[cut: only the first 33554432 bytes of this file were read]
<?xml version="1.0" encoding="utf-8"?>
<posts>
  <row Id="1" PostTypeId="1" AcceptedAnswerId="3" CreationDate="2014-06-12T00:08:33.097" Score="20" ViewCount="416" Body="&lt;p&gt;Can I extract a transform's settings from its handle? I'm trying to avoid upscaling images using the workaround, and I'd like to set my transform handle dynamically within some conditionals. (see &lt;a href=&quot;https://plus.google.com/115463622553757255119/posts/M4AWTz9PKPi&quot;&gt;this link&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I'm looping through a matrix field as in the example below, using a dropdown variable to determine which transform is best. When outputting the image I'd like to replace that '970' with pixel width specific to that the asset transform. I'm sure this is wrong, but I'm imagining something like &lt;code&gt;getTransform(transform).width.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.formation == 'twins' %} &#xA;    {% set transform = 'medium' %}&#xA;{% else%}&#xA;    {% set transform = 'large' %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;figure&amp;gt;&#xA;  &amp;lt;img src=&quot;{% if image.getWidth() &amp;gt; 970 %}{{ image.getUrl(transform) }}{% else %}{{ image.url }}{% endif %}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15" LastEditorUserId="250" LastEditDate="2014-06-12T22:53:03.583" LastActivityDate="2014-06-12T22:53:03.583" Title="Transform Info from Handle?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2" PostTypeId="1" CreationDate="2014-06-12T00:14:44.180" Score="29" ViewCount="1949" Body="&lt;p&gt;Has anyone successfully used Varnish with a Craft build? I'm trying to set up Varnish on my server but I'm very new at this. Can anyone share their config file or point me in the right direction? We have this build on an EC2 instance and so far it works great but we'd like to optimize it further.&lt;/p&gt;&#xA;" OwnerUserId="38" LastEditorUserId="141" LastEditDate="2014-09-25T15:45:25.720" LastActivityDate="2014-09-25T15:45:25.720" Title="How do I configure Varnish to work with Craft?" Tags="&lt;server&gt;&lt;varnish&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3" PostTypeId="2" ParentId="1" CreationDate="2014-06-12T00:18:00.650" Score="21" Body="&lt;p&gt;Sortof – you can find out what an image’s width would be with a transform applied to it via AssetFileModel’s - &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#getWidth&quot;&gt;getWidth()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#getHeight&quot;&gt;getHeigth()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;&#xA;    {%- if image.getWidth(transform) &amp;gt; 970 -%}&#xA;        {{ image.getUrl(transform) }}&#xA;    {%- else -%}&#xA;        {{ image.url }}&#xA;    {%- endif %}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for extra cleanliness points, you can update the code to use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#setTransform&quot;&gt;setTransform()&lt;/a&gt; instead of jumbling all that code into your &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if image.getWidth(transform) &amp;gt; 970 %}&#xA;    {% do image.setTransform(transform) %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T00:18:00.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4" PostTypeId="1" AcceptedAnswerId="12" CreationDate="2014-06-12T00:25:00.113" Score="17" ViewCount="6758" Body="&lt;p&gt;I would like to output a list of all the categories in a category group on the front end. How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="9" LastEditDate="2014-06-12T00:42:52.337" LastActivityDate="2014-06-12T00:45:55.630" Title="How do you list categories in a category group?" Tags="&lt;categories&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5" PostTypeId="1" AcceptedAnswerId="8" CreationDate="2014-06-12T00:32:56.147" Score="22" ViewCount="6484" Body="&lt;p&gt;What's the best known way to import masses of data into Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there tools that support the migration of content/users from say XML, JSON etc.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-10-24T15:26:10.330" Title="How do I import data into Craft?" Tags="&lt;import&gt;&lt;migration&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6" PostTypeId="2" ParentId="5" CreationDate="2014-06-12T00:35:26.333" Score="11" Body="&lt;p&gt;As far as ExpressionEngine goes, it looks like Mark Reeves has cooked up a &lt;a href=&quot;http://straightupcraft.com/craft-plugins/ee-craft-import&quot;&gt;starter plugin&lt;/a&gt; for that purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob Olde Hampsink made an &lt;a href=&quot;http://straightupcraft.com/craft-plugins/import&quot;&gt;import plugin&lt;/a&gt; as well that works with CSV's.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-06-12T00:35:26.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7" PostTypeId="2" ParentId="5" CreationDate="2014-06-12T00:38:53.690" Score="15" Body="&lt;p&gt;If you’re comfortable with PHP, Craft has some plugin APIs that make creating content relatively painless. For example, &lt;a href=&quot;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntriesService::saveEntry()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="3951" LastEditDate="2017-10-24T15:26:10.330" LastActivityDate="2017-10-24T15:26:10.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8" PostTypeId="2" ParentId="5" CreationDate="2014-06-12T00:40:38.310" Score="17" Body="&lt;p&gt;There is craftimport which is an 'unsupported' starting point for importing entries from an XML source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/clearbold/craftimport&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/clearbold/craftimport&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also Import:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/import&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can import from CSV sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://straightupcraft.com/craft-plugins&lt;/a&gt; for a list of current Craft plugins. &lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:06.097" LastActivityDate="2017-10-24T15:25:06.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10" PostTypeId="1" AcceptedAnswerId="15" CreationDate="2014-06-12T00:42:34.907" Score="101" ViewCount="14088" Body="&lt;p&gt;This issue becomes especially difficult when there are multiple environments, with multiple developers working on different features that affect the data structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The holy grail is a git-style distributed database setup, and I believe the Craft team is working on a solution that integrates with Craft Core. But it'd be great to hear how the community is handling this currently.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-06-12T01:59:09.523" LastActivityDate="2017-10-27T05:22:35.777" Title="What's the best practice for handling data migration and organization across development environments?" Tags="&lt;migration&gt;&lt;deployment&gt;&lt;environments&gt;&lt;database&gt;" AnswerCount="8" CommentCount="8" FavoriteCount="50" ContentLicense="CC BY-SA 3.0" />
  <row Id="11" PostTypeId="1" AcceptedAnswerId="37" CreationDate="2014-06-12T00:43:06.960" Score="19" ViewCount="4121" Body="&lt;p&gt;Is it possible to have one Craft install running multiple domains and/or subdomains?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example having the same Craft install running a blog Channel at blog.example.com and also an about Single at example.com/about.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-06-06T05:25:24.083" LastActivityDate="2018-06-06T05:25:24.083" Title="Can I run one Craft install on multiple domains and/or subdomains?" Tags="&lt;config&gt;&lt;server&gt;&lt;multi-site&gt;&lt;deployment&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12" PostTypeId="2" ParentId="4" CreationDate="2014-06-12T00:45:55.630" Score="27" Body="&lt;p&gt;You can fetch your categories on the front end using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot;&gt;craft.categories&lt;/a&gt;, which has a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories#group&quot;&gt;group param&lt;/a&gt; that can be used to filter categories by a given group handle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('myGroupHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the category group is limited to a single level, you can loop through those using a basic &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot;&gt;for-loop&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for category in categories %}&#xA;        &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the category group can be multi-level, you might be better off using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#nav&quot;&gt;{% nav %} tag&lt;/a&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% nav category in categories %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ category.title }}&#xA;&#xA;            {# Output a nested &amp;lt;ul&amp;gt; if this category has any children #}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T00:45:55.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13" PostTypeId="1" AcceptedAnswerId="17" CreationDate="2014-06-12T00:55:44.120" Score="33" ViewCount="3094" Body="&lt;p&gt;It's thrilling to click The Button and watch Craft update itself. I take advantage of multi-site configurations with every deploy, and my practice thus far is to...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upgrade Craft in production.&lt;/li&gt;&#xA;&lt;li&gt;Commit production file system changes via git.&lt;/li&gt;&#xA;&lt;li&gt;Choose Settings → Backup Database and download the backup file.&lt;/li&gt;&#xA;&lt;li&gt;Load the remote changes to my local environment via git.&lt;/li&gt;&#xA;&lt;li&gt;Clear out and locally import the .sql backup I downloaded in step #3.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I specifically update in production because I like thrills, and because I had previously done the opposite (upgrade locally, push live) and ran into problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been working for me pretty reliably and Craft upgrades always go smoothly, but I doubt that system updates on the production server are the &lt;em&gt;best&lt;/em&gt; idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-12T01:01:59.953" LastActivityDate="2014-06-12T03:58:30.607" Title="What's the best practice for upgrading a versioned Craft site?" Tags="&lt;environments&gt;&lt;upgrades&gt;&lt;database&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="24" ContentLicense="CC BY-SA 3.0" />
  <row Id="14" PostTypeId="1" AcceptedAnswerId="21" CreationDate="2014-06-12T00:58:06.207" Score="9" ViewCount="990" Body="&lt;p&gt;I'd like to output the Names of Matrix Blocks. I know you can &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot;&gt;filter by block types&lt;/a&gt; e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.type('text, heading') %}&#xA;{% if block.type == &quot;heading&quot; %}&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;{% else %}&#xA;    {{ block.text | markdown }}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I could use &lt;code&gt;{{ block.type }}&lt;/code&gt; and get the block type's handle but, I want to included the actual &lt;em&gt;Name&lt;/em&gt; of the block type itself too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.type.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this currently possible?&lt;/p&gt;&#xA;" OwnerUserId="12" LastActivityDate="2017-05-12T11:40:23.750" Title="Is it possible to output the name of a Matrix Block?" Tags="&lt;matrix&gt;&lt;custom-field&gt;&lt;blocks&gt;&lt;filter&gt;&lt;block-types&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15" PostTypeId="2" ParentId="10" CreationDate="2014-06-12T01:01:39.153" Score="49" Body="&lt;p&gt;My general approach for this, not just with Craft, but with all CMSes is to have a shared database for development. It's not the most ideal solution, since there can be overwriting of work, but it at least prevents schema changes from having to be redone across multiple environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once a site goes live, maintaining a dev environment alongside live becomes a bit more troublesome. My approach right now is generally to either make the changes in both places, or make the schema changes on live first and then copy the database back down to dev. (This of course requires that the changes not be anything that will break the current live site, and that both dev and live site are running the same version.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the upside, Craft does an awesome job of handling the schema changes that come with Craft updates. Basically the database version is checked against the file version, and the database changes can be reapplied on additional environments to update all the databases. This makes updates across environments lot easier than something like ExpressionEngine, which usually requires a multi-step copying of database down from live and back up to live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the future I'd love to see ways to encapsulate configurations in a migration similar to the updates, so that it's really just a matter of running the latest migrations to keep everything in sync.&lt;/p&gt;&#xA;" OwnerUserId="14" LastEditorUserId="167" LastEditDate="2014-06-18T20:01:46.577" LastActivityDate="2014-06-18T20:01:46.577" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16" PostTypeId="2" ParentId="10" CreationDate="2014-06-12T01:09:27.347" Score="9" Body="&lt;p&gt;I work with git for all my projects, I had to spend some time figuring out how to set up the folders and files, i.e.: what to gitignore. But it now works pretty well. All the core files are independent from the configuration/assets so it's pretty easy to work with once it's been setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in regards to the database, I have been working with separate, development and a production, databases. This allows me to play with new ideas that I can simply get rid of by the end of the day. After lots of content has been added to production I'll copy the data from production to dev to update it; this can be annoying but it does the job. This of course does not account for major structural changes. The way I've dealt with something like that is just replicating the structure in production after testing it in Development. Not the most pleasant experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly a git-style DB would be awesome for this, at least in concept. Not sure what would it actually look like in practice.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-06-12T01:09:27.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17" PostTypeId="2" ParentId="13" CreationDate="2014-06-12T01:09:47.673" Score="53" Body="&lt;p&gt;I know your method works flawlessly, but it scares the crap out of me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily Craft's update setup is magical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do is this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure my repo is clear of unstaged files, just so the update can be in a commit all by itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Run the update on my local dev environment (with a local database) (Test)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Commit the updated files and push&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Backup live database just in case&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Deploy the files on live. (I use Beanstalk, so it uploads the files for me, but you can also do a git pull if that's your method of deployment.) Craft detects that the database version doesn't match the files and puts up a maintenance message.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Visit /admin and click the update button&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Drink.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14" LastActivityDate="2014-06-12T01:09:47.673" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18" PostTypeId="1" AcceptedAnswerId="23" CreationDate="2014-06-12T01:10:28.707" Score="20" ViewCount="15233" Body="&lt;p&gt;If I'm used to PHP's &lt;code&gt;var_dump()&lt;/code&gt; and &lt;code&gt;print_r()&lt;/code&gt; to check the value of a variable, how can I evolve to inspect things in Craft where Twig's &lt;code&gt;dump&lt;/code&gt; isn't available?&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2016-12-14T06:38:06.627" Title="How can I check on the value of a template variable?" Tags="&lt;templating&gt;&lt;debugging&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19" PostTypeId="2" ParentId="14" CreationDate="2014-06-12T01:11:42.370" Score="2" Body="&lt;p&gt;It does not appear to be in the matrix block model. &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/matrixblockmodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-06-12T01:11:42.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20" PostTypeId="1" AcceptedAnswerId="11077" CreationDate="2014-06-12T01:17:42.140" Score="37" ViewCount="11318" Body="&lt;p&gt;I've played around with a few implementations but I still don't feel like either is right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first came across building the JSON itself. This would be in a file at &quot;craft/templates/entries.json&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {% for entry in craft.entries.section('news').find() %}&#xA;    {&#xA;      &quot;title&quot;: &quot;{{ entry.title | e('js') }}&quot;,&#xA;      &quot;body&quot;: &quot;{{ entry.body | e('js') }}&quot;&#xA;    } {% if not loop.last %},{% endif %}&#xA;  {% endfor %}&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This worked but I didn't feel right about writing my own JSON so I came up with this approach instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = [] %}&#xA;{% for entry in craft.entries.section('news').find() %}&#xA;{%&#xA;  set results = results | merge([{&#xA;    'title': entry.title,&#xA;    'body': entry.body&#xA;  }])&#xA;%}&#xA;{% endfor %}&#xA;{{ results | json_encode() | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, the JSON will definitely end up valid and as a bonus it'll be condensed but it's not very reusable and when I add fields I need to adjust it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What approach should I take to make a reliable way to query data from Craft and return json?&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="4246" LastEditDate="2016-02-10T20:49:37.353" LastActivityDate="2018-02-12T21:32:33.113" Title="How can I retrieve channel data in json format?" Tags="&lt;entries&gt;&lt;json&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="26" ContentLicense="CC BY-SA 3.0" />
  <row Id="21" PostTypeId="2" ParentId="14" CreationDate="2014-06-12T01:21:09.833" Score="13" Body="&lt;p&gt;&lt;code&gt;block.type&lt;/code&gt; is actually an alias for a &lt;code&gt;getType()&lt;/code&gt; function, which returns a new &lt;em&gt;MatrixBlockTypeModel&lt;/em&gt; object. Those will output their handle by default, which is why it's possible to compare &lt;code&gt;block.type&lt;/code&gt;  against block type handles. But MatrixBlockTypeModel also has a &lt;code&gt;handle&lt;/code&gt; property, so this is totally possible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.type.handle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="4208" LastEditDate="2017-05-12T11:40:23.750" LastActivityDate="2017-05-12T11:40:23.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22" PostTypeId="2" ParentId="11" CreationDate="2014-06-12T01:25:51.807" Score="3" Body="&lt;p&gt;No you can't. In Craft's early days, they had a MSM-like (ala ExpressionEngine) feature, but they eventually removed because it overcomplicated the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have to run a unique craft install per domain. However, these Craft installs can at the very least share the same craft/app folder: &lt;a href=&quot;http://buildwithcraft.com/help/sharing-craft-files&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/sharing-craft-files&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="71" LastActivityDate="2014-06-12T01:25:51.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23" PostTypeId="2" ParentId="18" CreationDate="2014-06-12T01:28:45.073" Score="13" Body="&lt;p&gt;There's &lt;a href=&quot;https://github.com/lukeholder/craft-dbug&quot;&gt;the dbug plugin&lt;/a&gt; which should give you what you are after, template side.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This plugin adds a helpful dbug method to your Craft templates. This&#xA;  will help you see in the dark - figure out what kind of variables you&#xA;  are dealing with, and what methods they implement.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="13" LastActivityDate="2014-06-12T01:28:45.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25" PostTypeId="1" AcceptedAnswerId="27" CreationDate="2014-06-12T01:51:55.317" Score="30" ViewCount="2174" Body="&lt;p&gt;How can I prevent my client from auto-updating Craft in production? I don't want them to run Craft updates on the production site, but the &quot;updates&quot; badge seems irresistible to them. I would prefer to run Craft updates in my dev environment, version control with Git, test, and then deploy at my leisure.&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2014-06-12T13:51:25.753" LastActivityDate="2018-06-06T16:12:06.970" Title="How can I prevent my client from auto-updating Craft in production?" Tags="&lt;auto-updates&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26" PostTypeId="2" ParentId="25" CreationDate="2014-06-12T02:03:15.117" Score="9" Body="&lt;p&gt;There is an &quot;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowAutoUpdates&quot;&gt;allowAutoUpdates&lt;/a&gt;&quot; config setting that you can set to false, which will disable auto-updating for a Craft install.  Manual updating will still work, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-12T02:03:15.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27" PostTypeId="2" ParentId="25" CreationDate="2014-06-12T02:05:18.960" Score="47" Body="&lt;p&gt;You can use the &lt;code&gt;config/general.php&lt;/code&gt; file to specify whether auto-updating is allowed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'allowAutoUpdates' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#allowAutoUpdates&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#allowAutoUpdates&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'allowUpdates' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-allowupdates&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-allowupdates&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Combined with a multi-environment configuration, this can be very helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Admittedly, this doesn't prevent the &quot;Updates are available&quot; notification from appearing... There have been some discussions about future versions of Craft possibly adding a separate config setting which will allow you to disable that notification as well.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-06-06T16:12:06.970" LastActivityDate="2018-06-06T16:12:06.970" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28" PostTypeId="2" ParentId="13" CreationDate="2014-06-12T02:20:24.900" Score="15" Body="&lt;p&gt;I actually keep all the craft system files gitignored. This way, all the assets are independent of the version of Craft and therefore of the updates. When it's time to run an update, I'll do it on dev first and then I'll run it in production knowing that it'll be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have not had a problem with this approach and it seems to me that it is a more elegant way of doing things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in my installations I keep separate databases, maintaining the structure the same across all environments. When I need to see the same data from production, in dev, I'll import it manually. I can't say that this side of things is the easiest to work with but since I've had to deal with small databases until now it hasn't been much trouble. I am beginning a new, larger project so... things may change soon. :P&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my usual gitignore file for Crafty projects.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# CMS related files&#xA;craft/app/*&#xA;craft/storage/*&#xA;public/content/*&#xA;craft/config/license.key&#xA;&#xA;# OS or program files&#xA;.DS_store&#xA;.tmproj&#xA;Thumbs.db&#xA;.Spotlight-V100&#xA;.Trashes&#xA;&#xA;# Grunt&#xA;node_modules&#xA;build&#xA;&#xA;# Others&#xA;*.sass-cache&#xA;*.sublime-project&#xA;*.sublime-workspace&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The folder &lt;code&gt;public/content&lt;/code&gt; is where all the assets generated by craft go. These get ignored since the real data is in storage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, storage is ignored here, as I said before, that's because I keep separate databases. That works for me but it's certainly not ideal for larger environments.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-06-12T02:20:24.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29" PostTypeId="1" AcceptedAnswerId="30" CreationDate="2014-06-12T02:38:49.393" Score="9" ViewCount="1592" Body="&lt;p&gt;This is actually a fairly crucial matter, since relative paths definitely won't work with languages, unless you really want all assets in a given Source to be localized or at least copied to each language folder. As well, hard paths in the CP will fail with multi-environment config where dev, staging, and deployment sites can have different full storage paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things may appear to operate at first with relative paths, for example, and it may feel like a safe way from experience with other systems, but then you'll find that features like automatic generation of image transforms that you've set up (icons, controlled sizes, etc.) will fail.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-06-12T07:32:39.973" LastActivityDate="2017-05-22T09:12:00.717" Title="What accurately will set asset paths for multilingual sites?" Tags="&lt;image-transforms&gt;&lt;localization&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30" PostTypeId="2" ParentId="29" CreationDate="2014-06-12T03:13:31.797" Score="9" Body="&lt;p&gt;An answer that works is to make your own environment variables, setting those apart from language variables, and as needed for each of your multiple sites. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can use these variables to make full paths for your Asset definitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need definitions for both the file system path and URL path. Let's name them appropriately so we don't get confused with {siteUrl}, which is common in a multilingual config or {{siteUrl}} which is the Twig variable resulting from whatever sets it for a given Craft site for templates, but not usable within CP configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example config:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;return array(&#xA;    'cpTrigger' =&gt; 'yourTrigger',&#xA;    'environmentVariables' =&gt; array(&#xA;        'siteStore' =&gt; '/storage/yourId/www/yoursite_html/',&#xA;        'sitePath'  =&gt; '&lt;a href=&quot;http://yoursite.com/&quot;&gt;http://yoursite.com/&lt;/a&gt;',&#xA;    ),&#xA;    'siteUrl' =&gt; array(&#xA;        'en' =&gt; '&lt;a href=&quot;http://yoursite.com/en/&quot;&gt;http://yoursite.com/en/&lt;/a&gt;',&#xA;        'de' =&gt; '&lt;a href=&quot;http://yoursite.com/de/&quot;&gt;http://yoursite.com/de/&lt;/a&gt;',&#xA;        'fi' =&gt; '&lt;a href=&quot;http://yoursite.com/fi/&quot;&gt;http://yoursite.com/fi/&lt;/a&gt;',&#xA;    ),&#xA;);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CP on a multi-language site, we'd fill in Assets-&gt;Sources-&gt;Local Images-&gt;File System path as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{siteStore}yourResources/images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to match, the URL would be set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{sitePath}yourResources/images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this, your paths for images and their generated transforms will be stable and correct across languages as well as the default URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To extend across multiple development, staging, and live sites, you'd just replicate this extra config in the usual way, filling in suitable siteStore and sitePath values for each environment.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-06-12T05:31:26.907" LastActivityDate="2014-06-12T05:31:26.907" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="31" PostTypeId="2" ParentId="11" CreationDate="2014-06-12T03:20:32.153" Score="10" Body="&lt;p&gt;Yes, it is possible to have a Craft install on multiple domains and subdomains as long as you only access the control panel from a single domain and you only have a single installation of craft that all the domains and subdomains use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The limitation is all domains would be using the same url router and content - although for multi language content having different domains might be the way to switch on which language to use.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-06-12T03:20:32.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="32" PostTypeId="2" ParentId="29" CreationDate="2014-06-12T03:36:10.490" Score="12" Body="&lt;p&gt;If each locale uses the same TLD but uses a subfolder for localized content (i.e. example.com/en, example.com/de, etc.). You can move between development, staging, and production environments without having to change settings in the admin panel by simply using an absolute path in the Admin assets source URL setting (i.e. &lt;code&gt;/assets/img/uploads&lt;/code&gt;) and a relative path for the File System Path there (i.e. &lt;code&gt;../public_html/assets/img/uploads&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more complicated setups, such as independent site URLs (i.e. example.com, example.co.uk, etc) for each locale, I've set asset paths by setting an assetsUrl environment variable in &lt;code&gt;general.php&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'example.com' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'        =&amp;gt; '//example.co.uk/',&#xA;        'assetsUrl'    =&amp;gt; '//example.com/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the Admin panel's assets source settings, I set a relative path for the File System Path and use the &lt;code&gt;{assetsUrl}&lt;/code&gt; environment variable for the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7u9YP.png&quot; alt=&quot;Screenshot of Craft Assets Source Settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this setup you can also move between development, staging, and production environments without having to change settings in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once &lt;code&gt;{assetsUrl}&lt;/code&gt; is set in the Admin panel for the URL, writing &lt;code&gt;{{ file.url }}&lt;/code&gt; in your template will return the full URL using the assets source URL setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, you can link to assets (e.g. scripts) in your templates using the &lt;code&gt;assetsUrl&lt;/code&gt; environment variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.environmentVariables['assetsUrl'] }}assets/js/main.js&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="93" LastEditorUserId="85" LastEditDate="2014-06-12T15:17:51.333" LastActivityDate="2014-06-12T15:17:51.333" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="33" PostTypeId="1" AcceptedAnswerId="35" CreationDate="2014-06-12T03:57:44.093" Score="18" ViewCount="6231" Body="&lt;p&gt;I'd like to create a form for users to load events (that I will moderate and publish).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2014-06-12T14:07:36.027" Title="How do you create a front-end form for users to submit content?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="34" PostTypeId="2" ParentId="13" CreationDate="2014-06-12T03:58:30.607" Score="11" Body="&lt;p&gt;I personally use a slightly different method than what Jeremy recommends.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Clean repo on the git side of things: no unstaged or non committed files&lt;/li&gt;&#xA;&lt;li&gt;Backup live DB and import in dev&lt;/li&gt;&#xA;&lt;li&gt;Update dev (test)&lt;/li&gt;&#xA;&lt;li&gt;Update production&lt;/li&gt;&#xA;&lt;li&gt;Commit &amp;amp; deploy&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Not encountered any problem so far and Craft runs its tests on both environments.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-06-12T03:58:30.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="35" PostTypeId="2" ParentId="33" CreationDate="2014-06-12T04:17:12.027" Score="19" Body="&lt;p&gt;&lt;strong&gt;If the users are authenticated&lt;/strong&gt; and have permission to post to the event section, you would use an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;noreferrer&quot;&gt;entry form&lt;/a&gt; to accept posts from the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example from the above linked page...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;viewentry/{id}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;10&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;body&quot;&amp;gt;Body&amp;lt;/label&amp;gt;&#xA;    &amp;lt;textarea id=&quot;body&quot; name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Deliberately removed from the example above is this &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&lt;/code&gt;, since it'd be redundant and make it more obvious how one might tamper with the form. Setting &lt;code&gt;enabled&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; would allow submitted posts to go live immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you'd like to accept guest entries&lt;/strong&gt; you can use Pixel and Tonic's &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;noreferrer&quot;&gt;GuestEntries plugin&lt;/a&gt;. Keep in mind that the submissions will still be assigned to the Craft author (user with appropriate permissions) that you designate. The front-end form would look nearly identical, with a hidden action of &lt;code&gt;guestEntries/saveEntry&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;viewentry/{id}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;10&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;body&quot;&amp;gt;Body&amp;lt;/label&amp;gt;&#xA;    &amp;lt;textarea id=&quot;body&quot; name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin's settings let you define default authors and entry statuses for each channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tMGL9.png&quot; alt=&quot;GuestEntries plugin settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GuestEntries also adds a &lt;code&gt;guestEntries.beforeSave&lt;/code&gt; event that you can hook into with your own plugin and further act on submissions before they're added to the database.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-12T14:07:36.027" LastActivityDate="2014-06-12T14:07:36.027" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="36" PostTypeId="2" ParentId="18" CreationDate="2014-06-12T04:58:52.663" Score="7" Body="&lt;p&gt;There's a plugin called &quot;craft inspector&quot; &lt;a href=&quot;https://github.com/adrianmacneil/craft-inspector&quot;&gt;https://github.com/adrianmacneil/craft-inspector&lt;/a&gt; that has come in handy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request | inspect }}&#xA;{{ inspect(craft.request) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-06-12T04:58:52.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="37" PostTypeId="2" ParentId="11" CreationDate="2014-06-12T06:48:26.863" Score="12" Body="&lt;p&gt;&lt;strong&gt;Update for Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 includes native support for multi-site installation. &lt;a href=&quot;https://docs.craftcms.com/v3/sites.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's a link&lt;/a&gt; to the official docs and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19601/multi-site-setup-in-craft3&quot;&gt;here's a link&lt;/a&gt; to another question with more resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Old answer for Craft 1 &amp;amp; 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Credit to @LukeHolder for the original answer, but here's a bit more detailed and technical answer. Note, this might not be possible on all hosts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Place the craft folder above both domains, add Craft's index.php file to both domain web roots and set the $craftPath variables in them to point to the same craft folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make a template (say for a blog) only load on its own subdomain instead of whenever any of its slugs are requested on &lt;em&gt;any&lt;/em&gt; domains you can run this quick check:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set domain = craft.request.getServerName() %}&#xA;&#xA;{% if not domain starts with 'blog' %}&#xA;    {% redirect '404' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will make &quot;blog.example.com/some-blog-post&quot; load, but &quot;example.com/some-blog-post&quot; will redirect to the 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Links to posts can formatted like this to add the subdomain to the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://blog.example.com/{{ entry.uri }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While this isn't an end all solution, it is a functional workaround, especially if it's only for page or two. Use Craft 3 if you can.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-06-06T05:24:23.733" LastActivityDate="2018-06-06T05:24:23.733" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="38" PostTypeId="1" AcceptedAnswerId="49" CreationDate="2014-06-12T07:35:05.327" Score="9" ViewCount="767" Body="&lt;p&gt;Is it possible to separate the public site and the Control Panel on separate domains (i.e. &lt;code&gt;www.domain.com&lt;/code&gt; and &lt;code&gt;admin.domain.com&lt;/code&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;baseCpUrl&lt;/code&gt; you're able to force the admin URL to &lt;code&gt;admin.domain.com&lt;/code&gt;, but is it possible to also remove the redirect from &lt;code&gt;www.domain.com/admin&lt;/code&gt; and completely remove all possible ways to access/redirect to the CP from &lt;code&gt;www.domain.com&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I guess setting &lt;code&gt;cpTrigger&lt;/code&gt; to a random string would be one way, but then you also end up with the admin address similar to &lt;code&gt;admin.domain.com/hjkads78ads5ads785ads68ads67&lt;/code&gt;)&lt;/p&gt;&#xA;" OwnerUserId="134" LastActivityDate="2016-12-14T06:44:54.277" Title="How can I run the Control Panel from a separate domain?" Tags="&lt;config&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="39" PostTypeId="1" AcceptedAnswerId="41" CreationDate="2014-06-12T09:31:24.593" Score="11" ViewCount="1292" Body="&lt;p&gt;I have a matrix field with one &quot;event&quot; block type that contains several fields. One of those fields is a date field. Is there a way to get just blocks with upcoming dates?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-12-18T03:14:35.107" Title="Search matrix for blocks with upcoming dates" Tags="&lt;matrix&gt;&lt;date&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="40" PostTypeId="1" AcceptedAnswerId="50" CreationDate="2014-06-12T09:38:31.403" Score="6" ViewCount="1363" Body="&lt;p&gt;How would you setup a section's entry type to auto-generate the titles based on the title (or slug) of another entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we have a &lt;strong&gt;Software&lt;/strong&gt; section with entries. We also have a &lt;strong&gt;Releases&lt;/strong&gt; section. Each release entry has a related software entry, along with a versionNumber text field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally each release's title would be of the form : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{software.title} {versionNumber}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where {software.title} is the title from associated entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/baS7i.png&quot; alt=&quot;Title Format input example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've looked at all sorts of combinations to get that value out, but any usage seems to either be ignored or throw an error on publish.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-12T12:19:01.793" Title="Using auto-generated titles against entry field type values" Tags="&lt;titles&gt;&lt;auto-generate&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="41" PostTypeId="2" ParentId="39" CreationDate="2014-06-12T09:40:25.573" Score="13" Body="&lt;p&gt;Here’s how you would do that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set futureEvents = entry.myMatrixField.myDateField('&amp;gt;= '~now) %}&#xA;&#xA;{% for event in futureEvents %}&#xA;    {{ event.description }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This actually hadn’t worked as I expected to, but it does as of Craft 2.3.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="9" LastEditDate="2014-12-18T03:14:35.107" LastActivityDate="2014-12-18T03:14:35.107" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="42" PostTypeId="2" ParentId="40" CreationDate="2014-06-12T09:46:52.627" Score="0" Body="&lt;p&gt;The &quot;Inherit Title&quot; plugin might work for you but you will have to test it for your needs. It hides the title field and then uses the content of other fields in the entry to automatically generate the title for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Inherit-Title/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/rkingon/Craft-Plugin--Inherit-Title/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the read.me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have a &quot;firstName&quot; and &quot;lastName&quot; field, and you would like the Title to auto populate with &quot;firstName lastName&quot; you could use: &quot;{{firstName}} {{lastName}}&quot; as your settings configuration.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-06-12T09:46:52.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="43" PostTypeId="2" ParentId="39" CreationDate="2014-06-12T09:51:43.143" Score="2" Body="&lt;p&gt;Would this do it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.matrixFieldHandle %}&#xA;{% for block in blocks if block.yourDateField|date &amp;gt;= now|date %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="94" LastActivityDate="2014-06-12T09:51:43.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="44" PostTypeId="1" AcceptedAnswerId="46" CreationDate="2014-06-12T09:58:12.153" Score="25" ViewCount="7921" Body="&lt;p&gt;I'm currently building a site with two languages, and I need a language switcher so wherever you enter the website you can switch the language easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've come this far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in craft.i18n.getSiteLocales() %}&#xA;    &amp;lt;li {{ locale == craft.i18n.getCurrentLocale() ? 'class=&quot;active&quot;' }}&amp;gt;&#xA;        &amp;lt;a href=&quot;/{{ locale }}/{{ entry.slug }}&quot;&amp;gt;&#xA;           {% if loop.first %}DE{% else %}FR{% endif %}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem here is that &lt;code&gt;{{ entry.slug }}&lt;/code&gt; only returns the slug for the current language and doesn't loop trough the languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I'm on french it returns &lt;code&gt;/bonjour&lt;/code&gt; twice and on german it returns &lt;code&gt;/hallo&lt;/code&gt; twice. Why is that?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="125" LastEditDate="2014-07-16T14:42:46.573" LastActivityDate="2019-07-23T19:42:50.913" Title="How can I build a language switcher?" Tags="&lt;localization&gt;&lt;navigation&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="45" PostTypeId="2" ParentId="38" CreationDate="2014-06-12T10:02:25.150" Score="1" Body="&lt;p&gt;I'm pretty sure you could achieve that using an .htaccess 301 redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the domain.com's .htaccess file add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;  RewriteEngine on&#xA;  Redirect 301 /admin http://admin.domain.com/admin&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.htaccess rules are processed in order, so you would want this closer to the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might run into an open_basedir restriction from transversing the file system across virtual hosts. If that is the case, how you handle that will depend on your specific hosting setup, so you will need to research the best approach for your config.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-06-12T10:02:25.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="46" PostTypeId="2" ParentId="44" CreationDate="2014-06-12T10:15:19.197" Score="29" Body="&lt;p&gt;I am building my first multi-language site with Craft as well. This is from a thread over at Google+, so I didn't come up with this myself but it works very well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block locale__switch %}&#xA;&#xA;    {# Loop through all of the site locales, except the current one #}&#xA;    {% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}&#xA;    {% for locale in otherLocales %}&#xA;&#xA;        {# Find the current entry in the other locale #}&#xA;        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;&#xA;        {# Make sure that it's actually localized to this locale #}&#xA;        {% if localeEntry.locale == locale %}&#xA;&#xA;            {# Output a link to it #}&#xA;            &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;        {% else %}&#xA;&#xA;            {# Output a link to the hompage #}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I set this up in a block to implement the switch in various templates. It loops through all the languages minus the current one and outputs the links. It also matches the entries by ID which is why you can have different slugs. Hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yay for the craftcms.stackexchange site!&lt;/p&gt;&#xA;" OwnerUserId="174" LastEditorUserId="22" LastEditDate="2014-06-13T12:50:17.623" LastActivityDate="2014-06-13T12:50:17.623" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="47" PostTypeId="1" AcceptedAnswerId="48" CreationDate="2014-06-12T10:26:25.937" Score="7" ViewCount="679" Body="&lt;p&gt;I'm looking for documentation on how to use operators in hashes in Twig. Someone mentioned this in the Google+ support group the other day and I was unable to find any docs or examples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventParams = {&#xA;  section       : 'events',&#xA;  order         : 'startDateTime asc',&#xA;  startDateTime : '&amp;gt;= '~now&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I wanted the startDateTime hash to use a range of dates, say ( &lt;code&gt;&amp;gt;= now&lt;/code&gt; and &lt;code&gt;&amp;lt;= now + 5 days&lt;/code&gt; ) how would I specify that in the startDateTime hash?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a hash syntax that is specific to Twig?&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="22" LastEditDate="2014-06-13T16:57:27.930" LastActivityDate="2014-09-22T07:59:32.097" Title="How can I use operators within Twig hashes?" Tags="&lt;hash&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="48" PostTypeId="2" ParentId="47" CreationDate="2014-06-12T11:23:33.870" Score="11" Body="&lt;p&gt;That's what you are after:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;startDateTime : 'and', '&amp;gt;= ' ~ now, '&amp;lt;= ' ~ now | date_modify('+5 days')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-12T11:23:33.870" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="49" PostTypeId="2" ParentId="38" CreationDate="2014-06-12T12:04:11.853" Score="6" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#baseCpUrl&quot; rel=&quot;noreferrer&quot;&gt;baseCpUrl&lt;/a&gt; config setting to tell Craft to always generate CP URLs pointing to &lt;a href=&quot;http://admin.domain.com&quot; rel=&quot;noreferrer&quot;&gt;http://admin.domain.com&lt;/a&gt;, and you can create a .htaccess redirect on &lt;a href=&quot;http://domain.com&quot; rel=&quot;noreferrer&quot;&gt;http://domain.com&lt;/a&gt; pointing all requests to /admin* to &lt;a href=&quot;http://admin.domain.com/admin/&quot; rel=&quot;noreferrer&quot;&gt;http://admin.domain.com/admin/&lt;/a&gt;*, but it is &lt;strong&gt;not&lt;/strong&gt; currently possible to get rid of the CP Trigger segment at this time. Craft relies on that to determine if the current request is a CP request.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T12:04:11.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="50" PostTypeId="2" ParentId="40" CreationDate="2014-06-12T12:19:01.793" Score="9" Body="&lt;p&gt;You can access the Software entry’s title exactly the same way you would in your front-end templates: &lt;code&gt;software.first.title&lt;/code&gt;. The only difference is the single-brace tags syntax, which you don’t even &lt;em&gt;have&lt;/em&gt; to use if you don’t want to. Both of these are identical:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{software.first.title}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{{ object.software.first.title }}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T12:19:01.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="51" PostTypeId="1" AcceptedAnswerId="78" CreationDate="2014-06-12T12:36:27.413" Score="15" ViewCount="1138" Body="&lt;p&gt;This is how I query elements from multiple channels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section(['publication','text', 'exhibition']).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I now want to sort all these entries by a custom date field. If all channels had the same date field, I would just append &lt;code&gt;order('releaseDate desc')&lt;/code&gt; to the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as I have chosen to set up individual date fields (i.e. &lt;code&gt;publicationReleaseDate&lt;/code&gt;, &lt;code&gt;exhibitionOpeningDate&lt;/code&gt;) I cannot figure out how to join and sort them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I could just use the same field in all channels, but then I can't have individual field names and instructions per channel.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-12T16:58:50.227" LastActivityDate="2014-06-12T18:32:22.243" Title="How do you sort elements queried from multiple channels?" Tags="&lt;elementcriteriamodel&gt;&lt;join&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="52" PostTypeId="1" AcceptedAnswerId="58" CreationDate="2014-06-12T12:37:19.173" Score="38" ViewCount="9101" Body="&lt;p&gt;What would be the equivalent in Craft of ExpressionEngine's &lt;a href=&quot;http://ellislab.com/expressionengine/user-guide/add-ons/channel/entry_linking.html&quot;&gt;Next/Previous entry linking&lt;/a&gt;? I was looking at &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; (and their aliases &lt;code&gt;next&lt;/code&gt; and &lt;code&gt;prev&lt;/code&gt;) (via the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;EntryModel docs&lt;/a&gt;), but when I try the obvious:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.prev.url }}&quot;&amp;gt;Previously: {{ entry.prev.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just get the current entry's data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What piece am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="63" LastEditorUserId="132" LastEditDate="2014-07-14T12:02:27.807" LastActivityDate="2021-03-11T10:30:13.380" Title="How to link to previous/next entries in a section?" Tags="&lt;pagination&gt;&lt;navigation&gt;&lt;entrymodel&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="53" PostTypeId="1" CreationDate="2014-06-12T12:41:05.060" Score="4" ViewCount="240" Body="&lt;p&gt;How can I implement Google+ comments into Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="250" LastEditDate="2014-06-13T14:10:59.647" LastActivityDate="2015-01-07T20:34:11.623" Title="How do I implement Google+ comments on a Craft site?" Tags="&lt;comments&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="54" PostTypeId="2" ParentId="52" CreationDate="2014-06-12T12:56:25.097" Score="19" Body="&lt;p&gt;You can set the &lt;code&gt;prev.url&lt;/code&gt; at the top of the template, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = {section: 'blog', order: 'postDate'} %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add a link if &lt;code&gt;prev&lt;/code&gt; is available:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if prev %}&#xA;   &amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;{{ prev.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2017-10-15T13:36:30.837" LastActivityDate="2017-10-15T13:36:30.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="55" PostTypeId="1" AcceptedAnswerId="62" CreationDate="2014-06-12T13:07:38.080" Score="16" ViewCount="6082" Body="&lt;p&gt;I'd like to be able to use git version control with Craft. Is this possible and if it is what is the best approach to ensure that all files/assets and the database are properly synced across local, staging and production servers?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2014-06-12T21:22:53.327" Title="Git Workflow and Multi Environment - how to approach" Tags="&lt;git&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="20" ContentLicense="CC BY-SA 3.0" />
  <row Id="56" PostTypeId="1" AcceptedAnswerId="66" CreationDate="2014-06-12T13:18:20.620" Score="8" ViewCount="2011" Body="&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://stackoverflow.com/questions/21882510/craft-order-by-title-that-is-a-number&quot;&gt;I originally asked this on Stack Overflow&lt;/a&gt;, but I'm hoping for more response here.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, I'm trying to order entries by the title. Each title is a number, but the sort function handles it like a string. Because of that &lt;code&gt;100&lt;/code&gt; shows up before &lt;code&gt;2&lt;/code&gt;, &lt;code&gt;31&lt;/code&gt; before &lt;code&gt;4&lt;/code&gt;, and so on.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySection').order('title').find() %}&#xA;    &amp;lt;h2&amp;gt;§{{entry.title}}&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this without extending  twig?&lt;/p&gt;&#xA;" OwnerUserId="195" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-06-12T15:07:30.360" Title="How can I order entries by title when each title is numeric?" Tags="&lt;sorting&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="57" PostTypeId="2" ParentId="20" CreationDate="2014-06-12T13:18:48.580" Score="26" Body="&lt;p&gt;I just threw together a add-on that will provide a Twig filter called &lt;code&gt;prune&lt;/code&gt; to allow you to more easily do what you're asking here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mattstauffer/craftcms-prune&quot;&gt;https://github.com/mattstauffer/craftcms-prune&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;prune&lt;/code&gt; you can now just do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.section('news').find() | prune(['title', 'body']) | json_encode() | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just pass in an array of the fields you want to pluck out. It's pretty new and could use some love, but it'll get the basics done for sure.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2014-06-12T13:18:48.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="58" PostTypeId="2" ParentId="52" CreationDate="2014-06-12T13:24:37.450" Score="57" Body="&lt;p&gt;You are probably not using this within a craft.entries loop. Position it inside a loop or set custom parameters for your prev and next elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set parameters for prev/next elements list #}&#xA;{% set params = craft.entries.section('blog').order('title asc') %}&#xA;&#xA;{# Get the prev/next elements #}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{# And make sure to only output the links if the element exists #}&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="9" LastEditDate="2014-06-12T18:34:48.250" LastActivityDate="2014-06-12T18:34:48.250" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="59" PostTypeId="1" AcceptedAnswerId="68" CreationDate="2014-06-12T13:33:17.997" Score="26" ViewCount="3333" Body="&lt;p&gt;I'm coming to Craft as someone experienced with Expression Engine templates. When I'm coding for EE I try to avoid certain big ticket performance hits, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using embeds excessively.&#xA;Using the disable parameter.&#xA;Using simple conditionals vs. advanced conditional when possible.&#xA;Keeping a close eye on the query count.&#xA;Etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Craft/Twig world, are there similar common pitfalls to avoid when thinking about template performance? What kind of things should I watch for?&lt;/p&gt;&#xA;" OwnerUserId="196" LastEditorUserId="250" LastEditDate="2014-06-13T14:10:56.807" LastActivityDate="2014-06-13T14:10:56.807" Title="What are the most common template performance gotchas to avoid?" Tags="&lt;performance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="60" PostTypeId="2" ParentId="20" CreationDate="2014-06-12T13:36:29.027" Score="11" Body="&lt;p&gt;You could also loop through all fields and output it depending on the field-type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;&#xA;[&#xA;    {% for entry in craft.entries.section('news').limit(1) %}&#xA;    {&#xA;        {# General Fields #}&#xA;        'slug': {{ entry.slug | json_encode() | raw }},&#xA;        'postDate': {{ entry.postDate | json_encode() | raw }},&#xA;        'title': {{ entry.title | json_encode() | raw }},&#xA;        'author': {{ entry.author.name | json_encode() | raw }},&#xA;&#xA;&#xA;        {# Your Fields #}&#xA;        {% for field in entry.getType().getFieldLayout().getFields() %}&#xA;            {% set field_attr = attribute(entry, field.field.handle) %}&#xA;&#xA;            {% switch field.field.type %}&#xA;                {% case 'Assets' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for asset in field_attr %} { 'title': {{ asset.title | json_encode() | raw }}, 'url': {{ asset.url | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Categories' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for category in field_attr %} { 'title': {{ category.title | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Checkboxes' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for option in field_attr %} { 'label': {{ option.label | json_encode() | raw }}, 'value': {{ option.value | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Date' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: {{ field_attr | json_encode() | raw }},&#xA;&#xA;                {% case 'DropDown' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { 'label': {{ field_attr.label | json_encode() | raw }}, 'value': {{ field_attr.value | json_encode() | raw }} },&#xA;&#xA;                {% case 'Entries' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for field_entry in field_attr %} { 'title': {{ field_entry.title | json_encode() | raw }}, 'slug': {{ field_entry.slug | json_encode() | raw }}, 'url': {{ field_entry.url | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Matrix' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: {{ 'This is a matrix-field' | json_encode() | raw }},&#xA;&#xA;                {% case 'MultiSelect' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for option in field_attr %} { 'label': {{ option.label | json_encode() | raw }}, 'value': {{ option.value | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Radiobutton' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { 'label': {{ field_attr.label | json_encode() | raw }}, 'value': {{ field_attr.value | json_encode() | raw }} },&#xA;&#xA;                {% case 'Tags' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for tag in field_attr %} { 'name': {{ tag.name | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% case 'Users' %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: { {% for user in field_attr %} { 'name': {{ user.name | json_encode() | raw }}, 'id': {{ user.id | json_encode() | raw }} }, {% else %}null{% endfor %} },&#xA;&#xA;                {% default %}&#xA;                    &quot;{{ field.field.handle | escape('js') }}&quot;: {{ field_attr | json_encode() | raw }},&#xA;            {% endswitch %}&#xA;        {% endfor %}&#xA;    }&#xA;    {% endfor %}&#xA;]&#xA;&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You might need to customize it, depending on what attributes you need&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it work with Matrix you'd need to create a Matrix case and copy the whole loop inside that case and set it to use the block var.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-12T13:36:29.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="61" PostTypeId="2" ParentId="59" CreationDate="2014-06-12T14:09:22.407" Score="19" Body="&lt;p&gt;Template performance isn't a huge worry in Craft thanks to the built-in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#cache&quot;&gt;cache tag&lt;/a&gt;. Even if some code is taking time to process, it can be wrapped in that tag to greatly improve performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to more thoroughly answer your question, the scenarios where that tag might have to be used generally revolve around the number of DB queries. Craft's relationship engine it's pretty great, but it can lead to templates making many DB calls. Sometime's they're unavoidable but you can squeeze a bit more performance out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt; (used to retrieve entries, assets, users etc) has some helpful, performance-enhancing methods. For example, instead of retrieving all entries for a section and then only selecting the first one, you can use the &lt;code&gt;.first()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetches all entries #}&#xA;{% set firstEntry = craft.entries.section('yourSection').find()[0] %}&#xA;&#xA;{# Only fetches first entry #}&#xA;{% set firstEntry = craft.entries.section('yourSection').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-06-12T14:09:22.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="62" PostTypeId="2" ParentId="55" CreationDate="2014-06-12T14:19:49.547" Score="25" Body="&lt;p&gt;Matt has a point, this is similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What's the best practice for handling data migration and organization across development environments?&lt;/a&gt;, but that question focuses mainly on how to handle the database (definitely see those answers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally speaking...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Multi-Environment Config&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set yourself up with &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;noreferrer&quot;&gt;Multi-Environment Configs&lt;/a&gt; in both &lt;code&gt;craft/config/general.php&lt;/code&gt; and &lt;code&gt;craft/config/db.php&lt;/code&gt; so that you don't have to be updating path settings every time you migrate data between environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be sure to set some &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;noreferrer&quot;&gt;Environment-Specific Variables&lt;/a&gt; for the site URL and server path for each environment. That way you can use those variables in the control panel settings (the Site URL setting in the &lt;em&gt;Setting → System → General&lt;/em&gt; and Assets paths in &lt;em&gt;Settings → Assets → Your asset settings&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample &lt;code&gt;general.php&lt;/code&gt; file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'usePathInfo'=&amp;gt; true,&#xA;        'cpTrigger' =&amp;gt; 'example-admin',&#xA;        'allowAutoUpdates' =&amp;gt; false,&#xA;    ),&#xA;&#xA;    'example.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'useCompressedJs' =&amp;gt; false,&#xA;        'allowAutoUpdates' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://example.dev/',&#xA;            'sitePath' =&amp;gt; '/Applications/MAMP/htdocs/example/html/',&#xA;        ),&#xA;    ),&#xA;&#xA;    'staging.example.com' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://staging.example.com/',&#xA;            'sitePath' =&amp;gt; '/var/www/vhosts/staging.example.com/html/',&#xA;        ),&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And an example &lt;code&gt;db.php&lt;/code&gt; file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix'   =&amp;gt; 'craft',&#xA;    ),&#xA;&#xA;    'example.dev' =&amp;gt; array(&#xA;        'server'        =&amp;gt; 'localhost',&#xA;        'user'          =&amp;gt; 'root',&#xA;        'password'      =&amp;gt; 'root',&#xA;        'database'      =&amp;gt; 'example_dev',&#xA;    ),&#xA;&#xA;    'staging.example.com' =&amp;gt; array(&#xA;        'server'        =&amp;gt; 'localhost',&#xA;        'user'          =&amp;gt; 'example_staging',&#xA;        'password'      =&amp;gt; '********************',&#xA;        'database'      =&amp;gt; 'example_staging',&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more on Multi-Environment Configs see &lt;a href=&quot;http://straightupcraft.com/learn-craft-cms/multi-environment-workflows&quot; rel=&quot;noreferrer&quot;&gt;Multi-Environment Workflows&lt;/a&gt; on Straight Up Craft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Version control with Git&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can definitely use Git. I version everything except for user file uploads and &lt;code&gt;/craft/storage&lt;/code&gt; and it works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My master &lt;code&gt;.gitignore&lt;/code&gt; file in the root of my project looks like (specific to my setup, YMMV)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.DS_Store&#xA;&#xA;# Node/Sass&#xA;node_modules&#xA;html/css/public/main.css.map&#xA;&#xA;# Config&#xA;dandelion.yml&#xA;sftp-config.json&#xA;craft/config/db.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in each directory I want to ignore the contents of (craft storage and user uploads) I put a &lt;code&gt;.gitignore&lt;/code&gt; file with...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Ignore everything&#xA;*&#xA;&#xA;# But not this file&#xA;!.gitignore&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And as Matt pointed out in his other comment on your question, do see the answers on the related question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13/whats-the-best-practice-for-upgrading-a-versioned-craft-site&quot;&gt;What's the best practice for upgrading a versioned Craft site?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-06-12T21:22:53.327" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="63" PostTypeId="2" ParentId="53" CreationDate="2014-06-12T14:35:42.207" Score="6" Body="&lt;p&gt;This is a bit tricky, and there may be some tradeoffs that I'm unaware of, but the following code works for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;https://apis.google.com/js/plusone.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&amp;lt;div style=&quot;width:100%&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;g-comments&quot;&#xA;       data-href=&quot;{{ entry.url }}&quot;&#xA;       data-width=&quot;675&quot;&#xA;       data-first_party_property=&quot;BLOGGER&quot;&#xA;       data-view_type=&quot;FILTERED_POSTMOD&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two things to note about the code above. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You want to pass the url that will be associated with the comments to the &lt;code&gt;data-href&lt;/code&gt; attribute. The example above assumes you are on a page where &lt;code&gt;{{ entry.url }}&lt;/code&gt; is the value you want.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The line that references BLOGGER is required: &lt;code&gt;data-first_party_property=&quot;BLOGGER&quot;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I can't explain why that is, but the odd specificity of it may also be a reason why this isn't an easy thing to figure out how to do, as it may suggest this is an unsupported method of adding Google Comments to your site or that the method to add Google Comments to your site will change at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my searches however, this was the only method I found to do it at all and it seems to be used by several people and work just fine at the time of this post.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-12T14:35:42.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="64" PostTypeId="1" AcceptedAnswerId="87" CreationDate="2014-06-12T14:37:00.100" Score="17" ViewCount="7871" Body="&lt;p&gt;After endless trial and error I figured out the right syntax for a simple one level navigation. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navi = craft.entries.section('not projekteintrag' ) %} &#xA;{% for entry in navi.order('id asc') %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.navigationTitle }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a parameter to just trigger single pages? Right now I grabbed the singles with filtering the entries.&lt;/li&gt;&#xA;&lt;li&gt;What is the difference between writing the upper syntax and:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('not projekteintrag' ).order('id asc') %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.navigationTitle }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2017-02-07T07:23:18.350" LastActivityDate="2019-10-17T13:09:52.637" Title="How to write a simple navigation?" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;singles&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="65" PostTypeId="2" ParentId="56" CreationDate="2014-06-12T14:39:40.727" Score="4" Body="&lt;p&gt;Twig doesn't have a &lt;code&gt;natsort()&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've put together a simple plugin which extends the sort-filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/victor-in/Craft-TwigBetterSort&quot; rel=&quot;nofollow&quot;&gt;https://github.com/victor-in/Craft-TwigBetterSort&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-12T14:39:40.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="66" PostTypeId="2" ParentId="56" CreationDate="2014-06-12T14:40:11.363" Score="14" Body="&lt;p&gt;You can do that using MySQL’s &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html#function_cast&quot;&gt;cast() function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('mySection').order('cast(title as unsigned)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you might get better performance if you create an actual Number field called “numberTitle”, attach it to your Entry Type, and set the Entry Type’s title to be &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#dynamic-entry-titles&quot;&gt;dynamically generated&lt;/a&gt; using the template “&lt;code&gt;{numberTitle}&lt;/code&gt;”. Then you can just order by that field instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('mySection').order('numberTitle')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-06-12T15:07:30.360" LastActivityDate="2014-06-12T15:07:30.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="67" PostTypeId="1" AcceptedAnswerId="72" CreationDate="2014-06-12T14:49:48.610" Score="16" ViewCount="4285" Body="&lt;p&gt;I'm thinking about the best way to implement a photo gallery in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A channel section with an assets field should do the job, but would like to hear how other devs have approached this problem.&lt;/p&gt;&#xA;" OwnerUserId="196" LastEditorUserId="250" LastEditDate="2014-06-13T14:11:09.553" LastActivityDate="2014-06-13T14:11:09.553" Title="What's the best approach to building a photo gallery in Craft?" Tags="&lt;gallery&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="68" PostTypeId="2" ParentId="59" CreationDate="2014-06-12T15:05:18.067" Score="28" Body="&lt;p&gt;Avoiding unnecessary DB queries is definitely the main thing to watch out for. Here’s an example that came up recently in support: Someone wanted to display the first 6 Matrix blocks in an entry, outputting them 2 at a time. Initially the template code looked something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixField.limit(2) %}&#xA;    &amp;lt;!-- Get the 1st two items --&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for block in entry.matrixField.offset(2).limit(2) %}&#xA;    &amp;lt;!-- Get the next two items --&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for block in entry.matrixField.offset(4).limit(2) %}&#xA;    &amp;lt;!-- Get whatever's left, not more than 2 --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than doing that, we suggested that all 6 blocks be grabbed up front, and output 2 at a time using Twig’s &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot;&gt;slice filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.matrixField.limit(6) %}&#xA;&#xA;{% for block in blocks|slice(0, 2) %}&#xA;    &amp;lt;!-- Get the 1st two items --&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for block in blocks|slice(2, 2) %}&#xA;    &amp;lt;!-- Get the next two items --&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for block in blocks|slice(4, 2) %}&#xA;    &amp;lt;!-- Get whatever's left, not more than 2 --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remember that you can always see what DB queries are happening in a given request by enabling &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot;&gt;Dev Mode&lt;/a&gt; and checking your browser’s Javascript console, where all DB queries for the current request will be logged, ordered by how long they took. It will also show if the exact same query was run multiple times.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-06-12T21:18:06.757" LastActivityDate="2014-06-12T21:18:06.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="69" PostTypeId="1" CreationDate="2014-06-12T15:08:26.100" Score="5" ViewCount="1152" Body="&lt;p&gt;I'm trying to create an archive list template that lists entries from a News or Blog Channel based on year/month/day combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I get no entries and can't see where I'm going wrong...I'm running the latest build of Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if year is not defined %}&#xA;    {% redirect &quot;news/archives/&quot;~now.year %}&#xA;{% endif %}&#xA;&#xA;{% set year  = craft.request.segment(3)  %}&#xA;{% set month = craft.request.segment(4) %}&#xA;{% set day = craft.request.segment(5) %}&#xA;&#xA;Year: {{ year }}&amp;lt;br&amp;gt;&#xA;Month: {{ month }}&amp;lt;br&amp;gt;&#xA;Day: {{ day }}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% if (year | length) and (month | length) and (day | length) %}&#xA;    {% set entryDate = year ~ '-' ~ month ~ '-' ~ day %}&#xA;{% elseif (year | length) and (month | length) %}&#xA;    {% set entryDate = year ~ '-' ~ month %}&#xA;{% elseif (year | length) %}&#xA;    {% set entryDate = year %}&#xA;{% endif %}&#xA;&#xA;Entry Date: {{ entryDate }}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% set entries = craft.entries.find({section: &quot;news&quot;, postDate: entryDate}) %}&#xA;&#xA;{% if entries | length %}&#xA;    Entries found.&#xA;{% else %}&#xA;    No entries found.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastEditorUserId="250" LastEditDate="2014-06-13T17:03:59.347" LastActivityDate="2014-06-16T15:53:24.113" Title="Creating a date filtered archive template" Tags="&lt;entries&gt;&lt;archives&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="70" PostTypeId="2" ParentId="67" CreationDate="2014-06-12T15:11:43.423" Score="9" Body="&lt;p&gt;It depends heavily on what kind of gallery you're trying to create. For a basic gallery (with maybe meta data) what you describe would be the best way. Pagination would be available for showing grids of images at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want some kind of album-style organization you can either make the section as a Structure with Album and Photo entry types (photos would be the children of albums), or you can simply create a category group called Albums and filter that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way is pretty easy to implement. Using a Structure section would make it even easier to include a photo album in a different entry. For example, you could have a blog on the site and attach an album to it for people to preview in the post.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-12T15:11:43.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="71" PostTypeId="1" AcceptedAnswerId="77" CreationDate="2014-06-12T15:13:13.020" Score="7" ViewCount="1038" Body="&lt;p&gt;When site members click logout they are taken back to the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to redirect the user back to the login page but with a &quot;You're logged out&quot; type of message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is something like this possible yet?&lt;/p&gt;&#xA;" OwnerUserId="170" LastEditorUserId="250" LastEditDate="2014-06-13T17:03:33.957" LastActivityDate="2014-06-13T17:03:33.957" Title="Is it possible to show a successful logout message?" Tags="&lt;redirection&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="72" PostTypeId="2" ParentId="67" CreationDate="2014-06-12T15:20:49.030" Score="10" Body="&lt;p&gt;Craft is so flexible there are many ways to do most things, it is up to you to determine what is best for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as photo galleries go, there are two main ways that I normally approach this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method 1: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define asset fields for the images, where you define the photo title and description, etc.  These fields are accessed by double clicking the image, which will pull up a form with the fields you have defined.  This method associates these fields directly to the assets themselves, and the data will be available site-wide, not just in the gallery.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this is simplest to code, it does have the drawback that clients will often skip over the asset fields and add images to the gallery that have not been assigned all of the data needed for the gallery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a matrix block to define the gallery and create matrix fields for the assets and associated fields.  This is much easier for clients as they can see each bit of data they need to enter, and you can even make the fields required so they do not avoid entering them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While much simpler for the client, this method does has several drawbacks. First, the data entered into the matrix block will only be available in the context of the gallery and not anywhere else in the site. Second, a gallery built from matrix blocks can become quite lengthy in the back end and take up a lot of space on the edit page. And lastly, this method is a bit more complex to code than just a simple assets loop. Once you get the hang of it it is no biggy, but you will need to work through nested matrix/asset loops the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I use for a very simple matrix based gallery w/o titles or descriptions, best of luck :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vertParams = {&#xA;  height: 800,&#xA;  mode: 'crop',&#xA;  position: 'center-center',&#xA;}&#xA;%}&#xA;{% set horzParams = {&#xA;  width: 800,&#xA;  mode: 'crop',&#xA;  position: 'center-center',&#xA;}&#xA;%}&#xA;{% set thumbParams = {&#xA;  width: 120,&#xA;  height: 120,&#xA;  mode: 'crop',&#xA;  position: 'center-center',&#xA;}&#xA;%}&#xA;{% set images = contentBlock.galleryImages %}&#xA;{% if images | length %}&#xA;  {% if contentBlock.galleryTitle | length %}&#xA;   &amp;lt;h3&amp;gt;{{ contentBlock.galleryTitle }}&amp;lt;/h3&amp;gt;&#xA;  {% endif %}&#xA;  &amp;lt;ul class=&quot;gallery&quot;&amp;gt;&#xA;    {% for image in images %}&#xA;    &amp;lt;li&amp;gt;&#xA;      {% if image.getHeight() &amp;gt; image.getWidth() %}&#xA;        &amp;lt;a href=&quot;{{ image.getURL(vertParams) }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getURL(thumbParams) }}&quot; alt=&quot;image&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      {% else %}&#xA;        &amp;lt;a href=&quot;{{ image.getURL(horzParams) }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getURL(thumbParams) }}&quot; alt=&quot;image&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-06-12T15:20:49.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="73" PostTypeId="2" ParentId="67" CreationDate="2014-06-12T15:35:51.340" Score="6" Body="&lt;p&gt;Creating a channel with a matrix field allows you to have more control over the content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I typically use the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;photograph: matrix field&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;image: asset field&lt;/li&gt;&#xA;&lt;li&gt;title: photograph title&lt;/li&gt;&#xA;&lt;li&gt;caption: plain text  &lt;/li&gt;&#xA;&lt;li&gt;description: rich text&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-06-12T15:35:51.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="74" PostTypeId="2" ParentId="64" CreationDate="2014-06-12T15:46:01.383" Score="7" Body="&lt;p&gt;If you have more complex menus in the future, you should take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#nav&quot;&gt;Nav-Tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Getting singles:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isn't an easy way to get singles (yet). But you can use the same method which is used in crafts backend:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSections = craft.sections.getAllSections() %}&#xA;{% set singleSections = [] %}&#xA;&#xA;{% for section in allSections %}&#xA;    {% if section.type == 'single' %}&#xA;        {% set singleSections = singleSections|merge([section]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set navi = craft.entries.section(singleSections) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Queries:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case there isn't a difference. But if you plan on using the same query twice, you should save it into a var and reuse it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example only makes one db call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navi = craft.entries.section('not projekteintrag' ).order('id asc') %}&#xA;&#xA;{% for entry in navi %} ... {% endfor %}&#xA;&#xA;{% for entry in navi %} ... {% endfor %}&#xA;&#xA;{% for entry in navi %} ... {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this makes three:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('not projekteintrag' ).order('id asc') %} ... {% endfor %}&#xA;&#xA;{% for entry in craft.entries.section('not projekteintrag' ).order('id asc') %} ... {% endfor %}&#xA;&#xA;{% for entry in craft.entries.section('not projekteintrag' ).order('id asc') %} ... {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-12T15:46:01.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="75" PostTypeId="2" ParentId="64" CreationDate="2014-06-12T15:46:18.947" Score="4" Body="&lt;p&gt;1) This is not so simple of an answer. Craft itself uses JS to handle the content of indexes, so I'm not sure how they're doing this. Using what's available you would need to build a list of Single Sections, then pull entries based on that list.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = [] %}&#xA;{% for section in craft.sections.getAllSections() %}&#xA;    {% if section.type == 'single' %}&#xA;        {% set sections = sections|merge([section]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your query would be (however you choose to use it):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(sections).order('id asc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Both examples are the same. You can keep adding/editing criteria until you actually pull the entries by using an output function (find, first, etc) or using it in a loop (such as for and nav)&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-12T15:46:18.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="76" PostTypeId="2" ParentId="11" CreationDate="2014-06-12T15:55:37.457" Score="1" Body="&lt;p&gt;I was also looking for an elegant solution to server multiple domain from the same Craft instance and this is what I found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiple domains documentation will assist your domain setup and is pretty easy: &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I got hung up is adding content which is specific to one domain.  The only 'hacky' work around I could come up with was using rewrite rules (.htaccess, etc) to append the request with a url segment that could be targeted via routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example.com -&gt; main site&#xA;example2.com -&gt; landing page site.  .htaccess rewrites to example2.com/lp/news&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example above, I could also access the /lp/news from blog.example.com unless I want to manage conditionals in configs / .htaccess (for this domain, not this domain, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of the day, it's pretty clear Craft isn't intended for multiple sites and I don't recommend solutions that become a spaghetti mess to manage.  If it's a landing page or two, I think using the combination of configs, routes and rewrite rule would do the trick...anything else I would look into a separate instance.&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2014-06-12T15:55:37.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="77" PostTypeId="2" ParentId="71" CreationDate="2014-06-12T16:01:31.417" Score="7" Body="&lt;p&gt;It is not possible yet, but a quick plugin would make this possible. It would just be a controller with a logout action. You'd be able to call the action as a url with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/actions/[PluginHandle]/[ControllerName]/[ActionName]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can logout the user the same way Craft does in their controller and edit the redirect as you see fit. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;logout(false);&#xA;$this-&amp;gt;redirect('?status=logout');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would log them out and then send them to the homepage with a query attached to the end.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-12T16:01:31.417" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="78" PostTypeId="2" ParentId="51" CreationDate="2014-06-12T16:10:56.020" Score="9" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot;&gt;order param&lt;/a&gt; sets the &lt;code&gt;ORDER BY&lt;/code&gt; part of the MySQL query. You can also pass MySQL functions in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_greatest&quot;&gt;&lt;code&gt;GREATEST()&lt;/code&gt;&lt;/a&gt; should do the job:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries&#xA;    .section(['publication','text', 'exhibition'])&#xA;    .order('GREATEST(releaseDate, publicationReleaseDate, exhibitionOpeningDate) desc')&#xA;    .limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="9" LastEditDate="2014-06-12T18:32:22.243" LastActivityDate="2014-06-12T18:32:22.243" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="80" PostTypeId="1" AcceptedAnswerId="82" CreationDate="2014-06-12T16:24:14.340" Score="3" ViewCount="1186" Body="&lt;p&gt;Is it possible to reset a users password from the Control Panel, I remember seeing an option for that before but not seeing it anymore?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same goes for notifing users when you create their account, is there a way to trigger an email to them automatically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not maybe a plugin is in order?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="9" LastEditDate="2014-06-13T14:11:05.667" LastActivityDate="2014-06-13T14:11:05.667" Title="How do I reset a user’s password or email them when I create an account?" Tags="&lt;emails&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="81" PostTypeId="2" ParentId="64" CreationDate="2014-06-12T16:33:03.313" Score="8" Body="&lt;p&gt;In some cases I use a pre-defined (very simple) nav that I don't need to be driven from the CMS yet I want to share it between the header / footer.  In these cases I'll set an array in my base layout template so I can use it throughout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &quot;_partials/layout.twig&quot; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nav = [&#xA;    {'title':'Home', 'link':siteUrl, 'class':'homepage'},&#xA;    {'title':'About', 'link':url('about'), 'class':'about-us'},&#xA;    {'title':'Contact', 'link':url('contact'), 'class':'contact-us'},&#xA;]%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &quot;_partials/header.twig&quot; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;{# logo, etc... #}&#xA;{% if (nav is defined) and (nav is iterable) %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for navItem in nav %}&#xA;        &amp;lt;li class=&quot;{{ navItem.class }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ navItem.link }}&quot;&amp;gt;{{ navItem.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &quot;_partials/footer.twig&quot; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (nav is defined) and (nav is iterable) %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for navItem in nav %}&#xA;        &amp;lt;li class=&quot;{{ navItem.class }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ navItem.link }}&quot;&amp;gt;{{ navItem.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Very simple concept I know.  But at the end of the day when I know the nav isn't going to change drastically or I don't want the end user to alter it, this is what I do.  It has practically no impact on performance and allows me to manage the items in one place.&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2014-06-12T16:33:03.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="82" PostTypeId="2" ParentId="80" CreationDate="2014-06-12T16:45:45.487" Score="8" Body="&lt;p&gt;If you are an administrator or your account has “administrate users” privileges, then there is a checkbox on the user’s edit page in the control panel that says “Require Password Reset on Next Login” which, if checked, will force the users to reset their password the next time they attempt to login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new account, if you leave the “Require Email Verification” checkbox checked, the user will get an email asking them to confirm their email address and set a new password on their account when the click the link in the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the password reset and account verification process requires email to be configured and working properly under Settings-&gt;Email in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-12T16:53:43.000" LastActivityDate="2014-06-12T16:53:43.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="83" PostTypeId="1" AcceptedAnswerId="84" CreationDate="2014-06-12T16:54:29.023" Score="2" ViewCount="86" Body="&lt;p&gt;I need to add a second section name to this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('not homePage')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out the correct formatting. I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('not homePage,clientPage')&#xA;craft.entries.section('not homePage, not clientPage')﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I add a second limiter? &lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-12T16:54:29.023" Title="How do I add a second section name to this logic?" Tags="&lt;logic&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="84" PostTypeId="2" ParentId="83" CreationDate="2014-06-12T16:54:29.023" Score="3" Body="&lt;p&gt;A second limiter is added to the conditional like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('and, not homepage, not clientPage')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-12T16:54:29.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="85" PostTypeId="1" AcceptedAnswerId="86" CreationDate="2014-06-12T17:02:14.123" Score="15" ViewCount="968" Body="&lt;p&gt;How do I create search result page &quot;excerpts&quot; when there are multiple sections/fields that need to be represented?&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="22" LastEditDate="2014-06-13T14:11:19.203" LastActivityDate="2014-07-17T22:11:25.503" Title="How can I display search &quot;excerpts&quot; from multiple sections?" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="86" PostTypeId="2" ParentId="85" CreationDate="2014-06-12T17:02:14.123" Score="9" Body="&lt;p&gt;This can be accomplished using a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section == 'sectionA' %}&#xA;    {{ entry.sectionAField }}&#xA;{% elseif entry.section == 'sectionB' %}&#xA;    {{ entry.sectionBField }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or a switch statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.section %}&#xA;    {% case &quot;sectionA&quot; %}&#xA;       {{ entry.sectionAField }}&#xA;    {% case &quot;sectionB&quot; %}&#xA;       {{ entry.sectionBField }}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-07-17T22:11:25.503" LastActivityDate="2014-07-17T22:11:25.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="87" PostTypeId="2" ParentId="64" CreationDate="2014-06-12T17:02:15.770" Score="17" Body="&lt;p&gt;My solution is to setup a dedicated &quot;Menu&quot; section and use an entries field type for the links.  This allows you to pull together entries from multiple sections into a single menu.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My normal setup is to have to custom fields&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;relatedEntry - Entries field allowing you to select any other entry&lt;/li&gt;&#xA;&lt;li&gt;customURL - text field for custom url input&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The idea being that you could fill in either or and have a dynamic menu with links to entries or custom links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the template side you simple would do this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set menu = craft.entries.section('menu') %}&#xA;&amp;lt;ul&amp;gt; &#xA;{% nav link in menu %}&#xA;    &amp;lt;li&amp;gt;&#xA;&#xA;        {% if link.relatedEntry|length %}&#xA;                &amp;lt;a href=&quot;{{ link.relatedEntry[0].url }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;        {% else %}&#xA;                &amp;lt;a href=&quot;{{ link.customURL }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt; &#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope that helps&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-06-12T17:02:15.770" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="88" PostTypeId="1" AcceptedAnswerId="89" CreationDate="2014-06-12T17:08:21.347" Score="5" ViewCount="365" Body="&lt;p&gt;I'm adding prev/next links to a detail page and can't get &lt;code&gt;craft.entries&lt;/code&gt; to return the correct entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Specifically, I need &lt;code&gt;craft.entries&lt;/code&gt; to return entries in the &quot;leadership&quot; section where the &lt;code&gt;leadershipType&lt;/code&gt; field matches the current entry's &lt;code&gt;leadershipType&lt;/code&gt; value.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code returns all entries instead of the ones specific to my field parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}&#xA;&#xA;{% set prev = entry.getPrev(params) %}&#xA;{% set next= entry.getNext(params) %}?&#xA;&#xA;{% if prev %}&amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;amp;lt;&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if next %}&amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;&amp;amp;gt;&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-07-15T21:48:56.360" LastActivityDate="2014-07-15T21:48:56.360" Title="How can I show next/previous paging that's limited by specific criteria?" Tags="&lt;pagination&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="89" PostTypeId="2" ParentId="88" CreationDate="2014-06-12T17:08:21.347" Score="7" Body="&lt;p&gt;You can only pass &lt;a href=&quot;https://github.com/brandonkelly/TwigForDesigners/blob/master/values-expressions-and-variables.md#objects&quot;&gt;&lt;strong&gt;an object&lt;/strong&gt;&lt;/a&gt; or an ElementCriteriaModel (what you get when you type 'craft.entries') into &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling &lt;code&gt;find()&lt;/code&gt; on an ElementCriteriaModel, as I'm doing in my code, turns it into an actual array of entries, which is not something &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; can work with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So changing the first line to this will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('leadership').leadershipType(entry.leadershipType) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or this using the object syntax for setting parameters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries({&#xA;    section: 'leadership',&#xA;    leadershipType: entry.leadershipType&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-06-12T17:35:22.637" LastActivityDate="2014-06-12T17:35:22.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="90" PostTypeId="1" CreationDate="2014-06-12T17:10:31.517" Score="9" ViewCount="428" Body="&lt;p&gt;I have a page with a bunch of images that I'd like people to rate and comment on.  The rating would be a select custom field, and the comment would be a simple textarea custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to allow guests to submit their ratings and comments, but the Guest Entries plugin doesn't seem to handle editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to get this to work?&lt;/p&gt;&#xA;" OwnerUserId="113" LastEditorUserId="125" LastEditDate="2014-06-12T20:34:28.370" LastActivityDate="2014-06-12T20:34:28.370" Title="How would I allow guests to add comments and ratings to existent entries?" Tags="&lt;entries&gt;&lt;comments&gt;&lt;guest&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="92" PostTypeId="1" AcceptedAnswerId="95" CreationDate="2014-06-12T17:24:41.603" Score="14" ViewCount="1950" Body="&lt;p&gt;I have a slideshow with slide data managed in a Matrix field. How would I go about randomizing the data returned in the template so the slides show in a different order on each page load?&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="22" LastEditDate="2014-06-13T14:11:13.987" LastActivityDate="2014-06-13T14:11:13.987" Title="How can I return data from a Matrix field in random order?" Tags="&lt;matrix&gt;&lt;random&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="93" PostTypeId="2" ParentId="92" CreationDate="2014-06-12T17:24:41.603" Score="2" Body="&lt;p&gt;There are two options for accomplishing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in shuffle(entry.matrixField) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in shuffle(entry.matrixField.find()) %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-12T17:24:41.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="94" PostTypeId="2" ParentId="90" CreationDate="2014-06-12T17:43:28.273" Score="6" Body="&lt;p&gt;Using the Guest Entries plugin, it is not possible. Using a custom plugin is possible though. The trick is that each guest needs to be identifiable in some way. Otherwise every guest would be able to edit every comment, and you would have chaos (or a wiki).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want them to be able to edit a comment and still not have to log in, you can create a custom plugin that replicates much of the functionality of the Guest Entries plugin. Adding on to that, you could create a unique string stored in a separate table linked to that entry. This string would be used to give the anonymous user a unique edit link. This would keep the comment reasonably safe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though in all honesty, you would be better served by having users log in or using an external commenting service (if you are avoiding buying a higher Craft version).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-12T17:43:28.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="95" PostTypeId="2" ParentId="92" CreationDate="2014-06-12T17:59:06.537" Score="27" Body="&lt;p&gt;You can either have MySQL select the blocks in a random order using &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_rand&quot;&gt;&lt;code&gt;RAND()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.order('RAND()') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can shuffle the blocks from Twig instead, using Craft’s &lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions#shuffle&quot;&gt;shuffle()&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = shuffle(entry.myMatrixField) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There’s not a major performance difference either way in most cases, however if you also want to &lt;em&gt;limit&lt;/em&gt; the number of blocks, each method will give you different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this will pick 3 blocks at random out of the entire set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.limit(3).order('RAND()') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this will always pick the first 3 blocks, and those 3 blocks will be displayed in a random order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = shuffle(entry.myMatrixField.limit(3)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T17:59:06.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="96" PostTypeId="1" AcceptedAnswerId="99" CreationDate="2014-06-12T19:07:56.340" Score="23" ViewCount="3566" Body="&lt;p&gt;While setting up a site recently I wanted to route a specific entry in a structure section to its own custom template. Using a dynamic route sounded like the right option until I remembered that it wouldn't work due to Craft's routing order (matched entry uri comes before matched template). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I considered adding a conditional redirect to the structure's generic template but this feels a bit dirty. Does anyone have a better solution of how to make this work?&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-12T20:03:39.507" LastActivityDate="2015-05-28T15:25:12.867" Title="How can I route a specific entry in a structure section to its own template?" Tags="&lt;templating&gt;&lt;structure&gt;&lt;custom&gt;&lt;routing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="20" ContentLicense="CC BY-SA 3.0" />
  <row Id="97" PostTypeId="2" ParentId="96" CreationDate="2014-06-12T19:27:36.563" Score="5" Body="&lt;p&gt;Currently, the conditional redirect is the best way. You can use it to load a template dynamically in the structure's generic _entry template using the include tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestion would be to add a lightswitch field that tells the entry to load a custom template. Then in the _entry template do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.customTemplate %}&#xA;    {% include &quot;section/_&quot; ~ entry.slug %}&#xA;{% else %}&#xA;    {% include &quot;section/_generic&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the same basic idea used in Pixel &amp;amp; Tonic's help page on &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot;&gt;using different templates for different entry types&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-12T19:27:36.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="98" PostTypeId="2" ParentId="96" CreationDate="2014-06-12T19:30:25.263" Score="1" Body="&lt;p&gt;I think you are on the right track. Call the generic template &lt;code&gt;_route.html&lt;/code&gt;, and have it do nothing but &lt;code&gt;{%extends ...%}&lt;/code&gt; to route to the template you want.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-12T19:30:25.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="99" PostTypeId="2" ParentId="96" CreationDate="2014-06-12T19:41:16.933" Score="42" Body="&lt;p&gt;The cleanest way I have found to achieve this is to create a generic template for the structure as well as a custom template for each entry that needs one, ensuring that its path matches the entry's uri. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then put this single line of code in the structure's selected template and it works beautifully:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [entry.uri, '_generic'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should work as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include [entry.uri, '_generic'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the entry's uri exists as a template route then it will be rendered, otherwise the generic template will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently extended this on a site to allow for unique custom pages, custom entry type pages and a fallback generic page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;    '_custom/' ~ entry.slug,&#xA;    '_entrytypes/' ~ entry.type,&#xA;    '_generic'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2015-05-28T15:25:12.867" LastActivityDate="2015-05-28T15:25:12.867" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="100" PostTypeId="2" ParentId="90" CreationDate="2014-06-12T19:55:23.550" Score="3" Body="&lt;p&gt;Haven't tried this but here is an idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up a separate channel for the comments and use an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;entries field&lt;/a&gt; to link the submitted comments to your images. You can use the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;guests plugin&lt;/a&gt; for this as you don't have to edit existing entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before you added your comment to Bryans answer, I thought you want your guests to be able to edit their comments after submitting them. This would indeed demand a custom plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-12T19:55:23.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="101" PostTypeId="1" AcceptedAnswerId="102" CreationDate="2014-06-12T20:29:07.560" Score="16" ViewCount="2540" Body="&lt;p&gt;Our team's typical workflow is pull from repo, delete craft tables, import latest db backup, work locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't want everyone working on the dev server db for early development, because we'll be breaking the site too much for everyone else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which brings me to my question, should I be deleting tables before importing? If I don't delete the tables Craft has to do some cleanup magic on the backend (I don't know what it does). I do know that Craft creates tables for matrix types. Would not deleting tables potentially leave orphaned db tables? Obviously there could other side effects as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Opinions? Clarification?&lt;/p&gt;&#xA;" OwnerUserId="244" LastEditorUserId="6007" LastEditDate="2018-06-09T04:38:01.077" LastActivityDate="2018-06-09T04:38:01.077" Title="Best practice on importing Craft db backups?" Tags="&lt;back-up&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="102" PostTypeId="2" ParentId="101" CreationDate="2014-06-12T20:58:46.690" Score="10" Body="&lt;p&gt;The short answer is, &lt;strong&gt;yes, definitely drop your existing tables before importing a new .sql file.&lt;/strong&gt; If you don't, you run a high risk of Craft developing weird issues of data mismatching. This is especially true if the two versions of the database were not created with the same exact version number of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE: You may want to back up your existing database before dropping all of the tables.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The longer answer is, database syncing is an interesting and complicated problem, with many possible solutions. Check out this thread discussing the &quot;holy grail&quot; of database syncing across multiple environments...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What&amp;#39;s the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, your data migration patterns are up to you. There are varying approaches, some involving Shell scripts and Git hooks. It's an evolving challenge for the Craft community (and other CMS's as well), so keep your eyes peeled for the next brilliant &quot;eureka&quot; moment!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-06-12T20:58:46.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="103" PostTypeId="2" ParentId="101" CreationDate="2014-06-12T21:00:41.420" Score="2" Body="&lt;p&gt;They key is to get the database from the &quot;backup database&quot; function in the control panel that includes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DROP TABLE IF EXISTS &lt;code&gt;craft_analytics_settings&lt;/code&gt;;&#xA;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;before it creates all the tables so you shouldn't have to delete any tables first, been working for us that way since the beginning.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-06-12T21:00:41.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="104" PostTypeId="2" ParentId="69" CreationDate="2014-06-12T21:06:02.810" Score="5" Body="&lt;p&gt;I've used this method for sorting by year and month (it could be expanded to support days).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the news/index.html template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if month is defined %} {# show an archive of a month #}&#xA;&#xA;    {% set sortDate = year ~ '-' ~ month %}&#xA;&#xA;    Entry Date: {{ sortDate }}&#xA;&#xA;    {% if month != 12 %}&#xA;        {% set nextmonth = month+1 %}&#xA;        {% set nextyear = year %}&#xA;    {% else %}&#xA;        {% set nextmonth = 01 %}&#xA;        {% set nextyear = year+1 %}&#xA;    {% endif %}&#xA;&#xA;    {% set entriesToShow = craft.entries.section('news').limit(null).after(year ~ '-' ~ month).before(nextyear ~ '-' ~ nextmonth) %}&#xA;&#xA;{% elseif year is defined %} {# show an archive of a year #}&#xA;&#xA;    Entry Date: {{ year }}&#xA;&#xA;    {% set entriesToShow = craft.entries.section('news').limit(null).after(year).before(year+1) %}&#xA;&#xA;{% else %} {# assume overview page #}&#xA;&#xA;    {% set entriesToShow = craft.entries.section('news') %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any entries can then be displayed by one loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entriesToShow %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since this is made to be in on the section's index template you don't need a separate archive template. Just setup a few routes in the CP to send the archive tokens back to the index template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set all the token combinations you need like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/archive/(month)/(year)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To route to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-06-12T21:06:02.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="105" PostTypeId="1" AcceptedAnswerId="107" CreationDate="2014-06-12T22:14:49.820" Score="40" ViewCount="4445" Body="&lt;p&gt;I started using the &lt;a href=&quot;https://buildwithcraft.com/docs/templating/tags#cache&quot;&gt;{% cache %} tag&lt;/a&gt; and would like to know what the best practices are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding performance:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example does it make sense..&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;..to cache the whole template, or is it better to enclose each query separately?&lt;/li&gt;&#xA;&lt;li&gt;..to combine the cache-tag with other &lt;a href=&quot;https://buildwithcraft.com/docs/config-settings#cacheMethod&quot;&gt;supported caches&lt;/a&gt;?&lt;/li&gt;&#xA;&lt;li&gt;..to cache non-dynamic content?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding development:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw the tip to use: &lt;code&gt;{% cache unless craft.config.devMode﻿ %}&lt;/code&gt;. Is there anything else to consider during development?&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-12T23:29:45.133" Title="What are the best practices for using the {% cache %} tag?" Tags="&lt;performance&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="25" ContentLicense="CC BY-SA 3.0" />
  <row Id="106" PostTypeId="2" ParentId="105" CreationDate="2014-06-12T22:54:00.260" Score="30" Body="&lt;p&gt;When working with multiple environments you likely want to disable caching for all but one  environment, because Craft saves the absolute url to entries/assets in the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I achieved this by setting a custom variable in &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'craft.dev' =&amp;gt; array(&#xA;    'cache' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(...),&#xA;)&#xA;&#xA; '192.168.178.20' =&amp;gt; array(&#xA;    'cache' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(...),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then add a conditional to the cache function in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache unless not craft.config.cache %}&#xA;    {# ... #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this setup I can now access the cached content on &lt;code&gt;craft.dev&lt;/code&gt; and open the site on another devices in the network on &lt;code&gt;192.168.178.20&lt;/code&gt; without having problems with cached urls.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-12T23:01:19.493" LastActivityDate="2014-06-12T23:01:19.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="107" PostTypeId="2" ParentId="105" CreationDate="2014-06-12T23:29:45.133" Score="38" Body="&lt;p&gt;Generally you’ll just want to cache areas of your templates that are going to trigger a lot of database queries, or fetch a lot of data, since those are going to have the biggest hit on your site’s performance. Matrix field loops that have relationship fields inside them (Entries/Assets/etc.) are a good example, since each Matrix block is going to come with one or more DB queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s not much advantage to caching less intensive areas of your templates, and might lead to unexpected consequences, if you have anything dynamic being output that’s not pure-content, such as the logged in user’s username.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;..to combine the cache-tag with other &lt;a href=&quot;https://buildwithcraft.com/docs/config-settings#cacheMethod&quot;&gt;supported caches&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Worth mentioning that template caching does &lt;em&gt;not&lt;/em&gt; respect the cacheMethod setting – that’s just for data caches. Template caches always go to the database, which in this case is the most performant option.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-12T23:29:45.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="108" PostTypeId="2" ParentId="10" CreationDate="2014-06-13T07:00:58.673" Score="8" Body="&lt;p&gt;We currently handle this with database dumps from dev and taking screenshots of config screens and attaching them to git pull requests. There needs to be a better way though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only CMS that has any kind of solution that I know of to this problem is Wordpress with this plugin &lt;a href=&quot;https://deliciousbrains.com/wp-migrate-db-pro/&quot;&gt;https://deliciousbrains.com/wp-migrate-db-pro/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-06-13T07:00:58.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="109" PostTypeId="1" AcceptedAnswerId="122" CreationDate="2014-06-13T08:42:46.803" Score="6" ViewCount="719" Body="&lt;p&gt;Is it possible to have an asset source pointing to a non public S3 bucket? Maybe also with expiring link urls?&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-06-13T12:38:54.157" Title="Are private S3 assets possible?" Tags="&lt;s3&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="110" PostTypeId="1" AcceptedAnswerId="116" CreationDate="2014-06-13T08:50:05.733" Score="5" ViewCount="963" Body="&lt;p&gt;I have a number of places in my templates where a link to a particular entry is needed to be hardcoded into the template, but we still want that links URL and title to be dynamic, so if the URL or Title of the entry is updated, this is reflected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a nice lightweight simple snipped of code we can use to fetch the URL and Title of an entry when supplied with a valid entry ID? I've checked through the documentation but can't see anything obvious. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly after something lightweight that isn't going to add significant numbers of DB queries to a page load. &lt;/p&gt;&#xA;" OwnerUserId="117" LastActivityDate="2014-06-13T19:42:13.457" Title="Tag to fetch URL and Title of a entry when supplied it's ID" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="111" PostTypeId="1" AcceptedAnswerId="112" CreationDate="2014-06-13T08:54:39.720" Score="2" ViewCount="140" Body="&lt;p&gt;I tried to write next class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TaskShortcutPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;    // Shortcut sample [task id=&quot;42&quot;]Reference to task with id = 42[/task]&#xA;    public function task($attributes, $content, $tag)&#xA;    {&#xA;             $id = $attributes['id'];    // 42&#xA;             $content;                   // Reference to task with id = 42&#xA;             $tag;                       // 'task'&#xA;&#xA;             return '&amp;lt;a href=&quot;/task/'.$id.'&quot; class=&quot;' .$tag. '&quot;&amp;gt;'.$content.'&amp;lt;/a&amp;gt;';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, what next, how to implement it into CMS? Or I should use it into Twig templates?&lt;/p&gt;&#xA;" OwnerUserId="247" LastActivityDate="2014-06-13T09:35:24.853" Title="Custom Plugin implementation" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="112" PostTypeId="2" ParentId="111" CreationDate="2014-06-13T09:11:07.040" Score="7" Body="&lt;p&gt;You've got a little ways to go before that will work as a plugin... I'd highly recommend getting a little more familiar with the basic anatomy of a plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction#anatomy-of-a-plugin&quot;&gt;Craft Docs - Anatomy of a Plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you'll want to take the &quot;task&quot; method that you have and move it to a *Variable.php file. Then you will be able to call that variable via a Twig template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.taskShortcut.task(attributes, content, tag) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can learn more about variables here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;Template Variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you'll still need your main *Plugin.php file, but the methods inside will be different (&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot;&gt;Your Primary Plugin Class&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will most likely be the folder structure of your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/plugins/taskshortcut&#xA;                           /TaskShortcutPlugin.php&#xA;                           /variables/TaskShortcutVariable.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-13T09:35:24.853" LastActivityDate="2014-06-13T09:35:24.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="113" PostTypeId="2" ParentId="110" CreationDate="2014-06-13T09:34:30.350" Score="4" Body="&lt;p&gt;Sounds like you just need this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(412).first() %}&#xA;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="125" LastEditDate="2014-06-13T17:03:39.117" LastActivityDate="2014-06-13T17:03:39.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="114" PostTypeId="2" ParentId="85" CreationDate="2014-06-13T09:36:18.987" Score="11" Body="&lt;p&gt;There is no way at present to delegate a field as the search excerpt field in Craft, so it needs to be handled by the search results template. It is possible to use conditionals but this can bloat the template, especially when there are multiple sections and each section outputs different fields in different ways, so I prefer to create dedicated search excerpt templates and include them in the search results template as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ['_search-excerpts/' ~ entry.section.handle, '_search-excerpts/default'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code will render the section's dedicated search excerpt template if it exists in a folder called &lt;em&gt;_search-excerpts&lt;/em&gt;, otherwise it will render the default search excerpt template which can contain for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting folder structure would then look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_search-excerpts/default.html&#xA;_search-excerpts/sectionA.html&#xA;_search-excerpts/sectionB.html&#xA;_search-excerpts/sectionC.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-26T17:50:01.450" LastActivityDate="2014-06-26T17:50:01.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="116" PostTypeId="2" ParentId="110" CreationDate="2014-06-13T09:46:12.403" Score="11" Body="&lt;p&gt;This is all you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set linkedEntry = craft.entries.id(42).first() %}&#xA;&amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ linkedEntry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use this in many places you can also make a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot;&gt;macro&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro linkToEntry(entryId) %} &#xA;&#xA;    {# Get the entry with the selected ID #}&#xA;    {% set linkedEntry = craft.entries.id(entryId).first() %}&#xA;&#xA;    {# Make sure the entry exists and output the link #}&#xA;    {% if linkedEntry %}&#xA;        &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ linkedEntry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's nice to have macros in a separate file and import it into your templates. I really love using macros for this kind of code snippets, very useful and DRY.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;macros.html&quot; as macros %}&#xA;&#xA;&amp;lt;li&amp;gt;{{ macros.linkToEntry(42) }}&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;{{ macros.linkToEntry(17) }}&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;{{ macros.linkToEntry(20) }}&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-13T19:42:13.457" LastActivityDate="2014-06-13T19:42:13.457" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="117" PostTypeId="1" AcceptedAnswerId="119" CreationDate="2014-06-13T10:21:23.950" Score="11" ViewCount="3140" Body="&lt;p&gt;Client has uploaded a number of severely badly lighted photographs for a 'staff' section of a site and these all have had a 'staffThumb' transform applied to it on the sites pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I corrected the lighting on the originals in Photoshop and re-uploaded those -- how do I make assets redo these transforms? Deleting the images in the _staffthumb folder doesn't do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers?&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="167" LastEditDate="2014-06-13T14:10:48.583" LastActivityDate="2020-10-07T17:22:13.220" Title="Is there a way to force Assets to redo transforms?" Tags="&lt;image-transforms&gt;&lt;assets&gt;&lt;cache&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="119" PostTypeId="2" ParentId="117" CreationDate="2014-06-13T10:47:24.677" Score="18" Body="&lt;p&gt;I can't actually reproduce your problem but here's a couple of things to check and try:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Clear your browsers cache!&lt;/li&gt;&#xA;&lt;li&gt;Did you re-upload through Assets with the same filename and click replace?&lt;/li&gt;&#xA;&lt;li&gt;Purge all the caches via the Clear Caches button on the settings page&lt;/li&gt;&#xA;&lt;li&gt;Update Asset Indexes on that same page&lt;/li&gt;&#xA;&lt;li&gt;Failing those, manually delete the contents of the /craft/storage/runtime/assets and /craft/storage/runtime/cache folders&lt;/li&gt;&#xA;&lt;li&gt;You can also try deleting the generated images manually in web/assets/..&lt;/li&gt;&#xA;&lt;li&gt;If you're still weeping into your coffee try emptying the craft_assettransformindex table in the database&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Of course, back everything up before you try all this...&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="4630" LastEditDate="2020-10-07T17:22:13.220" LastActivityDate="2020-10-07T17:22:13.220" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="120" PostTypeId="1" AcceptedAnswerId="136" CreationDate="2014-06-13T11:32:11.317" Score="15" ViewCount="4687" Body="&lt;p&gt;How do I migrate my Wordpress project to Craft CMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="115" LastEditDate="2014-06-13T16:08:22.050" LastActivityDate="2017-05-06T16:45:08.780" Title="How do I migrate a Wordpress project to Craft CMS?" Tags="&lt;migration&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="121" PostTypeId="2" ParentId="120" CreationDate="2014-06-13T12:00:19.063" Score="5" Body="&lt;p&gt;If you're just trying to migrate data, the most simple method would be to use a WordPress plugin to export your posts to a CSV and import it into Craft using this &lt;a href=&quot;http://boboldehampsink.github.io/CraftImportPlugin/&quot; rel=&quot;noreferrer&quot;&gt;Import Plugin by Bob Olde Hampsink&lt;/a&gt;. This is just for posts. I'm not sure what you would do for pages, since we have a special section type for those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A WordPress Import Plugin has not yet been created because many, if not most, Craft developers came from ExpressionEngine.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T12:00:19.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="122" PostTypeId="2" ParentId="109" CreationDate="2014-06-13T12:38:54.157" Score="6" Body="&lt;p&gt;Private buckets can be used, but files uploaded to them via the Craft CP will be given public read access. Expiring URLs are not built into Craft because the files being public.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T12:38:54.157" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="123" PostTypeId="1" AcceptedAnswerId="125" CreationDate="2014-06-13T12:48:37.687" Score="9" ViewCount="532" Body="&lt;p&gt;In Craft you can do two types of image transforms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Control Panel Transforms:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Via: Settings → Assets → Image Transforms&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Inline Transforms in your Templates&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m currently using 100% inline transforms as they can be version controlled and seem to work better across different dev environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any benefits of using Control Panel Transforms over using Inline Template Transforms in your Templates?&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-06-13T13:28:49.557" Title="What are the Pros and Cons to each image transform technique?" Tags="&lt;image-transforms&gt;&lt;assets&gt;&lt;git&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="124" PostTypeId="2" ParentId="123" CreationDate="2014-06-13T12:59:03.413" Score="2" Body="&lt;p&gt;They should effectively be doing the same thing. Control Panel Transforms are simply predefined transforms. In both cases, they should perform equally after the first render because Craft stores the transformed image for later reuse.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T12:59:03.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="125" PostTypeId="2" ParentId="123" CreationDate="2014-06-13T13:08:57.173" Score="9" Body="&lt;p&gt;Both methods essentially do exactly the same thing to the image however there are two advantages to pre-defining them in the control panel:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can just call a transform handle in your templates instead of having to define the whole transform model&lt;/li&gt;&#xA;&lt;li&gt;They are then available to be used in supported field types e.g. in the Rich Text field type you can select an existing image transform when inserting an image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As you already mentioned the advantages that I can see to defining them in the templates are version control and the lack of needing a database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've started defining them all in the templates for the development phase and then when we move to staging I go and add all the ones we're using to the control panel. &lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-06-13T13:08:57.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="126" PostTypeId="2" ParentId="123" CreationDate="2014-06-13T13:17:42.327" Score="6" Body="&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only technical difference is, that predefined-transforms have a different directory structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/asset-folder/_transform-name/image.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;whereas inline-transforms use dimensions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/asset-folder/_300x100/image.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Personally I like the first one more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Users:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference for users is, that only predefined-transforms can be selected in RichText-fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Development:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I often use just a few transforms on my projects, so I find maintaining them from the backend easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you could just as well create yourself an include-file to have everything in one place:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/_includes/image_transforms.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform_1 = {&#xA;    mode: 'crop',&#xA;    width: 100,&#xA;    height: 100,&#xA;    quality: 100,&#xA;    position: 'top-center'&#xA;} %}&#xA;&#xA;{% set transform_2 = {&#xA;    mode: 'crop',&#xA;    width: 50,&#xA;    height: 50,&#xA;    quality: 75,&#xA;    position: 'center-center'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/some_template.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/image_transforms&quot; %}&#xA;&#xA;&amp;lt;img src=&quot;{{ asset.getUrl(transform_1) }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;img src=&quot;{{ asset.getUrl(transform_2) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-13T13:17:42.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="127" PostTypeId="2" ParentId="123" CreationDate="2014-06-13T13:28:49.557" Score="3" Body="&lt;p&gt;If you need the image transforms in Rich Text fields, you have to define them in the control panel, as Josh said. Apart from that, I feel that it's much more flexible to define them at the template level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main advantage is that you can then make the transform dynamic, based on the current template or the current content that is displayed. One example is being able to do &lt;a href=&quot;https://github.com/aelvan/RESS-Toolbox-Craft&quot; rel=&quot;nofollow&quot;&gt;transforms based on the users device/screen size&lt;/a&gt;. Another is being able to give the client the ability to &lt;a href=&quot;http://craftcookbook.net/recipes/120&quot; rel=&quot;nofollow&quot;&gt;define crop positions on a per image basis&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-06-13T13:28:49.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="128" PostTypeId="1" CreationDate="2014-06-13T14:47:14.400" Score="4" ViewCount="318" Body="&lt;p&gt;It's great to have Craft CMS on SE at last!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're working on a Craft site that'll allow public visitors to register, maintain a profile, and create entries in an Events channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should we create individual user templates (signup, profile, content), or is there a more automatic way to do this with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, some of our profile fields are dropdown menus, but they don't seem to render as form dropdowns without us manually recoding them to do so. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look forward to some great answers! &lt;/p&gt;&#xA;" OwnerUserId="214" LastEditorUserId="250" LastEditDate="2014-06-13T22:36:59.640" LastActivityDate="2014-06-13T22:36:59.640" Title="What's the best way to create public profile and content forms?" Tags="&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="129" PostTypeId="1" AcceptedAnswerId="13671" CreationDate="2014-06-13T15:02:40.393" Score="22" ViewCount="3374" Body="&lt;p&gt;Since Craft 2.0 it is possible to pass &lt;code&gt;:empty:&lt;/code&gt; and &lt;code&gt;:notempty:&lt;/code&gt; to ElementCriteriaModel parameters when you’re looking for empty/non-empty values. If you are for example looking for all entries with a non-empty text field &lt;code&gt;myTextField&lt;/code&gt;, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').myTextField(':notempty:') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this syntax doesn't work for asset fields and I can't figure out how that syntax has to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative would be to use the search function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').search('myAssetField:*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I generally try to avoid using the search parameter in queries whenever possible. It is probably not that much of a performance killer but by avoiding it I don't have to worry about my search index.﻿&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-10-05T12:30:01.750" Title="How can I get only those entries with non-empty assets field" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="130" PostTypeId="1" CreationDate="2014-06-13T15:38:03.423" Score="2" ViewCount="354" Body="&lt;p&gt;How would one go about showing a link on the front end if this entry belongs to the current user? I was thinking it had something to do with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#can&quot; rel=&quot;nofollow&quot;&gt;the UserModel's &lt;code&gt;can()&lt;/code&gt;&lt;/a&gt;, but I don't see any documentation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm showing an &quot;Edit Page&quot; link once someone is logged in, but I don't want to show a that link on a page that the current user doesn't have access to edit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping something like this would work but it doesn't :( :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author == currentUser %}&#xA;    &amp;lt;a class=&quot;btn btn-primary btn-small cp&quot; href=&quot;{{ entry.getCpEditUrl() }}&quot;&amp;gt;Edit Page&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="101" LastEditorUserId="22" LastEditDate="2014-06-13T16:46:02.860" LastActivityDate="2014-06-13T16:46:02.860" Title="How can I grant front-end access to an entry that belongs to the current user?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="131" PostTypeId="2" ParentId="130" CreationDate="2014-06-13T15:47:33.193" Score="4" Body="&lt;p&gt;You can check if the current user can edit an entry by using this  as your conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.isEditable() %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;Edit Page&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T15:47:33.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="133" PostTypeId="1" AcceptedAnswerId="142" CreationDate="2014-06-13T15:59:11.693" Score="4" ViewCount="909" Body="&lt;p&gt;I have an entries field type associated with a structure section page. This displays the entries on this page in a particular order. When you click an entry link ti will take you to  a detailed page for more information about that entry. What I'd like to be able to do is paginate through these entries in the order set in the entries field, not just paginate through the entries in asc/desc or alphabetical order as would happen if I just paginated through the channel section that stores the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried straight forward pagination as detailed in the documentation but two problems occurred. First the pagination links were created with proper beginning end and number but when clicking through them you remained on the same entry. Second, a pagination URI was appended to the URL which I don't want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is pagination even the proper approach to this problem or is there a better solution?&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="125" LastEditDate="2014-07-15T10:10:40.927" LastActivityDate="2014-07-15T10:10:40.927" Title="What's the best way to paginate through entries from an entries field type?" Tags="&lt;pagination&gt;&lt;relations&gt;&lt;previous-next&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="135" PostTypeId="2" ParentId="128" CreationDate="2014-06-13T16:04:14.427" Score="5" Body="&lt;p&gt;User registration works just like front-end entry editing. You build the form on any page you like, and submit it to the action &quot;users/saveUser&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All fields need to be coded by you, and extra profile fields can be filled in by setting the input name to &quot;fields[handle]&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft Documentation has an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot;&gt;example registration form&lt;/a&gt;. The also have an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot;&gt;example for allowing users to update their profile&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T16:04:14.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="136" PostTypeId="2" ParentId="120" CreationDate="2014-06-13T16:07:17.157" Score="16" Body="&lt;p&gt;At this point in time, you have a few options: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Import Plugins&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of this post, there are a few partial import plugins available and rumors that a few others might be on their way.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; - Sprout Import supports over 40 data types such as Entries, Users, Assets, Products, Orders, Forms, Email, and Redirects; and more can be added as needed via plugin integrations.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt; - Feed Me is a Craft plugin for super-simple importing of content, either once-off or at regular intervals. With support for XML, RSS, ATOM or JSON feeds, you'll be able to import your content as Entries, Categories, Craft Commerce Products (and variants), and more.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/CraftImportPlugin/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt; - Handles Entries and allows you to map them to fields in&#xA;your Entries Sections &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/clearbold/craftimport/&quot; rel=&quot;nofollow noreferrer&quot;&gt;EE/Craft Import&lt;/a&gt; - While this plugin has EE&#xA;in it's title, it looks like it's framed more around XML imports in&#xA;general and promotes itself as being a starting point if you have&#xA;other custom import needs. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Import Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full disclosure, my company offers a migration service to help folks migrate to Craft.  We use a combination of a private plugin, custom scripts, and manual processes when necessary.  We find, in most cases, many things about your data architecture can be improved when migrating to Craft.  So, while an import plugin can help with some heavy lifting, being able to make architecture decisions on how to import certain types of content outside of what a plugin would allow is useful for improving user experience and getting the most of of Craft.  For example, content that fits nicely in Singles and Matrix Fields don't always have equivalents in other CMSs, yet frequently other CMSs have content that fits these use cases.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://thegreatmigration.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Great Migration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Do It Yourself&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to roll up your sleeves, you can create a utility plugin or script for your own needs.  If you need to go this route, you probably want to import your data using Craft's Service Layer and the &lt;code&gt;save&lt;/code&gt; methods for each of the individual Elements you are importing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see some examples of this in the plugins available on GitHub above, or read up more on the service layer in the Craft docs.  A good place to start may be the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries Service&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to get your data into a format that matches the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice#saveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; and then you can pass that information to the &lt;code&gt;saveEntry&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's a fairly simple explanation, but the gist of where to start. All of the other Elements are going to have similar Models and save methods you can use to import your data.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-05-06T16:45:08.780" LastActivityDate="2017-05-06T16:45:08.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="137" PostTypeId="1" AcceptedAnswerId="138" CreationDate="2014-06-13T16:50:01.690" Score="11" ViewCount="2309" Body="&lt;p&gt;Is there a quick way (or some sort of wizard) that can be run on a server in order to establish whether it fulfils Craft's minimum requirements without uploading all of the Craft files? Finding out PHP and MySQL versions is easy enough but sometimes it's hard to get the finer details from clients.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="9" LastEditDate="2014-07-03T14:40:53.420" LastActivityDate="2014-07-03T14:40:53.420" Title="Is there a quick way to check a server for Craft's minimum requirements?" Tags="&lt;php&gt;&lt;requirements&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="138" PostTypeId="2" ParentId="137" CreationDate="2014-06-13T16:50:01.690" Score="14" Body="&lt;p&gt;There is no way of programmatically checking whether a server fulfils the minimum requirements in Craft without uploading all of the Craft files, however I have created a script that performs all of Craft's web server related checks. It does not connect to a database so cannot check the MySQL version or that the InnoDB storage engine is installed and enabled, but this should be relatively easy to find out by asking your web hosting company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The script is available for download here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/putyourlightson/craft-requirements&quot;&gt;https://github.com/putyourlightson/craft-requirements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-16T07:56:17.007" LastActivityDate="2014-06-16T07:56:17.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="141" PostTypeId="1" AcceptedAnswerId="143" CreationDate="2014-06-13T17:02:24.600" Score="2" ViewCount="2114" Body="&lt;p&gt;I'm setting up a twitter feed with &lt;code&gt;craft.twitter.get()&lt;/code&gt; and I need to convert a dropdown value to an integer. Here is my code far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cacheTime = sidebarBlock.twitterFeedCacheTime %}&#xA;{% set tweets = craft.twitter.get('statuses/user_timeline.json?screen_name='~ sidebarBlock.twitterFeedUsername ~'&amp;amp;count='~ sidebarBlock.twitterFeedTweetCount ~ '&amp;amp;', { exclude_replies: sidebarBlock.twitterFeedIncludeReplies, include_rts: sidebarBlock.twitterFeedIncludeRetweets, }, {}, true, cacheTime) %}&#xA;{% if tweets %}&#xA;&amp;lt;div class=&quot;twitter-feed&quot;&amp;gt;&#xA;  &amp;lt;h4&amp;gt;{{ sidebarBlock.twitterFeedTitle }}&amp;lt;/h4&amp;gt;&#xA;  {% for tweet in tweets %}&#xA;  &amp;lt;div class=&quot;tweet&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;&#xA;      &amp;lt;a class=&quot;twitter-screen-name&quot; href=&quot;http://twitter.com{{ tweet.user.screen_name|raw }}&quot; target=&quot;_blank&quot;&amp;gt;@{{ tweet.user.screen_name|raw }}&amp;lt;/a&amp;gt;: &amp;lt;span class=&quot;tiny&quot;&amp;gt;{{ tweet.created_at |nicetime('m-d-Y') }}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&#xA;      {{tweet| tweetLink(newWindow='true') | raw}}&#xA;    &amp;lt;/p&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that no matter what I try on &lt;code&gt;twitterFeedcacheTime&lt;/code&gt; it returns a string to integer conversion error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object of class Craft\SingleOptionFieldData could not be converted to int&#xA;&#xA;/craft/app/etc/cache/FileCache.php(85)&#xA;&#xA;73      * @param  string  $value  The value to be cached&#xA;74      * @param  integer $expire The number of seconds in which the cached value will expire. 0 means never expire.&#xA;75      * @return boolean true    If the value is successfully stored into cache, false otherwise&#xA;76      */&#xA;77     protected function setValue($key, $value, $expire)&#xA;78     {&#xA;79         if (!$this-&amp;gt;_gced &amp;amp;&amp;amp; mt_rand(0, 1000000) &amp;lt; $this-&amp;gt;getGCProbability())&#xA;80         {&#xA;81             $this-&amp;gt;gc();&#xA;82             $this-&amp;gt;_gced = true;&#xA;83         }&#xA;84 &#xA;85         if($expire &amp;lt;= 0)&#xA;86         {&#xA;87             $expire = 31536000; // 1 year&#xA;88         }&#xA;89 &#xA;90         $expire += time();&#xA;91 &#xA;92         $cacheFile = $this-&amp;gt;getCacheFile($key);&#xA;93 &#xA;94         if ($this-&amp;gt;directoryLevel &amp;gt; 0)&#xA;95         {&#xA;96             IOHelper::createFolder(IOHelper::getFolderName($cacheFile), IOHelper::getWritableFolderPermissions());&#xA;97         }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2014-06-13T17:27:21.060" LastActivityDate="2014-06-13T19:10:22.377" Title="How can I convert a dropdown field value to an integer within a hash?" Tags="&lt;hash&gt;&lt;string&gt;&lt;conversion&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="142" PostTypeId="2" ParentId="133" CreationDate="2014-06-13T17:05:22.867" Score="4" Body="&lt;p&gt;To do this, you would need to use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow&quot;&gt;getPrev()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;getNext()&lt;/a&gt; on the related entries’ template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is telling getPrev() and getNext() to use the order you defined in the source entry’s Entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first, you will need to get that source entry. If you only have a single entry in your structure section that has one of these Entries fields, that could be as simple as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the entry in the structure section that relates to `entry` %}&#xA;{% set sourceEntry = craft.entries.section('myStructureSection').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'myEntriesField'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have that, you can just pass its Entries field into getPrev() and getNext():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = entry.getPrev(sourceEntry.myEntriesField) %}&#xA;{% set nextEntry = entry.getNext(sourceEntry.myEntriesField) %}&#xA;&#xA;{% if prevEntry %}&#xA;    &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous: {{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextEntry %}&#xA;    &amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next: {{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="87" LastEditDate="2014-07-14T18:42:58.343" LastActivityDate="2014-07-14T18:42:58.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="143" PostTypeId="2" ParentId="141" CreationDate="2014-06-13T17:24:18.940" Score="4" Body="&lt;p&gt;Give this a shot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set cacheTime = sidebarBlock.twitterFeedCacheTime.value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="251" LastEditorUserId="32" LastEditDate="2014-06-13T19:10:22.377" LastActivityDate="2014-06-13T19:10:22.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="144" PostTypeId="1" AcceptedAnswerId="145" CreationDate="2014-06-13T17:28:59.310" Score="11" ViewCount="496" Body="&lt;p&gt;I'm new to building plugins and I need to make templates for the control panel. How can I use existing Craft UI components to keep things consistent and save myself from having to rebuild everything?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="45" LastEditDate="2014-06-20T16:40:57.987" LastActivityDate="2016-08-15T16:56:46.440" Title="How can I utilize existing UI for my plugin's control panel views?" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="145" PostTypeId="2" ParentId="144" CreationDate="2014-06-13T17:30:23.277" Score="10" Body="&lt;p&gt;Have a look in &lt;strong&gt;craft/app/templates&lt;/strong&gt; for tons of great, easily-reusable examples that make up the existing control panel! They may not be documented, but there's a whole lot of quality stuff there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to consider using macros from &lt;strong&gt;craft/app/templates/_includes&lt;/strong&gt; (&lt;a href=&quot;http://buildwithcraft.com/docs/apis/templatesservice&quot; rel=&quot;nofollow&quot;&gt;Craft TemplatesService doc&lt;/a&gt;, &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig macro doc&lt;/a&gt;), which will go a long way toward good DRY templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus: this is also a great way to learn clever ways of doing things in Twig, like breadcrumbs for example. P&amp;amp;T builds excellent stuff, so there's lots to learn from and steal whether it's for the control panel or the front end.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-08-15T16:56:46.440" LastActivityDate="2016-08-15T16:56:46.440" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="146" PostTypeId="1" CreationDate="2014-06-13T17:32:48.643" Score="17" ViewCount="6812" Body="&lt;p&gt;Im looking for a good way to setup paging for new items with a simple &quot;load more&quot; button at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know i'd use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;on the listing template to not include the main _layout file for the ajax requests and then using the paginate tags to control which entries to return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curious is anyone has a more streamlined approach&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-06-13T20:23:02.537" LastActivityDate="2015-05-22T16:10:32.387" Title="How do i setup ajax paging for entries" Tags="&lt;pagination&gt;&lt;ajax&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="147" PostTypeId="1" CreationDate="2014-06-13T17:59:58.097" Score="5" ViewCount="183" Body="&lt;p&gt;In the Sections settings (&quot;Entry URL Format&quot;) I would like to add an entry property tag for Entry Type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;discography/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastEditorUserId="250" LastEditDate="2014-06-13T20:33:33.403" LastActivityDate="2014-06-13T20:33:33.403" Title="How do I add Entry Types to URL?" Tags="&lt;entries&gt;&lt;entry-type&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="148" PostTypeId="2" ParentId="147" CreationDate="2014-06-13T18:11:15.570" Score="11" Body="&lt;p&gt;Sure just do this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;discography/{type}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-06-13T19:43:15.843" LastActivityDate="2014-06-13T19:43:15.843" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="149" PostTypeId="2" ParentId="146" CreationDate="2014-06-13T18:17:10.313" Score="4" Body="&lt;p&gt;I would use Craft's built in paginate tag. You just add the page number (p2, p3, p4, etc.) to the end of the url in your ajax call and output the template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blog').limit(10) as entries %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        {{ entry.body }}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-13T18:17:10.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="150" PostTypeId="1" AcceptedAnswerId="152" CreationDate="2014-06-13T18:58:48.900" Score="5" ViewCount="2028" Body="&lt;p&gt;I'm trying to build and XML site map that sorts all entries by their modification dates with the newly modified first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.find() %}&lt;/code&gt; ignores the structures,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section().find() %}&lt;/code&gt; returns the same as above,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('mainPages').find() %}&lt;/code&gt; returns the structure as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for a way to include everything in a single, sortable query.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="57" LastEditDate="2015-08-04T17:57:11.573" LastActivityDate="2015-08-04T17:57:11.573" Title="How would I list all entries regardless of section or structure?" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="151" PostTypeId="1" AcceptedAnswerId="154" CreationDate="2014-06-13T19:04:05.273" Score="2" ViewCount="83" Body="&lt;p&gt;Per documentation I am getting a selected tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = entry.myTagsField.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to check if its name is equal to &quot;Flower&quot;?&lt;/p&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-06-13T19:14:35.893" Title="How to check name of a tag" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="152" PostTypeId="2" ParentId="150" CreationDate="2014-06-13T19:07:20.980" Score="7" Body="&lt;p&gt;Actually your code should work just fine. But by default only 100 entries are fetched, maybe you need to increase the limit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section().limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if you just want to create a Sitemap, try &lt;a href=&quot;http://www.putyourlightson.net/craft-cms-plugins&quot; rel=&quot;noreferrer&quot;&gt;Ben Croker's Sitemap-Plugin&lt;/a&gt; (I really like it)&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-17T19:27:09.830" LastActivityDate="2014-06-17T19:27:09.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="153" PostTypeId="1" AcceptedAnswerId="167" CreationDate="2014-06-13T19:10:15.393" Score="9" ViewCount="29679" Body="&lt;p&gt;Something that would work like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block A %}&#xA;  {% set testVar = &quot;foo&quot; %}&#xA;{% endblock %}&#xA;...&#xA;{% block B %}&#xA;  {{ testVar }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The scope of &lt;code&gt;testVar&lt;/code&gt; seems limited to &lt;code&gt;{% block A %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way around this, so that the child template can pass content to the parent to use in other blocks.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an issue since the child template that extends the parent cannot have content outside a defined block.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2017-09-20T00:17:32.497" Title="Is there a way to define a global var within a twig block?" Tags="&lt;templating&gt;&lt;blocks&gt;&lt;extends&gt;&lt;scope&gt;&lt;set&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="154" PostTypeId="2" ParentId="151" CreationDate="2014-06-13T19:14:35.893" Score="4" Body="&lt;p&gt;Your code returns an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tagmodel&quot; rel=&quot;nofollow&quot;&gt;TagModel&lt;/a&gt; and saves it as &quot;tag&quot;. You can now get all model properties like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ tag.property_name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if tag.name == 'Flower' %}&#xA;    Do stuff&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-13T19:14:35.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="155" PostTypeId="1" AcceptedAnswerId="156" CreationDate="2014-06-13T19:22:32.083" Score="10" ViewCount="221" Body="&lt;p&gt;Let's say you have two dates and want to output the timeframe in fully written &quot;day month year - day month year&quot; notation, but want to leave out the month and year parts of the start date if unnecessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-06-20&lt;/code&gt; yields &lt;code&gt;13 – 20 June 2014&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-07-13&lt;/code&gt; yields &lt;code&gt;13 June – 13 July 2014&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2015-06-13&lt;/code&gt; yields &lt;code&gt;13 June 2014 – 13 June 2015&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I get the desired notation of the timeframe?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-16T13:54:16.920" LastActivityDate="2014-07-14T20:48:36.250" Title="How can I output a timeframe in fully written notation nicely?" Tags="&lt;datetime&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="156" PostTypeId="2" ParentId="155" CreationDate="2014-06-13T19:22:32.083" Score="16" Body="&lt;p&gt;Add the following macro to your template or import it with a separate twig file. The script allows the start and end date to be the same and outputs a single date instead of a timeframe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-06-13&lt;/code&gt; yields &lt;code&gt;13 June 2014&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro timeframe(dateStart, dateEnd) %}&#xA;&#xA;    {# Output day of the start date if necessary #}&#xA;    {{ dateStart != dateEnd ? dateStart|date('j') }}&#xA;&#xA;    {# Output month of the start date if necessary #}&#xA;    {{ dateStart|date('FY') != dateEnd|date('FY') ? dateStart|date('F') }}&#xA;&#xA;    {# Output year of the start date if necessary #}&#xA;    {{ dateStart|date('Y') != dateEnd|date('Y') ? dateStart|date('Y') }}&#xA;&#xA;    {# Output a hyphen if necessary #}&#xA;    {{ dateStart != dateEnd ? ' - ' }}&#xA;&#xA;    {# Output end date #}&#xA;    {{ dateEnd|date('j F Y') }}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Import external `macros.html` #}&#xA;{% import &quot;macros.html&quot; as macros %}&#xA;&#xA;{# Call the macro #}&#xA;{% macros.timeframe(entry.exhibitionDateStart, entry.exhibitionDateEnd) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated the macro to &lt;em&gt;additionally&lt;/em&gt; support &quot;month day, year&quot; notation. The returned notation depends on the &lt;code&gt;localeId&lt;/code&gt; attribute passed to the macro (eg. &quot;en_us&quot;). But you probably want to use the current locale's id, &lt;code&gt;craft.locale&lt;/code&gt; for that ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-06-13&lt;/code&gt; yields &lt;code&gt;June 13, 2014&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-06-20&lt;/code&gt; yields &lt;code&gt;June 13 – 20, 2014&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2014-07-13&lt;/code&gt; yields &lt;code&gt;June 13 – July 13, 2014&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;2014-06-13&lt;/code&gt; to &lt;code&gt;2015-06-13&lt;/code&gt; yields &lt;code&gt;June 13, 2014 – June 13, 2015&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The updated macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro timeframe(dateStart, dateEnd, localeId) %}&#xA;&#xA;    {# Define locales where 'j. F - j. F Y' format is desired #}&#xA;    {% set locales_jFY = ['de', 'it', none] %}&#xA;&#xA;    {# Define locales where 'F j. - F j., Y' format is desired #}&#xA;    {% set locales_FjY  = ['en'] %}&#xA;&#xA;    {# Return timeframe for `locales_jFY` locales #}&#xA;    {% if localeId in locales_jFY %}&#xA;&#xA;        {# Output day of the start date if necessary #}&#xA;        {{- dateStart != dateEnd ? dateStart|date('j. ') -}}&#xA;&#xA;        {# Output month of the start date if necessary #}&#xA;        {{- dateStart|date('FY') != dateEnd|date('FY') ? dateStart|date('F ') -}}&#xA;&#xA;        {# Output year of the start date if necessary #}&#xA;        {{- dateStart|date('Y') != dateEnd|date('Y') ? dateStart|date('Y') -}}&#xA;&#xA;        {# Output a hyphen if necessary #}&#xA;        {{- dateStart != dateEnd ? ' - ' -}}&#xA;&#xA;        {# Output end date #}&#xA;        {{- dateEnd|date('j. F Y') -}}&#xA;&#xA;    {# Return timeframe for `locales_FjY` locales #}&#xA;    {% elseif localeId in locales_FjY %}&#xA;&#xA;        {# Check if dates are on the same day but in different years #}&#xA;        {% if (dateStart|date('Fj') == dateEnd|date('Fj')) and (dateStart|date('Y') != dateEnd|date('Y')) %}&#xA;            {% set sameDaydiffYear = true %}&#xA;        {% endif %}&#xA;&#xA;        {# Output month and day of the start date #}&#xA;        {{- dateStart|date('F j') -}}&#xA;&#xA;        {# Output year of the start date if necessary #}&#xA;        {{- dateStart|date('Y') != dateEnd|date('Y') ? dateStart|date(', Y') -}}&#xA;&#xA;        {# Output a hyphen if necessary #}&#xA;        {{- dateStart != dateEnd ? ' - ' -}}&#xA;&#xA;        {# Output month of the end date if necessary #}&#xA;        {{- dateStart|date('F') != dateEnd|date('F') or sameDaydiffYear ? dateEnd|date('F ') -}}&#xA;&#xA;        {# Output day of the end date if necessary #}&#xA;        {{- dateStart|date('Fj') != dateEnd|date('Fj') or sameDaydiffYear ? dateEnd|date('j') -}}&#xA;&#xA;        {# Output year of the end date #}&#xA;        {{- dateEnd|date(', Y') -}}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-14T20:48:36.250" LastActivityDate="2014-07-14T20:48:36.250" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="157" PostTypeId="1" AcceptedAnswerId="161" CreationDate="2014-06-13T19:51:28.007" Score="4" ViewCount="205" Body="&lt;p&gt;I can get the current year in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentYear = now.year %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get the next year?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="9" LastEditDate="2014-06-13T20:17:00.797" LastActivityDate="2015-03-12T16:39:43.630" Title="How do I get the next year?" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="158" PostTypeId="5" CreationDate="2014-06-13T19:52:15.707" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-06-13T19:52:15.707" LastActivityDate="2014-06-13T19:52:15.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="159" PostTypeId="4" CreationDate="2014-06-13T19:52:15.707" Score="0" Body="DateTime objects provide information about a given date/time." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-06-17T19:23:56.893" LastActivityDate="2014-06-17T19:23:56.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="161" PostTypeId="2" ParentId="157" CreationDate="2014-06-13T19:57:02.177" Score="8" Body="&lt;pre&gt;&lt;code&gt;{% set nextYear = now|date_modify('+1 year')|date('Y') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-13T19:57:02.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="162" PostTypeId="2" ParentId="157" CreationDate="2014-06-13T20:16:23.950" Score="11" Body="&lt;p&gt;You can also get it with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextYear = now.year + 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-13T20:16:23.950" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="163" PostTypeId="2" ParentId="146" CreationDate="2014-06-13T20:21:53.003" Score="9" Body="&lt;p&gt;Hey So here is what i came up with, curious if anyone has a more streamlined approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/keithmancuso/17619fc405a621b4a11e&quot;&gt;https://gist.github.com/keithmancuso/17619fc405a621b4a11e&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;    {% set layout = &quot;_ajaxLayout&quot; %}&#xA;{% else %}&#xA;    {% set layout = &quot;_layout&quot; %}&#xA;{% endif %}&#xA;&#xA;{% extends layout %}&#xA;&#xA;{% set limit = 10 %}&#xA;{% set params = { section: 'news', limit: limit} %}&#xA;&#xA;{% block content %}&#xA;&#xA;{% if not craft.request.isAjax %}&#xA;&amp;lt;h1&amp;gt;News&amp;lt;/h1&amp;gt;&#xA;&amp;lt;div id=&quot;news-entries&quot;&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% paginate craft.entries(params) as entries %}&#xA;{% for entry in entries %}&#xA;  &amp;lt;article class=&quot;news&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;{% endpaginate %}&#xA;&#xA;{% if not craft.request.isAjax %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;a href=&quot;#&quot; id=&quot;loadMore&quot; class=&quot;btn btn-default&quot;&amp;gt;load more news&amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;div id=&quot;loading&quot; style=&quot;display:none&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;/images/loading.gif&quot;/&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;{% set pagingJs %}&#xA;&#xA;$(function () {&#xA;&#xA;    var page = 2;&#xA;&#xA;    $('#loadMore').click (function (e) {&#xA;        e.preventDefault();&#xA;&#xA;        $('#loading').show();&#xA;&#xA;        $.get( &quot;/news/p&quot;+page, function( data ) {&#xA;&#xA;          $( &quot;#news-entries&quot; ).append( data );&#xA;          $('.loading').hide();&#xA;          page++;&#xA;&#xA;        });&#xA;&#xA;    });&#xA;});&#xA;&#xA;{% endset %}&#xA;&#xA;{% includeJs pagingJs %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-06-13T20:21:53.003" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="164" PostTypeId="1" AcceptedAnswerId="166" CreationDate="2014-06-13T21:02:08.697" Score="-3" ViewCount="2242" Body="&lt;p&gt;Suppose I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;myDiv&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to set its content to &quot;Some text&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set id.myDiv = &quot;Some text&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, despite the fact it is not, Lindsey D solved my problem in the BEST way.&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="45" LastEditDate="2014-06-14T18:36:57.197" LastActivityDate="2014-06-14T18:36:57.197" Title="Using Twig, is it possible to dynamically insert text into a div by referencing the div's ID?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="166" PostTypeId="2" ParentId="164" CreationDate="2014-06-13T21:16:23.543" Score="15" Body="&lt;p&gt;No disrespect, but you may be misunderstanding the relationship between Twig and HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Twig code is completely oblivious to your HTML DOM structure. Its job is to parse any Twig tags into PHP (which are then ultimately rendered in HTML).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your example, try it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDiv = &quot;Some text&quot; %}&#xA;&amp;lt;div id=&quot;myDiv&quot;&amp;gt;{{ myDiv }}&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To expand further on the relationship between Twig/PHP/HTML, think of it like this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Twig is parsed on the &lt;strong&gt;server&lt;/strong&gt;. It generates a PHP file which represents your entire Twig file. That PHP file is stored until a change is made to your Twig template. Assuming nothing has changed, Twig will then call that PHP file directly (bypassing the original Twig file).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) PHP will then do everything it needs to do, again on the &lt;strong&gt;server&lt;/strong&gt;. It will finish rendering whatever HTML it needs to, before sending back that fully-parsed HTML to the &lt;strong&gt;client&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) Once you get the the &lt;strong&gt;client&lt;/strong&gt; side, it's all HTML (and CSS and JS). There is no more PHP or Twig.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-13T22:02:01.123" LastActivityDate="2014-06-13T22:02:01.123" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="167" PostTypeId="2" ParentId="153" CreationDate="2014-06-13T21:29:01.250" Score="14" Body="&lt;p&gt;Twig variables are only accessible inside their own scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is a scope:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tags like &lt;code&gt;{% block %}&lt;/code&gt;, &lt;code&gt;{% for %}&lt;/code&gt;, &lt;code&gt;{% nav %}&lt;/code&gt; create a 'scope', which means that variables defined inside them, can't be accessed from outside. This is similar to &lt;a href=&quot;http://php.net/manual/en/language.variables.scope.php&quot;&gt;local variables inside php-functions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block A %}&#xA;    {% set var = 'apple' %}&#xA;    {{ var }} {# This prints apple #}&#xA;{% endblock %}&#xA;&#xA;{% block B %}&#xA;    {{ var }} {# This doesn't prints anything, since var isn't defined #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Variables outside their scope:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make variables accessible outside their scope you have to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot;&gt;define them before&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = 'apple' %}  &#xA;&#xA;{% block A %}&#xA;    {{ var }} {# This prints apple #}&#xA;{% endblock %}&#xA;&#xA;{% block B %}&#xA;    {% set var = 'banana' %}&#xA;    {{ var }} {# This prints banana #}&#xA;{% endblock %}&#xA;&#xA;{% block A %}&#xA;    {{ var }} {# This prints banana #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-13T21:29:01.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="168" PostTypeId="1" CreationDate="2014-06-13T21:55:23.163" Score="7" ViewCount="433" Body="&lt;p&gt;I am trying to setup an events section similar to that of Yelp's Events.  They have a listing of all the upcoming events and have filters on the side for &quot;Today, Tomorrow&quot; etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I received help from Brandon Kelly and will be posting my answer below.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="101" LastEditDate="2014-06-13T22:03:32.870" LastActivityDate="2014-06-13T22:03:32.870" Title="How Do I show advanced Date filters for Events?" Tags="&lt;entries&gt;&lt;date&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="169" PostTypeId="2" ParentId="168" CreationDate="2014-06-13T21:59:19.070" Score="6" Body="&lt;p&gt;Thanks to Brandon Kelly's help I now have Events being filtered by my custom date field called &lt;code&gt;eventDate&lt;/code&gt; by doing the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set day = date(craft.request.getSegment(2)) %}&#xA;{% set nextDay = day|date_modify('+1 day') %}&#xA;{% set events = craft.entries.eventDate('and, &amp;gt;= '~day|date('Y-m-d')~', &amp;lt;'~nextDay|date('Y-m-d')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have some links in my side bar that append the appropriate Date to the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url('events/'~now|date('Y-m-d')) }}&quot;&amp;gt;Today&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ url('events/'~nextDay|date('Y-m-d')) }}&quot;&amp;gt;Tomorrow&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally I just loop that through like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in events %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope someone else can find this as handy as I did through Brandon's help!&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2014-06-13T21:59:19.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="170" PostTypeId="1" CreationDate="2014-06-13T22:03:15.840" Score="17" ViewCount="1021" Body="&lt;p&gt;Stemming from this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/168/how-do-i-show-advanced-filters-for-events&quot;&gt;original post&lt;/a&gt; I was able to show Events using a custom date field and successfully got &quot;Today&quot; and &quot;Tomorrow&quot; events to show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing some custom Math to show &quot;This Weekend&quot; or &quot;Next Week&quot; events? I'm sure I have to first write a conditional on determine what the current Day is, but not sure the best way to do this.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-06-15T09:31:53.623" Title="How to show events for &quot;This Weekend, Next Week&quot;" Tags="&lt;entries&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="171" PostTypeId="2" ParentId="170" CreationDate="2014-06-13T22:33:00.420" Score="22" Body="&lt;p&gt;Twigs &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date_modify.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;date_modify filter&lt;/a&gt; accepts every string, which is supported by phps &lt;a href=&quot;http://www.php.net/strtotime&quot; rel=&quot;nofollow noreferrer&quot;&gt;strtotime()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These strings are called &lt;a href=&quot;http://www.php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relative Formats&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/168/how-do-i-show-advanced-filters-for-events&quot;&gt;original post&lt;/a&gt; you used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set day = date('m/d/Y') %}&#xA;{% set nextDay = day|date_modify('+1 day') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but with &lt;a href=&quot;http://www.php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relative Formats&lt;/a&gt; you can also do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = day|date_modify('now') %}&#xA;{% set var = day|date_modify('10 September 2000') %}&#xA;{% set var = day|date_modify('+1 week') %}&#xA;{% set var = day|date_modify('+1 week 2 days 4 hours 2 seconds') %}&#xA;{% set var = day|date_modify('next Thursday') %}&#xA;{% set var = day|date_modify('last Monday') %}&#xA;{% set var = day|date_modify('next month') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(These are equivalents of the &lt;a href=&quot;http://www.php.net/strtotime#example-2413&quot; rel=&quot;nofollow noreferrer&quot;&gt;php-doc examples&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this weekend would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = day|date_modify('next Friday') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Or Saturday, personally I start my weekends on Thursday, so it's hard to give a good example ;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next weekend:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = day|date_modify('next Friday +7 days') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next weekend in one year, half an hour ago:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = day|date_modify('next Friday +1 year -30 minutes') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-06-13T22:33:00.420" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="172" PostTypeId="1" AcceptedAnswerId="173" CreationDate="2014-06-14T06:35:01.863" Score="5" ViewCount="4333" Body="&lt;p&gt;Lets say I have a simple string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;Simple String&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to get number of characters of my string?&lt;/p&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-06-14T09:16:11.523" Title="How to check how many characters there are in my string?" Tags="&lt;string&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="173" PostTypeId="2" ParentId="172" CreationDate="2014-06-14T06:53:40.967" Score="8" Body="&lt;p&gt;Twig has a &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot;&gt;length filter&lt;/a&gt; that can help you with that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stringLength = &quot;Simple String&quot; | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this also works on arrays to give you the number of items in the array.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-06-14T06:53:40.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="174" PostTypeId="1" AcceptedAnswerId="191" CreationDate="2014-06-14T07:41:40.207" Score="8" ViewCount="214" Body="&lt;p&gt;I want to be able to provide the admin with a function so that they can email all registered users of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a native function or plugin that would make this possible?&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="250" LastEditDate="2014-06-14T22:12:23.623" LastActivityDate="2014-07-13T04:53:04.057" Title="Is there a native function or plugin to allow admins to email all users?" Tags="&lt;users&gt;&lt;plugins&gt;&lt;emails&gt;&lt;function&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="175" PostTypeId="2" ParentId="2" CreationDate="2014-06-14T07:47:50.440" Score="4" Body="&lt;p&gt;[Edit: I'm deprecating this answer, having a better one up now I believe, but leaving it as it's attracted very useful comments. I think what's said here isn't quite wrong, but has been considerably improved upon, and can be more so as the community gains experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, though for good reason, Railgun has turned out to be more naive than I thought (or see it can be configured at present), so that it is a great help on responsiveness out at the edge, but limited to as far as the original server is also speedy. This speed can be obtained in degrees, using Craft's caching at appropriate levels, and eventually by Varnish if one needs the ultimate available. Any of these improvements will also proportionately reduce load (and expense) on the originating server, while naturally increasing the precision required of configuration. Getting something in place sounds like it could give the space to work out such details on a staging server.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought on the original question was to wonder how often Varnish was actually going to be needed. It turns out though that each of the types of caching could answer a given situation on their own, but also contribute when several are stacked, up to where there may be the additional need of Varnish,.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have Craft's controllable and auto-breaking caching, which can engage memory-store methods like memcached or redis if needed above the effectiveness of database caching, if needed above the effectiveness it can give with just the filesystem method, especially with modern hosting having SSD or cache-SSD disks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, though, are the abilities of Railgun, a new addition on CloudFlare. This gives you edge caching, even on pages that may include active changes. They do this by sending only deltas, and holding your cache on edges near your client, in parallel with the static edge cashing CloudFlare began with. There are competitors, for example Incapsula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Railgun has been apparently effective in small early trials here, but for high-page-access sites, it's going to also need load reduction and response-speed improvers for the source server, so let me conclude, and suggest the discussion of those in the fresh article.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-06-18T08:12:22.703" LastActivityDate="2014-06-18T08:12:22.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="177" PostTypeId="2" ParentId="172" CreationDate="2014-06-14T09:16:11.523" Score="2" Body="&lt;p&gt;If you are attempting to get a count of the string, you can use Twigs dump function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ dump(myString) }}&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-06-14T09:16:11.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="178" PostTypeId="1" AcceptedAnswerId="179" CreationDate="2014-06-14T09:35:38.687" Score="4" ViewCount="325" Body="&lt;p&gt;I found this part of code in the documentation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;Cocktail Recipes&quot;|t %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What does &lt;code&gt;|t&lt;/code&gt; mean there?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="125" LastEditDate="2014-06-15T01:05:55.220" LastActivityDate="2014-06-15T01:05:55.220" Title="What's that |t - filter for?" Tags="&lt;string&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="179" PostTypeId="2" ParentId="178" CreationDate="2014-06-14T09:39:04.923" Score="10" Body="&lt;p&gt;It's the short syntax for the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#translate-or-t&quot;&gt;translate filter&lt;/a&gt;. Set up a translation file as described in &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot;&gt;the docs&lt;/a&gt; and the string you apply that filter to is translated according to it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-14T09:39:04.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="180" PostTypeId="5" CreationDate="2014-06-14T09:46:26.777" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-06-14T09:46:26.777" LastActivityDate="2014-06-14T09:46:26.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="181" PostTypeId="4" CreationDate="2014-06-14T09:46:26.777" Score="0" Body="String is a data type, which value is sequence of characters or symbols." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T17:09:11.747" LastActivityDate="2014-07-12T17:09:11.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="182" PostTypeId="2" ParentId="129" CreationDate="2014-06-14T09:48:05.117" Score="5" Body="&lt;p&gt;I think what you want is to check if a property of the asset is empty, rather than the asset itself, as a concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following appears to work, and might be of interest if you think you have empty assets, or in this example, count filled-in ones:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.assets.filename(':notempty:') %}&#xA;&#xA;Filled Count is {{ entries.count() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could of course use any extra fields you've assigned to the Assets; as for checking attribution, photo date, rights, etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that match the problem you are trying to solve?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All right, adding on a deeper and also tested example, to solve the clarified problem, thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think about the stacking of queries, the desired field to check for being filled in is nested within a target element field, and therefore can't be searched directly by an ElementCriteriaModel in present form. So, we use a for loop to access this set of images, limited by field values defined of their Asset, in this case a source where the image was obtained. The inner for loop just verifies which image assets those are, by title.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params =  { section: 'lodging' } %}&#xA;{% set entries = craft.entries(params)  %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;&amp;lt;p&amp;gt; {{ entry.title }} &#xA;   count: {{ entry.images.imageSource(':notempty:') .count() }} &amp;lt;/p&amp;gt;&#xA;&#xA;     {% for sourcedImage in entry.images %}&#xA;          &amp;lt;p&amp;gt; - {{ sourcedImage.title }} &amp;lt;/p&amp;gt;&#xA;     {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've used a param block to define the initial query. This makes it a little clearer how we are using first-level fields of the original entity, and don't at present have a way to operate on any multi-valued contents. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture should probably be documented more clearly, and I've put on my list for cookbook pages to be made.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="177" LastEditDate="2014-06-15T09:31:31.083" LastActivityDate="2014-06-15T09:31:31.083" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="183" PostTypeId="2" ParentId="174" CreationDate="2014-06-14T09:51:41.910" Score="8" Body="&lt;p&gt;Currently there isn't a native function to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only plugin that I know of that can do this, is &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow&quot;&gt;Sprout Email from Barrel Strength Design&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just released a plugin called &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer&quot; rel=&quot;nofollow&quot;&gt;Craft-Mailer&lt;/a&gt; which does what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="115" LastEditDate="2014-07-13T04:53:04.057" LastActivityDate="2014-07-13T04:53:04.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="184" PostTypeId="1" AcceptedAnswerId="185" CreationDate="2014-06-14T09:52:56.017" Score="5" ViewCount="13666" Body="&lt;p&gt;Is it possible to convert a simple string (&quot;Hello World!&quot;) to uppercase (&quot;HELLO WORLD!&quot;)?&lt;/p&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-06-14T14:15:04.023" Title="Is it possible to convert string to uppercase?" Tags="&lt;string&gt;&lt;uppercase&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="185" PostTypeId="2" ParentId="184" CreationDate="2014-06-14T09:55:19.380" Score="15" Body="&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/upper.html&quot;&gt;upper filter&lt;/a&gt; is what you are looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = 'Hello World' %}&#xA;&#xA;{# Print in UPPERCASE #}&#xA;{{ var|upper }} {# 'HELLO WORLD' #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Besides &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/upper.html&quot;&gt;upper&lt;/a&gt; there are also some other filters available to modify the capitalization style of your strings. Of course there is the lowercase equivalent &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/lower.html&quot;&gt;lower&lt;/a&gt; and additionally there are some Craft exclusive &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters&quot;&gt;filters&lt;/a&gt; available.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {# Set test strings #}&#xA;  {% set strLower = 'this is a test string' %}&#xA;  {% set strUpper = 'THIS IS A TEST STRING' %}&#xA;  {% set strMixed = 'this Is a TEST stRing' %}&#xA;&#xA;  {# Apply Twig filters #}&#xA;  &amp;lt;li&amp;gt;upper: {{ strLower|upper }}&amp;lt;/li&amp;gt; {# 'THIS IS A TEST STRING' #}&#xA;  &amp;lt;li&amp;gt;lower: {{ strUpper|lower }}&amp;lt;/li&amp;gt; {# 'this is a test string' #}&#xA;&#xA;  {# Apply filters provided by Craft #}&#xA;  &amp;lt;li&amp;gt;ucwords: {{ strLower|ucwords }}&amp;lt;/li&amp;gt; {# 'This Is A Test String' #}&#xA;  &amp;lt;li&amp;gt;ucfirst: {{ strLower|ucfirst }}&amp;lt;/li&amp;gt; {# 'This is a test string' #}&#xA;  &amp;lt;li&amp;gt;lcfirst: {{ strUpper|lcfirst }}&amp;lt;/li&amp;gt; {# 'tHIS IS A TEST STRING' #}      &#xA;&#xA;  {# Combine filters for predictable application #}&#xA;  &amp;lt;li&amp;gt;ucwords: {{ strMixed|lower|ucwords }}&amp;lt;/li&amp;gt; {# 'This Is A Test String' #}&#xA;  &amp;lt;li&amp;gt;ucfirst: {{ strMixed|lower|ucfirst }}&amp;lt;/li&amp;gt; {# 'This is a test string' #}&#xA;  &amp;lt;li&amp;gt;lcfirst: {{ strMixed|upper|lcfirst }}&amp;lt;/li&amp;gt; {# 'tHIS IS A TEST STRING' #}&#xA;&#xA;  {# Examples for possible use cases #}&#xA;  &amp;lt;li&amp;gt;PascalCase: {{ strMixed|lower|ucwords|replace(' ', '') }}&amp;lt;/li&amp;gt; {# 'ThisIsATestString' #}&#xA;  &amp;lt;li&amp;gt;camelCase: {{ strMixed|lower|ucwords|lcfirst|replace(' ', '') }}&amp;lt;/li&amp;gt; {# 'thisIsATestString' #}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="125" LastEditDate="2014-06-14T14:15:04.023" LastActivityDate="2014-06-14T14:15:04.023" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="186" PostTypeId="1" AcceptedAnswerId="187" CreationDate="2014-06-14T10:57:28.843" Score="6" ViewCount="22216" Body="&lt;p&gt;How do I replace &quot;;&quot; with &quot;,&quot; in string &quot;Red; Green; Blue&quot;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rgb = &quot;Red; Green; Blue&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-06-14T11:19:30.177" Title="How to replace characters in string" Tags="&lt;string&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="187" PostTypeId="2" ParentId="186" CreationDate="2014-06-14T11:19:30.177" Score="18" Body="&lt;p&gt;Twig has a &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot;&gt;replace filter&lt;/a&gt; for that. You can replace strings/vars with strings/vars: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;I love apples&quot; %}&#xA;{% set var = &quot;like&quot; %}&#xA;{% set string = string|replace({'apples': 'kiwis', 'love': var}) %}&#xA;&#xA;{{ string }} {# Prints &quot;I like kiwis&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rgb = &quot;Red; Green; Blue&quot; %}&#xA;{% set rgb = rgb|replace({';': ','}) %}&#xA;&#xA;{{ rgb }} {# Prints &quot;Red, Green, Blue&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-14T11:19:30.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="188" PostTypeId="1" AcceptedAnswerId="190" CreationDate="2014-06-14T17:31:11.557" Score="6" ViewCount="168" Body="&lt;p&gt;When to use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ variable.property }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and when to use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ variable['property'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a difference between these methods of accessing attributes of a variable or advantages of using one of them?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-06-17T15:55:04.923" LastActivityDate="2014-06-17T15:55:04.923" Title="Difference between using subscript syntax and &quot;dot&quot; syntax when accessing attributes of a variable or advantages of usage one of them" Tags="&lt;variable&gt;&lt;difference&gt;&lt;attribute&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="189" PostTypeId="2" ParentId="188" CreationDate="2014-06-14T17:35:30.257" Score="4" Body="&lt;p&gt;Generally speaking, no. They are just two ways of saying the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dot syntax is necessary when you are referring to a &lt;strong&gt;method&lt;/strong&gt; within an object. However, if you are only trying to access the &lt;strong&gt;property&lt;/strong&gt; of an object (or a value within an array), either technique will work.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-14T17:35:30.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="190" PostTypeId="2" ParentId="188" CreationDate="2014-06-14T17:36:20.490" Score="7" Body="&lt;p&gt;They're both the same for the most part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only time I'd use the second way you listed is when the property is a variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = 'name' %}&#xA;{{ variable[foo] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you &lt;code&gt;{{ variable.name }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2014-06-14T17:41:45.213" LastActivityDate="2014-06-14T17:41:45.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="191" PostTypeId="2" ParentId="174" CreationDate="2014-06-14T18:09:15.417" Score="7" Body="&lt;p&gt;Natively, there is no direct way to do this. It is possible, however, to easily create this functionality with a plugin...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Build an&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot;&gt;ElementCriteriaModel&lt;/a&gt;&#xA;which will return a list of all users. Organize that data into a&#xA;batch (or multiple batches) of recipient email addresses.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/apis/emailservice&quot;&gt;EmailService&lt;/a&gt; API&#xA;to generate an email to your selected recipients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Depending on your specific plans, some other small &quot;in between&quot; steps may be required to suit your individual needs.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-14T18:09:15.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="192" PostTypeId="2" ParentId="129" CreationDate="2014-06-14T18:15:21.577" Score="8" Body="&lt;p&gt;You can do this with the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;relatedTo param&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First get all assets that could possibly be related. (If you only wanted to find entries that related assets from a particular &lt;em&gt;source&lt;/em&gt;, this would be the place to add that filter.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next up, you would get all the entries that are related to any of those assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').relatedTo({&#xA;    targetElement: assets,&#xA;    field: 'myAssetsField'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now you can do with those as you wish.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-14T18:15:21.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="193" PostTypeId="1" AcceptedAnswerId="194" CreationDate="2014-06-14T18:26:38.047" Score="2" ViewCount="6478" Body="&lt;p&gt;How can I split (or explode) a Twig string like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fruits = &quot;Apples; Bananas; Tomatoes&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into an array like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ [&quot;Apples&quot;, &quot;Bananas&quot;, &quot;Tomatoes&quot;] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="250" LastEditorUserId="177" LastEditDate="2014-06-14T21:19:05.460" LastActivityDate="2014-06-14T21:19:05.460" Title="How to split a string into an array" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="194" PostTypeId="2" ParentId="193" CreationDate="2014-06-14T18:29:22.613" Score="5" Body="&lt;p&gt;You would use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;split&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fruits = &quot;Apples; Bananas; Tomatoes&quot; | split('; ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2014-06-14T18:35:02.703" LastActivityDate="2014-06-14T18:35:02.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="195" PostTypeId="2" ParentId="193" CreationDate="2014-06-14T18:30:47.553" Score="1" Body="&lt;p&gt;Use &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot; rel=&quot;nofollow&quot;&gt;Twig's split filter.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;Apples; Bananas; Tomatoes&quot;|split('; ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-06-14T18:30:47.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="196" PostTypeId="1" AcceptedAnswerId="199" CreationDate="2014-06-14T19:47:57.470" Score="4" ViewCount="348" Body="&lt;p&gt;I'm currently using a route to get a specific asset for a gallery section of my site. URL is similiar to &lt;a href=&quot;http://craft.dev/place/place-name/gallery/1&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev/place/place-name/gallery/1&lt;/a&gt; (Where 1 is the number in the gallery.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently doing the following in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set entry = craft.entries.slug(craft.request.getSegment(2)).first() %}&#xA;&#xA;{% set image = entry.images[craft.request.getSegment(4) - 1] %}&#xA;&#xA;{% block content %}&#xA;&#xA;    {{image.getImg('featuredImage')}}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works currently but is there a cleaner way to do it without the &lt;code&gt;- 1&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-06-14T21:08:28.583" Title="Better way to find a specific asset?" Tags="&lt;gallery&gt;&lt;assetfilemodel&gt;&lt;getsegment&gt;&lt;index&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="199" PostTypeId="2" ParentId="196" CreationDate="2014-06-14T21:08:28.583" Score="5" Body="&lt;p&gt;That’s definitely the way to do it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would set the URL segments to their own variables, to clean it up a little bit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entrySlug = craft.request.getSegment(2) %}&#xA;{% set imageOffset = craft.request.getSegment(4) - 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, probably a good idea to include the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#section&quot;&gt;section&lt;/a&gt; param when fetching the entry, in case you have another entry in another section with the same slug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('mySection').slug(entrySlug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only issue I can think of is, if the 4th segment is greater than the total number of assets, you’re going to get an error. You can grab the asset using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#offset&quot;&gt;offset&lt;/a&gt; param instead, and check to see if anything is returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.images.offset(imageOffset).first() %}&#xA;&#xA;{% if not image %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-14T21:08:28.583" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="200" PostTypeId="1" AcceptedAnswerId="203" CreationDate="2014-06-14T21:39:40.937" Score="6" ViewCount="12024" Body="&lt;p&gt;How can I incorporate a variable into a string, so that the result is a longer string that includes the contents of a given variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a variable called &lt;code&gt;apple&lt;/code&gt; and its value is &quot;Arlington Pippin&quot; (it's a &lt;a href=&quot;http://www.orangepippin.com/apples/arlington-pippin&quot; rel=&quot;noreferrer&quot;&gt;type of apple&lt;/a&gt;). I'd like to end up with a phrase that reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is an Arlington Pippin.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How could I accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-06-18T19:56:09.700" LastActivityDate="2019-01-30T17:35:22.510" Title="How can I incorporate a variable into a string?" Tags="&lt;templating&gt;&lt;string&gt;&lt;variable&gt;&lt;concatenation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="201" PostTypeId="2" ParentId="200" CreationDate="2014-06-14T21:39:40.937" Score="17" Body="&lt;p&gt;I know three ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;format()&lt;/code&gt; (look for &lt;a href=&quot;http://ru2.php.net/manual/en/function.sprintf.php&quot;&gt;type specifiers&lt;/a&gt;)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;There is an %s.&quot;|format(&quot;apple&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using string interpolation (assuming that &lt;code&gt;apple=&quot;apple&quot;&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;There is an #{apple}.&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using string concatenation (assuming that &lt;code&gt;apple=&quot;apple&quot;&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;There is an &quot; ~ apple %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-06-14T21:39:40.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="202" PostTypeId="2" ParentId="10" CreationDate="2014-06-14T21:48:45.847" Score="17" Body="&lt;p&gt;Hmm. I started out having a feeling existing tools might be a best approach here. I soon found that even with the better of these, except for in-dev patching, we may want to wait for a Craft capability for transferring any less than a full dump of data in a Craft database. Syncing databases is a tricky problem, unless they are of exactly the same structural vintage and you want to take it all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft you have the strong issue of how much of its capability which we take for granted is based on accurate use of foreign keys, which must be handled correctly by pulling the data that relates this way into the sync or merge, if it is not a total replacement - more on this below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want all current live data on a dev or staging database, you cam avoid the problems. It's very easy to do what that Wordpress plugin does: just take an sql dump of the live site, drop the dev database, and import the dump to replace your working data. This can be done with phpMyAdmin, much less pleasantly with MySQL Workbench, both free; or for as low as $10 you can have the base version of Navicat, Navicat Essentials, which is very slick, very fast, and with a free trial even at that price point. I think it's a good deal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that this method is best to use, unless you want to get in deep, or wait for a possible Craft feature solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does sound good indeed to just pull over fragments from a working or alternate dev database. It could certainly come in handy, especially as it wouldn't wipe out your own present partial work. I've had a very brief look at some current tools to try to see how they might support this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall conclusion (tl:dr): unless you want to really understand all technical aspects of the Craft database, at least in the area you are working, syncing fragments, for example test data for a new development, is not a sensible option. Further, unless I miss my overview taken quickly, the assistance of even the expensive db tools is not sufficient for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the difficulties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;you'd have to discover what tables are related, and copy over the&#xA;related records also for the data set you're interested in&#xA;transferring.&lt;/li&gt;&#xA;&lt;li&gt;Reverse engineering screens available in the more expensive versions&#xA;of paid tools could help with this, but it's still a write-down&#xA;process: they don't directly create the queries for data transfer.&lt;/li&gt;&#xA;&lt;li&gt;Worse, as with almost any system, Craft isn't entirely consistent in&#xA;using defined foreign keys for related data. So you have to 'know'&#xA;rather than tool-aided discover the needed tables. Sometimes those&#xA;are easy enough to guess, but...&lt;/li&gt;&#xA;&lt;li&gt;There are some 'floating' tables it may be hard to guess about. For&#xA;example, the migrations table. I found that had extra records on on&#xA;one of two relatively related sites, and it was probably because of&#xA;the initial craft version point installed on each. But to be sure?&lt;/li&gt;&#xA;&lt;li&gt;finally, but not small, consider consistency. Are you able to be&#xA;certain keys for data won't overwrite or otherwise supplant those on&#xA;a live database? Consider especially any generated keys, whether&#xA;simple unique names or autoincremented or autoincrement&#xA;variable-derived.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think it's not a small or unintended omission that even the expensive database tools quietly don't actually support automatic relational data merges. Just like text merges, you have to understand meaning to do it. The better ones have tools that can help you do that if very knowledgeable, but they don't automate using the information. You are on your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you do it anyway, merge in fragments from another development, or useful data from a live site?  You can - with varying degrees of misperformance or destructiveness, wherever you don't know or remember all the important relationships or data details. Caveat emptor, but in principle you can do it, given you're replete with backups and ready to start over. Thus this would be a dev-only move, and if you think it will save you over just using Craft to enter the the new data, say from windows side-by-side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have a play for yourself, I personally liked the look of Toad, which is entirely free, and possibly the nicest-implemented free tool to have seen, including its inside-integrated support and community system. Unusually, it's provided by Dell, as their free software contribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Toad operates a lot like a text diff-merge tool, and I had it ready to complete a chooseable merge of two databases in about five minutes from cold start -- if you didn't have the actual difficulties hinted at above for doing this correctly. Probably more, but that's what it felt like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying this will give you an idea of what you actually want in doing a merge. There's an amount of actual complexity in a database; it's not just a set of data lists to be conveniently manipulated by your framework's query builder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under Toad's Tools is what's called a Master-Detail Browser. This will build a pretty Entity-Relation diagram, showing you foreign key relations for a data area -- but ONLY when those have been defined. To see quickly an area where they aren't, try Categories and Category Groups - just an example to underline that you have to understand Craft's detail design, not just what a tool shows you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this Master-Detail Browser with some understanding of the Craft area, you can probably write down a paper list of what tables need to be considered. Then you could use Toad's Data Compare to see differences in that nice diff mode for two databases, and choose the tables you want to include from the paper list. Toad will then generate an SQL script to make the transfer - which you would sensibly only try with a complete backup first taken of the original dev database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might help you to try a new template or plugin feature, but only with full awareness of the potential inaccuracy of what you are doing. After such a testbed, you'd start clean again, no doubt by loading a backup or transfer of a clean working database. Building your test data again by entering through Craft will be a good test that you've done things right in your new code, and in relation to that in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps that's just as true if Craft actually could provide a partial data export/transfer ability in future? It might be some measure on whether they should. Immediate desires may be popular, but not always the best way forward; it's why we do what is design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, it's just one view here, and you may have another, but hoping it's useful, and that through comments and other solutions, we each may learn a thing.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-06-14T22:02:16.413" LastActivityDate="2014-06-14T22:02:16.413" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="203" PostTypeId="2" ParentId="200" CreationDate="2014-06-14T22:04:24.530" Score="18" Body="&lt;p&gt;If you‘ve got a multi-lingual site (or even if you don’t), you can pass variables into strings with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#translate-or-t&quot;&gt;&lt;code&gt;|t&lt;/code&gt; filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;Welcome back, {name}&quot;|t( {'name': currentUser.name} ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(See &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot;&gt;http://buildwithcraft.com/help/static-translations&lt;/a&gt; for details on how you can use the &lt;code&gt;|t&lt;/code&gt; filter to translate your text.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-14T22:04:24.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="204" PostTypeId="1" AcceptedAnswerId="214" CreationDate="2014-06-15T01:28:30.860" Score="8" ViewCount="2320" Body="&lt;p&gt;For example, if I'd like to serve a file as &lt;code&gt;application/json&lt;/code&gt; or &lt;code&gt;application/rss+xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/rss-feed&quot;&gt;RSS Feed documentation&lt;/a&gt; that it mentions saving a file with .rss will auto-detect and serve the correct mime-type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, how is this detected? Is there a set list that the CMS uses based on the extension or is it derived from the server in some way?&lt;/p&gt;&#xA;" OwnerUserId="287" LastEditorUserId="32" LastEditDate="2014-06-15T09:32:14.950" LastActivityDate="2019-09-24T13:11:56.233" Title="How do I set mime-types for Craft templates?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="205" PostTypeId="1" AcceptedAnswerId="207" CreationDate="2014-06-15T02:11:05.487" Score="4" ViewCount="815" Body="&lt;p&gt;It is &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;beautifully described&lt;/a&gt; in the docs how to translate static text using translation files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the client has no access to that file and managing a php array is not what I want them to do, I am looking for a way to make edits to the translation file feasible directly in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would allow me to set things up in the template and then hand off the actual translation work to someone else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you probably have to write a plugin for that. But can you edit the files from a plugin? Is there any API or service available that might help?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2014-06-15T03:22:33.080" LastActivityDate="2014-08-06T09:38:06.463" Title="Is it possible to manage language translations without directly accessing the PHP translations file?" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="206" PostTypeId="2" ParentId="205" CreationDate="2014-06-15T02:24:00.440" Score="0" Body="&lt;p&gt;I assume this is for a language that the CP hasn't been translated into, yet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, maybe the better solution here is to help us get the CP translated into that language at which point we'll officially start supporting it in future releases.  We're currently managing our translations on PhraseApp (&lt;a href=&quot;http://phraseapp.com&quot; rel=&quot;nofollow&quot;&gt;http://phraseapp.com&lt;/a&gt;) and gladly accept contributions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-15T02:24:00.440" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="207" PostTypeId="2" ParentId="205" CreationDate="2014-06-15T02:32:16.213" Score="5" Body="&lt;p&gt;I'm pretty new to Craft but I'll tell you what I'd try anyway for fun.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd create a &quot;Translations&quot; assets source that would hold files like &lt;code&gt;es.csv&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in &lt;code&gt;craft/translations/es.php&lt;/code&gt;, I'd run through that CSV and build the array Craft wants and return it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$path = $_SERVER['DOCUMENT_ROOT'].'/../craft/translations/translations.csv';&#xA;$delimiter = ';';&#xA;$skip_rows = 1; //skip header rows&#xA;$primary_locale_column = 0; //set primary locale column&#xA;$this_locale_column = 1; //set secondary locale column for this `lang.php` file&#xA;&#xA;$translations = array();&#xA;$translations_file = fopen($path, 'r');&#xA;&#xA;if ($translations_file) {&#xA;    while(($translation = fgetcsv($translations_file, 1024, $delimiter)) !== FALSE) {&#xA;        if($skip_rows != 0) { $skip_rows--; continue; }&#xA;        $translations[$translation[$primary_locale_column]] = $translation[$this_locale_column];&#xA;    }&#xA;}&#xA;&#xA;return $translations;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;This is totally untested.&lt;/s&gt;&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="125" LastEditDate="2014-08-06T09:38:06.463" LastActivityDate="2014-08-06T09:38:06.463" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="208" PostTypeId="2" ParentId="204" CreationDate="2014-06-15T02:54:25.690" Score="9" Body="&lt;p&gt;The mime type is automatically determined based on the file extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is nothing within Craft which determines the mime type. Detection follows normal server standards, looking at the file extension to figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a little digging, it appears that Craft relies on the Yii &lt;strong&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CFileHelper&quot;&gt;CFileHelper&lt;/a&gt;&lt;/strong&gt; class to determine the mime type of a file. Reading through the Yii docs gives the impression that several techniques are used to figure out the mime type (including looking at the file extension).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line... Give your file the right extension, and it will be served up with the correct mime type.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-15T03:04:12.600" LastActivityDate="2014-06-15T03:04:12.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="209" PostTypeId="1" AcceptedAnswerId="210" CreationDate="2014-06-15T03:18:35.423" Score="3" ViewCount="642" Body="&lt;p&gt;If I have a site that will eventually have thousands of product images on it, would using image transforms slow things down?  &lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="22" LastEditDate="2014-06-17T19:37:02.963" LastActivityDate="2014-06-17T19:37:02.963" Title="Can image transforms decrease performance?" Tags="&lt;image-transforms&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="210" PostTypeId="2" ParentId="209" CreationDate="2014-06-15T03:21:34.500" Score="9" Body="&lt;p&gt;Nope. Once a transform has been generated once, Craft remembers that, and saves it right in your asset source. Future page loads will get a direct URL to that generated image, so it gets loaded via your webserver (or S3, etc.) directly. No PHP involved.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-15T03:21:34.500" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="211" PostTypeId="2" ParentId="209" CreationDate="2014-06-15T03:21:50.713" Score="8" Body="&lt;p&gt;For all practical purposes, no.  The performance hit for images transforms happens the first time the transform is requested and generated.  After that, the images are served as a normal file that your web server can serve up as quickly as any other file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-15T03:33:13.807" LastActivityDate="2014-06-15T03:33:13.807" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="212" PostTypeId="1" AcceptedAnswerId="251" CreationDate="2014-06-15T06:09:44.843" Score="5" ViewCount="440" Body="&lt;p&gt;When I have a folder setup for template partials, is there a way I could automatically populate a drop-down with the list of templates in that folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be useful in the case where I have a complex matrix field set, and would like to select a partial to render or include along with the block's content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the drop-down were automatically populated, it would eliminate a lot of time setting up the drop-downs in the backend, and would make it much easier to deploy new feature sets across many Craft based sites as they are developed or improved.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2014-06-15T06:24:51.573" LastActivityDate="2014-06-18T02:24:15.943" Title="Is there a way to populate a drop-down with the templates files in a folder?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;drop-down&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="213" PostTypeId="2" ParentId="212" CreationDate="2014-06-15T06:25:38.097" Score="6" Body="&lt;p&gt;This would be a good task for a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd essentially need to build the plugin to do a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Use PHP in a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot;&gt;service&lt;/a&gt;&lt;/strong&gt; to list the contents of a directory. Once you have that list, you'd then need to...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Deliver that information to the front end via a custom &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot;&gt;field type&lt;/a&gt;&lt;/strong&gt;. You can then use your new custom field type wherever you'd like.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-15T06:31:51.433" LastActivityDate="2014-06-15T06:31:51.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="214" PostTypeId="2" ParentId="204" CreationDate="2014-06-15T13:14:44.017" Score="17" Body="&lt;p&gt;If you want to explicitly set the mime type from your template, you can do it with Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#header&quot;&gt;{% header %} tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it is already set via this method, Craft will go with it and not attempt to auto-detect/set the mime-type on it's own.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2014-06-15T20:07:09.757" LastActivityDate="2014-06-15T20:07:09.757" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="215" PostTypeId="1" AcceptedAnswerId="216" CreationDate="2014-06-15T13:19:24.053" Score="3" ViewCount="4303" Body="&lt;p&gt;How do I escape Twig code to prevent it from being processed?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-06-17T19:27:21.787" LastActivityDate="2017-01-24T14:26:42.273" Title="How can I escape Twig code to prevent it from being parsed?" Tags="&lt;templating&gt;&lt;escaping&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="216" PostTypeId="2" ParentId="215" CreationDate="2014-06-15T13:19:24.053" Score="12" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Escape single lines as strings:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ '{% set foo = &quot;bar&quot; %}' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/autoescape.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;autoescape&lt;/code&gt;&lt;/a&gt; to escape multiple lines, optionally specifying a syntax (see docs):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% autoescape %}&#xA;     {% if foo != &quot;bar&quot; %}&#xA;         {% set foo = &quot;bar&quot; %}&#xA;     {% endif %}&#xA;{% endautoescape %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/verbatim.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;verbatim&lt;/code&gt;&lt;/a&gt; to treat multiple lines as raw text&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% verbatim %}&#xA;     {% if foo != &quot;bar&quot; %}&#xA;         {% set foo = &quot;bar&quot; %}&#xA;     {% endif %}   &#xA;{% endverbatim %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-06-26T21:36:56.647" LastActivityDate="2014-06-26T21:36:56.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="217" PostTypeId="1" AcceptedAnswerId="220" CreationDate="2014-06-15T14:45:07.077" Score="8" ViewCount="796" Body="&lt;p&gt;I'm trying to use a lightswitch-field in a plugin-config. But for some reason it won't get saved. The lightswitch-field is always off.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        ...&#xA;        'mailerShowInfo' =&amp;gt; array(AttributeType::Bool, 'default' =&amp;gt; false),&#xA;        ...&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_settings.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{  forms.lightswitchField({&#xA;        label: &quot;Show info in sidebar?&quot;|t,&#xA;        id: 'mailerShowInfo',&#xA;        name: 'mailerShowInfo',&#xA;        value: settings.mailerShowInfo,&#xA;        required: true&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to use AttributeType::Number instead, and even used &lt;a href=&quot;http://php.net/manual/en/function.settype.php&quot;&gt;settype()&lt;/a&gt; in &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/plugin-settings&quot;&gt;prepSettings()&lt;/a&gt; to force a boolean conversion, but still nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="115" LastEditDate="2014-06-15T16:05:55.463" LastActivityDate="2014-06-15T16:05:55.463" Title="How do I maintain the on value with a lightswitch-field as a plugin setting?" Tags="&lt;field&gt;&lt;plugin-development&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="218" PostTypeId="1" AcceptedAnswerId="219" CreationDate="2014-06-15T14:47:31.733" Score="9" ViewCount="1669" Body="&lt;pre&gt;&lt;code&gt;{% if foo is same as('bar') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;vs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if foo == 'bar' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When to use first and when to use second? Does one of them has advantages over another?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-06-17T19:56:06.217" LastActivityDate="2014-06-18T08:28:00.463" Title="When to use &quot; is same as&quot; and when to use &quot;==&quot;" Tags="&lt;templating&gt;&lt;difference&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="219" PostTypeId="2" ParentId="218" CreationDate="2014-06-15T15:10:48.373" Score="14" Body="&lt;p&gt;Looking at the Twig code, they have this documented for the “same as” test:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Checks if a variable is the same as another one (=== in PHP).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I won’t re-hash the details of === vs. == in PHP because there is an excellent comparison here: &lt;a href=&quot;https://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp&quot;&gt;https://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The money quote is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;== compares the values of variables for equality, type casting as necessary. === checks if the two variables are of the same type AND have the same value.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And here’s what the PHP docs have to say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.php.net/manual/en/language.operators.comparison.php&quot;&gt;http://www.php.net/manual/en/language.operators.comparison.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-15T19:35:05.367" LastActivityDate="2014-06-15T19:35:05.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="220" PostTypeId="2" ParentId="217" CreationDate="2014-06-15T15:48:35.873" Score="13" Body="&lt;p&gt;I believe you need to set the &lt;code&gt;on&lt;/code&gt; value of your lightswitch field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;on: (settings.mailerShowInfo is defined) ? settings.mailerShowInfo : &quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, the full settings of your twig code would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{  forms.lightswitchField({&#xA;        label: &quot;Show info in sidebar?&quot;|t,&#xA;        id: 'mailerShowInfo',&#xA;        name: 'mailerShowInfo',&#xA;        value: settings.mailerShowInfo,&#xA;        required: true&#xA;        on: (settings.mailerShowInfo is defined) ? settings.mailerShowInfo : &quot;&quot;&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-15T15:48:35.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="221" PostTypeId="1" AcceptedAnswerId="222" CreationDate="2014-06-15T16:04:59.517" Score="9" ViewCount="7217" Body="&lt;p&gt;We have a some conditional logic for a dashboard style setup. We have urls like : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;neptune/{id}/details&#xA;neptune/{id}/options&#xA;neptune/{id}/confirm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual urls accessible depend on the status of the elements in question, and the whole process has a flow setup - the user has to go through each part in turn, ie. details &gt; options &gt; confirm, however they can go back and revise and drop out entirely and pick up where they left off later. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all works fine, but to smooth out things we'd ideally have a way to automatically force a redirect from a urls based on the current state. If this were ExpressionEngine we'd have a tag like : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{redirect=&quot;neptune/{id}/confirm&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the equivalent Craft/Twig setup? Or is there an alternative better setup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : this isn't for the main flow of the user, only needed for the actual edge cases where a user may revisit (ie. manually) an out of flow url somehow, so isn't related to the core logic. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-25T20:29:31.023" Title="How to automatically redirect a url based on dynamic content" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="222" PostTypeId="2" ParentId="221" CreationDate="2014-06-15T16:07:48.977" Score="10" Body="&lt;p&gt;Take a look at Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#redirect&quot;&gt;redirect&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect '/' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect 'neptune/' ~ id ~ '/confirm' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-15T16:07:48.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="223" PostTypeId="1" AcceptedAnswerId="224" CreationDate="2014-06-15T21:34:54.763" Score="19" ViewCount="2112" Body="&lt;p&gt;Auto-updating is great and all, but sometimes you need to roll-back to a previous version or build of Craft for whatever reason.  Where can you download these?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2020-08-05T00:31:25.827" Title="Where can I download previous versions of Craft?" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="224" PostTypeId="2" ParentId="223" CreationDate="2014-06-15T21:39:28.770" Score="26" Body="&lt;p&gt;&lt;strong&gt;In Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download previous versions of Craft from &lt;a href=&quot;https://download.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://download.craftcms.com&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Previous versions and builds of Craft are available with the following URL format in both zip and tar.gz versions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://download.craftcms.com/craft/{version}/{version}.{build}/Craft-{version}.{build}.zip (or .tar.gz)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example, if you wanted Craft 2.1 build 2557 in tar.gz format, it would be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://download.craftcms.com/craft/2.1/2.1.2557/Craft-2.1.2557.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that downloading Craft releases directly still binds you to Craft’s license agreement, and keep in mind that Craft does not support rolling back to previous versions automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’ve already updated your site past a certain release and want to go back to it, you’ll need to find and restore a database backup that was created with the version you’re going back to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download previous Craft 3 versions in several ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;From pre-built packages in this format:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://download.craftcms.com/craft/{majorVersion}/Craft-{majorVersion}.{minorVersion}.zip (or .tar.gz)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://download.craftcms.com/craft/3.0/Craft-3.0.26.1.zip (or .tar.gz)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Directly from the &lt;a href=&quot;https://github.com/craftcms/cms/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Github repo release&lt;/a&gt; page&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since Craft 3 is &lt;a href=&quot;https://getcomposer.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer&lt;/a&gt; based, you can modify your &lt;code&gt;composer.json&lt;/code&gt;'s &lt;code&gt;craftcms/cms&lt;/code&gt; line to install the previous version you're looking for.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-10-15T18:14:19.723" LastActivityDate="2018-10-15T18:14:19.723" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="225" PostTypeId="1" AcceptedAnswerId="226" CreationDate="2014-06-15T21:44:51.613" Score="32" ViewCount="1489" Body="&lt;p&gt;If you have a base install script that you use to quickly turn out a new base install for Craft, it would be very useful for that script to be able to download the latest version of Craft when doing it’s new site setup logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What’s the best way to do that?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-30T03:55:43.127" Title="Is there a way I can programmatically download the latest version of Craft?" Tags="&lt;setup&gt;&lt;install&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="226" PostTypeId="2" ParentId="225" CreationDate="2014-06-15T21:48:32.447" Score="37" Body="&lt;p&gt;&lt;strong&gt;In Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download the latest Craft 3 release in zip or .tar.gz format by going to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://craftcms.com/latest.zip&#xA;https://craftcms.com/latest.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or since Craft 3 is &lt;a href=&quot;https://getcomposer.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer&lt;/a&gt; based, you can modify your &lt;code&gt;composer.json&lt;/code&gt;'s &lt;code&gt;craftcms/cms&lt;/code&gt; line to install the specific version you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft 2:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the latest Craft 2 version in either zip or tar.gz format by going to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://craftcms.com/latest-v2.zip&#xA;https://craftcms.com/latest-v2.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-11-30T03:55:43.127" LastActivityDate="2018-11-30T03:55:43.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="227" PostTypeId="2" ParentId="150" CreationDate="2014-06-16T08:09:56.290" Score="2" Body="&lt;p&gt;This should output what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.order('dateUpdated desc') %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although the easiest way to create an xml sitemap is to use the &lt;a href=&quot;http://www.putyourlightson.net/craft-cms-plugins&quot; rel=&quot;nofollow&quot;&gt;Sitemap Plugin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-27T16:24:52.063" LastActivityDate="2014-06-27T16:24:52.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="228" PostTypeId="1" AcceptedAnswerId="232" CreationDate="2014-06-16T12:47:27.173" Score="13" ViewCount="45308" Body="&lt;p&gt;Is it possible to perform a RegEx match on a string in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;This is **string**. **wer**  qewr **234**&quot; %}&#xA;{% set match  = string.matches(/([*][*])(.*)([*][*])/g) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="250" LastEditorUserId="177" LastEditDate="2014-06-16T15:06:40.240" LastActivityDate="2016-11-18T05:47:35.430" Title="How can I perform a RegEx match in Twig?" Tags="&lt;templating&gt;&lt;regex&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="229" PostTypeId="1" AcceptedAnswerId="231" CreationDate="2014-06-16T15:49:28.663" Score="6" ViewCount="4009" Body="&lt;p&gt;I'm trying to push a site live today and am running into a problem I'm having trouble solving. I have a staging site which is a subdomain on the live server and everything works fine there but when I try to load the live site I get the following error (strange characters and all):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An exception has been thrown during the rendering of a template (&quot;Craft can't connect to the database with the credentials in craft/config/db.php.&quot;) in &quot;_includes/_main_nav&quot; at line 19.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The only difference between the two config files is the database name in db.php and the siteUrl and fileSystemPath in general.php. I do have a multi-environment config based on the one at straughtupcraft.com but I don't see any other difference between my live and staging environments other then what is already noted above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone run across this problem yet? Solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.php:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;//die('hey');&#xA;&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&#xA;&#xA;// Check the SERVER_NAME variable ourselves&#xA;switch ($_SERVER['SERVER_NAME']) &#xA;{&#xA;    // If the SERVER_NAME variable matches our case, &#xA;    // assign the CRAFT_ENVIRONMENT variable a keyword &#xA;    // that identifies this environment that we can &#xA;    // use in our multi-environment config&#xA;&#xA;    case 'site.com' :&#xA;        define('CRAFT_ENVIRONMENT', 'live');&#xA;        break;&#xA;&#xA;    case 'staging.site.com' :&#xA;        define('CRAFT_ENVIRONMENT', 'staging');&#xA;        break;&#xA;&#xA;    default :&#xA;        define('CRAFT_ENVIRONMENT', 'dev');&#xA;        break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cpTrigger' =&amp;gt; 'site_admin',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'slugWordSeparator' =&amp;gt; &quot;_&quot;,&#xA;    ),&#xA;    'live' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://site.com',&#xA;            'fileSystemPath' =&amp;gt; '/path/to/domains/site.com/html'&#xA;        )&#xA;    ),&#xA;    'staging' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://staging.site.com',&#xA;            'fileSystemPath' =&amp;gt; '/path/to/domains/staging.site.com/html'&#xA;        )&#xA;    ),&#xA;    'dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://site.dev',&#xA;            'fileSystemPath' =&amp;gt; '/users/stubear/sites/site/dev/html'&#xA;        )&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    'live' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'server',&#xA;        'user' =&amp;gt; 'username',&#xA;        'password' =&amp;gt; '********',&#xA;        'database' =&amp;gt; 'craft_live_db',&#xA;    ),&#xA;    'staging' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'server',&#xA;        'user' =&amp;gt; 'username',&#xA;        'password' =&amp;gt; '********',&#xA;        'database' =&amp;gt; 'craft_staging_db',&#xA;    ),&#xA;    'dev' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'site-dev',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="231" LastEditorUserId="45" LastEditDate="2014-06-16T19:34:03.597" LastActivityDate="2014-06-16T19:34:03.597" Title="Cannot connect to database with credentials provided in db.php" Tags="&lt;config&gt;&lt;database&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="230" PostTypeId="2" ParentId="69" CreationDate="2014-06-16T15:53:24.113" Score="1" Body="&lt;p&gt;I ended up getting my archive list working using 'after' and 'before' parameters like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if year is not defined %}&#xA;    {% redirect &quot;news/archives/&quot;~now.year %}&#xA;{% endif %}&#xA;&#xA;{% set year  = craft.request.segment(3)  %}&#xA;&#xA;{% set month = craft.request.segment(4) %}&#xA;&#xA;{% set day = craft.request.segment(5) %}&#xA;&#xA;Year: {{ year }}&amp;lt;br&amp;gt;&#xA;Month: {{ month }}&amp;lt;br&amp;gt;&#xA;Day: {{ day }}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% if (year | length) and (month | length) and (day | length) %}&#xA;&#xA;    {% set entryAfterDate = year ~ '-' ~ month ~ '-' ~ day %}&#xA;&#xA;    {% set entryBeforeDate = year ~ '-' ~ month ~ '-' ~ (day + 1) %}&#xA;&#xA;{% elseif (year | length) and (month | length) %}&#xA;&#xA;    {% set entryAfterDate = year ~ '-' ~ month %}&#xA;&#xA;    {% set entryBeforeDate = year ~ '-' ~ (month + 1) %}&#xA;&#xA;{% elseif (year | length) %}&#xA;&#xA;    {% set entryAfterDate = year %}&#xA;&#xA;    {% set entryBeforeDate = (year + 1) %}&#xA;&#xA;{% endif %}&#xA;&#xA;After Entry Date: {{ entryAfterDate}}&amp;lt;br&amp;gt;&#xA;Before Entry Date: {{ entryBeforeDate}}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% set entries = craft.entries.find({section: &quot;news&quot;, order: &quot;postDate&quot;, status: &quot;Live&quot;, after: entryAfterDate, before: entryBeforeDate}) %}&#xA;&#xA;{% if entries | length %}&#xA;&#xA;    Entries found.&#xA;&#xA;{% else %}&#xA;&#xA;    No entries found.&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-06-16T15:53:24.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="231" PostTypeId="2" ParentId="229" CreationDate="2014-06-16T17:19:34.310" Score="10" Body="&lt;p&gt;Move the check the SERVER_NAME &lt;code&gt;switch&lt;/code&gt; up above the &lt;code&gt;require_once $path;&lt;/code&gt;. You need to set &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; earlier.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-16T17:19:34.310" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="232" PostTypeId="2" ParentId="228" CreationDate="2014-06-16T18:34:49.427" Score="20" Body="&lt;p&gt;Currently Twig uses &lt;a href=&quot;https://php.net/manual/en/pcre.pattern.php&quot;&gt;regular expressions&lt;/a&gt; only with &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot;&gt;Comparisons&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if string matches '{^[\d\.]+$}' %}&#xA;    Do Stuff&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft itself currently doesn't have any custom Twig &lt;a href=&quot;https://buildwithcraft.com/docs/templating/filters&quot;&gt;filters&lt;/a&gt; or &lt;a href=&quot;https://buildwithcraft.com/docs/templating/functions&quot;&gt;functions&lt;/a&gt; either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are third-party plugins which might help you: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot;&gt;Twig PCRE Filters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/low/low_regex/&quot;&gt;Low Regex&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-16T18:34:49.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="233" PostTypeId="1" AcceptedAnswerId="234" CreationDate="2014-06-16T21:25:53.340" Score="11" ViewCount="2182" Body="&lt;p&gt;Is there a difference between using single-quoted and double-quoted strings?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-06-17T19:35:56.337" LastActivityDate="2014-06-17T19:35:56.337" Title="What's the difference between using single and double quotes in strings?" Tags="&lt;templating&gt;&lt;string&gt;&lt;difference&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="234" PostTypeId="2" ParentId="233" CreationDate="2014-06-16T21:25:53.340" Score="18" Body="&lt;p&gt;There is a small difference, single-quoted strings don't support interpolation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = 'There is a #{car}.' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above example &lt;strong&gt;won't&lt;/strong&gt; work. If you want to use it, you need to wrap your string in double quotes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = &quot;There is a #{car}.&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="250" LastEditorUserId="144" LastEditDate="2014-06-17T09:50:36.137" LastActivityDate="2014-06-17T09:50:36.137" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="235" PostTypeId="1" AcceptedAnswerId="236" CreationDate="2014-06-17T07:29:10.760" Score="8" ViewCount="1387" Body="&lt;p&gt;I'm writing a plugin that uses the registerSiteRoutes hook to create some new routes, and passes those routes to some controllers. In these routes, I have a few pieces of the URL that I'm capturing as named subpatterns. I'm curious how I handle these named variables in the controller that receives them.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="250" LastEditDate="2014-07-08T22:05:15.090" LastActivityDate="2014-07-08T22:05:15.090" Title="How do I handle named route variables passed to a controller?" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;controller&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="236" PostTypeId="2" ParentId="235" CreationDate="2014-06-17T08:20:08.840" Score="7" Body="&lt;p&gt;To quote @Brandon from &lt;a href=&quot;https://plus.google.com/116110705947365375372/posts/awJsEZKn2kn&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Yep you just need to include a $variables argument in your controller&#xA;  function, typeset to an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionArchive(array $variables = array())&#xA;{&#xA;    $variables['year'] ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-06-17T08:20:08.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="237" PostTypeId="1" AcceptedAnswerId="239" CreationDate="2014-06-17T12:23:28.667" Score="19" ViewCount="2302" Body="&lt;p&gt;I have a Resources page and an archived Resources page made up of entries. I want to show all current resources on the main page (this list should not include the archived ones) and on the archived page I only want to show only archived resources. I am using a lightswitch field to toggle whether a resource is archived or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The archived-only page works as expected, it shows only the archived resources, using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The main page, which should show all resource entries except archived ones actually shows all resources (archived and unarchived). I’m using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('0') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that the &lt;code&gt;.archivedResource(‘0’)&lt;/code&gt; bit is not having any affect. Should I be using some other method to check whether a switch field is toggled or not?&lt;/p&gt;&#xA;" OwnerUserId="324" LastEditorUserId="250" LastEditDate="2014-06-17T12:51:32.417" LastActivityDate="2014-06-17T12:52:43.587" Title="How do I check if a lightswitch field is false?" Tags="&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="238" PostTypeId="1" AcceptedAnswerId="240" CreationDate="2014-06-17T12:34:12.717" Score="12" ViewCount="7607" Body="&lt;p&gt;I'm aware that I can customise which buttons is available in the rich text editor. But how can I add custom css styles, either as classes or as inline styles? Do I need to create a plugin for this? If so, how do I add plugins? And, can I change which options are available in the formatting drop down?&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="125" LastEditDate="2014-06-18T09:58:07.150" LastActivityDate="2017-10-19T01:59:03.777" Title="How do I add custom styles/plugins to the rich text editor in Craft?" Tags="&lt;plugins&gt;&lt;richtext&gt;&lt;editor&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="239" PostTypeId="2" ParentId="237" CreationDate="2014-06-17T12:35:29.680" Score="23" Body="&lt;p&gt;You have to use &lt;code&gt;'not 1'&lt;/code&gt; instead of &lt;code&gt;'0'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries.relatedTo({ targetElement: category }).order('title').archivedResource('not 1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-17T12:52:43.587" LastActivityDate="2014-06-17T12:52:43.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="240" PostTypeId="2" ParentId="238" CreationDate="2014-06-17T12:51:48.410" Score="13" Body="&lt;p&gt;If by styles you mean the formatting drop-down, just add them in an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic'],&#xA;    formatting: ['p', 'blockquote', 'h2', 'h3', 'h4', 'SomeHtmlTag']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have a button which adds custom CSS-classes, take a look at: &lt;a href=&quot;https://github.com/Natetronn/redactor-css&quot; rel=&quot;noreferrer&quot;&gt;Redactor CSS by Nathan Doyle&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Update (July 2015)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.3.2615&lt;/a&gt; (Dec 2, 2014) and above use Redactor 10, which includes the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;noreferrer&quot;&gt;formattingAdd&lt;/a&gt; setting for adding custom styles and classes.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;formattingAdd: [&#xA;{&#xA;    tag: 'p',&#xA;    title: 'Red Block',&#xA;    class: 'red'&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="596" LastEditDate="2015-07-22T23:56:40.420" LastActivityDate="2015-07-22T23:56:40.420" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="241" PostTypeId="1" CreationDate="2014-06-17T14:06:33.007" Score="9" ViewCount="2264" Body="&lt;p&gt;I would like to use a CSS Framework like Zurb Foundation with Craft. I also want to manage my bower dependencies and I want to use Grunt to concat and minify my sass/js as well as compress my images. All this good stuff is happening on my local computer running Mamp Pro. I'll then move it to a Staging server once everything is set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have these folders/files in my directory. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.bowerrc&#xA;bower.json&#xA;-craft&#xA;-dev&#xA; -bower_components&#xA; -scss&#xA;  .htaccess&#xA;  index.php&#xA;  robots.txt&#xA;-node_modules&#xA;-public&#xA;Gruntfile.js&#xA;package.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea of my workflow is to work in the &quot;dev&quot; folder (html, scss, js) and when it's time to push to Staging server I use grunt to copy/minify/compress into the &quot;public&quot; folder. That way I can send only the &quot;craft&quot; and &quot;public&quot; folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm working in the &quot;dev&quot; folder my templates would need to link to the files in the bower_components folders as well as my unminified code. When I publish to the public folder everything gets the minified/concatenated version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question concerns templates.&#xA;I know that templates are in the &quot;craft&quot; folder. How would I get craft to choose between 2 base _layouts (one built for dev, one built for speed) based on which folder my index.php file is located? Is there a better workflow solution?&lt;/p&gt;&#xA;" OwnerUserId="312" LastEditorUserId="312" LastEditDate="2014-06-18T14:48:26.603" LastActivityDate="2014-06-18T14:48:26.603" Title="Craft, CSS Frameworks, Bower &amp; Grunt setup suggestions" Tags="&lt;templating&gt;&lt;config&gt;&lt;deployment&gt;&lt;theme&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="242" PostTypeId="1" AcceptedAnswerId="244" CreationDate="2014-06-17T14:33:04.393" Score="17" ViewCount="1350" Body="&lt;p&gt;It seems that currently if you want to avoid the main &quot;about&quot; page at the top of an &quot;about&quot; structure having a slug of /about/about/ then the approach people seem to take is to create an About page as a single, and a separate structure for subpages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative approach that occurred to me is to give the structure section a URL of just &lt;code&gt;{slug}&lt;/code&gt; and then make everything a child of the &quot;About&quot; entry. &lt;strong&gt;Is there any particular disadvantage to doing this though?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that it potentially allows URLs from different structures to clash (if someone creates a new top-level entry in a structure), but my feeling is that if I have to choose, the possibility for users to mess up the structure seems less bad than the probability that the &quot;separate single + structure&quot; approach will be confusing for users. Is there some other disadvantage that I'm overlooking here, though?﻿&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2014-06-17T15:42:52.733" Title="How to handle top-level/index pages in structure sections?" Tags="&lt;structure&gt;&lt;best-practice&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="243" PostTypeId="2" ParentId="241" CreationDate="2014-06-17T14:40:23.333" Score="5" Body="&lt;p&gt;You can have your templates folder outside the Craft folder. Just define a &lt;code&gt;CRAFT_TEMPLATES_PATH&lt;/code&gt; variable in your &lt;code&gt;index.php&lt;/code&gt; and tell Craft where your folder is located: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Move templates path to right above web root&#xA;define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . &quot;/../templates&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I learned about this in @Jake Chapman's &lt;a href=&quot;https://github.com/imjakechapman/CraftCMS-Boilerplate&quot; rel=&quot;nofollow&quot;&gt;CraftCMS-Boilerplate&lt;/a&gt;, which might also have some other interesting pointers for your setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For different themes of your site I'd use one &lt;code&gt;_layout.html&lt;/code&gt; and then do some conditionals that render your page based on your chosen theme settings. You could make these settings in dedicated lightswitch fields in a global field set for example. Another idea would be to make the theme conditional on the environment the site is requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set a theme variable in &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'craft.dev' =&amp;gt; array(&#xA;    'devTheme' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(...),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then test for it in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.devTheme %}&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/resources/stylesheets/devTheme.css&quot; /&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/resources/stylesheets/builtTheme.css&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-17T16:12:30.960" LastActivityDate="2014-06-17T16:12:30.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="244" PostTypeId="2" ParentId="242" CreationDate="2014-06-17T15:42:52.733" Score="9" Body="&lt;p&gt;I recently setup a structure which contains (almost) every page of my site. When I set it up, I specified only &lt;code&gt;{slug}&lt;/code&gt; as the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, it's working fantastically! And that's with about 30-40 pages created in the structure (some nested within others).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-17T15:42:52.733" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="245" PostTypeId="1" AcceptedAnswerId="246" CreationDate="2014-06-17T15:58:41.647" Score="9" ViewCount="514" Body="&lt;p&gt;I use template inheritance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_layout.html&lt;/code&gt; every other template is loaded with &lt;code&gt;{% block content %}{% endblock %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: &lt;code&gt;_layout.html&lt;/code&gt; never reloads. I changed the CSS path in the head tag of &lt;code&gt;_layout.html&lt;/code&gt; but I never &lt;em&gt;see&lt;/em&gt; the change reflected. Why?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;restarted MAMP (cache is already disabled)&lt;/li&gt;&#xA;&lt;li&gt;restarted computer&lt;/li&gt;&#xA;&lt;li&gt;emptied every cache I know of&lt;/li&gt;&#xA;&lt;li&gt;cache tags aren't used&lt;/li&gt;&#xA;&lt;li&gt;used all different browsers&lt;/li&gt;&#xA;&lt;li&gt;deleted the storage/runtime folder&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The above steps have no effect, and any changes on &lt;code&gt;_layout.html&lt;/code&gt; don't appear to do anything. Why might this be?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="22" LastEditDate="2014-06-17T19:40:58.507" LastActivityDate="2014-06-17T19:40:58.507" Title="Why does my base template never reload?" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="246" PostTypeId="2" ParentId="245" CreationDate="2014-06-17T16:03:11.563" Score="12" Body="&lt;p&gt;Are you using PHP 5.5?  If so, &lt;a href=&quot;http://www.php.net//manual/en/book.opcache.php&quot;&gt;opCache&lt;/a&gt; is enabled by default and that’s probably causing your issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-17T16:03:11.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="247" PostTypeId="2" ParentId="245" CreationDate="2014-06-17T17:20:27.417" Score="8" Body="&lt;p&gt;For those interested:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disabling opCache in Mamp:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to: &lt;code&gt;/Applications/MAMP/bin/php/php5.5.3/conf/php.ini&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OP Cache is at the bottom of the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comment out the following lines with a semicolon &lt;code&gt;;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[OPcache]&#xA;;zend_extension=&quot;/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so&quot;&#xA;;  opcache.memory_consumption=128&#xA;;  opcache.interned_strings_buffer=8&#xA;;  opcache.max_accelerated_files=4000&#xA;;  opcache.revalidate_freq=60&#xA;;  opcache.fast_shutdown=1&#xA;;  opcache.enable_cli=1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-06-17T17:20:27.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="248" PostTypeId="1" CreationDate="2014-06-17T21:26:28.577" Score="11" ViewCount="457" Body="&lt;p&gt;I know that on page load Craft makes multiple queries to get Fields. I have about 300 separate fields on a pretty large site. I know it's probably better to reuse fields when I can, but in many cases I can't rename fields or field instructions so I wouldn't be able to name them semantically for the user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it OK to have this many fields on my site, or should I find another strategy to manage my large number of fields, many of which are very similar?&lt;/p&gt;&#xA;" OwnerUserId="74" LastActivityDate="2014-06-18T06:18:06.557" Title="Will having large numbers of Fields decrease site performance?" Tags="&lt;performance&gt;&lt;field&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="249" PostTypeId="2" ParentId="248" CreationDate="2014-06-17T22:10:35.280" Score="1" Body="&lt;p&gt;I doubt any fields that are not being rendered have any influence on performance. I have have no worries about having a lot of &quot;dormant&quot; fields.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-06-17T22:10:35.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="250" PostTypeId="2" ParentId="248" CreationDate="2014-06-17T22:10:45.583" Score="7" Body="&lt;p&gt;I can't answer your question directly as I never got even close to 300 fields yet. But even with 50 fields I had some serious slowdowns, especially when getting related entries in form of assets and such. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you should definitely consider using the built in cache function to get good performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to that field name / instructions problem you ran into, I can tell you that this is something I hope that gets changed in the future. I already made @Brandon Kelly aware of this problem and he probably has it on &quot;the list&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After thinking a bit more about this, I'd go with @Simon Kuran and believe that the number of fields have rather &lt;s&gt;negligible&lt;/s&gt; moderate impact on your overall performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's more about the numbers of DB queries and not that much about the amount of data they request.&#xA;Be careful with building and inquiring relationships in particular, as they can lead to many (unintentional) DB calls. But first and foremost: use caching. The &lt;code&gt;{% cache %}&lt;/code&gt; tag is there for a reason! ;)&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-18T06:18:06.557" LastActivityDate="2014-06-18T06:18:06.557" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="251" PostTypeId="2" ParentId="212" CreationDate="2014-06-18T02:24:15.943" Score="5" Body="&lt;p&gt;try using this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lukeholder/dir&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lukeholder/dir&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to populate this plugin with the template names:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lewisjenkins/craft-lj-dynamicfields/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-06-18T02:24:15.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="252" PostTypeId="2" ParentId="241" CreationDate="2014-06-18T03:46:24.727" Score="6" Body="&lt;p&gt;In my humble opinion, this is a task for Grunt / Gulp, not for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addy Osmani has an excellent article on &lt;a href=&quot;http://addyosmani.com/blog/environment-specific-builds-with-grunt-gulp-or-broccoli/&quot;&gt;Environment-specific builds&lt;/a&gt; that would be interesting for you and the kind of use case you mention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, &lt;code&gt;gulp-replace&lt;/code&gt; or &lt;code&gt;gulp-processhtml&lt;/code&gt; and &lt;code&gt;gulp-preprocess&lt;/code&gt; will give you what you need to build such functionality in your build scripts. Similar plugins exist for Grunt as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for file organisation, I generally keep my &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;gulpfile.js&lt;/code&gt; files at the root of the repo / website. I find it a lot easier to manage paths.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-06-18T03:46:24.727" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="253" PostTypeId="1" AcceptedAnswerId="255" CreationDate="2014-06-18T05:26:41.033" Score="13" ViewCount="1901" Body="&lt;p&gt;What's the best way to prevent exceptions in my plugin from blowing up my entire page? try/catch and return null, and then check for null in the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: my plugin fetches data from a remote REST API. If that request fails for any reason I get an error page. I understand why, but I'm looking for the best way to handle it. I'd appreciate any input, even if it seems glaringly obvious to you.&lt;/p&gt;&#xA;" OwnerUserId="341" LastEditorUserId="115" LastEditDate="2014-06-18T13:51:36.640" LastActivityDate="2014-06-18T13:51:36.640" Title="What is the best way to handle errors in plugins and templates?" Tags="&lt;templating&gt;&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="254" PostTypeId="2" ParentId="253" CreationDate="2014-06-18T06:21:14.090" Score="8" Body="&lt;p&gt;This is what I generally do if I want to catch exceptions but still output an error to the browser. This example uses Craft's included Guzzle class to make the http request.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;try &#xA;{&#xA;    // create client&#xA;    $client = new \Guzzle\Http\Client('https://twitter.com');&#xA;&#xA;    // get response&#xA;    $response = $client-&amp;gt;get()-&amp;gt;send();&#xA;}&#xA;catch (\Guzzle\Http\Exception\CurlException $e) &#xA;{&#xA;    // throw a craft exception which displays the error cleanly&#xA;    throw new HttpException(400, 'Internet connection not available');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can of course do anything you want inside the catch block, such as rendering a template and providing it with information about the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = craft()-&amp;gt;templates-&amp;gt;render('error', array(&#xA;    'message' =&amp;gt; 'Internet connection not available'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-18T07:49:10.577" LastActivityDate="2014-06-18T07:49:10.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="255" PostTypeId="2" ParentId="253" CreationDate="2014-06-18T06:23:30.433" Score="12" Body="&lt;p&gt;Yep, Craft makes pretty liberal use of try/catch blocks. Wrap your HTTP request in that, and return whatever makes sense in the context – &lt;code&gt;null&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt;, or maybe an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably also worth logging the error, so the developer can investigate why it’s not working, using &lt;code&gt;Craft::log()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember when catching exceptions, that there’s a good chance the exception class won’t be in Craft’s namespace. So you’ll probably need to prepend the exception class(es) with &lt;code&gt;\&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to put it all together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;try&#xA;{&#xA;    // Make the HTTP request&#xA;    // ...&#xA;}&#xA;catch (\Exception $e)&#xA;{&#xA;    Craft::log('The request to domain.com failed: '.$e-&amp;gt;getMessage(),&#xA;               LogLevel::Warning, false, 'mypluginhandle');&#xA;&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-18T06:23:30.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="256" PostTypeId="1" AcceptedAnswerId="736" CreationDate="2014-06-18T06:40:09.180" Score="5" ViewCount="202" Body="&lt;p&gt;There seems to be a bug when I combine non-ascii characters, quotes and the OR operator when searching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these queries work ok: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;pølser&quot;&lt;/li&gt;&#xA;&lt;li&gt;&quot;pålegg&quot;&lt;/li&gt;&#xA;&lt;li&gt;pølser OR pålegg&lt;/li&gt;&#xA;&lt;li&gt;&quot;egg&quot; OR &quot;spekemat&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;pølser&quot; OR &quot;pålegg&quot; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;always returns no result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search form uses roughly this code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchTerm = craft.request.getParam('search') %}&#xA;&#xA;{% set entries = craft.entries %}&#xA;&#xA;... entries is optionally limited to a single section here, but it makes no difference here ... &#xA;&#xA;{% set entries = entries.search(searchTerm) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(cross-posted from google+ group as I only just found out about the stack-exchange)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(edit to add code sample)&lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="342" LastEditDate="2014-06-19T06:49:00.300" LastActivityDate="2014-07-03T21:39:28.817" Title="Bug with non-ascii characters, quotes and OR operator in search?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="257" PostTypeId="2" ParentId="238" CreationDate="2014-06-18T06:59:01.417" Score="8" Body="&lt;p&gt;Victor answers my questions regarding the formatting tags and the fact that you need to create a Craft plugin to add Redactor plugins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there wasn't a solution for adding classes on inline elements with custom classes/styles, Nathan's plugin only supports block elements, I created a plugin that wraps the Styles Redactor plugin. You can get it here: &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft&quot;&gt;https://github.com/aelvan/RedactorStyles-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-06-18T06:59:01.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="258" PostTypeId="2" ParentId="2" CreationDate="2014-06-18T07:11:52.533" Score="15" Body="&lt;p&gt;Ok, Carlo, I'll get in this improved answer tonight, anyway, probably cut down and informate the other answer in morning here, so comments stay. I've got a sick animal here house-sitting for brother &amp;amp; family, why I'm a little slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To accelerate what you have, it really depends on the content - whether you have logins or other personalization among your high ten-thousands of daily hits. If you don't, it may be possible to get some quick improvement, and then move up through the other things. Throughout this I'm going to be thinking of a big sports site I've seen you have, thinking it may have timely content updates while not personalization; but I don't remember it with assurance on that detail.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Digging into CloudFlare, since you do have it there on EC2, I find I was mistaken about what it does before you may configure it. This also explains some things I thought I saw in earlier brief shakedown tests myself. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With automatic, stock configuration, CloudFlare only edge caches media referred to, like jpgs, js, css etc. -- not html of any kind, to keep things safe for first users. There are three further levels of caching possible, which includes the ability to do whole pages. You use PageRules to enable this, and can for a whole site depending on the match filter. If you don't have personalization, I think you could get a huge benefit right away by setting this up, rather than using Railgun. Or for some pages, anyway? So this is what I'd look into first, if the content fits. &lt;a href=&quot;https://support.cloudflare.com/hc/en-us/articles/200168306-Is-there-a-tutorial-for-Page-Rules-&quot; rel=&quot;nofollow noreferrer&quot;&gt;CloudFlare doc link here&lt;/a&gt;. You can set time to live, so as to have essential static pages which still update regularly if you have timely but not personalized content.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have personalization of pages, then you do indeed need server-side caching to rein in such large page demands, I would agree. Railgun working as intended is only going to help with cutting out handshake latency, compressing, and so forth. This is great, but it still requires that you run the (Craft) CMS each time someone requests a page, in order to see if there is a delta Railgun would send.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The next stage then I would think would be to enable Craft's own caching, to cut  Craft's overhead way down, as this is very effective, targetable to what should and shouldn't be cached in your site, and can use &lt;a href=&quot;http://aws.amazon.com/elasticache/&quot; rel=&quot;nofollow noreferrer&quot;&gt;EC2's ElastiCache, w/doc link here&lt;/a&gt;, to get you memory-resident caching's speed. Craft's /app/etc/config/defaults has scripts for both Redis and Memcache(d) setup, which I think you just copy into your /craft/config folder once the facility is up on your EC2 machine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With fortune, this could be an easy solution to deal with, again if you need to have personalized or otherwise dynamic content, and you can try it out for gain before any ElastiCache by just turning it on in the file or db modes, for which there are also default scripts in the same location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd read very carefully the information that's in &lt;a href=&quot;https://craftcms.stackexchange.com/a/107/177&quot;&gt;Victor In's link reference&lt;/a&gt;, as it gives quite a bit of information straight from Brandon (and with others' interpreting) compared to present doc. I agree with what he says about effectiveness of  using db caching from experience before, as databases tend to have very efficient caching for their own operation, including sorting out high numbers of requests. What he says about the db as basis for the great effectiveness of Craft's detailed cache breaking with content updates is also very astute, and one of those things which makes Craft very intelligent with how it handles your content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about Varnish, then? Well, it does look very powerful and proven; also requiring the most detail of any speedup to configure. Setting it up in the first place is simple; you just set your webserver to run on a non-visible port, and tell Varnish where to find it while arranging Varnish to handle your visible standard http and possibly https ports. That installs the engine, as in their &lt;a href=&quot;https://www.varnish-software.com/static/book/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pretty good-looking Varnish doc with a kind of guide on this link&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't remember if EC2 comes with a C compiler installed, but easy to do, and this will be necessary to compile the VCL scripts you configure Varnish with to know your page requirements. VCL itself? Again, there's good doc, but you are really going to want to know exactly what your pages need, if they need personalized results. This is really about the site design, not anything about Craft itself, and here we are considering the original question directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, I think that depending on your content, you have three levels you can go through here to reduce load and increase apparent speed for your site.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you are so fortunate as to have non-login and otherwise non-personalized content, you can probably do the large arrangement by configuring CloudFlare to actually edge-cache the html pages as well as media content. This will give you essentially static site page speed, also hosted out near many visitors (if you're lucky on CloudFlare sites), plus having off-loaded your page request handling out to those edge sites. Using embedded monitoring may keep you lucky on getting enough access data to satisfy the client.&lt;/li&gt;&#xA;&lt;li&gt;If your client needs logins or personalization of other kinds, then one of the levels of Craft caching (and selection of what to cache) is going to help a lot. This would really take advantage of Railgun, while feeding it the information it needs very efficiently for your EC2 instance(s). This might be enough, and might see Railgun operating as you'd expect it to reliability-wise. Again, you could start with a file- or db- level Craft cache configuration, and then after working up redis or memcached on a staging server probably, fitting that in for even higher efficiency and speed.&lt;/li&gt;&#xA;&lt;li&gt;Varnish itself, then. I seem to feel this would be the most effort to configure, but if needed, give the highest effectiveness, if you need to go that far. The configuration itself is about your static vs. dynamic page content design, not Craft itself, so you can use such sources as stackoverflow's varnish tag to get hints or questions answered on it. &lt;a href=&quot;https://stackoverflow.com/questions/4490140/memcached-vs-varnish-for-speeding-up-3-tier-web-architecture&quot;&gt;Here's a link to an interesting start for that&lt;/a&gt;, mentioning relationships between varnish and memcached in the frame as I've put some thoughts here. ElastiCache-driven native Craft caching will give you the highest performance for necessary dynamic content here, and it looks like Railgun will improve on Varnish alone, by getting that fast-resolved dynamic content out to the edges in much less time than a standard internet request would do so.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Carlo, hope it's been helpful to have another head looking at this, and that possibly these stages in some form may give you ideas to do a useful rapid response, then refine. Craft community advancing on many fronts at the moment, anyway ;)&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-06-21T23:52:02.803" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="259" PostTypeId="2" ParentId="218" CreationDate="2014-06-18T08:28:00.463" Score="1" Body="&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;false == 0&lt;/code&gt; will be &lt;code&gt;true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;false === 0&lt;/code&gt; will be &lt;code&gt;false&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very useful when you use such functions as &lt;code&gt;file_put_contents()&lt;/code&gt; and &lt;code&gt;preg_match()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first function returns a number of bytes writtent to the file (which can be 0 if nothing was written what does not mean that it's false). And the second one returns 1 if something was found otherwise 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They always warn people when you must check for the variable type too. &lt;a href=&quot;http://fr2.php.net/manual/en/function.preg-match.php&quot; rel=&quot;nofollow&quot;&gt;Php.net&lt;/a&gt;: Go at &quot;Return values&quot; and you will see a red Warning block.&lt;/p&gt;&#xA;" OwnerUserId="343" LastActivityDate="2014-06-18T08:28:00.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="260" PostTypeId="1" AcceptedAnswerId="447" CreationDate="2014-06-18T08:49:43.127" Score="3" ViewCount="1595" Body="&lt;p&gt;I've got a date field, and I'm grabbing the month and year from the url. What I'm after is to display all the events within the month, but for some reason I can't get this to work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = month ~ &quot;/1/&quot; ~ year|date(&quot;U&quot;) %} // returns the 1st day of the month in unixtime&#xA;&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth = month ~ &quot;/&quot; ~ daysInThisMonth ~ &quot;/&quot; ~ year|date(&quot;U&quot;) %} // returns the last day of the month in unixtime&#xA;&#xA;{% set thisMonthsEvents = craft.entries.section('events').eventDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{% if thisMonthsEvents | length %}&#xA;    some events&#xA;{% else %}&#xA;    no events&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? firstDayOfMonth and lastDayOfMonth return dates fine, but no matter how I format them, the result is no entries returned. For example, firstDayOfTheMonth could output &quot;2014-6-01&quot; and lastDayOfMonth could output &quot;2014-6-30&quot;, and I've got an event with an eventDate of 18th June 2014, but nothing is being returned.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-06-18T11:11:46.270" LastActivityDate="2014-06-24T20:54:30.247" Title="How to display entries with a custom date field within month" Tags="&lt;datetime&gt;&lt;date&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="261" PostTypeId="2" ParentId="260" CreationDate="2014-06-18T09:15:01.840" Score="2" Body="&lt;p&gt;I think you can't use the unix time format. Try &lt;code&gt;|date('Y-m-d')&lt;/code&gt; instead of &lt;code&gt;|date(&quot;U&quot;)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You actually don't need to use the &lt;code&gt;|date&lt;/code&gt; filter for that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set year = 2014 %}&#xA;{% set month = 06 %}&#xA;&#xA;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;&#xA;{% set lastDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %} &#xA;&#xA;{{ firstDayOfMonth ~ &quot; - &quot; ~ lastDayOfMonth }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-18T09:33:46.060" LastActivityDate="2014-06-18T09:33:46.060" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="262" PostTypeId="1" CreationDate="2014-06-18T11:07:40.817" Score="2" ViewCount="991" Body="&lt;p&gt;I am using Craft on Ubuntu 12.04 servers without problems, but when trying to run it on Ubuntu 14.04 (trusty) I always get the message&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mcrypt is required.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I installed it, however, via...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;apt-get install apache2 php5 mysql-server php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and restarted the web server afterwards. Any hints? Maybe this is a bug with the way craft checks for mcrypt?&lt;/p&gt;&#xA;" OwnerUserId="348" LastEditorUserId="22" LastEditDate="2014-06-18T20:01:27.390" LastActivityDate="2014-06-18T20:01:27.390" Title="Mcrypt is required on Ubuntu 14.04" Tags="&lt;config&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="263" PostTypeId="2" ParentId="262" CreationDate="2014-06-18T11:14:59.037" Score="8" Body="&lt;p&gt;I had to run &lt;code&gt;sudo php5enmod mcrypt&lt;/code&gt; to enable the module. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this has changed between 12.04 and 14.04—in 12.04 it was enabled automatically.&lt;/p&gt;&#xA;" OwnerUserId="348" LastEditorUserId="22" LastEditDate="2014-06-18T15:03:01.017" LastActivityDate="2014-06-18T15:03:01.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="264" PostTypeId="2" ParentId="260" CreationDate="2014-06-18T11:21:55.880" Score="2" Body="&lt;p&gt;Okay, here's the answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisMonthsEvents = craft.entries.section('events').eventDate('and', '&amp;gt;= ' ~ firstDayOfMonth | date(&quot;U&quot;), '&amp;lt;=' ~ lastDayOfMonth | date(&quot;U&quot;)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe this has something to do with me not formatting firstDayOfMonth and lastDayOfMonth as dates within the original query? Also, why doesn't this need a .find() after it?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-06-18T11:29:52.383" LastActivityDate="2014-06-18T11:29:52.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="265" PostTypeId="1" AcceptedAnswerId="271" CreationDate="2014-06-18T12:06:58.450" Score="12" ViewCount="1082" Body="&lt;p&gt;I am a little confused about the differences between an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;elementCriteriaModel&lt;/a&gt; and fetched elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I sometimes have to fetch elements with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot;&gt;&lt;code&gt;first()&lt;/code&gt;, &lt;code&gt;last()&lt;/code&gt;, &lt;code&gt;find()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('cocktails').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in other cases the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;elementCriteriaModel&lt;/a&gt; is enough:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('cocktails') %}&#xA;{% set prev   = entry.getPrev(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-18T16:15:34.620" Title="What are the differences between an elementCriteriaModel and fetched elements?" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="266" PostTypeId="2" ParentId="265" CreationDate="2014-06-18T12:14:49.517" Score="2" Body="&lt;p&gt;From the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Treating your ElementCriteriaModel object as an array will get it to act like one, too. (No find() necessary!)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See the fourth point &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-06-18T12:14:49.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="267" PostTypeId="1" AcceptedAnswerId="270" CreationDate="2014-06-18T12:15:29.710" Score="18" ViewCount="5536" Body="&lt;p&gt;Say for example, I wanted to add a &quot;Expand/Collapse All&quot; button to Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do this, or is this something more appropriate for a feature request for P&amp;amp;T?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2019-08-05T16:41:48.713" Title="Can a plugin add JS or CSS to the control panel?" Tags="&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="268" PostTypeId="1" AcceptedAnswerId="269" CreationDate="2014-06-18T12:20:24.880" Score="2" ViewCount="1167" Body="&lt;p&gt;Is there a way to loop through a day in 15-minute intervals, with the output of said intervals being localizable? This (cringe-worthy) snippet should help explain what I'm trying to accomplish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for hour in 0..23 %}&#xA;        {% for min in [0, 15, 30, 45] %}&#xA;&#xA;            {% set foo = [hour, min]|join(':')|date('H:i')|date_modify('+0 days') %}&#xA;            &amp;lt;li&amp;gt;{{ foo.localeTime() }}&amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For me, that snippet results in the unusual error &lt;code&gt;Method &quot;localeTime&quot; for object &quot;DateTime&quot; does not exist&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This question was asked on g+ by Chris Davis. I copied it to SE, as I didn't want to answer it there!)&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-18T13:51:32.733" Title="Output DateTime in that timezone related to the current locale?" Tags="&lt;datetime&gt;&lt;filter&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="269" PostTypeId="2" ParentId="268" CreationDate="2014-06-18T12:20:24.880" Score="3" Body="&lt;p&gt;You can set the site's timezone in Craft, but you won't get different timezones for your locales with that (locales != timezones btw.). But what you can do is to use Twig's &lt;code&gt;|date&lt;/code&gt; filter which allows you to specify a different timezone for the output (&lt;a href=&quot;https://php.net/manual/en/timezones.php&quot; rel=&quot;nofollow&quot;&gt;list of supported timezones&lt;/a&gt;). If you create your own &lt;code&gt;DateTime&lt;/code&gt; object by joining strings, you have to add a timezone here to give the filter a basis for its calculations. Make this match your Craft settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following example works without the Localization package. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set locale time to GMT+2 #}&#xA;{% set localeTime = &quot;0:00 +0200&quot; %}&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;th&amp;gt;Local Time&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Sao Paulo&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Manaus&amp;lt;/th&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;&#xA;    {% for hour in 0..23 %}&#xA;        {% for min in [0, 15, 30, 45] %}&#xA;&#xA;            &amp;lt;tr&amp;gt;&#xA;                {# Join time segments in a format supported by strtotime #}&#xA;                {% set timeStep = ['+ ', hour, ' hours ', min, ' minutes']|join() %}&#xA;&#xA;                {# Modify the locale time and output in chosen timezone #}&#xA;                &amp;lt;td&amp;gt;{{ localeTime|date_modify(timeStep)|date('H:i') }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ localeTime|date_modify(timeStep)|date('H:i', &quot;America/Sao_Paulo&quot;) }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ localeTime|date_modify(timeStep)|date('H:i', &quot;America/Manaus&quot;) }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To bring the site's currently requested locale into the game, just do some comparisons on &lt;code&gt;craft.locale&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.locale == 'de-DE' ? localeTime|date('H:i') }}&#xA;{{ craft.locale == 'pt-BR' ? localeTime|date('H:i', &quot;America/Sao_Paulo&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="167" LastEditDate="2014-06-18T13:51:32.733" LastActivityDate="2014-06-18T13:51:32.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="270" PostTypeId="2" ParentId="267" CreationDate="2014-06-18T12:23:23.477" Score="23" Body="&lt;p&gt;One way to accomplish this is to write some code in the &lt;code&gt;init()&lt;/code&gt; function of your root plugin file. So in your example that might look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyFunkyPlugin extends BasePlugin&#xA;{&#xA;&#xA;  function init() {&#xA;&#xA;    // check we have a cp request as we don't want to this js to run anywhere but the cp&#xA;    // and while we're at it check for a logged in user as well&#xA;    if ( craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; craft()-&amp;gt;userSession-&amp;gt;isLoggedIn() )&#xA;    {&#xA;&#xA;      // the includeJs method lets us add js to the bottom of the page&#xA;      craft()-&amp;gt;templates-&amp;gt;includeJs('var Myjs = &quot;foo&quot;;');&#xA;&#xA;      // the includeCss method will add css in the head&#xA;      craft()-&amp;gt;templates-&amp;gt;includeCss('.myFunkyPluginSelector { color: red; }');&#xA;&#xA;      // the includeJsResource method will add a js file to the bottom of the page&#xA;      craft()-&amp;gt;templates-&amp;gt;includeJsResource('myPlugin/js/app.js');&#xA;&#xA;      // the includeCssResource method will add a link in the head&#xA;      craft()-&amp;gt;templates-&amp;gt;includeCssResource('myFunkyPlugin/css/style.css');&#xA;&#xA;    }&#xA;&#xA;  }&#xA;&#xA;  // rest of the root plugin file&#xA;  ...&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The nice thing about the &lt;code&gt;init()&lt;/code&gt; function is it gets run before anything else in your plugin does and it gets run on every request as every installed plugin is initialised on every request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More detail on the available functions can be found in the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService&quot;&gt;TemplatesService docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2015-04-15T09:31:11.500" LastActivityDate="2015-04-15T09:31:11.500" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="271" PostTypeId="2" ParentId="265" CreationDate="2014-06-18T13:30:24.763" Score="19" Body="&lt;p&gt;The &lt;code&gt;ElementCriteriaModel&lt;/code&gt; and the individual element models (like the &lt;code&gt;EntryModel&lt;/code&gt;) can be thought of as two different points of time in retrieving data from your database. Essentially, you'll use an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; before the database is queried and the element models afterwards.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why do I sometimes have to fetch elements with &lt;code&gt;.first()&lt;/code&gt;, &lt;code&gt;.last()&lt;/code&gt;, &lt;code&gt;.find()&lt;/code&gt;…&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;ElementCriteriaModel&lt;/code&gt; does what it says on the tin — it specifies criteria to find elements. When you call &lt;code&gt;.find()&lt;/code&gt;, &lt;code&gt;.first()&lt;/code&gt; or &lt;code&gt;.last()&lt;/code&gt;, the model sends itself off to the &lt;code&gt;ElementsService&lt;/code&gt; which will return element models, based on your criteria.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;…and in other cases the ElementCriteriaModel is enough?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Internally, Craft is using &lt;code&gt;ElementCriteriaModels&lt;/code&gt; to work things out. For pagination or the &lt;code&gt;.getPrev()&lt;/code&gt; example, Craft is finding elements using the same criteria, but it's using it in a different way to &lt;code&gt;.find()&lt;/code&gt; or similar methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; omit the &lt;code&gt;.find()&lt;/code&gt; method and treat the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; as an array, but it depends on your scenario. As was touched on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/59/what-are-the-most-common-template-performance-gotchas-to-avoid/&quot;&gt;here&lt;/a&gt;, there are performance impacts to consider.&lt;/p&gt;&#xA;" OwnerUserId="148" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-06-18T16:15:34.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="274" PostTypeId="5" CreationDate="2014-06-18T15:11:46.903" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-06-18T15:11:46.903" LastActivityDate="2014-06-18T15:11:46.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="275" PostTypeId="4" CreationDate="2014-06-18T15:11:46.903" Score="0" Body="Questions having to do with Craft's ElementCriteriaModel, which is used to return a set of elements narrowed by a variety of parameters." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-19T14:50:15.530" LastActivityDate="2014-06-19T14:50:15.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="276" PostTypeId="2" ParentId="267" CreationDate="2014-06-18T17:08:22.713" Score="12" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a-plugin-add-js-or-css-to-the-control-panel/270#270&quot;&gt;Josh's answer&lt;/a&gt; is great if you are interested in building your own plugin. But if that's a little much for you, you're still in luck...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use these plugins to quickly &amp;amp; easily add CSS and JavaScript to your control panel:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/doublesecretagency/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS plugin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/doublesecretagency/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel JS plugin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I wrote both of those plugins, let me know if you run into any issues!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2019-08-05T16:41:48.713" LastActivityDate="2019-08-05T16:41:48.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="277" PostTypeId="1" AcceptedAnswerId="288" CreationDate="2014-06-18T17:56:04.097" Score="7" ViewCount="691" Body="&lt;p&gt;I'm trying to set a cache duration as an environment variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set up various environment variables and know they are being referenced correctly in my templates because I can print out the values of the variables in my templates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'cacheDuration'          =&amp;gt; '1 week',&#xA;            'cacheDurationQuantity'  =&amp;gt; 1,&#xA;            'cacheDurationUnit'      =&amp;gt; 'week',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I initially started with this cache tag...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache for craft.config.environmentVariables.cacheDuration unless craft.config.devMode %}...{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but I got this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;name&quot; of value &quot;craft&quot; (&quot;number&quot; expected)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This had me thinking that perhaps Craft or Twig is expecting an integer immediately after the &quot;for&quot; keyword. Thus, I broke my cacheDuration variable into two parts: quantity which is an integer and unit which is a string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache for craft.config.environmentVariables.cacheDurationQuantity craft.config.environmentVariables.cacheDurationUnit unless craft.config.devMode %}...{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I still got same error as above. This inspired me to try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set duration = 1 %}&#xA;{% cache for duration craft.config.environmentVariables.cacheDurationUnit unless craft.config.devMode %}...{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This time, I got a slightly different error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;name&quot; of value &quot;duration&quot; (&quot;number&quot; expected)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This has me thinking that any variable evaluated as expected in the duration parameter of the cache tag. However, other variables (like craft.config.devMode) are interpreted fine for other parameters of the cache tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone else confirm this or share insight into this?&lt;/p&gt;&#xA;" OwnerUserId="279" LastActivityDate="2016-02-06T00:02:43.153" Title="Is it possible to use environment variables as the cache duration?" Tags="&lt;cache&gt;&lt;variable&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="278" PostTypeId="1" CreationDate="2014-06-18T17:57:33.470" Score="2" ViewCount="172" Body="&lt;p&gt;I have a sports site I'm building where each team is set up as a user within a 'team' member group.  I have a channel called 'Schedule' that has only 2 fields; a user field to relate the schedule to a team and then a table for the list of games.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end if I have a profile page for each team (ie: &lt;code&gt;http://www.example.com/{username}&lt;/code&gt;).  I'm having trouble outputting the correct schedule based on the username in the URL?&lt;/p&gt;&#xA;" OwnerUserId="226" LastEditorUserId="250" LastEditDate="2014-06-19T14:48:01.680" LastActivityDate="2014-06-19T14:48:01.680" Title="Using relatedTo with 'Users' field" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="279" PostTypeId="2" ParentId="278" CreationDate="2014-06-18T18:17:32.030" Score="1" Body="&lt;p&gt;Without knowing how your templates look, I can only give you a basic example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set team    = craft.users.username(craft.request.lastSegment) %}&#xA;{% set entries = craft.entries.section('schedules').relatedTo(team) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should give you all entries in the &lt;code&gt;schedules&lt;/code&gt; channel which have a relation to the &lt;code&gt;team&lt;/code&gt; username.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-18T18:17:32.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="280" PostTypeId="2" ParentId="277" CreationDate="2014-06-18T19:08:23.940" Score="4" Body="&lt;p&gt;Wes, there is a built in config setting for &lt;code&gt;cacheDuration&lt;/code&gt;. See docs for &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheDuration&quot; rel=&quot;nofollow&quot;&gt;General config settings&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;cacheDuration&quot;: Also used by the &lt;code&gt;{% cache %}&lt;/code&gt; template tag if no expiration time is specified as a parameter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Example config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cacheDuration' =&amp;gt; '4 years',&#xA;        'environmentVariables' =&amp;gt; array(),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-30T18:20:25.203" LastActivityDate="2015-10-30T18:20:25.203" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="281" PostTypeId="1" AcceptedAnswerId="282" CreationDate="2014-06-18T19:09:24.537" Score="12" ViewCount="3536" Body="&lt;p&gt;Trying to determine if there is a method for getting an entry's last modified date, preferably date-time. Gave a good look over the docs and some searching and couldn't find anything other than the original creation date. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="269" LastEditorUserId="269" LastEditDate="2019-03-29T20:24:38.047" LastActivityDate="2019-04-04T09:15:33.883" Title="Get an entry's last modified date" Tags="&lt;entries&gt;&lt;datetime&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="282" PostTypeId="2" ParentId="281" CreationDate="2014-06-18T19:12:46.220" Score="18" Body="&lt;p&gt;You're looking for the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#dateUpdated&quot;&gt;dateUpdated&lt;/a&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.dateUpdated }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-18T19:12:46.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="283" PostTypeId="2" ParentId="281" CreationDate="2014-06-18T19:12:55.317" Score="6" Body="&lt;p&gt;Take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;EntryModel&lt;/a&gt;. The model has a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#dateUpdated&quot;&gt;dateUpdated&lt;/a&gt; property which will exactly output what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.dateUpdated }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-18T19:12:55.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="284" PostTypeId="1" CreationDate="2014-06-18T19:22:55.257" Score="5" ViewCount="1241" Body="&lt;p&gt;I've got a few simple front-end forms that users can use to update their profiles. I'm using the combo of the jQuery Validate and Form plugins to handle validation and submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can successfully update profiles when the fields are technically correct, but can't figure out how to get feedback from the server if an error occurs after submission (aka invalid password, username already in use, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of my password update form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;form action=&quot;&quot; class=&quot;secondary-content&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; id=&quot;pwForm&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;Update password&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/profile&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;password&quot; value=&quot;{{ currentUser.password }}&quot;&amp;gt;&#xA;      &amp;lt;div id=&quot;passwordFields&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;npw&quot;&amp;gt;New password &amp;lt;a href=&quot;#npw&quot; class=&quot;js-show-pw micro pull-right&quot;&amp;gt;Show password&amp;lt;/a&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;password&quot; id=&quot;npw&quot; name=&quot;newPassword&quot; class=&quot;text-input&quot; value=&quot;&quot; required /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;          &amp;lt;button class=&quot;button--red&quot; type=&quot;submit&quot;&amp;gt;Update&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the javascript (in CoffeeScript syntax):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#pwForm').validate&#xA;  submitHandler: (form) -&amp;gt;&#xA;    $(form).ajaxSubmit&#xA;      type: 'POST'&#xA;      dataType: 'json'&#xA;      beforeSubmit: -&amp;gt;&#xA;        $(pwFields).transition opacity: 0&#xA;        $('#pwLoader').spin(opts).transition opacity: 1&#xA;      error: (xhr, status, error) -&amp;gt;&#xA;        $('#pwLoader').stop().transition opacity: 0&#xA;        $(pwFields).transition opacity: 1&#xA;        $(pwFields).append('&amp;lt;label class=&quot;error&quot;&amp;gt;There was an error. Please try again.&amp;lt;/label&amp;gt;')&#xA;      success: -&amp;gt;&#xA;        $('#pwLoader').stop().transition opacity: 0&#xA;        $(pwFields).text ''&#xA;        $(pwFields).html('&amp;lt;h3&amp;gt;Password updated&amp;lt;/h3&amp;gt;').transition&#xA;          opacity: 1&#xA;          delay: 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, I'm actually tripping the &quot;There was an error…&quot; error no matter what I put in the field. If I pull out the javascript, the page refreshes and I don't get errors, but the password doesn't update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it has to do with posting to the correct URL. Any ideas? Is it even worth using both/either of these plugins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="352" LastEditorUserId="352" LastEditDate="2014-06-19T17:41:01.403" LastActivityDate="2018-07-11T07:31:57.507" Title="Getting server-side feedback when submitting forms with jQuery Form plugin" Tags="&lt;form&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="285" PostTypeId="2" ParentId="284" CreationDate="2014-06-18T19:46:25.390" Score="2" Body="&lt;p&gt;I myself am building a data locker using JavaScript to talk to Craft. How I have it set up is that the AJAX request is pointing to a template (which a request can be routed to without defining it in the Control Panel) that will load if there are errors. I can then redirect to a success template if I find no errors. Alternatively, you can set the location to redirect to like you did in your example. I'm returning JSON on both templates so that I can run client-side checks to see what I'm getting back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I have errors, I check for those on my request url template and output the JSON if necessary. If I don't, I load my redirect template which either returns a success message or the data I'm looking to retrieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell Craft that it's returning a JSON file by giving it a &quot;.json&quot; extension. Alternatively you can also set it manually with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Either way, this should get you what you're looking to achieve.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-18T19:46:25.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="286" PostTypeId="1" CreationDate="2014-06-18T21:42:16.917" Score="5" ViewCount="299" Body="&lt;p&gt;I have 2 primary entry types, one for a full width page, and one for a sidebar page. The sidebar page shares about 90% of the same block types as the full width page.  The other 10% do not apply to the sidebar page at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of going to the trouble of duplicating (and maintaining) an additional Matrix set for the sidebar page, sans the non-applicable block types, I have decided to use the same Matrix for both pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a way to disable / hide the unused block types on the sidebar page entry type. Just as with the normal fields which can be assigned or not to the entry types, shouldn't the matrix block types also work in the same manner?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-06-18T22:07:56.803" Title="Is there a way to hide Matrix blocks based on the Selected Entry Type?" Tags="&lt;matrix&gt;&lt;field&gt;&lt;block-types&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="287" PostTypeId="2" ParentId="286" CreationDate="2014-06-18T22:07:56.803" Score="2" Body="&lt;p&gt;No. Matrix blocks do not work in that manner. However you define it in the field is how it'll show when you edit it. If it's really important not to show that block type you can write a plugin that checks for an entry type, and hide certain block types based on that result. Granted that's a lot of work for very little gain. You would be better off ignoring the unwanted block types or building a new matrix field.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-18T22:07:56.803" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="288" PostTypeId="2" ParentId="277" CreationDate="2014-06-19T00:22:57.503" Score="6" Body="&lt;p&gt;The error you're encountering is part of how Pixel &amp;amp; Tonic wrote the cache tag. In short, variables will not work for what you're trying to accomplish. For the longer explanation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tags in Twig are made up of tokens. So strings, numbers, variables, functions, tags, and filters are all tokens. When Twig is parsing a tag, it reads all the tokens and checks it against rules in a Twig extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cache tag after seeing a 'for' token will only accept a number as the next token. Not a variable, or a string, or anything else. The bit typed into the template must be a number. For the duration unit, it checks what's there against a list they have already defined. Again, a variable won't work here. Likewise, the 'until' token looks for a date that can be parsed by PHP's strtotime, and 'unless' looks for something that gives it true or false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can accomplish the very same thing using built-in config settings. The &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheDuration&quot;&gt;cacheDuration&lt;/a&gt; setting will do as it says using the &lt;a href=&quot;http://www.php.net/manual/en/dateinterval.construct.php&quot;&gt;PHP Interval Specification&lt;/a&gt;. If you have a specific cache storage you'd like to use you can use &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot;&gt;cacheMethod&lt;/a&gt;. Setting these will let you use the cache tag without any extra configuration on the tag itself.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-19T00:22:57.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="289" PostTypeId="1" AcceptedAnswerId="296" CreationDate="2014-06-19T00:34:51.493" Score="16" ViewCount="46101" Body="&lt;p&gt;I'm looping through some images and want to target just the first image. How do I do that?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.images %}&#xA;&amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastEditorUserId="115" LastEditDate="2014-06-19T09:45:38.327" LastActivityDate="2014-06-26T19:51:04.403" Title="How do I target the first item in a Twig for loop?" Tags="&lt;entries&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="290" PostTypeId="2" ParentId="289" CreationDate="2014-06-19T00:46:13.627" Score="8" Body="&lt;pre&gt;&lt;code&gt;{% for image in entry.images %}&#xA;    {% if loop.first %}&#xA;         &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% elseif loop.last %}&#xA;          &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% else %}&#xA;          &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It can be done with loop.first &amp;amp; loop.last&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="103" LastEditDate="2014-06-26T19:51:04.403" LastActivityDate="2014-06-26T19:51:04.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="292" PostTypeId="2" ParentId="289" CreationDate="2014-06-19T00:47:39.277" Score="27" Body="&lt;p&gt;Twig has &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;loop-variables&lt;/a&gt; which can be accessed inside for-loops. &lt;code&gt;loop.first&lt;/code&gt; will return true on the first iteration.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.images %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;&#xA;    {% if loop.first %}&#xA;        Do stuff..&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="177" LastEditDate="2014-06-19T09:52:42.777" LastActivityDate="2014-06-19T09:52:42.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="293" PostTypeId="2" ParentId="289" CreationDate="2014-06-19T00:59:56.710" Score="6" Body="&lt;p&gt;I'm not sure if you are asking how to grab just the first image, or manipulate just the first image in a loop. You can use &lt;code&gt;.first()&lt;/code&gt; on asset fields to grab the first asset in the array only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also do all kinds of cool things with loops in twig: &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To manipulate just the first image within the loop, you would use &lt;code&gt;loop.first&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-06-19T01:18:04.513" LastActivityDate="2014-06-19T01:18:04.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="294" PostTypeId="1" AcceptedAnswerId="297" CreationDate="2014-06-19T02:47:09.573" Score="5" ViewCount="1150" Body="&lt;p&gt;I am trying to develop a plugin and what I want to do in this plugin is to be able to access the contents table that is already defined in the database and get and update entries in this table. What would be the best practice to do this? I know records can create new tables but how can I access or manipulate an already created table that is not part of my plugin but is created in the database by default?&lt;/p&gt;&#xA;" OwnerUserId="357" LastEditorUserId="45" LastEditDate="2014-06-20T16:44:47.920" LastActivityDate="2014-06-20T16:44:47.920" Title="Using a plugin, how can I manipulate entry data?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="295" PostTypeId="2" ParentId="294" CreationDate="2014-06-19T03:01:43.020" Score="2" Body="&lt;p&gt;Craft is built on Yii, and comes with a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;query builder&lt;/a&gt; for raw database access. It's based on &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;Yii's Query Builder&lt;/a&gt; with some added functions.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-19T03:01:43.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="296" PostTypeId="2" ParentId="289" CreationDate="2014-06-19T04:59:02.263" Score="23" Body="&lt;p&gt;If the “loop” is an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt; object, then you can grab the first element using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot;&gt;&lt;code&gt;.first()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogPost = craft.entries.section('blog').order('posdDate desc').first() %}&#xA;--&#xA;{% set image = entry.myAssetsField.first() %}&#xA;--&#xA;{% set firstTextBlock = entry.myMatrixField.type('text').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However if it’s just a normal array, then you will need to grab the &lt;code&gt;[0]&lt;/code&gt; syntax instead, or Twig’s &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/first.html&quot;&gt;&lt;code&gt;|first&lt;/code&gt; filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set updates = craft.feeds.getFeedItems('http://buildwithcraft.com/updates.rss') %}&#xA;{% set latestUpdate = updates[0] %}&#xA;--&#xA;{% set primaryLocale = craft.i18n.getSiteLocaleIds()|first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;code&gt;[0]&lt;/code&gt; and &lt;code&gt;|first&lt;/code&gt; syntaxes are available to ElementCriteriaModel objects as well, and there’s no performance penalty for using those. &lt;code&gt;.first()&lt;/code&gt; was the only one you could use originally, but that changed in Craft 1.3. I still prefer &lt;code&gt;.first()&lt;/code&gt; when it can be used, just because it looks a little cleaner and jQuery-esque.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One warning about &lt;code&gt;[0]&lt;/code&gt;: If the array/ElementCriteriaModel doesn’t have a first item, and if Dev Mode is enabled, Twig will give you an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstItem = myArray[0] %}&#xA;{% if firstItem %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myArray[0] is defined %}&#xA;    {% set firstItem = myArray[0] %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;|first&lt;/code&gt; and &lt;code&gt;.first()&lt;/code&gt; it’s the other way around, though:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myArray|first is defined %}&#xA;    {% set firstItem = myArray|first %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;--&#xA;&#xA;{% if entry.myAssetsField.first() is defined %}&#xA;    {% set firstItem = entry.myAssetsField.first() %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstItem = myArray|first %}&#xA;{% if firstItem %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;--&#xA;&#xA;{% set firstItem = entry.myAssetsField.first() %}&#xA;{% if firstItem %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-19T04:59:02.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="297" PostTypeId="2" ParentId="294" CreationDate="2014-06-19T07:40:45.270" Score="7" Body="&lt;p&gt;You are correct in stating that Records typically define a new custom table for your plugin. However, don't forget that Craft already comes with many pre-existing Records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look inside this folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/app/records&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although based on your question (and the ensuing comments thread), it looks like you may not need to tap directly into any Records at all. I'd recommend you peruse the built-in API to see what may help you get the job done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, take a look at the EntriesService API... &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice&quot;&gt;http://buildwithcraft.com/docs/apis/entriesservice&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I suspect that everything you need to do can be done using those methods. After all, they already allow you to get, modify, and delete entry data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An important thing to note when dealing with the EntriesService API... You're not directly accessing Entry Records. Instead, you'll be dealing with Entry &lt;strong&gt;Models&lt;/strong&gt;. This is greatly preferred, and you'll find that it's much easier to do what you want with a Model. (Behind the scenes, your model will tie into an Entry Record as needed.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;On a separate note, it looks like you'll need to take advantage of &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#events&quot;&gt;Events&lt;/a&gt;&lt;/strong&gt;. You mentioned in a comment that you'd like an action to take place &quot;when an entry is saved&quot;. To do that, you'll definitely want to take advantage of the &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot;&gt;entries.onSaveEntry&lt;/a&gt;&lt;/strong&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In summary, I don't think that you will need to create a custom Record, nor build your own custom Yii query.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-19T07:40:45.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="298" PostTypeId="1" AcceptedAnswerId="302" CreationDate="2014-06-19T08:16:40.797" Score="11" ViewCount="9647" Body="&lt;p&gt;I have a page that should show entries within a category, and then entries within children of that category. Basically, I need a way to loop through entries that have a level 1 category but not a level 2 category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give an example, suppose I've got some categories set up like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;— 1.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;—— 1.1.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;— 1.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also one entry related to each category. I'd then use code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Reference the category #}&#xA;{% set cat = craft.categories.title('1.').first() %}&#xA;&#xA;{# Find related entries #}&#xA;{% set entries = craft.entries.section('mySection').relatedTo(cat).find() %}&#xA;&#xA;{# Print them out #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.1.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find entries which are &lt;strong&gt;directly&lt;/strong&gt; related to the category “1.”?&lt;/p&gt;&#xA;" OwnerUserId="40" LastEditorUserId="148" LastEditDate="2014-06-20T16:12:32.430" LastActivityDate="2015-02-03T17:32:08.607" Title="Display entries that belong to a category" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="299" PostTypeId="1" AcceptedAnswerId="301" CreationDate="2014-06-19T08:24:53.840" Score="36" ViewCount="7243" Body="&lt;p&gt;I'm developing an online store. The store needs to be seamlessly integrated with all of the editorial content on both the front and back-end. Craft is obviously a perfect candidate for the editorial content, but at this moment the options for e-commerce plugins are limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What e-commerce options are currently available for Craft?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="359" LastEditorUserId="45" LastEditDate="2015-04-23T20:37:25.343" LastActivityDate="2015-12-02T00:31:49.680" Title="What is the current landscape regarding e-commerce plugins for Craft?" Tags="&lt;plugins&gt;&lt;ecommerce&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="23" CommunityOwnedDate="2014-08-14T18:27:49.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="300" PostTypeId="2" ParentId="299" CreationDate="2014-06-19T08:41:13.870" Score="11" Body="&lt;p&gt;I've yet to try it but &lt;a href=&quot;https://snipcart.com&quot;&gt;Snipcart&lt;/a&gt; seems to be on of the most viable options right now. Essentially it works though HTML/JavaScript and integrates with fields you define in your Craft setup, see their post explaining &lt;a href=&quot;https://snipcart.com/blog/integrating-snipcart-with-craft-cms-a-child-s-play-&quot;&gt;here&lt;/a&gt;. You can even update your inventory using their webhooks, again they explain how to &lt;a href=&quot;https://snipcart.com/blog/managing-your-craft-inventory-using-snipcart-webhooks&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only others that you haven't mentioned but are in the Straight Up Craft directory are a &lt;a href=&quot;https://github.com/davist11/craft-shopify/&quot;&gt;Shopify plugin&lt;/a&gt; by Trevor Davis and &lt;a href=&quot;http://squarebit.co.uk/plugins/charge&quot;&gt;Charge&lt;/a&gt; by Joel Bradbury - I'm not sure if you have already seen these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an upcoming site I plan to try the Snipcart method, failing that I'll fall back to implementing &lt;a href=&quot;https://stripe.com&quot;&gt;Stripe.js&lt;/a&gt; manually and writing a plugin to handle the inventory side of things with &lt;a href=&quot;https://stripe.com/docs/webhooks&quot;&gt;Stripe webhooks&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-06-19T08:41:13.870" CommentCount="4" CommunityOwnedDate="2014-08-14T18:27:49.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="301" PostTypeId="2" ParentId="299" CreationDate="2014-06-19T09:22:45.257" Score="39" Body="&lt;h3&gt;E-commerce Master List&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is a compilation of all publicly available solutions.&lt;/strong&gt; Other answers here describe each plugin in greater detail... This is simply a complete list of every known option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Listed in alphabetical order (not by popularity or preference)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1st party plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcommerce.com/&quot;&gt;Craft Commerce&lt;/a&gt; (&lt;em&gt;see more info below&lt;/em&gt;)*&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3rd party plugins (built exclusively for Craft)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot;&gt;Charge&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/commerce&quot;&gt;Sprout Commerce&lt;/a&gt; (in private beta)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3rd party services with official Craft plugins&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/FoxyCart/foxycart-craft&quot;&gt;FoxyCart&lt;/a&gt; (&lt;a href=&quot;https://wiki.foxycart.com/integration/craftcms&quot;&gt;integration notes&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/snipcart/snipcart-craft-webhooks-plugin&quot;&gt;Snipcart&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3rd party services with unofficial Craft plugins&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-moltin&quot;&gt;Moltin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/davist11/craft-shopify/&quot;&gt;Shopify&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/mattstein/snipcart-craft-plugin&quot;&gt;Snipcart&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DIY custom solutions (via an API)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://moltin.com/&quot;&gt;Moltin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://developer.paypal.com/docs/api/&quot;&gt;PayPal&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stripe.com/docs&quot;&gt;Stripe&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&amp;#42; Craft Commerce was formerly known as &quot;Market Commerce&quot; (aka &quot;Cellar Commerce&quot;). The name was changed after the plugin (and its developer, &lt;a href=&quot;https://twitter.com/lukeholder&quot;&gt;Luke Holder&lt;/a&gt;) were &lt;a href=&quot;http://pixelandtonic.com/blog/craft-commerce&quot;&gt;acquired by Pixel &amp;amp; Tonic&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="3951" LastEditDate="2015-12-02T00:31:49.680" LastActivityDate="2015-12-02T00:31:49.680" CommentCount="23" CommunityOwnedDate="2014-08-14T18:27:49.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="302" PostTypeId="2" ParentId="298" CreationDate="2014-06-19T09:39:49.633" Score="9" Body="&lt;p&gt;Categories are Craft's implementation of a taxonomy, which itself is the classification of things into groups and sub-groups. In this respect, I suppose it makes sense that if an entry is related to a sub-category, it inherits (it's also related to) its parent. That would explain why you're getting all entries in this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, the only way I can think of is to test what level the category/sub-category is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this would get you started for the time being. I don't really like this because it seems convoluted, so I'll put my thinking cap on and I may revise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('myGroup').title('1.').first() %}&#xA;{% set entries = craft.entries.section('mySection').relatedTo(category).find() %}&#xA;{% set isThisLevel = false %}&#xA;{% for entry in entries %}&#xA;&#xA;    {# Test if this entry is related to the correct category level #}&#xA;    {% for relatedCat in entry.catField %}&#xA;        {% if relatedCat.level == category.level %}&#xA;            {% set isThisLevel = true %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {# Only output if it's this category level #}&#xA;    {% if isThisLevel %}&#xA;        {# Do whatever you want #}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastEditorUserId="148" LastEditDate="2014-06-20T08:53:31.780" LastActivityDate="2014-06-20T08:53:31.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="303" PostTypeId="1" AcceptedAnswerId="305" CreationDate="2014-06-19T10:19:13.837" Score="4" ViewCount="2620" Body="&lt;p&gt;Looping through a category group to show links to all the categories. This is an entry page and I want to highlight any categories assigned to the entry. How do I do that? I've tried this so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = craft.categories.group('events').find() %}&#xA;{% for cat in cats %}&#xA;    &amp;lt;a href=&quot;{{ cat.url }}&quot; {% if cat.relatedTo(entry) %}class=active{% endif %}&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-06-19T10:30:36.893" LastActivityDate="2014-06-19T10:35:01.747" Title="How to loop through category group and identify those related to entry" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="305" PostTypeId="2" ParentId="303" CreationDate="2014-06-19T10:35:01.747" Score="9" Body="&lt;p&gt;Your solution looks like it's almost there, but it would be making a lot of DB queries as Craft will be querying the database for each category. You can give Craft all the help you can with something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# First, retrieve all of your events categories #}&#xA;{% set cats = craft.categories.group('events').find() %}&#xA;&#xA;{# Get the IDs of all categories related to this entry #}&#xA;{% set relatedCats = craft.categories.group('events').relatedTo({sourceElement: entry}).ids() %}&#xA;&#xA;{# Test if the current category ID is in the array of related category IDs #}&#xA;{% for cat in cats %}&#xA;    &amp;lt;a href=&quot;{{ cat.url }}&quot; {% if cat.id in relatedCats %}class=&quot;active&quot;{% endif %}&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-06-19T10:35:01.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="306" PostTypeId="2" ParentId="277" CreationDate="2014-06-19T13:12:48.820" Score="2" Body="&lt;p&gt;You could use the cache tags &lt;a href=&quot;https://craftcms.com/docs/templating/cache#until&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;until&lt;/code&gt;&lt;/a&gt; parameter and calculate the next expiration date from your &quot;cacheDuration&quot; config variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cacheDuration' =&amp;gt; 604800, // 1 week&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/round.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;round&lt;/code&gt;&lt;/a&gt; filter to round up from &quot;now&quot; to the next week.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set duration = craft.config.cacheDuration %}&#xA;{% set next = (now|date('U') / duration)|round(0, 'ceil') * duration %}&#xA;&#xA;{% cache until next|date('c') %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-06T00:02:43.153" LastActivityDate="2016-02-06T00:02:43.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="307" PostTypeId="1" AcceptedAnswerId="310" CreationDate="2014-06-19T13:17:47.443" Score="4" ViewCount="465" Body="&lt;p&gt;I have created a fieldtype that saves a single integer to the database, it has some settings that defines the maximum value that integer can be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;  return array(&#xA;    'maxNumber' =&amp;gt; array(AttributeType::Number, 'min' =&amp;gt; 2, 'default' =&amp;gt; 12)&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do when outputting my field in the templates is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The value is {{ entry.myField }} of {{ entry.myField.maxNumber }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas? Do I need to create a data class like the options-based fields use or something? I'm just stabbing around in the dark here...&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2014-06-19T15:44:23.267" LastActivityDate="2014-06-23T17:00:17.993" Title="When creating a fieldtype how do I provide methods to be used in the templates?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="308" PostTypeId="2" ParentId="307" CreationDate="2014-06-19T14:04:14.487" Score="1" Body="&lt;p&gt;To do this as you describe, you would need to add the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use&quot; rel=&quot;nofollow&quot;&gt;prepValue&lt;/a&gt; function to your field type. You would then need to create a PHP class to fill with your field value and settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure that it would work, but I also suggest adding the __invoke() method. You could use it to return the field value when you use the object as a variable (though Twig would call it as a method I think).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-19T14:04:14.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="309" PostTypeId="1" AcceptedAnswerId="9609" CreationDate="2014-06-19T14:10:06.760" Score="18" ViewCount="2040" Body="&lt;p&gt;I am using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#cache&quot;&gt;&lt;code&gt;cache&lt;/code&gt;&lt;/a&gt; tag in my templates. How can I assure that a site visitor always gets the data directly from the cache and never has to wait for it to be generated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My cache gets invalidated quiet often, as this happens each time new content is created or edits are made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on how to trigger the recreation of all cached template content automatically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To better explain my use case: some of my &lt;code&gt;craft.assets&lt;/code&gt; and &lt;code&gt;craft.entries&lt;/code&gt; calls result in a lot of DB queries. Without the template being cached this leads to 3+ seconds delay in page-load. Using Craft cache this is solved for all but one site visitors, because there is still the first visitor, that has to trigger the caches to be created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you shouldn't ignore this single user and hope someone comes up with a solution as additional 3+ seconds in page-load can easily cause customer loss. Further I'd appreciate a solution feasible with core functions, as I consider performance being a key component to every site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;2nd Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I started a bounty on this question was to get more attention on it from the community and also from P&amp;amp;T. This seems to work out so far, so thank you all for your thoughts on this and for having this interesting discussion, which is sometimes a little too technical for me (who's not a php/server developer). I actually don't know what to do which the bounty points, but for me it was already worth spending them (who cares for pts anyway?)! &lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-25T14:45:29.203" LastActivityDate="2016-02-19T18:54:49.197" Title="Cache invalidation to automatically update all cached template content?" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="4" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="310" PostTypeId="2" ParentId="307" CreationDate="2014-06-19T14:51:49.350" Score="7" Body="&lt;p&gt;Like plugins, fieldtypes can have their own settings as you're aware but while you can grab your plugin settings from pretty much anywhere, fieldtypes are a little more contextual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, like @Bryan pointed out, your fieldtype needs to implement &lt;code&gt;prepValue($value)&lt;/code&gt; and ideally return a model containing the value as defined in &lt;code&gt;defineAttributes()&lt;/code&gt; and the &lt;code&gt;maxNumber&lt;/code&gt; as a property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This basically means that when Craft calls your fieldtype's &lt;code&gt;prepValue($value)&lt;/code&gt; which it does when the value of your field is needed (editing/outputting) you can return a model with the &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;maxNumber&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// MyFieldType.php&#xA;public function prepValue($value)&#xA;{&#xA;    $model = new MyFieldModel;&#xA;&#xA;    $model-&amp;gt;setAttribute('value', $value);&#xA;    $model-&amp;gt;setMaxNumber($this-&amp;gt;getSettings()-&amp;gt;getAttribute('maxNumber'));&#xA;&#xA;    return $model;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// MyFieldModel.php&#xA;// Explicit getter/setter for $maxNumber rather than defining it as an attribute&#xA;protected $maxNumber;&#xA;&#xA;public function setMaxNumber($value)&#xA;{&#xA;    $this-&amp;gt;maxNumber = $value;&#xA;}&#xA;&#xA;public function getMaxNumber()&#xA;{&#xA;    return $this-&amp;gt;maxNumber;&#xA;}&#xA;&#xA;public function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'value' =&amp;gt; AttributeType::Number,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;// _entry.html or other template name&#xA;{{ entry.myFieldHandle.value }}&#xA;{{ entry.myFieldHandle.maxNumber }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twitter.com/selvinortiz&quot; rel=&quot;nofollow&quot; title=&quot;@selvinortiz&quot;&gt;@selvinortiz&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2014-06-23T17:00:17.993" LastActivityDate="2014-06-23T17:00:17.993" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="311" PostTypeId="1" CreationDate="2014-06-19T15:19:55.083" Score="2" ViewCount="761" Body="&lt;p&gt;What would be the best approach to a webshop in Craft, for solving the possibility of having products on more that on URL. Is there a best practice for one entry being accessible from more than one url? We use canonical for SEO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a quick summary of the current approach that works, but may be totally overkill :)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Products are stored in a Channel.&lt;/li&gt;&#xA;&lt;li&gt;A product can be related to several entries in Structures &gt; Product Categories.&lt;/li&gt;&#xA;&lt;li&gt;The product uri is for example /shop/category/subcategory/product - meaning that one product can have more than one location (url). The SEO issue with this is handled with &lt;a href=&quot;https://support.google.com/webmasters/answer/139066?hl=en&quot; rel=&quot;nofollow&quot;&gt;canonical URLs&lt;/a&gt; (further down). The reason we want the product in several locations is that the store is for example selling a certain boot both as a &quot;hiking boot&quot; and a &quot;hunting boot&quot;, so the context is different and it won't work as well going to domain.com/products/name without the category (keyword rich) structure in the url. Also having all product entries at the same base url like that (/products/name/) takes the user out of their current context in general (breadcrumb + section specific content/design) if they clicked the product at domain.com/shop/boots/hiking/high/.&lt;/li&gt;&#xA;&lt;li&gt;3 routes are setup to send /shop/* (1-3 levels adding /* for each) to the ecommerce/_product template.&lt;/li&gt;&#xA;&lt;li&gt;Entry is not found when entering a product in this way, so if entry is not defined, it is set to be the one matching the last segment of the current URL (matched by slug).&lt;/li&gt;&#xA;&lt;li&gt;Now we're good to go to show the actual product entry.&lt;/li&gt;&#xA;&lt;li&gt;The issue of SEO (penalty for duplicate content) is handled with &quot;canonical&quot;. I get all entries from Product Categories with a relation to the product (reversed relation), and defining the first one in that loop to be the main location (random - could be set as a relation on product level for the user to decide, but that requires &quot;manual control&quot; and may be hard for the client to relate to), and all other URLs showing the product in a different category that the main location will get  in the header.&lt;/li&gt;&#xA;&lt;li&gt;In product listings we find the uri to each product again with reversed relations to all categories that has a relation to that product, and we prioritize the product category we are currently in. If the product is listed outside any of its product categories (like on a product page as a related product) it ends up with the base url from the last reversed related product category.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you think this approach works well or if you have any other ideas.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out with native Categories for product categories. But the client is a brand selling their own product on their site, and each product category is a page with quite a bit more content than just the products, so I have a structure with an entry type for productCategory with several tabs (not possible for a Category).&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="250" LastEditDate="2014-07-08T22:06:29.137" LastActivityDate="2014-07-08T22:06:29.137" Title="Best approach for building a webshop with more than one URL to the same product (entry)" Tags="&lt;url&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="313" PostTypeId="2" ParentId="311" CreationDate="2014-06-19T15:46:32.550" Score="6" Body="&lt;p&gt;My two cents:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I wouldn't use different url's for the same product, that's considered bad seo. Instead use something like &lt;code&gt;domain.com/product/slug&lt;/code&gt;. That way you can change product categories while keeping the links intact, and it'll be easier to get the url of entries.&lt;/li&gt;&#xA;&lt;li&gt;If there is no specific reason for using structures, use &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot;&gt;native categories&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Instead of reverse-relations for seo-information, a simpler solution like &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo/&quot;&gt;Sprout SEO&lt;/a&gt; might be better.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt;: keep it simple&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-19T15:46:32.550" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="314" PostTypeId="1" AcceptedAnswerId="315" CreationDate="2014-06-19T16:01:17.573" Score="8" ViewCount="1132" Body="&lt;p&gt;I am considering a purchase of Craft Pro in place of a new ExpressionEngine build for a client. One of the client's requirements is that there be a comprehensive set of logs like Audit Pro of what each user is doing (logging on, deleting entries, changing settings) and when. Is that data logged in Craft Pro, or is there a plugin that would accomplish that functionality?&lt;/p&gt;&#xA;" OwnerUserId="368" LastActivityDate="2014-06-20T22:14:13.020" Title="Comprehensive logging of user actions with Craft Pro?" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="315" PostTypeId="2" ParentId="314" CreationDate="2014-06-19T16:07:50.510" Score="7" Body="&lt;p&gt;I don't know of a plugin that exists expressly for this purpose, but you could combine &lt;a href=&quot;https://github.com/themusicman/lumberjack/&quot; rel=&quot;noreferrer&quot;&gt;LumberJack&lt;/a&gt; (logging plugin) with &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;noreferrer&quot;&gt;Craft's numerous events&lt;/a&gt; to make this happen with your own plugin. You can log from within said plugin or even in your Craft templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the event reference and see if there's enough there to satisfy your client's needs. Creating your plugin should be pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may also be worth noting that Craft's logs are available from the control panel at &lt;code&gt;/admin/utils/logs&lt;/code&gt;. These are developer-centric errors and warnings though, not a record of specific user actions.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-19T16:19:00.237" LastActivityDate="2014-06-19T16:19:00.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="316" PostTypeId="2" ParentId="299" CreationDate="2014-06-19T16:42:00.677" Score="14" Body="&lt;p&gt;I just finished &lt;a href=&quot;http://lighthouseroasters.com/&quot;&gt;my first Snipcart project&lt;/a&gt; and I'm in the process of making a plugin for browsing orders and customers from the Craft control panel. Lindsey D's got the landscape covered with his answer so I can at least share my experience with &lt;a href=&quot;https://snipcart.com/&quot;&gt;Snipcart&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Snipcart&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For those who somehow skipped other answers or haven't &lt;em&gt;looked at&lt;/em&gt; Snipcart, it's a JavaScript cart service that's focused on being quick and easy to implement. You define product links with some &lt;code&gt;data&lt;/code&gt; markup, include their cart JavaScript, and get a modal (guest+member) cart and checkout flow that you can style as needed. It can work with physical products, downloads, somewhat configurable products, and it comes with support for flexible promotional code options. There's a somewhat limited (but useful) control panel, integration with a handful of payment gateways, and the option of using live shipping rates from different (selectable) carriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Snipcart is not as full-featured as something like Shopify—the reporting is fairly basic and we're hoping for gift certificate support, for example. My client asked to customize the specific shipping speeds/services offered by carriers, but at the time of this answer it's not possible; you can only toggle one &lt;em&gt;carrier&lt;/em&gt; or another, not the individual services from that carrier. These limitations are the tradeoffs you get with Snipcart since it's young: it's astonishingly easy to get working right now, but if a particular feature doesn't exist there's not much you can do other than ask and wait.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Team Snipcart&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Snipcart's team is small but dedicated and incredibly responsive. It's abundantly clear that they're working hard on building and refining their product. Charles responded quickly and thoughtfully to every question I had, even the annoying didn't-RTFM ones. He was willing to take feature requests, help troubleshoot when I had issues, and he's a nice guy to boot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes merely asking about &lt;em&gt;how to do something&lt;/em&gt; would result in a feature magically appearing or a problem being fixed.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Integration&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you can &lt;a href=&quot;http://docs.snipcart.com/configuration/product-definition&quot;&gt;define your products&lt;/a&gt; in a way that works, you're basically done. There are JavaScript and REST APIs and webhook support for limited extensibility. The Snipcart folks are aware of Craft, to the point of &lt;a href=&quot;https://snipcart.com/blog/managing-your-craft-inventory-using-snipcart-webhooks&quot;&gt;suggesting Craft-specific inventory management on their blog&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Snipcart was easy to drop in and immediately get a working cart. (And we're using Stripe, which is always dreamy in my experience.) Overriding/customizing cart styles was painless, even though Snipcart could change the base cart markup at any time and require some adjustment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integration with Stripe was perfectly smooth, in test mode and in live mode—not a single issue or hiccup. Snipcart was available and fast 100% of the time, and every order has been captured and charged flawlessly as you'd expect. (We had some initial configuration issues on our end that we quickly worked out, but those weren't Snipcart's fault.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We had an awkward account-juggling process since there's only one set of administrative credentials per Snipcart account. We ended up creating a new client-owned account and reconfiguring it for launch. Not a big deal, but it'd be nice to see multiple account users as an option. You can have multiple private API keys, hence the Craft plugin I'm working on for browsing orders/customers.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Conclusion&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Snipcart's definitely the scrappy new kid on the block, this simple integration has gone pretty well, and I would look to use Snipcart again for the right project. For a store with more intense/complicated needs, Shopify, Commerce, or Sprout Commerce might give you more control at the expense of more development time.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-19T19:11:10.427" LastActivityDate="2014-06-19T19:11:10.427" CommentCount="6" CommunityOwnedDate="2014-08-14T18:27:49.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="318" PostTypeId="1" AcceptedAnswerId="432" CreationDate="2014-06-19T19:50:19.110" Score="5" ViewCount="1894" Body="&lt;p&gt;The &lt;code&gt;'localhost'&lt;/code&gt; array is not being recognized. If I add &lt;code&gt;:3307&lt;/code&gt; to the &lt;code&gt;'*'&lt;/code&gt; array's server attribute, it works. Here's the contents of my db.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '*' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'av01759',&#xA;    'password' =&amp;gt; '*******',&#xA;    'database' =&amp;gt; 'av01759_maltaministries',&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;  ),&#xA;&#xA;  'localhost' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost:3307'&#xA;  )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This a fresh Craft install with no tweaks. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="372" LastEditorUserId="250" LastEditDate="2014-06-20T20:42:12.343" LastActivityDate="2016-04-27T08:29:23.993" Title="Multi-environment database config being ignored" Tags="&lt;environments&gt;" AnswerCount="8" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="319" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T20:01:44.787" Score="2" Body="&lt;p&gt;This issue may be that your database name, prefix, password, etc are different on your local machine, than the ArcusTech server. If your local values don't match the values in the block defined with the asterisk, you won't be able to connect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most local databases with tools like MAMP, use a default user and password like 'root'. Try to look into some of these values, or post more info about your local setup.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2014-06-19T20:01:44.787" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="320" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T20:06:19.747" Score="2" Body="&lt;p&gt;If you're using MAMP you might also want to try using &quot;.dev&quot; or &quot;.dv&quot; for your array like so in your general.php config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;     'devMode' =&amp;gt; true,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Versus using &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATED Local / Live General.php file setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'defaultFolderPermissions' =&amp;gt; 0755,&#xA;        'phpMaxMemoryLimit' =&amp;gt; '1024M',&#xA;        'useCompressedJs' =&amp;gt; true,&#xA;        'useEmailAsUsername' =&amp;gt; true,&#xA;        'autominEnabled' =&amp;gt; true,&#xA;        'autominCachingEnabled' =&amp;gt; true,&#xA;        'autominMinifyEnabled' =&amp;gt; true,&#xA;    ),&#xA;    '.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://www.DOMAINNAME.dev/',&#xA;            'basePath' =&amp;gt; 'LOCAL PATH',&#xA;            'autominPublicRoot' =&amp;gt; basePath,&#xA;            'autominCachePath' =&amp;gt; basePath.'cache',&#xA;            'autominCacheURL' =&amp;gt; '/cache',&#xA;        )&#xA;    ),&#xA;    '.com' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; false,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://www.DOMAINANME.COM/',&#xA;            'basePath' =&amp;gt; 'SERVER BASE PATH',&#xA;            'autominPublicRoot' =&amp;gt; basePath,&#xA;            'autominCachePath' =&amp;gt; basePath.'cache',&#xA;            'autominCacheURL' =&amp;gt; '/cache',&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="101" LastEditorUserId="101" LastEditDate="2014-06-19T20:17:29.323" LastActivityDate="2014-06-19T20:17:29.323" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="321" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T20:20:52.950" Score="2" Body="&lt;p&gt;When you are accessing a database &quot;from a distance&quot;, it won't be called &quot;localhost&quot;. Having the port in there is probably helpful, but you'll want to specify the DB server by its IP address.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'localhost' =&amp;gt; array(&#xA;  'server' =&amp;gt; '(DB IP address):3307'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, be sure that your server database is allowing remote access. By default, most DBs will only allow access to their local files.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-19T20:20:52.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="322" PostTypeId="1" AcceptedAnswerId="325" CreationDate="2014-06-19T20:23:49.480" Score="3" ViewCount="182" Body="&lt;p&gt;I just uploaded 48,000 photos to Amazon S3, added the bucket to Craft, and am now trying to add them to the Assets library. Where can I see the logs for this?&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="284" LastEditDate="2014-06-20T00:08:27.407" LastActivityDate="2014-06-20T16:10:42.720" Title="How can I check the progress of a large Assets indexing job?" Tags="&lt;assets&gt;&lt;index&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="323" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T20:25:56.883" Score="3" Body="&lt;p&gt;The environment-specific array that Craft uses is determined by the $_SERVER['SERVER_NAME'] variable (usuall your &lt;em&gt;domain name&lt;/em&gt;), not the database hostname. Instead of using &lt;code&gt;localhost&lt;/code&gt; to trigger the env-specific settings, you should use your domain. Your db.php should looks more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  // default&#xA;  '*' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'av01759',&#xA;    'password' =&amp;gt; '*******',&#xA;    'database' =&amp;gt; 'av01759_maltaministries',&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;  ),&#xA;&#xA;  // production-specific (use your domain instead of example.com)&#xA;  'example.com' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost:3307'&#xA;  )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Since in this case, $_SERVER['SERVER_NAME'] actually is &quot;localhost&quot; for you and I understand you are connecting to a remote db, you could try using this for your db.php (swapped the value for &lt;code&gt;server&lt;/code&gt; in my above example, this way you make the exception for production).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  // default&#xA;  '*' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost:3307',&#xA;    'user' =&amp;gt; 'av01759',&#xA;    'password' =&amp;gt; '*******',&#xA;    'database' =&amp;gt; 'av01759_maltaministries',&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;  ),&#xA;&#xA;  // production-specific&#xA;  'production-site-domain-here.com' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost'&#xA;  )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2014-06-19T20:53:03.210" LastActivityDate="2014-06-19T20:53:03.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="324" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T20:26:28.193" Score="2" Body="&lt;p&gt;Another option is to use named environments instead of using domain matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in your &lt;code&gt;index.php&lt;/code&gt; file, just set (changing 'development' to whatever you like):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_ENVIRONMENT', 'development');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your environmental config array can use &quot;development&quot; as a key, instead of &lt;code&gt;localhost&lt;/code&gt; or &lt;code&gt;.dev&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-19T20:26:28.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="325" PostTypeId="2" ParentId="322" CreationDate="2014-06-19T21:13:31.467" Score="9" Body="&lt;p&gt;It's not a log per se, but you can check out the &lt;code&gt;craft_assetindexdata&lt;/code&gt; table of your database. That will show you all of the assets which Craft has indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how far Craft has gotten by taking a look at the &lt;strong&gt;recordId&lt;/strong&gt; column - all of the already indexed entries are going to have a value in that column while the records still waiting to be indexed are going to have NULL there.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-20T16:10:42.720" LastActivityDate="2014-06-20T16:10:42.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="327" PostTypeId="2" ParentId="318" CreationDate="2014-06-19T22:11:32.830" Score="1" Body="&lt;p&gt;This boils down to being either one of two things...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &lt;strong&gt;database connection error&lt;/strong&gt;, or&lt;/li&gt;&#xA;&lt;li&gt;An &lt;strong&gt;environment detection error&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You seem very convinced that the database connection info is perfect, so let's explore the possibility of an environment detection error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please conduct this test... Edit your &lt;strong&gt;craft/config/general.php&lt;/strong&gt; file, and add this configuration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '*' =&amp;gt; array(),&#xA;&#xA;  'localhost' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true&#xA;  )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now login to your Craft control panel... &lt;strong&gt;Do you see the yellow-striped &quot;caution tape&quot; at the top of your control panel?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &quot;yes&quot;, then your environment detection is working perfectly. Therefore, you have a database connection error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &quot;no&quot;, then you have an environment detection error. If this is the case, please answer this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Exactly what URL do you use to view your website on your local machine?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-19T22:11:32.830" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="328" PostTypeId="2" ParentId="299" CreationDate="2014-06-20T02:17:38.460" Score="8" Body="&lt;p&gt;Foxycart indicates they are jumping in  &lt;a href=&quot;https://twitter.com/foxycart/status/478952251239567361&quot;&gt;https://twitter.com/foxycart/status/478952251239567361&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2014-06-20T02:17:38.460" CommentCount="3" CommunityOwnedDate="2014-08-14T18:27:49.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="329" PostTypeId="1" AcceptedAnswerId="330" CreationDate="2014-06-20T05:36:18.787" Score="8" ViewCount="1553" Body="&lt;p&gt;If one wished to manually update for any reason, would one need to change anything outside of the the app folder, or be concerned with anything else?&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="45" LastEditDate="2014-06-21T06:12:25.570" LastActivityDate="2016-09-09T14:38:20.233" Title="How can I manually update Craft?" Tags="&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="330" PostTypeId="2" ParentId="329" CreationDate="2014-06-20T05:40:29.313" Score="17" Body="&lt;p&gt;&lt;strong&gt;Only the /app folder matters.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No other files are relevant to the Craft core operations. Make sure you replace the folder entirely, don't let the new files get merged with the old files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing else will be changed. If the update would trigger any database changes, those will be handled automatically by migrations (located in the app/migrations folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, see the documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/updating#manually-updating&quot;&gt;Manually Updating&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-20T05:57:51.527" LastActivityDate="2014-06-20T05:57:51.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="331" PostTypeId="2" ParentId="329" CreationDate="2014-06-20T06:33:59.880" Score="6" Body="&lt;p&gt;I would also recommend using the one-click updating feature to make sure the updates are installed correctly. This feature is really quick and handles everything for you.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-06-20T06:33:59.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="332" PostTypeId="2" ParentId="311" CreationDate="2014-06-20T07:43:33.880" Score="2" Body="&lt;p&gt;It looks to me as if you need to have multiple urls for one entry, because at least as far as the breadcrumbs go, you have different content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example for entry &lt;code&gt;boot1&lt;/code&gt;: its data shows up at &lt;code&gt;/shop/boots/hiking/boot1&lt;/code&gt; with breadcrumbs &lt;em&gt;boots &gt; hiking&lt;/em&gt; and at &lt;code&gt;/shop/boots/hunting/boot1&lt;/code&gt; with breadcrumbs &lt;em&gt;boots &gt; hunting&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you really do need the multiple urls, not overkill. Make sure that &lt;code&gt;/shop/bad/path/boot1&lt;/code&gt; gives a &lt;code&gt;404&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-20T07:43:33.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="333" PostTypeId="1" AcceptedAnswerId="334" CreationDate="2014-06-20T09:07:57.943" Score="4" ViewCount="757" Body="&lt;p&gt;I have a structure like below and need previous / next links on an entry such that they go back and forth between E, F, G and H. They shouldn't step into D or I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying this, but I can't get it not to step into D or I.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%  set prev = entry.getPrev({section: 'mySection'}) %}&#xA;&#xA;    {% if not prev %}&#xA;        {% set prev = craft.entries.section('mySection').last() %}&#xA;    {% endif %}&#xA;&#xA;    {{ prev.title }}&#xA;&#xA;    {% set next = entry.getNext({section: 'mySection'}) %}&#xA;&#xA;    {% if not next %}&#xA;        {{ craft.entries.section('mySection').order('lft desc').first().title }}&#xA;    {% endif %}&#xA;&#xA;    {{ next.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A&#xA;&lt;ul&gt;&#xA;&lt;li&gt;B&lt;/li&gt;&#xA;&lt;li&gt;C&lt;/li&gt;&#xA;&lt;li&gt;D&#xA;&lt;ul&gt;&#xA;&lt;li&gt;E&lt;/li&gt;&#xA;&lt;li&gt;F&lt;/li&gt;&#xA;&lt;li&gt;G&lt;/li&gt;&#xA;&lt;li&gt;H&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;I&#xA;&lt;ul&gt;&#xA;&lt;li&gt;J&lt;/li&gt;&#xA;&lt;li&gt;K&lt;/li&gt;&#xA;&lt;li&gt;L&#xA;&lt;ul&gt;&#xA;&lt;li&gt;M&lt;/li&gt;&#xA;&lt;li&gt;N&lt;/li&gt;&#xA;&lt;li&gt;O&lt;/li&gt;&#xA;&lt;li&gt;P&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="122" LastEditorUserId="177" LastEditDate="2014-06-20T10:03:51.513" LastActivityDate="2014-06-20T10:03:51.513" Title="How do you page through entries in a structure?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="334" PostTypeId="2" ParentId="333" CreationDate="2014-06-20T09:43:09.790" Score="7" Body="&lt;p&gt;Craft provides many helpful methods to traverse structure sections and your use case is no exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using &lt;code&gt;.getPrev()&lt;/code&gt; or &lt;code&gt;.getNext()&lt;/code&gt;, try &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling&quot;&gt;&lt;code&gt;.getPrevSibling()&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNextSibling&quot;&gt;&lt;code&gt;.getNextSibling()&lt;/code&gt;&lt;/a&gt; (or their aliases &lt;code&gt;.prevSibling&lt;/code&gt; and &lt;code&gt;.nextSibling&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create prev/next links with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = entry.prevSibling %}&#xA;{% if prev %}&#xA;    &amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;{{ prev.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% set next = entry.nextSibling %}&#xA;{% if next %}&#xA;    &amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;{{ next.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-06-20T09:43:09.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="335" PostTypeId="1" AcceptedAnswerId="338" CreationDate="2014-06-20T10:28:04.387" Score="4" ViewCount="290" Body="&lt;p&gt;For instance I'm writing a plugin which is going to be periodically pulling stuff from Twitter, so I'd like to keep a hold of when the plugin was last run and maybe some Ids relevant to Twitter that sort of thing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is the settings array which you use for user defined values, should I also use it for other stuff that the user can't change, or is there a more sensible place to stick those?  &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2014-06-23T17:04:52.790" Title="When developing plugins where should you store values that might not strictly be settings?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="336" PostTypeId="1" AcceptedAnswerId="377" CreationDate="2014-06-20T11:33:27.890" Score="3" ViewCount="409" Body="&lt;p&gt;I created some sample blog posts during development, and now want to change the author of those posts to the client. Yet, only I'm listed in the dropdown box when I try and change an entry's author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Besides editing it in the database.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-06-21T13:12:05.753" Title="Change author of entry within Craft Client licence" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="337" PostTypeId="2" ParentId="336" CreationDate="2014-06-20T12:28:14.133" Score="2" Body="&lt;p&gt;Can you edit the client's permissions settings so that he can edit and/or create entries? Because that's what necessary with the &quot;Pro&quot; package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is to just rename your account, change the email and make it the client's.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-20T12:28:14.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="338" PostTypeId="2" ParentId="335" CreationDate="2014-06-20T12:36:01.493" Score="7" Body="&lt;p&gt;You could create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot; title=&quot;Record&quot;&gt;Record&lt;/a&gt; which will give you a custom table to store your twitter related settings and update them as needed but I think that your use case is still simple enough that you could leave them in the &lt;code&gt;settings array&lt;/code&gt; and then use the &lt;code&gt;Plugins Service&lt;/code&gt; to update those settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I would do it if I chose to use &lt;code&gt;defineSettings()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// MyPlugin.php&#xA;public function defineSettings()&#xA;{&#xA;   return array(&#xA;        // ...&#xA;        'twitterApiKey' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; '5omeRand0mstriNg'),&#xA;        'twitterUsername' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'someone'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// MyService.php&#xA;public function saveTwitterSettings(array $settings=array())&#xA;{&#xA;    $plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('myplugin');&#xA;    $savedSettings = $plugin-&amp;gt;getSettings()-&amp;gt;getAttributes();&#xA;    $newSettingsRow = array_merge($savedSettings, $settings);&#xA;&#xA;    return craft()-&amp;gt;plugins-&amp;gt;savePluginSettings($plugin, $newSettingsRow);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Feel free to follow up with questions/comments if you have any.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twitter.com/selvinortiz&quot; rel=&quot;nofollow&quot; title=&quot;Selvin Ortiz&quot;&gt;@selvinortiz&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2014-06-23T17:04:52.790" LastActivityDate="2014-06-23T17:04:52.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="339" PostTypeId="2" ParentId="10" CreationDate="2014-06-20T14:02:10.683" Score="11" Body="&lt;p&gt;Note: This method is not for the faint of heart and might not be for everybody, but can be useful in some situations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;One thing we do (at &lt;a href=&quot;http://airtype.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Airtype Studio&lt;/a&gt;, where I work) for larger installations is set up a couple of load-balanced pools of servers: an app tier and a web tier. In fact, the environment architecture is very similar to this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DvC0o.png&quot; alt=&quot;aws architecture&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of architecture is commonly referred to as an n-tier architecture. You can read more about it here: &lt;a href=&quot;https://stackoverflow.com/a/312197/3053214&quot;&gt;https://stackoverflow.com/a/312197/3053214&lt;/a&gt;. Basically, web servers can't talk to the database; Only the app servers can. This allows you to lock down who or how the app servers are accessed. It also provide a layer of separation between software that can be publicly attacked (the web tier) and the database, which inherently has advantages outside of the context of this question. Anyways, moving on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So where does Craft fit into this big picture and more importantly, what does this have to do with migrating data across environments? I'm getting there, just bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We install Craft on the app tier and basically build an API (either by outputting json via twig which can get hairy, or building plugin to map routes and output json for us). On the web tier we have a php app (like Laravel, Yii, Slim, etc - we typically choose Laravel) that makes requests to and consumes the app tier API that Craft is controlling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a git standpoint, the web and app tiers have their own repos. They are considered two separate applications, each on their on track, although they work together as one. Each application has their own dev and staging environments. This allows us to point our web-dev environment to our app-production environment. I could have a whole convo on what a git workflow looks like in this situation, so if you're interested, hit me up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To manage content across multiple environments, we don't actually migrate data at all. We elevate it. What I mean by this is all web tier apps typically point to the production environment of the app tier. It's no different than pulling data from a 3rd party source, like Twitter for example. You don't point your dev environment to Twitter's dev environment do you? No, you'd have your dev code point to Twitter's production environment. My main point is, don't feel like your web-dev environment has a 1 to 1 relationship with your app-dev environment. Just don't think about it like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On entries within Craft, we use a multi-select or checkbox custom field that contains a list of our environments. By checking which environments the content is allowed to be viewed in and querying Craft with the environment criteria, we can effectively limit where our content is allowed to show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So really, a request for us goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The user requests &lt;a href=&quot;http://website.com/about&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website.com/about&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The web tier makes a GET request to the APP tier to get the about&#xA;page info. The environment of the web tier is sent over with the GET&#xA;request (either as a custom header or a query string parameter).&lt;/li&gt;&#xA;&lt;li&gt;On the app tier, Craft reads the criteria pass from the web tier and&#xA;gets the content that matches the criteria (entry, environment,&#xA;etc).&lt;/li&gt;&#xA;&lt;li&gt;The app tier returns a json response to the web tier.&lt;/li&gt;&#xA;&lt;li&gt;The web tier handles presenting the view, or template (which is a&#xA;non-Craft template).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now I realize that many of you have no need for a load balanced, multi-tier environment. Not to mention that setting all this up as described above is a lot of work and in many situations is super overkill. However, you can apply some of the principles of what I'm describing to an environment that as a much smaller scale. For example, you could set up separate virutalhosts on the same server and build out web and app environments there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of thoughts about all of this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Having a standardized, RESTful Craft API would make something&#xA;like this a lot easier. As described above, creating that app tier&#xA;API is up to the individuals creating the site. This can lead to&#xA;inconsistencies in the API if not done with care.&lt;/li&gt;&#xA;&lt;li&gt;Having environment support natively on elements would be ideal,&#xA;rather than a custom field.&lt;/li&gt;&#xA;&lt;li&gt;The method described above opens up a ton of avenues for Craft.&#xA;Since your Craft has an API now, the tech that drives the &quot;web tier&quot;&#xA;can change. It could be .NET app, Android app, or iPhone app. Just&#xA;think long and hard about exposing the Craft API via javascript. You&#xA;should probably have your javascript hit an endpoint on your web&#xA;tier that queries the app tier if you are really going for security.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="279" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-06-20T14:02:10.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="340" PostTypeId="1" AcceptedAnswerId="341" CreationDate="2014-06-20T15:27:38.543" Score="9" ViewCount="1491" Body="&lt;p&gt;Can I accept file uploads using the Craft Guest Entries plugin? Using input type=&quot;file&quot; doesn't seem to be working.&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="125" LastEditDate="2014-06-28T10:09:02.573" LastActivityDate="2014-06-28T10:09:02.573" Title="Can I accept file uploads using the Craft Guest Entries plugin?" Tags="&lt;assets&gt;&lt;form&gt;&lt;guest&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="341" PostTypeId="2" ParentId="340" CreationDate="2014-06-20T15:54:27.127" Score="9" Body="&lt;p&gt;I don't see why you couldn't. That is unless the plugin needs to handle file uploads as opposed to the Entry Model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot;&gt;Uploading Files from a Form&lt;/a&gt;. You need to make sure your form tag has &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; and your file input has the name &lt;code&gt;fields[fieldHandle]&lt;/code&gt;. If you are uploading multiple files, be sure to add and extra set of square braces on the end (&lt;code&gt;fields[fieldHandle][]&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-20T15:54:27.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="342" PostTypeId="1" AcceptedAnswerId="403" CreationDate="2014-06-20T16:20:01.083" Score="9" ViewCount="1040" Body="&lt;p&gt;It's not been asked as a broad question here yet, but we've all wondered: how does one go adding comments to a Craft site, such as those you'd find on a blog?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've either used or been aware of...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Tacking &lt;a href=&quot;https://disqus.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Disqus&lt;/a&gt; (JavaScript) comments onto pages. &lt;/li&gt;&#xA;&lt;li&gt;Integrating &lt;a href=&quot;https://craftcms.stackexchange.com/questions/53/how-do-i-implement-google-comments-on-a-craft-site&quot;&gt;Google+ comments&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Using a dedicated Craft Section for comments and relating each to a post, collecting submissions with &lt;a href=&quot;http://straightupcraft.com/craft-plugins/guest-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there others out there? Would an expert comment engineer care to answer authoritatively?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2019-05-17T18:14:45.517" Title="How are people adding public comments to their Craft sites?" Tags="&lt;comments&gt;&lt;guest&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="343" PostTypeId="5" CreationDate="2014-06-20T16:22:05.047" Score="0" Body="&lt;p&gt;Tagged questions can be either about &lt;strong&gt;plugin usage&lt;/strong&gt; or &lt;strong&gt;plugin development&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do I use X plugin?&lt;/li&gt;&#xA;&lt;li&gt;Do I need a plugin to accomplish X?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;It's preferred to use the &lt;a href=&quot;/questions/tagged/plugin-dev&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;plugin-dev&amp;#39;&quot; rel=&quot;tag&quot;&gt;plugin-dev&lt;/a&gt; tag when knowingly discussing the construction of a plugin.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's not always obvious that plugin construction will be necessary to accomplish a specific task. Or perhaps the intended goal can be accomplished by a plugin which already exists. In those cases, simply tagging with &lt;a href=&quot;/questions/tagged/plugin&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;plugin&amp;#39;&quot; rel=&quot;tag&quot;&gt;plugin&lt;/a&gt; is acceptable.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-24T13:09:35.727" LastActivityDate="2014-06-24T13:09:35.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="344" PostTypeId="4" CreationDate="2014-06-20T16:22:05.047" Score="0" Body="Questions about plugin availability or usage, as opposed to those that are development-centric." OwnerUserId="-1" LastEditorUserId="22" LastEditDate="2014-07-14T16:57:56.210" LastActivityDate="2014-07-14T16:57:56.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="345" PostTypeId="5" CreationDate="2014-06-20T16:28:19.080" Score="0" Body="&lt;p&gt;Tagged questions are about &lt;strong&gt;building a plugin&lt;/strong&gt;. This tag is useful for questions along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do I build X feature into a plugin?&lt;/li&gt;&#xA;&lt;li&gt;What's the difference between Models and Records?&lt;/li&gt;&#xA;&lt;li&gt;How can I trigger an Event in my plugin?&lt;/li&gt;&#xA;&lt;li&gt;... and so on.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-24T13:09:21.427" LastActivityDate="2014-06-24T13:09:21.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="346" PostTypeId="4" CreationDate="2014-06-20T16:28:19.080" Score="0" Body="Focus on the development side of Craft plugins." OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-24T13:09:12.433" LastActivityDate="2014-06-24T13:09:12.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="347" PostTypeId="1" AcceptedAnswerId="355" CreationDate="2014-06-20T17:11:41.440" Score="2" ViewCount="145" Body="&lt;p&gt;For example: Users. You can only have one fieldlayout per ElementType user which you customize in the settings section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got as far as abstracting out the fieldlayout to it's own view, but when I go to set the field layout in the controller I'm borrowing the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set the field layout&#xA;$fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayoutFromPost(false);&#xA;$fieldLayout-&amp;gt;type = ElementType::MyElementType;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To which I get the following (pretty much expected) error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Fatal error: Undefined class constant 'MyElementType' in /controllers/MyElementTypeController.php on line 115&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've looked at how the plugin example &quot;Events&quot; is handling this and Brandon seems to be setting the fieldlayout-&gt;type to Assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayoutFromPost();&#xA;$fieldLayout-&amp;gt;type = ElementType::Asset;&#xA;$calendar-&amp;gt;setFieldLayout($fieldLayout);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this how we're supposed to be setting these up? i.e., borrowing from other elementtypes?&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="45" LastEditDate="2014-06-20T17:17:03.770" LastActivityDate="2014-06-20T19:00:07.120" Title="How would I setup my plugin to use a unique fieldlayout that is unique to the top level of the plugin?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="348" PostTypeId="1" AcceptedAnswerId="368" CreationDate="2014-06-20T17:15:00.433" Score="3" ViewCount="926" Body="&lt;p&gt;Is there a way to get the rich text field to automatically convert straight quotes to curly (smart) quotes? I'm not seeing anything on the redactorjs site or in the docs. &lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2017-06-18T22:23:15.573" Title="Smart quotes in rich text fields?" Tags="&lt;richtext&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="349" PostTypeId="1" AcceptedAnswerId="357" CreationDate="2014-06-20T17:17:08.663" Score="4" ViewCount="975" Body="&lt;p&gt;I eventually figured out that I could use a code sniffer in Sublime Text, load up a &lt;a href=&quot;https://github.com/thomas-ernest/CodeIgniter-for-PHP_CodeSniffer&quot; rel=&quot;nofollow&quot;&gt;CodeIgniter rule set&lt;/a&gt; (not a Craft project, obviously), and see in real time where my formatting, spacing and naming conventions could be improved for consistency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an equivalent standard for Craft/Yii? I'd like to start forming good habits, and the Sublime Text part is a bonus but not required—I'm most interested in whatever standards there are to reference.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-09-21T17:12:17.490" Title="Are there coding standards I can follow when writing my Craft plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="350" PostTypeId="2" ParentId="349" CreationDate="2014-06-20T17:39:38.083" Score="1" Body="&lt;p&gt;I don't know about any Craft specific-guide, but there are is a guide and code-sniffer for Yii 1:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/yiisoft/yii/wiki/Core-framework-code-style&quot; rel=&quot;nofollow&quot;&gt;Core framework code style&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Ardem/yii-coding-standard&quot; rel=&quot;nofollow&quot;&gt;Yii Framework PHP CodeSniffer Coding Standard&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-20T17:39:38.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="351" PostTypeId="1" AcceptedAnswerId="352" CreationDate="2014-06-20T17:58:17.497" Score="18" ViewCount="10820" Body="&lt;p&gt;I'm running some checks to see if there is a user logged in, and if that user is someone specific. When accessing &lt;code&gt;user.isCurrent&lt;/code&gt; it's returning &lt;code&gt;1&lt;/code&gt; when I'm logged in, but returns &lt;code&gt;null&lt;/code&gt; when I'm not. Should this be returning &lt;code&gt;0&lt;/code&gt; or false in that case, or should I be checking &lt;code&gt;{% if user.isCurrent is defined %}&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="269" LastEditorUserId="45" LastEditDate="2014-06-20T18:14:53.520" LastActivityDate="2014-06-20T18:14:53.520" Title="How can I determine if a user is logged in, and who that user is?" Tags="&lt;templating&gt;&lt;users&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="352" PostTypeId="2" ParentId="351" CreationDate="2014-06-20T18:01:40.970" Score="28" Body="&lt;p&gt;To determine if the user is logged in at all, you'll want to use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#currentUser&quot;&gt;currentUser&lt;/a&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    Welcome, {{ currentUser.friendlyName }}!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To determine if the logged in user is a &lt;em&gt;specific&lt;/em&gt; user, then simply compare against their username:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.username is 'johndoe' %}&#xA;    Hey Johnny Boy!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isCurrent&quot;&gt;isCurrent&lt;/a&gt; method is useful when targeting a more generic &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot;&gt;UserModel&lt;/a&gt; (where you don't know if the user would be the current user).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for user in craft.users %}&#xA;    {% if user.isCurrent %}&#xA;        {{ user.friendlyName }} is you!&#xA;    {% else %}&#xA;        {{ user.friendlyName }} is someone else.&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-20T18:13:29.947" LastActivityDate="2014-06-20T18:13:29.947" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="353" PostTypeId="1" AcceptedAnswerId="372" CreationDate="2014-06-20T18:29:41.550" Score="9" ViewCount="2527" Body="&lt;p&gt;I'm trying to mimic the URL structure exactly how I have it in my old CMS. If I select an entry to have both a category and subcategory I would like to have the subcategory in the URL along with the category and the entry slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/cat1/subcat1/entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Right now I have the Entry URL Format set to be &lt;code&gt;{category.first().slug}/{slug}&lt;/code&gt;, but that only shows the first category. How do I access that optional &lt;code&gt;subcat1&lt;/code&gt; subcategory in that field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the following but it doesn't work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.first.slug }/{ category.first.children.first.slug ? category.first.children.first.slug ~ '/' : '' }{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category[0].slug}/{ category[1] ? category[1].slug ~ '/': ''}{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastEditorUserId="284" LastEditDate="2014-06-20T23:09:42.993" LastActivityDate="2018-02-27T14:46:47.437" Title="How do I add a subcategory to the URL slug for a channel entry?" Tags="&lt;categories&gt;&lt;url&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="354" PostTypeId="2" ParentId="349" CreationDate="2014-06-20T18:36:57.987" Score="1" Body="&lt;p&gt;Another option: Use &lt;a href=&quot;http://editorconfig.org/&quot; rel=&quot;nofollow&quot;&gt;http://editorconfig.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using Sublime Text, you can use &lt;a href=&quot;https://github.com/sindresorhus/editorconfig-sublime&quot; rel=&quot;nofollow&quot;&gt;https://github.com/sindresorhus/editorconfig-sublime&lt;/a&gt; to enforce those rules.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-20T18:36:57.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="355" PostTypeId="2" ParentId="347" CreationDate="2014-06-20T19:00:07.120" Score="4" Body="&lt;p&gt;You're bumping into this error because of a minor misunderstanding of how Pixel &amp;amp; Tonic are referencing their Element Types. The problem you have is with this line of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldLayout-&amp;gt;type = ElementType::MyElementType;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When P&amp;amp;T use that syntax, it's because they've already pre-defined all of their element types as enums. Open up the /app folder and take a look at this file to see what they've done:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft/app/enums/ElementType.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This allows them to use a syntax like &lt;code&gt;ElementType::Asset&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't have that option (unless you create your own enum). What you would do instead, simply use a normal string to specify your element type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldLayout-&amp;gt;type = 'MyPlugin_MyElementType';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the same string that you wrote when you defined the Model for your Element Type. It should be one of the first lines of code within your Model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $elementType = 'MyPlugin_MyElementType';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting up enums is a different topic, but just go ahead and use the string and it should resolve that error for you!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-20T19:00:07.120" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="356" PostTypeId="1" AcceptedAnswerId="360" CreationDate="2014-06-20T20:19:19.653" Score="13" ViewCount="9321" Body="&lt;pre&gt;&lt;code&gt;{% if var is defined %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if var is not null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a difference in usage of them?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="45" LastEditDate="2014-06-21T06:06:08.277" LastActivityDate="2014-06-21T06:08:07.933" Title="What's the difference between &quot;is defined&quot; and &quot;is not null&quot;?" Tags="&lt;templating&gt;&lt;null&gt;&lt;defined&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="357" PostTypeId="2" ParentId="349" CreationDate="2014-06-20T20:25:48.643" Score="6" Body="&lt;p&gt;I would strongly suggest that you follow PSR-2 since that is what most of the craft source code adheres to and it is a pretty good standard for general PHP development. Just be aware that craft itself won't pass PSR-2 linting because there are places where it deviates from the standard, two of which are namespacing (craft has a global namespace) and indentation (tabs over spaces) but that is totally fine in my opinion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing clean, readable, intuitive, and testable code should be the end goal of any developer and if that means you have to violate a standards rule here or there, go for it: )&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-06-20T20:25:48.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="358" PostTypeId="5" CreationDate="2014-06-20T20:28:03.377" Score="0" Body="&lt;p&gt;Twig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and developed by Fabien Potencier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft documentation has a brief overview of Twig on the &lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer&quot; rel=&quot;nofollow&quot;&gt;Twig Primer&lt;/a&gt; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information, examples and a list of features, are available on Twig's &lt;a href=&quot;http://twig.sensiolabs.org/documentation&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="50" LastEditDate="2014-06-28T08:13:12.073" LastActivityDate="2014-06-28T08:13:12.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="359" PostTypeId="4" CreationDate="2014-06-20T20:28:03.377" Score="0" Body="The templating language powering all of Craft's templates." OwnerUserId="250" LastEditorUserId="57" LastEditDate="2014-07-11T22:25:00.300" LastActivityDate="2014-07-11T22:25:00.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="360" PostTypeId="2" ParentId="356" CreationDate="2014-06-20T20:31:32.077" Score="14" Body="&lt;p&gt;&lt;code&gt;is defined&lt;/code&gt; - The variable has been defined, and set to any value (or &lt;code&gt;null&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;is not null&lt;/code&gt; - The variable has been defined, and is specifically &lt;strong&gt;not&lt;/strong&gt; &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PHP terms, it's like the difference between &lt;code&gt;is_null()&lt;/code&gt; vs. checking whether the variable exists using &lt;code&gt;get_defined_vars()&lt;/code&gt; (see this &lt;a href=&quot;https://stackoverflow.com/questions/3803282/check-if-value-isset-and-null&quot;&gt;Stack Overflow thread&lt;/a&gt; for a little more clarity)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Try this experiment... Without setting &lt;code&gt;myVar&lt;/code&gt;, put this in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (myVar is defined) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since that equates to &lt;code&gt;false&lt;/code&gt;, nothing will appear in your template. Now change it to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (myVar is not null) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will actually throw an error, since &lt;code&gt;myVar&lt;/code&gt; was never defined.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-06-21T06:08:07.933" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="361" PostTypeId="2" ParentId="356" CreationDate="2014-06-20T20:38:55.260" Score="6" Body="&lt;p&gt;The first statement checks for the existence of &lt;code&gt;var&lt;/code&gt;, the second checks that it has a value other than &lt;code&gt;null&lt;/code&gt; and will throw and error if &lt;code&gt;var&lt;/code&gt; does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not sure whether a variable exists, you should check if it exists first then check for its value to be safe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could combine both statements like so &lt;code&gt;{% if var is defined and var is not null %}&lt;/code&gt; or use &lt;code&gt;empty, not empty&lt;/code&gt; if you're feeling fancy: )&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2014-06-21T02:49:51.407" LastActivityDate="2014-06-21T02:49:51.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="363" PostTypeId="2" ParentId="349" CreationDate="2014-06-20T22:01:32.583" Score="6" Body="&lt;p&gt;We plan on adding official &quot;Craft Plugin Code Guidelines&quot; recommendations once the plugin store is out of the gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, Selvin is correct.  We aren't 100% PSR-2 compliant, but it's easy enough to look in the craft/app folder and see what our coding style is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Yii 1.0 coding style is, IMO, quite awful, so I wouldn't recommend following that.  Yii 2.0, on the other hand is PSR-2 compliant and we'll re-address Craft's guidelines when we're ready to integration Yii 2.0 into Craft.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; We now have official &lt;a href=&quot;https://github.com/pixelandtonic/CodingStandards&quot; rel=&quot;nofollow&quot;&gt;&quot;P&amp;amp;T Coding Standards&quot;&lt;/a&gt; which we recommend you to use, when writing Craft plugins.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="177" LastEditDate="2014-09-21T17:12:17.490" LastActivityDate="2014-09-21T17:12:17.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="364" PostTypeId="1" AcceptedAnswerId="367" CreationDate="2014-06-20T22:03:20.287" Score="3" ViewCount="484" Body="&lt;p&gt;I'm working on building a post-receive hook and a third party service's attempt to post data to a webhook keeps 302ing to the Craft login page when I attempt to use &lt;code&gt;EmailModel&lt;/code&gt; and &lt;code&gt;sendEmail()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing Craft logs during this failed transaction is a series of errors that read...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Someone tried to restore a session from a cookie without presenting an IP address or userAgent string.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I noticed the &lt;code&gt;requireUserAgentAndIpForSession&lt;/code&gt; setting in &lt;code&gt;UserSessionService-&amp;gt;_checkVitals()&lt;/code&gt;, disabled it, and of course the problem went away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer not to disable this setting in general—is there a way to programmatically unrequire it for a specific plugin receiving posts?&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-06-20T22:17:57.260" Title="Is it possible to disable `requireUserAgentAndIpForSession` for specific instances?" Tags="&lt;plugin-development&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="365" PostTypeId="2" ParentId="348" CreationDate="2014-06-20T22:05:20.507" Score="1" Body="&lt;p&gt;Not natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your options would be to either write a redactor plugin that converts them on the fly or a Craft plugin that either converts them to curly quotes on save before saving them in the database or leaves them as straight in the database and converts them to curly quotes on display.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-20T22:05:20.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="366" PostTypeId="2" ParentId="314" CreationDate="2014-06-20T22:14:13.020" Score="2" Body="&lt;p&gt;We've discussed the ability to have an &quot;audit trail&quot; of actions for a given user in Craft, so you can see exactly who did what, where and when, but given that it's a relatively minor use-case and would have a potential performance impact, it would either be a config setting turned off by default or a first or third-party plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-20T22:14:13.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="367" PostTypeId="2" ParentId="364" CreationDate="2014-06-20T22:17:57.260" Score="1" Body="&lt;p&gt;Currently, no... it's an all or nothing thing and you'll have to disable it globally.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-20T22:17:57.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="368" PostTypeId="2" ParentId="348" CreationDate="2014-06-20T22:41:32.770" Score="6" Body="&lt;p&gt;It turns out &lt;a href=&quot;https://github.com/experience/smartdown.craft-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smartdown&lt;/a&gt; should do the trick. It's a Craft plugin that adds MarkdownExtra and SmartyPants (the latter of which matters here) support to Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://daringfireball.net/projects/smartypants/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SmartyPants&lt;/a&gt; is a rather ancient blogging plug-in from John Gruber for intelligently handling smart punctuation. Michel Fortin ran with it in the form of &lt;a href=&quot;https://michelf.ca/projects/php-smartypants/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP SmartyPants&lt;/a&gt;, and most recently this Craft plugin by Experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: my first answer linked to a SmartyPants Craft filter by Experience that's apparently not finished. That one won't get you very far. :)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="273" LastEditDate="2017-05-17T10:23:47.610" LastActivityDate="2017-05-17T10:23:47.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="369" PostTypeId="1" AcceptedAnswerId="371" CreationDate="2014-06-21T03:47:39.900" Score="6" ViewCount="190" Body="&lt;p&gt;I'm creating a tumblr-esque blog with a bunch of different entry types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the entry types will be named &quot;Image&quot;. When I'm on the entry page for an &quot;Image&quot; entry, I'd like to be able to show 10 more entries with the same &quot;Image&quot; entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="381" LastEditorUserId="4215" LastEditDate="2016-06-29T12:45:01.817" LastActivityDate="2016-06-29T12:45:01.817" Title="Is it possible to show more entries of the same entry type as the current entry?" Tags="&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="370" PostTypeId="2" ParentId="369" CreationDate="2014-06-21T04:52:40.680" Score="5" Body="&lt;p&gt;Yes. This is certainly possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how you're templating / naming is setup but you can get entries by entry type and you can check an entry's type. To get entries by a specific type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.section('blog').find({type: 'imagePost', limit: 10})&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some helpful references for craft.entries:&#xA;&lt;a href=&quot;http://straightupcraft.com/articles/cheat-sheet-craft.entries&quot;&gt;Entries Cheat Sheet&lt;/a&gt; - &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;Craft Docs For the Entry Model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could structure some kind of comparison, to see if the current entry is a specific type, and if it is query and render the desired additional entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'imagePost' %}&#xA;  {% for post in craft.entries.section('blog').find({type: 'imagePost'}) %}&#xA;...&#xA;{% if entry.type == 'textPost' %}&#xA;  {% for post in craft.entries.section('blog').find({type: 'textPost'}) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However there are many ways to do what you want depending on your setup. Please note I used the name imagePost instead of image, to avoid any confusion there might be with a common name like image. I'm not sure if that could cause name conflicts or if it's a reserved keyword / field etc.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2014-06-21T04:52:40.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="371" PostTypeId="2" ParentId="369" CreationDate="2014-06-21T05:07:43.083" Score="5" Body="&lt;p&gt;You can get the entry’s current type handle via &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#type&quot;&gt;&lt;code&gt;entry.type&lt;/code&gt;&lt;/a&gt;, and craft.entries supports a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#type&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/a&gt; param for finding entries of a given type, so you can plug those two together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherEntries = craft.entries.section('blog').type(entry.type) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-21T05:07:43.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="372" PostTypeId="2" ParentId="353" CreationDate="2014-06-21T05:10:43.110" Score="18" Body="&lt;p&gt;If you go into your Category Group’s settings and set the following settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Top Level URL Format: &lt;code&gt;{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Nested URL Format: &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Craft 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category URI Format: &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;then you would be able to set your section’s Entry URL Format to this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{myCategoryField.last.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 3&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{myCategoryField.inReverse().one().uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-02-27T14:46:47.437" LastActivityDate="2018-02-27T14:46:47.437" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="373" PostTypeId="1" AcceptedAnswerId="375" CreationDate="2014-06-21T07:30:34.317" Score="8" ViewCount="3708" Body="&lt;p&gt;Is it possible for a user group to be notified by email when a post is submitted using either the backend or a form on the front end?&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2015-09-17T03:00:27.230" Title="Email Notification When Post Submitted" Tags="&lt;form&gt;&lt;emails&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="374" PostTypeId="1" AcceptedAnswerId="384" CreationDate="2014-06-21T07:47:28.053" Score="23" ViewCount="1697" Body="&lt;p&gt;I'm working on a plugin, and it requires a modal to be displayed when the user interacts with a field of my Field Type. When the user finishes interacting with the modal, they would click &quot;Done&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the standard modal that displays when you select Assets...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QZVA9.png&quot; alt=&quot;Assets Modal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I basically want a more generic version of this modal, where I can put anything I want into the middle of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I would love to have something like this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KehTf.png&quot; alt=&quot;Blank Modal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's the best way to pull that off?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="9" LastEditDate="2014-08-13T14:03:09.047" LastActivityDate="2019-12-06T20:26:50.313" Title="How can my plugin generate a generic modal window in the Control Panel?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;fieldtypes&gt;&lt;modal&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="375" PostTypeId="2" ParentId="373" CreationDate="2014-06-21T11:07:12.487" Score="7" Body="&lt;p&gt;Currently there isn't a native way to do this, but you could &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;noreferrer&quot;&gt;write a plugin&lt;/a&gt; which would work like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Wait for an &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;noreferrer&quot;&gt;event&lt;/a&gt; like: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#content-onSaveContent&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;content.onSaveContent&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entries.onSaveEntry&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get all users from a specific usergroup using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/emailservice&quot; rel=&quot;noreferrer&quot;&gt;EmailService&lt;/a&gt; to send a mail to each of them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quick-and-Dirty:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    //Event: onSaveEntry&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;&#xA;        //Get all users from UserGroup&#xA;        $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;        $user_criteria-&amp;gt;groupId = '1';&#xA;        $users = $user_criteria-&amp;gt;find();&#xA;&#xA;        //Send to each User&#xA;        foreach ($users as $user) {&#xA;            //Send Mail&#xA;            $email = new EmailModel();&#xA;            $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;            $email-&amp;gt;subject = 'Heyyyyy';&#xA;            $email-&amp;gt;body    = 'How you doin?';&#xA;&#xA;            craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-16T11:43:39.460" LastActivityDate="2014-07-16T11:43:39.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="376" PostTypeId="1" AcceptedAnswerId="379" CreationDate="2014-06-21T11:19:54.687" Score="1" ViewCount="495" Body="&lt;p&gt;I'm trying to edit the Contact Form plugin to copy the email to another address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking in apps/models/EmailModel.php I see this for CC:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'cc' =&amp;gt; array(AttributeType::Mixed);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking in apps/services/EmailService.php I see this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Add any CC's&#xA;if (!empty($emailModel-&amp;gt;cc))&#xA;{&#xA;    foreach ($emailModel-&amp;gt;cc as $cc)&#xA;    {&#xA;        if (!empty($cc['email']))&#xA;        {&#xA;            $ccEmail = $cc['email'];&#xA;&#xA;            $ccName = !empty($cc['name']) ? $cc['name'] : '';&#xA;            $email-&amp;gt;addCC($ccEmail, $ccName);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, it looks like 'cc' needs to be array? I tried it without it being an array and I get an invalid foreach error. At the moment, I've added this line to ContactFormService.php (after line 45):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$email-&amp;gt;cc = array('email' =&amp;gt; 'name@domain.com');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$email-&amp;gt;cc = array('email' =&amp;gt; 'name@domain.com', 'name' =&amp;gt; 'My Name');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem: The email is not being CC'd and I'm not getting any errors. Anyone?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="177" LastEditDate="2014-06-23T15:04:04.227" LastActivityDate="2014-06-23T15:04:04.227" Title="Adding CC to contact form plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="377" PostTypeId="2" ParentId="336" CreationDate="2014-06-21T12:10:09.273" Score="5" Body="&lt;p&gt;Update the database: author_id column in the craft_entries table.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-06-21T13:12:05.753" LastActivityDate="2014-06-21T13:12:05.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="378" PostTypeId="1" AcceptedAnswerId="380" CreationDate="2014-06-21T12:42:42.587" Score="4" ViewCount="850" Body="&lt;p&gt;I'm wondering if it's possible to dynamically filter a section list by entry type based on a url segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping to avoid assigning a category to every entry.&lt;/p&gt;&#xA;" OwnerUserId="381" LastActivityDate="2014-06-24T14:39:43.793" Title="Is it possible to Filter entry types via the URL?" Tags="&lt;entry-type&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="379" PostTypeId="2" ParentId="376" CreationDate="2014-06-21T13:15:20.707" Score="5" Body="&lt;p&gt;From that code snippet, it looks like you're needing nested arrays. Try setting your &lt;code&gt;$email-&amp;gt;cc&lt;/code&gt; property like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;cc = array(&#xA;    array('name' =&amp;gt; 'Your Name', 'email' =&amp;gt; 'name@example.com')&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code snippet is iterating over &lt;code&gt;$email-&amp;gt;cc as $cc&lt;/code&gt; as the first array, then going into &lt;code&gt;cc['name']&lt;/code&gt; and &lt;code&gt;cc['email']&lt;/code&gt; as a nested array.&lt;/p&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-06-21T13:15:20.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="380" PostTypeId="2" ParentId="378" CreationDate="2014-06-21T13:57:36.043" Score="3" Body="&lt;p&gt;Yes, it is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pass the entry type handle to a segment and access that segment using the &lt;code&gt;craft.request&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getSegment&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getSegment()&lt;/code&gt;&lt;/a&gt; method. Use this segment variable with the &lt;code&gt;craft.entries&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#type&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;.type()&lt;/code&gt;&lt;/a&gt; method to fetch only the entries of the given type. The example below assumes your entry type handle is in segment 2.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('pages').type(craft.request.getSegment(2)) %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2014-06-24T14:39:43.793" LastActivityDate="2014-06-24T14:39:43.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="381" PostTypeId="2" ParentId="373" CreationDate="2014-06-21T14:06:08.590" Score="4" Body="&lt;p&gt;Alternatively, you could get in touch with Ben Parizek of Barrel Strength Design who has a plugin called &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot;&gt;Sprout Email&lt;/a&gt;. Currently in beta but you can request a preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using it as we speak.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-06-21T14:06:08.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="382" PostTypeId="1" AcceptedAnswerId="383" CreationDate="2014-06-21T14:28:13.063" Score="5" ViewCount="147" Body="&lt;p&gt;I'm wondering how I would replicate the ExpressionEngine &lt;a href=&quot;http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#date-heading&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date_heading&lt;/code&gt;&lt;/a&gt; tag pair in Craft?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{date_heading}  {entry_date format=&quot;%Y %m %d&quot;}  {/date_heading}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The date heading can be used to show a heading at certain intervals.&#xA;  The interval can be set to show hourly, daily, weekly, monthly, or&#xA;  yearly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="381" LastEditorUserId="43" LastEditDate="2014-06-21T15:34:48.413" LastActivityDate="2017-02-22T23:42:44.053" Title="How do you replicate the EE {date_heading} tag pair in Craft?" Tags="&lt;date&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="383" PostTypeId="2" ParentId="382" CreationDate="2014-06-21T14:59:11.090" Score="7" Body="&lt;p&gt;&lt;strong&gt;Group:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at Craft's custom &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;group filter&lt;/a&gt;. Your example could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog').find() %}&#xA;{% set allEntriesByDay = allEntries | group('postDate') %}&#xA;&#xA;{% for day, entriesInDay in allEntriesByDay %}&#xA;    &amp;lt;h1&amp;gt;{{ day }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% for entry in entriesInDay %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conditionals:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also save the last entries date and use conditionals:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog') %}&#xA;{% set last_date = '' %}&#xA;&#xA;{% for entry in allEntries %}&#xA;    {% if last_date &amp;lt; entry.date %}&#xA;        This entry is the first of a new day&#xA;    {% endif %}&#xA;&#xA;    {% set last_date = entry.date %}&#xA;&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-23T14:58:35.450" LastActivityDate="2014-06-23T14:58:35.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="384" PostTypeId="2" ParentId="374" CreationDate="2014-06-21T16:09:41.480" Score="19" Body="&lt;p&gt;Create a div with whatever contents you want in the modal, and with a class &quot;modal&quot;. Then create a new &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/lib/garnishjs/garnish.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;Garnish.Modal&lt;/a&gt; object with it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var $div = $('&amp;lt;div class=&quot;modal&quot;&amp;gt;...&amp;lt;/div&amp;gt;');&#xA;var myModal = new Garnish.Modal($div);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="10322" LastEditDate="2019-12-06T20:26:50.313" LastActivityDate="2019-12-06T20:26:50.313" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="385" PostTypeId="1" CreationDate="2014-06-21T16:58:31.287" Score="6" ViewCount="1342" Body="&lt;p&gt;We recently launched our first site with front end user registration and we are getting a lot (not a ton, like 5 a day) spam registrations. See here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Icj1.png&quot; alt=&quot;Spam accounts&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to find a way to cut down on these without doing something like a captcha but maybe thats my only option?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-06-21T17:08:23.423" Title="How can I prevent &quot;spam&quot; user registrations?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="386" PostTypeId="2" ParentId="385" CreationDate="2014-06-21T17:08:23.423" Score="4" Body="&lt;p&gt;&lt;strong&gt;Plugins:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.putyourlightson.net/craft-cms-plugins&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Snaptcha&lt;/strong&gt;&lt;/a&gt; (private beta)&lt;br&gt;&#xA;Works with the User Registration Form, Contact Form Plugin and Sprout Forms Plugin&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/invisible-captcha&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Invisible Captcha&lt;/strong&gt;&lt;/a&gt; (private beta)  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Config:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't mind having a few spam-users in your list. Just add &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#purgePendingUsersDuration&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;purgePendingUsersDuration&lt;/code&gt;&lt;/a&gt; to your config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will purge all users which haven't been activated for x time.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-21T17:08:23.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="388" PostTypeId="1" AcceptedAnswerId="393" CreationDate="2014-06-21T20:04:07.600" Score="9" ViewCount="747" Body="&lt;p&gt;I'm trying to add a &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot;&gt;redactor richtext field&lt;/a&gt; to one of my plugin templates in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found macros for every field in &lt;code&gt;craft/app/templates/_includes/forms&lt;/code&gt;, but a richtext macro is missing. I assume that I have to use a normal textarea-field and add some code to the controller or &lt;code&gt;init()&lt;/code&gt;-function, but couldn't find anything by inspecting Craft's CP code.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-21T23:24:31.100" Title="How can I add a RichText-Field to my plugin's CP-section?" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="389" PostTypeId="1" CreationDate="2014-06-21T20:07:06.613" Score="4" ViewCount="699" Body="&lt;p&gt;Craft makes it nice and easy for us to have hierarchy in Structures or Categories. Many other popular CMS platforms support hierarchical data as well but some support it using a different data model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an overview of managing hierarchical data in MySQL if anyone's interested:&#xA;&lt;a href=&quot;http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql&quot; rel=&quot;nofollow&quot;&gt;http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I'm trying to understand the best way to migrate data that uses the Adjacency List Model into Craft which uses the Nested Set model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any tools to help translate how each item in the table of the adjacency list model refers to a parent to how the nested set model uses lft and rgt to identify how the items in the table are nested?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there aren't any tools for this, is there any step-by-step process that might make this a bit more accessible?  Or could I just be thinking about it the wrong way?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-06-21T22:52:52.740" LastActivityDate="2021-01-19T20:45:17.450" Title="How do you import hierarchical data that uses the adjacency list model into Craft Structures or Categories?" Tags="&lt;categories&gt;&lt;structure&gt;&lt;migration&gt;&lt;import&gt;&lt;nested-set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="390" PostTypeId="1" AcceptedAnswerId="392" CreationDate="2014-06-21T20:40:45.533" Score="11" ViewCount="4773" Body="&lt;p&gt;I'd like to make my 404 page editable through Craft, but when I create a single for it, a URI is required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make a single with no URI, or is the best route to setup globals for managing this content? Or is there a better way that I don't know about?&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2018-07-25T19:10:09.183" Title="What's the best way to set up a content-manageable 404 page?" Tags="&lt;singles&gt;&lt;404-page&gt;&lt;error-templates&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="391" PostTypeId="2" ParentId="390" CreationDate="2014-06-21T21:11:08.490" Score="2" Body="&lt;p&gt;&lt;strong&gt;404 redirect:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set up your single to use &lt;code&gt;404-not-found&lt;/code&gt; (example) as a uri, and add a redirect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect '/404-not-found' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the &lt;code&gt;/404.html&lt;/code&gt; file. That way every 404-page gets redirected to the single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Downside:&lt;/em&gt; You will loose the 404-header, and the uri in the address-bar will be lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Load Single:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up a single, and load the single entry into the &lt;code&gt;/404.html&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.section('404-single-handle').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can use the entry-var just like you would in a normal single template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have to use a single-uri, but you could add a conditional to the single template (not the 404.html), which redirects to index if it gets accessed directly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect '/' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I didn't know a single can be set to 404 without breaking the functionality, so Brandon's answer is the way to go ;)&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-21T21:24:37.003" LastActivityDate="2014-06-21T21:24:37.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="392" PostTypeId="2" ParentId="390" CreationDate="2014-06-21T21:23:01.513" Score="18" Body="&lt;p&gt;I would create a Single with the URI set to &quot;404&quot;, and also set its Template to &quot;404&quot;. That entry will automatically get loaded if you go to &lt;a href=&quot;http://example.com/404&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/404&lt;/a&gt;, and load your 404.html template, so at the top of the template you should add this to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; #  Fetch the 404 Single entry, if we don’t already have it.&#xA; #  (requests to /404 will already have it.)&#xA; #}&#xA;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.uri('404').first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3 note:&lt;/strong&gt; As of Craft 3 the 404.html template is only loaded if &lt;code&gt;devMode&lt;/code&gt; is &lt;em&gt;disabled&lt;/em&gt; in the current environment. If &lt;code&gt;devMode&lt;/code&gt; is &lt;em&gt;enabled&lt;/em&gt;, you'll continue get a Yii error message.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="50" LastEditDate="2018-07-25T18:32:54.323" LastActivityDate="2018-07-25T18:32:54.323" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="393" PostTypeId="2" ParentId="388" CreationDate="2014-06-21T23:24:31.100" Score="13" Body="&lt;p&gt;To do this you'll need to take a few steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Load the necessary resources which include the redactor.css and redactor.js file.  And if you are using Craft's macros for your fields, the form macro file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssResource &quot;lib/redactor/redactor.css&quot; %}&#xA;{% includeJsResource &quot;lib/redactor/redactor.js&quot; %}&#xA;&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a class to your field that you will use to initialize your Redactor toolbar.  Here's a simplified textarea macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textareaField({&#xA;    class: 'myFieldsRedactorClass',&#xA;    name: name,&#xA;    value: (value is defined) ? value : ''&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize the redactor field type with your desired toolbar.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function() {&#xA;    $('.myFieldsRedactorClass').redactor({&#xA;        buttons: ['bold', 'italic'] &#xA;    });&#xA;})();&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's a related article on customizing Redactor toolbars from Straight Up Craft:&#xA;&lt;a href=&quot;http://straightupcraft.com/articles/custom-redactor-toolbars-for-the-rich-text-field-in-craft-cms&quot;&gt;Custom Redactor Toolbars for the Rich Text Field in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &#xA;One thing to be mindful of, which I'm not sure what to say about, is that if you have other Rich Text fields in your section with you custom field type, Craft is probably already loading these resources. I don't know if there is some way to check to see if these are loaded and only load the redactor css and js assets if they are not being loaded elsewhere.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-21T23:24:31.100" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="394" PostTypeId="1" CreationDate="2014-06-22T06:02:30.807" Score="4" ViewCount="1986" Body="&lt;p&gt;How do I list all categories in use alphabetically? And how to get the total post count from each category? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers﻿&lt;/p&gt;&#xA;" OwnerUserId="385" LastActivityDate="2014-06-22T19:12:06.483" Title="Listing categories alphabetically &amp; total post count" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="395" PostTypeId="2" ParentId="394" CreationDate="2014-06-22T07:49:47.320" Score="9" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; param will do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.limit(null) %}&#xA;{% for category in craft.categories.relatedTo(entries).order('title asc') %}&#xA;    {% set entryCount = entries.relatedTo(category).total() %}&#xA;    {{ category }} ({{ entryCount }})&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-06-22T19:12:06.483" LastActivityDate="2014-06-22T19:12:06.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="396" PostTypeId="2" ParentId="389" CreationDate="2014-06-22T08:18:37.367" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/archive/blogs/mvpawardprogram/hierarchies-convert-adjacency-list-to-nested-sets&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; looks like a good high-level description of how to go about it.&lt;/p&gt;&#xA;&lt;p&gt;Also possibly useful: &lt;a href=&quot;https://stackoverflow.com/questions/4664517/how-do-you-convert-a-parent-child-adjacency-table-to-a-nested-set-using-php-an&quot;&gt;How do you convert a parent-child (adjacency) table to a nested set using PHP and MySQL?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="6007" LastEditDate="2021-01-19T20:45:17.450" LastActivityDate="2021-01-19T20:45:17.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="397" PostTypeId="1" AcceptedAnswerId="398" CreationDate="2014-06-22T09:28:47.650" Score="5" ViewCount="857" Body="&lt;p&gt;Is there a way to set the Dashboard up globally for a specific user group and lock it so that it can't be edited?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-07-13T17:16:52.633" LastActivityDate="2015-03-19T16:44:24.633" Title="Set Up A Global Dashboard For A Specific User Group" Tags="&lt;users&gt;&lt;dashboard-widgets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="398" PostTypeId="2" ParentId="397" CreationDate="2014-06-22T10:12:16.147" Score="8" Body="&lt;p&gt;The dashboard widgets are currently set on a per user basis. Brandon has said on the Google+ community that a site-wide and/or user group solution is planned but doesn't have en ETA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/106689452282751248337/posts/CvZZa5DDGwb&quot;&gt;https://plus.google.com/106689452282751248337/posts/CvZZa5DDGwb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/103717873128586100650/posts/gW9buKqF4LA&quot;&gt;https://plus.google.com/103717873128586100650/posts/gW9buKqF4LA&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-06-22T10:12:16.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="399" PostTypeId="1" AcceptedAnswerId="402" CreationDate="2014-06-22T15:29:42.080" Score="1" ViewCount="694" Body="&lt;p&gt;Having already defined foo, I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in availability.{{ foo }} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Expected name or number&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone please tell me the right way to go about this.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="250" LastEditDate="2014-07-08T22:05:47.617" LastActivityDate="2014-07-08T22:05:47.617" Title="Is it possible to call a variable within a tag pair?" Tags="&lt;tags&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="400" PostTypeId="2" ParentId="399" CreationDate="2014-06-22T16:48:58.390" Score="1" Body="&lt;p&gt;Twig isn't like ExpressionEngine, there is no &quot;parse order&quot; to contend with. In Twig, you &lt;strong&gt;cannot nest tags within other tags&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that line of code should look more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in availability.foo %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... or even this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in availability['foo'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond that, it's difficult to tell what you are intending with your code. If this doesn't solve your problem, please expand your question with more information and we can give you a better solution.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-22T16:48:58.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="401" PostTypeId="2" ParentId="399" CreationDate="2014-06-22T16:49:26.693" Score="5" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in availability[foo] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The square brackets let you access a variable variable name on an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a general rule you never put &lt;code&gt;{{ }}&lt;/code&gt; inside of &lt;code&gt;{% %}&lt;/code&gt; tags in twig.&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="250" LastEditDate="2014-06-22T22:27:36.020" LastActivityDate="2014-06-22T22:27:36.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="402" PostTypeId="2" ParentId="399" CreationDate="2014-06-22T17:03:09.430" Score="1" Body="&lt;p&gt;Many thanks for your answers and apologies for the poor example in my question. Before your answers came in I continued researching and found the twig attribute function (&lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/functions/attribute.html&lt;/a&gt;). So I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for availability in craft.entries.section('availability2014').limit(52).find( {order: 'availabilityWeekBeginning asc'} ) %}&#xA;  {% set foo = attribute (availability, ['availability', craft.request.getSegment(2)|replace('-lake','')|capitalize]|join) %}&#xA;&#xA;  {% for block in foo %}&#xA;      //Loop&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="122" LastEditorUserId="177" LastEditDate="2014-06-22T17:06:59.323" LastActivityDate="2014-06-22T17:06:59.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="403" PostTypeId="2" ParentId="342" CreationDate="2014-06-22T18:29:13.743" Score="3" Body="&lt;p&gt;What you describe above is essentially your options. If you use built in sections for comments, you can probably make them more secure from spam by using &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;Dukt's OAuth&lt;/a&gt; plugin to require a log in from a more reputable site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other third-party options include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://intensedebate.com/&quot; rel=&quot;nofollow&quot;&gt;Intense Debate&lt;/a&gt; (from the makers of WordPress)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://web.livefyre.com/comments/&quot; rel=&quot;nofollow&quot;&gt;LiveFyre Comments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://developers.facebook.com/docs/plugins/comments/&quot; rel=&quot;nofollow&quot;&gt;Facebook Comments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-22T18:29:13.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="404" PostTypeId="2" ParentId="309" CreationDate="2014-06-22T19:01:12.880" Score="2" Body="&lt;p&gt;I do not believe that this is a feasible feature request. Cache Invalidation isn't checked until Twig checks for it when it encounters the cache tag. If the content being cached is rarely updated, you can instead set the cache expiration date to something far off. Maybe something like &lt;code&gt;{% cache for 3 years %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-22T19:01:12.880" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="405" PostTypeId="1" AcceptedAnswerId="407" CreationDate="2014-06-22T19:03:45.870" Score="5" ViewCount="455" Body="&lt;p&gt;I have a plugin that I am writing and I want to make available a macro that can be used within the front end sites templates. What is the best way to do that?&lt;/p&gt;&#xA;" OwnerUserId="317" LastActivityDate="2014-06-23T02:02:59.277" Title="How can I create a template macro within my plugin for use within front end templates?" Tags="&lt;templating&gt;&lt;plugin-development&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="406" PostTypeId="1" AcceptedAnswerId="684" CreationDate="2014-06-22T19:48:14.460" Score="5" ViewCount="1564" Body="&lt;p&gt;After publishing some entries, I've changed the section setting &quot;Entry URL Format&quot; from news/{slug} to news/{id} but I had to re-save every entry to reflect the change.&#xA;Is there a better and fast way to update all entries URIs after changing the entry URL format?&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2017-12-07T20:25:40.940" Title="Updating all entries URIs after changing entry URL format" Tags="&lt;url&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="407" PostTypeId="2" ParentId="405" CreationDate="2014-06-22T21:04:53.050" Score="4" Body="&lt;p&gt;I'm not aware of this being possible. The control panel uses a different template path than the front end. This makes plugin templates generally inaccessible. One possible option is to create a template variable that runs a macro or renders a template on behalf of the user. Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.pluginHandle.macro(arguments) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to make sure that the template path is set to the Control Panel so that your macro can be found, and that it's set back afterwards. At the start of the function set this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getCpTemplatesPath())&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then when you are done rendering your macro (preferably to a variable to return later), you set it back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath())&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditDate="2014-06-23T02:02:59.277" LastActivityDate="2014-06-23T02:02:59.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="408" PostTypeId="1" AcceptedAnswerId="409" CreationDate="2014-06-22T21:51:39.310" Score="10" ViewCount="2339" Body="&lt;p&gt;We're currently using a single ExpressionEngine install with MultiSite Manager to serve up 11 total sites that share the same database. After investigating Craft, and asking &lt;a href=&quot;https://twitter.com/craftcms/status/415220999018135552&quot;&gt;questions via Twitter&lt;/a&gt; it appears that multisite may not be supported.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use a single Craft install to serve up completely separate sites, or any knowledge of this being implemented in the future?&lt;/p&gt;&#xA;" OwnerUserId="322" LastActivityDate="2016-04-08T12:26:58.670" Title="Are there any intentions to release multisite support for Craft?" Tags="&lt;config&gt;&lt;plugins&gt;&lt;server&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="409" PostTypeId="2" ParentId="408" CreationDate="2014-06-22T22:08:22.177" Score="7" Body="&lt;p&gt;&lt;strong&gt;Currently multi-site support isn't planned.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want simple multi-site-support you could use the localization feature with a custom locale. But with Craft's auto-update's and easy deployment, why would you want to use MSM anyway?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...we're pretty against adding it to Craft... at least in the way EE did&#xA;  it, where everything is stored on a per-site basis.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;However you should take a look at Craft's localization features. With&#xA;  that, all content can be stored on a per-locale basis, all users can&#xA;  have per-locale permissions, each locale can have its own base URL,&#xA;  templates, routes, etc.. Really is pretty powerful. The only thing&#xA;  missing is the ability to define custom locales, in the event that&#xA;  your localized sites aren't defined by territory/language, but some&#xA;  other factor. That's the main thing that's going to be changing ;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/105300374023226628031/posts/CS2uUefs6Ah&quot;&gt;https://plus.google.com/105300374023226628031/posts/CS2uUefs6Ah&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Correct. Initially it did have an MSM-type feature, but we ended up&#xA;  taking it out, due to it overcomplicating the system.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you want to run multiple domains/sites off of Craft, you’ll just&#xA;  need multiple Craft installs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/102316327373347344486/posts/71qEZ4SANhP&quot;&gt;https://plus.google.com/102316327373347344486/posts/71qEZ4SANhP&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can however use one &lt;code&gt;craft/app/&lt;/code&gt; folder for multiple sites. But since you'd still need multiple databases, configs, plugins, templates... it's probably not worth it, except that you would save a few bytes on files.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-22T23:35:22.013" LastActivityDate="2014-06-22T23:35:22.013" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="410" PostTypeId="1" AcceptedAnswerId="417" CreationDate="2014-06-23T07:36:29.127" Score="2" ViewCount="476" Body="&lt;p&gt;I'm trying to listen for an event when users create new accounts. I have the following code in my init() function in my main plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('users.activateUser', function(Event $event) {&#xA;    error_log(&quot;user activated&quot;);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn't firing when new users register on the site and I'm wondering if this has to do with the &quot;Verify email addresses?&quot; users setting. I'm not requiring users to verify their email addresses. Does that setting have to be checked in order to trigger that event? If so, is there a different event to listen for?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="177" LastEditDate="2014-06-24T17:42:16.403" LastActivityDate="2014-06-24T17:42:16.403" Title="Does &quot;verify email addresses?&quot; have to be enabled in order to fire the users.onActivateUser event?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="411" PostTypeId="1" AcceptedAnswerId="413" CreationDate="2014-06-23T13:21:45.090" Score="6" ViewCount="1951" Body="&lt;p&gt;I have the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;{% for date in entry.d_date %}&#xA;    {% if date.showMonth == 1 %}&#xA;    {{ date.date.month }}-&#xA;    {% endif %}&#xA;    {% if date.showDate == 1 %}&#xA;    {{ date.date.day }}-&#xA;    {% endif %}&#xA;    {{ date.date.year }}&#xA;{% endfor %}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which outputs 1- 1- 2014&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to get rid of the whitespace without touching the indentation? I've used &lt;code&gt;{spaceless}&lt;/code&gt; but it's not working.&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="125" LastEditDate="2014-06-23T22:20:22.893" LastActivityDate="2014-06-23T22:20:22.893" Title="How do I get rid of whitespace when rendering without touching template indentations?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;whitespace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="412" PostTypeId="1" AcceptedAnswerId="7046" CreationDate="2014-06-23T13:27:48.583" Score="7" ViewCount="615" Body="&lt;p&gt;Is there a way to show custom columns in the backend with entries listing views? Or can it be a feature in the future?&#xA;For example: show category as a column in the news overview in the backend&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="115" LastEditDate="2014-06-24T16:20:17.607" LastActivityDate="2015-02-08T19:16:45.313" Title="Can I extend entries listing views (currently or in the future)?" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="413" PostTypeId="2" ParentId="411" CreationDate="2014-06-23T13:49:24.427" Score="13" Body="&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#whitespace-control&quot;&gt;spaceless&lt;/a&gt; tag only removes whitespace between HTML tags. You have to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#whitespace-control&quot;&gt;whitespace control modifier&lt;/a&gt; on your tags to remove leading and or trailing whitespace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I'd use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot;&gt;ternary operator&lt;/a&gt; for your conditionals (and put the hyphen inside it):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for date in entry.d_date %}&#xA;    {{  date.showMonth == 1 ? date.date.month ~ '-' : '' -}}&#xA;    {{- date.showDate == 1 ? date.date.day ~ '-' : '' -}}&#xA;    {{- date.date.year }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-23T13:59:04.300" LastActivityDate="2014-06-23T13:59:04.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="414" PostTypeId="1" AcceptedAnswerId="415" CreationDate="2014-06-23T16:04:17.057" Score="2" ViewCount="679" Body="&lt;p&gt;I have two date fields in my entry and I want to return those entries with either a start date OR and end date within a calendar year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get those with a startDate within the calendar year using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextyear = year +1 %}&#xA;{% set yearbegins = '1 January ' ~ year %}&#xA;{% set yearends = '1 January' ~ nextyear %}&#xA;{% set unixbegins = yearbegins | date(&quot;U&quot;) %}&#xA;{% set unixends = yearends | date(&quot;U&quot;) %}&#xA;&#xA;{% set entries = craft.entries.section('events').limit(null).startDate('and', '&amp;gt;= ' ~ unixbegins, '&amp;lt; ' ~ unixends) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to I then run a test on endDate to further filter them down?&amp;nbsp;&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="125" LastEditDate="2014-06-24T16:19:53.653" LastActivityDate="2014-06-24T16:19:53.653" Title="Return entries with startDate or endDate within a calendar year" Tags="&lt;datetime&gt;&lt;date&gt;&lt;conditional&gt;&lt;logic&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="415" PostTypeId="2" ParentId="414" CreationDate="2014-06-23T16:35:05.410" Score="2" Body="&lt;p&gt;You could do two queries to get the Ids of the desired entries, &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge&lt;/a&gt; the Ids and then query the entries with these Ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get Ids of desired entries #}&#xA;{% set startDateIds = craft.entries.startDate('and', '&amp;gt;= ' ~ unixbegins, '&amp;lt; ' ~ unixends).ids() %}&#xA;{% set endDateIds = craft.entries.endDate('and', '&amp;gt;= ' ~ unixbegins, '&amp;lt; ' ~ unixends).ids() %}&#xA;&#xA;{# Merge queried Ids #}&#xA;{% set filteredIds = startDateIds|merge(endDateIds) %}&#xA;&#xA;{# Get entries with Id paramenter #}&#xA;{% set filteredEntries = craft.entries.id(filteredIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is to query all potential entries, loop those and filter within the loop. This is probably the way to go if you need to combine your conditionals with &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#logic&quot; rel=&quot;nofollow&quot;&gt;other logic&lt;/a&gt; then the &lt;code&gt;and&lt;/code&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all potential entries #}&#xA;{% set allEntries = craft.entries.section('events').limit(null).find() %}&#xA;&#xA;{# Define array before loop #}&#xA;{% set filteredEntries = {} %}&#xA;&#xA;{# Loop all entries #}&#xA;{% for key, entry in allEntries %}&#xA;&#xA;    {# Set conditionals to filter for desired entries #}&#xA;    {% if ( entry.startDate &amp;gt;= unixbegins and entry.startDate &amp;lt; unixends ) and ( entry.endDate &amp;gt;= unixbegins and entry.endDate &amp;lt; unixends ) %}&#xA;&#xA;        {# Merge entries #}&#xA;        {% set filteredEntries = filteredEntries|merge({ (key): entry }) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-24T11:00:07.983" LastActivityDate="2014-06-24T11:00:07.983" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="416" PostTypeId="1" CreationDate="2014-06-23T17:12:50.050" Score="4" ViewCount="1307" Body="&lt;p&gt;I'm writing a simple project-specific plugin that sends a notification to the site admin when a new user is registered. I have an HTML template that I'd like to use for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin's main class, I have the following function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;    {&#xA;        parent::init();&#xA;        // Events&#xA;        craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;            $user = $event-&amp;gt;params['user'];&#xA;            $isNewUser = $event-&amp;gt;params['isNewUser'];&#xA;&#xA;            if ($isNewUser)&#xA;            {&#xA;                // Send notification email&#xA;                craft()-&amp;gt;aeiMember-&amp;gt;registrationNotification($user);&#xA;            }&#xA;        });&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which calls a one of my plugin's services, 'registrationNotification'. Here's the code I have for that service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registrationNotification(UserModel $savedUser)&#xA;    {&#xA;        $user = new \stdClass();&#xA;&#xA;        $user-&amp;gt;firstName            = $savedUser-&amp;gt;firstName;&#xA;        $user-&amp;gt;lastName             = $savedUser-&amp;gt;lastName;&#xA;        $user-&amp;gt;email                = $savedUser-&amp;gt;email;&#xA;        $user-&amp;gt;aeiGroups            = $savedUser-&amp;gt;aeiGroups;&#xA;        $user-&amp;gt;phone                = $savedUser-&amp;gt;phone;&#xA;        $user-&amp;gt;mailingAddress       = $savedUser-&amp;gt;mailingAddress;&#xA;        $user-&amp;gt;city                 = $savedUser-&amp;gt;city;&#xA;        $user-&amp;gt;state                = $savedUser-&amp;gt;state;&#xA;        $user-&amp;gt;zip                  = $savedUser-&amp;gt;zip;&#xA;        $user-&amp;gt;country              = $savedUser-&amp;gt;country;&#xA;        $user-&amp;gt;preferredDealer      = $savedUser-&amp;gt;preferredDealer;&#xA;        $user-&amp;gt;dealerAccountNumber  = $savedUser-&amp;gt;dealerAccountNumber;&#xA;        $user-&amp;gt;school               = $savedUser-&amp;gt;school;&#xA;        $user-&amp;gt;expectedGraduationDate = $savedUser-&amp;gt;expectedGraduationDate;&#xA;&#xA;        $email = new EmailModel();&#xA;        $email-&amp;gt;toEmail = '...myemailaddress...';&#xA;        $email-&amp;gt;subject = 'New User Registration: ' . $user-&amp;gt;firstName . ' ' . $user-&amp;gt;lastName;&#xA;        $email-&amp;gt;htmlBody = craft()-&amp;gt;templates-&amp;gt;render('aeiMember/registration_notification', array(&#xA;            'user' =&amp;gt; $user,&#xA;        ));&#xA;&#xA;        // Send&#xA;        if (craft()-&amp;gt;email-&amp;gt;sendEmail($email))&#xA;        {&#xA;            return true;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I submit the registration form, I get the following error: &quot;CDbException: CDbTransaction is inactive and cannot perform commit or roll back operations.&quot;. I narrowed down the issue, and if I use a non-HTML email body, everything works fine, so apparently there's an issue with rendering a template at this event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a link to a Google Doc with the stack trace: &lt;a href=&quot;https://docs.google.com/document/d/1atFNkktuZQ91hU9QipXYMhOCHNGAavO5qUI_TF5jSeE/edit?usp=sharing&quot; rel=&quot;nofollow&quot;&gt;https://docs.google.com/document/d/1atFNkktuZQ91hU9QipXYMhOCHNGAavO5qUI_TF5jSeE/edit?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong, or is there a workaround to accomplish what I'm after? It seems like it should be pretty simple.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="250" LastEditDate="2014-07-08T22:05:28.583" LastActivityDate="2015-10-25T22:45:32.367" Title="Error when rendering a template (for HTML email) on users.saveUser" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;users&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="417" PostTypeId="2" ParentId="410" CreationDate="2014-06-24T00:45:58.010" Score="2" Body="&lt;p&gt;Use the &lt;code&gt;onSaveUser&lt;/code&gt; event instead but check for the flag inside that event called &lt;code&gt;isNewUser&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-06-24T00:45:58.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="418" PostTypeId="1" AcceptedAnswerId="419" CreationDate="2014-06-24T01:26:38.987" Score="7" ViewCount="2686" Body="&lt;p&gt;In the main &lt;code&gt;Plugin.php&lt;/code&gt; file of my plugin, I can retrieve the plugin's settings like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;getSettings()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I retrieve those same settings from elsewhere in the plugin?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to reference those setting from my &lt;code&gt;Service.php&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-29T19:55:56.543" Title="How do I reference the settings of my plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="419" PostTypeId="2" ParentId="418" CreationDate="2014-06-24T02:36:08.633" Score="15" Body="&lt;p&gt;Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="45" LastEditDate="2014-06-24T03:39:01.623" LastActivityDate="2014-06-24T03:39:01.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="420" PostTypeId="1" CreationDate="2014-06-24T05:36:06.327" Score="3" ViewCount="979" Body="&lt;p&gt;I have a JavaScript file which sends an array of data to a controller: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest('wineNotes/wineSpreadSheet/saveWines', data, ...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The structure of the data variable is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;    Data: sData&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... where &lt;code&gt;sData&lt;/code&gt; is an array of temp variables &lt;code&gt;sData(temp1,temp2,...)&lt;/code&gt; and the structure of each temp object is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;temp = {&#xA;    &quot;wine&quot;:        ht.getDataAtCell(i,0),&#xA;    &quot;country&quot;:     ht.getDataAtCell(i,1),&#xA;    &quot;region&quot;:      ht.getDataAtCell(i,2),&#xA;    &quot;note&quot;:        ht.getDataAtCell(i,3),&#xA;    &quot;tastingdate&quot;: ht.getDataAtCell(i,4),&#xA;    &quot;rating&quot;:      ht.getDataAtCell(i,5),&#xA;    &quot;maturity&quot;:    ht.getDataAtCell(i,6),&#xA;    &quot;conclusion&quot;:  ht.getDataAtCell(i,7)&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I access the parameter &lt;code&gt;temp.wine&lt;/code&gt; for each &lt;code&gt;temp&lt;/code&gt; in the &lt;code&gt;sData&lt;/code&gt; array within the following method of my controller?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveWines()&#xA;{&#xA;    // ???&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know the data structure is kinda wierd its actually an array of arrays. Read the below code and you might understand.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for(i=0;i&amp;lt;NumRows;i++)&#xA;        {&#xA;            temp = {&#xA;                &quot;wine&quot;:ht.getDataAtCell(i,0),&#xA;                &quot;country&quot;:ht.getDataAtCell(i,1),&#xA;                &quot;region&quot;:ht.getDataAtCell(i,2),&#xA;                &quot;tastingdate&quot;:ht.getDataAtCell(i,3),&#xA;                &quot;rating&quot;:ht.getDataAtCell(i,4),&#xA;                &quot;maturity&quot;:ht.getDataAtCell(i,5),&#xA;                &quot;conclusion&quot;:ht.getDataAtCell(i,6),&#xA;            };&#xA;            sData.push(temp);&#xA;        }&#xA;&#xA;        var data = {&#xA;            Data: sData,&#xA;        }&#xA;        Craft.postActionRequest('wineNotes/wineSpreadSheet/saveWines', data, function(response) {&#xA;&#xA;&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="357" LastEditorUserId="357" LastEditDate="2014-06-24T08:26:45.120" LastActivityDate="2014-06-24T08:57:34.143" Title="How do I access AJAX data within a controller method?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="421" PostTypeId="2" ParentId="420" CreationDate="2014-06-24T07:22:52.440" Score="4" Body="&lt;p&gt;Any properties of the object you pass into &lt;code&gt;Craft.postActionRequest()&lt;/code&gt;’s second argument will be available to Craft as POST parameters, so you can get to them with &lt;a href=&quot;http://buildwithcraft.com/docs/apis/httprequestservice#getPost&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;HttpRequestService::getPost()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sData = craft()-&amp;gt;request-&amp;gt;getPost('Data');&#xA;&#xA;foreach ($sData as $temp)&#xA;{&#xA;    $wine = $temp['wine'];&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-06-24T08:57:34.143" LastActivityDate="2014-06-24T08:57:34.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="422" PostTypeId="1" AcceptedAnswerId="624" CreationDate="2014-06-24T07:29:21.653" Score="2" ViewCount="237" Body="&lt;p&gt;When I try to add an asset source under &lt;code&gt;Admin &amp;gt; Settings &amp;gt; Assets&lt;/code&gt;, I can't see the &lt;code&gt;type&lt;/code&gt;-field on the 'Create a new Asset source'-page. Why not?&lt;/p&gt;&#xA;" OwnerUserId="393" LastEditorUserId="177" LastEditDate="2014-06-26T14:56:20.130" LastActivityDate="2014-06-30T16:12:04.823" Title="Why can't I set the 'type' of my Asset source?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="423" PostTypeId="2" ParentId="412" CreationDate="2014-06-24T08:09:07.383" Score="4" Body="&lt;p&gt;Short answer is no, that's not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Longer answer is no, because P&amp;amp;T didn't build it that way. Entries are an element type, and that kind of behavior is buried deep within the element type. Those columns are pre-determined, there's nothing you can do to edit them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be honest, I can't even visualize how a 3rd party plugin could be able to modify that part of the Entries UI and insert a column. It kinda needs to be built directly into the element type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I guess you could make a feature request about it (either on G+ or by emailing support@buildwithcraft.com).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-24T08:09:07.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="424" PostTypeId="1" AcceptedAnswerId="441" CreationDate="2014-06-24T10:05:31.687" Score="9" ViewCount="11940" Body="&lt;p&gt;I experienced that there is a difference between real DateTime objects (as &lt;code&gt;now&lt;/code&gt; is one) and strings composed to &quot;fake DateTime objects&quot; (ie. &lt;code&gt;{% set myDate = '2014/06/24' %}&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes it makes no difference and you can use one or the other. The &lt;code&gt;date()&lt;/code&gt; filter for example works fine with both. But this isn't always the case, the &lt;code&gt;localeTime()&lt;/code&gt; method is an example that exclusively takes real DateTime objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying a &lt;code&gt;date&lt;/code&gt; or &lt;code&gt;date_modify&lt;/code&gt; filter to the &lt;code&gt;myDate&lt;/code&gt; (string) variable is apparently not sufficient to convert it. The only solution I found is to modify &lt;code&gt;now&lt;/code&gt; or fetch a DateTime object from an entry field, but I am looking for a way to generate one solely with twig in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your answers so far, but I still don't get this to work. For me it always results in the following template error when I use a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#methods&quot; rel=&quot;nofollow&quot;&gt;DateTime method&lt;/a&gt; on a manually composed DateTime object:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Method &quot;localeTime&quot; for object &quot;DateTime&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here my example code for easy reproducibility. I more and more believe this is rather a problem with those &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#methods&quot; rel=&quot;nofollow&quot;&gt;DateTime methods&lt;/a&gt; and not with the way I compose the object.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{# Set var to string in supported format #}&#xA;{% set myDatetimeString = '2014-06-24 23:40' %}&#xA;&#xA;{# Use date() function to convert string to DateTime object #}&#xA;{% set myDatetimeObject = date(myDatetimeString) %}&#xA;&#xA;{# Alternatively use date_modify filter to convert string to DateTime object #}&#xA;{% set myDatetimeObject = myDatetimeString|date_modify('+0 day') %}&#xA;&#xA;&#xA;{# DateTime method doesnt work with these &quot;objects&quot; !! #}&#xA;{{ myDatetimeObject.localeTime() }}&#xA;&#xA;{# But DateTime methods work with the `now` DateTime object #}&#xA;{{ now.localeTime() }}&#xA;{{ now.day() }}&#xA;{{ now.iso8601() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-06-24T21:58:15.467" LastActivityDate="2014-06-24T22:46:24.680" Title="Is it possible to compose a DateTime object from a string?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="425" PostTypeId="1" AcceptedAnswerId="427" CreationDate="2014-06-24T11:07:48.960" Score="6" ViewCount="738" Body="&lt;p&gt;My site has 2 locales: &lt;code&gt;en_us&lt;/code&gt; and &lt;code&gt;nl_nl&lt;/code&gt;. I also have a Structure section called Pages, which targets both locales. For each locale, the section has an Entry URL Format:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;en_us: &lt;code&gt;en/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;nl_nl: &lt;code&gt;nl/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The Entry Template setting for the section is &lt;code&gt;pages/_entry&lt;/code&gt;, and there is a template there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for an entry with the slug &lt;code&gt;home&lt;/code&gt; for both locales, the URI &lt;code&gt;nl/home&lt;/code&gt; gives me the correct page, but &lt;code&gt;en/home&lt;/code&gt; gives me a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my setup wrong? Do I need to explicitly create &lt;code&gt;nl&lt;/code&gt; and &lt;code&gt;en&lt;/code&gt; template folders?&lt;/p&gt;&#xA;" OwnerUserId="127" LastActivityDate="2017-01-06T22:07:54.197" Title="How do I get the right entry data based on locale and slug?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="426" PostTypeId="1" AcceptedAnswerId="429" CreationDate="2014-06-24T11:47:44.077" Score="5" ViewCount="599" Body="&lt;p&gt;Disclaimer: I'm new to Craft, making the jump from WordPress and looking for implementation advice to a specific requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to images, I would like to be able to manage oEmbed video references (mostly Vimeo URLs, and any associated metadata) from one central location: Assets. This way, when specifying the media assets for an entry, I can manage images and video &lt;em&gt;together&lt;/em&gt; in one field, and can use drag &amp;amp; drop to order my content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intention is to extend the Assets UI with an additional button (after &quot;Upload Files&quot;, called &quot;Add oEmbed&quot;) that will generate a static file which acts as a pointer to the embed-able video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a sensible approach? If not, how would you suggest I go about it?&lt;/p&gt;&#xA;" OwnerUserId="394" LastActivityDate="2016-09-29T23:08:47.407" Title="Extending Assets with oEmbed video references" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="427" PostTypeId="2" ParentId="425" CreationDate="2014-06-24T11:50:03.233" Score="5" Body="&lt;p&gt;Probably the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-locale&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CRAFT_LOCALE&lt;/code&gt;&lt;/a&gt; isn't set correctly. There is an in-depth &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;knowledge article here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve this, you could add a conditional to the &lt;code&gt;/public/index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;//Locale&#xA;if ( preg_match(&quot;/\/nl\//i&quot;, $_SERVER['REQUEST_URI']) ) { //Check if /nl/ is in the uri&#xA;    define('CRAFT_LOCALE', 'nl_nl');&#xA;}&#xA;else {&#xA;    define('CRAFT_LOCALE', 'en_us');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-24T12:27:43.380" LastActivityDate="2014-06-24T12:27:43.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="428" PostTypeId="1" AcceptedAnswerId="431" CreationDate="2014-06-24T11:54:26.453" Score="3" ViewCount="1380" Body="&lt;p&gt;When I watch my site trough live preview the previewframe is left blank, and in the console there appears the error: `&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;XMLHttpRequest cannot load &lt;a href=&quot;http://domain.com/template&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/template&lt;/a&gt; . No&#xA;  'Access-Control-Allow-Origin' header is present on the requested&#xA;  resource. Origin '&lt;a href=&quot;http://www.domain.com&quot; rel=&quot;nofollow&quot;&gt;http://www.domain.com&lt;/a&gt;' is therefore not allowed&#xA;  access.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is that?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-06-24T13:17:57.900" Title="Live Preview XMLHttpRequest error" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="429" PostTypeId="2" ParentId="426" CreationDate="2014-06-24T12:06:43.740" Score="3" Body="&lt;p&gt;It's currently not possible to change a system CP section through a plugin. Also Assets are meant to be used for files, not for 'links-to-files'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest solution to your problem would be to use &lt;a href=&quot;https://dukt.net/craft/videos&quot; rel=&quot;nofollow&quot;&gt;Dukt's Video plugin&lt;/a&gt;, you just wouldn't be able to manage assets and videos together in one single field.&lt;br&gt;&#xA;You could write a new fieldtype-plugin though, which combines both element-types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be the &lt;a href=&quot;https://github.com/fruitstudios/LinkIt&quot; rel=&quot;nofollow&quot;&gt;Link It&lt;/a&gt; plugin, but that would only allow you to add a link to the video.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-24T12:06:43.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="430" PostTypeId="2" ParentId="428" CreationDate="2014-06-24T12:26:40.593" Score="3" Body="&lt;p&gt;I assume you are running Craft on a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment config&lt;/a&gt; with to different domains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are getting this error because modern browsers block cross-site requests, and the live-preview is probably trying to load the template from another domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell your server to allow a cross-site requests by sending a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-origin_resource_sharing&quot; rel=&quot;nofollow&quot;&gt;CORS-header&lt;/a&gt;. This header is called &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try adding this to your .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header add Access-Control-Allow-Origin &quot;http://example.com&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will allow all requests coming from example.com. To be safe add the header for each domain you use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header add Access-Control-Allow-Origin &quot;http://example1.com&quot;&#xA;Header add Access-Control-Allow-Origin &quot;http://example2.com&quot;&#xA;Header add Access-Control-Allow-Origin &quot;http://example3.com&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You need &lt;code&gt;mod_headers&lt;/code&gt; activated. And if you know what you're doing, you could also set this up in: &lt;code&gt;httpd.conf &amp;lt;VirtualHost&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-24T12:26:40.593" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="431" PostTypeId="2" ParentId="428" CreationDate="2014-06-24T13:17:57.900" Score="10" Body="&lt;p&gt;Instead of allowing cross site access, I'd recommend that you instead just make sure that the site is only accessible through &lt;strong&gt;one&lt;/strong&gt; domain (not both www.domain.com and domain.com). This will also improve your SEO ranking, since search engines will index both these domains as separate, duplicated content. You can rewrite the domain in your .htaccess, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Remove the www from the URL&#xA;RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&#xA;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&#xA;# Force the www &#xA;# RewriteCond %{HTTP_HOST} !^www\.&#xA;# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that only one of these rules should be used, if you enable both you'll get a redirection loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, make sure you use the correct domain in your Craft config.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-06-24T13:17:57.900" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="432" PostTypeId="2" ParentId="318" CreationDate="2014-06-24T13:39:14.047" Score="2" Body="&lt;p&gt;Well, I can't really mark any of these as the answer, and I have no clue what actually did it, the config simply started working. I restarted all services and my machine many times during this process, so it was nothing quite so simple. I guess this is what I get for developing on a Windows machine. I considered deleting the question, but there's some valuable troubleshooting in the answers, so better to leave it live.&lt;/p&gt;&#xA;" OwnerUserId="372" LastActivityDate="2014-06-24T13:39:14.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="433" PostTypeId="2" ParentId="426" CreationDate="2014-06-24T14:03:38.117" Score="4" Body="&lt;p&gt;Craft gives you the ability to combine different type of content in one single field, the &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;matrix field&lt;/a&gt;. Configure one matrix &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;block type&lt;/a&gt; for your images and one for your video links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This setup still allows you to re-order your content (the matrix blocks) using drag &amp;amp; drop. You can further extend your entries with other types of content (maps, quotes, etc.) and have better accessibility to any fields assigned to your images and videos (not hidden behind double click).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-24T14:03:38.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="434" PostTypeId="2" ParentId="412" CreationDate="2014-06-24T14:24:05.397" Score="7" Body="&lt;p&gt;The current answer to this is no, not out of the box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unofficial answer to this is, it has been discussed several times out there in the forums and there are some good arguments to make that this is a core part of 'content management'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The developer-friendly answer to this is yes, you can control those columns if you create a plugin with a new Element Type.  Your Element can extend the default Entries Element Type and customize the columns in the listing views.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within your Element Type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;defineTableAttributes()&lt;/code&gt; - Returns the attributes that can be shown/sorted by in table views.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;modifyElementsQuery()&lt;/code&gt; - Modifies an element query targeting elements of this type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;getSources()&lt;/code&gt; - Returns the element type's sources and can be used to trigger filters on the table view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a new listing template with these three lines of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;Page Title&quot;|t %}&#xA;{% set elementType = 'PluginName_Element' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this a smart thing to do?  It probably depends on your use case.  Elements are powerful, but they also take time to develop and maintain.  While you can easily extend a class, several parts of the Control Panel UI are not as easy to extend if you start adding variations on the intended use cases. Make your case to P&amp;amp;T about this feature being a core part of content management and if enough others do the same, you may save yourself a lot of custom development.  I think there is a strong case that this type of feature can only be done well in the core.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-24T14:24:05.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="435" PostTypeId="1" AcceptedAnswerId="437" CreationDate="2014-06-24T15:59:27.650" Score="5" ViewCount="1491" Body="&lt;p&gt;This might be a stupid question... but I can't seem to figure it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to show the photo of an author beside their entry. I thought the proper variable was... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{user.photoUrl}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...until I logged out and my photo disappeared. &lt;/p&gt;&#xA;" OwnerUserId="381" LastActivityDate="2014-06-24T16:15:29.320" Title="How do I display the Image of an Author in a post?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="436" PostTypeId="2" ParentId="424" CreationDate="2014-06-24T16:07:45.887" Score="2" Body="&lt;p&gt;This works for me, starting with a string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set yearbegins = '1 January ' ~ year %} // getting year from a url (dynamic route)&#xA;{{ yearbegins | date(&quot;U&quot;) }} // outputs the date in Unixtime&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Are you saying this is not a real datetime object, and it's just the date filter making it look like it? I'm finding some unpredictability, too, as you know.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-06-24T16:12:50.527" LastActivityDate="2014-06-24T16:12:50.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="437" PostTypeId="2" ParentId="435" CreationDate="2014-06-24T16:15:29.320" Score="12" Body="&lt;p&gt;That will get you the url of the current user's photo. To get an author's photo do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ author.photoUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the author is not defined in your context but the entry is, then get the entry's author's photo as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.photoUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-06-24T16:15:29.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="438" PostTypeId="1" AcceptedAnswerId="439" CreationDate="2014-06-24T17:23:51.240" Score="2" ViewCount="169" Body="&lt;p&gt;Problem:&#xA;I want to be able to log things to my Craft DB from an external app, via some sort of request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my first question is, is there any plans for any kind of built-in development log, or should use something like: &lt;a href=&quot;https://github.com/themusicman/lumberjack/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/themusicman/lumberjack/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I'd have to set up some kind of shared key authentication so I could post to this log with an external request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What tools does Craft/Yii already have for this process, and what would need to be custom development?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-24T17:32:40.787" Title="Native development log / API access?" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="439" PostTypeId="2" ParentId="438" CreationDate="2014-06-24T17:32:40.787" Score="3" Body="&lt;p&gt;Craft has &lt;code&gt;Craft::log()&lt;/code&gt; for that purpose. Brandon has an example of this function &lt;a href=&quot;https://craftcms.stackexchange.com/q/253/177&quot;&gt;over here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this work from an external request, you can create plugin with a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; which saves incoming data (post or json) to the log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To secure this with a key just send an additional variable and check if it's correct.&#xA;Take a look at &lt;a href=&quot;https://github.com/putyourlightson/Craft-Dump&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ben's Dump&lt;/a&gt; plugin, for an example of such a key-protected controller.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-06-24T17:32:40.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="440" PostTypeId="1" AcceptedAnswerId="475" CreationDate="2014-06-24T18:27:56.430" Score="6" ViewCount="499" Body="&lt;p&gt;I'd like to get Craft working with New Relic so I can play with my two favorite apps.  My web host (EngineHosting) got the New Relic daemons et al going; has anyone tackled getting the Craft side going so that it reports in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know, please? I may be doing some learning in order to do this integration down the line; but if someone has tackled it, I could dive right on in a bit more quickly.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2014-07-12T19:32:48.763" LastActivityDate="2014-12-19T08:46:58.957" Title="New Relic and Craft?" Tags="&lt;config&gt;" AnswerCount="2" CommentCount="13" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="441" PostTypeId="2" ParentId="424" CreationDate="2014-06-24T18:54:33.560" Score="5" Body="&lt;p&gt;In Twig, the &lt;code&gt;date_modify&lt;/code&gt; filter returns a DateTime object. Also, &lt;code&gt;date&lt;/code&gt; is not just a filter, but also a function. The &lt;code&gt;date&lt;/code&gt; function accepts any a DateTime object or a string in a &lt;a href=&quot;http://www.php.net/manual/en/datetime.formats.php&quot;&gt;supported format&lt;/a&gt;, and returns a DateTime object. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date(&quot;+2 years&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should give you a DateTime object set for 2 years from when it's triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is localeTime missing?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;now&lt;/code&gt; variable is not a regular DateTime object from PHP. It's actually an extended class ( \Craft\DateTime ). So it won't have all the convenience functions you get from &lt;code&gt;now&lt;/code&gt; or a date field from an entry. Instead you would need to do it manually (I'm not sure if you can overwrite a function or filter in Twig). Fortunately, the locale's format string is available as a variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDatetimeString = '2014-06-24 23:40' %}&#xA;{% set format = craft.i18n.getTimepickerJsFormat() %}&#xA;{{ myDatetimeString|date(format) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can even shorten it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDatetimeString = '2014-06-24 23:40' %}&#xA;{{ myDatetimeString|date(craft.i18n.getTimepickerJsFormat()) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To replicate localeDate, use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDatetimeString = '2014-06-24 23:40' %}&#xA;{{ myDatetimeString|date(craft.i18n.getDatepickerJsFormat()) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditDate="2014-06-24T22:46:24.680" LastActivityDate="2014-06-24T22:46:24.680" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="442" PostTypeId="1" AcceptedAnswerId="451" CreationDate="2014-06-24T19:59:03.683" Score="1" ViewCount="95" Body="&lt;p&gt;I need to store revisions of assets for a plugin I am working on, what is the best / most robust location to store them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the location / files to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Always be writable.&lt;/li&gt;&#xA;&lt;li&gt;Not removed when / if craft/storage is cleaned out.&lt;/li&gt;&#xA;&lt;li&gt;Unaffected by updates or cache being cleared.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;S&lt;/p&gt;&#xA;" OwnerUserId="158" LastEditorUserId="177" LastEditDate="2014-06-24T20:01:55.603" LastActivityDate="2014-06-24T21:57:37.733" Title="Where to store asset backups for plugin?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="443" PostTypeId="1" AcceptedAnswerId="445" CreationDate="2014-06-24T20:42:07.580" Score="1" ViewCount="1227" Body="&lt;p&gt;I am trying to create a meta include to display all my meta data and I have the following set up so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3. {% if craft.request.getSegment(1) != &quot;404&quot; and craft.request.getSegment(1) != &quot;databytes&quot; %}&#xA;  4. &amp;lt;title&amp;gt;{% if entry.metaTitle is defined %}{{ entry.metaTitle }}{% else %}{{ entry.title }}{% endif %} | {{ siteName }}&amp;lt;/title&amp;gt;&#xA;  5. {% if entry.metaDescription is defined %}&#xA;  6. &amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot;&amp;gt;&#xA;  7. {% endif %}&#xA;8. {% endif %}&#xA;&#xA;{# 404 =============== #}&#xA;&#xA;{% if craft.request.getSegment(1)  == &quot;404&quot; %}&#xA;  &amp;lt;title&amp;gt;Page Missing | {{ siteName }}&amp;lt;/title&amp;gt;&#xA;  &amp;lt;meta name=&quot;description&quot; content=&quot;Sorry the page you are looking for is missing, it may have been moved or deleted, please use the navigation to search for similar content.&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I visit main pages the code works and if I go to example.com/404 the code works, but if I visit an invalid url example.com/foo then I get a Twig Error Runtime error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cJmTb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-06-24T20:53:00.060" LastActivityDate="2014-06-24T20:53:00.060" Title="Twig Error Runtime When Using Conditionals" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="444" PostTypeId="2" ParentId="443" CreationDate="2014-06-24T20:50:22.257" Score="1" Body="&lt;p&gt;Take a look at what you have in your &lt;em&gt;_includes/_page_meta&lt;/em&gt; file at line 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely you just need to wrap it in a conditional with &lt;code&gt;is defined&lt;/code&gt; like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {# your template stuff here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="43" LastActivityDate="2014-06-24T20:50:22.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="445" PostTypeId="2" ParentId="443" CreationDate="2014-06-24T20:51:41.657" Score="3" Body="&lt;p&gt;Craft doesn't redirect to 404 if a page isn't found, it just loads the 404 template and keeps the invalid uri.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What currently happens:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/invalid_uri&lt;/li&gt;&#xA;&lt;li&gt;Craft doesn't find it and shows the 404 template&lt;/li&gt;&#xA;&lt;li&gt;Your conditional checks if &lt;code&gt;404&lt;/code&gt; is in the uri, but it isn't.&lt;/li&gt;&#xA;&lt;li&gt;Your code now tries to access the &lt;code&gt;entry&lt;/code&gt; variable which isn't defined.&lt;/li&gt;&#xA;&lt;li&gt;This results in a Twig error.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add an &lt;code&gt;entry is defined&lt;/code&gt; to your conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) != &quot;404&quot; and craft.request.getSegment(1) != &quot;databytes&quot; and entry is defined %}&#xA;....&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-24T20:51:41.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="446" PostTypeId="1" CreationDate="2014-06-24T20:53:20.793" Score="8" ViewCount="2946" Body="&lt;p&gt;Im curious to hear more about what any of you are using to build &quot;community&quot;/ &quot;forum&quot; messaging options into your craft cms site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I've found it seems there would be a couple of interesting options&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Socialize Plugin&lt;/strong&gt; &lt;a href=&quot;https://dukt.net/craft/socialize&quot;&gt;https://dukt.net/craft/socialize&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its in private beta and I haven't tried it but it seems to have a lot of the features we would need.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big option questions would be how to manage any group messaging features but maybe you just have a &quot;posts&quot; channel that users can post to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Muut&lt;/strong&gt; &lt;a href=&quot;https://muut.com/&quot;&gt;https://muut.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Allows for an iframe type integration. Seems to be pretty full featured but wouldnt really share any data (or logins) with craft, would be a visual integration only&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other options&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We aren't looking for a ton of features, just a way for people to login, share text and photos, and comment on those posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curious if anyone out there has tackled a problem like this?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2018-01-29T12:37:23.897" Title="Craft Forum/Community options" Tags="&lt;users&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="447" PostTypeId="2" ParentId="260" CreationDate="2014-06-24T20:54:30.247" Score="4" Body="&lt;p&gt;&lt;strong&gt;Solution 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with your code is, that you apply the &lt;code&gt;date&lt;/code&gt; filter exclusively to the year variable:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;{% set firstDayOfMonth = month ~ &quot;/1/&quot; ~ year|date(&quot;U&quot;) %}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To get this right you have to first compose your &quot;datetime string&quot; and then apply the filter to the string as a whole:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = (month ~ &quot;/1/&quot; ~ year)|date(&quot;U&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's also the reason why it works for you to apply it inside the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't need to pass a unix datetime formated string to your query, a string in format &quot;Y-m-d&quot; is just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;&#xA;{% set lastDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;&#xA;{% set thisMonthsEvents = craft.entries.section('events').eventDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-24T20:54:30.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="448" PostTypeId="2" ParentId="416" CreationDate="2014-06-24T21:18:35.427" Score="5" Body="&lt;p&gt;The issue turned out to be the result of a variable name mistake on my part. I had typed in an incorrect variable name in the email template. I actually still don't really understand what that has to do with a database transaction, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;If anyone else is running into a similar issue, I've found a way to get a more useful error message, as opposed to the &quot;CDbTransaction is inactive&quot; message, which doesn't help much. If you go to craft/app/services/UsersService.php, and comment out line 311 (&quot;$transaction-&gt;rollback();&quot;), then Yii won't give you the CDbTransaction error before Craft has a chance to tell you its more helpful error. This should give you a better idea of what you're doing wrong. Obviously, don't forget to un-comment that line after you've fixed your issue.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="228" LastEditDate="2014-07-16T23:15:57.167" LastActivityDate="2014-07-16T23:15:57.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="449" PostTypeId="1" AcceptedAnswerId="792" CreationDate="2014-06-24T21:18:50.327" Score="4" ViewCount="4557" Body="&lt;p&gt;Is it possible to output the template name being used? Using a global variable or something similar? I am wanting to check which template is being used in a conditional.&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="45" LastEditDate="2014-07-07T22:16:49.207" LastActivityDate="2018-09-05T11:34:30.720" Title="How can I make a template output its own filename?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="450" PostTypeId="2" ParentId="449" CreationDate="2014-06-24T21:34:42.800" Score="5" Body="&lt;p&gt;I don't believe this is currently possible outside of the context of a Craft plugin.  Inside of a plugin, you could probably do it through a Twig extension so that you have access to the template instance, where you could call $template-&gt;getTemplateName(), which is part of Twig's Twig_Template abstract class.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-24T21:34:42.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="451" PostTypeId="2" ParentId="442" CreationDate="2014-06-24T21:57:37.733" Score="1" Body="&lt;p&gt;The only thing that Craft guarantees to be writable is craft/storage (and to a limited extent, craft/config).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, 99% of things in craft/storage can and will be rebuilt as needed depending on the request, even if the entire folder has been nuked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either work within that context, save your assets as blob's in the database (would not recommend) or in your plugin's installation instructions, make sure that you specify they create a craft/plugins/pluginHandle/writable folder you can save your asset revisions to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-24T21:57:37.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="452" PostTypeId="1" AcceptedAnswerId="453" CreationDate="2014-06-24T22:19:33.163" Score="8" ViewCount="3885" Body="&lt;p&gt;I'm trying to return entries where a specific field named &quot;productSale&quot; is not empty. Unfortunately, my code attempts keep throwing the &quot;Expected name or number&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code attempts include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.section('product').productSale.(':notempty:').find() %}&#xA;{% set products = craft.entries.section('product').productSale.('not null').find() %}&#xA;{% set products = craft.entries.section('product').productSale.('is not null').find() %}&#xA;{% set products = craft.entries.section('product').productSale.('not empty').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Three questions then:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the &quot;Expected name or number&quot; error saying exactly? &lt;/li&gt;&#xA;&lt;li&gt;Where in the available docs (Craft or Twig) would I look for explanation on this? I didn't find much in my first pass.&lt;/li&gt;&#xA;&lt;li&gt;How do I return entries where a specific field is &quot;not empty&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="103" LastActivityDate="2018-01-18T11:26:31.380" Title="Return entries where field is &quot;not empty&quot;" Tags="&lt;entries&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="453" PostTypeId="2" ParentId="452" CreationDate="2014-06-24T22:28:04.830" Score="17" Body="&lt;p&gt;&lt;strong&gt;1. &quot;Expected name or number&quot; error&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parser is expecting a method/property after the dot of &lt;code&gt;productSale&lt;/code&gt;, but you are passing arguments. Removing the dot to make it valid:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.section('product').productSale(':notempty:') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Documentation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no documentation on this yet, but it is listed in the &lt;a href=&quot;https://craftcms.com/changelog#2-0-2524&quot; rel=&quot;noreferrer&quot;&gt;release notes&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added support for passing “:empty:” and “:notempty:” to&#xA;  &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; parameters when you’re looking for&#xA;  empty/non-empty values.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="177" LastEditorUserId="142" LastEditDate="2018-01-18T11:26:31.380" LastActivityDate="2018-01-18T11:26:31.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="454" PostTypeId="1" AcceptedAnswerId="456" CreationDate="2014-06-24T23:15:52.587" Score="13" ViewCount="1539" Body="&lt;p&gt;We've got a plugin.  It doesn't have the ability to add custom field types.  We're pre-defining all of the fields.  One of the fields needs to be an Asset field.  A user should be able to upload an Asset using the native Craft Asset UI, store that Asset locally or on Amazon or any supported cloud platforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do we create the relationship between the uploaded Asset and the database record we want the Asset related to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were allowing custom fields we could have our custom table relate to a Field Layout ID, and have any number of fields relate to that Field Layout.  But in our case, we're defining all of the columns we need in our template, in our own record, and don't really need to create any fields within Craft's fields table as we're setting them all up beforehand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we need a Field Layout in this situation?  Do we need to create a Field within Craft under our own context (like Matrix blocks) to be able to control the settings such as where to upload the assets to, and whether to restrict the upload to a single folder, or single image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel I have lots of pieces of the puzzle, but can't yet see how they fit together.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-02-20T01:20:56.827" LastActivityDate="2018-02-20T22:43:53.443" Title="How do we create a pre-defined Asset upload field in a plugin that integrates with the native Craft Assets file manager?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="455" PostTypeId="1" AcceptedAnswerId="457" CreationDate="2014-06-25T00:19:28.590" Score="3" ViewCount="2382" Body="&lt;p&gt;In my plugin, I'm sending an email like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$recipients = 'person@example.com';&#xA;&#xA;$email = new EmailModel();&#xA;$email-&amp;gt;toEmail = $recipients;&#xA;$email-&amp;gt;subject = 'My Email Subject';&#xA;$email-&amp;gt;body    = 'My Email Body';&#xA;&#xA;craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works great! But when I'm sending to multiple people, the string would look like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$recipients = 'person1@example.com, person2@example.com';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and it generates an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Invalid address: person1@example.com, person2@example.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I properly send an email to multiple recipients?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-01-15T05:05:06.587" Title="How do I send an email to multiple recipients?" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="456" PostTypeId="2" ParentId="454" CreationDate="2014-06-25T00:55:32.043" Score="16" Body="&lt;p&gt;I did this recently with my &lt;a href=&quot;https://www.doublesecretagency.com/plugins/ad-wizard&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ad Wizard&lt;/a&gt; plugin... There are several different parts which need to be brought together to make it work:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In your &lt;strong&gt;Record&lt;/strong&gt; file, add this to &lt;code&gt;defineRelations&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'asset' =&amp;gt; array(static::BELONGS_TO, 'AssetFileRecord')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In your &lt;strong&gt;Model&lt;/strong&gt; file, add this to &lt;code&gt;defineAttributes&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'assetId' =&amp;gt; AttributeType::Number&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Whichever &lt;strong&gt;template&lt;/strong&gt; is responsible for editing that data will need something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;field&quot; id=&quot;assetId-field&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;assetId&quot;&amp;gt;Image&amp;lt;/label&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        {% if assetsSourceExists %}&#xA;            {{ forms.elementSelect({&#xA;                elements: elements,&#xA;                id: 'assetId',&#xA;                name: 'assetId',&#xA;                elementType: elementType,&#xA;                criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_us&quot;},&#xA;                sourceElementId: assetId,&#xA;                jsClass: 'Craft.AssetSelectInput',&#xA;                addButtonLabel: 'Select Image',&#xA;                limit: 1,&#xA;            }) }}&#xA;        {% else %}&#xA;            &amp;lt;p class=&quot;error&quot;&amp;gt;No assets sources currently exist. &amp;lt;a href=&quot;{{ newAssetsSourceUrl }}&quot;&amp;gt;Create one now...&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll notice in the Twig code above, I set references to the following variables:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;assetId&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;elements&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;elementType&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;assetsSourceExists&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;newAssetsSourceUrl&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These variable were set in the &lt;code&gt;actionEditMyElement&lt;/code&gt; method of the &lt;strong&gt;Controller&lt;/strong&gt; prior to loading the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set assetId&#xA;$variables['assetId'] = $myModel-&amp;gt;assetId;&#xA;&#xA;// Set elements&#xA;if ($variables['assetId']) {&#xA;    $asset = craft()-&amp;gt;elements-&amp;gt;getElementById($variables['assetId']);&#xA;    $variables['elements'] = array($asset);&#xA;} else {&#xA;    $variables['elements'] = array();&#xA;}&#xA;&#xA;// Set elementType&#xA;$variables['elementType'] = craft()-&amp;gt;elements-&amp;gt;getElementType(ElementType::Asset);&#xA;&#xA;// Set assetsSourceExists&#xA;$sources = craft()-&amp;gt;assets-&amp;gt;findFolders();&#xA;$variables['assetsSourceExists'] = count($sources);&#xA;&#xA;// Set newAssetsSourceUrl&#xA;$variables['newAssetsSourceUrl'] = UrlHelper::getUrl('settings/assets/sources/new');&#xA;&#xA;// Render the template!&#xA;$this-&amp;gt;renderTemplate('myplugin/_edit', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your &lt;strong&gt;Controller&lt;/strong&gt; will probably have something like this in your &lt;code&gt;actionSaveMyElement&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myModel-&amp;gt;assetId = craft()-&amp;gt;request-&amp;gt;getPost('assetId', $myModel-&amp;gt;assetId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your &lt;strong&gt;Service&lt;/strong&gt; file will probably have something like this to save your record:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assetId = (!empty($myModel-&amp;gt;assetId) ? $myModel-&amp;gt;assetId[0] : null);&#xA;$myRecord-&amp;gt;assetId = $assetId;&#xA;...&#xA;$myRecord-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, let me know if I missed anything!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-02-20T22:43:53.443" LastActivityDate="2018-02-20T22:43:53.443" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="457" PostTypeId="2" ParentId="455" CreationDate="2014-06-25T01:10:11.147" Score="7" Body="&lt;p&gt;You can loop through a list of your recipients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Comma-separated list of recipients&#xA;$recipients = 'person1@example.com, person2@example.com';&#xA;&#xA;// Break out recipients into an array&#xA;$recipientList = explode( &quot;,&quot;, $recipients );&#xA;&#xA;// Create the globally known things about the EmailModel&#xA;$email = new EmailModel();&#xA;$email-&amp;gt;subject = 'My Email Subject';&#xA;$email-&amp;gt;body    = 'My Email Body';&#xA;&#xA;// Loop through each recipient in the recipient list&#xA;foreach ( $recipientList as $recipient )&#xA;{&#xA;    try&#xA;    {&#xA;        // Add a specific recipient to the email model&#xA;        $email-&amp;gt;toEmail = $recipient;&#xA;&#xA;        // Send the email&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail( $email );&#xA;    }&#xA;    catch ( \Exception $e )&#xA;    {&#xA;        // Do nothing&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-06-25T04:58:31.410" LastActivityDate="2014-06-25T04:58:31.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="458" PostTypeId="1" AcceptedAnswerId="459" CreationDate="2014-06-25T02:28:23.170" Score="5" ViewCount="2112" Body="&lt;p&gt;I know how to add images into my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.featureImage.first() %}&#xA;&amp;lt;div class=&quot;imagewrapper&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;{{ image.getWidth('banner') }}&quot; height=&quot;{{ image.getHeight('banner') }}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what if my client doesn't have feature images for all of his entries? I need some function that'll tell the website, if there is no image, omit &lt;code&gt;&amp;lt;div class=&quot;imagewrapper&quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps some kind of if/else statement that I can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if&#xA;    //the featureimage for this entry is filled in&#xA;%}&#xA;    {% set image = entry.featureImage.first() %}&#xA;    &amp;lt;div class=&quot;imagewrapper&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;{{ image.getWidth('banner') }}&quot; height=&quot;{{ image.getHeight('banner') }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="398" LastEditorUserId="45" LastEditDate="2014-06-26T01:11:47.043" LastActivityDate="2014-06-26T01:11:47.043" Title="How do I use an if/else statement to determine if a field is filled in?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="459" PostTypeId="2" ParentId="458" CreationDate="2014-06-25T02:45:27.170" Score="9" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot;&gt;&lt;code&gt;length&lt;/code&gt;&lt;/a&gt; Twig filter for that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.featureImage | length %}&#xA;    {% set image = entry.featureImage.first() %}&#xA;    &amp;lt;div class=&quot;imagewrapper&quot;&amp;gt;&#xA;       &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;{{ image.getWidth('banner') }}&quot; height=&quot;{{ image.getHeight('banner') }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there isn't an image in &lt;code&gt;featureImage&lt;/code&gt; then nothing will be output.&lt;/p&gt;&#xA;" OwnerUserId="43" LastActivityDate="2014-06-25T02:45:27.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="460" PostTypeId="1" CreationDate="2014-06-25T05:04:17.290" Score="4" ViewCount="1680" Body="&lt;p&gt;I'm building www.mynewcraftsite.com.au, but I also wanna create www.mynewcraftsite.dev which is a testing server to preview to my clients. I've heard that I can set this up with Craft without going through the drudgery of downloading/uploading databases and updating urls in the db, users ... etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been reading the Craft CMS documentation for &quot;Multi-Environment Configs&quot;.  So far I've got this in my db.php file;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    //All environments&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'localhost' or '127.0.0.1'.&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'dashing-print',&#xA;        'password' =&amp;gt; 'f#$njEwFRn3&amp;amp;2',&#xA;        'database' =&amp;gt; 'dashing-print',&#xA;        'tablePrefix' =&amp;gt; 'craft'&#xA;    ),&#xA;&#xA;    //Testing environment&#xA;    'www.mynewcraftsite.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'www.dashingprint.dev'&#xA;    ),&#xA;&#xA;    //Live environment&#xA;    'www.mynewcraftsite.com.au' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'www.dashingprint.com.au'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works EXCEPT when I go to www.mynewcraftsite.dev and then click on the links, I end up back on www.mynewcraftsite.com.au (eg. Instead of going to www.mynewcraftsite.dev/services, I go to www.mynewcraftsite.com.au/services. In order to get to the correct page I gotta write up the whole url www.mynewcraftsite.dev/service into the google chrome url bar.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The siteURL property isn't doing anything, there's gotta be something else that I gotta stick in there in order to rewrite the urls.&lt;/p&gt;&#xA;" OwnerUserId="398" LastEditorUserId="45" LastEditDate="2014-06-25T06:07:52.043" LastActivityDate="2016-12-04T17:24:53.107" Title="How can I use multi-environment configuration to set each root URL?" Tags="&lt;config&gt;&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="461" PostTypeId="2" ParentId="460" CreationDate="2014-06-25T05:27:34.540" Score="12" Body="&lt;p&gt;Make sure to change the &quot;Site URL&quot; setting to &lt;code&gt;{siteUrl}&lt;/code&gt; in your control panel settings...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Control Panel &gt; Settings &gt; General &gt; &quot;Site URL&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Within your config file, you'll also want to put your &lt;code&gt;siteUrl&lt;/code&gt; value inside of an &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot;&gt;Environment-Specific Variables&lt;/a&gt; sub-array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'mynewcraftsite.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://www.mynewcraftsite.dev/'&#xA;    )&#xA;),&#xA;'mynewcraftsite.com.au' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://www.mynewcraftsite.com.au/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's how Craft is compiling all of that... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within each of your environment configurations, there are many &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot;&gt;config settings&lt;/a&gt; that you can apply to that specific environment. Additionally, each environment can have a sub-array called &lt;code&gt;environmentVariables&lt;/code&gt;, which allows you to set whatever unique variables you want. The most common examples are &lt;code&gt;siteUrl&lt;/code&gt; and &lt;code&gt;fileSystemPath&lt;/code&gt; (great for setting up assets sources), but you can truly set whatever environment variables you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've set the &lt;code&gt;siteUrl&lt;/code&gt; value in your environment variables array, you now need to use that value... This is where the control panel settings page comes into play. Changing &quot;Site URL&quot; to simply &lt;code&gt;{siteUrl}&lt;/code&gt; tells Craft to pull that value from your environment variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt; Notice the single set of curly braces, and the lack of spacing between the variable name and the braces. This is the syntax difference between &lt;strong&gt;environment variables&lt;/strong&gt; and &lt;strong&gt;Twig variables&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's it! When you create a path, Craft will use whatever is in the &quot;Site URL&quot; setting. And since that's pulling in your environment variable, that's what you'll get.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Lastly, allow me to point out a few things in your example which may also be stopping this from working for you (feel free to update the example in your question to fix these issues)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Most importantly:&lt;/strong&gt; You're combining data that should be stored in two separate files... &lt;code&gt;craft/config/db.php&lt;/code&gt; and &lt;code&gt;craft/config/general.php&lt;/code&gt;. While the multi-environment format is the same, you'll need to separate the data shown in your example. Put most of your settings into &lt;code&gt;general.php&lt;/code&gt;, only the following belong in &lt;code&gt;db.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;server&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;user&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;password&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;database&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;tablePrefix&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You also have an errant line of code in your example... This line should definitely be removed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'localhost' or '127.0.0.1'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, you've left some crucial security information in your example... All of your database connection info is exposed (as well as your true domain names in your &lt;code&gt;siteUrl&lt;/code&gt; examples).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hope that helps... If you fix the bugs in your example code, I'll remove my corresponding notes from this answer. :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-25T05:56:55.333" LastActivityDate="2014-06-25T05:56:55.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="462" PostTypeId="2" ParentId="460" CreationDate="2014-06-25T05:56:32.323" Score="2" Body="&lt;p&gt;The siteUrl value you are trying to set should not be set in the &lt;code&gt;db.php&lt;/code&gt; file.  It needs to be set in the &lt;code&gt;general.php&lt;/code&gt; file.  It also seems like you have a few other variables that should be moved over to &lt;code&gt;general.php&lt;/code&gt; too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have one line that needs to be removed completely or commented out.  &lt;code&gt;'localhost' or '127.0.0.1'.&lt;/code&gt; is not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    //All environments&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    )&#xA;&#xA;    //Testing environment&#xA;    'www.mynewcraftsite.dev' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://www.mynewcraftsite.dev'&#xA;        )&#xA;    ),&#xA;&#xA;    //Live environment&#xA;    'www.mynewcraftsite.com.au' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; 'http://www.mynewcraftsite.com.au'&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    //All environments&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft'&#xA;    ),&#xA;&#xA;    //Testing environment&#xA;    'www.mynewcraftsite.dev' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'testuser',&#xA;        'password' =&amp;gt; 'testpassword',&#xA;        'database' =&amp;gt; 'testdatabase'&#xA;    ),&#xA;&#xA;    //Live environment&#xA;    'www.mynewcraftsite.com.au' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'liveuser',&#xA;        'password' =&amp;gt; 'livepassword',&#xA;        'database' =&amp;gt; 'livedatabase'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-25T05:56:32.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="463" PostTypeId="1" CreationDate="2014-06-25T07:56:00.640" Score="6" ViewCount="585" Body="&lt;p&gt;Is there a quick an easy way to change the asset thumbnail size when it's attached to an entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default this is quite small and restrictive and would like to show a more representative version of the image when add/editing each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would have thought this is possible using a transform but how would this be tied back to the entry form?&lt;/p&gt;&#xA;" OwnerUserId="396" LastEditorUserId="250" LastEditDate="2014-07-08T22:06:55.290" LastActivityDate="2014-07-08T22:06:55.290" Title="Asset thumbnail size in Entries" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="464" PostTypeId="2" ParentId="463" CreationDate="2014-06-25T08:24:41.670" Score="4" Body="&lt;p&gt;No, you currently can't do that. But it's on The List! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See discussions in g+ here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/110899911634334728373/posts/Q4Vi5d1y8Ry&quot; rel=&quot;nofollow&quot;&gt;https://plus.google.com/110899911634334728373/posts/Q4Vi5d1y8Ry&lt;/a&gt;&#xA;&lt;a href=&quot;https://plus.google.com/114292096121951987560/posts/PdXYBMxqbzb&quot; rel=&quot;nofollow&quot;&gt;https://plus.google.com/114292096121951987560/posts/PdXYBMxqbzb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-25T08:24:41.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="465" PostTypeId="2" ParentId="446" CreationDate="2014-06-25T12:16:14.577" Score="3" Body="&lt;p&gt;Out side of what you have mentioned, I recall &lt;a href=&quot;http://www.discourse.org/&quot; rel=&quot;nofollow&quot;&gt;Discourse&lt;/a&gt; being mentioned on the Google+ Community. That's written in Ruby, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://vanillaforums.org/&quot; rel=&quot;nofollow&quot;&gt;Vanilla Forums&lt;/a&gt; is open-source and written in PHP. It's also comes with SSO (Single-Sign On), and can be embedded into another site via an iframe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are currently no announced forum plugins native to Craft.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-25T12:16:14.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="466" PostTypeId="2" ParentId="2" CreationDate="2014-06-25T12:40:49.883" Score="4" Body="&lt;p&gt;As requested, here's a Varnish (3.x) configuration we use:&#xA;&lt;a href=&quot;https://gist.github.com/timkelty/35625a90a6819c8f7927&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/timkelty/35625a90a6819c8f7927&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one setup for ExpressionEngine, but the only thing there really specific to that is the EE_PURGE request portion, which makes it work with: &lt;a href=&quot;https://github.com/kevincupp/purge.ee2_addon&quot; rel=&quot;nofollow&quot;&gt;https://github.com/kevincupp/purge.ee2_addon&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have it set up so site.com:8080 is the un-varnished port, so you can check updated content with necessarily clearing the Varnish cache.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-25T12:40:49.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="467" PostTypeId="1" AcceptedAnswerId="471" CreationDate="2014-06-25T13:32:20.573" Score="3" ViewCount="990" Body="&lt;p&gt;Currently using a date picker to select a date and submit it on user registration, formatted as &lt;strong&gt;m/d/Y&lt;/strong&gt;, have played with various formats but can't one that works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="158" LastEditorUserId="250" LastEditDate="2014-10-03T16:05:59.790" LastActivityDate="2016-02-25T17:44:30.093" Title="How do you format a date for saving with users/saveUser on the front end?" Tags="&lt;users&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="468" PostTypeId="1" CreationDate="2014-06-25T15:00:20.943" Score="5" ViewCount="244" Body="&lt;p&gt;Recently got tripped up with plugin routing due to casing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems when you're in the control panel, your &quot;plugin handle&quot; is lower-cased in routes, though both seem to work: &lt;code&gt;/cp/settings/plugins/myplugin&lt;/code&gt; (/cp/settings/plugins/myPlugin` also works)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when using an controller action, it seems like it must be camel cased (&lt;code&gt;/actions/myPlugin/foo&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems inconsistent, unless I'm missing some reasoning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot;&gt;docs&lt;/a&gt; say &lt;code&gt;[PluginHandle]/[ControllerName]/[ActionName]&lt;/code&gt;, but it seems like it's actually &lt;code&gt;[pluginHandle]/[controllerName]/[actionName]&lt;/code&gt; as the example shows (&lt;code&gt;cocktailRecipes/ingredients/saveIngredient&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-25T16:21:32.987" Title="Plugin routing casing: camel, lower, Pascal" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;controller&gt;&lt;uppercase&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="469" PostTypeId="1" AcceptedAnswerId="476" CreationDate="2014-06-25T15:37:41.493" Score="1" ViewCount="483" Body="&lt;p&gt;We are building a simple user import plugin, saving the basic user is easy enough but how does one save data to the custom fields added to users&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic exmaple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;status = UserStatus::Active;&#xA;$user-&amp;gt;firstName = 'Fruit';&#xA;$user-&amp;gt;lastName = 'Studios';&#xA;$user-&amp;gt;email = 'email@domain.com';&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works great but i cant work out how I add the custom fields?? The following will abviously not work because 'postCode' is not part of the User Model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;postCode = 'SO23 9UG';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2014-06-25T17:02:33.757" Title="How do you save custom fields along with the user/saveUser action?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="470" PostTypeId="2" ParentId="468" CreationDate="2014-06-25T16:00:04.457" Score="3" Body="&lt;p&gt;This is the general rule of thumb...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Lower (myplugin)&lt;/strong&gt; - When creating links for the browser to follow (&quot;href&quot; &amp;amp; &quot;src&quot;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Camel (myPlugin)&lt;/strong&gt; - When creating a path for PHP to interpret (like calling an action)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Pascal (MyPlugin)&lt;/strong&gt; - Almost never. Only for naming plugin components. (ie: MyPluginService)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's the logic behind lower vs. camel... If it's an &quot;href&quot; or &quot;src&quot; for your browser to follow, you're basically referring to the &lt;strong&gt;folder name&lt;/strong&gt; which contains your plugin. If it's a reference for PHP to interpret, that information is used to trigger a part of your plugin by &lt;strong&gt;class name&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a controller action (&lt;code&gt;/actions/myPlugin/foo&lt;/code&gt;), that path &lt;strong&gt;starts&lt;/strong&gt; as a normal browser path, until &lt;code&gt;actions&lt;/code&gt; gets interpreted by your root &lt;code&gt;index.php&lt;/code&gt; file. Once the index file parses out the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#actionTrigger&quot; rel=&quot;nofollow&quot;&gt;actionTrigger&lt;/a&gt;, the rest of the path is handled via PHP.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-25T16:21:32.987" LastActivityDate="2014-06-25T16:21:32.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="471" PostTypeId="2" ParentId="467" CreationDate="2014-06-25T16:21:35.983" Score="8" Body="&lt;p&gt;Craft stores dates in the database in the following format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y-m-d H:i:s&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So submitting the date in this format should work, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014-06-24 23:30:00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should also be possible to split the date and time into individual fields as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[customFieldName][date]&quot; value=&quot;2014-06-24&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[customFieldName][time]&quot; value=&quot;23:30:00&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="12" LastEditDate="2016-02-25T17:44:30.093" LastActivityDate="2016-02-25T17:44:30.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="472" PostTypeId="1" AcceptedAnswerId="473" CreationDate="2014-06-25T16:29:07.573" Score="6" ViewCount="6243" Body="&lt;p&gt;I try to write a row in which there are two columns:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{# and so on and so on #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now maybe there is only one &lt;code&gt;block_txt&lt;/code&gt; div at the end so I try to wrap the row tag in a &lt;code&gt;devisibleby&lt;/code&gt; conditional to only write the row tag every second time, or at the end.&#xA;It looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in entriesInYear %}&#xA;   {% if loop.index is divisibleby(2) or loop.first %}&amp;lt;div class=&quot;row&quot;&amp;gt;{% endif %}&#xA;      &amp;lt;div class=&quot;block_txt&quot;&amp;gt;This gets repeated n times&amp;lt;/div&amp;gt;&#xA;   {% if loop.index is divisibleby(2) or loop.last  %}&amp;lt;/div&amp;gt;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work the way I want. Every third block_txt isn't wrapped in a row. How do I have to math this? Or is there a better way to write the whole piece?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="115" LastEditDate="2014-06-26T06:33:42.823" LastActivityDate="2014-06-26T06:33:42.823" Title="How do I use divisibleby() in a for loop to display two columns?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="473" PostTypeId="2" ParentId="472" CreationDate="2014-06-25T16:33:35.150" Score="13" Body="&lt;p&gt;Instead of using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/divisibleby.html&quot;&gt;&lt;code&gt;divisibleby&lt;/code&gt;-function&lt;/a&gt; you can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/batch.html&quot;&gt;&lt;code&gt;batch&lt;/code&gt;-filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for row in entriesInYear|batch(2) %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for entry in row %}&#xA;        &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have 3 entries in &lt;code&gt;entriesInYear&lt;/code&gt; this code would output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-25T16:48:12.297" LastActivityDate="2014-06-25T16:48:12.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="474" PostTypeId="1" AcceptedAnswerId="486" CreationDate="2014-06-25T16:40:38.647" Score="2" ViewCount="2128" Body="&lt;p&gt;I'm trying to put together a plugin that allows for SAML authentication with Craft. We're working on a site that will be locked down but employees will be able to authenticate to the site using SAML. I came across a SAML toolkit from Onelogin that does the job and was able to get it configured and working outside of craft. With SAML you are not sending a username and password. It authenticates by redirecting the user to the Identity Provider(in this case the client's Proxy Server) and they enter user and password information there, and then the Provider issues a token that gets sent to the Service Provider(Our Craft Site) to allow them in. So far it's working pretty well and I'd like to get it integrated with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few things I'm getting stuck on being new to Craft and also Yii. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we're not dealing with conventional users, is there a hook that I can use to establish a session that Craft understands but base it on the SAML attributes? Is extending userSessionService the way to go with that or should I be looking at creating a custom session? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to lock every page down on the front end and only show it if the user has authenticated. I've seen a few other plugins using the init function and if(craft()-&gt;request-&gt;isSiteRequest()). I've tried that and it works pretty well. Is this the way to go or should I be looking at something else? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do keep the authorization code in init, should I be offloading the heavy lifting to a Service? I'm already thinking about creating some controller actions for login and logoff along with registering some routes in the CP. That way I could include links on the front end for that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, new to Craft. Any guidance would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="405" LastActivityDate="2014-06-25T22:45:18.097" Title="Need help with plugin for SAML authentication" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="475" PostTypeId="2" ParentId="440" CreationDate="2014-06-25T16:44:14.503" Score="5" Body="&lt;p&gt;Not quite sure what happened here; Brandon over at EngineHosting re-ran the installation and now I see my info in RPM.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for future New Relic users that want to integrate with Craft on EngineHosting - at its most basic, ask EH to get New Relic installed for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exciting!  Thanks @joshangell for the help.  Sometimes knowing it should &lt;em&gt;just work&lt;/em&gt; is the key. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;__&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Editing as requested.  &lt;a href=&quot;http://enginehosting.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;EngineHosting&lt;/a&gt; fully manages my site/server.  I don't have root via SSH so asked them to get the New Relic PHP agent installated (the agent installation requires root).  EH did install NR for me, but the first installation did not work and I do not know why.  When EngineHosting re-ran the installation, the PHP agent worked and Craft (and other PHP apps, mostly the 'index.php' file for each) started reporting to APM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not helpful for people on cPanel or Plesk hosts, admittedly, nor is it helpful for people with root access doing their own installations.  But if you can get the New Relic PHP agent installed where Craft is, then it will report to APM.  Looking forward to getting more specific metrics from Craft to New Relic down the line, but that is not likely to come from me :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With that very basic installation I get information like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZUdYw.png&quot; alt=&quot;Craft in NR APM&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2014-07-12T19:40:04.007" LastActivityDate="2014-07-12T19:40:04.007" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="476" PostTypeId="2" ParentId="469" CreationDate="2014-06-25T17:02:33.757" Score="4" Body="&lt;p&gt;Got it, just need to use the getContent() function exactly the same as entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'postCode' =&amp;gt; 'SO23 9UG',&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2014-06-25T17:02:33.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="477" PostTypeId="1" AcceptedAnswerId="484" CreationDate="2014-06-25T17:24:07.183" Score="6" ViewCount="552" Body="&lt;p&gt;I'm currently adding messages to the log when an error occurs in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm wondering what such a message should contain, to provide useful information to developers and end-users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently my logged errors/warnings look like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;functionName&quot;: A simple explaination of the error:&#xA;  &quot;$related_var&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actual example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;_getUserGroupUsers&quot;: No Users found in UserGroups with ID: &quot;1, 2&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something a developer/user checking the logs would find useful, or should more information be passed? If so, what else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also are you just logging errors/warnings or also valid operations (something like a StackTrace)?&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2016-09-13T19:11:45.753" Title="What are the best-practices for useful logging messages?" Tags="&lt;plugin-development&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="478" PostTypeId="1" AcceptedAnswerId="483" CreationDate="2014-06-25T17:25:48.453" Score="7" ViewCount="1885" Body="&lt;p&gt;Basically, I'm trying to emulate &lt;code&gt;show_error&lt;/code&gt; from EE/CI: &lt;a href=&quot;http://ellislab.com/codeigniter/user-guide/general/errors.html&quot;&gt;http://ellislab.com/codeigniter/user-guide/general/errors.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to just use the generic Craft error template (&lt;code&gt;/craft/app/templates/error.html&lt;/code&gt;), like what happens if you have a DB connection error, and have it serve a 500.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is from with a plugin controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to do that?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-27T16:25:09.090" Title="Render generic message/error template from plugin" Tags="&lt;plugin-development&gt;&lt;error-templates&gt;&lt;error-message&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="479" PostTypeId="2" ParentId="478" CreationDate="2014-06-25T17:35:18.047" Score="2" Body="&lt;p&gt;This will do it, and you can change the 400 to whatever type of &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_HTTP_status_codes&quot; rel=&quot;nofollow&quot;&gt;http error&lt;/a&gt; you want:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;throw new HttpException(400, 'Error message text');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-27T16:25:09.090" LastActivityDate="2014-06-27T16:25:09.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="480" PostTypeId="2" ParentId="309" CreationDate="2014-06-25T18:29:48.860" Score="1" Body="&lt;p&gt;I have a plugin that clears the cache from outside the control panel, I'm sure its possible to rebuild the cache using the same type of approach. Here is a link to my plugin if you need a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/themccallister/craft.cache-clear&quot; rel=&quot;nofollow&quot;&gt;https://github.com/themccallister/craft.cache-clear&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without looking at the code, it may be possible to clear the cache and then immediate build it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I agree with the majority that this should NOT be a core feature of Craft. Craft is focused on content and extensibility so adding more and more to the core is not in their, or our, best interest.&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-06-25T18:29:48.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="481" PostTypeId="2" ParentId="478" CreationDate="2014-06-25T18:50:36.587" Score="2" Body="&lt;p&gt;Craft itself (I'm referencing the EntriesController) checks to see if an entry is saved. If it doesn't it, points back to the template and hands it an error message in the session and any needed variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of your plugin, gather your form data and errors and send it back. Craft does it all in a single Model. You can do the same or different. It doesn't matter so long as those using the plugin knows what's up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example based on a Craft Controller (with optional Ajax response):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest())&#xA;{&#xA;    $this-&amp;gt;returnJson(array(&#xA;        'errors' =&amp;gt; $errors,&#xA;    ));&#xA;}&#xA;else&#xA;{&#xA;    $userSessionService-&amp;gt;setError(Craft::t('Error Message!'));&#xA;&#xA;    // Send the data back to the template.&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'data' =&amp;gt; $data,&#xA;        'errors' =&amp;gt; $errors,&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-25T18:50:36.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="482" PostTypeId="1" CreationDate="2014-06-25T19:27:40.713" Score="6" ViewCount="779" Body="&lt;p&gt;I'm writing some pretty huge articles consisting of multiple (80+) Matrix blocks of various types. They're so long they'd benefit from in-article navigation for skip-links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WordPress has a plugin called autogen_menu which creates linked navigation from the header hierarchy in a post. You just put in a small snippet where you want the generated nav to go and it generates all the links (and presumably id's on the headers) itself. Has Craft got anything similar, I've not been able to find a plugin that does this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, would this be better outside of Craft entirely and done as JS?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-02-06T12:12:34.447" Title="Automatic in-page navigation plugin?" Tags="&lt;navigation&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="483" PostTypeId="2" ParentId="478" CreationDate="2014-06-25T19:29:15.583" Score="9" Body="&lt;p&gt;I'm not familiar with EE's show_error, but a plugin's error template logic is identical to the logic that Craft uses to determine what to display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your plugin, if you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new HttpException($statusCode, $optionalMessage)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $statusCode is 404 or 400, or any proper &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_HTTP_status_codes&quot; rel=&quot;noreferrer&quot;&gt;http status code&lt;/a&gt;, Craft will load the corresponding 404.html, 400.html, etc. from the craft/app/templates folder displaying the optional message, or the more generic message supplied in the template if no optional one is provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you have supplied your own 404, 400, etc. from your own craft/templates folder, Craft will display that one instead of the one it provides so you can customize these errors for your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new Exception($optionalMessage)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;noreferrer&quot;&gt;devMode&lt;/a&gt; is enabled, then Craft will load exception.html which will display the full error long with stack trace to help in debugging.  If devMode is not enabled, it will display the more generic error.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft specifically checks for database connection errors and will display the error.html template while setting a 500 status code.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-25T20:38:11.790" LastActivityDate="2014-06-25T20:38:11.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="484" PostTypeId="2" ParentId="477" CreationDate="2014-06-25T19:35:48.950" Score="6" Body="&lt;p&gt;If you're throwing Exceptions from your plugin, then those will automatically get logged in Craft's log files at craft/storage/runtime/logs with full stack trace information, so there is no need for extra logging there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In you're using &lt;code&gt;Craft::log&lt;/code&gt; or &lt;code&gt;PluginHandlePlugin::log&lt;/code&gt; statements, and you set &lt;code&gt;LogLevel::Error&lt;/code&gt;, or &lt;code&gt;LogLevel::Warning&lt;/code&gt;, then those messages will get logged regardless if &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; is enabled or not.  &lt;code&gt;LogLevel::Info&lt;/code&gt; and &lt;code&gt;LogLevel::Profile&lt;/code&gt; will only get logged if devMode is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logging the actual method name isn't really necessary because even with devMode disabled, you'll get a few steps in the stack leading up to the message so you can determine where it came from.  You will want to pass in any relevant variable names and values to the log message, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2016-09-13T19:11:45.753" LastActivityDate="2016-09-13T19:11:45.753" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="485" PostTypeId="2" ParentId="482" CreationDate="2014-06-25T19:39:34.650" Score="5" Body="&lt;p&gt;If you just mean to create an anchor-link menu, just use this plugin: &lt;a href=&quot;https://github.com/pixelandtonic/Anchors&quot;&gt;Anchor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to create a multi-site article pagination, you could do it like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a page-break-block to your matrix.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get your entry by the slug's segment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('section_handle').slug( craft.request.getSegment(2) ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a route which redirects to the template, if an additional segment is added, for example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;something/{slug}/{*}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could check with a conditional in your template what lastSegment is passed, and depending on it, show parts of your matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-25T20:12:12.867" LastActivityDate="2014-06-25T20:12:12.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="486" PostTypeId="2" ParentId="474" CreationDate="2014-06-25T19:49:26.060" Score="6" Body="&lt;p&gt;Yii provides a &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CUserIdentity&quot;&gt;CUserIdentity&lt;/a&gt; class that is meant for your typical username/password form/cookie-based authentication.  Craft extends that a bit and uses that in it's own UserIdentity class for logging into the control panel, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But ultimately, Yii's CUserIdentity implements the IUserIdentity interface, which they intend for people to use that want to implement their own custom authentication mechanisms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd probably want to write a SamlUserIdentity class that implements the interface, provides it's own authentication logic (calls the Identity Provider, etc) and handles the interactions between Yii/Craft and SAML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want to enforce an authenticated session from the template, use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to do it from a controller's action, use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requireLogin();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-25T22:45:18.097" LastActivityDate="2014-06-25T22:45:18.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="487" PostTypeId="2" ParentId="482" CreationDate="2014-06-25T19:58:11.350" Score="11" Body="&lt;p&gt;If I'm understanding you correctly, you want users when they visit your site to have a secondary menu that has links to various points in the article. That would actually be very easy to do in Craft. It's also possible for you to paginate a page, but that would be far more in-depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For skip links, you would need to run over the matrix twice. You will also need an anchor matrix block. It can either be a dedicated block for anchor tags, or a header block. You run over it the first time to create your menu:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;article menu&quot;&amp;gt;&#xA;{% for block in entry.articleMatrix.type('header') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ block.header|slugify }}&quot;&amp;gt;{{ block.header }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then later when you are running over your article, you can check for block type and add the id as needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;header&quot; %}&#xA;    &amp;lt;h1 id=&quot;{{ block.header|slugify }}&quot;&amp;gt;{{ block.header }}&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a really basic example. It uses &lt;a href=&quot;https://gist.github.com/boboldehampsink/7354431&quot;&gt;Bob Olde Hampsink's slugify plugin&lt;/a&gt; (it uses Craft's built in slug method). It would be better if you could determine (maybe with a drop down field in your block) what level of heading the block is. I suggest you also cache each matrix loop for performance.&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditDate="2014-06-25T21:24:45.617" LastActivityDate="2014-06-25T21:24:45.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="488" PostTypeId="1" AcceptedAnswerId="489" CreationDate="2014-06-25T20:58:31.973" Score="8" ViewCount="483" Body="&lt;p&gt;I have a plugin returning json from a controller action using &lt;code&gt;$this-&amp;gt;returnJson(...)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works great in production, but when &lt;code&gt;devMode = true&lt;/code&gt;, the json is invalidated because Craft is still dumping the console debugging script at the end of the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to avoid this?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-06-25T21:06:23.190" Title="Console script tags garbling up non-html output (e.g. json) when in devMode" Tags="&lt;plugin-development&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="489" PostTypeId="2" ParentId="488" CreationDate="2014-06-25T21:00:49.797" Score="8" Body="&lt;p&gt;Just remove these two logging routes from your plugin's init() method in your PluginHandlePlugin.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;log-&amp;gt;removeRoute('WebLogRoute');&#xA;craft()-&amp;gt;log-&amp;gt;removeRoute('ProfileLogRoute');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will prevent the extra logging and profiling information to be output in the browser's console when devMode is enabled.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-25T21:06:23.190" LastActivityDate="2014-06-25T21:06:23.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="490" PostTypeId="1" AcceptedAnswerId="501" CreationDate="2014-06-25T21:23:36.717" Score="5" ViewCount="979" Body="&lt;p&gt;When developing a plugin, I am registering routes to controller actions. Other frameworks, read that as Laravel, typically return the controllers response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function showProfile($id)&#xA;{&#xA;    $user = User::find($id);&#xA;&#xA;    return View::make('user.profile', array('user' =&amp;gt; $user));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in Craft to render a template from your controller you would use the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPluginIndex()&#xA;{&#xA;   $this-&amp;gt;renderTemplate('pluginName/template');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the same time, you can also return the rendered template this way and it functions as expected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPluginIndex()&#xA;{&#xA;   return $this-&amp;gt;renderTemplate('pluginName/template);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at &lt;code&gt;craft/app/controllers/BaseController.php&lt;/code&gt; templateRender method shows that it accepts a parameter &lt;code&gt;return&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the real question is &lt;code&gt;to return or not to return&lt;/code&gt; and I was hoping for a more technical explanation on the way Craft handles this.&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-06-26T05:46:50.203" Title="Should my controllers actions 'return' when rendering templates?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;controller&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="491" PostTypeId="1" AcceptedAnswerId="493" CreationDate="2014-06-25T21:25:52.270" Score="12" ViewCount="2026" Body="&lt;p&gt;I've created a plain text-field and added this field into a section.&#xA;I then created an entry and filled it with content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can output the content of the field in my template with &lt;code&gt;{{ entry.field_handle }}&lt;/code&gt;, but is it also possible to display the field name? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="312" LastEditorUserId="115" LastEditDate="2014-06-26T09:16:32.610" LastActivityDate="2014-06-26T09:16:32.610" Title="How can I output the Field Name in my template?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="492" PostTypeId="1" AcceptedAnswerId="494" CreationDate="2014-06-25T21:30:27.013" Score="13" ViewCount="11224" Body="&lt;p&gt;When I upload an asset I get an alert window stating my file size is to large. I have increased the file size in the general.php config file larger than the file size, however I keep getting a error. We are using AmazonS3. Is Craft limiting the file size, PHP or AmazonS3?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-11-22T16:25:03.630" Title="When uploading assets what determines the maximum file size?" Tags="&lt;assets&gt;&lt;config&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="493" PostTypeId="2" ParentId="491" CreationDate="2014-06-25T21:30:49.953" Score="14" Body="&lt;p&gt;You can get any field with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.fields&quot;&gt;craft.fields&lt;/a&gt;, which returns a FieldModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.fields.getFieldbyHandle('field_handle') %}&#xA;{{ field.name }}&#xA;{{ field.instructions }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is no documentation on the FieldModel yet, but if you want to know more, take a look at &lt;code&gt;craft/app/models/FieldModel.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a list of all attributes supported by the Model:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;groupId&lt;/li&gt;&#xA;&lt;li&gt;name&lt;/li&gt;&#xA;&lt;li&gt;handle&lt;/li&gt;&#xA;&lt;li&gt;context&lt;/li&gt;&#xA;&lt;li&gt;instructions &lt;/li&gt;&#xA;&lt;li&gt;required&lt;/li&gt;&#xA;&lt;li&gt;translatable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-25T21:30:49.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="494" PostTypeId="2" ParentId="492" CreationDate="2014-06-25T21:55:06.153" Score="8" Body="&lt;p&gt;It's most likely PHP. Most PHP installations come standard with a 2M limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out this &lt;a href=&quot;https://stackoverflow.com/questions/3263480/upload-max-size-in-php&quot;&gt;Stack Overflow thread&lt;/a&gt; for more information on what needs to be adjusted.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-10-21T19:17:17.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="495" PostTypeId="2" ParentId="492" CreationDate="2014-06-25T21:59:42.813" Score="11" Body="&lt;p&gt;It's almost always an environmental limitation.  The most common culprits are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) PHP's memory_limit setting: &lt;a href=&quot;http://us3.php.net/manual/en/ini.core.php#ini.memory-limit&quot;&gt;http://us3.php.net/manual/en/ini.core.php#ini.memory-limit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) PHP's post_max_size: &lt;a href=&quot;http://us3.php.net/manual/en/ini.core.php#ini.post-max-size&quot;&gt;http://us3.php.net/manual/en/ini.core.php#ini.post-max-size&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) PHP's upload_max_filesize &lt;a href=&quot;http://us3.php.net/manual/en/ini.core.php#ini.upload-max-filesize&quot;&gt;http://us3.php.net/manual/en/ini.core.php#ini.upload-max-filesize&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These default values vary per host/installation, but try increasing them in your php.ini file. You may or may not need to restart your web server in order for the new settings to take affect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your specific case, if those aren't the culprit, then I'd check either S3's upload limitation settings or Craft's own &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxUploadFileSize&quot;&gt;maxUploadFileSize&lt;/a&gt; config setting, which we default to 16MB.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-25T21:59:42.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="496" PostTypeId="2" ParentId="492" CreationDate="2014-06-25T21:59:57.283" Score="14" Body="&lt;p&gt;&lt;strong&gt;Craft&lt;/strong&gt; itself, limits the filesize only in the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxUploadFileSize&quot;&gt;&lt;code&gt;maxUploadFileSize&lt;/code&gt;&lt;/a&gt;. Default: 16MB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However Craft gets limited by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP:&lt;/strong&gt; Has a few values which might cause the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.php.net/manual/de/ini.core.php#ini.memory-limit&quot;&gt;memory_limit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.php.net/manual/en/info.configuration.php#ini.max-input-time&quot;&gt;max_input_time&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize&quot;&gt;upload_max_filesize&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.php.net/manual/en/ini.core.php#ini.post-max-size&quot;&gt;post_max_size&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;AmazonS3:&lt;/strong&gt; If not limited by a &lt;a href=&quot;http://aws.amazon.com/articles/1434&quot;&gt;&lt;code&gt;policy&lt;/code&gt; value&lt;/a&gt;, the default is 5GB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;User:&lt;/strong&gt; Sometimes it can be just a Browser issue causing the problem.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-25T21:59:57.283" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="497" PostTypeId="1" AcceptedAnswerId="500" CreationDate="2014-06-25T22:51:05.943" Score="5" ViewCount="384" Body="&lt;p&gt;I have a plugin which creates a task every time a specify form is submited. Now I want to create a WrapperTask and run each of those tasks as a subTask:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4BfXm.jpg&quot; alt=&quot;Craft Task with running sub tasks&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can create a sub-task within the WrapperTask by using &lt;code&gt;$this-&amp;gt;runSubTask&lt;/code&gt;, but how can I add a subTask to an already running WrapperTask from outside (the service for example)? Or at least send a new settings-array to an already running Task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User submits form&lt;/li&gt;&#xA;&lt;li&gt;Service creates WrapperTask&lt;/li&gt;&#xA;&lt;li&gt;Service adds subTask to WrapperTask&lt;/li&gt;&#xA;&lt;li&gt;Nothing happens for some time&lt;/li&gt;&#xA;&lt;li&gt;User submits form again&lt;/li&gt;&#xA;&lt;li&gt;Service checks if WrapperTask is still running, and adds subTask&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not possible, can I at least show them visually as subtasks of my plugin in the task-list?&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-26T15:36:45.467" LastActivityDate="2014-06-26T19:28:28.550" Title="How to add a subTask to an already running Task?" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="498" PostTypeId="2" ParentId="482" CreationDate="2014-06-25T22:59:40.647" Score="2" Body="&lt;p&gt;I'm not sure I fully understand what you are trying to do, but I think this may apply as an option to consider.  Matrix Blocks are Element Types and the {% paginate %} tag works with all Element Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could treat your blocks as you would a section with entries, and paginate them.  A simple example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate entry.articleMatrix.limit(3) as blocks %}&#xA;&#xA;  {% for block in blocks %}&#xA;&#xA;    {# Display all your blocks output as needed #}&#xA;    &amp;lt;div class=&quot;block {{ block.type }}&quot;&amp;gt;&#xA;      {% include &quot;_partials/blocks/&quot; ~ block.type %}   &#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% if paginate.prevUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow&quot;&gt;Pagination in the Craft Docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-25T22:59:40.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="499" PostTypeId="2" ParentId="472" CreationDate="2014-06-26T04:46:20.117" Score="10" Body="&lt;p&gt;If you wish to use divisibleby to solve this problem, the key is in how you use the &lt;code&gt;loop.index&lt;/code&gt; and &lt;code&gt;loop.index0&lt;/code&gt; variables.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;loop.index&lt;/code&gt; counts the iterations in your loop starting with the number 1&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;loop.index0&lt;/code&gt; counts the iterations in your loop starting with the number 0&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can test this with an odd number of items using the range function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop 3 times  #}&#xA;{% for i in 1..3 %}&#xA;&#xA;  {# If index0 is divisible by 2, output the starting row #}&#xA;  {% if loop.index0 is divisible by(2) %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;  {% endif %}&#xA;&#xA;    {# Output the content #}&#xA;    &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;  {# If index is divisible by 2, output the ending row, and&#xA;     if it is the last loop, make sure we close the open row regardless #}&#xA;  {% if loop.index is divisible by(2) or loop.last %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}﻿&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And will get your desired output and ensure your last row div element gets closed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;       &#xA;    &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more on the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;noreferrer&quot;&gt;Twig loop variable&lt;/a&gt; and the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/range.html&quot; rel=&quot;noreferrer&quot;&gt;Twig range function&lt;/a&gt; in the Twig docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your use case, you can then just update the range function to use the variable you need to loop through:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entriesInYear %}&#xA;&#xA;  {% if loop.index0 is divisible by(2) %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;  {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;block_txt&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;  {% if loop.index is divisible by(2) or loop.last %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}﻿&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-26T04:46:20.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="500" PostTypeId="2" ParentId="497" CreationDate="2014-06-26T05:41:24.563" Score="7" Body="&lt;p&gt;Sub-tasks can only be initiated by the parent task, and they will only visually look like a sub-task if they are actually sub-tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s also not possible to change the settings of an already-running task, at least without manually checking for new settings in your task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your parent task’s &lt;code&gt;getStep()&lt;/code&gt; function would need to do its own checking to see if it should be running a sub-task, somehow, and then conditionally call &lt;code&gt;$this-&amp;gt;runSubTask()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-06-26T19:28:28.550" LastActivityDate="2014-06-26T19:28:28.550" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="501" PostTypeId="2" ParentId="490" CreationDate="2014-06-26T05:46:50.203" Score="5" Body="&lt;p&gt;There’s no reason for your controller to return anything – it will never be checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many requests call more than one controller action, so it would be pretty presumptuous for Craft to think that it should actually output whatever your controller returns, and end the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, it’s up to the actual controller to do the outputting, and end the request, if that’s what it wants to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$this-&amp;gt;renderTemplate()&lt;/code&gt; comes from BaseController, and it’s basically a wrapper for &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render()&lt;/code&gt;, except that after calling that, it will also set the Content-Type header for the request, insert any queued-up JS and CSS, and then end the request.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-26T05:46:50.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="502" PostTypeId="1" CreationDate="2014-06-26T05:53:11.143" Score="6" ViewCount="1646" Body="&lt;p&gt;I'm converting a WordPress blog to Craft - first time playing with categories in Craft, so how can I display the related posts (by category) at the bottom of each post? &lt;/p&gt;&#xA;" OwnerUserId="296" LastEditorUserId="115" LastEditDate="2014-06-26T09:16:25.667" LastActivityDate="2016-04-10T14:35:28.917" Title="How can I display the related posts (by category) at the bottom of each post?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="503" PostTypeId="1" AcceptedAnswerId="504" CreationDate="2014-06-26T06:01:02.310" Score="7" ViewCount="309" Body="&lt;p&gt;With dev mode on, I'm getting a warning there is no entry.title, which I know about already because that's what I'm testing for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.title | length == 0 %}&#xA;    {% set entry = craft.entries.section('sectionname').slug(craft.request.segment(2)).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to test for a variable without dev mode triggering this notice?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="57" LastEditDate="2017-02-17T16:38:25.397" LastActivityDate="2017-02-17T16:38:25.397" Title="Avoid notice of variable's not being set within dev mode" Tags="&lt;conditional&gt;&lt;variable&gt;&lt;devmode&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="504" PostTypeId="2" ParentId="503" CreationDate="2014-06-26T06:10:11.430" Score="12" Body="&lt;p&gt;I've had luck using &quot;is defined&quot; before using other logic operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.title is defined and entry.title | length == 0 %}&#xA;    {% set entry = craft.entries.section('sectionname').slug(craft.request.segment(2)).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="26" LastActivityDate="2014-06-26T06:10:11.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="505" PostTypeId="2" ParentId="502" CreationDate="2014-06-26T06:42:54.967" Score="4" Body="&lt;p&gt;This can be accomplished using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;Relations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;My example code assumes you know the blog categories slug, and that you are pulling posts from a single category.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you'll have to get a reference to the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot; rel=&quot;nofollow&quot;&gt;category ElementCriteriaModel&lt;/a&gt; object pointing to the category of the blog post.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('your-category-slug').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With a reference to the category model, you'll be able to find related entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in craft.entries.section('blog').relatedTo({targetElement: category}) %}&#xA;    {% if post.id != entry.id %}&#xA;        &amp;lt;div class=&quot;related-entry&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ post.title }}&amp;lt;/h2&amp;gt;&#xA;            {{ post.body }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The if statement makes sure you aren't including the current post with the related posts.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2014-06-26T16:52:14.787" LastActivityDate="2014-06-26T16:52:14.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="506" PostTypeId="1" AcceptedAnswerId="507" CreationDate="2014-06-26T06:55:05.443" Score="2" ViewCount="96" Body="&lt;p&gt;My plugin has a field type. When I'm editing an entry which uses that field type, this message gets logged to the console:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Element was added to more than one selector&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can tell that it's Garnish which is generating this message, but &lt;strong&gt;what does it mean?&lt;/strong&gt; Is it a problem that needs to be fixed? And if so, how would I go about fixing it?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-26T07:25:00.840" Title="Is this Garnish message bad? &quot;Element was added to more than one selector&quot;" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="507" PostTypeId="2" ParentId="506" CreationDate="2014-06-26T07:25:00.840" Score="4" Body="&lt;p&gt;That message comes from from &lt;a href=&quot;https://github.com/pixelandtonic/Garnish/blob/master/Source/classes/Select.js&quot; rel=&quot;nofollow&quot;&gt;Garnish.Select&lt;/a&gt;, when the same DOM element is associated with two separate Garnish.Select instances. The JS will log that message right before destroying the first Garnish.Select instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s not necessarily a bad thing, but could be an indication of something in your JS that could be improved. (Craft’s own JS causes several of those messages, so don’t worry too much about it if everything seems to be working correctly.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-26T07:25:00.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="508" PostTypeId="1" AcceptedAnswerId="514" CreationDate="2014-06-26T07:35:46.807" Score="7" ViewCount="1821" Body="&lt;p&gt;When I navigate to [home]/news/2014/poster my relative links to stylesheets break. I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;css/myStylesheet.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I stop these links breaking in this scenario?&lt;/p&gt;&#xA;" OwnerUserId="393" LastEditorUserId="125" LastEditDate="2014-06-26T07:47:29.190" LastActivityDate="2016-01-28T20:10:39.613" Title="How do I stop my relative links to stylesheets breaking?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="509" PostTypeId="2" ParentId="508" CreationDate="2014-06-26T07:40:14.610" Score="4" Body="&lt;p&gt;You need to make the url absolute, or relative to the root. The url() function will help you to keep this maintainable. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('assets/build/css/main.css') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will prepend the {{ siteUrl }} to the path, so if you move the site later, or are running in a multi environment setup, the path will be updated. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-06-26T07:40:14.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="510" PostTypeId="1" AcceptedAnswerId="511" CreationDate="2014-06-26T08:33:39.253" Score="6" ViewCount="298" Body="&lt;p&gt;I have a site which allows people to register as a member from the front end. I've got a bunch of fields attached to the User so that each person can build their own extended profile page; the site is bilingual. I've successfully got fields translatable when they're attached to a Section (the fields are marked as translatable), but when the same fields are attached to User there appears to be no way to input content in a different language; the familiar language switch in the back-end is not there... what am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., here is the biography field, marked as translatable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EdMQ0.png&quot; alt=&quot;translatable-field&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the result when the field is used in a Section (note the interface has a language switch on the right, which can be toggled and the contents of the biography field changes):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3IWm6.png&quot; alt=&quot;translatable-field-in-a-section&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here is the same field when used in a User, note the lack of a way to change the language:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Spyq.png&quot; alt=&quot;translatable-field-in-a-user&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus Question:&lt;/strong&gt;&#xA;Assuming these fields are translatable; how would I get the front-end user form to list the fields in both English and Welsh so the user could fill in both on one page (i.e., without them needing to switch the site itself into another language)?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="6007" LastEditDate="2019-01-09T11:42:53.340" LastActivityDate="2019-01-09T11:42:53.340" Title="Fields applied to the User area are not translatable?" Tags="&lt;users&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="511" PostTypeId="2" ParentId="510" CreationDate="2014-06-26T09:31:08.460" Score="3" Body="&lt;p&gt;You're not missing anything; user content is currently not translatable. (It's up to each type of element whether it wants to support translatable content, and we felt that 99% of the time it would not be desirable for users to have translatable profiles.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-26T09:31:08.460" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="512" PostTypeId="1" AcceptedAnswerId="513" CreationDate="2014-06-26T09:37:17.107" Score="6" ViewCount="377" Body="&lt;p&gt;I am trying to get a random entry which has the &lt;code&gt;quote&lt;/code&gt; matrix field populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('entries').quote(':notempty:').order('RAND()').limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That isn't working. What do I need to do?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2014-06-26T09:40:02.330" Title="Return entry where matrix field is not empty" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="513" PostTypeId="2" ParentId="512" CreationDate="2014-06-26T09:40:02.330" Score="7" Body="&lt;p&gt;Currently the only way to find entries that have Matrix rows is with the &lt;code&gt;search&lt;/code&gt; param:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('entries').search('quote:*').order('RAND()').limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-26T09:40:02.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="514" PostTypeId="2" ParentId="508" CreationDate="2014-06-26T09:59:04.327" Score="11" Body="&lt;p&gt;The links aren't working because that's a relative URL, from whatever the last &quot;directory&quot;-looking segment in your page's URL is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To resolve this, you can either make your URLs root-relative:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;/css/myStylesheet.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or relative to the site URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;{{ siteUrl }}css/myStylesheet.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The drawback to root-relative URLs is, it makes your site a little less portable - you'll only be able to install the site in a web root (no subfolders) without having to update all URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a localized site with multiple site URLs, then both solutions could have issues. In that case it might make sense to define your own custom config setting in craft/config/general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'baseResourceUrl' =&amp;gt; &quot;http://example.com/&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then call glad from your templates instead of &lt;code&gt;siteUrl&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;{{ craft.config.baseResourceUrl }}css/myStylesheet.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="45" LastEditDate="2016-01-28T20:10:39.613" LastActivityDate="2016-01-28T20:10:39.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="515" PostTypeId="1" AcceptedAnswerId="517" CreationDate="2014-06-26T14:58:39.333" Score="2" ViewCount="491" Body="&lt;p&gt;I'm trying to create a condensed overview of my website content on my homepage. I'd like that page to loop through all sections, in each section looping through the categories that apply to the section, and for each category to pull the title, uri, and excerpt of the newest three entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble wrapping my head around how I'd do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm after might be seen as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;SECTION&#xA;  CATEGORY 1 [title, description, view category archive]&#xA;    POST 1 [title, excerpt, publication date, view entry]&#xA;    POST 2 [title, excerpt, publication date, view entry]&#xA;    POST 3 [title, excerpt, publication date, view entry]&#xA;  CATEGORY 2 [title, description, view category archive]&#xA;    POST 1 [title, excerpt, publication date, view entry]&#xA;    POST 2 [title, excerpt, publication date, view entry]&#xA;    POST 3 [title, excerpt, publication date, view entry]&#xA;SECTION 2&#xA;  CATEGORY 1 [title, description, view category archive]&#xA;    POST 1 [title, excerpt, publication date, view entry]&#xA;    POST 2 [title, excerpt, publication date, view entry]&#xA;    POST 3 [title, excerpt, publication date, view entry]&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the sake of simplicity, all my categories are currently under a 'global' group. They also map pretty much 1:1 to the EntryTypes available in each section. (I'm not entirely convinced I'm using Categories / EntryTypes correctly, given that 1:1 relation... in fact that's another question to ask).&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="250" LastEditDate="2014-07-08T22:10:02.063" LastActivityDate="2014-07-08T22:10:02.063" Title="How to list the latest 3 entries per category per section?" Tags="&lt;categories&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="516" PostTypeId="1" AcceptedAnswerId="518" CreationDate="2014-06-26T15:08:18.887" Score="4" ViewCount="1077" Body="&lt;p&gt;bit of a 'best practice' question, as I'm very sure there are many ways to do this sort of thing, but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When/how do you decide whether to use a section, category, or entry type to organise your entries? I've been finding that my EntryTypes match 1:1 to the categories in my 'global' group, and that's lead me to wonder if there's any point in having them as global categories too, and whether I'm just not understanding how to use these tools properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I've got sections: webDevelopment, generalWriting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And categories (in a global group): Article, Tutorial, Links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And EntryTypes in each section: Article, Tutorial, Links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's starting to look like there's little point in having global categories, but &lt;em&gt;not&lt;/em&gt; having categories feels very weird / wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So... how do you decide how to organise your stuff?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-06-26T15:45:34.420" Title="Sections, Categories, and EntryTypes. Which, when?" Tags="&lt;categories&gt;&lt;entry-type&gt;&lt;best-practice&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="517" PostTypeId="2" ParentId="515" CreationDate="2014-06-26T15:34:28.443" Score="4" Body="&lt;p&gt;You need to loop over the sections. In each section, you then loop over the categories, and display your entries inside them. Something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('groupHandle').find() %}&#xA;{% for section in craft.sections.getAllSections() %}&#xA;    {% if section.type == 'channel' %}&#xA;        &amp;lt;h1&amp;gt;{{ section.name }}&amp;lt;/h1&amp;gt;&#xA;        {% for category in categories %}&#xA;            &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;            {% for entry in craft.entries.section(section).relatedTo(category).limit(3).find() %}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a pretty quick and dirty example. I pull the categories ahead of time so I can reduce the number of database calls. I suggest using the cache to speed things up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/&quot; rel=&quot;nofollow&quot;&gt;template docs&lt;/a&gt; (especially the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;) are handy reading materials.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-26T15:34:28.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="518" PostTypeId="2" ParentId="516" CreationDate="2014-06-26T15:45:34.420" Score="5" Body="&lt;p&gt;Sections are for completely separate areas of content. They have their own URLs, and are conceptually different. Like blog posts and press releases would be different sections. Your sections could easily be one section with a different set of categories defining web development and general writing. This is entirely up to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories are for separating entries into smaller groups. Your use of categories is correct. You just use it to categorize entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry types are when you have common content that require different field layouts. Think Tumblr and how it has one stream that shows text, pictures, links, and quotes as separate types. For your setup, if no entry will be both an article and a tutorial at the same time, you can remove the tutorial entry type and simply use the article one. Then in your template, use the category to decide how to lay it out. The link has a different field layout so it can stay separate.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-26T15:45:34.420" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="519" PostTypeId="1" AcceptedAnswerId="520" CreationDate="2014-06-26T15:53:41.840" Score="4" ViewCount="119" Body="&lt;p&gt;I've got a generic template that can display entries from different channels. How in the template can I test if a field has been has been assigned to any given channel?&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="250" LastEditDate="2014-07-08T22:05:55.800" LastActivityDate="2014-07-08T22:05:55.800" Title="How can I test if a field has been assigned to a channel?" Tags="&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="520" PostTypeId="2" ParentId="519" CreationDate="2014-06-26T16:02:07.103" Score="8" Body="&lt;p&gt;Twig has a &quot;is defined&quot; test that you can apply to a variable to see if it exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.possibleField is defined %}&#xA;    Yup!&#xA;{% else %}&#xA;    Nope!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow&quot;&gt;more&lt;/a&gt; information on using &lt;code&gt;is defined&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="109" LastEditorUserId="250" LastEditDate="2014-06-26T18:03:46.233" LastActivityDate="2014-06-26T18:03:46.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="521" PostTypeId="1" AcceptedAnswerId="522" CreationDate="2014-06-26T16:20:35.210" Score="8" ViewCount="3694" Body="&lt;p&gt;Looking to explore &lt;strong&gt;solutions for ordering entries in a channel&lt;/strong&gt;. My current ideas are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example purposes let's say this is for recipes and the client wants to be able to pick the &lt;strong&gt;order of recipes by some method other than changing the date&lt;/strong&gt; of the recipe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Add a matrix field, with blocks as entry fields ( for recipes channel ) on the single section (recipes index), where you can select and reorder the entries. Then loop over matrix field to print out the recipes in that order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt; Very easy drag and drop sort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt; Every time a new recipe is added, it as to be manually added to the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Add a custom field to the recipe channel entry as an integer. Use that integer to sort the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt; No extra field on a single section that is somewhat de-coupled from the recipe channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt; As far as I could find, there is no way to add a column to the entries overview page on the backend of Craft, so you would have to go into each entry and make sure to not have duplicates of the same number. If you wanted to add a new entry at spot 5, and you already had 10 entries, that would be very tedious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are brainstorming today, and thinking about what we could make plugin-wise that may add this kind of functionality as well. Will post more info if I come with anything else.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2015-08-21T08:51:04.940" Title="Ordering Entries without using entry date" Tags="&lt;entries&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="522" PostTypeId="2" ParentId="521" CreationDate="2014-06-26T16:35:02.910" Score="18" Body="&lt;p&gt;I'd suggest changing the Recipe section to a &quot;Structure&quot; section type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aKd0O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This lets the client order the entries with a drag and drop from the Entries tab where they can see the whole list of entries during the reordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PbaNl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-26T16:35:02.910" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="523" PostTypeId="1" AcceptedAnswerId="527" CreationDate="2014-06-26T17:23:23.503" Score="2" ViewCount="129" Body="&lt;p&gt;I keep getting this error when I go to install Craft: &quot;Declaration of Craft\UrlManager::parseUrl() should be compatible with that of CUrlManager::parseUrl()&quot;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am installing on a subdomain.  The database credentials are in place, the permissions are correct and the craft folder is found. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have devmode enabled and the last stack trace item is pointing to &quot;craft/app/etc/web/UrlManager.php(18)&quot;. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-06-26T18:58:16.483" Title="PHP error upon installation" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="524" PostTypeId="1" AcceptedAnswerId="525" CreationDate="2014-06-26T17:40:55.550" Score="4" ViewCount="1588" Body="&lt;p&gt;I need to get a list of all the &quot;sizes&quot; from my Table type field column. The list of sizes needs to be separated by a &quot;|&quot;... eg: small|medium|large&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Table type field name is &quot;productAttributes&quot; and the column in that field is &quot;size&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I string together the results of a For Each loop to create a new variable with Twig? &lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-06-26T18:31:15.703" LastActivityDate="2014-06-26T18:31:15.703" Title="How to create new variable from For Loop results" Tags="&lt;variable&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="525" PostTypeId="2" ParentId="524" CreationDate="2014-06-26T17:59:59.003" Score="10" Body="&lt;p&gt;If I understood your question correctly then you should be able to do it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sizes = [] %}&#xA;&#xA;{% for productAttribute in entry.productAttributes %}&#xA;    {% set sizes = sizes|merge([productAttribute.size]) %}&#xA;{% endfor %}&#xA;&#xA;{% set sizes = sizes|join('|') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;sizes&lt;/code&gt; variable will then be a string containing the pipeline separated sizes, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;small|medium|large&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-06-26T17:59:59.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="526" PostTypeId="1" CreationDate="2014-06-26T18:48:08.597" Score="7" ViewCount="4137" Body="&lt;p&gt;I want to load some entries via AJAX. I have a page that normally shows &lt;em&gt;all&lt;/em&gt; entries of a specific type with user-selectable filters. I want to load filtered entries via AJAX. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to create a plugin to do this? If so, how can I use the Craft object in my JavaScript code to call Craft.ajaxActionRequest or Craft.postActionRequest?&lt;/p&gt;&#xA;" OwnerUserId="412" LastEditorUserId="22" LastEditDate="2014-06-27T08:15:51.053" LastActivityDate="2014-06-27T08:15:51.053" Title="Do I need a plugin to load entries via AJAX?" Tags="&lt;entries&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="527" PostTypeId="2" ParentId="523" CreationDate="2014-06-26T18:58:16.483" Score="3" Body="&lt;p&gt;That's a bug in Craft that occurs with the specific configuration of PHP you're running.  Just fixed it for the next release, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you can open up craft/app/etc/web/UrlManager.php, find the parseUrl method and change it from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function parseUrl(HttpRequestService $request)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function parseUrl($request)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-26T18:58:16.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="528" PostTypeId="2" ParentId="526" CreationDate="2014-06-26T19:05:35.187" Score="10" Body="&lt;p&gt;There is a new RESTful plugin which might be what you need: &lt;a href=&quot;https://github.com/wesrice/rest-easy&quot;&gt;Rest-Easy from Wes Rice&lt;/a&gt;.&lt;br&gt;&#xA;But you could also make use of Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot;&gt;extends functionality&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_ajax.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% block ajax %}&#xA;    { success: false }&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends craft.request.isAjax ? &quot;_ajax&quot; : &quot;_main&quot; %}&#xA;&#xA;{% block ajax %}&#xA;    { success: true }&#xA;{% endblock %}&#xA;&#xA;{% block normal %}&#xA;    &amp;lt;p&amp;gt;Normal entry&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you request &lt;code&gt;entry.html&lt;/code&gt; via ajax, the template will extend &lt;code&gt;_ajax.html&lt;/code&gt; instead of &lt;code&gt;_main.html&lt;/code&gt;, and show your json data. In this example &lt;code&gt;_main.html&lt;/code&gt; would be your normal layout-template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Don't forget to set the &lt;code&gt;XMLHttpRequest&lt;/code&gt; in your ajax call.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-26T19:05:35.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="529" PostTypeId="2" ParentId="526" CreationDate="2014-06-26T19:07:41.650" Score="2" Body="&lt;p&gt;You do not need a plugin. You just need to write a template (which may require you to define a custom route in the Control Panel) that returns JSON. You can even feed it GET or POST values and use those as the filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have the template be recognized as JSON, you just need to give the template a '.json' extension. If that doesn't work you can force it with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-26T19:07:41.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="530" PostTypeId="1" AcceptedAnswerId="531" CreationDate="2014-06-26T19:28:32.720" Score="1" ViewCount="230" Body="&lt;p&gt;I'm creating an isotope filter and have the following code. Could someone please help me write an if statement showing the buttons only if any of these entries have content. For instance the CD button if statement would check if the Entry &quot;album&quot; type &quot;cd&quot; and Entry &quot;single&quot; type &quot;cd&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Albums #}&#xA;{% set albumCd = entries.section('album').type('cd') %}&#xA;{% set albumVinyl = entries.section('album').type('vinyl') %}&#xA;{% set albumCassette = entries.section('album').type('cassette') %}&#xA;{% set albumOther = entries.section('album').type('other') %}&#xA;&#xA;{# Singles #}&#xA;{% set singleCd = entries.section('single').type('cd') %}&#xA;{% set singleVinyl = entries.section('single').type('vinyl') %}&#xA;{% set singleCassette = entries.section('single').type('cassette') %}&#xA;{% set singleOther = entries.section('single').type('other') %}&#xA;&#xA;{# Collectable #}&#xA;{% set otherVideo = entries.section('other').type('video') %}&#xA;{% set otherMagazine = entries.section('other').type('magazine') %}&#xA;{% set otherPrint = entries.section('other').type('print') %}&#xA;{% set otherCollectable = entries.section('other').type('collectable') %}&#xA;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;*&quot;&amp;gt;show all&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.CD&quot;&amp;gt;CD&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Vinyl&quot;&amp;gt;Vinyl&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Cassette&quot;&amp;gt;Cassette&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Other&quot;&amp;gt;Other&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Magazine&quot;&amp;gt;Magazine&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Print&quot;&amp;gt;Print&amp;lt;/button&amp;gt;&#xA;&amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.Collectable&quot;&amp;gt;Collectable&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastEditorUserId="57" LastEditDate="2014-06-26T20:47:54.193" LastActivityDate="2014-06-27T16:26:51.670" Title="How do I write an if statement to show Isotope filter button only if the Entry Section has content?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="531" PostTypeId="2" ParentId="530" CreationDate="2014-06-26T19:44:22.687" Score="2" Body="&lt;p&gt;If I understand you correctly this should do the job:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if albumCd|length &amp;gt; 0 or singleCd|length &amp;gt; 0  %}&#xA;    &amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.CD&quot;&amp;gt;CD&amp;lt;/button&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also check out Twig docs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow&quot;&gt;if-statement&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot; rel=&quot;nofollow&quot;&gt;comparison operators&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/index.html&quot; rel=&quot;nofollow&quot;&gt;Filters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-26T19:44:22.687" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="532" PostTypeId="2" ParentId="530" CreationDate="2014-06-26T20:18:21.737" Score="3" Body="&lt;p&gt;Here's just a variation on the conditional that Victor provided that will do the same thing, might be a bit cleaner if you ever need to check several arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if albumCd|merge(singleCd)|length  %}&#xA;    &amp;lt;button class=&quot;filt btn&quot; type=&quot;button&quot; data-filter=&quot;.CD&quot;&amp;gt;CD&amp;lt;/button&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-27T16:26:51.670" LastActivityDate="2014-06-27T16:26:51.670" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="533" PostTypeId="1" AcceptedAnswerId="534" CreationDate="2014-06-26T20:22:32.977" Score="2" ViewCount="336" Body="&lt;p&gt;I'm attempting to do some advanced layout orchestration using Matrix blocks. I'll need different blocks types – Image, Quote, Body – that can be combined, but they'll each need to share a few fields that allow their layout to be customized, such as Padding, Alignment, or Width. I'd rather not have to create the exact same field (e.g. Alignment could be a 4-option Dropdown) for each block type, but there doesn't seem to be a way to share fields between Matrix Blocks the same way you can share them between Sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct that there is no better way to accomplish this than just recreate the shared fields for each block type?&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="115" LastEditDate="2014-06-26T21:00:12.073" LastActivityDate="2014-06-26T21:46:21.627" Title="Is it possible to share a field between Matrix Blocks?" Tags="&lt;matrix&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="534" PostTypeId="2" ParentId="533" CreationDate="2014-06-26T20:26:46.230" Score="5" Body="&lt;p&gt;Correct - currently Matrix fields are not global, so you'll need to recreate them if you want to use them in other Matrix blocks.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2014-06-26T21:46:21.627" LastActivityDate="2014-06-26T21:46:21.627" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="535" PostTypeId="1" AcceptedAnswerId="537" CreationDate="2014-06-26T20:29:30.727" Score="2" ViewCount="150" Body="&lt;p&gt;The add-on I'm using to import blogs has this to save tags to an entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;relations-&amp;gt;saveRelations($tagFieldId, $entryRecord['elementId'], $tags);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the first arg is the field id for the tag, the second is the entry, and the third is the tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting an error that says $tagFieldId needs to be an instance of the tag model:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to Craft\RelationsService::saveRelations() must be&#xA;  an instance of Craft\FieldModel,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can I turn my little field ID into an instance of this? How do I get a fresh one, if not? Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on approaches appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also - would tag tagmodel but I'm a wee newbie.&lt;/p&gt;&#xA;" OwnerUserId="413" LastActivityDate="2014-06-27T16:26:10.620" Title="Turn a tag field id into an instance of the tag model" Tags="&lt;entrymodel&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="536" PostTypeId="2" ParentId="502" CreationDate="2014-06-26T20:33:45.517" Score="4" Body="&lt;p&gt;This can be done quite easily as follows, assuming that you are on an entry page so &lt;code&gt;entry&lt;/code&gt; is a variable in your template and your category field is called &lt;code&gt;categories&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for relatedEntry in craft.entries({&#xA;    section: 'blog',&#xA;    relatedTo: entry.categories,&#xA;    id: 'not ' ~ entry.id&#xA;}) %}&#xA;    &amp;lt;a href=&quot;{{ relatedEntry.url }}&quot;&amp;gt;{{ relatedEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am passing an object into the ElementCriteriaModel for clarity above but you could just as easily do it by chaining parameters onto the ElementCriteriaModel as follows, it's just a matter of preference.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for relatedEntry in craft.entries.section('blog').relatedTo(entry.categories).id('not ' ~ entry.id) %}&#xA;    &amp;lt;a href=&quot;{{ relatedEntry.url }}&quot;&amp;gt;{{ relatedEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;the relatedTo param&lt;/a&gt; in the docs to understand the magic.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-27T16:25:56.220" LastActivityDate="2014-06-27T16:25:56.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="537" PostTypeId="2" ParentId="535" CreationDate="2014-06-26T20:46:32.237" Score="2" Body="&lt;p&gt;You need to get the FieldModel using the &lt;code&gt;$tagFieldId&lt;/code&gt; variable, and then pass that model into the function as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$tagFieldRecord = FieldRecord::model()-&amp;gt;findById($tagFieldId);&#xA;&#xA;$tagFieldModel = FieldModel::populateModel($tagFieldRecord);&#xA;&#xA;craft()-&amp;gt;relations-&amp;gt;saveRelations($tagFieldModel, $entryRecord['elementId'], $tags);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-27T16:26:10.620" LastActivityDate="2014-06-27T16:26:10.620" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="538" PostTypeId="1" CreationDate="2014-06-26T21:49:00.510" Score="3" ViewCount="2015" Body="&lt;p&gt;I have a Craft site that works great locally, but I can't get it running on a staging server. The virtual host is working and when I remove code from &lt;code&gt;index.php&lt;/code&gt; in html it runs perfectly. Here is the error...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/vhosts/testsite/staging/html/index.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've seen the error reported online but no solutions, any ideas?&lt;/p&gt;&#xA;" OwnerUserId="417" LastEditorUserId="22" LastEditDate="2014-06-27T08:16:06.760" LastActivityDate="2015-03-19T22:44:04.433" Title="Can't get Craft running on a remote server" Tags="&lt;config&gt;&lt;server&gt;&lt;php&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="539" PostTypeId="2" ParentId="538" CreationDate="2014-06-26T21:55:59.723" Score="3" Body="&lt;p&gt;If you upload Craft, your folder structure should look like this (default):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft/..&lt;br&gt;&#xA;  /public/index.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is not the case, you have to set &lt;code&gt;$craftPath&lt;/code&gt; (in the index.php) depending on your folder structure. Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-1-upload-the-files&quot; rel=&quot;nofollow&quot;&gt;Installing&lt;/a&gt; section in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your structure looks like this..&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft/..&lt;br&gt;&#xA;  /index.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;..the path should be: &lt;code&gt;$craftPath = './craft';&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-26T21:55:59.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="540" PostTypeId="1" AcceptedAnswerId="549" CreationDate="2014-06-26T23:05:32.787" Score="6" ViewCount="1325" Body="&lt;p&gt;I'm building a plugin to browse store orders via a third-party API. I make various requests to URLs that can include query parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;/customers&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;/orders/e8b48e72-9c7f-4d6f-91aa-2f7238bdf936&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;/orders?offset=0&amp;amp;limit=250&amp;amp;from=2014-05-26T22%3A58%3A38%2B00%3A00&amp;amp;to=2014-06-26T22%3A58%3A38%2B00%3A00&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've just started using Guzzle and more importantly &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt; to keep results around for a few minutes and speed up browsing. I use the query URI as the key for the cache:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft()-&amp;gt;fileCache-&amp;gt;set($query, $response-&amp;gt;getBody(true), 600); // store result for 10 minutes&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A web hook gets hit with every new order that comes in, making it an ideal time to clear out these caches I've set—but I have no idea &lt;em&gt;how&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can tag this plugin's caches or somehow clear out only those I've made, rather than get overzealous with &lt;code&gt;craft()-&amp;gt;fileCache-&amp;gt;flushValues()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-06-27T11:07:32.083" Title="What's the best way to clear cached JSON responses from a third-party API?" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="542" PostTypeId="1" AcceptedAnswerId="543" CreationDate="2014-06-27T03:42:19.917" Score="7" ViewCount="133" Body="&lt;p&gt;I am creating a simple Element Type to hold form submissions, but I have hit a wall with this one issue I am having. For some reason I cannot get anything to output in the first column of my element type's index view. I have attached a screenshot. It doesn't matter what column comes first it is always blank. If I inspect the contents of the empty cells there is an empty anchor tag that links correctly to the edit/view entry template. I am not sure what I am doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ti8X5.png&quot; alt=&quot;screenshot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="192" LastEditorUserId="45" LastEditDate="2014-06-27T06:01:53.993" LastActivityDate="2014-06-27T06:01:53.993" Title="In my element type index view, why is the first column always empty?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="543" PostTypeId="2" ParentId="542" CreationDate="2014-06-27T04:04:36.333" Score="6" Body="&lt;p&gt;The first column is reserved for whatever your element model's &lt;code&gt;__toString()&lt;/code&gt; function returns. By default that is the element's title, if your element type has editable titles. Otherwise you will need to override that method and return whatever makes sense.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-27T04:04:36.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="544" PostTypeId="2" ParentId="503" CreationDate="2014-06-27T05:36:31.423" Score="5" Body="&lt;p&gt;If you want to set entry to a new value if &lt;code&gt;entry.title&lt;/code&gt; is undefined or 0 length, try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if !(entry is defined and entry.title is defined and entry.title|length) %}&#xA;    {% set entry = craft.entries.section('sectionname').slug(craft.request.segment(2)).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-27T05:36:31.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="545" PostTypeId="1" AcceptedAnswerId="546" CreationDate="2014-06-27T08:31:38.630" Score="6" ViewCount="444" Body="&lt;p&gt;Is there a tuple data structure in Twig? If there is, how do you create one?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-06-27T17:43:54.397" LastActivityDate="2014-06-29T17:00:23.347" Title="Do tuples exist in twig? If so, how can I create one?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="546" PostTypeId="2" ParentId="545" CreationDate="2014-06-27T08:44:44.470" Score="5" Body="&lt;p&gt;None that I'm aware of.  Since Twig ultimately gets compiled down to PHP and PHP doesn't have first-class citizen support for tuples, you're limited there.  You can quasi-fake them with &lt;a href=&quot;http://us1.php.net/manual/en/language.types.array.php&quot;&gt;arrays&lt;/a&gt; and the &lt;a href=&quot;http://us1.php.net/list&quot;&gt;list&lt;/a&gt; function, but I don't think there is a Twig equivalent for list.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-27T08:44:44.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="547" PostTypeId="1" AcceptedAnswerId="548" CreationDate="2014-06-27T09:37:17.127" Score="3" ViewCount="810" Body="&lt;p&gt;I have a built a little plugin that calls the Twitter API to add new Tweets from a user timeline as entries, so that I can return them in an ElementCriteriaModel request to be integrated with content from other Sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find out the largest tweet ID currently in the Craft system, where tweet IDs are stored as a text field against an entry, so that the next call to the Twitter API can set the sinceId field to only return tweets newer than the latest one currently stored in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing this by doing an ElementCriteriaModel call, setting the order parameter to 'tweetId desc' and then attempting to find the first() entry, to retrieve the tweetId from that entry. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'tweet';&#xA;$criteria-&amp;gt;order = array('tweetId desc');&#xA;$criteria-&amp;gt;status = array(BaseElementModel::ENABLED, BaseElementModel::DISABLED, BaseElementModel::ARCHIVED);&#xA;&#xA;$latestTweet = $criteria-&amp;gt;first();&#xA;$latestTweetId = $latestTweet-&amp;gt;tweetID;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I do this, the ordering of the Tweets seems to be affected by the status of the entry. It seems to be returning the tweet with the largest ID with status DISABLED, rather than the largest ID across all stored tweets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this behaviour correct, or is there a better way to do this? I do need to be able to set certain tweets to disabled, if I don't want them shown on the front-end of the site.&lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="177" LastEditDate="2014-06-27T11:50:32.403" LastActivityDate="2014-06-27T11:50:32.403" Title="Ordering of ElementCriteriaModel with varying statuses" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="548" PostTypeId="2" ParentId="547" CreationDate="2014-06-27T11:03:43.683" Score="6" Body="&lt;p&gt;Your statuses are incorrect. They would be correct for many elements, but the Entry Element overwrites them to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EntryModel::LIVE&#xA;EntryModel::PENDING&#xA;EntryModel::EXPIRED&#xA;BaseElementModel::DISABLED&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-27T11:03:43.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="549" PostTypeId="2" ParentId="540" CreationDate="2014-06-27T11:07:32.083" Score="6" Body="&lt;p&gt;You can &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CCache#delete-detail&quot;&gt;delete a cache&lt;/a&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;fileCache-&amp;gt;delete($key);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So instead of caching individual keys, you could perhaps cache an array of keys and delete the entire array when you want to clear out your keys.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-06-27T11:07:32.083" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="550" PostTypeId="1" AcceptedAnswerId="610" CreationDate="2014-06-27T12:02:14.117" Score="4" ViewCount="547" Body="&lt;p&gt;I've installed craft on some terrible hoster (I know, under force). Because of that I had to install craft in the public folder, next to the index.php file. I've set the path to ./craft and activated the .htaccess file. Now it will show the installation page, but halfway stops&#xA;with the attached errors.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The odd thing is that it searches for /garnish-0.1.min.map in the site root, while it's in the app/resources etc folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1XEy0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1XEy0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Click to enlarge)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Placing the file garnish-0.1.min.map in the root removes the first error, apparently it's really looking for the files in that place?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2014-06-27T14:25:51.757" LastActivityDate="2014-07-15T00:23:19.280" Title="Installation stops halfway. Files not found and internal server error 500" Tags="&lt;server&gt;&lt;install&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="552" PostTypeId="2" ParentId="550" CreationDate="2014-06-27T13:22:39.447" Score="1" Body="&lt;p&gt;I'm throwing out a wild guess only, but what happens if you temporarily remove the .htaccess file in the top level of the &quot;craft&quot; folder. It's contents (i.e. &quot;deny from all&quot;) may be causing some problem. Could that be causing some files not to be found? &lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2014-06-27T13:22:39.447" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="553" PostTypeId="1" AcceptedAnswerId="555" CreationDate="2014-06-27T13:26:49.917" Score="4" ViewCount="2182" Body="&lt;p&gt;I'm trying to get data submitted from a form using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost()&lt;/code&gt;, but I'm not sure what to do when the form name is an array element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a form with:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;label for=&quot;notes&quot;&amp;gt;Notes&amp;lt;/label&amp;gt;&#xA;&amp;lt;textarea rows=&quot;6&quot; id=&quot;notes&quot; name=&quot;fields[notes]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and want to use:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields[notes]');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when I do this I don't get any data from the form, and I'm not sure what to put in &lt;code&gt;getPost()&lt;/code&gt; to let it know its an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will work fine if I change the name to &quot;notes&quot; and use &lt;code&gt;getPost('notes')&lt;/code&gt;, but I'd like to be able to get it working with the array.&lt;/p&gt;&#xA;" OwnerUserId="418" LastEditorUserId="177" LastEditDate="2014-06-27T13:50:26.670" LastActivityDate="2014-06-27T16:26:51.677" Title="getPost() on array element in plugin" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="554" PostTypeId="1" AcceptedAnswerId="575" CreationDate="2014-06-27T13:29:55.867" Score="34" ViewCount="45796" Body="&lt;p&gt;Just wondering how people approach setting a class of current in their navigation. Is there anything in Craft or Twig where you can set a conditional to check if a page is the current page. Or do you just need to set classes/ids on the body tag based on the segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas appreciated, Gareth&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="22" LastEditDate="2014-06-27T18:05:32.450" LastActivityDate="2018-11-19T19:53:11.730" Title="How can I add a dynamic &quot;active&quot; CSS class to the navigation on any given page?" Tags="&lt;conditional&gt;&lt;navigation&gt;" AnswerCount="11" CommentCount="0" FavoriteCount="26" ContentLicense="CC BY-SA 3.0" />
  <row Id="555" PostTypeId="2" ParentId="553" CreationDate="2014-06-27T13:41:42.350" Score="9" Body="&lt;p&gt;You can use dot notation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields.notes');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2014-06-27T14:03:33.363" LastActivityDate="2014-06-27T14:03:33.363" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="556" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T13:41:57.980" Score="6" Body="&lt;p&gt;I add a variable in my &quot;_entry&quot; template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a basic example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% set bodyClass = 'myPageType' %}&#xA;&#xA;{% block content %}&#xA;&amp;lt;!-- entry HTML here --&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my _layout template, it begins like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html class=&quot;{% if bodyClass is defined %}{{ bodyClass }}{% endif %}&quot;&amp;gt;&#xA;&amp;lt;!-- the rest of the template follows --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does something like that work for you?&lt;/p&gt;&#xA;" OwnerUserId="349" LastEditorUserId="177" LastEditDate="2014-06-27T13:56:27.253" LastActivityDate="2014-06-27T13:56:27.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="557" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T13:45:00.397" Score="10" Body="&lt;p&gt;In your template you can set a var in twig:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set active = 'blog' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your navigation you can run an if statement to see what the var is&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;a {% if active = 'homepage' %}class=&quot;active&quot;{% endif %}&amp;gt; Home &amp;lt;/a&amp;gt;&#xA;    &amp;lt;a {% if active = 'blog' %} class=&quot;active&quot;{% endif %}&amp;gt; Blog &amp;lt;/a&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="218" LastEditorUserId="177" LastEditDate="2014-06-27T13:55:58.917" LastActivityDate="2014-06-27T13:55:58.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="558" PostTypeId="2" ParentId="553" CreationDate="2014-06-27T13:48:42.683" Score="1" Body="&lt;p&gt;Note:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be cases where you want to check whether the post data is an actual array before using it, this isn't possible with the dot notation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$data = craft()-&amp;gt;request-&amp;gt;getPost('fields');&#xA;&#xA;if (is_array($data)) {&#xA;    //Do stuff...&#xA;}&#xA;else {&#xA;    //Do stuff...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;ContactForm&lt;/a&gt; plugin allows you to specify &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#adding-additional-fields&quot; rel=&quot;nofollow&quot;&gt;additional body fields&lt;/a&gt; that way:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;One message field:    &#xA;&amp;lt;input id=&quot;msg&quot; type=&quot;text&quot; name=&quot;message&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;Multiple message fields:&#xA;&amp;lt;input id=&quot;phone&quot; type=&quot;text&quot; name=&quot;message[phone]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;name&quot; type=&quot;text&quot; name=&quot;message[name]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also like Selvin noted in the comments, you might want to check whether the field is actually set to prevent errors.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-27T16:26:51.677" LastActivityDate="2014-06-27T16:26:51.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="559" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T14:46:04.213" Score="12" Body="&lt;p&gt;Barrel Strength also have a URL segment based plugin called &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/active&quot;&gt;Sprout Active&lt;/a&gt;, with &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/active/docs/getting-started/introduction&quot;&gt;docs/examples here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-06-27T20:43:03.673" LastActivityDate="2014-06-27T20:43:03.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="560" PostTypeId="1" AcceptedAnswerId="564" CreationDate="2014-06-27T16:19:07.477" Score="3" ViewCount="150" Body="&lt;p&gt;Hello kind helper folk,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with Simple Craft XML Import, which has a handful of older code in it. I've managed to get through most of it to the very end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last thing it does is saves tags. My tags are saved, but now it has to relate it back to the entry and Craft appears to be saving them but not relating them back correctly, and not throwing an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The saveRelations function appears to need:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;an instance of Craft\FieldModel&lt;/code&gt; provided in arg 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;an instance of Craft\BaseElementModel&lt;/code&gt; provided in arg 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.. the data in arg 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                $tagFieldRecord = FieldRecord::model()-&amp;gt;findByPk($tagFieldId);&#xA;&#xA;                $tagFieldModel = FieldModel::populateModel($tagFieldRecord);&#xA;&#xA;                $entryRecord = EntryRecord::model()-&amp;gt;findById($entryRecord['elementId']);&#xA;&#xA;                $entryModel = EntryModel::populateModel($entryRecord);&#xA;&#xA;                craft()-&amp;gt;relations-&amp;gt;saveRelations($tagFieldModel, $entryModel, $tags);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything appears to have saved in the db tables - tags and the relations, but when I go to the entries in the back end, there are no tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good db value to look in on and change to get these to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is there something in my code I can change to make this happen through the code and not hacking the db?&lt;/p&gt;&#xA;" OwnerUserId="413" LastEditorUserId="250" LastEditDate="2014-07-08T22:07:05.163" LastActivityDate="2014-07-08T22:07:05.163" Title="Tag relations not saving" Tags="&lt;tags&gt;&lt;php&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="561" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T16:19:17.587" Score="30" Body="&lt;p&gt;Assuming you use a structure called &lt;code&gt;pages&lt;/code&gt; to create your navigation and the &lt;code&gt;entry&lt;/code&gt; variable represents the currently viewed entry, you can output  your navigation and active state as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav page in craft.entries.section('pages') %}&#xA;    &amp;lt;li class=&quot;{{ page.id == entry.id ? 'active' }}&quot;&amp;gt;&#xA;        {{ page.link }}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#nav&quot;&gt;nav tag&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, instead of a structure, you are using a channel called &lt;code&gt;pages&lt;/code&gt; for the navigation then the &lt;code&gt;nav&lt;/code&gt; tag method above will still work but the following code is leaner and simpler to understand:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for page in craft.entries.section('pages') %}&#xA;    &amp;lt;li class=&quot;{{ page.id == entry.id ? 'active' }}&quot;&amp;gt;&#xA;        {{ page.link }}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-06-30T20:25:43.153" LastActivityDate="2014-06-30T20:25:43.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="562" PostTypeId="1" AcceptedAnswerId="638" CreationDate="2014-06-27T16:25:48.523" Score="4" ViewCount="677" Body="&lt;p&gt;Does the Find and Replace tool support regex? I need to remove a certain section of an image url for all images in the 'field_body' column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I had an image referenced as such &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://craft.dev/uploads/image-600x400.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would be able to find all images that match that pattern and return the url to be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://craft.dev/uploads/image.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I have very little experience with Regex but would this be a safe pattern to use (if I can with Craft that is...)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(-[0-9]+x[0-9]+)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastActivityDate="2017-12-19T14:11:39.280" Title="Can I use Regex in the Find and Replace tool?" Tags="&lt;regex&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="563" PostTypeId="1" AcceptedAnswerId="565" CreationDate="2014-06-27T16:29:21.920" Score="2" ViewCount="798" Body="&lt;p&gt;I'm getting odd results when trying to apply multiple image transforms to the same image. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for photo in photos %}&#xA;    {% set thumb = photo.image.first().setTransform({ mode: 'crop', width: 300, height: 300 }) %}&#xA;    {% set large = photo.image.first().setTransform({ width: 600 }) %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ large.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ thumb.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code renders an image that is 600px wide for BOTH &quot;thumb&quot; and &quot;large&quot; even though the criteria for each is different and I'm setting unique variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have multiple transforms on the same image? Is there another approach I should try?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same results with these two code variations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = craft.entries.section('photo').find() %}&#xA;{% set thumbTransform = { mode: 'crop', width: 300, height: 300 } %}&#xA;{% set largeTransform = { width: 600 } %}&#xA;{% for photo in photos %}&#xA;    {% set p = photo.image.first() %}&#xA;    {% set thumb = p.setTransform(thumbTransform) %}&#xA;    {% set large = p.setTransform(largeTransform) %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ large.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ thumb.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;AND&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = craft.entries.section('photo').find() %}&#xA;{% for photo in photos %}&#xA;    {% set thumbImage = photo.image.first() %}&#xA;    {% set largeImage = photo.image.first() %}&#xA;    {% set thumb = thumbImage.setTransform({ mode: 'crop', position: 'center-center', width: 300, height: 300 }) %}&#xA;    {% set large = largeImage.setTransform({ width: 600 }) %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ large.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ thumb.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-06-27T17:06:55.213" LastActivityDate="2017-11-27T21:05:10.483" Title="Multiple image transforms of same image in template" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="564" PostTypeId="2" ParentId="560" CreationDate="2014-06-27T16:50:47.347" Score="4" Body="&lt;p&gt;Please make sure the tag &lt;a href=&quot;https://github.com/clearbold/craftimport/blob/master/services/CraftImportService.php#L18-L22&quot; rel=&quot;nofollow&quot;&gt;settings in CraftImportService.php&lt;/a&gt; are set properly.&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2014-06-27T17:05:22.440" LastActivityDate="2014-06-27T17:05:22.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="565" PostTypeId="2" ParentId="563" CreationDate="2014-06-27T16:52:04.820" Score="5" Body="&lt;p&gt;You might consider setting a variable for the image, then one for each transform type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = { mode: 'crop', width: 300, height: 300 } %}&#xA;{% set large = { width: 600 } %}&#xA;&#xA;{% for photo in photos %}&#xA;    {% set p = photo.image.first() %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ p.getUrl(large) }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ p.getUrl(thumb) }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-11-27T21:05:10.483" LastActivityDate="2017-11-27T21:05:10.483" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="566" PostTypeId="1" AcceptedAnswerId="2449" CreationDate="2014-06-27T18:01:17.663" Score="12" ViewCount="19610" Body="&lt;p&gt;Say I have &lt;code&gt;{{ item.width }}&lt;/code&gt; and &lt;code&gt;{{ item.height }}&lt;/code&gt; which are number fields with 2 decimal places.&lt;/p&gt;&#xA;&lt;p&gt;In my template I have this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Dimensions: {{ item.width }} x {{ item.height }} in.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output like this:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Dimensions: 8.50 x 11.00 in.&lt;/p&gt;&#xA;&lt;p&gt;Dimensions: 5.00 x 7.00 in.&lt;/p&gt;&#xA;&lt;p&gt;Dimensions: 4.25 x 6.50 in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How would I drop the decimal places that are not used?  Like this:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Dimensions: 8.5 x 11 in.&lt;/p&gt;&#xA;&lt;p&gt;Dimensions: 5  x 7 in.&lt;/p&gt;&#xA;&lt;p&gt;Dimensions: 4.25 x 6.5 in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="32" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2020-01-26T18:02:46.320" Title="How would I omit zero value decimals in a number format?" Tags="&lt;number&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="568" PostTypeId="2" ParentId="566" CreationDate="2014-06-27T18:09:29.640" Score="12" Body="&lt;p&gt;This can be done with Twig's &lt;code&gt;trim&lt;/code&gt; filter. It works just like PHP's trim function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.width|trim('0','right')|trim('.','right') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastEditorUserId="45" LastEditDate="2018-01-12T23:22:40.817" LastActivityDate="2018-01-12T23:22:40.817" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="569" PostTypeId="1" AcceptedAnswerId="570" CreationDate="2014-06-27T18:21:54.197" Score="6" ViewCount="284" Body="&lt;p&gt;Is there a way in Twig to make this conditional shorter so I don't use &quot;craft.request.getSegment(2)&quot; twice?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) == &quot;knowledge&quot; or &#xA;craft.request.getSegment(2) == &quot;search&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-27T18:38:04.673" Title="Is Shorter Twig Conditional possible?" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="570" PostTypeId="2" ParentId="569" CreationDate="2014-06-27T18:21:54.197" Score="11" Body="&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot;&gt;&lt;strong&gt;Containment Operator&lt;/strong&gt;&lt;/a&gt; helps with this...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It returns true if the left operand is contained in the right&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) in ['knowledge', 'search'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) not in ['', 'sale'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2014-06-27T18:38:04.673" LastActivityDate="2014-06-27T18:38:04.673" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="571" PostTypeId="1" AcceptedAnswerId="573" CreationDate="2014-06-27T18:25:21.390" Score="5" ViewCount="697" Body="&lt;p&gt;I love using the excerpt option in Wygwam (CKEditor). I've looked high and low but as of yet, have been unable to find a way to have an exceprt show short of having a whole second field. I have seen a custom Twig filter running around that would allow to show first paragraph (which I could modify to show whatever) but I like the ease of doing it straight in the WYSIWYG. Anyone have any options? (looking for a solution for a news roll page)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(First P Twig filter)&#xA;&lt;a href=&quot;https://gist.github.com/james2doyle/6629712&quot;&gt;https://gist.github.com/james2doyle/6629712&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-06-27T18:35:57.683" Title="&quot;Excerpt&quot; option in Redactor?" Tags="&lt;templating&gt;&lt;custom-field&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="572" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T18:31:08.447" Score="14" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request&quot;&gt;&lt;strong&gt;craft.request&lt;/strong&gt;&lt;/a&gt; is useful for setting an &quot;active&quot; class based on URL segments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your URL was: &lt;code&gt;domain.com/sale/products/shirts&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write conditionals like the following to target each segment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.firstSegment == &quot;sale&quot; %}class=&quot;active&quot;{% endif %}&#xA;{% if craft.request.segment(2) == &quot;products&quot; %}class=&quot;active&quot;{% endif %}&#xA;{% if craft.request.lastSegment == &quot;shirts&quot; %}class=&quot;active&quot;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-27T18:31:08.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="573" PostTypeId="2" ParentId="571" CreationDate="2014-06-27T18:35:57.683" Score="6" Body="&lt;p&gt;You could use the Redactor's pagebreak plugin. Check &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#templating&quot;&gt;out the docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If activated in your Redactor config, you will have the option to insert page breaks to your content, via a new “Insert Page Break” toolbar button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can get the first &quot;page&quot; in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog') %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&#xA;        {{ entry.richTextFieldHandle.getPage(1) }}&#xA;&#xA;        {% if entry.richTextFieldHandle.getTotalPages() &amp;gt; 1 %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-27T18:35:57.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="574" PostTypeId="1" AcceptedAnswerId="578" CreationDate="2014-06-27T18:40:56.573" Score="17" ViewCount="2688" Body="&lt;p&gt;When setting up a new &lt;strong&gt;assets source&lt;/strong&gt;, Craft allows you to natively connect to one of these cloud storage solutions (assuming you're using the Craft Pro edition):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amazon S3&lt;/li&gt;&#xA;&lt;li&gt;Google Cloud Storage&lt;/li&gt;&#xA;&lt;li&gt;Rackspace Cloud Files&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know that the answer may be subjective, but want to hear pros &amp;amp; cons from people who have tried any of these. I'm working on a project which will require one of these solutions, and I greatly value the opinions of this community.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-23T06:56:46.853" Title="What are the advantages/disadvantages of the various cloud storage solutions for assets?" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="575" PostTypeId="2" ParentId="554" CreationDate="2014-06-27T18:44:11.267" Score="33" Body="&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; To keep it short and reusable I would recommend that you wrap your preferred &quot;check-method&quot; in a Twig macro, I like &lt;a href=&quot;https://craftcms.stackexchange.com/a/572/177&quot;&gt;Anna's&lt;/a&gt; version the most:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_macros.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% macro is_active(segment) %}{% if craft.request.firstSegment == segment %}active{% endif %}{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;layout.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% import &quot;_macros.html&quot; as macros %}&#xA;&#xA;&amp;lt;a href=&quot;{{ url('news') }}&quot; class=&quot;{{ macros.is_active('news') }}&quot;&amp;gt;News&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ url('blog') }}&quot; class=&quot;{{ macros.is_active('blog') }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-06-29T16:19:04.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="576" PostTypeId="2" ParentId="566" CreationDate="2014-06-27T19:10:41.080" Score="5" Body="&lt;p&gt;I would use the twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/number_format.html&quot; rel=&quot;noreferrer&quot;&gt;number_format&lt;/a&gt; filter to make sure there were a known number of decimal places, then &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/trim.html&quot; rel=&quot;noreferrer&quot;&gt;trim&lt;/a&gt; first the 0s, then the '.':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{item.width|number_format(4)|trim('0')|trim('.')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would write a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;noreferrer&quot;&gt;macro&lt;/a&gt; for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro num_format(n) %}&#xA;  {{n|number_format(4)|trim('0')|trim('.')}}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Called like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ num_format(item.width) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-27T19:10:41.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="577" PostTypeId="2" ParentId="574" CreationDate="2014-06-27T19:13:33.910" Score="4" Body="&lt;p&gt;I have used Rackspace and S3. I can pretty much guess the Pros and Cons of Google's Storage. It's been my experience with these (and a few not supported by Craft) that they are all fast and reliable. In fact, they are all pretty much the same save for price and an errant feature here and there. You should not be disappointed by any of them.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-27T19:13:33.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="578" PostTypeId="2" ParentId="574" CreationDate="2014-06-27T19:58:34.810" Score="17" Body="&lt;p&gt;Allright, I'll bite. First, I'll get the cost argument out of the way, then I'll cover each type with their specifics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Costs&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amazon S3: USD 0.03 per GB (up to 1TB, where the price drops as you store more and more data)&lt;/li&gt;&#xA;&lt;li&gt;Rackspace: USD 0.12 per GB (up to 1TB, where the price drops)&lt;/li&gt;&#xA;&lt;li&gt;Google Cloud Storage: USD 0.026 per GB (No price reduction for large amounts)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In conclusion - pricing will not be a deciding factor, as the difference, while having a rather noticeable amplitutde, only matter when storing such an absurd amount of data, that the price is the least of your problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;S3 Specifics&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Superb integration with AWS. If you're hosting there, then your choice has been made.&lt;/li&gt;&#xA;&lt;li&gt;CDN - Amazon Cloud Front is super-easy to set up and is a breeze to use.&lt;/li&gt;&#xA;&lt;li&gt;Different types of storages available. &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Regular&lt;/li&gt;&#xA;&lt;li&gt;Reduced Redundancy Storage - cheaper, however Amazon guarantees &quot;only&quot; 99.99% durability of data&lt;/li&gt;&#xA;&lt;li&gt;Glacier - super-cheap storage for archiving. Super long data recovery, though. I'm talking 3 to 5 hours. Also, as Matt Stein pointed out, in some cases, the data retrieval could get super-expensive. (&lt;a href=&quot;http://aws.amazon.com/glacier/&quot;&gt;more info&lt;/a&gt;, &lt;a href=&quot;https://news.ycombinator.com/item?id=4412886&quot;&gt;expensive retrieval case&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Supports object versioning (&lt;a href=&quot;http://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html&quot;&gt;more info&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Cache headers - you can set up cache duration per Assets source for files uploaded to the source via Assets&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rackspace Specifics&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CDN built right in - no set-up necessary.&lt;/li&gt;&#xA;&lt;li&gt;CDN comes at a cost - you can purge only up to 25 files from the CDN per day, so be careful with frequent file changes. (&lt;a href=&quot;http://www.rackspace.com/blog/cloud-files-cdn-gets-edge-purge/&quot;&gt;blog post&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Supports object versioning (&lt;a href=&quot;http://www.rackspace.com/blog/rackspace-cloud-files-how-to-use-object-versioning/&quot;&gt;blog post&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Google Cloud Storage Specifics&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cheapest of them all.&lt;/li&gt;&#xA;&lt;li&gt;Offers Durable Reduced Availability storage. Cheaper, but stores data on further servers, so the data recovery time is slightly longer.&lt;/li&gt;&#xA;&lt;li&gt;Cache headers - you can set up cache duration per Assets source for files uploaded to the source via Assets&lt;/li&gt;&#xA;&lt;li&gt;According to google, CDN is built in at no extra cost. (&lt;a href=&quot;https://groups.google.com/forum/#!msg/gs-discussion/z7Kee2CIdsk/gEtlHK7L_JgJ&quot;&gt;Google groups post&lt;/a&gt;))&lt;/li&gt;&#xA;&lt;li&gt;Supports object versioning (&lt;a href=&quot;https://developers.google.com/storage/docs/object-versioning&quot;&gt;more info&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am biased, I'll admit that, but I've had nothing but joy working with Amazon S3, a lot of frustration working with Rackspace and mixed feelings when it comes to Google. For Google it's mainly of their unbelievably clunky UI, but that might be just me.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2014-06-27T20:59:27.567" LastActivityDate="2014-06-27T20:59:27.567" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="579" PostTypeId="1" AcceptedAnswerId="582" CreationDate="2014-06-28T01:41:25.647" Score="3" ViewCount="480" Body="&lt;p&gt;I want to display an entry's tag next its title in a list of entries, and on the entry's detail page. For example, for a blog. How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="393" LastEditorUserId="45" LastEditDate="2014-06-28T06:08:00.730" LastActivityDate="2014-06-28T12:24:11.693" Title="How do I display an entry's tag?" Tags="&lt;templating&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="581" PostTypeId="1" AcceptedAnswerId="584" CreationDate="2014-06-28T02:46:52.673" Score="4" ViewCount="725" Body="&lt;p&gt;I have a Matrix field with two blocks. Each block has an assets field that I'm trying to set to restrict to uploads to a single folder and setting the upload location to {slug}. Basically what I'm trying to do is set up a main folder for my portfolio. I want to be able to upload images for each entry and have them placed in a folder with the same name as the entry so whenI look in Assets I see something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Portfolio&#xA;-- project 1 entry name&#xA;-- project 2 entry name&#xA;...&#xA;-- project 17 entry name&#xA;-- project 18 entry name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I upload the file in my entry form no subfolders are created. I have tried a few things to remedy the problem to no avail. I've set permissions to 777 and have tried placing a / before {slug} because the fileSystemPath variable doesn't have a trailing slash in my general.php config file. Any other issues that might cause this?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-06-28T09:29:22.003" Title="Trouble with Restrict to Single Folder and Upload Location" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="582" PostTypeId="2" ParentId="579" CreationDate="2014-06-28T02:52:07.403" Score="6" Body="&lt;p&gt;To list all tags on a particular entry use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in entry.tagField %}&#xA;    {{ tag }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you only want the first tag you can just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.tagField.first }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-06-28T02:58:57.330" LastActivityDate="2014-06-28T02:58:57.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="583" PostTypeId="1" AcceptedAnswerId="668" CreationDate="2014-06-28T05:23:11.927" Score="9" ViewCount="947" Body="&lt;p&gt;I'm trying to submit an Entry programmatically from the front end.  Everything works flawlessly, except, the asset fields never save.  I've dug and dug through the Entries, Elements, and Content Services.  Through similar Controllers; the Element Model.  I can't find any errors, and no matter what I do, nothing seems to happen with Assets.  Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a simplified version of my html form:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;utf-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;plugin/save/saveEntry&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; value=&quot;Woo hoo&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;authorId&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;10&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;en_us&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrixField]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrixField][new1][type]&quot; value=&quot;imageBlock&quot;&amp;gt;&#xA;&#xA;    &amp;lt;h4&amp;gt;Upload Your Photo&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrixField][new1][fields][image]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;fields[matrixField][new1][fields][image][]&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's a simplified version of my Controller/Service (all jammed in the Controller for the convenience of sharing)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Plugin_SaveController extends BaseController&#xA;{&#xA;    public function actionSaveEntry()&#xA;    {       &#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // Fields&#xA;        $entry = new EntryModel();&#xA;        $entry-&amp;gt;sectionId  = 10;&#xA;        $entry-&amp;gt;typeId     = 11;&#xA;        $entry-&amp;gt;locale     = 'en_us';&#xA;        $entry-&amp;gt;postDate   = date('Y-m-d');&#xA;        $entry-&amp;gt;authorId   = 1;&#xA;&#xA;        // Tell our content model where to look for custom fields&#xA;        $entry-&amp;gt;setContentFromPost('fields');&#xA;&#xA;        // Content&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = &quot;Fancy Title&quot;;&#xA;&#xA;        // Save the entry content&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-06-28T16:03:50.600" LastActivityDate="2014-07-01T22:33:37.617" Title="How do I save a Matrix field with an asset block programmatically?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ClosedDate="2016-01-25T06:19:15.750" ContentLicense="CC BY-SA 3.0" />
  <row Id="584" PostTypeId="2" ParentId="581" CreationDate="2014-06-28T09:29:22.003" Score="5" Body="&lt;p&gt;Since you're inside the context of a Matrix block, you'll want to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{owner.slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More information on that &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/assets-fields#dynamic-subfolder-paths&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-28T09:29:22.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="585" PostTypeId="1" AcceptedAnswerId="865" CreationDate="2014-06-28T09:40:10.757" Score="8" ViewCount="3989" Body="&lt;p&gt;I would like to allow users of our site to be able to upload images, mp3's and video from the front-end. Can I do this with the entry form template easily enough?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking maybe I could use Wistia for the video upload with their widget. &lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2018-03-22T19:20:34.913" Title="Frontend upload for images, mp3s and video?" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="587" PostTypeId="1" AcceptedAnswerId="602" CreationDate="2014-06-28T20:48:33.090" Score="3" ViewCount="636" Body="&lt;p&gt;I'm getting all Users from specific UserGroups like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;groupId = array(1, 3);&#xA;$users = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I additionally fetch all admin Users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to add the admin attribute, but this hasn't changed anything:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria-&amp;gt;admin = array(false, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume that's because the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; has to match all attributes, but there isn't an admin which has a UserGroup with the ID 1 or 3. But how can I tell the criteria to perform a &quot;OR&quot; fetch?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I know I could merge two fetched criterias but I want to use a &quot;clean&quot; solution.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-06-28T21:33:08.270" LastActivityDate="2015-07-31T23:36:18.483" Title="How to fetch specific users OR admins with the ElementCriteriaModel?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="588" PostTypeId="1" AcceptedAnswerId="589" CreationDate="2014-06-29T01:17:28.667" Score="3" ViewCount="381" Body="&lt;p&gt;We have a custom fieldtype that can be attached to an entry type multiple times and everything works just fine. This fieldtype has multiple input fields (shortUrl, longUrl) and they have been properly namespaced to make them unique (via the fieldtype handle) and when the data is saved, it gets saved to a table that defines the necessary columns (id, elementId, shortUrl, longUrl) since the &lt;code&gt;defineContetAttribute()&lt;/code&gt; method has been set to false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As previously mentioned, this fieldtype has been properly namespaced and is taking advantage of the Craft JS buffer to avoid naming conflicts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue comes up when we try to retrieve the data from our custom table via &lt;code&gt;preValue($value)&lt;/code&gt; because &lt;code&gt;$value&lt;/code&gt; will be &lt;code&gt;null&lt;/code&gt; and all the other values we have access to in this context  (&lt;code&gt;$field-&amp;gt;model-&amp;gt;id&lt;/code&gt;, &lt;code&gt;$field-&amp;gt;model-&amp;gt;handle&lt;/code&gt;, &lt;code&gt;$field-&amp;gt;element-&amp;gt;id&lt;/code&gt;) are not unique enough to fetch a record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a couple of workarounds but have not found a clean way to do this yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;prepValue()&lt;/code&gt; method provides the entry id (&lt;code&gt;$field-&amp;gt;element-&amp;gt;id&lt;/code&gt;) which we can use to fetch the content (record) for each field since we have a relationship set but beyond that, I haven't found any other way to identify each record individually so that I can attach it to the right field instance within the input html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be something simple that I'm missing and thought I would ask: )&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-06-29T19:59:16.603" Title="How can multiple fieldtype instances without a content column be attached to the same entry type and still be uniquely identifiable?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="589" PostTypeId="2" ParentId="588" CreationDate="2014-06-29T04:22:32.740" Score="5" Body="&lt;p&gt;Since you're saving your data in a separate table, you basically need &lt;strong&gt;two fields&lt;/strong&gt; within your custom table to help you identify which field &amp;amp; element originally saved the content:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;strong&gt;element id&lt;/strong&gt; (which you're already storing)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;field id&lt;/strong&gt; (missing from your current setup)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You could even create an index on your custom table that would be a combo of those two fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, you should be able to retrieve your data with a combination of the &lt;code&gt;$field-&amp;gt;model-&amp;gt;id&lt;/code&gt; and &lt;code&gt;$field-&amp;gt;element-&amp;gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When saving:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$attr['elementId'] = $field-&amp;gt;element-&amp;gt;id;&#xA;$attr['fieldId']   = $field-&amp;gt;model-&amp;gt;id;&#xA;&#xA;$fieldRecord-&amp;gt;setAttributes($attr);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When retrieving:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldRecord = MyPlugin_FieldRecord::model()-&amp;gt;findByAttributes(array(&#xA;    'elementId' =&amp;gt; $field-&amp;gt;element-&amp;gt;id,&#xA;    'fieldId'   =&amp;gt; $field-&amp;gt;model-&amp;gt;id,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-06-29T19:59:16.603" LastActivityDate="2014-06-29T19:59:16.603" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="590" PostTypeId="1" AcceptedAnswerId="628" CreationDate="2014-06-29T09:37:33.553" Score="15" ViewCount="4531" Body="&lt;p&gt;I've got a Structure section where the top level is the main menu. The submenu consists of the children of the active main menu item. This works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the submenu, I'm using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set mainEntry = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;{% set subnav = craft.entries.descendantOf(mainEntry) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% nav page in subnav %}&#xA;  &amp;lt;li{% if page.slug == craft.request.getSegment(page.level) %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;    {{ page.getLink() }}&#xA;    {% ifchildren %}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% children %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which shows &lt;em&gt;all&lt;/em&gt; children of each page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I only show the children of the &lt;em&gt;active&lt;/em&gt; parent? I've tried to wrap the &lt;code&gt;ifchildren&lt;/code&gt; block inside another &lt;code&gt;if&lt;/code&gt; statement (the same I used to set the &lt;code&gt;class=&quot;active&quot;&lt;/code&gt; to the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;), but that results in a Template error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected tag name &quot;ifchildren&quot; (expecting closing tag for the &quot;if&quot; tag defined near line &lt;em&gt;x&lt;/em&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Putting that &lt;code&gt;if&lt;/code&gt; statement &lt;em&gt;inside&lt;/em&gt; the &lt;code&gt;ifchildren&lt;/code&gt; block also throws a template error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. With the current HTML output, I could also just use CSS to hide/show the &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;s based on the &lt;code&gt;.active&lt;/code&gt; class, but I'd still like to know how to generate that tree without the need for  a CSS workaround.&lt;/p&gt;&#xA;" OwnerUserId="127" LastEditorUserId="127" LastEditDate="2014-06-29T09:43:21.763" LastActivityDate="2020-09-20T14:48:35.283" Title="How do you only show children of &quot;active&quot; parent in a Structure section's nav?" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="591" PostTypeId="1" AcceptedAnswerId="606" CreationDate="2014-06-29T10:31:57.027" Score="2" ViewCount="1466" Body="&lt;p&gt;I'm trying to create a very simple controller from a &quot;foo plugin&quot;, but it seems there is something i did not understand because i can't make it work. (404 error)&#xA;I looked at contactForm plugin as an example; except i'm trying to respond to a &quot;GET&quot; http request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin is enable and OK. &#xA;My plugin is &quot;foo&quot;. Here is my controller, in plugins/foo/controllers :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Contact Form controller&#xA; */&#xA;class fooController extends BaseController {&#xA;&#xA;  function actionHello() {&#xA;     $this-&amp;gt;renderTemplate('foo/test');&#xA;  }&#xA;&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not supposed to be called with this uri ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://craft.local/index.php?p=actions/foo/Hello&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Must i register a route to make this work ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried renaming my controller and class to &quot;foo_testController&quot;, and then calling :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://craft.local/index.php?p=actions/foo/test/Hello&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am i missing ?&lt;/p&gt;&#xA;" OwnerUserId="433" LastEditorUserId="433" LastEditDate="2014-06-30T07:30:58.043" LastActivityDate="2014-06-30T07:30:58.043" Title="How to create a basic plugin front-end controller?" Tags="&lt;controller&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="592" PostTypeId="1" AcceptedAnswerId="595" CreationDate="2014-06-29T10:48:06.447" Score="3" ViewCount="104" Body="&lt;p&gt;I'm not sure how to ask this question.  I have a form. It works just fine on desktops.  However when the form is submitted on iPhone or iPad it never makes it to my controller and resolves to the URL /login with a 404 (which is correct, because I don't have a /login template).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this is true for custom controllers and for Craft forms like 'entries/saveEntry'. &#xA;I don't have any routes or other rules that target the 'login' url or any other URLs I'm using in the action parameter that I can determine. I've uninstalled all plugins.  Logs only report the 404 error message but they also seem to report that second page request to the 'login' URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've traced the request through the WebApp.php file all the way to around line 254 where WebApp.php hands things off to the UrlManager:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parent::processRequest();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I should be looking for here?  I'm not even sure why this would be happening and feel I'm getting too deep as most routing in Craft is pretty straightforward.  Could there be any other, obvious settings or anything I might be overlooking?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-06-29T16:47:11.787" Title="Where do I begin troubleshooting a Form in Craft that is redirecting to /login on iPad and iPhone?" Tags="&lt;controller&gt;&lt;form&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="593" PostTypeId="2" ParentId="591" CreationDate="2014-06-29T11:06:51.900" Score="1" Body="&lt;p&gt;&lt;strong&gt;Typo:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your plugin-handle you may have a typo in your action routes. It's important to note that this routes are 'Camel' case-sensitive. &lt;a href=&quot;https://craftcms.stackexchange.com/a/470/177&quot;&gt;Read this answer by Lindsey for more info&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Access:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to add your action to &lt;code&gt;$allowAnonymous&lt;/code&gt;, otherwise only users who are logged in can access the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected $allowAnonymous = array('actionHello');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-06-29T11:06:51.900" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="594" PostTypeId="2" ParentId="418" CreationDate="2014-06-29T14:10:59.063" Score="10" Body="&lt;p&gt;In addition to Ben Parizek answer, here is a full example code to get value of a &quot;foo&quot; setting from a &quot;bar&quot; plugin, using magic get methods.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$pluginSettings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('bar')-&amp;gt;getSettings();&#xA;$foo = $pluginSettings-&amp;gt;foo;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="433" LastEditorUserId="45" LastEditDate="2014-06-29T19:55:56.543" LastActivityDate="2014-06-29T19:55:56.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="595" PostTypeId="2" ParentId="592" CreationDate="2014-06-29T16:47:11.787" Score="5" Body="&lt;p&gt;Just an idea, but are you &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot;&gt;Allowing Anonymous Access to Actions&lt;/a&gt;? Maybe you are logged in on your Desktop, but not on your iPhone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected $allowAnonymous = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-06-29T16:47:11.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="596" PostTypeId="2" ParentId="545" CreationDate="2014-06-29T17:00:23.347" Score="4" Body="&lt;p&gt;No tuples per se. You can use arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set a = ['a', 'b'] %}&#xA;{{ a[0] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use objects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set o = {'first': 'a', 'second': 'b'} %}&#xA;{{ o.first }} or {{ attribute(o, 'first') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge&lt;/a&gt; is very useful for constructing arrays and objects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set a = a | merge(['c']) %}&#xA;{% set o = o | merge({'third': 'c'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-29T17:00:23.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="597" PostTypeId="2" ParentId="590" CreationDate="2014-06-29T19:22:19.160" Score="4" Body="&lt;p&gt;This will do it:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainEntry = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;{% set subnav = craft.entries.descendantOf(mainEntry) %}&#xA;&#xA;{% set numSegs = craft.request.segments|length %}&#xA;&amp;lt;ul&amp;gt;&#xA;{% nav page in subnav %}&#xA;  {% set thisOneIsActive = page.slug == craft.request.getSegment(page.level) %}&#xA;  {% set pageUrlSegs = (page.url|split('//'))[1]|split('/') %}&#xA;  {% set wantThisOne = thisOneIsActive or (pageUrlSegs|length &amp;gt; numSegs and pageUrlSegs[numSegs] == craft.request.getLastSegment) %}&#xA;  {% if wantThisOne %}&#xA;    &amp;lt;li{% if thisOneIsActive %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;      {{ page.getLink() }}&#xA;  {% endif %}&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;  {# at this point for whatever reason we have lost our context variables and have to recalculate them #}&#xA;  {% set thisOneIsActive = page.slug == craft.request.getSegment(page.level) %}&#xA;  {% set pageUrlSegs = (page.url|split('//'))[1]|split('/') %}&#xA;  {% set wantThisOne = thisOneIsActive or (pageUrlSegs|length &amp;gt; numSegs and pageUrlSegs[numSegs] == craft.request.getLastSegment) %}&#xA;  {% if wantThisOne %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think it's kind of a hack. It works around the limitations of not being able to have the &lt;code&gt;ifchildren&lt;/code&gt; in an &lt;code&gt;if&lt;/code&gt; by calculating for every element whether or not we want to show it. And it works around the nav context no longer being set after the &lt;code&gt;ifchildren&lt;/code&gt; block by making that calculation twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the &lt;code&gt;nav&lt;/code&gt; tag has room for improvement (easier to say than to do, I know).&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-29T19:22:19.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="598" PostTypeId="1" AcceptedAnswerId="601" CreationDate="2014-06-29T22:25:34.720" Score="1" ViewCount="342" Body="&lt;p&gt;I have an entry whose slug I would like to set to 'archive', but when I save it, it is 'archive-1'. There is no existing entry with slug of 'archive' (&lt;code&gt;craft.entries.slug('archive')&lt;/code&gt; returns null). There have been previous entries with that slug.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-29T23:42:39.877" Title="Unable to set slug to value used previously" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="599" PostTypeId="2" ParentId="598" CreationDate="2014-06-29T23:05:38.230" Score="2" Body="&lt;p&gt;There probably is still an (maybe corrupted) entry in the db with that slug. Have a look at the entries-content table, sort it by slug and you possibly see an entry responsible for your problem.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-06-29T23:05:38.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="600" PostTypeId="2" ParentId="554" CreationDate="2014-06-29T23:27:11.750" Score="11" Body="&lt;p&gt;Here's yet another way you can do it (in some circumstances) and it's nice and DRY:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPath() ==  entry.uri %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft 3&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.app.request.pathInfo ==  entry.uri %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-11-19T19:53:11.730" LastActivityDate="2018-11-19T19:53:11.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="601" PostTypeId="2" ParentId="598" CreationDate="2014-06-29T23:42:39.877" Score="1" Body="&lt;p&gt;My problem was that the uri needs to be unique. I found the duplicate uri by finding my entry in craft_elements_i18n, and looking for other entries with the uri I wanted.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-29T23:42:39.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="602" PostTypeId="2" ParentId="587" CreationDate="2014-06-30T01:53:01.293" Score="4" Body="&lt;p&gt;You won't be able to do that using the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; or a single query (unless you use &lt;code&gt;craft ()-&amp;gt; db-&amp;gt; createCommand()&lt;/code&gt; or &lt;code&gt;\CDbCriteria&lt;/code&gt; to perform a conditional &lt;code&gt;JOIN&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will either have to 1) do &lt;strong&gt;post filtering&lt;/strong&gt; or 2) get the &lt;code&gt;ids&lt;/code&gt; for users in the groups you want and the &lt;code&gt;ids&lt;/code&gt; for all admin users (which I would recommend). You can then merge both arrays and use the resulting array to get all users that match the containing &lt;code&gt;ids&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mentioned that you wanted to do it the &lt;strong&gt;clean&lt;/strong&gt; way and doing a couple of queries using the public Element Query API is definitely the clean way to do it and the fact that you're doing a couple of queries to get the users you want should not feel &lt;strong&gt;&quot;unclean&quot;&lt;/strong&gt; because that is happening in a lot of different places behind the scenes when you use the API instead of raw queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when you add the &lt;code&gt;$ criteria-&amp;gt;groupId = array(1, 3);&lt;/code&gt; to a user query, Craft will hit the db once to get all &lt;code&gt;ids&lt;/code&gt; for users in those groups and then hit it again as many times as necessary to do what it needs to do, like perform searches and such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My point is, using the API means that you might not be able get everything in one go but your plugin won't break if Craft changes any internal APIs.&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="1016" LastEditDate="2015-07-31T23:36:18.483" LastActivityDate="2015-07-31T23:36:18.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="603" PostTypeId="1" AcceptedAnswerId="646" CreationDate="2014-06-30T05:42:28.610" Score="12" ViewCount="1082" Body="&lt;p&gt;I have a field &lt;code&gt;categories&lt;/code&gt; in a channel &lt;code&gt;news&lt;/code&gt;, and I want to find all the entries in &lt;code&gt;news&lt;/code&gt; that don't have a category set. I know I could loop over the entries and find them that way, but I'm hoping to do it with a query. I tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set uncategorized = craft.entries.section('news').categories(':empty:') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it returned none.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-01T11:37:23.280" Title="How to find entries with no category" Tags="&lt;categories&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="604" PostTypeId="1" AcceptedAnswerId="616" CreationDate="2014-06-30T06:11:31.323" Score="4" ViewCount="1042" Body="&lt;p&gt;&lt;strong&gt;This may be a bug...&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have a controller action which has been working great. It's a simple action with a single purpose... load a template with an internal value.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAction()&#xA;{&#xA;    $this-&amp;gt;renderTemplate('myplugin/_mytemplate', array(&#xA;        'internalVar' =&amp;gt; craft()-&amp;gt;myPlugin-&amp;gt;internalVar&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I call that action via a simple URL, everything loads flawlessly:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;mywebsite.com/actions/myPlugin/myAction&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Here's where it gets interesting...&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I just discovered the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;registerSiteRoutes&lt;/a&gt; hook. It looks awesome, and would make accessing my special page that much easier for a front-end user!&lt;/p&gt;&#xA;&lt;p&gt;Here's how I implemented it in my &lt;code&gt;MyPluginPlugin.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'myroute' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;The good news is,&lt;/strong&gt; the route is properly followed, and my controller action gets loaded.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The bad news is,&lt;/strong&gt; suddenly the template that's supposed to be loaded can't be found. :(&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Template Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unable to find the template &amp;quot;myplugin/_mytemplate&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So does anyone know, &lt;strong&gt;what's going on here?&lt;/strong&gt; I know that the &lt;code&gt;renderTemplate&lt;/code&gt; method does some minor rewriting of the template path, but why would it be different when accessing via a front-end route?&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-06-30T18:58:23.410" Title="Is the &quot;registerSiteRoutes&quot; hook screwing up my template path?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="605" PostTypeId="1" AcceptedAnswerId="607" CreationDate="2014-06-30T06:38:13.677" Score="4" ViewCount="252" Body="&lt;p&gt;Just looking for a little clarification on the &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt; method...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everybody already knows that when a cookie is set, that cookie only exists on the end-user's computer. No one else using the website can access that cookie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I were to replace that cookie getter/setter with the &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt; getter/setter methods, is that data now available to everyone? Where a cookie is stored on the &lt;strong&gt;client&lt;/strong&gt; machine, the &lt;code&gt;fileCache&lt;/code&gt; data is stored on the &lt;strong&gt;server&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I suspect is happening, just trying to be sure that I'm interpreting this correctly.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-30T09:11:40.397" Title="How is &quot;craft()-&gt;fileCache&quot; different from using cookies?" Tags="&lt;plugin-development&gt;&lt;filecache&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="606" PostTypeId="2" ParentId="591" CreationDate="2014-06-30T07:30:19.400" Score="3" Body="&lt;p&gt;I solved the problem using Pascal Case for naming all my files and classes. I was using camel Case...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all works fine with those filenames for my &quot;foo&quot; plugin :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;FooPlugin.php&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;controllers/FooController.php&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I used Pascal Case for the classes name too, mainly for consistency reason; but i noticed that :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;using camelCase for controller class name if the filename is in PascalCase does not break anything&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;using camelCase for plugin classname breaks the controller.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anyway, if you don't want issues, juste use Pascal Case (file names and class names) everywhere and you should be Ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that with apache, this path is calling my controller correctly (all in lower case)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;actions/foo/hello&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="433" LastActivityDate="2014-06-30T07:30:19.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="607" PostTypeId="2" ParentId="605" CreationDate="2014-06-30T09:11:40.397" Score="7" Body="&lt;p&gt;Correct... &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt; will save to your &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; folder by default, which will have a .bin file that has a hash of the key you provided when calling &lt;code&gt;set()&lt;/code&gt; and the contents will be a serialized version of the value you passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth noting that while &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt; still exists, as of Craft 2.0, it is simply a shortcut to &lt;code&gt;craft()-&amp;gt;cache&lt;/code&gt;, when the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot;&gt;cacheMethod&lt;/a&gt; config setting is set to &lt;code&gt;file&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-06-30T09:11:40.397" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="608" PostTypeId="1" AcceptedAnswerId="618" CreationDate="2014-06-30T09:17:04.160" Score="6" ViewCount="935" Body="&lt;p&gt;Is there any known way to bootstrap Craft to use the core functions inside another application? For example, in Magento anyone can include a file, initialize the app and use all the functions from there.&#xA;&lt;a href=&quot;http://fishpig.co.uk/magento/tutorials/run-magento-code-externally/&quot; rel=&quot;nofollow&quot;&gt;This is exactly what i am trying to achieve&lt;/a&gt; but in Craft.&#xA;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="435" LastEditorUserId="125" LastEditDate="2014-07-15T09:27:09.277" LastActivityDate="2019-01-30T15:42:23.093" Title="Bootstrap Craft from another app" Tags="&lt;config&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="609" PostTypeId="1" AcceptedAnswerId="613" CreationDate="2014-06-30T09:26:02.093" Score="3" ViewCount="2111" Body="&lt;p&gt;I'm trying to create a plugin with a controller, but I don't want to render any view but run a script from a cronjob. I can't get into the controller with an url and I'm not sure why. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried everything &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but it does not state any way to directly call a controller with an url. Is this possible? &lt;/p&gt;&#xA;" OwnerUserId="435" LastEditorUserId="340" LastEditDate="2017-03-12T01:43:04.327" LastActivityDate="2017-03-12T01:43:04.327" Title="Direct access to controller" Tags="&lt;config&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="610" PostTypeId="2" ParentId="550" CreationDate="2014-06-30T09:54:15.513" Score="4" Body="&lt;p&gt;The log file got me on my way after a tip from Brad Bell:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'CDbException' with message 'CDbCommand failed during the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'craft_assetfiles' already exists' in ...craft/app/framework/db/CDbCommand.php:358&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Removing the database and doing a fresh install solved the issue. &lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="22" LastEditDate="2014-07-15T00:23:19.280" LastActivityDate="2014-07-15T00:23:19.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="611" PostTypeId="2" ParentId="609" CreationDate="2014-06-30T10:00:05.857" Score="4" Body="&lt;p&gt;The docs explain how to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#linking-directly-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;generate links to controller actions&lt;/a&gt;. Assuming your action trigger is &quot;actions&quot; (as it is by default) then your URL will look as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.domain.com/actions/pluginName/controllerName/actionName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Following the first example in the docs, the URL will look as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.domain.com/actions/cocktailRecipes/ingredients/deleteIngredient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be sure to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;allow anonymous access&lt;/a&gt; to your controller action so it can be reached by the cron job.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-06-30T10:00:05.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="612" PostTypeId="1" AcceptedAnswerId="614" CreationDate="2014-06-30T10:03:05.027" Score="2" ViewCount="1020" Body="&lt;p&gt;I have imported some data for a client, and it turns out there are some duplicates in the csv-files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to remove or filter out duplicates, either in my entries-query or in my template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My query looks like this now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dealers = craft.entries({section:'dealers'}).order('dealerName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="326" LastActivityDate="2014-06-30T10:21:35.757" Title="Is there a way to remove or filter out duplicate entries?" Tags="&lt;entries&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="613" PostTypeId="2" ParentId="609" CreationDate="2014-06-30T10:04:24.293" Score="4" Body="&lt;p&gt;As &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot; rel=&quot;nofollow&quot;&gt;that page in the docs says&lt;/a&gt;, dedicated controller action URLs will look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/actions/pluginHandle/actionName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your plugin’s name is “CocktailRecipes”, and you have a controller located at plugins/cocktailrecipes/controllers/CocktailRecipesController.php, and within that you have a function called &lt;code&gt;actionSaveIngredient()&lt;/code&gt;, you would get to that via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/actions/cocktailRecipes/saveIngredient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your controller is actually called CocktailRecipes_IngredientsController.php, it would be this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/actions/cocktailRecipes/ingredients/saveIngredient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your plugin can also register a route (either &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow&quot;&gt;CP-facing&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow&quot;&gt;site-facing&lt;/a&gt;) which could provide a cleaner endpoint for the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'saveIngredient' =&amp;gt; array('action' =&amp;gt; 'cocktailRecipes/ingredients/saveIngredient'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you had that in place, you’d be able to access CocktailRecipes_IngredientsController’s actionSaveIngredients() like this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/saveIngredient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I don’t recommend trying to create a route for your controller until you’ve figured out how to get a basic action URL to point to it correctly. No need to add another step of complexity while you’re still troubleshooting.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-30T10:04:24.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="614" PostTypeId="2" ParentId="612" CreationDate="2014-06-30T10:21:35.757" Score="3" Body="&lt;p&gt;First you would need to figure out how to identify duplicates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn’t allow duplicate entry slugs; it will append “-1”, “-2”, etc. to them to keep them unique. So that would probably be a good starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use this query to get a list of all entries that have a number appended to the end of the slug. It’ll tell you the entry title, its section’s name, and the URL to edit it in the control panel. (Just update “example.com” with the actual host name.) Go through those and use your best judgement to decide which ones should be deleted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT c.title, s.name AS sectionName, CONCAT('http://example.com/admin/entries/', s.handle, '/', el.elementId) AS cpUrl&#xA;FROM craft_elements_i18n el&#xA;INNER JOIN craft_content c ON c.elementId = el.elementId&#xA;INNER JOIN craft_entries en ON en.id = el.elementId&#xA;INNER JOIN craft_sections s ON s.id = en.sectionId&#xA;WHERE el.slug REGEXP '\-[0-9]+$'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-30T10:21:35.757" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="615" PostTypeId="1" AcceptedAnswerId="619" CreationDate="2014-06-30T10:53:51.090" Score="2" ViewCount="2036" Body="&lt;p&gt;Im trying to update an entry field programatically. I can load an entry by any field with a function i created&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    /**&#xA; * Returns an element by any attribute.&#xA; *&#xA; * @param int $elementId&#xA; * @param string|null $type&#xA; * @param string|null $localeId&#xA; * @param string $localeId&#xA; * @return BaseElementModel|null&#xA; */&#xA;public function getElementByField($elementId, $elementType = null, $localeId = null, $field)&#xA;{&#xA;    if (!$elementId)&#xA;    {&#xA;        return null;&#xA;    }&#xA;&#xA;    if (!$elementType)&#xA;    {&#xA;        $elementType = craft()-&amp;gt;elements-&amp;gt;getElementTypeById($elementId);&#xA;&#xA;        if (!$elementType)&#xA;        {&#xA;            return null;&#xA;        }&#xA;    }&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria($elementType);&#xA;    $criteria-&amp;gt;$field = $elementId;&#xA;    $criteria-&amp;gt;locale = $localeId;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;localeEnabled = null;&#xA;    return $criteria-&amp;gt;first();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i cant save the new values of the fields i want.&#xA;This is my save code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $this-&amp;gt;getElementByField(&quot;3081001100390&quot;, ElementType::Entry, null, &quot;variantSku&quot;);&#xA;    $entry-&amp;gt;variantSku = 1;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the error is  Property &quot;Craft\EntryModel.variantSku&quot; is not defined. I know the variantSku exists since im loading a product by that attribute and i can see it when dumping $entry-&gt;variantSku.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complete error here: &lt;a href=&quot;https://www.diigo.com/item/image/4u33k/972k&quot; rel=&quot;nofollow&quot;&gt;https://www.diigo.com/item/image/4u33k/972k&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did anyone achieved this?&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-06-30T12:13:38.710" Title="Update entry programatically" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="616" PostTypeId="2" ParentId="604" CreationDate="2014-06-30T11:03:08.267" Score="7" Body="&lt;p&gt;Craft will only check for templates in your plugin’s templates/ folder during CP and action requests. When you start routing to your controller action via a site-facing route, it’s no longer either one of those; it’s just a normal Site request. So you will need to point Craft to your plugin’s templates folder explicitly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Point Craft to this plugin's templates/ folder&#xA;$templatesPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'myplugin/templates/';&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($templatesPath);&#xA;&#xA;// Render and output the template&#xA;$this-&amp;gt;renderTemplate('_mytemplate', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that it will no longer be necessary to include your plugin’s handle in the template path.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-06-30T18:58:23.410" LastActivityDate="2014-06-30T18:58:23.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="617" PostTypeId="2" ParentId="603" CreationDate="2014-06-30T11:14:23.630" Score="4" Body="&lt;p&gt;If you're wanting to avoid a loop, I think the best solution here would be to find the entries which &lt;em&gt;do&lt;/em&gt; have a category set and work backwards using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;|without()&lt;/code&gt;&lt;/a&gt; filter. I can't see this being possible in only one query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# First, get your categories #}&#xA;{% set categories = craft.categories.group('optionalGroup').ids() %}&#xA;&#xA;{# Find all news entries which have a category set #}&#xA;{% set newsWithCategories = craft.entries.section('news').relatedTo({targetElement: categories}).ids() %}&#xA;&#xA;{# Now find news without categories #}&#xA;{% set newsWithoutCategories = craft.entries.section('news').ids()|without(newsWithCategories) %}&#xA;&#xA;{# Finally retrieve the EntryModels #}&#xA;{% set newsEntries = craft.entries.section('news').id(newsWithoutCategories).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, there are quite a few calls to the DB being made here. This little algorithm would probably be more efficient with a loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsEntries = [] %}&#xA;{% for news in craft.entries.section('news').find() %}&#xA;    {% if news.categories is empty %}&#xA;        {% set newsEntries = newsEntries|merge([news]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-06-30T11:14:23.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="618" PostTypeId="2" ParentId="608" CreationDate="2014-06-30T11:20:12.997" Score="12" Body="&lt;p&gt;Craft’s bootstrap file in located at craft/app/index.php. Importing that will get you 99% of the way there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem is, index.php not only loads Craft, it also runs it. In doing so, Craft is going to insist that it completely resolves the request, with a response to the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m thinking we should move most of that code into a new bootstrap.php file, with the only exception being the last line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then index.php would simply import bootstrap.php and call &lt;code&gt;$app-&amp;gt;run()&lt;/code&gt; itself. That way you could import bootstrap.php rather than index.php, and do whatever you want with the app, like &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;fetch entries&lt;/a&gt;, without losing control over the whole request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you could copy the contents, sans &lt;code&gt;$app-&amp;gt;run()&lt;/code&gt;, of index.php into your own file and import that instead. You’d need to go through it and update all of the paths, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be to make Craft think the page should be a 404, and catch the 404 exception:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Make it look like a 404&#xA;$_GET['p'] = &quot;some/invalid/path&quot;;&#xA;&#xA;// Import Craft, catching the 404&#xA;try&#xA;{&#xA;    require 'path/to/craft/app/index.php';&#xA;}&#xA;catch (\Craft\HttpException $e){}&#xA;&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Little hacky, but that may be your cleanest option until we give you a bootstrap.php file to import instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2&lt;/a&gt;, Craft now ships with a &lt;strong&gt;bootstrap.php&lt;/strong&gt; file which handles all of the app initialization stuff with the exception of actually calling &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#run-detail&quot; rel=&quot;nofollow&quot;&gt;run()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you include bootstrap.php(), a new &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;Craft application&lt;/a&gt; will be returned.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$craft = require 'craft/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-02T19:41:04.753" LastActivityDate="2014-09-02T19:41:04.753" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="619" PostTypeId="2" ParentId="615" CreationDate="2014-06-30T12:13:38.710" Score="4" Body="&lt;p&gt;After some research, i found a way to achieve this. Here is my full controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;  namespace Craft;&#xA;&#xA;  class Module_ControlController extends BaseController {&#xA;   protected $allowAnonymous = true;&#xA;public function actionChangeStock()&#xA;{&#xA;    $entry = $this-&amp;gt;getElementByField(&quot;3081001100390&quot;, ElementType::Entry, null, &quot;variantSku&quot;);&#xA;    $entry-&amp;gt;enabled = false;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'variantSku' =&amp;gt; &quot;Hello my friend!&quot;,&#xA;        'variantStock'  =&amp;gt; &quot;3&quot;&#xA;    ));&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;    die(var_dump($success));&#xA;}&#xA;&#xA;/**&#xA; * Returns an element by any attribute.&#xA; *&#xA; * @param int $elementId&#xA; * @param string|null $type&#xA; * @param string|null $localeId&#xA; * @return BaseElementModel|null&#xA; */&#xA;public function getElementByField($elementId, $elementType = null, $localeId = null, $field)&#xA;{&#xA;    if (!$elementId)&#xA;    {&#xA;        return null;&#xA;    }&#xA;&#xA;    if (!$elementType)&#xA;    {&#xA;        $elementType = craft()-&amp;gt;elements-&amp;gt;getElementTypeById($elementId);&#xA;&#xA;        if (!$elementType)&#xA;        {&#xA;            return null;&#xA;        }&#xA;    }&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria($elementType);&#xA;    $criteria-&amp;gt;$field = $elementId;&#xA;    $criteria-&amp;gt;locale = $localeId;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;localeEnabled = null;&#xA;    return $criteria-&amp;gt;first();&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-06-30T12:13:38.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="620" PostTypeId="1" AcceptedAnswerId="621" CreationDate="2014-06-30T14:26:28.927" Score="8" ViewCount="2945" Body="&lt;p&gt;Is there any known way to get all the entries from a certain channel? I dont want to do this in a view but in PHP since i need to do a bulk update of an attribute to all the entries in a certain channel.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-06-30T14:33:54.547" Title="Get all entries from a channel" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="621" PostTypeId="2" ParentId="620" CreationDate="2014-06-30T14:32:05.140" Score="12" Body="&lt;p&gt;You would do that using an ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'mySectionHandle';&#xA;$criteria-&amp;gt;limit = null;&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read all about how to work with ElementCriteriaModel’s in the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot;&gt;Working with Elements&lt;/a&gt; guide in the Craft docs.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="177" LastEditDate="2014-06-30T14:33:54.547" LastActivityDate="2014-06-30T14:33:54.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="622" PostTypeId="1" CreationDate="2014-06-30T14:51:58.063" Score="1" ViewCount="820" Body="&lt;p&gt;I'm trying to use a custom icon font for a plugin, so I added it with font-face like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;/* styles.css */&#xA;&#xA;@font-face {&#xA;  font-family: 'scrawlfont';&#xA;  src:url('fonts/icomoon.eot');&#xA;  src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),&#xA;    url('fonts/icomoon.woff') format('woff'),&#xA;    url('fonts/icomoon.ttf') format('truetype'),&#xA;    url('fonts/icomoon.svg#icomoon') format('svg');&#xA;  font-weight: normal;&#xA;  font-style: normal;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My folder structure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugin directory/&#xA;  resources/&#xA;    css/&#xA;      styles.css (contains the font-face snippet above)&#xA;      fonts/&#xA;        icomoon.eot&#xA;        icomoon.woff&#xA;        icomoon.ttf&#xA;        icomoon.svg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I load my page I get 404 not found errors for all font files except .eot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KipUf.png&quot; alt=&quot;Font-face error&quot;&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KipUf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Click to enlarge)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts appreciated, Mario&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had wrong permissions on my font folder and files.&#xA;I set correct permissions using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chmod 755 fonts/&#xA;chmod 644 fonts/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="304" LastEditorUserId="304" LastEditDate="2014-07-01T09:21:55.120" LastActivityDate="2014-07-01T09:21:55.120" Title="Font-face in plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="623" PostTypeId="2" ParentId="574" CreationDate="2014-06-30T16:04:07.507" Score="4" Body="&lt;p&gt;Or if you have the available space already on your general hosting/vps/etc. account store the assets locally and if you are looking for CDN acceleration put CloudFlare in front of the web site, which also provides abuse protection, DDoS and other acceleration options too.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2014-06-30T16:04:07.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="624" PostTypeId="2" ParentId="422" CreationDate="2014-06-30T16:12:04.823" Score="2" Body="&lt;p&gt;The problem you are having is with your Craft &lt;strong&gt;edition&lt;/strong&gt;... as in, which level of Craft did you pay for: Personal, Client, or Pro? If you didn't buy &lt;strong&gt;Craft Pro&lt;/strong&gt;, then you can't save assets to a cloud service. And since you can't save to the cloud, all of your assets will be automatically saved to a &lt;strong&gt;Local Folder&lt;/strong&gt;. The Type menu is only shown in &lt;strong&gt;Craft Pro&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-06-30T16:12:04.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="625" PostTypeId="2" ParentId="622" CreationDate="2014-06-30T16:46:47.007" Score="1" Body="&lt;p&gt;Your paths and file-names look good to me. Since everything except .eot gives you a 404 error, I assume it has something to do with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Internet_media_type&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIME Types&lt;/a&gt;, or browser support:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Apache and IIS you sometimes have to add the MIME-Types yourself, see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/a/7374640/3589841&quot;&gt;Answer on StackOverflow&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://coderwall.com/p/v4uwyq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Firefox @fontface cross domain errors &amp;amp; workarounds&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also check if your fonts load on other browsers, if so check out this article:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://readableweb.com/mo-bulletproofer-font-face-css-syntax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mo' Bulletproofer @Font-Face&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Also since every resource request goes through the &lt;code&gt;ìndex.php&lt;/code&gt;, it might as well be a Craft bug.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-06-30T16:46:47.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="626" PostTypeId="2" ParentId="590" CreationDate="2014-06-30T16:51:46.673" Score="3" Body="&lt;p&gt;I was working on a site where I needed dynamic sub nav similar to what I think you are describing - in order to solve the issue I set my arrays at the top of the page calculating by entry.level and page parent. I didn't do anything with active classes yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the nav tree is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;About&#xA;--Leaders&#xA;--History&#xA;Groups&#xA;--Men&#xA;----Men Book Group&#xA;--Women&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you click on About you will be presented only with the sub nav &quot;Leaders&quot; and &quot;History&quot; and with my particular implementation it will display only the sub nav that belongs to a 2nd level nav item as well... so if you navigate to &quot;Men&quot; it will only show &quot;Men Book Group&quot; in the sidenav. I think you should be able to make it show that whole tree if you took of the if statement related to the 3rd level.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == '1' %}&#xA;&#xA;    {% set pages = craft.entries.section('page').descendantOf( entry.id ).descendantDist(1) %}&#xA;    {% set parentLink = entry %}&#xA;&#xA;{% elseif entry.level == '2' %}&#xA;&#xA;    {% if entry.children.first == TRUE %}&#xA;&#xA;        {% set pages = craft.entries.section('page').descendantOf( entry.id ) %}&#xA;        {% set parentLink = entry %}&#xA;&#xA;    {% else %}&#xA;&#xA;         {% set pages = craft.entries.section('page').descendantOf( entry.parent ) %}&#xA;         {% set parentLink = entry.parent %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% elseif entry.level == '3' %}&#xA;&#xA;    {% set pages = craft.entries.section('page').descendantOf( entry.parent ) %}&#xA;    {% set parentLink = entry.parent %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My sub nav code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ parentLink.url }}&quot;&amp;gt;{{ parentLink.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;ul&amp;gt;&#xA;            {% nav page in pages %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    {% if page.type == 'link'  %}&#xA;                        {% set link = page.destination %}&#xA;                        &amp;lt;a href=&quot;{{ link.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                    {% else %}&#xA;                        &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;                    {% endif %}&#xA;&#xA;                    {% ifchildren %}&#xA;                        &amp;lt;ul&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endifchildren %}&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;            &amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps and I apologize if I have misunderstood the question!&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2014-06-30T16:51:46.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="627" PostTypeId="1" AcceptedAnswerId="637" CreationDate="2014-06-30T18:29:28.867" Score="8" ViewCount="788" Body="&lt;p&gt;Curious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would just be passing a string to the path of the image.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-01-11T15:14:18.133" Title="Can I apply an image transformation to an arbitrary image (non-Assets field)?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="628" PostTypeId="2" ParentId="590" CreationDate="2014-06-30T18:42:56.500" Score="17" Body="&lt;p&gt;A recursive macro will help you get around the limitations of &lt;code&gt;ifchildren&lt;/code&gt; (which P&amp;amp;T will hopefully resolve soon), as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set mainEntry = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;{% set subnav = craft.entries.descendantOf(mainEntry).level(2) %}&#xA;&#xA;{% macro recursiveChildren(page) %}&#xA;  {% if page.hasDescendants and page.slug == craft.request.getSegment(page.level) %}&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for subpage in page.children %}&#xA;          &amp;lt;li{% if subpage.slug == craft.request.getSegment(subpage.level) %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;            {{ subpage.link }}&#xA;            {{ _self.recursiveChildren(subpage) }}&#xA;          &amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for page in subnav %}&#xA;  &amp;lt;li{% if page.slug == craft.request.getSegment(page.level) %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;    {{ page.link }}&#xA;    {{ _self.recursiveChildren(page) }}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot;&gt;macros here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="127" LastEditDate="2014-07-01T11:05:15.813" LastActivityDate="2014-07-01T11:05:15.813" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="629" PostTypeId="1" CreationDate="2014-06-30T19:41:48.450" Score="9" ViewCount="1689" Body="&lt;p&gt;I've ended up with loads of duplicate entries after a botched import job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy and safe way to delete all entries in a section, so that I can start over again?&lt;/p&gt;&#xA;" OwnerUserId="326" LastActivityDate="2016-08-15T11:14:56.133" Title="Is there a way to delete all entries in a section?" Tags="&lt;entries&gt;&lt;database&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="630" PostTypeId="1" AcceptedAnswerId="640" CreationDate="2014-06-30T19:42:00.593" Score="2" ViewCount="1424" Body="&lt;p&gt;I'm having a bit of a hard time wrapping my head around exactly how to work with both Relationships and Assets. Here is my current problem that I seem to be stumped on, i'm sure once I get this going I'll be good to go and fully understand how to work with both:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to determine if an entry is selected to be related to an entry single (the homepage) via the entry field 'featuredEvent', then&#xA;I need to determine if the 'image' block is being used in the matrix 'articleBody' in that related entry, then&#xA;I need to pull the first instance of the 'image' block (not necessarily the first block altogether), then&#xA;I need to determine if there is more than one 'asset/image' in the 'image' field in the 'image' block in the related entry, then&#xA;If there is only one image I need to output some code, and then output the image, as well as the other parameters 'size' &amp;amp; 'alignment', which are both drop downs, 'size' selects the pre-determined 'imageTransform' where as 'alignment' just applies a class or&#xA;If there are multiple images i need to output some code, and then output the images, as well as the other parameters 'size' &amp;amp; 'alignment'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anybody write that code out for me and explain what is happening in each line to help me get a better grasp? Thank you so much in advance.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="87" LastEditDate="2014-06-30T20:49:27.037" LastActivityDate="2014-06-30T22:17:15.693" Title="How do I pull related entries and assets?" Tags="&lt;entries&gt;&lt;assets&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="631" PostTypeId="2" ParentId="627" CreationDate="2014-06-30T19:52:45.447" Score="3" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A transform can only be applied to an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModel&lt;/a&gt;, and there is no AssetFileModel for a random image.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-30T19:52:45.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="632" PostTypeId="2" ParentId="629" CreationDate="2014-06-30T19:58:32.170" Score="7" Body="&lt;p&gt;If you delete the section, that will delete all the entries in the section as well.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-06-30T19:58:32.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="633" PostTypeId="1" AcceptedAnswerId="639" CreationDate="2014-06-30T20:12:11.487" Score="5" ViewCount="1257" Body="&lt;p&gt;While I know the back button does this perfectly well, I was wondering if there was a good way to &quot;return to&quot; a paginated page using a previous request or something? Wanting to do this server-side rather than relying on JS. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2018-02-12T10:06:26.020" Title="Back to paginated page" Tags="&lt;pagination&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="634" PostTypeId="2" ParentId="633" CreationDate="2014-06-30T20:34:02.493" Score="2" Body="&lt;p&gt;I'd guess if this existed it would be available through craft.session. Unfortunately, I don't see any reference to a variable for the previous page's URL in the documentation for craft.session:   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.session&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/craft.session&lt;/a&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-30T20:34:02.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="635" PostTypeId="2" ParentId="633" CreationDate="2014-06-30T20:37:03.317" Score="4" Body="&lt;p&gt;This is not something built into Craft, but you could accomplish this with a plugin. You could have it run during your plugin's init function. On each page load, it would take the current page and load it into a &lt;code&gt;currentUrl&lt;/code&gt; session variable. Then when you went to another page, the previous page url would move from &lt;code&gt;currentUrl&lt;/code&gt; to a &lt;code&gt;prevUrl&lt;/code&gt; session variable, and the current one would go into &lt;code&gt;currentUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would write a template variable to check and output them in your templates. You could possibly work with Craft's session flashes, but you would have to remember to tell it not to delete them when you grabbed them.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-30T20:37:03.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="636" PostTypeId="2" ParentId="629" CreationDate="2014-06-30T20:37:50.907" Score="3" Body="&lt;p&gt;There is currently no way to select and delete all entries specific to a section through the control panel interface. &lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2014-06-30T20:37:50.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="637" PostTypeId="2" ParentId="627" CreationDate="2014-06-30T21:05:51.887" Score="12" Body="&lt;p&gt;While &lt;em&gt;transforms&lt;/em&gt; are an asset-only feature, you can get at all of the underlying image manipulation features pretty easily using the ImagesService.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$image = craft()-&amp;gt;images-&amp;gt;loadImage($imageSource);&#xA;$image-&amp;gt;setQuality($quality);&#xA;$image-&amp;gt;resize($transform-&amp;gt;width, $transform-&amp;gt;height);&#xA;$image-&amp;gt;saveAs($targetFile);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-30T21:05:51.887" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="638" PostTypeId="2" ParentId="562" CreationDate="2014-06-30T21:57:12.473" Score="6" Body="&lt;p&gt;Nope, because MySQL doesn't support RegEx replacements in SQL statements.  It's been an &lt;a href=&quot;http://bugs.mysql.com/bug.php?id=27389&quot; rel=&quot;nofollow&quot;&gt;open feature request&lt;/a&gt; since 2007, so feel free to add your vote.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some potential workarounds &lt;a href=&quot;https://stackoverflow.com/questions/986826/how-to-do-a-regular-expression-replace-in-mysql&quot;&gt;listed here&lt;/a&gt;, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-06-30T22:44:22.270" LastActivityDate="2014-06-30T22:44:22.270" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="639" PostTypeId="2" ParentId="633" CreationDate="2014-06-30T22:00:55.303" Score="6" Body="&lt;p&gt;The easiest way would be to check &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#urlReferrer&quot;&gt;craft.request.urlReferrer&lt;/a&gt; and see if they just came from the entry index page. If so, provide a link to send them back.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set referrer = craft.request.urlReferrer %}&#xA;{% set indexBaseUrl = url('articles') %}&#xA;&#xA;{% if referrer and referrer|slice(0, indexBaseUrl|length) == indexBaseUrl %}&#xA;    &amp;lt;a href=&quot;{{ referrer }}&quot;&amp;gt;Go back&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another, more explicit way to do it would be to actually pass the current page in the query string of the entry URLs, from the entry index page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% set url = url(entry.uri, { page: craft.request.pageNum }) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you could check for that “page” query string param in the single entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set indexPage = craft.request.getQuery('page') %}&#xA;{% if indexPage %}&#xA;    {% set indexUrl = url('articles/' ~ craft.config.pageTrigger ~ indexPage) %}&#xA;    &amp;lt;a href=&quot;{{ indexUrl }}&quot;&amp;gt;Go back&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-06-30T22:00:55.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="640" PostTypeId="2" ParentId="630" CreationDate="2014-06-30T22:17:15.693" Score="13" Body="&lt;p&gt;The data in Craft is handled mostly by Models (and arrays of Models). Before pulling actual information, you define your criteria in an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt; using generic parameters and parameters specific to what you are trying to get (&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;entries&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot;&gt;assets&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot;&gt;etc.&lt;/a&gt;). You then use one of the ElementCriteriaModel's functions to pull the actual data. You will get either a model or an array of models to loop over. This works the same for most things in Craft because most things are Elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look under the Variables heading in the side menu of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/&quot;&gt;templating docs&lt;/a&gt; to see the kinds of models you will get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your homepage, you start with an automatically created &lt;code&gt;entry&lt;/code&gt; model (this is created on every page that Craft recognizes as an entry's page). Here's the basic code you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in entry.featuredEvent %}&#xA;    {# Output some event code here #}&#xA;    {% set block = event.articleBody.type('image').first() %}&#xA;    {% for image in block.image.find() %}&#xA;        {# Output some image code here #}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl(image.size) }}&quot; class=&quot;{{ image.alignment }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So an explanation of the above. In Craft, related elements are not automatically pulled from the DB. Instead each field that points to a related element (entries, assets, categories, users, etc.) is an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; so that you add more criteria before pulling. So &lt;code&gt;entry.featuredEvent&lt;/code&gt; is an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; that points to all of your featured event entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When working with &lt;code&gt;ElementCriteriaModel&lt;/code&gt; you have a few options to pull the data and use it. In the above code, when you give a &lt;code&gt;for&lt;/code&gt; loop &lt;code&gt;ElementCriteriaModel&lt;/code&gt; it will automatically pull the data and give the loop entries. So we take the &lt;code&gt;entry.featuredEvent&lt;/code&gt;, and loop over the entries that's given to us when we use it in the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the for loop, we pull the first image block in &lt;code&gt;event.articleBody&lt;/code&gt;. Because matrix blocks are elements, we get the same features. So we set the type, and pull the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the next &lt;code&gt;for&lt;/code&gt; loop, we are grabbing all of our images in the image block. The tricky part here is that we can make the code a little more efficient by simply pulling all of the images and looping over them. If you have very different html you plan on using for one image and multiple images, you will need to &lt;code&gt;set&lt;/code&gt; the images as a variable like we did the block. You can then check the number of images using the &lt;code&gt;length&lt;/code&gt; filter, and either Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#switch&quot;&gt;&lt;code&gt;switch&lt;/code&gt;&lt;/a&gt; tag, or a couple &lt;code&gt;if&lt;/code&gt; statements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I recommend using the loop, and using CSS to make the style differences you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we output each image. Because you're using a transform on them, we can't use each assets &lt;code&gt;getImg&lt;/code&gt; function. Instead we write the img tag manually and grab the transformed url using &lt;code&gt;getUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next bit is making a couple assumptions. I'm assuming that &lt;code&gt;size&lt;/code&gt; is a image transform handle. I'm also assuming that these fields are on the asset. If they're on the matrix block, replace &lt;code&gt;image.size&lt;/code&gt; and &lt;code&gt;image.alignment&lt;/code&gt; with &lt;code&gt;block.size&lt;/code&gt; and &lt;code&gt;block.alignment&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-06-30T22:17:15.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="641" PostTypeId="1" CreationDate="2014-07-01T08:10:03.783" Score="6" ViewCount="527" Body="&lt;p&gt;Our client wants a poll on the website.&#xA;How can I deal with client input and update the entry?&#xA;I found the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry-Form example&lt;/a&gt;, but this doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The title field is the question and the admin can add answers with a matrix field. Within the matrix fields there are 2 fields: answer and totalVotes &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form class=&quot;poll__questions&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.getPath }}?success=√&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;38&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ pollentry.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {{% for answer in pollentry.answers %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; name=&quot;fields[answers][{{ answer.id }}][fields][totalVotes]&quot; value=&quot;{{ answer.totalVotes + 1 }}&quot;&amp;gt; {{ answer.answer }}&amp;lt;/label&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;button button--third&quot;&amp;gt;Vote&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anybody know why this doesn't work. It submits the form without visible errors, but it doens't update the entry.&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="177" LastEditDate="2014-07-12T12:41:08.360" LastActivityDate="2014-09-26T20:59:49.720" Title="How to deal with client input your site?" Tags="&lt;entries&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="642" PostTypeId="2" ParentId="629" CreationDate="2014-07-01T10:07:22.040" Score="5" Body="&lt;p&gt;Not really an answer, as such (as others have pointed out there's no way to mass delete from the CP, yet), but when I'm trialling imports I take a DB backup via the CP before and if the import fails or I need to rollback I simply restore the DB.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-07-01T10:07:22.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="643" PostTypeId="1" AcceptedAnswerId="647" CreationDate="2014-07-01T10:10:58.180" Score="2" ViewCount="75" Body="&lt;p&gt;Are there some logs which tell, what the member does in the backend?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like: &quot;User: «John Doe» Edited this entry at this and that date&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a bit more information than what is written on the member account:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z0fUx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2014-07-01T11:50:34.160" LastActivityDate="2014-07-01T12:31:37.813" Title="Member ControlPanel Logs?" Tags="&lt;control-panel&gt;&lt;member&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="644" PostTypeId="1" AcceptedAnswerId="805" CreationDate="2014-07-01T11:26:38.287" Score="14" ViewCount="3933" Body="&lt;p&gt;What’s the best way to paginate search results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.search(query).section('…').limit(…).order('…') as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the pagination links (paginate.prevUrl and paginate.nextUrl) don’t contain the query.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="9" LastEditDate="2015-01-27T11:25:37.053" LastActivityDate="2015-01-27T11:25:37.053" Title="How to paginate search results?" Tags="&lt;pagination&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="645" PostTypeId="2" ParentId="644" CreationDate="2014-07-01T11:29:34.917" Score="2" Body="&lt;p&gt;I think this will work   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ paginate.prevUrl }}?search=' ~ (craft.request.getParam('search'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="390" LastActivityDate="2014-07-01T11:29:34.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="646" PostTypeId="2" ParentId="603" CreationDate="2014-07-01T11:37:23.280" Score="11" Body="&lt;p&gt;You can do this in a single query using the search parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set uncategorized = craft.entries.section('news').search('-categories:*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot;&gt;searching here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-07-01T11:37:23.280" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="647" PostTypeId="2" ParentId="643" CreationDate="2014-07-01T12:31:37.813" Score="2" Body="&lt;p&gt;Not currently... we've discussed adding a sort of audit or activity trail to Craft itself, but haven't flushed out any details or timeline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you could probably get 95% there with a custom plugin that listens to the various Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;events&lt;/a&gt; you're interested in.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-01T12:31:37.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="648" PostTypeId="1" AcceptedAnswerId="656" CreationDate="2014-07-01T14:09:06.383" Score="6" ViewCount="7526" Body="&lt;p&gt;From either a plugin or a Twig template, is there a prescribed way to set (and get) cookies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lewisjenkins/craft-lj-cookies/&lt;/a&gt;, which just uses PHP's &lt;code&gt;setcookie&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also noticed &lt;code&gt;getCookie&lt;/code&gt; in &lt;code&gt;craft.request&lt;/code&gt;. &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getCookie&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request#getCookie&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've noticed the cookies set with &lt;code&gt;setcookie&lt;/code&gt; aren't readable by &lt;code&gt;getCookie&lt;/code&gt;. How should one set a cookie so that it is readable by &lt;code&gt;getCookie&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="3951" LastEditDate="2017-10-24T12:52:29.157" LastActivityDate="2019-10-11T10:42:23.267" Title="Prescribed way to set cookies (from plugin or Twig)" Tags="&lt;plugin-development&gt;&lt;cookies&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="649" PostTypeId="1" CreationDate="2014-07-01T14:41:07.550" Score="2" ViewCount="169" Body="&lt;p&gt;I've found it a little challenging to use global sets effectively, so I'm wondering how others are doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that a global &lt;em&gt;has&lt;/em&gt; to be in a set has been a little tricky to deal with at the beginning a of a build, as knowing what those sets might be is hard when there aren't any globals yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leaves me using sets like &quot;Misc&quot;, &quot;Content&quot;, and &quot;Settings&quot;, which doesn't end up being all that helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The arbitrary nature of these assignments also present a problem when using those globals, because you have to call them with their set name &lt;code&gt;{{ settings.analyticsId }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just thinking out loud, and wondering how others are dealing!&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-07-01T16:25:14.167" Title="How are people organizing their global sets?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="650" PostTypeId="1" CreationDate="2014-07-01T14:51:54.173" Score="2" ViewCount="331" Body="&lt;p&gt;I would like to have some advise on the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll be running a site with events. These events (channel entries) will take place in a certain city. I don't want to setup every city as a category, but use tags instead. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it logical to use tags for cities?&lt;/li&gt;&#xA;&lt;li&gt;Can I list all events based on a city (tag) on my template?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="177" LastEditDate="2014-07-01T15:53:27.547" LastActivityDate="2014-07-01T16:03:53.053" Title="Should I use tags for cities?" Tags="&lt;entries&gt;&lt;tags&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="651" PostTypeId="1" CreationDate="2014-07-01T15:13:50.650" Score="1" ViewCount="631" Body="&lt;p&gt;Does anybody know if it is possible to overwrite entry.title in a template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following 2 options causes errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry.title = 'value' %}&#xA;{% set entry['title'] = 'value' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="390" LastActivityDate="2014-07-01T16:05:35.793" Title="Overwrite entry.title in template" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="652" PostTypeId="2" ParentId="650" CreationDate="2014-07-01T15:34:44.863" Score="3" Body="&lt;p&gt;Probably and yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Using tags for cities:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to allow users to add any city they want, tags are perfect. If not, you should predefine them, and use categories, dropdowns or multi-selects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you don't know if the user has actually entered a city, you should consider validating it with a custom plugin:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wait for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onBeforeSaveEntry&lt;/a&gt; event&lt;/li&gt;&#xA;&lt;li&gt;Check if the entered tag is a city. (You could use the &lt;a href=&quot;https://developers.google.com/maps/documentation/geocoding/?hl=de&quot; rel=&quot;nofollow&quot;&gt;Google Geocoding API&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;List entries which have a specific tag:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;relations&lt;/a&gt; to find all entries which have a specific tag:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set tag = craft.tags.name('miami') %}&#xA;{% set relatedEntries = craft.entries.section('events').relatedTo(tag) %}&#xA;&#xA;{# Gets all entries which have the 'miami' tag #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-01T15:34:44.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="653" PostTypeId="2" ParentId="650" CreationDate="2014-07-01T15:52:40.050" Score="3" Body="&lt;p&gt;I agree with Victor, but if you're looking to loop through all the cities (regardless of how many you have) and show entries related to them I'd do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('events').limit(null) %}&#xA;{% for tag in craft.tags('cities') %}&#xA;    &amp;lt;h2&amp;gt;{{ tag }}&amp;lt;/h2&amp;gt;&#xA;        {% for entry in entries.relatedTo(tag) %}&#xA;            {# entry #}&#xA;        {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="177" LastEditDate="2014-07-01T15:57:00.743" LastActivityDate="2014-07-01T15:57:00.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="654" PostTypeId="2" ParentId="650" CreationDate="2014-07-01T16:03:53.053" Score="3" Body="&lt;p&gt;There is an address plugin available, that might be useful for your event locations. It's called &lt;a href=&quot;https://github.com/lindseydiloreto/craft-smartmap/wiki&quot; rel=&quot;nofollow&quot;&gt;craft-smartmap&lt;/a&gt; by Lindsey D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addresses are auto-completed on input, latitude and longitude are calculated (for maps output etc.) and you have access to the cities names like with any other field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if it's overkill for your goals and you just need the city names. Nevertheless added this here as it might be worth a look.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-01T16:03:53.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="655" PostTypeId="2" ParentId="651" CreationDate="2014-07-01T16:05:35.793" Score="5" Body="&lt;p&gt;It's my understanding that &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot;&gt;Twig's set tag&lt;/a&gt; can only be used on variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in your case &lt;code&gt;entry&lt;/code&gt; is an object and &lt;code&gt;title&lt;/code&gt; is it's &lt;a href=&quot;http://php.net/manual/en/language.oop5.properties.php&quot;&gt;property&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could however create a work-around:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set my_title = 'New' %}&#xA;{{ my_title is defined ? my_title : entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;my_title&lt;/code&gt; is defined it will be outputted.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-01T16:05:35.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="656" PostTypeId="2" ParentId="648" CreationDate="2014-07-01T16:17:23.977" Score="6" Body="&lt;p&gt;Cookies cannot be set via templates. However, in a plugin you have access to Craft's services. The &lt;code&gt;UserSessionService&lt;/code&gt; has the &lt;code&gt;saveCookie&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie($cookieName, $data, $duration);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-01T16:17:23.977" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="657" PostTypeId="2" ParentId="649" CreationDate="2014-07-01T16:25:14.167" Score="1" Body="&lt;p&gt;Before I create any fields I try to plan them on paper. This helps me to create my first logical groups. It doesn't prevent changes later on, but at least reduces them a little.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also all my global sets have prefix: &lt;code&gt;global__settings&lt;/code&gt;, &lt;code&gt;global__misc&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if I have to create a new set and move some fields, I can do a &quot;Search &amp;amp; Replace&quot; on all templates, and thanks to the prefix I don't have to worry about replacing the wrong variables.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-01T16:25:14.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="658" PostTypeId="1" AcceptedAnswerId="660" CreationDate="2014-07-01T17:33:16.833" Score="5" ViewCount="3863" Body="&lt;p&gt;I have set up a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix field&lt;/a&gt; with three blocks, each contains a &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow&quot;&gt;Table field&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each table has one column - a single line text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I call these tables into the template with this code, each row is echoed twice:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.projectFacts.limit(3) %}&#xA;    &amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&#xA;    {% switch block.type %}&#xA;        {% case 'code' %}&#xA;            {% if block.codePoints | length %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% for items in block.codePoints %}&#xA;&#xA;                        /* Outputs &quot;Array&quot; */&#xA;                        {{ items }}&#xA;&#xA;                        {% for wtf in items %}&#xA;                            /* Outputs identical content &amp;amp; wrapper twice */&#xA;                            &amp;lt;li&amp;gt;{{ wtf }}&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd be delighted if someone were able to point out what I need to do differently.&lt;/p&gt;&#xA;" OwnerUserId="413" LastEditorUserId="125" LastEditDate="2015-02-24T18:59:01.523" LastActivityDate="2016-04-14T08:20:51.180" Title="How to correctly output a Table Field?" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;table-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="660" PostTypeId="2" ParentId="658" CreationDate="2014-07-01T18:33:44.963" Score="10" Body="&lt;p&gt;I suppose in your example &lt;code&gt;codePoints&lt;/code&gt; is the actual Table field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to output the table rows, the template should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.codePoints | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for row in block.codePoints %}&#xA;         {# Assuming 'text' is the column handle of the text field #}&#xA;        &amp;lt;li&amp;gt;{{ row.text }}&amp;lt;/li&amp;gt; &#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You get a double output because every row contains an array containing each table field twice, it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(2) { [&quot;col1&quot;]=&amp;gt; string(4) &quot;Some&quot; [&quot;text&quot;]=&amp;gt; string(4) &quot;Some&quot; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's why when loop over &lt;code&gt;items&lt;/code&gt; you get every text twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="304" LastEditorUserId="4246" LastEditDate="2016-04-14T08:20:51.180" LastActivityDate="2016-04-14T08:20:51.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="661" PostTypeId="1" AcceptedAnswerId="662" CreationDate="2014-07-01T18:49:23.330" Score="16" ViewCount="6355" Body="&lt;p&gt;I see that there are &lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Trimmer&quot;&gt;Trimmer&lt;/a&gt; and &lt;a href=&quot;https://github.com/nizur/truncate/&quot;&gt;Truncate&lt;/a&gt; out there that have been created for truncating text but I don't believe either does what it is I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to truncate text similar to how &lt;a href=&quot;http://devot-ee.com/add-ons/hacksaw&quot;&gt;Hacksaw&lt;/a&gt; for ExpressionEngine works. Allowing me to allow or disallow html tags, and making sure that even if it cuts off before a tag is closed, that it automatically properly closes the tag. I wouldn't want to turn the entire lower half of my page into a hyperlink for instance if i happen to truncate mid-link. I do want to maintain the ability for links to be in the text that is being truncated, and multiple paragraphs, etc. however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips would be fantastic.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2020-06-09T01:18:08.177" Title="Best method of text truncating" Tags="&lt;templating&gt;&lt;richtext&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="662" PostTypeId="2" ParentId="661" CreationDate="2014-07-01T20:09:21.760" Score="18" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/ryanshrum/hacksaw&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ryanshrum/hacksaw&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This hasn't been fully tested for production, or documented for that matter, but I have migrated it over and tested &lt;strong&gt;basic&lt;/strong&gt; usage as per the docs on devot-ee. It should, at the very least, give you a nice start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the Twig filter with: &lt;code&gt;{{ entry.fieldHandle|hacksaw(words=&quot;100&quot;) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2016-11-02T21:11:11.110" LastActivityDate="2016-11-02T21:11:11.110" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="663" PostTypeId="1" AcceptedAnswerId="1012" CreationDate="2014-07-01T21:07:04.957" Score="8" ViewCount="612" Body="&lt;p&gt;So, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have two sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Recipes&#xA;- Ingredients&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Recipes can have many ingredients. Ingredients can have many recipes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm editing a Recipe, I can edit the ingredients. This updates the relationship so that when I edit ingredients it can show the associated recipes (and they are editable from the ingredients as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;====== EDIT ======&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to make this more clear. What I'm trying to do is create a Many to Many relationship between two Sections of Entries so there is an association between the two that works both ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example of this would be if you have a User with many Roles. I can manage which Users belong to which Roles from the Roles section, and/or I could manage which Roles a User belongs to from the Users section.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-07-02T16:26:41.333" LastActivityDate="2014-07-12T17:27:28.287" Title="Is it possible to create a fieldtype that creates a many to many relationship between two entry sections?" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="664" PostTypeId="2" ParentId="663" CreationDate="2014-07-01T21:16:56.420" Score="6" Body="&lt;p&gt;You can assign ingredients to recipes using the built-in &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot;&gt;Entries&lt;/a&gt; field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, to view which recipes an ingredient is used on, check out the &lt;a href=&quot;https://github.com/iainurquhart/craft_introvert&quot;&gt;Introvert&lt;/a&gt; plugin. It gives you a new field type that can be used to simply show reverse relationships, also providing links to edit those other entries.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-01T21:16:56.420" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="665" PostTypeId="1" AcceptedAnswerId="667" CreationDate="2014-07-01T21:56:30.027" Score="3" ViewCount="1113" Body="&lt;p&gt;I have two plugins that I want to use in a single form.  One is a Guest Entry plugin to save the data submitted in the form, and the other is a Plugin that sends an email notification when the form is submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use both of these in the same form but I'm not sure how.  If I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;formNotification/getForm&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It won't work since both have the name &quot;action&quot;&#xA;and I can't change the name or the functions never get called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to make both of them work?&lt;/p&gt;&#xA;" OwnerUserId="418" LastActivityDate="2020-11-20T08:09:31.497" Title="Multiple actions in a form?" Tags="&lt;plugins&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="666" PostTypeId="2" ParentId="665" CreationDate="2014-07-01T22:21:51.270" Score="3" Body="&lt;p&gt;You can't run multiple actions in one request. What you're looking to do is trigger your notification action after the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries.saveEntry&lt;/code&gt;&lt;/a&gt; event. I'm assuming that your &lt;code&gt;formNotification&lt;/code&gt; plugin is a custom plugin that you wrote. Fortunately, &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow&quot;&gt;events are easy&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    // Your notification code here.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The best place to add this event listener is in your plugin's &lt;code&gt;init&lt;/code&gt; function. This is located in the main plugin file.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-01T22:21:51.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="667" PostTypeId="2" ParentId="665" CreationDate="2014-07-01T22:24:53.993" Score="7" Body="&lt;p&gt;It’s not possible for a form to simultaneously invoke two controller actions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to write a plugin that provides its own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot;&gt;controller&lt;/a&gt;, which in turn could be used to invoke the other controller actions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginController&#xA;{&#xA;    public function actionSaveEntryAndSendNotification()&#xA;    {&#xA;        // Save the entry&#xA;        craft()-&amp;gt;runController('guestEntries/saveEntry');&#xA;&#xA;        // Send the notification&#xA;        craft()-&amp;gt;runController('formNotification/getForm');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If &quot;FormNotificationController&quot; is already your own custom plugin, then it might make more sense to just call &lt;code&gt;craft()-&amp;gt;runController('guestEntries/saveEntry');&lt;/code&gt; from the top of &lt;code&gt;actionGetForm()&lt;/code&gt;. Or just save the entry yourself from the controller action – the Guest Entries plugin is really pretty simple; most of the heavy lifting is provided by the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice#saveEntry&quot;&gt;EntriesService - saveEntry() API&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-01T22:24:53.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="668" PostTypeId="2" ParentId="583" CreationDate="2014-07-01T22:33:37.617" Score="4" Body="&lt;p&gt;This ended up being a Craft bug. We just released &lt;a href=&quot;http://buildwithcraft.com/updates#build2562&quot; rel=&quot;nofollow&quot;&gt;Craft 2.1 build 2562&lt;/a&gt; with a fix.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-01T22:33:37.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="669" PostTypeId="1" CreationDate="2014-07-02T03:36:28.990" Score="2" ViewCount="514" Body="&lt;p&gt;Ok so I know this is something really basic but unfortunately i could not find it in the documentation and I don't have a lot of experience with localisation at all. i have set up two locales in my craft admin panel and I have also updated general.php, etc to set up content localisation. But unfortunately the content that i set as translatable is still displayed in english at both the en and zh site post-fixes. Can somebody simply explain how can I use a link to change the language of all my content on a page to another language inside of a template?&lt;/p&gt;&#xA;" OwnerUserId="357" LastActivityDate="2014-07-02T07:23:39.460" Title="How to translate the whole page?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="670" PostTypeId="1" AcceptedAnswerId="678" CreationDate="2014-07-02T06:11:48.610" Score="11" ViewCount="6264" Body="&lt;p&gt;Can I disable template caching for local development?&#xA;For example: setting a environmentVariable in a config file?&#xA;Or is this possible in the future?&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="125" LastEditDate="2015-03-13T18:28:59.180" LastActivityDate="2018-08-06T19:44:40.253" Title="Can I disable template caching for local development?" Tags="&lt;templating&gt;&lt;cache&gt;&lt;multi-environment&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="671" PostTypeId="2" ParentId="669" CreationDate="2014-07-02T07:23:39.460" Score="4" Body="&lt;p&gt;Do you have separate &lt;code&gt;index.php&lt;/code&gt; files for your locales? There is a nicely explained documentation for this on the official Get Help pages: &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;&quot;How do I show localized content on the front end?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-02T07:23:39.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="672" PostTypeId="1" AcceptedAnswerId="682" CreationDate="2014-07-02T08:49:10.637" Score="4" ViewCount="652" Body="&lt;p&gt;This might be a bit of a Noob question but here I go:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Guest Entries on a site and cannot figure out how to make certain fields required. Those fields are marked as required in the CP but, when using Guest Entries, entries are submitted even when required fields are not filled in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can easily implement a front-end validation but I would like the validation to happen on the back-end before saving the entry as well.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should this happen automatically, am I missing something ?&lt;/li&gt;&#xA;&lt;li&gt;Do I have to create a validation &quot;manually&quot; and if so, how ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After updating the plugin, this is how I displayed validation errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.errors is defined %}&#xA;    {% for errorField, error in entry.errors %}&#xA;        {% for errorMessage in error %}&#xA;        &amp;lt;ul class=&quot;form-errors&quot;&amp;gt;&#xA;            &amp;lt;li&amp;gt;{{ errorField }} - {{ errorMessage }}&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2014-07-07T08:39:04.467" LastActivityDate="2014-07-07T08:39:04.467" Title="Make fields required when using Guest Entries" Tags="&lt;guest-entries&gt;&lt;required&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="673" PostTypeId="1" AcceptedAnswerId="677" CreationDate="2014-07-02T09:37:47.323" Score="3" ViewCount="1325" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow&quot;&gt;Reroute plugin&lt;/a&gt; is great for a handful of 301 redirects, but we have hundreds of entries and each entry has a legacy URL. Dumping this into a template as normal works fine, but thinking about if it could work with the .htaccess file directly. Has anyone tried, or would be a dangerous path?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking along the lines of NSM htaccess for EE.&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="9" LastEditDate="2014-07-02T13:54:09.480" LastActivityDate="2016-04-25T20:27:36.937" Title=".htaccess as a Craft template for 301 redirects?" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="674" PostTypeId="1" AcceptedAnswerId="679" CreationDate="2014-07-02T11:28:52.527" Score="2" ViewCount="290" Body="&lt;p&gt;Is there a way to rename a tag, globally, within the Craft CP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not directly, would the Find and Replace tool include tags?&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="115" LastEditDate="2014-07-06T02:44:27.223" LastActivityDate="2014-07-06T02:44:27.223" Title="How do you rename a tag globally in the Craft Control Panel?" Tags="&lt;tags&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="675" PostTypeId="2" ParentId="674" CreationDate="2014-07-02T11:39:05.777" Score="3" Body="&lt;p&gt;A section to manage existing tags (renaming, editing, adding, deleting) &lt;a href=&quot;https://plus.google.com/112408693722116868145/posts/VZvEvxBrn8X&quot; rel=&quot;nofollow&quot;&gt;is on the list&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately you can't use the 'Find and Replace'-tool:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added a new Find and Replace tool in Settings, for finding/replacing&#xA;  text within all Rich/Plain Text fields (including ones in a Matrix&#xA;  field).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/updates#build2524&quot; rel=&quot;nofollow&quot;&gt;See the Changelog of 2.0.2524&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;Currently you can only solve this with a custom plugin or by editing tags directly in the database&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; See Brandon's answer.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-02T14:28:52.077" LastActivityDate="2014-07-02T14:28:52.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="676" PostTypeId="2" ParentId="673" CreationDate="2014-07-02T13:19:03.977" Score="1" Body="&lt;p&gt;If I understand what you're looking for, it's not so much dangerous as it is not possible. Apache looks at the filesystem and parses the .htaccess file directly, and this is done long before Apache starts to process any PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A route you could take is writing the .htaccess file each time an entry is saved (or having a button that does it so you're not wasting resources). So long as PHP has the write access, this should be doable. Plus, you can still render the file via the template service.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$htaccess = craft()-&amp;gt;templates-&amp;gt;render('PluginHandle/path/to/template');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-02T13:19:03.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="677" PostTypeId="2" ParentId="673" CreationDate="2014-07-02T14:02:56.143" Score="1" Body="&lt;p&gt;The more redirects you have, the better off you’re going to be having them managed &lt;em&gt;outside&lt;/em&gt; of your .htaccess file, and in a database table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each redirect in your .htaccess file comes with a slight performance hit, since mod_rewrite needs to parse and evaluate each one individually, for every single request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have them managed in an indexed database table, the performance hit will be trivial – just the time it takes to make a very simple DB query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven’t used &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow&quot;&gt;Reroute&lt;/a&gt;, but it looks like that’s just storing redirects in a DB table, so it’s probably going to be your best bet for managing hundreds of redirects. (Not sure how scalable the UI is, though.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-02T14:02:56.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="678" PostTypeId="2" ParentId="670" CreationDate="2014-07-02T14:11:18.453" Score="17" Body="&lt;p&gt;When working with multiple environments you most likely want to disable caching for all but one environment, because Craft saves the absolute URL to entries/assets in the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I achieved this by setting a custom variable in general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'craft.dev' =&amp;gt; array(&#xA;    'cache' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(...),&#xA;)&#xA;&#xA; '192.168.178.20' =&amp;gt; array(&#xA;    'cache' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(...),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then add a conditional to the cache function in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache if craft.config.cache %}&#xA;    {# ... #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this setup I can now access the cached content on craft.dev and open the site on another devices in the network on 192.168.178.20 without having problems with cached urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first posted this on another question about caching: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag&quot;&gt;&quot;What are the best practices for using the {% cache %} tag?&quot;&lt;/a&gt;, which might also be of interest for you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(&lt;strong&gt;Edit:&lt;/strong&gt; Since Craft 2.2 it is possible to use &lt;code&gt;if&lt;/code&gt; condition with the &lt;code&gt;cache&lt;/code&gt; tag, so you don't have to do messy constructs like &lt;code&gt;unless not&lt;/code&gt; any more.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-13T18:29:39.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="679" PostTypeId="2" ParentId="674" CreationDate="2014-07-02T14:22:52.487" Score="5" Body="&lt;p&gt;As of Craft 2.0 you can rename tags by double-clicking on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aLhhr.png&quot; width=&quot;214&quot; height=&quot;234&quot; alt=&quot;Tag editor modal&quot;/&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-02T14:22:52.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="681" PostTypeId="1" AcceptedAnswerId="713" CreationDate="2014-07-02T14:56:24.973" Score="2" ViewCount="2132" Body="&lt;p&gt;This may not be Craft related of course but I’m getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt; CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1205 Lock wait timeout&#xA;  executed; try restarting transaction&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any leads to likely causes very much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated Craft and cleared caches but still got the error. A temporary workaround was to remove the cache tag in the site’s templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here’s what the error looks like in the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/07/02 15:23:31 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction. The SQL statement executed was: DELETE FROM `craft_templatecaches`.&#xA;2014/07/02 15:23:31 [error] [exception.Twig_Error_Runtime] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction' in /craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 /craft/app/framework/db/CDbCommand.php(1302): CDbCommand-&amp;gt;execute(Array)&#xA;#1 /craft/app/etc/db/DbCommand.php(404): CDbCommand-&amp;gt;delete('craft_templatec...', Array, Array)&#xA;#2 /craft/app/services/TemplateCacheService.php(380): Craft\DbCommand-&amp;gt;delete('templatecaches', Array, Array)&#xA;#3 /craft/app/services/TemplateCacheService.php(406): Craft\TemplateCacheService-&amp;gt;deleteExpiredCaches()&#xA;#4 /craft/app/services/TemplateCacheService.php(37): Craft\TemplateCacheService-&amp;gt;deleteExpiredCachesIfOverdue()&#xA;#5 /craft/storage/runtime/compiled_templates/4e/63/XXXXX.php(54): Craft\TemplateCacheService-&amp;gt;getTemplateCache('XXXXX...', false)&#xA;#6 /craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_XXXXX-&amp;gt;block_content(Array, Array)&#xA;#7 /craft/storage/runtime/compiled_templates/4e/7f/XXXXX.php(260): Twig_Template-&amp;gt;displayBlock('content', Array, Array)&#xA;#8 /craft/app/vendor/twig/twig/lib/Twig/Template.php(278): __TwigTemplate_XXXXX-&amp;gt;doDisplay(Array, Array)&#xA;#9 /craft/app/vendor/twig/twig/lib/Twig/Template.php(252): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#10 /craft/storage/runtime/compiled_templates/4e/63/XXXXX.php(41): Twig_Template-&amp;gt;display(Array, Array)&#xA;#11 /craft/app/vendor/twig/twig/lib/Twig/Template.php(278): __TwigTemplate_XXXXX-&amp;gt;doDisplay(Array, Array)&#xA;#12 /craft/app/vendor/twig/twig/lib/Twig/Template.php(252): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#13 /craft/app/vendor/twig/twig/lib/Twig/Template.php(263): Twig_Template-&amp;gt;display(Array)&#xA;#14 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#15 /craft/app/services/TemplatesService.php(158): Twig_Environment-&amp;gt;render('_views/_section', Array)&#xA;#16 /craft/app/controllers/BaseController.php(75): Craft\TemplatesService-&amp;gt;render('_views/_section', Array)&#xA;#17 /craft/app/controllers/TemplatesController.php(185): Craft\BaseController-&amp;gt;renderTemplate('_views/_section', Array)&#xA;#18 /craft/app/controllers/TemplatesController.php(27): Craft\TemplatesController-&amp;gt;_render('_views/_section', Array)&#xA;#19 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('_views/_section', Array)&#xA;#20 /craft/app/framework/web/actions/CAction.php(108): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#21 /craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#22 /craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#23 /craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#24 /craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), NULL)&#xA;#25 /craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#26 /craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#27 /craft/app/etc/web/WebApp.php(247): CWebApplication-&amp;gt;processRequest()&#xA;#28 /craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#29 /craft/app/index.php(196): CApplication-&amp;gt;run()&#xA;#30 /index.php(17): require_once('/var/www/vhosts...')&#xA;#31 {main}&#xA;&#xA;Next exception 'Twig_Error_Runtime' with message 'An exception has been thrown during the rendering of a template (&quot;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction&quot;) in &quot;_views/_section&quot; at line 35.' in /craft/app/vendor/twig/twig/lib/Twig/Template.php:148&#xA;Stack trace:&#xA;#0 /craft/storage/runtime/compiled_templates/4e/7f/XXXXX.php(260): Twig_Template-&amp;gt;displayBlock('content', Array, Array)&#xA;#1 /craft/app/vendor/twig/twig/lib/Twig/Template.php(278): __TwigTemplate_XXXXX-&amp;gt;doDisplay(Array, Array)&#xA;#2 /craft/app/vendor/twig/twig/lib/Twig/Template.php(252): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#3 /craft/storage/runtime/compiled_templates/4e/63/XXXXX.php(41): Twig_Template-&amp;gt;display(Array, Array)&#xA;#4 /craft/app/vendor/twig/twig/lib/Twig/Template.php(278): __TwigTemplate_XXXXX-&amp;gt;doDisplay(Array, Array)&#xA;#5 /craft/app/vendor/twig/twig/lib/Twig/Template.php(252): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#6 /craft/app/vendor/twig/twig/lib/Twig/Template.php(263): Twig_Template-&amp;gt;display(Array)&#xA;#7 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#8 /craft/app/services/TemplatesService.php(158): Twig_Environment-&amp;gt;render('_views/_section', Array)&#xA;#9 /craft/app/controllers/BaseController.php(75): Craft\TemplatesService-&amp;gt;render('_views/_section', Array)&#xA;#10 /craft/app/controllers/TemplatesController.php(185): Craft\BaseController-&amp;gt;renderTemplate('_views/_section', Array)&#xA;#11 /craft/app/controllers/TemplatesController.php(27): Craft\TemplatesController-&amp;gt;_render('_views/_section', Array)&#xA;#12 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('_views/_section', Array)&#xA;#13 /craft/app/framework/web/actions/CAction.php(108): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#14 /craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#15 /craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#16 /craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#17 /craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), NULL)&#xA;#18 /craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#19 /craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#20 /craft/app/etc/web/WebApp.php(247): CWebApplication-&amp;gt;processRequest()&#xA;#21 /craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#22 /craft/app/index.php(196): CApplication-&amp;gt;run()&#xA;#23 /index.php(17): require_once('/var/www/vhosts...')&#xA;#24 {main}&#xA;REQUEST_URI=/features&#xA;---&#xA;2014/07/02 15:23:31 [error] [application] Unable to find the template “500”.&#xA;2014/07/02 15:23:31 [error] [application] Unable to find the template “error”.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2014-07-03T13:28:04.803" LastActivityDate="2014-07-03T13:28:04.803" Title="CDbCommand failed to execute" Tags="&lt;templating&gt;&lt;database&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="682" PostTypeId="2" ParentId="672" CreationDate="2014-07-02T15:13:22.387" Score="4" Body="&lt;p&gt;If the fields are marked as required in your field layout, then they should fail validation even on the front-end, so it sounds like a bug to me.  Can you send a database backup as well as the template code you're using for the form over to support@buildwithcraft.com?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue was that if your entries were set to be disabled by default, then Craft won't run any validation on them.  Just made a change so that if you use the &lt;a href=&quot;https://github.com/pixelandtonic/guestentries&quot; rel=&quot;nofollow&quot;&gt;latest Guest Entries&lt;/a&gt;, you'll have an additional plugin setting to enable/disable validation on a per section basis, regardless of the default status of the entry.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-03T07:55:17.087" LastActivityDate="2014-07-03T07:55:17.087" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="683" PostTypeId="2" ParentId="681" CreationDate="2014-07-02T15:18:43.067" Score="3" Body="&lt;p&gt;That error means that one database request comes into MySQL and grabs an exclusive handle on a table.  For whatever reason, it doesn't release that handle in a reasonable amount of time, so another request comes in wanting access to the same table, but gives up waiting on the first one to finish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you open up your craft/storage/runtime/logs files and find the error in there, it will come with a full stack trace where you can track down where the error is actually occurring.  Better yet... redact any sensitive details and place it here so we can all learn from it. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the stack trace it looks like the timeout is occurring when Craft is in the process of running it's &quot;DeleteStaleTemplateCache&quot; task.  It also looks like you're not on the latest release.  You should update to the latest 2.1 build where we've made that task much less aggressive when doing it's database queries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-02T16:21:30.990" LastActivityDate="2014-07-02T16:21:30.990" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="684" PostTypeId="2" ParentId="406" CreationDate="2014-07-02T15:50:52.890" Score="5" Body="&lt;p&gt;The entries won't immediately get updated, as it could take a little while to go through all of them, but you should see a little progress bar in your CP header immediately after updating your section's settings, and if you click on it, it will give you more details -- saying that a &quot;Resave Elements&quot; background task is running. Once that has completed, your entries will have new URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, it was not working as indented with localised entries but thankfully that was fixed on build 2562.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2014-07-02T15:50:52.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="685" PostTypeId="1" AcceptedAnswerId="687" CreationDate="2014-07-02T16:07:19.390" Score="19" ViewCount="4874" Body="&lt;p&gt;I have a rich text output section I want to limit to the first paragraph so I can link to a full version on another page. What's the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="446" LastActivityDate="2016-02-19T17:04:26.377" Title="Is there a way to output only the first paragraph of a Rich Text field?" Tags="&lt;richtext&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="686" PostTypeId="1" AcceptedAnswerId="688" CreationDate="2014-07-02T16:10:34.873" Score="3" ViewCount="791" Body="&lt;p&gt;I am displaying a series of icons and associated labels in an unordered list. Some of the icons should only be displayed when a user is in a specific set of user groups, so I am using a conditional. Without the conditional, the icon and label displays perfectly, but when I wrap it in a conditional, it seems to output an extra blank character which breaks my layout.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;icon&quot;&amp;gt;&#xA;  &amp;lt;a href=&quot;/entry1&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;/assets/images/icon1.svg&quot; alt=&quot;&quot; /&amp;gt;&#xA;    &amp;lt;div class=&quot;title&quot;&amp;gt;Entry 1&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% if currentUser.isInGroup('admin') %}﻿&#xA;&amp;lt;li class=&quot;icon&quot;&amp;gt;&#xA;  &amp;lt;a href=&quot;/entry2&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;/assets/images/icon2.svg&quot; alt=&quot;&quot; /&amp;gt;&#xA;    &amp;lt;div class=&quot;title&quot;&amp;gt;Entry 2&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endif %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Chrome Inspector shows two quotation marks separated by a blank line between the li.icon elements, which I think indicates one blank character. When I remove the conditional, these quotation marks and the blank line don't appear, and the layout looks correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I collapse all the logic and HTML elements into one long line of characters with no spaces between them, this weird blank output still occurs. Wrapping the block in the {% spaceless %} tag doesn't seem to work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might be causing this?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-07-02T16:26:50.100" Title="Unwanted output when using Twig conditional" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;whitespace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="687" PostTypeId="2" ParentId="685" CreationDate="2014-07-02T16:16:53.900" Score="27" Body="&lt;p&gt;You can do this entirely with Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot;&gt;&lt;code&gt;|split&lt;/code&gt; filter&lt;/a&gt; to split your HTML into an array of paragraphs, on their closing &lt;code&gt;&amp;lt;/p&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paragraphs = entry.myRichTextField|split('&amp;lt;/p&amp;gt;') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can assign the first paragraph to a new variable using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/first.html&quot;&gt;&lt;code&gt;|first&lt;/code&gt; filter&lt;/a&gt;. And don’t forget to bring back that missing &lt;code&gt;&amp;lt;/p&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstParagraph = paragraphs|first ~ '&amp;lt;/p&amp;gt;' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, you can output that. Use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot;&gt;&lt;code&gt;|raw&lt;/code&gt; filter&lt;/a&gt; so that Twig doesn’t encode the HTML entities.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ firstParagraph|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-02T16:31:48.770" LastActivityDate="2014-07-02T16:31:48.770" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="688" PostTypeId="2" ParentId="686" CreationDate="2014-07-02T16:26:17.590" Score="5" Body="&lt;p&gt;I pasted your HTML into TextMate with “Show Invisible Characters” enabled, and it shows that there are two &lt;a href=&quot;http://www.fileformat.info/info/unicode/char/FEFF/index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;“zero width no-break space” (U+FEFF)&lt;/a&gt; characters in there, at the end of these lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('admin') %}&#xA;&#xA;-- and --&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here’s a screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NpavX.png&quot; width=&quot;531&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those characters tend to come from code that was copied from &lt;a href=&quot;https://plus.google.com/communities/106505340287442511226&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google+&lt;/a&gt;, which likes to add them at the very end of each post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, Sublime Text doesn’t show these types of characters; you need to use TextMate to see them.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-02T16:26:17.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="689" PostTypeId="2" ParentId="686" CreationDate="2014-07-02T16:26:50.100" Score="2" Body="&lt;p&gt;I'd venture to guess that you have a &lt;a href=&quot;http://en.wikipedia.org/wiki/Byte_order_mark&quot; rel=&quot;nofollow&quot;&gt;BOM character&lt;/a&gt; in there somewhere. It's basically an invisible character that does nothing but cause trouble. One of these can show up from copying a chunk of code from somewhere else... quite often from the Google+ group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is generally to re-type your code by hand, and delete the original offending chunk of code. You can probably narrow down the specific line or two which may contain that BOM by deleting and checking your Chrome Inspector (like you already did to determine where the issue was coming from). Then you can just re-type the one or two lines which actually contain the BOM&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-02T16:26:50.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="690" PostTypeId="1" AcceptedAnswerId="694" CreationDate="2014-07-02T18:58:55.387" Score="2" ViewCount="122" Body="&lt;p&gt;Not trying to do anything fancy here, just trying to have a &quot;tag&quot; view similar to my category view (which uses the same template), however, when I add my link, &lt;code&gt;/blog/{{ tag|slugify}}&lt;/code&gt; (I'm using &lt;a href=&quot;http://straightupcraft.com/craft-plugins/slugify&quot; rel=&quot;nofollow&quot;&gt;Slugify&lt;/a&gt; to generate a slug out of the tag name.), it returns the &quot;Unable to find the template â€œ_layoutâ€&quot; error. This should load the &lt;code&gt;/blog/index.html&lt;/code&gt; template but it is not. My category view is working as well as the main load. (I am getting the same error when trying to do an author &lt;code&gt;/blog/{{ entry.author.username }}&lt;/code&gt;) What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-02T20:10:05.213" Title="Not finding template when adding &quot;tag&quot; view" Tags="&lt;templating&gt;&lt;users&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="691" PostTypeId="1" AcceptedAnswerId="776" CreationDate="2014-07-02T19:33:19.003" Score="5" ViewCount="1561" Body="&lt;p&gt;I've been playing with Craft for days now and love it. I'm new to Yii but I think I got the hang of everything and how you develop a Craft Plugin. My question is regarding security on input post/get vars.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading Yii's documentation is seems the &quot;HtmlPurifier&quot; filter is suggested to protect against XSS - but everything seems to be applied on output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Does Craft do anything to &quot;clean&quot; input data OR how do you protect your data against malicious input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to clarify that the data submitted by the user has gone through the validation rules in the Record/Model. Is there anything else you need to keep in mind?&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="250" LastEditDate="2014-07-08T22:06:35.703" LastActivityDate="2014-07-08T22:06:35.703" Title="How do _you_ protect input against XSS? (&quot;HtmlPurifier&quot;?)" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="692" PostTypeId="1" AcceptedAnswerId="695" CreationDate="2014-07-02T19:58:39.950" Score="4" ViewCount="644" Body="&lt;p&gt;I'm wondering if I can have another name for my Plugin CP navigation item?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say my plugin is called &quot;Company name Social Media&quot; but I want the navigation item to just say &quot;Social Media&quot;. Might be a bad example but I think you understand what I mean. Let's say I'll release a commercial Craft plugin w/ my company name in it, but I want the customer to be able to add the plugin for a client without my name visible (more then on the plugins page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is there any way to add dropdown-like sub-navigation items to the CP navigation for a plugin?&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="250" LastEditDate="2014-07-08T22:04:43.637" LastActivityDate="2014-09-06T12:45:52.037" Title="Is there any way to change the CP navigation item for a plugin?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="693" PostTypeId="1" AcceptedAnswerId="696" CreationDate="2014-07-02T20:07:52.517" Score="1" ViewCount="1295" Body="&lt;p&gt;When they exist, I'd like to get specification PDFs from a product entry. They're stored in a &lt;code&gt;productInfo&lt;/code&gt; Matrix field, in a &lt;code&gt;specifications&lt;/code&gt; block that has a &lt;code&gt;downloads&lt;/code&gt; Assets collection.&lt;/p&gt;&#xA;&lt;p&gt;Naturally I attempted the following...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set specFiles = entry.productInfo.specifications.downloads %}&#xA;{% for specFile in specFiles %}&#xA;    {{ specFile.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;...and Craft thought I was being greedy:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Craft\ElementCriteriaModel and its behaviors do not have a method or closure named &amp;quot;specifications&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I noticed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/39/search-matrix-for-blocks-with-upcoming-dates&quot;&gt;this SE question&lt;/a&gt; that examples skipped referencing the block type and went straight for the field name, so I tried that next...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set specificationDownloads = entry.productInfo.downloads %}&#xA;{% for specFile in specificationDownloads %}&#xA;    {{ specFile.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This didn't throw any error, but it didn't return any results either.&lt;/p&gt;&#xA;&lt;p&gt;I know that I can loop through the blocks and then the downloads, it just seems excessive...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.productInfo %}&#xA;    {% if block.type == 'specifications' %}&#xA;        {% for specFile in block.downloads %}&#xA;            {{ specFile.title }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So what &lt;em&gt;is&lt;/em&gt; the most straightforward way to get results when I want to limit them to a specific (Assets) field within a certain Matrix block type?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-07-02T20:31:36.533" Title="Can I get Assets from a specific Matrix block?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="694" PostTypeId="2" ParentId="690" CreationDate="2014-07-02T20:10:05.213" Score="2" Body="&lt;p&gt;And the winner is, &lt;strong&gt;routing&lt;/strong&gt;... Adding in &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routing&lt;/a&gt; got me squared away. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the URI looks like this: &lt;code&gt;blog/*&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Load this template: &lt;code&gt;blog/index&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to note (as documented in the docs), your URI should not begin with a slash (/).&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-02T20:10:05.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="695" PostTypeId="2" ParentId="692" CreationDate="2014-07-02T20:22:44.443" Score="5" Body="&lt;p&gt;I don't know if it's possible to change the name of the CP section, but it has become a common practice to allow each user to change the plugin-name on its setting page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;main plugin file:&lt;/strong&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getName()&#xA;{&#xA;    return $this-&amp;gt;getSettings()-&amp;gt;name;&#xA;}&#xA;&#xA;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'name' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'SuperPluginName')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;settings template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% import '_includes/forms' as forms %}&#xA;&#xA;{{  forms.textField({&#xA;        first: true,&#xA;        label: &quot;Plugin Name&quot;|t,&#xA;        instructions: &quot;How the plugin should be named in the CP&quot;|t,&#xA;        id: 'name',&#xA;        name: 'name',&#xA;        value: settings.name,&#xA;        required: true&#xA;    }) &#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-02T20:22:44.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="696" PostTypeId="2" ParentId="693" CreationDate="2014-07-02T20:31:36.533" Score="8" Body="&lt;p&gt;You should be able to do this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.productIndo.type('specifications') %}&#xA;    {% for download in block.downloads %}&#xA;        {{ download.url }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of if the nested loops don't suit you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set specificationBlock = entry.productIndo.type('specifications').first() %}&#xA;&#xA;{% if specificationBlock %}&#xA;    {% for download in block.specificationBlock %}&#xA;        {{ download.url }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-02T20:31:36.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="697" PostTypeId="1" AcceptedAnswerId="698" CreationDate="2014-07-02T21:55:38.410" Score="4" ViewCount="1888" Body="&lt;p&gt;I can't find any information on this issue, but I'm not seeing any way to create subfolders in the Assets view of the control panel. I just see all of my images with no folders. Is this feature restricted to paid versions?&lt;/p&gt;&#xA;" OwnerUserId="372" LastActivityDate="2014-07-02T22:24:26.007" Title="How to create subfolders in the Assets view?" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="698" PostTypeId="2" ParentId="697" CreationDate="2014-07-02T22:24:26.007" Score="8" Body="&lt;p&gt;What you see on the left in the Asset section, are asset-sources and their subfolders. You can configure them in &lt;code&gt;Settings -&amp;gt; Assets -&amp;gt; New Source&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, &lt;code&gt;Drinks&lt;/code&gt; and &lt;code&gt;Cars&lt;/code&gt; are asset-sources:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fa44U.jpg&quot; alt=&quot;Assets&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add subfolders to each asset-source (and each other subfolder) with &lt;code&gt;Rightclick -&amp;gt; New subfolder&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-02T22:24:26.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="699" PostTypeId="1" CreationDate="2014-07-02T23:50:36.100" Score="3" ViewCount="74" Body="&lt;p&gt;Was wondering if anyone had looked a a way of saving RSS feed items as an entry into craft.&#xA;I imagine this would have to be done through a plugin and a custom field type? Or is there a better way to do this.&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2014-07-03T07:24:19.973" Title="A way to save feeds as an entry" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="700" PostTypeId="1" CreationDate="2014-07-03T00:36:42.243" Score="4" ViewCount="1199" Body="&lt;p&gt;My understanding of the {% cache %} tag is that if the content between it changes, the cache is invalidated and you see the new content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having an issue where a new entry is created in section, but it doesn't show up on the front-end unless I manually clear the cache in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The content is pulled in via a loop such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%  for entry in craft.entries.section( &quot;news&quot; ).limit(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I not understanding how this tag works or is something going wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here is the full code block wrapped by cache tags&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;{%  for entry in craft.entries.section( item.nameId ).limit(3) %}&#xA;    &amp;lt;div class=&quot;cardRow_column-carousel&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;card&quot; &amp;gt;&#xA;            &amp;lt;div class=&quot;card_imageHolder&quot;&amp;gt;&#xA;                &amp;lt;img class=&quot;card_image&quot; src=&quot;{{ entry.tileImage.first().getUrl(cardCrop) }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;card_content&quot;&amp;gt;&#xA;                &amp;lt;h4 class=&quot;card_content_heading&quot;&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;div class=&quot;card_content_icon&quot;&amp;gt;&#xA;                    {% if item.type == &quot;video&quot; %}&#xA;                        {% set iconType = &quot;icon-video&quot; %}&#xA;                    {% elseif item.type == &quot;game&quot; %}&#xA;                        {% set iconType = &quot;icon-games&quot; %}&#xA;                    {% elseif item.type == &quot;image&quot; or item.type == &quot;imageGallery&quot; %}&#xA;                        {% set iconType = &quot;icon-image&quot; %}&#xA;                    {% else %}&#xA;                        {% set iconType = &quot;icon-paper&quot; %}&#xA;                    {% endif %}&#xA;                    &amp;lt;i class=&quot;{{ iconType }} card_content_icon-category&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                    &amp;lt;i class=&quot;icon-arrow-right card_content_icon_arrow&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The strange thing that I'm noticing is if I add an entry it never shows up, but if I delete one it does get cleared out. And deleting an entry then causes the new one to show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Craft support determined there was a bug and plans to fix it in the next version. Current version is Craft 2.1 build 2563.&lt;/p&gt;&#xA;" OwnerUserId="449" LastEditorUserId="449" LastEditDate="2014-07-11T19:50:06.723" LastActivityDate="2014-07-11T19:50:06.723" Title="Cached template content not invalidating" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="701" PostTypeId="1" AcceptedAnswerId="702" CreationDate="2014-07-03T01:40:41.583" Score="8" ViewCount="1328" Body="&lt;p&gt;I’m trying to update Craft Pro 2.0.2543 to the latest build but the site’s database is in excess of 2Gb. When hitting ‘Finish up’ in the CP after a manual update, by the time the database has backed up I’m logged out, or the process has timed out. Is there a way I can ‘Finish up’ without the backup running first?&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2014-07-03T01:52:08.540" Title="Manual update without database backup" Tags="&lt;database&gt;&lt;updating&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="702" PostTypeId="2" ParentId="701" CreationDate="2014-07-03T01:52:08.540" Score="13" Body="&lt;p&gt;It is indeed possible. Craft has a handy general configuration option for this exact situation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    'backupDbOnUpdate' =&amp;gt; false &#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just add that to &lt;code&gt;config/general.php&lt;/code&gt; and that should do the trick!&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-07-03T01:52:08.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="703" PostTypeId="1" AcceptedAnswerId="704" CreationDate="2014-07-03T01:57:22.377" Score="6" ViewCount="3406" Body="&lt;p&gt;I've got a parent template which contains the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_layout' with {'countryCode': 'au'} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a global set with the handle &lt;code&gt;au_Variables&lt;/code&gt;, and within that a field with the handle &lt;code&gt;vimeoVideoId_au&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is with trying to render the following global: &lt;code&gt;{{ au_Variables.vimeoVideoId_au }}&lt;/code&gt; dynamically, using the countryCode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set videoId = countryCode~'_Variables.vimeoVideoId_'~countryCode %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then outputting &lt;code&gt;{{ videoId }}&lt;/code&gt; but all I get is the string &lt;code&gt;au_Variables.vimeoVideoId_au&lt;/code&gt;, not the rendered global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to do this in Twig?&lt;/p&gt;&#xA;" OwnerUserId="13" LastActivityDate="2014-07-03T08:21:14.567" Title="Calling variables, dynamically" Tags="&lt;templating&gt;&lt;variable&gt;&lt;concatenation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="704" PostTypeId="2" ParentId="703" CreationDate="2014-07-03T03:29:28.123" Score="4" Body="&lt;p&gt;I've got a bit of a workaround, not sure if it's the best way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I restructured my fields, turns I don't need unique field names for the globals (still thinking in EE mode) so that took away half the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the global group dynamically, using &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#global-variables&quot; rel=&quot;nofollow&quot;&gt;_context&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after renaming my Video ID field, I can call the global set dynamically using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ _context[countryCode~'_Variables'].vimeoId }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13" LastEditorUserId="57" LastEditDate="2014-07-03T08:21:14.567" LastActivityDate="2014-07-03T08:21:14.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="705" PostTypeId="2" ParentId="703" CreationDate="2014-07-03T03:38:00.220" Score="5" Body="&lt;p&gt;Not sure if you saw this, but you may also be able to use the Twig &lt;code&gt;attribute&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(array, item) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pretty straightforward, here's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;noreferrer&quot;&gt;the official docs page...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-03T03:38:00.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="706" PostTypeId="1" CreationDate="2014-07-03T05:29:55.737" Score="4" ViewCount="347" Body="&lt;p&gt;My question is simple and straightforward. Maybe I am making a mistake but it seems that all the text in a global field is always capital. I want to have 'Eng&quot; in a global plain text field but it outputs &quot;ENG&quot;&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2014-07-03T18:08:26.557" Title="Is it possible to have lowercase globals?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="707" PostTypeId="2" ParentId="706" CreationDate="2014-07-03T05:48:42.127" Score="5" Body="&lt;p&gt;If you have a global set named &lt;em&gt;globalSet&lt;/em&gt;, and a plain text field in that set named &lt;em&gt;textField&lt;/em&gt;, and the value you enter is &lt;em&gt;Eng&lt;/em&gt;, then &lt;code&gt;{{globalSet.textField}}&lt;/code&gt; will output &lt;em&gt;Eng&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things that could be going wrong:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;caps-lock: Did you enter &lt;em&gt;ENG&lt;/em&gt; in the field in the first place?&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;|upper&lt;/em&gt;: &lt;code&gt;{{globalSet.textField|upper}}&lt;/code&gt; will output &lt;em&gt;ENG&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;CSS: &lt;code&gt;text-transform: uppercase;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;jQuery: &lt;code&gt;$(&quot;*&quot;).text($(&quot;*&quot;).text().toUpperCase());&lt;/code&gt; (or other jQuery)&lt;/li&gt;&#xA;&lt;li&gt;all caps font&lt;/li&gt;&#xA;&lt;li&gt;translations: &lt;code&gt;{{globalSet.textField|t}}&lt;/code&gt; and a translation file with &lt;code&gt;&quot;Eng&quot; =&amp;gt; &quot;ENG&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[edited to fold in suggestions from the coments - Marion]&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-07-03T18:08:26.557" LastActivityDate="2014-07-03T18:08:26.557" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="708" PostTypeId="2" ParentId="699" CreationDate="2014-07-03T07:24:19.973" Score="3" Body="&lt;p&gt;This would have to be a plugin to pull in an rss feed and make it an entry -butt there is also the option to use the craft.feeds tag to pull rss feeds directly into your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.feeds&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/craft.feeds&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-07-03T07:24:19.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="709" PostTypeId="1" AcceptedAnswerId="712" CreationDate="2014-07-03T10:02:21.137" Score="8" ViewCount="2192" Body="&lt;p&gt;I upgraded to Craft 2.1 and there is no Preview Button visible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must have something to do with the configuration I created for the different sections because when I use the same craft installation with a clean database the preview button is visible.&lt;/p&gt;&#xA;" OwnerUserId="348" LastActivityDate="2020-05-05T11:38:51.437" Title="Live Preview Button missing" Tags="&lt;editor&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="710" PostTypeId="2" ParentId="709" CreationDate="2014-07-03T11:11:27.013" Score="3" Body="&lt;p&gt;Have you specified a template to use under that section's settings?  If you didn't,  the Live Preview button won't show.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-03T11:11:27.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="711" PostTypeId="1" AcceptedAnswerId="715" CreationDate="2014-07-03T11:46:22.807" Score="4" ViewCount="492" Body="&lt;p&gt;On a single entries page I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;article-pagination&quot;&amp;gt;&#xA;&#xA;    {% set params = {section: 'databytes', order: 'title'} %}&#xA;    {% set prevDatabyte = entry.getPrev(params) %}&#xA;    {% set nextDatabyte = entry.getNext(params) %}&#xA;&#xA;    {% if prevDatabyte %}&#xA;    &amp;lt;a href=&quot;{{ prevDatabyte.url }}&quot; data-hint=&quot;Previous Databyte&quot; class=&quot;prev article-pagination-link icon-alone hint--right&quot;&amp;gt;&#xA;      &amp;lt;i class=&quot;icon-arrow2-left&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if nextDatabyte %}&#xA;    &amp;lt;a href=&quot;{{ nextDatabyte.url }}&quot; data-hint=&quot;Next Databyte&quot; class=&quot;next article-pagination-link icon-alone hint--left&quot;&amp;gt;&#xA;      &amp;lt;i class=&quot;icon-arrow2-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- END .article-pagination --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am wanting to somehow only paginate through entries that are tagged with the same tag maybe by passing that into the params object is that possible?&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-07-03T14:15:15.533" Title="Paginate Entries With The Same Tag" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="712" PostTypeId="2" ParentId="709" CreationDate="2014-07-03T13:10:02.323" Score="13" Body="&lt;p&gt;For the Live Preview button to show up, two criteria must be met:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your section’s &lt;em&gt;“Entries in this section have their own URLs”&lt;/em&gt; setting must be checked&lt;/li&gt;&#xA;&lt;li&gt;Your section’s &lt;em&gt;“Entry Template”&lt;/em&gt; setting must be set to a &lt;strong&gt;valid&lt;/strong&gt; template path&lt;/li&gt;&#xA;&lt;li&gt;For Craft 3.2+ pro version, a preview target must be specified. This happens automatically, but might be missing &lt;a href=&quot;https://github.com/craftcms/cms/issues/5844&quot; rel=&quot;nofollow noreferrer&quot;&gt;due to a bug&lt;/a&gt;. Add a preview target with Primary entry page =&gt; {url} to fix this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Make sure both of those are set correctly, and the Live Preview button will show up.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9528" LastEditDate="2020-05-05T11:38:51.437" LastActivityDate="2020-05-05T11:38:51.437" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="713" PostTypeId="2" ParentId="681" CreationDate="2014-07-03T13:25:46.667" Score="1" Body="&lt;p&gt;The CP was also showing tasks getting stuck on ‘Deleting Stale Template Caches’ – having seen &lt;a href=&quot;https://plus.google.com/+KevinOuellette/posts/NW9VvZCxpK1&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt;, I changed the task to ‘error’ in the db. The task then ran successfully, and template caching was no longer a problem.&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2014-07-03T13:25:46.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="714" PostTypeId="2" ParentId="700" CreationDate="2014-07-03T13:42:45.237" Score="4" Body="&lt;p&gt;When &lt;strong&gt;new&lt;/strong&gt; elements are created, there’s no way for Craft to immediately know which template caches should be cleared. That’s where the &lt;em&gt;Delete Stale Template Caches&lt;/em&gt; task comes in. It loops through all of your caches that included element queries, re-runs the queries, and checks to see if the new element is now included in the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two things to be aware of, though:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Your element query must happen &lt;em&gt;inside&lt;/em&gt; the &lt;code&gt;{% cache %}&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bad:&#xA;&#xA;{% set entries = craft.entries.section('news').limit(3) %}&#xA;{% cache %}&#xA;    {% for entry in entries %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&#xA;good:&#xA;&#xA;{% cache %}&#xA;    {% set entries = craft.entries.section('news').limit(3) %}&#xA;    {% for entry in entries %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The cache querying is not immediate. After saving the entry you will see a little progress bar in the CP header. You need to wait until that has completed before your caches will be cleared.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-03T13:42:45.237" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="715" PostTypeId="2" ParentId="711" CreationDate="2014-07-03T14:15:15.533" Score="5" Body="&lt;p&gt;You can limit the prev/next links to only show entries with the same tags using the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt; param&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'databytes',&#xA;    order: 'title',&#xA;    relatedTo: { targetElement: entry.tagsFieldHandle, field: 'tagsFieldHandle' }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That might do the trick, but it may lead to inconsistent prev/next page links, because you can have more that one tag associated with each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take this entry/tag setup, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pizza&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Lunch&lt;/li&gt;&#xA;&lt;li&gt;Dinner&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ice Cream&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Desert&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Crepe&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Breakfast&lt;/li&gt;&#xA;&lt;li&gt;Lunch&lt;/li&gt;&#xA;&lt;li&gt;Desert&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you land on Pizza, its &lt;em&gt;Next Page&lt;/em&gt; link would take you to Crepe, since they share the Lunch tag. But when you click on Crepe, its &lt;em&gt;Prev Page&lt;/em&gt; link should take you to Ice Cream, rather than Pizza, because Crepe also shares the Desert tag with Ice Cream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see why that might get a little confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to keep the navigation more consistent would be to choose one single tag that all entries should have in common, and pass that tag in the Prev/Next URLs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;  Figure out which tag ID we should use to limit the previous/next entries.&#xA;  It will either be set in the query string already,&#xA;  or we can just use the first tag that the current entry has.&#xA;#}&#xA;&#xA;    {% set tagId = craft.request.getQuery('tag') %}&#xA;&#xA;    {% if not tagId %}&#xA;        {% set tagId = entry.tagsFieldHandle.ids()|first %}&#xA;    {% endif %}&#xA;&#xA;{# Find the previous/next entries that have that tag #}&#xA;&#xA;    {% set params = {&#xA;        section: 'databytes',&#xA;        order: 'title',&#xA;        relatedTo: { targetElement: tagId, field: 'tagsFieldHandle' }&#xA;    } %}&#xA;&#xA;    {% set prevDatabyte = entry.getPrev(params) %}&#xA;    {% set nextDatabyte = entry.getNext(params) %}&#xA;&#xA;{# Output their links, and pass the tag ID in the query string #}&#xA;&#xA;    {% if prevDatabyte %}&#xA;        &amp;lt;a href=&quot;{{ prevDatabyte.url }}?tag={{ tagId }}&quot; ... /&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if nextDatabyte %}&#xA;        &amp;lt;a href=&quot;{{ nextDatabyte.url }}?tag={{ tagId }}&quot; ... /&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-03T14:15:15.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="716" PostTypeId="1" AcceptedAnswerId="717" CreationDate="2014-07-03T14:44:50.927" Score="2" ViewCount="532" Body="&lt;p&gt;I have a couple of issues regarding administering users passwords from the front-end of my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, I'm trying to implement the Set Password form as listed at &lt;a href=&quot;https://craftcms.com/docs/templating/set-password-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/set-password-form&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a single pointing to the path specified in the setPasswordPath config entry, using a template containing the above form. However, when I navigate to the setPasswordPath page it is erroring saying that 'Variable &quot;code&quot; does not exist'. When I remove the hidden code field, the id variable errors in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the forgot password form listed at &lt;a href=&quot;https://craftcms.com/docs/templating/forgot-password-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/forgot-password-form&lt;/a&gt; works great, except for when the user navigates to the link in the e-mail, and then enters their new password, they are redirected the Craft dashboard login, which a lot of the end users should never really see. Is it possible to redirect people  to my home page login form on the front-end?&lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="3951" LastEditDate="2017-10-25T23:57:00.800" LastActivityDate="2017-10-25T23:57:00.800" Title="How do I setup a password administration workflow using setPasswordPath and a forgot password page?" Tags="&lt;users&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="717" PostTypeId="2" ParentId="716" CreationDate="2014-07-03T15:01:26.737" Score="6" Body="&lt;p&gt;The form that lives at &lt;a href=&quot;https://craftcms.com/docs/config-settings#setPasswordPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;setPasswordPath&lt;/a&gt; assumes that the user arrived there by clicking on the link in the validation email that was sent to the provided email address.  That link includes a &lt;code&gt;code=somelongid&lt;/code&gt; querystring parameter in the URL that the form is looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just loading that URL directly, then you'll get the &quot;Variable 'code' does not exist&quot; error.  You could always do something like this to guard against it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set code = craft.request.getParam('code') %}&#xA;&#xA;{% if not code %}&#xA;    {% exit 503 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regarding the forgot password form, upon successfully setting their new password, Craft will check to see if the user has control panel access.  If they do not, it will check the &lt;a href=&quot;https://craftcms.com/docs/config-settings#setPasswordSuccessPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;setPasswordSuccessPath&lt;/a&gt; config variable and redirect there.  If they do, Craft will send them to the dashboard (which will redirect to the login page if you don't have &lt;a href=&quot;https://craftcms.com/docs/config-settings#autoLoginAfterAccountActivation&quot; rel=&quot;nofollow noreferrer&quot;&gt;autoLoginAfterAccountActivation&lt;/a&gt; set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3951" LastEditDate="2017-10-25T23:56:55.360" LastActivityDate="2017-10-25T23:56:55.360" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="718" PostTypeId="1" AcceptedAnswerId="734" CreationDate="2014-07-03T15:38:54.817" Score="2" ViewCount="1615" Body="&lt;p&gt;I'm currently using Categories to organize an inventory of products. The hierarchy is straightforward: category, subcategory, and single product entry. The url structure I'm are hoping to use reflects the hierarchy: &lt;em&gt;homepage.com/products/category/subcategory/product&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I've been able to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/353/how-do-i-add-a-subcategory-to-the-url-slug-for-a-channel-entry&quot;&gt;display the proper slug for the products section&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4/how-do-you-list-categories-in-a-category-group&quot;&gt;output a simple nav menu&lt;/a&gt;. What I'd like to do now is refine the nav so that it only display the subcategories (children) of the category (parent) of product I'm on. I think I'm looking for &lt;a href=&quot;https://craftcms.stackexchange.com/questions/590/how-do-you-only-show-children-of-active-parent-in-a-structure-sections-nav&quot;&gt;something like this&lt;/a&gt; but for Categories + Channel section rather than a Structure section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an idea of how to achieve this, but I'm having trouble getting it to work. I think what I'd like to do is pull the url segment, match it to a category, then display its children. I know I'm missing something basic or haven't fully grasped the syntax of Twig. Any help would be appreciated, thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- edit --&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marion's suggestion was right on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('products').level('1') %}&#xA;&#xA;&amp;lt;ul id=&quot;sideNav&quot;&amp;gt;&#xA;  {% for category in categories %}&#xA;    {% set activeCat = (category.slug == craft.request.segment(2)) %}&#xA;    &amp;lt;li{% if activeCat %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;      &amp;lt;a href=&quot;{{category.url}}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;      {% if activeCat %}&#xA;        {% set subCategories = craft.categories.descendantOf(category) %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% for subCat in subCategories %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{subCat.url}}&quot;&amp;gt;{{subCat.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;       {% endif %}&#xA;   &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="425" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-07T14:51:09.000" Title="How do you only show children of “active” parent using categories?" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="719" PostTypeId="1" AcceptedAnswerId="720" CreationDate="2014-07-03T16:08:18.980" Score="9" ViewCount="1763" Body="&lt;p&gt;I'm returning the username as the second segment &lt;code&gt;/blog/username&lt;/code&gt; and then setting the &lt;code&gt;username&lt;/code&gt; var to &lt;code&gt;craft.request.segment(2)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to list a group of entries by that author (username). I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogPosts = craft.entries.section('blog').relatedTo(username) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: username, field: 'author' })%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have a way to list through entries related by author?&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-07-03T18:00:38.303" LastActivityDate="2014-07-03T18:00:38.303" Title="How do I list entries from a single author?" Tags="&lt;entries&gt;&lt;users&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="720" PostTypeId="2" ParentId="719" CreationDate="2014-07-03T16:23:08.843" Score="8" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# First, grab the username from the URI #}&#xA;{% set username = craft.request.segment(2) %}&#xA;&#xA;{# Then, grab the user based on the username %}&#xA;{% set user = craft.users.username(username).first() %}&#xA;&#xA;{# Make sure we actually found a user #}&#xA;{% if user %}&#xA;    {% set blogPosts = craft.entries.section('blog').authorId(user.id).find() %}&#xA;&#xA;    Found: {{ blogPosts|length }} blog posts.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-03T17:06:35.370" LastActivityDate="2014-07-03T17:06:35.370" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="721" PostTypeId="1" CreationDate="2014-07-03T16:31:59.030" Score="3" ViewCount="513" Body="&lt;p&gt;This piece of code used to work to retrieve 1 featured (lightswitch) entry per category. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories %}      &#xA;    {% set entries = craft.entries.find({&#xA;      section:    'news',&#xA;      limit:      '1',&#xA;      featured : '1',&#xA;      search :&quot;category:&quot; ~ category.title,&#xA;      order :'postDate desc'&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Somehow I have to save a entry twice now before it appears. Any ideas whats wrong? Is this a craft bug?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="57" LastEditDate="2014-07-04T11:07:35.330" LastActivityDate="2014-11-11T14:27:15.073" Title="Retrieving featured entry from a given category" Tags="&lt;templating&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="722" PostTypeId="1" AcceptedAnswerId="723" CreationDate="2014-07-03T16:45:28.717" Score="14" ViewCount="15029" Body="&lt;p&gt;Is it possible to use strait PHP in our templates along side of Twig and or instead of Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so how does one go about it?&lt;/p&gt;&#xA;" OwnerUserId="12" LastActivityDate="2019-01-08T01:44:31.327" Title="Can we use PHP in our templates instead of Twig?" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="723" PostTypeId="2" ParentId="722" CreationDate="2014-07-03T16:49:22.190" Score="24" Body="&lt;p&gt;No this is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really need PHP, you can write a plugin with one of the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;Template Variable&lt;/a&gt;&lt;/strong&gt; class, which can be accessed from your templates via &lt;code&gt;craft.myPluginHandle&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;a &lt;strong&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension&quot;&gt;Twig extension&lt;/a&gt;&lt;/strong&gt;, which can add its own global &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#filters&quot;&gt;filters&lt;/a&gt;, &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#functions&quot;&gt;functions&lt;/a&gt;, or &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#tags&quot;&gt;tags&lt;/a&gt;, etc.&lt;/li&gt;&#xA;&lt;li&gt;a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot;&gt;controller&lt;/a&gt;&lt;/strong&gt;, which can execute PHP before calling &lt;code&gt;$this-&amp;gt;renderTemplate(...)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot;&gt;template hook&lt;/a&gt;&lt;/strong&gt;, which allows PHP code to access and modify the current template variable context, wherever the &lt;code&gt;{% hook %}&lt;/code&gt; tag is placed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why Twig anyway?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question to use php in templates comes up every once in a while, but there are good reasons for not using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if Craft changes its code you don't have to worry about your templates. The upcoming update of the &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-upgrade-from-v1.html&quot;&gt;Yii framework&lt;/a&gt; would force you to rewrite all your templates if they were written in php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a great &lt;a href=&quot;http://fabien.potencier.org/article/34/templating-engines-in-php&quot;&gt;article from Fabien Potencier&lt;/a&gt; on this topic -- &lt;em&gt;tl;dr&lt;/em&gt; php is too verbose for templating.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-09-09T16:11:18.053" LastActivityDate="2014-09-09T16:11:18.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="724" PostTypeId="1" AcceptedAnswerId="779" CreationDate="2014-07-03T16:53:15.440" Score="1" ViewCount="441" Body="&lt;p&gt;Seeing the above error, somewhat sporadically, and can't seem to track it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the full log entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/07/03 15:17:22 [error] [exception.CDbException] exception 'CDbException' with message 'The DB query must contain the &quot;from&quot; portion.' in /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php:566&#xA;Stack trace:&#xA;#0 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(160): CDbCommand-&amp;gt;buildQuery(Array)&#xA;#1 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(484): CDbCommand-&amp;gt;getText()&#xA;#2 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(415): CDbCommand-&amp;gt;queryInternal('fetch', Array, Array)&#xA;#3 /var/www/topsecret.co.uk/craft/app/etc/behaviors/AppBehavior.php(410): CDbCommand-&amp;gt;queryRow()&#xA;#4 /var/www/topsecret.co.uk/craft/app/etc/behaviors/AppBehavior.php(146): Craft\AppBehavior-&amp;gt;getInfo('edition')&#xA;#5 [internal function]: Craft\AppBehavior-&amp;gt;getEdition()&#xA;#6 /var/www/topsecret.co.uk/craft/app/framework/base/CComponent.php(261): call_user_func_array(Array, Array)&#xA;#7 /var/www/topsecret.co.uk/craft/app/services/LocalizationService.php(111): CComponent-&amp;gt;__call('getEdition', Array)&#xA;#8 /var/www/topsecret.co.uk/craft/app/services/LocalizationService.php(111): Craft\WebApp-&amp;gt;getEdition()&#xA;#9 /var/www/topsecret.co.uk/craft/app/services/LocalizationService.php(141): Craft\LocalizationService-&amp;gt;getSiteLocales()&#xA;#10 /var/www/topsecret.co.uk/craft/app/services/LocalizationService.php(154): Craft\LocalizationService-&amp;gt;getPrimarySiteLocale()&#xA;#11 /var/www/topsecret.co.uk/craft/app/etc/web/WebApp.php(824): Craft\LocalizationService-&amp;gt;getPrimarySiteLocaleId()&#xA;#12 /var/www/topsecret.co.uk/craft/app/etc/web/WebApp.php(291): Craft\WebApp-&amp;gt;_getTargetLanguage()&#xA;#13 /var/www/topsecret.co.uk/craft/app/framework/i18n/CMessageSource.php(83): Craft\WebApp-&amp;gt;getLanguage()&#xA;#14 /var/www/topsecret.co.uk/craft/app/framework/YiiBase.php(585): CMessageSource-&amp;gt;translate('yii', 'The DB query mu...', NULL)&#xA;#15 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(566): YiiBase::t('yii', 'The DB query mu...')&#xA;#16 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(160): CDbCommand-&amp;gt;buildQuery(Array)&#xA;#17 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(484): CDbCommand-&amp;gt;getText()&#xA;#18 /var/www/topsecret.co.uk/craft/app/framework/db/CDbCommand.php(415): CDbCommand-&amp;gt;queryInternal('fetch', Array, Array)&#xA;#19 /var/www/topsecret.co.uk/craft/app/etc/behaviors/AppBehavior.php(410): CDbCommand-&amp;gt;queryRow()&#xA;#20 /var/www/topsecret.co.uk/craft/app/etc/behaviors/AppBehavior.php(371): Craft\AppBehavior-&amp;gt;getInfo('maintenance')&#xA;#21 [internal function]: Craft\AppBehavior-&amp;gt;isInMaintenanceMode()&#xA;#22 /var/www/topsecret.co.uk/craft/app/framework/base/CComponent.php(261): call_user_func_array(Array, Array)&#xA;#23 /var/www/topsecret.co.uk/craft/app/etc/web/WebApp.php(145): CComponent-&amp;gt;__call('isInMaintenance...', Array)&#xA;#24 /var/www/topsecret.co.uk/craft/app/etc/web/WebApp.php(145): Craft\WebApp-&amp;gt;isInMaintenanceMode()&#xA;#25 /var/www/topsecret.co.uk/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#26 /var/www/topsecret.co.uk/craft/app/index.php(196): CApplication-&amp;gt;run()&#xA;#27 /var/www/topsecret.co.uk/web/index.php(17): require_once('/var/www/topse...')&#xA;#28 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking through that I'm not seeing any references to any custom plugins or templates so wonder if it's a bug...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be very much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2014-07-07T09:18:20.590" Title="CDbException: The DB query must contain the &quot;from&quot; portion" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="725" PostTypeId="2" ParentId="724" CreationDate="2014-07-03T16:59:59.497" Score="1" Body="&lt;p&gt;That actually looks like it might be a bug.  Can you send a database dump as well as a zip of your craft/storage/runtime/logs folder over to support@buildwithcraft.com so we can investigate?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-03T16:59:59.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="727" PostTypeId="2" ParentId="446" CreationDate="2014-07-03T17:26:40.690" Score="2" Body="&lt;p&gt;Muut's Small subscription ($36/month if paid yearly, $45 if paid month to month -- previously $16/$20 for a 'developer subscription') includes 'Single Sign On', so users in Craft can translate to users in Muut without having to login a second time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.theburn-zone.com/&quot; rel=&quot;nofollow&quot;&gt;BurnZone&lt;/a&gt; is another alternative, similar to Disqus, it's tailored to commenting. You'd have to have a user create an entry, then use BurnZone/Disqus to facilitate comments on that entry. Both Disqus and BurnZone have 'Single Sign On' included as a free feature.&lt;/p&gt;&#xA;" OwnerUserId="215" LastEditorUserId="215" LastEditDate="2014-11-02T00:47:17.237" LastActivityDate="2014-11-02T00:47:17.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="728" PostTypeId="1" CreationDate="2014-07-03T17:33:29.257" Score="4" ViewCount="411" Body="&lt;p&gt;I'm pretty new to Twig and I know the level here is far above my question, but thank you in advance...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm designing a site with sponsor logos on the homepage, each sponsor is an entry in a channel of sponsors. I have a lightswitch field on the entry page called 'showOnHome'.  I've tried &quot;if&quot; statements and conditionals in the loop, but have only got to where it shows the first entry and breaks the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works to get all of the entries, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('sponsors') %}&#xA;        {% for image in entry.sponsorlogo %}&#xA;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I only get entries where showOnHome == '1'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for helping the rookie.&lt;/p&gt;&#xA;" OwnerUserId="453" LastEditorUserId="57" LastEditDate="2014-07-03T19:03:12.387" LastActivityDate="2014-07-03T19:03:12.387" Title="Looping Entries Based on Field State" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="729" PostTypeId="2" ParentId="728" CreationDate="2014-07-03T17:59:40.467" Score="8" Body="&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('sponsors').showOnHome('1') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;.showOnHome('1')&lt;/code&gt; restricts your query to ones with the lightswitch on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted only the ones with the lightswitch off, you would use &lt;code&gt;.showOnHome('not 1')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-03T17:59:40.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="730" PostTypeId="2" ParentId="721" CreationDate="2014-07-03T18:06:03.040" Score="4" Body="&lt;p&gt;&lt;del&gt;There’s currently a bug with storing keywords based on related elements, which we’re looking into.&lt;/del&gt; Using the &lt;code&gt;search&lt;/code&gt; parameter for this isn’t really the right way to go anyway, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you should be using the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt; param&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.find({&#xA;    section:   'news',&#xA;    limit:     1,&#xA;    featured:  1,&#xA;    relatedTo: { targetElement: category, field: 'category' },&#xA;    order:     'postDate desc'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aforementioned bug was fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2563&quot; rel=&quot;nofollow&quot;&gt;Craft 2.1.2563&lt;/a&gt;.  You’re still better off using the &lt;code&gt;relatedTo&lt;/code&gt; param though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed a typo in the above code block.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="144" LastEditDate="2014-11-11T14:27:15.073" LastActivityDate="2014-11-11T14:27:15.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="731" PostTypeId="2" ParentId="728" CreationDate="2014-07-03T18:14:49.813" Score="3" Body="&lt;p&gt;While Marion’s answer is &lt;strong&gt;definitely&lt;/strong&gt; the right way to go about this, since you’re new with Twig I’ll show you how you could also do this with a Twig conditional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use an &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% if %}&lt;/code&gt; tag&lt;/a&gt; to check if your showOnHome field is enabled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('sponsors') %}&#xA;&#xA;        {% if entry.showOnHome %}&#xA;&#xA;            {% for image in entry.sponsorlogo %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. Again, using the &lt;code&gt;showOnHome(1)&lt;/code&gt; parameter on &lt;code&gt;craft.entries&lt;/code&gt; query is a much better way to go, since you will be saving Craft the trouble of fetching those entries to begin with.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-03T18:14:49.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="732" PostTypeId="2" ParentId="718" CreationDate="2014-07-03T18:25:34.877" Score="2" Body="&lt;p&gt;The outline of what you want to do looks reasonable. Here are some details:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get the category from the segment #}&#xA;{% set parentCategory = craft.categories.slug(craft.request.segment(2)) %}&#xA;&#xA;{# get the children of this category #}&#xA;{% set subCategories = craft.categories.descendantOf(parentCategory) %}&#xA;&#xA;{# loop over the subcategories #}&#xA;{% for subCat in subCategories %}&#xA;  &amp;lt;a href=&quot;{{subCat.url}}&quot;&amp;gt;{{subCat.title}}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-03T18:25:34.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="733" PostTypeId="2" ParentId="685" CreationDate="2014-07-03T19:29:10.503" Score="5" Body="&lt;p&gt;Just for reference, if you use a regular Rich Text field for an optional custom Post Excerpt and a Matrix field (with a &quot;text&quot; field in it, among others) for the Post Body, you could check the custom excerpt for content and otherwise output the first paragraph of the text field in the first Matrix block of type textBlock: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').find() %}&#xA;&#xA;        &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;post-summary&quot;&amp;gt;&#xA;            {% if entry.postExcerpt | length %}&#xA;                {# Custom Excerpt #}&#xA;                {{ entry.postExcerpt }}&#xA;            {% elseif entry.postBody.type('textBlock').first() | length %}&#xA;                {# Auto Excerpt: in postBody Matrix, find first text block and extract first paragraph #}&#xA;                {% set first_block = entry.postBody.type('textBlock').first() %}&#xA;                {% set first_block_text = first_block.text %}&#xA;                {% set paragraphs = first_block_text|split('&amp;lt;/p&amp;gt;') %}&#xA;                {% set first_paragraph = paragraphs|first ~ '&amp;lt;/p&amp;gt;' %}&#xA;                {{ first_paragraph | raw }}&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Read More&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt; &#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15" LastActivityDate="2014-07-03T19:29:10.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="734" PostTypeId="2" ParentId="718" CreationDate="2014-07-03T21:27:53.027" Score="4" Body="&lt;p&gt;I think you don't need or want the &lt;code&gt;{% nav %}&lt;/code&gt; tag. This should work with your current nav:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('products') %}&#xA;&#xA;&amp;lt;ul id=&quot;sideNav&quot;&amp;gt;&#xA;  {% for category in categories %}&#xA;    {% set thisIsActiveCategory = (category.slug == craft.request.segment(2)) %}&#xA;    &amp;lt;li{% if thisIsActiveCategory %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;      {{ category.title }}&#xA;      {% if thisIsActiveCategory %}&#xA;        {# loop over the subcategories #}&#xA;        {% set subCategories = craft.categories.descendantOf(category) %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% for subCat in subCategories %}&#xA;            &amp;lt;li&amp;gt;{{subCat.title}}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-03T21:27:53.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="735" PostTypeId="1" AcceptedAnswerId="968" CreationDate="2014-07-03T21:29:06.240" Score="6" ViewCount="449" Body="&lt;p&gt;The image tag shown below prevents my {% cache %} tag from caching the loop it's in. If I remove the image tag or change the data-resource attribut to a normal src, it works fine. The class=&quot;lazy&quot; and data-original are from the jQuery plugin Lazy Load 1.9.3. Regardless, the page still renders fine. Does anyone have any ideas what's wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help for a first-time poster.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img class=&quot;lazy&quot; data-original=&quot;{{ image.getUrl(transform) }}&quot; alt=&quot;{{ project.title }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Now showing just the code that seems to be the problem rather than the whole loop.&lt;/p&gt;&#xA;" OwnerUserId="229" LastEditorUserId="229" LastEditDate="2014-07-04T14:59:02.433" LastActivityDate="2014-07-11T21:23:02.767" Title="Cache tag won’t cache in a template" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="736" PostTypeId="2" ParentId="256" CreationDate="2014-07-03T21:39:28.817" Score="6" Body="&lt;p&gt;This looks like a bug to me too. Here are the search terms and generated queries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'pølser OR pålegg' -&#xA;   SELECT * FROM `craft_searchindex` WHERE (MATCH(`keywords`) AGAINST('pølser palegg' IN BOOLEAN MODE)) AND `elementId` IN (3,18,21,22,23,24)&#xA;&#xA;'&quot;pølser&quot; OR &quot;pålegg&quot;' -&#xA;   SELECT * FROM `craft_searchindex` WHERE (`keywords` LIKE '% pølser or %') AND MATCH(`keywords`) AGAINST('+palegg' IN BOOLEAN MODE) AND `elementId` IN (3,18,21,22,23,24)&#xA;&#xA;'&quot;egg&quot; OR &quot;spekemat&quot;' -&#xA;   SELECT * FROM `craft_searchindex` WHERE ((`keywords` LIKE '% egg %') OR MATCH(`keywords`) AGAINST('spekemat' IN BOOLEAN MODE)) AND `elementId` IN (3,18,21,22,23,24)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-03T21:39:28.817" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="737" PostTypeId="1" AcceptedAnswerId="756" CreationDate="2014-07-03T21:55:45.010" Score="2" ViewCount="377" Body="&lt;p&gt;I’m trying to create a plugin that relies on the values of a Matrix field in the same entry. Knowing that a single entry type could have more than 1 Matrix field, I think I need a way to select which Matrix field to pull from in my field settings. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="288" LastActivityDate="2014-07-06T17:39:22.030" Title="How can I create list of a group’s fields for a select field’s options in my Field Settings?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="738" PostTypeId="1" CreationDate="2014-07-04T05:48:56.500" Score="2" ViewCount="166" Body="&lt;p&gt;One of the functions in a plugin that I'm working on, is the ability to create fields. It has created a Matrix field, and directly after that, I want to know the MatrixBlockType.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get any results if I use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$blockTypes = craft()&amp;gt;matrix&amp;gt;getBlockTypesByFieldId($newField-&amp;gt;id, 'handle');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I do the exact same thing as the above function should do, and run this code I do have results:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$results = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;-&amp;gt;select('id, fieldId, fieldLayoutId, name, handle, sortOrder')&#xA;-&amp;gt;from('matrixblocktypes')&#xA;-&amp;gt;where('fieldId = :fieldId', array(':fieldId' =&amp;gt; $newField&amp;gt;id))&#xA;-&amp;gt;order('sortOrder')&#xA;-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you would debug both variables, you'll notice that the first one doesn't contain any data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I would be creating the fields and in later server request I would use the first example, I do receive the data. Somehow it's not available right after creating the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me out here by any chance? I want to use the first example, which is the correct way.&lt;/p&gt;&#xA;" OwnerUserId="121" LastEditorUserId="57" LastEditDate="2014-08-15T19:18:22.583" LastActivityDate="2014-08-15T19:19:30.613" Title="Matrix getBlockTypesByFieldId() function doesn't work as intended?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2014-08-15T20:38:40.560" ContentLicense="CC BY-SA 3.0" />
  <row Id="739" PostTypeId="1" AcceptedAnswerId="766" CreationDate="2014-07-04T07:54:15.830" Score="2" ViewCount="1013" Body="&lt;p&gt;I have two channels set up, the first creates entries called &quot;databytes&quot; the second is a channel for relating certain databytes to each other called &quot;databyteSeries&quot;. In my template I want to output all databytes but if they are related just show the first in the series. I have the following code which is displaying the first in the databyteSeries no problem (sectionId 8):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(['databytes','databyteSeries']).limit(6) as entries %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;  {% if entry.sectionId == 8 %}&#xA;&#xA;  {% for series in entry.relatedDatabytes %}&#xA;    {% if loop.first %}&#xA;      {# TEMPLATE CODE FOR ENTRY HERE #}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;  {% else %}&#xA;&#xA;    {# THIS NEEDS TO DISPLAY ALL DATABYTES THAT ARE NOT RELATED #}&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# PAGINATION CODE HERE #}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's the second part where I now only want to display the databytes that have NOT been related where I am struggling. I guess it needs some kind of reverse relationship where I have put the &lt;code&gt;{# THIS NEEDS TO DISPLAY ALL DATABYTES THAT ARE NOT RELATED #}&lt;/code&gt; but I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-07-04T09:35:57.880" LastActivityDate="2014-07-06T22:18:24.073" Title="Displaying Entries That Are Not Related" Tags="&lt;relations&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="740" PostTypeId="1" AcceptedAnswerId="910" CreationDate="2014-07-04T08:23:24.303" Score="5" ViewCount="1279" Body="&lt;p&gt;I'm trying to do a stock update for all entries within a channel with a cronjob once a day, and I can't achieve it, because I always get &lt;em&gt;Allowed memory size of X bytes exhausted&lt;/em&gt; (tried to allocate Y bytes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries are around 2000 and the server is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Amazon_Elastic_Compute_Cloud&quot; rel=&quot;nofollow&quot;&gt;EC2&lt;/a&gt; medium instance. The cron I'm using is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 9 * * * wget -O /home/ubuntu/cronStock http://domain.com/actions/garp/cron/changeStock&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I will try to create a simpler script without all the loaders Craft calls in a controller, but I'm not sure it will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionChangeStock()&#xA;{&#xA;    foreach ($this-&amp;gt;getAllFromChannel('productVariants', 10) as $key =&amp;gt; $entry) {&#xA;&#xA;        //$entry = $this-&amp;gt;getElementByField(&quot;3081001100390&quot;, ElementType::Entry, null, &quot;variantSku&quot;);&#xA;        //$entry-&amp;gt;enabled = false;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'variantStock'  =&amp;gt; $this-&amp;gt;getStockFromGarp($entry-&amp;gt;variantSku)&#xA;        ));&#xA;        $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        echo $entry-&amp;gt;variantSku.': '.$entry-&amp;gt;variantStock.'&amp;lt;br&amp;gt;';&#xA;    }&#xA;    die();&#xA;}&#xA;&#xA;protected function getAllFromChannel($channel, $limit = null) {&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = $channel;&#xA;    $criteria-&amp;gt;limit = $limit;&#xA;&#xA;    return $criteria-&amp;gt;find();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I fix this problem?&lt;/p&gt;&#xA;" OwnerUserId="435" LastEditorUserId="392" LastEditDate="2014-08-04T19:15:41.567" LastActivityDate="2014-08-04T19:15:41.567" Title="Memory issue when updating all entries from a channel (allowed memory size of X bytes exhausted (tried to allocate Y bytes))" Tags="&lt;plugin-development&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="741" PostTypeId="1" CreationDate="2014-07-04T09:38:05.683" Score="3" ViewCount="222" Body="&lt;p&gt;I'm new to Craft, but starting off with building a multilingual site. I wonder what is best practice for storing multilingual content that is used accross sections (i.e. site navigation headings, footer link text). I know about the static translation files, but I want to enable local editors to translate those themselves in the CP. &lt;/p&gt;&#xA;" OwnerUserId="457" LastEditorUserId="437" LastEditDate="2014-07-04T11:36:56.833" LastActivityDate="2014-07-04T11:36:56.833" Title="Storing multilingual content that is used across sections" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="742" PostTypeId="1" CreationDate="2014-07-04T09:57:02.903" Score="18" ViewCount="2883" Body="&lt;p&gt;I had to add an image size in the assets transforms; all my pics were previously uploaded, but when I use &lt;code&gt;getUrl('headIpad')&lt;/code&gt;, it makes urls like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://host.com/cpresources/transforms/4/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://host.com/uploads/team-photo/_headIpad/fall-back.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use generateTransformsBeforePageLoad in my config but Craft generates an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error&#xA;  Image “fall-back.jpg” cannot be found.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="458" LastEditorUserId="57" LastEditDate="2014-07-04T15:39:46.370" LastActivityDate="2017-06-24T17:01:15.707" Title="How do I force Craft to regenerate assets transform?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="743" PostTypeId="2" ParentId="741" CreationDate="2014-07-04T10:27:30.490" Score="5" Body="&lt;p&gt;I am fairly new to Craft myself but I think the best approach for that type of content would be to set up &lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot;&gt;Globals&lt;/a&gt; I think you can then make them translatable and common translations can be added to in a &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager/tree/master/final/web/craft/translations&quot;&gt;translations file&lt;/a&gt;. Have a look at the &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager/tree/master/final&quot;&gt;HappyLager&lt;/a&gt; site to see how that works. I have found it really useful.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-07-04T10:27:30.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="745" PostTypeId="1" AcceptedAnswerId="746" CreationDate="2014-07-04T13:57:42.800" Score="6" ViewCount="1804" Body="&lt;p&gt;Does anyone have an experience in using Craft in conjunction with a front-end JS MVC/MVVM framework such as Backbone, Ember or Angular?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a project coming up where there may be a lot of JS state management requirement and AJAX calls required, and would like to access back-end data using JSON. However, there is also a strong need for a robust easy-to-use CMS as there will be a lot of content to administer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first port of call for this type of application would be some more general server-side framework such as Laravel, but Craft has sort of spoiled us with the content management side of things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way of marrying Craft with this kind of project?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2017-07-27T18:47:47.943" Title="Craft CMS and JS/MVVM frameworks" Tags="&lt;ajax&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="746" PostTypeId="2" ParentId="745" CreationDate="2014-07-04T14:07:53.950" Score="5" Body="&lt;p&gt;I am just starting out on a project using both Craft and Angular. I ran into an early issue because both Angular and Twig use the {{ }} braces, but that was quickly fixed by changing Angular’s settings like in &lt;a href=&quot;https://stackoverflow.com/questions/13671701/angularjs-twig-conflict-with-double-curly-braces&quot;&gt;this Stackover flow post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Christian noted in the comments, though, you could also use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/verbatim.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% verbatim %}&lt;/a&gt; tag to keep Craft from parsing Angular tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from that, I haven't had issues since Craft gives you full frontend control and there are no CMS scripts on the frontend to worry about. And (so far) Craft's dynamic routes make it really quite easy to set up your templates, JSON, etc.&lt;/p&gt;&#xA;" OwnerUserId="109" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-07-05T18:53:44.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="747" PostTypeId="2" ParentId="742" CreationDate="2014-07-04T15:10:27.003" Score="17" Body="&lt;p&gt;If you simply go into your &lt;code&gt;craft_assettransformindex&lt;/code&gt; table and &lt;strong&gt;empty it&lt;/strong&gt;, that should trigger brand new transformations for everything.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-04T15:10:27.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="748" PostTypeId="2" ParentId="740" CreationDate="2014-07-04T15:54:10.917" Score="3" Body="&lt;p&gt;I've got no idea what your script is actually doing, but it sounds like it's pretty memory intensive and PHP is simply running out of it's allocated memory trying to finish executing the script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bump up the memory_limit in your php.ini file to something larger (128M, 256M, 512M, etc.) and try the script again.  Note that you may or may not have to restart your web server before the setting takes affect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option, is to use Craft's &lt;code&gt;TasksService&lt;/code&gt;, which runs these memory intensive, long running tasks in the background in small batches to avoid memory limitations like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're simply resaving all of the entries in the system, you can also look at triggering Craft's &lt;code&gt;ResaveElements&lt;/code&gt; task, like &lt;a href=&quot;https://craftcms.stackexchange.com/a/823/57&quot;&gt;Brandon pointed out&lt;/a&gt;.  If your plugin needs to do some custom logic outside of the scope of &lt;code&gt;ResaveElements&lt;/code&gt;, it can create it's own task to register with Craft and run.  We don't have any documentation for that up, yet, but if you look at &lt;code&gt;craft/app/tasks&lt;/code&gt; and &lt;code&gt;craft/app/services/TasksService.php&lt;/code&gt; you can get a good idea of what's required.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-08T16:48:07.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="749" PostTypeId="1" AcceptedAnswerId="750" CreationDate="2014-07-04T16:22:51.127" Score="7" ViewCount="7293" Body="&lt;p&gt;Inside the default template that comes installed with Craft, the title of a page is set as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works perfectly for the homepage and on pages where the {{ title }} variable is set. However for individual entries inside a channel, only the site name is used for the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to use the {{ entry.title }} variable instead, however in that case the title of the homepage is rendered as 'Homepage - {{ siteName }}'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to achieve the following page titles for the different sections?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Homepage: {{ siteName }}&#xA;Page: {{ title }} - {{ siteName }}&#xA;Entry: {{ entry.title }} - {{ siteName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="455" LastEditorUserId="115" LastEditDate="2014-07-05T19:53:22.880" LastActivityDate="2014-07-05T19:53:22.880" Title="How do I adjust the page title for different Section and Entry pages?" Tags="&lt;templating&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="750" PostTypeId="2" ParentId="749" CreationDate="2014-07-04T17:02:15.767" Score="11" Body="&lt;p&gt;The &lt;code&gt;title&lt;/code&gt; var can be set in the child templates, that way you can fine-tune it for each section of your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at these default templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;news/index.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;News&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;news/_entry.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main layout just checks if it has been defined or not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Embed templates might be confusing at first, but are really great, &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/embed.html&quot;&gt;check out the docs.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-04T17:02:15.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="751" PostTypeId="1" AcceptedAnswerId="753" CreationDate="2014-07-04T20:24:35.060" Score="6" ViewCount="1790" Body="&lt;p&gt;I have a category set up and have added entries to it. How do I loop through these entries, and output just the title of each entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Serious noob here but trying to learn, any help would be gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="463" LastEditorUserId="45" LastEditDate="2014-07-04T20:41:54.480" LastActivityDate="2014-08-04T05:02:47.890" Title="How can I create a simple loop through entries in a category?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="752" PostTypeId="1" AcceptedAnswerId="809" CreationDate="2014-07-04T22:08:18.170" Score="3" ViewCount="256" Body="&lt;p&gt;&lt;strong&gt;Plugin 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that is a custom fieldtype.  It works fine, and has a getInputHtml() method that behaves as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have a second plugin, where I want to output the HTML from the Plugin 1 getInputHtml() method.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the FieldModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field = $field-&amp;gt;getField();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the Plugin 1 fieldtype object&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldtype = craft()-&amp;gt;fields-&amp;gt;populateFieldType($field, $element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I call the getInputHtml() method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldtype-&amp;gt;getInputHtml($field-&amp;gt;handle, $value);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I place the necessary files at the base of Plugin 2 &lt;code&gt;plugin2/templates/plugin1/_field/input&lt;/code&gt; everything works fine.  But I can't seem to access the input HTML template in the context of Plugin 1: &lt;code&gt;plugin1/templates/_field/input&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to update the Template Path in various ways before calling $fieldtype-&gt;getInputHtml():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getPluginsPath());&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'plugin1/');&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getCpTemplatesPath());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything I have tried has resulted in a template error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to find the template &quot;plugin1/_field/input&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-08T11:25:30.407" Title="How do I call the getInputHtml() method of a custom fieldtype plugin from another plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="753" PostTypeId="2" ParentId="751" CreationDate="2014-07-04T22:25:08.573" Score="6" Body="&lt;p&gt;This example assumes you have your &lt;a href=&quot;http://buildwithcraft.com/docs/categories#category-groups&quot; rel=&quot;nofollow&quot;&gt;Category Group&lt;/a&gt; setup to use custom URLs.  In the template used to display your categories, the &lt;code&gt;category&lt;/code&gt; variable will be available and represent your &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;CategoryModel&lt;/a&gt; for that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is to pass the &lt;code&gt;CategoryModel&lt;/code&gt; (in our example below &lt;code&gt;category&lt;/code&gt;) to the &lt;code&gt;relatedTo&lt;/code&gt; parameter of the Entries tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.title }}&#xA;&#xA;{% paginate craft.entries&#xA;    .section('articles')&#xA;    .relatedTo(category)&#xA;    .limit(10) &#xA;    as entries &#xA;%}&#xA;&#xA;    {% if entries|length %}&#xA;&#xA;        {# Content #}&#xA;        {% for entry in entries %}&#xA;            {{ entry.title }}&#xA;        {% endfor %}&#xA;&#xA;        {# Pagination #}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;No items have been added to this Category yet.&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-08-04T05:02:47.890" LastActivityDate="2014-08-04T05:02:47.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="754" PostTypeId="2" ParentId="739" CreationDate="2014-07-04T23:39:12.013" Score="3" Body="&lt;p&gt;Your question is just about entries without relationships but your code example is attempting to display both items with a relationship and without a relationship.  I think your example is making things a bit more complicated than this needs to be.  Rather than looping through both sections (databytes and databyteSeries), I believe you only need to loop through one section.  The &lt;code&gt;databyteSeries&lt;/code&gt; section, as you've described it, has a relation field for &lt;code&gt;databytes&lt;/code&gt;, so all the info you need to know about &lt;code&gt;databytes&lt;/code&gt; should be available to you in the relation field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if the following example gets at what you are going for.  It simplifies your loop to just the &lt;code&gt;databyteSeries&lt;/code&gt; section, and then uses Twig's length filter to test the &lt;code&gt;entry.relatedDatabytes&lt;/code&gt; field to see if it has any entries. If there are related databytes, it displays one output, and if there are not, it displays an alternative output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also updated the method in which you were using to output the first item in the series.  Rather than loop through the entire &lt;code&gt;entry.relatedDatabytes&lt;/code&gt; field and just output the first item using a &lt;code&gt;loop.first&lt;/code&gt; conditional, I've updated the code to use &lt;code&gt;entry.relatedDatabytes.first()&lt;/code&gt;.  Using the &lt;code&gt;first()&lt;/code&gt; method on an EntryModel will just grab the first item, and then you can output it as you wish with whatever variable you assign it to.  Below, I've assigned the first item to the &lt;code&gt;firstInSeries&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries&#xA;     .section('databyteSeries')&#xA;     .limit(6)&#xA;     as entries &#xA;%}&#xA;&#xA;    {# Loop through databyteSeries entries #}&#xA;    {% for entry in entries %}&#xA;&#xA;        {% if entry.relatedDatabytes|length %}&#xA;&#xA;            {# Display the first item in a Databyte Series that has a relationship #}&#xA;            {% set firstInSeries = entry.relatedDatabytes.first() %}&#xA;        {{ firstInSeries.title }}&#xA;&#xA;      {% else %}&#xA;&#xA;        {# Display the Databyte Series name that has no relationships #}&#xA;        {{ entry.title }}&#xA;&#xA;      {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your clarification in the comments and your potential solution, here's another method to consider using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;without&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all databyteSeries and databytes #}&#xA;{% set databyteSeries = craft.entries.section('databyteSeries').limit(null) %}&#xA;{% set databytes = craft.entries.section('databytes').limit(null).indexBy('id') %}&#xA;&#xA;{# Determine which databytes already have a relationship to a databyteSeries #}&#xA;{% set alreadyUsedDatabytes = craft.entries.section('databytes').relatedTo(databyteSeries).indexBy('id') %}&#xA;&#xA;{# Use the without filter to remove all 'alreadyUsedDatabytes' from the complete 'databytes' result, so you are left with only 'unusedDatabytes'  #}&#xA;{% set unusedDatabytes = databytes|without(alreadyUsedDatabytes) %}&#xA;&#xA;{# Output the unusedDatabytes #}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for entry in unusedDatabytes %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have not tested this code so let me know if you run into any issues to troubleshoot.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-07-06T15:45:30.237" LastActivityDate="2014-07-06T15:45:30.237" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="755" PostTypeId="2" ParentId="751" CreationDate="2014-07-05T01:21:54.803" Score="6" Body="&lt;p&gt;Here's another good example for working with categories that may be useful to you. This will loop through all categories (that have entries) and show their entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('someSection').limit(null) %}&#xA;&#xA;{% for category in craft.categories.group('someCategoryGroup').relatedTo(entries) %}&#xA;    &amp;lt;h2&amp;gt;{{ category }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for entry in entries.relatedTo(category) %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-05T01:21:54.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="756" PostTypeId="2" ParentId="737" CreationDate="2014-07-05T07:27:02.927" Score="3" Body="&lt;p&gt;Your plugin will need a few things.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;FieldType&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types#giving-your-fieldtype-some-settings&quot; rel=&quot;nofollow&quot;&gt;FieldType Settings&lt;/a&gt; using &lt;code&gt;defineSettings()&lt;/code&gt; and &lt;code&gt;getSettingsHtml()&lt;/code&gt; method&lt;/li&gt;&#xA;&lt;li&gt;A template that will render your settings which will be referenced in the &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render&lt;/code&gt; function of the &lt;code&gt;getSettingsHtml()&lt;/code&gt; method&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the settings template, I believe you will need two dropdowns.  The first, will just be a dropdown of available Sections.  Upon selecting the section, you would update the second Dropdown to have a list of the Matrix fields within that section, or a message saying that no Matrix fields we're available.  Or perhaps, you can just sort out which Sections have Matrix fields to start off with, and only display those Sections in the dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if there is a more efficient way to just grab Matrix fields, but here are some functions that may help you get to what you need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get all available Sections&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$sections = craft()-&amp;gt;sections-&amp;gt;getAllSections()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get a specific section by ID&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$section = craft()-&amp;gt;sections-&amp;gt;getSectionById(1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get the FieldLayoutFieldModels attached to a Section (Note Fields are not related to the Section directly, they are related to a FieldLayout, which is related to an EntryType, which is related to your Section).  In the example below, I have assumed you are grabbing the first EntryType using &lt;code&gt;getEntryTypes()[0]&lt;/code&gt; however in your code, you'll likely have to do a bit more logic to make sure you're getting what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$fields = $section-&amp;gt;getEntryTypes()[0]-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have the FieldLayoutFieldModels, you can access each FieldModel using the &lt;code&gt;getField()&lt;/code&gt; method and check which type of field type it is:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;foreach ($fields as $field) &#xA;{&#xA;  $field = $field-&amp;gt;getField();          &#xA;&#xA;  if ($field-&amp;gt;type == 'Matrix') &#xA;  {&#xA;    // Build an array of the options for your Matrix fields dropdown&#xA;  }             &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you build an array of your options, you can hand them off to your fields settings template in the &lt;code&gt;getSettingsHtml()&lt;/code&gt; method and loop through and output them in your template file.  The doc pages referenced at the beginning of this post go over that in more detail.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return craft()-&amp;gt;templates-&amp;gt;render('yourplugin/_fields/settings', array(&#xA;    'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;    'matrixFieldOptions' =&amp;gt; $matrixFieldOptions&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="177" LastEditDate="2014-07-06T17:39:22.030" LastActivityDate="2014-07-06T17:39:22.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="757" PostTypeId="1" AcceptedAnswerId="759" CreationDate="2014-07-05T07:40:29.463" Score="2" ViewCount="666" Body="&lt;p&gt;I'm using Craft in a multilingual setup with the Smart Map plugin. However, the CSS and JavaScript files are not being linked properly when the site isn't in the main language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, the paths to the plugin resources contain the language prefix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/en/cpresources/smartmap/css/smartmap.css&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this normal behaviour? How can it be fixed?&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="45" LastEditDate="2014-07-06T04:15:30.327" LastActivityDate="2014-07-06T13:30:34.787" Title="Why do the plugin resource paths include the localization prefix?" Tags="&lt;plugin-smartmap&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="758" PostTypeId="1" AcceptedAnswerId="760" CreationDate="2014-07-05T08:57:45.903" Score="6" ViewCount="196" Body="&lt;p&gt;When it comes to naming files within a plugin - is it preferable to follow &lt;code&gt;PluginHandle_SomeController&lt;/code&gt;, or stuff everything inside a single &lt;code&gt;PluginHandleController&lt;/code&gt; file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably a subjective question for the most part - but in building out a plugin at the moment, I have 4 different Service files, and I'm not sure if I'm being too pragmatic by breaking each different service type out individually, or if I should just include it within the single file. Each service isn't complex, they're basically a function or two each, but cover different aspects of the plugins feature set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any benefit to one way or the other?&lt;/p&gt;&#xA;" OwnerUserId="465" LastActivityDate="2014-07-06T02:48:43.073" Title="Best practices for plugin service/controller/etc file names" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="759" PostTypeId="2" ParentId="757" CreationDate="2014-07-05T09:26:12.523" Score="2" Body="&lt;p&gt;Good question... As far as I know, the plugin's resource paths &lt;strong&gt;should not&lt;/strong&gt; include the localization prefix. The resources are being called via PHP in the most direct way possible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJsResource('smartmap/js/smartmap.js');&#xA;craft()-&amp;gt;templates-&amp;gt;includeCssResource('smartmap/css/smartmap.css');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure, but I suspect this may be a Craft bug. I've reached out to Pixel &amp;amp; Tonic in order to fully diagnose the problem. If the plugin code needs to be corrected, I will implement a fix as soon as we can figure out what's going on.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-05T09:26:12.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="760" PostTypeId="2" ParentId="758" CreationDate="2014-07-05T09:41:38.473" Score="9" Body="&lt;p&gt;At the end of the day, it all comes down to &lt;strong&gt;personal preference&lt;/strong&gt;. Depending on how large and/or complex each of your Service files is, it may make sense to break them up into separate files. Or if you've got less than a dozen service methods total, you could easily combine them into a single service file (if you choose).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me personally, I try to break it up by where those service methods are being called from. &lt;code&gt;MyPlugin_VariableService&lt;/code&gt; and &lt;code&gt;MyPlugin_ControllerService&lt;/code&gt; for example... and any methods that are shared would go in the &quot;main&quot; &lt;code&gt;MyPluginService&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But every developer (and project) is different. You may have some other method of organizing that's better suited to you. So mostly personal preference.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, the one thing I would definitely suggest... If you build any service methods which you'd like to be triggered from &lt;strong&gt;other plugins&lt;/strong&gt;, then you may want to put those in your main service file. So the other plugins could simply call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft-&amp;gt;myPlugin-&amp;gt;myMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as an API for your plugin goes, it's much cleaner. Similarly, for any Controller actions which submit through a front-end form, you may want to have those submit through the &quot;main&quot; controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myPlugin/myAction&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lastly, the same thinking applies to your main Variable file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.myVariable }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just makes for a cleaner interface for end-users and other devs. :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-07-06T02:48:43.073" LastActivityDate="2014-07-06T02:48:43.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="761" PostTypeId="1" AcceptedAnswerId="762" CreationDate="2014-07-05T09:44:20.323" Score="3" ViewCount="3659" Body="&lt;p&gt;I would like to loop through entries in a channel but only the ones for a specific entry type. Is this Possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the free version of craft on a test site, I have used the channel for my pages but also want to set up a blog. I have set up a blogPost entry type, is there a way to target this in a loop?&lt;/p&gt;&#xA;" OwnerUserId="463" LastEditorUserId="115" LastEditDate="2014-07-05T17:29:42.437" LastActivityDate="2020-10-12T00:15:19.427" Title="How do I loop through entries for a specific entry type?" Tags="&lt;entry-type&gt;&lt;loop&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="762" PostTypeId="2" ParentId="761" CreationDate="2014-07-05T10:19:04.667" Score="14" Body="&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages').type('blogPost') %}&#xA;&#xA;{% for entry in entries %}&#xA;   {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is what I have cobbled together... any pointers on improvements would be welcome.&lt;/p&gt;&#xA;" OwnerUserId="463" LastEditorUserId="57" LastEditDate="2014-07-05T13:31:51.233" LastActivityDate="2014-07-05T13:31:51.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="763" PostTypeId="1" AcceptedAnswerId="764" CreationDate="2014-07-05T11:45:44.623" Score="5" ViewCount="1281" Body="&lt;p&gt;Within a plugin I'm working on, I'll be adding user synchronisation with a third-party database to enable SSO, so will be creating users within Craft based on an interaction from this other service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also like to associate the user ID from the other service against the Craft User model. Obviously you can create custom fields from within the CP - but is there a way for a plugin to automatically add a custom field so the admin doesn't need to do it themselves?&lt;/p&gt;&#xA;" OwnerUserId="465" LastEditorUserId="250" LastEditDate="2014-07-08T22:05:20.243" LastActivityDate="2014-07-08T22:05:20.243" Title="Is it possible to add a custom field to User model from a plugin?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="764" PostTypeId="2" ParentId="763" CreationDate="2014-07-05T16:14:51.950" Score="6" Body="&lt;p&gt;First of all, you will need the Pro package to be able to customise the user profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would have to use the &lt;em&gt;onAfterInstall&lt;/em&gt; and &lt;em&gt;onBeforeUninstall&lt;/em&gt; events in your plugin file. These events are called when installing and uninstalling the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the install, you need to create a new field and add it to the user field layout. And before uninstall, you have to remove the field from the layout and delete the field itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below should work, but it doesn't keep the required fields (I didn't find a way to get them using the available functions).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class UserfieldPlugin extends BasePlugin&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Userfield');&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '0.9.1';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'Mario';&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'http://craftshake.com';&#xA;    }&#xA;&#xA;    public function onAfterInstall()&#xA;    {&#xA;        // Create the third party field&#xA;&#xA;        $thirdPartyField = new FieldModel();&#xA;        $thirdPartyField-&amp;gt;groupId      = 1;&#xA;        $thirdPartyField-&amp;gt;name         = Craft::t('Third Party');&#xA;        $thirdPartyField-&amp;gt;handle       = 'thirdParty';&#xA;        $thirdPartyField-&amp;gt;translatable = false;&#xA;        $thirdPartyField-&amp;gt;type         = 'PlainText';&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;saveField($thirdPartyField);&#xA;&#xA;        // Create the new user field layout&#xA;&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType(ElementType::User);&#xA;        $fieldsIds = $fieldLayout-&amp;gt;getFieldIds();&#xA;        $fieldsIds[] = $thirdPartyField-&amp;gt;id;&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;deleteLayoutsByType(ElementType::User);&#xA;&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout(&#xA;            array(&#xA;                Craft::t('Profile') =&amp;gt; $fieldsIds,&#xA;            ),&#xA;            array(),&#xA;            false&#xA;        );&#xA;        $fieldLayout-&amp;gt;type = ElementType::User;&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;saveLayout($fieldLayout, false);&#xA;    }&#xA;&#xA;    public function onBeforeUninstall()&#xA;    {&#xA;        // Get third party field&#xA;        $thirdPartyField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('thirdParty');&#xA;&#xA;        // Remove field from layout&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType(ElementType::User);&#xA;        $fieldsIds = $fieldLayout-&amp;gt;getFieldIds();&#xA;        $fieldsIds = array_diff($fieldsIds, array($thirdPartyField-&amp;gt;id));&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;deleteLayoutsByType(ElementType::User);&#xA;&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout(&#xA;            array(&#xA;                Craft::t('Profile') =&amp;gt; $fieldsIds,&#xA;            ),&#xA;            array(),&#xA;            false&#xA;        );&#xA;        $fieldLayout-&amp;gt;type = ElementType::User;&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;saveLayout($fieldLayout, false);&#xA;&#xA;        // Delete field&#xA;        craft()-&amp;gt;fields-&amp;gt;deleteField($thirdPartyField);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mario&lt;/p&gt;&#xA;" OwnerUserId="304" LastActivityDate="2014-07-05T16:14:51.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="765" PostTypeId="1" CreationDate="2014-07-05T19:32:27.340" Score="3" ViewCount="111" Body="&lt;p&gt;I have static data that my plugin requires as an array (multidimensional with 100s of items), it doesn't need to change and it seems overkill to store in a database and not appropriate as just arrays in my code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Options I have considered:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Json files - load them in&lt;/li&gt;&#xA;&lt;li&gt;In the config file&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which is best and is there a more appropriate way to store access?&lt;/p&gt;&#xA;" OwnerUserId="158" LastEditorUserId="57" LastEditDate="2014-07-06T00:03:07.467" LastActivityDate="2014-07-06T00:21:28.290" Title="What's the best place to store and load static data for plugins?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="766" PostTypeId="2" ParentId="739" CreationDate="2014-07-05T20:31:44.380" Score="1" Body="&lt;p&gt;I think I have a solution: if I create an array and add the entry id's for the &lt;code&gt;databytes&lt;/code&gt; that are being used in the &lt;code&gt;databyteSeries&lt;/code&gt; collections, then I can check that the entries are not in the array and display all the remaining entries from the &lt;code&gt;databytes&lt;/code&gt; and &lt;code&gt;databyteSeries&lt;/code&gt; channels. Here is a simple test that I am working with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set alreadyUsedDatabytes = [] %}&#xA;&#xA;{% set databyteSeries = craft.entries.section('databyteSeries') %}&#xA;{% for entry in craft.entries.section('databytes').relatedTo(databyteSeries) %}&#xA;  {% set alreadyUsedDatabytes = alreadyUsedDatabytes|merge([entry.id]) %}&#xA;{% endfor %}&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for entry in craft.entries.section(['databytes','databyteSeries']) %}&#xA;  {% if entry.id not in alreadyUsedDatabytes %}&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-07-05T20:31:44.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="767" PostTypeId="2" ParentId="765" CreationDate="2014-07-06T00:21:28.290" Score="4" Body="&lt;p&gt;What format is the source data in?  If it's already in a multidimensional PHP array, then it might be as simple as having a &lt;code&gt;data.php&lt;/code&gt; file in your plugin and doing a &lt;code&gt;require_once&lt;/code&gt; in your plugin's &lt;code&gt;init()&lt;/code&gt; method and you're good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if it's in a different format, loading it from &lt;code&gt;init()&lt;/code&gt; and parsing it into the multidimensional array is a good option.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-06T00:21:28.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="769" PostTypeId="1" AcceptedAnswerId="770" CreationDate="2014-07-06T10:17:22.640" Score="4" ViewCount="4630" Body="&lt;p&gt;This is a beginner question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I create a link to an entry using entry's id?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried several combinations, such as &lt;code&gt;{{ entry.getUrl(my_id) }}&lt;/code&gt;, &lt;code&gt;{{ entry.url.id(my_id) }}&lt;/code&gt;, etc. but failed to found the correct syntax.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2015-02-01T18:14:47.987" Title="How do I create a link to an entry using entry's id?" Tags="&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="770" PostTypeId="2" ParentId="769" CreationDate="2014-07-06T10:54:21.117" Score="4" Body="&lt;p&gt;The reason why your example fail is that you are using the &lt;code&gt;entry&lt;/code&gt; variable. You are trying to call the function &lt;code&gt;getUrl&lt;/code&gt; on the model &lt;code&gt;entry&lt;/code&gt;, but the function (or model) doesn't exist yet, and has to be created (fetched).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;craft.entries&lt;/a&gt; to fetch the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;, and than output its url:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set my_id = 5 %}&#xA;{% set entry = craft.entries.id(my_id).first() %}&#xA;{{ entry.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are in an entry loop, it works the same way:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('blog') %}&#xA;    {{ entry.url }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="9" LastEditDate="2014-07-06T13:21:59.010" LastActivityDate="2014-07-06T13:21:59.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="771" PostTypeId="2" ParentId="757" CreationDate="2014-07-06T13:30:34.787" Score="2" Body="&lt;p&gt;When Craft generates a “resource URL” from a front-end request, it just takes whatever the current site URL is, adds the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#resourceTrigger&quot; rel=&quot;nofollow&quot;&gt;resourceTrigger&lt;/a&gt; config setting (“cpresources”), and then adds the path that was passed in (“smartmap/js/smartmap.js” for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if your site URL is “/en”, then that’s going to be part of the resulting resource URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as there’s a working Craft index.php file at /en/index.php, and you’re able to serve regular front end pages from that base URL, then there’s no reason the “en/” part should be tripping anything up when serving resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the CP’s front-end resources are served through the same mechanism – try going to /en/admin (or whatever your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;cpTrigger&lt;/a&gt; is set to) and seeing if the CP is working normally from there.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-06T13:30:34.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="772" PostTypeId="1" AcceptedAnswerId="775" CreationDate="2014-07-06T16:56:43.040" Score="9" ViewCount="3315" Body="&lt;p&gt;The website I'm working on has different sections and each section different types of entries. I would like the types of entries to be shown in the URL. I have followed &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-urls&quot; rel=&quot;noreferrer&quot;&gt;this tutorial to do so&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a site example.com where we have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Section called: My Section&lt;/li&gt;&#xA;&lt;li&gt;With Entry Types: Example Entry Type, Another Entry type.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Utilizing the model from the tutorial, we could structure the URL for &lt;em&gt;My Section&lt;/em&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/my-section/{type}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which would give us URLs like these:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/my-section/&lt;strong&gt;exampleEntryType&lt;/strong&gt;/new-entry-1&lt;/li&gt;&#xA;&lt;li&gt;example.com/my-section/&lt;strong&gt;exampleEntryType&lt;/strong&gt;/new-entry-2&lt;/li&gt;&#xA;&lt;li&gt;example.com/my-section/&lt;strong&gt;anotherEntryType&lt;/strong&gt;/new-entry-3&lt;/li&gt;&#xA;&lt;li&gt;example.com/my-section/&lt;strong&gt;anotherEntryType&lt;/strong&gt;/new-entry-4&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Notice that the &lt;strong&gt;entry types&lt;/strong&gt; are the only part of the URL camelCased. This is  because Entry Types can only be configured to have a Name, and a Handle; and handles can NOT have dashes. This interferes with keeping URLs consistent as the rest of the site uses dashes instead of spaces&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am trying to solve is: how do we get the Entry Types to stay consistent with the rest of the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestion on how to deal with this? Is this a problem that should be addressed in Craft? Should I be taking another approach for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had considered using categories but the way the system is setup, entry types seem more appropriate. &lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="47" LastEditDate="2014-07-06T20:53:44.330" LastActivityDate="2016-08-24T23:41:42.813" Title="Entry Types Custom Slug" Tags="&lt;entry-type&gt;&lt;url&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="773" PostTypeId="2" ParentId="772" CreationDate="2014-07-06T17:30:28.003" Score="3" Body="&lt;p&gt;You can change the slug for the entry type to be whatever you want it to be. The one generated by Craft with the -'s is a default, not a requirement. Also there is a config setting, &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#slugWordSeparator&quot; rel=&quot;nofollow&quot;&gt;slugWordSeparator&lt;/a&gt; to control the default word separator.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-06T17:30:28.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="775" PostTypeId="2" ParentId="772" CreationDate="2014-07-06T21:34:07.747" Score="10" Body="&lt;p&gt;You could just set your &quot;Entry URL Format&quot; to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-section/{type.name}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your entry type names couldn't be as clean when composing entries in the CP as you'd need to set them to something like &quot;example-entry-type&quot;, but it would work.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now for the really clean way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install the &lt;a href=&quot;https://github.com/low/low_regex/&quot;&gt;Low Regex for Craft&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set &quot;Entry URL Format&quot; to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-section/{type.handle|regex('/(^|[a-z])([A-Z])/e', 'strtolower(strlen(&quot;\\1&quot;) ? &quot;\\1-\\2&quot; : &quot;\\2&quot;)',(type.handle))}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will convert the entry type handle from camelCase to all lowercase with dashes as word delimiters. Set the entry type handles to be like &quot;exampleEntryType&quot; and they will become &quot;example-entry-type&quot; when in a slug.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-07-06T21:49:12.633" LastActivityDate="2014-07-06T21:49:12.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="776" PostTypeId="2" ParentId="691" CreationDate="2014-07-06T22:02:14.417" Score="7" Body="&lt;p&gt;When dealing with XSS concerns, it's important to stay focused on the fact that this is a client-side issue... So in regards to Craft, &lt;strong&gt;Twig&lt;/strong&gt; is the star of the show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, Twig takes measures by default to ensure that your output is safe. For example, any time you're outputting some HTML code via a Twig variable, you're required to add a &lt;code&gt;raw&lt;/code&gt; filter to get the HTML to render properly. Otherwise, those special characters get encoded and simply rendered &quot;as is&quot; on the front-end. When you apply the &lt;code&gt;raw&lt;/code&gt; filter to a Twig variable, you're essentially telling Twig that you trust whatever data may be coming out of that variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a few other Twig filters which may help you out:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/escape.html&quot;&gt;escape&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot;&gt;striptags&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your question puts an emphasis on data &lt;strong&gt;input&lt;/strong&gt;, which isn't typically where XSS issues are addressed. However, there are some things (as you noted) which can help you sort out incoming data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Validating your data using Yii validation rules is a good start. And I believe the &lt;code&gt;CHtmlPurifier&lt;/code&gt; can be useful to you as well. Skimming through the Yii documentation, I believe this helper method can be applied to input data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$purifier = new \CHtmlPurifier();&#xA;$purifier-&amp;gt;purify($html)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier&quot;&gt;http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Simply apply that helper method to data as it's being stored in your Record, and that should make your data safe for future output.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2014-07-07T00:13:28.407" LastActivityDate="2014-07-07T00:13:28.407" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="777" PostTypeId="2" ParentId="739" CreationDate="2014-07-06T22:18:24.073" Score="1" Body="&lt;p&gt;I think you should consider using a structure for your entries. Try a structure with Max Levels = 2 and two field types: &lt;em&gt;single&lt;/em&gt; and &lt;em&gt;series&lt;/em&gt;. Organize the structure like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;single&lt;/li&gt;&#xA;&lt;li&gt;single&lt;/li&gt;&#xA;&lt;li&gt;series&#xA;&lt;ul&gt;&#xA;&lt;li&gt;single&lt;/li&gt;&#xA;&lt;li&gt;single&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then to loop over the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for dataByte in craft.entries.section('dataByte').level(1) %}&#xA;  {% switch dataByte.type %}&#xA;  {% case 'single' %}&#xA;      {# TEMPLATE CODE FOR STAND ALONE ENTRY HERE #}&#xA;      single: {{dataByte.title}}&amp;lt;br/&amp;gt;&#xA;  {% case 'series' %}&#xA;    {% set firstInSeries = dataByte.getChildren().first() %}&#xA;    {% if firstInSeries %}&#xA;      {# TEMPLATE CODE FOR FIRST ENTRY IN SERIES HERE #}&#xA;      seriesFirst: {{firstInSeries.title}}&amp;lt;br/&amp;gt;&#xA;    {% endif %}&#xA;  {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-06T22:18:24.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="779" PostTypeId="2" ParentId="724" CreationDate="2014-07-07T09:18:20.590" Score="3" Body="&lt;p&gt;Traced the error back to the &lt;code&gt;from&lt;/code&gt; function in Yii's &lt;code&gt;craft/app/framework/db/CDbCommand.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tables=preg_split('/\s*,\s*/u',trim($tables),-1,PREG_SPLIT_NO_EMPTY);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://www.php.net/manual/en/function.preg-split.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;preg_split&lt;/code&gt; documentation&lt;/a&gt; states &quot;if matching fails, an array with a single element containing the input string will be returned&quot; but I was just getting an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This made me suspicious of what the &lt;code&gt;PREG_SPLIT_NO_EMPTY&lt;/code&gt; flag was hiding, sure enough without it I got an array with one empty string in it, as if there was a match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some trial and error later and adding the &lt;a href=&quot;http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;PCRE_UTF8&lt;/code&gt; modifier&lt;/a&gt; &lt;code&gt;u&lt;/code&gt; to the &lt;code&gt;preg_split&lt;/code&gt; patterns seemed to solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately can't explain what's causing the encoding issues yet.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2014-07-07T09:18:20.590" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="780" PostTypeId="1" AcceptedAnswerId="876" CreationDate="2014-07-07T11:14:12.337" Score="5" ViewCount="3033" Body="&lt;p&gt;I'm trying to get a basic locals sub directory system working on Nginx:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/entry - en local.&#xA;/fr/entry - french translation.&#xA;/it/entry ect..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/425/how-do-i-get-the-right-entry-data-based-on-locale-and-slug?rq=1&quot;&gt;this knowledge base article&lt;/a&gt; and some other forum posts I'm still having difficulties with 404 errors when following them or duplicate '/fr/fr'/entry issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to use duplicate index.php files with locals declared in them if I'm adding url paths in the section admin pages? What about site baseUrls in the config file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation seems very conflicting in these cases and having tried nearly every possible configuration option my site still won't serve up different locals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had the most luck with this nginx config, together with specifying the local in the section urls in the cms for each section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen 80;&#xA;    server_name site.com;&#xA;    root /sites/site/public;&#xA;    index index.php;&#xA;    client_max_body_size 30M;&#xA;    location /en/ {&#xA;            root /sites/site/public;&#xA;            if (!-e $request_filename) {&#xA;                    rewrite ^/(.*)$ /index.php?q=$1 last;&#xA;            }&#xA;    }&#xA;    location /ru/ {&#xA;            root /sites/site/public/ru;&#xA;            if (!-e $request_filename) {&#xA;                    rewrite ^/(.*)$ /ru/index.php?q=$1 last;&#xA;            }&#xA;    }&#xA;    location /zh/ {&#xA;            root /sites/site/public/zh;&#xA;            if (!-e $request_filename) {&#xA;                    rewrite ^/(.*)$ /zh/index.php?q=$1 last;&#xA;            }&#xA;    }&#xA;    location / {&#xA;            root /sites/site/public;&#xA;            if (!-e $request_filename) {&#xA;                    rewrite ^/(.*)$ /index.php?q=$1 last;&#xA;            }&#xA;    }&#xA;    location ~ \.php$ {&#xA;            try_files $uri =404;&#xA;            fastcgi_split_path_info ^(.+\.php)(.*)$;&#xA;            fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;            fastcgi_index  index.php;&#xA;            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;&#xA;            include fastcgi_params;&#xA;            fastcgi_ignore_client_abort on;&#xA;            fastcgi_param  SERVER_NAME $http_host;&#xA;    }&#xA;&#xA;    location ~ /\.ht {&#xA;            deny  all;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(each index.php has its own set local var within it like so for fr):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the local site&#xA;define('CRAFT_LOCALE', 'fr');&#xA;&#xA;// Do not edit below this line&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My General config is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; */&#xA;&#xA;return array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://www.site.com/',&#xA;        'ar' =&amp;gt; 'http://www.site.com/ar/',&#xA;        'es' =&amp;gt; 'http://www.site.com/es/',&#xA;        'fr' =&amp;gt; 'http://www.site.com/fr/',&#xA;        'hu' =&amp;gt; 'http://www.site.com/hu/',&#xA;        'it' =&amp;gt; 'http://www.site.com/it/',&#xA;        'ru' =&amp;gt; 'http://www.site.com/ru/',&#xA;        'zh' =&amp;gt; 'http://www.site.com/zh/',&#xA;    ),&#xA;    'maxUploadFileSize' =&amp;gt; 2147483647,&#xA;&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in the server displaying the correct links to my localised articles in the menu and the en language serves up entries correctly, however other languages are found at /local/local/entitypath not local/entitypath.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding site_urls to my config seems to break things more, causing locals to not be served up at all.&lt;/p&gt;&#xA;" OwnerUserId="469" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-10T00:20:22.033" Title="Locales sub directories on Nginx" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="781" PostTypeId="1" AcceptedAnswerId="848" CreationDate="2014-07-07T11:44:08.860" Score="2" ViewCount="1493" Body="&lt;p&gt;I have read through the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt; and I am not sure if what I need to do is possible with array sets. I have filtered my entries using the following code&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allDatabytes = craft.entries.section('databytes').limit(null) %}&#xA;{% set seriesCollection = [] %}&#xA;&#xA;{% for databyte in allDatabytes %}&#xA;&#xA;  {# get only the series databytes #}&#xA;  {% set series = databyte.series %}&#xA;&#xA;  {# add the series databytes to the series collection #}&#xA;  {% for entry in series %}&#xA;    {% set seriesCollection = seriesCollection|merge([entry.title]) %}&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Output the filtered results #}&#xA;&#xA;{% set filteredDatabytes = allDatabytes|without(seriesCollection) %}&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for entry in filteredDatabytes %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I now need to do is add pagination to the &lt;code&gt;filteredDatabytes&lt;/code&gt; set of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;From The Example Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code which currently doesn't display any results. I guess you add the limit to the &lt;code&gt;MyCriteria&lt;/code&gt; model (is that the correct term)?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set MyCriteria = craft.entries.section('databytes').series(':empty:').limit(10) %}&#xA;&#xA;{% paginate MyCriteria as entries %}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-07-07T16:11:06.260" LastActivityDate="2014-07-08T22:45:38.210" Title="Paginate An Array Of Entries" Tags="&lt;pagination&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="782" PostTypeId="2" ParentId="781" CreationDate="2014-07-07T13:11:44.463" Score="1" Body="&lt;p&gt;This won't work with your example, because the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;pagination-tag&lt;/a&gt; only accepts an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, not an array of already fetched entries:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% paginate MyCriteria as PageSubset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See also: &lt;a href=&quot;https://craftcms.stackexchange.com/q/265/177&quot;&gt;What are the differences between an elementCriteriaModel and fetched elements?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If I understand your code correctly, you want to get all entries which have an empty &lt;code&gt;series&lt;/code&gt;-field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you don't have to fetch all entries and check against it, you can just add this to the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}&#xA;&#xA;{% paginate MyCriteria as entries %}&#xA;....&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why does the pagination tag need a CriteriaModel?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;treat your CriteriaModel as an array or append .first()&lt;/a&gt; it will fetch those entries and replace the results with the CriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;pagination-tag&lt;/a&gt; needs a CriteriaModel (or &quot;query&quot;) because it adds an offset (to the &quot;query&quot;) depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-07T15:49:52.783" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="783" PostTypeId="1" AcceptedAnswerId="784" CreationDate="2014-07-07T13:58:59.850" Score="2" ViewCount="166" Body="&lt;p&gt;I'm outputting a timeline for company history and i'd like to add a graphic for the Year before the first entry of each year. My current code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set companyHistory = craft.entries.section('about').slug('company-history').first() %}&#xA;&#xA;{% for moment in companyHistory.children.type('history') %}&#xA;    &amp;lt;li&amp;gt;{{ moment.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My date field is simply called 'date'. How might I go about this with the fewest possible DB queries?&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="57" LastEditDate="2014-07-07T15:24:03.883" LastActivityDate="2014-07-08T22:03:14.733" Title="Do something if first entry of a year" Tags="&lt;entries&gt;&lt;date&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="784" PostTypeId="2" ParentId="783" CreationDate="2014-07-07T14:22:31.187" Score="3" Body="&lt;p&gt;I got it using the 'group' filter at : &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/filters#group&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to Steve Abraham for pointing me in the right direction. My code that seems to work is:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set companyHistory = craft.entries.section('about').slug('company-history').first() %}&#xA;{% set allEntriesByYear = companyHistory.children.type('history') | group('date.year') %}&#xA;&#xA;{% for year, entriesInYear in allEntriesByYear %}&#xA;    &amp;lt;h2&amp;gt;{{ year }}&amp;lt;/h2&amp;gt;&#xA;    {% for moment in entriesInYear %}&#xA;        &amp;lt;li&amp;gt;{{ moment.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if there is an even better solution. &lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="250" LastEditDate="2014-07-08T22:03:14.733" LastActivityDate="2014-07-08T22:03:14.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="785" PostTypeId="2" ParentId="735" CreationDate="2014-07-07T14:24:47.657" Score="8" Body="&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag will detect if there are any ungenerated image transforms within it. If there are, it will hold off on caching the template until the next request, so that the temporary image URL won’t get cached.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-07T14:24:47.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="786" PostTypeId="1" AcceptedAnswerId="787" CreationDate="2014-07-07T15:36:54.823" Score="4" ViewCount="1459" Body="&lt;p&gt;I'm unable to upload the favicon.ico thought Craft because it says:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Upload failed for favicon.ico. The error message was: ”Error uploading the file: This file type is not allowed“&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why does that restriction exists? I just couldn't find a list of forbidden files.&lt;/li&gt;&#xA;&lt;li&gt;Can I change that restriction?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know I can use a FTP client to put the file in the folder, but since I'm doing this site for a friend I just wanted to leave her an easy way of managing the icon.&lt;/p&gt;&#xA;" OwnerUserId="456" LastActivityDate="2014-07-07T15:49:31.330" Title="Why I can't upload a favicon.ico as an Asset?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="787" PostTypeId="2" ParentId="786" CreationDate="2014-07-07T15:49:31.330" Score="7" Body="&lt;p&gt;1) It's not allowed because it's currently not in the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot;&gt;allowedFileExtensions&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Just add 'ico' to the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#extraAllowedFileExtensions&quot;&gt;extraAllowedFileExtensions&lt;/a&gt; config setting and you'll be able to upload .ico file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-07T15:49:31.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="788" PostTypeId="1" AcceptedAnswerId="791" CreationDate="2014-07-07T19:00:35.673" Score="11" ViewCount="676" Body="&lt;p&gt;I am looking to control what asset directories are available from the image upload button in a rich text field. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, does anyone know the Redactor setting to set the default size of the editor? I can't seem to track it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2014-07-07T20:57:44.187" Title="Is there a way to limit the Asset upload directory in Redactor?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="789" PostTypeId="1" AcceptedAnswerId="1214" CreationDate="2014-07-07T19:33:44.447" Score="5" ViewCount="1941" Body="&lt;p&gt;I have a section where its entries have a matrix field (&lt;code&gt;matrixField&lt;/code&gt;). In the first matrix block there is a date field (&lt;code&gt;dateField&lt;/code&gt;). I want to get my entries ordered by that date field. Is this possible? Pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('dates').order(matrixField.first().dateField).limit(5) %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="133" LastEditorUserId="133" LastEditDate="2014-07-07T20:52:59.840" LastActivityDate="2020-03-31T15:20:24.750" Title="How to order by matrix field?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;datetime&gt;&lt;ordering&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="791" PostTypeId="2" ParentId="788" CreationDate="2014-07-07T20:43:32.357" Score="9" Body="&lt;p&gt;&lt;strong&gt;Is there a way to limit the Asset upload directory in Redactor?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No. You'll want to use a Matrix Field with an image block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, it's possible you could create a Redactor button that does this via a plugin, but it'd probably be a bit of work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone know the Redactor setting to set the default size of the editor?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting your looking for is &lt;code&gt;minHeight&lt;/code&gt;.  Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;    plugins: ['fullscreen', 'pagebreak'],&#xA;    minHeight: 200&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A longer discussion on custom Redactor toolbars and a few more examples can be found in this article: &lt;a href=&quot;http://straightupcraft.com/articles/custom-redactor-toolbars-for-the-rich-text-field-in-craft-cms&quot;&gt;Custom Redactor Toolbars for the Rich Text Field in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-07-07T20:57:44.187" LastActivityDate="2014-07-07T20:57:44.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="792" PostTypeId="2" ParentId="449" CreationDate="2014-07-07T21:35:28.417" Score="14" Body="&lt;p&gt;You can get the current template’s name like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ _self.getTemplateName() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-07T21:35:28.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="793" PostTypeId="1" AcceptedAnswerId="795" CreationDate="2014-07-07T22:30:48.877" Score="3" ViewCount="491" Body="&lt;p&gt;If I want to get a list of all fields that I've defined on the site, I can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;fields-&amp;gt;getAllFields()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I get a list of &lt;strong&gt;all sub-fields defined within a Matrix field?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have access to the &lt;code&gt;MatrixBlockModel&lt;/code&gt;, if that helps.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-07-07T23:22:40.993" LastActivityDate="2014-07-08T00:20:57.050" Title="How can I list all sub-field handles of a Matrix parent field?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="794" PostTypeId="2" ParentId="793" CreationDate="2014-07-07T23:29:12.960" Score="2" Body="&lt;p&gt;With a MatrixBlockModel you can get the MatrixBlockTypeModel like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixBlockTypeModel = $matrixBlockModel-&amp;gt;getType();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can get the FieldModel of all the fields associated with that type with the &lt;code&gt;getFields()&lt;/code&gt; method on the MatrixBlockTypeModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fields = $matrixBlockTypeModel-&amp;gt;getFields();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you needed the FieldLayoutFieldModel you could access them like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fields = $matrixBlockTypeModel-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE: This answer misses the question as the original question requested all fields from the parent Matrix field, which would require looping through all of the MatrixBlockTypeModels as Brandon describes above.  I've tried to update this answer to at least provide some related information instead of just being wrong or a duplicate of the one above!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-07-08T00:20:57.050" LastActivityDate="2014-07-08T00:20:57.050" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="795" PostTypeId="2" ParentId="793" CreationDate="2014-07-07T23:30:27.957" Score="5" Body="&#xA;&#xA;&lt;p&gt;You’ll need to start by figuring out the Matrix field’s ID. If you already have a MatrixBlockModel object as you say, you can get that via &lt;code&gt;$matrixBlock-&amp;gt;fieldId&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you know the Matrix field’s ID, you can get all its block types like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$blockTypes = craft()-&amp;gt;matrix-&amp;gt;getBlockTypesByFieldId($matrixFieldId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will give you an array of MatrixBlockTypeModel objects. From there you can loop through each of those and get their fields like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;foreach ($blockTypes as $blockType)&#xA;{&#xA;    $fields = $blockType-&amp;gt;getFields();&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-07T23:30:27.957" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="796" PostTypeId="1" CreationDate="2014-07-08T01:05:55.643" Score="-7" ViewCount="152" Body="&lt;p&gt;I'm building a large social media site. We've already coded user registration and  profiles using Code Igniter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Situation 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) We'd like to offer each user their own blog. We envision using a single template which they could customize with their own header image. Is it possible create new blogs using the API and bypass the Craft login process so the user goes straight to their dashboard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Do you think it would be possible to have posts 'repostable' by other users, so the post from one blog appears on another?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Situation 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) We are going to have channels of content such as games. Within those channels are hubs for individual games such as Grand Theft Auto. Each hub will have multiple section such as news (user submitted articles, videos, media), galleries, Q&amp;amp;A and forums. Each hub will not be owned by any particular user - they can only submit content to it. Is this something that could be powered by Craft, or better suited to Expression Engine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) We will also have main channel pages with articles submitted by paid users. Was planning on using Expression Engine for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any feedback would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="473" LastActivityDate="2014-07-08T12:51:58.540" Title="Would this be possible using Craft Pro?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2014-07-08T17:20:55.493" ContentLicense="CC BY-SA 3.0" />
  <row Id="797" PostTypeId="1" AcceptedAnswerId="798" CreationDate="2014-07-08T02:17:09.183" Score="4" ViewCount="646" Body="&lt;p&gt;When an entry is created with my plugin's field type, data is saved to a separate table with entries id for reference. I need to delete that data if the entry that is associated with the data is deleted.  How and where should I listen for entry delete event to execute a method to delete this separate data?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-07-08T04:40:21.480" Title="Where and how should you listen for entry delete in plugin?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="798" PostTypeId="2" ParentId="797" CreationDate="2014-07-08T02:54:55.100" Score="4" Body="&lt;p&gt;You can add something like this to your plugin's &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onDeleteEntry', function(Event $event) {&#xA;    // Do your custom logic here.&#xA;    // Note that you can access the entry that was just deleted via $event-&amp;gt;params['entry']&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, better yet, from your custom table, make sure the foreign key that you've created on your entryId column back to the entries table has a CASCADE DELETE setup on it so that when Craft deletes the entry, it will cascade down and delete it from your table as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-08T02:54:55.100" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="799" PostTypeId="2" ParentId="796" CreationDate="2014-07-08T04:23:46.850" Score="3" Body="&lt;p&gt;&lt;strong&gt;Yes, virtually anything is possible with Craft Pro.&lt;/strong&gt; If it's something another CMS can do, then there is a 99.9% chance that Craft can do it, and do it well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to prevent a jumbled mess of answers, please break your question up into its various components. Ask each question individually, and you will get much better responses. :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-08T04:23:46.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="800" PostTypeId="2" ParentId="797" CreationDate="2014-07-08T04:40:21.480" Score="1" Body="&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/798/45&quot;&gt;Brad's answer&lt;/a&gt; is totally correct.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the question was posed by the original asker, Brad provided an example of an event listener which would be triggered when an entry is deleted. He also mentions the CASCADE DELETE capabilities of a Record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, the absolute best way to achieve what you're doing is by &lt;strong&gt;properly setting up your Record.&lt;/strong&gt; In your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records#defining-relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;defineRelations&lt;/a&gt; method, you can create a proper relationship between your table and the main elements table...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_MyRecord extends BaseRecord&#xA;{&#xA;&#xA;    // ...&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;        );&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-08T04:40:21.480" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="802" PostTypeId="1" AcceptedAnswerId="838" CreationDate="2014-07-08T08:35:46.803" Score="1" ViewCount="182" Body="&lt;p&gt;Does anyone have any clue why my login page is missing styling. Seems like encoding trouble, but this has been perfectly fine before. I also checked the CSS, which has alot of scrambled content... check out the screenshots.﻿&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Front end:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8rLIz.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Weird CSS file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XFe3P.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="474" LastActivityDate="2014-07-08T19:03:51.590" Title="Login form missing styling" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="803" PostTypeId="2" ParentId="802" CreationDate="2014-07-08T08:47:33.030" Score="2" Body="&lt;p&gt;Have you tried clearing your cache?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Control Panel &gt; Settings &gt; Clear Caches&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looks like a template or something might have gotten screwed up. That's definitely a weird CSS file.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-08T08:47:33.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="804" PostTypeId="1" AcceptedAnswerId="2902" CreationDate="2014-07-08T08:59:32.193" Score="5" ViewCount="2073" Body="&lt;p&gt;For a member only area I would like to secure (private) assets:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The files should not be accessible when not logged in&lt;/li&gt;&#xA;&lt;li&gt;The file download URL should be randomly generated and should expire after some time &lt;em&gt;OR&lt;/em&gt; the files can be placed above the web root&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is for example &lt;a href=&quot;http://masugadesign.com/software/link-vault&quot; rel=&quot;nofollow&quot;&gt;Link Vault&lt;/a&gt; for ExpressionEngine which is able to achieve that.&lt;/p&gt;&#xA;" OwnerUserId="133" LastEditorUserId="133" LastEditDate="2014-07-08T12:19:19.107" LastActivityDate="2017-11-15T14:58:51.390" Title="Is it possible to have secure (private) assets?" Tags="&lt;assets&gt;&lt;security&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="805" PostTypeId="2" ParentId="644" CreationDate="2014-07-08T09:20:57.847" Score="15" Body="&lt;p&gt;&lt;code&gt;{{ paginate.nextUrl }}?q={{ query }}&lt;/code&gt; did the trick with this setup.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2014-12-08T14:35:27.760" LastActivityDate="2014-12-08T14:35:27.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="806" PostTypeId="1" AcceptedAnswerId="832" CreationDate="2014-07-08T09:52:05.297" Score="5" ViewCount="772" Body="&lt;p&gt;I have a directory structure in place that I'd like to mimic in Craft. File uploads are first categorised by Year, then by month so the directory sturcture is like such&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-- 2014&#xA;---- 01&#xA;---- 02&#xA;---- 03&#xA;---- 04&#xA;---- 05&#xA;---- 06&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried this but it still only uploads to the root folder I setup in sources&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/uploads/{postDate.format('Y')}/{postDate.format('M')}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I using the wrong syntax? Do I need to use now | date ('Y') instead?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-07-08T17:19:17.007" Title="How can I set my upload path by date?" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="807" PostTypeId="1" AcceptedAnswerId="834" CreationDate="2014-07-08T10:33:15.247" Score="1" ViewCount="416" Body="&lt;p&gt;I get this error when trying to change a database name on a new dev with no entries:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/E9Oik.png&quot; alt=&quot;phpmyadmin change db name error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can be done?&lt;/p&gt;&#xA;" OwnerUserId="106" LastEditorUserId="45" LastEditDate="2014-07-08T21:06:32.323" LastActivityDate="2014-07-08T21:06:32.323" Title="Error when trying to change the database name" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="808" PostTypeId="1" AcceptedAnswerId="821" CreationDate="2014-07-08T10:48:22.587" Score="4" ViewCount="285" Body="&lt;p&gt;I'm trying to work out how I can order news posts by postDate, unless a lightswitch is toggled for a post, at which point it will use the dateUpdated to order that item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is so a client can still change posts without them appearing at the top of the list (for corrections, etc), but also make substantial updates to certain posts and have them appear as the latest newest item.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-01-24T00:32:34.453" Title="No ordinary news post ordering" Tags="&lt;entries&gt;&lt;ordering&gt;&lt;postdate&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="809" PostTypeId="2" ParentId="752" CreationDate="2014-07-08T11:08:23.250" Score="1" Body="&lt;p&gt;The problem as I see it is that the call is happening on the front-end. Because of this, the template renderer is not looking for the template at &lt;code&gt;plugin1/templates/_field/input&lt;/code&gt; as it normally would, but at &lt;code&gt;plugin1/_field/input&lt;/code&gt;, which explains the error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Plugin 1 is your own plugin then you should be able to include the &lt;code&gt;templates&lt;/code&gt; part of the path in the render call, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;templates-&amp;gt;render('templates/_field/input');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't tested this but I think it should work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, and I would recommend this, since this is a front-end call, you could create your own function &lt;code&gt;getFrontEndInputHtml()&lt;/code&gt; to return the html appropriately.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2014-07-08T11:25:30.407" LastActivityDate="2014-07-08T11:25:30.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="810" PostTypeId="2" ParentId="804" CreationDate="2014-07-08T11:25:49.970" Score="3" Body="&lt;p&gt;There is a plugin from &lt;a href=&quot;https://bitbucket.org/jkenters/craft-memberassets/&quot; rel=&quot;nofollow&quot;&gt;Jeroen Kenters called Member Assets&lt;/a&gt; which denies access when logged out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really need a random url, you could extend his plugin.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-08T11:25:49.970" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="811" PostTypeId="1" AcceptedAnswerId="813" CreationDate="2014-07-08T11:31:31.187" Score="4" ViewCount="982" Body="&lt;p&gt;I'm looking to be able to return the info from a field(s) from a Matrix row where I know which row I want (long story). I had a guess at various ways of doing this, but in the end the only way that worked was to run the loop with an if statement to limit the output to a given row's id, e.g:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.bodyRepeater %}&#xA;    {% if loop.index==2 %}&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Guessing there might be a better way though?&lt;/p&gt;&#xA;" OwnerUserId="470" LastActivityDate="2016-04-19T08:41:53.757" Title="Return specific Matrix row?" Tags="&lt;matrix&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="812" PostTypeId="1" AcceptedAnswerId="819" CreationDate="2014-07-08T11:46:49.897" Score="17" ViewCount="25136" Body="&lt;p&gt;Hopefully this is a simple question but I couldn't find a clear answer anywhere - I just want to be able to pull in data from a specific entry, where I know the identifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular case, the entry is a single. Currently I'm doing this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('myChosenSection').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this correct, or is there a more concise way?&lt;/p&gt;&#xA;" OwnerUserId="470" LastEditorUserId="177" LastEditDate="2014-07-08T12:55:21.020" LastActivityDate="2020-07-15T22:14:24.797" Title="How to return a specific entry?" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="813" PostTypeId="2" ParentId="811" CreationDate="2014-07-08T12:00:39.957" Score="4" Body="&lt;p&gt;This works but using this code can be a problem if you are dealing with a huge number of rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To access the n-th row, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.blockRepeater.findElementAtOffset(n-1).heading }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found this method in the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; class. You can test if a certain row exists using &lt;code&gt;entry.blockRepeater.offsetExists(n)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="304" LastActivityDate="2014-07-08T12:00:39.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="814" PostTypeId="2" ParentId="808" CreationDate="2014-07-08T12:05:31.110" Score="3" Body="&lt;p&gt;I think I'd create a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#functions&quot; rel=&quot;nofollow&quot;&gt;twig function&lt;/a&gt; or filter to create a custom sort (&lt;a href=&quot;http://www.php.net/manual/en/function.usort.php&quot; rel=&quot;nofollow&quot;&gt;usort&lt;/a&gt; in php), pass the collection to the function so it's returned 'sorted'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be interested in seeing if anyone has a nice craft.entries query straight off the bat for this though.&lt;/p&gt;&#xA;" OwnerUserId="365" LastEditorUserId="365" LastEditDate="2014-07-08T12:30:17.740" LastActivityDate="2014-07-08T12:30:17.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="815" PostTypeId="2" ParentId="808" CreationDate="2014-07-08T12:31:19.293" Score="4" Body="&lt;p&gt;I don't know if it's possible (but would like to see a query solution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is one problem with your setup: If an entry gets a &quot;substantial update&quot;, you can't make a correction afterwards, since it would become the latest item again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I propose you write a plugin which would:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wait for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;'onBeforeSaveEntry' event&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Check if the &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;Lightswitch-field&lt;/a&gt; is &quot;on&quot;&lt;/li&gt;&#xA;&lt;li&gt;If true, set &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#postDate&quot; rel=&quot;nofollow&quot;&gt;postDate&lt;/a&gt; to the current date&lt;/li&gt;&#xA;&lt;li&gt;Set the Lightswitch-field to &quot;off&quot; again&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quick-and-Dirty example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    //Event: onBeforeSaveEntry&#xA;    craft()-&amp;gt;entries-&amp;gt;onBeforeSaveEntry = function(Event $event) {&#xA;&#xA;        //Check if its the right section&#xA;        if ( $event-&amp;gt;entry-&amp;gt;section == 'news' ) {&#xA;&#xA;            //Check if the lightswitch-field is &quot;on&quot;&#xA;            if ( $event-&amp;gt;entry-&amp;gt;lightswitch_field_handle == 1 ) {&#xA;                //Set postDate to current date&#xA;                $event-&amp;gt;entry-&amp;gt;postDate = $event-&amp;gt;entry-&amp;gt;dateUpdated;&#xA;&#xA;                //Set Lightswitch-filed to &quot;off&quot;&#xA;                $event-&amp;gt;entry-&amp;gt;lightswitch_field_handle = 0;&#xA;            }&#xA;&#xA;        }&#xA;&#xA;        //Return&#xA;        return $event;&#xA;&#xA;    };&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you add this function to your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;nofollow&quot;&gt;primary plugin class&lt;/a&gt; and sort your entries by &lt;code&gt;postDate&lt;/code&gt; it should work just like you want.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-08T13:51:13.797" LastActivityDate="2014-07-08T13:51:13.797" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="816" PostTypeId="1" AcceptedAnswerId="818" CreationDate="2014-07-08T12:42:37.080" Score="3" ViewCount="724" Body="&lt;p&gt;Is there a way to have multiple entry templates per entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to create two different templates that display the same content/data in different ways.&lt;/p&gt;&#xA;" OwnerUserId="218" LastEditorUserId="218" LastEditDate="2014-07-08T13:20:36.310" LastActivityDate="2014-07-08T13:20:36.310" Title="Multiple entry templates per entry" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="818" PostTypeId="2" ParentId="816" CreationDate="2014-07-08T12:53:40.223" Score="4" Body="&lt;p&gt;If they can live at different URL's, you could setup multiple routes under Settings-&gt;Routes. Give them different URL structures like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;blog/slug loads mytemplatefolder/blog_template&#xA;another-url/slug loads mytemplatefolder/another_template&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="66" LastActivityDate="2014-07-08T12:53:40.223" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="819" PostTypeId="2" ParentId="812" CreationDate="2014-07-08T12:54:16.593" Score="34" Body="&lt;p&gt;This is the correct way.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Singles:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.section('section_handle').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;Channels / Structures:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.section('section_handle').slug('my_slug').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;General:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.id(5).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt; for a list of all properties.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2020-07-15T22:14:24.797" LastActivityDate="2020-07-15T22:14:24.797" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="820" PostTypeId="1" AcceptedAnswerId="822" CreationDate="2014-07-08T14:33:47.993" Score="2" ViewCount="1821" Body="&lt;p&gt;This might be a very simple question but I am pretty new to Craft with a EE background. Basically, I have a global containing contact details that use a matrix field, I’m literally just looking for the syntax to loop through the matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried similar code to the successful matrix fields I have in other areas, but how do I reference the particular global? This is what I’ve attempted with no success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in contactDetails %}&#xA;    {{ block.location }}&#xA;    {{ block.address }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;contactDetails&lt;/code&gt; being the name of the global. I’m sure this is very simple I just can’t figure it out.&lt;/p&gt;&#xA;" OwnerUserId="478" LastEditorUserId="250" LastEditDate="2014-07-08T22:06:49.047" LastActivityDate="2014-07-08T22:06:49.047" Title="Looping through a Global with a Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="821" PostTypeId="2" ParentId="808" CreationDate="2014-07-08T14:45:21.063" Score="8" Body="&lt;p&gt;You can do this entirely from the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot;&gt;&lt;code&gt;order&lt;/code&gt;&lt;/a&gt; param using MySQL’s &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/case.html&quot;&gt;&lt;code&gt;CASE&lt;/code&gt;&lt;/a&gt; syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsItems = craft.entries({&#xA;    section: 'news',&#xA;    order:   '(CASE field_myLightswitchField&#xA;                  WHEN 1 THEN elements.dateUpdated&#xA;                  ELSE elements.dateCreated&#xA;              END) DESC'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you’ll need to include that “field_” prefix before your Lightswitch field’s handle since this is a more complex condition and Craft won’t be sure if it should add that automatically.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-08T14:45:21.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="822" PostTypeId="2" ParentId="820" CreationDate="2014-07-08T14:48:52.257" Score="6" Body="&lt;pre&gt;&lt;code&gt;{% for block in contactDetails.myMatrixField %}&#xA;     {{ block.location }}&#xA;     {{ block.address }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="66" LastActivityDate="2014-07-08T14:48:52.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="823" PostTypeId="2" ParentId="740" CreationDate="2014-07-08T15:00:46.523" Score="10" Body="&lt;p&gt;If you just want to re-save a large number of entries &lt;strong&gt;without modifying them&lt;/strong&gt;, you can run a ResaveElements task, which takes some basic parameters and re-saves all the entries that match them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do that like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Queue up a new ResaveElements task&#xA;craft()-&amp;gt;tasks-&amp;gt;createTask('ResaveElements', null, array(&#xA;    'elementType' =&amp;gt; ElementType::Entry,&#xA;    'criteria'    =&amp;gt; array('section' =&amp;gt; 'mySectionHandle', 'limit' =&amp;gt; null, 'status' =&amp;gt; null, 'localeEnabled' =&amp;gt; null)&#xA;));&#xA;&#xA;// Start running tasks&#xA;craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-10T18:27:34.313" LastActivityDate="2014-07-10T18:27:34.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="824" PostTypeId="1" AcceptedAnswerId="842" CreationDate="2014-07-08T15:06:01.100" Score="29" ViewCount="18495" Body="&lt;p&gt;How do I check if a field is blank? I thought it was something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if article.articleImage is defined %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which in this case is testing an Assets field (and seems to work). Tried the same for a text field (in a Matrix row), and that doesn't work, as far as I can tell:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ if block.heading is defined }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="470" LastEditorUserId="22" LastEditDate="2014-07-09T17:05:26.333" LastActivityDate="2017-08-01T04:56:22.320" Title="Test for empty field?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="27" ContentLicense="CC BY-SA 3.0" />
  <row Id="825" PostTypeId="2" ParentId="740" CreationDate="2014-07-08T15:18:26.183" Score="3" Body="&lt;p&gt;It's likely because PHP's per-process memory limit is set too low for this particular script. I would not raise it globally using your php.ini file, but raise it right in your script on a per-process basis, right inside of your template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put together a quick plugin to do this (and set other ini_set parameters):&#xA;&lt;a href=&quot;https://github.com/jpeacock/setini/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/jpeacock/setini/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="66" LastEditorUserId="66" LastEditDate="2014-07-08T16:47:50.743" LastActivityDate="2014-07-08T16:47:50.743" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="826" PostTypeId="2" ParentId="824" CreationDate="2014-07-08T15:19:51.127" Score="12" Body="&lt;p&gt;If you have a peek through the &lt;a href=&quot;http://twig.sensiolabs.org/documentation&quot;&gt;Twig documentation&lt;/a&gt;, you'll come across the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/empty.html&quot;&gt;&lt;code&gt;empty&lt;/code&gt;&lt;/a&gt; test.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.heading is empty %}&#xA;    {# ... #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-07-08T15:19:51.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="827" PostTypeId="1" AcceptedAnswerId="831" CreationDate="2014-07-08T15:55:21.287" Score="13" ViewCount="6374" Body="&lt;p&gt;I'm trying to get Craft to render an image transform defined in the control panel. No image is added to the &quot;filelocation/_transformhandle&quot; folder and returns the url &quot;/cpresources/transforms/98&quot; where 98 is the transform index. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried clearing the cache and db table already as well as updating the asset index. I have double checked the sources paths and it is not a file permission issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code example as a matrix block: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;slideShow&quot; %} &#xA;{% if block.galleryImages|length&amp;gt;0 %}&#xA;&#xA;{% for image in block.galleryImages %}&#xA;    {{ image.aboutText }}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl('galleryHorizontal') }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried using the other methods on this page in the docs with the same result. &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot;&gt;http://buildwithcraft.com/docs/templating/assetfilemodel&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="479" LastActivityDate="2019-08-31T16:17:32.607" Title="Image transforms returning cpresources url" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;image-transforms&gt;&lt;url&gt;&lt;gallery&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="828" PostTypeId="1" AcceptedAnswerId="839" CreationDate="2014-07-08T15:59:30.273" Score="4" ViewCount="2066" Body="&lt;p&gt;It doesn't appear that tags are handled the same way as categories in the sense that categories have a slug (which results to a URI). I'd like to use tags to link to a &quot;tag&quot; page, similar to a category page, but &quot;Really Cool Tag Name&quot; doesn't work/look right as part of a URL. I've used the Slugify plugin to turn the tag in to a slug, however, I'm not sure the best approach to return the relationship of that tag as that slug is not related to the tag at all. Would the best practice be to add an additional slug field to the tag group? Then I'd be able to make that relationship. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-09T02:27:43.523" Title="Looking to use a tag slug/URI and loop through entries of that tag" Tags="&lt;entries&gt;&lt;tags&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="829" PostTypeId="2" ParentId="828" CreationDate="2014-07-08T16:11:26.913" Score="1" Body="&lt;p&gt;Not sure if this is the best way to go, but thus far I've used a custom route (in Settings-&gt;Routes) to setup tag listing/landing pages. Something like tags/* so the wildcard catches the tag slug. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagId = &quot;&quot; %} {# set the initial tagID variable outside of your loop to access it later in the template #}&#xA;&#xA;{% if craft.request.getSegment(1) == &quot;tags&quot; %} {# if you're on the tag listing template #}&#xA;    {% set tags = craft.tags.find() %} {# get all tags in the system #}&#xA;    {% for tag in tags %}&#xA;        {% set tagUrl = tag.name|lower|replace({' ': '-'}) %} {# do the same string manipulation that you did to create the slug that links to this page #}&#xA;        {% if (tagUrl == craft.request.getSegment(2)) %} {# grab the tag that matches your URL #}&#xA;            {% set tagId = tag.id %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, grab entries that are related to this tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.id(tagId) %}&#xA;{% set entries = craft.entries.section('blog').relatedTo(tag).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="66" LastActivityDate="2014-07-08T16:11:26.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="830" PostTypeId="2" ParentId="828" CreationDate="2014-07-08T16:28:18.977" Score="2" Body="&lt;p&gt;I setup a route, in my case &quot;news/tag/[tag]&quot; with a template &lt;strong&gt;news/_tag&lt;/strong&gt;. Then in the template I find the tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set actualTag = craft.tags.name(tag).first() %}&#xA;{% if not actualTag %}{% exit 404 %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and get the entries related to the tag (could additionally restrict this by section):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relevantEntries = craft.entries&#xA;  .relatedTo({&#xA;    targetElement: actualTag,&#xA;    field: 'tags'&#xA;  })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[edited to add:]&#xA;To get the list of tags with links to the tag pages (twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/url_encode.html&quot; rel=&quot;nofollow&quot;&gt;url_encode&lt;/a&gt; to translate tag name to url):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.relatedTo({&#xA;    sourceElement: entries,&#xA;    field: 'tags'&#xA;  }).order('name')&#xA;%}&#xA;  {% set tagUrl = '/news/tag/'~(tag.name|url_encode) %}&#xA;  &amp;lt;a href=&quot;{{tagUrl}}&quot;&amp;gt;{{tag.name}}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-07-08T17:59:29.937" LastActivityDate="2014-07-08T17:59:29.937" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="831" PostTypeId="2" ParentId="827" CreationDate="2014-07-08T16:32:45.787" Score="21" Body="&lt;p&gt;That’s what &lt;code&gt;getUrl()&lt;/code&gt; returns if the transform hasn’t been generated yet. When the browser requests that URL, Craft will generate the transform, and respond with a 302 redirect to the actual image URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Update:&lt;/strong&gt; As of Craft 2.2, even if the transform generation URL doesn’t get directly requested (e.g. if it’s a social media image, or a &lt;code&gt;srcset&lt;/code&gt; size that doesn’t apply to the browser), it will still get generated automatically as a background task as soon as Craft is done serving the page.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next time &lt;code&gt;getUrl()&lt;/code&gt; gets called (after the transform has been generated), the image URL will be returned directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would prefer that &lt;code&gt;getUrl()&lt;/code&gt; actually generates the transform itself and immediately returns the image URL (perhaps because the output is getting cached by Varnish or something), you can open up craft/config/general.php and add this to your config array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(See &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot;&gt;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&lt;/a&gt; for details.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-09T11:08:36.907" LastActivityDate="2014-10-09T11:08:36.907" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="832" PostTypeId="2" ParentId="806" CreationDate="2014-07-08T17:19:17.007" Score="3" Body="&lt;p&gt;First you create an asset source &lt;code&gt;uploads&lt;/code&gt;. Then you create an asset field and set its upload location subfolder to &lt;code&gt;{postDate|date('Y')}/{postDate|date('m')}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you edit an entry, any files you upload will go in the subfolder for the year and date. If you have selected &lt;strong&gt;Restrict uploads to a single folder?&lt;/strong&gt; in the asset field, then only assets in that subfolder can be used.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-08T17:19:17.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="834" PostTypeId="2" ParentId="807" CreationDate="2014-07-08T17:59:26.593" Score="2" Body="&lt;p&gt;Craft has a lot of &lt;strong&gt;foreign keys&lt;/strong&gt; between tables, so something might be getting tripped up there. Here's what I'd suggest...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using phpMyAdmin to &quot;Rename database to&quot;, perhaps try this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Export your existing DB to an SQL file.&lt;/li&gt;&#xA;&lt;li&gt;Create a new DB with the name you want.&lt;/li&gt;&#xA;&lt;li&gt;Import your SQL into the new DB.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Assuming that all goes smoothly, you can then go back and drop your original database.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-08T17:59:26.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="835" PostTypeId="2" ParentId="828" CreationDate="2014-07-08T18:45:48.197" Score="3" Body="&lt;p&gt;There is &lt;a href=&quot;http://buildwithcraft.com/help/tag-urls&quot; rel=&quot;nofollow&quot;&gt;a detailed help article dedicated to that&lt;/a&gt; in the help section of the Craft website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;create a route&lt;/li&gt;&#xA;&lt;li&gt;get all entries related to the tag&lt;/li&gt;&#xA;&lt;li&gt;use &lt;code&gt;{{ tag.name | url_encode }}&lt;/code&gt; to create the URL pointing to the tag page&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-07-08T18:45:48.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="836" PostTypeId="2" ParentId="824" CreationDate="2014-07-08T18:48:07.367" Score="7" Body="&lt;p&gt;Stuart's answer totally works. You can also use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot;&gt;&lt;code&gt;length&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if article.articleImage|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-08T18:48:07.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="837" PostTypeId="2" ParentId="807" CreationDate="2014-07-08T18:53:33.707" Score="3" Body="&lt;p&gt;MySQL doesn't have a native command for &quot;Rename database&quot; (well, they &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.1/en/rename-database.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;did at one point&lt;/a&gt;, but removed it shortly thereafter), so any MySQL client that offers that functionality ends up writing their own implementation for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is usually somethings as simple as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Export data and schema to a backup.&lt;/li&gt;&#xA;&lt;li&gt;Create new database with new name.&lt;/li&gt;&#xA;&lt;li&gt;Import data and schema from backup.&lt;/li&gt;&#xA;&lt;li&gt;Delete old database.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But it looks like phpMyAdmin is trying to be more clever than that and failing.  I would try &lt;a href=&quot;https://craftcms.stackexchange.com/a/834/57&quot;&gt;Lindsey's suggestion&lt;/a&gt; as a workaround.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the error, it looks like you've got a dash (-) in your database table name prefix.  That's considered a &quot;special&quot; character by MySQL and must be escaped in backticks `table-prefix.table-name`, which phpMyAdmin doesn't appear to be doing, so it's likely there is a phpMyAdmin bug there, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-08T19:29:58.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="838" PostTypeId="2" ParentId="802" CreationDate="2014-07-08T19:03:51.590" Score="4" Body="&lt;p&gt;For the garbled CSS, you need to disable &lt;code&gt;zlib.output_compression&lt;/code&gt; in your php.ini file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems to be a &lt;a href=&quot;https://bugs.php.net/bug.php?id=23488&quot; rel=&quot;nofollow&quot;&gt;PHP bug&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-08T19:03:51.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="839" PostTypeId="2" ParentId="828" CreationDate="2014-07-08T19:14:43.453" Score="6" Body="&lt;p&gt;Here's a really DRY way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setup a route, something like &quot;news/tags/(tag)&quot; to load the &quot;news/index&quot; template (the same one used for listing all entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &quot;news/index&quot; template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# If there is a tag token in the URL, set a filtered variable. #}&#xA;{% if tag is defined %}&#xA;&#xA;    &amp;lt;h2&amp;gt;Tag: {{ tag }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% set tag = craft.tags.name(tag).first() %}&#xA;&#xA;    {% set entriesToShow = craft.entries.section('news').relatedTo(tag) %}&#xA;&#xA;{% else %} {# No tag token in URL, assume unfiltered overview page. #}&#xA;&#xA;    {% set entriesToShow = craft.entries.section('news') %}&#xA;&#xA;{% endif %}&#xA;&#xA;{# the entry loop for both filtered and unfiltered entries #}&#xA;{% for entry in entriesToShow %} &#xA;    {# display entry #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When templating tag links to this system use:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ siteUrl }}news/tag/{{ tag.name|url_encode }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method allows you to reuse your entry loop and you don't even need a &quot;tags&quot; template. I can also be expanded to filter by categories as well without needing another template.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-07-09T02:27:43.523" LastActivityDate="2014-07-09T02:27:43.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="840" PostTypeId="1" CreationDate="2014-07-08T20:37:00.433" Score="3" ViewCount="3470" Body="&lt;p&gt;A forbidden error appears and can't get it to disappear. I've gone through the installation process several times and everything else works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I load the URL &quot;test.craft.dev&quot;, I get back &lt;code&gt;&quot;Forbidden: You don't have permission to access / on this server.&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things I've tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) db.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) folder structure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/..&#xA;/public/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="481" LastEditorUserId="57" LastEditDate="2014-07-08T20:51:45.230" LastActivityDate="2014-07-08T21:51:15.793" Title="Craft Installation - Getting a Forbidden Error" Tags="&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="841" PostTypeId="2" ParentId="840" CreationDate="2014-07-08T20:57:31.997" Score="2" Body="&lt;p&gt;I'm not quite sure I understand your folder structure, but as long as the &lt;code&gt;craft/&lt;/code&gt; folder is exactly one level above your &lt;code&gt;public/index.php&lt;/code&gt; file, then the &lt;code&gt;$craftPath&lt;/code&gt; setting you currently have will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific error message you are getting isn't coming from Craft... it's coming from Apache and will be related to how your server environment is currently setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some great threads &lt;a href=&quot;https://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/21551840/forbidden-you-dont-have-permission-to-access-on-this-server&quot;&gt;here&lt;/a&gt; that should get you going in the right direction on how to resolve it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-08T21:29:02.883" LastActivityDate="2014-07-08T21:29:02.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="842" PostTypeId="2" ParentId="824" CreationDate="2014-07-08T21:03:54.087" Score="51" Body="&lt;p&gt;The answer depends on the field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assets, Categories, Checkboxes, Dropdown, Entries, Matrix, Multi-select, Radio Buttons, Tags, and Users fields each will each appear to be non-empty, even if they don’t have a user-submitted value, because in each case, &lt;code&gt;entry.myFieldHandle&lt;/code&gt; will still return &lt;em&gt;something&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot;&gt;&lt;strong&gt;ElementCriteriaModel&lt;/strong&gt;&lt;/a&gt; object for Assets, Categories, Entries, Matrix, Tags, and Users fields&lt;/li&gt;&#xA;&lt;li&gt;a &lt;strong&gt;MultiOptionsFieldData&lt;/strong&gt; object for Checkboxes and Multi-select fields&lt;/li&gt;&#xA;&lt;li&gt;a &lt;strong&gt;SingleOptionFieldData&lt;/strong&gt; object for Dropdown and Radio Buttons fields&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So for each of those field types, you will need to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot;&gt;&lt;code&gt;|length&lt;/code&gt;&lt;/a&gt; filter to determine if there is an actual value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.myCheckboxesField|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also worth noting for Assets, Categories, Entries, Matrix, Tags, and Users fields: ElementCriteriaModel objects also have a &lt;code&gt;total()&lt;/code&gt; function which can be used to speed up your template if all you need to know is whether any elements were selected, and you won’t be actually looping through them further down in the template. &lt;em&gt;(&lt;code&gt;|length&lt;/code&gt; actually fetches the elements first, and then returns the count of the results, but stores those elements internally in case they are going to be looped through later on. &lt;code&gt;.total()&lt;/code&gt; runs a separate, much less expensive DB query, but the results won’t be cached internally for later use.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.myCategoriesField.total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Color, Date/Time, Lightswitch, Number, Plain Text, Rich Text, and Table fields will each return an empty value (&lt;code&gt;null&lt;/code&gt;, an empty string/array, etc.) when there is no value, so each of those field types are safe to use with the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/empty.html&quot;&gt;&lt;code&gt;is empty&lt;/code&gt;&lt;/a&gt; test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myTextField is empty %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would also work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.myTextField %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In all cases, the &lt;code&gt;|length&lt;/code&gt; filter will work as expected, so if you don’t want to remember this stuff, just use that.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-08T21:59:50.970" LastActivityDate="2014-07-08T21:59:50.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="843" PostTypeId="1" AcceptedAnswerId="844" CreationDate="2014-07-08T21:48:08.380" Score="4" ViewCount="844" Body="&lt;pre&gt;&lt;code&gt;{% if entry.fieldHandle %}&#xA;  {{ entry.fieldHandle}}&#xA;{% else %}&#xA;  {{ global.fieldHandle}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doesn't seem to be rendering for me. The entry field shows up when it's true, but the global field doesn't in the cases it needs to.&lt;/p&gt;&#xA;" OwnerUserId="24" LastEditorUserId="125" LastEditDate="2014-07-15T10:07:47.993" LastActivityDate="2014-07-15T10:07:47.993" Title="How to use a global variable in a conditional statement if an entries relation field is empty?" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;field&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="844" PostTypeId="2" ParentId="843" CreationDate="2014-07-08T21:48:08.380" Score="6" Body="&lt;p&gt;The reason it wasn't rendering is because my original entry field is an &lt;em&gt;Entries Field&lt;/em&gt; (see &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields#examples&quot; rel=&quot;nofollow&quot;&gt;templating examples&lt;/a&gt; in the docs). The relationship fieldtypes (Entries, Assets, Users) require that you include the &lt;code&gt;length&lt;/code&gt; filter in your conditional like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.fieldHandle |length  %}&#xA;  {{ entry.fieldHandle}}&#xA;{% else %}&#xA;  {{ global.fieldHandle}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to Keith Mancuso @keithmancuso for &lt;a href=&quot;https://gist.github.com/keithmancuso/cc2e933491bb9d7afcc3&quot; rel=&quot;nofollow&quot;&gt;the fix&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="24" LastEditorUserId="24" LastEditDate="2014-07-10T01:06:25.367" LastActivityDate="2014-07-10T01:06:25.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="845" PostTypeId="2" ParentId="840" CreationDate="2014-07-08T21:51:15.793" Score="3" Body="&lt;p&gt;When I get this error it is usually because the top craft directory isn't readable. When you unzip the original craft zip file, you get something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;drwx------@ 5 m  staff       170 Jul  8 14:47 Craft-2.1.2563&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that top directory (the one that contains craft and public) needs to be readable by apache.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-08T21:51:15.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="846" PostTypeId="2" ParentId="843" CreationDate="2014-07-08T22:27:47.937" Score="1" Body="&lt;p&gt;For a relationship field you should use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;length filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.fieldHandle|length  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or the more efficient &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;total function&lt;/a&gt; to get and check against the total number of elements that match the criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.fieldHandle.total  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A more detailed answer on how to test for empty fieldtypes is here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/842/9&quot;&gt;https://craftcms.stackexchange.com/a/842/9&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: this answer was edited based on clarification of the question as well as the comments below&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-07-10T10:43:47.230" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="847" PostTypeId="1" AcceptedAnswerId="849" CreationDate="2014-07-08T22:42:32.460" Score="1" ViewCount="421" Body="&lt;p&gt;I have two Services in my plugin. &lt;code&gt;MyPluginService&lt;/code&gt; is the &quot;main&quot; service, and &lt;code&gt;MyPlugin_OtherService&lt;/code&gt; accomplishes some other tasks (when it is occasionally needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an &lt;code&gt;init&lt;/code&gt; method in &lt;code&gt;MyPluginService&lt;/code&gt; which starts a chain of events, and under certain circumstances will call a method in &lt;code&gt;MyPlugin_OtherService&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;MyPluginService&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    parent::init();&#xA;    if (&quot;conditions are met&quot;) {&#xA;        craft()-&amp;gt;myPlugin_otherService-&amp;gt;methodInOtherService();&#xA;    }&#xA;}&#xA;&#xA;public function methodInMainService() {&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;MyPlugin_OtherService&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function methodInOtherService() {&#xA;    craft()-&amp;gt;myPlugin-&amp;gt;methodInMainService();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While the method in &lt;code&gt;MyPlugin_OtherService&lt;/code&gt; is being run, it will refer &lt;em&gt;back&lt;/em&gt; to a method in &lt;code&gt;MyPluginService&lt;/code&gt;. This is where the error is triggered:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Call to undefined method stdClass::methodInMainService()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand why it's not recognizing that call to the main service method. Hasn't the main service already been initialized before this point? There is a lot about &quot;lazy loading&quot; that I don't understand, maybe this falls in that knowledge gap.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="9" LastEditDate="2014-07-08T22:58:04.000" LastActivityDate="2014-07-08T23:07:42.833" Title="Error when calling methods between two services (triggered by init)" Tags="&lt;plugin-development&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="848" PostTypeId="2" ParentId="781" CreationDate="2014-07-08T22:45:38.210" Score="3" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/782/57&quot;&gt;Victor rightfully points out&lt;/a&gt;, the {% paginate %} tags require an ElementCriteriaModel, so you can't do what you're doing in your first example because as soon as you call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for databyte in allDatabytes %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft hits the database and converts the ElementCriteriaModel into actual EntryModels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also don't have support, yet, for passing &lt;code&gt;:empty:&lt;/code&gt; into things like AssetFields, TagFields, etc., which is why your second example won't work...  however that is on our list to add!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I think your best bet is going to be to do through the search service with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Search for 10 entries in the 'databytes' section where the 'series' assetField doesn't have anything selected. #}&#xA;{% set myCriteria = craft.entries.section('databytes').search('-series:*').limit(10) %}&#xA;&#xA;{% paginate myCriteria as entries %}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-08T22:45:38.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="849" PostTypeId="2" ParentId="847" CreationDate="2014-07-08T22:50:13.343" Score="2" Body="&lt;p&gt;Your service’s &lt;code&gt;init()&lt;/code&gt; function gets called immediately after it is loaded – and before Yii has had a chance to remember that &lt;code&gt;craft()-&amp;gt;myPlugin&lt;/code&gt; should return the service instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;https://github.com/yiisoft/yii/blob/master/framework/base/CModule.php#L393-L394&quot; rel=&quot;nofollow&quot;&gt;these two lines&lt;/a&gt; from CModule::getComponent() (the method that the magic getter invokes when you call &lt;code&gt;craft()-&amp;gt;somePluginName&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$component-&amp;gt;init();&#xA;return $this-&amp;gt;_components[$id]=$component;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So when &lt;code&gt;MyPlugin_OtherService::methodInOtherService()&lt;/code&gt; tries to refer back to &lt;code&gt;craft()-&amp;gt;myPlugin&lt;/code&gt;, &lt;code&gt;craft()-&amp;gt;myPlugin&lt;/code&gt; has not yet been assigned to the service instance, which results in the PHP fatal error you’re getting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can propose a change that would fix this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;_components[$id] = $component;&#xA;$component-&amp;gt;init();&#xA;return $component;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…but I’m not sure what the implications would be for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might just need to question whether it’s so important for this code to be running from &lt;code&gt;init()&lt;/code&gt; as opposed to another function that you’d have to invoke manually. Having it in &lt;code&gt;init()&lt;/code&gt; could lead to other unexpected consequences as well.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-08T23:07:42.833" LastActivityDate="2014-07-08T23:07:42.833" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="850" PostTypeId="1" AcceptedAnswerId="851" CreationDate="2014-07-08T23:18:01.800" Score="4" ViewCount="639" Body="&lt;p&gt;I have logged into the server and attempted to create a migration for my plugin.  However I get this output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exception 'CException' with message 'CHttpRequest is unable to determine the request URI.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The request is targeting &quot;/craft/app/framework/web/CHttpRequest.php:519&quot;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Stack trace:&#xA;#0 /craft/app/framework/web/CHttpRequest.php(431): CHttpRequest-&amp;gt;getRequestUri()&#xA;#1 /httpdocs/craft/app/services/HttpRequestService.php(816): CHttpRequest-&amp;gt;getPathInfo()&#xA;#2 /httpdocs/craft/app/services/HttpRequestService.php(43): Craft\HttpRequestService-&amp;gt;getNormalizedPath()&#xA;#3 /httpdocs/craft/app/framework/base/CModule.php(387): Craft\HttpRequestService-&amp;gt;init()&#xA;#4 /httpdocs/craft/app/framework/base/CModule.php(103): CModule-&amp;gt;getComponent('request')&#xA;#5 /httpdocs/craft/plugins/redactorclips/RedactorClipsPlugin.php(31): CModule-&amp;gt;__get('request')&#xA;#6 /httpdocs/craft/app/services/PluginsService.php(136): Craft\RedactorClipsPlugin-&amp;gt;init()&#xA;#7 /httpdocs/craft/app/etc/console/ConsoleApp.php(53): Craft\PluginsService-&amp;gt;loadPlugins()&#xA;#8 /httpdocs/craft/app/framework/base/CApplication.php(165): Craft\ConsoleApp-&amp;gt;init()&#xA;#9 /httpdocs/craft/app/framework/YiiBase.php(121): CApplication-&amp;gt;__construct('/var/www/vhosts...')&#xA;#10 /httpdocs/craft/app/etc/console/yiic.php(76): YiiBase::createApplication('Craft\ConsoleAp...', '/var/www/vhosts...')&#xA;#11 /httpdocs/craft/app/etc/console/yiic(4): require_once('/var/www/vhosts...')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2014-07-08T23:41:50.573" LastActivityDate="2014-07-08T23:57:33.333" Title="Why would I get a &quot;CHttpRequest is unable to determine the request URI&quot; when creating a migration?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="851" PostTypeId="2" ParentId="850" CreationDate="2014-07-08T23:57:33.333" Score="5" Body="&lt;p&gt;That's a bug in our RedactorClips plugin, actually.  Just fixed it, so if you grab the latest from here (&lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips&quot;&gt;https://github.com/pixelandtonic/RedactorClips&lt;/a&gt;), &lt;code&gt;yiic&lt;/code&gt; still should run fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-08T23:57:33.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="852" PostTypeId="1" AcceptedAnswerId="855" CreationDate="2014-07-09T01:49:49.840" Score="8" ViewCount="345" Body="&lt;p&gt;So I have successfully set up two locales on my site, with a button to switch between, this works fine for all the sections that have the langauges set, but I cannot seem to get it to work for the news index template, my news feed. An individual entry will work fine, but the collated entries don’t. Is there a snippet I need to place at the top of the News index template to define what locale it should contain?&lt;/p&gt;&#xA;" OwnerUserId="478" LastEditorUserId="125" LastEditDate="2014-07-14T23:50:20.613" LastActivityDate="2014-07-14T23:50:20.613" Title="Locale Switch not Affecting News Index Template" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="853" PostTypeId="1" AcceptedAnswerId="858" CreationDate="2014-07-09T11:35:17.853" Score="7" ViewCount="413" Body="&lt;p&gt;The in-app process of upgrading a Craft licence is smooth, but leaves no paper trail (&lt;s&gt;not even a confirmation email&lt;/s&gt;). &#xA;All I've found is a date of registration in the admin panel sidebar, without even stating the Craft licence type (client or pro).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there away to obtain a somewhat formal proof of purchase, like a receipt, that I can pass along to a client?&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="37" LastEditDate="2014-07-09T22:08:49.077" LastActivityDate="2014-07-09T22:08:49.077" Title="After upgrading Craft CMS, is there a receipt to print out?" Tags="&lt;upgrades&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="854" PostTypeId="2" ParentId="853" CreationDate="2014-07-09T12:16:45.757" Score="6" Body="&lt;p&gt;You should receive an email after purchasing a Craft license. Maybe double check your email details and/or your spam folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, if you email the guys at support@buildwithcraft.com they will sort out a receipt for you.&lt;/p&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-07-09T12:16:45.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="855" PostTypeId="2" ParentId="852" CreationDate="2014-07-09T12:27:33.750" Score="10" Body="&lt;p&gt;This Google+ thread may help: &lt;a href=&quot;https://plus.google.com/116942350387086245334/posts/TBtR3XwuZGx&quot;&gt;https://plus.google.com/116942350387086245334/posts/TBtR3XwuZGx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current options as per above thread:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a &lt;em&gt;Single&lt;/em&gt; for the News index template&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;em&gt;localized template&lt;/em&gt; as per &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview#template-localization&quot;&gt;http://buildwithcraft.com/docs/templating-overview#template-localization&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2014-07-09T12:54:40.180" LastActivityDate="2014-07-09T12:54:40.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="856" PostTypeId="1" AcceptedAnswerId="866" CreationDate="2014-07-09T13:24:07.860" Score="11" ViewCount="1946" Body="&lt;p&gt;For a url like &lt;code&gt;domain.com/example/123&lt;/code&gt; where &lt;code&gt;123&lt;/code&gt; is a Matrix Block ID (not an Entry ID), can I get the associated entry for given block ID in a template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, for a more general approach, what would be the best way to get that Matrix Block element and its Entry element when you only have a block ID?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; so ideally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set block = craft.matrixBlocks.id(craft.request.segment(2)).first() %}&#xA;{% set entry = block.getOwner() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which isn't possible now.&lt;/p&gt;&#xA;" OwnerUserId="127" LastEditorUserId="127" LastEditDate="2014-07-09T14:06:59.263" LastActivityDate="2014-07-09T17:44:26.193" Title="Can I get an entry by Matrix Block ID?" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="857" PostTypeId="2" ParentId="856" CreationDate="2014-07-09T13:48:32.443" Score="4" Body="&lt;p&gt;Perhaps just grab the URL segment and set it as a variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mID = craft.request.getSegment(2) %}&#xA;{% for entry in craft.entries.section('whatever') %}&#xA;   {% for block in entry.myMatrixField.id(mID) %}&#xA;     {{ block.someNestedFieldInsideOfMyMatrixField }}&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="66" LastActivityDate="2014-07-09T13:48:32.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="858" PostTypeId="2" ParentId="853" CreationDate="2014-07-09T15:23:39.360" Score="5" Body="&lt;p&gt;As of a few weeks ago we added a &quot;proper&quot; PDF invoice attached to the receipt email that works for most people's cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't currently capture anything like your company information during the checkout process, so if you need that on the invoice, or you placed your purchase before we started attaching the invoice, hit us up at support@buildwithcraft.com and we can regenerate the invoice for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-09T15:23:39.360" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="859" PostTypeId="1" AcceptedAnswerId="861" CreationDate="2014-07-09T15:34:23.627" Score="9" ViewCount="1892" Body="&lt;p&gt;I have a main layout file and extending it with another template. I have my markup and content in the &lt;code&gt;{% block content %}{% endblock %}&lt;/code&gt; however, I'd like to add content to another &quot;block&quot; on the individual entry page for meta data - that would require adding another &lt;code&gt;{% block content %}&lt;/code&gt; to my template as it would need to be output in a different area of the layout template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, is there a way to add a second block (perhaps name it differently) or is my best bet to set all that meta data as a variable and pass it that way?&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-07-09T16:54:51.757" LastActivityDate="2019-01-20T22:57:58.400" Title="How do I add an HTML block from template extension to main layout template? (i.e. meta data)" Tags="&lt;entries&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="860" PostTypeId="2" ParentId="859" CreationDate="2014-07-09T15:34:23.627" Score="5" Body="&lt;p&gt;In my example (&lt;code&gt;{% block content %}&lt;/code&gt;), the variable is &quot;content&quot; so you can create additional &lt;em&gt;blocks&lt;/em&gt; by naming the block something different and outputting it in your layout template - reference &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;Twig docs for more examples&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adding a new block &lt;code&gt;{% block meta %}&lt;/code&gt; I was able to output entry specific meta data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Child template: &lt;code&gt;group/template.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block meta %}&#xA;&amp;lt;meta property=&quot;og:title&quot; content=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;&amp;lt;meta property=&quot;og:site_name&quot; content=&quot;{{ siteName }}&quot;&amp;gt;&#xA;&amp;lt;meta property=&quot;og:type&quot; content=&quot;article&quot;&amp;gt;&#xA;&amp;lt;meta property=&quot;og:locale&quot; content=&quot;en_US&quot;&amp;gt; &#xA;&amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;&amp;lt;meta property=&quot;og:description&quot; content=&quot;{{ entry.body|hacksaw(chars=300) }}&quot;&amp;gt;&#xA;&amp;lt;meta property=&quot;article:published_time&quot; content=&quot;{{ entry.postDate|date('U') }}&quot;&amp;gt;   &#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Parent template: &lt;code&gt;_layout.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    {% block meta %}{% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    {% block content %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-07-09T21:53:21.110" LastActivityDate="2014-07-09T21:53:21.110" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="861" PostTypeId="2" ParentId="859" CreationDate="2014-07-09T16:12:39.847" Score="7" Body="&lt;h2&gt;Option A: Set individual properties in the child template&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you want to set specific meta properties instead of defining a block, you can include lines like this in &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if metaDescription is defined %}&amp;lt;meta property=&quot;description&quot; content=&quot;{{ metaDescription }}&quot;&amp;gt;{% endif %}&#xA;{% if metaKeywords is defined %}&amp;lt;meta property=&quot;keywords&quot; content=&quot;{{ metaKeywords }}&quot;&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can simply set either value from within the child template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set metaDescription = entry.summaryFieldOrWhatever %}&#xA;{% set metaKeywords = entry.tagField %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Option B: Pack an array with properties in the child template&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;...or as you pointed out, that could get cumbersome if you have a whole bunch of meta data. In that case, you could take a similar approach with an object instead of a block. So in &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if metaProperties is defined %}&#xA;     {% for prop in metaProperties %}&#xA;     &amp;lt;meta property=&quot;{{ prop.name }}&quot; content=&quot;{{ prop.value }}&quot;&amp;gt;&#xA;     {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the child template, then, you could...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set metaProperties = [&#xA;    { name: &quot;description&quot;, value: entry.summaryFieldorWhatever },&#xA;    { name: &quot;keywords&quot;, value: entry.tagField }&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way, you could set as many items as you'd like and still avoid passing markup to the parent template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT] Typo fix&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="-1" LastEditDate="2019-01-20T22:57:58.400" LastActivityDate="2019-01-20T22:57:58.400" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="862" PostTypeId="1" AcceptedAnswerId="864" CreationDate="2014-07-09T16:38:32.347" Score="9" ViewCount="12385" Body="&lt;p&gt;Is it possible to break out of a loop in twig? If it is, how would I do it?&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-10T12:00:31.030" LastActivityDate="2019-05-15T05:27:24.497" Title="Is it possible to break out of a loop in twig?" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="863" PostTypeId="2" ParentId="862" CreationDate="2014-07-09T16:38:32.347" Score="15" Body="&lt;p&gt;Currently there is no special build-in command to do it (unless you want to use a plugin, as &lt;a href=&quot;https://craftcms.stackexchange.com/a/864/250&quot;&gt;stated&lt;/a&gt; by Brandon Kelly). There is a workaround, however. The workaround is to check for additional condition.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set break = 0 %}&#xA;&#xA;{# this variable we will set to 1 when we do not want code in our loop to run anymore #}&#xA;&#xA;{% for i in 20..100 if break == 0 %} &#xA;    ...&#xA;    {# on some condition we will set break to 1 to prevent running of further code #}&#xA;    {% set break = 1 %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="250" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-09T18:08:22.367" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="864" PostTypeId="2" ParentId="862" CreationDate="2014-07-09T17:39:24.967" Score="8" Body="&lt;p&gt;Marion Newlevant wrote a Craft plugin that adds &lt;code&gt;{% break %}&lt;/code&gt; and &lt;code&gt;{% continue %}&lt;/code&gt; tags to Twig:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marionnewlevant/craft-mnbreakandcontinue&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft 3 version is &lt;a href=&quot;https://plugins.craftcms.com/twig-perversion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Perversion&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="130" LastEditDate="2019-05-15T05:27:24.497" LastActivityDate="2019-05-15T05:27:24.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="865" PostTypeId="2" ParentId="585" CreationDate="2014-07-09T17:42:19.850" Score="10" Body="&lt;p&gt;Yes you can do that with an &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;noreferrer&quot;&gt;Entry Form&lt;/a&gt; in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;noreferrer&quot;&gt;assets fields&lt;/a&gt; article in the docs, there is a small section about &lt;a href=&quot;https://craftcms.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot; rel=&quot;noreferrer&quot;&gt;uploading files from front-end forms&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2017-01-12T05:06:07.647" LastActivityDate="2017-01-12T05:06:07.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="866" PostTypeId="2" ParentId="856" CreationDate="2014-07-09T17:44:26.193" Score="11" Body="&lt;p&gt;At the time of this writing, the ideal solution isn't possible. But, as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/856/can-i-get-an-entry-by-matrix-block-id/866#comment1366_857&quot;&gt;jpea suggested&lt;/a&gt;, creating a plugin was dead easy, so here it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Low Blocks&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...which lets me use syntax like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set block = craft.lowBlocks.id(craft.request.segment(2)) %}&#xA;{% set entry = block.owner %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="127" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-09T17:44:26.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="867" PostTypeId="1" CreationDate="2014-07-09T18:02:01.720" Score="2" ViewCount="210" Body="&lt;p&gt;I'm developing on a Virtual Box on a Mac, and every time I log into the CP, I can log in successfully and click on one (maybe two) links before getting redirected to login again. I tested this on a staging server and it's working, but not in vagrant. However, I can get other things like Wordpress to allow me to login fine on the Vagrant box, so it seems to be some combination of Craft + Vagrant issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on where I might look to debug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I understand this is probably a vagrant issue, but curious if I can get any pointers of where to start looking inside of craft to find the potential problem/incompatibility.&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="57" LastEditDate="2014-07-09T18:39:48.820" LastActivityDate="2014-07-09T19:23:46.853" Title="Getting redirected to login page on every other CP request when using Vagrant" Tags="&lt;control-panel&gt;&lt;cookies&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="868" PostTypeId="2" ParentId="852" CreationDate="2014-07-09T18:34:02.673" Score="4" Body="&lt;p&gt;If you don't want to translate the sections URLs and the entries slugs then there's a very easy way to do a language switch. Just append &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#path&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.path()&lt;/code&gt;&lt;/a&gt; to your localized base URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ 'http://craft.dev/' ~ craft.request.path() }}&quot; class=&quot;nav-link{{ craft.locale == 'pt_BR' ? ' current' }}&quot;&amp;gt;BRA&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ 'http://craft.dev/de/'  ~ craft.request.path() }}&quot; class=&quot;nav-link{{ craft.locale == 'de' ? ' current' }}&quot;&amp;gt;GER&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-10T01:38:40.760" LastActivityDate="2014-07-10T01:38:40.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="869" PostTypeId="2" ParentId="867" CreationDate="2014-07-09T18:36:57.673" Score="2" Body="&lt;p&gt;I kind of doubt this is it, but Craft does have a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#requireMatchingUserAgentForSession&quot; rel=&quot;nofollow&quot;&gt;couple&lt;/a&gt; of &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession&quot; rel=&quot;nofollow&quot;&gt;config settings&lt;/a&gt; that might be coming into play here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell if you're being affected by these by looking in your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files and see if there are any messages being logged with a &lt;code&gt;[warning]&lt;/code&gt; related to not being able to restore session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are being affected by those, try setting both of them to false just to see if that helps.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-09T18:36:57.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="870" PostTypeId="1" AcceptedAnswerId="898" CreationDate="2014-07-09T19:17:52.783" Score="8" ViewCount="16226" Body="&lt;p&gt;I have two Instagram API responses that I want to merge, by the photo's &lt;code&gt;created_time&lt;/code&gt;. Is there a way to do that in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I am just using this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set instagram = &amp;lt;data&amp;gt; %}&#xA;{% set community = &amp;lt;data&amp;gt; %}&#xA;{% set feed = instagram|merge(community) %}&#xA;&#xA;    {% for photo in feed %}&#xA;        &amp;lt;img src=&quot;{{photo.images.low_resolution.url}}&quot; alt=&quot;&quot;&amp;gt;&#xA;        &amp;lt;br /&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each photo has a created_time string that I'd like to sort the array by, is that possible without creating a custom Twig extension? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sortByField plugin looked promising and sort of what I want, but it was directly aimed at Craft entry manipulation. Is there anything hacky that could be done?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2017-10-30T16:37:00.677" Title="Sort merged array by array value in Twig?" Tags="&lt;templating&gt;&lt;sorting&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="871" PostTypeId="2" ParentId="867" CreationDate="2014-07-09T19:23:46.853" Score="1" Body="&lt;p&gt;Something to note is that Vagrant can have issues with syncing a massive amount of files. Without much information, here are a few things to maybe help you narrow it down.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check the folder sync type in your Vagrant file. Vagrant should use NFS as it offers some improvement over the alternatives.&lt;/li&gt;&#xA;&lt;li&gt;Ensure that your craft config is not referencing a &quot;hard path&quot; to the storage directory (i.e /home/yourname/site/projectname/storage).&lt;/li&gt;&#xA;&lt;li&gt;Ensure that virtual box and vagrant are using the latest versions. Virtual box tends to be the culprit with sync issues. In fact, Oracles latest version fails when trying to update itself...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know thats not too much help but I have found those to be a common issue for my setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Also, if you are using git make sure you are ignoring the /storage directory as that will cause the same type of erratic behavior.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-09T19:23:46.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="872" PostTypeId="1" CreationDate="2014-07-09T20:00:52.570" Score="4" ViewCount="527" Body="&lt;p&gt;Our client has created a lot of folders and sub-folders to keep their assets organised. I would guess they've made around 700 to 800!! (Basically two folders for each post)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The assets page in the CP loads very slow now - is there anything I can do to speed this up?&lt;/p&gt;&#xA;" OwnerUserId="426" LastEditorUserId="125" LastEditDate="2014-07-09T20:10:54.793" LastActivityDate="2014-07-12T20:25:53.893" Title="Slow Assets Listing in CP" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="874" PostTypeId="1" AcceptedAnswerId="875" CreationDate="2014-07-09T20:21:37.780" Score="12" ViewCount="592" Body="&lt;p&gt;I would like to turn on a profiler in Craft CMS so I can see what DB queries are being run and how long they take.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2014-07-09T20:38:18.483" Title="How to profile Craft CMS" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="875" PostTypeId="2" ParentId="874" CreationDate="2014-07-09T20:29:57.000" Score="14" Body="&lt;p&gt;Yup! Just turn on &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot;&gt;devMode&lt;/a&gt; in your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot;&gt;general config&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; true,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then just open up a console (Firebug, Chrome, etc) and look in the profiling summary report.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="177" LastEditDate="2014-07-09T20:38:18.483" LastActivityDate="2014-07-09T20:38:18.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="876" PostTypeId="2" ParentId="780" CreationDate="2014-07-10T00:04:21.160" Score="4" Body="&lt;p&gt;When you are following the &lt;em&gt;each-locale-gets-its-own-index.php-file&lt;/em&gt; pattern as outlined in the official KB article, “&lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;How do I show localized content on the front end?&lt;/a&gt;”, then you do &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; need to include the locale ID in your sections’ Entry URL Format settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you have a News section, and you want Arabic entries to get URLs that look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.site.com/ar/news/my-entry-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the Arabic Entry URL Format should just be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;not&lt;/strong&gt; this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ar/news/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything leading up to “news/{slug}”, including “ar/”, is handled by your Arabic site URL, as defined in your config/general.php file’s &lt;code&gt;siteUrl&lt;/code&gt; setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://www.site.com/',&#xA;    'ar' =&amp;gt; 'http://www.site.com/ar/',&#xA;    // ...&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-10T00:04:21.160" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="877" PostTypeId="1" AcceptedAnswerId="882" CreationDate="2014-07-10T00:10:22.963" Score="15" ViewCount="3266" Body="&lt;p&gt;I’m trying to create a dropdown menu to switch between language’s on my site. I am currently doing this with this snippet found on the google plus community:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block locale__switch %}&#xA;&#xA;{# Loop through all of the site locales, except the current one #}&#xA;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}&#xA;{% for locale in otherLocales %}&#xA;&#xA;    {# Find the current entry in the other locale #}&#xA;    {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;&#xA;    {# Make sure that it's actually localized to this locale #}&#xA;    {% if localeEntry.locale == locale %}&#xA;&#xA;        {# Output a link to it #}&#xA;        &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot; style=&quot;text-transform:uppercase;&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;&#xA;        {# Output a link to the hompage #}&#xA;        &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; style=&quot;text-transform:uppercase;&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endblock %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this simply shows a single link to the opposite locale than the current. Basically I want to have something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;div id=&quot;lang-form&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;language-selected&quot; class=&quot;dropdownbox&quot;&amp;gt;EN &amp;amp;#9662;&amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;dropdown-wrapper&quot;&amp;gt;&#xA;      &amp;lt;ul name=&quot;lang&quot; id=&quot;select-language-menu&quot; class=&quot;menu&quot;&amp;gt;&#xA;          &amp;lt;li class=&quot;selected&quot;&amp;gt;&#xA;               English&#xA;               &amp;lt;div class=&quot;lang-code&quot; style=&quot;display: none;&quot;&amp;gt;en &amp;amp;#9662;&amp;lt;/div&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;               Hungarian&#xA;               &amp;lt;div class=&quot;lang-code&quot; style=&quot;display: none;&quot;&amp;gt;hu &amp;amp;#9662;&amp;lt;/div&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;       &amp;lt;/ul&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This probably seems trivial and simple, but I’m having a tough time figuring out how craft works at this level. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="478" LastEditorUserId="125" LastEditDate="2014-07-16T14:42:12.817" LastActivityDate="2017-10-05T12:30:57.063" Title="How do I create a locale dropdown to switch between languages?" Tags="&lt;localization&gt;&lt;navigation&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="878" PostTypeId="2" ParentId="780" CreationDate="2014-07-10T00:20:22.033" Score="3" Body="&lt;p&gt;When you write:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've had the most luck with this nginx config, together with specifying the local in the section urls in the cms for each section.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are you referring to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w4ill.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, and you put the locale, in this case: &lt;code&gt;fr_ca/a-apropos&lt;/code&gt;, try removing &lt;code&gt;fr_ca&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2014-07-10T00:20:22.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="879" PostTypeId="1" AcceptedAnswerId="880" CreationDate="2014-07-10T00:30:11.727" Score="19" ViewCount="6756" Body="&lt;p&gt;When I output &lt;code&gt;{{ craft.locale }}&lt;/code&gt; in my template, I get the current locale’s ID (e.g. “en”) rather than its name (e.g. “English”).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the locale’s &lt;strong&gt;name&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-10T12:51:02.647" LastActivityDate="2014-07-10T12:54:21.663" Title="How do I output the locale’s name?" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="880" PostTypeId="2" ParentId="879" CreationDate="2014-07-10T00:30:11.727" Score="21" Body="&lt;p&gt;You can get the current locale’s name via &lt;code&gt;craft.i18n.getCurrentLocale()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;{{ locale.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will output the name using the current locale’s translation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would prefer to output the locale’s name in its native tongue, use &lt;code&gt;nativeName&lt;/code&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ locale.nativeName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also output the name of any locale using (not necessarily the current one) using &lt;code&gt;craft.i18n.getLocaleById()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getLocaleById(entry.locale) %}&#xA;{{ locale.name }}&#xA;{{ locale.nativeName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-10T12:54:21.663" LastActivityDate="2014-07-10T12:54:21.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="881" PostTypeId="1" AcceptedAnswerId="884" CreationDate="2014-07-10T01:08:32.673" Score="11" ViewCount="1214" Body="&lt;p&gt;I kind of want a tag archive page where it doesn't just list all the tags and links to entries based on that tag, but where the sizes of the actual tag link vary based on frequency of use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how?&lt;/p&gt;&#xA;" OwnerUserId="24" LastEditorUserId="22" LastEditDate="2014-07-10T03:16:53.680" LastActivityDate="2016-06-12T03:37:09.387" Title="How can I create a visually weighted tag cloud?" Tags="&lt;tags&gt;&lt;format&gt;&lt;archives&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="882" PostTypeId="2" ParentId="877" CreationDate="2014-07-10T01:10:50.563" Score="15" Body="&lt;p&gt;This is because you loop through all but the current locales. Remove the &lt;code&gt;without&lt;/code&gt; filter to loop them all.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &quot;current&quot; class:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To assign the current locale's link a class of &quot;current&quot;, compare the looped locale to the current locale and set a variable that you can later test for. (In the example code I use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;ternary operator&lt;/a&gt; for short output syntax.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example Code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my example code below you first create an array of all the locales you want the language switch to include, and then loop through it. With this technique you can define the order of the output manually or exclude locales from the loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Configure and loop through selected site locales #}&#xA;{% set locales = ['en', 'hu'] %}&#xA;{% for locale in locales %}&#xA;&#xA;    {# Check if locale equals the requested page locale #}&#xA;    {% set current = false %}&#xA;    {% if locale == craft.locale %}&#xA;        {% set current = true %}&#xA;    {% endif %}&#xA;&#xA;    {# Is this an entry page? #}&#xA;    {% if entry is defined %}&#xA;&#xA;        {# Find the current entry in the other locale #}&#xA;        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first() %}&#xA;&#xA;        {# Make sure that it's actually localized to this locale #}&#xA;        {% if localeEntry and localeEntry.locale == locale %}&#xA;&#xA;            {# Output a link to it #}&#xA;            &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;            {# Output a link to the hompage #}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {# Not an entry page #}&#xA;    {% else %}&#xA;&#xA;        {# Output the same path with the locale's base URL (`siteUrl`) #}&#xA;        &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Code edits done to implement a lookup of the (translated) locale name as described &lt;a href=&quot;https://craftcms.stackexchange.com/a/880/125&quot;&gt;here&lt;/a&gt; by Brandon Kelly&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The easiest (and recommended) way to use this language switch is to exclusively use    entry pages (channel entries, structure entries, or singles) on your site.&lt;/li&gt;&#xA;&lt;li&gt;All non entry pages have to have the same URL path / slug for each locale (eg. &lt;code&gt;http://craft.dev/de/meineindexseite/&lt;/code&gt; and &lt;code&gt;http://craft.dev/en/meineindexseite/&lt;/code&gt;), translated URL parts won't work for non entry pages with this code.&lt;/li&gt;&#xA;&lt;li&gt;If you only use entry pages or if you are using &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview#template-localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;localized template folders&lt;/a&gt; you should be save to remove the &lt;code&gt;entry is defined&lt;/code&gt; conditional (incl. the else part) altogether.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft.config.siteUrl[localeId]&lt;/code&gt; only works if &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;siteUrl is configured&lt;/a&gt; to take care of localized URLs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="6225" LastEditDate="2017-10-05T12:30:57.063" LastActivityDate="2017-10-05T12:30:57.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="883" PostTypeId="1" AcceptedAnswerId="893" CreationDate="2014-07-10T01:37:10.237" Score="6" ViewCount="1342" Body="&lt;p&gt;Does anyone have any examples of how they've put together the main site navigation for a multi-lingual site set-up made up of singles, channels and structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I've just hard-coded the nav and done and if else on the locale ID but would like to know if there's a more flexible, future-proof method.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="125" LastEditDate="2014-07-14T23:47:54.737" LastActivityDate="2014-07-14T23:47:54.737" Title="Multi-lingual site navigation made of singles, channels and structure" Tags="&lt;navigation&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="884" PostTypeId="2" ParentId="881" CreationDate="2014-07-10T01:41:26.303" Score="15" Body="&lt;p&gt;Brandon commented on getting tag usage count (and how it can be expensive) in &lt;a href=&quot;https://plus.google.com/105335880239855961276/posts/WSy2LNwi21i&quot; rel=&quot;nofollow&quot;&gt;this Google+ post&lt;/a&gt; and again in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1091/how-can-i-best-extend-tagmodel-to-add-a-count-property?lq=1&quot;&gt;this SE question&lt;/a&gt; where I was trying to think through a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to completely steal from that, you could loop through your tags and get a count for each...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags.find() %}&#xA;&#xA;{% for tag in tags %}&#xA;    {% set count = craft.entries.section('blog').relatedTo(tag).total() %}&#xA;    &amp;lt;a href=&quot;/entries/{{ tag.slug }}&quot; data-count=&quot;{{ count }}&quot;&amp;gt;{{ tag.name }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then manipulate the listing with JavaScript or find the max count and loop again to apply inline CSS percentages or &lt;code&gt;font-size&lt;/code&gt;s that are scaled accordingly. As Brandon noted in that post, be sure to wrap everything in &lt;code&gt;{% cache %}&lt;/code&gt; tags since this will be an intense template to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this answer, Phil Birnie released &lt;a href=&quot;https://github.com/philbirnie/CraftPopularTags&quot; rel=&quot;nofollow&quot;&gt;a plugin for this&lt;/a&gt; he's linked to below, and I came up &lt;a href=&quot;https://gitlab.com/workingconcept/craft-taggregate&quot; rel=&quot;nofollow&quot;&gt;with my own&lt;/a&gt; that we trashed in &lt;a href=&quot;https://straightupcraft.com/events/code-review-optimized-tag-clouds-with-taggregate&quot; rel=&quot;nofollow&quot;&gt;a Straight Up Craft Hangout&lt;/a&gt; thanks to Marion's stellar idea of using a Preparse field to tally counts, which I've added here as an alternative answer.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-06-12T02:58:32.707" LastActivityDate="2016-06-12T02:58:32.707" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="885" PostTypeId="2" ParentId="883" CreationDate="2014-07-10T03:29:01.650" Score="9" Body="&lt;p&gt;I have one main structure &quot;pages&quot; and got rid of all single sections. I also gave each channel's index page an entry in the structure (good for URL translation). Then I added some entry types to it (you can also &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot;&gt;link templates&lt;/a&gt; to them) and created my site navigation like in my example code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to translate the slug of the index pages in the CP and you have access to localized URL (&lt;code&gt;page.getUrl&lt;/code&gt;) and page title variables (&lt;code&gt;page.title&lt;/code&gt;) in your nav template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only one level of hierarchy I need. If you have to go deeper, the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#nav&quot;&gt;&lt;code&gt;nav&lt;/code&gt;&lt;/a&gt; tag's waiting for you! ;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get top-level entries in pages structure #}&#xA;{% set pages = craft.entries.section('pages').level(1) %}&#xA;&#xA;&amp;lt;nav class=&quot;navigation&quot; role=&quot;navigation&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;        {# Loop through entries (= pages) and list the links #}&#xA;        {% for page in pages %}&#xA;            &amp;lt;li class=&quot;navigation-item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ page.getUrl }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {# Include links to switch locales #}&#xA;        &amp;lt;li class=&quot;navigation-item&quot;&amp;gt;&#xA;            {% include '_includes/language_switch.html' %}&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-10T10:48:23.880" LastActivityDate="2014-07-10T10:48:23.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="886" PostTypeId="1" CreationDate="2014-07-10T07:18:27.467" Score="4" ViewCount="675" Body="&lt;p&gt;I'm using Matrix to give loads of flexibility with blog posts, but it means things aren't as simple when it comes to RSS than if just using a single field called &lt;em&gt;Body&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is everyone else dealing with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As Christian points out, I'm party asking what is best practice for RSS feeds. But I'm also exploring the extra flexibility or complexibility offered by using Matrix for blog post content. Best practice is constantly evolving, and I think it quite possible best practice for creating an RSS feed using Craft may turn out to be different best practice to feeds generated by something else, simply because the flexibility is there (just as long-form content is becoming more commonplace as CMSs start to deal with it better). For example, using Matrix we can pick and choose which types of content are included within the feed to a much greater degree. Or do we just say, no, a feed should contain this, this and this and you shouldn't mess with that, no matter what the tool?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-07-11T07:56:15.243" LastActivityDate="2014-07-11T07:56:15.243" Title="Populating an RSS feed with full post content?" Tags="&lt;best-practice&gt;&lt;rss&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="887" PostTypeId="1" AcceptedAnswerId="892" CreationDate="2014-07-10T07:19:25.830" Score="10" ViewCount="345" Body="&lt;p&gt;I'm working on a plugin with its own element type, I'm trying to add custom statuses to the element type. What is the best way to proceed? I have hasStatuses set to true and getStatuses is where I would set them.. But what should the array look like thats returned?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UserElementType returns this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns all of the possible statuses that elements of this type may have.&#xA; *&#xA; * @return array|null&#xA; */&#xA;public function getStatuses()&#xA;{&#xA;    return array(&#xA;        UserStatus::Active    =&amp;gt; Craft::t('Active'),&#xA;        UserStatus::Pending   =&amp;gt; Craft::t('Pending'),&#xA;        UserStatus::Locked    =&amp;gt; Craft::t('Locked'),&#xA;        UserStatus::Suspended =&amp;gt; Craft::t('Suspended'),&#xA;        UserStatus::Archived  =&amp;gt; Craft::t('Archived')&#xA;    );&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-10T09:42:08.547" Title="Best way to implement my own statuses on my custom element type?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="888" PostTypeId="2" ParentId="886" CreationDate="2014-07-10T08:22:00.993" Score="4" Body="&lt;p&gt;I would use a lead paragraph field that you could then call into the RSS feed. Or you could add a post summary field. You could then call that whenever you need to, RSS or otherwise.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2014-07-10T08:22:00.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="892" PostTypeId="2" ParentId="887" CreationDate="2014-07-10T09:42:08.547" Score="12" Body="&lt;p&gt;All you need to return from the &lt;code&gt;getStatuses()&lt;/code&gt; method is an associative &lt;code&gt;array()&lt;/code&gt; where the key represents the status &lt;strong&gt;name&lt;/strong&gt; and the value represents the status &lt;strong&gt;label&lt;/strong&gt;, more or less.&lt;/p&gt;&#xA;&lt;p&gt;An example might be a set of statuses for a &lt;strong&gt;Payment&lt;/strong&gt; element type:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getStatuses()&#xA;{&#xA;    return array(&#xA;        'captured' =&amp;gt; Craft::t('Captured'),&#xA;        'canceled' =&amp;gt; Craft::t('Canceled'),&#xA;        'refunded' =&amp;gt; Craft::t('Refunded'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, since it is likely that you'll be referring to and comparing against those statuses, it makes sense to give yourself a little extra insurance by creating a set of &lt;a href=&quot;http://www.php.net/manual/en/language.oop5.constants.php&quot; rel=&quot;noreferrer&quot;&gt;class constants&lt;/a&gt; instead of using plain strings.&lt;/p&gt;&#xA;&lt;p&gt;That is exactly what Craft has done in the &lt;strong&gt;UserStatus&lt;/strong&gt; class and you can achieve the same result in one of two ways.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Create your own class and define those constants&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// plugin/enums/PluginPaymentStatus.php&#xA;namespace Craft;&#xA;&#xA;class PluginPaymentStatus&#xA;{&#xA;    const CAPTURED = 'captured';&#xA;    const CANCELED = 'canceled';&#xA;    const REFUNDED = 'refunded';&#xA;}&#xA;&#xA;// plugin/elementtypes/PluginElementType.php&#xA;public function getStatuses()&#xA;{&#xA;    return array(&#xA;        PluginPaymentStatus::CAPTURED =&amp;gt; Craft::t('Captured'),&#xA;        PluginPaymentStatus::CANCELED =&amp;gt; Craft::t('Canceled'),&#xA;        PluginPaymentStatus::REFUNDED =&amp;gt; Craft::t('Refunded'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Create the status constants in your element type model if you have one&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that if you go with option &lt;strong&gt;1&lt;/strong&gt;, you will need to &lt;strong&gt;import|include|require&lt;/strong&gt; your &lt;strong&gt;&amp;quot;enum&amp;quot;&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-07-10T09:42:08.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="893" PostTypeId="2" ParentId="883" CreationDate="2014-07-10T11:10:23.840" Score="3" Body="&lt;p&gt;This was on my first craft site (&lt;a href=&quot;http://patisseriejanandries.com&quot; rel=&quot;nofollow&quot;&gt;http://patisseriejanandries.com&lt;/a&gt;) so this is a 'warts and all' example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Productpages was a structure, news a channel, the other pages were singles. The 'nieuwsindex' single is there because I needed a translatable url for the news page, so that single served as a workaround. (more on that here: &lt;a href=&quot;https://plus.google.com/116942350387086245334/posts/TBtR3XwuZGx&quot; rel=&quot;nofollow&quot;&gt;https://plus.google.com/116942350387086245334/posts/TBtR3XwuZGx&lt;/a&gt;)&#xA;You're still basically hardcoding the nav, but craft does take care of the multi-language urls, pretty nice if you ask me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nav template looked like this (which IMO isn't &lt;em&gt;that&lt;/em&gt; bad for a first try :) )&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {# set values for the navigation #}&#xA;   {# products = structure #}&#xA;   {% set productpages = craft.entries.section('productPages').depth(1).find() %}&#xA;   {# singles #}&#xA;   {% set contact = craft.entries.section('contact').find() %}&#xA;   {% set overjanandries = craft.entries.section('overJanAndries').find() %}&#xA;   {% set overview = craft.entries.section('overview').find() %}&#xA;   {% set news = craft.entries.section('nieuwsIndex').find() %}&#xA;&#xA;&#xA;    &amp;lt;div id=&quot;menu&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;close&quot;&amp;gt; &amp;lt;span class=&quot;menu-icon icon-cancel&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;nav role=&quot;navigation&quot;&amp;gt;&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% for page in overview %}&#xA;          &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;        {% for page in overjanandries %}&#xA;          &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;        {% for page in productpages %}&#xA;         &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;         {% for page in news %}&#xA;          &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;        {% for page in contact %}&#xA;          &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/nav&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- menu --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Following Christian's suggestions I've amended my code and added a 'current' class.&#xA;This is working fine (and probably cuts down on DB calls):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set values for the navigation #}&#xA;{# products = structure #}&#xA;{% set productpages = craft.entries.section('productPages').depth(1).find() %}&#xA;{# singles #}&#xA;{% set contact = craft.entries.section('contact').first() %}&#xA;{% set overjanandries = craft.entries.section('overJanAndries').first() %}&#xA;{% set overview = craft.entries.section('overview').first() %}&#xA;{% set news = craft.entries.section('nieuwsIndex').first() %}&#xA;{% set section = craft.request.getSegment(1) %}&#xA;&#xA;&#xA;&amp;lt;div id=&quot;menu&quot;&amp;gt;&#xA;  &amp;lt;a class=&quot;close&quot;&amp;gt; &amp;lt;span class=&quot;menu-icon icon-cancel&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;  &amp;lt;nav role=&quot;navigation&quot;&amp;gt;&#xA;  &amp;lt;ul&amp;gt;&#xA;    &amp;lt;li {% if section == overview.uri %}class=&quot;current&quot;{% endif %}&amp;gt;{{ overview.getLink() }}&amp;lt;/li&amp;gt;  &#xA;    &amp;lt;li {% if section == overjanandries.uri %}class=&quot;current&quot;{% endif %}&amp;gt;{{ overjanandries.getLink() }}&amp;lt;/li&amp;gt;  &#xA;    {% for page in productpages %}&#xA;     &amp;lt;li {% if section == page.uri %}class=&quot;current&quot;{% endif %}&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;  &#xA;    {% endfor %}&#xA;    &amp;lt;li {% if section == news.uri %}class=&quot;current&quot;{% endif %}&amp;gt;{{ news.getLink() }}&amp;lt;/li&amp;gt;  &#xA;    &amp;lt;li {% if section == contact.uri %}class=&quot;current&quot;{% endif %}&amp;gt;{{ contact.getLink() }}&amp;lt;/li&amp;gt;  &#xA;  &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/nav&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- menu --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="166" LastEditorUserId="166" LastEditDate="2014-07-10T13:10:35.467" LastActivityDate="2014-07-10T13:10:35.467" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="894" PostTypeId="2" ParentId="886" CreationDate="2014-07-10T12:49:30.963" Score="1" Body="&lt;p&gt;If I am getting you right you have no problem with Craft outputting the content you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are rather asking us on what is considered best practice for what content one should deliver with RSS feeds. I'd say it is totally up to you, there's no real standardized way on how to do it right, as far as I can tell. I did have feeds with long read articles and others with just a title / subtitle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a nice (mobile) site layout (without distracting adds) I always preferred reading the content on the sites themselves. With other feeds I was happy not being forced to use the whole website for their articles.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-10T12:49:30.963" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="895" PostTypeId="1" AcceptedAnswerId="899" CreationDate="2014-07-10T12:58:49.113" Score="7" ViewCount="1220" Body="&lt;p&gt;So I'm writing a plugin to try and create a relationship between two entry sections that is a two way street (Many to Many).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to co-opt the UI and functionality of the ElementType modal for a predefined section ID and then do my own saving logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I would just like to use the front end form functionality and handle the backend logic myself. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-07-10T14:49:22.450" Title="Is it possible to use the ElementType Modal UI for a custom Field Type Plugin?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="897" PostTypeId="1" AcceptedAnswerId="909" CreationDate="2014-07-10T13:27:40.480" Score="4" ViewCount="594" Body="&lt;p&gt;You sometime want to pass specific info from one page to another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you do that with twig and are there explicit Craft methods to do this?&#xA;Can you do this without exposing the variable in the URL?&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-10T17:23:45.047" Title="Best practice on how to hand over variables with links?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="898" PostTypeId="2" ParentId="870" CreationDate="2014-07-10T13:32:56.587" Score="8" Body="&lt;p&gt;This is only possible with a custom &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html&quot;&gt;Twig Extension&lt;/a&gt;, since sorting a multidimensional array can't be done with Twig itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written a plugin which extends Twigs sorting methods, which you could use as a base: &lt;a href=&quot;https://github.com/victor-in/Craft-TwigBetterSort&quot;&gt;Craft-TwigBetterSort&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add this to the &lt;a href=&quot;https://github.com/victor-in/Craft-TwigBetterSort/blob/master/twigbettersort/twigextensions/TwigBetterSortTwigExtension.php&quot;&gt;&lt;em&gt;TwigBetterSortTwigExtension.php&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function twig_sort($array, $method='asort', $sort_flag='SORT_REGULAR')&#xA;{&#xA;    // ....&#xA;    case 'custom_sort_name':&#xA;        usort($array, array('TwigBetterSortTwigExtension','custom_sort_function'));&#xA;        break;&#xA;    // ....&#xA;}&#xA;&#xA;private function custom_sort_function($a, $b)&#xA;{&#xA;    // Do stuff with your array&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and use it like this in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% array|sort('custom_sort_name') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-10T13:32:56.587" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="899" PostTypeId="2" ParentId="895" CreationDate="2014-07-10T14:49:22.450" Score="14" Body="&lt;p&gt;Yep, you can do that with &lt;code&gt;Craft.createElementSelectorModal()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var myModal = Craft.createElementSelectorModal('Entry', {&#xA;    resizable:          true,&#xA;    storageKey:         'someUniqueID',&#xA;    sources:            ['section:1', 'seciton:2'],&#xA;    criteria:           { status: null },&#xA;    multiSelect:        true,&#xA;    disabledElementIds: [1, 2, 3],&#xA;    disableOnSelect:    true,&#xA;    onCancel:           function(){},&#xA;    onSelect:           function(entries){}&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first argument specifies what &lt;em&gt;type&lt;/em&gt; of element you want to be selecting (Entry, Asset, etc.), and the second argument defines the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of those settings are optional except for &lt;code&gt;onSelect&lt;/code&gt;. Here’s what they do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;resizable&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(bool)&lt;/em&gt; – Whether the modal should be user-resizable. (Defaults to &lt;code&gt;true&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;storageKey&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(string)&lt;/em&gt; – The storage key prefix that the modal will use to save its state in the browser’s localStorage, including things like which source was selected. (Defaults to &lt;code&gt;null&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;sources&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(array)&lt;/em&gt; – Which sources should be shown in the modal’s sidebar. If omitted, all sources will be shown. (Defaults to &lt;code&gt;null&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;criteria&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(object)&lt;/em&gt; – The params that will be used to determine which elements will be shown. See the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;craft.entries documentation&lt;/a&gt; for available params when selecting entries. (Defaults to &lt;code&gt;null&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;multiSelect&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(bool)&lt;/em&gt; – Whether multiple elements should be able to be selected at once. (Defaults to &lt;code&gt;false&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;disabledElementIds&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(array)&lt;/em&gt; – A list of element IDs that should be disabled (unselectable). Pass any elements that are already selected in here, so they can’t be double-selected. (Defaults to an empty array)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;disableOnSelect&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(bool)&lt;/em&gt; – Whether the modal should automatically disable elements when they are selected. (Defaults to &lt;code&gt;false&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;onCancel&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(function)&lt;/em&gt; – A function that should get called when the modal is cancelled without selecting anything.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;onSelect&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(function)&lt;/em&gt; – A function that should get called when elements have been selected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;onSelect&lt;/code&gt; function will get passed an array that contains info about each of the selected elements. Each item in the array will have the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;id&lt;/code&gt;&lt;/strong&gt; – The element’s ID&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;label&lt;/code&gt;&lt;/strong&gt; – The element’s label (the Title if it’s an entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;status&lt;/code&gt;&lt;/strong&gt; – The element’s status&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;url&lt;/code&gt;&lt;/strong&gt; – The element’s front-end URL, if it has one&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;hasThumb&lt;/code&gt;&lt;/strong&gt; – Whether the element has a thumbnail&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;$element&lt;/code&gt;&lt;/strong&gt; – A jQuery object for the element, which you can append to your field input&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you’ve created your modal, it will automatically be shown. It will also be automatically closed when it is cancelled out of, or elements are selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can re-open it later by calling &lt;code&gt;myModal.show()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-10T14:49:22.450" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="900" PostTypeId="1" CreationDate="2014-07-10T15:06:29.383" Score="1" ViewCount="389" Body="&lt;p&gt;How do I check if a given number is prime in twig? &lt;/p&gt;&#xA;" OwnerUserId="250" LastActivityDate="2014-07-11T16:33:56.567" Title="How to check if number is prime?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;number&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="901" PostTypeId="2" ParentId="900" CreationDate="2014-07-10T15:06:29.383" Score="2" Body="&lt;p&gt;Example using build-in functions (sure, not the best ;-) ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that &lt;code&gt;number&lt;/code&gt; is our number:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set result = 0 %}&#xA;{% if number / number|round == 1 %}&#xA;    {% set result = 1 %}&#xA;    {% if number &amp;gt; 3 %}&#xA;        {% for i in 2..number-1 if result == 1 %}&#xA;            {% if number is divisibleby(i) %}&#xA;                {% set result = 2 %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;code&gt;result&lt;/code&gt; equals to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;0&lt;/code&gt;, if &lt;code&gt;number&lt;/code&gt; is not integer&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;1&lt;/code&gt;, if &lt;code&gt;number&lt;/code&gt; is prime &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;2&lt;/code&gt;, if &lt;code&gt;number&lt;/code&gt; is composite&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-10T15:25:58.780" LastActivityDate="2014-07-10T15:25:58.780" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="902" PostTypeId="1" AcceptedAnswerId="905" CreationDate="2014-07-10T15:58:51.057" Score="-1" ViewCount="192" Body="&lt;p&gt;First time building a site with Craft, but a long time admirer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wanted to know the best way to approach an educational site that has many locations,&#xA;and then have a news section, etc. in each one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure the best approach in regards to creating sections to achieve this.&lt;/p&gt;&#xA;" OwnerUserId="140" LastEditorUserId="57" LastEditDate="2014-07-10T17:15:22.280" LastActivityDate="2014-07-10T17:15:22.280" Title="What's are some best practices for building a site structure with multiple locations?" Tags="&lt;best-practice&gt;&lt;sections&gt;" AnswerCount="3" CommentCount="10" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="903" PostTypeId="1" AcceptedAnswerId="904" CreationDate="2014-07-10T16:07:43.193" Score="6" ViewCount="1571" Body="&lt;p&gt;I thought this would be very easy but I'm having a hard time figuring it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you output a warning/message if there are no entries to loop through?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').limit(5).find() %}&#xA;&#xA;{% if entries|length %}&#xA;    {% for entry in entries %}&#xA;      {# Do Loop #}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries found.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or am I just sleepy and approaching this all wrong?&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="57" LastEditDate="2014-07-12T01:15:43.093" LastActivityDate="2014-07-12T01:16:06.630" Title="How do you return a message if no entries are found?" Tags="&lt;entries&gt;&lt;templating&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="904" PostTypeId="2" ParentId="903" CreationDate="2014-07-10T16:10:27.550" Score="13" Body="&lt;p&gt;The &lt;strong&gt;for&lt;/strong&gt; tag has an &lt;strong&gt;else&lt;/strong&gt; clause by which you can render a replacement block if no iteration took place because the sequence was empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for user in users %}&#xA;        &amp;lt;li&amp;gt;{{ user.username|e }}&amp;lt;/li&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;em&amp;gt;no user found&amp;lt;/em&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;reference: &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-else-clause&quot;&gt;http://twig.sensiolabs.org/doc/tags/for.html#the-else-clause&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="246" LastEditDate="2014-07-12T01:16:06.630" LastActivityDate="2014-07-12T01:16:06.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="905" PostTypeId="2" ParentId="902" CreationDate="2014-07-10T16:22:44.313" Score="3" Body="&lt;p&gt;A different News Channel for each location:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;News Location 1&lt;/em&gt; with Entry URL Format &lt;code&gt;location-1/news/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;News Location 2&lt;/em&gt; with Entry URL Format &lt;code&gt;location-2/news/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="298" LastActivityDate="2014-07-10T16:22:44.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="906" PostTypeId="2" ParentId="902" CreationDate="2014-07-10T16:24:07.640" Score="2" Body="&lt;p&gt;See this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/408/are-there-any-intentions-to-release-multisite-support-for-craft/409#409&quot;&gt;Are there any intentions to release multisite support for Craft?&lt;/a&gt; and be sure to click through to the G+ conversation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tl;dr: consider using locales. Custom locales likely to come to Craft somewhere down the road.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-10T16:24:07.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="907" PostTypeId="1" AcceptedAnswerId="1043" CreationDate="2014-07-10T16:28:23.197" Score="9" ViewCount="490" Body="&lt;p&gt;I made a lot of progress on my custom element type from this post and with the help of @selvinortiz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/887/best-way-to-implement-my-own-statuses-on-my-custom-element-type&quot;&gt;Best way to implement my own statuses on my custom element type?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know have custom statuses that look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pwpfN.png&quot; alt=&quot;custom statuses&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are a few things I'm stuck on:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do you assign colors to the statuses? I could target them with CSS but I feel there may be a way with Craft itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When listing entries in my templates, the default status is &quot;green&quot; for enabled. So how do I correlate my custom statuses with the enabled/disabled featured thats all ready in place?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rnMpm.png&quot; alt=&quot;enabled element types&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like Craft is the perfect tool for developing a workflow style plugin but I am having a few issues with statuses specifically. Does anyone have personal experience with creating a workflow, using native functionality, with Craft?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-10-25T09:31:11.877" Title="How to integrate custom statuses in a workflow style custom element type?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="908" PostTypeId="2" ParentId="902" CreationDate="2014-07-10T16:36:26.747" Score="2" Body="&lt;p&gt;You could use a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;mulit-environment&lt;/a&gt; config for your &quot;locations&quot; (if my guessing is right and you want different Base URLs). Both &quot;locations&quot; (= environments) get access to the same content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can access your site on:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.location-1.com&quot; rel=&quot;nofollow&quot;&gt;http://www.location-1.com&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.location-2.com&quot; rel=&quot;nofollow&quot;&gt;http://www.location-2.com&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-10T16:36:26.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="909" PostTypeId="2" ParentId="897" CreationDate="2014-07-10T17:23:45.047" Score="6" Body="&lt;p&gt;You're options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Adding it as a parameter in the querystring (e.g. domain.com?key1=value1)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Submitting it though a form and grabbing the value from POST.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Setting the value in a cookie and retrieving it on the next page using something like &lt;a href=&quot;http://straightupcraft.com/craft-plugins/lj-cookies&quot;&gt;this plugin&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Writing a plugin with a Twig function that wraps Craft's &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash()&lt;/code&gt; method, which will store a key-&gt;value pair in session for exactly one request.  You can retrieve the value via &lt;code&gt;craft.userSession.getFlash()&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that there are limitations to the size and complexity of the data you can pass along with all of these, but especially options 3 and 4, so it's best to stick with simple strings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-10T17:23:45.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="910" PostTypeId="2" ParentId="740" CreationDate="2014-07-10T18:19:34.763" Score="6" Body="&lt;p&gt;If you need to make changes to each entry, then the key to avoiding memory issues is to save them one at a time (or possibly in batches), rather than trying to fetch and update all the entries at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before you do anything, tell the TemplateCachesService to delete all template caches, so that it’s not going to try to selectively delete caches each time you re-save an entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Delete all the entry caches&#xA;craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementType('Entry');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next up, get all of the entry IDs that you want to edit. (See our &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot;&gt;Working With Elements guide&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Now find the entry IDs&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Entry', array('section' =&amp;gt; 'mySectionHandle', 'limit' =&amp;gt; null, 'status' =&amp;gt; null, 'localeEnabled' =&amp;gt; null));&#xA;$criteria-&amp;gt;section = 'mySectionHandle';&#xA;$criteria-&amp;gt;limit = null;&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;localeEnabled = null;&#xA;&#xA;$entryIds = $criteria-&amp;gt;ids();&#xA;$totalEntries count($entryIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally, loop through the IDs and fetch/save each entry individually.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($entryIds as $entryId)&#xA;{&#xA;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;    if (!$entry)&#xA;    {&#xA;        continue;&#xA;    }&#xA;&#xA;    // Make your changes&#xA;    $entry-&amp;gt;getContent()-&amp;gt;myCustomField = 'foo';&#xA;&#xA;    // Save it&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    if (!$success)&#xA;    {&#xA;        // Log the error in this plugin's log file (in craft/storage/runtime/logs/fooplugin.log)&#xA;        $error = 'Encountered the following validation errors when trying to save entry # &quot;'.$entry-&amp;gt;id.'&quot;:';&#xA;&#xA;        foreach ($entry-&amp;gt;getAllErrors() as $attributeError)&#xA;        {&#xA;            $error .= &quot;\n - {$attributeError}&quot;;&#xA;        }&#xA;&#xA;        FooPlugin::log($error, LogLevel::Error);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that saving new content gets a little complicated if you have any relational or Matrix fields on the entry. Probably warrants another question.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-10T18:19:34.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="911" PostTypeId="1" AcceptedAnswerId="913" CreationDate="2014-07-10T18:36:39.330" Score="3" ViewCount="1887" Body="&lt;p&gt;To get around a temporary issue where two urls go to the same site, I wanted to set all my site links to be relative rather than using the full url. Looking through the Craft docs I found that it's &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-site-url&quot; rel=&quot;nofollow&quot;&gt;apparently possible&lt;/a&gt; to place something like this in the index.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_SITE_URL', &quot;http://{host}/&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this didn't seem to work - I just get '{host}' appearing in all my links. Instead I set the site url as below, which has had the desired effect...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_SITE_URL', &quot;/&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but is this a bad idea?&lt;/p&gt;&#xA;" OwnerUserId="470" LastEditorUserId="115" LastEditDate="2014-07-13T04:53:23.043" LastActivityDate="2014-07-13T04:53:23.043" Title="How do I make site links relative?" Tags="&lt;config&gt;&lt;url&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="912" PostTypeId="1" AcceptedAnswerId="914" CreationDate="2014-07-10T19:37:17.550" Score="8" ViewCount="2937" Body="&lt;p&gt;Is there a way to filter a matrix by block type, or get a count of how many items there are of a certain type? Can't find a syntax example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a matrix with two blocks. In pseudo code, basically what I want to do is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set typeOneBlocks = theMatrix blocks where type == &quot;typeOne&quot; %}&#xA;&#xA;{% if typeOneBlocks != null %}&#xA;    &amp;lt;div class=&quot;divAWrapper&quot;&amp;gt;&#xA;        {% for block in typeOneBlocks %}&#xA;            &amp;lt;div class=&quot;divA&quot;&amp;gt;{# do stuff #}&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same with &lt;code&gt;typeTwo&lt;/code&gt; blocks. If there are no items of one type or the other, I don't want to create that container and have it sitting empty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is not a way to filter or get a count, I'd have to use for loops to increment vars for how many of each block type there are and then act based on those counts. Seems there should be a simpler way.&lt;/p&gt;&#xA;" OwnerUserId="495" LastEditorUserId="250" LastEditDate="2014-07-11T22:24:42.913" LastActivityDate="2014-07-11T22:24:42.913" Title="How do you filter matrix blocks by type?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="913" PostTypeId="2" ParentId="911" CreationDate="2014-07-10T19:42:09.973" Score="4" Body="&lt;p&gt;I may be mistaken, but I feel like a standard multi-environment configuration should work for you in this situation... specifically the use of &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot;&gt;environment-specific variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you setup your multi-environment configuration, just set one up for each of your domain names. You would include something like this in your &lt;strong&gt;config/general.php&lt;/strong&gt; file...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'my.first.domain' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://my.first.domain/'&#xA;    )&#xA;),&#xA;'my.second.domain' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://my.second.domain/'&#xA;    )&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you've got that setup, login to your Control Panel and go to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Settings &gt; General&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Change the value of &lt;strong&gt;Site URL&lt;/strong&gt; to be &quot;{siteUrl}&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can easily use any of these variations in your template:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{{ siteUrl }}/contact-us&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;url('contact-us')&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;siteUrl('contact-us')&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It's a little tricky to explain the relationship between those three variations of &quot;site url&quot;, but here's the gist of it...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When you set an environment-specific variable in your config file, it can be parsed by Craft (in certain circumstances) with the syntax &lt;code&gt;{siteUrl}&lt;/code&gt;. Note the single set of curly braces, and the lack of spaces between the variable name and the braces.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &quot;Site URL&quot; setting in your CP is capable of parsing out environment-specific variables. So when you put &quot;{siteUrl}&quot; in there, it represents whatever you put in your config file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, when you use &lt;code&gt;{{ siteUrl }}&lt;/code&gt; in your templates, it uses whatever value is represented by the &quot;Site URL&quot; value in your CP. Since we just told that field to use the environment-specific variable, that's what will be parsed through to the front-end.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In my example, I also mentioned &lt;code&gt;url()&lt;/code&gt; and &lt;code&gt;siteUrl()&lt;/code&gt;. These two functions will automatically prepend the &quot;Site URL&quot; value to whatever string you specify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between the two only really matters &lt;strong&gt;if you're rendering a template in the Control Panel (using a plugin)&lt;/strong&gt;. &lt;code&gt;url()&lt;/code&gt; will prepend the &lt;em&gt;entire&lt;/em&gt; site url, including the &lt;code&gt;/admin/&lt;/code&gt; segment... meanwhile, &lt;code&gt;siteUrl()&lt;/code&gt; will only prepend the &lt;em&gt;base&lt;/em&gt; site url.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-10T19:42:09.973" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="914" PostTypeId="2" ParentId="912" CreationDate="2014-07-10T19:42:55.633" Score="19" Body="&lt;p&gt;You can grab a specific block type in Matrix by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.type('typeOne') %}&#xA;    {{ block.text | markdown }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to know the number of blocks of a certain type, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.type('typeOne') %}&#xA;{{ blocks | length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to search for multiple block types, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.type('typeOne, typeTwo') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For your specific example, it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set typeOneBlocks = entry.myMatrixField.type('typeOne') %}&#xA;&#xA;{% if typeOneBlocks | length %}&#xA;    &amp;lt;div class=&quot;divAWrapper&quot;&amp;gt;&#xA;        {% for block in typeOneBlocks %}&#xA;            &amp;lt;div class=&quot;divA&quot;&amp;gt;{# do stuff #}&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-10T19:42:55.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="915" PostTypeId="1" AcceptedAnswerId="917" CreationDate="2014-07-10T20:01:05.710" Score="6" ViewCount="204" Body="&lt;p&gt;Right now Globals are listed in alpha order in the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if it would be possible to reorder them somehow? Maybe when working under Settings &gt; Globals, etc.?&lt;/p&gt;&#xA;" OwnerUserId="196" LastEditorUserId="22" LastEditDate="2014-07-14T16:52:46.983" LastActivityDate="2014-07-14T16:52:46.983" Title="Is it possible to reorder globals in the back end?" Tags="&lt;control-panel&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="916" PostTypeId="1" CreationDate="2014-07-10T20:33:29.203" Score="4" ViewCount="1160" Body="&lt;p&gt;I read this &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;KB article&lt;/a&gt; about localization though, the examples are for sub-folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how to handle the same concept but, for different language based domains e.g.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com&lt;/li&gt;&#xA;&lt;li&gt;example.mx&lt;/li&gt;&#xA;&lt;li&gt;example.es&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently I'm not sure if the different sites will be based on language or country though, let's assume country for this question. For example we'll have Mexico and Spain sites, both will be in Spanish but, will have different content which relates to each country.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I asked CraftCMS about this on twitter and this was &lt;a href=&quot;https://twitter.com/natetronn/status/487326868123967488&quot; rel=&quot;nofollow&quot;&gt;their reply&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right to think that each site will have an install of craft, with the config/ general.php setup accordingly (in this case using domains instead of sub-folders?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then we'll just link to the db in it's settings on each copy of config/db.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, I'm hoping for some elaboration on this topic. Bonus points for including a multilingual, multi-domain and multi-environment for git workflow/setup in your answer ;)&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="125" LastEditDate="2014-07-14T23:51:35.963" LastActivityDate="2014-07-14T23:51:35.963" Title="Localization - How do we manage multilingual, multi-environment on multiple domains?" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;language&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="917" PostTypeId="2" ParentId="915" CreationDate="2014-07-10T20:53:00.697" Score="7" Body="&lt;p&gt;It's currently not possible to change the order in the control panel, but we might look into that for a future release.  They are currently set to display alphabetically.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-10T20:53:00.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="918" PostTypeId="2" ParentId="916" CreationDate="2014-07-10T21:07:22.903" Score="2" Body="&lt;p&gt;You have one Craft install and one DB. Do everything described in &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;that article&lt;/a&gt;, just replace the subfolder paths with the different domains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://example.com/',&#xA;        'es' =&amp;gt; 'http://example.es/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then all you have to do is to configure your webhost so that it routes those domains to different &lt;code&gt;index.php&lt;/code&gt; files. It should contain the info about the locale and point to Craft folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the Spanish site&#xA;define('CRAFT_LOCALE', 'es');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="12" LastEditDate="2014-07-10T21:09:07.247" LastActivityDate="2014-07-10T21:09:07.247" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="919" PostTypeId="1" AcceptedAnswerId="922" CreationDate="2014-07-10T21:09:44.393" Score="4" ViewCount="741" Body="&lt;p&gt;So,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to grab all entries that are related to an entry but with the following criteria:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Only from my section ($section)&lt;/li&gt;&#xA;&lt;li&gt;Only the ones that have been added to a certain field ($fieldId)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I currently have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = $section;&#xA;$criteria-&amp;gt;limit   = null;&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $element,&#xA;);&#xA;$elements = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;return $elements;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I add two relationship fields to an entry, this will return ALL the associated entries from either field. I want to limit it to just the entries attached to the one field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? Does the question make sense? :-)&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-07-10T23:39:16.923" Title="Is it possible to grab related entries that have been attached to a certain field?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="920" PostTypeId="1" AcceptedAnswerId="921" CreationDate="2014-07-10T21:12:15.417" Score="32" ViewCount="10021" Body="&lt;p&gt;There are multiple ways to set the site URL. What is the recommended way?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="22" LastEditDate="2014-07-14T23:45:46.633" LastActivityDate="2019-03-14T08:34:02.323" Title="What’s the recommended way to set the site URL?" Tags="&lt;url&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="22" ContentLicense="CC BY-SA 3.0" />
  <row Id="921" PostTypeId="2" ParentId="920" CreationDate="2014-07-10T21:12:15.417" Score="47" Body="&lt;p&gt;As of Craft 2, &lt;strong&gt;you should be using the new &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#siteurl&quot; rel=&quot;nofollow noreferrer&quot;&gt;siteUrl&lt;/a&gt; config setting&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There are two advantages to setting your site URL using this config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, The value can be set on a &lt;strong&gt;per-locale basis&lt;/strong&gt;, in a way where Craft is actually aware of all locales’ URLs on every request (unlike the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-site-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;CRAFT_SITE_URL&lt;/code&gt;&lt;/a&gt; constant, where Craft only knows the current locale’s URL). That’s a good thing because it means you can easily link to entries’ URLs across different locales, for example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_us' =&amp;gt; 'http://example.com/',&#xA;        'de'    =&amp;gt; 'http://example.com/de/',&#xA;    ),&#xA;&#xA;    // ...&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its value can also be set directly on a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;per-environment basis&lt;/a&gt;&lt;/strong&gt;. (Yes you can achieve this using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;environmentVariables&lt;/code&gt;&lt;/a&gt; config setting combined with a &lt;code&gt;{siteUrl}&lt;/code&gt; tag inside the Site URL setting within the CP’s general settings, but that’s much less direct/obvious.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://example.dev/',&#xA;        // ...&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://example.com/',&#xA;        // ...&#xA;    ),&#xA;&#xA;    // ...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those of course can be combined as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en_us' =&amp;gt; 'http://example.dev/',&#xA;            'de'    =&amp;gt; 'http://example.dev/de/',&#xA;        ),&#xA;        // ...&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en_us' =&amp;gt; 'http://example.com/',&#xA;            'de'    =&amp;gt; 'http://example.com/de/',&#xA;        ),&#xA;        // ...&#xA;    ),&#xA;&#xA;    // ...&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-03-14T08:34:02.323" LastActivityDate="2019-03-14T08:34:02.323" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="922" PostTypeId="2" ParentId="919" CreationDate="2014-07-10T23:39:16.923" Score="4" Body="&lt;p&gt;If you want to limit your relationships to a particular field, use this syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $element,&#xA;    'field' =&amp;gt; $field&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe 'field' will take:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A single or array of $field instances&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) A single or array of field IDs or field handles.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-10T23:39:16.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="923" PostTypeId="1" AcceptedAnswerId="925" CreationDate="2014-07-11T01:41:37.410" Score="3" ViewCount="336" Body="&lt;p&gt;While developing an API for a client site I recognized that there was a  tag being returned after our JSON response (generated using BaseController's returnJson method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I copy &amp;amp; pasted some of the output into The Google and found a reference to the &lt;em&gt;YII_DEBUG&lt;/em&gt; constant. I checked the value (true) and assumed it was related to devMode. I turned off devMode for this environment and the extra code went away (and YII_DEBUG===false).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't suspect that this extra output is expected while using the returnJson() method but I need to get around this. Can I turn off devMode outside of the config file? I really only want to make an exception when calling this method.&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-09-02T19:43:09.187" Title="BaseController::returnJson &amp; devMode interference" Tags="&lt;plugin-development&gt;&lt;json&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="924" PostTypeId="2" ParentId="923" CreationDate="2014-07-11T02:17:07.813" Score="1" Body="&lt;p&gt;You can turn off dev mode for just this page/call if you'd like, using the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/configservice#set&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;config-&amp;gt;set&lt;/code&gt; API method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;set('devMode', false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget to turn it back on after your function runs (if it still matters at that point).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-11T02:17:07.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="925" PostTypeId="2" ParentId="923" CreationDate="2014-07-11T03:32:09.110" Score="4" Body="&lt;p&gt;I had the same problem. See Brad's response here to so this without messing with devMode: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/488/console-script-tags-garbling-up-non-html-output-e-g-json-when-in-devmode&quot;&gt;Console script tags garbling up non-html output (e.g. json) when in devMode&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be nice if this happened automatically when specifically outputting non-html, though.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-11T03:32:09.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="926" PostTypeId="1" AcceptedAnswerId="929" CreationDate="2014-07-11T03:40:41.870" Score="6" ViewCount="197" Body="&lt;p&gt;When I add the company logo it appears aligned to the left with a lot of space on the right side. How can I make it appear to the center?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that adding &lt;code&gt;background-position: top center;&lt;/code&gt; to the CSS aligns it to the center, but I don't know where I can set this change permanent.&lt;/p&gt;&#xA;" OwnerUserId="456" LastActivityDate="2014-07-13T00:08:46.227" Title="How to tweak login logo position?" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="928" PostTypeId="1" AcceptedAnswerId="930" CreationDate="2014-07-11T05:56:46.163" Score="2" ViewCount="1035" Body="&lt;p&gt;In Craft we have the table field type and each column can have a type. This field type is restricted to only text, number and checkboxes. Is there a plugin to add entries field type to the column types?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if there isn't, can someone guide me to the proper files which I should look into to modify and add the field types myself by making a new plugin.&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="57" LastEditDate="2014-07-11T16:59:53.967" LastActivityDate="2017-04-05T16:19:41.267" Title="Plugin for entries table field" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="929" PostTypeId="2" ParentId="926" CreationDate="2014-07-11T07:04:05.707" Score="8" Body="&lt;p&gt;You can use this &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot;&gt;Control Panel CSS plugin&lt;/a&gt; to add whatever CSS you'd like.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-11T07:04:05.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="930" PostTypeId="2" ParentId="928" CreationDate="2014-07-11T07:41:51.577" Score="2" Body="&lt;p&gt;Is there any reason that what you're doing can't be accomplished using a Matrix field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &quot;no, a Matrix field isn't sufficient&quot;, then you'll need to build a custom plugin to handle it. Assuming that this is the path that you are taking, you'll want to get familiar with this file:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/app/templates/_includes/forms.html&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;These macros will help you to generate just about every field type that Craft has natively available.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I built a plugin awhile back which puts a select dropdown menu inside of a table. The table macro is pre-rendered via PHP, turning it into a string. I then output that string directly into my actual page template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see exactly how I did it, check out &lt;a href=&quot;https://github.com/lindseydiloreto/craft-phptweak/blob/master/phptweak/PhpTweakPlugin.php#L59&quot; rel=&quot;nofollow&quot;&gt;this example code...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may not answer your question 100%, but hopefully it points you in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-11T07:41:51.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="931" PostTypeId="2" ParentId="928" CreationDate="2014-07-11T09:24:36.900" Score="2" Body="&lt;p&gt;This was intentionally omitted from the table field.  For more complex data stores you should use Matrix. &lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-07-11T09:24:36.900" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="932" PostTypeId="1" AcceptedAnswerId="1499" CreationDate="2014-07-11T10:13:28.233" Score="12" ViewCount="46817" Body="&lt;p&gt;How do I check what type my variable of (string, integer, boolean, array, dictionary,  etc)?&lt;/p&gt;&#xA;" OwnerUserId="250" LastActivityDate="2019-11-11T11:46:16.330" Title="How to check variable type?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;variable-type&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="933" PostTypeId="2" ParentId="932" CreationDate="2014-07-11T10:34:05.933" Score="12" Body="&lt;p&gt;To my knowledge this is not possible natively in Twig. Depending on your situation / template needs here are some useful tests&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if foo is iterable %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Array or object&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if foo is same as(true) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically identical to using === in php&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-07-11T10:34:05.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="935" PostTypeId="1" AcceptedAnswerId="10386" CreationDate="2014-07-11T13:34:42.620" Score="2" ViewCount="8233" Body="&lt;p&gt;I tried the &lt;strong&gt;attribute&lt;/strong&gt; twig function for this but that did not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, what I'd like to achieve is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This string variable is a name of the object #}&#xA;{% set myForm = 'form' %}&#xA;{# I'd like to call the 'errors' method on the 'form' object #}&#xA;{% set formErrors = myForm.errors %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with the above code is that the &lt;em&gt;errors&lt;/em&gt; method will be called on the &lt;strong&gt;myForm&lt;/strong&gt; object instead of the &lt;strong&gt;form&lt;/strong&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve what I'm trying to do here?&lt;/p&gt;&#xA;" OwnerUserId="75" LastActivityDate="2015-06-28T14:17:14.817" Title="Can I call methods on an object represented by a string variable?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="936" PostTypeId="1" AcceptedAnswerId="957" CreationDate="2014-07-11T13:46:35.927" Score="7" ViewCount="1625" Body="&lt;p&gt;I'm looking to have the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; inserted without the wrapping &lt;code&gt;&amp;lt;p /&amp;gt;&lt;/code&gt;. I'm assuming I can tie in to one of the callback functions to do this? There is a &lt;code&gt;fileUploadCallback&lt;/code&gt; function available but based on nomenclature, doesn't seem like that would help me if I added a path to a remote image versus uploading one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone done this yet?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2016-11-04T00:06:43.337" Title="How do I prevent Redactor from wrapping &lt;img&gt; with &lt;p /&gt;" Tags="&lt;entries&gt;&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="938" PostTypeId="2" ParentId="935" CreationDate="2014-07-11T16:01:22.593" Score="2" Body="&lt;p&gt;Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;attribute function&lt;/a&gt; allows you to set the method as a string and not the object. The object has to be an actual object, even with that function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set object = craft.entries.order('postdate').last() %}&#xA;{% set method = 'title' %}&#xA;&#xA;{{ attribute(object, method) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only workaround I can think of is to link your object-representing string to an actual object in your template. But this makes little sense as you probably wouldn't have set it as a string to begin with, hehe. Anyways:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if string == &quot;craft.entries.order('postdate').last()&quot; %}&#xA;    {% set object = craft.entries.order('postdate').last() %}&#xA;{% endif %}&#xA;&#xA;{{ attribute(object, method) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-11T16:01:22.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="939" PostTypeId="1" AcceptedAnswerId="940" CreationDate="2014-07-11T16:09:14.850" Score="17" ViewCount="12664" Body="&lt;p&gt;Whether I'm using the Reroute plugin or plugging it in .htaccess, changing the path elsewhere appends the query in the end. How can I remove?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Redirect 301 /blog/category /blog/archive&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the line I have in my .htaccess&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I go to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://domain.com/blog/category/category-name&quot;&gt;http://domain.com/blog/category/category-name&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it takes me to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://domain.com/blog/archive/category-name?p=blog/category/category-name&quot;&gt;http://domain.com/blog/archive/category-name?p=blog/category/category-name&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's going on here? &lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2016-03-29T20:39:19.957" Title="301 Redirects Appends ?p=original/url/path - how can I remove?" Tags="&lt;url&gt;&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="940" PostTypeId="2" ParentId="939" CreationDate="2014-07-11T16:11:46.717" Score="20" Body="&lt;p&gt;The issue here is that your &lt;code&gt;Redirect&lt;/code&gt; directive is conflicting with Craft’s index.php-hiding &lt;code&gt;RewriteRule&lt;/code&gt; directive. &lt;em&gt;(&lt;code&gt;Redirect&lt;/code&gt; is a &lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/mod_alias.html&quot;&gt;mod_alias&lt;/a&gt; directive and &lt;code&gt;RewriteRule&lt;/code&gt; is a &lt;a href=&quot;http://httpd.apache.org/docs/current/mod/mod_rewrite.html&quot;&gt;mod_rewrite&lt;/a&gt; directive. They’re two separate modules that can be used for the same thing, but lead to unexpected consequences when used together.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix this, use a &lt;code&gt;RewriteRule&lt;/code&gt; directive for your own custom redirects as well, rather than &lt;code&gt;Redirect&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^blog/category(/.*)?$ /blog/archive$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure that you place that &lt;em&gt;&lt;strong&gt;before&lt;/strong&gt;&lt;/em&gt; Craft’s redirect.&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="9" LastEditDate="2014-07-11T18:02:15.237" LastActivityDate="2014-07-11T18:02:15.237" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="941" PostTypeId="1" AcceptedAnswerId="943" CreationDate="2014-07-11T16:15:49.820" Score="4" ViewCount="475" Body="&lt;p&gt;I would like to create a route for the entry types of a specific section, pointing to a single template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do this automatically? So far I haven't had luck, I'm thinking something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;route = /{ mysection.type }&lt;/li&gt;&#xA;&lt;li&gt;template = type/index.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Or would I need to create a route for each entry type and all of them pointing to same template?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;route 1 = /entryType1&lt;/li&gt;&#xA;&lt;li&gt;route 2 = /entryType2&lt;/li&gt;&#xA;&lt;li&gt;route 3 = /entryType3&lt;/li&gt;&#xA;&lt;li&gt;shared template = type/index.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The reason I would like to do it this way, as opposed to how it has been shown before, &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-urls&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;; is because I would like to keep all the URL's with a date format, i.e.: &lt;em&gt;example.com/2014/07/11/slug&lt;/em&gt; so that I can then implement an archive template. But I still need a way to filter by entry types (a total of 12 types). So that at the end of the day I end up with URLs like these ones:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/2014/01/01/&lt;strong&gt;example-entry&lt;/strong&gt; - URL for Example Entry&lt;/li&gt;&#xA;&lt;li&gt;example.com/&lt;strong&gt;2014/01/01/&lt;/strong&gt; - URL for listing entries from day&lt;/li&gt;&#xA;&lt;li&gt;example.com/&lt;strong&gt;2014/01/&lt;/strong&gt; - URL for listing entries from month&lt;/li&gt;&#xA;&lt;li&gt;example.com/&lt;strong&gt;2014/&lt;/strong&gt; - URL for listing entries from year&lt;/li&gt;&#xA;&lt;li&gt;example.com/&lt;strong&gt;video/&lt;/strong&gt; - URL for Video types of entry&lt;/li&gt;&#xA;&lt;li&gt;example.com/&lt;strong&gt;audio/&lt;/strong&gt; - URL for Audio types of entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to solve this?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-07-11T17:42:38.320" Title="New route for entry types" Tags="&lt;entry-type&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="942" PostTypeId="2" ParentId="939" CreationDate="2014-07-11T16:25:48.343" Score="2" Body="&lt;p&gt;What happens if you add a &lt;code&gt;?&lt;/code&gt; to the rule:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^blog/category?$ /blog/archive [R=301,L,NE]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="237" LastEditorUserId="250" LastEditDate="2014-07-11T17:22:01.850" LastActivityDate="2014-07-11T17:22:01.850" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="943" PostTypeId="2" ParentId="941" CreationDate="2014-07-11T16:29:45.487" Score="5" Body="&lt;p&gt;You can have entry type specific templates for your &lt;em&gt;entry pages&lt;/em&gt;, see this &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;docs article&lt;/a&gt; on how you can do this. And for your &lt;em&gt;archive pages&lt;/em&gt;, just set a route for each of them and point it to the corresponding index/listings template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically you end up with something like this for your entries:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;media/_entry.html (example.com/2014/01/01/example-entry)&lt;/li&gt;&#xA;&lt;li&gt;media/_types/audio.html (included in _entry.html if entry type is audio)&lt;/li&gt;&#xA;&lt;li&gt;media/_types/video.html (included in _entry.html if entry type is video)&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and this for your archive pages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;media/index.html (example.com/2014/01/01/ etc.)&lt;/li&gt;&#xA;&lt;li&gt;media/audio/index.html (example.com/audio/)&lt;/li&gt;&#xA;&lt;li&gt;media/video/index.html (example.com/video/)&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you don't want to set new routes for the entry type specific archive pages you can also put the templates in a folder whose index.html template file is called automatically if no route exists (eg. audio/index.html for example.com/audio/).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I'd make good use of include and extend in these templates to make this as DRY and easy to maintain as possible.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-11T17:42:38.320" LastActivityDate="2014-07-11T17:42:38.320" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="944" PostTypeId="2" ParentId="939" CreationDate="2014-07-11T16:30:23.017" Score="6" Body="&lt;p&gt;One way you can avoid this is by making a small change to the htaccess rules for removing index.php from Craft URLs. You can remove the query string from &lt;code&gt;RewriteRule (.+) index.php?p=$1 [QSA,L]&lt;/code&gt; and replace it with &lt;code&gt;/$1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the full set of rules to remove index.php would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php/$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to work fine in my test and prevents the query string from being appended to the URL when using &lt;code&gt;Redirect 301&lt;/code&gt; in htaccess.&lt;/p&gt;&#xA;" OwnerUserId="43" LastActivityDate="2014-07-11T16:30:23.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="945" PostTypeId="2" ParentId="900" CreationDate="2014-07-11T16:33:56.567" Score="1" Body="&lt;p&gt;I think the question of the use-case is vital here. If you want to check whether a large number is prime or not, you will need a plugin and a lot of math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your number is guaranteed not too big, I would use twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot; rel=&quot;nofollow&quot;&gt;in&lt;/a&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set primes = [2, 3, 5, 6, 11, 13, 17, 19] %}&#xA;{% if n &amp;gt; primes|last %}&#xA;  too big to tell&#xA;{% elseif n in primes %}&#xA;  {{n}} is prime&#xA;{% else %}&#xA;  {{n}} is composite&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or check for prime factors in a loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set primes = [2, 3, 5, 6, 11, 13, 17, 19] %}&#xA;{% if n &amp;gt; (primes|last) * (primes|last) %}&#xA;  too big to tell&#xA;{% else %}&#xA;  {% set isComposite = false %}&#xA;  {% for p in primes %}&#xA;    {% if (not isComposite) and  (n is divisibleby (p)) %}&#xA;      {{n}} is composite (divisible by {{p}})&#xA;      {% set isComposite = true %}&#xA;      {# optional break #}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;  {% if not isComposite %}&#xA;    {{n}} is prime&#xA;  {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://craftcms.stackexchange.com/questions/862/is-it-possible-to-break-out-of-a-loop-in-twig&quot;&gt;Twig doesn't have a native break tag, but you can use a plugin&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-11T16:33:56.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="946" PostTypeId="1" AcceptedAnswerId="947" CreationDate="2014-07-11T16:49:28.320" Score="2" ViewCount="308" Body="&lt;p&gt;Method &quot;siteUrl&quot; for object &quot;Craft\ConfigVariable&quot; does not exist&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in otherLocales %}&#xA;&#xA;    {# Is this an entry page? #}&#xA;       {% if entry is defined %}&#xA;&#xA;         {# Find the current entry in the other locale #}&#xA;        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;&#xA;        {# Make sure that it's actually localized to this locale #}&#xA;       {% if localeEntry.locale == locale %}&#xA;&#xA;           {# Output a link to it #}&#xA;            &amp;lt;link rel=&quot;alternate&quot; hreflang=&quot;{{ locale }}&quot; href=&quot;{{ craft.config.siteUrl[locale] ~ (localeEntry.uri != '__home__' ? localeEntry.uri) }}&quot;&amp;gt;&#xA;         {% endif %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {# Just output the same path with the locale's base URL #}&#xA;        &amp;lt;link rel=&quot;alternate&quot; hreflang=&quot;{{ locale }}&quot; href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="125" LastEditDate="2014-07-14T23:52:23.520" LastActivityDate="2014-07-14T23:52:23.520" Title="Template error: Method &quot;siteUrl&quot; for object &quot;Craft\ConfigVariable&quot; does not exist" Tags="&lt;localization&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="947" PostTypeId="2" ParentId="946" CreationDate="2014-07-11T16:52:11.060" Score="4" Body="&lt;p&gt;Did you &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;configure siteUrl&lt;/a&gt; in &lt;code&gt;general.php&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://example.com/en/',&#xA;        'de' =&amp;gt; 'http://example.com/de/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-11T16:52:11.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="948" PostTypeId="1" AcceptedAnswerId="950" CreationDate="2014-07-11T17:27:59.553" Score="4" ViewCount="99" Body="&lt;p&gt;I have a route set up with a tag:&#xA;news/tag/[tag] =&gt; news/_tag&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I generate urls that will match that route for all possible tags (including tags with punctuation)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I resolve that url back to a tag (including tags with punctuation)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that twigs &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/url_encode.html&quot; rel=&quot;nofollow&quot;&gt;url_encode&lt;/a&gt; filter &lt;code&gt;href=&quot;{{tag.name|url_encode}}&quot;&lt;/code&gt; will generate urls that don't route to the template for some tags.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="22" LastEditDate="2014-07-11T23:38:49.843" LastActivityDate="2014-07-11T23:38:49.843" Title="Bullet-proofing tags with punctuation" Tags="&lt;templating&gt;&lt;tags&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="950" PostTypeId="2" ParentId="948" CreationDate="2014-07-11T17:45:04.297" Score="4" Body="&lt;p&gt;To generate the url, use the &lt;a href=&quot;https://gist.github.com/boboldehampsink/7354431/download#&quot; rel=&quot;nofollow&quot;&gt;slugify&lt;/a&gt; plugin: &lt;code&gt;href=&quot;{{tag.name|slugify}}&quot;&lt;/code&gt;. Slugify uses Craft's slug technology, so the slugs are always recognized by the router.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To resolve the url back to a tag, use &lt;code&gt;search&lt;/code&gt; in the &lt;code&gt;news/_tag&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set thisTag = craft.tags.search('name:&quot;'~tag~'&quot;').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.tags.name(tag).first()&lt;/code&gt; will often work, but not for all slugs, so this is also possible, and may be more efficient if that is an issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisTag = craft.tags.name(tag).first() %}&#xA;{% if not thisTag %} {% set thisTag = craft.tags.search('name:&quot;'~tag~'&quot;').first() %} {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-11T17:45:04.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="951" PostTypeId="1" AcceptedAnswerId="954" CreationDate="2014-07-11T18:39:11.053" Score="1" ViewCount="121" Body="&lt;p&gt;I'm using the createElementsSelectorModal to access certain element types as described by Brandon &lt;a href=&quot;https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this implementation, how would I clear out &quot;disabledElementIds&quot;? So that if an Entry is added and then removed I can tell the Modal it should be selectable again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-11T21:30:31.420" Title="How would I change &quot;disabledElementIds&quot; when using createElementSelectorModal()?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="952" PostTypeId="1" AcceptedAnswerId="1018" CreationDate="2014-07-11T19:13:28.067" Score="18" ViewCount="6061" Body="&lt;p&gt;While working in the Craft admin area, on a fresh install, I get logged out every once in a while. It makes the CMS unusable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Clearing cookies&lt;/li&gt;&#xA;&lt;li&gt;Resetting the cache in the backend&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sometimes it logs out after 1 pageview, sometimes after 10. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a Macbook Pro, 10.9.3 Mavericks. This happens in both Chrome and Safari (haven't tried Firefox).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running Vagrant with: PHP 5.5.12, Ubunutu 14.04, Nginx. Accessing the project locally via &lt;a href=&quot;http://project.craft.dev&quot;&gt;http://project.craft.dev&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone experienced something similar? Are there any error logs for this kind of thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: in the craft.log I get a few errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/07/11 19:38:56 [trace] [system.db.CDbCommand] Querying SQL: SELECT count(`id`) FROM `craft_tasks` WHERE (level = 0) AND (status = :status). Bound with :status='error' &#xA;in /vagrant/dlfm/craft/craft/app/etc/db/DbCommand.php (79) &#xA;in /vagrant/dlfm/craft/craft/app/services/TasksService.php (420) &#xA;in /vagrant/dlfm/craft/craft/app/controllers/TasksController.php (57)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/07/11 19:38:55 [error] [php] session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/vagrant/dlfm/craft/craft/storage/runtime/sessions/) (/vagrant/dlfm/craft/craft/app/services/HttpRequestService.php:852)&#xA;Stack trace:&#xA;#0 /vagrant/dlfm/craft/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TasksController-&amp;gt;actionRunPendingTasks()&#xA;#1 /vagrant/dlfm/craft/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#2 /vagrant/dlfm/craft/craft/app/framework/web/CController.php(286): Craft\TasksController-&amp;gt;runAction()&#xA;#3 /vagrant/dlfm/craft/craft/app/framework/web/CController.php(265): Craft\TasksController-&amp;gt;runActionWithFilters()&#xA;#4 /vagrant/dlfm/craft/craft/app/framework/web/CWebApplication.php(282): Craft\TasksController-&amp;gt;run()&#xA;#5 /vagrant/dlfm/craft/craft/app/etc/web/WebApp.php(863): Craft\WebApp-&amp;gt;runController()&#xA;#6 /vagrant/dlfm/craft/craft/app/etc/web/WebApp.php(252): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#7 /vagrant/dlfm/craft/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#8 /vagrant/dlfm/craft/craft/app/index.php(196): Craft\WebApp-&amp;gt;run()&#xA;#9 /vagrant/dlfm/craft/public/index.php(14): require_once()&#xA;REQUEST_URI=/index.php/admin/actions/tasks/runPendingTasks&#xA;in /vagrant/dlfm/craft/craft/app/services/HttpRequestService.php (852)&#xA;in /vagrant/dlfm/craft/craft/app/controllers/TasksController.php (37)&#xA;in /vagrant/dlfm/craft/craft/app/etc/web/WebApp.php (863)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this one looks most suspect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;24. 2014/07/11 19:41:47 [error] [application] Tried to restore session from a cookie, but the given login name does not match the given uid. UID: 9d515b08-1073-4872-a0e2-155c389a2991 and loginName: Jason.&#xA;&#xA;24. 2014/07/11 19:41:47 [error] [application] Tried to restore session from a cookie, but the given hashed database token value does not appear to belong to the given login name. Hashed db value: 37bb858b4b13b688c4034fe5eb127f75f4931387czozNjoiNDBlNTk0YWQtNGYxZS00NjAxLWEwY2UtZDJlY2NhNDkwMmQ1Ijs= and loginName: Jason.&#xA;in /vagrant/dlfm/craft/craft/app/services/UserSessionService.php (797)&#xA;in /vagrant/dlfm/craft/craft/app/services/UserSessionService.php (64)&#xA;in /vagrant/dlfm/craft/craft/app/etc/web/WebApp.php (592)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2014-07-11T19:44:57.723" LastActivityDate="2019-10-31T17:59:02.617" Title="Craft constantly logging out from admin area" Tags="&lt;users&gt;" AnswerCount="9" CommentCount="5" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="953" PostTypeId="1" AcceptedAnswerId="955" CreationDate="2014-07-11T19:30:15.740" Score="5" ViewCount="1087" Body="&lt;p&gt;We want to mask specific action routes in our project's routes.php file. Currently what we have looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // /actions/api/element/section/name/{$name}/&#xA;    'api/test/(?P&amp;lt;name&amp;gt;)'  =&amp;gt; ['action' =&amp;gt; 'api/element/section'],&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We would like to pass name into the action array somehow. Is there something documented or undocumented that I'm missing? Or is what I'm attempting not possible at this time?&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="9" LastEditDate="2014-07-11T19:59:51.173" LastActivityDate="2014-07-11T21:17:56.210" Title="How can I implement advanced action routes (in routes.php)?" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="954" PostTypeId="2" ParentId="951" CreationDate="2014-07-11T19:54:57.990" Score="3" Body="&lt;p&gt;Elements can be manually enabled/disabled from the modal after it has been initialized using the following methods:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myModal.elementIndex.enableElementsById(elementIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myModal.elementIndex.disableElementsById(elementIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both functions accept a number (single element ID) or an array of numbers (multiple element IDs).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-11T19:54:57.990" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="955" PostTypeId="2" ParentId="953" CreationDate="2014-07-11T19:59:15.373" Score="5" Body="&lt;p&gt;Yes it’s possible. First you will need to update your route key so that you’re capturing the &lt;code&gt;name&lt;/code&gt; parameter with a valid &lt;a href=&quot;http://php.net/manual/en/regexp.reference.subpatterns.php&quot; rel=&quot;nofollow&quot;&gt;named subpattern&lt;/a&gt;. (You were close, but missing the actual &lt;em&gt;pattern&lt;/em&gt; part of it).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'api/test/(?P&amp;lt;name&amp;gt;[^\/]+)' =&amp;gt; ['action' =&amp;gt; 'api/element/section'],&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any named subpattern matches in your route will be passed to your controller action’s &lt;code&gt;$variables&lt;/code&gt; argument, if it has one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Api_ElementController extends BaseController&#xA;{&#xA;    // ...&#xA;&#xA;    public function actionSection(array $variables = array())&#xA;    {&#xA;        $name = $variables['name'];&#xA;&#xA;        // ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you specifically need to call the argument “&lt;code&gt;$variables&lt;/code&gt;”, and you need to typeset it to an &lt;code&gt;array&lt;/code&gt; for this to work.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-11T21:17:56.210" LastActivityDate="2014-07-11T21:17:56.210" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="956" PostTypeId="1" AcceptedAnswerId="997" CreationDate="2014-07-11T20:00:57.293" Score="2" ViewCount="189" Body="&lt;p&gt;I'm in the context of an Entry that has a Matrix field, and one of those Matrix fields is a Dropdown called &lt;code&gt;subsection&lt;/code&gt;. I want to grab all Matrix blocks that have &lt;code&gt;subsection&lt;/code&gt; set to 'intro'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I'm trying to do it and it definitely doesn't work. Is there another way to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrix.subsection('intro') %}&#xA;…&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="414" LastEditorUserId="57" LastEditDate="2014-07-11T20:02:48.817" LastActivityDate="2014-07-12T18:08:21.950" Title="Return all Matrix blocks with a drop down set to a specified value" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="957" PostTypeId="2" ParentId="936" CreationDate="2014-07-11T20:05:40.407" Score="4" Body="&lt;p&gt;I’m not sure that this is possible – Redactor has some checks in its code to make sure everything lives within a block-level element like &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be better off using a Matrix field instead, with Text and Image block types. You can still use a Redactor field within your Text block type; just disable the Image toolbar button on it from your Redactor config in craft/config/redactor/. Give the Image block type an actual Assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your templates you’ll have full control over the image markup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;    {% if block.type == 'text' %}&#xA;&#xA;        {{ block.myRichTextField }}&#xA;&#xA;    {% elseif block.type == 'image' %}&#xA;&#xA;        {% set image = block.myAssetsField.first() %}&#xA;        {% if image %}&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;{{ image.width }}&quot; height=&quot;{{ image.height }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-11T20:05:40.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="958" PostTypeId="1" AcceptedAnswerId="964" CreationDate="2014-07-11T20:08:46.157" Score="4" ViewCount="2202" Body="&lt;p&gt;I'm working with the contact form plugin and would like to test for post data to see if the form was just submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this code always throws a template error.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;Variable &quot;test&quot; does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set success = craft.request.getPost(test) %}&#xA;{% if success %}&#xA;    form was just submitted&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="196" LastEditorUserId="177" LastEditDate="2014-07-25T17:21:57.393" LastActivityDate="2014-07-25T17:21:57.393" Title="Access POST data to conditionally display form" Tags="&lt;templating&gt;&lt;post&gt;&lt;request&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="959" PostTypeId="1" AcceptedAnswerId="965" CreationDate="2014-07-11T20:20:13.643" Score="3" ViewCount="279" Body="&lt;p&gt;If I set my timezone in server and in Craft general settings, do I still need to change it in php.ini? And how does Craft handle timezone in those three places?&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2014-07-11T21:19:54.810" Title="Do I need to change the date.timezone in php.ini?" Tags="&lt;timezone&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="960" PostTypeId="2" ParentId="952" CreationDate="2014-07-11T20:21:59.020" Score="2" Body="&lt;p&gt;Check if you can write in /vagrant/dlfm/craft/craft/storage/runtime/sessions/.&#xA;There is where the sessions are being stored. &#xA;To test, try chmod 777 -R /vagrant/dlfm/craft/craft/storage/runtime/sessions and try again.&#xA;Those permissions are too wide, but if this works after you might know the cause.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-07-11T20:21:59.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="961" PostTypeId="1" AcceptedAnswerId="17525" CreationDate="2014-07-11T20:50:04.950" Score="17" ViewCount="11953" Body="&lt;p&gt;I'm looking for the recommended way of how to configure Nginx server to run Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I use the following configuration, it works, but I don't know if it could be better:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen 80;&#xA;    server_name example.com;&#xA;    root /home/vagrant/craft/public;&#xA;&#xA;    index index.html index.php;&#xA;&#xA;    charset utf-8;&#xA;&#xA;    location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;&#xA;    location = /favicon.ico { access_log off; log_not_found off; }&#xA;    location = /robots.txt  { access_log off; log_not_found off; }&#xA;&#xA;    access_log off;&#xA;    error_log  /var/log/nginx/example.com-error.log error;&#xA;&#xA;    error_page 404 /index.php;&#xA;&#xA;    location ~ \.php$ {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;    }&#xA;&#xA;    location ~* (?:^|/)\. {&#xA;        deny all;&#xA;    }&#xA;&#xA;    location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {&#xA;        deny all;&#xA;    }&#xA;&#xA;    location ~* \.(?:manifest|appcache|html?|xml|json)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires -1;&#xA;        access_log /var/log/nginx/example.com-access.log;&#xA;    }&#xA;&#xA;    location ~* \.(?:rss|atom)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires 1h;&#xA;        add_header Cache-Control &quot;public&quot;;&#xA;    }&#xA;&#xA;    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires 1M;&#xA;        add_header Cache-Control &quot;public&quot;;&#xA;    }&#xA;&#xA;    location ~* \.(?:css|js)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires 1y;&#xA;        add_header Cache-Control &quot;public&quot;;&#xA;    }&#xA;&#xA;    location ~* \.(?:ttf|ttc|otf|eot|woff)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires 1M;&#xA;        add_header Cache-Control &quot;public&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="246" LastActivityDate="2016-11-01T19:01:13.370" Title="What is the recommended Nginx configuration for Craft?" Tags="&lt;server&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="962" PostTypeId="5" CreationDate="2014-07-11T21:17:21.643" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-11T21:17:21.643" LastActivityDate="2014-07-11T21:17:21.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="963" PostTypeId="4" CreationDate="2014-07-11T21:17:21.643" Score="0" Body="Information about an error displayed when an unexpected condition (error) occurs." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-11T21:42:41.270" LastActivityDate="2014-07-11T21:42:41.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="964" PostTypeId="2" ParentId="958" CreationDate="2014-07-11T21:19:41.313" Score="9" Body="&lt;p&gt;I think you want this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set success = craft.request.getPost('test') %}&#xA;{% if success %}form was just submitted{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pass a string to &lt;code&gt;getPost()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-11T21:19:41.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="965" PostTypeId="2" ParentId="959" CreationDate="2014-07-11T21:19:54.810" Score="3" Body="&lt;p&gt;This is from the Craft Documentation about &lt;a href=&quot;http://buildwithcraft.com/docs/date-time-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Date/Time Fields&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note: Dates and times [...] are displayed in the site’s timezone, however they get stored in UTC like all other dates in Craft.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additionally you can also use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter, which allows you to specify a different timezone for the output (&lt;a href=&quot;https://php.net/manual/en/timezones.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;list of supported timezones&lt;/a&gt;). If you want to bind a timezone to a specific site locale (multi-lingual sites), there's a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/268/&quot;&gt;dedicated Q/A&lt;/a&gt; on how to do that.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-11T21:19:54.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="966" PostTypeId="5" CreationDate="2014-07-11T21:21:47.777" Score="0" Body="&lt;p&gt;Entries generally hold the content that you want to display on your web pages. Each entry has an Author, a Post Date, an Expiration Date (if desired), a status (enabled or disabled), and of course, content. If you have Craft Client or Craft Pro, you will also be able to create drafts of entries that live alongside the current live version of the entry, and you’ll also be able to view past versions of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally each entry will have a stake in its own primary URL on your site, though any entry can be fetched from anywhere if your template needs it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Craft's &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sections and Entries Documentation&lt;/a&gt; for more.&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2017-05-10T02:01:53.993" LastActivityDate="2017-05-10T02:01:53.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="967" PostTypeId="4" CreationDate="2014-07-11T21:21:47.777" Score="0" Body="Entries hold the content that you want to display on your web pages. Each entry has an Author, a Post Date, an Expiration Date (if desired), a status (enabled or disabled), and, of course, content. " OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-11T21:42:47.383" LastActivityDate="2014-07-11T21:42:47.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="968" PostTypeId="2" ParentId="735" CreationDate="2014-07-11T21:23:02.767" Score="2" Body="&lt;p&gt;I finally got the chance to update Craft from 2.0 to 2.1 and that seems to have made the cache tag function as expected. (And it is terrific.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help,&#xA;Willhaus&lt;/p&gt;&#xA;" OwnerUserId="229" LastActivityDate="2014-07-11T21:23:02.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="969" PostTypeId="5" CreationDate="2014-07-11T21:23:43.157" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-11T21:23:43.157" LastActivityDate="2014-07-11T21:23:43.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="970" PostTypeId="4" CreationDate="2014-07-11T21:23:43.157" Score="0" Body="In Craft, you define your site’s HTML output with templates.&#xD;&#xA;&#xD;&#xA;Templates are files that live within your craft/templates folder. The structure of your templates is completely up to you – you can put templates at the root of that folder, within subdirectories, or within subdirectories’ subdirectories (and on and on)." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-11T21:42:28.633" LastActivityDate="2014-07-11T21:42:28.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="971" PostTypeId="5" CreationDate="2014-07-11T21:24:33.270" Score="0" Body="&lt;p&gt;See Craft's &lt;a href=&quot;https://craftcms.com/docs/assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets Documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="22" LastEditDate="2017-05-10T02:01:14.203" LastActivityDate="2017-05-10T02:01:14.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="972" PostTypeId="4" CreationDate="2014-07-11T21:24:33.270" Score="0" Body="Files managed by Craft, stored in physical folders or (with Craft Pro) on Amazon S3, Rackspace Cloud, and Google Cloud." OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-07-14T21:14:16.250" LastActivityDate="2014-07-14T21:14:16.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="973" PostTypeId="5" CreationDate="2014-07-11T21:25:43.190" Score="0" Body="&lt;p&gt;Read more in Craft's &lt;a href=&quot;https://craftcms.com/docs/users&quot; rel=&quot;nofollow noreferrer&quot;&gt;Users Documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="22" LastEditDate="2017-05-10T02:09:33.850" LastActivityDate="2017-05-10T02:09:33.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="974" PostTypeId="4" CreationDate="2014-07-11T21:25:43.190" Score="0" Body="Craft member accounts." OwnerUserId="250" LastEditorUserId="22" LastEditDate="2014-07-14T21:12:52.267" LastActivityDate="2014-07-14T21:12:52.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="975" PostTypeId="5" CreationDate="2014-07-11T21:27:13.537" Score="0" Body="&lt;p&gt;Matrix fields have the following settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configuration&lt;/strong&gt; – This is where you configure which block types should be available to your Matrix field, and which sub-fields each of those block types should have.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Max Blocks&lt;/strong&gt; – The maximum number of blocks that can be created within the field. (Default is no limit.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix Fields Documentation&lt;/a&gt; for more detail.&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="22" LastEditDate="2017-05-10T02:07:18.077" LastActivityDate="2017-05-10T02:07:18.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="976" PostTypeId="4" CreationDate="2014-07-11T21:27:13.537" Score="0" Body="Matrix fields allow you to create multiple blocks of content within a single field." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-11T21:43:01.800" LastActivityDate="2014-07-11T21:43:01.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="977" PostTypeId="2" ParentId="951" CreationDate="2014-07-11T21:30:31.420" Score="1" Body="&lt;p&gt;Well, this probably wasn't the best way to go about it, but I solved this by manually defining what is un-selectable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var unSelectable = [1,2,3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I keep track of the array as things happen in the DOM and pop items in and out. Then, I pass them to the function I use to call Craft.createElementSelectorModal() setting disabledElementIds manually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;disabledElementIds: unSelectable,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-07-11T21:30:31.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="978" PostTypeId="5" CreationDate="2014-07-11T21:35:26.800" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-11T21:35:26.800" LastActivityDate="2014-07-11T21:35:26.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="979" PostTypeId="4" CreationDate="2014-07-11T21:35:26.800" Score="0" Body="Variable a symbolic name associated with a value that may be changed" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-11T21:42:37.627" LastActivityDate="2014-07-11T21:42:37.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="980" PostTypeId="2" ParentId="961" CreationDate="2014-07-11T21:41:35.470" Score="11" Body="&lt;p&gt;Definitely not an nginx expert, but this has been working well for anyone that's tried it so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;  listen 8080 default;&#xA;  charset utf8;&#xA;  server_name example.com;&#xA;  root /path/to/example.com/public;&#xA;  index index.php index.html;&#xA;&#xA;  # Logs&#xA;  error_log /usr/local/etc/nginx/logs/example.com.error.log debug;&#xA;  access_log /usr/local/etc/nginx/logs/example.com.access.log;&#xA;&#xA;  location ~ \.php$ {&#xA;    include fastcgi_params;&#xA;    fastcgi_pass 127.0.0.1:9000;&#xA;    fastcgi_index index.php;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;  }&#xA;&#xA;  location ~ ^(.*)$ {&#xA;      try_files $uri $uri/ /index.php?p=$uri&amp;amp;$args;&#xA;  }&#xA;&#xA;  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {&#xA;    expires max;&#xA;    add_header Pragma public;&#xA;    add_header Cache-Control &quot;public, must-revalidate, proxy-revalidate&quot;;&#xA;  }&#xA;&#xA;  location = /robots.txt  { access_log off; log_not_found off; }&#xA;  location = /favicon.ico { access_log off; log_not_found off; }&#xA;  location ~ /\. { access_log off; log_not_found off; deny all; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that it's making a few assumptions about how you've setup php-fpm and what ports things are listening on, so those may need to be adjusted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-11T21:41:35.470" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="981" PostTypeId="1" AcceptedAnswerId="986" CreationDate="2014-07-11T21:45:59.753" Score="3" ViewCount="910" Body="&lt;p&gt;I use Craft on multilingual site and I'm having some difficulty in getting the static messages on templates added or changed on every translation file I have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to extract those static messages changed or not already translated from templates into all translation files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a functionality like of &quot;yiic message&quot; which searches for messages to be translated in the specified source files and compiles them into PHP arrays as message source.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2018-12-22T00:20:18.100" Title="How to extract static messages from templates into translation files?" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="982" PostTypeId="5" CreationDate="2014-07-11T21:56:47.153" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-11T21:56:47.153" LastActivityDate="2014-07-11T21:56:47.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="983" PostTypeId="4" CreationDate="2014-07-11T21:56:47.153" Score="0" Body="Conditional will perform different actions depending on some condition." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T10:21:41.910" LastActivityDate="2014-07-12T10:21:41.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="984" PostTypeId="5" CreationDate="2014-07-11T22:01:25.663" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-11T22:01:25.663" LastActivityDate="2014-07-11T22:01:25.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="985" PostTypeId="4" CreationDate="2014-07-11T22:01:25.663" Score="0" Body="For loop is a statement executing some code repeatedly (forever or till some condition exists it)" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T10:21:38.927" LastActivityDate="2014-07-12T10:21:38.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="986" PostTypeId="2" ParentId="981" CreationDate="2014-07-11T22:33:19.377" Score="6" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 3, we use the Yii 2 Inspections plugin for PhpStorm to do this now. &lt;a href=&quot;https://plugins.jetbrains.com/plugin/9400-yii2-inspections&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.jetbrains.com/plugin/9400-yii2-inspections&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a translation inspection that will let you know which strings are missing translations and which translations are no longer in use.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Old:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We currently have our own command line tool that goes through all of Craft's files and extracts anything in &lt;code&gt;Craft::t()&lt;/code&gt; (for PHP), and &lt;code&gt;|t&lt;/code&gt; (for Twig) and &lt;code&gt;Craft.t()&lt;/code&gt; for JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we would probably do is make that tool into a &lt;code&gt;yiic&lt;/code&gt; command and update it to let plugins take advantage of it for their own files as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will add it to the list.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-12-22T00:20:18.100" LastActivityDate="2018-12-22T00:20:18.100" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="987" PostTypeId="1" AcceptedAnswerId="998" CreationDate="2014-07-11T22:37:41.213" Score="6" ViewCount="1032" Body="&lt;p&gt;I have a Entries field and I'd like to return a URL for one randomly picked entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could loop through all the entries, but I'd like to do something more efficient. Can I return an array of URLs? Or better yet, is it possible to randomly get one URL all at once?&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-07-12T03:26:57.190" LastActivityDate="2014-07-12T14:50:54.587" Title="How do I get a random entry's URL from a Entries field?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;url&gt;&lt;random&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="988" PostTypeId="2" ParentId="958" CreationDate="2014-07-11T23:21:44.270" Score="6" Body="&lt;p&gt;If you just want to test if &lt;em&gt;something&lt;/em&gt; is in POST, and don't care what it is, then this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set success = craft.request.getPost() | length %}&#xA;&#xA;{% if success %}&#xA;    form was just submitted&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-11T23:21:44.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="989" PostTypeId="2" ParentId="987" CreationDate="2014-07-11T23:27:25.310" Score="3" Body="&lt;p&gt;No need to loop. You can use &lt;code&gt;random()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomEntry = random(entry.entriesFieldHandle) %}&#xA;{% if randomEntry %}&#xA;    {% set randomUrl = randomEntry.url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;randomUrl&lt;/code&gt; is your random entry's url you wanted to get.&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T14:50:54.587" LastActivityDate="2014-07-12T14:50:54.587" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="990" PostTypeId="1" AcceptedAnswerId="991" CreationDate="2014-07-12T00:12:18.050" Score="3" ViewCount="185" Body="&lt;p&gt;I have a single. I want to set the uri to section/single. For example academy/sign-up. I have created a single and have a template file named sign-up.html in the right location (within academy folder). I get a 404 when requesting site.com/academy/sign-up. Removing academy from address works. Can I use the nested uri or do all singles need to sit at the top level?&lt;/p&gt;&#xA;" OwnerUserId="393" LastActivityDate="2014-07-12T12:21:26.437" Title="Can I use a nested uri for a single?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="991" PostTypeId="2" ParentId="990" CreationDate="2014-07-12T00:31:48.497" Score="6" Body="&lt;p&gt;Create a Single called &lt;em&gt;Sign Up&lt;/em&gt; with a URI (section &gt; settings) of &lt;code&gt;academy/sign-up&lt;/code&gt; while keeping your current template &lt;code&gt;academy/sign-up.html&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2014-07-12T12:21:26.437" LastActivityDate="2014-07-12T12:21:26.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="992" PostTypeId="1" AcceptedAnswerId="995" CreationDate="2014-07-12T01:13:52.730" Score="2" ViewCount="109" Body="&lt;p&gt;Is it possible to hide a custom field from the modal that appears when you double-click on a related entry inside a Entries field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I don't want my custom field to be visible within the modal that comes from getEditorHtml.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;===== Updated based on accepted answer below =====&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the accepted answer from @Tyler Willingham I used the following code in my plugin's main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('myPlugin/js/myJs.js');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-07-12T18:50:27.110" LastActivityDate="2014-07-12T18:50:27.110" Title="Is it possible to hide a custom field type plugin from the popup tab when double clicking an entry?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="993" PostTypeId="1" AcceptedAnswerId="1041" CreationDate="2014-07-12T03:15:39.790" Score="3" ViewCount="747" Body="&lt;p&gt;I have read a few docs about front-end forms such as the &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields&quot; rel=&quot;nofollow&quot;&gt;Checkbox field docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although that doc doesn't seem to give an example of what I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 'categories' field type. I am creating a front-end form that will need to submit what is checked to the entry. I have tried a few different ways and can't get it to work. This is the last code I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;label for=&quot;designTags&quot;&amp;gt;Design Tags&amp;lt;/label&amp;gt;&#xA;&#xA;{% set categories = craft.categories.group('designs') %}&#xA;&#xA;{% for category in categories %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;designTags&quot; name=&quot;fields[designsTags][]&quot; value=&quot; {{ category.id }}&quot;&amp;gt; {{ category.title }} &amp;lt;/input&amp;gt; &amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried changing &lt;code&gt;category.title&lt;/code&gt; to &lt;code&gt;category.id&lt;/code&gt;, but no luck with that either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And before that, I tried something similar to the code at &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields&quot; rel=&quot;nofollow&quot;&gt;the bottom of this page&lt;/a&gt; (using the &lt;code&gt;option.value&lt;/code&gt;) and it still wouldn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help you can give is greatly appreciated! :)&lt;/p&gt;&#xA;" OwnerUserId="504" LastEditorUserId="177" LastEditDate="2014-07-12T11:33:33.857" LastActivityDate="2014-07-14T02:42:28.737" Title="Submitting checkbox data from a front-end form for a 'Categories' Field Type" Tags="&lt;categories&gt;&lt;form&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="994" PostTypeId="2" ParentId="907" CreationDate="2014-07-12T03:18:15.660" Score="4" Body="&lt;p&gt;I looked into this a little bit... It looks like the color of the circles is dependent on one of these CSS classes by default:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;.status.live&lt;/code&gt; - Green&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.status.pending&lt;/code&gt; - Orange&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.status.expired&lt;/code&gt; - Red&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.status.disabled&lt;/code&gt; - White&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm assuming (haven't checked this) that the status gets applied to the color dot as a &lt;strong&gt;lowercased&lt;/strong&gt; version of the name. So for example, if you have a status called &quot;Awesome&quot;, you would end up with a dot with the class &lt;code&gt;.status.awesome&lt;/code&gt;.*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* If I'm mistaken about how this works, anyone is welcome to correct me.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you've got your &lt;code&gt;.status.awesome&lt;/code&gt; classes applied to the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; which produces the color dots, you get to make your own dot! The default versions are pulling from two sprite files... You'll be served up the version which best matches your display:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;/app/resources/images/status.png&#xA;/app/resources/images/status_2x.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since you're not going to be changing anything in the &lt;code&gt;app&lt;/code&gt; folder, you'll need to make your own image to represent your dot. One great bonus of this: Your dot doesn't have to be dot shaped! You could just as easily make a star, question mark icon, etc. I'd suggest making both a &quot;regular&quot; and &quot;2x&quot; versions, to stay compliant with the native Craft handling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put your new image files into your plugin's resources folder:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;/myplugin/resources/images/customstatus.png&#xA;/myplugin/resources/images/customstatus_2x.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you'd reference those in your plugin's CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;.status.awesome {&#xA;    background: url(/myplugin/resources/images/customstatus.png);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The default &lt;code&gt;.status&lt;/code&gt; class handles a lot of the generic positioning, so you shouldn't have to override much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, most of this is speculative and untested... But let us know if it works out for you!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-07-14T04:06:18.930" LastActivityDate="2014-07-14T04:06:18.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="995" PostTypeId="2" ParentId="992" CreationDate="2014-07-12T03:22:35.567" Score="2" Body="&lt;p&gt;If you're looking for a setting you can apply to the plugin that corresponds to your custom field, it doesn't look like such a setting exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I was just made aware of this &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs/&quot; rel=&quot;nofollow&quot;&gt;Craft CP JS plugin&lt;/a&gt; in another question. It looks like you could potentially hide your plugin from displaying. It's not as elegant as a first-party solution but it may be worth a shot&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="84" LastEditDate="2014-07-12T18:45:57.787" LastActivityDate="2014-07-12T18:45:57.787" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="996" PostTypeId="1" AcceptedAnswerId="1009" CreationDate="2014-07-12T03:29:43.143" Score="7" ViewCount="175" Body="&lt;p&gt;For this particular build the client will frequently be creating 3 similar, but unique, types of content all housed in the same section which differ by a Content Type. When creating &quot;quick post&quot; widgets for the dashboard, each widget is currently given the same name despite the corresponding Entry Type. I don't necessarily need granular control over the title, but a way to provide additional context to the administrators would be nice.&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="250" LastEditDate="2014-07-12T20:54:16.903" LastActivityDate="2014-07-12T20:54:16.903" Title="Is it possible to change the title of &quot;Quick Post&quot; dashboard widgets?" Tags="&lt;control-panel&gt;&lt;dashboard-widgets&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="997" PostTypeId="2" ParentId="956" CreationDate="2014-07-12T03:41:26.330" Score="3" Body="&lt;p&gt;How about:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrix if block.subsection == 'intro' %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="82" LastEditorUserId="82" LastEditDate="2014-07-12T18:08:21.950" LastActivityDate="2014-07-12T18:08:21.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="998" PostTypeId="2" ParentId="987" CreationDate="2014-07-12T04:18:15.633" Score="7" Body="&lt;p&gt;It is possible to have the query pick a random entry.&#xA;From the Craft &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields#templating&quot; rel=&quot;nofollow&quot;&gt;Entries Fields&lt;/a&gt; docs we see that &lt;code&gt;entry.entriesFieldHandle&lt;/code&gt; is a shortcut for&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;  relatedTo: { sourceElement: entry, field: &quot;entriesFieldHandle&quot; },&#xA;  order: &quot;sortOrder&quot;,&#xA;  limit: null&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And what we want is to order the entries randomly, and then limit the number we retrieve to only one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;  relatedTo: { sourceElement: entry, field: &quot;entriesFieldHandle&quot; },&#xA;  order: &quot;RAND()&quot;,&#xA;  limit: 1&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So to retrieve one random entry and get its url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomEntry = craft.entries({&#xA;      relatedTo: { sourceElement: entry, field: &quot;entriesFieldHandle&quot; },&#xA;      order: &quot;RAND()&quot;,&#xA;      limit: 1&#xA;    }).first()&#xA;%}&#xA;{% if randomEntry %}&#xA;  {% set randomUrl = randomEntry.url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-07-12T14:40:30.257" LastActivityDate="2014-07-12T14:40:30.257" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="999" PostTypeId="1" AcceptedAnswerId="1016" CreationDate="2014-07-12T05:27:42.410" Score="9" ViewCount="1946" Body="&lt;h2&gt;Summary&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'm getting the following error when attempting to install a new Craft site locally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES LIKE 'craft_%'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Having just downloaded the ZIP, I assume the version of Craft in question is the latest at time of writing (2.1.2563).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Point of failure&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;After some digging, the error appears to be caused by line 59 in &lt;code&gt;craft/app/etc/behaviors/AppBehavior.php&lt;/code&gt;, specifically the call to &lt;code&gt;craft()-&amp;gt;db-&amp;gt;tableExists()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;_isInstalled = (craft()-&amp;gt;isConsole() || craft()-&amp;gt;db-&amp;gt;tableExists('info', false));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that is indeed the case, it means that the preceding &lt;code&gt;craft()-&amp;gt;getComponent('db')&lt;/code&gt; and &lt;code&gt;craft()-&amp;gt;getIsDbConnectionValid()&lt;/code&gt; checks are passing, which leaves me completely baffled as to what is causing the error.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Environment info&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The site is (not) running on a local Vagrant VM, which is happily hosting another Craft site with no problems. It's perhaps worth noting that I didn't install the other site from scratch on this server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic server specs are as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ubuntu 12.04 LTS (64-bit)&lt;/li&gt;&#xA;&lt;li&gt;Apache 2.2.22&lt;/li&gt;&#xA;&lt;li&gt;PHP 5.4.30&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The database definitely exists, and I can connect to it using Sequel Pro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody else run into this?&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="-1" LastEditDate="2014-07-13T13:29:05.000" LastActivityDate="2014-07-13T13:29:05.000" Title="Installation Error &quot;1046 No database selected&quot;" Tags="&lt;database&gt;&lt;server&gt;&lt;install&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1000" PostTypeId="5" CreationDate="2014-07-12T08:25:27.977" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-12T08:25:27.977" LastActivityDate="2014-07-12T08:25:27.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1001" PostTypeId="4" CreationDate="2014-07-12T08:25:27.977" Score="0" Body="Categories are taxonomies for your entries, users, and assets." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T16:21:02.107" LastActivityDate="2014-07-12T16:21:02.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1002" PostTypeId="1" CreationDate="2014-07-12T11:23:24.253" Score="3" ViewCount="856" Body="&lt;p&gt;I'm trying to use a &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;Lightswitch&lt;/a&gt; field to insert a class on my body tag if the field is turned on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good Twig template code to do this?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for answering, guys. I still couldn't manage to do it, though. My lightswitch field handle is named whiteText. If I do this: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;body class='{% if whiteText('1') %}white{% endif %}'&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it'll just say: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The function &quot;whiteText&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(which I assume seems logical for you guys, but not for me). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I use &lt;code&gt;entry.whiteText&lt;/code&gt; it'll say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\EntryModel and its behaviors do not have a method or closure&#xA;  named &quot;whiteText&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I should also have some kind of &quot;else&quot; in the code, to output a clean -tag if the lightswitch is not switched on. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have now set up a global field. If I do &lt;code&gt;{{ globalfieldhandle.lightswitchfieldhandle }}&lt;/code&gt; it outputs 0, even on the craft entry section I have it switched on (a single). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a way to make it say &quot;1&quot; if the lightswitch is turned on on the entry, and some help with the code to add a class on the body tag, and also the code for doing nothing if its not turned on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first answer to my question: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class='{% if lightswitch_field_handle %}class_name{% endif %}'&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;seems like the right direction, but is it missing something?&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="125" LastEditDate="2014-07-16T12:00:22.770" LastActivityDate="2014-07-16T12:00:22.770" Title="Using a Lightswitch to insert a class on a body's tag" Tags="&lt;templating&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1003" PostTypeId="2" ParentId="1002" CreationDate="2014-07-12T11:31:16.953" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lightswitch fields&lt;/a&gt; save an &lt;a href=&quot;http://php.net/manual/en/language.types.integer.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;integer&lt;/a&gt; to the database:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This integer can be checked just like a &lt;a href=&quot;http://php.net/manual/en/language.types.boolean.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;boolean&lt;/a&gt;, with &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twigs if-tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;body class='{% if lightswitch_field_handle %}class_name{% endif %}'&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1 = true  = on&lt;br&gt;&#xA;  0 = false = off&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig has also a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;ternary operator&lt;/a&gt; which is similar to &lt;a href=&quot;http://docs.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary&quot; rel=&quot;nofollow noreferrer&quot;&gt;php's ternary operator&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;body class=&quot;{{ lightswitch_field_handle ? 'class_name' }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;body class=&quot;{{ lightswitch_field_handle ? 'class_name' : 'alt_class_name' }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer to Edit 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your example doesn't work because you aren't comparing: &lt;code&gt;if value == 1&lt;/code&gt;, you are checking a function: &lt;code&gt;if function(param) == true&lt;/code&gt;. Check out the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig if documentation&lt;/a&gt; for more examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;entry.whiteText&lt;/code&gt; doesn't work, your section doesn't have such a field. If you added it to your main template, you should &lt;a href=&quot;https://craftcms.stackexchange.com/q/356/177&quot;&gt;check if the field is defined&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-14T15:26:39.803" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1004" PostTypeId="2" ParentId="993" CreationDate="2014-07-12T12:36:20.347" Score="1" Body="&lt;p&gt;I just tried your code and it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is your entry getting saved at all? If not I assume there might be another error. Add this to your code to output all form errors:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ dump(entry.getErrors()) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although it didn't made a difference in my test, you should remove the space to be sure:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;value=&quot;{{ category.id }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-12T14:32:43.647" LastActivityDate="2014-07-12T14:32:43.647" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1005" PostTypeId="1" AcceptedAnswerId="1006" CreationDate="2014-07-12T13:20:22.187" Score="3" ViewCount="1017" Body="&lt;p&gt;Is there any way to output the content of a channel entry by their slug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say I have an asset field called &quot;image&quot; in each channel entry, I want to output the content of that field only for the channel entry filtered by the slug &quot;home&quot;, I've tried both:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.entries.section('images').slug('home') %}&#xA;    {{ item.image.first() }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.entries.section('images').find().slug('home') %}&#xA;    {{ item.image.first() }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but neither work...&lt;/p&gt;&#xA;" OwnerUserId="467" LastEditorUserId="250" LastEditDate="2014-07-12T14:03:21.340" LastActivityDate="2014-07-12T14:20:55.360" Title="Filter channel entries by slug" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1006" PostTypeId="2" ParentId="1005" CreationDate="2014-07-12T14:05:45.370" Score="3" Body="&lt;p&gt;The second example won't work since &lt;code&gt;.find()&lt;/code&gt; should be at the end of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;. But since you treat the CriteriaModel like an array, you don't &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements&quot; rel=&quot;nofollow&quot;&gt;need to add it at all&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your first code looks correct, but you should &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-else-clause&quot; rel=&quot;nofollow&quot;&gt;check if the loop found an entry&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for item in craft.entries.section('images').slug('home') %}&#xA;    ....&#xA;{% else %}&#xA;    No entry found&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also your current code is only outputting the title of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModel&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Outputting an AssetFileModel object without attaching a property or&#xA;  method will return the asset’s Title&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's why you should add the &quot;url&quot; property, and also check whether the field contains an asset:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for item in craft.entries.section('images').slug('home') %}&#xA;    {% set asset = item.image.first() %}&#xA;&#xA;    {% if asset %}&#xA;       {{ asset.url }}&#xA;    {% else %}&#xA;        No asset added to the field&#xA;    {% endif %}&#xA;{% else %}&#xA;    No entry found&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-12T14:20:55.360" LastActivityDate="2014-07-12T14:20:55.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1007" PostTypeId="5" CreationDate="2014-07-12T15:04:14.800" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-07-12T15:04:14.800" LastActivityDate="2014-07-12T15:04:14.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1008" PostTypeId="4" CreationDate="2014-07-12T15:04:14.800" Score="0" Body="Tags are folksonomies for your entries, users, and assets." OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-07-12T17:09:19.420" LastActivityDate="2014-07-12T17:09:19.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1009" PostTypeId="2" ParentId="996" CreationDate="2014-07-12T16:11:58.390" Score="7" Body="&lt;p&gt;You can use this &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs/&quot;&gt;Control Panel JS plugin&lt;/a&gt; to change the info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just copy the &lt;code&gt;cpjs&lt;/code&gt; folder in the &lt;code&gt;craft/plugins/&lt;/code&gt; folder and the plugin should appear in &lt;code&gt;Settings-&amp;gt;Plugins&lt;/code&gt;. Install it and add your code in the textarea displayed at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now with your title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the dashboard, each widget has an ID like &lt;code&gt;widget1&lt;/code&gt;, &lt;code&gt;widget2&lt;/code&gt;, etc; get it with the dev tools.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then try the following code changing the corresponding widget number:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;document.getElementById(&quot;widget1&quot;).childNodes[3].innerHTML = &quot;new_title&quot;;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="456" LastActivityDate="2014-07-12T16:11:58.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1010" PostTypeId="1" CreationDate="2014-07-12T16:48:48.850" Score="6" ViewCount="2615" Body="&lt;p&gt;I have a controller that returns route variables to the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;  'errors' =&amp;gt; $entry-&amp;gt;getErrors()&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the page that gets loaded, I can access the variables I set in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for error in errors %} ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to handle this variable dynamically. Is it possible to access the 'errors' variable in my MyPluginVariable.php file without passing it directly to my variable function? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.doSomething(errors) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That passes my variable to the plugin variable and I can access it just fine.  But I don't want to ask the user to pass this variable to the function every time, I'd prefer to just handle it in the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, on the page that gets loaded, instead of outputting the variable, can I have a Twig tag like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.doSomething() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And directly access the 'errors' variable in my plugin?  Something like (this doesn't work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getRouteVariables('errors')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="250" LastEditDate="2014-07-12T17:24:17.110" LastActivityDate="2014-10-05T15:56:28.267" Title="Is it possible to access Twig variables in a plugin variable using PHP?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1011" PostTypeId="1" AcceptedAnswerId="1014" CreationDate="2014-07-12T17:25:22.910" Score="18" ViewCount="3953" Body="&lt;p&gt;How can I allow a user to change or delete their photo for their profile from the front end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a form setup for the user to edit their profile but I want to load their current photo (or a default) and then allow them to change it or delete it.&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="125" LastEditDate="2014-07-12T21:11:57.633" LastActivityDate="2017-02-18T23:32:24.453" Title="Allow user to change or delete their photo for their profile from the front end" Tags="&lt;assets&gt;&lt;users&gt;&lt;form&gt;&lt;user-profile&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1012" PostTypeId="2" ParentId="663" CreationDate="2014-07-12T17:27:28.287" Score="7" Body="&lt;p&gt;There's still a few kinks to work out, but I developed a plugin that solves this problem using Craft's native Many to Many relationship that already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I've created a field type that links the relationship from the other side of things and allows you to add entries to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find it here:&#xA;&lt;a href=&quot;https://github.com/page-8/craft-manytomany&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/page-8/craft-manytomany&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;a href=&quot;https://craftcms.stackexchange.com/users/9/brandon-kelly&quot;&gt;@Brandon Kelly&lt;/a&gt; for the help and guidance.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-12T17:27:28.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1013" PostTypeId="2" ParentId="872" CreationDate="2014-07-12T20:25:53.893" Score="4" Body="&lt;p&gt;The first step to diagnose would be to determine where the bottleneck is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, you'll see database profiling information in your browser's console, including the SQL executed for each query along with the total number of queries executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those queries will be ordered by the slowest performing ones at the top.  If there are multiple, slow performing queries that are taking up the majority of the time it takes to load the page, then there is likely something we could do in Craft to optimize performance in your scenario and you should contact us at support@buildwithcraft.com and send along a database dump so we can try to reproduce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the database queries look like they are not the issue, then the next likely culprit is disc access times.  If these folders/files are in the cloud (S3, Rackspace, etc.), or you're using NFS for your file system, then those could be slowing down the request as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-12T20:25:53.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1014" PostTypeId="2" ParentId="1011" CreationDate="2014-07-12T23:25:21.400" Score="16" Body="&lt;p&gt;Before you can allow a user to manage their profile photo in your front-end profile edit form, be sure to update your form tag with the &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can access a users profile photo using the &lt;code&gt;currentUser&lt;/code&gt; global and fallback to a different image like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.photoUrl %}&#xA;    &amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot; /&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;img src=&quot;/assets/images/fallback.gif&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The upload and manage part becomes a bit trickier.  Setting up a basic use case is fairly straightforward but if you want to begin giving the user a better UI and more feedback as to the status of the uploaded image, you'll have to get into some css and javascript.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when you delete a photo you might want to swap in the fallback image.  When an image is uploaded, you may want to display the image instead of just the filename for the user. Before a user has uploaded an image, you probably don't want to display the delete button. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not going to go into those items here, but here's one approach to get you started with the functionality:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Check to see if the user has a photo  #}&#xA;{% if currentUser.photoUrl %}&#xA;&#xA;    {# If a photo exists, give the option to change the user photo #}&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Change Photo&quot;&amp;gt;&#xA;&#xA;{% else %}&#xA;&#xA;    {# If no photo exists, give the option to upload a new one #}&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot;&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to be more brief, you can do the same using a ternary operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In  both cases, at different points in the process, you may want to give the user an option to remove their photo. To delete a photo, you can pass any value to an input field called &lt;code&gt;deleteUserPhoto&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Setup a delete action (see javascript snippet below) #}&#xA;&amp;lt;a href=&quot;#&quot; id=&quot;deleteUserPhotoAction&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&#xA;&#xA;{# Setup a hidden deleteUserPhoto field with no value #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When a user clicks the delete button you want to update the &lt;code&gt;deleteUserPhoto&lt;/code&gt; input field to have a value.  Any value works.  Here's an example using jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function() {&#xA;&#xA;    // Bind an action to the deleteUserPhotoAction click event&#xA;    $(&quot;#deleteUserPhotoAction&quot;).on('click', function() {&#xA;&#xA;        // Add the value 'zap' to the deleteUserPhoto input&#xA;        document.getElementById(&quot;deleteUserPhotoInput&quot;).value = 'zap';&#xA;&#xA;    });&#xA;&#xA;})();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-07-12T23:34:23.037" LastActivityDate="2014-07-12T23:34:23.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1015" PostTypeId="2" ParentId="1011" CreationDate="2014-07-12T23:28:56.593" Score="10" Body="&lt;p&gt;If you want a user to be able to upload a profile photo from the front-end, the you should be able to add &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; to your form that saves your user and have a file input called &lt;code&gt;'userPhoto'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; id=&quot;image-upload&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to delete a user's existing profile photo, then add a hidden input called &lt;code&gt;'deleteUserPhoto'&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; value=&quot;1&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="132" LastEditDate="2017-02-18T21:40:39.970" LastActivityDate="2017-02-18T21:40:39.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1016" PostTypeId="2" ParentId="999" CreationDate="2014-07-12T23:51:56.173" Score="3" Body="&lt;p&gt;While it may be an unsatisfying answer, for the sake of completion, this question was resolved by completely destroying and rebuilding the exact same VM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short discussion on Twitter about it here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twitter.com/monooso/status/487831027327696896&quot; rel=&quot;nofollow&quot;&gt;https://twitter.com/monooso/status/487831027327696896&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a warm affection for the on/off technique.  I've even seen it fix elevators!&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-12T23:51:56.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1017" PostTypeId="2" ParentId="926" CreationDate="2014-07-13T00:08:46.227" Score="4" Body="&lt;p&gt;If you don't wish to use a plugin to manage your login logo, you can create a 300px wide transparent PNG and place your logo in the center, or wherever you'd like to position it.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-13T00:08:46.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1018" PostTypeId="2" ParentId="952" CreationDate="2014-07-13T00:43:44.053" Score="27" Body="&lt;p&gt;My solution is to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'overridePhpSessionLocation' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Into &lt;em&gt;craft/config/general.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tells Craft to use the default location to write sessions, instead of craft/storage/runtime/sessions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For whatever reason, even though  craft/storage/runtime/sessions has CHMOD 777, PHP was saving the session file with 644. When it tried to write to the same file again, it got and error and logged me out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also (unsuccessfully) tried giving PHP ownership of the folder, which should in theory fix the problem too.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; sudo chown -R www-data:www-data sessions&#xA; chown: www-data: illegal group name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am assuming it's a Vagrant/OSX thing. &lt;/p&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2014-10-07T18:07:23.047" LastActivityDate="2014-10-07T18:07:23.047" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1019" PostTypeId="2" ParentId="999" CreationDate="2014-07-13T12:39:30.060" Score="3" Body="&lt;p&gt;I have seen a few random errors when using Craft and Vagrant that made me feel nutty after troubleshooting. I came to the same conclusion that you did, destroying the machine and rebuilding seemed to solve the issue but didn't quite give me the answer I felt I was owed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I did some digging...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the culprit to be the sync functionality of Vagrant. Back when Vagrant first came onto the scene one of the major issues was syncing folders with a lot of files and directories, aka a CMS. I can't find the direct link but I believe some people had issues with virtual box guest addition tools.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not saying that your vagrant machine is really old, that tends not to be the case. However, I am saying that sometimes - not sure when and why - the sync function can corrupt or even not sync directories/files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you run into this again, I would make sure you diff the files in question on the host and guest machine. Especially looking for invisible characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worthy to note, but I have zero experience with this. Vagrant allows you to use VMWare as the provider which claims improved performance. One downside is that it costs $79 for a license - but it also goes towards funding future development of Vagrant. Details on the VMWare provider are here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.vagrantup.com/vmware&quot; rel=&quot;nofollow&quot;&gt;https://www.vagrantup.com/vmware&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-13T12:39:30.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1020" PostTypeId="1" CreationDate="2014-07-13T13:56:10.027" Score="5" ViewCount="2037" Body="&lt;p&gt;I just purchased a license from the CP of my production server. Then I went to the config directory to retrieve the license.key for my local dev server but it was not there. I can't find it anywhere. I installed the site the other day using Craft-2.1.2563 and when I went back to look at the zip I see that the license file is missing there as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I do? How can I transfer the license to my dev environment as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI - I set up my dev environment a few weeks ago and it was based on a slightly older build of Craft 2 - I'm not sure which version. But, it does have a license.key file. That doesn't do me any good because I purchased a license on the production server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="512" LastActivityDate="2014-07-13T17:03:27.590" Title="My license.key file missing. How do I transfer the license to other servers?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1021" PostTypeId="1" CreationDate="2014-07-13T14:29:24.223" Score="3" ViewCount="762" Body="&lt;p&gt;Craft seems to have a limitation when generating unique URI for &gt; 100 entries with the same title.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel with YouTube videos in and some are spread across 140 parts all with the same title, and craft auto appends a -1 -2 etc. on the slug but fails when it reaches 3 digits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to change this limitation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment it just responds with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Could not find a unique URI for this element.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-13T06:07:05.827" LastActivityDate="2015-08-13T06:07:05.827" Title="URI / Slug auto generation limitation" Tags="&lt;entries&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1022" PostTypeId="1" AcceptedAnswerId="1026" CreationDate="2014-07-13T15:21:34.100" Score="7" ViewCount="1546" Body="&lt;p&gt;I've gotten locales up and running on a site, but would like it to automatically route to &lt;code&gt;domain.com/no&lt;/code&gt; for norwegian visitors and &lt;code&gt;domain.com/en&lt;/code&gt; for all other visitors. For the life of me, I seem incapable of finding a way using the built in functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to write a plugin to handle this or is there some clever trick I haven't thought of? Can't find anything on geolocation at all. &lt;/p&gt;&#xA;" OwnerUserId="511" LastEditorUserId="643" LastEditDate="2015-06-08T11:57:20.783" LastActivityDate="2017-04-26T19:23:55.457" Title="Locale change based on geolocation" Tags="&lt;localization&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1023" PostTypeId="2" ParentId="1021" CreationDate="2014-07-13T15:23:19.260" Score="4" Body="&lt;p&gt;To resolve this we added a new config setting for the upcoming 2.2 release called &lt;code&gt;maxSlugIncrement&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It defaults to 100, but you can bump it if you need it to keep finding more unique URIs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-11T18:26:12.673" LastActivityDate="2014-08-11T18:26:12.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1024" PostTypeId="2" ParentId="1022" CreationDate="2014-07-13T15:43:31.100" Score="2" Body="&lt;p&gt;Not exactly related but might help. You can define locales in combination with urls, so you can point no.yourdomain.com to no locale and yourdomain.com to the default locale. Will need to see some more documentation, but this might help.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-07-13T15:43:31.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1025" PostTypeId="1" AcceptedAnswerId="1078" CreationDate="2014-07-13T16:08:01.070" Score="8" ViewCount="663" Body="&lt;p&gt;I have a somewhat unique thumbnail need for a certain site. I need to watermark images with custom text (per image, not globally across the site). Is there a way to hook into the Craft image transform generation logic and insert/run my own logic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've experimented with &lt;code&gt;craft()-&amp;gt;on('content.onSaveContent', function(Event $event) {&lt;/code&gt; and it seems to work okay. It will run when you save/upload the asset. The downside is that it generates the thumbnail on save, instead of on demand (using Javascript) as the native Craft transform feature does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, is there a different event I can hook into? Or, is there a better way to adjust the transform generation logic.&lt;/p&gt;&#xA;" OwnerUserId="513" LastEditorUserId="9" LastEditDate="2014-08-06T11:20:41.983" LastActivityDate="2014-08-06T11:20:41.983" Title="Is it possible to hook into image transforms?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;image-transforms&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1026" PostTypeId="2" ParentId="1022" CreationDate="2014-07-13T16:38:45.427" Score="7" Body="&lt;p&gt;The &lt;em&gt;mod_geoip2&lt;/em&gt; Apache module with a redirect in .htaccess file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;http://dev.maxmind.com/geoip/legacy/mod_geoip2/&quot;&gt;http://dev.maxmind.com/geoip/legacy/mod_geoip2/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2014-07-13T16:38:45.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1027" PostTypeId="1" AcceptedAnswerId="1408" CreationDate="2014-07-13T17:02:05.930" Score="4" ViewCount="171" Body="&lt;p&gt;I'm building a plugin where each Element created has a unique content table associated with it.  Each individual Element behaves as needed, however, when I try to create an index page that returns all of the records of this Element Type, Craft seems to assume that I'm using the default content table unless I tell it differently in the &lt;code&gt;getContentTableForElementsQuery()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the results that are being returned have Elements with multiple content tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I overlooking anything here or is there a different way I should be thinking about this?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-25T18:00:46.333" Title="Is it possible for an Element Type to return multiple content tables with the getContentTableForElementsQuery() method?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1028" PostTypeId="2" ParentId="1020" CreationDate="2014-07-13T17:03:27.590" Score="6" Body="&lt;p&gt;The Craft .zip does not come with the license.key file. From the Craft docs: &quot;It doesn’t get one until you have finished installing Craft and it has made its first call to our web service to check for updates.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure your Craft edition upgrade went through, it seems a bit odd that you upgraded editions and you don't have a license.key file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Double check that it's not there (craft/config/license.key), maybe by using a search tool on the whole Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also try checking for Craft updates to see if that triggers the generation of a license.key file. Restarting the server may help, but you did say it was a production server so that might not be convenient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all else fails, I'm sure if you contact P&amp;amp;T (&lt;a href=&quot;http://mailto:support@buildwithcraft.com&quot;&gt;support@buildwithcraft.com&lt;/a&gt;) they can sort it out.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-13T17:03:27.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1029" PostTypeId="1" AcceptedAnswerId="1033" CreationDate="2014-07-13T17:16:19.700" Score="4" ViewCount="380" Body="&lt;p&gt;Until you can override widgets on per user group basis, does anyone know if it's possible to change the feed settings to not display the Pixel &amp;amp; Tonic feed in the dashboard and either set it to be blank or another feed? Maybe using a config setting?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="22" LastEditDate="2014-07-13T20:51:49.817" LastActivityDate="2015-03-19T16:47:48.443" Title="Is it possible to change the default feed widget settings?" Tags="&lt;dashboard-widgets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1030" PostTypeId="1" AcceptedAnswerId="1032" CreationDate="2014-07-13T18:45:44.017" Score="10" ViewCount="1111" Body="&lt;p&gt;I have a website where I am pulling a list of staff members from the Craft users. You can add individual fields to the users element, but it seems the image for the photo is incredibly small is size and lacking in quality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to change the size of the profile photo? Hopefully I can just apply an image transform on the user profile photo. Adding another field for a photograph seems redundant. &lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-13T20:02:07.357" LastActivityDate="2014-07-13T21:14:24.383" Title="Change the size of a users profile photo?" Tags="&lt;users&gt;&lt;image-transforms&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1031" PostTypeId="1" AcceptedAnswerId="1034" CreationDate="2014-07-13T20:10:31.150" Score="4" ViewCount="144" Body="&lt;p&gt;I have a member group that has very fine grain options when they log in. They should only be able to add, edit, and delete their own entries in a single channel. At the moment they can select any user as the author. Is it possible to not allow them to change the author?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="22" LastEditDate="2014-07-13T20:57:12.377" LastActivityDate="2014-07-13T23:02:09.510" Title="Can I stop the logged-in user from selecting other users in the author dropdown?" Tags="&lt;entries&gt;&lt;users&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1032" PostTypeId="2" ParentId="1030" CreationDate="2014-07-13T20:39:18.317" Score="15" Body="&lt;p&gt;I found the answer on the Craft website under the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#getPhotoUrl&quot; rel=&quot;noreferrer&quot;&gt;UserModel section&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;getPhotoUrl( size )&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Returns a URL to the user’s photo at a given size in pixels (defaults to 100). You can also pass in &amp;quot;original&amp;quot; if you want to get a non-resized photo back.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Although this does answer my question, I feel the behavior between handling this &amp;quot;asset&amp;quot; compared to an actual native asset is a little cumbersome, especially considering if I wanted to apply an image transformation on the original file.&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-07-13T21:14:24.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1033" PostTypeId="2" ParentId="1029" CreationDate="2014-07-13T21:59:15.610" Score="1" Body="&lt;p&gt;If you're looking to do it on a per-user basis, you can change what feed the widget points to by clicking the dashboard settings icon near the top of the dashboard.  You can also remove the widget entirely from there as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The settings for all widgets are json-encoded and saved in the craft_widgets table in the settings column.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-13T21:59:15.610" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1034" PostTypeId="2" ParentId="1031" CreationDate="2014-07-13T23:02:09.510" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;They should only be able to add, edit, and delete their own entries in a single channel.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can currently to this by granting &quot;Edit Entries&quot;, &quot;Create Entries&quot;, &quot;Publish Live Changes&quot; and &quot;Delete Entries&quot; permission to a user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, none of those affect what shows up in the &quot;Authors&quot; drop down and I'm not sure they should.  Technically, changing the author of an entry is still editing the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe what's needed here is an additional permission under &quot;Edit Entries&quot; called &quot;Change Entry Author&quot;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-13T23:02:09.510" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1035" PostTypeId="1" AcceptedAnswerId="1037" CreationDate="2014-07-13T23:47:26.857" Score="5" ViewCount="696" Body="&lt;p&gt;We are going to start an online magazine. Registered users will be able to submit new entries (articles, places, etc...). Can Craft handle thousands of entries and high traffic (Of course with required server)?&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastEditorUserId="57" LastEditDate="2014-07-14T00:03:56.903" LastActivityDate="2014-07-14T01:25:23.460" Title="Can Craft handle thousands of entries and high traffic?" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1036" PostTypeId="1" AcceptedAnswerId="1042" CreationDate="2014-07-13T23:59:07.283" Score="4" ViewCount="350" Body="&lt;p&gt;I have custom statuses working on the control panel for my plugin. However, there are a few issues I have with custom statues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through the database, I am unable to figure out exactly where the custom status is stored. I have my table 'craft_pluginName' with my records. My field layouts exist and so does everything else needed for my element type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I still can't find the custom status. Browsing through the 'craft_content' table I see the content, related to my element type. Yet I still don't see anything related to a status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the assumption that my table 'craft_pluginName' is supposed to contain a column named 'pluginNameStatus' and I then have to hook that into the element type (for a lack of better term)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &#xA;More research uncovered that 'craft_elements' has id, type, enabled and the typical time stamps. The column 'enabled' is a boolean so it can be only 0 or 1. Updating that value manually in the database updates the 'status' on my element type index view.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel that this 'status', which is shown when your element type has 'hasStatus' set to true. I do not feel that this really allows us to use custom statuses as you are more than likely going to have more than two options for a custom status. In my case: 'pending', 'approved' and 'denied'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am still at a loss on how we actually use custom statuses in our element types, as the default right now is either on or off... &lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-14T00:17:43.943" LastActivityDate="2014-07-14T10:00:03.340" Title="Where exactly are my element type custom statuses stored and used?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1037" PostTypeId="2" ParentId="1035" CreationDate="2014-07-14T00:03:36.343" Score="6" Body="&lt;p&gt;Sure... we've seen Craft installs with several hundred thousands entries/users/assets/etc. running in the wild, but there really isn't a simple answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you pointed out, performance can be heavily dependent on the server and environment that Craft is running on, but that goes for any web application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performance on the front-end is also dependent on your templating architecture and code.  Craft does provide some &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tags that can help with some of the more database dependent parts of your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If traffic to your site is significant enough, you can also consider putting something like &lt;a href=&quot;https://www.varnish-cache.org/&quot; rel=&quot;nofollow&quot;&gt;Varnish&lt;/a&gt; in front of Craft as well as another layer of caching.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-14T01:15:02.513" LastActivityDate="2014-07-14T01:15:02.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1038" PostTypeId="2" ParentId="1035" CreationDate="2014-07-14T01:25:23.460" Score="1" Body="&lt;p&gt;Don't use a structure section if you want over 200-300 entries...&#xA;They become unusable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be resolved in version 2.2 I'm pleased to hear.&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2014-07-14T01:25:23.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1039" PostTypeId="1" AcceptedAnswerId="1040" CreationDate="2014-07-14T02:02:18.270" Score="8" ViewCount="3386" Body="&lt;p&gt;I have a multilingual site, and I want my dates formatted like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;English site: July 13, 2014&lt;/li&gt;&#xA;&lt;li&gt;Italian site: 13 lulgio 2014&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So the month name is translated, and the order of the elements changes as well.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="125" LastEditDate="2014-07-15T00:18:59.490" LastActivityDate="2014-07-15T00:18:59.490" Title="Multilingual Dates where date format varies" Tags="&lt;templating&gt;&lt;date&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1040" PostTypeId="2" ParentId="1039" CreationDate="2014-07-14T02:07:52.630" Score="14" Body="&lt;p&gt;Craft has extended Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot;&gt;date filter&lt;/a&gt; so that it translates the output (no documentation for this, but the code is in &lt;em&gt;craft/app/etc/templating/twigextensions/CraftTwigExtension.php&lt;/em&gt; around line 152). So &lt;code&gt;{{now|date('F j, Y')}}&lt;/code&gt; will give &lt;strong&gt;July 13, 2014&lt;/strong&gt; on the English site, and &lt;strong&gt;luglio 13, 2014&lt;/strong&gt; on the Italian site. Which is half way there. In order to get the Italian date to use the Italian format (&lt;em&gt;j F Y&lt;/em&gt;), we need a translation for the format string. Add this to &lt;em&gt;craft/translations/it.php&lt;/em&gt;. (For more info see &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot;&gt;Static Translations&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'F j, Y' =&amp;gt; 'j F Y',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To output the translated date:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{now|date('F j, Y'|t)}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-14T02:07:52.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1041" PostTypeId="2" ParentId="993" CreationDate="2014-07-14T02:42:28.737" Score="1" Body="&lt;p&gt;I just wanted to let you know that I figured this out. I had the section handle in craft.categories.group instead of the category handle. I had just gone through everything again to make sure things were matching up and that's when I found it. Some of my category / section / field names were too similar to each other so too easy to swap out. I just made some tweaks to that to prevent this in the future. Thank you for all of the help and suggestions. So glad that's out of the way and figured out. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-07-14T02:42:28.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1042" PostTypeId="2" ParentId="1036" CreationDate="2014-07-14T04:07:23.320" Score="4" Body="&lt;p&gt;Short answer: Your custom statuses will be stored in your own 3rd party table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on everything you've mentioned &lt;a href=&quot;https://craftcms.stackexchange.com/questions/907/how-to-integrate-custom-statuses-in-a-workflow-style-custom-element-type&quot;&gt;in this thread&lt;/a&gt;, it sounds like you've figured out how to at least &lt;strong&gt;define&lt;/strong&gt; your custom statuses. Now, you'll want to store that status along with the rest of your data in your own custom table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example of how the status data is typically handled, let's take a look at the native Users element type...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;/app/models/UserModel.php&#xA;/app/records/UserRecord.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll notice that in both the Model and the Record, &quot;status&quot; has been created as its own column. This is exactly what you will need to do in your own Model and Record. (Of course the enum &quot;values&quot; will be your own.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;/myplugin/models/MyElementModel.php&#xA;/myplugin/records/MyElementRecord.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-07-14T04:07:23.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1043" PostTypeId="2" ParentId="907" CreationDate="2014-07-14T07:45:25.133" Score="3" Body="&lt;p&gt;Here is a quick code summary of how this can be done.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// GasTankElementType&#xA;public function hasStatuses()&#xA;{&#xA;    return true;&#xA;}&#xA;&#xA;public function getStatuses()&#xA;{&#xA;    return array(&#xA;        'full' =&amp;gt; Craft::t('Full Tank'),&#xA;        'half' =&amp;gt; Craft::t('Half Full/Empty'),&#xA;        'empty' =&amp;gt; Craft::t('Totally Empty'),&#xA;    );&#xA;}&#xA;&#xA;// GasTankModel&#xA;// If this method is missing, your actual elements may display the default green status&#xA;public function getStatus()&#xA;{&#xA;    return $this-&amp;gt;status;&#xA;}&#xA;&#xA;// ElementTemplate&#xA;{% extends &quot;_layouts/elementindex&quot; %}&#xA;&#xA;{% set statusSnippet %}&#xA;    .status.full {&#xA;        background-position: 0 0; // @green&#xA;    }&#xA;    .status.half {&#xA;        background-position: 0 -10px; // @orange&#xA;    }&#xA;    .status.empty {&#xA;        background-position: 0 -20px; // @red&#xA;    }&#xA;{% endset %}&#xA;&#xA;{% includeCss(statusSnippet) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This example is very brief and may lack context for people that don't have a good grasp on how this all works but I know you've been digging into this for a while and I just wanted to throw something together that you can &lt;strong&gt;adapt&lt;/strong&gt; and &lt;strong&gt;optimize&lt;/strong&gt;. At the very least, it should provide an example of all the moving parts that are required and serve as reference if you need to ask a more specific question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do want to note that we're riding on top of entry specific behavior here as far as the templates classes are concerned but everything else is standardized elemental stuff so, I don't see things completely breaking any time soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twitter.com/selvinortiz&quot; rel=&quot;nofollow&quot;&gt;@selvinortiz&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="115" LastEditDate="2014-10-25T09:31:11.877" LastActivityDate="2014-10-25T09:31:11.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1044" PostTypeId="1" CreationDate="2014-07-14T07:55:28.420" Score="5" ViewCount="279" Body="&lt;p&gt;I am looking for a plugin or simple method that can add some stats to the User Admin. We have a membership site running for a client and it would be good to add either a count to the sidebar User Groups filters (eg &quot;Users (11)&quot;) or a dashboard widget of basic stats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone added this already, or used something suitable?&lt;/p&gt;&#xA;" OwnerUserId="214" LastEditorUserId="22" LastEditDate="2014-07-14T17:28:50.830" LastActivityDate="2014-07-14T17:28:50.830" Title="Is there a user stats plugin available?" Tags="&lt;users&gt;&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1045" PostTypeId="1" CreationDate="2014-07-14T08:42:18.450" Score="2" ViewCount="1106" Body="&lt;p&gt;I have a channel section by the name of order. What I need is that every time a user clicks a button on the front end the data of the form is sent to my plugin which then uses the data to create a new entry of type order and saved in the back end. The data in the form only represents the content of the entry and the only other information we have is that the entry is of type channel and that it belongs to the order channel. What would be the best way to create the entry with the publishing date, title, id, etc all set appropriately? Can I use saveEntry of the entries service in some way?&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="443" LastEditDate="2014-07-15T02:50:47.397" LastActivityDate="2014-07-15T11:50:27.177" Title="Whats the best way to save a new entry in my plugin?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;services&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1047" PostTypeId="1" AcceptedAnswerId="1072" CreationDate="2014-07-14T09:58:11.900" Score="6" ViewCount="432" Body="&lt;p&gt;When typing in the title, the automatic slug generator doesn't filter or replace accentuated letters such as (ő, ú, á, ű). Is there a way to replace these letters to the unaccented one (like ő -&gt; o, ű -&gt; u, etc..)?&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastActivityDate="2016-08-31T00:25:38.500" Title="How automatic slug generator could replace accentuated letters?" Tags="&lt;url&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1048" PostTypeId="2" ParentId="1036" CreationDate="2014-07-14T10:00:03.340" Score="5" Body="&lt;p&gt;For starters I'd classify statuses in two groups - static statuses and dynamic statuses: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Static statuses are set explicitly&lt;/li&gt;&#xA;&lt;li&gt;Dynamic statuses change according to other circumstances (other attribute values, lunar phases, whatever)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For static statuses you'd go with the approach Lindsey outlined and just define a column for that where to store everything, however, things get more interesting when you start tackling dynamic statuses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that, you should look at the Entry element type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/app/elementtypes/EntryElementType.php&#xA;/app/models/EntryModel.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll want to look at the EntryElementType::getElementQueryStatusCondition() method - adding this method to your Element type will allow you to use &quot;status&quot; criteria when searching for elements. As a nice side-effect, this will also make the status filter in the Element index work nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method worth looking at is the EntryModel::getStatus() method - implementing this method ensures that your Element type actually returns the correct dynamic status when asked for it.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-07-14T10:00:03.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1050" PostTypeId="1" CreationDate="2014-07-14T10:56:50.100" Score="1" ViewCount="333" Body="&lt;p&gt;I'm trying to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.illustration %}&#xA;    {% if image | length %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;flag__img&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ entry.altText }}&quot; class=&quot;profile__image&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% else %}  &#xA;        &amp;lt;p&amp;gt;No image.&amp;lt;/p&amp;gt;        &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="177" LastEditDate="2014-07-14T11:10:27.540" LastActivityDate="2014-07-14T18:02:15.873" Title="Showing a generic image when no image is chosen" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1051" PostTypeId="2" ParentId="1045" CreationDate="2014-07-14T11:06:53.923" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;FrontEnd Entry Form&lt;/a&gt; for this. If you want to allow guests (non-registered users) to submit the form, you need to use the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both methods will set &quot;publishing date, id, etc&quot; automatically, you just need to specify the title in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to hard-code some field values and prevent the user from changing it, you'd need to create a plugin which checks for &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries#the-guestentriesbeforesave-event&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;guestEntries.beforeSave&lt;/code&gt;&lt;/a&gt; (if you use Guest Entries plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Entry Form is just an example. You can just as well use an ajax-request to send your data. Just make sure the POST values are set correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to save an entry from within your plugin, use the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice&quot; rel=&quot;nofollow&quot;&gt;EntriesService API&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-15T11:50:27.177" LastActivityDate="2014-07-15T11:50:27.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1053" PostTypeId="2" ParentId="1050" CreationDate="2014-07-14T12:06:22.660" Score="2" Body="&lt;p&gt;If you want to make it a little smaller, you could use a ternary statement, so on your img tag, you could use the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ image ? image.getUrl : 'http://example.com/image.png' }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you're full snippet would be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.illustration %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;flag__img&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image ? image.getUrl : 'http://example.com/image.png' }}&quot; alt=&quot;{{ image.altText ? image.altText : &quot;Default Alt Text&quot; }}&quot; class=&quot;profile__image&quot; /&amp;gt;&#xA;&#xA;        &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A ternary statement is basically a shorthand if statement.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (condition is true) ? do this : else do this }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also changed &lt;code&gt;entry.altText&lt;/code&gt; to &lt;code&gt;image.altText&lt;/code&gt; in the for loop. That may be where you are going wrong?&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="284" LastEditDate="2014-07-14T14:51:24.580" LastActivityDate="2014-07-14T14:51:24.580" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1054" PostTypeId="1" AcceptedAnswerId="1070" CreationDate="2014-07-14T12:26:58.913" Score="11" ViewCount="653" Body="&lt;p&gt;Is it possible, by any method, to change the list of available locales? The current list includes some strange entries, e.g. East Germany, and we would like to update this to be more current for our client. &lt;/p&gt;&#xA;" OwnerUserId="214" LastEditorUserId="57" LastEditDate="2014-07-14T17:52:50.273" LastActivityDate="2014-09-11T15:49:27.623" Title="Can I change the list of available locales?" Tags="&lt;config&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1056" PostTypeId="1" AcceptedAnswerId="1060" CreationDate="2014-07-14T14:07:14.697" Score="6" ViewCount="1443" Body="&lt;p&gt;Is there a specific way I can have a development and live version of a website with Craft Pro running simultaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have multiple clients, and so using craft.dev for our development is not really feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I duplicate the production license over to dev to unlock all features?&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2014-07-14T16:42:37.457" Title="Development and Production License Key" Tags="&lt;upgrades&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1057" PostTypeId="1" AcceptedAnswerId="1059" CreationDate="2014-07-14T14:13:41.280" Score="8" ViewCount="3823" Body="&lt;p&gt;I have a blog. I want to output an entry author's first and last name. What is a good method to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="393" LastActivityDate="2015-10-01T16:05:09.793" Title="How do I output an entry author's data" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1058" PostTypeId="2" ParentId="1057" CreationDate="2014-07-14T14:24:21.773" Score="3" Body="&lt;pre&gt;&lt;code&gt;{{ entry.author.firstName }} {{ entry.author.lastName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="393" LastEditorUserId="344" LastEditDate="2015-10-01T16:05:09.793" LastActivityDate="2015-10-01T16:05:09.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1059" PostTypeId="2" ParentId="1057" CreationDate="2014-07-14T14:25:24.333" Score="21" Body="&lt;p&gt;For each entry, you can get the username of the author by simply using {{ entry.author }} (assuming entry is the variable containing the blog entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to display Full name, first name and/or last name for one entry, you'd use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.fullName }}&#xA;{{ entry.author.firstName }}&#xA;{{ entry.author.lastName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a list of entries and their authors, you'd use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('your-section').find() %}&#xA;    {{ entry.author.fullName }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-07-14T14:25:24.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1060" PostTypeId="2" ParentId="1056" CreationDate="2014-07-14T14:52:44.937" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;We have multiple clients, and so using craft.dev for our development is not really feasible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How about client1.craft.dev, client2.craft.dev etc?&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2014-07-14T14:52:44.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1061" PostTypeId="1" AcceptedAnswerId="1062" CreationDate="2014-07-14T14:52:45.720" Score="1" ViewCount="174" Body="&lt;p&gt;I want to show the latest blog post on the blog/index.html page of my blog which I have done. I now want to display a link to the next post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, when I click a blog entry's url I want to add next / prev controls to the blog/_detail.html page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a simple way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="393" LastActivityDate="2014-07-14T15:00:46.397" Title="How do I add next/prev controls to a blog?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-07-14T16:09:30.907" ContentLicense="CC BY-SA 3.0" />
  <row Id="1062" PostTypeId="2" ParentId="1061" CreationDate="2014-07-14T15:00:46.397" Score="2" Body="&lt;p&gt;Take a look at: &lt;a href=&quot;http://buildwithcraft.com/help/pagination-nav&quot; rel=&quot;nofollow&quot;&gt;How do I build a pagination nav?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2014-07-14T15:00:46.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1063" PostTypeId="2" ParentId="1050" CreationDate="2014-07-14T15:07:36.027" Score="3" Body="&lt;p&gt;You may want to try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.illustration %}&#xA;  {% if image %}&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;flag__img&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ entry.altText }}&quot; class=&quot;profile__image&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;  {% else %}&#xA;    &amp;lt;p&amp;gt;No image.&amp;lt;/p&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Assuming the altText field is an entry field.) :)&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-07-14T15:07:36.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1064" PostTypeId="1" AcceptedAnswerId="1068" CreationDate="2014-07-14T15:26:44.473" Score="3" ViewCount="324" Body="&lt;p&gt;Other than setting up a cron job, does Craft include any functionality for plugins to run a function at a specific time and/or date?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some actions could include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bulk activate/deactivate entries&lt;/li&gt;&#xA;&lt;li&gt;Messaging all users every monday (or once a week)&lt;/li&gt;&#xA;&lt;li&gt;Hitting an API (account update, eCommerce, data updating etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let me know if a question like this already exists. I searched and couldn't find any related information.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="22" LastEditDate="2014-07-14T16:40:28.507" LastActivityDate="2014-07-14T19:57:18.050" Title="Plugins: Time/Date specific functions" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;date&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1065" PostTypeId="1" CreationDate="2014-07-14T15:36:48.830" Score="0" ViewCount="97" Body="&lt;p&gt;I'm trying to send a meta-data image from an entry template to the main layout template.  The image is in a matrix block on the entry.  It comes out correctly when I call it on the entry page, but when I try to pass it to the layout it doesn't see it and reverts to the default image called in the layout.  Any help is appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_Layout template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;twitter:image:src&quot; content={% if twitterpic is defined %}&quot;{{ twitterpic }}&quot;{%else%}&quot;{{ siteImage.getUrl('twitterPic') }}&quot; {%endif%}/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_entry template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#  social image  #}&#xA;{% for block in entry.projectImage%}&#xA;{% set image for block.projectImage.first() %}&#xA;{% set twitterpic =image.getUrl('twitterPic') %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="519" LastEditorUserId="519" LastEditDate="2014-07-14T15:41:49.203" LastActivityDate="2014-07-14T15:41:49.203" Title="How do I pass an image to the _layout" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="0" ClosedDate="2014-07-14T16:06:14.307" ContentLicense="CC BY-SA 3.0" />
  <row Id="1066" PostTypeId="1" AcceptedAnswerId="1067" CreationDate="2014-07-14T15:43:57.287" Score="2" ViewCount="315" Body="&lt;p&gt;In our workflow, we run a shared development server. Each developer develops locally but points to the development database. All Craft software updates need to happen while in the local environment and then changes need to immediately be committed to the git repo otherwise things could get really screwed up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would the option to disable the update capability using a multi-environment config setting so we could prevent anyone from running those updates on the shared development server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know we could set up user permissions to lock this down, but I think it would be much handier to be able to do that at the config level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2014-07-14T16:23:24.813" Title="Config option to disable update capability per environment" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-07-14T17:48:01.920" ContentLicense="CC BY-SA 3.0" />
  <row Id="1067" PostTypeId="2" ParentId="1066" CreationDate="2014-07-14T15:52:36.277" Score="5" Body="&lt;p&gt;I believe you're looking for the '&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowAutoUpdates&quot; rel=&quot;nofollow&quot;&gt;allowAutoUpdates&lt;/a&gt;' config option combined with &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment configs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="57" LastEditDate="2014-07-14T16:23:24.813" LastActivityDate="2014-07-14T16:23:24.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1068" PostTypeId="2" ParentId="1064" CreationDate="2014-07-14T16:37:01.157" Score="4" Body="&lt;p&gt;Not really, and it'd be pretty difficult for PHP to truly emulate a cron service since, by nature, it requires something to execute it before it can run (in Craft's case, a browser request).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing in Craft would be its &quot;Tasks&quot; (completely undocumented).  Tasks are usually meant for things that might take a long time for PHP to complete and it's not critical that they happen right away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can't schedule, them... if there is a task in a &quot;pending&quot; state in the craft_tasks table, the next request to the control panel is going to trigger it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose we could add something like a &quot;runDate&quot; property to tasks where you could be at least guaranteed they wouldn't run until the first control panel request was made after that given date.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-14T19:57:18.050" LastActivityDate="2014-07-14T19:57:18.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1069" PostTypeId="2" ParentId="1056" CreationDate="2014-07-14T16:42:37.457" Score="1" Body="&lt;p&gt;You can buy Craft on a local domain like &quot;client1.dev&quot; when you're building a site. When it's time to go live just &lt;em&gt;copy&lt;/em&gt; the license.key file (app/config/license.key) to the production server (or vice versa).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are allowed to use the same license on a public domain and on any number of private local domains like client1.dev. See &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot; rel=&quot;nofollow&quot;&gt;How is Craft’s license agreement enforced?&lt;/a&gt; on the Craft docs for more info.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-14T16:42:37.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1070" PostTypeId="2" ParentId="1054" CreationDate="2014-07-14T16:43:50.137" Score="8" Body="&lt;p&gt;You can download the locales you want from &lt;a href=&quot;https://github.com/yiisoft/yii/tree/master/framework/i18n/data&quot;&gt;https://github.com/yiisoft/yii/tree/master/framework/i18n/data&lt;/a&gt; and place in your &lt;code&gt;craft/app/framework/i18n/data&lt;/code&gt; folder and they will show up as options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Yii ships with so many locales, we initially stripped a lot of them out to keep the Craft download size to something reasonable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are some locales we stripped that you think should be included in Craft, hit us up at support@buildwithcraft.com and we'll get them in.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-14T16:43:50.137" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1071" PostTypeId="2" ParentId="1044" CreationDate="2014-07-14T16:47:55.610" Score="2" Body="&lt;p&gt;Until the plugin store officially becomes a thing, &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Straight up Craft&lt;/a&gt; has got the most curated list of plugins available for Craft at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing anything like you're describing for users, but it is definitely something a plugin should be able to handle.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-14T16:47:55.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1072" PostTypeId="2" ParentId="1047" CreationDate="2014-07-14T16:51:34.323" Score="9" Body="&lt;p&gt;It actually used to work this way when Craft first launched, but we had feedback where it was desired behavior to allow accented characters and even multi-byte characters in slugs, because they are perfectly valid in the URI.  e.g. &lt;a href=&quot;http://domain.com/%E6%9C%83%E6%84%8F%E5%AD%97&quot; rel=&quot;noreferrer&quot;&gt;http://domain.com/會意字&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, enough people have brought it up where they would like the old behavior that we're going to add a config setting for Craft 2.2 where you can choose which you prefer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was added as a &lt;a href=&quot;https://craftcms.com/docs/config-settings#limitAutoSlugsToAscii&quot; rel=&quot;noreferrer&quot;&gt;limitAutoSlugToAscii&lt;/a&gt; config setting that defaults to &lt;code&gt;true&lt;/code&gt; in Craft 2.2.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-08-31T00:25:38.500" LastActivityDate="2016-08-31T00:25:38.500" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1073" PostTypeId="5" CreationDate="2014-07-14T16:53:57.240" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T16:53:57.240" LastActivityDate="2014-07-14T16:53:57.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1074" PostTypeId="4" CreationDate="2014-07-14T16:53:57.240" Score="0" Body="Questions having to do with Craft's control panel." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T16:53:57.240" LastActivityDate="2014-07-14T16:53:57.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1075" PostTypeId="1" AcceptedAnswerId="1076" CreationDate="2014-07-14T17:27:50.667" Score="4" ViewCount="434" Body="&lt;p&gt;I have a page which lists assets by source. I've added a date field to the asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I order the assets by this field so that the most recent is first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/doYWd.png&quot; alt=&quot;asset date field&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.find({sourceId: 2}) %}&#xA;&#xA;{% for asset in assets %}&#xA;    &amp;lt;a href=&quot;{{ asset.url }}&quot;&amp;gt;{{ asset.date | date('M Y') }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the &lt;a href=&quot;http://straightupcraft.com/cheat-sheets&quot; rel=&quot;nofollow noreferrer&quot;&gt;cheat sheet for Assets&lt;/a&gt; it seems that these are my only options for order:      &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;sourceId&lt;/code&gt;, &lt;code&gt;folderId&lt;/code&gt;, &lt;code&gt;filename&lt;/code&gt;, &lt;code&gt;kind&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, &lt;code&gt;size desc&lt;/code&gt;'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.find({sourceId: 2, order: '{{ asset.date }}'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="22" LastEditDate="2014-07-14T17:44:34.957" LastActivityDate="2014-07-14T17:44:34.957" Title="Order Assets by date field" Tags="&lt;assets&gt;&lt;date&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1076" PostTypeId="2" ParentId="1075" CreationDate="2014-07-14T17:31:17.083" Score="7" Body="&lt;p&gt;You're so close it's maddening—you should be able to order by a custom field as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.find({sourceId: 2, order: 'date desc'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;date&lt;/code&gt; is the name of your custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#order&quot;&gt;Craft docs&lt;/a&gt; (emphasis added):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Possible values include 'title', 'id', 'sourceId', 'folderId', 'filename', 'kind', 'width', 'height', 'size', 'dateCreated', and 'dateUpdated', &lt;strong&gt;as well as any textual custom field handles&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T17:37:22.663" LastActivityDate="2014-07-14T17:37:22.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1077" PostTypeId="2" ParentId="1050" CreationDate="2014-07-14T18:02:15.873" Score="1" Body="&lt;p&gt;I am assuming that &lt;em&gt;illustration&lt;/em&gt; is an asset field, and you want to display all the images, or &lt;em&gt;No image&lt;/em&gt; if there are none. You can do that with an &lt;code&gt;else&lt;/code&gt; clause on the &lt;code&gt;for&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.illustration %}&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;flag__img&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ entry.altText }}&quot; class=&quot;profile__image&quot;&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;No image.&amp;lt;/p&amp;gt;        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-14T18:02:15.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1078" PostTypeId="2" ParentId="1025" CreationDate="2014-07-14T18:26:15.143" Score="3" Body="&lt;p&gt;Currently it’s not possible to hook into Craft’s own thumbnail/transform generation logic. Your best bet would be to write a plugin that independently adds the watermark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could give the plugin a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Variable&lt;/a&gt; class that accepts the AssetFileModel object, grabs the image, stamps it with the watermark and saves it somewhere else, returning the URL to that watermarked image, or something like that.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-14T18:26:15.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1079" PostTypeId="1" AcceptedAnswerId="1089" CreationDate="2014-07-14T20:56:13.470" Score="11" ViewCount="5000" Body="&lt;p&gt;A developer built our site locally configured as &quot;craft.dev&quot;. At the same time, my sysadmin was busy getting Craft installed with Apache on our Linux server. He set that up with our real domain and purchased the $299 license for &quot;ourcoolwebsite.com&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we've got the real website on the developer's machine, and a blank website on the linux server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What files/folders do we need to migrate to get the real website up?&lt;/strong&gt; Should we just dump and load his database and overwrite the one that was created for the install? I am guessing there are some database tables with data specific to my purchase and license key that differ from his. Basically I want to know how to take his work and put it into my production environment with database tables and file paths.&lt;/p&gt;&#xA;" OwnerUserId="521" LastEditorUserId="22" LastEditDate="2014-07-14T21:42:39.810" LastActivityDate="2017-10-10T17:30:21.507" Title="Migrating a whole website between Craft instances" Tags="&lt;database&gt;&lt;migration&gt;&lt;upgrades&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1080" PostTypeId="5" CreationDate="2014-07-14T21:05:27.457" Score="0" Body="&lt;p&gt;See Craft's &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Development Introduction&lt;/a&gt; for more.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:02:38.477" LastActivityDate="2017-05-10T02:02:38.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1081" PostTypeId="4" CreationDate="2014-07-14T21:05:27.457" Score="0" Body="Questions having to do with constructing plugins." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T21:05:27.457" LastActivityDate="2014-07-14T21:05:27.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1082" PostTypeId="5" CreationDate="2014-07-14T21:11:09.013" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T21:11:09.013" LastActivityDate="2014-07-14T21:11:09.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1083" PostTypeId="4" CreationDate="2014-07-14T21:11:09.013" Score="0" Body="Craft's native, non-destructive image manipulations." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T21:11:09.013" LastActivityDate="2014-07-14T21:11:09.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1084" PostTypeId="5" CreationDate="2014-07-14T21:15:55.110" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T21:15:55.110" LastActivityDate="2014-07-14T21:15:55.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1085" PostTypeId="4" CreationDate="2014-07-14T21:15:55.110" Score="0" Body="Locales and multi-lingual translations." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-07-14T21:15:55.110" LastActivityDate="2014-07-14T21:15:55.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1086" PostTypeId="1" CreationDate="2014-07-14T21:16:48.037" Score="10" ViewCount="1341" Body="&lt;p&gt;I would like to have a Top 10 Tags list in descending order. I'm able to list and limit 10 tags used, but the order parameters are limited to name, group, and date essentially.&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2020-08-23T10:18:57.857" Title="Order tags by count - e.g. Top 10 Tags Used" Tags="&lt;tags&gt;&lt;ordering&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1087" PostTypeId="1" AcceptedAnswerId="1090" CreationDate="2014-07-14T21:34:44.200" Score="13" ViewCount="9778" Body="&lt;p&gt;I'm trying to restrict access to items in a channel using some form of custom user permissions however I don't appear to be able to create or set custom read permissions for a channel using crafts permissions as they currently are, I'm therefore trying to do something using either user groups or custom fields on the user and validate if a user has access that way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping this is along the right lines, although it doesn't seem ideal, so is it possible to check if a user is in a certain user group elegantly using twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do &lt;code&gt;{{ if currentUser.admin }}&lt;/code&gt; and I'm guessing I could therefore do something like &lt;code&gt;{{if 'groupnamewithaccess' in currentUser.groups }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2021-01-24T10:22:45.257" Title="Check user is in User Group / Custom User Permissions" Tags="&lt;templating&gt;&lt;users&gt;&lt;current-user&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1088" PostTypeId="2" ParentId="1079" CreationDate="2014-07-14T21:40:54.493" Score="3" Body="&lt;p&gt;Your purchase on the &quot;real&quot; domain was tied to your the &lt;code&gt;craft/config/license.key&lt;/code&gt; file on that site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you should need to do is move your files up &lt;em&gt;except&lt;/em&gt; for your local development &lt;code&gt;license.key&lt;/code&gt; file, restore the database to the production site and adjust any domains/paths as necessary.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-14T21:40:54.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1089" PostTypeId="2" ParentId="1079" CreationDate="2014-07-14T21:42:51.193" Score="10" Body="&lt;ol&gt;&#xA;&lt;li&gt;Make sure both Craft installs are up-to-date.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/help/transferring-purchases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's license&lt;/a&gt; is saved in &lt;code&gt;craft/config/license.key&lt;/code&gt;, make a backup of your purchased license file.&lt;/li&gt;&#xA;&lt;li&gt;Move all your files/directories except:&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft/app/&lt;br&gt;&#xA;  /craft/storage/&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copy the backup of your &lt;code&gt;license.key&lt;/code&gt; to &lt;code&gt;craft/config/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Remove &lt;code&gt;/craft/storage/&lt;/code&gt;, if it exists on your new server, to prevent cache errors.&lt;/li&gt;&#xA;&lt;li&gt;&quot;dump and load&quot; your database to the new server. Craft will update what's necessary.&lt;/li&gt;&#xA;&lt;li&gt;Update your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;config settings&lt;/a&gt; in &lt;code&gt;/craft/config/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Go to your BackEnd.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also you might find this interesting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/10/177&quot;&gt;What's the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-14T21:42:51.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1090" PostTypeId="2" ParentId="1087" CreationDate="2014-07-14T21:53:32.277" Score="22" Body="&lt;p&gt;I believe what you're looking for is &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot;&gt;'isInGroup'&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('groupHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will also accept an actual group object or a group ID as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#getGroups&quot;&gt;getGroups&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.getGroups() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will return an array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usergroupmodel&quot;&gt;UserGroupModels&lt;/a&gt; all of the groups the user belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#can&quot;&gt;can&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.can('permissionName') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will check if the current user has the given permissions, whether that was indirectly assigned to them in a group, or directly assigned to them as a user.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-14T21:53:32.277" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1091" PostTypeId="1" AcceptedAnswerId="1194" CreationDate="2014-07-14T22:21:43.773" Score="9" ViewCount="539" Body="&lt;p&gt;I'm attempting to write a plugin to extend tags by adding a &lt;code&gt;count&lt;/code&gt; property that'd be useful &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1086/order-tags-by-count-e-g-top-10-tags-used&quot;&gt;identifying popular tags&lt;/a&gt;, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/881/how-can-i-create-a-visually-weighted-tag-cloud&quot;&gt;making a tag cloud&lt;/a&gt;, and anything else where a count would be useful.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Goal&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;What I'd like is to neatly extend &lt;code&gt;TagModel&lt;/code&gt; so that interacting with these new count tallies  would be straightforward and as similar as possible to working with tags. For example, pretend &lt;code&gt;superTags&lt;/code&gt; is my count-appended set and I'm getting the top ten tags for a site across sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in superTags.limit(10).order('count desc') %}&#xA;    {{ tag.name }} has been used {{ tag.count }} times.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or getting the top 10 tags by a blog author:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in superTags.channel('blog').relatedTo(author).limit(10).order('count desc') %}&#xA;    {{ tag.name }} was born in {{ tag.dateCreated | date('Y') }}.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;The Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I humbly admit that I'm struggling to see the big picture. For example, this works fine (my plugin's called Taggregate):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags.find() %}&#xA;{% set superTags = craft.taggregate.appendCounts(tags) %}&#xA;{% set superTags = craft.taggregate.sortByCount(superTags) %}&#xA;&#xA;{% for tag in superTags %}&#xA;    {{ tag.name }} has been used {{ tag.count }} times.&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've got a &lt;code&gt;TaggregateModel&lt;/code&gt; that extends &lt;code&gt;TagModel&lt;/code&gt; only to merge in a &lt;code&gt;count&lt;/code&gt; Number to &lt;code&gt;defineAttributes()&lt;/code&gt;. My Service takes the tags array, then spits out a new one with &lt;code&gt;TaggregateModel&lt;/code&gt; objects that include the &lt;code&gt;count&lt;/code&gt; property. (Each count is just a tally from &lt;code&gt;craft_relations&lt;/code&gt; with no regard for other parameters like section or author—later I intend to use an aggregate table as Brad suggested, even though that's irrelevant here.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TaggregateService&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;public function appendCounts($tags)&#xA;{&#xA;    $superTags = array(); &#xA;&#xA;    new TaggregateModel($tags);&#xA;&#xA;    for ($i=0; $i &amp;lt; count($tags); $i++)&#xA;    { &#xA;        $superTags[$i] = new TaggregateModel($tags[$i]);&#xA;        $superTags[$i]-&amp;gt;count = $this-&amp;gt;getTagCount($superTags[$i]-&amp;gt;id);&#xA;    }&#xA;&#xA;    return $superTags;&#xA;}&#xA;&#xA;public function getTagCount($tagId)&#xA;{&#xA;    $q = craft()-&amp;gt;db-&amp;gt;createCommand('SELECT count(*) as count FROM craft_relations WHERE targetId = '.$tagId)-&amp;gt;queryAll();&#xA;&#xA;    // TODO: get stored aggregate if it exists, otherwise count and store&#xA;&#xA;    return $q[0]['count'];&#xA;}&#xA;&#xA;public function sortByCount($tags)&#xA;{&#xA;    usort($tags, function($a, $b)&#xA;        {&#xA;            return $a-&amp;gt;count &amp;lt; $b-&amp;gt;count;&#xA;        }&#xA;    );&#xA;&#xA;    return $tags;&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While this works, it's clearly bad design:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Twig interface is specific to the plugin's weird version of non-native methods.&lt;/li&gt;&#xA;&lt;li&gt;This &lt;code&gt;superTag&lt;/code&gt; array isn't smart enough to do any of the cool things that &lt;code&gt;TagModel&lt;/code&gt; can.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;The Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a more sensible way to build this so I can hit my ideal usage outlined in &quot;The Goal&quot; above?&lt;/strong&gt; I'm not looking for somebody to write this for me, just some big-picture guidance since I suspect I'm making this harder than it should be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;...or is my seemingly-simple objective actually complicated?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-16T23:51:36.290" Title="How can I best extend TagModel to add a `count` property?" Tags="&lt;plugin-development&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1092" PostTypeId="1" AcceptedAnswerId="1093" CreationDate="2014-07-14T22:35:05.907" Score="10" ViewCount="5492" Body="&lt;p&gt;If I want to convert text into a URL friendly string for sharing text in a social media link, how would I go about that?&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="22" LastEditDate="2014-07-14T22:59:13.960" LastActivityDate="2017-08-16T18:01:45.970" Title="How can I convert text into a URL-friendly string?" Tags="&lt;templating&gt;&lt;url&gt;&lt;string&gt;&lt;conversion&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1093" PostTypeId="2" ParentId="1092" CreationDate="2014-07-14T22:35:05.907" Score="12" Body="&lt;p&gt;I was about to ask this question, but realized that it's closely related to &lt;strong&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/184/is-it-possible-to-convert-string-to-uppercase&quot;&gt;this question&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer, like in the above referenced question &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;lies with Twig filters&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, in this case, one needs to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/url_encode.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;url_encode&lt;/code&gt;&lt;/a&gt; filter to convert the text needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;http://www.linkedin.com/shareArticle?mini=true&amp;amp;url={{ entry.url|url_encode }}&amp;amp;title={{ entry.title|url_encode }}&amp;amp;source=Xavier%20Creative%20House&amp;amp;summary={{ entry.question|url_encode|striptags }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In any case, I hope that helps others with this. I know how easy it is to forget that the answers sometimes like over in the Twig docs, and not Craft’s.&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-14T22:35:05.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1094" PostTypeId="1" AcceptedAnswerId="1306" CreationDate="2014-07-14T22:50:24.693" Score="2" ViewCount="1676" Body="&lt;p&gt;I get the Craft loaded with another application on PHP and I try to create a Entry, no problems deleting and getting the entries but when I try to create a new one Craft doesn't show me anything, and also doesn't create an Entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, when I run some &quot;file.php&quot; from the console in order to create a new Entry the error appears, so if I wanna load all the dependencies, I need a Http request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I want to create an Entry by console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set YII_DEBUG on false and this message appear: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notice: Undefined property: Craft\WebApp::$userSession in /Applications/MAMP/htdocs/craft/craft/app/etc/templating/twigextensions/CraftTwigExtension.php on line 350&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = new \Craft\EntryModel(); &#xA;&#xA;$entry-&amp;gt;sectionId  = 2; &#xA;$entry-&amp;gt;typeId     = 2; &#xA;$entry-&amp;gt;authorId   = 1; &#xA;$entry-&amp;gt;enabled    = true;&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(     &#xA;    'title' =&amp;gt; &quot;Console Entrie 1!&quot;,     &#xA;    'body'  =&amp;gt; &quot;&amp;lt;p&amp;gt;I can’t believe I literally just called this “Hello World!”.&amp;lt;/p&amp;gt;&quot; &#xA;)); &#xA;&#xA;$success = \Craft\craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My bootstrap file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Make sure this is PHP 5.3 or later&#xA;if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID &amp;lt; 50300)&#xA;{&#xA;    exit('Craft requires PHP 5.3.0 or later, but you&amp;amp;rsquo;re running '.PHP_VERSION.'. Please talk to your host/IT department about upgrading PHP or your server.');&#xA;}&#xA;&#xA;/**&#xA; * Quit early if this is just an omitScriptNameInUrls or usePathInfo test request&#xA; */&#xA;&#xA;// Is this a script name redirect test?&#xA;if ((isset($_SERVER['PATH_INFO']) &amp;amp;&amp;amp; $_SERVER['PATH_INFO'] == '/testScriptNameRedirect')&#xA;    || (isset($_SERVER['QUERY_STRING']) &amp;amp;&amp;amp; strpos($_SERVER['QUERY_STRING'], 'testScriptNameRedirect') !== false))&#xA;{&#xA;    exit('success');&#xA;}&#xA;&#xA;// Is this a PATH_INFO test?&#xA;if (isset($_SERVER['PATH_INFO']) &amp;amp;&amp;amp; $_SERVER['PATH_INFO'] == '/testPathInfo')&#xA;{&#xA;    exit('success');&#xA;}&#xA;&#xA;/**&#xA; * Path constants and validation&#xA; */&#xA;&#xA;// We're already in the app/ folder, so let's use that as the starting point.&#xA;// Make sure it doesn't look like we're on a network share that starts with \\&#xA;$appPath = realpath(dirname(__FILE__));&#xA;if (isset($appPath[0]) &amp;amp;&amp;amp; isset($appPath[1]))&#xA;{&#xA;    if ($appPath[0] !== '\\' &amp;amp;&amp;amp; $appPath[1] !== '\\')&#xA;    {&#xA;        $appPath = str_replace('\\', '/', $appPath);&#xA;    }&#xA;}&#xA;&#xA;$_SERVER['DOCUMENT_ROOT']   = '/some/path/to/craft.dev';&#xA;$_SERVER['HTTP_HOST']       = 'craft.dev';&#xA;$_SERVER['HTTPS']           = 'off';&#xA;$_SERVER['PHP_SELF']        = '/index.php';&#xA;$_SERVER['REQUEST_URI']     = '/index.php';&#xA;$_SERVER['SERVER_PORT']     = 80;&#xA;$_SERVER['SCRIPT_FILENAME'] = '/some/path/to/craft.dev/index.php';&#xA;$_SERVER['SCRIPT_NAME']     = '/index.php';&#xA;&#xA;//define('YII_ENABLE_EXCEPTION_HANDLER', false);&#xA;//define('YII_ENABLE_ERROR_HANDLER', false);&#xA;// define('YII_DEBUG', true);&#xA;&#xA;defined('CRAFT_APP_PATH') || define('CRAFT_APP_PATH', $appPath.'/');&#xA;&#xA;// The app/ folder goes inside craft/ by default, so work backwards from app/&#xA;defined('CRAFT_BASE_PATH') || define('CRAFT_BASE_PATH', realpath(CRAFT_APP_PATH.'..').'/');&#xA;&#xA;// Everything else should be relative from craft/ by default&#xA;defined('CRAFT_CONFIG_PATH')       || define('CRAFT_CONFIG_PATH',       CRAFT_BASE_PATH.'config/');&#xA;defined('CRAFT_PLUGINS_PATH')      || define('CRAFT_PLUGINS_PATH',      CRAFT_BASE_PATH.'plugins/');&#xA;defined('CRAFT_STORAGE_PATH')      || define('CRAFT_STORAGE_PATH',      CRAFT_BASE_PATH.'storage/');&#xA;defined('CRAFT_TEMPLATES_PATH')    || define('CRAFT_TEMPLATES_PATH',    CRAFT_BASE_PATH.'templates/');&#xA;defined('CRAFT_TRANSLATIONS_PATH') || define('CRAFT_TRANSLATIONS_PATH', CRAFT_BASE_PATH.'translations/');&#xA;&#xA;function craft_createFolder($path)&#xA;{&#xA;    // Code borrowed from IOHelper...&#xA;    if (!is_dir($path))&#xA;    {&#xA;        $oldumask = umask(0);&#xA;&#xA;        if (!mkdir($path, 0755, true))&#xA;        {&#xA;            exit('Tried to create a folder at '.$path.', but could not.');&#xA;        }&#xA;&#xA;        // Because setting permission with mkdir is a crapshoot.&#xA;        chmod($path, 0755);&#xA;        umask($oldumask);&#xA;    }&#xA;}&#xA;&#xA;function craft_ensureFolderIsReadable($path, $writableToo = false)&#xA;{&#xA;    $realPath = realpath($path);&#xA;&#xA;    // !@file_exists('/.') is a workaround for the terrible is_executable()&#xA;    if ($realPath === false || !is_dir($realPath) || !@file_exists($realPath.'/.'))&#xA;    {&#xA;        exit (($realPath !== false ? $realPath : $path).' doesn\'t exist or isn\'t writable by PHP. Please fix that.');&#xA;    }&#xA;&#xA;    if ($writableToo)&#xA;    {&#xA;        if (!is_writable($realPath))&#xA;        {&#xA;            exit ($realPath.' isn\'t writable by PHP. Please fix that.');&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;// Validate permissions on craft/config/ and craft/storage/&#xA;craft_ensureFolderIsReadable(CRAFT_CONFIG_PATH);&#xA;craft_ensureFolderIsReadable(CRAFT_STORAGE_PATH, true);&#xA;&#xA;// Create the craft/storage/runtime/ folder if it doesn't already exist&#xA;craft_createFolder(CRAFT_STORAGE_PATH.'runtime/');&#xA;craft_ensureFolderIsReadable(CRAFT_STORAGE_PATH.'runtime/', true);&#xA;&#xA;/**&#xA; * Load the config&#xA; */&#xA;&#xA;// Set the environment&#xA;defined('CRAFT_ENVIRONMENT') || define('CRAFT_ENVIRONMENT', $_SERVER['SERVER_NAME']);&#xA;&#xA;// We need to special case devMode in the config because YII_DEBUG has to be set as early as possible.&#xA;$devMode = false;&#xA;$generalConfigPath = CRAFT_CONFIG_PATH.'general.php';&#xA;&#xA;if (file_exists($generalConfigPath))&#xA;{&#xA;    $generalConfig = require $generalConfigPath;&#xA;&#xA;    if (is_array($generalConfig))&#xA;    {&#xA;        // Normalize it to a multi-environment config&#xA;        if (!array_key_exists('*', $generalConfig))&#xA;        {&#xA;            $generalConfig = array('*' =&amp;gt; $generalConfig);&#xA;        }&#xA;&#xA;        // Loop through all of the environment configs, figuring out what the final word is on Dev Mode&#xA;        foreach ($generalConfig as $env =&amp;gt; $envConfig)&#xA;        {&#xA;            if ($env == '*' || strpos(CRAFT_ENVIRONMENT, $env) !== false)&#xA;            {&#xA;                if (isset($envConfig['devMode']))&#xA;                {&#xA;                    $devMode = $envConfig['devMode'];&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;if ($devMode)&#xA;{&#xA;    error_reporting(E_ALL &amp;amp; ~E_STRICT);&#xA;    ini_set('display_errors', 1);&#xA;    defined('YII_DEBUG') || define('YII_DEBUG', true);&#xA;    defined('YII_TRACE_LEVEL') || define('YII_TRACE_LEVEL', 3);&#xA;}&#xA;else&#xA;{&#xA;    error_reporting(0);&#xA;    ini_set('display_errors', 0);&#xA;    defined('YII_DEBUG') || define('YII_DEBUG', false);&#xA;}&#xA;&#xA;/**&#xA; * Load Yii, Composer dependencies, and the app&#xA; */&#xA;&#xA;// Load Yii, if it's not already&#xA;if (!class_exists('Yii', false))&#xA;{&#xA;    require CRAFT_APP_PATH.'framework/yii.php';&#xA;}&#xA;&#xA;// Guzzle makes use of these PHP constants, but they aren't actually defined in some compilations of PHP&#xA;// See http://it.blog.adclick.pt/php/fixing-php-notice-use-of-undefined-constant-curlopt_timeout_ms-assumed-curlopt_timeout_ms/&#xA;defined('CURLOPT_TIMEOUT_MS')        || define('CURLOPT_TIMEOUT_MS',        155);&#xA;defined('CURLOPT_CONNECTTIMEOUT_MS') || define('CURLOPT_CONNECTTIMEOUT_MS', 156);&#xA;&#xA;// Load up Composer's files&#xA;require CRAFT_APP_PATH.'vendor/autoload.php';&#xA;&#xA;// Disable the PHP include path&#xA;Yii::$enableIncludePath = false;&#xA;&#xA;// Load 'em up&#xA;require CRAFT_APP_PATH.'Craft.php';&#xA;require CRAFT_APP_PATH.'etc/web/WebApp.php';&#xA;require CRAFT_APP_PATH.'Info.php';&#xA;&#xA;// Set some aliases for Craft::import()&#xA;Yii::setPathOfAlias('app', CRAFT_APP_PATH);&#xA;Yii::setPathOfAlias('plugins', CRAFT_PLUGINS_PATH);&#xA;&#xA;// Load the full config&#xA;$config = require CRAFT_APP_PATH.'etc/config/main.php';&#xA;&#xA;// Initialize Craft\WebApp this way so it doesn't cause a syntax error on PHP &amp;lt; 5.3&#xA;$appClass = '\Craft\WebApp';&#xA;$app = new $appClass($config);&#xA;&#xA;//$app-&amp;gt;run();`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="523" LastEditorUserId="523" LastEditDate="2014-07-15T15:05:26.353" LastActivityDate="2014-07-21T19:59:07.667" Title="Problems creating an entry using app()-&gt;entries-&gt;saveEntry()" Tags="&lt;entry-type&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1095" PostTypeId="2" ParentId="1086" CreationDate="2014-07-14T23:14:34.503" Score="7" Body="&lt;p&gt;This is based on Matt's answer to your &lt;a href=&quot;https://craftcms.stackexchange.com/q/881/125&quot;&gt;previous question&lt;/a&gt;. Likewise this should better be used within &lt;code&gt;cache&lt;/code&gt; tags!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is untested, but it hopefully works out for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is still untested but it &lt;a href=&quot;https://craftcms.stackexchange.com/q/1514/125&quot;&gt;came to my ears&lt;/a&gt;, that it could make problems to assign variables as array keys. That's why I changed the code to use objects instead. If anyone &lt;em&gt;uses&lt;/em&gt; this code, I'd be happy to hear if it does actually work!&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Get all tags #}&#xA;{% set allTags = craft.tags.find() %}&#xA;&#xA;{# Define object outside the for loop #}&#xA;{% set weightedTags = [] %}&#xA;&#xA;{# Iterate over all tags #}&#xA;{% for tag in allTags %}&#xA;&#xA;    {# Get total number of tag occurrences in entries belonging to 'blog' section #}&#xA;    {% set count = craft.entries.section('blog').relatedTo(tag).total() %}&#xA;&#xA;    {# Save tag id and count to our weightedTags object #}&#xA;    {% set weightedTags = weightedTags|merge([{ tagId: tag.id, tagCount: count }]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Sort, reverse-sort and pick top 10 elements of the array #}&#xA;{% set weightedTags = weightedTags|sort|reverse|slice(0, 10) %}&#xA;&#xA;{# To print the top 10 list iterate over our weightedTags array #}&#xA;{% for tagObject in weightedTags %}&#xA;&#xA;    {# Get tag object for each tagId #}&#xA;    {% set tagEntry = craft.tags.id(tagObject.tagId).first() %}&#xA;&#xA;    {# Return the list item #}&#xA;    &amp;lt;a href=&quot;/entries/{{ tagEntry.slug }}&quot; data-count=&quot;{{ tagObject.tagCount }}&quot;&amp;gt;{{ tagEntry.name }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-05-19T10:57:22.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1096" PostTypeId="2" ParentId="1039" CreationDate="2014-07-15T00:17:54.280" Score="1" Body="&lt;p&gt;If you don't need to customized the output you can also use the Crafts datetime methods &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#localeDate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;localeDate()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#localeDate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;localeTime()&lt;/code&gt;&lt;/a&gt; to return a date / time in the current locale's preferred date format.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Returns '7/15/2014' if current locale is 'en' #}&#xA;{# Returns '15.07.2014' if current locale is 'it' #}&#xA;{{ now.localeDate() }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-15T00:17:54.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1097" PostTypeId="1" AcceptedAnswerId="1100" CreationDate="2014-07-15T01:22:48.217" Score="7" ViewCount="823" Body="&lt;p&gt;I am building a plugin that's uses an enum for custom statuses. The statuses are integrated within my plugin with the exception of changing the status in my template code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;pluginname/enums/PluginStatus.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginNameStatus&#xA;{&#xA;    const Approved = 'approved';&#xA;    const Denied   = 'denied';&#xA;    const Pending  = 'pending';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the best method to grab the enum values and display those in a select field for my edit template? All of my templates are rendered via controller actions so I am thinking that assigning the enums to an array and passing to the templates as $variables might be the most practical method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;pluginname/controllers/PluginNameController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginNameController extends BaseController&#xA;{&#xA;    public function actionShowIndex()&#xA;    {&#xA;        $variables['customStatuses'] = array(&#xA;            PluginStatus::Approved =&amp;gt; 'Approved',&#xA;            PluginStatus::Denied   =&amp;gt; 'Denied',&#xA;            PluginStatus::Pending  =&amp;gt; 'Pending',&#xA;        ), &#xA;        $this-&amp;gt;renderTemplate('pluginname/_edit', $variables);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-15T02:39:14.857" LastActivityDate="2014-07-15T08:18:50.350" Title="Best way to use custom enums in my plugin templates?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;controller&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1098" PostTypeId="1" AcceptedAnswerId="1099" CreationDate="2014-07-15T01:54:20.763" Score="4" ViewCount="353" Body="&lt;p&gt;If I was going to include my custom enums for my plugin, should the include be outside of my plugin class or use the &lt;strong&gt;init()&lt;/strong&gt; method. What is the best way to handle this and are there any pros or cons to either? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Current method:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;// include enums for custom statuses&#xA;include(dirname(__FILE__) . '/enums/PluginNameEnums.php');&#xA;&#xA;class PluginNamePlugin extends BasePlugin&#xA;{&#xA;    // etc&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-15T03:33:15.900" LastActivityDate="2014-07-15T03:38:34.137" Title="How should I include my custom enums class in my plugin?" Tags="&lt;plugin-development&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1099" PostTypeId="2" ParentId="1098" CreationDate="2014-07-15T02:34:47.653" Score="3" Body="&lt;p&gt;I suppose it depends on what the code is going to be doing.  If it's standard &quot;business logic&quot; code related to your plugin, then it would make more sense to add it to your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;services&lt;/a&gt;, which is where we recommend that type of logic goes.  There, it handles the interactions with the database and returns the appropriate &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;models&lt;/a&gt; back to your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controllers&lt;/a&gt; and/or &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding it to your service layer will also get you the added benefit of Craft auto-uploading the classes for you as well and attaching them to the global &lt;code&gt;craft()&lt;/code&gt; instance as &lt;code&gt;craft()-&amp;gt;pluginHandle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we're talking about enums, I'd follow Craft's example and create an &lt;code&gt;enums&lt;/code&gt; folder for your plugin.  From your plugin's &lt;code&gt;init()&lt;/code&gt; method, simply import your custom enums:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    Craft::import('plugins.yourPluginHandle.enums.MyCustomEnum');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-15T03:38:34.137" LastActivityDate="2014-07-15T03:38:34.137" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1100" PostTypeId="2" ParentId="1097" CreationDate="2014-07-15T04:45:41.040" Score="5" Body="&lt;p&gt;Right now that's probably the best way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 2.2, I just added a static &lt;code&gt;getConstants()&lt;/code&gt; method to BaseEnum, so you can do can do a &lt;code&gt;PluginStatus::getConstants()&lt;/code&gt; call that will return an array with a key =&gt; value pair of the enum options and their values that should make that cleaner.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-15T04:45:41.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1101" PostTypeId="1" AcceptedAnswerId="1218" CreationDate="2014-07-15T06:09:43.787" Score="5" ViewCount="2168" Body="&lt;p&gt;I have a section of type channel with a matrix field. I want to know how I would save the matrix content while I save the entry as well. I know I can save the entry as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry = new EntryModel();&#xA;    $content = array('productName' =&amp;gt; $data[0]['Product'][0], 'productQuantities' =&amp;gt; $data[0]['Product'][1]);&#xA;    $entry-&amp;gt;sectionId = 10;&#xA;    $entry-&amp;gt;typeId = 10;&#xA;    $entry-&amp;gt;postDate   = date('Y-m-d');&#xA;    $entry-&amp;gt;authorId   = 1;&#xA;&#xA;    $result = $entry-&amp;gt;setContentFromPost($content);&#xA;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = &quot;Fancy Title&quot;;&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The content variable above stores the content matrix block for this entry should have. So the Matrix has two fields within it one is of entry type and the other is numerical. I want to set these two fields before &quot;craft()-&gt;entries-&gt;saveEntry($entry);&quot;. Please someone tell me how this is possible. I know for the entries type field I have to create a relation but please help me by letting me know how to do that as well as how to create this new matrix block containing that relation etc.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2014-07-17T14:48:03.390" Title="How to save a matrix content of a new entry in my plugin?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1102" PostTypeId="1" CreationDate="2014-07-15T07:25:02.183" Score="2" ViewCount="1756" Body="&lt;p&gt;In my HTML-prototype I have two ways of showing a module of employees. One version shows one employee, and the other shows two. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To build this in Craft I have setup a Matrix field (with a handle named 'contactMatrix'). It contains a headline, some text and an entry field to pick employees (with a limit of two).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To output this in my front end I need a way to check if the user has picked one or two employees. Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if one employee within the matrix field is chosen&#xA;&lt;em&gt;do this html&lt;/em&gt;&#xA;else&#xA;if two employees within the matrix field is chosen&#xA;&lt;em&gt;do this slightly different html&lt;/em&gt;&#xA;end if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help, anyone? &lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="125" LastEditDate="2014-07-15T10:05:48.880" LastActivityDate="2014-07-15T17:23:39.287" Title="Checking if a matrix field with entries has more than one entry" Tags="&lt;matrix&gt;&lt;conditional&gt;&lt;field&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1103" PostTypeId="2" ParentId="1097" CreationDate="2014-07-15T07:55:19.533" Score="2" Body="&lt;p&gt;I found an issue importing the enums via the &lt;code&gt;init()&lt;/code&gt; method. You will receive a &lt;code&gt;Fatal error: Class 'Craft\PluginStatus' not found&lt;/code&gt; on install. It seems during the install the &lt;code&gt;init()&lt;/code&gt; method is not called in time to include the custom enums. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this works as its called immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;pluginname/PluginNamePlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;// include enums for custom statuses&#xA;include(dirname(__FILE__) . '/enums/PluginStatus.php');&#xA;&#xA;class PluginNamePlugin extends BasePlugin&#xA;{&#xA;    // etc&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-15T08:18:50.350" LastActivityDate="2014-07-15T08:18:50.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1104" PostTypeId="1" AcceptedAnswerId="1109" CreationDate="2014-07-15T08:09:28.643" Score="8" ViewCount="7771" Body="&lt;p&gt;I have a channel section with a handle named 'events'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my field layout for this section I have a field named eventsDate, which is a Date/Time field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a plain text field called 'eventsHeadline'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good way to output the 'eventsHeadline' entries ordered by 'eventsDate'?&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="125" LastEditDate="2014-07-15T14:20:19.073" LastActivityDate="2014-07-15T14:20:19.073" Title="Order entries by date field" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;elementcriteriamodel&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1105" PostTypeId="2" ParentId="673" CreationDate="2014-07-15T08:35:14.030" Score="1" Body="&lt;p&gt;I'm not sure how safe it is but I have just imported 301 redirects into Craft-Reroute by exporting the old &amp;amp; new url slugs to a csv file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then imported that using Sequel Pro and set default values for &lt;code&gt;method&lt;/code&gt;, &lt;code&gt;date_created&lt;/code&gt; &amp;amp; &lt;code&gt;date_updated&lt;/code&gt;. &lt;code&gt;Id&lt;/code&gt; is auto incremental but &lt;code&gt;uid&lt;/code&gt; isnt set unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-07-15T08:35:14.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1106" PostTypeId="1" CreationDate="2014-07-15T08:35:36.563" Score="1" ViewCount="533" Body="&lt;p&gt;Is there any way to rename files upon there upload to an assets field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can hit the options of the file and rename manually, but was wondering if there was a way to do this automatically? i.e. renamed based on the entry ID.&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2014-07-15T08:40:45.883" Title="Rename asset file upon upload?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1107" PostTypeId="2" ParentId="1106" CreationDate="2014-07-15T08:40:45.883" Score="1" Body="&lt;p&gt;Craft has the ability to dynamically add subfolder paths to Assets when you are creating the Asset field in the control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tags like {slug} and {author.username} are some of the available options for creating the directories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it has been brought up before and they have acknowledged the possibility. So who knows, maybe we will see it in 2.2? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, if organization is a concern I recommend using subfolders to keep it clean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4DyEe.png&quot; alt=&quot;asset field options&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-15T08:40:45.883" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1108" PostTypeId="2" ParentId="1102" CreationDate="2014-07-15T09:23:34.940" Score="4" Body="&lt;p&gt;I believe the code below should work. This code assumes you are on a single entry page or within a loop and your entry is available to you with the &lt;code&gt;entry&lt;/code&gt; variable. You may need to adjust the &lt;code&gt;block.type&lt;/code&gt; name and &lt;code&gt;block.employees&lt;/code&gt; entries field name to match your proper handles. I've added comments inline to clarify each step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through your Matrix Field #}&#xA;{% for block in entry.contactMatrix %}&#xA;&#xA;    {# Check to see which type of block you have.  You only want to check for the employees entry field if you are within the contact block #}&#xA;    {% if block.type == 'contact' %}&#xA;&#xA;        {# See if your employees entries field has more than 1 entry #}&#xA;        {% if block.employees|length &amp;gt; 1 %}&#xA;&#xA;          {# Output HTML for blocks with multiple employees #}&#xA;&#xA;        {% else %}&#xA;&#xA;          {# Output HTML for blocks with zero or one employee #}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-07-15T17:23:39.287" LastActivityDate="2014-07-15T17:23:39.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1109" PostTypeId="2" ParentId="1104" CreationDate="2014-07-15T09:57:19.080" Score="13" Body="&lt;p&gt;Read the article about &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; in the official Craft docs on how to query elements in general and the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;noreferrer&quot;&gt;craft.entries&lt;/a&gt; article about the parameter available to modify the object returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example code for your events list:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Get events from `events` section in desired sort order #}&#xA;{% set allEvents = craft.entries.section('events').order('eventsDate desc') %}&#xA;&#xA;{# Loop through `allEvents` and print the list #}&#xA;{% for event in allEvents %}&#xA;    &amp;lt;li&amp;gt;{{ event.eventsHeadline }} - {{ event.eventsDate|date('F j, Y') }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-15T14:18:29.640" LastActivityDate="2014-07-15T14:18:29.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1110" PostTypeId="1" CreationDate="2014-07-15T10:34:29.247" Score="13" ViewCount="2192" Body="&lt;p&gt;I'm in desperate need of a plugin that lets:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Users create calendar events or (even better) lets you import those from Outlook or GCal.&lt;/li&gt;&#xA;&lt;li&gt;Visitors participate in an event and (after submitting a form) get a calendar request through e-mail&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of any plugin(s) in the making, or should I start building my own?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="125" LastEditDate="2014-07-15T10:44:28.393" LastActivityDate="2016-09-24T00:11:49.713" Title="Plugins: Is there any events and/or calendar plugin in the making?" Tags="&lt;plugins&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1111" PostTypeId="1" AcceptedAnswerId="1142" CreationDate="2014-07-15T10:54:51.770" Score="28" ViewCount="3910" Body="&lt;p&gt;I have auto-updating currently disabled using the &quot;allowAutoUpdates&quot; config setting, due to concerns about plugin compatibility and unforeseen breakages, mainly due to experiences with other CMS's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm starting to feel that having that button available for clients to update automatically is very tempting, especially as the number of Craft installations to keep up to date increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How safe is this mechanic to enable? For example, if a client was to auto-update and there was a breakage, and the database was not able to roll back to a previous version? Surely you can't guarantee that the internal API won't change in the future, and if it ever does, how can the auto-update feature prevent plugin breakages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I was to enable it, would this just be a case of adding the app folder to my .gitignore and not including it in my git repo?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-07-16T11:43:44.753" Title="How safe is auto-updating?" Tags="&lt;auto-updates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="1112" PostTypeId="1" CreationDate="2014-07-15T11:48:54.220" Score="2" ViewCount="384" Body="&lt;p&gt;If I &quot;View source&quot; in my browser I get a bunch of stuff in the end of my html output. It starts with console.groupCollapsed(&quot;Application Log&quot;);. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this is something Craft does automatically. Is it possible to turn it off when I launch my site?&lt;/p&gt;&#xA;" OwnerUserId="507" LastActivityDate="2014-07-15T11:58:28.133" Title="console.groupCollapsed(&quot;Application Log&quot;); - what is it?" Tags="&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1113" PostTypeId="2" ParentId="1112" CreationDate="2014-07-15T11:58:07.403" Score="6" Body="&lt;p&gt;This is something Craft only shows if your site is in devMode (&lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot;&gt;http://buildwithcraft.com/help/dev-mode&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use Firebug or Chrome Developer Tools for instance, it shows you a performance and error log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By disabling devMode, it disappears. Do this by setting 'devMode' =&gt; false into your craft/config/general.php.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-07-15T11:58:07.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1114" PostTypeId="2" ParentId="1112" CreationDate="2014-07-15T11:58:28.133" Score="2" Body="&lt;p&gt;Just turn off &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; in your general config:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; false,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also check out the knowledge-base article: &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;What does Dev Mode do?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-15T11:58:28.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1115" PostTypeId="1" CreationDate="2014-07-15T12:49:38.317" Score="12" ViewCount="1577" Body="&lt;p&gt;Where in the Craft Control Panel can I globally delete a tag? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not from a specific entry, but completely out of the system.&lt;/p&gt;&#xA;" OwnerUserId="507" LastActivityDate="2017-07-22T01:29:22.363" Title="How do I delete a tag?" Tags="&lt;tags&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1116" PostTypeId="2" ParentId="1115" CreationDate="2014-07-15T12:55:18.313" Score="-2" Body="&lt;p&gt;Delete the &lt;em&gt;Tag Field&lt;/em&gt; in Settings &gt; Fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More about &lt;em&gt;Tags Fields&lt;/em&gt;: &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/tags-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer is incorrect. The correct answer is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Currently it’s not possible to delete tags (or otherwise manage them).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1118/298&quot;&gt;https://craftcms.stackexchange.com/a/1118/298&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-16T13:52:01.493" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1117" PostTypeId="1" AcceptedAnswerId="1119" CreationDate="2014-07-15T13:01:40.247" Score="12" ViewCount="21654" Body="&lt;p&gt;I'm using tags to do some Javascripting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way that I can tell Craft to remove whitespace from {{ tag.name }} if the tag.name has spaces (for example 'apples and carrots'), and add dashes ('apples-and-carrots') ?&lt;/p&gt;&#xA;" OwnerUserId="507" LastActivityDate="2019-12-05T08:22:27.627" Title="Removing whitespace from {{ tag.name }}" Tags="&lt;tags&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1118" PostTypeId="2" ParentId="1115" CreationDate="2014-07-15T13:16:54.223" Score="6" Body="&lt;p&gt;Currently it’s not possible to delete tags (or otherwise manage them).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-15T13:16:54.223" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1119" PostTypeId="2" ParentId="1117" CreationDate="2014-07-15T13:39:36.433" Score="24" Body="&lt;p&gt;There are multiple ways to solve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Native:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/url_encode.html&quot;&gt;Twigs &lt;code&gt;url_encode&lt;/code&gt; filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ &quot;apples and carrots&quot;|url_encode }}&#xA;{# outputs &quot;apples%20and%20carrots&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot;&gt;Twigs &lt;code&gt;replace&lt;/code&gt; filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ &quot;apples and carrots&quot;|replace(' ', '-') }}&#xA;{# outputs &quot;apples-and-carrots&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugins:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot;&gt;Twig PCRE Filters - Plugin&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ &quot;apples and carrots&quot;|preg_replace('/ /', '-') }}&#xA;{# outputs &quot;apples-and-carrots&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/low/low_regex/&quot;&gt;Low Regex - Plugin&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ &quot;apples and carrots&quot;|regex('/ /', '-') }}&#xA;{# outputs &quot;apples-and-carrots&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/boboldehampsink/7354431&quot;&gt;Slugify - Plugin&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ &quot;apples and carrots&quot;|slugify }}&#xA;{# outputs &quot;apples-and-carrots&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-15T13:39:36.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1120" PostTypeId="1" AcceptedAnswerId="1121" CreationDate="2014-07-15T14:58:47.850" Score="3" ViewCount="467" Body="&lt;p&gt;I'm working on creating an image transform to handle retina images. I upload the 2x assets and need an image transform to create my images at 50% their original size. Since images on the site can be varying widths and heights I am currently forced to create a new image transform for each image ratio. Percentage values would cut this down to a single image transform for everything.&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-07-15T18:51:22.613" Title="Is it possible to use percentage values for width and height in image transforms?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1121" PostTypeId="2" ParentId="1120" CreationDate="2014-07-15T15:22:06.440" Score="5" Body="&lt;p&gt;It’s possible to do this from your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.myAssetsField %}&#xA;&#xA;    {% set half = {&#xA;        width: (image.width/2)|round,&#xA;        height: (image.height/2)|round&#xA;    } %}&#xA;&#xA;    {% set halfUrl = image.getUrl(half) %}&#xA;&#xA;    &amp;lt;img src=&quot;{{ halfUrl }}&quot; srcset=&quot;{{ image.url }} 2x&quot; width=&quot;{{ half.width }}&quot; height=&quot;{{ half.height }}&quot;&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-07-15T18:51:22.613" LastActivityDate="2014-07-15T18:51:22.613" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1123" PostTypeId="2" ParentId="1111" CreationDate="2014-07-15T15:33:14.830" Score="15" Body="&lt;p&gt;We just had a client auto-update a Wordpress site, run into plugin conflicts, and bring their whole site down.  The Wordpress Wikipedia page references &quot;dead simple installation and upgrade&quot; being added in January 2004, which is over 10 years ago at the time of this posting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think someone can speak more extensively to the checks and fallbacks Craft has in place (or is planning to add), and I don't doubt that the makers of Craft, and the folks at WordPress, take one-click upgrades seriously and do their best to make the process pretty seamless and comfortable in most use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For small, low-risk sites, where the owner doesn't have an ongoing budget, it may be worth it to let them take that risk.  For anything where not taking the site offline matters, or that has a maintenance budget, I think the best approach is to have a developer test the update in a development environment first and push things live once it has been confirmed everything works smoothly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more plugins (or other variables) you have on your site, the more you should probably opt for the manual approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case, I'd make it very clear to clients that a one-click update is not a promise of youth and beauty and flawlessness.  It might come pretty close, it might be pretty tempting, and I'm sure it will improve; but Craft and the plugins and servers and networks and options around it will constantly be evolving and one-click update will have to evolve with them.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-15T15:33:14.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1125" PostTypeId="1" AcceptedAnswerId="1126" CreationDate="2014-07-15T16:47:54.950" Score="4" ViewCount="257" Body="&lt;p&gt;Lets say I have a channel called places, which has the following URL : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/places&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url points to a directory of individual places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when you click into an entry, each entry is a place, so it might make more sense to have each entry's url to be : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http:/example.com/place/place-name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I right in assuming that the best way to go about this would be to use a route for &lt;strong&gt;&lt;code&gt;entries&lt;/code&gt;&lt;/strong&gt;? Or is it best practice to keep things the same for consistency?&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="57" LastEditDate="2014-07-15T19:39:17.263" LastActivityDate="2014-07-15T19:39:17.263" Title="Should I pluralize a channel's index slug?" Tags="&lt;url&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1126" PostTypeId="2" ParentId="1125" CreationDate="2014-07-15T17:12:14.027" Score="11" Body="&lt;p&gt;It doesn’t matter to Craft, but generally I think it’s better to have consistent URLs, so they can be discoverable. For example if you land on /places/place-name, it would be reasonable to assume that you could chop off “place-name” and find an index of all the places at /places/.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-15T17:12:14.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1127" PostTypeId="1" CreationDate="2014-07-15T17:38:44.787" Score="4" ViewCount="7004" Body="&lt;p&gt;I'm doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get events from `events` section in desired sort order #}&#xA;{% set allEvents = craft.entries.section('events').order('eventsDate asc') %}&#xA;&#xA;{# Loop through `allEvents` and print the list #}&#xA;{% for event in allEvents %}&#xA;    &amp;lt;li&amp;gt;{{ event.title }} - {{ event.eventsDate|date('j F, Y') }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess I can do something with this: &lt;a href=&quot;http://php.net/manual/en/datetime.formats.date.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/datetime.formats.date.php&lt;/a&gt;, but I need to display months in my native language, which is slightly different from how Craft outputs it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I'd like it to say &quot;7 des&quot;, not &quot;07 dec&quot;, &quot;15 mai&quot;, not &quot;15th may&quot; and so on.&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="125" LastEditDate="2014-08-15T11:44:53.903" LastActivityDate="2014-08-15T11:51:24.333" Title="Is it possible to output month names in my native language?" Tags="&lt;localization&gt;&lt;datetime&gt;&lt;date&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1128" PostTypeId="1" AcceptedAnswerId="1135" CreationDate="2014-07-15T17:50:31.887" Score="7" ViewCount="3130" Body="&lt;p&gt;Since I am involved in a multi-developer, version-controlled setup, I do a lot of database importing and exporting from environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice today that when I export a database from one of our sites using the control panel &quot;Backup Database&quot; function, it comes out at about 3.6MB and takes about 5 minutes to import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I export from Sequel Pro, the database dump comes out at about 1.6MB and imports within 30 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, I always dump the existing tables before import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering what the difference is here that there is such a difference in file size and import time and which way is best?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2014-07-15T19:51:09.090" Title="Export database from control panel or Sequel Pro? What's the difference?" Tags="&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1129" PostTypeId="1" AcceptedAnswerId="1132" CreationDate="2014-07-15T17:55:45.050" Score="2" ViewCount="1046" Body="&lt;p&gt;So I may be somewhat obtuse here, but I’m trying to discern what I might be doing wrong in this instance. I’m attempting to use a &lt;code&gt;{% paginate %}&lt;/code&gt; tag inside my &lt;code&gt;craft.entries&lt;/code&gt; loop to return a simple next/previous set of pagination links. I have ensured I have two entries already, so I should be seeing the pagination links, correct?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('houseRules').limit(1) %}&#xA;    &amp;lt;div class=&quot;rule-content&quot;&amp;gt;&#xA;        &amp;lt;article&amp;gt;&#xA;            {# Content is Here #}&#xA;        &amp;lt;/article&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% paginate craft.entries as entries %}&#xA;        {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;        {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% endpaginate %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastActivityDate="2014-07-15T18:22:38.163" Title="How do I create pagination links for my entry index page?" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1130" PostTypeId="2" ParentId="1127" CreationDate="2014-07-15T17:59:56.637" Score="1" Body="&lt;p&gt;I think &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1039/multilingual-dates-where-date-format-varies&quot;&gt;Multilingual Dates where date format varies&lt;/a&gt; pretty much covers it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For details on date formats you will want to look at php's &lt;a href=&quot;http://us2.php.net/manual/en/function.date.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;date format documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-15T17:59:56.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1131" PostTypeId="1" AcceptedAnswerId="1146" CreationDate="2014-07-15T18:20:38.573" Score="1" ViewCount="293" Body="&lt;p&gt;I'm confused over this simple problem of a conditional printing &quot;1&quot; instead of behaving normally, and I can't figure out why it's happening.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Goal&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;    &amp;lt;label for=&quot;contactFirstName&quot; class=&quot;required&quot;&amp;gt;First Name*&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;contactFirstName&quot; value=&quot;&quot; class=&quot;required&quot;&amp;gt;&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Attempt&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I've passed a &lt;code&gt;field&lt;/code&gt; variable that contains the following (among other things)...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;handle&lt;/code&gt; (string) =&gt; &lt;code&gt;&quot;contactFirstName&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;label&lt;/code&gt; (string) =&gt; &lt;code&gt;&quot;First Name&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;required&lt;/code&gt; (boolean) =&gt; &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...into a macro...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro labeledInput(field) %}&#xA;    &amp;lt;p&amp;gt;&#xA;        &amp;lt;label for=&quot;{{ field.handle }}&quot;{% if field.required %} class=&quot;required&quot;{% endif %}&amp;gt;&#xA;            {{ field.label }}{% if field.required %}*{% endif %}&#xA;        &amp;lt;/label&amp;gt;&#xA;        &amp;lt;input name=&quot;{{ field.handle }}&quot; value=&quot;&quot;{% if field.required %} class=&quot;required&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;/p&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Result/Mystery&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&quot;Couldn't be easier!&quot;, we're all thinking. Except that the markup comes out like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;    &amp;lt;label for=&quot;contactFirstName&quot;1&amp;gt;&#xA;        First Name1     &#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;contactFirstName&quot; value=&quot;&quot;1&amp;gt;&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Potential Clues&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If I add &lt;code&gt;{% if true == true %}foo{% endif %}&lt;/code&gt; in the macro, I'll get &lt;code&gt;foo&lt;/code&gt; and not a &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When the value of &lt;code&gt;required&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt;, nothing prints (as you'd expect).&lt;/li&gt;&#xA;&lt;li&gt;It doesn't seem to matter whether I'm using a macro, an include, or whether I try the same thing in my parent template.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;field&lt;/code&gt; object is a Sprout Forms &lt;code&gt;SproutForms_HtmlDisplay&lt;/code&gt;, if that ends up being significant.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How is it possible for &lt;code&gt;{% if field.required %}*{% endif %}&lt;/code&gt; to print a &lt;code&gt;1&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;{{ dump(field) }}&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(Craft\SproutForms_HtmlDisplay)#544 (1) {&#xA;  [&quot;htmlFields&quot;:&quot;Craft\SproutForms_HtmlDisplay&quot;:private] =&amp;gt; array(10) {&#xA;    [&quot;input&quot;] =&amp;gt; string(145) &quot;&#xA;        &amp;lt;input class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; id=&quot;contactFirstName&quot; name=&quot;contactFirstName&quot; value=&quot;&quot; autocomplete=&quot;off&quot; placeholder=&quot;&quot;&amp;gt;&#xA;    &quot;&#xA;    [&quot;handle&quot;] =&amp;gt; string(16) &quot;contactFirstName&quot;&#xA;    [&quot;type&quot;] =&amp;gt; string(9) &quot;plaintext&quot;&#xA;    [&quot;settings&quot;] =&amp;gt;&#xA;      array(4) {&#xA;        [&quot;placeholder&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;        [&quot;maxLength&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;        [&quot;multiline&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;        [&quot;initialRows&quot;] =&amp;gt; string(1) &quot;4&quot;&#xA;      }&#xA;    [&quot;validation&quot;]=&amp;gt;&#xA;      array(1) {&#xA;        [0] =&amp;gt; string(8) &quot;required&quot;&#xA;      }&#xA;    [&quot;required&quot;] =&amp;gt; bool(true)&#xA;    [&quot;instructions&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;    [&quot;hint&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;    [&quot;label&quot;] =&amp;gt; string(10) &quot;First Name&quot;&#xA;    [&quot;error&quot;] =&amp;gt; string(0) &quot;&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;compiled template for macro&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* macros/forms */&#xA;class __TwigTemplate_6b53fb724811bc086c93653f7ad8519f9f9b0f194a80bfde00a078376bde6a36 extends Craft\BaseTemplate&#xA;{&#xA;    public function __construct(Twig_Environment $env)&#xA;    {&#xA;        parent::__construct($env);&#xA;&#xA;        $this-&amp;gt;parent = false;&#xA;&#xA;        $this-&amp;gt;blocks = array(&#xA;        );&#xA;    }&#xA;&#xA;    protected function doDisplay(array $context, array $blocks = array())&#xA;    {&#xA;    }&#xA;&#xA;    // line 1&#xA;    public function getlabeledInput($_field = null)&#xA;    {&#xA;        $context = $this-&amp;gt;env-&amp;gt;mergeGlobals(array(&#xA;            &quot;field&quot; =&amp;gt; $_field,&#xA;        ));&#xA;&#xA;        $blocks = array();&#xA;&#xA;        ob_start();&#xA;        try {&#xA;            // line 2&#xA;            echo &quot;&#xA;\t&amp;lt;p&amp;gt;&#xA;\t\t&amp;lt;label for=\&quot;&quot;;&#xA;            // line 4&#xA;            echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;handle&quot;), &quot;html&quot;, null, true);&#xA;            echo &quot;\&quot;&quot;;&#xA;            if ((!twig_test_empty($this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;required&quot;)))) {&#xA;                echo &quot; class=\&quot;required\&quot;&quot;;&#xA;            }&#xA;            echo &quot;&amp;gt;&#xA;\t\t\t&quot;;&#xA;            // line 5&#xA;            echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;label&quot;), &quot;html&quot;, null, true);&#xA;            if ((!twig_test_empty($this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;required&quot;)))) {&#xA;                echo &quot;*&quot;;&#xA;            }&#xA;            // line 6&#xA;            echo &quot;\t\t&amp;lt;/label&amp;gt;&#xA;\t\t&amp;lt;input name=\&quot;&quot;;&#xA;            // line 7&#xA;            echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;handle&quot;), &quot;html&quot;, null, true);&#xA;            echo &quot;\&quot; value=\&quot;\&quot;&quot;;&#xA;            if ((!twig_test_empty($this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;required&quot;)))) {&#xA;                echo &quot; class=\&quot;required\&quot;&quot;;&#xA;            }&#xA;            echo &quot;&amp;gt;&#xA;\t&amp;lt;/p&amp;gt;&#xA;&#xA;&quot;;&#xA;        } catch (Exception $e) {&#xA;            ob_end_clean();&#xA;&#xA;            throw $e;&#xA;        }&#xA;&#xA;        return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this-&amp;gt;env-&amp;gt;getCharset());&#xA;    }&#xA;&#xA;    public function getTemplateName()&#xA;    {&#xA;        return &quot;macros/forms&quot;;&#xA;    }&#xA;&#xA;    public function isTraitable()&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    public function getDebugInfo()&#xA;    {&#xA;        return array (  36 =&amp;gt; 4,  169 =&amp;gt; 122,  163 =&amp;gt; 114,  155 =&amp;gt; 112,  147 =&amp;gt; 110,  143 =&amp;gt; 109,  139 =&amp;gt; 108,  131 =&amp;gt; 106,  127 =&amp;gt; 105,  124 =&amp;gt; 104,  122 =&amp;gt; 103,  119 =&amp;gt; 102,  117 =&amp;gt; 101,  46 =&amp;gt; 28,  40 =&amp;gt; 26,  33 =&amp;gt; 22,  21 =&amp;gt; 1,  54 =&amp;gt; 21,  44 =&amp;gt; 5,  38 =&amp;gt; 25,  32 =&amp;gt; 2,  26 =&amp;gt; 7,  19 =&amp;gt; 1,  347 =&amp;gt; 180,  330 =&amp;gt; 168,  318 =&amp;gt; 159,  314 =&amp;gt; 158,  303 =&amp;gt; 150,  299 =&amp;gt; 149,  295 =&amp;gt; 148,  266 =&amp;gt; 126,  263 =&amp;gt; 125,  260 =&amp;gt; 124,  255 =&amp;gt; 121,  238 =&amp;gt; 107,  232 =&amp;gt; 106,  224 =&amp;gt; 103,  216 =&amp;gt; 100,  191 =&amp;gt; 80,  187 =&amp;gt; 78,  176 =&amp;gt; 75,  171 =&amp;gt; 74,  167 =&amp;gt; 73,  159 =&amp;gt; 113,  135 =&amp;gt; 107,  110 =&amp;gt; 22,  87 =&amp;gt; 182,  85 =&amp;gt; 180,  82 =&amp;gt; 29,  80 =&amp;gt; 124,  77 =&amp;gt; 123,  75 =&amp;gt; 26,  72 =&amp;gt; 25,  70 =&amp;gt; 21,  65 =&amp;gt; 19,  56 =&amp;gt; 22,  49 =&amp;gt; 6,  42 =&amp;gt; 14,  34 =&amp;gt; 6,  29 =&amp;gt; 8,  25 =&amp;gt; 2,  23 =&amp;gt; 1,  151 =&amp;gt; 111,  148 =&amp;gt; 94,  146 =&amp;gt; 93,  123 =&amp;gt; 73,  115 =&amp;gt; 68,  107 =&amp;gt; 21,  98 =&amp;gt; 57,  94 =&amp;gt; 56,  81 =&amp;gt; 45,  79 =&amp;gt; 28,  61 =&amp;gt; 23,  52 =&amp;gt; 7,  50 =&amp;gt; 19,  31 =&amp;gt; 4,  28 =&amp;gt; 3,);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Point of Failure !&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not even sure what this means, but this automatically-generated conditional from the compiled template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($this-&amp;gt;getAttribute((isset($context[&quot;field&quot;]) ? $context[&quot;field&quot;] : $this-&amp;gt;getContext($context, &quot;field&quot;)), &quot;required&quot;)) {&#xA;    echo &quot;pony&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...produces a &lt;code&gt;1&lt;/code&gt;. If I cheat...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($context[&quot;field&quot;]-&amp;gt;required) {&#xA;     echo &quot;pony&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...I get &lt;code&gt;pony&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hacking at SproutFormsVariable.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I make &lt;code&gt;_getFieldOutput()&lt;/code&gt; return a dumb array instead of an instance of &lt;code&gt;SproutForms_HtmlDisplay&lt;/code&gt;, the template will parse properly...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field['handle']   = $handle;&#xA;$field['label']    = $fieldInfo-&amp;gt;name;&#xA;$field['required'] = in_array('required', $fieldModel-&amp;gt;validation) ? true : false;&#xA;&#xA;return $field;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastEditorUserId="45" LastEditDate="2014-07-15T23:48:56.727" LastActivityDate="2014-07-15T23:48:56.727" Title="Why would an if statement insist on printing a value?" Tags="&lt;templating&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="8" ClosedDate="2014-07-17T20:09:26.027" ContentLicense="CC BY-SA 3.0" />
  <row Id="1132" PostTypeId="2" ParentId="1129" CreationDate="2014-07-15T18:22:38.163" Score="5" Body="&lt;p&gt;You have your &lt;code&gt;{% for %}&lt;/code&gt; and &lt;code&gt;{% paginate %}&lt;/code&gt; tags in the reverse order. You need to wrap the loop &lt;em&gt;and&lt;/em&gt; the pagination URLs with the &lt;code&gt;{% paginate %}&lt;/code&gt; tag pair:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('houseRules').limit(1) as entries %}&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;div class=&quot;rule-content&quot;&amp;gt;&#xA;            &amp;lt;article&amp;gt;&#xA;                {# Content is here #}&#xA;            &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice how we’re actually looping through &lt;code&gt;entries&lt;/code&gt;, rather than a new &lt;code&gt;craft.entries&lt;/code&gt; call. That &lt;code&gt;entries&lt;/code&gt; variable will be an array of the current page’s entries. All we had to do is define what we wanted that variable to be called (e.g. “entries”).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/tags#paginate&lt;/a&gt; for more details on what can be done inside the &lt;code&gt;{% paginate %}&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-15T18:22:38.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1133" PostTypeId="1" CreationDate="2014-07-15T18:36:01.400" Score="2" ViewCount="1773" Body="&lt;p&gt;I'm using a lightswitch field to add a class to my html document body-tag. The field is added to a section  with a handle named &quot;events&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this happen, I do this in my _layout.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.whiteLogoText %}&#xA;    &amp;lt;body class=&quot;white&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;body&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I also want to use such a lightswitch for entries of a different section (with a field handle named 'projects').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I make a new lightswitch field for this particular section, and if so, how should I print it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanna make sure I don't get two &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;-tags.&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="507" LastEditDate="2014-07-15T20:39:35.030" LastActivityDate="2014-07-15T21:28:45.350" Title="Two different lightswitches to add class on body tag" Tags="&lt;conditional&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1134" PostTypeId="2" ParentId="1128" CreationDate="2014-07-15T19:10:07.350" Score="3" Body="&lt;p&gt;Not an expert&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Brad is, see his post&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I have noticed, the difference seems to be merely one of syntax in the way SQL dump are written. Sequel pro is more generic (and also more optimised as Brad explains). Craft creates files that are tailored for Craft and the way it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used both indifferently and never had any problem, although I tend to go with Craft generated ones lately. &lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2014-07-15T19:51:09.090" LastActivityDate="2014-07-15T19:51:09.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1135" PostTypeId="2" ParentId="1128" CreationDate="2014-07-15T19:31:47.227" Score="10" Body="&lt;p&gt;The difference in both size and speed is likely because Sequel Pro (and any other MySQL client) is likely using &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html&quot;&gt;mysqldump&lt;/a&gt;, which is a native CLI command and highly optimized.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft can't rely on that for a variety of reasons (PHP might have have &lt;a href=&quot;http://php.net/manual/en/function.exec.php&quot;&gt;exec&lt;/a&gt; permissions, the account Craft uses to connect to the database might not have the permissions necessary to perform a backup, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So Craft has it's own fallback where it manually analyzes the database's &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_manipulation_language&quot;&gt;DML&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_definition_language&quot;&gt;DDL&lt;/a&gt; and writes it out to a file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slower?  Yes.  Larger file size?  Yes.  More reliable for Craft?  Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is on our list somewhere to check if Craft has the ability to access &lt;code&gt;mysqldump&lt;/code&gt; and use that, if not fall back to our current method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-15T19:31:47.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1136" PostTypeId="2" ParentId="1110" CreationDate="2014-07-15T19:47:10.847" Score="5" Body="&lt;p&gt;Until the Craft plugin store becomes an &quot;official things&quot;, the best, most curated list of plugins available for Craft is over on &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing I can find on there to what you're looking for is the &quot;&lt;a href=&quot;http://straightupcraft.com/craft-plugins/recurring-dates&quot; rel=&quot;nofollow&quot;&gt;Recurring Dates&lt;/a&gt;&quot; plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-23T00:43:58.227" LastActivityDate="2014-09-23T00:43:58.227" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1137" PostTypeId="2" ParentId="1133" CreationDate="2014-07-15T20:01:35.507" Score="1" Body="&lt;p&gt;You can use the same lightswitch field on both of your channel sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wouldn't use an EntryModel in the &lt;code&gt;_layout.html&lt;/code&gt; (assuming that's a template you use to extend your actual entry and index templates with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably have two different &lt;code&gt;_entry.html&lt;/code&gt; templates for your sections &quot;project&quot; and &quot;events&quot;. Define a variable in these if your condition (lightswitch) is true:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% if entry.whiteLogoText %}&#xA;    {% set bodyClass = 'white' %}&#xA;{% endif %}&#xA;&#xA;{% block content %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how your &lt;code&gt;_layout.html&lt;/code&gt; should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if bodyClass is defined %}&#xA;    &amp;lt;body class=&quot;otherBodyClasses {{ bodyClass }}&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;body class=&quot;otherBodyClasses&quot;&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;main class=&quot;page&quot; role=&quot;main&quot;&amp;gt;&#xA;    {% block content %}&#xA;    {% endblock %}&#xA;&amp;lt;/main&amp;gt;&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or with the ternary syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;body class=&quot;otherBodyClasses {{ bodyClass is defined ? bodyClass }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can additionally set that &lt;code&gt;bodyClass&lt;/code&gt; variable in other templates using different conditionals:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if myGlobalSetHandle.whiteLogoTextForProjectsEntries %}&#xA;    {% set bodyClass = 'white' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or (based on my latest assumptions on what you wanna do):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Define var before the for loop #}&#xA;{% set bodyClass = '' %}&#xA;&#xA;{# Check if `whiteLogoText` is set on any &quot;project&quot; entry #}&#xA;{% for project in craft.entries.section('projects') %}&#xA;    {% if project.whiteLogoText %}&#xA;        {% set bodyClass = 'white' %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this last code example you have to define the variable before the loop to make it accessible outside of it. Because you will always have a &lt;code&gt;bodyClass&lt;/code&gt; defined then, change the conditional in your &lt;code&gt;_layout.html&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;body class=&quot;otherBodyClasses {{ bodyClass is defined and != '' ? bodyClass }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-15T21:28:45.350" LastActivityDate="2014-07-15T21:28:45.350" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1138" PostTypeId="2" ParentId="1127" CreationDate="2014-07-15T20:36:59.120" Score="3" Body="&lt;p&gt;Yes, the &lt;code&gt;date()&lt;/code&gt; filter you use (see &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;Twig docs&lt;/a&gt;) allows you to format dates with the same &lt;a href=&quot;http://php.net/date&quot; rel=&quot;nofollow&quot;&gt;formating characters&lt;/a&gt; as the php date function takes. All language dependent parts are returned in the language of the current locale. I don't know if you can change that primary locale in the control panel, but you could do that in the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted in the comments to your question, you want the CP to be in english. This is possible even if you set the site's locale to another language; the site's locale and the user language for the CP are different things.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-15T11:51:24.333" LastActivityDate="2014-08-15T11:51:24.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1139" PostTypeId="1" AcceptedAnswerId="1140" CreationDate="2014-07-15T21:33:31.010" Score="1" ViewCount="901" Body="&lt;p&gt;Can I manually set a user's password?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can change it but it is asking for the current password which is null at the moment.&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2014-07-15T21:36:47.637" Title="Set User Password Manually" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1140" PostTypeId="2" ParentId="1139" CreationDate="2014-07-15T21:36:47.637" Score="6" Body="&lt;p&gt;The current password it is asking for when you change it is not the password of the user who is having their pasword changed, but the password of the admin (you) who is doing the changing.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-15T21:36:47.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1141" PostTypeId="1" AcceptedAnswerId="1145" CreationDate="2014-07-15T22:28:05.733" Score="3" ViewCount="546" Body="&lt;p&gt;I have a optional &lt;code&gt;dateFinished&lt;/code&gt; attribute in my &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;Record&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        ...&#xA;        'dateFinished'  =&amp;gt; AttributeType::DateTime,&#xA;        ...&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some Records have it set to a &lt;a href=&quot;http://php.net/manual/en/datetime.format.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateTime&lt;/a&gt; other have it set to &lt;code&gt;null&lt;/code&gt; (default).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prevent Twig errors I tried using the &lt;a href=&quot;https://craftcms.stackexchange.com/q/356/177&quot;&gt;&lt;code&gt;is defined&lt;/code&gt; test&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ log.dateFinished is defined ? log.dateFinished|date('m.d.y - H:m'|t) : '-'}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't work, I'm getting the typical &quot;Scope error&quot;. After taking a look at the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;dump()&lt;/code&gt;&lt;/a&gt; it looks that even a &lt;code&gt;null&lt;/code&gt; value is getting defined:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;  [&quot;dateFinished&quot;]=&amp;gt;&#xA;  object(Craft\DateTime)#2670 (3) {&#xA;    [&quot;date&quot;]=&amp;gt;&#xA;    string(19) &quot;2014-07-15 17:48:25&quot;&#xA;    [&quot;timezone_type&quot;]=&amp;gt;&#xA;    int(1)&#xA;    [&quot;timezone&quot;]=&amp;gt;&#xA;    string(6) &quot;+00:00&quot;&#xA;  }&#xA;&#xA;  ....&#xA;&#xA;  [&quot;dateFinished&quot;]=&amp;gt;&#xA;  array(2) {&#xA;    [&quot;column&quot;]=&amp;gt;&#xA;    string(8) &quot;datetime&quot;&#xA;    [&quot;type&quot;]=&amp;gt;&#xA;    string(8) &quot;datetime&quot;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to solve this by &quot;&lt;a href=&quot;https://stackoverflow.com/a/14482336/3589841&quot;&gt;Check(ing) if a variable is a date with Twig&lt;/a&gt;&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ log.dateFinished is defined and log.dateFinished.timestamp is defined ? log.dateFinished|date('m.d.y - H:m'|t) : '-'}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't make a difference, I'm still getting the &quot;Scope error&quot;. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-07-16T00:01:06.960" Title="How to check if a DateTime attribute is set?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1142" PostTypeId="2" ParentId="1111" CreationDate="2014-07-15T22:28:35.090" Score="67" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1123/57&quot;&gt;Ben gives some good practical updating advice.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I agree with him that for the majority of cases, the best practice is to update locally, then push to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just adding my 2 cents on top of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First, some background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being a self-hosted PHP web application is a hard life.  Your parents try to raise you correctly and equip you with the tools necessary to successfully go out into the world and live on some stranger's unknown, unfriendly and oftentimes hostile server environment so you can serve up web pages, but things are stacked against you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any given 1,000 web hosting providers, you will find 2,500 different environmental configurations... at least.  Different Linux distributions each with their own different libraries and versions.  Windows servers running IIS... or Apache.  Different permissions and user/group setups for each account.  Different versions of Apache and all of its modules... or nginx. Different MySQL versions each with different configurations.  Or &quot;&lt;a href=&quot;https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/&quot; rel=&quot;noreferrer&quot;&gt;drop in&lt;/a&gt;&quot; MySQL replacements that the host doesn't mention they're using, that's actually not a drop in replacement.  Or hosts that decide it's a good idea to store PHP sessions in memcached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll find yourself living on fully-managed servers where you have limited to zero control of what you can do.  On boxes administered by weekend sysadmin warriors, running the bleeding edge of every piece of software on their box, because they read it on HackerNews.  You'll live on overloaded, underperforming, $5/month shared hosting accounts where the host has crammed 400 sites on one box and you get blamed for being slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.hanselman.com/blog/EverythingsBrokenAndNobodysUpset.aspx&quot; rel=&quot;noreferrer&quot;&gt;Everything is broken&lt;/a&gt;.  &lt;a href=&quot;http://techcrunch.com/2014/03/29/the-internet-is-held-together-with-bubble-gum-and-baling-wire/&quot; rel=&quot;noreferrer&quot;&gt;It's amazing software works at all&lt;/a&gt;, &lt;a href=&quot;https://medium.com/message/everything-is-broken-81e5f33a24e1&quot; rel=&quot;noreferrer&quot;&gt;much less the Internet.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is a simple PHP script meant to survive is such as harsh world?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we've painted this picture of a horrible, bleak universe that Craft has to live in, let's look at some stats:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Auto-updating stats&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hard numbers:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft has successfully sent out over 8,100 auto-update requests.&lt;/li&gt;&#xA;&lt;li&gt;94% of Craft installs with recent control panel usage are running Craft 2.&lt;/li&gt;&#xA;&lt;li&gt;Since launch, we've received roughly 2,000 Craft-related support tickets.&lt;/li&gt;&#xA;&lt;li&gt;About 370 of those tickets have been related to updating.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Soft, touchy-feely, by-the-gut numbers:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Of those 370 updating support tickets, I'd guess 90% of them fall into environmental issues that are mostly outside of Craft's control, but Craft tries to deal with as gracefully as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually the culprits are either a) permissions aren't setup correctly and Craft can't download the update patch file, unzip it, or write to the craft/app folder to actually update the files b) during the update, Craft runs into a php.ini limitation... &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;noreferrer&quot;&gt;memory_limit&lt;/a&gt; and &lt;a href=&quot;http://php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;noreferrer&quot;&gt;max_execution_time&lt;/a&gt; being the most common.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these can be an issue if they are set low (32M and 30 seconds on older PHP installs or stingy hosts), or the size of your database has grown large enough that when Craft tries to automatically back it up during an update, it bumps into them.  That's a reason we added the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;noreferrer&quot;&gt;backupDbonUpdate&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll also see a spike in update errors related to these settings during bigger Craft updates (like 1.3 =&gt; 2.0) when we'll do an update to &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;noreferrer&quot;&gt;Yii&lt;/a&gt;, for example, that touches thousands of files.  More files in an update = more time to process the update = more of a chance of bumping into a limit.  Some people might prefer to do a &lt;a href=&quot;http://buildwithcraft.com/docs/updating#manually-updating&quot; rel=&quot;noreferrer&quot;&gt;manual update&lt;/a&gt; during those times, since that can finish executing quicker than an auto-update would.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will also try to increase these limits for itself at runtime during potentially long running or memory intensive operations like updating, but that doesn't always work.  Some hosts have hard limits on them and things like &lt;a href=&quot;http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html&quot; rel=&quot;noreferrer&quot;&gt;FastCGI&lt;/a&gt; don't allow PHP scripts to use &lt;a href=&quot;http://php.net/manual/en/function.ini-set.php&quot; rel=&quot;noreferrer&quot;&gt;ini_set()&lt;/a&gt; in order to increase them at runtime.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;5% of those tickets are related to bugs in a database migration that the update needs to run.  This usually occurs when we overlook some way that someone is using Craft and usually get fixed quickly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The remaining 5% of the tickets were related to bugs in the updating logic in Craft itself.  We saw a few of these back in the 1.0, 1.1 and maybe 1.2 days, but honestly haven't ran into one in quite awhile (knocks on wood).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Does Craft practice safe-updating?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I think so.  We've got some ideas to try and further bullet-proof the process, but this is how it stands currently and is working out pretty well.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When Craft downloads an update patch file, it first validates the MD5 hash of the file to make sure that the file it received is the one it expected and nothing got corrupted during the transfer.  If a failure occurs here, we consider that a non-rollback failure - meaning, a failure has occurred, but no files have been updated, the database hasn't been touched and the site is still online - so no harm, no foul.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft will unzip that file to a temp location, grab the &lt;code&gt;RequirementsChecker&lt;/code&gt; script from the recently unzipped file and run it, so that if any new requirements were added to be able to run Craft, and your server doesn't support them, you'll get a message stating so. If a failure occurs here, it's a non-rollback failure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;From the recently unzipped patch file, Craft will validate that all of the paths that it's about to update are still writable by PHP.  If a failure occurs here, it's a non-rollback failure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft will now make a backup of all of the files/folders it's about to update by coping them from &lt;code&gt;fileName.php&lt;/code&gt; to &lt;code&gt;fileName.php.bak&lt;/code&gt; or &lt;code&gt;folderName&lt;/code&gt; to &lt;code&gt;folderName.bak&lt;/code&gt;.  If the update deleted a file/folder, it still gets a backup created.  If a failure occurs here, it's a non-rollback failure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The recently updated files get coped over to their new homes.  If a file was deleted during the update, it gets deleted at this point.  If a failure occurs here, it's a file-only rollback failure and Craft will attempt to take all of the recently backed-up .bak files and put them back in their proper place and put the site back online.  The database hasn't been touched at this point.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If Craft is configured to backup the database during update, this is the point where a database backup gets created. If a failure occurs here, it will do a file-only rollback.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the update came with any new database migrations (alter table schema, and/or data) to run, this is the point where they run.  If a migration fails, or any other error occurs, this is a full-rollback failure and Craft will attempt to restore the database from the backup it just made in step 6 to its last known working state, as well as perform the file rollback.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we've made it this far, we're almost done.  All that is left is housekeeping.  Craft will try to delete all of the .bak files it created as well as flush various bits of info from cache.  If a failure occurs at this point, technically the upgrade is finished, so we don't attempt any rollback.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-16T11:13:07.497" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1143" PostTypeId="5" CreationDate="2014-07-15T22:29:29.660" Score="0" Body="&lt;p&gt;Active record models (or “records”) are like models, except with a database-facing layer built on top. On top of all the things that models can do, records can:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Define database table schemas&lt;/li&gt;&#xA;&lt;li&gt;Represent rows in the database&lt;/li&gt;&#xA;&lt;li&gt;Find, alter, and delete rows&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-16T00:24:06.297" LastActivityDate="2014-07-16T00:24:06.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1144" PostTypeId="4" CreationDate="2014-07-15T22:29:29.660" Score="0" Body="Active record models (or “records”) are models, with a database-facing layer built in." OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-16T00:23:53.280" LastActivityDate="2014-07-16T00:23:53.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1145" PostTypeId="2" ParentId="1141" CreationDate="2014-07-15T23:23:02.667" Score="4" Body="&lt;p&gt;You shouldn't be returning a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;record&lt;/a&gt; instance to your templates directly. That can lead to all sorts of badness like templates being able to update the database themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;service&lt;/a&gt; populate a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Mailer_LogModel&lt;/a&gt; with just the attributes you want to expose to your template and return that.  Pretty sure after you do that, a simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if log.dateFinished %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-07-16T00:01:06.960" LastActivityDate="2014-07-16T00:01:06.960" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1146" PostTypeId="2" ParentId="1131" CreationDate="2014-07-15T23:38:53.503" Score="4" Body="&lt;p&gt;Wow Matt, awful question! You should probably have a moderator remove it so nobody else has to suffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;SproutForms_HtmlDisplay&lt;/code&gt;, change the &lt;code&gt;__call()&lt;/code&gt; function's &lt;code&gt;echo&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __call($key, $args)&#xA;{&#xA;    if (isset($this-&amp;gt;htmlFields[$key]))&#xA;    {&#xA;        echo $this-&amp;gt;htmlFields[$key];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...to a &lt;code&gt;return&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __call($key, $args)&#xA;{&#xA;    if (isset($this-&amp;gt;htmlFields[$key]))&#xA;    {&#xA;        return $this-&amp;gt;htmlFields[$key];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-07-15T23:38:53.503" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1147" PostTypeId="1" AcceptedAnswerId="1148" CreationDate="2014-07-16T02:08:27.733" Score="6" ViewCount="848" Body="&lt;p&gt;I think the transform feature is great, although in my case I need to request that certain images be uploaded at specific dimensions to an assets field. (i.e. 500 x 300 pixels). These dimensions will also need to be required on the front-end Guest Entries form. Although I don't see this option in the control panel or in the docs. Is this something that can be done?&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-10-09T10:29:03.043" Title="How do you require specific dimensions when uploading an image?" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1148" PostTypeId="2" ParentId="1147" CreationDate="2014-07-16T02:23:51.823" Score="2" Body="&lt;p&gt;You are correct, a front-end would be needed. It is however possible to limit by upload size (how many bytes).&lt;/p&gt;&#xA;" OwnerUserId="531" LastActivityDate="2014-07-16T02:23:51.823" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1149" PostTypeId="1" AcceptedAnswerId="1151" CreationDate="2014-07-16T04:47:55.123" Score="3" ViewCount="1151" Body="&lt;p&gt;I have a custom element type with its own table 'pluginname_entries'. I am trying to find a way to &quot;dummy proof&quot; changing the plugins status. So I came up, aka stole from the Events element type, with the idea of clicking a button that triggers a controller action - similar to the following example to delete my element types entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;actionDelete()&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Deletes an entry.&#xA; */&#xA;public function actionDelete()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $entryId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('entryId');&#xA;&#xA;    if (craft()-&amp;gt;elements-&amp;gt;deleteElementById($entryId))&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Entry deleted.'));&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Couldn’t delete entry.'));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I love the concept or a quick way to delete or update the entry, more specifically the entry custom status, with a simple click of a button. So I came up with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;actionDeny()&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Changes an entry to denied.&#xA; */&#xA;public function actionDeny()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $status = PluginStatus::Denied;&#xA;&#xA;    $entryId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('entryId');&#xA;&#xA;    $query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('id, status')&#xA;        -&amp;gt;from('entries')&#xA;        -&amp;gt;where(array(&#xA;            'id' =&amp;gt; $entryId&#xA;        ))-&amp;gt;queryRow();&#xA;&#xA;    if ($query == null) {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Unable to deny the entry.'));&#xA;    }&#xA;    else {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('The entry was denied.'));&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works as intended, notifying the user but of course doesn't actually update the &lt;code&gt;status&lt;/code&gt; column to the new value, is there a better way to handle this? Maybe more of a &quot;Craft&quot; way?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-16T05:53:43.073" Title="How do I update a column value in my custom plugin with a simple controller?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1150" PostTypeId="1" AcceptedAnswerId="1161" CreationDate="2014-07-16T05:20:07.633" Score="3" ViewCount="1850" Body="&lt;p&gt;What I am trying to do is have my plugin know when I edit a post that is part of a particular section - let's call it &quot;parts&quot; - which then checks to see if a field is filled out in the form and then hits up an API and then pulls information from it and inserts it into empty fields in the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to clarify, here is a flow of what I'm looking to do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I create an entry in the section &quot;parts&quot;. &lt;/li&gt;&#xA;&lt;li&gt;Upon saving, it checks to see if the part number field is filled in.&lt;/li&gt;&#xA;&lt;li&gt;If the field is filled in it will access an external json api and I'll pull a certain value (or in some cases multiple values) from the array.&lt;/li&gt;&#xA;&lt;li&gt;I then want to have it fill in/update/replace the values in fields that I specify that are part of this entry. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So essentially I am trying to figure out how to: Have my plugin trigger once an entry in a specific section is edited or added and then how I can (off of this trigger) have the plugin insert a value (or multiple values) into specific fields in the entry.&lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2014-07-17T21:32:23.150" Title="How could I have a plugin hook into when I edit or update a post?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1151" PostTypeId="2" ParentId="1149" CreationDate="2014-07-16T05:53:43.073" Score="5" Body="&lt;p&gt;You are currently performing a &lt;code&gt;SELECT&lt;/code&gt;instead of an &lt;code&gt;UPDATE&lt;/code&gt; so no data will be updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that &lt;code&gt;entryId&lt;/code&gt; is the primary key of the record you are trying to update? If so, I would suggest you find the record to make sure it exists, update its attributes (status) and then save it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// PluginController&#xA;public function actionDeny()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $status  = PluginStatus::Denied;&#xA;    $entryId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('entryId');&#xA;&#xA;    if (craft()-&amp;gt;pluginName-&amp;gt;updateStatus($entryId, $status)&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Unable to deny the entry.'));&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('The entry was denied.'));&#xA;    }&#xA;}&#xA;&#xA;// PluginService&#xA;public function updateStatus($id, $status)&#xA;{&#xA;    $record = PluginRecord::model()-&amp;gt;findById($id);&#xA;&#xA;    if ($record)&#xA;    {&#xA;        $record-&amp;gt;setAttribute('status', $status);&#xA;&#xA;        return $record-&amp;gt;save();&#xA;    }&#xA;    else&#xA;    {&#xA;        throw new Exception(Craft:t('No record was found with id {id}', array('id' =&amp;gt; $id));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unless I'm missing something, that should be about all you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twitter.com/selvinortiz&quot; rel=&quot;noreferrer&quot;&gt;@selvinortiz&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-07-16T05:53:43.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1152" PostTypeId="1" CreationDate="2014-07-16T06:47:34.953" Score="3" ViewCount="15780" Body="&lt;p&gt;This just happened, but just one time. Any idea why?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;CDbException&lt;/p&gt;&#xA;&lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query. The SQL statement executed was: SELECT &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;groupId&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;handle&lt;/code&gt;, &lt;code&gt;context&lt;/code&gt;, &lt;code&gt;instructions&lt;/code&gt;, &lt;code&gt;translatable&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;, &lt;code&gt;settings&lt;/code&gt; FROM &lt;code&gt;craft_fields&lt;/code&gt; WHERE context = :context ORDER BY &lt;code&gt;name&lt;/code&gt;. Bound with :context='global' (/Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php:543)&lt;/p&gt;&#xA;&lt;p&gt;0 /Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php(396): CDbCommand-&amp;gt;queryInternal('fetchAll', Array, Array)&lt;/p&gt;&#xA;&lt;p&gt;... (large, not relevant stack trace)&lt;/p&gt;&#xA;&lt;p&gt;30 {main}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="507" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2020-09-09T09:35:43.937" Title="CDbException: What does this mean?" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1153" PostTypeId="1" CreationDate="2014-07-16T06:58:50.400" Score="11" ViewCount="3107" Body="&lt;p&gt;I'm looking at making a plugin and need to search news entries.&#xA;I can use:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'news';&#xA;$find = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to add a criteria where I search a specific field, for example: &lt;code&gt;fieldabc = 'zyx'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct syntax for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="448" LastEditorUserId="177" LastEditDate="2014-07-16T11:26:23.080" LastActivityDate="2014-12-16T12:35:46.773" Title="How to search for a specific field using getCriteria()?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1154" PostTypeId="2" ParentId="1152" CreationDate="2014-07-16T07:11:11.310" Score="2" Body="&lt;p&gt;Looks like it is failing in local development on a Mac. My experience with native MySQL on OS X 10.9.3 is that the MySQL server just stops working once every few weeks, and I have to restart it. Since it's only occasional and I don't use it for anything really critical, I just live with the restarts.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-16T07:11:11.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1155" PostTypeId="2" ParentId="1153" CreationDate="2014-07-16T08:52:17.070" Score="7" Body="&lt;p&gt;You can use the a special search format.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria-&amp;gt; search = 'fieldHandle:searchstring';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Learn more about &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;noreferrer&quot;&gt;searching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-07-16T08:52:17.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1156" PostTypeId="2" ParentId="1110" CreationDate="2014-07-16T09:20:55.243" Score="4" Body="&lt;p&gt;I know of about five people/agencies working on calendar/event plugins but almost all off them are in early stages. There is one that I've gotten a sneak peak at that may be ready sooner than later. I've done very light consulting on said plugin but the person to ask about it if you're curios is my buddy &lt;a href=&quot;http://twitter.com/adamrandlett&quot; rel=&quot;nofollow&quot;&gt; @adamrandlett&lt;/a&gt; since he's the main developer on that project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A general commerce platform and a solid calendar are two missing pieces in the plugin ecosystem right now mainly because these two are hard to do well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, just wanted to say there is hope but no quick answer yet!&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-07-16T09:20:55.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1157" PostTypeId="1" AcceptedAnswerId="1196" CreationDate="2014-07-16T10:02:06.927" Score="2" ViewCount="192" Body="&lt;p&gt;Is there a config setting to be able to set a proxy in Craft? WordPress has something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('WP_PROXY_HOST', 'url_here);&#xA;define('WP_PROXY_PORT', 'port_here');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was thinking a config setting like the following would be great...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'setProxy' =&amp;gt; array(&#xA;    'host' =&amp;gt; 'url_here',&#xA;    'port' =&amp;gt; 'port_here'&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;David&lt;/p&gt;&#xA;" OwnerUserId="534" LastActivityDate="2014-07-17T00:17:07.853" Title="Setting a proxy?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1158" PostTypeId="1" CreationDate="2014-07-16T10:26:25.273" Score="2" ViewCount="180" Body="&lt;p&gt;I have a local craft.dev server running MAMP, and a public server (mysite.com), that both access the same database (on the public server). I then have some environmentvariables in general.php that makes this work smoothly (setting siteUrl and basePath for the different environments).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this doesnt seem to work if I access my public servers Craft CP, and add a new user. The activation link won't work on the users end. If I check Craft CPs General Settings it says the siteurl is craft.dev (even when I'm on mysite.com/admin), so that might be the problem, I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I have setup my general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://craft.dev/',&#xA;        'basePath' =&amp;gt; '/Users/foo/'&#xA;    )&#xA;),&#xA;&#xA;'mysite.com' =&amp;gt; array(&#xA;    'cooldownDuration' =&amp;gt; 0,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://mysite.com/',&#xA;        'basePath' =&amp;gt; '/home/mysite_ftp/www/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would it make sense if I visit mysite.com/admin, change the CPs general settings siteurl to mysite.com/, add the user, and then change siteurl back to craft.dev? Would the activation link work on the users end then?  And, can I do any harm by changing this siteurl-setting (just to give it a try)?&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="125" LastEditDate="2014-07-16T11:17:09.870" LastActivityDate="2014-07-16T15:20:14.550" Title="User activation link issue" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1159" PostTypeId="2" ParentId="1158" CreationDate="2014-07-16T11:14:38.607" Score="2" Body="&lt;p&gt;I don't know if this is relevant for the Email Service, but you should use the (new since Craft 2.0) &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;siteUrl&lt;/code&gt;&lt;/a&gt; config setting (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921&quot;&gt;recommended&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://example.dev/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://example.dev/',&#xA;        'serverPath' =&amp;gt; '/Users/foo/'&#xA;    ),&#xA;),&#xA;&#xA;'mysite.com' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://example.com/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://example.com/',&#xA;        'serverPath' =&amp;gt; '/home/mysite_ftp/www/'&#xA;    ),&#xA;),&#xA;&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you set the Site URL setting in Settings → General to &lt;code&gt;{siteUrl}&lt;/code&gt; (the custom &lt;code&gt;siteUrl&lt;/code&gt; variable you set in &lt;code&gt;environmentVariables&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-16T15:20:14.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1161" PostTypeId="2" ParentId="1150" CreationDate="2014-07-16T12:23:05.657" Score="8" Body="&lt;p&gt;Craft has &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;noreferrer&quot;&gt;Hooks and Events&lt;/a&gt; which get invoked at different points in the core code. In your case the&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; event would be perfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    //Event: onBeforeSaveEntry&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;    {&#xA;        //Is the entry in the section 'parts'?&#xA;        if ($event-&amp;gt;params['entry']-&amp;gt;section == 'parts') {&#xA;&#xA;            //Check if field is a number&#xA;            if (is_numeric($event-&amp;gt;params['entry']-&amp;gt;number_field_handle)) {&#xA;                //Do your JSON stuff&#xA;&#xA;                //Replace values&#xA;                $event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;number_field_handle = 'something_else';&#xA;            }&#xA;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;init()&lt;/code&gt; function goes into your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;noreferrer&quot;&gt;Primary Plugin Class&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="9" LastEditDate="2014-07-17T21:32:23.150" LastActivityDate="2014-07-17T21:32:23.150" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="1162" PostTypeId="1" AcceptedAnswerId="1163" CreationDate="2014-07-16T12:35:43.433" Score="7" ViewCount="962" Body="&lt;p&gt;Hello Craft community,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My team and I have built a site for a client and it looks great.  The site runs just fine in my developers local environment and we're all very happy.  I have the site now set up on my preproduction Red Hat environment and when I access it there is about 30 seconds of latency, every single time.  I cannot figure out where this latency happens, perhaps there is a configuration somewhere I am missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access images, js files, etc. without any issue - but once I hit a php file in the Craft environment, things are super slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried turning the devMode flag to false in the general configurations and that didn't seem to help.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has nothing to do with my browser - I've tried a straight CURL to the URL and I see the same amount of lag.  Perhaps there's some server-side caching I need to enable?  Like I said - this is not just with my site, it was slow during the install as well as when I just access the admin tool to look at/change configurations.  Please help!&lt;/p&gt;&#xA;" OwnerUserId="521" LastActivityDate="2014-11-03T11:33:51.390" Title="Huge Latency In Pre-prod Environment" Tags="&lt;performance&gt;" AnswerCount="2" CommentCount="10" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1163" PostTypeId="2" ParentId="1162" CreationDate="2014-07-16T12:48:43.917" Score="6" Body="&lt;p&gt;Could you upload a &quot;non Craft&quot; php-file, restart the server, and check if this file also loads slow? If it does, the server has probably some kind of an issue, and you should contact your hoster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If not, try:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;deleting the &lt;code&gt;/craft/app/storage/runtime&lt;/code&gt; directory.&lt;/li&gt;&#xA;&lt;li&gt;bumping up the php &lt;a href=&quot;http://www.php.net/manual/en/ini.core.php#ini.memory-limit&quot;&gt;&lt;code&gt;memory_limit&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;contacting P&amp;amp;T support from the Dashboard widget. They love environmental issues (So I've heard... *cough*).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-16T12:48:43.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1164" PostTypeId="1" CreationDate="2014-07-16T13:42:05.217" Score="7" ViewCount="533" Body="&lt;p&gt;I used to use a plugin for ExpressionEngine called &quot;Backup Pro&quot; (&lt;a href=&quot;http://devot-ee.com/add-ons/backup-pro&quot;&gt;http://devot-ee.com/add-ons/backup-pro&lt;/a&gt;) that would allow me to backup the entire file system and database to an offsite location like Rackspace or Amazon S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this functionality built into Craft anywhere or does a similar plugin exist?&lt;/p&gt;&#xA;" OwnerUserId="446" LastActivityDate="2016-04-12T14:54:02.763" Title="Is there a way to send offsite backups of the whole site to Amazon S3?" Tags="&lt;plugins&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1165" PostTypeId="1" AcceptedAnswerId="1296" CreationDate="2014-07-16T14:11:38.983" Score="3" ViewCount="523" Body="&lt;p&gt;I've got a bi-lingual site running nicely, /en/news/news-item displays the English version and /cy/news/news-item displays the Welsh version. Great!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to get the URLs for the main site navigation to respect the currently used locale though. For example;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm on the page: &lt;a href=&quot;http://craft.dev/cy/news/news-title&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev/cy/news/news-title&lt;/a&gt; the main site navigation should list 'news' and 'artist' with a /cy preceding the URL (/cy/news and /cy/artists). Instead it's spitting out /en/news and /en/artists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I'm using to get the URLs for the navigation is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('news') }}&quot; {% if craft.request.firstSegment == 'news' %}class=&quot;active&quot;{% endif %}&amp;gt;News&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('artists') }}&quot;&amp;gt;Artists&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="125" LastEditDate="2014-07-16T14:39:51.870" LastActivityDate="2014-07-21T08:34:35.453" Title="How to persist locale in site navigation?" Tags="&lt;localization&gt;&lt;url&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1166" PostTypeId="2" ParentId="1165" CreationDate="2014-07-16T14:38:06.010" Score="3" Body="&lt;p&gt;Did you &lt;a href=&quot;http://buildwithcraft.com/help/localization&quot; rel=&quot;nofollow&quot;&gt;configure siteUrl&lt;/a&gt; in &lt;code&gt;general.php&lt;/code&gt;, so Craft knows what the base URL is for your entries?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://craft.dev/en/',&#xA;        'cy' =&amp;gt; 'http://craft.dev/cy/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-16T14:38:06.010" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1167" PostTypeId="1" AcceptedAnswerId="1182" CreationDate="2014-07-16T14:42:26.250" Score="3" ViewCount="344" Body="&lt;p&gt;I'm building a plugin that relies on Javascript to function correctly. Having tried different methods, I can't get the ID names to remain consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of the code that is being output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot;&#xA;id=&quot;fields-slider-output&quot;&#xA;name=&quot;fields[slider]&quot;&#xA;value=&quot;539&quot;&amp;gt;&#xA;&#xA;&amp;lt;span id=&quot;fields-value&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;&#xA;&amp;lt;input&#xA;id=&quot;fields-input&quot;&#xA;type=&quot;range&quot;&#xA;name=&quot;fields[slider]&quot;&#xA;value=&quot;539&quot;  min=&quot;0 max=&quot;1000&quot; step=&quot;0&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first input is a text input, and displays the ID as you would expect. The span element below only contains &quot;fields-&quot;, and leaves out the name of the field. The same happens with the range input, which is the most surprising, as it's a form input with a name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using JavaScript, the &quot;fields-&quot; namespace is left out entirely, which means that the Javascript can't bind to an element.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#slider-input&quot;)[0].oninput = function () {&#xA;    $('#slider-value').html(this.value);&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using this code from the Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$id = craft()-&amp;gt;templates-&amp;gt;formatInputId($name);&#xA;$namespacedId = craft()-&amp;gt;templates-&amp;gt;namespaceInputId($id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also looked into the namespacing HTML docs (&lt;a href=&quot;http://buildwithcraft.com/docs/apis/templatesservice#namespacing-html&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/apis/templatesservice#namespacing-html&lt;/a&gt;) with little success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know a possible solution to this? Bearing in mind this Fieldtype requires Matrix support, so using a class instead of an ID is not an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="537" LastActivityDate="2014-07-16T20:17:03.183" Title="Namespace issues with binding Javascript" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1168" PostTypeId="1" AcceptedAnswerId="1256" CreationDate="2014-07-16T15:04:48.457" Score="2" ViewCount="311" Body="&lt;p&gt;I'm trying to stay as DRY as possible here and sharing one template for a news list view; all, category and tag all sharing the same template (and trying to refrain from having a category or tag segment). My query isn't returning any results when the segment 2 (in this case the url encoded tag or category slug) when there is a tag and category that share the same name. Example, 'design' is a category for design related posts; 'design' is a tag for posts that featured a design service within the 'portfolio' category. My template code is below. Is there a work around here or do I need to have a second segment for tag/category (i.e. &lt;code&gt;.com/news/category/design&lt;/code&gt; and &lt;code&gt;.com/news/tag/design&lt;/code&gt; - or one or the other to differentialte)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;&#xA;    {% set newsPosts = craft.entries.section('news').relatedTo(category).limit(5) %}&#xA;&#xA;{% elseif tag is defined %}&#xA;&#xA;    {% set tag = craft.tags.groupId(3).name(tag).first() %}&#xA;&#xA;    {% set newsPosts = craft.entries.section('news').relatedTo(tag).limit(5) %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set newsPosts = craft.entries.section('news').limit(5) %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-18T16:06:59.060" Title="Sharing a template with identical category and tag name" Tags="&lt;entries&gt;&lt;templating&gt;&lt;tags&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1169" PostTypeId="1" AcceptedAnswerId="1170" CreationDate="2014-07-16T15:14:38.130" Score="5" ViewCount="449" Body="&lt;p&gt;I am curious how those of you who use a multi-environment development process handle user upload directories? If you use a remote database and one developer uploads some test content, the shared database will think there are files on the other developers machine and they won't be there. This would also show its face if you access a staging server. The database would be out of sync with the upload directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your input.&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2015-10-30T21:31:10.107" Title="Multi-Environment Uploads" Tags="&lt;assets&gt;&lt;multi-environment&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1170" PostTypeId="2" ParentId="1169" CreationDate="2014-07-16T15:25:11.427" Score="3" Body="&lt;p&gt;We use &lt;a href=&quot;http://rsync.samba.org/&quot; rel=&quot;nofollow&quot;&gt;rsync&lt;/a&gt;. This can either be run manually with your CLI or you could set up a cron to run it every so often. It's significantly faster than FTP.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-16T15:25:11.427" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1171" PostTypeId="1" AcceptedAnswerId="1190" CreationDate="2014-07-16T15:31:50.690" Score="5" ViewCount="946" Body="&lt;p&gt;I use the following entry form (front-end): &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add a tags-field to this entry form? &lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:21.910" LastActivityDate="2017-10-24T15:25:21.910" Title="How to add a tags-field to an entry form?" Tags="&lt;tags&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1172" PostTypeId="1" CreationDate="2014-07-16T15:42:48.587" Score="2" ViewCount="181" Body="&lt;p&gt;Similarly to how Craft knows that a category is defined when a category slug is used, is there a way to detect a user in the same way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Something along the lines of (which only returns true if a user is logged in):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if user is defined %}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If a username is in the URL, would/should above code return true similarly to how &lt;code&gt;{% if category is defined %}&lt;/code&gt; returns true if a category slug is in the URL? (i.e. &lt;code&gt;.com/news/sherlock_holmes&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to return author posts using method listed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/719/how-do-i-list-entries-from-a-single-author&quot;&gt;this question&lt;/a&gt;, I'm just trying to simplify even further and have one template &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1168/sharing-a-template-with-identical-category-and-tag-name&quot;&gt;list all these views&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-18T14:28:40.073" Title="Setting a conditional for username in URL?" Tags="&lt;entries&gt;&lt;templating&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1173" PostTypeId="1" AcceptedAnswerId="1181" CreationDate="2014-07-16T15:59:51.503" Score="2" ViewCount="1527" Body="&lt;p&gt;I just want to apologize in advance if I'm not quite understanding how the element criteria model works. I know that's the basis of Craft but I learn best by doing and this StackExchange has been an incredible resource. Thank you!&lt;/p&gt;&#xA;&lt;p&gt;As my question title explains, I'm trying to get an image (image url actually) located in an asset field from the first entry of the first subcategory within a category.&lt;/p&gt;&#xA;&lt;p&gt;This is what I have so far:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    {% set lastSeg = craft.request.lastSegment %}&#xA;    {% for cat in categories.slug(lastSeg) %}&#xA;      {{category.title}}&#xA;      {{category.catContent}}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% set subCategories = craft.categories.descendantOf(category) %}&#xA;        {% for subCat in subCategories %}&#xA;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{subCat.url}}#anchor&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;https://i.stack.imgur.com/zwipu.png&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&amp;quot;{{subCat.url}}#anchor&amp;quot; class=&amp;quot;meta&amp;quot;&amp;gt;{{subCat.title}}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;       &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'd like the image url to replace &lt;a href=&quot;http://fpoimg.com/280x280&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://fpoimg.com/280x280&lt;/a&gt; as the img src. I'm getting stuck after looping through the subcategories. I'm not sure how to loop through entries in the subcategory and return the first one, so that I can then loop through the assets and pull the image url I need.&lt;/p&gt;&#xA;&lt;p&gt;-- edit --&lt;/p&gt;&#xA;&lt;p&gt;I think I have gotten it to work thanks to Marion's comment, but I would love some input to be certain:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    {% set lastSeg = craft.request.lastSegment %}&#xA;    {% for cat in categories.slug(lastSeg) %}&#xA;      {{category.title}}&#xA;      {{category.catContent}}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% set subCategories = craft.categories.descendantOf(category) %}&#xA;        {% set products = craft.entries.section('products').relatedTo(subCategories) %}&#xA;&#xA;        {% for subCat in subCategories %}&#xA;        {% for entry in products.relatedTo(subCat).limit(1) %}&#xA;        {% set image = entry.productImage.first() %}&#xA;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{subCat.url}}#anchor&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;{{image.getUrl()}}&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&amp;quot;{{subCat.url}}#anchor&amp;quot; class=&amp;quot;meta&amp;quot;&amp;gt;{{subCat.title}}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;       &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="425" LastEditorUserId="6007" LastEditDate="2021-01-19T20:45:47.863" LastActivityDate="2021-01-19T20:45:47.863" Title="How do I pull the first image from the first entry of the first subcategory?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1174" PostTypeId="2" ParentId="1168" CreationDate="2014-07-16T16:50:24.893" Score="2" Body="&lt;p&gt;If the url for posts with the &lt;strong&gt;category&lt;/strong&gt; &lt;code&gt;design&lt;/code&gt; is &lt;code&gt;.com/news/design&lt;/code&gt; and the url for posts with the &lt;strong&gt;tag&lt;/strong&gt; &lt;code&gt;design&lt;/code&gt; is also &lt;code&gt;.com/news/design&lt;/code&gt;, then you are not going to be able to see both lists. You do need that extra segment in the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do to stay DRY is let Craft route tags and categories to different templates (so you don't have to repeat the &lt;em&gt;is this a category or a tag&lt;/em&gt; logic). Then on the different templates, use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;macro&lt;/a&gt; or &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;include&lt;/a&gt; for the common code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what the categories page looks like with a macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;{% import '_macros/_news' as news %}&#xA;&#xA;{% set newsPosts = craft.entries.section('news')relatedTo(category).limit(5) %}&#xA;&#xA;{% block content %}&#xA;  &amp;lt;h1&amp;gt;Entries with category {{category.title}}&amp;lt;/h1&amp;gt;&#xA;  {{ news.index(newsPosts) }} {# all the shared code is in news.index() #}&#xA;{% endblock content %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-16T16:50:24.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1175" PostTypeId="2" ParentId="1169" CreationDate="2014-07-16T17:22:50.120" Score="3" Body="&lt;p&gt;I think Ryan's solution is the best, but since you're looking for other ways...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.panic.com/transmit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transmit's&lt;/a&gt; sync feature works very well for user upload directories. Sync down or sync up as needed. I use this only for user upload directories (for me &lt;code&gt;html/assets&lt;/code&gt;). Everything else is handled with Git, similar to the way Ryan described. I also &lt;code&gt;gitignore&lt;/code&gt; the user upload directories (seems the wise thing to do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of Transmit's sync dialogue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Om8Di.png&quot; alt=&quot;Transmit sync dialogue&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="43" LastActivityDate="2014-07-16T17:22:50.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1176" PostTypeId="2" ParentId="1164" CreationDate="2014-07-16T17:55:26.120" Score="2" Body="&lt;p&gt;It's not built natively into Craft.  Craft will either write the backup to craft/storage/runtime/backups or send it to the browser if you check &quot;Download Backup&quot; from the backup tool under Settings in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of a plugin that exists that currently does this, but it could relatively easily be done by extending &lt;a href=&quot;https://github.com/putyourlightson/Craft-Dump/&quot; rel=&quot;nofollow&quot;&gt;Craft-Dump&lt;/a&gt;, which lets you trigger a Craft backup via a URL/cron job and then writing the logic that does the move to S3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-16T17:55:26.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1177" PostTypeId="1" AcceptedAnswerId="1399" CreationDate="2014-07-16T17:56:21.347" Score="2" ViewCount="207" Body="&lt;p&gt;If I wanted to update the Elements listing based on an action taken from a plugin, would it be possible to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We're on an Elements listing page.&lt;/li&gt;&#xA;&lt;li&gt;We filter the results with a search query.&lt;/li&gt;&#xA;&lt;li&gt;We then click an Element's name to move to its individual editing page&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently in my tests with Google Chrome if I:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Filter a list by a search query (say &lt;code&gt;lastName::T*&lt;/code&gt; on the Users listing page),&lt;/li&gt;&#xA;&lt;li&gt;Click on one of the usernames&lt;/li&gt;&#xA;&lt;li&gt;Hit &quot;Back&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My search is not saved, i.e., I'm returned to a non-filtered list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My workaround to this is to write a simple JS plugin that stores your search query - if populated - when you navigate away from the page. I then re-populate the search query when you re-enter the page but I have to tell Craft to execute it, IE to fire &lt;code&gt;updateElements&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current workaround for this is to fire a &lt;code&gt;change&lt;/code&gt; event on the search box if the search query is stored and it's not an Ajax request. It works, it just feels kind of hacky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering if there's a more native, less hacky solution.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="9" LastEditDate="2014-07-25T17:04:32.853" LastActivityDate="2014-07-25T17:04:32.853" Title="How would I trigger updateElements for BaseElementIndex from a plugin's JavaScript?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1178" PostTypeId="2" ParentId="1152" CreationDate="2014-07-16T18:00:57.897" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbException&quot; rel=&quot;nofollow&quot;&gt;CDbException&lt;/a&gt; is the exception that &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;nofollow&quot;&gt;Yii&lt;/a&gt; will throw when something has gone wrong with a database operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the only important part of the error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that error can occur for any one of &lt;a href=&quot;https://www.google.com/search?q=SQLSTATE%5BHY000%5D%3A%20General%20error%3A%202013%20Lost%20connection%20to%20MySQL%20server%20during%20query&quot; rel=&quot;nofollow&quot;&gt;3,210 different reasons&lt;/a&gt; including network connection errors, misconfigured PDO, MySQL and/or PHP, etc.  It's going to be difficult to track down especially if it's only occurring sporadically.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-16T18:00:57.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1179" PostTypeId="1" CreationDate="2014-07-16T18:02:13.423" Score="2" ViewCount="256" Body="&lt;p&gt;Front-end developer here playing with fire. I'm developing a site that as a specific UI element that I want to reuse throughout the site. Specifically it's a button that has different &quot;configuration&quot; options. You can change the colors, add an icon, etc. It's currently all controlled via CSS classes. You can think of the element as something akin to a Button within &lt;a href=&quot;http://getbootstrap.com/css/#buttons&quot; rel=&quot;nofollow&quot;&gt;Twitter Bootstrap&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to build a custom fieldtype so that users within the CMS can add in these UI elements throughout the site and change the options such as color, size, name, link, etc. I'd like to be able to place this type inside of Matrix blocks. So doing this within an existing Matrix isn't really feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm kind of thinking of it as a mini-matrix or an advanced table element. If someone can point me in the right direction that'd be great. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept I'm currently struggling with is how to create the fieldtype and have it save the data from the different form elements within my fieldtype to the database. &lt;/p&gt;&#xA;" OwnerUserId="222" LastEditorUserId="222" LastEditDate="2014-07-16T22:09:46.457" LastActivityDate="2014-07-17T22:52:26.833" Title="Fieldtype with multiple form elements" Tags="&lt;plugin-development&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1180" PostTypeId="2" ParentId="1147" CreationDate="2014-07-16T18:04:44.023" Score="2" Body="&lt;p&gt;I believe you'd need to do some front-end pre-processing of the image to get it to the correct size(s) you require before passing it off to Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-16T18:04:44.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1181" PostTypeId="2" ParentId="1173" CreationDate="2014-07-16T18:40:19.723" Score="5" Body="&lt;p&gt;This should work!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code is to pull the first image, from the first entry of the first sub category given that the 'slug' passed into the first set is your top level category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# Get the category from the slug. This will return one CategoryModel #}&#xA;    {% set topCat = craft.categories.slug('someSlug').first() %}&#xA;&#xA;    {# Get the first subcategory under the top level category using the getChildren() method on the category model.  #}&#xA;    {% set firstSubCat = topCat.getChildren().first() %}&#xA;&#xA;    {# Grab the first entry under that category using the relatedTo function and appending the .first() method to return only one item. #}&#xA;    {% set firstEntry = craft.entries.relatedTo( firstSubCat ).first()  %}&#xA;&#xA;    {# Set your image from your asset field #}&#xA;    {% set image = firstEntry.assetField.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="222" LastActivityDate="2014-07-16T18:40:19.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1182" PostTypeId="2" ParentId="1167" CreationDate="2014-07-16T20:17:03.183" Score="4" Body="&lt;p&gt;It’s not enough to simply define &lt;code&gt;$namespacedId&lt;/code&gt; – you need to actually use it in your Javascript code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’re defining the javascript code in your template, you’ll need to pass the namespaced ID to your template, along with &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, and &lt;code&gt;value&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;templates-&amp;gt;render(&quot;myplugin/my_input_template&quot;, array(&#xA;    'name'         =&amp;gt; $name,&#xA;    'id'           =&amp;gt; $id,&#xA;    'namespacedId' =&amp;gt; $namespacedId,&#xA;    'value'        =&amp;gt; $value&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template, use the &lt;code&gt;id&lt;/code&gt; variable within &lt;code&gt;id=&lt;/code&gt; attributes, and the &lt;code&gt;namespacedId&lt;/code&gt; variable within Javascript code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;{{ id }}-output&quot; name=&quot;{{ name }}&quot; value=&quot;{{ value }}&quot;&amp;gt;&#xA;&amp;lt;span id=&quot;{{ id }}-value&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;&amp;lt;input id=&quot;{{ id }}-input&quot; type=&quot;range&quot; value=&quot;{{ value }}&quot; min=&quot;0&quot; max=&quot;1000&quot; step=&quot;0&quot;&amp;gt;&#xA;&#xA;{% set js %}&#xA;    $(&quot;#{{ namespacedId }}-input&quot;)[0].oninput = function () {&#xA;        $('#{{ namespacedId }}-value').html(this.value);&#xA;    };&#xA;{% endset %}&#xA;&#xA;{% includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(I’ve cleaned up your HTML a little, besides the formatting – I added a missing quote after &lt;code&gt;min=&quot;0&lt;/code&gt;, and removed the entire &lt;code&gt;name=&lt;/code&gt; attribute from the 3rd input, since the first input seems like it will already take care of that.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-16T20:17:03.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1183" PostTypeId="2" ParentId="1179" CreationDate="2014-07-16T20:34:48.883" Score="3" Body="&lt;p&gt;You have (at least) two options here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a matrix block with the fields you need. That way, the user kan add one or more blocks of the type 'button' (for instance) to the page. Within button, you could have a plain text field for the link and name, a color field for the color, a number field for size, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create your own fieldtype (&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/field-types&lt;/a&gt;, not as easy as first option). That way you have optimal control over the way your user inputs values.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would go with option 1.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-07-16T20:34:48.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1184" PostTypeId="2" ParentId="1164" CreationDate="2014-07-16T20:35:22.663" Score="1" Body="&lt;p&gt;I've not come across a plugin that does this, but there are existing tools you can use to achieve the same sort of thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Git and a private repo to store your template files and resources (CSS, JS). If you wanted to, you could also deploy these files to S3 pretty easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using S3 or Rackspace within Craft to store your site's assets. This is a feature of Craft Pro, but allows you to skip the step of transferring files from a local source to S3. You can also take advantage of other AWS services like Cloudfront with this installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Task runners like Grunt or Gulp can also be configured to watch for new assets, template files and resources, and deploy them straight to S3. In theory, you could do the same with your database using the MYSQL dump package for Grunt, then watch for new files and sync. Or simply run a back-up task for your sites at the end of the day. This is highly configurable, but would require some work on your part to ensure it's running as expected.&lt;/p&gt;&#xA;" OwnerUserId="537" LastActivityDate="2014-07-16T20:35:22.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1185" PostTypeId="2" ParentId="1172" CreationDate="2014-07-16T20:39:52.337" Score="2" Body="&lt;p&gt;If you're looking for the current (logged in) user, you should use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#currentUser&quot; rel=&quot;nofollow&quot;&gt;global variable currentUser&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {# currentUser returns a User Model if there is one, so do with it whatever you like #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if you want to find a user through a URL segment, you might want to get into &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;using routes&lt;/a&gt;. If you use advanced routing, you can get what (I think) you want by adding following to your &lt;code&gt;craft/config/routes.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    '(?P&amp;lt;category&amp;gt;[^/\]+)/(?P&amp;lt;user&amp;gt;[^/\]+)/' =&amp;gt; 'path/to/template',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you can then use the variables &lt;code&gt;{{ category }}&lt;/code&gt; and &lt;code&gt;{{ user }}&lt;/code&gt;. Don't hang me on the RegExp-pattern, this is not tested but should get you further.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="177" LastEditDate="2014-07-18T14:28:40.073" LastActivityDate="2014-07-18T14:28:40.073" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1186" PostTypeId="1" AcceptedAnswerId="1191" CreationDate="2014-07-16T20:47:32.493" Score="2" ViewCount="139" Body="&lt;p&gt;I know that I can get the default description of a Task with:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;description;&#xA;//or&#xA;$this-&amp;gt;getDescription();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I get the description if it got changed on creation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;tasks-&amp;gt;createTask('Mailer', $new_description);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding it as an attribute doesn't seem &quot;right&quot; to me:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;tasks-&amp;gt;createTask('Mailer', $new_description, array('description' =&amp;gt; $new_description));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-17T10:39:12.007" LastActivityDate="2014-07-17T10:39:12.007" Title="How to get a Task's description inside runStep()?" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1187" PostTypeId="1" AcceptedAnswerId="1192" CreationDate="2014-07-16T20:48:37.213" Score="5" ViewCount="299" Body="&lt;p&gt;We have a client site that has been getting a lot of spam registrations. We're turning on &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#purgePendingUsersDuration&quot;&gt;&lt;code&gt;purgePendingUsersDuration&lt;/code&gt;&lt;/a&gt; to help deal  with some of these automatically, but I was planning to go into the database to delete a bunch in bulk directly (since there are almost 200 of them)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it safe to delete them just from &lt;code&gt;craft_users&lt;/code&gt; and &lt;code&gt;craft_usergroups_users&lt;/code&gt; tables? Are there other places I should watch out for?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="177" LastEditDate="2014-07-16T20:52:36.267" LastActivityDate="2020-03-16T02:26:59.230" Title="Is it safe to mass delete users from the database directly" Tags="&lt;users&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1188" PostTypeId="2" ParentId="1179" CreationDate="2014-07-16T21:08:46.367" Score="2" Body="&lt;p&gt;Paul's suggestion should work fine based on your description. Another way to improve this would be to set the max blocks to 1 in your field settings, and to also use a different tab along the lines of 'theme' in your field layout. This will help separate the content and styles in the CMS, and prevent the client from adding multiple blocks of classes that will override each other.&lt;/p&gt;&#xA;" OwnerUserId="537" LastActivityDate="2014-07-16T21:08:46.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1190" PostTypeId="2" ParentId="1171" CreationDate="2014-07-16T22:46:20.207" Score="4" Body="&lt;p&gt;You would need to add inputs to the form based on your Tags field handle, with values set to the tag IDs that should be selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a very simple example – it creates a big checkbox list of all the existing tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;tags&quot;&amp;gt;&#xA;    {% for tag in craft.tags.group('myTagsGroup').limit(null) %}&#xA;        &amp;lt;label&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[myTagsField][]&quot; value=&quot;{{ tag.id }}&quot;&amp;gt;&#xA;            {{ tag.name }}&#xA;        &amp;lt;/label&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that it is not possible to create new tags directly from a Tags field. If you want users to also be able to create new tags from your form, that will require a little Javascript.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a id=&quot;new-tag&quot;&amp;gt;+ New tag&amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;&#xA;    $('#new-tag').click(function()&#xA;    {&#xA;        var name = prompt('What’s the new tag name?');&#xA;&#xA;        if (!name) return;&#xA;&#xA;        var data = {&#xA;            groupId: 1,&#xA;            name: name&#xA;        };&#xA;&#xA;        $.post('/actions/tags/createTag', data, function(response)&#xA;        {&#xA;            if (response.success)&#xA;            {&#xA;                $('&amp;lt;label&amp;gt;' +&#xA;                      '&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[myTagsField][]&quot; value=&quot;'+response.id+'&quot; checked=&quot;checked&quot;/&amp;gt; ' +&#xA;                    name +&#xA;                  '&amp;lt;/label&amp;gt;').appendTo($('#tags'));&#xA;            }&#xA;            else&#xA;            {&#xA;                alert('Unable to create that tag.');&#xA;            }&#xA;        });&#xA;    });&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure to set the correct &lt;code&gt;groupId&lt;/code&gt; in that &lt;code&gt;data&lt;/code&gt; object. You can find your tag group’s ID by looking at the URL when editing the group’s settings within Craft’s CP.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-16T22:46:20.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1191" PostTypeId="2" ParentId="1186" CreationDate="2014-07-16T22:52:35.923" Score="3" Body="&lt;p&gt;The description you define in &lt;code&gt;getDescription()&lt;/code&gt; is just the default description in the event that no description was specified when &lt;code&gt;craft()-&amp;gt;tasks-&amp;gt;createTask()&lt;/code&gt; was called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;actual&lt;/em&gt; description for the task is saved on the TaskModel, which you can get via &lt;code&gt;$this-&amp;gt;model&lt;/code&gt; from your Task class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$description = $this-&amp;gt;model-&amp;gt;description;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-16T22:52:35.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1192" PostTypeId="2" ParentId="1187" CreationDate="2014-07-16T22:59:48.573" Score="8" Body="&lt;p&gt;If you want to delete users (or any other elements in Craft) directly from the database, the place to do that is the &lt;code&gt;elements&lt;/code&gt; table. Delete the row(s) from there, and all the elements’ rows in the other tables will go away automatically.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2020-03-16T02:26:59.230" LastActivityDate="2020-03-16T02:26:59.230" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1193" PostTypeId="1" AcceptedAnswerId="1220" CreationDate="2014-07-16T23:36:14.507" Score="1" ViewCount="4084" Body="&lt;p&gt;When I browse to the public index file, I get a message that says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Page not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I already configured the database and the folders have write permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else should I check?&lt;/p&gt;&#xA;" OwnerUserId="541" LastEditorUserId="57" LastEditDate="2014-07-17T00:09:34.313" LastActivityDate="2014-07-17T15:14:55.240" Title="Craft won't install" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1194" PostTypeId="2" ParentId="1091" CreationDate="2014-07-16T23:51:36.290" Score="5" Body="&lt;p&gt;Before worrying about how templating should work, let’s just get one thing out of the way: Computing this data every time it’s requested is horribly inefficient, and could easily take a site down. You’ll absolutely need to find a way to store the tag counts in a more permanent location, and calculate it when entries are saved rather than when the template requests it. (Even if you wrap the template in a &lt;code&gt;{% cache %}&lt;/code&gt; tag, you’re still forcing a couple people to experience slow page load times for no good reason.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have multiple options on how to store the data, but giving it its own table is probably the most obvious/reliable. I’d call it something like &lt;code&gt;tagcounts&lt;/code&gt;, and give it &lt;code&gt;tagId&lt;/code&gt; and &lt;code&gt;count&lt;/code&gt; columns. &lt;code&gt;tagId&lt;/code&gt; should be a FK to the &lt;code&gt;tags&lt;/code&gt; table, set to cascade delete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you’d want to listen to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;noreferrer&quot;&gt;entries.onSaveEntry&lt;/a&gt; event. When it fires, loop through all the entry’s Tags fields, and each of their selected tags. For each one, get the total count of rows in the &lt;code&gt;relations&lt;/code&gt; table where the &lt;code&gt;targetId&lt;/code&gt; column is set to the tag’s ID. Use DbCommand::insertOrUpdate() to save the value in your table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;insertOrUpdate('tagcounts', array(&#xA;    'tagId' =&amp;gt; $tag-&amp;gt;id&#xA;), array(&#xA;    'count' =&amp;gt; $count&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You’ll also need to loop through all existing tags and populate this table when the plugin is first installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the tag count data in place, next up is templating. Unfortunately I don’t have a good answer for you there. It’s a complicated problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what I would do is, create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;Variable&lt;/a&gt; class which accepts an ElementCriteriaModel, passes that off to &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;buildElementsQuery()&lt;/code&gt; which will take most of the parameters into account, then make some additional modifications to the query – join in the &lt;code&gt;tagcounts&lt;/code&gt; table and set the &lt;code&gt;ORDER BY&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next up you would basically have to copy a ton of code from ElementsService::findElements(), which is totally lame. I’m going to see what I can do to make it much easier on you going forward. Ideally at this point you would be able to just do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;elements-&amp;gt;findElementsUsingQuery($query);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-16T23:51:36.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1196" PostTypeId="2" ParentId="1157" CreationDate="2014-07-17T00:17:07.853" Score="2" Body="&lt;p&gt;Currently, it's not possible, but I'll add it to our &quot;todo&quot; list!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-17T00:17:07.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1197" PostTypeId="1" AcceptedAnswerId="1198" CreationDate="2014-07-17T02:06:46.870" Score="10" ViewCount="971" Body="&lt;p&gt;I'm new to Craft and (attempting to) create a plugin so that I can import existing users from CSV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm referencing this method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-usersservice.html#method-changepassword&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v2/craft-usersservice.html#method-changepassword&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my function, I'm using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById(6);&#xA;$user-&amp;gt;newPassword('mynewpassword123');&#xA;craft()-&amp;gt;users-&amp;gt;changePassword($user);&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I completely misunderstanding what this is supposed to do?&lt;/p&gt;&#xA;" OwnerUserId="543" LastEditorUserId="4118" LastEditDate="2019-08-06T17:40:33.403" LastActivityDate="2019-08-06T17:40:33.403" Title="How do I change a user's password programmatically in a plugin?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1198" PostTypeId="2" ParentId="1197" CreationDate="2014-07-17T02:16:44.773" Score="10" Body="&lt;p&gt;You shouldn't need to call changePassword() at all.  Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById(6);&#xA;$user-&amp;gt;newPassword = 'mynewpassword123';&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it's not updating correctly, then there is likely a validation error somewhere.  You can check that with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;getErrors();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will return an array of properties that failed validation and their error messages.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2014-07-17T19:48:36.163" LastActivityDate="2014-07-17T19:48:36.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1199" PostTypeId="1" AcceptedAnswerId="1200" CreationDate="2014-07-17T04:29:16.507" Score="4" ViewCount="99" Body="&lt;p&gt;I have been looking at the BaseElementFieldType.php file to try and understand how to use it for my own field type. How do I provide that field type with my own array of data to use? I believe it has to do with the sources,criteria, or elements but it is unclear to me. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-07-17T06:48:34.083" Title="Using ElementType as field type for plugin in what way do I provide my own data to the modal?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1200" PostTypeId="2" ParentId="1199" CreationDate="2014-07-17T06:48:34.083" Score="6" Body="&lt;p&gt;Ah, in that case you'll need to make your own ElementType. You should probably check out &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot;&gt;https://github.com/pixelandtonic/Events&lt;/a&gt; - that's meant to be a simple ElementType to serve as an entry point while we get some documentation together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there are some videos to watch over here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements#creating-new-element-types&quot;&gt;http://buildwithcraft.com/docs/plugins/working-with-elements#creating-new-element-types&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-07-17T06:48:34.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1201" PostTypeId="1" CreationDate="2014-07-17T07:47:29.233" Score="5" ViewCount="1522" Body="&lt;p&gt;Can the control panel have a skin or theme applied without it affecting automatic updates?&lt;/p&gt;&#xA;" OwnerUserId="547" LastActivityDate="2014-07-17T13:04:03.290" Title="Is it possible to totally reskin the admin panel with a new template?" Tags="&lt;theme&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1202" PostTypeId="1" AcceptedAnswerId="1204" CreationDate="2014-07-17T08:39:38.800" Score="3" ViewCount="119" Body="&lt;p&gt;I'm trying my first plug-in; it's to automatically create an entry in a section when a user belonging to a specific user group is activated. However I'm not that hot at PHP and I can't figure out how I would check that the user being activated belongs to a given user group. Here's my basic code from in the main plugin file's init() function:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.onActivateUser', function(Event $event) {&#xA;        // check the user being activated belongs to the user group 'artist'&#xA;        // ???&#xA;&#xA;        // now save an entry on their behalf&#xA;        $entry = new EntryModel();&#xA;        ...&#xA;&#xA;        $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        if (!$success)&#xA;        {&#xA;            Craft::log('Couldn’t save the entry &quot;'.$entry-&amp;gt;title.'&quot;', LogLevel::Error);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastEditorUserId="177" LastEditDate="2014-07-17T10:41:32.430" LastActivityDate="2014-07-17T10:41:32.430" Title="How do I access the properties of an object which triggered an event?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1203" PostTypeId="1" AcceptedAnswerId="1209" CreationDate="2014-07-17T08:53:48.297" Score="3" ViewCount="1700" Body="&lt;p&gt;I am trying to figure out how to page through only the children of the top level section entry being displayed, I have looked at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/333/how-do-you-page-through-entries-in-a-structure/334#334&quot;&gt;this question&lt;/a&gt; but as I say I am after only the children not the siblings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a &lt;code&gt;prevChild()&lt;/code&gt; and &lt;code&gt;nextChild()&lt;/code&gt; or something similar I can't see them in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Response to Bryan&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set prevDatabyteSeries = entry.getChildren().first().getPrevSibling() %}&#xA;{% set nextDatabyteSeries = entry.getChildren().first().getNextSibling() %}&#xA;&#xA;{% if prevDatabyteSeries %}&#xA;&amp;lt;a href=&quot;{{ prevDatabyteSeries.url }}&quot; class=&quot;icon-alone paginate-arrow&quot;&amp;gt;&#xA;  &amp;lt;i class=&quot;icon-arrow-left&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextDatabyteSeries %}&#xA;&amp;lt;a href=&quot;{{ nextDatabyteSeries.url }}&quot; class=&quot;icon-alone paginate-arrow&quot;&amp;gt;&#xA;  &amp;lt;i class=&quot;icon-arrow-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-17T14:49:43.710" Title="How do you page through child entries in a structure?" Tags="&lt;sections&gt;&lt;previous-next&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1204" PostTypeId="2" ParentId="1202" CreationDate="2014-07-17T09:10:21.033" Score="3" Body="&lt;p&gt;Within the context of that event, you will have access to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['user']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... which is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow&quot;&gt;A UserModel instance representing the user that has just been activated.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Once you've got your user model, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['user']-&amp;gt;isInGroup('artists')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;On a separate note, I believe the correct syntax is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.activateUser' ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can ditch the &quot;on&quot; in &lt;code&gt;onActivateUser&lt;/code&gt;. Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow&quot;&gt;official example...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-17T09:10:21.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1205" PostTypeId="2" ParentId="1201" CreationDate="2014-07-17T10:32:49.713" Score="9" Body="&lt;p&gt;You can certainly override the admin css by using &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt; from Double Secret Agency. It's rather nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lindsey also has a Admin JS plugin too: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot;&gt;https://github.com/lindseydiloreto/craft-cpjs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding actual admin template changes and their ability to survive an update, I'll have to defer that to somebody who know's more about it than myself.&lt;/p&gt;&#xA;" OwnerUserId="260" LastActivityDate="2014-07-17T10:32:49.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1206" PostTypeId="1" AcceptedAnswerId="1207" CreationDate="2014-07-17T12:18:36.573" Score="3" ViewCount="141" Body="&lt;p&gt;I have a client who needs the flexibility to add new user groups in the future to allow access to only certain sections etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone in these user groups will appear on the website team page, so what I need to do is to exclude our admin group (and an ex employees group!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently i'm chaining the groups to include as per:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { group: 'groupB,groupC,etc,etc,etc'} %}&#xA;{% for team in craft.users(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way of telling it to just exclude groupA instead?&lt;/p&gt;&#xA;" OwnerUserId="292" LastActivityDate="2014-07-17T12:29:50.280" Title="Exclude groups from user search" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1207" PostTypeId="2" ParentId="1206" CreationDate="2014-07-17T12:29:50.280" Score="5" Body="&lt;p&gt;You can do that like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { group: 'and, not groupX, not groupY' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-17T12:29:50.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1208" PostTypeId="1" CreationDate="2014-07-17T12:35:01.817" Score="3" ViewCount="717" Body="&lt;p&gt;We have a user signup form (see &lt;a href=&quot;http://thinkdif.co/me/signup&quot; rel=&quot;nofollow&quot;&gt;http://thinkdif.co/me/signup&lt;/a&gt;) that has some extra required fields. When a craft field us missed out, the error code below works, however when a custom User field is not completed, the page does not save, but no error is presented. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We require errors on custom user signup fields, and also on the 'Update your profile' page that is presented later in the workflow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help or examples. End goal is to have good required fields throughout the user workflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example error code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if account is defined %}&#xA;    {{ _self.errorList(account.getErrors('occupation')) }}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a gist of the full page. &lt;a href=&quot;https://gist.github.com/slipstreamstudio/d8dd801d722c3f275b74&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/slipstreamstudio/d8dd801d722c3f275b74&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="214" LastEditorUserId="214" LastEditDate="2014-07-18T09:13:38.563" LastActivityDate="2014-07-18T23:43:18.957" Title="Required Fields for User Signup" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1209" PostTypeId="2" ParentId="1203" CreationDate="2014-07-17T12:59:21.110" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow&quot;&gt;getPrev&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;getNext&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling&quot; rel=&quot;nofollow&quot;&gt;getPrevSibling&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNextSibling&quot; rel=&quot;nofollow&quot;&gt;getNextSibling&lt;/a&gt; all specify an entry relative to the current one. &lt;code&gt;prevChild&lt;/code&gt; and &lt;code&gt;nextChild&lt;/code&gt; if they existed would somehow specify an entry relative to a child of the current entry. They don't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is paginate through the children. Here I use &lt;code&gt;.limit(1)&lt;/code&gt; to page through them one at a time, but you could fetch more.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prePaginatedEntries = entry.getChildren().limit(1) %}&#xA;{% paginate prePaginatedEntries as entries %}&#xA;  {% for oneChild in entries %}&#xA;    {# do whatever with oneChild #}&#xA;  {% endfor %}&#xA;  {# pagination links #}&#xA;  {% if paginate.prevUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if paginate.nextUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-17T12:59:21.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1210" PostTypeId="2" ParentId="1203" CreationDate="2014-07-17T13:03:48.717" Score="1" Body="&lt;p&gt;There is no &lt;code&gt;getPrevChild&lt;/code&gt; and &lt;code&gt;getNextChild&lt;/code&gt; methods, but the &lt;code&gt;getPrevSibling&lt;/code&gt; and &lt;code&gt;getNextSibling&lt;/code&gt; should still serve your purpose. You would simply call it on the child entry instead of its parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method would be to gather all the children in one go and paginate them via JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yet another method would be the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#paginate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;paginate&lt;/code&gt;&lt;/a&gt; tag. &lt;code&gt;paginate&lt;/code&gt; works using any criteria. When you use &lt;code&gt;getChildren&lt;/code&gt;, you are getting criteria that's used to pull the child entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate entry.getChildren().limit(1) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As per the docs, you would then get the &lt;code&gt;paginate.prevUrl&lt;/code&gt; and &lt;code&gt;paginate.nextUrl&lt;/code&gt; variables to page through as needed.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-17T13:03:48.717" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1211" PostTypeId="2" ParentId="1201" CreationDate="2014-07-17T13:04:03.290" Score="6" Body="&lt;p&gt;No files within craft/app/ are safe to modify if you intend to keep Craft updated, including the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus, the license forbids it, so there’s that.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-17T13:04:03.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1212" PostTypeId="1" AcceptedAnswerId="1215" CreationDate="2014-07-17T13:11:39.237" Score="13" ViewCount="2164" Body="&lt;p&gt;S3 is seemingly costing us a lot. While it has its benefits, I think we could do with moving images from s3 to the server we are running the site from. How difficult/impossible of a task would that be?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-07-17T13:45:19.920" Title="Is it possible to move an entire asset source?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1213" PostTypeId="2" ParentId="1212" CreationDate="2014-07-17T13:24:40.467" Score="2" Body="&lt;p&gt;&lt;strong&gt;Ignore my answer. Andris' is better.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no functionality in Craft that I'm aware of, but you should be able to handle it similar to moving a website. The hardest part I think would be updating fields and references within entries.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set up your new asset source (whether local or another object store).&lt;/li&gt;&#xA;&lt;li&gt;Move all of your files to the new source.&lt;/li&gt;&#xA;&lt;li&gt;Go to the settings page in the control panel. First icon under &lt;strong&gt;Tools&lt;/strong&gt; is &lt;strong&gt;Update Asset Indexes&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Add your new source to Asset fields, and go update all of the entries.&lt;/li&gt;&#xA;&lt;li&gt;After the entries are updated, you can just delete the old asset source.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There's really no automated way to update fields and entries, but it might be possible with a really clever plugin.&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditDate="2014-07-17T13:45:19.920" LastActivityDate="2014-07-17T13:45:19.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1214" PostTypeId="2" ParentId="789" CreationDate="2014-07-17T13:39:20.860" Score="5" Body="&lt;p&gt;Your example is referencing a field that Twig doesn't know about yet. Also, you usually place the fields you are ordering entries with in quotes (ex: &lt;code&gt;order('dateField')&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix blocks are elements (like so many things in Craft), and thus are unable to be used for ordering entries. THe reason is that the variable in the returned model is not the actual blocks, but a Criteria Model for retrieving those blocks. It's a reference, if you will. I suggest you create a separate date field on the entry for ordering.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-17T13:39:20.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1215" PostTypeId="2" ParentId="1212" CreationDate="2014-07-17T13:40:25.460" Score="19" Body="&lt;p&gt;The easiest way I imagine would be to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a local folder&lt;/li&gt;&#xA;&lt;li&gt;Download all the files into the folder (outside of Assets - via Transmit or similar)&lt;/li&gt;&#xA;&lt;li&gt;Change your source settings from S3 to Local with correct paths&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And you're done. Whoa, that was easy :)&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-07-17T13:40:25.460" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1216" PostTypeId="2" ParentId="1101" CreationDate="2014-07-17T14:18:45.617" Score="4" Body="&lt;p&gt;Matrix blocks are elements like entries themselves. There's an API for them even. You will want to load your matrix data into an array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;MatrixBlockModels&lt;/code&gt;&lt;/a&gt;, then run &lt;a href=&quot;http://buildwithcraft.com/docs/apis/matrixservice#saveBlock&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;matrix-&amp;gt;saveBlock&lt;/code&gt;&lt;/a&gt; on each one. You will need the field id and type id for the block in question, which you can get from the Fields Service (you'll need to look this up in the Craft source code) and &lt;a href=&quot;http://buildwithcraft.com/docs/apis/matrixservice&quot; rel=&quot;nofollow&quot;&gt;Matrix Service&lt;/a&gt;. You will also need the owner which can be set by running &lt;code&gt;setOwner&lt;/code&gt; on the &lt;code&gt;MatrixBlockModel&lt;/code&gt; and handing it the entry model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets more involved, but this should give you a start.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-17T14:18:45.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1217" PostTypeId="1" AcceptedAnswerId="1227" CreationDate="2014-07-17T14:37:28.457" Score="8" ViewCount="377" Body="&lt;p&gt;The subject more or less covers it — is there any way to set the default status for Entries, either on a Section by Section basis, or globally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a client that doesn't want to accidentally set something live when they save something without deliberately setting it to published.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment it looks like I have two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create an un-Crafty &quot;Publish&quot; checkbox field that I check for in my templates.&lt;/li&gt;&#xA;&lt;li&gt;Use User Groups to keep some users from publishing — this is a little overkill for them, though. They don't want to keep these people from publishing, just try to limit people publishing content without meaning to.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="109" LastEditorUserId="109" LastEditDate="2014-07-17T14:46:59.590" LastActivityDate="2017-10-11T11:54:11.357" Title="Is there any way to set a default status for Entries, either globally or per Section?" Tags="&lt;entries&gt;&lt;sections&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1218" PostTypeId="2" ParentId="1101" CreationDate="2014-07-17T14:48:03.390" Score="5" Body="&lt;p&gt;Ok there are two parts to this question - how to save relationships and how to save matrix blocks whilst saving an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to save relationships&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To deal with the first, it is my understanding that the entries need to exist first so you may need to create them if they aren't already. Then all you need to do is pass an array of entry ids to the relevant field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;entriesField = $targetEntryIds;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to save matrix blocks whilst saving an entry&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bryan is correct in that you can create and save blocks all by themselves, however if all you want to do is add some blocks to a new entry then the following setup will work just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixData = array();&#xA;&#xA;$matrixData['new1'] = array(&#xA;  'type' =&amp;gt; 'blockType',&#xA;  'enabled' =&amp;gt; true,&#xA;  'fields' =&amp;gt; array(&#xA;    'fieldOne' =&amp;gt; 'Some string or data',&#xA;    'fieldTwo' =&amp;gt; '12'&#xA;  )&#xA;);&#xA;&#xA;// You can repeat this part for each block you want to add, just increment the newN number.&#xA;$matrixData['new2'] = array(&#xA;  'type' =&amp;gt; 'blockType',&#xA;  'enabled' =&amp;gt; true,&#xA;  'fields' =&amp;gt; array(&#xA;    'fieldOne' =&amp;gt; 'Some more text',&#xA;    'fieldTwo' =&amp;gt; '16'&#xA;  )&#xA;);&#xA;&#xA;// set matrix field to contain those blocks before saving the entry&#xA;$entry-&amp;gt;setContentFromPost(array('matrixField' =&amp;gt; $matrixData));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/brandonkelly/8149062&quot;&gt;This gist&lt;/a&gt; from Brandon explains all on the Matrix front, I am merely repeating most of it here for your benefit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck!&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-07-17T14:48:03.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1219" PostTypeId="1" AcceptedAnswerId="1221" CreationDate="2014-07-17T14:59:18.427" Score="5" ViewCount="150" Body="&lt;p&gt;I'm working on a Craft project with another developer. We're connected to the same shared database but my dashboard is different than his (I customized mine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This made us wonder how the custom dashboards are scoped. Are they based on user? Or are they based on a user group and &quot;super admins&quot; have their own individual scope?&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-07-18T06:17:31.003" Title="How are changes to the dashboard scoped?" Tags="&lt;control-panel&gt;&lt;scope&gt;&lt;cp-dashboard&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1220" PostTypeId="2" ParentId="1193" CreationDate="2014-07-17T15:14:55.240" Score="7" Body="&lt;p&gt;Did you try this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;If you’re getting a 404, your server might not be configured to redirect would-be 404’s to index.php correctly. Try going to &lt;a href=&quot;http://example.com/index.php/admin&quot;&gt;http://example.com/index.php/admin&lt;/a&gt; or &lt;a href=&quot;http://example.com/index.php?p=admin&quot;&gt;http://example.com/index.php?p=admin&lt;/a&gt; instead.&quot;&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2014-07-17T15:14:55.240" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1221" PostTypeId="2" ParentId="1219" CreationDate="2014-07-17T16:20:38.583" Score="4" Body="&lt;p&gt;&lt;strong&gt;Every user has their own unique dashboard.&lt;/strong&gt; The changes you make to your dashboard affect only your account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It cannot be shared, and it cannot be preset in any way. It is not related to user groups at all. The only way to change someone else's dashboard is by logging into the control panel as an admin, then finding that user and &quot;Log in as them&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been a handful of feature requests regarding pre-setting dashboards, or remotely controlling or locking another user's dashboard... but for the near future, this is simply how dashboards work.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-17T16:20:38.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1222" PostTypeId="1" CreationDate="2014-07-17T16:51:47.410" Score="1" ViewCount="1176" Body="&lt;p&gt;I have a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;Controller Action&lt;/a&gt; which should pass on some data from one (CP) template to another:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Template 1 (&lt;code&gt;plugin/form&lt;/code&gt;): Form sends data&lt;/li&gt;&#xA;&lt;li&gt;Controller redirects data to Template 2&lt;/li&gt;&#xA;&lt;li&gt;Template 2 (&lt;code&gt;plugin/&lt;/code&gt;): Shows data&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I don't want to just load the template but redirect to &lt;code&gt;plugin/&lt;/code&gt; and show the data, any ideas?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionTemplate()&#xA;{&#xA;    $data = 'Something';&#xA;    $this-&amp;gt;redirect( 'plugin_handle' ); //Pass on $data to 'plugin/'&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a way to send a post-request to a &quot;route&quot; rather then an actionController?&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-18T14:34:57.583" LastActivityDate="2014-09-17T13:56:18.377" Title="How to perform a redirect and pass on data?" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1223" PostTypeId="1" AcceptedAnswerId="1224" CreationDate="2014-07-17T17:12:03.963" Score="2" ViewCount="1045" Body="&lt;p&gt;Forgive the simplicity of this question but I am in the early stages of my first Craft implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My simple question is: how do I display a category name in a template. This is the code I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.find({section: 'blog', limit: '3'}) %}&#xA;    &amp;lt;div class=&quot;article&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;category&quot;&amp;gt;{{ entry.blogCategory }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;headline&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error I am getting says &quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. &lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2014-07-17T17:27:35.173" Title="How do I list category name?" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1224" PostTypeId="2" ParentId="1223" CreationDate="2014-07-17T17:21:01.910" Score="9" Body="&lt;p&gt;An &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt; is &quot;used to fetch elements with a given set of parameters.&quot; &lt;code&gt;{{ entry.blogCategory }}&lt;/code&gt; hasn't yet fetched your category element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;category&quot;&amp;gt;{{ entry.blogCategory.first }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you are positive there is exactly one of them, or more generally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for c in entry.blogCategory %}&#xA;  &amp;lt;p class=&quot;category&quot;&amp;gt;{{ c }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-17T17:21:01.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1225" PostTypeId="2" ParentId="1223" CreationDate="2014-07-17T17:27:35.173" Score="2" Body="&lt;p&gt;There are several ways. Categories in Craft are &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;elements&lt;/a&gt;. Most things are. I wrote &lt;a href=&quot;https://craftcms.stackexchange.com/questions/630/how-do-i-pull-related-entries-and-assets/640#640&quot;&gt;an answer about relating elements here&lt;/a&gt;. For you, if you know there's just one you can:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;category&quot;&amp;gt;{{ entry.blogCategory.first() }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there's many you can loop over them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.blogCategory %}&#xA;    &amp;lt;p class=&quot;category&quot;&amp;gt;{{ category }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you just want a comma separated list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;category&quot;&amp;gt;{{ entry.blogCategory.find()|join(&quot;, &quot;) }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't tried the last one, but it should theoretically work.&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-07-17T17:27:35.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1226" PostTypeId="2" ParentId="1222" CreationDate="2014-07-17T17:40:10.720" Score="2" Body="&lt;p&gt;I would suggest either using query parameters in your redirect method, or storing it in session variables (which should be no different than regular PHP).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-17T17:40:10.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1227" PostTypeId="2" ParentId="1217" CreationDate="2014-07-17T17:44:37.290" Score="2" Body="&lt;p&gt;Your two options are the only ones thus far. If you would like this feature you can leave a post on the &lt;a href=&quot;https://plus.google.com/communities/106505340287442511226&quot; rel=&quot;nofollow&quot;&gt;G+ group&lt;/a&gt;, or email them at: support@buildwithcraft.com&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-17T17:44:37.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1228" PostTypeId="1" CreationDate="2014-07-17T18:16:08.650" Score="1" ViewCount="328" Body="&lt;p&gt;Anyone else suffering from this issue after doing an upgrade/update?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may be in the category of bugs because it appeared to be working earlier today before upgrading Craft from the Free version to the Pro version I've been unable to save fields that are of type &quot;Assets&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current install is:&#xA;Craft Pro 2.1.2564 Released on 7/15/2014&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is pretty straight forward. Attempting to save or edit a field that is set to the type &quot;assets&quot; fails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the sources available for assets on the create new field page incorrectly indicate that no sources are available. Error reads &quot;No sources exist yet.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Drc67.png&quot; alt=&quot;see &amp;quot;no sources available&amp;quot; warning even though there are sources.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a run down where I verified the directory paths were properly set, and the permissions for those directories were also properly set. Both checked out okay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, uploads to all my defined sources work as expected. This issue seems to only impact fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result of trying to save or edit a field produces an error that appears saying &quot;save failed&quot;. No further warnings show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a shot of the available sources defined on my install, these were defined after my upgrade if that makes a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4XeZZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="552" LastActivityDate="2014-07-19T19:05:26.340" Title="Why am I getting &quot;no sources available&quot; when adding/editing a field of type Assets?" Tags="&lt;fieldtypes&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1229" PostTypeId="2" ParentId="1228" CreationDate="2014-07-17T18:21:43.187" Score="1" Body="&lt;p&gt;Does &lt;em&gt;Update Asset Indexes&lt;/em&gt; from the control panel help? (you might as well &lt;em&gt;Clear Caches&lt;/em&gt; and &lt;em&gt;Rebuild Search Indexes&lt;/em&gt; while you're at it)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-17T18:21:43.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1230" PostTypeId="2" ParentId="1228" CreationDate="2014-07-17T18:26:59.237" Score="0" Body="&lt;p&gt;If &lt;a href=&quot;https://craftcms.stackexchange.com/a/1229/177&quot;&gt;Marion's way&lt;/a&gt; doesn't work, it could also be possible that while updating something got messed up in the &lt;code&gt;/craft/storage/runtime/&lt;/code&gt; directory. Try deleting it, and check again.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-17T18:26:59.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1232" PostTypeId="1" AcceptedAnswerId="1235" CreationDate="2014-07-17T19:36:04.920" Score="7" ViewCount="1186" Body="&lt;p&gt;When I need to make one tiny change to the default config it would be handy to be able to duplicate the current default.json file and just change a one thing instead of building a duplicate from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a small thing, but it would be a nice time saver. I've had no luck finding it, does anyone know if the default is saved somewhere?&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2015-05-24T20:33:45.527" Title="Is Redactor's default config saved as a .json file anywhere?" Tags="&lt;config&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1234" PostTypeId="2" ParentId="1232" CreationDate="2014-07-17T19:47:35.150" Score="4" Body="&lt;p&gt;Unfortunately no, the “Default” config is just whatever default values are hard-coded in redactor.js.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-17T19:47:35.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1235" PostTypeId="2" ParentId="1232" CreationDate="2014-07-17T20:39:21.993" Score="9" Body="&lt;p&gt;As @Brandon said, the defaults are hardcoded in redactor.js so there isn't a default.json file, but if there was, this is what it would be (from Craft 2.3.2615):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;    buttons: ['html', 'formatting', 'bold', 'italic', 'deleted',&#xA;    'unorderedlist', 'orderedlist', 'outdent', 'indent',&#xA;    'image', 'link', 'alignment', 'horizontalrule'],&#xA;&#xA;    formatting: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the above code could change on occasion consider checking directly over at the Redactor site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/buttons/#setting-buttons&quot; rel=&quot;nofollow&quot;&gt;Buttons defaults&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formatting&quot; rel=&quot;nofollow&quot;&gt;Formatting defaults&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="12" LastEditDate="2015-05-24T20:33:45.527" LastActivityDate="2015-05-24T20:33:45.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1236" PostTypeId="1" AcceptedAnswerId="1237" CreationDate="2014-07-17T21:00:34.517" Score="5" ViewCount="987" Body="&lt;p&gt;I have a rich text field that I don't want wrapped in anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want a text area field, but I'm not sure how to get a text area without making it rich text, as the only multiline text field is the rich text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is going to be rich text, I need to be able to remove wrapping tags and control those.&lt;/p&gt;&#xA;" OwnerUserId="269" LastEditorUserId="45" LastEditDate="2014-07-17T22:50:37.170" LastActivityDate="2014-07-17T22:50:37.170" Title="Can I have a textarea field which isn't rich text?" Tags="&lt;fieldtypes&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1237" PostTypeId="2" ParentId="1236" CreationDate="2014-07-17T21:06:38.980" Score="6" Body="&lt;p&gt;If what you want is a multi-line plain text field, then check the &lt;em&gt;Allow line breaks&lt;/em&gt; checkbox for that field.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-17T21:06:38.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1238" PostTypeId="1" CreationDate="2014-07-17T22:21:01.803" Score="3" ViewCount="602" Body="&lt;p&gt;I have a Structure setup where I'd like each child to link to an anchor within the parent page (see the attached image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TI2Tv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I use &lt;code&gt;&amp;lt;a href=&quot;{{ subEntry.url }}&quot;&amp;gt;&lt;/code&gt; and click on the link, it redirects to the parent URL without the # anchor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;code&gt;http://localhost:3000/services/web-interactive-design#website-design&lt;/code&gt; redirects to &lt;code&gt;http://localhost:3000/services/website-design&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prevent this from happening?&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="130" LastEditDate="2014-07-18T00:20:15.427" LastActivityDate="2014-07-18T00:20:15.427" Title="Prevent Craft URLs containing # from redirecting" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1239" PostTypeId="2" ParentId="1179" CreationDate="2014-07-17T22:52:26.833" Score="1" Body="&lt;p&gt;It turns out I ended up needing to utilize a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Model&lt;/a&gt; with the fieldtype. I'm changing my approach to this and won't be needing this custom fieldtype. But you can see what I ended up coming up with via this &lt;a href=&quot;https://gist.github.com/irock195/a86cf3dd9c8a72c2244f&quot; rel=&quot;nofollow&quot;&gt;gist&lt;/a&gt;. I'm not sure this is the totally correct way to handle this, but I got it working how I imagined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone is super interested this is how I went about figuring it out. I picked apart the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-smartmap&quot; rel=&quot;nofollow&quot;&gt;SmartMap&lt;/a&gt; plugin to learn more about models and how to output them within templates.&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2014-07-17T22:52:26.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1240" PostTypeId="1" AcceptedAnswerId="1333" CreationDate="2014-07-17T23:02:20.450" Score="5" ViewCount="579" Body="&lt;p&gt;I now know that you can enter data into an entry's field by using &lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;handle&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let's say I have a foreach loop and I want to enter each line into an entry that is a table field. So for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($apigrab['properties'] as $specs) {&#xA;    $event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;specs == ??&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously each table heading has it's own handle and I don't imagine specs.handle would work in this case, and also how would you prevent it from just overwriting the same line over and over again? Would I have to count how many first and tell it specifically where to go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="532" LastEditorUserId="45" LastEditDate="2014-07-23T01:51:52.463" LastActivityDate="2014-07-23T01:51:52.463" Title="Programmatically entering data into a table field for an entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1241" PostTypeId="2" ParentId="1238" CreationDate="2014-07-17T23:08:55.243" Score="3" Body="&lt;p&gt;The setup you have there is creating routes within the system not overriding the URL property of your entry. If you just want to generate anchors you should uncheck &quot;Entries in this section have their own URLs&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then within your template for your top-level structure item run a loop and output the content with ids and then the anchors as links.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('myStructure') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ entry.slug }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    &amp;lt;div id=&quot;{{ entry.slug }}&quot;&amp;gt;&#xA;        {{ entry.content }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="222" LastEditorUserId="130" LastEditDate="2014-07-18T00:18:43.073" LastActivityDate="2014-07-18T00:18:43.073" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1243" PostTypeId="1" AcceptedAnswerId="1248" CreationDate="2014-07-18T05:22:17.297" Score="4" ViewCount="692" Body="&lt;p&gt;For a website I'm currently building I have a bunch of photos within an Assets folder (folder id of 5) that I have linked to &quot;Photographer&quot; entries within a &quot;Photographers&quot; structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now trying to search by the photographer slug in order to show photos for a specific photographer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchQuery = &quot;photographer::example-photographer&quot; %}&#xA;{% set matchingPhotos = craft.assets.folderId(5).search(searchQuery) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately however the &lt;code&gt;matchingPhotos&lt;/code&gt; data set is always empty, even though I'm very sure that a photographer exists with a slug of &lt;code&gt;example-photographer&lt;/code&gt; and there are photos linked to this photographer in the assets folder..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the way I'm trying to search correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="557" LastActivityDate="2014-07-18T10:37:52.680" Title="searching assets - using related entry slug" Tags="&lt;assets&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1245" PostTypeId="1" AcceptedAnswerId="14395" CreationDate="2014-07-18T09:54:19.733" Score="5" ViewCount="2551" Body="&lt;p&gt;On an entry page I search for related entries based on the tags assigned to the respective entry. The following example works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.q_tags.first %}&#xA;&#xA;{% for tag in entry.q_tags.offset(1) %}&#xA;    {% set tags = tags ~ ' OR ' ~ tag  %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.search(tags).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just wonder whether there is a smarter solution?&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="57" LastEditDate="2014-07-18T17:49:12.157" LastActivityDate="2016-03-30T15:25:38.087" Title="Search for related entries based on tags" Tags="&lt;tags&gt;&lt;search&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1246" PostTypeId="1" CreationDate="2014-07-18T09:58:10.900" Score="3" ViewCount="481" Body="&lt;p&gt;If I add an image to a rich-text field, I can set it's title. On the front-end however, the img-tag only gets an alt-attribute. I would also like the title-attribute to be set. Is this possible with a Redactor config-file, and if so, how?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-07-19T17:49:08.280" Title="Can I make Redactor add a 'title' attribute to img-tag?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1247" PostTypeId="2" ParentId="1245" CreationDate="2014-07-18T10:24:50.940" Score="5" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.q_tags %}&#xA;{% set entries = craft.entries.relatedTo(tags).order('score').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-07-18T11:04:57.930" LastActivityDate="2014-07-18T11:04:57.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1248" PostTypeId="2" ParentId="1243" CreationDate="2014-07-18T10:37:52.680" Score="4" Body="&lt;p&gt;I have not tried this against a working database but based on something very similar this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matchingPhotos = craft.assets.folderId(5).relatedTo({&#xA;  targetElement: craft.entries({&#xA;    slug : 'example-photographer',&#xA;    section : 'photographers'&#xA;  }),&#xA;  field : assetsPhotographerField&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In reverse what you are doing is getting all the photographer entries that match that slug that are related to the assets field in that specific folder id...does that make any sense?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to swap &lt;code&gt;targetElement&lt;/code&gt; out for &lt;code&gt;sourceElement&lt;/code&gt; - I never know which way round it should be!&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-07-18T10:37:52.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1249" PostTypeId="1" CreationDate="2014-07-18T11:20:13.870" Score="2" ViewCount="247" Body="&lt;p&gt;I have Craft Pro (2.1.2564) and cannot locate the &amp;quot;share&amp;quot; functionality outlined below.&#xA;When I edit an entry, The Live Preview button in Chrome (OSX) has only the Live Preview button with the eye icon and then an arrow. That row triggers the Live preview and not any sharing function.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/updates#build2554&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/updates#build2554&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Added a “Share” button next to entries’ Live Preview button, which opens the current entry/draft/version on the front end, with a tokened URL that can be shared with others without requiring them to be logged in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="283" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-07-18T17:56:11.340" Title="Can't find the &quot;share entry&quot; functionality" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1250" PostTypeId="1" AcceptedAnswerId="1254" CreationDate="2014-07-18T12:24:36.957" Score="9" ViewCount="2743" Body="&lt;p&gt;Starting on a second site which is an almost like for like copy of the first, except it has different content. I cant use locales to manage it because there may be the possibility of multiple languages on the second site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have dozens of field &amp;amp; entry types I want to transfer over to the second site. Is there an automated way of deleting all the content?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2018-04-13T04:40:50.047" Title="Is there a way to delete all entries?" Tags="&lt;content&gt;&lt;deletion&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1251" PostTypeId="2" ParentId="1250" CreationDate="2014-07-18T12:58:45.067" Score="0" Body="&lt;p&gt;As far as I know, you can only do that by deleting and recreating a section.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-18T12:58:45.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1252" PostTypeId="2" ParentId="1250" CreationDate="2014-07-18T13:13:21.270" Score="3" Body="&lt;p&gt;I figured it out somewhat by using the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import plugin, by Bob Olde Hampsink&lt;/a&gt;, exporting all my slugs to a csv, then using the delete functionality of the plugin to remove all entries with a slug found in the csv. Worked perfectly!&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-07-18T13:13:21.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1253" PostTypeId="2" ParentId="1249" CreationDate="2014-07-18T13:19:21.520" Score="5" Body="&lt;p&gt;The arrow &lt;em&gt;is&lt;/em&gt; the Share button. If it’s just opening Live Preview for you, please get in touch with us directly – support@buildwithcraft.com.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-18T13:19:21.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1254" PostTypeId="2" ParentId="1250" CreationDate="2014-07-18T14:26:11.893" Score="11" Body="&lt;p&gt;You could also delete all rows in your &lt;code&gt;craft_elements&lt;/code&gt; table, which have &lt;code&gt;type&lt;/code&gt; set to &lt;code&gt;Entry&lt;/code&gt; (or whatever &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot;&gt;ElementType&lt;/a&gt; you want to delete).&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-18T14:26:11.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1255" PostTypeId="1" AcceptedAnswerId="1257" CreationDate="2014-07-18T15:22:14.577" Score="2" ViewCount="1092" Body="&lt;p&gt;I'm iterating through a folder using craft.assets, to select the folder I'll use the folderId.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to find the folderId of a specific folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I've found is to go the the Asset Settings page in the CP and hovering over a folder to see the url in the status bar in my browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a folder in the CP Fields page (see image) and there seems no way to get this folderId as I cannot get to it in the Asset Settings page. As I only have a small number of folders I was able to figure it but it got me wondering if I was missing the obvious somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4LdAs.png&quot; alt=&quot;Folder added in Field page&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="260" LastEditorUserId="260" LastEditDate="2014-07-18T17:30:53.413" LastActivityDate="2018-03-22T19:03:13.577" Title="Best way to find a folderId" Tags="&lt;assets&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1256" PostTypeId="2" ParentId="1168" CreationDate="2014-07-18T16:06:59.060" Score="2" Body="&lt;p&gt;While Marion's post is right, it's not quite what I was trying to achieve I didn't want to have 2 templates (although use of macros is perfectly suitable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done to get around this is is add a &lt;code&gt;tag&lt;/code&gt; segment for tags and leave categories as is. Then I added a custom route to support the tag segement but use the same template code &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;URI's:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/news/*category*&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/news/tag/*tag*&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The category route is defined automagically, but I needed to set up a route for the &lt;code&gt;tag&lt;/code&gt; view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template Path:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;news/index&lt;/code&gt; (which is also defined as my Category Template in the category settings)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the same template code above, I'm able to get the index/list view of a &lt;code&gt;category&lt;/code&gt; and &lt;code&gt;tag&lt;/code&gt; when they are the same all within the same template.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-18T16:06:59.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1257" PostTypeId="2" ParentId="1255" CreationDate="2014-07-18T17:49:36.543" Score="2" Body="&lt;p&gt;You can find the id in the database in the &lt;code&gt;craft_assetfolders&lt;/code&gt; table. Creating a field with &lt;em&gt;uploads restricted to a single folder&lt;/em&gt; does not create an asset folder. The asset folder only gets created when you actually have an asset in that folder, so before that point there is no &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-18T17:49:36.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1258" PostTypeId="1" AcceptedAnswerId="1260" CreationDate="2014-07-18T18:56:26.607" Score="15" ViewCount="453" Body="&lt;p&gt;I use &lt;a href=&quot;http://kapeli.com/dash&quot;&gt;Dash&lt;/a&gt; to browse docs and was wondering if there are any plans to get Crafts docs into it. If it's not too difficult I'd like to request it for the future (eventually).&lt;/p&gt;&#xA;" OwnerUserId="196" LastEditorUserId="250" LastEditDate="2014-10-03T16:08:45.693" LastActivityDate="2014-11-13T22:32:35.737" Title="Are there any plans to get Craft Docs in Dash App" Tags="&lt;documentation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1259" PostTypeId="1" AcceptedAnswerId="1263" CreationDate="2014-07-18T19:05:05.900" Score="7" ViewCount="2257" Body="&lt;p&gt;I'm trying to show related entries to current entry by tag ID (which is working fine) but getting hung up when trying to exclude the current entry from the loop. I think I'm having an issue with paginate tags requiring an element criteria model but I'm not able to figure out how to get around this. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set segment = craft.request.lastSegment %}&#xA;{% for entries in craft.entries.slug(segment) %}&#xA;  {% set current = craft.entries.slug(segment) %}&#xA;  {% set tagId = entry.myTagFieldHandle.first() %}&#xA;  {% set suite = craft.entries.relatedTo(tagId) %}&#xA;&#xA;    {% paginate suite|without(current) as entries %}&#xA;      {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;      {% endfor %}&#xA;    {% endpaginate %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Excluding the without filter on paginate outputs everything fine, but includes the current entry. I know there are probably better ways of doing this and I appreciate any help, thanks!&lt;/p&gt;&#xA;" OwnerUserId="425" LastEditorUserId="3951" LastEditDate="2017-12-10T15:21:27.610" LastActivityDate="2017-12-10T15:21:27.610" Title="Show related entries without current entry" Tags="&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1260" PostTypeId="2" ParentId="1258" CreationDate="2014-07-18T19:23:21.010" Score="12" Body="&lt;p&gt;We've discussed it off and on because so many people have requested it and have got some ideas on how we'd tackle it.  No ETA, but it's on “The List” ™.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-18T19:23:21.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1261" PostTypeId="1" AcceptedAnswerId="1389" CreationDate="2014-07-18T19:35:52.503" Score="6" ViewCount="664" Body="&lt;p&gt;I have a custom element type that I want to allow anonymous submission from the front-end. I have a solid concept on how the form data is passed but I seem to be missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the controller setup like so: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class PluginNameController extends BaseController&#xA;{&#xA;    /**&#xA;     * @var Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = array('actionSubmit');&#xA;&#xA;    /**&#xA;     * Allow public submission of the element type&#xA;     */&#xA;    public function actionSubmit()&#xA;    {&#xA;        // require post request for this action&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        $entry = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;        // set the form id from the post request&#xA;        $formId = craft()-&amp;gt;request-&amp;gt;getPost('formId');&#xA;        $entry = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;        // if form id is empty, throw exception as we can't continue&#xA;        if (!$formId) {&#xA;            throw new Exception(Craft::t('The formId is required to submit.'));&#xA;        }&#xA;&#xA;        if (craft()-&amp;gt;pluginName-&amp;gt;publicSubmission($formId, $entry))&#xA;        {&#xA;            $this-&amp;gt;redirectToPostedUrl();&#xA;        }&#xA;        else&#xA;        {&#xA;            die('failed submission');&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My element type has 4 fields that are required and those submit anonymously as expected as I am grabbing them using &lt;code&gt;getPost&lt;/code&gt;. However, my plugin also utilizes the &lt;code&gt;getSources&lt;/code&gt; method and each &lt;code&gt;formId&lt;/code&gt; has a field layout assigned to the custom element type, lets say 'entry'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats causing the trip up is the fact that since this is an element type that utilizes a field layout, I will need to account for the fields based on the &lt;code&gt;formId&lt;/code&gt;. So when using &lt;code&gt;getPost&lt;/code&gt; I can namespace the attributes for the element type, but I am trying to find the best way to capture the fields specified in the field layout and save those to the appropriate table.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? &lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-25T01:58:47.757" LastActivityDate="2014-07-25T09:15:36.113" Title="Allow anonymous submission on a custom element type?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;elementtype&gt;&lt;services&gt;&lt;models&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1262" PostTypeId="2" ParentId="1258" CreationDate="2014-07-18T19:57:30.143" Score="1" Body="&lt;p&gt;Lots of people have requested this, either to P&amp;amp;T or directly to Kapeli... When talking to Kapeli, he basically says &quot;here's instructions on how to do it yourself&quot;. So, if you feel like starting a repo for it, I'm sure some other folks would jump on board. :)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://twitter.com/kapeli/status/483392793566781441&quot; rel=&quot;nofollow&quot;&gt;https://twitter.com/kapeli/status/483392793566781441&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-18T19:57:30.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1263" PostTypeId="2" ParentId="1259" CreationDate="2014-07-18T20:05:30.737" Score="16" Body="&lt;p&gt;You're wanting to show a paginated list of related entries from a single entry page based on a tag relationship, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should point you in the right direction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment = craft.request.lastSegment %}&#xA;&#xA;{% for entry in craft.entries.slug(segment) %}&#xA;&#xA;    {% set tagId = entry.myTagFieldHandle.first() %}&#xA;&#xA;    {% set relatedEntries = craft.entries.relatedTo(tagId).id('not ' ~ entry.id) %}&#xA;&#xA;    {% paginate relatedEntries as related %}&#xA;&#xA;        {% for entry in related %}&#xA;&#xA;            {{ entry.title }}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endpaginate %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-07-18T20:15:28.570" LastActivityDate="2014-07-18T20:15:28.570" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1264" PostTypeId="1" AcceptedAnswerId="1269" CreationDate="2014-07-18T21:16:05.667" Score="4" ViewCount="1476" Body="&lt;p&gt;In my plugin, how do I save a relationship when creating a new entry? The example below works for all but the &quot;quiz&quot; relationship.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$triviaSet = craft()-&amp;gt;entries-&amp;gt;getEntryById($data['itemId']);&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId   = 3&#xA;$entry-&amp;gt;typeId     = 2&#xA;$entry-&amp;gt;authorId   = 1;&#xA;$entry-&amp;gt;enabled    = true;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'title' =&amp;gt; 'My New Entry',&#xA;    'score' =&amp;gt; $data['score'],&#xA;    'quiz' =&amp;gt; $triviaSet&#xA;));&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="502" LastEditorUserId="177" LastEditDate="2014-07-18T21:23:19.753" LastActivityDate="2014-07-19T06:26:28.263" Title="In a plugin, how do I save an entry with a related entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1265" PostTypeId="1" CreationDate="2014-07-18T23:36:32.287" Score="5" ViewCount="863" Body="&lt;p&gt;I'm really struggling to display entries of a category, based on the segment. In other words, I have 1 category template, so the category needs to be determined dynamically (*we still  do this by segment, right?? or is that not the best practice?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying something like this, but I can't seem to get it right:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('typeOfPack').find() %}&#xA;     {% set active = (&#xA;        craft.request.Segment(2) == category.slug&#xA;     ) %}&#xA;&#xA;    {% for entry in entry.typeOfPack.search('active').find()  %}&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apologies if this offensively bad. As I try to get my head around Twig, I'm wondering if there are some high level errors, for instance: &#xA;1. Does the {% for entry... %} need to be inside the {%for category... %}? Do I even need to do the {% for category...%} stuff if I'm just needing entries, or is the &quot;.search(...)&quot; sufficient? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Big Mike&lt;/p&gt;&#xA;" OwnerUserId="562" LastActivityDate="2014-07-21T17:34:55.393" Title="Display category entries based on Segment?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1266" PostTypeId="2" ParentId="1208" CreationDate="2014-07-18T23:43:18.957" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There was a bug in Craft such that when saving a user, if the username / email / password failed validation first, content validation would never get a chance to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have just fixed that locally and it will go out in the next release.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The way you have your dropdowns defined (userCountry and occupation), they'll never fail validation because there will always be a value selected and submitted in $_POST.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The first name and last name fields on a user account are somewhat “&lt;a href=&quot;https://plus.google.com/u/0/+BenParizek/posts/isVyC5MnQs1&quot; rel=&quot;nofollow&quot;&gt;special&lt;/a&gt;” fields.  There is currently no way to set them as required.  We've got some plans to revamp how user names are handled on “The List”™ for a future update.  In the meantime, if you want to make them required fields, you can create actual custom fields for them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-18T23:43:18.957" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1267" PostTypeId="2" ParentId="1265" CreationDate="2014-07-19T01:39:51.060" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;How do I list the entries related to a category?&lt;/a&gt; article on the Craft site should get you headed in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can fetch the entries related to a given category with a little&#xA;  help from &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;craft.entries&lt;/a&gt; and the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; param.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the entries related to this category #}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{# Output them #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="43" LastEditDate="2014-07-21T17:34:55.393" LastActivityDate="2014-07-21T17:34:55.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1268" PostTypeId="1" CreationDate="2014-07-19T06:21:07.070" Score="17" ViewCount="4692" Body="&lt;p&gt;I have global variables that I want to include in Rich Text Fields, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is a rich text field, call us today at at {{ phone.number }}!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work out-of-the-box, are there any ways of doing this? I am coming from working in another CMS where this was possible to do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Specifically in this case I the global variable includes a javascript code that dynamically updates the phone number with a tracking number:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;{ document.write(_ibp_phone_number); }&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2014-07-19T06:46:13.757" LastActivityDate="2017-02-07T00:40:18.830" Title="Is it possible to use Twig in a Rich Text Field?" Tags="&lt;templating&gt;&lt;richtext&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1269" PostTypeId="2" ParentId="1264" CreationDate="2014-07-19T06:26:28.263" Score="6" Body="&lt;p&gt;Relations fields can store multiple related values (even if you only have one item).  Perhaps try to pass an array to the 'quiz' value: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'quiz' =&amp;gt; array($data['itemId'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you are submitting all of your content, in the correct format, you can get rid of your &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes&lt;/code&gt; line and use the &lt;code&gt;setContentFromPost&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to pass to the &lt;code&gt;setContentFromPost&lt;/code&gt; method is the name of the custom content fields array you are submitting to the content table.  For example, if your fields above were structured as follows in your front-end form template (this is a bit simplified for your complex field types like relations, but as long as your submitting the right values this should work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;title&quot; value=&quot;My New Entry&quot;&amp;gt; &#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[score]&quot; value=&quot;101&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[quiz][]&quot; value=&quot;101&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in the input field name of &lt;code&gt;quiz&lt;/code&gt; relations field we are passing an array: &lt;code&gt;fields[quiz][]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then receive your submitted data and hand it off to the ContentModel tied to your EntryModel. Your title is handled slightly differently than your custom content as the title field is a default attribute of the ContentModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;title = craft()-&amp;gt;request-&amp;gt;getPost('title');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your array of submitted custom content can be handed off silently to the &lt;code&gt;setContentFromPost&lt;/code&gt; field by just passing it the name of all of the fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't even need to capture your post data using something like &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields')&lt;/code&gt;, just passing the 'fields' value to the function does all the heavy lifting for you.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-19T06:26:28.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1270" PostTypeId="2" ParentId="1268" CreationDate="2014-07-19T06:34:35.870" Score="25" Body="&lt;h2&gt;The Technical Way&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You can do this using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/template_from_string.html&quot; rel=&quot;noreferrer&quot;&gt;template_from_string&lt;/a&gt; function and the raw filter.  In your template code you would output your Rich Text field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ include(template_from_string(entry.richTextFieldHandle)|raw) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And within your Rich Text field you could reference your global with the same syntax you normally would in Twig as you described above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is a rich text field, call us today at {{ phone.number }}!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;A More User-Friendly Way&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/nystudio107/richvariables&quot; rel=&quot;noreferrer&quot;&gt;Rich Variables&lt;/a&gt; Plugin allows you to give a user control over adding Global Variables to your Rich Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach will be a bit more limited in what you can accomplish, but probably toward a more user-friendly outcome for your content managers.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-02-07T00:40:18.830" LastActivityDate="2017-02-07T00:40:18.830" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1271" PostTypeId="1" AcceptedAnswerId="1272" CreationDate="2014-07-19T16:37:16.437" Score="2" ViewCount="1878" Body="&lt;p&gt;I'm a beginner and don't understand this error, and how to correct it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template error&lt;/strong&gt;&lt;br&gt;&#xA;Impossible to invoke a method (&quot;getUrl&quot;) on a string variable (&quot;60&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to display only the first entry of one loop. In my case,&lt;br&gt;&#xA;'&lt;em&gt;selectedArtwork&lt;/em&gt;' has an &lt;em&gt;Entries&lt;/em&gt; type and '&lt;em&gt;pictures&lt;/em&gt;' an &lt;em&gt;Assets&lt;/em&gt; type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.selectedArtwork | length %}&#xA;    {% for artwork in entry.selectedArtwork %}&#xA;&#xA;        {% set assets = artwork.pictures.first() %}&#xA;        {% if assets | length %}&#xA;            {% for asset in assets %}&#xA;&#xA;                {% set artworkPicture = { width: 475 } %}&#xA;                {% set artworkPictureRetina = { width: 930 } %}&#xA;&#xA;                &amp;lt;figure&amp;gt;&#xA;                    &amp;lt;img data-interchange=&quot;[{{ asset.getUrl(artworkPicture) }}, (default)], [{{ asset.getUrl(artworkPictureRetina) }}, (retina)]&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;noscript&amp;gt;&#xA;                        &amp;lt;img src=&quot;{{ asset.getUrl(artworkPicture) }}&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;                    &amp;lt;/noscript&amp;gt;&#xA;                &amp;lt;/figure&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the part of code highlighted in Craft's debug mode are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img data-interchange=&quot;[{{ asset.getUrl(artworkPicture) }}, (default)], [{{ asset.getUrl(artworkPictureRetina) }}, (retina)]&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;noscript&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl(artworkPicture) }}&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;&amp;lt;/noscript&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is working well as an entry template of another page of my website to display all entries, but not here for my homepage to only display the first entry.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2014-07-19T17:36:09.563" LastActivityDate="2014-07-19T22:20:46.287" Title="Impossible to invoke a method (&quot;getUrl&quot;) on a string variable (&quot;60&quot;)" Tags="&lt;assets&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1272" PostTypeId="2" ParentId="1271" CreationDate="2014-07-19T17:22:28.343" Score="2" Body="&lt;p&gt;I think your problem is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = artwork.pictures.first() %}&#xA;{% if assets | length %}&#xA;  {% for asset in assets %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This sets &lt;code&gt;assets&lt;/code&gt; to the first &lt;code&gt;artwork.pictures&lt;/code&gt;, not to a list of assets, and then you try to loop over that single asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a &lt;code&gt;figure&lt;/code&gt; for every &lt;code&gt;pictures&lt;/code&gt; of every &lt;code&gt;selectedArtwork&lt;/code&gt; of your entry, try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artworkPicture = { width: 475 } %}&#xA;{% set artworkPictureRetina = { width: 930 } %}&#xA;&#xA;{% for artwork in entry.selectedArtwork %}&#xA;  {% for asset in artwork.pictures %}&#xA;    &amp;lt;figure&amp;gt;&#xA;      &amp;lt;img data-interchange=&quot;[{{ asset.getUrl(artworkPicture) }}, (default)], [{{ asset.getUrl(artworkPictureRetina) }}, (retina)]&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;noscript&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl(artworkPicture) }}&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;/noscript&amp;gt;&#xA;    &amp;lt;/figure&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;set &lt;code&gt;artworkPicture&lt;/code&gt; and &lt;code&gt;artworkPictureRetina&lt;/code&gt; once, outside your loop.&lt;/li&gt;&#xA;&lt;li&gt;no need to use &lt;code&gt;{% if ...|length %}&lt;/code&gt;. If the length is 0, the for loop will run 0 times.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you want a &lt;code&gt;figure&lt;/code&gt; for the first &lt;code&gt;picture&lt;/code&gt; of every &lt;code&gt;selectedArtwork&lt;/code&gt;, try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artworkPicture = { width: 475 } %}&#xA;{% set artworkPictureRetina = { width: 930 } %}&#xA;&#xA;{% for artwork in entry.selectedArtwork %}&#xA;  {% set asset = artwork.pictures.first %}&#xA;  {% if asset %}&#xA;    &amp;lt;figure&amp;gt;&#xA;      &amp;lt;img data-interchange=&quot;[{{ asset.getUrl(artworkPicture) }}, (default)], [{{ asset.getUrl(artworkPictureRetina) }}, (retina)]&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;noscript&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl(artworkPicture) }}&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;/noscript&amp;gt;&#xA;    &amp;lt;/figure&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want a &lt;code&gt;figure&lt;/code&gt; for the first &lt;code&gt;picture&lt;/code&gt; of the first &lt;code&gt;selectedArtwork&lt;/code&gt;, try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artworkPicture = { width: 475 } %}&#xA;{% set artworkPictureRetina = { width: 930 } %}&#xA;&#xA;{% set artwork = entry.selectedArtwork.first %}&#xA;{% if artwork %}&#xA;  {% set asset = artwork.pictures.first %}&#xA;  {% if asset %}&#xA;    &amp;lt;figure&amp;gt;&#xA;      &amp;lt;img data-interchange=&quot;[{{ asset.getUrl(artworkPicture) }}, (default)], [{{ asset.getUrl(artworkPictureRetina) }}, (retina)]&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;noscript&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl(artworkPicture) }}&quot; width=&quot;{{ asset.getWidth(artworkPicture) }}&quot; height=&quot;{{ asset.getHeight(artworkPicture) }}&quot;&amp;gt;&#xA;      &amp;lt;/noscript&amp;gt;&#xA;    &amp;lt;/figure&amp;gt;&#xA;  {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-07-19T22:20:46.287" LastActivityDate="2014-07-19T22:20:46.287" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1273" PostTypeId="2" ParentId="1246" CreationDate="2014-07-19T17:49:08.280" Score="3" Body="&lt;p&gt;None of the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/&quot; rel=&quot;nofollow&quot;&gt;settings you can put in your Redactor config-file&lt;/a&gt; will do what you want. You &lt;strong&gt;can&lt;/strong&gt; write a &lt;a href=&quot;http://imperavi.com/redactor/docs/plugins-creating/&quot; rel=&quot;nofollow&quot;&gt;redactor plugin&lt;/a&gt; to do this, and then include your redactor plugin as a Craft plugin. One Craft plugin that does this is &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips/&quot; rel=&quot;nofollow&quot;&gt;RedactorClips&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Craft plugin is &lt;em&gt;mycraftplugin&lt;/em&gt;, and your redactor plugin files are &lt;em&gt;myredactorplugin.css&lt;/em&gt; and &lt;em&gt;myredactorplugin.js&lt;/em&gt;, then you store the redactor plugin files in the &lt;code&gt;resources&lt;/code&gt; directory of your craft plugin, and in the craft plugin &lt;code&gt;init()&lt;/code&gt; function, you call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeCssResource('mycraftplugin/myredactorplugin.css');&#xA;craft()-&amp;gt;templates-&amp;gt;includeJsResource('mycraftplugin/myredactorplugin.js');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-19T17:49:08.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1275" PostTypeId="1" AcceptedAnswerId="1276" CreationDate="2014-07-19T18:16:27.383" Score="21" ViewCount="6629" Body="&lt;p&gt;How can I exclude the current entry when I've structured my syntax like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section:        'blog',&#xA;  order:          'postDate',&#xA;  limit:          5,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2014-07-19T18:47:38.737" Title="Exclude Current Entry" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1276" PostTypeId="2" ParentId="1275" CreationDate="2014-07-19T18:47:38.737" Score="35" Body="&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section:        'blog',&#xA;  order:          'postDate',&#xA;  limit:          5,&#xA;  id:             'not ' ~ entry.id&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section:        'blog',&#xA;  order:          'postDate',&#xA;  limit:          5,&#xA;}).id('not ' ~ entry.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-19T18:47:38.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1277" PostTypeId="2" ParentId="1255" CreationDate="2014-07-19T18:57:17.823" Score="1" Body="&lt;p&gt;Checkout the &lt;a href=&quot;https://github.com/bjerenec/craftcms-blueprint/&quot; rel=&quot;nofollow&quot;&gt;blueprint&lt;/a&gt; plugin. It doesn't currently do this, but it does similar things.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-19T18:57:17.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1278" PostTypeId="2" ParentId="1228" CreationDate="2014-07-19T19:05:26.340" Score="3" Body="&lt;p&gt;I would not consider this to be the best solution, but I was able to fix my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I downloaded a fresh copy of Craft and replaced the craft/app/ directory with the fresh download. This restored all functionality back to normal. Not the most ideal, but it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone.&lt;/p&gt;&#xA;" OwnerUserId="552" LastActivityDate="2014-07-19T19:05:26.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1279" PostTypeId="1" CreationDate="2014-07-19T19:17:06.077" Score="8" ViewCount="3150" Body="&lt;p&gt;I've tried to install Craft on a variety of systems, and it seems that no matter what I try, I cannot get all the way through the installation process. In most cases, my install hangs on the &quot;Oops&quot; screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m9Kcw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've learned not to trust this screen, because if I immediately close the window and cancel my installation, the installer screen continues to show up when trying to access the admin login /admin/.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, if I just let it sit for a few minutes then close the screen, it seems like the install actually works as expected. Visiting /admin/ in my browser has the desired affect, and I'm able to use the CMS as expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought is that it might be something related to the install cleanup process - but I'd like to take a peek at the install log file to see exactly where things went wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked system requirements, although on some systems, I'm unable to personally verify all of the requirements are met. But I'd like to know why I got that &quot;Oops&quot; screen. It's obviously a non-critical error, or else the db and system would not function properly - which it does.&lt;/p&gt;&#xA;" OwnerUserId="552" LastActivityDate="2017-03-26T19:43:28.487" Title="Does Craft have an installer error log I can check?" Tags="&lt;install&gt;&lt;error-message&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1280" PostTypeId="2" ParentId="1279" CreationDate="2014-07-19T19:22:17.087" Score="7" Body="&lt;p&gt;Typically the Craft logs are stored here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/storage/runtime/logs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know how much logging the installer does, but if it does any at all, that's where you'll find the log data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you can also try this &lt;a href=&quot;https://craftcms.stackexchange.com/a/138/45&quot;&gt;script by Ben Croker&lt;/a&gt; which will check your server configuration to make sure it has everything it needs to proceed.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-19T19:22:17.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1281" PostTypeId="2" ParentId="1279" CreationDate="2014-07-19T21:26:11.087" Score="4" Body="&lt;p&gt;All of Craft's log files get stored in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running in &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt;, then any log message with a &lt;code&gt;trace&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt;, &lt;code&gt;warning&lt;/code&gt; or &lt;code&gt;error&lt;/code&gt; severity error will get logged there in addition to lots of database profiling information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;devMode&lt;/code&gt; is off, only &lt;code&gt;warning&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt; get logged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installation is a special exception to this config setting.  During installation, Craft will run with &lt;code&gt;devMode&lt;/code&gt; on, regardless of what it is set to in the config file precisely to help debug installation issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will run it's requirements checker and block the installation letting you know what's missing if a requirement is not met.  &lt;a href=&quot;https://craftcms.stackexchange.com/a/138/45&quot;&gt;Ben's script&lt;/a&gt; is handy if you want to check your server's requirements &lt;em&gt;before&lt;/em&gt; uploading Craft's file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth noting that PHP's error logs also get redirected to the same folder and that Craft will keep 6MB of log files before it starts to rotate the oldest logs out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't figure out the cause of the issue, be sure and hit us up at support@buildwithcraft.com and we'll take stab at it, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-19T23:13:39.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1282" PostTypeId="1" AcceptedAnswerId="1284" CreationDate="2014-07-19T22:18:48.963" Score="3" ViewCount="546" Body="&lt;p&gt;I've been working on a plugin that updates entry data based on the results from a json array using entries.onBeforeSaveEntry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this API might put out different information in the future, I would like to create an &quot;update all&quot; button that would cycle through all entries and just save them rather than going through each one and clicking save manually. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? &lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2014-07-19T23:06:10.393" Title="How could I create a button to loop through entries and re-save them?" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1283" PostTypeId="1" AcceptedAnswerId="1288" CreationDate="2014-07-19T23:05:51.310" Score="4" ViewCount="794" Body="&lt;p&gt;I’m creating a plugin that will ultimately create new entries using the Moves API (&lt;a href=&quot;https://dev.moves-app.com&quot; rel=&quot;nofollow&quot;&gt;https://dev.moves-app.com&lt;/a&gt;). The Moves API needs OAuth make authenticated calls on a user's account, so I'm using Dukt's OAuth plugin (&lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/oauth&lt;/a&gt;) to handle the OAuth authentication process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually have it up and running, but to create an Oauth provider that isn't supported natively by Dukt's plugin, I've added files to their folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s what I’ve done.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Created a Moves.php file in the &lt;code&gt;craft/plugins/oauth/vendor/chrisnharvey/oauth/src/Oauth/Provider/&lt;/code&gt; folder that sets up the necessary info to communicate w/ the Moves API - Link to source: &lt;a href=&quot;https://gist.github.com/bwlng/2cb486c8d83001deae19#file-moves-php&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/bwlng/2cb486c8d83001deae19#file-moves-php&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Created a MovesOAuthProviderSource.php file in the &lt;code&gt;craft/plugins/oauth/vendor/chrisnharvey/oauth/providers/&lt;/code&gt;folder that echoes the other providers Dukt supports out of the box. Link to source: &lt;a href=&quot;https://gist.github.com/bwlng/2cb486c8d83001deae19#file-movesoauthprovidersource-php&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/bwlng/2cb486c8d83001deae19#file-movesoauthprovidersource-php&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do this? Ideally want to require the Dukt plugin be installed, and then keep the code I've linked to above in my own folder in &lt;code&gt;craft/plugins/moves&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="177" LastEditDate="2014-07-20T17:01:49.450" LastActivityDate="2014-07-20T17:01:49.450" Title="What's the proper way to create a plugin that uses and extends another author’s plugin?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1284" PostTypeId="2" ParentId="1282" CreationDate="2014-07-19T23:06:10.393" Score="1" Body="&lt;p&gt;If all you want to do is re-save all of the entries without making any modifications to them, you're best bet is to use the completely undocumented &lt;code&gt;TaskService&lt;/code&gt; and trigger the &lt;code&gt;ResaveElements&lt;/code&gt; task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an example of how to do it from your plugin &lt;a href=&quot;https://craftcms.stackexchange.com/a/823/57&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-19T23:06:10.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1285" PostTypeId="2" ParentId="1283" CreationDate="2014-07-19T23:12:33.093" Score="3" Body="&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read about it from &lt;a href=&quot;https://craftcms.stackexchange.com/a/1288/57&quot;&gt;the man himself&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I haven't looked at the internals of Dukt's oAuth plugin to know how it works, but the proper way to do it would be for his plugin to provide a hook (or hooks) that let's other plugins register their own oAuth providers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not currently setup to do that, you can make a &lt;a href=&quot;http://mailto:hello@dukt.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; or &lt;a href=&quot;https://github.com/dukt/craft-oauth&quot; rel=&quot;nofollow noreferrer&quot;&gt;pull request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-20T16:52:08.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1286" PostTypeId="1" AcceptedAnswerId="1287" CreationDate="2014-07-20T09:08:42.890" Score="5" ViewCount="1501" Body="&lt;p&gt;I have limited knowledge of PHP but I would like to try and create a widget. Basically all it needs to do is provide some text and a link to the user profile page as you can't route directly to that page on login. Would someone be able to point me in the write direction please. I have in my &lt;code&gt;grWidget.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class GrWidget extends BasePlugin&#xA;{&#xA;  function getName()&#xA;    {&#xA;      return Craft::t('Gareth Widget');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;      return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;      return 'Gareth Redfern';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;      return 'http://garethredfern.com';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="177" LastEditDate="2014-07-20T13:30:46.383" LastActivityDate="2014-07-20T14:42:40.820" Title="How to create a simple widget?" Tags="&lt;plugin-development&gt;&lt;dashboard-widgets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1287" PostTypeId="2" ParentId="1286" CreationDate="2014-07-20T13:18:02.497" Score="8" Body="&lt;p&gt;I think you are mixing up your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;noreferrer&quot;&gt;Primary Plugin Class&lt;/a&gt; with your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/widgets&quot; rel=&quot;noreferrer&quot;&gt;Dashboard Widget&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin Structure:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your plugin is called &lt;code&gt;Gareth&lt;/code&gt; and your widget &lt;code&gt;Gr&lt;/code&gt;, this files should be in your &lt;code&gt;/craft/plugins/gareth/&lt;/code&gt; directory:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;GarethPlugin.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;templates/&lt;/code&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;GrWidget.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;widgets/&lt;/code&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Gareth_GrWidget.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;noreferrer&quot;&gt;Primary Plugin Class&lt;/a&gt;: &lt;code&gt;GarethPlugin.php&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Your primary plugin class defines all of the things that Craft needs&#xA;  to know about your plugin, such as the plugin’s name, version number,&#xA;  developer’s name and URL, and Global Settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class GarethPlugin extends BasePlugin&#xA;{&#xA;    function getName()&#xA;    {&#xA;         return Craft::t('Gareth');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;        return 'Gareth Redfern';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;        return 'http://garethredfern.com';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/widgets&quot; rel=&quot;noreferrer&quot;&gt;Widget Class&lt;/a&gt;: &lt;code&gt;Gareth_GrWidget.php&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This class defines the widget types name &lt;code&gt;getName()&lt;/code&gt; and its content &lt;code&gt;getBodyHtml()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Gareth_GrWidget extends BaseWidget&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Gr');&#xA;    }&#xA;&#xA;    public function getBodyHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('gareth/GrWidget');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates&quot; rel=&quot;noreferrer&quot;&gt;Widget Template&lt;/a&gt;: &lt;code&gt;GrWidget.html&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;This is just some text which will be shown inside the GrWidget.&#xA;&amp;lt;a href=&quot;{{ url('myaccount') }}&quot;&amp;gt;A link to my user profile&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4uuzT.jpg&quot; alt=&quot;How the example Widget will look like&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/widgets&quot; rel=&quot;noreferrer&quot;&gt;Widget documentation&lt;/a&gt;. Also take a look at Craft's default widgets which can be found in the &lt;code&gt;craft/app/widgets&lt;/code&gt; directory.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-20T14:42:40.820" LastActivityDate="2014-07-20T14:42:40.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1288" PostTypeId="2" ParentId="1283" CreationDate="2014-07-20T15:18:23.217" Score="6" Body="&lt;p&gt;Adding a new provider to OAuth plugin is a two step process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Create a new OAuth Provider in lusitanian/oauth&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing you will need to do is to add support for your new provider in &lt;a href=&quot;https://github.com/Lusitanian/PHPoAuthLib&quot;&gt;lusitanian/oauth OAuth PHP library&lt;/a&gt;. This library supports OAuth 1 &amp;amp; 2 authentication process and you can give a look at other providers to get started writing your own. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's usually just a matter of a smart copy paste from the code of another provider, by updating:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;scopes&lt;/li&gt;&#xA;&lt;li&gt;api URL&lt;/li&gt;&#xA;&lt;li&gt;authorize URL&lt;/li&gt;&#xA;&lt;li&gt;access token URL&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That said, you will sometimes have to adjust your code to support the web service's specificities. Read your web service's authentication docs carefully to understand who they implemented the OAuth authentication process and you'll be good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when your provider is ready, just perform a pull request on lusitanian/oauth OAuth PHP library on GitHub. We're pulling new providers on each Craft OAuth plugin release, so if you got your provider added to lusitanian's library, it will be automatically part of Craft OAuth plugin's next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, if you add your new provider in Craft OAuth plugin code, it won't do anything and the provider will not appear in OAuth settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Create an OAuth Provider Source in the OAuth plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The OAuth provider source class makes the link between between your lusitanian/oauth provider and Craft OAuth plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should name the file based on lusitanian/oauth's provider file name and save it under &lt;code&gt;oauth/providers&lt;/code&gt; folder. For example if your lusitanian/oauth provider file is named &lt;code&gt;Vimeo.php&lt;/code&gt;, you provider source file will be named &lt;code&gt;VimeoOAuthProviderSource.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This file contains basic informations like the web service's console url, its name, and a simple getAccount() method, and when you'll add it to the oauth/providers folder, your provider will start showing up in Craft CP / Plugin / OAuth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're ready with your OAuth provider source, perform a pull request on &lt;a href=&quot;https://github.com/dukt/craft-oauth&quot;&gt;Craft OAuth plugin on GitHub&lt;/a&gt; and your provider will be added to the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Checking that OAuth plugin is installed&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugin, you will have to check that OAuth is installed before using it in order to prevent errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your templates you can check that OAuth plugin is installed this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.oauth is not defined %}&#xA;&#xA;    {# OAuth plugin not installed #}&#xA;&#xA;{% else %}&#xA;&#xA;    {# OAuth installed #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your php files, you could do it that way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('oauth');&#xA;&#xA;if(!$plugin)&#xA;{&#xA;    // oauth is not installed&#xA;}&#xA;else&#xA;{&#xA;    // oauth is installed&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm working on a step by step guide on how to implement OAuth in Craft plugin. It's not ready yet but I'll probably start to share the draft in August.&lt;/p&gt;&#xA;" OwnerUserId="164" LastActivityDate="2014-07-20T15:18:23.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1289" PostTypeId="1" CreationDate="2014-07-20T20:07:21.210" Score="2" ViewCount="673" Body="&lt;p&gt;Let's say I have 4 entry types (Article, Video, Photo &amp;amp; Quote). What's the best way to list the latest 5 entries by each entry type?&lt;/p&gt;&#xA;" OwnerUserId="385" LastActivityDate="2014-07-20T21:40:15.450" Title="How to list the latest 5 entries per entry type?" Tags="&lt;entries&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1290" PostTypeId="1" AcceptedAnswerId="1292" CreationDate="2014-07-20T20:27:33.300" Score="6" ViewCount="1024" Body="&lt;p&gt;I have an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot;&gt;Entries field&lt;/a&gt; that I need to have as a drop-down field in my front-end form. The code below is displaying the correct options, although after selecting and submitting the form, the &lt;code&gt;tbdDesignerUrl&lt;/code&gt;-field is not populated with the selection in the entry.&lt;br&gt;&#xA;It shows as nothing selected. (&lt;code&gt;tbdDesignerUrl&lt;/code&gt; is the name of the Entires field I am trying to populate through the form and &lt;code&gt;entry.designerUrl&lt;/code&gt; is the field I am using to select the entry in the options.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('designers') %}&#xA;  &amp;lt;select name=&quot;fields[tbdDesignerUrl]&quot; id=&quot;fields[tbdDesignerUrl]&quot;&amp;gt;&#xA;    {% for entry in entries %}&#xA;     &amp;lt;option value=&quot;{{ entry.designerUrl }}&quot;&amp;gt;{{ entry.designerUrl }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help you can give! :)&lt;/p&gt;&#xA;" OwnerUserId="504" LastEditorUserId="177" LastEditDate="2014-07-20T21:16:18.323" LastActivityDate="2014-07-20T21:16:18.323" Title="How do I use a Dropdown 'Entries' Field Type in a Front End Form" Tags="&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1291" PostTypeId="1" AcceptedAnswerId="1295" CreationDate="2014-07-20T20:33:11.483" Score="9" ViewCount="3650" Body="&lt;p&gt;I have a custom section that uses routes like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/section/category/entry_url&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In trying to program the search form results I realized that I need to explicitly define the entry URL format for the section so that the search results return the proper links to view the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have &lt;code&gt;/section/{category.slug}/{slug}&lt;/code&gt; but it is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I set the entry URL format to include only the first category slug of the entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-07-21T00:35:22.693" Title="How would I include the first category slug in the section's entry URL format?" Tags="&lt;url&gt;&lt;search&gt;&lt;entrymodel&gt;&lt;slug&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1292" PostTypeId="2" ParentId="1290" CreationDate="2014-07-20T21:07:13.113" Score="8" Body="&lt;p&gt;Simply put, an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot;&gt;Entries field&lt;/a&gt; is an array containing entry ids, and your form needs to send it that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just replace &lt;code&gt;name=&quot;fields[tbdDesignerUrl]&quot;&lt;/code&gt; with &lt;code&gt;name=&quot;fields[tbdDesignerUrl][]&quot;&lt;/code&gt;. That way the &lt;a href=&quot;http://php.net/manual/en/faq.html.php#faq.html.arrays&quot;&gt;value gets submitted as an array&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also replace &lt;code&gt;value=&quot;{{ entry.designerUrl }}&quot;&lt;/code&gt; with &lt;code&gt;value=&quot;{{ entry.id }}&quot;&lt;/code&gt;, since we need the submitted value to be an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#id&quot;&gt;entry id&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-20T21:07:13.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1293" PostTypeId="2" ParentId="1289" CreationDate="2014-07-20T21:40:15.450" Score="8" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;craft.entries()&lt;/a&gt; fetches entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fetch the entries with a given entry type, you use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#type&quot;&gt;type&lt;/a&gt;. So to get the &lt;em&gt;Article&lt;/em&gt; entries, either &lt;code&gt;craft.entries.type('Article')&lt;/code&gt; or &lt;code&gt;craft.entries({type: 'Article'})&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fetch the latest 5, you want the entries &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot;&gt;sorted&lt;/a&gt; by postDate, descending (this is the default sort order), and then &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot;&gt;limit&lt;/a&gt; that to 5. Combining with the entry type, you have: &lt;code&gt;craft.entries.type('Article').limit(5)&lt;/code&gt; or &lt;code&gt;craft.entries({type: 'Article', limit: 5})&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you have four entry types, so might as well loop over those:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entryType in ['Article', 'Video', 'Photo', Quote] %}&#xA;  {% set latestFive = craft.entries({&#xA;    type: entryType,&#xA;    limit: 5&#xA;  }) %}&#xA;&#xA;  {% for oneEntry in latestFive %}&#xA;    {# list that entry #}&#xA;    {{ oneEntry.title}} is of type {{ entryType }}&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-20T21:40:15.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1294" PostTypeId="2" ParentId="1291" CreationDate="2014-07-20T22:36:29.023" Score="4" Body="&lt;p&gt;As I understand it,  you want the url for an entry to be &lt;code&gt;/section/category-slug/entry-slug&lt;/code&gt;. This is a little tricky, because if the entry has no category defined, it won't have a url, which is why you can't just set the &lt;em&gt;Entry URL Format&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to do this, you can do it using routes rather than the entry URL format. Uncheck the &lt;em&gt;Entries in this section have their own URLs&lt;/em&gt; box, and create a route for section/[slug]/[slug] that points to your entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the entry template, you can figure out the category and entry slugs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getSegment(2) %}&#xA;{% set entrySlug = craft.request.getSegment(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;get the category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.category.slug(categorySlug) %}&#xA;{% if not category %}{% exit 404 %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;get the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(entrySlug).relatedTo(category).first %}&#xA;{% if not entry %}{% exit 404 %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have the entry, proceed as usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you need the entry url, that will be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/section/{{ entry.category.first.slug }}/{{ entry.slug }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would write a macro for the entry url, and the macro can deal with the possibility of the entry having no category.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-20T22:36:29.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1295" PostTypeId="2" ParentId="1291" CreationDate="2014-07-21T00:35:22.693" Score="16" Body="&lt;p&gt;This got it working for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/section/{categoryFieldName.first.slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-07-21T00:35:22.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1296" PostTypeId="2" ParentId="1165" CreationDate="2014-07-21T08:34:35.453" Score="1" Body="&lt;p&gt;I found the problem. We use 'en' and 'gb' in the website's URLs (&lt;a href=&quot;http://website.dev/en/whatever&quot; rel=&quot;nofollow&quot;&gt;http://website.dev/en/whatever&lt;/a&gt; and &lt;a href=&quot;http://website.dev/cy/whatever&quot; rel=&quot;nofollow&quot;&gt;http://website.dev/cy/whatever&lt;/a&gt;), and I'd mis-understood what Craft was looking for in the /craft/config/general.php setting - I'd put the 'site_url' values as those two-character codes - that's wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, even though my URLs are en and cy, because the Locale values are actually en_gb and cy_gb, I needed to set the site_url array to those values (the URL has nothing to do with anything, which was what I'd mis-understood).&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-07-21T08:34:35.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1297" PostTypeId="1" CreationDate="2014-07-21T09:26:39.473" Score="1" ViewCount="78" Body="&lt;p&gt;Why do I sometimes receive the following message when I save a change made to a page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Call to a member function getAttributes() on a non-object&#xA;  in&#xA;  /nfs/c04/h06/mnt/181592/domains/imperfectinteriors.co.uk/craft/app/controllers/EntriesController.php&#xA;  on line 444&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Although it is an error message, the save is successful and the change is reflected in the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="177" LastEditDate="2014-07-21T12:38:27.843" LastActivityDate="2014-07-21T12:38:27.843" Title="Fatel error message when saving post/pages" Tags="&lt;error-message&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2014-07-21T18:39:30.710" ContentLicense="CC BY-SA 3.0" />
  <row Id="1298" PostTypeId="1" AcceptedAnswerId="1299" CreationDate="2014-07-21T13:38:16.507" Score="7" ViewCount="5464" Body="&lt;p&gt;I'm using this in the root of a structure to try and get the count of entries in another part of the structure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set count = craft.entries.section('hotelDetails').descendantOf('oakview-hotel').level(3).type('review').total() %}&#xA;        {{ count }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's including entries from other hotels, I hoped descendantOf('oakview-hotel') would restrict the count to only oakview-hotel. When I replace escendantOf('oakview-hotel') with descendantOf(17) 17 being the ID oakview-hotel the count is restricted to oakview-hotel and the entry count is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ca anyone please telly me why descendantOf('oakview-hotel') isn't working for me or suggest a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2014-07-21T16:10:10.413" Title="How can I get the count of entries in a structure?" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1299" PostTypeId="2" ParentId="1298" CreationDate="2014-07-21T13:46:45.500" Score="10" Body="&lt;p&gt;There may be a better option, but off the top of my head, you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countParent = craft.entries.slug('oakview-hotel').first() %}&#xA;{% set count = craft.entries.section('hotelDetails').descendantOf(countParent).level(3).type('review').total() %}&#xA;        {{ count }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-07-21T13:46:45.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1300" PostTypeId="2" ParentId="1298" CreationDate="2014-07-21T16:10:10.413" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#descendantOf&quot; rel=&quot;nofollow&quot;&gt;descendantOf&lt;/a&gt; accepts either an EntryModel object or an entry’s ID. And you are passing it a string that isn't the id, so that's why it isn't working&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-21T16:10:10.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1301" PostTypeId="1" CreationDate="2014-07-21T16:57:45.647" Score="4" ViewCount="650" Body="&lt;p&gt;Is there a way to prevent the current user from changing fields in his profile? Currently i've attached a customfield &quot;company&quot; to the user object. I only want the site admin to set this field once and the only one allowed to change this. Where can I inject/override/overload the behavior of the saveUser method? Or is there a way to allow a different validation function or to disable a certain customfield during edit/save?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.... ﻿&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-12-29T16:57:26.923" Title="Prevent change field in user profile edit" Tags="&lt;user-profile&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1302" PostTypeId="1" AcceptedAnswerId="1303" CreationDate="2014-07-21T18:29:53.877" Score="11" ViewCount="2118" Body="&lt;p&gt;If I have a section called 'blog', and its handle is 'blog', and it's a Channel, all of the entries appear under &lt;a href=&quot;http://mysite.com/blog/&quot;&gt;http://mysite.com/blog/&lt;/a&gt;{slug} - which is great; but how would I create a page at mysite.dev/blog which is editable in the CMS, with its own fields? I'd like to do this so I can have a CMS editable introduction to the blog section, rather than having to hard-code an introduction into the template that would then list the latest X blog posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't create a Single called 'blog' because that handle is already taken by the Section itself, so how would I go about this? I'd considered using a Global, but that seems a bit off (it's not global content, it's a singular page's content) not to mention repetative/non-DRY if I had multiple sections to do similar things with, or if there were multiple fields I wanted applying on the overview/landing page. Is there a neater solution?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="328" LastEditDate="2014-07-28T16:54:58.927" LastActivityDate="2014-07-28T16:54:58.927" Title="How to create a CMS editable channel section index page?" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1303" PostTypeId="2" ParentId="1302" CreationDate="2014-07-21T18:38:14.117" Score="13" Body="&lt;p&gt;Create a Single called &quot;Blog Overview&quot; and set its URI to &quot;blog&quot; and its &quot;Entry Template&quot; to &quot;blog/index&quot; (your blog listing template).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then just override the title to &quot;Blog&quot; either by hard coding it in the index template, using an &quot;title override&quot; field, not showing its title etc.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-21T18:38:14.117" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1305" PostTypeId="2" ParentId="1301" CreationDate="2014-07-21T19:25:45.783" Score="3" Body="&lt;p&gt;There isn't anything to do this out-of-the-box in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the proper way you'd want to approach it would be to write a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that has it's own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;field type&lt;/a&gt; that takes into account user permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An admin would get a normal text input, for example, and any other user would just see read-only text.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-21T19:25:45.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1306" PostTypeId="2" ParentId="1094" CreationDate="2014-07-21T19:59:07.667" Score="3" Body="&lt;p&gt;For running Craft from the console you just need to copy all the content of /directory/toCraft/app/index.php to another file, called what you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comment the last instruction &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and finally add this instructions in the beginning of the file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_SERVER['DOCUMENT_ROOT']   = '/some/path/to/craft.dev';&#xA;$_SERVER['HTTP_HOST']       = 'craft.dev';&#xA;$_SERVER['HTTPS']           = 'off';&#xA;$_SERVER['PHP_SELF']        = '/index.php';&#xA;$_SERVER['REQUEST_URI']     = '/index.php';&#xA;$_SERVER['SERVER_PORT']     = 80;&#xA;$_SERVER['SCRIPT_FILENAME'] = '/some/path/to/craft.dev/index.php';&#xA;$_SERVER['SCRIPT_NAME']     = '/index.php';&#xA;&#xA;$_SERVER['HTTP_USER_AGENT']     = 'Super User Agent';&#xA;$_SERVER['REMOTE_ADDR']     = 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this doesn't do nothing especial, just emulate a connection&lt;/p&gt;&#xA;" OwnerUserId="523" LastActivityDate="2014-07-21T19:59:07.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1307" PostTypeId="1" AcceptedAnswerId="1309" CreationDate="2014-07-21T20:26:41.737" Score="3" ViewCount="200" Body="&lt;p&gt;I have a problem when trying to put a div into a content of an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm creating entries, building a HTML hierarchy that helps me to manipulate the content with JS. I'm adding divs an build something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;cont1&quot; class=&quot;content&quot; &amp;gt;&#xA;  &amp;lt;h3&amp;gt;Hi I am a title&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;p&amp;gt;this is the introduction &amp;lt;/p&amp;gt;&#xA;  &amp;lt;p&amp;gt;this is the content&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I create this, the hierarchy is right, but when I edit it from the CP, all the divs change to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p id=&quot;cont1&quot; class=&quot;content&quot; &amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;h3&amp;gt;Hi I am a title&amp;lt;/h3&amp;gt;&#xA;&amp;lt;p&amp;gt;this is the introduction &amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;this is the content&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What can I do to prevent this from happening? Hope you can help me, thanks.&lt;/p&gt;&#xA;" OwnerUserId="523" LastEditorUserId="50" LastEditDate="2014-07-21T20:52:15.000" LastActivityDate="2014-07-21T22:16:04.030" Title="Div into the content of an Entry" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1308" PostTypeId="1" CreationDate="2014-07-21T20:29:01.650" Score="7" ViewCount="2547" Body="&lt;p&gt;I'd like to manage my users (both active site users, and other employees at my client's company) via the Craft user management. I've added more profile fields, etc. But i'm wondering, is there a built in public profile page/route for users?  I'm listing various users on a page, and i'd like their profile image to link to a profile page for each of them, with more info, contact info etc. What's the best way to do this?  &lt;/p&gt;&#xA;" OwnerUserId="412" LastActivityDate="2015-07-20T20:01:22.897" Title="User profile public page" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1309" PostTypeId="2" ParentId="1307" CreationDate="2014-07-21T22:16:04.030" Score="6" Body="&lt;p&gt;Assuming you are using the Rich Text field, you'll want to look at the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/#set-convertDivs&quot;&gt;Redactor setting&lt;/a&gt;, &lt;code&gt;convertDivs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;convertDivs &lt;strong&gt;(Default setting is true)&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;With this option turned on, Redactor will automatically replace divs to paragraphs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Go in to your field settings:&#xA;Craft Admin &amp;rsaquo; Settings &amp;rsaquo; Fields &amp;rsaquo; &lt;strong&gt;Rich Text field name&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the config settings to determine which config file you are using. Then, go in to your &lt;code&gt;craft/config/redactor/ConfigFile.json&lt;/code&gt; file and edit your redactor settings to exclude the &lt;code&gt;convertDivs&lt;/code&gt; setting (assuming nothing else in your config file):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    convertDivs: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-21T22:16:04.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1310" PostTypeId="2" ParentId="1308" CreationDate="2014-07-22T04:05:06.113" Score="7" Body="&lt;p&gt;If you simply need a public profile page, you can build that easy enough.  Simply pass in some user identifier through the URI &lt;code&gt;/profile/username&lt;/code&gt; or &lt;code&gt;/profile/userId&lt;/code&gt; will do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userId = craft.request.getSegment(2) %}&#xA;{% set user = craft.users.id(userId).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;user&lt;/code&gt; is a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; and you can access any of those properties of it as well as any custom fields you've assigned to users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you can create templates on the front-end for user management.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This includes &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;public registration&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;editing user profiles&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/forgot-password-form&quot; rel=&quot;nofollow&quot;&gt;password&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/set-password-form&quot; rel=&quot;nofollow&quot;&gt;reseting&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;logging in&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-07-20T20:01:22.897" LastActivityDate="2015-07-20T20:01:22.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1311" PostTypeId="1" AcceptedAnswerId="1316" CreationDate="2014-07-22T04:09:25.630" Score="4" ViewCount="1051" Body="&lt;p&gt;I'm building a site that regroups several properties, and I'd like each manager to edit content in his property only. All properties use the same templates and share content between each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first tried to create a new section for each property, but it occurs to me that it would be much simpler to have a &quot;room&quot; and &quot;facilities&quot; section (and templates), and then divide everything using categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However at the moment user permissions only allow a user to add any category to their entries, which could lead to mistakes if users are not careful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be possible to limit users to a single category, so that user1 can only edit entries in category1 and user2 in category2? Any tips on how to approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2018-05-29T02:34:35.093" Title="Is it possible to limit users to adding/editing entries in specific categories?" Tags="&lt;users&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1312" PostTypeId="1" AcceptedAnswerId="1314" CreationDate="2014-07-22T07:00:05.903" Score="4" ViewCount="532" Body="&lt;p&gt;I'm building a rough JSON API using normal Craft templates (i.e. rendering the JSON with Twig) but would like to be able to return HTTP 403 to unauthenticated requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not user %}&#xA;    {% respond 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is something like this built in?&lt;/p&gt;&#xA;" OwnerUserId="577" LastActivityDate="2014-07-22T15:48:19.233" Title="How can I return HTTP 403 from a template?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1313" PostTypeId="2" ParentId="1312" CreationDate="2014-07-22T08:34:57.180" Score="1" Body="&lt;p&gt;Bit of a shot in the dark here, but it might be worth having a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/header&quot; rel=&quot;nofollow&quot;&gt;header tag&lt;/a&gt;, see if you can get that to do what you need...&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-07-22T08:34:57.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1314" PostTypeId="2" ParentId="1312" CreationDate="2014-07-22T09:52:13.197" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/exit&quot; rel=&quot;noreferrer&quot;&gt;Exit tag&lt;/a&gt; is what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% exit 403 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastEditorUserId="45" LastEditDate="2014-07-22T15:48:19.233" LastActivityDate="2014-07-22T15:48:19.233" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1315" PostTypeId="1" AcceptedAnswerId="1317" CreationDate="2014-07-22T11:32:02.747" Score="3" ViewCount="802" Body="&lt;p&gt;Related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1197/how-do-i-change-a-users-password-programmatically-in-a-plugin&quot;&gt;this question&lt;/a&gt; - with one difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set a hashed password for a user? I'm able to save the user just fine - but when I pass the already hashed password like &lt;code&gt;$user-&amp;gt;password&lt;/code&gt; it doesn't set the password. I'm not seeing anything within &lt;code&gt;$user-&amp;gt;getErrors()&lt;/code&gt;, it's just a blank array. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="465" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-22T11:57:53.953" Title="Is it possible to set a hashed password programatically for a user?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1316" PostTypeId="2" ParentId="1311" CreationDate="2014-07-22T11:32:07.020" Score="4" Body="&lt;p&gt;Entry permissions are sort of an all or nothing thing. If they can publish entries, they can publish all entries or just their own entries. The tricky part of this kind of permission is that Craft doesn't know if a category field will be on a particular entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible way to make this work is to create a custom plugin that fires the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; event, and checks each user's category access with the entry's categories. Granted, you run into the issue of them being able to remove the category to remove any problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second option is to give them a special front-end portal area that will let them edit entries, and let you filter those entries to what they can edit. You will also then be able to omit fields that you don't want them to edit (including the categories that prohibit their access).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-22T11:32:07.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1317" PostTypeId="2" ParentId="1315" CreationDate="2014-07-22T11:57:53.953" Score="4" Body="&lt;p&gt;There’s no API for it; you would need to save it to the database directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If any of the passwords are known to you, you should probably start by manually pasting that hashed password into your account’s password column, and verify that it’s actually going to work. Even if the old site was also using mcrypt, it’s still pretty unlikely that they get hashed the &lt;em&gt;exact&lt;/em&gt; same way (different salts, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it doesn’t work out, and you really don’t want to require everyone to reset their passwords, you could save all of your hashed passwords in a separate table, and write your own &quot;login&quot; controller action using a plugin. That controller action could:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;grab the user by their given username/email&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$loginName = craft()-&amp;gt;request-&amp;gt;getPost('loginName');&#xA;$user = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($loginName);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;see if that user has a row in your old hashed passwords table&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if so, fetch their password from post...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$password = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;hash that password using the old site’s exact hashing method&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;if the hashed password matches the one in the table...&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;save the posted password on the user account&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;newPassword = $password;&#xA;craft()-&amp;gt;users-&amp;gt;changePassword($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;delete the user’s row in the old hashed passwords table (so we're only doing this once per user)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;log the user in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;login($loginName, $password);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(See craft/app/controllers/UsersController.php - actionLogin() for a full code example of &lt;code&gt;login()&lt;/code&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-22T11:57:53.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1318" PostTypeId="1" AcceptedAnswerId="1322" CreationDate="2014-07-22T12:49:05.690" Score="16" ViewCount="2415" Body="&lt;p&gt;I've currently setup a matrix-field for adresses. I added the field as required field to my user-group &quot;Customer&quot;. Which breaks the registration, as a user can only be registered, when the matrix has at last one entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What im missing now is the possibility to add the specific input elements for one single address-block (or matrix entry) so the user has to add at last one address at registration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When logged in and viewing the profile, the user should also be able to manage  his matrix entries, so managing multiple addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any documentation on how to get the backend-matrix-editor into the frontend? Can anyone link me an example without copying the whole backend stuff into the frontend?&lt;/p&gt;&#xA;" OwnerUserId="578" LastActivityDate="2017-01-27T06:52:39.387" Title="How to get matrix editor into frontend?" Tags="&lt;matrix&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1319" PostTypeId="1" AcceptedAnswerId="1321" CreationDate="2014-07-22T15:18:22.277" Score="2" ViewCount="1158" Body="&lt;p&gt;Here is the code I am trying to use to set an active state for category navigation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for category in categories %}&#xA;        &amp;lt;li {% if craft.request.segment(2) == &quot;{{ category.slug }}&quot; %}class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that the conditional can't check against the category.slug output. Is this the case? What would be a better approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-02-20T15:34:18.850" Title="How do I conditionally set active state in category navigation?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;conditional&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1320" PostTypeId="1" AcceptedAnswerId="1331" CreationDate="2014-07-22T15:27:01.373" Score="2" ViewCount="229" Body="&lt;p&gt;I'm building a multi-lingual site (english and spanish) and I have a news section with entries that have a &quot;tags&quot; field attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've marked this field as &quot;translatable&quot; in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, when I've added a tag to an entry, double clicking it reveals the pop-up field editor where I can switch between locales as expected (see screenshot). But I can't enter different values for &quot;Name&quot; in each locale. It behaves like a  non-translatable field where changing the value in one locale changes it for all the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ScyQ4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting my &quot;tags&quot; field as translatable in the CP seems to allow me to assign different tags to the entry for each locale, but that's not what I want. What I want is to have an entry's tags persist across locales, but be translated into their appropriate language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the default &quot;Name&quot; field for tags translatable? How should I be setting this up to get the behavior I want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help.&lt;/p&gt;&#xA;" OwnerUserId="579" LastEditorUserId="579" LastEditDate="2014-07-22T17:50:21.120" LastActivityDate="2014-07-22T19:31:29.107" Title="Problems translating the default &quot;Name&quot; field on tags" Tags="&lt;localization&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1321" PostTypeId="2" ParentId="1319" CreationDate="2014-07-22T15:31:20.250" Score="2" Body="&lt;p&gt;You don't need the quotes or braces in twig tags to reference variables.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;    &amp;lt;li {% if craft.request.segment(2) == category.slug %}class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use ternary operators:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;    &amp;lt;li {{ craft.request.segment(2) == category.slug ? 'class=&quot;active&quot;' : &quot;&quot; }}&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-22T15:31:20.250" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1322" PostTypeId="2" ParentId="1318" CreationDate="2014-07-22T15:32:49.360" Score="17" Body="&lt;p&gt;Getting a Matrix field working on the front-end is going to require 2 things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setting up the field inputs so the data submits correctly.&lt;/li&gt;&#xA;&lt;li&gt;Some custom JavaScript to make the blocks repeat and behave how you want them to.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's an example of the Matrix input code you'll need on the front-end.  You'll need to update all of the field handle values to fit your situation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# You need to include the 'type' input to identify the matrix block type you are submitting. #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contact][new1][type]&quot; value=&quot;contacts&quot;&amp;gt;&#xA;&#xA;{# You should include the 'enabled' input to specify whether the block should be enabled. #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contact][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;{# All of your custom fields must be within a 'fields' array. #}&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new1][fields][contactName]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new1][fields][contactEmail]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new1][fields][contactPhone]&quot;&amp;gt;&#xA;&#xA;{# For new blocks, you'll want to use the naming convention 'new1', 'new2', 'new3' for each of your blocks. For existing blocks, you can update those values to be the block IDs. #}&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new2][fields][contactName]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new2][fields][contactEmail]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contact][new2][fields][contactPhone]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the JavaScript, I won't give an example here, but you'll want to create a way for users to create new blocks, update the ID value appropriately using the &lt;code&gt;new1&lt;/code&gt; convention for new entries and the actual IDs for entries that are being edited.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="45" LastEditDate="2017-01-27T06:52:39.387" LastActivityDate="2017-01-27T06:52:39.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1323" PostTypeId="1" CreationDate="2014-07-22T15:41:53.177" Score="4" ViewCount="1417" Body="&lt;p&gt;Getting the following when just querying the database for all records in a section (channel). There are about 75 entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting the PHP Fatal error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why would i be running out of 32MB for these pretty simple entries? The channel entry type just has a title, body, image URL, text field, and a field referencing another channel entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the SortByField plugin. Wonder if that's causing any issues. Here's my query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('people').find()|sortByField('lastName', 'asc') %}&#xA;     // ... outputting names of people, etc.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="412" LastEditorUserId="45" LastEditDate="2014-07-23T01:05:27.177" LastActivityDate="2014-07-23T13:47:08.370" Title="PHP Fatal error: Allowed memory size of X bytes exhausted" Tags="&lt;database&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1324" PostTypeId="2" ParentId="1323" CreationDate="2014-07-22T16:13:04.307" Score="7" Body="&lt;p&gt;Craft will run out-of-the-box with 32M of memory, no problem.  However, memory consumption will start to increase depending on several factors including:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The complexity of your site, including the number of fields, sections (and types of sections), categories, tags, users, entries, plugins in use (and how efficient they are working), etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More importantly, how your front-end templates are coded and how they are pulling in all of this data in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also worth noting that 32M is usually the default on older PHP installs (or really stingy newer hosts) and the latest PHP releases ship with &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot;&gt;something more reasonable&lt;/a&gt;, like 128M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot;&gt;devMode&lt;/a&gt;, you can view memory profiling information in your browser's console to help you see where the memory is being distributed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-22T16:13:04.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1325" PostTypeId="1" CreationDate="2014-07-22T16:19:24.367" Score="4" ViewCount="327" Body="&#xA;&#xA;&lt;p&gt;I'm creating a HTTP RESTful API plugin for Craft. In this case, I'm trying to return Elements (based on criteria), and include their content (via &lt;code&gt;$element-&amp;gt;getContent()&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, if I return just the Elements collection returned by &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria($type)-&amp;gt;find()&lt;/code&gt;, the content is not included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also running each Element through a Transformer which uses &lt;code&gt;ModelHelper::packageAttributeValue($value)&lt;/code&gt;, and converts attributes to their proper PHP type using attribute configs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure the best way to go about including content in my responses dynamically. Suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just found out that &lt;code&gt;$element-&amp;gt;getContent()&lt;/code&gt; returns fields that aren't even associated with that particular element. Weird. Anybody know anything about this? I've instead resorted to using:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$fields = array_map(function (FieldLayoutFieldModel $model) {&#xA;    return $model-&amp;gt;getField();&#xA;}, $element-&amp;gt;getFieldLayout()-&amp;gt;getFields());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what's best here.&lt;/p&gt;&#xA;" OwnerUserId="238" LastEditorUserId="238" LastEditDate="2014-07-22T19:19:02.163" LastActivityDate="2014-07-22T19:19:02.163" Title="What is the best way to include an Element's content?" Tags="&lt;plugins&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1326" PostTypeId="2" ParentId="1308" CreationDate="2014-07-22T16:30:15.213" Score="16" Body="&lt;p&gt;You will need to add a &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot;&gt;custom route&lt;/a&gt; for the path for which you want to show the profile from a list of all users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per my example of &lt;code&gt;/profile/{{ username }}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;profile/index&lt;/code&gt; template, you would run a loop on the user set of your choice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users %}&#xA;{% for user in users %}&#xA;    &amp;lt;a href=&quot;/profile/{{ user }}&quot;&amp;gt;{{ user }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Craft Admin › Settings › &lt;strong&gt;Routes&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;New Route&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;If the URI looks like this: &lt;code&gt;profile/*&lt;/code&gt; (Use the &lt;code&gt;*&lt;/code&gt; token provided)&lt;/li&gt;&#xA;&lt;li&gt;Load this template: &lt;code&gt;profile/_profile&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then, in your &lt;code&gt;profile/_profile&lt;/code&gt; template, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.username( craft.request.segment(2) ).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once &lt;code&gt;user&lt;/code&gt; is defined, you can use the &lt;a href=&quot;http://straightupcraft.com/articles/cheat-sheet-craft.users&quot;&gt;UserModel&lt;/a&gt; to return any data from that user (i.e. &lt;code&gt;{{ user.email }}&lt;/code&gt; ).&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-07-22T16:30:15.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1327" PostTypeId="1" AcceptedAnswerId="1328" CreationDate="2014-07-22T18:35:42.443" Score="5" ViewCount="587" Body="&lt;p&gt;I a trying to display a simple event listing. I set up a custom date field called eventDate to note when the event happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code delivers me the list of events sorted by eventDate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for event in craft.entries.find({section: 'events', order: 'eventDate'}) %}&#xA;    &amp;lt;a class=&quot;eventSummary&quot; href=&quot;{{ event.url }}&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;date&quot;&amp;gt;{{ event.eventDate }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span class=&quot;eventTitle&quot;&amp;gt;{{ event.title }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to omit events whose eventDate falls before the current date/time. If it were an entry date I guess I'd just use &quot;after&quot;, but I am not sure how to apply that to a custom date field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2014-07-22T19:21:09.957" Title="How can I limit a list based on a custom date field" Tags="&lt;date&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1328" PostTypeId="2" ParentId="1327" CreationDate="2014-07-22T19:03:10.033" Score="7" Body="&lt;p&gt;I think &lt;code&gt;.after&lt;/code&gt; would work, but I've used this way:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('events').limit(null) %}&#xA;&#xA;{% for entry in entries.eventDate('&amp;gt;=' ~ (now.date)).order('eventDate DESC') %}&#xA;    {# Show entry #}  &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-07-22T19:03:10.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1329" PostTypeId="2" ParentId="1325" CreationDate="2014-07-22T19:17:21.550" Score="4" Body="&#xA;&#xA;&lt;p&gt;I've determined what I think to be the best way to dynamically add Element's field content values to my responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, the reason why field content values are being returned using &lt;code&gt;$element-&amp;gt;getContent()&lt;/code&gt; regardless of the Element relationship with the fields, is because the content table has field values as columns themselves. So when a Content model is populated, all fields are included. If I setup a field for an Entry, it will appear as a field for a User when using this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entries = array();&#xA;&#xA;$results = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;find();&#xA;&#xA;foreach ($results as $model) {&#xA;    $entry = array();&#xA;&#xA;    $attributes = $model-&amp;gt;getAttributes();&#xA;&#xA;    foreach ($attributes as $name =&amp;gt; $value) {&#xA;        $entry[$name] = $value; // Do some transformation here (type casting, etc.)&#xA;    }&#xA;&#xA;    $content = $model-&amp;gt;getContent(); // No extra DB queries here - Model is already populated with content values&#xA;&#xA;    $fields = array_map(function (FieldLayoutFieldModel $model) {&#xA;        return $model-&amp;gt;getField();&#xA;    }, $model-&amp;gt;getFieldLayout()-&amp;gt;getFields());&#xA;&#xA;    foreach ($fields as $field) {&#xA;        $entry[$field-&amp;gt;handle] = $content-&amp;gt;{$field-&amp;gt;handle};&#xA;    }&#xA;&#xA;    $entries[] = $entry;&#xA;}&#xA;&#xA;return $this-&amp;gt;returnJson(array(&#xA;    'entries' =&amp;gt; $entries,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my particular development, I've separated a lot of the above logic into services, which I'm using like Transformers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This helps me deliver field content values through my API. I spent hours pouring through source code, and I'm pretty confident this is the best solution based on efficiency, best practices, and similarity with logic concepts found throughout built-in services and models. Let me know what you guys think.&lt;/p&gt;&#xA;" OwnerUserId="238" LastActivityDate="2014-07-22T19:17:21.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1330" PostTypeId="2" ParentId="1327" CreationDate="2014-07-22T19:21:09.957" Score="10" Body="&lt;p&gt;Actually you should be able to specify your custom field as part of the chained element criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentAndFutureEvents = craft.entries.section('events').eventDate('&amp;gt;= ' ~ now).order('eventDate DESC') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://plus.google.com/111247306448293182882/posts/Uu6ZuTH1NBu&quot;&gt;https://plus.google.com/111247306448293182882/posts/Uu6ZuTH1NBu&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="168" LastActivityDate="2014-07-22T19:21:09.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1331" PostTypeId="2" ParentId="1320" CreationDate="2014-07-22T19:31:29.107" Score="2" Body="&lt;p&gt;I can confirm this is indeed the case (as of  2.1.2564). I don't know if it's intended behaviour or a bug, but I would wager the former.  I seem to recall somewhere learning that P&amp;amp;T made an explicit decision to not have tag Names be translatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround you could consider a tag custom field with a &quot;translatable label&quot; that you fill in for each language? Seems a bit lame. I'd probably opt for simply making the field itself translatable, and then binding separate tags for each language.&lt;/p&gt;&#xA;" OwnerUserId="168" LastActivityDate="2014-07-22T19:31:29.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1332" PostTypeId="1" AcceptedAnswerId="1371" CreationDate="2014-07-22T20:09:34.300" Score="3" ViewCount="1108" Body="&lt;p&gt;I have a Matrix field with four blocks currently, a header (text), explanation (rich text), slideshow (assets), and single image (assets). Both the slideshow and single image blocks have two fields, image and caption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image field is the same in both with the exception of the slideshow assets field allows multiple images to be uploaded while the single is obviously limited to one. Both have &quot;Restrict uploads to a single folder?&quot; and &quot;Restrict allowed file types?&quot; checked and the latter only allows images. Both also have the same Asset Location selected and {owner.slug} as the path. Recently I discovered that I can no longer upload images to {owner.slug}, instead Craft is trying to upload images to /craft/storage/runtime/assets/tempuploads/field_##.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked file permissions for my assets directory and there shouldn't be a problem writing to it. I used to be able to create subfolders based on the entry slug and what's even more bizarre is that I can edit an existing single image or slideshow block image field and it will use/upload to the proper directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why it would stop doing this?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-07-24T14:49:39.543" Title="Having problems with dynamic Asset folders and {owner.slug}" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1333" PostTypeId="2" ParentId="1240" CreationDate="2014-07-23T01:46:51.570" Score="4" Body="&lt;p&gt;When saving data to a Table field, here's the catch... Your field data is being condensed into &lt;strong&gt;JSON&lt;/strong&gt; and stored in a &lt;strong&gt;single database table cell&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So ultimately, you'll want to have your Table field data arranged in an array, then use &lt;code&gt;json_encode&lt;/code&gt; to prep it for entry into the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of data for a Table field... This is a hypothetical field containing products, with a &lt;em&gt;Product Name&lt;/em&gt; and prices for &lt;em&gt;Small&lt;/em&gt;, &lt;em&gt;Medium&lt;/em&gt;, and &lt;em&gt;Large&lt;/em&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;col1&quot;: &quot;Product #1&quot;,&#xA;    &quot;col2&quot;: &quot;5&quot;,&#xA;    &quot;col3&quot;: &quot;10&quot;,&#xA;    &quot;col4&quot;: &quot;15&quot;&#xA;  },&#xA;  {&#xA;    &quot;col1&quot;: &quot;Product #2&quot;,&#xA;    &quot;col2&quot;: &quot;7&quot;,&#xA;    &quot;col3&quot;: &quot;14&quot;,&#xA;    &quot;col4&quot;: &quot;21&quot;&#xA;  },&#xA;  {&#xA;    &quot;col1&quot;: &quot;Product #3&quot;,&#xA;    &quot;col2&quot;: &quot;7&quot;,&#xA;    &quot;col3&quot;: &quot;14&quot;,&#xA;    &quot;col4&quot;: &quot;21&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;An important note...&lt;/strong&gt; The column names you established when setting up your Table field are not relevant here. Instead, each columnn will be referred to as &quot;col1&quot;, &quot;col2&quot;, &quot;col3&quot;, etc.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-23T01:46:51.570" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1334" PostTypeId="1" AcceptedAnswerId="1335" CreationDate="2014-07-23T05:10:20.860" Score="5" ViewCount="1504" Body="&lt;p&gt;This is the host-installed version of CloudFlare/Railgun as offered very successfully at Arcustech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The arrangement is different from Railgun offered with the $200/month CloudFlare Business plan. It is free, and it takes a different approach to configuring the connection between your site and Railgun's high-speed server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The configuration needs to operate properly with Locale multilingual features, and with SSL coverage for Craft CP admin and Stripe e-commerce pages.&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2016-01-24T02:53:51.503" Title="What's the configuration to enable Craft for free CloudFlare and Railgun?" Tags="&lt;server&gt;&lt;cloudflare&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1335" PostTypeId="2" ParentId="1334" CreationDate="2014-07-23T05:13:45.797" Score="10" Body="&lt;p&gt;I'm going to answer this one, to share information on how I just did it. One issue will remain, but that will be raised in a separate question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing is to understand the URL layout which CloudFlare/Railgun will require. You or your hoster will create A records in DNS for all but one of these, each of them pointing to your server IP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an order in which these records should be created, which your hoster will specify, in order to check all is well before aetting the CloudFlare service to be fully active for visitors to your site. &lt;em&gt;So don't just go ahead from this list!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your main site, which will remain un-accelerated, but is a necessary DNS reference, and fallback if you disconnect CloudFlare. We'll call that domain.com.&lt;/li&gt;&#xA;&lt;li&gt;The access subdomain, where CloudFlare/Railgun retrieves content from your site in order to accelerate it. This will be cloudflare-source.domain.com, or similar if your hoster differs.&lt;/li&gt;&#xA;&lt;li&gt;if you're going to need SSL (https) to protect your Craft CP admin, you'll need a non-CloudFlare url to allow this, unless you're using one of the non-free versions of CloudFlare which allow SSL. Let's call this secure.domain.com. &lt;/li&gt;&#xA;&lt;li&gt;Notice that secure.domain.com on https/SSL can also be what you'd use to shelter e-commerce pages, but be very careful here. Unless you want to be required to go through a process of certifying PCI compliance, you'll want to use an actually self-safe e-commerce solution like Stripe.js, which handles customer and credit card data so that they are never sent to your server. The secure page set up here just adds security against mistakes, and helps build customer confidence by showing visibly that everything is protected by SSL.&lt;/li&gt;&#xA;&lt;li&gt;Any other subdomains such as a staging server will need to be on the same domain DNS record set, and also controlled by your server's virtual hosting config to arrive at the proper html folders on your site.&lt;/li&gt;&#xA;&lt;li&gt;Finally, and as mentioned, only after all the CloudFlare arrangements have been verified operating as your hoster show you to do, then a final DNS record will be added, by you or them depending on who's managing DNS. This will be a CNAME record aliasing www.domain.com, and it will point not to your site, but to the CloudFlare URL you'll be given, something like www.domain.com.xyz.cloudflare.net.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Ok. Notice that the CNAME alias is from www.domain.com. Your hoster will give you a set of prefix rules to go in your public Craft directory's .htaccess file, above the handling which calls Craft itself. If you have special rules there to cause automatic switching to SSL for the Craft CP, a small portion of those will need to go before the CloudFlare additions. I'll cover that in another question/answer on automatic SSL itself, updating an earlier post to one of the cookbooks, and as setup has slightly changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of the DNS and .htaccess additions is that your site will now always redirect visitors to www.domain.com even if they originally linked simply domain.com. As you can see, www.domain.com is aliased by the CNAME record to call CloudFlare rather than your site directly, and that's how the speed-up caching is applied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Railgun will also operate on this URL once you turn it on from your CloudFlare control panel, the one which will have been set up for you by your hosting provider. You want to let them do that, as it is different and differently connected than one which would result from you signing up to CloudFlare independently, thus enabling your hoster's service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can see why the extra cloudflare-source DNS access is needed. Your main site will refer to www.domain.com, which comes from CloudFlare. CloudFlare must then get its picture of your site from somewhere else, and cloudflare-source.domain.com is that place.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now that we have CloudFlare arranged via DNS and .htaccess, what do you need to do in Craft configuration to properly use it? As it turns out, not very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to refer Craft to the now-required www.domain.com wherever it needs reference to your site, rather than domain.com. In particular, the constant siteUrl needs to be set this way You can do that in the CP General configuration page, and/or as a definition in general.php. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus if you are not using languages (Locale on Craft Pro), in general.php you would set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; 'http://www.domain.com/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while if you are using languages you would in general.php set the siteUrl array by the same principle, according to the languages on your site. This example is for English, Russian, and Swedish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://www.domain.com/en/',&#xA;    'ru' =&amp;gt; 'http://www.domain.com/ru/',&#xA;    'sv' =&amp;gt; 'http://www.domain.com/sv/',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Several such arrays can be used individually as ever within a multi-site configuration, covering staging servers and so forth if you use that method. With or without multisite, if you've set your staging server as its own subdomain, then that will automatically bypass CloudFlare/Railgun for staging, which is very likely what you'd prefer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, if you are using Craft Pro languages (Locale), you'll need to copy the fully equipped main site .htaccess to each of the language folders on the html site, so that they will respond appropriately. Not an option, and one of those fun ways to go wrong with languages, which when set up properly, are on Craft very easy and practical to work with.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How much improvement do you gain, from setting this up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be quite dramatic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On initial Pingdom testing and a site of not quite medium complexity, I'm seeing &gt;5x improvement monitored in the US: from 2.5 seconds to 0.3 seconds for full all-images page loads, that important first customer access to your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going overseas, CloudFlare is making practical a European customer's site from a single server base at Arcustech in the US. The same ordinary first-load pages go from 3 seconds to under 0.5 seconds. A difficult page with video players on it goes from around &lt;em&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;/em&gt; seconds to around 1.7 seconds complete, both of these in Amsterdam from Minneapolis servers. The delay on the slow page is due to the video player background loading of libraries, so the screen view comes up more rapidly, but you can see it would be unusable without CloudFlare.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the CloudFlare-amplified service is as if it was local in Amsterdam. Across Europe one can see via Pingdom that not all areas will be as fast, but with the distribution of CloudFlare edge  servers, all will be practical; 1-second pages say instead of half-second, and a little more for the video page, but by use of player-assisted 'poster' images it comes up visually much more quickly than it completes, so a few seconds will be fine there also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These figures are assuming the caches are full at the edge servers. The very first access will be slower, if helped by CloudFlare's excellent connections, as always with a cache. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How much Railgun adds, for which we take this special configuration's effort, has to be complex. If you are running CNN-sized pages, it will measurably help a lot, as big boys and girls are using it, as well as other edge caches with similar (and very expensive) features. If you are running small pages, most of the time it will not be so visible. In between, in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I suspect Railgun is likely to speed up first-viewer-on-empty-edge-cache page speed also, due to its keepalive single connection and compressed, high-availability path. Similarly, it should help unexpectedly more than usual whenever there is network congestion and extended latency, which as anyone who uses or monitors them knows certainly happens a lot on transoceanic paths. As we note with the Netflix wars bringing it to visibility, it's not happening a little within North America itself. Edge caching and delta compression sending only in-page differences is clearly a way to insure and proceed, when it is free as in these Arcustech-type arrangements; at least I feel so for my present and future customers.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-07-23T08:22:25.577" LastActivityDate="2014-07-23T08:22:25.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1336" PostTypeId="1" AcceptedAnswerId="1337" CreationDate="2014-07-23T07:31:21.403" Score="2" ViewCount="542" Body="&lt;p&gt;In a previous question and answer, I've laid out recent experience in bringing up Craft on the combination of CloudFlare and Railgun offered as a free feature for VPS hosting at Arcustech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Pingdom-tools-verified performance results are very good, especially in the combination of North American and European customers that the present site is going to serve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was natural to test also Craft features, and only one was found to need some help to operate in this environment. This is to have the very client-useful Live View operate properly when using the Craft CP under SSL/https as the secure.domain.com DNS allows from the previous article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What actually happens at present is that the Live View pane comes up unexpectedly blank. A look at HTTP headers on the iframe ajax loading that pane along with console messages shows why. The CP runs on &lt;a href=&quot;https://secure.domain.com&quot; rel=&quot;nofollow&quot;&gt;https://secure.domain.com&lt;/a&gt;, while the Live View iframe is called at &lt;a href=&quot;https://www.domain.com&quot; rel=&quot;nofollow&quot;&gt;https://www.domain.com&lt;/a&gt;, which can never be possible on free CloudFlare, as it does not support https. It will simply be silent, and then in a long interval time out. As well, there is a CORS error in the console, which suggests that an Access-Control-Allow-Origin header needs to be present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, experiment shows that besides the unavailability of https on the www site, such an CORS header from a template (general _layout inclusion) isn't accepted, either from Craft header() or from embedded http-equiv. Perhaps this is because other CORS headers would have to be introduced within the Craft side to allow it. There may be other reasons, but clearly the situation isn't remediable from outside, at least as far as I can see. If CORS would work, still the https accesson the www CloudFlare-free coupling never will by design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, experimentation proves a solution. I temporarily modified the siteUrl array for some languages (in general.php) to point to the secure.domain.com site, instead of www.domain.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now Live View worked perfectly for each of the languages so modified, because the iframe calls went to a url that could answer, and which was on the same path as the CP ajax caller. Success as tested, but the real site itself would no longer work through CloudFlare/Railgun, as it would no longer be sent as www.domain.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The evident solution is to have the CP iframe ajax load Live View pages by the exact same full URL base as it uses for its own pages. Now everybody would be happy, and there would be no need to entangle CORS as the Live View iframes would be on the same basis as their Ajax loader.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there were any question whether this internal solution would work in all possible cases, it could be introduced by a general.php config element, so that it could also be turned off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would happily spend the hour to build a plugin to arrange this, but I think we are not allowed access by code framework or by license to modify Craft's internals in this area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can see a solution from outside, to save effort at Craft, that would be a great answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In lieu, I'm hoping to have analyzed this problem in a way to make it very easy for our friends to provide what it needs - and if  they don't with better insight than any of us intuit something the matter with such a solution, or realize that there's a better one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many very good surprises have indeed come that way, but not necessary here ;)&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-07-24T03:33:19.590" Title="What configuration does Craft need to enable Live View on hoster CloudFlare with SSL/https CP?" Tags="&lt;config&gt;&lt;cache&gt;&lt;cloudflare&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1337" PostTypeId="2" ParentId="1336" CreationDate="2014-07-23T10:26:15.967" Score="4" Body="&lt;p&gt;I'm not completely sure, but would setting site_url to always be whatever the server host is work in this case? In my general.php I use the following before the config array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$protocol = (isset($_SERVER['HTTPS']) &amp;amp;&amp;amp; $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';&#xA;$base_url = $protocol . $_SERVER['HTTP_HOST'] . '/';&#xA;define('CRAFT_SITE_URL', $base_url);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when you run the cp from secure.example.com the livepreview should load urls based on the same url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running a couple of sites on cloudflare and it doesn't matter what domain I call them from they still all work with livepreview so I was wondering if this might be the difference...&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-07-23T10:26:15.967" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1338" PostTypeId="1" CreationDate="2014-07-23T10:49:41.270" Score="1" ViewCount="119" Body="&lt;p&gt;Traditional .htaccess or&#xA;&lt;code&gt;&amp;lt;!--[if lt IE 7]&amp;gt;&amp;lt;meta http-equiv=&quot;refresh&quot; content=&quot;0; url=/assets/errors/ie.html&quot;/&amp;gt;&amp;lt;![endif]--&amp;gt;&lt;/code&gt; &#xA;methods don't work to redirect users in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it may seem taboo, but quite frankly I don't want anyone who is using IE7 or below to access my site. I'd like to completely redirect them to a separate page/template that will instruct them on why they can't see the site and how to upgrade. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how best to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers, Mark.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-07-23T11:44:10.697" Title="Redirect IE7 or below users to a new page" Tags="&lt;redirect&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1339" PostTypeId="2" ParentId="1338" CreationDate="2014-07-23T11:32:14.657" Score="3" Body="&lt;p&gt;I can't understand why you would simply turn users away. It's part of why we use graceful degradation. It's ugly but usable in browsers that are old like IE7. In Craft's case, there's nothing stopping those methods from working because they are outside Craft's control. This is probably an IE7 bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestion is to keep the users and just show them ugly content, or even add a div that explains why it's ugly. If it's really that important to redirect, use JavaScript. It works mostly fine in IE.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-23T11:32:14.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1340" PostTypeId="2" ParentId="1338" CreationDate="2014-07-23T11:44:10.697" Score="4" Body="&lt;p&gt;I agree with Bryan, personally I like to use the &lt;a href=&quot;http://www.browser-update.org/en/&quot; rel=&quot;nofollow&quot;&gt;Browser-Update.org&lt;/a&gt; notification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, if you want to use &lt;strong&gt;.htaccess&lt;/strong&gt; just make sure you put your redirect code before Crafts routing:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-htaccess prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Redirect old Browsers&#xA;    RewriteCond %{HTTP_USER_AGENT} &quot;MSIE [1-7]&quot; [NC]&#xA;    RewriteRule ^(.*)$ http://something.com/else [R=301,L]&#xA;&#xA;    # Crafts routing&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-23T11:44:10.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1341" PostTypeId="1" AcceptedAnswerId="1342" CreationDate="2014-07-23T11:45:48.350" Score="5" ViewCount="792" Body="&lt;p&gt;I'm trying to decide how to organize my content on a site with a few levels of hierarchical content. I'm toying with the idea of creating structures for all my top level navigation items, with a few levels of nested content for sub-navs and sub-sub-navs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main concern is that if there are 100+ sibling entries deep inside one of my structures, how coupled are the entries to the hierarchy of the structure? Would I be able to later move that section to a completely different main navigation structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or would I be better decoupling the a lot of my content into singles and smaller structures or channels, and sacrifice the relationships between the pages and the neat tree-like representation that gives clients a better overview of their site structure?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-07-25T02:38:03.797" Title="How flexible is tying content to a structure?" Tags="&lt;structure&gt;&lt;content&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1342" PostTypeId="2" ParentId="1341" CreationDate="2014-07-23T12:21:30.580" Score="4" Body="&lt;p&gt;Structures simply add an extra bit of sorting and querying. You can look for entries in a structure the same way you look for entries in a channel. The difference is that you can also have parents and children in a structure with a manually set order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the section page for a structure and hover over an entry, you will see a move handle. You can use that to resort your entries in any order you wish. You can also move the entries to become the child of any other entry. Taking three child entries of a top-level nav and moving them to another top-level nav is no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you organize your content is highly contextual. I don't know what kind of site you're building, so I can't say what's best for you. Most sites I've built thus far have only needed channels save for one. And for that one, I have two structures and two channels. I'm using one channel for news entries, and the other for event entries. I'm using a structure for static pages so I can sort them into a hierarchy (and it gives me breadcrumbs). I'm also using a structure for the main menu because it needs to be set up somewhat different than the static pages (and I need extra fields). This was all chosen based on the needs of my client's site. So just think about your client's needs. Will they be editing it? Is how you have it set up now easy for them to understand how to edit?&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-23T12:21:30.580" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1343" PostTypeId="2" ParentId="1323" CreationDate="2014-07-23T13:47:08.370" Score="1" Body="&lt;p&gt;An excessive amount of for / if statements can cause this. Try simplifying your templates.&lt;/p&gt;&#xA;" OwnerUserId="479" LastActivityDate="2014-07-23T13:47:08.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1344" PostTypeId="1" AcceptedAnswerId="1347" CreationDate="2014-07-23T14:30:50.733" Score="3" ViewCount="375" Body="&lt;p&gt;Ok somebody ought to start asking the Totally Green questions, it may as well be me.  How do I show the date and time an entry was last manipulated in the control panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I produce video more than websites, though that is rapidly changing, and will so even more as the canvas becomes the new After Effects, so I am giving up and in and I'm going to ask all the questions total neophytes would, if it's okay with you people.  Eventually I'm gonna announce my first plug-in, pat myself on the back, and drink a shot.&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="45" LastEditDate="2014-07-23T16:03:04.710" LastActivityDate="2014-07-23T17:25:09.227" Title="Order entries by &quot;recently modified&quot; date time in control panel" Tags="&lt;control-panel&gt;&lt;datetime&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1345" PostTypeId="1" AcceptedAnswerId="1349" CreationDate="2014-07-23T15:45:55.260" Score="11" ViewCount="1757" Body="&lt;p&gt;I want to list all categories that have an entry assigned to them, but hide the ones that are empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In EE I could do this &lt;code&gt;show_empty=&quot;no&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't see a parameter in the docs for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I've found that I could use relatedTo but with passing an object with up to 600 entries it dies with caching tags :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way of doing this? This is what I've got at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogPosts = craft.entries({section:'blog',limit:null}).find() %}&#xA;&#xA;{% for cat in craft.categories({groupId:2}).relatedTo(blogPosts) %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/blog/{{cat.slug}}&quot;&amp;gt;{{cat.title}}&amp;lt;/a&amp;gt; &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="585" LastActivityDate="2014-07-23T17:40:35.433" Title="Check to see if category is populated?" Tags="&lt;entries&gt;&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1346" PostTypeId="2" ParentId="1344" CreationDate="2014-07-23T16:03:49.450" Score="2" Body="&lt;p&gt;Click 'Post Date' in your entries view. You can then toggle ascending or descending. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kJSDy.png&quot; alt=&quot;Entries view sorting by post date&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2014-07-23T16:03:49.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1347" PostTypeId="2" ParentId="1344" CreationDate="2014-07-23T16:12:23.947" Score="5" Body="&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt; is, you can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long answer&lt;/strong&gt;... &lt;a href=&quot;https://craftcms.stackexchange.com/a/1346/45&quot;&gt;Ian has some good advice&lt;/a&gt;, but the Post Date won't update automatically. Your best solution would be to update the Post Date every time you update something else in the entry. Then your Post Date will essentially represent your &quot;last changed&quot; date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus answer&lt;/strong&gt;... If/when you &lt;em&gt;do&lt;/em&gt; build your own plugin, you can look into building your own Element Type. (Just a fair warning... building a custom Element Type is a little more advanced.) When you're setting up your Element Type, you can define which columns appear in that &quot;list&quot; view. One of the native columns in every Craft DB table is &quot;dateUpdated&quot;, which contains exactly the information you're looking for. Just output that as one of your columns, and voila!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;There's no rush, I can wait answer&lt;/strong&gt;... the ability to add custom, sortable columns to the entries (and users, assets, etc.) index pages is coming “Real Soon Now”™.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-23T17:25:09.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1348" PostTypeId="1" CreationDate="2014-07-23T16:13:49.280" Score="3" ViewCount="266" Body="&lt;p&gt;How does one go about serving asset files stored in cloud locations over SSL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For S3, serving assets over SSL is simply a matter of changing 'http' to 'https'. However, Rackspace uses completely different domains for their SSL. This creates a situation where &lt;a href=&quot;http://container1.rscf.com/myfile.jpg&quot; rel=&quot;nofollow&quot;&gt;http://container1.rscf.com/myfile.jpg&lt;/a&gt; mightb be served over &lt;a href=&quot;https://weird.something.rscf.com/myfile.jpg&quot; rel=&quot;nofollow&quot;&gt;https://weird.something.rscf.com/myfile.jpg&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There just seems like there should be a property in the getUrlForFile method in AssetsService.php that helps with this, but I'm not seeing it.&lt;/p&gt;&#xA;" OwnerUserId="279" LastActivityDate="2014-07-23T18:51:20.127" Title="Serving Cloud Assets over SSL" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1349" PostTypeId="2" ParentId="1345" CreationDate="2014-07-23T16:33:02.010" Score="13" Body="&lt;p&gt;There is a great tutorial over at &lt;a href=&quot;http://straightupcraft.com/articles/how-do-i-only-display-a-list-of-categories-that-have-entries-and-hide-empty-categories&quot;&gt;Straight Up Craft&lt;/a&gt; for handling this (it is however very similar to what you have - it may speed things up a tad though).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First, we want to grab all of the entry ids from the Section of&#xA;  content which we want to display categories for.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;{% set entryIds = craft.entries.section('blog').ids() %}&lt;/code&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Next, we will use the craft.categories tags relatedTo() method to only&#xA;  return categories that have a relationship with one of our entry ids.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;{% set categories = craft.categories.relatedTo({ sourceElement:&#xA;  entryIds }).groupId(1).find() %}&lt;/code&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Once we have our list of categories that are in use, we can loop&#xA;  through those categories and display them in our template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-07-23T17:40:35.433" LastActivityDate="2014-07-23T17:40:35.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1350" PostTypeId="1" AcceptedAnswerId="1351" CreationDate="2014-07-23T18:30:12.687" Score="9" ViewCount="2277" Body="&lt;p&gt;Is there a specific or preferred way to set the username for new user registrations to be their email address?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment my user signup form contains both fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Username --&amp;gt;&#xA;  &amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; placeholder=&quot;joesmith&quot; {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}/&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ _self.errorList(account.getErrors('username')) }}&#xA;    {% endif %}&#xA;&#xA;&amp;lt;!-- Email --&amp;gt;&#xA;  &amp;lt;label for=&quot;email&quot; &amp;gt;Email&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;email&quot; name=&quot;email&quot; {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif -%}/ autocapitalize=off autocorrect=off&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ _self.errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="57" LastEditDate="2019-06-21T01:39:26.700" LastActivityDate="2019-06-21T01:39:26.700" Title="Use email address as username" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1351" PostTypeId="2" ParentId="1350" CreationDate="2014-07-23T18:36:51.053" Score="17" Body="&lt;p&gt;I believe you're looking for the conveniently named &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#useemailasusername&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;useEmailAsUsername&lt;/code&gt;&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that is set to true, any new user that is saved with a valid email address will have that copied over to the username field as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9162" LastEditDate="2019-06-20T20:59:34.640" LastActivityDate="2019-06-20T20:59:34.640" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1352" PostTypeId="2" ParentId="1348" CreationDate="2014-07-23T18:51:20.127" Score="3" Body="&lt;p&gt;Personally, I would just go with S3 (I've &lt;a href=&quot;https://craftcms.stackexchange.com/a/578/258&quot;&gt;ranted&lt;/a&gt; about this before), but I understand that sometimes your hand is forced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was not even aware that Rackspace supported SSL or that it would be a different domain. I did some digging through their docs and it seems there'll be some work involved to get this feature in and it will cause a change in behaviour, so I'd say this will have to wait until 2.2.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-07-23T18:51:20.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1353" PostTypeId="1" CreationDate="2014-07-23T19:15:19.617" Score="2" ViewCount="532" Body="&lt;p&gt;I want to create a variable based on the contents of a matrix block.  This is the code I created:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.screenshot %} //my matrix field&#xA;    {% for asset in item.webpage %} // an asset field in the block&#xA;        {% set backgroundUrl = asset.url %} //want to declare a variable using the asset url&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws a &quot;backgroundUrl not defined&quot; error when I try to use the variable.  Obviously my syntax is wrong.  Any advice would be appreciated!  &lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2014-07-23T19:19:29.477" LastActivityDate="2014-07-23T19:49:41.623" Title="Create a variable from content in a matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1354" PostTypeId="2" ParentId="1353" CreationDate="2014-07-23T19:49:41.623" Score="6" Body="&lt;p&gt;This is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot;&gt;twig thing&lt;/a&gt;. Loops in twig are scoped. Variables defined in a loop cannot be used outside of that loop. To fix this, you simply have to declare the variable before the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set backgroundUrl = &quot;&quot; %}&#xA;{% for item in entry.screenshot %}&#xA;    {% for asset in item.webpage %}&#xA;        {% set backgroundUrl = asset.url %}&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you know that you only have one asset you can shorten it a bit with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set backgroundUrl = &quot;&quot; %}&#xA;{% for item in entry.screenshot %}&#xA;    {% set backgroundUrl = item.webpage.first().url %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-23T19:49:41.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1356" PostTypeId="1" AcceptedAnswerId="1376" CreationDate="2014-07-24T01:51:07.590" Score="5" ViewCount="1028" Body="&lt;p&gt;In my studio, we have successfully used multi-environment config files to allow several machines on our local network to use local MAMP installs as well as designate dev and production environments at our web host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally we run sites on separate ports, so for instance to look at my site I point my browser to &lt;code&gt;http://10.0.1.2:8081/&lt;/code&gt;. To look at what’s going on on each other’s machines in the studio, we just change the ip address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now we are looking to run both a stable “trunk” version and a “branch” version for developing new features of our site on each local machine. And I can’t see how to make that work in the general.php and db.php files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is what I’ve had in general.php for running a single instance of the site on my server:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2' =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'        =&amp;gt; 'http://10.0.1.2:8081/',&#xA;        'fileSystemPath' =&amp;gt; ‘/path/to/trunk/files/‘,&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I feel that what I’d like to do is something like the following to differentiate between the two sites running on 10.0.1.2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2:8081’ =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'        =&amp;gt; 'http://10.0.1.2:8081/',&#xA;        'fileSystemPath' =&amp;gt; ‘/path/to/trunk/files/‘,&#xA;    ),&#xA;),&#xA;&#xA;'10.0.1.2:8082’ =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'        =&amp;gt; 'http://10.0.1.2:8082/',&#xA;        'fileSystemPath' =&amp;gt; ‘/path/to/branch/files/‘,&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Similarly, in the db.php file, currently I’ve got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root',&#xA;    'database' =&amp;gt; 'trunk.database’&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which I thought I’d change to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2:8081’ =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root',&#xA;    'database' =&amp;gt; 'trunk.database’&#xA;),&#xA;&#xA;'10.0.1.2:8082’ =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root',&#xA;    'database' =&amp;gt; ‘branch.database’&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But alas these kick off this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An exception has been thrown during the rendering of a template (&quot;Craft canâ€™t connect to the database with the credentials in craft/config/db.php.&quot;) in &quot;_layout&quot; at line 15.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I trying to do something impossible, or can anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you much,&#xA;Willhaus&lt;/p&gt;&#xA;" OwnerUserId="229" LastActivityDate="2014-07-24T18:35:45.930" Title="Multi-environment configs and running sites on different ports" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1357" PostTypeId="2" ParentId="1336" CreationDate="2014-07-24T03:33:19.590" Score="1" Body="&lt;p&gt;I've checked Josh's answer above, because it does the trick. I'm going to put here another approach, one that came literally in an epiphany late last night, just floated up. I enjoy it when that happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we do here is just make use of multi-environmental config, in general,.php. Because the SSL admin is on a subdomain to fit with free CloudFlare, this is easy. Here's the pattern, where secure.domain.com is, wait for it, the SSL domain. Simply by naming it for a selected enviroment, we can put in a siteUrl array that has that subdomain named also, and then the twisty little caverns* within Craft path determination will use it accordingly. It works, and now you have two choices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll still vote that Craft become as dynamite here as it is in almost any of it's abilities, and alter to do this internally. That's so designers and others don't have to dig around and find these technical answers. That we can make them is because each of Craft's areas of ability are so well thought out and computationally complete, of course. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the attraction ever, whichever kind of eyes you are using at a moment to see it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cpTrigger' =&amp;gt; 'yourtrigger',&#xA;        'devMode' =&amp;gt; false,&#xA;        // etc. of yours&#xA;&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'http://www.domain.com/en/',&#xA;            'ru' =&amp;gt; 'http://www.domain.com/ru/',&#xA;            'sv' =&amp;gt; 'http://www.domain.com/sv/',&#xA;        , i )&#xA;     ),&#xA;&#xA;    'secure.domain.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'http://secure.domain.com/en/',&#xA;            'ru' =&amp;gt; 'http://secure.domain.com/ru/',&#xA;            'sv' =&amp;gt; 'http://secure.domain.com/sv/',&#xA;        )&#xA;     )&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;*) a reference to a computer game which grew up alongside Unix, Adventure -- later called Zork&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-07-24T03:33:19.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1358" PostTypeId="2" ParentId="1356" CreationDate="2014-07-24T05:14:08.360" Score="3" Body="&lt;p&gt;When matching the array keys in a multi-environment config, Craft checks the $_SERVER['SERVER_NAME'], which does not include the port, which is in &lt;a href=&quot;http://php.net/manual/en/reserved.variables.server.php&quot; rel=&quot;nofollow&quot;&gt;$_SERVER['SERVER_PORT']&lt;/a&gt;, so it's currently not going to work the way you expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it will do a partial match (since it just uses &lt;a href=&quot;http://php.net/manual/en/function.strpos.php&quot; rel=&quot;nofollow&quot;&gt;strpos&lt;/a&gt;) and successfully match the first key if finds.  In your case, '10.0.1.2:8081'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your MySQL install is running on a non-default (3306) port as well, there is a separate db.php config item for 'port' that you'd need to specify.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-24T05:14:08.360" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1359" PostTypeId="1" AcceptedAnswerId="1362" CreationDate="2014-07-24T05:25:34.407" Score="7" ViewCount="3453" Body="&lt;p&gt;I have a site setup which is for subscribers only. I have added a user expiry date field to the users section and everything is working perfectly on the front end in that I can restrict access to accounts that have already passed their expiry date. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I need to send notification emails to accounts that expire today or will expire in 7 days time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the mailer plugin in combination with a basic plugin I have made. I have setup a basic plugin with a controller which calls the following function from the plugins service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sendNotificationEmail()&#xA;{&#xA;    //Create an EmailModel&#xA;    $email = new EmailModel;&#xA;&#xA;    //Set the necessary attributes &#xA;    $email-&amp;gt;fromName = 'Joe Blogs';&#xA;    $email-&amp;gt;fromEmail = 'joe.blogs@example.com';&#xA;    $email-&amp;gt;subject     = 'Email subject';&#xA;    $email-&amp;gt;htmlBody    = 'The message';&#xA;&#xA;&#xA;    //RecipientsModel&#xA;    $recipients = new Mailer_RecipientsModel();&#xA;    $recipients-&amp;gt;recipients = array(&#xA;        array(&#xA;            'to' =&amp;gt; 'jane.doe@example.com'&#xA;        )&#xA;    );&#xA;&#xA;    if( $recipients-&amp;gt;validate()){&#xA;        //Create mailer&#xA;        craft()-&amp;gt;mailer_main-&amp;gt;newMailer($recipients, $email); //This will start the MailerTask&#xA;    }&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, at the moment I'm just sending a single test email each time. Everything works as expected but I've noticed that the task does not get triggered until I refresh the CP. This is a problem in my case, I think, because I want to trigger everything from a CRON job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any solution as to how to automatically trigger the task or if there are any alternative methods to solve this problem, I'd love to here them :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;btw, the reason I went down the task route was that the system could be sending to 100s of email addresses at a time and I didn't want to be (a) treated as spam or (b) get a timeout from the request&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2017-06-17T16:17:08.843" Title="Triggering the start of a task from a CRON job" Tags="&lt;plugins&gt;&lt;tasks&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1360" PostTypeId="2" ParentId="1356" CreationDate="2014-07-24T06:57:46.457" Score="4" Body="&lt;p&gt;You can define &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; in your &lt;em&gt;index.php&lt;/em&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch ($_SERVER['SERVER_PORT']) {&#xA;  case &quot;8081&quot;:&#xA;    define('CRAFT_ENVIRONMENT', 'TRUNK');&#xA;    break;&#xA;  case &quot;8082&quot;:&#xA;    define('CRAFT_ENVIRONMENT', 'BRANCH');&#xA;    break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in &lt;em&gt;general.php&lt;/em&gt; and &lt;em&gt;db.php&lt;/em&gt; you can:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    ...&#xA;  ),&#xA;  'TRUNK' =&amp;gt; array(&#xA;    ...&#xA;  ),&#xA;  'BRANCH' =&amp;gt; array(&#xA;    ...&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-24T06:57:46.457" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1361" PostTypeId="2" ParentId="1359" CreationDate="2014-07-24T07:41:00.057" Score="3" Body="&lt;p&gt;Ok, you are probably nearly there - all you need to do is call that controller action from the outside world. Here is a small example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_SomeController extends BaseController&#xA;{&#xA;&#xA;  // this lets anyone run the controller actions we specify&#xA;  protected $allowAnonymous = = array('actionRunSomeTask');&#xA;&#xA;  // this is the controller function you want to call&#xA;  public function actionRunSomeTask()&#xA;  {&#xA;    craft()-&amp;gt;tasks-&amp;gt;createTask('MyPlugin_Task');&#xA;    echo 'Task started!';&#xA;    craft()-&amp;gt;end();&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can access the url &lt;a href=&quot;http://example.com/actions/myPlugin/someController/runSomeTask&quot; rel=&quot;nofollow&quot;&gt;http://example.com/actions/myPlugin/someController/runSomeTask&lt;/a&gt; however you like. In cron you could then use something like &lt;code&gt;wget&lt;/code&gt; to get the url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 2 * * * wget http://example.com/actions/myPlugin/someController/runSomeTask&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All this information and more can be found in the docs: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't really grasp the issue which is that Tasks only get set off when the cp is requested. To that end, one solution is to use something like PhantomJS to log in to the cp purely to start off the tasks. I have done this to actually set going something else more complex but here is a cleaned up example using PhantomJS and CasperJS to just access the cp and log in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// make casper&#xA;var casper = require('casper').create();&#xA;&#xA;// log in&#xA;casper.start('http://example.com/admin/login', function(){&#xA;  this.fill('#login-form', {&#xA;    'username' : 'someuser',&#xA;    'password' : 'somepassword'&#xA;  }, true);&#xA;});&#xA;&#xA;// wait for the dashboard&#xA;casper.waitForUrl(http://example.com/admin/dashboard', function(){&#xA;  this.echo('Yay, logged in!');&#xA;&#xA;  // maybe check for some evidence of the task running here&#xA;&#xA;  casper.exit();&#xA;});&#xA;&#xA;// tell casper to run the above sequence&#xA;casper.run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure at some point P&amp;amp;T will sort something more native out but for now this would work.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2014-07-24T09:11:35.737" LastActivityDate="2014-07-24T09:11:35.737" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1362" PostTypeId="2" ParentId="1359" CreationDate="2014-07-24T09:42:17.650" Score="10" Body="&lt;p&gt;Everything you need to manage tasks is in the &lt;strong&gt;TasksService&lt;/strong&gt;, so you should be able to just use that in your controller action to kick off any pending tasks, using something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;tasks-&amp;gt;isTaskRunning())&#xA;{&#xA;    $task = craft()-&amp;gt;tasks-&amp;gt;getNextPendingTask();&#xA;&#xA;    if ($task)&#xA;    {&#xA;        craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have a look around &lt;strong&gt;craft/app/services/TasksService.php&lt;/strong&gt; you'll see you can also grab and run tasks by type which might be useful in this situation.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-07-24T09:42:17.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1363" PostTypeId="1" AcceptedAnswerId="1366" CreationDate="2014-07-24T09:49:47.167" Score="5" ViewCount="552" Body="&lt;p&gt;Is it possible to change the default location users upload their profile photos to? Right now they are stored in &lt;code&gt;/admin/resources/userphotos/&lt;/code&gt; which for me is not preferable for some reasons. I’d rather have them somewhere in &lt;code&gt;html/img/member&lt;/code&gt; or similar.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-07-24T11:54:51.140" Title="Change the location of the user photos" Tags="&lt;users&gt;&lt;user-profile&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1364" PostTypeId="2" ParentId="1363" CreationDate="2014-07-24T11:10:03.880" Score="2" Body="&lt;p&gt;Profile photos are saved to &lt;code&gt;craft/storage/userphotos/&lt;/code&gt; by default. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if you can change the path of &lt;code&gt;userphotos&lt;/code&gt; specifically, but what you can do is to change the path of &lt;code&gt;craft/storage/&lt;/code&gt; to your liking by adding this to your &lt;code&gt;index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;define('CRAFT_STORAGE_PATH', realpath(dirname(__FILE__) . &quot;/../assets/storage&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other interesting path constants that you can overwrite like this are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;CRAFT_CONFIG_PATH&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;CRAFT_PLUGINS_PATH&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;CRAFT_TEMPLATES_PATH&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;CRAFT_TRANSLATIONS_PATH&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-24T11:10:03.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1365" PostTypeId="1" AcceptedAnswerId="1367" CreationDate="2014-07-24T11:34:28.797" Score="4" ViewCount="222" Body="&lt;p&gt;When uploading user profile images, Craft forces you to crop it to a square. Is there a way to keep the images untouched instead?&lt;/p&gt;&#xA;" OwnerUserId="591" LastActivityDate="2014-07-24T14:29:44.373" Title="How do I tell Craft not to automatically crop user profile images?" Tags="&lt;user-profile&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1366" PostTypeId="2" ParentId="1363" CreationDate="2014-07-24T11:54:51.140" Score="4" Body="&lt;p&gt;You could add a custom asset field for the users' profile images and hide the default one in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a plugin to do this: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Control Panel CSS&lt;/a&gt; by Lindsey D&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-24T11:54:51.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1367" PostTypeId="2" ParentId="1365" CreationDate="2014-07-24T11:56:50.600" Score="4" Body="&lt;p&gt;You could add a custom asset field for the users' profile images and hide the default one in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a plugin to do this: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Control Panel CSS&lt;/a&gt; by Lindsey D&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-24T11:56:50.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1368" PostTypeId="1" AcceptedAnswerId="2053" CreationDate="2014-07-24T12:28:52.150" Score="4" ViewCount="433" Body="&lt;p&gt;I am trying to show a list of users but only if they have created a post in a certain section... the code I am using isn't working as expected. Perhaps I have the syntax wrong when it comes to the user model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;{% set authorList = craft.users.relatedTo(entries) %}&#xA;&#xA;{% for author in authorList %}&#xA;&amp;lt;h5&amp;gt;&amp;lt;a href=&quot;/news/author/{{author.username}}&quot;&amp;gt;{{author.fullName}}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;{% endfor %}         &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="28" LastActivityDate="2018-01-29T17:51:14.637" Title="Author List, Only Users With Entry" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1369" PostTypeId="2" ParentId="1368" CreationDate="2014-07-24T12:53:38.853" Score="1" Body="&lt;p&gt;This is similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1345/check-to-see-if-category-is-populated&quot;&gt;another question&lt;/a&gt;, and should yield the same results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('news').ids() %}&#xA;{% set authorList = craft.users.relatedTo({ sourceElement: entryIds }).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this you are basically saying, &quot;I'm looking for users related to these news entries where the news entry is where the user is set&quot;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-07-24T12:53:38.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1370" PostTypeId="2" ParentId="1365" CreationDate="2014-07-24T14:29:44.373" Score="3" Body="&lt;p&gt;Maybe not the answer you are looking for, but I asked a similar question. I needed to grab the original size of the user uploaded images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1030/change-the-size-of-a-users-profile-photo&quot;&gt;Change the size of a users profile photo?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just use &lt;code&gt;getPhotoUrl('original')&lt;/code&gt; when calling the images on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't give you an 'untouched' version of the image but Craft stores the original and makes it easy to call.&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-24T14:29:44.373" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1371" PostTypeId="2" ParentId="1332" CreationDate="2014-07-24T14:49:39.543" Score="2" Body="&lt;p&gt;According to Andris this is the expected behavior in this situation. The bug fix does make Craft work as intended but creates a slightly confusing workflow if you don't know what to expect. The good news is &lt;em&gt;my&lt;/em&gt; expected behavior, which is to have assets available if {owner.slug} has been created in my assets folder already, is on the official list of features to implement. Well, assuming Andris doesn't go into a drunken stupor and forget to tell Brad or Brandon.&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-07-24T14:49:39.543" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1372" PostTypeId="1" AcceptedAnswerId="1373" CreationDate="2014-07-24T15:37:54.810" Score="6" ViewCount="1264" Body="&lt;p&gt;I don't suspect it's currently possible but  I would be pleasantly surprised to find that it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to use an example from Django because I've seen it used there and a similar implementation would be handy to have in Craft. Annnnd it would be helpful for what we're trying to achieve with my current project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;In Django you have your project-wide urls.py (think of this as routes.php in Craft). Additionally you can have app-specific URLs (an App might be a Blog or a Portfolio). You can define the app-specific paths in the app-specific urls.py file and then you can include those URLs in the project-wide URL file. That might look like this (example from the Django docs):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;urlpatterns = [&#xA;    # ... snip ...&#xA;    url(r'^community/', include('django_website.aggregator.urls')),&#xA;    url(r'^contact/', include('django_website.contact.urls')),&#xA;    # ... snip ...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So a use-case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're developing a REST API and right now all of our routes are defined in routes.php. That's an ok solution, but we have a lot of plugin-specific routes. It would be nice to be able to define a base such as /api/ and pass the rest of the request to a plugin-specific routes file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An idea of what this might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'api'   =&amp;gt; array('pluginRoutes' =&amp;gt; 'apiPluginName'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in craft/plugins/apiPluginName/routes.php would be a routes file similar to the project-wide routes.php file in craft/config&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2019-09-06T14:40:15.023" Title="Can we define routes (non-CP) in plugins?" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;custom&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1373" PostTypeId="2" ParentId="1372" CreationDate="2014-07-24T15:44:41.337" Score="13" Body="&lt;p&gt;Is the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot;&gt;&lt;code&gt;registerSiteRoutes&lt;/code&gt; hook&lt;/a&gt; what you're looking for?&lt;/p&gt;&#xA;" OwnerUserId="279" LastEditorUserId="177" LastEditDate="2014-07-24T16:04:08.493" LastActivityDate="2014-07-24T16:04:08.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1374" PostTypeId="1" AcceptedAnswerId="1383" CreationDate="2014-07-24T16:34:12.067" Score="4" ViewCount="960" Body="&lt;p&gt;On &lt;a href=&quot;http://imperavi.com/redactor/&quot; rel=&quot;nofollow&quot;&gt;Redactor's website&lt;/a&gt;, they provide a demo with an image that you can click on and drag around the editor to relocate it among the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/u/13223/Redactor_Website.mp4&quot; rel=&quot;nofollow&quot;&gt;Video example from Redactor's website&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying this same functionality in the rich text editor in the Craft control panel doesn't work though. I even copied the demo HTML from Redactor's website and pasted it into Craft, without any luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/u/13223/Craft_Website.mp4&quot; rel=&quot;nofollow&quot;&gt;Video example from Craft control panel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody been able to get this working or have any idea why this functionality would be missing in Craft?&lt;/p&gt;&#xA;" OwnerUserId="592" LastEditorUserId="592" LastEditDate="2014-07-24T20:22:09.043" LastActivityDate="2014-07-24T22:49:36.067" Title="Dragging images inside of rich text editor" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2014-07-28T02:54:38.650" ContentLicense="CC BY-SA 3.0" />
  <row Id="1375" PostTypeId="1" CreationDate="2014-07-24T17:13:36.610" Score="1" ViewCount="153" Body="&lt;p&gt;In the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Craft Models documentation&lt;/a&gt; example the model extends the BaseModel class. However in the &lt;a href=&quot;https://github.com/pixelandtonic/Events/blob/master/events&quot; rel=&quot;nofollow&quot;&gt;example Events plugin source code&lt;/a&gt; the Events_EventModel extends the BaseElementModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While poking around in PHPStorm I also noticed other &quot;base model&quot; classes such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;BaseComponentModel&lt;/li&gt;&#xA;&lt;li&gt;BaseElementModel&lt;/li&gt;&#xA;&lt;li&gt;BaseEntryRevisionModel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I also wondered if it makes sense to extend non-base models such as the EntryModel (if you're modeling entry data for example).&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-07-24T19:54:34.663" Title="When should I build upon existing models in my own plugins?" Tags="&lt;plugin-development&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1376" PostTypeId="2" ParentId="1356" CreationDate="2014-07-24T17:16:30.947" Score="3" Body="&lt;p&gt;BOOM! Got it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following makes it work. I can leave the ip address as is, and the insert a test for which port I’m on. I never would have figured that without y’all’s help and another pass through the &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Multi-Environment Configs&lt;/a&gt; doc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did this for &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2' =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; ($_SERVER['SERVER_PORT'] == '8081' ? 'http://10.0.1.2:8081/' : 'http://10.0.1.2:8082/'),&#xA;        'fileSystemPath' =&amp;gt; ($_SERVER['SERVER_PORT'] == '8081' ? '/path/to/trunk/files/' : '/path/to/branch/files/'),&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this in &lt;code&gt;db.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'10.0.1.2' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root',&#xA;    'database' =&amp;gt; ($_SERVER['SERVER_PORT'] == '8081' ? 'trunk.database' : ‘branch.database'),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;THANK YOU, everyone, for your help!&lt;/p&gt;&#xA;" OwnerUserId="229" LastEditorUserId="57" LastEditDate="2014-07-24T18:35:45.930" LastActivityDate="2014-07-24T18:35:45.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1377" PostTypeId="2" ParentId="1374" CreationDate="2014-07-24T17:58:34.530" Score="2" Body="&lt;p&gt;More than likely (this would have to be confirmed by Pixel &amp;amp; Tonic), they didn't include the server-side scripting for handling that. Uploads in Craft are handled using Assets, which treats files as a whole lot more than just files. Allowing files to be dropped in would possibly be difficult with the kinds of options users have for handling files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is click the image icon and select &quot;Choose Image&quot;, you will get a modal pop up that does allow you to drag and drop in images. Afterwards, you'll be able to drag it around for placement. It's not exactly what you're looking for, but it's an option.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-24T17:58:34.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1378" PostTypeId="1" AcceptedAnswerId="1380" CreationDate="2014-07-24T18:34:09.203" Score="5" ViewCount="1372" Body="&lt;p&gt;When using rich text fields, is there a way to automatically wrap embedded content (specifically, videos) in some kind of custom HTML?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to, at the very least, wrap the embed in some element (a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;, for instance) with some kind of class or ID, so that it'd be something like &lt;code&gt;&amp;lt;div class=&quot;inline-media&quot;&amp;gt;EMBED HERE&amp;lt;/div&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found my way to &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot;&gt;the Craft docs for rich text fields&lt;/a&gt;, and see that I may be able to add this functionality via &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/&quot;&gt;Redactor&lt;/a&gt;, but I'm not sure how to go about doing so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2015-09-23T14:00:18.947" Title="Wrap embeds with HTML in rich text field" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1379" PostTypeId="2" ParentId="1375" CreationDate="2014-07-24T19:54:34.663" Score="2" Body="&lt;p&gt;BaseComponentModel, BaseElementModel and BaseEntryRevisionModel all ultimately end up extending BaseModel, which itself extends &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel&quot; rel=&quot;nofollow&quot;&gt;Yii's CModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to think of them, roughly, as beefed up &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_transfer_object&quot; rel=&quot;nofollow&quot;&gt;Data Transfer Objects&lt;/a&gt;.  Primarily useful for transferring data throughout the various layers of Craft (templates, controllers, services, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding which ones you extend, it depends entirely on what you are trying to do in your plugin and with your Models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BaseModel is the most &quot;generic&quot; one as far as Craft is concerned that gives you all of the Craft specific attributes of Models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BaseElementModel is useful if your plugin is dealing with &lt;a href=&quot;http://pixelandtonic.com/blog/craft-element-types&quot; rel=&quot;nofollow&quot;&gt;Element Types&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BaseComponentModel is useful if your plugin is dealing with Component Types (tools, widgets, tasks, etc.).  You can check the &lt;code&gt;craft/app/enums/ComponentType.php&lt;/code&gt; enum for a full list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And BaseEntryRevisionModel is pretty self explanatory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there is nothing stopping you from extending things like Craft's own &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt; directly, if you need specific features that it has.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-24T19:54:34.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1380" PostTypeId="2" ParentId="1378" CreationDate="2014-07-24T20:26:27.757" Score="8" Body="&lt;p&gt;I suggest a Twig filter so you can do something like this in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | wrapembeds }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is something to love about Craft - the ease of building Twig filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plugins directory create a folder &lt;code&gt;videoembeds&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create the main plugin file &lt;code&gt;WrapEmbedsPlugin.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class WrapEmbedsPlugin extends BasePlugin&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Embed Wrapper Twig Filter');&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '0.0';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'Your Name';&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'http://yoursite.com';&#xA;    }&#xA;&#xA;    public function hookAddTwigExtension()&#xA;    {&#xA;        Craft::import('plugins.wrapembeds.WrapEmbedsTwigExtension');&#xA;        return new WrapEmbedsTwigExtension();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Create another file &lt;code&gt;WrapEmbedsTwigExtension.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class WrapEmbedsTwigExtension extends \Twig_Extension&#xA;{&#xA;  protected $env;&#xA;&#xA;  public function getName()&#xA;  {&#xA;    return 'WrapEmbeds Twig Extension';&#xA;  }&#xA;&#xA;  public function getFilters()&#xA;  {&#xA;    return array('wrapembeds' =&amp;gt; new \Twig_Filter_Method($this, 'wrapembeds'));&#xA;  }&#xA;&#xA;  public function initRuntime(\Twig_Environment $env)&#xA;  {&#xA;    $this-&amp;gt;env = $env;&#xA;  }&#xA;&#xA;  public function wrapembeds($content)&#xA;  {&#xA;    $filtered = preg_replace_callback('/&amp;lt;iframe.+iframe&amp;gt;/', function($matches) {&#xA;      return '&amp;lt;div class=&quot;inline-media&quot;&amp;gt;'. $matches[0] . '&amp;lt;/div&amp;gt;';&#xA;    }, $content);&#xA;&#xA;    $charset = craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;getCharset();&#xA;    $filtered = new RichTextData($filtered, $charset);&#xA;&#xA;    return $filtered;&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Enable the plugin in the admin then add the filter to the template tag. Hopefully this is enough to get you started adding custom Twig filters. Simple once you know how and very handy!&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2014-07-24T20:26:27.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1381" PostTypeId="1" AcceptedAnswerId="1382" CreationDate="2014-07-24T21:39:02.120" Score="3" ViewCount="1031" Body="&lt;p&gt;Doing some testing, and stumbled across the &quot;CraftSessionId&quot; cookie...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the difference between CraftSessionId and a normal PHP session? Is there any difference at all? What's the best way to refer to the current session?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-07-24T21:46:24.063" Title="What's the difference between CraftSessionId and a normal PHP session?" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1382" PostTypeId="2" ParentId="1381" CreationDate="2014-07-24T21:46:24.063" Score="3" Body="&lt;p&gt;They are one in the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft simply renames it to &quot;CraftSessionId&quot; rather than the default &quot;PHPSESSIONID&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only additional things we do to it is set the &quot;httpOnly&quot; flag so that JavaScript can't read it and change the place it is saved to by default (varies per server) to &lt;code&gt;craft/storage/runtime/sessions&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that in action in &lt;code&gt;HttpSessionService&lt;/code&gt;, which extends &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHttpSession&quot; rel=&quot;nofollow&quot;&gt;Yii's CHttpSession&lt;/a&gt;, which is a convenient wrapper for PHP's session functionality.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-24T21:46:24.063" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1383" PostTypeId="2" ParentId="1374" CreationDate="2014-07-24T22:49:36.067" Score="6" Body="&lt;p&gt;Just looked into this and it’s a Craft bug. If you add an image manually using the “Insert URL” option, the image can be dragged around, but not if you use the “Choose image” option, which opens Craft’s image selection modal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saving the entry and coming back to it (or just typing Command + S) will also make the image draggable, regardless of how you added it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We’ll get this fixed.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-24T22:49:36.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1384" PostTypeId="1" AcceptedAnswerId="1391" CreationDate="2014-07-25T01:49:51.560" Score="9" ViewCount="1228" Body="&lt;p&gt;From working on plugin development, importing (I believe the correct term for this is macro) the 'forms' to quickly generate text areas, selects and etc. is incredibly useful. Adding the import now fails as '_includes' is only accessible from the control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my template I could add this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use something similar to this to output my forms fields?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;    label: &quot;First Name&quot;|t,&#xA;    id: 'firstName',&#xA;    name: 'firstName',&#xA;    instructions: &quot;First name (i.e John)&quot;,&#xA;    placeholder: &quot;John&quot;,&#xA;    first: true,&#xA;    autofocus: true,&#xA;    required: true&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know when using Symfony and Twig you can specify the namespace on where to grab the template from. Does Craft include a way to access those templates from the front end? Has anyone managed to perform this outside of the control panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: &lt;em&gt;if this is not possible, or p&amp;amp;t doesn't plan on making this possible (for security concerns) is there a way for a plugins template path to allow anonymous access? This way the developer could create an '_includes' and allow people to access it in the same manor?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="57" LastEditDate="2019-03-11T23:43:35.337" LastActivityDate="2019-03-11T23:43:35.337" Title="Is it possible to use _includes/forms outside of the Control Panel?" Tags="&lt;templating&gt;&lt;import&gt;&lt;macro&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1386" PostTypeId="1" CreationDate="2014-07-25T03:46:41.207" Score="4" ViewCount="476" Body="&lt;p&gt;For example, when editing an entry &lt;code&gt;cmd + s&lt;/code&gt; saves the entry. Is there an easy way to extend Garnish to allow for my plugin to listen for custom keyboard shortcuts?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-25T08:59:21.013" Title="Can Garnish be extended to allow plugins to use custom keyboard shortcuts?" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1387" PostTypeId="1" AcceptedAnswerId="1390" CreationDate="2014-07-25T08:27:10.440" Score="7" ViewCount="812" Body="&lt;p&gt;I have problems to understand the difference between search and relatedTo. From my understanding, this is a fulltext search on all fields.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.search(test).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does the following approach mean the same?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(test).order('score').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if yes, which one delivers the better performance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="57" LastEditDate="2014-07-25T17:02:01.230" LastActivityDate="2014-07-25T17:02:01.230" Title="Using “search” vs. “relatedTo” in a template" Tags="&lt;search&gt;&lt;performance&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1388" PostTypeId="2" ParentId="1386" CreationDate="2014-07-25T08:59:21.013" Score="3" Body="&lt;p&gt;I'm not sure if there's an &quot;official&quot; way yet but I've looked through the source a little bit and I think the most Craft-like way I would do it, following plugin conventions, is to extend Garnish.Base with a new object that attaches the listener. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($) {&#xA;&#xA;        var PluginName_KeyCapture = Garnish.Base.extend({&#xA;&#xA;            init: function()&#xA;            {&#xA;                this.addListener(Garnish.$doc, 'keydown', function(ev)&#xA;                {&#xA;                    if ((ev.metaKey || ev.ctrlKey) &amp;amp;&amp;amp; ev.keyCode == 66)&#xA;                    {&#xA;                        ev.preventDefault();&#xA;                        console.log('You hit CTRL + B! Good work.');&#xA;                    }&#xA;                });&#xA;            }&#xA;        });&#xA;&#xA;        Craft.PluginName_KeyCapture = new PluginName_KeyCapture();&#xA;    })(jQuery);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-07-25T08:59:21.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1389" PostTypeId="2" ParentId="1261" CreationDate="2014-07-25T09:08:57.877" Score="3" Body="&lt;p&gt;Ok, so I finally figured it out. The trick was using the following two methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;assembleLayoutFromPost()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;setContentFromPost('fields')&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The controller now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionSubmit()&#xA;{&#xA;// require POST&#xA;$this-&amp;gt;requirePostRequest();&#xA;&#xA;// assume new element type&#xA;$elementtype = new PluginName_ElementTypeModel();&#xA;&#xA;// assign the attributes specific to the element type&#xA;$elementtype-&amp;gt;formId    = craft()-&amp;gt;request-&amp;gt;getPost('formId');&#xA;$elementtype-&amp;gt;fieldName1 = craft()-&amp;gt;request-&amp;gt;getPost('fieldName1');&#xA;$elementtype-&amp;gt;fieldName2  = craft()-&amp;gt;request-&amp;gt;getPost('fieldName2');&#xA;&#xA;// if form id does NOT exist&#xA;if (!$elementtype-&amp;gt;formId)&#xA;{&#xA;    // @TODO figure out how to return errors/validation&#xA;    dd('need a form id');&#xA;}&#xA;// if form id exists but we can't find it in the system&#xA;elseif (craft()-&amp;gt;elementtype_forms-&amp;gt;getFormById($elementtype-&amp;gt;formId) == null)&#xA;{&#xA;    // @TODO figure out how to return errors/validation&#xA;    dd('form does not exist');&#xA;}&#xA;&#xA;// setup a new form model&#xA;$form = new PluginName_FormModel();&#xA;&#xA;// shared attributes&#xA;$form-&amp;gt;id = $elementtype-&amp;gt;formId;&#xA;&#xA;// set the field layout&#xA;$fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayoutFromPost();&#xA;$fieldLayout-&amp;gt;type = ElementType::Asset;&#xA;$form-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;// set content from post with the fields namespace&#xA;$elementtype-&amp;gt;setContentFromPost('fields');&#xA;&#xA;// Save it&#xA;if (craft()-&amp;gt;elementtype-&amp;gt;save($elementtype))&#xA;{&#xA;    $this-&amp;gt;redirectToPostedUrl($elementtype);&#xA;}&#xA;else&#xA;{&#xA;    dd('not saved');&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The main difference was on the front-end where I namespaced the fields that were assigned via the field layout, so the template to submit looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;plugin-form&quot;guinname method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;pluginname/submit&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;pluginname?submit=success&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;formId&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- Required Fields --&amp;gt;&#xA;&amp;lt;label&amp;gt;Field 1&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fieldName1&quot; /&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&amp;lt;label&amp;gt;Last Name&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fieldName2&quot; /&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&amp;lt;!-- End Required Fields --&amp;gt;&#xA;&#xA;&amp;lt;!-- My Custom Fields --&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[body]&quot; rows=&quot;8&quot; cols=&quot;40&quot;&amp;gt;OMG IT WORKED&amp;lt;/textarea&amp;gt;&#xA;&#xA;&amp;lt;button type=&quot;submit&quot;&amp;gt;Submit Now&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-25T09:15:36.113" LastActivityDate="2014-07-25T09:15:36.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1390" PostTypeId="2" ParentId="1387" CreationDate="2014-07-25T09:30:23.723" Score="10" Body="&lt;p&gt;To be honest, those two parameters may seem to be slightly similar but provide a totally different functionality.&lt;/p&gt;&#xA;&lt;p&gt;From their documentation on search:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;search&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Only fetch entries that match a given search query. (See Searching for the syntax and &amp;gt; available search attributes.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Which means whatever you pass in &lt;code&gt;.search(query)&lt;/code&gt;, and there is a rather complex list &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, will actually 'search' Craft for the query string you specify.&lt;/p&gt;&#xA;&lt;p&gt;On a different note,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;relatedTo&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Only fetch entries that are related to certain other elements. (See&#xA;Relations for the syntax options.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This on the other hand only 'relates' to other entries, meaning its not performing a fill search on Craft, only the entries. A detailed reference on relations can be found &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As far as performance, the two are unrelated as it really depends on what you are trying to accomplish.&lt;/p&gt;&#xA;&lt;p&gt;Hope this clears it up for you!&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-07-25T09:30:23.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1391" PostTypeId="2" ParentId="1384" CreationDate="2014-07-25T09:52:10.133" Score="4" Body="&lt;p&gt;We've done this on a few sites and you're right it's extremely helpful. The only way I've found to get it to work is to simply copy the &quot;_includes/forms&quot; folder from craft/app/templates to the sites craft/templates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works but I'd love a less hacks way to do it, either through a plugin or some built-in means.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-07-25T09:52:10.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1393" PostTypeId="1" CreationDate="2014-07-25T11:51:22.363" Score="2" ViewCount="245" Body="&lt;p&gt;When transforming images, we’re getting the following error on the client’s production server.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Argument 1 passed to Craft\AssetTransformsService::ensureTransformUrlByIndexModel() must be an instance of Craft\AssetTransformIndexModel, null given, called in /craft/app/services/ResourcesService.php on line 223 and defined&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As a consequence image elements on the page don’t appear. When reloading the page a second time images are displayed as expected.&lt;/p&gt;&#xA;&lt;p&gt;What might be the cause of this?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As requested in comments…&lt;/p&gt;&#xA;&lt;p&gt;The .htaccess, below-pasted, is just the default.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The template transform is very simple.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&amp;quot;{{ block.image.first().getUrl({ width: 560, height: 310 }) }}&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The transform does work but only displays on the second page load.&lt;/p&gt;&#xA;" OwnerUserId="596" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-08-26T15:38:42.320" Title="Exception when transforming image" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-02-20T01:07:30.143" ContentLicense="CC BY-SA 3.0" />
  <row Id="1394" PostTypeId="1" AcceptedAnswerId="1397" CreationDate="2014-07-25T11:55:39.307" Score="2" ViewCount="1027" Body="&lt;p&gt;I have my plugin working now so that I can email users who's accounts will expire in 7 days time. The users are being selected correctly and the emails are being sent as expected. However, the tasks don't seem to be running in the background. I was expecting that when I hit the controller the task will be triggered and the page would immediately return saying &quot;emails sent&quot;. Instead it seems it waits until the emails are sent before returning &quot;emails sent&quot;. I'm worried that if the number of emails is large the page will timeout before it completes. It was my understanding that tasks run as a background process but may I have miss understood. Can anyone explain them to me in more detail?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference here is the controller and the service of my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class AcmeNotifications_NotificationsController extends BaseController&#xA;{&#xA;&#xA;// let anyone run the controller actions&#xA;protected $allowAnonymous = array('actionSendEmail');&#xA;&#xA;public function actionSendEmail()&#xA;{&#xA;    craft()-&amp;gt;acmeNotifications_notifications-&amp;gt;sendReminderEmail();&#xA;&#xA;    //Make sure we kick the task off&#xA;&#xA;    if (!craft()-&amp;gt;tasks-&amp;gt;isTaskRunning())&#xA;    {&#xA;        $task = craft()-&amp;gt;tasks-&amp;gt;getNextPendingTask();&#xA;&#xA;        if ($task)&#xA;        {&#xA;            craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;        }&#xA;    }&#xA;&#xA;    craft()-&amp;gt;end();&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class AcmeNotifications_NotificationsService extends BaseApplicationComponent&#xA;{&#xA;public function sendReminderEmail()&#xA;{&#xA;    //Get all users whos account will expire in 7 days&#xA;    $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;&#xA;    $user_criteria-&amp;gt;userExpiryDate = date('Y-m-d',strtotime(&quot;+7 days&quot;));&#xA;&#xA;    $users = $user_criteria-&amp;gt;find();&#xA;&#xA;&#xA;&#xA;    if($users){&#xA;        //Create array of user email addresses&#xA;        $user_emails = array();&#xA;        foreach ($users as $user) {&#xA;            $user_emails[] = array(&quot;to&quot; =&amp;gt; $user-&amp;gt;email);&#xA;        }&#xA;&#xA;        //Create an EmailModel&#xA;        $email = new EmailModel;&#xA;&#xA;        //Set the global attributes &#xA;        $email-&amp;gt;fromName = 'Joe Blogs';&#xA;        $email-&amp;gt;fromEmail = 'joe.blogs@example.com';&#xA;        $email-&amp;gt;subject     = 'Your account will expire in 7 days';&#xA;        $email-&amp;gt;htmlBody    = 'The message';&#xA;&#xA;        //Create the RecipientsModel and add the user emails&#xA;        $recipients = new Mailer_RecipientsModel();&#xA;        $recipients-&amp;gt;recipients = $user_emails;&#xA;&#xA;        if( $recipients-&amp;gt;validate()){&#xA;            //Create mailer task&#xA;            craft()-&amp;gt;mailer_main-&amp;gt;newMailer($recipients, $email); &#xA;        }&#xA;&#xA;        echo &quot;emails sent&quot;;&#xA;    }&#xA;    else{&#xA;        echo &quot;no emails to send&quot;;&#xA;    }&#xA;}&#xA;&#xA;&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="590" LastEditorUserId="125" LastEditDate="2014-07-25T13:42:05.497" LastActivityDate="2014-07-25T13:49:00.980" Title="My tasks don't seem to be running as a background process" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1395" PostTypeId="1" AcceptedAnswerId="1396" CreationDate="2014-07-25T12:11:53.963" Score="2" ViewCount="430" Body="&lt;p&gt;We have more than 100 authors in a user group, but when selecting an author for an entry, only the first 100 are listed in the (a-z) dropdown. Whats the best way to display them all (or up the parameter?)&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-07-25T13:05:33.693" Title="Author list limited to first 100 when assigning to entry?" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;author&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1396" PostTypeId="2" ParentId="1395" CreationDate="2014-07-25T13:05:33.693" Score="3" Body="&lt;p&gt;By default, Craft sets the limit of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; to 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get all/more entries just set the &lt;code&gt;.limit&lt;/code&gt; parameter to &lt;code&gt;null&lt;/code&gt; or a number:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allUsers = craft.users.limit(null).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set someUsers = craft.users.limit(200).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A list of all available parameters can be found here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.users&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.users&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-25T13:05:33.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1397" PostTypeId="2" ParentId="1394" CreationDate="2014-07-25T13:33:11.860" Score="2" Body="&lt;p&gt;You are right about the Tasks running in the background. If the Task is just sending a few mails, it might be done before your site is loaded, thus creating this impression. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Check:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change the Batch Size of the &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer&quot; rel=&quot;nofollow&quot;&gt;Mailer plugin&lt;/a&gt; to &lt;code&gt;1&lt;/code&gt; and the waiting time to &lt;code&gt;120&lt;/code&gt; seconds.&lt;/li&gt;&#xA;&lt;li&gt;Change the &lt;code&gt;$user_criteria&lt;/code&gt; to fetch 2 users.&lt;/li&gt;&#xA;&lt;li&gt;Run your controller&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It should now take about 2 minutes for the Task to finish, if your site loads faster it was just an impression.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should however separate your code a bit more, because right now you are mixing &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;Services&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your Service shouldn't output anything, it should just return a value, (e.g. &lt;a href=&quot;https://php.net/manual/en/language.types.boolean.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;boolen&lt;/code&gt;&lt;/a&gt;), and your Controller should then output the message:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Service {&#xA;    //Create Task etc...&#xA;&#xA;    if ($itWorked == true) {&#xA;       return true;&#xA;    }&#xA;    else {&#xA;       return false;&#xA;    }&#xA;}&#xA;&#xA;/* ------------------------ */&#xA;&#xA;Controller {&#xA;    if ( FunctionService() ) {&#xA;       echo 'It worked';&#xA;    }&#xA;    else {&#xA;       echo 'Something went wrong';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also the &quot;Make sure we kick the task off&quot;-part, should go into your Service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt; I see you are using my plugin :), if you need any help, create &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer/issues?state=closed&quot; rel=&quot;nofollow&quot;&gt;an issue over on github&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-25T13:49:00.980" LastActivityDate="2014-07-25T13:49:00.980" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1398" PostTypeId="1" AcceptedAnswerId="1402" CreationDate="2014-07-25T14:07:14.603" Score="2" ViewCount="143" Body="&lt;p&gt;I'm considering using Craft for a new site. One requirement will be allowing members to upload and manage images. With Craft, can I set a size requirement for member uploaded images? So for example, if I only wanted to allow 400x400 image size to be uploaded, could I lock it down so that any image smaller or larger will just give an error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not possible, is there a way to resize/crop a large image down to the correct size?&lt;/p&gt;&#xA;" OwnerUserId="598" LastActivityDate="2014-07-25T15:46:59.437" Title="Member uploaded images" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1399" PostTypeId="2" ParentId="1177" CreationDate="2014-07-25T14:56:59.753" Score="4" Body="&lt;p&gt;The cleanest way to do this would be to provide your own Javascript class that overrides Craft.BaseElementIndex, which stores the latest search value in localStorage:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;MyElementTypeIndex = Craft.BaseElementIndex.extend(&#xA;{&#xA;    onAfterHtmlInit: function()&#xA;    {&#xA;        // Do we have a stored search value?&#xA;        if (this.instanceState.searchVal)&#xA;        {&#xA;            this.$search.val(this.instanceState.searchVal);&#xA;        }&#xA;&#xA;        this.base();&#xA;    },&#xA;&#xA;    updateElements: function()&#xA;    {&#xA;        // Store the current search val in localStorage&#xA;        this.setInstanceState('searchVal', this.$search.val());&#xA;&#xA;        this.base();&#xA;    }&#xA;});&#xA;&#xA;// Register this as the official index class for this element type!&#xA;Craft.registerElementIndexClass('MyElementType', MyElementTypeIndex);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Save that file somewhere in your plugin’s resources/ folder (let’s say it’s craft/plugins/myplugin/resources/js/index.js), and then include it from your plugin’s &lt;code&gt;init()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class MyPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    public function init()&#xA;    {&#xA;        if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;        {&#xA;            craft()-&amp;gt;templates-&amp;gt;includeJsResource('myplugin/js/index.js');&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-25T14:56:59.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1400" PostTypeId="1" AcceptedAnswerId="1565" CreationDate="2014-07-25T15:28:09.893" Score="6" ViewCount="497" Body="&lt;p&gt;I'm currently working with the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/&quot; rel=&quot;nofollow&quot;&gt;Contact Form plugin&lt;/a&gt; from P&amp;amp;T. I don't need much more, but as usual the client wants to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;See the email address and name in the body of the mail (he won't understand the way it works now). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get this done?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="177" LastEditDate="2014-07-25T17:15:31.260" LastActivityDate="2014-08-01T08:54:13.613" Title="P&amp;T Contact Form plugin: How can I copy &quot;name&quot; and &quot;email address&quot; in the body of the mail?" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1401" PostTypeId="1" AcceptedAnswerId="1403" CreationDate="2014-07-25T15:35:26.847" Score="4" ViewCount="376" Body="&lt;p&gt;How can I prevent people accessing templates directly that are only used as includes for instance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that I could add an underscore ie _example.html,but then the include stops working.&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-07-25T15:47:52.533" Title="How to block direct access to templates (hiding templates)" Tags="&lt;templating&gt;&lt;hiding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1402" PostTypeId="2" ParentId="1398" CreationDate="2014-07-25T15:46:59.437" Score="2" Body="&lt;p&gt;You can ad {author.username} to the file upload field, that way their files will always be in the folder of the user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With assets you can define scale sizes which works way better then forcing a fixed size. It doesn't stop someone from uploading a 36 Mp image though. As far as I know it's impossible to check the canvas size before upload.&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-07-25T15:46:59.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1403" PostTypeId="2" ParentId="1401" CreationDate="2014-07-25T15:47:52.533" Score="8" Body="&lt;p&gt;If your template is &lt;em&gt;_example.html&lt;/em&gt;, you include like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_example.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It also works to have a template in a directory that starts with an underscore. So you could name the directory &lt;em&gt;_includes&lt;/em&gt;, name the template in there &lt;em&gt;example.html&lt;/em&gt; and include it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/example.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Either way, the template can't be accessed directly.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-25T15:47:52.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1404" PostTypeId="1" CreationDate="2014-07-25T15:48:34.100" Score="4" ViewCount="387" Body="&lt;p&gt;I am looping through a matrix field and it appears to stop looping when the index reaches 100 but I have more than 100 blocks here. How can I loop through the remaining blocks?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {{ loop.index }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="243" LastActivityDate="2014-07-25T16:51:35.297" Title="How can I iterate more than 100 blocks in a matrix field for loop?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1405" PostTypeId="2" ParentId="1404" CreationDate="2014-07-25T15:48:34.100" Score="2" Body="&lt;p&gt;The default limit for fetching elements is 100. This can be overridden as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Passing in &lt;code&gt;null&lt;/code&gt; will grab all of them, or you can pass in the specific number you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.limit(400) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="243" LastEditorUserId="57" LastEditDate="2014-07-25T16:51:35.297" LastActivityDate="2014-07-25T16:51:35.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1406" PostTypeId="2" ParentId="1400" CreationDate="2014-07-25T16:59:48.707" Score="2" Body="&lt;p&gt;Your options are either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Hack the plugin to get it to add name and email to the body.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Use a more robust &lt;a href=&quot;http://straightupcraft.com/craft-plugins/sprout-forms&quot; rel=&quot;nofollow&quot;&gt;form-building plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Use JavaScript to add a hidden input to the page that will add it to the body so they don't have to enter an email twice.  Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;emailCopy&quot; type=&quot;hidden&quot; name=&quot;message[emailCopy]&quot; value=&quot;my@email.com&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-25T16:59:48.707" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1407" PostTypeId="2" ParentId="1010" CreationDate="2014-07-25T17:12:05.910" Score="5" Body="&lt;p&gt;You can’t access the current Twig variables (the “context”, as Twig calls them), from a Template Variable class, but you can access them with a &lt;a href=&quot;http://buildwithcraft.com/docs/apis/templatesservice#hook&quot; rel=&quot;noreferrer&quot;&gt;template hook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your plugin’s &lt;code&gt;init()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook('errorCheck', function(&amp;amp;$context)&#xA;{&#xA;    if (isset($context['errors']))&#xA;    {&#xA;        // do something with $context['errors'];&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook &quot;errorCheck&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can modify, delete, and create variables within that &lt;code&gt;$context&lt;/code&gt; array if you want. And because it is passed by reference (that’s what the “&lt;code&gt;&amp;amp;&lt;/code&gt;” does in “&lt;code&gt;&amp;amp;$context&lt;/code&gt;”, you won’t need to actually return the array at the end of the function or anything; just make your changes to it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-25T17:12:05.910" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1408" PostTypeId="2" ParentId="1027" CreationDate="2014-07-25T18:00:46.333" Score="3" Body="&lt;p&gt;You can only return a single content table per element query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to join multiple content tables, you have two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use multiple element queries, one for each group of elements that share a content table. Disadvantage of this approach is, you won't be able to order elements in SQL.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Just don’t join in any content tables in the initial elements query, and let your elements lazy-load their content rows if any custom fields are actually accessed on the elements. You can do this by having your element type’s &lt;code&gt;getContentTableForElementsQuery()&lt;/code&gt; function return &lt;code&gt;null&lt;/code&gt;. The only disadvantage here is that you won't be able to order/filter by custom field values, since those tables won’t have been joined in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go this route, you will need to make sure that your model that extends BaseElementModel is overriding the &lt;code&gt;getContentTable()&lt;/code&gt; function (which it should be anyway, if you’re using custom content tables). That way it will know which table to pull data from if any custom field values are requested from it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In your case, if &lt;em&gt;each&lt;/em&gt; element is going to have its own content table, then option #2 is probably going to be your best bet.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-25T18:00:46.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1409" PostTypeId="1" AcceptedAnswerId="1414" CreationDate="2014-07-25T20:34:04.667" Score="5" ViewCount="1085" Body="&lt;p&gt;I'm building a plugin that adds blocks to a matrix in an entry from the front end. I got it up and running by following the answer in this post: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1101/how-to-save-a-matrix-content-of-a-new-entry-in-my-plugin/1218#1218&quot;&gt;How to save a matrix content of a new entry in my plugin?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I check if the matrix already has blocks when I fetch the entry? And then, once I know if the matrix already has blocks, how do I retain the existing data while saving new blocks via the plugin?&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2018-11-21T20:40:46.887" Title="How do I add a block to a matrix that already has content via a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1410" PostTypeId="1" AcceptedAnswerId="1411" CreationDate="2014-07-25T21:49:18.007" Score="7" ViewCount="3061" Body="&lt;p&gt;I'm working on my first subfolder-based Craft site, so I'm relying on Asset URLs based on the &lt;code&gt;{{ siteUrl }}&lt;/code&gt; variable. I cannot, however, manage to get them working. Any tags I add to the URL field in the control panel get printed literally (not parsed) in the template output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My config.php looks like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;    ),&#xA;&#xA;    'foo.craft.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://foo.craft.dev/',&#xA;        'devMode' =&amp;gt; true&#xA;    ),&#xA;&#xA;    'foo.bar.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://foo.bar.com/',&#xA;        'devMode' =&amp;gt; true&#xA;    ),&#xA;&#xA;    'example.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://example.com/foo',&#xA;        'devMode' =&amp;gt; false&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Logos Asset settings look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NNqZY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a relevant chunk of template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;logos&quot;&amp;gt;&#xA;    {% for logo in logos.logoImages %}&#xA;        &amp;lt;a href=&quot;{{ logo.websiteUrl }}&quot; target=&quot;_blank&quot; style=&quot;background-image: url({{ logo.geturl() }}); padding-top: {{ logo.getHeight() }}px; width: {{ logo.getWidth() }}px;&quot;&amp;gt;{{ logo.companyName }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;background-image&lt;/code&gt; URL above renders out as &lt;code&gt;{siteUrl}assets/logos/logo.gif&lt;/code&gt;, which isn't parsed as I would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I done wrong?&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-07-25T21:54:28.530" Title="How can I set dynamic absolute Asset URLs?" Tags="&lt;assets&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1411" PostTypeId="2" ParentId="1410" CreationDate="2014-07-25T21:54:28.530" Score="8" Body="&lt;p&gt;If you want to use the {siteUrl} tag in your Asset source settings, you'll still additionally need to define it in your &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot;&gt;environment variables&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#comment1751_921&quot;&gt;here as well&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-25T21:54:28.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1412" PostTypeId="1" AcceptedAnswerId="1413" CreationDate="2014-07-25T22:24:08.983" Score="3" ViewCount="621" Body="&lt;p&gt;Can someone explain exactly what each of the above refers to when talking about assets? In particular, the difference between dateModified and dateUpdated.&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2014-07-26T00:47:26.250" Title="What is the difference between dateModified, dateCreated and dateUpdated?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1413" PostTypeId="2" ParentId="1412" CreationDate="2014-07-25T23:03:45.847" Score="8" Body="&lt;p&gt;&lt;code&gt;dateCreated&lt;/code&gt; and &lt;code&gt;dateUpdated&lt;/code&gt; are pretty standard columns that you can find in pretty much every Craft database table. They store the date in which the row was created and last updated, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;dateModified&lt;/code&gt; is an assets-specific thing, and that stores the time that the &lt;em&gt;file&lt;/em&gt; was last modified, according to the file system.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2014-07-26T00:47:26.250" LastActivityDate="2014-07-26T00:47:26.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1414" PostTypeId="2" ParentId="1409" CreationDate="2014-07-25T23:13:34.337" Score="12" Body="&lt;p&gt;You can save Matrix blocks directly, without having to re-save the entry.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Craft 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-matrixservice.html#method-saveblock&quot; rel=&quot;noreferrer&quot;&gt;MatrixService::saveBlock()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$block = new MatrixBlockModel();&#xA;$block-&amp;gt;fieldId = 5;&#xA;$block-&amp;gt;ownerId = 100;&#xA;$block-&amp;gt;ownerLocale = 'en_us';&#xA;$block-&amp;gt;typeId = 2;&#xA;$block-&amp;gt;sortOrder = 10;&#xA;&#xA;$block-&amp;gt;setContentFromPost(array(&#xA;    'fieldHandle' =&amp;gt; 'value',&#xA;    // ...&#xA;));&#xA;&#xA;$success = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Craft 3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-elements.html#method-saveelement&quot; rel=&quot;noreferrer&quot;&gt;craft\services\Elements::saveElement()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\elements\MatrixBlock;&#xA;&#xA;$block = new MatrixBlock();&#xA;$block-&amp;gt;fieldId = 5;&#xA;$block-&amp;gt;ownerId = 100;&#xA;$block-&amp;gt;siteId = 1;&#xA;$block-&amp;gt;typeId = 2;&#xA;$block-&amp;gt;sortOrder = 10;&#xA;&#xA;$block-&amp;gt;setFieldValues([&#xA;    'fieldHandle' =&amp;gt; 'value',&#xA;    // ...&#xA;]);&#xA;&#xA;$success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-11-21T20:40:46.887" LastActivityDate="2018-11-21T20:40:46.887" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1415" PostTypeId="1" AcceptedAnswerId="1418" CreationDate="2014-07-26T01:29:25.860" Score="7" ViewCount="1753" Body="&lt;p&gt;I'm trying to speed up the process of synchronizing my production site down to my local install. Currently, it is: Back up database, wipe local database, import database backup. It's not perfect, but it is pretty fast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But synchronizing the assets down is still a pain. Is there a process or plugin that makes it easy/easier to synchronize assets (uploaded photos, etc.) between installs?&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2014-07-28T13:17:57.303" LastActivityDate="2016-05-13T13:44:11.417" Title="Is there an easy way to download the assets directory to a local install?" Tags="&lt;assets&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1416" PostTypeId="2" ParentId="1415" CreationDate="2014-07-26T01:34:44.347" Score="4" Body="&lt;p&gt;I think this might be the plugin you are looking for: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/boboldehampsink/zipassets&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/zipassets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It allows you to download a zip of selected assets, might be easy to specify all assets within the plugin.&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-26T01:34:44.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1418" PostTypeId="2" ParentId="1415" CreationDate="2014-07-26T01:43:47.450" Score="7" Body="&lt;p&gt;I made a simple script to do this. It's much, much less powerful than Capistrano, but with a few tweaks I think it'll be more flexible (for starters, not requiring Ruby or learning Cap).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mattstauffer/syncCraft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mattstauffer/syncCraft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Original solution, pre-syncCraft:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, this is what I'm doing right now. It's not good enough, but I'll put it up for reference... I run this from the command line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scp myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's manual, and not smart enough to avoid overwriting stuff locally. I think I could use &lt;code&gt;rsync&lt;/code&gt; to avoid overwriting locally, but again, I feel like a Craft plugin might(?) be a better option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the &lt;code&gt;rsync&lt;/code&gt; version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rsync -auv myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2014-07-27T17:18:32.960" LastActivityDate="2014-07-27T17:18:32.960" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1419" PostTypeId="1" AcceptedAnswerId="1424" CreationDate="2014-07-26T06:00:04.940" Score="4" ViewCount="2922" Body="&lt;p&gt;I'm quite new to server config, so this might be a simple mistake. I have a local environment setup on my computer that works just fine. I uploaded my project to my staging server at AWS and the only thing that loads is the index.html in my &lt;code&gt;craft&lt;/code&gt; folder. For some reason it gives me a &lt;code&gt;&quot;The requested URL /css/bootstrap.min.css was not found on this server&quot;&lt;/code&gt; error for every folder or file I have inside of public folder. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA;* General Configuration&#xA;*&#xA;* All of your system's general configuration settings go in here.&#xA;* You can see a list of the default settings in craft/app/etc/config/defaults/general.php&#xA;*/&#xA;&#xA;return array(&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My craft folder in my staging is at: &lt;code&gt;/var/www/craft-portfolio/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Public folder is at: &lt;code&gt;/var/www/craft-portfolio&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The web root is the public folder that is &lt;code&gt;/var/www/craft-portfolio/public&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="125" LastEditDate="2014-07-26T13:42:13.073" LastActivityDate="2017-08-08T05:17:52.750" Title="CSS is not loading on staging server" Tags="&lt;config&gt;&lt;url&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1420" PostTypeId="2" ParentId="1415" CreationDate="2014-07-26T06:15:52.417" Score="4" Body="&lt;p&gt;You might want to take a look at capistrano if your looking at ways to automate sync mutliple environments:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://capistranorb.com/&quot; rel=&quot;nofollow&quot;&gt;http://capistranorb.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what your local environment is like but if you have ruby installed, capistrano might be be something to consider for automation. There are plenty examples across the web of how to use it to sync databases and folders. It used to be heavily tied to rails app but as of recent versions I believe it is more agnostic. I know I'll be looking into this in the coming weeks once I get some spare time.&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2014-07-26T06:15:52.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1421" PostTypeId="1" CreationDate="2014-07-26T06:28:03.357" Score="5" ViewCount="1811" Body="&lt;p&gt;I'm trying to get a basic console command for my plugin to run but not having much luck. I have created a folder called &lt;code&gt;consolecommands&lt;/code&gt; inside my plugin directory and have created a file called &lt;code&gt;AcmeNotificationsCommand.php&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this file I have:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class AcmeNotificationsCommand extends BaseCommand&#xA;{&#xA;    public function actionHello()&#xA;    {&#xA;        echo &amp;quot;hello&amp;quot;;&#xA;        return 0;&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;From the console I am running &lt;code&gt;/Users/dave/acme/craft/app/framework/yiic acmenotifications hello&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;But &lt;code&gt;yiic&lt;/code&gt; comes back and says:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;The following commands are available:&#xA;- migrate&#xA;- shell&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So I guess it's not picking up my new console command.  What am I missing?&lt;/p&gt;&#xA;&lt;h2&gt;Update:&lt;/h2&gt;&#xA;&lt;p&gt;It occurred to me that maybe I was running the wrong yiic file since I could not see the Querygen command that is in the app/consolecommands directory as expected.&lt;/p&gt;&#xA;&lt;p&gt;So instead I tried running /Users/dave/acme/craft/app/etc/console/yiic to see what commands were available and I got the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0 /Users/dave/code/acme/craft/app/Craft.php(397): CComponent-&amp;gt;__call('getTranslatedBr...', Array)&#xA;1 /Users/dave/code/acme/craft/app/Craft.php(397): Craft\ConsoleApp-&amp;gt;getTranslatedBrowserLanguage()&#xA;2 /Users/dave/code/acme/craft/app/etc/db/DbConnection.php(57): Craft\Craft::t('Craft can???t c...')&#xA;3 /Users/dave/code/acme/craft/app/framework/base/CModule.php(387): Craft\DbConnection-&amp;gt;init()&#xA;4 /Users/dave/code/acme/craft/app/etc/behaviors/AppBehavior.php(41): CModule-&amp;gt;getComponent('db')&#xA;5 [internal function]: Craft\AppBehavior-&amp;gt;isInstalled()&#xA;6 /Users/dave/code/acme/craft/app/framework/base/CComponent.php(261): call_user_func_array(Array, Array)&#xA;7 /Users/dave/code/acme/craft/app/services/PluginsService.php(89): CComponent-&amp;gt;__call('isInstalled', Array)&#xA;8 /Users/dave/code/acme/craft/app/services/PluginsService.php(89): Craft\ConsoleApp-&amp;gt;isInstalled()&#xA;9 /Users/dave/code/acme/craft/app/etc/console/ConsoleApp.php(53): Craft\PluginsService-&amp;gt;loadPlugins()&#xA;10 /Users/dave/code/acme/craft/app/framework/base/CApplication.php(165): Craft\ConsoleApp-&amp;gt;init()&#xA;11 /Users/dave/code/acme/craft/app/framework/YiiBase.php(121): CApplication-&amp;gt;__construct('/Users/dave/cod...')&#xA;12 /Users/dave/code/acme/craft/app/etc/console/yiic.php(76): YiiBase::createApplication('Craft\ConsoleAp...', '/Users/dave/cod...')&#xA;13 /Users/dave/code/acme/craft/app/etc/console/yiic(4): require_once('/Users/dave/cod...')&#xA;14 {main}%&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also noticed a similar error when looking at the databaseimportexport plugin. Not sure if this is a bug or whether I am still doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="590" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-12-09T16:41:58.530" Title="Trouble running a plugin console command" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1422" PostTypeId="2" ParentId="1421" CreationDate="2014-07-26T06:46:33.007" Score="1" Body="&lt;p&gt;Sounds like you haven't enabled the plugin from Settings-&gt;Plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you do that, yiic will register your plugin's custom command.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-26T06:46:33.007" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1423" PostTypeId="1" AcceptedAnswerId="22723" CreationDate="2014-07-26T09:53:53.720" Score="3" ViewCount="115" Body="&lt;p&gt;I'd like to use a tokenised image replacement technique which is commonly adopted in ExpressionEngine. This is where the author can add image tokens such as {image_1}, {image_2} etc into their content, and these get replaced by images defined in a matrix in the same publish form (with additional information such as image size etc). What technique can I use to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2017-11-10T16:57:12.977" Title="How to integrate an image haystack replacement technique" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1424" PostTypeId="2" ParentId="1419" CreationDate="2014-07-26T10:39:41.537" Score="8" Body="&lt;p&gt;There are multiple ways to set the URLs to your files. I don't know if I got your folder structure right. But let's suppose that your web root is set to&lt;br/&gt;&#xA;&lt;code&gt;/var/www/craft-portfolio/public/&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your CSS folder is&lt;br/&gt;&#xA;&lt;code&gt;/var/www/craft-portfolio/public/css/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and your Craft folder (actually not relevant) is&lt;br/&gt;&#xA;&lt;code&gt;/var/www/craft-portfolio/craft/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Root-relative URL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Root-relative URLs start with a &lt;code&gt;/&lt;/code&gt; character.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/css/build.css&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are using multiple environments, the path from the web root to your file has to be the same on each environment.&#xA;Something like this won't work with root-relative URLs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/css/build.css&#xA;http://192.168.178.20/projects/mysite/css/build.css&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Absolute URL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the complete URL of the CSS file to the link tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://mysite.com/css/build.css&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use Craft's global &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#siteUrl&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;siteUrl&lt;/code&gt;&lt;/a&gt; variable. To do that define the site's URL (&lt;code&gt;http://mysite.com/&lt;/code&gt;) in Settings → General in the Control Panel and add the variable to your tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{ siteUrl }}css/build.css&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to use the variable in a multi-environment setup, define it in your &lt;code&gt;general.php&lt;/code&gt; file (this overrides the CP settings):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '192.168.178.20' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://192.168.178.20/projects/mysite/',&#xA;    ),&#xA;&#xA;    'craft.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://craft.dev/',&#xA;    ),&#xA;&#xA;    'mysite.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://mysite.com/',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just be careful if you want to use this on a multilingual Craft site. If you have multiple locales configured, &lt;code&gt;siteUrl&lt;/code&gt; will be set to each locale's site URL, which might point to different folders.&#xA;You can avoid this by setting a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;noreferrer&quot;&gt;custom variable&lt;/a&gt; (eg. &lt;code&gt;baseUrl&lt;/code&gt;) in your &lt;code&gt;general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;    'baseUrl'  =&amp;gt; 'http://example.dev/',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then use the absolute URL like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{ craft.config.environmentVariables.baseUrl }}css/build.css&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-26T13:46:21.663" LastActivityDate="2014-07-26T13:46:21.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1425" PostTypeId="1" CreationDate="2014-07-26T16:09:23.667" Score="4" ViewCount="217" Body="&lt;p&gt;I'm building a plugin to add users to the system with set properties (like company) and permissions. The user form works with an &quot;Entries&quot; field and works with connected source section entries and works fine. Now when I receive the objects in my SiteAdministrator_UserService i'm trying to link the passed in companyId to the custom Entries field. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lNewUser = new UserModel();&#xA;$lNewUser-&amp;gt;status = UserStatus::Pending;&#xA;$lNewUser-&amp;gt;firstName = $aUser-&amp;gt;firstname;&#xA;$lNewUser-&amp;gt;username = $aUser-&amp;gt;username;&#xA;$lNewUser-&amp;gt;lastName = $aUser-&amp;gt;lastname;&#xA;$lNewUser-&amp;gt;email = $aUser-&amp;gt;emailaddress;&#xA;&#xA;$lCompany = craft()-&amp;gt;entries-&amp;gt;getEntryById($aUser-&amp;gt;companyId);&#xA;$lNewUser-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'companiesDropdown' =&amp;gt; $lCompany,&#xA;    ));&#xA;&#xA;return craft()-&amp;gt;users-&amp;gt;saveUser($lNewUser);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$lCompany holds the entry of the company, that works fine. Now how do I link the $lCompany to the first entry in the custom Entries (companiesDropdown handle) field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to clarify. All the above has nothing to do with an actual dropdown field.&#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastEditorUserId="571" LastEditDate="2014-07-26T16:23:40.270" LastActivityDate="2014-07-26T16:41:46.490" Title="How to add/link an entry to an object using PHP?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1426" PostTypeId="2" ParentId="1423" CreationDate="2014-07-26T16:10:00.307" Score="6" Body="&lt;p&gt;This generally isn't necessary in Craft. You can use a Matrix Field and combination of Matrix Blocks to build advanced content with flexible images. This is really the best way to go if it's an option.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-07-26T16:10:00.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1427" PostTypeId="2" ParentId="1425" CreationDate="2014-07-26T16:41:46.490" Score="4" Body="&lt;p&gt;Ah got it : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lNewUser-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'companiesDropdown' =&amp;gt; array($aUser-&amp;gt;companyId),&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-07-26T16:41:46.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1428" PostTypeId="1" AcceptedAnswerId="1430" CreationDate="2014-07-26T17:39:52.177" Score="4" ViewCount="3333" Body="&lt;p&gt;I am absolutely new to craft plugin development and could not find any documentation on creating database tables specific to a new plugin. How are new tables created when a plugin is installed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am browsing through the source code for the &lt;code&gt;CocktailRecipes&lt;/code&gt; plugin: &lt;a href=&quot;https://github.com/adrianmacneil/cocktailrecipes/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/adrianmacneil/cocktailrecipes/&lt;/a&gt; and I cannot find how the &lt;code&gt;craft_cocktailrecipes_ingredients&lt;/code&gt; table gets created when I install it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it merely a matter of defining a record class like &lt;code&gt;CocktailRecipes_IngredientRecord&lt;/code&gt; and then overriding the &lt;code&gt;getTableName&lt;/code&gt; and &lt;code&gt;defineAttributes&lt;/code&gt; methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that how craft cms builds the tables?&lt;/p&gt;&#xA;" OwnerUserId="597" LastActivityDate="2014-07-26T20:45:26.717" Title="How do I create database tables for a craft cms plugin on install?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1429" PostTypeId="1" AcceptedAnswerId="16714" CreationDate="2014-07-26T17:59:10.883" Score="6" ViewCount="981" Body="&lt;p&gt;My edit profile page doensn't save all fields:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/users/{{ user.username }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;      &amp;lt;legend&amp;gt;Your Photo&amp;lt;/legend&amp;gt;&#xA;    {# Check to see if the user has a photo  #}&#xA;    {% if currentUser.photoUrl %}&#xA;&#xA;      &amp;lt;figure&amp;gt;&amp;lt;img src=&quot;{{ currentUser.photoUrl(200) }}&quot; /&amp;gt;&amp;lt;/figure&amp;gt;&#xA;    {# If a photo exists, give the option to change the user photo #}&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Change Photo&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% else %}&#xA;&#xA;    {# If no photo exists, give the option to upload a new one #}&#xA;    &amp;lt;figure&amp;gt;&amp;lt;img src=&quot;/assets/img/user.gif&quot; /&amp;gt;&amp;lt;/figure&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;&#xA;&#xA;  &amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;legend&amp;gt;Your Login Details&amp;lt;/legend&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;email&quot;&amp;gt;Email address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;email&quot; class=&quot;form-control&quot; id=&quot;email&quot; name=&quot;fields[email]&quot; value=&quot;{{ user.email }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;&#xA;  &amp;lt;fieldset&amp;gt;&#xA;  &amp;lt;legend&amp;gt;Your Personal Details&amp;lt;/legend&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;firstName&quot; name=&quot;fields[firstName}&quot; value=&quot;{{ user.firstName }}&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;lastName&quot; name=&quot;fields[lastName]&quot; value=&quot;{{ user.lastName }}&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;phoneNumber&quot;&amp;gt;Contact Number&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;phoneNumber&quot; name=&quot;fields[phoneNumber]&quot; value=&quot;{{ user.phoneNumber}}&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;&#xA;  &amp;lt;fieldset&amp;gt;&#xA;    {% set pets = craft.fields.getFieldbyHandle('pets') %}&#xA;&#xA;  &amp;lt;legend&amp;gt;Your Property Details&amp;lt;/legend&amp;gt;&#xA;  &amp;lt;label for=&quot;pets&quot;&amp;gt;{{ pets.instructions }}&amp;lt;/label&amp;gt;&#xA;  &amp;lt;select class=&quot;form-control margin-bottom&quot; id=&quot;pets&quot; name=&quot;fields[pets]&quot;&amp;gt;&#xA;    {% for option in user.pets.options %}&#xA;    &amp;lt;option {% if option.selected %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  {% set renting = craft.fields.getFieldbyHandle('renting') %}&#xA;&#xA;  &amp;lt;label for=&quot;renting&quot;&amp;gt;{{ renting.instructions }}&amp;lt;/label&amp;gt;&#xA;  &amp;lt;select class=&quot;form-control margin-bottom&quot; id=&quot;renting&quot; name=&quot;fields[renting]&quot;&amp;gt;&#xA;    {% for option in user.renting.options %}&#xA;    &amp;lt;option {% if option.selected %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;&#xA;&#xA;  &amp;lt;input type=&quot;submit&quot; class=&quot;btn btn-primary pull-right margin-top&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It only saves the last two fields which means that a user can't change their email address, name or phone number. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've recently updated Craft to the latest build (Craft Pro 2.1.2566) and also changed user/saveProfile to user/saveUser.&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="9" LastEditDate="2014-07-27T19:11:39.833" LastActivityDate="2016-09-07T04:44:51.587" Title="User Profile Not Saving Changes" Tags="&lt;user-profile&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1430" PostTypeId="2" ParentId="1428" CreationDate="2014-07-26T18:07:37.663" Score="2" Body="&lt;p&gt;Yep, that's it, check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Records documentation&lt;/a&gt; to learn more:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Active record models (or “records”) are like models, except with a&#xA;  database-facing layer built on top. On top of all the things that&#xA;  models can do, records can:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Define database table schemas&lt;/strong&gt;&lt;/li&gt;&#xA;  &lt;li&gt;Represent rows in the database&lt;/li&gt;&#xA;  &lt;li&gt;Find, alter, and delete rows&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also, you might find &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;&quot;Creating Database Migrations&quot;&lt;/a&gt; interesting.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-26T18:07:37.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1431" PostTypeId="2" ParentId="1429" CreationDate="2014-07-26T18:41:35.447" Score="2" Body="&lt;p&gt;For starters I see you have a typo...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fields[firstName}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fields[firstName]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ user.phoneNumber}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ user.phoneNumber }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2014-07-26T18:58:20.330" LastActivityDate="2014-07-26T18:58:20.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1432" PostTypeId="2" ParentId="1428" CreationDate="2014-07-26T18:55:16.920" Score="4" Body="&lt;p&gt;&lt;code&gt;PluginNameRecord.php&lt;/code&gt; is how Craft installs database tables. You can also have multiple tables by using &lt;code&gt;PluginName_TableRecord.php&lt;/code&gt; where 'Table' will be the name of the new table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might also be worthwhile to mention that the cocktails recipe you linked to has a lot of issues as it has not been updated for the latest versions of Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sean Delaney updated that plugin and the new repository is here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/seandelaney/cocktailrecipes&quot; rel=&quot;nofollow&quot;&gt;https://github.com/seandelaney/cocktailrecipes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-26T20:45:26.717" LastActivityDate="2014-07-26T20:45:26.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1433" PostTypeId="2" ParentId="1429" CreationDate="2014-07-26T20:50:54.333" Score="7" Body="&lt;p&gt;&lt;code&gt;firstName&lt;/code&gt;, &lt;code&gt;lastName&lt;/code&gt;, and &lt;code&gt;email&lt;/code&gt; are actual user fields (not custom), so their &lt;code&gt;name=&lt;/code&gt; attributes shouldn’t have the &lt;code&gt;fields[]&lt;/code&gt; namespace.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;email&quot; class=&quot;form-control&quot; id=&quot;email&quot; name=&quot;email&quot; value=&quot;{{ user.email }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;firstName&quot; name=&quot;firstName&quot; value=&quot;{{ user.firstName }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;lastName&quot; name=&quot;lastName&quot; value=&quot;{{ user.lastName }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m guessing that once you fix those, your &lt;code&gt;phoneNumber&lt;/code&gt; custom field will also start saving.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-26T20:50:54.333" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1434" PostTypeId="2" ParentId="1415" CreationDate="2014-07-27T05:18:31.613" Score="8" Body="&lt;p&gt;I use &lt;code&gt;rsync&lt;/code&gt; with &lt;a href=&quot;http://gruntjs.com/&quot;&gt;grunt&lt;/a&gt;. There is a &lt;a href=&quot;https://github.com/jedrichards/grunt-rsync&quot;&gt;grunt rsync task&lt;/a&gt;, which is just a wrapper for raw rsync. If all I used grunt for was the rsync I don't think it would be worth it, but I use it to compile my sass, and to reload my browser (&lt;a href=&quot;https://github.com/gruntjs/grunt-contrib-sass&quot;&gt;grunt-contrib-sass&lt;/a&gt;, &lt;a href=&quot;https://github.com/gruntjs/grunt-contrib-watch&quot;&gt;grunt-contrib-watch&lt;/a&gt;) among other things.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-27T05:18:31.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1435" PostTypeId="2" ParentId="1415" CreationDate="2014-07-27T06:30:49.643" Score="6" Body="&lt;p&gt;Another alternative to grunt is to use &lt;a href=&quot;http://gulpjs.com/&quot;&gt;http://gulpjs.com/&lt;/a&gt;. This is what I use for minifying css js and assets etc. I've been meaning to setup a way of syncing folders so I've put together gulp task to do it. I have roughly tested it but you might want to look over the code before you use it on a production site :) Be aware that it is setup to sync the folder so it will remove any local files that are not present on your staging/production server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use gulp you need to have node.js installed with npm. First install gulp globally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;npm install -g gulp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you might need to run that as sudo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, in the root of your craft project create a gulpfile.js that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Gulp&#xA;var gulp = require('gulp');&#xA;&#xA;// Plugins&#xA;var rsync = require(&quot;rsyncwrapper&quot;).rsync;&#xA;&#xA;// Pull down assets and sync local folder&#xA;gulp.task('synclocal', function(){&#xA;    rsync({&#xA;        src: &quot;username@hostname.com:/path/to/assets&quot;,&#xA;        dest: &quot;assets&quot;,&#xA;        ssh: true,&#xA;        recursive: true,&#xA;        syncDest: true,&#xA;        compareMode: &quot;checksum&quot;&#xA;    },function (error,stdout,stderr,cmd) {&#xA;        if ( error ) {&#xA;            // failed&#xA;            console.log(error.message);&#xA;        } else {&#xA;            // success&#xA;            console.log(&quot;folder synced!&quot;)&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally we need to make sure rsyncwrapper is install. You can do this by running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;npm install rsyncwrapper&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should now be able to run the task by typing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gulp synclocal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="590" LastActivityDate="2014-07-27T06:30:49.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1436" PostTypeId="1" AcceptedAnswerId="1437" CreationDate="2014-07-27T18:18:59.627" Score="10" ViewCount="1073" Body="&lt;p&gt;There is almost never a reason why I would want an image to be scaled past 100% by a transform. This usually results in an image being looking worse than it would if scaled by the browser. Is there a way to tell Craft not to scale an image past 100% of its original size, even if the transform width is larger?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2019-11-07T14:51:05.343" Title="Prevent Asset Transforms from scaling Image past 100%" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1437" PostTypeId="2" ParentId="1436" CreationDate="2014-07-27T18:53:04.030" Score="10" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#getWidth&quot;&gt;getWidth&lt;/a&gt; will give you an image's width: &lt;code&gt;{% set originalWidth = image.getWidth(false) %}&lt;/code&gt;. You want to apply the transform if &lt;code&gt;desiredWidth&lt;/code&gt; is less than &lt;code&gt;originalWidth&lt;/code&gt;. I would write a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot;&gt;twig macro&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro transform(image, desiredWidth) %}&#xA;  {% set originalWidth = image.getWidth(false) %}&#xA;  {% if desiredWidth &amp;lt; originalWidth %}&#xA;    {{ image.getUrl({mode: 'fit', width: desiredWidth}) }}&#xA;  {% else %}&#xA;    {{ image.getUrl() }}&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also do the same test, and then conditionally &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#setTransform&quot;&gt;setTransform&lt;/a&gt; on the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms#defining-transforms-from-the-control-panel&quot;&gt;define your transforms in the CP&lt;/a&gt; the macro would be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro transform(image, transformHandle) %}&#xA;  {% set originalWidth = image.getWidth(false) %}&#xA;  {% set transformedWidth = image.getWidth(transformHandle) %}&#xA;  {% if transformedWidth &amp;lt; originalWidth %}&#xA;    {{ image.getUrl(transformHandle) }}&#xA;  {% else %}&#xA;    {{ image.getUrl() }}&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="125" LastEditDate="2014-07-27T21:55:02.133" LastActivityDate="2014-07-27T21:55:02.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1438" PostTypeId="1" CreationDate="2014-07-27T19:41:59.953" Score="2" ViewCount="499" Body="&lt;p&gt;I'm trying to customise the elementindex view. For example I want to filter out some entries that don't match certain criteria. Also if possible add some hooks to the read calls. Is there any documentation available about this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-07-27T20:40:02.207" Title="Any documentation about the elementindex template available?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1439" PostTypeId="1" AcceptedAnswerId="1440" CreationDate="2014-07-27T19:43:19.820" Score="6" ViewCount="1503" Body="&lt;p&gt;I have this in my listings template, but the 'pending' parameter does not seem to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set urlCat = craft.request.getSegment(3) %}&#xA;{% set category = craft.categories.slug( urlCat ) %}&#xA;{% set allEntries =  craft.entries.status('live, pending').section('sectionName').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to only return 'live' entries even though I do have 'pending' specified.  I've tried this several ways and cannot seem to make it work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strange thing is that this seems to work fine on my single entry page where I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('sectionName').slug(selected).status(&quot;live, pending&quot;).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?  Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2018-08-08T19:53:10.080" Title="How do I find live and pending entries when using an array?" Tags="&lt;status&gt;&lt;pending&gt;&lt;array&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1440" PostTypeId="2" ParentId="1439" CreationDate="2014-07-27T20:02:24.980" Score="4" Body="&lt;p&gt;You can get all entries regardless of status with &lt;code&gt;.status(null)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries =  craft.entries.section('sectionName').relatedTo(category).status(null).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-27T20:02:24.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1441" PostTypeId="2" ParentId="1439" CreationDate="2014-07-27T20:32:29.637" Score="3" Body="&lt;p&gt;Try to set both states in single/double quotes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.status('live', 'pending').section('sectionName').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-27T20:32:29.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1442" PostTypeId="1" CreationDate="2014-07-27T20:32:32.500" Score="2" ViewCount="827" Body="&lt;p&gt;I'm having trouble registering a CP route. What I have is a &quot;working&quot; SiteAdministrator_UserController.php (other form save actions already work through this controller, so its functional). Inside the controller I have a function :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCurrent()&#xA;{&#xA;    die ('Works!');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my Plugin I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'siteadministator/currentusers' =&amp;gt; array('action' =&amp;gt; 'siteAdministrator/user/current')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;trying the uri &lt;a href=&quot;http://cms.craft.dev/admin/siteadministrator/currentusers&quot; rel=&quot;nofollow&quot;&gt;http://cms.craft.dev/admin/siteadministrator/currentusers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft says its a  404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong and/or is there a way to debug this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2015-06-12T13:14:14.767" Title="Havin trouble with registerCpRoutes" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1443" PostTypeId="2" ParentId="1438" CreationDate="2014-07-27T20:40:02.207" Score="3" Body="&lt;p&gt;Your best bet on learning element type templating is to look at Craft template itself. Element types use the following template for controlling the layout:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/app/templates/_layouts/elementindex.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, its important to know that you should only be using the &lt;code&gt;elementindex&lt;/code&gt;if you are creating a custom element type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the &lt;code&gt;element index&lt;/code&gt;, a good portion of the options are actually set through Javascript by Craft using &lt;a href=&quot;https://github.com/pixelandtonic/Garnish&quot; rel=&quot;nofollow noreferrer&quot;&gt;Garnish&lt;/a&gt;. If you look at the following code, you can see that the status, template side, is set via Garnish. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block initJs %}&#xA;Craft.createElementIndex('{{ elementTypeClass }}', $('#main'), {&#xA;    context:        '{{ context }}',&#xA;    showStatusMenu: {{ showStatusMenu is defined ? showStatusMenu|json_encode|raw : &quot;'auto'&quot; }},&#xA;    showLocaleMenu: {{ showLocaleMenu is defined ? showLocaleMenu|json_encode|raw : &quot;'auto'&quot; }},&#xA;    storageKey:     'elementindex.{{ elementTypeClass }}',&#xA;    criteria:       { localeEnabled: null }&#xA;});&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can set custom statuses on your element type, if that is the route you are looking to travel. I have dug into element types and custom statuses on these posts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/907/how-to-integrate-custom-statuses-in-a-workflow-style-custom-element-type&quot;&gt;How to integrate custom statuses in a workflow style custom element type?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1097/best-way-to-use-custom-enums-in-my-plugin-templates&quot;&gt;Best way to use custom enums in my plugin templates?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/887/best-way-to-implement-my-own-statuses-on-my-custom-element-type&quot;&gt;Best way to implement my own statuses on my custom element type?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As for Craft documentation, they are working on it still and the only thing available right now is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements#creating-new-element-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating new Element Types&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-27T20:40:02.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1444" PostTypeId="2" ParentId="1442" CreationDate="2014-07-27T20:47:09.983" Score="3" Body="&lt;p&gt;The documentation on Craft's website covers registering control panel routes here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot; rel=&quot;nofollow&quot;&gt;Posting to Controller Actions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the documentation your route is setup correctly. I have had an experience where a route would not register. I took the following steps to troubleshoot:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Uninstalled the plugin&lt;/li&gt;&#xA;&lt;li&gt;Reinstalled the plugin&lt;/li&gt;&#xA;&lt;li&gt;Checked spelling on the controller and the main plugins class 'registerCpRoutes' method.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, if you are at a point where uninstalling is out of the question, I would again check for spelling and make sure there are no typos or missing brackets in the controller and main plugin class. In my case, I found a small typo and that corrected my issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Debugging/Linters&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on what text editor you are using, you might also want to look at using a Linter. A linter for PHP essentially runs the command line &lt;code&gt;php -l&lt;/code&gt; which will check the syntax on your PHP file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use Atom on a daily basis and use the &lt;a href=&quot;https://atom.io/packages/linter-php&quot; rel=&quot;nofollow&quot;&gt;Atom Linter&lt;/a&gt; package. However, I know Sublime has a Linter package as well but I am not familiar with that one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Helper Plugins&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to look into installing this plugin from Matt Stauffer: &lt;a href=&quot;https://github.com/mattstauffer/craftPluginDevHelpers&quot; rel=&quot;nofollow&quot;&gt;Plugin Dev Helpers&lt;/a&gt;. This will allow you to use the 'die and dump' helper that exists in the Laravel framework. Essentially allowing you to use &lt;code&gt;dd($anyVariableName)&lt;/code&gt;, which will dump and die but allows you to pass variables to the output.&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-27T21:34:44.983" LastActivityDate="2014-07-27T21:34:44.983" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1445" PostTypeId="1" AcceptedAnswerId="1446" CreationDate="2014-07-27T21:55:30.007" Score="2" ViewCount="1561" Body="&lt;p&gt;I'm in the process of setting up Asset image transforms for my site and was playing with the quality setting to find the right balance between file size vs. output image quality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As part of the testing process I was outputting matching images at the same final transform size in Photoshop at various levels of &quot;Save for Web...&quot; quality. I was surprised to see that the images Craft was generating were consistently larger in file size  than the images Photoshop was generating with approximately the same final visual quality. Typically the difference was anywhere from 20-40%. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels important to note that I realize that Craft's image transform quality settings don't equate to Photoshop's &quot;Save for Web...&quot; quality settings (i.e. using a quality setting of 65 in Photoshop is &lt;strong&gt;not&lt;/strong&gt; the same as using an image transform quality setting of 65 in Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested a variety of image types at a variety of transform and quality settings and found the results to be roughly the same in every scenario. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious if anyone else has seen / noticed this issue and if there might be a fix.&lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2014-07-28T02:59:16.623" Title="Using image transforms sometimes results in bloated file sizes." Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1446" PostTypeId="2" ParentId="1445" CreationDate="2014-07-27T22:34:01.347" Score="5" Body="&lt;p&gt;Is Imagick installed on your server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, Craft uses GD as a &quot;fallback&quot;. Chances are that transforms with GD lead to poorer image quality and longer calculation times. I'm not sure about ICC profiles, but I think they only get included using Imagick (photos can look really bad if profile is missing unexpectedly!).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-27T22:34:01.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1447" PostTypeId="1" AcceptedAnswerId="1448" CreationDate="2014-07-27T22:50:12.910" Score="2" ViewCount="1124" Body="&lt;p&gt;I am finishing up the last few details on my custom element type. I have custom statuses and public submissions working. The last detail is providing validation on custom fields set through the field layout outside of the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a brief overview of the plugin:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;PluginNameElementType - that allows custom fields via the field layout.&lt;/li&gt;&#xA;&lt;li&gt;PluginNameController - which has an action 'actionSubmit' which is allowed public access to submit entries outside of the control panel. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The code for public submission is on this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1261/allow-anonymous-submission-on-a-custom-element-type&quot;&gt;Allow anonymous submission on a custom element type?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen some Yii examples that include &lt;code&gt;CActiveForm::validate()&lt;/code&gt; and pass a  model to validate the input, but I don't see that anywhere in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I see it, there are two parts to validation on custom element types from outside of the control panel.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part being providing authentication for the attributes defined as 'required' in the element types model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array_merge(&#xA;        parent::defineAttributes(), array(&#xA;            'formId' =&amp;gt; array(&#xA;                AttributeType::Number,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'fieldName1' =&amp;gt; array(&#xA;                AttributeType::String,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'fieldName2' =&amp;gt; array(&#xA;                AttributeType::String,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;        )&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I access and return this in the controller action method that allows public submission? Does Craft provide an additional layer on top of Yii to assist with validation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part of the question is similar, but unique all the same. The other part I need to provide validation for is the custom fields set in the field layout of the element type. If a user sets the fields to required in the same method they would with a regular entry field. How would I access validation on the custom fields level?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-28T00:01:46.500" Title="Using the required field validation in custom element types/plugins?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;elementtype&gt;&lt;custom-field&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1448" PostTypeId="2" ParentId="1447" CreationDate="2014-07-28T00:01:46.500" Score="2" Body="&lt;p&gt;Custom field validation happens automatically for you when you pass your element into &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement()&lt;/code&gt;. That function will return &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;, largely depending on whether custom field validation passes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;code&gt;EntriesService::saveEntry()&lt;/code&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-28T00:01:46.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1449" PostTypeId="2" ParentId="454" CreationDate="2014-07-28T00:33:28.847" Score="2" Body="&lt;p&gt;Looks like you have to do a bit of fudging if your running the $model-&gt;validate() function in your controller. assetId has to be set correctly before it jumps over to Service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still run the following in my &lt;strong&gt;Controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$reorder = craft()-&amp;gt;request-&amp;gt;getPost('assetId', $model-&amp;gt;assetId);&#xA;$model-&amp;gt;assetId = (!empty($reorder) ? $reorder[0] : null);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I run this in my &lt;strong&gt;Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record-&amp;gt;assetId = $model-&amp;gt;assetId;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tell me if I've missed something here.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-07-28T00:33:28.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1450" PostTypeId="2" ParentId="1442" CreationDate="2014-07-28T01:34:12.080" Score="5" Body="&lt;p&gt;Based on your code excerpts, things look good.  I've encountered issues with spelling and caps  when referencing controllers and templates within my controllers...so pay close attention to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest referencing the 'Cocktail Recipes' sample plugin: &lt;a href=&quot;https://github.com/seandelaney/cocktailrecipes&quot; rel=&quot;nofollow&quot;&gt;https://github.com/seandelaney/cocktailrecipes&lt;/a&gt; (Craft 2.x) as it contains an example of what you're trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Updated link to Craft 2.x version as per comment below.&lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="142" LastEditDate="2015-06-12T13:14:14.767" LastActivityDate="2015-06-12T13:14:14.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1452" PostTypeId="2" ParentId="1445" CreationDate="2014-07-28T02:59:16.623" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1446/57&quot;&gt;Christian is most likely correct.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will try to use &lt;a href=&quot;http://php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagick&lt;/a&gt; if it is available, because it's infinitely more flexible and produces better quality images, but that is at the expense of larger file sizes.  Craft will fallback to &lt;a href=&quot;http://php.net/manual/en/book.image.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;GD&lt;/a&gt;, because it's installed on practically every host in the world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can manually tell Craft which image processing library to use with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#imageDriver&quot; rel=&quot;nofollow noreferrer&quot;&gt;imageDriver&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When an image is first uploaded, Craft will &quot;sanitize&quot; the image for any malicious code by re-saving the image out to a new file.  It jumps through some pretty significant to ensure that the sanitized image is as close to possible as the originally uploaded image in both quality and file size, which usually explains the differences people see in file sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this process does not happen during an image transform (for obvious reasons), which leads us back to the image processing extension in use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-28T02:59:16.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1453" PostTypeId="1" AcceptedAnswerId="1455" CreationDate="2014-07-28T05:15:00.317" Score="5" ViewCount="468" Body="&lt;p&gt;I'm trying to add entries to a Matrix block with one field type of 'entry' using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block = new MatrixBlockModel();&#xA;$block-&amp;gt;fieldId    = 9;             // Matrix field's ID&#xA;$block-&amp;gt;ownerId    = $collectionID; // ID of entry the block should be added to&#xA;$block-&amp;gt;typeId     = 2;             // ID of block type&#xA;$block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'contentRss' =&amp;gt; array($entry-&amp;gt;id)&#xA;));&#xA;&#xA;$success = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code saves the new block and entry, but when I view the entry it has not linked the entry. I notice in the database tables it has not created an entry in the &lt;code&gt;craft_relations&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong? :)&lt;/p&gt;&#xA;" OwnerUserId="448" LastEditorUserId="57" LastEditDate="2016-02-19T17:12:40.370" LastActivityDate="2016-02-19T17:12:40.370" Title="Saving related entry in a Matrix block programmaticially" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1454" PostTypeId="1" AcceptedAnswerId="1465" CreationDate="2014-07-28T07:18:24.713" Score="8" ViewCount="1113" Body="&lt;p&gt;Since there is a free edition and the plugin architecture looks relatively simple, I'd like to know if anyone has an idea of how this could work. Are there any plans for it?&lt;/p&gt;&#xA;" OwnerUserId="100" LastEditorUserId="45" LastEditDate="2018-08-20T21:33:29.987" LastActivityDate="2018-08-20T21:35:20.063" Title="What would it take to make Craft composer based?" Tags="&lt;composer&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1455" PostTypeId="2" ParentId="1453" CreationDate="2014-07-28T08:03:30.673" Score="7" Body="&lt;p&gt;Possibly a duplicate of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1101/how-to-save-a-matrix-content-of-a-new-entry-in-my-plugin/1218&quot;&gt;this one here&lt;/a&gt; but hey, here is where I think you are going wrong:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Change this part:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;  'contentRss' =&amp;gt; array($entry-&amp;gt;id)&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block-&amp;gt;getContent()-&amp;gt;contentRss = array($entry-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-28T08:03:30.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1456" PostTypeId="1" CreationDate="2014-07-28T09:03:55.687" Score="2" ViewCount="601" Body="&lt;p&gt;I've created a simple plugin based on the Craft docs with the following directory structure...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;    /plugins&#xA;        /eforms&#xA;            /resources&#xA;                /js&#xA;                    public.js&#xA;            /templates&#xA;                /public&#xA;                    index.html&#xA;/public_html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the index.html template of my plugin I'm using the following line to try to include the public.js file...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource &quot;eforms/js/public.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which attempts to include the following resource in the browser&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mydomain/eforms/js/public.js&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this just gives me a 404. Does anyone have an idea of what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2019-07-17T01:27:10.073" Title="Including plugin javascript on the client side" Tags="&lt;plugin-development&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1457" PostTypeId="2" ParentId="1456" CreationDate="2014-07-28T10:11:35.283" Score="4" Body="&lt;p&gt;Think you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UrlHelper::getResourceUrl('path/to/file.ext')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is more info over at &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/resources&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/resources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;ok, scrap that answer, I didn't read the rest of the help page :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you are nearly there though. I'll have a test on my local machine and get back to you.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I believe I'm running into the same problem you have described as well. I did however get it working by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ resourceUrl('eforms/js/public.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="590" LastEditorUserId="590" LastEditDate="2014-07-28T10:46:29.993" LastActivityDate="2014-07-28T10:46:29.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1458" PostTypeId="1" AcceptedAnswerId="1459" CreationDate="2014-07-28T10:39:43.403" Score="10" ViewCount="2367" Body="&lt;p&gt;I am wondering what would be the best approach to add another file type to the 'Restrict allowed file types' asset field settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For our website specification we need to have .zip files and .pdf files only for this field, however I can only restrict to .pdf.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-04-29T13:21:29.217" LastActivityDate="2017-07-11T13:25:04.337" Title="How to add more options to the 'Restrict allowed file types' settings?" Tags="&lt;assets&gt;&lt;fieldtypes&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1459" PostTypeId="2" ParentId="1458" CreationDate="2014-07-28T12:13:54.073" Score="5" Body="&lt;p&gt;Currently, no. The list you see there is the result of a function in &lt;code&gt;IOHelper&lt;/code&gt; called &lt;code&gt;getFileKinds&lt;/code&gt;. It just hands out an array of options. While I don't have a recommendation for making this work, I do suggest you send a feature request to: support@buildwithcraft.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With it already being a function, I can see there being a possibility of them allowing users to add custom restricted extension options via a config setting.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-07-28T12:13:54.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1460" PostTypeId="1" AcceptedAnswerId="1470" CreationDate="2014-07-28T13:22:49.890" Score="3" ViewCount="509" Body="&lt;p&gt;I'm setting up a site with several channels, and the design requires an introductory paragraph at the top of each channel's index page (ie. before the list of entries) - essentially a post that corresponds to the channel's index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, there's only a template but no entry corresponding to the index of a channel, so I'm wondering how best to handle this in Craft. I definitely don't want it hard-coded in the template, and ideally it should be somewhere reasonably intuitive for site admins to find and edit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels like it should be straightforward to implement, but I just can't quite think how to do it. Any suggestions would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="328" LastEditDate="2014-07-28T14:56:01.970" LastActivityDate="2014-07-28T16:23:40.763" Title="How to handle custom text on a channel index page?" Tags="&lt;sections&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1461" PostTypeId="1" CreationDate="2014-07-28T13:33:52.083" Score="2" ViewCount="465" Body="&lt;p&gt;Curious if anything exists like this for Craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.wpexplorer.com/create-rss-news-aggregation-portal-wordpress/&quot; rel=&quot;nofollow&quot;&gt;http://www.wpexplorer.com/create-rss-news-aggregation-portal-wordpress/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just looking for something that can look at an RSS feed and post entries to a Craft powered site.&lt;/p&gt;&#xA;" OwnerUserId="598" LastActivityDate="2014-07-28T15:27:46.240" Title="RSS Aggregator for Craft?" Tags="&lt;rss&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1462" PostTypeId="2" ParentId="1461" CreationDate="2014-07-28T14:02:33.710" Score="2" Body="&lt;p&gt;Perhaps the following plugin could help to import entries from RSS:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/clearbold/craftimport&quot; rel=&quot;nofollow&quot;&gt;Craft CMS plugin to import entries from XML&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2014-07-28T14:02:33.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1463" PostTypeId="1" AcceptedAnswerId="1472" CreationDate="2014-07-28T14:07:14.180" Score="2" ViewCount="832" Body="&lt;p&gt;I'm just getting to grips with Craft but it seems very flexible. To try it out I have set up a structure to store some sample products. These products have an image, text, tags and belong to a category (E.g cakes). I can sort and output products, display in groups even sort by tag - brilliant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I struggling with is how assign a image and other fields to the category? So that I can then have a page with a list of categories each with an image and text Or even output a single category that I want to highlight on another page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should this be a &quot;parent&quot; entry? If so how do I assign a set of fields to the parent item but not the child? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly I am thinking about approaching this the wrong way and I should create a &quot;types&quot; structure in which the entries have a required field that is the &quot;category&quot; and use this to search for any products of matching category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Confused - any pointers appreciated.&lt;/p&gt;&#xA;" OwnerUserId="487" LastActivityDate="2014-07-28T16:50:57.110" Title="Possible to assign fields (or an image) to a category?" Tags="&lt;entries&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1464" PostTypeId="2" ParentId="1461" CreationDate="2014-07-28T15:27:46.240" Score="2" Body="&lt;p&gt;Until the plugin store becomes an &quot;official thing&quot;, the best, most curated list of plugins available for Craft is over at &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing anything that would do exactly what you're looking for, but it wouldn't be a difficult one to write.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-28T15:27:46.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1465" PostTypeId="2" ParentId="1454" CreationDate="2014-07-28T15:35:21.090" Score="5" Body="&lt;p&gt;I'm not 100% sure what you're looking for, but Craft does use Composer to manage its own dependencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're referring to using Composer in your plugin, it's as simple as creating your composer.json file in your plugin's root folder and running &lt;code&gt;composer update&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-28T15:35:21.090" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1466" PostTypeId="1" AcceptedAnswerId="1476" CreationDate="2014-07-28T15:52:14.730" Score="4" ViewCount="165" Body="&lt;p&gt;is it possible for S3 bucket assets to use reduced redundancy storage?&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2014-07-28T19:59:53.717" Title="Assets and S3 - Reduced Redundacy Storage" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1467" PostTypeId="1" AcceptedAnswerId="1811" CreationDate="2014-07-28T15:53:47.047" Score="24" ViewCount="7752" Body="&lt;p&gt;I am using a structure for all of my site's pages (single pages and channel index pages). The structure settings are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL for Top-Level Entries:&lt;br/&gt;&#xA;&lt;code&gt;{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL for Nested Entries:&lt;br/&gt;&#xA;&lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry Template:&lt;br/&gt;&#xA;&lt;code&gt;_pages/_entry.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I set up multiple entry types for the structure to relate the pages with individual templates (basically as &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot;&gt;described in the FAQs&lt;/a&gt;). This is my &lt;code&gt;_entry.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_pages/_types/' ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works great for me [*], but now I'd like to further improve the template setup by adding my site's home page to the structure, too. With a single section I can simply trigger the option &quot;this is the home page&quot; in the section's settings, but how can I tell an entry of my pages structure to be my home page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;[*]: I can generate my site's main navigation from this structure (nice!) and all channels' index pages have entry slugs now, which is incredibly helpful in a multi-lingual Craft setup, if you want to translate your slugs.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-13T21:12:54.350" LastActivityDate="2018-11-30T08:36:35.313" Title="Add home page to a structure?" Tags="&lt;url&gt;&lt;navigation&gt;&lt;structure&gt;&lt;slug&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="1468" PostTypeId="1" AcceptedAnswerId="1469" CreationDate="2014-07-28T16:07:45.617" Score="4" ViewCount="718" Body="&lt;p&gt;I've got a Assets field which is limited to 1 asset inside a Matrix field. Is there a better way to fetch the image without using a forloop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the minute I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for image in block.backgroundImage %}&#xA;    {{ image.getUrl() }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it just doesn't seem right using a forloop when I know there is only one image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="601" LastEditorUserId="125" LastEditDate="2014-08-13T21:12:13.357" LastActivityDate="2014-08-13T21:12:13.357" Title="Fetch Single asset without for loop?" Tags="&lt;assets&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1469" PostTypeId="2" ParentId="1468" CreationDate="2014-07-28T16:18:52.710" Score="8" Body="&lt;p&gt;You can call the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#first&quot;&gt;&lt;code&gt;first()&lt;/code&gt;&lt;/a&gt; function to just get the first image:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set image = block.backgroundImage.first() %}&#xA;{{ image.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this will fail if there is no image. So to be safe, you need:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set image = block.backgroundImage.first() %}&#xA;{% if image %}&#xA;    {{ image.getUrl() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="9" LastEditDate="2014-07-28T16:27:25.653" LastActivityDate="2014-07-28T16:27:25.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1470" PostTypeId="2" ParentId="1460" CreationDate="2014-07-28T16:23:40.763" Score="2" Body="&lt;p&gt;I'd recommend to either give each channel's index page a dedicated single section or you configure a structure section to contain them all. An advantage of using a structure over separate singles is that you can generate the site's main navigation from it. And you can add a hierarchy to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure settings in the CP:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL for Top-Level Entries:&lt;br/&gt;&#xA;&lt;code&gt;{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL for Nested Entries:&lt;br/&gt;&#xA;&lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably want to give your index pages individual templates. To do this just add multiple entry types to your structure and relate each entry type with a template as &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;described in the FAQs&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-28T16:23:40.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1471" PostTypeId="1" AcceptedAnswerId="1549" CreationDate="2014-07-28T16:26:16.793" Score="7" ViewCount="4095" Body="&lt;p&gt;It would make my day to be able to have PHPStorm recognize third-party services. Has anyone figured out how to get this working yet?&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="82" LastEditDate="2014-07-30T20:17:36.927" LastActivityDate="2014-12-18T21:27:59.927" Title="Has anyone been able to get auto-complete working with plugins + PHPStorm?" Tags="&lt;plugin-development&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1472" PostTypeId="2" ParentId="1463" CreationDate="2014-07-28T16:50:57.110" Score="3" Body="&lt;p&gt;The Craft &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;Categories&lt;/a&gt; page is very useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To assign an entry to a category, create a category field, and require it in the entry type (you are probably already doing this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you create a &lt;em&gt;Category Group&lt;/em&gt; you can edit the field layout, and add an image field and a text field for the category. Then to edit that content, double click on the category itself (from the right-side category menu), and you will get a modal dialog where you can edit the text and image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To list the categories in &lt;em&gt;myCategoryGroup&lt;/em&gt; you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.category.group('myCategoryGroup') %}&#xA;{% for cat in categories %}&#xA;  {{cat.title}} - {{cat.image}} {# assuming image is the name of the image field #&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft site has an article on &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;How do I list the entries related to a category?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-28T16:50:57.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1473" PostTypeId="1" AcceptedAnswerId="1474" CreationDate="2014-07-28T16:59:07.820" Score="10" ViewCount="3253" Body="&lt;p&gt;I'm setting up my first Craft project and I have a lot of different content. I have around 6 different Channels (News, Events, Blog, Pages, Products, Staff) and ~10 Singles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this idea of using Structures as my sorting and &quot;Navigation&quot; &quot;content types&quot; only. Meaning I'll for example have one Structure called &quot;Navigation&quot; in which I have the default &quot;Title&quot; field and one &quot;Entries&quot; field (for linking to other entries in channels and singles). This I'll output in my template and fetching each linked entries page.link to build my main site navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should give my client the ability to control the main navigation structure of the entire site 100% with sorting, linking and naming each navigation item (&quot;Title&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a good approach on using a Structure this way? Or will the extra field &quot;Entries&quot; give me a massive query count when the Structure contains (let's say) 100 entries?&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="125" LastEditDate="2014-07-29T18:59:07.597" LastActivityDate="2014-07-30T13:56:59.763" Title="Would you use a Structure as navigation over multiple sections (channel entries, indexes and singles)?" Tags="&lt;navigation&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="1474" PostTypeId="2" ParentId="1473" CreationDate="2014-07-28T17:16:56.223" Score="12" Body="&lt;p&gt;&lt;strong&gt;Structure for &quot;sorting-only&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't tried the approach that you are thinking of yet, but your concerns regarding the query count are not that unfounded. You would need to use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot;&gt;&lt;code&gt;relatedTo()&lt;/code&gt;&lt;/a&gt; parameter with the ElementCriteriaModel you create &lt;s&gt;on your pages (to get the single's content)&lt;/s&gt;&#xA;on your navigation &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot;&gt;include&lt;/a&gt; (even if you only want to get the entries URL) and relations can have a rather big performance hit. &lt;s&gt;Hopefully this is not true for a simple relation like this; otherwise, you'd still have the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#when-to-use-cache-tags&quot;&gt;&lt;code&gt;cache&lt;/code&gt;&lt;/a&gt; tag.&lt;/s&gt; But I'd suggest you to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#when-to-use-cache-tags&quot;&gt;cache&lt;/a&gt; the whole include (this is a perfect example for caching being really useful). Additionally setting the limit to '1' will probably help to keep the query count low if the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#cache-clearing&quot;&gt;cache is cleared&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% cache for 3 years %}&#xA;&#xA;    {% set pages = craft.entries.section('pagesSectionHandle').level(1) %}&#xA;&#xA;    {% for page in pages %}&#xA;&#xA;        {% set params = {&#xA;            relatedTo: { sourceElement: page, field: &quot;entriesFieldHandle&quot; },&#xA;            limit: '1'&#xA;        } %}&#xA;&#xA;        {% set linkedEntry = craft.entries(params).first() %}&#xA;&#xA;        {# Get the title from the structure (why set this twice?) #}&#xA;        &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {# Get the title from the entry #}&#xA;        &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ linkedEntry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Structure containing &quot;all the content&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd suggest you to do is to not only use the structure as a &quot;sorting only&quot; structure, but to also add content directly to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use entry types for your singles, if you need to load individual templates for them, and further entry types for your channel index pages. If it's thought-out carefully (modular site design) you probably won't end up with lots of entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Combining those two&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a need to link to specific channel entries from your navigation, you could make an entry type in your structure specifically for those links to channel entries. All other content could still be added directly to the structure itself as described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that being able to edit the content directly in the pages structure is a very convenient and less geeky like experience for the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what Naboovalley and I came up with in the chat (we should have done this before spamming the comments section). It &quot;will give you a fully dynamic menu for your client linking between Singles, Channels and even other Structure entries&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% cache globally for 3 years %}&#xA;{% set entries = craft.entries.section('navigation') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {# Check for entry type / get related entry #}&#xA;            {% if entry.type == 'linkedChannelEntry' %}&#xA;                {% set linkedEntry = entry.entriesField.limit(1).first() %}&#xA;            {% endif %}&#xA;&#xA;            {% if linkedEntry %}&#xA;&#xA;                {# Link to a linked channel entry #}&#xA;                &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ linkedEntry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% else %}&#xA;&#xA;                {# Link to a structure entry #}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;            {# Repeat this for child entries #}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-29T18:57:43.587" LastActivityDate="2014-07-29T18:57:43.587" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1475" PostTypeId="2" ParentId="1471" CreationDate="2014-07-28T17:17:40.797" Score="6" Body="&lt;p&gt;Absolutely, just add the app directory as a external library.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Double click on the 'external libraries'.&lt;/li&gt;&#xA;&lt;li&gt;Add the interpreter&lt;/li&gt;&#xA;&lt;li&gt;Include the path to the 'app' directory&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZUoBy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-07-28T18:42:06.360" LastActivityDate="2014-07-28T18:42:06.360" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1476" PostTypeId="2" ParentId="1466" CreationDate="2014-07-28T18:36:41.407" Score="6" Body="&lt;p&gt;I was under impression that it was a bucket setting, but after doing some reading, it seems that this is a per-object setting and should be performed while uploading to a bucket. I'll add this to the list and you can expect to see this in Craft 2.2!&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2014-07-28T19:59:53.717" LastActivityDate="2014-07-28T19:59:53.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1477" PostTypeId="2" ParentId="1442" CreationDate="2014-07-28T18:42:55.550" Score="4" Body="&lt;p&gt;Dumb ass typo : &quot;siteadministator&quot; instead of siteadministRator &lt;em&gt;sigh&lt;/em&gt; ... Sorry for taking up bytes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working method now is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function hookRegisterCpRoutes()&#xA;{&#xA;    return array(&#xA;        'siteadministrator/currentusers' =&amp;gt; array('action' =&amp;gt; 'siteAdministrator/user/current'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-07-28T18:42:55.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1478" PostTypeId="1" CreationDate="2014-07-28T18:56:24.440" Score="4" ViewCount="1576" Body="&lt;p&gt;I've got a variable (widget is a better word) that I want to output with accompanying CSS and/or JS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm rendering the variable (widget) with the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return TemplateHelper::getRaw($output);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I realize the following exists but other than inline js/css is there a way to output the widget and include CSS/JS by only using a single variable? I want to make this as simple as possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ resourceUrl('plugin/js/public.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;`&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2014-07-28T20:42:41.407" LastActivityDate="2014-07-28T20:42:53.547" Title="How to include JS and CSS resources for a plugin variable" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2014-07-29T15:42:50.140" ContentLicense="CC BY-SA 3.0" />
  <row Id="1479" PostTypeId="1" CreationDate="2014-07-28T20:17:22.900" Score="2" ViewCount="341" Body="&lt;p&gt;Is it possible to execute a custom function on the entry crud methods? Basically what I want to achieve is that a CP user with certain field value cannot read or save an entry that doesn't have the same field value. (in this case company) Are there any hooks/events available on that level? On group permission level I just want all permissions set to allow on that section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-07-28T20:34:19.403" Title="Is it possible to execute a custom function on the entry crud methods?" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1480" PostTypeId="2" ParentId="1479" CreationDate="2014-07-28T20:34:19.403" Score="4" Body="&lt;p&gt;You'd have to create a plugin but you could listen for the &lt;strong&gt;entries.saveEntry&lt;/strong&gt; event that is noted here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/hooks-and-events&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then lookup the value, run validation and even return a custom error message if things were not saved correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-07-28T20:34:19.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1481" PostTypeId="2" ParentId="1478" CreationDate="2014-07-28T20:42:53.547" Score="5" Body="&lt;p&gt;You can use these and Craft automatically adds the files in the appropriate spots.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$output = craft()-&amp;gt;templates-&amp;gt;includeJsFile(UrlHelper::getResourceUrl('plugin/script.js'));&#xA;&#xA;$output .= craft()-&amp;gt;templates-&amp;gt;includeCssResource(UrlHelper::getResourceUrl('plugin/styles.css'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-07-28T20:42:53.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1482" PostTypeId="1" AcceptedAnswerId="1483" CreationDate="2014-07-28T22:09:19.730" Score="9" ViewCount="434" Body="&lt;p&gt;I'm using &lt;a href=&quot;http://scottjehl.github.io/picturefill/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PictureFill&lt;/a&gt; on a large page, containing many image transforms, that doesn't seem to be caching despite most of the page being wrapped in &lt;code&gt;{% cache %}&lt;/code&gt; tags. When I view the page after several refreshes with Dev Mode enabled, the Profiling Summary Report is reporting &lt;code&gt;Total Queries&lt;/code&gt; at 174, and the HTML source still contains many examples of image urls that contain something like &lt;code&gt;/cpresources/transforms/XX&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read in &lt;a href=&quot;https://craftcms.stackexchange.com/a/785/414&quot;&gt;this answer&lt;/a&gt; that Craft won't cache a page with unresolved transforms, which might explain why this page isn't being cached. But then the question is, why aren't these transforms resolving?&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-07-29T17:06:04.043" Title="Caching not working on page with asynchronously loaded asset transforms" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1483" PostTypeId="2" ParentId="1482" CreationDate="2014-07-29T01:36:22.617" Score="12" Body="&lt;p&gt;Seems to be the case that Craft won't attempt to resolve these &lt;code&gt;/cpresources/transforms/&lt;/code&gt; URLs until the asset is actually requested, which can mess with a setup like PictureFill where there is no guarantee that the transformed assets will ever be loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution in my case was to to set &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&lt;/code&gt; in your Craft config array as mentioned &lt;a href=&quot;https://craftcms.stackexchange.com/a/785/414&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing this, all transform URLs resolve and the page is properly cached.&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-29T02:24:52.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1484" PostTypeId="1" AcceptedAnswerId="1486" CreationDate="2014-07-29T03:06:44.577" Score="4" ViewCount="475" Body="&lt;p&gt;For some rss readers they have issues with the images having &quot;mtime&quot; at the end of the url.  Is there a way to output an image without this?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-07-29T06:32:04.477" Title="How do you output images without &quot;?mtime&quot; at the end of the url?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;rss&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1485" PostTypeId="1" CreationDate="2014-07-29T06:16:34.407" Score="4" ViewCount="2288" Body="&lt;p&gt;I need to install Craft under a laravel sub-directory &lt;code&gt;http://example.com/corp/&lt;/code&gt; where &lt;code&gt;example.com&lt;/code&gt; is a laravel site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a clean way to install craft in a directory below an existing app?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my config from &lt;code&gt;/corp/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../../craftsite/craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="125" LastEditDate="2014-07-29T07:26:24.600" LastActivityDate="2014-07-29T13:04:01.430" Title="Installing Craft in sub directory" Tags="&lt;url&gt;&lt;install&gt;&lt;security&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1486" PostTypeId="2" ParentId="1484" CreationDate="2014-07-29T06:32:04.477" Score="5" Body="&lt;p&gt;?mtime= should only appear for Assets images that are being served from a source that has Expires settings set (so, either an S3 or Google Cloud source).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done done for cache busting purposes. If you upload a new file, it's mtime value will change causing a different URL and, in turn, forcing the user's browser to serve the new image, instead of the cached version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to serve images without that you would have to turn off Expires setting for that source.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-07-29T06:32:04.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1487" PostTypeId="2" ParentId="1485" CreationDate="2014-07-29T06:35:49.203" Score="1" Body="&lt;p&gt;With &lt;code&gt;$craftPath&lt;/code&gt; you set the path to the &lt;code&gt;craft/&lt;/code&gt; directory (containing the &lt;code&gt;app/&lt;/code&gt; folder etc.) whereby your &lt;code&gt;index.php&lt;/code&gt; is the starting point if you set this as a relative path:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../relative/path/to/craft_dir/';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As narration_sd pointed out, the &lt;code&gt;craft/&lt;/code&gt; directory should be above the web root for security reasons. But this doesn't mean that you cannot have your &lt;code&gt;index.php&lt;/code&gt; at &lt;code&gt;http://example.com/corp/index.php&lt;/code&gt;. Just configure &lt;code&gt;$craftPath&lt;/code&gt; accordingly. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laravel at web root:&lt;br&gt;&#xA;&lt;code&gt;/var/www/laravel-site/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft in a subdir:&lt;br&gt;&#xA;&lt;code&gt;/var/www/laravel-site/public/corp/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft app above web root:&lt;br&gt;&#xA;&lt;code&gt;/var/www/craftsite/craft/app/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's path config:&lt;br&gt;&#xA;&lt;code&gt;$craftPath = '../../../craftsite/craft';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember to also update the paths to your assets in the Control Panel and the paths to your files linked to in your templates.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-29T13:04:01.430" LastActivityDate="2014-07-29T13:04:01.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1488" PostTypeId="1" CreationDate="2014-07-29T10:30:20.410" Score="3" ViewCount="948" Body="&lt;p&gt;I'm trying to set up redirects for some pages (specifically pages in structure sections that are there purely for structure, which I want to redirect to their first child). Craft's  &quot;routes&quot; seem to be geared towards routing a request to a template. But how can I simply route a request to a different URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can use Twig's &lt;code&gt;{% redirect %}&lt;/code&gt; function, but to be honest I'd much rather just set up all the routes I want redirected outside my template (in order to allow me to avoid (hopefully) unnecessary conditional URL-handling logic in the template). Is this possible at all? If not, is there an elegant way of handling it inside a template?&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="125" LastEditDate="2014-07-29T11:41:42.813" LastActivityDate="2014-08-20T17:35:01.440" Title="Setting up redirects via Craft routes?" Tags="&lt;routes&gt;&lt;navigation&gt;&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1489" PostTypeId="2" ParentId="1488" CreationDate="2014-07-29T11:00:27.473" Score="4" Body="&lt;p&gt;If you want to &quot;redirect&quot; all parent entries of your structure that have child entries, you could do something like this in your navigation (untested code!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {% if page.getChildren()|length %}&#xA;                &amp;lt;a href=&quot;{{ page.getChildren().first().url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to exclude specific parent entries from that behavior, you could do this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if page.getChildren()|length and page.id('and, not 1, not 2, not 3') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-20T17:35:01.440" LastActivityDate="2014-08-20T17:35:01.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1490" PostTypeId="1" AcceptedAnswerId="1496" CreationDate="2014-07-29T12:17:26.807" Score="6" ViewCount="910" Body="&lt;p&gt;The code from the &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#templatin&quot; rel=&quot;noreferrer&quot;&gt;RichText documentation&lt;/a&gt; appends the 'Continue reading…' link in a new block and on a new line:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('blog') %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {{ entry.richTextFieldHandle.getPage(1) }}&#xA;        {% if entry.richTextFieldHandle.getTotalPages() &amp;gt; 1 %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to append the 'Continue reading…' link inside the final &lt;code&gt;&amp;lt;/p&amp;gt;&lt;/code&gt; tag generated by Redactor at the end of the final paragraph, i.e. as a continuation of the Excerpt text, and on the same line?&lt;/p&gt;&#xA;" OwnerUserId="605" LastEditorUserId="177" LastEditDate="2014-07-29T12:30:21.567" LastActivityDate="2014-07-30T06:06:47.263" Title="How to append 'Continue reading…' link within the last paragraph of the Excerpt" Tags="&lt;templating&gt;&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1491" PostTypeId="2" ParentId="932" CreationDate="2014-07-29T12:49:45.090" Score="7" Body="&lt;p&gt;I recently needed to check if a variable is a number. My first idea was to use the &lt;code&gt;divisibleby&lt;/code&gt; test:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# DOESN'T WORK AS EXPECTED! #}&#xA;{% if var is divisible by(1) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfurtunatelly twig returns &lt;code&gt;true&lt;/code&gt; for every string passed to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you can do is to use regular expressions using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot;&gt;&lt;code&gt;matches&lt;/code&gt;&lt;/a&gt; operator in the comparison. You'll note that I double escaped the dot and the meta-character &lt;code&gt;\d&lt;/code&gt;, this is because of a &lt;a href=&quot;https://github.com/fabpot/Twig/pull/1457&quot;&gt;twig bug&lt;/a&gt; (or put otherwise: &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot;&gt;wrong documentation&lt;/a&gt; of using regex here).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Match integer #}&#xA;{% if var matches '/^\\d+$/' %}&#xA;{% endif %}&#xA;&#xA;{# Match floating point number #}&#xA;{% if var matches '/^[-+]?[0-9]*\\.?[0-9]+$/' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-29T13:06:44.440" LastActivityDate="2014-07-29T13:06:44.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1492" PostTypeId="1" AcceptedAnswerId="1503" CreationDate="2014-07-29T14:15:15.567" Score="4" ViewCount="262" Body="&lt;p&gt;Due to the way our build and deployment process works, it's convenient for us to have the Craft templates inside our /public/assets folder together with our css and javascript, instead of in /craft. Does this make the site less secure than having them outside of the public root?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-07-29T19:53:28.350" Title="Is it a security risk to put Craft templates inside public root?" Tags="&lt;templating&gt;&lt;security&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1493" PostTypeId="2" ParentId="1490" CreationDate="2014-07-29T14:35:47.463" Score="1" Body="&lt;p&gt;To solve this properly you'd need to write a Craft plugin which also holds some sort of Redactor plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as a quick solution, how about using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot; rel=&quot;nofollow&quot;&gt;striptags&lt;/a&gt; filter? It'll remove &lt;em&gt;all&lt;/em&gt; your tags though, meaning that you will also loose all other paragraph and styling tags.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{#&#xA; # This comment is only necessary because of this bug:&#xA; # http://meta.craftcms.stackexchange.com/questions/72/temporary-removal-of-twig-syntax-highlighting&#xA; #}&#xA;&#xA;&amp;lt;p&amp;gt;&#xA;    {{ entry.richTextFieldHandle.getPage(1)|striptags }}&#xA;&#xA;    {% if entry.richTextFieldHandle.getTotalPages() &amp;gt; 1 %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also try to apply &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filters. I'm not sure, but maybe this automatically leads to a &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;raw output&lt;/a&gt; of your rich text, making all other tags not working as well.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{#&#xA; # This comment is only necessary because of this bug:&#xA; # http://meta.craftcms.stackexchange.com/questions/72/temporary-removal-of-twig-syntax-highlighting&#xA; #}&#xA;&#xA;&amp;lt;p&amp;gt;&#xA;    {{ entry.richTextFieldHandle.getPage(1)|slice(4)|slice(0, -4) }}&#xA;&#xA;    {% if entry.richTextFieldHandle.getTotalPages() &amp;gt; 1 %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-30T06:06:47.263" LastActivityDate="2014-07-30T06:06:47.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1494" PostTypeId="2" ParentId="1492" CreationDate="2014-07-29T14:47:02.377" Score="3" Body="&lt;p&gt;It depends on what kind of secure infos you write into your templates. I wouldn't put my credit card infos into a twig comment for example, if the template is not above the root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But normally all one could make up from the raw template code is rather uninteresting and not really relevant for further hacking attempts, I'd say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: please do &lt;strong&gt;NOT&lt;/strong&gt; put the &lt;code&gt;craft/config/&lt;/code&gt; folder above the root!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-29T14:55:13.547" LastActivityDate="2014-07-29T14:55:13.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1495" PostTypeId="2" ParentId="1490" CreationDate="2014-07-29T14:48:02.960" Score="1" Body="&lt;p&gt;I would write a Craft plugin with a twig extension.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.richTextFieldHandle.getTotalPages() &amp;gt; 1 %}&#xA;  {{ entry.richTextFieldHandle.getPage(1)|continueReading('Continue reading…', entry.url)|raw }}&#xA;{% else %}&#xA;  {{ entry.richTextFieldHandle }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;continueReading&lt;/code&gt; plugin left as an exercise for the reader.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-29T14:48:02.960" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1496" PostTypeId="2" ParentId="1490" CreationDate="2014-07-29T15:05:11.407" Score="5" Body="&lt;p&gt;I'm a total novice with Craft/Twig and I was hoping for some sort of simple and neat &lt;code&gt;append&lt;/code&gt; function in Twig!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've got close to a working solution using CSS, by overriding the Extract's &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags' usual behavior with &lt;code&gt;display: inline&lt;/code&gt;, and enclosing the 'Continue reading…' in a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;br&gt;&#xA;The following (including some additional logic for a 'Summary' field) seems to work well…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;excerpts&quot;&amp;gt;&#xA;&#xA;    {% if entry.summary %}&#xA;        {{ entry.summary }}&#xA;    {% else %}&#xA;        {{ entry.body.page(1) }}&#xA;    {% endif %}&#xA;&#xA;    {% if entry.body.getTotalPages() &amp;gt; 1 or entry.summary %}&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; rel=&quot;nofollow&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;         &#xA;    {% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…and…&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;.excerpts p:last-of-type { display: inline; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="605" LastEditorUserId="125" LastEditDate="2014-07-29T18:12:02.103" LastActivityDate="2014-07-29T18:12:02.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1497" PostTypeId="1" AcceptedAnswerId="1500" CreationDate="2014-07-29T15:53:00.557" Score="5" ViewCount="1190" Body="&lt;p&gt;I want to move some permanent routes from the admin to my routes config file so that they can be version controlled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in the admin...&#xA;news-sort/month/&amp;lt;year&amp;gt;/&amp;lt;month&amp;gt; ....&#xA;news-sort/tag/&amp;lt;tag&amp;gt; ....&#xA;news-sort/author/&amp;lt;*&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do these look ok, not 100% sure on the variable and regex etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news-sort/month/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})' =&amp;gt; 'news-sort/index',&#xA;'news-sort/tag/(?P&amp;lt;tag&amp;gt;[a-zA-Z0-9._%-]+)' =&amp;gt; 'news-sort/index',&#xA;'news-sort/author/(?P&amp;lt;author&amp;gt;[a-zA-Z0-9._%-]+)' =&amp;gt; 'news-sort/index'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="196" LastEditorUserId="125" LastEditDate="2014-07-30T19:37:13.613" LastActivityDate="2014-07-30T19:37:13.613" Title="`routes.php` config example" Tags="&lt;config&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1498" PostTypeId="2" ParentId="1497" CreationDate="2014-07-29T16:27:51.727" Score="3" Body="&lt;p&gt;You forgot to escape the dot, but otherwise it looks good to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could replace &lt;code&gt;[a-zA-Z0-9._%-]&lt;/code&gt; with &lt;code&gt;.&lt;/code&gt; to allow all characters in the slug. Maybe you want to use german umlauts or other special characters in your slugs at some point (you probably shouldn't, but who knows). I'd do that (the &lt;code&gt;.&lt;/code&gt;, not the umlauts), as I think it's not the task of a route to restrict you in doing such things.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-29T16:33:35.027" LastActivityDate="2014-07-29T16:33:35.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1499" PostTypeId="2" ParentId="932" CreationDate="2014-07-29T16:28:15.150" Score="7" Body="&lt;p&gt;I needed this feature today, so I've put together a simple plugin, which does the job: &lt;a href=&quot;https://github.com/victor-in/Craft-TwigTypeTest&quot;&gt;Craft-TwigTypeTest&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set test_var = craft.entries %}&#xA;&#xA;{% if test_var is of_type('object') %}&#xA;  true&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set test_var = craft.entries %}&#xA;&#xA;{{ test_var|get_type }}&#xA;{# Outputs: object #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-29T16:28:15.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1500" PostTypeId="2" ParentId="1497" CreationDate="2014-07-29T16:39:33.260" Score="9" Body="&lt;p&gt;The simplest way to transform &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot;&gt;dynamic routes&lt;/a&gt; into &lt;a href=&quot;http://buildwithcraft.com/docs/routing#advanced-routing&quot;&gt;advanced routes&lt;/a&gt;, is to go to your &lt;code&gt;craft_routes&lt;/code&gt; table and copy it out of &lt;code&gt;urlPattern&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have set this in your backend:&lt;br&gt;&#xA;&lt;code&gt;news-sort/month/&amp;lt;year&amp;gt;/&amp;lt;month&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll find this in &lt;code&gt;urlPattern&lt;/code&gt;:&lt;br&gt;&#xA;&lt;code&gt;news\-sort\/month\/(?P&amp;lt;year&amp;gt;\d{4})\/(?P&amp;lt;month&amp;gt;(?:0?[1-9]|1[012]))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just remove the escaping &lt;code&gt;\&lt;/code&gt;, and you've got your regex:&lt;br&gt;&#xA;&lt;code&gt;news-sort/month/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;(?:0?[1-9]|1[012]))&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-29T16:39:33.260" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1501" PostTypeId="1" AcceptedAnswerId="1502" CreationDate="2014-07-29T18:28:11.803" Score="8" ViewCount="1654" Body="&lt;p&gt;I'm following the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/adding-a-thank-you-page&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt; to create a thank-you page when the user submits the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a single created for &lt;code&gt;/contact-us/&lt;/code&gt; and I want the user to be redirected to &lt;code&gt;/contact-us/thank-you/&lt;/code&gt; when they submit the form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created the route so &lt;code&gt;contact-us/thank-you&lt;/code&gt; shows the &lt;code&gt;contact-us&lt;/code&gt; template, but when I go to that URL I get a template error saying &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks like it's showing the template correctly, but not loading the data from the single.&lt;/p&gt;&#xA;" OwnerUserId="601" LastEditorUserId="250" LastEditDate="2014-10-03T16:07:51.143" LastActivityDate="2014-10-03T16:07:51.143" Title="Route breaks Single Entry" Tags="&lt;entries&gt;&lt;routes&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1502" PostTypeId="2" ParentId="1501" CreationDate="2014-07-29T18:40:37.310" Score="9" Body="&lt;p&gt;Craft automatically includes the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entry&lt;/code&gt; variable&lt;/a&gt; if the &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;noreferrer&quot;&gt;slug matches the url&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the URI matches an entry’s or category’s URI, the&#xA;  section’s/category group’s template will get loaded, and the matched&#xA;  element will be made available to the template via a pre-populated&#xA;  entry or category variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;code&gt;contact-us&lt;/code&gt; gets matched automatically, but &lt;code&gt;contact-us/thank-you&lt;/code&gt; does not. This means you have to set &lt;code&gt;entry&lt;/code&gt; yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add this to the top of your template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.section('contact-us').first() %}&#xA;    {# Fetch single which has 'contact-us' as a handle #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-07-29T18:47:23.550" LastActivityDate="2014-07-29T18:47:23.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1503" PostTypeId="2" ParentId="1492" CreationDate="2014-07-29T19:53:28.350" Score="7" Body="&lt;p&gt;If you’re running Apache, you can put a .htaccess file in your templates/ folder with this in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Deny from all&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and any HTTP traffic to that folder will be given an Apache 403 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better, you can put this in there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Send the request to Craft&#xA;RewriteEngine On&#xA;RewriteRule (.*) /index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the request will be redirected to Craft’s index.php file behind the scenes, the same way that would-be 404s are sent there. So even if you go to /templates/index.html, or any other URL that points to an actual file within your templates/ folder, it will end up as /index.php?p=templates/index.html, leaving Craft to handle the request, which will most likely result in a Craft-based 404.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-07-29T19:53:28.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1504" PostTypeId="1" AcceptedAnswerId="1505" CreationDate="2014-07-29T21:34:23.483" Score="3" ViewCount="2351" Body="&lt;p&gt;I'm rendering some HTML into a variable. On this HTML I want to replace a value using &lt;code&gt;craft.request.getUrl()&lt;/code&gt; but the value doesn't seem to get replaced. Any idea what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages %}&#xA;    {% set entries = craft.entries.section('pages') %}&#xA;    {% for entry in entries %}&#xA;         &amp;lt;a href=&quot;{{ entry.url }}&quot; data-url=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endset %}&#xA;&#xA;{{ pages|replace({'data-url=&quot;{{ craft.request.getUrl() }}&quot;': 'class=&quot;active&quot;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-07-30T15:23:01.997" Title="Why isn't my Twig replace filter working with craft.request.getUrl()?" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1505" PostTypeId="2" ParentId="1504" CreationDate="2014-07-29T21:37:26.680" Score="6" Body="&lt;p&gt;Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ pages|replace({('data-url=&quot;' ~ craft.request.getUrl() ~ '&quot;'): 'class=&quot;active&quot;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You were double nesting Twig tags &lt;code&gt;{{ {{ }} }}&lt;/code&gt;, which is never necessary.  You'll want to use string concatenation instead. Also for dynamic keys in twig you need parentheses.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="297" LastEditDate="2014-07-30T15:23:01.997" LastActivityDate="2014-07-30T15:23:01.997" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1506" PostTypeId="1" AcceptedAnswerId="1507" CreationDate="2014-07-29T22:40:18.403" Score="13" ViewCount="7268" Body="&lt;p&gt;I'm setting my categories by matching the third segment to a category slug. How do I get the category title?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catSlug = craft.request.getSegment(3) %}&#xA;{% set category = craft.categories.slug(catSlug) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{{ category.slug }} returns the slug, but {{ category.title }} returns nothing.&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="50" LastEditDate="2014-07-30T10:32:42.293" LastActivityDate="2014-07-30T23:03:01.710" Title="Get category title by slug" Tags="&lt;categories&gt;&lt;slug&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1507" PostTypeId="2" ParentId="1506" CreationDate="2014-07-29T23:43:59.747" Score="24" Body="&lt;p&gt;You need to add &lt;code&gt;.first()&lt;/code&gt; when setting the category. As far as I can tell, if you don't have &lt;code&gt;.first()&lt;/code&gt; only &lt;code&gt;{{ category.slug }}&lt;/code&gt; will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First get the slug:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set catSlug = craft.request.getSegment(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot;&gt;CategoryModel&lt;/a&gt; object for catSlug:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set category = craft.categories.slug(catSlug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now access whatever you want from the category, like the title:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-07-30T23:03:01.710" LastActivityDate="2014-07-30T23:03:01.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1508" PostTypeId="1" CreationDate="2014-07-30T04:22:02.073" Score="4" ViewCount="995" Body="&lt;p&gt;Ok I'm running Mamp pro 3.0.5 for my localhost setup and php 5.3.28 and for the life of me, I can't get my localhost setup to send out emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My host name is &lt;strong&gt;smtp.postmarkapp.com&lt;/strong&gt;&#xA;My &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt; are my API key as specified by postmarkapp. I've tried port on both 25 and 2525, Use SMTP authentication is set to yes and SMTP Secure Transport Type is set to none.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run a test email through the admin panel I see &lt;strong&gt;SMTP connect() failed.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: emails send out correct on our dev/production servers without issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have ideas here?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-07-30T04:22:02.073" Title="Craft SMTP emails + Localhost [Mamp pro] (+postmarkapp)" Tags="&lt;emails&gt;" AnswerCount="0" CommentCount="9" FavoriteCount="1" ClosedDate="2014-08-18T19:19:01.363" ContentLicense="CC BY-SA 3.0" />
  <row Id="1510" PostTypeId="1" AcceptedAnswerId="1511" CreationDate="2014-07-30T11:52:27.940" Score="5" ViewCount="1094" Body="&lt;p&gt;I want to limit the rows returned here to 4, then if loop.index is 3 display a separator and then output the last row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the table field have that kind of control?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in registration.registrationCost %}&#xA;    &amp;lt;li class=&quot;circle&quot;&amp;gt;&#xA;        &amp;lt;h3 class=&quot;registration-cost&quot;&amp;gt;{{ row.cost }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;hr/&amp;gt;&#xA;        &amp;lt;h5&amp;gt;Through&amp;lt;/h5&amp;gt;&#xA;        &amp;lt;h4&amp;gt;{{ row.date }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;/li&amp;gt;          &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastEditorUserId="57" LastEditDate="2014-07-30T15:25:27.490" LastActivityDate="2014-07-30T15:26:18.773" Title="How can I limit the rows returned in a table field?" Tags="&lt;templating&gt;&lt;field&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1511" PostTypeId="2" ParentId="1510" CreationDate="2014-07-30T12:10:00.160" Score="7" Body="&lt;p&gt;According to &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot;&gt;the Craft docs&lt;/a&gt; , the table field returns an array of rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that is the case, you should be able to use &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot;&gt;the Twig &lt;code&gt;slice&lt;/code&gt; filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in registration.registrationCost | slice(0, 3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use a simple conditional to output the row divider:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index == 3 %}  &#xA;    &amp;lt;hr&amp;gt;  &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="57" LastEditDate="2014-07-30T15:26:18.773" LastActivityDate="2014-07-30T15:26:18.773" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1513" PostTypeId="2" ParentId="1473" CreationDate="2014-07-30T13:56:59.763" Score="5" Body="&lt;p&gt;If you want to be able to add a class=&quot;active&quot; to the selected URL you can use Twig's replace filter. Since the code will be cached you can't do this at runtime.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation %}&#xA;{% cache globally for 3 years %}&#xA;{% set entries = craft.entries.section('navigation') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% nav entry in entries %}&#xA;    &amp;lt;li&amp;gt;&#xA;&#xA;        {# Check for entry type / get related entry #}&#xA;        {% if entry.type == 'linkedChannelEntry' %}&#xA;            {% set linkedEntry = entry.entriesField.limit(1).first() %}&#xA;        {% endif %}&#xA;&#xA;        {% if linkedEntry %}&#xA;&#xA;            {# Link to a linked channel entry #}&#xA;            &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot; data-url=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ linkedEntry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;            {# Link to a structure entry #}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; data-url=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;        {# Repeat this for child entries #}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endcache %}&#xA;{% endset %}&#xA;&#xA;{{ navigation|replace({('data-url=&quot;' ~ craft.request.getUrl() ~ '&quot;'): 'class=&quot;active&quot;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-07-30T13:56:59.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1514" PostTypeId="1" AcceptedAnswerId="1532" CreationDate="2014-07-30T14:26:32.663" Score="2" ViewCount="170" Body="&lt;p&gt;I have modified the code from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1086/order-tags-by-count-e-g-top-10-tags-used&quot;&gt;this question&lt;/a&gt; but I'm running into an issue. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCats = craft.categories.group('blogCategories').level(1).find() %}&#xA;&#xA;{% set catArray = {} %}&#xA;&#xA;{% for cat in allCats %}&#xA;&#xA;    {% set catArray = catArray | merge({(cat.id):craft.entries.relatedTo(cat).total() }) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set catArray = catArray|sort|reverse %}&#xA;&#xA;{% for catId, count in catArray %}&#xA;&#xA;    {% set category = craft.categories.id(catId).first() %}&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }} &amp;lt;span&amp;gt;{{count}}&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ive ran a dump on the catArray array and the category id isnt being set as the key, regardless of if I try put brackets around it to protect it, I only get the value in the array.&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-07-30T20:43:50.990" Title="Order a list of categories by number of entries, key not being set" Tags="&lt;templating&gt;&lt;array&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1515" PostTypeId="1" AcceptedAnswerId="1517" CreationDate="2014-07-30T15:51:01.907" Score="5" ViewCount="2168" Body="&lt;p&gt;Wanting to move static/single templates in to a directory &lt;code&gt;pages&lt;/code&gt; and thus, the path to my 404 template is now &lt;code&gt;pages/404.html&lt;/code&gt;. I don't necessarily need dynamic content &lt;a href=&quot;https://craftcms.stackexchange.com/questions/390/whats-the-best-way-to-set-up-a-content-manageable-404-page&quot;&gt;as asked here&lt;/a&gt;. Is there a config setting I can use to point the default 404 URI behavior to that template?&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-12-06T01:52:13.170" Title="Can I define a path to my 404 template?" Tags="&lt;templating&gt;&lt;404-page&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1516" PostTypeId="1" CreationDate="2014-07-30T15:58:28.907" Score="6" ViewCount="1781" Body="&lt;p&gt;I have a Structure section and a Channel section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries in the Channel will be listed on one of the Structure Entries, and it's entry page will fit the same URL format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, the Structure Entry may be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Title: &quot;Our People&quot;&lt;br&gt;&#xA;URL: /about/our-people&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and the Channel entry may be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Title: &quot;Jamie&quot;&lt;br&gt;&#xA;URL: /about/our-people/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I set up the Channel is there any way of dynamically setting it's &quot;Entry URL Format&quot; based on another entry's URL/slug? I can set it to &quot;/about/our-people/{slug}&quot; but if the Structure entry's slug ever changes it'll be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding the following to the Channel's Entry URL Format field and it seems to work (high fives P&amp;amp;T).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.section('site').id('32').first() %}{{ parent.uri }}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything I should be worried about using that? Obviously if that parent entry is deleted things will break. Anything else?&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-02-20T13:03:40.017" Title="Dynamically setting a channel's Entry URL Format with Craft tags" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1517" PostTypeId="2" ParentId="1515" CreationDate="2014-07-30T16:00:13.190" Score="6" Body="&lt;p&gt;Yes, use &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#errorTemplatePrefix&quot;&gt;errorTemplatePrefix&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'errorTemplatePrefix' =&amp;gt; &quot;pages/&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-30T16:00:13.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1518" PostTypeId="1" CreationDate="2014-07-30T16:11:47.933" Score="7" ViewCount="1604" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Craft Guest Entries&lt;/a&gt; plugin and the Entry Form technique elsewhere on my site. I'm currently trying to add a file upload to it. The entry is publishing but nothing is making it to assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;ajax-form&quot; method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;17&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[whitepaperCategory]&quot; value=&quot;{{entry.title}}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;title&quot; required&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;email&quot;&amp;gt;Email Address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;fields[email]&quot; required&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;resume&quot;&amp;gt;Resume and Cover Letter (.pdf)&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;file-upload btn btn-primary&quot;&amp;gt;&#xA;        &amp;lt;span&amp;gt;Upload Resume and Cover Letter&amp;lt;/span&amp;gt;&#xA;        &amp;lt;input type=&quot;file&quot; id=&quot;resume&quot; name=&quot;fields[resumes][]&quot; class=&quot;upload&quot; multiple&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything obvious I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="446" LastEditorUserId="142" LastEditDate="2015-02-20T12:37:28.640" LastActivityDate="2015-02-20T12:37:28.640" Title="Can guests upload files to assets in an entry form?" Tags="&lt;form&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1520" PostTypeId="1" AcceptedAnswerId="1522" CreationDate="2014-07-30T16:17:26.940" Score="2" ViewCount="698" Body="&lt;p&gt;I’m working on a simple cart and trying to utilize the user session id to keep track of things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The session getting saved to the database doesn't match the session that’s being displayed in templates. I have a template variable set-up to output the session on the front end for comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s quite a bit of code with a plugin so I’ll include what’s most relevant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a service setup that included methods for saving an item and loading a session through a variable. In the service constructor the session is set like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class EyeCart_CartService extends BaseApplicationComponent&#xA;    {&#xA;    private $_cartSession;&#xA;&#xA;    public function __construct()&#xA;    {&#xA;        $session = new  HttpSessionService;&#xA;        $session-&amp;gt;open();&#xA;        $this-&amp;gt;_cartSession =  $session-&amp;gt;sessionID;&#xA;    } &#xA;    etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then use _cartSession in the saveItem method. This works fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveItem(EyeCart_CartModel $item)&#xA;{&#xA;    ….&#xA;    // Set the cart record attributes&#xA;    $cartRecord-&amp;gt;session = $this-&amp;gt;_cartSession;  // the session saves as bakg59bu9lmbbs50s8meg5jk71&#xA;    $cartRecord-&amp;gt;itemId = $item-&amp;gt;itemId;&#xA;    etc…&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the service I also have a cartSession method for outputting the current session in the template via variables (for testing).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function cartSession()&#xA;{&#xA;   return $this-&amp;gt;_cartSession;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a different value than is being saved in the database (9m9g3msjo3v9f8ke7gf4b3qfv0). I tried including the cart variable on different templates and it displays consistently across page states just not when saving to the db. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice? &lt;/p&gt;&#xA;" OwnerUserId="347" LastActivityDate="2014-07-30T16:46:27.470" Title="How can I use a session consistently in a service and variable?" Tags="&lt;plugins&gt;&lt;services&gt;&lt;variable-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1521" PostTypeId="1" CreationDate="2014-07-30T16:37:56.680" Score="4" ViewCount="284" Body="&lt;p&gt;I have an event listener on elements.onPopulateElement, what I want is make a last minute decision if I want to populate or not. I have certain customfields on an admin CP user (eg company). All entries (in this case in the section &quot;normalUsers&quot;, these are entries not actual users) have that same field company (companiesDropdown). I can detect in the code below that the entries' companiesDropdown field does not match the currentUsers companyDropdown field. But how can I tell the calling piece of code not the populate this element?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code it initialised in the plugin init method&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _initEventPopulateNormalUser() {&#xA;    craft()-&amp;gt;on('elements.onPopulateElement', function(Event $event) {&#xA;        $this-&amp;gt;_getNormalUserSection();&#xA;        // HERE we check if we actually save a normalUser section entry, may be a bit brute force, we will polish that later&#xA;        $lCompanyIdEntry = $event-&amp;gt;params['element']-&amp;gt;getAttributes(array('sectionId'));&#xA;        if (! isset($lCompanyIdEntry['sectionId'])) return;&#xA;        if ($lCompanyIdEntry['sectionId'] != $this-&amp;gt;mNormalUsersSection) return;&#xA;&#xA;        $lCurrentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $lCompanyIdUser = $lCurrentUser-&amp;gt;companiesDropdown[0]-&amp;gt;id;&#xA;&#xA;        $lEntryCompanyId = $event-&amp;gt;params['element']-&amp;gt;companiesDropdown-&amp;gt;first()-&amp;gt;id;&#xA;&#xA;        if ($lCompanyIdUser != $lEntryCompanyId) {&#xA;            /*&#xA;                Somewhere here I want the element to be emptied and&#xA;                all functionality calling it, like a elementindex template,&#xA;                to not show the element in its listing&#xA;            */&#xA;        }&#xA;    });&#xA;}&#xA;&#xA;&#xA;private function _getNormalUserSection()&#xA;{&#xA;    if (is_null($this-&amp;gt;mNormalUsersSection)) {&#xA;        $lSection = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('normalUsers');&#xA;        $this-&amp;gt;mNormalUsersSection = $lSection-&amp;gt;id;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-08-07T08:33:03.300" Title="How do I stop an element from populating?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1522" PostTypeId="2" ParentId="1520" CreationDate="2014-07-30T16:46:27.470" Score="2" Body="&lt;p&gt;I suspect you're getting different session IDs because you're creating a new instance of HttpSessionService (which ultimately is a wrapper for &lt;a href=&quot;http://php.net/manual/en/book.session.php&quot; rel=&quot;nofollow&quot;&gt;PHP's session handling&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you should be doing is using Craft's existing session off of &lt;code&gt;craft()-&amp;gt;httpSession&lt;/code&gt; and grab the existing PHP session ID with &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;getSessionID()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No need to call &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;open()&lt;/code&gt;, because Craft will automatically start the session as soon as the HttpSessionService gets loaded.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-30T16:46:27.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1523" PostTypeId="1" AcceptedAnswerId="1558" CreationDate="2014-07-30T16:49:53.240" Score="8" ViewCount="563" Body="&lt;p&gt;I've set up a channel using categories to distinguish between different blog post types. The majority will probably be in one category, so it would be great to be able to specify a default category. However, as far as I can see the Category field type (unlike, say, the Drop Down field type) doesn't give you the option to set a default... Is there any way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="250" LastEditDate="2014-10-15T17:54:09.390" LastActivityDate="2014-10-15T17:54:09.390" Title="Is there any way of specifying a default category for a category field?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1524" PostTypeId="1" AcceptedAnswerId="1525" CreationDate="2014-07-30T17:59:41.837" Score="6" ViewCount="208" Body="&lt;p&gt;I'm having trouble outputting a list of tags that only includes tags from the current locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the setup:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have a site with two locales: english and spanish&lt;/li&gt;&#xA;&lt;li&gt;I have a section with handle newsAndEvents&lt;/li&gt;&#xA;&lt;li&gt;I have a tag field with handle newsTags on entries in that section that is set to translatable to allow my clients to assign locale-specific tags to the entries&lt;/li&gt;&#xA;&lt;li&gt;I have an entry in that section created with a published version for each of my locales. In the english version, I've added a tag &quot;Turtles&quot; to the entry. In the spanish version, I've added a tag &quot;Tortugas&quot; to the entry.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On the landing page of my news section, I am displaying a list of recent tags in a sidebar. Here's the code I'm using to do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# grab the entries in the specific locale #}&#xA;{% set entries = craft.entries.find({section: 'newsAndEvents', locale: craft.locale}) %}&#xA;&#xA;{# Grab the related tags for those entries #}&#xA;{% set tags = craft.tags.relatedTo(entries) %}&#xA;&#xA;{# Build the list #}&#xA;{% if tags | length %}&#xA;  &amp;lt;ul class=&quot;tag-list&quot;&amp;gt;&#xA;  {% for tag in tags %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a class=&quot;tag&quot; href=&quot;#&quot;&amp;gt;{{ tag.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;The problem is, when I'm looking at the english version of my landing page, I get both &quot;Tortugas&quot; and &quot;Turtles&quot; in the list output by the code above. What I want is to only see the tags on english versions entries on the english landing page; and the tags on spanish versions of entries on the spanish landing page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some additional info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If an entry has only one published version, english for example, any tags I assign to that version do not appear on the spanish landing page, as would be expected.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On my entry detail pages, I'm using similar code to generate a list of tags assigned to the current entry, and the output is what I expect: english versions only show tags assigned to english versions, not to both english and spanish like on the landing page.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-07-31T09:05:25.023" Title="Show a list of recently used tags only from the current locale" Tags="&lt;localization&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1525" PostTypeId="2" ParentId="1524" CreationDate="2014-07-30T17:59:41.837" Score="6" Body="&lt;p&gt;Brandon at P&amp;amp;T was able to fill in the piece I was missing. He said:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To only get tags that were related from a specific locale, you just need to specify that in your &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; param:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set tags = craft.tags.relatedTo({&#xA;      sourceElement: entries,&#xA;      sourceLocale: craft.locale&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the addition of &lt;code&gt;order('dateCreated desc').limit(10)&lt;/code&gt; to put some additional constraints on what I was getting back, this solved it for me. &lt;/p&gt;&#xA;" OwnerUserId="579" LastEditorUserId="125" LastEditDate="2014-07-31T08:13:16.370" LastActivityDate="2014-07-31T08:13:16.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1526" PostTypeId="1" CreationDate="2014-07-30T18:27:09.443" Score="2" ViewCount="843" Body="&lt;p&gt;Is there a way to duplicate fields when creating &quot;structures&quot; in the visual editor. If I wanted to add four simple textfields, it appears I can't just drag-and-drop four textfields in and give them IDs as that field disappears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. If I have four tabs with headlines... would I need to create four separate fields called &quot;headline&quot;?&lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="57" LastEditDate="2014-07-31T05:05:36.577" LastActivityDate="2014-07-31T06:49:12.273" Title="Can you add duplicates fields in a structured section's GUI?" Tags="&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1527" PostTypeId="1" AcceptedAnswerId="1529" CreationDate="2014-07-30T18:32:33.417" Score="3" ViewCount="734" Body="&lt;p&gt;I just accidentally dragged a root category onto another. Now, all of the entries that were assigned to that category are assigned to the one I accidentally dragged it onto. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, I have like 7 entries but if this happened with a lot of them I'd be pretty screwed. It seems like a disaster waiting to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to &quot;bulk assign&quot; categories? If that's not possible is there anyway to add a &quot;Save&quot; button to the category manager so I'd have to click save before the database actually updates? Am I overlooking something really, really obvious here? Definitely wouldn't be the first time.&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2014-07-30T18:38:09.417" LastActivityDate="2014-07-30T19:23:08.933" Title="Assign entries to categories in bulk?" Tags="&lt;categories&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1528" PostTypeId="1" AcceptedAnswerId="1530" CreationDate="2014-07-30T18:35:37.260" Score="10" ViewCount="2409" Body="&lt;p&gt;Is there a way to place matrix fields inside of matrix fields or also to setup a matrix field with existing fields? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are currently trying not to have duplicate content in terms of fields, but that doesnt seem possible?&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2016-12-20T01:50:35.620" Title="Matrix fields within matrix field" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1529" PostTypeId="2" ParentId="1527" CreationDate="2014-07-30T19:23:08.933" Score="2" Body="&lt;p&gt;I think that, right now, the only way to deal with that is at the DB level. I believe you would only have to deal with the &lt;code&gt;craft_relations&lt;/code&gt; table for adding / removing categories to entries.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-07-30T19:23:08.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1530" PostTypeId="2" ParentId="1528" CreationDate="2014-07-30T20:24:35.063" Score="10" Body="&lt;p&gt;Matrix within Matrix isn't possible... &lt;strong&gt;yet&lt;/strong&gt;. Brandon has stated a few times that it's part of the long-term plan, and it's really more of the UI which is a stumbling block, rather than any major technical challenge.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://plus.google.com/u/0/109046469195386381812/posts/YWHYCDJ2Fzw&quot; rel=&quot;nofollow&quot;&gt;... Matrix within Matrix is still something we intend to get working at some point.&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://viget.com/extend/craft-cms-summit&quot; rel=&quot;nofollow&quot;&gt;… Matrix within Matrix will be coming eventually. The UI is tough, but the code is all in place.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you may want to try using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;LJ Dynamic Fields plugin&lt;/a&gt;. It may not be &lt;em&gt;exactly&lt;/em&gt; what you're dreaming of, but it can certainly help keep things a little DRY-er.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="610" LastEditDate="2014-07-31T17:05:21.117" LastActivityDate="2014-07-31T17:05:21.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1532" PostTypeId="2" ParentId="1514" CreationDate="2014-07-30T20:43:50.990" Score="2" Body="&lt;p&gt;If you encounter problems with assigning variables as the keys, what about putting all your values into objects?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set catObjects = [] %}&#xA;&#xA;{% for cat in allCats %}&#xA;&#xA;    {% set catObject = [&#xA;        { catId: cat.id, catCount: craft.entries.relatedTo(cat).total()  }&#xA;    ] %}&#xA;&#xA;    {% set catObjects = catObjects|merge(catObject) %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-30T20:43:50.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1533" PostTypeId="1" AcceptedAnswerId="1535" CreationDate="2014-07-30T21:18:51.377" Score="5" ViewCount="1021" Body="&lt;p&gt;I've got Email Service working correctly (&lt;a href=&quot;http://buildwithcraft.com/docs/apis/emailservice&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/apis/emailservice&lt;/a&gt;) but what's the best way to include attachments when using this service? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've got so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $email = new EmailModel();&#xA;    $email-&amp;gt;subject = &quot;Thanks!&quot;;&#xA;    $email-&amp;gt;htmlBody = &quot;&amp;lt;h1&amp;gt;Congratulations!&amp;lt;/h1&quot;;&#xA;    $email-&amp;gt;htmlBody .= &quot;&amp;lt;p&amp;gt;Hello World&amp;lt;/p&amp;gt;&quot;;&#xA;    $email-&amp;gt;fromEmail = &quot;email@domain.com&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see there is &lt;strong&gt;$email-&gt;addAttachment&lt;/strong&gt; but I'm not sure what variables to include to make it pass through the service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any examples?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-07-30T21:44:05.567" Title="Best way to include attachments using EmailService [Craft Plugin]?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1534" PostTypeId="2" ParentId="1533" CreationDate="2014-07-30T21:40:12.510" Score="5" Body="&lt;p&gt;In &lt;code&gt;craft/app/models/EmailModel.php&lt;/code&gt; the function docblock describes the params:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Adds an attachment from a path on the filesystem. Returns false if the file could not be found or accessed.&#xA; *&#xA; * @param string $path Path to the attachment.&#xA; * @param string $name Overrides the attachment name.&#xA; * @param string $encoding File encoding (see $Encoding).&#xA; * @param string $type File extension (MIME) type.&#xA; * @throws phpmailerException&#xA; * @return bool&#xA; */&#xA;public function addAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream')&#xA;{&#xA;    $existingAttachments = $this-&amp;gt;attachments;&#xA;    $existingAttachments[] = array('path' =&amp;gt; $path, 'name' =&amp;gt; $name, 'encoding' =&amp;gt; $encoding, 'type' =&amp;gt; $type);&#xA;    $this-&amp;gt;attachments = $existingAttachments;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that what you're looking for?&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2014-07-30T21:40:12.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1535" PostTypeId="2" ParentId="1533" CreationDate="2014-07-30T21:44:05.567" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L51&quot; rel=&quot;nofollow&quot;&gt;Contact Form&lt;/a&gt; plugin has an example of doing this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;addAttachment($message-&amp;gt;attachment-&amp;gt;getTempName(), $message-&amp;gt;attachment-&amp;gt;getName(), 'base64', $message-&amp;gt;attachment-&amp;gt;getType());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;EmailModel-&amp;gt;addAttachment()&lt;/code&gt; signature looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;* @param string $path Path to the attachment.&#xA;* @param string $name Overrides the attachment name.&#xA;* @param string $encoding File encoding (see $Encoding).&#xA;* @param string $type File extension (MIME) type.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is just a thin wrapper for &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php#L2047&quot; rel=&quot;nofollow&quot;&gt;PHPMailer's addAttachment&lt;/a&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-30T21:44:05.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1536" PostTypeId="1" AcceptedAnswerId="1537" CreationDate="2014-07-30T23:02:22.000" Score="9" ViewCount="1194" Body="&lt;p&gt;Two different plugins not showing in the CP after code was pushed to staging server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) Why wouldn't the plugins show in CP if plugins are present in the craft_plugins table?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) How to troubleshoot this issue?&lt;/strong&gt;  I'm not seeing any plugin errors in php-error.log or craft.log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I know:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Two plugins are NOT showing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;truncHTML ( my own custom twigFilter )  &lt;/li&gt;&#xA;&lt;li&gt;the &quot;Import&quot; plugin (&#xA;boboldehampsink v 0.7.1- latest)&lt;/li&gt;&#xA;&lt;li&gt;Other plugins load fine. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;-- Both &quot;missing&quot; plugins are present in the craft_plugins table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Site seems to work file except for missing plugins, and related missing twig filter template error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The filter &quot;truncHTML&quot; does not exist &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-- My Development environment is php 5.4.24.&lt;br&gt;&#xA;-- Staging is PHP 5.3.3 (where Plugins not loading) &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I confirmed that all Craft required PHP extensions are loading on the staging server&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;-- Craft dev mode enabled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- a similar truncate twig filter plugin loads fine.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/07/30 00:51:58 [trace] [system.CModule] Loading &quot;plugins&quot; application component&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (594)&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (226)&#xA;in /var/www/craft.dev/craft/app/index.php (196)&#xA;2014/07/30 00:51:58 [trace] [system.db.CDbCommand] Querying SQL: SELECT `id`, `class`, `version`, `settings`, `installDate`&#xA;FROM `craft_plugins`&#xA;WHERE enabled=1&#xA;in /var/www/craft.dev/craft/app/services/PluginsService.php (101)&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (226)&#xA;in /var/www/craft.dev/craft/app/index.php (196)&#xA;2014/07/30 00:51:58 [profile] [system.db.CDbCommand.query] begin:system.db.CDbCommand.query(SELECT `id`, `class`, `version`, `settings`, `installDate`&#xA;FROM `craft_plugins`&#xA;WHERE enabled=1)&#xA;2014/07/30 00:51:58 [profile] [system.db.CDbCommand.query] end:system.db.CDbCommand.query(SELECT `id`, `class`, `version`, `settings`, `installDate`&#xA;FROM `craft_plugins`&#xA;WHERE enabled=1)&#xA;2014/07/30 00:51:58 [trace] [system.CModule] Loading &quot;messages&quot; application component&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (594)&#xA;in /var/www/craft.dev/craft/app/Craft.php (402)&#xA;in /var/www/craft.dev/craft/plugins/truncate/TruncatePlugin.php (13)&#xA;2014/07/30 00:51:58 [trace] [system.CModule] Loading &quot;i18n&quot; application component&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (594)&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (826)&#xA;in /var/www/craft.dev/craft/app/etc/web/WebApp.php (293)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-- I can include a stack trace detailing the twig &quot;missing filter&quot; error resulting from missing twig filter plugin, but I don't think this helps explain the missing plugin.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any Ideas?  Thanks!!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="232" LastActivityDate="2014-07-30T23:23:10.997" Title="Two Plugins not showing in CP after pushing to staging server" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1537" PostTypeId="2" ParentId="1536" CreationDate="2014-07-30T23:23:10.997" Score="12" Body="&lt;p&gt;Check if the plugin folders in &lt;code&gt;craft/plugins&lt;/code&gt; are named correctly. Most local environments aren't case-sensitive, but most servers are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Valid:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/trunchtml/&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;craft/plugins/import/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Invalid:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/truncHTML/&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;craft/plugins/Import/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-07-30T23:23:10.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1538" PostTypeId="1" CreationDate="2014-07-31T03:17:14.800" Score="4" ViewCount="2648" Body="&lt;p&gt;I'm using image transforms to create 1x versions of hdpi 2x images but one area I get slammed on web page performance is loading these images. Is it possible to compress them and if so, how?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2016-12-05T09:28:57.503" Title="Is it possible to compress image transforms?" Tags="&lt;image-transforms&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1539" PostTypeId="1" CreationDate="2014-07-31T03:34:17.843" Score="2" ViewCount="299" Body="&lt;p&gt;I am running a Nginx server and tried to hide the 'Set-Cookie' parameter from the HTTP header output when using &lt;code&gt;curl -I hostname.com&lt;/code&gt; - I applied the Nginx configuration using: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;proxy_hide_header Set-Cookie;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this worked as intended - until I noticed that any request to login to the control panel simply resulted in reloading the admin login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to change or hide this that still allows users to login to the control panel?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-07-31T04:29:29.633" Title="Change the name of 'CraftSessionId' from HTTP header requests?" Tags="&lt;config&gt;&lt;control-panel&gt;&lt;security&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1540" PostTypeId="2" ParentId="1538" CreationDate="2014-07-31T04:11:44.490" Score="2" Body="&lt;p&gt;Compress?  No.  But you can set a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#defaultImageQuality&quot; rel=&quot;nofollow&quot;&gt;default image quality&lt;/a&gt; for transformed images with the &lt;code&gt;defaultImageQuality&lt;/code&gt; config setting that can be overridden on a per-transform basis from the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That quality value gets passed onto the respective &lt;a href=&quot;http://php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt; or &lt;a href=&quot;http://php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; driver when generating the image and will affect image size and quality.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-31T04:11:44.490" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1541" PostTypeId="2" ParentId="1539" CreationDate="2014-07-31T04:29:29.633" Score="1" Body="&lt;p&gt;I'm not sure I'm understanding 100% what you're trying to do, but by preventing the &lt;code&gt;Set-Cookie&lt;/code&gt; header, aren't you essentially blocking any cookies from being set in your browser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of Craft's authentication is cookie based, so it's not surprising that trying to login to the control panel doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-31T04:29:29.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1542" PostTypeId="2" ParentId="1526" CreationDate="2014-07-31T06:49:12.273" Score="2" Body="&lt;p&gt;An entry type can only use a field once, regardless the tab. But you can reuse the field in other entry types of that same section or reuse it in other sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, that you (currently [*]) always have the same field settings shared with each instance you use it. Meaning that you'll always end up with the same field name and instructions, which sometimes (I'd say often) is a deal breaker for reusability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[*]: if I remember this right, I already made P&amp;amp;T aware of this and made a feature request&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-31T06:49:12.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1543" PostTypeId="2" ParentId="1538" CreationDate="2014-07-31T08:05:58.290" Score="4" Body="&lt;p&gt;All common image file formats are compressed, even lossless formats like RAW, TIFF or PNG use compression!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reduce file size of you images you should choose a lossy format (avoid TIFF Baseline or BMP), and accept some degree of information loss to reduce the file size. You usually set this quality to file size ratio in percentages (for the web). Craft's default quality ratio applied on transforms, &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#defaultImageQuality&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;defaultImageQuality&lt;/code&gt;&lt;/a&gt;, is set to 75%, but you can always set it to your needs &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms#defining-transforms-from-the-control-panel&quot; rel=&quot;nofollow noreferrer&quot;&gt;from the Control Panel&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms#defining-transforms-in-your-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;in your templates&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a nice &lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/c/ce/Quality_comparison_jpg_vs_saveforweb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;chart on Wikimedia&lt;/a&gt;, illustrating the relative quality of quality settings for JPG formats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I'd recommend you to have a look at this &lt;a href=&quot;https://craftcms.stackexchange.com/a/1446/125&quot;&gt;other question&lt;/a&gt; about transformation performance with image libraries supported by Craft.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-07-31T08:05:58.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1544" PostTypeId="2" ParentId="1524" CreationDate="2014-07-31T08:53:49.833" Score="0" Body="&lt;p&gt;I think this is actually two problems you have, Adam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't &lt;code&gt;dateCreated&lt;/code&gt; – which you are now using with the code you provided – something different to &quot;recently used&quot;, your actual plan to filter your tags by? I don't know it there's a built in way to get the therefore necessary info, the &quot;entry-tag-relation creation date&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try &lt;code&gt;dateModified&lt;/code&gt; on the tag model, but I'm not sure if this works (maybe worth a feature request though? → &lt;a href=&quot;http://buildwithcraft.com/help&quot; rel=&quot;nofollow&quot;&gt;support@buildwithcraft.com&lt;/a&gt; or &lt;a href=&quot;https://plus.google.com/u/0/communities/106505340287442511226/stream/3ff4ba0f-25e6-4f6f-ad4b-04da3a7e81c9&quot; rel=&quot;nofollow&quot;&gt;&quot;Craft: Feedback and Ideas&quot; section on g+&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-07-31T09:05:25.023" LastActivityDate="2014-07-31T09:05:25.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1545" PostTypeId="1" AcceptedAnswerId="5337" CreationDate="2014-07-31T10:25:40.207" Score="3" ViewCount="3200" Body="&lt;p&gt;I've been trying to add extra line breaks to a text field, But this seems impossible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most logical thing to do for the user would be to give it an extra linebreak &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those get deleted, sometimes directly, sometimes after opening and then saving again&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;disable cleanup html in the field - still deletes &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the json file settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;tidyHtml: false - no&lt;/li&gt;&#xA;&lt;li&gt;cleanSpaces: false - no&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;removeEmptyTags: false - no&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;linebreaks: true - this converts ALL breaks to line breaks. Not handy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-12-18T16:37:46.713" Title="Placing an extra empty linebreak in the Redactor Field" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1546" PostTypeId="2" ParentId="1545" CreationDate="2014-07-31T10:52:17.743" Score="2" Body="&lt;p&gt;For me this works: &lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-07-31T10:52:17.743" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1547" PostTypeId="1" CreationDate="2014-07-31T14:17:10.810" Score="6" ViewCount="696" Body="&lt;p&gt;Heyo - I have an entry form in which you select/upload assets (photos). The asset has a caption/copyright (custom)field attached to it, so ideally I'd tell them…&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Click &quot;Add Asset&quot; and upload/select your photos&lt;/li&gt;&#xA;&lt;li&gt;When the pills show up in the entry form, double-click them to add captions/copyright&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But, I find that if you do the above, you won't see the caption/copyright field (just title and file name) &lt;em&gt;unless&lt;/em&gt; you save the entry between steps one and two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KMgVi.png&quot; alt=&quot;Before saving…&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IIE1l.png&quot; alt=&quot;After saving…&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see why this could be … the images are probably in a holding position until you save the entry(?). But just wondering if someone can confirm I'm not mucking something up, or maybe has a workaround?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems weird to have a note on the entry form that says &quot;Reminder: 'Save and Continue Editing' to add captions to the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same issue also comes up when you need to upload assets in a field, then in a subsequent field choose one of the assets (say, an entry form where you upload a group of images, then want to select one of the images to be the group's thumbnail).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Tks in advance.&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2014-08-01T17:22:49.857" Title="Uploading Assets w/ Immediate Save?" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1548" PostTypeId="1" AcceptedAnswerId="1595" CreationDate="2014-07-31T14:19:58.087" Score="4" ViewCount="201" Body="&lt;p&gt;Is it possible to make the uploaded &quot;original&quot; images unaccessable for site visitors and make only the transforms public?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to upload images in full quality, to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;get the best possible quality out of Craft transforms&lt;/li&gt;&#xA;&lt;li&gt;make Craft's assets folder basically a backup for my Lighroom library&lt;/li&gt;&#xA;&lt;li&gt;no manual transforms necessary before upload (Craft does the job anyways for all the required 2x, 1x and thumbnail sizes)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The images should be secure in that folder, otherwise I run into possible copyright problems (images would be in printable size and quality).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-04T13:33:55.240" Title="Make &quot;original&quot; images unaccessable?" Tags="&lt;assets&gt;&lt;url&gt;&lt;image-transforms&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1549" PostTypeId="2" ParentId="1471" CreationDate="2014-07-31T16:54:37.437" Score="5" Body="&lt;p&gt;I'm actually not sure how it would work if you're trying to reference another plugin's services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works in Craft by defining the property in the PHPDoc in &lt;code&gt;WebApp.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@property AssetsService $assets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That lets PHPStorm know that there exists an AssetsService object off of &lt;code&gt;craft()-&amp;gt;assets&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it's not like we can add a hook for the PHPDoc so plugins can inject their own... maybe through some crazy reflection magic, but it'd be super hackey.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-31T16:54:37.437" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1550" PostTypeId="1" AcceptedAnswerId="1554" CreationDate="2014-07-31T17:13:11.680" Score="9" ViewCount="944" Body="&lt;p&gt;I have a site that uses several PDF forms that update from time to time. Instead of adding a new asset, I would rather replace the existing one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't see how to do that from within the Craft admin. I suppose it's possible to do via FTP, but I'd really like it to be able to be done by the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something, or is this not possible at this time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="196" LastEditorUserId="57" LastEditDate="2014-07-31T18:04:31.053" LastActivityDate="2014-08-01T11:55:45.033" Title="Is it possible to replace uploaded assets?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1551" PostTypeId="2" ParentId="1523" CreationDate="2014-07-31T17:17:55.547" Score="5" Body="&lt;p&gt;Not with the out-of-the-box field types. You could create a field type that is category+default. The &lt;a href=&quot;https://github.com/marionnewlevant/craft-defaultcolor&quot;&gt;Default Color&lt;/a&gt; plugin might be a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-31T17:17:55.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1552" PostTypeId="2" ParentId="1467" CreationDate="2014-07-31T17:34:31.310" Score="3" Body="&lt;p&gt;I kludged this to work by creating a global whose value was the entry I wanted to use as the home page (&lt;code&gt;everyPage.homePage&lt;/code&gt;), and then on &lt;code&gt;_pages/_entry.html&lt;/code&gt; using twig to sort things out based on the entry:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if no entry: 404 (this should never happen)&lt;/li&gt;&#xA;&lt;li&gt;if entry is &lt;em&gt;everyPage.homePage&lt;/em&gt;: 404&lt;/li&gt;&#xA;&lt;li&gt;if entry is the Craft home page single: set entry to &lt;em&gt;everyPage.homePage&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then proceed as normal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;  {% exit 404 %}&#xA;{% elseif entry.id == everyPage.homePage.first.id %}&#xA;  {% exit 404 %}&#xA;{% elseif entry.id == craft.entries.section('homePage').first().id %}&#xA;  {% set entry = everyPage.homePage.first %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This was using a channel (not a structure) for the pages, and the URL is simply &lt;code&gt;{slug}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-07-31T17:34:31.310" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1553" PostTypeId="2" ParentId="1550" CreationDate="2014-07-31T17:38:22.347" Score="0" Body="&lt;p&gt;No, I don't think it's currently possibly &lt;strong&gt;[from the entry section]&lt;/strong&gt;. You'll always end up with a new file, filename and URL, if an asset already exists with the same file name. To be able to upload an updated version of that asset, you'd need to properly delete the old file first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was a related &lt;a href=&quot;https://plus.google.com/110713469361173113445/posts/i2w5vDFGmd7&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; on +g not long ago. Jamie Wade asked to make it possible to delete (and rename) assets through the asset field &lt;strong&gt;while editing an entry&lt;/strong&gt;. If this get's implemented, your client should be able to update the assets with ease. You should just tell him the difference between the minus sign (to just remove the relation), and the UI for proper deletion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This is only true, if you're dealing with assets from the entry section the the Control Panel. Currently the best way to replace / update assets is through the assets section in the CP (&lt;a href=&quot;https://craftcms.stackexchange.com/a/1554/125&quot;&gt;see Peter's answer&lt;/a&gt;), some things probably change with Craft 2.2 though.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-01T11:55:45.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1554" PostTypeId="2" ParentId="1550" CreationDate="2014-07-31T17:49:20.330" Score="11" Body="&lt;p&gt;This actually is possible if you navigate to the folder or sub folder where you are trying to add the asset and then upload a file with the exact same file name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will ask you if you want to replace the existing file or upload another version with an appended name (for example &quot;my-file-1.txt&quot;)&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-07-31T17:49:20.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1555" PostTypeId="1" AcceptedAnswerId="1556" CreationDate="2014-07-31T17:55:34.197" Score="4" ViewCount="2331" Body="&lt;p&gt;We have a date/time field shown to render the time for a series of workshops but right now Craft only increments in 30 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for us to render 15 minute increments? &lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2014-07-31T18:15:02.707" LastActivityDate="2015-03-08T07:14:27.090" Title="Is it possible to change the time increments in the Date/Time field?" Tags="&lt;datetime&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1556" PostTypeId="2" ParentId="1555" CreationDate="2014-07-31T18:16:03.853" Score="4" Body="&lt;p&gt;Not currently, but it should probably be a setting on the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently uses &lt;a href=&quot;https://jonthornton.github.io/jquery-timepicker/&quot; rel=&quot;nofollow&quot;&gt;jquery.timepicker&lt;/a&gt; (in &lt;code&gt;craft/app/resources/lib/jquery.timepicker/jquery.timepicker.js&lt;/code&gt;) and is just going with it's default &lt;code&gt;step: 30&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add it to “The List”™.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-31T18:16:03.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1557" PostTypeId="1" AcceptedAnswerId="1561" CreationDate="2014-07-31T19:42:50.197" Score="6" ViewCount="178" Body="&lt;p&gt;When searching for an Asset in the Assets Control Panel, does it search everywhere? Does it search in subfolders? e.g., If I search for the title &quot;image_1&quot;, does my search need to be done on the folder &quot;image_1&quot; is in for the search to return anything?&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="50" LastEditDate="2014-07-31T20:12:33.500" LastActivityDate="2014-12-22T17:49:40.040" Title="Assets Control Panel searches only current folder, not sub folders?" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1558" PostTypeId="2" ParentId="1523" CreationDate="2014-07-31T20:00:16.433" Score="6" Body="&lt;p&gt;You could output the categories in a way that makes them look like they are from a specific category when they don't have any categories assigned to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're outputting any of the entries, just add a custom link if there isn't a category assigned:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.categories|length %}&#xA;    {% for category in entry.categories %}&#xA;        &amp;lt;a href=&quot;/blog/category/{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;/blog/category/default-category-slug&quot;&amp;gt;Default Category Title&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Create a route that points &quot;/blog/category/default-category-slug&quot; to your filtered listing template (/blog/index, /blog/category etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the filtered listing template check if the default category slug is in the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if craft.request.getSegment(3) == 'default-category-slug' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that evaluates to true, you can now get the entries without any categories assigned to them and loop through them, see this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/603/how-to-find-entries-with-no-category&quot;&gt;How to find entries with no category&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set uncategorized = craft.entries.section('blog').search('-categories:*') %}&#xA;{% for entry in uncategorized %}&#xA;    {# show entry #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Any other times you need to get the entries that &quot;have&quot; the default category, to loop through them, use &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.relatedTo&lt;/code&gt;&lt;/a&gt; on etc., instead of using:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entriesWithDefaultCategory = craft.entries.section('blog').relatedTo('the-default-category') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use this like on the filtered listing above:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set uncategorized = craft.entries.section('blog').search('-categories:*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-07-31T20:00:16.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1559" PostTypeId="1" AcceptedAnswerId="1560" CreationDate="2014-07-31T20:41:17.703" Score="12" ViewCount="1032" Body="&lt;p&gt;I can't seem to edit entry details all of a sudden: in this Products section (and &lt;em&gt;only&lt;/em&gt; this one section), the page title and &quot;Current Version&quot; button will render, but the rest of the page is missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XEHV3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only clue is this line from Craft's log:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[31-Jul-2014 19:07:36 UTC] PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /Users/gob/projects/gobias/craft/app/vendor/twig/twig/lib/Twig/Node.php on line 140&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've loaded earlier MySQL backups, restarted MAMP Pro (PHP 5.5.10), cleared Craft's caches, tried different browsers and machines, and the problem persists.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2016-02-27T10:50:33.807" Title="Why are some entry detail views empty in the control panel?" Tags="&lt;control-panel&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1560" PostTypeId="2" ParentId="1559" CreationDate="2014-07-31T20:44:42.533" Score="25" Body="&lt;p&gt;That error isn't a Craft or PHP error, it's coming from older versions of &lt;a href=&quot;http://xdebug.org/&quot;&gt;xDebug&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can happen on more complicated pages (lots of fields, tabs, etc.), but you can get around it by adjusting the &lt;a href=&quot;http://xdebug.org/docs/all_settings#max_nesting_level&quot;&gt;xdebug.max_nesting_level&lt;/a&gt; to something higher than the default 100 or to upgrade xDebug to 2.3+, which has changed to the default value to 256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you don't have to have an active debug session going on in order to run into this, you just have to have the xDebug extension installed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-01-13T03:27:44.403" LastActivityDate="2016-01-13T03:27:44.403" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1561" PostTypeId="2" ParentId="1557" CreationDate="2014-07-31T21:08:58.473" Score="2" Body="&lt;p&gt;Correct... currently searching in Assets does not search across sub-folders.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-07-31T21:08:58.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1562" PostTypeId="1" CreationDate="2014-08-01T00:11:41.140" Score="3" ViewCount="441" Body="&lt;p&gt;I have a section &quot;projects&quot; with entry type (projectPage) with and an index page set up displaying a grid view of entries.  I have also set up category filtering via links to the {{category.url}} which point to the projects/index template.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add another entry type (projectList)  that will have entries that&#xA;1. have only title and category relationships defined&#xA;2. do not have their own url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add a toggle button to the page that will change the display from a grid view to a list view combining the (projectPage) entries and (projectList) entries, but I want it to remain in effect as you cycle through the categories, until it is deselected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had some success setting  up a route to projects/list  that filtered the entry types based on the url with   &lt;code&gt;{% if craft.request.getSegment(2) == link %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but the relationship brakes when I click on a category link.  I'd prefer to have everything in the same template file and not add the &quot;list&quot; to the url if possible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm think that to hide the (projectList) entry URL's I'd have to set up another section &quot;projectListings&quot;  and set up routes  for project/list to point to the new index template and add routes for each category for project/list/{{cat}}  but I'm hitting a roadblock as to if this is the best way to go about it, and how exactly to implement it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this is not too broad a question, as I could use a little direction.  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="519" LastActivityDate="2014-08-01T13:31:32.587" Title="How do I toggle list/grid view on section index page without affect category filtering" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1563" PostTypeId="1" CreationDate="2014-08-01T00:12:28.783" Score="2" ViewCount="111" Body="&lt;p&gt;We have found that craft (and twig mostly) combined with bootstrap make a great prototyping tool.  We'd started up a number of projects that use templating and lots of fun twig stuff but no real need to anything in the database&lt;/p&gt;&#xA;&#xA;&lt;p&gt;right now we go through the entire craft install and setup a database anyways but curious if it would be possible to run just the templating part of craft without a database at all?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-08-01T03:45:32.123" Title="Simple way to use craft for databaseless prototypes" Tags="&lt;templating&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1564" PostTypeId="2" ParentId="1563" CreationDate="2014-08-01T03:45:32.123" Score="3" Body="&lt;p&gt;Using Craft without a database isn't possible, you're probably best off doing things the way you are now (with a minimal Craft install).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At its core, Craft is built on two very powerful frameworks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Twig&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Yii&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(There are other components as well, but these are the driving forces.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, of course, just use &lt;strong&gt;Twig&lt;/strong&gt; as a templating language for your prototyping. But that's all you'll have... a templating language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't use &lt;strong&gt;Yii&lt;/strong&gt; without a database, since the primary purpose of Yii is to act as a DAO (Data Access Object). Without a database, it's kinda useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My official recommendation:&lt;/strong&gt; Create a &quot;base installation&quot; repo with a generic website, and have Craft completely installed. Then you can quickly clone that and work your prototyping magic!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-01T03:45:32.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1565" PostTypeId="2" ParentId="1400" CreationDate="2014-08-01T08:54:13.613" Score="4" Body="&lt;p&gt;I ended up hacking the ContactFormService.php file with some extra code for the body&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's actually quite simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$email-&gt;body = &quot;Sender: &quot;.$message-&gt;fromName.&quot;\n\nEmail-addreas: &quot;.$message-&gt;fromEmail.&quot;\n\nMessage: &quot;.$message-&gt;message;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same thing for cc mail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood 2.2 will have a plugin hook for this kind of added functionality (emails.onBeforeSend event)&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-08-01T08:54:13.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1566" PostTypeId="1" AcceptedAnswerId="1622" CreationDate="2014-08-01T09:29:27.723" Score="3" ViewCount="2872" Body="&lt;p&gt;I am looking for something quite simple, but I still can't find a way to do it in twig syntax. So basically here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upperlimit = 3 %}&#xA;    {% for entry in entry.getChildren() %}&#xA;        {% if loop.index0 &amp;lt; upperlimit %}&#xA;            &amp;lt;button type=&quot;button&quot; class=&quot;btn btn-default ma-category-btn {% if loop.first %}first{% endif %} {% if loop.index == upperlimit %}last{% endif %}&quot;&amp;gt;{{ entry. title }} &amp;lt;span class=&quot;glyphicon glyphicon-info-sign&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;button type=&quot;button&quot;  class=&quot;btn btn-default ma-more-category-btn&quot;&amp;gt;VIEW MORE CATEGORIES&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically when I click on the button &quot;VIEW MORE CATEGORIES&quot;, it should load the next three children and create three more buttons like the ones in the &lt;code&gt;for&lt;/code&gt; loop if there are enough children for that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have this dynamic behaviour in craft and twig?&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="392" LastEditDate="2014-08-04T19:16:43.610" LastActivityDate="2014-08-05T09:42:56.700" Title="Dynamically load craft entries based on twig variable" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1567" PostTypeId="1" AcceptedAnswerId="1569" CreationDate="2014-08-01T10:34:32.780" Score="3" ViewCount="587" Body="&lt;p&gt;Having much success with the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import Plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also raised this &lt;a href=&quot;https://github.com/boboldehampsink/import/issues/9&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, but thought this forum perhaps better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to force through a Post Date on my imports, but nothing is being respected, also, doesn't map automatically. All other fields have imported flawlessly, but PostDate seems to stick with the current date (not the date from years ago I want to be the postDate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I check please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have CSV column titled tried a few but thought &quot;postDate&quot; would work best.&#xA;Date format, matched &quot;31/07/2014&quot; to the field, and &quot;31/07/2014 00:00&quot; but can't get anything to stick though any method (append, or replace)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="177" LastEditDate="2014-08-01T19:33:34.907" LastActivityDate="2014-08-01T19:33:34.907" Title="Import Plugin date format (Post Date postDate)" Tags="&lt;control-panel&gt;&lt;postdate&gt;&lt;plugin-import&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1568" PostTypeId="1" CreationDate="2014-08-01T11:57:40.947" Score="7" ViewCount="2806" Body="&lt;p&gt;I've uploaded the files, verified permissions and set up the database. When I run the install, I see the monkey, and I enter in my details. It appears to go well, until a screen showing only: &amp;quot;&lt;strong&gt;Oops&lt;/strong&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://github.com/putyourlightson/craft-requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ben Croker's Craft Requirements Checker&lt;/a&gt;, I get:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Success&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Minimum requirements met. Craft can run on this server!!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The server is running &lt;strong&gt;MySQL 5.1.56&lt;/strong&gt; with &lt;strong&gt;InnoDB&lt;/strong&gt;, so I believe it's capable of running Craft.&lt;/p&gt;&#xA;&lt;p&gt;Any advice?&lt;/p&gt;&#xA;" OwnerUserId="612" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-05-11T12:26:21.977" Title="Craft install stuck on &quot;Oops&quot; screen" Tags="&lt;database&gt;&lt;install&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2017-06-15T19:01:24.630" ContentLicense="CC BY-SA 3.0" />
  <row Id="1569" PostTypeId="2" ParentId="1567" CreationDate="2014-08-01T12:16:50.360" Score="3" Body="&lt;p&gt;I haven't yet used the plugin, but I'd try to import the dates into another, custom datetime field (e.g. myImportDate) to see if it's a problem with &lt;code&gt;postDate&lt;/code&gt; being a special field (also goes into other tables in the DB, as far as I know). This would be for testing purposes only...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another hint that might help:&lt;br&gt;&#xA;Craft usually saves a datetime in a format like so: &quot;2014-07-31 12:00:00&quot;. I've no idea if this is relevant for your plugin though. Same applies for the timezone, as &lt;a href=&quot;http://buildwithcraft.com/docs/date-time-fields&quot; rel=&quot;nofollow&quot;&gt;Craft saves a datetime in UTC&lt;/a&gt;. As the plugin uses the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice#saveEntry&quot; rel=&quot;nofollow&quot;&gt;saveEntry API&lt;/a&gt;, you probably don't have to care about the timezone, but the string format could break it for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK,&lt;code&gt;postDate&lt;/code&gt; should be possible and the timezone defined after Craft install should be used to save datetime values. I'd bet it's the unusual &quot;31/07/2014 00:00&quot; format, Simon!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-01T12:28:06.287" LastActivityDate="2014-08-01T12:28:06.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1571" PostTypeId="2" ParentId="1566" CreationDate="2014-08-01T12:58:26.977" Score="4" Body="&lt;p&gt;You can't use Twig for dynamic interactions on your site, as it is a server side language. Twig compiles to PHP code, which is then rendered and loaded to the DOM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you'd need is a script running in userland. The technique Stehen suggested is one way to do it, but you probably don't want your site's visitors to load all data right from the start, using the button simply to reveal already loaded &quot;extra entries&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd say you should learn how to do &lt;a href=&quot;http://api.jquery.com/load/&quot; rel=&quot;nofollow&quot;&gt;AJAX loading&lt;/a&gt; with Javascript or jQuery. This is how you could properly address the desired behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A way to make it work with your Craft template would be to split your entries list into multiple parts using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;paginate&lt;/code&gt;&lt;/a&gt; tag. The first block would load right away and then with every click on that button each succeeding entry block is loaded into the DOM via Javascript.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-01T12:58:26.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1572" PostTypeId="2" ParentId="1562" CreationDate="2014-08-01T13:31:32.587" Score="2" Body="&lt;p&gt;If I don't misunderstand anything from your question, you're basically looking for a way to pass data with a link, in your case the toggle state, which is responsible for the grid / list view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's multiple ways to do that. See Brad's short but precise &lt;a href=&quot;https://craftcms.stackexchange.com/q/897/125&quot;&gt;answer on an related question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You said that you're preferably looking for a way that doesn't reveal the toggle state in the URL. I can understand the thinkings behind that, but keep in mind, that this is the only way one could save the site or post a link to someone else with the information included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea: Most sites probably use Javascript for such a toggle (I've seen many Wordpress themes with such a feature). But you'd still need to save the state somehow or completely AJAXify the relevant pages.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-01T13:31:32.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1573" PostTypeId="2" ParentId="1567" CreationDate="2014-08-01T13:56:12.873" Score="2" Body="&lt;p&gt;Yes, thanks carlcs!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as long as your &lt;code&gt;postDate&lt;/code&gt; is set to this format &quot;2014-07-31 12:00:00&quot; and NOT your localised version as it appears in the Control Panel, everything works. Thanks to the magic of the import plugin, I can overwrite just the one field.&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-08-01T13:56:12.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1574" PostTypeId="2" ParentId="1547" CreationDate="2014-08-01T17:22:49.857" Score="3" Body="&lt;p&gt;So, thanks to @carlcs for verifying it was my setup…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;turns out I had set the asset's Default Upload Location to include the slug (i.e. /photography/{slug}) and restricted uploads to that folder. This way images would end up in a folder whose name matched the entry slug, making it easier to clean out unused assets from time-to-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that approach was the source of the problem. Once I removed {slug} from the default upload location it all worked as expected, the caption field appeared immediately after adding the asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, in retrospect this makes total sense — there's no {slug} until you save the entry.&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2014-08-01T17:22:49.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1575" PostTypeId="2" ParentId="1568" CreationDate="2014-08-01T18:50:55.770" Score="5" Body="&lt;p&gt;The cause of this is most likely an overloaded (very common if this is a shared hosting account) or misconfigured MySQL server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The installer itself should only take 10-20 seconds on 99% of hosts.  However on this one, it sits for about 120 seconds, before Apache redirects the AJAX request to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'p' =&amp;gt; 'internal_error.html',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As seen from your log files.  The underlying error is probably being logged in your Apache error logs, but it is most likely something related to a timeout from the long request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to manually execute the SQL from a database dump that is working, removing Craft from the equation entirely, it does finish in time, but still takes about 45 seconds when it should be done in less than 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd contact your host and ask them to check on the performance/configuration of your MySQL box.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-01T18:50:55.770" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1576" PostTypeId="1" AcceptedAnswerId="1581" CreationDate="2014-08-02T11:51:44.557" Score="3" ViewCount="143" Body="&lt;p&gt;We're setting up craft as a webservice. One of my programmers came to me and said every &quot;slug&quot; he called from the frontend application resulted in a 302 redirect to the login page of craft CP. Afer some investigation it seems that he didnt sent any Useragent string from his frontend curl client. After adding a useragent string everything went ok. Is this normal behaviour or can it be configured?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="571" LastEditorUserId="57" LastEditDate="2014-08-02T23:52:11.337" LastActivityDate="2015-01-16T14:56:24.827" Title="Is it possible to use Craft as a webservice when no useragent is sent?" Tags="&lt;plugin-development&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1577" PostTypeId="1" AcceptedAnswerId="1579" CreationDate="2014-08-02T12:44:01.927" Score="3" ViewCount="306" Body="&lt;p&gt;I am trying to pass a member's &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt; to the title on a member profile page. I am using segment 2 to capture the username. This works well in the &lt;code&gt;for&lt;/code&gt; loop in the &lt;code&gt;block&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}&#xA;{% for partner in thePartner %}&#xA;First Name and Last Name: {{ partner.firstName}} {{ partner.lastName }}&#xA;{% endfor %)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outside the &lt;code&gt;block&lt;/code&gt;, where I set the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt;, it doesn't work. Essentially, I would like to set the full name and use it in the title, like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fullname = partner.firstName ~ ' ' ~ partner.lastName %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with something like the following in _layout: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ fullname }} | {{ siteUrl }} &amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I pass the full name through?&lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2014-08-02T13:12:34.870" Title="How do I pass a user's first name and last name from a user profile page to the title in _layout?" Tags="&lt;templating&gt;&lt;users&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1578" PostTypeId="1" AcceptedAnswerId="1580" CreationDate="2014-08-02T13:11:51.650" Score="4" ViewCount="1046" Body="&lt;p&gt;This seems simple, but I cannot get it to render -- how do display a user's User Group? Assuming I set the user in segment 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}&#xA;This Is My User Group: {% ???? %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="79" LastActivityDate="2014-08-02T14:43:49.303" Title="How do you display a user's User Group?" Tags="&lt;templating&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1579" PostTypeId="2" ParentId="1577" CreationDate="2014-08-02T13:12:34.870" Score="5" Body="&lt;p&gt;Since you're just expecting one, you should only look for one. Then you don't have to use a for loop. Plus, fullName is already an attribute of user models. So you can do this for the title:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thePartner = craft.users.username( craft.request.getSegment(2) ).first() %}&#xA;&amp;lt;title&amp;gt;{{ thePartner.fullName }} | {{ siteUrl }} &amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're still having trouble, it may be with what segments you are pulling from the URL.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-08-02T13:12:34.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1580" PostTypeId="2" ParentId="1578" CreationDate="2014-08-02T14:43:49.303" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#getGroups&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; has a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;getGroups()&lt;/a&gt; function which:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Returns an array of&#xA;  &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usergroupmodel&quot; rel=&quot;nofollow&quot;&gt;UserGroupModel&lt;/a&gt;&#xA;  objects that the user belongs to.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since a user can belong to multiple usergroups, you have to loop through the array containing them:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}&#xA;&#xA;# Loop through array of UserGroupModels #&#xA;{% for group in thePartner.getGroups() %}&#xA;    # Print name of current UserGroupModel #&#xA;    {{ group.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are sure the user only belongs to one group, you can fetch the first UserGroupModel from like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}&#xA;&#xA;# Get first UserGroupModel #&#xA;{% set group = thePartner.getGroups().first %}&#xA;&#xA;# Print name #&#xA;{{ group.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-02T14:43:49.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1581" PostTypeId="2" ParentId="1576" CreationDate="2014-08-02T14:50:26.610" Score="7" Body="&lt;p&gt;This post may help:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/364/is-it-possible-to-disable-requireuseragentandipforsession-for-specific-instanc&quot;&gt;Is it possible to disable `requireUserAgentAndIpForSession` for specific instances?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;requireUserAgentAndIpForSession&lt;/code&gt;&lt;/a&gt; config-setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Post from phone, sorry if formatting is a bit off.&lt;/p&gt;&#xA;" OwnerUserId="260" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-08-02T14:55:59.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1582" PostTypeId="1" AcceptedAnswerId="1583" CreationDate="2014-08-02T22:14:05.477" Score="5" ViewCount="3760" Body="&lt;p&gt;I know I can set the template in the email settings to use a HTML template but how do I pass the content of the system messages (activate your account, reset your password, etc) to this template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added this to the html template but then the email that is sent is blank:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2014-08-03T00:23:02.257" Title="Pass content of system messages to HTML Email Template" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1583" PostTypeId="2" ParentId="1582" CreationDate="2014-08-03T00:23:02.257" Score="14" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/apis/emailservice#sendEmailByKey&quot;&gt;EmailService-&gt;sendEmailByKey()&lt;/a&gt; sets the &lt;code&gt;htmlBody&lt;/code&gt; property of &lt;code&gt;EmailModel&lt;/code&gt; to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$emailModel-&amp;gt;htmlBody = &quot;{% extends '{$template}' %}\n&quot;.&#xA;    &quot;{% set body %}\n&quot;.&#xA;        $emailModel-&amp;gt;htmlBody.&#xA;    &quot;{% endset %}\n&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if you've got a custom email template in &lt;code&gt;craft/templates/email.html&lt;/code&gt;, in the control panel under Settings → Email → HTML Email Template, you'd set the value to &lt;code&gt;email.html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you'd simply output the dynamic email content in your template by using &lt;code&gt;{{ body }}&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;        &amp;lt;div&amp;gt;&#xA;            {{ body }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-03T00:23:02.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1584" PostTypeId="1" AcceptedAnswerId="1587" CreationDate="2014-08-03T00:40:49.067" Score="3" ViewCount="246" Body="&lt;p&gt;I am in the process of building my first multilingual Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site will have two languages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;English (default)&lt;/li&gt;&#xA;&lt;li&gt;Spanish&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When setting up the site, I chose &lt;code&gt;U.S. English&lt;/code&gt; and &lt;code&gt;Spanish - United States&lt;/code&gt; as the respective locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now thinking it might be better to keep the languages less specific to the United States and would like to switch the two to &lt;code&gt;English&lt;/code&gt; and &lt;code&gt;Spanish&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if it is possible to do this without losing any content that has already been entered under both &lt;code&gt;U.S. English&lt;/code&gt; and &lt;code&gt;Spanish - United States&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="78" LastActivityDate="2014-08-03T12:21:05.433" Title="Converting existing content to a different locale" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1585" PostTypeId="1" CreationDate="2014-08-03T04:37:22.320" Score="2" ViewCount="43" Body="&lt;p&gt;I'm creating a structure page for collections. What is the best way to display collections by year? Should I use tags? How can I implement that?﻿&lt;/p&gt;&#xA;" OwnerUserId="617" LastActivityDate="2014-08-03T06:05:10.667" Title="How to display a collection for admins" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1586" PostTypeId="2" ParentId="1585" CreationDate="2014-08-03T06:05:10.667" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entry-archive&quot; rel=&quot;nofollow&quot;&gt;How do I create an “Archive” page for my entries?&lt;/a&gt; covers this.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-03T06:05:10.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1587" PostTypeId="2" ParentId="1584" CreationDate="2014-08-03T12:21:05.433" Score="8" Body="&lt;p&gt;Currently it's not possible to edit a locale from the CP, which means you have to edit it directly in your db.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit locale:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;UPDATE craft_locales SET locale = 'en' WHERE locale = 'en_us';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit elements:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each element (entries, assets, users, etc.) which can be translated has a &lt;code&gt;locale&lt;/code&gt;-column:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;UPDATE craft_categorygroups_i18n SET locale = 'en' WHERE locale = 'en_us';&#xA;UPDATE craft_content             SET locale = 'en' WHERE locale = 'en_us';&#xA;UPDATE craft_elements_i18n       SET locale = 'en' WHERE locale = 'en_us';&#xA;UPDATE craft_entryversions       SET locale = 'en' WHERE locale = 'en_us';&#xA;UPDATE craft_sections_i18n       SET locale = 'en' WHERE locale = 'en_us';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit permissions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;UPDATE craft_userpermissions SET name = 'editlocale:en' WHERE name = 'editlocale:en_us';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Check:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be sure you've got them all do a sql search for &lt;code&gt;en_us&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-03T12:21:05.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1589" PostTypeId="1" AcceptedAnswerId="1592" CreationDate="2014-08-03T18:41:53.663" Score="2" ViewCount="385" Body="&lt;p&gt;Assuming that I’ve a total number of 10 entries in my &lt;strong&gt;section('exhibitions')&lt;/strong&gt; where 8 of them have their &lt;strong&gt;entry.endingDate &amp;lt; now&lt;/strong&gt;, I limit the display to 8 entries but the paginate shows a &lt;strong&gt;next button&lt;/strong&gt; whereas the next page is empty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('exhibitions').limit(8) as pastExhibitions %}&#xA;    {% for entry in pastExhibitions %}&#xA;        {% if entry.endingDate &amp;lt; now %}&#xA;            …&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;button previous&quot;&amp;gt;&amp;amp;larr; Précédent&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;button next&quot;&amp;gt;Suivant &amp;amp;rarr;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I add a date filter, in this case &lt;strong&gt;&amp;lt; now&lt;/strong&gt;, to the paginate configuration in order to only paginate on entries that are &lt;strong&gt;&amp;lt; now&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2014-08-04T00:46:24.770" Title="How to use paginate with a date filter?" Tags="&lt;entries&gt;&lt;sections&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1590" PostTypeId="1" AcceptedAnswerId="1591" CreationDate="2014-08-03T20:52:36.327" Score="3" ViewCount="369" Body="&lt;p&gt;I'm in the process of developing a site for a client and I'd like to give them access to the control panel on the staging server so they can begin to enter content for their &quot;News&quot; channel, which is set up and ready to go, and for which they have lots of historical content to enter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that I'm still developing the rest of the site and want to come up with the most painless way possible of keeping their content in-tact in the database without breaking my development workflow as I continue to create additional fields and templates for the remaining sections of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I can easily export just their &quot;News&quot; channel content from the staging database periodically, importing it into my local database and eventually migrating my more complete local database back to staging as I finish more sections?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-08-03T21:11:33.327" Title="How to export client-entered content for a specific channel to keep my local database in sync with staging" Tags="&lt;database&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1591" PostTypeId="2" ParentId="1590" CreationDate="2014-08-03T21:11:33.327" Score="4" Body="&lt;p&gt;There's currently not an easy or clean answer for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;great answers here&lt;/a&gt; on different solutions for handling data syncing/migrations across multiple environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got some ideas of our own on how we'd like to make this less painful for users (it's a PITA for us as well), with syncing / importing / exporting data between Craft installs, but unfortunately we don't have an ETA on it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-03T21:11:33.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1592" PostTypeId="2" ParentId="1589" CreationDate="2014-08-04T00:46:24.770" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('exhibitions').endingDate('&amp;lt; ' ~ now).limit(8) as pastExhibitions %}&#xA;  ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will paginate the entries in section &lt;em&gt;exhibiitions&lt;/em&gt; with &lt;em&gt;endingDate&lt;/em&gt; &lt;strong&gt;&amp;lt; now&lt;/strong&gt;. That &lt;code&gt;~&lt;/code&gt; is string concatination operator. The string '&amp;lt; 2014-08-04' queries for entries with endingDate in the past.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-04T00:46:24.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1593" PostTypeId="1" CreationDate="2014-08-04T11:41:47.807" Score="7" ViewCount="670" Body="&lt;p&gt;I have a model that returns markup as part of a variable. To escape twig's encoding we have to include the raw filter, like so : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.customField | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The encoded output of that field is never useful, so ideally we'd have a way to get the same result without that twig filter. ie : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.customField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the various twig and template components I doubt this is possible, but is there any hidden ways to get this working? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all designed to remove that extra requirement from the usage, so wrapping unescape tags around it isn't want I'm looking for.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="45" LastEditDate="2014-08-04T15:54:35.940" LastActivityDate="2014-08-17T14:46:07.427" Title="How can I pre-raw a Model attribute for the Twig template? (ie. &quot;myModel.myAttr&quot; without requiring the raw filter)" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1594" PostTypeId="1" CreationDate="2014-08-04T12:37:25.050" Score="2" ViewCount="392" Body="&lt;p&gt;I have a photography website with just two categories, 'Lifestyle' and 'Food'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to display the content&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have a category group called 'photoCategories' to which I have assigned two categories 'Lifestyle' and 'Food'.  I also have a Category field 'imageCategory'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I have two Entries, one for Lifestyle and one for Food and I have linked to the appropriate category in the category field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 'category' template but I can't figure how to pull the appropriate content based on the URI and how to pull All content (within) the category group for when the user selects All?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;My navigation needs to look as follows:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Homepage (Single)&#xA;All Images ('images' Channel)&#xA;Lifestyle Photos ('images' Channel)&#xA;Food Photos ('images' Channel)&#xA;About Us (Single)&#xA;Contact Us (Single)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice is very much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2014-08-11T18:13:56.407" Title="Showing specific category content as well as ALL" Tags="&lt;templating&gt;&lt;categories&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1595" PostTypeId="2" ParentId="1548" CreationDate="2014-08-04T13:26:08.637" Score="2" Body="&lt;p&gt;Since all &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;asset transforms&lt;/a&gt; are saved in a sub-directory starting with an underscore, you could simply test for that.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Original:&lt;/strong&gt;&lt;br&gt;&#xA;  /assets/folder/house.png&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Transforms:&lt;/strong&gt;&lt;br&gt;&#xA;  /assets/folder/_900x500/house.png&lt;br&gt;&#xA;  /assets/folder/_thumb/house.png&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your asset-folder is above &lt;code&gt;public_html&lt;/code&gt;, and the request is routed through Craft, you could &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;create a plugin&lt;/a&gt;, which checks for the underscore:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    //Is resource request?&#xA;    if (craft()-&amp;gt;request-&amp;gt;isResourceRequest()) {&#xA;&#xA;        //Parent directory&#xA;        $parent_dir = dirname(craft()-&amp;gt;request-&amp;gt;getUrl());&#xA;&#xA;        //Check if parent dir doesn't beginns with an underscore&#xA;        if (!preg_match('/^[\/\\]*([_]+)/U', $parent_dir)) {&#xA;            exit(403);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;.htaccess:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your assets can be accessed directly, you'd have to use .htaccess to deny the request. I'm really bad at RewriteConditions, so this would possible be a question for &lt;a href=&quot;http://stackoverflow.com&quot;&gt;StackOverflow&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-08-04T13:33:55.240" LastActivityDate="2014-08-04T13:33:55.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1596" PostTypeId="1" AcceptedAnswerId="1599" CreationDate="2014-08-04T13:38:57.513" Score="2" ViewCount="262" Body="&lt;p&gt;Can the Entry URL Format of a Channel intersect with the Entry URL Format of a Structure? For example I have a Structure like this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top-Level Entries: products/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nested Entries: {parent.uri}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can a Channel Entry URL Format be set so that the scenario below is possible?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;products/shirts/reviews &amp;lt;-- review list page&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;products/shirts/reviews/{slug} &amp;lt;-- individual review&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="122" LastEditorUserId="122" LastEditDate="2014-08-04T14:30:20.490" LastActivityDate="2014-08-04T14:58:46.140" Title="Can the Entry URL Format of a Channel intersect with the Entry URL Format of a Structure?" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1597" PostTypeId="1" CreationDate="2014-08-04T14:35:16.813" Score="3" ViewCount="508" Body="&lt;p&gt;Is there a way to automatically create a 301 redirect on a structure entry if it gets reordered into a new group. For example the original entry lives under &lt;code&gt;/section-1/entry-title&lt;/code&gt; and it gets moved to &lt;code&gt;/section-2/entry-title&lt;/code&gt;. So if the original url is indexed it gets redirected to the new location without the client needing to do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help&lt;/p&gt;&#xA;" OwnerUserId="619" LastEditorUserId="177" LastEditDate="2014-08-04T14:37:31.647" LastActivityDate="2014-08-04T17:32:31.200" Title="Structure dynamic 301 redirects" Tags="&lt;redirect&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1598" PostTypeId="2" ParentId="1593" CreationDate="2014-08-04T14:35:29.387" Score="4" Body="&lt;p&gt;Here are two ways I know of that allow you to mark your content as safe before you hand it off to the template.  I'm not sure they will fit your exact use case, but perhaps they are a place to start:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Twig_Markup&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a variable you can return a new instance of Twig_Markup to the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return new \Twig_Markup($yourReturnData, craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;getCharset());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) is_safe&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a Twig filter, you can return that data to the template marking it as safe by passing &lt;code&gt;'is_safe' =&amp;gt; array('html')&lt;/code&gt; as the third argument to the Twig_Filter_Method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFilters()&#xA;{&#xA;  return array(&#xA;    'yourtwigfilter' =&amp;gt; new Twig_Filter_Method(&#xA;      $this, &#xA;     'customFunction', &#xA;     array(&#xA;       'is_safe' =&amp;gt; array('html')&#xA;     )&#xA;  ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-08-04T14:43:34.147" LastActivityDate="2014-08-04T14:43:34.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1599" PostTypeId="2" ParentId="1596" CreationDate="2014-08-04T14:58:46.140" Score="3" Body="&lt;p&gt;Where the review list page is in the structure? Yes. This works just the way you would expect. Set the review channel url to &lt;code&gt;products/shirts/reviews/{slug}&lt;/code&gt; and it will do just that.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-04T14:58:46.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1601" PostTypeId="2" ParentId="1594" CreationDate="2014-08-04T15:33:15.167" Score="3" Body="&lt;p&gt;It sounds like you're pretty close. I'll work off of the assumption that you want the URLs to be structured like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/lifestyle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/food&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…and an individual image will be at /images/{image slug}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you've done, I'd create a category group called &lt;strong&gt;photoGalleries&lt;/strong&gt;. I'd set the URL format simple to &lt;code&gt;/{slug}&lt;/code&gt; and a max level of 1. The two categories can then be added to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;images&lt;/strong&gt; channel would have a URL format of &lt;code&gt;/images/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By setting up categories and the channel like this, Craft will automatically create variables when it matches those paths. You can then use these variables to do practical things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show images by category, you'll need to use to &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;.relatedTo()&lt;/code&gt;&lt;/a&gt; method. When Craft matches a category route, it will create a &lt;code&gt;category&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;variable&lt;/a&gt; which can be passed into this method. In the template for a category, you'll need code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.entries.section('images').relatedTo(category).find() %}&#xA;{% for image in images %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This asks Craft to find any image which has been categorised by (related to) a specific category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then create a simple images listing via a template for &lt;code&gt;/images&lt;/code&gt;. If you wanted to get really fancy, you could output what categories an image is under. To do that you'd need code like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.entries.images.find() %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for category in craft.categories.relatedTo(image).find() %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that gets you going.&lt;/p&gt;&#xA;" OwnerUserId="148" LastActivityDate="2014-08-04T15:33:15.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1602" PostTypeId="1" AcceptedAnswerId="1603" CreationDate="2014-08-04T16:37:37.317" Score="2" ViewCount="324" Body="&lt;p&gt;I created a RSS feed template and setup a route to it.  If I output more than 40 entries I get a timeout on both FeedBurner and FeedValidator.  Is there a setting in Craft that updates a timeout time or could it be something else going on?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-08-04T17:20:51.087" Title="Does Craft have a timeout setting for template requests?" Tags="&lt;entries&gt;&lt;rss&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1603" PostTypeId="2" ParentId="1602" CreationDate="2014-08-04T17:20:51.087" Score="2" Body="&lt;p&gt;Nothing directly in Craft, but you're probably looking for &lt;a href=&quot;http://php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;nofollow&quot;&gt;PHP's max_execution_time&lt;/a&gt;, which governs how long a PHP script is allowed to execute.  It defaults to 30 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can edit that value from you php.ini file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-04T17:20:51.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1604" PostTypeId="2" ParentId="1597" CreationDate="2014-08-04T17:32:31.200" Score="1" Body="&lt;p&gt;Nothing clever I can think of, but it's an interesting idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either manually setup the redirects in your .htaccess file, or there are a &lt;a href=&quot;http://straightupcraft.com/craft-plugins/redirect-manager&quot; rel=&quot;nofollow&quot;&gt;couple&lt;/a&gt; of &lt;a href=&quot;http://straightupcraft.com/craft-plugins/reroute&quot; rel=&quot;nofollow&quot;&gt;plugins&lt;/a&gt; that appear to let you manually manage redirects from the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A feature request to the plugin developers might be to get them to add support to listening to an (as-of-yet non-existent) &quot;onMoveStructuredEntry&quot; event in Craft that automatically creates the redirect for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-04T17:32:31.200" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1605" PostTypeId="1" CreationDate="2014-08-04T18:04:48.553" Score="2" ViewCount="307" Body="&lt;p&gt;I'm using a gallery where when an image is clicked it opens a larger version in a modal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ varGalleryImages.getUrl('galleryLarge') }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ varGalleryImages.getUrl('galleryThumb') }}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Initially the larger 'galleryLarge' images wouldn't load because the transform hadn't been created. After some digging around on here I found that adding 'generateTransformsBeforePageLoad' =&gt; true, to craft/config/general.php would create the transforms (all of them) before the page loads.  This worked a treat and now my modal works as expected!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem:  The page now takes forever to load.  I stopped this issue by removing the line from general.php but now of course, any new images added by the client won't get transformed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas around this issue would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2014-08-05T03:08:00.833" LastActivityDate="2014-08-05T03:11:12.053" Title="Image transforms and modal gallery" Tags="&lt;image-transforms&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1606" PostTypeId="1" CreationDate="2014-08-04T18:09:11.410" Score="5" ViewCount="137" Body="&lt;p&gt;I'd like to be able to assign permissions to content or sections of content within a structure. For example, if I have a structure modeled around an organization and there are several departments within that organization, maybe marketing and sales, I'd like to be able to create groups that can create/edit content within a specific department. Is it possible, using a plugin or by some other means, to restrict access to a specific area within a larger structure?&lt;/p&gt;&#xA;" OwnerUserId="620" LastActivityDate="2014-08-04T22:41:12.047" Title="Is it Possible to Assign Permissions Within a Content Structure" Tags="&lt;users&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1607" PostTypeId="1" AcceptedAnswerId="1608" CreationDate="2014-08-04T18:39:22.387" Score="9" ViewCount="4788" Body="&lt;p&gt;Is there a method or recommended way of grabbing URL hash parameters with Twig? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if my URL is &lt;a href=&quot;http://mysite.com/my-page#hash&quot; rel=&quot;noreferrer&quot;&gt;http://mysite.com/my-page#hash&lt;/a&gt;, is there a way to grab the hash?&lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="476" LastEditDate="2014-08-04T18:55:51.720" LastActivityDate="2014-08-04T19:00:18.367" Title="Method to grab URL hash in Twig or craft.request?" Tags="&lt;templating&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1608" PostTypeId="2" ParentId="1607" CreationDate="2014-08-04T19:00:18.367" Score="7" Body="&lt;p&gt;This isn't possible because the &lt;code&gt;#hash&lt;/code&gt;-part isn't even send to the server. See this question on StackOverflow: &lt;a href=&quot;https://stackoverflow.com/q/940905/3589841&quot;&gt;Can PHP read the hash portion of the URL?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you use &lt;code&gt;?hash=something&lt;/code&gt; instead, these functions will help you: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getParam&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getParam()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getQuery&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getQuery()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-08-04T19:00:18.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1609" PostTypeId="1" AcceptedAnswerId="1619" CreationDate="2014-08-04T19:29:23.367" Score="3" ViewCount="1130" Body="&lt;p&gt;Images were uploaded to a matrix field and then the changes were not saved, but the assets still show up in the control panel as selectable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The asset seems to be stored here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://example.com/admin/resources/tempassets/field_51/file_name.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to delete or remove these so that we dont't have them laying around taking up the desired file name. If I upload the same image again it appends a &lt;code&gt;_x&lt;/code&gt; to the end of the file name as the number of times it's been uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find the assets anywhere in the assets page in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2014-08-05T03:05:03.977" Title="How do I delete or remove temporary assets?" Tags="&lt;assets&gt;&lt;filecache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1610" PostTypeId="1" AcceptedAnswerId="1616" CreationDate="2014-08-04T21:13:48.633" Score="6" ViewCount="4292" Body="&lt;p&gt;I have a structure section which I am using to create a navigation menu.&#xA;It works ok and produces the list etc.&#xA;I want to add a class to the li element if it has children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current Code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('navigation') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {# Check for entry type / get related entry #}&#xA;            {% if entry.type == 'customLink' %}&#xA;&#xA;                {# Link to a custom url #}&#xA;                &amp;lt;a href=&quot;{{ entry.customUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% else %}&#xA;&#xA;                {# Link to a structure entry #}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;            {# Repeat this for child entries #}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to add &lt;code&gt;class=&quot;has-dropdown&quot;&lt;/code&gt; to the first list element if it has children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li {% ifchildren %}class=&quot;has-dropdown&quot;{% endifchildren %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that does not work. How can this be achieved?&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="45" LastEditDate="2014-08-05T05:19:29.310" LastActivityDate="2014-08-05T05:19:29.310" Title="Structure - Add class if element has children" Tags="&lt;entries&gt;&lt;navigation&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1611" PostTypeId="1" CreationDate="2014-08-04T21:29:31.963" Score="7" ViewCount="3609" Body="&lt;p&gt;I'm stuck on the /admin/install page, getting an error &quot;Can't run Craft :(&quot; saying that Mcrypt is required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried installing with Homebrew, but kept getting an error. So, I installed mcrypt manually using these &lt;a href=&quot;https://stackoverflow.com/questions/14595841/installing-mcrypt-extension-for-php-on-osx-mountain-lion&quot;&gt;instructions on Stack Overflow&lt;/a&gt;. PHP and Mcrypt are installed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ which php&#xA;/usr/local/bin/php&#xA;&#xA;$ which mcrypt&#xA;/usr/local/bin/mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my php.ini file I've added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;extension=mcrypt.so&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I've also tried including the path extension=/usr/local/bin/mcrypt.so)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;;extension&lt;/code&gt; area (around line 880).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even after restarting Apache, I still get the same error that &quot;Mcrypt isn't installed&quot; from Craft. &lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-08T19:29:44.713" Title="Mcrypt is required on OS X Mavericks 10.9.4" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1612" PostTypeId="2" ParentId="1610" CreationDate="2014-08-04T22:15:01.070" Score="4" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li {% if entry.level == 1 and entry.children|length %}class=&quot;has-dropdown&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="623" LastActivityDate="2014-08-04T22:15:01.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1613" PostTypeId="2" ParentId="1606" CreationDate="2014-08-04T22:41:12.047" Score="1" Body="&lt;p&gt;Currently there is no native way to do this, but you could:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;...split the &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;structure&lt;/a&gt; into multiple &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;channels&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;...&lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;write a plugin&lt;/a&gt; which checks: on what page a user is, and denies access if necessary&lt;/li&gt;&#xA;&lt;li&gt;...ask P&amp;amp;T to add this as a feature.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-04T22:41:12.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1614" PostTypeId="2" ParentId="1611" CreationDate="2014-08-04T22:43:31.480" Score="6" Body="&lt;p&gt;Here's all you need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://topicdesk.com/downloads/mcrypt/mcrypt-download&quot; rel=&quot;nofollow&quot;&gt;http://topicdesk.com/downloads/mcrypt/mcrypt-download&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt; to use brew, you have to specify the version of PHP for it to work. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;brew install mysql php54-mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="286" LastEditorUserId="286" LastEditDate="2014-08-05T21:53:34.920" LastActivityDate="2014-08-05T21:53:34.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1616" PostTypeId="2" ParentId="1610" CreationDate="2014-08-05T00:20:54.883" Score="8" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#methods&quot;&gt;Methods&lt;/a&gt; section on the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;EntryModel&lt;/a&gt; documentation page has a lot of useful things for working with navigation for Structure sections. You can use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#hasDescendants&quot;&gt;&lt;code&gt;hasDescendants()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.hasDescendants() %}class=&quot;has-dropdown&quot;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-08-05T00:20:54.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1617" PostTypeId="1" CreationDate="2014-08-05T00:42:34.443" Score="1" ViewCount="889" Body="&lt;p&gt;We have received the Craft CMS and design files from our web developer with content already loaded into the Craft backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the frontend displays correctly but we are able to edit all the textual content in the 'Globals' sections and save it but when we edit any text/fields in the 'Entries' section and save the changes, the page reloads with the old content which hasn't been updated with the changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know a fix for this?&lt;/p&gt;&#xA;" OwnerUserId="624" LastActivityDate="2014-08-05T01:50:34.483" Title="Craft entries not saving" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1618" PostTypeId="2" ParentId="1617" CreationDate="2014-08-05T01:50:34.483" Score="1" Body="&lt;p&gt;Based on our comment thread, I would suggest to perform a &lt;strong&gt;manual update&lt;/strong&gt; of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download and unzip the latest copy of Craft, and &lt;strong&gt;replace&lt;/strong&gt; the old &lt;code&gt;app&lt;/code&gt; folder with the &lt;code&gt;app&lt;/code&gt; folder that you just unzipped. No other files or folders need to be replaced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure to change the permissions of your new &lt;code&gt;app&lt;/code&gt; folder, so you can perform auto-updates in the future.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-05T01:50:34.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1619" PostTypeId="2" ParentId="1609" CreationDate="2014-08-05T03:05:03.977" Score="2" Body="&lt;p&gt;&lt;strong&gt;From my comment above:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to find the files uploaded to the root of my assets path and deleted them there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the control panel settings page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated Asset Indexes and Cleared Cache and it seems to be all working.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2014-08-05T03:05:03.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1620" PostTypeId="2" ParentId="1605" CreationDate="2014-08-05T03:11:12.053" Score="1" Body="&lt;p&gt;When &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true&lt;/code&gt; is set, is it taking a long time to load because of the sheer number of images you have or is it only on the first request when all of the transforms are being generated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After they are generated, they are quickly served directly by Apache (or whatever your webserver is) and Craft doesn't get involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's because of the sheer number of images you have, then you'll probably want to look at a front-end method of lazy loading the images as they are needed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-05T03:11:12.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1621" PostTypeId="1" AcceptedAnswerId="1647" CreationDate="2014-08-05T05:50:52.877" Score="2" ViewCount="918" Body="&lt;p&gt;I'm having some trouble trying to write a plugin. I'm trying to create a simple fieldtype that I'm going to use inside a matrix block.&#xA;So far the public function &lt;code&gt;getInputHtml&lt;/code&gt; of my fieldtype class, contains only:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump($this-&amp;gt;element)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it shows me, as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(Craft\MatrixBlockModel)#1121 (25){[&quot;elementType&quot;:protected]=&amp;amp;gt; string(11) &quot;MatrixBlock&quot; [.......]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that, as I try to change the previous&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump($this-&amp;gt;element)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump($this-&amp;gt;element-&amp;gt;getOwner())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or any other method/property of the MatrixBlockModel class), I obtain:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Call to a member function getOwner() on a non-object&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any suggestion? Could it have something to do with the magic methods (maybe __call) inherited by CComponent class?&lt;/p&gt;&#xA;" OwnerUserId="627" LastEditorUserId="45" LastEditDate="2014-08-05T06:08:15.397" LastActivityDate="2014-08-06T11:02:29.700" Title="MatrixBlockModel error - &quot;Call to a member function on a non-object&quot;" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1622" PostTypeId="2" ParentId="1566" CreationDate="2014-08-05T09:42:56.700" Score="2" Body="&lt;p&gt;Here is the way I solved this issue in order someone comes around looking for a solution. I created a plugin basically. The plugin had only a single controller. So the main plugin.php file contains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPluginPlugin extends BasePlugin&#xA;{&#xA;     function getName()&#xA;     {&#xA;         return Craft::t('My Plugin');&#xA;     }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;        return 'Digital Butter';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;        return 'http://butter.com.hk';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the controllers folder had only one file MyPlugin_MyController.php as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_MyController extends BaseController&#xA;{&#xA;public function actionGetEntry()&#xA;{&#xA;&#xA;    $parent = craft()-&amp;gt;entries-&amp;gt;getEntryById($_GET['id']);&#xA;    $type = craft()-&amp;gt;elements-&amp;gt;getElementTypeById($parent-&amp;gt;id);&#xA;    $elemModel = craft()-&amp;gt;elements-&amp;gt;getCriteria($type);&#xA;&#xA;    $attributes = array(&#xA;        &quot;descendantOf&quot; =&amp;gt; $parent-&amp;gt;id,&#xA;        &quot;level&quot; =&amp;gt; &quot;2&quot;&#xA;        );&#xA;    $child = $elemModel-&amp;gt;find($attributes);&#xA;&#xA;    $children = array();&#xA;&#xA;    foreach ($child as $value) {&#xA;        array_push($children, $value-&amp;gt;slug);&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJson($children);&#xA;}&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally we have the page in which I wanted to get the entries dynamically, the javascript is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// function to dynamically generate he entries that represent sub-categories of articles like cancer&#xA;var num = 3;&#xA;$('.ma-more-category-btn').click(function(){&#xA;num = num+3;&#xA;var x = {{ entry.id }};&#xA;$.ajax({&#xA;url: &quot;{{ siteUrl }}/actions/myPlugin/my/getEntry&quot;,&#xA;data: { &quot;id&quot;: x },&#xA;success: function(data){&#xA;&#xA;    $('.ma-category-btns').html('');&#xA;&#xA;if(num &amp;gt; data.length + 3)&#xA;    num = num-3;&#xA;jQuery.each(data, function(index, value){&#xA;    if(index &amp;lt; num)&#xA;    {&#xA;            if(index == 0)&#xA;        {&#xA;            $('.ma-category-btns').append(&#xA;            &quot;&amp;lt;button type=\&quot;button\&quot; class=\&quot;btn btn-default ma-category-btn first\&quot;&amp;gt;&quot; + value + &quot;&amp;lt;span class=\&quot;glyphicon glyphicon-info-sign\&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&quot;&#xA;            );&#xA;&#xA;        }&#xA;        else if(index == data.length - 1 || index == num-1)&#xA;        {&#xA;            $('.ma-category-btns').append(&#xA;            &quot;&amp;lt;button type=\&quot;button\&quot; class=\&quot;btn btn-default ma-category-btn last\&quot;&amp;gt;&quot; + value + &quot;&amp;lt;span class=\&quot;glyphicon glyphicon-info-sign\&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&quot;&#xA;            );&#xA;        }&#xA;        else {&#xA;            $('.ma-category-btns').append(&#xA;            &quot;&amp;lt;button type=\&quot;button\&quot; class=\&quot;btn btn-default ma-category-      btn\&quot;&amp;gt;&quot; + value + &quot;&amp;lt;span class=\&quot;glyphicon glyphicon-info-sign\&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&quot;&#xA;            );&#xA;        }&#xA;      }&#xA;&#xA;    });&#xA;    }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also the html layout for this purpose was as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             &amp;lt;div class=&quot;ma-category-btns&quot;&amp;gt;&#xA;                {% for entry in entry.getChildren() %}&#xA;                    {% if loop.index &amp;lt;= 3 %}&#xA;                        &amp;lt;button type=&quot;button&quot; class=&quot;btn btn-default ma-category-btn {% if loop.first %}first{% elseif loop.index == 3 %}last{% endif %}&quot;&amp;gt;{{ entry.title }}&amp;lt;span class=&quot;glyphicon glyphicon-info-sign&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps anyone that comes travelling to this page.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2014-08-05T09:42:56.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1623" PostTypeId="1" CreationDate="2014-08-05T09:49:21.170" Score="2" ViewCount="383" Body="&lt;p&gt;I'm trying to create a site with a gallery, and am investigating the possibility of getting Craft to treat an asset as an entry so I can display a detail page for an image without having to create an entry for it specifically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it might do what I need, but I've fallen at the first hurdle whereby according to the documentation (unless I've missed it) assets don't have a slug. I could use ID, but the client will want keywords in the URL blah blah.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pull an asset and output {{ asset.slug }}, it does return what I'd want it to. The problem is, if I edit the title, that value isn't updated and there doesn't appear to be a way to get to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to get to this somehow?&lt;/p&gt;&#xA;" OwnerUserId="292" LastActivityDate="2014-08-05T15:10:50.887" Title="Is there a 'slug' for assets?" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1624" PostTypeId="1" AcceptedAnswerId="4434" CreationDate="2014-08-05T10:36:05.763" Score="4" ViewCount="293" Body="&lt;p&gt;Is it possible to output the block type name in Craft for each matrix block in your field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently Craft just lists the name of each field within the block, but we are using generic field names (Width, depth etc), so in those instances there is no clear context for which block type is being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the attached screenshot to see what I mean. I have just shown the 'Footprint' block type, but with the list of generic fields there is no way of clearly seeing this is actually 'Footprint', which can make things difficult for our client when they are managing content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second screenshot shows what I am trying to achieve, so it simply adds &quot;Type: Footprint&quot; to the start of the field list. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MTw47.png&quot; alt=&quot;Before&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xhEIj.png&quot; alt=&quot;After&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-12-03T09:25:37.873" Title="How to output the matrix block type name in Craft? Possible feature request" Tags="&lt;matrix&gt;&lt;block-types&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1625" PostTypeId="1" AcceptedAnswerId="6736" CreationDate="2014-08-05T11:33:08.973" Score="3" ViewCount="395" Body="&lt;p&gt;We have a very strange issue here. On my computer I'm trying to save an entry. The process indicator keeps spinning for about five minutes before this exception comes up:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;CDbException&lt;/p&gt;&#xA;&lt;p&gt;CDbCommand faalde tijdens het uitvoeren van volgend SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. The SQL statement executed was: SELECT `locale`&#xA;FROM `craft_locales`&#xA;ORDER BY `sortOrder`&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's triggered by this function:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;userSession-&amp;gt;checkPermission('accessCpWhenSystemIsOff')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On first look this definitely looks like a server issue. But... when I test this on a windows computer, it never happens. It's just not saving from an osx computer (browsers tested on osx: chrome, safari, firefox). Also tested on different osx computers and different windows computers. All with the same result. Windows works, osx doesn't.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone have a clue what might be going on here? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="466" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-01-21T20:57:11.793" Title="Entries not saving CDbException" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1626" PostTypeId="1" AcceptedAnswerId="1627" CreationDate="2014-08-05T11:36:40.230" Score="12" ViewCount="4736" Body="&lt;p&gt;I have a Global Set called &quot;Settings&quot; (handle = 'settings'); Within that I have a text field called &quot;Address&quot; (handle = 'address'). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a function in my Plugin and I'd like to get the Address data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the front-end I would write this: &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ settings.address }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I get the same information in my plugin with PHP? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got as far as this: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$address = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::GlobalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I var_dump this array, I can see the address string. But I can't figure out how to filter down to the address correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="177" LastEditDate="2014-08-05T12:43:10.840" LastActivityDate="2016-09-06T17:42:42.137" Title="How to get data from a Global Set in a plugin?" Tags="&lt;plugin-development&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1627" PostTypeId="2" ParentId="1626" CreationDate="2014-08-05T12:30:00.080" Score="24" Body="&lt;p&gt;You can use the GlobalsService service available with &lt;code&gt;craft()-&amp;gt;globals&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Get the settings global set&#xA;$settings = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('settings');&#xA;&#xA;// Access the address field&#xA;var_dump($settings-&amp;gt;address)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could use ElementCriteria as you suggested:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Get the GlobalSet element critera&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::GlobalSet);&#xA;// Set the handle you want&#xA;$criteria-&amp;gt;handle = 'settings';&#xA;// Find the settings set&#xA;$settings = $criteria-&amp;gt;first();&#xA;&#xA;// Access the address field&#xA;var_dump($settings-&amp;gt;address)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can access all fields on the &lt;code&gt;$settings&lt;/code&gt; variable using this synthax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mario&lt;/p&gt;&#xA;" OwnerUserId="304" LastEditorUserId="304" LastEditDate="2014-08-05T12:37:55.117" LastActivityDate="2014-08-05T12:37:55.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1630" PostTypeId="2" ParentId="1623" CreationDate="2014-08-05T15:10:50.887" Score="4" Body="&lt;p&gt;Could you add your own field to use as a slug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you edit an Asset Source in Settings you get the &lt;code&gt;Field Layout&lt;/code&gt; tab same as you do for Entries. You could maybe add something there and then combine this with a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow&quot;&gt;Route&lt;/a&gt; somehow?&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2014-08-05T15:10:50.887" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1631" PostTypeId="1" AcceptedAnswerId="1666" CreationDate="2014-08-05T16:36:48.233" Score="3" ViewCount="230" Body="&lt;p&gt;I have done a commenting system based on entries. It works fine but I would like to allow to registered users to do basic formatting on their comments. What type of checking is done on the Rich Text Field? Is it protected by SQL Injection or XSS?&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastActivityDate="2014-08-06T17:35:11.180" Title="Can I use Rich Text field on frontend safely?" Tags="&lt;richtext&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1632" PostTypeId="1" AcceptedAnswerId="1634" CreationDate="2014-08-05T16:56:50.137" Score="12" ViewCount="11998" Body="&lt;p&gt;I have a field in a matrix block that is used for video embed codes. I want to output the contents of that field directly as HTML. However, it always seems to get entity-encoded (ie. the &lt;code&gt;&amp;lt;&lt;/code&gt; and &lt;code&gt;&amp;gt;&lt;/code&gt; get converted to &lt;code&gt;&amp;amp;lt;&lt;/code&gt; and &lt;code&gt;&amp;amp;gt;&lt;/code&gt;), so the html just appears as text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;noreferrer&quot;&gt;|raw filter&lt;/a&gt;, so I tried outputting the field's content through it (eg. using &lt;code&gt;{{ element.blockContent|raw }}&lt;/code&gt;), but it seems to make no difference. Can anyone tell me what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Just in case it's relevant, this is a sub-template that is being included in a &lt;code&gt;for&lt;/code&gt; loop that goes through the matrix blocks and outputs them)&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="125" LastEditDate="2014-10-09T16:52:43.743" LastActivityDate="2014-10-09T16:52:43.743" Title="How to output a field as raw HTML?" Tags="&lt;templating&gt;&lt;filter&gt;&lt;escaping&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1633" PostTypeId="2" ParentId="1632" CreationDate="2014-08-05T17:31:59.080" Score="11" Body="&lt;p&gt;The difference between &quot;raw&quot; and &quot;escape&quot; is sometimes confusing... Try this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ element.blockContent|e }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;&lt;strong&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/escape.html&quot;&gt;escape:&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The escape filter escapes a string for safe insertion into the final output.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;&lt;strong&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot;&gt;raw:&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The raw filter marks the value as being &quot;safe&quot;, which means that in an environment with automatic escaping enabled this variable will not be escaped if raw is the last filter applied to it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-05T17:31:59.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1634" PostTypeId="2" ParentId="1632" CreationDate="2014-08-05T17:46:05.077" Score="7" Body="&lt;p&gt;For what it's worth, the problem was due to a mistake on my part: the field in question had been set up as Rich Text, and then switched to Plain Text. I guess the original HTML had been encoded going into the database when the field was still Rich Text, and so was already entity-encoded before it even reached the template. When I pasted the HTML in question back in and saved the post again all was well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for me, the solution was: make sure that the HTML was definitely saved as raw HTML in a Plain Text field.&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="328" LastEditDate="2014-08-05T19:10:38.513" LastActivityDate="2014-08-05T19:10:38.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1635" PostTypeId="1" CreationDate="2014-08-05T18:44:47.950" Score="2" ViewCount="174" Body="&lt;p&gt;I have a category group set up called 'gists'. I have entries that contain a category field which pulls in the category group 'gists'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I need to access entries that are tied to individual categories but I need to do so by the category slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot figure out how to make this happen. I have tried numerous things but cannot get my head around this. Here is my latest.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('gist').relatedTo('tech').limit(10).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="45" LastEditDate="2014-08-05T22:50:13.830" LastActivityDate="2014-08-05T22:50:13.830" Title="Wrapping my head around Categories" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1636" PostTypeId="2" ParentId="1471" CreationDate="2014-08-05T18:45:09.673" Score="6" Body="&lt;p&gt;I handled it by adding a global function and singleton object similar to Craft's WebApp. All of my plugin's services are access from my custom global function myPlugin() while Craft's services continue to be started from the craft() global function. In the doc block for the new object, I specify properties for each service. Each new service must be added by hand, but all members of that service are recognized by the IDE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work across all IDEs (including PHPStorm where this was developed). &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;/**&#xA; * Class MyPlugin&#xA; * @package Craft&#xA; */&#xA;&#xA;/**&#xA; * @property MyPlugin_CategoriesService $categories MyPlugin Categories Service&#xA; * @property MyPlugin_TriviaService     $trivia     MyPlugin Trivia Service&#xA; */&#xA;class MyPlugin {&#xA;&#xA;    public function __get($memberName)&#xA;    {&#xA;        $craftName = 'myPlugin_' . strtolower($memberName);&#xA;        return craft()-&amp;gt;$craftName;&#xA;    }&#xA;&#xA;    /**&#xA;     * Return singleton instance of the rantAPI service manager&#xA;     * @return MyPlugin&#xA;     */&#xA;    public static function app()&#xA;    {&#xA;        static $inst = null;&#xA;        if ( $inst === null) {&#xA;            $inst = new MyPlugin();&#xA;        }&#xA;        return $inst;&#xA;    }&#xA;}&#xA;&#xA;&#xA;/**&#xA; * Returns the myPlugin equivalent to webApp class that serves up all the services.&#xA; *&#xA; * @return MyPlugin&#xA; */&#xA;function myPlugin()&#xA;{&#xA;    return MyPlugin::app();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my controller, I reference my services and craft's services in the following way.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$parentEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById(999);&#xA;$triviaToAdd = myPlugin()-&amp;gt;trivia-&amp;gt;getByKeyword('nerds');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the example above, both entries and trivia are recognized as valid objects and their methods are available for intelligent code completion. &lt;/p&gt;&#xA;" OwnerUserId="502" LastEditorUserId="502" LastEditDate="2014-08-05T20:00:03.887" LastActivityDate="2014-08-05T20:00:03.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1637" PostTypeId="2" ParentId="1635" CreationDate="2014-08-05T18:59:49.730" Score="3" Body="&lt;p&gt;Craft site has the excellent document &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;How do I list the entries related to a category?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building on that, you would fetch your category (by slug), and then the entries related to the category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch the category with slug 'categorySlug' #}&#xA;{% set category = craft.categories.slug('categorySlug').first() %}&#xA;&#xA;{# Fetch all of the entries related to this category #}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop over those entries.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-05T18:59:49.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1638" PostTypeId="1" CreationDate="2014-08-05T19:10:49.910" Score="5" ViewCount="213" Body="&lt;p&gt;Has anyone successfully imported tags from EE (solspace tags) along with entries? I installed &lt;a href=&quot;http://straightupcraft.com/craft-plugins/ee-craft-import&quot; rel=&quot;nofollow&quot;&gt;this plugin&lt;/a&gt; but it seems to be really old and Craft must have changed a lot since then since it reflects even a different Schema and many deprecated methods. I refactored to work with simple entry fields but importing tags along with that seems a little trickier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I am good if I can just figure out how to save relations for entries. VERY new to craft as in 2 days but this all seems familiar since I'm a Laravel guy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://d1zjcuqflbd5k.cloudfront.net/files/acc_263254/pCaR?response-content-disposition=inline;%20filename=Screen%20Shot%202014-08-05%20at%203.05.44%20PM.png&amp;amp;Expires=1415576102&amp;amp;Signature=IwfOcCzRhCuLnntMyLCqwOMuDJzel0qkahsMNIsca3krLgxdrq0yqbHIBNiaYB39g7f~402iUL1DmAWjgcnKRRjwf6PnHayxZMKOHEweApEC-8BG1jrl33ZqfDo9Ef4Zf3HG7GesOvFbycmEOUyXbFI6Kt3CCLMtJ8TTWyR2Msc_&amp;amp;Key-Pair-Id=APKAJTEIOJM3LSMN33SA&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can figure this stuff out by following the trails but if someone else has tackled this or can give me quick feedback on using the services and models that would so super fantastical. &lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="115" LastEditDate="2015-02-20T03:16:45.873" LastActivityDate="2015-03-27T13:30:52.947" Title="How do you import tags from EE (solspace tags) along with entries?" Tags="&lt;plugins&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1639" PostTypeId="1" AcceptedAnswerId="1646" CreationDate="2014-08-05T19:44:11.440" Score="6" ViewCount="1237" Body="&lt;p&gt;I have an event site with dates in the future and past.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to display future entries as a listing: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').status('pending') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do you display an entry with status &quot;pending&quot; on the &quot;_entry&quot; template?&lt;br&gt;&#xA;In my case nothing displays?&lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="45" LastEditDate="2014-08-06T20:22:17.927" LastActivityDate="2017-12-04T03:33:02.860" Title="How can I display a &quot;pending&quot; entry in my &quot;_entry&quot; template?" Tags="&lt;date&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1640" PostTypeId="1" AcceptedAnswerId="1641" CreationDate="2014-08-05T19:51:24.523" Score="3" ViewCount="141" Body="&lt;p&gt;My customer has 3500 categories in a 3 level hierarchy. This is causing some significant pain when adding categories to an entry. The server delivers the categories via ajax in 9sec, but the browser then takes 3-5 minutes to push the html segment into the modal dialog. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to handle this a little more efficiently? I need to be able to select from any of the 3500 categories, but would love to limit the initial display to only the top one or two levels of the hierarchy. &lt;/p&gt;&#xA;" OwnerUserId="502" LastActivityDate="2014-08-05T20:11:34.833" Title="High volume category list causes slow load" Tags="&lt;categories&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1641" PostTypeId="2" ParentId="1640" CreationDate="2014-08-05T20:11:34.833" Score="2" Body="&lt;p&gt;This is a known issue with category and structured section UI in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performance actually starts degrading around the 3-400 item mark, but it will be addressed in the upcoming 2.2 release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-05T20:11:34.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1642" PostTypeId="1" AcceptedAnswerId="1650" CreationDate="2014-08-05T23:15:42.030" Score="11" ViewCount="1556" Body="&lt;p&gt;I'm developing a plugin which requires certain sections and fields to exist so I'm currently creating them in the &lt;code&gt;onAfterInstall()&lt;/code&gt; method of the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create individual fields, sections, entry types and even a Matrix field + block type fine. I'm having trouble with creating the Matrix sub-field and attaching that field to the Matrix block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created the matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field = new FieldModel();&#xA;$field-&amp;gt;groupId      = $group-&amp;gt;id;&#xA;$field-&amp;gt;name         = Craft::t('Field Name');&#xA;$field-&amp;gt;handle       = 'handleName';&#xA;$field-&amp;gt;translatable = false;&#xA;$field-&amp;gt;type         = 'Matrix';&#xA;craft()-&amp;gt;fields-&amp;gt;saveField($fieldContentRSS);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the block type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$blockType = new MatrixBlockTypeModel();&#xA;$blockType-&amp;gt;fieldId = $field-&amp;gt;id;&#xA;$blockType-&amp;gt;name = Craft::t('Block Name');&#xA;$blockType-&amp;gt;handle = 'handleName';&#xA;craft()-&amp;gt;matrix-&amp;gt;saveBlockType($blockType);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that I will need to create a field/set of fields for this block type. Is this exactly the same as the new field above? How do I then attach these fields to the block type?&lt;/p&gt;&#xA;" OwnerUserId="448" LastEditorUserId="9" LastEditDate="2014-08-06T11:50:39.057" LastActivityDate="2018-07-19T16:35:18.147" Title="Programatically create a Matrix field" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1643" PostTypeId="1" CreationDate="2014-08-06T00:13:25.553" Score="6" ViewCount="1065" Body="&lt;p&gt;any help would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have Live Preview working on my entries ie. I can see and use the button, but the live preview won't update as I manipulate the content? It was working before so it is baffling me as to how it could stop working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only change I think I have made in that time is removing the open_basedir settings in my php.ini, but I wouldn;t imagine that would affect it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE::&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the htaccess code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="630" LastEditorUserId="630" LastEditDate="2014-08-06T00:26:32.527" LastActivityDate="2017-03-17T02:26:13.333" Title="Live preview not automatically updating" Tags="&lt;live-preview&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1644" PostTypeId="2" ParentId="1643" CreationDate="2014-08-06T01:42:22.800" Score="8" Body="&lt;p&gt;There is a known issue where if you use a variable name 'entry' in any template involved in a Live Preview request (including layout templates), then it can cause the behavior you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries. ... .find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries. ... .find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The workaround is to rename that variable to something else.  &lt;code&gt;myEntry&lt;/code&gt;, for example.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-06T01:42:22.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1645" PostTypeId="1" CreationDate="2014-08-06T04:11:49.997" Score="2" ViewCount="48" Body="&lt;p&gt;I'm interested in creating a plug-in that creates a new type of transform. Is there a hook/event related to image transforms? &lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="50" LastEditDate="2014-08-06T04:19:08.927" LastActivityDate="2014-08-06T04:19:08.927" Title="Hook for Image Transforms" Tags="&lt;plugin-development&gt;&lt;image-transforms&gt;&lt;events&gt;&lt;hook&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2014-08-06T18:33:29.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="1646" PostTypeId="2" ParentId="1639" CreationDate="2014-08-06T04:28:02.177" Score="12" Body="&lt;p&gt;I'm assuming that when you defined your section, you checked the box which says this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Entries in this section have their own URLs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;... and then filled out the relevant &lt;strong&gt;Entry URL Format&lt;/strong&gt; and &lt;strong&gt;Entry Template&lt;/strong&gt; values. The great thing about this technique is that it automatically populates the &lt;code&gt;entry&lt;/code&gt; variable in your target template. Typically, this is the best way to go!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are occasions where this isn't the suitable solution. There are certain circumstances in Craft which, by default, can prevent non-active entries from being included. I suspect this is one of those situations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is what I would suggest instead...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Uncheck the box which says &quot;Entries in this section have their own URLs&quot;, and save.&lt;/li&gt;&#xA;&lt;li&gt;Setup a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot;&gt;dynamic route&lt;/a&gt;. This is basically what the aforementioned checkbox was doing for you.&lt;/li&gt;&#xA;&lt;li&gt;Declare your route using the same pattern that you had previously setup in your section definition.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Within your template, manually set the &lt;code&gt;entry&lt;/code&gt; value, based on the parameters passed through in the URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.getSegment(2) %}&#xA;{% set entry = craft.entries.slug(slug).status(null).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's where this manual method differs from the automatic method... Specifying &lt;code&gt;null&lt;/code&gt; as the status will return that entry &lt;em&gt;regardless&lt;/em&gt; of what its status is. Otherwise, only an active entry could be returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you are now &lt;strong&gt;manually&lt;/strong&gt; setting the &lt;code&gt;entry&lt;/code&gt; value, you have enough control to specify that you &lt;strong&gt;really do want this entry&lt;/strong&gt;, despite the fact that it's not currently active.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-06T04:28:02.177" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1647" PostTypeId="2" ParentId="1621" CreationDate="2014-08-06T11:02:29.700" Score="2" Body="&lt;p&gt;Matrix initializes its blocks’ field types multiple times – once for each existing block in the field, and one last time to get the initial input HTML that should be used when new blocks are added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For existing blocks, &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; will be set on the field types, referring back to the existing MatrixBlockModel objects representing each of those blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That won’t be the case the time that your field type is just telling Matrix what the initial input HTML should be, however, since no corresponding Matrix block exists yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you call this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;var_dump($this-&amp;gt;element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it’s not giving you any errors because &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; will just be &lt;code&gt;null&lt;/code&gt; when there is no element set, and there’s nothing wrong with dumping a &lt;code&gt;null&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when you call this;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;var_dump($this-&amp;gt;element-&amp;gt;getOwner())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now you’re trying to access a method on &lt;code&gt;$this-&amp;gt;element&lt;/code&gt;, which won’t necessarily be set, and that’s when you’re getting that exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you need to do is ensure that &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; is actually set before trying to access &lt;code&gt;getOwner()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if (isset($this-&amp;gt;element))&#xA;{&#xA;    $owner = $this-&amp;gt;element-&amp;gt;getOwner();&#xA;&#xA;    if ($owner)&#xA;    {&#xA;        // ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I’m also not assuming that &lt;code&gt;getOwner()&lt;/code&gt; will actually return anything, because that’s not a certainty either. For example if you create/save a new entry but there are validation errors, when the Edit Entry page reloads, you will have MatrixBlockModel objects for each of the blocks you had created, which &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; will point to, but they won’t actually have IDs nor an owner yet.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-06T11:02:29.700" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1648" PostTypeId="1" AcceptedAnswerId="1649" CreationDate="2014-08-06T11:10:40.877" Score="9" ViewCount="712" Body="&lt;p&gt;In a current project we will list entries in a masonry-style grid view where the entry’s respective cover image should be styled differently based on their image format. Landscape vs. portrait and -- of course -- square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven’t found anything on here or in the docs pointing to a possible way of doing this.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-08-06T12:33:13.573" Title="Is there a way to find out if images (assets) are landscape or portrait?" Tags="&lt;assets&gt;&lt;format&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1649" PostTypeId="2" ParentId="1648" CreationDate="2014-08-06T12:33:13.573" Score="10" Body="&lt;p&gt;How about just using the &lt;code&gt;getHeight()&lt;/code&gt; and &lt;code&gt;getWidth()&lt;/code&gt; methods available on the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot;&gt;AssetFileModel&lt;/a&gt;? Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myImage = entry.imagesField.first %}&#xA;&#xA;{% if myImage.getWidth() &amp;lt; myImage.getHeight() %}&#xA;  {# portrait #}&#xA;{% elseif myImage.getWidth() &amp;gt; myImage.getHeight() %}&#xA;  {# landscape #}&#xA;{% else %}&#xA;  {# square #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-08-06T12:33:13.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1650" PostTypeId="2" ParentId="1642" CreationDate="2014-08-06T12:40:10.303" Score="10" Body="&lt;p&gt;Creating the field/block types manually is only part of the equation - you would also need to create the new content table for your Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is assign all of your block types and their sub-fields’ settings to &lt;code&gt;$field-&amp;gt;settings&lt;/code&gt; before calling &lt;code&gt;saveField()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$field = new FieldModel();&#xA;$field-&amp;gt;groupId      = 1;&#xA;$field-&amp;gt;name         = Craft::t('Field Name');&#xA;$field-&amp;gt;handle       = 'handleName';&#xA;$field-&amp;gt;translatable = false;&#xA;$field-&amp;gt;type         = 'Matrix';&#xA;&#xA;$field-&amp;gt;settings = array(&#xA;    'blockTypes' =&amp;gt; array(&#xA;        'new1' =&amp;gt; array(&#xA;            'name' =&amp;gt; 'My Block Type 1',&#xA;            'handle' =&amp;gt; 'myBlockType1',&#xA;            'fields' =&amp;gt; array(&#xA;                'new1' =&amp;gt; array(&#xA;                    'name' =&amp;gt; 'My Sub-Field 1',&#xA;                    'handle' =&amp;gt; 'mySubField1',&#xA;                    'required' =&amp;gt; true,&#xA;                    'translatable' =&amp;gt; false,&#xA;                    'type' =&amp;gt; 'PlainText',&#xA;                    'typesettings' =&amp;gt; array(&#xA;                        'multiline' =&amp;gt; false,&#xA;                    )&#xA;                ),&#xA;                'new2' =&amp;gt; array(&#xA;                    'name' =&amp;gt; 'My Sub-Field 2',&#xA;                    'handle' =&amp;gt; 'mySubField2',&#xA;                    'required' =&amp;gt; false,&#xA;                    'translatable' =&amp;gt; false,&#xA;                    'type' =&amp;gt; 'PlainText',&#xA;                    'typesettings' =&amp;gt; array(&#xA;                        'multiline' =&amp;gt; true,&#xA;                    )&#xA;                ),&#xA;            )&#xA;        )&#xA;    )&#xA;);&#xA;&#xA;craft()-&amp;gt;fields-&amp;gt;saveField($field);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-03T14:29:09.437" LastActivityDate="2014-09-03T14:29:09.437" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1651" PostTypeId="1" CreationDate="2014-08-06T13:30:27.440" Score="14" ViewCount="4033" Body="&lt;p&gt;How do I duplicate content within craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created one article, and dont want to copy paste content from one to the other, or use one article as template for the others.&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2015-08-12T18:02:21.727" Title="How to duplicate entries" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1653" PostTypeId="1" CreationDate="2014-08-06T13:52:24.280" Score="7" ViewCount="1159" Body="&lt;p&gt;Just started working with Craft, and it's been great! One question I have is regarding the 'correct' way to create a group of fields, rather than using Matrix or Table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To better illustrate, see the below screenshot of a Matrix, which is setup as a Global for people to add their contact information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ufL0z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, it's not really being used for the purpose of repeating content, but at least it groups fields together nicely. It does have the greyed-out button when setting Max Blocks to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other alternative would be to create each Field separately for the 3 fields above, and add those to the Field Layout. This is kind of a fair amount of work, and leaves you with a massive cluster of Fields (I'm aware you can Group them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway - hope I've explained myself! Just wanted to bounce ideas around, and at least make sure I'm on the right track!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-03-05T10:57:40.130" Title="Matrix field alternative (or easier field grouping)" Tags="&lt;matrix&gt;&lt;field&gt;" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1654" PostTypeId="1" CreationDate="2014-08-06T13:58:19.553" Score="17" ViewCount="3503" Body="&lt;p&gt;Is there an easy way for Importing/Exporting Fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just working on a selection of Global fields that I'd like to be able to add for each client site. These would be things like Contact Details, Social Links, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: I created &lt;a href=&quot;https://github.com/engram-design/FieldManager&quot;&gt;FieldManager&lt;/a&gt; for this!&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2016-06-30T01:23:30.450" LastActivityDate="2016-06-30T01:23:30.450" Title="Exporting/Importing Fields" Tags="&lt;field&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1655" PostTypeId="1" AcceptedAnswerId="1658" CreationDate="2014-08-06T13:59:56.800" Score="6" ViewCount="2708" Body="&lt;p&gt;How do you create breadcrumbs based on a structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My structure:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child (active)&lt;/li&gt;&#xA;&lt;li&gt;Other Child&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Child&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My url:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;site.com/parent/child&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my breadcrumb need to be:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;home (url) / parent (url) / child&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2019-07-25T11:50:00.083" Title="What is the best way to create breadcrumbs based on a structure?" Tags="&lt;navigation&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1656" PostTypeId="1" AcceptedAnswerId="1657" CreationDate="2014-08-06T14:38:50.510" Score="8" ViewCount="699" Body="&lt;p&gt;If I were to have entries of types: Book, Film, Note, Post and Bookmark. How would I automatically create a list of links (or a filter) to each entry type?&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-08-06T15:26:17.240" Title="How Do You Create A Navigation Of Entry Types?" Tags="&lt;templating&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1657" PostTypeId="2" ParentId="1656" CreationDate="2014-08-06T14:56:39.473" Score="7" Body="&#xA;&#xA;&lt;p&gt;First, get your section. The following code will return you a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel&quot;&gt;SectionModel&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set section = craft.sections.getSectionByHandle('mySectionHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, get the Entry Types off it. This will return you an array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrytypemodel&quot;&gt;EntryTypeModel&lt;/a&gt; objects:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entryTypes = section.getEntryTypes() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you can loop through them to create your nav:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entryType in entryTypes %}&#xA;    &amp;lt;a href=&quot;{{ url('types/'~entryType.handle) }}&quot;&amp;gt;{{ entryType.name }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You’ll want to create a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot;&gt;Route&lt;/a&gt; which accepts those dynamic URLs (e.g. &lt;code&gt;types/(slug)&lt;/code&gt;), and point it to a template like “types/_type.html”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that _type template, you can fetch entries of the requested type like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set type = craft.request.getSegment(2) %}&#xA;{% set entries = craft.entries.type(type) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastEditorUserId="9" LastEditDate="2014-08-06T15:26:17.240" LastActivityDate="2014-08-06T15:26:17.240" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1658" PostTypeId="2" ParentId="1655" CreationDate="2014-08-06T15:11:36.480" Score="13" Body="&lt;p&gt;Got it!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segments %}&#xA;&amp;lt;nav class=&quot;breadcrubs&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% for crumb in entry.getAncestors() %}&#xA;                    &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ol&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="960" LastEditDate="2019-07-25T11:50:00.083" LastActivityDate="2019-07-25T11:50:00.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1659" PostTypeId="2" ParentId="877" CreationDate="2014-08-06T15:34:13.467" Score="5" Body="&lt;p&gt;I've used the code provided by carlcs and it works great (many thanks for the sample code).&#xA;I did have to make an adjustment for cases where an entry wasn't translated in every locale.&#xA;Would have put this in a comment but don't have enough reputation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing fancy, just added another if. Here's what i ended up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = ['nl_be', 'fr_be', 'en'] %}&#xA;{% for locale in locales %}&#xA;&#xA;    {# Check if locale equals the requested page locale #}&#xA;    {% if locale == craft.locale %}&#xA;        {% set current = true %}&#xA;    {% else %}&#xA;        {% set current = false %}&#xA;    {% endif %}&#xA;&#xA;&#xA;    {# Is this an entry page? #}&#xA;    {% if entry is defined %}&#xA;&#xA;&#xA;&#xA;        {# Find the current entry in the other locale#}&#xA;        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;&#xA;        {# Make sure that the localised entry exists#}&#xA;        {% if localeEntry %}&#xA;&#xA;            {# Make sure that it's actually localized to this locale#}&#xA;            {% if localeEntry.locale == locale %}&#xA;&#xA;                {# Output a link to it #}&#xA;                &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% else %}&#xA;&#xA;                {# Output a link to the hompage #}&#xA;                &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% endif %}&#xA;        {% else %}&#xA;&#xA;            {# Output a link to the hompage #}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {# Not an entry page #}&#xA;    {% else %}&#xA;&#xA;        {# Output the same path with the locale's base URL (`siteUrl`) #}&#xA;        &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-08-06T15:34:13.467" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1660" PostTypeId="1" AcceptedAnswerId="1664" CreationDate="2014-08-06T15:41:40.397" Score="4" ViewCount="476" Body="&lt;p&gt;Is there a way to add a whole bunch of entries at once? For example, I have a parent entry in a Structure section, and want to add a bunch of children, just setting the title on each one real quick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could write a plugin to do it, but wanted to see if something was already out there first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="629" LastActivityDate="2014-08-06T16:56:49.203" Title="Add entries in bulk" Tags="&lt;entries&gt;&lt;structure&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1661" PostTypeId="2" ParentId="1653" CreationDate="2014-08-06T15:50:14.347" Score="3" Body="&lt;p&gt;Depending on the amount of data required (and if it makes logical sense to have the data separate from the entry) I'd probably set this up as a &quot;Contact details&quot; section itself, using the individual matrix fields from your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if some other entry type needs it, set up an entries field in that entry type, limited to entries in the &quot;contact details&quot; section and limited to the number of contact detail entries you want to show, probably 1 going by your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can still have your details grouped (as a separate entry) but it's more compact as a single field rather than a matrix in the fields of the entry you're using the contact details in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trade-off is that you need to enter your contact details entry before you try to add it to your &quot;x&quot; entry field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it makes no logical sense to have the fields as entirely different sections and your fields are getting cumbersome I think the best way is to put them in a different tab to at least remove the clutter.&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2014-08-06T15:50:14.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1662" PostTypeId="1" CreationDate="2014-08-06T16:08:04.747" Score="2" ViewCount="749" Body="&lt;p&gt;There is a jQuery plugin called pjax (&lt;a href=&quot;https://github.com/defunkt/jquery-pjax/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/defunkt/jquery-pjax/&lt;/a&gt;) for downloading page content via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you integrate pjax in Craft for downloading entries via ajax? Or are there other ways to download entries via ajax?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2014-08-06T16:50:46.033" LastActivityDate="2014-08-07T02:53:35.243" Title="How can you use the jQuery pjax plugin with Craft?" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1663" PostTypeId="2" ParentId="1624" CreationDate="2014-08-06T16:46:24.280" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-matrixcolors&quot; rel=&quot;nofollow&quot;&gt;Matrix Colors plugin for Craft CMS&lt;/a&gt; would help. It lets you assign a different color for each block type.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-06T16:46:24.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1664" PostTypeId="2" ParentId="1660" CreationDate="2014-08-06T16:56:49.203" Score="2" Body="&lt;p&gt;Right now, a plugin is the way to go.  There are a &lt;a href=&quot;http://straightupcraft.com/craft-plugins/import&quot; rel=&quot;nofollow&quot;&gt;couple&lt;/a&gt; of Craft &lt;a href=&quot;http://straightupcraft.com/craft-plugins/ee-craft-import&quot; rel=&quot;nofollow&quot;&gt;importing&lt;/a&gt; plugins that might get you where you want to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long-term, we've got some plans around importing and exporting data from a Craft install as well, but no ETA on it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-06T16:56:49.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1665" PostTypeId="2" ParentId="1654" CreationDate="2014-08-06T17:06:48.560" Score="3" Body="&lt;p&gt;Currently, there isn't a native way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's been &lt;a href=&quot;https://plus.google.com/u/0/+SamHibberd/posts/1p8dHMfFA2G&quot; rel=&quot;nofollow&quot;&gt;discussed&lt;/a&gt; many times before and it's still on our radar.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-06T17:06:48.560" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1666" PostTypeId="2" ParentId="1631" CreationDate="2014-08-06T17:35:11.180" Score="1" Body="&lt;p&gt;All data that goes to the database is properly parameterized by Craft / &lt;a href=&quot;http://yiiframework.com&quot; rel=&quot;nofollow&quot;&gt;Yii&lt;/a&gt; and ultimately &lt;a href=&quot;http://php.net/manual/en/book.pdo.php&quot; rel=&quot;nofollow&quot;&gt;PDO&lt;/a&gt; to prevent against SQL Injection attacks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For obvious reasons, the Rich Text Field is the only field type that Craft will return the &quot;raw&quot; content for, meaning exactly what was saved in the database.  All other field types will get automatically encoded by &lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow&quot;&gt;Twig&lt;/a&gt; on output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're accepting guest input from a Rich Text Field on the front-end, you'll probably want to have it post to a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; and run it through &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier&quot; rel=&quot;nofollow&quot;&gt;CHtmlPurifier&lt;/a&gt; to remove any malicious looking bits before getting saved to the database.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$purifier = new \CHtmlPurifier();&#xA;$purifier-&amp;gt;purify($html)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-06T17:35:11.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1667" PostTypeId="1" AcceptedAnswerId="1668" CreationDate="2014-08-06T18:20:31.480" Score="2" ViewCount="668" Body="&lt;p&gt;I've set up multiple &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;translation files&lt;/a&gt; (&lt;code&gt;de.php&lt;/code&gt;, &lt;code&gt;fr.php&lt;/code&gt;, &lt;code&gt;es.php&lt;/code&gt; etc.) in &lt;code&gt;craft/translations/&lt;/code&gt; to translate static text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While my site is in development, I am trying to keep these &lt;code&gt;lang.php&lt;/code&gt; files in sync, so that they all contain at least the strings of the primary locale as array keys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the more strings are added or changed, the more annoying this undertaking gets. Any idea on how I could make this more simple and efficient?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-06T18:56:14.437" LastActivityDate="2014-08-06T18:56:14.437" Title="Keep translation files in sync?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1668" PostTypeId="2" ParentId="1667" CreationDate="2014-08-06T18:20:31.480" Score="4" Body="&lt;p&gt;You could manage all your translations in one csv file. There's &lt;a href=&quot;https://craftcms.stackexchange.com/q/205/125&quot;&gt;another Q/A&lt;/a&gt; about translation files, where &lt;a href=&quot;https://craftcms.stackexchange.com/users/54/&quot;&gt;@Bill Criswell&lt;/a&gt; explains how you can use csv files for translations. I added some variables to his script to make it well adaptable to multiple locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up your new csv file with a column for each locale. Then add the script to each of your &lt;code&gt;lang.php&lt;/code&gt; files and configure &lt;code&gt;$this_locale_column&lt;/code&gt; according to the file's locale.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$path = $_SERVER['DOCUMENT_ROOT'].'/../craft/translations/translations.csv';&#xA;$delimiter = ';';&#xA;$skip_rows = 1; //skip header rows&#xA;$primary_locale_column = 0; //set primary locale column&#xA;$this_locale_column = 1; //set secondary locale column for this `lang.php` file&#xA;&#xA;$translations = array();&#xA;$translations_file = fopen($path, 'r');&#xA;&#xA;if ($translations_file) {&#xA;    while(($translation = fgetcsv($translations_file, 1024, $delimiter)) !== FALSE) {&#xA;        if($skip_rows != 0) { $skip_rows--; continue; }&#xA;        $translations[$translation[$primary_locale_column]] = $translation[$this_locale_column];&#xA;    }&#xA;}&#xA;&#xA;return $translations;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-08-06T18:20:31.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1669" PostTypeId="1" AcceptedAnswerId="1670" CreationDate="2014-08-06T21:06:08.290" Score="1" ViewCount="93" Body="&lt;p&gt;The following code is throwing an error for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventEntries = craft.entries.find({&#xA;    section: 'events',&#xA;    event_startDateTime: '&amp;lt;= {{ now }}',&#xA;    limit: '4'&#xA;}) %}&#xA;&#xA;{% for entry in eventEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fatal error: Call to a member function getTimestamp() on a non-object&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is pull 4 events where a date field (event_startDateTime) is before the current time.  My suspicion is that the {{ now }} variable isn't parsing inside the single quotes, but I'm not entirely sure.  Can anyone correct my code?&lt;/p&gt;&#xA;" OwnerUserId="638" LastActivityDate="2014-08-06T21:08:38.597" Title="Problem with Pulling Event Entries" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1670" PostTypeId="2" ParentId="1669" CreationDate="2014-08-06T21:08:38.597" Score="2" Body="&lt;p&gt;In Twig, you'll never need to double up on your curly brackets.  I.E.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ {{ }} }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% {{ }} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Change this (which is already inside of &lt;code&gt;{% %}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;event_startDateTime: '&amp;lt;= {{ now }}',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To use string concatenation like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;event_startDateTime: '&amp;lt;= ' ~ now,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you should be set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-06T21:08:38.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1671" PostTypeId="1" CreationDate="2014-08-06T22:16:23.230" Score="1" ViewCount="279" Body="&lt;p&gt;Can anyone recommend a hosting company that can handle running CraftCMS based out of Australia? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried contacting &lt;a href=&quot;http://www.digitalpacific.com.au/&quot; rel=&quot;nofollow&quot;&gt;http://www.digitalpacific.com.au/&lt;/a&gt; but they came back to me with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;I have had this reviewed by our technicians to ensure we recommend the correct solution. I have been advised that due to the &quot;crypt() with BLOWFISH_CRYPT&quot; requirement, we are unable to host this on a Business hosting plan.&quot;&lt;/p&gt;&#xA;" OwnerUserId="285" LastActivityDate="2014-08-07T02:37:37.513" Title="CraftCMS Hosting in Australia?" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2014-08-07T15:57:14.977" ContentLicense="CC BY-SA 3.0" />
  <row Id="1672" PostTypeId="1" AcceptedAnswerId="1686" CreationDate="2014-08-07T01:38:48.660" Score="9" ViewCount="2000" Body="&lt;p&gt;I'm writing a plugin where I have the id of an entry, that entry has a matrix field, and I want to iterate over the blocks of the matrix field. In php. How do I do that? Pointers to good documentation for how to do this would be appreciated too.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-07T11:34:17.767" Title="How to iterate over matrix field from a plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1673" PostTypeId="2" ParentId="1671" CreationDate="2014-08-07T02:37:37.513" Score="2" Body="&lt;p&gt;I'm not in Australia, but I've seen Luke Holder (of Perth) &lt;a href=&quot;https://plus.google.com/u/0/107146320975542982883/posts/QZSyJjbHyzJ&quot; rel=&quot;nofollow&quot;&gt;repeatedly mention Digital Ocean&lt;/a&gt;. I've heard other folks describe having a good experience with Digital Ocean as well.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.digitalocean.com/&quot; rel=&quot;nofollow&quot;&gt;Digital Ocean&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-07T02:37:37.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1674" PostTypeId="2" ParentId="1662" CreationDate="2014-08-07T02:53:35.243" Score="2" Body="&lt;p&gt;In order to make an AJAX call in Craft, you'll need to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;build a custom plugin&lt;/a&gt;. Within the context of your plugin, add a &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controller&lt;/a&gt;&lt;/strong&gt; as the end-point for your AJAX call. Once you've setup your controller, take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice&quot; rel=&quot;nofollow&quot;&gt;EntriesService API methods&lt;/a&gt; to sort out exactly how to retrieve your entry data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've never built a plugin or are unsure of where to begin, you can download this &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic template&lt;/a&gt; to use as a starting point. It comes pre-packaged with a controller containing a simple AJAX call (and a lot of &quot;how-to&quot; notes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any follow-up questions along the lines of &quot;how do I collect the data for my AJAX call&quot;, those would be worthy of being their own Stack Exchange questions.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-07T02:53:35.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1675" PostTypeId="2" ParentId="1642" CreationDate="2014-08-07T04:47:08.623" Score="4" Body="&lt;p&gt;I got the code working by using the following, without using the saveSettings method:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$field = new FieldModel();&#xA;$field-&amp;gt;groupId      = 1;&#xA;$field-&amp;gt;name         = Craft::t('Field Name');&#xA;$field-&amp;gt;handle       = 'handleName';&#xA;$field-&amp;gt;translatable = false;&#xA;$field-&amp;gt;type         = 'Matrix';&#xA;&#xA;craft()-&amp;gt;fields-&amp;gt;saveField($field);&#xA;&#xA;$settings = new MatrixSettingsModel($field);&#xA;&#xA;$blockType = new MatrixBlockTypeModel();&#xA;$blockType-&amp;gt;fieldId = $field-&amp;gt;id;&#xA;$blockType-&amp;gt;name = Craft::t('blockTypeName');&#xA;$blockType-&amp;gt;handle = 'blockTypeHandle';&#xA;&#xA;$mySubField1 = new FieldModel();&#xA;$mySubField1-&amp;gt;name         = 'My Sub-Field 1';&#xA;$mySubField1-&amp;gt;handle       = 'mySubField1a';&#xA;$mySubField1-&amp;gt;required     = true;&#xA;$mySubField1-&amp;gt;translatable = false;&#xA;$mySubField1-&amp;gt;type         = 'PlainText';&#xA;$mySubField1-&amp;gt;settings     = array('multiline' =&amp;gt; false);&#xA;&#xA;$mySubField2 = new FieldModel();&#xA;$mySubField2-&amp;gt;name         = 'My Sub-Field 2';&#xA;$mySubField2-&amp;gt;handle       = 'mySubField2a';&#xA;$mySubField2-&amp;gt;required     = true;&#xA;$mySubField2-&amp;gt;translatable = false;&#xA;$mySubField2-&amp;gt;type         = 'PlainText';&#xA;$mySubField2-&amp;gt;settings     = array('multiline' =&amp;gt; true);&#xA;&#xA;$blockType-&amp;gt;setFields(array($mySubField1, $mySubField2));&#xA;&#xA;craft()-&amp;gt;matrix-&amp;gt;saveBlockType($blockType);&#xA;$settings-&amp;gt;setBlockTypes(array($blockType));&#xA;$success = craft()-&amp;gt;matrix-&amp;gt;saveSettings($settings);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="448" LastEditorUserId="9" LastEditDate="2014-08-07T10:15:51.170" LastActivityDate="2014-08-07T10:15:51.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1677" PostTypeId="1" AcceptedAnswerId="1678" CreationDate="2014-08-07T07:53:06.827" Score="3" ViewCount="403" Body="&lt;p&gt;I have created a Calendar channel in the Control Panel.&#xA;I have added a field Calendar Date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add that field to the Entries list and sort by it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the post date as the calendar date it will not display if it is in the future?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-08-07T08:04:46.633" Title="Display additional fields (and sort by) in Entries in Control Panel" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1678" PostTypeId="2" ParentId="1677" CreationDate="2014-08-07T08:04:46.633" Score="5" Body="&lt;p&gt;Not at the moment. Sorting by custom field in the back end entries screen is not yet implemented although I know it is definitely possible in the future based on the way the code is currently laid out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would create a front end method to list and sort the entries with links into edit with cpEditUrl &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel#cpEditUrl&quot;&gt;http://buildwithcraft.com/docs/templating/categorymodel#cpEditUrl&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-08-07T08:04:46.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1679" PostTypeId="2" ParentId="1521" CreationDate="2014-08-07T08:33:03.300" Score="5" Body="&lt;p&gt;I am not really clear on what you are trying to do. My guess is you are trying to add your own validation to saving an element and trying to block that with your own custom checking of content values etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think listening to the event will help as you cannot send a message to say this element is not valid from an event listener - the event does pass you a element that is about to be saved but you cant return the modified element from the listener.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would suggest is building a custom fieldType that contains some validation rules that peeks in at the content of other fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class My_CustomFieldType extends BaseFieldType&#xA;{&#xA;&#xA;/**&#xA; All the normal filetype stuff like name etc here.&#xA;*/&#xA;&#xA;public function validate($value)&#xA;{&#xA;  $errors = parent::validate($value);&#xA;&#xA;  if (!is_array($errors))&#xA;  {&#xA;    $errors = array();&#xA;  }&#xA;&#xA;  // DO you logic here to test then set an $variable to true or false&#xA;  // if your conditions are met then add to the $errors array below if there is a problem.&#xA;  // if you want to access other field in this element do this:&#xA;  // &#xA;  //   $owner     = $this-&amp;gt;element;&#xA;  //   $fieldData = $owner-&amp;gt;getContent()-&amp;gt;getAttribute(array('sectionId'));&#xA;  //&#xA;&#xA;&#xA;  if ($variable){&#xA;    $errors[] = Craft::t('You are not allowed to edit this element.');&#xA;  }&#xA;&#xA;&#xA;  if ($errors)&#xA;  {&#xA;    return $errors;&#xA;  }&#xA;  else&#xA;  {&#xA;    return true;&#xA;  }&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Im thinking that this will be able to stop the entry being saved. Hopefully thats what you were looking for.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-08-07T08:33:03.300" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1680" PostTypeId="1" AcceptedAnswerId="1683" CreationDate="2014-08-07T10:12:40.243" Score="5" ViewCount="639" Body="&lt;p&gt;I my be in a bit of a &quot;wood for the trees&quot; situation but how is it possible to return elements based on a custom field being between two supplied values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example returning users based on a number field. Let's say the number field is between 1 - 100 and I want to return users that have between 5 and 10 selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could do it like the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User, array(&quot;customNumberField&quot;=&amp;gt;array(5,6,7,8,9,10))-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However that sets &lt;code&gt;OR&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that you can use parameters eg &lt;code&gt;&quot;customNumberField&quot;=&amp;gt;&quot;&amp;lt;= 10&quot;&lt;/code&gt; but obviously specifying that key twice causes it to be overwritten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also specify an array with the parameters (avoiding the overwriting) like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User, array(&quot;customNumberField&quot;=&amp;gt;array(&quot;&amp;gt;= 5&quot;, &quot;&amp;lt;= 10&quot;))-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But again this just creates &lt;code&gt;customNumberField &amp;gt;= 5 OR customNumberField &amp;lt;= 10&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use the array as above but tell it to use &lt;code&gt;AND&lt;/code&gt; instead of &lt;code&gt;OR&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track or way off?&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2014-08-07T10:26:15.180" Title="How can you return elements between two values?" Tags="&lt;elementtype&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1681" PostTypeId="1" AcceptedAnswerId="1684" CreationDate="2014-08-07T10:14:51.277" Score="2" ViewCount="818" Body="&lt;p&gt;I've got a 'booking' channel and an 'event' channel setup. Through the frontend, I need the logged in user to be able to submit a saveEntry form on the frontend which saves a new entry in the booking channel. The booking channel has two fields, both Entries fields. The first field is a relation to one user (the logged in user), and the second field is a relation to a single entry in the events channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I submit the form, the entry is being created in the booking channel, both both Entries fields are blank. How do I make it save the related entries? Can't find any documentation on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Existing code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Summary&amp;lt;/h2&amp;gt;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; class=&quot;custom&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;events/{{event.slug}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;18&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userBooking]&quot; value=&quot;{{user.username}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[eventBooking]&quot; value=&quot;{{eventID}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Confirm Booking&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Short version: How do I save a related entry through a frontend form?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-08-07T10:27:00.860" Title="How to save Entries to an entry? (non-plugin)" Tags="&lt;entries&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1682" PostTypeId="1" AcceptedAnswerId="1685" CreationDate="2014-08-07T10:18:16.720" Score="15" ViewCount="11812" Body="&lt;p&gt;I can't help but think this is a silly/obvious question, but I'm trying to retrieve the current section handle so I can use it as a class. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm going about it wrong, but {{ handle }} does nothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="125" LastEditDate="2016-01-23T10:52:40.757" LastActivityDate="2016-01-23T10:52:40.757" Title="Get the current section handle" Tags="&lt;templating&gt;&lt;entry&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1683" PostTypeId="2" ParentId="1680" CreationDate="2014-08-07T10:26:15.180" Score="6" Body="&lt;p&gt;You’re close! You just need to begin the array with &lt;code&gt;&quot;and&quot;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;customNumberField = array('and', '&amp;gt;=5', '&amp;lt;=10');&#xA;&#xA;$users = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This same thing could also be accomplished from your templates like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set users = craft.users.customNumberField('and', '&amp;gt;=5', '&amp;lt;=10') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-07T10:26:15.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1684" PostTypeId="2" ParentId="1681" CreationDate="2014-08-07T10:27:00.860" Score="4" Body="&lt;p&gt;All related fields need to be passed as an array even if it is limited to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so for example change your eventBooking and userBooking hidden fields to be the following (also you may need to specify the user id when relating to a user):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userBooking][]&quot; value=&quot;{{user.id}}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[eventBooking][]&quot; value=&quot;{{eventID}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should get you want you need.&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2014-08-07T10:27:00.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1685" PostTypeId="2" ParentId="1682" CreationDate="2014-08-07T10:40:04.307" Score="20" Body="&lt;p&gt;One thing that’s important to remember is that there’s no inherent relationship between your templates and sections. Any template can show any entry from any section. So there’s no such thing as the “current section”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your section has the “Entries in this section have their own URLs” setting checked, and you’re requesting one of that section’s entries’ URLs, then the section’s template will get loaded automatically and an &lt;code&gt;entry&lt;/code&gt; variable will be available to it, which represents the entry whose URL you requested. But that doesn’t mean that you couldn’t have loaded the same template some other way (e.g. via an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;&lt;code&gt;{% include %}&lt;/code&gt;&lt;/a&gt; tag from another template), or that you couldn’t have manually fetched that entry some other way (e.g. with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, if you have an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;EntryModel&lt;/a&gt; variable set (such as that &lt;code&gt;entry&lt;/code&gt; variable that you’d automatically get when accessing an entry’s URL), you can access it’s section using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getSection&quot;&gt;&lt;code&gt;entry.getSection()&lt;/code&gt;&lt;/a&gt;, and you can access that section’s handle via its &lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel#handle&quot;&gt;&lt;code&gt;handle&lt;/code&gt;&lt;/a&gt; property.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set section = entry.getSection() %}&#xA;{% set handle = section.handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That could be simplified to:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set handle = entry.getSection().handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set handle = entry.section.handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-07T10:40:04.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1686" PostTypeId="2" ParentId="1672" CreationDate="2014-08-07T11:34:17.767" Score="7" Body="&lt;p&gt;So, first you want to get the entry model using your entry id. In the EntriesService there is a method called &lt;a href=&quot;http://buildwithcraft.com/docs/apis/entriesservice#getEntryById&quot;&gt;&lt;code&gt;getEntryById&lt;/code&gt;&lt;/a&gt; which you can use like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(123);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return you an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot;&gt;EntryModel&lt;/a&gt; which has on it all your fields. So, if you matrix field handle is called &lt;code&gt;matrixFieldHandle&lt;/code&gt; then you would access the field contents like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixBlocks = $entry-&amp;gt;matrixFieldHandle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A matrix field will return you an array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot;&gt;MatrixBlockModels&lt;/a&gt; from which you can get at everything else you need e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($matrixBlocks as $block){&#xA;  echo $block-&amp;gt;id;&#xA;  echo $block-&amp;gt;fieldHandle;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that to play with block types you will need to look at the &lt;a href=&quot;http://buildwithcraft.com/docs/apis/matrixservice&quot;&gt;MatrixService&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/apis/matrixservice#getBlockTypeById&quot;&gt;&lt;code&gt;getBlockTypeById()&lt;/code&gt;&lt;/a&gt; to do things like filter out different blocks based on their block types.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-08-07T11:34:17.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1687" PostTypeId="1" CreationDate="2014-08-07T12:36:06.630" Score="5" ViewCount="533" Body="&lt;p&gt;After twitter conversation with Brandon Kelly, is it possible to implement something similar to the following?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(&quot;mySection&quot;).sum(&quot;myCustomField&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="129" LastEditorUserId="250" LastEditDate="2014-10-03T16:04:43.557" LastActivityDate="2019-12-07T17:38:17.887" Title="Ability to SUM() or GROUP BY from the template or ElementCriteriaModel" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1688" PostTypeId="2" ParentId="1687" CreationDate="2014-08-07T13:00:32.983" Score="6" Body="&lt;p&gt;You could do this with a plugin. Create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variable&lt;/a&gt; class with a function called &lt;code&gt;sum()&lt;/code&gt;, which accepts an ElementCriteriaModel, passes it to ElementsService::buildElementsQuery(), and then replaces the &lt;code&gt;SELECT&lt;/code&gt; value on the resulting DbCommand object:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class FooVariable&#xA;{&#xA;    public function sum(ElementCriteriaModel $criteria, $column)&#xA;    {&#xA;        $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;        if ($query)&#xA;        {&#xA;            return $query&#xA;                -&amp;gt;select(&quot;SUM({$column})&quot;)&#xA;                -&amp;gt;group(null)&#xA;                -&amp;gt;queryScalar();&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place, you can do this in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;mySection&quot;) %}&#xA;{% set sum = craft.foo.sum(entries, &quot;field_myCustomField&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you will need to pass in the field’s full column name (with that “field_” prefix) rather than just its handle. You can figure that out by looking at your craft_content table (or craft_matrixcontent_matrixfieldhandle if it’s a Matrix field). It would have been possible to get the code to be smart enough to figure the column name out for itself, but this way is a bit simpler.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-02-27T19:11:44.743" LastActivityDate="2017-02-27T19:11:44.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1689" PostTypeId="1" AcceptedAnswerId="1702" CreationDate="2014-08-07T13:23:44.853" Score="2" ViewCount="1532" Body="&lt;p&gt;If a booking channel contains two Entries fields (one related to a single User, one related to a single 'Event'), how can I get the booking entry title to be set automatically to the following syntax:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Event Date - Username&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set up the entry to not show the title field, but my syntax is wrong. I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{eventBooking.title}} - {{userBooking.username}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but all I'm getting is &quot;-&quot;, so it's obviously not recognising the fields. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-08-07T16:04:53.037" LastActivityDate="2014-08-08T15:22:23.493" Title="How can I set an entry title automatically, based on a related entry?" Tags="&lt;entries&gt;&lt;titles&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1690" PostTypeId="1" AcceptedAnswerId="1691" CreationDate="2014-08-07T13:55:30.323" Score="5" ViewCount="654" Body="&lt;p&gt;In the multi-lingual site I'm building, I've created an &quot;SEO&quot; global set where my client can enter keywords and a description to populate meta tags site-wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem: globals don't seem to be translatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So unless I'm missing something, I'll have to add additional dedicated fields to hold the Spanish version of this info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? How would you approach this, if you'd do it differently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-08-07T15:39:28.743" Title="Can globals be localized?" Tags="&lt;localization&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1691" PostTypeId="2" ParentId="1690" CreationDate="2014-08-07T13:59:17.927" Score="5" Body="&lt;p&gt;Yes, globals can be localised. Make sure you have ticked &lt;strong&gt;&quot;This field is translatable&quot;&lt;/strong&gt; in the field settings for the ones in your global set, and you should be good to go.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-08-07T13:59:17.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1692" PostTypeId="1" AcceptedAnswerId="1693" CreationDate="2014-08-07T14:58:18.640" Score="2" ViewCount="1244" Body="&lt;p&gt;I have one tag for each entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - Entry1&#xA;     Tag1&#xA; - Entry2&#xA;     Tag2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to show them in the title of each entry. But it doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mainEntry').limit(4) %}&#xA;{% set tag = entry.mainEntryTag.first() %}&#xA;  &amp;lt;h2&amp;gt;{{ tag }} {{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in displaying only the globally first tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Entry1&#xA;     Tag1&#xA;- Entry2&#xA;     Tag1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I just write: &lt;code&gt;{% set tag = entry.projektart %}&lt;/code&gt; I get the error: &lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get to current entry tag? &lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-08-07T15:40:47.147" Title="Show tags for each entry" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1693" PostTypeId="2" ParentId="1692" CreationDate="2014-08-07T15:04:36.220" Score="4" Body="&lt;p&gt;You're very close. Change &quot;set tag&quot; to &quot;set tags&quot; so you have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.projektart %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then loop through the tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;    {{ tag }}&#xA;{% else %}&#xA;    No tags found&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also simplify this and instead of setting the &quot;tags&quot; variable you could write the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in entry.projektart %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="82" LastEditorUserId="82" LastEditDate="2014-08-07T15:40:47.147" LastActivityDate="2014-08-07T15:40:47.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1694" PostTypeId="1" AcceptedAnswerId="1696" CreationDate="2014-08-07T15:16:20.723" Score="3" ViewCount="777" Body="&lt;p&gt;I am using the &lt;code&gt;UserModel&lt;/code&gt; to create a user, and then injecting that into the User API service as is instructed in the documentation. The only thing I am not seeing is how to set the group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked in the Model class and there is no method for setting the group and it's not part of the &lt;code&gt;defineAttributes()&lt;/code&gt; method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the documentation there is no method to set group, just read only the groups: &lt;a href=&quot;https://craftcms.com/docs/templating/usermodel#getGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/usermodel#getGroups&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing here about it: &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/UsersService&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I am doing to save user.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = new UserModel;&#xA;&#xA;$user-&amp;gt;username = 'username';&#xA;$user-&amp;gt;email = 'yourmom@email.com';&#xA;// $user-&amp;gt;groupID = &quot;group&quot;;&#xA;$user-&amp;gt;firstName = 'first name';&#xA;$user-&amp;gt;lastName = 'last name';&#xA;$user-&amp;gt;getContent()-&amp;gt;setAttributes([ 'usersAddress' =&amp;gt; 'Your face' ]);&#xA;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing something obvious?&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="45" LastEditDate="2017-06-19T21:09:40.040" LastActivityDate="2017-06-19T21:09:40.040" Title="How do you set a users group?" Tags="&lt;users&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1695" PostTypeId="1" AcceptedAnswerId="1697" CreationDate="2014-08-07T15:23:31.613" Score="3" ViewCount="1315" Body="&lt;p&gt;I'm trying to build my first plugin using a service but i can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file is named CampaignReports_CampaignMonitorService.php and it's in the services folder of my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code of the service:&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CampaignReports_CampaignMonitorService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    public function __construct()&#xA;    {        &#xA;&#xA;    }&#xA;&#xA;    public function getSettings()&#xA;    {&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm calling the service as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;campaignReports_CampaignMonitor-&amp;gt;getSettings();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This causes an internal server error with the following message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Property &quot;Craft\WebApp.campaignReports_CampaignMonitor&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what i'm doing wrong? Probably some naming convention I haven't followed exactly but I just don't find it&lt;/p&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-08-07T15:32:38.347" Title="Service not defined" Tags="&lt;plugin-development&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1696" PostTypeId="2" ParentId="1694" CreationDate="2014-08-07T15:24:00.720" Score="6" Body="&lt;p&gt;It's not documented, but &lt;code&gt;UserGroupsService&lt;/code&gt; has a method &lt;code&gt;assignUserToGroups($userId, int|array $groupIds)&lt;/code&gt;. You'll have to save your user first, but once you have a user id, I believe you can just use that with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Original code&#xA;$user = new UserModel;&#xA;&#xA;$user-&amp;gt;username = 'username';&#xA;$user-&amp;gt;email = 'user@email.com';&#xA;$user-&amp;gt;firstName = 'first name';&#xA;$user-&amp;gt;lastName = 'last name';&#xA;$user-&amp;gt;getContent()-&amp;gt;setAttributes([ 'usersAddress' =&amp;gt; 'Your face' ]);&#xA;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;// Add to single group&#xA;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;&#xA;// OR, add to multiple groups&#xA;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, [$groupIdOne, $groupIdTwo]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="77" LastEditorUserId="45" LastEditDate="2017-06-19T21:06:24.967" LastActivityDate="2017-06-19T21:06:24.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1697" PostTypeId="2" ParentId="1695" CreationDate="2014-08-07T15:32:38.347" Score="5" Body="&lt;p&gt;Looks like a casing issue to me. You should be calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;campaignReports_campaignMonitor-&amp;gt;getSettings();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-08-07T15:32:38.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1698" PostTypeId="2" ParentId="1690" CreationDate="2014-08-07T15:39:28.743" Score="4" Body="&lt;p&gt;Per my comment on Jamie's answer above, I didn't notice that on the Globals section in the control panel, the locale switcher is up where the version switcher usually is on entries:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kW2vK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of those UI-blindness moments.&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-08-07T15:39:28.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1699" PostTypeId="2" ParentId="1689" CreationDate="2014-08-07T15:55:11.917" Score="0" Body="&lt;p&gt;If you are on an entry page have you tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ entry.eventBooking.title }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because at the moment it doesn't look like your telling craft to look at the eventBooking handle on the entry but the title on a eventBooking variable&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-08-07T15:55:11.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1700" PostTypeId="1" CreationDate="2014-08-07T16:13:59.783" Score="5" ViewCount="630" Body="&lt;p&gt;I have a Structure Section controlling my Nav and page contents&#xA;So I have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About Us&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;History&lt;/li&gt;&#xA;&lt;li&gt;List item&lt;/li&gt;&#xA;&lt;li&gt;List item &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Services&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Service 1 &lt;/li&gt;&#xA;&lt;li&gt;Service 2 &lt;/li&gt;&#xA;&lt;li&gt;Service 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the Control Panel when I add items to this structure I have 3 different Entry Types.&#xA;Is it possible to set it so that when I add a Child to the Services structure item a specific entry type can be set as default as opposed to the first one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should create a different structure section for each one and have its own entry type?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-08-07T16:23:09.213" Title="Set Default Entry Types for elements in a Structure Section" Tags="&lt;structure&gt;&lt;sections&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1701" PostTypeId="2" ParentId="1700" CreationDate="2014-08-07T16:23:09.213" Score="7" Body="&lt;p&gt;I'm not sure if you can set a default entry type within Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a reasonably workaround would be to go to Settings &gt; Sections, then click 'Edit entry types' for the section you need to apply this to. Next, drag the entry type you would like to be used by default to the top of the entry-type list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, when a new entry is added to the Section, the default entry type will be whichever type is the top of the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, but as I say there may be some other answers that offer a cleaner approach.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-08-07T16:23:09.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1702" PostTypeId="2" ParentId="1689" CreationDate="2014-08-07T16:33:41.587" Score="6" Body="&lt;p&gt;I believe this is in regards to the &lt;code&gt;Title Format&lt;/code&gt; feature, so just to be explicit in what I'm referring to, Craft Documentation calls this a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow&quot;&gt;Dynamic Entry Title&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The syntax you are looking for can take two forms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) Long form object syntax&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as on the front end your &lt;code&gt;entry&lt;/code&gt; is available via the &lt;code&gt;{{ entry }}&lt;/code&gt; variable, within your Title pattern on the back end, the current entry is available via the &lt;code&gt;{{ object }}&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I believe the following should work, assuming you are using the actual field names:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.eventBooking.first().title }} - {{ object.userBooking.first().username }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You need to use the &lt;code&gt;first()&lt;/code&gt; method here because Relations fields return an array by default. Since you need to output your content directly, you need to make sure you are accessing the &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;username&lt;/code&gt; properties via the Model they are associated with in that array.  If your fields are required, you can safely assume that the first item will exist in the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Short hand syntax&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you are doing is simple, Craft gives you the option to make the syntax a bit easier and omit the &lt;code&gt;object&lt;/code&gt; variable.  So the above could also be written with single curly braces as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{eventBooking.first().title} - {userBooking.first().username}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-08-08T15:22:23.493" LastActivityDate="2014-08-08T15:22:23.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1703" PostTypeId="1" AcceptedAnswerId="1704" CreationDate="2014-08-07T18:31:32.747" Score="3" ViewCount="203" Body="&lt;p&gt;Is there a way to specify a different template directory from the general config?&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2014-08-07T18:38:43.117" Title="Specify template directory in config" Tags="&lt;templating&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1704" PostTypeId="2" ParentId="1703" CreationDate="2014-08-07T18:38:43.117" Score="3" Body="&lt;p&gt;Not in the config file, but you can from index.php using the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-templates-path&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CRAFT_TEMPLATES_PATH&lt;/code&gt;&lt;/a&gt; constant:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;define('CRAFT_TEMPLATES_PATH', '../templates/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-07T18:38:43.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1705" PostTypeId="1" AcceptedAnswerId="1725" CreationDate="2014-08-07T20:51:46.973" Score="3" ViewCount="179" Body="&lt;p&gt;I'm trying to set up a workflow where I have a group of &quot;Drafters&quot; who can create new entries but the new entry is not published by default. I've made the following setting for this group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FSSlu.png&quot; alt=&quot;screenshot of group settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I log in as a user within this group, the user is not allowed to create a new entry, even though their permission explicitly says they can create new entries. Am I missing something here?&lt;/p&gt;&#xA;" OwnerUserId="279" LastActivityDate="2014-08-08T17:04:59.737" Title="Can a User Group Create Drafts of New Entries Only?" Tags="&lt;workflow&gt;&lt;entry&gt;&lt;draft&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1706" PostTypeId="1" AcceptedAnswerId="1708" CreationDate="2014-08-07T22:33:00.383" Score="5" ViewCount="5941" Body="&lt;p&gt;Both of these things:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.  {{ siteUrl }}path/to/template&#xA;2.  url('path/to/template')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... will generate this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mywebsite.com/path/to/template&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering, &lt;strong&gt;which method is preferred?&lt;/strong&gt; Are there any pros/cons of either technique?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-08T02:55:23.193" Title="What's the difference between {{ siteUrl }} and url()?" Tags="&lt;templating&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1707" PostTypeId="2" ParentId="1706" CreationDate="2014-08-07T23:02:28.127" Score="2" Body="&lt;p&gt;{{ siteUrl }} is just a simple URL taken from your config file, this is helpful for when you want to use absolute linking to things like style sheets js files, images etc. because it's dynamic you can set it differently depending on the environment and not have to worry about links breaking or putting a localhost link into a live template (which would fail)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url() is useful for generating absolute links to other internal pages, again without worrying about having to check and update links in your template going from live to development, it takes the path specified and attaches the siteUrl variable so {{ url(path/to/page) }} would output ocalhost/path/to/page or yourdomain.com/path/to/page , depending on your environment and config, hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-08-07T23:02:28.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1708" PostTypeId="2" ParentId="1706" CreationDate="2014-08-08T02:50:02.720" Score="12" Body="&lt;p&gt;The &lt;code&gt;siteUrl&lt;/code&gt; global variable is actually set by calling &lt;code&gt;url()&lt;/code&gt; without passing anything into it&lt;sup&gt;1&lt;/sup&gt;, so if you're asking about the difference between &lt;code&gt;siteUrl&lt;/code&gt; and &lt;code&gt;url()&lt;/code&gt; &lt;em&gt;without passing a path to it&lt;/em&gt;, you will always get the exact same result. The only difference is that it will be ever so slightly more efficient to use &lt;code&gt;siteUrl&lt;/code&gt; since that is a variable that has already been defined for you, whereas Craft will have to go through a bit of logic each time &lt;code&gt;url()&lt;/code&gt; is called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for where to use which, it's mostly a matter of taste. The only time when &lt;code&gt;siteUrl~&quot;some/path&quot;&lt;/code&gt; might differ from &lt;code&gt;url(&quot;some/path&quot;)&lt;/code&gt; is if Craft is not set up to hide index.php in URLS - &lt;code&gt;url()&lt;/code&gt; will be smart about how to output URLs with index.php and the path appended after it (either in the query string or path info, depending on the usePathInfp config setting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a greater difference between the two in CP templates, though: in that context &lt;code&gt;url()&lt;/code&gt; will automatically add the CP trigger to the path for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last thing worth noting is that &lt;code&gt;url()&lt;/code&gt; also provides some arguments for changing the schema (http or https) and appending query string parameters to the URL, whether you pass in a relative site path or a full URL. We've documented those features here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions#url&quot;&gt;http://buildwithcraft.com/docs/templating/functions#url&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; or more precisely, UrlHelper::getUrl(), the PHP function that &lt;code&gt;url()&lt;/code&gt; maps to&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-08T02:55:23.193" LastActivityDate="2014-08-08T02:55:23.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1709" PostTypeId="1" CreationDate="2014-08-08T06:14:51.973" Score="5" ViewCount="1594" Body="&lt;p&gt;I returned to a site designed months ago, and added a second language to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the beginning, this site had prominent composition of entries out of multiple elements in their matrix, with formatting choices selectable on the elements (like positioning and size for images; or position left or right for compound pull quote/citation blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all works fine, and now in languages. However, there is the fact that languages other than the first used seem &lt;s&gt;not ever&lt;/s&gt; never to have their Matrix of content blocks copied over into the new language. The Matrix is there, of course, but empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This emptiness is the case with first save starting with an entirely fresh entry, which is a noted in the add as the only case at present where Craft normally copies content to other available languages, and very handily so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really I think this is a bug report, but maybe not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present copy over does, as commented below, operate only at the point of first save to a first language. If you edit after saving, only that first save will have been copied, and your edits won't be. If you add fields to the section, and fill them in for a first language, nothing will be copied for those to other languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is clearly worth looking into for persons who use multiple languages/Locales, but isn't so simple to do well, and I believe it is somewhere down the list for Craft futures, likely properly so compared other desires. Worth mentioning, though ;)&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="125" LastEditDate="2014-08-08T08:34:12.633" LastActivityDate="2017-11-30T14:02:24.850" Title="How do I get Matrix elements to copy their content across language Locales?" Tags="&lt;matrix&gt;&lt;localization&gt;&lt;entry&gt;" AnswerCount="3" CommentCount="7" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1710" PostTypeId="2" ParentId="1709" CreationDate="2014-08-08T07:01:58.937" Score="2" Body="&lt;p&gt;Entry content is copied over to other locales on the VERY FIRST save of the entry (doesn't matter if it is your primary or one of you secondary locales). When a fresh locale is set up, all the content of all your entries should get copied over to this fresh locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Matrix content is not copied over, I think you're right and this is a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I think Jamie is right, content is only copied over to other locales on the VERY FIRST save of an entry. I think you're out of luck, if your second locale didn't exist back then.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there were multiple feature request on Craft's Google+ site for better syncing options across locales. Other problems mentioned there were, that you have no indication about which fields are always synchronized (not marked as translatable) or which fields are still in sync across all locales (marked as translatable). Another idea was to have smallish buttons, to trigger a new sync for the select field on the next save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is probably not easy to implement these features, but I am confident that P+T will continue to improve on localization.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-08T08:52:36.683" LastActivityDate="2014-08-08T08:52:36.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1711" PostTypeId="1" CreationDate="2014-08-08T10:47:46.373" Score="2" ViewCount="636" Body="&lt;p&gt;I'm currently finishing a client-website which has to be 100% valid HTML5. For one of the sections, I am using a matrix containing rich-text fields. This content is simply shown on the front page.&#xA;The name of the client is &quot;E&amp;amp;K&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Requirements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The output contains HTML tags.&lt;/li&gt;&#xA;&lt;li&gt;The output has to be 100% valid HTML.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Problem:&#xA;The &amp;amp; character won't be escaped to &amp;amp;amp; wherever it is outputted. This breaks the valid requirement. It seems the problem is the input, not the output. However the rich text editor keeps replacing manually placed &amp;amp;amp; with &amp;amp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get this to work correctly?&lt;/p&gt;&#xA;" OwnerUserId="578" LastEditorDisplayName="user1080" LastEditDate="2017-05-23T23:07:37.567" LastActivityDate="2017-05-24T11:16:34.537" Title="How to use &quot;&amp;amp;&quot; in richtext?" Tags="&lt;richtext&gt;&lt;escaping&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1713" PostTypeId="1" CreationDate="2014-08-08T11:48:20.083" Score="5" ViewCount="567" Body="&lt;p&gt;I know that if i have created a new ElementType for my plugin that I can use the same template that Entries uses:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;Entries&quot;|t %}&#xA;{% set elementType = 'Entry' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that will give me the standard layout with a sortable table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However is there anyway to tap into the sortable stuff for my own custom table in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it simply a case of having to work the sortable stuff myself (which is fine)? I just thought I would ask as I would prefer to use the native stuff if it is easy to hook into.&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2015-01-04T19:33:21.743" Title="Easiest way to make a table in the Control Panel sortable?" Tags="&lt;control-panel&gt;&lt;sorting&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1714" PostTypeId="1" AcceptedAnswerId="1717" CreationDate="2014-08-08T12:16:44.323" Score="2" ViewCount="200" Body="&lt;p&gt;If use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$currentEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;$currentContent = $currentEntry-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;$currentAttributes = array();&#xA;&#xA;$fieldLayout = $currentEntry-&amp;gt;getFieldLayout();&#xA;foreach ($fieldLayout-&amp;gt;getFields() as $fieldLayoutField) {&#xA;    $field = $fieldLayoutField-&amp;gt;getField();&#xA;    if (isset($currentContent[$field-&amp;gt;handle])) {&#xA;        $currentAttributes[$field-&amp;gt;handle] = $currentContent[$field-&amp;gt;handle];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It retrieves all data that I want, but I don't get the data from relation fields. If an asset or entry has been selected, I won't receive that data. The result from that field is always null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="121" LastEditorUserId="177" LastEditDate="2014-08-08T12:38:04.003" LastActivityDate="2014-08-08T12:38:46.200" Title="How do I get the data from a relation field?" Tags="&lt;plugin-development&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1715" PostTypeId="1" AcceptedAnswerId="1716" CreationDate="2014-08-08T12:32:35.140" Score="3" ViewCount="658" Body="&lt;p&gt;If I’m accessing an entry’s URL (the 4th check in &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing&lt;/a&gt;), how can I get the entry that the URL matched from a plugin?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-13T11:18:56.130" Title="How can I get the requested entry from a plugin?" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;&lt;routing&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1716" PostTypeId="2" ParentId="1715" CreationDate="2014-08-08T12:32:35.140" Score="3" Body="&lt;p&gt;You can get the request’s matched element via:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$element = craft()-&amp;gt;urlManager-&amp;gt;getMatchedElement();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are two things to remember though:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There may not be a matched element&lt;/li&gt;&#xA;&lt;li&gt;The matched element might not be an &lt;em&gt;entry&lt;/em&gt;. (It could also be a category, and if you have any plugins installed that add their own element types that can have their own URLs, it could be one of those.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To defend against those possibilities, just use the following conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if ($element &amp;amp;&amp;amp; $element-&amp;gt;getElementType() == ElementType::Entry)&#xA;{&#xA;    // There was a matched element, and it's an entry!&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-08T12:39:09.380" LastActivityDate="2014-08-08T12:39:09.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1717" PostTypeId="2" ParentId="1714" CreationDate="2014-08-08T12:38:46.200" Score="1" Body="&lt;p&gt;If you already know the custom field name then it is pretty straight forward:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($id);&#xA;$relatedEntries = $currentEntry-&amp;gt;customFieldName;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you could either loop through each one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($relatedEntries as $entry) {&#xA;    echo $entry-&amp;gt;title;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or simply get the data from the first one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo $relatedEntries-&amp;gt;first()-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remember that all related entries come back as an array even if you have specified that the user can only select 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2014-08-08T12:38:46.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1718" PostTypeId="1" AcceptedAnswerId="1719" CreationDate="2014-08-08T12:57:31.983" Score="4" ViewCount="317" Body="&lt;p&gt;I want my site to serve 1X and 2X images depending on the browser using something like &lt;a href=&quot;http://scottjehl.github.io/picturefill/&quot; rel=&quot;nofollow&quot;&gt;Picturefill&lt;/a&gt;, and I don’t want the 1X version to just be automatically generated using a transform - I want to be able to upload separate 1X and 2X versions, and have them be linked together. How can I go about that?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-08T15:39:19.920" Title="How can I upload separate 1X and 2X images?" Tags="&lt;assets&gt;&lt;image&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1719" PostTypeId="2" ParentId="1718" CreationDate="2014-08-08T12:57:31.983" Score="7" Body="&lt;p&gt;You can do that like so:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields&quot;&gt;Assets field&lt;/a&gt; called “Hi-Res Image” (handle “&lt;code&gt;hiResImage&lt;/code&gt;”) with the following settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Restrict uploads to a single folder&lt;/strong&gt;: [ √ ]&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upload Location&lt;/strong&gt;:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;[same source you’re uploading 1X images to]&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{folder.path}_2x/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Restrict allowed file types&lt;/strong&gt;:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;[ √ ]&lt;/li&gt;&#xA;&lt;li&gt;[Images]&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Target Locale&lt;/strong&gt;: [Same as source]&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limit&lt;/strong&gt;: 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to Settings &gt; Assets &gt; [your source] &gt; Fields tab, and add your new Hi-Res Image field to the layout.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With that set up, after you select 1X images in your main Assets field, you will be able to double-click on them and see your “Hi-Res Image” Assets field in their metadata modals. You can drag your 2X image into that, and it will automatically get saved into a _2x/ subfolder wherever its parent image lives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your templates, you can then output &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags that point to both images:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for image in entry.myAssetsField %}&#xA;    {% set hiResImage = image.hiResImage.first() %}&#xA;&#xA;    &amp;lt;img srcset=&quot;{{ image.url }}&#xA;        {%- if hiResImage %}, {{ hiResImage.url }} 2x{% endif %}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-08T15:39:19.920" LastActivityDate="2014-08-08T15:39:19.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1720" PostTypeId="2" ParentId="1711" CreationDate="2014-08-08T12:59:03.510" Score="2" Body="&lt;p&gt;You could use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;nofollow&quot;&gt;replace filter&lt;/a&gt; on output:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ entry.richtext_field_handle|replace('&amp;amp;': '&amp;amp;amp;') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At first glance I couldn't find a &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/&quot; rel=&quot;nofollow&quot;&gt;Redactor setting&lt;/a&gt; which would help you, but you might want to check yourself, or even write a &lt;a href=&quot;http://imperavi.com/redactor/docs/plugins-creating/&quot; rel=&quot;nofollow&quot;&gt;Redactor plugin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-08T12:59:03.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1721" PostTypeId="1" AcceptedAnswerId="1731" CreationDate="2014-08-08T14:11:06.093" Score="4" ViewCount="284" Body="&lt;p&gt;I want to listen for Yii events like onBeginRequest and onEndRequest. I've tried the following but nothing happens :( &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\Yii::app()-&amp;gt;onBeginRequest = create_function('$event', 'die (&quot;YO&quot;) ;');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;attachEventHandler('onBeginRequest', array($this, 'dieyo'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;getEventHandlers('onBeginRequest')-&amp;gt;add(array($this, 'dieyo'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function dieyo($event)&#xA;{&#xA;    craftdd($event);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-08-08T17:08:39.030" Title="Is it possible to listen for Yii events?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1722" PostTypeId="1" AcceptedAnswerId="1727" CreationDate="2014-08-08T14:26:38.013" Score="4" ViewCount="1040" Body="&lt;p&gt;I'm working on a complex website with multi locales, channels, structures and different designs per page. And the site needs a breadcrumb path. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client &lt;strong&gt;needs&lt;/strong&gt; to manage and add items the to menu. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is a simple overview of the navigation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home&lt;/li&gt;&#xA;&lt;li&gt;About us &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Profile &lt;/li&gt;&#xA;&lt;li&gt;History &lt;em&gt;(different template)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Staff &lt;em&gt;(listing with entry url's)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Jobs &lt;em&gt;(listing)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;investor relations&#xA;&lt;ul&gt;&#xA;&lt;li&gt;finance&lt;/li&gt;&#xA;&lt;li&gt;results (with iframe)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;portfolio&lt;/li&gt;&#xA;&lt;li&gt;press (custom url to external page)&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So no hard coding. What is the best solution to build this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is still a difficult thing in Craft. We need something like Navee or Structure (expression engine) to have a client friendly navigation system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;a href=&quot;https://craftpl.us/plugins/craftnav&quot; rel=&quot;nofollow&quot;&gt;CraftNav&lt;/a&gt;. But it is still too simple.&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="103" LastEditDate="2015-03-03T18:11:36.747" LastActivityDate="2015-03-03T18:11:36.747" Title="How to build a great multi-lingual navigation with channels, structure, and manageable in the CP" Tags="&lt;localization&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1723" PostTypeId="1" AcceptedAnswerId="1724" CreationDate="2014-08-08T14:31:06.807" Score="24" ViewCount="6628" Body="&lt;p&gt;I want to be able to upload a single high resolution image, and output a &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; element that outputs it with a few different sizes and resolutions automatically (using &lt;a href=&quot;http://scottjehl.github.io/picturefill/&quot;&gt;Picturefill&lt;/a&gt; to sort out which one actually shows up to the browsers). How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-13T11:29:42.520" Title="How can I automatically generate responsive images from a single hi-res asset?" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;&lt;responsive-images&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="37" ContentLicense="CC BY-SA 3.0" />
  <row Id="1724" PostTypeId="2" ParentId="1723" CreationDate="2014-08-08T14:31:06.807" Score="38" Body="&lt;p&gt;You can do this using &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot;&gt;image transforms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple things you’re going to need to consider though:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Not every image will necessarily be high-res (e.g. a computer screenshot taken on a non-retina screen)&lt;/li&gt;&#xA;&lt;li&gt;You probably don’t want to output images that are larger than their original size&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For #1, we need some way of identifying images that are 1X vs. 2X. You could do this a couple different ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Give your assets a Lightswitch field that identifies if it’s a 2X image&lt;/li&gt;&#xA;&lt;li&gt;Use a consistent naming convention for 2X image filenames, e.g. “filename@2x.ext” (to borrow Retina.js’s convention)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I personally prefer the second. (That’s what we do on &lt;a href=&quot;http://buildwithcraft.com&quot;&gt;buildwithcraft.com&lt;/a&gt;, except we use “.2x” instead of “@2x”.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can tackle #2 with some logic in the template that only uses a transform when the resulting size is going to be smaller than the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s the combination of these two problems where things get interesting: You need to figure out the image’s &lt;a href=&quot;http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html&quot;&gt;CSS pixel size&lt;/a&gt; (based on whether it’s 1X or 2X) &lt;em&gt;before&lt;/em&gt; you start determining whether it needs a transform, and how big to make the transform, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s what we came up with for Craft’s documentation (such as the image on the &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot;&gt;asset transforms page&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot;&gt;macro&lt;/a&gt; called &lt;code&gt;srcset()&lt;/code&gt; which will be responsible for outputting a &lt;code&gt;&amp;lt;source&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag’s &lt;code&gt;srcset=&lt;/code&gt; attribute and value, and optionally the &lt;code&gt;width=&lt;/code&gt; and &lt;code&gt;height=&lt;/code&gt; attributes as well. It should accept the following arguments:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;image&lt;/code&gt; - an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot;&gt;AssetFileModel&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;maxCssWidth&lt;/code&gt; - the maximum “CSS pixel” width that we want to output the image at&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;includeDimensions&lt;/code&gt; - whether the macro should also output the &lt;code&gt;width=&lt;/code&gt; and &lt;code&gt;height=&lt;/code&gt; attributes.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; element with nested &lt;code&gt;&amp;lt;source&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; elements per the Picture spec, using our new &lt;code&gt;srcset()&lt;/code&gt; macro to write out the &lt;code&gt;srcset=&lt;/code&gt; attributes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here’s what the macro looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro srcset(image, maxCssWidth, includeDimensions) %}&#xA;    {%- spaceless %}&#xA;        {# Is this a 2X image? #}&#xA;        {% set is2x = image.filename matches '/@2x\\.\\w+$/' %}&#xA;&#xA;        {# Determine the CSS width for the image, if it were output at 100% #}&#xA;        {% set cssWidth = (is2x ? round(image.width / 2) : image.width) %}&#xA;&#xA;        {# Determine the image size that 1X screens should get #}&#xA;        {% set width = (cssWidth &amp;gt; maxCssWidth ? maxCssWidth : cssWidth) %}&#xA;&#xA;        {# Determine the image size that 2X screens should get #}&#xA;        {% set width2x = (width * 2) &amp;gt; image.width ? image.width : (width * 2) %}&#xA;&#xA;        {# Output the srcset= attribute value #}&#xA;        srcset=&quot;{{ image.getUrl(image.width != width ? { width: width }) }}, {{ image.getUrl(image.width != width2x ? { width: width2x }) }} 2x&quot;&#xA;&#xA;        {#- Output the width= and height= attributes if needed #}&#xA;        {%- if includeDimensions %} width=&quot;{{ width }}&quot; height=&quot;{{ image.getHeight({ width: width }) }}&quot;{% endif %}&#xA;    {% endspaceless -%}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adjust that &lt;code&gt;{% set is2x = ...&lt;/code&gt; line based on however you’re identifying 2X images. For example if you’re going the Lightswitch route instead, it could be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set is2x = image.is2x %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that each of the &lt;code&gt;image.getUrl()&lt;/code&gt; calls on the {{ output }} line are making sure that the width is different than the actual image width before passing the &lt;code&gt;{ width: X }&lt;/code&gt; object into &lt;code&gt;getUrl()&lt;/code&gt; - that way we’re not having Craft go through the trouble of generating a transform unless we actually need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that macro in place, now we just need to import it in our template, and start using it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% from _self import srcset %}&#xA;&#xA;{# ... #}&#xA;&#xA;{% for image in entry.myAssetsField %}&#xA;    &amp;lt;picture&amp;gt;&#xA;        &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;video style=&quot;display: none;&quot;&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;        &amp;lt;source media=&quot;(min-width: 1000px)&quot; {{ srcset(image, 1000) }}&amp;gt;&#xA;        &amp;lt;source media=&quot;(min-width: 800px)&quot; {{ srcset(image, 800) }}&amp;gt;&#xA;        &amp;lt;source media=&quot;(max-width: 320px)&quot; {{ srcset(image, 320) }}&amp;gt;&#xA;        &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;/video&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;        &amp;lt;img {{ srcset(image, 600, true) }} alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    &amp;lt;/picture&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you placed the macro in a different template, replace &lt;code&gt;_self&lt;/code&gt; with the path to that template, e.g. &lt;code&gt;&quot;_macros&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-14T14:11:34.227" LastActivityDate="2014-08-14T14:11:34.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1725" PostTypeId="2" ParentId="1705" CreationDate="2014-08-08T14:36:59.670" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Am I missing something here?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, you’re missing a bugfix that should be going out today ;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2014-08-08T17:04:59.737" LastActivityDate="2014-08-08T17:04:59.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1726" PostTypeId="1" AcceptedAnswerId="1770" CreationDate="2014-08-08T14:52:48.993" Score="2" ViewCount="218" Body="&lt;p&gt;In my main plugin file I have the following code in my registerCpRoutes fucntion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'campaignreports/subscribers/detail\/(?P&amp;lt;listId&amp;gt;\d+)' =&amp;gt; 'campaignreports/subscribers/_detail/'&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a _detail.html template located in /templates/subscribers/_detail.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason this doesn't seem to work. I keep on getting a &quot;Page not found&quot; error.&#xA;As far as I can tell I have followed &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates#dynamic-url-routing&quot; rel=&quot;nofollow&quot;&gt;the docs on dynamic routing&lt;/a&gt;&#xA;Any ideas on what is going wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have uninstalled &amp;amp; reinstalled the plugin&lt;/p&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-08-11T07:36:29.873" Title="registerCpRoutes gives 404" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1727" PostTypeId="2" ParentId="1722" CreationDate="2014-08-08T15:09:22.033" Score="5" Body="&lt;p&gt;Not sure I'm the best person to answer this having only built one Craft site but here goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a &lt;strong&gt;Structure&lt;/strong&gt; called Main Menu which has three Entry Types. (Entry types were the key for me when doing this)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Structure allows drag and drop ordering and hierarchal navigation ordering for parent &gt; child relationships.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Entry Link &lt;/li&gt;&#xA;&lt;li&gt;Asset Link&lt;/li&gt;&#xA;&lt;li&gt;External Link&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry Link&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;img src=&quot;https://i.stack.imgur.com/P5u2u.png&quot; alt=&quot;entryLink&quot;&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Asset Link&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;img src=&quot;https://i.stack.imgur.com/ehRie.png&quot; alt=&quot;assetLink&quot;&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;External Link&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DS95n.png&quot; alt=&quot;externalLink&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Big, big (two bigs!) NavEE fan here, CraftNav has huge potential to replicate it but it's still a tad early when I tried it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short Entry Types were the key for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: For my own sanity at a later date &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1610/structure-add-class-if-element-has-children&quot;&gt;it would be good to read this post on how to tell if your Structure Navigation has child elements.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this helps but hope it does.&lt;/p&gt;&#xA;" OwnerUserId="260" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-08T15:32:54.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1729" PostTypeId="1" AcceptedAnswerId="1732" CreationDate="2014-08-08T15:46:20.023" Score="2" ViewCount="276" Body="&lt;p&gt;I'm looking to create a very simple website where a user can add items to their own personal feed over time. So by default it's date ordered, but you maintain the ability to sort the order a little bit if you want. So one day I might add a photo, the next day I add a video, the next day I add some text. All these items build up over time and it just gets bigger and bigger. Over the years you might end up with hundreds or thousands of items that you've added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix seems perfectly suited to something like this – where each item is a new block. Except for the fact that all of the items would need to live in a single entry. And I just can't see scaling that very big if everything is in one entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the alternative would be to have each item live as a new post in a channel. This seems like it would make more sense, especially as you get into the hundreds or thousands of items. But then how would I maintain the ability to sort the entries? If I made the channel structured, would that be adequate? And would there not be any issues with having it scale to hundred or thousands of posts in a structured channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I'm just trying to lay a firm foundation where I could theoretically have hundreds/thousands of users each with hundreds/thousands of posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this is basically a vision for a web app that would have a front end interface on it. Is something like this pushing Craft past it's abilities for what it was designed for?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-08-08T17:41:49.060" Title="Hundreds or thousands of posts in a structured channel?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1730" PostTypeId="2" ParentId="1726" CreationDate="2014-08-08T15:48:31.277" Score="1" Body="&lt;p&gt;Not sure why you are escaping the / right in front of the regex. Maybe thats the issue?&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-08-08T15:48:31.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1731" PostTypeId="2" ParentId="1721" CreationDate="2014-08-08T17:08:39.030" Score="2" Body="&lt;p&gt;Yii fires the onBeginRequest event before Craft has had a chance to do any of the plugin bootstrapping / initialization, which is why it's not firing in your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-08T17:08:39.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1732" PostTypeId="2" ParentId="1729" CreationDate="2014-08-08T17:41:49.060" Score="5" Body="&lt;p&gt;We've seen Craft installs running with several hundred thousands of users / assets / entries, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when you're getting into that range, there are several other things to take into account such as hardware resources and architectural designs, various caching methods (Varnish, memcached, Craft's template caching), etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, it makes more sense to me to have them as entries and if you need the ability to have them sortable, then a structured section is the ways to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;But&lt;/em&gt; there is a known issue with the UI for structured sections in the control panel where it will bog down when you get into the thousands of entries range.  We're addressing that for the upcoming Craft 2.2 release, so it shouldn't be a problem for long.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-08T17:41:49.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1733" PostTypeId="1" CreationDate="2014-08-08T18:00:47.750" Score="9" ViewCount="1382" Body="&lt;p&gt;Is it possible to build something like this with a structure and the {% nav %} tag?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;       &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;         &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;Dropdown&amp;lt;/a&amp;gt;&#xA;         &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;           &amp;lt;li&amp;gt;&#xA;               &amp;lt;div class=&quot;yamm-content&quot;&amp;gt;&#xA;                  &amp;lt;div class=&quot;row&quot;&amp;gt; &#xA;                    ...&#xA;           &amp;lt;/li&amp;gt;&#xA;         &amp;lt;/ul&amp;gt;&#xA;       &amp;lt;/li&amp;gt;&#xA;     &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is my code for now:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pagina') %}&#xA;   &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;      {% nav entry in entries %}&#xA;         &amp;lt;li {{ activeClass(entry.slug) }} {% if entry.hasDescendants() %}class=&quot;dropdown yamm-fw&quot;{% endif %}&amp;gt;     &#xA;            &amp;lt;a href=&quot;#&quot; {% if entry.hasDescendants() %}dropdown-toggle{% endif %}&quot; {% if entry.hasDescendants() %}data-toggle=&quot;dropdown&quot;{% endif %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% ifchildren %}&#xA;               &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;                  {% children %}&#xA;               &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;         &amp;lt;/li&amp;gt;&#xA;      {% endnav %}&#xA;   &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem is, i need custom html inside the children&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-08-08T18:11:50.027" LastActivityDate="2020-04-07T20:33:28.687" Title="Custom or complex nav tag" Tags="&lt;navigation&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1734" PostTypeId="2" ParentId="1733" CreationDate="2014-08-08T18:26:39.323" Score="6" Body="&lt;p&gt;For more control over nav output I like to use a recursive macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursive_nav(entries, depth) %}&#xA;{% import _self as self %}&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;      &amp;lt;li&amp;gt;&#xA;        {{ entry }}&#xA;        {% if entry.hasDescendents() %}&#xA;          {{ self.recursive_nav(entry.children, depth+1) }}&#xA;        {% endif %}&#xA;      &amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endmacro %}&#xA;&#xA;{% set entries = craft.entries.section('pagina') %}&#xA;{{ recursive_nav(entries, 1) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can test &lt;code&gt;depth&lt;/code&gt; in the macro, and customize your output accordingly.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-08T18:26:39.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1735" PostTypeId="2" ParentId="1733" CreationDate="2014-08-08T18:27:21.673" Score="9" Body="&lt;p&gt;You'll want to make use of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#level&quot;&gt;&lt;code&gt;level&lt;/code&gt;&lt;/a&gt; property of your entry...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == 1 %}&#xA;    &amp;lt;!-- Top Level Links --&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;!-- Child Links --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-08T18:27:21.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1736" PostTypeId="1" CreationDate="2014-08-08T21:31:21.900" Score="3" ViewCount="1210" Body="&lt;p&gt;I'm running craft locally using MAMP and I'm trying to move assets into a subfolder when unploaded into an image field in my gallery section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set the path to subfolder so it uses the slug. When I put {slug} into the field settings nothing happens when I upload the images and save the entry, it just pulls them all into the top level folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im not sure if its something in the local file permissions or something but I can bring the images in fine and transforms work okay ie. they create folders and pop the images in fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated&lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-08-09T10:59:41.847" Title="Using { slug } to create subfolders won't work" Tags="&lt;assets&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1737" PostTypeId="1" AcceptedAnswerId="1740" CreationDate="2014-08-08T22:35:57.993" Score="2" ViewCount="1157" Body="&lt;p&gt;Here is how I am filtering entries by a specific month: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filterId = &quot;July&quot; %}&#xA;{% set allEntries = craft.entries.section('messages') %}&#xA;{% set filteredEntries = [] %}&#xA;&#xA;{% for msg in allEntries %}&#xA;&#xA;  {% if msg.messageDate | date('F') == filterId | date('F') %}&#xA;    {% set filteredEntries = filteredEntries | merge([msg]) %}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set messageList = filteredEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I paginate messageList? Do I need to filter by month a different way for pagination to work?&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="57" LastEditDate="2014-08-09T03:02:17.210" LastActivityDate="2014-08-09T03:16:10.040" Title="How do I filter entries by month using custom Date/Time field and paginate them?" Tags="&lt;entries&gt;&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1738" PostTypeId="1" CreationDate="2014-08-09T01:32:52.257" Score="5" ViewCount="728" Body="&lt;p&gt;I am working on a plugin that is requiring several DB tables, some of which are relational pivot tables. This is more of a general how-to, but also best practice question on managing those relationships. I can post code examples if requested, but I'm more curious if A) I'm missing anything withing Craft and/or Yii or B) if there are already ways to do what I'm asking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, Yii does have a way to automatically manage related records, in either a HAS_MANY or MANY_MANY relationship. Meaning, you need to manually save them and also manually how they are updated or deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a basic example of the HAS_MANY relationship:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Table A (HAS_MANY Table B records)&#xA;----------&#xA;id (PK)&#xA;attributes&#xA;&#xA;Table B&#xA;----------&#xA;id (PK)&#xA;attributes&#xA;&#xA;Table C (pivot)&#xA;----------------&#xA;id (PK)&#xA;aId (FK)&#xA;bId (FK)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have all of the models and records setup (I think) correctly. If I understand Yii correctly, when saving Table A records and relating Table B records via the pivot Table C, this has to be done via separate calls to &lt;code&gt;TableCRecord-&amp;gt;save()&lt;/code&gt;. This seems fine, but the question is, is there a way or best practice to handle updating and deleting these relations? And, is there a better way design-wise to handle this either with functionality within Craft or Yii?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or advice is greatly appreciated. If you need more info, I will be happy to provide whatever is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;Michael&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2014-08-09T03:01:45.780" Title="Plugins: Managing Related Records" Tags="&lt;database&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1739" PostTypeId="2" ParentId="1738" CreationDate="2014-08-09T03:01:45.780" Score="2" Body="&lt;p&gt;You can see an example of how we're doing this exact scenario in Craft by looking in the database at the &lt;code&gt;craft_users&lt;/code&gt;, &lt;code&gt;craft_usergroups&lt;/code&gt; and the join table for the two, &lt;code&gt;craft_usergroups_users&lt;/code&gt; as well as their related record classes in &lt;code&gt;craft/app/records&lt;/code&gt;, &lt;code&gt;UserRecord&lt;/code&gt;, &lt;code&gt;UserGroupRecord&lt;/code&gt; and &lt;code&gt;UserGroup_UserRecord&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;UserRecord&lt;/code&gt; defines its relation to &lt;code&gt;UserGroupRecord&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$relations['groups']  = array(static::MANY_MANY, 'UserGroupRecord', 'usergroups_users(userId, groupId)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, &quot;I'm related to UserGroups, through the usergroups_users table using the columns userId and groupId&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, if you're sticking purely with ActiveRecord, you don't have to worry about manually updating the &lt;code&gt;usergropus_users&lt;/code&gt; table... Craft/Yii/ActiveRecord will do it for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-09T03:01:45.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1740" PostTypeId="2" ParentId="1737" CreationDate="2014-08-09T03:16:10.040" Score="3" Body="&lt;p&gt;You won't be able to paginate messageList, because that's just an array... According to the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;official documentation on the &lt;code&gt;{% paginate %}&lt;/code&gt; tag&lt;/a&gt;, only an &lt;strong&gt;ElementCriteriaModel&lt;/strong&gt; can be paginated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see how to create an ElementCriteriaModel which has already been filtered by month, check out &lt;a href=&quot;https://craftcms.stackexchange.com/a/447/45&quot;&gt;Solution #2 in this thread...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll end up with code that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth  = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;&#xA;{% set thisMonthsEntries = craft.entries.section('messages').messageDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{% paginate thisMonthsEntries as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;        {# ... whatever your code does... #}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-08-09T03:16:10.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1741" PostTypeId="2" ParentId="1736" CreationDate="2014-08-09T10:59:41.847" Score="2" Body="&lt;p&gt;Got the problem solved, I had wanted to have the option of selecting photos from another folder so in the field settings I had Default Upload Location with the {slug} in there. When I switched it to &quot;restrict to single folder&quot; and set the {slug} then it is all functioning as expected. I don't think it would make sense selecting a photo from another folder in this field as the asset wouldn't be able to move when entry is saved. Hope this makes sense. I just have the same issue as the other post now where I don't see the caption field until the entry is saved. &lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-08-09T10:59:41.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1742" PostTypeId="1" AcceptedAnswerId="1817" CreationDate="2014-08-09T11:53:34.507" Score="3" ViewCount="1618" Body="&lt;p&gt;I try to compose an entry URL for artists pages with first name and last name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;artists/{slug} = artists/{{ entry.title }}&#xA;{slug} = {{ entry.title }} = Artist Last Name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to add at the end of the URL (Plain Text field):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.artistFirstName }} = Artist First Name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I try to get, but which is not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;artists/{slug}-{{ entry.artistFirstName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible? how? And how can I add a conditional to check if &lt;em&gt;entry.artistFirstName&lt;/em&gt; is defined?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2014-08-09T12:44:27.467" LastActivityDate="2014-08-12T21:27:29.103" Title="Is it possible to add an entry value to the entry URL Format?" Tags="&lt;url&gt;&lt;slug&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1743" PostTypeId="1" AcceptedAnswerId="1744" CreationDate="2014-08-09T12:19:39.773" Score="2" ViewCount="266" Body="&lt;p&gt;I'm trying to build a page similar to the index page of buildwithcraft.com. There you have a page with (visual) sections (&quot;A new kind of flexible&quot;, &quot;Ready where you are&quot; and so on). Each one has different backgrounds and maybe different layouts as well. Therefore you need a different set of input fields for every such section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to set up a (craft) section that allows you to edit pages like that?&lt;/p&gt;&#xA;" OwnerUserId="520" LastActivityDate="2017-10-26T10:30:32.117" Title="How do I set up a section for pages with very flexible content?" Tags="&lt;sections&gt;&lt;best-practice&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1744" PostTypeId="2" ParentId="1743" CreationDate="2014-08-09T18:45:46.550" Score="3" Body="&lt;p&gt;I would use a &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix field&lt;/a&gt; with multiple types.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:25.863" LastActivityDate="2017-10-26T09:27:25.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1745" PostTypeId="1" AcceptedAnswerId="1747" CreationDate="2014-08-09T21:30:32.507" Score="4" ViewCount="905" Body="&lt;p&gt;I have a type of content that i use on the homepage of a site I am building, the code is shown here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for point in entry.keyPoints %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;div class=&quot;a-ico&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;fa fa-{{ point.icon }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;a-info&quot;&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ point.heading }}&amp;lt;/h4&amp;gt;&#xA;                {{ point.text }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does exactly what i want it to do. It opens a UL and then loops through the different items which are LI's and output accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use this same type of content on inner pages however as a matrix block TYPE rather than being the only type of content like on the homepage in the above example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem then is that the FOR loop starts before i even know if this is the type of content i am dealing with so I can't appropriately wrap this type in a UL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can solve this by checking if it is the FIRST of TYPE and LAST of TYPE and outputting the opening and closing UL tags that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then run into another problem that the first and last of this type are not necessarily adjacent to each other. If that is the case then all the other content TYPEs in the matrix between the FIRST and LAST of this TYPE will be inside of the UL as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question then is how can i determine if the other matrix blocks that are immediately adjacent to this TYPE are of the same TYPE and if they are don't close the UL and if they are NOT then close the UL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code to determine what type is is just a simple FOR loop and then inside it a series of conditionals checking the TYPE and then outputting the appropriate content accordingly.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2014-08-09T23:13:26.030" Title="Identify immediate siblings block type in matrix" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1746" PostTypeId="2" ParentId="1745" CreationDate="2014-08-09T23:00:43.247" Score="7" Body="&lt;p&gt;You can do that by using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel#next&quot;&gt;&lt;code&gt;next&lt;/code&gt;&lt;/a&gt; parameter...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {% if block.next %}&#xA;        &amp;lt;p&amp;gt;Next block type is: {{ block.next.type }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's important to check &lt;code&gt;{% if block.next %}&lt;/code&gt;, because the last block won't have a &quot;next&quot;. If you were to try to call &lt;code&gt;block.next.type&lt;/code&gt; where there is no &quot;next&quot;, an error will be thrown.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-08-09T23:10:40.997" LastActivityDate="2014-08-09T23:10:40.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1747" PostTypeId="2" ParentId="1745" CreationDate="2014-08-09T23:05:53.643" Score="8" Body="&lt;p&gt;Fun question! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel#methods&quot;&gt;Methods&lt;/a&gt; on the MatrixBlockModel documentation page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for point in entry.keyPoints %}&#xA;&#xA;    {# if this is the &quot;typeToWrap&quot; block type #}&#xA;    {% if point.type == 'typeToWrap' %}&#xA;&#xA;        {# if there is a previous point to check #}&#xA;        {% if point.getPrev() %}&#xA;&#xA;            {# if the previous point wasn't the &quot;typeToWrap&quot; type start a ul #}&#xA;            {% if point.getPrev().type != 'typeToWrap' %}&#xA;                &amp;lt;ul&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {# if there isn't a previous point start a ul #}&#xA;        {% else %}&#xA;            &amp;lt;ul&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;    {# output point #}&#xA;&#xA;    {# if this is the &quot;typeToWrap&quot; block type #}&#xA;    {% if point.type == 'typeToWrap' %}&#xA;&#xA;        {# if there is a next point to check #}&#xA;        {% if point.getNext() %}&#xA;&#xA;            {# if the next point isn't the &quot;typeToWrap&quot; type end a ul #}&#xA;            {% if point.getNext().type != 'typeToWrap' %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {# if there isn't another point end a ul #}&#xA;        {% else %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2014-08-09T23:13:26.030" LastActivityDate="2014-08-09T23:13:26.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1748" PostTypeId="1" AcceptedAnswerId="1749" CreationDate="2014-08-09T23:48:39.743" Score="2" ViewCount="516" Body="&lt;p&gt;right click on source &gt; add new subfolder &gt; dialog box asks for subfolder name &gt; submit = &quot;There was an error while creating the folder.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas here?&lt;/p&gt;&#xA;" OwnerUserId="652" LastActivityDate="2017-03-09T06:32:34.617" Title="Creating new assets subfolder throws error" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1749" PostTypeId="2" ParentId="1748" CreationDate="2014-08-09T23:52:55.207" Score="1" Body="&lt;p&gt;Two possible suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are you positive that the &lt;strong&gt;File System Path&lt;/strong&gt; of your assets source is correct?&lt;/li&gt;&#xA;&lt;li&gt;Does your assets source folder have the correct &lt;strong&gt;permissions&lt;/strong&gt; which would allow Craft to create a new subfolder?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-09T23:52:55.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1750" PostTypeId="1" CreationDate="2014-08-10T02:17:36.990" Score="1" ViewCount="468" Body="&lt;p&gt;I'm very curious to know what are the most popular hosting services chosen by CratCMS developers. Perhaps I'm missing out in some gems!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know what you love about your favorite hosting service and at least one thing you dislike about it.&lt;/p&gt;&#xA;" OwnerUserId="566" LastActivityDate="2014-08-10T04:48:00.363" Title="Where do you all host your CratCMS sites?" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-08-10T05:44:03.723" ContentLicense="CC BY-SA 3.0" />
  <row Id="1751" PostTypeId="2" ParentId="1750" CreationDate="2014-08-10T04:48:00.363" Score="1" Body="&lt;p&gt;Anything that you can config and auto-deploy through using &lt;a href=&quot;https://forge.laravel.com/&quot; rel=&quot;nofollow&quot;&gt;https://forge.laravel.com/&lt;/a&gt; (Digital Ocean, Rackspace, Amazon).&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-10T04:48:00.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1752" PostTypeId="2" ParentId="1722" CreationDate="2014-08-10T07:54:26.207" Score="3" Body="&lt;p&gt;Please take a look at this post on how to build a navigation (like NavEE, Structure, Taxonomy) using a Craft Structure. It also has some code-example for your template: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1473/would-you-use-a-structure-as-navigation-over-multiple-sections-channel-entries/1513?noredirect=1#comment2416_1513&quot;&gt;Would you use a Structure as navigation over multiple sections (channel entries, indexes and singles)?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-08-10T07:54:26.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1753" PostTypeId="1" CreationDate="2014-08-10T09:00:02.113" Score="3" ViewCount="422" Body="&lt;p&gt;I have a custom Element Type to which I can add several custom fields.  I can create a front end form with most of those custom fields and the submitted data saves just fine.  However, I'm getting some odd behavior with the Assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can save Assets fields from the front end of Craft to Craft sections just fine.  And I can edit one of the Entries for my custom Element types on the backend and upload an Asset just fine there as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I submit an Asset from the front-end for a new Entry with this custom Element type, I don't get the right behavior. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does happen (as far as I can tell):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The asset uploads and appears in the target upload folder&lt;/li&gt;&#xA;&lt;li&gt;A new row in the craft_relations table is created correctly&#xA;identifying the asset and the element that it is related to.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What doesn't happen:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The uploaded asset doesn't appear in the Asset index.  Even if I reindex assets for this particular folder, it never shows up in the Assets file manager.&lt;/li&gt;&#xA;&lt;li&gt;When I visit the individual entry page in the CP, the Asset never appears. (But if I upload the asset directly from this CP page, the asset then does appear on this same page)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to know where to look to troubleshoot this.  What would cause an Asset not to display properly when it's uploaded from the front end but to work fine when it's uploaded from the back end?  Could I be missing some data on the front end submission?  My form uses &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; and the asset field is as simple as it gets (and I've tried several variations (&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;fields[uploadfield]&quot; &amp;gt;&lt;/code&gt;)&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-01-28T07:52:08.113" Title="Front End Asset Upload to Custom Element Type not working" Tags="&lt;assets&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1754" PostTypeId="1" AcceptedAnswerId="1759" CreationDate="2014-08-10T10:32:16.337" Score="3" ViewCount="766" Body="&lt;p&gt;What's the best solution for having a 'gallery' block inside of a Matrix? By 'gallery block' I mean an ability to have multiple images, with captions, alt, and link, presented as a gallery on the front-end, but as part of a parent Matrix (the user needs to control the location of the gallery within the page content, so the page content is a Matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I really need is a Matrix within a Matrix, but that's not possible with Craft at the moment. I'd thought using a Table type inside the Matrix might work, but Craft doesn't offer Asset as a type for use inside a Table (makes sense, this would be a hacky use of 'table').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another work-around might be to just have 'singular image' blocks and have the Template code notice when multiple Image blocks occur as siblings, and convert those into gallery mark-up - but I've no idea how to code that, if it's even possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have better solutions?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-08-10T19:29:33.340" Title="Gallery block inside a Matrix" Tags="&lt;matrix&gt;&lt;gallery&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1755" PostTypeId="2" ParentId="1754" CreationDate="2014-08-10T14:04:04.050" Score="6" Body="&lt;p&gt;I guess it depends on what information each Asset needs to contain. As you mentioned, a Matrix within a Matrix is not possible, so you will need a different method to attach additional information to each Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method that may work is to create &lt;a href=&quot;http://buildwithcraft.com/docs/assets#asset-meta-fields&quot;&gt;Asset Meta Fields&lt;/a&gt; for Assets. This way, you can define additional things on each image on the Asset level. For example, you could have custom fields for things like title, description, copyright, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Asset Meta Fields in place, you could define one &quot;Gallery&quot; Matrix block that allows for multiple files to be selected. The order could be controlled by drag/dropping each of the selected Assets.&lt;/p&gt;&#xA;" OwnerUserId="78" LastActivityDate="2014-08-10T14:04:04.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1756" PostTypeId="1" AcceptedAnswerId="1757" CreationDate="2014-08-10T15:36:31.183" Score="2" ViewCount="264" Body="&lt;p&gt;I have this piece of code which orders my entries by month, which is working great. I only have two issues which I can't work out. How would I display the year of the month beside the month title eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;{{ month }} &amp;gt; {{ year }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As the list could run over a number of years it would be good to distinguish this. The next part is I can't seem to convert the month from a number ie: 8 to the word ie. &quot;august&quot;. When I filter it, it just returns &quot;Jan&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('featureArticles').find() %}&#xA;{% set allEntriesByMonth = allEntries|group('postDate.month') %}&#xA;&#xA;{% for month, entriesInMonth in allEntriesByMonth %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ month }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entriesInMonth %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="650" LastEditorUserId="57" LastEditDate="2014-08-10T16:03:56.067" LastActivityDate="2014-08-10T16:19:56.177" Title="Outputting Year of Entry Group alongside Month" Tags="&lt;entries&gt;&lt;date&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1757" PostTypeId="2" ParentId="1756" CreationDate="2014-08-10T16:19:56.177" Score="3" Body="&lt;p&gt;You're close!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got an example of how to do this here: &lt;a href=&quot;http://buildwithcraft.com/help/entry-archive#grouping-by-year-and-then-month&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/entry-archive#grouping-by-year-and-then-month&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to group by year first, then by month.  Using the 'F' token is how to &lt;a href=&quot;http://us2.php.net/manual/en/function.date.php&quot; rel=&quot;nofollow&quot;&gt;tell PHP&lt;/a&gt; to display the name of the month.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-10T16:19:56.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1758" PostTypeId="1" AcceptedAnswerId="1763" CreationDate="2014-08-10T18:55:53.180" Score="12" ViewCount="7128" Body="&lt;p&gt;I have done a &amp;quot;Is featured&amp;quot; switch on articles which works great. I can list the latest 4 featured articles but after that I would like to list the others (Of course they may be featured too). What is the best way to exclude an array of elements when getting elements? Or is there a better solution?&lt;/p&gt;&#xA;&lt;h2&gt;Update 1&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set allArticles = craft.entries.section('articles').find() %}&#xA;{% set featuredArticles = craft.entries.section('articles').featured(1).limit(4).find() %}&#xA;{% set notFeaturedArticles = allArticles|without(featuredArticles) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the code and the notFeaturedArticles returns with the same entries as the allArticles.&lt;/p&gt;&#xA;&lt;h2&gt;Update 2&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredArticleIds = craft.entries.section('articles').featured(1).limit(4).ids() %}&#xA;{% set featuredArticlIdsString = featuredArticleIds | join(', ') %}&#xA;{% set notFeaturedArticles = craft.entries.section('articles').id('not '~featuredArticlIdsString) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case only the first entry is excluded from the not featured articles.&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastEditorUserId="-1" LastEditorDisplayName="user516" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2020-11-12T10:51:33.987" Title="What is the best way to exclude an array of entries?" Tags="&lt;entries&gt;&lt;array&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1759" PostTypeId="2" ParentId="1754" CreationDate="2014-08-10T19:16:45.103" Score="3" Body="&lt;p&gt;Another option is to create a &lt;code&gt;galleryImage&lt;/code&gt; channel (with &lt;em&gt;Entries in this section have their own URLs&lt;/em&gt; &lt;strong&gt;not&lt;/strong&gt; checked), and then make your matrix block be a collection of entries in &lt;code&gt;galleryImage&lt;/code&gt; added via an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries&lt;/a&gt; field. Each &lt;code&gt;galleryImage&lt;/code&gt; would have the image, caption, etc.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="50" LastEditDate="2014-08-10T19:29:33.340" LastActivityDate="2014-08-10T19:29:33.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1760" PostTypeId="2" ParentId="1758" CreationDate="2014-08-10T19:41:18.633" Score="3" Body="&lt;p&gt;I can think of two ways to accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fetch all entries and all featured entries. Then remove the latter from the first: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set all          = craft.entries.section('news').find() %}&#xA;{% set featured     = craft.entries.section('news').featured(1).find() %}&#xA;{% set not_featured = all|without(featured) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Pro:&lt;/em&gt; You can set the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot; rel=&quot;nofollow&quot;&gt;limit&lt;/a&gt; for each type individually.&lt;br&gt;&#xA;&lt;em&gt;Cons:&lt;/em&gt; You need two queries (performance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;br&gt;&#xA;I talked with Brad from P&amp;amp;T and he explained that my example is not working, because after fetching, &lt;code&gt;all&lt;/code&gt; and &lt;code&gt;featured&lt;/code&gt; become objects not arrays.&#xA;However it might become possible at some point in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now you would have to do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allIds = craft.entries.section('news').ids() %}&#xA;{% set featuredIds = craft.entries.section('news').light('1').ids() %}&#xA;{% set notFeaturedIds = allIds|without(featuredIds) %}&#xA;&#xA;{% set entries = craft.entries.id(notFeaturedIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sorting:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default all entries are sorted by date. But you could just as well &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;order&lt;/a&gt; by &quot;featured&quot; first and then by &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#postDate&quot; rel=&quot;nofollow&quot;&gt;date&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set all = craft.entries.section('news').order('featured desc, postDate desc').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Pros:&lt;/em&gt; One query.&lt;br&gt;&#xA;&lt;em&gt;Cons:&lt;/em&gt; You can only set one &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot; rel=&quot;nofollow&quot;&gt;limit&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-08-11T22:03:46.473" LastActivityDate="2014-08-11T22:03:46.473" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1761" PostTypeId="1" AcceptedAnswerId="1762" CreationDate="2014-08-10T22:41:53.407" Score="2" ViewCount="338" Body="&lt;p&gt;I found this code in the &lt;a href=&quot;http://buildwithcraft.com/help/locale-data-from-templates&quot; rel=&quot;nofollow&quot;&gt;Craft documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set localeData = craft.i18n.getLocaleData() %}&#xA;{% for month in localeData.getMonthNames() %}&#xA;    {{ month }}&#xA;{% endfor %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I need is the whole list of countries (from Ascension Island to Zimbabwe).&#xA;I tried &lt;code&gt;.getTerritories()&lt;/code&gt; but it doesn't exist:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set localeData = craft.i18n.getLocaleData() %}&#xA;{% for country in localeData.getTerritories() %}&#xA;    {{ country }}&#xA;{% endfor %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any solution?&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2014-08-11T18:40:44.757" LastActivityDate="2014-08-11T18:40:44.757" Title="How can I output the territories array with craft.i18n?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1762" PostTypeId="2" ParentId="1761" CreationDate="2014-08-10T23:15:59.643" Score="2" Body="&lt;p&gt;Looks like Yii doesn't expose a way to grab all of the territories for a given locale by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just added it to Craft 2.2, though.  So when that comes out, you'll be able to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$localeData = craft()-&amp;gt;i18n-&amp;gt;getLocaleData('en_us');&#xA;$allTerritories = $localeData-&amp;gt;getAllTerritories();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-11T17:39:07.500" LastActivityDate="2014-08-11T17:39:07.500" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1763" PostTypeId="2" ParentId="1758" CreationDate="2014-08-10T23:31:15.783" Score="28" Body="&lt;p&gt;Craft documentation describes &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot;&gt;how to exclude entries with a given value&lt;/a&gt;. In this case, we want a string that looks like: &lt;code&gt;'and, not id1, not id2, not id3, not id4'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we need a string that is all of the featured article ids separated by &lt;code&gt;, not&lt;/code&gt;. First, get them as an array using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#ids&quot;&gt;ids()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredArticleIds = craft.entries.section('articles').featured(1).limit(4).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then convert that array to a string, using &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot;&gt;twig's join filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredArticleIdsString = featuredArticleIds | join(', not ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, fetch all the articles, but &lt;em&gt;not&lt;/em&gt; the featured ones:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notFeaturedArticles = craft.entries.section('articles').id('and, not '~featuredArticleIdsString) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[thanks to carlcs for crucial fix]&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-08-11T13:29:50.067" LastActivityDate="2014-08-11T13:29:50.067" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1765" PostTypeId="1" CreationDate="2014-08-11T05:59:31.700" Score="1" ViewCount="406" Body="&lt;p&gt;Having an issue with assets not reindexing from the Update Asset Indexes option.  If I add new folders to the file system they do not appear after I run the Update Asset Indexes, if I upload them manually in the backend then they do appear as normal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I diagnose this?  Running Apache as my logged in user so it's does not seem to be a group / permissions related issue. &lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-08-11T06:23:05.620" Title="What would prevent my assets from reindexing on a local MAMP install" Tags="&lt;assets&gt;&lt;reindex&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1766" PostTypeId="2" ParentId="1765" CreationDate="2014-08-11T06:23:05.620" Score="1" Body="&lt;p&gt;If the Update Asset Indexes fails on a MAMP install, double check to make sure ALL assets source paths are correct and exist on the file system.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had defined a asset source to a folder which I had planned on using but had not yet created on the file system, and this caused the Update Asset Indexes to fail w/o any warning messages, save for a JS error in the console.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2014-08-11T06:23:05.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1767" PostTypeId="1" CreationDate="2014-08-11T06:30:03.123" Score="2" ViewCount="86" Body="&lt;p&gt;Say that I have a folder structure like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/images&#xA;  /products&#xA;  /employee-photos&#xA;  /user-photos&#xA;  /advertising&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I could define the single asset source of /images while only allowing uploads to its children?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to do this so that I could simply add new children w/o having to define them as assets sources separately. &lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-01-09T00:44:26.173" Title="Is there a way to prevent uploading assets into a parent level folder?" Tags="&lt;assets&gt;&lt;children&gt;&lt;upload&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1768" PostTypeId="2" ParentId="1711" CreationDate="2014-08-11T07:13:24.843" Score="1" Body="&lt;p&gt;I finally found a way to do that using the &quot;&lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot; rel=&quot;nofollow noreferrer&quot;&gt;TwigPCRE&lt;/a&gt;&quot; Craft plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|preg_replace('/&amp;amp;(?!(?:[a-z]+|#x?\d+);)/', '&amp;amp;amp;')|raw&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will replace all unescaped &amp;amp; characters which are not part of something else.&lt;/p&gt;&#xA;" OwnerUserId="578" LastEditorUserId="57" LastEditDate="2017-05-24T07:37:48.847" LastActivityDate="2017-05-24T07:37:48.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1769" PostTypeId="1" AcceptedAnswerId="1789" CreationDate="2014-08-11T07:28:26.837" Score="3" ViewCount="3122" Body="&lt;p&gt;I'm trying to cover the plugin controller with unit tests, but when I try to run phpunit this error shows up:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Warning: Cannot modify header information - headers already sent by (output started at /craft/app/vendor/phpunit/phpunit/src/Util/Printer.php:172 ) in /craft/craft/app/helpers/JsonHelper.php on line 25&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The same error indicates also line 26 and 27 of JsonHelper.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did someone already had this issue? Can somebody help me on this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="653" LastEditorUserId="45" LastEditDate="2014-08-11T09:45:36.597" LastActivityDate="2014-08-27T10:00:41.810" Title="PHPUnit - Warning: &quot;Header already sent&quot;" Tags="&lt;plugin-development&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1770" PostTypeId="2" ParentId="1726" CreationDate="2014-08-11T07:36:29.873" Score="0" Body="&lt;p&gt;Fresh week, fresh look at things. I failed to notice that the regex was set to \d and my campaignmonitor &quot;id&quot; contained alphabetic characters.&lt;br&gt;&#xA;Changing it to \w fixed it.&lt;/p&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-08-11T07:36:29.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1771" PostTypeId="1" AcceptedAnswerId="1772" CreationDate="2014-08-11T08:25:16.410" Score="3" ViewCount="662" Body="&lt;p&gt;In my general.php file I have a siteUrl environment variable declared:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'ontherocks.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'  =&amp;gt; 'http://local.ontherocks.dev/',&#xA;    )      &#xA;),&#xA;&#xA;'dev.livesite.com' =&amp;gt; array(&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'  =&amp;gt; 'http://dev.livesite.com/',&#xA;    )       &#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when calling it on my page to get page url: siteUrl ~ entry.url&#xA;siteUrl is appearing as it is defined in the Craft CMS General Settings SiteUrl.&#xA;Is it possible for the environment variable to take precedence?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-08-11T08:51:13.907" Title="Environment Variable siteURL ignored" Tags="&lt;config&gt;&lt;control-panel&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1772" PostTypeId="2" ParentId="1771" CreationDate="2014-08-11T08:41:45.993" Score="7" Body="&lt;p&gt;In your Control Panel, go to &lt;strong&gt;Settings &gt; General&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then set your Site URL to &lt;code&gt;{siteUrl}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will parse out the &lt;code&gt;siteUrl&lt;/code&gt; environment variable. For more information, see &lt;a href=&quot;https://craftcms.stackexchange.com/a/913/45&quot;&gt;this thread...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-11T08:51:13.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1773" PostTypeId="1" AcceptedAnswerId="1775" CreationDate="2014-08-11T10:43:18.000" Score="22" ViewCount="10730" Body="&lt;p&gt;Is there a way to check what environment craft is running on - ie, dev or not dev - via the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%if env is 'dev'%}&#xA;    hello dev&#xA;{% else %}&#xA;   hello world&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="467" LastEditorUserId="250" LastEditDate="2014-10-03T16:05:34.160" LastActivityDate="2021-03-25T19:06:26.747" Title="Access environment information in template" Tags="&lt;templating&gt;&lt;multi-environment&gt;&lt;devmode&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1774" PostTypeId="1" CreationDate="2014-08-11T10:52:29.853" Score="8" ViewCount="2375" Body="&lt;p&gt;In a registration form with public signup possible, how do you set the user group for a particular form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a stop-gap I am attempting to use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event)&#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        if( $user-&amp;gt;leader == true )&#xA;        {&#xA;            craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, array(2));&#xA;        }   &#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a field (lightswitch) called leader to enable me to check the value after saving the user and adding them to the group. The above code is not working though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;var_dump($user-&amp;gt;leader)&lt;/code&gt; I can see the true and false being returned on user, and also the &lt;code&gt;$user-&amp;gt;id&lt;/code&gt; is returning the user's id, but the group (2) is not being assigned. Think I am missing something obvious. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="4433" LastEditDate="2018-10-03T16:33:01.447" LastActivityDate="2020-09-09T16:50:26.370" Title="How do you set a user's group on a registration form?" Tags="&lt;craft3&gt;&lt;registration&gt;&lt;user-groups&gt;&lt;frontend-form&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="1775" PostTypeId="2" ParentId="1773" CreationDate="2014-08-11T11:07:12.467" Score="25" Body="&lt;p&gt;When developing locally on Craft you would most likely have &lt;code&gt;devMode =&amp;gt; true&lt;/code&gt; set in your config file and set to false for your production config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;app/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA; 'mydevdomain.dev' =&amp;gt; array(&#xA;   'devMode' =&amp;gt; true&#xA; ),&#xA; 'mylivedomain.com' =&amp;gt; array(&#xA;   'devMode' =&amp;gt; false&#xA; )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you could test whether craft is in dev mode and respond to that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.devMode %}&#xA;  You are in dev mode&#xA;{% else %}&#xA;  You are not in devmode&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2014-08-12T08:00:02.437" LastActivityDate="2014-08-12T08:00:02.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1776" PostTypeId="1" AcceptedAnswerId="1782" CreationDate="2014-08-11T11:13:11.927" Score="7" ViewCount="895" Body="&lt;p&gt;Within a channel I have two kinds of possible article types, which I separate with the entry type feature. For the entry URL format I want to include the type, but only for &lt;em&gt;one&lt;/em&gt; of the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;channel{% if type.handle == 'xyz' %}/{type}{% endif %}/{slug}&lt;/code&gt; but without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tested &quot;if 2 &gt; 1&quot; and it &lt;em&gt;did&lt;/em&gt; output the type, so I guess the structure of the if-statement is correct. Does anyone have an idea how I could make this work?&lt;/p&gt;&#xA;" OwnerUserId="654" LastActivityDate="2014-08-11T14:26:02.693" Title="Using an IF-statement to define the Entry URL Format" Tags="&lt;url&gt;&lt;conditional&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1777" PostTypeId="1" AcceptedAnswerId="1784" CreationDate="2014-08-11T11:29:29.033" Score="2" ViewCount="2418" Body="&lt;p&gt;I have 2 bits of code that should be about identical with the exception of one being in a Matrix and one not. The bit that is not looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for point in entry.keyPoints %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;div class=&quot;a-ico&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;fa fa-{{ point.icon }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;a-info&quot;&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ point.heading }}&amp;lt;/h4&amp;gt;&#xA;                {{ point.text }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works exactly as intended. and uses the &quot;ICON&quot; 3rd-party field type which essentially is a dropdown that allows me to pick which icon I want to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code that i'm having trouble with is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.articleBody %}&#xA;    {% if block.type == &quot;text&quot; %}&#xA;         Some stuff here&#xA;    {% elseif block.type ==&quot;iconSection&quot; %}&#xA;        {% if block.getPrev() %}&#xA;            {% if block.getPrev().type != &quot;iconSection&quot; %}&#xA;                &amp;lt;ul&amp;gt;&#xA;            {% endif %}&#xA;        {% else %}&#xA;            &amp;lt;ul&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;div class=&quot;a-ico&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;fa fa-{{ block.icon }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;a-info&quot;&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ block.heading }}&amp;lt;/h4&amp;gt;&#xA;                {{ block.text }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% if block.getNext() %}&#xA;            {% if block.getNext().type != &quot;iconSection&quot; %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;        {% else %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% elseif block.type ==&quot;video&quot; %}&#xA;        some stuff here&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is saying Template Error (Array to String Conversion) with this bit highlighted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;i class=&quot;fa fa-{{ block.icon }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see the code is almost identical except it is BLOCK instead of POINT, and the block one is in a matrix where as the point item is not. What might be causing this and how might I resolve it?&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="45" LastEditDate="2014-08-11T16:25:04.560" LastActivityDate="2014-08-11T16:25:04.560" Title="Array to string conversion Template Error" Tags="&lt;matrix&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1778" PostTypeId="1" AcceptedAnswerId="1792" CreationDate="2014-08-11T13:05:13.070" Score="2" ViewCount="196" Body="&lt;p&gt;I am looking for some help with persistent form data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user submits a front-end entry form for some Entries data, but there are errors with the submission, they are currently redirected to the entry page and successfully shown the errors (eg field is required). Is there a method or syntax where this form can also retrieve the posted form data so the user is not required to fill in the whole form again?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any help from the community!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dan&lt;/p&gt;&#xA;" OwnerUserId="214" LastActivityDate="2014-08-11T18:14:30.883" Title="Persistent Form Data" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1779" PostTypeId="1" AcceptedAnswerId="1781" CreationDate="2014-08-11T13:40:03.203" Score="4" ViewCount="1273" Body="&lt;p&gt;I'm stuck. For a new site I need to display numbers before the main h1 title and in the submenu's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 Home&lt;/li&gt;&#xA;&lt;li&gt;2 About&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;01 history &lt;/li&gt;&#xA;&lt;li&gt;02 strategy (active page)&lt;/li&gt;&#xA;&lt;li&gt;03 profile&lt;/li&gt;&#xA;&lt;li&gt;etc. etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the active page (strategy) the title needs to be 02 strategy.&#xA;So the number is based on the position inside the parent. If I reorder strategy to the first position, the number needs to be 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://durk.com/example.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;preview http://durk.com/example.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-08-12T06:50:46.640" Title="Display number based on position in structure hierarchy" Tags="&lt;entries&gt;&lt;navigation&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1780" PostTypeId="2" ParentId="1758" CreationDate="2014-08-11T13:40:17.557" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter seems to be a bit picky with parameters. This is what did work in the end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the Entry Models of the most recent feature acticles #}&#xA;{% set featuredArticles = craft.entries.section('articles').featured(1).limit(4) %}&#xA;&#xA;{# Get the Entry Models of all articles without the most recent feature acticles #}&#xA;{% set notFeaturedArticles = craft.entries.section('articles').limit(null)&#xA;    |without(featuredArticles[0].title)&#xA;    |without(featuredArticles[1].title)&#xA;    |without(featuredArticles[2].title)&#xA;    |without(featuredArticles[3].title)&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you get the Entry Models over their IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get IDs of all the articles #}&#xA;{% set allArticlesIds = craft.entries.section('articles').ids() %}&#xA;&#xA;{# Get IDs of the most recent feature acticles #}&#xA;{% set featuredArticlesIds = craft.entries.section('articles').featured(1).limit(4).ids() %}&#xA;&#xA;{# Get IDs of all articles without the most recent feature acticles #}&#xA;{% set notFeaturedArticlesIds = allArticlesIds|without(featuredArticlesIds) %}&#xA;&#xA;{# Get the Entry Models #}&#xA;{% set featuredArticles = craft.entries.section('articles').id(featuredArticlesIds) %}&#xA;{% set notFeaturedArticles = craft.entries.section('articles').id(notFeaturedArticlesIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-11T14:45:39.177" LastActivityDate="2014-08-11T14:45:39.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1781" PostTypeId="2" ParentId="1779" CreationDate="2014-08-11T14:14:36.733" Score="6" Body="&lt;p&gt;What about using CSS for your numbers? (Yes, this answer makes your question sound a bit off-topic, sorry for that, hehe)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mainmenu:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.mainNav {&#xA;  counter-reset: mainNav;&#xA;}&#xA;.mainNav-item {&#xA;  counter-increment: mainNav;&#xA;}&#xA;.mainNav-item::before {&#xA;  content: counter(mainNav) &quot;. &quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Submenu (double digits):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.subNav {&#xA;  counter-reset: subNav;&#xA;}&#xA;.subNav-item {&#xA;  counter-increment: subNav;&#xA;}&#xA;.subNav-item::before {&#xA;  content: counter(subNav, decimal-leading-zero) &quot;. &quot;;&#xA;  color: gold;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Misunderstood that &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; problem at first. I don't think that there's a dedicated function in Craft to get the position in a structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can get the entry position like so. You have to get all the structure entries that are on the same structure level with a new ElementCriteriaModel (→ new DB Queries) and then you do a conditional to find the position of the current entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the IDs of all the sections #}&#xA;{% set currentSectionId = entry.id %}&#xA;{% set allSectionIds = craft.entries.section('myStructure').level(1).ids() %}&#xA;&#xA;{# Define var before loop #}&#xA;{% set sectionNumber = '' %}&#xA;&#xA;{# Loop through all section IDs and find the one that matches the current #}&#xA;{% for key, sectionId in allSectionIds if sectionId == currentSectionId %}&#xA;&#xA;    {# Use array key to calculate the section's position #}&#xA;    {% set sectionNumber = key + 1 %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Save the section's position in a custom data attribute #}&#xA;&amp;lt;h1 data-section-no=&quot;{{ sectionNumber }}&quot;&amp;gt;Test&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use CSS to style your heading:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h1:before {&#xA;  content: attr(data-section-no) &quot;. &quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-11T16:45:11.680" LastActivityDate="2014-08-11T16:45:11.680" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1782" PostTypeId="2" ParentId="1776" CreationDate="2014-08-11T14:26:02.693" Score="8" Body="&lt;p&gt;Alright, I was able to figure it out myself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel{% if object.type == 'xyz' %}/{type}{% endif %}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;produces the desired results. The section for &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#dynamic-entry-titles&quot;&gt;Dynamic Entry Titles&lt;/a&gt; in the docs pointed me into the right direction.&lt;/p&gt;&#xA;" OwnerUserId="654" LastActivityDate="2014-08-11T14:26:02.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1783" PostTypeId="1" CreationDate="2014-08-11T15:20:41.033" Score="1" ViewCount="17" Body="&lt;p&gt;I have a channel with content and I want to only display content from a certain category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I use a slug? Just trying to wrap my head around this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for product in craft.entries.find({section: 'Product', limit:'4',}) %}&#xA;&#xA;    {% for image in product.photo %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl('bottom') }}&quot; /&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;Link to pants!&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ product.title }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ product.price }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ category.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="617" LastActivityDate="2014-08-11T15:20:41.033" Title="How do I omit a page with just a catagory" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2014-08-18T19:27:43.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="1784" PostTypeId="2" ParentId="1777" CreationDate="2014-08-11T16:03:31.037" Score="3" Body="&lt;p&gt;According to the &lt;a href=&quot;https://github.com/fruitstudios/Icons/#usage&quot; rel=&quot;nofollow&quot;&gt;docs for the Icons plugin&lt;/a&gt;, &lt;code&gt;icon&lt;/code&gt; is actually an &lt;strong&gt;object&lt;/strong&gt;. Try this instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;i class=&quot;fa {{ block.icon.class }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In both scenarios, I'd take another look at your rendered HTML... your first example may actually be rendering the word &lt;code&gt;Array&lt;/code&gt; instead of the class name that you are looking for. You can also leave off the leading &lt;code&gt;fa-&lt;/code&gt;, since that will be automatically included in the class name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you have called &lt;code&gt;icon&lt;/code&gt; in both examples, you're simply referring to &lt;em&gt;the field itself&lt;/em&gt;. You actually want to be referring to the &lt;em&gt;values of the field&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To output the HTML you're looking for, either of these two options will work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;{{ block.icon.icon }}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;i class=&quot;fa {{ block.icon.class }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And for your non-matrix example, just replace &lt;code&gt;block&lt;/code&gt; with &lt;code&gt;point&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-08-11T16:19:53.983" LastActivityDate="2014-08-11T16:19:53.983" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1785" PostTypeId="1" AcceptedAnswerId="1793" CreationDate="2014-08-11T16:25:04.040" Score="3" ViewCount="483" Body="&lt;p&gt;I'm using asset transforms in various places to serve appropriately sized images via a Twig macro that I feed an entry and the name of a transform into (the idea is to have the same bit of HTML, but with differently sized images depending on the context). The way I get the image URL is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.mainImage.first().getUrl(transform)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, at the moment if the named transform is not found (ie. if the value of &lt;code&gt;transform&lt;/code&gt; doesn't correspond to the name of an existing transform) I get a Craft error. For my purposes a better failure mode would be to just serve the untransformed, full-size image. I'm wondering if there's a way of checking whether a named transform exists? That way I could just set &lt;code&gt;transform&lt;/code&gt; to &lt;code&gt;null&lt;/code&gt; if it's not found and it should fail gracefully.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2014-08-11T18:37:04.117" Title="How to check whether a named Asset Transform exists?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1786" PostTypeId="2" ParentId="1774" CreationDate="2014-08-11T16:39:30.390" Score="4" Body="&lt;p&gt;&lt;strong&gt;This answer was originally written for Craft 2.&lt;/strong&gt; For a Craft 3 solution, see &lt;a href=&quot;https://craftcms.stackexchange.com/a/27926/45&quot;&gt;Ryan's answer&lt;/a&gt; above.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I literally just worked through this problem last week. Ran into the same issue, so I reached out to P&amp;amp;T.&lt;/p&gt;&#xA;&lt;p&gt;Turns out there is a &amp;quot;catch&amp;quot;... For a new user, the &lt;code&gt;$_POST['groups']&lt;/code&gt; value is passed as an empty array. And because of the order that it's processed, that empty array will actually overwrite what you've set manually.&lt;/p&gt;&#xA;&lt;p&gt;After working through it with Brad, this is the solution that worked for me:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;        // If new user&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;            // If &amp;quot;groups&amp;quot; is in POST&#xA;            if (isset($_POST['groups'])) {&#xA;                // If not an array, it's an empty string&#xA;                if (!is_array($_POST['groups'])) {&#xA;                    // Set it to an array with the user group ID&#xA;                    $_POST['groups'] = array(2);&#xA;                } else {&#xA;                    // Merge in the user group ID with any existing ones.&#xA;                    $_POST['groups'] = array_merge($_POST['groups'], array(2));&#xA;                }&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2020-09-09T16:50:26.370" LastActivityDate="2020-09-09T16:50:26.370" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="1787" PostTypeId="1" AcceptedAnswerId="1788" CreationDate="2014-08-11T16:41:28.563" Score="4" ViewCount="604" Body="&lt;p&gt;Is is possible to assign a category via a frontend Guest Entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fieldHandle&quot; value=&quot;SomeExistingCategorySlug&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that did not work.&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="125" LastEditDate="2014-08-11T17:14:25.413" LastActivityDate="2014-08-13T13:48:49.743" Title="Assign Category via Guest Entry Form" Tags="&lt;categories&gt;&lt;plugins&gt;&lt;guest&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1788" PostTypeId="2" ParentId="1787" CreationDate="2014-08-11T17:41:33.313" Score="4" Body="&lt;p&gt;Simply put, a &lt;a href=&quot;http://buildwithcraft.com/docs/categories-fields&quot; rel=&quot;nofollow&quot;&gt;Categories field&lt;/a&gt; is an array containing category ids, and your form needs to send it that way:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle][]&quot; value=&quot;100&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding brackets to your field-handle &lt;a href=&quot;http://php.net/manual/en/faq.html.php#faq.html.arrays&quot; rel=&quot;nofollow&quot;&gt;submits the value as an array&lt;/a&gt;, and &lt;code&gt;100&lt;/code&gt; is the id of the category.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-08-13T13:48:49.743" LastActivityDate="2014-08-13T13:48:49.743" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1789" PostTypeId="2" ParentId="1769" CreationDate="2014-08-11T17:54:28.657" Score="3" Body="&lt;p&gt;You could try setting PHPUnit's &lt;a href=&quot;http://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.runInSeparateProcess&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;@runInSeparateProcess&lt;/code&gt; flag&lt;/a&gt;, as &lt;a href=&quot;https://stackoverflow.com/questions/9745080/test-php-headers-with-phpunit?rq=1&quot;&gt;discussed here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it sounds as though you're attempting to use PHPUnit for acceptance or integration tests, when it's really designed to be used for unit testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You could mock the &lt;code&gt;JsonHelper::sendJsonHeaders&lt;/code&gt; method, but that may prove tricky;&lt;/li&gt;&#xA;&lt;li&gt;You could use something like &lt;a href=&quot;http://docs.behat.org/en/v2.5/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Behat&lt;/a&gt; for integration testing. This may be more appropriate for a controller.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-08-11T17:54:28.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1790" PostTypeId="2" ParentId="1778" CreationDate="2014-08-11T18:10:36.003" Score="2" Body="&lt;p&gt;If there are any problems with your submission, Craft sets an &lt;code&gt;entry&lt;/code&gt; route variable&lt;sup&gt;1&lt;/sup&gt;, which you can use to retrieve the previously-posted form data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of how you might do that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input&#xA;    id=&quot;title&quot;&#xA;    type=&quot;text&quot;&#xA;    name=&quot;title&quot;&#xA;    value=&quot;{{ entry is defined ? entry.title : '' }}&quot;,&#xA;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also retrieve the errors from the &lt;code&gt;entry&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry is defined) and (entry.hasErrors('title')) %}&#xA;    &amp;lt;span class=&quot;error&quot;&amp;gt;{{ entry.getError('title') }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to learn more about the validation-related methods available on the &lt;code&gt;entry&lt;/code&gt; object (such as the difference between &lt;code&gt;getError&lt;/code&gt; and &lt;code&gt;getErrors&lt;/code&gt;), I've &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-1-foundations&quot; rel=&quot;nofollow&quot;&gt;written a blog post&lt;/a&gt; on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a look at line 477 of &lt;code&gt;craft/app/controllers/EntriesController.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="505" LastActivityDate="2014-08-11T18:10:36.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1791" PostTypeId="2" ParentId="1594" CreationDate="2014-08-11T18:13:56.407" Score="0" Body="&lt;p&gt;Apologies for the &quot;Answer&quot; but the comments have a way too short character restriction...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been away for a few days so only just getting back to this.  I'm still not getting any content pulled through following your suggestion.  I've even gone back to a clean slate (install) but still struggling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to clarify:&#xA;I (now) have a Category group called &quot;&lt;em&gt;stmimagecategories&lt;/em&gt;&quot;.&#xA;I have assigned an Asset field to this group called &quot;&lt;em&gt;imageUpload&lt;/em&gt;&quot;.&#xA;I have created a Category field called &quot;&lt;em&gt;imageCategory&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My '&lt;strong&gt;Section&lt;/strong&gt;' is called '&lt;strong&gt;Gallery&lt;/strong&gt;' and I have assigned the '&lt;em&gt;imageCategory&lt;/em&gt;' field to that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine the clients workflow would be to use the '&lt;strong&gt;Categories&lt;/strong&gt;' menu and subsequent Modal to dump a load of images into the appropriate category using the '&lt;em&gt;imageUpload&lt;/em&gt;' field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I need is... User creates a new Gallery &lt;strong&gt;entry&lt;/strong&gt; called say &quot;Panoramas&quot;.  They add a title, bit of descriptive text and then select 'Panoramas' from the '&lt;em&gt;imageCategory&lt;/em&gt;' field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the above set-up but the required template syntax to pull the content of the &quot;&lt;em&gt;imageCategory&lt;/em&gt;&quot; field is blowing my mind :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, the 'page needs to know what to show based on URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can help further with this I would be very much appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2014-08-11T18:13:56.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1792" PostTypeId="2" ParentId="1778" CreationDate="2014-08-11T18:14:30.883" Score="2" Body="&lt;p&gt;I've updated our front-end entry template example to show you how this can be done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-11T18:14:30.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1793" PostTypeId="2" ParentId="1785" CreationDate="2014-08-11T18:37:04.117" Score="4" Body="&lt;p&gt;You can check for the existence of a transform within your controller (for example), as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if (craft()-&amp;gt;assetTransforms-&amp;gt;getTransformByHandle('jimbob')) {&#xA;      // Transform exists.&#xA; } else {&#xA;      // Transform does not exist (null is returned).&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there doesn't seem to be an equivalent service (such as &lt;code&gt;craft.assetTransforms&lt;/code&gt;) for use within templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2014-08-11T18:37:04.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1794" PostTypeId="2" ParentId="44" CreationDate="2014-08-11T18:38:31.943" Score="14" Body="&lt;p&gt;I have changed the above code a little bit because it causes an error when I have for example a website with three active locales and an entry with only one or two active locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is: Impossible to access an attribute (&quot;locale&quot;) on a NULL variable (&quot;&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expanded if-statement looks now like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;{% if localeEntry.locale is defined and localeEntry.locale == locale %}&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the complete code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(entry.locale) %}&#xA;{% for locale in otherLocales %}&#xA;    {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;    {% if localeEntry.locale is defined and localeEntry.locale == locale %}&#xA;        &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="623" LastActivityDate="2014-08-11T18:38:31.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1795" PostTypeId="2" ParentId="1268" CreationDate="2014-08-11T20:00:39.457" Score="8" Body="&lt;p&gt;Craft has a &lt;code&gt;parseRefs&lt;/code&gt; filter built right in: &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot;&gt;http://buildwithcraft.com/docs/reference-tags&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One drag if using globals is that you have to use the globalset's ID, not the handle. e.g. &lt;code&gt;{globalset:34:number}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-08-11T20:00:39.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1796" PostTypeId="1" AcceptedAnswerId="1798" CreationDate="2014-08-11T20:05:26.810" Score="2" ViewCount="215" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/reference-tags&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my tests, only using the ID with globalsets work, e.g &lt;code&gt;{globalset:34:address}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to do &lt;code&gt;{globalset:misc:address}&lt;/code&gt;, with &lt;code&gt;misc&lt;/code&gt; being the global set handle.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="3951" LastEditDate="2017-10-24T15:24:21.337" LastActivityDate="2017-10-24T15:24:21.337" Title="How can I use a reference tag with a global set using the handle (not the ID)" Tags="&lt;globals&gt;&lt;reference-tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1797" PostTypeId="1" AcceptedAnswerId="1799" CreationDate="2014-08-11T20:17:25.377" Score="2" ViewCount="244" Body="&lt;p&gt;In my rich text field, I have a reference tag: &lt;code&gt;{globalset:34:address}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I save and open the entry back up, the content is no longer a reference, but the parsed content, which sort of eliminates its usefulness.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-08-11T21:31:07.320" Title="Reference tags in rich text fields parse and converted on save" Tags="&lt;reference-tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1798" PostTypeId="2" ParentId="1796" CreationDate="2014-08-11T21:09:37.263" Score="1" Body="&lt;p&gt;Currently, you can't.  Only element IDs will work for the reference part of the reference tag when using a global set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only entries get two additional formats for the reference part of the tag.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry-slug&lt;/li&gt;&#xA;&lt;li&gt;sectionHandle/entry-slug&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-11T21:09:37.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1799" PostTypeId="2" ParentId="1797" CreationDate="2014-08-11T21:31:07.320" Score="1" Body="&lt;p&gt;Correct... they currently only work on plain text fields, not rich text fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just updating the &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; so it's a more clear.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-11T21:31:07.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1800" PostTypeId="1" AcceptedAnswerId="1806" CreationDate="2014-08-11T21:34:50.690" Score="3" ViewCount="595" Body="&lt;p&gt;I have created a plugin that takes a form post, retrieves an asset id and am trying to have the browser start the download process. Is this possible if using a third party source like AmazonS3?  If so what may be wrong with this plugin controller method?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDownloadAsset()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $id = craft()-&amp;gt;request-&amp;gt;getRequiredPost(&quot;id&quot;);&#xA;&#xA;    $attributes = array('id' =&amp;gt; $id);&#xA;    $element = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset)-&amp;gt;limit(1)-&amp;gt;find($attributes);&#xA;&#xA;    header('Content-Description: File Transfer');&#xA;    header('Content-Type: application/octet-stream');&#xA;    header('Content-Disposition: attachment; filename='.basename($element-&amp;gt;filename));&#xA;    header('Content-Transfer-Encoding: binary');&#xA;    header('Expires: 0');&#xA;    header('Cache-Control: must-revalidate');&#xA;    header('Pragma: public');&#xA;    header('Content-Length: ' . $element-&amp;gt;filesize);&#xA;    readfile($element-&amp;gt;url);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everytime I try the plugin from front end I get a page not found.  I have made sure the from is posting to the controller method. &lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="57" LastEditDate="2014-08-11T21:51:02.907" LastActivityDate="2014-08-14T04:16:17.670" Title="Can a plugin force download an asset from third-party source like Amazon S3?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1801" PostTypeId="2" ParentId="1800" CreationDate="2014-08-11T21:49:02.700" Score="2" Body="&lt;p&gt;If you're getting a Craft 404, then it sounds like it's not even making it to your controller's action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likely, you haven't &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;allowed anonymous access&lt;/a&gt; to your controller globally or that action in particular.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-11T22:14:58.313" LastActivityDate="2014-08-11T22:14:58.313" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1802" PostTypeId="1" AcceptedAnswerId="1803" CreationDate="2014-08-12T00:58:15.763" Score="1" ViewCount="1402" Body="&lt;p&gt;When I try to save a new entry as a child under a Structure entry, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to&#xA;  string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I also get the same error when I tried to move it out to it's own Channel instead, so I am not sure what could be causing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several fields in this entry, most notably the cause would be an Entries field and Tags field. Both seem to select the correct values fine.&lt;/p&gt;&#xA;" OwnerUserId="655" LastActivityDate="2014-08-12T01:14:17.060" Title="What would cause an Internal Server Error on saving entry" Tags="&lt;entries&gt;&lt;structure&gt;&lt;error-message&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1803" PostTypeId="2" ParentId="1802" CreationDate="2014-08-12T01:14:17.060" Score="1" Body="&lt;p&gt;I have solved the problem myself while debugging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the Entry Type &quot;Title&quot; field set to &lt;code&gt;{relatedFieldName} Post&lt;/code&gt; which was causing the error. When I changed it to a plain string or other non-object field name, it no longer errors out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was unclear about how the Title field works exactly.&lt;/p&gt;&#xA;" OwnerUserId="655" LastActivityDate="2014-08-12T01:14:17.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1805" PostTypeId="1" AcceptedAnswerId="1866" CreationDate="2014-08-12T01:55:35.557" Score="2" ViewCount="483" Body="&lt;p&gt;Is there a way to override Garnish.Modal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a custom modal which uses a custom form but I want to be able to use the built in forms.elementSelect to select from a user list. When I select a user and press &quot;select&quot; it closes both my custom modal and my user select window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can I override this to just close the most recent modal?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in reference to Custom Modals inside Plugins: &lt;a href=&quot;https://craftcms.stackexchange.com/q/374/45&quot;&gt;How can my plugin generate a generic modal window in the Control Panel?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; It looks as if Garnish hides any other modals before loading a new one.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-13T14:16:48.923" Title="Possible to override Garnish.Modal? [Plugin]" Tags="&lt;plugin-development&gt;&lt;modal&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1806" PostTypeId="2" ParentId="1800" CreationDate="2014-08-12T03:32:46.713" Score="3" Body="&lt;p&gt;I have found a solution. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDownloadAsset()&#xA;{&#xA;  $this-&amp;gt;requirePostRequest();&#xA;  $id = craft()-&amp;gt;request-&amp;gt;getRequiredPost(&quot;id&quot;);&#xA;  $attributes = array('id' =&amp;gt; $id);&#xA;  $element = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset)-&amp;gt;first($attributes);&#xA;&#xA;&#xA;  $file = $entry-&amp;gt;url;&#xA;  $name = $entry-&amp;gt;filename;&#xA;&#xA;  header('Content-Description: File Transfer');&#xA;  header('Content-Type: application/octet-stream');&#xA;  header('Content-Disposition: attachment; filename='.basename($name));&#xA;  header('Content-Transfer-Encoding: binary');&#xA;  header('Expires: 0');&#xA;  header('Cache-Control: must-revalidate');&#xA;  header('Pragma: public');&#xA;&#xA;  readfile($file);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get access to the file url I had to array_shift the $element returned from getCriteria.  Then I had to exclude the file size header. This was ultimately causing the &quot;this webpage is not available&quot;. Not sure the reason. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;header('Content-Length: ' . filesize($entry-&amp;gt;size))&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2014-08-14T04:16:17.670" LastActivityDate="2014-08-14T04:16:17.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1807" PostTypeId="1" CreationDate="2014-08-12T05:45:11.633" Score="2" ViewCount="184" Body="&lt;p&gt;Been trying for days to figure this one out. How do I extract entries from a channel and display only entries related to a category? How do I pull in the related photo? I have this code below but it pulls in all the photos. I don't think I'm doing doing this right.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('spring-summer').first() %}&#xA;&#xA;{% for post in craft.entries.section('product').relatedTo({targetElement: category}) %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ post.title }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ post.price }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% for product in craft.entries.find() %}&#xA;        {% for image in product.photo %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('bottom') }}&quot; /&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="617" LastEditorUserId="57" LastEditDate="2014-08-12T17:48:39.637" LastActivityDate="2014-08-12T17:48:39.637" Title="Related category on a single page" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1808" PostTypeId="2" ParentId="1807" CreationDate="2014-08-12T05:57:05.990" Score="2" Body="&lt;p&gt;When you set up your category, you check the &lt;strong&gt;Categories in this group have their own URLs&lt;/strong&gt; box, and you give the category a URL (suppose it is &lt;code&gt;category/{slug}&lt;/code&gt;), and a template (suppose it is &lt;code&gt;category/_entry&lt;/code&gt;). Now in the &lt;code&gt;category/_entry.html&lt;/code&gt; template, &lt;code&gt;category&lt;/code&gt; will be defined (the way &lt;code&gt;entry&lt;/code&gt; is defined on the template for a section entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;How do I list the entries related to a category?&lt;/a&gt; (tucked away in the Get Help section of the Craft website) describes how to fetch and list the entries related to a category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the entries related to this category #}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{# Output them #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to narrow the entries down to a single section, then fetch them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySectionHandle').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-12T05:57:05.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1809" PostTypeId="2" ParentId="1779" CreationDate="2014-08-12T06:50:46.640" Score="3" Body="&lt;p&gt;You can write a recursive macro to display the site structure. In that macro, when you are looping through the entries &lt;code&gt;loop.index&lt;/code&gt; will be the the loop index, and &lt;code&gt;e.level&lt;/code&gt; will be the depth of entry &lt;code&gt;e&lt;/code&gt; in the structure. Here is a macro to print the navigation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursiveNav(entries) %}&#xA;{% import _self as self %}&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for e in entries %}&#xA;      {# loop.index is our index, e.level is our level #}&#xA;      &amp;lt;li&amp;gt;&#xA;        {# using twig range here to output right number of 0s #}&#xA;        {% if e.level &amp;gt; 1 %}{% for i in range(2, e.level) %}0{% endfor %}{% endif %}{{loop.index}}&#xA;        {{e.link}}&#xA;        {% if e.hasDescendants %}&#xA;          {{self.recursiveNav(e.children)}}&#xA;        {% endif %}&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endmacro %}&#xA;&#xA;{% import _self as self %}&#xA;{% set entries = craft.entries.section('sitecontent').level(1) %}&#xA;{# call recursive nav, pass it level 1 entries #}&#xA;{{ self.recursiveNav(entries) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If all you want is the title for a particular entry (&lt;em&gt;02 strategy&lt;/em&gt; e.g.), you can use almost the same recursive macro to do that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursiveTitle(entries, distinguishedId) %}&#xA;{% import _self as self %}&#xA;  {% for e in entries %}&#xA;    {% if e.id == distinguishedId %}&#xA;      {# this is the one we want #}&#xA;      {% if e.level &amp;gt; 1 %}{% for i in range(2, e.level) %}0{% endfor %}{% endif %}{{loop.index}}&#xA;      {{e.title}}&#xA;    {% endif %}&#xA;    {% if e.hasDescendants %}&#xA;      {{self.recursiveTitle(e.children, distinguishedId)}}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{% import _self as self %}&#xA;{% set entries = craft.entries.section('sitecontent').level(1) %}&#xA;{# call recursive title, pass it level 1 entries and id of our active entry #}&#xA;{{ self.recursiveTitle(entries, entry.id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no way to pass data out of a macro, so the recursiveNav can't also save the index and level of the active entry for later.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-12T06:50:46.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1810" PostTypeId="1" AcceptedAnswerId="1849" CreationDate="2014-08-12T07:22:50.810" Score="4" ViewCount="1120" Body="&lt;p&gt;I have a section for holding calendar entries stored by postDate in the CMS.&#xA;On the front end I want to basically display these in a calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have code which displays the calendar looping through each day of the month.&#xA;For each day it currently queries if there is any entries for this day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do it? - my current method had a query for each day?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table class=&quot;cal&quot;&amp;gt;&#xA;  &amp;lt;thead class=&quot;hide-for-small&quot;&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Sun&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Mon&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Tue&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Wed&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Thu&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Fri&amp;lt;/th&amp;gt;&#xA;      &amp;lt;th width=&quot;300&quot;&amp;gt;Sat&amp;lt;/th&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;  &amp;lt;/thead&amp;gt;&#xA;  &amp;lt;tbody&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;    {% set time = &quot;now&quot;|date(&quot;U&quot;) %}        &#xA;    {% set daysInMonth = time|date('t') %}&#xA;    {% set startDow = time|date('F 1\\s\\t Y')|date('w') %}&#xA;    {% set dow = startDow %}&#xA;    {% for day in range(1,daysInMonth) %}&#xA;        {% if loop.first and startDow != 0 %}&#xA;            &amp;lt;td colspan=&quot;{{ startDow }}&quot;&amp;gt;&amp;lt;/td&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;td&amp;gt;&#xA;            &amp;lt;div&amp;gt;&#xA;                &amp;lt;span class=&quot;day&quot;&amp;gt;{{ day }}&amp;lt;/span&amp;gt;&#xA;                    {% set today=thisyear ~ &quot;/&quot; ~ thismonth ~ &quot;/&quot; ~ day %}&#xA;&#xA;                    {% if (category is defined) and (category is not empty) %}&#xA;                    {% set params = { section: 'calendar', status: null, postDate:today|date('Y-m-d'), relatedTo: category } %}&#xA;                    {% else %}&#xA;                    {% set params = { section: 'calendar', status: null, postDate:today|date('Y-m-d') } %}&#xA;                    {% endif %}&#xA;                    {% set entries = craft.entries(params)%}&#xA;                    {% if entries|length %}&#xA;                &amp;lt;div&amp;gt;&#xA;                    {% for entry in entries %}&#xA;                    &amp;lt;span class=&quot;event green&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/td&amp;gt;&#xA;        {% if loop.last and dow != 6 %}&#xA;            &amp;lt;td colspan=&quot;{{ 6 - dow }}&quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&#xA;        {% endif %}&#xA;        {% if dow == 6 %}&#xA;            {% set dow = 0 %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;        {% else %}&#xA;            {% set dow = dow + 1 %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;  &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastActivityDate="2020-10-12T17:39:33.883" Title="Display Entries in a calendar" Tags="&lt;entries&gt;&lt;date&gt;&lt;postdate&gt;&lt;queries&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1811" PostTypeId="2" ParentId="1467" CreationDate="2014-08-12T10:28:55.473" Score="14" Body="&lt;p&gt;The &quot;this is for the homepage&quot; button available on single sections does two things for you, when you navigate to the home page's URL:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it populates the &lt;code&gt;entry&lt;/code&gt; variable with the single's entry model&lt;/li&gt;&#xA;&lt;li&gt;it loads the template spezified in the single's CP settings&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually nothing you can't do manually with your home page's &lt;code&gt;index.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Replace the default `entry` variable with the home page's entry model #}&#xA;{% set entry = craft.entries.section('pages').id('1').first() %}&#xA;&#xA;{# Load the home page's template from the &quot;pages&quot; structure #}&#xA;{% include &quot;_pages/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_pages/_entry.html&lt;/code&gt; further includes the template partial designed for the entry type I assigned my home page to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Load the designed template for this entry's entry type #}&#xA;{% include '_pages/' ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is all you need to replicate the &quot;this is for the homepage&quot; button behaviour for a structure entry. Additionally you might want to exclude the home page from your navigation menu for example. Again use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#id&quot;&gt;&lt;code&gt;id&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#slug&quot;&gt;&lt;code&gt;slug&lt;/code&gt;&lt;/a&gt; parameter on the ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get top-level entries in pages structure (exclude home page)  #}&#xA;{% set pages = craft.entries.section('pages').id('not 1').level(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Thanks again to Marion, her answer pointed me in the right direction.&#xA;I added this answer, because her configuration is a bit spezific and rather complicated.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-12T10:28:55.473" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1812" PostTypeId="1" AcceptedAnswerId="1814" CreationDate="2014-08-12T11:00:08.660" Score="1" ViewCount="206" Body="&lt;p&gt;I want to display entries in a specific custom order in Craft. For example entry Id 1, then Id 5, then Id 3.  How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="639" LastEditorUserId="57" LastEditDate="2014-08-12T16:49:55.113" LastActivityDate="2014-08-14T16:09:00.017" Title="How do you display entries in a specific (custom) order?" Tags="&lt;entries&gt;&lt;entry-type&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1813" PostTypeId="1" CreationDate="2014-08-12T11:10:27.263" Score="4" ViewCount="896" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Would it be a great idea to post here your plugins wish list? Just post it in the comments so the community can vote for it. I can collect the wishes here.&#xA;Developers can comment if the plugin is in development.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h1&gt;Wish list:&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;Comment plugin&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;low is working on it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Form builder or processor&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Better control over email HTML&lt;/li&gt;&#xA;&lt;li&gt;Support for Mailchimp etc&lt;/li&gt;&#xA;&lt;li&gt;Save form data as an entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Image editor&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dukt.net/ee/image-editor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt Image Editor (for EE)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Postmaster / Notification email system&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://devot-ee.com/add-ons/postmaster&quot; rel=&quot;nofollow noreferrer&quot;&gt;Objective HTML&lt;/a&gt; - &lt;a href=&quot;https://dukt.net/craft/notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt Notifications&lt;/a&gt; (still to premature).&lt;/li&gt;&#xA;&lt;li&gt;Third party email support: MailChimp, CampaignMonitor,&#xA;SendGrid, Postmark, PostageApp, Mandrill, Mailgun&lt;/li&gt;&#xA;&lt;li&gt;CRON support&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Private asset sources&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dukt.net/craft/safelink&quot; rel=&quot;nofollow noreferrer&quot;&gt;Safelink by Dukt&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reefine&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://devot-ee.com/add-ons/reefine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reefine allows your users to easily filter, search and refine your entries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Translation manager in CP&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What more?&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Add it as an answer&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="294" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-08-12T17:24:21.157" Title="Plugins wish list" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="5" CommentCount="7" FavoriteCount="3" ClosedDate="2014-08-12T19:37:16.423" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1814" PostTypeId="2" ParentId="1812" CreationDate="2014-08-12T11:14:19.197" Score="4" Body="&lt;p&gt;Try using a structure. You can reorder them in the CP. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('your_structure') %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-08-12T16:36:28.857" LastActivityDate="2014-08-12T16:36:28.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1815" PostTypeId="2" ParentId="1813" CreationDate="2014-08-12T11:20:52.137" Score="0" Body="&lt;p&gt;&lt;strong&gt;Postmaster&lt;/strong&gt;: isn't this similar to &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/&quot; rel=&quot;nofollow&quot;&gt;sprout email&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2014-08-12T12:07:38.537" LastActivityDate="2014-08-12T12:07:38.537" CommentCount="2" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1816" PostTypeId="1" AcceptedAnswerId="1818" CreationDate="2014-08-12T13:14:44.570" Score="3" ViewCount="355" Body="&lt;p&gt;I would like to test out Craft Pro to see if it would be a good fit for my next project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one issue. I have followed the instructions to install Craft CMS @ &lt;a href=&quot;http://site1.craft.dev&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site1.craft.dev&lt;/a&gt; - but am unable to see the upgrade/test link in the footer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screen shot of the domain I have it installed at:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/alLGC.png&quot; alt=&quot;Domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screen shot of the footer:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1CNnH.png&quot; alt=&quot;Footer&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I activate the trial licence (I am probably missing something obvious, so forgive me if this is the case) :)?&lt;/p&gt;&#xA;" OwnerUserId="658" LastActivityDate="2014-08-12T13:39:43.110" Title="Unable to activate trial licence" Tags="&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1817" PostTypeId="2" ParentId="1742" CreationDate="2014-08-12T13:21:52.857" Score="5" Body="&lt;p&gt;For this a good approach is to use the excellent Dynamic Routing system in Craft.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Solution #1&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First create your section &quot;Artists&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ImtMa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that go to &quot;Settings&quot; -&gt; &quot;Routes&quot; and add this Dynamic Route:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SQz8g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this is done all URL requests made to &quot;/artists/-whatever-&quot; will be routed to the &quot;artists/_entry&quot; template. Now you can create your link like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/artists/{{ entry.slug }}/{{ entry.firstNameField }}/{{ entry.lastNameField }}&quot;&amp;gt;Artist Name&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your URL might now look like this rendered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/artists/ladygaga/firstname/lastname&quot;&amp;gt;Lady Gaga&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &quot;_entry&quot; template you can now fetch your entry using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('artists').slug(craft.request.getSegment(2)).first() %}&#xA;Artist Name: {{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Solution #2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you instead want the URL to be &quot;/artists/firstname-slug&quot; you can alter the Dynamic Route slightly and use the Twig filter &quot;split&quot; to get the slug from the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First change the Dynamic Route to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;artists/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then update your template &quot;_entry&quot; with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.request.getSegment(2)|split('-') %}&#xA;{% set entry = craft.entries.section('pages').slug(segments[1]).first() %}&#xA;Title: {{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your URL can now be &quot;/artists/{{ entry.firstNameField }}-{{ entry.slug }}&quot; and the template code will take care of the rest.&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="297" LastEditDate="2014-08-12T21:27:29.103" LastActivityDate="2014-08-12T21:27:29.103" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1818" PostTypeId="2" ParentId="1816" CreationDate="2014-08-12T13:31:24.807" Score="2" Body="&lt;p&gt;I know it sounds silly, but try refreshing or clicking another tab (like entries). What you should see is in the attached screenshot. &lt;img src=&quot;https://i.stack.imgur.com/KGA36.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Click that box and click &quot;Try&quot; and you should be all set.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-08-12T13:31:24.807" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1819" PostTypeId="1" AcceptedAnswerId="1843" CreationDate="2014-08-12T13:39:40.957" Score="2" ViewCount="454" Body="&lt;p&gt;Hi I'm creating a site that will be used in 4 locales which each have their own domain.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Australia: project.com.au &lt;/li&gt;&#xA;&lt;li&gt;New Zealand: project.co.nz &lt;/li&gt;&#xA;&lt;li&gt;South Africa: project.co.za &lt;/li&gt;&#xA;&lt;li&gt;USA: project.co&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In short, from a content management perspective I only want two locales. English AU and English USA. However, I need the content on the au locale to be accessible from the au,nz,za domains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have an array of URL for one locale config?&lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2014-08-12T18:18:54.570" Title="Multiple domains for a single locale" Tags="&lt;localization&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1820" PostTypeId="2" ParentId="1816" CreationDate="2014-08-12T13:39:43.110" Score="1" Body="&lt;p&gt;I found this in the release notes of Craft 2.0.2535:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The upgrade promo is now only shown on the Settings page if you’re running Craft Client.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe this is also true if you are running Craft Personal? I'd look for the link at the bottom of the settings page...&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-12T13:39:43.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1821" PostTypeId="1" AcceptedAnswerId="1829" CreationDate="2014-08-12T14:49:29.643" Score="3" ViewCount="731" Body="&lt;p&gt;I'm trying to pull entries from a database where the postDate is a specific date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set today = thisyear ~ &quot;-&quot; ~ thismonth ~ &quot;-&quot; ~ day %}&#xA;{% set today = today|date('Y-m-d') %}&#xA;&#xA;{% set entries = craft.entries(params).section('calendar').status('null').postDate(today|date('Y-m-d'))%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This only gets the entry if the Time element of the Post Date is empty or 00:00&#xA;How can I correct this to pull the entries even if it has a time associated with the Post Date&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="125" LastEditDate="2014-08-12T16:14:36.363" LastActivityDate="2014-08-12T16:19:44.307" Title="Get entries by date but ignore time" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1822" PostTypeId="2" ParentId="1813" CreationDate="2014-08-12T14:51:32.840" Score="3" Body="&lt;p&gt;I'd personally love to see a Freeform like plugin created. There are ways of making it happen by using Sprout Email or P&amp;amp;T's Contact Form, but when someone fills out a form it would be nice to have it saved as an Entry into a Section.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2014-08-12T14:51:32.840" CommentCount="0" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1823" PostTypeId="2" ParentId="1813" CreationDate="2014-08-12T15:10:20.120" Score="1" Body="&lt;p&gt;&lt;strong&gt;Private asset sources&lt;/strong&gt;, see &lt;a href=&quot;https://dukt.net/craft/safelink&quot; rel=&quot;nofollow&quot;&gt;Dukt Safe Link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-08-12T15:10:20.120" CommentCount="1" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1824" PostTypeId="1" AcceptedAnswerId="1825" CreationDate="2014-08-12T15:17:52.280" Score="13" ViewCount="4831" Body="&lt;p&gt;I've been building sites with ModX Revolution for about 4 months but I've heard great things about Craft. I downloaded and installed it and the interface looks great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform a detailed evaluation, I need to dive in and start building a basic site. But I don't know where to start. I found the mijingo tutorials but I have to pay $39.00 then mijingo tells me that I can only get so far with a free Craft license. To get the full experience, I need to buy at least a client license. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any beginner tutorials for Craft that are free or at least don't require me to commit to the client Craft license?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="660" LastEditorUserId="22" LastEditDate="2017-05-10T00:23:56.490" LastActivityDate="2017-05-10T00:23:56.490" Title="Are there any beginner Craft tutorials?" Tags="&lt;resources&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="7" CommunityOwnedDate="2014-08-14T18:31:47.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="1825" PostTypeId="2" ParentId="1824" CreationDate="2014-08-12T15:32:31.867" Score="10" Body="&lt;p&gt;If you run Craft from a non-public domain, you actually have the option to switch between Craft Personal, Craft Client, and Craft Pro for free, forever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can start with using the &quot;&lt;a href=&quot;https://github.com/pixelandtonic/ontherocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;On The Rocks&lt;/a&gt;&quot; example website. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“What is a non-public domain&quot;, you ask? We consider any domain that ends with &lt;code&gt;.dev&lt;/code&gt;, &lt;code&gt;.local&lt;/code&gt;, or any other unofficial/nonregistrable TLD, to be non-public, as well as other special cases such as &lt;code&gt;localhost&lt;/code&gt; and IP addresses. You can view the full list of things we check in &lt;a href=&quot;https://craftcms.com/support/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;this help article&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;From &lt;a href=&quot;https://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="294" LastEditorUserId="5437" LastEditDate="2016-12-27T03:21:47.797" LastActivityDate="2016-12-27T03:21:47.797" CommentCount="1" CommunityOwnedDate="2014-08-14T18:31:47.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="1826" PostTypeId="2" ParentId="1824" CreationDate="2014-08-12T15:40:38.437" Score="17" Body="&lt;p&gt;&lt;strong&gt;Testing all Craft versions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you would like to try out Craft Client or Craft Pro before buying,&#xA;  you can do so by running your site from the host name craft.dev.&#xA;  Subdomains work as well, e.g. site1.craft.dev.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;http://buildwithcraft.com/help/try-craft-client-pro&quot;&gt;How can I try Craft Client or Craft Pro before buying?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Tutorials:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://mijingo.com/products/screencasts/craft-cms-tutorial/&quot;&gt;Mijingo's Learning&#xA;Craft&lt;/a&gt; - Most comprehensive tutorial&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://withchief.com/blog/basics-of-templating-in-craft&quot;&gt;Basic of templating in Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer&quot;&gt;Twig Primer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/brandonkelly/TwigForDesigners&quot;&gt;Twig for Designers&lt;/a&gt; - A work-in-progress book from Brandon Kelly&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://gist.github.com/brandonkelly/8584132&quot;&gt;Templating in EE vs. Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P&amp;amp;T has demo files for two sites on github, which you can install locally:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot;&gt;HappyLager&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ontherocks&quot;&gt;On the Rocks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcookbook.net/&quot;&gt;Craft Cookbook&lt;/a&gt; - Code Snippets&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://straightupcraft.com/&quot;&gt;Straight up Craft&lt;/a&gt; - Articles / Link lists / Tweets / Plugin List&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-12T15:40:38.437" CommentCount="3" CommunityOwnedDate="2014-08-14T18:31:47.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="1827" PostTypeId="1" AcceptedAnswerId="1902" CreationDate="2014-08-12T15:53:16.840" Score="2" ViewCount="196" Body="&lt;p&gt;Supposing you have a structure of products but you only want some to be available to certain localities? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure you could add a field to the entries E.g (Available in: eng | fr) and then test the local in the template before listing the entires. However, I'm not sure this is the best way of approaching this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, it may be that the category the product is within dictates its availability in a country but this is not guaranteed in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas appreciated.&lt;/p&gt;&#xA;" OwnerUserId="487" LastActivityDate="2015-09-11T04:58:19.540" Title="How can you display entries filtered by localisation/localization?" Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1828" PostTypeId="1" CreationDate="2014-08-12T15:59:38.433" Score="2" ViewCount="463" Body="&lt;p&gt;I am looking to filter entries by a given month regardless of year. The filter would be based on a custom Date/Time input.  My last goal would allow them to be paginated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth  = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;&#xA;{% set thisMonthsEntries = craft.entries.section('messages').messageDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{% paginate thisMonthsEntries as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;        {# ... whatever your code does... #}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my original code. My first guess is I would need to have an array of years and loop through each year applying to the above code, however I am unclear on how to get a unique list of years that my entries are related too. Then I would probably have multiple sets of entries which would then need to be merged some how for output.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-08-12T17:23:29.020" Title="Filter entries by month regardless of year using custom Date/Time and paginate them" Tags="&lt;entries&gt;&lt;pagination&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1829" PostTypeId="2" ParentId="1821" CreationDate="2014-08-12T16:13:59.457" Score="4" Body="&lt;p&gt;This happens because you set the parameter on the ElementCriteriaModel to get entries with that specific &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime&quot; rel=&quot;nofollow&quot;&gt;datetime&lt;/a&gt;. If you omit a time when you compose a datetime with strings, you'll still get a time (00:00:00) and even a timezone set on it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDatetime = '2014-08-12' %}&#xA;&#xA;{# Print the datetime in ISO 8601 format / 2014-08-12T00:00:00+02:00 #}&#xA;{{ myDatetime|date('c') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how you set the parameter to accept datetime ranges:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDatetime = thisyear ~ '-' ~ thismonth ~ '-' ~ day %}&#xA;{% set entries = craft.entries.postDate('and', '&amp;gt;= ' ~ myDatetime, '&amp;lt; ' ~ myDatetime|date_modify('+1 day')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-12T16:19:44.307" LastActivityDate="2014-08-12T16:19:44.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1830" PostTypeId="1" CreationDate="2014-08-12T16:29:05.943" Score="2" ViewCount="160" Body="&lt;p&gt;I have a channel with entries which have a category field which is required.&#xA;When the entries are listed on a page how do I find the category that it belongs to?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    &amp;lt;span class=&quot;event&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code so far is above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The category has a background color field which I want to apply to the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="57" LastEditDate="2014-08-12T16:51:09.923" LastActivityDate="2014-08-12T17:20:22.790" Title="How do I find the category an entry belongs to?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1831" PostTypeId="1" AcceptedAnswerId="1832" CreationDate="2014-08-12T16:53:33.703" Score="5" ViewCount="6411" Body="&lt;p&gt;Each of my entry types have their own template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/foo/{entryTypeHandle}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the route is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'foo/(?P&amp;lt;routesEntryTypeHandle&amp;gt;[-\w]+)' =&amp;gt; 'bar.html'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the template I can get the section the entry type is in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionById(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can get ALL the entry types:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryTypes = section.getEntryTypes() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can get all the entries of that entry type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(section).type(routesEntryTypeHandle) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't seem to get the entry type's name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Sections Service there's a method called &lt;code&gt;getEntryTypesByHandle&lt;/code&gt; but that's not available in the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could get the entry type name from the &lt;code&gt;entries&lt;/code&gt;, but that relies on there actually being results, which isn't assured.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entries.first.type.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I must be missing an easier way. Anyone?&lt;/p&gt;&#xA;" OwnerUserId="379" LastEditorUserId="57" LastEditDate="2014-08-12T17:33:50.960" LastActivityDate="2015-05-15T20:35:54.520" Title="How can you get an entry type's name from its handle in a template?" Tags="&lt;entry-type&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1832" PostTypeId="2" ParentId="1831" CreationDate="2014-08-12T17:03:52.427" Score="8" Body="&lt;p&gt;Classic find the answer straight after posting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The getEntryTypes method of the sections model allows you to choose how the array is indexed. This means you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryTypes = section.getEntryTypes('handle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which means our entry type model can be accessed using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryType = entryTypes[routesEntryTypeHandle] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entryType.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2014-08-12T17:03:52.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1833" PostTypeId="1" CreationDate="2014-08-12T17:08:55.377" Score="2" ViewCount="660" Body="&lt;p&gt;Why does this work fine&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries().limit(7).section('events').eventStartDate('&amp;gt;= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this does not&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries().limit(7).section('events').eventStartDate('&amp;gt;= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this &lt;a href=&quot;http://d.pr/i/NRvg&quot; rel=&quot;nofollow&quot;&gt;http://d.pr/i/NRvg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also get errors when simply using '&amp;lt;' so it seems to require only either a less than or equal to or a greater than or equal to operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point to some kind of documentation for what is allowed within the custom field filter -------------&gt; this part ('&amp;lt;= ' ~ 2014 ~ '-' ~ 09)&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2014-08-12T17:32:43.813" Title="Custom field filtering" Tags="&lt;datetime&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1834" PostTypeId="1" AcceptedAnswerId="1847" CreationDate="2014-08-12T17:10:12.520" Score="11" ViewCount="8259" Body="&lt;p&gt;This seriously can't be this hard. How are you handling complex navigation on your sites? Do you hard-code them? Do you use a dedicated &quot;Menu&quot; Structure Section? I am curious what everyone is doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few customers who really need to have control over their menu and its structure, but as I build the templates, I am finding I need complete control over the first level and especially the sub/children of them. I am finding it nearly impossible to come up with a way to be able to loop through children and style them how I need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I am trying to access the Dropdown portion of this menu example and as you can see, I need to be able to add a class and data-toggle to those items.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;navbar navbar-default&quot; role=&quot;navigation&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;bs-example-navbar-collapse-1&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;      &amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;Dropdown &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li class=&quot;divider&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li class=&quot;divider&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;One more separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="472" LastEditorUserId="472" LastEditDate="2014-08-12T18:42:32.600" LastActivityDate="2017-04-07T15:01:02.270" Title="How do you handle complex navigation in Craft?" Tags="&lt;templating&gt;&lt;navigation&gt;" AnswerCount="5" CommentCount="11" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1835" PostTypeId="2" ParentId="1830" CreationDate="2014-08-12T17:20:22.790" Score="3" Body="&lt;p&gt;If I'm following you, you've got a category group setup with a color field on its field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you've got a category field setup with it's source set to that category group and in an entry, you want to get to the color field on the category group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;&#xA;    {# Grab the first category #}&#xA;    {% set category = entry.categoryFieldHandle.first() %}&#xA;&#xA;    {# &#xA;        Or if there are multiple categories...&#xA;        set category = entry.categoryFieldHandle.find()&#xA;        And loop through to find the one you want&#xA;    #}&#xA;&#xA;    &amp;lt;span class=&quot;event&quot; style=&quot;background-color: {{ category.colorFieldHandle }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-12T17:20:22.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1836" PostTypeId="2" ParentId="1813" CreationDate="2014-08-12T17:20:59.760" Score="0" Body="&lt;p&gt;Wish: &quot;Dashboard widget control&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ability to manage users and/or usergroups dashboard widgets globally without having to login to each user. &lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-08-12T17:20:59.760" CommentCount="0" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1837" PostTypeId="2" ParentId="1828" CreationDate="2014-08-12T17:23:29.020" Score="1" Body="&lt;p&gt;I think you are right and there's no chance to do what you want with parameters on a single ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could definitely do it with many queries, the first one to get your years array, then one for each year. Merging them is simple with Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; filter. But then you'd end up with a manually composed array of entry models and don't have the convenience of a single ElementCriteriaModel. Methods like &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; or – important in your case – the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% paginate %}&lt;/code&gt;&lt;/a&gt; tag won't work with an array of entry models!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's skip the paginate problem for now and look at that query flood, you'd produce. Sure, Craft has the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag, but if your entries are modified regularly, there'll always be people who access the uncached version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about another solution, why not do a single query to get all your &quot;messages&quot; entries and filter them in your template with a simple conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all `messages` entries #}&#xA;{% set entries = craft.entries.section('messages') %}&#xA;&#xA;{# Loop through all entries with a `messageDate` month of `myMonth` regardless the year #}&#xA;{% for entry in entries if entry.messageDate|date('m') == myMonth %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd still have no solution yet for your pagination problem, but this should be way less expensive on performance, and it's really easy to implement.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-12T17:23:29.020" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1838" PostTypeId="2" ParentId="1813" CreationDate="2014-08-12T17:24:21.157" Score="4" Body="&lt;p&gt;Wish: &quot;Reordering of entries based on custom sets&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This wish is similar to the EE addon Low Reorder. Craft has the awesome Structure support but sometime you need the ability to be able to make custom reordering within the same section more then one time. &lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-08-12T17:24:21.157" CommentCount="0" CommunityOwnedDate="2014-08-12T18:16:15.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="1839" PostTypeId="2" ParentId="1833" CreationDate="2014-08-12T17:25:55.987" Score="1" Body="&lt;p&gt;You shouldn't need to use string concatenation here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.eventStartDate('&amp;gt;= ' ~ 2014 ~ '-' ~ 09)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're hard coding the year and month, just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.eventStartDate('&amp;gt;= 2014-09-01')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-12T17:25:55.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1840" PostTypeId="1" CreationDate="2014-08-12T17:25:59.257" Score="2" ViewCount="54" Body="&lt;p&gt;I have a route that matches:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/blog/tagged/{tag}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my template I would like to pull up all blogs that are related to the tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if tag is defined %}&#xA;    {% set blogTag = craft.tags({ name: tag, group: 'blogTags' }) %}&#xA;    {% set filter = filter|merge({ relatedTo: blogTag }) %}&#xA;{% endif %}&#xA;&#xA;{% for entry in craft.entries(filter).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't work since craft.tags() gives me an ElementCriteriaModel, but I need a TagModel to work with relatedTo(). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to get the TagModel here.&lt;/p&gt;&#xA;" OwnerUserId="501" LastActivityDate="2014-08-12T17:58:45.277" Title="How do you get ahold of a TagModel in a template?" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1841" PostTypeId="2" ParentId="1840" CreationDate="2014-08-12T17:30:26.640" Score="2" Body="&lt;p&gt;I figured this one out right after I posted it. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogTag = craft.tags({ tag: tag, group: 'blogTags' }).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One mistake was searching for it with &quot;name&quot; instead of &quot;tag&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other mistake was that I needed to call first() to get the TagModel. Otherwise, craft.tags() just returns an ElementCriteriaModel.&lt;/p&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2014-08-12T17:58:45.277" LastActivityDate="2014-08-12T17:58:45.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1842" PostTypeId="2" ParentId="1833" CreationDate="2014-08-12T17:32:43.813" Score="1" Body="&lt;p&gt;Ahhhhh. I was because before I changed that I was pulling from a segment which was a string. I figured it out though. Ended up with this which works out... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set year = craft.request.segment(2) %}&#xA;{% set month = craft.request.segment(3) %}&#xA;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;&#xA;{% paginate craft.entries()&#xA;    .limit(7)&#xA;    .section('events')&#xA;    .eventStartDate('&amp;gt;= ' ~ firstDayOfMonth | date(&quot;U&quot;))&#xA;    .eventEndDate('&amp;lt;= ' ~ lastDayOfMonth | date(&quot;U&quot;))&#xA;as entriesOnPage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="447" LastActivityDate="2014-08-12T17:32:43.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1843" PostTypeId="2" ParentId="1819" CreationDate="2014-08-12T18:03:54.470" Score="1" Body="&lt;p&gt;Use a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Multi-Environment&lt;/a&gt; configuration to set the &lt;a href=&quot;http://buildwithcraft.com/help/site-url&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt; for your two locales, &lt;code&gt;en_au&lt;/code&gt; and &lt;code&gt;en_us&lt;/code&gt;, independently for each domain like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'project.com.au' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_au' =&amp;gt; 'http://project.com.au/',&#xA;        'en_us' =&amp;gt; 'http://project.co/',&#xA;    ),&#xA;),&#xA;&#xA;'project.co.nz' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_au' =&amp;gt; 'http://project.co.nz/',&#xA;        'en_us' =&amp;gt; 'http://project.co/',&#xA;    ),&#xA;),&#xA;&#xA;'project.co.za' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_au' =&amp;gt; 'http://project.co.za/',&#xA;        'en_us' =&amp;gt; 'http://project.co/',&#xA;    ),&#xA;),&#xA;&#xA;'project.co' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_au' =&amp;gt; 'http://project.com.au/',&#xA;        'en_us' =&amp;gt; 'http://project.co/',&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also set additional environment / domain specific variables in the config file. You could set the currency or the timezone for each domain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'project.com.au' =&amp;gt; array(&#xA;    'currency' =&amp;gt; 'AUD',&#xA;    'timeZone' =&amp;gt; 'UTC+10',&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_au' =&amp;gt; 'http://project.com.au/',&#xA;        'en_us' =&amp;gt; 'http://project.co/',&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how you &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.config&quot; rel=&quot;nofollow&quot;&gt;access such a variable&lt;/a&gt; in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.currency }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-12T18:18:54.570" LastActivityDate="2014-08-12T18:18:54.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1844" PostTypeId="1" AcceptedAnswerId="1846" CreationDate="2014-08-12T18:25:20.970" Score="6" ViewCount="682" Body="&lt;p&gt;I want to create a basic Craft installation that I can use as my starting point. I don't want to just start with the Craft download, because there is a lot of common setup I don't want to repeat every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is making sure I properly pay Pixel &amp;amp; Tonic for a new license each time I need one.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="505" LastEditDate="2014-08-12T20:38:26.447" LastActivityDate="2014-09-08T23:34:45.923" Title="How to replicate a Craft installation as a starting point" Tags="&lt;install&gt;&lt;license&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1845" PostTypeId="2" ParentId="1844" CreationDate="2014-08-12T18:34:37.077" Score="2" Body="&lt;p&gt;Take a look at Jake Chapman's &lt;a href=&quot;https://github.com/imjakechapman/CraftCMS-Boilerplate&quot; rel=&quot;nofollow&quot;&gt;Craft CMS - Boilerplate&lt;/a&gt; on GitHub. You simply copy or clone your Craft boilerplate for each new project, and then add a newly downloaded &lt;code&gt;craft/app/&lt;/code&gt; folder (wich is already on the latest Craft version) with a new &lt;code&gt;license.key&lt;/code&gt; file to it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-12T18:42:11.360" LastActivityDate="2014-08-12T18:42:11.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1846" PostTypeId="2" ParentId="1844" CreationDate="2014-08-12T18:35:33.977" Score="9" Body="&lt;p&gt;Relevant link: &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot;&gt;http://buildwithcraft.com/help/license-enforcement&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the TLDR is that purchases are tied to your &lt;code&gt;craft/config/license.key&lt;/code&gt; file and the purchase will follow that file wherever it goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as long as your replication script ignores that file, you'll get a fresh one tied to Craft Personal Edition the first time that Craft sees it's has an internet connection and you can make a new purchase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, and regardless of edition, Craft will tie the &lt;code&gt;license.key&lt;/code&gt; file to a domain when it thinks it's being run on a &quot;public&quot; domain.  &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot;&gt;Here is how we determine what is public.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if Craft gets that wrong (maybe you develop on public staging domaina.com, but the site will ultimately be on a public domainb.com) and Craft ties the &lt;code&gt;license.key&lt;/code&gt; file to the staging domaina.com, the worst that will happen is that when you deploy the &lt;code&gt;license.key&lt;/code&gt; file to domainb.com, you'll get a alert in the control panel saying something to the affect of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;This license.key file is already in use on domaina.com.  Would you like to transfer it to domainb.com?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of the site's functionality will be affected.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-12T18:35:33.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1847" PostTypeId="2" ParentId="1834" CreationDate="2014-08-12T19:20:56.403" Score="19" Body="&lt;p&gt;If the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt; tag doesn't give you enough control over the output, you can always replicate the behavior with custom loops and the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getChildren&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;getChildren()&lt;/code&gt;&lt;/a&gt; method. Just nest them as far as your navigation hierarchy possibly gets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here an example code on how you'd dynamically call &lt;code&gt;getChildren()&lt;/code&gt; on each top-level entry of your structure. If you need to go deeper another level in the structure's hierarchy, I marked the line where you would do that:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul class=&quot;Navigation&quot;&amp;gt;&#xA;&#xA;    {# Get top-level entries in pages structure (exclude home page)  #}&#xA;    {% set pages = craft.entries.section('pages').id('not 1').level(1) %}&#xA;&#xA;    {# Loop through top-level entries #}&#xA;    {% for page in pages %}&#xA;&#xA;        {# Check if entry has descendants #}&#xA;        {% if not page.hasDescendants %}&#xA;&#xA;            {# List navigation item if entry has NO child entries #}&#xA;            &amp;lt;li class=&quot;Navigation-item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ page.getUrl }}&quot; class=&quot;Navigation-link&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;            {# List navigation item if entry does have child entries #}&#xA;            &amp;lt;li class=&quot;Navigation-item Navigation-item--dropdown&quot;&amp;gt;&#xA;&#xA;                &amp;lt;a href=&quot;{{ page.getUrl }}&quot; class=&quot;Navigation-link Navigation-link--dropdown&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;ul class=&quot;Navigation Navigation--subMenu&quot;&amp;gt;&#xA;&#xA;                    {# Get child entries of current iteration's top-level entry #}&#xA;                    {% set subPages = page.getChildren() %}&#xA;&#xA;                    {# Loop through those 2nd-level entries #}&#xA;                    {% for subPage in subPages %}&#xA;&#xA;                        {# This is the place where you'd nest the next menu hierarchy !! #}&#xA;&#xA;                        {# List sub-menu navigation item #}&#xA;                        &amp;lt;li class=&quot;Navigation-item Navigation-item--subMenu&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{ subPage.getUrl }}&quot; class=&quot;Navigation-link Navigation-link--subMenu&quot;&amp;gt;{{ subPage.title }}&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;&#xA;                    {% endfor %}&#xA;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because most of your question's topics are already covered by other Q/As, I'd also recommend you to read through these too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to realize a client editable navigation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1473/125&quot;&gt;Would you use a Structure as navigation over multiple sections?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1722/125&quot;&gt;How to build a great multi-lingual navigation witch channels, structure, and manageable in the CP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/883/125&quot;&gt;Multi-lingual site navigation made of singles, channels and structure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1467/125&quot;&gt;Add home page to a stucture?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;More control over the HTML output of the &lt;code&gt;nav&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1733/125&quot;&gt;Custom or complex nav tag&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-14T15:44:56.087" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1848" PostTypeId="2" ParentId="1834" CreationDate="2014-08-12T19:45:15.557" Score="4" Body="&lt;p&gt;I am a big fan of using a recursive macro when the &lt;code&gt;{% nav %}&lt;/code&gt; tag is not enough. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1779/display-number-based-on-position-in-structure-hierarchy/1809#1809&quot;&gt;This answer&lt;/a&gt; has an example.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-08-12T19:45:15.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1849" PostTypeId="2" ParentId="1810" CreationDate="2014-08-12T19:57:50.907" Score="9" Body="&lt;p&gt;I haven't tested this, but it should be a good starting point, at the very least.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Determine the number of days in the month #}&#xA;{% set daysInMonth = &quot;now&quot;|date(&quot;t&quot;) %}&#xA;&#xA;{# Determine the date range spanning the month #}&#xA;{% set firstDayOfMonth = &quot;now&quot;|date(&quot;Y-m-01&quot;) %}&#xA;{% set firstDayOfNextMonth = &quot;now&quot;|date_modify(&quot;first day of next month&quot;)|date(&quot;Y-m-01&quot;) %}&#xA;{% set postDateParam = &quot;and, &amp;gt;= &quot; ~ firstDayOfMonth ~ &quot;, &amp;lt; &quot; ~ firstDayOfNextMonth %}&#xA;&#xA;{# Create our parameters object #}&#xA;{% if (category is defined) and (category is not empty) %}&#xA;    {% set params = {section: 'calendar', postDate: postDateParam, status: null, order: 'postDate', relatedTo: category} %}&#xA;{% else %}&#xA;    {% set params = {section: 'calendar', postDate: postDateParam, status: null, order: 'postDate'} %}&#xA;{% endif %}&#xA;&#xA;{# Retrieve all of the events for the month, and group them by day #}&#xA;{% set groupedEvents = craft.entries(params)|group('postDate|date(&quot;Y-m-d&quot;)') %}&#xA;&#xA;{# Set a shortcut for the YYYY-MM portion of the current month #}&#xA;{% set yearMonth = &quot;now&quot;|date(&quot;Y-m&quot;) %}&#xA;&#xA;{# Loop through all of the days in the month #}&#xA;{% for day in range(1, daysInMonth) %}&#xA;    {% set formattedDay = &quot;%02d&quot;|format(day) %}&#xA;    {% set dayOfMonth = yearMonth ~ &quot;-&quot; ~ formattedDay) %}&#xA;&#xA;    {# If the current day is a key in our groupedEvents array, we have events #}&#xA;    {% if dayOfMonth in groupedEvents|keys %}&#xA;        &amp;lt;span class=&quot;day&quot;&amp;gt;{{ dayOfMonth }}&amp;lt;/span&amp;gt;&#xA;&#xA;        &amp;lt;div&amp;gt;&#xA;            {% for event in groupedEvents[dayOfMonth] %}&#xA;                &amp;lt;span class=&quot;event green&quot;&amp;gt;{{ event.title }}&amp;lt;/span&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I said, I haven't tested the above code, but the basic principle works (I've used it for grouping people by surname, and so forth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if anything is unclear, I realise it's quite the chunk of Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="125" LastEditDate="2015-03-04T21:10:00.127" LastActivityDate="2015-03-04T21:10:00.127" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1850" PostTypeId="1" CreationDate="2014-08-12T20:50:50.650" Score="2" ViewCount="211" Body="&lt;p&gt;We are attempting to implement a number of Pardot forms within Craft templates.  Since Pardot's form actions do not allow us to dynamically specify a return URL, our best choice is to use the form's URL as the return URL.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our page is /about/contact.  We want one of three things to happen on this page: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the user has an identifying cookie on their machine, display only a comment field, for example&lt;/li&gt;&#xA;&lt;li&gt;If the user does not have a cookie saved, display the complete form&lt;/li&gt;&#xA;&lt;li&gt;If the user is returning from Pardot, set a cookie and display a thank you message.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's important to us that we maintain pretty URLs, so we have created a route in routes.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  'about/contact' =&amp;gt; array('action' =&amp;gt; 'pardotForm/ManageForm'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Our contact page is an entry in our Landing Page structure.  We've set that entry's slug to be something random so that Craft does not route to the default controller for that entry.  It is set to &quot;contact-us-page&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to maintain the actual slug on the contact page as &quot;contact&quot; so that we can use slug features in normal ways.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any possible way to maintain our slug as &quot;contact&quot;, our url as &quot;about/contact&quot;, and still route to our 'pardotForm/ManageForm' action?&lt;/p&gt;&#xA;" OwnerUserId="274" LastActivityDate="2014-09-09T16:10:57.433" Title="Insert action in front of template, while maintaining entry slug" Tags="&lt;controller&gt;&lt;slug&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1851" PostTypeId="1" AcceptedAnswerId="1852" CreationDate="2014-08-12T22:51:51.057" Score="3" ViewCount="3529" Body="&lt;p&gt;I have a site where I want to feature the latest 5 entries and show the next 10 in a separate list. How would I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part would be easy: &lt;code&gt;craft.entries.section('news').limit(5)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to bring the next 10. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="250" LastEditDate="2014-10-05T15:59:36.043" LastActivityDate="2017-07-24T17:54:43.413" Title="How to get latest entries, after X number?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1852" PostTypeId="2" ParentId="1851" CreationDate="2014-08-12T22:54:35.090" Score="5" Body="&lt;p&gt;I believe you're looking for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#offset&quot; rel=&quot;noreferrer&quot;&gt;offset&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want entries 6-15 it would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('news').offset(5).limit(10)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-12T22:54:35.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1853" PostTypeId="1" CreationDate="2014-08-13T01:09:19.350" Score="3" ViewCount="368" Body="&lt;p&gt;Is it possible to create a &quot;Quick Link&quot; in the control panel, similar to the way quick links function in ExpressionEngine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a Single that is frequently accessed by the client, it would be really helpful to save a link to the publish page right in the CP, rather than having the clients select Entries &gt; Singles &gt; Title every time they need to make an edit.&lt;/p&gt;&#xA;" OwnerUserId="661" LastActivityDate="2015-09-11T14:42:53.907" Title="&quot;Quick Links&quot; in control panel" Tags="&lt;control-panel&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1854" PostTypeId="1" AcceptedAnswerId="1856" CreationDate="2014-08-13T01:28:43.440" Score="2" ViewCount="440" Body="&lt;p&gt;Successfully installed Craft on MAMP but whenever I load the dashboard, I get the error message &quot;Unknown error occurred&quot;. The message clears after a few seconds. The CMS appears to be functioning correctly except when I create a Section, it only allows me to select Single as a type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed light on this error?&lt;/p&gt;&#xA;" OwnerUserId="660" LastActivityDate="2014-08-13T03:29:28.240" Title="Unknown error occurred after install on MAMP" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1855" PostTypeId="1" AcceptedAnswerId="2736" CreationDate="2014-08-13T01:52:09.130" Score="2" ViewCount="427" Body="&lt;p&gt;The Admin login screen for my site is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The button to submit my credentials is greyed out and submission by pressing enter is not working either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to go about solving this one or updated the site to fix it if there is a bug?&lt;/p&gt;&#xA;" OwnerUserId="662" LastEditorUserId="662" LastEditDate="2016-07-12T06:32:32.280" LastActivityDate="2016-07-12T06:32:32.280" Title="Control Panel access. Greyed out button" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2014-09-25T08:00:16.447" ContentLicense="CC BY-SA 3.0" />
  <row Id="1856" PostTypeId="2" ParentId="1854" CreationDate="2014-08-13T03:29:28.240" Score="1" Body="&lt;p&gt;Chances are your &lt;code&gt;craft/config&lt;/code&gt; folder isn't &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow&quot;&gt;writable&lt;/a&gt;, but you can see the underlying error in your craft/config/storage/runtime/logs files.  Just search for [error] or [warning].&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T03:29:28.240" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1857" PostTypeId="2" ParentId="1855" CreationDate="2014-08-13T03:32:31.543" Score="1" Body="&lt;p&gt;If your look at your browser's console on that page you'll see your getting several JavaScript errors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XQWQC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which seems to indicate that some of your files didn't FTP up properly and are corrupted.  Try re-uploading your files and make sure your FTP client is set to transfer in 'auto' mode.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T03:32:31.543" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1858" PostTypeId="2" ParentId="1853" CreationDate="2014-08-13T03:36:53.107" Score="2" Body="&lt;p&gt;Not natively, but it would be pretty easy for a plugin to add a widget that does something like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see anything currently on &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt; that would fit that bill, unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T03:36:53.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1859" PostTypeId="2" ParentId="1834" CreationDate="2014-08-13T04:29:06.547" Score="6" Body="&lt;p&gt;It sounds like you want utmost flexibility. So instead of trying to write any code for you, let me just describe all of the tools which should make this possible...&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To begin, you definitely want a &lt;strong&gt;Structure&lt;/strong&gt; section. Then your clients will have the complete control that you are looking for... adding, removing, and rearranging their entries (aka pages).&lt;/p&gt;&#xA;&lt;h3&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;This one is pretty obvious. Run the whole section through a &lt;code&gt;nav&lt;/code&gt; tag like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in craft.entries.section('pages') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Within that loop, you can use some of these other tools...&lt;/p&gt;&#xA;&lt;h3&gt;&lt;code&gt;{% ifchildren %}&lt;/code&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Also pretty obvious. You'll need this to run sub-loops for all of your nested entries. Every time an entry contains sub-entries, this Twig tag will be triggered (no matter how deep it goes).&lt;/p&gt;&#xA;&lt;h3&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#hasDescendants&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entry.hasDescendants()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Optional. If you want to check if an entry has any children without actually navigating down that branch, you can use this function. In fact, many of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#methods&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;EntryModel&lt;/code&gt; methods&lt;/a&gt; can be useful to you in various circumstances.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#level&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entry.level&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;This will tell you exactly what level you are on. So for example, &amp;quot;1&amp;quot; is the top level, &amp;quot;2&amp;quot; is their respective children, etc.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#type&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;entry.type&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;If you're using various entry types (which you probably are), then this will help you sort out which type of entry you're dealing with at that exact moment.&lt;/p&gt;&#xA;&lt;h3&gt;Bonus: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;You can wrap the whole nav in a &lt;code&gt;cache&lt;/code&gt; tag to make it easier for the system to deal with in the future.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you feel like I missed something, or that you still don't have the control that you want, just let me know what you're trying to accomplish. I can 99% guarantee that there is an existing Craft way of handling it.&lt;/p&gt;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-08-13T04:29:06.547" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1860" PostTypeId="1" CreationDate="2014-08-13T06:53:52.763" Score="1" ViewCount="730" Body="&lt;p&gt;I have a section called 'news' (url: /news) and have setup in my templates folder /news/index.html which I could access previously.&#xA;I then created a route: news/* to go to another template and then deleted it. I can now no longer access /news and it gives the 404 error page.&#xA;I have duplicated the news template and renamed it to newsblah and when I go to the url /newsblah I can view the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have cleared the cache on the settings page. Any ideas as to why this may be? very puzzling...&lt;/p&gt;&#xA;" OwnerUserId="448" LastEditorUserId="448" LastEditDate="2014-08-13T23:08:13.157" LastActivityDate="2014-08-14T04:53:20.857" Title="404 on template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1861" PostTypeId="1" CreationDate="2014-08-13T07:13:28.220" Score="4" ViewCount="542" Body="&lt;p&gt;I have a navigation like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navi = craft.entries.id('2, 4, 5, 6' ).order('id asc') %} &#xA;&amp;lt;nav&amp;gt;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for entry in navi %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; {% if entry.url == craft.request.geturl %}class=&quot;active&quot;{% endif %}&amp;gt;{{ entry.naviTitel }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home&lt;/li&gt;&#xA;&lt;li&gt;Projects&lt;/li&gt;&#xA;&lt;li&gt;About&lt;/li&gt;&#xA;&lt;li&gt;Contact&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now under Projects (Wich is a Single entry) are entry pages like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;url/projects/project_entry_1&lt;/li&gt;&#xA;&lt;li&gt;url/projects/project_entry_2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now what I'm trying to achieve is that when viewing a project_entry, the nav link &quot;Project&quot; should have the class active which is not the case right now. Is this somehow possible with this navi markup or do I have to write something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I taught about writing a conditional {% if url_segment 2 == project %} but that doesn't work because this would give all links the class active and since I have a multi-language installation segment_2 is not always the single slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the prettiest way to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-08-13T08:20:48.717" Title="Set parent nav to active" Tags="&lt;navigation&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1862" PostTypeId="2" ParentId="1861" CreationDate="2014-08-13T08:20:48.717" Score="2" Body="&lt;p&gt;You need to get all possible translations of your entry slug to do a thorough comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only possible with additional DB queries (ElementCriteriaModels) for each of your navigation items and each of your installed locales, if you don't want to hardcode the values into your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because your navigation probably doesn't change that often, I'd do it anyways and simply wrap the whole navigation in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tags with a really long invalidation time (it does get updated if anything is changed within the tags though!).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache for 3 years %}&#xA;{% for naviItem in navi %}&#xA;&#xA;    {# Get the relevant URL segment #}&#xA;    {% set segment = craft.request.segment(1) %}&#xA;&#xA;    {# Get all possible translations of the entry slug #}&#xA;    {% set enSlug = craft.entries.id(naviItem.id).locale('en').first().uri %}&#xA;    {% set frSlug = craft.entries.id(naviItem.id).locale('fr').first().uri %}&#xA;    {% set deSlug = craft.entries.id(naviItem.id).locale('de').first().uri %}&#xA;&#xA;    {# Define a variable `activeClass` if the URL segment matches one of the slug translations #}&#xA;    {% if segment == enSlug or segment == frSlug or segment == deSlug %}&#xA;        {% set activeClass = ' active' %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        {# If the `activeClass` var is set, add its value to the link's classes #}&#xA;        &amp;lt;a href=&quot;{{ naviItem.url }}&quot; class=&quot;defaultClasses{{ activeClass ? activeClass }}&quot;&amp;gt;&#xA;            {{ naviItem.naviTitel }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-13T08:20:48.717" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1863" PostTypeId="1" AcceptedAnswerId="1865" CreationDate="2014-08-13T11:09:47.210" Score="5" ViewCount="2173" Body="&lt;p&gt;Just wondering if there's a way to return the matrix block number during the loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;  {% if block.type == &quot;quote&quot; %}&#xA;    &amp;lt;blockquote class=&quot;quote{{GET_BLOCK_NUMBER}}&quot;&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ block.quote }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Might return something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote class=&quot;quote1&quot;&amp;gt;&#xA;  &amp;lt;p&amp;gt;Curabitur aliquet quam id dui posuere blandit.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&amp;lt;blockquote class=&quot;quote2&quot;&amp;gt;&#xA;  &amp;lt;p&amp;gt;Curabitur aliquet quam id dui posuere blandit.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&amp;lt;blockquote class=&quot;quote3&quot;&amp;gt;&#xA;  &amp;lt;p&amp;gt;Curabitur aliquet quam id dui posuere blandit.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks, Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-08-13T11:39:41.070" Title="Return Matrix Field block number" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1865" PostTypeId="2" ParentId="1863" CreationDate="2014-08-13T11:39:41.070" Score="8" Body="&lt;p&gt;Yes that's possible, all Twig loops have a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;loop&lt;/code&gt; variable&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;loop.index&lt;/code&gt; - The current iteration of the loop. (1 indexed)&lt;br&gt;&#xA;  &lt;code&gt;loop.index0&lt;/code&gt; - The current iteration of the loop. (0 indexed)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;  {% if block.type == &quot;quote&quot; %}&#xA;    &amp;lt;blockquote class=&quot;quote{{ loop.index }}&quot;&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ block.quote }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-13T11:39:41.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1866" PostTypeId="2" ParentId="1805" CreationDate="2014-08-13T14:16:30.867" Score="1" Body="&lt;p&gt;By default, Garnish.Modal will automatically close other modals when &lt;a href=&quot;https://github.com/pixelandtonic/Garnish/blob/master/Source/classes/Modal.js#L91&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;show()&lt;/code&gt;&lt;/a&gt; is called (which happens automatically when you first create it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That behavior can be overridden by setting the &lt;code&gt;closeOtherModals&lt;/code&gt; setting to &lt;code&gt;false&lt;/code&gt;, though:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var myModal = new Garnish.Modal($container, {&#xA;    closeOtherModals: false&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-13T14:16:30.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1867" PostTypeId="5" CreationDate="2014-08-13T14:24:47.760" Score="0" Body="&lt;p&gt;Garnish is a Javascript library developed by Pixel &amp;amp; Tonic for Craft and other P&amp;amp;T software. It contains several classes that handle the heavy lifting behind common application UI elements, such as drag-and-drop, modal windows, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft only ships with a compressed version of Garnish, but all of the source code is publicly available on GitHub: &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/garnishjs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-08-22T16:59:11.367" LastActivityDate="2016-08-22T16:59:11.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1868" PostTypeId="4" CreationDate="2014-08-13T14:24:47.760" Score="0" Body="The Javascript UI library used by Craft." OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-13T14:24:47.760" LastActivityDate="2014-08-13T14:24:47.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1869" PostTypeId="1" AcceptedAnswerId="1951" CreationDate="2014-08-13T14:26:45.633" Score="3" ViewCount="728" Body="&lt;p&gt;In the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1712/check-if-entry-is-defined-within-a-plugin-for-a-404-check&quot;&gt;previous question&lt;/a&gt; I asked for a way to detect the 404 page from a plugin. &lt;a href=&quot;https://craftcms.stackexchange.com/users/9/brandon-kelly&quot;&gt;Brandon&lt;/a&gt; gave me a good starting point with &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1715/how-can-i-get-the-requested-entry-from-a-plugin&quot;&gt;this answer&lt;/a&gt;. However, I wondered what method I could use to also detect wether the user is on any category/channel index page?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-03T16:10:20.010" Title="How to check if on a channel/category index?" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1870" PostTypeId="1" CreationDate="2014-08-13T14:38:32.257" Score="6" ViewCount="2435" Body="&lt;p&gt;Is there any reason you wouldn't want to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: More info&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a website that was built in HTML/CSS and over the years, it's been modified, added to and hacked at to the point where the code is kind of a mess. I'd like to redesign the site using a structured CMS but I want the base HTML/CSS to be well coded and optimized. That's why I'm thinking of building a site using the Bootstrap framework and then rebuilding it in Craft. I realize this seems redundant but I'm not good enough with CSS to just build it from the scratch in Craft. I'm more of the cut and paste kind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I'm considering Craft is because I like the idea of defining fields and sections I can reuse. I built the site 90% through using ModX, it looked good but the back end and the way it presents Template Variables is not very friendly. I like Craft's approach a lot more.&lt;/p&gt;&#xA;" OwnerUserId="660" LastEditorUserId="22" LastEditDate="2017-05-10T00:22:39.617" LastActivityDate="2017-05-10T00:22:39.617" Title="Has anyone converted a Bootstrap based website to Craft?" Tags="&lt;frontend&gt;&lt;craft-features&gt;" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1871" PostTypeId="1" AcceptedAnswerId="1875" CreationDate="2014-08-13T14:51:26.010" Score="3" ViewCount="298" Body="&lt;p&gt;Puzzle of the day: How does one load paginated entries on a different template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say in my homepage I'm loading the latest 5 entries and I would like to have pagination links below, however I want these to load on a different template. (in order to have less rings and bells than on the homepage)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use routes but it doesn't seem to be working, is this because the pagination works from the original template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I tried for &lt;strong&gt;example.com&lt;/strong&gt; where &lt;strong&gt;example.com/p2&lt;/strong&gt; is paginated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'(?P&amp;lt;page&amp;gt;\d+)'     // page must be the answer, right?       nope...&#xA;'p(?P&amp;lt;number&amp;gt;\d+)'  // let's try combining 'p' and a number  nope...&#xA;'p\d+'              // how about with just the regex?        nope...&#xA;'(?P&amp;lt;page&amp;gt;)'        // also targets homepage so...           nope...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried doing it in the CP with no results.&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="250" LastEditDate="2014-10-05T15:59:18.047" LastActivityDate="2014-10-05T15:59:18.047" Title="Use different template for paginated entries" Tags="&lt;templating&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1872" PostTypeId="2" ParentId="1870" CreationDate="2014-08-13T15:09:22.243" Score="1" Body="&lt;p&gt;Can you add a little more information? I'm not sure I understand the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bootstrap is a front-end framework, it can be used in combination with Craft. Not necessarily &lt;em&gt;replace&lt;/em&gt; it. So you wouldn't be &quot;converting it&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you're referring to converting a static site that uses Bootstrap as its framework, it's going to depend on &lt;em&gt;the needs of the website&lt;/em&gt; whether you want to use Craft or not. I've found that Craft works well in many scenarios but there are always exceptions.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-08-13T15:09:22.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1873" PostTypeId="1" CreationDate="2014-08-13T15:10:20.087" Score="1" ViewCount="667" Body="&lt;p&gt;I know this is bad practice but it's just for dev sites and there's no easy way around it with our current hosting provider. Anyway, I have my craft folder next to my index.php and $craftpath set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = './craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /chroot/home/rizencre/rizenweb.com/html/terravant/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="377" LastEditorUserId="125" LastEditDate="2014-08-13T17:58:51.260" LastActivityDate="2014-08-13T17:58:51.260" Title="Intalling Craft in the webroot folder" Tags="&lt;config&gt;&lt;install&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1874" PostTypeId="2" ParentId="1870" CreationDate="2014-08-13T15:10:20.817" Score="2" Body="&lt;p&gt;Bootstrap strictly refers to the front-end framework used as a starting point. It doesn't provide any back-end functionality so there's no clash with what Craft provides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Now that you've provided more details it sounds like Craft would be a fine solution. It's not hard to take your existing code and integrate it with Craft. The learning curve that you may face based on your self-evaluation of your skillset would be tackling Twig and really understanding how twig works for templating. But we're here to help :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT pt2: &#xA;This is a helpful resource: &lt;a href=&quot;http://straightupcraft.com/twig-templating&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/twig-templating&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="82" LastEditDate="2014-08-13T16:51:33.740" LastActivityDate="2014-08-13T16:51:33.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1875" PostTypeId="2" ParentId="1871" CreationDate="2014-08-13T15:15:15.183" Score="5" Body="&lt;p&gt;I don't know if there's a route way to handle this, but you could do a conditional on the &lt;code&gt;craft.request&lt;/code&gt; method &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getPageNum&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getPageNum()&lt;/code&gt;&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPageNum == 1 %}&#xA;    &amp;lt;!-- Header for the home page --&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;!-- Header for pagination pages --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-13T15:15:15.183" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1876" PostTypeId="2" ParentId="1873" CreationDate="2014-08-13T15:39:35.660" Score="2" Body="&lt;p&gt;I just tested it for you and this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = './craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = 'craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;does both work for me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This probably doesn't help you much; I only wanted to confirm, that your &lt;code&gt;$craftPath = './craft';&lt;/code&gt; config should be working for your file structure.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-13T17:58:09.220" LastActivityDate="2014-08-13T17:58:09.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1877" PostTypeId="1" CreationDate="2014-08-13T15:46:56.793" Score="2" ViewCount="428" Body="&lt;p&gt;I understand how to set up a route and template that allows me to display entries by tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I set up a template + route to grab multiple tags (if supplied but could just be one) from the url and display entires that have these tags?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to add a category element (showing all the entires from a category with the selected tags) but suspect much of that may be answered by the first part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a form the builds a url depending on user selections&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysite/queryurl&amp;amp;tags=cheese,egg,bacon&amp;amp;cat=sandwich&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="487" LastActivityDate="2014-08-14T14:07:07.570" Title="Create a route to display entries with multiple tags" Tags="&lt;tags&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1878" PostTypeId="1" AcceptedAnswerId="2355" CreationDate="2014-08-13T15:55:05.613" Score="11" ViewCount="2745" Body="&lt;p&gt;Not sure of the best way to progress with this but i'm trying to create an advanced search on a Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it needs is a select dropdown for Authors, Categories and a normal text input. The search options can be stacked and used singularly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying a couple of things  which I'll post here if they work but any assistance would be grand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the basics to being with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;search&quot; action=&quot;{{ url('news/results') }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col col-33&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Category&amp;lt;/label&amp;gt;&#xA;        &amp;lt;div class=&quot;filter&quot;&amp;gt;&#xA;            &amp;lt;select name=&quot;c&quot;&amp;gt;&#xA;            {% set categories = craft.categories.find({ group: 'news' }) %}&#xA;                {% for category in categories %}&#xA;                &amp;lt;option&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col col-33&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Keywords&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;q&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col col-33&quot;&amp;gt;&#xA;         &amp;lt;button type=&quot;submit&quot; class=&quot;btn search&quot;&amp;gt;&#xA;                Begin Search&#xA;         &amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then on the &quot;search results&quot; page for example...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q', 'c') %}&#xA;    {% set entries = craft.entries.search(query).order('score').section('news').limit(10) %}&#xA;&#xA;        {% if entries|length %}&#xA;&#xA;            {% for entry in entries %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        {% else %}&#xA;            &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know i'm probably missing something extremely obvious here as i'm sure it's fairly simple to achieve.&lt;/p&gt;&#xA;" OwnerUserId="665" LastEditorUserId="665" LastEditDate="2014-08-15T14:54:02.343" LastActivityDate="2014-09-04T15:29:34.357" Title="Advanced Search" Tags="&lt;categories&gt;&lt;search&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1879" PostTypeId="1" AcceptedAnswerId="1903" CreationDate="2014-08-13T16:11:41.063" Score="3" ViewCount="231" Body="&lt;p&gt;Is it possible to control what gets output in the template a custom fieldtype?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example im working on a eventbrite plugin and it saves the id in the database but I want the field in the template to return a fully formatted register button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now im doing this with a craft variable that i'm passing the id and returns the html for the button into but feels like there might be a simpler way?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Related to that right now i have to add | raw to the variable output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so its &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.eventBrite.registerButton(entry.eventbriteId) | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is there a way to prevent the escaping of whats being returned without the extra filter in the template?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-08-13T23:42:48.467" LastActivityDate="2014-08-13T23:42:48.467" Title="How do you customize what value a Custom FieldType returns to a template" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1880" PostTypeId="1" AcceptedAnswerId="1923" CreationDate="2014-08-13T16:15:09.917" Score="2" ViewCount="276" Body="&lt;p&gt;We're experimenting with using &lt;a href=&quot;http://fastly.com&quot; rel=&quot;nofollow&quot;&gt;Fastly&lt;/a&gt; for full-site caching of a Craft site. Everything is working great so far, with the exception that Fastly obviously has no way to know when a URL's cache has been invalidated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We were thinking that the easiest way to make this work would be to use Craft's built-in caching and create a simple plugin that listens for Craft to invalidate a URL's cache (such as when updating an Entry referenced by that cache) and call out to Fastly to clear its cache for the same URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, as far as I can tell, Craft doesn't provide an Event for when it updates its own caches. Am I missing something? Any tips on how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="414" LastEditDate="2014-08-13T18:26:44.277" LastActivityDate="2014-08-15T03:58:35.377" Title="How to clear a third-party cache when Craft updates its own template caches" Tags="&lt;caching&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1882" PostTypeId="2" ParentId="1879" CreationDate="2014-08-13T16:42:01.020" Score="4" Body="&lt;p&gt;Run your HTML string through &lt;code&gt;getRaw&lt;/code&gt; before sending it back to the template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return TemplateHelper::getRaw($output);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will basically &quot;pre-raw&quot; your HTML string.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-13T16:42:01.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1883" PostTypeId="2" ParentId="1870" CreationDate="2014-08-13T17:06:17.683" Score="1" Body="&lt;p&gt;I think it's actually a good idea to first build parts of the site with some static HTML/CSS and later implement the Craft code (in form of &lt;a href=&quot;http://twig.sensiolabs.org&quot; rel=&quot;nofollow&quot;&gt;Twig&lt;/a&gt;, the tempting language used by Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would't need to convert your site for this process, because Craft template files are  normal HTML files with Twig code in-between. Yes, you probably want to refactor your code and the template files a bit, maybe make use of &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;includes&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/block.html&quot; rel=&quot;nofollow&quot;&gt;blocks&lt;/a&gt; etc., but using a static HTML page as a starting point for your new Craft site can be really helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh.. and believe me, while you're learning Craft and about all the features, you'll most likely want to refactor parts of your code more than once. :D&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-13T17:06:17.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1884" PostTypeId="2" ParentId="1873" CreationDate="2014-08-13T17:21:53.423" Score="2" Body="&lt;p&gt;Usually when this happens and you're positive the &lt;code&gt;$craftPath&lt;/code&gt; path is correct, it's one of two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;PHP doesn't have permissions to be able to read the &lt;code&gt;craft&lt;/code&gt; folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your host has &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.open-basedir&quot; rel=&quot;nofollow&quot;&gt;open_basedir&lt;/a&gt; restrictions in place preventing PHP from reading the &lt;code&gt;craft&lt;/code&gt; folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T17:21:53.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1885" PostTypeId="2" ParentId="1877" CreationDate="2014-08-13T17:34:38.397" Score="4" Body="&lt;p&gt;As long as you're using commas to separate the tag names in the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com?queryurl&amp;amp;tags=cheese,egg,bacon&amp;amp;cat=sandwich&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you should be able to retrieve the multiple tags like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagsString = craft.request.getParam('tags') %}&#xA;&#xA;{% set tags = craft.tags.name(tagsString).find() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for tag in tags %}&#xA;        &amp;lt;li&amp;gt;{{ tag.name }}&amp;lt;/li&amp;gt;&#xA;   {% endfor %}&#xA;{/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T17:34:38.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1886" PostTypeId="1" CreationDate="2014-08-13T17:50:10.640" Score="4" ViewCount="1487" Body="&lt;p&gt;How can I auto center and zoom my &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; with multiple markers?&#xA;Something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var bounds = new smartMap.map.LatLngBounds();&#xA;smartMap.map.fitBounds(bounds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="45" LastEditDate="2021-01-01T05:36:00.880" LastActivityDate="2021-01-01T05:41:03.607" Title="How do you auto zoom/center Smart Map with multiple markers?" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1887" PostTypeId="1" AcceptedAnswerId="1893" CreationDate="2014-08-13T18:31:09.570" Score="3" ViewCount="250" Body="&lt;p&gt;And how do you set a different icon and infoWindow when a lightswitch or entry type?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.entries.section('section').find() %}&#xA;&#xA;{% set options = {&#xA;    'zoom': 5,&#xA;    'height': 750,&#xA;    'markerInfo': '_includes/infoBubble',&#xA;    markerOptions: {&#xA;        icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;    },&#xA;} %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-08-13T19:04:22.327" LastActivityDate="2014-08-15T09:41:26.660" Title="How do you set a different icon per entry in SmartMap?" Tags="&lt;plugins&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1888" PostTypeId="1" CreationDate="2014-08-13T18:53:11.087" Score="1" ViewCount="357" Body="&lt;p&gt;I am getting the following error when installing craft .. do you have any clue of what I might be doing wrong or missing out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uQWs8.png&quot; alt=&quot;Craft error during installation&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-08-13T19:01:21.160" Title="Installation stops with a 500 error" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1889" PostTypeId="2" ParentId="1888" CreationDate="2014-08-13T19:01:21.160" Score="2" Body="&lt;p&gt;The problem was related to the database already having a particular table defined. Was not so easy to find, some type of error would have made my life easier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution: Re-create the database. Re-run the installation process.&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-08-13T19:01:21.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1890" PostTypeId="2" ParentId="1886" CreationDate="2014-08-13T19:25:23.077" Score="5" Body="&#xA;&lt;p&gt;So for starters, let's clear something up for anyone visiting this thread:&lt;/p&gt;&#xA;&lt;p&gt;We're talking about &lt;strong&gt;JavaScript&lt;/strong&gt;... specifically, how to manipulate a map that has &lt;strong&gt;already been generated&lt;/strong&gt;. The official documentation on what kind of variables (maps/markers/info bubbles) which are created by the plugin &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/manipulating-the-map-in-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;can be found here...&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Beyond that, you can basically do anything you want with those JS variables. Much of that is beyond the scope of what I can help you with, but I'll try to at least point you in the right direction.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Map JS object&lt;/h3&gt;&#xA;&lt;p&gt;The way you'll want to refer to the map is like this:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;smartMap.map['smartmap-mapcanvas-1']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;By default, the map will be called &amp;quot;smartmap-mapcanvas-1&amp;quot; (or 2, 3, etc). But this value can be easily overridden when creating your map, by &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/customizing-the-map-in-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;using the &lt;code&gt;id&lt;/code&gt; parameter in your &lt;code&gt;options&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now that you've got this map object, you can do anything you want via the &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/reference#Map&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Maps API&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3&gt;Marker JS objects&lt;/h3&gt;&#xA;&lt;p&gt;When you're referring to &lt;strong&gt;individual markers&lt;/strong&gt;, the format looks like this:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;smartMap.marker['smartmap-mapcanvas-1.100.myAddressField']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That naming scheme breaks into three separate components:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your map ID (&amp;quot;smartmap-mapcanvas-1&amp;quot;)&lt;/li&gt;&#xA;&lt;li&gt;The element ID (&amp;quot;100&amp;quot;)&lt;/li&gt;&#xA;&lt;li&gt;The field handle (&amp;quot;myAddressField&amp;quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now that you've got this marker object, you can do anything you want via the &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/reference#Marker&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Maps API&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3&gt;Info bubble JS objects&lt;/h3&gt;&#xA;&lt;p&gt;The format for &lt;strong&gt;marker info bubbles&lt;/strong&gt; is nearly identical:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;smartMap.infoWindow['smartmap-mapcanvas-1.100.myAddressField']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now that you've got this info window object, you can do anything you want via the &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/reference#InfoWindow&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Maps API&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3&gt;Debugging&lt;/h3&gt;&#xA;&lt;p&gt;Finally, since it's not always clear what maps, markers, and info bubbles have been created, you have these three functions available to you for debugging purposes...&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;smartMap.listMaps()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;smartMap.listMarkers()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;smartMap.listInfoWindows()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Beyond that, you're really just asking a standard JavaScript and Google Maps API question. I'd highly recommend searching Stack Overflow (or just a Google search) to get the best results on &amp;quot;how to use fitBounds&amp;quot; or &amp;quot;how to zoom/center&amp;quot; a map.&lt;/p&gt;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T05:38:32.000" LastActivityDate="2021-01-01T05:38:32.000" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1893" PostTypeId="2" ParentId="1887" CreationDate="2014-08-13T19:52:17.353" Score="4" Body="&lt;p&gt;That's a tricky one... Natively, all of the &lt;code&gt;options&lt;/code&gt; are applied to all markers equally. But you can do a little workaround using something like this pseudo-code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markerIconJs  %}&#xA;&#xA;    // On page load&#xA;    $(function () {&#xA;&#xA;    {% for entry in locations %}&#xA;&#xA;        {% if entry.lightswitch %}&#xA;&#xA;            // JavaScript: Override the default icon with your own&#xA;            smartMap.marker['smartmap-mapcanvas-1.{{ entry.id }}.myAddressField'].setOptions({&#xA;                icon: '{{ entry.icon }}'&#xA;            });&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    });&#xA;&#xA;{% endset %}&#xA;&#xA;{% includeJs markerIconJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-08-15T09:41:26.660" LastActivityDate="2014-08-15T09:41:26.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1894" PostTypeId="1" CreationDate="2014-08-13T20:12:38.897" Score="4" ViewCount="607" Body="&lt;p&gt;We've unchecked the clean HTML feature on a few rich text fields but our attempts to add some html (span tags) keep getting cleaned out. Is there another setting we should be looking for?&lt;/p&gt;&#xA;" OwnerUserId="670" LastActivityDate="2015-09-29T03:05:02.693" Title="Unchecking Rich Text option to clean up HTML still cleaning?" Tags="&lt;field&gt;&lt;richtext&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1895" PostTypeId="2" ParentId="1468" CreationDate="2014-08-13T20:25:08.020" Score="2" Body="&lt;p&gt;Looking for the exact same answer I came across this question and would argue that joshangell's answer is the best if trying to simplify down from a for loop to one line of code.  The only issue is that the answer uses incorrect wrapping tags for an inline if statement.  So I submit this as the best answer for simplification and correct syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.backgroundImage | length ? block.backgroundImage.first().getUrl() : '' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just used it in my own project and it worked like a charm.&lt;/p&gt;&#xA;" OwnerUserId="669" LastActivityDate="2014-08-13T20:25:08.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1897" PostTypeId="1" CreationDate="2014-08-13T20:37:36.157" Score="2" ViewCount="749" Body="&lt;p&gt;When I try to upload an image, I am getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;imagepng(C:/wamp/craft/storage/runtime/temp/assets53ebcb012cffa3.92019251-temp.png): failed to open stream: Invalid argument (C:\wamp\craft\app\vendor\imagine\imagine\lib\Imagine\Gd\Image.php:691)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know what is going wrong?&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-08-13T21:24:17.443" Title="Upload asset failed to open stream: Invalid argument" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1898" PostTypeId="1" AcceptedAnswerId="1900" CreationDate="2014-08-13T20:48:24.173" Score="2" ViewCount="171" Body="&lt;p&gt;I am building a field type for Craft that needs to do additional processing to the saved data once the element id is available. For this reason, the &lt;code&gt;prepValueFromPost()&lt;/code&gt; method won't work, since the element id isn't available yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how to update the content of the current element from the &lt;code&gt;onAfterElementSave()&lt;/code&gt; method?&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="57" LastEditDate="2014-08-13T21:15:14.910" LastActivityDate="2014-08-13T22:08:50.430" Title="How do I update the content of a field type in the onAfterElementSave() method?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1899" PostTypeId="2" ParentId="1894" CreationDate="2014-08-13T21:05:07.437" Score="2" Body="&lt;p&gt;If you are using a custom redactor config (defined in /craft/config/redactor) and it has &lt;code&gt;allowedTags&lt;/code&gt; in the configuration, that list of allowed tags will need to include span&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-13T21:05:07.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1900" PostTypeId="2" ParentId="1898" CreationDate="2014-08-13T21:14:51.087" Score="4" Body="&lt;p&gt;This will return the content for the specific element instance you're on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;element-&amp;gt;getContent()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And from there you can do your additional content processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're ready so save it, you can call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;content-&amp;gt;saveContent($this-&amp;gt;element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are several examples in &lt;code&gt;craft/app/fieldtypes&lt;/code&gt; folder where Craft's native field types do additional processing like this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-13T22:08:50.430" LastActivityDate="2014-08-13T22:08:50.430" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1901" PostTypeId="2" ParentId="1897" CreationDate="2014-08-13T21:24:17.443" Score="1" Body="&lt;p&gt;I'd check the permissions and make sure that Craft has write permissions to the craft/storage folder first.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-13T21:24:17.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1902" PostTypeId="2" ParentId="1827" CreationDate="2014-08-13T22:17:10.137" Score="2" Body="&lt;p&gt;Yeah, a simple checkboxes field with a list of the countries would be a good approach to realize this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is to make use of the &lt;a href=&quot;http://buildwithcraft.com/features/localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;localization feature&lt;/a&gt;, which comes with a Craft Pro license. Then you'd add a new structure entry (in your case the product) in one locale (e.g. &quot;fr&quot;), save it, and all entered content is copied over to the other locales (e.g. &quot;en&quot; and &quot;de&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that you can switch over to another locale's version of that entry, and make individual edits for it (e.g. change &quot;10 EUR&quot; to &quot;8 GBP&quot;). To disable an entry completely for one locale, use the status lightswitch available for each locale separately at the top right of the info panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ygQvD.png&quot; alt=&quot;Craft CP - Lightswitch to toggle entry status for each locale&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't read this as if this &quot;localization feature&quot; solution is the right one. Consider if you really need to translate entry fields (product infos etc.) into other languages&lt;sup&gt;1&lt;/sup&gt;, if not I'd definitely do it like you initially intended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there's also a chance that you want to use both of these features combined: if you want to list all entry pages translated for each locale and additionally show the visitors where these products are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1. &quot;Craft Personal and Craft Client store content on a per-locale basis too, so down the road if you want your site to cater to a second locale, Craft is already set up for it.&quot;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-13T22:17:10.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1903" PostTypeId="2" ParentId="1879" CreationDate="2014-08-13T23:39:40.613" Score="2" Body="&lt;p&gt;So I found the answer i was looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like if you add a prepValue function to your fieldtypes class it can perform any action you want on the value from your custom field before returning it to the template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PLUGINNAME_FIELDNAMEFieldType extends BaseFieldType&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('My Field\'s Name');&#xA;    }&#xA;&#xA;...&#xA;    public function prepValue($value)&#xA;    {&#xA;      // do stuff with value here like create a model, or just some conversion&#xA;      $newValue = $value.&quot; &amp;lt;strong&amp;gt;it works!&amp;lt;/strong&amp;gt;&quot;;&#xA;&#xA;      // newValue is whats returned to the template when you access via entry.customFieldName&#xA;      return TemplateHelper::getRaw($newValue);&#xA;&#xA;      // Note: TemplateHelper::getRaw isnt required it just included cause the newValue includes html that i want to render on the page, default behavior is to escape all html&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-08-13T23:39:40.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1904" PostTypeId="2" ParentId="1860" CreationDate="2014-08-14T04:53:20.857" Score="2" Body="&lt;p&gt;The issue was I had a section called news which was referencing a template that didn't exist. Craft saw that for the /news url it should call the template defined in the section, but as it didn't exist it was displaying the 'page not found' page.&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2014-08-14T04:53:20.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1905" PostTypeId="1" AcceptedAnswerId="1934" CreationDate="2014-08-14T10:09:50.673" Score="3" ViewCount="3797" Body="&lt;p&gt;I am trying to import from Wordpress, so originally installed the Import plugin which worked but I needed xml not csv. So I uninstalled that and installed another, but now no matter what plugin I try to install, nothing shows up!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I tried resetting cache etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Adding more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to install multiple plugins since the original one, the current plugin that I have in the plugins folder is 'craftimport-master' with all the correct files inside it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugins page just says &quot;There are no available plugins.&quot; with no errors.&#xA;I've tried running Clear Caches and Rebuild Search Indexes, just in case it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried updating to Pro (using craft.dev) but that didn't change it either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the current file structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VF6AD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VF6AD.png&quot; alt=&quot;file structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh and there was an error when I uninstalled the first plugin but it redirected me almost instantly so I don't know what it said.&lt;/p&gt;&#xA;" OwnerUserId="633" LastEditorUserId="45" LastEditDate="2017-07-17T17:31:58.973" LastActivityDate="2017-07-17T17:31:58.973" Title="Why are my plugins not showing?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1906" PostTypeId="1" CreationDate="2014-08-14T12:15:21.997" Score="3" ViewCount="1602" Body="&lt;p&gt;I found out that the functions count and total on the elementCriteriaModel show different results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following examples gave different results. &lt;code&gt;paginate.total&lt;/code&gt; was the same as &lt;code&gt;total&lt;/code&gt;, but not correct. Only count showed me the correct answer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries(filterParams).section('object').order('title asc').limit(resultsLimit) as results %}&#xA;&#xA;Total results:{{ paginate.total }}&#xA;&#xA;{% set total =  craft.entries(filterParams).section('object').order('title asc').total() %}&#xA;{% set count =  craft.entries(filterParams).section('object').order('title asc').count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="306" LastEditorUserId="57" LastEditDate="2014-08-14T20:45:22.527" LastActivityDate="2014-08-14T20:45:22.527" Title="What's the difference between total function and count function?" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1907" PostTypeId="2" ParentId="1877" CreationDate="2014-08-14T14:07:07.570" Score="1" Body="&lt;p&gt;Ok. I think I worked this out (with a little help from Brad and the search example page). Though there might be a better way of achieving the same result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;ul&amp;gt;Looking for:&#xA;    {% for tag in tags %}&#xA;        &amp;lt;li&amp;gt;{{ tag.name }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above demonstrates that Craft pulls the tags from the URL into the an array called &quot;tags&quot; automatically(?). For each entry I loop through these tags - for each one loop through the entries tags to see if they match. I set matchFound to false before starting and at the end of each entry. If I hit a matching tag I set it to true to remove entries being listed multiple times. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;&#xA;        {% for thisItemTag in entry.tags %}&#xA;&#xA;                {% set lookingFor = tag.name %}&#xA;                {% set currentTag = thisItemTag %}&#xA;&#xA;                &amp;lt;!-- &amp;lt;li&amp;gt;{{ thisItemTag }}&amp;lt;/li&amp;gt; --&amp;gt;&#xA;                {% if lookingFor == currentTag %}&#xA;                    {% if matchFound == false %}&#xA;                        {% set matchFound = true %}&#xA;                        &amp;lt;article class=&quot;product&quot;&amp;gt;&#xA;                            &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;/article&amp;gt;&#xA;                    {% endif %}&#xA;                {% endif %}&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;    {% set matchFound = false %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="487" LastActivityDate="2014-08-14T14:07:07.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1908" PostTypeId="2" ParentId="1812" CreationDate="2014-08-14T15:46:51.477" Score="0" Body="&lt;p&gt;Structures aren't available in the free version of Craft, but a useful workaround is to simply manipulate the entry published date to accomplish a custom sort, as Craft orders entries from newest to oldest by default. It's a hack, but it's useful in a pinch.&lt;/p&gt;&#xA;" OwnerUserId="372" LastActivityDate="2014-08-14T15:46:51.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1909" PostTypeId="2" ParentId="1812" CreationDate="2014-08-14T16:09:00.017" Score="1" Body="&lt;p&gt;Another option if you can't use structures is to have a global that is a collection of entries, and use that global to determine which entries and in what order.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for e in myGlobal.myEntries %}&#xA;  {{ e.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-14T16:09:00.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1910" PostTypeId="1" AcceptedAnswerId="1917" CreationDate="2014-08-14T16:34:20.043" Score="1" ViewCount="1243" Body="&lt;p&gt;My entry url structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://site.com/section/category/subcategory/entry_slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to drill down to specific entries by using the url structure and I'm currently having trouble getting the following to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set secondSeg = craft.request.getSegment(2) %}&#xA;{% set subCategories = craft.categories.group('section').level(2) %}&#xA;&#xA;{% for cat in subCategories.relatedTo(secondSeg).slug(lastSeg) %}&#xA;    {{category.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently nothing is returned. If I remove the .relatedTo(secondSeg) parameter in the cat loop, I'm properly getting all of the entries in child category that match the slug. But, the problem is that there is a possibility of certain entries having the same slug under different child categories. I'm not sure if I'm using the relatedTo parameter properly or not.&lt;/p&gt;&#xA;" OwnerUserId="425" LastEditorUserId="125" LastEditDate="2014-08-14T19:47:38.360" LastActivityDate="2014-08-14T19:47:38.360" Title="How do I get entries of a child category, related to a parent category, defined in a URL segment?" Tags="&lt;categories&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1911" PostTypeId="1" AcceptedAnswerId="1926" CreationDate="2014-08-14T17:05:16.897" Score="3" ViewCount="475" Body="&lt;p&gt;I'm trying to set up a sub nav from a Structure Section on my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainEntry = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;{% set subnav = craft.entries.descendantOf(mainEntry).level(2) %}&#xA;&#xA;{{ subnav.total() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But my when loop through sub nav below it returns nothing.&#xA;I am outputting subnav.total above but it is returning 0, but there is a lot of entries  in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mainEntry gets loaded with the correct info ok, but I don't get anything in subnav. &lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-08-15T07:04:45.223" Title="Structure Navigation - Not returning sub nav entries" Tags="&lt;entries&gt;&lt;navigation&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1912" PostTypeId="1" AcceptedAnswerId="1918" CreationDate="2014-08-14T18:25:46.670" Score="3" ViewCount="182" Body="&lt;p&gt;So while building a field type (FT), what is the expected data type of the returned value from the prepValue method? I am not sure I am using this method right, as I am running into a PHP error when trying to save the FT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My FT stores data in two ways, the first as a JSON string stored in the element content table. When my FT is saved, I used the &lt;code&gt;onAfterElementSave()&lt;/code&gt; method for additional processing. During this method, I am creating rows in a db table created by my plugin. What I desire to happen is when I call my field from the template on the front-end, it returns a data model which I can then pass to other methods for further manipulation (in the template). All this works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &lt;code&gt;prepValue()&lt;/code&gt; code in my FT. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValue($value)&#xA;{&#xA;    $value = json_decode($value);&#xA;&#xA;    return new MyPlugin_MyModelNameModel((array) $value);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All this works fine until I go to save my entry, which is producing this error &quot;Internal Server Error - Object of class stdClass could not be converted to string&quot;. When I return the data from the &lt;code&gt;prepValue()&lt;/code&gt; method as a string, it works fine when saving but then break in the template because it's expecting to be a model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even added a &lt;code&gt;__toString()&lt;/code&gt; method to my model in hopes that if the data needs to be a string, my model could dynamically pass the JSON back as a string but that isn't working either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the stack trace from the craft.log&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/08/14 19:28:35 [error] [php] Object of class stdClass could not be converted to string (/Users/justinkimbrell/Sites/craft_dev/craft/app/helpers/StringHelper.php:61)&#xA;Stack trace:&#xA;#0 /Users/justinkimbrell/Sites/craft_dev/craft/app/fieldtypes/BaseFieldType.php(148): arrayToString()&#xA;#1 /Users/justinkimbrell/Sites/craft_dev/craft/app/services/ContentService.php(366): Craft\GoogleMaps_GoogleMapFieldType-&amp;gt;getSearchKeywords()&#xA;#2 /Users/justinkimbrell/Sites/craft_dev/craft/app/services/ContentService.php(137): Craft\ContentService-&amp;gt;_updateSearchIndexes()&#xA;#3 /Users/justinkimbrell/Sites/craft_dev/craft/app/services/ElementsService.php(898): Craft\ContentService-&amp;gt;saveContent()&#xA;#4 /Users/justinkimbrell/Sites/craft_dev/craft/app/services/EntriesService.php(141): Craft\ElementsService-&amp;gt;saveElement()&#xA;#5 /Users/justinkimbrell/Sites/craft_dev/craft/app/controllers/EntriesController.php(440): Craft\EntriesService-&amp;gt;saveEntry()&#xA;#6 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;#7 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#8 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/web/CController.php(286): Craft\EntriesController-&amp;gt;runAction()&#xA;#9 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/web/CController.php(265): Craft\EntriesController-&amp;gt;runActionWithFilters()&#xA;#10 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/web/CWebApplication.php(282): Craft\EntriesController-&amp;gt;run()&#xA;#11 /Users/justinkimbrell/Sites/craft_dev/craft/app/etc/web/WebApp.php(865): Craft\WebApp-&amp;gt;runController()&#xA;#12 /Users/justinkimbrell/Sites/craft_dev/craft/app/etc/web/WebApp.php(254): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /Users/justinkimbrell/Sites/craft_dev/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 /Users/justinkimbrell/Sites/craft_dev/craft/app/index.php(196): Craft\WebApp-&amp;gt;run()&#xA;#15 /Users/justinkimbrell/Sites/craft_dev/public/index.php(14): require_once()&#xA;REQUEST_URI=/index.php/admin/entries/news/47&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully the issue is clear. I am just unsure of how to properly use this method, and wondering how I can return data in a model and not as a string.&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="19" LastEditDate="2014-08-14T19:29:49.587" LastActivityDate="2014-08-14T19:47:38.263" Title="What is the expected data type to be returned when using the prepValue() method?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1913" PostTypeId="1" CreationDate="2014-08-14T18:27:54.747" Score="5" ViewCount="1787" Body="&lt;p&gt;I'm new to Craft template development and one of the first things I'm trying to do is create a &lt;code&gt;Variable&lt;/code&gt; that renders a template into the template its called from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My directory structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;  /plugins&#xA;    /test&#xA;      /templates&#xA;        _headers.html&#xA;      /variables&#xA;        TestVariable.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the Variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class TestVariable&#xA;{&#xA;    /**&#xA;     * Get header for test code&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function headers()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('test/_headers');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'm calling it in the template with a simple: &lt;code&gt;{{ craft.test.headers }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template is erroring with &lt;code&gt;Unable to find the template “test/_headers”.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I misunderstanding here?&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="45" LastEditDate="2014-08-14T19:14:06.567" LastActivityDate="2014-08-15T03:32:44.170" Title="Plugin Variable can't find template" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1914" PostTypeId="1" CreationDate="2014-08-14T18:41:26.340" Score="1" ViewCount="285" Body="&lt;p&gt;I am trying to get a certain segment of the url. For this i’m setting the slug as a variable which seems to be best practice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.getSegment(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am interested in the second segment which is &lt;a href=&quot;http://example.com/projects/awesome-project&quot; rel=&quot;nofollow&quot;&gt;http://example.com/projects/awesome-project&lt;/a&gt; where “awesome-project” is the desired part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never had any problem with this method but in this case it &lt;em&gt;always&lt;/em&gt; returns the first segment (projects), regardless of the passed argument. The site is localized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried various things but am completely clueless, atm. This can be reproduced with every template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be the culprit?&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-08-14T18:48:18.057" Title="Having trouble setting/getting slug" Tags="&lt;slug&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1915" PostTypeId="2" ParentId="1914" CreationDate="2014-08-14T18:48:18.057" Score="2" Body="&lt;p&gt;Got it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Had already set the slug variable to the first segment in _layout.twig thus overriding everything after. m(&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-08-14T18:48:18.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1917" PostTypeId="2" ParentId="1910" CreationDate="2014-08-14T19:46:07.940" Score="4" Body="&lt;p&gt;I don't think that there's a &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;&quot;relation&quot;&lt;/a&gt; between categories and their sub-categories.&#xA;But that's what you currently have as a parameter on &lt;code&gt;craft.categories&lt;/code&gt;.&#xA;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories#ancestorOf&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ancestorOf()&lt;/code&gt;&lt;/a&gt; parameter instead to filter your subcategories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainCategory = craft.categories.group('section').level(1).slug(secondSeg).first() %}&#xA;{% set secondLevelCategories = craft.categories.ancestorOf(mainCategory).slug(lastSeg) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-14T19:46:07.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1918" PostTypeId="2" ParentId="1912" CreationDate="2014-08-14T19:47:38.263" Score="3" Body="&lt;p&gt;Looks like the error is occurring when your field type’s &lt;code&gt;getSearchKeywords()&lt;/code&gt; function is called. The value that’s passed into that function will have already been run through &lt;code&gt;prepValue()&lt;/code&gt;, so at that point it looks like it will be a &lt;code&gt;MyPlugin_MyModelNameModel&lt;/code&gt; instance (whatever the actual class name is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your field type doesn’t override &lt;code&gt;getSearchKeywords()&lt;/code&gt;, the BaseFieldType version will just pass the value off to StringHelper::arrayToString(), which will do its best to convert whatever variable it was passed into a string. Something in there must be tripping it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet here is probably to just override &lt;code&gt;getSearchKeywords()&lt;/code&gt; in your field type. It should be returning a space-delimited list of keywords you want to be stored for the current field value.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-14T19:47:38.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1919" PostTypeId="2" ParentId="1906" CreationDate="2014-08-14T20:36:41.213" Score="3" Body="&lt;p&gt;&lt;code&gt;.count&lt;/code&gt; will return the total results for a particular paginated page (in your case, it should be the same as the &lt;code&gt;resultsLimit&lt;/code&gt; variable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.total&lt;/code&gt; will return the number of results in the entire results object regardless of pagination.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-08-14T20:36:41.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1920" PostTypeId="1" CreationDate="2014-08-14T22:29:45.417" Score="4" ViewCount="116" Body="&lt;p&gt;Im curious if folks have found an easy way to stage template updates for a craft site thats already live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally we have branch in the repo for the new version which works fine but on the server if we want to share them with the client ideally wed just use stage.sitedomain.com or something&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now we are replicating the whole craft setup in a different location for a sub-domain and just sharing the database, is there a way to share a craft folder and just have a different templates folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually looking to move some of this to vagrant cloud for staging environments but not quite there yet&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="45" LastEditDate="2018-08-20T21:37:07.883" LastActivityDate="2018-08-20T21:37:07.883" Title="Easy way to stage template updates for a live site" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1922" PostTypeId="2" ParentId="1913" CreationDate="2014-08-15T03:32:44.170" Score="5" Body="&lt;p&gt;Just added this note to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates&quot; rel=&quot;noreferrer&quot;&gt;Plugin Templates&lt;/a&gt; documentation, which should answer your question:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft will only automatically look for templates within the plugin folders for CP requests. If you are going to be calling TemplatesService::render() from a front end site request, you will need to manually tell Craft where to find your template using &lt;a href=&quot;http://buildwithcraft.com/docs/apis/pathservice#setTemplatesPath&quot; rel=&quot;noreferrer&quot;&gt;PathService::setTemplatesPath()&lt;/a&gt; first:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;$newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'pluginHandle/templates';&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath)&#xA;$html = craft()-&amp;gt;templates-&amp;gt;render('path/to/template');&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;If you do this, you won’t be needing to begin the template path with your plugin handle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-15T03:32:44.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1923" PostTypeId="2" ParentId="1880" CreationDate="2014-08-15T03:58:35.377" Score="1" Body="&lt;p&gt;Can't think of any clever workarounds, but this is on our 2.2 list to add events so that 3rd party services can be notified when template caches get invalidated.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-15T03:58:35.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1924" PostTypeId="1" CreationDate="2014-08-15T06:23:25.863" Score="4" ViewCount="377" Body="&lt;p&gt;I am hoping to write a plug-in to cache pages as static HTML. Is there a hook that would give me access to the full rendered HTML of a page? &lt;/p&gt;&#xA;" OwnerUserId="677" LastActivityDate="2014-08-15T22:25:17.100" Title="Hook into rendered templates?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1926" PostTypeId="2" ParentId="1911" CreationDate="2014-08-15T07:04:45.223" Score="1" Body="&lt;p&gt;Is there a chance that you're getting the another entry with the the same slug as your &lt;code&gt;mainEntry&lt;/code&gt;? I'd try to further filter it down by adding &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#section&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;section()&lt;/code&gt;&lt;/a&gt; for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I wrote in the comments, try to loosen the second ElementCriteriaModel by removing the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#level&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;level&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea would be to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;dump()&lt;/code&gt;&lt;/a&gt; function on your &lt;code&gt;mainEntry&lt;/code&gt; (only works with dev-mode turned on).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T07:04:45.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1927" PostTypeId="1" AcceptedAnswerId="4831" CreationDate="2014-08-15T08:19:08.110" Score="9" ViewCount="7184" Body="&lt;p&gt;In a list of tags I'd like to remove the last comma. So is there something that works like the Ee backspace parameter?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="250" LastEditDate="2014-10-05T15:58:58.990" LastActivityDate="2014-11-19T19:42:24.950" Title="Remove the last comma in an inline list of tags?" Tags="&lt;templating&gt;&lt;tags&gt;&lt;conditional&gt;&lt;forloop&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1928" PostTypeId="2" ParentId="1927" CreationDate="2014-08-15T09:17:06.823" Score="3" Body="&lt;p&gt;What about using CSS for that?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;.u-inlineList {&#xA;  display: inline;&#xA;}&#xA;&#xA;.u-inlineList-item {&#xA;  display: inline;&#xA;  list-style: none;&#xA;}&#xA;&#xA;.u-inlineList-item:after {&#xA;  content: &quot;, &quot;;&#xA;}&#xA;&#xA;.u-inlineList-item:last-child:after {&#xA;  content: &quot;&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T09:17:06.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1929" PostTypeId="2" ParentId="1927" CreationDate="2014-08-15T09:29:19.693" Score="17" Body="&lt;p&gt;There's a couple of &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;special variables&lt;/a&gt; available while for looping through an array. In your case I'd make use of &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;&lt;code&gt;loop.last&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ tag }}{{ not loop.last ? ', ' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the expression using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot;&gt;ternary operator&lt;/a&gt; to keep the syntax short.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T09:29:19.693" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1930" PostTypeId="1" CreationDate="2014-08-15T10:14:17.373" Score="1" ViewCount="374" Body="&lt;p&gt;I've installed a client version of craft. Apparently this is set in my local language (Dutch). First question is if that is something you can set to another language or must I install a Pro version for that? (Dutch is fine, but just would like to know)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, while the CP is in Dutch, if I parse the month, it is in English:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate.format('F') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So how can that be set in Dutch as well?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-08-15T10:28:41.677" Title="Change date language in a client version of craft" Tags="&lt;datetime&gt;&lt;date&gt;&lt;language&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-08-15T18:40:55.530" ContentLicense="CC BY-SA 3.0" />
  <row Id="1931" PostTypeId="2" ParentId="1930" CreationDate="2014-08-15T10:28:41.677" Score="1" Body="&lt;p&gt;Found the solution in the twig docs, this appears to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate|date(&quot;F&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This uses the local date setup instead of the US setup&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still odd, that the standard language from the CP is not used?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-08-15T10:28:41.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1932" PostTypeId="2" ParentId="1920" CreationDate="2014-08-15T10:33:10.010" Score="1" Body="&lt;p&gt;There is a PHP Constant &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-templates-path&quot; rel=&quot;nofollow&quot;&gt;CRAFT_TEMPLATES_PATH&lt;/a&gt; which you can use to specify your Template Path. Would that help you out any?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the top of the page linked above, it explains where you set the Constants.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2014-08-15T10:33:10.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1933" PostTypeId="1" AcceptedAnswerId="1935" CreationDate="2014-08-15T10:43:43.660" Score="2" ViewCount="1672" Body="&lt;p&gt;Here's a summary of what I try to do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I created a Single page with a specific template where I want to display a list of partners&lt;/li&gt;&#xA;&lt;li&gt;I created a group of Categories to define all types of partners&lt;/li&gt;&#xA;&lt;li&gt;All my partners are encoded in a 'partners' Channel&lt;/li&gt;&#xA;&lt;li&gt;In this Channel, each partner has a field that allows to select one partner Category &lt;/li&gt;&#xA;&lt;li&gt;On the Single page, I display all categories of partners with at least one partner&lt;/li&gt;&#xA;&lt;li&gt;For each Category of partners, I display the partner(s) related to this Category&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And here is my code which attempt to do this, but not correctly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('partners').ids() %}&#xA;  {% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).groupId(2).find() %}&#xA;    {% for category in categories %}&#xA;      &amp;lt;div&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;        {% set categoryToDisplay = category.slug %}&#xA;        {% for entry in craft.entries.section('partners') %}&#xA;          &amp;lt;ul&amp;gt;&#xA;          {% for category in craft.categories(categoryToDisplay) %}&#xA;             &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This properly displays all Partners categories with at least one partner, but this does not correctly display the partners associated with each category. Each time, all partners of all categories are repeated instead of displaying only those that are related.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2014-08-15T11:29:51.780" Title="How do I create a list of categories and display the entries relating to each of these categories that have at least one entry?" Tags="&lt;forloop&gt;&lt;relations&gt;&lt;entry&gt;&lt;category&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1934" PostTypeId="2" ParentId="1905" CreationDate="2014-08-15T10:51:34.407" Score="7" Body="&lt;p&gt;It looks like the &lt;strong&gt;folder name&lt;/strong&gt; of your plugin is wrong. Change it to just say &lt;code&gt;craftimport&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The folder name should be the same as the &quot;Whatever&quot; part of the &lt;code&gt;WhateverPlugin.php&lt;/code&gt; file sitting in the plugin's root folder. Except that the folder name should always be &lt;strong&gt;all lowercase&lt;/strong&gt;. That's important, because some systems are case-sensitive while others are not... The only way to be certain your plugins will be detected is to use a lowercase folder name. (see &lt;a href=&quot;https://craftcms.stackexchange.com/a/1537/45&quot;&gt;this thread...&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-08-15T10:51:34.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1935" PostTypeId="2" ParentId="1933" CreationDate="2014-08-15T11:29:51.780" Score="4" Body="&lt;p&gt;Here's the link to relevant the &quot;Get Help&quot; article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;How do I list the entries related to a category?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These really helpful tutorials are somewhat hidden on builtwithcraft.com, I overlooked them more than once while thought the normal Documentation articles!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just use the provided example code in your category loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('partners').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).groupId(2).find() %}&#xA;&#xA;{% for category in categories %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;ul&amp;gt;     &#xA;&#xA;            {# Fetch all of the entries related to this category #}&#xA;            {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;            {# Output them #}&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T11:29:51.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1936" PostTypeId="1" CreationDate="2014-08-15T11:52:26.923" Score="2" ViewCount="502" Body="&lt;p&gt;I have an entry type whose content will be separated from the main content. So I was wondering how can we give an entry type its own search and categories? Possible?&lt;/p&gt;&#xA;" OwnerUserId="678" LastEditorUserId="57" LastEditDate="2014-08-15T17:04:45.887" LastActivityDate="2014-08-15T17:04:45.887" Title="How can an entry type have its own search and categories?" Tags="&lt;categories&gt;&lt;entry-type&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1937" PostTypeId="2" ParentId="1936" CreationDate="2014-08-15T12:23:30.387" Score="3" Body="&lt;p&gt;Sure it's possible. There's the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#type&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;type()&lt;/code&gt;&lt;/a&gt; parameter available for ElementCriteriaModels to filter the returned results by only those entry types you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To separate the categories, I'd set up multiple &lt;a href=&quot;http://buildwithcraft.com/docs/categories#category-groups&quot; rel=&quot;nofollow&quot;&gt;category groups&lt;/a&gt;, one for each of your entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryParams = {&#xA;    group: 'audioCategories',&#xA;    slug: 'podcasts'&#xA;} %}&#xA;&#xA;{% set category = craft.categories(categoryParams).first() %}&#xA;{% set searchTerm = 'basketball OR soccer' %}&#xA;&#xA;{% set entryParams = {&#xA;    section: 'news',&#xA;    type: 'audio',&#xA;    relatedTo: category,&#xA;    search: searchTerm&#xA;} %}&#xA;&#xA;{% for entry in craft.entries(entryParams) %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would list only those entries which are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;in a &lt;strong&gt;section&lt;/strong&gt; named &quot;news&quot;&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;given an &lt;strong&gt;entry type&lt;/strong&gt; (and entry template) &quot;audio&quot;&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;related to a category from the &lt;strong&gt;category group&lt;/strong&gt; &quot;audioCategories&quot; (I additionally filter for just the one cat. named &quot;podcasts&quot; to keep the example a little simpler)&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;matching to the &lt;strong&gt;search term&lt;/strong&gt; &quot;basketball OR soccer&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-15T12:40:30.673" LastActivityDate="2014-08-15T12:40:30.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1938" PostTypeId="1" AcceptedAnswerId="1941" CreationDate="2014-08-15T13:24:11.970" Score="3" ViewCount="1723" Body="&lt;p&gt;When users enter &lt;a href=&quot;http://www.example.com&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com&lt;/a&gt; I would like to redirect them to the &lt;a href=&quot;http://www.example.com/news&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com/news&lt;/a&gt; template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2015-04-15T12:10:14.337" Title="How to set a channel as the homepage" Tags="&lt;routing&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1939" PostTypeId="2" ParentId="1927" CreationDate="2014-08-15T13:32:15.817" Score="5" Body="&lt;p&gt;If you you have a given string and can't influence how it is generated, use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter to crop that last comma:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = 'Alpirsbacher Klosterbräu, Rothaus Tannenzäpfle, Neumarkter Lammsbräu, ' %}&#xA;&#xA;{# Remove the last two chars &quot;, &quot; from the string #}&#xA;{{ tags|slice(0, -2) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T13:32:15.817" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1940" PostTypeId="2" ParentId="1938" CreationDate="2014-08-15T13:52:30.437" Score="3" Body="&lt;p&gt;&lt;em&gt;EDIT:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This answer was given when it wasn't yet clear that @shanti wants one of the channel entries to become the home page. The following is only relevant, if you want a channel's index page to be available under &lt;code&gt;http://www.example.com&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend you to add a single section to your configuration as the entry for your channel's index. In this single's settings you select the template you currently use and you have a checkbox to make this single entry your home page!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea would be to use one structure section for all &lt;em&gt;singular content pages&lt;/em&gt; (e.g. about, contact, etc.) and all your channel &lt;em&gt;index pages&lt;/em&gt; (e.g. projects, news). There are other interesting Q/As here on Stack Exchange on that topic. If you're going that way, have a look at the answers on &lt;a href=&quot;https://craftcms.stackexchange.com/q/1467/125&quot;&gt;&quot;Add home page to a structure?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you simply want to redirect the visitors to &lt;code&gt;http://www.example.com/news&lt;/code&gt;, there's a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% redirect %}&lt;/code&gt;&lt;/a&gt; tag available for such redirects.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-15T17:13:46.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1941" PostTypeId="2" ParentId="1938" CreationDate="2014-08-15T13:54:23.367" Score="8" Body="&lt;p&gt;You can do this with Craft’s &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot;&gt;{% redirect %}&lt;/a&gt; tag. Just put this in your /index.html template:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% redirect 'news' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to redirect to the latest entry in your News section, as you mentioned in the comments above, just fetch the entry first:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set latestNews = craft.entries.section('news').order('postDate desc').first() %}&#xA;{% redirect latestNews.url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-15T13:54:23.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1942" PostTypeId="2" ParentId="1938" CreationDate="2014-08-15T14:58:32.867" Score="4" Body="&lt;p&gt;If you want one of your &lt;em&gt;channel entries&lt;/em&gt; to be the homepage, simply include the channel entries' template to your home page &lt;code&gt;index.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set the `entry` variable manually #}&#xA;{% set entry = craft.entries.section('news').first() %}&#xA;&#xA;{# Load the channel entry template #}&#xA;{% include &quot;news/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this setup, your visitors would actually be on your homepage's URL &lt;code&gt;http://www.example.com&lt;/code&gt; instead of never really landing there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd possibly even confuse some visitors, if they get redirected to &lt;code&gt;http://www.example.com/news/my-not-so-very-long-news-title&lt;/code&gt; straight away and they might search for your proper home page?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure at all, but I can imagine a regularly changing redirect (each time you add a new news post you'd also have a new home URL!) could also by problematic for SEO rankings. Please correct me if I'm wrong with that! &lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-15T15:06:39.180" LastActivityDate="2014-08-15T15:06:39.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1943" PostTypeId="1" CreationDate="2014-08-15T15:06:38.140" Score="1" ViewCount="345" Body="&lt;p&gt;I've broken my news channel but I don't know how I did it, or consequently to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one clicks on 'I just installed Craft' or 'Continue reading', it will take you to the URL I specified in the Section settings using the Craft control panel, but it results in a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It didn't do this at first, then (I think this is when it broke) I changed the entry URL format from &lt;code&gt;news/{postDate.year}/{postDate.month}/{slug}&lt;/code&gt; to just &lt;code&gt;{postDate.year}/{postDate.month}/{slug}&lt;/code&gt;. After I got the 404s assumed I couldn't do that so I changed it back, but it's still broken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm quite new to this kind of thing so I apologise if I'm wasting anyone's time. Any help would be much appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="681" LastEditorUserId="681" LastEditDate="2014-08-15T18:45:34.147" LastActivityDate="2014-08-15T18:45:34.147" Title="Channel URL Format leads to 404s for individual entries" Tags="&lt;url&gt;&lt;routes&gt;&lt;routing&gt;&lt;404-page&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1944" PostTypeId="1" AcceptedAnswerId="1950" CreationDate="2014-08-15T15:30:01.440" Score="2" ViewCount="465" Body="&lt;p&gt;I'm trying to display a list of names alphabetically ordered. This is working fine, but I also want to check if the name is &lt;strong&gt;intoCollection&lt;/strong&gt; or not (using a &lt;em&gt;Lightswitch&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is &lt;strong&gt;intoCollection&lt;/strong&gt;, it displays the &lt;em&gt;letter&lt;/em&gt; + the list of names related. If there is no name related to the &lt;em&gt;letter&lt;/em&gt;, I need to display nothing (= no &lt;em&gt;letter&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code which seems good for me, but is not correct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('artists').limit(null).order('title') %}&#xA;{% for letter, letterEntries in artists | group('title|upper|slice(0, 1)') %}&#xA;&#xA;    {% for entry in letterEntries %}&#xA;        {% if entry.intoCollection | length %}&#xA;&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ letter | upper }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;ul&amp;gt; &#xA;            {% for entry in letterEntries %}&#xA;                {% if entry.intoCollection %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It displays &lt;em&gt;letters&lt;/em&gt; duplicated, but also &lt;em&gt;letters&lt;/em&gt; that contain no names...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2014-08-15T16:38:48.213" Title="Using a loop in a loop, how do I check if child loop is empty to not display parent loop?" Tags="&lt;forloop&gt;&lt;entry&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1945" PostTypeId="1" AcceptedAnswerId="1997" CreationDate="2014-08-15T15:30:28.813" Score="3" ViewCount="1543" Body="&lt;p&gt;I'm trying to set a password for a user account while logged in without Site Admin permissions (the user does however have 'Edit Users+Administrate users+Assign Groups and Permissions + Remove User permissions all enabled). - Despite this they still can't change a password for a current user or even create a new user with a set password that can login to the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is partially problematic as 'Verify email address' is not something the company is interested in so I'm looking for a solution to create a user on the backend that can login once their account is created without verifying or really receiving any email and without having to give full administrative access to my client just to set passwords? Seems like something that should be achievable especially with the permission 'Administrate Users' enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2014-08-18T18:34:37.773" Title="Setting user password on creation / without full admin rights" Tags="&lt;users&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1946" PostTypeId="1" AcceptedAnswerId="1947" CreationDate="2014-08-15T15:45:34.483" Score="3" ViewCount="451" Body="&lt;p&gt;I am building a plugin that needs to cache generated images into a directory in Craft, presumably the &lt;code&gt;craft/storage&lt;/code&gt; directory. I took a glance in the docs, but couldn't find much in the form of how to use storage. When building similar functionality in EE I used the their &lt;code&gt;cache&lt;/code&gt; directory, so looking for something similar with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does one cache generated files in local directory so they can be used later to prevent the overhead of constantly having to generate the image?&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2018-02-21T21:27:17.960" Title="How does a plugin make use of Craft's storage?" Tags="&lt;plugin-development&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1947" PostTypeId="2" ParentId="1946" CreationDate="2014-08-15T16:10:29.483" Score="6" Body="&lt;p&gt;craft/storage/ is used for all sorts of things, so there’s no single API for storing things in there. Mostly you would just be working with PHP’s standard IO functions like &lt;a href=&quot;http://php.net/manual/en/function.file-put-contents.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;file_put_contents()&lt;/a&gt;. There are some handy functions in Craft’s IOHelper class too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the path to the storage folder via &lt;a href=&quot;https://craftcms.com/classreference/services/PathService#getStoragePath-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;PathService::getStoragePath()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$storagePath = craft()-&amp;gt;path-&amp;gt;getStoragePath();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;IOHelper::ensureFolderExists() is a handy function for creating a subfolder for your plugin within craft/storage:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$myStoragePath = $storagePath.'myplugin/';&#xA;IOHelper::ensureFolderExists($myStoragePath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="7715" LastEditDate="2018-02-21T21:27:17.960" LastActivityDate="2018-02-21T21:27:17.960" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1948" PostTypeId="1" AcceptedAnswerId="4575" CreationDate="2014-08-15T16:32:05.800" Score="4" ViewCount="1077" Body="&lt;p&gt;How would you combine multiple logical expressions on a ElementCriteriaModel parameter?&#xA;You could query twice and then merge the two returned arrays of entry models,&#xA;but that probably wouldn't allow me to later use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% paginate %}&lt;/code&gt;&lt;/a&gt; tag or methods like &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example where I'd like to filter events starting in calender week 32 or 34:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateParamCw32 = 'and, &amp;gt;= 2014-08-04 00:00:00, &amp;lt; 2014-08-10 23:59:59' %}&#xA;{% set dateParamCw34 = 'and, &amp;gt;= 2014-08-18 00:00:00, &amp;lt; 2014-08-24 23:59:59' %}&#xA;&#xA;{% set startDateParam = 'date range cw32 OR cw34' %}&#xA;&#xA;{% set entries = craft.entries.section('events').startDate(startDateParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-03-29T22:35:41.457" LastActivityDate="2017-06-29T10:24:44.983" Title="Complex logic on a ElementCriteriaModel parameter?" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1949" PostTypeId="2" ParentId="1944" CreationDate="2014-08-15T16:37:17.810" Score="2" Body="&lt;p&gt;You have &lt;code&gt;{% for entry in letterEntries %}&lt;/code&gt; twice, one loop inside the other, which is going to give you things twice. Also, since &lt;code&gt;intoCollection&lt;/code&gt; is a &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;Lightswitch Field&lt;/a&gt; you test it with &lt;code&gt;{% if entry.intoCollection %}&lt;/code&gt; (no &lt;code&gt;|length&lt;/code&gt;) Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('artists').limit(null).order('title') %}&#xA;{% for letter, letterEntries in artists | group('title|upper|slice(0, 1)') %}&#xA;&#xA;  {# see if any of the entries is intoCollection #}&#xA;  {% set isIntoCollection = false %}&#xA;  {% for entry in letterEntries %}&#xA;    {% if entry.intoCollection %}&#xA;      {% set isIntoCollection = true %}&#xA;      {# break here #}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;  {# now display them #}&#xA;  {% if isIntoCollection %}&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;h3&amp;gt;{{ letter | upper }}&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;ul&amp;gt; &#xA;        {% for entry in letterEntries %}&#xA;          {% if entry.intoCollection %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can break the loop at &lt;code&gt;{# break here #}&lt;/code&gt; if you have the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;mnbreakandcontinue&lt;/a&gt; plugin. It's not necessary, just a potential optimization.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-15T16:37:17.810" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1950" PostTypeId="2" ParentId="1944" CreationDate="2014-08-15T16:38:48.213" Score="4" Body="&lt;p&gt;You'd further filter your returned artist entries down like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('artists').intoCollection('1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then remove all the unnecessary &quot;intoCollection&quot; conditionals in your loop.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-15T16:38:48.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1951" PostTypeId="2" ParentId="1869" CreationDate="2014-08-15T16:46:48.110" Score="3" Body="&lt;p&gt;That would require some sort of convention on your end which identifies what makes up a category/channel index page, as channels and categories don’t actually have an “index URL”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you could decide that all sections’ index pages should have a URI that matches the section’s handle (not necessarily a good idea though, in the event that you want a URI that includes dashes). In that case you could do something like:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set segments = craft.request.getSegments() %}&#xA;{% if segments|length == 1 %}&#xA;    {% set section = craft.sections.getSectionByHandle(segments[0]) %}&#xA;    {% if section %}&#xA;        We’re on a section index!&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no corresponding function for getting a category group by its handle at this time, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better approach might be to just leave it up to the templates to define whether they are supposed to be an index template. So in news/index.html, the template that you want to treat as the News index template, for example, you could put this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set isIndex = true %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any layout templates that the index template extends will then have access to that &lt;code&gt;isIndex&lt;/code&gt; variable.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-15T17:06:10.457" LastActivityDate="2014-08-15T17:06:10.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1952" PostTypeId="1" AcceptedAnswerId="1955" CreationDate="2014-08-15T17:07:40.093" Score="5" ViewCount="743" Body="&lt;p&gt;I am generating dynamic images to a directory in &lt;code&gt;craft/storage&lt;/code&gt;. I need to be able to use these generated images on the front-end inside templates. Is there a helper method for this, or some way to use these images in my templates?&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-08-15T21:53:10.150" Title="Is there a way to generate a url to an image in the craft/storage/myplugin directory?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1953" PostTypeId="2" ParentId="1943" CreationDate="2014-08-15T18:44:03.367" Score="3" Body="&lt;p&gt;It turned out that when I deleted &lt;code&gt;news/&lt;/code&gt; from the entry URL format, I also deleted it from the entry template path as well because I misunderstood what that field was for (and forgot to revert that change when everything broke).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to @Brad for drawing my attention to it.&lt;/p&gt;&#xA;" OwnerUserId="681" LastActivityDate="2014-08-15T18:44:03.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1954" PostTypeId="2" ParentId="738" CreationDate="2014-08-15T19:19:30.613" Score="3" Body="&lt;p&gt;Turns out this &lt;em&gt;was&lt;/em&gt; a bug in Craft and we've just fixed it for the next (post build 2568) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-15T19:19:30.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1955" PostTypeId="2" ParentId="1952" CreationDate="2014-08-15T21:51:42.657" Score="4" Body="&lt;p&gt;Since craft/storage/ is not publicly accessible, your only real option here is to serve them through Craft as Resource Requests. (This is the vehicle through which Craft serves up all of the CP’s front end resources, which live in craft/app/resources/.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual resource URLs will depend on the site’s &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#resourceTrigger&quot; rel=&quot;nofollow&quot;&gt;resourceTrigger&lt;/a&gt; config setting, so to generate the URLs you should use URLHelper::getResourceUrl():&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$url = UrlHelper::getResourceUrl('myplugin/some/path.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your templates can call the corresponding &lt;code&gt;resourceUrl()&lt;/code&gt; function as well:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ resourceUrl('myplugin/some/path') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you will need to add a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getResourcePath&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getResourcePath&lt;/code&gt;&lt;/a&gt; hook method to your primary plugin class, which would detect incoming resource requests and resolve them to the actual server path in craft/storage/.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getResourcePath($path)&#xA;{&#xA;    // Does this path start with &quot;myplugin/&quot;?&#xA;    if (strncmp($path, 'myplugin/', 9) == 0)&#xA;    {&#xA;        // Return the path to the file in craft/storage/&#xA;        return craft()-&amp;gt;path-&amp;gt;getStoragePath().'myplugin/'.substr($path, 9);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It’s worth mentioning that you’re always going to get worse performance out of serving files through PHP than you would if they were located somewhere that’s publicly accessible. So you might just want to have the user create a new folder somewhere under their web root, and have them specify the path/URL to that folder, just like local asset sources.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2014-08-15T21:53:10.150" LastActivityDate="2014-08-15T21:53:10.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1956" PostTypeId="2" ParentId="1924" CreationDate="2014-08-15T22:25:17.100" Score="2" Body="&lt;p&gt;Currently, no.  But it is on our radar and we've got some ideas on how we'd want to implement it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-15T22:25:17.100" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1957" PostTypeId="1" CreationDate="2014-08-16T00:42:03.560" Score="4" ViewCount="877" Body="&lt;p&gt;I know this has been discussed a little bit on here, but I'm asking if any one has successfully implemented a Members Discussion Forum using CraftCMS ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, if anyone knows of an add-on roadmap to include this type of functionality ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really trying to avoid having to use EE to accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TIA, Eric&lt;/p&gt;&#xA;" OwnerUserId="683" LastEditorUserId="183" LastEditDate="2014-08-16T02:03:50.100" LastActivityDate="2014-08-19T05:53:43.447" Title="Discussion forum" Tags="&lt;member&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1958" PostTypeId="1" CreationDate="2014-08-16T05:07:58.597" Score="2" ViewCount="244" Body="&lt;p&gt;Let's say I have an entry type named &quot;Designers&quot;, and I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A title field &quot;Full Name&quot; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A categories field &quot;Specialty&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another categories field &quot;Location&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now I want each designer (that is, each entry) from the &quot;Designers&quot; entry type to link to a another page showing blog entries on which this designer's work is featured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry if I'm not being clear enough... Basically, it's a basic directory what I want to build. People can find designers by specialty and location (not sure if categories is the right way to do it...any suggestions?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can I create that page showing the entries. Maybe this can't be done with entry types and I need a separated channel?!&lt;/p&gt;&#xA;" OwnerUserId="684" LastEditorUserId="684" LastEditDate="2014-08-16T05:14:27.600" LastActivityDate="2014-08-17T23:13:18.290" Title="Pages for each entry from an entry type?" Tags="&lt;url&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1959" PostTypeId="2" ParentId="1958" CreationDate="2014-08-16T08:42:10.290" Score="1" Body="&lt;p&gt;You could indeed use entry types to separate your &quot;Designer&quot; and &quot;Blog&quot; entries, but that wouldn't be a very good way to do it. The type of content is just too different to make them a good fit for a single channel section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let's try it anyways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you'd need to &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;relate&lt;/a&gt; the entries, each &quot;Designer&quot; entry with all linked &quot;Blog&quot; entries. To make such relations possible, you add an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;entries field&lt;/a&gt; &quot;Designer&quot; to the &quot;Blog&quot; entry type. Entries fields can be configured to only show entries of select sections. With a separate &quot;Designers&quot; section you could nicely filter the entries available. If you have one combined channel, where you mix &quot;Designer&quot; and &quot;Blog&quot; entries – even if they are in separate entry types – you will always have them next to each other in your entries field modal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ability to further filter the sources available on an entries field other than a filter on the section will &lt;a href=&quot;https://plus.google.com/112173526450245116573/posts/2NHbdQTsKiL&quot; rel=&quot;nofollow&quot;&gt;most likely&lt;/a&gt; come with an update to Craft though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But besides this (current) problem, you could definitely mis-use that one single channel for your design. Another thing to mention here, it'd probably be a bit more of work to set this all up.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-17T23:13:18.290" LastActivityDate="2014-08-17T23:13:18.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1960" PostTypeId="1" AcceptedAnswerId="1965" CreationDate="2014-08-16T13:36:57.500" Score="5" ViewCount="10045" Body="&lt;p&gt;I'm not sure if it is appropriate to post twig questions on this forum? I have a question about nested blocks and using the twig &quot;parent&quot; function. I'm running into unexpected behaviour on a craft site i'm building. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My parent and child template layouts.&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Parent Template #}&#xA;{% block breadcrumbs %}&#xA;    {% block crumb %}&#xA;&#xA;    {% endblock %}&#xA;{% endblock %}&#xA;&#xA;{# Child Template #}&#xA;{% block breadcrumbs %}&#xA;    {{ parent() }}&#xA;    {% block crumb %}&#xA;        My custom content&#xA;    {% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;What I'm trying to achieve&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On my child template, I'm trying to retain the content in block breadcrumbs but override the content in block crumb.&lt;/li&gt;&#xA;&lt;li&gt;However when I use the parent function in my child template, it does not respect &quot;my custom content&quot; and uses the block crumb content defined in the parent template.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="594" LastActivityDate="2014-08-18T10:16:53.230" Title="How to use twig parent function on nested blocks" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1961" PostTypeId="2" ParentId="1957" CreationDate="2014-08-16T13:54:30.163" Score="3" Body="&lt;p&gt;Just about to start a project where we will be integrating Muut.com, and using their Single Sign-On functionality to make it a pretty seamless experience for our users. Wish I could have native functionality (always worried that any SaaS provider will one day go away), but they look to be the best option.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2014-08-16T13:54:30.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1962" PostTypeId="2" ParentId="1957" CreationDate="2014-08-16T16:23:43.633" Score="4" Body="&lt;p&gt;You may want to look at &lt;a href=&quot;http://vanillaforums.org/&quot; rel=&quot;nofollow&quot;&gt;http://vanillaforums.org/&lt;/a&gt;  its open source and php based like craft. You host it yourself so no need to worry about a Saas providers longevity (they do offer a hosted option as well at vanillaforums.com)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has a single sign on option that seems to allow for a basic forum but I havent yet actually tried it, although we have a project coming up this fall that we will likely use it for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously a custom developed plugin would be the ideal option but that may or may not happen anytime soon.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-08-16T16:23:43.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1963" PostTypeId="2" ParentId="1957" CreationDate="2014-08-16T16:24:57.883" Score="4" Body="&lt;p&gt;I would also go the SSO way: Install a nice stand-alone discussion forum and connect it with Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;phpBB (&lt;a href=&quot;https://www.phpbb.com/kb/article/phpbb3-cross-site-sessions-integration&quot; rel=&quot;nofollow&quot;&gt;phpBB3 Cross-site Sessions Integration&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Vanilla Forums (&lt;a href=&quot;http://blog.vanillaforums.com/help/vanilla-jsconnect-single-signon-on/&quot; rel=&quot;nofollow&quot;&gt;Implementing Vanilla jsConnect Single-Signon&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;vBulletin (&lt;a href=&quot;http://www.vbulletin.org/forum/showthread.php?t=270517&quot; rel=&quot;nofollow&quot;&gt;SSO Plugin&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Invision Power Board (&lt;a href=&quot;http://www.invisionpower.com/support/guides/_/advanced-and-developers/integration/single-sign-on-sso-r209&quot; rel=&quot;nofollow&quot;&gt;Single Sign-On&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-16T16:24:57.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1964" PostTypeId="1" AcceptedAnswerId="1966" CreationDate="2014-08-16T19:35:45.207" Score="7" ViewCount="986" Body="&lt;p&gt;Unfortunately, I'm in a position where I need to run a Craft and WordPress installation out of the same directory. The WordPress install is under the sub-directory &lt;code&gt;/blog&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I visit &lt;code&gt;http://mysite.dev/blog/&lt;/code&gt; the WordPress blog loads as expected, but attempts to visit any routes within that result in Craft's 404 page. For instance, &lt;code&gt;http://mysite.dev/blog/my-post&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to convince Craft to ignore any requests under &lt;code&gt;/blog&lt;/code&gt;? &lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="57" LastEditDate="2014-08-16T23:08:43.843" LastActivityDate="2014-08-16T23:08:43.843" Title="Is it possible to tell Craft to ignore requests to under a certain path?" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1965" PostTypeId="2" ParentId="1960" CreationDate="2014-08-16T22:02:06.623" Score="7" Body="&lt;p&gt;Try to keep the blocks separate in your child template. That's how it's done in a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html#child-template&quot; rel=&quot;noreferrer&quot;&gt;comparable example&lt;/a&gt; in the Twig Documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parent Template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block breadcrumbs %}&#xA;    {% block crumb %} &#xA;    {% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Child Template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;parent.html&quot; %}&#xA;&#xA;{% block breadcrumbs %}&#xA;    {{ parent() }}&#xA;{% endblock %}&#xA;&#xA;{% block crumb %}&#xA;    My custom content&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not adding any content to your &quot;breadcrumbs&quot; block from the child template, you can also omit that block completely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;parent.html&quot; %}&#xA;&#xA;{% block crumb %}&#xA;    My custom content&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-18T10:16:53.230" LastActivityDate="2014-08-18T10:16:53.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1966" PostTypeId="2" ParentId="1964" CreationDate="2014-08-16T23:07:43.317" Score="4" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing article&lt;/a&gt; in the Craft Documentation, it describes why Craft handles these request in the first place:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;strong&gt;.htaccess&lt;/strong&gt; file that comes with Craft will redirect all would-be 404 requests over to index.php behind the scenes, which is why Craft is able to respond to URLs that don’t point to any actual folder/file in your web root.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A fresh Craft install's &lt;code&gt;.htaccess&lt;/code&gt; file looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll notice that favicons are removed from the redirect. Add a similar &lt;code&gt;RewriteCond&lt;/code&gt; for &lt;code&gt;blog/&lt;/code&gt; to also exclude request to your  WordPress folder from this condition. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteCond %{REQUEST_URI} !blog [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-16T23:07:43.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1967" PostTypeId="1" CreationDate="2014-08-17T10:42:56.783" Score="1" ViewCount="226" Body="&lt;p&gt;Adding images with a named transform in a Redactor rich text field is causing an Internal Server Error on save: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to&#xA;  string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Typical html generated by Redactor reads:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`&amp;lt;img src=&quot;http://craft-tryout:8888/assets/images/_thumbnail/afternoon_tea.JPG#asset:41:thumbnail&quot;&amp;gt;`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I manually delete &lt;code&gt;#asset:41:thumbnail&lt;/code&gt; this seems to fix the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images added in normal Craft image fields are all working OK.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What is this extra bit of Redactor generated code?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Might I have set up something incorrectly with my transforms?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="605" LastEditorUserId="605" LastEditDate="2014-08-17T11:08:48.037" LastActivityDate="2014-08-17T11:08:48.037" Title="Images added with transform in Redactor field causing Internal Server Error" Tags="&lt;image-transforms&gt;&lt;redactor&gt;&lt;image&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2014-08-20T15:23:27.420" ContentLicense="CC BY-SA 3.0" />
  <row Id="1968" PostTypeId="1" CreationDate="2014-08-17T11:57:30.057" Score="3" ViewCount="262" Body="&lt;p&gt;I want any visitor to be able to submit links to my blog via the Guest Entries plugin, but how do I include the custom fields of my &quot;Links&quot; entry type in the Guest Entries form? For example, a category field, text fields...&lt;/p&gt;&#xA;" OwnerUserId="684" LastActivityDate="2014-08-17T21:59:06.987" Title="How do I include custom fields of an entry type in the Guest Entries form?" Tags="&lt;guest-entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1969" PostTypeId="1" AcceptedAnswerId="2007" CreationDate="2014-08-17T13:10:50.140" Score="2" ViewCount="1411" Body="&lt;p&gt;I have a localized site, localization works fine for homepage (/en/), however the links to other page does not work (/en/rooms) where /chambres works fine for default language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The English 'chambres' page is accessible with /en/?p=rooms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the english page being accessible with /en/rooms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's definitely an Nginx vhost config issue. The config listed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx&quot;&gt;Locales sub directories on Nginx&lt;/a&gt; didn't solve my problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my english index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Tell Craft to serve the English content&#xA;define('CRAFT_LOCALE', 'en');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is in my general config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'quartiergeneral.craft.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'usePathInfo' =&amp;gt; true,&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/home/vagrant/Code/quartiergeneral/craft/public/',&#xA;            'baseUrl'  =&amp;gt; 'http://quartiergeneral.craft.dev:8000/',&#xA;        ),&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'fr' =&amp;gt; 'http://quartiergeneral.craft.dev:8000/',&#xA;            'nl' =&amp;gt; 'http://quartiergeneral.craft.dev:8000/nl/',&#xA;            'en' =&amp;gt; 'http://quartiergeneral.craft.dev:8000/en/',&#xA;        ),&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my nginx config vhost:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen 80;&#xA;    server_name quartiergeneral.craft.dev;&#xA;    root /home/vagrant/Code/quartiergeneral/craft/public;&#xA;&#xA;    index index.html index.htm index.php;&#xA;&#xA;    charset utf-8;&#xA;&#xA;    location / {&#xA;        try_files $uri $uri/ @rewrites;&#xA;    }&#xA;&#xA;    location @rewrites {&#xA;        rewrite ^(.*) /index.php?p=$1 last;&#xA;    }&#xA;&#xA;    location = /favicon.ico { access_log off; log_not_found off; }&#xA;    location = /robots.txt  { access_log off; log_not_found off; }&#xA;&#xA;    access_log off;&#xA;    error_log  /var/log/nginx/quartiergeneral.craft.dev-error.log error;&#xA;&#xA;    error_page 404 /index.php;&#xA;&#xA;    sendfile off;&#xA;&#xA;    location ~ \.php$ {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;    }&#xA;&#xA;    location ~ /\.ht {&#xA;        deny all;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="156" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-08-10T20:10:34.900" Title="Nginx Vhost Config - Get page based on translated URI and without parameters in url" Tags="&lt;localization&gt;&lt;slug&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ClosedDate="2014-08-20T15:34:47.190" ContentLicense="CC BY-SA 3.0" />
  <row Id="1972" PostTypeId="2" ParentId="1593" CreationDate="2014-08-17T14:46:07.427" Score="8" Body="&lt;p&gt;The easiest way i've found to do that is to use TemplateHelper::getRaw()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your &quot;prepValue&quot; function inside your fieldtype class do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function prepValue($value) {&#xA;    //any other data manipulation stuff&#xA;    return TemplateHelper::getRaw($value);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use&quot;&gt;More info on prepValue in the docs.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-08-17T14:46:07.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1973" PostTypeId="2" ParentId="18" CreationDate="2014-08-17T20:21:58.907" Score="21" Body="&lt;p&gt;If you have devMode set to &quot;true&quot; in your config files, you can use &quot;dump&quot; in a twig template like this without any plug in needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(myArray) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="349" LastActivityDate="2014-08-17T20:21:58.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1974" PostTypeId="2" ParentId="1968" CreationDate="2014-08-17T21:59:06.987" Score="3" Body="&lt;p&gt;if you're using an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry Form - [entries/saveEntry]&lt;/a&gt; you'll need to pass them in as fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you had a text field called &quot;Links&quot; you would need an input like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[links]&quot; value=&quot;{{ entry.links }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Passing in inputs with the name fields[your_field_name] allow it to be picked up and populated correctly.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-17T21:59:06.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1975" PostTypeId="2" ParentId="1958" CreationDate="2014-08-17T22:32:03.920" Score="3" Body="&lt;p&gt;What about using a &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;category group&lt;/a&gt; for your designers as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add your &quot;Specialty&quot; and &quot;Locations&quot; category fields to a &quot;Designers&quot; category's field layout and then use a &quot;Designers&quot; category field on your blog entries to assign the designer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Sorry for the confusion with my other answer, after re-reading your question today I noticed that I headed in the wrong direction. A &quot;Designers&quot; category would probably be the right way to do it, even if you had the ability to add a second channel section.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-17T22:32:03.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1976" PostTypeId="1" CreationDate="2014-08-18T00:19:36.903" Score="5" ViewCount="628" Body="&lt;p&gt;What would be the best way to build an Ad rotator similar to those we usually see around from &lt;a href=&quot;http://fusionads.net&quot;&gt;http://fusionads.net&lt;/a&gt; for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WordPress have a plugin/widget for adding ads: &lt;a href=&quot;https://wordpress.org/plugins/ad-rotator/&quot;&gt;https://wordpress.org/plugins/ad-rotator/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it shows random HTML code every time you refresh the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering how we can do that with Craft.&lt;/p&gt;&#xA;" OwnerUserId="385" LastActivityDate="2019-04-01T17:30:34.163" Title="What would be the best way to build an Ad rotator?" Tags="&lt;templating&gt;&lt;best-practice&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1977" PostTypeId="2" ParentId="1976" CreationDate="2014-08-18T00:42:52.760" Score="3" Body="&lt;p&gt;You build this in a couple different ways but the simplest would be to setup ads as as channel with an asset for the add, url etc. In the template you could set the ad [the entry] to appear randomly by using shuffle().&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="45" LastEditDate="2019-04-01T17:28:47.167" LastActivityDate="2019-04-01T17:28:47.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1978" PostTypeId="2" ParentId="1976" CreationDate="2014-08-18T02:17:21.450" Score="4" Body="&lt;p&gt;I built a plugin which does exactly this... &lt;strong&gt;&lt;a href=&quot;https://www.doublesecretagency.com/plugins/ad-wizard&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ad Wizard&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can put your ads into groups, and add that group to your template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.adWizard.position('rightSidebar') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That code will automatically display a random ad from the group (unless it's disabled, expired, or over its maximum allowed impressions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also target a single ad specifically, by referring to its ID number:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.adWizard.ad(42) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin also gives you built in ad tracking... You can add &lt;a href=&quot;https://www.doublesecretagency.com/plugins/ad-wizard/docs/seeing-your-ad-statistics&quot; rel=&quot;nofollow noreferrer&quot;&gt;two chart widgets&lt;/a&gt; to your dashboard which will show you statistics on how your ads are doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need any help, feel free to contact support@doublesecretagency.com... All feedback, bug reports, and feature requests are welcome!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2019-04-01T17:30:34.163" LastActivityDate="2019-04-01T17:30:34.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1979" PostTypeId="1" AcceptedAnswerId="1980" CreationDate="2014-08-18T06:07:13.657" Score="6" ViewCount="1393" Body="&lt;p&gt;I have a section with entries which I wish to push to specific parts of the website.&#xA;I know I could filter them with a Category but the section already has a category so I would like to use checkboxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The checkbox only has 3 options so I could like to return those that are checked for a specific section.&#xA;Is this possible with checkboxes?&#xA;Been trying this but not getting anything returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set entries = craft.entries.section('newsMedia').order('postDate desc').limit(7).search('zone:pupil')%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="622" LastEditDate="2014-08-18T07:11:43.293" LastActivityDate="2014-08-18T08:08:19.387" Title="Can entries be returned based on checkbox selection?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1980" PostTypeId="2" ParentId="1979" CreationDate="2014-08-18T08:08:19.387" Score="8" Body="&lt;p&gt;You'd better double check for a typo because you actually got the syntax right for the &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot;&gt;search parameter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;search('myField:myString')&lt;/code&gt; filters all entries where a field with handle &quot;myField&quot; contains a string &quot;myString&quot;. What you have should totally work to get the entries with a checkbox field handle &quot;zone&quot; and the value of the checkbox option being &quot;pupil&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're sure that there's no typo and you actually have entries that match the criteria, I'd try if it helps to &lt;a href=&quot;http://buildwithcraft.com/docs/searching#rebuilding-your-search-indexes&quot;&gt;rebuild the search indexes&lt;/a&gt; (tool in the CP settings). I actually try to avoid using the &lt;code&gt;search&lt;/code&gt; parameter if possible, because things can go wrong with the indexes. Unfortunatelly I don't think there's other ways to filter by a checkbox field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other posibillity: If you don't want to paginate the entries or use other methods that are not available on custom arrays of entry models, what about filtering them with a simple conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries %}&#xA;&#xA;{% for entry in entries if entry.zone.contains('pupil') %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-18T08:08:19.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1981" PostTypeId="1" AcceptedAnswerId="1982" CreationDate="2014-08-18T10:47:46.110" Score="3" ViewCount="478" Body="&lt;p&gt;In the case that I have an asset folder structure like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/images&#xA;   /group-a&#xA;   /group-b&#xA;   /group-c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I loop through all of the images in &lt;code&gt;/group-b&lt;/code&gt; without having to assign them to entries.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="250" LastEditDate="2014-10-03T16:09:24.513" LastActivityDate="2014-10-03T16:09:24.513" Title="How would I list assets from a specific subfolder?" Tags="&lt;assets&gt;&lt;forloop&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1982" PostTypeId="2" ParentId="1981" CreationDate="2014-08-18T11:00:01.633" Score="4" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#folderId&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;folderId&lt;/code&gt;-parameter&lt;/a&gt; in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.assets&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for image in craft.assets.folderId(1) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can get the &lt;code&gt;folderId&lt;/code&gt; by inspecting the folder-name in the CP.&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-08-18T11:00:01.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1983" PostTypeId="1" AcceptedAnswerId="2018" CreationDate="2014-08-18T11:05:25.813" Score="1" ViewCount="1164" Body="&lt;p&gt;I have some logic in a template where I want to count the number of items that have a lightswitch set to yes, and a radio button set to another value, currently I'm doing this via a series of {% set %} variables for loops and if statments, I just wondered if anyone know of a more efficient method to resolve this issue, or if this is the simplest implementation within Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set normalNominations = 0 %}&#xA;{% set specialNominations = 0 %}&#xA;{% set normalWin = 0 %}&#xA;{% set specialWin = 0 %}&#xA;&#xA;{% for items in entry.matrixloop %}&#xA;    {% if items.type == &quot;awardBody&quot; %}&#xA;&#xA;    {% elseif items.type == &quot;awardType&quot; %}&#xA;        {% if items.oscar %}&#xA;            {% if items.awardGained == &quot;Win&quot; %}&#xA;                {% set specialWin = specialWin + 1 %}&#xA;            {% elseif items.awardGained == &quot;Nomination&quot; %}&#xA;                {% set specialNominations = specialNominations + 1 %}&#xA;            {% endif %}&#xA;        {% else %}&#xA;            {% if items.awardGained == &quot;Win&quot; %}&#xA;                {% set normalWin = normalWin + 1 %}&#xA;            {% elseif items.awardGained == &quot;Nomination&quot; %}&#xA;                {% set normalNominations = normalNominations + 1 %}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# Debug Information #}&#xA;{#&#xA;&amp;lt;p&amp;gt; Special win: {{ specialWin }} &amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt; Special Nominations: {{ specialNominations }} &amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt; Normal Win: {{ normalWin }} &amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt; Normal Nomination: {{ normalNominations }} &amp;lt;/p&amp;gt;&#xA;&#xA;{{ entry.matrixloop | length }}&#xA;&#xA;#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help with this, I'm pretty new to Craft so want to make sure I'm being efficient in my templates and not writing rubbish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ta&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dave&lt;/p&gt;&#xA;" OwnerUserId="685" LastEditorUserId="57" LastEditDate="2014-08-19T17:17:04.833" LastActivityDate="2014-08-19T17:17:04.833" Title="More efficient matrix count method" Tags="&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1984" PostTypeId="1" AcceptedAnswerId="2109" CreationDate="2014-08-18T11:19:05.850" Score="4" ViewCount="125" Body="&lt;p&gt;I want to control what users are able to do. For example, prevent access to the CP when the system is off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I &lt;strong&gt;prevent users for assigning extra permissions&lt;/strong&gt; but still allow them to assign users to User Groups?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present, it would appear that anyone able to assign User Groups is also able to assign whatever permissions they want.&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2014-08-22T15:11:37.887" Title="Prevent users for assigning permissions" Tags="&lt;users&gt;&lt;security&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1985" PostTypeId="1" AcceptedAnswerId="1987" CreationDate="2014-08-18T16:33:13.737" Score="3" ViewCount="163" Body="&lt;p&gt;I can do it in PHP, but I'm having trouble converting it to twig. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$day = date(&quot;l&quot;);&#xA;date_default_timezone_set('America/Chicago');&#xA;&#xA;&#xA;&#xA;if ($day == &quot;Saturday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;SATURDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;Half priced desserts&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$1 off Seasonal Pints&amp;lt;/h3&amp;gt;&quot;;&#xA;&#xA;}&#xA;elseif ($day == &quot;Sunday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;GAMEDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;One Free Kids Meal w/ each Adult Meal&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$3 on ALL Bottled Beers&amp;lt;/h3&amp;gt;&quot;;    }&#xA;elseif ($day == &quot;Monday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;MONDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$1 Tenders &amp;lt;br /&amp;gt;(5 piece min.)&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$2 Lonestar Pints&amp;lt;/h3&amp;gt;&quot;;  }&#xA;elseif ($day == &quot;Tuesday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;TUESDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$.50 Boneless Wings &amp;lt;br /&amp;gt; (10 piece min.)&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$4 Margaritas&amp;lt;/h3&amp;gt;&quot;;  }&#xA;elseif ($day == &quot;Wednesday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;WEDNESDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;Half price APPs!&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$3 shots of Jameson &amp;amp; Jager&amp;lt;/h3&amp;gt;&quot;;&#xA;}&#xA;elseif ($day == &quot;Thursday&quot;)&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;THURSDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;2 for $10 Wingzup Burgers&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$3 Draft Beers all day&amp;lt;/h3&amp;gt;&quot;;&#xA;}&#xA;else&#xA;{&#xA;    echo &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;FRIDAY SPECIALS&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;/div&amp;gt;&amp;lt;div class=\&quot;mod1\&quot;&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;FOOD&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$2 Chili Pies&amp;lt;/h3&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;p&amp;gt;DRINK&amp;lt;/p&amp;gt;&quot;;&#xA;    echo &quot;&amp;lt;h3&amp;gt;$10 Pitchers (Bud Lt./Ziegenbock/Lone Star)&amp;lt;/h3&amp;gt;&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="686" LastEditorUserId="45" LastEditDate="2014-08-18T16:47:59.307" LastActivityDate="2014-08-18T16:56:40.777" Title="How do I make display a specific post based on what the day of the week it is?" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1986" PostTypeId="2" ParentId="1984" CreationDate="2014-08-18T16:42:08.573" Score="1" Body="&lt;p&gt;At the moment, you can't separate those two permissions issues. However, feel free to put in a feature request to support@buildwithcraft.com or the &lt;a href=&quot;https://plus.google.com/u/0/communities/106505340287442511226&quot; rel=&quot;nofollow&quot;&gt;Google+ community&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, here's what I have done... &lt;strong&gt;You can automatically assign a user to a group upon registration.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change the permissions of your main user group to lock them out of all &quot;Users&quot; management permissions. Add a business logic plugin to your site (if you don't have one already).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put this into the &lt;strong&gt;init&lt;/strong&gt; method of your plugin's main class...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init() {&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;        $targetGroupId = 1;&#xA;&#xA;        // If new user&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;            // If &quot;groups&quot; is in POST&#xA;            if (isset($_POST['groups'])) {&#xA;&#xA;                // If not an array, it's an empty string&#xA;                if (!is_array($_POST['groups'])) {&#xA;                    // Set it to an array with the user group ID&#xA;                    $_POST['groups'] = array($targetGroupId);&#xA;                } else {&#xA;                    // Merge in the user group ID with any existing ones.&#xA;                    $_POST['groups'] = array_merge($_POST['groups'], array($targetGroupId));&#xA;                }&#xA;&#xA;            }&#xA;&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-18T16:42:08.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1987" PostTypeId="2" ParentId="1985" CreationDate="2014-08-18T16:47:32.017" Score="6" Body="&lt;p&gt;To get the current date and time in Twig use the string &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot;&gt;&lt;code&gt;&quot;now&quot;&lt;/code&gt;&lt;/a&gt; and filter it with the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot;&gt;&lt;code&gt;date()&lt;/code&gt;&lt;/a&gt; filter to return it in the format you need (see the &lt;a href=&quot;http://de1.php.net/manual/en/function.date.php&quot;&gt;list for supported parameters&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then do the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot;&gt;&lt;code&gt;if&lt;/code&gt; / &lt;code&gt;elseif&lt;/code&gt;&lt;/a&gt; conditionals similar to how you'd do it in PHP. Another option would be to use the Craft specific &lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot;&gt;&lt;code&gt;switch&lt;/code&gt;&lt;/a&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% switch &quot;now&quot; | date(&quot;l&quot;) %}&#xA;&#xA;    {% case &quot;Monday&quot; %}&#xA;        {# Do Monday stuff #}&#xA;&#xA;    {% case &quot;Tuesday&quot; %}&#xA;        {# Do Tuesday stuff #}&#xA;&#xA;    {% case &quot;Wednesday&quot; %}&#xA;        {# Do Wednesday stuff #}&#xA;&#xA;    {# etc. #}&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="125" LastEditDate="2014-08-18T16:56:40.777" LastActivityDate="2014-08-18T16:56:40.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1988" PostTypeId="1" AcceptedAnswerId="1996" CreationDate="2014-08-18T16:51:58.697" Score="6" ViewCount="931" Body="&lt;p&gt;We had an instance where a user deleted an admin and it seemed to delete the content that user had created. Is this currently how Craft works? If so is there a way around that without having to change every entry's author. Or suggestion adding a prompt to warn user of content being deleted and to just suspend them.&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="57" LastEditDate="2014-08-18T18:09:51.410" LastActivityDate="2015-04-14T05:58:39.630" Title="When deleting a user do the entries they created also get deleted?" Tags="&lt;entries&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1989" PostTypeId="1" AcceptedAnswerId="1990" CreationDate="2014-08-18T16:53:04.407" Score="6" ViewCount="910" Body="&lt;p&gt;I've got a Quick Post widget for notes (tweet-like posts). Is there any way to make the titles optional? I've tried adding the id as an auto-generated title but it doesn't appear to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;It actually appears that the auto-generated title is now working (thanks to carlcs) but it only works through the entries menu item rather than the quick post widget despite the widget's type being correct.&lt;/p&gt;&#xA;" OwnerUserId="633" LastEditorUserId="633" LastEditDate="2014-08-18T19:20:08.263" LastActivityDate="2014-08-25T16:37:58.013" Title="Is It Possible To Make Titles Optional?" Tags="&lt;auto-generate&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1990" PostTypeId="2" ParentId="1989" CreationDate="2014-08-18T17:23:22.710" Score="4" Body="&lt;p&gt;If you set the title format to a string like &quot;Note&quot; in the channel's field layout, all your entries will be given this exact name. The entry slug will be saved prefixed: &quot;note-1&quot;, &quot;note-2&quot;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want them all to be named the same, you could add a date to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Note {{ 'now'|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This approach has one problem, if you make an edit to the &quot;Notes&quot; entry at a later point, the title will get updated to a new &lt;code&gt;'now'&lt;/code&gt; date. To work against that you can add a conditional to the code, checking if a title is already saved for that entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.title ? object.title : 'Note ' ~ 'now'|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the case you add more than one &quot;Note&quot; a day the entries would still be named the same though. To solve that, you could format &lt;code&gt;'now'&lt;/code&gt; to add a time to the title &lt;code&gt;|date('Y-m-d H:i')&lt;/code&gt;, or you could use a counter instead. Because entry IDs are saved across all sections you wouldn't want to use them here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you could do is to use the entry title of the previous entry in your &quot;Notes&quot; section (sorted by title) and modify upon that. Just name your first entry in your section &quot;Note 001&quot; and then use this snippet as the title format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.title ? object.title : 'Note %03d'|format(craft.entries.type('note').order('title').last().title|slice(5) + 1) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="57" LastEditDate="2014-08-25T16:37:58.013" LastActivityDate="2014-08-25T16:37:58.013" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1991" PostTypeId="1" AcceptedAnswerId="1994" CreationDate="2014-08-18T17:26:32.470" Score="1" ViewCount="512" Body="&lt;p&gt;I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requireAjaxRequest();&#xA;&#xA;$segments = craft()-&amp;gt;request-&amp;gt;getActionSegments();&#xA;&#xA;$lang = $segments[2];&#xA;&#xA;$entryId = $segments[3];&#xA;&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById( $entryId );&#xA;&#xA;$response = array(&#xA;    'titre' =&amp;gt; $entry-&amp;gt;typeChambre,&#xA;    'etage' =&amp;gt; $entry-&amp;gt;etage-&amp;gt;label,&#xA;    'surface' =&amp;gt; $entry-&amp;gt;surface,&#xA;    'loyer' =&amp;gt; $entry-&amp;gt;loyer,&#xA;    'charges' =&amp;gt; $entry-&amp;gt;charges,&#xA;    'description' =&amp;gt; $entry-&amp;gt;description,&#xA;    'photos' =&amp;gt; $entry-&amp;gt;photosChambre&#xA;);&#xA;&#xA;$this-&amp;gt;returnJson($response);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="57" LastEditDate="2014-08-18T18:05:03.773" LastActivityDate="2014-08-18T18:07:55.040" Title="How can you retrieve entries with a specific locale in a plugin?" Tags="&lt;localization&gt;&lt;ajax&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1992" PostTypeId="2" ParentId="1989" CreationDate="2014-08-18T17:36:32.767" Score="3" Body="&lt;p&gt;So odd, I actually &lt;em&gt;just&lt;/em&gt; arrived at this. It was from using the Guest Entries plugin and I wanted a front end form that created a derived title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution was to create a hidden input with the title value as dummy content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; value=&quot;placer&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the Entry Service ran, it saved the entry with the correct derived title&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-08-18T17:36:32.767" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1993" PostTypeId="2" ParentId="1518" CreationDate="2014-08-18T18:01:09.120" Score="4" Body="&lt;p&gt;I just tested this locally and it's working fine (with the caveat that the latest build 2.1.2568 introduced a separate, unrelated bug that broke front-end asset uploading that's been fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2569&quot; rel=&quot;nofollow&quot;&gt;build 2.1.2569&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely something is failing validation when the entry is saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using this to see if there are any errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;ajax-form&quot; method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;17&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[whitepaperCategory]&quot; value=&quot;{{entry.title}}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;title&quot; required&amp;gt;&#xA;&#xA;    {% if entry is defined %}&#xA;        {{ errorList(entry.getErrors('title')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;email&quot;&amp;gt;Email Address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;fields[email]&quot; required&amp;gt;&#xA;&#xA;    {% if entry is defined %}&#xA;        {{ errorList(entry.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;resume&quot;&amp;gt;Resume and Cover Letter (.pdf)&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;file-upload btn btn-primary&quot;&amp;gt;&#xA;        &amp;lt;span&amp;gt;Upload Resume and Cover Letter&amp;lt;/span&amp;gt;&#xA;        &amp;lt;input type=&quot;file&quot; id=&quot;resume&quot; name=&quot;fields[resumes][]&quot; class=&quot;upload&quot; multiple&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% if entry is defined %}&#xA;        {{ errorList(entry.getErrors('resumes')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-19T17:27:46.587" LastActivityDate="2014-08-19T17:27:46.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1994" PostTypeId="2" ParentId="1991" CreationDate="2014-08-18T18:07:55.040" Score="1" Body="&lt;p&gt;You'll want to use an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;id = $entryId;&#xA;$criteria-&amp;gt;locale = $lang;&#xA;$entry = $criteria-&amp;gt;first();&#xA;&#xA;if ($entry)&#xA;{&#xA;    $response = array(&#xA;        'titre' =&amp;gt; $entry-&amp;gt;typeChambre,&#xA;        'etage' =&amp;gt; $entry-&amp;gt;etage-&amp;gt;label,&#xA;        'surface' =&amp;gt; $entry-&amp;gt;surface,&#xA;        'loyer' =&amp;gt; $entry-&amp;gt;loyer,&#xA;        'charges' =&amp;gt; $entry-&amp;gt;charges,&#xA;        'description' =&amp;gt; $entry-&amp;gt;description,&#xA;        'photos' =&amp;gt; $entry-&amp;gt;photosChambre&#xA;    );&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-18T18:07:55.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1995" PostTypeId="1" AcceptedAnswerId="2032" CreationDate="2014-08-18T18:08:41.493" Score="3" ViewCount="485" Body="&lt;p&gt;It's possible to generate a &quot;flash&quot; error message at the top of the control panel like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setError('Your custom plugin error message.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The message appears at the top of the control panel when the page loads, but then fades away after a few seconds. &lt;strong&gt;Is there any way to &quot;pin&quot; the message to the top of the page, so it stays indefinitely?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-19T22:07:07.977" Title="How do you &quot;pin&quot; a flash error message in the CP?" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1996" PostTypeId="2" ParentId="1988" CreationDate="2014-08-18T18:11:04.700" Score="8" Body="&lt;p&gt;Currently, yes, that's how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our list to 1) Add a prompt warning what's about to happen and 2) Add options as to what you want to do with that author's current content (assign to a different user, delete, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3&lt;/a&gt;, when a user's account is deleted you'll be prompted what you want to do with their content.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-01-22T18:32:55.787" LastActivityDate="2015-01-22T18:32:55.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1997" PostTypeId="2" ParentId="1945" CreationDate="2014-08-18T18:34:37.773" Score="1" Body="&lt;p&gt;Currently there isn't a way to do what you're looking for from the control panel, even if a user has &quot;Administrate Users&quot; permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the control panel, only current administrators can change an existing user's email or password and they must supply their existing administrator password to do so.  And even administrators can't set an initial password for a user from the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end, if you're running Craft Pro and you've enabled public registration, a user &lt;em&gt;can&lt;/em&gt; set an initial password from the public registration form.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-18T18:34:37.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1998" PostTypeId="1" AcceptedAnswerId="2000" CreationDate="2014-08-18T18:43:20.680" Score="8" ViewCount="1542" Body="&lt;p&gt;When building a plugin, how does one define user editable config files? Would it be better to create a settings UI in the plugin and have the user edit those variables in the CP? Or is there a way to do it properly with a config file? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I want to opt for a config option is so the value can be localized for the specific environment to set different options. I need to add the ability to define a public directory that will be used to store generated images and obviously that path could be different on local and production environments.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-08-18T19:29:49.553" Title="How does a plugin include it's own config options?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1999" PostTypeId="2" ParentId="1998" CreationDate="2014-08-18T19:12:40.750" Score="2" Body="&lt;p&gt;I would use plugin settings to store these kinds of values. Then in your plugin files (controller, services etc.) you could call up the settings and adjust your output as needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for asset paths and your site path, you can keep all of those relative by using the URL helper functions like &#xA;&lt;code&gt;{{ url('assets/build/css/main.css') }}&lt;/code&gt; and &lt;code&gt;UrlHelper::getUrl('/')&lt;/code&gt; depending on where you are working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a related post - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/418/how-do-i-reference-the-settings-of-my-plugin&quot;&gt;How do I reference the settings of my plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-18T19:12:40.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2000" PostTypeId="2" ParentId="1998" CreationDate="2014-08-18T19:23:49.937" Score="11" Body="&lt;p&gt;You can add a &lt;code&gt;config.php&lt;/code&gt; file in the root of your plugin's folder (&lt;code&gt;craft/plugins/pluginhandle/config.php&lt;/code&gt;) that specifies the default values of your config items by returning an array of key value pairs for config settings and values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user wants to change any of those settings, they can add a &lt;code&gt;pluginhandle.php&lt;/code&gt; config file to &lt;code&gt;craft/config/pluginhandle.php&lt;/code&gt; that returns an array with the overridden key value pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your plugin, if you call:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('key', 'pluginhandle')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then Craft will return the user supplied value, if it exists, and fallback on the plugin supplied default value, if it does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth nothing that all of Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot;&gt;multi-environment config stuff&lt;/a&gt; will work in this context for the plugin, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-18T19:29:49.553" LastActivityDate="2014-08-18T19:29:49.553" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2001" PostTypeId="1" AcceptedAnswerId="2016" CreationDate="2014-08-19T02:20:55.310" Score="4" ViewCount="812" Body="&lt;p&gt;Within my plugin, I have a need to open an Assets sheet and pick a file that has been uploaded and make use of it in my plugin. How is this possible? I am looking for something similar to the EE version of Assets that will allow me to programmatically use Assets with JS.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-08-19T15:47:45.363" Title="How does a plugin make use of Assets?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2002" PostTypeId="1" AcceptedAnswerId="2003" CreationDate="2014-08-19T02:32:35.510" Score="2" ViewCount="210" Body="&lt;p&gt;I would like to make a separate RSS feed for each entry type of a section, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/posts/feed.rss&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/posts/feed.rss&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/videos/feed.rss&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/videos/feed.rss&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;" OwnerUserId="687" LastEditorUserId="687" LastEditDate="2014-08-19T02:43:19.037" LastActivityDate="2014-08-19T03:13:57.373" Title="How to make a separate RSS feed for each entry type of a section?" Tags="&lt;entry-type&gt;&lt;rss&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2003" PostTypeId="2" ParentId="2002" CreationDate="2014-08-19T03:13:57.373" Score="1" Body="&lt;p&gt;Rey - depending on how you've setup your enries and folder structure you could create feed.rss as a template in both of those folders. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the template you can setup the entry loop to output whatever information you need the RSS feed to include. It's not automated but completely within your control.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-19T03:13:57.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2004" PostTypeId="2" ParentId="2001" CreationDate="2014-08-19T03:23:14.690" Score="1" Body="&lt;p&gt;I build a plugin called &lt;a href=&quot;https://craftpl.us/plugins/lemmings&quot; rel=&quot;nofollow&quot;&gt;Lemmings&lt;/a&gt; that does this as one of it's built in functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside your plugin (depending on exactly what kind of plugin you're building) you'll need to include an element field aimed add accessing assets. Here's the one I used for Lemmings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelect({&#xA;     elements: t_element,&#xA;     id: 'thumbId',&#xA;     name: 'thumbId',&#xA;     elementType: t_elementType,&#xA;     criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_us&quot;},&#xA;     sourceElementId: thumbId,&#xA;     jsClass: 'Craft.AssetSelectInput',&#xA;     addButtonLabel: 'Select Thumbnail',&#xA;     limit: 1,&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before you can build your html form/page. You'll need to register a control panel route (registerCpRoutes) and point over to an action. This action will rending your template and including the element type as defined below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $variables['t_elementType'] = craft()-&amp;gt;elements-&amp;gt;getElementType(ElementType::Asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2014-08-19T03:31:58.083" LastActivityDate="2014-08-19T03:31:58.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2005" PostTypeId="2" ParentId="1957" CreationDate="2014-08-19T05:53:43.447" Score="1" Body="&lt;p&gt;You might like to check out this alternative &lt;a href=&quot;http://www.discourse.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.discourse.org/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="473" LastActivityDate="2014-08-19T05:53:43.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2006" PostTypeId="1" AcceptedAnswerId="2010" CreationDate="2014-08-19T08:45:53.423" Score="4" ViewCount="1191" Body="&lt;p&gt;Given a list of assets, for each asset, how do I display a list of entries that relate to this asset? So, for instance, if asset A is selected as asset in entries 1 and 2, I want a list to be displayed like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset A:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Used in entry 1&lt;/li&gt;&#xA;&lt;li&gt;Used in entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Asset B:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Used in ... etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With this ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content = craft.entries.section('content').find() %}&#xA;{% set usedFotos = craft.assets.relatedTo(content).find() | group('id') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... I can see if certain assets are used, but now I want to see what entr(y/ies) they belong to.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-08-19T11:32:23.077" Title="How do I display a list of assets with the entries they are related to?" Tags="&lt;entries&gt;&lt;assets&gt;&lt;relations&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2007" PostTypeId="2" ParentId="1969" CreationDate="2014-08-19T09:35:06.030" Score="5" Body="&lt;p&gt;Ok, I got it working with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nginx vhost config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location /en/ {&#xA;    try_files $uri $uri/ @enrewrites;&#xA;}&#xA;&#xA;location /nl/ {&#xA;    try_files $uri $uri/ @nlrewrites;&#xA;}&#xA;&#xA;location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;}&#xA;&#xA;location @enrewrites {&#xA;    rewrite ^/en/(.*)$ /en/index.php?p=$1 last;&#xA;}&#xA;&#xA;location @nlrewrites {&#xA;    rewrite ^/nl/(.*)$ /nl/index.php?p=$1 last;&#xA;}&#xA;&#xA;location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in general craft config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="156" LastEditorUserId="9" LastEditDate="2015-08-10T20:10:34.900" LastActivityDate="2015-08-10T20:10:34.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2008" PostTypeId="1" CreationDate="2014-08-19T09:40:18.597" Score="5" ViewCount="565" Body="&lt;p&gt;Is there any way to set entries of an certain entry type to auto-expire after a certain number of days from the original post date? &lt;/p&gt;&#xA;" OwnerUserId="296" LastEditorUserId="125" LastEditDate="2014-08-19T16:22:10.380" LastActivityDate="2015-05-13T16:03:55.937" Title="How to set entries to auto-expire after certain # of days from post date?" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2009" PostTypeId="1" AcceptedAnswerId="2011" CreationDate="2014-08-19T11:10:48.220" Score="3" ViewCount="138" Body="&lt;p&gt;This seems like a somewhat overlooked feature. When I use an &quot;Entries&quot; field type with &quot;All&quot; sources selected. I don't have the option to select the root link for any of the channels. I &lt;strong&gt;can&lt;/strong&gt; select the individual entries for the channels, just not the actual channel itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this intentional? Or is there a way to include channel index pages as a selectable option too?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-08-19T11:36:24.560" Title="How can I select channel index/root pages from an Entries Field Type?" Tags="&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2010" PostTypeId="2" ParentId="2006" CreationDate="2014-08-19T11:23:30.667" Score="5" Body="&lt;p&gt;You probably have to query a new ElementCriteriaModel for each asset in your loop and use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter to filter the relevant &quot;content&quot; entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the &lt;code&gt;targetElement&lt;/code&gt; property with the &lt;code&gt;relatedTo&lt;/code&gt; parameter to be more spezific on that relation. But you should be fine using the &lt;code&gt;element&lt;/code&gt; property or the short syntax &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;relatedTo(element)&lt;/code&gt;&lt;/a&gt;, if you don't do any (reverse) relations (e.g. with an entries field as an &lt;a href=&quot;http://buildwithcraft.com/docs/assets#asset-meta-fields&quot; rel=&quot;noreferrer&quot;&gt;asset meta field&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tested this on an install with 400 images and yes, you want to wrap it in &lt;code&gt;cache&lt;/code&gt; tags!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content = craft.entries.section('content').find() %}&#xA;{% set usedFotos = craft.assets.relatedTo(content).order('filename').find() %}&#xA;&#xA;{# Loop throught the array of assets #}&#xA;{% for usedFoto in usedFotos %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ usedFoto.filename }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;        {# Loop throught entries related to this asset #}&#xA;        {% for entry in craft.entries.relatedTo(usedFoto).order('title') %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-19T11:32:23.077" LastActivityDate="2014-08-19T11:32:23.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2011" PostTypeId="2" ParentId="2009" CreationDate="2014-08-19T11:36:24.560" Score="2" Body="&lt;p&gt;Having thought about it a bit more, this doesn't really make much sense. Obviously the entries will only link to... entries. I got a little confused as to why it also allowed me to select &quot;single&quot; pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still think it's worth including the option to add channel index/root pages. In the meantime, because I'm using this as a crude navigation maker, I've just created an additional single section. I then directed the Entry Template to the same directory as the index.html page. This then gives me the option to add it in my entry field, without messing any links up.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-08-19T11:36:24.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2012" PostTypeId="2" ParentId="2008" CreationDate="2014-08-19T12:02:04.033" Score="5" Body="&lt;p&gt;There's no build in functionality for this, but you could make a custom plugin that automatically sets the expiration date &lt;code&gt;expiryDate&lt;/code&gt; when you first save an entry with a specific entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be to simply filter your entries from your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.type('myEntryType').postDate('&amp;gt;= ' ~ now|date_modify('-10 days')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a description for the expression used as the value for the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date_modify.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date_modify&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;syntax for parameter values&lt;/a&gt; in the Craft docs. And also how the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date_modify.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date_modify&lt;/code&gt;&lt;/a&gt; filter works. &lt;code&gt;now|date_modify('-10 days')&lt;/code&gt; returns a string which is then &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;concatenated&lt;/a&gt; with the string &lt;code&gt;'&amp;gt;= '&lt;/code&gt; and then passed as a value to the &lt;code&gt;postDate()&lt;/code&gt; parameter.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-19T17:04:49.627" LastActivityDate="2014-08-19T17:04:49.627" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2013" PostTypeId="1" AcceptedAnswerId="2029" CreationDate="2014-08-19T13:23:17.183" Score="10" ViewCount="2125" Body="&lt;p&gt;I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a frontend form working correctly for creating a new project and uploading files attached to it... however the missing piece to the puzzle for full management is being able to delete a project entry and also being able to manage the media attached to the project entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to let a frontend user manage assets, in particular deleting assets from their username folder?&lt;/p&gt;&#xA;" OwnerUserId="28" LastEditorUserId="28" LastEditDate="2014-08-20T03:41:00.057" LastActivityDate="2019-01-29T11:43:36.833" Title="How do you delete assets from a frontend form?" Tags="&lt;assets&gt;&lt;form&gt;&lt;entry&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2014" PostTypeId="1" AcceptedAnswerId="2017" CreationDate="2014-08-19T14:32:08.783" Score="3" ViewCount="329" Body="&lt;p&gt;I need to add some javascript to a page depending upon whether or not a matrix block is used, one is for a slideshow block to load responsiveslides.js, another is for a video block to load fitvid.js. If I place it in the loop then I will get the javascript repeated for each time an entry uses that matrix block. I'm looking to add this towards the bottom of the template and load the .js files once each if the block is used in a loop above. What's the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="231" LastEditDate="2014-08-19T14:38:32.060" LastActivityDate="2014-08-19T15:49:44.220" Title="What's the best way to setup a conditional to see if a matrix block is used?" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2015" PostTypeId="2" ParentId="2014" CreationDate="2014-08-19T15:46:33.860" Score="2" Body="&lt;p&gt;When you're looping through your matrix blocks, check against the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel#type&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;block.type&lt;/code&gt;&lt;/a&gt; to see what kind of blocks you're dealing with. Assuming you find the block type that you want (at least once), try referencing the JS file with an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeJsFile&lt;/code&gt;&lt;/a&gt; tag...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/your/site/script.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you use that tag, your JS file will be queued up... If a future loop triggers the same tag, but the file is already queued up, it won't be added again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another benefit is that this will automatically render the script tag at the bottom of your page, just before the body tag closes.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-19T15:46:33.860" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2016" PostTypeId="2" ParentId="2001" CreationDate="2014-08-19T15:47:45.363" Score="2" Body="&lt;p&gt;Something like this should get you going in the right direction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.createElementSelectorModal('Asset', {&#xA;    multiSelect: true,&#xA;    criteria: { locale: this.elementLocale, kind: 'image' }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See Brandon's answer here for more information and documentation:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin&quot;&gt;Is it possible to use the ElementType Modal UI for a custom Field Type Plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-19T15:47:45.363" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2017" PostTypeId="2" ParentId="2014" CreationDate="2014-08-19T15:49:44.220" Score="4" Body="&lt;p&gt;I would use a loop to set a conditional, and then check it afterwards. You need to initialize the conditional outside of the loop, otherwise it won't be set outside the loop later.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set haveAVideo = false %}&#xA;{% for block in matrixBlocks %}&#xA;  {% if block.type == 'video' %}&#xA;    {% set haveAVideo = true %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if haveAVideo %}&#xA;  {# video block js #}&#xA;  {% includeJsFile ... %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-19T15:49:44.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2018" PostTypeId="2" ParentId="1983" CreationDate="2014-08-19T16:17:37.807" Score="2" Body="&lt;p&gt;I'd say that due to the level of nested that you have going on, this is probably as compact of code as you can get out of the box. From an efficiency standpoint, you are only looping through the loop once, so I can't imagine there being anything more efficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wanting to minimize the amount of logic in your template, then you can create a plugin and utilize &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variables&lt;/a&gt; that would accept the matrix content as a parameter. Logic would be handled with PHP and could return an associative array of properties (specialWin, specialNominations, normalWin, normalNominations). So you'd end up with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrixData = craft.myPlugin.myPluginVariableMethod( entry.matrixloop ) %}&#xA;{# Debug Information #}&#xA;{#&#xA;&amp;lt;p&amp;gt; Special win: {{ matrixData.specialWin }} &amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt; Special Nominations: {{ matrixData.specialNominations }} &amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt; Normal Win: {{ matrixData.normalWin }} &amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt; Normal Nomination: {{ matrixData.normalNominations }} &amp;lt;/p&amp;gt;&#xA;&#xA;{{ entry.matrixloop | length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Personally, I'd go with the plugin route just to keep heavy logic out of the templates. It's nice that you can do that type of logic via twig if you want, but it also muddles things up a bit.&lt;/p&gt;&#xA;" OwnerUserId="279" LastActivityDate="2014-08-19T16:17:37.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2019" PostTypeId="1" AcceptedAnswerId="2020" CreationDate="2014-08-19T17:06:57.260" Score="2" ViewCount="1366" Body="&lt;p&gt;I am wondering if Craft/Yii has some sort of built in queuing system for apps that need to do additional processing that could hang up the UI or make the user wait unnecessarily. I am looking for something similar to Laravel Queues. Does Craft have something similar built in? If not, I think queues would make a great addition to the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://laravel.com/docs/queues&quot; rel=&quot;nofollow&quot;&gt;http://laravel.com/docs/queues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2018-05-21T10:23:50.267" Title="Does Craft have a server-side queuing system?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2020" PostTypeId="2" ParentId="2019" CreationDate="2014-08-19T17:14:10.967" Score="4" Body="&lt;p&gt;Not so much true queues, but Craft does have the (completely undocumented) concept of Tasks, which are meant to be used for potentially long running tasks that don't need to execute immediately.  Plugins can create and register tasks to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some questions discussing them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1394/my-tasks-dont-seem-to-be-running-as-a-background-process&quot;&gt;My tasks don&amp;#39;t seem to be running as a background process&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/497/how-to-add-a-subtask-to-an-already-running-task&quot;&gt;How to add a subTask to an already running Task?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1359/triggering-the-start-of-a-task-from-a-cron-job&quot;&gt;Triggering the start of a task from a CRON job&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can view the TaskService in &lt;code&gt;craft/app/services/TaskService.php&lt;/code&gt; and you can see examples of Craft's own tasks in &lt;code&gt;craft/app/tasks&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth noting that proper support for queues at the framework level looks like it's on the &lt;a href=&quot;https://github.com/yiisoft/yii2/pull/2378&quot; rel=&quot;nofollow&quot;&gt;roadmap for Yii 2.1&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-19T17:32:43.730" LastActivityDate="2014-08-19T17:32:43.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2021" PostTypeId="1" AcceptedAnswerId="2027" CreationDate="2014-08-19T17:52:46.713" Score="14" ViewCount="2174" Body="&lt;p&gt;I have some entries that I'd like to move to a different channel, but I don't see any way to do this. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="9" LastEditDate="2014-09-22T18:25:09.703" LastActivityDate="2019-05-02T19:11:25.500" Title="Move entries between sections" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2022" PostTypeId="1" CreationDate="2014-08-19T18:59:13.420" Score="3" ViewCount="381" Body="&lt;p&gt;I was wondering if someone with Paypal/PHP experience could give some suggestions on how to integrate Paypal with the Guest Entries plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the Guest Entries plugin to build a job listing (it has been done before, check it out &lt;a href=&quot;http://pasesetter.org/jobs&quot; rel=&quot;nofollow&quot;&gt;http://pasesetter.org/jobs&lt;/a&gt;) and would have to charge a small fee for users (no registration required) to submit job listings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before the entry/listing becomes published, users would be redirected directly to PayPal where they can make the payment. Paypal already has an auto-return option for websites payments, so users are redirected back to the site after payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance would be highly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="385" LastEditorUserId="385" LastEditDate="2014-08-20T05:13:18.367" LastActivityDate="2014-09-24T23:09:16.333" Title="Guest Entries plugin with Paypal integration?" Tags="&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2023" PostTypeId="1" AcceptedAnswerId="2169" CreationDate="2014-08-19T19:22:44.093" Score="4" ViewCount="836" Body="&lt;p&gt;The validations error message get displayed in main language instead of being translated, you can try here (contact form at bottom):&#xA;&lt;a href=&quot;http://lequartiergeneral.be/en/&quot; rel=&quot;nofollow&quot;&gt;http://lequartiergeneral.be/en/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form is being displayed and get response via Ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to display them correctly in each language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="156" LastEditDate="2014-08-20T21:01:27.203" LastActivityDate="2014-08-26T14:04:52.967" Title="P&amp;T Contact Form plugin: How to display error messages in other languages via Ajax" Tags="&lt;ajax&gt;&lt;language&gt;&lt;plugin-contactform&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2024" PostTypeId="1" CreationDate="2014-08-19T19:59:05.733" Score="2" ViewCount="195" Body="&lt;p&gt;I frequently run into front-end performance issues in EE CP pages, where I have a big Matrix field (100+ rows), or a Playa field with a long list of entries (3000+ relatable entries), or worst of all, a combo of the two: The page gets really slow, and sometimes freezes, while JS initializes and renders all of those fields and their content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious if the same issues would plague big Matrix/Relationship fields in Craft's CP. If not, what architectural differences make it so?&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2014-08-19T20:27:19.787" LastActivityDate="2014-08-19T20:48:23.497" Title="How might big Matrix/Relationship fields affect front-end CP performance?" Tags="&lt;control-panel&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2025" PostTypeId="1" AcceptedAnswerId="2036" CreationDate="2014-08-19T20:08:55.807" Score="2" ViewCount="998" Body="&lt;p&gt;I've got a section called 'web development' and there are four categories that apply to it. Three can be grouped together as 'original content' and one is a link list to external third party content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to split my entry archive list such that one group lists all entries in the Web Development section that &lt;em&gt;don't&lt;/em&gt; belong to the 'external' category (there will only ever be one 'external' category, but I may make new categories that apply to 'original content' so I don't want to hard-code the categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I'd like to loop through again but only listing entries that &lt;em&gt;do&lt;/em&gt; belong to that 'external' category. For each entry I'd like to spit out which category it belongs to as well as the entry title and date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't wrap my head around how to do this, I'm not sure I'm groking how to use relations. Or would I be better to create nested categories rather than trying to group them 'after the fact'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: went with making categories and sub categories, but still can't get things to work!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set originalContentCategory   = craft.categories.slug('original-content').find() %}&#xA;{% set originalContentCategories = craft.categories.group('global').descendantOf(originalContentCategory).find() %}&#xA;{% for category in originalContentCategories %}&#xA;    &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;    {{ category.synopsis }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is listing all categories in the group, including the 'original-content' category itself. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2014-08-19T21:34:35.840" LastActivityDate="2014-08-20T08:49:54.203" Title="List all entries in a section filtered by given category groups" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2026" PostTypeId="2" ParentId="2024" CreationDate="2014-08-19T20:48:23.497" Score="1" Body="&lt;p&gt;Matrix fields are going to suffer from similar scalability issues if you have a large number of blocks in a single field, affecting memory consumption, MySQL/Javascript performance, and usability. We consider that a bug (and it has been logged in our bug tracker as such), and plan on addressing it at some point in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relational fields have similar issues if you plan on &lt;em&gt;selecting&lt;/em&gt; hundreds of elements. If you simply have a section with hundreds of entries, but don’t intend on actually selecting more than a handful, you don’t have anything to worry about; the element selector modal that comes up when you want to select additional elements is perfectly scalable, because it only loads 50 elements at a time, and lazy-loads additional elements as needed via an infinite scrolling implementation.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-19T20:48:23.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2027" PostTypeId="2" ParentId="2021" CreationDate="2014-08-19T20:53:01.843" Score="14" Body="&lt;p&gt;It’s currently only possible via direct manipulation of the entries in your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will first need to visit your &lt;code&gt;sections&lt;/code&gt; table to determine the desired &lt;strong&gt;section ID&lt;/strong&gt;, and then the &lt;code&gt;entrytypes&lt;/code&gt; table to determine the desired &lt;strong&gt;entry type ID&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have those, find your entry’s row in the &lt;code&gt;entries&lt;/code&gt; table, and change its &lt;code&gt;sectionId&lt;/code&gt; and &lt;code&gt;typeId&lt;/code&gt; columns accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; If either of the the old/new sections are Structures, there’s quite a bit more work involved, and your best bet will be to write some PHP code to handle the migration. See &lt;a href=&quot;https://craftcms.stackexchange.com/a/4467/9&quot;&gt;https://craftcms.stackexchange.com/a/4467/9&lt;/a&gt; for a complete example of how to do that.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-10-30T21:42:14.830" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2028" PostTypeId="1" AcceptedAnswerId="2031" CreationDate="2014-08-19T20:57:08.817" Score="9" ViewCount="2882" Body="&lt;p&gt;I'm developing a site locally using MAMP + VirtualHostX on Mavericks. I'm at the point in the project where I want to create some user accounts for clients, but I can't seem to get my mail set up properly so Craft can send emails from my local environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone done this same thing? Any advice for getting Craft emails working on a similar local dev environment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2020-07-25T17:47:49.847" Title="How do I set up Craft to send emails from my local MAMP/Virtual Host X dev environment" Tags="&lt;emails&gt;&lt;mamp&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2029" PostTypeId="2" ParentId="2013" CreationDate="2014-08-19T21:09:31.883" Score="9" Body="&lt;p&gt;You can create a POST request via Ajax to the &lt;code&gt;assets/deleteFile&lt;/code&gt; (Craft 2) / &lt;code&gt;assets/delete-asset&lt;/code&gt; (Craft 3) controller action:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;$('#delete-file').click(function() {&#xA;    var data = {&#xA;        fileId: 100&#xA;    };&#xA;&#xA;    $.post('/actions/assets/deleteFile', data, function(response) {&#xA;        // ...&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;$('#delete-file').click(function() {&#xA;    var data = {&#xA;        assetId: 100&#xA;    };&#xA;&#xA;    $.post('/actions/assets/delete-asset', data, function(response) {&#xA;        // ...&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That controller action will require that the user is logged-in with a user account that has the “Remove files” permission on the asset source that the file belongs to. Granting that permission to a user will give them the ability to delete &lt;strong&gt;any&lt;/strong&gt; file within that asset source though - not just their own. So this is probably not a good idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better way of doing this would be to write a &lt;a href=&quot;https://docs.craftcms.com/v3/extend/module-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;module&lt;/a&gt; that provides its own &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/structure-controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; that does its own permission checking and handles the file deletion. It would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class MyController extends BaseController&#xA;{&#xA;    public function actionDeleteFile()&#xA;    {&#xA;        $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;        $fileId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('fileId');&#xA;        $file = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;&#xA;        if (!$file)&#xA;        {&#xA;            throw new Exception('Could not find a file with the ID '.$fileId);&#xA;        }&#xA;&#xA;        // Make sure that it's within a folder with the same name as the user's username&#xA;        if ($file-&amp;gt;getFolder()-&amp;gt;name != craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;username)&#xA;        {&#xA;            throw new HttpException(403);&#xA;        }&#xA;&#xA;        $response = craft()-&amp;gt;assets-&amp;gt;deleteFiles($fileIds);&#xA;        $this-&amp;gt;returnJson($response-&amp;gt;getResponseData());&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\web\Controller;&#xA;use yii\web\BadRequestHttpException;&#xA;use yii\web\ForbiddenHttpException;&#xA;use yii\web\Response;&#xA;&#xA;class MyController extends Controller&#xA;{&#xA;    public function actionDeleteFile(): Response&#xA;    {&#xA;        $this-&amp;gt;requireAcceptsJson();&#xA;&#xA;        $assetId = Craft::$app-&amp;gt;request-&amp;gt;getRequiredBodyParam('fileId');&#xA;        $asset = Craft::$app-&amp;gt;assets-&amp;gt;getAssetById($assetId);&#xA;&#xA;        if (!$asset) {&#xA;            throw new BadRequestHttpException('Invalid asset ID: ' . $assetId);&#xA;        }&#xA;&#xA;        // Make sure that it's within a folder with the same name as the user's username&#xA;        if ($asset-&amp;gt;getFolder()-&amp;gt;name != Craft::$app-&amp;gt;user-&amp;gt;getIdentity()-&amp;gt;username) {&#xA;            throw new ForbiddenHttpException('Not permitted to delete asset ' . $assetId);&#xA;        }&#xA;&#xA;        $success = Craft::$app-&amp;gt;elements-&amp;gt;deleteElement($asset);&#xA;        return $this-&amp;gt;asJson([&#xA;            'success' =&amp;gt; $success,&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place, you’d just need to update your JavaScript to point to your &lt;code&gt;deleteFile&lt;/code&gt;/&lt;code&gt;delete-file&lt;/code&gt; action instead of Craft’s.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-01-29T11:43:36.833" LastActivityDate="2019-01-29T11:43:36.833" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2030" PostTypeId="2" ParentId="1995" CreationDate="2014-08-19T21:13:06.223" Score="1" Body="&lt;p&gt;Not currently. The CP’s Javascript will automatically hide all flash messages 2 or 4 seconds after page load (4 if it’s an error).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-19T21:13:06.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2031" PostTypeId="2" ParentId="2028" CreationDate="2014-08-19T21:16:37.830" Score="14" Body="&lt;p&gt;These days I just use &lt;a href=&quot;https://mandrillapp.com&quot;&gt;Mandrill&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's simple to set up, free unless you're sending tens of thousands of emails, and you can continue to use it on any development (or production) machine without any configuration changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just set &lt;a href=&quot;http://help.mandrill.com/categories/20090941-SMTP-Integration&quot;&gt;the Mandrill SMTP settings&lt;/a&gt; in the Craft admin area, and you're done.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2014-08-19T21:16:37.830" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2032" PostTypeId="2" ParentId="1995" CreationDate="2014-08-19T22:07:07.977" Score="2" Body="&lt;p&gt;I have not tried but you could probably use the CP Custom JavaScript plugin to force display of &lt;code&gt;.notification.error&lt;/code&gt; as the flash only sets &lt;code&gt;display: none;&lt;/code&gt; and does not remove the element.&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-08-19T22:07:07.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2033" PostTypeId="1" AcceptedAnswerId="2051" CreationDate="2014-08-20T03:48:32.937" Score="7" ViewCount="1866" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2013/how-do-you-delete-assets-entries-from-a-frontend-form/2029#2029&quot;&gt;Part 2 of a 3 part question:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a frontend form working correctly for creating a new project via it's own section. However the missing piece to the puzzle for full management is being able to delete an entry in the projects channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you delete entries from a front end form?&lt;/p&gt;&#xA;" OwnerUserId="28" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-08-20T17:42:57.963" Title="How do you delete entries from a frontend form?" Tags="&lt;form&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2034" PostTypeId="1" AcceptedAnswerId="2044" CreationDate="2014-08-20T04:04:23.677" Score="6" ViewCount="338" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2033/how-do-you-delete-entries-from-a-frontend-form&quot;&gt;Part 3 of a 3 part question:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A missing piece to the puzzle for full management is being able to give the user access to the assets modal and asset relationship field so they can better manage the files that are associated with the entry. Ideally they would be able to edit a field with existing content with the ability to associate new files or remove them all together (while still preserving the file in the upload directory, for this use case).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to access the asset modal and manage the relationship field from the front end?&lt;/p&gt;&#xA;" OwnerUserId="28" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-08-20T13:07:44.290" Title="Is it possible to use the assets modal on the front end?" Tags="&lt;assets&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2035" PostTypeId="2" ParentId="2023" CreationDate="2014-08-20T08:39:17.313" Score="2" Body="&lt;p&gt;There may be a better answer, or one forthcoming, but why don't you try using translation files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the translations in the file can be any phrase, not just single words, so should fit well here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;Craft doc on translation files&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this will work simply if you add the | t within the errorList macro at the to of the example contact form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error | t }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Salud ;)&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-08-20T08:39:17.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2036" PostTypeId="2" ParentId="2025" CreationDate="2014-08-20T08:49:54.203" Score="4" Body="&lt;p&gt;I would use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;without filter&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;relations&lt;/a&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# starting points #}&#xA;{% set externalCategory = craft.categories.slug('external-content').first() %}&#xA;{% set allEntries = craft.entries.section('webdev').find() %}&#xA;&#xA;{# create the arrays/objects you need #}&#xA;{% set externalEntries = craft.entries.section('webdev').relatedTo(externalCategory).find() %}&#xA;{% set otherEntries = allEntries|without(externalEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then use the usual for loops for each array / object you have created. That way, you only need to define your external-content category, all the rest is automatic, regardless of the number of other categories you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the number of entries you have and the kind of traffic you get, you might want to consider &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;caching&lt;/a&gt; this.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-08-20T08:49:54.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2037" PostTypeId="1" AcceptedAnswerId="2038" CreationDate="2014-08-20T09:07:03.663" Score="3" ViewCount="694" Body="&lt;p&gt;What's a good way to add attributes (classes etc.) to the HTML elements returned from the &lt;code&gt;markdown&lt;/code&gt; filter?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-19T17:21:26.863" LastActivityDate="2017-09-29T13:32:11.180" Title="Markdown filter, how to add HTML attributes?" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2038" PostTypeId="2" ParentId="2037" CreationDate="2014-08-20T09:07:03.663" Score="6" Body="&lt;p&gt;This is what I currently do to add a class &lt;code&gt;Bibliography&lt;/code&gt; to all generated &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; tags from my &lt;code&gt;articleBibliography&lt;/code&gt; field. Because there's never other content in this field, I'm save to replace them all.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.articleBibliography|markdown|replace({'&amp;lt;ul&amp;gt;': '&amp;lt;ul class=&quot;Bibliography&quot;&amp;gt;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;You can also use the awesome Retcon plugin for this, it’s using DomDocument internally so the result should be more reliable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.articleBibliography|markdown|retconAttr('ul', {'class': 'Bibliography'}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-09-29T13:32:11.180" LastActivityDate="2017-09-29T13:32:11.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2039" PostTypeId="1" AcceptedAnswerId="2043" CreationDate="2014-08-20T10:46:53.197" Score="3" ViewCount="226" Body="&lt;p&gt;Due to a server problem one of our production sites was unable to connect to the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it was unable to connect the site was outputting the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An exception has been thrown during the rendering of a template (&quot;Craft can't connect to the database with the credentials in craft/config/db.php.&quot;) in &quot;_layout&quot; at line 10.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm a little concerned that a production site is outputting this kind of information, is there a way to stop these errors being output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The site is currently running Craft Pro 2.1.2561 with dev mode disabled.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="173" LastEditorUserId="173" LastEditDate="2014-08-21T13:02:50.550" LastActivityDate="2014-08-21T13:02:50.550" Title="How to stop rendering errors being output in production" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2040" PostTypeId="1" CreationDate="2014-08-20T11:20:48.610" Score="5" ViewCount="1339" Body="&lt;p&gt;All, we have a website built by third party company and they gave us the pack which includes cms, craft and MySQL database. But our hosting server is hardcoded to run the website from public_html folder (can't change this). Could you tell me how can change cms references to public_html? Tried to copy everything under cms folder to public_html only to see misconfiguration errors. Let me know if you need more info. &lt;/p&gt;&#xA;" OwnerUserId="692" LastActivityDate="2014-08-20T12:22:41.967" Title="change the root directory references" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2041" PostTypeId="1" CreationDate="2014-08-20T12:11:12.120" Score="4" ViewCount="1293" Body="&lt;p&gt;I'm trying to install Craft for the first time, I've used Ben Croker's requirements check and everything passes, and I'm pretty sure everything else is set up properly, but when I access domain.com/admin to run the install, I just get a blank screen - no errors, warnings or messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried installing in a subdomain (my preference) as well as in the root, with the craft dir both above and below the root, but get the same result no matter what the config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked the logs (craft.log) and it gets this far (see below). There is no phperrors.log file. Does anyone have any ideas where I should check next?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/08/20 11:49:16 [info] [application] $_GET=array (&#xA;  'p' =&amp;gt; 'admin',&#xA;)&#xA;&#xA;$_SERVER=array (&#xA;  'DOCUMENT_ROOT' =&amp;gt; '/xxx/xxx/public_html',&#xA;  'GATEWAY_INTERFACE' =&amp;gt; 'CGI/1.1',&#xA;  'HTTP_ACCEPT' =&amp;gt; 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',&#xA;  'HTTP_ACCEPT_ENCODING' =&amp;gt; 'gzip,deflate,sdch',&#xA;  'HTTP_ACCEPT_LANGUAGE' =&amp;gt; 'en-US,en;q=0.8,es;q=0.6,fr;q=0.4,it;q=0.2,ja;q=0.2,pl;q=0.2,ru;q=0.2',&#xA;  'HTTP_HOST' =&amp;gt; 'xxx.xx.xx',&#xA;  'HTTP_PROXY_CONNECTION' =&amp;gt; 'keep-alive',&#xA;  'HTTP_USER_AGENT' =&amp;gt; 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36',&#xA;  'PATH' =&amp;gt; '/bin:/usr/bin',&#xA;  'QUERY_STRING' =&amp;gt; 'p=admin',&#xA;  'REDIRECT_QUERY_STRING' =&amp;gt; 'p=admin',&#xA;  'REDIRECT_STATUS' =&amp;gt; '200',&#xA;  'REDIRECT_UNIQUE_ID' =&amp;gt; 'U-SLOlmRTRcABtAqnnkAAAAx',&#xA;  'REDIRECT_URL' =&amp;gt; '/admin',&#xA;  'REMOTE_ADDR' =&amp;gt; 'xx.xx.xx.xx',&#xA;  'REMOTE_PORT' =&amp;gt; '62291',&#xA;  'REQUEST_METHOD' =&amp;gt; 'GET',&#xA;  'REQUEST_URI' =&amp;gt; '/admin',&#xA;  'SCRIPT_FILENAME' =&amp;gt; '/xxx/xxx/public_html/index.php',&#xA;  'SCRIPT_NAME' =&amp;gt; '/index.php',&#xA;  'SERVER_ADDR' =&amp;gt; 'xx.xx.xx.xx',&#xA;  'SERVER_ADMIN' =&amp;gt; 'xxxxx',&#xA;  'SERVER_NAME' =&amp;gt; 'xxxxxx',&#xA;  'SERVER_PORT' =&amp;gt; '80',&#xA;  'SERVER_PROTOCOL' =&amp;gt; 'HTTP/1.1',&#xA;  'SERVER_SIGNATURE' =&amp;gt; '',&#xA;  'SERVER_SOFTWARE' =&amp;gt; 'Apache',&#xA;  'UNIQUE_ID' =&amp;gt; 'U-SLOlmRTRcABtAqnnkAAAAx',&#xA;  'PHP_SELF' =&amp;gt; '/index.php',&#xA;  'REQUEST_TIME_FLOAT' =&amp;gt; 1408535356.3350970745086669921875,&#xA;  'REQUEST_TIME' =&amp;gt; 1408535356,&#xA;)&#xA;2014/08/20 11:49:16 [trace] [system.CModule] Loading &quot;db&quot; application component&#xA;in /xxx/xxx/xxx/craft/app/etc/web/WebApp.php (642)&#xA;in /xxx/xxx/xxx/craft/app/etc/behaviors/AppBehavior.php (69)&#xA;in /xxx/xxx/xxx/craft/app/etc/web/WebApp.php (799)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="693" LastEditorUserId="693" LastEditDate="2014-08-20T13:08:23.190" LastActivityDate="2015-03-26T20:05:54.253" Title="Getting blank screen at domain.com/admin when installing" Tags="&lt;install&gt;" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2042" PostTypeId="2" ParentId="2040" CreationDate="2014-08-20T12:22:41.967" Score="6" Body="&lt;p&gt;The actual web root name doesn’t matter. Usually it’s “public_html” or something similar, and Craft’s “public” folder is only meant to &lt;em&gt;represent&lt;/em&gt; that folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no references to the public/public_html folder within Craft itself; it’s the other way around: The index.php file within public/public_html is the one referencing Craft, via its &lt;code&gt;$craftPath&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here’s what you need to do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Upload the craft/ folder to your web server, ideally on the same level as your public_html/ folder rather than inside it, but if you don’t have permission to do that, inside public_html/ is OK.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Upload the public/index.php file into your public_html/ folder&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Upload the public/htaccess file into your public_html/ folder and rename it to .htaccess&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open up public_html/index.php and make sure the &lt;code&gt;$craftPath&lt;/code&gt; variable is a valid path to the craft/ folder, wherever it is.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-20T12:22:41.967" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2043" PostTypeId="2" ParentId="2039" CreationDate="2014-08-20T12:38:50.770" Score="3" Body="&lt;p&gt;DB connection errors are the &lt;strong&gt;only&lt;/strong&gt; case where Craft will output the full error even if &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;Dev Mode&lt;/a&gt; is disabled, because 99.99% of the time those only occur when Craft is not yet installed, and it’s an extremely common issue people run into when installing Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to prevent those errors from showing up on the front end, you can edit your index.php file so that it catches them, and displays something different:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;try&#xA;{&#xA;    require_once $path;&#xA;}&#xA;catch (Craft\DbConnectException $e)&#xA;{&#xA;    exit('An error occurred.');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-20T12:38:50.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2044" PostTypeId="2" ParentId="2034" CreationDate="2014-08-20T13:07:44.290" Score="3" Body="&lt;p&gt;Craft supports all of the fields within the Control Panel, but not on the front-end – the number of scenarios they would need to support on the front-end increases the scope of supporting a field dramatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does however support submitting Assets from the front-end (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1518/can-guests-upload-files-to-assets-in-an-entry-form/1993#1993&quot;&gt;an example with Guest Entries&lt;/a&gt;) and restricting Assets to user specific folders using &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Subfolder Paths&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can do what you are describing, and may even be able to reuse some of the code they use to build out the functionality, but (currently) you will have to adapt it to your scenario and maintain it yourself.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-20T13:07:44.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2045" PostTypeId="1" CreationDate="2014-08-20T13:43:21.003" Score="5" ViewCount="480" Body="&lt;p&gt;Is there any way to tweak the way search score is calculated? For example, I would like words in the title field to be scored higher than the same terms in other fields.&lt;/p&gt;&#xA;" OwnerUserId="629" LastEditorUserId="629" LastEditDate="2014-10-01T19:22:34.143" LastActivityDate="2014-10-01T19:22:34.143" Title="Modifying search scoring algorithm" Tags="&lt;search&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2046" PostTypeId="1" AcceptedAnswerId="2052" CreationDate="2014-08-20T14:33:40.387" Score="4" ViewCount="1259" Body="&lt;p&gt;On my in-development version of a site I'm working on, I'm unable to access any of my custom fields without Craft displaying an error that reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt; Function &quot;dump&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can navigate to Settings &gt; Fields but when I attempt to click on any of my fields to check/adjust settings or when I try to create a new field, I get the error screen. I'm able to access all other parts of the CP, create entries, adjust settings, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The odd thing is that I have a working instance of the site running in my local environment. As part of my troubleshooting process, I dumped the database on the staging site and imported my local version. I also replaced the &quot;craft&quot; folder on my staging site with the one from my local site. The problem still persists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently updated to the latest build (2.1.2569) so I first thought something in the update might need fixing, but my local instance is updated as well and completely functional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it helps, I'm hosting my staging site on Arcustech and have had no issues up to now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what might be going wrong?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-08-20T19:14:36.983" Title="Getting &quot;Internal Server Error: Function 'dump' does not exist&quot; when accessing/creating custom fields" Tags="&lt;control-panel&gt;&lt;field&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2047" PostTypeId="2" ParentId="2046" CreationDate="2014-08-20T16:09:45.627" Score="0" Body="&lt;p&gt;I’m guessing you have some third party field type that is calling this nonexistent function. Try enabling &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;Dev Mode&lt;/a&gt; and then going to a page that gives you the error. The stack trace will reveal what file was calling the function.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-20T16:09:45.627" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2048" PostTypeId="1" AcceptedAnswerId="2049" CreationDate="2014-08-20T16:45:19.160" Score="2" ViewCount="921" Body="&lt;p&gt;How can i redirect to the first child if an entry has children?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hasDescendants() %}&#xA;    {% redirect &quot;{{ entry.getChildren().first().url }}&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="57" LastEditDate="2014-08-20T17:12:51.503" LastActivityDate="2014-08-20T17:18:48.227" Title="How to redirect if entry has children?" Tags="&lt;redirect&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2049" PostTypeId="2" ParentId="2048" CreationDate="2014-08-20T17:18:48.227" Score="7" Body="&lt;p&gt;You have twig syntax (&lt;code&gt;{{...}}&lt;/code&gt;) inside twig syntax (&lt;code&gt;{%...%}&lt;/code&gt;), which is never right. Does this work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hasDescendants() %}&#xA;  {% redirect entry.getChildren().first().url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-20T17:18:48.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2050" PostTypeId="2" ParentId="2041" CreationDate="2014-08-20T17:24:50.073" Score="1" Body="&lt;p&gt;What happens if you try the alternate URLs noted here? &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-5-run-the-installer&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/installing#step-5-run-the-installer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's a pure white screen, that sounds like an Apache error.  Try checking Apache's error log files for any relevant errors.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-20T17:24:50.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2051" PostTypeId="2" ParentId="2033" CreationDate="2014-08-20T17:42:57.963" Score="6" Body="&lt;p&gt;It's going to be virtually identical to &lt;a href=&quot;https://craftcms.stackexchange.com/a/2029/57&quot;&gt;this answer&lt;/a&gt;, with the exception that you're posting to the 'entries/deleteEntry' controller action instead of 'assets/deleteFile' and you're posting the 'entryId' and the 'locale' of the entry you want to delete, instead of 'fileId'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this requires a logged in user with necessary delete entry permissions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-20T17:42:57.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2052" PostTypeId="2" ParentId="2046" CreationDate="2014-08-20T19:14:36.983" Score="3" Body="&lt;p&gt;Adding as an answer because it was confirmed via a support ticket that a plugin was at fault.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow&quot;&gt;dump&lt;/a&gt; method is only available in Craft when &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; is enabled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turn it off, reproduce the problem, then search your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for &lt;code&gt;[error]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stack trace listed in that error log will show which plugin is causing the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chances are that plugin is calling Twig's &lt;code&gt;dump&lt;/code&gt; somewhere in a template, assuming it will always be available, when that is not the case.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-20T19:14:36.983" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2053" PostTypeId="2" ParentId="1368" CreationDate="2014-08-21T04:40:44.997" Score="2" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the entries for the section #}&#xA;{% set entries = craft.entries.section('news').find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set entriesByAuthor = entries|group('authorId') %}&#xA;&#xA;{# Grab all of the users with the userIds in entriesByAuthor #}&#xA;{% set authors = craft.users.id(entriesByAuthor|keys) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for author in authors %}&#xA;        &amp;lt;li&amp;gt;{{ author.username }}&#xA;    {%  endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4229" LastEditDate="2018-01-29T17:51:14.637" LastActivityDate="2018-01-29T17:51:14.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2054" PostTypeId="2" ParentId="1851" CreationDate="2014-08-21T06:30:45.367" Score="6" Body="&lt;p&gt;In the way you have described that you want to use all the results on the page but just moved and used in chunks you should save a query on the database and use &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;slice&lt;/a&gt; over &lt;code&gt;offset&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesList = craft.entries.section('news').limit(15) %}&#xA;&#xA;{# Featured #}&#xA;{% for entries in entriesList | slice(0, 5) %}&#xA;{% endfor %}&#xA;&#xA;{# Other List#}&#xA;{% for entries in entriesList | slice(4, 10) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="111" LastEditorUserId="57" LastEditDate="2017-07-24T17:54:43.413" LastActivityDate="2017-07-24T17:54:43.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2055" PostTypeId="1" CreationDate="2014-08-21T07:11:48.757" Score="6" ViewCount="1199" Body="&lt;p&gt;Is it possible to password protect a single page in Craft? Wordpress has this functionality built in. I would love to do it in Craft as well. &lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="480" LastEditDate="2015-02-11T11:40:14.260" LastActivityDate="2015-02-11T11:40:14.260" Title="Password protect a single page" Tags="&lt;security&gt;&lt;password&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2057" PostTypeId="1" AcceptedAnswerId="2069" CreationDate="2014-08-21T08:29:27.100" Score="3" ViewCount="396" Body="&lt;p&gt;I can see that normal caching can have it's storage specified, but I would specifically like to be able to set the caching storage method for the template tag {% cache %}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment it appears to be hitting our MySQL database very hard and so I would like to consider using something like Redis instead.&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2014-09-26T05:59:40.877" Title="Template caching tag storage options" Tags="&lt;templating&gt;&lt;cache&gt;&lt;caching&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2058" PostTypeId="2" ParentId="2055" CreationDate="2014-08-21T08:33:09.513" Score="14" Body="&lt;p&gt;Yes. Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/requirelogin&quot;&gt;RequireLogin&lt;/a&gt; tag at the top of a page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This tag will ensure that the user is logged in. If they aren’t, they will be redirected to the Login page, and returned to the original page after successfully logging in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(make sure you are logged out before you test this!)&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-02-11T06:44:10.930" LastActivityDate="2015-02-11T06:44:10.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2059" PostTypeId="1" AcceptedAnswerId="2071" CreationDate="2014-08-21T08:40:22.407" Score="3" ViewCount="1982" Body="&lt;p&gt;Is it common to have a (near)constantly running 'Deleting stale template caches' task ongoing? I commonly log in to see a task still pending several hours after the last change to the site was made, looking in the database the task usually has 50000+ 'steps'. Each step runs reasonably quickly (although it sometimes hangs) but the process appears to be taking up quite a lot of disk IO according to newrelic and clearly some pages are not getting their cache cleared for quite some time...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could cause this and it it solvable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's any help I have a reasonably large dynamic menu that i've put in 'cache' tags around and also have one channel with &gt;1200 entries in it and the site is in 5 languages (although the channel with 1200 entries isn't localised) so this isn't a tiny site, performance still seems sluggish at times however.&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2014-08-21T15:52:17.977" Title="Long 'Deleting stale template caches'" Tags="&lt;cache&gt;&lt;performance&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2060" PostTypeId="1" AcceptedAnswerId="2065" CreationDate="2014-08-21T09:54:05.887" Score="4" ViewCount="2558" Body="&lt;p&gt;I've got a single structure menu for my entire site which consists of a title and a single related entry. I use that to output the main menu, which uses this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;top-bar-section&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;right&quot;&amp;gt;&#xA;        {% nav link in craft.entries.section('menu') %}&#xA;        &amp;lt;li class=&quot;{% if link.slug == craft.request.getSegment(1) %}active{% endif %} {% if link.hasDescendants() %}has-dropdown{% endif %}&quot;&amp;gt; {# Checks if              the page link is the same as the slug of current page #}&#xA;            &amp;lt;a href=&quot;{{ link.relatedEntry[0].url }}&quot;&amp;gt;{{link.title}}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;            &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the top level pages, in their template they have a sidebar which should output the menu items in that main section - all singles. Is there a way to do this or do I need to create separate Structures for each section?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-08-21T13:39:53.263" Title="How to output a structure sub-navigation of current page" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2061" PostTypeId="1" AcceptedAnswerId="2063" CreationDate="2014-08-21T10:13:37.560" Score="3" ViewCount="2529" Body="&lt;p&gt;When I use {{page.link}} or {{page.url}} in a template I am getting &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.dev/index.php?p=pages/about/history&quot; rel=&quot;nofollow&quot;&gt;http://mysite.dev/index.php?p=pages/about/history&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;when what I really want is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.dev/pages/about/history&quot; rel=&quot;nofollow&quot;&gt;http://mysite.dev/pages/about/history&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The latter URL works fine on the site, but I'm using the above code to try and create a menu, and don't want the menu item linking to the first URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I fix this?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2014-08-21T10:22:17.597" Title="How do I get get clean URLs in twig templates" Tags="&lt;templating&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2062" PostTypeId="1" CreationDate="2014-08-21T10:13:54.483" Score="1" ViewCount="416" Body="&lt;p&gt;I am having some odd behavior with an assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an assets field that pulls a series of images. The template pulls the image transforms using {{ asset.getUrl('galleryThumb') }}. Odd thing is, the first image added always references the /cpresources/transforms/(number)b and not the actual file. All the other files work as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried clearing the caches. I tried a rinkydink solution of uploading a dummy image, making it the first and then deleting it... which worked until I cleared the caches again which made the first real image disappear again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens also if I change the getUrl to another transform or even just the {{ asset.url }} so I am assuming it is the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The db assettransformsindex has a &quot;0&quot; in the fileExists column, but if I look in the actual transforms folder, it's there and was created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is an assets field set to go to a specific folder in the path settings of the assets field I have the name of the folder(set to 777 out of frustration) &quot;before-and-after&quot; (without quotes and no slashes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen other questions here regarding images referrencing the /cpresources/transforms and tried all the solutions but this slightly different as it is only one image(the first) of a series.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-08-21T10:13:54.483" Title="First Image in a Series always references /cpresources/transforms/" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="0" CommentCount="7" ClosedDate="2014-08-21T21:19:27.153" ContentLicense="CC BY-SA 3.0" />
  <row Id="2063" PostTypeId="2" ParentId="2061" CreationDate="2014-08-21T10:22:17.597" Score="3" Body="&lt;p&gt;Documentation for removing index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might have to adjust the .htaccess code depending on your server.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-08-21T10:22:17.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2064" PostTypeId="2" ParentId="2060" CreationDate="2014-08-21T10:24:19.497" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set sidebarNav = entry.getChildren() %}&#xA;&#xA;{% if sidebarNav | length %}&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in sidebarNav %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although I'm not sure what you mean by all singles? Is this what you're after? It will return all children of the current structure page.&lt;/p&gt;&#xA;" OwnerUserId="696" LastActivityDate="2014-08-21T10:24:19.497" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2065" PostTypeId="2" ParentId="2060" CreationDate="2014-08-21T12:42:08.403" Score="5" Body="&lt;p&gt;You first have to get the corresponding entry in your &quot;menu&quot; structure and then build your navigation upon that item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&lt;code&gt;relatedTo()&lt;/code&gt;&lt;/a&gt; parameter for that. The &lt;code&gt;entry&lt;/code&gt; entry model that you automatically get on that single template is the &lt;code&gt;targetElement&lt;/code&gt; of that relation, but you should be fine using the less specific &lt;code&gt;element&lt;/code&gt; property used with the short syntax &lt;code&gt;relatedTo(myEntryModel)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the (one!) related entry from the &quot;menu&quot; structure #}&#xA;{% set menuItem = craft.entries.section('menu').relatedTo(entry).first() %}&#xA;&#xA;{# Check if there are descendant entries #}&#xA;{% if menuItem.hasDescendants() %}&#xA;&#xA;    {# Get entries to build the sub-menu #}&#xA;    {% set subMenu = craft.entries.descendantOf(menuItem) %}&#xA;&#xA;    {# Output the sub menu #}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav link in subMenu %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ link.url }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-21T13:39:53.263" LastActivityDate="2014-08-21T13:39:53.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2066" PostTypeId="2" ParentId="2041" CreationDate="2014-08-21T13:01:52.830" Score="2" Body="&lt;p&gt;Thanks for the responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem has somehow gone away, so I can only assume it was a local error with my setup. I deleted everything, including the database etc, and installed from scratch, and now everything works.&lt;/p&gt;&#xA;" OwnerUserId="693" LastActivityDate="2014-08-21T13:01:52.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2067" PostTypeId="1" CreationDate="2014-08-21T13:40:37.227" Score="2" ViewCount="2652" Body="&lt;p&gt;Say I have a custom field &quot;URL&quot; for each entry and I want them to be redirected to these specific URLs instead of Craft's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar to WordPress &quot;Page Links To&quot; plugin. &lt;a href=&quot;http://wordpress.org/plugins/page-links-to/&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org/plugins/page-links-to/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do this in Craft?&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2014-08-21T14:50:16.570" Title="How to redirect an entry's URL to a specific URL?" Tags="&lt;entries&gt;&lt;url&gt;&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2068" PostTypeId="2" ParentId="2067" CreationDate="2014-08-21T13:54:57.867" Score="1" Body="&lt;p&gt;Use this &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;redirect&lt;/code&gt;&lt;/a&gt; tag in the template of your entries. Without any plugin! :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect entry.myUrlFieldName %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-21T13:54:57.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2069" PostTypeId="2" ParentId="2057" CreationDate="2014-08-21T14:41:54.463" Score="4" Body="&lt;p&gt;Currently, the template {% cache %} tag can only cache to the database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Brandon's comment &lt;a href=&quot;https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag/107#107&quot;&gt;here&lt;/a&gt; (&quot;Template caches always go to the database&quot;).&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-08-21T14:48:05.230" LastActivityDate="2014-08-21T14:48:05.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2070" PostTypeId="2" ParentId="2067" CreationDate="2014-08-21T14:50:16.570" Score="2" Body="&lt;p&gt;Instead of using a redirect, what about using the saved URLs directly with your links?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say it's a channel with the handle &lt;code&gt;myExternalLinks&lt;/code&gt; where you collect the links. The actual URL is entered into a field with the handle &lt;code&gt;myLinkUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the template code to list the links:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set links = craft.entries.section('myExternalLinks') %}&#xA;&#xA;{% for link in links %}&#xA;&#xA;    {#&#xA;     # Link to the URL entered into `myLinkUrl` instead of&#xA;     # linking to `entry.getUrl()` and then using a redirect on that entry template&#xA;     #}&#xA;    &amp;lt;a href=&quot;{{ link.myLinkUrl }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-21T14:50:16.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2071" PostTypeId="2" ParentId="2059" CreationDate="2014-08-21T15:52:17.977" Score="8" Body="&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt;, by default will cache it's contents on a &lt;em&gt;per URL&lt;/em&gt; and &lt;em&gt;per locale&lt;/em&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of times when we see the behavior you're seeing, that's not the desired behavior and you should be using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#globally&quot;&gt;{% cache globally %}&lt;/a&gt; parameter, where Craft stores the cached segment only on a per locale basis and &lt;em&gt;drastically&lt;/em&gt; reduces the number of rows in the database table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd inspect everywhere you're using the tag and if it makes sense to use &lt;code&gt;globally&lt;/code&gt; parameter, swap to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then clear the contents of your template cache tables (under Settings-&gt;Tools-&gt;Clear Caches Tool) and the database tables shouldn't grow anywhere near as large, letting the delete stale template caches task run faster.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-21T15:52:17.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2072" PostTypeId="2" ParentId="2037" CreationDate="2014-08-21T17:05:22.613" Score="2" Body="&lt;p&gt;You could put the class on the parent element, and then target &lt;code&gt;.Bibliography &amp;gt; ul&lt;/code&gt; in your css.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-21T17:05:22.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2073" PostTypeId="1" AcceptedAnswerId="35483" CreationDate="2014-08-21T18:10:11.390" Score="9" ViewCount="6233" Body="&lt;p&gt;Is there any way to output the actual source code from an SVG asset in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than linking to it, I would like to embed the code in the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a twig include, but I cannot include files outside the templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2020-06-04T08:21:05.533" Title="Can I output SVG code from an asset?" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2074" PostTypeId="1" AcceptedAnswerId="2094" CreationDate="2014-08-21T18:14:58.943" Score="4" ViewCount="282" Body="&lt;p&gt;How does the &lt;code&gt;{% cache %}&lt;/code&gt; tag handle a situation where an entry reaches its post date or expires?&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2014-08-22T04:24:05.400" Title="Cached entries and postDate / expirationDate" Tags="&lt;cache&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-10-29T23:13:32.063" ContentLicense="CC BY-SA 3.0" />
  <row Id="2075" PostTypeId="1" CreationDate="2014-08-21T18:38:11.863" Score="4" ViewCount="1325" Body="&lt;p&gt;I'm using SCSS to write all of my styles and am currently using Codekit for processing it. I want to be able to add some global variables to Craft so I can change color and font vars, which would then be re-compiled into CSS for the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through the plugins, I've found the Sprockets port (&lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Sprockets/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/rkingon/Craft-Plugin--Sprockets/&lt;/a&gt;) and AutoMin (&lt;a href=&quot;https://github.com/aelvan/AutoMin-Craft/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aelvan/AutoMin-Craft/&lt;/a&gt;). They both look like they'll take a bit to get set up so I wanted to see if I could get some input before I dive in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is what I want to do possible? With either one or both, can I set vars in the CMS that are then pulled into a _config.scss file, which is in turn imported into my main.scss file, compiled, and then fed to the browser automatically? I've tried pulling a craft color var into the main css file but it did not replace the twig syntax with the hex color.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Would one of the plugins is better suited to my needs than the other?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="495" LastEditorUserId="57" LastEditDate="2014-08-22T00:09:11.497" LastActivityDate="2015-02-19T10:29:56.953" Title="Can you insert Craft variables into SCSS files and have a plugin generate CSS?" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2076" PostTypeId="1" CreationDate="2014-08-21T18:46:40.943" Score="1" ViewCount="479" Body="&lt;p&gt;When I go to install Craft everything appears to install properly.  It creates all the db tables, but then after going to the CP it displays &quot;Craft can’t connect to the database with the credentials in craft/config/db.php.&quot;  Even though during the install process it could connect just fine.  Anybody run into this?  Craft Version 2.1.2569&lt;/p&gt;&#xA;" OwnerUserId="701" LastActivityDate="2014-08-21T19:23:36.697" Title="Installation issues" Tags="&lt;config&gt;&lt;database&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2014-08-21T21:22:30.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="2077" PostTypeId="1" AcceptedAnswerId="10751" CreationDate="2014-08-21T18:55:11.207" Score="3" ViewCount="196" Body="&lt;p&gt;I have some tables in a matrix field and when I created the columns, originally I named them Col 1, Col 2, etc. That made sense to me but later I decided that since the client will be entering data, it'd make more sense to name them Column 1, Column 2, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I renamed them but that was after I'd entered a bunch of content. So now in the Craft admin, I only see the new names, but when I loop through the entries in the table rows, all of the old entries are there as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to purge that old data? I want to give the client to enter in the number of a column so you can add a highlight class to it. Right now, as I loop through the entries in those rows, it hits both old and new content and you can't get a dependable count.&lt;/p&gt;&#xA;" OwnerUserId="495" LastEditorUserId="125" LastEditDate="2015-07-29T06:07:51.627" LastActivityDate="2015-07-29T06:07:51.627" Title="Is there a way to purge old data in a table?" Tags="&lt;templating&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2078" PostTypeId="2" ParentId="2076" CreationDate="2014-08-21T19:23:36.697" Score="0" Body="&lt;p&gt;Local MySQL problem. #facepalm&lt;/p&gt;&#xA;" OwnerUserId="701" LastActivityDate="2014-08-21T19:23:36.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2079" PostTypeId="2" ParentId="2073" CreationDate="2014-08-21T20:10:21.010" Score="14" Body="&lt;p&gt;Check out my plugin &lt;a href=&quot;https://github.com/aelvan/Inlin-Craft/&quot;&gt;Inlin&lt;/a&gt;, I made it exactly for this. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-21T20:10:21.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2080" PostTypeId="2" ParentId="2073" CreationDate="2014-08-21T20:23:16.883" Score="5" Body="&lt;p&gt;What about using &lt;a href=&quot;http://developer.mozilla.org/docs/Web/SVG/Element/use&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt;&lt;/a&gt; (see &lt;a href=&quot;http://css-tricks.com/svg-use-external-source/&quot; rel=&quot;noreferrer&quot;&gt;css-tricks article&lt;/a&gt;) to reference the SVG from the template instead of embedding the actual code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's what I do for SVGs currently. Difference is that I don't use Craft assets for this, but have a grunt task that concatenates all SVGs from a folder into one single SVG file with multiple symbols. Then I use a macro that outputs the SVG tag. Just modified that code to make it work with Craft assets, all you need to do is to add an &lt;a href=&quot;http://buildwithcraft.com/docs/assets#asset-meta-fields&quot; rel=&quot;noreferrer&quot;&gt;assets meta field&lt;/a&gt; to your asset with a handle &lt;code&gt;symbol&lt;/code&gt; (or similar) to reference the right shape.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro svg(svgAssetModel, cssClasses) %}&#xA;&#xA;    &amp;lt;svg class=&quot;{{ cssClasses }}&quot; title=&quot;{{ svgAssetModel.title }}&quot;&amp;gt;&#xA;        &amp;lt;use xlink:href=&quot;{{ svgAssetModel.url }}#{{ svgAssetModel.symbol }}&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;    &amp;lt;/svg&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ macros.svg(entry.svg.first, 'big-blue-symbol') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-21T20:30:04.053" LastActivityDate="2014-08-21T20:30:04.053" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2081" PostTypeId="1" AcceptedAnswerId="2120" CreationDate="2014-08-21T21:53:04.867" Score="1" ViewCount="802" Body="&lt;p&gt;What could cause Craft to not define the request object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a local site that recently stopped loading (front-end and back-end)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is happening in WebApp.php (line 630) when &lt;code&gt;$this-&amp;gt;request-&amp;gt;getBrowserLanguages()&lt;/code&gt; method runs.  The script fails because &lt;code&gt;$this-&amp;gt;request&lt;/code&gt; is not defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other Craft installations work just fine.  This site works just fine on a dev and live server with the same code. Any ideas on what I bumped?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-04T01:00:48.050" Title="Undefined property: Craft\WebApp::$request" Tags="&lt;error-message&gt;&lt;request&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2082" PostTypeId="2" ParentId="2075" CreationDate="2014-08-21T21:55:48.240" Score="3" Body="&lt;p&gt;I did the port of AutoMin to Craft, and I don't think what you want to do is possible with it. Maybe if you were somehow able to write a new file to disk, with the variables defined in it, and then feed that into the AutoMin, it could work. But seems like a pretty complicated solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure exactly what you're trying to achieve, but in previous projects where I've let the user control colors and fonts on certain objects, I've just done it with pure CSS. If I wanted to let the client define the link color, I'd just do something like this in :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;    a { color: {{ myGlobal.linkColor }} }&#xA;&amp;lt;/style&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then not define the link color in my stylesheet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is maybe too simplistic for what you're trying to do? :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="495" LastEditDate="2015-02-19T10:29:56.953" LastActivityDate="2015-02-19T10:29:56.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2083" PostTypeId="1" AcceptedAnswerId="2088" CreationDate="2014-08-21T22:21:48.277" Score="2" ViewCount="710" Body="&lt;p&gt;I'm trying to grab all Entries that were updated after a given date and time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like I can grab all entries updated after a &lt;em&gt;date&lt;/em&gt; using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timeLimit = now | date_modify(&quot;-2 min&quot;) %}&#xA;{% set updated = craft.entries({ dateUpdated: '&amp;gt;=' ~ timeLimit }).section('myChannel') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, that code doesn't actually seem to take time into account at all, just date. &lt;code&gt;timeLimit&lt;/code&gt; in the above will always return something like &lt;code&gt;2014-08-21&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="414" LastEditorUserId="125" LastEditDate="2014-08-21T23:28:19.760" LastActivityDate="2014-08-21T23:54:07.227" Title="Fetch all entries with dateUpdated after a given time" Tags="&lt;entries&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2084" PostTypeId="1" AcceptedAnswerId="2089" CreationDate="2014-08-21T23:12:42.487" Score="2" ViewCount="104" Body="&lt;p&gt;I'm trying to grab an Asset which is a child of my Entry...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$criteria-&amp;gt;childOf = $entryId;&#xA;$photo = craft()-&amp;gt;assets-&amp;gt;findFile($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the most part, this works pretty well. But my entry has multiple Asset fields, and &lt;strong&gt;sometimes it grabs the wrong image&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that I just need to add another parameter to my &lt;code&gt;$criteria&lt;/code&gt;, but I can't figure out what... theoretically something to denote which specific field I'm referring to. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-22T00:04:36.950" Title="How can I get a related Asset of a specific field?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2085" PostTypeId="1" AcceptedAnswerId="2091" CreationDate="2014-08-21T23:21:35.300" Score="5" ViewCount="1798" Body="&lt;p&gt;Im wondering if there is a simple way to password protect  site thats in development using just Craft Personal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I setup a login page and i got {% requirelogin %} to redirect but it seems with craft personal even the admin cant login via a front end login form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they have to login at /admin and then jump to the front end of the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is there an easier way?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2014-08-22T00:22:01.073" LastActivityDate="2017-10-02T05:55:43.300" Title="How do you password protect a site in progress?" Tags="&lt;password&gt;" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2086" PostTypeId="1" CreationDate="2014-08-21T23:22:01.883" Score="1" ViewCount="1664" Body="&lt;p&gt;I'm trying to fetch entries from a channel via a front-end form featuring multiple filters - several dropdown selects and one checkbox field - kind of like an advanced search feature. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form works OK when using the select dropdown fields but for some reason I can't get the checkbox input in the form to work. I have followed the &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields&quot; rel=&quot;nofollow&quot;&gt;example in the docs here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the checkbox part of the form looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Checkboxes Based on a Checkbox Field #}&#xA;&amp;lt;label class=&quot;heading&quot; for=&quot;features&quot;&amp;gt;Features&amp;lt;/label&amp;gt;&#xA;&#xA;{% for option in craft.fields.getFieldById(15).settings.options %}&#xA;    {% set checked = false %}&#xA;&#xA;    {% if option.selected %}&#xA;        {% set checked = true %}&#xA;    {% endif %}&#xA;&#xA;    {% if not checked %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[features][]&quot; value=&quot;&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[features][]&quot; value=&quot;{{ option.value }}&quot; {% if checked %} checked=&quot;checked&quot;{% endif %}&amp;gt;{{ option.label }}&#xA;    &amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws an error in the template:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Key &quot;selected&quot; for array with keys &quot;label, value, default&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On the line above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if option.selected %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Further, on my search results template, I'm using &lt;code&gt;getParam&lt;/code&gt; to pull the values from the query string like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = craft.request.getParam('location') %}&#xA;{% set realEstateType = craft.request.getParam('type') %}&#xA;{% set bedrooms = craft.request.getParam('bedrooms') %}&#xA;{% set priceRange = craft.request.getParam('price-range') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search().location(location).realEstateType(realEstateType).bedrooms(bedrooms).priceRange(priceRange) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works OK without the offending Checkbox field. I suspect because there are possibly multiple values submitted for a checkbox field that it may not work - should I use search instead of getParam?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long-winded question, any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2014-08-22T00:13:15.940" LastActivityDate="2017-04-26T16:21:18.930" Title="Fetching entries from an advanced search form on the front end" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2087" PostTypeId="1" CreationDate="2014-08-21T23:33:14.463" Score="3" ViewCount="164" Body="&lt;p&gt;After doing some experimentation in looping through &lt;code&gt;MatrixBlockModel&lt;/code&gt;, it seems that even though each block has a &lt;code&gt;dateUpdated&lt;/code&gt; property, this value is never unique to each block, but is shared between all blocks in the Entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timeLimit = now | date_modify(&quot;-2 min&quot;) %}&#xA;{% for block in entry.blocks %}&#xA;  {% if block.dateUpdated &amp;gt;= timeLimit %}&#xA;&#xA;    {{ block.dateUpdated | date(dtFilter) }}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the entry has 6 blocks, and I update one of those blocks and save, the same date will output 6 times for about 2 minutes, then nothing will output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody confirm this?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2014-08-22T00:15:54.993" Title="Does each MatrixBlockModel in an entry have a unique dateUpdated?" Tags="&lt;matrix&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2088" PostTypeId="2" ParentId="2083" CreationDate="2014-08-21T23:43:00.497" Score="2" Body="&lt;p&gt;You concatenate the strings &lt;code&gt;'&amp;gt;='&lt;/code&gt; and what is output from the &lt;code&gt;timeLimit&lt;/code&gt; var (the same as &lt;code&gt;{{ timeLimit }}&lt;/code&gt; does). So it gets concatenated to &lt;code&gt;'&amp;gt;=2014-08-22'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to change two things. First add a space after the comparison operator and second, change the date output to include the time by using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter. I suggest to use  &lt;code&gt;'c'&lt;/code&gt; as the value for the formatting parameter, as it returns the datetime ISO 8601 formatted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timeLimit = now|date_modify('-2 min') %}&#xA;&#xA;{# Get entries with `dateUpdated('&amp;gt;= 2014-08-22T01:55:00+02:00')` #}&#xA;{% set updated = craft.entries.dateUpdated('&amp;gt;= ' ~ timeLimit|date('c')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-21T23:54:07.227" LastActivityDate="2014-08-21T23:54:07.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2089" PostTypeId="2" ParentId="2084" CreationDate="2014-08-22T00:04:36.950" Score="3" Body="&lt;p&gt;Found it! The specific field can be targeted like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;childField = 'myFieldHandle';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-08-22T00:04:36.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2090" PostTypeId="2" ParentId="2087" CreationDate="2014-08-22T00:15:54.993" Score="3" Body="&lt;p&gt;Yes I can confirm, currently the &lt;code&gt;dateUpdated&lt;/code&gt; property returns the same datetime object for every block model. It's actually the save date of the entry (&lt;code&gt;entry.dateUpdated&lt;/code&gt;) that is saved to the &lt;code&gt;craft_matrixblocks&lt;/code&gt; table in the DB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't say if it's intended to work like this though.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-22T00:15:54.993" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2091" PostTypeId="2" ParentId="2085" CreationDate="2014-08-22T01:56:52.047" Score="8" Body="&lt;p&gt;Front-end user features are only available in the Pro edition of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like the easiest thing to do would be to use &lt;a href=&quot;http://www.htaccesstools.com/articles/password-protection/&quot;&gt;.htaccess password protection&lt;/a&gt; for the site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-22T01:56:52.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2092" PostTypeId="2" ParentId="2086" CreationDate="2014-08-22T02:10:41.207" Score="1" Body="&lt;p&gt;&lt;code&gt;craft.fields.getFieldById()&lt;/code&gt; will return a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/FieldModel&quot; rel=&quot;nofollow&quot;&gt;FieldModel&lt;/a&gt; and calling settings on that is going to return the actual field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe you'll want to get something like this to get the actual &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/CheckboxesFieldType&quot; rel=&quot;nofollow&quot;&gt;Checkboxes field type&lt;/a&gt; (completely untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set checkboxFieldType = craft.fields.getFieldById(15).getFieldType() %}&#xA;&#xA;{% for option in checkboxFieldType.options %}&#xA;    ....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-22T02:10:41.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2093" PostTypeId="2" ParentId="2075" CreationDate="2014-08-22T02:12:34.870" Score="2" Body="&lt;p&gt;I would go down the path of setting up your vars in a .json file generated by craft and have &lt;a href=&quot;https://github.com/vigetlabs/sass-json-vars&quot; rel=&quot;nofollow&quot;&gt;sass-json-vars&lt;/a&gt; pull them into your sass document.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This keeps both techs separate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would also mean you would need to have ruby running sass on your server. You could try the node version of sass but it is still missing a ton of stuff.&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-08-22T02:12:34.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2094" PostTypeId="2" ParentId="2074" CreationDate="2014-08-22T04:24:05.400" Score="3" Body="&lt;p&gt;Currently, it will ignore them and will only invalidate according to any &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#parameters&quot; rel=&quot;nofollow&quot;&gt;explicit parameters&lt;/a&gt; you've told it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think it should take into account an entry's post and expiration date so I've added it to our todo list.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-22T04:24:05.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2095" PostTypeId="1" CreationDate="2014-08-22T04:33:00.483" Score="2" ViewCount="341" Body="&lt;p&gt;I'm experimenting with migrating a large site from EE to Craft to take advantage of the performance improvements for an upcoming site redesign. I see there are some plugins that work well to import entries via XML or CSV, but I have been unable to find a way to import members. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the passwords are stored in the database encrypted for the EE logins which makes it a little more tricky. Any thoughts? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="704" LastActivityDate="2016-08-02T10:31:43.930" Title="Importing Members from ExpressionEngine" Tags="&lt;database&gt;&lt;import&gt;&lt;member&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2096" PostTypeId="2" ParentId="2095" CreationDate="2014-08-22T06:29:58.250" Score="5" Body="&lt;p&gt;Tricky is a mild way of putting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EE and Craft both hash (not encrypt) their passwords differently. Hashing differs from encryption in a few ways, but the most important one here is that hashing is not reversible, which means that the passwords cannot be recovered. Which, in turn, means that if you import the user information into Craft, the members still would all have to reset their passwords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's okay, then you would be looking at a custom plugin that uses &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;the Users Service&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2014-08-26T09:33:42.513" LastActivityDate="2014-08-26T09:33:42.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2097" PostTypeId="1" AcceptedAnswerId="2119" CreationDate="2014-08-22T08:07:55.370" Score="2" ViewCount="379" Body="&lt;p&gt;Is there a way to cache content with the (% cache %} tag on a per-user base?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If user A is logged in, his content gets cached. User B logs in, but his content should not interfere with that of User A.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="57" LastEditDate="2014-08-22T18:01:33.340" LastActivityDate="2014-08-22T18:12:33.673" Title="How to cache content per user?" Tags="&lt;users&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2099" PostTypeId="1" CreationDate="2014-08-22T09:34:24.437" Score="1" ViewCount="823" Body="&lt;p&gt;I've set up a global set &quot;attachmentGlobals&quot; with a matrix field inside named &quot;globalFiles&quot;. This matrix has only one block &quot;files&quot; which has a text field &quot;fileId&quot; and an Asset field &quot;fileAsset&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to retrieve a specific row searching for the &quot;fileId&quot; content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've triyed in those ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Test 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;attachmentGlobals.globalFiles.fileId('sitelogo')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Return me an Error saying no method &quot;fileId&quot; is available&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Test 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;attachmentGlobals.globalFiles.find('fileId:sitelogo')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error, but no results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Test 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;attachmentGlobals.globalFiles.search('fileId:sitelogo')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error, but no results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've search Craft documentation and some examples on Stack Exchange, but nothing seems to help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first place, is this possible? or were am I wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;PS: I know this issue could be solved using only assets fields, but I would like to know if is possible to search for matrix fields by filed content.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="705" LastActivityDate="2014-08-22T15:04:04.340" Title="Search for matrix field in a global set" Tags="&lt;matrix&gt;&lt;search&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2100" PostTypeId="2" ParentId="2097" CreationDate="2014-08-22T10:47:00.970" Score="1" Body="&lt;p&gt;You could add user dependent content in between your &lt;code&gt;cache&lt;/code&gt; tags to make the cache invalidate itself every time the page is requested by a new user. This probably doesn't help you much (but depends on the use case):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    &amp;lt;div class=&quot;hidden&quot;&amp;gt;{{ currentUser.id }}&amp;lt;/div&amp;gt;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is to have user specific URLs. That'd work because each URL gets its own cache entry in the DB (see Brad's &lt;a href=&quot;https://craftcms.stackexchange.com/q/2059/125&quot;&gt;comment&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the pages in question, add user specific info to the URL in your links:&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;a href=&quot;/{{ currentUser.id }}/blog/{{ entry.slug }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then use &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic routes&lt;/a&gt; to make them work:&lt;br&gt;&#xA;URI format:&lt;code&gt;&amp;lt;*&amp;gt;/blog/&amp;lt;*&amp;gt;&lt;/code&gt; → Template: &lt;code&gt;blog/_entry.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1: &quot;The cache, by default will cache it's contents on a per URL and per locale basis.&quot;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-22T10:47:00.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2101" PostTypeId="1" CreationDate="2014-08-22T10:51:29.717" Score="0" ViewCount="432" Body="&lt;p&gt;DevMode is awesome, but I wanted to post this as a bit of a heads up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll preface to say yes, you shouldn't be developing live and yes, the docs do include a warning(yet very small and not really explaining why).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am assuming &lt;strong&gt;alot of you have it turned on right now.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It reveals the craft path, file system paths, plugins installed, field handles and a whole lot of other juicy stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To everyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couldn't we have, or is there a way to have, this wonderful feature only available if logged in and/or admin?&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="250" LastEditDate="2014-10-04T18:38:16.950" LastActivityDate="2014-10-04T18:38:16.950" Title="DevMode Reveals Info to Everyone" Tags="&lt;devmode&gt;&lt;debugging&gt;" AnswerCount="3" CommentCount="3" ClosedDate="2014-08-22T16:12:16.033" ContentLicense="CC BY-SA 3.0" />
  <row Id="2102" PostTypeId="2" ParentId="2101" CreationDate="2014-08-22T11:03:43.950" Score="3" Body="&lt;p&gt;Making it only available to logged in users and/or admin, would make it impossible to debug the site as an anonymous user would see it. I'd say that's an pretty important feature which I think is wrong to remove just because someone might configure craft wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But maybe it'd be possible to use a plugin to turn on/off devMode depending on user permissions? &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-22T11:03:43.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2104" PostTypeId="2" ParentId="2099" CreationDate="2014-08-22T12:07:59.200" Score="1" Body="&lt;p&gt;As far as I know, (currently) the only way to filter matrix blocks is to use the &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/a&gt; method to filter by block type or to limit the amount of returned matrix models with &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#adjusting-the-limit&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;limit&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchString = 'sitelogo' %}&#xA;&#xA;{# Search for potential matrix blocks #}&#xA;{% set foundBlocks = attachmentGlobals.globalFiles.type('files').search(searchString) %}&#xA;&#xA;{# Loop through the result and output the right one #}&#xA;{% for foundBlock in foundBlocks %}&#xA;&#xA;    {% if foundBlock.fileId == searchString %}&#xA;        &amp;lt;img src=&quot;{{ foundBlock.fileAsset.first.url }}&quot; alt=&quot;{{ foundBlock.fileAsset.first.title }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can't use &lt;code&gt;search('fileId:sitelogo')&lt;/code&gt;, because that would filter for entries with  &lt;code&gt;fileId:sitelogo&lt;/code&gt; and not entries with a matrix block &lt;code&gt;fileId:sitelogo&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-22T15:04:04.340" LastActivityDate="2014-08-22T15:04:04.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2105" PostTypeId="2" ParentId="2101" CreationDate="2014-08-22T13:16:57.977" Score="1" Body="&lt;p&gt;Why don't you set up a second, password protected environment (&lt;code&gt;.htaccess&lt;/code&gt; restrictions) and enable dev mode only for that environment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    'example.com' =&amp;gt; array(&#xA;    ),&#xA;&#xA;    'dev.example.com' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-22T13:16:57.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2106" PostTypeId="2" ParentId="2101" CreationDate="2014-08-22T14:49:02.363" Score="4" Body="&lt;p&gt;There already was a warning about it, but it didn’t really stick out, I guess.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VAhDd.png&quot; width=&quot;681&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Just gave it the actual Warning style treatment, so hopefully this helps the next guy:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i3BXN.png&quot; width=&quot;696&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-22T14:49:02.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2107" PostTypeId="1" AcceptedAnswerId="2111" CreationDate="2014-08-22T14:53:31.743" Score="6" ViewCount="1992" Body="&lt;p&gt;I would like to allow registered users to submit entries to sections. The documentation didn't mention how to get the values and labels of dropdown / checkbox / multiselect fields to show them as options on the submitting page. I can't use the &lt;code&gt;entry&lt;/code&gt; variable because the entry is not saved yet.&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastEditorUserId="70" LastEditDate="2014-09-15T01:11:22.110" LastActivityDate="2014-09-15T01:11:22.110" Title="Get dropdown / checkbox / multiselect field values on frontend submit" Tags="&lt;field&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2108" PostTypeId="1" AcceptedAnswerId="8376" CreationDate="2014-08-22T15:03:48.877" Score="8" ViewCount="1336" Body="&lt;p&gt;I have written this simple redirect code in the main index.php file. &#xA;Now I need to know if this code can somehow cause problems with Craft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    // Check if URI contains cpTrigger&#xA;    $pos = strpos($_SERVER['REQUEST_URI'], 'admin');&#xA;&#xA;    if ($pos === false) {&#xA;&#xA;        // Language paths&#xA;        $paths = array(&#xA;            'de'=&gt;'/de/',&#xA;            'it'=&gt;'/it/',&#xA;            'en'=&gt;'/en/'&#xA;        );&#xA;&#xA;        // Browser language&#xA;        $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);&#xA;&#xA;        // Default language&#xA;        if (!isset($paths[$language])) {&#xA;            $language = 'de';&#xA;        }&#xA;&#xA;        // Redirect&#xA;        header('HTTP/1.1 301 Moved Permanently'); &#xA;        header('Location:' . $paths[$language]);&#xA;&#xA;    } else {&#xA;&#xA;        // Path to your craft/ folder&#xA;        $craftPath = '../craft';&#xA;&#xA;        // Do not edit below this line&#xA;        $path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;        if (!is_file($path)) {&#xA;            exit('&lt;strong&gt;Temporary error.&lt;/strong&gt; Could not find the CMS folder.');&#xA;        }&#xA;&#xA;        require_once $path;&#xA;&#xA;    }&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only the 404 page doesn't load with www.example.com/idontexist but loads instead the homepage.&#xA;(www.example.com/&lt;strong&gt;en&lt;/strong&gt;/idontexist loads as expected the 404 page)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps somebody knows a better solution?&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2015-02-24T23:31:30.027" LastActivityDate="2015-02-24T23:31:30.027" Title="302 redirects to locales in main index.php" Tags="&lt;redirect&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2109" PostTypeId="2" ParentId="1984" CreationDate="2014-08-22T15:11:37.887" Score="2" Body="&lt;p&gt;I’ve built a plugin to allow control over what user groups can allocate permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/joshuabaker/Sanction&quot; rel=&quot;nofollow&quot;&gt;https://github.com/joshuabaker/Sanction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2014-08-22T15:11:37.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2110" PostTypeId="1" AcceptedAnswerId="2112" CreationDate="2014-08-22T15:12:34.713" Score="5" ViewCount="1202" Body="&lt;p&gt;I've got an asset field on a channel entry called &quot;thumbnail&quot;. I'm using it to return a singular image, specifically for an image transform called &quot;thumb&quot;. Looks a little like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.thumbnail.first().getUrl('thumb') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine. But I'd like to get the same information/url using a plugin (so I can perform some colour validation and other checks via PHP). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone share some wisdom on how best to approach this please?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-08-22T15:33:18.323" Title="Get entry field data via a plugin. ( For specific image assets )" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2111" PostTypeId="2" ParentId="2107" CreationDate="2014-08-22T15:12:56.240" Score="10" Body="&lt;p&gt;You can get info about your fields using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.fields#getFieldByHandle&quot;&gt;craft.fields.getFieldByHandle()&lt;/a&gt;. That will include a &lt;code&gt;settings&lt;/code&gt; property, which will be an array of the field type’s settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual settings available will differ depending on the field type, but Dropdown, Checkboxes, and Multi-select fields all have the same one: &lt;code&gt;options&lt;/code&gt;. So in each of their cases, here’s how you would loop through the options:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('myFieldHandle') %}&#xA;{% for opt in field.settings.options %}&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input name=&quot;fields[myFieldHandle][]&quot; type=&quot;checkbox&quot; value=&quot;{{ opt.value }}&quot;&amp;gt;&#xA;        {{ opt.label }}&#xA;    &amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-22T15:12:56.240" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2112" PostTypeId="2" ParentId="2110" CreationDate="2014-08-22T15:33:18.323" Score="8" Body="&lt;p&gt;Assuming you already have the entry (see &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;noreferrer&quot;&gt;Working with Elements&lt;/a&gt; for info about how to do that), you can interact with it exactly the same way you do in your templates - just with PHP syntax instead of Twig.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$asset = $entry-&amp;gt;thumbnail-&amp;gt;first();&#xA;&#xA;if ($asset)&#xA;{&#xA;    $url = $asset-&amp;gt;getUrl('thumb');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Though the transform won’t necessarily be available yet, since getUrl() will not generate transforms that don’t already exist by default. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That behavior can be customized with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;noreferrer&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; config setting though, and lucky for you, you can even override the actual config value from PHP before calling getUrl(), using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ConfigService#set-detail&quot; rel=&quot;noreferrer&quot;&gt;ConfigService::set()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;$url = $asset-&amp;gt;getUrl('thumb');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-22T15:33:18.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2113" PostTypeId="1" AcceptedAnswerId="2163" CreationDate="2014-08-22T15:37:31.560" Score="6" ViewCount="3393" Body="&lt;p&gt;I'm trying to create a frontend entry form for a logged in user, with a field to upload multiple assets to that entry.&lt;/p&gt;&#xA;&lt;p&gt;I've tried using the &lt;a href=&quot;http://blueimp.github.io/jQuery-File-Upload/&quot; rel=&quot;noreferrer&quot;&gt;Jquery FileUpload plugin&lt;/a&gt;, but can't seem to get that working.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The situation:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The entry type contains an Asset Field, called photos. This field creates a new folder based on the entry's ID;&lt;/li&gt;&#xA;&lt;li&gt;Users have to be able to select multiple images, with a nice process-bar showing while uploading;&lt;/li&gt;&#xA;&lt;li&gt;I've tried uploading directly to actions/assets/uploadFile, but I get a permission error;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Does anyone have something similar working with Craft?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-11-15T14:59:27.807" Title="Does anyone have a working example of frontend form with multiple file upload, drag &amp; drop etc?" Tags="&lt;assets&gt;&lt;form&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="2114" PostTypeId="1" CreationDate="2014-08-22T15:47:11.457" Score="2" ViewCount="111" Body="&lt;p&gt;I want do display a financial widget on a front-end of a site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8uoZ4.png&quot; alt=&quot;Widget&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The financial data is actually a feed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://test.solutions.vwdservices.com/customers/vastned.com/page-modules/widgetrss&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://test.solutions.vwdservices.com/customers/vastned.com/page-modules/widgetrss&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's not working on the frontend. No content. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set feedUrl = &quot;http://test.solutions.vwdservices.com/customers/vastned.com/page-modules/widgetrss&quot; %}&#xA;{% set limit = 1 %}&#xA;{% set items = craft.feeds.getFeedItems(feedUrl, limit) %}&#xA;&#xA;{% for item in items %}&#xA;    &amp;lt;div class=&quot;col-md-5ths&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;number&quot;&amp;gt;{{ item.title }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;small class=&quot;{{ item.authors[0].name }}&quot;&amp;gt;{{ item.summary }}&amp;lt;br /&amp;gt;{{ item.date }}&amp;lt;/small&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my feed data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Feed xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns=&quot;http://www.w3.org/2005/Atom&quot;&amp;gt;&#xA;&amp;lt;Title&amp;gt;Aandelen Vastned&amp;lt;/Title&amp;gt;&#xA;&amp;lt;Id&amp;gt;0&amp;lt;/Id&amp;gt;&#xA;&amp;lt;Updated&amp;gt;2014-08-22T17:29:40&amp;lt;/Updated&amp;gt;&#xA;&amp;lt;Entry&amp;gt;&#xA;&amp;lt;Title&amp;gt;€ 36,81&amp;lt;/Title&amp;gt;&#xA;&amp;lt;Id&amp;gt;00000000-0000-0000-0000-000000000000&amp;lt;/Id&amp;gt;&#xA;&amp;lt;Updated&amp;gt;2014-08-22T17:29:40&amp;lt;/Updated&amp;gt;&#xA;&amp;lt;Summary&amp;gt;0,00%&amp;lt;/Summary&amp;gt;&#xA;&amp;lt;Author&amp;gt;&#xA;&amp;lt;Name&amp;gt;Grijs&amp;lt;/Name&amp;gt;&#xA;&amp;lt;/Author&amp;gt;&#xA;&amp;lt;/Entry&amp;gt;&#xA;&amp;lt;/Feed&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="57" LastEditDate="2014-08-22T17:23:32.877" LastActivityDate="2014-08-22T17:23:32.877" Title="craft.feeds does not appear to be working" Tags="&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2115" PostTypeId="2" ParentId="2114" CreationDate="2014-08-22T17:22:56.780" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/FeedsService&quot; rel=&quot;nofollow&quot;&gt;FeedsService&lt;/a&gt; uses &lt;a href=&quot;http://simplepie.org/&quot; rel=&quot;nofollow&quot;&gt;SimplePie&lt;/a&gt; for feed parsing, but it currently does expose any errors that SimplePie may be returning when connecting to a feed.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A feed could not be found at &lt;a href=&quot;http://test.solutions.vwdservices.com/customers/vastned.com/page-modules/widgetrss&quot; rel=&quot;nofollow&quot;&gt;http://test.solutions.vwdservices.com/customers/vastned.com/page-modules/widgetrss&lt;/a&gt;. This does not appear to be a valid RSS or Atom feed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's the error it's returning when connecting to that feed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll update FeedsService to return any errors that come back from SimplePie, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-22T17:22:56.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2116" PostTypeId="1" AcceptedAnswerId="2117" CreationDate="2014-08-22T17:46:04.470" Score="8" ViewCount="2964" Body="&lt;p&gt;I am trying to code defensively and check whether a field exists before accessing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if e.someField is defined %} {{e.someField}} {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get a CException&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;someField&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#test-operator&quot;&gt;is&lt;/a&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/defined.html&quot;&gt;defined&lt;/a&gt; is always returning &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clue what's wrong?&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="57" LastEditDate="2016-08-31T19:04:08.047" LastActivityDate="2020-08-21T08:19:15.343" Title="Twig &quot;is defined&quot; always returning true" Tags="&lt;templating&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2117" PostTypeId="2" ParentId="2116" CreationDate="2014-08-22T18:02:03.353" Score="10" Body="&lt;p&gt;This is a known issue with Twig’s ‘defined’ test - it’s not very reliable when it comes to object properties. We plan on looking further into it at some point and coming up with a formal test case that reproduces the issue, plus a bug fix. Just haven’t gotten around to it yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, rather than testing if a field is defined, check the entry type:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if e.type == 'news' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to check multiple entry/block types at once, you can use the &lt;code&gt;in&lt;/code&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if e.type.handle in ['news', 'blog'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-22T18:02:03.353" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2118" PostTypeId="1" AcceptedAnswerId="2128" CreationDate="2014-08-22T18:08:59.377" Score="8" ViewCount="1227" Body="&lt;p&gt;Is there any way of filtering by category in the control panel entries list?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, is there for an &quot;entries&quot; field (like how Playa lets you filter by channel, category)?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-05-12T13:10:07.847" Title="Filtering/searching for entries by category in the control panel" Tags="&lt;categories&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2119" PostTypeId="2" ParentId="2097" CreationDate="2014-08-22T18:12:33.673" Score="4" Body="&lt;p&gt;In the upcoming Craft 2.2 release, we've added a &lt;code&gt;using key&lt;/code&gt; parameter to the &lt;code&gt;{% cache %}&lt;/code&gt; tag for for situations like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd be able to do something like this for per user caching:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key &quot;myImportantUserCache&quot; ~ currentUser.id %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-22T18:12:33.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2120" PostTypeId="2" ParentId="2081" CreationDate="2014-08-22T19:03:30.373" Score="2" Body="&lt;p&gt;This issue turned out to be caused by a config setting that had been added to &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheMethod' =&amp;gt; 'apc'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The server had APC installed but my local environment did not.  There were a couple options to fix this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install &lt;a href=&quot;http://php.net/manual/en/book.apc.php&quot; rel=&quot;nofollow&quot;&gt;Alternative PHP Cache&lt;/a&gt; (APC)&lt;/li&gt;&#xA;&lt;li&gt;Setup a multi-environment config and override the &lt;code&gt;cacheMethod&lt;/code&gt; setting with another method that is supported in your local environment, such as &lt;code&gt;'cacheMethod' =&amp;gt; 'file'&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Remove this line as it may not be needed anyway. &lt;code&gt;apc&lt;/code&gt; is PHP byte caching and if your running PHP 5.5, that's enabled by default and &lt;code&gt;apc&lt;/code&gt; is unnecessary&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-08-22T19:03:30.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2121" PostTypeId="1" AcceptedAnswerId="2125" CreationDate="2014-08-23T08:23:52.277" Score="1" ViewCount="466" Body="&lt;p&gt;I currently have one entry in a page and would like to display next and previous arrows. The next/previous entries should be in the same section and related to the same category. To do this I have written this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('seasons').title(entry.season.title).first() %}&#xA;{% set arrowsParams = craft.entries.section('blog').relatedTo(category) %}&#xA;{% set nextEntry = entry.getNext(arrowParams) %}&#xA;{% set prevEntry = entry.getPrev(arrowParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For each entry I have added a field 'season' which maps to a category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When retrieving the nextEntry, the relatedTo category is being neglected and an entry in a different category is being returned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('blog').relatedTo(category).first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it works fine and actually retrieves the first entry in that category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am  I missing something? Could this be done?&lt;/p&gt;&#xA;" OwnerUserId="666" LastEditorUserId="666" LastEditDate="2014-08-23T09:03:34.747" LastActivityDate="2014-08-23T14:06:38.027" Title="entries related To category not working with getNext function" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2122" PostTypeId="1" AcceptedAnswerId="2127" CreationDate="2014-08-23T08:39:47.687" Score="3" ViewCount="440" Body="&lt;p&gt;When a user forgets their password multiple times on one my front-end login screen, they sometimes get locked out of the system until an admin can unlock them in the control panel. Is there any way to prevent this behaviour?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-08-23T14:58:34.350" Title="How do you prevent user lockout?" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2123" PostTypeId="1" AcceptedAnswerId="2124" CreationDate="2014-08-23T10:47:22.000" Score="1" ViewCount="653" Body="&lt;p&gt;I have a series of talks that have speakers as a related entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to order the talks by the last name of the speaker (the last name is the title of the speaker channel).&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-08-23T10:55:38.943" Title="Order by related field title" Tags="&lt;entries&gt;&lt;relations&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2124" PostTypeId="2" ParentId="2123" CreationDate="2014-08-23T10:55:38.943" Score="1" Body="&lt;p&gt;You probably have to loop through all the speaker (ordered by lastName) that are related to the talks (the speaker entry is the &lt;code&gt;targetElement&lt;/code&gt;). Then use one &lt;code&gt;craft.entries&lt;/code&gt; (ElementCriteriaModel) for each loop to get the talk entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/a/2010/125&quot;&gt;this Q/A&lt;/a&gt; for a comparable problem.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-23T10:55:38.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2125" PostTypeId="2" ParentId="2121" CreationDate="2014-08-23T14:06:38.027" Score="4" Body="&lt;p&gt;The code you currently have (after fixing the &lt;code&gt;arrowsParams&lt;/code&gt; typo) will only work on entries that happen to have the very first category in the Seasons category group selected, because this &lt;code&gt;title&lt;/code&gt; parameter is actually not getting any value right now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.title(entry.season.title)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why? Because &lt;code&gt;entry.season&lt;/code&gt; is not going to return the first category you have selected in your Season categories field; it’s going to return an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; that is prepped to return the category(s) selected in your Season categories field, once one of its &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#fetching-the-elements&quot; rel=&quot;nofollow&quot;&gt;output functions&lt;/a&gt; have been called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;entry.season&lt;/code&gt; is an ElementCriteriaModel, &lt;code&gt;entry.season.title&lt;/code&gt; is actually just going to return its current &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories#title&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;title&lt;/code&gt;&lt;/a&gt; parameter value (which is &lt;code&gt;null&lt;/code&gt; by default). So this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('seasons').title(entry.season.title).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is really the same as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('seasons').title(null).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is the same as not including the parameter at all, so it’s also the same as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('seasons').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;category&lt;/code&gt; is always going to be set to the first category in the group, and &lt;code&gt;arrowsParams&lt;/code&gt; is going to be set to all of the Blog entries that are related to that first category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the entry you’re viewing &lt;em&gt;doesn’t&lt;/em&gt; have that first category selected, then its getNext() and getPrev() functions won’t return anything. (If they can’t determine where the current entry fits into the parameters that were passed in, they can’t determine what the next and previous entries would be.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, to fix this, you would need to put a &lt;code&gt;.first()&lt;/code&gt; call inside that &lt;code&gt;title&lt;/code&gt; param when setting the current category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('seasons').title(entry.season.first().title).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But here’s the thing: &lt;code&gt;entry.season.first()&lt;/code&gt; &lt;strong&gt;is already the category you’re trying to get.&lt;/strong&gt; So there’s no point in fetching it through a second &lt;code&gt;craft.categories&lt;/code&gt; query in the first place. This will do just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.season.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-23T14:06:38.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2126" PostTypeId="1" AcceptedAnswerId="2132" CreationDate="2014-08-23T14:18:40.507" Score="2" ViewCount="520" Body="&lt;p&gt;What's the best practice for development Craft installations? I think I would like to work on the production web server but in a hidden folder either upstream from my public HTML or as a subfolder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it matter where I install and develop my Craft site? Looking for easy migration when I want to go live.&lt;/p&gt;&#xA;" OwnerUserId="660" LastActivityDate="2014-08-23T23:48:24.857" Title="Best location for Craft development? Local or Server? Subfolder of production?" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-08-25T20:57:09.990" ContentLicense="CC BY-SA 3.0" />
  <row Id="2127" PostTypeId="2" ParentId="2122" CreationDate="2014-08-23T14:58:34.350" Score="2" Body="&lt;p&gt;It’s not currently possible to disable that behavior altogether, but you can increase the number of times the user can enter the incorrect password before their account gets locked using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxInvalidLogins&quot; rel=&quot;nofollow&quot;&gt;maxInvalidLogins&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also customize how long Craft will track invalid logins before that maxInvalidLogins counter resets using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#invalidLoginWindowDuration&quot; rel=&quot;nofollow&quot;&gt;invalidLoginWindowDuration&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you, if you wanted the users to get locked out if they entered more than two* incorrect passwords in 10 seconds, you could set these in craft/config/general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'maxInvalidLogins' =&amp;gt; 3, // see the note below&#xA;'invalidLoginWindowDuration' =&amp;gt; 'PT10S',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also customize what happens when a user gets locked out with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cooldownDuration&quot; rel=&quot;nofollow&quot;&gt;cooldownDuration&lt;/a&gt; config setting. By default they will only be locked out for 5 minutes, so it’s not actually necessary for an admin to log in and unlock their account. That would only happen if the config setting was set to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;*There’s actually a bug in Craft right now where a user will get locked out as soon as they’ve hit the maxInvalidLogins count, which I think is incorrect; if the setting is set to 2, they should be able to login incorrectly 2 times, and still have a 6th chance to get it right. I’ve just adjusted that behavior for the upcoming 2.2 release.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-23T14:58:34.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2128" PostTypeId="2" ParentId="2118" CreationDate="2014-08-23T15:01:02.733" Score="5" Body="&lt;p&gt;You can via the search box:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myCategoriesField:&quot;some category title&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/searching&lt;/a&gt; for details on the syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do plan on making it possible to add category/tag filters to the element indexes though, including the modal selection windows.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; You can add a list of categories to the Entries page sidebar using the &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources&quot; rel=&quot;nofollow&quot;&gt;Category Sources&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-05-12T13:10:07.847" LastActivityDate="2015-05-12T13:10:07.847" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2129" PostTypeId="2" ParentId="2108" CreationDate="2014-08-23T16:14:12.597" Score="4" Body="&lt;p&gt;I would suggest making the “admin” check a little more strict:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Make sure this isn't a CP request&#xA;if (!isset($_GET['p']) || strncmp($_GET['p'], 'admin', 5) !== 0)&#xA;{&#xA;    // ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Assuming you’re using the &lt;a href=&quot;http://buildwithcraft.com/help/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;recommended .htaccess redirect rule&lt;/a&gt;, by the time the request hits index.php, the original request URI will be available as &lt;code&gt;$_GET['p']&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Accept-Language header can actually include multiple languages, so you might want to consider looking at all of them, sorted by weight. &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getBrowserLanguages-detail&quot; rel=&quot;nofollow&quot;&gt;HttpRequestService::getBrowserLanguages()&lt;/a&gt; has some example code on how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 302 redirect would probably be more appropriate than 301. You wouldn’t want Google to think that &lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt; should always really be &lt;a href=&quot;http://example.com/en/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/en/&lt;/a&gt; or whatever this script might end up sending it to, and people could theoretically change their browser’s language preferences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also might want to include &lt;code&gt;$_GET['p']&lt;/code&gt; in your redirect location. Right now you’re just sending all traffic off to the locale-specific homepage, which is why 404s aren’t working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To put it all together, here’s what you might want to do:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Make sure this isn't a CP request&#xA;if (!isset($_GET['p']) || strncmp($_GET['p'], 'admin', 5) !== 0)&#xA;{&#xA;    // Language paths&#xA;    $paths = array(&#xA;        'de' =&amp;gt; '/de/',&#xA;        'it' =&amp;gt; '/it/',&#xA;        'en' =&amp;gt; '/en/'&#xA;    );&#xA;&#xA;    // Get the browser's preferred languages&#xA;    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) &amp;amp;&amp;amp; preg_match_all('/([\w\-_]+)\s*(?:;\s*q\s*=\s*(\d*\.\d*))?/', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches, PREG_SET_ORDER))&#xA;    {&#xA;        $languages = array();&#xA;        $weights = array();&#xA;&#xA;        foreach ($matches as $match)&#xA;        {&#xA;            $languages[] = strtolower(substr($match[1], 0, 2));&#xA;            $weights[] = !empty($match[2]) ? floatval($match[2]) : 1;&#xA;        }&#xA;&#xA;        // Sort the languages by their weight&#xA;        array_multisort($weights, SORT_NUMERIC, SORT_DESC, $languages);&#xA;&#xA;        // Find the first match&#xA;        foreach ($languages as $language)&#xA;        {&#xA;            if (isset($paths[$language]))&#xA;            {&#xA;                $matchingLanguage = $language;&#xA;                break;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    // Default to German&#xA;    if (!isset($matchingLanguage))&#xA;    {&#xA;        $matchingLanguage = 'de';&#xA;    }&#xA;&#xA;    // Redirect&#xA;    $url = $paths[$matchingLanguage].(isset($_GET['p']) ? $_GET['p'] : '');&#xA;    header('Location: '.$url, true, 301);&#xA;}&#xA;else&#xA;{&#xA;    // Path to your craft/ folder&#xA;    $craftPath = '../craft';&#xA;&#xA;    // Do not edit below this line&#xA;    $path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;    if (!is_file($path))&#xA;    {&#xA;        exit('Temporary error. Could not find the CMS folder.');&#xA;    }&#xA;&#xA;    require_once $path;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="623" LastEditDate="2014-08-25T16:12:58.090" LastActivityDate="2014-08-25T16:12:58.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2130" PostTypeId="1" AcceptedAnswerId="2131" CreationDate="2014-08-23T20:28:49.427" Score="1" ViewCount="581" Body="&lt;p&gt;Does anything need to be done to allow for ajax submittions using the GuestEntries plugin? &#xA;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm following the method used here for Contact form, it submits fine and returns success but nothing shows up in the DB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#ajax-form-submissions&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm#ajax-form-submissions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in chrome the request looks right?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Request URL: http://familiar.dev/&#xA;Request Method: POST&#xA;Request Payload:&#xA;{&quot;action&quot;:&quot;guestEntries/saveEntry&quot;,&quot;sectionId&quot;:&quot;5&quot;,&quot;enabled&quot;:&quot;1&quot;,&quot;redirect&quot;:&quot;contact/thanks&quot;,&quot;title&quot;:&quot;asdsa&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;any ideas?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-08-23T20:56:44.747" LastActivityDate="2014-08-23T23:40:50.673" Title="Ajax Submittions to Guest Entries" Tags="&lt;ajax&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2131" PostTypeId="2" ParentId="2130" CreationDate="2014-08-23T23:40:50.673" Score="1" Body="&lt;p&gt;So looks like i found the answer.  My javascript was submitting the data as json instead of as regular form data.  I reformatted and it works as expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whoops.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-08-23T23:40:50.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2132" PostTypeId="2" ParentId="2126" CreationDate="2014-08-23T23:48:24.857" Score="3" Body="&lt;p&gt;The best way to do it would be to develop locally, ideally managed with a version control system like Git and then push your site to your server. Craft handles a multi-environment workflow very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;From the Craft docs on Mult-Environment configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/articles/multi-environment-workflows&quot; rel=&quot;nofollow&quot;&gt;A good screencast from Straight Up Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also several questions and answers dealing with this topic in Stack Exchange here.&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2014-08-23T23:48:24.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2133" PostTypeId="1" AcceptedAnswerId="2134" CreationDate="2014-08-24T08:52:06.123" Score="2" ViewCount="529" Body="&lt;p&gt;What would be the best way to select and display featured entries? For example, if I want to choose at least 3 entries to feature in a sidebar apart from the main content?&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2014-08-25T13:21:58.203" Title="What would be the best way to select and display featured entries?" Tags="&lt;entries&gt;&lt;best-practice&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2134" PostTypeId="2" ParentId="2133" CreationDate="2014-08-24T13:43:12.037" Score="1" Body="&lt;p&gt;I would suggest using a custom &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;category&lt;/a&gt; OR a lightswitch field like it's described in the &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I would go with a category since you can fetch the entries for that particular category directly. With a lightswtich (I think) you need to fetch all, then run a if-statement to see which is selected.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-08-24T13:43:12.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2135" PostTypeId="2" ParentId="2133" CreationDate="2014-08-24T14:03:17.740" Score="2" Body="&lt;p&gt;It always depends on your needs, so there is not really a best way to do feature entries, at least if you don't give more specific info on what your exact situation is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have a nice overview of which entries are featured, you could add a new section (structure or channel), with an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;entries field&lt;/a&gt; to collect the entries you want to be featured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea would be to collect the feature entries in a global set using matrix. You need just a single block type, again with an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;entries field&lt;/a&gt; to make the relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Matrix field or a structure section enables you to (optionally) re-order the entries to your liking.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-25T13:21:58.203" LastActivityDate="2014-08-25T13:21:58.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2136" PostTypeId="1" CreationDate="2014-08-24T19:03:05.233" Score="1" ViewCount="187" Body="&lt;p&gt;Google Maps for Craft has a settings page that uses JavaScript that aids the user in setting up their Google Maps field. So the user can set a default center and zoom for the map, and they do this by manipulating a map in the settings page. All works fine when creating a standard field. I used the &lt;code&gt;$(document).ready()&lt;/code&gt; method to trigger my code, but since Matrix creates these fields after the DOM has already triggered that event, my code isn't getting instantiated. Matrix for EE has a similar callback function that is triggered, so I assume Matrix for Craft has the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any code examples for listening for when new Matrix fields are created? I tried browsing through the existing field type code and &lt;code&gt;MatrixConfigurator.js&lt;/code&gt; but couldn't find any examples yet.&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="19" LastEditDate="2014-08-24T19:16:06.677" LastActivityDate="2014-08-26T12:26:50.623" Title="Is there a JavaScript event that is triggered when a field type's settings html is displayed within Matrix?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2137" PostTypeId="2" ParentId="2136" CreationDate="2014-08-24T19:56:46.520" Score="2" Body="&lt;p&gt;There’s no event for it, but any JS you include using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#includeJs-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;templates-&gt;includeJs()&lt;/a&gt; from your field type's getSettingsHtml() method will get fired each time a new Matrix sub-field is created, so &lt;strong&gt;if you code your field type correctly&lt;/strong&gt; with properly namespaced inputs] IDs/names, no event will be needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing about Matrix is, there’s no way to predict what the actual input IDs/names are going to be when they are added to the DOM, as they will be run through &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#namespaceInputs-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService::namespaceInputs()&lt;/a&gt; with the namespace &lt;code&gt;blockTypes[__BLOCK_TYPE__][fields][__FIELD__][typesettings]&lt;/code&gt;, and those “__BLOCK_TYPE__” and “__FIELD__” placeholders are replaced dynamically by MatrixConfigurator’s Javascript before adding the settings HTML to the DOM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regular field settings get namespaced too, but in a more predictable way (their namespace will always be &lt;code&gt;types[FieldTypeClassHandle]&lt;/code&gt;), so it can be tempting to just hard-code the namespaced IDs directly into your Javascript, like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$js = &quot;\$('#types-FieldTypeClassHandle-myInputId')&quot; // ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Matrix’s unpredictability shows why it’s important to &lt;strong&gt;not&lt;/strong&gt; do that, and instead always use &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#namespaceInputId-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService::namespaceInputId()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#namespaceInputName-detail&quot; rel=&quot;nofollow&quot;&gt;namespaceInputName()&lt;/a&gt; whenever you need to reference an input’s ID or name from your Javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$namespacedId = craft()-&amp;gt;templates-&amp;gt;namespaceInputId('myInputId');&#xA;&#xA;$js = &quot;\$('#{$namespacedId}')&quot; // ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you let TemplatesService generate the namespaced IDs/names for you, you can be sure that it will always give you an ID/name that will match whatever the actual ID/name will be in the DOM.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-08-26T12:26:50.623" LastActivityDate="2014-08-26T12:26:50.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2138" PostTypeId="1" AcceptedAnswerId="2139" CreationDate="2014-08-24T22:03:50.693" Score="2" ViewCount="2001" Body="&lt;p&gt;I'm not entirely sure how to search a &lt;em&gt;specific&lt;/em&gt; Matrix field for a given bit of content. I can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cta in entry.homeCtas.search('&quot;Lorem Ipsum&quot;') %}&#xA;    &amp;lt;h1&amp;gt;{{ cta.ctaTitle }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to find any Matrix rows with &quot;Lorem Ipsum&quot; (not in a specific field). But when I try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cta in entry.homeCtas.search('ctaTitle:&quot;Lorem Ipsum&quot;') %}&#xA;    &amp;lt;h1&amp;gt;{{ cta.ctaTitle }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It returns nothing. Is my field syntax incorrect? Am I missing something obvious?&lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2014-08-25T00:48:58.700" Title="How to search for content in a specific Matrix field?" Tags="&lt;matrix&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2139" PostTypeId="2" ParentId="2138" CreationDate="2014-08-25T00:48:58.700" Score="2" Body="&lt;p&gt;What I'm not clear of is if you are asking if you can query for entries that have a matrix field that contains x, or if you just asking if you can search within a matrix field of an entry that has already been returned by a query. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is the later, the following solution would work. This isn't a feature of Craft, but a feature of Twig. Thus, implementing it won't save on queries or anything, but it will help you filter the results returned by Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig has a feature that allows you to apply a condition in addition to the for loop. It is documented &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cta in entry.homeCtas if cta.ctaTitle == &quot;Lorem Ipsum&quot; %}&#xA;    &amp;lt;h1&amp;gt;{{ cta.ctaTitle }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="279" LastActivityDate="2014-08-25T00:48:58.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2140" PostTypeId="1" AcceptedAnswerId="2143" CreationDate="2014-08-25T01:47:26.637" Score="4" ViewCount="2744" Body="&lt;p&gt;I'm trying to generate a sitemap and wish to output all the entries that have a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel#type&quot; rel=&quot;nofollow&quot;&gt;section type&lt;/a&gt; of 'single' but can't get the the correct syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the entries need to return 'single' for &lt;code&gt;{entry.section.type}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This query doesn't work but hopefully helps demo the above question #}&#xA;&#xA;{% for entry in craft.entries.section({'type':'single'}).order('id asc') %}&#xA;    &amp;lt;url&amp;gt;&#xA;        &amp;lt;loc&amp;gt;{{ entry.url }}&amp;lt;/loc&amp;gt;&#xA;        &amp;lt;lastmod&amp;gt;{{ entry.dateUpdated.atom }}&amp;lt;/lastmod&amp;gt;&#xA;        &amp;lt;changefreq&amp;gt;weekly&amp;lt;/changefreq&amp;gt;&#xA;        {% if entry.section.isHomepage() %}&#xA;            &amp;lt;priority&amp;gt;1&amp;lt;/priority&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;priority&amp;gt;0.8&amp;lt;/priority&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/url&amp;gt;    &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This query does work but it's a slow &lt;strong&gt;bad way&lt;/strong&gt; of doing it as it gets &lt;strong&gt;EVERY&lt;/strong&gt; entry and filters after the fact:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.order('id asc') if entry.section.type == &quot;single&quot; %}&#xA;    &amp;lt;url&amp;gt;&#xA;        &amp;lt;loc&amp;gt;{{ entry.url }}&amp;lt;/loc&amp;gt;    &#xA;        &amp;lt;changefreq&amp;gt;weekly&amp;lt;/changefreq&amp;gt;&#xA;        {% if entry.section.isHomepage() %}&#xA;            &amp;lt;priority&amp;gt;1&amp;lt;/priority&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;priority&amp;gt;0.8&amp;lt;/priority&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/url&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="111" LastEditorUserId="111" LastEditDate="2014-08-26T06:09:19.493" LastActivityDate="2015-07-22T03:01:10.253" Title="How do I return ALL entries that are singles" Tags="&lt;sections&gt;&lt;elementtype&gt;&lt;singles&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2141" PostTypeId="1" AcceptedAnswerId="2190" CreationDate="2014-08-25T06:34:19.557" Score="2" ViewCount="274" Body="&lt;p&gt;I use a responsive image plugin similar to picturefill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my local environement it works well, on my live install however the last trasnform isn't applied and I receive a 404. I guess it might be some memory_limit issue, so I wonder if there is a more efficent way to write this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fullw_trans_xs = { mode: 'crop', width: 767, } %}&#xA;{% set fullw_trans_sm = { mode: 'crop', width: 768, } %}&#xA;{% set fullw_trans_md = { mode: 'crop', width: 992, } %}&#xA;{% set fullw_trans_lg = { mode: 'crop', width: 1200, } %}&#xA;&amp;lt;img class=&quot;bttr img-responsive&quot; alt=&quot;{{asset.title}}&quot;&#xA;   data-bttrlazyloading-xs='{&quot;src&quot;: &quot;{{ asset.getUrl(fullw_trans_xs) }}&quot;, &quot;width&quot; : {{ asset.getWidth(fullw_trans_xs) }},  &quot;height&quot; : {{ asset.getHeight(fullw_trans_xs) }}}'&#xA;   data-bttrlazyloading-sm='{&quot;src&quot;: &quot;{{ asset.getUrl(fullw_trans_sm) }}&quot;, &quot;width&quot; : {{ asset.getWidth(fullw_trans_sm) }},  &quot;height&quot; : {{ asset.getHeight(fullw_trans_sm) }}}'&#xA;   data-bttrlazyloading-md='{&quot;src&quot;: &quot;{{ asset.getUrl(fullw_trans_md) }}&quot;, &quot;width&quot; : {{ asset.getWidth(fullw_trans_md) }},  &quot;height&quot; : {{ asset.getHeight(fullw_trans_md) }}}'&#xA;   data-bttrlazyloading-lg='{&quot;src&quot;: &quot;{{ asset.getUrl(fullw_trans_lg) }}&quot;, &quot;width&quot; : {{ asset.getWidth(fullw_trans_lg) }},  &quot;height&quot; : {{ asset.getHeight(fullw_trans_lg) }}}'&#xA;            /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I saw the answer of Brandon Kelly about &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1723/how-can-i-automatically-generate-responsive-images-from-a-single-hi-res-asset/1724#1724&quot;&gt;retina images&lt;/a&gt; with that macro thing but frankly, I don't get it. Could that be applied in some way to solve this problem as well?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-08-27T06:42:06.227" Title="Efficiently writing multiple transforms" Tags="&lt;image-transforms&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2142" PostTypeId="2" ParentId="2023" CreationDate="2014-08-25T06:50:40.330" Score="0" Body="&lt;p&gt;I'm going to edit this as another answer, so it will get seen - and will removed it as a comment, since it offers a new path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started looking at the problem in detail, and tracked the error handling and its translation back into Yii as handler. Translation of Yii stock form error messages should just work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I looked again at your site, and messages are in French, e.g. invalid email, even though the site is presenting in English, which I presume is your problem. I imagine French is the base language of the site, which shows I think that the translation is active for templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So maybe your problem is not fully switching to English as far as Yii is concerned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you setting define('CRAFT_LOCALE', 'en_us'); in your /en/index.php file?? In my experience it has to be en_us to match the standard translations. If you set it up as en only, for example, your templates could use your English template versions depending on your other settings choices, but not I think access the stock translations, like these form errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe that's your problem??  I don't think Ajax is any part of the problem, as the same (translated) error strings would be passed there as are made available for the template. If you look at the error handler which does Ajax also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's another edit. I'd like to present the relevant portion of a properly configured general.php file for three languages, which successfully presents in-locale Contact Form error messages in English, Russian, or Swedish depending on the operating Locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'environmentVariables' =&amp;gt; array(&#xA;       'siteStore' =&amp;gt; '/storage/avNNNNN/www/the_site_html/public/',&#xA;       'sitePath' =&amp;gt; 'http://www.thesite.com/',&#xA;    ),&#xA;&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://www.thesite.com/en/',&#xA;        'ru' =&amp;gt; 'http://www.thesite.com/ru/',&#xA;        'sv' =&amp;gt; 'http://www.thesite.com/sv/',&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magic coding in Craft will properly handle https operation automatically, and this configuration pattern also makes sure that Live View operates properly in Entry edits. Note you match the 'en' 'ru' etc..  to however you've defined locales in Locale CP config screens, not necessarily to more specific variants like en_us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the sitePath and siteStore as {sitePath} for example in Asset definitions, so that their paths will come out correctly on the base site rather than the language variant path. This affects Live View for instance also, makes it work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it's all very sensitive, precise, and not yet fully described in doc here, unless they caught up on it in the last update which included much doc. I've asked...and they are very busy producing towards all of need.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2014-08-25T23:21:27.293" LastActivityDate="2014-08-25T23:21:27.293" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2143" PostTypeId="2" ParentId="2140" CreationDate="2014-08-25T07:14:03.073" Score="12" Body="&lt;p&gt;There's no such method available for &lt;code&gt;craft.entries&lt;/code&gt;, at least it's not documented. But you can use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.sections&quot;&gt;&lt;code&gt;craft.sections&lt;/code&gt;&lt;/a&gt; to get an array of section models and filter them with a conditional within a loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all Section #}&#xA;{% set sections = craft.sections.getAllSections() %}&#xA;&#xA;{# Loop through all single sections #}&#xA;{% for singleSection in sections if singleSection.type == 'single' %}&#xA;&#xA;    {# Get the first (and only) entry of that section #}&#xA;    {% set singleEntry = craft.entries.sectionId(singleSection.id).first %}&#xA;&#xA;    {# Output #}&#xA;    {{ singleSection }}&#xA;    {{ singleSection.isHomepage() ? '(Home)' : '(not Home)'}}&#xA;    {{ singleEntry.dateUpdated.atom }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-26T06:23:11.773" LastActivityDate="2014-08-26T06:23:11.773" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2144" PostTypeId="2" ParentId="1723" CreationDate="2014-08-25T08:19:35.927" Score="10" Body="&lt;p&gt;Quick comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using generated transforms, you are likely not doing any &quot;art direction&quot; with your images. Basically all your images will be the same, their dimensions alone would be different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not concerned about art direction, a picture element is overkill and you should just look at &lt;code&gt;srcset&lt;/code&gt; and &lt;code&gt;sizes&lt;/code&gt; attributes on an image tag. &lt;a href=&quot;http://dev.opera.com/articles/native-responsive-images/&quot;&gt;Yoav Weiss explains it better than I ever could&lt;/a&gt;. &lt;a href=&quot;http://ericportis.com/posts/2014/srcset-sizes/&quot;&gt;Eric Portis also has a comprehensive blog post&lt;/a&gt; on &lt;code&gt;srcset&lt;/code&gt; and &lt;code&gt;sizes&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;small.jpg&quot;&#xA;     srcset=&quot;large.jpg 1024w,&#xA;             medium.jpg 600w,&#xA;             small.jpg 350w&quot;&#xA;     sizes=&quot;(min-width: 64em) 33.3vw,&#xA;            (min-width: 37.5em) 50vw,&#xA;            100vw&quot;&#xA;     alt=&quot;alternate text&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this, the browser will figure out which image to serve, depending on the screen size and pixel resolution. Magic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: To make sure all the transforms are generated by Craft with picturefill, use &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true&lt;/code&gt; in your general.php config file.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-08-25T08:19:35.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2145" PostTypeId="1" CreationDate="2014-08-25T17:16:48.173" Score="3" ViewCount="629" Body="&lt;p&gt;I'm working on a webshop with an advanced filter / search with multiple categories, entry types and fields and sorting options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Schematic URL&lt;/strong&gt;&lt;br /&gt;&#xA;site.com/template/entry.type/category/?size=category OR category&amp;amp;color=category AND category&amp;amp;checkbox=yes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Real world example&lt;/strong&gt;&lt;br /&gt;&#xA;site.com/shop/woman/jeans/?size=s,m&amp;amp;color=blue,red&amp;amp;delivery=yes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to show the entries? With search or relatedTo?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is what I have so far:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment('3') is not null %}&#xA;    {% set kind_slug = craft.request.getSegment('3') %}&#xA;&#xA;    {% set categoryParams = {&#xA;        group: 'kind',&#xA;        slug: kind_slug&#xA;    } %}&#xA;&#xA;{% else %}&#xA;    {% set categoryParams = {&#xA;       all kinds&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{% set kind = craft.categories(categoryParams).first() %}&#xA;{% set size = craft.request.getParam('size') %} #}&#xA;{% set color = craft.request.getParam('color') %} #}&#xA;&#xA;{% set params = {&#xA;    section: 'product',&#xA;    type: craft.request.getSegment(2),&#xA;    relatedTo: kind AND size AND color&#xA;} %}&#xA;&#xA;{% for entry in craft.entries(params).find() %}&#xA;    {{ entry.title }}   &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want the same functionality as this EE plugin: &lt;br /&gt;&lt;a href=&quot;http://www.ralphmedia.co.uk/reefine/demo_basic&quot; rel=&quot;nofollow&quot;&gt;http://www.ralphmedia.co.uk/reefine/demo_basic&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-08-26T07:53:46.720" LastActivityDate="2014-08-26T07:53:46.720" Title="Filter entries with segments and params based on categories and fields" Tags="&lt;entries&gt;&lt;search&gt;&lt;filter&gt;&lt;segments&gt;&lt;params&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ClosedDate="2014-08-25T20:58:16.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="2146" PostTypeId="1" CreationDate="2014-08-25T17:38:14.297" Score="5" ViewCount="655" Body="&lt;p&gt;Is it possible to put conditions on the ordering of a loop of entries? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two fields: title and alphaTitle. I want to order alphabetically, by alphaTitle if it has a value, otherwise by title. Title will always have a value but I only want to order by title if there is no alphaTitle. I've been having some trouble figuring out if this is possible or how to do it - any chance someone can point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="715" LastEditorUserId="57" LastEditDate="2014-08-25T17:58:51.600" LastActivityDate="2014-08-25T18:00:35.740" Title="From a template, how can you order entries by one field, and if that field is empty a different field?" Tags="&lt;entries&gt;&lt;conditional&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2147" PostTypeId="2" ParentId="2146" CreationDate="2014-08-25T18:00:35.740" Score="12" Body="&lt;p&gt;There are several ways you could attack this, but probably the easiest is directly from the SQL side with something like this using a SQL CASE statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').order('(CASE WHEN field_alphaTitle IS NULL OR field_alphaTitle = &quot;&quot; THEN title ELSE field_AlphaTitle END)').find() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;TITLE = {{ entry.title }} / ALPHA TITLE = {{ entry.alphaTitle }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that is assuming that &lt;code&gt;alphaTitle&lt;/code&gt; is a custom field and &lt;code&gt;title&lt;/code&gt; is the standard one available to all entries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-25T18:00:35.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2148" PostTypeId="1" AcceptedAnswerId="2158" CreationDate="2014-08-25T18:07:42.250" Score="3" ViewCount="1447" Body="&lt;p&gt;The question says it all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Matrix field, with&lt;/li&gt;&#xA;&lt;li&gt;A subfield with the type table&lt;/li&gt;&#xA;&lt;li&gt;Two columns within that table of which I want to show the column headers in my template&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is that possible and if yes, how?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="125" LastEditDate="2014-08-26T08:22:27.257" LastActivityDate="2018-05-01T15:59:05.293" Title="Show a table field's column headers in template?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2149" PostTypeId="1" AcceptedAnswerId="2150" CreationDate="2014-08-25T18:28:37.893" Score="5" ViewCount="828" Body="&lt;p&gt;How would I make a post(s) sticky so that it appears first in the results and does not repeat later in the results?&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="45" LastEditDate="2018-08-20T21:38:37.317" LastActivityDate="2021-03-30T12:17:26.790" Title="Is there a &quot;sticky post&quot; function built into Craft?" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2150" PostTypeId="2" ParentId="2149" CreationDate="2014-08-25T19:43:13.037" Score="11" Body="&lt;p&gt;You could add a custom lightswitch field or similar and order your entries by that field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').order('myLightswitch desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need additional sort options, @Brad &lt;a href=&quot;https://craftcms.stackexchange.com/q/2146/125&quot;&gt;just shared&lt;/a&gt; how to do that with SQL in the &lt;code&gt;order()&lt;/code&gt; parameter.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-25T19:43:13.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2152" PostTypeId="1" CreationDate="2014-08-25T20:36:39.537" Score="2" ViewCount="231" Body="&lt;p&gt;I guess the answer is probably &quot;No&quot; but I have read this &quot;relate anything to anything&quot; feature here &lt;a href=&quot;http://buildwithcraft.com/features/relations&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/features/relations&lt;/a&gt; and I was wondering how powerful is that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create an Events website&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my project users should be able to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Enter records via a form (Events)&lt;/li&gt;&#xA;&lt;li&gt;Change their own records &lt;/li&gt;&#xA;&lt;li&gt;Choose an event and say they attend it (subscribe)&lt;/li&gt;&#xA;&lt;li&gt;Enter or choose how the travel to that event (by car, bus, plane)&lt;/li&gt;&#xA;&lt;li&gt;To rate and add a comment to those events.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The Events should show for instance how many people attend to that event, who are those people and how they travel there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally users should be able to sell their own even tickets but that will need some custom developing for implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could reach that kind of functionality with an SaaS database online solution like knapp or Caspio, create their a relational database and embed their database views in a CMS like Craft but I would prefer to use just Craft for the whole project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be that possible to build all that in Craft?&lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="633" LastEditDate="2014-08-26T15:52:55.533" LastActivityDate="2014-08-26T16:33:48.180" Title="Can you use Craft to build a relational web app database in a Knapp or Caspio style?" Tags="&lt;database&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2153" PostTypeId="1" CreationDate="2014-08-25T21:59:55.940" Score="1" ViewCount="861" Body="&lt;p&gt;How do I use/call globals in entries? Trying to insert a simple global called {{ whateveryounameit }} with some text but don't see anything except its name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ways to display common content across multiple entries?&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-09-10T14:05:19.377" Title="Reusable content in entries, globals?" Tags="&lt;globals&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2154" PostTypeId="2" ParentId="2153" CreationDate="2014-08-25T22:04:17.730" Score="4" Body="&lt;p&gt;You call globals with the globals' handle, and the field name of a field in it. So, if you have a text input field named &quot;myField&quot; inside a global with handle &quot;myGlobal&quot;, you can call it anywhere in your templates with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myGlobal.myField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-25T22:04:17.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2155" PostTypeId="2" ParentId="2153" CreationDate="2014-08-25T22:46:36.053" Score="1" Body="&lt;p&gt;if globals don't work for you could create a related entry field that allows you call up previously created content (related blog or news posts as an example). This way you can but reference the same content through multiple entries but only have to create it once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;Craft docs for Relations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-25T22:46:36.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2156" PostTypeId="1" AcceptedAnswerId="2159" CreationDate="2014-08-26T06:15:35.223" Score="3" ViewCount="1309" Body="&lt;p&gt;Is it possible to auto generate PDF preview images with Craft transforms? &lt;a href=&quot;https://stackoverflow.com/q/467793/3699394&quot;&gt;This popular Q/A&lt;/a&gt; at Stack Overflow shows a PHP solution making use of &lt;a href=&quot;http://us3.php.net/imagick&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageMagick&lt;/a&gt; and &lt;a href=&quot;http://sourceforge.net/projects/ghostscript/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GhostScript&lt;/a&gt;. Is installing these plugins all I'd need to make Craft do the transforms with &lt;code&gt;pdf.getUrl('thumb')&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I use an assets - &lt;a href=&quot;http://buildwithcraft.com/docs/assets#asset-meta-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;asset meta field&lt;/a&gt; on the PDF to achieve what I want (see code below), but that means I have to generate and upload the image myself. So I wondered if there's a nice and easy way to automate that process.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for pdf in entry.pdfAssets %}&#xA;&#xA;    {# Get the pdf preview thumb or use a generic one as a fallback #}&#xA;    {% set previewImage = pdf.previewImage|length ? pdf.previewImage.first.url('thumb') : 'pdf_thumb.jpg' %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ pdf.url }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ previewImage }}&quot;&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-08-26T07:58:24.877" Title="Generate PDF preview images automatically?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2157" PostTypeId="1" CreationDate="2014-08-26T07:05:10.263" Score="2" ViewCount="89" Body="&lt;p&gt;I've made a matrix field on one of my templates. After adding alot of content, and then trying to delete it, I get this message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;include(/home/blabla/bla/craft/app/enums/AssetConflictResolution.php): failed to open stream: No such file or directory&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The reason might be that I changed my basepath in general.php / staging issues. Any idea, anyone?&lt;/p&gt;&#xA;" OwnerUserId="507" LastEditorUserId="250" LastEditDate="2014-10-10T19:01:25.323" LastActivityDate="2014-10-10T19:01:25.323" Title="Assetconflict after changing general.php" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2158" PostTypeId="2" ParentId="2148" CreationDate="2014-08-26T07:06:22.710" Score="18" Body="&lt;p&gt;You don't get table headings with the entry model data (use the &lt;code&gt;dump()&lt;/code&gt; function while in dev mode to see yourself). But there's the method &lt;code&gt;getFieldByHandle()&lt;/code&gt; that returns a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/FieldModel&quot; rel=&quot;noreferrer&quot;&gt;field model&lt;/a&gt; containing info to any field settings.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;This is how you access the headings of a table field&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Craft 2&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('myTableField') %}&#xA;&#xA;{% for column in field.settings.columns %}&#xA;    &amp;lt;li&amp;gt;{{ column.heading }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Craft 3&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set field = craft.app.fields.getFieldByHandle('myTableField') %}&#xA;&#xA;{% for column in field.settings.columns %}&#xA;    &amp;lt;li&amp;gt;{{ column.heading }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Table field in Matrix block:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As fields within matrix blocks don't necessarily have unique field handles, you can't use the &lt;code&gt;getFieldByHandle()&lt;/code&gt; method to get the field model. Use the unique field ID with the method &lt;code&gt;getFieldById()&lt;/code&gt; instead. To look that ID up, open up the source code of the field in the matrix field's field settings. There's a div with the class &lt;code&gt;matrixconfigitem&lt;/code&gt; and a data attribute &lt;code&gt;data-id&lt;/code&gt;, which is the ID you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(PS: use the code in your matrix loop for the block type containing your table &quot;sub&quot; field to output in the right place, but it actually works everywhere!)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="5557" LastEditDate="2018-05-01T15:59:05.293" LastActivityDate="2018-05-01T15:59:05.293" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2159" PostTypeId="2" ParentId="2156" CreationDate="2014-08-26T07:58:24.877" Score="4" Body="&lt;p&gt;There a plugin for that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carnesmedia/pthumb&quot; rel=&quot;nofollow&quot;&gt;https://github.com/carnesmedia/pthumb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PThumb is a Craft plugin that generates thumbnail preview images for PDF documents. It's easy to drop into your templates, requires only the commmand-line version of ImageMagick (not the PHP bindings), and caches the generated thumbnails.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ craft.PThumb.thumbnail(myAsset) }}&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;{{ craft.PThumb.thumbnail(myAsset, 100, 100) }}&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;{{ craft.PThumb.thumbnail(myAsset, 100, 150, true, 'jpg') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-08-26T07:58:24.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2160" PostTypeId="1" AcceptedAnswerId="2161" CreationDate="2014-08-26T08:02:40.093" Score="12" ViewCount="2346" Body="&lt;p&gt;As the title says, I changed a section from Channel to Structure, but when clicking on that section in the dashboard, the layout still looks like a Channel, and I'm not able to reorder/drag the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried switching the section back to a Channel, and then again back to a Structure, with no change. Most of the entries were added since switching over to Structure, but they all still behave like Channel entries.&lt;/p&gt;&#xA;" OwnerUserId="228" LastActivityDate="2016-10-07T17:46:19.590" Title="Changed section from Channel to Structure, but can't re-order entries" Tags="&lt;structure&gt;&lt;sections&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2161" PostTypeId="2" ParentId="2160" CreationDate="2014-08-26T08:07:08.067" Score="23" Body="&lt;p&gt;Have you switched sorting to &quot;Structure&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WVxjC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WVxjC.png&quot; alt=&quot;sort menu&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're not sorting by Structure, you won't be able to rearrange the entries.&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="45" LastEditDate="2016-10-07T17:46:19.590" LastActivityDate="2016-10-07T17:46:19.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2163" PostTypeId="2" ParentId="2113" CreationDate="2014-08-26T09:04:38.430" Score="18" Body="&lt;p&gt;OK, figured it out (or at least it works, so correct me if a better way is available):&#xA;This method assumes logged in frontend users, not sure if it's possible for guests, have not tested that. Might give permission errors.&lt;/p&gt;&#xA;&lt;p&gt;Let's say, we have a section &lt;em&gt;message&lt;/em&gt; with id 2, containing an asset field called &lt;em&gt;photos&lt;/em&gt;. This is the field in which we want to save all frontend uploaded images.&lt;/p&gt;&#xA;&lt;p&gt;In your form template, do everything exactly as &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;noreferrer&quot;&gt;this doc page&lt;/a&gt; says. Beware of the fact that you're own fields input names should start with 'fields[myFieldHandle]', and default fields such as title and author should just have their handle as input name.&lt;/p&gt;&#xA;&lt;p&gt;Also, make sure your form has &lt;em&gt;enctype=&amp;quot;multipart/form-data&amp;quot;&lt;/em&gt; in its tag. What you have now, should look like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&amp;quot;&amp;quot; method=&amp;quot;POST&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&#xA;    &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;action&amp;quot; value=&amp;quot;entries/saveEntry&amp;quot; /&amp;gt;&#xA;    &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;sectionId&amp;quot; value=&amp;quot;2&amp;quot; /&amp;gt;&#xA;    &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;enabled&amp;quot; value=&amp;quot;1&amp;quot; /&amp;gt;&#xA;&#xA;    &amp;lt;input type=&amp;quot;file&amp;quot; name=&amp;quot;assets-upload&amp;quot; multiple /&amp;gt;&#xA;&#xA;    &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Make it work!&amp;quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You'll notice that the file input field has 'assets-upload' as its name. You can either do this, or make your uploading mechanism change the field name to 'assets-upload' for you, because Craft assumes this name in the controller class you're about to use.&lt;/p&gt;&#xA;&lt;p&gt;For my form, I used the excellent Jquery File Upload plugin, which starts to do its work once files are selected in the file input field. I'm sure any other plugin could do the same. Make sure the plugin uploads the files to Craft's assets/uploadFile controller for them to be processed. The only thing this controller needs, is a folderId (the id of the asset folder the assets should be copied to). So, this is what the upload plugin needs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$('#assets-upload').fileupload({&#xA;    url: '{{ url(actions/assets/uploadFile) }}',&#xA;    dataType: 'json',&#xA;    formData: [{ name: 'folderId', value: yourfolderId}],&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;By now, you should be able to have your plugin send one or more assets to Craft's controller. Use firebug or Chrome's devTools to see what is returned. If everything worked as it should, a json-string should be returned containing the fileId(s) of the uploaded file(s).&#xA;The only thing left to do then, is creating hidden input fields to tell Craft which assets to relate to this entry. What JavaScript should append to the form, is one or more instances of:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;fields[photos][]&amp;quot; value=&amp;quot;yourFileId&amp;quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example, using the 'done' callback function in JQuery File upload:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;done: function (e, data) {&#xA;    if(data.result.success) {&#xA;        var fileId = data.result.fileId;&#xA;        $(this).after('&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;fields[photos][]&amp;quot; value=&amp;quot;' + fileId + '&amp;quot; /&amp;gt;');&#xA;    }&#xA;},&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Submit your form, and see if it works. It should. If not, use the errors Craft returns to solve your problems (quite possibly permission-related).&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Final note: My asset field is set to create a different file folder for each entry. In this case, I created a temporary folder and used its ID in the frontend form (because the folder is only created once the entry is saved). Craft will copy the assets to the right place and clean out this temp folder on saving the entry.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-08-26T14:54:01.860" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="2164" PostTypeId="1" AcceptedAnswerId="2166" CreationDate="2014-08-26T09:21:28.980" Score="3" ViewCount="665" Body="&lt;p&gt;How do you update an URL with new params?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a search / filter entries page. I have multiple menu lists with categories in it. Like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Size:&lt;/strong&gt;&#xA;Small&#xA;Medium&#xA;Large&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Color:&lt;/strong&gt;&#xA;Blue&#xA;Red&#xA;White&#xA;Yellow&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the URL is &lt;code&gt;product?size=m&lt;/code&gt; and I click on a link &quot;Size → Large&quot; then the URL needs to update to &lt;code&gt;product?size=m,l&lt;/code&gt;. Click again on &quot;Large&quot; the &lt;code&gt;l&lt;/code&gt; value of the sizes parameter needs to delete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I then click on &quot;Color → Red&quot; the URL must be &lt;code&gt;product?size=m,l&amp;amp;color=red&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="125" LastEditDate="2014-08-26T13:18:32.897" LastActivityDate="2014-08-26T13:18:32.897" Title="Compose URL POST parameters to filter entries by category?" Tags="&lt;templating&gt;&lt;url&gt;&lt;request&gt;&lt;category&gt;&lt;post&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2166" PostTypeId="2" ParentId="2164" CreationDate="2014-08-26T12:26:20.930" Score="4" Body="&lt;p&gt;I'd &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot; rel=&quot;nofollow&quot;&gt;split the parameter string&lt;/a&gt; into an array and then loop through the categories and use a conditional to check if the value already exists in the parameter. It's not so easy to describe in detail, that's why I added lots of comments to the code (untested!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work in your other parameters (size, etc.), simply add them to your links exactly how &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getParam&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getParam()&lt;/code&gt;&lt;/a&gt; returns them. Conditionally skip the output completely if the param is empty.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{# Get the parameter (e.g. 'red,blue,black') #}&#xA;{% set currentParam = craft.request.getParam('color') %}&#xA;&#xA;{# Split the parameter string #}&#xA;{% set arrCurrentParam = currentParam|split(',') %}&#xA;&#xA;{# Loop through categories to output the links #}&#xA;{% for catOut in categories %}&#xA;&#xA;    {# Define newParam var before loop #}&#xA;    {% set newParam = '' %}&#xA;&#xA;    {# Loop through categories to compose the new parameter #}&#xA;    {% for catComp in categories %}&#xA;&#xA;        {# Check if changes could happen in this loop #}&#xA;        {% if catOut.slug == catComp.slug %}&#xA;&#xA;            {# Add category if it was currently NOT selected #}&#xA;            {% if catComp.slug not in arrCurrentParam %}&#xA;                {% set newParam = newParam ~ ',' ~ catComp.slug %}&#xA;            {% endif %}&#xA;&#xA;        {% else %}&#xA;&#xA;            {# Add category if it was already selected #}&#xA;            {% if catComp.slug in arrCurrentParam %}&#xA;                {% set newParam = newParam ~ ',' ~ catComp.slug %}&#xA;            {% endif %}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {# Remove leading comma #}&#xA;    {% set newParam = newParam|slice(1) %}&#xA;&#xA;    {# Conditionally add param to link output #}&#xA;    &amp;lt;a href=&quot;product?{{ newParam ? 'color=' ~ newParam }}&quot;&amp;gt;{{ category.slug }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-26T13:00:59.663" LastActivityDate="2014-08-26T13:00:59.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2167" PostTypeId="1" AcceptedAnswerId="2251" CreationDate="2014-08-26T13:10:58.077" Score="2" ViewCount="231" Body="&lt;p&gt;This might be a little difficult to explain thoroughly and correctly, bear with me. :)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The news website I'm working on has different categories based on topics, location, and &quot;genres&quot; (news, editorial, press release, etc). In addition, we also have other channels that work independently from the primary articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having a difficult time finding the best approach to provide information such as heading, description, a cover image, etc — for these different channels in a way that is organized, makes sense and can be easily edited from the CP.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Example&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;strong&gt;Main&lt;/strong&gt; channel could have an image and a description which states that the articles in this section are written by the members of the company.&lt;/li&gt;&#xA;&lt;li&gt;A channel managed by a writer from the community could also have its own cover image and description stating that this channel contains chronicles and critics by him and other authors.&lt;/li&gt;&#xA;&lt;li&gt;A channel managed by a collaborator/correspondent could focus on a specific topic, such as technology; the image and description of the channel would explain this.&lt;/li&gt;&#xA;&lt;li&gt;Another channel could provide news related to the company alone.&lt;/li&gt;&#xA;&lt;li&gt;Another channel could be from the developers in the team.&lt;/li&gt;&#xA;&lt;li&gt;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note how these secondary channels are different from the main content. These should not be mixed together and are often accessed by different users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So... Has anyone dealt with this problem? How have you solved it? I have a few ideas in mind but I'd like to see what other practices are out there.&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="47" LastEditDate="2014-08-28T18:20:04.790" LastActivityDate="2014-08-30T15:55:15.103" Title="Adding description and other information to channels" Tags="&lt;structure&gt;&lt;sections&gt;&lt;channels&gt;&lt;content&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2168" PostTypeId="1" CreationDate="2014-08-26T13:31:25.690" Score="2" ViewCount="2210" Body="&lt;p&gt;Is is possible to use Craft's URL validation without &lt;code&gt;http://&lt;/code&gt; or &lt;code&gt;https://&lt;/code&gt; in the URL?&#xA;Or use some sort of function / filter to conditionally add it to the URL if it is missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm posting a form using sprout forms. The form contains a field that is set to validate as url.&lt;br&gt;&#xA;If you post this field without adding &lt;code&gt;http://&lt;/code&gt; or &lt;code&gt;https://&lt;/code&gt; it doesn't validate.&lt;br&gt;&#xA;Is it possible to somehow to set the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CUrlValidator#defaultScheme-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;defaultScheme&lt;/code&gt;&lt;/a&gt; of an url field to http without changing the core Craft UrlValidator or Yii's CUrlValidator?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="250" LastEditDate="2014-10-05T15:58:36.183" LastActivityDate="2014-10-05T15:58:36.183" Title="URL validation without http:// or https:// in the URL" Tags="&lt;templating&gt;&lt;url&gt;&lt;conditional&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2169" PostTypeId="2" ParentId="2023" CreationDate="2014-08-26T13:56:28.893" Score="3" Body="&lt;p&gt;Well, the problem was that I was posting my Ajax request to / from all languages, therefore the site replied back with the site main language, which was French in my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following finally works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the proper url to post to&#xA;&#xA;if ( '{{ craft.i18n.getCurrentLocale() }}' == '{{ craft.i18n.getPrimarySiteLocale() }}' {&#xA;     var url = '/';&#xA;} else {&#xA;     var url = '/{{ craft.i18n.getCurrentLocale() }}/';&#xA;}&#xA;&#xA;// Send it to the server&#xA;&#xA;$.post(url, data, function(response) {&#xA;     .......&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="156" LastEditorUserId="156" LastEditDate="2014-08-26T14:04:52.967" LastActivityDate="2014-08-26T14:04:52.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2171" PostTypeId="1" CreationDate="2014-08-26T14:16:13.640" Score="2" ViewCount="43" Body="&lt;p&gt;I'd like to group my Craft plugins using the PSR-0 Standard, I was hoping I could use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CompanyName_PluginNamePlugin extends BasePlugin&#xA;&#xA;plugins/&#xA;    companyname/&#xA;       pluginname/&#xA;           CompanyName_PluginNamePlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to group plugins in sub folders? Or do I just need to prefix my plugin folder - eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugins/&#xA;   companyname_pluginname/&#xA;       CompanyName_PluginNamePlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gets messy if I want to group any further:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugins/&#xA;    companyname_pluginname&#xA;    companyname_subgroup_otherpluginname&#xA;    companyname_secondsubgroup_otherpluginname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phil.&lt;/p&gt;&#xA;" OwnerUserId="723" LastEditorUserId="115" LastEditDate="2014-08-28T15:22:09.533" LastActivityDate="2014-08-28T15:22:09.533" Title="Is it possible to group my Craft plugins using the PSR-0 Standard?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2172" PostTypeId="1" CreationDate="2014-08-26T14:42:32.183" Score="1" ViewCount="163" Body="&lt;p&gt;My understanding is that the &lt;code&gt;testToEmailAddress&lt;/code&gt; config items &lt;em&gt;replaces&lt;/em&gt; the &lt;strong&gt;to&lt;/strong&gt; address for system emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way, outside of extending the system functionality with a plugin, to &lt;em&gt;add&lt;/em&gt; a &lt;strong&gt;to&lt;/strong&gt;/&lt;strong&gt;cc&lt;/strong&gt;/&lt;strong&gt;bcc&lt;/strong&gt; address for system emails? (Use case: I want to CC/BCC an admin on every system email.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-08-26T15:16:26.070" Title="Is it possible to bcc/cc an admin on every system email?" Tags="&lt;emails&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2173" PostTypeId="2" ParentId="2168" CreationDate="2014-08-26T14:48:48.567" Score="3" Body="&lt;p&gt;To conditionally add &lt;code&gt;http://&lt;/code&gt; to strings that don't begin with &lt;code&gt;http://&lt;/code&gt; or &lt;code&gt;https://&lt;/code&gt;, use the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot; rel=&quot;nofollow&quot;&gt;matches operator&lt;/a&gt; in a comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To keep the syntax compact, I use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary operator&lt;/a&gt; within the &lt;code&gt;set&lt;/code&gt; tag. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set an example URL without `http://` #}&#xA;{% set url = 'example.com' %}&#xA;&#xA;{# &quot;Correct&quot; the URL notation #}&#xA;{% set url = url matches '/^(https?:\\/\\/)/' ? url : 'http://' ~ url %}&#xA;&#xA;{# Test output #}&#xA;{{ url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is no full URL check in my regular expression, but you could simply work that in too. Pay attention to the escaping character &lt;code&gt;\&lt;/code&gt; that (&lt;a href=&quot;https://github.com/fabpot/Twig/pull/1457&quot; rel=&quot;nofollow&quot;&gt;currently&lt;/a&gt;) needs to be escaped itself, so you end up with &lt;code&gt;\\&lt;/code&gt; (it's wrong in the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot; rel=&quot;nofollow&quot;&gt;Twig docs&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-26T15:42:33.793" LastActivityDate="2014-08-26T15:42:33.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2174" PostTypeId="2" ParentId="2172" CreationDate="2014-08-26T14:55:21.097" Score="1" Body="&lt;p&gt;You can easily do that without any plugin by using a transactional email provider like &lt;a href=&quot;https://mandrill.com/&quot; rel=&quot;nofollow&quot;&gt;https://mandrill.com/&lt;/a&gt; or &lt;a href=&quot;http://sendgrid.com/&quot; rel=&quot;nofollow&quot;&gt;http://sendgrid.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2014-08-26T14:55:21.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2175" PostTypeId="2" ParentId="2172" CreationDate="2014-08-26T15:16:26.070" Score="0" Body="&lt;p&gt;Nothing in Craft out of the box will allow you do to that.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to write a plugin that creates and populates an &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/EmailModel.php&quot; rel=&quot;nofollow&quot;&gt;EmailModel&lt;/a&gt; with the settings you want and then pass that off to &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/EmailService.php#L67&quot; rel=&quot;nofollow&quot;&gt;EmailService-&gt;sendEmail()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-26T15:16:26.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2176" PostTypeId="2" ParentId="2171" CreationDate="2014-08-26T15:24:56.143" Score="1" Body="&lt;p&gt;Craft plugin naming conventions follow a specific format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#create-your-plugins-folder&quot; rel=&quot;nofollow&quot;&gt;The plugin folder must live immediately under the &lt;code&gt;craft/plugin&lt;/code&gt; folder and it must be the all lowercase name of your plugin's handle.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#create-your-plugins-folder&quot; rel=&quot;nofollow&quot;&gt;primary plugin class&lt;/a&gt; must live immediately in that folder and is named after your plugin's handle plus the word &quot;Plugin&quot;.  i.e. &lt;code&gt;PluginHandlePlugin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't support any concept of multiple primary plugin class files in one plugin folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-26T15:24:56.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2177" PostTypeId="2" ParentId="2157" CreationDate="2014-08-26T15:29:08.540" Score="3" Body="&lt;p&gt;If it were related to &lt;code&gt;basePath&lt;/code&gt;, then you'd most likely be getting other errors as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one sounds like Craft simply can't autoload the file it's looking for.  I'd re-upload your &lt;code&gt;craft/app&lt;/code&gt; folder to make sure all of the files got transferred up properly and aren't corrupted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-26T15:29:08.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2179" PostTypeId="1" AcceptedAnswerId="2180" CreationDate="2014-08-26T15:54:05.650" Score="4" ViewCount="1696" Body="&lt;p&gt;The website I'm building enables users to book places on events. This is simply a form which creates an entry in a channel containing 2 fields: &quot;related user&quot; and &quot;related event&quot;. In the control panel I've written a simple plugin which displays all the entries in that channel exactly the same as the control panel normally would do, but now I can display any fields I want instead of just title and post date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client wants to be able to export the entry data from the control panel into Excel (xls or csv). What's the simplest way to do this? I read somewhere about changing http headers to force a download of a file, so can I just force a browser download of a dynamically generated page containing a table of all that entry data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I say &quot;force a download&quot; I mean I probably just need a button that says &quot;Export&quot;, but it should download the file instead of opening it in the browser.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-10-17T16:06:18.987" Title="How can I force a download of entry data to an excel file?" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2180" PostTypeId="2" ParentId="2179" CreationDate="2014-08-26T16:06:07.550" Score="8" Body="&lt;p&gt;Craft's &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/HttpRequestService.php&quot;&gt;HttpRequestService&lt;/a&gt; has a &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/HttpRequestService.php#L660&quot;&gt;sendFile&lt;/a&gt; method (available via &lt;code&gt;craft()-&amp;gt;request-&amp;gt;sendFile()&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3rd parameter is an optional &lt;code&gt;$options&lt;/code&gt; array that accepts key =&gt; value pairs.  One of those is &lt;code&gt;'forceDownload' =&amp;gt; true&lt;/code&gt; and when that is passed in, Craft will set the proper HTTP headers to force the given file to be sent to the browser as a download.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do this from inside an action in one of your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot;&gt;controllers&lt;/a&gt;.  Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDownloadFile()&#xA;{&#xA;    // Grab your file content from wherever you have it stored. Here, it's just hard coded into a string.&#xA;    $contents = 'row1column1,row2column2'.PHP_EOL.'row2column1,row2column2'.PHP_EOL;    &#xA;&#xA;    // Call sendFile, giving it the name of the file to send, the contents and tell it to force a download to the browser.&#xA;    craft()-&amp;gt;request-&amp;gt;sendFile('filename.csv', $contents, array('forceDownload' =&amp;gt; true));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-08-26T17:04:33.633" LastActivityDate="2014-08-26T17:04:33.633" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2181" PostTypeId="2" ParentId="2152" CreationDate="2014-08-26T16:33:48.180" Score="4" Body="&lt;p&gt;It is perfectly possible. You would probably need a channel for the events and perhaps a separate channel for interactions on the event (ratings, comments etc). You can use Guest Editions or create your own plugin to add entries via a form.&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-08-26T16:33:48.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2182" PostTypeId="1" AcceptedAnswerId="2186" CreationDate="2014-08-26T17:58:49.517" Score="1" ViewCount="1485" Body="&lt;p&gt;I am trying to install a craft playground using vagrant and puppet.&#xA;After firing the default installation for a LAMP stack and creating related DB and User, granting privileges, ... I want to start the craft installation, all I get is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft can’t connect to the database with the credentials in craft/config/db.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The commands I am using to create the DB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE DATABASE craftdb CHARACTER SET utf8 COLLATE utf8_general_ci;&#xA;CREATE USER craftadmin@localhost IDENTIFIED BY 'ThisPassword';&#xA;GRANT ALL PRIVILEGES ON craftdb.* TO craftadmin@localhost;&#xA;FLUSH PRIVILEGES;&#xA;EXIT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The dp.php looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;'server' =&amp;gt; 'localhost',&#xA;&#xA;// The database username to connect with.&#xA;'user' =&amp;gt; 'craftadmin',&#xA;&#xA;// The database password to connect with.&#xA;'password' =&amp;gt; 'ThisPassword',&#xA;&#xA;// The name of the database to select.&#xA;'database' =&amp;gt; 'craftdb',&#xA;&#xA;// The prefix to use when naming tables. This can be no more than 5 characters.&#xA;'tablePrefix' =&amp;gt; '',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP Packages installed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;php5&quot;,&#xA;&quot;php5-common&quot;,&#xA;&quot;php5-cli&quot;,&#xA;&quot;php5-mysql&quot;,&#xA;&quot;php5-sqlite&quot;,&#xA;&quot;php-pear&quot;,&#xA;&quot;php5-dev&quot;,&#xA;&quot;php5-gd&quot;,&#xA;&quot;php5-curl&quot;,&#xA;&quot;php5-mcrypt&quot;,&#xA;&quot;libapache2-mod-php5&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are much appreciated&lt;/p&gt;&#xA;" OwnerUserId="726" LastActivityDate="2014-08-26T22:15:54.143" Title="Craft on Vagrant: Please advise on initial install (Craft can’t connect to the database with the credentials in craft/config/db.php.)" Tags="&lt;config&gt;&lt;install&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2183" PostTypeId="1" AcceptedAnswerId="2317" CreationDate="2014-08-26T18:46:37.557" Score="3" ViewCount="328" Body="&lt;p&gt;if I have a single that is available in English &amp;amp; Spanish, how do you edit the title for the non default language?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-09-03T12:58:25.267" Title="Alternative title, multi lingual single" Tags="&lt;localization&gt;&lt;titles&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2184" PostTypeId="1" CreationDate="2014-08-26T20:33:49.637" Score="5" ViewCount="1474" Body="&lt;p&gt;How can I get the top level ancestor of an entry within a structure? I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rootEntry = null %}&#xA;{% for ancestor in entry.getAncestors() %}&#xA;    {% set rootEntry = ancestor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that only returns the most recent ancestor back and doesn't go all the way up the chain.&lt;/p&gt;&#xA;" OwnerUserId="727" LastActivityDate="2014-08-27T01:21:02.370" Title="Get structure top ancestor" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2185" PostTypeId="1" CreationDate="2014-08-26T21:10:15.967" Score="2" ViewCount="66" Body="&lt;p&gt;I have a plugin that does a little work after a user has been saved in the CP based on the user groups they are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $event-&gt;params['user'] object seems to be partially up to date when the event is handled. The username and general info is the recently entered values, however the groups is not current, it is always what is was before&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2014-08-26T21:10:15.967" Title="users.onSaveUser groups out of sync" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;events&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2015-02-20T01:05:50.397" ContentLicense="CC BY-SA 3.0" />
  <row Id="2186" PostTypeId="2" ParentId="2182" CreationDate="2014-08-26T22:15:54.143" Score="1" Body="&lt;p&gt;Solution found:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I copied again all files to the root folder, changed the very same settings and got it to work - for whatever reason it seems that with the first attempt some files where missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Brad: Thanks for taking the time - the shared infos are of help anyway.&lt;/p&gt;&#xA;" OwnerUserId="726" LastActivityDate="2014-08-26T22:15:54.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2188" PostTypeId="2" ParentId="2184" CreationDate="2014-08-27T01:21:02.370" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getAncestors&quot;&gt;&lt;code&gt;getAncestors()&lt;/code&gt;&lt;/a&gt; gets all entries that are ancestors. Since you're looping through them what rootEntry is set to last time through is the closest ancestor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can avoid the loop and just get the first one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rootEntry = entry.getAncestors().first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2014-08-27T01:21:02.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2189" PostTypeId="2" ParentId="2183" CreationDate="2014-08-27T02:29:39.607" Score="3" Body="&lt;p&gt;Single titles are not translatable in the control panel since &lt;a href=&quot;http://buildwithcraft.com/updates#build2524&quot; rel=&quot;nofollow&quot;&gt;Craft version 2&lt;/a&gt;, they need to be set in your &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;translations file&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2014-08-27T05:40:29.063" LastActivityDate="2014-08-27T05:40:29.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2190" PostTypeId="2" ParentId="2141" CreationDate="2014-08-27T06:42:06.227" Score="0" Body="&lt;p&gt;Okay, I found the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was the caching. I cleared the cache in the cp and emptied the &lt;code&gt;craft_assettransformindex&lt;/code&gt; table&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deploied the site to my live server but had the image folder on svnIgnore, so craft tought the images would still be there and didn't try to recreate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://craftcms.stackexchange.com/questions/117/is-there-a-way-to-force-assets-to-redo-transforms&quot;&gt;answer&lt;/a&gt; helps.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-27T06:42:06.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2191" PostTypeId="1" AcceptedAnswerId="2192" CreationDate="2014-08-27T08:11:56.273" Score="2" ViewCount="635" Body="&lt;p&gt;I'm using the localisation feature for the first time, and I'm not sure if I understand its rationale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a site with entries that have multiple fields, I only have the main body text set up for translation. If I switch to the secondary language in the control panel, all fields are displayed and pre-populated with the contents of the main language (but according to my understanding, they're just pointers and not duplicated in the database). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why are the non-translateable fields not set to disabled, marked up otherwise, or even hidden completely? Is there a way to do so?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(My concern is that my client can't identify which fields need to be translated, and hereby overwrites a non-translateable field with the secondary language.) &lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2014-09-03T08:51:10.463" Title="How to only show translated fields in an additional locale?" Tags="&lt;localization&gt;&lt;control-panel&gt;&lt;field&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2192" PostTypeId="2" ParentId="2191" CreationDate="2014-08-27T09:06:31.313" Score="2" Body="&lt;p&gt;The fields that are not marked for translation are duplicated and synced between the different locales. So if you make a change in one locale, it will change it in all. This is different from saying that they are only available in one locale, which isn't possible in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing/disabling them in &quot;secondary languages&quot; isn't possible, and doesn't make sense since there is no &quot;primary&quot; or &quot;secondary&quot; languages in Craft. You can choose to publish an entry in only your &quot;secondary language&quot; if you want, and when doing so you'd probably want all fields to be editable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I see your point, and I've had this dilemma myself. What I did was put the fields that weren't translatable in a separate tab (you could of course do it the opposite way, put the fields that are translatable in a separate tab). That made sense for my client, at least, but I guess it really depends on your project. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="37" LastEditDate="2014-09-02T05:22:05.100" LastActivityDate="2014-09-02T05:22:05.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2193" PostTypeId="2" ParentId="1769" CreationDate="2014-08-27T10:00:41.810" Score="-1" Body="&lt;p&gt;You can run phpunit with --stderr to redirect the phpunit output to stderr.&lt;/p&gt;&#xA;" OwnerUserId="732" LastActivityDate="2014-08-27T10:00:41.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2194" PostTypeId="2" ParentId="2183" CreationDate="2014-08-27T10:18:14.460" Score="0" Body="&lt;p&gt;A single's &lt;code&gt;entry.title&lt;/code&gt; isn't displayed in the entries section of the Control Panel anyways, so (currently) there's no way to edit it even for the primary locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the title to be user-editable, what about adding an additional field &lt;code&gt;entry.singleTitle&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case this is a one time config (done by the admin), you could use the &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;translation&lt;/code&gt;&lt;/a&gt; filter like @PatrickNesbitt &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;mentioned&lt;/a&gt; or edit the title for all your locales in the &lt;code&gt;craft_content&lt;/code&gt; table in the DB.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-27T10:18:14.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2195" PostTypeId="1" AcceptedAnswerId="2200" CreationDate="2014-08-27T12:10:01.967" Score="1" ViewCount="167" Body="&lt;p&gt;Is there a way to generate a form based on my record-attributes ? Like a quick and dirty CRUD-Interface to get started ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And otherwise: where would I create such forms ? Are those Controllers ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="125" LastEditDate="2014-08-27T12:40:13.650" LastActivityDate="2014-08-27T15:53:57.157" Title="Plugin: Fill Record with data (auto generated form)" Tags="&lt;plugin-development&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2196" PostTypeId="1" AcceptedAnswerId="2197" CreationDate="2014-08-27T13:13:20.597" Score="1" ViewCount="739" Body="&lt;p&gt;I am looking for a way to exclude certain pages from the navigation. I know it must be quite easy, but nothing seems to work for me at the moment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've setup a lightswitch field &quot;exclude from navigation&quot; (cf_hideFromNav)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is that I want the navigation to start only from a certain slug: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topEntry = craft.entries.section('pages').depth(1).slug('club').first() %}&#xA;{% set descendants = topEntry.getDescendants()  %}              &#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav entry in descendants %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ entry.title }} &#xA;            {% ifchildren %}&amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;{% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how could I incorporate the cf_hideFromNav in this equation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help appreciated!&lt;br&gt;&#xA;cheers&lt;br&gt;&#xA;stefan&lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2014-08-27T13:48:31.577" Title="How to exclude a page from the navigation tree" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2197" PostTypeId="2" ParentId="2196" CreationDate="2014-08-27T13:27:01.963" Score="2" Body="&lt;p&gt;Use a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#descendantOf&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;descendantOf&lt;/code&gt;&lt;/a&gt; parameter with a new ElementCriteriaModel instead of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getDescendants&lt;/code&gt;&lt;/a&gt; method on your entry model and you can add additional parameters. In your case add &lt;code&gt;cf_hideFromNav&lt;/code&gt; as a parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topEntry = craft.entries.section('pages').slug('club').first() %}&#xA;{% set navItems = craft.entries.section('pages').descendantOf(topEntry).cf_hideFromNav('0') %}&#xA;&#xA;{% nav navItem in navItems %}&#xA;    ...&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use the parameters &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#id&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;id&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#slug&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slug&lt;/code&gt;&lt;/a&gt; to exclude certain entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topEntry = craft.entries.section('pages').slug('club').first() %}&#xA;{% set navItems = craft.entries.section('pages').descendantOf(topEntry).id('and, not 23, not 40, not 12') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#descendantOf&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;descendantOf&lt;/code&gt;&lt;/a&gt; parameter also takes IDs. This would allow you to do this all with just a single ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navItems = craft.entries.section('pages').descendantOf('1').id('and, not 23, not 40, not 12') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-27T13:48:31.577" LastActivityDate="2014-08-27T13:48:31.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2198" PostTypeId="1" CreationDate="2014-08-27T13:30:53.567" Score="10" ViewCount="1897" Body="&lt;p&gt;Is it possible to exclude some fields when using search?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the q parameter from the URL and searching the products section including all fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set results = craft.entries.section('products').search(query) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This searches all fields, included those for &quot;related articles&quot; and &quot;related products&quot;. I need to exclude those from the search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some experiments&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works to exclude hits in relatedProducts but limits the fields being searched to the productName field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('products').search('productName:'~ query ~' -relatedProducts:'~ query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does not work - also returns the product with a related product matching the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('products').search(query ~' -relatedProducts:'~ query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the same when trying to include several fields before excluding relatedProducts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('products').search('productName:'~ query ~' OR productDescription:'~ query ~' -relatedProducts:'~ query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also tried searching just in the relatedProducts, confirming that it returns only the product with a related entry matching the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('products').search('relatedProducts:'~ query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="293" LastActivityDate="2016-02-10T17:07:34.703" Title="Excluding fields in a search" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2199" PostTypeId="2" ParentId="2198" CreationDate="2014-08-27T13:59:42.973" Score="4" Body="&lt;p&gt;What about including only those fields you want to search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('products').search('productName:'~ query ~' OR productDescription:'~ query ~' OR productFoo:'~ query ~' OR productBar:'~ query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yep I know, it's not very nice (but hey, it was you who started listing them). What you could do to make this ugly thing of a search parameter more manageable is to add the conditions programmatically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchFields = [&#xA;    'productName',&#xA;    'productDescription',&#xA;    'productFoo',&#xA;    'productBar',&#xA;] %}&#xA;&#xA;{% set searchParam %}&#xA;&#xA;    {% for searchField in searchFields %}&#xA;        {{- not loop.first ? 'OR' -}}&#xA;        {{- searchField ~ ':' ~ query -}}&#xA;    {% endfor %}&#xA;&#xA;{% endset %}&#xA;&#xA;{% set results = craft.entries.section('products').search(searchParam|trim) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-03T09:33:22.953" LastActivityDate="2014-09-03T09:33:22.953" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2200" PostTypeId="2" ParentId="2195" CreationDate="2014-08-27T15:53:57.157" Score="0" Body="&lt;p&gt;I believe what you're asking is if there is any built-in &lt;a href=&quot;https://en.wikipedia.org/wiki/Scaffold_(programming)&quot; rel=&quot;nofollow&quot;&gt;scaffolding&lt;/a&gt; support in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, then no... you'd have to manually build out the forms and CRUD support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;nofollow&quot;&gt;Yii&lt;/a&gt; does ship with a component called &lt;a href=&quot;http://www.yiiframework.com/doc/blog/1.1/en/prototype.scaffold#installing-gii&quot; rel=&quot;nofollow&quot;&gt;gii&lt;/a&gt; that enables scaffolding, but it's currently not compatible with Craft and we don't support it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-27T15:53:57.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2201" PostTypeId="1" CreationDate="2014-08-27T19:09:38.217" Score="5" ViewCount="1171" Body="&lt;p&gt;I saw this thread &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1087/check-user-is-in-user-group-custom-user-permissions&quot;&gt;Check user is in User Group / Custom User Permissions&lt;/a&gt; had an idea. Can I use USER group to limit who can see the Author dropdown on the entries form? Is this even permitted the craft license. I really need to remove that field from view of two user groups. Also would be nice to be able to limit which fields a user has access to when creating an entry. &lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-05-26T16:17:15.903" Title="Restricting access to fields based on user group" Tags="&lt;field&gt;&lt;entry&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2202" PostTypeId="1" CreationDate="2014-08-27T20:11:35.780" Score="1" ViewCount="247" Body="&lt;p&gt;I have both Redactor Clips and Redactor Styles plugins installed, but neither seem to affect my rich text editor (i.e., i don't see any extra buttons). Are there known issues? &lt;/p&gt;&#xA;" OwnerUserId="412" LastActivityDate="2014-12-16T20:12:34.347" Title="RedactorClips and RedactorStyles plugins not working" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2203" PostTypeId="2" ParentId="2202" CreationDate="2014-08-27T21:43:48.167" Score="1" Body="&lt;p&gt;Did you &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/#set-buttons&quot; rel=&quot;nofollow&quot;&gt;add the buttons&lt;/a&gt; to your toolbar by editing or adding a config file:&lt;br&gt;&#xA;&lt;code&gt;/craft/config/redactor/my_custom_toolbar.json&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can configure multiple redactor setting files and apply them individually to your rich text fields from the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/#set-buttons&quot; rel=&quot;nofollow&quot;&gt;field settings&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-27T21:43:48.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2204" PostTypeId="1" CreationDate="2014-08-28T11:44:44.297" Score="4" ViewCount="1178" Body="&lt;p&gt;I'm trying to find any documentation on the usable forms from  &lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&lt;/code&gt;&lt;br&gt;&#xA;so for example I have no idea what the difference is between &lt;code&gt;elementSelect&lt;/code&gt; and &lt;code&gt;select&lt;/code&gt; or how I get the options in there&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2015-07-27T23:41:42.573" Title="_includes/forms documentation on field types" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;documentation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2205" PostTypeId="1" AcceptedAnswerId="2206" CreationDate="2014-08-28T12:04:40.947" Score="5" ViewCount="1199" Body="&lt;p&gt;I have a registration form on my website. All of the fields here so far have been text, which is no problem. However, I've just been asked to create a dropdown box for users to select their salutation (mr, mrs, doctor etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created the field in the backend and linked it to Users, and I can update it through a front-end form no problem using the value=&quot;users/saveUser&quot; method, and pulling the values using currentUser.salutation.options. However, when registering, I can't output the values like that as the user isn't signed in (because they're registering), so there is no currentUser. I can't use the documentation code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.dropdownFieldHandle.options %}&#xA;    &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as there is no entry, I'm just on a template with a registration form on it. How do I output the dropdown options?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-08-28T13:23:40.927" Title="How do I output a dropdown's values if I'm on a registration form not tied to an entry?" Tags="&lt;users&gt;&lt;field&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2206" PostTypeId="2" ParentId="2205" CreationDate="2014-08-28T13:23:40.927" Score="11" Body="&lt;p&gt;The not so elegant way to do this is to re-use the field somewhere else, where you do have access to (e.g. a global set). But you probably want to avoid this, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do instead is to access the field directly using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.fields&quot;&gt;&lt;code&gt;craft.fields&lt;/code&gt;&lt;/a&gt;. This function returns the FieldModel of your field, containing all of its properties. The FieldModel property you want is &lt;code&gt;attributes.settings&lt;/code&gt;, where you can access your dropdown &lt;code&gt;options&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdownField = craft.fields.getFieldbyHandle('dropdownFieldHandle') %}&#xA;&#xA;{% for option in dropdownField.settings.options %}&#xA;    {{ option.value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-28T13:23:40.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2207" PostTypeId="1" AcceptedAnswerId="2963" CreationDate="2014-08-28T13:35:02.320" Score="3" ViewCount="1172" Body="&lt;p&gt;I'm building a customer portal for work, and we are storing customer-facing files on the site in an Amazon S3 bucket. I currently have it all set up as a Structure section with an Asset field. I query for each entry using its uri, and for Folder Entry Types I pull and output its children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My hope is that I can instead query for Asset folders and files directly, and then add a few fields to Assets (through the usual methods). Querying for files is fine, but I can't see any variables to pull folders. Would I need to write a plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-10-07T10:27:06.047" Title="How do you query for Asset Folders?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2208" PostTypeId="1" AcceptedAnswerId="2228" CreationDate="2014-08-28T14:33:02.003" Score="1" ViewCount="646" Body="&lt;p&gt;I have a plugin where I'd like my CP tab to output two columns just like the entry page.  On the left, would be the body and then there would be a nice dividing gap and then on the right there would be a aside column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to copy the way that the Entry Edit page works but I must be missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending &lt;code&gt;_layouts/cp&lt;/code&gt; wraps everything on the page with the following three divs which don't seem to get output at all on the Entry Edit page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;pane&quot;&amp;gt;&#xA;             ...&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How does the entry page get rid of these divs?  I'm not seeing anything obvious in the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; To be clear, I can create the layout that I want, except for the fact that the layout I want gets wrapped in the above code and makes the gutter disappear and messes up the padding around the two columns on the page.  If I extend the {% extends '_layouts/cp' %} and remove those three divs above, just like the Edit and Entry page seems to do somehow, the page displays just as I want it to.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can't figure out is how the Entry page is getting rid of those three divs. It uses {% extends '_layouts/cp' %} and those divs do not appear on the Edit an Entry page.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-08-28T16:21:33.737" LastActivityDate="2014-08-28T22:49:17.770" Title="How do you create two grid columns like the Entry Edit page within a plugin?" Tags="&lt;plugin-development&gt;&lt;user-interface&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2209" PostTypeId="1" AcceptedAnswerId="2215" CreationDate="2014-08-28T14:37:52.377" Score="2" ViewCount="824" Body="&lt;p&gt;Craft allows users to use whatever template extension they prefer: &lt;code&gt;.html&lt;/code&gt; or &lt;code&gt;.twig&lt;/code&gt; or something custom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can check if a file exists like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IOHelper::fileExists($filePath)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to know which extension we want to be testing for?  By default Craft supports both &lt;code&gt;html&lt;/code&gt; and &lt;code&gt;twig&lt;/code&gt; in the supported extensions config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I have the following which feels a bit clunky:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach (craft()-&amp;gt;config-&amp;gt;get('defaultTemplateExtensions') as $extension) &#xA;{&#xA;    if (IOHelper::fileExists($template . &quot;.&quot; . $extension)) &#xA;    {&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-08-28T16:51:24.503" Title="What is the best way to test if a file exists without knowing which file extension a Craft install is using for templates?" Tags="&lt;plugin-development&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2210" PostTypeId="1" AcceptedAnswerId="2214" CreationDate="2014-08-28T15:02:17.913" Score="6" ViewCount="637" Body="&lt;p&gt;I have a form.  It submits.  It saves.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to pass the newly-created, complete form object back to the 'thank you' page template so that I can display the values that were submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not want to pass the ID or any identifiable information in the URL.  Ideally, I'd like behavior just like using &lt;code&gt;setRouteVariables&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'form' =&amp;gt; $form&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, &lt;code&gt;setRouteVariables&lt;/code&gt; does not work when using &lt;code&gt;$this-&amp;gt;redirect()&lt;/code&gt; or &lt;code&gt;$this-&amp;gt;redirectToPostedUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can successfully pass query string parameters back using the &lt;code&gt;redirect&lt;/code&gt; method in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;redirect(array($redirectUrl,'dog'=&amp;gt;'cat'), true); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do this with posted variables that are not visible to the user?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-08-28T16:47:04.257" Title="Is it possible to setRouteVariables when redirecting after a successful form submission?" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2211" PostTypeId="2" ParentId="2208" CreationDate="2014-08-28T15:37:05.223" Score="0" Body="&lt;p&gt;Hey Ben if you are using &lt;code&gt;{% extends '_layouts/cp' %}&lt;/code&gt; how about something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sidebar %}&#xA;     &amp;lt;div class=&quot;buttons&quot;&amp;gt;&#xA;           &amp;lt;a href=&quot;{{ url('') }}&quot;&amp;gt;&amp;lt;div class=&quot;btn submit add icon&quot;&amp;gt;New Button&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-28T15:37:05.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2212" PostTypeId="2" ParentId="2167" CreationDate="2014-08-28T15:44:34.507" Score="0" Body="&lt;p&gt;I probably wouldn't do so many channels and entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To style your articles differently (header images etc.) you could for example register different user groups and conditionally load assets or css styles base on the user who published the article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider to replace your entry types with categories. Entry types actually don't make that much sense, if the html structure of the templates is essentially the same. Instead I'd try to build one universal template using matrix that'd go well with all of your articles.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-28T15:44:34.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2213" PostTypeId="2" ParentId="2202" CreationDate="2014-08-28T16:13:37.033" Score="0" Body="&lt;p&gt;I just figure it out. I had to add entries to the 'plugins' setting in the redactor tool bar json:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plugins: ['fullscreen', 'clips', 'styles']&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now they're showing up&lt;/p&gt;&#xA;&#xA;&lt;p&gt;joe&lt;/p&gt;&#xA;" OwnerUserId="412" LastActivityDate="2014-08-28T16:13:37.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2214" PostTypeId="2" ParentId="2210" CreationDate="2014-08-28T16:47:04.257" Score="4" Body="&lt;p&gt;Other than the query string, you're options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Save it to a cookie and retrieve it from the next page with something like this &lt;a href=&quot;http://straightupcraft.com/craft-plugins/lj-cookies&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Save it to &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/cache/FileCache&quot; rel=&quot;nofollow&quot;&gt;cache&lt;/a&gt; (craft()-&gt;cache).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Save it to PHP's $_SESSION, which Craft wraps with &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpSessionService&quot; rel=&quot;nofollow&quot;&gt;HttpSessionService&lt;/a&gt; (craft()-&gt;httpSession).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Writing a plugin with a Twig function that wraps Craft's &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash()&lt;/code&gt; method, which will store a key-&gt;value pair in session for exactly one request. You can retrieve the value via &lt;code&gt;craft.userSession.getFlash()&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that there are limitations to the size and complexity of the data you can pass along with all of these and in almost all cases, the data needs to be serializable.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-28T16:47:04.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2215" PostTypeId="2" ParentId="2209" CreationDate="2014-08-28T16:51:24.503" Score="2" Body="&lt;p&gt;That's exactly how I'd do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't make much sense, but there's nothing stopping a user from having both extensions for a template like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/index.html&#xA;/index.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your existing code would cover both cases.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-28T16:51:24.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2216" PostTypeId="2" ParentId="2204" CreationDate="2014-08-28T16:54:53.190" Score="1" Body="&lt;p&gt;There currently is no documentation for Craft's own template includes and macros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to do a global search through the app folder and see how Craft is using them internally.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-28T16:54:53.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2217" PostTypeId="1" AcceptedAnswerId="2220" CreationDate="2014-08-28T17:04:18.973" Score="2" ViewCount="171" Body="&lt;p&gt;I have a top level page that needs the URL of &quot;/login/&quot;. It has nothing to do with an actual Craft login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a logged-in session, that url redirects me to the dashboard (via &lt;code&gt;UsersController-&amp;gt;actionLogin&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm logged out, the page renders fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought setting &lt;code&gt;craft.config.loginPath&lt;/code&gt; to something other than &lt;code&gt;&quot;login&quot;&lt;/code&gt; would fix it, but it didn't seem to have an effect.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-09-02T18:58:50.153" Title="Prevent redirecting to the control panel from a URI of &quot;/login&quot; when logged in" Tags="&lt;control-panel&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2219" PostTypeId="1" CreationDate="2014-08-28T17:25:08.687" Score="1" ViewCount="191" Body="&lt;p&gt;I have a record so I can save my data to the DB but do I need a model for services and stuff ? Or can the record do that too ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2014-08-28T19:03:29.783" Title="Do I need a model when I have a record?" Tags="&lt;plugin-development&gt;&lt;records&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2220" PostTypeId="2" ParentId="2217" CreationDate="2014-08-28T17:26:48.880" Score="2" Body="&lt;p&gt;I can confirm this is a bug in the latest build of Craft (2.1.2570).  The fix for this will be in Tuesday's (09/02/2014) release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This bug has been fixed in Craft 2.2. &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/updates#build2579&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2014-09-02T18:58:50.153" LastActivityDate="2014-09-02T18:58:50.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2221" PostTypeId="1" AcceptedAnswerId="2224" CreationDate="2014-08-28T18:57:12.477" Score="3" ViewCount="827" Body="&lt;p&gt;I like to use &lt;code&gt;.twig&lt;/code&gt; for my templates for easy syntax switching, but it doesn't seem to work when my template requires an extension as part of its name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;robots.txt&lt;/code&gt; works fine&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;robots.txt.twig&lt;/code&gt;, doesn't. The matching request is now &lt;code&gt;{siteUrl}/robots.txt.twig&lt;/code&gt;, and I don't get the automatic &lt;code&gt;Content-Type&lt;/code&gt; matching that happens when it is just &lt;code&gt;robots.txt&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I figure this just isn't currently supported, but I would be nice!&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2014-08-28T19:08:53.097" LastActivityDate="2014-09-02T18:57:08.103" Title="Include an extension in your template name, including &quot;.twig&quot; (e.g. robots.txt.twig)" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2222" PostTypeId="2" ParentId="2219" CreationDate="2014-08-28T19:03:29.783" Score="4" Body="&lt;p&gt;Records &lt;em&gt;can&lt;/em&gt; do that too (where that = hold data), but, according to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Craft docs&lt;/a&gt;, Records should never ever leave Service layer. So, yes, you do need a model too.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-08-28T19:03:29.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2223" PostTypeId="2" ParentId="2167" CreationDate="2014-08-28T19:39:22.593" Score="1" Body="&lt;p&gt;I have a channel of index pages, where each entry in the index page channel serves as the index page for some channel. I use &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;ljdynamic fields&lt;/a&gt; and have a 'chanel' field which is a dropdown to select the channel. Description and etc. could be other fields in this index page channel.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-28T19:39:22.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2224" PostTypeId="2" ParentId="2221" CreationDate="2014-08-28T21:40:21.503" Score="2" Body="&lt;p&gt;This is because right now, if your template path includes an extension, Craft assumes that you’re explicitly providing the full template path, and won’t try appending the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#defaultTemplateExtensions&quot; rel=&quot;nofollow&quot;&gt;defaultTemplateExtensions&lt;/a&gt; to it. (See a full explanation &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#findTemplate-detail&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;robots.txt does make a good use case for why we should append those extensions anyway, though. We shall consider it :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We changed this behavior in Craft 2.2, so now a request to /robots.txt could resolve to a template called /robots.txt.twig. &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/updates#build2579&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-02T18:57:08.103" LastActivityDate="2014-09-02T18:57:08.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2226" PostTypeId="1" CreationDate="2014-08-28T21:45:36.440" Score="2" ViewCount="744" Body="&lt;p&gt;I have a group of different regions which would like to have region admins who can't approve content from each other's region but also have a super admin who can approve content from any regions. I will outline below the how this is laid out and would like to know if its possible with Craft.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Super Admin&lt;/strong&gt; (master admin - approval master)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Region 1&lt;/strong&gt; (region admin - approvers)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Location 1 (location admin - drafters)&lt;/li&gt;&#xA;&lt;li&gt;Location 2 (location admin - drafters)&lt;/li&gt;&#xA;&lt;li&gt;Location 3 (location admin - drafters)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Region 2&lt;/strong&gt; (region admin - approvers)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Location 4 (location admin - drafters)&lt;/li&gt;&#xA;&lt;li&gt;Location 5 (location admin - drafters)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Region 3&lt;/strong&gt; (region admin - approvers)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Location 6 (location admin - drafters)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Super Admin&lt;/strong&gt; can approve any item created by location admins and region admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Region Admins&lt;/strong&gt; can approve only content created by location admins within their region only&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Location Admins&lt;/strong&gt; can only create drafts&lt;/p&gt;&#xA;" OwnerUserId="740" LastActivityDate="2014-09-26T21:27:33.983" Title="Craft user group permissions" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2227" PostTypeId="1" AcceptedAnswerId="2229" CreationDate="2014-08-28T21:51:01.547" Score="3" ViewCount="208" Body="&lt;p&gt;I'm working on a site with both english and spanish locales. Crafts localization features have been awesome so far, and I've been embracing Craft's ability to easily localize URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a section on conservation, the english url would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/conservation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the spanish one would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/es/conservación&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I going to run into any technical issues by allowing accented characters in my urls?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-08-28T23:16:30.583" Title="Is there any downside to using localized characters in urls?" Tags="&lt;localization&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2228" PostTypeId="2" ParentId="2208" CreationDate="2014-08-28T22:49:17.770" Score="1" Body="&lt;p&gt;&lt;code&gt;templates/layouts/_cp.html&lt;/code&gt; has &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;pane&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;nested inside the &lt;code&gt;{% block main %}&lt;/code&gt; (line  207) and &lt;code&gt;templates/entries/_edit.html&lt;/code&gt; is overriding that &lt;code&gt;block main&lt;/code&gt;, so those grid,item,pane divs get overridden too.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-08-28T22:49:17.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2229" PostTypeId="2" ParentId="2227" CreationDate="2014-08-28T23:16:30.583" Score="2" Body="&lt;p&gt;There is technically nothing wrong with using them in a URI since they are valid URI characters.  Even multi-byte characters (Chinese, Korean, Japanese, etc.) are valid in the URI (i.e. domain.com/漢字漢字).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some people have requested that they not be allowed in the slug, so for the upcoming 2.2 release, we've added a config setting where you can disable the behavior and multi-byte characters are stripped and high-ASCII characters like ó are swapped with their low-ASCII counterparts (o).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't speak to any other non-technical reasons why they might not want to be used (SEO, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-28T23:16:30.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2230" PostTypeId="2" ParentId="554" CreationDate="2014-08-29T05:17:02.867" Score="7" Body="&lt;p&gt;Another way to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in entries %}&#xA;      {% set active = craft.request.path ~ '/' matches &quot;|^#{entry.uri}/|&quot; %}&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ active ? 'is-active' : '' }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This accounts for even when a navigation item might not be on the top level, but you want every URI that starts with that to trigger the active class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the pipes around the regex are just the encloser. They can be anything, but since we're dealing with URLs, it's easier not to use the standard &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2014-08-29T05:42:38.263" LastActivityDate="2014-08-29T05:42:38.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2232" PostTypeId="1" AcceptedAnswerId="2239" CreationDate="2014-08-29T08:01:38.213" Score="9" ViewCount="1400" Body="&lt;p&gt;Can you create HTML templates using Twig/Craft tags to style the body of the email message sent by the P&amp;amp;T contact form plugin?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-08-29T17:38:56.797" LastActivityDate="2014-08-29T17:38:56.797" Title="P&amp;T Contact Form Plugin: HTML Email Templates" Tags="&lt;plugins&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2233" PostTypeId="2" ParentId="554" CreationDate="2014-08-29T09:07:32.453" Score="6" Body="&lt;p&gt;Here's one more for this nice collection!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I use for a structure &quot;pages&quot; where I needed some way to not only add a class &lt;code&gt;active&lt;/code&gt; to the current entry, but also to all of the entry's ancestors. In an Example URL &lt;code&gt;http://example.com/beers/wheat-beers/&lt;/code&gt; both links &lt;code&gt;beers&lt;/code&gt; and &lt;code&gt;wheat-beers&lt;/code&gt; should be given the &lt;code&gt;active&lt;/code&gt;class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The macro takes the structure entry's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#uri&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;uri&lt;/code&gt;&lt;/a&gt; as one parameter. The other parameter is needed to specify the part of the current URL, the entry's URI gets compared to (→  &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getSegment&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;craft.request.getSegment()&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give this parameter a value based on the entry's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#level&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;level&lt;/code&gt;&lt;/a&gt; within its structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;_macros.html:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro activeLinkClass(linkUri, requestSegmentNumber) %}&#xA;&#xA;    {# Request the relevant path segment in the URL #}&#xA;    {% set nthRequestSegment = craft.request.segment(requestSegmentNumber) %}&#xA;&#xA;    {# Split the link's URI into a list of path segments #}&#xA;    {% set linkSegments = linkUri|split('/') %}&#xA;&#xA;    {# Get the path segment relevant for our comparison #}&#xA;    {% set nthLinkSegment = linkSegments[requestSegmentNumber - 1] %}&#xA;&#xA;    {# Return `active` if the nthLinkSegment equals the nthRequestSegment #}&#xA;    {% if nthLinkSegment == nthRequestSegment %}active{% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;_navigation.html:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros.html' as macros %}&#xA;&#xA;{# Get entries from pages structure (exclude home page)  #}&#xA;{% set pages = craft.entries.section('pages').id('not 1') %}&#xA;&#xA;{# Loop through entries and list the links #}&#xA;{% nav page in pages %}&#xA;&#xA;    {# Add a class `active` if needed, using our macro #}&#xA;    &amp;lt;a href=&quot;{{ page.url }}&quot; class=&quot;nav-link{{ macros.activeLinkClass(page.uri, page.level) }}&quot;&amp;gt;&#xA;        {{ page.title }}&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;    {% ifchildren %}{% children %}{% endifchildren %}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-08-29T10:00:45.757" LastActivityDate="2014-08-29T10:00:45.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2234" PostTypeId="1" AcceptedAnswerId="2242" CreationDate="2014-08-29T10:55:56.557" Score="1" ViewCount="425" Body="&lt;p&gt;I have a site that has a few different countries that speak the same language but want to have them as different Locales. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mexico (english)&lt;/li&gt;&#xA;&lt;li&gt;Mexico (spanish)&lt;/li&gt;&#xA;&lt;li&gt;USA (english)&lt;/li&gt;&#xA;&lt;li&gt;USA (spanish)&lt;/li&gt;&#xA;&lt;li&gt;Peru (english)&lt;/li&gt;&#xA;&lt;li&gt;Peru (spanish)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These might all share some content but the manager of each region might want to change the content for their own region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add in new Locales in the locale list in Craft?&lt;/p&gt;&#xA;" OwnerUserId="740" LastActivityDate="2014-08-29T21:26:11.730" Title="How can I add in new Locales to the locale list?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ClosedDate="2014-09-03T17:55:12.817" ContentLicense="CC BY-SA 3.0" />
  <row Id="2235" PostTypeId="1" AcceptedAnswerId="2237" CreationDate="2014-08-29T13:21:24.900" Score="2" ViewCount="466" Body="&lt;p&gt;I just started using Craft and I'm a little stuck with a public registration form.&#xA;I made a user group and wanted to add these to the saveUser form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1774/how-do-you-set-a-users-group-on-a-registration-form&quot;&gt;this answer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but don't know where to find this code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working in a twig file. Do i have to make my own plugin for that? Or do I have to overwrite something?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userGroups&quot; = &quot;1&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried adding a userGroups hidden input but that didn't work. &lt;/p&gt;&#xA;" OwnerUserId="744" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-08-29T17:32:28.313" Title="Registration Form twig add to an usergroup" Tags="&lt;form&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2236" PostTypeId="1" AcceptedAnswerId="2238" CreationDate="2014-08-29T14:37:32.113" Score="1" ViewCount="406" Body="&lt;p&gt;I set up a single page &quot;Add Post&quot; in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In following the example here &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt; my form title input field is pre-populated with &quot;Add Post&quot; This is obviously not the desired result. When I include an entry id for modifying the post it grabs the title from the post as it should. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create a new post without having a form pre-populated with &quot;Add Post&quot; in the title input field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;    &#xA;    &#xA;    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&#xA;    {%- if entry is defined %} value=&quot;{{ entry.title }}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:59.567" LastActivityDate="2017-10-26T09:27:59.567" Title="`entry` variable pre-populated on a frontend form" Tags="&lt;form&gt;&lt;entry&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2237" PostTypeId="2" ParentId="2235" CreationDate="2014-08-29T15:27:10.980" Score="3" Body="&lt;p&gt;1) You can set the default user group through your admin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D2p2Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Also I'm pretty sure &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userGroups&quot; = &quot;1&quot;&amp;gt;&lt;/code&gt; needs to be set to &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userGroups&quot; value=&quot;1&quot;&amp;gt;&lt;/code&gt; for it to work but I'd need to test to be sure.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-08-29T15:27:10.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2238" PostTypeId="2" ParentId="2236" CreationDate="2014-08-29T15:58:02.130" Score="1" Body="&lt;p&gt;This example code makes use of the &lt;code&gt;entry&lt;/code&gt; variable set by Craft to retrieve previously posted data. The variable is set if you encounter validation errors or if you want to modify upon an already saved entry (→ include the &lt;code&gt;entryId&lt;/code&gt; in a hidden input field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, that you already have an &lt;code&gt;entry&lt;/code&gt; variable available to your template because every entry page comes pre-populated with one (if the &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;URI is matched&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Easiest fix would probably be to make this single entry not match the URI set in the section's CP settings. Another idea would be to only fix that &lt;code&gt;title&lt;/code&gt; problem and modify the example code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %} value=&quot;{{ entry.title }}&quot;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and use this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.errors is defined %} value=&quot;{{ entry.title }}&quot;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:18.950" LastActivityDate="2017-10-26T09:27:18.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2239" PostTypeId="2" ParentId="2232" CreationDate="2014-08-29T16:07:58.667" Score="2" Body="&lt;p&gt;If you mean to build a template for all the e-mail messages, including the ones sent by P&amp;amp;T Contact Form Plugin, then you should at least have Craft Client edition, which supports &lt;em&gt;Custom HTML email templates&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have Client or Pro, you can set an e-mail template in your Email Settings (in the field called HTML Email template).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, you want to change the text sent by the plugin (so the body of your e-mail), I don't think there's a way to do that without altering the plugins code.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-08-29T16:07:58.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2240" PostTypeId="1" AcceptedAnswerId="2241" CreationDate="2014-08-29T16:32:50.513" Score="1" ViewCount="192" Body="&lt;p&gt;So I have a model with an Enum and I want a selectField for that Enum. Is there a DRY way to do that ? And if yes does it work with the translation-filter ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="250" LastEditDate="2014-10-05T15:57:28.437" LastActivityDate="2014-10-05T15:57:28.437" Title="From AttributeType::Enum in Model to a matching selectField?" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2241" PostTypeId="2" ParentId="2240" CreationDate="2014-08-29T17:30:59.130" Score="1" Body="&lt;p&gt;The upcoming Craft 2.2 release added a getConstants() method to the &lt;a href=&quot;http://buildwithcraft.com/classreference/enums/BaseEnum&quot; rel=&quot;nofollow&quot;&gt;BaseEnum&lt;/a&gt; class so you'd be able to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EnumClass::getConstants()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get an array of all of the options in an enum.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-29T17:30:59.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2242" PostTypeId="2" ParentId="2234" CreationDate="2014-08-29T21:26:11.730" Score="2" Body="&lt;p&gt;There are several locales that Yii comes with but Craft doesn't, simply to keep Craft's filesize down a bit (they add a lot of weight). You can see the master list of Yii locales here: &lt;a href=&quot;https://github.com/yiisoft/yii/tree/master/framework/i18n/data&quot; rel=&quot;nofollow&quot;&gt;https://github.com/yiisoft/yii/tree/master/framework/i18n/data&lt;/a&gt;   - If you see a locale in there you want that Craft doesn't come with, just view the raw version of the file on GitHub and then save it to your craft/app/framework/i18n/data/ folder. Then Craft will start supporting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a locale that Yii &lt;em&gt;doesn’t&lt;/em&gt; offer, find the closest locale Yii/Craft does come with, and copy it with a new name (e.g. &lt;code&gt;en_us.php&lt;/code&gt; =&gt; &lt;code&gt;en_mx.php&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-08-29T21:26:11.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2243" PostTypeId="1" AcceptedAnswerId="2247" CreationDate="2014-08-29T21:53:58.033" Score="12" ViewCount="7110" Body="&lt;p&gt;I'm trying to pull a random entry from among an array of sections, but I can't get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the code below, but I'm just getting errors. I've tried multiple ways of listing the sections -- &quot;section&quot;,&quot;section&quot; ['section,section'],etc, but none work. Do I need to specify my sections in a different way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set random = craft.entries.section('quotes,didYouKnow').limit(1).order('RAND()').find() %}&#xA;{% for content in random %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="323" LastActivityDate="2020-05-27T06:03:17.817" Title="How to get one random entry from among multiple sections" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2245" PostTypeId="1" CreationDate="2014-08-30T00:50:40.600" Score="2" ViewCount="482" Body="&lt;p&gt;Currently in the admin panel, all entries per channel appear in a single list. Is it at all possible (at least, by default) to filter/search by type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance a dropdown of all entry types, or just 'type: article' in the search form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is quite easy to do from the front-end, would it require a plugin to add the functionality to the back-end?&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-08-30T03:04:19.493" Title="Searching Content Back-end" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2246" PostTypeId="2" ParentId="2245" CreationDate="2014-08-30T03:04:19.493" Score="1" Body="&lt;p&gt;Indeed: &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anywhere there is a search bar in the control panel, you can use any of the syntaxes listed on that page.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-30T03:04:19.493" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2247" PostTypeId="2" ParentId="2243" CreationDate="2014-08-30T06:38:23.340" Score="22" Body="&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.entries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;According to the docs&lt;/a&gt;, you can &lt;strong&gt;pass an array&lt;/strong&gt; into the &quot;section&quot; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section(['quotes','didYouKnow']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are several ways to get a random entry, but the method you've chosen is a very good one, because it randomizes during the initial SQL call:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;.order('RAND()')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lastly, you can cut out some of the extra legwork from your original example by calling &lt;code&gt;first&lt;/code&gt; instead of &lt;code&gt;find&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.section('mySection').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you retrieve your entry using &lt;code&gt;first&lt;/code&gt;, you'll get a single entry instead of an array of entries. You can skip the &lt;code&gt;for&lt;/code&gt; loop entirely, since you're already dealing with a single entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So to put that all together...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set randomEntry = craft.entries.section(['quotes','didYouKnow']).order('RAND()').first() %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ randomEntry.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2020-05-27T06:03:17.817" LastActivityDate="2020-05-27T06:03:17.817" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2248" PostTypeId="1" CreationDate="2014-08-30T09:49:42.410" Score="2" ViewCount="1567" Body="&lt;p&gt;I'm trying to setup a multi country site running off one Craft install. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;example.com&lt;br /&gt;&#xA;ca.example.com&lt;br /&gt;&#xA;uk.example.com&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each countries content will be translated into five languages (English - en, Spanish - es, French - fr, German - de, Japanese - ja). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;example.com/en&lt;br /&gt;&#xA;example.com/es&lt;br /&gt;&#xA;example.com/fr&lt;br /&gt;&#xA;example.com/de&lt;br /&gt;&#xA;example.com/ja&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ca.example.com/en&lt;br /&gt;&#xA;ca.example.com/es&lt;br /&gt;&#xA;ca.example.com/fr&lt;br /&gt;&#xA;ca.example.com/de&lt;br /&gt;&#xA;ca.example.com/ja&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;uk.example.com/en&lt;br /&gt;&#xA;uk.example.com/es&lt;br /&gt;&#xA;uk.example.com/fr&lt;br /&gt;&#xA;uk.example.com/de&lt;br /&gt;&#xA;uk.example.com/ja&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries will be translated into all five languages. But, entries should also have the ability to display in one or two or all of the countries etc. I understand how the locales (translations) functionality built into Craft can handle the languages but how would the countries be handled at the same time?&lt;/p&gt;&#xA;" OwnerUserId="746" LastActivityDate="2014-08-31T16:07:14.410" Title="Multi-Region &amp; Multi-Language" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;language&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2249" PostTypeId="1" AcceptedAnswerId="2250" CreationDate="2014-08-30T15:12:23.060" Score="3" ViewCount="694" Body="&lt;p&gt;I have a template which displays a table of all the bookings on the website. The booking channel entries consist of two fields: a related user, and a related event, 1:1. There's a drop-down list of all the events at the top of the template which lists all of the events on the site. When a user clicks on an event title, the table updates to only show bookings related to that event (done by applying a class to all rows, and hiding every row which doesn't have the same class as the chosen event slug). The filter code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;event-filter&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;filter&quot;&amp;gt;Filter event: &amp;lt;/label&amp;gt;&#xA;    &amp;lt;select id=&quot;filter&quot; name=&quot;filter&quot;&amp;gt;&#xA;        {% for event in craft.entries.section('event') %}&#xA;        &amp;lt;option value=&quot;i{{event.id}}&quot;&amp;gt;{{event.title}}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bookings table displays all the events using something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bookings = craft.entries.section('booking').order('postDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way for my filter form to list my events, and display the number of bookings for each event? So it would say, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First event (3 bookings)&lt;/li&gt;&#xA;&lt;li&gt;Second event (8 bookings)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm sure it must be possible using relations, but I can't work out the syntax.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-08-30T15:32:54.167" Title="How can I display the number of related entries?" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2250" PostTypeId="2" ParentId="2249" CreationDate="2014-08-30T15:32:54.167" Score="4" Body="&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;event-filter&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;filter&quot;&amp;gt;Filter event: &amp;lt;/label&amp;gt;&#xA;    &amp;lt;select id=&quot;filter&quot; name=&quot;filter&quot;&amp;gt;&#xA;        {% for event in craft.entries.section('event') %}    &#xA;            {% set numEventBookings = craft.entries.section('booking').relatedTo(event).total() %}&#xA;            &amp;lt;option value=&quot;i{{event.id}}&quot;&amp;gt;{{event.title}} ({{numEventBookings}} bookings)&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it'll generate one database query pr event, so it might be a bit inefficient, depending on your setup.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-30T15:32:54.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2251" PostTypeId="2" ParentId="2167" CreationDate="2014-08-30T15:55:15.103" Score="0" Body="&lt;p&gt;Here's an approach I'm testing and so far it seems to be working well. Maybe I can get some feedback on it.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Main Structure Section&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have a Structure craft section, which is used for maintaining all the informational pages of the site, e.g.: about us. This structure has multiple entry types: Pages, Channels, Special. The template for this structure would identify the entry type and include a different template where needed.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Pages&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Hosts regular informational pages with content that is fairly static. Fields include: heading, description, body, tags. It's template would be very straightforward, take content and print it.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Channels&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Hosts information related to channels. Fields include: heading, description, a cover image, tags. It's template would take the cover and description, place it somewhere in the page, and then take the entry slug (which matches its counterpart channel) and bring a list of the entries for that channel.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Special&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;At the moment it's used as a place for holding hardcoded content (it actually just points to a static template based on the path of the url). Special divs and objects. Fields include: heading, description, code area, tags. It's template would also be very straightforward but would take into consideration the code area and output it as code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also looking into a Category Group entry type which, as you may guess, serves as a landing page for category groups. Thus offering a description of the group in question and creating a list of the categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach allows me to arrange and group channels and then makes it easy to output as a nav. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach is making the most sense to me right now but I would love to get some feedback on it.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-08-30T15:55:15.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2252" PostTypeId="2" ParentId="2248" CreationDate="2014-08-30T16:00:53.390" Score="2" Body="&lt;p&gt;I think this is partially related to a question I raised recently, even though my site won't have that many languages per country but some countries will have 2 languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2234/how-can-i-add-in-new-locales-to-the-locale-list/2242#2242&quot; title=&quot;How can I add in new Locales to the locale list?&quot;&gt;How can I add in new Locales to the locale list?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would do something like this in your config&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'example.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            // Global locales&#xA;            'en' =&amp;gt; 'http://example.com/en/',&#xA;            'es' =&amp;gt; 'http://example.com/es/',&#xA;            'fr' =&amp;gt; 'http://example.com/fr/',&#xA;            'de' =&amp;gt; 'http://example.com/de/',&#xA;&#xA;            // Canada locales&#xA;            'ca_en' =&amp;gt; 'http://ca.example.com/en/',&#xA;            'ca_es' =&amp;gt; 'http://ca.example.com/es/',&#xA;            'ca_fr' =&amp;gt; 'http://ca.example.com/fr/',&#xA;            'ca_de' =&amp;gt; 'http://ca.example.com/de/',&#xA;&#xA;            // UK locales&#xA;            'gb_en' =&amp;gt; 'http://uk.example.com/en/',&#xA;            'gb_es' =&amp;gt; 'http://uk.example.com/es/',&#xA;            'gb_fr' =&amp;gt; 'http://uk.example.com/fr/',&#xA;            'gb_de' =&amp;gt; 'http://uk.example.com/de/',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should work, I haven't tested it as yet as my site is still in planning stages and I have not gotten into the development phase as yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edited answer based on comment.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all countries to use the same English, you can set your array to look like below, however this will not allow individual countries to have different English copy since we are pointing them all to the same Locale now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'example.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            // Global locales&#xA;            'en' =&amp;gt; 'http://example.com/en/',&#xA;            'es' =&amp;gt; 'http://example.com/es/',&#xA;            'fr' =&amp;gt; 'http://example.com/fr/',&#xA;            'de' =&amp;gt; 'http://example.com/de/',&#xA;&#xA;            // Canada locales&#xA;            'en' =&amp;gt; 'http://ca.example.com/en/',&#xA;            'ca_es' =&amp;gt; 'http://ca.example.com/es/',&#xA;            'ca_fr' =&amp;gt; 'http://ca.example.com/fr/',&#xA;            'ca_de' =&amp;gt; 'http://ca.example.com/de/',&#xA;&#xA;            // UK locales&#xA;            'en' =&amp;gt; 'http://uk.example.com/en/',&#xA;            'gb_es' =&amp;gt; 'http://uk.example.com/es/',&#xA;            'gb_fr' =&amp;gt; 'http://uk.example.com/fr/',&#xA;            'gb_de' =&amp;gt; 'http://uk.example.com/de/',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="740" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-08-30T20:01:22.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2253" PostTypeId="1" CreationDate="2014-08-31T08:33:16.450" Score="3" ViewCount="1022" Body="&lt;p&gt;Are nested matrices panned for the coming future releases?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a matrix where users can upload various assets. For each asset, they should be able to specify different details but this cannot be achieved with the current features as there is no way in which the details could be related to a particular asset that has just been uploaded.&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-08-31T15:43:10.747" Title="Nested Matrix as field types" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ClosedDate="2014-08-31T21:58:20.970" ContentLicense="CC BY-SA 3.0" />
  <row Id="2254" PostTypeId="2" ParentId="2253" CreationDate="2014-08-31T10:59:56.123" Score="3" Body="&lt;p&gt;I'll let Brandon and Brad answer regarding what's planned. :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, couldn't you solve this by adding fields to your assets? You can make fields of whatever type and add them to the field layout of asset sources. To edit them, you just double-click on the asset in the matrix. This works both for existing assets and newly uploaded assets as far as I can tell.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-31T10:59:56.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2255" PostTypeId="1" AcceptedAnswerId="2312" CreationDate="2014-08-31T13:34:36.980" Score="3" ViewCount="1158" Body="&lt;p&gt;I have a Matrix field with some different block types; images, videos, text, etc. When I loop over the blocks I have some extra code (facebook and twitter sharing, back-button, etc) that should only be output for the last &quot;text&quot; block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I know, inside the loop, if the current block is the last of its type?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-07-27T16:16:09.217" Title="How can I get the last Matrix block of a certain type?" Tags="&lt;matrix&gt;&lt;block-types&gt;&lt;blocks&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2256" PostTypeId="2" ParentId="2255" CreationDate="2014-08-31T13:34:36.980" Score="1" Body="&lt;p&gt;I've come up with this very &quot;manual&quot; approach, which works ok: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastTextBlock = -1 %}&#xA;{% for block in entry.contentBlocks %}&#xA;    {% if block.type=='text' %}&#xA;        {% set lastTextBlock = loop.index0 %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for block in entry.contentBlocks %}&#xA;    {% include '_blocks/' ~ (block.type | lower) with { 'addButtons': loop.index0==lastTextBlock } %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But is there a better way? It feels a bit dirty and inefficient to loop over the blocks two times.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-08-31T13:34:36.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2257" PostTypeId="2" ParentId="2253" CreationDate="2014-08-31T15:43:10.747" Score="1" Body="&lt;p&gt;If you're referring to Matrix within Matrix, then yes, it's on our radar, but we don't have an ETA for it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-31T15:43:10.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2258" PostTypeId="2" ParentId="2248" CreationDate="2014-08-31T16:07:14.410" Score="1" Body="&lt;p&gt;What you could do to enable / disable entries from the Control Panel is to add a &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;lightswitch field&lt;/a&gt; to the entry type and use it as a ElementCriteriaModel parameter. You'd need one custom lightswitch for each country (additionally to the language lightswitches provided by Craft's localization feature).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To filter your elements with the right &quot;country lightswitch&quot; in your templates, you first have to figure out what country / subdomain the page is accessed from. Something you can do by requesting the &lt;code&gt;siteUrl&lt;/code&gt; variable and use Twig filters (e.g. &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt;) to put the string into shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can conditionally filter with the lightswitch relevant for the currently accessed country:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Cut the `siteUrl` string into shape #}&#xA;{% set subDomain = siteUrl|split('/')[2]|split('.')[0] %}&#xA;&#xA;{# Conditionally create the ElementCriteriaModel #}&#xA;{% switch subDomain %}&#xA;&#xA;    {% case 'us' %}&#xA;        {% set entries = craft.entries.section('news').subDomainUS('1') %}&#xA;&#xA;    {% case 'ca' %}&#xA;        {% set entries = craft.entries.section('news').subDomainCA('1') %}&#xA;&#xA;    {% case 'uk' %}&#xA;        {% set entries = craft.entries.section('news').subDomainUK('1') %}&#xA;&#xA;    {# No match found --&amp;gt; global domain #}&#xA;    {% default %}&#xA;        {% set entries = craft.entries.section('news').globalSite('1') %}&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-08-31T16:07:14.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2259" PostTypeId="2" ParentId="2255" CreationDate="2014-08-31T17:15:57.727" Score="2" Body="&lt;p&gt;What about using the &lt;code&gt;length&lt;/code&gt; filter on a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;type filtered&lt;/a&gt; array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow&quot;&gt;block models&lt;/a&gt; to get the total number of your &quot;text&quot; blocks. And then combine that with a counter in your block include to conditionally output the buttons? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;_entry.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastTextBlock = entry.contentBlocks.type('text')|length %}&#xA;{% set loopIndexText = 0 %}&#xA;&#xA;{% for block in entry.contentBlocks %}&#xA;    {% include '_blocks/' ~ block.type|lower %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_blocks/text.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set loopIndexText = loopIndexText + 1 %}&#xA;&#xA;{% if loopIndexText == lastTextBlock %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-03T11:41:57.500" LastActivityDate="2014-09-03T11:41:57.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2260" PostTypeId="1" AcceptedAnswerId="2262" CreationDate="2014-08-31T18:28:00.263" Score="1" ViewCount="930" Body="&lt;p&gt;Anyone here who can provide a working sample of how to create several fields and groups using a plugin? It don't need to be fancy, nothing new, just re use the stuff thats built-in and it need to work somehow so I can extend it from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something to consider if I create for example some profile fields for the Users Group? Or lets say I want a job portal and have field set name &quot;job profile&quot; which contains fields for job description, location, skills, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel a bit ashamed asking for such a comprehensive &quot;task&quot; but as I am not really a developer a lot things I am doing is hoping my try &amp;amp; error attempts succeed (sometime). Having said that, I am a real pro in destroying any environment to the ground and finding bugs but I am also very experienced in installing and configuring servers and apps - guess why this is...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the reason why I need to be able to create my playground as fast as possible and no, I don't want to copy/paste files, I want to learn extending the system.&lt;/p&gt;&#xA;" OwnerUserId="726" LastActivityDate="2014-08-31T21:03:14.623" Title="Creating fields programmatically / with PlugIn" Tags="&lt;plugin-development&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2261" PostTypeId="1" AcceptedAnswerId="2333" CreationDate="2014-08-31T19:38:23.943" Score="1" ViewCount="774" Body="&lt;p&gt;I have a client that has a need for adding users without knowing their e-mail beforehand. Their wish is that when the user login for the first time, they are prompted to enter their e-mail, which also needs to be verified as normally by sending a activate link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps something hooked into the users.onBeforeSaveUser event?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-03T17:02:16.663" Title="Create users without providing e-mail" Tags="&lt;users&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2262" PostTypeId="2" ParentId="2260" CreationDate="2014-08-31T21:03:14.623" Score="3" Body="&lt;p&gt;You can look at Craft's own &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/InstallController&quot; rel=&quot;nofollow&quot;&gt;InstallController&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/services/InstallService&quot; rel=&quot;nofollow&quot;&gt;InstallService&lt;/a&gt; to see how Craft programmatically creates the default content you see during a fresh install.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-08-31T21:03:14.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2263" PostTypeId="1" AcceptedAnswerId="12480" CreationDate="2014-08-31T23:33:44.240" Score="3" ViewCount="1955" Body="&lt;p&gt;Has anyone successfully minified Craft's HTML templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Had setup a Grunt task but it had parse issues with the twig template tags. I since found that the Grunt task &quot;HTMLmin&quot; is only for the purposes of minifying &quot;vanilla&quot; HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or direction is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="749" LastActivityDate="2015-11-21T10:01:44.907" Title="Minifying Craft HTML templates" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2264" PostTypeId="1" AcceptedAnswerId="2288" CreationDate="2014-09-01T00:57:33.287" Score="2" ViewCount="338" Body="&lt;p&gt;I am Craft newbie, and am trying to use PayPal express checkout but am stuck on a confirmation route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I register a route like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;localhost:8888/app/confirm?token=EC-5UA33446UB5625646&amp;amp;PayerID=8RB74GZ8ASWGQ &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I have done so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Registered route confirm on the plugin but when PayPal adds the token and payerId, Craft doesn't understand the route anymore.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'app/confirm' =&amp;gt; array('action' =&amp;gt; 'app/confirm')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2014-09-02T04:02:39.757" LastActivityDate="2014-09-02T05:06:09.287" Title="Craft routing with extra attributes" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2265" PostTypeId="1" AcceptedAnswerId="2267" CreationDate="2014-09-01T01:36:28.723" Score="2" ViewCount="889" Body="&lt;p&gt;Does anyone know, if craft gets support for MongoDB in the near future? Or is any solution out there for using MongoDB? This would be awesome. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards&#xA;Ron&lt;/p&gt;&#xA;" OwnerUserId="751" LastActivityDate="2016-03-10T23:15:19.250" Title="Any support for MongoDB?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2266" PostTypeId="2" ParentId="2263" CreationDate="2014-09-01T02:04:36.673" Score="6" Body="&lt;p&gt;There are &lt;a href=&quot;https://github.com/johndwells/craft.minimee&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;http://straightupcraft.com/craft-plugins/compressor&quot;&gt;plugins&lt;/a&gt; that will &lt;a href=&quot;http://straightupcraft.com/craft-plugins/automin&quot;&gt;minify/compress&lt;/a&gt; CSS/JS for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for HTML, maybe you're better off just &lt;a href=&quot;http://www.feedthebot.com/pagespeed/enable-compression.html&quot;&gt;enabling gzip compression&lt;/a&gt; on your web server for all output.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-01T02:04:36.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2267" PostTypeId="2" ParentId="2265" CreationDate="2014-09-01T02:12:18.057" Score="2" Body="&lt;p&gt;Not in the near, probably not in the long and a pretty slim chance in the very long-term future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll add support for additional relational databases (MSSQL, SQLite PostgreSQL, Oracle) long before a NoSQL solution and they will each bring their own level of additional support and challenges.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-01T02:21:36.090" LastActivityDate="2014-09-01T02:21:36.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2268" PostTypeId="1" AcceptedAnswerId="2269" CreationDate="2014-09-01T03:07:48.650" Score="2" ViewCount="236" Body="&lt;p&gt;I am displaying a list of users with entries in the Design section using a Route. I am using this code for that and it seems to be working to display the correct users:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set designs = craft.entries.section('designs').find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set entriesByAuthor = designs|group('authorId') %}&#xA;&#xA;{# Grab all of the users with the userIds in entriesByAuthor #}&#xA;{% set designers = craft.users.id(entriesByAuthor|keys).group('members') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although the issues I am having is trying to display data from fields from the entries by these users. For example, entries in the Design section also have images associated with them. I am trying to display the first image from the 'screenshots' field from the Designs section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for assets in designers %}&#xA;    {% for image in assets.screenshots %}&#xA;&#xA;        {% if image %}&#xA;            &amp;lt;a href=&quot;{{ user.userAgencyUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.url }}&quot; border=&quot;0&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endif %}         &#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not give an error, but does not display anything for the image. I also tried adding .first() to this to get the first image from each entry, but that resulted in an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated! I have searched thoroughly for information about displaying entry fields from a user list (instead of just user fields) and I have not been able to find this information. (I also tried several other methods, such as relatedTo.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="504" LastEditorUserId="57" LastEditDate="2014-09-01T14:52:54.140" LastActivityDate="2014-09-01T14:52:54.140" Title="How do I display data from an entry field related to each user in a user listing page?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2269" PostTypeId="2" ParentId="2268" CreationDate="2014-09-01T07:24:29.287" Score="1" Body="&lt;p&gt;You already have the right array of Design Entries &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;grouped&lt;/a&gt; by your Designer's user IDs with this line: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByAuthor = designs|group('authorId') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now all you have to do is to loop through this &lt;code&gt;entriesByAuthor&lt;/code&gt; array. Use this syntax to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#iterating-over-keys-and-values&quot; rel=&quot;nofollow&quot;&gt;iterate over Keys and Values&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for key, value in entriesByAuthor %}&#xA;    {{ key }}: {{ value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within the loop &lt;code&gt;key&lt;/code&gt; is the &lt;code&gt;authorId&lt;/code&gt; you grouped by and &lt;code&gt;value&lt;/code&gt; is an array of EntryModels that share the same value for the &lt;code&gt;authorId&lt;/code&gt; property. To list the Design entries you have to nest another for-loop and iterate over that array of EntryModels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To retrieve other Designer data besides the ID you first need to grab the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt;. Create a new ElementCriteriaModel with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.users&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;authorId&lt;/code&gt; as a parameter&lt;/a&gt; and use the &lt;code&gt;first()&lt;/code&gt; function to get the model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set allDesigns = craft.entries.section('designs').limit(null).find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set allDesignsByAuthor = allDesigns|group('authorId') %}&#xA;&#xA;{# Loop through all Design Entries grouped by the authorId #}&#xA;{% for authorId, designsByAuthor in allDesignsByAuthor %}&#xA;&#xA;    {# Grab the Designer's UserModel #}&#xA;    {% set designer = craft.users.id(authorId).first() %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ designer.name }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {# List the Designer's Design Entries #}&#xA;    {% for design in designsByAuthor %}&#xA;&#xA;        &amp;lt;h3&amp;gt;{{ design.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;        {# List the Screenshots #}&#xA;        {% for image in design.screenshots %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ designer.userAgencyUrl }}&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only now I got it, why you did this line to grab the UserModels with an ID of &lt;code&gt;allDesignsByAuthorId|keys&lt;/code&gt;. This is in fact a good idea if you want list the users in another sort order than the user ID. Because I don't think you can do that with the approach I posted above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you proceed after you fetched the Designers with a sort order of your desire. Loop through the array of Designers and create a new ElementCriteriaModel for each designer to grab the Designs using the Designer's user ID as the value for the &lt;code&gt;authorId&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set allDesigns = craft.entries.section('designs').limit(null).find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set allDesignsByAuthorId = allDesigns|group('authorId') %}&#xA;&#xA;{# Grab all of the users with the userIds in allDesignsByAuthorId #}&#xA;{% set designers = craft.users.id(allDesignsByAuthorId|keys).order('lastName') %}&#xA;&#xA;{# Loop through the array of Designers #}&#xA;{% for designer in designers %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ designer.name }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {# Grab all of the Design Entries created by this Designer #}&#xA;    {% set designs = craft.entries.section('designs').authorId(designer.id).find() %}&#xA;&#xA;    {# List the entries #}&#xA;    {% for design in designs %}&#xA;&#xA;        &amp;lt;h3&amp;gt;{{ design.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;        {# List the Screenshots #}&#xA;        {% for image in design.screenshots %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ designer.userAgencyUrl }}&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2nd Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only need to show one image for each Designer? Do it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set allDesigns = craft.entries.section('designs').limit(null).find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set allDesignsByAuthorId = allDesigns|group('authorId') %}&#xA;&#xA;{# Grab all of the users with the userIds in allDesignsByAuthorId #}&#xA;{% set designers = craft.users.id(allDesignsByAuthorId|keys).order('lastName') %}&#xA;&#xA;{# Loop through the array of Designers #}&#xA;{% for designer in designers %}&#xA;&#xA;    {# Get the total number of Design Entries created by this Designer #}&#xA;    {% set totalDesigns = craft.entries.section('designs').authorId(designer.id).total() %}&#xA;&#xA;    {# Grab the latest Design Entry created by this Designer #}&#xA;    {% set design = craft.entries.section('designs').authorId(designer.id).first() %}&#xA;&#xA;    {# Grab the first screenshot image of that entry #}&#xA;    {% set image = design.screenshots.first() %}&#xA;&#xA;    {# Output #}&#xA;    &amp;lt;h2&amp;gt;{{ designer.name }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;{{ totalDesigns }}&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ designer.userAgencyUrl }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-01T13:20:07.407" LastActivityDate="2014-09-01T13:20:07.407" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2270" PostTypeId="1" AcceptedAnswerId="2273" CreationDate="2014-09-01T09:16:39.010" Score="1" ViewCount="111" Body="&lt;p&gt;All, After we switched from Wordpress to Craft our site description and logo at the very top of the browser tab have been disappeared as shown in the image. Could you please guide me how can I achieve this? &lt;img src=&quot;https://i.stack.imgur.com/fHo1R.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="692" LastActivityDate="2014-09-01T12:16:09.330" Title="Description and logo at the very top of browser?" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2271" PostTypeId="1" CreationDate="2014-09-01T10:26:01.047" Score="1" ViewCount="1246" Body="&lt;p&gt;I have been unable to access my website or log into my CMS. I have checked with the server and everything is OK there but all I am getting is a blank page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I updated craft manually following the instructions given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a staging site which I use for sharing with my client and this all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I need to be checking? What will have stopped the website from working? I would really appreciate any help you can give with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="27" LastEditDate="2015-08-14T14:01:06.583" LastActivityDate="2015-08-23T04:53:42.630" Title="Unable to access login page or my website" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2272" PostTypeId="1" AcceptedAnswerId="2274" CreationDate="2014-09-01T11:45:51.740" Score="2" ViewCount="909" Body="&lt;p&gt;Is there an easy way to check what the current page &lt;strong&gt;section type&lt;/strong&gt; is, within a plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if I'm overlooking a little function that simply returns: &quot;single&quot;, &quot;channel&quot;, &quot;entry&quot;, etc...? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you Aevlan, this was the approach I took originally. I've been struggling to determine wether the user is currently on the root of a channel/structure, or if they are on an entry page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I can determine &quot;single&quot;, &quot;channel&quot; or &quot;structure&quot;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element = craft()-&amp;gt;urlManager-&amp;gt;getMatchedElement();&#xA;$element_exists = $element &amp;amp;&amp;amp; $element-&amp;gt;getElementType() == ElementType::Entry;&#xA;&#xA;$currentPageType = $element-&amp;gt;section-&amp;gt;type;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason I need to know this, is so I can perform some checks before I add certain navigation throughout the site. To help with my specific issue, I will use &quot;hasDescendants()&quot; or check the segment counts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again. Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2014-09-02T11:31:11.363" LastActivityDate="2014-09-02T11:31:11.363" Title="Return the current section type? (plugin)" Tags="&lt;plugin-development&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2273" PostTypeId="2" ParentId="2270" CreationDate="2014-09-01T12:16:09.330" Score="4" Body="&lt;p&gt;&lt;strong&gt;Site title&lt;/strong&gt; - This is set with HTML meta tags and not really anything to do with Craft specifically. It depends how you &quot;switched&quot; from wordpress to Craft. Inside your document head, you need to include a title tag, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;title&amp;gt;Website title goes here&amp;lt;/title&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can set this automatically by doing the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Favicon (logo)&lt;/strong&gt; - Upload your .ico file to the /public_html directory.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-09-01T12:16:09.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2274" PostTypeId="2" ParentId="2272" CreationDate="2014-09-01T12:53:01.237" Score="2" Body="&lt;p&gt;The SectionModel has a type property, which return what you're after, &quot;single&quot;, &quot;channel&quot; and &quot;entry&quot;. In a template it can be accessed like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.section.type }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this is in a plugin and you have the section, you access it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$section-&amp;gt;type&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm confused by the &quot;current page&quot; of your question. Maybe you can describe in a bit more detail what you're trying to achieve, and what your code looks like atm?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-01T12:53:01.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2275" PostTypeId="1" AcceptedAnswerId="2276" CreationDate="2014-09-01T13:00:45.300" Score="9" ViewCount="3228" Body="&lt;p&gt;Sorry if this has been asked before. I've searched for other relatedTo questions but could not find anything similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 sections (each having 1 entry type):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;games&lt;/li&gt;&#xA;&lt;li&gt;reviews&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Games are linked to 1 or more categories using a Categories field.&#xA;Reviews are linked to 1 or more games using an Entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a category page I can list all related games using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({section: 'games'}).relatedTo(category)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do however want to list all games inside a category that have at least 1 review. I tried something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({section: 'games'}).relatedTo(category).relatedTo(craft.entries.section('reviews'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that lists all games having a review regardless of the category. How to solve this?&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2014-09-01T14:57:49.257" Title="How to list entries related to a category + related to a section?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2276" PostTypeId="2" ParentId="2275" CreationDate="2014-09-01T13:31:01.440" Score="8" Body="&lt;p&gt;When you call this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;craft.entries({section: 'games'}).relatedTo(category).relatedTo(craft.entries.section('reviews'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that second &lt;code&gt;relatedTo&lt;/code&gt; param is just overriding the first one. Lucky for you, that parameter does accept multiple criteria (see the “Passing Multiple Relation Criteria” section on &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/relations#the-relatedTo-param&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set games = craft.entries({&#xA;    section: 'games',&#xA;    relatedTo: ['and',&#xA;        category,&#xA;        craft.entries.section('reviews').status(null)&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's a good idea to specify that &lt;code&gt;category&lt;/code&gt; will be a &lt;em&gt;target&lt;/em&gt; element (where the Games entries did the selecting), and that the Reviews will be &lt;em&gt;source&lt;/em&gt; elements (where the Games were selected by the Reviews), as this will slim the DB query down a bit:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set games = craft.entries({&#xA;    section: 'games',&#xA;    relatedTo: ['and',&#xA;        { targetElement: category },&#xA;        { sourceElement: craft.entries.section('reviews').status(null) }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-01T14:57:49.257" LastActivityDate="2014-09-01T14:57:49.257" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2277" PostTypeId="1" AcceptedAnswerId="2279" CreationDate="2014-09-01T16:34:46.183" Score="3" ViewCount="1076" Body="&lt;p&gt;How can I add the functionality for my clients to make text not just bold or italic, but have h2, h3, h4 headings too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6YBuN.png&quot; alt=&quot;Redactor bar&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-09-01T16:46:25.817" LastActivityDate="2014-09-01T16:56:29.367" Title="How can I add headings using the Rich Text field" Tags="&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2278" PostTypeId="2" ParentId="2277" CreationDate="2014-09-01T16:49:54.220" Score="1" Body="&lt;p&gt;I was being thick, as usual. You can add headings using the formatting button, which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NiLuZ.png&quot; alt=&quot;formatting bar&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-09-01T16:49:54.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2279" PostTypeId="2" ParentId="2277" CreationDate="2014-09-01T16:50:01.853" Score="3" Body="&lt;p&gt;You can modify &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow&quot;&gt;Craft's default Redactor configs&lt;/a&gt; stored in craft/config/redactor or add custom config files to this directory. Then select the config of choice for each rich text field individually in the field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use &quot;block styles&quot; in the editor, add the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings&quot; rel=&quot;nofollow&quot;&gt;formatting button&lt;/a&gt; to the toolbar with this config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['formatting', 'bold', 'italic']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also modify the formatting dropdown, if you want to restrict the block styles available to your client:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    formattingTags: ['p', 'h2', 'h3', 'h4']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just noticed that you already have the button in your toolbar, it's the second one from the left :D&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-01T16:55:35.927" LastActivityDate="2014-09-01T16:55:35.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2280" PostTypeId="2" ParentId="2277" CreationDate="2014-09-01T16:56:29.367" Score="1" Body="&lt;p&gt;When you set up a rich text field, you can adjust what options/buttons show up. Looks like you might have &quot;Simple&quot; selected. Choose &quot;Standard&quot; instead for more options or create your own as explained here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/articles/how-to-add-custom-redactor-toolbars-to-the-default-rich-text-field-in-craft-cms&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/articles/how-to-add-custom-redactor-toolbars-to-the-default-rich-text-field-in-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-09-01T16:56:29.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2281" PostTypeId="1" AcceptedAnswerId="2282" CreationDate="2014-09-01T18:38:37.673" Score="2" ViewCount="453" Body="&lt;p&gt;I'm successfully listing user (authors) via search from the url, so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;/author/Tom+Bowler lists data and entries by that name with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set getauth = craft.request.lastSegment %}&#xA;{% for authordetails in craft.users.search(getauth) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but we want to limit that search to 'fullName' (or what is best) ideally, as currently we are listing any authors not just the one that may mention &quot;Tom Bowler&quot; in their bio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At what point, and how is best to filter down to that search?&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-09-01T21:23:54.583" Title="Search, by just one user field - fullName?" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2282" PostTypeId="2" ParentId="2281" CreationDate="2014-09-01T20:08:28.210" Score="2" Body="&lt;p&gt;There's a nice list in the Craft docs with lot of examples for &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;supported search syntaxes&lt;/a&gt;. Here's two that probably do what you are after:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;body:salty&lt;/code&gt; → where the ‘body’ field contains “salty”.&lt;br&gt;&#xA;  &lt;code&gt;body::&quot;salty dog&quot;&lt;/code&gt; → where the ‘body’ field is set to “salty dog” and nothing more.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Combine it with your variable like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.search('fullName::&quot;' ~ getauth ~ '&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-01T20:08:28.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2283" PostTypeId="2" ParentId="2281" CreationDate="2014-09-01T21:23:54.583" Score="1" Body="&lt;p&gt;What about not using the &lt;code&gt;search&lt;/code&gt; parameter at all and use the &lt;code&gt;lastName&lt;/code&gt; and &lt;code&gt;firstName&lt;/code&gt; parameters instead (you wouldn't rely on up-to-date search indexes)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set getauth = 'tom+bowler' %}&#xA;&#xA;{% set fullName = getauth|split('+') %}&#xA;{% set lastName = fullName[1] %}&#xA;{% set firstName = fullName[0] %}&#xA;&#xA;{% for authordetails in craft.users.lastName(lastName).firstName(firstName) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-01T21:23:54.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2284" PostTypeId="1" AcceptedAnswerId="2285" CreationDate="2014-09-01T23:39:56.483" Score="3" ViewCount="187" Body="&lt;p&gt;I have a global that consists of 1 rich text field and the content is displayed on every page. Does it make sense to cache that? If so, I am assuming it should be cached globally?&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2014-09-02T00:04:49.513" Title="Does it make sense to cache a Global?" Tags="&lt;cache&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2285" PostTypeId="2" ParentId="2284" CreationDate="2014-09-02T00:04:49.513" Score="2" Body="&lt;p&gt;It all depends on what your template is doing with the global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's doing something to cause multiple database calls, then yes, you'll probably see some improvement (maybe minuscule, maybe more significant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anywhere you use a cache tags brings an overhead of one additional database call, so you just need to make sure it's worth it. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-02T00:04:49.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2286" PostTypeId="1" AcceptedAnswerId="2296" CreationDate="2014-09-02T00:34:07.067" Score="3" ViewCount="559" Body="&lt;p&gt;I have quotes inside a global matrix which i want to output randomly on the homepage but without the first quote-block. this does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quotes = city.cityBlocks.offset(1) %}&#xA;{% set randomQuotes = quotes.limit(1).order('RAND()') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the offset in 'quotes' works fine but the first block is still in randomQuotes anyway.&lt;/p&gt;&#xA;" OwnerUserId="174" LastEditorUserId="174" LastEditDate="2014-09-02T00:49:06.067" LastActivityDate="2014-09-02T20:50:35.673" Title="Output random blocks from a matrix but without the first" Tags="&lt;matrix&gt;&lt;random&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2287" PostTypeId="1" AcceptedAnswerId="2289" CreationDate="2014-09-02T03:51:45.837" Score="6" ViewCount="518" Body="&lt;p&gt;Consider an employee listing...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 sections: 1 for companies, 1 for personnel.  In the personnel section, there is a matrix field within which one field is a relational one to relate the staff member to his company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front end, I'm attempting to display a listing of all staff associated with a particular company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get the relational fields to work in the way that I want. I know I'm missing something basic here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set employer = craft.entries.section('companies').slug(segment) %}&#xA;{% set personnel = craft.entries.section('people').relatedTo(employer) %}&#xA;&#xA;{% for x in personnel %}&#xA;    {{ x.title }}&#xA;{% endfor %}&#xA;&#xA;// Output: nothing&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something particular to Matrix fields that changes how I might do this?  I've tried using the targetElement parameter but still can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="754" LastActivityDate="2014-10-14T14:08:51.897" Title="How can I display related entries selected within a Matrix field?" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2288" PostTypeId="2" ParentId="2264" CreationDate="2014-09-02T05:06:09.287" Score="4" Body="&lt;p&gt;Craft actually has its own built-in support for tokenized requests, which is activated if there's a &quot;token&quot; param. if that param is set, Craft will refer to the craft_tokens table for instructions in how to route the request, ignoring the normal routing steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The name of that param can be customized using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#tokenParam&quot; rel=&quot;nofollow&quot;&gt;tokenParam&lt;/a&gt; config setting, but you should probably just have PayPal use a different query string param if you can.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-02T05:06:09.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2289" PostTypeId="2" ParentId="2287" CreationDate="2014-09-02T05:15:13.760" Score="7" Body="&lt;p&gt;When you relate an element from a Matrix block, it's important to know that the relation is between the &lt;em&gt;Matrix block&lt;/em&gt; and the related element; nor the &lt;em&gt;entry&lt;/em&gt; (or whatever has the Matrix field) and the related element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the correct way to select related elements through a Matrix field is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set employer = craft.entries.section('companies').slug(segment) %}&#xA;{% set personnel = craft.entries.section('people').relatedTo({&#xA;    targetElement: employer,&#xA;    field: &quot;matrixField.relationField&quot;&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update: Added a missing } on the last line.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="293" LastEditDate="2014-10-14T14:08:51.897" LastActivityDate="2014-10-14T14:08:51.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2290" PostTypeId="1" AcceptedAnswerId="2291" CreationDate="2014-09-02T11:44:49.337" Score="1" ViewCount="283" Body="&lt;p&gt;I have a section with a &quot;Structure&quot; section type. I've called it &quot;structure_casestudies&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to create a navigation bar that links to that page, but only if there is at least one entry within it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;hasDescendants() or similar EntryModel functions work fine, for structure pages only. But how can I perform the same check, from anywhere on the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hoped doing a specific query would do the trick... but this just isn't right.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('structure_casestudies').hasDescendants() %}&amp;lt;a href=&quot;#&quot;&amp;gt;Case Studies&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-09-02T16:26:42.507" Title="How to check structure type has any entries/children from anywhere on my site?" Tags="&lt;entrymodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2291" PostTypeId="2" ParentId="2290" CreationDate="2014-09-02T12:18:03.157" Score="2" Body="&lt;p&gt;To do a check if a structure has content you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set structureNav = craft.entries({ section : 'structure_casestudies' }).first() %}&#xA;&#xA;{% if structureNav != &quot;&quot; %}&#xA;    I exist.&#xA;{% else %}&#xA;    I don't exist.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="696" LastEditorUserId="57" LastEditDate="2014-09-02T15:04:59.747" LastActivityDate="2014-09-02T15:04:59.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2292" PostTypeId="1" AcceptedAnswerId="2798" CreationDate="2014-09-02T12:31:16.637" Score="5" ViewCount="380" Body="&lt;p&gt;Has anyone successfully run craft on an HHVM server?  I tried it using &lt;a href=&quot;http://forge.laravel.com&quot; rel=&quot;nofollow&quot;&gt;Forge&lt;/a&gt;, I got a page loading, but no admin and no subpages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;http://hhvm.com/frameworks/&quot; rel=&quot;nofollow&quot;&gt;HHVM Frameworks page&lt;/a&gt;, it has 99.7 percent compatibility with yii and 100% compatible with twig? I guess that last 0.3% is a doozy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to hear if anyone else had had more success with it?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="6007" LastEditDate="2018-07-25T02:14:19.210" LastActivityDate="2019-12-23T04:02:07.217" Title="Get Craft working on HHVM?" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2293" PostTypeId="2" ParentId="2290" CreationDate="2014-09-02T16:26:42.507" Score="0" Body="&lt;p&gt;I like to keep a neat collection of useful functions, so I've just 'converted' the above, with a php based plugin function.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function hasChildren($section) {&#xA; $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA; $criteria-&amp;gt;section = $section;&#xA; return $criteria-&amp;gt;count();&#xA;}&#xA;&#xA;echo $this-&amp;gt;hasChildren('structure_services') ? &quot;I Exist.&quot; : &quot;I Don't exist.&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-09-02T16:26:42.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2294" PostTypeId="2" ParentId="923" CreationDate="2014-09-02T19:43:09.187" Score="3" Body="&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2&lt;/a&gt;, Craft will now only add the logs to the response if the Content-Type header is going to be &quot;text/html&quot; or &quot;application/xhtml+xml&quot;. Should solve this for you.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-02T19:43:09.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2295" PostTypeId="2" ParentId="2286" CreationDate="2014-09-02T20:36:25.837" Score="2" Body="&lt;p&gt;okay, shuffle seems to work:&#xA;first set these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quotes = city.cityBlocks.offset(1) %}&#xA;{% set randomQuotes = shuffle(quotes) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then slice the the for loop like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in randomQuotes|slice(1,1) %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="174" LastActivityDate="2014-09-02T20:36:25.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2296" PostTypeId="2" ParentId="2286" CreationDate="2014-09-02T20:50:35.673" Score="3" Body="&lt;p&gt;That query would basically tell MySQL to do this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Shuffle the blocks&lt;/li&gt;&#xA;&lt;li&gt;Return the second one&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Since the shuffling happens &lt;em&gt;before&lt;/em&gt; the offset/limit params get applied, they can’t be used to exclude the first block, since the first block will already be put in some random position by that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you should get the ID of the first block, and exclude it using that:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set firstBlockId = city.cityBlocks.limit(1).ids()|first %}&#xA;&#xA;{% if firstBlockId %}&#xA;    {% set randomQuotes = city.cityBlocks.id('not '~firstBlockId).order('RAND()') %}&#xA;    ...&#xA;{% else %}&#xA;    There were no blocks...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-02T20:50:35.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2297" PostTypeId="1" AcceptedAnswerId="2298" CreationDate="2014-09-02T21:54:17.107" Score="2" ViewCount="586" Body="&lt;p&gt;I am using the registration form from the docs here - &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt; - in the front end of my site. Unfortunately, when I click on &quot;Register&quot; the page just refreshes and no errors are displayed, and the user is not created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Allow Public Registration?&quot; is checked in the CP.&lt;/li&gt;&#xA;&lt;li&gt;I made sure that the Snaptcha plugin was disabled (just in case).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I should look for? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/success/&quot;&amp;gt;&#xA;&#xA;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('username')) }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('email')) }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('password')) }}&#xA;{% endif %}&#xA;&#xA;  &amp;lt;div class=&quot;divider&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot; class=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="504" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:43.307" LastActivityDate="2017-10-26T09:27:43.307" Title="Front-end Registration Form just refreshes with no error displayed and user not created" Tags="&lt;registration&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2298" PostTypeId="2" ParentId="2297" CreationDate="2014-09-02T23:27:19.467" Score="3" Body="&lt;p&gt;Solved the mystery. :) The issue was that even though my user fields were not required, there was a numeric 'year' field which had min and max values set, and this was throwing it off (and I had removed that field during my last round of testing to keep things simple). Removing those required min and max values allowed the form to be submitted. Thanks for the help Brad!&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-09-02T23:27:19.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2299" PostTypeId="1" CreationDate="2014-09-03T01:07:05.627" Score="1" ViewCount="942" Body="&lt;p&gt;I am adding new users in Craft Pro, I don't get a chance to specify password, seems its is auto generated but I don't get any email sent to the user I just created. Is there any setting I have missed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have setup Gmail in settings &gt;&gt; Email &gt;&gt; Protocol and tested and received test email but doesn't send email when a new user is added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.﻿&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-10-27T05:53:45.960" Title="Craft Pro Adding Users no email is sent" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2300" PostTypeId="2" ParentId="2299" CreationDate="2014-09-03T02:42:58.483" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't get a chance to specify password, seems its is auto generated but I don't get any email sent to the user I just created.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From the CP, you can't create a password for a user.  They'll receive an email, in which they can click on an activation link and they can set their own password by following the workflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is extra logic in registering a new user from the CP that will detect if Craft can create the user, but not send the email, and the CP will notify you if that is the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like maybe the email is being sent, but caught up in a SPAM filter somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check through your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files to see if any [error] or [warning] entries are getting logged.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-03T02:42:58.483" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2301" PostTypeId="1" AcceptedAnswerId="2306" CreationDate="2014-09-03T04:35:05.123" Score="2" ViewCount="994" Body="&lt;p&gt;I'm about to start building out a site that requires a booking system to be setup within it. The site owner should be able to set availability (days and times with time-frames) and allow the visitors to book/reserve available services within the available time-frames and make a payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how one might go about this? I know the request is pretty vague, just looking for some broad strokes to help me kick off in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2014-09-03T07:59:37.010" Title="Booking/Reservation system" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2302" PostTypeId="1" AcceptedAnswerId="2303" CreationDate="2014-09-03T05:33:59.890" Score="2" ViewCount="224" Body="&lt;p&gt;I wonder what structures are since everybody writes about it here. But I can only finde one tiny sentence in the official docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;«Used when entries do have an inherent relationship with each other,&#xA;  unlike Channels. They are both sortable and hierarchical.»&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there somewhere a bit more of a real world explenation/example on when/why/how to use this «structure» thing?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-09-03T05:37:57.060" Title="What are «Structures»?" Tags="&lt;structure&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2303" PostTypeId="2" ParentId="2302" CreationDate="2014-09-03T05:37:57.060" Score="6" Body="&lt;p&gt;A structure is a section that allows for a 'tree' like layout with hierarchy. A good example of where Structures might be used for instance is the Craft documentation pages, or building a navigation using a section.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2014-09-03T05:37:57.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2304" PostTypeId="1" AcceptedAnswerId="2305" CreationDate="2014-09-03T06:53:53.473" Score="3" ViewCount="1062" Body="&lt;p&gt;I am trying to pass an array on template render like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&lt;code&gt;&#xA;public function actionConfirm()&#xA;{&#xA;   $variables['confirm'] = array(&#xA;      'name'   =&gt; 'Silvanus',&#xA;      'office' =&gt; 'OOTS',&#xA;    );&#xA;    $this-&gt;renderTemplate('confirm', $variables);&#xA;}&#xA;&lt;/code&gt;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And output it in layout like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&lt;code&gt;&#xA;{%for variable in variables%}&#xA;  {{variable.name}}&#xA;  {{variable.office}}&#xA;&lt;/code&gt;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just an example, mainly after client pays using paypal I get a payment Object that I want to pass it to the confirmation layout as per explanation above. I have tried it doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone has an idea on how to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-09-03T07:54:52.340" Title="Passing an array on Template Render" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2305" PostTypeId="2" ParentId="2304" CreationDate="2014-09-03T07:45:32.243" Score="1" Body="&lt;p&gt;Yes, you do it with the setRouteVariables mathod on UrlManager, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'variable' =&amp;gt; array(&#xA;      'name' =&amp;gt; 'silvanus',&#xA;      'office' =&amp;gt; 'OOTS&#xA;    )&#xA;));&#xA;&#xA;$this-&amp;gt;renderTemplate('confirm');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can access your variables like this in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ variable.name }}&#xA;{{ variable.office }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;documentation on Controllers&lt;/a&gt;, there's an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;br&gt;&#xA;The above method is how I've done it in the past, but I see now that the renderTemplate method also can be used. I think the problem is just how you access it in your templates, I think you should just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ confirm.name }}&#xA;{{ confirm.office }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-09-03T07:54:52.340" LastActivityDate="2014-09-03T07:54:52.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2306" PostTypeId="2" ParentId="2301" CreationDate="2014-09-03T07:59:37.010" Score="1" Body="&lt;p&gt;As far as 'setting availablity' goes, one could choose to make a 'services' section with a Matrix field that contains a DateTimeField. That way, the client can create a new Matrix Block for each available time span. The {% cache %} tag will help you in speeding this up on the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For booking, you could:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A: Make a 'bookings' section, with a related content field 'service'. Fill this section with a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;frontend Entry form&lt;/a&gt;, set post and expiry dates to the time span of the visitor's choice. You could now display a list of bookings on the frontend (behind a login), or have your client manage bookings through the CP's content tab.&lt;/li&gt;&#xA;&lt;li&gt;B: Make a plugin to handle bookings. This would be my preferred approach.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To handle payments, you could use an existing plugin (&lt;a href=&quot;http://squarebit.co.uk/plugins/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt;, for example) or build your own.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-03T07:59:37.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2307" PostTypeId="1" CreationDate="2014-09-03T08:07:05.310" Score="6" ViewCount="605" Body="&lt;p&gt;So let's say I have the following code. I have the data to retrieve the entry I want, But I only want to return some of the matrix rows based on some criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryId = 1 %}&#xA;{% set entry = craft.entries({ section: &quot;mySection&quot;, id: entryId }).first() %}&#xA;&#xA;{% set myMatrixOutput = entry.myMatrixField.find({ someFieldInTheMatix: 2 }) %}&#xA;&#xA;{% for row in myMatrixOutput %}&#xA;    {{ row.someFieldInTheMatrix }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't get that to work it simply return me everything. I know that I could adjust my loop to be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in myMatrixOutput if row.someFieldInTheMatix == 2 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But say I have a large number of rows in the matrix field it would seem a waste to do all that looping if it could just bring back the correct results?&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2014-12-03T15:40:58.163" Title="How can I return specific matrix rows based on criteria?" Tags="&lt;matrix&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2308" PostTypeId="1" AcceptedAnswerId="2315" CreationDate="2014-09-03T08:41:59.647" Score="6" ViewCount="856" Body="&lt;p&gt;Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-09-29T11:25:45.260" Title="Craft ships with PHPUnit... How can we use it to test our plugins?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2309" PostTypeId="2" ParentId="2191" CreationDate="2014-09-03T08:51:10.463" Score="0" Body="&lt;p&gt;Things changed with Craft 2.2:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Translatable field labels are now marked with locale IDs to help identify which fields are translatable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-03T08:51:10.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2310" PostTypeId="1" AcceptedAnswerId="2321" CreationDate="2014-09-03T09:09:10.637" Score="5" ViewCount="1675" Body="&lt;p&gt;At the moment when a user clicks on the forgot password link in an email the following happens:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User is redirected to the forgot password page.&lt;/li&gt;&#xA;&lt;li&gt;User enters their new password.&lt;/li&gt;&#xA;&lt;li&gt;User is redirected to the Craft admin login page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set where they are sent to? For example, if they do not have admin access I don't want to be showing them the admin login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gareth&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-09-03T14:16:06.930" Title="Can you set the redirect path for system forgot password form?" Tags="&lt;form&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2311" PostTypeId="1" CreationDate="2014-09-03T10:56:14.933" Score="4" ViewCount="766" Body="&lt;p&gt;Has anyone made a plugin which allows for a visitor/user to remember an entry and then see a list of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to make a &quot;short list&quot; page for our new site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was sure there was a plugin that did this, but I can't for the life of me find it anywhere now!&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2015-03-30T19:06:40.133" Title="Need to make a wish list / favourites system" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2312" PostTypeId="2" ParentId="2255" CreationDate="2014-09-03T11:39:29.250" Score="5" Body="&lt;p&gt;What about comparing the currently looped &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel#id&quot; rel=&quot;nofollow&quot;&gt;block ID&lt;/a&gt; with the ID of the last &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;block of type&lt;/a&gt; &quot;text&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_entry.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastTextBlock = entry.simpleMatrix.type('text').last() %}&#xA;{% set lastTextBlockId = lastTextBlock ? lastTextBlock.id : null %}&#xA;&#xA;{% for block in entry.contentBlocks %}&#xA;    {% include '_blocks/' ~ block.type|lower %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_blocks/text.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.id == lastTextBlockId %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-07-27T16:16:09.217" LastActivityDate="2016-07-27T16:16:09.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2314" PostTypeId="2" ParentId="2311" CreationDate="2014-09-03T12:46:24.067" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://dukt.net/craft/like&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/like&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think Dukt is working on something like this. &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-09-03T12:46:24.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2315" PostTypeId="2" ParentId="2308" CreationDate="2014-09-03T12:46:28.600" Score="6" Body="&lt;p&gt;Yes it is possible, see this example plugin by Selvin Ortiz: &lt;a href=&quot;https://github.com/selvinortiz/craft.loath&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/selvinortiz/craft.loath&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check out &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/import&lt;/a&gt; for some detailed unit tests.&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="165" LastEditDate="2017-09-29T11:25:45.260" LastActivityDate="2017-09-29T11:25:45.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2316" PostTypeId="1" AcceptedAnswerId="2319" CreationDate="2014-09-03T12:55:11.640" Score="6" ViewCount="1167" Body="&lt;p&gt;In Twig code you can use &lt;code&gt;craft-&amp;gt;entries-&amp;gt;relatedTo&lt;/code&gt; to do all sorts of neat things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From plugin code I am not sure how this works? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$c = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$c-&amp;gt;section = 'concepts';&#xA;$c-&amp;gt;relatedTo(array('targetElement'=&amp;gt;$e, 'field'=&amp;gt;'entry'));&#xA;$concepts = $c-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't throw an error - but it doesn't work either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use the criteria model to retrieve entries that have some relationship? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2017-07-25T06:08:39.093" Title="How can I follow relations in ElementCriteriaModels from plugin code?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2317" PostTypeId="2" ParentId="2183" CreationDate="2014-09-03T12:58:25.267" Score="3" Body="&lt;p&gt;Things changed with Craft 2.2:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Single sections’ Entry Types now have “Show the Title field?”, “Title Field Label”, and “Title Format” settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;...and yes, the Title field is translatable of course!&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-03T12:58:25.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2318" PostTypeId="1" AcceptedAnswerId="2336" CreationDate="2014-09-03T13:05:10.307" Score="3" ViewCount="1101" Body="&lt;p&gt;I have a problem where some image assets do not produce thumbs. It seems Craft has an issue generating the thumbnail of large images (in pixel-values, not filesize).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if this is a known bug, or if it has anything to do with the server?&lt;/p&gt;&#xA;" OwnerUserId="94" LastActivityDate="2014-09-03T17:29:37.323" Title="Asset thumb missing" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2319" PostTypeId="2" ParentId="2316" CreationDate="2014-09-03T13:34:34.200" Score="6" Body="&lt;p&gt;You're very close! Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'concepts';&#xA;$criteria-&amp;gt;limit   = null;&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $e,&#xA;    'field'         =&amp;gt; $field&#xA;);&#xA;$elements = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, in this instance, $field is the field object which can be retrieved with something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$singleFieldModel = craft()-&amp;gt;fields-&amp;gt;getFieldById($singleField);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the documentation (&lt;a href=&quot;https://craftcms.com/classreference/services/FieldsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/FieldsService&lt;/a&gt;) for other ways to get a field object.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="45" LastEditDate="2017-07-25T06:08:39.093" LastActivityDate="2017-07-25T06:08:39.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2320" PostTypeId="1" AcceptedAnswerId="2322" CreationDate="2014-09-03T13:49:45.253" Score="1" ViewCount="328" Body="&lt;p&gt;I'm trying to create a FieldType that takes a POSTed day/month/year array and saves it into a datetime column, but I think because of the column type it's tripping up before it ever gets to &lt;code&gt;prepValueFromPost()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I'm extending &lt;code&gt;Craft\DateFieldType&lt;/code&gt;, which defines the content attribute as &lt;code&gt;AttributeType::DateTime&lt;/code&gt; for me, and I've got my &lt;code&gt;prepValueFromPost()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValueFromPost($value)&#xA;{&#xA;    if ($value)&#xA;    {&#xA;        $value = join('-', array($value['year'], $value['month'], $value['day']));&#xA;&#xA;        return parent::prepValueFromPost($value);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To work it into a string that &lt;code&gt;DateFieldType::prepValueFromPost()&lt;/code&gt; can use (probably). The issue is, during &lt;code&gt;$entry-&amp;gt;setContentFromPost($values)&lt;/code&gt;, it first sets the raw post content (an array) to the attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/vagrant/craft/app/models/BaseElementModel.php(888): Craft\BaseModel-&amp;gt;__set(&quot;userDateOfBirth&quot;, array(&quot;day&quot; =&amp;gt; &quot;01&quot;, &quot;month&quot; =&amp;gt; &quot;1&quot;, &quot;year&quot; =&amp;gt; &quot;1986&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which then looks at the column type for that field, sees its a DateTime and tries to shoehorn my array into &lt;code&gt;createFromString&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/vagrant/craft/app/models/BaseModel.php(349): Craft\DateTime::createFromString(array(&quot;day&quot; =&amp;gt; &quot;01&quot;, &quot;month&quot; =&amp;gt; &quot;1&quot;, &quot;year&quot; =&amp;gt; &quot;1986&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is no good. And all this happens before my fieldtype's &lt;code&gt;prepValueFromPost()&lt;/code&gt; ever gets called, so I'm not sure what to do :(&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2014-09-03T20:00:46.930" LastActivityDate="2014-09-03T20:00:46.930" Title="Prepping a field's value from a fieldtype before it hits Craft\BaseModel-&gt;__set()" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2321" PostTypeId="2" ParentId="2310" CreationDate="2014-09-03T13:57:50.560" Score="5" Body="&lt;p&gt;You can. You have to build some front end forms:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Forgot Password Form&lt;/strong&gt; (&lt;a href=&quot;http://buildwithcraft.com/docs/templating/forgot-password-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/forgot-password-form&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Set Password Form&lt;/strong&gt; (&lt;a href=&quot;http://buildwithcraft.com/docs/templating/set-password-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/set-password-form&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Be aware of the config setting, &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#setPasswordPath&quot; rel=&quot;nofollow&quot;&gt;setPasswordPath&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth noting that a user account with control panel privileges will be redirected to the control panel set password and login no matter what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Also, check out &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#setPasswordSuccessPath&quot; rel=&quot;nofollow&quot;&gt;setPasswordSuccessPath&lt;/a&gt; for redirecting the user after they've successfully set their new password. Again, this only applies to non admin users that have completed this process using the front end forms you have setup.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-09-03T14:16:06.930" LastActivityDate="2014-09-03T14:16:06.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2322" PostTypeId="2" ParentId="2320" CreationDate="2014-09-03T14:05:39.887" Score="2" Body="&lt;p&gt;I can see how this is unexpected behavior. The code in &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;BaseElementModel::setContentFromPost()&lt;/a&gt; isn’t considering that the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ContentModel&quot; rel=&quot;nofollow&quot;&gt;ContentModel&lt;/a&gt; it’s setting data to is going to be doing its own manipulation of the data before the field type has had a chance to tweak it (thanks to &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;setAttribute()&lt;/a&gt;). And in AttributeType::DateTime’s case, that means trying to convert the value to a DateTime object, else completely discarding the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I’ll tweak this for the next release. Shouldn’t have any negative side effects if we just hold off on assigning the value to the ContentModel until &lt;em&gt;after&lt;/em&gt; the field type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/BaseFieldType#prepValueFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;prepValueFromPost()&lt;/a&gt; has had a chance to do its thing.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-03T14:05:39.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2323" PostTypeId="1" CreationDate="2014-09-03T14:10:39.017" Score="6" ViewCount="676" Body="&lt;p&gt;I've created an alphabetical index of entries in my template. The code I'm using is in the gist below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/jamiepittock/2635516e95317e5c6ed6&quot; rel=&quot;noreferrer&quot;&gt;https://gist.github.com/jamiepittock/2635516e95317e5c6ed6&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It results in a layout like the one in the following image (screenshot only shows &quot;B&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jfScA.png&quot; alt=&quot;Screenshot of the resulting layout&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is it takes 704 database queries. If I don't include the category name (&quot;Business People&quot; under the Jeff Bezos entry on the screenshot) that drops to 22.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything other than caching I can do here?&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-08-05T16:58:10.747" Title="How can I reduce the number of queries when including a related item within a for loop" Tags="&lt;relations&gt;&lt;performance&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2325" PostTypeId="1" CreationDate="2014-09-03T14:30:01.303" Score="1" ViewCount="137" Body="&lt;p&gt;I have altered the Craft usermodel using some standard field types (like an entry field type) and an customfieldtype (extended from the EntriesFieldType). The only thing I have altered in the child fieldtype is some validation rules and the prepValue method. I dont get any errors saving this new field type but when I try to access it eg: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $lCurrentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    $lCompanyIdUser1 = $lCurrentUser-&amp;gt;companiesDropdown[0]-&amp;gt;id;&#xA;    $lCompanyIdUser2 = $lCurrentUser-&amp;gt;companyUser[0]-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;companiesDropdown is a standard &quot;Craft&quot; Entries fieldtype &#xA;companyUser is the custom fieldType &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the error is get is : &#xA;Undefined property: Craft\UserModel::$companyUser (i've tripple checked the handle name)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ps I'm running Craft 2.2) &lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-09-03T14:30:01.303" Title="Custom field type not accessible in usermodel" Tags="&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2326" PostTypeId="1" AcceptedAnswerId="2334" CreationDate="2014-09-03T14:36:14.297" Score="1" ViewCount="73" Body="&lt;p&gt;Unless I am misunderstanding the docs for the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/tree/master/contactform&quot; rel=&quot;nofollow&quot;&gt;P&amp;amp;T form&lt;/a&gt;, it says you have to include the message field, if some forms don't have a message field is the only way to not show this hide it with CSS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondered what other people are doing for forms - I am also looking at the Sprout form add-ons.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-09-03T17:11:09.237" Title="On the P&amp;T form add-on you have to use a message field is there a way round this?" Tags="&lt;plugins&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2327" PostTypeId="1" CreationDate="2014-09-03T15:27:52.763" Score="1" ViewCount="155" Body="&lt;p&gt;Installing Craft 2.2 succeeded. But every main content in the admin is hidden. Example Dashboard (copy &amp;amp; paste from ff debug, which shows only containers without sub nodes!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;main id=&quot;main&quot; role=&quot;main&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid&quot; style=&quot;&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;resize-triggers&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;item first&quot; data-colspan=&quot;1&quot;&amp;gt; &amp;lt;---- display: none&#xA;    &amp;lt;div class=&quot;item&quot; data-colspan=&quot;1&quot;&amp;gt; &amp;lt;---- display: none&#xA;    &amp;lt;div class=&quot;item&quot; data-colspan=&quot;1&quot;&amp;gt; &amp;lt;---- display: none&#xA;    &amp;lt;div class=&quot;item&quot; data-colspan=&quot;1&quot;&amp;gt; &amp;lt;---- display: none&#xA;    &amp;lt;div class=&quot;item&quot; data-colspan=&quot;1&quot;&amp;gt; &amp;lt;---- display: none&#xA;&amp;lt;/main&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When display: none is disabled in FireDebug I see evreything how it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is wrong?&lt;/p&gt;&#xA;" OwnerUserId="755" LastActivityDate="2014-09-03T15:50:49.597" Title="Admin Main Content hidden" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-09-03T17:56:24.613" ContentLicense="CC BY-SA 3.0" />
  <row Id="2328" PostTypeId="1" AcceptedAnswerId="2330" CreationDate="2014-09-03T15:41:53.440" Score="21" ViewCount="415672" Body="&lt;p&gt;In assets when uploading a medium size file I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does it mean? And how to fix?&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="9" LastEditDate="2014-09-03T16:28:50.460" LastActivityDate="2021-02-12T15:39:25.287" Title="413 “Request Entity Too Large” error with uploading a file" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;upload&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="2329" PostTypeId="2" ParentId="2327" CreationDate="2014-09-03T15:50:49.597" Score="1" Body="&lt;p&gt;Seems to be a browser bug. Dashboard is not working with Firefox 20. With Firefox 31 admin is working.&lt;/p&gt;&#xA;" OwnerUserId="755" LastActivityDate="2014-09-03T15:50:49.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2330" PostTypeId="2" ParentId="2328" CreationDate="2014-09-03T16:27:40.173" Score="46" Body="&lt;p&gt;413 errors occur when the request body is larger than the server is configured to allow. Here’s how you can fix it, depending on your web server:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Apache:&lt;/strong&gt; Set the &lt;a href=&quot;http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody&quot; rel=&quot;nofollow noreferrer&quot;&gt;LimitRequestBody directive&lt;/a&gt; in either your httpd.conf file or a local .htaccess file. (&lt;a href=&quot;https://stackoverflow.com/a/3719358/1688568&quot;&gt;https://stackoverflow.com/a/3719358/1688568&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Nginx:&lt;/strong&gt; Set the &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size&quot; rel=&quot;nofollow noreferrer&quot;&gt;client_max_body_size&lt;/a&gt; directive in nginx.conf (&lt;a href=&quot;http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;IIS:&lt;/strong&gt; Set the uploadreadaheadsize config setting (&lt;a href=&quot;https://web.archive.org/web/20160204040121/http://blogs.msdn.com:80/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://web.archive.org/web/20160204040121/http://blogs.msdn.com:80/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You also might want to try increasing PHP’s &lt;a href=&quot;http://de.php.net/manual/en/ini.core.php#ini.upload-max-filesize&quot; rel=&quot;nofollow noreferrer&quot;&gt;upload_max_filesize&lt;/a&gt; and &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.post-max-size&quot; rel=&quot;nofollow noreferrer&quot;&gt;post_max_size&lt;/a&gt; settings in php.ini or using the &lt;code&gt;php_value&lt;/code&gt; directive in your .htaccess file if you’re using Apache (&lt;a href=&quot;http://davidwalsh.name/php-values-htaccess&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://davidwalsh.name/php-values-htaccess&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="6007" LastEditDate="2021-02-12T15:39:25.287" LastActivityDate="2021-02-12T15:39:25.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2331" PostTypeId="2" ParentId="1054" CreationDate="2014-09-03T16:38:58.557" Score="3" Body="&lt;p&gt;Also worth noting: If you need a locale that Yii doesn’t offer, find the closest locale Yii/Craft does come with, and copy it with a new name (e.g. &lt;code&gt;en_us.php&lt;/code&gt; =&gt; &lt;code&gt;en_mx.php&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also wish to add it to the &lt;code&gt;'languages'&lt;/code&gt; array within each of your selected locales’ data files, so you can customize what the locale should be labeled as within the CP.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-03T16:38:58.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2332" PostTypeId="1" CreationDate="2014-09-03T16:50:24.133" Score="1" ViewCount="282" Body="&lt;p&gt;I'm trying to build a restaurant menu using a structure.&lt;br&gt;&#xA;The structure looks like that:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; Menu-part 1&#xA;  &amp;gt; Menu-item 1&#xA;  &amp;gt; Menu-item 2&#xA;  &amp;gt; Menu-item 3&#xA;&#xA;&amp;gt; Menu-part 2&#xA;  &amp;gt; Menu-item 4&#xA;  &amp;gt; Menu-item 5&#xA;  &amp;gt; Menu-item 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I now make a page accessible with those entries ? Should I create a single-page and then add those categories ? Or is there a better way ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;br&gt;&#xA;What I don't understand is: Do structures exist without any page behind it? Because what I want is a page that just takes every entry from my menu-structure and builds me the food-menu on &lt;code&gt;mysite.dev/lunch-menu&lt;/code&gt; for example.  &lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="733" LastEditDate="2014-09-03T22:58:52.750" LastActivityDate="2014-09-03T23:44:39.863" Title="How to access a structure" Tags="&lt;structure&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2333" PostTypeId="2" ParentId="2261" CreationDate="2014-09-03T17:02:16.663" Score="0" Body="&lt;p&gt;I think a custom plugin is going to be the best way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the client is adding users from the control panel, they'll either have to put in a dummy email address (username+someUniqueId@domain.com), or you can create a front-end &quot;user management&quot; form for them that fills that in behind the scenes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, you'll want to be sure &quot;verify email address&quot; is &lt;em&gt;not&lt;/em&gt; enabled for the user at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, assuming you'll be providing your own front-end login form for these users, with username/password fields (password not required), you'll want to point the form to your plugin's controller with it's own actionLogin method (very similar to Craft's UsersController-&gt;actionLogin), but check to see if password is null and if the username is valid and if the email is in the format of the unique email address that was previous assigned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, prompt for their actual email, then send Craft's activation email and let it go through Craft's usual workflow for setting a password on the user account.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-03T17:02:16.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2334" PostTypeId="2" ParentId="2326" CreationDate="2014-09-03T17:11:09.237" Score="1" Body="&lt;p&gt;Why not just add a hidden input called &quot;messages&quot; set to &quot;&quot; (or if that doesn't work &quot;.&quot;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the use case for wanted to send a contact email with a message body?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-03T17:11:09.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2335" PostTypeId="2" ParentId="2323" CreationDate="2014-09-03T17:24:11.090" Score="3" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll leave the original answer because they're certainly still viable options, this is now probably best solved by using the &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;eager loading features&lt;/a&gt; that Craft 2.6 added.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A bit difficult to properly debug without seeing things like your content architecture, database profiling information, logs, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tag is certainly an option here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're adverse to that, then you could also use a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; that goes to a plugin method that would &quot;eager load&quot; the data you know you'll be needing for this particular page directly from PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can search Craft's &lt;code&gt;app&lt;/code&gt; folder for &lt;code&gt;'{% hook'&lt;/code&gt; to see how we're using that for the CP in a few places as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-08-05T16:58:10.747" LastActivityDate="2016-08-05T16:58:10.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2336" PostTypeId="2" ParentId="2318" CreationDate="2014-09-03T17:29:37.323" Score="2" Body="&lt;p&gt;You're most likely running into some environmental limitation... PHP's &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; being the most likely scenario.  Try bumping that in your php.ini file and see if that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it doesn't, check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for any [error] or [warning] entries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-03T17:29:37.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2337" PostTypeId="1" CreationDate="2014-09-03T19:16:02.573" Score="1" ViewCount="771" Body="&lt;p&gt;I have a structure setup with parents and children.  Can a route be setup in the CP to route a generic url to a specific parent or child of the structure.  For example I have a blog landing page that is a child of the structure.  Can a route be setup, so when a user enters at /blog it takes them to that landing page?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-09-04T19:47:42.340" Title="Routing generic urls to sections or structures urls" Tags="&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2338" PostTypeId="1" CreationDate="2014-09-03T20:18:35.957" Score="1" ViewCount="972" Body="&lt;p&gt;I'm using &lt;code&gt;{% block content %}&lt;/code&gt; and a main layout file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using live preview the &quot;entire&quot; frame isn't shown (including layout files).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to get the whole template in?&lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="57" LastEditDate="2014-09-04T01:32:47.157" LastActivityDate="2014-09-09T11:45:16.797" Title="Live Preview and Twig blocks" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2014-09-25T17:31:46.613" ContentLicense="CC BY-SA 3.0" />
  <row Id="2339" PostTypeId="1" AcceptedAnswerId="2365" CreationDate="2014-09-03T21:04:04.500" Score="5" ViewCount="1322" Body="&lt;p&gt;Since the update to version 2.2 I can't upload assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get this error message in the console:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failed to load resource: the server responded with a status of 400 (Bad Request)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the upload stops:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xNhgV.png&quot; alt=&quot;upload error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why?&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2014-09-04T07:11:52.583" LastActivityDate="2014-09-08T19:27:36.780" Title="Craft 2.2 with enabled enableCsrfProtection: Failed to load resource: the server responded with a status of 400 (Bad Request)" Tags="&lt;error-message&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="7" ClosedDate="2014-09-08T20:09:44.563" ContentLicense="CC BY-SA 3.0" />
  <row Id="2340" PostTypeId="1" AcceptedAnswerId="2342" CreationDate="2014-09-03T21:22:04.013" Score="8" ViewCount="2681" Body="&lt;p&gt;I have a 'teacher' channel section on my site. That channel has three entry types, 'teacher', 'demoTeacher' and 'guestTeacher' - how do I display entries from teacher and demoTeach combined? At the moment I'm showing one type like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for teacher in craft.entries.find({section: 'teacher', type: 'demoTeacher'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Secondly, how can I use a conditional that checks for entry type? I need do something like the following (pseudocode):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entrytype is demoTeacher %}&#xA;    display read more button&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-09-03T21:51:51.073" LastActivityDate="2015-10-23T19:07:43.473" Title="How do I display entries from multiple entry types?" Tags="&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2341" PostTypeId="1" AcceptedAnswerId="2346" CreationDate="2014-09-03T21:46:57.067" Score="3" ViewCount="1089" Body="&lt;p&gt;Since updating to Craft 2.2, my front-end login form now redirects to the home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intended behaviour is to just reload the page that the visitor was on when they logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.1 I achieved this by omitting the hidden redirect field. Any idea how to prevent members from being kicked to the home page now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="352" LastActivityDate="2014-09-04T11:18:11.613" Title="Login redirects to home page after 2.2 update" Tags="&lt;redirect&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2342" PostTypeId="2" ParentId="2340" CreationDate="2014-09-03T21:57:57.903" Score="11" Body="&lt;p&gt;You can set the ElementCriteriaModel's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#type&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/a&gt; parameter to multiple values by passing it an &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#expressions&quot;&gt;array&lt;/a&gt; of entry type slugs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teachers = craft.entries.section('teacher').type(['teacher', 'demoTeacher']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#type&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/a&gt; property on the entry model to access its entry type in your conditional (also see &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#properties&quot;&gt;this list&lt;/a&gt; for other available properties).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for teacher in teachers %}&#xA;&#xA;    {{ teacher.title }}&#xA;&#xA;    {% if teacher.type == 'demoTeacher' %}&#xA;        ...&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-03T22:13:57.170" LastActivityDate="2014-09-03T22:13:57.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2343" PostTypeId="2" ParentId="2341" CreationDate="2014-09-03T22:52:56.577" Score="4" Body="&lt;p&gt;Craft 2.2 introduced the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#postLoginRedirect&quot; rel=&quot;nofollow&quot;&gt;postLoginRedirect&lt;/a&gt; config setting which affects not only where users on the front-end of the site get redirected to after logging in (defaults to the home page), but where they get sent if they visit the front-end login page while they are logged in.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-03T22:52:56.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2344" PostTypeId="2" ParentId="2332" CreationDate="2014-09-03T23:14:44.077" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Do structures exist without any page behind it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, you have to design a template for it. To make that template available under &lt;code&gt;mysite.dev/lunch-menu&lt;/code&gt; you have multiple options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to do it is to simply save the template as &lt;code&gt;/lunch-menu/index.html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another pretty common option is to use a Single section for your menu's Structure section index page. This is not very complicate to set up and because your &quot;Lunch menu&quot; now got it's own entry type, you can add custom fields to it. That's a good thing to have if you need other content on that lunch menu's index page besides the actual lists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also create another structure (e.g. named &quot;Pages&quot;) and make you Lunch menu structure's index page an entry of that other structure. Besides index pages, like the &quot;Lunch menu&quot; index or a &quot;News&quot; index for example, you could also add entries like &quot;About&quot; or &quot;Contact&quot; to that structure. One advantage of this approach is that you have all your pages (indexes and single content) in one structure and you can create your site navigation out of it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-03T23:44:39.863" LastActivityDate="2014-09-03T23:44:39.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2345" PostTypeId="1" CreationDate="2014-09-03T23:43:40.403" Score="2" ViewCount="429" Body="&lt;p&gt;I am trying to upload/add an asset to an entry via a form on the website. The entry saves fine when I don't include the asset field but as soon as I add the asset field and try to upload a file I get this odd SQL error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (&lt;code&gt;housewares&lt;/code&gt;.&lt;code&gt;craft_relations&lt;/code&gt;, CONSTRAINT &lt;code&gt;craft_relations_targetId_fk&lt;/code&gt; FOREIGN KEY (&lt;code&gt;targetId&lt;/code&gt;) REFERENCES &lt;code&gt;craft_elements&lt;/code&gt; (&lt;code&gt;id&lt;/code&gt;) ON DELETE CASCADE).&lt;br&gt;&#xA;  The SQL statement executed was: INSERT INTO &lt;code&gt;craft_relations&lt;/code&gt; (&lt;code&gt;fieldId&lt;/code&gt;, &lt;code&gt;sourceId&lt;/code&gt;, &lt;code&gt;sourceLocale&lt;/code&gt;, &lt;code&gt;targetId&lt;/code&gt;, &lt;code&gt;sortOrder&lt;/code&gt;, &lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;dateUpdated&lt;/code&gt;, &lt;code&gt;uid&lt;/code&gt;) VALUES (:row0_col0, :row0_col1, NULL, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7). Bound with :row0_col0='4', :row0_col1='27', :row0_col3='Golfclubs.jpg', :row0_col4=1, :row0_col5='2014-09-03 23:36:06', :row0_col6='2014-09-03 23:36:06', :row0_col7='a1e565e1-f6d3-4f3b-8a6f-2c049d236b13'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The field works fine in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input class=&quot;form-control&quot; type=&quot;file&quot; id=&quot;image&quot; name=&quot;fields[image][]&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="125" LastEditDate="2014-09-03T23:46:00.560" LastActivityDate="2019-05-02T17:31:23.743" Title="Upload an asset in a custom form" Tags="&lt;entries&gt;&lt;assets&gt;&lt;form&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2346" PostTypeId="2" ParentId="2341" CreationDate="2014-09-03T23:58:18.137" Score="11" Body="&lt;p&gt;As Brad said the new default behavior is for users to be redirected wherever &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#postLoginRedirect&quot;&gt;postLoginRedirect&lt;/a&gt; is set to (if a &lt;code&gt;redirect&lt;/code&gt; param was not in the POST data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get your old behavior back by adding that hidden &lt;code&gt;redirect&lt;/code&gt; param though, set to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getPath&quot;&gt;craft.request.getPath()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.path }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-04T11:18:11.613" LastActivityDate="2014-09-04T11:18:11.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2347" PostTypeId="1" AcceptedAnswerId="2348" CreationDate="2014-09-04T00:09:23.960" Score="1" ViewCount="67" Body="&lt;p&gt;I have installed Craft 2.2.2579 on my never-before-used website live rather than on my PC in a development environment. (I am not a developer.) Instructions were followed exactly (I believe), but when I point my browser to http://{mySiteName}/admin or the other alternatives, I get:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/wCzGQ.jpg&quot; alt=&quot;Error Message&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The index page of the website itself loads just fine as http://{mySiteName}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="757" LastEditorUserId="757" LastEditDate="2014-09-04T00:33:20.477" LastActivityDate="2014-09-04T00:52:17.810" Title="Installation Fails on Live Website" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2348" PostTypeId="2" ParentId="2347" CreationDate="2014-09-04T00:52:17.810" Score="1" Body="&lt;p&gt;Open up this file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/config/db.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and take a look at the very first line. The file &lt;strong&gt;should&lt;/strong&gt; start with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It sounds like that may not be the case with your file. Make sure there is absolutely nothing before that &lt;code&gt;&amp;lt;&lt;/code&gt; character, not even a blank line.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-04T00:52:17.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2349" PostTypeId="2" ParentId="2345" CreationDate="2014-09-04T00:55:57.963" Score="3" Body="&lt;p&gt;Problem solved! (head slap) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; requires the following parameters:&lt;br&gt;&#xA;&lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An odd error that gets thrown if omitted. &lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="37" LastEditDate="2019-05-02T17:31:23.743" LastActivityDate="2019-05-02T17:31:23.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2350" PostTypeId="2" ParentId="2337" CreationDate="2014-09-04T05:06:27.840" Score="2" Body="&lt;p&gt;Not 100% sure I follow what you're trying to do, but here's what I'd suggest (based on my interpretation)...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an actual template, either &lt;code&gt;blog.html&lt;/code&gt; or &lt;code&gt;blog/index.html&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In that template, write a couple simple lines of Twig code which will (A) determine which page they are supposed to be routed to, then (B) &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;redirect to that page&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-04T05:06:27.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2351" PostTypeId="1" CreationDate="2014-09-04T07:05:34.313" Score="1" ViewCount="2215" Body="&lt;p&gt;I want to point any domain.com/page to the www.domain.com/page without showing index.php in my urls. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a www and non-www A record pointing to an IP address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I set up my .htaccess file to do this?&lt;/p&gt;&#xA;" OwnerUserId="393" LastActivityDate="2014-09-04T09:41:50.467" Title="How should I setup my .htaccess file" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2353" PostTypeId="1" AcceptedAnswerId="2366" CreationDate="2014-09-04T09:37:42.763" Score="3" ViewCount="1031" Body="&lt;p&gt;I have a booking form on my site, which when submitted creates a new entry which has two fields: an Entries field which links to a single User, and another Entries field which links to a single Event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The title field of the entry is set automatically to &quot;[date of event] - [username]&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that some users are booking twice for the same event. We need a way to limit bookings to ONE PER USER. Is there a way to prevent an entry with the same title being created, and rather than just failing to submit the form, give the user an error message saying &quot;you can't book more than one place&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; class=&quot;custom&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;events/book/complete/{{eventID}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;18&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userBooking][]&quot; value=&quot;{{userID}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[eventBooking][]&quot; value=&quot;{{eventID}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Confirm Booking&quot; class=&quot;button secondary&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Related question (possibly could be solved with the same answer) - I need to limit the number of bookings an event can take in total. So for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event One: Bookings per user: 1, Total places: 35&lt;/li&gt;&#xA;&lt;li&gt;Event Two: Bookings per user: 1, Total places: 50&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This needs to be done with template code, not a plugin. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-09-17T11:47:49.007" LastActivityDate="2014-09-29T17:23:04.553" Title="How can I stop a duplicate entry being created &amp; provide feedback?" Tags="&lt;form&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2354" PostTypeId="2" ParentId="2351" CreationDate="2014-09-04T09:41:50.467" Score="1" Body="&lt;p&gt;Here's what I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Remove the www from the URL&#xA;RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&#xA;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&#xA;# Exclude root files&#xA;RewriteCond $1 !^(favicon\.ico|favicon\.png|fb_share\.jpg|apple-touch-icon\.png|apple-touch-icon-precomposed\.png|index\.php|robots\.txt) [NC]&#xA;&#xA;# Exclude asset folders&#xA;RewriteCond $1 !^(assets|uploads)/ [NC]&#xA;&#xA;# Remove index.php&#xA;RewriteRule ^(.*)$ /index.php/$1 [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also set up a CNAME record from www.domain.com to domain.com in your DNS.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-04T09:41:50.467" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2355" PostTypeId="2" ParentId="1878" CreationDate="2014-09-04T10:06:56.803" Score="3" Body="&lt;p&gt;I'm not sure if you can get multiple POST parameters with one &lt;code&gt;getParam&lt;/code&gt; request (maybe it works if you request them as an array?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What definitely works is to get the parameters separately:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set c = craft.request.getParam('c') %}&#xA;{% set q = craft.request.getParam('q') %}&#xA;&#xA;{% set query = c ~ ' ' ~ q %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Request the category parameter&#xA; --&amp;gt; see other answer on how to proceed with this #}&#xA;{% set catParam = craft.request.getParam('c') %}&#xA;&#xA;{# Request search parameters #}&#xA;{% set searchParamQ = craft.request.getParam('q') %}&#xA;{% set searchParamR = craft.request.getParam('r') %}&#xA;{% set searchParamS = craft.request.getParam('s') %}&#xA;{% set searchParamT = craft.request.getParam('t') %}&#xA;&#xA;{# Set `searchParam` before conditionals #}&#xA;{% set searchParam = '' %}&#xA;&#xA;{# Add parameters with `OR` logic #}&#xA;{% set searchParam = searchParamQ ? searchParam ~ ' OR ' ~ searchParamQ : searchParam %}&#xA;{% set searchParam = searchParamR ? searchParam ~ ' OR ' ~ searchParamR : searchParam %}&#xA;{% set searchParam = searchParamS ? searchParam ~ ' OR ' ~ searchParamR : searchParam %}&#xA;{% set searchParam = searchParamT ? searchParam ~ ' OR ' ~ searchParamR : searchParam %}&#xA;&#xA;{# Beautify `searchParam` #}&#xA;{% set searchParam = searchParam|trim|trim('OR ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-04T14:49:36.003" LastActivityDate="2014-09-04T14:49:36.003" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2356" PostTypeId="2" ParentId="1878" CreationDate="2014-09-04T11:15:25.790" Score="5" Body="&lt;p&gt;You should process your two POST parameters differently. One is responsible for your &lt;code&gt;search&lt;/code&gt; parameter in your results template and the other should go into a &lt;code&gt;relatedTo&lt;/code&gt; parameter. That's why I recommend to get them separately (it's probably not even possible to get them with a single &lt;code&gt;getParam&lt;/code&gt;, but I'm not sure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I'd proceed with the category parameter 'c'. For starters I'd use the category's slug as the value, just to be save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_search.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;    &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use that slug to grab the right category with a &lt;code&gt;craft.categories&lt;/code&gt; ElementCriteriaModel. Use &lt;code&gt;first()&lt;/code&gt; to get the first (and only) category model that matches the criteria and use it to compose the relation parameter. The category is the taget element because you select the category from your &quot;News&quot; entry and not the other way round.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_results.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchParam = craft.request.getParam('q') %}&#xA;{% set catSlug = craft.request.getParam('c') %}&#xA;&#xA;{% set cat = craft.categories.group('news').slug(catSlug).first %}&#xA;{% set relationParam = catSlug ? {targetElement: cat} : '' %}&#xA;&#xA;{% set entries = craft.entries.section('news').relatedTo(relationParam).search(searchParam) %}&#xA;&#xA;{% if entries|length %}&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% else %}&#xA;&#xA;    &amp;lt;p&amp;gt;Your search for “{{ searchParam }}” in “{{ cat.title }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-04T15:29:34.357" LastActivityDate="2014-09-04T15:29:34.357" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2357" PostTypeId="2" ParentId="2307" CreationDate="2014-09-04T13:00:58.693" Score="3" Body="&lt;p&gt;&lt;s&gt;As far as I know, the only criteria to filter Matrix blocks is the &lt;code&gt;type&lt;/code&gt; property or to pick a block by it's position with &lt;code&gt;first&lt;/code&gt;, &lt;code&gt;last&lt;/code&gt; or the new &lt;code&gt;nth&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it would totally make sense to have more options to grab select Matrix blocks and I am rather confident that this is s.th. that is already on &quot;The List&quot;.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.3 change things! Besides using the &lt;code&gt;type&lt;/code&gt; property or to pick a block by it's position with &lt;code&gt;first&lt;/code&gt;, &lt;code&gt;last&lt;/code&gt; or the &lt;code&gt;nth&lt;/code&gt; filter it is now possible to query for Matrix blocks using all sorts of custom field parameters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug('myMatrixEntry').first() %}&#xA;&#xA;{# Query Matrix blocks using custom field parameters #}&#xA;{% set blocks = entry.myMatrixField.type('text').myLightswitchField('1').myDateField('&amp;gt; 2014-12-02') %}&#xA;&#xA;{% for block in blocks %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-03T15:40:58.163" LastActivityDate="2014-12-03T15:40:58.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2358" PostTypeId="1" CreationDate="2014-09-04T13:32:40.390" Score="3" ViewCount="293" Body="&lt;p&gt;in a multilingual site, how can i place multilingual links to content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. in the footer i would place a Imprint but in anohter language the slug might be /de/germanImprint...is there an easy helper to always get the right url from the english slug?&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2014-09-04T16:18:02.847" Title="How to localise page url" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2359" PostTypeId="1" AcceptedAnswerId="2361" CreationDate="2014-09-04T15:14:10.003" Score="9" ViewCount="1603" Body="&lt;p&gt;I am receiving the following error when I click on &lt;code&gt;Check for Updates&lt;/code&gt; ...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft is unable to determine if an update is available at this time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do you know what could be causing this?&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="45" LastEditDate="2014-09-04T18:50:50.517" LastActivityDate="2016-12-29T02:42:13.240" Title="&quot;Craft is unable to determine if an update is available at this time.&quot;" Tags="&lt;error-message&gt;&lt;auto-updates&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2360" PostTypeId="2" ParentId="2358" CreationDate="2014-09-04T15:19:10.373" Score="3" Body="&lt;p&gt;This is how to &quot;translate&quot; a slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set enSlug = 'work' %}&#xA;&#xA;{# Get the ID of an entry with that english slug #}&#xA;{% set enId = craft.entries.slug(enSlug).locale('en').first().id %}&#xA;&#xA;{# Use the entry ID to get the german slug #}&#xA;{% set deSlug = craft.entries.id(enId).locale('de').first().slug %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-09-04T16:18:02.847" LastActivityDate="2014-09-04T16:18:02.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2361" PostTypeId="2" ParentId="2359" CreationDate="2014-09-04T16:19:22.860" Score="12" Body="&lt;p&gt;You'll get this if (for any reason) your local install can't connect to our web service that holds all of our update and release information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this happens, your local install will cache that there was a connection error and cache to not try again for 5 minutes, no matter how many times you refresh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can either wait the 5 minutes and try again, or clear your data caches under Settings-&gt;Tools-&gt;Clear Caches Tool and try again and hopefully the connection problem will have resolved itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for any cURL related errors indicating a cURL configuration problem on the box.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-12-07T22:40:38.757" LastActivityDate="2016-12-07T22:40:38.757" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2362" PostTypeId="2" ParentId="2359" CreationDate="2014-09-04T17:53:19.473" Score="4" Body="&lt;p&gt;I cleared the cache to no avail. After combing through error logs, I found I had an error with my curl and ssl setup via homebrew. After re-installing those items and reinstalling php55 like so... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;brew install php55 --with-homebrew-curl --with-homebrew-libxslt --with-homebrew-openssl --without-snmp&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...everything seemed to be fixed and was able to run my updates.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2014-09-04T17:53:19.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2363" PostTypeId="2" ParentId="2353" CreationDate="2014-09-04T18:27:43.343" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;Write a plugin&lt;/a&gt;, and have that plugin do the custom validation for you.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-04T18:27:43.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2364" PostTypeId="2" ParentId="2337" CreationDate="2014-09-04T19:47:42.340" Score="3" Body="&lt;p&gt;What I would do is create a structure &lt;code&gt;siteUrls&lt;/code&gt; which is responsible for page urls. Top-level entries have url of &lt;code&gt;{slug}&lt;/code&gt;, nested entries have url of &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;. The top-level entry with slug &lt;em&gt;blog&lt;/em&gt; will be the entry with url &lt;em&gt;/blog&lt;/em&gt;. Then you can have an entry type of &lt;code&gt;blogLandingPage&lt;/code&gt; and use that entry type for this entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other piece of the puzzle is getting the right template for the &lt;code&gt;blogLandingPage&lt;/code&gt;. The trick for this is to use a feature of the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;twig include tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;New in version 1.2: The possibility to pass an array of templates has been added in Twig 1.2.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;You can also provide a list of templates that are checked for existence before inclusion. The first template that exists will be included:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So your template for  &lt;code&gt;siteUrls&lt;/code&gt; will look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ['_siteUrls/'~entry.type, '_siteUrls/default'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the template for entries (like this one) with type &lt;code&gt;blogLandingPage&lt;/code&gt; is &lt;em&gt;_siteUrls/blogLandingPage&lt;/em&gt;. Using a list for the &lt;code&gt;{% include %}&lt;/code&gt; means some entry types can share templates, and thing fail more gracefully if you have an entry type without a matching template.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-04T19:47:42.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2365" PostTypeId="2" ParentId="2339" CreationDate="2014-09-04T20:35:26.113" Score="4" Body="&lt;p&gt;I can confirm this is a bug on &lt;a href=&quot;http://buildwithcraft.com/help/csrf-protection&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2.2579&lt;/a&gt; when CSRF protection is enabled.  Will get a fix out for it shortly and update this answer when it's done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed in &lt;a href=&quot;https://buildwithcraft.com/updates#build2582&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2.2582&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-08T19:27:36.780" LastActivityDate="2014-09-08T19:27:36.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2366" PostTypeId="2" ParentId="2353" CreationDate="2014-09-04T21:08:22.683" Score="2" Body="&lt;p&gt;What about not showing the submit button at all, if a similar booking already exists?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser|length %}&#xA;    {% if entry.dateTime &amp;gt; now %} {# If event is in the future, display button to book #}&#xA;&#xA;        {% set similarBooking = craft.entries({ sectionId: '18', relatedTo: ['and', { targetElement: currentUser, field: 'userBooking' }, { targetElement: entry.id, field: 'eventBooking' } ]}) %}&#xA;        {% set totalBookings = craft.entries({ sectionId: '18', relatedTo: { targetElement: entry.id, field: 'eventBooking' } }) %}&#xA;&#xA;        {% if similarBooking|length %} {# Check if they have already booked #}&#xA;            &amp;lt;p&amp;gt;You have already booked a place for this event.&amp;lt;/p&amp;gt;&#xA;        {% else %} {# No previous booking, so check if there are spaces #}&#xA;&#xA;            {% if entry.maxBookings &amp;gt; 0 %} {# Check if there is a limit on spaces #}&#xA;&#xA;                {% if totalBookings|length &amp;lt; entry.maxBookings %} {# Check if there are spaces left #}&#xA;                    &amp;lt;a href=&quot;#&quot;&amp;gt;Book Now&amp;lt;/a&amp;gt;&#xA;                {% else %} {# There are no spaces left #}&#xA;                    &amp;lt;p&amp;gt;This event is full.&amp;lt;/p&amp;gt;&#xA;                {% endif %}&#xA;&#xA;            {% else %} {# No limit, display booking button #}&#xA;                &amp;lt;a href=&quot;#&quot;&amp;gt;Book Now&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;#&quot;&amp;gt;Login to book&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="642" LastEditDate="2014-09-29T17:23:04.553" LastActivityDate="2014-09-29T17:23:04.553" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2367" PostTypeId="1" AcceptedAnswerId="2369" CreationDate="2014-09-04T23:40:39.030" Score="3" ViewCount="193" Body="&lt;p&gt;I'm working on a site with a &quot;Research&quot; channel that is going to have scientific names in the titles of the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to allow these names to be marked up with &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tags so I can display them in italics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm using the default &quot;Title&quot; field Craft supplies when you set up a section, but I haven't needed to insert formatting here before. &lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-09-05T00:08:02.287" Title="How do I italicize words in an entry title?" Tags="&lt;titles&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2368" PostTypeId="2" ParentId="2367" CreationDate="2014-09-04T23:54:23.467" Score="2" Body="&lt;p&gt;I would have the user enter the title with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#markdown-or-md&quot; rel=&quot;nofollow&quot;&gt;markdown formatting&lt;/a&gt;: So they would enter&#xA;&quot;Title with *italics*&quot; in the title field, and in the template you would display it with: &lt;code&gt;{{entry.title|md}}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-04T23:54:23.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2369" PostTypeId="2" ParentId="2367" CreationDate="2014-09-05T00:08:02.287" Score="1" Body="&lt;p&gt;I'd also suggest to enter the titles with markdown formatting. But instead of using the Craft built-in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#markdown-or-md&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;markdown&lt;/code&gt;&lt;/a&gt; filter, I'd suggest to look into the &lt;a href=&quot;https://github.com/pixelandtonic/Parsedown&quot; rel=&quot;nofollow&quot;&gt;parsedown plugin&lt;/a&gt; provided by P+T. The plugin has an option for single line output, so you won't end up with your title wrapped in &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title|parsedown('line') }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-05T00:08:02.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2370" PostTypeId="1" AcceptedAnswerId="2373" CreationDate="2014-09-05T00:50:23.200" Score="1" ViewCount="626" Body="&lt;p&gt;I came across error Property &quot;Craft\WebApp.assetUpload&quot; is not defined, when registering users from front end. Is this a bug or missing config param?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the example on craft website:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Actual template used is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Membership Registration&amp;lt;/h1&amp;gt;&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Sil&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="3951" LastEditDate="2017-10-26T00:42:37.080" LastActivityDate="2017-10-26T00:42:37.080" Title="Property &quot;Craft\WebApp.assetUpload&quot; is not defined" Tags="&lt;error-templates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2371" PostTypeId="2" ParentId="1709" CreationDate="2014-09-05T01:33:56.443" Score="6" Body="&lt;p&gt;Ok, in some conversation with Brandon which leaned this direction, I realized a different direction to temporarily solving most of this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that a root of the issues is that marking a Matrix as translatable causes the base problem here, that the set of elements in an original language isn't copying at all into other Locales, as would be expected on first Save as all other kinds of elements do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;don't&lt;/em&gt; mark the Matrix as translatable, two good things happen:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All Matrix elements now do get copied over, so that you don't have to recreate the Matrix in its individual form for each Entry and language.&lt;/li&gt;&#xA;&lt;li&gt;Text items marked as translatable do have their original text copied over, so that you have a starting situation for language translation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's true that Assets marked as translatable show up empty rather than with their original content, but at least they are there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also don't really know what marking a Matrix as translatable should mean. I suspect it should mean that all contained elements are marked translatable, but we shall see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft crew is well aware of issues here, and plans a careful improvement of the whole area, which as complex isn't at the top of lists yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This little detail should get most of us through until that happens, and given we set up the non-translatability of Matrix elements, should make extra steps explainable to customer end users.&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-09-05T01:33:56.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2372" PostTypeId="1" AcceptedAnswerId="2396" CreationDate="2014-09-05T02:07:41.810" Score="3" ViewCount="1221" Body="&lt;p&gt;I have a user field called &quot;designOptions&quot; that is a Categories Checkbox field type. I have this field in the Edit Profile front-end form so that the user can see the saved options that they had selected previously (if any) and then change or add to those selections in the Edit Profile form. I am having a hard time finding anything in the documentation or SE about how to display all of the user's category checkbox options while displaying the options that are already selected in their account for that field. This is what I have so far, but it is checking all category options instead of just the 4 that the user has selected - likely because the length conditional is only looking at whether this field has 'any' value and not checking the value of each option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any guidance you can give on the best way to do this. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all categories in the group and set variable. #}&#xA;{% set categories = craft.categories.group('designCategories') %}&#xA;&#xA;{# Grab the categories that the user already selected #}&#xA;{% set userOptions = user.designOptions %}&#xA;&#xA;{# Display all category checkboxes in the form, with the logged in user's saved selections already checked.#}&#xA;{% for category in categories %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;designOptions&quot; name=&quot;fields[designsOptions][]&quot; {% if userOptions | length %}checked{% endif %} value=&quot; {{ category.id }}&quot;&amp;gt; {{ category.title }}&amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LwAJ5.jpg&quot; alt=&quot;Design Categories&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0nNfE.png&quot; alt=&quot;Design Options User Field with Design Categories as Source&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/usjLA.png&quot; alt=&quot;Categories already selected by User&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T4Pc3.png&quot; alt=&quot;Trying to display all categories as well as the categories already selected by the user on the &amp;quot;Edit Profile&amp;quot; front end page.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="504" LastEditorUserId="504" LastEditDate="2014-09-05T23:03:57.313" LastActivityDate="2020-09-02T03:55:36.773" Title="Display a user's selected checkbox options for a category field type in a front-end Edit Profile form" Tags="&lt;user-profile&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2373" PostTypeId="2" ParentId="2370" CreationDate="2014-09-05T02:11:01.823" Score="1" Body="&lt;p&gt;You won't need the &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; part of the form, since you don't appear to be uploading any files when saving the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, I'd guess that maybe you've got an Asset field on your User's field layout that set to required and you're not taking that into account on the front-end?j&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-05T02:11:01.823" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2374" PostTypeId="1" CreationDate="2014-09-05T03:56:00.817" Score="3" ViewCount="1196" Body="&lt;p&gt;I'm new to php development, so I'm probably doing something silly...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have setup Craft running in a Vagrant VM on Windows 8. I am using XDebug and Eclipse as my IDE. It all works beautifully! However I cannot debug any of my plugin code. I can step into the Craft code but it never breaks on any plugin actions. I suspect its something to do with the way the Craft code is calling the actions, it looks like it is using some sort of reflection to call the methods of the plugin class. Can anyone help? Is there a way to debug plugin code? Or perhaps a better IDE if it is Eclipse that has this limitation?&lt;/p&gt;&#xA;" OwnerUserId="760" LastActivityDate="2015-11-26T21:06:32.467" Title="Debugging Craft plugin actions" Tags="&lt;debugging&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2375" PostTypeId="1" AcceptedAnswerId="2389" CreationDate="2014-09-05T04:30:08.293" Score="25" ViewCount="4209" Body="&lt;p&gt;In the CMS the progress indicator for tasks is stuck and not completing its jobs. What can I do to resolve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DXcfD.png&quot; alt=&quot;task indicators&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-08-24T04:52:49.300" Title="Generating pending image transforms stuck in process" Tags="&lt;image-transforms&gt;&lt;cache&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2376" PostTypeId="1" AcceptedAnswerId="2436" CreationDate="2014-09-05T05:14:00.373" Score="5" ViewCount="1436" Body="&lt;p&gt;Leading on from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2045/modifying-search-scoring-algorithm&quot;&gt;this question by Chris Lewis&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find anything on the technicals, but by what criteria &quot;best-match to worst-match&quot; calculated? For example, if I was to have, an entry with the title &quot;Top Trees&quot; then &quot;Top Trees&quot; I would expect to be a &quot;best-match&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a little bit &quot;How do I get my post to the first page of the Craft Search!&quot; I know.&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-11T14:05:15.180" Title="Search order &quot;Score&quot; criteria" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2377" PostTypeId="1" AcceptedAnswerId="29000" CreationDate="2014-09-05T08:19:12.663" Score="7" ViewCount="1598" Body="&lt;p&gt;I would like to output a tag-list like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;foo, bar and baz&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to elegantly output a tag list with no comma after the last tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;    {{ tag }}{{ not loop.last ? ', ' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a similarly elegant solution for getting the tags to display the way I want?&lt;/p&gt;&#xA;" OwnerUserId="327" LastActivityDate="2019-01-04T10:35:05.220" Title="How do I display tags comma separated with &quot;and&quot; between the last two tags?" Tags="&lt;templating&gt;&lt;tags&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2378" PostTypeId="2" ParentId="2377" CreationDate="2014-09-05T08:47:47.693" Score="6" Body="&lt;p&gt;Not very elegant, but... :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;    {{ tag.type }}{{ loop.index &amp;lt; loop.length-1 ? ', ' : loop.index &amp;lt; loop.length ? ' and' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-05T08:47:47.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2380" PostTypeId="5" CreationDate="2014-09-05T10:41:57.323" Score="0" Body="&lt;p&gt;For questions about singles, one of Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Section Types&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Used for one-off pages, like your Homepage, which likely has a unique set of fields and a URL that doesn’t necessarily fall in line with other entries’ URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike the other section types, Singles only have one entry associated with them, and they don’t have an editable Author, Slug, Post Date, or Expiration Date.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="6007" LastEditDate="2019-12-06T21:07:48.697" LastActivityDate="2019-12-06T21:07:48.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2381" PostTypeId="4" CreationDate="2014-09-05T10:41:57.323" Score="0" Body="For questions about singles, one of Craft's Section Types." OwnerUserId="142" LastEditorUserId="6007" LastEditDate="2020-02-06T19:32:48.330" LastActivityDate="2020-02-06T19:32:48.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2382" PostTypeId="5" CreationDate="2014-09-05T10:50:33.833" Score="0" Body="&lt;p&gt;For more information visit the &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;Craft Docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2014-09-05T15:34:12.300" LastActivityDate="2014-09-05T15:34:12.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2383" PostTypeId="4" CreationDate="2014-09-05T10:50:33.833" Score="0" Body="Config setting which allows the developer greater visibility of Errors/Warnings, more detailed logging and access to developer tools such as Twig's dump() function." OwnerUserId="142" LastEditorUserId="142" LastEditDate="2014-09-05T15:33:41.933" LastActivityDate="2014-09-05T15:33:41.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2384" PostTypeId="5" CreationDate="2014-09-05T10:55:26.140" Score="0" Body="&lt;p&gt;For more information visit &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Barrel Strength&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2014-09-05T15:33:58.393" LastActivityDate="2014-09-05T15:33:58.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2385" PostTypeId="4" CreationDate="2014-09-05T10:55:26.140" Score="0" Body="Commercial Forms Plugin from Barrel Strength Design." OwnerUserId="142" LastEditorUserId="142" LastEditDate="2014-09-05T15:34:47.843" LastActivityDate="2014-09-05T15:34:47.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2386" PostTypeId="1" CreationDate="2014-09-05T11:20:21.130" Score="2" ViewCount="541" Body="&lt;p&gt;Wondering how to write a conditional that was dependent on the length of a plain text field within a matrix field. I  have something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pricing %}&#xA;    &amp;lt;li&amp;gt;{% if block.destination|length &amp;gt; 25 %}TEST{% endif %}{{ block.smallCost }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I’m trying to add TEST if the length of the string of block.destination is more than 25. &lt;/p&gt;&#xA;" OwnerUserId="478" LastActivityDate="2014-09-05T16:47:48.427" Title="Plain Text Length Conditional" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2387" PostTypeId="1" AcceptedAnswerId="2388" CreationDate="2014-09-05T11:51:41.930" Score="6" ViewCount="4052" Body="&lt;p&gt;Should I create a Single for the blog home page content (/blog) and then a Channel to hold the entries (/blog/{slug})?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blog index page also needs to have non blog entries on, i.e. intro text describing what the blog is about.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="122" LastEditDate="2014-09-05T15:04:44.647" LastActivityDate="2020-01-03T23:20:28.510" Title="What's the right way to create a simple blog in Craft?" Tags="&lt;channels&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2388" PostTypeId="2" ParentId="2387" CreationDate="2014-09-05T14:09:45.963" Score="5" Body="&lt;p&gt;A &lt;em&gt;Channel&lt;/em&gt; called &lt;em&gt;Blog&lt;/em&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry URL Format: blog/{slug}&lt;/li&gt;&#xA;&lt;li&gt;Entry Template: blog/_entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In blog/_entry.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;{{ entry.title }}&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;        {{ entry.body }}&#xA;        &amp;lt;p&amp;gt;Written by {{ entry.author }} on {{ entry.postDate|date('M d, Y') }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't &lt;em&gt;need&lt;/em&gt; to create a &lt;em&gt;Single&lt;/em&gt; for the Blog index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just create a template file: blog/index.html with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Blog&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% for entry in craft.entries.section('blog').find() %}&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            {{ entry.body }}&#xA;            &amp;lt;p&amp;gt;Written by {{ entry.author }} on {{ entry.postDate|date('M d, Y') }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is a requirement for end users to be able to publish and edit content, other than blog entries, appearing on Blog index page via the CP, then a Single is the way to go.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create custom field(s).&lt;/li&gt;&#xA;&lt;li&gt;Create &lt;em&gt;Single&lt;/em&gt; called &lt;em&gt;Blog Index,&lt;/em&gt; or &lt;em&gt;Blog Homepage&lt;/em&gt;, or something other than &lt;em&gt;Blog&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Add custom field(s) to Blog Single entry type.&lt;/li&gt;&#xA;&lt;li&gt;Entry Template: blog/index&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In blog/index.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Blog&quot; %}&#xA;&#xA;{% block content %}&#xA;    {{ entry.customField }}&#xA;&#xA;    {% for entry in craft.entries.section('blog').find() %}&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            {{ entry.body }}&#xA;            &amp;lt;p&amp;gt;Written by {{ entry.author }} on {{ entry.postDate|date('M d, Y') }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="298" LastEditorUserId="-1" LastEditDate="2020-01-03T23:20:28.510" LastActivityDate="2020-01-03T23:20:28.510" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2389" PostTypeId="2" ParentId="2375" CreationDate="2014-09-05T14:55:53.113" Score="37" Body="&lt;p&gt;More of a &quot;How do I debug stuck tasks&quot; answer, but it should help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open up your craft_tasks table. You'll see one task in with a 'status' of 'running' and if you refresh the table several times, the 'currentStep' value for that task is no longer incrementing.  That's your stuck task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set that task's status to 'pending', and reload any page in the control panel to re-trigger the task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it gets stuck again, immediately go to your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder and check for a &lt;code&gt;phperrors.log&lt;/code&gt; file.  If that exists, it will likely hold the error message for why the task is hung.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;90% of the time, when a task gets stuck, it's because it has ran into some environmental limitation (PHP max_execution_time, memory_limit, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just added a help article for this here: &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2017-08-24T04:52:49.300" LastActivityDate="2017-08-24T04:52:49.300" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2390" PostTypeId="2" ParentId="2386" CreationDate="2014-09-05T16:47:48.427" Score="1" Body="&lt;p&gt;Turns out it needs the space in the conditional either side of the vertical bar so the code should’ve been:                 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;{% if block.destination | length &amp;gt; 25 %}&amp;lt;br /&amp;gt;{% endif %} {{ block.smallCost }}&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="478" LastActivityDate="2014-09-05T16:47:48.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2391" PostTypeId="1" AcceptedAnswerId="2395" CreationDate="2014-09-05T17:42:03.543" Score="1" ViewCount="1062" Body="&lt;p&gt;As of Craft 2.2 build 2579 / 2581  I get an error upon save for entires in a section that uses postDate in the URL and in the {slug}&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CException  Craft\MatrixBlockModel and its behaviors do not have a&#xA;  method or closure named &quot;postDate&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Removing postDate from slug didn't eliminate error.  Also noticed that system wanted to change postDate in slug when editing older entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;**Any possible work arounds for this? **&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;--------------------------------------------------------&lt;/h2&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/www/Sites/craft.dev/craft/app/framework/base/CComponent.php(266)&lt;/strong&gt;    &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;266         throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named &quot;{name}&quot;.',&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stack Trace&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#0  &#xA;+  /www/Sites/craft.dev/craft/app/models/BaseModel.php(124): CComponent-&amp;gt;__call(&quot;postDate&quot;, array())&#xA;#1  &#xA; unknown(0): Craft\BaseModel-&amp;gt;__call(&quot;postDate&quot;, array())&#xA;#2  &#xA; unknown(0): Craft\MatrixBlockModel-&amp;gt;postDate()&#xA;#3  &#xA;+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(461): call_user_func_array(array(Craft\MatrixBlockModel, &quot;postDate&quot;), array())&#xA;#4  &#xA;+  /www/Sites/craft.dev/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Craft\MatrixBlockModel, &quot;postDate&quot;, array(), &quot;any&quot;, ...)&#xA;#5  &#xA;+  /www/Sites/craft.dev/craft/storage/runtime/compiled_templates/30/9d/6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211.php(19): Craft\BaseTemplate-&amp;gt;getAttribute(Craft\MatrixBlockModel, &quot;postDate&quot;)&#xA;#6  &#xA;+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_309d6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211-&amp;gt;doDisplay(array(&quot;object&quot; =&amp;gt; Craft\MatrixBlockModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array())&#xA;#7  &#xA;+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;object&quot; =&amp;gt; Craft\MatrixBlockModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array())&#xA;#8  &#xA;+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(array(&quot;object&quot; =&amp;gt; Craft\MatrixBlockModel))&#xA;#9  &#xA;+  /www/Sites/craft.dev/craft/app/services/TemplatesService.php(309): Twig_Template-&amp;gt;render(array(&quot;object&quot; =&amp;gt; Craft\MatrixBlockModel))&#xA;#10 &#xA;+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(407): Craft\TemplatesService-&amp;gt;renderObjectTemplate(&quot;{postDate.year}/{postDate.month}&quot;, Craft\MatrixBlockModel)&#xA;#11 &#xA;+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(203): Craft\AssetsFieldType-&amp;gt;_resolveSourcePathToFolderId(&quot;1&quot;, &quot;{postDate.year}/{postDate.month}/&quot;)&#xA;#12 &#xA;+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\AssetsFieldType-&amp;gt;onAfterElementSave()&#xA;#13 &#xA;+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(701): Craft\ElementsService-&amp;gt;saveElement(Craft\MatrixBlockModel, false)&#xA;#14 &#xA;+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(802): Craft\MatrixService-&amp;gt;saveBlock(Craft\MatrixBlockModel, false)&#xA;#15 &#xA;+  /www/Sites/craft.dev/craft/app/fieldtypes/MatrixFieldType.php(467): Craft\MatrixService-&amp;gt;saveField(Craft\MatrixFieldType)&#xA;#16 &#xA;+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\MatrixFieldType-&amp;gt;onAfterElementSave()&#xA;#17 &#xA;+  /www/Sites/craft.dev/craft/app/services/EntriesService.php(167): Craft\ElementsService-&amp;gt;saveElement(Craft\EntryModel)&#xA;#18 &#xA;+  /www/Sites/craft.dev/craft/app/controllers/EntriesController.php(479): Craft\EntriesService-&amp;gt;saveEntry(Craft\EntryModel)&#xA;#19 &#xA;+  /www/Sites/craft.dev/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;#20 &#xA;+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;p&quot; =&amp;gt; &quot;admin/entries/daily/56-daily-edition-for-2014-5-19&quot;))&#xA;#21 &#xA;+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(CInlineAction)&#xA;#22 &#xA;+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(CInlineAction, null)&#xA;#23 &#xA;+  /www/Sites/craft.dev/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run(&quot;saveEntry&quot;)&#xA;#24 &#xA;+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(899): CWebApplication-&amp;gt;runController(&quot;entries/saveEntry&quot;)&#xA;#25 &#xA;+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(272): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#26 &#xA;+  /www/Sites/craft.dev/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#27 &#xA;+  /www/Sites/craft.dev/craft/app/index.php(35): CApplication-&amp;gt;run()&#xA;#28 &#xA;–  /Users/jball/Sites/craft.dev/public/index.php(14): require_once(&quot;/www/Sites/craft.dev/craft/app/index.php&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="232" LastActivityDate="2014-09-05T22:46:23.600" Title="CException Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;postDate&quot;" Tags="&lt;matrix&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2392" PostTypeId="1" AcceptedAnswerId="2394" CreationDate="2014-09-05T18:23:50.913" Score="2" ViewCount="77" Body="&lt;p&gt;I have a global set called socialNetworkContent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to setup a conditional to check whether any of the fields within this set have content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the section wouldn't display if all the fields were blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something along these lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if socialNetworkContent|length %}&#xA;&amp;lt;section&amp;gt;&#xA;&amp;lt;div class=&quot;social&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Follow Us&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;            {% if socialNetworkContent.branchFacebookProfile|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchFacebookProfile }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-facebook fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;            {% if socialNetworkContent.branchTwitterAccount|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchTwitterAccount }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-twitter fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;            {% if socialNetworkContent.branchLinkedInAccount|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchLinkedInAccount }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-linkedin fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;            {% if socialNetworkContent.branchGooglePlusAccount|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchGooglePlusAccount }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-google-plus fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;            {% if socialNetworkContent.branchInstagramAccount|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchInstagramAccount }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-instagram fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;            {% if socialNetworkContent.branchYoutubeAccount|length %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialNetworkContent.branchYoutubeAccount }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-youtube fa-2x&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2014-09-05T19:58:32.477" Title="Is there a way to check if any fields in a global set have content?" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2393" PostTypeId="1" CreationDate="2014-09-05T19:39:49.473" Score="4" ViewCount="107" Body="&lt;p&gt;So basically, my url is mysite.com/blog which should apparently lead to /blog/index.html which is stored under templates/blog/index.html. As far as I can see I don't need to set up any routes to make it work and it should be happening as standard. I'm working in a multisite environment, and may have done some damage there? I basically need to know where the error will be coming from, .htaccess/index.php etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="765" LastActivityDate="2014-09-06T19:43:48.663" Title="Why is /blog not displaying /blog/index.html?" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2394" PostTypeId="2" ParentId="2392" CreationDate="2014-09-05T19:58:32.477" Score="2" Body="&lt;p&gt;It's not exactly &quot;quick&quot;, you'll have to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if socialNetworkContent.branchFacebookProfile|length &#xA;       or socialNetworkContent.branchTwitterAccount|length&#xA;       or socialNetworkContent.branchLinkedInAccount|length&#xA;       ...&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is probably exactly what you're trying to avoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to just make it a little easier to read, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set x = socialNetworkContent %}&#xA;&#xA;{% if x.branchFacebookProfile|length &#xA;       or x.branchTwitterAccount|length&#xA;       or x.branchLinkedInAccount|length&#xA;       ...&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The hurdle that you're dealing with is the fact that the &lt;code&gt;socialNetworkContent&lt;/code&gt; object contains many other attributes besides just your custom field names. So there's not really any efficient way to &quot;loop through&quot; your custom fields without dealing with a bunch of extra junk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you could build a plugin to create a simple boolean variable, but that sounds like overkill for this situation.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-05T19:58:32.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2395" PostTypeId="2" ParentId="2391" CreationDate="2014-09-05T22:46:23.600" Score="3" Body="&lt;p&gt;Looks like maybe you have an Assets field within a Matrix field, which has the dynamic subpath set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{postDate.year}/{postDate.month}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as the error suggests, Matrix blocks don’t have post dates. They have an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/MatrixBlockModel#owner&quot; rel=&quot;nofollow&quot;&gt;owner&lt;/a&gt;, though, and that owner will have a post date, if it's an entry. So you should use this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{owner.postDate.year}/{owner.postDate.month}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{owner.postDate|date('Y/n')}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-05T22:46:23.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2396" PostTypeId="2" ParentId="2372" CreationDate="2014-09-05T23:34:56.100" Score="1" Body="&lt;p&gt;Try something like this (completely untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all categories in the group and set variable. #}&#xA;{% set categories = craft.categories.group('designCategories') %}&#xA;&#xA;{# Grab the categories Ids that the user already selected #}&#xA;{% set userOptionIds = user.designOptions.limit(null).ids() %}&#xA;&#xA;{# Display all category checkboxes in the form, with the logged in user's saved selections already checked.#}&#xA;{% for category in categories %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;designOptions&quot; name=&quot;fields[designsOptions][]&quot; {% if category.id in userOptionIds %}checked{% endif %} value=&quot; {{ category.id }}&quot;&amp;gt;&#xA;        {{ category.title }}&#xA;    &amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-05T23:34:56.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2398" PostTypeId="2" ParentId="2374" CreationDate="2014-09-06T04:32:11.603" Score="1" Body="&lt;p&gt;Andrew, you could always use Whoops. &lt;a href=&quot;https://github.com/filp/whoops&quot; rel=&quot;nofollow&quot;&gt;https://github.com/filp/whoops&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do is just install Whoops through composer in your plugin directory (here is an example of my composer.json file (&lt;a href=&quot;http://d.pr/i/trWp&quot; rel=&quot;nofollow&quot;&gt;http://d.pr/i/trWp&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could include this within your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;include(CRAFT_BASE_PATH . 'plugins/(your directory)/vendor/autoload.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's basically it. Here is an example of an exception thrown within my plugin with a full stack trace. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://d.pr/i/Ar8v&quot; rel=&quot;nofollow&quot;&gt;http://d.pr/i/Ar8v&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2014-09-06T04:32:11.603" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2399" PostTypeId="1" AcceptedAnswerId="2434" CreationDate="2014-09-06T05:31:23.167" Score="2" ViewCount="306" Body="&lt;p&gt;I need to have a JavaScript event that is triggered when the parent tab of my field type instance is shown on the entry form. So if the field is on the second tab, the div is hidden on instantiation. The div is obviously shown once the parent tab is clicked. I need this event to reset the map in my field type. If a map is instantiated with a hidden div, it must be redrawn before it can be displayed properly. So when the div displays (after the parent tab click) I need to trigger the method to redraw the map. Is there a JavaScript event available for this and if so, how would I use it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If no such event exists and if one can't be added, I guess the only other way would be to try to traverse the DOM and add click events to the respective tabs. This feels kind of like a hack though and would break if the DOM changes.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-09-08T17:43:52.207" Title="Is there a JavaScript event available for when the parent tab of a custom field is shown?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2400" PostTypeId="2" ParentId="692" CreationDate="2014-09-06T12:45:52.037" Score="2" Body="&lt;p&gt;I use Victor In's &quot;getName&quot; function with a minor addition of a check of the type of value returned. I do this because without the value check, I get an error when I try to uninstall a plugin without confirming the value is a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my version of the function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getName() {&#xA;    $name = $this-&amp;gt;getSettings()-&amp;gt;name;&#xA;    if (is_string($name) ){&#xA;        return $name;&#xA;    } else {&#xA;        return Craft::t( 'My Default Plugin Name Here' );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="349" LastActivityDate="2014-09-06T12:45:52.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2401" PostTypeId="2" ParentId="590" CreationDate="2014-09-06T14:56:26.260" Score="5" Body="&lt;p&gt;I know this has been answered already, but here's my code for showing the children of the current parent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.getParent(entry)|length %}&#xA;{% set subMenu = craft.entries.descendantOf(entry.getParent(entry)) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav link in subMenu %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{link.getUrl}}&quot;&amp;gt;{{link.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="103" LastEditDate="2015-02-25T02:58:34.760" LastActivityDate="2015-02-25T02:58:34.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2402" PostTypeId="2" ParentId="2374" CreationDate="2014-09-06T17:18:07.410" Score="2" Body="&lt;p&gt;I can confirm that Win8.1 + PHPStorm + xDebug and plugin code works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you symlink'ing (using mklink in Windows) to your plugin code by chance? xDebug won't follow symlink's by default and at least in PHPStorm, you have to explicitly setup the path mapping in your project's settings to tell PHPStorm/xDebug where the &lt;em&gt;actual&lt;/em&gt; paths to your symlink'ed files live.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-06T22:42:45.107" LastActivityDate="2014-09-06T22:42:45.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2403" PostTypeId="2" ParentId="2393" CreationDate="2014-09-06T17:26:50.990" Score="1" Body="&lt;p&gt;Check for a blog.html file in the root of templates, craft would go to that first then check for a subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;the process that Craft follows&lt;/a&gt; when deciding how to handle a request.&lt;/p&gt;&#xA;" OwnerUserId="766" LastEditorUserId="45" LastEditDate="2014-09-06T19:43:48.663" LastActivityDate="2014-09-06T19:43:48.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2404" PostTypeId="1" AcceptedAnswerId="2407" CreationDate="2014-09-06T21:05:59.623" Score="5" ViewCount="466" Body="&lt;p&gt;I dont't currently need a home page on the personal site I'm working on but I want to be able to keep the option open in the future. I currently have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect 'portfolio' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as the only code on the index page but Craft seems to take a while before it redirects to the portfolio page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a rewrite rule and while it worked it doesn't change the URL and I didn't see much difference in the time it took to load the page. In fact, it seemed to take longer on my local machine running MAMP Pro 3 then the redirect tag did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also looked into &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot;&gt;Reroute plug-in by Trevor Davis&lt;/a&gt; which seemed to work about as well as the redirect tag, maybe slightly better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts as to which is a better approach and why a simple index page with a redirect tag on it would take so long to process?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-09-06T22:51:01.817" Title="What's the most efficient way to handle a redirect of the home page?" Tags="&lt;redirect&gt;&lt;reroute&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2405" PostTypeId="1" AcceptedAnswerId="2406" CreationDate="2014-09-06T21:30:42.010" Score="4" ViewCount="650" Body="&lt;p&gt;I am trying to instantiate a class from a third-party library from within a controller. Probably not the best place to do this but just testing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require(craft()-&amp;gt;path-&amp;gt;getPluginsPath().'myplugin/vendor/ifpk/src/fsdk.php');&#xA;&#xA;$app = new fSDK;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Class 'Craft\fSDK' not found in /var/www/.../controllers/MyPluginController.php on line 57&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure where to go with this next.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-06T22:12:42.910" Title="Registering a class library within a plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2406" PostTypeId="2" ParentId="2405" CreationDate="2014-09-06T22:05:42.560" Score="8" Body="&lt;p&gt;Through the magic of PHP namespacing, all plugins fall under the &lt;code&gt;Craft&lt;/code&gt; parent class by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're accessing a library outside of the &lt;code&gt;Craft&lt;/code&gt; scope, you'll need to prepend a backslash to your library's class name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$app = new \fSDK;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-09-06T22:12:42.910" LastActivityDate="2014-09-06T22:12:42.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2407" PostTypeId="2" ParentId="2404" CreationDate="2014-09-06T22:51:01.817" Score="4" Body="&lt;p&gt;.htaccess should &lt;em&gt;always&lt;/em&gt; be faster because it doesn't involve PHP or Craft at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on top of that the {% redirect %} tag should be pretty darn quick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon hitting it, Craft immediately calls Yii's &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.15/framework/web/CHttpRequest.php#L799&quot; rel=&quot;nofollow&quot;&gt;CHttpRequest-&gt;redirect()&lt;/a&gt;, which sets the redirect header and terminates the current request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-06T22:51:01.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2408" PostTypeId="1" AcceptedAnswerId="2411" CreationDate="2014-09-07T13:27:33.077" Score="2" ViewCount="90" Body="&lt;p&gt;I've imported Wordpress comments into a post type called 'comments' in a section called 'interactions'. I have the slug stored in 'relatedPostSlug'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I relate the 'relatedPostSlug' to the actual posts with that slug?&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-09-07T15:21:20.220" Title="Can I Relate Afterwards" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2409" PostTypeId="1" AcceptedAnswerId="2415" CreationDate="2014-09-07T14:01:16.777" Score="2" ViewCount="288" Body="&lt;p&gt;I have a plugin with a record (and model). The record have attributes &lt;strong&gt;uri&lt;/strong&gt; and &lt;strong&gt;hits&lt;/strong&gt;. The &lt;strong&gt;uri&lt;/strong&gt; attribute in my record corresponds to an entry's uri, as stored in the craft_elements_i18n table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most efficient way to return entries with the uris I have stored, sorted on &lt;strong&gt;hits&lt;/strong&gt;? Is there a way to join the uri attribute in my record with the uri in the craft_elements_i18n table, and return entry data and hits in one go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I have this, which does the job but isn't very efficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$results = $this-&amp;gt;queryResultRecord-&amp;gt;getQueryResultsBySetId($querySet-&amp;gt;id);&#xA;&#xA;if ($results) {&#xA;    foreach ($results as $result) {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;uri = $result-&amp;gt;uri;&#xA;        $entries = $criteria-&amp;gt;find();&#xA;&#xA;        if ($entries) {&#xA;            $entry = $entries[0];&#xA;            $return[] = array('entry'=&amp;gt;$entry, 'hits'=&amp;gt;$result-&amp;gt;hits);&#xA;        } &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;getQueryResultsBySetId&lt;/code&gt; method return the data from my record sorted by hits. The &lt;code&gt;$return&lt;/code&gt; variable is returned back to my frontend templates where I can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for result in results %}&#xA;    {{ result.entry.title }} - {{ result.hits }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-07T19:33:23.663" Title="How can I join plugin data with entry data based on uri?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;sorting&gt;&lt;records&gt;&lt;join&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2410" PostTypeId="1" AcceptedAnswerId="2412" CreationDate="2014-09-07T14:01:37.127" Score="4" ViewCount="874" Body="&lt;p&gt;how do I able to track the visit number of entry?&#xA;Something like track view in Expression Engine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have try to find but don't have any source.&lt;/p&gt;&#xA;" OwnerUserId="768" LastActivityDate="2017-01-13T05:52:26.627" Title="How to track entry visit?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2411" PostTypeId="2" ParentId="2408" CreationDate="2014-09-07T15:21:20.220" Score="2" Body="&lt;p&gt;If you want to leave the data as-is, you could just fetch the “related” interaction entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for interaction in craft.entries.section('interactions').relatedPostSlug(enry.slug) %}&#xA;    {{ interaction.comment }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-07T15:21:20.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2412" PostTypeId="2" ParentId="2410" CreationDate="2014-09-07T16:06:47.673" Score="3" Body="&lt;p&gt;Check out the &lt;em&gt;Craft Entry Count&lt;/em&gt; plugin by Ben Croker...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/putyourlightson/craft-entry-count&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Counting entry views is exactly what that plugin does.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="5437" LastEditDate="2017-01-13T05:52:26.627" LastActivityDate="2017-01-13T05:52:26.627" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2413" PostTypeId="1" AcceptedAnswerId="2414" CreationDate="2014-09-07T17:12:24.770" Score="9" ViewCount="3765" Body="&lt;p&gt;Structures look interesting because you can reorder entries manually, generate breadcrumbs and visually see a hierarchy of entries. Besides this, what are the primary consideration when choosing a Structure over a Channel?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2014-09-07T18:19:17.647" Title="When to choose a Structure over a Channel?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2414" PostTypeId="2" ParentId="2413" CreationDate="2014-09-07T18:19:17.647" Score="9" Body="&lt;p&gt;Ordering and Hierarchy are the main benefits but they create a couple of side benefits such as the ability to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;get the &quot;children&quot; and &quot;parents&quot; of an entry&lt;/li&gt;&#xA;&lt;li&gt;get siblings including next and previous siblings&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The best part is there no real downside, they have all the features and functions of a regular channel PLUS the structure.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-09-07T18:19:17.647" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2415" PostTypeId="2" ParentId="2409" CreationDate="2014-09-07T19:33:23.663" Score="3" Body="&lt;p&gt;You could of course manually create a select query with a join that fetches entries ordered by hits descending, however you will basically be recreating what &lt;em&gt;$criteria-&gt;find()&lt;/em&gt; does above. I imagine this will introduce an almost negligible performance improvement, but it really depends on how many entries you are returning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code should give you a starting point:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;from('pluginTable pluginTable')&#xA;    -&amp;gt;join('elements_i18n elements_i18n', 'elements_i18n.uri = pluginTable.uri')&#xA;    -&amp;gt;join(...)&#xA;    -&amp;gt;order('pluginTable.hits desc');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-09-07T19:33:23.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2416" PostTypeId="1" AcceptedAnswerId="2417" CreationDate="2014-09-07T20:00:16.940" Score="7" ViewCount="1715" Body="&lt;p&gt;How can I conditionally display content if its a specific section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm trying this with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section == 'lettings' %}{{ entry.rentFrequency.label }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2014-09-07T20:03:24.920" Title="Conditionally Display Content if Section" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2417" PostTypeId="2" ParentId="2416" CreationDate="2014-09-07T20:03:24.920" Score="10" Body="&lt;p&gt;You're close!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/SectionModel&quot;&gt;SectionModel&lt;/a&gt; has '&lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/SectionModel.php#L182&quot;&gt;name&lt;/a&gt;' and '&lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/SectionModel.php#L183&quot;&gt;handle&lt;/a&gt;' attributes and one of those is probably what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section.handle == 'lettings' %}&#xA;    {{ entry.rentFrequency.label }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-07T20:03:24.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2418" PostTypeId="1" AcceptedAnswerId="2422" CreationDate="2014-09-08T09:04:59.213" Score="4" ViewCount="950" Body="&lt;p&gt;We are building a multilingual site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have different domains and slugs for German and English pages/sections  i.e. &lt;code&gt;projects&lt;/code&gt; is called &lt;code&gt;projekte&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now the template used is called &quot;projects.html&quot; which we want to use for all languages, but Craft is looking for each slug's language template and not the English one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we need to duplicate each template or?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="57" LastEditDate="2014-09-08T16:58:55.493" LastActivityDate="2014-09-09T08:45:47.633" Title="Don't use localized slugs for templates" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2419" PostTypeId="1" CreationDate="2014-09-08T09:36:26.900" Score="3" ViewCount="623" Body="&lt;p&gt;I have a section 'people' which has several related entries such as 'sibling', 'spouse', 'offspring', etc. When creating a new 'person' the user has to set up these relationships. I understand that's it's possible to easily look up a persons relations in either direction as per &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/relations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is it possible to reflect this in the CMS? So, when a person is related to another via 'spouse' it shows up for &lt;em&gt;both&lt;/em&gt; people automatically? Currently, the user would have to do this manually.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-01-15T19:31:58.420" Title="Two-way relations" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2420" PostTypeId="2" ParentId="2419" CreationDate="2014-09-08T10:37:00.997" Score="3" Body="&lt;p&gt;It's not possible natively in Craft, but have look at the &lt;a href=&quot;https://github.com/page-8/craft-manytomany&quot; rel=&quot;nofollow&quot;&gt;Many-to-many plugin from Page 8&lt;/a&gt;. It might not be exactly what you're after, since it assumes that you have a relationship field in one channel, and the many-to-many field in another. But maybe you can figure out a way to adapt it to your case.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-08T10:37:00.997" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2421" PostTypeId="1" CreationDate="2014-09-08T11:59:48.283" Score="2" ViewCount="123" Body="&lt;p&gt;From my plugin, I know I can use ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;renderObjectTemplate($string, $entry)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... to parse, for example, { belongsTo.first.fullName } to the full name of the first user in the belongsTo field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I need an easy way to parse { belongsTo.find } into an array with all users related to this belongsTo field. Is there an easy way to do this, or should I let my plugin do the work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background information&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My custom notification plugin has a settings field where I can set the 'receivers' of a notification. If an entry has a user field called 'belongsTo', and the setting is { belongsTo.find }, I need all the users related to this field, so I can further process the notification.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-08T18:21:17.907" Title="How can I 'Parse' { entry.belongsTo } to array with users?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2422" PostTypeId="2" ParentId="2418" CreationDate="2014-09-08T14:03:16.603" Score="4" Body="&lt;p&gt;You can create new template files for your second locale and simply use Twig include to only maintain one template for all of your locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;projekte.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'projects.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use a locale specific subfolder (craft/templates/de/) to separate the german templates from your main / first locale templates (see the &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview#template-localization&quot; rel=&quot;nofollow&quot;&gt;Template Localization&lt;/a&gt; article in the Docs on how this works).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to handle localized URIs is to not use &quot;URI to template matching&quot; (pt. 6 in the &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing&lt;/a&gt; article) but configure an entry that loads your template instead (pt. 4). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a single section with &quot;projects.html&quot; for the template that should get loaded if the single's URL is requested. The template's filename is irrelevant for the URI matching and you can set the entry's slug to whatever you want in both of your locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before creating many single sections now, also consider using a &quot;Pages&quot; structure section instead.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-09-08T14:03:16.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2423" PostTypeId="1" AcceptedAnswerId="2431" CreationDate="2014-09-08T14:14:41.760" Score="8" ViewCount="4658" Body="&lt;p&gt;Is there any way to save a variable in the Craft session inside a controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running a cron job and I need to store a variable as a session for every run to see if a condition matches.&lt;/p&gt;&#xA;" OwnerUserId="435" LastEditorUserId="57" LastEditDate="2014-09-08T16:53:16.337" LastActivityDate="2020-04-09T10:04:55.177" Title="Can you save a variable in session?" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2424" PostTypeId="2" ParentId="2421" CreationDate="2014-09-08T14:49:19.327" Score="2" Body="&lt;p&gt;You should be able to use the full Twig tag for what you want to do.  Perhaps something like the following (which assumes you have an &lt;code&gt;email&lt;/code&gt; field you are trying to output for each user and want to separate your emails by a comma):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for person in object.belongsTo %}{{ person.email }}{% if not loop.last %},{% endif %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;renderObjectTemplate&lt;/code&gt; should parse both the abbreviated syntax with a single curly brace or complete Twig tags.  To take a close look, the abbreviated syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ belongsTo.first.fullName }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is being interpreted by Craft as the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.belongsTo.first.fullName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-09-08T18:21:17.907" LastActivityDate="2014-09-08T18:21:17.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2425" PostTypeId="1" AcceptedAnswerId="2427" CreationDate="2014-09-08T15:23:45.117" Score="2" ViewCount="529" Body="&lt;p&gt;This may not be the most efficient approach for this specific case but I'm trying to learn how this might be done for other similar problems I might run across in the future so bear with me here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Global that creates links to social media sites on my profile page. My fields include icon (asset), name (text), url (text), and color (color). I have included the following at the top of my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set buttonCSS %}&#xA;    {% for block in contactLinks.contactLinks.type(&quot;contactLink&quot;) %}&#xA;    .{{ block.contactLinkName | lower }}:hover {&#xA;        background-color: {{ block.buttonColor }}&#xA;    }&#xA;    {% endfor %}&#xA;{% endset %}&#xA;&#xA;{% includeCss buttonCSS %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This generates dynamic styles for each button at the top of my profile page so I can add links. My template then generates the links:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in contactLinks.contactLinks.type(&quot;contactLink&quot;) %}&#xA;&amp;lt;a href=&quot;{{ block.contactLinkUrl | entities }}&quot; class=&quot;contact_link {{ block.contactLinkName | lower }}{% if loop.last %} last{% endif %}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ block.contactLinkIcon.first().url }}&quot; class=&quot;contact_link_image&quot; /&amp;gt;&amp;lt;p class=&quot;contact_link_text&quot;&amp;gt;{{ block.contactLinkName }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, for the most part this works since social media sites tend to be one word but when I tried to use &quot;Let's Talk&quot; for my email link I run into problems with the CSS. What's the best way to strip the apostrophe and spaces from my class names?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-09-23T14:41:36.543" Title="Need to create dynamic CSS names for buttons" Tags="&lt;templating&gt;&lt;filter&gt;&lt;css&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2426" PostTypeId="2" ParentId="2425" CreationDate="2014-09-08T15:57:56.283" Score="1" Body="&lt;p&gt;You could use the twig replace&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/filters/replace.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.contactLinkName | replace({' ': -}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-09-08T15:57:56.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2427" PostTypeId="2" ParentId="2425" CreationDate="2014-09-08T16:07:36.420" Score="2" Body="&lt;p&gt;You can chain filters to achieve what you want. &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;The example for the twig replace filter in the Craft docs&lt;/a&gt; shows this in action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.contactLinkName | lower }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.contactLinkName | lower | replace('/ /', '-') | replace(&quot;'&quot;,&quot;&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2014-09-23T14:41:36.543" LastActivityDate="2014-09-23T14:41:36.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2428" PostTypeId="1" CreationDate="2014-09-08T16:16:30.877" Score="3" ViewCount="810" Body="&lt;p&gt;I've got a multi-environment setup working well for my database - that was easy to setup and i've had no issues getting it to work. Now i'm trying to set the siteUrl as a multi-config variable and no luck. I have this in general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '.dev' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'siteUrl'  =&amp;gt; 'http://mysite.dev:8888',&#xA;    )&#xA;  ),&#xA;  '.org' =&amp;gt; array(&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'siteUrl'  =&amp;gt; 'http://mysite.org',&#xA;    )&#xA;  )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and i've set &quot;Site URL&quot; in settings &gt; General Settings to {siteUrl}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the problem is, now when I load the front-end of my site, it is outputting my links with {siteURL} written out as the actual links, eg&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{siteUrl}/about#start&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All the documentation and posts I can find seem to imply that this is all I should have to do. Any idea what's missing?&lt;/p&gt;&#xA;" OwnerUserId="715" LastActivityDate="2014-09-08T18:08:47.170" Title="multi-environment config for {siteURL} not working" Tags="&lt;url&gt;&lt;multi-environment&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2429" PostTypeId="1" AcceptedAnswerId="2430" CreationDate="2014-09-08T16:35:11.433" Score="2" ViewCount="242" Body="&lt;p&gt;Just wondered if there's a quick way to see if a specific tag exists from anywhere in the site (by ID)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm creating a navigation bar, and need to include a specific tag... only if it has been created/used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers, Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2019-01-20T00:57:42.013" Title="Quick check to see if tag exists?" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2430" PostTypeId="2" ParentId="2429" CreationDate="2014-09-08T16:48:17.527" Score="3" Body="&lt;p&gt;This should get you going in the right direction: &lt;a href=&quot;https://craftcms.com/guides/displaying-tags-that-are-in-use&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/displaying-tags-that-are-in-use&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2019-01-20T00:57:42.013" LastActivityDate="2019-01-20T00:57:42.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2431" PostTypeId="2" ParentId="2423" CreationDate="2014-09-08T16:57:33.527" Score="12" Body="&lt;p&gt;Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpSessionService&quot;&gt;HttpSessionService&lt;/a&gt; is a thin wrapper for PHP's global $_SESSION variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add($key, $value)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;get($key)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to save and retrieve values from it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-08T16:57:33.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2432" PostTypeId="2" ParentId="2425" CreationDate="2014-09-08T17:08:17.840" Score="3" Body="&lt;p&gt;I would use the &lt;a href=&quot;https://gist.github.com/boboldehampsink/7354431&quot; rel=&quot;nofollow&quot;&gt;slugify&lt;/a&gt; twig filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.contactLinkName | slugify }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will handle apostrophies, spaces, and anything else that might come along.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-08T17:08:17.840" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2433" PostTypeId="2" ParentId="2428" CreationDate="2014-09-08T17:27:27.837" Score="5" Body="&lt;p&gt;Multi-environment configs &lt;strong&gt;require&lt;/strong&gt; you to create a &lt;code&gt;'*'&lt;/code&gt; config array, even if it’s empty because there aren’t any config settings that you need to set globally. Simply having that &lt;code&gt;'*'&lt;/code&gt; array is how Craft is able to determine that this is a multi-environment config, as opposed to &lt;code&gt;'.dev'&lt;/code&gt; and &lt;code&gt;'.org'&lt;/code&gt; just being normal config settings. (See the warning on &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        // It's OK if this is empty, as long as it's here.&#xA;    ),&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; 'http://mysite.dev:8888',&#xA;        )&#xA;    ),&#xA;&#xA;    '.org' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; 'http://mysite.org',&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-08T17:27:27.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2434" PostTypeId="2" ParentId="2399" CreationDate="2014-09-08T17:41:25.590" Score="1" Body="&lt;p&gt;There is not, however if you have a Javascript class that extends &lt;a href=&quot;https://github.com/pixelandtonic/Garnish/blob/master/Source/garnish.js#L472&quot; rel=&quot;nofollow&quot;&gt;Garnish.Base&lt;/a&gt;, you will be able to listen for a custom &lt;code&gt;resize&lt;/code&gt; event on your container div using &lt;a href=&quot;https://github.com/pixelandtonic/Garnish/blob/master/Source/garnish.js#L601&quot; rel=&quot;nofollow&quot;&gt;Garnish.Base::addListener()&lt;/a&gt;, which will trigger when the element first gets a height.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;window.MyClass = Garnish.Base.extend(&#xA;{&#xA;    container: null,&#xA;&#xA;    init: function(container)&#xA;    {&#xA;        this.$container = $(container);&#xA;&#xA;        // Is the container already visible?&#xA;        if (this.$container.height())&#xA;        {&#xA;            this.doStuff();&#xA;        }&#xA;        else&#xA;        {&#xA;            // Hold off until it is&#xA;            this.addListener(this.$container, 'resize', function(ev)&#xA;            {&#xA;                this.removeListener(this.$container, 'resize');&#xA;                this.doStuff();&#xA;            }&#xA;        }&#xA;    },&#xA;&#xA;    doStuff: function()&#xA;    {&#xA;        // this.$container is visible now&#xA;        // ...&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Off-topic, but worth noting: one of the benefits of using Garnish.Base::addListener() rather than jQuery.on() or jQuery.bind() is that it will maintain the scope for you in the callback function. So you don’t need to worry about doing that yourself with jQuery.proxy(), e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.$container.bind('click', $.proxy(function(ev)&#xA;{&#xA;    // `this` would refer to the container element here, if it weren’t for $.proxy().&#xA;}, this);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2014-09-08T17:43:52.207" LastActivityDate="2014-09-08T17:43:52.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2436" PostTypeId="2" ParentId="2376" CreationDate="2014-09-08T19:56:13.783" Score="10" Body="&lt;p&gt;When Craft is determining a matching element’s score, it will loop through each of the search terms, and for each one, loop through each of the element’s attributes, and add the following points to the element’s score:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the attribute is an exact match of the search term, 100 points will be added&lt;/li&gt;&#xA;&lt;li&gt;If the attribute contains a full-word match of the search term, 50 points will be added&lt;/li&gt;&#xA;&lt;li&gt;If the attribute contains a partial match of the search term, 10 points will be added&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the term is part of an “OR” group, then its points will be divided by the total number of terms within that group. So for example, if searching for “gin OR tonic” and an exact match is found within one of the custom fields, rather than getting 100 points, the element would only get 50.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of today’s &lt;a href=&quot;https://buildwithcraft.com/updates#build2582&quot;&gt;2.2.2582 release&lt;/a&gt;, if the attribute is the Title field, then the score will be multiplied by 5. For example, an exact match in the Title field would actually be 500 points, etc.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-08T19:56:13.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2437" PostTypeId="1" CreationDate="2014-09-08T20:39:07.937" Score="3" ViewCount="980" Body="&lt;p&gt;Im trying to setup a front end user form with a category as a select box.  The box looks right but when i submit the form i get a new entry and other fields are filled out but the catgory fields are blank?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for a fieldgroup named borough and the field on the section is also called bourough&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/jobs?added={id}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;9&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- other form fields --&amp;gt;&#xA;&#xA;  {% set boroughs = craft.categories.group('borough') %}&#xA;&#xA;  &amp;lt;select name=&quot;fields[borough]&quot; class=&quot;form-control&quot;&amp;gt;&#xA;       {% for category in boroughs %}&#xA;           &amp;lt;option value=&quot;{{category.id}}&quot;&amp;gt;&#xA;             {{category}}&#xA;           &amp;lt;/option&amp;gt;&#xA;       {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastActivityDate="2016-05-14T03:45:40.613" Title="Category as select dropdown box" Tags="&lt;categories&gt;&lt;form&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2440" PostTypeId="1" CreationDate="2014-09-08T23:42:27.983" Score="3" ViewCount="259" Body="&lt;p&gt;I'm currently writing a plugin which should connect to another Craft Instance (same server, same &lt;code&gt;app&lt;/code&gt; folder) and run some code (start a task or execute a service function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/bootstrap.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;bootstrap.php&lt;/code&gt;&lt;/a&gt; which looks great, but I can't include it inside the plugin, or can I somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I bootstrap / connect to another Craft instance from inside my plugin?&lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-09-14T17:31:10.737" Title="How to bootstrap / connect to another Craft instance from inside a plugin?" Tags="&lt;plugin-development&gt;&lt;bootstrap-craft&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2441" PostTypeId="2" ParentId="2440" CreationDate="2014-09-09T00:43:16.687" Score="1" Body="&lt;p&gt;I don't see why you wouldn't be able to load it up from your plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    $otherCraftApp = require '/path/to/other/bootstrap.php';&#xA;    $otherCraftHttpRequestService = $otherCraftApp-&amp;gt;request;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-09T00:43:16.687" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2442" PostTypeId="2" ParentId="2374" CreationDate="2014-09-09T01:32:39.293" Score="1" Body="&lt;p&gt;PHPStorm debugs fine. So the solution is to use that for debugging Craft sites&lt;/p&gt;&#xA;" OwnerUserId="760" LastActivityDate="2014-09-09T01:32:39.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2443" PostTypeId="2" ParentId="2338" CreationDate="2014-09-09T08:43:37.563" Score="2" Body="&lt;p&gt;The problem was my attempt to ajaxify the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had my block content wrapped around&#xA;&lt;code&gt;{% if not craft.request.isAjax %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the page also gets loaded in via Ajax into the control panel, I changed the code to:&lt;br&gt;&#xA;&lt;code&gt;{% if not craft.request.isAjax or craft.request.isLivePreview %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now it works.&lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="177" LastEditDate="2014-09-09T11:45:16.797" LastActivityDate="2014-09-09T11:45:16.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2444" PostTypeId="2" ParentId="2418" CreationDate="2014-09-09T08:45:47.633" Score="0" Body="&lt;p&gt;I changed the /page/_entry to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% include [&quot;pages/_#{subpage.type}&quot;, &quot;pages/_#{subpage.slug}.html&quot;, &quot;pages/_#{subpage.id}.html&quot;, 'pages/_default.html'] with {entry: subpage} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way it first uses the page type, then the slug, then the id and at last the default page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows for easy localized templating with using the same templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanx @carls&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2014-09-09T08:45:47.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2445" PostTypeId="1" CreationDate="2014-09-09T09:48:26.940" Score="3" ViewCount="153" Body="&lt;p&gt;I have an archive of an event based site. &#xA;I know how to break cache until the next event. No Problem&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache until nextEvent %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the archive works the following way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;archive&lt;br&gt;&#xA;-- 2014 (latest year)&lt;br&gt;&#xA;-- 2013&lt;br&gt;&#xA;-- 2012&lt;br&gt;&#xA;-- 2011  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The until nextEvent part makes only sense for the latest year. The other years should be cached forever. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I achieve such a thing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- edit --&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I have to go a little more into the details:&lt;br&gt;&#xA;I get the year in the forth segment.&lt;br&gt;&#xA;Now it should cache the whole loop and never break it, unless it's the actual year, then break it each night: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestYear = now|date(&quot;Y&quot;) %}&#xA;&#xA;{% if year is not defined %}&#xA;    {% redirect &quot;club/programm/archiv/&quot;~latestYear %}&#xA;{% endif %}&#xA;&#xA;{% set year = craft.request.getSegment(4) %}&#xA;&#xA;{# Set the first day of the year and the last #}&#xA;{% set lastyear = year -1 %}&#xA;{% set nextyear = year +1 %}&#xA;{% set yearbegins = '1 January ' ~ year %}&#xA;{% set yearends = '1 January ' ~ nextyear %}&#xA;{% set unixbegins = yearbegins | date('U') %}&#xA;{% set unixends = yearends | date('U') %}&#xA;&#xA;{# Today at 00:00 #}&#xA;{% set today = now|date(&quot;Y-m-d&quot;) ~ ' 00:00' %}&#xA;{% set tomorrow = now|date_modify(&quot;+1 day&quot;)|date(&quot;Y-m-d&quot;) ~ ' 00:00' %}&#xA;&#xA;{% set entriesByYear = craft.entries.section('programm').limit(null).cf_date('and', '&amp;gt;= ' ~ unixbegins, '&amp;lt; ' ~ unixends, '&amp;lt; ' ~ today| date(&quot;U&quot;)) %} {# '&amp;gt; just to make syntax highlighting correct #}&#xA;&#xA;{% cache until tomorrow %}&#xA;    {% for month, entries in entriesByYear | group(&quot;postDate|date('F')&quot;) %}&#xA;&#xA;        {# MONTHLY HEADER #}&#xA;        &amp;lt;div class=&quot;program_monthly_header&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;content_column&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ month }} {{ year }} &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {# ENTRIES PER MONTH #}&#xA;        {% for entry in entries %}&#xA;&#xA;            &amp;lt;div class=&quot;listing_item{% if loop.last %} last{% endif %}&quot; id=&quot;programm_{{ entry.slug }}&quot;&amp;gt; &#xA;                {% include &quot;programm/_common&quot; %}                    &#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;maybe that helps someone to help me ;)&lt;br&gt;&#xA;cheers&lt;br&gt;&#xA;stefan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- edit 2 and solution --- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so after the comments of victor I updated the code. and it works like a charm: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestYear = now|date(&quot;Y&quot;) %}&#xA;&#xA;{% if year is not defined %}&#xA;    {% redirect &quot;club/programm/archiv/&quot;~latestYear %}&#xA;{% endif %}&#xA;&#xA;{% set year = craft.request.getSegment(4) %}&#xA;&#xA;{# Set the first day of the year and the last #}&#xA;{% set lastyear = year -1 %}&#xA;{% set nextyear = year +1 %}&#xA;{% set yearbegins = '1 January ' ~ year %}&#xA;{% set yearends = '1 January ' ~ nextyear %}&#xA;{% set unixbegins = yearbegins | date('U') %}&#xA;{% set unixends = yearends | date('U') %}&#xA;&#xA;{# Today at 00:00 #}&#xA;{% set today = now|date(&quot;Y-m-d&quot;) ~ ' 00:00' %}&#xA;{% set tomorrow = now|date_modify(&quot;+1 day&quot;)|date(&quot;Y-m-d&quot;) ~ ' 00:00' %}&#xA;&#xA;{# Get the Date of the next Event, to allow caching until then #}&#xA;{% set nextEvent = craft.entries.section('programm').cf_date('&amp;gt;= ' ~ today| date(&quot;U&quot;)).order('cf_date asc').first() %}{# '&amp;gt; just to make syntax highlighting correct #}&#xA;{% set nextEventDate = nextEvent.cf_date|date_modify(&quot;+1 day&quot;)|date(&quot;Y-m-d&quot;) ~ ' 00:00' %}&#xA;&#xA;{# Get all the events within the year concerned #}  &#xA;{% set entriesByYear = craft.entries.section('programm').limit(null).cf_date('and', '&amp;gt;= ' ~ unixbegins, '&amp;lt; ' ~ unixends, '&amp;lt; ' ~ today| date(&quot;U&quot;)) %} {# '&amp;gt; just to make syntax highlighting correct #}&#xA;&#xA;{# If the year is the current year, cache it until the next event. Otherwhise, cache indefinitely #}&#xA;{% if year == latestYear %}&#xA;    {% cache until nextEventDate %}&#xA;        {% include &quot;club/programm/_archive_common&quot; %}&#xA;    {% endcache %}&#xA;{% else %}&#xA;    {% cache %}&#xA;        {% include &quot;club/programm/_archive_common&quot; %}&#xA;    {% endcache %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thanks for all the fish!&lt;br&gt;&#xA;stefan&lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="367" LastEditDate="2014-09-10T13:38:53.413" LastActivityDate="2014-09-10T13:38:53.413" Title="On a Archive: how could I break cache for the current year, but not the others?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2446" PostTypeId="2" ParentId="2445" CreationDate="2014-09-09T11:54:45.267" Score="1" Body="&lt;p&gt;You could use the new &lt;a href=&quot;https://github.com/pixelandtonic/ColdCache/&quot; rel=&quot;nofollow&quot;&gt;Cold Cache pluging from P&amp;amp;T&lt;/a&gt; which:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Adds a new &lt;code&gt;{% coldcache %}&lt;/code&gt; tag to Craft, which works just like Craft’s&#xA;  built-in &lt;code&gt;{% cache %}&lt;/code&gt; tag, except that this tag won’t record which&#xA;  elements and element queries are active between its tags. The only way&#xA;  caches will ever get deleted is if they expire, or an admin clears&#xA;  them using the Clear Caches tool in Settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-09-09T11:54:45.267" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2447" PostTypeId="1" CreationDate="2014-09-09T13:30:35.633" Score="1" ViewCount="73" Body="&lt;p&gt;On our website www.efcgroup.net we have created new new product under a ghost page (under parent). We can see the new page heading in side bar but not under main menu at home screen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, the page is BOP hoists under Subsea Handling Equipment under mechanical handling. Please help &lt;/p&gt;&#xA;" OwnerUserId="692" LastActivityDate="2014-09-09T13:30:35.633" Title="Child page not appearing in the main menu" Tags="&lt;control-panel&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2448" PostTypeId="1" AcceptedAnswerId="2454" CreationDate="2014-09-09T13:30:54.303" Score="4" ViewCount="841" Body="&lt;p&gt;Given a structure that has, for example, three levels of content—how do I just iterate over it and create a nested &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; reflecting the hierarchy and containing the &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;slug&lt;/code&gt; (as a link) of each entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following just gives me a flat representation of the structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;panel&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;People&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in craft.entries.section('people') %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="770" LastEditorUserId="177" LastEditDate="2014-09-09T13:59:05.730" LastActivityDate="2014-09-09T15:32:26.750" Title="Output structure in a &lt;ul&gt;" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2449" PostTypeId="2" ParentId="566" CreationDate="2014-09-09T13:33:44.340" Score="10" Body="&lt;p&gt;For all those looking for a zeroes-trimming &lt;strong&gt;solution for just a single decimal place&lt;/strong&gt;, please consider the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.width | replace({&quot;.0&quot; : &quot;&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In our case, the &lt;a href=&quot;https://craftcms.stackexchange.com/a/568/37&quot;&gt;previously posted solution&lt;/a&gt; will not work reliably, because…&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{{ item.width|trim('0')|trim('.') }}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;…will correctly trim down &lt;code&gt;3.0&lt;/code&gt; to &lt;code&gt;3&lt;/code&gt;, but transform &lt;code&gt;0.3&lt;/code&gt; to &lt;code&gt;3&lt;/code&gt; just the same. &lt;code&gt;replace()&lt;/code&gt;, instead, does work like a charm.&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-09-09T15:27:02.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2450" PostTypeId="2" ParentId="2448" CreationDate="2014-09-09T14:02:21.767" Score="6" Body="&lt;p&gt;This could be achieved through a recursive macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursive_nav(entries, depth) %}&#xA;{% import _self as self %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for e in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ e.url }}&quot;&amp;gt;{{ e.title }}&amp;lt;/a&amp;gt;&#xA;            {% if e.hasDescendants() %}&#xA;                {{ self.recursive_nav(e.children, depth+1) }}&#xA;            {% endif %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then to use it in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/recursive-nav.twig' as rn %}&#xA;{% set entry = craft.entries.section('people').level(1) %}&#xA;&amp;lt;div class=&quot;panel&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;People&amp;lt;/h2&amp;gt;&#xA;    {{ rn.recursive_nav(entry, 1) }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This was borrowed and slightly modified from Marion's answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1733/custom-or-complex-nav-tag/1734#1734&quot;&gt;here&lt;/a&gt;. That question is also a great resource for other ways to achieve this result.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-09-09T14:02:21.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2452" PostTypeId="1" AcceptedAnswerId="2456" CreationDate="2014-09-09T14:50:35.917" Score="2" ViewCount="692" Body="&lt;p&gt;I'd like to use a single template to pull in entries from different channels based on url segment 2. But it seems I need to change the section attribute to match the url segment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySection').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given that the url segment and section handle are different, can this be done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the url segment might be &lt;code&gt;hotel-california&lt;/code&gt; and the section handle of the section I want entries from could be &lt;code&gt;hotelCalifornia&lt;/code&gt; or &lt;code&gt;hotelsInCalifornia&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="177" LastEditDate="2014-09-09T15:27:27.117" LastActivityDate="2014-09-09T15:58:34.367" Title="Use a single template to display entries from different channels?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2453" PostTypeId="1" AcceptedAnswerId="2461" CreationDate="2014-09-09T15:09:55.953" Score="3" ViewCount="700" Body="&lt;p&gt;I have a Matrix field that has an Entries field. I want to get those entries, in the selected order, removing entries that don’t have an image asset assigned to the &lt;code&gt;pageImage&lt;/code&gt; field.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Attempt 1&lt;/strong&gt;&lt;br /&gt;&#xA;Gets correct entries but doesn’t maintain the selection order.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;block.entries.relatedTo('and', {&#xA;  targetElement: craft.assets.kind('image'),&#xA;  field: 'pageImage'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Attempt 2&lt;/strong&gt;&lt;br /&gt;&#xA;Same result as above. Correct entries but wrong order.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;craft.entries.relatedTo('and', {&#xA;  sourceElement: block&#xA;}, {&#xA;  targetElement: craft.assets.kind('image'),&#xA;  field: 'pageImage'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Setting the &lt;code&gt;field&lt;/code&gt; value in the first statement results in an empty result set.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Attempt 3&lt;/strong&gt;&lt;br /&gt;&#xA;Seems to work but generates extra queries.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set ids = block.entries.ids() %}&#xA;{% set entries = craft.entries.id(ids).fixedOrder(ids).relatedTo({&#xA;  targetElement: craft.assets.kind('image'),&#xA;  field: 'pageImage'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="596" LastEditorUserId="3951" LastEditDate="2021-02-12T15:35:26.730" LastActivityDate="2021-02-12T15:35:26.730" Title="Get matrix entries related to an image asset via specific field" Tags="&lt;entries&gt;&lt;assets&gt;&lt;matrix&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2454" PostTypeId="2" ParentId="2448" CreationDate="2014-09-09T15:18:33.330" Score="6" Body="&lt;p&gt;Craft's built-in &lt;code&gt;{% nav %}&lt;/code&gt; tag would save you having to write your own recursive macro:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adapted from &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/nav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;panel&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;People&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav entry in craft.entries.section('people') %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not quite as flexible, but is more readable. It should be all you need if it's just links to the entries you want, and it &lt;em&gt;might&lt;/em&gt; be a tiny bit faster, but I haven't actually compared twig's compiled macro vs it's tag code.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2014-09-09T15:32:26.750" LastActivityDate="2014-09-09T15:32:26.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2455" PostTypeId="2" ParentId="2452" CreationDate="2014-09-09T15:43:58.957" Score="1" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#setting-the-parameters&quot; rel=&quot;nofollow&quot;&gt;&quot;object syntax&quot;&lt;/a&gt; of the ElementCriteriaModel, in combination with an &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow&quot;&gt;if-statement&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;// Checks if the 2. segment of the url is 'hotel-california'&#xA;{% if craft.request.getSegment(2) == 'hotel-california' %}&#xA;    {% set params = { section: 'hotelCalifornia' } %}&#xA;{% else %}&#xA;    {% set params = { section: 'anotherSection' } %}&#xA;{% endif %}&#xA;&#xA;{% for entry in craft.entries(params) %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-09-09T15:43:58.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2456" PostTypeId="2" ParentId="2452" CreationDate="2014-09-09T15:58:34.367" Score="3" Body="&lt;p&gt;Personally, in situations like this (particularly if there's only a few items, and no easy way to automate it with inflection or similar,) I just use an array as a kind of dictionary.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionHandlesBySegment = { &#xA;    'hotel-california': 'hotelsCalifornia',&#xA;    'hotel-florida':    'hotelsFlorida' }&#xA;%}&#xA;&#xA;{% if not craft.request.getSegment(2) in sectionHandlesBySegment|keys %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% set sectionHandle = sectionHandlesBySegment[craft.request.getSegment(2)] %}&#xA;{% set hotels = craft.entries.section(sectionHandle) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-09-09T15:58:34.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2457" PostTypeId="2" ParentId="1850" CreationDate="2014-09-09T16:10:57.433" Score="2" Body="&lt;p&gt;The easiest way to solve this, would be to use a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; instead, and put all your PHP code in there. &lt;/p&gt;&#xA;" OwnerUserId="177" LastActivityDate="2014-09-09T16:10:57.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2459" PostTypeId="1" AcceptedAnswerId="2462" CreationDate="2014-09-10T10:20:06.163" Score="6" ViewCount="3171" Body="&lt;p&gt;I have a nested Structure with 3 layers like so:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home&lt;/li&gt;&#xA;&lt;li&gt;Services&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Service A&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub Service A&lt;/li&gt;&#xA;&lt;li&gt;Sub Service B&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Service B&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;About Us&lt;/li&gt;&#xA;&lt;li&gt;Contact&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now I would like the nesting to be reflected in the URL like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://example.com/services/service-a/sub-service-a&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;code&gt;{parent.slug}/{slug}&lt;/code&gt; as the URL Format and this is working for two but not three layers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would the correct format look like?&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2014-09-10T15:40:43.140" Title="URL Format of a nested structure with 3 or more layers" Tags="&lt;url&gt;&lt;structure&gt;&lt;format&gt;&lt;nested-set&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2460" PostTypeId="1" CreationDate="2014-09-10T10:37:04.197" Score="8" ViewCount="2921" Body="&lt;p&gt;I having a problem when trying to upload gif animations. It seems that the animation element doesn't work after they have been uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at the Craft changelog and it mentioned something about support for gifs through ImageMagick. The site is on MediaTemple so when I used their ImageMagick install instructions it throws up an error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if it is an ImageMagick thing or not but it is crucial to the function of the site. Its probably very simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-09-10T15:48:02.653" Title="GIF Animations NOT Appearing" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2461" PostTypeId="2" ParentId="2453" CreationDate="2014-09-10T11:30:15.953" Score="3" Body="&lt;p&gt;While you said that &lt;strong&gt;Attempt 1&lt;/strong&gt; was giving you the correct entries, just in the wrong order, if you have two blocks, you will probably find that you’re getting all blocks’ related entries each time. Because when you set that &lt;code&gt;relatedTo&lt;/code&gt; param on &lt;code&gt;block.entries&lt;/code&gt;, you’re actually overriding the existing &lt;code&gt;relatedTo&lt;/code&gt; param that the Entries field type set, which limits entries to just those that are related to the current block. So with a little more testing you’ll find that’s more than just an ordering problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt 2&lt;/strong&gt; is the right way to go - finding entries that are explicitly related to both the current block &lt;em&gt;and&lt;/em&gt; some number of assets. If you want those entries to show up in the order they were related within the current block, you just need to set the &lt;code&gt;order&lt;/code&gt; param. In this case you’ll want to set that to &lt;code&gt;sources1.sortOrder&lt;/code&gt;, as &lt;code&gt;sources1&lt;/code&gt; is the alias that the &lt;code&gt;craft_relations&lt;/code&gt; will get when it’s joined into the query to aid in a &lt;code&gt;sourceElement&lt;/code&gt; relation param for the first time.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;craft.entries({&#xA;    relatedTo: [&#xA;        'and',&#xA;        { sourceElement: block },&#xA;        { targetElement: craft.assets.kind('image'), field: 'pageImage' }&#xA;    ],&#xA;    order: 'sources1.sortOrder'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing I would recommend is, if you are going to be running this same query on multiple Matrix blocks on the same page, you should define that &lt;code&gt;craft.assets&lt;/code&gt; ElementCriteriaModel outside of the main for-loop. That will save Craft a DB query for each block.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allImages = craft.assets.kind('image').limit(null) %}&#xA;&#xA;{% for block in entry.myMatrixField %}&#xA;&#xA;    {% set entries = craft.entries({&#xA;        relatedTo: [&#xA;            'and',&#xA;            { sourceElement: block },&#xA;            { targetElement: allImages, field: 'pageImage' }&#xA;        ],&#xA;        order: 'sources1.sortOrder'&#xA;    }) %}&#xA;&#xA;    ...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-10T11:30:15.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2462" PostTypeId="2" ParentId="2459" CreationDate="2014-09-10T15:40:43.140" Score="12" Body="&lt;p&gt;Set the Nested Entries URL format to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-09-10T15:40:43.140" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2463" PostTypeId="2" ParentId="2460" CreationDate="2014-09-10T15:48:02.653" Score="4" Body="&lt;p&gt;You're correct in that animated GIFs will only have their animations preserved if your server has &lt;a href=&quot;http://www.imagemagick.org/&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're getting an error installing Imagick on MediaTemple, the you're better off contacting them with the error and seeing if they can help resolve the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-10T15:48:02.653" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="2464" PostTypeId="1" AcceptedAnswerId="2465" CreationDate="2014-09-10T16:21:16.910" Score="9" ViewCount="1022" Body="&lt;p&gt;We're in the process of building a restfull backend in craft. We had sluggish response times due to the amount of queries done by craft on a an entry listing. Each entry had about 3 levels of nesting and a list of 9 entries tool 10-13 seconds to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've worked around this by outputting the json using twig and its cache. Now I've noticed that craft uses mysql to cache its data. Due to the amount of queries to this backend we will probably run out of its auto incremental key space. This platform has over 2 million unique visitors a day. (I've seen it before and it will happen) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is can I override the twig cache subsystem? For example use Redis so I can proactively notify middleware and/or frontend that caches have been cleared, so these tiers can regenerate the cache while still serving stale cache? And/or is there an event available inside the cache system so I can trigger on that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-09-10T17:33:33.090" Title="Is there a way to override the template caching system?" Tags="&lt;templating&gt;&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2465" PostTypeId="2" ParentId="2464" CreationDate="2014-09-10T17:33:33.090" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Due to the amount of queries to this backend we will probably run out of its auto incremental key space.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That would seem to suggest that maybe your template caching strategy should be re-visited?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there really going to be 215 million (from a signed int) unique pieces of cached content that need to be saved?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now my question is can I override the twig cache subsystem?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Right now, there aren't any hooks or events into the template caching layer, but a few people have asked for it to hook up to external services like memcached, redis, varnish, fastly, etc.  So it's on our list to add some events for plugins to get notified when things like cache expiration occurs for a piece of content.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-10T17:33:33.090" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2466" PostTypeId="1" AcceptedAnswerId="2468" CreationDate="2014-09-10T19:06:26.583" Score="3" ViewCount="852" Body="&lt;p&gt;I am a craft newbie and was wondering what General Settings &gt; Logo does, as I can't find anything about it (how to use it with twig etc.) in the documentation or elsewhere.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TGPYJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="780" LastActivityDate="2014-09-10T19:40:10.763" Title="What does General Settings &gt; Logo do?" Tags="&lt;control-panel&gt;&lt;dashboard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2467" PostTypeId="2" ParentId="2466" CreationDate="2014-09-10T19:07:58.133" Score="0" Body="&lt;p&gt;It lets you add a custom logo to your control panel.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-09-10T19:07:58.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2468" PostTypeId="2" ParentId="2466" CreationDate="2014-09-10T19:40:10.763" Score="1" Body="&lt;p&gt;The logo you upload there will replace the default Craft graphic on the login page for the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-10T19:40:10.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2469" PostTypeId="1" CreationDate="2014-09-10T22:15:32.690" Score="7" ViewCount="1072" Body="&lt;p&gt;I'm trying to make the jump from EE to Craft but struggling in this area (and thinking I may be approaching this all wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In EE, I often use url segments (in combination with Freebie to ignore them) for certain logic in templates (ie. adding a last segment of 'thanks' to show a thank you message).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot figure out how to do this well in Craft - or even if it is the right approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel entry with a slug of 'contact' and want to add 'thanks' to the url to conditionally display a thank you message on that page. I know I could add a route so that 'contact/thanks' will still load the correct template for that channel but I then run into the issue of that URL not matching the entry slug and no entry data is available for {{entry.whateverFields}}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then I did this to try to get around the issue by putting all my entry data in a for loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('standard').slug(craft.request.firstSegment) %}&#xA;    {{entry.title}}&#xA;    ...other template code in here&#xA;    {% if craft.request.lastSegment == 'thanks' %}  &#xA;        ...thank you message&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This lets me now get the correct entry data loaded for this entry (or others in this section) and my thank you message still appears however it just feels like an awkward way to do it and I suspect in other scenarios it could become really messy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to approach this in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or can you actually have Craft ignore certain url segments?&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="22" LastEditDate="2017-05-10T00:22:08.703" LastActivityDate="2017-05-10T00:22:08.703" Title="How to use url segments like with Freebie in EE" Tags="&lt;templating&gt;&lt;url&gt;&lt;routing&gt;&lt;craft-features&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2470" PostTypeId="1" AcceptedAnswerId="2471" CreationDate="2014-09-11T00:53:53.710" Score="2" ViewCount="1356" Body="&lt;p&gt;Is it possible to have the labels for any of these fields be translatable in templates? I don't mean make the whole field translatable - the same option values would be shared between locales, I would just like the output the label in the correct language.&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2014-09-11T08:21:11.190" Title="Translating the option labels of Dropdown, Checkboxes or Multi-select fields" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2471" PostTypeId="2" ParentId="2470" CreationDate="2014-09-11T01:15:37.363" Score="5" Body="&lt;p&gt;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#translate-or-t&quot; rel=&quot;noreferrer&quot;&gt;translate (or t)&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{label|t}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;noreferrer&quot;&gt;how to translate static text in templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-11T01:15:37.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2472" PostTypeId="1" AcceptedAnswerId="2478" CreationDate="2014-09-11T03:54:38.397" Score="3" ViewCount="725" Body="&lt;p&gt;Sorry if there is an answer out there for this, I've read quite a few posts but have got myself confused. I hope you can point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this code in my EE template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{exp:switchee variable=&quot;{segment_2}&quot; parse=&quot;inward&quot;}&#xA;{case value=&quot;''&quot;}&#xA;{exp:channel:entries channel=&quot;portfolio&quot; dynamic=&quot;no&quot; status=&quot;open&quot; disable=&quot;pagination|member_data&quot; orderby=&quot;date&quot; sort=&quot;desc&quot;}&#xA;&amp;lt;div class=&quot;col-sm-4 col-md-4 col-lg-3&quot;&amp;gt; &#xA;&#xA;    {cf_portfolio_link}&#xA;    {cf_portfolio_image}&#xA;    {title}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{/exp:channel:entries}&#xA;{/case}&#xA;{case default=&quot;yes&quot;}&#xA;{exp:channel:entries channel=&quot;portfolio&quot; dynamic=&quot;no&quot; category=&quot;{segment_2_category_id}&quot; status=&quot;open&quot; disable=&quot;pagination|member_data&quot; orderby=&quot;date&quot; sort=&quot;desc&quot;}&#xA;&amp;lt;div class=&quot;col-sm-4 col-md-4 col-lg-3&quot;&amp;gt; &#xA;&#xA;    {cf_portfolio_link}&#xA;    {cf_portfolio_image}&#xA;    {title}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{/exp:channel:entries}&#xA;{/case}&#xA;{/exp:switchee}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to do the same in Craft - use one template and filter my entries by segment(2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present I have this code in my Craft template (the first case works, the second returns a 404):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch craft.request.getSegment(2) %}&#xA;{% case &quot;&quot; %}&#xA;&#xA;{% for item in craft.entries.section('portfolioImages').order('id desc') %}&#xA;    &amp;lt;div class=&quot;col-sm-4 col-md-4 col-lg-3 work-item&quot;&amp;gt; &#xA;    &amp;lt;a href=&quot;{{ item.websiteLink }}&quot; target=&quot;_blank&quot; title=&quot;View site&quot;&amp;gt;&#xA;    {% for image in item.image %}&#xA;        &amp;lt;img src=&quot;{{ image.url() }}&quot; alt=&quot;{{ item.alternativeText }}&quot; class=&quot;img-responsive center-block&quot; /&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/a&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ item.title }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% default %}&#xA;&#xA;    filtered entries to go here&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The URL for my portfolio page is mysite.com/work or mysite.com/work/ecommerce-websites if it has been filtered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have a category group set up in the system called Portfolio with 3 top level categories only:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ecommerce-websites &lt;/li&gt;&#xA;&lt;li&gt;promotion-websites&lt;/li&gt;&#xA;&lt;li&gt;product-catalogue-websites&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Not sure where to go from here now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need further information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="782" LastActivityDate="2014-09-11T09:09:14.983" Title="Porting from EE - How to filter by category/segment in one template" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2473" PostTypeId="1" CreationDate="2014-09-11T04:09:07.563" Score="3" ViewCount="590" Body="&lt;p&gt;I have a site that requires the client to reorder their entries in each 'category' manually. Obviously structures are perfect for this but where I'm running into trouble is that the entries need to appear in multiple 'categories'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg. Project One needs to appear in /projects and /selected-projects, both of which need the ability to be reordered via drag and drop functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know using Craft's categories isn't an option as they can't be reordered so I'm trying to set this up with one channel that contains the entries and then using multiple structures and using the entries field so the client can add the entries they create in the channel to the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short, is it possible to display channels within structures?&lt;/p&gt;&#xA;" OwnerUserId="783" LastActivityDate="2014-09-11T09:28:09.897" Title="Channels within Structures?" Tags="&lt;structure&gt;&lt;sections&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2474" PostTypeId="1" CreationDate="2014-09-11T06:58:35.623" Score="1" ViewCount="188" Body="&lt;p&gt;I'm planning for a site which will use a number of small image elements, which leads naturally to looking for first-load speedups by using sprites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the site will be responsive, it will need the sprites to resize.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One way would be to let Craft do the resizing; might work well enough.&lt;/li&gt;&#xA;&lt;li&gt;the offsets would also be very nice to find re-aligned with the resized sprite locations. I think I am probably talking about a feature request here. Maybe it could be as simple as a conversion function, cached results or not.&lt;/li&gt;&#xA;&lt;li&gt;another possibility would be to allow Assets to specify their own non-generated images for given Transform labels. Maybe by a middle-extension that named the tranform, if not a tranform folder solution?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ok, I think this is all dreamland for now, but might spark some thinking. I'm considering it because I think I'm realizing that the delay times for later than first images which show even on a Pingdom are probably due to limited sockets for browsers, or a modeled equivalent in the monitoring service if they are not just using Webkit contents for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something to think about, or if someone has an answer I don't know about.&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-09-22T13:39:04.633" Title="How to use sprite sheets effectively and responsively in Craft" Tags="&lt;assets&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2475" PostTypeId="2" ParentId="2470" CreationDate="2014-09-11T08:07:10.980" Score="2" Body="&lt;p&gt;Using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;LJ Dynamic Fields&lt;/a&gt; plugin, you can also generate drop-down, checkbox, multi-select, and radio button labels/values dynamically from a another channel. If the lookup channel data is localized then the labels will be also. I implemented this for a localized drop-down country list. Works great! and client can control the entries. Powerful plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('countries').limit(null).order('countryName') %}&#xA;  { &quot;value&quot;:&quot;{{ entry.countryCode }}&quot; , &quot;label&quot;:&quot;{{ entry.countryName }}&quot;}&#xA;  {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-09-11T08:21:11.190" LastActivityDate="2014-09-11T08:21:11.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2476" PostTypeId="1" AcceptedAnswerId="2487" CreationDate="2014-09-11T08:08:41.047" Score="6" ViewCount="526" Body="&lt;p&gt;Ok, this is the first time I need this, but here's my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;em&gt;crop&lt;/em&gt; is selected for a transition, what you get is a &lt;em&gt;scaleAndCrop&lt;/em&gt;. Is there a way to do a 'real' crop, so no resizing before cropping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bVl95.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-11T15:48:25.657" Title="Is 'real crop' a possibility?" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2477" PostTypeId="2" ParentId="2472" CreationDate="2014-09-11T08:34:35.523" Score="1" Body="&lt;p&gt;After a few more hours of reading and trying, I have now come up with the following solution for displaying a landing page and filtered entries by segment() in the same template:&#xA;(as a newbie I don't know if this is &quot;best practise&quot;, maybe someone could clarify that?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch craft.request.getSegment(2) %}&#xA;{% case &quot;&quot; %}&#xA;&#xA;{% for entry in craft.entries.section('portfolioImages').order('id desc') %}&#xA;&amp;lt;div class=&quot;col-sm-4 col-md-4 col-lg-3 work-item&quot;&amp;gt; &#xA;    &amp;lt;div class=&quot;holder2&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;portfolio-item2&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.websiteLink }}&quot; target=&quot;_blank&quot; title=&quot;View site&quot;&amp;gt;&#xA;            {% for image in entry.image %}&#xA;                    &amp;lt;img src=&quot;{{ image.url() }}&quot; alt=&quot;{{ entry.alternativeText }}&quot; class=&quot;img-responsive center-block&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;div class=&quot;client-name&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% default %}&#xA;&#xA;{% for category in craft.categories.slug(craft.request.getSegment(2)).find() %}&#xA;    {% for entry in craft.entries.section('portfolioImages').relatedTo({targetElement: category}).find() %}&#xA;        &amp;lt;div class=&quot;col-sm-4 col-md-4 col-lg-3 work-item&quot;&amp;gt; &#xA;            &amp;lt;div class=&quot;holder2&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;portfolio-item2&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ item.websiteLink }}&quot; target=&quot;_blank&quot; title=&quot;View site&quot;&amp;gt;&#xA;                    {% for image in entry.image %}&#xA;                            &amp;lt;img src=&quot;{{ image.url() }}&quot; alt=&quot;{{ entry.alternativeText }}&quot; class=&quot;img-responsive center-block&quot; /&amp;gt;&#xA;                    {% endfor %}&#xA;                    &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;div class=&quot;client-name&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}﻿&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="782" LastActivityDate="2014-09-11T08:34:35.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2478" PostTypeId="2" ParentId="2472" CreationDate="2014-09-11T08:46:09.993" Score="5" Body="&lt;p&gt;/work/ecommerce-websites is giving you a 404 because there is no obvious place to route it. See &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/routing&lt;/a&gt; for details on how Craft tries to route each request that comes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have 3 options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;GOOD: Create individual templates for each category&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m not sure why you would want to do that, but it &lt;em&gt;is&lt;/em&gt; an option, so I’m putting it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BETTER: Create a dynamic route&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a new &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; that tells Craft to point URLs that look something like “work/(slug)” to the “work” template, or you might be better off just creating a new “work/_category” template so that you don’t have a single template that is responsible for two entirely different types of pages, which is a little weird. (If there are similarities between the work index and a work category page, you should probably just create a new Work-specific layout template that outputs those things.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BEST: Make these your primary category URLs&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You said you have a category group set up, and the second segment is supposed to match one of them. If this is the &lt;strong&gt;primary&lt;/strong&gt; place that you would expect to find info about these categories on your site, then go into Settings &gt; Categories &gt; [your group] and check the “Categories in this group have their own URLs” checkbox, and fill in the “Category URL Formats” and “Category Template” settings like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/44LHe.png&quot; width=&quot;617&quot; alt=&quot;Craft category group settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, double-click on each of your categories and make sure their Slugs are what you would expect the 2nd segments to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I’m expecting you’ve decided to create a “work/_category” template as suggested earlier, but if you really want your work index template to be handling these pages you can change the Category Template setting to just plain “work”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a bonus with this third approach, you won’t need to fetch your categories manually from the template; a &lt;code&gt;category&lt;/code&gt; variable will already be available to the template, so you can go straight to outputting &lt;code&gt;{{ category.title }}&lt;/code&gt; or whatever. (See step 4 on &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/routing&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This third technique also applies to sections/entries by the way. I mention that because based on your posted template code (&lt;code&gt;{{ entry.websiteLink }}&lt;/code&gt;) it looks like you’re managing entry URLs manually with a custom field, which is really not necessary in Craft. Check the “Entries in this section have their own URLs” checkbox in your section’s settings and Craft will assign a primary URL to all the entries in your section, based on the URL Format you give it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-11T08:46:09.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2479" PostTypeId="2" ParentId="2472" CreationDate="2014-09-11T09:09:14.983" Score="1" Body="&lt;p&gt;To sum it up, you want a single template to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;display all &quot;portfolioImages&quot; items if no category is selected (appears in the URL)&lt;/li&gt;&#xA;&lt;li&gt;display only &quot;portfolioImages&quot; items belonging to a category if one category is selected (appears in the URL)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The key is to use categories having their own URLs (in the CP for your category group) and the category variable Craft creates for you automatically if the URL calls for a category page. You can use that variable to specify that you only want entries related to that current category to display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a &lt;a href=&quot;http://craftcookbook.net/recipes/102&quot; rel=&quot;nofollow&quot;&gt;recipe in Craft Cookbook a while back&lt;/a&gt;. Have a look at the second version entitled &quot;with native categories&quot;.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2014-09-11T09:09:14.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2480" PostTypeId="2" ParentId="2473" CreationDate="2014-09-11T09:16:43.910" Score="1" Body="&lt;p&gt;I think you solved your own problem — by linking channel entries to structure entries using relationships (via the &quot;Entries&quot; field) you can display the same project in multiple locations. Seems like a perfect solution.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-09-11T09:28:09.897" LastActivityDate="2014-09-11T09:28:09.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2481" PostTypeId="1" AcceptedAnswerId="2483" CreationDate="2014-09-11T09:35:16.160" Score="3" ViewCount="1772" Body="&lt;p&gt;I've got a user registration form on my site, using the code from Craft's documentation. How can I get the form working so it asks the user to enter their email address and password twice? Can Craft take care of that or do I need to use client-side JS validation?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-03-17T10:45:18.263" Title="User registration: How do implement &quot;Confirm password&quot; and &quot;Confirm email&quot;?" Tags="&lt;form&gt;&lt;registration&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2482" PostTypeId="1" CreationDate="2014-09-11T12:53:06.783" Score="3" ViewCount="2367" Body="&lt;p&gt;How do you add extra parameters or update a parameter to an exiting POST URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADD EXTRA PARAMETER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a page at this address:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/shop/?color=red&amp;amp;order=title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my twig I want to add a parameter like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/shop/?color=red&amp;amp;order=title&amp;amp;sort=asc&#xA;http://localhost/shop/?color=red&amp;amp;order=title&amp;amp;sort=asc&amp;amp;limit=10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE PARAMETER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a page at this address:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/shop/?color=red&amp;amp;order=title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my twig I want to update a parameter like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/shop/?color=blue&amp;amp;order=title&#xA;http://localhost/shop/?color=red&amp;amp;order=price&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-09-11T14:40:55.233" Title="Update and add POST URL parameters" Tags="&lt;url&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2483" PostTypeId="2" ParentId="2481" CreationDate="2014-09-11T14:19:08.303" Score="2" Body="&lt;p&gt;This is something you should let JavaScript take care of. Craft does not check a 'second' email or password field, so you should make sure the two field values are identical before posting the values to Craft's controller.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-11T14:19:08.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2484" PostTypeId="2" ParentId="2482" CreationDate="2014-09-11T14:40:55.233" Score="4" Body="&lt;p&gt;If i'm not mistaking, craft.request.getQuery() returns an array filled with all $_GET key-value pairs, so in your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = craft.request.getQuery() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will let you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Do with it what you like ...&#xA;{% set queryParams = queryParams | without(key) %} // Removes a param&#xA;{% set queryParams = queryParams | merge([{ 'limit' : 10 }]) %} // Adds a param&#xA;{% set queryParams['order'] = 'price' %} // Changes a param&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After doing what you need to do, you can rebuild the query string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryString = '' %}&#xA;{% for key, value in queryParams %}&#xA;    {% set queryString = loop.first ? '?' ~ key ~ '=' ~ value : '&amp;amp;amp;' ~ key ~ '=' ~ value %}&#xA;{% endfor %}&#xA;{% redirect(siteUrl ~ queryString) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-11T14:40:55.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2485" PostTypeId="1" CreationDate="2014-09-11T15:25:58.420" Score="2" ViewCount="159" Body="&lt;p&gt;Is it possible to check the status of entries linked to in content from the Rich Text field? For example, the user might create a link in a paragraph to an entry that is in draft status. I would like to only display an actual link in the front end if this entry is then published.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this currently possible?&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="770" LastEditDate="2014-09-12T07:46:43.210" LastActivityDate="2014-09-12T09:03:23.503" Title="Status of links to entries in body copy" Tags="&lt;entry&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2486" PostTypeId="2" ParentId="2481" CreationDate="2014-09-11T15:45:23.450" Score="4" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/a/2483/57&quot;&gt;letting JavaScript&lt;/a&gt; take care of the extra front-end logic, you could also write a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that exposes a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; that does the extra email and password sameness checks from PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If those are equal, then it would just pass the data off to &lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser()&lt;/code&gt;, otherwise, return any validation errors back to the template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-09-11T15:45:23.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2487" PostTypeId="2" ParentId="2476" CreationDate="2014-09-11T15:48:25.657" Score="5" Body="&lt;p&gt;Currently, no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is on our list to open us the asset transformation pipeline so that plugins can add new transforms that go beyond what is available out of the box in Craft, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-11T15:48:25.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2490" PostTypeId="2" ParentId="2469" CreationDate="2014-09-11T16:34:30.210" Score="4" Body="&lt;p&gt;One easy way to work around this is to use a query string instead of a segment. You'd redirect the user to for instance &lt;code&gt;/contact?receipt=thanks&lt;/code&gt; instead of &lt;code&gt;/contact/thanks&lt;/code&gt;, and you change the conditional in your template to something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request. getParam('receipt') == 'thanks' %}  &#xA;    ...thank you message&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've always felt that this kind of information doesn't belong as a segment-part of an url, and the only reason we did that in EE was the lack of easy access to the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way would be to set up a route like you did. Maybe set it to &lt;code&gt;(slug)/thanks&lt;/code&gt;, where (slug) is the slug token. Then, at the beginning of your template, before trying to access entry, you check if it exists, and if it doesn't you pull it manually. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries({ slug: craft.request.segment(1) }).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope one of those solutions helps.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-11T16:34:30.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2491" PostTypeId="1" AcceptedAnswerId="2492" CreationDate="2014-09-11T17:05:02.423" Score="3" ViewCount="2040" Body="&lt;p&gt;Is there a way to get the parameters from the referrer url?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this:&#xA;&lt;code&gt;{{ craft.request.urlReferrer.getQuery }}&lt;/code&gt;&#xA;but that’s not working.&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2014-09-12T16:26:43.230" Title="Get parameters from referrer" Tags="&lt;url&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2492" PostTypeId="2" ParentId="2491" CreationDate="2014-09-11T17:15:25.820" Score="4" Body="&lt;p&gt;It can be done with some Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set referrer = craft.request.urlReferrer %}&#xA;&#xA;{% if referrer %}&#xA;    {# Remove everything before the `?` #}&#xA;    {% set queryString = referrer|replace('/^.*\\?/', '') %}&#xA;&#xA;    {# Split the query string into individual params #}&#xA;    {% set params = queryString|split('&amp;amp;') %}&#xA;&#xA;    {% for param in params %}&#xA;        {# Split this param on the `=` sign #}&#xA;        {% set parts = param|split('=') %}&#xA;        {% set name = parts[0] %}&#xA;        {% set value = parts[1] is defined ? parts[1] %}&#xA;&#xA;        {# Do something with it... #}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this could would require Craft 2.2 or later, which comes with a regex-enabled &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;replace&lt;/a&gt; filter.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="176" LastEditDate="2014-09-12T16:26:43.230" LastActivityDate="2014-09-12T16:26:43.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2493" PostTypeId="1" AcceptedAnswerId="2494" CreationDate="2014-09-11T17:21:33.347" Score="3" ViewCount="361" Body="&lt;p&gt;I have a single category field (named category) in my section and I am looking to use the auto-generated title to keep these entries titled consistently. I have had success outputting the first category selection into the entry field but I can't seem to grab multiple selections. I have tried a for loop and I can of course getting working on a template but I am thinking the syntax must be different for the auto generated title field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of the tree I am working with.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category One&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub Cat One&lt;/li&gt;&#xA;&lt;li&gt;Sub Cat Two&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In a example entry I will have Sub Cat One selected and of course Category One since it is an ancestor of the Sub Cat One. I would like to output something like (Category One / Sub Cat One) in the entry title but I either get no results or just the first one. I have tried the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for categoryList in category %}{{categoryList.title}}{% if loop.index &amp;lt; loop.length %}/{% endif %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.first().title}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which of course contains only the first selected category title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you output more than one category selection in an entry title field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2014-09-11T18:47:59.670" Title="Multiple category output in auto generated entry title" Tags="&lt;titles&gt;&lt;auto-generate&gt;&lt;post&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2494" PostTypeId="2" ParentId="2493" CreationDate="2014-09-11T17:29:52.430" Score="2" Body="&lt;p&gt;When you use the single brace tag syntax within your URL Format field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.first().title}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that’s actually a shortcut for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.category.first().title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, &lt;code&gt;object&lt;/code&gt; is the actual variable name that you can use to refer to your entry, when you want to use the normal Twig tags &lt;code&gt;{{ ... }}&lt;/code&gt; and &lt;code&gt;{% ... %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for categoryList in object.category %}{{ categoryList.title }}{% if not loop.last %}/{% endif %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-11T17:29:52.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2495" PostTypeId="1" AcceptedAnswerId="2497" CreationDate="2014-09-11T18:47:48.943" Score="1" ViewCount="74" Body="&lt;p&gt;Let's say that I have an Assets field on a single page where someone can add a bunch of images to a &quot;gallery&quot; on that page. Is there a way to perform a query and return the entries from a channel where these images are used as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'm trying to get the URL's to all of the listing entries where any of these images are also used, but without the admin explicitly relating them to those entries on the single page. There's no explicit relationship between them, other than the same images were used on both the single and channel entry. &lt;/p&gt;&#xA;" OwnerUserId="66" LastActivityDate="2014-09-11T19:08:50.673" Title="Method for pulling entries that have a specific image linked?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2496" PostTypeId="2" ParentId="2493" CreationDate="2014-09-11T18:47:59.670" Score="3" Body="&lt;p&gt;I think you could also use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot; rel=&quot;nofollow&quot;&gt;join filter&lt;/a&gt; instead of the for loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.category | join('/') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2014-09-11T18:47:59.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2497" PostTypeId="2" ParentId="2495" CreationDate="2014-09-11T19:08:50.673" Score="2" Body="&lt;p&gt;You can use &lt;code&gt;relatedTo&lt;/code&gt; for that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').relatedTo(myAsset) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({ section: 'mySection', relatedTo: myAsset }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;the documentation on relationships&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-11T19:08:50.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2498" PostTypeId="1" CreationDate="2014-09-11T20:12:01.480" Score="5" ViewCount="217" Body="&lt;p&gt;i'm just getting my feet wet with craft and would appreciate some pointers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what i would like to do is show and compare products. Each product will have a description, price, review, and many other characteristics (&gt;50 in total). Items must be searchable by any single or combination of these. Data will be imported through a script (ie not manually).&#xA;Apart from that there will be articles etc (with maybe 3-6 fields) on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the craft content table, it looks like an extra column is created for each field. When there are different types of entries, often many/most columns will be null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: should i be concerned about:&#xA;a) the db structure of craft entries (alternative could be to create separate table for products), especially performance wise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) searchability of product entries. Would it be easy to search entries by combination of fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not looking for a complete solution, just some pointers i can take along when deciding which way to go :)&lt;/p&gt;&#xA;" OwnerUserId="786" LastActivityDate="2014-09-28T13:05:05.993" Title="Entry with many fields vs plugin/custom data structure" Tags="&lt;field&gt;&lt;custom-fieldtype&gt;&lt;entries-field&gt;&lt;custom-field&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2499" PostTypeId="1" AcceptedAnswerId="2503" CreationDate="2014-09-11T21:37:50.447" Score="3" ViewCount="117" Body="&lt;p&gt;I've looked through all the tables, and I can not find a column for status. I'd like to close all entries in channelId X. Is there a way to bulk edit entries via DB?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-09-12T02:42:51.363" Title="How can I change status of all the entries in a channel to closed?" Tags="&lt;entries&gt;&lt;channels&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2500" PostTypeId="1" AcceptedAnswerId="2501" CreationDate="2014-09-11T22:02:41.233" Score="4" ViewCount="735" Body="&lt;p&gt;I'm trying to return results based on a year stored in a custom field. For example, returning entries with a model year greater than 2006 and less than 2009. Is there a search syntax to support this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;for entry in craft.entries.section('equipment').search(modelYear: &amp;gt; 2006 &amp;amp;&amp;amp; &amp;lt; 2009) …&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="788" LastActivityDate="2014-09-11T22:52:48.837" Title="Using search to display entries based on a value in a number field" Tags="&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2501" PostTypeId="2" ParentId="2500" CreationDate="2014-09-11T22:52:48.837" Score="5" Body="&lt;p&gt;You can do a certain amount of logic in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel syntax&lt;/a&gt;. I think this will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('equipment').modelYear('and, &amp;gt; 2006, &amp;lt; 2009') %}&#xA;{% for entry in entries %}&#xA;  ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-11T22:52:48.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2502" PostTypeId="1" CreationDate="2014-09-11T23:17:52.467" Score="1" ViewCount="16712" Body="&lt;p&gt;When devMode is true, both the front end and admin of my site give me the PHP warning:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;&lt;code&gt;var_export&lt;/code&gt; does not handle circular references&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've tried disabling plugins, with no luck.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="-1" LastEditDate="2016-04-08T23:46:41.653" LastActivityDate="2016-04-08T23:46:41.653" Title="&quot;PHP Warning: var_export does not handle circular references&quot; when devMode = true" Tags="&lt;php&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2503" PostTypeId="2" ParentId="2499" CreationDate="2014-09-12T02:42:51.363" Score="2" Body="&lt;p&gt;Grab all of the entry IDs you want from the &lt;code&gt;craft_entries&lt;/code&gt; table, then find the rows matching those IDs in the &lt;code&gt;craft_elements&lt;/code&gt; table and set their &lt;code&gt;enabled&lt;/code&gt; column to &lt;code&gt;0&lt;/code&gt; to disable them en masse.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-12T02:42:51.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2504" PostTypeId="2" ParentId="2485" CreationDate="2014-09-12T05:12:37.483" Score="2" Body="&lt;p&gt;I don't think it's possible out-of-the-box, but you might be able to get something like that working with a shortcode approach. You could make a custom shortcode with a link parameter, and in the function for that shortcode, look up that link parameter's corresponding entry and find out its status. Then the shortcode could output a link if the entry was published, and just the original text otherwise. Here's a plugin that lets you add shortcodes: &lt;a href=&quot;https://github.com/samhernandez/craftcms-shortcodes&quot; rel=&quot;nofollow&quot;&gt;https://github.com/samhernandez/craftcms-shortcodes&lt;/a&gt;. If you wanted to get really fancy, you could even make a new redactor (the WYSIWYG editor Craft uses) button that inserts the shortcode instead of the normal anchor HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach would probably take a bit of work, though. I'd be interested to see if anyone else has a better solution.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="228" LastEditDate="2014-09-12T07:47:12.117" LastActivityDate="2014-09-12T07:47:12.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2505" PostTypeId="1" AcceptedAnswerId="4273" CreationDate="2014-09-12T05:33:02.190" Score="2" ViewCount="260" Body="&lt;p&gt;I'm trying to write a general use plugin for a calculation fieldtype that evaluates a twig expression (defined in the field settings) to display additional information about the current record in the CP (i.e. price * qty = amount). So far, everything is working perfectly — the generic expression &lt;code&gt;1 + 1&lt;/code&gt; is evaluated and the result is properly displayed in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, I don't actually know how to reference the current entry in the CP from within the CP via twig, to get access to the entry field values. Looking for something like &lt;code&gt;{{ entry.price }} * {{ entry.qty }}&lt;/code&gt;, but don't know what to use instead of &lt;code&gt;entry&lt;/code&gt;. Does anyone know a twig expression that I can use?&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-01T22:26:32.787" LastActivityDate="2014-10-21T21:49:14.063" Title="How to reference the current entry via twig in the control panel?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2506" PostTypeId="1" AcceptedAnswerId="2515" CreationDate="2014-09-12T06:49:47.947" Score="1" ViewCount="1165" Body="&lt;p&gt;I am looking for some advice on how best to add error messages (eg incorrect password / username) on a custom Login form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried the usual routes for documentation but have seen nothing as yet - all help appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dan&lt;/p&gt;&#xA;" OwnerUserId="214" LastActivityDate="2015-01-31T07:50:23.500" Title="Login form error messages" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2507" PostTypeId="2" ParentId="2485" CreationDate="2014-09-12T09:03:23.503" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/2504/177&quot;&gt;Instead of a shortcode&lt;/a&gt;, you could also &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;write a filter&lt;/a&gt; which finds all links, and if they are &quot;local&quot;, checks their status by slug, and possibly removes them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage is that the end-user doesn't have to worry about shortcodes or special redactor-buttons.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-09-12T09:03:23.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2508" PostTypeId="1" CreationDate="2014-09-12T13:53:23.723" Score="1" ViewCount="170" Body="&lt;p&gt;I'm using CSS calc to help make my links the proper width and still account for the margins that separate them. The number of links here will vary between 3 and 5 and I wanted to not have to update my CSS when this changes. The code below works except the code is written after CSS is run and therefore doesn't set the width for the links as I'd want. Is there a way to get this to work using Craft or is this a problem with the way calc works?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contactLinkCSS %}&#xA;    {% for block in contactLinks.contactLinks.type(&quot;contactLink&quot;) %}&#xA;        {% set count = 100 / loop.length %}&#xA;        .{{ block.contactLinkName | slugify }}:hover {&#xA;            width:calc({{ count }}% - 0.625rem);&#xA;            background-color: {{ block.contactLinkColor }}&#xA;        }&#xA;    {% endfor %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="231" LastEditorUserId="57" LastEditDate="2014-09-12T15:56:30.260" LastActivityDate="2014-09-12T16:36:39.700" Title="trying to use loop.length with some dynamic css" Tags="&lt;loop&gt;&lt;css&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2509" PostTypeId="1" AcceptedAnswerId="2518" CreationDate="2014-09-12T14:43:01.273" Score="4" ViewCount="163" Body="&lt;p&gt;I'm finding the user activation process a bit confusing...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying to create a handful of users, but I didn't want to send out the activation emails yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I incorrectly assumed if I unchecked &quot;send activation email&quot; when creating, it would create the user and I would be able to send the activation later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, Craft creates the user as &quot;active&quot; with no password, and the &quot;Resend activation email&quot; isn't available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I'm stuck, as you can't set a user to inactive. I'm left with these choices:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;having to set a dummy password, require reset, and manually email my users&lt;/li&gt;&#xA;&lt;li&gt;email my users the control panel url, and instruct them to click &quot;Forgot password&quot; and enter the same email I've created their user with.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Neither options are great, unless I'm missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-09-12T16:56:58.443" Title="Postpone sending activation codes; Creating a user as &quot;Inactive&quot;" Tags="&lt;users&gt;&lt;emails&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2510" PostTypeId="1" AcceptedAnswerId="2513" CreationDate="2014-09-12T15:02:36.810" Score="2" ViewCount="937" Body="&lt;p&gt;In the past I would comment out analytics code on my dev and staging sites then uncomment the code when it went live. I ran across &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.config&quot; rel=&quot;nofollow&quot;&gt;this page in the Craft docs&lt;/a&gt; the other day and started thinking, can I use this to access the siteUrl from the environment variable array and specify a value in my conditional (i.e. {% craft.config.environmentVariable('siteUrl', '&lt;a href=&quot;http://www.example.com&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com&lt;/a&gt;') %}? This way I can add the analytics code and only worry about it loading on the live site.&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-09-12T16:56:42.213" Title="Is using craft.config to access siteUrl possible?" Tags="&lt;config&gt;&lt;conditional&gt;&lt;environments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2511" PostTypeId="1" AcceptedAnswerId="2512" CreationDate="2014-09-12T15:17:35.210" Score="4" ViewCount="4189" Body="&lt;p&gt;I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;partials/includes/page-header&quot; with { 'title' : '{{ entry.heading }}' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it seems that nothing I do will actually pass &lt;code&gt;{{ entry.heading }}&lt;/code&gt; as 'title' in the include.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="57" LastEditDate="2014-09-12T15:54:08.257" LastActivityDate="2014-09-12T15:54:08.257" Title="How would I pass and entry's field value to an include?" Tags="&lt;variable&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2512" PostTypeId="2" ParentId="2511" CreationDate="2014-09-12T15:21:02.960" Score="10" Body="&lt;p&gt;You'll never need to put Twig tags within other Twig tags... Try it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;partials/includes/page-header&quot; with { 'title' : entry.heading } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-12T15:21:02.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2513" PostTypeId="2" ParentId="2510" CreationDate="2014-09-12T15:35:17.280" Score="3" Body="&lt;p&gt;Yes, if you set up proper &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi environment configs&lt;/a&gt;, this isn't very hard. My config/general.php file usually look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '*' =&amp;gt; array(&#xA;     // some general settings here&#xA;  ),&#xA;&#xA;  'mydomain.craft.dev' =&amp;gt; array(&#xA;    'environment' =&amp;gt; 'local',&#xA;    'devMode' =&amp;gt; true,&#xA;    'useCompressedJs' =&amp;gt; false,&#xA;    'siteUrl' =&amp;gt; 'http://mydomain.craft.dev/',&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'fileSystemPath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/../',&#xA;      'publicRootPath'    =&amp;gt; 'public/'&#xA;    ),&#xA;  ),&#xA;&#xA;  // staging and other environments here&#xA;&#xA;  'mydomain.com' =&amp;gt; array(&#xA;    'environment' =&amp;gt; 'prod',&#xA;    'devMode' =&amp;gt; false,&#xA;    'useCompressedJs' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://mydomain.com/',&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'fileSystemPath' =&amp;gt; '/path/to/system/root/',&#xA;      'publicRootPath' =&amp;gt; 'html/'&#xA;    )&#xA;  ) &#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, to only include the GA tracking tag when I'm on the prod server, I include this in my html head:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.environment=='prod'  %}&#xA;  &amp;lt;script&amp;gt;&#xA;    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){&#xA;    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),&#xA;    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)&#xA;    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');&#xA;&#xA;    ga('create', 'UA-XXXXXXXX-X', 'auto');&#xA;    ga('send', 'pageview');&#xA;  &amp;lt;/script&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could of course check siteUrl instead, but I prefer to use something a little more abstract. Just in case the siteUrl changes.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-09-12T16:56:42.213" LastActivityDate="2014-09-12T16:56:42.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2514" PostTypeId="1" AcceptedAnswerId="2799" CreationDate="2014-09-12T15:50:49.003" Score="4" ViewCount="450" Body="&lt;p&gt;Is there an way way to copy sections I have in an existing site to a new website I am doing with a fresh install?&#xA;E.g. To Copy the News Channel Section and all the field types&#xA;Also copy the structure section and all it's entry types etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose I could copy the full database to the new install but then all the entries would need to be deleted, e.g. all the news articles etc.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-09-28T22:20:12.827" Title="Easy way to copy sections to a new install" Tags="&lt;structure&gt;&lt;sections&gt;&lt;channels&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2515" PostTypeId="2" ParentId="2506" CreationDate="2014-09-12T15:59:15.923" Score="1" Body="&lt;p&gt;Any login validation errors are passed back to the form and available via the Twig &lt;code&gt;{{ errorMessage }}&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of how to display them on a login form here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-12T15:59:15.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2516" PostTypeId="2" ParentId="2505" CreationDate="2014-09-12T16:02:21.263" Score="1" Body="&lt;p&gt;A bit hard to tell what's going on without any code examples, but if you're just looking for a way to grab an entry from your plugin, and you already have the ID of the entry, then &lt;a href=&quot;http://buildwithcraft.com/classreference/services/EntriesService&quot; rel=&quot;nofollow&quot;&gt;EntriesService&lt;/a&gt; has a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/EntriesService#getEntryById-detail&quot; rel=&quot;nofollow&quot;&gt;getEntryById()&lt;/a&gt; method available via &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;getEntryById()&lt;/code&gt; that your plugin can call.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-12T16:02:21.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2517" PostTypeId="2" ParentId="2508" CreationDate="2014-09-12T16:36:39.700" Score="1" Body="&lt;p&gt;Turns out I was trying to add this to my :hover state and not the initial state. Problem solved by adding a new rule and putting the width in there.&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2014-09-12T16:36:39.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2518" PostTypeId="2" ParentId="2509" CreationDate="2014-09-12T16:56:58.443" Score="1" Body="&lt;p&gt;Good point, not a very good UX there. We’ll have to come up with something better.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-12T16:56:58.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2519" PostTypeId="1" AcceptedAnswerId="12162" CreationDate="2014-09-12T17:05:46.990" Score="3" ViewCount="500" Body="&lt;p&gt;Is anybody familiar with a plugin (similar to EE's Link Vault) that tracks all downloads, by user? &lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2020-01-12T06:06:13.450" Title="What would be the best way to track downloads by user?" Tags="&lt;users&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2520" PostTypeId="2" ParentId="2519" CreationDate="2014-09-12T17:11:24.640" Score="1" Body="&lt;p&gt;Until the plugin store is a real thing, the most comprehensive list of plugins available for Craft is currently here: &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closet thing I'm seeing to what you're looking for is &lt;a href=&quot;http://straightupcraft.com/craft-plugins/counter&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/craft-plugins/counter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-12T17:11:24.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2521" PostTypeId="1" CreationDate="2014-09-12T21:56:30.127" Score="3" ViewCount="797" Body="&lt;p&gt;I'm trying to change my profile avatar image, and I'm getting a &quot;An unknown error occurred.&quot; No indication of what might have gone wrong. Permissions are correct on &lt;code&gt;/craft/storage/userphotos&lt;/code&gt; and all the user directories inside. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error message in &lt;code&gt;/craft/storage/runtime/logs/craft.log&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/09/13 13:39:02 [warning] [application] 404 - &#xA;2014/09/13 13:39:02 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /abs/path/to/craft/app/controllers/TemplatesController.php:59&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2014-09-13T18:08:09.353" LastActivityDate="2014-10-13T19:02:08.643" Title="&quot;An unknown error occurred.&quot; when changing profile avatar image" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-10-14T19:36:42.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="2522" PostTypeId="2" ParentId="2521" CreationDate="2014-09-12T21:57:47.800" Score="2" Body="&lt;p&gt;Check the log files in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; and search for &lt;code&gt;[error]&lt;/code&gt; or &lt;code&gt;[warning]&lt;/code&gt; to see the underlying error message.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-12T21:57:47.800" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2523" PostTypeId="1" CreationDate="2014-09-12T22:34:50.133" Score="1" ViewCount="1066" Body="&lt;p&gt;Im sorry, as I was formulating this question I discovered the answer. Chrome only accepts dates in ISO format (the accepted format for Chrome Date field is YYYY-MM-DD). So use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;date&quot; name=&quot;date&quot; value=&quot;{{ &quot;now&quot;|date(&quot;Y-m-d&quot;) }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which now looks aweful in Firefox, and not to mention the Date Picker issues.&lt;/p&gt;&#xA;" OwnerUserId="792" LastActivityDate="2014-09-12T22:34:50.133" Title="HTML5 date input field in Chrome ignores twig formatting?" Tags="&lt;datetime&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2015-02-20T01:27:15.777" ContentLicense="CC BY-SA 3.0" />
  <row Id="2524" PostTypeId="1" AcceptedAnswerId="2525" CreationDate="2014-09-13T00:43:10.910" Score="4" ViewCount="883" Body="&lt;p&gt;I have structures called Instrument and Person. On the person structure, I have a Matrix field called Roles. Roles has a block called Musician. And That block type has a Relationship Field called Instrument. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows someone to be a musician and to be assigned an instrument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I need to output each Instrument as a section, and all of the musicians that play that instrument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this issue has something to do with the relationship being added in a Matrix block rather than on the entry itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately there are many roles (block types) that a person can have, each with different fields. I tried to solve this by swapping to Instruments as categories but that doesn't seem to be working either. Here's some sample code I've been playing with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for instrument in craft.entries.section('instrument') %}&#xA;          &amp;lt;h3&amp;gt;{{ instrument.instrumentName }}&amp;lt;/h3&amp;gt;&#xA;          {% for person in craft.entries.section('person').relatedTo( instrument ) %}&#xA;            &amp;lt;p&amp;gt;{{ person.personName }}&amp;lt;/p&amp;gt;&#xA;          {% endfor %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="269" LastEditorUserId="269" LastEditDate="2014-09-13T00:54:42.023" LastActivityDate="2014-10-30T22:49:23.893" Title="How to query with relatedTo of a Relationship Field in a Matrix Field block" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2525" PostTypeId="2" ParentId="2524" CreationDate="2014-09-13T06:10:44.100" Score="2" Body="&lt;p&gt;I think your first idea of using Matrix rather than Categories makes the most sense as a content model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently added a new method to the plugin &lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow&quot;&gt;lowblocks&lt;/a&gt; which should help you. Low has already merged it into the core so go and install it now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work for you hopefully:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# loop through the instruments #}&#xA;{% for instrument in craft.entries.section('instrument') %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ instrument.instrumentName }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {# select all our musician blocks related to this instrument #}&#xA;    {% set musicians = craft.lowblocks.blocks.type('musiciansBlockHandle').relatedTo(instrument) %}&#xA;&#xA;    {% if musicians | length %}&#xA;&#xA;        {# loop through the results #}&#xA;        {% for musician in musicians %}&#xA;&#xA;            {# set a variable to store the person (the entry/owner of this block #}&#xA;            {% set person = musician.owner %}&#xA;&#xA;            &amp;lt;p&amp;gt;{{ person.personName }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2014-09-13T06:10:44.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2527" PostTypeId="1" AcceptedAnswerId="2529" CreationDate="2014-09-13T14:45:17.697" Score="4" ViewCount="700" Body="&lt;p&gt;I am a complete novice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Live Preview does not seem to be accessing the stylesheets, which are called in my _skeleton.html. My template is sample.html. I am live, not in dev environment,in case that matters. And this is a single, not channel or structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read the other questions/answers about this topic, but I haven't made changes to any code/php files, and I don't have any variables named &quot;entry.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, _skeleton.html.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; {% block language %}{% endblock language %}&amp;gt;&#xA;  &amp;lt;head prefix=&quot;og: http://ogp.me/ns#&quot;&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;&#xA;    {% block robots %}{% endblock robots %}&#xA;    &amp;lt;title&amp;gt;{% block title %}{% endblock title %}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;link rel=&quot;home&quot; href=&quot;{{ siteUrl }}&quot; /&amp;gt;&#xA;    &amp;lt;meta name=&quot;description&quot; {% block description %}{% endblock description %}&amp;gt;&#xA;    &amp;lt;!-- Typekit --&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;//use.typekit.net/xxx7vby.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;try{Typekit.load();}catch(e){}&amp;lt;/script&amp;gt;&#xA;    &amp;lt;!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --&amp;gt;&#xA;    &amp;lt;!--[if lt IE 9]&amp;gt;&#xA;      &amp;lt;script src=&quot;https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;      &amp;lt;script src=&quot;https://oss.maxcdn.com/respond/1.4.2/respond.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;![endif]--&amp;gt;&#xA;    &amp;lt;link rel=&quot;canonical&quot; {% block canonicalURL %}{% endblock canonicalURL %} /&amp;gt;&#xA;    &amp;lt;link rel=&quot;icon&quot; href=&quot;assets/images/favicon.ico&quot;&amp;gt;&#xA;    &amp;lt;!-- Bootstrap core CSS --&amp;gt;&#xA;    &amp;lt;link href=&quot;assets/bootstrap/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;    &amp;lt;!-- Custom styles for this template --&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/to-do.css&quot;&amp;gt;&#xA;    &amp;lt;!--http://ogp.me/--&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:title&quot; {% block ogTitle %}{% endblock ogTitle %}&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:type&quot; content=&quot;website&quot; /&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:url&quot; {% block ogURL %}{% endblock ogURL %} /&amp;gt;&#xA;    &amp;lt;!-- &amp;lt;meta property=&quot;og:image&quot; content=&quot;http://delectabl.es/assets/images/delectables-logo.png&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:image:type&quot; content=&quot;image/png&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:image:width&quot; content=&quot;???&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:image:height&quot; content=&quot;???&quot;&amp;gt; --&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:description&quot; {% block ogDescription %}{% endblock ogDescription %}&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:locale&quot; {% block locale %}{% endblock locale %}&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:site_name&quot; content=&quot;{{ siteName }}&quot;&amp;gt;&#xA;    &amp;lt;!--&amp;lt;meta prefix=&quot;fb: http://ogp.me/ns/fb#&quot; property=&quot;fb:app_id&quot; content=&quot;???????????????&quot;&amp;gt; --&amp;gt;&#xA;  &amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt;&#xA;{% block contents %}{% endblock contents %}&#xA;{% include &quot;includes/include-footer&quot; %}&#xA;{% include &quot;includes/include-bootstrap-core-javascript&quot; %}&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, sample.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block language %}&#xA;lang=&quot;{{ entry.languageLocale }}&quot;&#xA;{% endblock language %}&#xA;&#xA;{% block robots %}&#xA;{% if entry.metaRobotsIndex.contains('index') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;index&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('noindex') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;noindex&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('noimageindex') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;noimageindex&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('none') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;none&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('follow') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;index&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('nofollow') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;nofollow&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('noarchive') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;noarchive&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('nocache') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;nocache&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('nosnippet') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;nosnippet&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('noodp') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;noodp&quot;&amp;gt;&#xA;{% endif %}&#xA;{% if entry.metaRobotsIndex.contains('noydir') %}&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;noydir&quot;&amp;gt;&#xA;{% endif %}&#xA;{% endblock robots %}&#xA;&#xA;{% block title %}&#xA;{{ siteName }}: {{ entry.title }}&#xA;{% endblock title %}&#xA;&#xA;{% block description %}&#xA;content=&quot;{{ entry.metaDescription }}&quot;&#xA;{% endblock description %}&#xA;&#xA;{% block canonicalURL %}&#xA;href=&quot;{{ entry.url }}&quot;&#xA;{% endblock canonicalURL %}&#xA;&#xA;{% block ogTitle %}&#xA;content=&quot;{{ siteName }}: {{ entry.title }}&quot;&#xA;{% endblock ogTitle %}&#xA;&#xA;{% block ogURL %}&#xA;content=&quot;{{ entry.url }}&quot;&#xA;{% endblock ogURL %}&#xA;&#xA;{% block ogDescription %}&#xA;content=&quot;{{ entry.metaDescription }}&quot;&#xA;{% endblock ogDescription %}&#xA;&#xA;{% block locale %}&#xA;content=&quot;{{ entry.languageLocale }}&quot;&#xA;{% endblock locale %}&#xA;&#xA;{% block contents %}&#xA;    &amp;lt;div class=&quot;container-fluid&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-xs-10 col-xs-offset-1&quot;&amp;gt;&#xA;          &amp;lt;article&amp;gt;&#xA;            &amp;lt;header&amp;gt;&#xA;              &amp;lt;h1&amp;gt;{{ entry.heading }}&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;            &amp;lt;div&amp;gt;&#xA;              {{ entry.body }}&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock contents %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The page is live (ignore the ugly styling). You can see it at delectabl.es/sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Live Preview it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nYtnl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lora at Two Sigma&lt;/p&gt;&#xA;" OwnerUserId="757" LastActivityDate="2014-09-13T15:07:07.447" Title="Live Preview has No Style" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2529" PostTypeId="2" ParentId="2527" CreationDate="2014-09-13T14:59:27.763" Score="7" Body="&lt;p&gt;Not sure what your end url is but I think you'll need either a &quot;/&quot; or {{ siteUrl }} before &quot;assets&quot; in &quot;assets/bootstrap/css/bootstrap.min.css&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so (for all references to css etc.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;{{ siteUrl }}assets/bootstrap/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;/assets/bootstrap/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2014-09-13T15:07:07.447" LastActivityDate="2014-09-13T15:07:07.447" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2530" PostTypeId="1" AcceptedAnswerId="2543" CreationDate="2014-09-13T17:22:41.163" Score="4" ViewCount="150" Body="&lt;p&gt;I'm working on a site that has two different entry types (e.g., &quot;blog&quot; and &quot;photos&quot;), and each type has it's own tag group. When viewing a particular entry, I'd like to display related entries found in both entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for example, let's say that I've written &quot;Entry A&quot; and &quot;Entry B&quot; -- &quot;Entry A&quot; is in &quot;blog&quot; and &quot;Entry B&quot; is a &quot;photos.&quot; They both have the same tag (&quot;foo&quot;), but that tag exists in each entry type's respective tag group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I view &quot;Entry A,&quot; can I display a list of related entries that includes &quot;Entry B&quot; even though the tag that they share isn't in the same tag group?&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2014-09-15T09:19:41.610" Title="Display related entries across different entry types using tags in different tag groups?" Tags="&lt;tags&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2531" PostTypeId="1" AcceptedAnswerId="2532" CreationDate="2014-09-14T01:54:40.523" Score="4" ViewCount="1193" Body="&lt;p&gt;When writing a plugin is there a Craft request to grab the entire url? I want to grab everything including &lt;a href=&quot;http://domain.com/uri&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/uri&lt;/a&gt; preferably without writing my own function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getUrl&quot; rel=&quot;nofollow&quot;&gt;getUrl&lt;/a&gt; but &lt;code&gt;craft()-&amp;gt;request-&amp;gt;url&lt;/code&gt; only returns 'uri' of &lt;a href=&quot;http://domain.com/uri&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/uri&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="177" LastEditDate="2014-09-14T08:31:48.800" LastActivityDate="2014-09-14T08:31:48.800" Title="How to grab the full URL in a plugin?" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2532" PostTypeId="2" ParentId="2531" CreationDate="2014-09-14T03:35:36.137" Score="5" Body="&lt;p&gt;You're probably looking for something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getHostInfo().craft()-&amp;gt;request-&amp;gt;getRequestUri();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will return the host name with the schema it's using (http:// or https://) as well as any URI after the host including any querystring parameters.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-14T03:35:36.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2533" PostTypeId="1" AcceptedAnswerId="2538" CreationDate="2014-09-14T08:00:52.553" Score="7" ViewCount="1822" Body="&lt;p&gt;Is it possible to allow some users to write content &amp;amp; an editor can edit &amp;amp; publish / approve it?&lt;/p&gt;&#xA;" OwnerUserId="794" LastActivityDate="2017-04-26T01:20:06.107" Title="Does Craft Have Publishing Workflow?" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2534" PostTypeId="1" AcceptedAnswerId="2535" CreationDate="2014-09-14T10:09:45.730" Score="2" ViewCount="147" Body="&lt;p&gt;I try to build a complete sentence based on tags as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is a sentence with tag1, tag2 and tag3.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topics = entry.topics.first %}&#xA;&#xA;{% for topic in entry.topics.offset(1) %}&#xA;    {% if topic != entry.topics.last %}&#xA;       {% set topics = topics ~ ', ' ~ topic %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;p&amp;gt;This is a sentence with {{ topics }} and {{ entry.topics.last }}.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is that the if clause does not work. The results is always:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is a sentence with tag1, tag2, tag3 and tag3.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="57" LastEditDate="2014-09-14T15:43:35.003" LastActivityDate="2014-09-14T15:43:35.003" Title="How to build a sentence based on tags" Tags="&lt;tags&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2535" PostTypeId="2" ParentId="2534" CreationDate="2014-09-14T13:09:59.990" Score="5" Body="&lt;p&gt;I think it'll be easier and more efficient to achieve that if you use the loop functionality instead of querying the actual tags. I think this code does what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topics = '' %}&#xA;&#xA;{% for topic in entry.topics %}&#xA;    {% set topics = topics ~ topic ~ (loop.index &amp;lt; loop.length-1 ? ', ' : loop.index &amp;lt; loop.length ? ' and ') %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;p&amp;gt;This is a sentence with {{ topics }}.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-14T13:09:59.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2536" PostTypeId="2" ParentId="2440" CreationDate="2014-09-14T17:02:07.800" Score="1" Body="&lt;p&gt;As I am not able to comment I am leaving a braindump...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you try to trigger actions/tasks whatever in a environment like devmaster &amp;lt;-- dev, a dev &amp;lt;-- stage or something similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is the case:&lt;br&gt;&#xA;I was looking at that already as well but found utilizing a cron job or puppet script be more&lt;br&gt;&#xA;- secure and controllable (also in case a developer leaves the company)&lt;br&gt;&#xA;- scalable in regards to performance and security also accross   systems/clusters/dokku boxes)&lt;br&gt;&#xA;- more reliable and granular as it allows more detailed logging/repoting options in case of a failure (snapin for the dashboard could utilize system logs and related data, you just need a template and no conversion)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I am still in a concept phase for my project, I cant provide a working sample yet, sorry.&lt;/p&gt;&#xA;" OwnerUserId="726" LastEditorUserId="726" LastEditDate="2014-09-14T17:31:10.737" LastActivityDate="2014-09-14T17:31:10.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2537" PostTypeId="2" ParentId="2045" CreationDate="2014-09-14T17:29:06.690" Score="3" Body="&lt;p&gt;Seems to be the new standard since version 2.2.2582:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Entry and category search results now place a 5X weight on search term matches within Title fields.&quot;&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2014-09-14T17:29:06.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2538" PostTypeId="2" ParentId="2533" CreationDate="2014-09-14T18:00:19.237" Score="7" Body="&lt;p&gt;You can give a user or a user group the following permissions (on each section separately):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Edit entries&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create entries&lt;/li&gt;&#xA;&lt;li&gt;Publish live changes&lt;/li&gt;&#xA;&lt;li&gt;Delete entries&lt;/li&gt;&#xA;&lt;li&gt;Edit other authors’ entries&lt;/li&gt;&#xA;&lt;li&gt;Edit other authors’ drafts&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If a user only can &quot;create entries&quot;, but not &quot;publish live changes&quot;, then he is not able to publish an entry (but he can create the entry).&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="517" LastEditDate="2014-09-14T19:52:05.630" LastActivityDate="2014-09-14T19:52:05.630" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2540" PostTypeId="5" CreationDate="2014-09-15T01:06:35.350" Score="0" Body="&lt;p&gt;The project website is located at &lt;a href=&quot;http://imperavi.com/redactor/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Redactor is a paid product, with three pricing options. Purchases include updates and a year of support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Key benefits:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;customizable toolbar&lt;/li&gt;&#xA;&lt;li&gt;drag and drop images&lt;/li&gt;&#xA;&lt;li&gt;lightweight design&lt;/li&gt;&#xA;&lt;li&gt;extensible via API&lt;/li&gt;&#xA;&lt;li&gt;parses pasted links&lt;/li&gt;&#xA;&lt;li&gt;built for developers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="70" LastEditorUserId="70" LastEditDate="2014-09-15T05:23:23.813" LastActivityDate="2014-09-15T05:23:23.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2541" PostTypeId="4" CreationDate="2014-09-15T01:06:35.350" Score="0" Body="An easy to use WYSIWYG editor that is visually light and very flexible." OwnerUserId="70" LastEditorUserId="70" LastEditDate="2014-09-15T05:23:06.600" LastActivityDate="2014-09-15T05:23:06.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2542" PostTypeId="1" CreationDate="2014-09-15T05:04:34.730" Score="2" ViewCount="732" Body="&lt;p&gt;(I have a lot of experience with custom PHP and JS code and multiple frameworks and a few CMS's, but little experience with Craft.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a site and they want to have multiple accounts and admins and users that fit in that paradigm, and I'm not sure the best way to approach it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So general admins should be able to create new accounts and account admins. Account admins can log in and add products for their account &lt;em&gt;only&lt;/em&gt;. And then the regular site is locked behind a login so that &quot;regular&quot; users must log in and be associated with an account and can. Both Account Admins and General Admins should be able to create &quot;regular&quot; users (but the former for their accounts only).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was maybe thinking of associating extra fields to User Groups and trying to go at it in that route. I see you can edit User Profiles with Pro, but I don't see a way to customize User Groups (maybe we don't fully need that, but maybe just let those general admins create User Groups (can this be renamed &quot;Accounts?&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize this is a bit of a vague/open ended question. Maybe this isn't really practical in Craft, or will need a lot of custom work...? Or maybe someone has a plugin with this in mind? Just looking for some general help, and this seemed like the place to start!&lt;/p&gt;&#xA;" OwnerUserId="338" LastActivityDate="2014-09-23T20:07:05.777" Title="What's the best way to create a multiple account architecture?" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2543" PostTypeId="2" ParentId="2530" CreationDate="2014-09-15T09:19:41.610" Score="4" Body="&lt;p&gt;Ok, I believe this does what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.tags1 | length %}&#xA;&#xA;    {# get tag names from our current entry #}&#xA;    {% set entryTagNames = [] %}&#xA;    {% for tag in entry.tags1 %}&#xA;        {% set entryTagNames = entryTagNames | merge([tag.name]) %}&#xA;    {% endfor %}&#xA;&#xA;    {% if entryTagNames | length %}&#xA;&#xA;        {# get tags from the other tag group with the same names #}&#xA;        {% set otherTags = craft.tags({ group: 'group2', name: entryTagNames }) %}&#xA;&#xA;        {# get entries related to these tags #}&#xA;        {% set retaledEntries = craft.entries({ section: 'news', relatedTo: otherTags }) %}&#xA;&#xA;        {# output related entries. just debugging that this actually works #}&#xA;        {% for relatedEntry in retaledEntries %}&#xA;            {{ relatedEntry }}&amp;lt;br&amp;gt;&#xA;            {% for relatedEntryTag in relatedEntry.tags2 %}&#xA;                - {{ relatedEntryTag.name }}&amp;lt;br&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My first section, which the current entry is in, has a field named &lt;strong&gt;tags1&lt;/strong&gt;, connected to the tag group &lt;strong&gt;group1&lt;/strong&gt;. My second section is named &lt;strong&gt;news&lt;/strong&gt;, has a field named &lt;strong&gt;tags2&lt;/strong&gt;, connected to the tag group &lt;strong&gt;group2&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems a bit sketchy to rely on tag &lt;em&gt;names&lt;/em&gt;, but. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-15T09:19:41.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2544" PostTypeId="1" AcceptedAnswerId="2547" CreationDate="2014-09-15T10:15:33.593" Score="3" ViewCount="2629" Body="&lt;p&gt;I have a field where the client can enter a URL, and then that field's value is put into the 'href' of a link in the template. The client will sometimes prepend it with &quot;http://&quot;, sometimes with &quot;www.&quot;, and sometimes with nothing. Unless it's prepended with &quot;http://&quot; or &quot;https://&quot;, the link is interpreted as relative and tries to go to &quot;&lt;a href=&quot;http://mysite.com/www.otherlink.com&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/www.otherlink.com&lt;/a&gt;&quot;, which is obviously not what I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way of automatically handling different URL formats?&lt;/p&gt;&#xA;" OwnerUserId="228" LastActivityDate="2014-09-15T12:47:50.080" Title="What's the best way to make sure external URLs aren't interpreted as relative links?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2545" PostTypeId="1" AcceptedAnswerId="2546" CreationDate="2014-09-15T10:22:30.860" Score="5" ViewCount="2315" Body="&lt;p&gt;I installed craft according to the documentation but when I tried to access example.com/admin I get following error&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Request exceeded the limit of 10 internal redirects due to probable&#xA;  configuration error. Use 'LimitInternalRecursion' to increase the&#xA;  limit if necessary. Use 'LogLevel debug' to get a backtrace., referer:&#xA;  &lt;a href=&quot;http://example.com/&quot; rel=&quot;noreferrer&quot;&gt;http://example.com/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Every subpage like example.com/about has the same behavior. Only example.com works&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2015-03-20T16:47:49.440" Title="URLs other than index cause 500 internal server error" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2546" PostTypeId="2" ParentId="2545" CreationDate="2014-09-15T10:26:32.943" Score="9" Body="&lt;p&gt;I changed the .htaccess-file after I found the &lt;a href=&quot;https://stackoverflow.com/questions/15850845/request-exceeded-the-limit-of-10-internal-redirects-due-to-probable-configuratio&quot;&gt;same problem with cakePHP&lt;/a&gt;. I just had to add &lt;code&gt;RewriteBase /&lt;/code&gt; after &lt;code&gt;RewriteEngine On&lt;/code&gt; so the .htaccess looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteBase /&#xA;    # Send would be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your site is &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;multilingual&lt;/a&gt; (i.e., if you have subfolders like &lt;code&gt;/en/&lt;/code&gt;, &lt;code&gt;/de/&lt;/code&gt;, etc. with indivudual .htaccess files in them), this fix requires you to add you the locale's segment to the specific rewrite base of each .htaccess file (e.g. &lt;code&gt;RewriteBase /en/&lt;/code&gt; and so on.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now it works fine.&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-03-20T16:47:49.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2547" PostTypeId="2" ParentId="2544" CreationDate="2014-09-15T10:29:12.603" Score="6" Body="&lt;p&gt;Using Craft, you could go two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make your own field-type, that handles the url in PHP and appends http:// if needed (&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot;&gt;Create a plugin for that&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Check the url for 'http' in your template, and if needed prepend it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set url = entry.url | slice(0,4) == 'http' ? entry.url : 'http://' ~ entry.url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Be sure to use the {% cache %} tag if you use option 2, so the check only has to be done once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: You could use &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/link-field&quot;&gt;this plugin&lt;/a&gt; to pre-validate your urls.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-09-15T10:40:41.687" LastActivityDate="2014-09-15T10:40:41.687" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2548" PostTypeId="1" AcceptedAnswerId="2549" CreationDate="2014-09-15T12:16:29.800" Score="4" ViewCount="3025" Body="&lt;p&gt;The &lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.request.html#getcookie-name&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; state that &lt;code&gt;{{ craft.request.getCookie(name) }}&lt;/code&gt; will not work for cookies that were set in JavaScript, because all cookies in Craft go through some validation to ensure that they aren't tampered with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is understandable, but is there any way of getting non-Craft cookies with twig?&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="975" LastEditDate="2018-06-05T18:34:18.363" LastActivityDate="2020-03-28T18:12:33.823" Title="How can I get cookies that were set in javascript from a twig template?" Tags="&lt;templating&gt;&lt;cookies&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2549" PostTypeId="2" ParentId="2548" CreationDate="2014-09-15T12:16:29.800" Score="7" Body="&lt;p&gt;So far the only solution I have found is to use a plugin, and Lewis Jenkins' &lt;a href=&quot;https://github.com/khamer/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Cookies plugin&lt;/a&gt; does the trick nicely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.lj_cookies.get( NAME ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It also allows you to set and delete cookies within templates.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2020-03-28T18:12:33.823" LastActivityDate="2020-03-28T18:12:33.823" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2550" PostTypeId="2" ParentId="2544" CreationDate="2014-09-15T12:47:50.080" Score="3" Body="&lt;p&gt;There is a fieldtype called &lt;a href=&quot;http://straightupcraft.com/craft-plugins/link-field&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt; from Sprout that validates links, and it works very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One point of criticism is that the error it gives you when you haven't added the protocol isn't very client-friendly. It just says: 'Link must be a valid link.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could either contact Sprout and give them feedback on that, and they'll probably improve it (it's in beta), or you could modify it yourself.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-15T12:47:50.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2551" PostTypeId="1" AcceptedAnswerId="2552" CreationDate="2014-09-15T18:51:58.127" Score="3" ViewCount="348" Body="&lt;p&gt;I have a site where I want to set up a &quot;tour&quot; of a software screenshot, and I need to allow users to select points on an image to insert the tour &quot;stops&quot;. Is there an add-on like DevDemon's &lt;a href=&quot;http://devot-ee.com/add-ons/entry-mapper&quot; rel=&quot;nofollow&quot;&gt;Entry Mapper&lt;/a&gt; for Craft? Or does anyone have a suggestion for a way to do this that doesn't involve explaining to a client how to figure out coordinates on an image and then entering them into a Matrix field?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2014-09-15T19:35:44.837" Title="Plot absolute coordinates / Image map" Tags="&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2552" PostTypeId="2" ParentId="2551" CreationDate="2014-09-15T19:35:44.837" Score="3" Body="&lt;p&gt;Have a look at Iain Urquhart's plugin, Pointy: &lt;a href=&quot;https://github.com/iainurquhart/Craft-Pointy&quot; rel=&quot;nofollow&quot;&gt;https://github.com/iainurquhart/Craft-Pointy&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a port of his EE addon that's similar to Entry Mapper, but I'm not 100% certain if it's production ready or not. &lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2014-09-15T19:35:44.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2553" PostTypeId="1" AcceptedAnswerId="2554" CreationDate="2014-09-15T21:21:00.610" Score="4" ViewCount="846" Body="&lt;p&gt;I'm looking to paginate and array with multiple filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current url would be: &lt;code&gt;www.example.com/search?filter=shorts&amp;amp;type=leather&amp;amp;brand=sams&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking on the next next link returns: &lt;code&gt;www.example.com/search/p2&lt;/code&gt; effectively removing the search params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to paginate the full url without removing the search params?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate test.limit(4) as entries %}&#xA;    {% for entry in entriesOnPage %}&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;            {{ entry.body }}&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="788" LastEditorUserId="57" LastEditDate="2014-09-15T21:22:45.910" LastActivityDate="2014-09-15T21:35:42.083" Title="Paginate an array with multiple filters" Tags="&lt;search&gt;&lt;pagination&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2554" PostTypeId="2" ParentId="2553" CreationDate="2014-09-15T21:26:29.380" Score="6" Body="&lt;p&gt;Try using this (completely untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate.prevUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.prevUrl }}?{{ craft.request.getQueryStringWithoutPath() }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if paginate.nextUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.nextUrl }}?{{ craft.request.getQueryStringWithoutPath() }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above will only work once Craft 2.3 comes out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, it's a bit sketchy, but you can open up &lt;code&gt;craft/app/variables/HttpRequestVariable.php&lt;/code&gt; and add this method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getQueryStringWithoutPath()&#xA;{&#xA;    return craft()-&amp;gt;request-&amp;gt;getQueryStringWithoutPath();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it should work.  But please be aware that file could be overwritten by a 2.2 build release at any point during an auto-update and your template would break.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-15T21:35:42.083" LastActivityDate="2014-09-15T21:35:42.083" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2555" PostTypeId="2" ParentId="1894" CreationDate="2014-09-15T23:01:04.590" Score="1" Body="&lt;p&gt;Best I can figure it's either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A Redactor bug&lt;/li&gt;&#xA;&lt;li&gt;A known behavior and Redactor just &lt;em&gt;really&lt;/em&gt; doesn't like &lt;code&gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Even if you explicitly set Redactor's &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/#set-allowedTags&quot; rel=&quot;nofollow&quot;&gt;allowedTags&lt;/a&gt; config setting to include span, they will strip it out simply swapping between source and rendered view, whereas any other tag I set in that list will be allowed as expected.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-15T23:06:48.810" LastActivityDate="2014-09-15T23:06:48.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2556" PostTypeId="1" CreationDate="2014-09-16T11:01:22.723" Score="2" ViewCount="923" Body="&lt;p&gt;This probably has a very simple answer but cannot seem to get it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 404.html template in craft/templates and it works fine within a section (such as &lt;a href=&quot;https://shanehudson.net/articles/dfs&quot; rel=&quot;nofollow&quot;&gt;https://shanehudson.net/articles/dfs&lt;/a&gt;) but not at all for non-existant pages in the root (such as &lt;a href=&quot;https://shanehudson.net/404&quot; rel=&quot;nofollow&quot;&gt;https://shanehudson.net/404&lt;/a&gt;). Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-09-16T11:01:22.723" Title="404 Page Not Showing" Tags="&lt;404-page&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2557" PostTypeId="1" AcceptedAnswerId="2559" CreationDate="2014-09-16T12:17:52.470" Score="2" ViewCount="157" Body="&lt;p&gt;Apologies if I am dense, it won't be the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have thousands of product images that I will output on more than one page, under varying conditions.  Rather than having to do an entry for each product in these circumstances, can I just:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;attach product  description fields to the asset field&lt;/li&gt;&#xA;&lt;li&gt;upload the assets &lt;/li&gt;&#xA;&lt;li&gt;use Bob Olde Hampsink's import plug-in to populate all the product info to assets fields&lt;/li&gt;&#xA;&lt;li&gt;fetch the asset and the associated fields in a template&lt;/li&gt;&#xA;&lt;li&gt;skip the entry part altogether?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This way I could use the same asset in multiple instances without having to reinvent the wheel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  A. Is this possible?&#xA;  B. Is this wise?&#xA;  C. If A and B =='yes' what is the most direct way to go about this?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="83" LastEditorUserId="83" LastEditDate="2014-09-16T13:08:12.843" LastActivityDate="2014-09-16T13:47:36.260" Title="Outputting Assets Instead of Entries" Tags="&lt;templating&gt;&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2558" PostTypeId="1" CreationDate="2014-09-16T13:07:36.407" Score="1" ViewCount="852" Body="&lt;p&gt;I like to have the user’s full name in their profile page-url rather than the username in case they don’t want their username associated with their full name. In my case they don’t get to set the username at the sign up point but might been asked for a username by the person signing them up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do i use the user’s full name as an identifier in the url of their profile page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so: &lt;code&gt;example.com/user/first-last&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that even possible?&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="57" LastEditDate="2014-09-16T17:02:50.603" LastActivityDate="2014-09-16T17:02:50.603" Title="Using a user’s full name in the URL" Tags="&lt;url&gt;&lt;user-profile&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2559" PostTypeId="2" ParentId="2557" CreationDate="2014-09-16T13:20:33.543" Score="2" Body="&lt;p&gt;Since there is several moving parts here, i'll make a few assumptions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You got a list of some kind with the product images and their containing metadata.&lt;/li&gt;&#xA;&lt;li&gt;Your product image filenames have a consistent naming scheme. Something like product-condition1-01,product-condition2-01, product-condition2-02&lt;/li&gt;&#xA;&lt;li&gt;You are able to write a couple PHP scripts and/or some frontend code that uploads your images, and then creates an list with the returned fileIds and the matching image filename. Take a look at &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService&lt;/a&gt; and the uploadFile action in &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/AssetsController#actionUploadFile-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsController&lt;/a&gt;. For the uploading part, you can probably make a simple JS snippet that loops through the file list and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2113/does-anyone-have-a-working-example-of-frontend-form-with-multiple-file-upload-d/2163#2163&quot;&gt;uploads them&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;After you got that list, write a script that runs through the product list (an CSV or something), and replace the placeholders matching your image filenames (product-condition-xx etc.) with the previous fetched fileId(s).&lt;/li&gt;&#xA;&lt;li&gt;You will then end up with a comma-separated list of fileIds in your CSV fields, which Craft expects to able to relate the Assets to the imported Entries.&lt;/li&gt;&#xA;&lt;li&gt;Import the entries with Import.&lt;/li&gt;&#xA;&lt;li&gt;List the connected assets in your entries template the normal way.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have not looked into how to save field info for Assets, but you can for sure make fields and then add them to the field layout for your Assets Sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Not sure I understand all the conditions, but I think my outline should work pretty well for your case. Not able to comment yet, so I could not ask any questions beforehand. I'll update my answer if you add some follow-up information).&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-09-16T13:47:36.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2560" PostTypeId="2" ParentId="2558" CreationDate="2014-09-16T14:30:54.137" Score="4" Body="&lt;p&gt;Marcus, I think you can use &lt;em&gt;anything&lt;/em&gt; as an url for a user's page. In your case, I'd make a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;user/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and assign it a template, for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;user/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within that template, all you'd have to do is lookup the user by the match found in the url. The variable &lt;em&gt;matches&lt;/em&gt; contains the first-last part (the * part of your route). With that, the user should be easy to find:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set names = matches[1] | split('-') %}&#xA;{% set user = craft.users.firstName(names[0]).lastName(names[1]).first() %}&#xA;&#xA;{% if user %}&#xA;    // Do with it what you want&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd have to be careful, however, that no two identical first- and last name combinations exists. The advantage of using the username is that it's always unique.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-16T14:30:54.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2561" PostTypeId="2" ParentId="2558" CreationDate="2014-09-16T14:47:57.287" Score="2" Body="&lt;p&gt;Although the craft.users tag let you find users who have firstName or lastName matching whatever, I wouldn't try to match just against that, as you could end up having users with the same sames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would include the id of the user in the URL, so you would have something like example.com/user/1-first-last&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can lookup the profile by doing this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; that matches for example profile/(number)-*&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Graf the profile with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &#xA;    - Use matches variable from dynamic route&#xA;    - matches.number will give you the expected id if you only have &#xA;      one number segment in your dynamic route&#xA;#}&#xA;{% set userId = matches.number %}&#xA;{# Find user #}&#xA;{% if userId is defined %}&#xA;    {% set profile = craft.users.id(userId) | first %}&#xA;        {{ profile.name }}&amp;lt;br/&amp;gt;&#xA;        {{ profile.username }}&amp;lt;br/&amp;gt;&#xA;        {{ profile.email }}&amp;lt;br/&amp;gt;&#xA;        {{ profile.id }}&amp;lt;br/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-16T16:17:13.733" LastActivityDate="2014-09-16T16:17:13.733" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2562" PostTypeId="1" CreationDate="2014-09-16T18:51:02.137" Score="1" ViewCount="897" Body="&lt;p&gt;I know that it is possible to let user comment entries using the guest entries plugin or to implement a third-party solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wonder if is someone working on a dedicated comment plugin?&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-04-03T11:55:28.927" Title="Looking for comment plugin" Tags="&lt;plugins&gt;&lt;comments&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2563" PostTypeId="2" ParentId="2562" CreationDate="2014-09-16T19:09:39.107" Score="4" Body="&lt;p&gt;Don't know of any comment plugins yet but the easiest thing to do is to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/integrating-disqus&quot; rel=&quot;nofollow&quot;&gt;Integrate Disqus&lt;/a&gt;. You just drop the embed code in and paste in your entry ID.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2014-09-16T20:23:32.583" LastActivityDate="2014-09-16T20:23:32.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2564" PostTypeId="2" ParentId="20" CreationDate="2014-09-16T19:20:58.947" Score="5" Body="&lt;p&gt;You could also do what Victor In has suggested, but deal with everything in arrays and hashes instead of building a big string. That way you only have to encode once at the end, and it's easier (for me) to debug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;  {% set entries = [] %}&#xA;&#xA;  {% for entry in craft.entries.section('people') %}&#xA;    {% set thisEntry = {} %}&#xA;&#xA;    {% for fieldModel in entry.getType().getFieldLayout().getFields() %}&#xA;      {% set fieldHandle = fieldModel.field.handle %}&#xA;      {% set fieldAttr = attribute(entry, fieldHandle) %}&#xA;&#xA;      {% switch fieldModel.field.type %}&#xA;&#xA;        {% case 'Assets' %}&#xA;          {% set enumerable = [] %}&#xA;          {% for asset in fieldAttr %}&#xA;            {% set enumerable = enumerable|merge([{&#xA;              'title': asset.title,&#xA;              'url': asset.url&#xA;            }]) %}&#xA;          {% endfor %}&#xA;          {% set fieldValue = enumerable %}&#xA;&#xA;        {% default %}&#xA;          {% set fieldValue = fieldAttr %}&#xA;      {% endswitch %}&#xA;&#xA;      {% set thisEntry = thisEntry|merge({(fieldHandle): fieldValue}) %}&#xA;    {% endfor %}&#xA;&#xA;    {% set entries = entries|merge([thisEntry]) %}&#xA;  {% endfor %}&#xA;  {{ entries | json_encode() | raw }}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-09-16T19:20:58.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2565" PostTypeId="1" AcceptedAnswerId="3048" CreationDate="2014-09-16T19:22:15.167" Score="6" ViewCount="1820" Body="&lt;p&gt;I'd like to create a field type for my plugin called &quot;location&quot; with two text boxes: one that holds a coordinate for latitude, and one for longitude. I haven't figured out yet how to map those two values from HTML input elements in a template to a JSON array in the database.  Is there an elegant way to achieve this with the Craft API?  &lt;/p&gt;&#xA;" OwnerUserId="800" LastEditorUserId="800" LastEditDate="2014-09-16T20:00:13.407" LastActivityDate="2014-10-09T16:15:38.707" Title="Custom Field Type with Multiple Values" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2566" PostTypeId="1" CreationDate="2014-09-16T19:43:48.850" Score="2" ViewCount="82" Body="&lt;p&gt;Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.artistFirstName | capitalize ~ ' ' ~ entry.title | capitalize %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It outputs &lt;em&gt;Firstname title&lt;/em&gt; instead of &lt;em&gt;Firstname Title&lt;/em&gt; whereas filters are applied on the two concatenated elements. Why and how to add this filter on each of these elements?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2014-09-17T12:00:34.960" Title="How to apply a filter on a title with several concatenated elements?" Tags="&lt;filter&gt;&lt;titles&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2567" PostTypeId="1" AcceptedAnswerId="2571" CreationDate="2014-09-16T19:51:09.100" Score="1" ViewCount="220" Body="&lt;p&gt;I need to set the page title like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.artistFirstName | length %}&#xA;    {{ entry.artistFirstName | capitalize }}&#xA;{% endif %}&#xA;&#xA;{{ entry.title | capitalize }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if a first name is set I need to display it, but if not I only need to display the entry's title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is one of the solutions I've tried but unfortunately does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = {% if entry.artistFirstName | length %}&#xA;    {{ entry.artistFirstName | capitalize }}&#xA;{% endif %}&#xA;&#xA;{{ entry.title | capitalize }} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It does not seem possible to define something in something that is being defined. Any idea how to get around this?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="57" LastEditDate="2014-09-16T19:54:30.660" LastActivityDate="2014-09-16T23:04:06.420" Title="How to add a conditional elements into the title of a page?" Tags="&lt;conditional&gt;&lt;titles&gt;&lt;concatenation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2568" PostTypeId="2" ParentId="2566" CreationDate="2014-09-16T19:55:35.270" Score="0" Body="&lt;pre&gt;&lt;code&gt;{% set title = (entry.artistFirstName|capitalize) ~ ' ' ~ (entry.title|capitalize) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2014-09-16T19:55:35.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2569" PostTypeId="2" ParentId="2567" CreationDate="2014-09-16T20:11:45.240" Score="2" Body="&lt;p&gt;How about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We assign the result of a conditional to a variable called &lt;code&gt;title&lt;/code&gt;. The conditional checks if &lt;code&gt;entry.artistFirstName&lt;/code&gt; is not empty. If true we assign it to the &lt;code&gt;title&lt;/code&gt; variable, if false we fallback to assigning &lt;code&gt;entry.title&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = (entry.artistFirstName) ? entry.artistFirstName ~ ' ' ~ entry.title : entry.title %}&#xA;&#xA;{{ title | capitalize }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastEditorUserId="379" LastEditDate="2014-09-16T21:47:37.927" LastActivityDate="2014-09-16T21:47:37.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2570" PostTypeId="1" AcceptedAnswerId="2579" CreationDate="2014-09-16T20:46:06.437" Score="2" ViewCount="1474" Body="&lt;p&gt;I followed the advice from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2428/multi-environment-config-for-siteurl-not-working/2433#2433&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1771/environment-variable-siteurl-ignored&quot;&gt;this&lt;/a&gt; post, but I just can't get my environment specific &lt;code&gt;siteUrl&lt;/code&gt;s to work.&lt;/p&gt;&#xA;&lt;p&gt;This is what my config file looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;      'errorTemplatePrefix' =&amp;gt; &amp;quot;pages/&amp;quot;,&#xA;    ),&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;      'environmentVariables' =&amp;gt; array(&#xA;        'userSessionDuration' =&amp;gt; false,&#xA;        'devMode' =&amp;gt; true,&#xA;        'siteUrl ' =&amp;gt; 'http://myurl.dev',&#xA;      )&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;      'environmentVariables' =&amp;gt; array(&#xA;        'userSessionDuration' =&amp;gt; false,&#xA;        'devMode' =&amp;gt; true,&#xA;        'siteUrl ' =&amp;gt; 'http://myurl.com',&#xA;      )&#xA;    ),&#xA;&#xA;    '.org' =&amp;gt; array(&#xA;      'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'  =&amp;gt; 'http://myurl.org',&#xA;      )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;These &lt;strong&gt;do not take precedence&lt;/strong&gt; over any URL specified in &lt;code&gt;Settings &amp;gt; General&lt;/code&gt; in the CP as outlined in the docs. If I set the &lt;code&gt;Site URL&lt;/code&gt; field to &lt;code&gt;{siteUrl}&lt;/code&gt; in the CP, then my links are broken and look like this: &lt;code&gt;{siteUrl}/link-to-a-page&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Am I missing something else to get the &lt;code&gt;siteUrl&lt;/code&gt; settings to work?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;Fixed the additional space in 'siteUrl ', thanks to Lindsey.&lt;/p&gt;&#xA;&lt;p&gt;My config settings now look like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(&#xA;  'errorTemplatePrefix' =&amp;gt; &amp;quot;pages/&amp;quot;,&#xA;),&#xA;// local&#xA;'.dev' =&amp;gt; array(&#xA;  'devMode' =&amp;gt; true,&#xA;  'userSessionDuration' =&amp;gt; false,&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://myurl.dev',&#xA;  )&#xA;),&#xA;// staging&#xA;'.com' =&amp;gt; array(&#xA;  'devMode' =&amp;gt; true,&#xA;  'userSessionDuration' =&amp;gt; false,&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://myurl.com',&#xA;  )&#xA;),&#xA;// live&#xA;'.org' =&amp;gt; array(&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'siteUrl'  =&amp;gt; 'http://myurl.org',&#xA;  )&#xA;)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With this and adding &lt;code&gt;{siteUrl}&lt;/code&gt; in the CP, everything works as expected - hooray!&lt;/p&gt;&#xA;&lt;p&gt;It does however not reflect what the Craft docs say, as they state that the config settings &amp;quot;&lt;strong&gt;will take precedence over the Site URL setting in Settings → General&lt;/strong&gt;&amp;quot;. I've contacted the Craft team to let them know about this.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Update #2&lt;/h2&gt;&#xA;&lt;p&gt;Got this response from Brandon:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;“I'm guessing that when you added 'siteUrl' to your config, you put it inside the environmentVariables array? (which would explain why adding {siteUrl} to the CP setting made it work.)&lt;/p&gt;&#xA;&lt;p&gt;When the documentation is referring to the siteUrl config setting, it's referring to an actual top-level config setting, not some custom &amp;quot;siteUrl&amp;quot; environmentVariable that happens to have the same name.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So I've taken the setting out of &lt;code&gt;environmentVariables&lt;/code&gt;, and hey presto, it all works as expected. You even get a helpful message in the CP:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://cl.ly/image/1V120c2m2N0o/Screen%20Shot%202014-09-19%20at%2010.45.00.png&quot; alt=&quot;screenshot&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Final working code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(&#xA;  'errorTemplatePrefix' =&amp;gt; &amp;quot;pages/&amp;quot;,&#xA;),&#xA;// local&#xA;'.dev' =&amp;gt; array(&#xA;  'devMode' =&amp;gt; true,&#xA;  'userSessionDuration' =&amp;gt; false,&#xA;  'siteUrl' =&amp;gt; 'http://myurl.dev',&#xA;),&#xA;// staging&#xA;'.com' =&amp;gt; array(&#xA;  'devMode' =&amp;gt; true,&#xA;  'userSessionDuration' =&amp;gt; false,&#xA;  'siteUrl' =&amp;gt; 'http://myurl.com',&#xA;),&#xA;// live&#xA;'.org' =&amp;gt; array(&#xA;  'siteUrl'  =&amp;gt; 'http://myurl.org',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Got there in the end - phew!&lt;/p&gt;&#xA;" OwnerUserId="176" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-09-19T09:50:59.280" Title="Environment specific siteUrl settings not working" Tags="&lt;config&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2571" PostTypeId="2" ParentId="2567" CreationDate="2014-09-16T20:53:18.710" Score="3" Body="&lt;p&gt;I suggested an edit to Jamies suggestion (hope that's okay - don't know all the rules yet).&#xA;Here's the suggestion&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = (entry.artistFirstName) ? [entry.artistFirstName, ' ', entry.title]|join : entry.title %}&#xA;{{ title | capitalize }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here i'm joining the two variables if entry.artistFirstName exists, by first putting all the parts into an array, and then using the join filter to glue them together. I like this approach, because it's easy to add many parts without having to put ~ ' ' ~ for every space you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you want to glue strings like this together, you use the ~ operator, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'string1' ~ 'string2' ~ 'string3' }} -&amp;gt; {{ string1string2string3 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An alternative approach to the one I suggest above is therefore like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = (entry.artistFirstName) ? entry.artistFirstName ~ ' ' ~ entry.title : entry.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just as fine, but the first approach might be nicer if you have more parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third way is this, which might be just as nice/clean, but maybe slightly less readable?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = (entry.artistFirstName) ? '%s - %s'|format(entry.artistFirstName, entry.title) : entry.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-16T23:04:06.420" LastActivityDate="2014-09-16T23:04:06.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2572" PostTypeId="2" ParentId="2570" CreationDate="2014-09-16T21:13:37.937" Score="2" Body="&lt;p&gt;As of Craft 2.2, you should now be using the new siteUrl setting. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921&quot;&gt;See this reply&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your variable siteUrl from environmentVariables should still work, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you see if you add this to a test template?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&#xA;  {{ dump(craft.config.get('environmentVariables')) }}&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://buildwithcraft.com/help/site-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;How is the Site URL determined?&lt;/a&gt; from the docs as well.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-09-16T21:13:37.937" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2573" PostTypeId="2" ParentId="2565" CreationDate="2014-09-16T21:48:07.027" Score="3" Body="&lt;p&gt;Something like this (Let's call the fieldtype Geo):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your field html should output those two fields, and update a hidden input with the correct namespaced fieldname. Get it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$id = craft()-&amp;gt;templates-&amp;gt;formatInputId($name);&#xA;$namespaceInputId = craft()-&amp;gt;templates-&amp;gt;namespaceInputId($id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types#binding-javascript&quot; rel=&quot;nofollow&quot;&gt;See docs here about binding JS to fields.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your fieldtypes content should be defined as Mixed. Craft will encode/decode it to JSON when saving the model automatically.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return AttributeType::Mixed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your fieldtypes prepValueFromPost method, you do all the conversion magic for saving. Let's say your JS save the lat/lng values as a pipe separated value in the hidden input field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValueFromPost($value)&#xA;{&#xA;    if ( empty($value) )&#xA;    {&#xA;        return new Geo_GeoModel();&#xA;    }&#xA;&#xA;    $coordinates = explode('|', $value);&#xA;    $geo = new Geo_GeoModel($coordinates);&#xA;    return $geo;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also need to hook up the model with the defined attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Geo_GeoModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'lat' =&amp;gt; AttributeType::String,&#xA;            'lng' =&amp;gt; AttributeType::String,&#xA;        );&#xA;    }&#xA;&#xA;    public function render()&#xA;    {&#xA;        $render = craft()-&amp;gt;templates-&amp;gt;render('geo/templates/render', $this);&#xA;        return $render;&#xA;    }&#xA;&#xA;    public function __toString()&#xA;    {&#xA;        return $this-&amp;gt;render();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was actually going to make a plugin that does the same. Please share if you do :)&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-17T09:46:14.567" LastActivityDate="2014-09-17T09:46:14.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2574" PostTypeId="1" AcceptedAnswerId="2575" CreationDate="2014-09-16T22:24:45.900" Score="2" ViewCount="990" Body="&lt;p&gt;is it possible to create forms that save to the DB &amp;amp; a new screen in admin to see the submissions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a user created forms module (like gravity forms) for Craft?&lt;/p&gt;&#xA;" OwnerUserId="794" LastEditorUserId="250" LastEditDate="2014-10-04T18:38:02.093" LastActivityDate="2014-10-04T18:38:02.093" Title="Creating forms that save to the database &amp; can be viewed in the admin" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2575" PostTypeId="2" ParentId="2574" CreationDate="2014-09-16T23:12:34.933" Score="3" Body="&lt;p&gt;For now, you can create forms and create entries through the plugin &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Guest Entries, entries are disabled by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout also has a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;plugin for creating forms&lt;/a&gt;, that is currently in beta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything specific you are looking for, or would you just like to be able to receive submissions from site users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you give some more information, we might be able to give you some better advice, but the Forms Market is still pretty thin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you say those forms are always the same in the context of a site? You don't need a form builder for that (?), unless they are always changing and adding things. Even then, you can make a rudimentary form builder by using Matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notifications part has to be be added by a custom plugin. You can hook into the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry hook&lt;/a&gt;, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I built a notification plugin that does that, which sends of an e-mail and a sms to the site owner when entries are added through Guest Entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subscribing to MailChimp is also fairly easy. You can have a look at the &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow&quot;&gt;MailChimp Subscribe plugin&lt;/a&gt; as an example.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-17T09:56:24.063" LastActivityDate="2014-09-17T09:56:24.063" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2576" PostTypeId="1" AcceptedAnswerId="2578" CreationDate="2014-09-17T02:07:37.750" Score="9" ViewCount="4881" Body="&lt;p&gt;Trying to get my Craft site running on my server for the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the error &lt;code&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/dev.mysite.com/htdocs/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is nothing different to the folder structure on my server than I have locally. &#xA;i.e. the &lt;code&gt;$craftPath&lt;/code&gt; set in index.php is still &lt;code&gt;../craft&lt;/code&gt; which is correct... my Craft folder sits beside my public folder as per default installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I try to get this working? &lt;/p&gt;&#xA;" OwnerUserId="802" LastEditorUserId="57" LastEditDate="2014-09-17T02:41:36.503" LastActivityDate="2017-10-31T20:31:35.350" Title="Getting $craftPath error on server trying to get Craft running" Tags="&lt;install&gt;&lt;server&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2577" PostTypeId="1" CreationDate="2014-09-17T02:39:11.680" Score="1" ViewCount="682" Body="&lt;p&gt;I asked a similar question previously but it was a bit too vague (and slightly different) to what I actually need. I'm about to start building a site that requires a booking system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially the site owner is available 24/7 (with the exception of some dates and times that they would set as unavailable). So users need to be able to book a service for ANY time except the times the site owner has set as unavailable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to that, the visitors of the site will be booking specific services that have pre-set durations. For instance one service may be 2 hours, another might be 3 hours, etc. When someone books a service the time-slot should no longer be available for another individual to book. For instance if customer X books a service that is set to take up 3 hours on November 16th 2014 to start at 8:00 AM PST, then customer Y can not book any services between 8:00 AM - 11:00 AM PST on that day. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Payments should also be processed when they make a booking, i'd think i could use something like CHARGE for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question then is not only how would i go about building a system like this sans-plugin? I know it's a pretty complex question but i'd really appreciate a little help in the right direction as I'm having a bit of a hard time wrapping my head around how to accomplish this. Thanks a bunch in advance.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2014-09-17T14:35:10.277" Title="Booking &amp; Reservation System" Tags="&lt;entries&gt;&lt;booking&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2578" PostTypeId="2" ParentId="2576" CreationDate="2014-09-17T02:40:35.713" Score="8" Body="&lt;p&gt;9 times out of 10, if you're absolutely sure the path is correct, it's either a permissions issue (PHP doesn't have permissions to open the &lt;code&gt;craft&lt;/code&gt; folder) or your php.ini file has  &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.open-basedir&quot;&gt;open_basedir&lt;/a&gt; restrictions in place preventing PHP from accessing the folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-17T02:40:35.713" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2579" PostTypeId="2" ParentId="2570" CreationDate="2014-09-17T02:46:12.827" Score="3" Body="&lt;p&gt;Make sure that you change &lt;code&gt;.dev&lt;/code&gt;, &lt;code&gt;.com&lt;/code&gt;, etc. to reflect your actual environment URLs. They operate based on a partial string match, so as long as your URL contains one of those substrings, it'll pick up the first one it matches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'local.mywebsite' =&amp;gt; array(&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl ' =&amp;gt; 'http://local.mywebsite',&#xA;  )&#xA;),&#xA;&#xA;'mywebsite.com' =&amp;gt; array(&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl ' =&amp;gt; 'http://mywebsite.com',&#xA;  )&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whoa, I think I may have just realized what the problem is... I copied my example from your original code, and copied a glitch right along with it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've listed &lt;code&gt;siteUrl&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'siteUrl ' =&amp;gt; 'http://mywebsite.com'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice anything? There is &lt;em&gt;an extra space&lt;/em&gt; between &lt;code&gt;siteUrl&lt;/code&gt; and the closing quote.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'siteUrl '&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'siteUrl'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-09-17T04:24:22.113" LastActivityDate="2014-09-17T04:24:22.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2580" PostTypeId="2" ParentId="2574" CreationDate="2014-09-17T03:06:07.083" Score="1" Body="&lt;p&gt;Yes but you would need a to build a plugin to do so. The &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/&quot; rel=&quot;nofollow&quot;&gt;Pixel and Tonic Contact Form&lt;/a&gt; is a good place to start or you could build your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative you could create a &quot;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;saveEntry&lt;/a&gt;&quot; form which would save the content form submissions as entries or use the plugins like Fred suggested.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-09-17T03:06:07.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2581" PostTypeId="2" ParentId="2577" CreationDate="2014-09-17T03:11:53.827" Score="1" Body="&lt;p&gt;This would be really tricky without a plugin but you &lt;em&gt;could&lt;/em&gt; (and this is a stretch) manipulate the entry channel to accept &quot;reservations&quot; where as the reservations date and time use the date and time field types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then output all the reservation entries to show if/when times are still available. There's no getting around this though, you'd need to work extensively with the saveEntry form, jQuery and a date/time picker to get everything to line up correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to do would be to create a reservation plugin that does specifically this instead of wrangling entires to do the same thing. Either-way I'd say you're looking at some in-depth development time.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2014-09-17T14:35:10.277" LastActivityDate="2014-09-17T14:35:10.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2582" PostTypeId="1" AcceptedAnswerId="2596" CreationDate="2014-09-17T08:02:28.267" Score="2" ViewCount="452" Body="&lt;p&gt;I am trying to add a class which will cycle through on every iteration of a matrix block type, here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.asideNavigation %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'textBlock' %}&#xA;            &amp;lt;li class=&quot;aside__nav__item {{ cycle(['cs-a','cs-b'], loop.index0) }}&quot;&amp;gt;&#xA;                ...&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% case 'imageBlock' %}&#xA;            ...&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This cycle function gives me the error &quot;Variable &quot;loop&quot; does not exist&quot; where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="57" LastEditDate="2014-09-17T18:04:03.167" LastActivityDate="2016-11-05T03:25:38.023" Title="How do I cycle a class on a Matrix block?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2583" PostTypeId="1" CreationDate="2014-09-17T10:49:46.177" Score="1" ViewCount="136" Body="&lt;p&gt;I now have 5 Structures that belong together (they are all different parts of our restaurant menu) together with my other structures its all very confusing. So what I want is a way to split up my&lt;br&gt;&#xA;&lt;code&gt;----Structures----&lt;/code&gt;     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the entries area to have like:   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-----Singles------&#xA;  ..&#xA;-----Channels-----&#xA;  ..&#xA;----Structures----&#xA;  ..  &#xA;-----FoodMenu-----&#xA;  ..  &#xA;----Navigation----&#xA;  ..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve that ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="250" LastEditDate="2014-10-04T18:37:44.417" LastActivityDate="2014-10-04T18:37:44.417" Title="Is it possible to sort Sections?" Tags="&lt;best-practice&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2584" PostTypeId="2" ParentId="2583" CreationDate="2014-09-17T11:23:26.843" Score="1" Body="&lt;p&gt;I don't think there is at the moment, but you could probably build a easy plugin to do that with Javascript.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-17T11:23:26.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2585" PostTypeId="2" ParentId="2566" CreationDate="2014-09-17T12:00:34.960" Score="3" Body="&lt;p&gt;I've tested these three methods (the first one from AbbeyDesign's answer,) and they seem to work fine with variables, I can't see any obvious reason why they wouldn't:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = { artistFirstName: 'hello', title: 'world' } %}&#xA;&#xA;{% set title = (entry.artistFirstName|capitalize) ~ ' ' ~ (entry.title|capitalize) %}&#xA;{% set title = &quot;#{entry.artistFirstName|capitalize} #{entry.title|capitalize}&quot; %}&#xA;{% set title = [entry.artistFirstName|capitalize, entry.title|capitalize]|join(' ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in &quot;Hello World&quot; in each case.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-09-17T12:00:34.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2586" PostTypeId="1" AcceptedAnswerId="2587" CreationDate="2014-09-17T12:51:49.510" Score="1" ViewCount="710" Body="&lt;p&gt;I have a structure for different categories like salad, soup, main course and so on. Basically they share the same fields - but I want to be able to have dynamic singles based on those structures. For example I have a MainMenu-Single where I than can select entries from salads, soups, main courses and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is there a way to loop through all the fields in that single?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.entries.section('foodMenuCategories') %}&#xA;    {% if entry.{category} is defined %} &#xA;       ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sadly that doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="57" LastEditDate="2014-09-17T14:59:20.707" LastActivityDate="2014-09-17T14:59:20.707" Title="Loop through fields from 'single'" Tags="&lt;entries&gt;&lt;structure&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2587" PostTypeId="2" ParentId="2586" CreationDate="2014-09-17T13:28:51.823" Score="3" Body="&lt;p&gt;I think there's a few ways you can do this with twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to check whether the category slug exists as an attribute on the entry object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('foodMenuCategories') %}&#xA;    {% if category.slug in entry.getAttributes|keys %} &#xA;        ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or by using the category slug in an array accessor:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('foodMenuCategories') %}&#xA;    {% if entry[category.slug] is defined %}&#xA;       ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or whether the getAttribute() method on the entry model returns anything truthy for that handle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('foodMenuCategories') %}&#xA;    {% if entry.getAttribute(category.slug) %} &#xA;        ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's also important, that the slug is the same in every language!&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="733" LastEditDate="2014-09-17T14:14:14.213" LastActivityDate="2014-09-17T14:14:14.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2588" PostTypeId="1" AcceptedAnswerId="2590" CreationDate="2014-09-17T13:45:26.917" Score="4" ViewCount="1802" Body="&lt;p&gt;I have a form in one of my templates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;paypalPayments/payment/pay&quot;&amp;gt;&#xA;&#xA;     [...] &#xA; &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also created a simple plugin like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//PaypalPaymentsPlugin.php&#xA; &amp;lt;?php &#xA; namespace Craft;&#xA; class PaypalPaymentsPlugin extends BasePlugin {&#xA;&#xA;    function getName() {&#xA;       return Craft::t('Paypal Payments');&#xA;     }&#xA;&#xA;     function getVersion() {&#xA;       return '1.0';&#xA;     }&#xA;&#xA;     function getDeveloper() {&#xA;       return 'Paul Timoce';&#xA;     }&#xA;&#xA;     function getDeveloperUrl() {&#xA;       return &quot;http://paultimoce.net&quot;;&#xA;     }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also a controller file inside a controller folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; //File PaypalPayments_PaymentController.php&#xA; &amp;lt;?php &#xA;&#xA;   namespace Craft;&#xA;&#xA;   class PaypalPayments_PaymentController extends BaseController {&#xA;&#xA;     public function actionPayWithPaypal() &#xA;     {&#xA;        echo &quot;I'm in...&quot;;&#xA;     }&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All I want to do is post some variables through my form and process them with my plugin controller but every time I submit my form I hit the 404 page...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you guys have any idea as to why this is happening? I also installed and activated the sample cocktailRecipes plugin trying to do the same thing but unsuccessfully also... I tried to point my browser to /actions/paypalPayments/payment/pay and /actions/cocktailRecipes/ingredients/saveIngredient but also no luck... I always get redirected to the 404 page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help?&lt;/p&gt;&#xA;" OwnerUserId="803" LastActivityDate="2014-09-17T14:13:51.560" Title="Cannot post data to a plugin controller action" Tags="&lt;controller&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2590" PostTypeId="2" ParentId="2588" CreationDate="2014-09-17T14:13:51.560" Score="7" Body="&lt;p&gt;There's alot of different things that could be going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, if your action is named &lt;code&gt;actionPayWithPaypal&lt;/code&gt; (as in the code above) the action url should be &lt;code&gt;paypalPayments/payment/payWithPaypal&lt;/code&gt; I guess?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't be able to hit the cocktail recipes method directly from your browser since it requires the request to be a post. But you should be able to hit your controller with yourdomain.com/actions/paypalPayments/payment/payWithPaypal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, only if you're logged in. If you're not logged in, that will give you a 404 unless you enable anonymous access to the controller, see &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot;&gt;the documentation&lt;/a&gt; on how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is your .htaccess rewriting working as it should? If not, that could cause problems with calling the action directly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try generating an action url and see if that works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl('paypalPayments/payment/payWithPaypal') }}&quot;&amp;gt;Test me&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-17T14:13:51.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2591" PostTypeId="1" AcceptedAnswerId="2593" CreationDate="2014-09-17T15:34:41.843" Score="3" ViewCount="2796" Body="&lt;p&gt;I have looked at documentation and I still can't figure out how to output the matrix to my template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Field handle name is: &lt;strong&gt;threeHomepageImages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Block type handle name is: &lt;strong&gt;images&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fields names are: &lt;strong&gt;image&lt;/strong&gt;, &lt;strong&gt;alt&lt;/strong&gt;, and &lt;strong&gt;imageTitle&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following and tried a few combinations, but no luck. Any help is much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.threeHomepageImages.type('images') %}&#xA;    {{ image }} {{ alt }} {{ imageTitle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastActivityDate="2014-09-17T16:46:44.283" Title="Outputting Matrix Loop in Template" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2592" PostTypeId="2" ParentId="2591" CreationDate="2014-09-17T15:52:35.337" Score="5" Body="&lt;p&gt;You're almost there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every block returns a MatrixBlockModel, so you have to reference your block when getting the attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.threeHomepageImages.type('images') %}&#xA;    &amp;lt;h2&amp;gt;{{ block.imageTitle }}&amp;lt;/h2&amp;gt;&#xA;    {# Save images to variable for reuse #}&#xA;    {% set image = block.image %}&#xA;    {# Check if there is any images #}&#xA;    {% if image | length %}&#xA;        {# Get url #}&#xA;        {% set image = image.first().getUrl() %}&#xA;        &amp;lt;img src=&quot;{{ image }}&quot; alt=&quot;{{ block.alt }}&quot; /&amp;gt; &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-17T16:46:44.283" LastActivityDate="2014-09-17T16:46:44.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2593" PostTypeId="2" ParentId="2591" CreationDate="2014-09-17T15:52:56.740" Score="5" Body="&lt;p&gt;It looks like you're pretty close, but those field names need to be called as attributes on &lt;code&gt;block&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.threeHomepageImages.type('images') %}&#xA;    {% if block.image|length %}&#xA;        {{ block.image.first }}&#xA;    {% endif %}&#xA;    {{ block.alt }} {{ block.imageTitle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming your &lt;code&gt;image&lt;/code&gt; field is an &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#examples&quot; rel=&quot;noreferrer&quot;&gt;Assets Field&lt;/a&gt; here, so you need to first check that any exist, then select the first one.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-09-17T15:52:56.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2594" PostTypeId="1" AcceptedAnswerId="2601" CreationDate="2014-09-17T17:16:05.420" Score="3" ViewCount="879" Body="&lt;p&gt;A two part question here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When saving an entry from front-end entry form, can I designate it to save as a draft? If so, how?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the answer to #1 is true, can I query against that to list only entries that are not in 'draft' mode.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="603" LastEditorUserId="57" LastEditDate="2015-03-08T18:05:05.550" LastActivityDate="2015-03-08T18:05:05.550" Title="Creating Drafts from Frontend Entry Form" Tags="&lt;entry&gt;&lt;draft&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2595" PostTypeId="1" AcceptedAnswerId="2597" CreationDate="2014-09-17T17:22:29.217" Score="2" ViewCount="878" Body="&lt;p&gt;Trying to create a page link to entries and can't figure out how to do it.  Here's what I have.  It's just outputting the title, but not the url.  Specifically, I'm talking about &lt;code&gt;{{ block.pageLink.first }}&lt;/code&gt; Any help is much appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.threeHomepageImages.type('images') %}&#xA;    &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;image-block&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                {% if block.image|length %}&#xA;                    &amp;lt;a href=&quot;{{ block.pageLink.first }}&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;images/{{ block.image.first }}.jpg&quot; alt=&quot;{{ block.alt }}&quot;&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ block.imageTitle }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastEditorUserId="57" LastEditDate="2014-09-17T17:59:09.620" LastActivityDate="2014-09-17T18:47:04.903" Title="Matrix Entry URL Link" Tags="&lt;matrix&gt;&lt;url&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2596" PostTypeId="2" ParentId="2582" CreationDate="2014-09-17T18:18:52.607" Score="3" Body="&lt;p&gt;This is mostly likely a scoping issue inside the &lt;code&gt;switch&lt;/code&gt; statement.  Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.asideNavigation %}&#xA;&#xA;    {% set index0 = loop.index0 %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'textBlock' %}&#xA;            &amp;lt;li class=&quot;aside__nav__item {{ cycle(['cs-a','cs-b'], index0) }}&quot;&amp;gt;&#xA;                ...&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% case 'imageBlock' %}&#xA;            ...&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-17T18:18:52.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2597" PostTypeId="2" ParentId="2595" CreationDate="2014-09-17T18:47:04.903" Score="4" Body="&lt;p&gt;If &lt;code&gt;pageLink&lt;/code&gt; is an Entry field and &lt;code&gt;image&lt;/code&gt; is an Assets field, then you're probably looking for something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ block.pageLink.first().getUrl() }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ block.image.first().getUrl() }}&quot; alt=&quot;{{ block.alt }}&quot;&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-17T18:47:04.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2598" PostTypeId="1" AcceptedAnswerId="2600" CreationDate="2014-09-17T19:37:13.197" Score="9" ViewCount="3298" Body="&lt;p&gt;Craft seems to be setting headers to tell the browser not to cache anything it serves, which seems bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why it do dat?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2021-03-08T09:14:38.900" Title="Why does Craft set no-cache headers for all requests?" Tags="&lt;cache&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2599" PostTypeId="1" CreationDate="2014-09-17T20:54:15.843" Score="2" ViewCount="1926" Body="&lt;p&gt;Want to do two things and wondering if I'm missing something in the docs or if someone has tackled this already: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User registers on the front end and get success messages saying they will be notified when approved.&lt;/li&gt;&#xA;&lt;li&gt;Admin is notified that they just did that.&lt;/li&gt;&#xA;&lt;li&gt;Admin activates them&lt;/li&gt;&#xA;&lt;li&gt;They get email saying they are good to go. (optional I guess)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="447" LastActivityDate="2016-04-14T09:58:50.940" Title="User registration approval/activation" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2600" PostTypeId="2" ParentId="2598" CreationDate="2014-09-17T21:09:24.087" Score="10" Body="&lt;p&gt;Craft doesn't explicitly set &lt;em&gt;any&lt;/em&gt; caching headers in the response, but you can control exactly how you want your caching headers to behave from your templates with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/header&quot; rel=&quot;noreferrer&quot;&gt;{% header %}&lt;/a&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Tell the browser to cache this page for 30 days #}&#xA;{% set expiry = now|date_modify('+30 days') %}&#xA;&#xA;{% header &quot;Cache-Control: max-age=&quot; ~ expiry.timestamp %}&#xA;{% header &quot;Pragma: cache&quot; %}&#xA;{% header &quot;Expires: &quot; ~ expiry|date('D, d M Y H:i:s', 'GMT') ~ &quot; GMT&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default PHP has the &lt;a href=&quot;http://php.net/manual/en/function.session-cache-limiter.php&quot; rel=&quot;noreferrer&quot;&gt;session_cache_limiter()&lt;/a&gt; method set to &lt;code&gt;nocache&lt;/code&gt;, which is probably what you're seeing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-18T02:04:51.450" LastActivityDate="2014-09-18T02:04:51.450" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="2601" PostTypeId="2" ParentId="2594" CreationDate="2014-09-17T21:43:56.600" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes. Kind of. Have you had a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry Form example&lt;/a&gt; in the docs? It looks like Craft will always need an entry to begin with, so you can't have a draft version without first creating a normal entry. That being said, you can set this new this entry as disabled, which also can be queried against by using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft.entries.status('disabled')&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I cannot see a documented example on how to list drafted entries, though.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Either way, to build on the Entry Form example, instead of having the action set to &lt;strong&gt;entries/saveEntry&lt;/strong&gt;, change it to &lt;strong&gt;entryRevisions/saveDraft&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entryRevisions/saveDraft&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;draft?id={id}&amp;amp;draft={draftId}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;1&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you're now posting to the EntryRevisionsController@saveDraft, and that I here set entries to be disabled by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does having them disabled help you do what you want, or do they have to be in Draft mode for some reason?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-17T21:43:56.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2602" PostTypeId="2" ParentId="2599" CreationDate="2014-09-17T21:56:30.000" Score="3" Body="&lt;p&gt;There is no current way that I know of that does this, but you can probably do it relatively easy with a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If e-mail validation is turned off in the Users settings, the created user is verified by default. You can hook into the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow&quot;&gt;users.onBeforeSaveUser event&lt;/a&gt; and set the status as &lt;strong&gt;UserStatus::Pending&lt;/strong&gt;. Then redirect them to a screen saving something like &quot;Blah blah you will be notified once we activate you blah blah&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hook into the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow&quot;&gt;users.onSaveUser event&lt;/a&gt;, check if this is a new user (isNewUser) and send off an e-mail to a given e-mail.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Admin logins and activate as normal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Optional) In the same users.onSaveUser event, if this isn't a new user and the user status is UserStatus::Active, send out an e-mail to the address given by the user.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-17T21:56:30.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2603" PostTypeId="1" AcceptedAnswerId="2604" CreationDate="2014-09-18T00:09:09.707" Score="1" ViewCount="410" Body="&lt;p&gt;I have a single page selected as home page by ticking &quot;This is for homepage&quot; but now I find link comes up as &lt;pre&gt;&lt;code&gt; &lt;a href=&quot;http://example.com/index.php/____home____&quot; rel=&quot;nofollow&quot;&gt;http://example.com/index.php/&lt;strong&gt;__home__&lt;/strong&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the home link to only be &lt;pre&gt;&lt;code&gt; &lt;a href=&quot;http://example.com/index.php/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/index.php/&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt; What do I need to do to get rid of &lt;strong&gt;__home__&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-09-18T00:18:40.657" Title="Removing _home_ from Home Page link" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2604" PostTypeId="2" ParentId="2603" CreationDate="2014-09-18T00:18:40.657" Score="3" Body="&lt;p&gt;&lt;code&gt;__home__&lt;/code&gt; is the pretend URI that Craft uses to identify an element that should be treated as the homepage. The only way you would be able to output it is if you were doing something like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl ~ entry.uri }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should be doing this instead, though, which will remove it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or,&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.getUrl() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-18T00:18:40.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2605" PostTypeId="1" AcceptedAnswerId="2608" CreationDate="2014-09-18T05:37:08.520" Score="2" ViewCount="616" Body="&lt;p&gt;How to auto-generate URLs in Craft? For example when we upload images on Tumblr, an URL to the post is created:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twotimeselliott.tumblr.com/post/95032257420&quot; rel=&quot;nofollow&quot;&gt;http://twotimeselliott.tumblr.com/post/95032257420&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And an URL for the image is created:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://31.media.tumblr.com/2142197f5273865770be44723c2a5df0/tumblr_nagyr9INCE1r6ky2bo1_500.jpg&quot; rel=&quot;nofollow&quot;&gt;http://31.media.tumblr.com/2142197f5273865770be44723c2a5df0/tumblr_nagyr9INCE1r6ky2bo1_500.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we do that in Craft?&lt;/p&gt;&#xA;" OwnerUserId="687" LastActivityDate="2014-09-18T13:45:13.330" Title="How to auto-generate URLs in Craft?" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2606" PostTypeId="2" ParentId="2605" CreationDate="2014-09-18T08:27:47.067" Score="0" Body="&lt;p&gt;Entries have the &lt;strong&gt;url&lt;/strong&gt; attribute, which you can access like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;See example in the docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you upload an image through Assets, you can get the url for the image by doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.imageHandle.first().getUrl() }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the getUrl takes an optional transform name, if you have added any &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;transforms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See more in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;docs on craft.assets tag&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-18T08:27:47.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2607" PostTypeId="1" AcceptedAnswerId="2609" CreationDate="2014-09-18T08:55:15.590" Score="2" ViewCount="830" Body="&lt;p&gt;I'm building a profile page for members on a site where members can change their password. I'm sending the request with ajax, and can successfully change password if I have the input name &quot;password&quot; correct with the users current password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I get a success-response, when I should have gotten an error-response. (Password isn't changed, but I have no way of telling the user there was en error).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My JS is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    type: &quot;POST&quot;,&#xA;    url: &quot;&quot;,&#xA;    data: dataString,&#xA;    success: function(data) {&#xA;        console.log(&quot;Password successfully changed&quot;);&#xA;    },&#xA;    error: function(data) {&#xA;        console.log(&quot;Error. Password did not change&quot;);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="94" LastActivityDate="2014-09-18T14:10:41.640" Title="Change user password on the front end" Tags="&lt;ajax&gt;&lt;user-profile&gt;&lt;password&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2608" PostTypeId="2" ParentId="2605" CreationDate="2014-09-18T13:45:13.330" Score="3" Body="&lt;p&gt;I’m not sure if those Tumblr URLs are just an incrementing ID (so each new post is +1 greater than the last one), or if it’s a randomly-generated string of numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want yours to be the entry ID, all you’d have to do is go into your section’s settings, and set the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do entries in this section have their own URLs?&lt;/strong&gt; [check]&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Entry URL Format:&lt;/strong&gt; &lt;code&gt;post/{id}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you want it to be random, that’s a little more difficult. You would need to create a custom text field that stores the random number, attach it to your section, and start entering random numbers into it when creating new entries (or you could write a custom &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;field type&lt;/a&gt; that handles this for you). Then your &lt;strong&gt;Entry URL Format&lt;/strong&gt; would get set to &lt;code&gt;post/{customFieldHandle}&lt;/code&gt; instead of &lt;code&gt;post/{id}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the image URL, if you have an Assets field that’s responsible for storing the entry’s main image, you can set it to restrict uploads to a single directory, and give it a subfolder based on the entry’s ID/random number custom field handle. (See &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#restricting-uploads-to-a-single-folder&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/assets-fields#restricting-uploads-to-a-single-folder&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-18T13:45:13.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2609" PostTypeId="2" ParentId="2607" CreationDate="2014-09-18T14:10:41.640" Score="3" Body="&lt;p&gt;Currently the users/saveUser (and the deprecated users/setPassword) controller action doesn’t support Ajax requests, so there won’t really be an easy way to tell if it worked or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to update user passwords over Ajax, your best bet will be to write a plugin with its own custom controller action, which mimics the password-related stuff in &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersController::actionSaveUser()&lt;/a&gt;, but probably calls &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#changePassword-detail&quot; rel=&quot;nofollow&quot;&gt;UsersService::changePassword()&lt;/a&gt; rather than &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;saveUser()&lt;/a&gt; since you only care about updating the password. And have that controller respond with JSON if it’s an Ajax request, rather than assuming it’s not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/EntriesController#actionSaveEntry-detail&quot; rel=&quot;nofollow&quot;&gt;EntriesController::actionSaveEntry()&lt;/a&gt; for an example of a controller action that &lt;em&gt;does&lt;/em&gt; support Ajax.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-18T14:10:41.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2610" PostTypeId="1" AcceptedAnswerId="2611" CreationDate="2014-09-18T16:11:28.400" Score="10" ViewCount="692" Body="&lt;p&gt;I have a listing page of entries, some of which may have future-dated postDates. I want to cache the output, but only until one of the pending entries goes live.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-05-02T08:26:39.390" Title="How can I cache a list of entries with pending postDates and have it automatically invalidate the cache appropriately?" Tags="&lt;postdate&gt;&lt;pending&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2611" PostTypeId="2" ParentId="2610" CreationDate="2014-09-18T16:11:28.400" Score="18" Body="&lt;p&gt;Easy! Get the most soonest upcoming pending entry, and use &lt;code&gt;until&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstPending = craft.entries({&#xA;  section: 'articles',&#xA;  status: 'pending',&#xA;  order: 'postDate asc'&#xA;}).first %}&#xA;{% set cacheUntil = firstPending ? firstPending.postDate : now|date_modify('+1 year') %}&#xA;&#xA;{% set content %}&#xA;    {% cache until cacheUntil %}&#xA;        ...&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this solution requires &lt;a href=&quot;http://buildwithcraft.com/updates#build2598&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.2.2598&lt;/a&gt; or later.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="3898" LastEditDate="2016-05-02T08:26:39.390" LastActivityDate="2016-05-02T08:26:39.390" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2612" PostTypeId="1" AcceptedAnswerId="2613" CreationDate="2014-09-18T18:20:15.380" Score="1" ViewCount="245" Body="&lt;p&gt;Trying to output a matrix field image so that it crops the thumbnail. However, I can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.servicesItems.type('images') %}&#xA;    &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;&#xA;        {% if block.image|length %}&#xA;&#xA;            {% set thumb = {&#xA;                mode: 'crop',&#xA;                width: 229,&#xA;                height: 172,&#xA;                quality: 75,&#xA;                position: 'center-center'&#xA;            } %}&#xA;&#xA;            &amp;lt;a href=&quot;images/{{ block.image.first }}.jpg&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;images/{{ block.image.first('thumb') }}.jpg&quot; alt=&quot;{{ block.alt }}&quot; width=&quot;{{ block.image.first.getWidth(thumb) }}&quot; height=&quot;{{ block.image.first.getHeight(thumb) }}&quot;&amp;gt;&#xA;&#xA;                &amp;lt;div id=&quot;lightbox-title&quot;&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ block.imageTitle }}&amp;lt;/h2&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ block.imageContent }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastEditorUserId="250" LastEditDate="2014-10-05T15:57:13.610" LastActivityDate="2014-10-05T15:57:13.610" Title="How can you crop an image and output from a Matrix field?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2613" PostTypeId="2" ParentId="2612" CreationDate="2014-09-18T18:33:15.730" Score="2" Body="&lt;p&gt;When you call &lt;code&gt;.first&lt;/code&gt; on an Asset field, that's going to return an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/AssetFileModel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change the relevant part of your code to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# grab the first image #}&#xA;{% set image = block.image.first() %}&#xA;&#xA;{# link to the full sized version #}&#xA;&amp;lt;a href=&quot;{{ image.getUrl('thumb') }}&quot;&amp;gt;&#xA;&#xA;    {# generated the transformed thumbnail version #}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl('thumb')}}&quot; alt=&quot;{{ block.alt }}&quot; width=&quot;{{ image.getWidth('thumb') }}&quot; height=&quot;{{ image.getHeight('thumb') }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;lightbox-title&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ block.imageTitle }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ block.imageContent }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-18T18:33:15.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2614" PostTypeId="1" AcceptedAnswerId="2618" CreationDate="2014-09-18T21:00:46.223" Score="3" ViewCount="7174" Body="&lt;p&gt;I'm having a problem getting my asset URLs to print properly in templates. The site is using a multi-environment configuration (dev/stage/live) with localized content (en/es/da) and shared assets. Here are the config and settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('SITE_URL', URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;define('BASEPATH', realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        // common config settings&#xA;    ),&#xA;    'site.craft.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'http://site.craft.dev:8888/',&#xA;            'es' =&amp;gt; 'http://site.craft.dev:8888/es/',&#xA;            'da' =&amp;gt; 'http://site.craft.dev:8888/da/',&#xA;        ),&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl'  =&amp;gt; 'http://site.craft.dev:8888/',&#xA;            'basePath' =&amp;gt; BASEPATH . 'http/',&#xA;        ),&#xA;    ),&#xA;    'stage.site.com'  =&amp;gt; array(&#xA;        // etc&#xA;    ),&#xA;    'site.com'  =&amp;gt; array(&#xA;        // etc&#xA;    ), &#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the CP:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an 'Images' asset source defined with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;File System Path: {basePath}assets/img/&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;URL: /assets/img/&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have a 'printImage' asset field defined with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Upload Location: Images (selected in dropdown); prints (in field)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Uploading images through the CP works great, and images go to the correct folder, and are viewable in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template (and here is the problem), when I request the image url using {{ printImage.url }} it outputs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://site.craft.dev:8888/prints/imagename.jpg&quot; rel=&quot;nofollow&quot;&gt;http://site.craft.dev:8888/prints/imagename.jpg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;when it should be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://site.craft.dev:8888/assets/img/prints/imagename.jpg&quot; rel=&quot;nofollow&quot;&gt;http://site.craft.dev:8888/assets/img/prints/imagename.jpg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, when I switch to another language it outputs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://site.craft.dev:8888/es/prints/imagename.jpg&quot; rel=&quot;nofollow&quot;&gt;http://site.craft.dev:8888/es/prints/imagename.jpg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It seems to be missing the portion of the path defined in Settings:Assets:Sources:'Images', and also is including the localization prefix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other paths and URLs in the site are working perfectly. Anyone have any ideas where I'm going wrong with assets? I guess I don't understand how it's crafting the asset URLs. Should I be defining an 'assetsPath' in my environment variables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2021-03-03T13:03:13.260" Title="How do I properly set assets paths?" Tags="&lt;assets&gt;&lt;url&gt;&lt;config&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2615" PostTypeId="1" AcceptedAnswerId="2616" CreationDate="2014-09-18T21:32:39.563" Score="1" ViewCount="197" Body="&lt;p&gt;Cross-posting from &lt;a href=&quot;https://github.com/themccallister/craft.cache-clear/issues/2&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, as I'm not sure if this is a Craft issue or specific to the &lt;code&gt;cache-clear&lt;/code&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intermittently (twice in a day now), I've seen templates being cached with Craft URLs outputting as either &lt;code&gt;/index.php/my-page/&lt;/code&gt; or &lt;code&gt;/index.php?p=my-page&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once this happens, clearing cache via the plugin url (&lt;a href=&quot;http://domain.com/actions/cacheClear/clear?key=myKey&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/actions/cacheClear/clear?key=myKey&lt;/a&gt;) doesn't seem to fix anything, but clearing cache in the control panel does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="57" LastEditDate="2014-09-18T21:52:44.163" LastActivityDate="2014-09-18T21:52:44.163" Title="Craft URLs intermittently being cached as /index.php/my-page/ or /index.php?p=my-page" Tags="&lt;url&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2616" PostTypeId="2" ParentId="2615" CreationDate="2014-09-18T21:46:22.660" Score="2" Body="&lt;p&gt;There is an explanation of why this can occur on the Craft help section here: &lt;a href=&quot;http://buildwithcraft.com/help/why-index.php&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/why-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-18T21:46:22.660" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2617" PostTypeId="2" ParentId="117" CreationDate="2014-09-18T22:06:50.333" Score="0" Body="&lt;p&gt;You have probably figured this out by now. But I go into my images folder and remove the sub-directories that Craft sets up for each transform. For example if you have a transform set up as thumbnail140 you should see a directory by the same name. Remove that directory and its contents to force a re-transformation.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-18T22:06:50.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2618" PostTypeId="2" ParentId="2614" CreationDate="2014-09-19T00:02:21.470" Score="3" Body="&lt;p&gt;Everything is set up properly after all. I just wasn't referencing the actual image, but rather its parent record. Correct syntax in this context should have been:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{{ print.printImage.first().getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Feel free to delete this post, or leave it for the config details.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="11044" LastEditDate="2021-03-03T13:03:13.260" LastActivityDate="2021-03-03T13:03:13.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2619" PostTypeId="1" AcceptedAnswerId="2620" CreationDate="2014-09-19T00:34:17.487" Score="2" ViewCount="357" Body="&lt;p&gt;Is it possible to configure &quot;Save &amp;amp; Continue Editing&quot; as default mode? &#xA;I know there is option to select it when adding entry but I want to configure so that always is the case for one of the channel.&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-09-19T13:12:39.193" Title="Save Continue Editing" Tags="&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2620" PostTypeId="2" ParentId="2619" CreationDate="2014-09-19T00:43:05.920" Score="3" Body="&lt;p&gt;It's currently not a configuration option, but there is a Control-S (Windows) / Command-S (OSX) shortcut that should work on every page in the Control Panel that basically says &quot;save and stay on the same page&quot;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-19T00:43:05.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2621" PostTypeId="1" AcceptedAnswerId="2624" CreationDate="2014-09-19T01:48:54.467" Score="2" ViewCount="2673" Body="&lt;p&gt;I need to sort my categories based on the date of entries returned within the category. I am trying to sort sermons from a church by the series they were contained within. I have the sermons grouped by their series and outputting correctly on that front but they display in order based on the category creation date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the sermon series to show in chronological descending order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have Sermon Series A, Sermon Series B, Sermon Series C... within each one of those categories we have individual sermons related to the category. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Sermon Series B&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (1/10/2013)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (1/17/2013)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sermon Series C&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (9/10/2014)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (9/17/2014)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sermon Series A&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (5/10/2014)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (5/17/2014)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently my output looks very similar to the above example but what I need is for it to show like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sermon Series C&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (9/10/2014)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (9/17/2014)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sermon Series A&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (5/10/2014)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (5/17/2014)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sermon Series B&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sermon 1 (1/10/2013)&lt;/li&gt;&#xA;&lt;li&gt;Sermon 2 (1/17/2013)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since the entries contained within the categories are in that order by post date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sermon').limit(null) %}&#xA;&#xA;{% for category in craft.categories.group('sermonSeries').relatedTo(entries).order('dateCreated desc') %}&#xA;&#xA;  {% for entry in entries.relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as I stated above this doesn't output my content with the desired effect.&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2015-01-24T00:28:53.787" Title="Sorting categories by the post date of the entries related to them" Tags="&lt;categories&gt;&lt;datetime&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2622" PostTypeId="1" AcceptedAnswerId="2623" CreationDate="2014-09-19T02:54:35.317" Score="1" ViewCount="247" Body="&lt;p&gt;Anyone using the &quot;Store Hours&quot; plugin know how to print out day open and close hours details?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this but not outputting anything.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for openTime in entry.openTimes %}&#xA;    {{openTime.day.open}}&amp;lt;br&amp;gt;&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: openTimes is a field of StoreHours type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="6007" LastEditDate="2019-08-16T20:31:21.263" LastActivityDate="2019-08-16T20:31:21.263" Title="Store Hours Plugin - Output Details" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2623" PostTypeId="2" ParentId="2622" CreationDate="2014-09-19T05:03:21.107" Score="5" Body="&lt;p&gt;The &lt;code&gt;openTime&lt;/code&gt; data is being stored as a numerically-indexed array. You may even want to create a mapping of those days to make rendering each day easier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set days = {&#xA;    0: 'Sunday',&#xA;    1: 'Monday',&#xA;    2: 'Tuesday',&#xA;    3: 'Wednesday',&#xA;    4: 'Thursday',&#xA;    5: 'Friday',&#xA;    6: 'Saturday'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can adjust your &lt;code&gt;for&lt;/code&gt; loop like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for dayIndex,openTime in entry.openTimes %}&#xA;&#xA;    {% set day = days[dayIndex] %}&#xA;    {% set hours = openTime.open|date('g:i a') ~ ' - ' ~ openTime.close|date('g:i a') %}&#xA;&#xA;    {{ day }}: {{ hours }}&amp;lt;br/&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;noreferrer&quot;&gt;dev mode&lt;/a&gt; enabled, you can use &lt;code&gt;dump&lt;/code&gt; to see what a variable contains.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(anyVariable) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's how I figured out the underlying structure of the &lt;code&gt;openTime&lt;/code&gt; data.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-19T05:03:21.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2624" PostTypeId="2" ParentId="2621" CreationDate="2014-09-19T07:59:29.793" Score="5" Body="&lt;p&gt;Alan,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without having tested this, you might get the desired result by using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;group&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, get all you entries ordered by dateCreated, and then group them by category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sermons = craft.entries.section('sermon').order('dateCreated desc').limit(null) %}&#xA;{% for category, catSermons in sermons | group('categoryFieldHandle.first().title') %}&#xA;    &amp;lt;li&amp;gt;{{ category }}&#xA;        {% for sermon in catSermons %}&#xA;            &amp;lt;li&amp;gt;{{ sermon.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if that works!&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-09-25T17:40:20.820" LastActivityDate="2014-09-25T17:40:20.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2625" PostTypeId="2" ParentId="2619" CreationDate="2014-09-19T08:05:23.080" Score="3" Body="&lt;p&gt;If you install my &lt;a href=&quot;https://github.com/aelvan/Guano-Craft&quot; rel=&quot;nofollow&quot;&gt;Guano plugin&lt;/a&gt;, it adds an additional &quot;Save &amp;amp; Continue Editing&quot; button above the default buttons. Also, if you have several tabs, it will return to the active one when saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also adds some other GUI changes, like making the sidebar &quot;float&quot;, so that you have access to the save buttons even if you scroll down the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope things like this makes it way into Craft somewhere down the road.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-09-19T13:12:39.193" LastActivityDate="2014-09-19T13:12:39.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2626" PostTypeId="1" CreationDate="2014-09-19T11:21:09.663" Score="1" ViewCount="511" Body="&lt;p&gt;Is there any way to add memcache servers to use per environment? I mean, one server for dev, one for staging and one for production.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-09-19T14:58:20.910" Title="Configure Memcache per environment" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2628" PostTypeId="2" ParentId="2626" CreationDate="2014-09-19T14:58:20.910" Score="2" Body="&lt;p&gt;Your &lt;code&gt;craft/config/memcache.php&lt;/code&gt; config file has the same &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment config&lt;/a&gt; support as any other of Craft's config files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see all the default memcache config options Craft ships with in &lt;code&gt;craft/config/etc/config/defaults/memcache.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-19T14:58:20.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2629" PostTypeId="1" AcceptedAnswerId="14692" CreationDate="2014-09-19T14:59:20.553" Score="5" ViewCount="584" Body="&lt;p&gt;I'm trying to retrieve custom fields value after submitting a form. Trying to access the custom fields through the message element after the form is submitted always throws an error  that the custom fields variable does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example that works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;fromName&quot;&amp;gt;Name:*&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example that doesn't work (custom fields):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;fromCompany&quot;&amp;gt;Company:&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;fromCompany&quot; type=&quot;text&quot; name=&quot;message[fromCompany]&quot; value=&quot;{% if message is defined %}{{ message.fromCompany }}{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to retrieve custom field values after submitting the form?&lt;/p&gt;&#xA;" OwnerUserId="788" LastActivityDate="2016-04-18T12:30:00.200" Title="P/T ContactForm Retrieving Custom fields Value after submitting form" Tags="&lt;form&gt;&lt;plugin-contactform&gt;&lt;custom&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2630" PostTypeId="1" AcceptedAnswerId="2644" CreationDate="2014-09-19T15:23:07.153" Score="1" ViewCount="774" Body="&lt;p&gt;I have the following buttons on my frontend entry from (user editing one of their entries). The idea is to turn the lightswitch &quot;on&quot; (green) when entry is being marked as draft and &quot;off&quot; when submitted for review. The turning it &quot;on&quot; part seems to work. I just cannot seem to control its &quot;off&quot; state.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;        &amp;lt;button class=&quot;btn btn-primary btn-lg btn-block &quot; style=&quot;margin:10px 15px 0 0;&quot; type=&quot;submit&quot;  name=&quot;fields[gistDraft]&quot; value=&quot;true&quot;&amp;gt;Save as Draft&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;  &#xA;   &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;          &amp;lt;button class=&quot;btn btn-success  btn-lg btn-block &quot; style=&quot;margin:10px 15px 0 0;&quot; type=&quot;submit&quot;    name=&quot;fields[gistDraft]&quot; value=&quot;false&quot;&amp;gt;Save &amp;amp;amp; Submit for Review&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;    &amp;lt;/div&amp;gt;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-21T14:27:24.573" Title="Populate Lightswitch field from Frontend Entry Form" Tags="&lt;form&gt;&lt;entry&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2631" PostTypeId="1" CreationDate="2014-09-19T16:12:21.563" Score="2" ViewCount="859" Body="&lt;p&gt;I have a bunch of images that aren't related to any entries but are in an asset source. Let's call this 'My Images'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I just grab those assets? I can't find anything in the docs that suggests this is possible—it seems such an obvious use-case though I'm sure I am missing something.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2017-12-05T03:44:38.820" Title="Get assets from an asset source" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2632" PostTypeId="2" ParentId="2631" CreationDate="2014-09-19T16:40:18.153" Score="4" Body="&lt;p&gt;What you want is &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;craft.assets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can access your site’s assets from your templates via craft.assets. It returns an ElementCriteriaModel object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;sourceId&lt;/code&gt; for the parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the sourceId, look at the &lt;code&gt;craft_assetsources&lt;/code&gt; table in the database. There doesn't seem to be any way to query for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetsourcemodel&quot; rel=&quot;nofollow&quot;&gt;AssetSourceModel&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-09-21T17:21:11.600" LastActivityDate="2014-09-21T17:21:11.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2634" PostTypeId="1" CreationDate="2014-09-19T17:47:19.027" Score="1" ViewCount="459" Body="&lt;p&gt;I'm trying to add some embed code/script and the rich text field on save puts misc &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags around my code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I save code so it keeps it's code formatting without adding an extra stuff?&lt;/p&gt;&#xA;" OwnerUserId="806" LastEditorUserId="57" LastEditDate="2014-09-19T20:10:05.383" LastActivityDate="2014-09-19T20:12:16.373" Title="Rich Text Field Adding Tags around script" Tags="&lt;field&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2635" PostTypeId="2" ParentId="2634" CreationDate="2014-09-19T20:12:16.373" Score="1" Body="&lt;p&gt;You probably need to set the Redactor &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/#set-allowedTags&quot; rel=&quot;nofollow&quot;&gt;allowedTags&lt;/a&gt; config setting to allow &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how to define custom Redactor configs in Craft &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-19T20:12:16.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2636" PostTypeId="1" CreationDate="2014-09-19T21:23:37.173" Score="1" ViewCount="352" Body="&lt;p&gt;I need some help with coding the navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;services&amp;lt;/a&amp;gt;&#xA;        &amp;lt;div class=&quot;drop&quot;&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;signs&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;printed decals&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;vehicle &amp;amp;amp; fleet graphics&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;banners &amp;amp;amp; posters&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;magnetics&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;vinyl graphics&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;construction and job site signs&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;business cards &amp;amp;amp; flyers&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;sign hardware&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;testimonials&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;get quote&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's a sample of my entries, channels and structures: &lt;a href=&quot;http://grab.by/Awx8&quot; rel=&quot;nofollow&quot;&gt;http://grab.by/Awx8&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far, but it's not really working at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get menu items #}&#xA;{# {% set pageItems = craft.entries.section('services').level('&amp;lt;= 2') %} #}&#xA;&#xA;{% set pageItems = craft.entries.level('&amp;lt;= 2') %}&#xA;&#xA;{# Output the sub menu #}&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;    {% nav page in pageItems %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;                {% if page.navigationTitle %}&#xA;                    {{ page.navigationTitle|nl2br }}&#xA;                {% else %}&#xA;                    {{ page.title }}&#xA;                {% endif %}&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;            {% ifchildren %}&#xA;                &amp;lt;div class=&quot;drop&quot;&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;testimonials&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;get quote&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="806" LastEditorUserId="57" LastEditDate="2014-09-19T21:49:07.380" LastActivityDate="2014-09-20T01:23:39.903" Title="Outputting Navigation" Tags="&lt;entries&gt;&lt;structure&gt;&lt;navigation&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2637" PostTypeId="2" ParentId="2636" CreationDate="2014-09-20T01:23:39.903" Score="1" Body="&lt;p&gt;My Solution uses:&lt;br&gt;&#xA;1. LJ Dynamic Fields Plugin&lt;br&gt;&#xA;2. 1 Structure I called SiteMenu&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did is:&lt;br&gt;&lt;br&gt;&#xA;1. Install LJ Dynamic Fields&lt;br&gt;&#xA;2. Setup a MenuLinkPage Field of fieldType Dynamic DropDown&#xA;    - In the Drop Down Options is like this because am pulling links from entries and category &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;{% set menuIds = craft.entries.section('siteMenu').ids()%}&#xA;{% set menuIdsString = menuIds | join(', not ') %}&#xA;&#xA;{ &quot;value&quot;:&quot;#&quot;,&quot;label&quot;:&quot;Select Page&quot;},&#xA;{%for category in craft.categories.limit(null) %}&#xA;      { &quot;value&quot;:&quot;{{category.id}}&quot; , &quot;label&quot;:&quot;category-{{category.group}}--{{category.title}}&quot;},&#xA;{%endfor%}&#xA;{%for entry in craft.entries.limit(null).id('and, not '~menuIdsString).order('type ASC')%}&#xA;      { &quot;value&quot;:&quot;{{ entry.id }}&quot; , &quot;label&quot;:&quot;{{entry.type}} - {{ entry | raw }}&quot;  &#xA;      }&#xA;      {% if not loop.last %},{% endif %}&#xA;{%endfor%}&#xA;    &lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Setup a SiteMenu Structure on its layout I added MenuLink Field.&lt;/li&gt;&#xA;&lt;li&gt;Then added Pages I need for my Menu by selecting from MenuLinkPage field.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Call the menu in my _layout template like this&#xA;&lt;pre&gt;&lt;code&gt;&#xA;{% block menu %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set pages = craft.entries.section('siteMenu').level('&amp;lt;=2') %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;&amp;lt;li class=&quot;mobile-close&quot;&amp;gt;&amp;lt;a href=&quot;#close&quot; class=&quot;mobile-menu-trigger&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt; close menu&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% cache %}  &#xA;  {% nav page in pages %}&#xA;&#xA;        {% set entryId = page.menuLinkPage %}&#xA;&#xA;        {% if entryId &amp;gt; 0 %}&#xA;          {% if craft.categories.id(entryId)|length %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{siteUrl}}index.php/{{ craft.categories.id(entryId).first().uri }}&quot;&amp;gt;{{page.title}}&amp;lt;/a&amp;gt;&#xA;          {% else %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{siteUrl}}index.php/{{ craft.entries.id(entryId).first().uri }}&quot;&amp;gt;{{page.title}}&amp;lt;/a&amp;gt;&#xA;          {% endif %}    &#xA;{% else %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{siteUrl}}&quot;&amp;gt;{{page.title}}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul class=&quot;sub-menu&quot;&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endcache %}&lt;br&gt;&#xA;    &#xA;&#xA;{% endblock menu %}&#xA;&lt;/pre&gt;&lt;/code&gt;&#xA;&lt;br&gt;&#xA;I hope this helps&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-09-20T01:23:39.903" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2638" PostTypeId="1" CreationDate="2014-09-20T01:28:57.117" Score="0" ViewCount="160" Body="&lt;p&gt;I am using a similar approach with the code provided &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1318/how-to-get-matrix-editor-into-frontend&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to get an initial block to save, but when I go back to the form and try to add another a new block is not created. My application is basically to add notes to an entry. The notes contain an editorName, reviewNotes and a datetime stamp.  What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[editorialHistory][new43][type]&quot; value=&quot;block&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[editorialHistory][new43][fields][editorName]&quot; value=&quot;{{currentUser.getFriendlyName()}}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[editorialHistory][new43][fields][reviewDate]&quot; value=&quot;{{&quot;now&quot;|date(&quot;F j, Y, g:i a&quot;)}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-09-20T17:58:47.347" Title="Adding Matrix from frontend form" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2014-12-19T00:14:48.377" ContentLicense="CC BY-SA 3.0" />
  <row Id="2639" PostTypeId="1" AcceptedAnswerId="2649" CreationDate="2014-09-20T15:28:07.673" Score="2" ViewCount="655" Body="&lt;p&gt;Is there any way to set a different url format for each entry type of a section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an entry type &quot;image&quot; on which I will be using the &lt;a href=&quot;https://github.com/sjelfull/Craft-Randomm&quot; rel=&quot;nofollow&quot;&gt;Randomm&lt;/a&gt; plugin by Fred Carlsen to generate random strings for the URLs. Something like mysite.com/image/324739483. So I have to set the URL format to image/{customFieldHandle}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I also have an entry type &quot;articles&quot; and I'd like to add the actual article name in the URL, like mysite.com/articles/some-article-name.&lt;/p&gt;&#xA;" OwnerUserId="687" LastEditorUserId="687" LastEditDate="2014-09-22T00:26:56.533" LastActivityDate="2014-09-22T00:37:21.250" Title="How to set a different URL format for each entry type of a section?" Tags="&lt;url&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2640" PostTypeId="1" AcceptedAnswerId="2642" CreationDate="2014-09-20T16:56:50.697" Score="2" ViewCount="1419" Body="&lt;p&gt;I have the following code and I'm looking for the best way to link to another entry page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;#&quot; class=&quot;btn-quote&quot;&amp;gt;request a quote&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried something like this with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.getLink('Get a Quote') }}&quot; class=&quot;btn-quote&quot;&amp;gt;request a quote&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the entry: &lt;a href=&quot;http://grab.by/Ax6s&quot; rel=&quot;nofollow&quot;&gt;http://grab.by/Ax6s&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help.&lt;/p&gt;&#xA;" OwnerUserId="806" LastActivityDate="2015-02-01T18:23:56.453" Title="What's the best way to link to an entry in a template?" Tags="&lt;templating&gt;&lt;url&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2641" PostTypeId="2" ParentId="2639" CreationDate="2014-09-20T19:07:15.540" Score="2" Body="&lt;p&gt;You can't create a separate url format for each type, the url format is defined on a per section basis. But you can use the type as part of the url, if that helps. For instance, you can set the url format to &lt;code&gt;{type.handle}/{slug}&lt;/code&gt;. On a recent project I had an &lt;code&gt;article&lt;/code&gt; section with entry types like &lt;code&gt;news&lt;/code&gt;, &lt;code&gt;video&lt;/code&gt;, &lt;code&gt;story&lt;/code&gt;, etc. The resulting url structure was &lt;code&gt;/news/slug&lt;/code&gt;, &lt;code&gt;/video/slug&lt;/code&gt;, &lt;code&gt;/story/slug&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there is nothing stopping you from defining your url structure using routes, and creating the url's based on whatever variables, including entry type. But it would require some more work since you'd have to make sure all your links conform to your defined routes instead of the actual entry urls. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you provide more info on what you're trying to achieve, maybe I can provide a more concrete solution.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-20T19:07:15.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2642" PostTypeId="2" ParentId="2640" CreationDate="2014-09-21T01:23:10.403" Score="3" Body="&lt;p&gt;First, you'll want to retrieve that entry specifically...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug('get-a-quote').first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you've got the entry that you want to target, you can easily link to it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn-quote&quot;&amp;gt;request a quote&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-21T01:23:10.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2643" PostTypeId="1" AcceptedAnswerId="2647" CreationDate="2014-09-21T08:49:52.660" Score="1" ViewCount="164" Body="&lt;p&gt;Getting error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Craft\Import_HistoryRecord and its behaviors do not have a method or closure named &quot;type&quot;.  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Import_HistoryRecord&lt;/code&gt; is one of the Plugin Files in the &quot;records&quot; folder.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Import_HistoryRecord extends BaseRecord&#xA;{&#xA;&#xA;    public function getTableName()&#xA;    {&#xA;        return 'import_history';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'type'     =&amp;gt; AttributeType::String,&#xA;            'file'     =&amp;gt; AttributeType::Name,&#xA;            'rows'     =&amp;gt; AttributeType::Number,&#xA;            'behavior' =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; array(ImportModel::BehaviorAppend, ImportModel::BehaviorReplace, ImportModel::BehaviorDelete)),&#xA;            'status'   =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; array(ImportModel::StatusStarted, ImportModel::StatusFinished, ImportModel::StatusReverted))&#xA;        );&#xA;    }&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord',       'onDelete' =&amp;gt; static::CASCADE, 'required' =&amp;gt; false),&#xA;            'log'  =&amp;gt; array(static::HAS_MANY,   'Import_LogRecord', 'logId')&#xA;        );&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It worked a month ago when I used it, don't think I am doing anything differently.&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="250" LastEditDate="2014-09-21T09:39:28.153" LastActivityDate="2014-09-21T17:00:03.853" Title="Import Plugin Error" Tags="&lt;import&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2644" PostTypeId="2" ParentId="2630" CreationDate="2014-09-21T10:34:09.560" Score="3" Body="&lt;p&gt;The Lightswitch field is a simple boolean/tinyint column, with a 0/1 value. For this to work, you want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[gistDraft]&quot; value=&quot;1&quot; {% if entry.gistDraft %} checked=&quot;checked&quot;{% endif %} /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are sending the value some other way than a checkbox (the lightswitch field is a hidden checkbox), make sure that gistDraft has a value of 0 (off) or 1 (on).&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-21T14:27:24.573" LastActivityDate="2014-09-21T14:27:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2645" PostTypeId="1" CreationDate="2014-09-21T15:02:26.707" Score="3" ViewCount="849" Body="&lt;p&gt;im developing a forms plugin and i'm having some trouble getting my plugin model class autoloaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make development easier i'm implementing the Yii way of rendering forms(&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveForm&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/doc/api/1.1/CActiveForm&lt;/a&gt;). The widget basicly takes a model and attribute name to render the form control in HTML. I'm rewriting this for Craft so i can easily hook ajax validation and template macro's to it while still being super flexible and i can easily develop more forms on the same code base later on. This is the setup (as per Craft plugin design);&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;plugins&#xA;&lt;ul&gt;&#xA;&lt;li&gt;forms&#xA;&lt;ul&gt;&#xA;&lt;li&gt;models&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Forms_BaseModel.php&lt;/li&gt;&#xA;&lt;li&gt;Forms_ContactModel.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;services&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Forms_BaseService.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;FormsPlugin.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem is my model classes aren't getting autoloaded. After snooping around in Craft\PluginsService it seems plugin subclasses are autoloaded per request if their suffix is in the autoloadClasses array found in app\etc\config\common.php on line 661. In this case the suffix is Model so it should get autoloaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the model class isn't autoloaded nor reachable in the FormsVariable-&gt;model() method using Craft::import('path/to/class'), i'm beginning to think this might be a bug or something. I checked for possible typos in the naming but these are all correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have a clue on what's going on?&lt;/p&gt;&#xA;" OwnerUserId="811" LastEditorUserId="811" LastEditDate="2014-09-21T15:23:31.380" LastActivityDate="2015-05-01T14:13:06.303" Title="Plugin autoload classes" Tags="&lt;plugin-development&gt;&lt;models&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2646" PostTypeId="2" ParentId="2645" CreationDate="2014-09-21T15:58:58.450" Score="2" Body="&lt;p&gt;Got it working now, namespace issue :s. The autoloaded classes are in the Craft namespace and i didnt prepend this to the dynamicly generated class names. Time to take a break...&lt;/p&gt;&#xA;" OwnerUserId="811" LastActivityDate="2014-09-21T15:58:58.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2647" PostTypeId="2" ParentId="2643" CreationDate="2014-09-21T17:00:03.853" Score="1" Body="&lt;p&gt;The developer recently added multiple types of import - Entry, User and Category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your import history in the database saved prior to this recent update - I think the db table is called craft_import_history or similar - doesn't have a type saved against so an error is being thrown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit the rows in that table directly and either delete them or edit the type column and add the correct value.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2014-09-21T17:00:03.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2649" PostTypeId="2" ParentId="2639" CreationDate="2014-09-22T00:37:21.250" Score="3" Body="&lt;p&gt;You can set the URL format to something like this and it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.type == &quot;image&quot; %}image/{customFieldHandle}{% elseif object.type == &quot;articles&quot; %}articles/{slug}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-22T00:37:21.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2650" PostTypeId="1" AcceptedAnswerId="2658" CreationDate="2014-09-22T06:01:08.577" Score="1" ViewCount="509" Body="&lt;p&gt;I have a structure section which is three levels deep and I want to add a class when the entry has a parent id of X. I am trying something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('brand').descendantOf(entry.id).level(3) %}&#xA;&amp;lt;li class=&quot;nav--brand__item{% if entry.isAncestorOf(13) %} cs-g{% endif %}&quot;&amp;gt;&#xA;  ...&#xA;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me a &quot;Recoverable error&quot;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to Craft\BaseElementModel::isAncestorOf() must be an&#xA;  instance of Craft\BaseElementModel, string given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('brand').descendantOf(entry.id).level(3) %}&#xA;{% set entryWithId13 = craft.entries.id(13).first() %}&#xA;{% set entryWithId23 = craft.entries.id(23).first() %}&#xA;{% set entryWithId23 = craft.entries.id(29).first() %}&#xA;&amp;lt;li class=&quot;nav--brand__item{% if entryWithId13.isAncestorOf(entry) %} cs-h{% endif %}{% if entryWithId23.isAncestorOf(entry) %} cs-k{% endif %}{% if entryWithId29.isAncestorOf(entry) %} cs-h{% endif %}&quot;&amp;gt;&#xA;...&#xA;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2014-09-22T11:06:17.100" LastActivityDate="2014-09-22T12:45:17.660" Title="How do I set a class if entry is a child of a particular parent?" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2651" PostTypeId="2" ParentId="2650" CreationDate="2014-09-22T07:13:17.960" Score="2" Body="&lt;p&gt;If you want to test whether &lt;code&gt;entry-with-id-X&lt;/code&gt; is an ancestor of &lt;code&gt;entry&lt;/code&gt;, do this (assuming x = 13):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryWithIdX = craft.entries.id(13).first() %}&#xA;...&#xA;{% if entryWithIdX.isAncestorOf(entry) %} ... {% endif %}&#xA;{# or #}&#xA;{% if entry.isDescendantOf(entryWithIdX) %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#isAncestorOf&quot; rel=&quot;nofollow&quot;&gt;isAncestorOf&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#isDescendantOf&quot; rel=&quot;nofollow&quot;&gt;isDescendantOf&lt;/a&gt; take an entry as parameter, not an entryId.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be a good idea to test to see whether &lt;code&gt;craft.entries.id(13)&lt;/code&gt; returns anything before calling &lt;code&gt;first()&lt;/code&gt; on it, but that's a separate issue.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-22T07:13:17.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2652" PostTypeId="1" CreationDate="2014-09-22T07:58:49.770" Score="2" ViewCount="60" Body="&lt;p&gt;When I download the Craft CMS and try to unpack it. I get the error: &quot;Unexpected end of archive&quot;. It seems the download pakage is not complete. When I browse in the .zip file I only see a craft folder (and no public). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone can give me a good download link? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advanced&lt;/p&gt;&#xA;" OwnerUserId="813" LastActivityDate="2014-09-22T08:17:17.373" Title="Download craft error" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2654" PostTypeId="2" ParentId="2652" CreationDate="2014-09-22T08:17:17.373" Score="3" Body="&lt;p&gt;It is probably to do with your connection. I have the same problem here, and I had to use something that can resume downloads to get the complete zip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;a href=&quot;https://chrome.google.com/webstore/detail/chrono-download-manager/mciiogijehkdemklbdcbfkefimifhecn&quot; rel=&quot;nofollow&quot;&gt;Chrono Download Manager&lt;/a&gt; addon for Chrome might work for that.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-22T08:17:17.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2655" PostTypeId="1" CreationDate="2014-09-22T10:01:17.417" Score="3" ViewCount="263" Body="&lt;p&gt;First i would like to say that Craft CMS really impresses me and im really interested in learning more about it &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in a recent project i am having a bit of problems, i have looked at the sample cocktail recipes plugin and it all makes sense however my project is a bit more complicated than that, it adds about 10 new tables and i need to be able to use more than one locale&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will describe a small portion of what im trying to achieve and maybe someone could point out where to look for some code examples within craft core files &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of this example i will have 4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;disease (diseaseSort)&#xA;disease_translation (diseaseId, locale, diseaseTranslation, diseaseTranslationDescription)&#xA;treatment (diseaseId, treatmentSort)&#xA;treatment_translation (treatmentId, locale, treatment, treatmentDescription)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is we would have a list of diseases (in more languages)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and each of those would also have multiple treatments that are available, and also they would be in all the different languages&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what i would like to find out is how can i have a form where i add the disease and it also update the relevant translation table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at the source code but at the moment its still bit hard to understand the data flow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To Clarify why i am thinking of separating the plugins data structure from crafts structure and not using elementsModel i will outline a more detailed plugin description&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin will have Diseases with locales &#xA;Each Disease will have a Grid &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Grid would have a table based layout where there would be treatments as columns ranging from 2-5 treatments for each grid &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And 5-15 questions about the effects of a disease as rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the cells of the grid would be answers to a specific question for a specific treatment &#xA;a simple example would be :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0xhMs.png&quot; alt=&quot;Grid example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;even with this very simple example i have 9 elements and if i have 5 locales it amounts to 45 entries in the database however most grids will have far more data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am i wrong into thinking that it will slow things down considerably ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A suggestion that would help me and probably other people as well would be extending the cocktail recipes plugin a bit so it would have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cocktail Ingridients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cocktail Recipies (A group of ingridients)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locales integrated with both the ingridients and recipies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would provide an example for both the locale integration and more advanced relations between tables &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance &lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="814" LastEditDate="2014-09-22T14:15:56.100" LastActivityDate="2014-09-22T14:15:56.100" Title="Plugin with multiple locales and relations" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="8" FavoriteCount="1" ClosedDate="2014-10-09T18:35:08.507" ContentLicense="CC BY-SA 3.0" />
  <row Id="2656" PostTypeId="1" AcceptedAnswerId="2657" CreationDate="2014-09-22T11:57:37.343" Score="1" ViewCount="256" Body="&lt;p&gt;I am trying to set up a search form in my website. Followed &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;this tutorial&lt;/a&gt; on builtwithcraft documentation website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my top navigation bar I include this code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;navbar-form navbar-right&quot; role=&quot;search&quot; action=&quot;{{ url('/oeuvres/_results') }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;search&quot; class=&quot;form-control&quot; name=&quot;q&quot; placeholder=&quot;Recherche&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;input-group-btn&quot;&amp;gt;&#xA;            &amp;lt;button type=&quot;button&quot; class=&quot;btn btn-default&quot; value=&quot;Go&quot;&amp;gt;&amp;lt;span class=&quot;glyphicon glyphicon-search&quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then the result page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block main %}&#xA;    {% include &quot;includes/_topNav&quot; %}&#xA;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;Résultats&amp;lt;/h1&amp;gt;&#xA;&#xA;                {% set query = craft.request.getParam('q') %}&#xA;                {% set entries = craft.entries.search(query).section('oeuvres') %}&#xA;&#xA;                {% if entries|length %}&#xA;                    &amp;lt;p&amp;gt;{{ entries|length }} Votre recherche:&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% for entry in entries %}&#xA;                            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% else %}&#xA;                    &amp;lt;p&amp;gt;Votre recherche “{{ query }}” n'a donné aucun résultat.&amp;lt;/p&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% include &quot;includes/_javaScript&quot; %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no idea what is wrong, it seems that the &quot;q&quot; param is passing through the result page (the address line is for example: &lt;a href=&quot;http://www.example.com/oeuvres/_results?q=routes&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com/oeuvres/_results?q=routes&lt;/a&gt;&#xA;But the page is totally blank. Meaning nothing gets generated between the body tags. (not even the template tags...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find what I am missing here.&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="130" LastEditDate="2014-09-22T18:06:02.217" LastActivityDate="2014-09-22T18:06:02.217" Title="Search form generates blank page" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2657" PostTypeId="2" ParentId="2656" CreationDate="2014-09-22T12:02:19.793" Score="1" Body="&lt;p&gt;Templates starting with an underscore character is by default denied direct access in Craft (resulting in a 404 not found error). I guess that renaming your template to &quot;results&quot; should fix it.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-22T12:02:19.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2658" PostTypeId="2" ParentId="2650" CreationDate="2014-09-22T12:45:17.660" Score="1" Body="&lt;p&gt;I have worked it out using the following code. Not sure if I could make the conditional neater but this achieves what I need:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('brand').descendantOf(entry.id).level(3) %}&#xA;{% set parentId = entry.getParent().id %}&#xA;&amp;lt;li class=&quot;nav--brand__item{% if parentId == 13 %} cs-g{% endif %}{% if parentId == 23 %} cs-k{% endif %}{% if parentId == 29 %} cs-h{% endif %}&quot;&amp;gt;&#xA;  ...&#xA;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-09-22T12:45:17.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2659" PostTypeId="2" ParentId="2474" CreationDate="2014-09-22T13:39:04.633" Score="2" Body="&lt;p&gt;I thought I'd just add my two cents, since no one has answered this yet. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not clear from your question if these image elements are purely front-end design assets, or if the client/end-user needs to update them from within Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of front-end assets, my opinion is that how these are used in your site is part of the projects build phase, and not something Craft should be responsible for. If Craft starts implementing support for generating sprite sheets, there're tons of other front-end stuff that would be just as relevant to add. Compiling SCSS/LESS/Stylus, concatenation and minification of CSS and JS, building web fonts from SVG files, minification of images and SVGs, etc. I don't feel that this is what P&amp;amp;T should spend their valuable time on. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are numerous ways to automate building a sprite sheet as part of the build, I use &lt;code&gt;grunt-spritesmith&lt;/code&gt; which also gives me a complete stylesheet with classes for all the different elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the problem is that the client needs to update the assets, I see why the sprite sheet has to be generated by Craft. It would be possible to make a plugin that creates a stylesheet from all images in a folder, a list of images or something like that. It would probably involve a lot of inline css, since you wouldn't know the sizes and positions of the different elements in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, depending on the nature of the elements I'm not sure if I think it's worth it.  Since you're considering making a sprite sheet I guess that the elements isn't actual content (ie images that should be accessible, searchable by Google, etc)? In that case I think I'd just lazyload them if they result in too many requests. If the elements is actual content, combining them into a single image would really ruin accessibility, so that is a really bad idea anyhow. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-22T13:39:04.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2660" PostTypeId="1" AcceptedAnswerId="2661" CreationDate="2014-09-22T14:01:40.733" Score="4" ViewCount="796" Body="&lt;p&gt;First of all, I want to thank you for creating Craft. It's really one of the best content management systems I have ever worked with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I encountered an issue while working on a multilingual site: German Umlauts are not automatically transliterated (&lt;strong&gt;Ä -&gt; Ae&lt;/strong&gt;) for slugs. In other parts of Craft (e.g. field handles) Umlauts &lt;em&gt;are&lt;/em&gt; transliterated automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I would prefer if this behavior could be controlled by a config variable (e.g. &lt;code&gt;slugExpandUmlauts&lt;/code&gt;). &lt;/p&gt;&#xA;" OwnerUserId="798" LastEditorUserId="250" LastEditDate="2014-10-04T18:34:14.537" LastActivityDate="2014-10-04T18:34:14.537" Title="How to transform German umlauts when creating slugs?" Tags="&lt;localization&gt;&lt;slug&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2661" PostTypeId="2" ParentId="2660" CreationDate="2014-09-22T14:14:54.760" Score="4" Body="&lt;p&gt;Try enabling the config setting &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#limitAutoSlugsToAscii&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;limitAutoSlugsToAscii&lt;/code&gt;&lt;/a&gt;, that should do what you want.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="250" LastEditDate="2014-10-04T18:33:23.843" LastActivityDate="2014-10-04T18:33:23.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2662" PostTypeId="1" CreationDate="2014-09-22T16:06:59.557" Score="1" ViewCount="460" Body="&lt;p&gt;I'm trying to install craft on my local machine (OSX Mavericks). It gets stuck on a screen with &quot;Oops.&quot; and a spinning icon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The requirements checker says all is good. I have InnoDB and MySQL 5.7.3 installed. I get a list of errors in craft.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/09/22 15:40:54 [warning] [application] Skipping record /Library/WebServer/Documents/lays2/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;&#xA;2014/09/22 15:40:55 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead. The SQL statement executed was: CREATE TABLE `craft_assetfolders` (&#xA;`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY NULL,&#xA;`parentId` INT(11) NULL,&#xA;`sourceId` INT(11) NULL,&#xA;`name` VARCHAR(255) NOT NULL,&#xA;`path` VARCHAR(255) NULL,&#xA;`dateCreated` datetime NOT NULL,&#xA;`dateUpdated` datetime NOT NULL,&#xA;`uid` CHAR(36) NOT NULL DEFAULT 0&#xA;) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.&#xA;&#xA;2014/09/22 15:40:55 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead' in /Library/WebServer/Documents/lays2/craft/app/framework/db/CDbCommand.php:358&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's also a Stack Trace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="815" LastEditorUserId="22" LastEditDate="2017-05-10T00:21:39.217" LastActivityDate="2017-05-10T00:21:39.217" Title="Craft installer errors" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-09-24T19:49:34.493" ContentLicense="CC BY-SA 3.0" />
  <row Id="2663" PostTypeId="2" ParentId="2662" CreationDate="2014-09-22T16:44:28.140" Score="0" Body="&lt;p&gt;If I had to guess, they made a chance in MySQL 5.7 that's breaking Craft and you've found a bug.  We haven't done any 5.7 testing, since it's not officially released, yet, but I'll install it and do some verification and update this answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was a bug in Craft when using MySQL 5.7 and has been fixed for the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2588&quot; rel=&quot;nofollow&quot;&gt;post 2.2.2588&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-24T19:56:05.180" LastActivityDate="2014-09-24T19:56:05.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2664" PostTypeId="1" AcceptedAnswerId="2673" CreationDate="2014-09-22T18:11:04.037" Score="3" ViewCount="589" Body="&lt;p&gt;I have created a front-end form to facilitate editorial review of user submitted content. I have created a controller action to receive the post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question, how do I locate the email address of the author tied to this entry? My objective is to be able to email the author with the results of the editorial review. In order to accomplish this I need to know the user (author) email address etc. Here is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requirePostRequest();&#xA;&#xA;$entryId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('entryId');&#xA;$editorialNotesInternal = craft()-&amp;gt;request-&amp;gt;getPost('fields.editorialNotesInternal');&#xA;$editorialScore = craft()-&amp;gt;request-&amp;gt;getPost('fields.editorialScore');&#xA;$editorialNotes = craft()-&amp;gt;request-&amp;gt;getPost('fields.editorialNotes');&#xA;$sectionId = craft()-&amp;gt;request-&amp;gt;getPost('sectionId');&#xA;&#xA;$entry = new EntryModel();&#xA;&#xA;$entry-&amp;gt;id = $entryId;&#xA;$entry-&amp;gt;sectionId = $sectionId;&#xA;&#xA;if ( $editorialScore &amp;gt;= 3) {&#xA;    $entry-&amp;gt;enabled = true;&#xA;} else {&#xA;    $entry-&amp;gt;enabled = false;&#xA;}   &#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;editorialScore = $editorialScore;&#xA;$entry-&amp;gt;getContent()-&amp;gt;editorialNotes  = $editorialNotes;&#xA;$entry-&amp;gt;getContent()-&amp;gt;editorialNotesInternal  = $editorialNotesInternal;&#xA;&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="57" LastEditDate="2014-09-22T20:01:33.447" LastActivityDate="2014-09-23T04:31:27.537" Title="Retrieve Author Email based on Entry Id" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;author&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2665" PostTypeId="1" AcceptedAnswerId="2667" CreationDate="2014-09-22T19:45:21.360" Score="5" ViewCount="959" Body="&lt;p&gt;I have a plugin which needs to create a temporary file. Where should I put it?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-22T20:22:31.760" Title="Where should a plugin create temporary files" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2666" PostTypeId="2" ParentId="2664" CreationDate="2014-09-22T20:18:13.440" Score="3" Body="&lt;p&gt;I assume you're talking about getting the email address of the currently logged in user?  That's what &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel's&lt;/a&gt; authorId property will get set to, if one isn't explicitly supplied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you can do that with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;email;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to get the email address of the user that is the author of the entry, then you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = $entry-&amp;gt;getAuthor()-&amp;gt;email;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-22T22:22:51.147" LastActivityDate="2014-09-22T22:22:51.147" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2667" PostTypeId="2" ParentId="2665" CreationDate="2014-09-22T20:22:31.760" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/PathService&quot; rel=&quot;nofollow&quot;&gt;PathService&lt;/a&gt; has a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/PathService#getTempPath-detail&quot; rel=&quot;nofollow&quot;&gt;getTempPath()&lt;/a&gt; method which will return the &lt;code&gt;craft/storage/runtime/temp&lt;/code&gt; path by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft uses that for its temporary files and so can plugins.  Just make sure youre plugin is being defensive by giving it a unique filename or create a folder with a unique name and put your files in there, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-22T20:22:31.760" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2668" PostTypeId="1" CreationDate="2014-09-22T20:41:50.040" Score="4" ViewCount="1055" Body="&lt;p&gt;I see how to use Image Transforms when the image tag is its own field but don't see a way to handle images within Rich Text fields or force a size on upload. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to have the image dimensions match the size the client sized the image to in the Rich Text field. Is there a way to do this?&lt;/p&gt;&#xA;" OwnerUserId="649" LastEditorUserId="9" LastEditDate="2014-10-16T18:32:23.207" LastActivityDate="2014-10-16T18:32:23.207" Title="Can images embedded in a Rich Text field be resized on output?" Tags="&lt;richtext&gt;&lt;redactor&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2669" PostTypeId="2" ParentId="2668" CreationDate="2014-09-22T21:28:06.727" Score="3" Body="&lt;p&gt;If you create an image transform in the control panel, the client will be able to choose that transform when selecting an image (in the bottom right corner). But there's no way to get Craft to transform the image based on the size the clients manually set the image to be in the rich text field. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-22T21:28:06.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2670" PostTypeId="1" AcceptedAnswerId="2671" CreationDate="2014-09-23T00:38:04.097" Score="2" ViewCount="1307" Body="&lt;p&gt;Has anyone else run into an unstyled /admin/install/ page? Inspector shows 404 on all css and js files and they are pointing to /admin/resources/*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Been searching around and it doesn't seem to be a common issue so I'm a bit stumped. (Trying to install on an ubuntu/nginx digitalocean droplet)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently staring at this screen:&#xA;![enter image description here][1]&lt;/p&gt;&#xA;" OwnerUserId="816" LastEditorUserId="816" LastEditDate="2015-08-31T17:48:17.570" LastActivityDate="2015-08-31T17:48:17.570" Title="/admin/install/ missing resource files (css/js 404) and is unstyled" Tags="&lt;install&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2671" PostTypeId="2" ParentId="2670" CreationDate="2014-09-23T01:01:26.030" Score="0" Body="&lt;p&gt;Most likely an nginx config file issue.  There are some configs that are working for people here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;What is the recommended Nginx configuration for Craft?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-23T01:01:26.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2672" PostTypeId="2" ParentId="2670" CreationDate="2014-09-23T01:23:09.730" Score="0" Body="&lt;p&gt;Could be that you have &lt;a href=&quot;http://php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression&quot; rel=&quot;nofollow&quot;&gt;zlib.output_compression&lt;/a&gt; enabled. See this help article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/missing-cp-css-js&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/missing-cp-css-js&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-23T01:23:09.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2673" PostTypeId="2" ParentId="2664" CreationDate="2014-09-23T04:31:27.537" Score="1" Body="&lt;p&gt;I think I found my solution. To recap, I have a front-end form where a user that is not the author is permitted to make changes to an existing entry. I was creating a new Entry model instead of retrieving the Entry that I wanted to update. The answer getEntryById(). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requirePostRequest();&#xA;&#xA;$entryId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('entryId'); &#xA;//entryId passed to controller from front-end form&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId, $localeId = null);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then reset values that I am changing. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( $editorialScore &amp;gt;= 3) {&#xA;$entry-&amp;gt;enabled = true;&#xA;} else {&#xA;$entry-&amp;gt;enabled = false;&#xA;    }   &#xA;    $entry-&amp;gt;getContent()-&amp;gt;editorialScore = $editorialScore;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;editorialNotes  = $editorialNotes;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Follow that with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am then able to get Author's email address using Brad's suggested &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = $entry-&amp;gt;getAuthor()-&amp;gt;email;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-23T04:31:27.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2674" PostTypeId="1" AcceptedAnswerId="2693" CreationDate="2014-09-23T08:48:05.667" Score="4" ViewCount="2405" Body="&lt;p&gt;I have a template in my control panel (technically a plugin, but it's just one template) which is running out of memory:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Allowed memory size of 134217728 bytes exhausted (tried&#xA;  to allocate 78 bytes) in&#xA;  /var/sites/t/thames-arbitrators.org.uk/craft/app/helpers/ModelHelper.php&#xA;  on line 101&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In my local dev site, the profiler is giving me the following info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Time 10.66053s&lt;/li&gt;&#xA;&lt;li&gt;Memory: 127,544Kb&lt;/li&gt;&#xA;&lt;li&gt;Total Queries: 381&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to alleviate this? I've seen the answer to '&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1323/php-fatal-error-allowed-memory-size-of-x-bytes-exhausted&quot;&gt;PHP Fatal error: Allowed memory size of X bytes exhausted&lt;/a&gt;' but there are only two conditionals in this template, it's almost certainly down to the fact that I need to return several hundred entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't mind posting my template here but there's a big table in it so it's going to make the page super long - let me know which bits you need.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-09-23T19:46:32.043" Title="Fatal error: Allowed memory size of 134mb exhausted" Tags="&lt;entries&gt;&lt;php&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2675" PostTypeId="1" AcceptedAnswerId="2676" CreationDate="2014-09-23T11:17:23.840" Score="17" ViewCount="5644" Body="&lt;p&gt;I was wondering if it's was possible to order section entries by random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('team').type('mainPeople').order('title random)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="817" LastEditorUserId="250" LastEditDate="2014-10-03T16:05:09.310" LastActivityDate="2014-10-03T16:05:09.310" Title="Section entries - order by random" Tags="&lt;templating&gt;&lt;entries&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2676" PostTypeId="2" ParentId="2675" CreationDate="2014-09-23T11:20:58.700" Score="45" Body="&lt;p&gt;You can use MySQL's &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand&quot;&gt;RAND()&lt;/a&gt; function inside your order method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('team').type('mainPeople').order('RAND()') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-09-23T11:20:58.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2677" PostTypeId="1" AcceptedAnswerId="2690" CreationDate="2014-09-23T11:55:00.070" Score="2" ViewCount="624" Body="&lt;p&gt;I'm just starting to explore the whole power of Craft and I'm really satisfied with its possibilities so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't get one thing done, so here's my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use matrix fields in my very own plugins? I already finished a form with several fields just as text inputs and stuff but I really need to extend this thing with a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I just blind and it's documented anywhere or is it a more complicated task than I can imagine at this point?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jonas&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="57" LastEditDate="2014-09-23T17:32:54.410" LastActivityDate="2014-09-23T18:28:23.543" Title="Matrix fields within a plugin?" Tags="&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2678" PostTypeId="1" AcceptedAnswerId="2680" CreationDate="2014-09-23T12:59:26.320" Score="3" ViewCount="3845" Body="&lt;p&gt;I am a little puzzled by the way craft handles CSS files. Although I am used to working with SCSS and CSS assets and setting up a reasonable directory structure, I was expecting a little documentation or a best practice recommendation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, I tried to create an asset folder with all CSS files. But then I realized that they could not be uploaded because they were not in the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;allowedFileExtensions&lt;/a&gt; config array. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin documentation contains some info about handling plugin-specific &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;frontend resources&lt;/a&gt; but it does not say anything about the general CSS files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most helpful information I found so far was &lt;a href=&quot;https://craftcms.stackexchange.com/a/1424/798&quot;&gt;this answer&lt;/a&gt; although it did not really help me with my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the recommended way to handle CSS assets? What are your best practices for asset management and setting up a frontend workflow in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards&lt;/p&gt;&#xA;" OwnerUserId="798" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-09-23T16:43:58.793" Title="Where should I put custom CSS files?" Tags="&lt;assets&gt;&lt;workflow&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2679" PostTypeId="1" CreationDate="2014-09-23T13:42:11.600" Score="4" ViewCount="139" Body="&lt;p&gt;I have a site that is mixed English and Chinese.  I've properly set up the locale to include Chinese as a locale, and have put Chinese translations for my fields in place.  That all works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the site isn't one where you'll pick Chinese or English, it's going to display both in many cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a way to explicitly set the English or Chinese translation of a global (or any field for that matter)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ myGlobalSet.myGlobal.en }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ myGlobalSet.en.myGlobal }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...but it didn't like either one of them.  Is there a way to retrieve the localization of a field without having to switch the locale of the entire site?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2014-09-23T14:12:21.827" Title="Fetching localized globals?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2680" PostTypeId="2" ParentId="2678" CreationDate="2014-09-23T13:47:02.393" Score="5" Body="&lt;p&gt;In general, Craft doesn't normally come into the equation when we're talking about general frontend assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things like minification, preprocessing of SASS/LESS/Coffescript/WHATEVER, image compression (asset images, not content images) etc. should preferably be handled by a tool like Grunt or Gulp (my favorite).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even when it comes to CSS/JS for your plugins, you might want to do the actual build process with Gulp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I usually have all source files in the project root, under a folder named &lt;strong&gt;src&lt;/strong&gt;. In there, you have subfolders named js, scss, img, fonts etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're unfamiliar with for example Gulp, I might recommend you &lt;a href=&quot;http://markgoodyear.com/2014/01/getting-started-with-gulp/&quot; rel=&quot;nofollow&quot;&gt;Mark Goodyear's article Getting started with Gulp&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Craft side, you could take a look at &lt;a href=&quot;https://github.com/johndwells/craft.minimee&quot; rel=&quot;nofollow&quot;&gt;John D. Wells' awesome Minimee&lt;/a&gt; and &lt;a href=&quot;https://github.com/aelvan/Inlin-Craft&quot; rel=&quot;nofollow&quot;&gt;Inlin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="45" LastEditDate="2014-09-23T16:43:58.793" LastActivityDate="2014-09-23T16:43:58.793" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2681" PostTypeId="1" AcceptedAnswerId="2683" CreationDate="2014-09-23T14:05:24.890" Score="5" ViewCount="668" Body="&lt;p&gt;I'm trying to generate titles for a section's entries based off of the given post date (if it exists). Here's the configuration I've got in the Title Format field for this section's entry types:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;New Arrivals for {% if postDate %}{{ postDate|date('M j, Y') }}{% else %}{{ now|date('M j, Y') }}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect that, upon saving each new entry, Craft would build a title based off of the post date. Unfortunately, it always builds off of the current date - even with a more straightforward title format configuration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;New Arrivals for {{ postDate|date('M j, Y') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the user doesn't have to fill out the post date fields, but it appears that Craft creates a post date for every entry (and even does so &lt;em&gt;before&lt;/em&gt; it writes the date created field to the database).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that in mind, why wouldn't the above title format configurations work? Am I missing something? Any and all help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="799" LastActivityDate="2014-09-23T14:17:57.237" Title="Use postDate in section title format field" Tags="&lt;sections&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2682" PostTypeId="2" ParentId="2679" CreationDate="2014-09-23T14:12:21.827" Score="2" Body="&lt;p&gt;It looks like I can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myGlobalSet = craft.globals.getSetByHandle( 'setName', 'zh' ) %}&#xA;{{ myGlobalSet.myGlobalVar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone has a better way to do it, please let me know... my plan is just to put this into a base template so that all of the pages can access the localization easily.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2014-09-23T14:12:21.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2683" PostTypeId="2" ParentId="2681" CreationDate="2014-09-23T14:17:57.237" Score="4" Body="&lt;p&gt;The entry will be passed to this template as a variable named &lt;code&gt;object&lt;/code&gt;. When you want to reference its properties you have two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{postDate}&lt;/code&gt; (single braces)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{{object.postDate}}&lt;/code&gt; (regular Twig syntax)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first one is just a shortcut for the second one. When Craft is getting ready to pass your Title Format template off to Twig, the first thing it will do is find any of those shortcut tags and swap ten with the full Twig syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case here's what you should do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;New Arrivals for {% if object.postDate %}{postDate|date('M j, Y')}{% else %}{{ now|date('M j, Y') }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-23T14:17:57.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2684" PostTypeId="1" CreationDate="2014-09-23T16:04:56.383" Score="2" ViewCount="393" Body="&lt;p&gt;I'm not sure why this isn't working as I set the variable outside the scope of the matrix block. The variable is working inside the matrix block, but not accessible outside of it. What am I missing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Index template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slideImg = &quot;&quot; %}&#xA;&#xA;{% block hero %}&#xA;    {% for block in entry.hero %}&#xA;        {% set slideImg = block.heroImg.first().url %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&#xA;{% block footerJs %}&#xA;    &amp;lt;script&amp;gt;&#xA;        $(function() {&#xA;            $('#slide-1').backstretch('{{ slideImg }}');&#xA;        )};&#xA;    &amp;lt;/script&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update: Full Index template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% set metaTitle = entry.seoTitle %}&#xA;{% set metaDescription = entry.seoDescription %}&#xA;{% set metaKeywords = entry.seoKeywords %}&#xA;&#xA;{% set slideImg = &quot;&quot; %}&#xA;&#xA;{% block hero %}&#xA;    {% for block in entry.hero %}&#xA;        &amp;lt;h2&amp;gt;{{ block.headline|raw }}&amp;lt;/h2&amp;gt;&#xA;        {% set slideImg = block.heroImg.first().url %}&#xA;        {% set link1 = block.buttonLink1.first() %}&#xA;        &amp;lt;a href=&quot;{{ link1.url }}&quot; class=&quot;btn-gradient&quot;&amp;gt;{{ block.buttonLabel1 }}&amp;lt;/a&amp;gt;&#xA;        {% if block.buttonLabel2%}&#xA;        {% set link2 = block.buttonLink1.first() %}&#xA;        &amp;lt;a href=&quot;{{ link2.url }}&quot; class=&quot;btn-gradient&quot;&amp;gt;{{ block.buttonLabel2 }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&#xA;{% block footerJs %}&#xA;    &amp;lt;script&amp;gt;&#xA;        $(function() {&#xA;            $('#slide-1').backstretch('{{ slideImg }}');&#xA;        )};&#xA;    &amp;lt;/script&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update #2 _layout&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;!--[if lt IE 7]&amp;gt;      &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8 lt-ie7&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 7]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 8]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if gt IE 8]&amp;gt;&amp;lt;!--&amp;gt; &amp;lt;html class=&quot;no-js&quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;&#xA;&#xA;    {% block head %}&#xA;        &amp;lt;title&amp;gt;{% if metaTitle is defined %}{{ metaTitle }}{% else %}{{ entry.title }}{% endif %}{{siteName}}&amp;lt;/title&amp;gt;&#xA;        {% if metaDescription is defined %}&amp;lt;meta name=&quot;description&quot; content=&quot;{{ metaDescription }}&quot;&amp;gt;{% endif %}&#xA;        {% if metaKeywords is defined %}&amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ metaKeywords }}&quot;&amp;gt;{% endif %}&#xA;    {% endblock %}&#xA;&#xA;    &amp;lt;meta name=&quot;author&quot; content=&quot;@siebird&quot;&amp;gt;&#xA;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/normalize.min.css&quot;&amp;gt;&#xA;    &amp;lt;link href='http://fonts.googleapis.com/css?family=Arvo:400,400italic|PT+Sans+Narrow:400,700' rel='stylesheet' type='text/css'&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/styles.css&quot;&amp;gt;&#xA;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    &amp;lt;!--[if lt IE 7]&amp;gt;&#xA;        &amp;lt;p class=&quot;browsehappy&quot;&amp;gt;You are using an &amp;lt;strong&amp;gt;outdated&amp;lt;/strong&amp;gt; browser. Please &amp;lt;a href=&quot;http://browsehappy.com/&quot;&amp;gt;upgrade your browser&amp;lt;/a&amp;gt; to improve your experience.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;![endif]--&amp;gt;&#xA;    &amp;lt;div class=&quot;header{% if craft.request.firstSegment == '' %} big{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;div id=&quot;slide{% if craft.request.firstSegment == '' %}-int{% endif %}&quot; class=&quot;slide&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;{{ general.companyName}}&amp;lt;/h1&amp;gt;&#xA;&#xA;                {% block hero %}&#xA;&#xA;                {% endblock %}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;nav-bar&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;buns&quot;&amp;gt;&#xA;            &amp;lt;span&amp;gt;MENU&amp;lt;/span&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;hamburger nav-main&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;ul class=&quot;nav nav-main&quot;&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == '' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'who-we-are' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('who-we-are') }}&quot;&amp;gt;Who We Are&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'community' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('community') }}&quot;&amp;gt;Community&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'floorplans' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('floorplans') }}&quot;&amp;gt;Floor Plans&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'energy' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('energy') }}&quot;&amp;gt;Energy&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'gallery' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('gallery') }}&quot;&amp;gt;Gallery&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li{% if craft.request.firstSegment == 'agents' %} class=&quot;active&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ url('agents') }}&quot;&amp;gt;Agents&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li class=&quot;nav-btn&quot;&amp;gt;&amp;lt;a href=&quot;{{ url('visit') }}&quot;&amp;gt;Schedule a Visit&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% block main %}&#xA;&#xA;    {% endblock %}&#xA;&#xA;    &amp;lt;div class=&quot;footer&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;block-3&quot;&amp;gt;&#xA;                &amp;lt;address&amp;gt;{{ general.address }}&amp;lt;br&amp;gt; &amp;lt;a href=&quot;{{ general.directions }}&quot; target=&quot;_blank&quot;&amp;gt;Get Directions!&amp;lt;/a&amp;gt;&amp;lt;/address&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;block-3&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;Contact Us Today&amp;lt;br&amp;gt; &amp;lt;a href=&quot;tel:{{ general.phoneNumber }}&quot; class=&quot;tel&quot;&amp;gt;{{ general.phoneNumber }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;block-6&quot;&amp;gt;&#xA;                &amp;lt;small&amp;gt;&amp;amp;copy; {{ now.year }} {{ general.companyName }}. All Rights Reserved.&amp;lt;br&amp;gt; &amp;lt;a href=&quot;http://siebird.com&quot;&amp;gt;Website design &amp;amp;amp; development by &amp;lt;em&amp;gt;Siebird&amp;lt;/em&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/small&amp;gt;&#xA;                &amp;lt;img src=&quot;assets/img/eho.png&quot; class=&quot;pull-right&quot; alt=&quot;equal housing opportunity&quot; height=&quot;51&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script&amp;gt;window.jQuery || document.write('&amp;lt;script src=&quot;assets/js/vendor/jquery-1.10.2.min.js&quot;&amp;gt;&amp;lt;\/script&amp;gt;')&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script src=&quot;/assets/js/plugins.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script src=&quot;/assets/js/application.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;    {% block footerJs %}&#xA;&#xA;    {% endblock %}&#xA;&#xA;  {#&#xA;  Google Analytics: change UA-XXXXX-X to be your site's ID.&#xA;    &amp;lt;script&amp;gt;&#xA;        (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=&#xA;        function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;&#xA;        e=o.createElement(i);r=o.getElementsByTagName(i)[0];&#xA;        e.src='//www.google-analytics.com/analytics.js';&#xA;        r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));&#xA;        ga('create','UA-XXXXX-X');ga('send','pageview');&#xA;    &amp;lt;/script&amp;gt;&#xA;    #}&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2014-09-24T03:02:02.423" LastActivityDate="2015-08-23T00:29:21.567" Title="Setting Variable inside of Matrix" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2685" PostTypeId="1" CreationDate="2014-09-23T16:09:21.423" Score="0" ViewCount="1038" Body="&lt;p&gt;I have an &lt;code&gt;{entry.footer}&lt;/code&gt; field outputting just fine everywhere before &lt;code&gt;{% set entry... %}&lt;/code&gt;&#xA;Added &lt;code&gt;{% endset %}&lt;/code&gt; tags after closing anchor tag and caused an error. Any idea what the issue is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block home_slider %}&#xA;{% include 'global/home-slider.html' %}&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;            &amp;lt;main id=&quot;main&quot; role=&quot;main&quot;&amp;gt;&#xA;                &amp;lt;div id=&quot;content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;holder-top&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;holder&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;text-wrap&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;                                     {{ entry.body }}&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;div class=&quot;three-columns&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;                                    {% for block in entry.threeHomepageImages.type('images') %}&#xA;                                        &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;                                            &amp;lt;div class=&quot;image-block&quot;&amp;gt;&#xA;                                                &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                                                    {% if block.image|length %}&#xA;                                                        &amp;lt;a href=&quot;{{ block.pageLink.first().getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;images/{{ block.image.first }}.jpg&quot; alt=&quot;{{ block.alt }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                                                    {% endif %}&#xA;                                                &amp;lt;/div&amp;gt;&#xA;                                            &amp;lt;/div&amp;gt;&#xA;                                            &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ block.pageLink.first().getUrl() }}&quot;&amp;gt;{{ block.imageTitle }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                                        &amp;lt;/div&amp;gt;&#xA;                                    {% endfor %}&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;div class=&quot;btn-holder&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;btn-wrap&quot;&amp;gt;&#xA;                                    {% set entry = craft.entries.slug('get-a-quote').first %}&#xA;                                    &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn-quote&quot;&amp;gt;request a quote&amp;lt;/a&amp;gt;&#xA;                                    {% endset %}&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;holder-bottom&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;quote&quot;&amp;gt;&#xA;                            {{ entry.footer }}&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/main&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastEditorUserId="806" LastEditDate="2014-09-23T17:41:51.593" LastActivityDate="2014-09-23T21:03:29.053" Title="Entry field not outputting after {% set... %} code in template" Tags="&lt;templating&gt;&lt;field&gt;&lt;entry&gt;&lt;set&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2687" PostTypeId="1" AcceptedAnswerId="2688" CreationDate="2014-09-23T18:00:56.770" Score="4" ViewCount="1856" Body="&lt;p&gt;In looking over the docs on &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates&quot; rel=&quot;nofollow&quot;&gt;template rendering&lt;/a&gt; I am not seeing a way to pass in an Entry model. It seems more efficient to pass in an existing model rather than have the template do another lookup. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = craft()-&amp;gt;templates-&amp;gt;render('path/to/template', $myEntry); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my use case. I want to use the craft template rendering engine to compose email messages. &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-23T18:04:59.137" Title="Passing Entry to craft()-&gt;templates-&gt;render()" Tags="&lt;templating&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2688" PostTypeId="2" ParentId="2687" CreationDate="2014-09-23T18:04:59.137" Score="10" Body="&lt;p&gt;You can just pass in the EntryModel straight to the view.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = craft()-&amp;gt;templates-&amp;gt;render('path/to/template', [ 'entry' =&amp;gt; $entryModel ]); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-23T18:04:59.137" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2689" PostTypeId="2" ParentId="2685" CreationDate="2014-09-23T18:20:42.100" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow&quot;&gt;twig set tag&lt;/a&gt; has two syntaxes. You can use it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = 'bar' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo %}bar{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are both useful in different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error you were getting was about mixing them.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-23T18:20:42.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2690" PostTypeId="2" ParentId="2677" CreationDate="2014-09-23T18:28:23.543" Score="1" Body="&lt;p&gt;Matrix fields can only be used as custom fields, on an element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to use them, you would need to create a custom Element Type (see the resources at the bottom of &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/working-with-elements&lt;/a&gt;), and then create a Matrix field that is associated with your element type’s field layout.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-23T18:28:23.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2691" PostTypeId="1" AcceptedAnswerId="2695" CreationDate="2014-09-23T19:25:18.190" Score="4" ViewCount="1006" Body="&lt;p&gt;We need to be able to add super and sub-text to a rich text field without having the client dive into the markup. Has anyone successfully added this as a redactor or Craft plugin?&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2016-02-16T15:01:31.463" Title="How can I use &lt;small&gt; &lt;sub&gt; &lt;sub&gt; within a redactor/rich-text field?" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2692" PostTypeId="1" AcceptedAnswerId="2737" CreationDate="2014-09-23T19:32:58.407" Score="5" ViewCount="762" Body="&lt;p&gt;I have a plugin which contains a &lt;strong&gt;Record&lt;/strong&gt;. My record contains a &lt;strong&gt;foreign key&lt;/strong&gt; of the related &lt;strong&gt;element ID&lt;/strong&gt;. The only other column in my custom table is &lt;em&gt;the value I'd like to sort by&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Twig syntax, &lt;strong&gt;how can I expand on a normal Craft query to sort by a column in my custom table?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ordinary query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('colors').find&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ordinary query which sorts by my custom data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('colors').myPlugin('asc').find&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done something similar to this once before... But in that case, I used the &lt;code&gt;modifyElementsQuery&lt;/code&gt; method in my Field Type. Since this new plugin doesn't require a field type, I'm not exactly sure of the best way to modify a standard query.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-09-26T08:39:51.207" LastActivityDate="2014-09-26T08:39:51.207" Title="How can I expand on a normal Craft query to sort by a column in a custom table?" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2693" PostTypeId="2" ParentId="2674" CreationDate="2014-09-23T19:46:32.043" Score="4" Body="&lt;p&gt;If your plugin is pulling in a lot of data, then most likely you're just bumping into your php.ini file's &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; setting.  Try bumping that up to 256M and see if that helps.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-23T19:46:32.043" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2694" PostTypeId="2" ParentId="2542" CreationDate="2014-09-23T20:00:28.603" Score="1" Body="&lt;p&gt;Not exactly the fine control you're looking for, or ideal by any means, but one direction might be to create an &quot;Account&quot; channel with a related user field for 'User' (required; limit to 1; from userGroup 'Regular User') — or vice-versa (related &quot;Account&quot; entry in &quot;Users&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then restrict your Account Admins to only edit 'Accounts' (and Products) entries that belong to them, with all the custom fields that are required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is that you wouldn't also want the Account Admin to be able to edit or assign permissions to users (thus defeating the purpose). And there is no way to automatically assign a new user (created through the CP) to a userGroup (as far as I know). Users can however automatically be assigned through the front-end through &quot;allow public registration&quot; and &quot;default user group&quot; settings. So, an Account Admin could technically create a new user through the front-end. And then (back in the CP) create a new 'Account' entry, and relate that account to the user they just created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They would still require an admin to edit or delete the user, but maybe that's ok. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would also need checks in place to ensure that only one account was assigned to any one user, somehow. If you reverse the relationship (i.e. related 'Account' entries field in 'Users'; limit 1), then you could ensure the 1-to-1, but this would require an admin to relate the two together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Admins, of course, could do all of this through the CP and assign the &quot;Account&quot; to the Account Admin, by just setting the author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not ideal of course, but perhaps a step in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-09-23T20:07:05.777" LastActivityDate="2014-09-23T20:07:05.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2695" PostTypeId="2" ParentId="2691" CreationDate="2014-09-23T20:29:39.637" Score="4" Body="&lt;p&gt;There are keyboard shortcuts that can accomplish super and subscript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Redactor &lt;a href=&quot;http://imperavi.com/redactor/log/&quot; rel=&quot;nofollow&quot;&gt;changelog&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Superscript shortcut now crtl+h (high, super) instead of old ctrl+l&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subscript shortcut now crtl+l (low, sub) instead of old ctrl+h&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="260" LastActivityDate="2014-09-23T20:29:39.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2696" PostTypeId="1" CreationDate="2014-09-23T20:37:50.070" Score="0" ViewCount="375" Body="&lt;p&gt;So I have a matrix field with 3 different block types. The first two block types have markup contained within their scope. The last type, has opening and closing tags for the first of type and last of type (&lt;em&gt;basically creating a row with two columns&lt;/em&gt;). I was able to successfully get the markup, but wanted to see if there is a better way to to this write this. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeContentBlocks %}&#xA;    {% if block.type == &quot;leadGeneration&quot; %}&#xA;        ...&#xA;    {% elseif block.type == &quot;banner&quot; %}&#xA;        ...&#xA;    {% else %}&#xA;        {% if block.next() %}&#xA;            {% if block.next().type == &quot;contentBlock&quot; %}&amp;lt;div class=&quot;row&quot;&amp;gt;{% endif %}&#xA;        {% endif %}&#xA;&#xA;            {% if block.next() %}&#xA;                {% if block.next().type == &quot;contentBlock&quot; %}&#xA;                    &amp;lt;div class=&quot;block-6 v-divider&quot;&amp;gt;&#xA;                {% endif %}&#xA;            {% endif %}&#xA;            {% if block.prev() %}&#xA;                {% if block.prev().type == &quot;contentBlock&quot; %}&#xA;                    &amp;lt;div class=&quot;block-6 pad-left&quot;&amp;gt;&#xA;                {% endif %}&#xA;            {% endif %}&#xA;&#xA;                &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;                {{ block.body }}&#xA;                {% if block.btnLink | length %}&#xA;                    {% set link = block.btnLink.first().url %}&#xA;                    &amp;lt;a href=&quot;{{ link }}&quot; class=&quot;btn&quot;&amp;gt;{{ block.btnLabel }}&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% if block.prev() %}&#xA;            {% if block.prev().type == &quot;contentBlock&quot; %}&amp;lt;/div&amp;gt;{% endif %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this works, but let's say the blocks out of sequence. I thought maybe a increment variable could work, but wasn't sure how to implement it. &lt;/p&gt;&#xA;" OwnerUserId="202" LastActivityDate="2019-04-01T17:33:08.517" Title="Conditional variables within a certain matrix block type" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2697" PostTypeId="2" ParentId="2691" CreationDate="2014-09-23T20:39:35.130" Score="1" Body="&lt;p&gt;Check out the example over at the Redactor documentation: &lt;a href=&quot;http://imperavi.com/redactor/examples/buttons-sup-and-sub/&quot; rel=&quot;nofollow&quot;&gt;Add Sup and Sub Buttons&lt;/a&gt; - As an aside, also check out this article over at Straightupcraft.com: &lt;a href=&quot;http://straightupcraft.com/articles/how-to-add-custom-redactor-toolbars-to-the-default-rich-text-field-in-craft-cms&quot; rel=&quot;nofollow&quot;&gt;How to add custom Redactor toolbars to the default Rich Text field&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Save the example as a plugin file in craft/app/resources/lib/redactor/plugins, for example subsup.js (I don't know how to customize this so you can safely add custom plugins, or how to tell redactor to look for more than one place. An alternative way is to make a custom Craft plugin that add the plugin JS to the entry page).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make a custom redactor configuration file and add it to craft/config/redactor. This is the standard.json&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;    plugins: ['fullscreen'],&#xA;    toolbarFixedBox: true&#xA;}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add your plugin name to the plugins array:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plugins: ['fullscreen', 'subsup'],&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In your field settings, under Config, select the custom config.json file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, since we added the plugins file within the redactor/plugins folder, we risk it being overwritten. The best way is to add it via a plugin, but the mentioned process might be a quick way for you to add it now.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-23T20:39:35.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2698" PostTypeId="2" ParentId="2685" CreationDate="2014-09-23T20:42:21.977" Score="5" Body="&lt;p&gt;Here's your problem... You're redefining &lt;code&gt;entry&lt;/code&gt; halfway down the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page clearly uses the section's built-in routing functionality. I can tell because you use &lt;code&gt;entry.body&lt;/code&gt; near the top of your page &lt;em&gt;without explicitly declaring the value of &lt;code&gt;entry&lt;/code&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you later on use &lt;code&gt;{% set entry %}&lt;/code&gt; to &lt;strong&gt;reassign&lt;/strong&gt; the value of &lt;code&gt;entry&lt;/code&gt;. Based on the new value of &lt;code&gt;entry&lt;/code&gt;, the &lt;code&gt;entry.footer&lt;/code&gt; property no longer exists or is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to fix it...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of &lt;code&gt;{% set entry %}&lt;/code&gt;, use a &lt;em&gt;different&lt;/em&gt; variable name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set getQuoteEntry = craft.entries.slug('get-a-quote').first %}&#xA;&amp;lt;a href=&quot;{{ getQuoteEntry.url }}&quot; class=&quot;btn-quote&quot;&amp;gt;request a quote&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will leave the original value of &lt;code&gt;entry&lt;/code&gt; untouched, and you'll still have access to &lt;code&gt;entry.footer&lt;/code&gt; at the bottom of the page.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-09-23T21:03:29.053" LastActivityDate="2014-09-23T21:03:29.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2699" PostTypeId="1" AcceptedAnswerId="2700" CreationDate="2014-09-23T20:42:42.457" Score="9" ViewCount="8038" Body="&lt;p&gt;When migrating a Craft site, I'm used to...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;deploying files&lt;/li&gt;&#xA;&lt;li&gt;checking my config, tweaking as necessary&lt;/li&gt;&#xA;&lt;li&gt;loading a database backup&lt;/li&gt;&#xA;&lt;li&gt;running &quot;Update Asset Indexes&quot; and &quot;Clear Caches&quot; from the control panel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That last step is always important because random oddities and broken images are fixed site-wide because of caching and transforms. Now I'm attempting to automate the process with a Docker deploy script, so I'm wondering: &lt;strong&gt;is there any way to Update Asset Indexes and Clear Caches programmatically?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that you can nuke the &lt;code&gt;craft_assettransformindex&lt;/code&gt; table and delete the contents of &lt;code&gt;/craft/storage/runtime/assets&lt;/code&gt; and &lt;code&gt;/craft/storage/runtime/cache&lt;/code&gt; (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/117/is-there-a-way-to-force-assets-to-redo-transforms/119#119&quot;&gt;related question&lt;/a&gt;), but is that really doing the exact same thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that by &quot;programmatically,&quot; I generally mean anything you could achieve from a Linux terminal: MySQL commands, PHP or shell scripts, etc.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-12-15T22:26:56.677" Title="Is it possible to clear caches and re-index assets programattically?" Tags="&lt;assets&gt;&lt;cache&gt;&lt;image-transforms&gt;&lt;deployment&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2700" PostTypeId="2" ParentId="2699" CreationDate="2014-09-23T20:55:40.873" Score="7" Body="&lt;p&gt;I guess it depends. So, behind the scenes, Craft can have different cache drivers. You might use the db or file cache, or something like Redis or Memcache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Took a peek at ClearCachesTool, and it looks like it's doing the things you mentioned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;truncateTable('assettransformindex');&#xA;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;truncateTable('assetindexdata');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As well as deleting all the internal cache folders (runtime/cache, assets, compiled_templates, temp), including any plugin cache paths that have registered via &lt;strong&gt;registerCachePaths&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;delete(static::$_templateCachesTable);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It also deletes the templates cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess what you're looking for are these:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CacheService-&gt;flush()&lt;/li&gt;&#xA;&lt;li&gt;ClearCachesTool-&gt;performAction() (does most of the clearing)&lt;/li&gt;&#xA;&lt;li&gt;craft()-&gt;templateCache-&gt;deleteAllCaches(); (called in ClearCachesTool - TemplateCacheService)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So yes, you can either bootstrap Craft and call a php file from the commandline, or add a plugin with an action that you GET/POST to after deployment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The former, you can do with the included bootstrap.php file (as of 2.2)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require 'craft/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-23T20:55:40.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2701" PostTypeId="2" ParentId="2696" CreationDate="2014-09-23T20:59:13.677" Score="1" Body="&lt;p&gt;Why don't you do something like this? You can use switch and case to change the output of each part of the matrix (we call them blocks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is part of a snippet to output a documentation matrix that contains code, titles, content etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.documentation %}&#xA;    {% switch block.type %}&#xA;&#xA;         {% case 'subsectionTitle' %}&#xA;            &amp;lt;h2 id=&quot;{{ anchor }}&quot;&amp;gt;{{ block.subsectionTitle }} &amp;lt;a href=&quot;#{{ anchor }}&quot; class=&quot;pound&quot;&amp;gt;#&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% case 'description' %}&#xA;             &amp;lt;div class=&quot;docs-description&quot;&amp;gt;{{ block.description }}&amp;lt;/div&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastEditorUserId="45" LastEditDate="2019-04-01T17:33:08.517" LastActivityDate="2019-04-01T17:33:08.517" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2702" PostTypeId="1" AcceptedAnswerId="2705" CreationDate="2014-09-23T22:23:46.357" Score="1" ViewCount="292" Body="&lt;p&gt;During design/dev I created a bunch of matrix fields that I have since decided not to use. I have deleted the fields, however, I notice that the matrix tables are still in the database. Is it safe to delete these manually, or is there some other cleanup that needs to happen as well (i.e. references within another table, etc.)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; The problem is caused when changing the fieldtype from a matrix field to another field type, rather than deleting the field altogether, and creating a new one. Even if the field is subsequently deleted, the matrix tables will still remain, which results in orphaned data in the DB. &lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-10T13:07:34.870" LastActivityDate="2014-10-10T13:07:34.870" Title="Is it safe to delete unused matrix field tables from the DB?" Tags="&lt;matrix&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2703" PostTypeId="1" CreationDate="2014-09-23T23:31:25.600" Score="2" ViewCount="1543" Body="&lt;p&gt;I have a model with the following functions:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function render() &#xA;{&#xA;    $render = craft()-&amp;gt;templates-&amp;gt;render('myplugin/templates/mymodeltemplate');&#xA;    return $render;&#xA;}&#xA;&#xA;public function __toString()&#xA;{&#xA;    return $this-&amp;gt;render();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Calling &lt;code&gt;__toString()&lt;/code&gt; gives me the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Fatal error: Method Craft\MyModel::__toString() must not throw an exception in /projectpath/craft/app/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found this explanation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://php.net/manual/en/migration52.incompatible.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/migration52.incompatible.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how to work around it and accomplish what I'm trying to do...&lt;/p&gt;&#xA;" OwnerUserId="800" LastEditorUserId="9" LastEditDate="2014-10-09T16:00:35.773" LastActivityDate="2014-10-09T19:32:36.660" Title="PHP error when rendering a template from __toString()" Tags="&lt;templating&gt;&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2704" PostTypeId="2" ParentId="2703" CreationDate="2014-09-23T23:37:50.543" Score="3" Body="&lt;p&gt;In PHP, &lt;em&gt;nothing&lt;/em&gt; can throw an exception inside of a &lt;code&gt;__toString()&lt;/code&gt; method, or else you'll get the error you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not only is that a questionable design decision, it also hides the underlying exception message and stack trace from you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do this, at least you'll be able to log the underlying error and fix that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __toString()&#xA;{&#xA;    try&#xA;    {&#xA;        return $this-&amp;gt;render();&#xA;    }&#xA;    catch (\Exception $e)&#xA;    {&#xA;        Craft::log('ERROR: '.$e-&amp;gt;getMessage(), LogLevel::Error);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can look in your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for &lt;code&gt;[error]&lt;/code&gt; to see the exception message.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-23T23:37:50.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2705" PostTypeId="2" ParentId="2702" CreationDate="2014-09-23T23:39:25.180" Score="2" Body="&lt;p&gt;That shouldn't be the case... Those tables should have been deleted automatically when you deleted the fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did you actually delete the &lt;strong&gt;fields themselves&lt;/strong&gt;? Or did you simply remove them from your section's field layout? Make sure the actual fields were deleted within &lt;strong&gt;Settings &gt; Fields&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you're positive those fields have been properly deleted...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try updating to the latest version of Craft &lt;a href=&quot;http://buildwithcraft.com/updates#build2587&quot; rel=&quot;nofollow&quot;&gt;(v2.2.2587)&lt;/a&gt;, which was released today. It includes this bug fix:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Retroactively fixed a bug where some Matrix block rows would get left behind in the database when an element was deleted that had a Matrix field.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If that doesn't resolve the problem for you, I'd recommend submitting a bug report to Pixel &amp;amp; Tonic. Submit the message via your Dashboard, so you can include a copy of your database and log files.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-23T23:39:25.180" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2706" PostTypeId="1" AcceptedAnswerId="2707" CreationDate="2014-09-24T00:07:54.017" Score="0" ViewCount="207" Body="&lt;p&gt;Since updating to 2.2.2587, anytime I edit an entry by adding a block on certain Matrix fields, it throws the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_text_markdown' cannot be null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems to throw the error if &lt;em&gt;any&lt;/em&gt; of the blocks in that field contain a lightswitch field. It doesn't matter if the block with the lightswitch is actually added to the entry or not. In this case, my Matrix contains two switches, which are off by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throws the error whether the blocks with the switches are present or not… and doesn't seem to matter if I add the blocks with the switches and turn them on or off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="352" LastActivityDate="2014-09-24T00:41:45.223" Title="Craft throwing an SQL error on Save when Matrix field has a lightswitch" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-09-24T04:48:33.390" ContentLicense="CC BY-SA 3.0" />
  <row Id="2707" PostTypeId="2" ParentId="2706" CreationDate="2014-09-24T00:41:45.223" Score="1" Body="&lt;p&gt;Fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2588&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2 build 2588&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-24T00:41:45.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2709" PostTypeId="2" ParentId="2660" CreationDate="2014-09-24T07:13:14.513" Score="-1" Body="&lt;p&gt;If it´s a one-time operation, maybe you could just import everything and search/replace in MySQL?&lt;/p&gt;&#xA;" OwnerUserId="549" LastActivityDate="2014-09-24T07:13:14.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2710" PostTypeId="1" AcceptedAnswerId="2721" CreationDate="2014-09-24T08:50:14.323" Score="3" ViewCount="99" Body="&lt;p&gt;I am trying to upgrade a site from 2.0.2551 to 2.1.2570. I have ~18k entries and ~28 elements. The upgrade process seems to want to save all the elements again as far as I can tell, is there any way to avoid this or make it quicker? Is there some magical SQL I might play with to do it all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present I've had it sat for 14 hours before I gave up...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally I can legitimately reduce the number of entries to about ~3k and the elements to ~11k as I can just re-import those from an API service - I have tried this and it still takes an awfully long time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice or previous similar situations you people have run in to would be most helpful :)&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-09-24T15:25:37.160" Title="How to manage a large database when upgrading from 2.0 to 2.1" Tags="&lt;upgrades&gt;&lt;updating&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2711" PostTypeId="1" AcceptedAnswerId="2717" CreationDate="2014-09-24T09:38:37.523" Score="1" ViewCount="658" Body="&lt;p&gt;I am planning to create a &lt;a href=&quot;http://indiewebcamp.com/micropub&quot; rel=&quot;nofollow&quot;&gt;micropub&lt;/a&gt; plugin so that any micropub client can post to craft, particularly useful for automatic data logging and mobile clients. But I am trying to work out the best way to authenticate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read through the &lt;a href=&quot;https://buildwithcraft.com/classreference/etc/users/UserIdentity&quot; rel=&quot;nofollow&quot;&gt;UserIdentity&lt;/a&gt; docs but I was wondering if anybody has an examples of how to use it correctly?&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-09-24T22:42:39.447" Title="What is the correct way to use UserIdentity?" Tags="&lt;authentication&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2712" PostTypeId="1" CreationDate="2014-09-24T10:21:33.543" Score="2" ViewCount="75" Body="&lt;p&gt;I'm using a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix Field&lt;/a&gt; to display lists of entries. One extracts entries based on certain categories. They may or may not be set, but I need to use an &quot;and&quot; relatedTo parameter. At the moment it uses the default &quot;or&quot; option. Any suggestions on how I can be smarter about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Code is currently as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set country = block.countryCategory %}&#xA;{% set location = block.locationCategory %}&#xA;{% set person = block.personCategory %}&#xA;{% set role = block.roleCategory %}&#xA;&#xA;{% set categories = craft.categories.group(block.category).relatedTo(country, location, person, role).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="823" LastEditorUserId="142" LastEditDate="2014-09-26T16:26:31.580" LastActivityDate="2014-09-26T16:26:31.580" Title="Showing entries based on parameters that may or may not be populated" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2014-09-28T20:19:55.397" ContentLicense="CC BY-SA 3.0" />
  <row Id="2713" PostTypeId="1" AcceptedAnswerId="2720" CreationDate="2014-09-24T10:57:04.610" Score="3" ViewCount="502" Body="&lt;p&gt;I can't edit my entries. The entry page has no input fields. See attachtment&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lNX7O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I run the latest Craft version. Cleared the cache, tried different browsers.&#xA;No errors in my console. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like that no javascript file is loaded on the page. &lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="142" LastEditDate="2014-09-24T14:42:40.993" LastActivityDate="2016-01-29T01:39:45.290" Title="Blank entry input page" Tags="&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2714" PostTypeId="2" ParentId="2711" CreationDate="2014-09-24T11:04:56.943" Score="2" Body="&lt;p&gt;What about setting up a relation between your CustomUserAuthModel and the UserModel, check if everything is alright through your plugin with IndieAuth, and then login, through UserSessionService-&gt;impersonate()?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The new user session will only last as long as the browser session remains active; no identity cookie will be * created.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if that will work for you, but might be worth a try?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-24T11:04:56.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2716" PostTypeId="1" AcceptedAnswerId="2751" CreationDate="2014-09-24T11:56:53.393" Score="6" ViewCount="2257" Body="&lt;p&gt;Is there any vcl file to use with Craft? I saw &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2/how-do-i-configure-varnish-to-work-with-craft&quot;&gt;here&lt;/a&gt; an amazing answer about Varnish and Craft and there is a 3.x configuration file but i need a newer one for Varnish 4 and i don’t know Varnish Configuration Language to port it myself&lt;/p&gt;&#xA;" OwnerUserId="435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-17T22:16:43.977" Title="Varnish 4.x and Craft" Tags="&lt;cache&gt;&lt;varnish&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2717" PostTypeId="2" ParentId="2711" CreationDate="2014-09-24T13:00:12.847" Score="4" Body="&lt;p&gt;The basic user identity relies on login and password, so you will have to create your own class to represent an identity based on something else, like a token for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class TokenIdentity extends UserIdentity&#xA;{&#xA;    private $_id;&#xA;    public $token;&#xA;&#xA;    public function __construct($token)&#xA;    {&#xA;        $this-&amp;gt;token = $token;&#xA;    }&#xA;&#xA;    public function authenticate()&#xA;    {&#xA;        $socialUser = craft()-&amp;gt;social-&amp;gt;getUserByEncodedToken($this-&amp;gt;token);&#xA;&#xA;        if($socialUser) {&#xA;            $this-&amp;gt;_id = $socialUser-&amp;gt;user-&amp;gt;id;&#xA;            $this-&amp;gt;username = $socialUser-&amp;gt;user-&amp;gt;username;&#xA;            $this-&amp;gt;errorCode = static::ERROR_NONE;&#xA;&#xA;            return true;&#xA;        } else {&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    public function getId()&#xA;    {&#xA;        return $this-&amp;gt;_id;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll need to create your own user session service to be able to authenticate the user (with a token for example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Social_UserSessionService extends UserSessionService {&#xA;&#xA;    private $_identity;&#xA;    public $allowAutoLogin = true;&#xA;&#xA;    public function init()&#xA;    {&#xA;        $this-&amp;gt;setStateKeyPrefix(md5('Yii.Craft\UserSessionService.'.craft()-&amp;gt;getId()));&#xA;&#xA;        parent::init();&#xA;    }&#xA;&#xA;    public function login(Oauth_TokenModel $token)&#xA;    {&#xA;        $rememberMe = true;&#xA;&#xA;        $this-&amp;gt;_identity = new TokenIdentity($token-&amp;gt;encodedToken);&#xA;        $this-&amp;gt;_identity-&amp;gt;authenticate();&#xA;&#xA;        // Was the login successful?&#xA;        if ($this-&amp;gt;_identity-&amp;gt;errorCode == TokenIdentity::ERROR_NONE)&#xA;        {&#xA;            // Get how long this session is supposed to last.&#xA;&#xA;            $this-&amp;gt;authTimeout = craft()-&amp;gt;config-&amp;gt;getUserSessionDuration($rememberMe);&#xA;&#xA;            $id = $this-&amp;gt;_identity-&amp;gt;getId();&#xA;&#xA;            $user = craft()-&amp;gt;users-&amp;gt;getUserById($id);&#xA;&#xA;            $states = $this-&amp;gt;_identity-&amp;gt;getPersistentStates();&#xA;&#xA;&#xA;            // Run any before login logic.&#xA;            if ($this-&amp;gt;beforeLogin($id, $states, false))&#xA;            {&#xA;                // Fire an 'onBeforeLogin' event&#xA;                $this-&amp;gt;onBeforeLogin(new Event($this, array(&#xA;                    'username'      =&amp;gt; $user-&amp;gt;username,&#xA;                )));&#xA;&#xA;                $this-&amp;gt;changeIdentity($id, $this-&amp;gt;_identity-&amp;gt;getName(), $states);&#xA;&#xA;                // Fire an 'onLogin' event&#xA;                $this-&amp;gt;onLogin(new Event($this, array(&#xA;                    'username'      =&amp;gt; $user-&amp;gt;username,&#xA;                )));&#xA;&#xA;                if ($this-&amp;gt;authTimeout)&#xA;                {&#xA;                    if ($this-&amp;gt;allowAutoLogin)&#xA;                    {&#xA;                        if ($user)&#xA;                        {&#xA;                            // Save the necessary info to the identity cookie.&#xA;                            $sessionToken = StringHelper::UUID();&#xA;                            $hashedToken = craft()-&amp;gt;security-&amp;gt;hashData(base64_encode(serialize($sessionToken)));&#xA;                            $uid = craft()-&amp;gt;users-&amp;gt;handleSuccessfulLogin($user, $hashedToken);&#xA;&#xA;                            $data = array(&#xA;                                $this-&amp;gt;getName(),&#xA;                                $sessionToken,&#xA;                                $uid,&#xA;                                ($rememberMe ? 1 : 0),&#xA;                                craft()-&amp;gt;request-&amp;gt;getUserAgent(),&#xA;                                $this-&amp;gt;saveIdentityStates(),&#xA;                            );&#xA;&#xA;                            $this-&amp;gt;saveCookie('', $data, $this-&amp;gt;authTimeout);&#xA;                        }&#xA;                        else&#xA;                        {&#xA;                            throw new Exception(Craft::t('Could not find a user with Id of {userId}.', array('{userId}' =&amp;gt; $this-&amp;gt;getId())));&#xA;                        }&#xA;                    }&#xA;                    else&#xA;                    {&#xA;                        throw new Exception(Craft::t('{class}.allowAutoLogin must be set true in order to use cookie-based authentication.', array('{class}' =&amp;gt; get_class($this))));&#xA;                    }&#xA;                }&#xA;&#xA;                $this-&amp;gt;afterLogin(false);&#xA;            }&#xA;&#xA;            return !$this-&amp;gt;getIsGuest();&#xA;        }&#xA;&#xA;        Craft::log('Tried to log in unsuccessfully.', LogLevel::Warning);&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code comes from a plugin which is still under development so don't take for granted it's all secure or the best way to achieve this, but hopefully it will help you get started !&lt;/p&gt;&#xA;" OwnerUserId="164" LastEditorUserId="164" LastEditDate="2014-09-24T22:42:39.447" LastActivityDate="2014-09-24T22:42:39.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2719" PostTypeId="1" AcceptedAnswerId="2727" CreationDate="2014-09-24T13:53:12.863" Score="1" ViewCount="75" Body="&lt;p&gt;An auto update went awry. I lost Internet connection towards the end of the update. Each widget now appears on its own row. Everything else looks ok on the front end as well as the admin. When I check for updates, it says I'm up to date. Does anyone have any suggestions as to which files I should update to fix this issue?&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2014-09-24T18:48:38.553" Title="Dashboard grid layout broken after an auto update gone wrong" Tags="&lt;auto-updates&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2720" PostTypeId="2" ParentId="2713" CreationDate="2014-09-24T14:39:45.290" Score="4" Body="&lt;p&gt;Usually when you see this, PHP is running out of memory trying to load the page.  Bump your php.ini file's &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; setting to something higher and that should fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, this is in your phperrors.log file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[23-Sep-2014 15:11:20 UTC] PHP Fatal error:  Maximum function nesting level of '100' reached, aborting!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1559/why-are-some-entry-detail-views-empty-in-the-control-panel&quot;&gt;here&lt;/a&gt; for the fix.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-24T14:49:10.367" LastActivityDate="2014-09-24T14:49:10.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2721" PostTypeId="2" ParentId="2710" CreationDate="2014-09-24T15:25:37.160" Score="5" Body="&lt;p&gt;In my specific case - upgrading from 2.0.2551 to 2.1.2570 - the issue was caused by there being millions of rows in the &lt;code&gt;craft_entryversions&lt;/code&gt; table. One of the migrations in the update needed to loop through every row in that table and do something to it and therefore it took ages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply emptying that table solved the upgrade process for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Caveats&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this deletes all your entry versions...so, each entry will just exist at its last known 'live' state. This wasn't a problem for me - but might be for you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its worth noting that this shouldn't affect any drafts users might have made as they are stored in a separate &lt;code&gt;craft_entrydrafts&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to Fred Carlsen for helping me think aloud...&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-09-24T15:25:37.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2722" PostTypeId="1" AcceptedAnswerId="2732" CreationDate="2014-09-24T16:52:40.277" Score="4" ViewCount="269" Body="&lt;p&gt;I'm trying to get all entries that related to one .. three categories, as determined whether their id appears in the query string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sector = craft.categories.id(craft.request.getQuery('sector')) %}&#xA;{% set impact = craft.categories.id(craft.request.getQuery('impact')) %}&#xA;{% set topic = craft.categories.id(craft.request.getQuery('topic')) %}&#xA;&#xA;{% for post in craft.entries.section(section).relatedTo('and', sector, impact, topic) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works well if each of sector, impact, and topic are present, but will return nothing if any one of sector, impact, topic is null (i.e. getQuery('') is blank). Can anyone suggest a way I can do this?&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2014-09-26T16:31:46.503" Title="Getting entries related to all of supplied categories, if they exist" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2723" PostTypeId="1" AcceptedAnswerId="2724" CreationDate="2014-09-24T17:04:46.987" Score="2" ViewCount="1060" Body="&lt;p&gt;Having issues getting Craft to use a transform I set in the CP: &lt;code&gt;squarePhoto&lt;/code&gt;. I keep getting a template error, even though that transform exist.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;squarePhoto&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The template code in question is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in block.photoImages %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl(squarePhoto) }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After digging through other threads, I saw that Craft adds a subfolder to the directory with the transform name–this has not been generated. What am I missing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also added the config var &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&lt;/code&gt; to my general.php to see if that made a difference.&lt;/p&gt;&#xA;" OwnerUserId="202" LastActivityDate="2014-09-24T17:19:46.447" Title="Transforms not working" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2724" PostTypeId="2" ParentId="2723" CreationDate="2014-09-24T17:19:46.447" Score="6" Body="&lt;p&gt;It's a very subtle difference, but what you have added there is a variable, when what you are looking for is a string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl('squarePhoto') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your current way would be correct if you had set a variable somewhere with the name of squarePhoto, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set squarePhoto = 'transformName' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer&quot;&gt;Twig Primer&lt;/a&gt; in the Craft docs.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-24T17:19:46.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2725" PostTypeId="1" CreationDate="2014-09-24T18:25:38.233" Score="1" ViewCount="547" Body="&lt;p&gt;I switched my craft install to be completely served over SSL. The front end continued working fine, but the backend is 404'ing all static assets. I assume this is because the http was handling the /admin/resources/ rule fine but not the https. I'm using NGINX but am using the exact same config that I was before, just adding in my SSL Certificate keys. Any thoughts on config settings to look at or lines of code to investigate?&lt;/p&gt;&#xA;" OwnerUserId="488" LastActivityDate="2014-09-24T18:46:45.097" Title="Admin assets not being served over https" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2726" PostTypeId="2" ParentId="2725" CreationDate="2014-09-24T18:46:45.097" Score="3" Body="&lt;p&gt;So I added the following lines to my nginx file and it all worked&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;}&#xA;&#xA;location ~* \.(?:css|js)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="488" LastActivityDate="2014-09-24T18:46:45.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2727" PostTypeId="2" ParentId="2719" CreationDate="2014-09-24T18:48:38.553" Score="0" Body="&lt;p&gt;Try clearing your browser cache. (Your browser might be holding onto a stylesheet or something from the previous version.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-09-24T18:48:38.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2728" PostTypeId="1" CreationDate="2014-09-24T20:53:17.487" Score="0" ViewCount="517" Body="&lt;p&gt;I posted this on github already but I thought I would ask her as well to see if anyone has any ideas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying ot do a simple import of some organizations with categories and parent organization&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the CSV&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/irh8cno9eh536su/testImport.csv?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/irh8cno9eh536su/testImport.csv?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything goes in (including the parent which is an entry field and works great) but the categories always end up blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what might be wrong?  The importer isnt showing any errors.&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-02-20T01:34:14.453" Title="Import Entries with Categories" Tags="&lt;categories&gt;&lt;import&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2729" PostTypeId="1" AcceptedAnswerId="2738" CreationDate="2014-09-24T22:09:36.810" Score="1" ViewCount="114" Body="&lt;p&gt;With multiple locales setup when you toggle a specific locale off in the control panel for that entry, does the entry not show or will the output show the default locale content?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-09-25T08:12:25.580" Title="Does the default local content show when you toggle another locale/s off?" Tags="&lt;templating&gt;&lt;localization&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2730" PostTypeId="2" ParentId="2022" CreationDate="2014-09-24T23:09:16.333" Score="2" Body="&lt;p&gt;Hope that its not too late. I would not use paypal. Use stripe instead. You can then redirect the user to the Charge plugin by Squarebit.co.uk after the entry has posted. Once payment is made, change the status of your entry to enabled. Much cleaner and stripe is easier to work with.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-24T23:09:16.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2731" PostTypeId="1" AcceptedAnswerId="2982" CreationDate="2014-09-24T23:28:29.160" Score="4" ViewCount="1526" Body="&lt;p&gt;Every minute or so I get the &quot;Your session has ended&quot; popup in the admin. Entering my password just pops the message back up. If I reload the page I'm still logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft in vagrant so maybe it's a permissions problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could be related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area&quot;&gt;this question&lt;/a&gt; since I had that exact problem but setting the permissions in vagrant fixed that particular problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the requireUserAgentAndIpForSession, overridePHPSessionLocation, and userSessionDuration config settings, but none of them seem to solve the popup.&lt;/p&gt;&#xA;" OwnerUserId="824" LastActivityDate="2015-01-30T14:34:09.060" Title="Getting &quot;Session Ended&quot; popup in admin" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;config&gt;&lt;error-message&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2732" PostTypeId="2" ParentId="2722" CreationDate="2014-09-25T00:07:24.360" Score="5" Body="&lt;p&gt;Completely untested, but try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = [] %}&#xA;&#xA;{% if craft.request.getQuery('sector') %}&#xA;    {% set ids = ids|merge([craft.request.getQuery('sector')]) %}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.getQuery('impact') %}&#xA;    {% set ids = ids|merge([craft.request.getQuery('impact')]) %}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.getQuery('topic') %}&#xA;    {% set ids = ids|merge([craft.request.getQuery('topic')]) %}&#xA;{% endif %}&#xA;&#xA;{% if ids|length %}&#xA;&#xA;    {% for post in craft.entries.section(section).relatedTo('and', ids|join(',')) %}&#xA;        ....&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2014-09-26T16:31:46.503" LastActivityDate="2014-09-26T16:31:46.503" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2733" PostTypeId="1" AcceptedAnswerId="2734" CreationDate="2014-09-25T03:57:27.277" Score="5" ViewCount="2505" Body="&lt;p&gt;I notice in the template examples that &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;account&lt;/code&gt; and &lt;code&gt;currentUser&lt;/code&gt; are all being used, but not seeing clear documentation on these. Can someone perhaps explain the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;User Registration Form&lt;/a&gt; uses &lt;code&gt;{{ account.username }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;User Profile Form&lt;/a&gt; uses &lt;code&gt;{{ user.username }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and there is a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables&quot; rel=&quot;nofollow&quot;&gt;Global Variable&lt;/a&gt; called &lt;code&gt;{{ currentUser.username }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that &lt;code&gt;user&lt;/code&gt; is perhaps just an alias to &lt;code&gt;currentUser&lt;/code&gt; (unless explicitly defined otherwise)? And that &lt;code&gt;account&lt;/code&gt; is something that is used exclusively for &lt;code&gt;user/saveUser&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I ask is that I'm creating edit profile pages, and want to make sure they are secure. Seems like just using &lt;code&gt;user&lt;/code&gt; is enough, as that appears to always be populated correctly with the &lt;code&gt;currentUser&lt;/code&gt; data; and if not logged-in it redirects to the log-in page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="4466" LastEditDate="2016-08-26T09:24:59.473" LastActivityDate="2020-10-22T22:30:44.470" Title="What's the difference between 'user', 'currentUser', and 'account'?" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2734" PostTypeId="2" ParentId="2733" CreationDate="2014-09-25T04:55:44.327" Score="9" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As of Craft 3.x, the deprecated &lt;code&gt;user&lt;/code&gt; variable no longer works. Make sure to use the proper &lt;code&gt;currentUser&lt;/code&gt; variable instead!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Original:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;user&lt;/code&gt; and &lt;code&gt;currentUser&lt;/code&gt; are exactly the same. They contain the UserModel of the &lt;strong&gt;currently logged in user&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why are they exactly the same? Originally, &lt;code&gt;user&lt;/code&gt; was the preset value for the current user. However, there were many cases of people &lt;em&gt;manually&lt;/em&gt; setting a value for &lt;code&gt;user&lt;/code&gt; (often in the context of a &lt;code&gt;for&lt;/code&gt; loop through a group of users), and therefore overwriting the preset value. So P&amp;amp;T introduced &lt;code&gt;currentUser&lt;/code&gt; as an alias which was much less likely to be overwritten.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;account&lt;/code&gt; will only exist on the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Registration Form&lt;/a&gt;. Its value is automatically set when the form is submitted. &lt;code&gt;account&lt;/code&gt; represents the values entered during the attempted registration (whether the registration was successful or not).&lt;/p&gt;&#xA;&lt;p&gt;For the sake of your Edit Profile pages, you'll want to use &lt;code&gt;currentUser&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2020-10-22T22:30:44.470" LastActivityDate="2020-10-22T22:30:44.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2735" PostTypeId="2" ParentId="2731" CreationDate="2014-09-25T05:32:25.373" Score="2" Body="&lt;p&gt;Try deleting your entire &lt;code&gt;craft/storage/runtime&lt;/code&gt; folder. If something got out of sync with your session data, this will allow it to &quot;start from scratch&quot;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-25T05:32:25.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2736" PostTypeId="2" ParentId="1855" CreationDate="2014-09-25T07:14:41.250" Score="0" Body="&lt;p&gt;Turns out that this was a bug and a patch was duly applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the patch Brad.&lt;/p&gt;&#xA;" OwnerUserId="662" LastActivityDate="2014-09-25T07:14:41.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2737" PostTypeId="2" ParentId="2692" CreationDate="2014-09-25T07:54:52.187" Score="5" Body="&lt;p&gt;You can't do this using the &lt;em&gt;craft.entries&lt;/em&gt; tag in twig. You'll need to create a new function in your plugin that returns the entries in your custom order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you can create an array of element ids in your custom order then the following code should allow you to then fetch entries in that order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;// filter entries by element ids&#xA;$criteria-&amp;gt;setAttribute('id', $elementIds);&#xA;&#xA;// order entries by element ids&#xA;$criteria-&amp;gt;setAttribute('order', 'FIELD(elements.id, '.join(', ', $elementIds).')');&#xA;&#xA;// get entries&#xA;$entries = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-09-25T07:54:52.187" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2738" PostTypeId="2" ParentId="2729" CreationDate="2014-09-25T08:12:25.580" Score="2" Body="&lt;p&gt;If you toggle off a locale for an entry, that entry will not show in that locale. So, if you have a section &lt;code&gt;news&lt;/code&gt;, toggle off the entry &lt;code&gt;my-entry&lt;/code&gt; in your current locale, and use &lt;code&gt;craft.entries.section('news')&lt;/code&gt; to get all entries, &lt;code&gt;my-entry&lt;/code&gt; will not be in that list.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-25T08:12:25.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2739" PostTypeId="1" CreationDate="2014-09-25T08:29:52.810" Score="0" ViewCount="99" Body="&lt;p&gt;I have a plugin the imports data from an external database. This is more of a onetime action. But what I've noticed is that when this process runs, I cannot do anything in the admin section anymore. (and its not CPU or apache blocking) All my other requests (on other tabs) are blocked until the long running process is done. Is this normal behaviour? If so,can that be changed with config settings? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="571" LastEditorUserId="142" LastEditDate="2014-09-25T14:37:01.590" LastActivityDate="2014-10-22T18:50:39.990" Title="Concurrent actions in admin" Tags="&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2740" PostTypeId="1" CreationDate="2014-09-25T09:15:00.293" Score="1" ViewCount="1176" Body="&lt;p&gt;I've been using xampp for a long time and have never encountered a 403 error. I have many projects in my xampp/htdocs/ folder, none of them have ever had any problems until now. &lt;strong&gt;I have the craft files in a /craft folder inside htdocs but any time I try to visit files within this directory I am met with the 403 error.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been searching a solution for hours now, I edited &lt;strong&gt;httpd-vhosts.conf&lt;/strong&gt; with the following but it didn't help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory &quot;C:/xampp/xampp/craft/&quot;&amp;gt;&#xA;    Options Indexes FollowSymLinks MultiViews&#xA;    AllowOverride all&#xA;    Order Deny,Allow&#xA;    Allow from all&#xA;    Require all granted&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, no other folders within my htdocs directory has ever had any 403 errors. Anyone got a clue as to what is causing this and how to solve it?&lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="22" LastEditDate="2017-05-10T00:21:12.883" LastActivityDate="2017-05-10T00:21:12.883" Title="Craft directory 403 Access Forbidden with XAMPP" Tags="&lt;install&gt;&lt;installation&gt;&lt;environments&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2741" PostTypeId="1" AcceptedAnswerId="2742" CreationDate="2014-09-25T10:28:51.960" Score="0" ViewCount="3887" Body="&lt;p&gt;I think I might be missing something here but it seems twig tags aren't parsed within  tags? Is there any way they can be, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;var homepageStandfirstAnchors = [&amp;lt;% for anchor in homepage.homepageStandfirstAnchors %&amp;gt;[{{ anchor.text }},{{ anchor.section.handle }},{{ anchor.anchorLink }}],&amp;lt;% endfor %&amp;gt;];&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't work as expected.&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2014-09-25T10:36:55.680" Title="Twig templating within &lt;script&gt; tag" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2742" PostTypeId="2" ParentId="2741" CreationDate="2014-09-25T10:36:55.680" Score="1" Body="&lt;p&gt;It appears to be due to the angle brackets. Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    var homepageStandfirstAnchors = [{% for anchor in homepage.homepageStandfirstAnchors %}[{{ anchor.text }},{{ anchor.section.handle }},{{ anchor.anchorLink }}],{% endfor %}];&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-09-25T10:36:55.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2743" PostTypeId="1" AcceptedAnswerId="2744" CreationDate="2014-09-25T12:27:44.160" Score="5" ViewCount="962" Body="&lt;p&gt;Is it possible to output the path to a given section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this to define the section model for the contact page (a single):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contactPage = craft.entries.section('contact') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then, there doesn't seem to be a way to get the url from this model (according to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel&quot; rel=&quot;noreferrer&quot;&gt;section model page&lt;/a&gt; on the Craft website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this information does exist as on the backend there's a link to the Contact page next to the link to edit the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2014-09-25T12:45:41.530" Title="Output URL to section" Tags="&lt;url&gt;&lt;sections&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2744" PostTypeId="2" ParentId="2743" CreationDate="2014-09-25T12:45:41.530" Score="6" Body="&lt;p&gt;The url's are always bound to entries. And with your current code, you're getting all &lt;strong&gt;entries&lt;/strong&gt; in the 'contact' section, not the section itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if this is a single, what you want is the url of the entry in the 'contact' section. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contactPage = craft.entries.section('contact').first() %}&#xA;{{ contactPage.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-25T12:45:41.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2745" PostTypeId="2" ParentId="2740" CreationDate="2014-09-25T13:00:46.003" Score="2" Body="&lt;p&gt;That’s a good thing - you definitely &lt;strong&gt;don’t&lt;/strong&gt; want to allow direct HTTP traffic to your craft/ folder, as people would be able to access your config settings, license key, and plenty of other sensitive data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s a .htaccess file inside your craft/ folder with &lt;code&gt;Deny from all&lt;/code&gt; in it, which is what is responsible for that 403 error you’re getting. Keep it in there!&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-25T13:00:46.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2746" PostTypeId="1" AcceptedAnswerId="2755" CreationDate="2014-09-25T13:27:12.340" Score="0" ViewCount="154" Body="&lt;p&gt;I have a Single that includes a matrix as a field. The matrix has an internal date field. Is there a way to sort the matrix blocks by the date field on the admin side to help manage the blocks?&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2014-09-25T17:12:41.210" Title="Sort matrix blocks in admin by a field within the matrix?" Tags="&lt;matrix&gt;&lt;sorting&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2747" PostTypeId="1" CreationDate="2014-09-25T14:10:58.430" Score="6" ViewCount="1036" Body="&lt;p&gt;I want to be able to return all entries that are related to 1 .. n categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries.section('resources').relatedTo('and', categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in this example, categories contains two categories category1 and category2, and the query returns all entries that have either &lt;strong&gt;category1&lt;/strong&gt; or &lt;strong&gt;category2&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I change the syntax to return entries that are related to &lt;em&gt;both&lt;/em&gt; &lt;strong&gt;category1&lt;/strong&gt; &lt;em&gt;and&lt;/em&gt; &lt;strong&gt;category2&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought 'and' would do it, but seemingly not.&lt;/p&gt;&#xA;" OwnerUserId="161" LastEditorUserId="57" LastEditDate="2014-09-25T14:37:55.697" LastActivityDate="2015-11-11T20:23:59.553" Title="Perform &quot;inclusive&quot; relatedTo query with multiple categories" Tags="&lt;templating&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2748" PostTypeId="2" ParentId="2739" CreationDate="2014-09-25T14:43:31.960" Score="0" Body="&lt;p&gt;Well, &lt;em&gt;something&lt;/em&gt; is blocking it... CPU, Apache, MySQL, PHP, disk I/O, etc.  You can debug that or have your plugin perform it's actions in small batches or over multiple AJAX requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not much that Craft can do to help what you're seeing, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-25T14:43:31.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2749" PostTypeId="1" AcceptedAnswerId="2750" CreationDate="2014-09-25T14:47:38.247" Score="3" ViewCount="883" Body="&lt;p&gt;Ok, so basically I want to loop through categories and output the title of each category along with all the associated entries. Like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category 1:&lt;/strong&gt; Entry 1 Title, Entry 3 Title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category 2:&lt;/strong&gt; Entry 2 Title, Entry 4 Title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Where entry 1 and 3 are category 1 - and entry 2 and 4 are category 2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was the closest I got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set categories = craft.categories.group('jobCategories').find() %}&#xA;&#xA;        {% for category in categories %}&#xA;&#xA;            &amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;            {% for entry in craft.entries.section('people').relatedTo(category).find() %}&#xA;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                     {{ entry.title }}&#xA;                &amp;lt;/a&amp;gt;&#xA;&#xA;            {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="451" LastEditorUserId="451" LastEditDate="2014-09-25T15:05:06.017" LastActivityDate="2014-09-25T17:32:54.220" Title="How do I output entries by their category?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2750" PostTypeId="2" ParentId="2749" CreationDate="2014-09-25T15:14:40.447" Score="8" Body="&lt;p&gt;It might be quicker to turn it around: first get all the entries you need, then group those by their category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('people').find() %}&#xA;&#xA;{% for category, catEntries in entries | group('categoryFieldHandle.first().title') %}&#xA;    &amp;lt;h1&amp;gt;{{ category }}&amp;lt;/h1&amp;gt;&#xA;    {% for entry in catEntries %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-09-25T17:32:54.220" LastActivityDate="2014-09-25T17:32:54.220" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2751" PostTypeId="2" ParentId="2716" CreationDate="2014-09-25T15:35:24.563" Score="10" Body="&lt;p&gt;I'm by no means a Varnish pro, but I'm currently working on a project where we're running Varnish 4.0 in front of our nginx servers. I've uploaded an example of our VCL 4.0 file &lt;a href=&quot;https://gist.github.com/aelvan/eba03969f91c1bd51c40&quot; rel=&quot;nofollow&quot;&gt;in this gist&lt;/a&gt;. It is based on the &lt;a href=&quot;https://github.com/mattiasgeniar/varnish-4.0-configuration-templates&quot; rel=&quot;nofollow&quot;&gt;Varnish 4.0 template made by Mattias Geniar&lt;/a&gt; with some adjustments for Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is NOT an exact port of the 3.x file you're referencing, so it's important to understand what it does. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, the 3.x file sets the ttl of cacheable requests in the VCL. Not sure if this is because it's harder to set the correct headers in ExpressionEngine, but I prefer to leave this to the backend server. If you don't set expire headers in your templates your pages won't be cached. To set a page to expire in 7 days you add this to your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expiry = now|date_modify('+7 days') %}&#xA;{% header &quot;Cache-Control: max-age=&quot; ~ (expiry.timestamp - now.timestamp) %}&#xA;{% header &quot;Pragma: cache&quot; %}&#xA;{% header &quot;Expires: &quot; ~ expiry.rfc1123() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can add all kinds of logic to this, setting different cache duration based on entry section, entry age, custom fields, or whatever. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the 3.0 example file, all asset folders (like /scripts, /assets/, /files, etc) are excluded from caching. This is probably a good idea in most cases, see the comments from the original 4.0 template regarding this. But, in my project all content files are uploaded to Amazon S3, so the only assets served by nginx is css, js, font files, and some small assets. I've opted to just let Varnish handle everything for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm taking a heavy handed approach to cookies, because I don't need them, and I had some problems removing the Craft ones. I've left in some of the original stuff from the template, mostly for reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All requests to the Craft admin is passed on to the backend server. I had some issues with just excluding /admin, because the control panel sometimes add index.php to the url, so I'm excluding everything that contains &lt;code&gt;/admin&lt;/code&gt; or &lt;code&gt;p=admin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, this might not be a perfect VCL file, but it seems to work fine. Running Varnish on a DigitalOcean 1GB/1CPU droplet, I've cut the response time on my test page from ~1.5s (unoptimized/uncached template with a lot of matrix going on) to 40ms. Static tests with ApacheBench within the local network shows Varnish delivering ~900 requests/sec. Pretty awesome, me thinks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But comments and fixes are greatly appreciated. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also working on a Craft plugin for purging URLs when entries are changed, but it's not working very well at the moment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;br&gt;&#xA;My Varnish Purge plugin is now available &lt;a href=&quot;https://github.com/aelvan/VarnishPurge-Craft&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Also, check out Josh Angell's CacheMonster plugin &lt;a href=&quot;https://github.com/supercool/Cache-Monster&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for a different take on the same problem.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-10-17T22:16:43.977" LastActivityDate="2015-10-17T22:16:43.977" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2752" PostTypeId="1" AcceptedAnswerId="2756" CreationDate="2014-09-25T15:37:03.300" Score="0" ViewCount="203" Body="&lt;p&gt;I have the following code and after moving site to a live server, the img src is using the old domain, however, the anchor links have correct domain name.  Any idea what the issue is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                {% for block in entry.threeHomepageImages.type('images') %}&#xA;                                    &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;                                        &amp;lt;div class=&quot;image-block&quot;&amp;gt;&#xA;                                            &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                                                {% if block.image|length %}&#xA;                                                    &amp;lt;a href=&quot;{{ block.pageLink.first().getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ block.image.first.getUrl() }}&quot; alt=&quot;{{ block.alt }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                                                {% endif %}&#xA;                                            &amp;lt;/div&amp;gt;&#xA;                                        &amp;lt;/div&amp;gt;&#xA;                                        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ block.pageLink.first().getUrl() }}&quot;&amp;gt;{{ block.imageTitle }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastActivityDate="2014-09-25T17:39:04.777" Title="getUrl using my original develpment server domain" Tags="&lt;templating&gt;&lt;url&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2753" PostTypeId="1" CreationDate="2014-09-25T16:07:17.240" Score="2" ViewCount="4144" Body="&lt;p&gt;I'm 5 minutes new to Craft and G&amp;amp;T, but my client needs GA installed on their new site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts about how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, general SEO questions: are there SEO plugins a la wordpress that you guys can point me to?&lt;/p&gt;&#xA;" OwnerUserId="833" LastEditorUserId="45" LastEditDate="2017-08-01T16:23:40.027" LastActivityDate="2017-08-01T16:50:05.520" Title="Adding Google Analytics Code" Tags="&lt;plugins&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2754" PostTypeId="2" ParentId="2753" CreationDate="2014-09-25T17:02:17.687" Score="5" Body="&lt;p&gt;Installing GA is easy... you can either &lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;nofollow noreferrer&quot;&gt;put that info into a Global field&lt;/a&gt;, or &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;include it as a separate Twig template&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for general SEO... Check out the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt; or the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO plugin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-08-01T16:22:58.237" LastActivityDate="2017-08-01T16:22:58.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2755" PostTypeId="2" ParentId="2746" CreationDate="2014-09-25T17:12:41.210" Score="4" Body="&lt;p&gt;There is nothing that will automatically sort blocks for you in the Control Panel. Without writing a plugin with some very fancy JavaScript, the only way to arrange blocks is &lt;strong&gt;manually&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can manually arrange your blocks by clicking &amp;amp; dragging the crosshairs in the upper-right corner of each block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IF7Nq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-25T17:12:41.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2756" PostTypeId="2" ParentId="2752" CreationDate="2014-09-25T17:39:04.777" Score="3" Body="&lt;p&gt;Have you checked the path of the asset source the image is in? Sounds like that might still be the old server's path.&#xA;Best practice is to use &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;Environment-specific variables&lt;/a&gt; in your config file, and then use those in you Asset Source settings as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, use {basePath}assets/site as your File System Path for instance (if you've used basePath as a config variable). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, it will adapt to whatever environment you're working on.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-09-25T17:39:04.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2757" PostTypeId="1" AcceptedAnswerId="2758" CreationDate="2014-09-25T22:25:39.410" Score="1" ViewCount="256" Body="&lt;p&gt;Is there a way to return a user model entry, userid, or some other identifier (and/or variables in general) from a successful registration form submission using the hidden redirect parameter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the docs for &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;action/saveUser&lt;/a&gt; I see some mention of {id} in the redirect string, but I'm not exactly sure sure how this works (or if it's even related).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      if (isset($_POST['redirect']) &amp;amp;&amp;amp; mb_strpos($_POST['redirect'], '{userId}') !== false)&#xA;      {&#xA;           craft()-&amp;gt;deprecator-&amp;gt;log('UsersController::saveUser():userId_redirect', 'The {userId} token within the ‘redirect’ param on users/saveUser requests has been deprecated. Use {id} instead.');&#xA;           $_POST['redirect'] = str_replace('{userId}', '{id}', $_POST['redirect']);&#xA;      }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason I ask is that I am creating a multipart form that relies on the values of the previous form submission to continue (starting with user account registration). I essentially want to redirect back to the form, fill out the next part, submit, redirect back to form, fill out next, etc. (controlling the workflow with javascript or twig). FYI, using &lt;code&gt;impersonate()&lt;/code&gt; will not work for me in this case, because user must be admin, or in a custom 'manager' group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side question, I also see &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('User saved.'));&lt;/code&gt; used throughout the saveUser controller. Is there a corresponding &lt;code&gt;getNotices()&lt;/code&gt; similar to &lt;code&gt;getErrors()&lt;/code&gt; or some way to retrieve these on the front-end?&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-09-25T22:57:45.147" Title="Is it possible to return a User Model Entry or userid from a successful registration form submission?" Tags="&lt;form&gt;&lt;variable&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2758" PostTypeId="2" ParentId="2757" CreationDate="2014-09-25T22:57:45.147" Score="1" Body="&lt;p&gt;In your &lt;code&gt;redirect&lt;/code&gt; hidden input in your form, add an &lt;code&gt;{id}&lt;/code&gt; tag like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;nextStep/{id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that will be populated with the newly created user's userId.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a corresponding getNotices() similar to getErrors() or some way to retrieve these on the front-end?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'd have to duplicate the code that the control panel uses to retrieve the notices on the front-end of the site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-25T22:57:45.147" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2759" PostTypeId="1" AcceptedAnswerId="2760" CreationDate="2014-09-26T02:42:06.247" Score="6" ViewCount="3296" Body="&lt;p&gt;I'm trying to use &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/encode-email/docs/getting-started/introductio&quot;&gt;the Encode Email plugin&lt;/a&gt; to encode email addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email addresses are dynamic so I need to include the output from the database when I'm using set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is their example that doesn't use dynamic info:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email = &quot;&amp;lt;a href='mailto:you@example.com'&amp;gt;Your Name&amp;lt;/a&amp;gt;&quot; %}&#xA;{{ email | rot13 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is what I've tried that doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email = &quot;&amp;lt;a href='mailto:{{ contactInfo.contactEmail }}'&amp;gt;{{ contactInfo.contactEmail }}&amp;lt;/a&amp;gt;&quot; %}&#xA;{{ email | rot13 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to include the dynamic variables into the set statement?&lt;/p&gt;&#xA;" OwnerUserId="802" LastActivityDate="2014-09-26T05:47:30.293" Title="Twig Templates : Include dynamic data when using set" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2760" PostTypeId="2" ParentId="2759" CreationDate="2014-09-26T02:50:50.837" Score="4" Body="&lt;p&gt;The main thing to remember about Twig... &lt;strong&gt;You never need to nest tags within other tags&lt;/strong&gt;. So putting &lt;code&gt;{{ }}&lt;/code&gt; within &lt;code&gt;{% %}&lt;/code&gt; is never going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To concatenate a string in Twig, &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#expressions&quot; rel=&quot;nofollow&quot;&gt;use the &lt;code&gt;~&lt;/code&gt; character...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email = &quot;&amp;lt;a href='mailto:&quot; ~ contactInfo.contactEmail ~ &quot;'&amp;gt;&quot; ~ contactInfo.contactEmail ~ &quot;&amp;lt;/a&amp;gt;&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-26T02:50:50.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2761" PostTypeId="2" ParentId="2759" CreationDate="2014-09-26T05:47:30.293" Score="4" Body="&lt;p&gt;Another way to do this is to use the other &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow&quot;&gt;set syntax&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email %}&#xA;  &amp;lt;a href=&quot;mailto:{{ contactInfo.contactEmail }}&quot;&amp;gt;{{ contactInfo.contactEmail }}&amp;lt;/a&amp;gt;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sometimes it is easier to read.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-09-26T05:47:30.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2762" PostTypeId="2" ParentId="2057" CreationDate="2014-09-26T05:59:40.877" Score="0" Body="&lt;p&gt;Yea I would like to see some more static in memory/file store as well (as plug or native) -&gt; Page needs 1.7 secs for first byte..really wanna push that down to 150ms or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not everyone can put varnish or fastly before the page :)&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2014-09-26T05:59:40.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2763" PostTypeId="1" AcceptedAnswerId="2776" CreationDate="2014-09-26T06:16:46.603" Score="4" ViewCount="465" Body="&lt;p&gt;Forgive me if this is a stupid or naive question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generally think of an &lt;strong&gt;ElementCriteriaModel&lt;/strong&gt; as being a &quot;search object&quot;. Specifically, it's a search object which revolves around a specific type of element. The model has attributes like &lt;code&gt;order&lt;/code&gt;, &lt;code&gt;offset&lt;/code&gt; and &lt;code&gt;limit&lt;/code&gt;, which are obviously common terms when conducting an SQL query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, a &lt;strong&gt;DbCommand&lt;/strong&gt; is an object which directly translates to an SQL query. This is far more flexible, allowing you to do things like perform complex joins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So while I can certainly see &lt;em&gt;some&lt;/em&gt; differences, it's hard for me to grasp the finer points of one vs. the other. (I'll admit that typing this has helped me to see it a little more clearly.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing/misunderstanding?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-26T17:59:18.340" Title="What's the difference between ElementCriteriaModel and DbCommand?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2764" PostTypeId="2" ParentId="2763" CreationDate="2014-09-26T08:02:13.653" Score="1" Body="&lt;p&gt;I assume that one advantage would be that as Craft gets updated, the ElementCriteriaModel is updated whereas you may need to change any DBCommand queries you have created.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-26T08:02:13.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2765" PostTypeId="1" AcceptedAnswerId="2777" CreationDate="2014-09-26T09:12:43.410" Score="11" ViewCount="2627" Body="&lt;p&gt;I have a matrix field with around 26 block types with between 2-6 fields on each. It seems like I've hit a limit and cannot add any more fields to any of the block types. I can add a field if i delete one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error &quot;Undefined index: type&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/var/www/dev/domain.co.uk/craft/app/fieldtypes/MatrixFieldType.php(118)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft Pro 2.1.2563&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt&lt;/p&gt;&#xA;" OwnerUserId="834" LastActivityDate="2018-06-21T20:24:01.573" Title="Matrix field input error from within the control panel" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2768" PostTypeId="1" AcceptedAnswerId="2771" CreationDate="2014-09-26T13:47:47.077" Score="1" ViewCount="535" Body="&lt;p&gt;Does anyone know if I can output the number of children the current entry (structure) has?&lt;/p&gt;&#xA;" OwnerUserId="835" LastEditorUserId="250" LastEditDate="2014-09-29T11:44:44.967" LastActivityDate="2014-09-29T11:44:44.967" Title="Current Entry Children Count" Tags="&lt;structure&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2769" PostTypeId="1" AcceptedAnswerId="2775" CreationDate="2014-09-26T14:45:25.287" Score="7" ViewCount="2029" Body="&lt;p&gt;This seems so simple, but after reading over the docs, I couldn't find an answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to have a field have a default value in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I have a Lightswitch field that I want to be on by default, so my client doesn't have to turn it on every time they publish an asset.  But they still do need the ability to turn it off in exceptional cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize I could just reverse the logic of the field, but it raises a broader question of default field values (which would be useful to me).&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="22" LastEditDate="2017-05-10T00:20:14.413" LastActivityDate="2017-05-10T00:20:14.413" Title="Default field values?" Tags="&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2770" PostTypeId="1" CreationDate="2014-09-26T14:58:26.153" Score="1" ViewCount="37" Body="&lt;p&gt;Can I somehow use Asset transformations on external images (having them cached on my server)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have this image on &quot;&lt;a href=&quot;http://www.example-external-website.com/image.jpg&quot; rel=&quot;nofollow&quot;&gt;http://www.example-external-website.com/image.jpg&lt;/a&gt;&quot; and I wan't to pull this image into my own server and create a small 100x100 thumbnail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-09-26T14:58:26.153" Title="Use Assets to create transformations of external images" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2014-09-28T20:18:37.730" ContentLicense="CC BY-SA 3.0" />
  <row Id="2771" PostTypeId="2" ParentId="2768" CreationDate="2014-09-26T15:44:25.160" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.getChildren().total() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-26T15:44:25.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2772" PostTypeId="1" CreationDate="2014-09-26T15:48:37.000" Score="1" ViewCount="1300" Body="&lt;p&gt;I have added additional fields to my user profiles. I need to be able to change and save these via my plugin. How do I set those values before calling&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-01-14T23:08:09.870" Title="Save user profile fields through plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-profile&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2773" PostTypeId="2" ParentId="2772" CreationDate="2014-09-26T15:54:39.820" Score="4" Body="&lt;p&gt;You use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;setContentFromPost method&lt;/a&gt; on the UserModel if you are posting to your plugin, like so (this is what happens when you save your profile in the control panel):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is also a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContent-detail&quot; rel=&quot;nofollow&quot;&gt;setContent method&lt;/a&gt;, which takes a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ContentModel&quot; rel=&quot;nofollow&quot;&gt;ContentModel&lt;/a&gt; or an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;setContent([ 'fields' =&amp;gt; ['field1' =&amp;gt; 'value'] ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Behind the scenes, that runs the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;setAttributes method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-09-26T18:32:54.983" LastActivityDate="2014-09-26T18:32:54.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2774" PostTypeId="2" ParentId="2772" CreationDate="2014-09-26T17:35:34.353" Score="2" Body="&lt;p&gt;Fred got me pointed down a path. Not sure why this works, perhaps someone can explain it to me. This is what I ended up doing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$initialCredits = 100;&#xA;$user = craft()-&amp;gt;users-&amp;gt;getUserById(craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id);&#xA;$user-&amp;gt;getContent()-&amp;gt;initialCredits = $initialCredits;  &#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, why getContent() worked and setContent() doesn't confuses me. I would think that since I am setting content and not getting it, I should use getContent(). Unless I am on the other side of the model somehow.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-26T17:35:34.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2775" PostTypeId="2" ParentId="2769" CreationDate="2014-09-26T17:38:46.390" Score="4" Body="&lt;p&gt;As far as I know, the only fields that allow defaults are those that extend the &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/BaseOptionsFieldType&quot; rel=&quot;nofollow&quot;&gt;BaseOptionsFieldType&lt;/a&gt;, namely Dropdown, Multiselect, Checkboxes, and RadioButtons. You could change your lightswitch to one of these other fieldtypes and have a default value available.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-09-26T17:38:46.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2776" PostTypeId="2" ParentId="2763" CreationDate="2014-09-26T17:59:18.340" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; represents a SQL statement to execute against a database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; is a model just like any other model in &lt;code&gt;craft/app/models&lt;/code&gt;, but it also happens to make it easy to search for &lt;a href=&quot;http://buildwithcraft.com/classreference/#craft.app.elementtypes&quot; rel=&quot;nofollow&quot;&gt;Elements&lt;/a&gt; in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By setting all of the criteria for the elements you're searching for and calling the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel#find-detail&quot; rel=&quot;nofollow&quot;&gt;find()&lt;/a&gt; method, that will invoke &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;findElements($this);&lt;/code&gt;, which in turn will create a DbCommand object custom built for the ElementCriterialModel parameters that you set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So think of ElementCriteriaModel as an abstraction on top of DbCommand that makes it easy to search for Elements.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-26T17:59:18.340" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2777" PostTypeId="2" ParentId="2765" CreationDate="2014-09-26T18:55:03.973" Score="15" Body="&lt;p&gt;There's about a 99% chance you're bumping into your php.ini file's &lt;a href=&quot;http://php.net/manual/en/info.configuration.php#ini.max-input-vars&quot;&gt;max_input_vars&lt;/a&gt; value and/or its &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.post-max-size&quot;&gt;post_max_size&lt;/a&gt;. If you bump those to higher values, it should start working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you may have to restart your web server for the settings to take affect.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-28T22:27:05.623" LastActivityDate="2014-09-28T22:27:05.623" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2778" PostTypeId="2" ParentId="641" CreationDate="2014-09-26T20:54:07.950" Score="2" Body="&lt;p&gt;Not an answer, but one thing that might help you diagnose the problem, is to output all the return errors (without having to define it on each field as the example templates do).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getAllErrors()) }}&#xA;{% endif %}&#xA;&#xA;{% if entry is defined %}&#xA;    {{ errorList(entry.getAllErrors()) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A User Model named 'account' is returned by default from a failed &lt;code&gt;users/saveUser&lt;/code&gt; post action, and an Entry Model named 'entry' is returned by default from a failed &lt;code&gt;entries/saveEntry&lt;/code&gt; post action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also found the &lt;a href=&quot;http://straightupcraft.com/craft-plugins/inspector&quot; rel=&quot;nofollow&quot;&gt;Inpector&lt;/a&gt; plug-in extremely helpful. You can then add &lt;code&gt;{{ account | inspect }}&lt;/code&gt; or &lt;code&gt;{{ entry | inspect }}&lt;/code&gt; within the &lt;code&gt;if&lt;/code&gt; statements above to get more info.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-09-26T20:59:49.720" LastActivityDate="2014-09-26T20:59:49.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2779" PostTypeId="2" ParentId="2226" CreationDate="2014-09-26T21:27:33.983" Score="1" Body="&lt;p&gt;Seems pretty straightforward, unless I'm missing something.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create the 6 locales; one for each location (settings &gt; locales)&lt;/li&gt;&#xA;&lt;li&gt;Create user groups (10) and set permissions (settings &gt; users)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Allow location drafters to only 'edit' and 'create', but not 'publish' (for each section)&lt;/li&gt;&#xA;&lt;li&gt;Restrict location drafters to their respective locale (single locale)&lt;/li&gt;&#xA;&lt;li&gt;Allow Region Admins to edit, create, and publish (for each section)&lt;/li&gt;&#xA;&lt;li&gt;Restrict Region Admins to their region locales (more than one locale)&lt;/li&gt;&#xA;&lt;li&gt;Allow Super Admins to edit, create, and publish (for each section)&lt;/li&gt;&#xA;&lt;li&gt;Allow Super Admins for all locales&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is assuming of course you have a locale for each location (and not for each region).&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-09-26T21:27:33.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2780" PostTypeId="1" AcceptedAnswerId="2785" CreationDate="2014-09-27T02:47:46.380" Score="1" ViewCount="436" Body="&lt;p&gt;&lt;code&gt;{% includeCssFile %}&lt;/code&gt; can be used to add &quot;regular&quot; css files in the head tag. Is it possible to use this tag for print media?&lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="57" LastEditDate="2014-09-27T04:24:24.477" LastActivityDate="2014-09-27T16:18:41.640" Title="Is there a way to use the includeCssFile tag to include a css file for print media?" Tags="&lt;css&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2781" PostTypeId="2" ParentId="2780" CreationDate="2014-09-27T04:26:56.327" Score="1" Body="&lt;p&gt;I don't think so with &lt;code&gt;{% includeCssFile %}&lt;/code&gt;, but you can use &lt;code&gt;{% includeCss %}&lt;/code&gt; and have it inline.  Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCss('&#xA;    @media print {&#xA;        p {&#xA;            font-size: 20px;&#xA;            color: red;&#xA;        }&#xA;    }&#xA;') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-27T04:26:56.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2782" PostTypeId="1" CreationDate="2014-09-27T13:19:56.363" Score="7" ViewCount="2769" Body="&lt;p&gt;For some reason the CraftCMS URL rewrite is not working on GoDaddy shared hosting server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently by .htaccess file looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Options +FollowSymLinks -Multiviews&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;   RewriteEngine On&#xA;   # Send would-be 404 requests to Craft&#xA;   RewriteCond %{REQUEST_FILENAME} !-f&#xA;   RewriteCond %{REQUEST_FILENAME} !-d&#xA;   RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;   RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this problem? Can someone help me solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure any more if this a url rewrite problem. As when I access an entry such as &lt;a href=&quot;http://aspaceboydream.com/comic/so-this-is-me&quot;&gt;http://aspaceboydream.com/comic/so-this-is-me&lt;/a&gt;, it loads correctly. But when I use the function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;url('comic')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to construct the urls of the different channels, the URLs are being constructed as &lt;a href=&quot;http://aspaceboydream.com/index.php?p=comic&quot;&gt;http://aspaceboydream.com/index.php?p=comic&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="666" LastEditorUserId="666" LastEditDate="2014-09-27T14:34:28.353" LastActivityDate="2016-10-04T15:59:47.363" Title="URL rewrite not working" Tags="&lt;url&gt;&lt;config&gt;&lt;siteurl&gt;&lt;setup&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2783" PostTypeId="1" AcceptedAnswerId="2794" CreationDate="2014-09-27T15:03:28.933" Score="0" ViewCount="401" Body="&lt;p&gt;My current site is with Wordpress in the folder &lt;code&gt;/blog&lt;/code&gt;. My new Craft install is in a sibling folder &lt;code&gt;/craft&lt;/code&gt;. When i try to load &lt;code&gt;brianfeeney.us/craft/admin&lt;/code&gt;, i get the wordpress 404. Must be an &lt;code&gt;.htaccess&lt;/code&gt; issue, right? Can't figure out or find the solution anywhere. &lt;/p&gt;&#xA;" OwnerUserId="839" LastEditorUserId="250" LastEditDate="2014-09-28T18:08:55.193" LastActivityDate="2014-09-28T18:08:55.193" Title="Getting Wordpress 404 when accessing /craft/admin" Tags="&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2784" PostTypeId="2" ParentId="2782" CreationDate="2014-09-27T15:04:50.647" Score="9" Body="&lt;p&gt;I solved the problem and am writing it down for future people encountering the same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the following configuration to the your &lt;code&gt;craft/config/general.php&lt;/code&gt; config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;URLs will start to work fine.&lt;/p&gt;&#xA;" OwnerUserId="666" LastEditorUserId="57" LastEditDate="2014-09-27T18:28:26.040" LastActivityDate="2014-09-27T18:28:26.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2785" PostTypeId="2" ParentId="2780" CreationDate="2014-09-27T16:18:41.640" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;{% includeCssFile %}&lt;/code&gt;, you just need to make sure and wrap all of the styles in the print stylesheet with &lt;code&gt;@media only print { }&lt;/code&gt; or &lt;code&gt;@media print { }&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@media only print {&#xA;   nav {&#xA;       display:none;&#xA;   }&#xA;   p {&#xA;       color:#000000;&#xA;   }&#xA;   .etc {&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-09-27T16:18:41.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2786" PostTypeId="1" AcceptedAnswerId="2787" CreationDate="2014-09-27T20:50:55.870" Score="7" ViewCount="1241" Body="&lt;p&gt;I need to join my &lt;strong&gt;3rd party table&lt;/strong&gt; with a standard &lt;strong&gt;ElementCriteriaModel (ECM)&lt;/strong&gt;. I'd like to start with an ordinary ECM, so my plugin will be compatible with any element type which may exist, now or in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, an ECM generates a query which joins multiple native tables. According to Brad in &lt;a href=&quot;https://craftcms.stackexchange.com/a/2776/45&quot;&gt;this answer...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... think of ElementCriteriaModel as an abstraction on top of DbCommand that makes it easy to search for Elements.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My plugin does not have either a custom Field Type or custom Element Type (which means I can't use &lt;code&gt;modifyElementsQuery&lt;/code&gt; when retrieving the data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I expand my ECM query to take additional SQL commands into account?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-09-27T20:50:55.870" Title="How can I do more complicated queries with an ElementCriteriaModel?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2787" PostTypeId="2" ParentId="2786" CreationDate="2014-09-27T20:50:55.870" Score="10" Body="&lt;p&gt;Once you've got your ECM, pass it off to the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot;&gt;&lt;code&gt;buildElementsQuery&lt;/code&gt;&lt;/a&gt; method...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This will convert your ECM into a DbCommand object.&lt;/strong&gt; From there, you can make further modifications to the query... like adding a &lt;code&gt;join&lt;/code&gt; for your 3rd party table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query-&amp;gt;join('myplugintable myplugintable', 'myplugintable.id = elements.id');&#xA;$query-&amp;gt;order('myplugintable.mysortcolumn');&#xA;&#xA;return $query-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-27T20:50:55.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2788" PostTypeId="1" CreationDate="2014-09-27T21:10:54.077" Score="0" ViewCount="694" Body="&lt;p&gt;I'm having trouble saving some data into the database with my plugin. I am able to save content only if an index is defined on that column, but only if unique=&gt;true is set, which causes some problems because I need repeated values in column b. My function that runs after plugin install works, as I am able to save all the correct content in column A. Data is saved in column b if I set a unique index on it, otherwise the column fills with Null. Any help is greatly appreciated! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class Plugin_MyModel extends BaseModel&#xA;{&#xA;    public $a = &quot;&quot;;&#xA;    public $b = &quot;&quot;;&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'a' =&amp;gt; AttributeType::String,&#xA;            'b' =&amp;gt; AttributeType::String,&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Record:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Plugin_MyRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'my_table';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'a'     =&amp;gt; AttributeType::String,&#xA;            'b' =&amp;gt; AttributeType::String,&#xA;        );&#xA;    }&#xA;&#xA;    public function defineIndexes()&#xA;    {&#xA;        return array(&#xA;            array('columns' =&amp;gt; array('a'), 'unique' =&amp;gt; true),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Service that gets data from API call and attempts to save in DB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Plugin_MyService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    protected $myRecord;&#xA;&#xA;    public function __construct($myRecord = null)&#xA;    {&#xA;        $this-&amp;gt;myRecord = $myRecord;&#xA;        if(is_null($this-&amp;gt;myRecord))&#xA;        {&#xA;            $this-&amp;gt;myRecord = Plugin_MyRecord::model();&#xA;        }   &#xA;    }&#xA;&#xA;&#xA;    public function saveItem(Plugin_MyModel &amp;amp;$model)&#xA;    {&#xA;        if ($id = $model-&amp;gt;getAttribute('id')) {&#xA;            if (null === ($record = $this-&amp;gt;myRecord-&amp;gt;findByPk($id))) {&#xA;                throw new Exception(Craft::t('Can\'t find item with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;            }&#xA;        } else {&#xA;            $record = $this-&amp;gt;myRecord-&amp;gt;create();&#xA;        }&#xA;&#xA;        $record-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;        if ($record-&amp;gt;save()) {&#xA;            // update id on model (for new records)&#xA;            $model-&amp;gt;setAttribute('id', $record-&amp;gt;getAttribute('id'));&#xA;&#xA;            return true;&#xA;        } else {&#xA;            $model-&amp;gt;addErrors($record-&amp;gt;getErrors());&#xA;&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;&#xA;    public function loadAllItems()&#xA;    {&#xA;        $items = $this-&amp;gt;api();&#xA;&#xA;        foreach($items['Items'] AS $item)&#xA;        {        &#xA;            $new_item = new Plugin_MyModel();&#xA;            $new_item-&amp;gt;a = $item['a'];&#xA;            $new_item-&amp;gt;b = $item['b'];&#xA;            $this-&amp;gt;saveItem($new_item);&#xA;        }&#xA;    }&#xA;&#xA;    private function api(){&#xA;        //Returns API Data  &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2014-09-28T16:07:36.887" LastActivityDate="2015-01-25T21:23:21.460" Title="Plugin only saving one column in database" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2789" PostTypeId="1" AcceptedAnswerId="2791" CreationDate="2014-09-28T08:58:50.293" Score="9" ViewCount="15680" Body="&lt;p&gt;I am using the following block of code in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;hr class=&quot;rule&quot;&amp;gt;&#xA;&#xA;{% if entry.features | length %}&#xA;    &amp;lt;div class=&quot;feature-block&quot;&amp;gt;&#xA;        &amp;lt;h4 class=&quot;is-uppercase&quot;&amp;gt;Features&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul class=&quot;features fa-ul&quot;&amp;gt;&#xA;        {% for block in entry.features %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;i class=&quot;fa-li fa fa-check&quot;&amp;gt;&amp;lt;/i&amp;gt; {{ block.feature }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The if statement is adding whitespace to the markup which causes styling issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xn5B8.png&quot; alt=&quot;Whitespace&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I correct this? Do I need to format the code block differently?&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="3951" LastEditDate="2017-11-22T18:54:12.713" LastActivityDate="2017-11-22T18:54:12.713" Title="Whitespace created when using if statements" Tags="&lt;templating&gt;&lt;whitespace&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2790" PostTypeId="1" AcceptedAnswerId="2793" CreationDate="2014-09-28T09:53:31.993" Score="1" ViewCount="427" Body="&lt;p&gt;Is there a simple way to opt out of the translation that occurs when you format a date like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ expiry | date('D, d M Y H:i:s', 'GMT') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need this in english to create a valid date for my HTTP headers. But the site is in norwegian so days and months are translated, resulting in an invalid date.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-09-28T10:37:04.070" LastActivityDate="2014-09-28T17:15:15.930" Title="Format date without translating text" Tags="&lt;localization&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2791" PostTypeId="2" ParentId="2789" CreationDate="2014-09-28T09:56:44.260" Score="10" Body="&lt;p&gt;Have a look at the twig documentation regarding whitespace control:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#whitespace-control&quot; rel=&quot;noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/templates.html#whitespace-control&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, wrap the area where you want to remove whitespace in &lt;code&gt;{% spaceless %} ... {% endspaceless %}&lt;/code&gt;, and use the &lt;code&gt;-&lt;/code&gt; character inside tags to trim whitespace before and/or after.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="3951" LastEditDate="2017-11-20T19:32:09.033" LastActivityDate="2017-11-20T19:32:09.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2792" PostTypeId="2" ParentId="2789" CreationDate="2014-09-28T09:58:03.647" Score="4" Body="&lt;p&gt;You have several different options, depending on what you want to do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The spaceless function, which removes whitespace between HTML tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;strong&amp;gt;foo&amp;lt;/strong&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endspaceless %}&#xA;&#xA;{# output will be &amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;foo&amp;lt;/strong&amp;gt;&amp;lt;/div&amp;gt; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The trim filter, which removes whitespace from the beginning/end of a string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.feature | trim }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-28T09:58:03.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2793" PostTypeId="2" ParentId="2790" CreationDate="2014-09-28T12:14:44.107" Score="2" Body="&lt;p&gt;Not currently - we should probably add a new 'translate' argument to that function which would let you opt out of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However Craft’s DateTime variables have a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/dates/DateTime#rfc1123-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;rfc1123()&lt;/code&gt;&lt;/a&gt; function which can be used instead of the Twig &lt;code&gt;|date&lt;/code&gt; filter, and its output won’t get automatically translated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, &lt;a href=&quot;http://tools.ietf.org/html/rfc1123&quot; rel=&quot;nofollow&quot;&gt;RFC 1123&lt;/a&gt; defines the date/time specification recommended by &lt;a href=&quot;http://tools.ietf.org/html/rfc2616#section-3.3&quot; rel=&quot;nofollow&quot;&gt;RFC 2616 (HTTP 1.1)&lt;/a&gt; (which is the same as the one defined by &lt;a href=&quot;http://tools.ietf.org/html/rfc822#section-5&quot; rel=&quot;nofollow&quot;&gt;RFC 822&lt;/a&gt;, just with 4-digit years).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ expiry.rfc1123() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-09-28T17:15:15.930" LastActivityDate="2014-09-28T17:15:15.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2794" PostTypeId="2" ParentId="2783" CreationDate="2014-09-28T12:34:23.990" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://codex.wordpress.org/htaccess&quot; rel=&quot;nofollow&quot;&gt;Wordpress’ .htaccess file&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/help/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;Craft’s .htaccess file&lt;/a&gt; both use the same strategy: &lt;em&gt;If the request is not pointing to a valid file or folder, rather than have Apache respond with a 404, re-route the request to index.php.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds to me like you’ve got a .htaccess fie at your web root which is handling Wordpress’ index.php redirect, and that is taking precedence over Craft’s for whatever reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your Wordpress install lives within /blog/, you should move that Wordpress .htaccess file to /blog/.htaccess, so it’s only affecting blog/* requests. (You’ll also need to tweak it a bit; post the file’s contents if you need help with that.) Or another option is you could add this condition it, before the RewriteRule line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} ^/blog [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Likewise, Craft’s .htaccess file should live at /craft/.htaccess (no modification will be necessary as the one Craft ships with already accounts for the possibility that it’s within a subfolder), or a similar &lt;code&gt;RewriteCond&lt;/code&gt; line could be added to it if you really want to keep all your redirects in one place at /.htaccess.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-28T12:34:23.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2795" PostTypeId="2" ParentId="2747" CreationDate="2014-09-28T13:00:05.610" Score="9" Body="&lt;p&gt;That &lt;code&gt;and&lt;/code&gt; argument only applies to the other top-level relatedTo arguments. If one of those arguments targets multiple elements (e.g. &lt;code&gt;categories&lt;/code&gt;), those will still be glued together with “OR”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to set it up like this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries.section('resources').relatedTo(&#xA;    'and',&#xA;    { targetElement: category1 },&#xA;    { targetElement: category2 }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don’t know all of the categories ahead of time, you can create the parameter value dynamically like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the category IDs #}&#xA;{% set catIds = craft.categories[...].ids() %}&#xA;&#xA;{# Create the relatedTo param value #}    &#xA;{% set relatedTo = ['and'] %}&#xA;&#xA;{% for id in catIds %}&#xA;    {% set relatedTo = relatedTo|merge([id]) %}&#xA;{% endfor %}&#xA;&#xA;{# Now find our entries #}&#xA;{% set resources = craft.entries.section('resources').relatedTo(relatedTo) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is significantly easier in Craft 2.5 (&lt;a href=&quot;http://buildwithcraft.com/beta&quot; rel=&quot;nofollow&quot;&gt;currently in beta&lt;/a&gt;), as the relatedTo param’s &lt;code&gt;element&lt;/code&gt;, &lt;code&gt;targetElement&lt;/code&gt;, and &lt;code&gt;sourceElement&lt;/code&gt; sub-properties can now begin with &lt;code&gt;'and'&lt;/code&gt;, which tells Craft to only return elements that are related to &lt;em&gt;all&lt;/em&gt; of the following element IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a quick example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Start with a list of category IDs that must be included #}&#xA;{% set catIds = [1, 2] %}&#xA;&#xA;{# Find the entries #}&#xA;{% set resources = craft.entries({&#xA;    section: 'resources',&#xA;    relatedTo: {&#xA;        targetElement: ['and']|merge(catIds),&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-11-11T20:23:59.553" LastActivityDate="2015-11-11T20:23:59.553" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2796" PostTypeId="2" ParentId="2498" CreationDate="2014-09-28T13:05:05.993" Score="1" Body="&lt;p&gt;Since the data will be imported programmatically, my vote would be to write a plugin that manages these products as a custom thing. There will definitely be a performance benefit to giving your products their own DB table that’s perfectly suited for them, and it doesn’t sound like you’ll be missing any of the features you’d get by having these be actual entries.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-28T13:05:05.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2797" PostTypeId="2" ParentId="2201" CreationDate="2014-09-28T13:06:16.217" Score="1" Body="&lt;p&gt;Both of those are on the to-do list. In the meantime your best bet would be to write a plugin that conditionally hides those fields via Javascript.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-28T13:06:16.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2798" PostTypeId="2" ParentId="2292" CreationDate="2014-09-28T13:08:33.520" Score="3" Body="&lt;p&gt;I wouldn’t recommend it until Yii is 100% compatible. And I’m guessing there’s not a lot of motivation to do that, since Yii 2 is almost out and is pretty much a complete rewrite.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-09-28T13:08:33.520" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2799" PostTypeId="2" ParentId="2514" CreationDate="2014-09-28T22:20:12.827" Score="3" Body="&lt;p&gt;Depends on your definition of &quot;easy&quot;. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the easiest way would be to do what you describe and import the full database.  From there, you can write SQL to find all of the entries that you &lt;em&gt;don't&lt;/em&gt; want to keep around from the &lt;code&gt;craft_entries&lt;/code&gt; table.  If you get the IDs for those, you can remove the equivalent rows from the &lt;code&gt;craft_elements&lt;/code&gt;, and Craft's cascading deletes will take care of deleting the appropriate data in the other tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is on our long-term list to provide a way to import and export content between Craft installations for situations like what you're describing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-28T22:20:12.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2800" PostTypeId="1" AcceptedAnswerId="2801" CreationDate="2014-09-29T00:43:57.733" Score="2" ViewCount="318" Body="&lt;p&gt;I'm creating a macro I'd like to reuse multiple times but the only thing that changes is the field name (matrix). Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.fieldname1 %}&#xA;&amp;lt;h3&amp;gt;{{ block.title }}&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to increment this macro so I don't rewrite this code snippet over and over again but when I try and change &lt;strong&gt;entry.fieldname1&lt;/strong&gt; to a string it's no&lt;code&gt;{% set string = entry.fieldname ~ 1 %}&lt;/code&gt; it is no longer recognized inside the for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? &lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-09-29T00:55:44.220" Title="Field name in reusable macro" Tags="&lt;templating&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2801" PostTypeId="2" ParentId="2800" CreationDate="2014-09-29T00:55:44.220" Score="3" Body="&lt;p&gt;Try using an array syntax instead of the object syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = entry['fieldname' ~ 1] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-29T00:55:44.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2802" PostTypeId="1" CreationDate="2014-09-29T05:58:14.473" Score="1" ViewCount="210" Body="&lt;p&gt;I'm working on a site that will end up having 30-40+ structure sections which are sharing templates and will be using about 10 different entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(This would probably be much easier if I used categories instead of this many sections, but I need different user privileges for each 'project' and it seems &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1311/is-it-possible-to-limit-users-to-adding-editing-entries-in-specific-categories&quot;&gt;there's no simple way&lt;/a&gt; to restrict users to editing specific categories. Creating a plugin is beyond my skills at the moment, so I have to make do with what I have...)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I'm using URL segments with &lt;code&gt;getSegment&lt;/code&gt; to figure out which section is requested and I'm following &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;this advice&lt;/a&gt; from the Craft help site to assign templates to entry types and I'm wondering if this practice has any effect on performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it goes like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I need to figure out which section I'm in based on the URL so I can fetch the correct entries. The beginning of my &lt;code&gt;index.php&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Figure out which project/entry type is requested: #}&#xA;&#xA;{% set projectSegment = craft.request.getSegment(1) %}&#xA;{% set entryType = craft.request.getSegment(2) %}&#xA;&#xA;{% switch projectSegment %}&#xA;  {% case &quot;myproject1&quot; %}&#xA;    {% set projectSection = 'myProject1' %}&#xA;    {% set projectName = 'My Project 1' %} {# To be used later in templates #}&#xA;  {% case &quot;myproject2&quot; %}&#xA;    {% set projectSection = 'myProject2' %}&#xA;    {% set projectName = 'My Project 2' %}&#xA;  ...&#xA;{% endswitch %}&#xA;&#xA;&#xA;{# Fetch entries in the correct section using these variables: #}&#xA;&#xA;{% set typePath = craft.entries.section(projectSection).type(entryType) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now in my templates I can use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ projectName }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{% for entry in typePath %}&#xA;  ...&#xA;{% endfor}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I have to assign each entry type to its own templates, so in the CP I'm pointing each section to a single &lt;code&gt;entry.html&lt;/code&gt; template which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %} &#xA;  {% include &quot;_projects/entry-types/&quot; ~ entry.type %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in some cases I'm using even more conditionals in a particular entry type template to point to other templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entryType %}&#xA;&#xA;  {% case 'entryType1' %}&#xA;    {% include '_project/entry-types/entryType1-listing' %}&#xA;&#xA;  {% case 'entryType2' %}&#xA;    {% include '_project/entry-types/entryType2-listing' %}&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So here's my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will the use of this many structures/entry types and the use of &lt;code&gt;getSegment&lt;/code&gt; variables affect performance in any way, and will cache still perform efficiently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I figured out, the &lt;code&gt;{% cache %}&lt;/code&gt; tag should be placed inside the &lt;code&gt;{% block %}&lt;/code&gt; tag, but since everything is 'dynamic' inside the &lt;code&gt;{% block %}&lt;/code&gt; tag and changes based on the URL, I don't know if the cache will work the same way for all sections and entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complicate things even further, this will end up being multilingual as well, and I'm concerned this will put a lot of strain on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, any clarification is much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="576" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-09-29T05:58:14.473" Title="Performance and cache when using entry type templates and getSegment" Tags="&lt;url&gt;&lt;structure&gt;&lt;cache&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2803" PostTypeId="1" CreationDate="2014-09-29T08:03:50.167" Score="0" ViewCount="235" Body="&lt;p&gt;Breaking my head over this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On one of the tags in the HTML template. The &lt;code&gt;{% for image in category.CategorieImage %}&lt;/code&gt; loop. Craft seems to generate 2 unwanted quotation marks (&lt;code&gt;&quot;&lt;/code&gt;). These characters are messing up the lay-out as the generate an unwanted line/paragraph.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;div class=&quot;portfolio-item img-thumbnail&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;thumb-info secundary&quot;&amp;gt;&#xA;                {% for image in category.CategorieImage %}&#xA;                &amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ image.url ('categorieimage') }}&quot; title=&quot;{{ category.title }}&quot; alt=&quot;{{ category.title }}&quot;&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;span class=&quot;thumb-info-title&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;thumb-info-inner&quot;&amp;gt;{{ category.title }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;span class=&quot;thumb-info-type&quot;&amp;gt;{{ category.categorieDescription[:80] ~ '...' }}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;thumb-info-action&quot;&amp;gt;&#xA;                    &amp;lt;span title=&quot;Universal&quot; class=&quot;thumb-info-action-icon&quot;&amp;gt;&amp;lt;span class=&quot;badge&quot;&amp;gt;{{ entriesNbr }}&amp;lt;/span&amp;gt;&amp;lt;span class=&quot;nameMythes&quot;&amp;gt;Mythes&amp;lt;/span&amp;gt;&amp;lt;i class=&quot;fa fa-link&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what's rendered on the final page in Safari using the developers panel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;portfolio-item img-thumbnail&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;http://commercielemythes.nl/mythes/sales&quot; class=&quot;thumb-info secundary&quot;&amp;gt;&#xA;                                    &amp;lt;img class=&quot;img-responsive&quot; src=&quot;http://commercielemythes.nl/assets/categorie_image/_categorieimage/Sales.jpg&quot; title=&quot;Sales&quot; alt=&quot;Sales&quot;&amp;gt;&#xA;                &quot;  &quot;&#xA;                &amp;lt;span class=&quot;thumb-info-title&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;thumb-info-inner&quot;&amp;gt;Sales&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;span class=&quot;thumb-info-type&quot;&amp;gt;Over succes in sales zijn vele mythes. Velen zijn inmiddels zo geworteld dat ze ...&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;thumb-info-action&quot;&amp;gt;&#xA;                    &amp;lt;span title=&quot;Universal&quot; class=&quot;thumb-info-action-icon&quot;&amp;gt;&amp;lt;span class=&quot;badge&quot;&amp;gt;5&amp;lt;/span&amp;gt;&amp;lt;span class=&quot;nameMythes&quot;&amp;gt;Mythes&amp;lt;/span&amp;gt;&amp;lt;i class=&quot;fa fa-link&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've used CODA to show any unwanted (invisible) characters but none seems to be there.&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="250" LastEditDate="2014-09-29T08:14:33.513" LastActivityDate="2014-10-13T18:56:58.137" Title="Craft renders unwanted quotation marks on some tags" Tags="&lt;templating&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2804" PostTypeId="2" ParentId="2803" CreationDate="2014-09-29T09:16:35.120" Score="4" Body="&lt;p&gt;I believe the quotation marks are misleading... What you're seeing in the Safari developers panel is simply a blank space, and Safari is putting quotes around it because it's being interpreted as a &quot;string&quot; by the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equally, your visual layout is probably just getting screwed up because of empty space between your HTML tags. If you tightened up your HTML tags and removed any spacing in between, the layout might look as you expect it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#whitespace-control&quot; rel=&quot;nofollow&quot;&gt;You can easily trim whitespace around Twig tags by using &lt;code&gt;spaceless&lt;/code&gt;, or adding dashes.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;    &amp;lt;a href=&quot;#&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;path/to/img&quot; /&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove whitespace &lt;strong&gt;before&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- for entry in entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove whitespace &lt;strong&gt;after&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove whitespace &lt;strong&gt;before &amp;amp; after&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- for entry in entries -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-09-29T09:16:35.120" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2805" PostTypeId="1" AcceptedAnswerId="2807" CreationDate="2014-09-29T09:29:02.123" Score="3" ViewCount="1562" Body="&lt;p&gt;My matrix field has a block type called photo. When looping through entries I only want to output the first instance of this block type (although it will have been used multiple times), i.e. the first photo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below loops through the entries, but for each entry it's outputting every photo for the entry - not just the first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to change to get just the first photo of each entry output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySection') %}&#xA;&#xA;    {% for block in entry.tactics %}&#xA;&#xA;        {% if block.type == &quot;photo&quot; %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ entry.Url }}&quot;&amp;gt;&#xA;&#xA;                {% set photo = block.photo.first() %}&#xA;&#xA;                &amp;lt;img src=&quot;{{ photo.getUrl }}&quot; width=&quot;{{ photo.getWidth() }}&quot; height=&quot;{{ photo.getHeight() }} alt=&quot;{{ entry.title }}&quot;/&amp;gt;&#xA;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="122" LastEditorUserId="250" LastEditDate="2014-09-29T10:16:10.420" LastActivityDate="2014-09-29T11:08:47.460" Title="How do I output a matrix block type only once when looping through entries?" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2806" PostTypeId="2" ParentId="2805" CreationDate="2014-09-29T10:32:07.033" Score="1" Body="&lt;p&gt;You can exit the loop on some condition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySection') %}&#xA;&#xA;    {% set exitLoop = 0 %}&#xA;    {% for block in entry.tactics if exitLoop == 0 %}&#xA;&#xA;        {% if block.type == &quot;photo&quot; %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ entry.Url }}&quot;&amp;gt;&#xA;&#xA;                {% set photo = block.photo.first() %}&#xA;&#xA;                &amp;lt;img src=&quot;{{ photo.getUrl }}&quot; width=&quot;{{ photo.getWidth() }}&quot; height=&quot;{{ photo.getHeight() }} alt=&quot;{{ entry.title }}&quot;/&amp;gt;&#xA;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;            {% set exitLoop = 1 %} &#xA;            {# so as this loop will no longer be executed until new entry found #}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can use &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; plugin to break the loop. In this case you can just add&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% break %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the end of your &lt;code&gt;if&lt;/code&gt; statement.&lt;/p&gt;&#xA;" OwnerUserId="250" LastEditorUserId="250" LastEditDate="2014-09-29T11:08:47.460" LastActivityDate="2014-09-29T11:08:47.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2807" PostTypeId="2" ParentId="2805" CreationDate="2014-09-29T10:45:02.713" Score="5" Body="&lt;p&gt;You can &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot;&gt;output the first matrix block of it's type&lt;/a&gt; using &lt;code&gt;.type(blockHandle)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySection') %}&#xA;    {% set photoBlock = entry.tactics.type('photo').first %}&#xA;&#xA;    {% if photoBlock %}&#xA;        &amp;lt;a href=&quot;{{ entry.Url }}&quot;&amp;gt;&#xA;            {% set photo = photoBlock.photo.first() %}&#xA;&#xA;            {% if photo %}&#xA;                &amp;lt;img src=&quot;{{ photo.getUrl }}&quot; width=&quot;{{ photo.getWidth() }}&quot; height=&quot;{{ photo.getHeight() }} alt=&quot;{{ entry.title }}&quot;/&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {{ entry.title }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-09-29T10:45:02.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2810" PostTypeId="1" AcceptedAnswerId="2812" CreationDate="2014-09-29T12:15:40.533" Score="2" ViewCount="1208" Body="&lt;p&gt;Usually, I would use PHP to append the filetime of a file provide cache-busting. Does Craft or Twig do anything that can help with this?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-09-29T12:28:09.040" Title="Does Craft/Twig help with cache-busting js/css?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2812" PostTypeId="2" ParentId="2810" CreationDate="2014-09-29T12:28:09.040" Score="1" Body="&lt;p&gt;No, Craft/Twig itself doesn't really do anything in regards to cache busting your assets. Bust is one tool, and you'd also want to take a look at the awesome &lt;a href=&quot;https://github.com/johndwells/craft.minimee&quot; rel=&quot;nofollow&quot;&gt;Minimee plugin&lt;/a&gt; port.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-29T12:28:09.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2813" PostTypeId="1" CreationDate="2014-09-29T13:04:43.710" Score="6" ViewCount="1227" Body="&lt;p&gt;I am trying to make entries editable from the front end and pretty much follwed &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;noreferrer&quot;&gt;the docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i visit my edit view, the entry-from is filled with their respective values but unfortunately no changes are being saved back when i update those and submit. A redirect is also not happening. The old form just loads again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not errors too. The site is localized so could this be a problem? Should i add the locale to my inputs?&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2017-02-16T13:36:53.787" Title="Front end edit: entry doesn’t get saved" Tags="&lt;entries&gt;&lt;form&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2814" PostTypeId="1" CreationDate="2014-09-29T17:31:30.723" Score="0" ViewCount="142" Body="&lt;p&gt;Craft\WebApp and its behaviors do not have a method or closure named &quot;getInfo&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;appeared today, nothing has been updated or changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="844" LastActivityDate="2014-09-30T14:39:34.163" Title="Craft\WebApp and its behaviors do not have a method or closure named &quot;getInfo&quot;" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-09-30T17:45:28.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="2815" PostTypeId="2" ParentId="2814" CreationDate="2014-09-29T17:44:40.420" Score="2" Body="&lt;p&gt;Sounds like some of Craft's files are missing.  Try downloading the latest release from buildwithcraft.com and re-uploading the &lt;code&gt;craft/app&lt;/code&gt; folder and see if that solves it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the OP sent a ticket into support, I'll update that re-uploading the &lt;code&gt;craft/app&lt;/code&gt; folder solved the problem.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-09-30T14:39:34.163" LastActivityDate="2014-09-30T14:39:34.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2816" PostTypeId="1" CreationDate="2014-09-29T18:20:01.680" Score="1" ViewCount="1116" Body="&lt;p&gt;So this is not my first craft build, and basically, it's identical to my last setup on the craft front, I can't see anything wrong, but I can't remove index.php without causing a 404. I've tried the .htaccess fix, not luck. The last site I did simply had &quot;deny from all&quot; in .htaccess, but it didn't need index.php, so I don't see why I would need to change that for it to work? Is there anywhere else I can look for a settings change that might allow for cleaning up the urls?&lt;/p&gt;&#xA;" OwnerUserId="766" LastActivityDate="2015-02-18T06:23:38.143" Title="Can't remove index.php without getting a 404, .htaccess redirect not working, why?" Tags="&lt;url&gt;&lt;config&gt;&lt;routing&gt;&lt;404-page&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2817" PostTypeId="1" CreationDate="2014-09-29T18:49:41.233" Score="2" ViewCount="96" Body="&lt;p&gt;Example: section called &lt;code&gt;people&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Title format: &lt;code&gt;{firstName} {lastName}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I save an entry with the name _Michael &quot;That Guy&quot; D'Esopo, it saves and reads in the entries list screen as &lt;code&gt;Michael &amp;amp;quot;That Guy&amp;amp;quot; D&amp;amp;#039;Esopo&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="57" LastEditDate="2014-09-30T00:54:48.657" LastActivityDate="2014-09-30T00:54:48.657" Title="When using &quot;Title Format&quot;, quotes in fields are entitized when saving to title field" Tags="&lt;titles&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2818" PostTypeId="2" ParentId="2817" CreationDate="2014-09-29T18:49:41.233" Score="3" Body="&lt;p&gt;I've discovered a solution:&#xA;set the title format to &lt;code&gt;{firstName|raw} {lastName|raw}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I just proceed that way?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-09-29T18:49:41.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2819" PostTypeId="2" ParentId="2816" CreationDate="2014-09-29T18:52:58.977" Score="1" Body="&lt;p&gt;Try setting &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;omitScriptNameInUrls&lt;/code&gt;&lt;/a&gt; to true in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="250" LastEditDate="2014-09-30T16:16:51.180" LastActivityDate="2014-09-30T16:16:51.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2821" PostTypeId="1" AcceptedAnswerId="8920" CreationDate="2014-09-29T22:01:45.440" Score="6" ViewCount="482" Body="&lt;p&gt;Whats the recommended way to have javascript based filtering and sort table views in a plugin tab?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is is possible to use garnish to do that or should we be looking at external libraries like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.datatables.net/&quot; rel=&quot;noreferrer&quot;&gt;http://www.datatables.net/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-03-30T13:10:29.613" Title="Filtering and sorting lists in a plugin" Tags="&lt;plugin-development&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2822" PostTypeId="1" AcceptedAnswerId="6970" CreationDate="2014-09-30T00:17:23.780" Score="2" ViewCount="381" Body="&lt;p&gt;Is there a simple way to find entries that do not have a relationship with another channel? I see similar questions &lt;a href=&quot;https://craftcms.stackexchange.com/questions/603/how-to-find-entries-with-no-category&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/739/displaying-entries-that-are-not-related/766#766&quot;&gt;here&lt;/a&gt;, but neither seem to work in this context (or I don't know how to adapt their answers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 3 channels, 'accounts', 'clubs' and 'subscriptions'. Every 'subscription' has a required entries field (limit 1) for 'account' and 'club'. In this case, I'm trying to find 'accounts' that are not associated with a club (i.e. do not have a 'subscription'). Sounds like it should be easy, but not finding an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for something like &lt;code&gt;{% set params = params | merge({ not relatedTo : subscriptions }) %}&lt;/code&gt;, which obviously doesn't work. I'm using merge because there may be other criteria as well (such as account status, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-04T00:07:46.773" Title="How to find entries that are not related?" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2823" PostTypeId="1" AcceptedAnswerId="2824" CreationDate="2014-09-30T04:35:13.297" Score="2" ViewCount="416" Body="&lt;p&gt;I love routes, but they appear limited to loading a specific template. What about loading a plugin/controller based on the route instead? Anyway to do this in craft or am I limited to .htaccess?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-09-30T15:30:40.937" Title="Using Routes to load Controller" Tags="&lt;routes&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2824" PostTypeId="2" ParentId="2823" CreationDate="2014-09-30T05:43:58.190" Score="3" Body="&lt;p&gt;This is indeed possible.  You'll want to update your route to point to an array with and identify your controller path with the key &lt;code&gt;action&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;  return array(&#xA;    'pluginname/edit' =&amp;gt; array('action' =&amp;gt; 'pluginName/editItem'),&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin controller, you can create any number of variables you need and hand them off to your template as the second argument in the renderTemplate() method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// PluginNameController.php&#xA;public function actionEditItem()&#xA;{&#xA;    // Create any variables you want available in your template&#xA;    $variables['variable'] = craft()-&amp;gt;request-&amp;gt;getSegment(3);       &#xA;&#xA;    $variables['items'] = craft()-&amp;gt;pluginName-&amp;gt;getAllItems();&#xA;&#xA;    // Load a particular template and with all of the variables you've created&#xA;    $this-&amp;gt;renderTemplate('pluginname/_edit', $variables);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out the article &lt;a href=&quot;http://straightupcraft.com/articles/how-do-i-setup-a-route-to-point-to-a-controller-action-instead-of-a-template&quot; rel=&quot;nofollow&quot;&gt;How do I setup a route to point to a controller action instead of a template?&lt;/a&gt; on Straight Up Craft for a more in depth discussion that also goes into how to render the template from your control, hand off variables to your template, and reference multiple controllers.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-09-30T15:30:40.937" LastActivityDate="2014-09-30T15:30:40.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2825" PostTypeId="1" AcceptedAnswerId="2872" CreationDate="2014-09-30T07:17:21.007" Score="3" ViewCount="433" Body="&lt;p&gt;I have some issues with the asset handling of files containing Umlauts. Specifically it seems that the uploaded files on the server get renamed to a &quot;broken&quot; filename.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Zweigänger-1960.jpg&lt;/code&gt; becomes &lt;code&gt;ZweigaÌnger-1960.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No issues in the DB fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be the reason for that? What I'm overlooking? Also a solution similar to &quot;limitAutoSlugsToAscii&quot; would work for me or even renaming the files according to a pattern.&lt;/p&gt;&#xA;" OwnerUserId="149" LastEditorUserId="250" LastEditDate="2014-09-30T08:14:06.863" LastActivityDate="2015-06-04T12:33:03.947" Title="Umlauts in asset file-paths - Broken filenames on server" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2826" PostTypeId="1" AcceptedAnswerId="2836" CreationDate="2014-09-30T10:07:35.520" Score="1" ViewCount="194" Body="&lt;p&gt;In a structure like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Offices             US          Albuquerque&#xA;[offices]                       Boston&#xA;                                Chicago&#xA;                                Denver&#xA;&#xA;                    Mexico      Acapulco&#xA;                                Buenavista&#xA;                                Chihuahua&#xA;&#xA;                    Canada      Ajax&#xA;                                Brampton&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;writing this code on the offices overview page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('offices') %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives me an output of everything in the whole structure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when writing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('offices').level(1) %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the title from the entry in the first level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do i target a specific entry in the structure?&#xA;Let's say only Albuquerque, Chicago &amp;amp; Chihuahua?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked around but can't seem to find anything in the docs about that. Who can point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="846" LastEditorUserId="250" LastEditDate="2014-09-30T16:18:49.260" LastActivityDate="2014-09-30T17:05:53.397" Title="Targeting entries in a structure" Tags="&lt;structure&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2827" PostTypeId="2" ParentId="2826" CreationDate="2014-09-30T10:48:39.270" Score="2" Body="&lt;p&gt;To get a specific entry you need to know the id or slug of the entry. If the slug for Chicago is &quot;chicago&quot; (you find the slug in the side panel of the entry edit screen), you can get it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set chicagoEntry = craft.entries.slug('chicago') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But hardcoding slugs and id's into templates is rarely a good idea. If you explain a bit more what you're trying to achieve, maybe we can provide a more helpful answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to turn the structure into a menu of sorts, have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;documentation for the {% nav %} function&lt;/a&gt;, it was made specifically for this.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-09-30T10:48:39.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2828" PostTypeId="1" AcceptedAnswerId="2829" CreationDate="2014-09-30T11:17:34.853" Score="5" ViewCount="467" Body="&lt;p&gt;Is it possible for me to create an image transformation that generates a cirle cropped thumbnail?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://static.tumblr.com/3ce5cd2505dc3ed9c22920cdf4258237/v0s6rc6/Mydmwf0wc/tumblr_static_holman_circle.jpg&quot; width=&quot;300&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:49.780" LastActivityDate="2014-09-30T12:30:36.660" Title="Can I &quot;circle crop&quot; an image asset?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2829" PostTypeId="2" ParentId="2828" CreationDate="2014-09-30T11:38:28.890" Score="6" Body="&lt;p&gt;The short answer: No.&#xA;However, as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2476/is-real-crop-a-possibility&quot;&gt;this answer&lt;/a&gt; states, it will be possible to do this in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a tip, I know it doesn't answer your question: it's an effect you can easily achieve with CSS, by rounding the corners to 50%.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-09-30T11:38:28.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2830" PostTypeId="1" AcceptedAnswerId="2834" CreationDate="2014-09-30T12:41:54.337" Score="19" ViewCount="17164" Body="&lt;p&gt;I'm looking for a way to output line break from a text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of the &quot;Allow line breaks&quot; option and I have set that to true. I've then entered text with multiple new lines. However, when this text gets output in the template, there are no line breaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/nl2br.html&quot;&gt;Twig's new line to br function&lt;/a&gt;, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set address = contact.address|nl2br %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this creates &lt;code&gt;&amp;lt;br /&amp;gt;&lt;/code&gt; tags in the text, not the markup - that is, you can actually see the &lt;code&gt;&amp;lt;br /&amp;gt;&lt;/code&gt; in the browser and no actual line breaks are being created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong here? Are there any alternative solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2019-12-11T12:58:30.503" Title="Create line breaks from text field" Tags="&lt;templating&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2831" PostTypeId="2" ParentId="2830" CreationDate="2014-09-30T13:10:11.913" Score="11" Body="&lt;p&gt;You could also add the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot;&gt;&lt;code&gt;raw&lt;/code&gt;&lt;/a&gt; filter, which should prevent the automated escaping.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set address = contact.address|nl2br|raw %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="149" LastEditorUserId="250" LastEditDate="2014-09-30T13:21:22.770" LastActivityDate="2014-09-30T13:21:22.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2832" PostTypeId="1" CreationDate="2014-09-30T13:40:28.733" Score="3" ViewCount="1233" Body="&lt;p&gt;When I try the solution mentioned &lt;a href=&quot;http://buildwithcraft.com/help/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, my site breaks, pages not found. Even the &lt;code&gt;/admin/&lt;/code&gt; pages break, losing all styling. The only page which loads is the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts about why? I was having htaccess issues, but I believe those are all fixed now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the htaccess file in the the top level craft folder&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} ^/blog [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is the root: &#xA;&lt;code&gt;brianfeeney.us/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which contains both:&#xA;&lt;code&gt;brianfeeney.us/blog&lt;/code&gt; (WP)&#xA;&lt;code&gt;brianfeeney.us/craft&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The index.php in my root points towards &lt;code&gt;/blog/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for the help&lt;/p&gt;&#xA;" OwnerUserId="839" LastEditorUserId="839" LastEditDate="2014-10-02T12:35:21.483" LastActivityDate="2015-10-08T20:23:41.370" Title="Removing /index.php/ from url breaks site" Tags="&lt;admin&gt;&lt;index&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2833" PostTypeId="1" AcceptedAnswerId="2835" CreationDate="2014-09-30T13:50:42.830" Score="1" ViewCount="394" Body="&lt;p&gt;how can i output my content in pairs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;div.row &amp;gt;   entry 1 + entry 2&#xA;div.row &amp;gt;   entry 3 + entry 4&#xA;div.row &amp;gt;   entry 5 + entry 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so far i have the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.find({section:'events' ,level: 2 }) %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;&#xA;    {% if loop.index0 is divisible by(2) %}&#xA;    (entry odd output here)&#xA;    {% endif %}&#xA;&#xA;    {% if loop.index is divisible by(2) %}&#xA;    (entry even output here)&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this just gives me a new row for each entry.&#xA;What's the best approach?&lt;/p&gt;&#xA;" OwnerUserId="846" LastActivityDate="2014-09-30T14:34:02.370" Title="How can i output my content in pairs?" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2834" PostTypeId="2" ParentId="2830" CreationDate="2014-09-30T14:00:19.607" Score="32" Body="&lt;p&gt;Expanding from &lt;a href=&quot;https://craftcms.stackexchange.com/users/149/pascal-mollet&quot;&gt;Pascal Mollet&lt;/a&gt;'s answer, this was the solution I came up with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First setting the address variable with the &lt;code&gt;|nl2br&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set address = contact.address|nl2br %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, outputting that variable with the &lt;code&gt;|raw&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{address|raw}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using them both together at once like this (as Pascal suggested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set address = contact.address|nl2br|raw %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;didn't work.&lt;/p&gt;&#xA;" OwnerUserId="467" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-10-01T08:01:57.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2835" PostTypeId="2" ParentId="2833" CreationDate="2014-09-30T14:03:27.353" Score="3" Body="&lt;p&gt;I would go with Twigs &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/batch.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;batch&lt;/code&gt;&lt;/a&gt; filter, which exactly solves your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here an an adapted example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.entries({&#xA;    section: 'events',&#xA;    level: 2&#xA;}).find() %}&#xA;&#xA;{% for row in items|batch(2, 'No item') %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        {% for item in row %}&#xA;            {# Your entry #}&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="149" LastEditorUserId="149" LastEditDate="2014-09-30T14:34:02.370" LastActivityDate="2014-09-30T14:34:02.370" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2836" PostTypeId="2" ParentId="2826" CreationDate="2014-09-30T15:00:43.470" Score="2" Body="&lt;p&gt;Based on your response to the answer from @Andre, you could make a &quot;Featured&quot; lightswitch field and use that in your query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you would add a Lightswitch Field called &quot;Featured&quot; (handle: featured) or something of the sort. Then, from the entry itself you Toggle this on for the one you want to show up on the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code would change to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntry = craft.entries.section('offices').featured(1).first %}&#xA;{{ featuredEntry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This has the tertiary benefit of the CMS controlling which office hours show up on the homepage should they need to be changed by the client. Just be wary if multiple lightswitches are turned &quot;on&quot;. I believe it would take the first one in the sort order in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the comment below, you could solve this by creating a Drop Down field with days of the week as the Key =&gt; Value pairs, and then query your entries based on the day of the week it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dropdown field with a handle of &lt;code&gt;featuredDay&lt;/code&gt; with options:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA; -----------------&#xA;| label  | value  |&#xA; -----------------&#xA;| Sunday | sunday |&#xA; -----------------&#xA;| Monday | monday |&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntry = craft.entries.section('offices').featuredDay(now|date('l')|lower).first %}&#xA;{{ featuredEntry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-09-30T17:05:53.397" LastActivityDate="2014-09-30T17:05:53.397" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2837" PostTypeId="1" AcceptedAnswerId="2840" CreationDate="2014-09-30T17:24:09.763" Score="9" ViewCount="11289" Body="&lt;p&gt;This seems like it should be really simple. I set the field for an image asset, linked it to the entry type I want it associated to, and then uploaded the image in the cms to the folder I specified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, when I call &lt;code&gt;{{ entry.featureImage }}&lt;/code&gt; it should return the object of that image. I want its URL, because I want to place it in a special image tag. &lt;code&gt;&amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ entry.featureImage }}&quot;&amp;gt;&lt;/code&gt; Now I know this returns an error that says &quot;Object could not be converted to string&quot;. Because I need to modify it to get the string of the URL. How can I do this? I feel like I've tried everything and scoured the docs and internet. I cant just attach a &lt;code&gt;.getURL()&lt;/code&gt; or &lt;code&gt;.url&lt;/code&gt; like would make a whole ton of sense. I've even set entry.featureImage as a variable and then called image.url on it. Or &lt;code&gt;.getImg('featureImage')&lt;/code&gt; maybe? But it needs the class of img-responsive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This needs to be possible so that the CMS can allow for images to be specified and uploaded for specific spots in the website.&lt;/p&gt;&#xA;" OwnerUserId="849" LastEditorUserId="250" LastEditDate="2014-10-05T15:55:31.673" LastActivityDate="2014-10-05T15:55:31.673" Title="Fetch Image URL from entry CMS" Tags="&lt;assets&gt;&lt;url&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2839" PostTypeId="1" CreationDate="2014-09-30T18:29:45.087" Score="1" ViewCount="579" Body="&lt;p&gt;I would like to add the 'code' tag to the formatting drop-down. My rich text field is using Standard.json and I am able to remove the current tags, but it's not letting me add additional tags. I have tried adding 'code' like this in my Standard.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingTags: ['p', 'blockquote', 'pre', 'code', 'h1', 'h2' 'h3', 'h4', 'h5']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I realize 'pre' and 'code' are similar but if possible I would like to use code to be semantic.)&lt;/p&gt;&#xA;" OwnerUserId="832" LastActivityDate="2014-10-01T07:45:39.203" Title="How do I add an HTML tag to the formatting drop-down in the rich text editor?" Tags="&lt;richtext&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2840" PostTypeId="2" ParentId="2837" CreationDate="2014-09-30T18:55:23.333" Score="16" Body="&lt;p&gt;I bet this trips up a lot of people at first, but your asset field will return a &lt;strong&gt;ElementCriteriaModel&lt;/strong&gt;, not your image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get to image, you need to fetch it. If your field has only one image, you will do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetches the first image #}&#xA;{% set image = entry.featureImage.first() %}&#xA;{# It's good to check if you actually have an image before trying to get the url #}&#xA;{% if image %}&#xA;    {{ image.url }}&#xA;    {# Or alternatively #}&#xA;    {{ image.getUrl() }}&#xA;    {# If you want to get a specific transform: #}&#xA;    {{ image.getUrl('transformHandle') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#examples&quot;&gt;The Assets fields documentation&lt;/a&gt; got some good examples on the different use cases.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-09-30T18:55:23.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2841" PostTypeId="1" CreationDate="2014-09-30T21:29:22.647" Score="0" ViewCount="1877" Body="&lt;p&gt;Building further on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2826/targeting-entries-in-a-structure&quot;&gt;this problem&lt;/a&gt;, I try to make a loop that exits when the next opening hours or in other case events are found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an event on all days except monday. I added a couple of extra elseif statements in case they drop a couple of events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code (based on the answer below I changed my code)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').level(2) %}&#xA;  {% if entry.dayOfEvent == now|date(&quot;l&quot;) %}&#xA;    {{ entry.dayOfEvent }}&#xA;  {% elseif entry.dayOfEvent == now|date_modify(&quot;+1 day&quot;)|date(&quot;l&quot;) %}&#xA;    {{ entry.dayOfEvent }}&#xA;  {% elseif entry.dayOfEvent == now|date_modify(&quot;+2 days&quot;)|date(&quot;l&quot;) %}&#xA;    {{ entry.dayOfEvent }}&#xA;  {% elseif entry.dayOfEvent == now|date_modify(&quot;+3 days&quot;)|date(&quot;l&quot;) %}&#xA;    {{ entry.dayOfEvent }}&#xA;  {% else %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't seem to do it. It's probably basic stuff, but what am i doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Based on the answer below I changed my code&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output clearly gives me my days. But the {% elseif %} doesn't work, I just get the day outputted as well for all events in that range. Shouldn't it exit the loop as soon as the condition is met? &lt;/p&gt;&#xA;" OwnerUserId="846" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-01T11:42:47.500" Title="if/else loop with (almost) daily events" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2842" PostTypeId="1" CreationDate="2014-09-30T21:48:19.597" Score="10" ViewCount="3018" Body="&lt;p&gt;I'm looking to create an infinite scrolling section of entries on a site we're building. Has anyone tackled this yet? What's the best way to approach this?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2019-11-14T20:53:01.500" Title="Infinite scrolling with Craft?" Tags="&lt;entries&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2843" PostTypeId="2" ParentId="2841" CreationDate="2014-09-30T21:57:30.343" Score="2" Body="&lt;p&gt;It's probably because &lt;code&gt;entry.dayOfEvent&lt;/code&gt; isn't returning exactly what &lt;code&gt;&quot;now&quot;|date_modify('+1 day')&lt;/code&gt; is returning therefore the comparison fails.  Maybe one includes the time and the other doesn't, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see what each is returning by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.dayOfEvent }}&#xA;{{ &quot;now&quot;|date_modify('+1 day') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If they are different formats, then you can make the 2nd one match the format of the first by using &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html#date&quot; rel=&quot;nofollow&quot;&gt;Twig's date format method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-09-30T21:57:30.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2844" PostTypeId="1" CreationDate="2014-10-01T01:01:18.197" Score="3" ViewCount="295" Body="&lt;p&gt;Google Maps for Craft outputs data into script tags to add markers to map with Javascript. Everything works great until a user goes to cache the output of an entries loop. It works upon first page load, but all subsequent page loads do not contain any of the JS at the bottom of the page as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simple example to duplicate this issue. I am not sure what to do about it. In my mind, there should be a way to output JS that can be cached and output to the page without the query running.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    id: 'map', &#xA;    width: '400px', &#xA;    height: '300px',&#xA;    clustering: true&#xA;} %}&#xA;&#xA;{{ craft.googleMaps.map(options) }}&#xA;&#xA;{% cache %}&#xA;&#xA;    {% for entry in craft.entries.section('news') %}&#xA;&#xA;        {{ craft.googleMaps.data('map', entry.map) }}&#xA;&#xA;        test&amp;lt;br&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within my add-on all the methods that use &lt;code&gt;includeJs&lt;/code&gt; behave the same way. But this is just a simple example of what I am doing. I just instantiate an object with some data and include it in the JS.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft()-&amp;gt;templates-&amp;gt;includeJs('new GoogleMaps.MapData('.$id.','.$data-&amp;gt;toJson().','.$this-&amp;gt;jsonEncode($options).');');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For additional information you can see it here in this support thread on the Github repo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/objectivehtml/Google-Maps-for-Craft/issues/12&quot; rel=&quot;nofollow&quot;&gt;https://github.com/objectivehtml/Google-Maps-for-Craft/issues/12&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2018-04-25T16:14:17.680" Title="How does a plugin output JS that can be used within a cache tag?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2845" PostTypeId="1" AcceptedAnswerId="2866" CreationDate="2014-10-01T05:15:12.537" Score="2" ViewCount="167" Body="&lt;p&gt;I am working on a multi-lingual site that contains a few sections in 5 languages (de, en, es, fr, ja). Most of the content however exists only in two languages (de, en). For regular content sections I can indicate which locales should be available. However, I could not find a way to limit the locales for asset meta fields in a similar way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background: Why do I want to limit the number of locales?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My site contains a large number of product descriptions. Each product description can have multiple assets. Each asset has a (&lt;em&gt;non-translatable&lt;/em&gt;) type (e.g. image, PDF, audio sample) and a (&lt;em&gt;translatable&lt;/em&gt;) caption. The captions exist only in the de and en locales. When I import the assets in craft (with a plugin), a content entry for every locale will be created and this leads to a very bloated content table.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can I just delete the unwanted entries in the content table?&lt;/li&gt;&#xA;&lt;li&gt;Should I use a different setup for storing assets (e.g. a special content section with a file field and not asset meta fields)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any help is highly appreciated. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="798" LastActivityDate="2014-10-01T23:57:35.207" Title="Is it possible to limit the locales for asset meta fields?" Tags="&lt;assets&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2846" PostTypeId="2" ParentId="2839" CreationDate="2014-10-01T07:45:39.203" Score="2" Body="&lt;p&gt;Might &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;formattingAdd&lt;/a&gt; be something you can use for this? Not tested, just a quick look at Redactor's options page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: [&#xA;    {&#xA;        tag: 'code',&#xA;        title: 'Code'&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-01T07:45:39.203" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2847" PostTypeId="1" CreationDate="2014-10-01T08:09:34.457" Score="0" ViewCount="117" Body="&lt;p&gt;I have 900 entries that I have imported via the excellent &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;import&lt;/a&gt; plugin. I need these to be set as draft (or 'disabled' status). Is there any way I can do this programatically? I don't fancy doing it manually.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-10-01T08:43:06.527" Title="Batch set entries as draft?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2848" PostTypeId="2" ParentId="2847" CreationDate="2014-10-01T08:43:06.527" Score="2" Body="&lt;p&gt;I asked this in the issues for the plugin and got a very prompt reply, the solution offered works perfectly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/boboldehampsink/import/issues/15&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/import/issues/15&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-10-01T08:43:06.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2849" PostTypeId="1" CreationDate="2014-10-01T08:51:08.390" Score="1" ViewCount="364" Body="&lt;p&gt;So I have a section with 900 entries and I tried to just list them all on the page but Craft seems to choke after about 200 and will just not render any of them. Although I probably don't need to output all 900 it would be good to know what the issue is here?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-10-01T16:56:02.450" Title="Craft chokes on rendering large amounts of entries?" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2850" PostTypeId="1" AcceptedAnswerId="2851" CreationDate="2014-10-01T08:51:53.797" Score="1" ViewCount="327" Body="&lt;p&gt;We need to part translate a site, and by which i mean only certain sections are available in other locales, and only certain Entries in those pages. In order to display these in the front end we simply want to show :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;This entry is also available in French&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;at the base of the entry, and link to a special layout (no nav).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone achieved this - can the locales be called for each entry ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Dan&lt;/p&gt;&#xA;" OwnerUserId="214" LastActivityDate="2014-10-01T09:25:27.977" Title="Show entry content for other available locales" Tags="&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2851" PostTypeId="2" ParentId="2850" CreationDate="2014-10-01T09:12:08.143" Score="1" Body="&lt;p&gt;I think the best way to do this, is by using &lt;code&gt;craft.entries.id().locale()&lt;/code&gt; and checking if any entries are returned (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisEntryInDifferentLocales = craft.entries.id(thisEntry.id).locale('fr') %}&#xA;{% if thisEntryInDifferentLocales | length %}&#xA;    {% for localeEntry in thisEntryInDifferentLocales %}&#xA;       &amp;lt;a href=&quot;{{ localeEntry.url }}&quot;&amp;gt;This entry is also available in {{ localeEntry.locale }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-10-01T09:25:27.977" LastActivityDate="2014-10-01T09:25:27.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2853" PostTypeId="2" ParentId="2849" CreationDate="2014-10-01T09:44:55.570" Score="2" Body="&lt;p&gt;You may need to up your php memory limit. Should be good through Host CP to do, or if locally, edit the php.ini file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, craft will generally max out at 100 entries as default so adding .limit(null) to a request should also help...&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-10-01T09:44:55.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2854" PostTypeId="1" CreationDate="2014-10-01T10:37:41.937" Score="3" ViewCount="3597" Body="&lt;p&gt;Similar to this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2743/output-url-to-section&quot;&gt;Output URL to section&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a section with handle 'places' which defines its URL format as 'places/{slug}'—how do I get the link to the 'places' index page? The question above goes via the entries in that section but that just gets the url of the first entry in that section.&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2019-11-19T02:57:26.873" Title="Get the URL of a section?" Tags="&lt;sections&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2855" PostTypeId="2" ParentId="2854" CreationDate="2014-10-01T10:50:34.557" Score="1" Body="&lt;p&gt;Currently there is no method to get the link to the section's index page. However, if you try to visit &lt;a href=&quot;http://domain.com/sectionhandle/&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/sectionhandle/&lt;/a&gt;, it will will try to load a template named index.html inside a folder named after your sectionhandle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://domain.com/places/ -&amp;gt; templates/**places/index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think that you can easily make that assumption and use that in a link. It's not elegant, and it doesn't take into account locales, but.. It's the only way at the moment, I think.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-10-01T10:50:34.557" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2856" PostTypeId="1" AcceptedAnswerId="2858" CreationDate="2014-10-01T13:32:01.527" Score="1" ViewCount="185" Body="&lt;p&gt;I have my navigation in a &lt;code&gt;Structure&lt;/code&gt; like &lt;a href=&quot;https://i.stack.imgur.com/uMU8Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and I want to build a sub-navigation on my Information page containing Specials, Reviews, and About, but I can't figure out how.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set active_item = craft.entries.section('navigation').nextSiblingOf(48).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't give me what I need (and I really don't like handling with id's).&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="250" LastEditDate="2014-10-08T17:53:49.280" LastActivityDate="2014-10-08T17:53:49.280" Title="How to create sub-nav when using a structured navigation heirarchy?" Tags="&lt;templating&gt;&lt;sections&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2857" PostTypeId="2" ParentId="2844" CreationDate="2014-10-01T13:59:50.147" Score="3" Body="&lt;p&gt;That’s a tricky one, because right now the {% cache %} tag is only focussed on the actual HTML that gets output between its tags, but when you include Javascript using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#includeJs-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService::includeJs&lt;/a&gt;, etc., that’s actually queuing up the Javascript to be output later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the trick here will be to make sure any JS that is included within the {% cache %} tag is also output within the {% cache %} tag:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% cache %}&#xA;    {% for entry in craft.entries.section('news') %}&#xA;&#xA;        {{ craft.googleMaps.data('map', entry.map) }}&#xA;&#xA;        {# Output any queued-up JS #}&#xA;        {{ getFootHtml() }}&#xA;&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn’t a perfect solution because that tag will also output any Javascript that was already queued up before the {% cache %} tag. If there is any, then it will end up getting output twice on requests where the {% cache %} tag already has cached HTML to return. Might be something we can address in a future update though.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-01T13:59:50.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2858" PostTypeId="2" ParentId="2856" CreationDate="2014-10-01T14:45:44.103" Score="5" Body="&lt;p&gt;There is an nice &lt;a href=&quot;http://craftcookbook.net/recipes/77&quot;&gt;recipe on the craftcookbook.net&lt;/a&gt; site from sprocketeer that explains exactly this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topEntry = craft.entries.depth(1).slug('information').first() %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav subEntry in topEntry.getDescendants() %}&#xA;        &amp;lt;li&amp;gt;{{ subEntry.title }}&#xA;            {% ifchildren %}&amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;{% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-01T14:45:44.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2859" PostTypeId="2" ParentId="2849" CreationDate="2014-10-01T16:56:02.450" Score="1" Body="&lt;p&gt;Other than increasing the amount of memory available to PHP like &lt;a href=&quot;https://craftcms.stackexchange.com/a/2853/57&quot;&gt;Simon&lt;/a&gt; suggested, you can also lazy load the entries in batches using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;limit&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#offset&quot; rel=&quot;nofollow noreferrer&quot;&gt;offset&lt;/a&gt; parameters.  This would help keep the memory consumption down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The extra entries would be triggered via infinite scrolling or treeview, etc. depending on how you're displaying them on the front-end.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-01T16:56:02.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2860" PostTypeId="2" ParentId="2844" CreationDate="2014-10-01T16:56:18.877" Score="2" Body="&lt;p&gt;I am posting this answer in addition to Brandon's. His answer is &quot;correct&quot;, but this answer shows the correct code to get the caching using the method Brandon mentioned. Like he said, all the JS that is cached must be included inside the cache tags. So if one wants to cache the output of a map, you must use code similar to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note, the entire map and loop are included in the cache, not just the loop. If you the map isn't included in the cache, you will get a JS error saying the Google Maps API has been instantiated twice (which breaks the whole thing).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;&#xA;    {% set options = {&#xA;        id: 'map', &#xA;        width: '400px', &#xA;        height: '300px',&#xA;        clustering: true&#xA;    } %}&#xA;&#xA;    {{ craft.googleMaps.map(options) }}&#xA;&#xA;    {% for entry in craft.entries.section('news') %}&#xA;&#xA;        {{ craft.googleMaps.data('map', entry.map) }}&#xA;&#xA;        {{ getFootHtml() }}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-10-01T16:56:18.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2861" PostTypeId="1" CreationDate="2014-10-01T19:55:46.077" Score="0" ViewCount="173" Body="&lt;p&gt;The very useful &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Styles plugin&lt;/a&gt; has stopped working for me. I have the little wand in the toolbar, and appropriately styled entries in the drop down, but clicking on them does nothing.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3eDMD.png&quot; alt=&quot;toolbar with dropdown&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Styles JSON Object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;btnName&quot;: &quot;Button Link&quot;,&#xA;    &quot;className&quot;: &quot;redactor_format_button&quot;,&#xA;    &quot;spanClass&quot;: &quot;button_link&quot;&#xA;  },&#xA;  {&#xA;    &quot;btnName&quot;: &quot;air&quot;,&#xA;    &quot;className&quot;: &quot;redactor_format_air&quot;,&#xA;    &quot;spanClass&quot;: &quot;air&quot;&#xA;  },&#xA;  {&#xA;    &quot;btnName&quot;: &quot;water&quot;,&#xA;    &quot;className&quot;: &quot;redactor_format_water&quot;,&#xA;    &quot;spanClass&quot;: &quot;water&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Redactor config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  /* docs say 'json', but really we are allowed basic javascript object */&#xA;  /* allowedTags: need inline for RedactorStyles */&#xA;  allowedTags: ['a', 'blockquote', 'br', 'div', 'dl', 'dt', 'dd', 'em', 'h2', 'h3', 'hr', 'i', 'iframe', 'img', 'inline', 'li', 'ol', 'option', 'p', 'select', 'span', 'strong', 'ul', 'video'],&#xA;  formattingTags: ['p', 'blockquote', 'h2', 'h3'],&#xA;  buttons: ['html','|','formatting','|','bold','italic','|','unorderedlist','orderedlist','|','link','image','video', '|', 'horizontalrule'],&#xA;  plugins: ['fullscreen', 'styles', 'pagebreak', 'clips'],&#xA;  stylesJson: RedactorStyles.stylesJson&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field is using that configuration, and neither &lt;code&gt;Clean up HTML?&lt;/code&gt; nor &lt;code&gt;Purify HTML?&lt;/code&gt; is checked. This used to work, and I don't think I've changed anything (famous last words...)&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-10-02T16:37:44.020" LastActivityDate="2014-10-02T16:37:44.020" Title="Redactor Styles Plugin stopped working" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2862" PostTypeId="1" AcceptedAnswerId="2863" CreationDate="2014-10-01T20:01:43.630" Score="6" ViewCount="3506" Body="&lt;p&gt;Can an integer be formatted as a telephone number using Twig filters or other methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at the 'number_format' filter but it seems to be limited to controlling the number of decimals and how to delimited thousands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example; Integer variable from cms '20304050', output to HTML in twig like this: '20 30 40 50'.&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2014-10-01T21:58:16.557" Title="Can an integer be formatted as a telephone number using Twig?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2863" PostTypeId="2" ParentId="2862" CreationDate="2014-10-01T20:25:04.320" Score="8" Body="&lt;p&gt;Assuming that you always want to add a space after every two digits, something like this using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/split.html&quot; rel=&quot;noreferrer&quot;&gt;split&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot; rel=&quot;noreferrer&quot;&gt;join&lt;/a&gt; filters should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set splitArray = &quot;20304050&quot;|split('', 2) %}&#xA;{% set formattedString = splitArray|join(' ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want a different format, like &lt;code&gt;203 04 050&lt;/code&gt;, then you could use &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;noreferrer&quot;&gt;slice&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstSeg = &quot;20404050&quot;|slice(0, 3) %}&#xA;{% set secondSeg = &quot;20404050&quot;|slice(3, 2) %}&#xA;{% set thirdSeg = &quot;20404050&quot;|slice(5, 3) %}&#xA;&#xA;{% set formattedString = firstSeg ~ ' ' ~ secondSeg ~ ' ' ~ thirdSeg %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-01T21:58:16.557" LastActivityDate="2014-10-01T21:58:16.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2864" PostTypeId="1" CreationDate="2014-10-01T21:36:51.893" Score="4" ViewCount="166" Body="&lt;p&gt;I've set up an archive page as described in the docs... so my archive page url looks something like this &lt;code&gt;http://mysite.dev/news/2014/09&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I then make the title display &lt;strong&gt;Archive for September 2014&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{{ month }}&lt;/code&gt; variable is set as 09 and doing this -&gt; &lt;code&gt;{{ month|date(&quot;F&quot;) }}&lt;/code&gt; outputs &lt;strong&gt;January&lt;/strong&gt; not September.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="802" LastActivityDate="2014-10-01T21:46:08.757" Title="Showing the month on an archive page" Tags="&lt;datetime&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2865" PostTypeId="2" ParentId="2864" CreationDate="2014-10-01T21:46:08.757" Score="7" Body="&lt;p&gt;Figured out a way to do this if anyone who has the same problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if year is defined and month is defined %}&#xA;    {% set archiveDate = year ~ '-' ~ month ~ '-01' %}&#xA;    &amp;lt;h2 class='archive-title'&amp;gt;Archive for {{ archiveDate|date('F') }} - {{ year }}&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="802" LastActivityDate="2014-10-01T21:46:08.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2866" PostTypeId="2" ParentId="2845" CreationDate="2014-10-01T23:57:35.207" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I just delete the unwanted entries in the content table?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, definitely don’t do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to enter captions in a couple languages, fine. Just ignore the other locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your templates you can always have Craft fetch the assets with the DE or EN content, by setting the &lt;code&gt;locale&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set assetLocale = (craft.locale == 'en' ? 'en' : 'de') %}&#xA;&#xA;{% for asset in entry.myAssetsField.locale(assetLocale) %}&#xA;    {{ asset.caption }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-01T23:57:35.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2867" PostTypeId="2" ParentId="2437" CreationDate="2014-10-02T03:33:41.063" Score="5" Body="&lt;p&gt;So looks like I was just missing the extra &lt;code&gt;[]&lt;/code&gt; in the name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[borough][]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since categories are arrays the name also needed to be an array!&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2016-05-14T03:45:40.613" LastActivityDate="2016-05-14T03:45:40.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2868" PostTypeId="2" ParentId="2842" CreationDate="2014-10-02T06:04:55.357" Score="5" Body="&lt;p&gt;To handle this I would use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;noreferrer&quot;&gt;pagination tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would get the URL out of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#previous-next-page-links&quot; rel=&quot;noreferrer&quot;&gt;next link&lt;/a&gt; to determine the URL address to do the ajax call on and pull in the next chunk of content with ajax from that page when you hit a certain scroll point on the page which you would need to configure with javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also because you care about &lt;strong&gt;all&lt;/strong&gt; users even the ones without javascript you will make the next button visible to users without javascript so they can access all the content since they can't &quot;infinite scroll&quot; :)&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-10-02T06:04:55.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2869" PostTypeId="1" AcceptedAnswerId="2885" CreationDate="2014-10-02T08:14:30.367" Score="1" ViewCount="128" Body="&lt;p&gt;Users are falling into the following state:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tried to sign up with public registration&lt;/li&gt;&#xA;&lt;li&gt;Never clicked or never received (or so they claim) the verification email.&lt;/li&gt;&#xA;&lt;li&gt;Users try to sign up and email is already taken&lt;/li&gt;&#xA;&lt;li&gt;Users cannot reset password as their account is not verified.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this a problem? Or am I missing something. Is there a way to activate when they click the reset password link email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from resending verification email manually for all 100+ users is there anything else i can do?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2014-10-02T08:31:16.047" LastActivityDate="2014-10-02T19:26:42.200" Title="Users in odd state of pending and needing password reset" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2870" PostTypeId="1" AcceptedAnswerId="2871" CreationDate="2014-10-02T11:42:59.777" Score="2" ViewCount="1427" Body="&lt;p&gt;How do I change this template code to only return results from the &lt;em&gt;title&lt;/em&gt; field of an entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search result page url would look like this: &lt;code&gt;/search-results?q=joe+blogs&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.section('not thisSection').search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="250" LastEditDate="2014-10-04T18:30:51.500" LastActivityDate="2014-10-04T18:30:51.500" Title="How to search by title field only?" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2871" PostTypeId="2" ParentId="2870" CreationDate="2014-10-02T12:04:26.933" Score="6" Body="&lt;p&gt;This seems to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('not lakeDetails').search('title:' ~ query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="122" LastActivityDate="2014-10-02T12:04:26.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2872" PostTypeId="2" ParentId="2825" CreationDate="2014-10-02T13:43:33.417" Score="0" Body="&lt;p&gt;Looks like I had a combination of two separate issues on my side. Images showed up correctly when I tried it again (also made a craft updated in the meantime), likely some caching or browser issue. On the other hand my FTP client had some encoding issues to display the filenames correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue resolved for me.&lt;/p&gt;&#xA;" OwnerUserId="149" LastActivityDate="2014-10-02T13:43:33.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2873" PostTypeId="1" AcceptedAnswerId="2875" CreationDate="2014-10-02T13:56:04.667" Score="3" ViewCount="1409" Body="&lt;p&gt;I'm taking the month and year from parameters in the url like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('month') %}&#xA;{% set year = craft.request.getParam('year')  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url would look like this: ?month=September&amp;amp;Year=2014&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... and want to return entries from a specific section where the postDate month and year match those parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be very grateful for any pointers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Lee &lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="122" LastEditDate="2014-10-02T14:03:19.900" LastActivityDate="2014-10-02T14:58:51.100" Title="How to filter entries by month and year?" Tags="&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2874" PostTypeId="1" AcceptedAnswerId="2877" CreationDate="2014-10-02T14:10:11.890" Score="5" ViewCount="4910" Body="&lt;p&gt;Is there a tag that can shorten the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentPage = entry.getParent() %}&#xA;{% if parentPage %} &amp;lt;a href=&quot;{{ parentPage.url }}&quot;&amp;gt;{{ parentPage.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Something like &lt;code&gt;{entry.getParentUrl}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="846" LastEditorUserId="250" LastEditDate="2014-10-05T15:54:55.823" LastActivityDate="2014-10-05T15:54:55.823" Title="Is there a tag to get the parents url like {{entry.url}}?" Tags="&lt;templating&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2875" PostTypeId="2" ParentId="2873" CreationDate="2014-10-02T14:58:51.100" Score="6" Body="&lt;p&gt;You could try this (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('month') %}&#xA;{% set year = craft.request.getParam('year')  %}&#xA;&#xA;{% set firstDayOfMonth = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDayOfMonth = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;{% set entries = craft.entries.section('yourSection').postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-02T14:58:51.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2876" PostTypeId="1" CreationDate="2014-10-02T15:01:17.363" Score="1" ViewCount="100" Body="&lt;p&gt;I am having an issue where the activation link sent to a user has expired and when they click the 'resend activation link' on the warning message a new activation link is never sent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added logging into the &lt;code&gt;userservice-&amp;gt;sendActivationEmail&lt;/code&gt; method to see if it's called and it never gets called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="250" LastEditDate="2014-10-03T12:50:08.040" LastActivityDate="2014-10-03T12:50:08.040" Title="Resend Activation Link not sending" Tags="&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-10-03T17:15:26.710" ContentLicense="CC BY-SA 3.0" />
  <row Id="2877" PostTypeId="2" ParentId="2874" CreationDate="2014-10-02T15:04:57.863" Score="9" Body="&lt;p&gt;The shortest way, still checking if the parent exists, is to use (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.parent ? entry.parent.link }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#link&quot;&gt;&lt;code&gt;entry.link&lt;/code&gt;&lt;/a&gt;, or &lt;code&gt;entry.getLink()&lt;/code&gt; gives you the &lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&lt;/code&gt; part.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-02T15:04:57.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2879" PostTypeId="1" AcceptedAnswerId="2987" CreationDate="2014-10-02T17:23:29.903" Score="1" ViewCount="1010" Body="&lt;p&gt;IM running into an issue where I have one page that lists latest restaurant entries in a given section. However I also have a form to filter the entries by postcode (a category element and by cuisine type (tag element).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also required to give some rudimentary search functionality, which for now is governed by a seperate form. Both forms redirect to the same root page,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here i my slimmed down code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set restaurants = craft.entries.section('restaurants').limit(null) %}&#xA;{% set locations = craft.categories.group('postcode').relatedTo(restaurants).limit(null) %}&#xA;{% set types = craft.tags.group('imageTags').relatedTo(restaurants).limit(null) %}&#xA;&#xA;&#xA;{% set l =  craft.request.getParam('l') %}&#xA;{% set t = craft.request.getParam('t') %}&#xA;{% set q = craft.request.getParam('q') %} &#xA;&#xA;&#xA;{% set locId = craft.categories.group('postcode').slug( l ).ids() %} &#xA;{% set locName = craft.categories.group('postcode').slug( l ).first.title %} &#xA;{% set typeId = craft.tags.group('imageTags').name( t ).ids()  %}&#xA;&#xA;&#xA;{% if (l or t) %}&#xA;    {% set relatedTo = ['and'] %}&#xA;&#xA;    {% for id in locId %}&#xA;      {% set relatedTo = relatedTo|merge([id]) %}&#xA;    {% endfor %}&#xA;&#xA;    {% for id in typeId %}&#xA;      {% set relatedTo = relatedTo|merge([id]) %}&#xA;    {% endfor %}&#xA;&#xA;{% else %}&#xA;&#xA;&#xA;{% endif %}&#xA;&#xA;&#xA;{% set params = {&#xA;        section : 'restaurants',&#xA;        limit: 24,&#xA;        relatedTo: relatedTo ? relatedTo, &#xA;        search : q ? q,&#xA;        }&#xA;%}&#xA;&#xA;&#xA;&#xA;{% set entries = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pagination and for loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate entries as galEntries %}&#xA;&#xA;&#xA;&#xA;&#xA;                {% for entry in galEntries %}&#xA;&#xA;                    {% include 'restaurants/includes/_rest-item' %}&#xA;&#xA;                {% endfor %}&#xA;&#xA;&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My form elements&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('restaurants') }}&quot; method=&quot;get&quot; action=&quot;&quot; class=&quot;rest-filter&quot;&amp;gt;&#xA;&#xA;            &amp;lt;label&amp;gt;Filter :&amp;lt;/label&amp;gt;&#xA;&#xA;            &amp;lt;select name=&quot;l&quot; id=&quot;&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;All Locations&amp;lt;/option&amp;gt;&#xA;&#xA;                {% for loc in locations %}&#xA;                &amp;lt;option value=&quot;{{ loc.slug }}&quot; {{ loc.slug == l ? 'selected' }}&amp;gt;{{ loc.title }}&amp;lt;/option&amp;gt;    &#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/select&amp;gt;&#xA;&#xA;            &amp;lt;select name=&quot;t&quot; id=&quot;&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;All Types&amp;lt;/option&amp;gt;&#xA;&#xA;            {% for type in types %}&#xA;                &amp;lt;option value=&quot;{{ type.name }}&quot; {{ type.name == t  ? 'selected' }}&amp;gt;{{ type.name | capitalize }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;/select&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;Filter&quot;&amp;gt;&#xA;&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;        &amp;lt;form action=&quot;{{ url('restaurants') }}&quot; method=&quot;get&quot; action=&quot;&quot; class=&quot;rest-search&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;q&quot; class=&quot;text&quot; value=&quot;{{ searchq }}&quot; placeholder=&quot;Search for restaurants&amp;amp;hellip;&quot; required /&amp;gt;&#xA;                            &amp;lt;button type=&quot;submit&quot;  class=&quot;ss-icon sn-search-button&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works for the most part except for when I only filter by one element. Which throws the following error &lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1116 Too many tables; MySQL can only use 61 tables in a join&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ANy ideas where I'm going wrong?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-10-08T04:00:36.227" Title="Filtering with multiple criteria" Tags="&lt;relations&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2881" PostTypeId="1" AcceptedAnswerId="2886" CreationDate="2014-10-02T19:01:33.560" Score="5" ViewCount="624" Body="&lt;p&gt;I want to use progressive jpg files and want to know if craft image transforms save jpg images as progressive, or can they be made to?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2019-08-02T11:32:09.250" Title="Progressive jpg image transforms?" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2882" PostTypeId="1" AcceptedAnswerId="2883" CreationDate="2014-10-02T19:06:44.047" Score="7" ViewCount="1583" Body="&lt;p&gt;Got myself into a seemingly simple dead-end block with twig syntax. I need to test against multiple items:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment1 = craft.request.firstSegment %}&#xA;{% if segment1 == 'one OR two OR three' %}&#xA;DO SOMETHING&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's going wrong with this bit 'one OR two OR three'? brackets?&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-10-02T19:14:45.820" Title="Testing &quot;if&quot; against multiple segments" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2883" PostTypeId="2" ParentId="2882" CreationDate="2014-10-02T19:14:45.820" Score="8" Body="&lt;p&gt;You've just got quotes wrapped around a simple string. Try something like this instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if segment1 in ['one','two','three'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will check to see if your &lt;code&gt;segment1&lt;/code&gt; value is in the array of possible matches.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-02T19:14:45.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2884" PostTypeId="1" CreationDate="2014-10-02T19:25:15.130" Score="0" ViewCount="169" Body="&lt;p&gt;Any thoughts on how I could let  users know when they go to a page in the backend that/if another user is currently editing that page? I don't need it to lock editing, just to present a notice that it's being looked at/edited by someone else﻿&lt;/p&gt;&#xA;" OwnerUserId="854" LastActivityDate="2014-10-03T21:53:35.487" Title="Page currently being edited by another user notification?" Tags="&lt;admin&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2885" PostTypeId="2" ParentId="2869" CreationDate="2014-10-02T19:26:42.200" Score="0" Body="&lt;p&gt;Yeah... sounds like a registration workflow issue.  If they click on the activation link and it's past the time it's valid, the page does have a link where they can resend it, but that's only going to be helpful if they got the email in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think for now you'll have to use the &quot;Resend Activation Email&quot; button in the CP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-02T19:26:42.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2886" PostTypeId="2" ParentId="2881" CreationDate="2014-10-02T19:35:17.043" Score="2" Body="&lt;p&gt;You can achieve progressive JPGs if your server has &lt;a href=&quot;http://www.imagemagick.org/&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; installed, but it doesn't look like the &lt;a href=&quot;https://github.com/avalanche123/Imagine&quot; rel=&quot;nofollow&quot;&gt;image processing library&lt;/a&gt; that Craft is using has added support for it, yet.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-02T19:35:17.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2887" PostTypeId="2" ParentId="2876" CreationDate="2014-10-02T20:14:24.727" Score="1" Body="&lt;p&gt;Definitely a bug and just fixed it for the next release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-02T20:14:24.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2888" PostTypeId="1" CreationDate="2014-10-02T21:46:56.190" Score="1" ViewCount="330" Body="&lt;p&gt;It would be really nice to create a new entry in a section (say &quot;Dates&quot;-channel) direct from a related entries field in another section (say &quot;Events&quot;-channel). Is this possible already, or are there any plugins for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have asked this before on Google+, but not sure if it's been answered.&lt;/p&gt;&#xA;" OwnerUserId="94" LastEditorUserId="250" LastEditDate="2014-10-04T18:37:51.853" LastActivityDate="2016-09-18T06:05:44.990" Title="Create new entry from related Entry field" Tags="&lt;relations&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2889" PostTypeId="1" AcceptedAnswerId="2890" CreationDate="2014-10-02T22:17:07.887" Score="1" ViewCount="198" Body="&lt;p&gt;Its it possible to use the localization feature to create regional site versions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently when I attempt to use this feature I can only view pages in my locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Apple.com website shows a great example of what we're trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.apple.com/au/&#xA;http://www.apple.com/nz/&#xA;http://www.apple.com/uk/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We'd like to create new entries and have a draft appear in all regional sub directories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.acme.com/nz/news/news-release&#xA;http://www.acme.com/au/news/news-release&#xA;http://www.acme.com/uk/news/news-release&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main point is we want the entire site open to users from anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're not yet concerned with translations either.&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2016-05-25T23:07:47.227" Title="Apple.com style Localization" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2890" PostTypeId="2" ParentId="2889" CreationDate="2014-10-02T23:30:39.687" Score="3" Body="&lt;p&gt;I had some helpful advice via Craft's support channels. Here was the solution I arrived at with their assistance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can hard code the locale in index.php in the doc root.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_LOCALE', $locale);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The normal approach seems to be that multiple index.php pages can be used in a multi-locale site. I prefered to keep the one, so I used this tiny hack that derives from the url what the desired locale is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;$url_folder = substr(substr($_SERVER[&quot;REQUEST_URI&quot;],1), 0,&#xA;    strpos(substr($_SERVER[&quot;REQUEST_URI&quot;],1), &quot;/&quot;));&#xA;$locale = 'en_nz';&#xA;&#xA;if($url_folder === 'worldwide') {&#xA;    $locale = 'en_zz';&#xA;}&#xA;else {&#xA;    $locale = 'en_' . $url_folder;&#xA;}&#xA;&#xA;define('CRAFT_LOCALE', $locale);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This hack is confined to the index.php so it seems pretty clean.&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2014-10-02T23:30:39.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2891" PostTypeId="1" AcceptedAnswerId="2892" CreationDate="2014-10-03T00:27:08.167" Score="2" ViewCount="82" Body="&lt;p&gt;I'm trying to make a rather bullet proof front-end template that can toggle a sign up link based on if &lt;a href=&quot;http://buildwithcraft.com/docs/users#public-registration&quot; rel=&quot;nofollow&quot;&gt;public registration&lt;/a&gt; is enabled or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can query to see if the system currently has &lt;a href=&quot;http://buildwithcraft.com/docs/users#public-registration&quot; rel=&quot;nofollow&quot;&gt;public registration&lt;/a&gt; turned &lt;code&gt;on&lt;/code&gt; from the front-end?&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-10-03T00:48:17.733" Title="How can you check if &quot;public user registration&quot; is turned on or off on the front-end?" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2892" PostTypeId="2" ParentId="2891" CreationDate="2014-10-03T00:48:17.733" Score="3" Body="&lt;p&gt;You can write a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that has a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt; that exposes Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/SystemSettingsService#getSetting-detail&quot; rel=&quot;nofollow&quot;&gt;SystemSettingsService-&gt;getSettings()&lt;/a&gt; method like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function isPublicRegistrationEnabled()&#xA;{&#xA;    return craft()-&amp;gt;systemSettings-&amp;gt;getSetting('users', 'allowPublicRegistration');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd call it from the template via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.myAwesomePlugin.isPublicRegistrationEnabled() %}&#xA;    Enabled!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-03T00:48:17.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2893" PostTypeId="1" CreationDate="2014-10-03T08:42:55.150" Score="0" ViewCount="163" Body="&lt;p&gt;I'm finding that the structures view in CP is really slow with the amount of entries I have in it. The vast majority of these will be in draft for some time yet, however. I've had a look through the source of craft.js and hacked it a bit to just show the live entries by default just to see what would happen. The result is the CP is way more responsive in this view but obviously the status button doesn't reflect the right view any more and it's not a good idea to be doing this anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there scope to make this configurable via a plugin or something?&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="770" LastEditDate="2014-10-03T09:04:53.353" LastActivityDate="2015-02-20T01:27:00.837" Title="Default to only showing 'Live' entries in CP?" Tags="&lt;control-panel&gt;&lt;config&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2894" PostTypeId="1" AcceptedAnswerId="5215" CreationDate="2014-10-03T11:02:57.710" Score="1" ViewCount="196" Body="&lt;p&gt;I am using a testing library and while trying to load Craft through bootstrap with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require '&amp;lt;full path here to&amp;gt;/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(but with the real path)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dumped the error to a html file from the console and get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://dl.dropboxusercontent.com/s/uc89jpwf3zwf68f/2014-10-03%20at%206.57%20pm%202x.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that Ben Parizek got a similar error (but i don't believe it was while using bootstrap only from the command line) in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2081/undefined-property-craft-webapprequest&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried setting cache to file in general.php and also cleared all caches in craft.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-12-11T05:58:08.887" Title="Getting error when using bootstrap: Craft\WebApp::$request" Tags="&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2895" PostTypeId="1" AcceptedAnswerId="2896" CreationDate="2014-10-03T11:49:15.253" Score="7" ViewCount="3104" Body="&lt;p&gt;Is there any way to create a custom log in Craft? I need to log some actions inside a controller/service in a custom plugin.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2018-09-20T21:24:44.713" Title="Custom Log in Craft" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2896" PostTypeId="2" ParentId="2895" CreationDate="2014-10-03T12:01:58.670" Score="14" Body="&lt;p&gt;You can do this in your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ExamplePlugin::log('the is the log message');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the log method has the following signature:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;log($msg, $level = LogLevel::Info, $force = false)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;documentation &lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-baseplugin.html#public-properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;is here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your log will appear in the app/storage/runtime/logs/pluginname.log&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="222" LastEditDate="2018-09-20T21:24:44.713" LastActivityDate="2018-09-20T21:24:44.713" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2898" PostTypeId="1" AcceptedAnswerId="2899" CreationDate="2014-10-03T16:14:03.447" Score="7" ViewCount="16302" Body="&lt;p&gt;I want to create a comma separated list of categories to which an entry belongs, but without the trailing slash on the last element... can't work out how to remove it!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.mediaType %}&#xA;    &amp;lt;b&amp;gt;{{ category.title }}&amp;lt;/b&amp;gt;,&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2019-02-27T06:33:47.363" Title="Remove trailing comma from an output loop?" Tags="&lt;loop&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2899" PostTypeId="2" ParentId="2898" CreationDate="2014-10-03T16:25:39.250" Score="15" Body="&lt;p&gt;There is a special tag inside for loops you can use for this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.mediaType %}&#xA;    &amp;lt;b&amp;gt;{{ category.title }}&amp;lt;/b&amp;gt;,&#xA;    {% if loop.last %}&#xA;        &amp;lt;b&amp;gt;{{ category.title }}&amp;lt;/b&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full list &lt;a href=&quot;https://gist.github.com/brandonkelly/8584132#craft-2&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-10-03T16:25:39.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2900" PostTypeId="1" CreationDate="2014-10-03T16:42:42.647" Score="1" ViewCount="1118" Body="&lt;p&gt;I have a video Object with a duration property formatted in &lt;a href=&quot;http://www.ostyn.com/standards/scorm/samples/ISOTimeForSCORM.htm&quot; rel=&quot;nofollow&quot;&gt;SCORM 2004 time format&lt;/a&gt;. Like so: &lt;strong&gt;PT51M55S&lt;/strong&gt;. How do i convert this into a human readable time format like: &lt;strong&gt;51:55&lt;/strong&gt;? &lt;code&gt;date()&lt;/code&gt; does not seem to work obviously.&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2014-10-03T17:52:57.083" LastActivityDate="2014-10-03T18:08:23.067" Title="Twig: Convert time format" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;format&gt;&lt;conversion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2901" PostTypeId="2" ParentId="2900" CreationDate="2014-10-03T17:41:10.917" Score="2" Body="&lt;p&gt;I'm not sure this is possible in Twig alone, but it should be easy enough in PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, you could write a Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that adds a custom Twig extension that has a ScormIt filter that uses PHP's &lt;a href=&quot;http://php.net/manual/en/dateinterval.construct.php&quot; rel=&quot;nofollow&quot;&gt;DateInterval&lt;/a&gt; class to output it in the format that you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ videoObject.duration|ScormIt }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-03T18:08:23.067" LastActivityDate="2014-10-03T18:08:23.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2902" PostTypeId="2" ParentId="804" CreationDate="2014-10-03T18:51:58.770" Score="1" Body="&lt;p&gt;There is now the &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow&quot;&gt;Internal Assets Plugin&lt;/a&gt; which allows to place assets above the web root and works as expected.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-10-03T18:51:58.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2903" PostTypeId="1" AcceptedAnswerId="2911" CreationDate="2014-10-03T20:28:03.410" Score="3" ViewCount="740" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt; shows how to add additional fields as input fields or checkboxes. But I can't figure out how to add drop-down fields. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select&amp;gt;&#xA;  &amp;lt;option value=&quot;——&quot; selected=&quot;selected&quot;&amp;gt;Please select...&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option name=&quot;message[model][]&quot; value=&quot;volvo&quot;&amp;gt;Volvo&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option name=&quot;message[model][]&quot; value=&quot;saab&quot;&amp;gt;Saab&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option name=&quot;message[model][]&quot; value=&quot;mercedes&quot;&amp;gt;Mercedes&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option name=&quot;message[model][]&quot; value=&quot;audi&quot;&amp;gt;Audi&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="832" LastEditorUserId="45" LastEditDate="2018-03-24T18:19:09.827" LastActivityDate="2018-03-24T18:19:09.827" Title="Adding a drop-down to Contact Form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2904" PostTypeId="1" CreationDate="2014-10-03T20:30:12.023" Score="0" ViewCount="83" Body="&lt;p&gt;I am creating a resources page, on which a resource can be downloaded after filling or submitting a form. This form is having user info fields like first name, last name, email etc. Could anyone please suggest me how can I implement it in Craft.﻿&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2014-10-04T02:55:53.977" Title="Download resource form page" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2905" PostTypeId="1" AcceptedAnswerId="2955" CreationDate="2014-10-03T20:43:36.593" Score="1" ViewCount="807" Body="&lt;p&gt;Having problems logging to the console using &lt;code&gt;log&lt;/code&gt; from within an &lt;code&gt;onSaveEntry&lt;/code&gt; or &lt;code&gt;onSaveUser&lt;/code&gt; event. Just a simple test below, but will be critical for error logs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    BusinessLogicPlugin::log('init');&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) &#xA;    {&#xA;        Craft::log('onSaveEntry');&#xA;        BusinessLogicPlugin::log('onSaveEntry');&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'init' gets logged fine, but not 'onSaveEntry'. I seem to be able to log other events fine, like &lt;code&gt;plugins.loadPlugins&lt;/code&gt;. I have also confirmed that the event is firing via other tests. Is the &lt;code&gt;log&lt;/code&gt; function not available when the &lt;code&gt;onSaveEntry&lt;/code&gt; event fires? Scope issue? bug? Or am I missing something else? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-05T23:16:26.667" LastActivityDate="2014-10-06T18:10:12.817" Title="How to log info from an onSaveEntry event?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2906" PostTypeId="1" AcceptedAnswerId="2907" CreationDate="2014-10-03T21:07:47.383" Score="2" ViewCount="108" Body="&lt;p&gt;I created a cron for an import and i pointed it to a Craft controller. Everything is working as expected but im getting a strange output after the die() call. It is something starting with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Import finished&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;&#xA;/*&amp;lt;![CDATA[*/&#xA;if (typeof(console) == 'object')&#xA;{&#xA;        console.groupCollapsed(&quot;Application Log&quot;);&#xA;&#xA;                console.groupCollapsed(&quot;GET info&quot;);&#xA;        console.log(&quot;[20:51:21.230][info][application]\n&quot;);&#xA;        console.groupEnd();&#xA;        console.groupCollapsed(&quot;Info om informasjonskapsel&quot;);&#xA;        console.log(&quot;[20:51:21.230][info][application]\n$_GET=array (\n  \'p\' =&amp;gt; \'actions/garp/cron/changeStock\',\n)\n\n&quot;);&#xA;        console.groupEnd();&#xA;        console.groupCollapsed(&quot;SERVER info&quot;);&#xA;        console.log(&quot;[20:51:21.230][info][application]\n$_SERVER=array (\n  \'REDIRECT_HTTPS\' =&amp;gt; \'on\',\n  \'REDIRECT_SSL_TLS_SNI\' =&amp;gt; \'staging.alfa.rrdev.co\',\n  \'REDIRECT_STATUS\' =&amp;gt; \'200\',\n  \'HTTPS\' =&amp;gt; \'on\',\n  \'SSL_TLS_SNI\' =&amp;gt; \'staging.alfa.rrdev.co\',\n  \'HTTP_USER_AGENT\' =&amp;gt; \'Wget/1.15 (linux-gnu)\',\n  \'HTTP_ACCEPT\' =&amp;gt; \'*/*\',\n  \'HTTP_HOST\' =&amp;gt; \'staging.alfa.rrdev.co\',\n  \'HTTP_CONNECTION\' =&amp;gt; \'Keep-Alive\',\n  \'PATH\' =&amp;gt; \'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\',\n  \'SERVER_SIGNATURE\' =&amp;gt; \'&amp;lt;address&amp;gt;Apache/2.4.7 (Ubuntu) Server at staging.alfa.rrdev.co Port 443&amp;lt;\/address&amp;gt;\n\',\n  \'SERVER_SOFTWARE\' =&amp;gt; \'Apache/2.4.7 (Ubuntu)\',\n  \'SERVER_NAME\' =&amp;gt; \'staging.alfa.rrdev.co\',\n  \'SERVER_ADDR\' =&amp;gt; \'172.31.34.161\',\n  \'SERVER_PORT\' =&amp;gt; \'443\',\n  \'REMOTE_ADDR\' =&amp;gt; \'54.76.237.6\',\n  \'DOCUMENT_ROOT\' =&amp;gt; \'/var/www/alfa/public\',\n  \'REQUEST_SCHEME\' =&amp;gt; \'https\',\n  \'CONTEXT_PREFIX\' =&amp;gt; \'\',\n  \'CONTEXT_DOCUMENT_ROOT\' =&amp;gt; \'/var/www/alfa/public\',\n  \'SERVER_ADMIN\' =&amp;gt; \'[no address given]\',\n  \'SCRIPT_FILENAME\' =&amp;gt; \'/var/www/alfa/public/index.php\',\n  \'REMOTE_PORT\' =&amp;gt; \'51921\',\n  \'REDIRECT_QUERY_STRING\' =&amp;gt; \'p=actions/garp/cron/changeStock\',\n  \'REDIRECT_URL\' =&amp;gt; \'/actions/garp/cron/changeStock\',\n  \'GATEWAY_INTERFACE\' =&amp;gt; \'CGI/1.1\',\n  \'SERVER_PROTOCOL\' =&amp;gt; \'HTTP/1.1\',\n  \'REQUEST_METHOD\' =&amp;gt; \'GET\',\n  \'QUERY_STRING\' =&amp;gt; \'p=actions/garp/cron/changeStock\',\n  \'REQUEST_URI\' =&amp;gt; \'/actions/garp/cron/changeStock\',\n  \'SCRIPT_NAME\' =&amp;gt; \'/index.php\',\n  \'PHP_SELF\' =&amp;gt; \'/index.php\',\n  \'REQUEST_TIME_FLOAT\' =&amp;gt; 1412369481.227,\n  \'REQUEST_TIME\' =&amp;gt; 1412369481,\n)&quot;);&#xA;        console.groupEnd();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code (actionChangeStock) ends with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if (craft()-&amp;gt;httpSession-&amp;gt;get('garpfailed')) {&#xA;        echo &quot;Import failed&quot;;&#xA;    } else {&#xA;        echo &quot;Import finished&quot;;&#xA;    }&#xA;    die();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and cron call is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wget -O /home/ubuntu/cronStock https://domain.com/actions/garp/cron/changeStock&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this expected? Im getting a 9mb file when i should get only Import failed or Import finished.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-10-03T21:17:29.620" Title="Data after die()" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2907" PostTypeId="2" ParentId="2906" CreationDate="2014-10-03T21:17:29.620" Score="2" Body="&lt;p&gt;That's &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; output (usually gets sent to your browser's console).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to run your plugin in devMode, add this to your plugin's &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;log-&amp;gt;removeRoute('WebLogRoute');&#xA;craft()-&amp;gt;log-&amp;gt;removeRoute('ProfileLogRoute');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it will get rid of the extra output.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-03T21:17:29.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2908" PostTypeId="2" ParentId="2884" CreationDate="2014-10-03T21:53:35.487" Score="1" Body="&lt;p&gt;It would definitely have to be a plugin, but I'm not sure the right events are available for a plugin to pull it off right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like there would need to be at least two that need to be created.  Some &lt;code&gt;onDisplayEntry&lt;/code&gt; event that gets fired as soon as an entry page is viewed and another &lt;code&gt;onEditEntry&lt;/code&gt; event that gets fired over AJAX as soon as any field value changes.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-03T21:53:35.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2909" PostTypeId="1" CreationDate="2014-10-03T23:57:42.607" Score="8" ViewCount="18642" Body="&lt;p&gt;Is it not possible to define multiple conditions in an if statement?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if foo == 'x' || foo == 'y' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried this and got an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;punctuation&quot; of value &quot;|&quot; (&quot;name&quot; expected)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="587" LastEditorUserId="250" LastEditDate="2014-10-04T13:27:27.123" LastActivityDate="2014-10-04T15:55:20.940" Title="Multiple conditions in an if statement?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2910" PostTypeId="2" ParentId="2909" CreationDate="2014-10-04T00:00:09.547" Score="20" Body="&lt;p&gt;Twig doesn't accept &lt;code&gt;||&lt;/code&gt; or &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;... Try using &lt;code&gt;or&lt;/code&gt; and &lt;code&gt;and&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if foo == 'x' or foo == 'y' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Important to note, &lt;strong&gt;they must be lowercase&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to take a look at &lt;a href=&quot;https://craftcms.stackexchange.com/q/2882/45&quot;&gt;this question&lt;/a&gt;, which shows another way to write a similar condition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if foo in ['x', 'y'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-04T15:55:20.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2911" PostTypeId="2" ParentId="2903" CreationDate="2014-10-04T02:43:02.603" Score="6" Body="&lt;p&gt;It's definitely possible, your HTML is just a little off...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When dealing with a dropdown menu, the &lt;code&gt;name&lt;/code&gt; attribute should be part of the &lt;code&gt;select&lt;/code&gt; tag, not each individual option:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;message[model]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;——&quot; selected=&quot;selected&quot;&amp;gt;Please select...&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;volvo&quot;&amp;gt;Volvo&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;saab&quot;&amp;gt;Saab&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;mercedes&quot;&amp;gt;Mercedes&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;audi&quot;&amp;gt;Audi&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-04T02:43:02.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2912" PostTypeId="2" ParentId="2904" CreationDate="2014-10-04T02:55:53.977" Score="3" Body="&lt;p&gt;It depends to some extent whether the form is a login/registration form (to a user account) or just an information form, that you are saving in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the resources page is restricted and requires login, then you should place &lt;code&gt;{% requireLogin %}&lt;/code&gt; at the top of your resources template. If anyone requests this page they will automatically be redirected to the login page, and after a successful login, will be routed back to the original request, which was the resources page. The login page can have a link to 'create account' with the additional fields you need, if they don't already have one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is just an information form and not for login then you can simply create a form with the required fields. Submit the form using &lt;code&gt;action/saveEntry&lt;/code&gt; along with a hidden field called &lt;code&gt;redirect&lt;/code&gt; as explained &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;path/to/resources&quot;&amp;gt;&#xA;    ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not secure however. If you need to make certain that they just don't go straight to the resources page without filling out the form, then you can test for the existence of an &lt;code&gt;entry.id&lt;/code&gt; on the resources page (which is what is returned from a successful &lt;code&gt;entries/saveEntry&lt;/code&gt;), and redirect them back to the form again if not defined. However, this would make the resources page viewable only once (unless you set a cookie or store session data, etc). And they would have to fill out the form every time they wanted to view it, which doesn't sound like what you want. In which case go with the login route above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are example templates for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;login&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;user registration&lt;/a&gt;, and others (more links at bottom left of those pages). &lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-04T02:55:53.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2914" PostTypeId="2" ParentId="2898" CreationDate="2014-10-04T04:17:50.333" Score="14" Body="&lt;p&gt;While your conditional is complete personally preference I would do the following as I find it slightly easier to read. Note the use of the &lt;code&gt;{%- if -%}&lt;/code&gt; to trim &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#whitespace-control&quot;&gt;whitespace&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.mediaType %}&#xA;    &amp;lt;b&amp;gt;{{ category.title }}&amp;lt;/b&amp;gt;&#xA;    {%- if not loop.last -%}&#xA;      ,&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-10-04T04:17:50.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2915" PostTypeId="1" CreationDate="2014-10-04T16:11:24.783" Score="5" ViewCount="1468" Body="&lt;p&gt;How can I assign a user group to a user when it's created through the front end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: So a few more details. I see there are some great answers if you want to put all users in one group, but unfortunately that's not the case. I have different forms for different groups. Ideally I would like to have checkboxes on the front end you I can choose which group they are assigned to.&lt;/p&gt;&#xA;" OwnerUserId="858" LastEditorUserId="858" LastEditDate="2014-10-05T08:39:32.557" LastActivityDate="2017-07-18T23:47:47.310" Title="Automatically assign a user group" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2916" PostTypeId="1" CreationDate="2014-10-04T18:09:30.427" Score="1" ViewCount="421" Body="&lt;p&gt;After I install craft, I am getting the following error when trying to load the website including the admin page: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Stack trace:&#xA;PHP   1. {main}() \aspace\index.php:0&#xA;PHP   2. require_once() \aspace\index.php:14&#xA;PHP   3. CApplication-&amp;gt;run() \aspace\craft\app\index.php:35&#xA;PHP   4. Craft\WebApp-&amp;gt;processRequest() \aspace\craft\app\framework\base\CApplication.php:180&#xA;PHP   5. Craft\UserSessionService-&amp;gt;requireLogin() \aspace\craft\app\etc\web\WebApp.php:272&#xA;PHP   6. CHttpRequest-&amp;gt;redirect() \aspace\craft\app\services\UserSessionService.php:371&#xA;PHP   7. CApplication-&amp;gt;end() \aspace\craft\app\framework\web\CHttpRequest.php:805&#xA;PHP   8. CApplication-&amp;gt;handleError() \aspace\craft\app\framework\base\CApplication.php:0&#xA;PHP   9. CErrorHandler-&amp;gt;handle() \aspace\craft\app\framework\base\CApplication.php:816&#xA;PHP  10. Craft\ErrorHandler-&amp;gt;handleError() \aspace\craft\app\framework\base\CErrorHandler.php:131&#xA;PHP  11. CErrorHandler-&amp;gt;handleError() \aspace\craft\app\etc\errors\ErrorHandler.php:152&#xA;PHP  12. CErrorHandler-&amp;gt;render() \aspace\craft\app\framework\base\CErrorHandler.php:289&#xA;PHP  13. CWebApplication-&amp;gt;runController() \aspace\craft\app\framework\base\CErrorHandler.php:331&#xA;PHP  14. CController-&amp;gt;run() \aspace\craft\app\framework\web\CWebApplication.php:282&#xA;PHP  15. CController-&amp;gt;runActionWithFilters() \aspace\craft\app\framework\web\CController.php:265&#xA;PHP  16. CController-&amp;gt;runAction() \aspace\craft\app\framework\web\CController.php:286&#xA;PHP  17. CInlineAction-&amp;gt;runWithParams() \aspace\craft\app\framework\web\CController.php:308&#xA;PHP  18. Craft\TemplatesController-&amp;gt;actionRenderError() \aspace\craft\app\framework\web\actions\CInlineAction.php:49&#xA;PHP  19. Craft\BaseController-&amp;gt;renderTemplate() \aspace\craft\app\controllers\TemplatesController.php:190&#xA;PHP  20. Craft\TemplatesService-&amp;gt;render() \aspace\craft\app\controllers\BaseController.php:98&#xA;PHP  21. Twig_Environment-&amp;gt;render() \aspace\craft\app\services\TemplatesService.php:220&#xA;PHP  22. Twig_Environment-&amp;gt;loadTemplate() \aspace\craft\app\vendor\twig\twig\lib\Twig\Environment.php:292&#xA;PHP  23. __TwigTemplate_d77269d0acd17023cd9970dd5812452d2a881ef03373e6e22c0d80eb68481e00-&amp;gt;__construct() \aspace\craft\app\vendor\twig\twig\lib\Twig\Environment.php:345&#xA;PHP  24. Twig_Environment-&amp;gt;loadTemplate() \aspace\craft\storage\runtime\compiled_templates\d7\72\69d0acd17023cd9970dd5812452d2a881ef03373e6e22c0d80eb68481e00.php:10&#xA;PHP  25. __TwigTemplate_9fccce442511366b01108e1e704c62f53125ce92b05eb6545ea02e38a06a15b3-&amp;gt;__construct() \aspace\craft\app\vendor\twig\twig\lib\Twig\Environment.php:345&#xA;PHP  26. Twig_Environment-&amp;gt;loadTemplate() \aspace\craft\storage\runtime\compiled_templates\9f\cc\ce442511366b01108e1e704c62f53125ce92b05eb6545ea02e38a06a15b3.php:10&#xA;PHP  27. Twig_Environment-&amp;gt;getTemplateClass() \aspace\craft\app\vendor\twig\twig\lib\Twig\Environment.php:323&#xA;PHP  28. Craft\TemplateLoader-&amp;gt;getCacheKey() \aspace\craft\app\vendor\twig\twig\lib\Twig\Environment.php:265&#xA;PHP  29. Craft\TemplateLoader-&amp;gt;_findTemplate() \aspace\craft\app\etc\templating\twigextensions\TemplateLoader.php:71&#xA;PHP  30. Craft\TemplatesService-&amp;gt;findTemplate() \aspace\craft\app\etc\templating\twigextensions\TemplateLoader.php:119&#xA;PHP  31. Craft\TemplatesService-&amp;gt;_validateTemplateName() \aspace\craft\app\services\TemplatesService.php:835&#xA;PHP  32. Craft\PathHelper::ensurePathIsContained() \aspace\craft\app\services\TemplatesService.php:1178&#xA;PHP  33. Craft\HttpRequestService-&amp;gt;decodePathInfo() \aspace\craft\app\helpers\PathHelper.php:29&#xA;PHP  34. Craft\StringHelper::convertToUTF8() \aspace\craft\app\services\HttpRequestService.php:1072&#xA;PHP  35. Craft\StringHelper::getEncoding() \aspace\craft\app\helpers\StringHelper.php:390&#xA;PHP  36. mb_detect_encoding() \aspace\craft\app\helpers\StringHelper.php:460&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me with this error?&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-10-04T18:25:01.777" Title="PHP error after installation" Tags="&lt;install&gt;&lt;php&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2917" PostTypeId="2" ParentId="2916" CreationDate="2014-10-04T18:25:01.777" Score="2" Body="&lt;p&gt;Problem was being caused because I was trying to access the server through 'localhost' instead of '127.0.0.1'.&lt;/p&gt;&#xA;" OwnerUserId="666" LastActivityDate="2014-10-04T18:25:01.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2918" PostTypeId="2" ParentId="2915" CreationDate="2014-10-04T21:05:28.403" Score="7" Body="&lt;p&gt;Under Settings &gt; Users &gt; Settings Tab there is an option to &lt;code&gt;allow public registration&lt;/code&gt; and &lt;code&gt;Default User Group&lt;/code&gt; with a drop down that lets you select a user group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more flexibility, you could also write a simple plugin with an &lt;code&gt;init&lt;/code&gt; function defined in the primary plugin class that listens to the &lt;code&gt;saveUser&lt;/code&gt; event, and assigns a user group based on some criteria that you define — perhaps test the value of a custom user field on users (that is a hidden field on the registration form).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*UPDATED to assign group based on checkbox field called 'groupPreference':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;class BusinessLogicPlugin extends BasePlugin {&#xA;  public function getName() {&#xA;     return 'Business Logic';&#xA;  }&#xA;  public function getVersion() {&#xA;     return '0.1';&#xA;  }&#xA;  public function getDeveloper() {&#xA;     return craft()-&amp;gt;getSiteName();&#xA;  }&#xA;  public function getDeveloperUrl() {&#xA;     return 'http://mysite.com';&#xA;  }&#xA;  public function init() {&#xA;     parent::init();&#xA;&#xA;     craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;        // only fire if new user&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;           // retrieve the userModel from the event&#xA;           $user = $event-&amp;gt;params['user'];&#xA;           // retrieve the groupPreference field content&#xA;           $groupPreference = $user-&amp;gt;getContent()-&amp;gt;groupPreference;&#xA;           // create an empty array to store group ids&#xA;           $groups = array();&#xA;&#xA;           // test for values in groupPreference array&#xA;           if (in_array(&quot;group1&quot;, $groupPreference)) {&#xA;              $groups[] = 1;&#xA;           }&#xA;           if (in_array(&quot;group2&quot;, $groupPreference)) {&#xA;              $groups[] = 2;&#xA;           }&#xA;           if (in_array(&quot;group3&quot;, $groupPreference)) {&#xA;              $groups[] = 3;&#xA;           }&#xA;           // assign the user to the groups&#xA;           $_POST['groups'] = $groups;&#xA;        }         &#xA;     });&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Haven't tested, but should be pretty close. Please comment if you see an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind this event will fire, whenever this field is defined, even when saving a user through the CP. So you would have to delete the value before reassigning the user to a different group, or they will just get reassigned.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="5740" LastEditDate="2017-07-18T23:47:47.310" LastActivityDate="2017-07-18T23:47:47.310" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2919" PostTypeId="1" AcceptedAnswerId="2921" CreationDate="2014-10-04T22:06:42.050" Score="4" ViewCount="931" Body="&lt;p&gt;One of my Craft websites is taking a long time (30+ seconds) to load. The /admin area also loads slowly. I have other installs of Craft on the same server that don't experience this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any debugging tools built into Craft to see which part of the site is taking the long time to load?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some server information: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DigitalOcean instance in SF with 2GB ram&lt;/li&gt;&#xA;&lt;li&gt;Nginx 1.6.0 (set up through Forge). &lt;/li&gt;&#xA;&lt;li&gt;PHP 5.5.12-2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have tried a couple things: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Disabling gzip (I recently enabled it)&lt;/li&gt;&#xA;&lt;li&gt;Restarting the server&lt;/li&gt;&#xA;&lt;li&gt;Changing the mysql connection address from localhost to 127.0.0.1 (also tried server IP)&lt;/li&gt;&#xA;&lt;li&gt;Enabling memcached as the cache type&lt;/li&gt;&#xA;&lt;li&gt;Clearing cache/rebuild assets/reindex search&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The error logs don't show anything unusual. &lt;/p&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2014-10-04T22:20:20.347" LastActivityDate="2014-10-04T23:07:52.710" Title="Website taking 30+ seconds to load" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2920" PostTypeId="2" ParentId="2915" CreationDate="2014-10-04T22:54:12.980" Score="3" Body="&lt;p&gt;To have a new user automatically assigned to a user group, there are two easy ways to do it.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(1) If the user registers through a front-end form:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can pre-set their user group by going to Settings &gt; Users &gt; Settings, and selecting the &quot;Allow public registration?&quot; checkbox. This will reveal a dropdown menu, from which you can select their destination user group...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6voMF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any users who sign up after that point will be automatically placed into that user group.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(2) If the user is registered through the control panel:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was an issue I encountered on a few different sites, so I wrote a plugin to easily manage it...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-autoassignusergroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auto-Assign User Group&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's very easy to use, here's a screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UkY0Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any users who are created after that point will be automatically placed into whatever user group(s) you specified.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-01-12T18:37:46.330" LastActivityDate="2017-01-12T18:37:46.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2921" PostTypeId="2" ParentId="2919" CreationDate="2014-10-04T23:07:52.710" Score="7" Body="&lt;p&gt;There is a reasonable chance that this is due to a specific plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try disabling all of your plugins, and see if the site is loading quickly again. If it is, try re-enabling each plugin one by one, to determine which of them may be causing the slowdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to remember that your plugins actually get loaded on every single page load, both front-end and back-end.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-04T23:07:52.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2922" PostTypeId="1" AcceptedAnswerId="2923" CreationDate="2014-10-04T23:40:10.123" Score="4" ViewCount="534" Body="&lt;p&gt;I would like to see how long plugins take to load, as well as other aspects of the page (loops and database requests). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My webpage can take ~2-3 seconds to return the initial request. It seems high and I'd like to figure out how I can optimize it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as I understand it, every plugin is loaded on each request (even if it's not loaded for that page). Is this true? And if so, why is this the desired behavior? If a plugin is performing poorly it can bring the entire website to a standstill (this just happened to me: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2919/website-taking-30-seconds-to-load/2921#2921&quot;&gt;Website taking 30+ seconds to load&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="501" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-15T17:57:59.897" Title="How can I time-profile the page load for a Craft request?" Tags="&lt;cache&gt;&lt;server&gt;&lt;request&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2923" PostTypeId="2" ParentId="2922" CreationDate="2014-10-05T03:50:57.440" Score="4" Body="&lt;p&gt;If you enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, then database profiling information (number of queries, SQL executed, execution time, etc.) as well as PHP script benchmarking information for the request will be output to your browser's console as well as the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also, as I understand it, every plugin is loaded on each request&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Installed and enabled plugins are &lt;em&gt;initialized&lt;/em&gt; on every request.  The only time what you are describing is a problem is if a plugin is doing some time/resource intensive operation in it's &lt;code&gt;init()&lt;/code&gt; method, which is generally considered bad form.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-05T03:50:57.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2924" PostTypeId="1" CreationDate="2014-10-05T13:46:01.730" Score="1" ViewCount="381" Body="&lt;p&gt;So I have a Structure like that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subitem | inactive&lt;/li&gt;&#xA;&lt;li&gt;Subitem | inactive&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;why is &lt;code&gt;item.hasDescendants()&lt;/code&gt; true ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do something like that the right way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;{% if nav_item.hasDescendants() %}more{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="733" LastEditorUserId="250" LastEditDate="2014-10-05T15:53:46.783" LastActivityDate="2014-10-21T18:03:49.040" Title="Problem with entry.hasDescendants()" Tags="&lt;templating&gt;&lt;entries&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2925" PostTypeId="2" ParentId="1010" CreationDate="2014-10-05T15:56:28.267" Score="2" Body="&lt;p&gt;I ended up solving this by creating a public variable in my service layer and assigning and retrieving the submitted object from there.  This helps me keep any new error handling specific code out of the templates for the users, and the output tag can now handle both submitting and error handling in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method has three parts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Public variable in the service layer that handles the submitted Form object (this gets set after the submission is validated and gets retrieved, if it exists, when the tag is processed.&lt;/li&gt;&#xA;&lt;li&gt;Controller that handles the Form submission&lt;/li&gt;&#xA;&lt;li&gt;Variable in the template file&lt;br&gt;&#xA;&lt;code&gt;craft.sproutForms.outputForm()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;More specifically, our service layer has a public variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public $activeEntry;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If our submission fails, we assign the submitted object with errors to the &lt;code&gt;$activeEntry&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;myPlugin-&amp;gt;saveEntry($entry)) &#xA;{&#xA;   ...&#xA;}&#xA;else&#xA;{&#xA;   craft()-&amp;gt;myPlugin-&amp;gt;activeEntry = $entry;&#xA;&#xA;   ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And, when the page loads and the &lt;code&gt;outputForm()&lt;/code&gt; tag is processed, we check to see if that &lt;code&gt;$activeEntry&lt;/code&gt; variable is set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (isset(craft()-&amp;gt;myPlugin-&amp;gt;activeEntry))&#xA;{&#xA;    $entry = craft()-&amp;gt;myPlugin-&amp;gt;activeEntry;    &#xA;}&#xA;else&#xA;{&#xA;    $entry = new MyPlugin_EntryModel();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-10-05T15:56:28.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2926" PostTypeId="1" AcceptedAnswerId="2928" CreationDate="2014-10-05T18:08:30.190" Score="11" ViewCount="6954" Body="&lt;p&gt;How do I modify a template to include a loop that displays all custom fields that I added to the field group that the current entry belongs through? I know how to display the fields individually by calling their name, but how to display all fields belonging to the group?&lt;/p&gt;&#xA;" OwnerUserId="861" LastEditorUserId="250" LastEditDate="2014-10-06T10:01:58.870" LastActivityDate="2018-07-05T17:30:05.230" Title="How to display all fields belonging to current entry?" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2927" PostTypeId="1" AcceptedAnswerId="3022" CreationDate="2014-10-05T18:22:06.710" Score="3" ViewCount="112" Body="&lt;p&gt;Is there a recommended way to provide user feedback in the control panel — something like a modal window with a simple 'ok' button to dismiss?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing a plugin that syncs data between users, another channel ('accounts'), and an external service (Braintree), using saveEntry and saveUser events to create/update related records as needed. I would like to provide user feedback in the way of a modal window that reports what related records were created and/or updated. What would be the recommended 'Craft' way to implement this user feedback modal? Or is there something already built-in to support this and how might I access it? I see some advice here regarding &lt;a href=&quot;https://craftcms.stackexchange.com/questions/374/how-can-my-plugin-generate-a-generic-modal-window-in-the-control-panel&quot;&gt;generating a generic modal window&lt;/a&gt;, but not sure the best way to integrate this within my plugin. Any advice would be appreciated even if very general.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-10-08T22:22:46.747" Title="Recommended way to provide user feedback in the control panel?" Tags="&lt;plugin-development&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2928" PostTypeId="2" ParentId="2926" CreationDate="2014-10-05T18:56:47.613" Score="24" Body="&lt;p&gt;Field groups are not specific to a particular channel or channel entry. They are just an arbitrary organization within the control panel for ease of use. What you would be looking for are the fields defined for the particular field layout for that entry. I.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# loop through the fields in the entries fieldLayout Model #}&#xA;{% for fieldLayoutField in entry.getFieldLayout().getFields() %}&#xA;&#xA;    {# get the field Model from the fieldId #}&#xA;    {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}&#xA;&#xA;    {# print the field handle and the field content  #}&#xA;    {{ field.handle }} : {{ entry.getContent()[field.handle] }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By the way, there is an excellent plugin called '&lt;a href=&quot;https://github.com/adrianmacneil/craft-inspector&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inspector&lt;/a&gt;' written by Adrian McNeal that displays all methods/attributes/properties of an object or variable, which can be very useful for figuring out what your dealing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: It has been brought to my attention that&lt;code&gt;fieldLayoutField.fieldId&lt;/code&gt; has been discontinued in favor of &lt;code&gt;fieldLayoutField.id&lt;/code&gt;. While not tested, if the above does not work, please try the following instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set field = craft.fields.getFieldById(fieldLayoutField.id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2018-07-05T17:30:05.230" LastActivityDate="2018-07-05T17:30:05.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2929" PostTypeId="1" AcceptedAnswerId="2931" CreationDate="2014-10-05T19:41:03.847" Score="1" ViewCount="207" Body="&lt;p&gt;Are different cache saved for Mobile / Tablet / localisations or do we have to take care of this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. if i use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isMobileBrowser() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will the response be cached for desktop users as well?&lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="57" LastEditDate="2015-02-09T03:12:20.690" LastActivityDate="2015-02-09T03:12:20.690" Title="Does the cache tag behave differently for Mobile vs Tablet vs Desktop?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2930" PostTypeId="1" CreationDate="2014-10-05T22:53:21.127" Score="0" ViewCount="160" Body="&lt;p&gt;&lt;a href=&quot;http://denizen.tv/work/2011-kca-image-campaign&quot; rel=&quot;nofollow&quot;&gt;http://denizen.tv/work/2011-kca-image-campaign&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://denizen.tv&quot; rel=&quot;nofollow&quot;&gt;http://denizen.tv&lt;/a&gt; has been up and running well since June, but it's suddenly throwing 404s. It looks like the same &lt;code&gt;/index.php/&lt;/code&gt; problem I was recently having with my own Craft install. The coincidence makes me think it must be a bug with a recent release. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else getting this error?&lt;/p&gt;&#xA;" OwnerUserId="839" LastActivityDate="2014-10-08T17:44:53.100" Title="6 month old site is suddenly throwing 404s" Tags="&lt;404-page&gt;&lt;index&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2931" PostTypeId="2" ParentId="2929" CreationDate="2014-10-06T00:28:30.843" Score="7" Body="&lt;p&gt;Craft makes no distinction whether it's caching for mobile, tablet, desktop, etc., so it'll need to be taken care of on the template end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily do that with the &quot;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#using-key&quot;&gt;using key&lt;/a&gt;&quot; parameter of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot;&gt;{% cache %}&lt;/a&gt; tag, though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isMobileBrowser %}&#xA;    {% set cacheKeyType = 'mobile' %}&#xA;{% else %}&#xA;    {% set cacheKeyType = 'desktop' %}&#xA;{% endif %}&#xA;&#xA;{% cache using key &quot;page-header-&quot; ~ cacheKeyType %}&#xA;    ....&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-06T00:28:30.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2932" PostTypeId="1" AcceptedAnswerId="3016" CreationDate="2014-10-06T00:43:50.557" Score="3" ViewCount="981" Body="&lt;p&gt;Currently each time we make changes to our dev instance of our Craft install (add fields, plugins, change settings in CP), we dump the database and upload it to the production database server. This gets messy now that our production database is accepting guest entries. We obviously do not want to overwrite those changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a recommend workflow for this situation. &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-11-05T16:33:20.000" Title="Migrations for Deployment" Tags="&lt;database&gt;&lt;migration&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2934" PostTypeId="2" ParentId="2905" CreationDate="2014-10-06T03:11:05.330" Score="2" Body="&lt;p&gt;The plugin's full &lt;code&gt;init()&lt;/code&gt; code was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    BusinessLogicPlugin::log('init');&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;        Craft::log('onSaveUSer');&#xA;        BusinessLogicPlugin::log('onSaveUSer');&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;&#xA;        Craft::log('onSaveEntry');&#xA;        BusinessLogicPlugin::log('onSaveEntry');&#xA;&#xA;        if ($entry-&amp;gt;section == 'Accounts')&#xA;        {   &#xA;            if ($event-&amp;gt;params['isNewEntry'])&#xA;            {&#xA;                ... &#xA;            }&#xA;            else&#xA;            {   &#xA;                ...&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the &lt;code&gt;saveEntry&lt;/code&gt; callback was referencing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($entry-&amp;gt;section == 'Accounts')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;$entry&lt;/code&gt; hadn't been defined, yet, causing a fatal PHP error not letting Yii/Craft to flush out the log files, which happens in the &lt;code&gt;onEndRequest&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry is defined in the event params, though, so changing it to this is the fix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;&#xA;    Craft::log('onSaveEntry');&#xA;    BusinessLogicPlugin::log('onSaveEntry');&#xA;&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if ($entry-&amp;gt;section == 'Accounts')&#xA;    {   &#xA;        if ($event-&amp;gt;params['isNewEntry'])&#xA;        {&#xA;            ... &#xA;        }&#xA;        else&#xA;        {   &#xA;            ...&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-06T03:11:05.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2935" PostTypeId="1" AcceptedAnswerId="2941" CreationDate="2014-10-06T04:26:53.990" Score="1" ViewCount="176" Body="&lt;p&gt;I'm having trouble using the &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow&quot;&gt;Pixel and Tonic's Events plugin&lt;/a&gt;. I actually have no clue where to start on how to get it to render events in a template. I'm currently trying to pass in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.events.events_calendars('calendarName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is obviously wrong. Could anyone explain how I understand what methods and variables those methods take for custom Element types?&lt;/p&gt;&#xA;" OwnerUserId="862" LastEditorUserId="250" LastEditDate="2014-10-06T10:03:21.297" LastActivityDate="2014-10-06T10:03:21.297" Title="Trouble using events plugin" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2936" PostTypeId="1" AcceptedAnswerId="2940" CreationDate="2014-10-06T05:52:19.187" Score="4" ViewCount="890" Body="&lt;p&gt;I've been reading on here about suggestions on implementing commenting systems. I'm aware of disqus integration but I want/need  built in commenting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen it mentioned a couple of times that one approach would be to create a section (presumably a channel) dedicated to comments and the relate that to an entry via an entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just can't quite wrap my head around how that works out. Do the entries have to be manually selected in order to relate them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone's built something like this then I would love to know how they tackled it! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to add is that only registered members will be commenting. And there would be several different sections needing comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2015-08-03T17:55:26.883" Title="Creating comments via a related section" Tags="&lt;entries&gt;&lt;relations&gt;&lt;comments&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2937" PostTypeId="1" AcceptedAnswerId="13108" CreationDate="2014-10-06T06:59:01.533" Score="2" ViewCount="331" Body="&lt;p&gt;I like to display a tree-like view of all files in an asset source:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Folder_X&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File_A&lt;/li&gt;&#xA;&lt;li&gt;File_B&lt;/li&gt;&#xA;&lt;li&gt;Folder_Y&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File_C&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Folder_Z&#xA;&lt;ul&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know that I can iterate over all assets in a source (&lt;code&gt;{% for file in craft.assets.sourceId('1') %}&lt;/code&gt;) but this gives just an alphabetically sorted list of all files. Maybe we need something like the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;nav-tag&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-01-06T10:43:12.233" Title="How to display a tree view of all assets?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2939" PostTypeId="2" ParentId="2936" CreationDate="2014-10-06T07:57:58.753" Score="5" Body="&lt;p&gt;I've used this method before, works quite nice!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to do this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create the fields you need for commenting (name, message, etc.). Be sure to add a relational field to which you can later assign the 'parent entry'&lt;/li&gt;&#xA;&lt;li&gt;Create a section (channel) called &lt;code&gt;comments&lt;/code&gt; (or whatever else you want to call it)&lt;/li&gt;&#xA;&lt;li&gt;Assign the fields to the section you just created&lt;/li&gt;&#xA;&lt;li&gt;Use a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;noreferrer&quot;&gt;frontend entry form&lt;/a&gt; for commenting. The &lt;code&gt;sectionId&lt;/code&gt; is the id of the comments section, the &lt;code&gt;action&lt;/code&gt; is 'entries/saveEntry'.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a hidden input field, with the name of your relational field and assign the id of the 'parent entry' to it. Don't forget to add &lt;code&gt;fields&lt;/code&gt; and []. &lt;code&gt;Fields&lt;/code&gt; because it's not a default field, the &lt;code&gt;[]&lt;/code&gt; because it's a relational field. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[yourRelationalFieldName][]&quot; value=&quot;{{ entry.id }}&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, when the user commits this form (and has the permissions to create new entries in the comments section), a new comments entry will be created, related to the parent entry. You can even relate comments to other comments this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-06T07:57:58.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2940" PostTypeId="2" ParentId="2936" CreationDate="2014-10-06T08:08:41.210" Score="7" Body="&lt;p&gt;One approach would be to create a comments channel with an &lt;code&gt;entries&lt;/code&gt; fieldtype (with sources checked for any channels that you want to allow commenting; limit set to 1) called 'relatedEntry' (or whatever you like). On your article template, include a &lt;code&gt;for&lt;/code&gt; loop to display existing comments &lt;code&gt;relateTo&lt;/code&gt; the entry. Check to see if there is a current user, and if yes, include a comments form. In the comments form place a hidden field with the id for the current entry. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;article&amp;gt;&#xA;  {{ entry.title }}&#xA;  {{ entry.body }}&#xA;&amp;lt;/article&amp;gt;&#xA;&#xA;&amp;lt;ul class=&quot;comments&quot;&amp;gt;&#xA;{% for comment in craft.entries.section('comments').relatedTo(entry) %}&#xA;   &amp;lt;li&amp;gt;{{ comment.author.fullName }}&amp;lt;br/&amp;gt;{{ comment.body }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% if currentuser %}&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;2&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[relatedEntry][]&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;comment&quot;&amp;gt;Comment&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;comment&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;name=&quot;fields[relatedEntry][]&lt;/code&gt; is formated this way because related fields expect an array even if it's only a single related entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also create threaded comments by creating another related &lt;code&gt;entries&lt;/code&gt; fieldtype called parentComment (or whatever you like) and including that as a hidden field in the form as well (you might need ajax or javascript here to help set the hidden field value from the 'comment' link).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it a little nicer you could also load the comments form via ajax or reveal it with javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Untested, but hopefully this will point you in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-06T08:08:41.210" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="2941" PostTypeId="2" ParentId="2935" CreationDate="2014-10-06T09:02:43.640" Score="2" Body="&lt;p&gt;The events plugin by Pixel &amp;amp; Tonic is an example of how to use custom Elements if you're building your own plugin. I don't think it should be used in a production environment (but please correct me if I'm wrong). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use it, you should take a look at &lt;a href=&quot;https://github.com/pixelandtonic/Events/blob/master/events/variables/EventsVariable.php&quot; rel=&quot;nofollow&quot;&gt;the only variable&lt;/a&gt; for this plugin.&#xA;This variable gives you the ability to get all events, filtered by your criteria. There's no way to get all calendars, only events:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.events.events %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One other plugin you could have a look at, is &lt;a href=&quot;http://michaelrog.com/craftcalendars/&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;, still in private beta.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-06T09:02:43.640" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2942" PostTypeId="1" AcceptedAnswerId="2970" CreationDate="2014-10-06T09:31:02.127" Score="1" ViewCount="681" Body="&lt;p&gt;Edited for clarity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have a search form in the frontend where customers can enter keywords.&#xA;The way it searches now only returns exact matches. I'd like to tell Craft to look for works containing the keyword the look for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I have to set the 'q' param to do this but I have no idea what I should do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search for results page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).section('oeuvres').order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastEditorUserId="785" LastEditDate="2014-10-07T14:46:45.630" LastActivityDate="2014-10-07T14:53:45.040" Title="Craft Search looking for keywords contained in the query" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2943" PostTypeId="2" ParentId="2937" CreationDate="2014-10-06T09:51:29.823" Score="1" Body="&lt;p&gt;Yoursort, my answer was based on the assumption that the AssetsService could be used in templates. Ofcourse, only the variables can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have time to dive into this (now), but I think your best bet is to get all images, use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#folder&quot; rel=&quot;nofollow&quot;&gt;`asset.folder'&lt;/a&gt; for each asset and 'rebuild' the hierarchical list of folder and their assets. Again, use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;cache&lt;/a&gt; ;)&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-06T09:51:29.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2945" PostTypeId="1" AcceptedAnswerId="2952" CreationDate="2014-10-06T12:43:10.400" Score="1" ViewCount="552" Body="&lt;p&gt;Client has created /exhibitors but wishes it to point to /exhibitors/partners&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can that be done using routes or should we be looking at htaccess rules?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-10-06T16:14:23.787" Title="redirect on a Structure" Tags="&lt;structure&gt;&lt;routes&gt;&lt;routing&gt;&lt;htaccess&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2946" PostTypeId="1" AcceptedAnswerId="2948" CreationDate="2014-10-06T12:59:13.093" Score="1" ViewCount="2461" Body="&lt;p&gt;I've had this issue a few times &amp;amp; wanted to know if there is maybe a better way to deal with the following issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have this if on a page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.isEditable %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot; target=&quot;_blank&quot; id=&quot;editEntry&quot; class=&quot;cta&quot;&amp;gt;Edit this entry&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On an editable entry, the button appears if logged in. If logged out the button does not appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I visit a page that is not an entry (just a template group) when logged in or not, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impossible to access an attribute (&quot;isEditable&quot;) on a NULL variable (&quot;&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only successful way I've seen to so far to make this behave is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% if entry.isEditable is defined %}&#xA;        {% if entry.isEditable %}&#xA;            &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot; target=&quot;_blank&quot; id=&quot;editEntry&quot; class=&quot;cta&quot;&amp;gt;Edit this entry&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="585" LastActivityDate="2014-10-06T13:29:54.900" Title="Best way to deal with Impossible to access an attribute (&quot;isEditable&quot;) on a NULL variable (&quot;&quot;)" Tags="&lt;entry&gt;&lt;variable&gt;&lt;null&gt;&lt;defined&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2947" PostTypeId="1" AcceptedAnswerId="2949" CreationDate="2014-10-06T13:26:52.267" Score="1" ViewCount="199" Body="&lt;p&gt;I'm not sure 299US$ for Upgrading to Pro License is for 1 domain on upgrading or any domain with my account (Craft CMS Member).&lt;/p&gt;&#xA;" OwnerUserId="864" LastEditorUserId="250" LastEditDate="2014-10-06T14:38:30.563" LastActivityDate="2014-10-06T16:23:58.383" Title="299US$ Upgrade for Pro is for 1 site or any domain with my License" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2948" PostTypeId="2" ParentId="2946" CreationDate="2014-10-06T13:29:54.900" Score="5" Body="&lt;p&gt;You could combine the first three:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry is defined and entry and entry.isEditable %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the first or second part of this logic fails, it will not check the third part so no error will be thrown. The second part is for the rare cases that a variable with the name &lt;code&gt;entry&lt;/code&gt; exists but is null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If entry is defined, it's always an entry (or at least it should be), so you don't have to check if isEditable is defined.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-06T13:29:54.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2949" PostTypeId="2" ParentId="2947" CreationDate="2014-10-06T14:21:17.153" Score="5" Body="&lt;p&gt;It is per domain (excluding sub-domains), i.e. for one domain / website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;domain.com and subdomain.domain.com can both run off of the same license.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot; rel=&quot;nofollow&quot;&gt;More info&lt;/a&gt; on how that is all enforced.&lt;/p&gt;&#xA;" OwnerUserId="133" LastEditorUserId="250" LastEditDate="2014-10-06T16:23:58.383" LastActivityDate="2014-10-06T16:23:58.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2950" PostTypeId="1" AcceptedAnswerId="2951" CreationDate="2014-10-06T14:51:10.030" Score="3" ViewCount="645" Body="&lt;p&gt;Is it possible to restrict a part of a website to craft user-groups?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance if I want show an internal Blog to members-only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And is it possible to moderate user registrations? So when somebody registers an Admin has to approve it first?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-10-06T15:02:30.513" Title="Part of a website only accessible to users" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2951" PostTypeId="2" ParentId="2950" CreationDate="2014-10-06T14:57:21.650" Score="5" Body="&lt;p&gt;It is! You can use the &lt;code&gt;requirePermission&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requirePermission &quot;yourPermission&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the full documentation &lt;a href=&quot;http://buildwithcraft.com/docs/templating/requirepermission&quot;&gt;here&lt;/a&gt;. Keep in mind this list as built in permissions but you can also add custom permissions through a plugin should you require it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far the second question, I'm not 100% sure but I believe you can set &quot;enabled&quot; to &quot;false&quot; when creating a registration form. See further details &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: You can also use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot;&gt;isInGroup&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-10-06T15:02:30.513" LastActivityDate="2014-10-06T15:02:30.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2952" PostTypeId="2" ParentId="2945" CreationDate="2014-10-06T15:42:57.650" Score="3" Body="&lt;p&gt;If it's just a simple redirect, it'll be quicker to do it in .htaccess and not invoke PHP/Craft at all.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-06T15:42:57.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2953" PostTypeId="2" ParentId="2945" CreationDate="2014-10-06T15:50:55.990" Score="2" Body="&lt;p&gt;We had a pretty similar question already: &lt;a href=&quot;https://craftcms.stackexchange.com/q/1488/125&quot;&gt;&quot;Setting up redirects via Craft routes?&quot;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you could change the code to exchange the parent entry with its first child conditionally. Additionally you can also add a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;redirect&lt;/code&gt;&lt;/a&gt; to that child page, in case someone edits the url.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set linkToChildEntries = ['exhibitors', 'anotherparent'] %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {% if page.slug in linkToChildEntries and page.getChildren()|length %}&#xA;                &amp;lt;a href=&quot;{{ page.getChildren().first().url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you can also make this client editable by adding a field to the parent's entry type you then check for instead of managing the to be treated parent entires in the template code.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-06T15:56:12.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2954" PostTypeId="2" ParentId="2945" CreationDate="2014-10-06T16:14:23.787" Score="1" Body="&lt;p&gt;I don't have any of the code to hand so I'll have to check it later, but I had a similar need and wanted something I could switch on and off across multiple entries, so I went with a &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;lightswitch field&lt;/a&gt; and the following code in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.firstChildRedirect %}&#xA;    {% if entry.children|length %}&#xA;        {% redirect entry.children.first.uri %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also got a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;function in a variable&lt;/a&gt; that when given an entry, either returns that entry, or it's first child, using similar logic.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class YourPluginVariable&#xA;{&#xA;    public function entryOrRedirected(EntryModel $entry)&#xA;    {&#xA;        if($entry-&amp;gt;firstChildRedirect)&#xA;        {&#xA;            $child = $entry-&amp;gt;children-&amp;gt;first();&#xA;&#xA;            if($child) return $child;&#xA;        }&#xA;&#xA;        return $entry;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which can be used in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.yourPlugin.entryOrRedirected(entry).getLink }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-10-06T16:14:23.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2955" PostTypeId="2" ParentId="2905" CreationDate="2014-10-06T18:10:12.817" Score="3" Body="&lt;p&gt;After wasting all of Brad's time (sorry brad!) by sending him an incomplete plugin file with a missing line, I have discovered why I wasn't seeing logs in the console as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::log('...')&lt;/code&gt; or &lt;code&gt;MyPlugin::log('...')&lt;/code&gt; function calls within &lt;code&gt;onSaveEntry&lt;/code&gt; or &lt;code&gt;onSaveUser&lt;/code&gt; events are in fact properly saved to the log files (&lt;code&gt;craft/app/storage/runtime/logs/&lt;/code&gt;). They are just not available in the browser's console, because the event is taking place on the server, while the page is in the process of being redirected when the event fires.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lesson learned: don't rely on the console for debugging! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log files can be watched from the command line using &lt;code&gt;tail -F /full/path/to/log/file&lt;/code&gt; rather than having to constantly reload the log in a text editor. Although apparently some text editors also support live updates as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to delete this question or leave it here in case others run into the same problem.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-06T18:10:12.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2956" PostTypeId="1" CreationDate="2014-10-06T23:14:25.453" Score="6" ViewCount="938" Body="&lt;p&gt;I created a simple Craft plugin to allow for custom action URLs. Specifically, I have a path &quot;actions/api/sendEmail&quot; that hits a method in my plugin's controller. It sends an email from a contact form via Ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works perfectly when I'm logged into Craft in the browser. But if I am not logged in, Ajax hits the &quot;actions/api/sendEmail&quot; URL and then gets redirected to &quot;/login&quot;. Is my plugin not set to be a public-facing, front-end plugin? I'm pretty new to Craft. I've read through a lot of the docs about plugins and routes but can't seem to find the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my plugin controller class file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class apiController extends BaseController {&#xA;&#xA;  function actionSendEmail() {&#xA;&#xA;    $name = $_POST['first_name'] . ' ' . $_POST['last_name'];&#xA;    $email_address = $_POST['email'];&#xA;    $phone = $_POST['phone'];&#xA;    $company = $_POST['company'];&#xA;    $title = $_POST['title'];&#xA;&#xA;    $email = new EmailModel();&#xA;&#xA;    $email-&amp;gt;toEmail = 'luke@graftonstudio.com';&#xA;    $email-&amp;gt;subject = 'Contact Form Submission';&#xA;    $email-&amp;gt;htmlBody = '&amp;lt;style&amp;gt;div, p, h2 { font-family: &quot;Helvetica Neue&quot;, &quot;Helvetica&quot;, sans-serif; font-size: 14px; line-height: 22px; color: #4b4b4b; font-weight: 400; }&amp;lt;/style&amp;gt;&#xA;                                            &amp;lt;div style=&quot;margin: 20px; padding: 20px 20px 26px; border: 1px solid #e6e6e6; box-shadow: inset 0 1px 0 #ffffff, 0 4px 2px -3px rgba(0,0,0,0.06); background: #f9f9f9;&quot;&amp;gt;&#xA;                                                &amp;lt;h2 style=&quot;margin: 0 0 20px 0; font-size: 20px;&quot;&amp;gt;Contact Form Submission&amp;lt;/h2&amp;gt;&#xA;                                                &amp;lt;strong&amp;gt;Name:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;' . $name . '&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;                                                &amp;lt;strong&amp;gt;Email:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;' . $email_address . '&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;                                                &amp;lt;strong&amp;gt;Phone Number:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;' . $phone . '&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;                                                &amp;lt;strong&amp;gt;Company:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;' . $company . '&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;                                                &amp;lt;strong&amp;gt;Job Title:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;' . $title . '&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;                                            &amp;lt;/div&amp;gt;';&#xA;&#xA;    craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&#xA;    // not returning anything at the moment&#xA;    echo json_encode(array());&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="865" LastActivityDate="2014-10-06T23:36:39.233" Title="Craft CMS plugin route redirects to login when not logged into Craft" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2957" PostTypeId="2" ParentId="2956" CreationDate="2014-10-06T23:36:39.233" Score="8" Body="&lt;p&gt;You need to explicitly allow allow anonymous access to your controller's action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on how to do that here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-06T23:36:39.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2959" PostTypeId="1" CreationDate="2014-10-07T04:17:41.603" Score="2" ViewCount="270" Body="&lt;p&gt;I'd like to be able to create an Entries field that can select from entries from all locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently it looks like there's the option to choose a single locale or specify the same locale as the source entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way around this?&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2015-02-05T09:16:54.057" Title="Select entry from any locale with Entries Field" Tags="&lt;entries&gt;&lt;localization&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2961" PostTypeId="1" AcceptedAnswerId="3015" CreationDate="2014-10-07T09:29:49.297" Score="1" ViewCount="105" Body="&lt;p&gt;Craft will let us define what file-type is valid for a given asset field, but there are many times where I'd like to enforce other properties too - e.g., a minimum dimension for valid images uploaded to that field (i.e., dimensions must be larger than 800x600). Is there a way to do that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I can only see Craft enforcing file-types and file-size limits if they're too large (e.g., 4Mb is too big). I'd like some more options to avoid clients uploading unsuitable files.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-10-08T17:59:27.800" Title="Can we set properties to establish a valid asset per field?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2014-10-09T03:11:51.460" ContentLicense="CC BY-SA 3.0" />
  <row Id="2962" PostTypeId="1" AcceptedAnswerId="2969" CreationDate="2014-10-07T09:55:44.593" Score="1" ViewCount="436" Body="&lt;p&gt;Is it possible for me to execute any &quot;init&quot; like function for my Plugin the first time the user visits the site? You could say when the first userSession is defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking through the docs to see if there was any Event for when the user session is created but I couldn't find any.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add some default values to the userSession the first time the user hits my site.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-07T14:50:43.857" Title="Execute Plugin init function one time" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2963" PostTypeId="2" ParentId="2207" CreationDate="2014-10-07T10:27:06.047" Score="3" Body="&lt;p&gt;Writing a plugin would be your best shot. You can use AssetsService to get all the information you need (&lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/classreference/services/AssetsService&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might change with a future release, but the need to query Assets folders directly from a template is so rare, that I'm not entirely convinced it will make it's way into a future release at this point.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2014-10-07T10:27:06.047" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2964" PostTypeId="1" CreationDate="2014-10-07T11:12:44.890" Score="4" ViewCount="726" Body="&lt;p&gt;Where can I edit the error messages for the user registration form e.g for &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if account is defined %}&#xA;    {{ _self.errorList(account.getErrors('email')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to change this wording:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Email &quot;tom.bowler@mailbox.net&quot; has already been taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Email &quot;tom.bowler@mailbox.net&quot; has already been taken. Login here instead...&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="57" LastEditDate="2014-10-07T18:34:39.187" LastActivityDate="2015-02-04T20:12:40.713" Title="User Registration Form error message customisation" Tags="&lt;form&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2965" PostTypeId="1" AcceptedAnswerId="2981" CreationDate="2014-10-07T11:26:23.533" Score="0" ViewCount="722" Body="&lt;p&gt;Looking at the possibility of sending the link in account activation emails to a set page rather than the homepage which {{link}} does so we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://domain.net&quot; rel=&quot;nofollow&quot;&gt;http://domain.net&lt;/a&gt; but they go to &lt;a href=&quot;http://domain.net/welcome&quot; rel=&quot;nofollow&quot;&gt;http://domain.net/welcome&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Simon&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-10-07T21:40:47.200" Title="Activate account email {{link}}" Tags="&lt;emails&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2966" PostTypeId="1" AcceptedAnswerId="2973" CreationDate="2014-10-07T12:35:00.783" Score="5" ViewCount="1000" Body="&lt;p&gt;I'm trying to wrap my head around when to use a Model and when to use a Record (or both?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have both my Model and my Record. In my Controller I call my Service that creates my new Record instance before running the &lt;code&gt;-&amp;gt;save();&lt;/code&gt; command to save my new entry into the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since my Record can run the validation process from my specified &lt;code&gt;rules()&lt;/code&gt; array I'm wondering what I have my Model for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also since I'm running the actual database command from within my Service and dont have access to the Record in my Controller, how do I return the validation errors to my Controller for later use in my template variables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I run the validation on my Model in my Controller as well? Seems like I'll be doing the same thing twice if so.... or what am I not getting here? :P&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-07T18:33:57.307" Title="Where do I run validation before database insert?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2968" PostTypeId="2" ParentId="2962" CreationDate="2014-10-07T13:49:00.107" Score="0" Body="&lt;p&gt;I would create a new session in this case, it would probably be a bad idea to modify the userSession just in case there is an update that changes it etc.&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2014-10-07T13:49:00.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2969" PostTypeId="2" ParentId="2962" CreationDate="2014-10-07T14:50:43.857" Score="2" Body="&lt;p&gt;Sessions are initialized by Craft, and plugins are loaded/called after that, so you'll have to assume the session is already up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure about your use case, but here is how you could execute code once per session:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(!craft()-&amp;gt;httpSession-&amp;gt;get('initialized'))&#xA;{&#xA;    /*&#xA;    Your code executed once per session goes here&#xA;    */&#xA;&#xA;    craft()-&amp;gt;httpSession-&amp;gt;add('initialized', true);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="164" LastActivityDate="2014-10-07T14:50:43.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2970" PostTypeId="2" ParentId="2942" CreationDate="2014-10-07T14:53:45.040" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search('*' ~ query ~ '*').order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-07T14:53:45.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2971" PostTypeId="1" AcceptedAnswerId="2972" CreationDate="2014-10-07T17:15:07.263" Score="2" ViewCount="346" Body="&lt;p&gt;What conditional statement would hide a form if a user is logged in?&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2014-10-07T17:20:43.583" Title="How do I hide a login form if user is logged in?" Tags="&lt;form&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2972" PostTypeId="2" ParentId="2971" CreationDate="2014-10-07T17:20:43.583" Score="4" Body="&lt;p&gt;The Twig variable &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#currentUser&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;currentUser&lt;/code&gt;&lt;/a&gt; contains information about the currently logged in user, and will be &lt;em&gt;null&lt;/em&gt; if no user is currently logged in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser %}&#xA;&#xA;    &amp;lt;!-- Your login form --&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-07T17:20:43.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2973" PostTypeId="2" ParentId="2966" CreationDate="2014-10-07T18:33:57.307" Score="12" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot;&gt;Records&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot;&gt;models&lt;/a&gt; are similar in that they are both containers for data, but records have the additional functionality/overhead of being able to write and read from the database via the &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.ar&quot;&gt;Active Record&lt;/a&gt; pattern.  There is also not a 1:1 relationship between records and models.  A model can define attributes from multiple records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, records should never leave your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot;&gt;service layer&lt;/a&gt;, because you don't want them floating up to the controller or template level, for example.  If that happened, then people could inadvertently insert/update/overwrite data directly from a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your service, you do all of your Active Record / database related logic, and call &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#populateModel-detail&quot;&gt;populateModel(s)&lt;/a&gt; with the resulting data and return the models from your service and let those safely transport your data throughout your layers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general pattern for all of this, including validation, looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SomeController extends BaseController&#xA;{&#xA;    public function actionDoSomething()&#xA;    {&#xA;        $myModel = new MyModel();&#xA;        $myModel-&amp;gt;myProperty = 1;&#xA;&#xA;        // Validate the model&#xA;        if ($myModel-&amp;gt;validate())&#xA;        {&#xA;            // Pass it to the service.&#xA;            if (craft()-&amp;gt;myService-&amp;gt;doSomething($myModel))&#xA;            {&#xA;                // Success!&#xA;                $this-&amp;gt;redirectToPostedUrl();&#xA;            }&#xA;        }&#xA;&#xA;        // Return the model back to the template so the errors can be displayed.&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'model' =&amp;gt; $myModel&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your service can grab the info it needs from the model and create or grab any necessary records.  It can then, if it needs to, call &lt;code&gt;$record-&amp;gt;validate()&lt;/code&gt; on any of the records.  If a record fails validation in the service, it can add those errors to the original model and return false like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myModel-&amp;gt;addErrors($record-&amp;gt;getErrors);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And those errors will bubble up to the template to be displayed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-07T18:33:57.307" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2974" PostTypeId="2" ParentId="2964" CreationDate="2014-10-07T18:47:10.867" Score="2" Body="&lt;p&gt;You can do this using Craft's &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;static translation&lt;/a&gt; support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your site is using &lt;code&gt;en_us&lt;/code&gt; for its primary locale, then add a &lt;code&gt;craft/translations/en_us.php&lt;/code&gt; file that has this in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    '{attribute} &quot;{value}&quot; has already been taken.' =&amp;gt; '{attribute} &quot;{value}&quot; has already been taken. Login here instead.',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-07T18:47:10.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2975" PostTypeId="1" AcceptedAnswerId="2976" CreationDate="2014-10-07T18:49:58.947" Score="7" ViewCount="7857" Body="&lt;p&gt;By default you can access Craft on a site by visiting &lt;code&gt;/admin&lt;/code&gt;. How can I change the URL for this to something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;/new-url&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2016-05-26T16:20:18.590" LastActivityDate="2016-09-28T18:53:00.813" Title="How do I change the URL used to access Craft?" Tags="&lt;admin&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2976" PostTypeId="2" ParentId="2975" CreationDate="2014-10-07T18:51:49.807" Score="11" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;cpTrigger&lt;/a&gt; config setting is what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-09-28T18:53:00.813" LastActivityDate="2016-09-28T18:53:00.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2977" PostTypeId="2" ParentId="2975" CreationDate="2014-10-07T18:54:29.597" Score="6" Body="&lt;p&gt;You can edit this in the general config &lt;a href=&quot;https://craftcms.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#cpTrigger&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'cpTrigger' =&amp;gt; new-url,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="57" LastEditDate="2016-09-28T18:52:48.817" LastActivityDate="2016-09-28T18:52:48.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2978" PostTypeId="1" AcceptedAnswerId="3002" CreationDate="2014-10-07T19:25:14.457" Score="5" ViewCount="5495" Body="&lt;p&gt;I've done a bunch of research and I can't seem to find a suitable answer for this issue without hacking which I'd like to avoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client needs the entries in the DB to always assume they're relative to the users current timezone. So content set to display at 9am on Monday morning will display at 9am Monday in every timezone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The locale options in Twig only adjust the UTC timestamp to the users current timezone but it's still displaying content based on UTC timestamp in the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through MySQL I can use the following command per session to accomplish what I'm looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SET SESSION time_zone = '+10:00';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This appropriately offsets the MySQL time to match a users timezone +10 hours ahead of UTC, in this case Australia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading &lt;a href=&quot;http://www.yiiframework.com/wiki/197/local-time-zones-and-locales/&quot;&gt;this article&lt;/a&gt; it seems that &quot;initSQLs&quot; might be the answer but it's a Yii article that talks about adding that command to the &lt;em&gt;db&lt;/em&gt; array within the protected/config/main.php file which I'm unsure of how to tie into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I'm hoping someone might have some insight into how I can bootstrap the DB calls per user session or another solution potentially utilizing a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're doing timezone lookups by IP address, I realize the potential issue, so the option will need to work for both logged in and logged out users.&lt;/p&gt;&#xA;" OwnerUserId="871" LastEditorUserId="250" LastEditDate="2014-10-07T19:51:52.690" LastActivityDate="2017-06-22T11:25:36.853" Title="Adjust all date/times to users current timezone" Tags="&lt;datetime&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2979" PostTypeId="1" AcceptedAnswerId="2980" CreationDate="2014-10-07T20:01:49.863" Score="4" ViewCount="830" Body="&lt;p&gt;Does anyone have an example how I would implement search results that appear in a popup on the same form (without redirecting to a results page). The idea would be that as they start to type in the search bar, after a delay I'd show a popup with a few results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm good on the jS, popup part. The part i don't know about is how i would call craft cms dynamically on the same page to get the results (would i do this with JS or with the form tag, can i make the request with JSON/Ajax?). All the examples show the form directing to a results page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any suggestions&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2014-10-07T21:06:58.667" Title="Search Results In a Drop List/Popup on Same Page" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2980" PostTypeId="2" ParentId="2979" CreationDate="2014-10-07T20:32:29.517" Score="6" Body="&lt;p&gt;You can request any template via ajax using jQuery. jQuery would essentially listen for onChange events from the search field and ajax load a template that looped through the search results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template that you request can even be the default full search results page, with a conditional that determines which part of the template gets returned if the request is ajax.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;{% if not craft.request.isAjax %}&#xA;    {# Full page results content can go here #}&#xA;    &amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;div class=&quot;search-results&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if craft.request.isAjax %}&#xA;    {# Drop-down results can go here. And inserted into DOM via jquery. #}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;jQuery can then insert the results of the ajax call using an html element selector. See the jquery documentation for more information on using &lt;a href=&quot;http://api.jquery.com/load/&quot;&gt;.load&lt;/a&gt; or &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot;&gt;.ajax&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also probably want to put the &lt;code&gt;{% set entries ... %}&lt;/code&gt; inside the &lt;code&gt;if isAjax&lt;/code&gt; statements so that you can limit the results, or implement pagination, for the drop down vs the full page.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-07T21:06:58.667" LastActivityDate="2014-10-07T21:06:58.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2981" PostTypeId="2" ParentId="2965" CreationDate="2014-10-07T20:58:10.540" Score="4" Body="&lt;p&gt;OK, just did a quick look through the docs. Appears that this can be set via the config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#activateAccountSuccessPath&quot; rel=&quot;nofollow&quot;&gt;Link to documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also the option to set whether the user is logged in automatically.&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2014-10-07T21:40:47.200" LastActivityDate="2014-10-07T21:40:47.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2982" PostTypeId="2" ParentId="2731" CreationDate="2014-10-07T22:36:13.650" Score="1" Body="&lt;p&gt;This was a permissions problem, I fixed it by going nuclear and setting the files owner and group to root.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;config.vm.synced_folder &quot;.&quot;, &quot;/vagrant&quot;,&#xA;:owner =&amp;gt; 'root',&#xA;:group =&amp;gt; 'root',&#xA;:mount_options =&amp;gt; ['dmode=777,fmode=666']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="824" LastActivityDate="2014-10-07T22:36:13.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2983" PostTypeId="2" ParentId="2959" CreationDate="2014-10-07T23:27:11.923" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any way around this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not that I'm aware of.  You can currently only select entries from the locale you're viewing (same as source), or an explicit one specified in the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't browse across multiple locales and select entries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-07T23:27:11.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2984" PostTypeId="1" CreationDate="2014-10-08T01:44:28.130" Score="2" ViewCount="943" Body="&lt;p&gt;I'm trying to load a page from a Craft based website using file_get_contents or cURL. Using &lt;code&gt;get_file_contents&lt;/code&gt; I get an empty result, using cURL I can see that the request is getting redirected to the login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I switch to a different domain that is also running Craft the &lt;code&gt;file_get_contents&lt;/code&gt; and cURL both work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what could possibly be causing the redirect to be happening?&lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="57" LastEditDate="2014-10-08T03:40:35.060" LastActivityDate="2014-10-08T03:40:35.060" Title="Using cURL or file_get_contents is empty when calling a Craft page" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2985" PostTypeId="2" ParentId="2984" CreationDate="2014-10-08T01:51:32.477" Score="2" Body="&lt;p&gt;Found a solution. I needed to set the requireUserAgentAndIpForSession to false,  &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like having to disable this for a particular url could open up other issues across the board.&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2014-10-08T01:51:32.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2986" PostTypeId="1" AcceptedAnswerId="2988" CreationDate="2014-10-08T03:11:11.717" Score="16" ViewCount="7539" Body="&lt;p&gt;How do you guys handle SEO? Do you just make your own meta fields and add them in the template manually or am I missing something? I did notice there are some plugins being developed but there are sites in the wild now so it's been handled some how. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="45" LastEditDate="2014-10-08T05:35:15.203" LastActivityDate="2019-10-02T20:35:14.983" Title="How do you handle SEO on your site?" Tags="&lt;templating&gt;&lt;seo&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="2987" PostTypeId="2" ParentId="2879" CreationDate="2014-10-08T04:00:36.227" Score="2" Body="&lt;p&gt;It looks like your loops are causing Yii to add joins to the craft_relations table once for each iteration of your loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for id in locId %}&#xA;  {% set relatedTo = relatedTo|merge([id]) %}&#xA;{% endfor %}&#xA;&#xA;{% for id in typeId %}&#xA;  {% set relatedTo = relatedTo|merge([id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would guess that either &lt;code&gt;locId&lt;/code&gt; or &lt;code&gt;typeId&lt;/code&gt; contains an array with many values. Try using &lt;code&gt;{{ dump() }}&lt;/code&gt; or &lt;code&gt;{{ locId | length }}&lt;/code&gt; to see how many values you are dealing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might need to refine the query for each of these &lt;code&gt;locId&lt;/code&gt; and &lt;code&gt;typeId&lt;/code&gt; to ensure you get a single result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively if you really want to search among that many records you might need to redesign your approach. Perhaps build an SQL query that achieves what you want first then work your way back from there.&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2014-10-08T04:00:36.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2988" PostTypeId="2" ParentId="2986" CreationDate="2014-10-08T05:20:12.587" Score="16" Body="&lt;p&gt;You basically have two options...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the world of plugins&lt;/strong&gt;, check out the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt; or &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Craft 2, SEOmatic is free, Sprout SEO is $99. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Craft CMS 3, the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt; and &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO plugin&lt;/a&gt; are both available and $99.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you'd rather not use a plugin&lt;/strong&gt;, then you're on your own to create and implement whatever fields you think you'll need. Depending on how you're approaching SEO, it could be fields like &quot;Keywords&quot;, &quot;Description&quot;, etc... and/or fields for the Facebook OG tags, or whatever you want! At that point, implementing your SEO fields would be nearly identical to implementing any other fields in Craft.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="115" LastEditDate="2018-08-03T15:03:07.757" LastActivityDate="2018-08-03T15:03:07.757" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2989" PostTypeId="1" AcceptedAnswerId="2992" CreationDate="2014-10-08T05:42:31.463" Score="1" ViewCount="4472" Body="&lt;p&gt;I am including head.html and scripts.html in my template. Most of the scripts load except for 2 yet the path is the same for all of them. I {% include %} them.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;If I change foundation.min.js to foundation.js it works. The min file exists. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;This is because JS files are checked for errors before being loaded. For example, if I visit those URL's directly it will show me an error. Any way to stop that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craft.dev/bower_components/foundation/js/foundation.min.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craft.dev/bower_components/foundation/js/foundation.min.js&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F5w8O.png&quot; alt=&quot;JS Error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;/bower_components/jquery/dist/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/bower_components/foundation/js/foundation.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/bower_components/imagesloaded/imagesloaded.pkgd.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/bower_components/velocity/velocity.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/bower_components/velocity/velocity.ui.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/bower_components/wookmark-jquery/jquery.wookmark.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/js/app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="872" LastEditorUserId="872" LastEditDate="2014-10-10T02:24:21.530" LastActivityDate="2014-10-10T02:24:21.530" Title="Correct way to include include scripts" Tags="&lt;url&gt;&lt;include&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2990" PostTypeId="2" ParentId="2986" CreationDate="2014-10-08T05:55:26.980" Score="33" Body="&lt;p&gt;Without having to use a separate Plugin this is a good basic practice on setting up basic SEO for your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First create three new fields called &quot;&lt;strong&gt;seoTitle&lt;/strong&gt;&quot;, &quot;&lt;strong&gt;seoDescription&lt;/strong&gt;&quot; and &quot;&lt;strong&gt;seoKeywords&lt;/strong&gt;&quot;. Put these three fields in a Global group called &quot;&lt;strong&gt;globalSeo&lt;/strong&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your layout template &quot;&lt;em&gt;layouts/_layout.html&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set seoTitle = globalSeo.seoTitle %}&#xA;    {% set seoDescription = globalSeo.seoDescription %}&#xA;    {% set seoKeywords = globalSeo.seoKeywords %}&#xA;    &amp;lt;!DOCTYPE html&amp;gt;&#xA;    &amp;lt;html&amp;gt;&#xA;        &amp;lt;head&amp;gt;&#xA;            &amp;lt;title&amp;gt;{% if title is defined %}{{ title }}{% else %}{{ seoTitle }}{% endif %}&amp;lt;/title&amp;gt;&#xA;            &amp;lt;meta name=&quot;description&quot; content=&quot;{% if description is defined %}{{ description }}{% else %}{{ seoDescription }}{% endif %}&quot;/&amp;gt;&#xA;            &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ seoKeywords }}&quot;/&amp;gt;&#xA;&#xA;            {# You can then use the same fields for Facebook tags etc.. or create separate fields. #}&#xA;            &amp;lt;meta property=&quot;og:title&quot; content=&quot;{% if title is defined %}{{ title }}{% else %}{{ seoTitle }}{% endif %}&quot;/&amp;gt;&#xA;            &amp;lt;meta property=&quot;og:description&quot; content=&quot;{% if description is defined %}{{ description }}{% else %}{{ seoDescription }}{% endif %}&quot;/&amp;gt;&#xA;        &amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now per template override these standard variables with your own for that particular page and/or template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% extends &quot;layouts/_layout&quot; %}&#xA;    {% set title = &quot;This is a my custom Page Title&quot; %}&#xA;    {% set description = &quot;This is a my custom Page Description&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% extends &quot;layouts/_layout&quot; %}&#xA;    {% set title = entry.title %}&#xA;    {% set description = entry.descriptionField %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.. or if you want to user to have custom control over the entry SEO as well you can always add the same &quot;&lt;strong&gt;seoTitle&lt;/strong&gt;&quot; fields to the entry's Channel/Structure/Single and do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% extends &quot;layouts/_layout&quot; %}&#xA;    {% set title = entry.seoTitle %}&#xA;    {% set description = entry.seoDescription %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastEditorUserId="3795" LastEditDate="2016-06-14T11:17:06.800" LastActivityDate="2016-06-14T11:17:06.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2991" PostTypeId="1" AcceptedAnswerId="2994" CreationDate="2014-10-08T07:12:45.043" Score="2" ViewCount="580" Body="&lt;p&gt;For entries where the content isn't translated yet I'd like to add a &quot;Sorry not translated yet&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since all the content is synced is there a way to check if the synced content is the same as in the other locales?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-10-08T09:31:55.037" Title="Detect if a language is translated or not" Tags="&lt;localization&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2992" PostTypeId="2" ParentId="2989" CreationDate="2014-10-08T07:15:50.863" Score="1" Body="&lt;p&gt;One way to include JS (or CSS) files, is to use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;includeJsFile&lt;/a&gt; tag.&#xA;This tag will queue your file and append to the end of the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&#xA;If, for some reason, you don't want this (say you want to include JQuery in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;), I would just use &lt;code&gt;&amp;lt;script src=&quot;&quot;&amp;gt;&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might also solve your second problem.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-08T07:15:50.863" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2993" PostTypeId="2" ParentId="952" CreationDate="2014-10-08T08:18:37.270" Score="1" Body="&lt;p&gt;I've had the same problem for the past few weeks with my windows vagrant setup, it's been driving me crazy. Works fine on our staging server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I finally got it working :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did 2 things not sure yet which fixed it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;added this to my vagrant file&#xA;config.vm.synced_folder &quot;./craft/storage/runtime&quot;, &quot;/var/www/craft/storage/runtime&quot;, &#xA;disabled: true&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;destroyed my vagrant instance (vagrant destroy) and recreated it (vagrant up)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="760" LastActivityDate="2014-10-08T08:18:37.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2994" PostTypeId="2" ParentId="2991" CreationDate="2014-10-08T09:10:33.823" Score="4" Body="&lt;p&gt;You could try adding something like the following to the end of your template. This is assuming you only have 2 locales.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# test for the current entry locale (i.e. spanish) #}&#xA;{% if entry.locale = 'es' %}&#xA;&#xA;    {# retrieve the same entry in the original locale #}&#xA;    {% set localizedEntry = craft.entries.id(entry.id).locale('en') %}&#xA;&#xA;    {# compare the body content, and append additional content #}&#xA;    {% if localizedEntry[0].body == entry.body %}&#xA;        Sorry, not translated yet.&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-08T09:31:55.037" LastActivityDate="2014-10-08T09:31:55.037" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2995" PostTypeId="1" AcceptedAnswerId="2996" CreationDate="2014-10-08T09:14:35.900" Score="2" ViewCount="608" Body="&lt;p&gt;I'm making a site with Craft CMS/Angularjs. I'm using angular to filter and display entries on the index page and it's working good so far except for one thing. The login/register/entry form's all don't function at all. If I remove ng-app from the html tag they work just fine so it's definitely angular that's causing this issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my login form on the main page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;        You are logged in as &amp;lt;strong&amp;gt;{{ currentUser.friendlyName }}&amp;lt;/strong&amp;gt;&#xA;        &amp;lt;a href=&quot;/logout&quot;&amp;gt;logout&amp;lt;/a&amp;gt;&#xA;&#xA;    {% else %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;loginName&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Login&quot;&amp;gt;&#xA;&#xA;        {% if errorMessage is defined %}&#xA;            &amp;lt;p&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;p&amp;gt;Please login or &amp;lt;a href=&quot;/register&quot;&amp;gt;register&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone with experience using angular and craft together can chime in that'll be great.&lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="22" LastEditDate="2017-05-10T00:19:48.377" LastActivityDate="2017-05-10T00:19:48.377" Title="Craft front-end forms not working with Angularjs app" Tags="&lt;form&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2996" PostTypeId="2" ParentId="2995" CreationDate="2014-10-08T09:30:54.953" Score="2" Body="&lt;p&gt;Okay so I figured it out. Turns out a form won't submit in an Angular app if it doesn't have an action specified.&lt;/p&gt;&#xA;" OwnerUserId="829" LastActivityDate="2014-10-08T09:30:54.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2997" PostTypeId="1" AcceptedAnswerId="3006" CreationDate="2014-10-08T10:08:18.457" Score="10" ViewCount="1338" Body="&lt;p&gt;First off, I appreciate this is open ended and SE isn't the best place for it. For a lack of a better place to ask though, here we are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just built a system for a client where users could sign up an book places on events. None of the bookings on this system require payment, so it's just a case of submitting a form which creates an entry in a channel called &quot;bookings&quot; using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action=saveEntry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I now have a client who needs to take bookings for events which require payment, and to list those bookings in a front end page. I'm trying to use &lt;a href=&quot;http://squarebit.co.uk/plugins/charge&quot;&gt;Charge&lt;/a&gt; for payments (only because it seems easy to use, and my client doesn't want to pay monthly for something), which requires the form action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action=charge/charge&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The issue I have is that I want to submit a single form which takes a payment and creates a booking (action=saveEntry) &lt;strong&gt;without writing a plugin&lt;/strong&gt;. I'm not a backend developer, I don't know how to write plugins (despite trying). None of the eCommerce addons available for Craft are out of beta yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to take a payment and create a booking using template code?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="9" LastEditDate="2014-10-09T14:15:55.280" LastActivityDate="2014-10-09T14:15:55.280" Title="Booking paid-for events: How?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;booking&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2998" PostTypeId="2" ParentId="2997" CreationDate="2014-10-08T10:48:55.683" Score="1" Body="&lt;p&gt;Currently, you will have to either use a plugin, or dump all your content into a notes field given by Charge (this would require JS coding). There are new features coming up in 2.0, but you would need to talk to &lt;a href=&quot;http://squarebit.co.uk/&quot; rel=&quot;nofollow&quot;&gt;Joel over at Square Bit&lt;/a&gt; for any details. If this is a crucial feature, you can hire a Craft developer over at &lt;a href=&quot;http://straightupcraft.com/professionals&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-10-08T10:48:55.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2999" PostTypeId="1" AcceptedAnswerId="3001" CreationDate="2014-10-08T11:09:09.790" Score="2" ViewCount="247" Body="&lt;p&gt;Does anyone know if it is possible to apply a Twig filter or use escaping to convert a Craft textfield into a html class/id safe string?&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2014-10-08T13:30:17.203" Title="Convert textfield to be used in html class or id?" Tags="&lt;templating&gt;&lt;filter&gt;&lt;escaping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3000" PostTypeId="1" AcceptedAnswerId="3010" CreationDate="2014-10-08T13:25:53.233" Score="4" ViewCount="736" Body="&lt;p&gt;How can I add a counter or something similar to my entries, so that I could loop through the most read articles?&lt;/p&gt;&#xA;" OwnerUserId="874" LastEditorUserId="250" LastEditDate="2014-10-08T14:24:51.373" LastActivityDate="2017-05-29T18:25:57.790" Title="Counter for entries to show most read Articles" Tags="&lt;entries&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3001" PostTypeId="2" ParentId="2999" CreationDate="2014-10-08T13:30:17.203" Score="1" Body="&lt;p&gt;You can do this with the Luke Holder's &lt;a href=&quot;https://github.com/lukeholder/craft-inflect&quot; rel=&quot;nofollow&quot;&gt;Inflect plugin&lt;/a&gt;. Which method to use would depend on how you want the resulting text to look. I'd use &lt;code&gt;{{ myTextField|slugify }}&lt;/code&gt; to get a string that looks like this &quot;this-is-my-class&quot;, since I only use lowercase and hyphenate class/id names.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-08T13:30:17.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3002" PostTypeId="2" ParentId="2978" CreationDate="2014-10-08T14:32:43.853" Score="6" Body="&lt;p&gt;I wouldn’t recommend hacking the MySQL timezone, since that would happen on a global basis, not just for the current user, and will result in some weird race conditions whenever two people are using the site/CP at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting an entry to go live at a certain time based on their time zone is a fundamentally different thing than the feature provided by entry Post Dates. So your best bet here is to code the functionality yourself, rather than trying to bend Post Dates into something they’re not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, you should create your own custom Date/Time field to hold the post dates. Give it a handle that’s different than “postDate” so you don’t run into naming conflicts in your templates - let’s say it’s “liveDate”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your templates, you can query against your liveDate field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set timezone = 'Europe/Paris' %}&#xA;{% set localDate = date()|date('Y-m-d H:i:s', timezone) %}&#xA;{% set entries = craft.entries.section('blog').liveDate('&amp;lt;=' ~ localDate) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will only give you entries where the liveDate field is before or equal to the current date/time, in whatever timezone you’ve passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couple gotcha’s:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Twig’s &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;|date&lt;/a&gt; filter requires that you specify the timezone using one of PHP’s supported &lt;a href=&quot;http://php.net/manual/en/timezones.php&quot; rel=&quot;nofollow&quot;&gt;timezone names&lt;/a&gt;, not a numeric offset. Your script that is determining the timezone based on the user’s IP will need to account for that.&lt;/li&gt;&#xA;&lt;li&gt;The built-in Post Date fields will still be enforced, so you will need to get in the habit of making sure those are set at least 14 hours before the custom liveDate field is set (UTC-14 is the earliest time that “tomorrow” begins). That’s assuming you’ve left your system timezone set to UTC in Settings &gt; General.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-23T20:10:46.573" LastActivityDate="2014-10-23T20:10:46.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3003" PostTypeId="1" AcceptedAnswerId="3004" CreationDate="2014-10-08T15:03:56.693" Score="2" ViewCount="338" Body="&lt;p&gt;At the moment I have an image 300px wide, my transform is set to a width of 600px so it upscales it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like it to only transform if the image is over 600px. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible or should I use some other image manipulation thing like phpthumb?&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2014-10-08T15:13:00.107" Title="Image transform that only crops if image is larger than set dimensions" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ClosedDate="2014-10-10T13:30:28.067" ContentLicense="CC BY-SA 3.0" />
  <row Id="3004" PostTypeId="2" ParentId="3003" CreationDate="2014-10-08T15:13:00.107" Score="4" Body="&lt;p&gt;You can easily do this in twig with a conditional that checks if the width of the image is larger than your target transforms width. Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if image.getWidth()&amp;gt;600 %}&#xA;  &amp;lt;img src=&quot;{{ image.getUrl({ width: 600 }) }}&quot;&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-08T15:13:00.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3005" PostTypeId="1" CreationDate="2014-10-08T15:15:10.117" Score="2" ViewCount="317" Body="&lt;p&gt;I'm looking to add some additional functionality to the user registration process. Basically, we will be creating &quot;access codes&quot; that can be used N number of times during registration. Once N users have signed up using that code, the plugin that I'm writing will prevent additional users from registering on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I'm having trouble determining how to add errors to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;users.onBeforeSaveUser&lt;/code&gt;&lt;/a&gt; event. My plugin checks availability of the access code that was submitted during the registration process, and I'd like to prevent Craft from saving the user if the code isn't valid/enabled. Here's what the code looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class GatekeeperPlugin extends BasePlugin&#xA;{&#xA;&#xA;  ...&#xA;&#xA;  function init()&#xA;  {&#xA;&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;      // The user that's about to be saved&#xA;      $user = $event-&amp;gt;params['user'];&#xA;&#xA;      // Determine if an access code was submitted&#xA;      $accessCodeUsed = isset($user-&amp;gt;contentFromPost['accessCodeUsed']) ? $user-&amp;gt;contentFromPost['accessCodeUsed'] : false ;&#xA;&#xA;      // If there was an access code submitted...&#xA;      if ($accessCodeUsed)&#xA;      {&#xA;&#xA;        // Look for it in the database&#xA;        $queryAccessCode = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;          -&amp;gt;select('id, field_code, field_limit, field_timesUsed')&#xA;          -&amp;gt;from('content')&#xA;          -&amp;gt;where(array('field_code' =&amp;gt; $accessCodeUsed))&#xA;          -&amp;gt;limit('1')&#xA;          -&amp;gt;queryRow();&#xA;&#xA;        // If the code was found...&#xA;        if($queryAccessCode)&#xA;        {&#xA;&#xA;          ...Do some stuff&#xA;&#xA;        }&#xA;&#xA;        // If the code wasn't found...&#xA;        else&#xA;        {&#xA;&#xA;          // Prevent Craft from saving the user&#xA;          // Add error &quot;Sorry, that code is not valid.&quot;&#xA;&#xA;&#xA;        }&#xA;&#xA;      }&#xA;&#xA;    });&#xA;&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that error messages can only be added to models, but I'm working with an event here. The event has a user model within it, but trying to add errors to it (e.g. &lt;code&gt;$event-&amp;gt;params['user']-&amp;gt;addErrors([array of errors])&lt;/code&gt;) hasn't worked for me. Any pointers, here?&lt;/p&gt;&#xA;" OwnerUserId="799" LastActivityDate="2014-10-08T15:57:34.307" Title="Add errors to an event via plugin" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3006" PostTypeId="2" ParentId="2997" CreationDate="2014-10-08T15:36:31.000" Score="11" Body="&lt;p&gt;We did something similar with Charge when we were accepting payments for a &lt;a href=&quot;http://buildwithcraft.com/training&quot;&gt;Craft Virtual Training&lt;/a&gt; course. It does involve writing a plugin, but thankfully all of the heavy lifting for saving entries and charging credit cards is handled by the services provided by Craft and Charge, so the only thing the plugin has to worry about is collecting post data and passing it to some APIs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start off by creating a primary plugin class (see &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot;&gt;Setting Things Up&lt;/a&gt; in the Craft plugin docs), and then giving your plugin a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot;&gt;controller&lt;/a&gt; with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class FooController extends BaseController&#xA;{&#xA;    public $allowAnonymous = array('actionCreateBooking');&#xA;&#xA;    public function actionCreateBooking()&#xA;    {&#xA;        // Require this to be a POST request&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // Require that the user is logged in&#xA;        craft()-&amp;gt;userSession-&amp;gt;requireLogin();&#xA;&#xA;        // Get the user&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;        // Do any custom validation here&#xA;        // ...&#xA;&#xA;        // Charge the card&#xA;        $charge = new ChargeModel();&#xA;&#xA;        $charge-&amp;gt;cardToken     = craft()-&amp;gt;request-&amp;gt;getRequiredPost('cardToken');&#xA;        $charge-&amp;gt;cardLast4     = craft()-&amp;gt;request-&amp;gt;getPost('cardLast4');&#xA;        $charge-&amp;gt;cardType      = craft()-&amp;gt;request-&amp;gt;getPost('cardType');&#xA;        $charge-&amp;gt;cardName      = craft()-&amp;gt;request-&amp;gt;getPost('cardName');&#xA;        $charge-&amp;gt;cardExpMonth  = craft()-&amp;gt;request-&amp;gt;getPost('cardExpMonth');&#xA;        $charge-&amp;gt;cardExpYear   = craft()-&amp;gt;request-&amp;gt;getPost('cardExpYear');&#xA;&#xA;        $charge-&amp;gt;customerName  = craft()-&amp;gt;request-&amp;gt;getPost('customerName');&#xA;        $charge-&amp;gt;customerEmail = craft()-&amp;gt;request-&amp;gt;getPost('customerEmail');&#xA;&#xA;        $charge-&amp;gt;planAmount    = 10000; // In cents&#xA;&#xA;        if ($charge-&amp;gt;validate() &amp;amp;&amp;amp; craft()-&amp;gt;charge-&amp;gt;handlePayment($charge))&#xA;        {&#xA;            // Save the booking entry&#xA;            $entry = new EntryModel();&#xA;            $entry-&amp;gt;sectionId = craft()-&amp;gt;request-&amp;gt;getPost('sectionId');&#xA;            $entry-&amp;gt;typeId    = craft()-&amp;gt;request-&amp;gt;getPost('typeId'); // Not necessary if there's only one entry type&#xA;            $entry-&amp;gt;authorId  = $user-&amp;gt;id;&#xA;            $entry-&amp;gt;enabled   = true;&#xA;&#xA;            $entry-&amp;gt;getContent()-&amp;gt;title = 'New Booking: '.$user-&amp;gt;username;&#xA;            $entry-&amp;gt;getContent()-&amp;gt;chargeId = $charge-&amp;gt;id; // Custom number field&#xA;            $entry-&amp;gt;getContent()-&amp;gt;someOtherCustomField = 'xyz';&#xA;&#xA;            craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;            // Redirect the request based on the 'redirect' param&#xA;            craft()-&amp;gt;userSession-&amp;gt;setNotice('Booking saved.');&#xA;            $this-&amp;gt;redirectToPostedUrl();&#xA;        }&#xA;        else&#xA;        {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError('Couldn’t charge the card.');&#xA;&#xA;            // Send the charge model to the template&#xA;            craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                'charge' =&amp;gt; $charge&#xA;            ));&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might want to hard-code the sectionId and typeId rather than leaving it up to the POST data, and there might be other slight changes you want to make, but that’s the gist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the plugin in place, you would just need to create a form that captures all of the info the controller is looking for, and posts it to the &lt;code&gt;foo/createBooking&lt;/code&gt; action:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;foo/createBooking&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- ... --&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-08T18:38:39.317" LastActivityDate="2014-10-08T18:38:39.317" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3007" PostTypeId="2" ParentId="3005" CreationDate="2014-10-08T15:57:34.307" Score="2" Body="&lt;p&gt;Events are generally not capable of having an effect on the calling code; they’re just notifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would probably be better off disabling public user registration (Settings &gt; Users &gt; Settings), and creating a custom controller that registers users instead. Your controller would be the one to determine if there are still any slots left, and if so, call &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;users-&gt;saveUser()&lt;/a&gt; itself.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T15:57:34.307" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3008" PostTypeId="1" AcceptedAnswerId="3009" CreationDate="2014-10-08T16:01:55.277" Score="5" ViewCount="1679" Body="&lt;p&gt;I'm wondering if this plugin already exists and I'm just not finding it on Github or via Google. Essentially looking for a CraftCMS version of the ExpressionEngine plugin called &quot;Data Grab&quot; - &lt;a href=&quot;http://brandnewbox.co.uk/products/details/datagrab&quot; rel=&quot;noreferrer&quot;&gt;http://brandnewbox.co.uk/products/details/datagrab&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin basically lets you define a feed and run automated imports to create entries. Hoping someone has done this in Craft or has some pointers to a preexisting plugin!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="875" LastActivityDate="2016-12-23T03:58:58.383" Title="Creating entries from JSON feed - plugin?" Tags="&lt;entries&gt;&lt;import&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3009" PostTypeId="2" ParentId="3008" CreationDate="2014-10-08T16:56:01.360" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/boboldehampsink/import/&quot; rel=&quot;nofollow&quot;&gt;Import&lt;/a&gt; plugin by Bob Olde Hampsink can import CSVs. JSON support is on the roadmap, but in the meantime, it’s easy enough to convert JSON to a CSV with a little bit of Javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just paste this into your browser’s JS console on any webpage:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var data = [&#xA;    { title: &quot;Entry Title&quot;, body: &quot;Body content&quot; },&#xA;    { title: &quot;Entry Title 2&quot;, body: &quot;More body content&quot; },&#xA;    // etc.&#xA;];&#xA;&#xA;function csvVal(val) {&#xA;    // Borrowed from http://phpjs.org/functions/addslashes/&#xA;    return '&quot;' + ((val + '').replace(/[\\&quot;']/g, '\\$&amp;amp;').replace(/\u0000/g, '\\0')) + '&quot;';&#xA;}&#xA;&#xA;var csv = '';&#xA;&#xA;data.forEach(function(row) {&#xA;    csv += csvVal(row.title) + ',' + csvVal(row.body) + &quot;\n&quot;;&#xA;});&#xA;&#xA;console.log(csv);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Save the resulting CSV as somefile.csv and then you can upload it to the Import plugin.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T16:56:01.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3010" PostTypeId="2" ParentId="3000" CreationDate="2014-10-08T16:56:53.417" Score="3" Body="&lt;p&gt;Updated: There is an &lt;a href=&quot;https://www.putyourlightson.net/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Count&lt;/a&gt; plugin that is designed to do exactly this, written by Ben Croker. Thanks Ben!&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2017-05-29T18:25:57.790" LastActivityDate="2017-05-29T18:25:57.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3011" PostTypeId="1" AcceptedAnswerId="3013" CreationDate="2014-10-08T17:08:33.560" Score="8" ViewCount="2637" Body="&lt;p&gt;How do you output the all the children of a structure in a reverse order (assuming the children are limited to max depth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot; rel=&quot;noreferrer&quot;&gt;order parameter&lt;/a&gt;, Craft requires that you use a second parameter like &lt;code&gt;&quot;desc&quot;&lt;/code&gt; after a primary order parameter (eg, &lt;code&gt;&quot;title&quot;&lt;/code&gt;). This would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('volumes').order('title desc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what would be the primary parameter that would respect the natural structure order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there any other way? &lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2014-10-08T17:29:23.867" Title="Output children of a structure section in reverse order" Tags="&lt;structure&gt;&lt;sections&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3012" PostTypeId="2" ParentId="3011" CreationDate="2014-10-08T17:13:42.457" Score="8" Body="&lt;p&gt;You could &lt;s&gt;try using&lt;/s&gt; use the &lt;code&gt;reverse&lt;/code&gt; twig filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('volumes')|reverse %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="125" LastEditDate="2014-10-08T17:27:26.160" LastActivityDate="2014-10-08T17:27:26.160" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3013" PostTypeId="2" ParentId="3011" CreationDate="2014-10-08T17:29:23.867" Score="11" Body="&lt;p&gt;The primary parameter you're looking for is &lt;code&gt;lft&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('volumes').order('lft desc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-08T17:29:23.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3014" PostTypeId="2" ParentId="2930" CreationDate="2014-10-08T17:44:53.100" Score="3" Body="&lt;p&gt;Since files that begin with a dot are hidden by default in Unix-based systems like OS X, Craft ships with a “htaccess” file rather than “.htaccess”. If you are using Apache and want to use this file, you need to rename it to .htaccess when you upload it to your web server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure why suddenly your site stopped working, but I can tell you that Craft auto-updates will only ever touch files within the craft/app/ folder, so if your .htaccess file was misnamed, it’s definitely not due to a Craft auto-update.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T17:44:53.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3015" PostTypeId="2" ParentId="2961" CreationDate="2014-10-08T17:59:27.800" Score="4" Body="&lt;p&gt;Currently, no. The only file-based validation Assets fields have right now is the type. If you want to enforce a certain size, you can do that on the template end using &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;image transforms&lt;/a&gt;. I would suggest adding some instruction text to your Assets field that provides a minimum suggested size, and note that smaller images will be scaled up and look gross.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, if you &lt;em&gt;really&lt;/em&gt; want to enforce a minimum width/height, or other properties, you can do so by writing a plugin that provides its own field type, which extends &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/AssetsFieldType&quot; rel=&quot;nofollow&quot;&gt;AssetsFieldType&lt;/a&gt; and overrides its &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/AssetsFieldType#validate-detail&quot; rel=&quot;nofollow&quot;&gt;validate()&lt;/a&gt; method with your custom validation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function validate($value)&#xA;{&#xA;    // Let AssetsFieldType do its validation first&#xA;    $errors = parent::validate($value);&#xA;&#xA;    if (!is_array($errors))&#xA;    {&#xA;        $errors = array();&#xA;    }&#xA;&#xA;    if (is_array($value) &amp;amp;&amp;amp; !empty($value))&#xA;    {&#xA;        foreach ($value as $fileId)&#xA;        {&#xA;            $file = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;&#xA;            if ($file)&#xA;            {&#xA;                if ($file-&amp;gt;width &amp;lt; 600 || $file-&amp;gt;height &amp;lt; 400)&#xA;                {&#xA;                    $errors[] = Craft::t(&#xA;                        '{filename} must be at least 600x400px.',&#xA;                        array('filename' =&amp;gt; $file-&amp;gt;filename)&#xA;                    );&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    if ($errors)&#xA;    {&#xA;        return $errors;&#xA;    }&#xA;    else&#xA;    {&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T17:59:27.800" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3016" PostTypeId="2" ParentId="2932" CreationDate="2014-10-08T18:06:57.697" Score="2" Body="&lt;p&gt;If your production server is getting user-generated content, then your best bet is to just keep track of changes you make, and redo them manually on production. Probably not what you wanted to hear, and we would love to have a better solution for you down the road, but it’s a pretty far way away. Maybe someone will write a plugin that helps in the meantime.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T18:06:57.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3017" PostTypeId="1" AcceptedAnswerId="3019" CreationDate="2014-10-08T19:33:21.070" Score="2" ViewCount="146" Body="&lt;p&gt;When providing plugin users with variable containing arguments like &lt;code&gt;{{ craft.pluginname.variable(arg1, arg2) }}&lt;/code&gt; what's the best practice for returning something that doesn't throw an Internal Server Error exception for Missing argument 1 or argument 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should this be done as part of the /services/PluginService.php or somewhere else? Is it better to return a nicer Javascript console error (or Craft error log) vs. crashing the page?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-10-08T19:49:36.760" Title="What's the best way to degrade gracefully when using a Plugin Variable?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3018" PostTypeId="2" ParentId="3017" CreationDate="2014-10-08T19:44:43.870" Score="1" Body="&lt;p&gt;You can use the &lt;code&gt;is defined&lt;/code&gt; twig expression to determine if a variable is defined or not. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.pluginname.variable(arg1, arg2) is defined %}&#xA;    {{ craft.pluginname.variable(arg1, arg2) }}&#xA;{% elseif %}&#xA;    &amp;lt;p class=&quot;notice&quot;&amp;gt;Display notice.&amp;lt;/p&amp;gt;.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-08T19:44:43.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3019" PostTypeId="2" ParentId="3017" CreationDate="2014-10-08T19:49:36.760" Score="6" Body="&lt;p&gt;I think the best way to do this would be in your &lt;code&gt;PluginHandleVariable&lt;/code&gt; file's method, just have it accept one, optional parameter and expect it to be an array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function variableMethod($options = null)&#xA;{&#xA;    if (!$options || !is_array($options))&#xA;    {&#xA;        return &quot;No options set&quot;;&#xA;    }&#xA;&#xA;    // Now you can check for individual options on the array&#xA;    if (isset($options['option1'])&#xA;    {&#xA;        ....&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then both of these would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if craft.pluginname.variable()&#xA;if craft.pluginname.variable(options)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-08T19:49:36.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3020" PostTypeId="1" AcceptedAnswerId="3021" CreationDate="2014-10-08T20:35:17.417" Score="15" ViewCount="8367" Body="&lt;p&gt;My plugin requires vendor library dependencies and api keys set. What is the recommended way to register an external library? I would also like to configure the public api keys separately for stage and production environments — is there a way to set these in craft/config with the rest of the multi-environment configuration? Or is it better to create a plugin config file of some kind?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am having to include these in each of my service methods (and something similar again in my javascript files):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _saveStripeCustomer($account, $token = NULL)&#xA;{&#xA;    require_once(CRAFT_PLUGINS_PATH . 'businesslogic/vendor/stripe/lib/Stripe.php');&#xA;    \Stripe::setApiKey(&quot;sk_test_xxxxxxxxxxxxxxxxxx&quot;);&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with composer. I don't know if that can perhaps help here.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-09-13T20:30:20.450" Title="What's the recommended way to include vendor library dependencies in your plugins?" Tags="&lt;plugin-development&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="3021" PostTypeId="2" ParentId="3020" CreationDate="2014-10-08T20:49:35.837" Score="26" Body="&lt;p&gt;Composer!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's already a package for Stripe: &lt;a href=&quot;https://packagist.org/packages/stripe/stripe-php&quot;&gt;https://packagist.org/packages/stripe/stripe-php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Install &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-nix&quot;&gt;composer&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a &lt;code&gt;composer.json&lt;/code&gt; file in your plugin's root folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add this to the &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&#xA;    &quot;require&quot;: {&#xA;        &quot;stripe/stripe-php&quot;: &quot;1.17.2&quot;&#xA;    }&#xA;}&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Run &lt;code&gt;php composer.phar update&lt;/code&gt; from your plugin's root folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The library will be installed in a &lt;code&gt;/vendor&lt;/code&gt; folder in your plugin.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add an &lt;code&gt;init()&lt;/code&gt; method to your main plugin's class file with this in it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;require CRAFT_PLUGINS_PATH.'/pluginhandle/vendor/autoload.php';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And you're done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Composer will handle autoloading all of the class files, so you don't need to worry about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you ever want to update the Stripe library to a newer release, grab the version number from the packagist site, update your &lt;code&gt;composer.json&lt;/code&gt; file with it and run &lt;code&gt;php composer.phar update&lt;/code&gt; again.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="689" LastEditDate="2015-09-13T20:30:20.450" LastActivityDate="2015-09-13T20:30:20.450" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3022" PostTypeId="2" ParentId="2927" CreationDate="2014-10-08T22:22:46.747" Score="2" Body="&lt;p&gt;To me, this seems like a great use case for a custom &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/widgets&quot; rel=&quot;nofollow&quot;&gt;dashboard widget&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-08T22:22:46.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3023" PostTypeId="1" CreationDate="2014-10-08T23:20:19.460" Score="4" ViewCount="1010" Body="&lt;p&gt;I have created my own plugin. It works on my Mac but when I try to enabled it in my Debian server it shows as Disabled with a red dot. What's the best way to debug this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not found anything particularly illuminating in the logs yet.&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2020-03-07T22:09:09.227" Title="Plugin won't enable" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3024" PostTypeId="2" ParentId="3023" CreationDate="2014-10-08T23:27:40.113" Score="4" Body="&lt;p&gt;Make sure that the name of your plugin directory is all lowercase:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/plugins/myplugin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On some systems, the capitalization doesn't matter, but on other systems it makes a difference. (&lt;a href=&quot;https://craftcms.stackexchange.com/a/1537/45&quot;&gt;related&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-08T23:27:40.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3025" PostTypeId="2" ParentId="3023" CreationDate="2014-10-08T23:29:51.303" Score="6" Body="&lt;p&gt;Turns out I had a capitalization typo in my plugin php file name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;myPlugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;class MyPlugin ...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Renaming the file to &lt;code&gt;MyPlugin.php&lt;/code&gt; solved it. (capitial M)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it would seem that the file and class name need to match exactly.&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2014-10-08T23:29:51.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3026" PostTypeId="1" AcceptedAnswerId="3032" CreationDate="2014-10-09T04:28:05.083" Score="7" ViewCount="2448" Body="&lt;p&gt;Okay so my question is simple. Is there a craft plugin that lets me add tables in my redactor fields? If not then is there a way I can add the table.js to the redactor plugin config. I add ti but it doesn't show up.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-11-06T15:51:30.883" Title="Redactor table plugin for craft" Tags="&lt;plugins&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3027" PostTypeId="1" AcceptedAnswerId="3028" CreationDate="2014-10-09T06:33:56.327" Score="2" ViewCount="582" Body="&lt;p&gt;What is the recommended way to configure public api keys for multi-environment configurations (i.e. local, dev, stage, production)? Is there a way to set these in either the &lt;code&gt;craft/config/general.php&lt;/code&gt; or in &lt;code&gt;plugin/config.php&lt;/code&gt; files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am having to include these in each of my service methods (and something similar again in my javascript files):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _saveStripeCustomer($account, $token = NULL)&#xA;{&#xA;    \Stripe::setApiKey(&quot;sk_test_xxxxxxxxxxxxxxxxxx&quot;);&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am generally following the configuration method shown &lt;a href=&quot;http://straightupcraft.com/configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (both multi-environment and multi-locale). And a plugin config.php as described &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1998/how-does-a-plugin-include-its-own-config-options&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-06T02:57:57.850" Title="Recommended way to include API keys in a multi-environment configuration?" Tags="&lt;plugin-development&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3028" PostTypeId="2" ParentId="3027" CreationDate="2014-10-09T07:57:02.230" Score="5" Body="&lt;p&gt;You can insert whatever settings you need either in your config/general.php file, config/pluginhandle.php, or the plugin/config.php file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have different value for your setting in each of the environments you have defined. If you call your setting &lt;code&gt;myplugin_stripe_key&lt;/code&gt;, you'd put something like this in your config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;      ...&#xA;    ),&#xA;&#xA;    'local' =&amp;gt; array(&#xA;        'myplugin_stripe_key' =&amp;gt; 'sk_test_xxxxxxxxxxxxxxxxxx',&#xA;        ...&#xA;    ),&#xA;&#xA;    'stage' =&amp;gt; array(&#xA;        'myplugin_stripe_key' =&amp;gt; 'sk_stage_xxxxxxxxxxxxxxxxxx',&#xA;        ...&#xA;    ),&#xA;&#xA;    'prod' =&amp;gt; array(&#xA;        'myplugin_stripe_key' =&amp;gt; 'sk_prod_xxxxxxxxxxxxxxxxxx',&#xA;        ...&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _saveStripeCustomer($account, $token = NULL)&#xA;{&#xA;  \Stripe::setApiKey(craft()-&amp;gt;config-&amp;gt;get('myplugin_stripe_key'));&#xA;  // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use this several places in your service, I'd fetch all settings in the constructor and save them in an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MypluginService extends BaseApplicationComponent&#xA;{&#xA;    var $settings = array();&#xA;&#xA;    public function __construct($urlRecord = null)&#xA;    {&#xA;        $this-&amp;gt;settings = $this-&amp;gt;_initSettings();&#xA;    }&#xA;&#xA;    private function _initSettings()&#xA;    {&#xA;        $settings = array();&#xA;        $settings['myplugin_stripe_key'] = craft()-&amp;gt;config-&amp;gt;get('myplugin_stripe_key');&#xA;        return $settings;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can access them later like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\Stripe::setApiKey($this-&amp;gt;settings['myplugin_stripe_key']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need this key in javascript, you could create a craft variable that gets the config setting and output it to a javascript variable somewhere in your twig templates. You'd basically use the same way to get the config variable inside the craft variable method.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-09T07:57:02.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3030" PostTypeId="1" CreationDate="2014-10-09T09:27:52.277" Score="0" ViewCount="1451" Body="&lt;p&gt;I am trying to put my categories and their children into a Bootstrap navbar. If category has Children it should become a dropdown link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('compositions') %}&#xA;&amp;lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;workCategories&quot;&amp;gt;&#xA;  &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;   {% nav entry in categories %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;     {% ifchildren %}&#xA;      &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;       &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;{{ entry.title }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;       {% children %}&#xA;     &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endifchildren %}&#xA;&amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It kind of work except that the top categories appear twice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;once with the dropdown and the children (which I want)&#xA;and once without the dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I nest those children without repeating them?&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2014-10-09T15:14:05.020" Title="Categories children in Bootstrap navbar" Tags="&lt;navigation&gt;&lt;category&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3031" PostTypeId="1" CreationDate="2014-10-09T09:48:09.443" Score="3" ViewCount="616" Body="&lt;p&gt;I have a Matrix field with Image, Caption, and PDF sub-fields. I can output the Image and Caption fine, but am having no luck with the PDF file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.seriesInformation %}&#xA;    {% if block.type == &quot;bladeImage&quot; %}&#xA;&#xA;        {% set image = block.image.first() %}&#xA;&#xA;        {% if image %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('bladesdetail') }}&quot; width=&quot;{{ image.getWidth('bladesdetail') }}&quot; height=&quot;{{ image.getHeight('bladesdetail') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% elseif block.type == &quot;caption&quot; %}&#xA;&#xA;        {{ block.caption }}&#xA;&#xA;    {% elseif block.type == &quot;bladeBrochure&quot; %}&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ bladeBrochure.url }}&quot;&amp;gt;Download &amp;amp;rarr;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="856" LastEditorUserId="9" LastEditDate="2014-10-09T17:04:30.050" LastActivityDate="2014-10-10T11:35:22.577" Title="How do I output a file’s URL in a Matrix field?" Tags="&lt;matrix&gt;&lt;blocks&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3032" PostTypeId="2" ParentId="3026" CreationDate="2014-10-09T09:48:29.183" Score="12" Body="&lt;p&gt;Craft ships with Redactor’s &lt;a href=&quot;https://imperavi.com/redactor/plugins/table/&quot; rel=&quot;noreferrer&quot;&gt;Table plugin&lt;/a&gt;, but you must add it to your Redactor config yourself (in craft/config/redactor/).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    // ...&#xA;    plugins: ['table']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To determine which config file to place this in, go to your field’s settings in Settings → Fields → [your Rich Text field name], and check your “Redactor Config” setting.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="9" LastEditDate="2015-11-06T15:51:30.883" LastActivityDate="2015-11-06T15:51:30.883" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3033" PostTypeId="2" ParentId="1147" CreationDate="2014-10-09T10:29:03.043" Score="4" Body="&lt;p&gt;Currently, no. The only file-based validation Assets fields have right now is the type. If you want to enforce a certain size, you can do that on the template end using &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;image transforms&lt;/a&gt;. I would suggest adding some instruction text to your Assets field that provides a minimum suggested size, and note that smaller images will be scaled up and look gross.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, if you &lt;em&gt;really&lt;/em&gt; want to enforce a minimum width/height, or other properties, you can do so by writing a plugin that provides its own field type, which extends &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/AssetsFieldType&quot; rel=&quot;nofollow&quot;&gt;AssetsFieldType&lt;/a&gt; and overrides its &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/AssetsFieldType#validate-detail&quot; rel=&quot;nofollow&quot;&gt;validate()&lt;/a&gt; method with your custom validation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function validate($value)&#xA;{&#xA;    // Let AssetsFieldType do its validation first&#xA;    $errors = parent::validate($value);&#xA;&#xA;    if (!is_array($errors))&#xA;    {&#xA;        $errors = array();&#xA;    }&#xA;&#xA;    if (is_array($value) &amp;amp;&amp;amp; !empty($value))&#xA;    {&#xA;        foreach ($value as $fileId)&#xA;        {&#xA;            $file = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;&#xA;            if ($file)&#xA;            {&#xA;                if ($file-&amp;gt;width &amp;lt; 600 || $file-&amp;gt;height &amp;lt; 400)&#xA;                {&#xA;                    $errors[] = Craft::t(&#xA;                        '{filename} must be at least 600x400px.',&#xA;                        array('filename' =&amp;gt; $file-&amp;gt;filename)&#xA;                    );&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    if ($errors)&#xA;    {&#xA;        return $errors;&#xA;    }&#xA;    else&#xA;    {&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-09T10:29:03.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3034" PostTypeId="2" ParentId="3031" CreationDate="2014-10-09T10:42:58.433" Score="5" Body="&lt;p&gt;I'm assuming that your PDF field is an assets field? If so, it works exactly the same way as images, and you can output it using something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldHandle %}&#xA;    {% set pdf = block.pdfFieldHandle.first() %}&#xA;    &amp;lt;a href=&quot;{{pdf.getUrl}}&quot;&amp;gt;Text&amp;lt;/a&amp;gt;&#xA;{% endfor %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="9" LastEditDate="2014-10-09T17:06:47.260" LastActivityDate="2014-10-09T17:06:47.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3035" PostTypeId="2" ParentId="3031" CreationDate="2014-10-09T10:44:47.257" Score="6" Body="&lt;p&gt;Assuming the field where your client can select the download is an asset field, you can use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;bladeBrochure&quot; %}&#xA;    {% set download = block.download.first() %}&#xA;    {% if download %}&#xA;        &amp;lt;a href=&quot;{{ download.url }}&quot;&amp;gt;Click me to download&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replacing &lt;code&gt;block.download&lt;/code&gt; with the name of your field.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-10-09T10:44:47.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3036" PostTypeId="2" ParentId="3030" CreationDate="2014-10-09T11:29:07.983" Score="2" Body="&lt;p&gt;I guess it would be easier to use a for-loop instead of that nav-loop in your case. Although it's harder to get multi-level-dropdowns&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('compositions') %}&#xA;&amp;lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;workCategories&quot;&amp;gt;&#xA;  &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;    {% for entry in categories %}&#xA;      {% if not entry.hasDescendants() %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% else %}&#xA;        &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;{{ entry.title }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;          &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;            {% for child in entry.getDescendants() %}&#xA;              &amp;lt;a href=&quot;{{ child.url }}&quot;&amp;gt;{{ child.title }}&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="733" LastActivityDate="2014-10-09T11:29:07.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3037" PostTypeId="1" AcceptedAnswerId="3038" CreationDate="2014-10-09T12:06:58.570" Score="1" ViewCount="3869" Body="&lt;p&gt;I want to return entries in the news section, except the one that has a slug the matches url segment 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').slug(not craft.request.getSegment(2)).limit(6) %}...&#xA;{% for entry in craft.entries.section('news').slug('and, not craft.request.getSegment(2)').limit(6) %}...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But neither work - &lt;em&gt;all&lt;/em&gt; entries are returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the right syntax please?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2014-10-09T12:48:23.070" Title="How to filter entries by slug in url segment?" Tags="&lt;entries&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3038" PostTypeId="2" ParentId="3037" CreationDate="2014-10-09T12:48:23.070" Score="3" Body="&lt;p&gt;I think there is just some confusion between what should be a string or not. From the docs on &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;Parameter Value Syntax&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To exclude entries with a given value, you must pass in a string, prefixed with not&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To that end the following should work for your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').slug('not ' ~ craft.request.getSegment(2)).limit(6) %}...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastActivityDate="2014-10-09T12:48:23.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3039" PostTypeId="1" CreationDate="2014-10-09T13:24:15.267" Score="7" ViewCount="15336" Body="&lt;p&gt;I've created a field type that stores its value as a model. That model’s &lt;code&gt;__toString()&lt;/code&gt; method returns the result of a &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render()&lt;/code&gt; call:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function render() &#xA;{&#xA;    $render = craft()-&amp;gt;templates-&amp;gt;render('myplugin/templates/mymodeltemplate');&#xA;    return $render;&#xA;}&#xA;&#xA;public function __toString()&#xA;{&#xA;    return $this-&amp;gt;render();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I output the model from a template, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ entry.myField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Twig encodes the resulting HTML as a string with HTML entities.  Running the string through &lt;code&gt;html_entity_decode()&lt;/code&gt; before returning it in &lt;code&gt;__toString()&lt;/code&gt; doesn't help.  I'm assuming this string formatting is happening somewhere at the Twig level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being new to Craft, I'd love to understand a little more of what's going on here.  How does the string representation of an element model get passed to and handled by Twig?&lt;/p&gt;&#xA;" OwnerUserId="800" LastEditorUserId="9" LastEditDate="2014-10-09T16:01:13.290" LastActivityDate="2019-09-12T22:02:29.363" Title="How do I prevent Twig from encoding HTML?" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3040" PostTypeId="1" CreationDate="2014-10-09T14:52:09.107" Score="0" ViewCount="249" Body="&lt;p&gt;This is a category page. I am trying to display all entries from users with this specific category selected in their account (user field that is a category field type.) This is the code I have so far, but it is not returning results. No errors - just not returning anything unfortunately:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{# Grab all the users who have this category selected (which is a 'category field type' user field) #}&#xA;{% set categoryUsers = craft.users.relatedTo(category).limit(null) %}&#xA;&#xA;{# Grab all of the entries by those users #}    &#xA;{% set categoryUserEntries = craft.entries.section('jobs').relatedTo(categoryUsers).limit(null) %}&#xA;&#xA;{% paginate categoryUserEntries.limit(8) as entries %}&#xA;&#xA;     {% for entry in entries %} &#xA;         &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;     {% endfor %}&#xA;&#xA;     {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;pagination left&quot;&amp;gt;&amp;amp;laquo; Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;     {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;pagination right&quot;&amp;gt;Next Page &amp;amp;raquo;&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-10-10T22:34:49.040" Title="Trying to list entries related to users with a specific category selected" Tags="&lt;entries&gt;&lt;relations&gt;&lt;category&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3041" PostTypeId="1" CreationDate="2014-10-09T14:58:51.880" Score="1" ViewCount="49" Body="&lt;p&gt;Is there any way to group or sort my own &quot;Craft::log()&quot; calls for my Plugins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a bit tedius to go through the Application-&gt;Logs each page load to try and find my own log messsages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe someone has a better approach to this?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-09T15:15:02.097" Title="Grouping/sorting for easier view of Craft::log messages" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3042" PostTypeId="2" ParentId="3041" CreationDate="2014-10-09T15:07:49.967" Score="3" Body="&lt;p&gt;Your plugin can keep its own log using &lt;code&gt;MyPlugin::log('Message', LogLevel::Error);&lt;/code&gt;. A &lt;code&gt;log&lt;/code&gt; method gets created automatically by extending BasePlugin. The plugin log will be located in &lt;code&gt;craft/storage/runtime/logs/&lt;/code&gt; along with the default logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note: The log files can be watched from the command line using &lt;code&gt;tail -F /full/path/to/log/file&lt;/code&gt; rather than having to constantly reload the log in a text editor. Although apparently some text editors also support live updates as well.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-09T15:15:02.097" LastActivityDate="2014-10-09T15:15:02.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3043" PostTypeId="2" ParentId="3030" CreationDate="2014-10-09T15:14:05.020" Score="0" Body="&lt;p&gt;thanks all, this worked for me... not sure it's straight forward but it works...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('compositions') %}&#xA;&amp;lt;nav class=&quot;navbar navbar-default&quot; role=&quot;navigation&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;navbar-header&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;button&quot; class=&quot;navbar-toggle collapsed&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#workCategories&quot;&amp;gt;&#xA;    &amp;lt;span class=&quot;sr-only&quot;&amp;gt;Toggle navigation&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/button&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;workCategories&quot;&amp;gt;&#xA;&amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;  {% for entry in categories %}&#xA;  {% if entry.level == 1 and entry.children|length %}&#xA;    &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;{{ entry.title }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;        {% for child in entry.getDescendants() %}&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ child.url }}&quot;&amp;gt;{{ child.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% elseif entry.level == 1 and not entry.hasDescendants() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastActivityDate="2014-10-09T15:14:05.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3044" PostTypeId="1" AcceptedAnswerId="3056" CreationDate="2014-10-09T15:25:22.180" Score="2" ViewCount="770" Body="&lt;p&gt;I'm trying to set us the Rich Text Editor for inputting code snippets. I've almost got it working except when I go back to edit the entry Redactor removes spaces I entered to format the code. Also setting the tabAsSpaces doesn't seem to work. It still adds tab space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have in Redactor config.json&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    toolbar: false,&#xA;    visual: false,&#xA;    tabAsSpaces: 2,&#xA;    cleanOnPaste: false,&#xA;    cleanSpaces: false,&#xA;    cleanStyleOnEnter: true,&#xA;    paragraphize: false,&#xA;    minHeight: 200&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;&amp;lt;pre&amp;gt;&#xA;  &amp;lt;code&amp;gt;&#xA;    {{- block.html|replace({'&amp;amp;':'&amp;amp;amp;', '&amp;lt;':'&amp;amp;lt;', '&amp;gt;':'&amp;amp;gt;'})|raw -}}&#xA;  &amp;lt;/code&amp;gt;&#xA;&amp;lt;/pre&amp;gt;&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2014-10-09T19:28:01.610" Title="How do I set up the Rich Text Editor Field (Redactor) for code snippets?" Tags="&lt;templating&gt;&lt;richtext&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3045" PostTypeId="1" AcceptedAnswerId="3050" CreationDate="2014-10-09T15:26:24.463" Score="7" ViewCount="1384" Body="&lt;p&gt;I have a &lt;code&gt;detail&lt;/code&gt; transform setup and here's my template code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if block.type == 'image' %}&#xA;    {% for asset in block.image %}&#xA;        &amp;lt;img src=&quot;{{ asset.url('detail') }}&quot; alt=&quot;{{ asset.title }}&quot; class=&quot;{% if block.position in ['left'] %}pull-left{% endif %}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But on the front end it's taking a smaller image and stretching it and it's become distorted. If I remove &lt;code&gt;'detail'&lt;/code&gt; from the &lt;code&gt;url()&lt;/code&gt; parameter it's fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what my Detail Transform looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NDQn7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also looks like all transforms are doing the same thing as well. So it's not just related to the &lt;code&gt;detail&lt;/code&gt; transform.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="9" LastEditDate="2014-10-09T16:41:37.490" LastActivityDate="2014-10-10T07:41:59.617" Title="Image transforms getting applied even when image is smaller than the transform's width" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3047" PostTypeId="2" ParentId="3039" CreationDate="2014-10-09T16:01:40.777" Score="8" Body="&lt;p&gt;Whenever you output anything with Twig’s &lt;code&gt;{{ output tags }}&lt;/code&gt;, the contents will get encoded by default. You have to pass the content through the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;|raw&lt;/code&gt;&lt;/a&gt; filter in order for it to be output verbatim.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ entry.myFieldHandle|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-10T18:05:32.640" LastActivityDate="2014-10-10T18:05:32.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3048" PostTypeId="2" ParentId="2565" CreationDate="2014-10-09T16:15:38.707" Score="6" Body="&lt;p&gt;You can do this simply by setting your field type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#defineContentAttribute-detail&quot;&gt;defineContentAttribute()&lt;/a&gt; method to return &lt;code&gt;AttributeType::Mixed&lt;/code&gt;, which will tell Craft to JSON-encode its value before storing it in the database.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return AttributeType::Mixed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, whatever you submit in the field’s post data will be saved as-is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#getInputHtml-detail&quot;&gt;getInputHtml()&lt;/a&gt; method had this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    $lat = (isset($value['lat']) ? $value['lat'] : '');&#xA;    $lng = (isset($value['lng']) ? $value['lng'] : '');&#xA;&#xA;    return '&amp;lt;input type=&quot;text&quot; name=&quot;'.$name.'[lat]&quot; value=&quot;'.$lat.'&quot;&amp;gt;' .&#xA;           '&amp;lt;input type=&quot;text&quot; name=&quot;'.$name.'[lng]&quot; value=&quot;'.$lng.'&quot;&amp;gt;';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it would be expected that the resulting post data for your field would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;array(&#xA;    'lat' =&amp;gt; '12345',&#xA;    'lng' =&amp;gt; '67890'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And with &lt;code&gt;AttributeType::Mixed&lt;/code&gt;, that’s exactly how it would get stored. Behind the scenes it will get JSON-encoded when getting saved to the DB, and JSON-decoded when getting fetched from the DB, but your field type will never need to know about that.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-09T16:15:38.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3049" PostTypeId="1" CreationDate="2014-10-09T16:26:31.043" Score="1" ViewCount="670" Body="&lt;p&gt;I have a plain text field in Craft and the content has an apostrophe. On the front end, the apostrophe gets turned into &lt;code&gt;&amp;amp;#039;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not ideal! Thanks in advance..&lt;/p&gt;&#xA;" OwnerUserId="865" LastActivityDate="2014-10-09T17:45:05.530" Title="Plain text field - apostrophes are getting escaped" Tags="&lt;field&gt;&lt;escaping&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3050" PostTypeId="2" ParentId="3045" CreationDate="2014-10-09T16:35:03.690" Score="11" Body="&lt;p&gt;I think you're confusing the &quot;Width&quot; setting to mean &quot;Max Width&quot;, which it doesn’t. The image will get sized to match your transform's Width setting, regardless of whether it's bigger or smaller than that width beforehand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to conditionally apply the transform, only if it's larger than the transform's width, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if asset.width &amp;gt; asset.getWidth('detail') %}&#xA;    {% do asset.setTransform('detail') %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot; class=&quot;{% if block.position in ['left'] %}pull-left{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-09T16:46:05.780" LastActivityDate="2014-10-09T16:46:05.780" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3051" PostTypeId="1" CreationDate="2014-10-09T16:48:36.823" Score="1" ViewCount="612" Body="&lt;p&gt;I want to setup a custom field to assign a URL for an image.  On the front end I want to output the image and then wrap it in a URL. I've setup a field called 'logoURL' but not sure how to access that data.  What I have isn't working and I've tried several variations.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set logo = { width: 175, height: 120, mode: 'fit' } %}&#xA;&#xA;{% for image in entry.logos %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ logos.logoURL }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl(logo) }}&quot; height=&quot;{{ image.getHeight(logo) }}&quot; width=&quot;{{ image.getWidth(logo) }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;          &#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="57" LastEditDate="2014-10-09T17:39:18.097" LastActivityDate="2014-10-09T17:39:18.097" Title="How do I access a custom Asset field within an Assets field?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3052" PostTypeId="2" ParentId="3051" CreationDate="2014-10-09T17:00:02.007" Score="2" Body="&lt;p&gt;You’re close. When you do this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for image in entry.logos %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code within the for-loop will be repeated for each asset that was assigned to your &lt;code&gt;entry.logos&lt;/code&gt; field. Each time, the &lt;code&gt;image&lt;/code&gt; variable will be assigned the current asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you want to access a field that is &lt;em&gt;on the asset&lt;/em&gt; (e.g. your &lt;code&gt;logoUrl&lt;/code&gt; field), you would access that via &lt;code&gt;image.logoUrl&lt;/code&gt; rather than &lt;code&gt;logos.logoUrl&lt;/code&gt;. (You don’t actually have a variable named &lt;code&gt;logos&lt;/code&gt;, so if you have &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;Dev Mode&lt;/a&gt; enabled, that template would be giving you an error about that.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set logo = { width: 175, height: 120, mode: 'fit' } %}&#xA;&#xA;{% for image in entry.logos %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ image.logoURL }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl(logo) }}&quot; height=&quot;{{ image.getHeight(logo) }}&quot; width=&quot;{{ image.getWidth(logo) }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-09T17:00:02.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3053" PostTypeId="2" ParentId="3049" CreationDate="2014-10-09T17:43:17.157" Score="2" Body="&lt;p&gt;The only way I can see this happening is if the field was originally a Rich Text Field, the content was entered, then the field type was swapped to a plain text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, the Rich Text Field would have encoded the entities and saved them into the database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-09T17:43:17.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3054" PostTypeId="2" ParentId="3049" CreationDate="2014-10-09T17:45:05.530" Score="2" Body="&lt;p&gt;Found the answer. I just had to do &lt;code&gt;entry.title|raw&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had tried this before, but silly me had done it to the wrong heading, so I never saw it change! :D&lt;/p&gt;&#xA;" OwnerUserId="865" LastActivityDate="2014-10-09T17:45:05.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3055" PostTypeId="1" CreationDate="2014-10-09T18:09:08.707" Score="1" ViewCount="815" Body="&lt;p&gt;Is it possible to use a &lt;code&gt;page&lt;/code&gt; query parameter for paginating entries with &lt;code&gt;{% paginate %}&lt;/code&gt; instead of a dynamic segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of &lt;code&gt;http://example.com/articles/p2&lt;/code&gt; i would like to use &lt;code&gt;http://example.com/articles?page=2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would simplify interoperability with client side MVC frameworks because the query parameter would be clearly separated from a dynamic route for a single entry in &lt;code&gt;articles&lt;/code&gt; (i.e. &lt;code&gt;http://example.com/articles/a-single-article&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only solution I can think of at the moment is to not use &lt;code&gt;{% paginate %}&lt;/code&gt; altogether and instead calculate &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;offset&lt;/code&gt; for &lt;code&gt;craft.entries.find(...)&lt;/code&gt; manually from &lt;code&gt;craft.request.getQuery(&quot;page&quot;)&lt;/code&gt;. I hope there is an easier way?&lt;/p&gt;&#xA;" OwnerUserId="878" LastActivityDate="2015-04-02T17:50:51.693" Title="Paginate entries with 'page' query parameter?" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3056" PostTypeId="2" ParentId="3044" CreationDate="2014-10-09T19:28:01.610" Score="5" Body="&lt;p&gt;Not sure if it helps, but I accomplished this using a &lt;strong&gt;plain text&lt;/strong&gt; field (with multi-line enabled). Then I just used CSS to format the field in a way to make it look like a code snippet...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Screenshot of field in the Control Panel:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ekOwr.png&quot; alt=&quot;example code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;Control Panel CSS&lt;/a&gt; plugin to add this CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;#fields-myfieldhandle textarea.nicetext {&#xA;    font-size: 13px;&#xA;    font-family: Menlo, Monaco, monospace, sans-serif;&#xA;    color: #cccccc;&#xA;    background-color: #222222;&#xA;    padding: 14px 16px;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in my Twig template, I display it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;{{ block.code|e }}&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;May or may not be the solution you're looking for, but I've been very satisfied with it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-09T19:28:01.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3057" PostTypeId="2" ParentId="2703" CreationDate="2014-10-09T19:32:36.660" Score="1" Body="&lt;p&gt;At Brad's suggestion, the error log revealed a path issue in how I was calling my template. I needed to do this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$oldpath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath(); &#xA;$newpath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'myplugin/templates/'; &#xA;$render = craft()-&amp;gt;templates-&amp;gt;render('mymodeltemplate');&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though the html string returned renders in the browser with html entities encoded. HTML entities still appear when passing the string through &lt;code&gt;html_entity_decode()&lt;/code&gt; before returning the result in the &lt;code&gt;__toString()&lt;/code&gt; function.  Brandon addresses that issue &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3039/how-do-i-prevent-twig-from-encoding-html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="800" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-09T19:32:36.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3058" PostTypeId="1" CreationDate="2014-10-09T20:34:51.387" Score="1" ViewCount="2172" Body="&lt;p&gt;I have a 2 level category system. Some have children, some do not.&#xA;How can I display entries related to the last level only?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a category has no children, it should show the entries related to the 1st level. And if there are children, it should show entries related to that child category only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below currently shows both levels, which I don't want. How can I tell Craft to look for the last (bottom) level only?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).order('dateYear','comp_opus','title').limit(0) %}&#xA;{% for category in craft.categories.group('compositions').relatedTo(entries) %}&#xA;    {% for entry in entries.relatedTo(category).limit(7) %}&#xA;        {# Do stuff #}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastEditorUserId="45" LastEditDate="2014-10-09T21:37:02.460" LastActivityDate="2014-10-10T11:37:02.637" Title="Display entries related to a category (only bottom level)" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3059" PostTypeId="1" AcceptedAnswerId="3062" CreationDate="2014-10-09T22:29:40.913" Score="1" ViewCount="662" Body="&lt;p&gt;I'm trying to figure out how to integrate Stripe into the CMS more natively, and a thought occurred to me. Would it be possible to create a fieldtype that was just a button (i.e. no data being stored) with its own javascript?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would potentially allow you to add a lot of customization and functionality just by adding the button fieldtype to the field layout (rather than having a global javascript file throughout the CP) — like silently submitting data to an external service, handling the response, dynamically rewriting the CP form submit action temporarily to point to a custom controller, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad idea? Or worth investigating?&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-10T02:30:21.107" LastActivityDate="2014-10-10T15:56:38.470" Title="How do you create a custom button field type (with js includes) for customizing the CP?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3060" PostTypeId="1" AcceptedAnswerId="3061" CreationDate="2014-10-09T22:45:46.133" Score="4" ViewCount="630" Body="&lt;p&gt;My site contains a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;front-end registration form&lt;/a&gt;. New users will be automatically activated, and can begin using their account immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What password requirements exist?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I vaguely remember a 6-character minimum... Is that accurate, and are there any other requirements to be aware of?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-08-08T18:40:29.733" Title="What password requirements exist for new users?" Tags="&lt;templating&gt;&lt;registration&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3061" PostTypeId="2" ParentId="3060" CreationDate="2014-10-09T22:54:13.140" Score="7" Body="&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default Craft enforces a 6 character minimum as the only password requirement, but as of &lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.3&lt;/a&gt;, a plugin can now listen for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSetPassword&quot; rel=&quot;nofollow noreferrer&quot;&gt;users.onBeforeSetPassword&lt;/a&gt; event to enforce any password requirements it wants for newly set/changed passwords and set &lt;code&gt;$performAction = false&lt;/code&gt; to cancel the action with any validation errors returned on the UserModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has changed quite a bit for Craft 3... here is how you would pull it off:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\User;&#xA;use yii\base\Event;&#xA;use yii\base\ModelEvent;&#xA;&#xA;Event::on(User::class, User::EVENT_BEFORE_VALIDATE, function(ModelEvent $event) {&#xA;    /** @var User $user */&#xA;    $user = $event-&amp;gt;sender;&#xA;&#xA;    if ($user-&amp;gt;newPassword !== null) {&#xA;        $validates = $this-&amp;gt;validateNewPassword($user-&amp;gt;newPassword);&#xA;&#xA;        if (!$validates) {&#xA;            $user-&amp;gt;addError('newPassword', Craft::t('plugin-handle', 'Invalid password'));&#xA;            $event-&amp;gt;isValid = false;&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-08-08T18:40:29.733" LastActivityDate="2017-08-08T18:40:29.733" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3062" PostTypeId="2" ParentId="3059" CreationDate="2014-10-10T02:25:07.063" Score="2" Body="&lt;p&gt;I thought I would report back with the good, the bad, and the ugly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The good&lt;/strong&gt; It is very possible (and quite easy) to create a field type button element, and include your own custom javascript as is explained in the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;fieldtype plugin documentation&lt;/a&gt;. Setting the &lt;code&gt;defineContentAttributes&lt;/code&gt; to return false will prevent columns from being created in the database. And &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; variables are not even needed in this case in &lt;code&gt;templates-&amp;gt;render&lt;/code&gt; array. Here is the basic MyPlugin_CustomButtonFieldType.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_CustomButtonFieldType extends BaseFieldType&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Custom Button');&#xA;    }&#xA;    public function defineContentAttribute()&#xA;    {&#xA;        return false;&#xA;    }&#xA;    public function getInputHtml($name, $value)&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('myplugin/js/custombutton.js');&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('muplugin/fieldtypes/CustomButton/input', array(&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the fieldtype template file (for a default CP craft looking button):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;custombtn&quot; type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;{{ 'Do Something'|t }}&quot; &amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far so good. Imagine the possibilities!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Bad&lt;/strong&gt; It is basically impossible (as far as I can tell) to over-write the default actions (i.e. &lt;code&gt;action/saveEntry&lt;/code&gt;) via javascript as it is often dynamically inserted into the DOM via javascript depending on if you're using the &lt;code&gt;command+s&lt;/code&gt; save shortcut or the save button sub-nav, etc. So replacing the default controller action, doesn't look like an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: It does look like you can prevent the default form submission, though. And then perhaps write your own &lt;code&gt;.click()&lt;/code&gt; listener.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#entry-form').submit(function(event) {&#xA;    event.preventDefault();&#xA;    return false;&#xA;}&#xA;$('input.save').click(function()){...}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Ugly&lt;/strong&gt; It is possible to prevent fields from getting saved to the database (i.e. credit cards, and cvc codes) by simply removing the 'name' attributes from the fields, using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(function($) {&#xA;     // prevent the form from saving credit card and cvc codes&#xA;     $('input[name*=&quot;creditCardNumber&quot;]').removeAttr('name');&#xA;     $('input[name*=&quot;cvc&quot;]').removeAttr('name');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's pretty much a hack job and not very pretty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, custom field types with buttons and javascript look like a very easy and very powerful way to customize the CMS. And so far it seems pretty easy to send data via javascript to remote services, retrieve tokens, forward the token via ajax to a custom controller to get processed, saved and result returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Messing with the default actions on the other hand, not such a good idea.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-10T15:56:38.470" LastActivityDate="2014-10-10T15:56:38.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3063" PostTypeId="1" AcceptedAnswerId="4098" CreationDate="2014-10-10T06:49:55.920" Score="3" ViewCount="4045" Body="&lt;p&gt;The rich text editor redactor is adding in additional p tags to rich text content. Is there a way to modify this so it accepts the unmodified HTML but still has the advantage of WYSIWYG editing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps it is fixed in version 10.0.1 as I see Craft uses v9.2.6 of this editor. Will it be upgraded perhaps to test?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: This seems to be part of the config: &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-replaceDivs&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-replaceDivs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I believe we should be able to turn on/off some things&lt;/strong&gt;. e.g. &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-removeEmpty&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-removeEmpty&lt;/a&gt; &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="872" OwnerDisplayName="Ryan" LastEditorUserId="872" LastEditDate="2014-10-12T12:24:42.840" LastActivityDate="2016-05-18T14:48:24.823" Title="Rich text editor Redactor adding additional paragraph p tags" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3064" PostTypeId="1" CreationDate="2014-10-10T09:47:00.813" Score="3" ViewCount="1124" Body="&lt;p&gt;So I have a two-level Navigation in a structure. What I want is to give the parent of my entry (if a parent exists) the active tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;right now I'm doing that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for nav_item in navigation %}&#xA;  &amp;lt;li class=&quot;{% if craft.request.getSegment(1) == nav_item.nav_url %}active {% endif %}{% if nav_item.hasDescendants() %}more{% endif %}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{nav_item.nav_url}}&quot;&amp;gt;{{nav_item.title}}&amp;lt;/a&amp;gt;&#xA;&#xA;  {% if nav_item.hasDescendants() %}&#xA;    &amp;lt;ul class=&quot;submenu&quot;&amp;gt;&#xA;      {% for child in nav_item.getChildren() %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{child.nav_url}}&quot;&amp;gt;{{child.title}}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sadly most children don't share the first segment&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2014-10-23T13:38:41.960" Title="How give parent in navigation-structure the active tag" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3065" PostTypeId="2" ParentId="3064" CreationDate="2014-10-10T09:58:35.963" Score="0" Body="&lt;p&gt;If it works for you to use the URL segments for comparisons, I posted an answer on how to do that here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/2233/125&quot;&gt;&quot;How can I add a dynamic “active” CSS class to the navigation on any given page?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-10-10T09:58:35.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3066" PostTypeId="2" ParentId="3064" CreationDate="2014-10-10T10:17:05.653" Score="1" Body="&lt;p&gt;How a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#isAncestorOf&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;isAncestorOf()&lt;/code&gt;&lt;/a&gt; method in the Docs. The given example code probably covers all you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expanded = entry is defined and page.isAncestorOf(entry) %}&#xA;&amp;lt;li{% if expanded %} class=&quot;expanded&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To only address the direct parent, use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#isParentOf&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;isParentOf()&lt;/code&gt;&lt;/a&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-10T10:38:43.087" LastActivityDate="2014-10-10T10:38:43.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3067" PostTypeId="1" CreationDate="2014-10-10T10:27:20.653" Score="4" ViewCount="1327" Body="&lt;p&gt;I have one section with different &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;entry types&lt;/a&gt;. One entry type uses two matrix fields, another one only one, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the frontend layout is always the same, I use one template for the whole section: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;_layouts/main&quot; %}&#xA;&#xA;{% set title = entry.title %}&#xA;&#xA;{% block content %}&#xA;    {% include &quot;_fields/content__circles&quot; %}&#xA;    {% include &quot;_fields/content__body&quot; %}&#xA;    {% include &quot;_fields/content__links&quot; %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great, except when I change an entry to another entry type: Because the field-data isn't deleted from the db and shows up anyway, even though the field isn't added to the new entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually great, because that way your data isn't gone if you delete a field by mistake etc., but over time the db gets bloated, which I want to prevent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; How can I delete data of fields which aren't used without editing each entry by hand or going in the db?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Clearification:&lt;/strong&gt; entrytype 1 has &lt;code&gt;content__circles&lt;/code&gt; and &lt;code&gt;content__body&lt;/code&gt;, entrytype 2 has only &lt;code&gt;content__body&lt;/code&gt;. After switching from type 1 to 2, the data of &lt;code&gt;content__circles&lt;/code&gt; is still kept in the database, and is even accessible inside the &lt;code&gt;entry&lt;/code&gt;-variable.&lt;/p&gt;&#xA;" OwnerUserId="177" LastEditorUserId="177" LastEditDate="2014-10-10T20:18:20.863" LastActivityDate="2020-04-23T18:41:08.653" Title="How to clear the database of unused fields?" Tags="&lt;entries&gt;&lt;database&gt;&lt;field&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3070" PostTypeId="2" ParentId="3058" CreationDate="2014-10-10T11:37:02.637" Score="2" Body="&lt;p&gt;You can loop through your top level categories and check if descendants are available. Then collect the relevant category IDs that you can later use to filter the ElementCriteriaModel. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Define array before loop #}&#xA;{% set bottomLevelCatIds = [] %}&#xA;&#xA;{# Get top level categories only #}&#xA;{% set topLevelCats = craft.categories.group('compositions').level(1) %}&#xA;&#xA;{# Loop through categories and collect relevant IDs #}&#xA;{% for topLevelCat in topLevelCats %}&#xA;&#xA;    {# Check for child categories #}&#xA;    {% if craft.categories.descendantOf(topLevelCat).descendantDist('1')|length %}&#xA;&#xA;        {# Merge child category IDs #}&#xA;        {% set 2ndLevelCatIds = craft.categories.descendantOf(topLevelCat).descendantDist('1').ids() %}&#xA;        {% set bottomLevelCatIds = bottomLevelCatIds|merge(2ndLevelCatIds) %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {# Merge to level category ID #}&#xA;        {% set bottomLevelCatIds = bottomLevelCatIds|merge([topLevelCat.id]) %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Get the bottom level category models #}&#xA;{% set categories = craft.categories.id(bottomLevelCatIds) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-10T11:37:02.637" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3071" PostTypeId="1" AcceptedAnswerId="3072" CreationDate="2014-10-10T11:43:26.827" Score="1" ViewCount="663" Body="&lt;p&gt;I have this function within my &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.btn').click(function()&#xA;{&#xA;    var data = {&#xA;        title: &quot;This is a title&quot;&#xA;    };&#xA;&#xA;    Craft.postActionRequest('plugin/controller/action', data, function(response) {&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;Craft&quot; function returns as &quot;TypeError: Craft is undefined&quot;. I'm guessing I somehow need to reference the scope to the function but I can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding &lt;code&gt;_self = this&lt;/code&gt; outside my jquery click function and reference Craft like &quot;_self.Craft&quot; but that didn't do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-10T13:14:42.533" Title="How reference &quot;Craft&quot; js object in jquery scope" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3072" PostTypeId="2" ParentId="3071" CreationDate="2014-10-10T13:14:42.533" Score="3" Body="&lt;p&gt;The &quot;Craft&quot; javascript global object can only be used in the backend, not on the frontend.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-10T13:14:42.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3073" PostTypeId="1" AcceptedAnswerId="3078" CreationDate="2014-10-10T14:56:12.690" Score="2" ViewCount="884" Body="&lt;p&gt;I'm setting up a multiple authors blog and one of the requirements provided is that authors be notified when someone posts a new comment. We're planning to use Disqus for comments, and that will notify the moderators in Disqus by default, but it's not really an option for us to add all authors in craft as moderators in Disques. Maybe this is just a limitation with Disqus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In googling for an answer it seems that someone found a way to do this in Wordpress with a plugin. (&lt;a href=&quot;http://wpdailybits.com/blog/notify-post-author-for-new-comment-disqus/45&quot; rel=&quot;nofollow&quot;&gt;http://wpdailybits.com/blog/notify-post-author-for-new-comment-disqus/45&lt;/a&gt;) Would it be possible to do something similar in Craft perhaps?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2017-10-06T05:36:25.940" Title="Is there a way to make Disqus notify an entry author when a new comment is posted?" Tags="&lt;users&gt;&lt;plugins&gt;&lt;comments&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3074" PostTypeId="1" AcceptedAnswerId="3075" CreationDate="2014-10-10T15:10:15.573" Score="5" ViewCount="1425" Body="&lt;p&gt;I'm working on a english/spanish site that includes a language switcher link in the site footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for the switcher grabs the currently displayed entry, checks whether a corresponding entry exists in the other locale. If it does exist, the clicking the switcher will link to the corresponding entry. If not, you'll land on the other locale's homepage. If we're already on the homepage, just redirect to the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code, simplified, looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.sectionId == 1 %} // The homepage&#xA;&#xA;  // Redirect to homepage&#xA;&#xA;{% else %}&#xA;&#xA;  // Do some checking into whether there's a corresponding entry, etc.&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some pages on my site that aren't entries, and on these pages, I get a template error telling me that &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried rewriting this code so I'd check if that variable exists first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry|length %}&#xA;&#xA; // Do the previous code&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this gives me the same error. How can I write this logic so I don't have to rely on the entry variable existing or not, which should presumably avoid the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-10-10T15:47:11.350" Title="Template error on local development when checking entry variable" Tags="&lt;templating&gt;&lt;error-message&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3075" PostTypeId="2" ParentId="3074" CreationDate="2014-10-10T15:13:43.537" Score="6" Body="&lt;p&gt;You are close, instead of checking &lt;code&gt;entry|length&lt;/code&gt;, you can do &lt;code&gt;{% if entry is defined %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.sectionId == 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if I am understanding correctly, the full code will be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.sectionId == 1 %}&#xA;&#xA;    //  Redirect to homepage&#xA;&#xA;{% else %}&#xA;&#xA;    // Do some checking into whether there's a corresponding entry, etc.&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-10-10T15:47:11.350" LastActivityDate="2014-10-10T15:47:11.350" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3076" PostTypeId="1" AcceptedAnswerId="6576" CreationDate="2014-10-10T15:23:24.997" Score="3" ViewCount="466" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Arp30.png&quot; alt=&quot;See screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other fields disappear except the 'Title' field after I save a large block of text with a lot of links in the body (richtext) field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to pinpoint it on to anything specific, this is what I'm putting inside the 'Source' of the richtext &lt;a href=&quot;http://pastebin.com/jiyA6xii&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/jiyA6xii&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="884" LastActivityDate="2016-01-12T11:23:14.347" Title="All fields disappearing except 'Title' after saving" Tags="&lt;richtext&gt;&lt;redactor&gt;&lt;debugging&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3077" PostTypeId="2" ParentId="2888" CreationDate="2014-10-10T16:01:45.753" Score="3" Body="&lt;p&gt;I personally don't know a plugin that can achieve this as it's not built in the core functionality of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is however a plugin called &lt;strong&gt;&lt;a href=&quot;https://github.com/page-8/craft-manytomany/&quot; rel=&quot;nofollow&quot;&gt;ManyToMany&lt;/a&gt;&lt;/strong&gt;, which allows you to see entries that are related to one-and-other from both ends of the relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used the plugin myself, and I don't believe you can create entries through it, but it could put you one step closer to the functionality you need.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-10-10T16:01:45.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3078" PostTypeId="2" ParentId="3073" CreationDate="2014-10-10T16:48:45.627" Score="4" Body="&lt;p&gt;Disqus has a &lt;a href=&quot;https://help.disqus.com/customer/portal/articles/466258-capturing-disqus-commenting-activity-via-callbacks&quot; rel=&quot;nofollow&quot;&gt;callback function&lt;/a&gt; that you can use to fire an email off to the author. Within that callback, you could make an AJAX request to another template which sends an email.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2014-10-10T16:48:45.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3079" PostTypeId="1" CreationDate="2014-10-10T18:53:55.487" Score="1" ViewCount="861" Body="&lt;p&gt;I'm working on a multilingual site with english and spanish locales. I've built persistent switcher that resides in the site footer. When users click it, it redirects to a corresponding entry in the other locale if one exists and the homepage if one does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I have a handful of pages on my site that aren't entries: they are routes that are tied to particular templates. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;news-events/tags&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the route for a template that lists all tags in use in my news section, and:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;noticias-eventos/tags&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;would be the corresponding route on the spanish site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to check if the current uri is covered by a route and if so, whether there is a corresponding route in the other locale. If so, I'd redirect to that and if not, back to the homepage as per usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from what I can see, routes are not localizable and exist independently of each other. Am I wrong? How would I go about this?&lt;/p&gt;&#xA;" OwnerUserId="579" LastEditorUserId="250" LastEditDate="2014-10-10T18:59:13.117" LastActivityDate="2016-06-23T01:02:30.073" Title="How do I redirect to a corresponding route when user switches languages?" Tags="&lt;localization&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3080" PostTypeId="2" ParentId="1115" CreationDate="2014-10-10T19:26:48.233" Score="3" Body="&lt;p&gt;I was searching for a way to do this as well, and as the answer indicates, it's not possible. However, by double-clicking on a tag you want to delete you can rename it to something else – so you can't delete it, but you can change it. You just have to remember when it comes time to create a new tag to rename that existing tag instead of creating a new one.&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-10-10T19:26:48.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3081" PostTypeId="1" CreationDate="2014-10-10T21:30:40.963" Score="4" ViewCount="1574" Body="&lt;p&gt;Im trying to get a front end login form to work over ajax and running into issues, it seems to always pass back success and not sure how to actual make sure the cookie gets created and the user is logged in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the gist of what i have right now:&#xA;&lt;a href=&quot;https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2020-09-30T13:09:52.067" Title="Front end login form with ajax" Tags="&lt;ajax&gt;&lt;login&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3082" PostTypeId="2" ParentId="3081" CreationDate="2014-10-10T21:54:50.057" Score="3" Body="&lt;p&gt;If you’re getting the &lt;code&gt;{success: true}&lt;/code&gt; response, then the user is getting logged in successfully, and the cookie would have actually been created by that response.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-10T21:54:50.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3083" PostTypeId="1" CreationDate="2014-10-10T21:57:24.807" Score="1" ViewCount="163" Body="&lt;p&gt;I am trying to fetch the content from an event &lt;code&gt;onEntrySave&lt;/code&gt; but I don't know how to access the entry's properties from the event. So far I have got the event handler working I would just like to fetch the data, any ideas? &lt;/p&gt;&#xA;" OwnerUserId="883" LastEditorUserId="250" LastEditDate="2014-10-11T13:05:18.987" LastActivityDate="2014-10-11T13:05:18.987" Title="How to fetch the data from Event" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;entry&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3084" PostTypeId="2" ParentId="3083" CreationDate="2014-10-10T22:01:34.210" Score="1" Body="&lt;p&gt;From the docs: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/hooks-and-events#listening-for-events&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;entry&lt;/a&gt; will be in the &lt;code&gt;params&lt;/code&gt; property of the &lt;code&gt;$event&lt;/code&gt;.  You can access it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['entry']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-10T22:01:34.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3085" PostTypeId="2" ParentId="3040" CreationDate="2014-10-10T22:34:49.040" Score="1" Body="&lt;p&gt;I think I worked this out. It looks like the related entries need to be contained in the user loop. This is what I used to make this work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryUsers = craft.users.relatedTo(category) %}&#xA;    {% paginate categoryUsers.limit(1) as entries %}&#xA;&#xA;        {% for categoryUser in entries %}&#xA;            {{ categoryUser.username }}&#xA;&#xA;            {% set categoryEntry = craft.entries.section('jobs').authorId(categoryUser.id).first() %}       &#xA;                {% if categoryEntry %}&#xA;                    {{ categoryEntry.positionTitle }} (And other fields not added yet.)&#xA;                {% endif %}&#xA;&#xA;             &amp;lt;p&amp;gt;Testing the total found: {{ categoryUsers|length }}&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;pagination left&quot;&amp;gt;&amp;amp;laquo; Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;pagination right&quot;&amp;gt;Next Page &amp;amp;raquo;&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;    {% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still testing, but I think this is the solution. (Unless someone else has a better way of doing this. :)) &lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2014-10-10T22:34:49.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3086" PostTypeId="2" ParentId="3079" CreationDate="2014-10-11T00:34:04.343" Score="3" Body="&lt;p&gt;This is a rather hacky workaround, but I have no idea what else you could do to handle it. What I do is to compose an array of &quot;route objects&quot; that basically mirror the routes set up in the CP. This array can then be compared to the URL segments (→ &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getSegments&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getSegments&lt;/code&gt;&lt;/a&gt;). Not nice but it works :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Map the corresponding routes #}&#xA;{% set routes = [&#xA;    { en: 'news-events/tags', es: 'noticias-eventos/tags' },&#xA;    { en: 'news-events/categories', es: 'noticias-eventos/categorias' },&#xA;] %}&#xA;&#xA;{# Configure and loop through selected site locales #}&#xA;{% set locales = ['en', 'es'] %}&#xA;{% for locale in locales %}&#xA;&#xA;    {# Is this an entry page? #}&#xA;    {% if entry is not defined %}&#xA;&#xA;        {# ... Do entry stuff #}&#xA;&#xA;    {# Not an entry page --&amp;gt; check the routes #}&#xA;    {% else %}&#xA;&#xA;        {# Get URL segments #}&#xA;        {% set segments = craft.request.getSegments %}&#xA;&#xA;        {# Set var before loop #}&#xA;        {% set noRoute = true %}&#xA;&#xA;        {# Loop routes array #}&#xA;        {% for prop in routes %}&#xA;&#xA;            {# Check if URL segments match a route #}&#xA;            {% if prop[craft.locale]|split('/') == segments %}&#xA;&#xA;                {# Output link to the mapped route #}&#xA;                &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ prop[locale] }}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&#xA;                {# Switch var value #}&#xA;                {% set noRoute = false %}&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;        {# No route found --&amp;gt; output a link to the homepage #}&#xA;        {% if noRoute %}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-11T00:34:04.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3088" PostTypeId="1" AcceptedAnswerId="3091" CreationDate="2014-10-11T02:36:08.410" Score="5" ViewCount="15472" Body="&lt;p&gt;When I add this to my Nginx Confirguration file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {&#xA;    expires 7d;&#xA;    add_header Pragma &quot;public&quot;;&#xA;    add_header Cache-Control &quot;public, must-revalidate, proxy-revalidate&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the admin area I get all 404 responses on those assets (js, css, png, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without that in my configuration, for example, settings.css is OK:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Request URL:http://{site}admin/resources/css/settings.css?d=1411426522&#xA;Request Method:GET&#xA;Status Code:200 OK&#xA;Cache-Control:max-age=31536000&#xA;Connection:keep-alive&#xA;Expires:Sun, 11 Oct 2015 02:25:24 GMT&#xA;Last-Modified:Mon, 22 Sep 2014 22:55:22 GMT&#xA;Pragma:cache&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then with the code, the settings.css is 404 Not Found&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Request URL:http://{site}/admin/resources/css/settings.css?d=1411426522&#xA;Request Method:GET&#xA;Status Code:404 Not Found&#xA;Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0&#xA;Connection:keep-alive&#xA;Expires:Sat, 04 Oct 2014 02:31:56 GMT&#xA;Pragma:no-cache&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="501" LastActivityDate="2014-10-11T13:05:44.677" Title="Adding cache headers to Nginx configuation file breaks the /admin area" Tags="&lt;cache&gt;&lt;server&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3089" PostTypeId="1" AcceptedAnswerId="3090" CreationDate="2014-10-11T10:49:43.723" Score="11" ViewCount="4868" Body="&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'de_ch' =&amp;gt; 'http://blabla.dev/',&#xA;            'en' =&amp;gt; 'http://blabla.dev/en/',&#xA;        ),&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; 'path',&#xA;            'baseUrl' =&amp;gt; 'http://url-without-locale-segment.dev/',&#xA;        )&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I set a &lt;code&gt;baseUrl&lt;/code&gt; inside &lt;code&gt;environmentVariables&lt;/code&gt; to be able to grab the url without a locale. But when I enter &lt;code&gt;{{ baseUrl }}&lt;/code&gt; in the template it returns an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;baseUrl&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I have to write this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-04-07T06:44:00.467" Title="grab 'environmentVariables' with a tag" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3090" PostTypeId="2" ParentId="3089" CreationDate="2014-10-11T11:32:45.307" Score="19" Body="&lt;p&gt;You can get to any of your config variables (including custom ones) like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ craft.config.xyz }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The environmentVariables array is no different:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ craft.config.environmentVariables.baseUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.config&quot;&gt;craft.config&lt;/a&gt; documentation.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="9" LastEditDate="2014-10-11T16:02:38.800" LastActivityDate="2014-10-11T16:02:38.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3091" PostTypeId="2" ParentId="3088" CreationDate="2014-10-11T12:19:15.387" Score="8" Body="&lt;p&gt;Craft rewrites the location of those files using a query string, which is what's causing nginx to lose track of them. Using the &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files&quot;&gt;&lt;code&gt;try_files&lt;/code&gt;&lt;/a&gt; directive should force nginx to find and serve them properly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {&#xA;  try_files $uri /index.php?$query_string;&#xA;  expires 7d;&#xA;  add_header Pragma &quot;public&quot;;&#xA;  add_header Cache-Control &quot;public, must-revalidate, proxy-revalidate&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="48" LastEditorUserId="250" LastEditDate="2014-10-11T13:05:44.677" LastActivityDate="2014-10-11T13:05:44.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3092" PostTypeId="1" CreationDate="2014-10-11T15:43:54.120" Score="4" ViewCount="2592" Body="&lt;p&gt;Is there a way to serve my CSS files from the templates folder? I am wanting to be able to use TWIG tags, etc to build some of this. And even if the TWIG tag idea does not work out, I would prefer this sort of an organizational structure.&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="250" LastEditDate="2014-10-11T17:17:21.617" LastActivityDate="2015-04-07T19:27:14.533" Title="Serving CSS files from template folder" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3093" PostTypeId="2" ParentId="3092" CreationDate="2014-10-11T16:00:00.137" Score="10" Body="&lt;p&gt;You can, just by naming the file with a .css extension, and then accessing it just like any other template in there. For example, you could have the file craft/templates/styles/styles.css, and that would be accessible from &lt;a href=&quot;http://example.com/styles/styles.css&quot;&gt;http://example.com/styles/styles.css&lt;/a&gt;. Craft will even serve it with a &lt;code&gt;text/css&lt;/code&gt; Content-Type header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is only a good idea in certain situations. Directly loading your CSS by pointing the URL to a publicly-accessible file that Apache can serve without PHP/Craft’s help is going to be &lt;em&gt;much&lt;/em&gt; less work for your server (serving static files is what Apache does best). Also, browsers won’t be able to cache those dynamic CSS requests (unless you manually override the cache headers from your template using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/header&quot;&gt;{% header %}&lt;/a&gt; tag, but then, there would be no point in having it dynamically generated in the first place). So this will have some impact on your overall page load times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’d probably be better off just generating your CSS styles that have to be dynamic  right in the main HTML templates within &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tags, or using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includecss&quot;&gt;{% includeCss %}&lt;/a&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-11T16:00:00.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3094" PostTypeId="2" ParentId="3067" CreationDate="2014-10-11T16:09:34.313" Score="6" Body="&lt;p&gt;You can get the fields that aren’t in use anywhere by running this SQL query:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;SELECT f.*&#xA;FROM craft_fields f&#xA;LEFT JOIN craft_fieldlayoutfields l ON l.fieldId = f.id&#xA;WHERE l.id IS NULL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The easiest way to delete them would be from the Control Panel, but if you really want to limit your work to the database, you would need to delete those fields’ rows in &lt;code&gt;craft_fields&lt;/code&gt;, and their corresponding column (“field_TheFieldHandle”) in &lt;code&gt;craft_content&lt;/code&gt;. For Matrix fields, you would also need to drop the corresponding DB table (“craft_matrixcontent_TheFieldHandle”).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-11T16:09:34.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3095" PostTypeId="1" AcceptedAnswerId="4095" CreationDate="2014-10-11T18:42:50.293" Score="1" ViewCount="202" Body="&lt;p&gt;Can anyone tell me why this is returning all entries instead of entries with a &lt;code&gt;creditsUsed&lt;/code&gt; field &gt; 0? &lt;code&gt;creditsUsed&lt;/code&gt; is a number field that I created for this entry type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;authorId = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;$criteria-&amp;gt;section = 'news';&#xA;$criteria-&amp;gt;creditsUsed &amp;gt; 0;&#xA;$criteria-&amp;gt;status = null;&#xA;$entries = $criteria-&amp;gt;total();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="45" LastEditDate="2014-10-12T06:06:54.460" LastActivityDate="2014-10-12T06:06:54.460" Title="Modify an ElementCriteriaModel to compare against numeric field" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4095" PostTypeId="2" ParentId="3095" CreationDate="2014-10-11T20:48:46.670" Score="3" Body="&lt;p&gt;Here's what's actually happening with this line of code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;creditsUsed &amp;gt; 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You are actually generating the &lt;strong&gt;boolean&lt;/strong&gt; value of &quot;is creditsUsed more than zero&quot;. Granted, you aren't setting it to an actual variable, but nonetheless you are generating a boolean value. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$moreThanZeroCreditsUsed = ($criteria-&amp;gt;creditsUsed &amp;gt; 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even though you're not assigning that new boolean value to a variable, it's still valid PHP (and therefore no error is thrown).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it looks like you are trying to do instead is to actually set the value of &lt;code&gt;creditsUsed&lt;/code&gt;, which you'd need to use an &lt;strong&gt;equals sign&lt;/strong&gt; to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;creditsUsed = &quot;whatever&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If my memory serves me correctly, the way to denote a comparison on an ElementCriteriaModel is to simply pass the comparison as a string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;creditsUsed = &quot;&amp;gt; 0&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the last example in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;this subsection...&lt;/a&gt; Granted, it's being applied via Twig syntax, but it's still modifying the ElementCriteriaModel in the same way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.width('&amp;gt;= 100')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-11T20:48:46.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4096" PostTypeId="1" CreationDate="2014-10-12T06:38:25.773" Score="0" ViewCount="893" Body="&lt;p&gt;I have some functions in another plugin that I'd like to use. For example, I'm using the shortcodes plugin, and it has a function shortcode_atts that I want to use in my plugin.&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2014-10-12T19:54:00.190" Title="Access a function in a plugin from another plugin" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4097" PostTypeId="2" ParentId="4096" CreationDate="2014-10-12T07:18:21.967" Score="1" Body="&lt;p&gt;I did it this way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;\Craft\Shortcode::shortcode_atts()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems directly accessing it via &lt;strong&gt;namespace&lt;/strong&gt; would be correct (assuming!)&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2014-10-12T07:18:21.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4098" PostTypeId="2" ParentId="3063" CreationDate="2014-10-12T13:56:10.030" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-replaceDivs&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-replaceDivs&lt;/a&gt;&#xA;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-removeEmpty&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-removeEmpty&lt;/a&gt; &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard.json&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video', 'table'],&#xA;    plugins: ['fullscreen'],&#xA;    toolbarFixedBox: true,&#xA;    paragraphize: false,&#xA;    replaceDivs: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: This bug also happens in the most recent version of Redactor &lt;a href=&quot;https://imperavi.com/redactor/examples/source/&quot; rel=&quot;nofollow&quot;&gt;as seen on their example page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="712" LastEditDate="2016-05-18T14:48:24.823" LastActivityDate="2016-05-18T14:48:24.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4099" PostTypeId="2" ParentId="4096" CreationDate="2014-10-12T15:51:20.583" Score="4" Body="&lt;p&gt;If the method you want to access is public and in another service file, you could access it via the service layer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;theOtherPluginService-&amp;gt;method();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The method you are using above, the &lt;a href=&quot;http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php&quot; rel=&quot;nofollow&quot;&gt;Scope Resolution Operator&lt;/a&gt; should work fine without declaring the \Craft namespace, as the plugins should already be loaded into the Craft namespace.  It's used for accessing static and constant methods:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ClassName::method()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In cases where you may be loading a library that is not in the Craft namespace, the syntax you're using above would be needed, where you declare the full namespace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\SomeOtherNameSpace\ClassName::method()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-10-12T19:54:00.190" LastActivityDate="2014-10-12T19:54:00.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4100" PostTypeId="1" AcceptedAnswerId="4103" CreationDate="2014-10-12T18:11:20.723" Score="1" ViewCount="1882" Body="&lt;p&gt;I would like to store a json object in a custom fieldtype, and be able to traverse the object's attributes using twig dot syntax in my template. I am currently storing the raw json object as a string, but I'm not sure what I need to do to be able to reference the stored string as an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a shortened example of the raw json string that is being stored:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Stripe_Customer JSON: {&#xA;    &quot;id&quot;: &quot;cus_4v68MrZu3za8XT&quot;,&#xA;    &quot;object&quot;: &quot;customer&quot;,&#xA;    &quot;cards&quot;: { &quot;object&quot;: &quot;list&quot;, &quot;total_count&quot;: 0, &quot;has_more&quot;: false, &quot;url&quot;: &quot;/v1/customers/cus_4v68MrZu3za8XT/cards&quot;, &quot;data&quot;: [ ] },&#xA;    &quot;subscriptions&quot;: { &quot;object&quot;: &quot;list&quot;, &quot;total_count&quot;: 0, &quot;has_more&quot;: false, &quot;url&quot;: &quot;/v1/customers/cus_4v68MrZu3za8XT/subscriptions&quot;, &quot;data&quot;: [ ] },&#xA;    &quot;etc&quot;: &quot;etcetcetc&quot;&#xA;}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template I would like to be able to reference the objects properties in some way (i.e. &lt;code&gt;{{ fieldHandle.id }}&lt;/code&gt;) for display only; and on the back-end within a service, I would like to set object properties before saving back to the DB (i.e &lt;code&gt;fieldhandle-&amp;gt;id = value&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure whether &lt;code&gt;defineContentAttribute&lt;/code&gt; should return &lt;code&gt;AttributeType&lt;/code&gt; &lt;code&gt;String&lt;/code&gt; or &lt;code&gt;Mixed&lt;/code&gt; in this case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return AttributeType::String;&#xA;    //return AttributeType::Mixed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if it should be a string, how would one define the column type as &quot;Text&quot; vs the default &lt;code&gt;VARCHAR(255)&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I see that there is a similar question regarding &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2565/custom-field-type-with-multiple-values/3048#3048&quot;&gt;custom fieldtype with multiple values&lt;/a&gt;, however, in this case, the end-user will not be manipulating the data directly in any way — they will be filling in dummy fields that will be send to a third party service via javascript/ajax, a result object returned, and then forwarded (again via ajax) to a back-end service method to be processed and saved to the DB.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-10-14T01:53:14.870" Title="How to store json data in a custom fieldtype so that it's data can be referenced as attribute values?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;json&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4101" PostTypeId="2" ParentId="4100" CreationDate="2014-10-12T19:46:47.410" Score="4" Body="&lt;p&gt;You already mentioned the related answer in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2565/custom-field-type-with-multiple-values/3048#3048&quot;&gt;custom fieldtype with multiple values&lt;/a&gt;, and it actually is perfect for your usecase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't really matter how you transport the data over to Craft, because if the content is set to AttributeType::Mixed, then Craft will JSON encode/decode it when requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to save your data, send over an array, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$stripeCustomer = [&#xA;    &quot;id&quot; =&amp;gt; &quot;cus_4v68MrZu3za8XT&quot;,&#xA;    &quot;object&quot; =&amp;gt; &quot;customer&quot;,&#xA;    &quot;etc&quot; =&amp;gt; &quot;etcetcetc&quot;&#xA;    ];&#xA;&#xA;// Transport $stripeCustomer to Craft with Ajax&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the context of Javascript, you'd send over the serialized form data.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-12T20:34:30.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4102" PostTypeId="2" ParentId="4100" CreationDate="2014-10-12T22:46:15.360" Score="3" Body="&lt;p&gt;Completely untested, but a possibility would be to define your content attribute like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(AttributeType::Mixed, 'model' =&amp;gt; 'MyPluginContentModel');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;MyPluginContentModel&lt;/code&gt; would have every possible value that you would want to expose to your template ('id', 'obj', 'etc') defined as an attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Craft pulls the JSON from the database, it should decode it and populate your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;model&lt;/a&gt; with any matching attributes it finds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That gets returned to your template and you can access it via &lt;code&gt;{{ value.id }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-12T23:44:28.533" LastActivityDate="2014-10-12T23:44:28.533" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4103" PostTypeId="2" ParentId="4100" CreationDate="2014-10-13T02:35:09.997" Score="2" Body="&lt;p&gt;With a highly complex hierarchical object with many layers of sub-objects, etc., I found that it was much easier in the end to just store the raw JSON in the database in a text-field, and decode it manually before passing it to the template to allow full access to the object hierarchy using &lt;code&gt;dot&lt;/code&gt; or &lt;code&gt;array&lt;/code&gt; syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plugin's fieldtype class definition, define the column type as &lt;code&gt;String&lt;/code&gt; with no text limit (using the additional &lt;code&gt;column&lt;/code&gt; declaration):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the fieldType template file the string can then be decoded as a json object manually to make it available to the template using &lt;code&gt;JsonHelper::decode()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    $jsonObj = JsonHelper::decode($value);&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('myPlugin/fieldtypes/Myfield/input', array(&#xA;        'name'          =&amp;gt; $name,&#xA;        'value'         =&amp;gt; $value,&#xA;        'jsonObj'       =&amp;gt; $jsonObj&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the template, (assuming the json was properly formatted) the full json object can now be traversed using dot syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# access first level attribute #}&#xA;&amp;lt;p&amp;gt;{{ jsonObj.id }}&amp;lt;/p&amp;gt;&#xA;{# access deeper object array level attribute #}&#xA;&amp;lt;p&amp;gt;{{ jsonObj.objArray.data[0].id }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: In php, for some unexplained reason, &lt;code&gt;JsonHelper::decode($jsonStr)&lt;/code&gt; doesn't seem to allow access to the attributes, so instead the php equivalent &lt;code&gt;php_decode($jsonStr)&lt;/code&gt; can be used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$jsonObj = json_decode($entry-&amp;gt;jsonStr);&#xA;$Id = $jsonObj-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-14T01:53:14.870" LastActivityDate="2014-10-14T01:53:14.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4105" PostTypeId="1" AcceptedAnswerId="4513" CreationDate="2014-10-13T11:18:59.507" Score="1" ViewCount="197" Body="&lt;p&gt;I'm building a multi-lingual site and have found Craft's locales / translatable fields useful for setting up structures where each page will have a translated version. However, for at least one of the Channel sections it would make more sense to have separate entries for each locale, rather than having each entry being translatable and appearing in all locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems doable by disabling all but one of the locales on each entry in the section, but the problem I'm having is that if an entry has required fields, I can't save it if these fields are empty, even if they're only empty in a locale that I'm trying to disable. (eg. I want to have a Spanish-only post, but when I try to disable the English version I can't save the post because the English version has required fields that aren't filled in...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems I either have to make my required fields non-required, or fill them with spurious stuff in the locale I want to disable. I'm sure there must be a way of making required fields work with multi-lingual posts, but I can't figure out quite how... I'd be grateful for any pointers here!&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2014-11-03T11:49:57.563" Title="How to use required fields on localised entries?" Tags="&lt;localization&gt;&lt;field&gt;&lt;language&gt;&lt;required&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4106" PostTypeId="1" CreationDate="2014-10-13T11:26:27.103" Score="2" ViewCount="244" Body="&lt;p&gt;I have a bi-lingual site with public registration, the site has a front-end registration form which when completed sends the user to an 'activation pending' page correctly, then sends an email off that the user must click to activate the account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking that link takes the user to the normal Craft login page, and I am expecting it to instead take the user to the page I've got set up as a welcome message and FAQ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls'       =&amp;gt; true,          // Whether Craft should omit the script filename currently being used to access Craft (e.g. index.php) when generating URLs&#xA;    'cpTrigger'                  =&amp;gt; 'secretadmin', // The URI segment Craft should look for when determining if the current request should route to the CP rather than the front-end website&#xA;    'maxUploadFileSize'          =&amp;gt; '16777216',    // 16Mb&#xA;    'phpMaxMemoryLimit'          =&amp;gt; '128M',        // The maximum amount of memory Craft will try to reserve during memory intensive operations such as zipping, unzipping and updating&#xA;    'enableCsrfProtection'       =&amp;gt; true,          // Protect against Cross Site Request Forgery; http://buildwithcraft.com/help/csrf-protection&#xA;    'searchIgnoreWords'          =&amp;gt; array('a',&#xA;                                          'the',&#xA;                                          'and',&#xA;                                          'as',&#xA;                                          'if'),   // Words that should be ignored when indexing search keywords and preparing search terms to be matched against the keyword index&#xA;    'purgePendingUsersDuration'  =&amp;gt; 'P1W',         // If a user hasn't confirmed their registration in under a week, delete it.&#xA;    'activateAccountFailurePath' =&amp;gt; array('en_gb' =&amp;gt; '/accounts/activation-failed',&#xA;                                          'cy_gb' =&amp;gt; '/accounts/activation-failed'),   // Where to send failed account activations (only from front-end registration forms)&#xA;    'activateAccountSuccessPath' =&amp;gt; array('en_gb' =&amp;gt; '/accounts/activation-succeeded',&#xA;                                          'cy_gb' =&amp;gt; '/accounts/activation-succeeded'), // Where to send successful account activations (only from front-end registration forms)&#xA;),&#xA;...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The docs do say the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; only applies to front-end registration, but that's what I'm doing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I misunderstood or didn't set correctly?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="250" LastEditDate="2014-10-13T14:36:33.003" LastActivityDate="2016-01-27T21:30:20.357" Title="activateAccountSuccessPath doesn't work as expected" Tags="&lt;users&gt;&lt;activation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4107" PostTypeId="2" ParentId="4105" CreationDate="2014-10-13T12:10:15.887" Score="2" Body="&lt;p&gt;I don't know if you re-use the fields you're using in that channel in other sections and if you do, my suggestion might not work for you, but here's what you could do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set all fields to be &quot;not translatable&quot; and if content is entered in one locale it will get synced to all locales. Thereby all required fields will always be filled out and disabling individual &quot;dummy versions&quot; is no problem any more.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-13T12:10:15.887" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4108" PostTypeId="2" ParentId="4105" CreationDate="2014-10-13T12:26:54.337" Score="1" Body="&lt;p&gt;Why don't you leave the entries enabled in all locales and just don't load them in the templates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.locale == 'fr' %}&#xA;    {% set entries = craft.entries.section('news-fr') %}&#xA;{% elseif craft.locale == 'en' %}&#xA;    {% set entries = craft.entries.section('news-en') %}&#xA;{% elseif craft.locale == 'de' %}&#xA;    {% set entries = craft.entries.section('news-de') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-13T12:26:54.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4109" PostTypeId="1" AcceptedAnswerId="4112" CreationDate="2014-10-13T16:10:18.737" Score="4" ViewCount="412" Body="&lt;p&gt;So I have a contact form in my layout (just using the contact form plugin from the Craft guys) and on 404 pages I'm getting the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;getErrors&quot;) on a string variable (&quot;&quot;) in &quot;_layout&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What's the best way around that and to still get the contact form to show up on an 404 page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code is in the footer of _layout.html and looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- unrelated stuff here... --&amp;gt;&#xA;&#xA;&amp;lt;!-- CONTACT --&amp;gt;&#xA;&#xA;    {% set asset = globalContact.contactBackground.first() %}&#xA;    &amp;lt;section id=&quot;contact&quot; class=&quot;strip contact&quot; style=&quot;background-image: url({{ asset.url }});&quot; data-stellar-background-ratio=&quot;0.2&quot; data-stellar-responsive=&quot;true&quot; data-stellar-horizontal-offset=&quot;0&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;overlay&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;&#xA;                &amp;lt;span&amp;gt;{{ globalContact.contactPreHeader }}&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&#xA;                {{ globalContact.contactHeader }}&#xA;            &amp;lt;/h1&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;            {% macro errorList(errors) %}&#xA;                {% if errors %}&#xA;                    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                        {% for error in errors %}&#xA;                            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endif %}&#xA;            {% endmacro %}&#xA;&#xA;            {% from _self import errorList %}&#xA;            &amp;lt;form method=&quot;post&quot; action=&quot;&quot; class=&quot;contact-form&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;                {{ getCsrfInput() }}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;thanks&quot;&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;contact-name&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; id=&quot;fromName&quot; name=&quot;fromName&quot; placeholder=&quot;Name&quot; /&amp;gt;&#xA;                    {% if message is defined %}{{ errorList(message.getErrors('fromName')) }}{% endif %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;contact-email&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; id=&quot;fromEmail&quot; name=&quot;fromEmail&quot; placeholder=&quot;Email&quot; /&amp;gt;&#xA;                    {% if message is defined %}{{ errorList(message.getErrors('fromEmail')) }}{% endif %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;contact-phone&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; id=&quot;phone&quot; name=&quot;message[Phone]&quot; placeholder=&quot;Phone&quot; /&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;contact-message&quot;&amp;gt;&#xA;                    &amp;lt;textarea rows=&quot;8&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message[body]&quot; placeholder=&quot;Message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;                    {% if message is defined %}{{ errorList(message.getErrors('message')) }}{% endif %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;input id=&quot;shewbotsshew&quot; name=&quot;shewbotsshew&quot; type=&quot;text&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;contact-submit&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;&amp;lt;!-- unrelated stuff here... --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="889" LastEditorUserId="889" LastEditDate="2014-10-13T16:36:18.387" LastActivityDate="2014-10-13T16:42:12.633" Title="Contact Form plugin - Error loading 404 Pages" Tags="&lt;404-page&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4110" PostTypeId="1" AcceptedAnswerId="4114" CreationDate="2014-10-13T16:34:46.600" Score="0" ViewCount="140" Body="&lt;p&gt;My bilingual site works fine, but it is not optimal from a url and SEO perspective because Craft is outputting duplicate content on different paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My default locale is &lt;code&gt;en&lt;/code&gt; and the secondary locale is &lt;code&gt;cy&lt;/code&gt;, this means many English pages can be reached by omitting the local from the path (which is the behaviour I want).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that certain pages craft generates via the &lt;code&gt;{{ entry.url }}&lt;/code&gt; parameter contains the locale in the path even for the default one. i.e., Craft is spitting out paths like &lt;code&gt;http://mysite.com/en/section/entry-title&lt;/code&gt; when I'd prefer it to be &lt;code&gt;http://mysite.com/section/entry-title&lt;/code&gt;. It's actually accessible from both URLs, which is a bad thing for SEO. I only want the locale parameter added into the path when it's actually needed (i.e., for when we switch to cy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? If not, is there a work-around?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-10-13T18:23:25.013" Title="Can craft omit default locales from generated paths?" Tags="&lt;entries&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4111" PostTypeId="2" ParentId="4106" CreationDate="2014-10-13T16:37:35.933" Score="1" Body="&lt;p&gt;If the user account that is registering has access to the control panel, either directly or via a user group, then they'll get redirected to the control panel login page after clicking the activation link in the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they don't have access to the control panel, then they'll get redirected to the '&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#activateAccountSuccessPath&quot; rel=&quot;nofollow&quot;&gt;activateAccountSuccessPath&lt;/a&gt;' config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-13T16:37:35.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4112" PostTypeId="2" ParentId="4109" CreationDate="2014-10-13T16:42:12.633" Score="4" Body="&lt;p&gt;Anywhere you've currently got something that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if message is defined %}{{ errorList(message.getErrors('fromEmail')) }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try changing that to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you'll want to do that for the other attributes, too ('fromName', etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-13T16:42:12.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4113" PostTypeId="1" AcceptedAnswerId="4266" CreationDate="2014-10-13T18:12:57.273" Score="5" ViewCount="878" Body="&lt;p&gt;This might provide it's own answer, but I thought I would ask to be sure. How do you reference the current entry in custom fieldType or CP templates? I have tried &lt;code&gt;{{ entry.id }}&lt;/code&gt;, &lt;code&gt;{{ element.id }}&lt;/code&gt; but neither work. Do you need to explicitly set these variables in your &lt;code&gt;getInputHTML()&lt;/code&gt; function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see in the craft '_entry.html' template that {{ entry.id }} is used for a hidden field. Since that reference is not available, I assume that template variables are scoped to the template and not inherited by other templates on the same page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through trial and error I finally discovered the current entry can be referenced in PHP as &lt;code&gt;$this-&amp;gt;element;&lt;/code&gt;, and the id and section via &lt;code&gt;$this-&amp;gt;element-&amp;gt;id&lt;/code&gt;, &lt;code&gt;$this-&amp;gt;element-&amp;gt;section&lt;/code&gt; respectively. So, I could add &lt;code&gt;entry&lt;/code&gt; as a template variable, but I just assumed it would already be there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    $entry = $this-&amp;gt;element;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('myPlugin/fieldtypes/MyField/input', array(&#xA;        'name'          =&amp;gt; $name,&#xA;        'value'         =&amp;gt; $value,&#xA;        'entry'         =&amp;gt; $entry&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="9" LastEditDate="2014-10-21T17:52:14.137" LastActivityDate="2018-10-16T12:56:47.027" Title="How to reference the current entry element in custom Control Panel templates?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4114" PostTypeId="2" ParentId="4110" CreationDate="2014-10-13T18:23:25.013" Score="1" Body="&lt;p&gt;In your config file you will want to define the locales such that &lt;code&gt;en&lt;/code&gt; points to the root directory.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://craft.dev/',&#xA;    'cy' =&amp;gt; 'http://craft.dev/cy/'&#xA; ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your public &lt;code&gt;html&lt;/code&gt; folder should not include an 'en' folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;/html&#xA;    /cy&#xA;        /.htaccess&#xA;        /index.php&#xA;    /.htaccess&#xA;    /index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-13T18:23:25.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4115" PostTypeId="2" ParentId="2803" CreationDate="2014-10-13T18:56:58.137" Score="0" Body="&lt;p&gt;Since a ticket was sent into support, I'll add an answer here, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/2804/57&quot;&gt;Lindsey's&lt;/a&gt; answer is correct, browser inspectors will add quotes around any whitespace in the source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was a hidden whitespace character after his closing &lt;code&gt;{% endfor %}&lt;/code&gt; that was causing the whitespace to be output.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-13T18:56:58.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4116" PostTypeId="1" AcceptedAnswerId="5353" CreationDate="2014-10-13T20:40:19.667" Score="1" ViewCount="176" Body="&lt;p&gt;Like many of you, we've started to use New Relic to deep dive into performance of our websites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, we have a client's production server that has a version of Craft, ExpressionEngine and Wordpress. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now WP and Craft get lumped together as a 'PHP application'. Is there any config setting to allow us to set 'Craft CMS' as a thing to differentiate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've been able to do this with EE.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-12-19T09:27:44.157" Title="Set the application name for Craft in New Relic" Tags="&lt;config&gt;&lt;newrelic&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4117" PostTypeId="2" ParentId="4116" CreationDate="2014-10-13T21:29:16.093" Score="1" Body="&lt;p&gt;Looks like this &lt;a href=&quot;https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications#php&quot; rel=&quot;nofollow&quot;&gt;can be done&lt;/a&gt; with a &lt;code&gt;php.ini&lt;/code&gt; file in Craft's public HTML folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although, we should be able to call an &lt;code&gt;ini_set&lt;/code&gt; for it in Craft itself.  If you want to hit up support@buildwithcraft.com, I'll give you a file that you can test with.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="250" LastEditDate="2014-10-15T18:01:30.107" LastActivityDate="2014-10-15T18:01:30.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4119" PostTypeId="1" AcceptedAnswerId="4272" CreationDate="2014-10-14T03:19:58.867" Score="2" ViewCount="930" Body="&lt;p&gt;I working on a simple inquiries plugin and i want it to use custom element types to manage the inquiries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the basics working but I'm trying to setup the option to add/edit custom fields on the inquiry and thats where I'm running into some issues.  Most of the other examples I'm finding (including Pixel &amp;amp; Tonic's own events plugin) all seem to have a second model that sets up the field layout and passes it to the elements like Calendars -&gt; Events, or Entry Types -&gt; Entries, Category Groups-&gt; Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I'm hoping to do is just have one single field layout for all inquiries (more like how users work currently) and ideally this would be editable through the plugin settings (instead of the tab)  is that currently possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can include this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/fieldlayoutdesigner&quot; with {&#xA;  fieldLayout: fieldLayout&#xA;} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i need to get a field layout somehow? and then hook into the save?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2014-10-14T03:53:42.613" LastActivityDate="2018-02-03T00:32:30.733" Title="Is it possible to use the field layout designer in settings screen?" Tags="&lt;plugins&gt;&lt;elementtype&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4120" PostTypeId="1" CreationDate="2014-10-14T03:29:31.877" Score="2" ViewCount="101" Body="&lt;p&gt;I've created a custom element type with it's own Field Layout Designer. The details about the custom element can be modified in the same form where the Field Layout Designer exists.  There is also a chance a person navigates away from the form without saving the changes after the Field Layout Designer is updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if someone reorders one of the fields, doesn't save, and navigates away, the change they made in the editor may never get saved.  That's fine, and they have every right to, but I'd like to trigger a popup to warn them if they are about to navigate away without saved changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do this for all input fields with a snippet like the following.  The following snippet changes the isDirty variable to true and I can trigger a popup with my message if that value is true:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(':input').change(function () {&#xA;  isDirty = true;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to figure out how to do this for the Field Layout Designer.  How can I set the value &lt;code&gt;isDirty&lt;/code&gt; to true whenever someone reorders a field or tab, or perhaps drags anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to add a listener:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.addListener($('.tab.sel.draggable'), 'mouseup', '_onMouseUp');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And test for variables such as &lt;code&gt;Craft.FieldLayoutDesigner.fieldDrag&lt;/code&gt; and &lt;code&gt;!Craft.dragger.dragging&lt;/code&gt; but I haven't had any success and don't feel I'm approaching the problem with the right paradigm in my head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how I can test if any items have been updated in the Field Layout Designer?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="250" LastEditDate="2014-11-11T18:01:58.673" LastActivityDate="2014-11-11T18:01:58.673" Title="How can I test if there are any changes in the Drag/Drop Field Layout Designer?" Tags="&lt;field-layout-designer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4121" PostTypeId="1" AcceptedAnswerId="4122" CreationDate="2014-10-14T07:50:43.417" Score="1" ViewCount="1084" Body="&lt;p&gt;I'm building a simple blog that has the ability to publish entries:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Within a set of categories.&lt;/li&gt;&#xA;&lt;li&gt;With no category set.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The URL format of a blog entry is &lt;code&gt;/blog/YYYY/MM/DD/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything so far works, my section &lt;code&gt;blog&lt;/code&gt; works and the &lt;code&gt;templates/blog/index.html&lt;/code&gt; template loads correctly as does the &lt;code&gt;templates/blog/_entry.html&lt;/code&gt; for blog entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories however don't seem to work as they seem to be conflicting with the entry URLs… I have a list of all blog categories at the top of the blog section with each section, eg: 'Recipes', linking to &lt;code&gt;/blog/recipes&lt;/code&gt; (using the &lt;code&gt;{category.url}&lt;/code&gt; var).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft I have set the Blog categories settings set to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Category URL Format&lt;/strong&gt;: &lt;code&gt;blog/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nested Categories&lt;/strong&gt;: &lt;em&gt;not set/empty&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Category Template&lt;/strong&gt;: &lt;code&gt;_category.html&lt;/code&gt; &lt;em&gt;(I have also tried &lt;code&gt;_category&lt;/code&gt; without the &lt;code&gt;.html&lt;/code&gt; extension as the value with the same result)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The issue&lt;/strong&gt; is that when I navigate to &lt;code&gt;blog/recipes&lt;/code&gt; I get a 404 instead of the system serving the &lt;code&gt;templates/blog/_category.html&lt;/code&gt; template I have set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: There are no custom routes setup for this site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what I am doing wrong, single entries serve up fine, but I can't seem to get to the category listing of a blog's category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="169" LastActivityDate="2014-10-14T20:27:36.267" Title="How can I get blog categories and blog entry urls to play nice together?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;url&gt;&lt;categories&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4122" PostTypeId="2" ParentId="4121" CreationDate="2014-10-14T09:22:08.697" Score="3" Body="&lt;p&gt;I think the problem here could be to do with the path to your Category Template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that in your category settings, the path to your Category Template file includes the folder it is nested within.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of &lt;code&gt;_category.html&lt;/code&gt;, you should put &lt;code&gt;blog/_category.html&lt;/code&gt; (if that file is inside the Blog template folder)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also some &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt; on the Craft site that tells you how to template this file if you haven't seen it already.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-10-14T20:27:36.267" LastActivityDate="2014-10-14T20:27:36.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4124" PostTypeId="1" AcceptedAnswerId="4125" CreationDate="2014-10-14T12:05:31.833" Score="2" ViewCount="397" Body="&lt;p&gt;We would like to show a page which lists all Authors, and their respective entries, eg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dan Griffey&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1&lt;/li&gt;&#xA;&lt;li&gt;Entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Joe Blogs&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1&lt;/li&gt;&#xA;&lt;li&gt;Entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Have tried a few options but alas none working, so would appreciate any help / examples.&lt;/p&gt;&#xA;" OwnerUserId="214" LastEditorUserId="344" LastEditDate="2014-10-14T14:42:03.327" LastActivityDate="2014-10-14T14:42:03.327" Title="List Entries by Author" Tags="&lt;author&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4125" PostTypeId="2" ParentId="4124" CreationDate="2014-10-14T12:26:31.083" Score="6" Body="&lt;p&gt;I would use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for author, entries in craft.entries.find() | group('author') %}&#xA;    {{ author }}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;              &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-10-14T12:26:31.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4126" PostTypeId="1" AcceptedAnswerId="4134" CreationDate="2014-10-14T13:07:25.407" Score="0" ViewCount="77" Body="&lt;p&gt;Usecase: the site I'm building has public registration, the publicly registered users have access to only their own specific entry in the back-end (which makes use of many complex fields, such as Matrix, which is why I'm not trying to put this form on the front-end for them to manage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While everything else is hidden from them already, it'd be nice to hide the Craft version just to hinder any neer-do-wells from easy bug-hunting and hacking shenanigans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd still be useful to have that info displayed for other admin groups though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-10-14T14:11:29.110" Title="Can we hide version number in control panel for certain user groups?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4127" PostTypeId="1" AcceptedAnswerId="4132" CreationDate="2014-10-14T13:07:36.507" Score="3" ViewCount="4075" Body="&lt;p&gt;So, i have a channel called images and a couple of category groups one of which is called &quot;images&quot; which has categories called family, animals, individuals in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, i just want to grab the entries that have one of those categories assigned / related to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figured something like this would do it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in craft.entries.section('images').relatedTo('photography').find('family') %}&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i figured wrong! Any ideas would be gratefully received!&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2014-10-14T15:17:19.187" Title="Get entries which have a certain category assigned to them" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4128" PostTypeId="1" AcceptedAnswerId="4133" CreationDate="2014-10-14T13:07:37.713" Score="10" ViewCount="7165" Body="&lt;p&gt;I've installed a ssl cert on a site and it's working. Now I want to redirect visitors coming in on http over to https&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put this code and only this code in the htaccess file, but it's causing a redirect loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;RewriteCond %{SERVER_PORT} 80 &#xA;RewriteRule ^(.*)$ https://www.mysite.com/$1 [R,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My original htaccess looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;RewriteCond %{HTTP_HOST} ^mysite.com [NC]&#xA;RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R=301]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could Craft somehow be causing the redirect loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Craft CP I have the Site URL set to &lt;a href=&quot;https://www.mysite.com&quot;&gt;https://www.mysite.com&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="57" LastEditDate="2014-10-14T16:46:01.157" LastActivityDate="2019-11-20T17:26:14.537" Title="How do I force SSL on Craft?" Tags="&lt;htaccess&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4129" PostTypeId="2" ParentId="4128" CreationDate="2014-10-14T13:16:46.067" Score="5" Body="&lt;p&gt;Try this sample htaccess-file I'm using on another site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteBase /&#xA;&#xA;# If the request is not secure&#xA;RewriteCond %{HTTPS} off&#xA;# Redirect to the secure version&#xA;RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]&#xA;&#xA;# Normal redirect rules&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.*)$ /index.php/$1 [L] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastEditorUserId="297" LastEditDate="2014-10-14T13:29:47.653" LastActivityDate="2014-10-14T13:29:47.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4131" PostTypeId="1" AcceptedAnswerId="4136" CreationDate="2014-10-14T13:48:21.843" Score="2" ViewCount="190" Body="&lt;p&gt;How much data can I push into one craft()-&gt;cache key?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a json string that's reaaaallly long.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-14T15:02:48.943" Title="How much data can craft()-&gt;cache hold?" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4132" PostTypeId="2" ParentId="4127" CreationDate="2014-10-14T13:52:06.703" Score="15" Body="&lt;p&gt;This should do what you are looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('family') %}&#xA;{% set entries = craft.entries.section('images').relatedTo(category).find() %}&#xA;&#xA;{# If there are any entries, loop through them #}&#xA;{% if entries | length %}&#xA;&#xA;    {# For each entry we find, do this #}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we are creating a variable called category, in which you set the category you want to get the list of related entries from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next we set a variable called entries, which checks to see if there are any entries in the Image section that relate to the category we set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It then loops through the entries that we find (if there are any).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More than one category group might have the Family category. To get round this you can target a specific category group when we set the category variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('categoryGroup').slug('family') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-10-14T15:17:19.187" LastActivityDate="2014-10-14T15:17:19.187" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4133" PostTypeId="2" ParentId="4128" CreationDate="2014-10-14T14:02:06.497" Score="15" Body="&lt;p&gt;For reference, this worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP:X-Forwarded-Proto} !https&#xA;RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="122" LastActivityDate="2014-10-14T14:02:06.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4134" PostTypeId="2" ParentId="4126" CreationDate="2014-10-14T14:11:29.110" Score="2" Body="&lt;p&gt;You would need to write a plugin that hides it with Javascript. We don’t have any plans to make it customizable.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-14T14:11:29.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4135" PostTypeId="1" CreationDate="2014-10-14T14:59:39.537" Score="3" ViewCount="288" Body="&lt;p&gt;Im working on a plugin with a custom element type and i have most things working but i haven't been able to get custom fields to save with my elements using setContentFromPost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the record and the model all setup and saving, and it creates rows in both the custom table (inquiries) as well as an entry in the craft_elements table and the craft_content tables but the craft_content table always has blanks for all the fields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tracked things down to this one line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$inquiry-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thats where its supposted to copy all the values from the post variables for fields into the element but i tested it with var dumps both before and after that line and the content isnt attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did the same check in the example &quot;Events&quot; plugin from pixel and tonic and it is in fact that line that attaches the custom field values to that line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also checked the post variable 'fields' and its set properly and its returning an array as expected with content&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(4) { [&quot;jobTitle&quot;]=&amp;gt; string(7) &quot;partner&quot; [&quot;bio&quot;]=&amp;gt; string(47) &quot;&#xA;this is a guy&#xA;&#xA;&quot; [&quot;twitter&quot;]=&amp;gt; string(13) &quot;@keithmancuso&quot; [&quot;instagram&quot;]=&amp;gt; string(11) &quot;keithmancuo&quot; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I even went so far to try and manually attach content to the model and THAT WORKS!  so when i do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $fields = craft()-&amp;gt;request-&amp;gt;getPost('fields');&#xA;    $inquiry-&amp;gt;getContent()-&amp;gt;jobTitle = $fields['jobTitle'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;It works&lt;/em&gt;, job title is saved into the content table, huzza!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but why doesnt &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $inquiry-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;work for all the fields in the &quot;fields&quot; array.  Do i need to do my own loop around that array?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-10-14T14:59:39.537" Title="Trouble saving custom fields onto custom element type" Tags="&lt;plugins&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4136" PostTypeId="2" ParentId="4131" CreationDate="2014-10-14T15:02:48.943" Score="2" Body="&lt;p&gt;&lt;code&gt;craft()-&amp;gt;cache&lt;/code&gt; can point to different places, depending on what the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting is set to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, it's set to &lt;code&gt;file&lt;/code&gt;, which means that your cache will be saved to the file system in the &lt;code&gt;craft/runtime/storage/cache&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can pretty much save as much there as you have disk space available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just keep in mind, if you're saving something that's 500MB worth of text, PHP is roughly going need 500MB worth of extra memory to be able to read and write that data.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-14T15:02:48.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4137" PostTypeId="2" ParentId="4128" CreationDate="2014-10-14T15:12:53.143" Score="15" Body="&lt;p&gt;I recommend trying out the Patrol plugin.  It avoids .htaccess headbanging and just handles the redirects via PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/selvinortiz/craft.patrol&quot;&gt;Patrol Plugin for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Settings, turn on &lt;code&gt;Secure Connections&lt;/code&gt; and add a backslash &lt;code&gt;/&lt;/code&gt; to the &lt;em&gt;Protected Areas&lt;/em&gt; settings box.  That will force SSL across the board.  If you want to get more specific, you can provide multiple, more-specific paths.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-10-14T15:12:53.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4138" PostTypeId="1" CreationDate="2014-10-14T15:17:20.450" Score="3" ViewCount="187" Body="&lt;p&gt;First of all, I'm loving Craft. So refreshing (even coming from EE). Kudos to the team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious if anyone has had similar views on Craft's handling of Entry Types. It would seem favorable to allow sharing of them across Sections or, better yet, break them out altogether as a separate entity so that in Settings &gt; Content you'd have the option for Fields, Sections, Entry Types and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, to create a 'Common' Entry Type usable across multiple Channels I currently have to rebuild it for each channel. If Entry Types were broken out, I could simply choose from those available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, I admittedly may not be approaching Entry Type usage in the best manner possible. Does anyone have any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="45" LastEditDate="2016-08-13T02:26:24.650" LastActivityDate="2016-08-13T02:26:24.650" Title="Sharing Entry Types Across Sections (or Breaking Them Out Altogether)" Tags="&lt;entries&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2014-10-16T03:13:43.630" ContentLicense="CC BY-SA 3.0" />
  <row Id="4139" PostTypeId="1" AcceptedAnswerId="4155" CreationDate="2014-10-14T16:52:22.397" Score="2" ViewCount="510" Body="&lt;p&gt;We have a site that is running event pages, that will show live content (via Ustream or similar). Users have to be reg'd and logged in to view content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to establish who is online and how many logged in viewers at the time of the event. Is there a function that will display this to admin users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Dan&lt;/p&gt;&#xA;" OwnerUserId="214" LastActivityDate="2014-10-17T12:38:23.230" Title="Number of users online / Who is online" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4140" PostTypeId="2" ParentId="4139" CreationDate="2014-10-14T17:07:32.510" Score="2" Body="&lt;p&gt;Nothing native, so it would have to be with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin could listen for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#usersession-onLogin&quot; rel=&quot;nofollow&quot;&gt;userSession.onLogin&lt;/a&gt; event and keep a counter of the number of people that have logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how accurate you need to be, it gets more tricky when deciding on how/when a user has logged out (either manually or their session expired).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually logging out you would need to listen to an onLogout event, that doesn't exist yet, but probably should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For logging out via session expiration (no activity for the defined &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#userSessionDuration&quot; rel=&quot;nofollow&quot;&gt;userSessionDuration&lt;/a&gt;), you'd need to track the userId that was captured in the &lt;code&gt;onLogin&lt;/code&gt; event and periodically check against the &lt;code&gt;craft_session&lt;/code&gt; table in the database to see if it still exists.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-14T17:07:32.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4141" PostTypeId="1" CreationDate="2014-10-14T18:36:45.717" Score="1" ViewCount="167" Body="&lt;p&gt;Is there a direct relation between code in templates and PHP code inside a controller for example?&#xA;I need to translate &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedProducts = craft.entries.section('products').relatedTo({&#xA;                   targetElement: testVariant,&#xA;                   field: &quot;productVariants.productSizes&quot;&#xA;}) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into a controller and im not sure how.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-10-14T19:41:30.387" Title="Direct relation between templates and PHP" Tags="&lt;templating&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4143" PostTypeId="2" ParentId="4141" CreationDate="2014-10-14T19:41:30.387" Score="1" Body="&lt;p&gt;A very similar question has been asked before &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2316/how-can-i-follow-relations-in-elementcriteriamodels-from-plugin-code&quot;&gt;How can I follow relations in ElementCriteriaModels from plugin code&lt;/a&gt;. You would want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'products';&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $e,&#xA;    'field'         =&amp;gt; $field&#xA;);&#xA;$elements = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;$e&lt;/code&gt; is testVariant, and &lt;code&gt;$field&lt;/code&gt; is &lt;code&gt;productVariants.productSizes&lt;/code&gt;, which can be retrieved using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getElementById(id)&lt;/code&gt; and &lt;code&gt;craft()-&amp;gt;fields-&amp;gt;getFieldById(id)&lt;/code&gt; or &lt;code&gt;getFieldByHandle(handle)&lt;/code&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create a controller see the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation on Controllers&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-10-14T19:41:30.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4144" PostTypeId="1" AcceptedAnswerId="4159" CreationDate="2014-10-14T19:58:02.960" Score="0" ViewCount="827" Body="&lt;p&gt;Aside from Defining Transforms in the template (&lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/image-transforms&lt;/a&gt;) is there a way to go back and trigger an image transformation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got a number of assets that have been uploaded to rackspace that need image an image transformation but the transformation was created after the images were uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to kick this off?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-10-15T17:35:07.373" Title="Updated Image Transformation" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2014-10-16T15:37:54.483" ContentLicense="CC BY-SA 3.0" />
  <row Id="4145" PostTypeId="1" CreationDate="2014-10-14T20:04:53.460" Score="2" ViewCount="576" Body="&lt;p&gt;Are their any best practices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe some way to hook to craft native exception / log handler with a third party implantation so I could track my errors on services like &lt;a href=&quot;https://getsentry.com/welcome/&quot; rel=&quot;nofollow&quot;&gt;Sentry&lt;/a&gt; or &lt;a href=&quot;https://rollbar.com&quot; rel=&quot;nofollow&quot;&gt;Rollbar&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="896" LastEditorUserId="250" LastEditDate="2014-10-14T20:53:04.017" LastActivityDate="2014-11-13T01:33:57.410" Title="Log exception to a third party service like Sentry or Rollbar?" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4146" PostTypeId="1" AcceptedAnswerId="4289" CreationDate="2014-10-14T20:21:57.827" Score="3" ViewCount="1305" Body="&lt;p&gt;I would like to impliment the native craft datepicker ui in my custom fieldType. From looking at the native &lt;code&gt;date&lt;/code&gt; template (&lt;code&gt;craft/app/templates/_includes/form/date.html&lt;/code&gt;) I can see that it inserts javascript using &lt;code&gt;includeJs&lt;/code&gt;, which I have followed exactly. Here is my template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;datewrapper&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; autocomplete=&quot;off&quot; value=&quot;&quot; size=&quot;10&quot; id=&quot;trial_end&quot; data-stripe=&quot;trial_end&quot; class=&quot;text hasDatepicker&quot;&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{%- set js %}&#xA;    var $datePicker = $('#{{ 'trial_end'|namespaceInputId|e('js') }}');&#xA;    $datePicker.datepicker({&#xA;        constrainInput: false,&#xA;        dateFormat: '{{ craft.i18n.datepickerJsFormat }}',&#xA;        defaultDate: new Date(),&#xA;        prevText:   '{{ &quot;Prev&quot;|t|e('js') }}',&#xA;        nextText:   '{{ &quot;Next&quot;|t|e('js') }}',&#xA;    });&#xA;{%- endset %}&#xA;{%- includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have confirmed that the js output is identical to the other native date fields, and that the namespaced &lt;code&gt;id&lt;/code&gt; matches between the js selector and the html input field id. But no datepicker. Is there a piece missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Perhaps my question needs some clarification. My field type includes additional 'dummy' fields that will never get stored in the database, but rather are only used to collect information from the user that will be sent via ajax to a 3rd party service, with the result &lt;code&gt;customerId&lt;/code&gt; being stored in the database. One of those dummy fields is a date field that I would like to use the native datepicker for. Here is an image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZoR9P.png&quot; alt=&quot;This is the custom field&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes. That is all one field! that only stores a &lt;code&gt;customerid&lt;/code&gt; from a third party service (Stripe), and loads all of the customer account info via ajax. The actual field 'customerID' is never exposed to the client, as it generated automatically.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-22T18:07:21.117" LastActivityDate="2014-10-22T18:54:48.783" Title="How to use the native datepicker ui in custom fieldTypes?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4147" PostTypeId="2" ParentId="4145" CreationDate="2014-10-14T20:50:54.623" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Went to look into this and while it's true that Craft doesn't have any explicit events around error handling, Yii already does in the form of &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail&quot; rel=&quot;nofollow&quot;&gt;onException&lt;/a&gt; and &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onError-detail&quot; rel=&quot;nofollow&quot;&gt;onError&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can listen for them like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;onException = array($this, 'myCustomExceptionMethodHandler');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;onError = array($this, 'myCustomErrorMethodHandler');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Original answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently doesn't have any events around error handling, but it's probably not a bad idea to do so for situations like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added it to our list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, the only workaround I can think of is pretty sketchy, but a plugin could monitor the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder for &lt;code&gt;[error]&lt;/code&gt; entries and parse the text for the information it needs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-13T01:33:57.410" LastActivityDate="2014-11-13T01:33:57.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4148" PostTypeId="1" CreationDate="2014-10-15T00:53:50.067" Score="0" ViewCount="335" Body="&lt;p&gt;I created matrix field, put it in the user field. In the front-end page as usually write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in user.myMatrixfield.type('myType') %}&#xA;   ................&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but there is no output!&#xA;try to write &lt;code&gt;{% user.myMatrixfield|length %}&lt;/code&gt; - outputs 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In administration panel everything works.&#xA;How to get matrix field in user-profile front-end page?&lt;/p&gt;&#xA;" OwnerUserId="635" LastActivityDate="2014-10-15T12:10:24.453" Title="Matrix field in user-profile front-end" Tags="&lt;users&gt;&lt;matrix&gt;&lt;user-profile&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4149" PostTypeId="1" CreationDate="2014-10-15T09:02:19.790" Score="3" ViewCount="838" Body="&lt;p&gt;I'm wondering if Craft would be a good fit for a project that would require social features like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;users being able to submit content to the site&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;users being able to 'like' content&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;users being able to create 'folders/collections' and add/save content in them&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;users being able to follow each other to keep up with each others content&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-09-02T08:55:51.713" Title="Is Craft a good fit for a project w/ social network features?" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4150" PostTypeId="1" AcceptedAnswerId="4173" CreationDate="2014-10-15T09:06:19.407" Score="1" ViewCount="131" Body="&lt;p&gt;Is it possible to create a Custom Widget that behaves like the 'Deprecation Errors' warning on the Dashboard? When active, the widget would appear on all users', or particular user groups, dashboards at the top and display new information, warnings and anything else that may be of use.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-10-16T11:08:49.153" Title="Global User Notification Widget" Tags="&lt;dashboard-widgets&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4151" PostTypeId="2" ParentId="4144" CreationDate="2014-10-15T11:32:18.830" Score="0" Body="&lt;p&gt;Probably administration panel -&gt; settings -&gt; tools -&gt; Update Asset Indexes&lt;/p&gt;&#xA;" OwnerUserId="635" LastActivityDate="2014-10-15T11:32:18.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4152" PostTypeId="2" ParentId="4148" CreationDate="2014-10-15T11:33:29.870" Score="1" Body="&lt;p&gt;It works identically to entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a couple things you can do to troubleshoot:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure that &lt;code&gt;user&lt;/code&gt; is set to the user account you’re expecting it is. You can double check that by outputting &lt;code&gt;{{ user.username }}&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure that you’re calling the right Matrix field handle, with the correct capitalization.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you’re passing the &lt;code&gt;type&lt;/code&gt; param, make sure you’re passing in the right Block Type handle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-15T11:33:29.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4153" PostTypeId="2" ParentId="4148" CreationDate="2014-10-15T12:10:24.453" Score="1" Body="&lt;p&gt;Oh, sorry, &#xA;I forgot to put the original values in administration panel. That is, I did not push +myMatrixfield and it turns out that the matrix field does not exist.&lt;/p&gt;&#xA;" OwnerUserId="635" LastActivityDate="2014-10-15T12:10:24.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4154" PostTypeId="1" CreationDate="2014-10-15T13:11:09.787" Score="3" ViewCount="573" Body="&lt;p&gt;I have a CraftCMS site and a client has uploaded some images to their portfolio that were taken with their iPhone. Generally I don't worry about the EXIF data/camera orientation but it looks like the transforms are ignoring it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking in Chrome - you can see the issue on this page: &lt;a href=&quot;http://seachant.co/work/levis-x-vsco&quot; rel=&quot;nofollow&quot;&gt;http://seachant.co/work/levis-x-vsco&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wondering if anyone else has dealt with this or if there is a quick fix for this in Craft (without having the client save out their photos again)?&lt;/p&gt;&#xA;" OwnerUserId="875" LastEditorUserId="22" LastEditDate="2017-05-10T00:18:51.747" LastActivityDate="2017-05-10T00:18:51.747" Title="Camera Orientation and image transforms?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4155" PostTypeId="2" ParentId="4139" CreationDate="2014-10-15T13:59:44.237" Score="5" Body="&lt;p&gt;I have added a prototype plugin that uses Pusher.com to keep track of online users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/sjelfull/Craft-WhosAround&quot; rel=&quot;nofollow&quot;&gt;Check out the Git repo&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you need to add this to your frontend template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.whosaround.setup }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It adds the Pusher library, and also subscribes to the channel name you got in your settings. You need to signup to an account over at Pusher.com as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CP, you can get a rudimentary list with the name and the count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of some cool use cases, so I'll probably revisit it soon and add more stuff etc., but it might be a useful starting point, depending on if you want to use Pusher for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pusher is a very neat service for use cases like this, and might be especially interesting if you expect many users online.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-10-17T12:38:23.230" LastActivityDate="2014-10-17T12:38:23.230" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4156" PostTypeId="2" ParentId="4149" CreationDate="2014-10-15T15:21:26.753" Score="6" Body="&lt;p&gt;It really depends on whether you consider Craft a platform, that you're willing to do some custom development on, or an off-the-shelf, finished product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though I love Craft, I have to be honest. As an off-the-shelf product, and if the main goal of the project is building a social network, I think you're be better off choosing some other, more specialised, platform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can probably solve all the things you mention with Craft; user handling, posting content to different channels from the front-end, updating content with likes, updating users with followers, etc. But, you don't get any specific social network functionality &quot;for free&quot;, you'll have to use the building blocks that exists in Craft to create this functionality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if you're willing to do some custom plugin development, you could definitely use Craft as the platform. The plugin API is extremely powerful, and let's you build and integrate pretty much whatever you want into Craft.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-15T15:21:26.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4157" PostTypeId="2" ParentId="4154" CreationDate="2014-10-15T17:26:49.850" Score="2" Body="&lt;p&gt;The image processing library we use just recently added the support for us to be able to read image EXIF metadata from images, so it's on our list (among other things) to have transforms be aware of image orientation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-15T17:26:49.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4158" PostTypeId="1" CreationDate="2014-10-15T17:30:04.970" Score="4" ViewCount="471" Body="&lt;p&gt;I'm rethinking our Craft environment/workflow.  My idea is to accommodate disposable and/or multiple container (or server) environments.  As a result I want to use log aggregation apps like papertrail, logstash, etc to consolidate and investigate logging across multiple servers.  They recommend logging to php://stderr.  Is this possible?  What approach would you take to override the apps log route?&lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="22" LastEditDate="2014-11-10T21:10:56.077" LastActivityDate="2014-11-10T21:10:56.077" Title="Set logging path/file to use php://stderr" Tags="&lt;config&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4159" PostTypeId="2" ParentId="4144" CreationDate="2014-10-15T17:35:07.373" Score="5" Body="&lt;p&gt;I forgot we added a tool for this, too, under Settings-&gt;Tools-&gt;Clear Caches Tool-&gt;Asset Transform Index.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-15T17:35:07.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4160" PostTypeId="2" ParentId="4158" CreationDate="2014-10-15T17:42:25.683" Score="4" Body="&lt;p&gt;Pretty sure you'd need to write a plugin that has a class that extends Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CLogRoute&quot; rel=&quot;nofollow&quot;&gt;CLogRoute&lt;/a&gt; and override the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CLogRoute#processLogs-detail&quot; rel=&quot;nofollow&quot;&gt;processLogs&lt;/a&gt; method with your own logic.  Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class StdErrRoute extends \CLogRoute&#xA;{&#xA;    public function processLogs($logs)&#xA;    {&#xA;        $strErr = fopen(&quot;php://stderr&quot;, &quot;w&quot;);&#xA;&#xA;        foreach($logs as $log)&#xA;        {&#xA;            fwrite($strErr, $log[0]);&#xA;        }&#xA;&#xA;        fclose($strErr);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin's &lt;code&gt;init()&lt;/code&gt; method would register the route via &lt;code&gt;craft()-&amp;gt;log-&amp;gt;addRoute()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-15T17:42:25.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4161" PostTypeId="1" AcceptedAnswerId="4164" CreationDate="2014-10-15T18:27:22.287" Score="1" ViewCount="138" Body="&lt;p&gt;I have a plugin with nothing but the following in the init() method other than the basics (just for testing purposes):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'foo' =&amp;gt; array('bar' =&amp;gt; 'baz')&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From all of my routes I can access this just fine. It's working for static templates, dynamic entries, etc. To access it I'm using the following code in my main base template &lt;code&gt;/_layouts/base.twig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ foo.bar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is as expected: &lt;code&gt;baz&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cannot access this from a page that does not exist, i.e., a 404. If I go to &lt;code&gt;my-site.com/doesnt-exist&lt;/code&gt; I receive the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Runtime&#xA;&#xA;Variable &quot;foo&quot; does not exist in &quot;_layouts/base&quot; at line 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My 404 template is extending base as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably worth noting that the reason I'm trying to do this is because I want to include a form on the 404 page (that I also include in other areas, so it's setup as a partial) and I'm having trouble passing error validation back and forth with &lt;code&gt;setRouteVariables&lt;/code&gt;, but only for 404 pages. I know I could do this with a session and that is my current work around, but I wanted to see if there was a better way.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-10-15T19:44:31.863" Title="Do 404s get access to variables set with setRouteVariables?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4162" PostTypeId="1" AcceptedAnswerId="4163" CreationDate="2014-10-15T18:28:28.293" Score="3" ViewCount="100" Body="&lt;p&gt;I have a few fields assigned to an Asset Source, which allow the user to alter the appearance of the image (large, small, portrait, landscape) etc. on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is a bug or intended behaviour, but when I enter a field value as an editor to a particular instance of an Asset, if that Asset then appears elsewhere in a different entry, it appears to inherit the field values of the Asset where it was used previously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to have an image in one entry set to, for example, 'large', but also have that same image appear on another entry but set to 'small'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming this is intended behaviour, how can I get around this?&lt;/p&gt;&#xA;" OwnerUserId="470" LastActivityDate="2016-04-18T05:39:32.087" Title="Are values in Asset fields held globally for a particular Asset?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4163" PostTypeId="2" ParentId="4162" CreationDate="2014-10-15T19:09:22.423" Score="2" Body="&lt;p&gt;The fields attached to an asset source will be connected to the asset, and will follow the asset no matter where it's used. So yes, this is the intended behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to specify on an entry basis what size an image should have, you need to add a field for selecting size on the entry type. Say you have a field &quot;Main image&quot; in your entry type, you'd add a &quot;Main image size&quot; field to the same entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're making a gallery or something, instead of having one assets field where you select all images, you could create a matrix field that has one column for (one) asset and one column for size instead, and add each image as it's own row.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-15T19:09:22.423" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4164" PostTypeId="2" ParentId="4161" CreationDate="2014-10-15T19:44:31.863" Score="2" Body="&lt;p&gt;The simple answer is: no, error handling templates don’t have access to the variables that would be available to the template when the request resolves normally. And we won’t be making it possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically you could get access to them by creating a plugin that has a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; which is capable of adding those variables:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook('mergeRouteVariables', function(&amp;amp;$context)&#xA;{&#xA;    $routeParams = craft()-&amp;gt;urlManager-&amp;gt;getRouteParams();&#xA;&#xA;    if (isset($routeParams['variables']))&#xA;    {&#xA;        $context = array_merge($context, $routeParams['variables']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;404.html:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% hook &quot;mergeRouteVariables&quot; %}&#xA;{# ... #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It's probably worth noting that the reason I'm trying to do this is because I want to include a form on the 404 page (that I also include in other areas, so it's setup as a partial) and I'm having trouble passing error validation back and forth with setRouteVariables, but only for 404 pages. I know I could do this with a session and that is my current work around, but I wanted to see if there was a better way.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While I understand your use case, it's pretty weird that you would have a form that intentionally submits to a 404 page (even though it’s the same page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a couple alternatives you might want to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You could create a dedicated page for the form, and have the form submit to that page’s URL in the event that it’s coming from a 404.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could handle the form submission and validation with Javascript/Ajax.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-15T19:44:31.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4165" PostTypeId="1" AcceptedAnswerId="4168" CreationDate="2014-10-15T20:01:36.007" Score="3" ViewCount="2260" Body="&lt;p&gt;When using the Pixel &amp;amp; Tonic contact form (&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;) how do you make the fromName field required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the form as seen on github, only the message and email field are required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2018-10-02T11:13:00.587" Title="How to make fields required on the contact form?" Tags="&lt;plugin-contactform&gt;" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4166" PostTypeId="1" AcceptedAnswerId="4174" CreationDate="2014-10-15T20:11:57.113" Score="1" ViewCount="244" Body="&lt;p&gt;I have a list of entries with a thumbnail (Image Asset) added to the entry. Within my &lt;em&gt;entries&lt;/em&gt; loop I check if there's any image (thumbnail) added for the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumbnail = entry.thumbnail.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since each check requires one new query the queries keep adding up if the list has for example 100 entries. That's 100 queries just for displaying one thumbnail next to my entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way of doing this? Could I for example get the URL to the image asset some other way then running a query on the AssetModel?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-16T11:46:23.207" Title="Optimize queries with list of image thumbnails" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4167" PostTypeId="1" CreationDate="2014-10-15T20:35:05.450" Score="1" ViewCount="98" Body="&lt;p&gt;I'm wondering if there's a build in craft function for displaying countries (countryCode and/or name)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like it is for displaying locales:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.i18n.getAllLocales()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-15T23:03:40.043" Title="Does craft have any build in function for countries like locales?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4168" PostTypeId="2" ParentId="4165" CreationDate="2014-10-15T20:49:46.667" Score="0" Body="&lt;p&gt;Currently, there isn't a native way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write some JS that does client-side validation, fork the repo add it yourself or if you're looking for a more complete form-building solution, &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;hit up these guys&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-15T20:49:46.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4169" PostTypeId="2" ParentId="4167" CreationDate="2014-10-15T23:03:40.043" Score="1" Body="&lt;p&gt;The closest thing I can think of is to pull the data from the 'territories' part of a &lt;code&gt;craft/app/framework/i18n/data&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 'en_us', that would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set localeData = craft.i18n.getLocaleData('en_us') %}&#xA;{% set allTerritories = localeData.getAllTerritories() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-15T23:03:40.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4172" PostTypeId="2" ParentId="4162" CreationDate="2014-10-16T03:43:10.247" Score="1" Body="&lt;p&gt;To be clear, you're using &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;image transforms&lt;/a&gt; to control the size of your image, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4163/45&quot;&gt;André is correct...&lt;/a&gt; If your image manipulation fields will have different values per entry, then those fields should be attached to the &lt;strong&gt;entry type&lt;/strong&gt;, not the &lt;strong&gt;asset source&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your entry type would contain these fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Assets&quot; fieldtype&lt;/li&gt;&#xA;&lt;li&gt;limit 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Image Size&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Dropdown&quot; fieldtype&lt;/li&gt;&#xA;&lt;li&gt;options: &quot;Small&quot;, &quot;Medium&quot;, &quot;Large&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Your template would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.image.first %}&#xA;{% set transformSize = entry.imageSize.value %}&#xA;&#xA;&amp;lt;img src=&quot;{{ asset.getUrl(transformSize) }}&quot; width=&quot;{{ asset.getWidth(transformSize) }}&quot; height=&quot;{{ asset.getHeight(transformSize) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The person editing the entry can easily select &lt;strong&gt;which asset&lt;/strong&gt; and &lt;strong&gt;what size&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-18T05:39:32.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4173" PostTypeId="2" ParentId="4150" CreationDate="2014-10-16T11:08:49.153" Score="1" Body="&lt;p&gt;There’s no such thing as a “global” widget right row, however your widget’s &lt;code&gt;getBodyHtml()&lt;/code&gt; method can return &lt;code&gt;false&lt;/code&gt;, which tells Craft to not show the widget at all. So you could just have the widget assigned to all the user accounts you want, and always return &lt;code&gt;false&lt;/code&gt; unless there’s actually something to display.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-16T11:08:49.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4174" PostTypeId="2" ParentId="4166" CreationDate="2014-10-16T11:46:23.207" Score="1" Body="&lt;p&gt;I think that's how it works and there's no way around this. That asset is related to your entry and to get the asset's URL property, Craft has to do a query to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means: each page with lots of thumbnails should be cached. :(&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-16T11:46:23.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4175" PostTypeId="1" AcceptedAnswerId="4177" CreationDate="2014-10-16T11:47:00.340" Score="5" ViewCount="2879" Body="&lt;p&gt;I'm trying to do something very simple - but I've yet to find documentation to cover this basic scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm writing a plugin. In a controller, I want to create a new entry, and assign an uploaded file to an Assets field on the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create an entry using the example code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'Title of thing';&#xA;// set some custom fields&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One of the fields is an Assets type; I have image data in a variable - I want to create an asset and associate it to the relevant property of the entry.&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="9" LastEditDate="2014-10-16T13:22:01.933" LastActivityDate="2014-10-16T13:30:51.463" Title="Create entry with newly-uploaded asset programatically" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4176" PostTypeId="1" CreationDate="2014-10-16T12:30:15.807" Score="7" ViewCount="1286" Body="&lt;p&gt;Is there any way to &quot;eagerly load&quot; Craft element relations a la Yii's ActiveRelation &quot;with&quot; function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#with-detail&quot;&gt;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#with-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a very handy way to request one big query instead of many small ones in cases where you know up front that you are going to be using all the relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** UPDATE **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay after experimenting with this, I guess my real question should have been, is there any way to do this kind of thing at the ElementCriteriaModel level, taking advantage of Craft relational fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I want to get a list of children of a Structure entry, along with all the assets in a field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($entry-&amp;gt;children-&amp;gt;find() as $child) {&#xA;    // do something with $child-&amp;gt;assetsField...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to load those assets in one big query rather than individually for each child?&lt;/p&gt;&#xA;" OwnerUserId="629" LastEditorUserId="629" LastEditDate="2014-10-19T14:43:46.857" LastActivityDate="2016-08-05T04:21:25.707" Title="&quot;Eager loading&quot; of relations like Yii's &quot;with&quot; function" Tags="&lt;database&gt;&lt;relations&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4177" PostTypeId="2" ParentId="4175" CreationDate="2014-10-16T13:18:29.357" Score="7" Body="&lt;p&gt;Assets fields are capable of storing newly uploaded files into assets folders, and then automatically relating them to the entry (making &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot;&gt;this feature&lt;/a&gt; possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you’re saving the entry yourself rather than using the &lt;code&gt;entries/saveEntry&lt;/code&gt; controller action, there are two things you need to do in order to take advantage of this feature:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Make sure your form is set up correctly.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form should be submitting with a POST request, and encoding with multipart/form-data:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the file input needs to have an input name based on the Assets field’s handle:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;fields[myAssetsFieldHandle]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Your controller needs to tell the entry where to find the uploaded file.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this with &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot;&gt;setContentFromPost()&lt;/a&gt; if you want all custom field values in the POST data to be assigned to the entry automatically, or &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentPostLocation-detail&quot;&gt;setContentPostLocation()&lt;/a&gt; if you want to assign the custom field values to the entry manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;setContentFromPost() example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'My New Entry';&#xA;&#xA;// Look through $_POST['fields'] for any custom field values&#xA;// and assign them to the entry's content automatically&#xA;$entry-&amp;gt;setContentFromPost('fields');&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;setContentPostLocation() example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'My New Entry';&#xA;&#xA;// Assign the custom field values manually&#xA;$entry-&amp;gt;getContent()-&amp;gt;summary = craft()-&amp;gt;request-&amp;gt;getPost('fields.summary');&#xA;$entry-&amp;gt;getContent()-&amp;gt;body = craft()-&amp;gt;request-&amp;gt;getPost('fields.body');&#xA;&#xA;// Tell the entry where these custom fields are coming from in the POST data&#xA;// so that the Assets field will know where to look for an uploaded file&#xA;$entry-&amp;gt;setContentPostLocation('fields');&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can manually store the uploaded file into an asset folder using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#insertFileByLocalPath-detail&quot;&gt;AssetsService::insertFileByLocalPath()&lt;/a&gt;, get the resulting file ID, and assign that file ID directly onto the Assets field.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$fileIds = array();&#xA;&#xA;$uploadedFile = UploadedFile::getInstanceByName('fields.myAssetsFieldHandle');&#xA;&#xA;if ($uploadedFile)&#xA;{&#xA;    $response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;        $uploadedFile-&amp;gt;tempName,&#xA;        $uploadedFile-&amp;gt;name,&#xA;        $folderId,&#xA;        AssetConflictResolution::KeepBoth&#xA;    );&#xA;&#xA;    if ($response-&amp;gt;isSuccess())&#xA;    {&#xA;        $fileIds[] = $response-&amp;gt;getDataItem('fileId');&#xA;    }&#xA;}&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'My New Entry';&#xA;&#xA;// Assign the custom field values manually&#xA;$entry-&amp;gt;getContent()-&amp;gt;summary = craft()-&amp;gt;request-&amp;gt;getPost('fields.summary');&#xA;$entry-&amp;gt;getContent()-&amp;gt;body = craft()-&amp;gt;request-&amp;gt;getPost('fields.body');&#xA;$entry-&amp;gt;getContent()-&amp;gt;myAssetsFieldHandle = $fileIds;&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in this approach, the name of the file input doesn’t matter, since you’re the one that’s telling UploadedFile where to look for it in $_FILES.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-16T13:30:51.463" LastActivityDate="2014-10-16T13:30:51.463" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4178" PostTypeId="1" AcceptedAnswerId="4179" CreationDate="2014-10-16T15:42:29.733" Score="1" ViewCount="190" Body="&lt;p&gt;This is a head scratcher. We have a site we are about to launch that was ready to go when suddenly at some point in the day yesterday a bunch of Matrix fields within a group went missing. Just gone. Of course this broke the site and our templates started erroring out. Our first instinct was that they were manually deleted but the client is saying that they didn't touch the fields area. We also talked to the web host / Arcustech and they said that everything looked fine on their end. We had to restore the database which was a bummer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, could this have been due to a recent bug? Is there a way we can see what fields get deleted via the logs? It's really bothering us that we can't pinpoint exactly what happened here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention we were on 2.2.2592 when this happened. Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="405" LastEditorUserId="405" LastEditDate="2014-10-16T15:48:11.450" LastActivityDate="2014-10-16T16:03:15.897" Title="Missing matrix fields" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2014-10-16T17:45:06.363" ContentLicense="CC BY-SA 3.0" />
  <row Id="4179" PostTypeId="2" ParentId="4178" CreationDate="2014-10-16T16:03:15.897" Score="1" Body="&lt;p&gt;Nothing in Craft will automatically delete Matrix fields, and there haven’t been any DB migrations that would have deleted an entire Matrix field. (There was a recent migration that deleted some orphaned Matrix block rows in the DB, but that would only have affected the data, not the fields themselves, and wouldn’t have made any noticeable change in the Control Panel.) Someone must have gone in and deleted the field, or changed its name/field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it happened recently enough, there might still be some evidence of it in your logs. We can take a look - just send in a ticket from your Dashboard and they will be included automatically.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-16T16:03:15.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4180" PostTypeId="2" ParentId="4176" CreationDate="2014-10-16T16:57:06.810" Score="3" Body="&lt;p&gt;Sure thing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$groupRecord = FieldGroupRecord::model()-&amp;gt;with('fields')-&amp;gt;findById($groupId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will eager load the related data from the &quot;fields&quot; table with the &quot;fieldgroups&quot; table.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-16T16:57:06.810" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4181" PostTypeId="1" CreationDate="2014-10-16T17:11:28.477" Score="1" ViewCount="53" Body="&lt;p&gt;When including inline assets inside a rich text field is there a way to do trigger image transformations to include a different version of the photos that are embedded (thumbnail, resized etc.)?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-10-16T17:11:28.477" Title="Image transformations inside body field" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ClosedDate="2014-10-20T14:49:14.420" ContentLicense="CC BY-SA 3.0" />
  <row Id="4182" PostTypeId="1" AcceptedAnswerId="4184" CreationDate="2014-10-16T17:56:21.350" Score="4" ViewCount="987" Body="&lt;p&gt;We're considering using Craft for a new project. One of the features requested is to have a password protected area. Each user would have access to their own files only. So we'd need to be able to setup users and assign files to them. It also needs to be simple enough that the client could do this without our intervention. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty familiar with how I would do this with EE but wondered if/how it could be done with Craft. &lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-01-28T20:56:24.003" Title="Password protected area with unique files" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4183" PostTypeId="2" ParentId="4165" CreationDate="2014-10-16T18:21:46.643" Score="1" Body="&lt;p&gt;Sprout Forms works great for making fields required. It nicely places the error info on the page (if you have the error tags in place) without losing the form data. Slick!&lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2014-10-16T18:21:46.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4184" PostTypeId="2" ParentId="4182" CreationDate="2014-10-16T18:25:56.290" Score="11" Body="&lt;p&gt;It is very easy within your templates to define requirements for whether the page itself, or portions of the content are displayed, and/or route the user to another page if they do not meet the page requirements. For example, you can check whether the user is logged in, belongs to a particular group, is the author of the entry, has a specific permission (and even create your own permissions), and any combination of the above. Here are a few examples, but in general there is a lot flexibility here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;{% if craft.session.isLoggedIn %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;{% if currentUser.isInGroup( group ) %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;{% if currentUser.id == entry.author.id %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;{# custom permission #}&#xA;{% if currentUser.can('viewContent') %} &#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When retrieving entries using &lt;code&gt;ElementCriteriaModel&lt;/code&gt; you can also find by author, group, relatedTo, etc. so that you can only show the user links to entries that they have access to. To find entries where the author is the currentUser, for example, you could use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').authorId(currentUser.id).find() %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to let the site admins assign user(s) to articles on an article-by-article basis independent of author, you could also use an &lt;code&gt;entries&lt;/code&gt; fieldtype to create a relationship to user(s), and then find entries using the &lt;code&gt;relatedTo&lt;/code&gt; method. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').relatedTo(currentUser).find() %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same  technique can be applied to assets (i.e. pdf files) just as easily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information have a look at the documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;noreferrer&quot;&gt;UserModel&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.session&quot; rel=&quot;noreferrer&quot;&gt;craft.session&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.users&quot; rel=&quot;noreferrer&quot;&gt;craft.users&lt;/a&gt;, and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-28T20:56:24.003" LastActivityDate="2015-01-28T20:56:24.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4185" PostTypeId="2" ParentId="2668" CreationDate="2014-10-16T18:29:29.120" Score="1" Body="&lt;p&gt;If you want to customize the image transforms from your templates, you’re going to be better off using a Matrix field instead. You can give the field two block types, “Text” and “Image”, with Rich Text and Assets sub-fields, respectively. Then from your templates, you will have full control over the images’ dimensions when they are output.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-16T18:29:29.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4186" PostTypeId="1" AcceptedAnswerId="4187" CreationDate="2014-10-16T18:35:07.193" Score="1" ViewCount="532" Body="&lt;p&gt;Just wondering how to pull content from a matrix field on my homepage into another .html file. Basically taking the content from a single and placing it into a different template. This is what I have so far: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in entry.homepage %}&#xA;    {% for block in entry.aloneImages %}&#xA;        {% for asset in block.image %}&#xA;              &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt; &amp;lt;br /&amp;gt;&#xA;        {% endfor %}&#xA;        {{ block.source }}&#xA;        {{ block.credit }}&#xA;     {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="478" LastActivityDate="2014-10-16T18:38:56.733" Title="Pulling in matrix fields from a Single onto a different page" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4187" PostTypeId="2" ParentId="4186" CreationDate="2014-10-16T18:38:56.733" Score="5" Body="&lt;p&gt;You just need to define &lt;code&gt;entry&lt;/code&gt;, which can be done with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;noreferrer&quot;&gt;craft.entries&lt;/a&gt; the same way you’d fetch any other entry(s).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.section('homepage').first() %}&#xA;&#xA;{% for block in entry.aloneImages %}&#xA;    {# ... #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-16T18:38:56.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4188" PostTypeId="1" AcceptedAnswerId="4189" CreationDate="2014-10-16T18:57:36.360" Score="0" ViewCount="318" Body="&lt;p&gt;When entries with plugins custom fields are saved as a draft, the data previously entered in the custom field is not visible. It is saved in the database but doesn't show in the edit screen.  The data will show in the fields when the entry is published. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {{ forms.dateTimeField({&#xA;    label: &quot;Start Date&quot;|t,&#xA;    instructions: &quot;When should the event start?&quot;|t,&#xA;    id: 'eventStartDate',&#xA;    name: name~'[startDate]',&#xA;    value: (fieldData ? fieldData.startDate : null),&#xA;    errors:''&#xA;  }) }}&#xA;  {{ forms.dateTimeField({&#xA;    label: &quot;End Date&quot;|t,&#xA;    instructions: &quot;When should the event end?&quot;|t,&#xA;    id: 'eventEndDate',&#xA;    name: name~'[endDate]',&#xA;    value: (fieldData ? fieldData.endDate : null),&#xA;    errors: ''&#xA;  }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a different way to output the data to the template so it shows in both?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-10-22T14:28:58.230" Title="My plugin's custom fields don't show values when entry saved as draft" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4189" PostTypeId="2" ParentId="4188" CreationDate="2014-10-16T20:19:19.937" Score="3" Body="&lt;p&gt;When you save a draft, all of the fields’ POST data is saved in the craft_entrydrafts table, exactly as it showed up in POST. When the draft is loaded, it’s that raw POST data that is passed to your field type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#getInputHtml-detail&quot; rel=&quot;nofollow&quot;&gt;getInputHtml()&lt;/a&gt; method - not whatever the field type would have returned in &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#prepValueFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;prepValueFromPost()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your getInputHtml() method just needs to be aware that there’s a chance that the $value passed to it may be raw POST data, and react accordingly in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your field type is storing dates and you’re using Craft’s built-in date/time templates (&lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms/date.html&quot; rel=&quot;nofollow&quot;&gt;_includes/forms/date.html&lt;/a&gt; and &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms/time.html&quot; rel=&quot;nofollow&quot;&gt;_includes/forms/time.html&lt;/a&gt;, which are rendered by that &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms.html#L132&quot; rel=&quot;nofollow&quot;&gt;dateTimeField()&lt;/a&gt; macro in _includes/forms.html), then the POST data will look like this, for whatever input name you passed in.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;array(&#xA;    'date' =&amp;gt; '[localized date string]',&#xA;    'time' =&amp;gt; '[localized time string]'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That looks like it would be tricky to deal with. Thankfully, Craft’s DateTime class has a handy-yet-awkwardly-named &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/dates/DateTime#createFromString-detail&quot; rel=&quot;nofollow&quot;&gt;createFromString()&lt;/a&gt; static method which will check to see if a passed-in value follows that array format, and normalize it into an actual DateTime object for you, taking the localized date/time formats and timezones into account for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all you need to do, from your get field type’s getInputHtml() and prepValueFromPost() methods, is check to see if $value['startDate'] and $value['endDate'] are arrays, and if so, run them through DateTime::createFromString().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We happen to have an existing field type that does the same thing: &lt;a href=&quot;https://github.com/pixelandtonic/StoreHours&quot; rel=&quot;nofollow&quot;&gt;Store Hours&lt;/a&gt;. Rather than dealing with just two dates per field, it's actually dealing with with 14 (an Open and Close time for each day of the week), but it should be easy enough to adapt its code for your needs. Here’s its field type file: &lt;a href=&quot;https://github.com/pixelandtonic/StoreHours/blob/master/storehours/fieldtypes/StoreHoursFieldType.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/StoreHours/blob/master/storehours/fieldtypes/StoreHoursFieldType.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-22T14:28:58.230" LastActivityDate="2014-10-22T14:28:58.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4190" PostTypeId="2" ParentId="629" CreationDate="2014-10-16T21:48:57.093" Score="2" Body="&lt;p&gt;@pixelJitsu said &quot;Couldn't you just delete the entry type and re add it?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Anna_MediaGirl replied, &quot;Might work. Want to test? But not on a live site:)&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just tested this on a dev site. Craft asked me if I was sure I wanted to delete the entry type and &quot;all entries that use it&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Poof, they all disappeared from the dashboard.&lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2014-10-16T21:48:57.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4191" PostTypeId="1" CreationDate="2014-10-16T22:55:14.557" Score="2" ViewCount="249" Body="&lt;p&gt;I have a site that's mostly 'static' content pages, with a few dynamic &amp;amp; more complicated pages mixed in.  To make editing &amp;amp; setting up the navigation easy, I started by creating a Structure that holds all the entries in my Pages section.  Let's say that structure looks something like this -&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;About&#xA;&lt;ul&gt;&#xA;&lt;li&gt;People&lt;/li&gt;&#xA;&lt;li&gt;History&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Products&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product A&lt;/li&gt;&#xA;&lt;li&gt;Product B&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's more complicated, but just a longer version of that.  This structure is used to generate my navigation for the site, and everything is working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, all my content pages are in place and I need to add the 1-offs.  The first is a contact page, which is going to live @ /about/contact.  I'd like to place it within the structure because otherwise my navigation becomes a lot more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, it draws from a different template than my normal content pages, and a structure can only pull from a single template regardless of what sections are listed in it.  Ok, I thought, I could put the entry into that structure and then use a route to direct that page to the template I want to use.  That doesn't work, however, because page URI's are processed before routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the question is - what am I missing about doing this?  Is there a better way to set up what I'm doing?&lt;/p&gt;&#xA;" OwnerUserId="638" LastActivityDate="2014-10-16T23:08:56.353" Title="Working with Structure &amp; Multiple Pagetypes" Tags="&lt;structure&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4192" PostTypeId="2" ParentId="4191" CreationDate="2014-10-16T23:04:23.843" Score="4" Body="&lt;p&gt;Assuming that those pages are working off of different &lt;strong&gt;entry types&lt;/strong&gt;, you should check out this great help article...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;How can I give each Entry Type its own template?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, you let a parent template decide which child template to load, based on the current entry type.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-16T23:04:23.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4193" PostTypeId="2" ParentId="4191" CreationDate="2014-10-16T23:08:56.353" Score="1" Body="&lt;p&gt;Entry types is probably the way to go but you could also check advanced routing - &lt;a href=&quot;http://buildwithcraft.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/routing#advanced-routing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2014-10-16T23:08:56.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4194" PostTypeId="1" CreationDate="2014-10-16T23:42:10.713" Score="0" ViewCount="690" Body="&lt;p&gt;I have my first craft website all working great on my local dev server and want to move it to the production server. I think I went about this the wrong way but I installed a fresh install of craft on the pro server then purchased a pro license.key. This all installed OK. This is the same root level structure as the local dev version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made sure both sites were upto date then copied over my database dump from dev and uploaded my templates. However this has broken the URLs (the home page loads). Have I missed something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The production server doesn't have the domain pointing at it but can be view via the IP like so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://79.170.40.48/mydomain.co.uk/&lt;/code&gt;    &amp;lt;-- though it does require the trailing lash&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The odd bit is if I visit the link &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://79.170.40.48/mydomain.co.uk/products&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the browser address bar says &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://79.170.40.48/mydomain.co.uk/products&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the apache error says the requested URL is&#xA;&lt;code&gt;/home/sites/mydomain.co.uk/public_html/index.php&lt;/code&gt; was not found on this server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And curiously the &lt;code&gt;/home/sites/&lt;/code&gt; address is what my my local dev path is. So where is the remote product install getting this from?&lt;/p&gt;&#xA;" OwnerUserId="905" LastEditorUserId="250" LastEditDate="2014-10-17T15:06:43.573" LastActivityDate="2014-10-17T15:06:43.573" Title="Where are all the references to the URL stored?" Tags="&lt;url&gt;&lt;install&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4195" PostTypeId="2" ParentId="4194" CreationDate="2014-10-17T08:27:43.707" Score="1" Body="&lt;p&gt;Craft makes it easy to handle multiple environments, but you need to make it aware about the differences. Usually it's smart enough to enough to know the base folder path that you have it hosted in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also smart enough to usually which url's you want. Sometimes it doesn't properly remove index.php from the URL, and that you can manually override with the setting &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;omitScriptNameInUrls&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your public folder is named &lt;strong&gt;public_html&lt;/strong&gt;, it's not clear from your question if you are running with the standard folder structure (index.php located in public folder, $craftPath inside index.php pointing to &lt;strong&gt;craft/&lt;/strong&gt; folder one level above public folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, you should have a look at the documentation regarding multi-environment configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one other area where it's usually necessary to set environment specific settings is Asset sources: Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;chapter on that in the docs&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2014-10-17T10:07:52.150" LastActivityDate="2014-10-17T10:07:52.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4196" PostTypeId="1" AcceptedAnswerId="4198" CreationDate="2014-10-17T12:55:31.643" Score="3" ViewCount="499" Body="&lt;p&gt;I'm trying to build what's basically a blog page, but spread throughout the posts we want some of our tweets as well. Obviously we have the entries from Craft, and I've found this &lt;a href=&quot;https://dukt.net/craft/twitter&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; which I can use to pull in our tweets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can I merge our entries and tweets and order them by date? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of creating an array with the entries, then pulling in the tweets and merging them into the array and then ordering them by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="906" LastActivityDate="2014-10-17T15:54:57.253" Title="Entries &amp; Twitter Posts" Tags="&lt;entries&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4197" PostTypeId="1" AcceptedAnswerId="4202" CreationDate="2014-10-17T13:17:57.140" Score="1" ViewCount="604" Body="&lt;p&gt;I'm setting up a site for a charity with a national branch and several sub-chapters. I'd like users of a particular chapter to be able to add/modify users, but only within their chapter's user group. It seems like with the current structure of admin permissions, I'm only able to say whether or not a user can add/edit users, and not restrict that to a particular group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible and I'm just not seeing a setting somewhere? If not, does anyone know of a plugin that provides this functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2014-10-17T18:04:31.653" Title="Restrict user editing permissions within a user's group?" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4198" PostTypeId="2" ParentId="4196" CreationDate="2014-10-17T15:54:57.253" Score="5" Body="&lt;p&gt;I finally got this working, here is how, I'm sure there is a better way or ways I can improve, but for now it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we need to create an empty array like so...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set posts = [] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then we need to loop through the entries, and for each entry create an array containing the &lt;code&gt;entry.postDate&lt;/code&gt; and the entry data. We then need to push that &lt;code&gt;entry&lt;/code&gt; array into the main &lt;code&gt;posts&lt;/code&gt; array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(10) %}&#xA;&#xA;    {#-- We store the date reference for our custom sort function, and the entry data --#}&#xA;    {% set entry = [{&#xA;        'date': entry.postDate,&#xA;        'data': entry&#xA;    }] %}&#xA;&#xA;    {#-- Now we push that entry array into the posts array --#}&#xA;    {% set posts = posts|merge(entry) %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now we've got an array containing just our craft entries. Next we need to install the Dukt &lt;a href=&quot;https://dukt.net/craft/twitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twitter plugin&lt;/a&gt; and the Dukt &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow noreferrer&quot;&gt;oAuth Plugin&lt;/a&gt;. Set them both up via the documentation and then we move on to the next step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now need to pull in our tweets, which with these two plugins is surprisingly easy. It looks pretty much the same as the above chunk of code, except we're executing a GET request to Twitter instead of pulling in the entries from Craft. Also, because the tweets &lt;code&gt;created_at&lt;/code&gt; variable is formatted in a non-standard way, we need to reformat it into the same format as the craft entry date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tweetRef in craft.twitter.get('statuses/user_timeline', {&#xA;    count: 10,&#xA;}) %}&#xA;&#xA;    {% set tweet = [{&#xA;        'date': tweetRef.created_at|date('Y-m-d'),&#xA;        'data': tweetRef&#xA;    }] %}&#xA;    {% set posts = posts|merge(tweet) %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now, our posts array contains both our entries and tweets, but not in date order. With a bit of research I discovered &lt;a href=&quot;https://craftcms.stackexchange.com/questions/870/sort-merged-array-by-array-value-in-twig&quot;&gt;this post&lt;/a&gt; which explains Twig can't sort multi-dimensional arrays. Luckily @victor_in in that post provided a solution. He has developed a plugin with improves twigs sort functionality. So download his plugin, then as he mentioned, modify the plugin to add the custom sort function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the custom sort function that I used. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function sortByDate($a, $b)&#xA;{&#xA;    return strtotime($a['date']) &amp;lt; strtotime($b['date']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I should also note that Craft was giving me an error with &lt;code&gt;array('TwigBetterSortTwigExtension', 'sortByDate')&lt;/code&gt; saying the class 'TwigBetterSortTwigExtension' not being found. I fixed this by replacing it with &lt;code&gt;array(__CLASS__, 'sortByDate')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, we can loop through our posts array using the custom sort filter to order them by the date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in posts|sort('dateSort') %}&#xA;    {{ entry.date }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="906" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-10-17T15:54:57.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4199" PostTypeId="1" CreationDate="2014-10-17T15:54:59.977" Score="0" ViewCount="94" Body="&lt;p&gt;I recently switched host to DigitalOcean and also moved my assets onto S3. The system is freezing when I upload an asset which seems to be 1mb or over, I have altered my php.ini file to make sure this wasn't the culprit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an issue with some images appearing and others not. I'm getting this message when looking at some files&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This XML file does not appear to have any style information associated with it. The &gt;document tree is shown below.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I add a policy statement this seems to disappear but I'm not sure if this was even required, hard to see how other files are showing up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In craft_assetsources I have the following which still seems to carry the old url??&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;path&quot;:&quot;images\/ads\/&quot;,&quot;url&quot;:&quot;http:\/\/digbmx.com\/images\/ads\/&quot;,&quot;keyId&quot;:&quot;AKIAJCJA6QHXEOAZ2LMA&quot;,&quot;secret&quot;:&quot;EDGceqipqQOSqM7ItU8L52oT+ZjQD+pnK\/Z+30gW&quot;,&quot;bucket&quot;:&quot;digbmx&quot;,&quot;subfolder&quot;:&quot;ads\/&quot;,&quot;urlPrefix&quot;:&quot;http:\/\/s3-eu-west-1.amazonaws.com\/digbmx\/&quot;,&quot;expires&quot;:&quot;&quot;,&quot;location&quot;:&quot;eu-west-1&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help on these issues would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Dc&lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-10-17T15:54:59.977" Title="Assets not uploading to S3" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2014-10-21T19:17:50.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="4200" PostTypeId="1" CreationDate="2014-10-17T17:43:09.450" Score="1" ViewCount="49" Body="&lt;p&gt;I'm trying to get only entries with added thumbnail (Assets field with handle 'thumbnail'). Is there a way to check this in this query?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').limit(4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="809" LastActivityDate="2014-10-17T17:43:09.450" Title="Pulling entries that have a thumbnail image?" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2014-10-18T05:31:02.067" ContentLicense="CC BY-SA 3.0" />
  <row Id="4201" PostTypeId="1" AcceptedAnswerId="4203" CreationDate="2014-10-17T17:52:11.543" Score="2" ViewCount="1352" Body="&lt;p&gt;When a user registers on the front-end of our site, we'd like the default behavior be that when they click on the confirmation link in the email they receive, they are automatically logged in and taken to a &quot;My Account&quot; page that we've created. Is this possible? Right now, they're redirected to the home page, and it doesn't appear that they're logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We updated the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#postLoginRedirect&quot; rel=&quot;nofollow&quot;&gt;postLoginRedirect&lt;/a&gt; variable in our config to the My Account page, but that didn't seem to do the trick.&lt;/p&gt;&#xA;" OwnerUserId="725" LastActivityDate="2014-10-17T19:24:10.100" Title="How to Redirect After Successful Registration Confirmation" Tags="&lt;users&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4202" PostTypeId="2" ParentId="4197" CreationDate="2014-10-17T18:04:31.653" Score="2" Body="&lt;p&gt;This is not currently possible through the CP (as far as I know anyway). You would need to write a plugin; and I haven't seen any plugins on &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;straightupcraft&lt;/a&gt; that address this particular need, but have a look. You could also contact someone through the &lt;a href=&quot;http://straightupcraft.com/professionals&quot; rel=&quot;nofollow&quot;&gt;professionals&lt;/a&gt; section that might be able to help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to write your own plugin you might have a look at the documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;hooks and events&lt;/a&gt;. In particular the &lt;code&gt;onSaveUser&lt;/code&gt; event, where you could potentially force a user into a particular group, based on specific conditions that you establish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugIns &lt;code&gt;init&lt;/code&gt; function you could create a listener for the &lt;code&gt;onSaveUser&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) &#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        if ($allMyConditionsAreMet) &#xA;        {&#xA;            if($allMyGroupConditionsAreMet) &#xA;            {&#xA;                $groupId = 1;&#xA;            } &#xA;            else &#xA;            {&#xA;                $groupId = 2;&#xA;            }&#xA;            craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;        };&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-17T18:04:31.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4203" PostTypeId="2" ParentId="4201" CreationDate="2014-10-17T18:14:53.417" Score="4" Body="&lt;p&gt;The config settings you're looking for are probably '&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#activateAccountSuccessPath&quot; rel=&quot;nofollow&quot;&gt;activateAccountSuccessPath&lt;/a&gt;' and '&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#autoLoginAfterAccountActivation&quot; rel=&quot;nofollow&quot;&gt;autoLoginAfterAccountActivation&lt;/a&gt;'.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-17T19:24:10.100" LastActivityDate="2014-10-17T19:24:10.100" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4205" PostTypeId="1" AcceptedAnswerId="4240" CreationDate="2014-10-18T07:58:08.730" Score="2" ViewCount="1242" Body="&lt;p&gt;I'd like to create some tabs on a page, and the content inside each tab. The thing is, inside one tab you will have 3 columns which would have a title/body in little sections for each column. Then in another tab you'll have a masonry list so a title and then a bunch of spans repeated. Another tab might be a body field and an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can see there is repeating content inside each tab and you can't have a matrix in a matrix as far as I can see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would those more experienced approach it? Am I overthinking it? I'd like something that is easy for the customer (of course!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated with diagram and what I had in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://docs.google.com/drawings/d/1p13Scv7sDyxg1feIef1p4yhBYHoya9VncUCp0YO3oAg/pub?w=1440&amp;amp;h=1080&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IAI18.png&quot; alt=&quot;Inside Craft&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="872" LastEditDate="2014-10-19T02:02:30.683" LastActivityDate="2016-12-22T07:24:04.090" Title="Advanced layout: Best way to create a tabbed page with variable content in each tab" Tags="&lt;content&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4206" PostTypeId="1" AcceptedAnswerId="4207" CreationDate="2014-10-18T08:52:51.973" Score="1" ViewCount="213" Body="&lt;p&gt;Is there a way to use Craft javascript API to fetch all Matrix rows of a specific field on the entry edit page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, could that be added? Would be useful, for example in terms of fetching the handle/id and using that in the frontend to simulate Matrix inside Matrix.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2014-10-18T09:55:32.680" Title="Fetching Matrix rows with Javascript" Tags="&lt;matrix&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4207" PostTypeId="2" ParentId="4206" CreationDate="2014-10-18T09:55:32.680" Score="1" Body="&lt;p&gt;The Craft.MatrixInput class that manages each Matrix field doesn’t actually get assigned to a variable, so there’s no way to reference it right now. We probably won’t change that, since there wouldn’t be much point to it in the first place. The class doesn’t provide any sort of object-oriented API for managing the blocks; there’s no need for it in the current implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get a reference to all the blocks’ containers, you can just use a jQuery selector:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var $blocks = $('#fields-myMatrixField &amp;gt; .blocks &amp;gt; div');&#xA;&#xA;$blocks.each(function() {&#xA;    var $block = $(this),&#xA;        id = $block.data('id');&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-18T09:55:32.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4208" PostTypeId="1" CreationDate="2014-10-18T17:53:39.553" Score="1" ViewCount="448" Body="&lt;p&gt;I have a plugin and I want it to move some files into a system asset source.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a dropdown to select the folder which gets its options like this and shows a dropdown to select a folder Id.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;      $sourceIds = craft()-&amp;gt;assetSources-&amp;gt;getAllSourceIds();&#xA;      $tree = craft()-&amp;gt;assets-&amp;gt;getFolderTreeBySourceIds($sourceIds);&#xA;&#xA;      return craft()-&amp;gt;templates-&amp;gt;render('backups/_settings', array(&#xA;          'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;          'tree' =&amp;gt; $tree&#xA;      ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so in my controller what i want to do is copy a file into that folder?  I have the full path to the file but not sure where to go from there?  Ideally it wouldn't matter if it were local storage or cloud storage it would just move it but I'm a little dumbfounded?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt;: So I found this method in the Assets Service &lt;code&gt;insertFileByLocalPath()&lt;/code&gt; which seems exactly what i needed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath($backupsPath, $fileName, $folderId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which starts to work but i keep getting &lt;code&gt;S3::putObject(): [RequestTimeout] Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.&lt;/code&gt;??&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2014-10-21T01:05:42.017" LastActivityDate="2018-07-05T16:22:44.270" Title="Can plugin copy file into an asset source?" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4209" PostTypeId="1" CreationDate="2014-10-19T05:55:06.160" Score="2" ViewCount="443" Body="&lt;p&gt;While logged into the Control Panel, you can edit your account information. When you try to change your email address or password, Craft asks you to enter your current password (for security reasons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to borrow this password confirmation security feature?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've built a form which is very powerful and contains sensitive data. I want the user to be triple-sure that they want to submit the form... Forcing users to re-enter their password seems like a good way to minimize accidents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C0NwM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-19T21:18:55.673" Title="How can I use the password confirmation modal on other forms?" Tags="&lt;plugin-development&gt;&lt;password&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4210" PostTypeId="1" AcceptedAnswerId="4222" CreationDate="2014-10-19T08:40:19.420" Score="0" ViewCount="298" Body="&lt;p&gt;I am trying to use the &lt;a href=&quot;http://alecritson.co.uk/projects/placid&quot; rel=&quot;nofollow&quot;&gt;Placid plugin&lt;/a&gt; to retrieve track-names from an external service, and having problems. I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for song in craft.entries.section('music') %}&#xA;  {% set params = { 'id' : song.itunesId } %}&#xA;  {% set lookup = craft.placid.get('itunesMusic', { params : params } ) %}&#xA;&#xA;  {% for track in lookup.results %}&#xA;    {{ track.trackName }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The values of &lt;code&gt;song.itunesId&lt;/code&gt; and &lt;code&gt;params&lt;/code&gt; seem to be set correctly, however &lt;code&gt;lookup.results&lt;/code&gt; is returning the same &lt;code&gt;track.trackName&lt;/code&gt; on each iteration of the loop.&lt;/p&gt;&#xA;" OwnerUserId="862" LastEditorUserId="784" LastEditDate="2014-10-19T19:26:25.800" LastActivityDate="2014-10-20T12:02:34.717" Title="Variables not iterating in for loop" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4211" PostTypeId="1" AcceptedAnswerId="4239" CreationDate="2014-10-19T12:36:07.003" Score="0" ViewCount="302" Body="&lt;p&gt;I have a structure with 1 main Entry and 3 descendants underneath it but I have trouble accessing the data in matrix fields in the entries. I'm trying to do this all on one page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tabs = entry.descendants %}&#xA;     {% for tab in tabs %}&#xA;          {{ tab.title }}&#xA;     {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get as far as the tab title, and it displays fine. But I want to access the matrix fields in the descendants. Here are the blocks in my field with the handle 'tab'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dzkAU.png&quot; alt=&quot;Blocks&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to summarise, I have a structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/03WvP.png&quot; alt=&quot;Structure&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I want to use all those descendant data all one one page but I'm having trouble accessing it.&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2014-10-20T23:55:40.823" Title="Accessing structure descendants data" Tags="&lt;matrix&gt;&lt;structure&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4212" PostTypeId="1" AcceptedAnswerId="4213" CreationDate="2014-10-19T15:04:25.443" Score="1" ViewCount="180" Body="&lt;p&gt;So I hope I am explaining this correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some entries with a tag called 'hidden'. In my blog layout I want to exclude those entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.name('hidden') %}&#xA;{% set hiddenentry = craft.entries.section('blog').relatedTo(tag).find() %}&#xA;{% set allentry = craft.entries.section('blog').limit(5).find() %}&#xA;{% set unhidden = allentry|without(hiddenentry) %}&#xA;&#xA;{% for entry in unhidden %}&#xA;    &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p class=&quot;date&quot;&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;            {{ entry.body.getPage(1) }}&#xA;            {# {{ entry.summary }} #}&#xA;            &amp;lt;button&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="753" LastEditorUserId="57" LastEditDate="2014-10-19T15:13:34.800" LastActivityDate="2014-10-19T18:13:57.423" Title="List all entries except 'hidden'" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4213" PostTypeId="2" ParentId="4212" CreationDate="2014-10-19T18:13:57.423" Score="1" Body="&lt;p&gt;Not really the answer you are looking for, but it might be easier to change the tag &lt;code&gt;hidden&lt;/code&gt; to a checkbox or lightswitch field and add a condition to the &lt;code&gt;for..in&lt;/code&gt; loop, as explained in the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow&quot;&gt;twig documentation&lt;/a&gt;, which may do what you need and keep the query count lower.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in allEntries if not entry.hidden %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-19T18:13:57.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4214" PostTypeId="1" CreationDate="2014-10-19T20:35:40.140" Score="2" ViewCount="124" Body="&lt;p&gt;Does Craft have a bookmarklet that allows you to quickly post images, text, videos or any other content from web pages to Craft entry types/fields?&lt;/p&gt;&#xA;" OwnerUserId="687" LastEditorUserId="687" LastEditDate="2014-10-19T21:04:42.300" LastActivityDate="2014-11-19T02:01:00.827" Title="Does Craft have a bookmarklet to quickly post/save content from the web?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4215" PostTypeId="2" ParentId="4209" CreationDate="2014-10-19T21:18:55.673" Score="1" Body="&lt;p&gt;I copied and modified the built-in craft &lt;code&gt;AccountSettingsForm.js&lt;/code&gt; and placed it in my own plugin to test and it seems to work great. You will need to adapt it for your own use of course. It is currently triggered on elements that have a class 'btn confirm', and just prints 'Password Confirmed!' on success to the alert window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a button in your plugins CP template file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;submit&quot; class=&quot;btn confirm small submit&quot; value=&quot;{{ 'Confirm'|t }}&quot; &amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And include the new js file &lt;code&gt;PasswordConfirmation.js&lt;/code&gt;, which is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($) {&#xA;&#xA;PasswordConfirmation = Garnish.Base.extend(&#xA;{&#xA;    isCurrent: null,&#xA;&#xA;    $lockBtns: null,&#xA;    $currentPasswordInput: null,&#xA;    $spinner: null,&#xA;&#xA;    modal: null,&#xA;&#xA;    init: function(isCurrent)&#xA;    {&#xA;        this.isCurrent = isCurrent;&#xA;        this.$lockBtns = $('.btn.confirm');&#xA;        this.addListener(this.$lockBtns, 'click', 'showCurrentPasswordForm');&#xA;    },&#xA;&#xA;    showCurrentPasswordForm: function()&#xA;    {&#xA;        if (!this.modal)&#xA;        {&#xA;            var $form = $('&amp;lt;form id=&quot;verifypasswordmodal&quot; class=&quot;modal fitted&quot;/&amp;gt;').appendTo(Garnish.$bod),&#xA;                $body = $('&amp;lt;div class=&quot;body&quot;&amp;gt;&amp;lt;p&amp;gt;'+Craft.t(this.isCurrent ? 'Please enter your current password.' : 'Please enter your password.')+'&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;').appendTo($form),&#xA;                $passwordWrapper = $('&amp;lt;div class=&quot;passwordwrapper&quot;/&amp;gt;').appendTo($body),&#xA;                $buttons = $('&amp;lt;div class=&quot;buttons right&quot;/&amp;gt;').appendTo($body),&#xA;                $cancelBtn = $('&amp;lt;div class=&quot;btn&quot;&amp;gt;'+Craft.t('Cancel')+'&amp;lt;/div&amp;gt;').appendTo($buttons),&#xA;                $submitBtn = $('&amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;'+Craft.t('Continue')+'&quot; /&amp;gt;').appendTo($buttons);&#xA;&#xA;            this.$currentPasswordInput = $('&amp;lt;input type=&quot;password&quot; class=&quot;text password fullwidth&quot;/&amp;gt;').appendTo($passwordWrapper);&#xA;            this.$spinner = $('&amp;lt;div class=&quot;spinner hidden&quot;/&amp;gt;').appendTo($buttons);&#xA;            this.modal = new Garnish.Modal($form);&#xA;&#xA;            new Craft.PasswordInput(this.$currentPasswordInput, {&#xA;                onToggleInput: $.proxy(function($newPasswordInput) {&#xA;                    this.$currentPasswordInput = $newPasswordInput;&#xA;                }, this)&#xA;            });&#xA;&#xA;            this.addListener($cancelBtn, 'click', function() {&#xA;                this.modal.hide();&#xA;            });&#xA;&#xA;            this.addListener($form, 'submit', 'submitCurrentPassword');&#xA;        }&#xA;        else&#xA;        {&#xA;            this.modal.show();&#xA;        }&#xA;&#xA;        // Auto-focus the password input&#xA;        if (!Garnish.isMobileBrowser(true))&#xA;        {&#xA;            setTimeout($.proxy(function() {&#xA;                this.$currentPasswordInput.focus();&#xA;            }, this), 100);&#xA;        }&#xA;    },&#xA;&#xA;    submitCurrentPassword: function(ev)&#xA;    {&#xA;        ev.preventDefault();&#xA;&#xA;        var password = this.$currentPasswordInput.val();&#xA;&#xA;        if (password)&#xA;        {&#xA;            this.$spinner.removeClass('hidden');&#xA;&#xA;            var data = {&#xA;                password: password&#xA;            };&#xA;&#xA;            Craft.postActionRequest('users/verifyPassword', data, $.proxy(function(response, textStatus)&#xA;            {&#xA;                this.$spinner.addClass('hidden');&#xA;&#xA;                if (textStatus == 'success')&#xA;                {&#xA;                    if (response.success)&#xA;                    {&#xA;                        alert('Password Confirmed!');&#xA;&#xA;                        this.modal.hide();&#xA;&#xA;                    }&#xA;                    else&#xA;                    {&#xA;                        Garnish.shake(this.modal.$container);&#xA;                    }&#xA;                }&#xA;&#xA;            }, this));&#xA;        }&#xA;    }&#xA;&#xA;});&#xA;&#xA;new PasswordConfirmation;&#xA;&#xA;})(jQuery)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The next step would be to make it more generic so that it returns true, or executes a callback method, so that the result function can be customized per-use, and perhaps improve the instantiation so that you can pass it your own jquery selectors.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-19T21:18:55.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4216" PostTypeId="2" ParentId="4214" CreationDate="2014-10-20T01:02:00.073" Score="1" Body="&lt;p&gt;Nothing from P&amp;amp;T and I haven't seen one floating around the web, either.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-20T01:02:00.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4217" PostTypeId="2" ParentId="1301" CreationDate="2014-10-20T02:30:28.727" Score="2" Body="&lt;p&gt;I did not have a lot of time to find a solution for this so I used a workaround maybe that can work for your case as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So firstly my case was such that I needed to have an entries field type that only the admin can edit for each user. It was NOT important in my case for the user (For whom the field is being edited) to see which entries are attached to his field in the backend control panel. I could show it to them in the front end. Hence what I did was I modified the entries fieldtype form template (Which is located at craft/app/templates/_includes/forms/elementSelect.html) and added two if statements. Firstly I added an if statement to check the name of the field and then another if to show or hide the add entry button. Hence if my entry name is userSubscriptions then the html looked as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if name == 'userSubscriptions' %}&#xA;    {% if currentUser == 'admin' %}&#xA;        &amp;lt;div class=&quot;btn add icon dashed&quot;&amp;gt;{{ addButtonLabel }}&amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% else %}&#xA;    &amp;lt;div class=&quot;btn add icon dashed&quot;&amp;gt;{{ addButtonLabel }}&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But obviously this is not the best way of doing it. Its just a temporary solution if you really need to do it fast. Im not sure if this could work with your fieldtype as well but thats my take on it. I will keep trying to find the correct way of doing this and if I manage to do it Ill let you know and if you manage to do it the other way then let me know how you did it. Thanks&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2014-10-20T02:30:28.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4218" PostTypeId="1" CreationDate="2014-10-20T08:16:26.953" Score="1" ViewCount="196" Body="&lt;p&gt;I have an external php app that sits in a subdirectory in the public folder on the same server (and domain) as craft. I am trying to use bootstrap.php to check the logged in status of the current user. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is currently working for me by checking that the user is logged in (it does return false while not logged in) - but after the user logs out of craft the bootstrap.php continues to return true that the user is logged in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require '../../craft/app/bootstrap.php';&#xA;if ($craft-&amp;gt;userSession-&amp;gt;isAdmin() &amp;amp;&amp;amp; $craft-&amp;gt;userSession-&amp;gt;isLoggedIn() ){&#xA; // this returns after a log in, but continues to be true after a log out. It does not return true initially before using both craft and this script.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully that makes sense, any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also could not get the onLogout or onBeforeLogout to execute. I see it is in the class reference, but not listed in the event documentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    craft()-&amp;gt;on('usersession.onLogout', function(Event $event) {&#xA;        echo &quot;THIS DOES NOT EXECUTE&quot;;&#xA;        die();&#xA;    });&#xA;&#xA;    parent::init();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible the log out event is not triggering?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-12-19T23:33:40.993" Title="log out being shared with bootstrap.php" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4219" PostTypeId="1" AcceptedAnswerId="4237" CreationDate="2014-10-20T09:08:31.253" Score="1" ViewCount="950" Body="&lt;p&gt;I have three sections:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Discography&lt;/li&gt;&#xA;&lt;li&gt;Performers&lt;/li&gt;&#xA;&lt;li&gt;Works&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Within &quot;Discography&quot;, a Matrix field contains related entries from &quot;Performers&quot; and from &quot;Works&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking to display those related entries in Discography with the code below, but nothing happens (no error, no display):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('Discography').order('title') %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;    {% for block in entry.discoOeuvres %}&#xA;&#xA;        {% set relatedWorks = craft.entries.section('Works').relatedTo(entry) %}&#xA;        {% set relatedPerformers = craft.entries.section('Performers').relatedTo(entry) %}&#xA;&#xA;        {% for work in relatedWorks %}&#xA;            {{ work.title }}&#xA;&#xA;            {% for performer in relatedPerformers %}&#xA;                {{ performer.title }}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also tried to follow &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2287/how-can-i-display-related-entries-selected-within-a-matrix-field&quot;&gt;this solution&lt;/a&gt;, with no success...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do I miss something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for helping.&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-20T23:09:39.127" Title="Related entries in Matrix field" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4220" PostTypeId="1" AcceptedAnswerId="13896" CreationDate="2014-10-20T10:37:02.353" Score="5" ViewCount="1118" Body="&lt;p&gt;I have a &quot;single&quot; entry which has a &quot;entries&quot; field. The related entries have a image field of the &quot;Assets&quot; type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template, i want to display the image from each of the related entries. I figured i could do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for relatedImage in entry.relatedImages %}&#xA;            {% for images in relatedImage %}&#xA;                &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ images.url }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Though not only does it not work, but it is probably pretty inefficient too. Whilst I'm here, how do people go about inspecting what you get from your vars? Is there a Twig/Craft equivalent to PHP's &lt;code&gt;var_dump('relatedImage')&lt;/code&gt;?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas most welcome!&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="57" LastEditDate="2016-02-25T17:41:47.800" LastActivityDate="2016-02-25T17:41:47.800" Title="Get image from related entries asset field" Tags="&lt;assets&gt;&lt;relations&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4221" PostTypeId="1" AcceptedAnswerId="4223" CreationDate="2014-10-20T11:45:41.453" Score="2" ViewCount="558" Body="&lt;p&gt;When using image transforms, Craft not only doesn't seem to be outputting the transformed image, but the image path it's then giving back to the template is: &lt;code&gt;&amp;lt;img src=&quot;http://example.com/cpresources/transforms/1&quot; /&amp;gt;&lt;/code&gt; which doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a upload path defined, which is &lt;code&gt;http://example.com/assets/uploads/&lt;/code&gt; but obviously it isn't respecting that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find any docs on where to define the transformations image path so wondered if anyone could shed some light?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2014-10-20T12:08:48.040" Title="Set transformations image path" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4222" PostTypeId="2" ParentId="4210" CreationDate="2014-10-20T12:02:34.717" Score="2" Body="&lt;p&gt;Thanks for giving Placid a try, sucks you have had issues using it. I understand you're using Guzzle now, but for future reference I think I know what was going on.&lt;/p&gt;&#xA;&lt;h2&gt;Caching&lt;/h2&gt;&#xA;&lt;p&gt;In this case you would need to turn caching off for the Placid request, this is due to you needing a new request for each iteration, I will be looking to improve the caching in the near future to be more intelligent but in the meantime just setting &lt;code&gt;{ cache: false }&lt;/code&gt; should fix this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for song in craft.entries.section('music') %}&#xA;  {% set params = { 'id' : song.itunesId } %}&#xA;   {% set lookup = craft.placid.get('itunesMusic', { params : params, cache: false } ) %}&#xA;   {% for track in lookup.results %}&#xA;    {{ track.trackName }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've set up an example so you can &lt;a href=&quot;http://alecritson.co.uk/documentation/placid/examples/itunes-track-info&quot; rel=&quot;nofollow noreferrer&quot;&gt;see it in action here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope that helps if you choose to use Placid again in the future!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-10-20T12:02:34.717" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4223" PostTypeId="2" ParentId="4221" CreationDate="2014-10-20T12:08:48.040" Score="4" Body="&lt;p&gt;Craft doesn't have a setting for defining the transformations image path, they are automatically placed in a subfolder inside your created assets source' path. It could look something like this &lt;code&gt;_960x540_crop_center-center_70&lt;/code&gt;, if you had a transform like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ width: 960, height: 540, mode: 'crop', position: 'center-center', quality: 70 }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default, the url you're seeing is what Craft will return if the transform hasn’t been generated yet. The next time the page is loaded, it should reference the actual image file. &lt;a href=&quot;https://craftcms.stackexchange.com/a/831/141&quot;&gt;See Brandon's answer here&lt;/a&gt;, for a more thorough explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if everything is working, you should see the image in your browser even if it returns the transform url. If the image isn't created, check if the file path for your asset source is correct (guess it is if you can upload images), and that url rewriting is working. &lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-20T12:08:48.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4224" PostTypeId="1" AcceptedAnswerId="4227" CreationDate="2014-10-20T13:27:31.183" Score="1" ViewCount="207" Body="&lt;p&gt;I dont want to allow people to post from a legacy entry type but I still want the content that was created with that entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-10-20T15:43:30.170" Title="Disable Entry Type" Tags="&lt;config&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4225" PostTypeId="1" CreationDate="2014-10-20T13:44:03.977" Score="6" ViewCount="2442" Body="&lt;p&gt;I have a front-end form for registered users to submit entries, however I'd like to have a WYSIWYG editor like the dashboard. How would I get redactor working with this form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;j&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&#xA;         {% set jobTypeDropdown = craft.fields.getFieldbyHandle('jobType') %}&#xA;        &amp;lt;label for=&quot;fields[jobType]&quot;&amp;gt;Job Type&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[jobType]&quot;&amp;gt;&#xA;            {% for option in jobTypeDropdown.settings.options %}&#xA;                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        {% set jobCategoryDropdown = craft.fields.getFieldbyHandle('jobCategory') %}&#xA;        &amp;lt;label for=&quot;fields[jobCategory]&quot;&amp;gt;Job Category&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[jobCategory]&quot;&amp;gt;&#xA;            {% for option in jobCategoryDropdown.settings.options %}&#xA;                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        {% set jobStateDropdown = craft.fields.getFieldbyHandle('jobState') %}&#xA;        &amp;lt;label for=&quot;fields[jobState]&quot;&amp;gt;Job State&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[jobState]&quot;&amp;gt;&#xA;            {% for option in jobStateDropdown.settings.options %}&#xA;                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;field[jobCity]&quot;&amp;gt;Job City&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[jobCity]&quot;&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;field[jobOverview]&quot;&amp;gt;Job Overview&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;jobOverview&quot; name=&quot;fields[jobOverview]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;field[jobDescription]&quot;&amp;gt;Job Description&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;jobDescription&quot; name=&quot;fields[jobDescription]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;field[howToApply]&quot;&amp;gt;How to Apply&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;howToApply&quot; name=&quot;fields[howToApply]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;         &amp;lt;button class=&quot;button login-btn&quot; type=&quot;submit&quot;&amp;gt;Post Job&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="910" LastActivityDate="2021-03-25T15:34:45.023" Title="How do I enable redactor rich text editor in a front-end form?" Tags="&lt;entries&gt;&lt;form&gt;&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4226" PostTypeId="1" CreationDate="2014-10-20T15:12:34.280" Score="2" ViewCount="354" Body="&lt;p&gt;how to make required plane text fields or required firsrtName and lastName fields in users profile? I want to during the registration and profile changes were required. Maybe there is any plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="635" LastActivityDate="2014-10-21T02:13:48.050" Title="Required fields in the user profile" Tags="&lt;field&gt;&lt;user-profile&gt;&lt;required&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4227" PostTypeId="2" ParentId="4224" CreationDate="2014-10-20T15:43:30.170" Score="3" Body="&lt;p&gt;Under &lt;code&gt;settings &amp;gt; users&lt;/code&gt; you can define permissions for a &lt;code&gt;group&lt;/code&gt; and/or &lt;code&gt;user&lt;/code&gt; that determine what entries the user(s) are allowed to view, edit, delete, etc. If you uncheck 'create new entries' then they will no longer be able to post to that section. For more information see the &lt;a href=&quot;http://buildwithcraft.com/docs/users&quot; rel=&quot;nofollow&quot;&gt;users documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-20T15:43:30.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4228" PostTypeId="2" ParentId="4226" CreationDate="2014-10-20T15:56:48.050" Score="3" Body="&lt;p&gt;For custom fields that you add to &lt;code&gt;users&lt;/code&gt; under &lt;code&gt;settings&amp;gt;users&amp;gt;fields&lt;/code&gt;, you can control whether the field is required by clicking on the small gear icon and selecting &lt;code&gt;make required&lt;/code&gt;. With built-in fields such as &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt;, &lt;code&gt;make required&lt;/code&gt; cannot be controlled. Within the CP, at least, you would need to look for a plug-in solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end, I would suggest a writting javascript solution that simply validates that the fields are not empty before submitting the form (or before enabling the submit button). Have a look at jquery's &lt;a href=&quot;http://api.jquery.com/on/&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;.on('click')&lt;/code&gt; or &lt;code&gt;.on('change')&lt;/code&gt;&lt;/a&gt; functionality for more info.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-21T02:13:48.050" LastActivityDate="2014-10-21T02:13:48.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4229" PostTypeId="1" AcceptedAnswerId="4230" CreationDate="2014-10-20T17:20:32.637" Score="1" ViewCount="398" Body="&lt;p&gt;Is it possible to configure Craft to preserve the ICC color profile? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did test JPG images saved in &quot;sRGB IEC61966-2.1&quot; profile and the files returned from Craft transformations are always saved in plain &quot;RGB&quot;, oversaturated and just not as nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagick is installed.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-03T14:06:19.700" Title="Preserve ICC color profile on image transformations" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4230" PostTypeId="2" ParentId="4229" CreationDate="2014-10-20T17:58:12.053" Score="3" Body="&lt;p&gt;&lt;s&gt;Not currently, but this is already on our list.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image processing library we're using only recently (within the last 6 months or so) added ICC profile support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great news for all photographers and image lovers! Things changed with Craft 2.3, ICC profiles are now preserved if Imagick is installed and used for the transformation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2014-12-03T14:06:19.700" LastActivityDate="2014-12-03T14:06:19.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4231" PostTypeId="1" CreationDate="2014-10-20T18:24:52.307" Score="4" ViewCount="3546" Body="&lt;p&gt;I'm trying to get the total number of entires that match a .relatedTo() search.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('products').title(cat).first() %}&#xA;{% set entries = craft.entries.section('products').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryCount = craft.entries.section('products').relatedTo(category).find().total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But no joy. What Am I missing?&lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2018-11-21T18:40:42.497" Title="Outputting .relatedTo() total entries number" Tags="&lt;entries&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4232" PostTypeId="2" ParentId="4231" CreationDate="2014-10-20T18:26:32.080" Score="4" Body="&lt;p&gt;I found that the following works (removing the .find() from my initial attempt.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryCount = craft.entries.section('products').relatedTo(category).total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="905" LastEditorUserId="9" LastEditDate="2014-10-22T18:39:07.833" LastActivityDate="2014-10-22T18:39:07.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4233" PostTypeId="2" ParentId="4231" CreationDate="2014-10-20T18:37:27.620" Score="4" Body="&lt;p&gt;What you're probably looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryCount = craft.entries.section('products').relatedTo(category).find()|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-20T18:37:27.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4234" PostTypeId="1" AcceptedAnswerId="4235" CreationDate="2014-10-20T19:20:06.030" Score="3" ViewCount="3800" Body="&lt;p&gt;Someone provided a solution, via the Craft Google community, but it was suggested that I also post it here for others to use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot; {% if craft.request.firstSegment == 'homepage' %} class=&quot;active&quot; {% endif %}&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('work') }}&quot; {% if craft.request.firstSegment == 'work' %} class=&quot;active&quot; {% endif %}&amp;gt;Work&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('about') }}&quot; {% if craft.request.firstSegment == 'about' %} class=&quot;active&quot; {% endif %}&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above was adapted from the demo site install (I think) and although 'work' and 'about' work fine 'homepage' did not.  I used 'homepage' as this is the 'handle' in the craft sections part of the cms so I thought that would be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially found this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/554/how-can-i-add-a-dynamic-active-css-class-to-the-navigation-on-any-given-page&quot;&gt;How can I add a dynamic &amp;quot;active&amp;quot; CSS class to the navigation on any given page?&lt;/a&gt; but not being that dev focused found the many alternatives a bit confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was suggested that I add a 'section' to the homepage template and so I added &lt;code&gt;{% set section = &quot;home&quot; %}&lt;/code&gt; after &lt;code&gt;{% extends &quot;_layout&quot; %}&lt;/code&gt; in the homepage  index.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then amended my first &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; from above to be just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot; {% if section == 'home' %} class=&quot;active&quot; {% endif %}&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which worked as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can explain why my original doesn't work, in layman's terms that would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laurence&lt;/p&gt;&#xA;" OwnerUserId="911" LastEditorUserId="22" LastEditDate="2017-05-10T00:18:10.797" LastActivityDate="2017-05-10T00:18:10.797" Title="How to add active class to homepage nav list item" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4235" PostTypeId="2" ParentId="4234" CreationDate="2014-10-20T20:55:05.730" Score="3" Body="&lt;p&gt;Unless the URL is &lt;code&gt;domainname.com/homepage&lt;/code&gt; then your class will not get added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you using template layouts? If you are you could have something like this in your &lt;code&gt;_layout&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block bodyClass %}{% if bodyClass is defined %}&amp;lt;body class=&quot;{{ bodyClass }}&quot;&amp;gt;&#xA;{% else %}&amp;lt;body&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your &lt;code&gt;home&lt;/code&gt; template you would set it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyClass = 'CLASSNAME' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR you could something like this in your nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot; {% if craft.request.firstSegment == '' %}class=&quot;active&quot;{% endif %}&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('work') }}&quot; {% if craft.request.firstSegment == 'work' %} class=&quot;active&quot; {% endif %}&amp;gt;Work&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('about') }}&quot; {% if craft.request.firstSegment == 'about' %} class=&quot;active&quot; {% endif %}&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;#&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps. If not you can always look at this post with other methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/554/how-can-i-add-a-dynamic-active-css-class-to-the-navigation-on-any-given-page&quot;&gt;How can I add a dynamic &amp;quot;active&amp;quot; CSS class to the navigation on any given page?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-20T20:55:05.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4236" PostTypeId="2" ParentId="4218" CreationDate="2014-10-20T22:26:50.763" Score="1" Body="&lt;p&gt;I just tested this and it works as you'd expect it to work for me locally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$craft = require '/path/to/craft/app/bootstrap.php';&#xA;&#xA;if ($craft-&amp;gt;userSession-&amp;gt;isAdmin())&#xA;{&#xA;    echo 'I am an admin.';&#xA;}&#xA;else&#xA;{&#xA;    echo 'I am not an admin.';&#xA;}&#xA;&#xA;if ($craft-&amp;gt;userSession-&amp;gt;isLoggedIn())&#xA;{&#xA;    echo 'I am logged in.';&#xA;}&#xA;else&#xA;{&#xA;    echo 'I am not logged in.';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-20T22:26:50.763" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4237" PostTypeId="2" ParentId="4219" CreationDate="2014-10-20T23:09:39.127" Score="3" Body="&lt;p&gt;As Douglas mentioned in the comments, if the relation is defined within a Matrix block, then the Matrix block is the source of the relation; not the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Soy you just need to change &lt;code&gt;relatedWorks&lt;/code&gt; and &lt;code&gt;relatedPerformers&lt;/code&gt; to:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set relatedWorks = craft.entries.section('Works').relatedTo(block) %}&#xA;{% set relatedPerformers = craft.entries.section('Performers').relatedTo(block) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-20T23:09:39.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4238" PostTypeId="2" ParentId="4225" CreationDate="2014-10-20T23:40:30.033" Score="11" Body="&lt;p&gt;It’s technically possible to include Craft’s copy of Redactor on the front end:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% includeJsResource &quot;lib/redactor/redactor.js&quot; %}&#xA;{% includeCssResource &quot;lib/redactor/redactor.css&quot; %}&#xA;&#xA;&amp;lt;textarea id=&quot;jobOverview&quot; name=&quot;fields[jobOverview]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;{% includeJs &quot;$('#jobOverview').redactor();&quot; %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it’s &lt;strong&gt;not recommended&lt;/strong&gt;. Redactor’s API and config settings frequently change, and we generally try to keep it updated with each new Craft version. If you started including Craft’s version of Redactor, you’re going to have to start testing your website to make sure your front-end Redactor fields are still working properly each time you update Craft to a new version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;(I’m also not sure about the legal implications. Craft comes with a Developer license of Redactor which gives &lt;em&gt;us&lt;/em&gt; unlimited use of it, but whether or not end users of Craft are allowed to use it is a gray area you should check with Imperavi on.)&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’ll be better off in the long run by grabbing your own copy of Redactor and installing it yourself for the front end site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We checked with Imperavi and the Developer license we purchased for Craft is allowed to be used on the front and back-end of Craft, although we still don't recommend it for the reasons listed above.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-02-27T20:04:43.357" LastActivityDate="2017-02-27T20:04:43.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4239" PostTypeId="2" ParentId="4211" CreationDate="2014-10-20T23:55:40.823" Score="1" Body="&lt;p&gt;You would loop through the Matrix field within each &lt;code&gt;tab&lt;/code&gt; the same way you’d do it for any other element.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set tabs = entry.descendants %}&#xA;{% for tab in tabs %}&#xA;    {{ tab.title }}&#xA;    {% for block in tab.myMatrixFieldHandle %}&#xA;        {% if block.type == 'about' %}&#xA;            ...&#xA;        {% elseif block.type == 'team' %}&#xA;            ...&#xA;        {% elseif block.type == 'clients' %}&#xA;            ...&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-20T23:55:40.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4240" PostTypeId="2" ParentId="4205" CreationDate="2014-10-20T23:58:41.110" Score="2" Body="&lt;p&gt;This really is a case for nested Matrix fields. It’s something we definitely plan on adding at some point, but that won’t help you here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like you’re using nested Structure entries to accomplish it right now – that’s probably your best bet for the time being.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-20T23:58:41.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4241" PostTypeId="1" AcceptedAnswerId="4243" CreationDate="2014-10-21T00:00:15.127" Score="1" ViewCount="325" Body="&lt;p&gt;We're working on developing a proper deployment system for projects built on Craft, and wondering if there are any Craft specific tools built-in that can assist with generating database migrations, other than &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.migration&quot; rel=&quot;nofollow&quot;&gt;those included with Yii&lt;/a&gt; itself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have more questions, but we'll start here.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-21T00:08:03.267" LastActivityDate="2014-10-21T06:08:29.257" Title="Are there any Craft specific migration tools that extend Yii's built-in functionality?" Tags="&lt;migration&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4242" PostTypeId="2" ParentId="4208" CreationDate="2014-10-21T00:02:47.730" Score="1" Body="&lt;p&gt;As you discovered, the way to go about this is with AssetsService::insertFileByLocalPath().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure about the error you’re getting though. If you haven’t had any luck figuring that out, send your plugin over to support@buildwithcraft.com with instructions on how to reproduce, and we can look into it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-21T00:02:47.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4243" PostTypeId="2" ParentId="4241" CreationDate="2014-10-21T00:15:02.167" Score="1" Body="&lt;p&gt;Craft has it's own version of Yii's console app, &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/topics.console&quot; rel=&quot;nofollow&quot;&gt;yiic&lt;/a&gt;, in &lt;code&gt;craft/app/etc/console/yiic.php&lt;/code&gt; and we have a &lt;code&gt;migrate&lt;/code&gt; command that lets you create, view history, see new migrations, etc. for plugins as well as Craft itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've extended the default &lt;code&gt;migrate&lt;/code&gt; command to add Craft-specific features and remove some default Yii functionality that we don't want to support (i.e. down migrations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the available commands to run here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/migrations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="115" LastEditDate="2014-10-21T06:08:29.257" LastActivityDate="2014-10-21T06:08:29.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4245" PostTypeId="1" CreationDate="2014-10-21T03:09:49.333" Score="5" ViewCount="876" Body="&lt;p&gt;Let's say we add a section or other elements (field, category, tags, assets, etc) in the CP on our dev servers and want to roll that change out to a stage or production environment, is there a way to capture the changes we've made through the CP as a migration, or is there some other recommended way to reverse engineer that into a migration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked out the documentation on creating &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin migrations&lt;/a&gt; and a couple of questions &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1079/migrating-a-whole-website-between-craft-instances&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;here&lt;/a&gt;, but nothing addressing creating a migration for the craft DB itself.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-21T03:18:27.350" Title="How to create a migration for the main Craft DB?" Tags="&lt;database&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4246" PostTypeId="2" ParentId="4245" CreationDate="2014-10-21T03:18:27.350" Score="3" Body="&lt;p&gt;You're looking for the answer to a complicated problem. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're thinking of I would describe as &quot;content migrations&quot; or &quot;content model syncing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is currently nothing in Craft out-of-the-box that will do what you're looking for, although we've got some ideas on how we'd like to approach the sharing/syncing of content between environments/installations in the long term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need something before then, you'll have to write a plugin that rolls its own solution.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-21T03:18:27.350" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4247" PostTypeId="1" CreationDate="2014-10-21T05:13:48.663" Score="1" ViewCount="231" Body="&lt;p&gt;I have setup a page that has image asset pickers on it and image asset pickers in a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have setup the fields to allow a single directory and a { slug } for the normal field pickers and { owner.slug } for the matrix field destinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good, if I work with a saved page it all works beautifully, the images get saved in the folder with the name of the page :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it doesn't seem to work for a new page, when I pick an image the dialog that comes up does not show the { slug } folder and when upload and select an image it shows a broken image in live preview mode. Once I save the page and go back in it all comes good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok my description was poor, I am certain this is a bug, here are the details...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have an asset repository called property-images&lt;/li&gt;&#xA;&lt;li&gt;I have a section template with 2 image fields mainImage, searchImage and another image inside a matrix field&lt;/li&gt;&#xA;&lt;li&gt;mainImage and searchImage are set to use a single source (property-images) with the location set to {slug}&lt;/li&gt;&#xA;&lt;li&gt;the matrix image is the same with the location set to {owner.slug}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I create a new page and save it (so the page is created and has a slug)&#xA;I go back into the page and select mainImage, it works beautifully, and loads images into a sub folder correctly.&#xA;If i create a new matrix block and select an image, I don't get the asset in my sub folder display but some sort of tmpassets folder. OK I kind if get this, because the block isn't created yet, I don't like it but I can live with it.&#xA;Now when I look at live preview the image doesn't preview, the image url it renders doesn't exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I save my page and come back in...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the image I picked in the block has been moved to the correct assets folder but still doesn't render anything, the transformed images aren't there&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the image from the matrix block and re-pick it now it all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems to explain to the content editor how to use this I need to tell them whenever they create a new matrix block they need to publish the page and come back in and then pick the image and then it's good. I can tell you that is not going to fly with this client!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also experimented with a page in draft but a different set of weird things results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh one more thing! I'm using transforms in code, so something like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% set lrg = {&#xA;                            mode: 'crop',&#xA;                            width: 1400,&#xA;                            height: 866,&#xA;                            quality: 75,&#xA;                            position: 'center-center'           }       %}&lt;br&gt;&#xA;  img src='{{ image.getUrl(lrg) }}'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I wonder if predefined transforms are better?&lt;/p&gt;&#xA;" OwnerUserId="760" LastEditorUserId="760" LastEditDate="2014-10-24T03:26:05.783" LastActivityDate="2014-10-24T03:26:05.783" Title="slugs in asset picker not working until page is published" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4248" PostTypeId="2" ParentId="4220" CreationDate="2014-10-21T08:05:29.633" Score="2" Body="&lt;p&gt;I am an idiot, i just misspelled things. I'm still interested to know a more efficient way to do this though?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Corrected code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% for relatedImage in entry.relatedImages %}&#xA;                {% for images in relatedImage.image %}&#xA;                    &amp;lt;div&amp;gt;&amp;lt;a href=&quot;{{ relatedImage.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ images.url }}&quot; alt=&quot;{{ relatedImage.title }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the debug would be &lt;code&gt;{{ dump(relatedImage) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2014-10-21T08:05:29.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4249" PostTypeId="2" ParentId="4247" CreationDate="2014-10-21T08:33:07.303" Score="2" Body="&lt;p&gt;This is expected behaviour. By dynamically creating asset folders based off the entry slug, the entry itself has to first be saved. This is so when assets are uploaded, Craft can look at the slug of your entry, create an asset folder with the same name and put the assets there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By uploading assets to an unsaved entry, the slug &lt;em&gt;doesn't really&lt;/em&gt; exist yet, so Craft won't know where to put your files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you say, the only way round this is to save your entry first, so Craft knows what to name your folders, and then on the second save add in your assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correct me if I am wrong but that is my understanding of it all.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-10-21T08:33:07.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4250" PostTypeId="1" AcceptedAnswerId="4254" CreationDate="2014-10-21T08:44:49.533" Score="2" ViewCount="1039" Body="&lt;p&gt;I have a plugin called &quot;myPlugin&quot;, this has a variables file. Within there, I have a something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function helloWorld() { return &quot;Hello World&quot;; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also within this plugin, I've created a new fieldtype. From the &quot;getInputHtml&quot; function, I'd like to call the &quot;helloWorld()&quot; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this? This was my initial trail of thought:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$testing = craft()-&amp;gt;myPlugin-&amp;gt;helloWorld();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$testing = craft()-&amp;gt;myPlugin-&amp;gt;myPluginVariable-&amp;gt;helloWorld();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-10-21T15:10:05.913" Title="Call a public function within a FieldType file, from a variables files" Tags="&lt;plugin-development&gt;&lt;function&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4251" PostTypeId="1" CreationDate="2014-10-21T08:53:45.193" Score="4" ViewCount="367" Body="&lt;p&gt;I am using the following in a plugin which I would expect to simply output the time of the server.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get current time&#xA;$time = date(&quot;g:i a&quot;);&#xA;// outputs 9:36am&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In a straight &lt;code&gt;.php&lt;/code&gt; file this is correct - however, from within the plugin the time is an hour out - 8:36am. I imagine this might be to do with British Summer Time. However, in Crafts general settings I have set Timezone to UTC+1 (BST) - Europe/London&lt;/p&gt;&#xA;" OwnerUserId="905" LastEditorUserId="4118" LastEditDate="2016-11-25T13:29:43.560" LastActivityDate="2016-11-25T13:29:43.560" Title="Should the timezone in general settings effect the output of $time = date(&quot;g:ia&quot;);?" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4254" PostTypeId="2" ParentId="4250" CreationDate="2014-10-21T11:34:29.390" Score="4" Body="&lt;p&gt;From what I understand about plugin development on Craft, this isn’t possible. The idea of the variables file is to provide methods which are accessible from within your plugin or users templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea being that the methods you define here are actually references to your service methods (&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Taken from Craft docs&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Many of your template variable methods will likely be simple wrappers for your service API methods. It’s important to remember not to expose state-changing methods, however.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So from that I would actually create a service class for your plugin and access the methods in your getInputHtml function from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;services/MyPlugin_PluginService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_PluginService extends BaseApplicationComponent&#xA;{&#xA; public function helloWorld()&#xA; {&#xA;   return ‘Hello World’;    &#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your getInputHtml function&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$testing = craft()-&amp;gt;myPlugin_plugin-&amp;gt;helloWorld();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Call the same method in your templates&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Add this to your &lt;strong&gt;variables/MyPluginVariable.php&lt;/strong&gt; file to call the method in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sayHello() {&#xA;  return craft()-&amp;gt;myPlugin_plugin-&amp;gt;helloWorld();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you could call the service method in your templates like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.sayHello() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2014-10-21T15:10:05.913" LastActivityDate="2014-10-21T15:10:05.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4255" PostTypeId="1" AcceptedAnswerId="4262" CreationDate="2014-10-21T12:01:48.600" Score="2" ViewCount="52" Body="&lt;p&gt;I have a site where users move through different groups based on their progress through an eLearning course. On the CP Users page the groups are listed alphabetically down the left. To get them in a meaningful order I have prefixed their names with 1, 2 etc however it would be nice not to have to do this as I re-use these names and in some places the prefix is meaningless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do something like asset sources where they are 'orderable'?&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-10-21T14:49:42.820" Title="Can User Groups be ordered?" Tags="&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4256" PostTypeId="1" AcceptedAnswerId="4263" CreationDate="2014-10-21T13:07:15.293" Score="1" ViewCount="218" Body="&lt;p&gt;I’ve been developing my first Craft plugin and I think it would be really cool to be able to offer auto-updating for it, is there a way to hook into the update page you would use to update Craft? or is this something that could happen in the future?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand you could probably achieve this manually, I’ve seen a couple of plugins do this but then on later updates some remove this functionality, is this not a good idea to try and do? is it worth looking into how Craft does this in the core files and try to tap into that or would that be a big no no…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I was thinking of achieving this manually myself is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Deploy a base version on my own server&lt;/li&gt;&#xA;&lt;li&gt;Create a service that talks(Guzzle?) to the server to check the users version against the server version&lt;/li&gt;&#xA;&lt;li&gt;Look into the methods that Craft uses to copy and back up&#xA;files and use those methods to update the plugin if needed&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any pointers or info would be appreciated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-10-21T15:00:18.213" Title="Is is possible to allow auto-updates for a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4257" PostTypeId="1" CreationDate="2014-10-21T13:25:43.020" Score="0" ViewCount="213" Body="&lt;p&gt;My local copy of a live site is showing an update to Craft 2.2 build 2593 is available but a check for updates on the live site gives &quot;Craft is unable to determine if an update is available at this time.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across this kind of behaviour before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I safe to update my local copy, commit changes and push to live site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both local and live site are both in sync at the moment running Craft Pro 2.2.2592&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2014-10-22T18:04:53.190" Title="Updates available on local copy but don't show on live site" Tags="&lt;manual-updates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4258" PostTypeId="1" AcceptedAnswerId="4260" CreationDate="2014-10-21T13:50:21.537" Score="2" ViewCount="700" Body="&lt;p&gt;Can anyone help me work out why the following returns the error &quot;The merge filter only works with arrays or hashes.&quot;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# CREATE ARRAY TO HOLD ALL OF TODAY'S EVENTS #}&#xA;{% set todaysEvents = [] %}&#xA;&#xA;{# GET TODAY'S ONE-OFF EVENTS #}&#xA;{# RETURNS ENTRIES NICELY IF LOOPED THROUGH #}&#xA;{% set todaysOneOffEvents = craft.entries.section('events').eventDate('= '~today | date(&quot;Y-m-d&quot;)) %}&#xA;&#xA;{# ADD TODAY'S ONE-OFF EVENTS TO TODAY'S EVENTS %}&#xA;{# THIS RETURNS MERGE ARRAY ERROR #}&#xA;{% set todaysEvents = todaysEvents|merge(todaysOneOffEvents) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-10-21T15:02:02.410" Title="Shouldn't this merge be working?" Tags="&lt;array&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4259" PostTypeId="1" AcceptedAnswerId="4274" CreationDate="2014-10-21T13:57:16.847" Score="1" ViewCount="155" Body="&lt;p&gt;I would like to be able to perform actions on those users that register through the front end and skip ones who are created in the CP... is there are way of checking or a parameter accessible in the onBeforeSaveUser or onSaveUser events?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume there must be something hidden in there as users registered on the front end can be assigned to a certain user group which isn't applied to a CP registration.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-10-21T22:08:49.137" Title="Is it possible to tell if a user was registered through the front end or CP?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4260" PostTypeId="2" ParentId="4258" CreationDate="2014-10-21T14:38:54.120" Score="6" Body="&lt;p&gt;Try adding &lt;code&gt;find()&lt;/code&gt; to your ElementCriteriaModel, I think without that function you're not actually saving your entries as an array in your variable &lt;code&gt;todaysOneOffEvents&lt;/code&gt; yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#fetching-the-elements&quot; rel=&quot;nofollow&quot;&gt;found in the Docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You don’t actually need to call &lt;code&gt;find()&lt;/code&gt; yourself though: It will be called automatically as soon as the ElementCriteriaModel is treated like an array (that is, as soon as you check how many elements there are using the &lt;code&gt;|length&lt;/code&gt; filter, or start looping through the elements with a &lt;code&gt;{% for %}&lt;/code&gt; loop).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We learn that merging doesn't &quot;treat it like an array&quot;, good to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: You can't use the &lt;code&gt;length&lt;/code&gt; filter to &quot;convert&quot; the content of the variable to an actual array. Removed that part from the answer.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-21T15:02:02.410" LastActivityDate="2014-10-21T15:02:02.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4261" PostTypeId="1" AcceptedAnswerId="4310" CreationDate="2014-10-21T14:44:51.977" Score="1" ViewCount="431" Body="&lt;p&gt;Since file inputs are not allowd to be pre-populated, how do i tell craft that a required asset field is already filled in the front end edit form? Can’t seem to figure this one out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Users can create entries from the front end. Those entries have at least one required field which is an asset (image). Creating an entry works fine. However, when editing an entry the user should be able to change the asset as well so we give them the file input too when editing the entry. If they choose to leave that alone the entry couldn’t get saved since the file input stays empty but is still required.&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2014-10-23T06:52:20.803" LastActivityDate="2014-10-23T06:53:02.340" Title="Front end edit required asset" Tags="&lt;assets&gt;&lt;form&gt;&lt;field&gt;&lt;required&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4262" PostTypeId="2" ParentId="4255" CreationDate="2014-10-21T14:49:42.820" Score="1" Body="&lt;p&gt;Not currently, but not a bad idea.  I'll add it to the list.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-21T14:49:42.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4263" PostTypeId="2" ParentId="4256" CreationDate="2014-10-21T14:52:44.113" Score="4" Body="&lt;p&gt;You &lt;em&gt;could&lt;/em&gt; go through all of that effort, or you could just wait until the plugin store gets finished and any plugin that is listed in the store will get automatic updating for free nicely integrated into Craft's auto-updating functionality. :)&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-21T15:00:18.213" LastActivityDate="2014-10-21T15:00:18.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4264" PostTypeId="2" ParentId="4205" CreationDate="2014-10-21T15:33:07.953" Score="0" Body="&lt;p&gt;Maybe I just don't understand what you're trying to do, but can't you use one dedicated Matrix field for each of your tabs? All in a single entry &quot;Agency Structure&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want you can group fields using &quot;CP tabs&quot; in the field layout manager. You could do one tab for each of your tabs and an additional one for the main content / slider.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-21T15:33:07.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4265" PostTypeId="2" ParentId="4120" CreationDate="2014-10-21T17:04:42.730" Score="3" Body="&lt;p&gt;As of Craft 2.2, all you need to do is add a &lt;code&gt;data-confirm-unload&lt;/code&gt; attribute to the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element that wraps your Field Layout Designer:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; data-confirm-unload&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft will then automatically check to see if there were any changes in the form on page unload, and give the user a chance to stay on the page (same way the Edit Entry page works).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-21T17:04:42.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4266" PostTypeId="2" ParentId="4113" CreationDate="2014-10-21T17:55:52.673" Score="5" Body="&lt;p&gt;As you discovered, you can get the current element that a field type is getting applied to via &lt;code&gt;$this-&amp;gt;element&lt;/code&gt;. However you must keep in mind that that property will not always be set. So make sure that your PHP/template code is defensive about the possibility that there is no known element yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another assumption to avoid is that the current element is going to be an entry. Craft lets you associate fields with any type of element - entries, users, assets, categories, tags, globals, and Matrix blocks, and even any custom element types that plugins may add. So &lt;code&gt;$this-&amp;gt;element-&amp;gt;section&lt;/code&gt; should be avoided unless you know that &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; is actually an EntryModel; otherwise that will give you a PHP error.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-21T17:55:52.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4267" PostTypeId="2" ParentId="2924" CreationDate="2014-10-21T18:03:49.040" Score="2" Body="&lt;p&gt;hasDescendants() is only concerned with whether the entry actually has descendants; not whether they are enabled or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine in an entry has &lt;em&gt;enabled&lt;/em&gt; descendants, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set hasDescendants = entry.descendants.total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or in your case:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;li class=&quot;{% if nav_item.descendants.total() %}more{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.descendants&lt;/code&gt; is an alias for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow&quot;&gt;EntryModel::getDescendants()&lt;/a&gt;, which will return a new &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; prepped to return descendants of &lt;code&gt;entry&lt;/code&gt;. By default it will only return the enabled ones, like all ElementCriteriaModel’s.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-21T18:03:49.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4268" PostTypeId="1" CreationDate="2014-10-21T18:31:01.350" Score="5" ViewCount="1711" Body="&lt;p&gt;I am hoping craft supports MariaDB. Also, since version 10, InnoDB transaction engine in MariaDB has been replaced with XtraDB. Will this work with Craft?&lt;/p&gt;&#xA;" OwnerUserId="916" LastActivityDate="2019-05-23T21:05:17.027" Title="Does Craft Support MariaDB?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4269" PostTypeId="2" ParentId="4268" CreationDate="2014-10-21T18:36:16.097" Score="8" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;Craft 3 officially supports MariaDB 5.5+ now. &lt;a href=&quot;https://docs.craftcms.com/v3/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/requirements.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Not officially, no.  MariaDB is supposed to a &quot;drop-in&quot; replacement for MySQL, but there are clearly areas where it is not 1:1 compatible with MySQL: &lt;a href=&quot;https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've seen some installations using MariaDB where a query would actually return &lt;em&gt;incorrect&lt;/em&gt; results and the same MySQL query on the same database returns that data correctly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2019-05-23T21:05:17.027" LastActivityDate="2019-05-23T21:05:17.027" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4270" PostTypeId="1" AcceptedAnswerId="4271" CreationDate="2014-10-21T19:17:30.163" Score="3" ViewCount="1954" Body="&lt;p&gt;Just trying to use Craft's Twig replace filter to remove number prefixes from the beginning of User Groups names and I have had to double escape the character classes etc to get it to work. I tried this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ group.name|replace('/^\d+\.\s/','') }}{% if not loop.last %}, {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it didn't work so for some reason I tried this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ group.name|replace('/^\\d+\\.\\s/','') }}{% if not loop.last %}, {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and it worked. Is there a sensible explanation for this as Regular Expressions are like Voodoo?!&lt;/p&gt;&#xA;" OwnerUserId="897" LastEditorUserId="125" LastEditDate="2014-10-28T11:13:36.690" LastActivityDate="2014-12-15T03:29:28.957" Title="Double escaping Regular Expressions in Craft's Twig replace filter?" Tags="&lt;templating&gt;&lt;regex&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4271" PostTypeId="2" ParentId="4270" CreationDate="2014-10-21T20:04:37.200" Score="3" Body="&lt;p&gt;Twig auto-escapes the &lt;code&gt;\&lt;/code&gt; character so by the time it makes it to the Craft &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/templating/twigextensions/CraftTwigExtension.php#L140&quot; rel=&quot;nofollow&quot;&gt;replace&lt;/a&gt; filter PHP code, the regex string looks like &lt;code&gt;/^d+.s/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By double escaping it, you're forcing the correct regex to make it through &lt;code&gt;/^\d+\.\s/&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-15T03:29:28.957" LastActivityDate="2014-12-15T03:29:28.957" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4272" PostTypeId="2" ParentId="4119" CreationDate="2014-10-21T21:36:38.663" Score="6" Body="&lt;p&gt;There are two ways to retrieve field layouts: by ID (&lt;a href=&quot;http://buildwithcraft.com/classreference/services/FieldsService#getLayoutById-detail&quot;&gt;FieldsService::getLayoutById()&lt;/a&gt;) and by element type (&lt;a href=&quot;http://buildwithcraft.com/classreference/services/FieldsService#getLayoutByType-detail&quot;&gt;FieldsService::getLayoutByType()&lt;/a&gt;). The former is useful for element types that manage multiple field layouts and have their own way of storing those field layout IDs (e.g. sections, asset sources, etc.), and the latter is useful for element types that only need to manage a single field layout (e.g. users, or in your case, inquires.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here’s what your plugin’s &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/components/ISavableComponentType#getSettingsHtml-detail&quot;&gt;getSettingsHtml()&lt;/a&gt; method should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    $fieldLayout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType('Inquiry');&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('inquires/_settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;        'fieldLayout' =&amp;gt; $fieldLayout&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That “inquiries/_settings” template would map to craft/plugins/inquiries/templates/_settings.html, and that should include this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% include &quot;_includes/fieldlayoutdesigner&quot; with {&#xA;    fieldLayout: fieldLayout&#xA;} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your plugin’s &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/components/ISavableComponentType#prepSettings-detail&quot;&gt;prepSettings()&lt;/a&gt; method should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function prepSettings($settings)&#xA;{&#xA;    // Delete the old field layout&#xA;    craft()-&amp;gt;fields-&amp;gt;deleteLayoutsByType('Foo');&#xA;&#xA;    // Extract the field layout data from the settings&#xA;    $postedFieldLayout = isset($settings['fieldLayout']) ? $settings['fieldLayout'] : array();&#xA;    $requiredFields = isset($settings['requiredFields']) ? $settings['requiredFields'] : array();&#xA;&#xA;    // Save the field layout&#xA;    $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout($postedFieldLayout, $requiredFields, true);&#xA;    $fieldLayout-&amp;gt;type = 'Foo';&#xA;    craft()-&amp;gt;fields-&amp;gt;saveLayout($fieldLayout);&#xA;&#xA;    // Return the settings without the field layout data&#xA;    unset($settings['fieldLayout'], $settings['requiredFields']);&#xA;    return $settings;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, whatever model your element type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/IElementType#populateElementModel-detail&quot;&gt;populateElementModel()&lt;/a&gt; method returns should have a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldLayout-detail&quot;&gt;getFieldLayout()&lt;/a&gt; method that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;public function getFieldLayout()&#xA;{&#xA;    return craft()-&amp;gt;fields-&amp;gt;getLayoutByType('Inquiry');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; The Field Layout Designer will only work within the plugin settings in &lt;a href=&quot;http://buildwithcraft.com/updates#build2596&quot;&gt;Craft 2.2.2596&lt;/a&gt; or later.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-21T21:36:38.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4273" PostTypeId="2" ParentId="2505" CreationDate="2014-10-21T21:49:14.063" Score="2" Body="&lt;p&gt;As far as I know. The variable {{ entry }} is not available to custom field plugins through inheritance and must be explicitly set and returned as a variable in the &lt;code&gt;getInputHtml&lt;/code&gt; method within the class definition file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4113/how-to-reference-the-current-entry-element-in-custom-control-panel-templates/4266?noredirect=1#comment4699_4266&quot;&gt;this question&lt;/a&gt; for details on how to set this variable and things to be aware of.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-21T21:49:14.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4274" PostTypeId="2" ParentId="4259" CreationDate="2014-10-21T22:08:49.137" Score="2" Body="&lt;p&gt;You already answered your own question, but I thought I would post an example. In the plugin's class definition file create an &lt;code&gt;init&lt;/code&gt; method with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) &#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        $isNewUser = $event-&amp;gt;params['isNewUser'];&#xA;&#xA;        if ($isNewUser &amp;amp;&amp;amp; !$currentUser) {&#xA;&#xA;            // do your thing, whatever it is&#xA;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should only target 'new user registrations' by users who are 'not already logged in' (i.e. public registrations through the front-end). By the time the Users Service has raised the event, it should have already passed all the other checks, regarding whether to &lt;code&gt;allowPublicRegistration&lt;/code&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-21T22:08:49.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4275" PostTypeId="1" CreationDate="2014-10-22T00:14:41.263" Score="1" ViewCount="250" Body="&lt;p&gt;Can these things work together? Right now, after verification I am being redirected to the dashboard (/gistApp) instead of being routed through /actions/gistClient/loginControl where I have some user business logic. I know that /actions/gistClient/loginControl works because I can direct navigate to that URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA; 'omitScriptNameInUrls' =&amp;gt; true,&#xA;  'loginPath' =&amp;gt; '/gistapp/login',&#xA;  'setPasswordSuccessPath' =&amp;gt; '/gistapp/login' ,&#xA;  'purgePendingUsersDuration' =&amp;gt; 'P2M',&#xA;  'devMode' =&amp;gt; true,&#xA;  'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;  'postLoginRedirect' =&amp;gt; '/actions/gistClient/loginControl',&#xA;  'enableCsrfProtection' =&amp;gt; true,&#xA;  'csrfTokenName' =&amp;gt; 'cranberryCsrfToken',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-11-30T02:01:34.147" Title="autoLoginAfterAccountActivation and postLoginRedirect" Tags="&lt;config&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-11-30T04:40:44.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="4276" PostTypeId="2" ParentId="4275" CreationDate="2014-10-22T00:28:02.723" Score="0" Body="&lt;p&gt;If the user being registered has access to the control panel, then you'll want to set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#postCpLoginRedirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;postCpLoginRedirect&lt;/a&gt; config setting as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like this was a bug and the same problem as &lt;a href=&quot;https://craftcms.stackexchange.com/a/4305/57&quot;&gt;this one&lt;/a&gt;.  Should be fixed for the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Officially fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2598&quot; rel=&quot;nofollow noreferrer&quot;&gt;2.2 build 2598&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-31T01:22:25.470" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4277" PostTypeId="1" CreationDate="2014-10-22T00:56:30.037" Score="1" ViewCount="767" Body="&lt;p&gt;I get an error message when trying to add an asset through a matrix field when I try to save the entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internal Server Error&#xA;Cannot find the target folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to upload images through assets just can't get the entry to save. Any ideas. It was working before without issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help&#xA;Josh&lt;/p&gt;&#xA;" OwnerUserId="619" LastEditorUserId="619" LastEditDate="2014-10-22T01:21:17.333" LastActivityDate="2014-10-22T07:54:23.653" Title="Cannot find the target folder" Tags="&lt;error-message&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4278" PostTypeId="1" AcceptedAnswerId="4283" CreationDate="2014-10-22T07:43:09.033" Score="2" ViewCount="147" Body="&lt;p&gt;Is it possible to assign priveleges to a user group (not admin but with CP access) to manually 'Activate User's?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a few users who struggle with the email process but it would seem only top level admins can Activate - is that the case or is there an override?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Dan&lt;/p&gt;&#xA;" OwnerUserId="214" LastActivityDate="2017-06-23T18:21:37.467" Title="Activate Users - privilege" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4279" PostTypeId="2" ParentId="4277" CreationDate="2014-10-22T07:54:23.653" Score="3" Body="&lt;p&gt;Make sure that the &quot;Restrict uploads to a single folder?&quot; setting in the fields settings isn't enabled. Enabling this, and not providing a valid path will give you that error I think.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-22T07:54:23.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4280" PostTypeId="1" AcceptedAnswerId="4418" CreationDate="2014-10-22T10:30:00.527" Score="4" ViewCount="1271" Body="&lt;p&gt;I have a few different forms on my site for different kinds of enquiries, each represented by an &lt;code&gt;Entry Type&lt;/code&gt; with different fields in a single &lt;code&gt;Enquiries&lt;/code&gt; channel. How can I get the entries/saveEntry form to save as a specific entry type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My existing form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/hire-us/get-a-quote/success&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;61&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have two entry types in that channel, ID 111 and 112. When I add the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;typeId&quot; value=&quot;111&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then submit the form, I get an error message saying &quot;&lt;em&gt;Unable to find the template 'hire-us/enquiryPlanningEvent'&lt;/em&gt;&quot;. It appears that Craft is looking for a template named after the entry type I'm trying to save, but obviously there isn't one.&#xA;What's the solution to this?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-10-28T17:55:40.410" LastActivityDate="2014-10-30T16:31:07.620" Title="How do I save a front-end form as a specific Entry Type?" Tags="&lt;entries&gt;&lt;form&gt;&lt;entry-type&gt;&lt;guest-entries&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4281" PostTypeId="1" AcceptedAnswerId="35526" CreationDate="2014-10-22T13:14:59.467" Score="2" ViewCount="1734" Body="&lt;p&gt;Is there a possibility to ad a 'superscript' button to redactor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I found an explanation here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2691/how-can-i-use-small-sub-sub-within-a-redactor-rich-text-field/2695#2695&quot;&gt;How can I use &amp;lt;small&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;sub&amp;gt; within a redactor/rich-text field?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I copy this snippet form: &lt;a href=&quot;http://imperavi.com/redactor/examples/buttons-sup-and-sub/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imperavi.com/redactor/examples/buttons-sup-and-sub/&lt;/a&gt; to  &lt;code&gt;craft/app/resources/lib/redactor/plugins/subsup.js&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!RedactorPlugins) var RedactorPlugins = {};&#xA;&#xA;RedactorPlugins.scriptbuttons = function()&#xA;{&#xA;    return {&#xA;        init: function()&#xA;        {&#xA;            var sup = this.button.add('superscript', 'Superscript');&#xA;            var sub = this.button.add('subscript', 'Subscript');&#xA;&#xA;            // make your added buttons as Font Awesome's icon&#xA;            this.button.setAwesome('superscript', 'fa-superscript');&#xA;            this.button.setAwesome('subscript', 'fa-subscript');&#xA;&#xA;            this.button.addCallback(sup, this.scriptbuttons.formatSup);&#xA;            this.button.addCallback(sub, this.scriptbuttons.formatSub);&#xA;        },&#xA;        formatSup: function()&#xA;        {&#xA;            this.inline.format('sup');&#xA;        },&#xA;        formatSub: function()&#xA;        {&#xA;            this.inline.format('sub');&#xA;        }&#xA;    };&#xA;}; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I call the plugin in a custom.json file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['link','bold', 'italic','unorderedlist','orderedlist','image','html'],&#xA;    plugins: ['fullscreen', 'subsup'],&#xA;    toolbarFixedBox: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that results in nothing. What do I miss?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2020-06-08T14:16:06.383" Title="Redactor - Superscript button" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4282" PostTypeId="1" AcceptedAnswerId="4285" CreationDate="2014-10-22T15:30:10.280" Score="2" ViewCount="5065" Body="&lt;p&gt;I'm trying to loop through some entries and if they fulfil a certain condition push them into another array of entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set todaysEvents = []&#xA;{# GET TODAY'S ONE-OFF EVENTS #}&#xA;{% set todaysOneOffEvents = craft.entries.section('events').eventDate('= '~today | date(&quot;Y-m-d&quot;)).find() %}&#xA;&#xA;{# ADD TODAY'S ONE-OFF EVENTS TO TODAY'S EVENTS #}&#xA;{% set todaysEvents = todaysEvents|merge(todaysOneOffEvents) %}&#xA;{# WORKING BEAUTIFULLY #}       &#xA;&#xA;{# FOR MULTI-DAY EVENTS THE DATES ARE IN A MATRIX FIELD, SO WE CAN'T FILTER USING CRAFT.ENTRIES #}&#xA;{# INSTEAD, WE HAVE TO FILTER EVERY ENTRY IN EVENTS WHICH USE THE MULTI-DAY ENTRY TYPE #}&#xA;{% for event in craft.entries.section('events').type('eventWithMultipleDays').find() %}&#xA;    {# NOW FIND ONLY ENTRIES WITH A MATRIX BLOCK CONTAINING TODAY'S DATE #}&#xA;    {% for date in event.dates if date.multiDate == today | date(&quot;Y-m-d&quot;) %}&#xA;        {# CORRECTLY IDENTIFIES ENTRY AS HAVING TODAY'S DATE IN A MATRIX BLOCK #}&#xA;        {# SO NOW WE ADD IT TO TODAYSEVENTS ARRAY #}&#xA;        {% set todaysEvents = todaysEvents|merge(event) %}&#xA;        {# ERROR: THE MERGE FILTER ONLY WORKS WITH ARRAYS OR HASHES #}      &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What go on? See the error in the last comment. How do I pass only these filtered entries into todaysEvents array?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-10-22T16:21:15.103" LastActivityDate="2014-10-22T16:30:45.043" Title="Adding entries to an array, one at a time" Tags="&lt;array&gt;&lt;merge&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4283" PostTypeId="2" ParentId="4278" CreationDate="2014-10-22T15:37:14.147" Score="4" Body="&lt;p&gt;&lt;code&gt;requireAdmin&lt;/code&gt; is hard coded into the &lt;code&gt;actionActivateUser&lt;/code&gt; action in line 444 of the &lt;code&gt;UsersService&lt;/code&gt; file, so I suspect that there is no way to over-ride this without creating your own plugin.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-22T15:37:14.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4284" PostTypeId="2" ParentId="4280" CreationDate="2014-10-22T15:38:35.990" Score="1" Body="&lt;p&gt;I think the way you are trying to add entries requires authentication, if you look on the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;entry form page&lt;/a&gt; in the craft docs, you will see this snippet of text:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The user submitting the entry will also need to have the permission necessary to create entries for the section they are posting to&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I think you would need to use the guest entries plugin (from P&amp;amp;T), unless i'm mistaken, so maybe give that a try and see if it fixes the issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries plugin on Github&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference in markup is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the way I have done this on a site i've built and not had any issues, entries get saved and to the specified type. :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-10-22T15:38:35.990" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4285" PostTypeId="2" ParentId="4282" CreationDate="2014-10-22T16:08:11.620" Score="7" Body="&lt;p&gt;The merge filter only works with 2 arrays (or 2 hashes), not with an array and an object. I think that the &lt;code&gt;event&lt;/code&gt; you are trying to add is not an array, it is a single event (Entry Model). You might try adding the event using &lt;code&gt;[ event ]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set todaysEvents = todaysEvents|merge([event]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-22T16:30:11.760" LastActivityDate="2014-10-22T16:30:11.760" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4286" PostTypeId="2" ParentId="4282" CreationDate="2014-10-22T16:30:45.043" Score="1" Body="&lt;p&gt;Solved by putting the event object into an array using square brackets.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set todaysEvents = todaysEvents|merge([event]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-10-22T16:30:45.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4287" PostTypeId="1" AcceptedAnswerId="4288" CreationDate="2014-10-22T16:56:55.360" Score="3" ViewCount="965" Body="&lt;p&gt;I was wondering if someone could take a minute for a newbie to show the template code for a section index page that needs to be private - accessible only to &quot;clients&quot; (pre-registered as users in a private group - I am assuming).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused about the permissions in the users section of the CP as they only show permissions to edit/view assets etc.... not templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone asked a similar question and the response was &quot;yes it is easy - go look at the User Model&quot; - however I am just starting to figure all this out so need a little help!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="920" LastActivityDate="2014-10-22T17:22:17.953" Title="Password-Protect Sections - Newbie Template Code" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4288" PostTypeId="2" ParentId="4287" CreationDate="2014-10-22T17:22:17.953" Score="6" Body="&lt;p&gt;Here is a basic template that requires login, and checks that the currently logged-in user is in the user group 'clients'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% requireLogin %}    &#xA;&#xA;{% block content %}&#xA;&#xA;    {% if currentUser.isInGroup( craft.userGroups.getGroupByHandle('clients') ) %}&#xA;&#xA;        {# Only viewable by logged in users that belong to 'clients' user group #}    &#xA;        Restricted client content goes here.&#xA;&#xA;    {% else %}&#xA;&#xA;        {# Viewable by logged in users not in the user group 'clients' #}&#xA;        Notice to other user groups that this content is restricted to clients only.&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may also want to check out &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4182/password-protected-area-with-unique-files/4184#4184&quot;&gt;this question&lt;/a&gt; for more examples.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-22T17:22:17.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4289" PostTypeId="2" ParentId="4146" CreationDate="2014-10-22T17:42:36.913" Score="5" Body="&lt;p&gt;Here’s what your field type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#getInputHtml-detail&quot; rel=&quot;nofollow&quot;&gt;getInputHtml()&lt;/a&gt; method should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    // If $value['trial_end'] is set, make sure that it's a DateTime object&#xA;    if (!empty($value['trial_end']))&#xA;    {&#xA;        $value['trial_end'] = DateTime::createFromString($value['trial_end']);&#xA;    }&#xA;    else&#xA;    {&#xA;        $value['trial_end'] = '';&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('myplugin/input', array(&#xA;        'id'    =&amp;gt; craft()-&amp;gt;templates-&amp;gt;formatInputId($name),&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value,&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your plugin’s input.html template would be responsible for showing the Datepicker input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to create a Datepicker input is to either include the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms/date.html&quot; rel=&quot;nofollow&quot;&gt;_includes/forms/date.html&lt;/a&gt; template directly into your template, or use the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms.html#L24&quot; rel=&quot;nofollow&quot;&gt;date()&lt;/a&gt; macro from _includes/forms.html. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% from &quot;_includes/forms&quot; import date %}&#xA;&#xA;{{ date({&#xA;    id: id ~ '-trial_end',&#xA;    name: name ~ '[trial_end]',&#xA;    value: value.trial_end&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However if you need to tweak the HTML, such as adding that &lt;code&gt;ata-stripe=&quot;trial_end&quot;&lt;/code&gt; attribute, you can just copy the HTML from the _includes/forms/date.html template directly into yours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, it’s probably not working because you have that &lt;code&gt;hasDatepicker&lt;/code&gt; class on your &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;, which tells the Datepicker JS that a datepicker instance has already been assigned to that input, so the new datepicker initialization is getting skipped. Remove that class and you should be good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When an entry is saved, you will need to convert the user-submitted date value into a DateTime object, which you can do using &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/dates/DateTime#createFromString-detail&quot; rel=&quot;nofollow&quot;&gt;DateTime::createFromString()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a normal field type you would want to put that code within &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#prepValueFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;prepValueFromPost()&lt;/a&gt;, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function prepValueFromPost($value)&#xA;{&#xA;    // Convert trial_end to a DateTime object&#xA;    $value['trial_end'] = DateTime::createFromString($value['trial_end']);&#xA;&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However in your case, if your field type isn’t storing any data and its &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#defineContentAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;defineAttributeConfig()&lt;/a&gt; method is returning &lt;code&gt;false&lt;/code&gt;, a better place to put it would be in &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#onAfterElementSave-detail&quot; rel=&quot;nofollow&quot;&gt;onAfterElementSave()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    // Get the raw POST value for this field&#xA;    $value = $this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;getAttribute($this-&amp;gt;model-&amp;gt;handle);&#xA;&#xA;    // Convert trial_end to a DateTime object&#xA;    $value['trial_end'] = DateTime::createFromString($value['trial_end']);&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you’re looking for an example third party field type that works with dates, check out our &lt;a href=&quot;https://github.com/pixelandtonic/StoreHours&quot; rel=&quot;nofollow&quot;&gt;Store Hours&lt;/a&gt; plugin. It’s using timepickers rather than datepickers, but those both work exactly the same.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-22T18:54:48.783" LastActivityDate="2014-10-22T18:54:48.783" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4290" PostTypeId="2" ParentId="4257" CreationDate="2014-10-22T18:04:53.190" Score="1" Body="&lt;p&gt;Generally, it’s perfectly safe to update locally and push the changes live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two things to keep in mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If there were any migrations in the update, your production site will be put in Maintenance Mode when you deploy the update, and you will need to visit the Control Panel and click the Finish Up button to complete the update. You can tell if this is going to be necessary by checking craft/app/Info.php and seeing if the CRAFT_SCHEMA_VERSION has changed, or by checking to see if there are any new files within craft/app/migrations/.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you update locally and then a second update is immediately available, the chances are that you hit a “breakpoint update”, which means that you have to update &lt;em&gt;TO&lt;/em&gt; a certain release before you can update &lt;em&gt;PAST&lt;/em&gt; it. That will apply to your production site as well, so in that case, you will actually need to deploy the first update to production, click that Finish Up button if there is one, and then run the second update locally, deploy it, and once again click the Finish Up button.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-22T18:04:53.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4291" PostTypeId="2" ParentId="4251" CreationDate="2014-10-22T18:12:58.593" Score="4" Body="&lt;p&gt;Yes, Craft calls &lt;code&gt;date_default_timezone_set('UTC');&lt;/code&gt; when initializing, so PHP will output all times in UTC by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to output a time using the timezone that Craft has been set to in General Settings, you can do that with a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/dates/DateTime&quot; rel=&quot;nofollow&quot;&gt;DateTime&lt;/a&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$now = new DateTime();&#xA;$time = $now-&amp;gt;format('g:i a');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-22T18:12:58.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4292" PostTypeId="2" ParentId="4231" CreationDate="2014-10-22T18:38:27.703" Score="8" Body="&lt;p&gt;The best way to do it depends on whether you actually want to loop through the related entries or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;only&lt;/em&gt; want the total, and aren’t going to be looping through them, use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#total&quot; rel=&quot;noreferrer&quot;&gt;.total()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entryCount = craft.entries.section('products').relatedTo(category).total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Note that’s just &lt;code&gt;.total()&lt;/code&gt;, not &lt;code&gt;.find().total()&lt;/code&gt;.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you’re not making Craft do any more work than what you actually need - just figuring out the total related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do want to loop through them as well, then grab the entries normally and then figure out how many came back using Twig’s &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot; rel=&quot;noreferrer&quot;&gt;|length&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('products').relatedTo(category) %}&#xA;{% set entryCount = entries|length %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-22T18:38:27.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4293" PostTypeId="2" ParentId="2739" CreationDate="2014-10-22T18:50:39.990" Score="1" Body="&lt;p&gt;It sounds like delegating the import to a Task would be the best way to implement this. More info in this answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2019/does-craft-have-a-server-side-queuing-system/2020#2020&quot;&gt;Does Craft have a server-side queuing system?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="629" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-22T18:50:39.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4294" PostTypeId="1" AcceptedAnswerId="4296" CreationDate="2014-10-22T18:51:16.017" Score="0" ViewCount="281" Body="&lt;p&gt;This may have been answered before but my searching has not come up with anything. I need clarification on when to quote and when not to quote the boolean in the admin criteria for craft.users in a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that displays a table of users and the reason this came up is I needed to exclude the admins from the table. Easy you say, just use the admin parameter and set it to false. That's what I thought so I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.admin(false) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This however returned all the users. So I thought maybe it needs quoting and did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.admin('false') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hurray! This did exactly what I wanted. Then I thought what if I only wanted the admins and tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.admin('true') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This however returned all users that are not admins, eh? Ok, what about:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.admin(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hurray again! Only admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So looking through the source I can see why the first unquoted false has no affect as it fails the &lt;code&gt;if(criteria-&amp;gt;admin){}&lt;/code&gt; and therefore does nothing. After that I got lost in parseParam() and arrayHelpers so if anyone could clarify to quote or not to quote (that is the question!) and if this is the expected behaviour. Seems a little strange you need to quote 'false' and not quote true to get the desired behaviour. I also tried passing the parameters as an object and the results were the same.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-10-22T19:25:15.867" Title="craft.users.admin boolean parameter... to quote or not to quote?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4295" PostTypeId="2" ParentId="3064" CreationDate="2014-10-22T19:23:36.250" Score="0" Body="&lt;p&gt;If you have an Entries field type in your navigation structure &lt;a href=&quot;http://craftcookbook.net/recipes/88&quot; rel=&quot;nofollow&quot;&gt;(like the more advanced example in this post on the craft cookbook&lt;/a&gt;) you should be able to use the relatedTo( ) parameter to do the comparison instead of using the segment in a URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you had an Entries Field with the handle &quot;relatedEntry&quot; in your navigation structure you could change your code from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;li class=&quot;{% if craft.request.getSegment(1) == nav_item.nav_url %}active {% endif %}{% if nav_item.hasDescendants() %}more{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch the related navigation entry based on our current entry #}&#xA;{% set relatedToEntry = navigation.relatedTo(entry)%}&#xA;&#xA;{# Check to see if the mainNavigation entry matches the current entry. Only compare it with the top level navigation items #}&#xA;{% set active = (relatedToEntry[0].slug == nav_item.slug and nav_item.hasDescendants) or (relatedToEntry[0].parent != &quot;&quot; and relatedToEntry[0].parent.slug == nav_item.slug) %}&#xA;&#xA;{# display the class &quot;active&quot; if #}&#xA;&amp;lt;li class=&quot;{% if active %}active {% endif %}{% if nav_item.hasDescendants() %}more{% endif %}&quot;&amp;gt;&#xA;&amp;lt;a href=&quot;{{ nav_item.relatedEntry[0].url }}&quot;&amp;gt;{{ nav_item.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: For some reason I had to compare the slugs (as opposed to the names) in order to get a positive match.&lt;/p&gt;&#xA;" OwnerUserId="312" LastEditorUserId="312" LastEditDate="2014-10-23T13:38:41.960" LastActivityDate="2014-10-23T13:38:41.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4296" PostTypeId="2" ParentId="4294" CreationDate="2014-10-22T19:25:15.867" Score="2" Body="&lt;p&gt;Let me try to make some sense of the behavior you’re seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you should know that the &lt;code&gt;admin&lt;/code&gt; param will query against the &lt;code&gt;admin&lt;/code&gt; column in your &lt;code&gt;craft_users&lt;/code&gt; table, which will either be set to &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; for each user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like most Craft params, the &lt;code&gt;admin&lt;/code&gt; param is set to &lt;code&gt;null&lt;/code&gt; by default, and will only have any affect on the DB query if it is set to a &lt;strong&gt;non-empty&lt;/strong&gt; value. (Here’s a list of what PHP considers “empty”: &lt;a href=&quot;http://php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here’s what’s happening behind the scenes for each thing you passed in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;false&lt;/code&gt; – That’s an empty value, so it’s the same as not passing anything in.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;'false'&lt;/code&gt; – Since the &lt;code&gt;admin&lt;/code&gt; column is numeric, MySQL has to normalize this string into a number (sortof like using JavaScript’s parseInt() function). The result for &lt;code&gt;'false'&lt;/code&gt; is &lt;code&gt;0&lt;/code&gt;, since &lt;code&gt;'false'&lt;/code&gt; doesn’t begin with a number. The end result is that this awkwardly works as expected, but I wouldn’t recommend it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;'true'&lt;/code&gt; – Same effect as &lt;code&gt;'false'&lt;/code&gt;. Ends up being &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;true&lt;/code&gt; – SQL doesn’t support PHP’s boolean datatypes (&lt;code&gt;true&lt;/code&gt;/&lt;code&gt;false&lt;/code&gt;), so PHP will convert this to &lt;code&gt;1&lt;/code&gt; before passing it off to MySQL. (&lt;code&gt;false&lt;/code&gt; likewise becomes &lt;code&gt;0&lt;/code&gt;, but since &lt;code&gt;false&lt;/code&gt; is empty, Craft won’t let your value make it that far in the first place.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the future, I think this makes a good case for us allowing &lt;code&gt;false&lt;/code&gt;, so we’ll probably start checking for that and allowing it. But that won’t help you today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is then, what is the best way to find users that are(n’t) admins today? Here’s what I would recommend:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding admins:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;1&lt;/code&gt; (int)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;'1'&lt;/code&gt; (string)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finding non-admins:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;'not 1'&lt;/code&gt; (string)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-22T19:25:15.867" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4297" PostTypeId="1" AcceptedAnswerId="4306" CreationDate="2014-10-22T19:42:25.247" Score="0" ViewCount="1581" Body="&lt;p&gt;I am getting an Apache 404 page when trying to install Craft after following all instructions. I've run out of ideas. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Set up a droplet running LAMP on Ubuntu 14.04 with &lt;a href=&quot;https://www.digitalocean.com&quot; rel=&quot;nofollow&quot;&gt;Digital Ocean&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;'craft' folder is sitting in public at &lt;code&gt;'var/www'&lt;/code&gt; and &lt;code&gt;index.php&lt;/code&gt; on&#xA;the same level is pointing to &lt;code&gt;$craftPath = './craft';&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;.htaccess&lt;/code&gt; is running&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;set folder permissions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Created MySQL database with new user&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Updated &lt;code&gt;db.php&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have tried &lt;code&gt;example.com/admin&lt;/code&gt; and&#xA;&lt;code&gt;example.com/index.php/admin&lt;/code&gt; and&#xA;&lt;code&gt;example.com/index.php?p=admin&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Have tried moving craft folder above root and updating &lt;code&gt;$craftPath&lt;/code&gt; but with no luck. Not sure what else to try?&lt;/p&gt;&#xA;" OwnerUserId="914" LastActivityDate="2014-10-22T21:05:11.010" Title="Apache 404 on basic install" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4298" PostTypeId="1" AcceptedAnswerId="4302" CreationDate="2014-10-22T19:50:03.370" Score="3" ViewCount="2088" Body="&lt;p&gt;I feel this a simple problem to fix, but I can't find an answer anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am developing locally on using MAMP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything on my site is working great until I call up page using a template inside a folder inside the templates directory. At that point the paths are broken to any and all assets (CSS, images, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I set the Entry Template for a section in Craft to say news/_entry and then view a news article page... I get an un-styled page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am including the CSS like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;../public/assets/css/nav.css&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the images like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;img src=&quot;../public/assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="921" LastEditorUserId="9" LastEditDate="2014-10-22T20:13:34.553" LastActivityDate="2015-09-12T15:56:13.937" Title="Path and Entry Template problems when developing locally" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4299" PostTypeId="1" AcceptedAnswerId="4314" CreationDate="2014-10-22T20:02:46.973" Score="3" ViewCount="702" Body="&lt;p&gt;I'm working on a bilingual site (&lt;code&gt;en&lt;/code&gt; and &lt;code&gt;cy&lt;/code&gt;) and have a news channel with entry urls &lt;code&gt;news/{slug}&lt;/code&gt; and the translated &lt;code&gt;cy/newyddion/{slug}&lt;/code&gt;. Everything is working well with entries and if the url is accessed without the slug then a list of entries is displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when accessing without the slug the translation of &lt;code&gt;news&lt;/code&gt; is &lt;code&gt;cy/news&lt;/code&gt; not &lt;code&gt;cy/newyddion&lt;/code&gt; as required. If I attempt to access &lt;code&gt;cy/newyddion&lt;/code&gt; I get a 404 not found error. I have tried different solutions such as adding files in &lt;code&gt;templates/cy/newyddion&lt;/code&gt; but still get 404s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I've got it to work is by adding a new single section named &lt;code&gt;news&lt;/code&gt; which has no content and loads the news index template and renaming the news section handle to avoid conflicts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to know is if there is a better way of accomplishing this as it seems like a cumbersome way of doing it.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2014-10-23T13:42:11.267" Title="Is there a better way to localise channel url?" Tags="&lt;url&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4301" PostTypeId="2" ParentId="4298" CreationDate="2014-10-22T20:11:37.530" Score="1" Body="&lt;p&gt;I would suggest using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includecssfile&quot; rel=&quot;nofollow&quot;&gt;includeCssFile Tag&lt;/a&gt; for your CSS files (there is another for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;js files&lt;/a&gt; for what ever it's worth)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example in your case you'd have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% includeCssFile &quot;/assets/css/nav.css&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I think that is correct though you might need to play with the path a bit. Specifically the first slash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the img tags you can probably get way with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;/assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or if you want you could add the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl Global Variable&lt;/a&gt; to the mix as well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ siteUrl }}assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: again you might need to play with the starting slash depending on your config setup and siteUrl ending with a slash or not:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ siteUrl }}/assets/images/swf_logo.png&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2014-10-22T20:29:05.030" LastActivityDate="2014-10-22T20:29:05.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4302" PostTypeId="2" ParentId="4298" CreationDate="2014-10-22T20:11:42.233" Score="5" Body="&lt;p&gt;Your image/CSS/JS URLs should be either absolute, protocol-relative, or root-relative:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;!-- absolute --&amp;gt;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://example.com/assets/css/nav.css&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;http://example.com/assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&#xA;&amp;lt;!-- protocol-relative --&amp;gt;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;//example.com/assets/css/nav.css&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;//example.com/assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&#xA;&amp;lt;!-- root-relative --&amp;gt;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/nav.css&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;/assets/images/swf_logo.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Relative URLs (which start with either &lt;code&gt;./&lt;/code&gt;, &lt;code&gt;../&lt;/code&gt;, or no slash at all) are generally a bad idea, since the URL will need to vary depending on the number of segments in your URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you were to access &lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;, the relative path to your nav.css would be &lt;code&gt;assets/css/nav.css&lt;/code&gt;, but if you were to access &lt;a href=&quot;http://example.com/about/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/about/&lt;/a&gt; (with a trailing slash), then the proper relative URL would be &lt;code&gt;../assets/css/nav.css&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That’s not to say that relative URLs are impossible. The main issue with your URLs is not that they’re relative, it’s that you’re treating them as relative from the &lt;em&gt;physical template file location&lt;/em&gt;. Keep in mind that these front-end resource URLs are resolved by the &lt;em&gt;browser&lt;/em&gt;, not by the server, and browsers have no idea how the resulting HTML gets generated, let alone that it came from a template that happened to live a couple directories up from your web root, and in a craft/templates/... subfolder. So they need to be relative based an the &lt;em&gt;apparent&lt;/em&gt; location of the webpage, as defined by its URI (e.g. “/news/some-slug”).&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-22T20:19:48.910" LastActivityDate="2014-10-22T20:19:48.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4303" PostTypeId="2" ParentId="4299" CreationDate="2014-10-22T20:36:41.493" Score="1" Body="&lt;p&gt;You can create &lt;code&gt;routes&lt;/code&gt; in the CP in settings&gt;routes and set the locale to which that route applies. For example in the settings window: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;If the URI looks like this: newyddion (with locale dropdown set to 'cy')&#xA;Load this template: news (or 'news/index.html')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more information have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routes documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-23T13:42:11.267" LastActivityDate="2014-10-23T13:42:11.267" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4304" PostTypeId="1" AcceptedAnswerId="4305" CreationDate="2014-10-22T20:43:48.167" Score="1" ViewCount="404" Body="&lt;p&gt;A client uses the 'Login as user' behaviour to be able to see what users of the site are seeing, useful as it's an e-learning site and each user can see different content based on their progress. The users however, are only allowed to view the public site and not anything in the CP which means when the 'Login as user' is invoked the client is presented with the '&lt;strong&gt;Unauthorized&lt;/strong&gt; You don’t have the proper credentials to access this page' message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this right? Looking through the code it seems the function &lt;code&gt;_handleSuccessfulLogin()&lt;/code&gt; is called and if the user cannot access the CP then they should be redirected to the &lt;code&gt;postLoginRedirect&lt;/code&gt; which in the case of this site is not set, so the user should be redirected to the homepage if I understand correctly.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-10-22T22:05:27.243" Title="Correct behaviour for 'Login as user' when user cannot access CP?" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-11-30T04:41:37.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="4305" PostTypeId="2" ParentId="4304" CreationDate="2014-10-22T20:57:17.983" Score="1" Body="&lt;p&gt;You're correct... it should be sending to &lt;code&gt;postLoginRedirect&lt;/code&gt;, but there is actually a bug where after impersonating:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the current user&#xA;$currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is returning a cached copy of the previous user (who had CP access).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will get that fixed for the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed for the next post &lt;a href=&quot;http://buildwithcraft.com/updates#build2596&quot; rel=&quot;nofollow&quot;&gt;2.2.2596&lt;/a&gt; release!&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-22T22:05:27.243" LastActivityDate="2014-10-22T22:05:27.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4306" PostTypeId="2" ParentId="4297" CreationDate="2014-10-22T21:05:11.010" Score="1" Body="&lt;p&gt;Ended up the document root was looking for &lt;code&gt;var/www/html&lt;/code&gt; instead of just &lt;code&gt;var/www&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fixed it for me &lt;a href=&quot;https://stackoverflow.com/a/23175981/851669&quot;&gt;https://stackoverflow.com/a/23175981/851669&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="914" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-10-22T21:05:11.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4307" PostTypeId="1" AcceptedAnswerId="4308" CreationDate="2014-10-22T23:32:19.460" Score="3" ViewCount="2618" Body="&lt;p&gt;First Craft install so please excuse me if this is a newbie Q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Templates are in /craft/templates. Is it possible to move those to a different location? Our other sites (EE) have templates stored with the UI theme source files so everything to do with the the site look and feel is in one place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-23T02:35:55.917" Title="Custom template location" Tags="&lt;templating&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4308" PostTypeId="2" ParentId="4307" CreationDate="2014-10-23T00:15:15.960" Score="10" Body="&lt;p&gt;The default template path can be changed by setting the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-templates-path&quot;&gt;&lt;code&gt;CRAFT_TEMPLATES_PATH&lt;/code&gt;&lt;/a&gt; PHP constant in your index.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_TEMPLATES_PATH', &quot;path/to/templates&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would recommend, however, that you start with the default path locations, until you are more comfortable with the app. There is a logical system in place which works really well once you get used to it. And you'll notice that the craft app folder (and all the plug-ins) are organized the same way, so once you start building your own sites and plugins it will all feel very integrated. Keep in mind the folder names also match the names of the controller classes, service classes, method names, etc. throughout the system which makes it easier to find your way around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to keep in mind is that placing your Craft templates in your web root would make the raw template files publicly accessible from a web browser. So if you decide to go this route, be sure to place a .htaccess file in your templates folder with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Deny from all&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will tell Apache to protect the files from direct HTTP traffic, even though they live within the web root.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="9" LastEditDate="2014-10-23T02:35:55.917" LastActivityDate="2014-10-23T02:35:55.917" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4309" PostTypeId="1" CreationDate="2014-10-23T06:16:00.983" Score="0" ViewCount="132" Body="&lt;p&gt;I would like to create an elementSelect form field in my plugin, and can't find an example or description. Can someone help?&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="115" LastEditDate="2015-02-20T01:23:51.463" LastActivityDate="2015-02-20T01:23:51.463" Title="How can I relate PDFs and Files using an Element Select field in my custom plugin?" Tags="&lt;templating&gt;&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4310" PostTypeId="2" ParentId="4261" CreationDate="2014-10-23T06:53:02.340" Score="0" Body="&lt;p&gt;Solved it for now by making the file input hidden first and only changing its type attribute to file (using jquery) once the asset get’s deleted, ajax-style.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-10-23T06:53:02.340" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4312" PostTypeId="1" AcceptedAnswerId="4313" CreationDate="2014-10-23T08:27:02.813" Score="1" ViewCount="72" Body="&lt;p&gt;Is there a way or an event available to detect changes on the fieldlayout of an entrytype? We've wrote a piece of middleware that needs to be informed of such changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Patrick &lt;/p&gt;&#xA;" OwnerUserId="571" LastActivityDate="2014-10-23T08:34:26.600" Title="Event when a sections' entry type changes layout?" Tags="&lt;entry-type&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4313" PostTypeId="2" ParentId="4312" CreationDate="2014-10-23T08:34:26.600" Score="1" Body="&lt;p&gt;Not right now, and technically Craft actually deletes the old Field Layout and creates a new one each time you save an Entry Type, since it would be more trouble than it’s worth to keep the old one and compare it to the new POST data for changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we could add a new &lt;code&gt;onSaveEntryType&lt;/code&gt; event to SectionsService, which would end up getting called whenever the Field Layout changes. I’ll add that to the 2.3 list.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-23T08:34:26.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4314" PostTypeId="2" ParentId="4299" CreationDate="2014-10-23T08:52:00.467" Score="3" Body="&lt;p&gt;In my experience, the easiest and best to maintain way to do this is to use entries only. If you make that news index page an entry (e.g. structure or single section) it is as easy as entering your translated slug in that entry's CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another advantage is that you can add fields to that entry (e.g. to edit the meta description or some copy), so this can make sense in many cases, not just for multilingual routing.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-23T08:52:00.467" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4315" PostTypeId="1" CreationDate="2014-10-23T08:53:44.723" Score="1" ViewCount="764" Body="&lt;p&gt;I'm using the default form found in the Craft CMS docs, however I'd like to create more fields other than username, password and email. How would I add more custom fields to capture user data like address, phone number etc?&lt;/p&gt;&#xA;" OwnerUserId="910" LastActivityDate="2014-10-23T10:49:15.203" Title="How do I add more account fields for user registration?" Tags="&lt;users&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4316" PostTypeId="1" AcceptedAnswerId="4319" CreationDate="2014-10-23T09:19:51.637" Score="3" ViewCount="904" Body="&lt;p&gt;I've been given a site and asked to prevent visitors from seeing the news archive beyond page 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The navigation has already been done, but if the user manually enters &lt;code&gt;example.com/news/p7&lt;/code&gt; they'll see it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s my template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').limit(3) %}&#xA;{% paginate entries as entries %}&#xA;    {% for entry in entries %}&#xA;        {% include '_elements/_news-entry' %}&#xA;    {% endfor %}&#xA;    {% include '_elements/_pagination' %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The _elements/_pagination include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;pagination&quot;&amp;gt;&#xA;{% for page, url in paginate.getPrevUrls(5) %}&#xA;    &amp;lt;a href=&quot;{{ url  }}&quot; class=&quot;button&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;strong&amp;gt;{{ paginate.currentPage }}&amp;lt;/strong&amp;gt;&#xA;&#xA;{% for page, url in paginate.getNextUrls(5) %}&#xA;    &amp;lt;a href=&quot;{{ url  }}&quot; class=&quot;button&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried adding the following to &lt;code&gt;/craft/config/routes.php&lt;/code&gt;, but it doesn't appear to have any effect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news/p[^1-6]' =&amp;gt; '404',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="926" LastEditorUserId="9" LastEditDate="2014-10-23T09:57:44.973" LastActivityDate="2014-10-23T09:57:44.973" Title="Limit entry pagination to 6 pages?" Tags="&lt;entries&gt;&lt;routes&gt;&lt;pagination&gt;&lt;404-page&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4317" PostTypeId="1" CreationDate="2014-10-23T09:20:43.413" Score="1" ViewCount="782" Body="&lt;p&gt;On this product list page: &lt;a href=&quot;https://www.alfa.no/shop/skisko/&quot; rel=&quot;nofollow&quot;&gt;https://www.alfa.no/shop/skisko/&lt;/a&gt; I need to add a size filter, to only show products that are size 45 for example AND that are in stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure is built with products and productVariants in separate channels, and productVariants (individual shoe sizes) are added to the product inside a matrix field (colorVariants), with sizes as related productVariants entries to each color. All those words look a little something like this:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/2kyvfxq7xv843v6/Screenshot_2014-10-23_09_53_00.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/2kyvfxq7xv843v6/Screenshot_2014-10-23_09_53_00.png?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I need in the template is to search for products that have a related productVariant in the colorVariants matrix, matching 45 in the variantSize field AND &gt; 0 in the variantStock field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have only come as far as being able to list products that match the size in the matrix, with a way too simple search. It searches for the size in the colorVariants matrix field, but the approach is not targeting specific fields, like stock, in the related productVariants entries in the colorVariants matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set filteredProductList = productList.search('colorVariants:45') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2014-10-27T12:03:48.813" Title="Search result based on a specific field in a related entry in a matrix" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4319" PostTypeId="2" ParentId="4316" CreationDate="2014-10-23T09:49:02.010" Score="3" Body="&lt;p&gt;First, I don’t think your pagination navigation is limiting to just 6 pages like you think it is. The number you pass into &lt;code&gt;paginate.getPrevUrls()&lt;/code&gt; and &lt;code&gt;paginate.getNextUrls()&lt;/code&gt; will determine how many URLs the functions should return. So if you’re on the 3rd page, calling &lt;code&gt;paginate.getNextUrls(5)&lt;/code&gt; will give you the URLs for pages 4-8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Navigation-wise, what you’re probably better off using is &lt;code&gt;paginate.getRangeUrls()&lt;/code&gt;, which accepts explicit first/last page numbers:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for page, url in paginate.getRangeUrls(1, 6) %}&#xA;    {% if page == paginate.currentPage %}&#xA;        &amp;lt;strong&amp;gt;{{ page }}&amp;lt;/strong&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;button&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(You can get a full breakdown of the properties/functions within that &lt;code&gt;paginate&lt;/code&gt; variable here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#the-paginate-variable)_&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/paginate#the-paginate-variable)&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even with that change, you’re not actually &lt;em&gt;enforcing&lt;/em&gt; that only 6 pages are available; there’s still nothing stopping a user from manually going to &lt;a href=&quot;http://example.com/news/p7&quot; rel=&quot;nofollow&quot;&gt;http://example.com/news/p7&lt;/a&gt;. The would still get the 7th page of news entries, with an awkward pagination navigation, because it would just show links to pages 1-6 with no indication that you’re on the 7th page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So back to your original question: how do we enforce a 6-page maximum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your idea of setting a route in craft/config/routes.php was a good one, but unfortunately Craft actually removes the “page” part of the URL from its internal path before it starts checking the path for matching routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of that, your best option here is to enforce it from the actual News template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can access the current page using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getPageNum&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getPageNum()&lt;/code&gt;&lt;/a&gt;, so let’s just check for that at the very top of your template, and if it’s greater than 6, return a 404 using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/exit&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% exit %}&lt;/code&gt;&lt;/a&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if craft.request.getPageNum() &amp;gt; 6 %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To clean things up a bit, you might want to store that maximum number of News entries as a variable within your template, or maybe even as a &lt;code&gt;'maxNewsPages'&lt;/code&gt; custom config variable in craft/config/general.php.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Pull the custom 'maxNewsPages' config setting from craft/config/general.php #}&#xA;{% set maxPages = craft.config.maxNewsPages %}&#xA;&#xA;{# Enforce it #}&#xA;{% if craft.request.getPageNum() &amp;gt; maxPages %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;...&#xA;&#xA;{% for page, url in paginate.getRangeUrls(1, maxPages) %}&#xA;    {% if page == paginate.currentPage %}&#xA;        &amp;lt;strong&amp;gt;{{ page }}&amp;lt;/strong&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;button&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-23T09:49:02.010" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4320" PostTypeId="2" ParentId="4315" CreationDate="2014-10-23T10:49:15.203" Score="3" Body="&lt;p&gt;Create the input fields as you would any other, maybe add them to a 'users' group, then you can go to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/admin/settings/users/fields&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and add them via the layout designer, you should then see them appear when viewing a user in the admin area, under the profile tab I believe :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-10-23T10:49:15.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4321" PostTypeId="1" CreationDate="2014-10-23T13:52:57.020" Score="1" ViewCount="58" Body="&lt;p&gt;I'm trying to call the addBlock function from the Matrix fieldtype. Whenever a block is added i need to run some basic javascript. &#xA;Does anyone have an idea how to go about this?&#xA;thanks!&lt;/p&gt;&#xA;" OwnerUserId="927" LastEditorUserId="125" LastEditDate="2014-10-23T15:49:33.083" LastActivityDate="2015-06-21T14:27:25.647" Title="Extending the matrixinput class" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4323" PostTypeId="1" CreationDate="2014-10-23T14:48:21.073" Score="0" ViewCount="237" Body="&lt;p&gt;Anyone have any luck getting a localized Craft build working with a localized Vanilla Forums install?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got MAMP installed, in conjunction with CodeKit. Craft itself is running fine. I installed the Vanilla Forums directory under the Templates directory. Whenever I visit craft.dev/vanilla(MAMP) or macbook.local:5757/vanilla (CodeKit) in my browser, I get a Page Not Found error. If I go straight to the index.php file, it spews out the actual ph&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2014-10-23T15:30:18.500" Title="Localized Craft Build with Vanilla Forums?" Tags="&lt;mamp&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4325" PostTypeId="2" ParentId="4323" CreationDate="2014-10-23T15:30:18.500" Score="2" Body="&lt;p&gt;If you install a secondary app within your Craft directory, you have to tell Craft to ignore all these requests. Just edit your &lt;code&gt;.htaccess&lt;/code&gt; file accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See my answer here on how you can do this: &lt;a href=&quot;https://craftcms.stackexchange.com/q/1964/125&quot;&gt;&quot;Is it possible to tell Craft to ignore requests to under a certain path?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-23T15:30:18.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4326" PostTypeId="1" AcceptedAnswerId="4327" CreationDate="2014-10-23T15:57:34.157" Score="0" ViewCount="91" Body="&lt;p&gt;Is there a way to detect if a entry is being saved as a draft vs being published so when onAfterElementSave is called, so I don't save data to the database when it is a draft.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-10-23T16:16:39.307" Title="When onAfterElementSave is called check for save as draft or publishing?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4327" PostTypeId="2" ParentId="4326" CreationDate="2014-10-23T16:16:39.307" Score="1" Body="&lt;p&gt;Actually, onAfterElementSave doesn't get called at all when saving a draft, so there's nothing to worry about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you load a draft in the CP, your field type will be passed in a $value based on the POST data for the field back when the draft was last saved (which is the same thing that happens when saving an entry fails due to validation errors).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-23T16:16:39.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4328" PostTypeId="1" AcceptedAnswerId="4447" CreationDate="2014-10-23T16:59:48.490" Score="2" ViewCount="823" Body="&lt;p&gt;I am attempting to add a second locale to a site with existing content, much of that content in matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the documentation for &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;Setting Up a Localized Site&lt;/a&gt;, I have defined the locale, enabled all sections for this locale (and the original one), set up the configuration and the index.php files. What I have not yet done is mark any field as translatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I was expecting is that entries in the new locale would be initialized with content from the original locale. And this has happened, &lt;em&gt;except&lt;/em&gt; that the matrix fields have not been duplicated, so the entries in the new locale do not have any of that matrix content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is very similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1709/how-do-i-get-matrix-elements-to-copy-their-content-across-language-locales&quot;&gt;How do I get Matrix elements to copy their content across language Locales?&lt;/a&gt;. The answer there is &quot;don't mark matrix fields as translatable&quot;, which I haven't done, so not sure why this isn't working for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clues?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-10-29T22:24:04.243" Title="Added Locale, matrix content not copied" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ClosedDate="2014-11-07T00:05:26.980" ContentLicense="CC BY-SA 3.0" />
  <row Id="4329" PostTypeId="1" AcceptedAnswerId="4338" CreationDate="2014-10-23T17:13:12.417" Score="3" ViewCount="1707" Body="&lt;p&gt;I continue to see these pile up. If I clear my template cache, I can hit retry on each and they go away, but that's getting tedious.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PNUVT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have the following from a P&amp;amp;T support request on these a while back, but is there any way to track down where/why these are happening now? I'm not seeing any deprecated tag errors or anything in the CP, nor am I seeing any template errors on the site, and I have a fair number of pages cached where images are being resized.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Hrm... I see the error that's occurring in your log files when that task tries to complete. What looks like happened was that there was an error in your Twig code somewhere inside of one of your {% cache %} tags and that error actually got cached and saved to the database and that is freaking the DeleteStaleTemplatesCache task out.&lt;/p&gt;&#xA;&lt;p&gt;Kinda hard to back track which cache tag it occurred in and what part of your template code.&lt;/p&gt;&#xA;&lt;p&gt;But the way to get it worked again is to clear your template caches manually from Settings-&amp;gt;Tools. You should be able to click &amp;quot;retry&amp;quot; on those failed tasks again and they should complete fine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-10-24T17:28:13.217" Title="Deleting Stale Template Caches Failed" Tags="&lt;control-panel&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4330" PostTypeId="1" AcceptedAnswerId="4421" CreationDate="2014-10-23T19:23:29.927" Score="0" ViewCount="766" Body="&lt;p&gt;Just deployed to a server which has the following open_basedir setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{DOCROOT}/:/usr/tmp:/var/www/vhosts/mydomain.com/httpdocs/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The webroot is at &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/vhosts/mydomain.com/httpdocs/public_html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and craft is at&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/vhosts/mydomain.com/httpdocs/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all standard however I'm still getting this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/vhosts/domain.com/httpdocs/public_html/index.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any suggestions please?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-28T19:56:02.273" Title="Problem with open_basedir?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4332" PostTypeId="1" AcceptedAnswerId="4333" CreationDate="2014-10-23T22:45:06.003" Score="12" ViewCount="2187" Body="&lt;p&gt;This question is similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4315/how-do-i-add-more-account-fields-for-user-registration&quot;&gt;this&lt;/a&gt; post, but more of the next logical step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added custom fields to my user profiles, but would like these attributes to be part of the registration page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I'd like the user to specify their address on sign up, but I haven't found a way to reference this field correctly in the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;Address&quot;&amp;gt;Address&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;Address&quot; type=&quot;text&quot; name=&quot;Address&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.Address}}&quot;{% endif -%}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('Address')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work because account.Address doesn't seem to be the correct way to access custom user fields on registration, and the only way I currently know how to access this field would be through currentUser.Address, but that relies on the account all ready being created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to access these fields to save during registration, or am I going to have to create the account first then have a second page that allows the user to set these fields?&lt;/p&gt;&#xA;" OwnerUserId="930" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-06-17T16:00:18.133" Title="How to add custom user fields to the front end registration page" Tags="&lt;users&gt;&lt;registration&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4333" PostTypeId="2" ParentId="4332" CreationDate="2014-10-23T23:15:51.297" Score="17" Body="&lt;p&gt;You need to change your input tag from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;Address&quot; type=&quot;text&quot; name=&quot;Address&quot;&#xA;{%- if account is defined %} value=&quot;{{ account.Address}}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;Address&quot; type=&quot;text&quot; name=&quot;fields[Address]&quot;&#xA;{%- if account is defined %} value=&quot;{{ account.Address}}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All custom fields input types should have a name prefixed with &lt;code&gt;fields[]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4433" LastEditDate="2016-06-17T16:00:18.133" LastActivityDate="2016-06-17T16:00:18.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4334" PostTypeId="1" AcceptedAnswerId="4335" CreationDate="2014-10-24T03:38:23.923" Score="4" ViewCount="1656" Body="&lt;p&gt;I have a structure that goes up to 4 levels deep. Each page has a field for a 'hero' image. If a child page does not have this field filled out I would like to traverse up the structure and find the closest parent entry with this field set. Basically some 'sections' would have a default hero image added to the top level parent while others may have a specific image for each child page.&lt;/p&gt;&#xA;" OwnerUserId="887" LastEditorUserId="9" LastEditDate="2014-10-24T12:25:53.957" LastActivityDate="2017-10-25T12:30:40.760" Title="How do I find the closest parent entry with an Assets field filled in?" Tags="&lt;entries&gt;&lt;structure&gt;&lt;field&gt;&lt;elementcriteriamodel&gt;&lt;children&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4335" PostTypeId="2" ParentId="4334" CreationDate="2014-10-24T09:59:28.883" Score="6" Body="&lt;p&gt;You can get your entry's parent entry with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getParent&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getParent()&lt;/code&gt;&lt;/a&gt;. Use this entry method in a conditional, if your entry has no hero image set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can nest the code to climb up all of your structure's levels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Check if entry has hero image #}&#xA;{% if entry.hero.first() %}&#xA;    {{ entry.hero.first().url }}&#xA;{% else %}&#xA;&#xA;    {# Check the parent entry #}&#xA;    {% if entry.getParent().hero.first() %}&#xA;        {{ entry.getParent().hero.first().url }}&#xA;    {% else %}&#xA;&#xA;        {# Check the entry 2 levels above #}&#xA;        {% if entry.getParent().getParent().hero.first() %}&#xA;            {{ entry.getParent().getParent().hero.first().url }}&#xA;        {% else %}&#xA;&#xA;            {# ... Oh no, we're not finished yet :( #}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, that's not good code. That's why I recommend to use the same technique in &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a macro&lt;/a&gt;, that you can call recursively:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro showHero(thisRecursionEntryModel) %}&#xA;&#xA;    {% import _self as self %}&#xA;&#xA;    {# Check if entry has hero image #}&#xA;    {% if thisRecursionEntryModel.hero.first() %}&#xA;        {{ thisRecursionEntryModel.hero.first().url }}&#xA;    {% else %}&#xA;&#xA;        {# Check the entry's ancestors recursively #}&#xA;        {% if thisRecursionEntryModel.getParent() %}&#xA;            {{ self.showHero(thisRecursionEntryModel.getParent()) }}&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&#xA;{% import _self as self %}&#xA;{{ self.showHero(entry) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also import the macro from a file, if you want to use it in more than one template file or just like your code to be modular:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_includes/macros.html' as macros %}&#xA;{{ macros.showHero(entry) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-10-25T12:30:40.760" LastActivityDate="2017-10-25T12:30:40.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4336" PostTypeId="1" AcceptedAnswerId="4340" CreationDate="2014-10-24T11:43:15.820" Score="0" ViewCount="1193" Body="&lt;p&gt;Getting the above error when trying to add a new entry to a structure section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Section has an Entry URL Format of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{siteUrl}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php in the config folder I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;            'omitScriptNameInUrls' =&amp;gt; true,&#xA;        ),&#xA;&#xA;&#xA;    'local.ontherocks.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; 'C:/Users/User/Documents/My Websites/Sitename/public/',&#xA;            'baseUrl'  =&amp;gt; 'http://local.ontherocks.dev/',&#xA;            'siteUrl'  =&amp;gt; 'http://local.ontherocks.dev/',&#xA;        )   &#xA;    )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't see why I am getting this error - I have the same set up in another site I did.&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="57" LastEditDate="2014-10-24T17:16:33.530" LastActivityDate="2014-10-24T17:16:33.530" Title="Craft\EntryModel and its behaviors do not have a method or closure named &quot;siteUrl&quot;" Tags="&lt;entrymodel&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4337" PostTypeId="2" ParentId="4317" CreationDate="2014-10-24T11:48:30.117" Score="1" Body="&lt;p&gt;Yes, you're right to better not use the search parameter for such things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead get all the product variants that match your criteria first (e.g. size, color) and then query for all related products. Be careful with the field parameter, as your relation is between a Matrix field and your product variant entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code is not tested (as you might guess, hehe):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('skisko').first() %}&#xA;&#xA;{% set sizeParam = craft.request.getParam('size') %}&#xA;{% set colorParam = craft.request.getParam('color') %}&#xA;&#xA;{#&#xA; # Get product variants matching our search&#xA; #}&#xA;&#xA;{% set variantParams = {&#xA;    section: 'productVariants',&#xA;    variantStock: '&amp;gt; 0',&#xA;    variantSize: sizeParam,&#xA;    variantColor: colorParam,&#xA;} %}&#xA;&#xA;{% set variants = craft.entries(variantParams) %}&#xA;&#xA;{#&#xA; # Get the products related to these variants&#xA; #}&#xA;&#xA;{% set productParams = {&#xA;    section: 'products',    &#xA;    relatedTo: [&#xA;        'and',&#xA;        {&#xA;            targetElement: variants,&#xA;            field: 'colorVariants.myRelationField',&#xA;        },&#xA;        {&#xA;            targetElement: category,&#xA;            field: 'myCategoryRelationField',&#xA;        }&#xA;    ]&#xA;} %}&#xA;&#xA;{% set products = craft.entries(productParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-27T12:03:48.813" LastActivityDate="2014-10-27T12:03:48.813" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4338" PostTypeId="2" ParentId="4329" CreationDate="2014-10-24T11:55:06.990" Score="6" Body="&lt;p&gt;When a task actually fails (as opposed to getting &lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;noreferrer&quot;&gt;stuck&lt;/a&gt;), Craft will log an error message explaining why. To fish it up, open craft/storage/runtime/logs/craft.log, and search for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Encountered an error running task&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each time the task runner encounters an error, its log message will begin with that, followed by the task’s ID, its type, which step it was on (if applicable), and the error message the actual task returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’re not seeing it, check craft.log.1, craft.log.2, etc.  &lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-24T17:28:13.217" LastActivityDate="2014-10-24T17:28:13.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4339" PostTypeId="2" ParentId="4334" CreationDate="2014-10-24T12:21:49.053" Score="5" Body="&lt;p&gt;Another way to do this would be to assemble a list of the entry IDs that you want to look for a hero image in, in order, and then finding the first hero image related to one of those entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create that list of entry IDs, we start by creating an array of the current entry’s ID, and &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; it with an array of the entry’s &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getAncestors&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancestors’&lt;/a&gt; IDs in &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/reverse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;reverse&lt;/code&gt;&lt;/a&gt; order:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set ancestorIds = entry.getAncestors().ids() %}&#xA;{% set entryIds = [ entry.id ]|merge( ancestorIds|reverse ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now that we have our list of entry IDs that could have the hero image, next up we need to find the first one that actually has one. We can do that with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt; and passing &lt;code&gt;:notempty:&lt;/code&gt; to the relational field param:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set heroEntry = craft.entries({&#xA;    id: entryIds,&#xA;    fixedOrder: true,&#xA;    hero: ':notempty:',&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There’s a chance that no entry was found, so before you start interacting with &lt;code&gt;heroEntry&lt;/code&gt; you should make sure that &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#first&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;first()&lt;/code&gt;&lt;/a&gt; actually returned something.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if heroEntry %}&#xA;    &amp;lt;img src=&quot;{{ heroEntry.hero.first().url }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="125" LastEditDate="2017-10-25T12:24:21.003" LastActivityDate="2017-10-25T12:24:21.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4340" PostTypeId="2" ParentId="4336" CreationDate="2014-10-24T12:30:06.250" Score="1" Body="&lt;p&gt;Environment variables are only available in specific settings, and Entry URL Formats are not one of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s no need to include your Site URL in there anyway, though. The field’s label might be a little misleading – it’s really more of a &lt;em&gt;URI&lt;/em&gt; format than a &lt;em&gt;URL&lt;/em&gt; format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your entries to get URLs like &lt;a href=&quot;http://example.com/entry-slug&quot; rel=&quot;nofollow&quot;&gt;http://example.com/entry-slug&lt;/a&gt;, then all you need to put in your section’s Entry URL Format setting is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-24T12:30:06.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4341" PostTypeId="1" AcceptedAnswerId="4979" CreationDate="2014-10-24T12:50:47.720" Score="1" ViewCount="152" Body="&lt;p&gt;&lt;code&gt;asset.getNext().fieldName&lt;/code&gt; does not work but might help explain what I was aiming for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more specific, for where there are multiple images in an entry, I want to assign a class to each depending on its next image’s field value. Also, the field I’m trying to get a value from is a radio field.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2014-10-24T13:25:40.633" LastActivityDate="2014-11-28T10:55:09.303" Title="How to get a field value from next/prev asset" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4342" PostTypeId="1" CreationDate="2014-10-24T13:06:04.867" Score="1" ViewCount="148" Body="&lt;p&gt;I'm currently working on integration some caching behaviour using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tags. This works mostly just fine, but I have some issues when I work with related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have a list of categories with an indicator to show many entries they are assigned to.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;New (3)&lt;/li&gt;&#xA;&lt;li&gt;Used (2)&lt;/li&gt;&#xA;&lt;li&gt;Broken (3)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I change an entry and add a category, the cache refreshes and shows the correct amount. But if I remove a category from an entry I get the wrong number until I refresh the cache manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the expected behaviour? Or do I miss something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache unless not craft.config.cache %}&#xA;{% set categorySlug = productSection ~ 'Categories' %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;{% for category in craft.categories.group(categorySlug) %}&#xA;  {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;  {% if entryCount &amp;gt; 0 %}&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;      {{ category.title }} ( {{ entryCount }} )&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="149" LastEditorUserId="115" LastEditDate="2015-02-09T02:47:46.300" LastActivityDate="2015-02-09T02:47:46.300" Title="Caching and related Entries" Tags="&lt;templating&gt;&lt;relations&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4343" PostTypeId="1" AcceptedAnswerId="4350" CreationDate="2014-10-24T13:34:07.077" Score="6" ViewCount="1072" Body="&lt;p&gt;Following up on: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4329/deleting-stale-template-caches-failed&quot;&gt;Deleting Stale Template Caches Failed&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'm assuming is the tag throwing the error in the DeleteStaleTemplateCaches task. How would I disambiguate this? I'm not sure dateCreated desc is the default for relatedTo/assets, either.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.relatedTo(tags).order('dateCreated desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the log error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/10/23 17:10:34 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous. The SQL statement executed was: SELECT `elements`.`id`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;LEFT JOIN `craft_relations` `sources1` ON (sources1.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets1` ON (targets1.sourceId = elements.id)&#xA;JOIN `craft_assetfiles` `assetfiles` ON assetfiles.id = elements.id&#xA;WHERE (((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements.enabled = 1)) AND (elements_i18n.enabled = 1)) AND (((sources1.sourceId=:sources1sourceId1) OR (sources1.sourceId=:sources1sourceId2) OR (sources1.sourceId=:sources1sourceId3) OR (sources1.sourceId=:sources1sourceId4) OR (sources1.sourceId=:sources1sourceId5) OR (sources1.sourceId=:sources1sourceId6) OR (sources1.sourceId=:sources1sourceId7) OR (sources1.sourceId=:sources1sourceId8) OR (sources1.sourceId=:sources1sourceId9) OR (sources1.sourceId=:sources1sourceId10) OR (sources1.sourceId=:sources1sourceId11) OR (sources1.sourceId=:sources1sourceId12) OR (sources1.sourceId=:sources1sourceId13) OR (sources1.sourceId=:sources1sourceId14) OR (sources1.sourceId=:sources1sourceId15) OR (sources1.sourceId=:sources1sourceId16) OR (sources1.sourceId=:sources1sourceId17) OR (sources1.sourceId=:sources1sourceId18) OR (sources1.sourceId=:sources1sourceId19) OR (sources1.sourceId=:sources1sourceId20) OR (sources1.sourceId=:sources1sourceId21) OR (sources1.sourceId=:sources1sourceId22) OR (sources1.sourceId=:sources1sourceId23) OR (sources1.sourceId=:sources1sourceId24) OR (sources1.sourceId=:sources1sourceId25) OR (sources1.sourceId=:sources1sourceId26) OR (sources1.sourceId=:sources1sourceId27) OR (sources1.sourceId=:sources1sourceId28) OR (sources1.sourceId=:sources1sourceId29) OR (sources1.sourceId=:sources1sourceId30) OR (sources1.sourceId=:sources1sourceId31) OR (sources1.sourceId=:sources1sourceId32) OR (sources1.sourceId=:sources1sourceId33) OR (sources1.sourceId=:sources1sourceId34) OR (sources1.sourceId=:sources1sourceId35) OR (sources1.sourceId=:sources1sourceId36) OR (sources1.sourceId=:sources1sourceId37) OR (sources1.sourceId=:sources1sourceId38) OR (sources1.sourceId=:sources1sourceId39) OR (sources1.sourceId=:sources1sourceId40) OR (sources1.sourceId=:sources1sourceId41) OR (sources1.sourceId=:sources1sourceId42) OR (sources1.sourceId=:sources1sourceId43) OR (sources1.sourceId=:sources1sourceId44) OR (sources1.sourceId=:sources1sourceId45) OR (sources1.sourceId=:sources1sourceId46) OR (sources1.sourceId=:sources1sourceId47) OR (sources1.sourceId=:sources1sourceId48) OR (sources1.sourceId=:sources1sourceId49) OR (sources1.sourceId=:sources1sourceId50) OR (sources1.sourceId=:sources1sourceId51) OR (sources1.sourceId=:sources1sourceId52) OR (sources1.sourceId=:sources1sourceId53) OR (sources1.sourceId=:sources1sourceId54) OR (sources1.sourceId=:sources1sourceId55) OR (sources1.sourceId=:sources1sourceId56) OR (sources1.sourceId=:sources1sourceId57) OR (sources1.sourceId=:sources1sourceId58) OR (sources1.sourceId=:sources1sourceId59) OR (sources1.sourceId=:sources1sourceId60) OR (sources1.sourceId=:sources1sourceId61) OR (sources1.sourceId=:sources1sourceId62) OR (sources1.sourceId=:sources1sourceId63) OR (sources1.sourceId=:sources1sourceId64)) OR ((targets1.targetId=:targets1targetId1) OR (targets1.targetId=:targets1targetId2) OR (targets1.targetId=:targets1targetId3) OR (targets1.targetId=:targets1targetId4) OR (targets1.targetId=:targets1targetId5) OR (targets1.targetId=:targets1targetId6) OR (targets1.targetId=:targets1targetId7) OR (targets1.targetId=:targets1targetId8) OR (targets1.targetId=:targets1targetId9) OR (targets1.targetId=:targets1targetId10) OR (targets1.targetId=:targets1targetId11) OR (targets1.targetId=:targets1targetId12) OR (targets1.targetId=:targets1targetId13) OR (targets1.targetId=:targets1targetId14) OR (targets1.targetId=:targets1targetId15) OR (targets1.targetId=:targets1targetId16) OR (targets1.targetId=:targets1targetId17) OR (targets1.targetId=:targets1targetId18) OR (targets1.targetId=:targets1targetId19) OR (targets1.targetId=:targets1targetId20) OR (targets1.targetId=:targets1targetId21) OR (targets1.targetId=:targets1targetId22) OR (targets1.targetId=:targets1targetId23) OR (targets1.targetId=:targets1targetId24) OR (targets1.targetId=:targets1targetId25) OR (targets1.targetId=:targets1targetId26) OR (targets1.targetId=:targets1targetId27) OR (targets1.targetId=:targets1targetId28) OR (targets1.targetId=:targets1targetId29) OR (targets1.targetId=:targets1targetId30) OR (targets1.targetId=:targets1targetId31) OR (targets1.targetId=:targets1targetId32) OR (targets1.targetId=:targets1targetId33) OR (targets1.targetId=:targets1targetId34) OR (targets1.targetId=:targets1targetId35) OR (targets1.targetId=:targets1targetId36) OR (targets1.targetId=:targets1targetId37) OR (targets1.targetId=:targets1targetId38) OR (targets1.targetId=:targets1targetId39) OR (targets1.targetId=:targets1targetId40) OR (targets1.targetId=:targets1targetId41) OR (targets1.targetId=:targets1targetId42) OR (targets1.targetId=:targets1targetId43) OR (targets1.targetId=:targets1targetId44) OR (targets1.targetId=:targets1targetId45) OR (targets1.targetId=:targets1targetId46) OR (targets1.targetId=:targets1targetId47) OR (targets1.targetId=:targets1targetId48) OR (targets1.targetId=:targets1targetId49) OR (targets1.targetId=:targets1targetId50) OR (targets1.targetId=:targets1targetId51) OR (targets1.targetId=:targets1targetId52) OR (targets1.targetId=:targets1targetId53) OR (targets1.targetId=:targets1targetId54) OR (targets1.targetId=:targets1targetId55) OR (targets1.targetId=:targets1targetId56) OR (targets1.targetId=:targets1targetId57) OR (targets1.targetId=:targets1targetId58) OR (targets1.targetId=:targets1targetId59) OR (targets1.targetId=:targets1targetId60) OR (targets1.targetId=:targets1targetId61) OR (targets1.targetId=:targets1targetId62) OR (targets1.targetId=:targets1targetId63) OR (targets1.targetId=:targets1targetId64)))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `dateCreated` DESC LIMIT 100.&#xA;2014/10/23 17:10:34 [error] [application] Encountered an error running task 778 (DeleteStaleTemplateCaches), step 26 of 351: An exception was thrown: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-24T23:15:51.030" Title="How to fix &quot;ambiguous&quot; column error generated when DeleteStaleTemplateCaches is run?" Tags="&lt;assets&gt;&lt;relations&gt;&lt;cache&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4344" PostTypeId="1" CreationDate="2014-10-24T13:40:50.467" Score="3" ViewCount="892" Body="&lt;p&gt;I'm trying to determine if I can update this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;[&#xA;{% set tags = craft.tags.group('color','season','style','venue').limit(null) %}&#xA;{% for image in craft.assets.relatedTo(tags).order('elements.dateCreated desc') %}&#xA;{% set thumbParams = {&#xA;    width: 300,&#xA;    height:300,&#xA;    mode: 'crop'&#xA;} %}&#xA;{% set smallParams = {&#xA;    width: 768,&#xA;    mode: 'fit'&#xA;} %}&#xA;    {&#xA;        &quot;url&quot;: &quot;{{ image.url }}&quot;,&#xA;        &quot;filename&quot;: &quot;{{ image.filename }}&quot;,&#xA;        &quot;imageTitle&quot;: &quot;{{ image.imageTitle }}&quot;,&#xA;        &quot;imageThumb&quot;: &quot;{{ image.getUrl(thumbParams) }}&quot;,&#xA;        &quot;tagsColor&quot;: [&#xA;{% for tag in image.tagsColor %}&#xA;        {&#xA;            &quot;slug&quot;: &quot;{{ tag | slugify }}&quot;,&#xA;            &quot;tag&quot;:  &quot;{{ tag }}&quot;&#xA;        }{% if not (loop.last) %},{% endif %}&#xA;&#xA;{% endfor %}&#xA;        ],&#xA;&#xA;        &quot;tagsSeason&quot;: [&#xA;{% for tag in image.tagsSeason %}&#xA;            {&#xA;            &quot;slug&quot;: &quot;{{ tag | slugify }}&quot;,&#xA;            &quot;tag&quot;:  &quot;{{ tag }}&quot;&#xA;            }{% if not (loop.last) %},{% endif %}&#xA;&#xA;{% endfor %}&#xA;        ],&#xA;&#xA;        &quot;tagsStyle&quot;: [&#xA;{% for tag in image.tagsStyle %}&#xA;            {&#xA;            &quot;slug&quot;: &quot;{{ tag | slugify }}&quot;,&#xA;            &quot;tag&quot;:  &quot;{{ tag }}&quot;&#xA;            }{% if not (loop.last) %},{% endif %}&#xA;&#xA;{% endfor %}&#xA;        ],&#xA;&#xA;        &quot;tagsVenue&quot;: [&#xA;{% for tag in image.tagsVenue %}&#xA;            {&#xA;            &quot;slug&quot;: &quot;{{ tag | slugify }}&quot;,&#xA;            &quot;tag&quot;:  &quot;{{ tag }}&quot;&#xA;            }{% if not (loop.last) %},{% endif %}&#xA;&#xA;{% endfor %}&#xA;        ]&#xA;&#xA;    }{% if not loop.last %},&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;]&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To randomize the order of images. Is that possible with &lt;code&gt;.order&lt;/code&gt; and is that possible within cached template code? (As random would be &quot;new&quot; every instance.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I have the image crops and tag lookups inside the cached code, as those are intensive. The first answer, to shuffle the images after fetching them within the cached code, won't work, because the &lt;code&gt;for&lt;/code&gt; loop on the image set is what needs to be cached.&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="187" LastEditDate="2014-10-27T16:15:41.080" LastActivityDate="2014-10-28T08:25:42.150" Title="Can random be used for ordering with related/assets, in cached code?" Tags="&lt;templating&gt;&lt;cache&gt;&lt;ordering&gt;&lt;random&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4345" PostTypeId="1" AcceptedAnswerId="4390" CreationDate="2014-10-24T14:29:25.143" Score="2" ViewCount="60" Body="&lt;p&gt;I've found the need lately for a way to represent complex fieldtypes like Matrix, Entries, etc as strings. e.g. in the following plugins:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/auditlog&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/auditlog&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/export&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently, it seems like you have to more or less account for every fieldtype and do some special processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if there is a method that every fieldtype can use (&lt;code&gt;__toString&lt;/code&gt; or other) to do this kind of thing in a unified manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking at how Craft does the Matrix &quot;preview&quot; for collapsed rows, but I think that's just all JS.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="125" LastEditDate="2014-10-24T20:47:23.500" LastActivityDate="2014-10-28T09:28:53.840" Title="Is there a prescribed way to to represent complex field types as strings?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;fieldtypes&gt;&lt;string&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4346" PostTypeId="2" ParentId="4341" CreationDate="2014-10-24T15:11:24.737" Score="1" Body="&lt;p&gt;I never used that &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#getNext&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; method with &lt;code&gt;craft.asset&lt;/code&gt;, but maybe it works if you explicitly feed it with parameters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is to use loop variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myClass = not loop.last and entry.myAssets[loop.index].fieldName == '1' ? ' YEY' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-24T15:11:24.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4348" PostTypeId="1" AcceptedAnswerId="4552" CreationDate="2014-10-24T16:22:20.743" Score="6" ViewCount="1902" Body="&lt;p&gt;Initially I was doing &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;getAttributes()&lt;/code&gt;, but noticed my Matrix fields were all &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the right way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that &lt;code&gt;$entry-&amp;gt;myMatrixField&lt;/code&gt; gives me the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; for my Matrix that I need, I thought that would be the same as using `getAttribute('myMatrixField'), but i guess not.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="125" LastEditDate="2014-10-24T20:46:15.100" LastActivityDate="2015-04-16T12:59:07.057" Title="Getting all content, including Matrix fields from an EntryModel" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;entrymodel&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4349" PostTypeId="1" AcceptedAnswerId="4352" CreationDate="2014-10-24T16:22:50.043" Score="2" ViewCount="288" Body="&lt;p&gt;Been looking at porting a site from EE to Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a custom module that accepts a POST and then stores that data in fields in a particular channel. The mappings are stored in extension settings so there are no hardcoded field IDs in the module code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, how would we go about that? I can see that we'd need to have a controller method that would be publicly accessibly but am unsure if we can easily use Entries or if we need a custom table with fields, field layout etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case is a job board. Jobs are just entries in that they have a job title, body, summary, salary range, blah blah blah, and CMS users should be able to create jobs in Craft, so just a channel looks fine. The only addition is that a third party needs to post data to the channel to create jobs too, hence the need for the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please advise the best approach here? The bit I'm stuck on is either creating mappings in the plugin settings that link the posted data with fields created in the channel, or on showing a template where the CMS user can create and edit jobs using the standard Craft field layout UI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that all makes sense!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-24T18:51:20.693" Title="Posting remotely - to fields in a channel or a plugin's fields?" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4350" PostTypeId="2" ParentId="4343" CreationDate="2014-10-24T17:12:12.513" Score="6" Body="&lt;p&gt;Give this a whirl, Mark:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.relatedTo(tags).order('elements.dateCreated desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-24T17:12:12.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4351" PostTypeId="2" ParentId="492" CreationDate="2014-10-24T17:40:37.100" Score="3" Body="&lt;p&gt;For anyone else interested my issue was not the PHP limit but a limitation of NGINX, there is a setting which needs increased from the default value to allow uploading of larger files, client_max_body_size.&lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-10-24T17:40:37.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4352" PostTypeId="2" ParentId="4349" CreationDate="2014-10-24T18:45:23.547" Score="2" Body="&lt;p&gt;I'm not sure if this is the 'best' approach, but you can definitely accomplish this without creating your own tables, unless you have some other specific need. In your plugin &lt;code&gt;defineSettings&lt;/code&gt; method you could either define individual fields (if the entry fields are predetermined) or a table field (if both the post data and entry fields should be configurable) to store field mappings. In your public controller method you can then map the post data to your entry's fields via the settings that you defined, perform other security/data checks, etc. and save the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plugin's controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveJob()&#xA;{    &#xA;    // get 'post to field' mappings from plugin settings&#xA;    $pluginSettings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('JobPostPlugin')-&amp;gt;getSettings();&#xA;    $titlePostVar   = $pluginSettings-&amp;gt;titlePostVar;&#xA;    $bodyPostVar    = $pluginSettings-&amp;gt;bodyPostVar;&#xA;    $summaryPostVar = $pluginSettings-&amp;gt;summaryPostVar;&#xA;&#xA;    // retrieve post data&#xA;    $title   = craft()-&amp;gt;request-&amp;gt;getPost($titlePostVar);&#xA;    $body     = craft()-&amp;gt;request-&amp;gt;getPost($bodyPostVar);&#xA;    $summary = craft()-&amp;gt;request-&amp;gt;getPost($summaryPostVar);&#xA;&#xA;    // create a new entry&#xA;    $entry = new EntryModel(); &#xA;    $entry-&amp;gt;sectionId  = 2; &#xA;    $entry-&amp;gt;typeId     = 2; &#xA;    $entry-&amp;gt;authorId   = 1; &#xA;    $entry-&amp;gt;enabled    = true;&#xA;&#xA;    // set entry content&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(     &#xA;        'title'     =&amp;gt; $title,     &#xA;        'body'      =&amp;gt; $body,&#xA;        'summary'   =&amp;gt; $summary, &#xA;    ));&#xA;&#xA;    // save the entry&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but should be more or less correct. If anyone sees an error please comment or feel free to edit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would also want to add conditions to ensure that the post data exists and that it is formatted correctly, and that whatever security conditions you've established are met, and perhaps record/return success and or errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity I have shown this all happening in a controller action, however, I think the recommended approach would be to separate this between a controller and a corresponding service, so that the controller is never actually modifying the DB.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-24T18:51:20.693" LastActivityDate="2014-10-24T18:51:20.693" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="4353" PostTypeId="1" CreationDate="2014-10-24T20:23:48.337" Score="4" ViewCount="2616" Body="&lt;p&gt;I want to be able to render a template in the main 'templates' directory from within a plugin controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the controller gets the url request, does some work and then renders a template saved in the 'craft/templates' directory instead of the 'plugin/templates' directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the plugin path trick mentioned on this page &lt;a href=&quot;https://craftcms.com/docs/plugins/templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/templates&lt;/a&gt; without any success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:31.833" LastActivityDate="2017-10-26T09:27:31.833" Title="renderTemplate in a plugin for front end request using front end template" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4354" PostTypeId="1" AcceptedAnswerId="4355" CreationDate="2014-10-24T20:31:45.257" Score="5" ViewCount="932" Body="&lt;p&gt;In the CP there is a button which allows you to log in as a specific user. Can this be called from the Frontend/plugin or is it strictly a CP function?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-10-24T21:16:44.730" Title="Login As User from Frontend" Tags="&lt;login&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4355" PostTypeId="2" ParentId="4354" CreationDate="2014-10-24T21:16:44.730" Score="5" Body="&lt;p&gt;You can call it from the front-end, but it requires the currently logged in user to be an administrator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just point the form's hidden action input to &lt;code&gt;users/impersonate&lt;/code&gt; and have it submit a 'userId' input of the person you want to log in as.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-24T21:16:44.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4356" PostTypeId="2" ParentId="4348" CreationDate="2014-10-24T22:06:19.227" Score="2" Body="&lt;p&gt;I had the same problem a couple of weeks ago: apparently there isn't a simple function that can be called as getAttributes only returns data from the content table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote the code below to get data for all matrix fields within an entry, but later on I realised that there are other fields which appear null from getAttributes such as asset and entry fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else have a rock-solid method for all data?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$content = $entry-&amp;gt;getContent();&#xA;&#xA;$data = $content-&amp;gt;getAttributes(null,true);&#xA;&#xA;    // Getting content / attributes doesn't appear to work for Matrix fields? - get content and re-populate data array&#xA;    $matrixFields = craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;select(array('handle'))-&amp;gt;where( array('type' =&amp;gt; 'Matrix') )-&amp;gt;from('fields')-&amp;gt;queryAll();&#xA;&#xA;    foreach( $matrixFields as $matrix )&#xA;    {&#xA;        $handle = $matrix['handle'];&#xA;&#xA;        if( $entry-&amp;gt;$handle )&#xA;        {&#xA;            $attributes = array();&#xA;            foreach( $entry-&amp;gt;$handle as $matrix )&#xA;            {&#xA;                $attr =  $matrix-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;&#xA;                // Attribute Formatting (this is formatting for my use-case - feel free to amend as you need)&#xA;                unset( $attr['id'] , $attr['elementId'] , $attr['locale'] , $attr['title'] );&#xA;                $attr = array_merge( $attr , array(&quot;___type&quot; =&amp;gt; $matrix-&amp;gt;type-&amp;gt;handle ) );&#xA;&#xA;                $attributes[] = $attr;&#xA;            }&#xA;            $data[$handle] = $attributes;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="724" LastActivityDate="2014-10-24T22:06:19.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4357" PostTypeId="1" AcceptedAnswerId="4358" CreationDate="2014-10-25T03:02:29.243" Score="1" ViewCount="269" Body="&lt;p&gt;Some articles are very long and getting cut off when saved to the database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT', or would I have to write a plugin to replicate the 'richtext' fieldtype with a different field attribute defined in &lt;code&gt;defineContentAttribute&lt;/code&gt;? Any other considerations to take into account? Such as search, indexing, redactor or otherwise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part 2 of this question would be: what is the simplest way to duplicate the RichTextField in a plugin? Can I just extend 'RichTextFieldType' and redefine &lt;code&gt;getName&lt;/code&gt; and &lt;code&gt;defineContentAttribute&lt;/code&gt;? I tried the following with no luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; This creates a 'Rich Text (Medium)' field with the correct DB column type of 'MEDIUMTEXT', but causes the 'Edit Entry' screen in the CP to be blank below the entry title (silent fail?); and if switching to entry type with this field getting a garnish error 'Double-instantiating a transparent text input on an element'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class LongTextFields_MediumRichTextFieldType extends RichTextFieldType&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Rich Text (Medium)');&#xA;    }&#xA;    public function defineContentAttribute()&#xA;    {&#xA;        return array(AttributeType::String, 'column' =&amp;gt; ColumnType::MediumText);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option might be to just redefine the columntype manually in the database. Is there any chance this value will ever get overwritten? (i.e. upgrades, migrations, etc).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-26T16:12:06.593" LastActivityDate="2014-10-26T16:12:06.593" Title="Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT' in DB?" Tags="&lt;database&gt;&lt;field&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4358" PostTypeId="2" ParentId="4357" CreationDate="2014-10-26T03:00:36.447" Score="1" Body="&lt;p&gt;Defining your a plugin with it's own field type that extends RichTextFieldType might work (haven't tested), but your current code is slightly off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field type class/file name needs to be &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;PluginHandle_FieldTypeNameFieldType&lt;/a&gt; before Craft will even recognize it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the &lt;code&gt;ColumnType&lt;/code&gt; enum uses &lt;code&gt;MediumText&lt;/code&gt;, not &lt;code&gt;Mediumtext&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really, what we should probably do is make this a setting on the field type because it does pop up every so often and there currently isn't a clean answer.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-26T03:00:36.447" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4359" PostTypeId="1" AcceptedAnswerId="4389" CreationDate="2014-10-26T03:01:32.720" Score="0" ViewCount="101" Body="&lt;p&gt;It appears, toggling the status button on an entry affects only the &lt;code&gt;elements.enabled&lt;/code&gt; value.  What affects the &lt;code&gt;elements_i18n.enabled&lt;/code&gt; value?  When and how would we choose to update the &lt;code&gt;enabled&lt;/code&gt; column in the &lt;code&gt;elements_i18n&lt;/code&gt; table?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-10-28T09:27:41.063" Title="What is the difference between elements.enabled and elements_i18n.enabled?" Tags="&lt;elementcriteriamodel&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4360" PostTypeId="1" AcceptedAnswerId="4364" CreationDate="2014-10-26T06:44:41.680" Score="8" ViewCount="35642" Body="&lt;p&gt;I have content which needs to go into a certain column so I have a field called 'column' there. I can create the array I want by hand:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;    set items = {&#xA;        1 : {&#xA;            0 : 'Quick Facts',&#xA;            1 : 'Agencies'&#xA;        },&#xA;        2 : {&#xA;            0 : 'Inspiration',&#xA;            1 : 'Industry Experience'&#xA;        }&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 1 and 2 are the columns, and 0,1 is just a normal index. In a loop it is different. I have tried the same syntax but of course setting the variable in the loop will set the new variable every time and replace the old one. Using merge like below always gives me new keys. Is there a way to do this as easily as PHP?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = {} %}&#xA;&#xA;{% for tab in tabs %}&#xA;    {% for key,block in tab.tabItem %}&#xA;&#xA;        {% if block.type == 'about' %}&#xA;            {% set blocks = blocks|merge({ (block.column.value) : block.aboutTitle}) %}&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the output of the two pieces of code (first being what I want). I'd like the &lt;code&gt;block.column.value&lt;/code&gt; to be the key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RKEfJm.png&quot; alt=&quot;Output&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="125" LastEditDate="2014-10-28T09:02:29.610" LastActivityDate="2014-10-28T09:02:29.610" Title="Creating dynamic array and set keys" Tags="&lt;array&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4361" PostTypeId="1" AcceptedAnswerId="4363" CreationDate="2014-10-26T06:49:29.880" Score="5" ViewCount="5390" Body="&lt;p&gt;I have a rich text output section I want to limit to specific number of characters or words. So user able preview the blog post and link to the full blog. I try  &lt;code&gt;entry.body|slice(0, 100) ~ '...'&lt;/code&gt;. But it slice of my html tag and display html code in front end.&lt;/p&gt;&#xA;" OwnerUserId="768" LastActivityDate="2016-07-28T08:49:06.307" Title="Limit text when output richtext" Tags="&lt;richtext&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4362" PostTypeId="2" ParentId="4361" CreationDate="2014-10-26T09:45:39.417" Score="2" Body="&lt;p&gt;Looks like you can extend twig with extensions. I have not tried this, but I found this extension which preserves HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.versioneye.com/php/dzango:twig-truncate-extension/1.0.8&quot; rel=&quot;nofollow&quot;&gt;https://www.versioneye.com/php/dzango:twig-truncate-extension/1.0.8&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you have to create a plugin to use it. A fast way is to follow by example on this one perhaps: &lt;a href=&quot;https://github.com/lukeholder/craft-inflect&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lukeholder/craft-inflect&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2014-10-26T09:45:39.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4363" PostTypeId="2" ParentId="4361" CreationDate="2014-10-26T10:47:09.417" Score="4" Body="&lt;p&gt;I found a plugin to solve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is use this plugin.&#xA;&lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ehousestudio/craft_hacksaw&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="768" LastActivityDate="2014-10-26T10:47:09.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4364" PostTypeId="2" ParentId="4360" CreationDate="2014-10-26T18:10:03.230" Score="14" Body="&lt;p&gt;You can do this using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot;&gt;twig attribute function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set data = [&#xA;    {'column':'1','title':'Quick Facts'}, &#xA;    {'column':'2','title':'Inspiration'}, &#xA;    {'column':'1','title':'Agencies'}, &#xA;    {'column':'2','title':'Industry Experience'}&#xA;] %}&#xA;&#xA;{% set cols = {} %}&#xA;{% for item in data %}&#xA;&#xA;    {# create a dynamic property if one doesn't exist #}&#xA;    {% if not attribute(cols, 'col' ~ item.column) is defined %}&#xA;        {% set cols = cols|merge({ ('col' ~ item.column) : [item.title] }) %}&#xA;&#xA;    {# else update the dynamic property with the new title #}&#xA;    {% else %}&#xA;        {% set titles = attribute(cols, 'col' ~ item.column) %}&#xA;        {% set titles = titles|merge([item.title]) %}&#xA;        {% set cols = cols|merge({ ('col' ~ item.column) : titles }) %}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{{ dump(cols) }}&#xA;&#xA;{#&#xA;array(2) { &#xA;    [&quot;col1&quot;]=&amp;gt; array(2) {&#xA;         [0]=&amp;gt; string(11) &quot;Quick Facts&quot; &#xA;         [1]=&amp;gt; string(8) &quot;Agencies&quot; &#xA;    } &#xA;    [&quot;col2&quot;]=&amp;gt; array(2) { &#xA;        [0]=&amp;gt; string(11) &quot;Inspiration&quot; &#xA;        [1]=&amp;gt; string(19) &quot;Industry Experience&quot; &#xA;    } &#xA;} &#xA;#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-27T04:54:08.943" LastActivityDate="2014-10-27T04:54:08.943" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4365" PostTypeId="1" CreationDate="2014-10-26T22:46:34.063" Score="0" ViewCount="230" Body="&lt;p&gt;Total noob here.  Have managed to output entries and paginate them with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('woods').limit(5) as entries %}&#xA;    {% for entry in entries %}&#xA;        ....&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I cannot figure out how to output just entries of a certain type or entries from a certain category within a category group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('woods').type('mahogony').limit(5) %}&#xA;    {% for entry in entries %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ain't flying me anywhere but into a tree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure it is something basic.&lt;/p&gt;&#xA;" OwnerUserId="934" LastEditorUserId="57" LastEditDate="2014-10-26T23:15:33.943" LastActivityDate="2014-10-28T09:25:40.063" Title="Output Entry Type and/ or Category" Tags="&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4366" PostTypeId="2" ParentId="2299" CreationDate="2014-10-27T05:53:45.960" Score="0" Body="&lt;p&gt;I had similar problem with some german email providers (web.de, gmx). PHP-Mail and Sendmail failed but the solution for me was to use a smtp server in the email configs of Craft.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-10-27T05:53:45.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4367" PostTypeId="1" CreationDate="2014-10-27T11:07:32.323" Score="0" ViewCount="1450" Body="&lt;p&gt;Users can currently submit entries using a form on the front-end. How would I go about showing the current logged in user's existing entries and allow them to edit them through another front-end form? &lt;/p&gt;&#xA;" OwnerUserId="910" LastActivityDate="2014-10-27T12:21:31.130" Title="How do I enable editing of entries with a front-end form?" Tags="&lt;entries&gt;&lt;form&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4368" PostTypeId="1" AcceptedAnswerId="4370" CreationDate="2014-10-27T12:04:31.763" Score="6" ViewCount="908" Body="&lt;p&gt;I'm aware that running craft locally from &quot;craft.dev&quot; or &quot;ontherocks.dev&quot; will enable you to try out the Client and Pro versions (which is a super-cool feature!) - but just wanted to ask if there are any plans to allow any domain at *.local or *.dev.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously totally understand not wanting to open it up too much, but just working on a few projects under development, which is a little hard to juggle on the one domain.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="125" LastEditDate="2014-10-27T17:08:05.517" LastActivityDate="2015-04-27T21:04:45.990" Title="Try out Craft Client and Pro on multiple development URLs?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4369" PostTypeId="2" ParentId="4367" CreationDate="2014-10-27T12:21:31.130" Score="4" Body="&lt;p&gt;Add another hidden input field &amp;quot;entryId&amp;quot; to your form. There's nice &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form#editing-entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;example code in the Docs&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You can modify the form to save existing entries by adding an “entryId” hidden input to the form:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;entryId&amp;quot; value=&amp;quot;{{ entry.id }}&amp;quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-10-27T12:21:31.130" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4370" PostTypeId="2" ParentId="4368" CreationDate="2014-10-27T12:30:22.387" Score="10" Body="&lt;p&gt;You can always use this &quot;super-cool feature&quot; with sub-domains of &quot;craft.dev&quot; or &quot;ontherocks.dev&quot;! You can have as many as you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;craft.dev&quot;&lt;br&gt;&#xA;&quot;pro.craft.dev&quot;&lt;br&gt;&#xA;&quot;license.craft.dev&quot;&lt;br&gt;&#xA;&quot;testing.craft.dev&quot;&lt;br&gt;&#xA;&quot;is.craft.dev&quot;&lt;br&gt;&#xA;&quot;super.craft.dev&quot;&lt;br&gt;&#xA;&quot;cool.craft.dev&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;:D&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-27T12:30:22.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4371" PostTypeId="1" AcceptedAnswerId="4372" CreationDate="2014-10-27T13:17:14.507" Score="2" ViewCount="2130" Body="&lt;p&gt;I'm trying to pass an AssetModel into a twig macro but all I'm getting is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to define my twig macro variable to be an object instead of a string?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my macro&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro item(thumbnail) %}&#xA;    {% if thumbnail %}&#xA;        &amp;lt;img src=&quot;{{ thumbnail }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;macros/grid.html&quot; as grid %}&#xA;&#xA;{% for entry in craft.entries.section('handle') %}&#xA;    {{ grid.item(entry.image) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;entry.image&lt;/em&gt; is an Asset field&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="57" LastEditDate="2014-10-27T16:34:47.370" LastActivityDate="2014-10-27T20:39:08.037" Title="How pass an ElementModel to a Macro in Twig" Tags="&lt;templating&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4372" PostTypeId="2" ParentId="4371" CreationDate="2014-10-27T14:41:46.007" Score="3" Body="&lt;p&gt;I see a few problems. The first is that &lt;code&gt;{{ grid.item(entry.image) }}&lt;/code&gt; is actually an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; (i.e. which behaves like an array of images) and not an ElementModel (i.e. a single image), even if only one image is defined. To get the first image you can use &lt;code&gt;entry.image.first&lt;/code&gt; or &lt;code&gt;entry.image[0]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem is that in your macro, &lt;code&gt;&amp;lt;img src=&quot;{{ thumbnail }}&quot;/&amp;gt;&lt;/code&gt; is trying to set the url string using the whole &lt;code&gt;ElementModel&lt;/code&gt; (or in your case the ElementCriteriaModel). Instead use: &lt;code&gt;{{ thumbnail.url }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro item(thumbnail) %}&#xA;    {% if thumbnail %}&#xA;        &amp;lt;img src=&quot;{{ thumbnail.url }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import item %}&#xA;&#xA;{% for entry in craft.entries.section('handle') %}&#xA;    {{ item(entry.image.first) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; If on the other hand, for some reason you want to pass the ElementCriteriaModel then you just need to handle it appropriately in the macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro item(thumbnail) %}&#xA;    {% if thumbnail.first %}&#xA;        &amp;lt;img src=&quot;{{ thumbnail.first.url }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import item %}&#xA;&#xA;{% for entry in craft.entries.section('handle') %}&#xA;    {{ item(entry.image) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a side note — keep in mind that the macro can also exist in the same template and imported using &lt;code&gt;_self&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-27T20:39:08.037" LastActivityDate="2014-10-27T20:39:08.037" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="4373" PostTypeId="1" AcceptedAnswerId="4391" CreationDate="2014-10-27T15:38:39.280" Score="1" ViewCount="1090" Body="&lt;p&gt;Is there any way to check if a relationship field has a value/is assigned to other elements (assets/entries) without having to add an extra query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Channel with an Asset field assigned to it. Now let's say I have a list of 100 entries. This list should show a thumbnail and the entry title. I only want to &quot;fetch&quot; the related image thumbnail if the user has choosen to select any image to reduce the amount of queries used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;standard&quot; way which results in ~100 queries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.image.first() %}&#xA;{% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The way I tried it, but &lt;em&gt;|length&lt;/em&gt; adds (1) query making it ~100 queries + the queries for each found thumbnail&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.image|length &amp;gt; 0 %}&#xA;    {% set image = entry.image.first() %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a third option I can use to check (without a query) is the &lt;em&gt;entry.image&lt;/em&gt; has any related content assigned to it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-12-05T15:18:59.727" Title="Check if a Relationship field has a relationship without extra query" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4374" PostTypeId="1" AcceptedAnswerId="4375" CreationDate="2014-10-27T16:10:09.457" Score="1" ViewCount="122" Body="&lt;p&gt;Is there a way to enforce a limit to the amount of entries a user can create based on their user group&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve been digging around a little and can’t seem to find anything that would allow this, I’ve looked at adding my own permissions but I don’t think that’s right as I need/want the value to be a number, not a ‘can the user add x amount’ kinda deal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(‘listing’).authorId(user.id) %}&#xA;&#xA;{% if entries.count &amp;gt;= userGroup.entryLimit %}&#xA;    No more entries for you!&#xA;{% else %}&#xA;    More entries for you!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the only way to do this by creating a custom plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2014-10-31T12:14:22.693" LastActivityDate="2014-10-31T12:14:22.693" Title="Limit amount of entries a user can create based on their user group" Tags="&lt;entries&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4375" PostTypeId="2" ParentId="4374" CreationDate="2014-10-27T16:55:25.587" Score="1" Body="&lt;p&gt;I think a custom plugin is going to be the way to go with this.  Your template code would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(‘listing’).authorId(user.id) %}&#xA;&#xA;{% if entries.count &amp;gt;= craft.myPlugin.getEntryLimitForUser(user.id) %}&#xA;    No more entries for you!&#xA;{% else %}&#xA;    More entries for you!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your plugin would also hook onto the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry&lt;/a&gt; event and keep an incrementing entry save counter for each user you're tracking.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-27T16:55:25.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4376" PostTypeId="2" ParentId="4344" CreationDate="2014-10-27T16:59:53.037" Score="1" Body="&lt;p&gt;What about composing a custom Twig array containing all the data you need. This does all your DB queries and because you write it in default sort order (randomize afterwards), you can cache all the heavy lifting of your template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Cache an array of fake &quot;ElementModels&quot; #}&#xA;{% cache %}&#xA;&#xA;{% set imagesArray = [] %}&#xA;{% set tagsColor = [] %}&#xA;&#xA;{% for image in craft.assets %}&#xA;&#xA;    {% for tag in image.tagsColor %}&#xA;&#xA;        {% set tagColor = {&#xA;            slug: tag|slugify,&#xA;            tag: tag,&#xA;        } %}&#xA;&#xA;        {% set tagsColor = tagsColor|merge(tagColor) %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {% set imageObject = {&#xA;        url: image.url,&#xA;        title: image.title,&#xA;        tagsColor: tagsColor,&#xA;    } %}&#xA;&#xA;    {% set imagesArray = imagesArray|merge(imageObject) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then randomize your images and print the JSON:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Randomize our array #}&#xA;{% set imagesArray = shuffle(imagesArray) %}&#xA;&#xA;{# Print the thing into our JSON #}&#xA;{% for image in imagesArray %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-28T08:25:42.150" LastActivityDate="2014-10-28T08:25:42.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4377" PostTypeId="1" AcceptedAnswerId="4419" CreationDate="2014-10-27T18:42:15.987" Score="1" ViewCount="485" Body="&lt;p&gt;I have a development system running OS X / nginx / php-fpm 5.6 and I've pulled down a version of my site from my git repository. The site is currently running an out of date version of craft, however it appears to have issue connecting to the craft update server when I check for an update, simply saying ‘You’re up to date!' (which it isn't).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This only happens on the testing system so I'm guessing it's a configuration issue in php, but having reconfigured php several times I still have this issue. It also causes plugins like the Directory plugin and DUKT's Videos plugin to return errors like 'Couldn't retrieve account' when querying apis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the logs turns up a HttpException, although I'm not entirely sure what would cause this issue? Craft hasn't said anything is wrong with my environment but clearly something is failing somewhere...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/10/27 23:42:04 [warning] [application] 404 - &#xA;in craft/app/etc/errors/HttpException.php (29)&#xA;in craft/app/controllers/TemplatesController.php (59)&#xA;in craft/app/etc/web/WebApp.php (293)&#xA;2014/10/27 23:42:04 [error] [exception.Craft\HttpException.404] exception     'Craft\HttpException' in craft/app/controllers/TemplatesController.php:59&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I installed PHP through homebrew with the command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;brew install php56 --with-homebrew-curl --with-homebrew-libxslt --with-homebrew-openssl --without-snmp --without-apache --with-fpm --with-mysql php56&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="469" LastEditorUserId="469" LastEditDate="2014-10-28T18:35:42.733" LastActivityDate="2014-10-28T18:35:42.733" Title="Craft not Downloading Auto Update - HttpException on OS X PHP56" Tags="&lt;php&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4378" PostTypeId="1" AcceptedAnswerId="4379" CreationDate="2014-10-27T20:32:23.427" Score="1" ViewCount="285" Body="&lt;p&gt;I am looking to develop a plugin which out put the data in a loop Or that plugin would populate the array data with template tag. Could anyone please help me or share a doc link.﻿&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2015-04-07T03:48:06.580" Title="Develop a plugin for outputting data in a loop" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4379" PostTypeId="2" ParentId="4378" CreationDate="2014-10-27T20:43:00.047" Score="7" Body="&lt;p&gt;Please have a look at the &quot;Template Variables&quot; section of the documentation:&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template variables are the containers of data which you can access from your twig templates using &lt;code&gt;craft.yourPluginName.yourPluginVariableFunctionName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you want to loop through 3 different items in an array from your Plugin. Your Plugin variables file might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginNameVariable&#xA;{&#xA;    public function data()&#xA;    {&#xA;        return array('one', 'two', 'three');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template you can now &quot;fetch&quot; this data like this - in a loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.pluginName.data %}&#xA;    {{ item }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please not this code is not tested&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="103" LastEditDate="2015-04-07T03:48:06.580" LastActivityDate="2015-04-07T03:48:06.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4380" PostTypeId="1" AcceptedAnswerId="4382" CreationDate="2014-10-27T21:10:05.753" Score="1" ViewCount="634" Body="&lt;p&gt;I have a structure section. For that section, I have some categories. Each entry has a field where I can select the category that entry belongs to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I include the category uri? For example, &quot;section/category/entry&quot;. &lt;/p&gt;&#xA;" OwnerUserId="936" LastActivityDate="2014-10-28T00:27:49.327" Title="Add category to uri" Tags="&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4381" PostTypeId="1" AcceptedAnswerId="4384" CreationDate="2014-10-27T22:03:54.193" Score="1" ViewCount="679" Body="&lt;p&gt;With my plugin I am generating and saving a lot of data to a secondary table. Data that can be generated on the fly that is associated with entries. I have noticed a performance hit and was given a suggestion of caching some of that data instead of writing to a database.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does craft have a built in caching system I can use for accomplishing something like this?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-10-27T22:17:56.347" Title="Use cache instead of saving to database" Tags="&lt;plugin-development&gt;&lt;performance&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4382" PostTypeId="2" ParentId="4380" CreationDate="2014-10-27T22:06:51.863" Score="4" Body="&lt;p&gt;In the CP, in the settings window for 'categories' you can set whether 'Categories in this group have their own URLs', and define the 'Category URL Formats' for categories and subcategories, and choose a category template. You could use &lt;code&gt;{slug}&lt;/code&gt; for example, to route to the index page of the category (or whatever you want to use it for). Of course, you may not need this at all if you don't plan on having a landing or index page for the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For getting to an actual entry you would need to set a custom route in the CP using tokens. You could create &lt;code&gt;category/slug&lt;/code&gt; for example (where 'category' is your category name, and 'slug' is a token) which would point to your &lt;code&gt;_categoryentry.html&lt;/code&gt; template. Any tokens you define will be variables available in your template that you can use to retrieve the appropriate entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your entries will always only belong to one and only one category, then you may consider using the structure itself (i.e. inserting the categories into the structure itself as another level), which will provide the uri you are looking for automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, see the documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing&lt;/a&gt;, and &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;categories&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-28T00:27:49.327" LastActivityDate="2014-10-28T00:27:49.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4383" PostTypeId="1" CreationDate="2014-10-27T22:12:35.143" Score="3" ViewCount="505" Body="&lt;p&gt;I'm currently working on a website for a church and I thought that Craft would be perfect for the project and a great way to learn it. However, I'm having a hard time wrapping my head around how to structurally build sermons into a craft cms site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want it to look something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sermons &gt; Series &gt; Series Title, Series Artwork, Series Bio, Message Title, Date, short Bio, artwork, links to watch, links to listen, social links, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar to this website. &lt;a href=&quot;https://newspring.cc/sermons&quot; rel=&quot;nofollow&quot;&gt;https://newspring.cc/sermons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone provide any insight into what ways they'd build this? I guess I'm getting hung up on if I have to create 2 channels to make this work? One for Sermons, and one for each series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I want to be able to add a sermon series as and entry. And then go in and add each week's message as a separate entry under that particular sermon series. Does that make sense?&lt;/p&gt;&#xA;" OwnerUserId="937" LastEditorUserId="784" LastEditDate="2014-11-12T14:43:43.220" LastActivityDate="2014-11-12T14:43:43.220" Title="Help with understanding how to structurally build a sermon catalogue" Tags="&lt;structure&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4384" PostTypeId="2" ParentId="4381" CreationDate="2014-10-27T22:17:56.347" Score="3" Body="&lt;p&gt;&lt;code&gt;craft()-&amp;gt;cache&lt;/code&gt; can point to any one of several different caching drivers as defined by the   &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The available methods are all pretty much stock &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/#system.caching&quot; rel=&quot;nofollow&quot;&gt;Yii provided caching drivers&lt;/a&gt;, with the exception of &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/cache/FileCache&quot; rel=&quot;nofollow&quot;&gt;FileCache&lt;/a&gt;, which we've &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/cache/FileCache.php&quot; rel=&quot;nofollow&quot;&gt;extended a bit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that FileCache is used by default and its values are saved under the &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-27T22:17:56.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4385" PostTypeId="2" ParentId="4383" CreationDate="2014-10-28T00:13:33.120" Score="6" Body="&lt;p&gt;There is probably no best answer. There are a number of ways to structure craft to support this, and any answer is going to be highly subjective. A lot will depend on the relationships between the elements, and what the requirements of the different elements are (i.e. how complex, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option to get the desired uri pattern (i.e. &lt;code&gt;/sermons/series-name/sermon-name&lt;/code&gt;) would be to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a single called &lt;code&gt;sermons&lt;/code&gt; that would be the landing page for the sermons section.&lt;/li&gt;&#xA;&lt;li&gt;In the &lt;code&gt;sermons&lt;/code&gt; template you would display the sermons overview content, and retrieve and display the 'series' (perhaps ordered by date, or category, or whatever).&lt;/li&gt;&#xA;&lt;li&gt;Create a structure to house 'series', with at least 2 levels, with the series collection at the root and the individual series items (a.k.a. sermons), beneath. The series collection and series items would each have a different &lt;code&gt;Entry Type&lt;/code&gt; so that fields could be unique for collection vs. items, and you can display a different template depending on the Entry Type.&lt;/li&gt;&#xA;&lt;li&gt;Set the uri for the 'series' structure to be 'sermons/{slug}' and for nested entries to be &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;You could also create additional levels for video, artwork, etc. which would get added to the uri automatically (where each level or type of content might get assigned its own Entry Type based on the type of content your working with) (i.e. &lt;code&gt;/sermons/series-name/sermon-name/videos/video-name&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are lots of other options and considerations also, but this might be an easier one to deal with, without having to create your own custom routes to get the uri pattern you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes of course that an individual series item (or sermon) belongs to only one series. If not, then you may want to consider other options, such as creating a channel for 'series' and a channel for 'sermons' and then relate the two using an &lt;code&gt;entries&lt;/code&gt; FieldType.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can even take the structure concept further and map the whole site using a single structure, with different entry types for the different types of pages. This makes the nav very easy to build and the sections/pages can all be moved around easily. And you can always pull in other content into those pages from other channels as needed. OR create a structure for the rest of the site and structure for the series, where the uri's match up nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically. Lot's of options.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-28T00:13:33.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4386" PostTypeId="1" CreationDate="2014-10-28T06:07:27.253" Score="2" ViewCount="2054" Body="&lt;p&gt;Content is accessible via example.com/index.php?p=page-name but not via example.com/index.php/page-name or example.com/page-name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The .htaccess and 'omitScriptNameInUrls' =&gt; true are both in place but still no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="783" LastActivityDate="2014-10-28T06:28:50.433" Title="URL rewrites not working return Apache 404's" Tags="&lt;url&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4387" PostTypeId="2" ParentId="4386" CreationDate="2014-10-28T06:28:50.433" Score="3" Body="&lt;p&gt;Those are the 2 thing you need to ensure are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If .htaccess files are being ignored, you need to check to see that AllowOverride is set correctly. See &lt;a href=&quot;http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride&quot; rel=&quot;nofollow&quot;&gt;http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride&lt;/a&gt; for details on setting &quot;AllowOverride All&quot;. You need to also ensure that it is set in the correct scope - ie, in the right block in your configuration. Be sure you're NOT editing the one in the block, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, if you want to ensure that a .htaccess file is in fact being read, put garbage in it. An invalid line, such as &quot;INVALID LINE HERE&quot;, in your .htaccess file, will result in a 500 Server Error when you point your browser at the directory containing that file. If it doesn't, then you don't have AllowOverride configured correctly.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-10-28T06:28:50.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4388" PostTypeId="2" ParentId="4365" CreationDate="2014-10-28T09:25:40.063" Score="1" Body="&lt;p&gt;When you added the &lt;code&gt;type&lt;/code&gt; param to your &lt;code&gt;{% paginate %}&lt;/code&gt; tag, you removed the &lt;code&gt;as entries&lt;/code&gt; bit, which is required. (That tells the tag what variable name it should give to the current page’s entries.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('woods').type('mahogony').limit(5) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-28T09:25:40.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4389" PostTypeId="2" ParentId="4359" CreationDate="2014-10-28T09:27:41.063" Score="1" Body="&lt;p&gt;If your section is enabled in multiple locales, each locale will get its own status lightswitch setting, which maps back to &lt;code&gt;elements_i18n.enabled&lt;/code&gt;. It’s how you can have individual entries enabled/disabled on a per-locale basis.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-28T09:27:41.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4390" PostTypeId="2" ParentId="4345" CreationDate="2014-10-28T09:28:53.840" Score="0" Body="&lt;p&gt;There isn’t, and yeah, the collapsed Matrix block preview text is just created with some Javascript that checks the fields and their inputs within each block.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-28T09:28:53.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4391" PostTypeId="2" ParentId="4373" CreationDate="2014-10-28T09:30:14.770" Score="6" Body="&lt;p&gt;There isn’t currently, but it’s on our list to make it possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 2.5, you can set relational field params to &lt;code&gt;'not :empty:'&lt;/code&gt; or &lt;code&gt;':notempty:'&lt;/code&gt; to only show elements where &lt;em&gt;something&lt;/em&gt; is selected within the field; and you can set them to &lt;code&gt;':empty:'&lt;/code&gt; to only show elements where &lt;em&gt;nothing&lt;/em&gt; is selected within the field.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-12-05T15:18:59.727" LastActivityDate="2015-12-05T15:18:59.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4392" PostTypeId="2" ParentId="4353" CreationDate="2014-10-28T09:41:18.650" Score="8" Body="&lt;p&gt;Craft will only serve templates from craft/templates/ by default if it’s a front-end site request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To explicitly tell Craft to serve templates from there, you can use &lt;a href=&quot;http://buildwithcraft.com/classreference/services/PathService#setTemplatesPath-detail&quot; rel=&quot;noreferrer&quot;&gt;PathService::setTemplatesPath()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$path = craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath();&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($path);&#xA;&#xA;$this-&amp;gt;renderTemplate('path/to/template', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2015-06-15T17:43:38.180" LastActivityDate="2015-06-15T17:43:38.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4393" PostTypeId="2" ParentId="4342" CreationDate="2014-10-28T09:46:27.547" Score="1" Body="&lt;p&gt;This sounds like a bug, and I think I know why. Can you try changing the &lt;code&gt;{% set entryCount ...&lt;/code&gt; line to this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryCount = craft.entries.relatedTo(category.id).total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-28T09:46:27.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4394" PostTypeId="2" ParentId="4373" CreationDate="2014-10-28T09:55:18.027" Score="1" Body="&lt;p&gt;What about creating an array of IDs with only those entries that do have an Thumbs image assigned to it and then check in your loop if you have to query the image at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('myChannel') %}&#xA;&#xA;{# Get all potential &quot;thumbs&quot; using one! of the following ElementCriteriaModels #}&#xA;{% set thumbs = craft.assets.sourceId(1) %}&#xA;{% set thumbs = craft.assets.relatedTo(entries) %}&#xA;&#xA;{# Get the IDs of those entries that are related to a &quot;thumbs&quot; image #}&#xA;{% set thumbEntryIds = craft.entries.section('myChannel').relatedTo({&#xA;    targetElement: thumbs,&#xA;    field: 'myImagesField',&#xA;}).ids() %}&#xA;&#xA;{# Loop entries #}&#xA;{% for entry in entries %}&#xA;&#xA;    {# Only request image if relationship exists #}&#xA;    {% if entry.id in thumbEntryIds %}&#xA;        &amp;lt;img src=&quot;{{ entry.myImagesField.first().url }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-28T09:55:18.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4395" PostTypeId="1" AcceptedAnswerId="4551" CreationDate="2014-10-28T10:08:08.460" Score="1" ViewCount="207" Body="&lt;p&gt;I'm relying on the &lt;a href=&quot;https://github.com/low/low_regex&quot; rel=&quot;nofollow noreferrer&quot;&gt;Low Regex plugin&lt;/a&gt; to convert section handles from camelCase to lower-dash-case to use them in URLs, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{section.handle|regex('/(^|[a-z])([A-Z])/e', 'strtolower(strlen(&quot;\\1&quot;) ? &quot;\\1-\\2&quot; : &quot;\\2&quot;)',(section.handle))}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…and further, to convert the segment of the URL that contains the dash-separated section name to camel case, so I can work with it in my templates, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionHandle = craft.request.getFirstSegment() %}&#xA;{% set sectionHandleCc = sectionHandle | regex('/-([a-z])/e', 'strtoupper(strlen(&quot;\\1&quot;) ? &quot;\\1\\2&quot; : &quot;\\2&quot;)',(sectionHandle)) %}&#xA;{% set section = craft.sections.getSectionByHandle(sectionHandleCc) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, OS X 10.10 Yosemite ships with PHP version 5.5.14 pre-installed and as of 5.5.0 the e-modifier for regex patterns is &lt;a href=&quot;http://php.net/manual/en/reference.pcre.pattern.modifiers.php#reference.pcre.pattern.modifiers.eval&quot; rel=&quot;nofollow noreferrer&quot;&gt;deprecated&lt;/a&gt;, so on my local machine I get this error and the site breaks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2fPIH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got in touch with the plugin author and he suggested removing the e-modifier, which seemed to work within the templates, but when I removed the modifier in the sections entry URL format the CP wasn't able to re-save my entries and I couldn't save new entries either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The question that remains is&lt;/strong&gt;: Is there a workaround using a different regex pattern or – and that would be my preferred scenario – is there an approach I didn't think of that allows me to omit the plugin dependency completely? I guess one option would be to keep the section handles all lowercase, but I'd like to have them dash-separated in the URLs.&lt;/p&gt;&#xA;" OwnerUserId="654" LastActivityDate="2014-11-04T15:48:15.377" Title="Workaround for deprecated regex pattern modifier in PHP 5.5.0 and up (10.10 Yosemite)" Tags="&lt;url&gt;&lt;sections&gt;&lt;regex&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4396" PostTypeId="1" AcceptedAnswerId="4406" CreationDate="2014-10-28T10:48:15.053" Score="1" ViewCount="701" Body="&lt;p&gt;I have a Plugin which saves data from a form the user enters on my front-end. When the input data is wrong and I display my validation errors using &lt;em&gt;getErrors&lt;/em&gt; from the Model I want to re-populate all my form fields with the submitted data in my Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm doing this like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fieldName&quot; value=&quot;{% if model is defined %}{{ model.fieldName}}{% endif %}&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the correct way of doing this or is there a better practice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like there's to many unnecessary &lt;em&gt;if&lt;/em&gt; statements going on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="125" LastEditDate="2014-10-28T11:45:29.747" LastActivityDate="2014-10-28T12:52:24.690" Title="Best way to re-populate input field with Model data on front-end?" Tags="&lt;templating&gt;&lt;form&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4397" PostTypeId="1" CreationDate="2014-10-28T10:55:42.170" Score="2" ViewCount="565" Body="&lt;p&gt;I'm building a site with digital downloads of PDFs via the excellent &lt;a href=&quot;http://squarebit.co.uk/plugins/charge/&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; plugin and need to include some basic obfuscation of the path to files to prevent people from just being able to predict them. I was thinking maybe I can use the UID of the assets to identify it, is this possible? If not any suggestions are welcome.&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="125" LastEditDate="2014-10-28T13:09:33.613" LastActivityDate="2014-10-29T19:07:44.693" Title="Obfuscation of an asset's file path?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4398" PostTypeId="2" ParentId="4395" CreationDate="2014-10-28T11:05:14.470" Score="1" Body="&lt;p&gt;Can't help you with that &lt;code&gt;\e&lt;/code&gt; modifier problem and my regex knowledge is very limited, but that camelCase problem can be solved with Twig filters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'camelCase'|replace('/([A-Z])/', '-\\1')|lower }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-28T11:05:14.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4399" PostTypeId="1" AcceptedAnswerId="4402" CreationDate="2014-10-28T11:36:30.977" Score="2" ViewCount="659" Body="&lt;p&gt;I'm aware that I could enable the plugin to have it's own CP section, but I don't feel that this would be the right place for it to live due to its nature, when you view the settings page it wouldn't be a list of inputs, it would be a table view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally the plugin page would reside in &lt;code&gt;settings &amp;gt; plugins &amp;gt; myPlugin&lt;/code&gt; but have the same template as a plugin with a CP section, just like the sections settings page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my template in &lt;code&gt;pluginHandle/settings.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set title = &quot;My Plugin&quot; %}&#xA;&#xA;{% set content %}&#xA;  Some content should appear here maybe?&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't get any errors when I view the page it just looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KZDQi.jpg&quot; alt=&quot;Plugin settings page&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the title variable gets ignored and has taken the plugin name, but if I remove the &lt;code&gt;{% set title = '' %}&lt;/code&gt; part it throws an error of &lt;code&gt;Variable &quot;title&quot; does not exist&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to match the basics of what the sections settings template that craft has. Am I just trying to do something that was never an intended purpose or is just bad practice ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clearance would be great, thanks!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-10-28T12:20:37.670" Title="Can you extend &quot;_layouts/cp&quot; in a plugin settings page?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4400" PostTypeId="2" ParentId="4396" CreationDate="2014-10-28T11:44:55.413" Score="0" Body="&lt;p&gt;If you use that form to edit entries AND add new ones, then yes, this is probably the correct way to do this. But if this is an edit only form / template then you could check for the model once and if no &lt;code&gt;model is defined&lt;/code&gt; don't show your form at all.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if model is defined %}&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fieldName&quot; value=&quot;{{ model.fieldName}}&quot;/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-28T11:44:55.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4401" PostTypeId="1" AcceptedAnswerId="4404" CreationDate="2014-10-28T11:59:12.723" Score="1" ViewCount="923" Body="&lt;p&gt;I've using a matrix field from the same entry in two different templates. In one template I want them in the order they're displaying in the CMS, while in the other I want them displayed in reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cta in entry.ctas.order('desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can this be done any other way?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-10-28T12:44:29.603" Title="How to order matrix blocks in reverse" Tags="&lt;matrix&gt;&lt;sorting&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4402" PostTypeId="2" ParentId="4399" CreationDate="2014-10-28T12:20:37.670" Score="4" Body="&lt;p&gt;Your settings page doesn't need to include &lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also there's no need to define any block section. What's in your &lt;em&gt;template/settings.html&lt;/em&gt; file will be shown within that CP-area per default.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-28T12:20:37.670" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4403" PostTypeId="1" AcceptedAnswerId="11131" CreationDate="2014-10-28T12:26:22.917" Score="2" ViewCount="88" Body="&lt;p&gt;Complicated question regarding asset sharing for a client proposal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website to be built will contain reports uploaded by a super-admin. These reports will be PDFs, tagged by year and be about specific users. The users that the reports relate to will be registered members of the site, and will be able to view reports regarding themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users will be able to log in to their members area of the website (front-end), and &lt;strong&gt;send requests&lt;/strong&gt; to view other users' reports, and &lt;strong&gt;approve requests&lt;/strong&gt; from other users to view their own reports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User1 has a login to the site, and has access to user_1_report.pdf&lt;/li&gt;&#xA;&lt;li&gt;User2 logs in and sends a request to User1 to view user_1_report.pdf&lt;/li&gt;&#xA;&lt;li&gt;User1 receives a notification in their members area and can click &lt;strong&gt;Approve / Deny&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;User2 gains access to the user_1_report.pdf as a download link in their members area.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest how this might be implemented? I'm assuming that it needs to be done with a custom built plugin but I'd love to know if it's possible without.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is plugin-only and there are any Craft plugin developers available, let me know as there is a budget available for someone to build that area of the site if necessary.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-10-28T13:05:34.367" LastActivityDate="2015-08-23T05:22:56.733" Title="Question regarding member-owned shared assets" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4404" PostTypeId="2" ParentId="4401" CreationDate="2014-10-28T12:44:29.603" Score="3" Body="&lt;p&gt;I went and looked at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow&quot;&gt;MatrixBlockModel&lt;/a&gt;; there's an attribute named &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel#sortOrder&quot; rel=&quot;nofollow&quot;&gt;sortOrder&lt;/a&gt; (If you output &lt;code&gt;{{sortOrder}}&lt;/code&gt; inside the &lt;code&gt;for&lt;/code&gt; loop, it will display the index of that block).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use that attribute to sort by, in reverse:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cta in entry.ctas.order('sortOrder desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-10-28T12:44:29.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4405" PostTypeId="2" ParentId="4397" CreationDate="2014-10-28T12:52:13.167" Score="2" Body="&lt;p&gt;I guess that each of these PDFs are related to an entry using an assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is true, you could add an extra field &quot;Random Path&quot; to that entry and use that field's value as a segment of your PDF's URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can achieve this by setting the upload location for the PDFs to a subfolder named after that field's value. You set the subfolder path (i.e. to &lt;code&gt;{randomPath}&lt;/code&gt;) in Settings → Fields → &quot;myAssetField&quot; → Default Upload Location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;randomPath&lt;/code&gt; field has a value of &lt;code&gt;mUampRNYxcwXampC9QX&lt;/code&gt;, an PDF file &lt;code&gt;mySecureFile.pdf&lt;/code&gt; is saved like so: &lt;code&gt;/myPdfFolder/mUampRNYxcwXampC9QX/mySecureFile.pdf&lt;/code&gt; (in fact it is moved after the entry is saved).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To generate random strings for that field, use the fantastic Craft plugin &lt;a href=&quot;https://github.com/sjelfull/Craft-Randomm&quot; rel=&quot;nofollow&quot;&gt;&quot;Randomm&quot;&lt;/a&gt; by Fred Calsen.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-28T12:52:13.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4406" PostTypeId="2" ParentId="4396" CreationDate="2014-10-28T12:52:24.690" Score="3" Body="&lt;p&gt;The way the Craft docs do it is basically how you are already:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;userLastName&quot;&amp;gt;Last Name *&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;userLastName&quot; type=&quot;text&quot; name=&quot;fields[userLastName]&quot; {%- if entry is defined %} value=&quot;{{ entry.userLastName }}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-10-28T12:52:24.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4407" PostTypeId="1" AcceptedAnswerId="4412" CreationDate="2014-10-28T13:06:13.060" Score="0" ViewCount="150" Body="&lt;p&gt;I've got a multi-environment setup similar to the following, and thinking about adding database details to the index.php. In this way, I can pretty much just edit the index.php when creating new websites - staying out of app/config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch ($_SERVER['SERVER_NAME']) {&#xA;    case 'local.craft.dev':&#xA;        define('CRAFT_ENVIRONMENT', 'local');&#xA;        define('CRAFT_DB_USER', 'root');&#xA;        define('CRAFT_DB_PASSWORD', 'craftycraft');&#xA;        define('CRAFT_DB_DATABASE', 'local');&#xA;        break;&#xA;    case 'staging.com':&#xA;        define('CRAFT_ENVIRONMENT', 'staging');&#xA;        break;&#xA;    default:&#xA;        define('CRAFT_ENVIRONMENT', 'production');&#xA;        break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would there any potential security issues with this? I imagine being in the web root might be risky - but would having this information in db.php a level up really made a difference to a hacker?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would like to hear your thoughts!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2014-10-28T14:56:32.727" Title="Define database details in index.php" Tags="&lt;database&gt;&lt;multi-environment&gt;&lt;security&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4408" PostTypeId="1" CreationDate="2014-10-28T13:14:21.610" Score="3" ViewCount="591" Body="&lt;p&gt;A purely cosmetic change, but just wanted to know if its possible to change the menu item for Entries to something like Content? From a client point of view, I just know some will beg me to change this :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would also be handy to remove the Dashboard altogether as well for some cases.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-03-17T14:44:54.747" Title="Rename Entries to Content on CP top menu" Tags="&lt;control-panel&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4409" PostTypeId="2" ParentId="4408" CreationDate="2014-10-28T13:29:21.097" Score="3" Body="&lt;p&gt;For custom &quot;cosmetic&quot; changes on the Control Panel there's these two Plugins by Lindsey DiLoreto:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Control Panel CSS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do both, hiding and renaming of menu items with CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;#nav-dashboard {&#xA;  display: none;&#xA;}&#xA;&#xA;#nav-entries a,&#xA;#nav-entries a:hover,&#xA;#nav-entries a:active {&#xA;  color: transparent;&#xA;  word-spacing: -9999px;&#xA;  letter-spacing: -9999px;&#xA;}&#xA;&#xA;#nav-entries a:after {&#xA;  content: &quot;Content&quot;;&#xA;  color: #d7d9db;&#xA;  word-spacing: normal;&#xA;  letter-spacing: normal; &#xA;}&#xA;&#xA;#nav-entries a:hover:after,&#xA;#nav-entries a:active:after {&#xA;  color: #fff;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-28T15:03:50.950" LastActivityDate="2014-10-28T15:03:50.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4410" PostTypeId="2" ParentId="4408" CreationDate="2014-10-28T14:07:56.197" Score="3" Body="&lt;p&gt;Explain to your clients politely that the whole CMS controls 'Content' and that the entries tab controls a specific type of content called 'Entries'!&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-28T14:07:56.197" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4411" PostTypeId="1" AcceptedAnswerId="4413" CreationDate="2014-10-28T14:48:49.163" Score="1" ViewCount="800" Body="&lt;p&gt;I need to make a SoapClient &lt;code&gt;new SoapClient&lt;/code&gt; call from within one of my Models for a validation rule. When I create the new SoapClient instance class in my Model function I'm getting this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Class 'Craft\SoapClient' not found in...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the same error message whatever file Model/Service/Controller i put it in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateVatNumber()&#xA;{&#xA;    $client = new SoapClient(&quot;http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could anyone let me know what I should do to be able to make these calls? I'm guessing I somehow need to &quot;break free&quot; from the &lt;em&gt;Craft&lt;/em&gt; namespace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-10-28T14:57:10.870" Title="How call PHP native function in Model/Service/Controller scope" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4412" PostTypeId="2" ParentId="4407" CreationDate="2014-10-28T14:51:16.320" Score="2" Body="&lt;p&gt;As long as Apache and PHP are working like they’re supposed to, this is fine. Files that end in .php should always get processed by PHP before they’re served to the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the risks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If PHP is ever disabled, or the server is misconfigured so .php doesn’t get processed by PHP, then Apache will start serving that file directly, exposing all of your code (and in this case, your DB credentials).&lt;/li&gt;&#xA;&lt;li&gt;Every PHP file that gets loaded after index.php will be able to see those constants, and potentially echo them out. (Most likely this would be your own doing, e.g. you might be echoing out everything from &lt;a href=&quot;http://php.net/manual/en/function.get-defined-constants.php&quot; rel=&quot;nofollow&quot;&gt;get_defined_constants()&lt;/a&gt; while trying to debug something.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you can live with those, go for it. Personally, I’d say it’s just not worth it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-28T14:56:32.727" LastActivityDate="2014-10-28T14:56:32.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4413" PostTypeId="2" ParentId="4411" CreationDate="2014-10-28T14:57:10.870" Score="1" Body="&lt;p&gt;You need to backslash the class to tell it to look in the global namespace like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateVatNumber()&#xA;{&#xA;    $client = new \SoapClient(&quot;http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read on the basics of PHP namespacing here: &lt;a href=&quot;http://php.net/manual/en/language.namespaces.basics.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/language.namespaces.basics.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-28T14:57:10.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4414" PostTypeId="1" AcceptedAnswerId="4415" CreationDate="2014-10-28T16:18:08.020" Score="3" ViewCount="931" Body="&lt;p&gt;I'm new to Craft and I'm trying to achieve the following with a Craft Plugin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A user visits my site and can input a zip code to receive the corresponding contact person's name, phonenumber and image. I want to develop a plugin which allows the admin to create the contact person entries in the backend and which handles the ajax request by getting the right contact person form the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, the user sends the zip code 54343, an ajax request with that data is sent, the plugin queries the database, converts the result into a json-string and sends the ajax response back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm afraid I have no idea how to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create the table and import the data? (There is a CSV document)&#xA;Where do I send the ajax request to?&#xA;What structures of a Craft plugin do I need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd really appreciate your help.&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-01-16T23:48:03.850" Title="Search Contact Person Plugin via Ajax" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4415" PostTypeId="2" ParentId="4414" CreationDate="2014-10-28T17:06:38.180" Score="5" Body="&lt;p&gt;It's actually quite easy and you don't really need json or a plugin to do it. If you really need it as a plugin, then that's a whole different thing that would need a separate answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your search template file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;contacts&quot;&amp;gt;&amp;lt;!-- results will get inserted here. --&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;form id=&quot;find-contact-form&quot; data-url=&quot;/contacts&quot;&amp;gt;          &#xA;    &amp;lt;label for=&quot;zip&quot;&amp;gt;Zip Code&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;zip&quot;&amp;gt;&#xA;    &amp;lt;!-- submits form data via post to 'data-url' attribute --&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Find Contacts&quot;/&amp;gt; &#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your search template javascript file (make sure to include jquery):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function() {&#xA;    $('#find-contact-form').submit(function(event) {&#xA;        event.preventDefault();&#xA;&#xA;        var data = $(this).serialize();&#xA;        var url = $(this).attr('data-url');&#xA;&#xA;        $.post(url, data, function(result) {&#xA;            $('#contacts').html(result);&#xA;        }, 'html')&#xA;        .fail(function() {&#xA;            //console.log(&quot;error&quot;);&#xA;        });&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your contacts.html template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;&#xA;    {% set zip = craft.request.getParam('zip') %}&#xA;&#xA;    {% if zip %}&#xA;        {% set contacts = craft.entries.section('contacts').zip(zip) %}&#xA;        {% if contacts|length %}&#xA;            {% for contact in contacts %}&#xA;                &amp;lt;img src=&quot;{{ contact.image.first.url&quot; }}&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;                {{ contact.firstName }} {{ contact.lastName}}&amp;lt;br&amp;gt;&#xA;                T {{ contact.telephone}}&amp;lt;br&amp;gt;&#xA;            {% endfor %}&#xA;        {% else %}&#xA;            No contacts found with the zip {{ zip }}.&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use that same template for your normal contacts page. Just use the clause &lt;code&gt;{% if not craft.request.isAjax %}Put my full page content here.{% endif %}&lt;/code&gt;. In fact, the search page can just submit to itself using this technique.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2017-01-16T23:48:03.850" LastActivityDate="2017-01-16T23:48:03.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4416" PostTypeId="2" ParentId="4280" CreationDate="2014-10-28T18:03:14.497" Score="1" Body="&lt;p&gt;Based on the comments from my other answer and seeing the image you sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look in the template &lt;code&gt;hire-us/index.html&lt;/code&gt; where you are trying to include a template dynamically with the &lt;code&gt;entry.type&lt;/code&gt; variable, what that is generating does not correspond to a template you have, so it can't find the template to include and therefore you are getting the error.&#xA;As the error States craft is unable to find the template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try removing the include altogether and just put &lt;code&gt;{{ entry.type }}&lt;/code&gt; in the template and go through the process again so you can see what's being generated and get the name of the template you need to create to satisfy the include.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps &lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-10-28T18:03:14.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4417" PostTypeId="1" CreationDate="2014-10-28T18:08:27.470" Score="7" ViewCount="725" Body="&lt;p&gt;On the license enforcement help page, it says there are a number of checks to determine whether or not a domain is public. One of those checks is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Does it have a dev-sounding subdomain (e.g. ‘dev’, ‘local’, ‘loc’, ‘test’, ‘testing’, ‘stage’, or ‘staging’)?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there a sure-fire way of determining whether or not a subdomain is dev-sounding? For instance, what if my subdomain has the string 'staging' (e.g. &lt;a href=&quot;http://staging-subdomain.mysite.com&quot; rel=&quot;noreferrer&quot;&gt;http://staging-subdomain.mysite.com&lt;/a&gt;). Or what if it was just an unconventional sounding subdomain (e.g. &lt;a href=&quot;http://www-next.mysite.com&quot; rel=&quot;noreferrer&quot;&gt;http://www-next.mysite.com&lt;/a&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="940" LastEditorUserId="125" LastEditDate="2014-10-28T19:45:08.237" LastActivityDate="2021-04-05T21:15:55.477" Title="Craft license: what is considered a &quot;dev-sounding subdomain&quot;?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4418" PostTypeId="2" ParentId="4280" CreationDate="2014-10-28T18:25:27.917" Score="4" Body="&lt;p&gt;This has been solved via a support ticket, which I'm posting here for others etc.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The first time you load the template, the URI is mapping to your &quot;Get&#xA;  A Quote&quot; entry, which gets assigned to the entry variable when your&#xA;  template is loaded.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When you submit the form, the same URL is requested again, once again&#xA;  matching your &quot;Get A Quote&quot; entry, but this time the&#xA;  guestEntries/saveEntry controller action is summoned. When there's a&#xA;  validation error, Guest Entries will pass the new entry back to the&#xA;  template as an entry variable, overriding the &quot;Get A Quote&quot; entry that&#xA;  the URL matched. So, then the template gets routed to&#xA;  hire-us/index.html like it normally did, but this time entry.type is&#xA;  enquiryWeddingDance instead of getAQuote, since it's a different entry&#xA;  altogether. The template tries to include&#xA;  hire-us/enquiryWeddingDance.html, but that doesn't exist, so you get&#xA;  the error.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To fix this, I've just released an update to the Guest Entries plugin,&#xA;  which adds a new &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries#configuration&quot; rel=&quot;nofollow&quot;&gt;entryVariable config setting&lt;/a&gt;. You can use that to&#xA;  customize the variable name that Guest Entries will set the invalid&#xA;  entry to (i.e. 'guestEntry' or 'invalidEntry'), so it doesn't conflict&#xA;  with the entry variable that the request is getting routed to.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;After setting the Guest Entries variable as suggested in the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries#configuration&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;, it's now working as expected without conflicts. Thanks Brandon!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if guestEntry is defined %}{{ errorList(guestEntry.getErrors('variableName')) }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-10-30T16:31:07.620" LastActivityDate="2014-10-30T16:31:07.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4419" PostTypeId="2" ParentId="4377" CreationDate="2014-10-28T18:34:08.507" Score="2" Body="&lt;p&gt;So the issue appears to be with php56: after uninstalling 56 and installing 55 craft works as expected.&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2014-10-28T18:34:08.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4420" PostTypeId="2" ParentId="4417" CreationDate="2014-10-28T19:27:22.380" Score="4" Body="&lt;p&gt;&lt;code&gt;http://staging-subdomain.mysite.com&lt;/code&gt; would be considered a dev domain because we look for any of those keywords in the subdomain part of the URL.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;http://www-next.mysite.com&lt;/code&gt; would be considered a public domain because it does not meet any of the &lt;a href=&quot;https://craftcms.com/knowledge-base/how-craft-license-enforcement-works#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;criteria&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2021-04-05T21:15:55.477" LastActivityDate="2021-04-05T21:15:55.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4421" PostTypeId="2" ParentId="4330" CreationDate="2014-10-28T19:56:02.273" Score="1" Body="&lt;p&gt;The problem here was the URL in the database was wrong. I had assumed that config was entirely file-based but it seems that the config file is dependent upon the database Site URL. It would be great if this could be avoided as it makes deployment between environments so much easier without paths or URLs in the DB.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-28T19:56:02.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4422" PostTypeId="1" AcceptedAnswerId="4428" CreationDate="2014-10-28T21:57:10.407" Score="2" ViewCount="271" Body="&lt;p&gt;This is a specific question about the Dukt videos plugin. I have a site that's all HTTPS and I can't seem to find a way to switch all the embeds to also use HTTPS?  Is there an option anyone else knows of?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="6007" LastEditDate="2017-04-06T16:27:54.693" LastActivityDate="2017-04-06T16:27:54.693" Title="Use Dukt Videos with HTTPS" Tags="&lt;plugins&gt;&lt;https&gt;&lt;plugin-duktvideos&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4423" PostTypeId="1" CreationDate="2014-10-28T23:53:35.537" Score="0" ViewCount="23" Body="&lt;p&gt;I'm currently working on a registration page for users on a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two attributes that users may have on sign up that I need to reflect in the sign up process. (I will probably use checkboxes to indicate whether the user will have the categories assigned to them)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, my idea to solve this is to have categories for users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have to ask first, is it even possible to set a category from a template? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="930" LastActivityDate="2014-10-28T23:53:35.537" Title="Is it possible to add a category to an object through twig?" Tags="&lt;categories&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2014-10-30T16:24:16.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="4424" PostTypeId="1" CreationDate="2014-10-29T00:10:41.630" Score="1" ViewCount="791" Body="&lt;p&gt;How to automatically rename the image files to a random string during the upload process? For example, I have an image named &quot;big_poster.jpg&quot; and I want it to be saved as something random, for example &quot;2680542675157_cc7m541v_l.jpg&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see every asset have a &quot;Filename&quot; and &quot;Title&quot; field. Would be possible to use these fields to generate a random string? Perhaps using the &lt;a href=&quot;https://github.com/sjelfull/Craft-Randomm/&quot; rel=&quot;nofollow&quot;&gt;Randomm&lt;/a&gt; plugin?&lt;/p&gt;&#xA;" OwnerUserId="687" LastEditorUserId="687" LastEditDate="2014-11-10T23:37:17.793" LastActivityDate="2017-10-06T17:01:19.837" Title="How to automatically rename image uploads?" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4425" PostTypeId="1" CreationDate="2014-10-29T00:23:04.167" Score="8" ViewCount="1006" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/updates&quot;&gt;Craft updates come fast and frequent&lt;/a&gt; which introduces a problem when working with lots of people in a team.&#xA;Don't get me wrong, this is a &lt;em&gt;good&lt;/em&gt; problem to have!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are dev shops handling the update process when sites have multiple developers on them with multi feature branches running all at once?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main issue is the strong dependency each feature branch has with the database. Once you implement a craft update, craft doesn't like jumping around on older versions as you switch feature branches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What we're currently doing:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowAutoUpdates&quot;&gt;Disabling the ability for people to be able to update on the live production server&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Creating an &quot;Upgrade&quot; branch on git and doing the updates in that before merging them into the develop branch.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We still seem to be occasionally getting the odd issue of an old feature branch that is out of sync with the database/new install because of this we are still looking to improve this workflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Ideas we are tossing up:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Making a private repo of the &lt;code&gt;/app&lt;/code&gt; directory a submodule so the sites repo is rather clean.&lt;/li&gt;&#xA;&lt;li&gt;Disabling the ability to upgrade by default on all domains and treat updates as a &quot;big thing&quot; similar to how you would on an Expression Engine upgrade.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Would love to hear how others are tackling this &quot;convenient&quot; problem.&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2014-10-29T05:02:20.200" Title="Dealing with Upgrades and Git Workflow" Tags="&lt;workflow&gt;&lt;updating&gt;&lt;auto-updates&gt;&lt;git&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4426" PostTypeId="2" ParentId="4425" CreationDate="2014-10-29T00:45:37.413" Score="7" Body="&lt;p&gt;We at Familiar have decided to leave craft out of git because of this exact issue.  It's extra hassle every time an update comes out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To better deal with it we've built a couple of grunt functions as part of our craft yeoman generator.  You can see the whole generator on npm: &lt;a href=&quot;https://www.npmjs.org/package/generator-familiar-craft&quot; rel=&quot;noreferrer&quot;&gt;https://www.npmjs.org/package/generator-familiar-craft&lt;/a&gt;. Or just an idea of how the grunt tasks are setup: &lt;a href=&quot;https://github.com/familiar-studio/generator-familiar-craft/blob/master/app/templates/Gruntfile.js&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/familiar-studio/generator-familiar-craft/blob/master/app/templates/Gruntfile.js&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tasks are pretty simple, the first one will download the latest copy of craft, unzip it and then move just the app folder into place (perfect if your local environment gets way behind)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also have a database pull grunt task that grabs a copy of the live (or any staging) database and imports into your local database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way there's always a quick fix through one or both commands if things get out of sync on any of our developers local environments&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So our normal update process is this&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Update local to make sure everything's fine.&lt;/li&gt;&#xA;&lt;li&gt;Update live&lt;/li&gt;&#xA;&lt;li&gt;Celebrate!!&#xA;No committing needed.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Generally we treat craft just like any other project dependency manager like bower would and only add our own code to our repos &lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-10-29T05:02:20.200" LastActivityDate="2014-10-29T05:02:20.200" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4427" PostTypeId="1" AcceptedAnswerId="4429" CreationDate="2014-10-29T02:50:12.377" Score="0" ViewCount="548" Body="&lt;p&gt;I'm having a weird issue trying to figure out which database my staging site (staging.domain.com) is connecting too. On my staging site, craft is &lt;em&gt;up-to-date&lt;/em&gt;, but does not show the latest changes I made (added a new section and updated craft), which makes me think it's using the live database. However, if it's using the live DB, it should show craft as needing updates? All the other changes on the staging site are working fine (ie. tmpl &amp;amp; css updates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to troubleshoot, I added &lt;code&gt;devMode&lt;/code&gt; to my staging site array to see if my keys were working properly. This added the &lt;code&gt;devMode&lt;/code&gt; strip to the top of the CP. Next, I double checked both database on the server to make sure they were different. The staging DB has the new section I just added. Lastly, I cleared the cache to see if that made a difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I totally missing something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cpTrigger' =&amp;gt; 'cp-admin',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; $base_path,&#xA;            'baseUrl'  =&amp;gt; $base_url&#xA;        )&#xA;    ),&#xA;    '.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;    ),&#xA;    'stage.' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;    ),&#xA;    '.com' =&amp;gt; array(&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; '***pa_craft',&#xA;    ),&#xA;&#xA;    'stage.' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; '***pa',&#xA;        'password' =&amp;gt; '***',&#xA;        'database' =&amp;gt; '***pa_craft',&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; '***pa',&#xA;        'password' =&amp;gt; '***',&#xA;        'database' =&amp;gt; '***pa_craft_live',&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I just switched my local setup (dev) to point to the remote staging DB which connects and shows the updates. I also added a new entry to check to see if was writing to the correct DB. &lt;/p&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2014-10-29T03:26:51.210" LastActivityDate="2014-10-29T06:23:35.697" Title="How to check which DB craft is using?" Tags="&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4428" PostTypeId="2" ParentId="4422" CreationDate="2014-10-29T03:39:29.433" Score="2" Body="&lt;p&gt;We've run into this as well.  I don't know if there is a better fix, but for our case, we ended up using the video url parameter and the replace filter to get around it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.video|length %}&#xA;&#xA;&amp;lt;iframe src=&quot;{{ entry.video.url|replace(&quot;http://youtu.be/&quot;, &quot;https://www.youtube.com/embed/&quot;)|raw }}?wmode=transparent&amp;amp;enablejsapi=1&quot; width=&quot;640&quot; height=&quot;360&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot; allowscriptaccess=&quot;true&quot; enablejsapi=&quot;1&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-10-29T03:39:29.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4429" PostTypeId="2" ParentId="4427" CreationDate="2014-10-29T03:59:15.250" Score="2" Body="&lt;p&gt;If your domain name is actually &lt;code&gt;staging.somedomain.com&lt;/code&gt; and your multi-environment config is searching for &lt;code&gt;stage.&lt;/code&gt;, then they won't match up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What &lt;em&gt;will&lt;/em&gt; match, however, is the &lt;code&gt;.com&lt;/code&gt; key directly underneath it, which is probably what you're thinking is only for the live site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being more explicit with your matching multi-environment config keys will probably clear up the confusion.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-29T06:23:35.697" LastActivityDate="2014-10-29T06:23:35.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4430" PostTypeId="1" AcceptedAnswerId="4466" CreationDate="2014-10-29T04:08:59.253" Score="1" ViewCount="767" Body="&lt;p&gt;I've have a page that has a drag and drop ability to reorder a group of Structure entries (using jquery).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see order inside EntryModel (&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entrymodel&lt;/a&gt;) but it looks like Structure positioning is handled outside the EntryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once dropped and and the entries are reordered it submits to an action inside a plugin. If I reorder two entries (or any number) how do I set the new structure order?&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="3951" LastEditDate="2017-10-26T02:07:04.450" LastActivityDate="2017-10-26T09:27:51.087" Title="How do I reorder Structure entries on the front-end?" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4431" PostTypeId="1" CreationDate="2014-10-29T08:10:39.520" Score="2" ViewCount="506" Body="&lt;p&gt;We've got all the max settings set up OK as per &lt;a href=&quot;https://craftcms.com/support/upload-troubleshooting&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/upload-troubleshooting&lt;/a&gt;, but we are still getting errors. The log file just shows this, nothing more:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2014/10/24 11:26:35 [error] [application] Uploaded file was empty&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What else should we be looking for?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="3951" LastEditDate="2017-10-24T15:24:44.380" LastActivityDate="2017-10-24T15:24:44.380" Title="Uploaded file was empty" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4432" PostTypeId="1" CreationDate="2014-10-29T10:03:41.910" Score="2" ViewCount="462" Body="&lt;p&gt;I'm trying to import and process CSV data within a matrix field.&#xA;My situation is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a matrix field with one block and several fields inside. One of these is an asset field to upload a CSV file. Now I don't just need to upload this file to a specific destination but also directly want process the given data inside of my CSV file to write it into the database and also display the data in the backend after saving the entry. Furthermore I need to be able to edit the output of the CSV in the backend. The best case would be a table.&#xA;I specifically don't want to have a standalone plugin which provides the given data to a matching entry. That would kinda ruin the workflow for editors.&#xA;I would really love to have the upload inside of the suitable entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm just overlooking one simple solution but I don't see how I should do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I explained it good enough and am looking forward to some solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance and best regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JohN&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="818" LastEditDate="2014-10-29T11:11:19.710" LastActivityDate="2015-03-25T09:36:11.110" Title="How to process CSV files within a Matrix field?" Tags="&lt;entries&gt;&lt;assets&gt;&lt;matrix&gt;&lt;field&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4433" PostTypeId="1" AcceptedAnswerId="4467" CreationDate="2014-10-29T11:30:09.597" Score="5" ViewCount="2152" Body="&lt;p&gt;Seeing as moving entries between sections isn't supported (yet) through the Craft interface, I followed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2021/move-entries-between-sections&quot;&gt;Brandon's answer&lt;/a&gt; for a workaround through the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am moving entries from one structure to another; updating the &lt;code&gt;sectionId&lt;/code&gt; in the database works fine and the entries are moving over without a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the issues start when I try and make some of the entries children to others that have also been moved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried both dragging the entry through the Structure view and setting the parent in the dropdown while editing the entry, but both are coming up with the same error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An unknown error occurred.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And I am getting a 500 Internal Server error on this file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/index.php?p=admincp/api/structures/moveElement 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this a bug within Craft, or have I missed out on some other information that needs to be updated in the database?&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2019-01-19T13:15:32.953" Title="Move entry from one structure to another with parenting" Tags="&lt;entries&gt;&lt;structure&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4434" PostTypeId="2" ParentId="1624" CreationDate="2014-10-29T11:44:34.367" Score="6" Body="&lt;p&gt;The guys at Supercool have developed a &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/pimp-my-matrix/docs&quot; rel=&quot;nofollow&quot;&gt;Craft plugin&lt;/a&gt; that does exactly what I was after, and as a bonus it allows you to group matrix block types which is very handy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3&lt;/a&gt;, matrix block titles are now shown as part of the core functionality, thanks P&amp;amp;T!&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-12-03T09:25:37.873" LastActivityDate="2014-12-03T09:25:37.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4435" PostTypeId="2" ParentId="4422" CreationDate="2014-10-29T12:27:37.140" Score="1" Body="&lt;p&gt;So not a great solution but I wanted to share what we ended up doing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We edited the plugin directly by editing the getEmbedFormat() function in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft/plugins/videos/vendor/dukt/videos/src/Dukt/Videos/Vimeo/Video.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And just change the http to http so it's just.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return &quot;https://player.vimeo.com/video/%s&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also going to reach out to dukt to see if he'd change the default in the main plugin since https will work any site (with or without ssl)&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-10-29T12:27:37.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4436" PostTypeId="1" AcceptedAnswerId="4438" CreationDate="2014-10-29T14:04:24.273" Score="1" ViewCount="516" Body="&lt;p&gt;I have a Matrix field where one of my child fields is a Dynamic Dropdown that uses the following code to pull in entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.limit(null).section('dealers').type('online') %}&#xA;  { &quot;value&quot;:&quot;{{ entry.id }}&quot; , &quot;label&quot;:&quot;{{ entry | raw }}&quot;&#xA;    {% if entry.uri == '__home__' %} , &quot;default&quot;:true{% endif %}} &#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Matrix field has a handle of &lt;code&gt;mensPDPLinks&lt;/code&gt; and the child field has a handle of &lt;code&gt;retailer&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above code creates a dropdown containing a list of retailers from another section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When editing an entry containing this field a person can add as many retailers as needed by adding additional Matrix rows. It should be storing the entryID for each of the retailer entries they select. There are additional Matrix child fields to include other data to each retailer they select. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my templates I'd like to loop through the entries (retailers) they've added in the Matrix field and display some data from the retailers entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in a direction? I'm kinda lost as to how I can do this. &lt;/p&gt;&#xA;" OwnerUserId="476" LastActivityDate="2014-10-29T17:00:32.263" Title="Related entries from a dynamic dropdown" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4437" PostTypeId="1" AcceptedAnswerId="4453" CreationDate="2014-10-29T15:22:10.063" Score="0" ViewCount="996" Body="&lt;p&gt;I've been scratching my head over this for awhile and I can't seem to solve it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm after is the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have various categories with numerous sub categories. I'd like to be able to display the sub categories of a category that is related to an entry which is how my navigation  is set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code at the moment look like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.find({ section: 'landingPages' }) %}&#xA;   {% for entry in entries %}&#xA;       &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{% set colour = entry.category.find() %}{% for category in colour %}{{ category.slug|striptags }}{% endfor %}&quot; {% set colourTwo = entry.category.find() %}&#xA;           {% for category in colourTwo %} style=&quot;border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};&quot; {% endfor %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;           &amp;lt;div class=&quot;sub {% set sub = entry.category.find() %}{% for category in sub %}{{ category.slug|striptags }}{% endfor %}&quot;&amp;gt;&#xA;           {% set drop = entry.category.find({ }) %}&#xA;               &amp;lt;ul&amp;gt;&#xA;               {% for category in drop %}&#xA;                  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot; title=&quot;{{ category.title }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;               {% endfor %}&#xA;               &amp;lt;/ul&amp;gt;&#xA;           &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the moment it's just generating the category which is selected within the entry, i've tried various variations on descendant commands and nothing seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="665" LastActivityDate="2014-10-30T16:40:44.020" Title="Listing Sub Categories of a Category related to an entry" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4438" PostTypeId="2" ParentId="4436" CreationDate="2014-10-29T15:52:05.987" Score="2" Body="&lt;p&gt;You can loop though your &quot;myMatrixBlockName&quot; blocks to get all the retailers' entry IDs. Then use that array of IDs in a &lt;code&gt;craft.entries&lt;/code&gt; ElementCriteriaModel to get the entries you're after. Use &lt;code&gt;fixedOrder&lt;/code&gt; as a parameter to maintain the Matrix's sort order if you want that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set retailerIds = [] %}&#xA;&#xA;{# Loop `myMatrixBlockName` blocks to get the retailers' entry IDs #}&#xA;{% for block in entry.mensPDPLinks.type('myMatrixBlockName') %}&#xA;&#xA;    {% set retailerId = block.retailer %}&#xA;    {% set retailerIds = retailerIds|merge([retailerId]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Convert `retailerIds` array into comma separated list #}&#xA;{% set retailerIdString = retailerIds|join(', ') %}&#xA;&#xA;{# Get `retailers` in the same order as listed in the Matrix field #}&#xA;{% set retailers = craft.entries.id(retailerIdString).fixedOrder %}&#xA;&#xA;{# Loop `retailers` #}&#xA;{% for retailer in retailers %}&#xA;&#xA;    {{ retailer.title }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-29T17:00:32.263" LastActivityDate="2014-10-29T17:00:32.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4439" PostTypeId="1" AcceptedAnswerId="4442" CreationDate="2014-10-29T16:24:22.163" Score="1" ViewCount="420" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;The Craft site shows an example using a single comparison&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building upon this example from that page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.width('&amp;gt;= 100')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do something similar but where 'width' is ALSO less than or equal to 200?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceptually:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.width('&amp;gt;= 100 &amp;amp;&amp;amp; &amp;lt;= 200')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-10-29T16:50:21.473" Title="Can I have multiple comparisons within a single criteria parameter?" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4440" PostTypeId="1" AcceptedAnswerId="4445" CreationDate="2014-10-29T16:39:12.393" Score="0" ViewCount="59" Body="&lt;p&gt;I have an eLearning page people from a .gov domain need to access.  I want them to be able to sign up for a user account and get immediate access, but I only want people from within that domain and perhaps one other to have this privilege.  I would want to approve any other users before they gain access.  Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2014-10-29T18:06:04.140" Title="Limit Users Signup to Users from Specific Domain" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4441" PostTypeId="2" ParentId="4439" CreationDate="2014-10-29T16:49:47.410" Score="2" Body="&lt;p&gt;You can use some basic logic with &lt;code&gt;and&lt;/code&gt; or &lt;code&gt;or&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.width('and, &amp;gt;= 100, &amp;lt;= 200')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-29T16:49:47.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4442" PostTypeId="2" ParentId="4439" CreationDate="2014-10-29T16:50:21.473" Score="3" Body="&lt;p&gt;You can combine multiple criteria like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.width('and, &amp;gt;= 100, &amp;lt;= 200') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but what you can't do is to combine multiple statements to build more complex criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.width('and, &amp;gt;= 100, &amp;lt;= 200' or '&amp;gt;= 500') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in your case this wouldn't make much sense. But see my still unanswered question on this topic for another example: &lt;a href=&quot;https://craftcms.stackexchange.com/q/1948/125&quot;&gt;&quot;Complex logic on a ElementCriteriaModel parameter?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-10-29T16:50:21.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4443" PostTypeId="1" CreationDate="2014-10-29T17:20:17.160" Score="0" ViewCount="268" Body="&lt;p&gt;So, in my template I get what I'm calling parentCategory, and I can output what I need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentCategory = craft.categories.slug(craft.request.getSegment(2)) %}&#xA;{# parentCategory.title and parentCategory.slug output fine #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But shortly after, I'm wanting to get all the descendants of parentCategory, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = craft.categories.descendantOf(parentCategory.id).find() %}&#xA;{# outputs all categories, whether descendants or not #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems parentCategory.id is empty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ parentCategory.id }}&#xA;{# outputs nothing #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas where I'm going wrong here? Why is no ID being returned while title, slug and my custom fields are working fine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's line 1 and 2 from my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(3) %}&#xA;    {% set parentCategory = craft.categories.slug(craft.request.getSegment(2)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change line 2 to:&#xA;{% set parentCategory = craft.categories.slug(craft.request.getSegment(2)).first() %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\CategoryModel and its behaviors do not have a method or closure named &quot;first&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yet, I can repeat line 2 later in the template and include .first() and not get the error. What go on?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-10-29T17:56:53.820" LastActivityDate="2014-11-01T20:00:18.617" Title="Category ID not being returned" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4444" PostTypeId="2" ParentId="4443" CreationDate="2014-10-29T17:34:35.707" Score="3" Body="&lt;p&gt;The &lt;code&gt;craft.categories&lt;/code&gt; tag returns an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;, so &lt;code&gt;parentCategory.title&lt;/code&gt; really shouldn't work. Try changing the first line of code to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentCategory = craft.categories.slug(craft.request.getSegment(2)).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="250" LastEditDate="2014-10-30T16:10:04.863" LastActivityDate="2014-10-30T16:10:04.863" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4445" PostTypeId="2" ParentId="4440" CreationDate="2014-10-29T18:06:04.140" Score="2" Body="&lt;p&gt;Probably best to do all of this from a custom plugin (that way you can write the logic for the approval process).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But regardless, you can do something like this from the top of your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getServerName() is not &quot;mydomain.gov&quot; %}&#xA;    {% exit 503 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And similarly any controller actions would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;getServerName() !== 'mydomain.gov&quot; )&#xA;{&#xA;    throw new HttpException(503);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-29T18:06:04.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4446" PostTypeId="2" ParentId="4397" CreationDate="2014-10-29T19:07:44.693" Score="0" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow&quot;&gt;Internal Assets Plugin&lt;/a&gt; to have assets above your web root.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-10-29T19:07:44.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4447" PostTypeId="2" ParentId="4328" CreationDate="2014-10-29T22:24:04.243" Score="2" Body="&lt;p&gt;This is definitely a bug in Craft.  Doesn't just affect Matrix, but any relational field as well (Assets, Users, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not an super-easy fix, but as a workaround, you can re-save the entry in the original locale (before making any edits in the new) and the content will get duplicated over.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-29T22:24:04.243" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="4448" PostTypeId="1" AcceptedAnswerId="4449" CreationDate="2014-10-29T23:31:06.023" Score="59" ViewCount="10764" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What measures have been put in place in regards to securing Craft at the core level.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What measures have been put in place in regards to Craft's Plugins which make use of (connect to if you will) Craft's core?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If possible (without an opinion piece being written), is there anyway to make a comparison between other popular CMS and Craft in regards to security?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How does one know third party libraries which are used in Craft are secure?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft is built on &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;noreferrer&quot;&gt;Yii PHP Framework&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;noreferrer&quot;&gt;Twig&lt;/a&gt;. How secure are these?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Has Craft ever had any security incidents to date?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the case there is a security incident how does the team at Craft notify people such incident occurred?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1111/12&quot;&gt;How safe is auto-updating&lt;/a&gt; within Craft?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2019-02-19T18:07:17.113" Title="How secure is Craft and why is it secure?" Tags="&lt;security&gt;&lt;updating&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="45" ContentLicense="CC BY-SA 3.0" />
  <row Id="4449" PostTypeId="2" ParentId="4448" CreationDate="2014-10-30T03:12:02.863" Score="118" Body="&lt;p&gt;&lt;strong&gt;Updated Answer for Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated and consolidated the technical parts of this for Craft 3 and placed them in a security FAQ for easier referencing: &lt;a href=&quot;https://craftcms.com/guides/security-faq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/security-faq&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Answer for Craft 2)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me get this out of the way, first... &lt;a href=&quot;http://pragmatictips.com/30&quot; rel=&quot;nofollow noreferrer&quot;&gt;there is no perfect software&lt;/a&gt;.  Bugs exist and some of those will be security related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, we're pretty paranoid people (thanks NSA!) so we think about security a lot and take it seriously.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What measures have been put in place in regards to securing Craft at the core level.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head here's some of what we currently do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Perhaps the biggest thing Craft has going for it, in the event a security related bug is that we can get the fix deployed quickly to our users with Craft's one-click auto-updating.  In addition to that, we can mark a release as &quot;critical&quot;, which gets special attention in the control panel UI making it obvious there is an update that needs to occur. Thankfully, we've yet to use that feature.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft/Yii uses &lt;a href=&quot;http://php.net/manual/en/book.pdo.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PDO&lt;/a&gt; for all database queries, so all dynamic values are parameterized helping prevent SQL injection attacks. Don't think SQL injection attacks are still a problem? They are... even with the more &lt;a href=&quot;https://www.drupal.org/PSA-2014-003&quot; rel=&quot;nofollow noreferrer&quot;&gt;popular&lt;/a&gt; apps.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft validate sensitive cookie data to ensure no cookie tampering has taken place between requests.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft has &lt;a href=&quot;https://craftcms.com/help/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSRF token validation&lt;/a&gt; support to help prevent &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-site_request_forgery&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSRF&lt;/a&gt; attacks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt; auto-encodes all HTML by default, helping avoid &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-site_scripting&quot; rel=&quot;nofollow noreferrer&quot;&gt;XSS&lt;/a&gt; attack vectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Rich Text Fields have an HTML purification option that is enabled by default, which strips any malicious strings from the input. This is powered by the venerable &lt;a href=&quot;http://htmlpurifier.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;HTML Purifier&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft ensures that sensitive data (server paths, stack traces, etc.) doesn't get exposed to an end-user in the case where an error occurs and Dev Mode is disabled.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft uses email verification for creating new accounts. You can &lt;a href=&quot;https://craftcms.com/docs/config-settings#verificationCodeDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;configure&lt;/a&gt; how long the token in that email is valid.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft makes the control panel trigger &lt;a href=&quot;https://craftcms.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;configurable&lt;/a&gt; for better security by making it harder for people guess the entry point to your control panel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft exposes the &lt;a href=&quot;https://craftcms.com/docs/config-settings#blowfishHashCost&quot; rel=&quot;nofollow noreferrer&quot;&gt;blowFishHashCost&lt;/a&gt; config setting which helps control how long a breached password hash will survive a brute-force attack.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If a user has an &lt;a href=&quot;https://craftcms.com/docs/config-settings#maxInvalidLogins&quot; rel=&quot;nofollow noreferrer&quot;&gt;invalid login attempt X times&lt;/a&gt; within a &lt;a href=&quot;https://craftcms.com/docs/config-settings#maxInvalidLogins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Y window duration&lt;/a&gt;, you can force them to wait for &lt;a href=&quot;https://craftcms.com/docs/config-settings#cooldownDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z minutes before they try again &lt;em&gt;or&lt;/em&gt; permanently lock their account&lt;/a&gt; until an admin unlocks it. All configurable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The user session duration is &lt;a href=&quot;https://craftcms.com/docs/config-settings#userSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;configurable&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The default &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultFilePermissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;file&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultFolderPermissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;folder&lt;/a&gt; permissions are configurable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft jumps through some &lt;a href=&quot;https://craftcms.com/help/secure-in-app-purchasing&quot; rel=&quot;nofollow noreferrer&quot;&gt;pretty significant hoops&lt;/a&gt; to ensure in-app purchasing is secure &lt;em&gt;even on installs without SSL enabled&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft helps prevent session/cookie hijacking, by doing things like storing the browser's user agent string in the identity cookie and validating that it matches on subsequent session requests.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft will deny all requests to start a session that don't present a user agent string or IP address to prevent direct socket connections from trying to connect.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft uses &lt;a href=&quot;https://craftcms.com/news/new-security-features&quot; rel=&quot;nofollow noreferrer&quot;&gt;elevated sessions&lt;/a&gt; that forces people to re-enter/validate their existing password for critical actions (changing passwords, emails, permissions, etc.). By default these elevated sessions are valid for 5 minutes, but that is &lt;a href=&quot;https://craftcms.com/docs/config-settings#elevatedSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;configurable&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;No one, not even admins, can directly change another user's password.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft's codebase has been frequently audited by third party security firms and with tools like &lt;a href=&quot;https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project&quot; rel=&quot;nofollow noreferrer&quot;&gt;OWASP's Zed Attack Proxy Project&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft has permission enforcement at the controller level for all actions that make changes to the site.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft requires PHP 5.3. &lt;a href=&quot;https://wordpress.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Some applications&lt;/a&gt; are still supporting back to PHP 5.2.4, which is over &lt;em&gt;14 years&lt;/em&gt; old (approximately 980 internet years).  Craft 3 will require 5.6.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft requires &lt;a href=&quot;http://php.net/manual/en/book.mcrypt.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;mcrypt&lt;/a&gt; with &lt;a href=&quot;http://php.net/manual/en/mcrypt.ciphers.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;blowfish&lt;/a&gt; for password hashing, arguably the currently most secure and reliable method of password encryption.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is a &lt;a href=&quot;https://craftcms.com/help/force-ssl&quot; rel=&quot;nofollow noreferrer&quot;&gt;help article&lt;/a&gt; explaining how to force SSL for all CP requests. (&lt;a href=&quot;http://craftcms.com/help/force-ssl&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms.com/help/force-ssl&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft inserts caution tape across the top of all control panel pages when running in Dev Mode, reminding you not to use it on production.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft can be &lt;a href=&quot;https://craftcms.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow noreferrer&quot;&gt;configured&lt;/a&gt; to store PHP session files in a Craft folder (&lt;code&gt;craft/storage/runtime/sessions&lt;/code&gt;) so they don't get mingled with other app's session files on shared host.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft provides granular permissions on user accounts and user groups via a intuitive/simple permission system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft provides a &lt;a href=&quot;https://craftcms.com/docs/config-settings#preventUserEnumeration&quot; rel=&quot;nofollow noreferrer&quot;&gt;preventUserEnumeration&lt;/a&gt; config setting for people that want to prevent user enumeration attempts on their forgot password pages.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft provides a &lt;a href=&quot;https://craftcms.com/docs/config-settings#validateUnsafeRequestParams&quot; rel=&quot;nofollow noreferrer&quot;&gt;validateUnsafeRequestParams&lt;/a&gt; config setting that will ensure certain request parameters, such as redirect, are not tampered with on a POST request preventing a Denial of Service (DoS) attack vector. This config setting will be removed in the upcoming Craft 3 and the behavior will be enabled by default in Craft itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft's session cookies get set to HTTP only.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By default Craft will set the &lt;code&gt;secure&lt;/code&gt; flag on all cookies if the request is over &lt;code&gt;https&lt;/code&gt;. You can set the &lt;a href=&quot;http://craftcms.com/docs/config-settings#useSecureCookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;useSecureCookies&lt;/a&gt; config setting to &lt;code&gt;true&lt;/code&gt; to force the &lt;code&gt;secure&lt;/code&gt; flag no matter what.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because Craft requires &lt;a href=&quot;http://php.net/manual/en/book.openssl.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenSSL&lt;/a&gt;, we have a cryptographically strong way of generating randomness for things like email verification and password reset tokens.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft keep logs of any error and/or suspicious activity to help track issues down.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any uploaded files have their file names cleaned as well as any code embedded in the image stripped.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft's default folder structure encourages people to keep Craft's application files above the web root and the requirements page at &lt;code&gt;yourdomain.com/cpTrigger/utils/serverinfo&lt;/code&gt; does a test and warns you if sensitive Craft folders appear to be in the public web root.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We provide an &lt;a href=&quot;https://craftcms.com/updates.rss&quot; rel=&quot;nofollow noreferrer&quot;&gt;RSS feed for updates&lt;/a&gt; you can subscribe to that includes all bug fixes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft sets the &lt;code&gt;X-Frame-Options: SAMEORIGIN&lt;/code&gt; header on all control panel requests to prevent the CP from being loaded in an iframe to help prevent &lt;a href=&quot;https://www.owasp.org/index.php/Clickjacking&quot; rel=&quot;nofollow noreferrer&quot;&gt;clickjacking&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft sets the &lt;code&gt;X-Content-Type-Options: nosniff&lt;/code&gt; header on all control panel requests to help prevent some older IE/Ajax XSS attack vectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft uses timing safe methods for sensitive comparisons like checking password the equality of password hashes helping prevent &lt;a href=&quot;https://en.wikipedia.org/wiki/Timing_attack&quot; rel=&quot;nofollow noreferrer&quot;&gt;timing attacks&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is a “&lt;a href=&quot;https://craftcms.com/support/securing-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Securing Craft&lt;/a&gt;” support article to help guide people through securing their Craft installation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And keep in mind that there are still plenty of additional security related things on &quot;The List&quot; that we plan on implementing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What measures have been put in place in regards to Craft's Plugins which make use of (connect to if you will) Craft's core?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Permissions are enforced at the user/user group level, so if a user is using a plugin as an admin, then they'll be able to use any of Craft's services that require an admin.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If possible (without an opinion piece being written), is there anyway to make a comparison between other popular CMS and Craft in regards to security?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Someone smarter than me will have to do that.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How does one know third party libraries which are used in Craft are secure? Craft is built on Yii PHP Framework and Twig. How secure are these?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Lumping these two together because as far as Craft is concerned, &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt; are both third party libraries as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember... &lt;a href=&quot;https://softwareengineering.stackexchange.com/questions/195571/is-it-possible-to-reach-absolute-zero-bug-state-for-large-scale-software&quot;&gt;there is no bug-free software&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm much more comfortable with using 3rd party libraries for things like a &lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;templating language&lt;/a&gt;, an &lt;a href=&quot;http://simplepie.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RSS feed reader&lt;/a&gt;, an &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; rel=&quot;nofollow noreferrer&quot;&gt;email library&lt;/a&gt;, an &lt;a href=&quot;https://github.com/guzzle/guzzle&quot; rel=&quot;nofollow noreferrer&quot;&gt;HTTP client&lt;/a&gt; and even (especially) a &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;framework&lt;/a&gt; instead of attempting to roll our own for various reasons.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not our core competency.  The people working on these libraries have gained very specific, very valuable &lt;a href=&quot;https://en.wikipedia.org/wiki/Domain_knowledge&quot; rel=&quot;nofollow noreferrer&quot;&gt;domain knowledge&lt;/a&gt; about the problems their libraries are trying to solve. We can't (and shouldn't) try to be the experts in all of those areas and we should be focusing on what we do best. For example... if I had to write &lt;a href=&quot;https://github.com/simplepie/simplepie/blob/master/library/SimplePie.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;this code&lt;/a&gt;, I'd drink myself to death.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The libraries we use have been around a long time, are very popular and have been tried and tested across countless installs, configurations and use-cases.  On an order of magnitude greater than the Craft install base is. The more installs and eyeballs on the code, the more it's been exposed and audited.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Worst case scenario. A devastating security bug and exploit is revealed &lt;em&gt;before&lt;/em&gt; the library has had a chance to release an update (which is kind of a jerk move). If we think the library authors are taking too long for a fix, we can fork the library, fix it with a patch of our own and merge in the official patch when it's been released.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Has Craft ever had any security incidents to date?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nothing that's been exploited that we're aware of. Nearly everything that we've found or that people have reported to us has been pretty minor.  i.e. XSS vulnerabilities that could occur in the control panel under very specific conditions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the case there is a security incident how does the team at Craft notify people such incident occurred?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Depends entirely on the severity of the incident.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All fixed bugs get mentioned in the change log and we tweet about every release: &lt;a href=&quot;http://craftcms.com/changelog&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms.com/changelog&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is severe, then we have the ability to mark an update as &quot;critical&quot;, bringing special attention to it as well as filing an official &lt;a href=&quot;https://cve.mitre.org/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;CVE&lt;/a&gt;, blog post, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2019-02-19T18:07:17.113" LastActivityDate="2019-02-19T18:07:17.113" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="4450" PostTypeId="1" CreationDate="2014-10-30T06:05:56.080" Score="5" ViewCount="5346" Body="&lt;p&gt;I am trying to simply change a &lt;code&gt;nav&lt;/code&gt; element if one homepage and another if on the blog or another page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can the following to display if I set the following statement to &lt;code&gt;!=&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getUrl() == 'http://testsite.com/page/' %}&#xA;    {{siteUrl}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I can't figure out what that is returning as no matter what I put it doesn't work. &lt;/p&gt;&#xA;" OwnerUserId="946" LastEditorUserId="250" LastEditDate="2014-10-30T16:08:00.260" LastActivityDate="2014-10-30T16:08:00.260" Title="If url do something" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4451" PostTypeId="2" ParentId="4450" CreationDate="2014-10-30T06:49:42.030" Score="10" Body="&lt;p&gt;Personally, I'd use segments for that. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.lastSegment == &quot;page&quot; %}&#xA;   do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segments(1) == &quot;page&quot; %}&#xA;   do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These days, though, when not making a dynamic nav, I tend to pass a variable to my extended layouts or nav include. I find it much more flexible / robust than just relying on URL structures or segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In child template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentNav = &quot;home&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'includes/_nav' with {'currentNav':'home'} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In include or extended layout&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentNav == &quot;home&quot; %}&#xA;   do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2014-10-30T06:58:36.223" LastActivityDate="2014-10-30T06:58:36.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4452" PostTypeId="2" ParentId="4450" CreationDate="2014-10-30T07:35:55.070" Score="6" Body="&lt;p&gt;In addition to the options Jerome mentioned, you can also test for the Entry Type, which typically would be different for homepage vs blog, etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'home' %}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Switch also works well here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.type %}&#xA;   {% case 'home' %}&#xA;   ...&#xA;   {% case 'blog' %}&#xA;   ...&#xA;   {% default %}&#xA;   ...&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-30T07:35:55.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4453" PostTypeId="2" ParentId="4437" CreationDate="2014-10-30T15:09:21.470" Score="6" Body="&lt;p&gt;Check out the documentation for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot;&gt;craft.categories&lt;/a&gt; which should do what you need. In this example, I assume that 'landing pages' are the same as your level 1 categories, in which case you don't need to deal with the entries at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('navCategories') %}&#xA;&#xA;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {# using 'nav' and 'children' will create a recursive loop #}&#xA;    {% nav category in categories %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {% if category.level == 1 %}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ category.slug }}&quot; style=&quot;border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};&quot; &amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;            {% ifchildren %}&#xA;                &amp;lt;div class=&quot;sub{{ category.level }} {{ category.slug }}&quot;&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you only want a certain number of levels then you can use a level filter. I.e:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('navCategories').level('&amp;lt; 3') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; If level 1 categories are not the same as your landing pages then you can access the category through &lt;code&gt;entry.category.first&lt;/code&gt;, and then category decendants using: &lt;code&gt;{% for category in category.descendants %}...{% endfor %}&lt;/code&gt; or &lt;code&gt;{% nav category in category.descendants %}...{% endnav %}&lt;/code&gt; using the recursive method above.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% set entries = craft.entries.section('landingPages') %}&#xA;    {% for entry in entries %}&#xA;        {% set category = entry.category.first %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ category.slug }}&quot; style=&quot;border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};&quot; &amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;ul class=&quot;sub {{ category.slug }}&quot;&amp;gt;&#xA;                {# using 'nav' and 'children' will create a recursive loop, if more levels are needed #}&#xA;                {% nav category in category.descendants %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ category.url }}&quot; title=&quot;{{ category.title }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;                        {% ifchildren %}&#xA;                            &amp;lt;ul class=&quot;sub{{ category.level }}&quot;&amp;gt;&#xA;                                {% children %}&#xA;                            &amp;lt;/ul&amp;gt;&#xA;                        {% endifchildren %}&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endnav %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a side-note: Keep in mind that you can also define css dynamically within the loop rather than defining it on the elements directly, if you wanted to.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set css %}&#xA;    a.{{ category.slug }} { &#xA;        border-color: {{ category.supplierColour }}; &#xA;        color:{{ category.supplierColour }}; &#xA;    } &#xA;{% endset %}&#xA;{% includeCss css %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-10-30T16:40:44.020" LastActivityDate="2014-10-30T16:40:44.020" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4454" PostTypeId="1" AcceptedAnswerId="4465" CreationDate="2014-10-30T15:22:11.553" Score="1" ViewCount="271" Body="&lt;p&gt;I'm still trying to process my csv data as mentioned in a former question. But I'm struggling with another part of this right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided to implement a custom field type which should display the data from my csv in a table to make it further editable for editors. The problem is that I don't even get something shown in this table even without processing a csv file before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried something really simple, at least I thought it was...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    $id = 'test';&#xA;    $cols = array(&#xA;        'Sample' =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Heading',&#xA;            'type'    =&amp;gt; 'singleline'&#xA;        )&#xA;    );&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('csvImport/csvimport', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value,&#xA;        'id'    =&amp;gt; $id,&#xA;        'cols'  =&amp;gt; $cols,&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works until the point of saving the data. Craft stores everything into database as a string. No matter how many cols I use, it will always result in a string which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;{&quot;1&quot;:&quot;Sample&quot;:&quot;The entered string&quot;}}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what craft stores in the database, so at least the data is processed. But how the pencil do I get this stuff to show up in the table of my template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any other idea how I could solve my problem, please let me know!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table id=&quot;{{ id }}&quot; class=&quot;shadow-box editable&quot;&amp;gt;&#xA;&amp;lt;thead&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        {% for col in cols %}&#xA;            &amp;lt;th scope=&quot;col&quot; class=&quot;header&quot;&amp;gt;{{ col.heading ? col.heading : ' ' }}&amp;lt;/th&amp;gt;&#xA;        {% endfor %}&#xA;        {% if not static %}&#xA;            &amp;lt;th class=&quot;header&quot; colspan=&quot;2&quot;&amp;gt;&amp;lt;/th&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/thead&amp;gt;&#xA;&amp;lt;tbody&amp;gt;&#xA;    {% for rowId, row in rows %}&#xA;        &amp;lt;tr data-id=&quot;{{ rowId }}&quot;&amp;gt;&#xA;            {% for colId, col in cols %}&#xA;                {% set cellName = name~'['~rowId~']['~colId~']' %}&#xA;                {% set value = (row[colId] is defined ? row[colId] : null) %}&#xA;                {% set textual = (col.type in ['singleline','multiline','number']) %}&#xA;                &amp;lt;td class=&quot;{% if textual %}textual{% endif %} {% if col.class is defined %}{{ col.class }}{% endif %}&quot;{% if col.width is defined %} width=&quot;{{ col.width }}&quot;{% endif %}&amp;gt;&#xA;                    {%- if col.type == 'select' -%}&#xA;                        {% include &quot;_includes/forms/select&quot; with {&#xA;                            class:    'small',&#xA;                            name:     cellName,&#xA;                            options:  col.options,&#xA;                            value:    value,&#xA;                            disabled: static&#xA;                        } only %}&#xA;                    {%- elseif col.type == 'file' -%}&#xA;                        {% include &quot;_includes/forms/file&quot; with {&#xA;                            class:    'small',&#xA;                            name:     cellName,&#xA;                            value:    value&#xA;                        } only %}&#xA;                    {%- elseif col.type == 'checkbox' -%}&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;{{ cellName }}&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ cellName }}&quot; value=&quot;1&quot;{% if value %} checked{% endif %}{% if static %} disabled{% endif %}&amp;gt;&#xA;                    {%- else -%}&#xA;                        &amp;lt;textarea name=&quot;{{ cellName }}&quot; rows=&quot;1&quot;{% if static %} disabled{% endif %}&amp;gt;{{ dump(value) }}&amp;lt;/textarea&amp;gt;&#xA;                    {%- endif -%}&#xA;                &amp;lt;/td&amp;gt;&#xA;            {% endfor %}&#xA;            {% if not static %}&#xA;                &amp;lt;td class=&quot;thin action&quot;&amp;gt;&amp;lt;a class=&quot;move icon&quot; title=&quot;{{ 'Reorder'|t }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td class=&quot;thin action&quot;&amp;gt;&amp;lt;a class=&quot;delete icon&quot; title=&quot;{{ 'Delete'|t }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/tbody&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this is the relevant part for the ouput of my values.&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="818" LastEditDate="2014-10-31T12:12:35.177" LastActivityDate="2014-10-31T12:28:07.710" Title="Why won't the values of an editableTableField show up in my template?" Tags="&lt;templating&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4455" PostTypeId="2" ParentId="1545" CreationDate="2014-10-30T15:37:54.233" Score="0" Body="&lt;p&gt;&lt;strong&gt;Single Line-Break&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To insert a &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br&quot; rel=&quot;nofollow&quot;&gt;line-break &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;/a&gt; into a Redactor text field use &lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; on your keyboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do this for single &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br&quot; rel=&quot;nofollow&quot;&gt;line-breaks&lt;/a&gt; only! You or your client should not misuse the &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tag for  styling purposes by adding multiple of them in a row. It is semantically wrong (and you can't be sure how browsers interpret it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With older versions of Redactor / Craft it was possible to do this. I can still save Redactor fields with &lt;code&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/code&gt; on a Craft 1.3 installation, but something must have changed down the road, because now all but one gets removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there's other ways to make adding vertical space within a Redactor field possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Horizontal Line&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it matches the semantic meaning of that space you create, what about using a &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr&quot; rel=&quot;nofollow&quot;&gt;horizontal line &lt;code&gt;&amp;lt;hr&amp;gt;&lt;/code&gt;&lt;/a&gt; instead and style it to your needs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hr {&#xA;  height: 3em;&#xA;  visibility: hidden;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Redactor has a build-in button for &lt;code&gt;&amp;lt;hr&amp;gt;&lt;/code&gt;. Edit your &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow&quot;&gt;Redactor configs&lt;/a&gt; for it to show up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: [&#xA;        'html','formatting','bold','italic',&#xA;        'unorderedlist','orderedlist','link','image','video',&#xA;        'horizontalrule'&#xA;    ],&#xA;    plugins: ['fullscreen'],&#xA;    toolbarFixedBox: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DIV&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That vertical space should not have any semantic meaning at all and you simply want an option to insert some beautiful white space? Then it gets a bit more complicated, because what you should add to your markup in this case is a sematically meaningless element, a &lt;code&gt;div&lt;/code&gt; or &lt;code&gt;span&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, switch to &quot;HTML Mode&quot; in your Redactor field and add an empty &lt;code&gt;div&lt;/code&gt; inbetween your paragraphs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;        More white space for these paragraphs, please!&#xA;&amp;lt;/p&amp;gt;&#xA;&amp;lt;div class=&quot;whitespace&quot;&amp;gt;&amp;lt;div&amp;gt;&#xA;&amp;lt;p&amp;gt;&#xA;        More white space for these paragraphs, please!&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have to configure Redactor to not convert &lt;code&gt;div&lt;/code&gt; on save by setting &lt;code&gt;convertDivs:false&lt;/code&gt;. (note that this setting &lt;a href=&quot;http://imperavi.com/redactor/docs/whats-new-10/&quot; rel=&quot;nofollow&quot;&gt;will be renamed to &lt;code&gt;replaceDivs&lt;/code&gt;&lt;/a&gt; with Redactor 10).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make inserting such &lt;code&gt;div&lt;/code&gt; easier, write you own little Craft / Redactor plugin that inserts the HTML with the click on a button and add some CSS to style your white space on the backend. A good starting point for the JS might be the &lt;a href=&quot;http://imperavi.com/redactor/examples/insert-html/&quot; rel=&quot;nofollow&quot;&gt;&quot;Insert HTML&quot; Redactor plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://imperavi.com/redactor/examples/insert-html/&quot; rel=&quot;nofollow&quot;&gt;Craft plugin &quot;RedactorClips&quot;&lt;/a&gt; could be an alternative, but I think there's no option to set custom CSS for the backend.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-10-30T15:52:04.320" LastActivityDate="2014-10-30T15:52:04.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4456" PostTypeId="1" AcceptedAnswerId="4457" CreationDate="2014-10-30T16:46:52.960" Score="4" ViewCount="1456" Body="&lt;p&gt;As an extension of this question&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/52/how-to-link-to-previous-next-entries-in-a-section&quot;&gt;How to link to previous/next entries in a section?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my page is set to automatically provide a &lt;code&gt;entry&lt;/code&gt; var in my template.&#xA;And I can simply access a field like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which means I don't need to do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('blog').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I want to get the next entry and previous entry based on this entry's entry type. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="768" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-10-30T17:46:46.747" Title="Get next entry based on entry type" Tags="&lt;templating&gt;&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4457" PostTypeId="2" ParentId="4456" CreationDate="2014-10-30T16:58:33.067" Score="7" Body="&lt;p&gt;No, you still have to set the parameters by your own:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get this entry's entry type #}&#xA;{% set type = entry.getType() %}&#xA;&#xA;{# Set parameters for prev/next elements list #}&#xA;{% set params = craft.entries.section('blog').type(type) %}&#xA;&#xA;{# Get the prev/next elements #}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{# And make sure to only output the links if the element exists #}&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-30T16:58:33.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4458" PostTypeId="1" AcceptedAnswerId="4462" CreationDate="2014-10-30T18:14:40.387" Score="2" ViewCount="121" Body="&lt;p&gt;My plugin has a custom element type. The element type uses a standard &quot;title&quot; field, implemented by &lt;code&gt;MyElementType::hasTitles()&lt;/code&gt; returning &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, my element type contains a few hard-coded fields. The whole plugin has been built out and working great, I'm very happy with how all of the components interact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm trying to refine the &lt;strong&gt;validation&lt;/strong&gt; of when an element is saved. It's easy to make a field required by simply adding &lt;code&gt;'required' =&amp;gt; true&lt;/code&gt; when defining the field in my Record. And when a user attempts to save an element without filling in that field, the proper error message will be triggered and displayed in my template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's the catch...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user leaves empty both the &lt;strong&gt;title field&lt;/strong&gt; and my &lt;strong&gt;hard-coded field&lt;/strong&gt;, only one of them will display an error message at a time. Specifically, only the hard-coded field will display the error message first. Once that has been filled in, the title error message will be triggered on the second submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? Is there a specific way to merge these error messages together so that they are both returned to the template at the same time?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-30T20:40:53.717" Title="Merge element type errors? (title + hard-coded field)" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4459" PostTypeId="1" AcceptedAnswerId="4463" CreationDate="2014-10-30T19:07:32.337" Score="4" ViewCount="786" Body="&lt;p&gt;I'd like to know if it's possible to extend another plugin with my own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using the Sprout Forms plugin to create a contact form on our website, and I would like to extend that so when a user submits the form, it signs them up to a campaign monitor list as well (with their permission of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Craft? If so where in the documentation would I look for more info?&lt;/p&gt;&#xA;" OwnerUserId="906" LastEditorUserId="115" LastEditDate="2014-10-31T18:45:06.210" LastActivityDate="2014-10-31T18:45:55.327" Title="How do I extend another plugin?" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;events&gt;&lt;plugin-sproutforms&gt;&lt;extends&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4460" PostTypeId="1" AcceptedAnswerId="4461" CreationDate="2014-10-30T19:16:02.237" Score="5" ViewCount="337" Body="&lt;p&gt;I am doing some content modeling for a site with over 100 pages with a pretty deep tree. The site has a lot of what I refer to as &quot;General Pages&quot; as well as a collection of channel type content in the form of news, blogs, and such. In addition there are many unique pages such as contact and application form pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main question is: How to section the over 100 general pages for best balance for client friendliness?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do I create one &quot;General Page&quot; channel section and then use or build&#xA;some sort of nav add-on to create the appropriate heirarchy (This is&#xA;how we'd roll if we were building this in EECMS for example)?&lt;/li&gt;&#xA;&lt;li&gt;Do I use multiple structures, one for each primary nav item? And then figure out how to mix in the other unique singles and entries?&lt;/li&gt;&#xA;&lt;li&gt;Tons of singles? (my least favorite option)&lt;/li&gt;&#xA;&lt;li&gt;Something else?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know the answer to these questions given a CMS as flexible as Craft is simply &quot;Yes&quot;; however, would love to get some thoughts on how people have dealt with a well branched site map and lots of &quot;General Pages&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="329" LastEditorUserId="329" LastEditDate="2014-10-30T20:26:04.643" LastActivityDate="2014-10-30T21:39:45.980" Title="Content Modeling for Site Architecture Recommendations" Tags="&lt;content&gt;&lt;models&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4461" PostTypeId="2" ParentId="4460" CreationDate="2014-10-30T20:34:52.947" Score="3" Body="&lt;p&gt;It sounds like you have 3 different general buckets of entries to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Streams of similar entries (News section, blogs, etc.)&lt;/li&gt;&#xA;&lt;li&gt;General content pages (100+ of them)&lt;/li&gt;&#xA;&lt;li&gt;Unique/one-off pages (Contact Us, application forms, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Streams&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the easy ones: the streams of similar content (news, blogs, etc.) should each get their own Channel sections. A News channel, Bill’s Blog, Sally’s Blog, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;General content pages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the 100+ general pages, I think putting them all in a single “Pages” section makes sense. Find out what different types of pages there will be, and give the section different Entry Types based on those, so authors have the flexibility of choosing what type of page they want to create.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL format-wise, you can either require that these entries follow a particular slug-based URL format (e.g. every page will have a url such as &lt;a href=&quot;http://example.com/some-slug&quot; rel=&quot;nofollow&quot;&gt;http://example.com/some-slug&lt;/a&gt;), or give them a custom “Page URL” field where authors can choose what the entry URL would be. For the former, the section’s Entry URL Format setting would get set to &lt;code&gt;{slug}&lt;/code&gt;; for the latter, it would be &lt;code&gt;{pageUrlFieldHandle}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the type of section Pages should be (a Structure or a Channel), here’s a good rule of thumb: Do you want &lt;em&gt;all&lt;/em&gt; of the pages in this section to be shown in the navigation, or just certain ones? If you want them &lt;em&gt;all&lt;/em&gt; in the nav, then use a Structure, and use the built-in Structure View on the Entries index to sort out the navigation. Otherwise make it a Channel, and manage the navigation separately (&lt;a href=&quot;https://github.com/am-impact/amnav/&quot; rel=&quot;nofollow&quot;&gt;a&amp;amp;m nav&lt;/a&gt; and &lt;a href=&quot;https://craftpl.us/plugins/craftnav&quot; rel=&quot;nofollow&quot;&gt;Craft Nav&lt;/a&gt; are your two navigation options at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Unique pages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the unique pages like Contact Us and application forms. If you have any pages that are truly unique, which you would never conceive needing two of (e.g. a Contact Us page that has a bunch of custom fields that really only apply to that specific page), create Single sections for those pages. Otherwise you may just prefer to lump these in with the Pages section, with the help of a new entry type(s) (e.g. “Application Form”).&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-30T21:39:45.980" LastActivityDate="2014-10-30T21:39:45.980" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4462" PostTypeId="2" ParentId="4458" CreationDate="2014-10-30T20:40:53.717" Score="4" Body="&lt;p&gt;You can pass the element off to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ContentService#validateContent-detail&quot; rel=&quot;nofollow&quot;&gt;ContentService::validateContent()&lt;/a&gt; in the event that it doesn't pass the record’s validation, just to get those  errors mixed into the element as well.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if (!$record-&amp;gt;validate())&#xA;{&#xA;    // Copy the record's errors over to the element model&#xA;    $element-&amp;gt;addErrors($record-&amp;gt;getErrors());&#xA;&#xA;    // Might as well validate the content as well,&#xA;    // so we get a complete list of validation errors&#xA;    if (!craft()-&amp;gt;content-&amp;gt;validateContent($element))&#xA;    {&#xA;        // Copy the content model's errors over to the element model&#xA;        $element-&amp;gt;addErrors($element-&amp;gt;getContent()-&amp;gt;getErrors());&#xA;    }&#xA;&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-10-30T20:40:53.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4463" PostTypeId="2" ParentId="4459" CreationDate="2014-10-30T20:47:07.930" Score="6" Body="&lt;p&gt;I believe what you asking about are &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;Hooks and Events&lt;/a&gt;.  Craft has several of them listed in the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference&quot; rel=&quot;nofollow&quot;&gt;Hooks Reference&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;Events Reference&lt;/a&gt;.  And Craft also allows us to add Hooks and Events in our plugins, which other plugins can leverage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Sprout Forms, as of this post, we don't have any documented events yet, but there are a couple in there and we'll be formalizing them more in the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably want to take a look at &lt;code&gt;sproutForms.beforeSaveEntry&lt;/code&gt; Event.  Right now, plugins like &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/invisible-captcha&quot; rel=&quot;nofollow&quot;&gt;Sprout Invisible Captcha&lt;/a&gt;, &lt;a href=&quot;https://github.com/selvinortiz/craft.spamguard&quot; rel=&quot;nofollow&quot;&gt;SpamGuard&lt;/a&gt;, and &lt;a href=&quot;https://www.putyourlightson.net/craft-cms-plugins&quot; rel=&quot;nofollow&quot;&gt;Snaptcha&lt;/a&gt; use that Event to add spam protection to Forms.  You could use that event as well to check for a confirmation field, and add a user to a list in Campaign Monitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of how SpamGuard uses the event, which you can &lt;a href=&quot;https://github.com/selvinortiz/craft.spamguard/blob/master/SpamGuardPlugin.php&quot; rel=&quot;nofollow&quot;&gt;see here&lt;/a&gt; in the &lt;code&gt;init()&lt;/code&gt; method of primary plugin class file (I've added the comments myself in relation to your question):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Check for an Event in your plugins init method&#xA;public function init()&#xA;{&#xA;    # If you add a setting that allows a user to turn your integration on or off&#xA;    # you can check for that setting here, before you run your code&#xA;    if ($this-&amp;gt;getSettings()-&amp;gt;getAttribute('enableSproutFormsSupport'))&#xA;    {&#xA;        # Listen for the event where you want to add behavior&#xA;        craft()-&amp;gt;on('sproutForms.beforeSaveEntry', function(Event $event)&#xA;        {&#xA;            # Do your thing!&#xA;            $spam = spamGuard()-&amp;gt;detectDynamicFormSpam($event-&amp;gt;params['entry']);&#xA;            if ($spam)&#xA;            {&#xA;                $event-&amp;gt;fakeIt  = true;&#xA;                $event-&amp;gt;isValid = false;&#xA;            }&#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-10-31T18:45:55.327" LastActivityDate="2014-10-31T18:45:55.327" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4464" PostTypeId="2" ParentId="4459" CreationDate="2014-10-30T20:47:53.637" Score="3" Body="&lt;p&gt;There are two ways you could get something like this to work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the other plugin fires an &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;event&lt;/a&gt; when at a point in the code where your plugin wants to do something, you can just listen for that. (You will have to look through the plugin’s source code to be sure, if they haven’t documented it.) This is the cleanest route, so even if the event doesn’t exist, it’s probably worth writing to the developer and requesting it, explaining your use case.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the other plugin was written according to best practices, then all of the heavy-lifting business logic is tucked away in a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;service class&lt;/a&gt;. If that’s the case, your plugin could provide its own controller action which replaces the other plugin’s controller, as well as runs your own custom code. HTML forms would then just need to be updated post to your own custom controller rather than the other plugin’s. Here’s an example of this sort of thing: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2997/booking-paid-for-events-how/3006#3006&quot;&gt;Booking paid-for events: How?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-30T20:47:53.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4465" PostTypeId="2" ParentId="4454" CreationDate="2014-10-30T20:54:46.633" Score="3" Body="&lt;p&gt;That string that Craft stores is just JSON. When you try to save an array, Craft will automatically JSON-encode it, since MySQL doesn’t have an array-based data type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get that string to be automatically decoded back into an array for you, you need to give your field type a &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#defineContentAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;defineContentAttribute()&lt;/a&gt; method that returns &lt;code&gt;AttributeType::Mixed&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return AttributeType::Mixed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the values to actually output, you will need to make sure you’re passing the old value with the correct name. Your csvimport.html template is looping through a variable called &lt;code&gt;rows&lt;/code&gt;, which is meant to represent the existing value, but in getInputHtml() you are sending $value to the template as a variable called &lt;code&gt;value&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you change this line in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rowId, row in rows %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rowId, row in value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the template will probably start outputting data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’re not actually making any changes to the table HTML, you should probably just include the actual &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms/editableTable.html&quot; rel=&quot;nofollow&quot;&gt;_includes/forms/editableTable.html&lt;/a&gt; template, though. Using your own HTML puts you at a little risk, if you also intend to keep using the Craft.EditableTable JavaScript class, since those two are very much tied together. We aren’t concerned about making breaking changes to the way the HTML is supposed to look, as long as we haven’t broken the way the actual editableTable.html template is supposed to be included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from csvimport.html, you should just replace your entire &lt;code&gt;&amp;lt;table&amp;gt;...&amp;lt;/table&amp;gt;&lt;/code&gt; HTML with this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% from &quot;_includes/forms&quot; import editableTable %}&#xA;&#xA;{{ editableTable({&#xA;    id: id,&#xA;    name: name,&#xA;    cols: cols,&#xA;    rows: value&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(In this case I’m using the editableTable() macro in _includes/forms.html instead of including the actual _includes/forms/editableTable.html template, mainly because I think using the macro looks nicer.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-10-31T12:28:07.710" LastActivityDate="2014-10-31T12:28:07.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4466" PostTypeId="2" ParentId="4430" CreationDate="2014-10-30T21:02:43.667" Score="4" Body="&lt;p&gt;The place to do that sort of thing is &lt;a href=&quot;https://craftcms.com/classreference/services/StructuresService&quot; rel=&quot;nofollow noreferrer&quot;&gt;StructuresService&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we’re just talking about reordering a flat list of entries (no hierarchy), the only methods you need to worry about are &lt;a href=&quot;https://craftcms.com/classreference/services/StructuresService#moveAfter-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;moveAfter()&lt;/a&gt; (if an entry is being dragged after another one) and &lt;a href=&quot;https://craftcms.com/classreference/services/StructuresService#prependToRoot-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;prependToRoot()&lt;/a&gt; (if an entry is being dragged to the first position in the structure).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(1);&#xA;$prevEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById(2);&#xA;$structureId = $entry-&amp;gt;getSection()-&amp;gt;structureId;&#xA;&#xA;craft()-&amp;gt;structures-&amp;gt;moveAfter($structureId, $entry, $prevEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:51.087" LastActivityDate="2017-10-26T09:27:51.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4467" PostTypeId="2" ParentId="4433" CreationDate="2014-10-30T21:26:41.340" Score="6" Body="&lt;p&gt;That’s a little more complicated, and at that point you’re going to be best off writing your own PHP code to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft has a bootstrap file that makes it very easy to write custom PHP code without going to the trouble of writing a plugin, which is great for one-off tasks like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just create a new file alongside your index.php file, called move_entry.php. Here’s what it should look like:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;h2&gt;Craft 3&lt;/h2&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;&#xA;// ...&#xA;// copy contents of index.php here, except for the last `$app-&amp;gt;run();` line&#xA;// ...&#xA;&#xA;&#xA;// Start a transaction in case anything goes south&#xA;$transaction = $app-&amp;gt;db-&amp;gt;beginTransaction();&#xA;try {&#xA;    // Fetch the entry you need to move&#xA;    $entry = \craft\elements\Entry::findOne(184);&#xA;&#xA;    // Remove it from its old structure&#xA;    $oldSection = $entry-&amp;gt;getSection();&#xA;&#xA;    $record = \craft\records\StructureElement::findOne([&#xA;        'structureId' =&amp;gt; $oldSection-&amp;gt;structureId,&#xA;        'elementId' =&amp;gt; $entry-&amp;gt;id&#xA;    ]);&#xA;&#xA;    if (!$record-&amp;gt;deleteWithChildren()) {&#xA;        throw new \Exception('Could not delete the old structure node');&#xA;    }&#xA;&#xA;    // Set the new sectionId and typeId on the entry&#xA;    $entry-&amp;gt;sectionId = 2;&#xA;    $entry-&amp;gt;typeId = 2;&#xA;&#xA;    // Append it to the end of the new structure&#xA;    $newSection = $entry-&amp;gt;getSection();&#xA;&#xA;    if (!$app-&amp;gt;structures-&amp;gt;appendToRoot($newSection-&amp;gt;structureId, $entry, 'insert')) {&#xA;        throw new \Exception('Could not insert the new structure node');&#xA;    }&#xA;&#xA;    // Save the entry&#xA;    if (!$app-&amp;gt;elements-&amp;gt;saveElement($entry)) {&#xA;        throw new \Exception('Could not save the entry');&#xA;    }&#xA;&#xA;    // Commit the transaction&#xA;    $transaction-&amp;gt;commit();&#xA;} catch (\Exception $e) {&#xA;    // Undo whatever changes we already made&#xA;    $transaction-&amp;gt;rollBack();&#xA;    throw $e;&#xA;}&#xA;&#xA;echo 'success!';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Craft 2&lt;/h2&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;// Initialize Craft without letting it take over the whole request&#xA;$app = require '../craft/app/bootstrap.php';&#xA;&#xA;// Set Craft to Craft Personal so we don't get any errors about Client/Pro-only components not being available&#xA;$app-&amp;gt;getInfo()-&amp;gt;edition = 0;&#xA;&#xA;// Start a transaction in case anything goes south&#xA;$transaction = $app-&amp;gt;db-&amp;gt;beginTransaction();&#xA;try&#xA;{&#xA;    // Fetch the entry you need to move&#xA;    $entry = $app-&amp;gt;entries-&amp;gt;getEntryById(184);&#xA;&#xA;    // Remove it from its old structure&#xA;    $oldSection = $entry-&amp;gt;getSection();&#xA;&#xA;    $record = StructureElementRecord::model()-&amp;gt;findByAttributes(array(&#xA;        'structureId' =&amp;gt; $oldSection-&amp;gt;structureId,&#xA;        'elementId'   =&amp;gt; $entry-&amp;gt;id&#xA;    ));&#xA;&#xA;    if (!$record-&amp;gt;deleteNode())&#xA;    {&#xA;        throw new Exception('Could not delete the old structure node');&#xA;    }&#xA;&#xA;    // Set the new sectionId and typeId on the entry&#xA;    $entry-&amp;gt;sectionId = 2;&#xA;    $entry-&amp;gt;typeId = 2;&#xA;&#xA;    // Append it to the end of the new structure&#xA;    $newSection = $entry-&amp;gt;getSection();&#xA;&#xA;    if (!$app-&amp;gt;structures-&amp;gt;appendToRoot($newSection-&amp;gt;structureId, $entry, 'insert'))&#xA;    {&#xA;        throw new Exception('Could not insert the new structure node');&#xA;    }&#xA;&#xA;    // Save the entry&#xA;    if (!$app-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;    {&#xA;        throw new Exception('Could not save the entry');&#xA;    }&#xA;&#xA;    // Commit the transaction&#xA;    $transaction-&amp;gt;commit();&#xA;&#xA;    echo 'success!';&#xA;}&#xA;catch (\Exception $e)&#xA;{&#xA;    // Undo whatever changes we already made&#xA;    $transaction-&amp;gt;rollback();&#xA;&#xA;    throw $e;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plug the right entry/section/type IDs in there, point your browser to &lt;a href=&quot;http://example.com/move_entry.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/move_entry.php&lt;/a&gt; and you should be all set!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Make sure you never run this code for an entry that has any children in the structure, as its children will end up getting removed from the hierarchy.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-01-19T13:15:32.953" LastActivityDate="2019-01-19T13:15:32.953" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4468" PostTypeId="2" ParentId="2524" CreationDate="2014-10-30T22:49:23.893" Score="3" Body="&lt;p&gt;You were right about the issue being that the relationship is made within a Matrix field. Because of this, you have to explicitly pass the Matrix field's handle to the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for instrument in craft.entries.section('instrument') %}&#xA;      &amp;lt;h3&amp;gt;{{ instrument.instrumentName }}&amp;lt;/h3&amp;gt;&#xA;      {% set people = craft.entries.section('person').relatedTo({&#xA;         targetElement: instrument,&#xA;         field: 'roles.instrument'&#xA;      }) %}&#xA;      {% if people|length %}&#xA;         {% for person in people %}&#xA;           &amp;lt;p&amp;gt;{{ person.personName }}&amp;lt;/p&amp;gt;&#xA;         {% endfor %}&#xA;      {% else %}&#xA;         &amp;lt;p&amp;gt;Nobody plays {{ instrument.instrumentName }} :(&amp;lt;/p&amp;gt;&#xA;      {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: Using a dot notation to specify the sub-field is only necessary if you have multiple relational fields within a Matrix, but it can't hurt.&lt;/p&gt;&#xA;" OwnerUserId="48" LastActivityDate="2014-10-30T22:49:23.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4469" PostTypeId="1" AcceptedAnswerId="8274" CreationDate="2014-10-31T04:05:05.270" Score="4" ViewCount="1699" Body="&lt;p&gt;My question is regarding template caching in Craft. I want to know when does Craft actually change the cache or delete old cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that I am caching a chunk that just displays the entry title.  Does Craft detect this change when I reload the page and hence change the cache as well? I don't know if that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I wanted some insight into the cache structure. I was caching some chunks that displayed an entry's title, description etc. The code is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for document in resultset %}&#xA;    {% cache using key document.entryId ~ &quot;searchresult&quot; %}&#xA;&#xA;        {% set entry = craft.entries.id( document.entryId )[0] %}&#xA;&#xA;        &amp;lt;div&amp;gt;{{ entry.title }}&amp;lt;/div&amp;gt;&#xA;        ...&#xA;    {% endcache %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I looked into the cache tables in the database it seems like the cache is associated with an entry using the entry id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know how Craft knows which entry this cache relates to since the key that I have passed could have been anything and I could have cached a category or something instead of an entry. I am very confused as to how this magic is occurring.&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="57" LastEditDate="2014-10-31T05:11:08.443" LastActivityDate="2015-02-20T01:09:15.570" Title="When does Craft change or delete template caches?" Tags="&lt;templating&gt;&lt;database&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4470" PostTypeId="1" CreationDate="2014-10-31T05:26:32.330" Score="2" ViewCount="301" Body="&lt;p&gt;I'm wondering if it's possible to reduce the database user privileges required by Craft, to run just the front-end of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, the requirements docs indicate that the MySQL user must have CREATE, ALTER, DROP privileges, etc. This makes sense when using the CP to update content, etc. (or if the site needs to accept user input form submission, member login, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to disable the CP on the site front-end and create a multi-environment config using a DB connection with a much less privileged MySQL user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft require more than basic database 'read' permissions to simply serve up content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any reason I couldn't create two subdomains, one for serving content and one for managing content via the CP and provide different DB users (with separate privileges)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="92" LastActivityDate="2014-10-31T06:15:59.247" Title="Minimum database privileges for Craft front-end?" Tags="&lt;database&gt;&lt;multi-environment&gt;&lt;security&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4471" PostTypeId="2" ParentId="4470" CreationDate="2014-10-31T06:15:59.247" Score="4" Body="&lt;p&gt;Short answer, no. You'll want to make sure that your DB user has all of the necessary privileges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just because you're not entering &lt;em&gt;your&lt;/em&gt; data into the database doesn't mean that Craft isn't writing &lt;em&gt;its own&lt;/em&gt; data into the database. There are several tables responsible for handling data which is automatically generated by Craft, and not managed directly by admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_sessions&lt;/strong&gt; records user sessions, to know who is currently logged in.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_assettransformindex&lt;/strong&gt; saves any &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;image transforms&lt;/a&gt; which have already been triggered.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_templatecaches&lt;/strong&gt;, &lt;strong&gt;craft_templatecachecriteria&lt;/strong&gt;, and &lt;strong&gt;craft_templatecacheelements&lt;/strong&gt; store data from templates which use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt; tag&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And there are probably others that I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line... Craft needs to be able to write to the database just as much as you do.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-10-31T06:15:59.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4472" PostTypeId="1" CreationDate="2014-10-31T07:59:15.250" Score="1" ViewCount="284" Body="&lt;p&gt;Due to a permission check in \Craft\WebApp::processRequest(), I cannot access my plugin controller through the control panel templates. Also I cannot grant the user access because the plugin does not have a &quot;cp section&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a fieldtype that loads data through an ajax-request, but this does not work if the user looking at the pages does not have access to the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple solution would be to always show all plugins (with controllers) in the permission overview, so that I can grant access if needed.&lt;/p&gt;&#xA;" OwnerUserId="732" LastActivityDate="2014-11-01T20:07:28.047" Title="Cannot access plugin controllers when plugin does not have a &quot;cp section&quot;" Tags="&lt;plugins&gt;&lt;authentication&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4473" PostTypeId="1" AcceptedAnswerId="4478" CreationDate="2014-10-31T08:24:17.533" Score="0" ViewCount="298" Body="&lt;p&gt;I have a very simple site split into sections. All pages use just one template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The previous site had sections such as /section/subject.  I had thought I could have all entries in just one section and then alter the URL on each entry to include a 'pretend' section /section/{slug}, but this defaults to /section-subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to have /settings/subject/ without creating new sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2014-10-31T14:26:31.210" Title="Insert a url segment without creating sections" Tags="&lt;url&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4475" PostTypeId="1" AcceptedAnswerId="4479" CreationDate="2014-10-31T09:15:50.883" Score="5" ViewCount="3507" Body="&lt;p&gt;I have two queries on related entries (using Many to Many plugin) to find both related and then reverse related entries:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set relatedArticles = article.relatedArticles %}&#xA;&#xA;{% set reverseRelatedArticles = craft.entries.relatedTo(article) %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to merge these two ElementCriteriaModel, removing any duplicates before processing them further. I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for item in reverseRelatedArticles %}&#xA;    {% if item not in relatedArticles %}&#xA;        {% set relatedArticles = relatedArticles|merge([item]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't remove the duplicates. Adding &lt;code&gt;find()&lt;/code&gt; to the queries to turn them in to an array doesn't work either. Any way I can do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I tried this, too:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set relatedArticles = article.relatedArticles.find()|merge(craft.entries.relatedTo(article).find()) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="770" LastEditorUserId="9" LastEditDate="2014-10-31T12:31:15.103" LastActivityDate="2014-10-31T12:39:33.997" Title="Merge two arrays of ElementModels?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4476" PostTypeId="1" CreationDate="2014-10-31T09:31:05.320" Score="3" ViewCount="197" Body="&lt;p&gt;Is it possible to add additional tab views that aren't related to user fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to show a summary of user account activity that includes details of purchases they have made. A plugin would work obviously but we would want all of this information in the existing user area rather than in a new area for the plugin.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-12-07T10:31:58.090" Title="Extending the Users section of the admin panel" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4477" PostTypeId="2" ParentId="4472" CreationDate="2014-10-31T10:23:06.447" Score="1" Body="&lt;p&gt;If you don't want to give the user specific access to your plugin, I think the only solution is to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;allow anonymous access to the controller action&lt;/a&gt;. But of course, this would make the controller accessible to alll anonymous users, also outside the control panel. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-31T10:23:06.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4478" PostTypeId="2" ParentId="4473" CreationDate="2014-10-31T10:53:38.210" Score="3" Body="&lt;p&gt;From what I gather from your question you want some sort of sub-categorisation of your entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such that one entry can have the URL as:&#xA;    siteUrl/section/subject-1/entry-slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while another entry can have a URL as:&#xA;    siteUrl/section/subject-2/entry-slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is what you want to achieve then you have to look into Structures instead of Channels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the link: &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#sections&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/sections-and-entries#sections&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can basically have multiple entries with sub-urls in the same structure section.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2014-10-31T10:53:38.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4479" PostTypeId="2" ParentId="4475" CreationDate="2014-10-31T12:39:33.997" Score="7" Body="&lt;p&gt;Yep, there's a great mystery about how the &lt;code&gt;in&lt;/code&gt; containment operator actually works with objects. &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot; rel=&quot;noreferrer&quot;&gt;Twig Docs say&lt;/a&gt; it's possible:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can use this filter to perform a containment test on strings, arrays, or objects implementing the Traversable interface.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but I also tried this (multiple times) and did't get it working. I eventually always ended up using a workaround. In your case I'd do the following and use the entry's ID in the conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get arrays of entries #}&#xA;{% set entriesA = craft.entries(paramsA).find() %}&#xA;{% set entriesB = craft.entries(paramsB).find() %}&#xA;&#xA;{# Prepare merge #}&#xA;{% set entriesBIds = craft.entries(paramsB).ids() %}&#xA;{% set allEntries = entriesB %}&#xA;&#xA;{# Merge arrays #}&#xA;{% for entry in entriesA %}&#xA;&#xA;    {# Don't merge duplicates #}&#xA;    {% if entry.id not in entriesBIds %}&#xA;        {% set allEntries = allEntries|merge([entry]) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-10-31T12:39:33.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4480" PostTypeId="2" ParentId="4473" CreationDate="2014-10-31T14:26:31.210" Score="1" Body="&lt;p&gt;As Moin suggested a Structure works very well for this. I would add that you can also define different Entry Types for the different levels and/or page types (i.e. section landing page vs. entry page vs contact page) and test for &lt;code&gt;entry.type&lt;/code&gt; in your template. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{# switch content based on Entry Type #}&#xA;{% switch entry.type %}&#xA;    {% case 'landing %}&#xA;        {# my landing page content or template include #}&#xA;    {% case 'entry' %}&#xA;        {# my entry page content or template include #}&#xA;    {% case 'contact' %}&#xA;        {# my contact page content or template include #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you don't want or need an actual landing page you can create 'pretend' empty entries (i.e. entries with title and slug only) for the sole purpose of generating the navigation and uri segments that your looking for. If someone clicks a link to one of the these 'empty' pages (or accesses the url directly) you can simply redirect them to the next entry in the hierarchy that actually has content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{# if no body content and has descendants (i.e. no landing page) &#xA; # redirect to first descendant with content defined #}&#xA;&#xA;{% if not entry.body is defined or entry.body == &quot;&quot; %}&#xA;    {% set decendants = entry.descendants %}&#xA;    {% if decendants|length %}&#xA;        {% redirect decendants.first().url %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% block content %}&#xA;    {{ entry.title }}&#xA;    {{ entry.body }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't want to trust 'body' being empty, you could also more explicitly define an entry type that had no fields other than title, called 'pretendSection' for example, and test for that entry type, and redirect as above.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-10-31T14:26:31.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4481" PostTypeId="1" AcceptedAnswerId="4482" CreationDate="2014-10-31T14:57:19.083" Score="3" ViewCount="304" Body="&lt;p&gt;How am I to center text with in the rich text field type? It centers while I'm editing, then returns to left align on save (and on output). I feel like I'm missing something obvious here...&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2014-10-31T15:21:53.110" Title="On entry save/update, centered text returns to left in rich text field" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4482" PostTypeId="2" ParentId="4481" CreationDate="2014-10-31T15:03:53.863" Score="7" Body="&lt;p&gt;When you create a Rich Text field, there is an option for &lt;code&gt;Clean up HTML&lt;/code&gt; which is checked by default. The description underneath the setting reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Removes spans, empty tags, and most style attributes on save.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When aligning text in Redactor, inline styling is added, which would be stripped away on save if the &lt;code&gt;Clean up HTML&lt;/code&gt; option is checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll just need to uncheck this option in your field settings if you want inline styles to be saved.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-10-31T15:21:53.110" LastActivityDate="2014-10-31T15:21:53.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4483" PostTypeId="1" AcceptedAnswerId="4489" CreationDate="2014-10-31T16:20:49.303" Score="1" ViewCount="517" Body="&lt;p&gt;Is there a simple way to know if an entry's content changed when it was saved? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pulling data from an XML feed and create/update entries in a section. I need to know which entries has new data. I guess I could check each field value individually, or make some kind of hash and check that. But is there some built-in way in Yii/Craft that is easier?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-10-31T20:21:01.187" Title="Check if content in entry has changed" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4484" PostTypeId="2" ParentId="4476" CreationDate="2014-10-31T17:13:50.880" Score="1" Body="&lt;p&gt;Right now you're best bet is going to be with a plugin that has its own, separate section for displaying the purchase information.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-31T17:13:50.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4485" PostTypeId="1" AcceptedAnswerId="4488" CreationDate="2014-10-31T19:14:32.720" Score="2" ViewCount="486" Body="&lt;p&gt;I have a custom plugin that's saving an entry successfully. While saving the entry I'm setting our &quot;merchant&quot; field (an entries field, limit=1) like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;# ...&#xA;$entry = newEntryModel();&#xA;# set the sectionId, typeId, authorId, and some other fields...&#xA;$entry-&amp;gt;getContent()-&amp;gt;merchant = (isset($data['merchant']) ? [$data['merchant']-&amp;gt;id] : null; // $data['merchant'] is an EntryModel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This appears to be fine in the CP. I can see and edit the related entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However later in the application I have to update this entry and when updating the entry, I'm only updating a single field. While debugging the EntryModel that I'm trying to save I see that if I var_dump $entry-&gt;merchant I get an ElementCriteriaModel yet when I dump $entry-&gt;getContent-&gt;merchant I get 'null'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My log shows the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2014/10/31 18:25:46 [warning] [application]&#xA;  Craft\ContentModel-&gt;merchant failed validation: Merchant cannot be&#xA;  blank.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://twitter.com/pixelandtonic/status/528256177327452161&quot; rel=&quot;nofollow&quot;&gt;this tweet&lt;/a&gt; it seems like dumping $entry-&gt;getContent()-&gt;merchant should be returning a ContentModel instead of null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've confirmed that everything works as expected if the field is NOT marked as required. However, this can't really be a solution - I need to make sure that the client cannot leave this field blank.&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="82" LastEditDate="2014-10-31T19:57:20.997" LastActivityDate="2014-10-31T20:16:26.777" Title="Can someone help me identify why my entry is invalidating?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;entrymodel&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4486" PostTypeId="1" AcceptedAnswerId="4487" CreationDate="2014-10-31T20:03:17.287" Score="15" ViewCount="2976" Body="&lt;p&gt;If I want to retrieve content on an element, should I be calling &lt;code&gt;$entry-&amp;gt;$fieldHandle&lt;/code&gt; or &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;$fieldHandle&lt;/code&gt;? What’s the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, if I’m setting new content on an element, what’s the recommended way to set my new custom field values?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-10-20T17:28:51.697" Title="What is getContent() / the ContentModel, and how do I use it to get and set custom field values?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;entrymodel&gt;&lt;contentmodel&gt;&lt;baseelementmodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="4487" PostTypeId="2" ParentId="4486" CreationDate="2014-10-31T20:03:17.287" Score="18" Body="&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getContent-detail&quot; rel=&quot;nofollow&quot;&gt;BaseElementModel::getContent()&lt;/a&gt; will return the element’s &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ContentModel&quot; rel=&quot;nofollow&quot;&gt;ContentModel&lt;/a&gt;. It has two purposes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To store the element’s data from the craft_content table table when fetching elements from the DB.&lt;/li&gt;&#xA;&lt;li&gt;To store the POST data that should be stored in the craft_content table when saving an element to the DB.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In both cases, the ContentModel should not actually be accessed directly when getting/setting custom field values.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;When you’re &lt;strong&gt;getting&lt;/strong&gt; an element’s existing custom field values, use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldValue-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;$entry-&amp;gt;getFieldValue($fieldHandle)&lt;/code&gt;&lt;/a&gt;, or simply type &lt;code&gt;$entry-&amp;gt;$fieldHandle&lt;/code&gt;, since BaseElementModel’s &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#__get-detail&quot; rel=&quot;nofollow&quot;&gt;magic getter&lt;/a&gt; will act as a wrapper for getFieldValue() if the attribute you’re accessing happens to be a custom field handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should do this rather than go directly to the ContentModel because it gives the field types a chance to prep the raw DB data (via their &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#prepValue-detail&quot; rel=&quot;nofollow&quot;&gt;prepValue()&lt;/a&gt; method). Most field types have &lt;em&gt;something&lt;/em&gt; they need to do before their data will be ready to be interacted with, and in the case of Matrix/relational fields, who don’t store &lt;em&gt;any&lt;/em&gt; data in the craft_content table, it’s literally the only way you’ll have a chance to know anything about the field’s value. For those fields, if you were to call &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;$fieldHandle&lt;/code&gt; you would just get &lt;code&gt;null&lt;/code&gt; back, no matter how much data the field actually has.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you’re &lt;strong&gt;setting&lt;/strong&gt; new custom field values on an element, use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost($newValues)&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like getFieldValue()’s relationship to retrieving DB data, this method will give field types a chance to prep the POST data before it gets saved to the database (via their &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#prepValueFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;prepValueFromPost()&lt;/a&gt; method). Since Matrix/relational fields don’t actually store data in the database, this is actually a moot point here and their post data will end up on the ContentModel exactly how it was passed in to setContentFromPost(), but still, there’s no harm in using that method, and better to get in the habit of using it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$element-&amp;gt;setContentFromPost(array(&#xA;    'myEntriesField' =&amp;gt; array(1, 2, 3),&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastEditorUserId="4466" LastEditDate="2016-10-20T17:28:51.697" LastActivityDate="2016-10-20T17:28:51.697" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="4488" PostTypeId="2" ParentId="4485" CreationDate="2014-10-31T20:16:26.777" Score="4" Body="&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getContent-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getContent()&lt;/code&gt;&lt;/a&gt; will return the element’s &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ContentModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ContentModel&lt;/a&gt;, &lt;strong&gt;NOT&lt;/strong&gt; &lt;code&gt;getContent()-&amp;gt;merchant&lt;/code&gt;, which is just an attribute of the ContentModel—sorry for the confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve just posted a separate Q&amp;amp;A fully explaining what the ContentModel is used for here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are experiencing is actually a slight bug in Craft’s validation logic. Relational fields have a feature where their data is not actually required to be in POST when saving an entry. If that’s the case (if their value in the ContentModel ends up just being &lt;code&gt;null&lt;/code&gt;), then they will simply not make any changes to the element’s relationships - the field value will be left untouched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the ContentModel is not aware of that feature, and it’s the ContentModel that is currently in charge of enforcing Required Field validation. So, when it gets to your relational field, and finds that its value is &lt;code&gt;null&lt;/code&gt;, it gives you a validation error rather than letting it slide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you have two workaround options, if you want to keep the data the same, but need the field to be required:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You can actually set the value based on the current value:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    // ...&#xA;    'merchant' =&amp;gt; $entry-&amp;gt;merchant-&amp;gt;ids(),&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If all you’re doing is changing custom field values (nothing entry-specific) and you’re comfortable skipping custom field validation altogether, you can just call &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ContentService#saveContent-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;ContentService::saveContent()&lt;/a&gt; directly, and pass in &lt;code&gt;false&lt;/code&gt; to its second argument which tells it to skip validation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    // ...&#xA;    'merchant' =&amp;gt; null, // Tells the relational field to keep the old value&#xA;));&#xA;&#xA;craft()-&amp;gt;content-&amp;gt;saveContent($entry, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-10-31T20:16:26.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4489" PostTypeId="2" ParentId="4483" CreationDate="2014-10-31T20:21:01.187" Score="1" Body="&lt;p&gt;I don't think there's currently anything in Craft that's going to help you here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally we'd track for dirty/changed fields in JavaScript on an edit entry page and pass that as a parameter into the &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; event.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-10-31T20:21:01.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4490" PostTypeId="1" CreationDate="2014-10-31T21:20:35.923" Score="2" ViewCount="625" Body="&lt;p&gt;Craft supports enabling CSRF protection on our front-end forms.  They even have a nice, easy-to-follow, help page called &quot;&lt;a href=&quot;http://buildwithcraft.com/help/csrf-protection&quot; rel=&quot;nofollow&quot;&gt;How do I enable CSRF protection?&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we pull that all off without a hitch. Our forms output the csrfTokenName and csrfToken and the browser cookie is generated just as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how do we test if it is actually working?  Are there any steps an average, not-very-technical developer can take to see if CSRF protection is behaving as expected?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-10-31T22:48:13.737" Title="How do I test if Craft CSRF Protection is properly enabled?" Tags="&lt;security&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4491" PostTypeId="1" CreationDate="2014-10-31T21:25:28.587" Score="2" ViewCount="1000" Body="&lt;p&gt;In a plugin's settings view, I'm looking to show a list of fields to choose from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.fields.getAllFields() %}  &#xA;&#xA;{{ forms.selectField({&#xA;    label:          'Salary Mapping'|t,&#xA;    id:             'broadbeanSalaryMapping',&#xA;    name:           'broadbeanSalaryMapping',&#xA;    instructions:   'Choose a field in which to store this value.'|t,&#xA;    value:          settings.broadbeanSalaryMapping,&#xA;    options:        fields,&#xA;    errors:         settings.getErrors('broadbeanSalaryMapping')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I get an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\FieldModel and its behaviors do not have a method or closure named &quot;optgroup&quot;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Am I going about this the wrong way?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-31T22:04:11.500" Title="Displaying a list of fields in a form select" Tags="&lt;plugin-development&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4492" PostTypeId="2" ParentId="4490" CreationDate="2014-10-31T21:39:42.523" Score="2" Body="&lt;p&gt;After the page loads with the form loads, delete the CSRF cookie, then submit the form.  It should fail CSRF token validation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-10-31T22:48:13.737" LastActivityDate="2014-10-31T22:48:13.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4493" PostTypeId="2" ParentId="4491" CreationDate="2014-10-31T22:04:11.500" Score="4" Body="&lt;p&gt;I've got a solution, though I'd be interested to know if there is a better way of doing it. In the plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    $options = [[&#xA;        'label' =&amp;gt; 'Please select', &#xA;        'value' =&amp;gt; ''&#xA;    ]];&#xA;&#xA;    foreach (craft()-&amp;gt;fields-&amp;gt;getAllFields() as $field)&#xA;    {&#xA;        $options[] = [&#xA;            'label' =&amp;gt; $field['name'], &#xA;            'value' =&amp;gt; $field['handle']&#xA;        ];&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('broadbean/settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings(), &#xA;        'options' =&amp;gt; $options&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in the settings template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.selectField({&#xA;    label:          'Salary Mapping'|t,&#xA;    id:             'broadbeanSalaryMapping',&#xA;    name:           'broadbeanSalaryMapping',&#xA;    instructions:   'Choose a field in which to store this value.'|t,&#xA;    value:          settings.broadbeanSalaryMapping,&#xA;    options:        options,&#xA;    errors:         settings.getErrors('broadbeanSalaryMapping')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-10-31T22:04:11.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4494" PostTypeId="1" CreationDate="2014-11-01T01:11:22.587" Score="5" ViewCount="500" Body="&lt;p&gt;We've enabled CSRF Protection on a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we do, it sometimes works, but most of the time it gets tripped and triggers false positives and doesn't allow our forms to be submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things we've observed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Some forms work, others don't&lt;/li&gt;&#xA;&lt;li&gt;Sometimes a browser doesn't place the CSRF cookie&lt;/li&gt;&#xA;&lt;li&gt;Sometimes two different browsers will have the same CSRF cookie&lt;/li&gt;&#xA;&lt;li&gt;Sometimes if I delete the CSRF Cookie and then refresh the browser, the cookie won't return&lt;/li&gt;&#xA;&lt;li&gt;Clearing the Craft cache seems to get forms working again in one browser but not another&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Why are we seeing this weird behavior?  What is happening?!&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-11-01T01:11:22.587" Title="Forms are triggering CSRF Protection. Why would CSRF Protection trigger false positives?" Tags="&lt;form&gt;&lt;security&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4495" PostTypeId="2" ParentId="4494" CreationDate="2014-11-01T01:11:22.587" Score="8" Body="&lt;p&gt;We got this sorted before I finished my Stack Exchange question so I figured I'd share if anyone else runs into similar behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some troubleshooting, we learned that the issue here was that some of our Forms were being cached by Craft's &lt;code&gt;{% cache %}&lt;/code&gt; tag and others were not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CSRF Cookies are unique per user per session, so you don't want to cache them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our situation, it wasn't obvious at first that a &lt;code&gt;{% cache %}&lt;/code&gt; tag was wrapped around the form, because the &lt;code&gt;{% cache %}&lt;/code&gt; tag was actually in a &lt;code&gt;{% block %}&lt;/code&gt; in a parent layout file that was being extended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While searching through the templates helped us track down part of the issue, we also found it helpful to look at what was being cached in the &lt;code&gt;craft_templatecaches&lt;/code&gt; table.  In the &lt;code&gt;body&lt;/code&gt; column you can see what part of your template code is being cached, and we could see that the form, even though it didn't have &lt;code&gt;{% cache %}&lt;/code&gt; tags around it in the template it was in, was being cached within a larger block of code.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably not the most mindblowing thing you will ever read, but it came in handy for me one long hour of one short day in history.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-11-01T01:11:22.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4496" PostTypeId="1" AcceptedAnswerId="4501" CreationDate="2014-11-01T13:25:28.370" Score="2" ViewCount="1128" Body="&lt;p&gt;I have a multilingual website which has a folder structure such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA;assets&#xA;  js&#xA;  css&#xA;nl&#xA;fr&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to link to the assets folder for my js en css files, but as I'm running a multilingual site I have set my config file to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'nl' =&amp;gt; 'http://krycer.be/nl/',&#xA;        'fr' =&amp;gt; 'http://krycer.be/fr/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which means that my {{ siteUrl }} is set to krycer.be/nl or krycer.be/fr&#xA;But my assets folder is one level higher.&#xA;I tried adding this code to the config.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;    'baseUrl'  =&amp;gt; 'http://krycer.be/',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and accessing it by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ baseUrl }} or {{ craft.config.environmentVariables.baseUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But nothing seems to work. How can I create an abolute link to my assets folder?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2014-11-01T21:06:13.273" Title="Custom environment variable to main assets folder" Tags="&lt;localization&gt;&lt;config&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4497" PostTypeId="1" AcceptedAnswerId="4503" CreationDate="2014-11-01T14:31:52.927" Score="1" ViewCount="347" Body="&lt;p&gt;I have an entry form in home page which the home page already using the entry object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I am placing the entry form in home page when i call&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{%- if entry is defined %} value=&quot;{{ entry.title }}&quot;{% endif -%}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and this will grab the home page title, and this is not the result i want.&#xA;I need when the form submit and error return with value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, any source to learn about entry form? I don't see much tutorial about entry form. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="768" LastEditorUserId="768" LastEditDate="2015-02-04T10:02:07.747" LastActivityDate="2015-02-04T10:02:07.747" Title="Entry form in home page" Tags="&lt;form&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4498" PostTypeId="2" ParentId="4497" CreationDate="2014-11-01T15:27:57.263" Score="3" Body="&lt;p&gt;It sounds like you've got your home page setup as a Single. Which is a great way to go, and that's what is &lt;strong&gt;automatically setting the &lt;code&gt;entry&lt;/code&gt; variable&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a great walkthrough on creating an &quot;edit entry&quot; form...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, that example uses &lt;code&gt;entry&lt;/code&gt; to represent the entry being edited. That won't work for you, however, since &lt;code&gt;entry&lt;/code&gt; is being automatically set as your home page Single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you're attempting to modify another entry, I'd recommend setting it to a &lt;em&gt;different&lt;/em&gt; variable name. Obviously you can't have your home page and other entry both be represented by a variable named &lt;code&gt;entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryToEdit = craft.entries.slug('my-entry-to-edit').first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then &lt;code&gt;entryToEdit&lt;/code&gt; would replace any instances of &lt;code&gt;entry&lt;/code&gt; in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;documented example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-01T15:27:57.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4499" PostTypeId="2" ParentId="4443" CreationDate="2014-11-01T20:00:18.617" Score="0" Body="&lt;p&gt;If this is coming from a category’s primary URL – so a &lt;code&gt;category&lt;/code&gt; variable is already defined for you – another way to get that category’s parent is by using the CategoryModel’s &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel#getParent&quot; rel=&quot;nofollow&quot;&gt;getParent()&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set parentCategory = category.getParent() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-01T20:00:18.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4500" PostTypeId="2" ParentId="4472" CreationDate="2014-11-01T20:07:28.047" Score="1" Body="&lt;p&gt;Controller actions are actually available both from the Control Panel and the front-end site. For example, &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/EntriesController#actionSaveEntry-detail&quot; rel=&quot;nofollow&quot;&gt;EntriesController::actionSaveEntry()&lt;/a&gt; could be accessed from either of these locations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://example.com/admin/actions/entries/saveEntry&quot; rel=&quot;nofollow&quot;&gt;http://example.com/admin/actions/entries/saveEntry&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://example.com/actions/entries/saveEntry&quot; rel=&quot;nofollow&quot;&gt;http://example.com/actions/entries/saveEntry&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Only the first one will be considered a Control Panel URL, so it’s the only one that will enforce the “Access the CP” permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, if you’re calling a controller from a front-end page, you should just use the front-end version of the controller URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don’t actually have to think about this stuff if you just use &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/UrlHelper#getActionUrl-detail&quot; rel=&quot;nofollow&quot;&gt;UrlHelper::getActionUrl()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$url = UrlHelper::getActionUrl('entries/saveEntry');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There’s also a corresponding &lt;code&gt;actionUrl()&lt;/code&gt; function for templates:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ actionUrl('entries/saveEntry') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-01T20:07:28.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4501" PostTypeId="2" ParentId="4496" CreationDate="2014-11-01T21:06:13.273" Score="6" Body="&lt;p&gt;The easiest way to do this would be to just use root-relative resource URLs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/assets/css/styles.css&quot;&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript src=&quot;/assets/js/scripts.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only disadvantage of that is it makes your site slightly less portable – you wouldn’t be able to run it from a subdirectory on a web server without updating all your URLs in the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a better option would be to define a custom config variable that holds the value of your site’s base URL in craft/config/general.php;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'nl' =&amp;gt; 'http://krycer.be/nl/',&#xA;        'fr' =&amp;gt; 'http://krycer.be/fr/',&#xA;    ),&#xA;&#xA;    'baseUrl' =&amp;gt; 'http://krycer.be/',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then access that config setting from your templates via &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.config&quot; rel=&quot;noreferrer&quot;&gt;craft.config&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ craft.config.baseUrl }}assets/css/styles.css&quot;&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript src=&quot;{{ craft.config.baseUrl }}assets/js/scripts.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that there’s no reason to place that custom config variable within the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;noreferrer&quot;&gt;environmentVariables&lt;/a&gt; config setting. The top level of the config array will work just fine for this.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-01T21:06:13.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4502" PostTypeId="2" ParentId="4497" CreationDate="2014-11-02T16:33:39.640" Score="1" Body="&lt;p&gt;I got this plugin from Brandon.&#xA;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it solve the problem I face.&#xA;Now I able allow guest to submit entry and it able to change the variable not to use entry but any variable you name in config.&lt;/p&gt;&#xA;" OwnerUserId="768" LastActivityDate="2014-11-02T16:33:39.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4503" PostTypeId="2" ParentId="4497" CreationDate="2014-11-02T16:38:01.277" Score="3" Body="&lt;p&gt;If you use the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin to submit the entry, then the variable that the invalid entry is called is actually configurable, using the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries#configuration&quot; rel=&quot;nofollow&quot;&gt;entryVariable&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So just create a new file in craft/config/ called guestentries.php, with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'entryVariable' =&amp;gt; 'invalidEntry'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from your template you can just check to see if &lt;code&gt;invalidEntry&lt;/code&gt; is defined.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-02T16:38:01.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4504" PostTypeId="1" AcceptedAnswerId="4521" CreationDate="2014-11-02T20:18:55.180" Score="2" ViewCount="1020" Body="&lt;p&gt;I am setting up a localized site that defaults to English (en_us). Alternate locales will have URLs such as example.com/fr&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to ensure that users browsing the French website don't accidentally end up back on the default locale. My problem is that some sections will not target the French locale but I would still like the URL to display the default, English content with the /fr/ URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I uncheck targeting for that locale in my section settings, then browse to the entry (example.com/fr/section/entry) I get a 404. How can I display the default English entry content at that URL?&lt;/p&gt;&#xA;" OwnerUserId="452" LastActivityDate="2014-11-03T22:01:19.373" Title="Allowing a new locale to fallback on content from a default locale?" Tags="&lt;localization&gt;&lt;404-page&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4506" PostTypeId="1" AcceptedAnswerId="4507" CreationDate="2014-11-03T03:59:45.613" Score="3" ViewCount="1662" Body="&lt;p&gt;I have a template that displays in both http and https environments. When pulling my images for the https environment I need to be able to change the URL to https:// from http://. I tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ gist.gistImage.first().getUrl('gistUnit')|replace({'http': https}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;based on the documentation here twig.sensiolabs.org/doc/filters/replace.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not working. Is this because getURL() gets processed after the filter?&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="57" LastEditDate="2014-11-03T04:02:03.047" LastActivityDate="2014-11-03T04:02:03.047" Title="Using Twig's replace filter with getURL()" Tags="&lt;https&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4507" PostTypeId="2" ParentId="4506" CreationDate="2014-11-03T04:01:25.440" Score="3" Body="&lt;p&gt;Try using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ gist.gistImage.first().getUrl('gistUnit')|replace({'http': 'https'}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-03T04:01:25.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4508" PostTypeId="1" AcceptedAnswerId="4587" CreationDate="2014-11-03T10:34:08.277" Score="1" ViewCount="138" Body="&lt;p&gt;I'm setting up SEO fields (of which there are quite a few) using Matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plan is to offer the user the option to adjust the SEO on a page-by-page basis. This could become unwieldy and the user might not always add the SEO information. So to assist i've created a 'default' SEO entry which will always append unless the user makes changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the basic setup is &quot;If the field has content, use it.  If not, use the default&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment i have the following code (just done the title field so far), but you can see that this will become a lot of {{ ifelse }}, {{ if not }}, {{ for block }}, {{ endfor }}... etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, can this be refined into something much less intensive?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.seoSettings %}&#xA;&#xA;                {% if block.type == &quot;seoBasics&quot; %}&#xA;&#xA;&#xA;&#xA;                    {% if not block.seoPageTitle|length %}&#xA;                        {% for entry in craft.entries.section('defaultSeo').find() %}&#xA;                            {% for block in entry.seoSettings %}&#xA;                                &amp;lt;title&amp;gt;{{ block.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;                            {% endfor %}&#xA;                        {% endfor %}&#xA;                    {% else %}&#xA;                        &amp;lt;title&amp;gt;{{ block.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;&#xA;                    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ block.seoDescription }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;google-site-verification&quot; content=&quot;{{ block.googleVerificationNumber }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;msvalidate.01&quot; content=&quot;{{ block.bingVerificationNumber }}&quot; /&amp;gt;&#xA;&#xA;                {% elseif block.type == &quot;seoAdditional&quot; %}&#xA;&#xA;                    &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ block.seoCanonicalLinks }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;robots&quot; content=&quot;{{ block.seoRobotContent }}&quot; /&amp;gt;&#xA;&#xA;                {% elseif block.type == &quot;seoGeographic&quot; %}&#xA;&#xA;                    &amp;lt;meta name=&quot;geo.region&quot; content=&quot;{{ seoGeoRegion }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;geo.placename&quot; content=&quot;{{ seoGeoPlacename }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;geo.position&quot; content=&quot;{{ seoGeoLattitude }};{{ seoGeoLongitude }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;ICBM&quot; content=&quot;{{ seoGeoLattitude }}, {{ seoGeoLongitude }}&quot; /&amp;gt;&#xA;&#xA;               {% elseif block.type == &quot;seoOpenGraph&quot; %}&#xA;&#xA;                    &amp;lt;meta property=&quot;og:title&quot; content=&quot;{{ block.ogTitle }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:description&quot; content=&quot;{{ block.ogDescription }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:type&quot; content=&quot;{{ block.ogType }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ block.ogUrl }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:image&quot; content=&quot;{% for image in block.ogImage %}{{ image.getUrl() }}{% endfor %}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:author&quot; content=&quot;{{ block.ogAuthor }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:site_name&quot; content=&quot;{{ block.ogSiteName }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:locale&quot; content=&quot;{{ block.ogLocale }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;og:locale:alternate&quot; content=&quot;{{ block.ogAlternativeLocale }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta property=&quot;fb:admins&quot; content=&quot;{{ block.ogFacebookAdmin }}&quot;/&amp;gt;&#xA;&#xA;                {% elseif block.type == &quot;twitterCard&quot; %}&#xA;&#xA;                    &amp;lt;meta name=&quot;twitter:card&quot; content=&quot;{{ block.twitterCard }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:title&quot; content=&quot;{{ block.twitterTitle }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:description&quot; content=&quot;{{ block.twitterDescription }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:site&quot; content=&quot;{{ block.twitterSite }}&quot;&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:creator&quot; content=&quot;{{ block.twitterCreator }}&quot;&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:url&quot; content=&quot;{{ block.twitterUrl }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta name=&quot;twitter:image&quot; content=&quot;{% for image in block.twitterImage %}{{ image.getUrl() }}{% endfor %}&quot; /&amp;gt;&#xA;&#xA;                {% elseif block.type == &quot;googlePlus&quot; %}&#xA;&#xA;                    &amp;lt;meta itemscope itemtype=&quot;http://schema.org/{{ block.schemaPageType }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta itemprop=&quot;name&quot; content=&quot;{{ block.schemaName }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta itemprop=&quot;description&quot; content=&quot;{{ block.schemaDescription }}&quot; /&amp;gt;&#xA;                    &amp;lt;meta itemprop=&quot;image&quot; content=&quot;{% for image in block.schemaImage %}{{ image.getUrl() }}{% endfor %}&quot; /&amp;gt;&#xA;&#xA;                {% elseif block.type == &quot;rdPartyVerification&quot; %}&#xA;&#xA;                    &amp;lt;meta name=&quot;{{ block.partyName }}&quot; content=&quot;{{ block.partyContent }}&quot;/&amp;gt;&#xA;&#xA;                {% endif %}&#xA;&#xA;              {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2014-11-05T22:17:42.007" Title="Code refinement on checking a field for content and outputting an alternative" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4509" PostTypeId="2" ParentId="4508" CreationDate="2014-11-03T10:50:26.133" Score="2" Body="&lt;p&gt;We do something similar to the setup you have here, whereby if the SEO fields haven't been filled for an entry the default is used, but there is a cleaner way of doing this, especially for your clients when they want to go in and make changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Globals&lt;/a&gt; would be a perfect fit for what you are after. In your Global settings, create a new one called 'SEO' or similar, and in there create your fields for the various SEO attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Globals allow you to define content and information which can be accessed from anywhere on the site, and by doing this would mean you will no longer need the DefaultSEO entry you have created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the default information you have set in the Default SEO entry can instead be set in the Globals section, which makes for a cleaner experience for you clients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think with the very rich SEO set up you have here, you can't really get round having the &lt;code&gt;if&lt;/code&gt; statements in your templates, as this is how matrix fields work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as I say, you can really tidy things up by using Globals instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;seoBasics&quot; %} &#xA;&#xA;    {# If a page title has been set for this entry, use that #}&#xA;    {% if block.seoPageTitle | length %}&#xA;        &amp;lt;title&amp;gt;{{ block.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;&#xA;    {# If it hasn't, use the default page title from the SEO Global #}&#xA;    {% else %}&#xA;        &amp;lt;title&amp;gt;{{ seo.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps you in the right direction, if you have any questions then let me know.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-11-03T11:02:02.637" LastActivityDate="2014-11-03T11:02:02.637" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="4510" PostTypeId="1" CreationDate="2014-11-03T10:56:24.077" Score="2" ViewCount="2891" Body="&lt;p&gt;So I'm using &lt;a href=&quot;https://github.com/johndwells/craft.territories/&quot; rel=&quot;nofollow&quot;&gt;this territories plugin&lt;/a&gt; to display a list of countries in a dropdown. The issue I'm having is showing these countries within my front-end entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used this example but it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.territoryFieldHandle.options %}&#xA;    &amp;lt;li {% if option.selected %}class=&quot;active&quot;{% endif %}&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my whole form. The other dropdowns work fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             {% set jobTypeDropdown = craft.fields.getFieldbyHandle('jobType') %}&#xA;        &amp;lt;label for=&quot;fields[jobType]&quot;&amp;gt;Job Type&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[jobType]&quot;&amp;gt;&#xA;            {% for option in jobTypeDropdown.settings.options %}&#xA;                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        {% set jobCategoryDropdown = craft.fields.getFieldbyHandle('jobCategory') %}&#xA;        &amp;lt;label for=&quot;fields[jobCategory]&quot;&amp;gt;Job Category&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[jobCategory]&quot;&amp;gt;&#xA;            {% for option in jobCategoryDropdown.settings.options %}&#xA;                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;fields[country]&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[country]&quot;&amp;gt;&#xA;            {% for option in entry.country.options %}&#xA;                &amp;lt;option value=&quot;{{ option }}&quot;&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="910" LastEditorUserId="45" LastEditDate="2014-11-05T19:45:44.900" LastActivityDate="2015-07-13T21:32:22.140" Title="Display list of countries in form using a dropdown" Tags="&lt;entries&gt;&lt;form&gt;&lt;drop-down&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4511" PostTypeId="1" CreationDate="2014-11-03T11:22:00.967" Score="1" ViewCount="91" Body="&lt;p&gt;Is it possible to have a Craft installation on the same site as another ecommerce solution like OpenCart or OSCommerce?&#xA;Reason being those and some others are already linked with Sage and would like to keep the general content of the site updated using Craft.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-11-03T14:57:31.623" Title="Can Craft be used on same site as other eCommerce Solutions" Tags="&lt;installation&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4512" PostTypeId="2" ParentId="1162" CreationDate="2014-11-03T11:33:51.390" Score="8" Body="&lt;p&gt;I've just ran into this myself this morning. It looks to be related to the SmartMaps plugin doing an IP &gt; Geo lookup using an external service. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically it looks like it's using this api :&lt;a href=&quot;https://geoip.maxmind.com/geoip/v2.0/&quot;&gt;https://geoip.maxmind.com/geoip/v2.0/&lt;/a&gt; which is hanging. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disabling the plugin fixed my loading issues. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-11-03T11:33:51.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4513" PostTypeId="2" ParentId="4105" CreationDate="2014-11-03T11:49:57.563" Score="0" Body="&lt;p&gt;The solution that ended up working for me was to just turn off all default locales for the section in question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem was that if a locale is on by default, then it seems it's impossible to turn it off until you've filled in all the required fields. But if no locale is active by default, you can just create only the one(s) that you need, and you don't run into the problem of trying to deactivate any of the others (since their status is off by default).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd thought that having a default locale would save admins time when posting, but actually with all locales off, no extra steps are added to the process of creating a post, and you actually &lt;em&gt;avoid&lt;/em&gt; the step of (and potential problems with) turning off non-required locales.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2014-11-03T11:49:57.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4514" PostTypeId="1" AcceptedAnswerId="4525" CreationDate="2014-11-03T12:40:32.190" Score="1" ViewCount="699" Body="&lt;p&gt;Is it possible for me to use the default Craft error-handling/exception-throwing/debug-showing template layout for my own plugin? Let's say something goes wrong and I want to show that to the user in the same style as any other &quot;code related error&quot; for my Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could/how would I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-11-04T14:51:08.913" Title="Use default Craft error/exception layout in Plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4515" PostTypeId="1" AcceptedAnswerId="4533" CreationDate="2014-11-03T12:52:18.180" Score="0" ViewCount="195" Body="&lt;p&gt;In the Setting of an account on front-end I've added the possibility to change the password. Please enter your current password, then the new&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;userform&quot; class=&quot;&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;div class=&quot;errors&quot;&amp;gt;&#xA;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;div&amp;gt;{{ error }}&amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; autocomplete=&quot;off&quot; name=&quot;password&quot; class=&quot;input-list password&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input id=&quot;newPassword&quot; type=&quot;password&quot; autocomplete=&quot;off&quot; name=&quot;newPassword&quot; class=&quot;input-list password&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }} //Current password&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;        {{ errorList(account.getErrors('newPassword')) }} //New password&#xA;        {{ errorList(account.getErrors('newPassword')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot; class=&quot;input-submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Mistakes new password displayed and the error of the current password is not displayed, for example if it is wrong page just reboot and the data will not be saved. How to be&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2014-11-03T17:29:38.997" LastActivityDate="2014-11-03T22:01:49.217" Title="Output error of the current password correctly" Tags="&lt;error-message&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4516" PostTypeId="2" ParentId="4511" CreationDate="2014-11-03T14:57:31.623" Score="1" Body="&lt;p&gt;You &lt;em&gt;shouldn't&lt;/em&gt; have any issues running multiple applications on the same host but it would be smarter to decouple the different applications and build a bridge between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never worked with OSCommerce or OpenCart so I can't speak to the specifics of what's involved in doing that but if your high-level goal is to run Craft on the same server as the other application(s), that &lt;em&gt;should&lt;/em&gt; be fine.&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-11-03T14:57:31.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4517" PostTypeId="1" CreationDate="2014-11-03T15:07:05.953" Score="1" ViewCount="107" Body="&lt;p&gt;I have a matrix with only one block type. and it only has videos ID's it (videoID). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have this videoID in the url and then fetch the corresponding Matrix Row. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.example.com/segment-1/segment-2/videoID&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com/segment-1/segment-2/videoID&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said: I know I could get the matrix row ID like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set test = craft.myMatrixField.id(craft.request.lastSegment()) %}&#xA;Video Id: {{ test.videoID }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as the ID will change when reordering the matrix, I would like something more Permalink like and use the videoID in the URL.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody knows how to achieve something like this?  &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2014-11-03T15:10:30.720" Title="Making a navigation out of a matrix?" Tags="&lt;matrix&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4518" PostTypeId="2" ParentId="4517" CreationDate="2014-11-03T15:10:30.720" Score="1" Body="&lt;p&gt;Take a look at &lt;a href=&quot;http://buildwithcraft.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow&quot;&gt;Craft's advanced routing&lt;/a&gt;. You'll need to define a regex pattern in order to create the named subpattern that you want, but once you've done that you can access the variable directly in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following example {{ year }} and {{ month }} become available as variables in the news/_archive template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})' =&amp;gt; 'news/_archive',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="82" LastActivityDate="2014-11-03T15:10:30.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4519" PostTypeId="1" CreationDate="2014-11-03T15:14:52.907" Score="0" ViewCount="120" Body="&lt;p&gt;I'm trying to access the value of an asset field in a backend entry form from my plugins own field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment it's looking like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValue($value)&#xA;{&#xA;    $filename = &quot;path/to/csv&quot;;&#xA;&#xA;    if( ($handle = fopen( $filename, &quot;r&quot;)) !== FALSE) {&#xA;        $rowCounter = 0;&#xA;        while (($rowData = fgetcsv($handle, 0, &quot;;&quot;)) !== FALSE) {&#xA;            if( 0 === $rowCounter) {&#xA;                $headerRecord = $rowData;&#xA;            } else {&#xA;                foreach( $rowData as $key =&amp;gt; $val) {&#xA;                    $value[ $rowCounter - 1][ $headerRecord[ $key] ] = $val;  &#xA;                }&#xA;            }&#xA;            $rowCounter++;&#xA;        }&#xA;        fclose($handle);&#xA;    }&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of the csv values are mapped to a table column of the same field type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{   &#xA;    $id = 'test';&#xA;    $cols = array(&#xA;        'col_1' =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 1',&#xA;            'type'    =&amp;gt; 'singleline',&#xA;        ),&#xA;        'col_2'   =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 2',&#xA;            'type'    =&amp;gt; 'singleline'&#xA;        ),&#xA;        'col_3'   =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 3',&#xA;            'type'    =&amp;gt; 'number'&#xA;        ),&#xA;        'col_4'   =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 4',&#xA;            'type'    =&amp;gt; 'number'&#xA;        ),&#xA;        'col_5'   =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 5',&#xA;            'type'    =&amp;gt; 'singleline'&#xA;        ),&#xA;        'col_6'   =&amp;gt; array(&#xA;            'heading' =&amp;gt; 'Col 6',&#xA;            'type'    =&amp;gt; 'singleline',&#xA;        ),&#xA;    );&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('csvImport/csvimport', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value,&#xA;        'id'    =&amp;gt; $id,&#xA;        'cols'  =&amp;gt; $cols,&#xA;&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to fill $filename dynamically with the value of an asset field in the same entry backend form. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;//EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok I solved the above problem by just changing the prepValue() to the prepValueFromPost()-Function. I now am able to access every piece of data I want to through the post array.&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="818" LastEditDate="2014-11-05T07:46:13.290" LastActivityDate="2014-11-05T07:46:13.290" Title="Is it possible to access backend fields from my own field type?" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4520" PostTypeId="1" AcceptedAnswerId="4527" CreationDate="2014-11-03T15:31:51.070" Score="1" ViewCount="110" Body="&lt;p&gt;I'm having trouble getting the elements service working correctly in a consolecommand. The same code works as expected in a controller, so I expect there is either a bug, or some extra config I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ShoppingCommand extends BaseCommand {&#xA;&#xA;    public function actionListOrders() {&#xA;        $c = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        //$c-&amp;gt;locale = craft()-&amp;gt;i18n-&amp;gt;getPrimarySiteLocale();&#xA;        $c-&amp;gt;section = 'orders';&#xA;        $c-&amp;gt;limit = 5;&#xA;        foreach($c as $o) {&#xA;            print $o-&amp;gt;orderId . &quot;: &quot; . $o-&amp;gt;title . &quot;, &quot; . $o-&amp;gt;price . &quot;\n&quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;running this results in the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ ./app/etc/console/yiic shopping listorders&#xA;: blah,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;running the same action with a Controller in the webapp results in the expected output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10: blah, 123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas if it's possible to get around this? For now I can just build my functionality into a controller, but it would be much more convenient if I could run it from the command line like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there is another issue with this relating to the locale. Originally I needed to use the commented out line above because my site's default locale was &lt;code&gt;en&lt;/code&gt; where as the consolecommands default to &lt;code&gt;en_us&lt;/code&gt; and without forcing the locale my queries were not returning any results at all. I changed my default locale to &lt;code&gt;en_us&lt;/code&gt; to test whether the other issue was something to do with the locales as well, but it didn't make a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Tristan&lt;/p&gt;&#xA;" OwnerUserId="965" LastActivityDate="2014-11-03T19:46:11.653" Title="Issues using the elements service in console commands" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4521" PostTypeId="2" ParentId="4504" CreationDate="2014-11-03T15:37:16.360" Score="4" Body="&lt;p&gt;One solution (without needing to create a custom plugin) would be to add a lightswitch or checkbox field called &lt;code&gt;useDefaultLocale&lt;/code&gt;, and add it to the field layout of any sections that you want to default to english. In your template you can test for the value of this field and display the default locale version of the content. You would of course need to target 'fr' locales for any sections that included this functionality.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.locale == 'en' and entry.useDefaultLocale %}&#xA;    {% set entry = craft.entries.section(entry.section).locale('en') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any content that is defined directly in the template using the translate filter (i.e. &lt;code&gt;{{ 'Date'|t }}&lt;/code&gt; ) would still get translated of course, but maybe that's a good thing. There also may be a way to manually set the locale so as not to translate these as well, that I don't know about. If anyone knows, please leave a comment, and I'll add it to the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; carlcs brings up a good point regarding SEO and duplicate content. To solve this you could define a canonical link using: (placed in the &lt;code&gt;if&lt;/code&gt; clause above)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set canonical %}&#xA;    &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ entry.url }} /&amp;gt;&#xA;{% endset %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in the _layout template head:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if canonical is defined %}{{ canonical }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The side effect is that some French users might get directed to the english url from search engines. Pick your poison I guess.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-03T22:01:19.373" LastActivityDate="2014-11-03T22:01:19.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4522" PostTypeId="1" AcceptedAnswerId="4530" CreationDate="2014-11-03T16:45:32.127" Score="7" ViewCount="1115" Body="&lt;p&gt;Just had an e-commerce site go down due to Craft's custom way of handling Sessions. The session directory never gets cleaned up, causing the sessions folder to be littered with tens to hundreds of thousands of orphaned files, causing my server to run out of inodes. PHP has a built in utility to deal with this, but that doesn't work since Craft sets a &lt;a href=&quot;http://ar.php.net/manual/en/session.configuration.php#ini.session.save-path&quot;&gt;custom session directory&lt;/a&gt;. Looking for a good cron job or other utility that will automatically clean this folder up automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, curious if there is work being done on Craft to fix this issue by default. I wonder if the reason it hasn't become as big of an issue as it seems it is (only found a handful of people mentioning it on the Google Plus page), is because Craft hasn't been out long enough for some sites to experience this yet, but they may soon. It took about 4 months for the session directory to get too full on a pretty small hard drive, so I wonder if a number of other sites with bigger hard drives currently have this issue behind the scenes, and haven't experienced any problems yet, but will soon.  &lt;/p&gt;&#xA;" OwnerUserId="488" LastActivityDate="2016-02-25T01:50:11.463" Title="Session Cleanup in Craft" Tags="&lt;php&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4523" PostTypeId="1" CreationDate="2014-11-03T16:58:26.877" Score="1" ViewCount="544" Body="&lt;p&gt;Everything works fine on my local machine (OSX/MAMP PRO) but on my server (Digital Ocean LAMP stack on Ubuntu) saving an entry brings the whole thing down and I have to restart Apache before the site becomes responsive again. It doesn't seem to time out, it just never completes the save. Oddly, it does actually save the data so when I bring the server back up with &lt;code&gt;service apache2 restart&lt;/code&gt; the changes are there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apache logs look like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;zend_mm_heap corrupted&#xA;zend_mm_heap corrupted&#xA;[Mon Nov 03 11:44:55.395173 2014] [mpm_prefork:notice] [pid 16677] AH00169: caught SIGTERM, shutting down&#xA;[Mon Nov 03 11:44:56.453282 2014] [mpm_prefork:notice] [pid 17116] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations&#xA;[Mon Nov 03 11:44:56.453484 2014] [core:notice] [pid 17116] AH00094: Command line: '/usr/sbin/apache2'&#xA;zend_mm_heap corrupted&#xA;zend_mm_heap corrupted&#xA;[Mon Nov 03 11:51:53.601504 2014] [mpm_prefork:notice] [pid 17116] AH00169: caught SIGTERM, shutting down&#xA;[Mon Nov 03 11:51:54.577982 2014] [mpm_prefork:notice] [pid 17178] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations&#xA;[Mon Nov 03 11:51:54.578223 2014] [core:notice] [pid 17178] AH00094: Command line: '/usr/sbin/apache2'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;zend_mm_heap corrupted&lt;/code&gt; bit looks like it could be something to do with it? I've tried increasing out_buffering as per &lt;a href=&quot;https://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean&quot;&gt;this SO thread&lt;/a&gt; but it didn't help. I don't know where to even start with this, I've never experienced it before. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies if this is a bit vague but this is the only place I can think of to ask — I've contacted P&amp;amp;T too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've re-installed a new version of Craft in the same place on my server and, although the installation went 'Oops' I can actually log in and save entries so I don't think there's anything fundamentally wrong there.&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-11-03T17:31:44.460" Title="Craft hangs when saving any entry and brings Apache down" Tags="&lt;apache&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4524" PostTypeId="2" ParentId="4522" CreationDate="2014-11-03T17:03:27.583" Score="4" Body="&lt;p&gt;Here's one answer from &lt;a href=&quot;https://stackoverflow.com/questions/654310/cleanup-php-session-files&quot;&gt;cleanup php session files&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Every 30 minutes, not on the hour&amp;lt;br&amp;gt;&#xA;# Grabs maxlifetime directly from \`php -i\`&amp;lt;br&amp;gt;&#xA;# doesn't care if /var/lib/php5 exists, errs go to /dev/null&amp;lt;br&amp;gt;&#xA;&#xA;09,39 * * * *   find /var/www/craft/storage/runtime/sessions -type f -cmin +60 -exec rm -f {} +  &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="488" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-11-03T17:03:27.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4525" PostTypeId="2" ParentId="4514" CreationDate="2014-11-03T17:27:09.797" Score="2" Body="&lt;p&gt;If I'm understanding your question correctly, then you get that behavior by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new Exception('Uh oh.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll get the same error handling layout and logic that Craft uses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can &lt;a href=&quot;https://craftcms.stackexchange.com/questions/478/render-generic-message-error-template-from-plugin/483#483&quot;&gt;read here&lt;/a&gt; for more information on how that works.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-04T14:51:08.913" LastActivityDate="2014-11-04T14:51:08.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4526" PostTypeId="1" AcceptedAnswerId="4528" CreationDate="2014-11-03T17:41:38.807" Score="1" ViewCount="742" Body="&lt;p&gt;Ok what i'm trying to achieve is a set of links which have &quot;search parameters&quot; attached to them. Which would be a &quot;category&quot; and an &quot;option.field&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then when these links are clicked they display search results according to the parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure even where to start with something like this, could it be achieved with data attributes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it even possible? Or have would I have to jerry-rig a form to do this via radio buttons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help you can give.&lt;/p&gt;&#xA;" OwnerUserId="665" LastActivityDate="2014-11-03T22:09:02.677" Title="Linking to Search Results" Tags="&lt;categories&gt;&lt;relations&gt;&lt;search&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4527" PostTypeId="2" ParentId="4520" CreationDate="2014-11-03T19:46:11.653" Score="0" Body="&lt;p&gt;There was a bug in Craft where custom fields weren't being loaded when using the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService&quot; rel=&quot;nofollow&quot;&gt;ElementsService&lt;/a&gt; in the context of a console command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just fixed it for the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2598&quot; rel=&quot;nofollow&quot;&gt;2.2.2598&lt;/a&gt;) release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I'm not sure I'm following the locale issue.  Can you post that as a separate question with some more clarification?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-03T19:46:11.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4528" PostTypeId="2" ParentId="4526" CreationDate="2014-11-03T19:54:33.777" Score="4" Body="&lt;p&gt;You can use either &lt;code&gt;get&lt;/code&gt; (via a direct link) or &lt;code&gt;post&lt;/code&gt; (via javascript) which can be accessed in your search template using &lt;code&gt;[craft.request.getParam(name)][1]&lt;/code&gt;, and then either display the template (if a direct link) or return it (via ajax) to your original template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a full example using &lt;code&gt;post&lt;/code&gt; and ajax see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2979/search-results-in-a-drop-list-popup-on-same-page/2980#2980&quot;&gt;this question&lt;/a&gt; or &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4414/search-contact-person-plugin-via-ajax/4415#4415&quot;&gt;this question&lt;/a&gt;. These examples use post and a form, but you could easily adapt this to place your variables in attributes and then retrieve and send those using javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;js-triggerhook&quot; data-option=&quot;{{ field.option }}&quot; data-category=&quot;{{ category }}&quot; data-url=&quot;{{ siteUrl }}path/to/searchtemplate&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.js-triggerhook').on('click', function(e) {&#xA;    e.preventDefault();&#xA;    var option = $(this).attr('data-option),&#xA;        category = $(this).attr('data-category'),&#xA;        url = $(this).attr('data-url'),&#xA;        data = &quot;option=&quot; + option + &quot;&amp;amp;amp;category=&quot; + category;&#xA;    // send post data&#xA;    $.post(url, data, function(result) {&#xA;        $('#search-results').html(result);&#xA;    }, 'html');&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or for a direct link using &lt;code&gt;get&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}path/to/searchtemplate?option={{ option.field }}&amp;amp;amp;category={{ category }}&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or for a way to do either on the fly, just by including the class 'js-sendAsAjax':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;js-sendAsAjax&quot; href=&quot;{{ siteUrl }}path/to/searchtemplate?option={{ option.field }}&amp;amp;amp;category={{ category }}&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.js-sendAsAjax').on('click', function(e) {&#xA;   e.preventDefault();&#xA;   var href = $(this).attr('href').split('?'),&#xA;       url = href[0],&#xA;       data = href[1];&#xA;    $.post(url, data, function(result) {&#xA;        $('#search-results').html(result);&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-03T22:09:02.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4530" PostTypeId="2" ParentId="4522" CreationDate="2014-11-03T20:41:18.627" Score="6" Body="&lt;p&gt;Apparently PHP's garbage collection does &lt;em&gt;not&lt;/em&gt; work when you've set a custom PHP session save path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot;&gt;overridePhpSessionLocation&lt;/a&gt; config setting to false, Craft will go with whatever path Apache/PHP is configured to save sessions to. If you're not on shared hosting, then it's a perfectly safe change, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting that to false on a site that is on shared hosting has its &lt;a href=&quot;http://websec.io/2012/08/24/Shared-Hosting-PHP-Session-Security.html&quot;&gt;own security implications&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;curious if there is work being done on Craft to fix this issue by default.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We're discussing what we can do in Craft itself to help with this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-04T05:09:04.953" LastActivityDate="2014-11-04T05:09:04.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4532" PostTypeId="1" AcceptedAnswerId="4534" CreationDate="2014-11-03T21:31:46.500" Score="0" ViewCount="1076" Body="&lt;p&gt;I'm currently working on a plugin that sends an email before the Guest Entries Plugin saves the entry. But one of the fields is an asset field and the file may be renamed when uploaded so I need to switch this up so the email being sent after the entry is saved.  I tried creating an onEntrySave event in the Guest Entries plugin by doing the following. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added to GuestEntriesService.php: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA;     * Fires an 'onSaveEntry' event.&#xA;     *&#xA;     * @param GuestEntriesEvent $event&#xA;     *&#xA;     * @return null&#xA;     */&#xA;    public function onSaveEntry(GuestEntriesEvent $event)&#xA;    {&#xA;        $this-&amp;gt;raiseEvent('onSaveEntry', $event);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In GuestEntriesController.php I've added &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;onSaveEntry(new GuestEntriesEvent($this, array('entry'=&amp;gt; $entry,'isNewEntry' =&amp;gt; true)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the section of the code where the entry is saved.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA;     $this-&amp;gt;onSaveEntry(new GuestEntriesEvent($this, array('entry'=&amp;gt; $entry,'isNewEntry' =&amp;gt; true)));&#xA;     $this-&amp;gt;_returnSuccess($entry);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is where I've gone wrong as I get the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft\GuestEntriesController and its behaviors do not have a method or closure named &quot;onSaveEntry&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about modifying the plugin to trigger an onSaveEntry event?&lt;/p&gt;&#xA;" OwnerUserId="967" LastActivityDate="2015-04-25T14:24:41.870" Title="Creating an onSaveEntry event in Guest Entries Plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4533" PostTypeId="2" ParentId="4515" CreationDate="2014-11-03T22:01:49.217" Score="1" Body="&lt;p&gt;Change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ errorList(account.getErrors('password')) }} //Current password&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ errorList(account.getErrors('currentPassword')) }} //Current password&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-03T22:01:49.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4534" PostTypeId="2" ParentId="4532" CreationDate="2014-11-03T22:21:56.033" Score="4" Body="&lt;p&gt;It probably would be better to just write your own plugin to do this, so that you don't have to worry about patching in your changes every time the &lt;code&gt;guestEntries&lt;/code&gt; plugin is updated — and it could technically be just one file, although the recommended craft method would be to create a &lt;code&gt;service&lt;/code&gt; method to handle the events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugins main class file, just create an &lt;code&gt;init&lt;/code&gt; method that listens for the &lt;code&gt;entries.saveEntry&lt;/code&gt; event for the section in question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) &#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        if ($entry-&amp;gt;section == 'MySection') &#xA;        {&#xA;            if ($event-&amp;gt;params['isNewEntry']) &#xA;            {&#xA;                craft()-&amp;gt;myplugin-&amp;gt;handleNewSectionEntry($entry);&#xA;                // or do something directly&#xA;            } &#xA;            else &#xA;            {   &#xA;                craft()-&amp;gt;myplugin-&amp;gt;handleUpdateSectionEntry($entry);&#xA;                // or do something directly&#xA;            }&#xA;        }&#xA;    }); // edited&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to test whether it is a 'guest' entry from the front-end vs the CP you can add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$currentUser) { ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="100" LastEditDate="2015-04-25T14:24:41.870" LastActivityDate="2015-04-25T14:24:41.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4535" PostTypeId="1" AcceptedAnswerId="4627" CreationDate="2014-11-03T23:29:16.297" Score="5" ViewCount="694" Body="&lt;p&gt;When using a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;noreferrer&quot;&gt;multi-environment config&lt;/a&gt;, Craft will select which settings to use based on a partial string match of the server name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the following example, does &quot;dev.mywebsite.com&quot; need to be &lt;strong&gt;first&lt;/strong&gt; or &lt;strong&gt;last&lt;/strong&gt;? Clearly it contains &quot;mywebsite.com&quot; within it, so the order is relevant.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // All environments&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    // Production&#xA;    'mywebsite.com' =&amp;gt; array(&#xA;        'server'   =&amp;gt; 'localhost',&#xA;        'user'     =&amp;gt; 'xxxxxxxx',&#xA;        'password' =&amp;gt; 'xxxxxxxx',&#xA;        'database' =&amp;gt; 'prod_mywebsite',&#xA;    ),&#xA;    // Development&#xA;    'dev.mywebsite.com' =&amp;gt; array(&#xA;        'server'   =&amp;gt; 'localhost',&#xA;        'user'     =&amp;gt; 'xxxxxxxx',&#xA;        'password' =&amp;gt; 'xxxxxxxx',&#xA;        'database' =&amp;gt; 'dev_mywebsite',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-07T12:26:50.043" Title="Proper order of multi-environment config" Tags="&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4536" PostTypeId="1" AcceptedAnswerId="4538" CreationDate="2014-11-04T02:08:22.767" Score="3" ViewCount="1179" Body="&lt;p&gt;I have a matrix field with one block type. In that block type, I have one field that is a related entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I access the title from the related entries field from the matrix field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the setup I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry name is programs&#xA;In that entry I have a matrix block with handle name menuLinks&#xA;In that block, the related entries field name is called menuLink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="936" LastActivityDate="2014-11-04T05:47:09.223" Title="Get related entries from matrix field" Tags="&lt;matrix&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4537" PostTypeId="2" ParentId="4348" CreationDate="2014-11-04T02:57:48.223" Score="1" Body="&lt;p&gt;Reference: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust/4487?noredirect=1#comment5139_4487&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I wanted to get all attributes, and all content attributes. Here's my approach: &lt;a href=&quot;http://gist.github.com/timkelty/2a221ac232e5ecf1b090&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://gist.github.com/timkelty/2a221ac232e5ecf1b090&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curious to see if there are alternate solutions, though.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-04-16T12:59:07.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4538" PostTypeId="2" ParentId="4536" CreationDate="2014-11-04T05:26:00.910" Score="5" Body="&lt;p&gt;Related entries in a matrix field are technically related to the matrix block and not the entry. So you will first want to get the related entries via &lt;code&gt;relatedTo(block)&lt;/code&gt;; then loop through the related entries to get the field values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.menuLinks %}&#xA;    {% set relatedEntries = craft.entries.section('SectionName').relatedTo(block) %}&#xA;    {% for entry in relatedEntries %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you know there is one and only one block or related entry then you can skip the &lt;code&gt;for..in&lt;/code&gt; loop(s) and just use the &lt;code&gt;.first()&lt;/code&gt; method (i.e. &lt;code&gt;entry.menuLinks.first()&lt;/code&gt; and or  &lt;code&gt;craft.entries.section('SectionName').relatedTo(block).first()&lt;/code&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that if you are just trying to create a simple list of links to related entries you do not need a matrix field at all (unless of course you are doing something more complicated). The Entries Field Type itself can support an unlimited number of related entries (and are sortable), so you could just create an &lt;code&gt;entries&lt;/code&gt; field directly in &lt;code&gt;programs&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-04T05:47:09.223" LastActivityDate="2014-11-04T05:47:09.223" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4540" PostTypeId="2" ParentId="4535" CreationDate="2014-11-04T09:47:55.087" Score="3" Body="&lt;p&gt;Yes, I've also found that in this case &quot;dev.mywebsite.com&quot; has to be &lt;strong&gt;after&lt;/strong&gt; &quot;mywebsite.com&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a bit counter intuitive. Lately I've been using the &lt;a href=&quot;http://craftcookbook.net/recipes/210&quot; rel=&quot;nofollow&quot;&gt;&quot;Foolproof Multi-Environment Config&quot; from Craft Cookbook&lt;/a&gt;, mostly because it keeps the config files more sane.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-11-04T09:47:55.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4541" PostTypeId="1" AcceptedAnswerId="4561" CreationDate="2014-11-04T10:00:30.643" Score="0" ViewCount="402" Body="&lt;p&gt;For Structured entries, I always have about the same folder structure. &#xA;If I could access the parent's folder name, I woudn't have to change the &lt;code&gt;{% includes %}&lt;/code&gt; when copying a folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;blog&lt;br&gt;&#xA;---_common&lt;br&gt;&#xA;---_entry&lt;br&gt;&#xA;---_listing&lt;br&gt;&#xA;---index  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;code&gt;_entry&lt;/code&gt; looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% include &quot;blog/_common&quot; %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and _listing looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section:'blog', limit: gl_config.cf_blog_limit} %}&#xA;{% paginate craft.entries(params) as entries %}&#xA;&#xA;    {% for entry in entries %}&#xA;        {% include &quot;blog/_common&quot; %}&#xA;    {% endfor %}&#xA;&#xA;    {% include &quot;_includes/_pagination&quot; %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They look almost the same for every structure channel I use (e.g. discography, pressreleases, projects etc etc.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I could use &lt;code&gt;{% include &quot;PARENT_FOLDER_NAME/_common&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could just duplicate the folder and don't have to worry about these templates! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;btw: &lt;code&gt;the _common&lt;/code&gt; template looks about like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;article class=&quot;listing_item format&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;listing_heading toggle_content&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;listing_heading_date&quot;&amp;gt;&#xA;             &amp;lt;span class=&quot;h1&quot;&amp;gt;{{ entry.postDate | date(&quot;d&quot;) }}&amp;lt;/span&amp;gt;&#xA;             {{ entry.postDate|date(&quot;F Y&quot;) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;listing_heading_title&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;            {% set tags = entry.cf_blog_tags %}&#xA;&#xA;            {% if tags | length %}&#xA;                {% for tag in tags %}&#xA;                    {{ tag.name }} &#xA;                {% endfor %}&#xA;            {% endif %}         &#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;listing_content&quot;&amp;gt;&#xA;        {# &#xA;            Content Matrix text / images / files / quotes / slideshows / videos etc..&#xA;        #}&#xA;        {% include &quot;_includes/_content_blocks&quot; %}&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url() }}&quot;&amp;gt;Permalink&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;        {# Edit #}&#xA;        {% include &quot;_includes/_edit&quot; %} &#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="367" LastEditorUserId="250" LastEditDate="2014-11-12T14:02:20.137" LastActivityDate="2014-11-12T14:02:20.137" Title="In a template: Is there a way to call the parent's folder name?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4542" PostTypeId="1" AcceptedAnswerId="4555" CreationDate="2014-11-04T12:50:15.783" Score="2" ViewCount="156" Body="&lt;p&gt;The default (and only) locale for my site is &lt;code&gt;en&lt;/code&gt;, however, when trying to query the &lt;code&gt;ElementService&lt;/code&gt; from a console command without specifying the locale in the criteria, the locale used in the query is &lt;code&gt;en_us&lt;/code&gt;. As such, the query returns no results. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ShoppingCommand extends BaseCommand {&#xA;&#xA;    public function actionListOrders() {&#xA;        $c = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $c-&amp;gt;section = 'orders';&#xA;        $c-&amp;gt;limit = 5;&#xA;        foreach($c as $o) {&#xA;            print $o-&amp;gt;id . &quot;: &quot; . $o-&amp;gt;title . &quot;\n&quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;prints nothing, even though there are entries present for the default locale &lt;code&gt;en&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Printing out the query object &lt;code&gt;print_r(craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($c));&lt;/code&gt; shows the &lt;code&gt;:locale&lt;/code&gt; parameter being passed to the sql query as &lt;code&gt;en_us&lt;/code&gt;. But this locale doesn't even exist for the site (&lt;code&gt;select * from craft_locales&lt;/code&gt; shows only &lt;code&gt;en&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I could find to work around this is by adding the site's default locale to the criteria manually with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$c-&amp;gt;locale = craft()-&amp;gt;i18n-&amp;gt;getPrimarySiteLocale();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, since the query works find without this when run in a controller, I'm skeptical that it should be needed. Is this is a bug, or is there some extra configuration i'm missing? Having some parameter to specify the locale to use for commands would make sense in mutli-locale environments, but I would still expect the default to be the site's default rather than &lt;code&gt;en_us&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="965" LastActivityDate="2014-11-04T21:38:55.400" Title="Default locale in console commands is always en_us rather than the site default" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4544" PostTypeId="1" AcceptedAnswerId="4546" CreationDate="2014-11-04T13:17:00.027" Score="1" ViewCount="263" Body="&lt;p&gt;I'm currently working on an eCommerce project with categories for products:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Category 1&#xA;    - Sub-category 1&#xA;    - Sub-category 2&#xA;    - Sub-category 3&#xA;- Category 2&#xA;    - Sub-category 1&#xA;    - Sub-category 2&#xA;    - Sub-category 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am hoping to achieve, is to give each top-level category its own entry in Craft, so I can apply my site-wide SEO, matrix content and utility fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware you can apply fields to categories, but the whole double-clicking on a category and managing the content from the small modal window approach isn't ideal, especially with category pages that are a bit heavy on the content side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These categories do have their own URL, and creating an entry with the same slug results in incrementation: &lt;code&gt;example-category-1&lt;/code&gt;, which is to be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way in Craft I can get round this? I guess if there is no other way I can apply fields to the category, but I wanted to see if anyone had any other ideas.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-11-04T14:39:10.367" Title="What is the best way to have an entry for top-level categories?" Tags="&lt;categories&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4546" PostTypeId="2" ParentId="4544" CreationDate="2014-11-04T14:39:10.367" Score="3" Body="&lt;p&gt;After a little more consideration, I decided it was best instead not to use categories for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have instead created a 'Product Categories' structure, and the relationships are handled through an entry field. &lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-11-04T14:39:10.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4547" PostTypeId="1" AcceptedAnswerId="4550" CreationDate="2014-11-04T15:09:41.523" Score="1" ViewCount="412" Body="&lt;p&gt;Any way to turn cookies off for the front end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it's only CraftSessionId being set, but still, anyone know?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;" OwnerUserId="696" LastActivityDate="2014-11-04T15:45:00.183" Title="Any way to turn cookies off for the front end?" Tags="&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4548" PostTypeId="1" CreationDate="2014-11-04T15:17:13.570" Score="3" ViewCount="786" Body="&lt;p&gt;Is there a way to send the user to a different page than the control panel when logging in from a custom login form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;apply&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried setting the returnUrl session in a login event within a plugin. There's a bit left to do in the init function but you get the idea. Currently the code should redirect all logins. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('userSession.onLogin', function(Event $event) {&#xA;        // load the user info and determine user group&#xA;        // if part of applicant user group&#xA;        // load any existing unfinished applications&#xA;        // set a session for the unfinished application&#xA;        // redirect to /apply which should load the unfinished application&#xA;        craft()-&amp;gt;session['returnUrl'] = &quot;/apply&quot;;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="347" LastActivityDate="2014-11-04T22:18:16.730" Title="How do I set where the user is sent from a custom login form?" Tags="&lt;plugin-development&gt;&lt;login&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4549" PostTypeId="2" ParentId="4548" CreationDate="2014-11-04T15:42:59.523" Score="4" Body="&lt;p&gt;You can set a variable in your craft/config/general.php. Here is the option taken from the default config file which is located here &lt;code&gt;craft/app/etc/config/defaults/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * The path that users should be redirected to after logging in from the front-end site.&#xA; *&#xA; * This setting will also come into effect if the user visits the Login page (as specified by the loginPath config&#xA; * setting) when they are already logged in.&#xA; */&#xA;'postLoginRedirect' =&amp;gt; '',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From that page you can also easily route them to another page based on conditionals in twig using &lt;code&gt;{% if something %}{% redirect url %}{% endif %}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And although I haven't tried this personally, it looks like (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/71/is-it-possible-to-show-a-successful-logout-message/77#77&quot;&gt;based on this answer&lt;/a&gt;) you can redirect from within your plugin using the following (perhaps only from a controller however): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;redirect('/apply');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also see in UserSessionService.php line 371 the following which should also work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = UrlHelper::getUrl(craft()-&amp;gt;config-&amp;gt;getLoginPath());&#xA;craft()-&amp;gt;request-&amp;gt;redirect($url);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-11-04T22:18:16.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4550" PostTypeId="2" ParentId="4547" CreationDate="2014-11-04T15:45:00.183" Score="1" Body="&lt;p&gt;That's PHP's &lt;a href=&quot;http://php.net/manual/en/book.session.php&quot; rel=&quot;nofollow&quot;&gt;session&lt;/a&gt; cookie and is how PHP keeps track of user data across different requests. It'll only get set if something in your template ultimately invokes any of the methods in Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService&quot; rel=&quot;nofollow&quot;&gt;UserSessionService&lt;/a&gt; or Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CWebUser&quot; rel=&quot;nofollow&quot;&gt;CWebUser&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-04T15:45:00.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4551" PostTypeId="2" ParentId="4395" CreationDate="2014-11-04T15:48:15.377" Score="2" Body="&lt;p&gt;Okay, so, thanks to &lt;a href=&quot;https://craftcms.stackexchange.com/a/4398/654&quot;&gt;carlcs' answer&lt;/a&gt; I managed to solve the camel-case to lower-dash-case conversion. The other direction was a bit trickier, but again, after digging in a bit deeper I was able to figure it out myself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, I'm not using the plugin any longer! Yay! The secret was to create a custom Twig filter that would convert dash-separated strings like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'my-first-car'|dash2camel }}&#xA;{# outputs 'myFirstCar' #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the help of &lt;a href=&quot;http://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide&lt;/a&gt; and some code from &lt;a href=&quot;https://stackoverflow.com/a/12642156&quot;&gt;this answer&lt;/a&gt; I created my own custom Twig filter within Craft. Nothing fancy and hacked together quickly, but &lt;strong&gt;I've put it on &lt;a href=&quot;https://github.com/rppld/dash2camel&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub&lt;/a&gt; if someone runs into the same issues&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-11-04T15:48:15.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4552" PostTypeId="2" ParentId="4348" CreationDate="2014-11-04T17:34:49.007" Score="5" Body="&lt;p&gt;ContentModel will only have the values in the actual content table, and the values that are actually there still may not be what you’re after, because accessing those values directly won’t give the field types a chance to do any preprocessing on their data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the best way to reliably get an array of all of an element’s custom field content is to go through its Field Layout, via &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldLayout-detail&quot; rel=&quot;noreferrer&quot;&gt;BaseElementModel::getFieldLayout()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$values = array();&#xA;&#xA;foreach ($element-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $fieldLayoutField)&#xA;{&#xA;    // $fieldLayoutField is a FieldLayoutFieldModel, *not* a FieldModel&#xA;    // http://buildwithcraft.com/classreference/models/FieldLayoutFieldModel&#xA;    // so get the actual FieldModel here&#xA;    $field = $fieldLayoutField-&amp;gt;getField();&#xA;&#xA;    // Now get the prepped field value&#xA;    $value = $element-&amp;gt;getFieldValue($field-&amp;gt;handle);&#xA;&#xA;    $values[$field-&amp;gt;handle] = $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-04T17:34:49.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4553" PostTypeId="1" AcceptedAnswerId="4554" CreationDate="2014-11-04T19:29:45.687" Score="10" ViewCount="5958" Body="&lt;p&gt;I'm working on a plugin that'll create a private API for content authors to post entries to Craft from desktop-based scripts. These scripts post data to plugin controller actions (anonymous-allowed), where the plugin will first check for valid Craft user account details or a plugin-generated key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Since I'm still enforcing authentication, what's the best way to disable CSRF checks &lt;em&gt;just for these posts&lt;/em&gt; when CSRF is globally enabled?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts I've had:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Attempt to put the CSRF key and token in the $_POST data as early as possible. (Probably not even possible.)&lt;/li&gt;&#xA;&lt;li&gt;Have the client (desktop) script grab the CSRF key+token just before posting. (Inconvenient, potentially failure-prone.)&lt;/li&gt;&#xA;&lt;li&gt;Somehow prevent CSRF protection from being enabled for requests passed to this controller.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="22" LastActivityDate="2021-05-25T08:26:56.717" Title="What's the best way to skip CSRF for plugin controllers?" Tags="&lt;plugin-development&gt;&lt;csrf&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4554" PostTypeId="2" ParentId="4553" CreationDate="2014-11-04T20:21:48.450" Score="13" Body="&lt;p&gt;Craft is piggybacking off of Yii's CSRF support for 90% of the work here and they've implemented it at the &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.15/framework/web/CHttpRequest.php#L135&quot; rel=&quot;noreferrer&quot;&gt;Request&lt;/a&gt; level (specifically &lt;code&gt;onBeginRequest&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That happens way before Craft gets a chance to determine what type of request this is, much less figure out where to route it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your best bet is going to be to put some logic in Craft's &lt;code&gt;general.php&lt;/code&gt; config file that specifically check's for PHP's &lt;code&gt;$_GET&lt;/code&gt; and &lt;code&gt;$_POST&lt;/code&gt; globals for a &lt;code&gt;p=some/path/to/my/plugin/controller&lt;/code&gt; and disables the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#enableCsrfProtection&quot; rel=&quot;noreferrer&quot;&gt;enableCsrfProtection&lt;/a&gt; config setting for that request.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'enableCsrfProtection' =&amp;gt; (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] != '/actions/plugin/controller/action'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2016-12-02T17:47:08.900" LastActivityDate="2016-12-02T17:47:08.900" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4555" PostTypeId="2" ParentId="4542" CreationDate="2014-11-04T21:38:55.400" Score="1" Body="&lt;p&gt;Turns out this is actually a bug, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's going to end up being more involved to fix than a build release probably warrants, though, so it'll have to wait for the upcoming 2.3 release to get a proper fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you'll be able to get by with your workaround of manually setting it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$c-&amp;gt;locale = craft()-&amp;gt;i18n-&amp;gt;getPrimarySiteLocale();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-04T21:38:55.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4556" PostTypeId="1" AcceptedAnswerId="4566" CreationDate="2014-11-04T22:05:06.890" Score="1" ViewCount="339" Body="&lt;p&gt;I'm trying to get a record from my database for a UserGroup (although I'm guessing this applies to a few scenarios really - anything that isn't a Craft Element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still new to plugin development so I could be approaching this entirely wrong but I'm pretty sure I don't want to be using &lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt; because it might break in a future version of craft when the schema changes and I also can't do it by using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::UserGroup);&lt;/code&gt; because it's not an element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a best practice for this?&lt;/p&gt;&#xA;" OwnerUserId="469" LastEditorUserId="469" LastEditDate="2014-11-05T01:51:23.897" LastActivityDate="2014-11-05T01:51:23.897" Title="Get Craft UserGroup by ID in Plugin" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4557" PostTypeId="1" CreationDate="2014-11-04T22:11:45.587" Score="7" ViewCount="882" Body="&lt;p&gt;Pretty much like the title says - What is the best way to track, record or view search terms when using the built in &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;noreferrer&quot;&gt;Search form&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="9" LastEditDate="2014-11-05T01:14:37.247" LastActivityDate="2020-10-04T17:56:40.807" Title="What is the best way to track, record or view search terms?" Tags="&lt;search&gt;&lt;analytics&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4558" PostTypeId="2" ParentId="4510" CreationDate="2014-11-04T22:38:07.067" Score="12" Body="&lt;p&gt;This is not the answer you were looking for, but if you decide to just go with a normal drop-down, then you can paste the following into the dropdown field in the database. This would go in the &lt;code&gt;craft_fields&lt;/code&gt; table, &lt;code&gt;yourCountryField&lt;/code&gt; row, &lt;code&gt;settings&lt;/code&gt; column. After editing the list the way you need it I would suggest removing all line-breaks using grep find/replace ('\n', ''), but it may not matter either.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;options&quot;:[&#xA;{&quot;label&quot;:&quot;Afghanistan&quot;,&quot;value&quot;:&quot;AF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Aland Islands&quot;,&quot;value&quot;:&quot;AX&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Albania&quot;,&quot;value&quot;:&quot;AL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Algeria&quot;,&quot;value&quot;:&quot;DZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;American Samoa&quot;,&quot;value&quot;:&quot;AS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Andorra&quot;,&quot;value&quot;:&quot;AD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Angola&quot;,&quot;value&quot;:&quot;AO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Anguilla&quot;,&quot;value&quot;:&quot;AI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Antarctica&quot;,&quot;value&quot;:&quot;AQ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Antigua and Barbuda&quot;,&quot;value&quot;:&quot;AG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Argentina&quot;,&quot;value&quot;:&quot;AR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Armenia&quot;,&quot;value&quot;:&quot;AM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Aruba&quot;,&quot;value&quot;:&quot;AW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Australia&quot;,&quot;value&quot;:&quot;AU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Austria&quot;,&quot;value&quot;:&quot;AT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Azerbaijan&quot;,&quot;value&quot;:&quot;AZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bahamas&quot;,&quot;value&quot;:&quot;BS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bahrain&quot;,&quot;value&quot;:&quot;BH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bangladesh&quot;,&quot;value&quot;:&quot;BD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Barbados&quot;,&quot;value&quot;:&quot;BB&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Belarus&quot;,&quot;value&quot;:&quot;BY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Belgium&quot;,&quot;value&quot;:&quot;BE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Belize&quot;,&quot;value&quot;:&quot;BZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Benin&quot;,&quot;value&quot;:&quot;BJ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bermuda&quot;,&quot;value&quot;:&quot;BM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bhutan&quot;,&quot;value&quot;:&quot;BT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bolivia&quot;,&quot;value&quot;:&quot;BO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bosnia and Herzegovina&quot;,&quot;value&quot;:&quot;BA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Botswana&quot;,&quot;value&quot;:&quot;BW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bouvet Island&quot;,&quot;value&quot;:&quot;BV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Brazil&quot;,&quot;value&quot;:&quot;BR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;British Indian Ocean Territory&quot;,&quot;value&quot;:&quot;IO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Brunei Darussalam&quot;,&quot;value&quot;:&quot;BN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Bulgaria&quot;,&quot;value&quot;:&quot;BG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Burkina Faso&quot;,&quot;value&quot;:&quot;BF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Burundi&quot;,&quot;value&quot;:&quot;BI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cambodia&quot;,&quot;value&quot;:&quot;KH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cameroon&quot;,&quot;value&quot;:&quot;CM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Canada&quot;,&quot;value&quot;:&quot;CA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cape Verde&quot;,&quot;value&quot;:&quot;CV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cayman Islands&quot;,&quot;value&quot;:&quot;KY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Central African Republic&quot;,&quot;value&quot;:&quot;CF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Chad&quot;,&quot;value&quot;:&quot;TD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Chile&quot;,&quot;value&quot;:&quot;CL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;China&quot;,&quot;value&quot;:&quot;CN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Christmas Island&quot;,&quot;value&quot;:&quot;CX&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cocos (Keeling) Islands&quot;,&quot;value&quot;:&quot;CC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Colombia&quot;,&quot;value&quot;:&quot;CO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Comoros&quot;,&quot;value&quot;:&quot;KM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Congo&quot;,&quot;value&quot;:&quot;CG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Congo, The Democratic Republic of the&quot;,&quot;value&quot;:&quot;CD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cook Islands&quot;,&quot;value&quot;:&quot;CK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Costa Rica&quot;,&quot;value&quot;:&quot;CR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cote D'Ivoire&quot;,&quot;value&quot;:&quot;CI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Croatia&quot;,&quot;value&quot;:&quot;HR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cuba&quot;,&quot;value&quot;:&quot;CU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Cyprus&quot;,&quot;value&quot;:&quot;CY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Czech Republic&quot;,&quot;value&quot;:&quot;CZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Denmark&quot;,&quot;value&quot;:&quot;DK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Djibouti&quot;,&quot;value&quot;:&quot;DJ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Dominica&quot;,&quot;value&quot;:&quot;DM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Dominican Republic&quot;,&quot;value&quot;:&quot;DO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Ecuador&quot;,&quot;value&quot;:&quot;EC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Egypt&quot;,&quot;value&quot;:&quot;EG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;El Salvador&quot;,&quot;value&quot;:&quot;SV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Equatorial Guinea&quot;,&quot;value&quot;:&quot;GQ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Eritrea&quot;,&quot;value&quot;:&quot;ER&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Estonia&quot;,&quot;value&quot;:&quot;EE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Ethiopia&quot;,&quot;value&quot;:&quot;ET&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Falkland Islands (Malvinas)&quot;,&quot;value&quot;:&quot;FK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Faroe Islands&quot;,&quot;value&quot;:&quot;FO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Fiji&quot;,&quot;value&quot;:&quot;FJ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Finland&quot;,&quot;value&quot;:&quot;FI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;France&quot;,&quot;value&quot;:&quot;FR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;French Guiana&quot;,&quot;value&quot;:&quot;GF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;French Polynesia&quot;,&quot;value&quot;:&quot;PF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;French Southern Territories&quot;,&quot;value&quot;:&quot;TF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Gabon&quot;,&quot;value&quot;:&quot;GA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Gambia&quot;,&quot;value&quot;:&quot;GM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Georgia&quot;,&quot;value&quot;:&quot;GE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Germany&quot;,&quot;value&quot;:&quot;DE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Ghana&quot;,&quot;value&quot;:&quot;GH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Gibraltar&quot;,&quot;value&quot;:&quot;GI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Greece&quot;,&quot;value&quot;:&quot;GR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Greenland&quot;,&quot;value&quot;:&quot;GL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Grenada&quot;,&quot;value&quot;:&quot;GD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guadeloupe&quot;,&quot;value&quot;:&quot;GP&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guam&quot;,&quot;value&quot;:&quot;GU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guatemala&quot;,&quot;value&quot;:&quot;GT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guernsey&quot;,&quot;value&quot;:&quot;GG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guinea&quot;,&quot;value&quot;:&quot;GN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guinea-Bissau&quot;,&quot;value&quot;:&quot;GW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Guyana&quot;,&quot;value&quot;:&quot;GY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Haiti&quot;,&quot;value&quot;:&quot;HT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Heard Island and Mcdonald Islands&quot;,&quot;value&quot;:&quot;HM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Holy See (Vatican City State)&quot;,&quot;value&quot;:&quot;VA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Honduras&quot;,&quot;value&quot;:&quot;HN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Hong Kong&quot;,&quot;value&quot;:&quot;HK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Hungary&quot;,&quot;value&quot;:&quot;HU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Iceland&quot;,&quot;value&quot;:&quot;IS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;India&quot;,&quot;value&quot;:&quot;IN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Indonesia&quot;,&quot;value&quot;:&quot;ID&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Iran, Islamic Republic Of&quot;,&quot;value&quot;:&quot;IR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Iraq&quot;,&quot;value&quot;:&quot;IQ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Ireland&quot;,&quot;value&quot;:&quot;IE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Isle of Man&quot;,&quot;value&quot;:&quot;IM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Israel&quot;,&quot;value&quot;:&quot;IL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Italy&quot;,&quot;value&quot;:&quot;IT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Jamaica&quot;,&quot;value&quot;:&quot;JM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Japan&quot;,&quot;value&quot;:&quot;JP&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Jersey&quot;,&quot;value&quot;:&quot;JE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Jordan&quot;,&quot;value&quot;:&quot;JO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Kazakhstan&quot;,&quot;value&quot;:&quot;KZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Kenya&quot;,&quot;value&quot;:&quot;KE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Kiribati&quot;,&quot;value&quot;:&quot;KI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Korea, Democratic People's Republic of&quot;,&quot;value&quot;:&quot;KP&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Korea, Republic of&quot;,&quot;value&quot;:&quot;KR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Kuwait&quot;,&quot;value&quot;:&quot;KW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Kyrgyzstan&quot;,&quot;value&quot;:&quot;KG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Lao People's Democratic Republic&quot;,&quot;value&quot;:&quot;LA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Latvia&quot;,&quot;value&quot;:&quot;LV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Lebanon&quot;,&quot;value&quot;:&quot;LB&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Lesotho&quot;,&quot;value&quot;:&quot;LS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Liberia&quot;,&quot;value&quot;:&quot;LR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Libyan Arab Jamahiriya&quot;,&quot;value&quot;:&quot;LY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Liechtenstein&quot;,&quot;value&quot;:&quot;LI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Lithuania&quot;,&quot;value&quot;:&quot;LT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Luxembourg&quot;,&quot;value&quot;:&quot;LU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Macao&quot;,&quot;value&quot;:&quot;MO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Macedonia, The Former Yugoslav Republic of&quot;,&quot;value&quot;:&quot;MK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Madagascar&quot;,&quot;value&quot;:&quot;MG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Malawi&quot;,&quot;value&quot;:&quot;MW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Malaysia&quot;,&quot;value&quot;:&quot;MY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Maldives&quot;,&quot;value&quot;:&quot;MV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mali&quot;,&quot;value&quot;:&quot;ML&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Malta&quot;,&quot;value&quot;:&quot;MT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Marshall Islands&quot;,&quot;value&quot;:&quot;MH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Martinique&quot;,&quot;value&quot;:&quot;MQ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mauritania&quot;,&quot;value&quot;:&quot;MR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mauritius&quot;,&quot;value&quot;:&quot;MU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mayotte&quot;,&quot;value&quot;:&quot;YT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mexico&quot;,&quot;value&quot;:&quot;MX&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Micronesia, Federated States of&quot;,&quot;value&quot;:&quot;FM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Moldova, Republic of&quot;,&quot;value&quot;:&quot;MD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Monaco&quot;,&quot;value&quot;:&quot;MC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mongolia&quot;,&quot;value&quot;:&quot;MN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Montserrat&quot;,&quot;value&quot;:&quot;MS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Morocco&quot;,&quot;value&quot;:&quot;MA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Mozambique&quot;,&quot;value&quot;:&quot;MZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Myanmar&quot;,&quot;value&quot;:&quot;MM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Namibia&quot;,&quot;value&quot;:&quot;NA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Nauru&quot;,&quot;value&quot;:&quot;NR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Nepal&quot;,&quot;value&quot;:&quot;NP&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Netherlands&quot;,&quot;value&quot;:&quot;NL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Netherlands Antilles&quot;,&quot;value&quot;:&quot;AN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;New Caledonia&quot;,&quot;value&quot;:&quot;NC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;New Zealand&quot;,&quot;value&quot;:&quot;NZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Nicaragua&quot;,&quot;value&quot;:&quot;NI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Niger&quot;,&quot;value&quot;:&quot;NE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Nigeria&quot;,&quot;value&quot;:&quot;NG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Niue&quot;,&quot;value&quot;:&quot;NU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Norfolk Island&quot;,&quot;value&quot;:&quot;NF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Northern Mariana Islands&quot;,&quot;value&quot;:&quot;MP&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Norway&quot;,&quot;value&quot;:&quot;NO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Oman&quot;,&quot;value&quot;:&quot;OM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Pakistan&quot;,&quot;value&quot;:&quot;PK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Palau&quot;,&quot;value&quot;:&quot;PW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Palestinian Territory, Occupied&quot;,&quot;value&quot;:&quot;PS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Panama&quot;,&quot;value&quot;:&quot;PA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Papua New Guinea&quot;,&quot;value&quot;:&quot;PG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Paraguay&quot;,&quot;value&quot;:&quot;PY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Peru&quot;,&quot;value&quot;:&quot;PE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Philippines&quot;,&quot;value&quot;:&quot;PH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Pitcairn&quot;,&quot;value&quot;:&quot;PN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Poland&quot;,&quot;value&quot;:&quot;PL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Portugal&quot;,&quot;value&quot;:&quot;PT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Puerto Rico&quot;,&quot;value&quot;:&quot;PR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Qatar&quot;,&quot;value&quot;:&quot;QA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Reunion&quot;,&quot;value&quot;:&quot;RE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Romania&quot;,&quot;value&quot;:&quot;RO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Russian Federation&quot;,&quot;value&quot;:&quot;RU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Rwanda&quot;,&quot;value&quot;:&quot;RW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saint Helena&quot;,&quot;value&quot;:&quot;SH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saint Kitts and Nevis&quot;,&quot;value&quot;:&quot;KN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saint Lucia&quot;,&quot;value&quot;:&quot;LC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saint Pierre and Miquelon&quot;,&quot;value&quot;:&quot;PM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saint Vincent and the Grenadines&quot;,&quot;value&quot;:&quot;VC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Samoa&quot;,&quot;value&quot;:&quot;WS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;San Marino&quot;,&quot;value&quot;:&quot;SM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Sao Tome and Principe&quot;,&quot;value&quot;:&quot;ST&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Saudi Arabia&quot;,&quot;value&quot;:&quot;SA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Senegal&quot;,&quot;value&quot;:&quot;SN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Serbia and Montenegro&quot;,&quot;value&quot;:&quot;CS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Seychelles&quot;,&quot;value&quot;:&quot;SC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Sierra Leone&quot;,&quot;value&quot;:&quot;SL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Singapore&quot;,&quot;value&quot;:&quot;SG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Slovakia&quot;,&quot;value&quot;:&quot;SK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Slovenia&quot;,&quot;value&quot;:&quot;SI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Solomon Islands&quot;,&quot;value&quot;:&quot;SB&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Somalia&quot;,&quot;value&quot;:&quot;SO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;South Africa&quot;,&quot;value&quot;:&quot;ZA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;South Georgia and the South Sandwich Islands&quot;,&quot;value&quot;:&quot;GS&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Spain&quot;,&quot;value&quot;:&quot;ES&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Sri Lanka&quot;,&quot;value&quot;:&quot;LK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Sudan&quot;,&quot;value&quot;:&quot;SD&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Suriname&quot;,&quot;value&quot;:&quot;SR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Svalbard and Jan Mayen&quot;,&quot;value&quot;:&quot;SJ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Swaziland&quot;,&quot;value&quot;:&quot;SZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Sweden&quot;,&quot;value&quot;:&quot;SE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Switzerland&quot;,&quot;value&quot;:&quot;CH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Syrian Arab Republic&quot;,&quot;value&quot;:&quot;SY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Taiwan, Province of China&quot;,&quot;value&quot;:&quot;TW&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tajikistan&quot;,&quot;value&quot;:&quot;TJ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tanzania, United Republic of&quot;,&quot;value&quot;:&quot;TZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Thailand&quot;,&quot;value&quot;:&quot;TH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Timor-Leste&quot;,&quot;value&quot;:&quot;TL&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Togo&quot;,&quot;value&quot;:&quot;TG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tokelau&quot;,&quot;value&quot;:&quot;TK&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tonga&quot;,&quot;value&quot;:&quot;TO&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Trinidad and Tobago&quot;,&quot;value&quot;:&quot;TT&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tunisia&quot;,&quot;value&quot;:&quot;TN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Turkey&quot;,&quot;value&quot;:&quot;TR&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Turkmenistan&quot;,&quot;value&quot;:&quot;TM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Turks and Caicos Islands&quot;,&quot;value&quot;:&quot;TC&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Tuvalu&quot;,&quot;value&quot;:&quot;TV&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Uganda&quot;,&quot;value&quot;:&quot;UG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Ukraine&quot;,&quot;value&quot;:&quot;UA&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;United Arab Emirates&quot;,&quot;value&quot;:&quot;AE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;United Kingdom&quot;,&quot;value&quot;:&quot;GB&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;United States&quot;,&quot;value&quot;:&quot;US&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;United States Minor Outlying Islands&quot;,&quot;value&quot;:&quot;UM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Uruguay&quot;,&quot;value&quot;:&quot;UY&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Uzbekistan&quot;,&quot;value&quot;:&quot;UZ&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Vanuatu&quot;,&quot;value&quot;:&quot;VU&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Venezuela&quot;,&quot;value&quot;:&quot;VE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Viet Nam&quot;,&quot;value&quot;:&quot;VN&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Virgin Islands, British&quot;,&quot;value&quot;:&quot;VG&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Virgin Islands, U.S.&quot;,&quot;value&quot;:&quot;VI&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Wallis and Futuna&quot;,&quot;value&quot;:&quot;WF&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Western Sahara&quot;,&quot;value&quot;:&quot;EH&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Yemen&quot;,&quot;value&quot;:&quot;YE&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Zambia&quot;,&quot;value&quot;:&quot;ZM&quot;,&quot;default&quot;:&quot;&quot;},&#xA;{&quot;label&quot;:&quot;Zimbabwe&quot;,&quot;value&quot;:&quot;ZW&quot;,&quot;default&quot;:&quot;&quot;}&#xA;]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-04T22:43:42.597" LastActivityDate="2014-11-04T22:43:42.597" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4559" PostTypeId="1" CreationDate="2014-11-04T23:16:48.010" Score="1" ViewCount="299" Body="&lt;p&gt;Does anyone know if there is a way to extend redactor to render a template, for example, when inserting an image so that it could also display custom asset fields (i.e. caption, photo credit, etc.) in a small html block? I have no idea how difficult or easy it is write redactor plugins.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-10T04:30:06.950" Title="Is there a way integrate redactor with your assets fields?" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4560" PostTypeId="1" AcceptedAnswerId="4565" CreationDate="2014-11-04T23:21:21.983" Score="5" ViewCount="1163" Body="&lt;p&gt;In my template, I want to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get all the entries in the section 'uploads';&lt;/li&gt;&#xA;&lt;li&gt;Get all the assets that are related to &lt;strong&gt;one of the&lt;/strong&gt; upload entries, &lt;strong&gt;and&lt;/strong&gt; have a relation to all the tags I provide.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, that would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set company = craft.entries.section('company').id(companyId).first() %}&#xA;{% set uploads = craft.entries.section('uploads').relatedTo(company).limit(null) %}&#xA;&#xA;{% set relatedToUploads = ['or'] %}&#xA;{% for upload in uploads %}&#xA;    {% set relatedToUploads = relatedToUploads | merge([upload.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set relatedToTags = ['and'] %}&#xA;{% for tag in tags %}&#xA;    {% set relatedToTags = relatedToTags | merge([tag.id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, how would I combine those two relatedTo-arrays to one, usable in the ElementCriteriaModel for the assets?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-05T01:25:44.263" Title="How can I create an ElementCriteriaModel with 'and' and 'or'" Tags="&lt;entries&gt;&lt;assets&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4561" PostTypeId="2" ParentId="4541" CreationDate="2014-11-04T23:22:08.653" Score="2" Body="&lt;p&gt;Have you tried setting a variable and passing it down into your include?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentFolder = craft.request.getFirstSegment %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then pass &lt;code&gt;parentFolder&lt;/code&gt; (or whatever you name it) down? This of course assumes your first segment is the name of your folder tree.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2014-11-04T23:22:08.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4562" PostTypeId="2" ParentId="4557" CreationDate="2014-11-04T23:26:44.673" Score="4" Body="&lt;p&gt;No built in way that I am aware of, but you could send the search query off to a custom plugin controller from your search template using ajax, which could either save it to a custom table (i.e. search_cache), or log them to a log file.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-04T23:26:44.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4563" PostTypeId="2" ParentId="4557" CreationDate="2014-11-04T23:35:12.130" Score="3" Body="&lt;p&gt;Completely untested, but may work in theory... &lt;strong&gt;Take a look into &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hooks&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the template loads, it will ping your hook and provide whatever Twig variables have already been set. Your custom plugin will have a chance to then record your search terms as needed.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-04T23:35:12.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4564" PostTypeId="2" ParentId="4557" CreationDate="2014-11-05T01:13:27.823" Score="9" Body="&lt;p&gt;We track search terms on buildwithcraft.com the same way we track all other site activity: using Google Analytics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do is throw GA event tracking code into your search results template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’ve upgraded to Universal Analytics/analytics.js, use this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set js %}&#xA;    ga('send', 'event', 'Search', 'Search', '{{ query|e(&quot;js&quot;) }}', {'nonInteraction': 1});&#xA;{% endset %}&#xA;{% includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you’re still on the old ga.js, use this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set js %}&#xA;    _gaq.push(['_trackEvent', 'Search', 'Search', '{{ query|e(&quot;js&quot;) }}', null, true]);&#xA;{% endset %}&#xA;{% includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are other ways to include the JS, of course. (In our case we actually have a blank &lt;code&gt;analytics&lt;/code&gt; block right alongside other Google Analytics instantiating code in the layout template, and set this JS code by overriding that block on templates that have custom things to track.) This &lt;code&gt;{% includeJs %}&lt;/code&gt; route is just the most unassuming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that code in place, you’ll be able to start tracking “Search” events from Behavior &gt; Events in your Google Analytics dashboard.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-05T01:13:27.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4565" PostTypeId="2" ParentId="4560" CreationDate="2014-11-05T01:25:44.263" Score="4" Body="&lt;p&gt;It’s not currently possible to specify both of those conditions at once with the relatedTo param, so you would have to do it with two separate queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, get all of the asset IDs that are related to the upload entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set uploadAssetIds = craft.assets.relatedTo(uploads).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that the relatedToUploads variable is not actually necessary here.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would get all of the assets whose ID falls within one of the uploadAssetIds, &lt;strong&gt;and&lt;/strong&gt; who are related to all of the tag IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedToTags = ['and'] %}&#xA;...&#xA;&#xA;{% set assets = craft.assets.id(uploadAssetIds).relatedTo(relatedToTags) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-05T01:25:44.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4566" PostTypeId="2" ParentId="4556" CreationDate="2014-11-05T01:33:45.403" Score="2" Body="&lt;p&gt;You'll want to go through Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/#craft.app.services&quot; rel=&quot;nofollow&quot;&gt;service&lt;/a&gt; layer to get things like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService&quot; rel=&quot;nofollow&quot;&gt;UserGroupsService&lt;/a&gt;, which has all sorts of handy methods for retrieving UserGroups like &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService#getGroupById-detail&quot; rel=&quot;nofollow&quot;&gt;getGroupById()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService#getGroupByHandle-detail&quot; rel=&quot;nofollow&quot;&gt;getGroupByHandle()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can invoke these from your plugin like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userGroup = craft()-&amp;gt;usergroups-&amp;gt;getGroupById(3);&#xA;$groupName = $userGroup-&amp;gt;name;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that these will return a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserGroupModel&quot; rel=&quot;nofollow&quot;&gt;UserGroupModel&lt;/a&gt; populated with your UserGroup information.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-05T01:33:45.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4567" PostTypeId="1" AcceptedAnswerId="5004" CreationDate="2014-11-05T02:30:39.410" Score="1" ViewCount="428" Body="&lt;p&gt;I've got a site-wide search box (based on the example in the documentation). It's doing a good job of searching through the entries, but is there a way that I can include a search through a user group like authors as well and include it in the same list of results? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I just have this but its not getting any results for author searches even though I know they exist. It seems like the authors should be searchable since they're linked to the entry...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I did another search through &lt;code&gt;craft.users.search&lt;/code&gt; I could get another list of results, but I'd like to have one combined list. Is something like that possible?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-11-30T21:34:59.997" Title="Including author in search for entries" Tags="&lt;users&gt;&lt;search&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4568" PostTypeId="1" AcceptedAnswerId="4569" CreationDate="2014-11-05T02:46:40.737" Score="5" ViewCount="639" Body="&lt;p&gt;I want to create a custom plugin (element type) that does not allow custom fields. Therefore, when digging through existing element types, do I really need to have the getSources method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is the case, what is the P&amp;amp;T definition of &quot;sources&quot; and are there any base element types that don't use &quot;sources&quot;?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-11-05T05:06:15.647" Title="Use a custom Element Type without sources?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4569" PostTypeId="2" ParentId="4568" CreationDate="2014-11-05T05:00:39.220" Score="4" Body="&lt;p&gt;Element Types, Custom Fields, and Sources can work closely together, but how you structure that relationship has a lot of flexibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sources are optional.  They are a convenient way to group and filter Elements, but they vary in the way that they group those Elements – Globals use Global Sets, Categories use Category Groups, Entries use Sections – and if you don't need them, you should be able to just leave them out altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One place, where sources aren't completely non-existent, but where you will see the Craft user interface present an Element Type without any sources is if you restrict an Asset field to a single folder or an Entry Relations field to a single Section.  When you trigger the field modal to select the related Assets or Entries, you will not see any sources in the sidebar, because all the Elements fall into that singular container that you set in the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building your custom Element without sources would behave in a similar way. Your Element index page and your Element Field Type will expand to full width and your user will just see your content however you wish to present it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your question in the comments: What should be an Element Type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure this is a much longer discussion, but I will volunteer a vague one sentence answer!:  when the benefits of using the extendable features of Element Types (sources, search, relations, etc.) outweigh the costs of developing more specific custom solutions for your needs.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2014-11-05T05:06:15.647" LastActivityDate="2014-11-05T05:06:15.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4571" PostTypeId="1" AcceptedAnswerId="4573" CreationDate="2014-11-05T06:39:03.657" Score="4" ViewCount="1777" Body="&lt;p&gt;I'm building an advanced search form and having some difficulty with getting the results. The form inputs include price and year ranges. For example, search for used cars from $10,000 to $20,000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search is working, here's my results page code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set manufacturer = craft.request.getParam('manufacturer') %}&#xA;{% set model = craft.request.getParam('model') %}&#xA;{% set bodyStyle = craft.request.getParam('bodyStyle') %}&#xA;&#xA;{% set minPrice = craft.request.getParam('minPrice') %}&#xA;{% set maxPrice = craft.request.getParam('maxPrice') %}&#xA;&#xA;{% set startYear = craft.request.getParam('startYear') %}&#xA;{% set endYear = craft.request.getParam('endYear') %}&#xA;&#xA;{% set results = craft.entries.section('usedCars').type('entry').search().manufacturer(manufacturer).model(model).bodyStyle(bodyStyle) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how i'm showing the price range.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if minPrice|length and maxPrice|length %}&#xA;{% for entry in results if entry.price &amp;lt;= maxPrice and entry.price &amp;gt;= minPrice %}&#xA;&#xA;{% if minPrice is empty and maxPrice|length %}&#xA;{% for entry in results if entry.price &amp;lt;= maxPrice %}&#xA;&#xA;and so on etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The trouble with this method is it's all based on a whole stack of &quot;IF&quot; statements and when I start to think about adding the year ranges too, my head starts to hurt. Is there an easier way to achieve the same thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd appreciate any nod in a general direction, or help simplifying my code down...&lt;/p&gt;&#xA;" OwnerUserId="749" LastActivityDate="2014-11-05T15:12:58.590" Title="Building Results From Advanced Search Form" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4572" PostTypeId="1" AcceptedAnswerId="4595" CreationDate="2014-11-05T07:51:29.223" Score="2" ViewCount="764" Body="&lt;p&gt;I need to upload a file to my server via a custom field type and I'm trying it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function prepValueFromPost($value)&#xA;{&#xA;    // Get file&#xA;    $file = \CUploadedFile::getInstanceByName('fields[handle]');&#xA;&#xA;    // Determine folder&#xA;    $folder = 'folder/to/upload';&#xA;&#xA;    // Ensure folder exists&#xA;    IOHelper::ensureFolderExists($folder);&#xA;&#xA;    // Get filepath - save in storage folder&#xA;    $path = $folder . $file-&amp;gt;getName();&#xA;&#xA;    // Save file to Craft's temp folder for later use&#xA;    $file-&amp;gt;saveAs($path);&#xA;}&#xA;&#xA;public function getInputHtml($name, $value)&#xA;{   &#xA;    return craft()-&amp;gt;templates-&amp;gt;render('_includes/forms/file', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value,&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This sadly ends up in the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to a member function getName() on a non-object in...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea how to solve this? My file input has the name &quot;fields[handle]&quot; but i also tried &quot;handle&quot; but nothing changes...&lt;/p&gt;&#xA;" OwnerUserId="818" LastActivityDate="2014-11-05T23:29:28.817" Title="Custom field type file upload error [Uploaded File Class]" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4573" PostTypeId="2" ParentId="4571" CreationDate="2014-11-05T08:48:38.253" Score="10" Body="&lt;p&gt;You can set multiple conditions on a single ElementCriteriaModel parameter. Pass it either a comma-separated list as a string or an array of conditions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.id('84, 62, &amp;lt; 7, 29') %}&#xA;{% set entries = craft.entries.id([84, 62, &amp;lt; 7, 29]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, each entry with any of these IDs is returned (→ &lt;code&gt;or&lt;/code&gt; logic).&#xA;To return only those entries that match all criteria of your list (→ &lt;code&gt;and&lt;/code&gt; logic), set the first value to &lt;code&gt;and&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.id('and, &amp;gt; 100, &amp;lt; 200, not 110') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case I'd set the &quot;year&quot; and &quot;price&quot; parameters as an array and combine it with all other &lt;code&gt;craft.entries&lt;/code&gt; parameters using the object syntax like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;&#xA;    section: 'usedCars',&#xA;    type: 'entry',&#xA;    manufacturer: manufacturer,&#xA;    model: model,&#xA;    bodyStyle: bodyStyle,&#xA;    price: [&#xA;        'and',&#xA;        '&amp;gt;= ' ~ minPrice,&#xA;        '&amp;lt;= ' ~ maxPrice,&#xA;    ],&#xA;    year: [&#xA;        'and',&#xA;        '&amp;gt;= ' ~ startYear,&#xA;        '&amp;lt;= ' ~ endYear,&#xA;    ],&#xA;&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure that your &quot;year&quot; and &quot;price&quot; variables are not empty by setting default values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startYear = craft.request.getParam('startYear') %}&#xA;{% set startYear = startYear is not empty ? startYear : '1900' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-05T09:44:13.893" LastActivityDate="2014-11-05T09:44:13.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4574" PostTypeId="1" CreationDate="2014-11-05T09:58:01.630" Score="2" ViewCount="445" Body="&lt;p&gt;For a client eCommerce project I am working on all the product images are on white backgrounds, so they blend nicely with the background of the site. Currently I am putting all the images through a fit transform (480px by 480px), so that parts of the image aren't cut off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images are of different shapes and sizes and are transformed something like this (the grey area is the actual visible product part of the image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vRZ8k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am trying to achieve something like this, so all the images are 480px by 480px, and the visible content is slap bang in the middle. Anything extra is added as whitespace to make all the images the same dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something Craft can do and I am just being a dolt?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0G4XT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the risk of this question being closed as off topic, please note that I am not looking for a CSS/JS related answer for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find out if there is a way Craft can process the images for me, perhaps with ImageMagick or something similar to achieve what I am hoping for.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2014-11-05T13:32:28.900" LastActivityDate="2014-11-05T15:05:02.463" Title="Is it possible to add white background to transformed images?" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4575" PostTypeId="2" ParentId="1948" CreationDate="2014-11-05T10:11:22.653" Score="9" Body="&lt;p&gt;For most cases you can find a workaround to combine such conditions by making use of entry IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example query for each time range condition separately and use the &lt;code&gt;ids()&lt;/code&gt; method to &quot;collect&quot; your entries. All matching IDs are then passed to the &lt;code&gt;id&lt;/code&gt; parameter of a final ElementCriteriaModel, that you can also use for Pagination etc.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateParamCw32 = 'and, &amp;gt;= 2014-08-04 00:00:00, &amp;lt; 2014-08-10 23:59:59' %}&#xA;{% set dateParamCw34 = 'and, &amp;gt;= 2014-08-18 00:00:00, &amp;lt; 2014-08-24 23:59:59' %}&#xA;&#xA;{% set entriesCw32Ids = craft.entries.section('events').startDate(dateParamCw32).ids() %}&#xA;{% set entriesCw34Ids = craft.entries.section('events').startDate(dateParamCw34).ids() %}&#xA;&#xA;{% set idParam = [] %}&#xA;{% set idParam = idParam|merge(entriesCw32Ids) %}&#xA;{% set idParam = idParam|merge(entriesCw34Ids) %}&#xA;&#xA;{% set entries = craft.entries.id(idParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-06-29T10:24:44.983" LastActivityDate="2017-06-29T10:24:44.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4577" PostTypeId="1" AcceptedAnswerId="4592" CreationDate="2014-11-05T12:58:56.267" Score="1" ViewCount="1440" Body="&lt;p&gt;Also: &lt;a href=&quot;https://plus.google.com/111272585078935192473/posts/5qNuffv3SKp&quot; rel=&quot;nofollow&quot;&gt;https://plus.google.com/111272585078935192473/posts/5qNuffv3SKp&lt;/a&gt; which seems to be a similar problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m with a hoster where compression for PHP scripts must be enabled in php.ini adding &lt;code&gt;zlib.output_compression = On&lt;/code&gt; to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After restarting the front end gets compressed as exprected, but the CP breaks, throwing &lt;code&gt;net::ERR_CONTENT_LENGTH_MISMATCH&lt;/code&gt; for all resources (css, js etc.) which causes them not to be loaded. I have spoken with the hoster but they are unsure about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is to do?&#xA;How can i get compression for my website without breaking the Control Panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something i can do on my end?&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2014-11-05T15:52:10.673" LastActivityDate="2014-11-05T22:36:35.937" Title="net::ERR_CONTENT_LENGTH_MISMATCH for CP after enabling compression" Tags="&lt;server&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4579" PostTypeId="2" ParentId="4574" CreationDate="2014-11-05T14:09:50.340" Score="3" Body="&lt;p&gt;Unless one of the devs say otherwise, Craft's image processing is resizing only. They do not add anything to the image.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-11-05T14:09:50.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4580" PostTypeId="2" ParentId="4574" CreationDate="2014-11-05T15:05:02.463" Score="2" Body="&lt;p&gt;Even if it was possible to do that with image transforms in Craft, why would you do that. You produce unnecessary data or image artifacts if you work the background into your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to achieve the same effect with css:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * 1. Positions the image absolutely to its container.&#xA; * 2. Sets the bounding box for the image.&#xA; * 3. Centers the image in both directions.&#xA; * 4. Make the container's aspect ratio 1:1 by default.&#xA; * 5. Shrinks the image to fit its bounding box.&#xA; */&#xA;&#xA;.Letterbox {&#xA;  position: relative; /* 1 */&#xA;  padding-top: 100%; /* 4 */&#xA;}&#xA;&#xA;.Letterbox &amp;gt; img {&#xA;  position: absolute; /* 1 */&#xA;  margin: auto; /* 3 */&#xA;  top: 0; /* 2 */&#xA;  left: 0;&#xA;  bottom: 0;&#xA;  right: 0;&#xA;  max-width: 100%; /* 5 */&#xA;  max-height: 100%; /* 5 */&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1495407/css-a-way-to-maintain-aspect-ratio-when-resizing-a-div&quot;&gt;&quot;CSS: A way to maintain aspect ratio when resizing a DIV?&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Absolute Horizontal And Vertical Centering In CSS&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-11-05T15:05:02.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4581" PostTypeId="2" ParentId="4571" CreationDate="2014-11-05T15:12:58.590" Score="3" Body="&lt;p&gt;If statements should be fine. What you're building is a query to find things later. So you could easily start with the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries.section('usedCars').type('entry') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then add parameters as they exist:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('manufacturer') %}&#xA;    {% set query = query.manufacturer(craft.request.getParam('manufacturer')) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, I don't see an actual search query (like from a search box). If you're just searching based on predefined parameters, you don't need to add &lt;code&gt;search()&lt;/code&gt;. That's mainly for full text searching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're all set, you can then check for results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if query.total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And display them if there's any:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for car in query %}&#xA;    {{ car.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2014-11-05T15:12:58.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4582" PostTypeId="1" AcceptedAnswerId="30619" CreationDate="2014-11-05T15:37:16.310" Score="6" ViewCount="2240" Body="&lt;p&gt;I just want to run a couple of conditionals depending on a visitor's IP address. How would I do that?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2019-06-07T19:50:11.207" Title="How to get IP address without a plugin?" Tags="&lt;conditional&gt;&lt;ip-address&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4583" PostTypeId="1" AcceptedAnswerId="4585" CreationDate="2014-11-05T15:54:54.877" Score="4" ViewCount="2501" Body="&lt;p&gt;Following up on this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/648/prescribed-way-to-set-cookies-from-plugin-or-twig&quot;&gt;Prescribed way to set cookies (from plugin or Twig)&lt;/a&gt; the following works great.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie($cookieName, $data, $duration);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see &lt;strong&gt;Location&lt;/strong&gt; being set as my cookie in the Application Log but when I try to use &lt;code&gt;{{ craft.request.getCookie('location') }}&lt;/code&gt; It returns blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; - Upon closer inspection it doesn't look like saveCookie is working correctly either. I see location from when I was using setFlash but I need the data to persist even if the page is reloaded.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2019-03-16T00:32:52.067" Title="Best way to use saveCookie and craft.request.getCookie('location')" Tags="&lt;cookies&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4584" PostTypeId="2" ParentId="4582" CreationDate="2014-11-05T15:55:50.743" Score="9" Body="&lt;p&gt;From PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;getIpAddress() == '255.255.255.255')&#xA;{&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService#getIpAddress-detail&quot; rel=&quot;noreferrer&quot;&gt;from the docs&lt;/a&gt; that this is a &quot;best guess&quot; and can easily be spoofed, so you shouldn't use it to hide any sensitive information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We currently don't expose that method at the template level, but we probably should. I'll add that on the Craft 2.3 branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to hack it in before then, you can open up &lt;code&gt;craft/app/variables/HttpRequestVariable.php&lt;/code&gt; and add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getIpAddress()&#xA;{&#xA;    return craft()-&amp;gt;request-&amp;gt;getIpAddress();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from a template you'd use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getIpAddress() == '255.255.255.255' %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just note that there is a chance that a 2.2 update could overwrite that file at any time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: No hack is required since Craft 2.3.2615.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="167" LastEditDate="2015-04-16T12:04:45.587" LastActivityDate="2015-04-16T12:04:45.587" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4585" PostTypeId="2" ParentId="4583" CreationDate="2014-11-05T18:50:41.137" Score="4" Body="&lt;p&gt;You should probably be using something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $cookie = new HttpCookie($name, $value);&#xA;    $cookie-&amp;gt;expire = time() + 3600;&#xA;&#xA;    craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add($cookie-&amp;gt;name, $cookie);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting whatever properties you want on &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/HttpCookie&quot; rel=&quot;nofollow&quot;&gt;HttpCookie&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService&quot; rel=&quot;nofollow&quot;&gt;UserSessionService&lt;/a&gt;-&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService#saveCookie-detail&quot; rel=&quot;nofollow&quot;&gt;saveCookie&lt;/a&gt; is meant mainly for Craft's session identity cookie, so it has some security checks it goes through saving the cookie that &lt;code&gt;craft.request.getCookie('location')&lt;/code&gt; is probably failing.  &lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-05T19:15:41.783" LastActivityDate="2014-11-05T19:15:41.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4586" PostTypeId="1" AcceptedAnswerId="4602" CreationDate="2014-11-05T20:40:27.473" Score="6" ViewCount="6313" Body="&lt;p&gt;I have a plugin that accepts a form post. I need to return a notice or error, plus the original data. Starting with the notice/error first, I have tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;broadbean_jobs-&amp;gt;createJob())&#xA;{&#xA;    craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Job created.'));&#xA;}&#xA;else&#xA;{&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Unable to create job.'));&#xA;}&#xA;&#xA;$this-&amp;gt;redirectToPostedUrl();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I display the notice or error in my template?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2018-10-04T09:53:20.563" Title="How to display a flash message in a template" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4587" PostTypeId="2" ParentId="4508" CreationDate="2014-11-05T21:04:04.180" Score="1" Body="&lt;p&gt;Thanks to the outstanding support from Pixel and Tonic I can answer this with code supplied by Brad at P&amp;amp;T.  Also thanks to Jamie for looking into this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.seoInfo %}&#xA;    {% if block.type == &quot;seoBasics&quot; %}&#xA;&#xA;        {% if block.seoPageTitle | length %}&#xA;            &amp;lt;title&amp;gt;{{ block.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;        {% else %}&#xA;            {% for block in seoSettings.seoInfo.type('seoBasics') %}&#xA;                &amp;lt;title&amp;gt;{{ block.seoPageTitle }}&amp;lt;/title&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="189" LastEditorUserId="130" LastEditDate="2014-11-05T22:17:42.007" LastActivityDate="2014-11-05T22:17:42.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4588" PostTypeId="2" ParentId="1164" CreationDate="2014-11-05T21:27:55.830" Score="1" Body="&lt;p&gt;I personally have a cron set up to rsync my site to another server that is my standby server. If something happens it is ready to be swapped in. Using Amazon Mysql is great, they do all of the backups for you as part of their service. If you did not want to use Amazon Mysql, they you can add a mysqldump to your shell script and push the resulting dump file to to the remote server as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think Git is a great idea as well.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-11-05T21:27:55.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4589" PostTypeId="1" CreationDate="2014-11-05T21:28:06.457" Score="1" ViewCount="170" Body="&lt;p&gt;I use for example {{ craft.config.baseUrl }} where baseUrl is a custom variable in general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine. But when I enable devMode it gives a template error 'craft variable unknown'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also get other template errors such as variable 'entry' unknown but I don't have a variable called entry in that template. These errors happen in my _layout template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Weird thing is that with devMode false everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm on mobile now but can post detailed code tomorrow if necessary.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2014-11-11T19:44:21.440" Title="Dev mode giving multiple errors but everything works" Tags="&lt;devmode&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4591" PostTypeId="1" AcceptedAnswerId="4594" CreationDate="2014-11-05T21:59:51.600" Score="2" ViewCount="3445" Body="&lt;p&gt;I'm having trouble redirecting HTTP to HTTPS with a self assigned SSL certificate generated by MAMP PRO using the following code in my .htaccess:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteCond %{HTTPS} !on&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteCond %{HTTPS} off&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried the &lt;a href=&quot;https://github.com/selvinortiz/craft.patrol&quot; rel=&quot;nofollow&quot;&gt;patrol&lt;/a&gt; plugin for Craft, enabling/disabling dev mode and included  &lt;code&gt;'enableCsrfProtection' =&amp;gt; true,&lt;/code&gt; in my &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the .htaccess &lt;a href=&quot;http://buildwithcraft.com/help/force-ssl&quot; rel=&quot;nofollow&quot;&gt;provided by Craft&lt;/a&gt; doesn't work for me.&lt;/p&gt;&#xA;" OwnerUserId="970" LastActivityDate="2017-10-19T14:41:08.767" Title="How can I redirect HTTP to HTTPS with a local self assigned SSL certificate in my .htaccess?" Tags="&lt;htaccess&gt;&lt;https&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4592" PostTypeId="2" ParentId="4577" CreationDate="2014-11-05T22:36:35.937" Score="1" Body="&lt;p&gt;I think we've just found a workaround for this in the upcoming 2.3 release. :)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-05T22:36:35.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4593" PostTypeId="2" ParentId="4589" CreationDate="2014-11-05T23:16:50.777" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;One of the things Dev Mode does&lt;/a&gt; is put Twig into a strict mode where it will throw an error any time a variable is referenced that isn’t defined. So that explains why you’re only getting these errors when Dev Mode is enabled. The errors should also show the part of your template code where the error occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are certain that this is a bug, please send in a ticket from your Dashboard, including your DB backup and template files, so we can look into it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-05T23:16:50.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4594" PostTypeId="2" ParentId="4591" CreationDate="2014-11-05T23:19:07.843" Score="4" Body="&lt;p&gt;The condition should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTPS} !=on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(You were missing the &lt;code&gt;=&lt;/code&gt; sign.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, see our help article, &lt;a href=&quot;http://buildwithcraft.com/help/force-ssl&quot; rel=&quot;nofollow&quot;&gt;How do I force SSL for CP requests?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-05T23:19:07.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4595" PostTypeId="2" ParentId="4572" CreationDate="2014-11-05T23:29:28.817" Score="4" Body="&lt;p&gt;Yii’s &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CUploadedFile&quot; rel=&quot;nofollow&quot;&gt;CUploadedFile&lt;/a&gt; class actually doesn’t support retrieving uploaded files that came from a file input whose name was “namespaced” (e.g. &lt;code&gt;name=&quot;fields[handle]&quot;&lt;/code&gt; rather than just &lt;code&gt;name=&quot;handle&quot;&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Craft has its own &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/UploadedFile&quot; rel=&quot;nofollow&quot;&gt;UploadedFile&lt;/a&gt; class which extends CUploadedFile, and the whole point of it is to add that namespaced input name support. It uses a dot syntax rather than square brackets, so if a file input had the name &lt;code&gt;fields[handle]&lt;/code&gt;, you would fetch that file like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$file = UploadedFile::getInstanceByName('fields.handle');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Problem is, you can’t actually rely on the file input name having a &lt;code&gt;fields&lt;/code&gt; namespace – it will vary depending on the form. In fact many element forms within Craft have randomized namespaces (e.g. the Quick Post dashboard widget, or the modal windows that come up when you double-click on an element within a relational field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That’s why field types have a &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/BaseFieldType#getContentPostLocation-detail&quot; rel=&quot;nofollow&quot;&gt;getContentPostLocation()&lt;/a&gt; method, which returns the input name that would have been used for the current field, namespace and all, converted into dot syntax. So you can plug that value directly into getInstanceByName() and get your uploaded file.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$contentPostLocation = $this-&amp;gt;getContentPostLocation();&#xA;&#xA;if ($contentPostLocation)&#xA;{&#xA;    $file = UploadedFile::getInstanceByName($contentPostLocation);&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-05T23:29:28.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4596" PostTypeId="1" CreationDate="2014-11-06T02:41:38.187" Score="1" ViewCount="339" Body="&lt;p&gt;So I've been breaking my head trying to figure this out. I'm working on a contact form plugin. Basically I'm coping exact same code craft uses to create form &quot;fields&quot;. I have validation working like it should. And I have 2 required fields that should return error messages. But when I try to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;  'field' =&amp;gt; $field&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the template file {{ field }}, I get.. &lt;code&gt;Variable &quot;field&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get the value to populate on the form nor display the errors because of this. Anyone had problems like this before? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my files:&#xA;&lt;a href=&quot;https://gist.github.com/owldesign/e01b49fdb1da3ef23ef2&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/owldesign/e01b49fdb1da3ef23ef2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for weird file delivery.. this comment won't let me post more than 2 links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if you guys need more from me?&#xA;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Repo &lt;a href=&quot;https://github.com/owldesign/FormBuilder&quot; rel=&quot;nofollow&quot;&gt;https://github.com/owldesign/FormBuilder&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="971" LastEditorUserId="125" LastEditDate="2014-11-06T09:12:51.080" LastActivityDate="2014-12-04T04:33:26.083" Title="setRouteVariables doesn't return errors to the template" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4597" PostTypeId="1" AcceptedAnswerId="4601" CreationDate="2014-11-06T02:50:41.537" Score="1" ViewCount="404" Body="&lt;p&gt;Is there a way in Craft to filter assets by an associated category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In asset settings, one of our asset sources has been given a category field, and those assets have been given a category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie; asset source &quot;documentLibrary&quot; has category field &quot;documentType&quot;&#xA;and asset &quot;documentOne&quot; has documentType &quot;sitePlan&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the following variations below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.assets({documentType: &quot;sitePlan&quot;})&#xA;craft.assets({documentType: &quot;contains, sitePlan&quot;})&#xA;craft.assets({documentType: &quot;LIKE '%sitePlan%'&quot;})&#xA;craft.assets({documentType: array('sitePlan')})&#xA;craft.assets({count(documentType): '&amp;gt; 0'})&#xA;craft.assets({relatesTo: &quot;sitePlan&quot;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="972" LastEditorUserId="125" LastEditDate="2014-11-06T08:51:51.593" LastActivityDate="2014-11-06T08:51:51.593" Title="Filter assets by a single category?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4600" PostTypeId="1" CreationDate="2014-11-06T08:35:22.460" Score="5" ViewCount="1209" Body="&lt;p&gt;I have two entry-types, 'Events' and 'Reports'. 'Events' have a matrix-field ('eventMultiDate') that allows authors to assign multiple dates to an event (recurring). 'Reports' have the default 'postDate' field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to return entries from both entry-types combined in a single array, ordered by their corresponding date-fields. As 'Events' may occur on more than one date, one single 'Event' may be displayed more than once in that array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with a possible solution, but would like to know if there is a simpler way to achieve this making better use of the craft API?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;  /**&#xA;   * As 'events' may occur on multiple dates and have to be displayed along with 'reports' they have to queried via this method.&#xA;   */&#xA;  public function queryEvents(\DateTime $dateFrom, \DateTime $dateTo) {&#xA;    /*&#xA;     *  create a 'event'-criteria to build the report query&#xA;     */&#xA;    // create a ECM for element-type 'Entry'&#xA;    $eventsCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;    // create a DBCommand object from ECM&#xA;    $eventsDbCommand = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($eventsCriteria);&#xA;&#xA;    // alter select part to only return the elements ID (alias id) + the corresponding date (alias eventDate)&#xA;    $eventsDbCommand-&amp;gt;select(array('elements.id AS id', 'matrixcontent_eventdate.field_multiDate_date AS eventDate'));&#xA;&#xA;    // add section handle with placeholder 'sectionsHandle1'&#xA;    $eventsDbCommand-&amp;gt;andWhere('sections.handle = :sectionsHandle1');&#xA;&#xA;    // filter the matrix-eventdate-field by current locale, too&#xA;    $eventsDbCommand-&amp;gt;andWhere('matrixcontent_eventdate.locale = :locale');&#xA;&#xA;    // add filter on from/to dates for matrix-column field_multidate_date to query&#xA;    $eventsDbCommand-&amp;gt;andWhere('matrixcontent_eventdate.field_multiDate_date &amp;gt;= :dateFrom');&#xA;    $eventsDbCommand-&amp;gt;andWhere('matrixcontent_eventdate.field_multiDate_date &amp;lt; :dateTo');&#xA;&#xA;    // join the matrixblocks + matrixcontent_eventdate tables&#xA;    $eventsDbCommand-&amp;gt;join('matrixblocks matrixblocks', 'entries.id = matrixblocks.ownerId');&#xA;    $eventsDbCommand-&amp;gt;join('matrixcontent_eventdate matrixcontent_eventdate', 'matrixblocks.id = matrixcontent_eventdate.elementId');&#xA;&#xA;    // group by element ID + the eventdates elementId to remove duplicates&#xA;    $eventsDbCommand-&amp;gt;group(array('elements.id', 'matrixcontent_eventdate.elementId'));&#xA;&#xA;    // get the resulting SQL-String&#xA;    $eventsSql = $eventsDbCommand-&amp;gt;getText();&#xA;&#xA;    /*&#xA;     *  create a 'report'-criteria to build the report query&#xA;     */&#xA;    // create a ECM for element-type 'Entry'&#xA;    $reportsCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;    // create a DBCommand object from ECM&#xA;    $reportsDbCommand = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($reportsCriteria);&#xA;&#xA;    // alter select part to only return the elements ID (alias id) + the corresponding date (alias eventDate)&#xA;    $reportsDbCommand-&amp;gt;select(array('elements.id AS id', 'entries.postDate AS eventDate'));&#xA;&#xA;    // add section handle with placeholder 'sectionsHandle2'&#xA;    $reportsDbCommand-&amp;gt;andWhere('sections.handle = :sectionsHandle2');&#xA;&#xA;    // add filter on from/to dates for postDate column to query&#xA;    $reportsDbCommand-&amp;gt;andWhere('entries.postDate &amp;gt;= :dateFrom');&#xA;    $reportsDbCommand-&amp;gt;andWhere('entries.postDate &amp;lt; :dateTo');&#xA;&#xA;    // group by element ID&#xA;    $reportsDbCommand-&amp;gt;group(array('elements.id'));&#xA;&#xA;    // get the resulting SQL-String&#xA;    $reportsSql = $reportsDbCommand-&amp;gt;getText();&#xA;&#xA;    /*&#xA;     * Create a new DbCommand to union these two together and order in descending order by the eventdate&#xA;     */&#xA;    // convert incoming \DateTime parameters to Craft::DateTime instances&#xA;    $dateTimeFrom = new DateTime('@'.$dateFrom-&amp;gt;getTimestamp());&#xA;    $dateTimeTo = new DateTime('@'.$dateTo-&amp;gt;getTimestamp());&#xA;&#xA;    $unionCommand = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;    $unionCommand&#xA;      -&amp;gt;setText('SELECT id, eventDate FROM (' . $eventsSql . ' UNION ALL ' . $reportsSql . ') e ORDER BY eventDate DESC')&#xA;      -&amp;gt;bindValue(':locale', $eventsCriteria-&amp;gt;locale)&#xA;      -&amp;gt;bindValue(':sectionsHandle1', 'events')&#xA;      -&amp;gt;bindValue(':sectionsHandle2', 'reports')&#xA;      -&amp;gt;bindValue(':dateTo', $dateTimeTo-&amp;gt;mySqlDateTime())&#xA;      -&amp;gt;bindValue(':dateFrom', $dateTimeFrom-&amp;gt;mySqlDateTime());&#xA;&#xA;    $results = $unionCommand-&amp;gt;queryAll();&#xA;&#xA;    $resultingEntries = array();&#xA;&#xA;    foreach ($results as $result) {&#xA;      $resultingEntries[] = array(&#xA;        'id' =&amp;gt; $result['id'],&#xA;        'eventDate' =&amp;gt; DateTime::createFromFormat(DateTime::MYSQL_DATETIME, $result['eventDate']),&#xA;        'entry' =&amp;gt; craft()-&amp;gt;entries-&amp;gt;getEntryById($result['id'])&#xA;      );&#xA;    }&#xA;&#xA;    return $resultingEntries;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="964" LastEditorUserId="784" LastEditDate="2015-02-23T16:45:26.380" LastActivityDate="2015-04-14T13:44:14.520" Title="How to retrieve entries from two entry-types ordered by different date-fields?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;datetime&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4601" PostTypeId="2" ParentId="4597" CreationDate="2014-11-06T08:42:35.963" Score="2" Body="&lt;p&gt;You first have to get the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;CategoryModel&lt;/a&gt; of that category you want to filter by. Use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slug&lt;/code&gt;&lt;/a&gt; as a parameter and the &lt;code&gt;first()&lt;/code&gt; method to get the first and only category matching that criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This CategoryModel is the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;target element&lt;/a&gt; of your relation. Set your &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#parameters&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.assets&lt;/code&gt;&lt;/a&gt; ElementCriteriaModel using the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter to filter by your category and also set the relation's field name here (not necessary if you don't have other relations set on your assets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really have the need to further filter by an asset source (don't get the assets which match the other criteria but are in a different source folder), you (currently) can only do this by looking up that asset source's ID in the database and filter by that &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#sourceId&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;sourceId&lt;/code&gt;&lt;/a&gt;. Set all &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#parameters&quot; rel=&quot;nofollow&quot;&gt;other parameters&lt;/a&gt; to your needs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = 'sitePlan' %}&#xA;&#xA;{# Get the CategoryModel #}&#xA;{% set category = craft.categories.slug(categorySlug).first() %}&#xA;&#xA;{# Get the assets related to this CategoryModel #}&#xA;{% set assets = craft.assets({&#xA;    relatedTo: {&#xA;        targetElement: category,&#xA;        field: 'documentType',&#xA;    },&#xA;    sourceId: '1',&#xA;    limit: null,&#xA;    order: 'dateUpdated desc',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-06T08:48:14.367" LastActivityDate="2014-11-06T08:48:14.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4602" PostTypeId="2" ParentId="4586" CreationDate="2014-11-06T09:27:49.927" Score="16" Body="&lt;p&gt;You can use the &lt;code&gt;setFlash&lt;/code&gt; function in the &lt;code&gt;userSession&lt;/code&gt; Service like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your Controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash('yourVariable', &quot;Something happened yo!&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template (that the user gets redirected to):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.session.getFlash('yourVariable') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that just run an if-statement to see if the message is set or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;In Craft 3 controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;session-&amp;gt;setFlash('yourVariable', &quot;Something happened yo!&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.app.session.getFlash('yourVariable') %}&#xA;{% if message|length &amp;gt; 0 %}&#xA;    {{message}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastEditorUserId="8838" LastEditDate="2018-10-04T09:53:20.563" LastActivityDate="2018-10-04T09:53:20.563" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4603" PostTypeId="1" AcceptedAnswerId="4927" CreationDate="2014-11-06T10:18:05.910" Score="4" ViewCount="757" Body="&lt;p&gt;Has anyone had success hosting Craft on Heroku? I got it up and running, but can't get file uploads to work. Also image thumbnails don't get generated. I am using Craft PRO and Assets are hosted on Amazon S3. I understand that you can't upload assets to Heroku, I thought using S3 should be sufficient to circumvent that fact.&lt;/p&gt;&#xA;" OwnerUserId="327" LastEditorUserId="327" LastEditDate="2014-11-07T09:18:17.287" LastActivityDate="2014-11-25T11:57:27.490" Title="Hosting Craft on Heroku, problems with Asset uploads and thumbnail generation" Tags="&lt;assets&gt;&lt;server&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4605" PostTypeId="1" AcceptedAnswerId="4618" CreationDate="2014-11-06T11:53:33.540" Score="1" ViewCount="384" Body="&lt;p&gt;Just working with a Matrix field to create a flexible, 2 column layout. The user can choose to add either an Image or Rich Text field, and position them accordingly with the Position Select field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate, one layout might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;| image | image |&#xA;|       |       |&#xA;| text  | text  |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But another might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;| image | text  |&#xA;|       |       |&#xA;| image | text  |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now my solution is to first loop through the Matrix field for each possible position option and group fields depending on their position into arrays. ie: &lt;code&gt;leftContent[]&lt;/code&gt;, &lt;code&gt;rightContent[]&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Printing them out is then simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;col col-6 mobile-full&quot;&amp;gt;&#xA;    {% for row in leftContent %}&#xA;        {% if row.type == 'image' %}&#xA;            &amp;lt;img src=&quot;{{ row.image.first().getUrl() }}&quot; /&amp;gt;&#xA;        {% else %}&#xA;            {{ row.text }}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would certainly make things easier if you could grab fields for x position? I'm aware this is more of a HTML layout issue and should really be left to the template creator to figure out, but just wanted to see if people had come across this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense :)&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="125" LastEditDate="2014-11-06T14:15:42.077" LastActivityDate="2014-11-06T18:36:41.230" Title="Get all fields within Matrix for position?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4606" PostTypeId="1" CreationDate="2014-11-06T12:12:05.667" Score="1" ViewCount="242" Body="&lt;p&gt;A project I've been working on has just 'turned bad' - due to a number of reasons I've removed myself from involvement in the project. Earlier in the year I purchased an upgrade to the Craft license to that site for the Pro version, which I now don't want the client to have access to. I've removed the license.key file from their staging server, but they still have a backup of that file on their local machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;http://buildwithcraft.com/help/license-transferring&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;, if I use that license.key file on another website, the &lt;em&gt;old&lt;/em&gt; client will just get a notification asking them if they want to transfer the license to their website (the one I've stopped working on), which gives me no control over it. Am I stuck with the client just being able to say &quot;I want this license&quot; and there being nothing I can do about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't ownership &amp;amp; domain control of the license sit with the owner of that license rather than the person trying to take it?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2014-11-06T12:20:30.470" LastActivityDate="2014-11-06T12:20:30.470" Title="Craft License Management" Tags="&lt;license&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2014-11-06T17:43:42.620" ContentLicense="CC BY-SA 3.0" />
  <row Id="4607" PostTypeId="1" AcceptedAnswerId="4608" CreationDate="2014-11-06T13:01:11.833" Score="2" ViewCount="320" Body="&lt;p&gt;Is it possible to just assign the ID to the owning side of a relationship rather than querying the DB, loading the record and assigning it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something similar to Doctrines &lt;code&gt;_getReference()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.doctrine-project.org/api/orm/2.1/class-Doctrine.ORM.EntityManager.html#_getReference&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.doctrine-project.org/api/orm/2.1/class-Doctrine.ORM.EntityManager.html#_getReference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/a/9308576/1982031&quot;&gt;https://stackoverflow.com/a/9308576/1982031&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="963" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-11-06T13:19:59.513" Title="Create Model relationship with just an ID rather than full Model?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4608" PostTypeId="2" ParentId="4607" CreationDate="2014-11-06T13:19:59.513" Score="2" Body="&lt;p&gt;I think that's actually the way to do it, assign the id to the owning record:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = new Cocktails_CocktailRecord;&#xA;$record-&amp;gt;authorId = 10;&#xA;$record-&amp;gt;title = &quot;Gin Tonic&quot;;&#xA;$record-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When getting the record from the db, the record is turned into a model, at this point, records and models are only dealing with authorId, not the whole record. Your model will then have to define a getAuthor() method that will get the author user for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAuthor()&#xA;{&#xA;    if ($this-&amp;gt;authorId) {&#xA;        return craft()-&amp;gt;users-&amp;gt;getUserById($this-&amp;gt;authorId);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way your model only loads the relationship when you actually use it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model-&amp;gt;getAuthor();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="164" LastActivityDate="2014-11-06T13:19:59.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4609" PostTypeId="1" AcceptedAnswerId="4613" CreationDate="2014-11-06T14:53:17.920" Score="2" ViewCount="194" Body="&lt;p&gt;We have a CakePHP 2.5 app for which we'll very soon be building a learning centre/knowledge base. Craft is one of the tools we're considering for that due to its apparent suitability for content editors to create longform, mixed content consisting of text, images and videos without ending up with junk HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a couple of reasons, it might be preferable for us to have the learning centre content served as part of the app rather than via Craft at a subdomain, so we'd like to know how we would pull in just the generated HTML Content for the actual article content from Craft for embedding within the app's layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The learning centre will have four categories, each with an unknown number of articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'd need to be able to reference each article, and maybe each category, from within the app as users can be set parts of the learning centre as tasks.&lt;/p&gt;&#xA;" OwnerUserId="975" LastActivityDate="2014-11-06T15:32:31.847" Title="How can Craft-generated Content HTML be accessed via an external PHP app?" Tags="&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4610" PostTypeId="1" AcceptedAnswerId="4616" CreationDate="2014-11-06T14:59:34.393" Score="4" ViewCount="882" Body="&lt;p&gt;I'd like to allow a non-admin user to remove their own account from the front end of my app, without allowing them CP access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm concerned that if I give the user group &lt;code&gt;deleteUser&lt;/code&gt; permissions they will just be able to delete any other non-admin user if they change the values of my forms hidden inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/deleteUser&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/delete/success&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;submit&quot; class=&quot;btn  btn--red&quot;&amp;gt;Delete my account!&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it best that I create a custom controller action to handle this and first check they are only deleting themselves before passing it off to the &lt;code&gt;craft()-&amp;gt;users-&amp;gt;deleteUser()&lt;/code&gt; function? Or is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2021-03-22T10:01:03.820" Title="Allow user to delete their own account from the front end" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4611" PostTypeId="1" CreationDate="2014-11-06T15:07:48.133" Score="1" ViewCount="272" Body="&lt;p&gt;I have implemented a custom field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to register a javascript event handler that is called before my custom field is saved?&lt;/p&gt;&#xA;" OwnerUserId="281" LastActivityDate="2014-11-06T15:07:48.133" Title="Javascript event on save for custom field" Tags="&lt;custom-fieldtype&gt;&lt;custom-field&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4612" PostTypeId="2" ParentId="4611" CreationDate="2014-11-06T15:07:48.133" Score="2" Body="&lt;p&gt;Attach a submit event to the #entry-form element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#entry-form').submit(function(e) {&#xA;    // code run on submit here&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="281" LastActivityDate="2014-11-06T15:07:48.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4613" PostTypeId="2" ParentId="4609" CreationDate="2014-11-06T15:32:31.847" Score="4" Body="&lt;p&gt;Your app can load up Craft using its bootstrap.php file:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$craft = require 'path/to/craft/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That file returns a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;Craft\WebApp&lt;/a&gt; instance. From it, you can access all of Craft’s services, including the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService&quot; rel=&quot;nofollow&quot;&gt;ElementsService&lt;/a&gt; which provides APIs for fetching elements and their content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read through our &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;Working with Elements&lt;/a&gt; guide to get an idea of how those APIs work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a quick example, here’s how you’d get the entries in a section with an ID of &lt;code&gt;1&lt;/code&gt; with a category selected, with an ID of &lt;code&gt;5&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = $craft-&amp;gt;elements-&amp;gt;getCriteria(Craft\ElementType::Entry);&#xA;$criteria-&amp;gt;sectionId = 1;&#xA;$criteria-&amp;gt;relatedTo = array('targetElement' =&amp;gt; 5);&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the HTML for an entry, you could either assemble that in PHP based on the entry’s content fields, but it would probably be easier to just write a &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;template&lt;/a&gt; for it, and have &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#render-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService::render()&lt;/a&gt; render it for you:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$html = $craft-&amp;gt;templates-&amp;gt;render('path/to/templates', array(&#xA;    'entries' =&amp;gt; $entries&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-06T15:32:31.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4614" PostTypeId="5" CreationDate="2014-11-06T16:10:21.473" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-11-06T16:10:21.473" LastActivityDate="2014-11-06T16:10:21.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4615" PostTypeId="4" CreationDate="2014-11-06T16:10:21.473" Score="0" Body="Questions about the Craft CMS license and how it's enforced on both dev-sounding and public domains." OwnerUserId="167" LastEditorUserId="167" LastEditDate="2014-11-06T17:04:25.577" LastActivityDate="2014-11-06T17:04:25.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4616" PostTypeId="2" ParentId="4610" CreationDate="2014-11-06T17:49:49.907" Score="4" Body="&lt;p&gt;I think you hit the nail on the head!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Including the &lt;code&gt;userId&lt;/code&gt; in the front-end form give them the perfect opportunity to delete whoever they want... even just by guessing random IDs. That definitely seems like a huge security risk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you build your own custom controller, you can &lt;strong&gt;&lt;em&gt;guarantee&lt;/em&gt;&lt;/strong&gt; that the current user is the one being deleted.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-06T17:49:49.907" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4617" PostTypeId="2" ParentId="4422" CreationDate="2014-11-06T17:50:15.170" Score="5" Body="&lt;p&gt;Sorry about that guys, this issue has been fixed in Videos 1.0.20:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dukt.net/craft/videos/updates#v1.0.20&quot;&gt;https://dukt.net/craft/videos/updates#v1.0.20&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="164" LastActivityDate="2014-11-06T17:50:15.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4618" PostTypeId="2" ParentId="4605" CreationDate="2014-11-06T18:36:41.230" Score="2" Body="&lt;p&gt;If I'm understanding what you've asked correctly (and there's every chance I'm not – it's been a long day), I've got something similar on one of my sites and I'm using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for faq in entry.faq if faq.column == 'Left' %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ faq.question }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ faq.answer }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for faq in entry.faq if faq.column == 'Right' %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ faq.question }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ faq.answer }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case 'faq' is the Matrix field and 'faq.column' is the Position Select field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are neater ways to do this to avoid the repeated code, but you get the idea.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-06T18:36:41.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4619" PostTypeId="1" AcceptedAnswerId="4620" CreationDate="2014-11-07T00:11:04.260" Score="3" ViewCount="735" Body="&lt;p&gt;Looking at my database today notice this one table is MyISAM and also seems huge relative to all other tables with 147,835 rows.  Is that normal?  Shouldn't all tables be InnoDB?  What would cause one to be MyISAM?&lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2015-12-15T17:54:03.330" Title="craft_searchindex is MyISAM all others InnoDB" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4620" PostTypeId="2" ParentId="4619" CreationDate="2014-11-07T01:50:22.940" Score="2" Body="&lt;p&gt;The &lt;code&gt;searchindex&lt;/code&gt; table &lt;em&gt;has&lt;/em&gt; to be MyISAM because up until &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.6/en/fulltext-restrictions.html&quot; rel=&quot;nofollow&quot;&gt;MySQL 5.6.4&lt;/a&gt;, MyISAM was the only engine that supported full text search indexing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently supports back to &lt;a href=&quot;http://buildwithcraft.com/docs/requirements#server-requirements&quot; rel=&quot;nofollow&quot;&gt;MySQL 5.1&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is normal for that table to be large because it's keeping a record of every searchable thing on your web site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-15T17:54:03.330" LastActivityDate="2015-12-15T17:54:03.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4621" PostTypeId="1" AcceptedAnswerId="4622" CreationDate="2014-11-07T02:06:39.913" Score="2" ViewCount="120" Body="&lt;p&gt;I am running Craft Pro 2.2.2601. When I submit an entry, I am getting back JSON rather than being redirected to a success page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I just go to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/admin/entries/pages/new&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I fill out some fields and click &lt;code&gt;Save&lt;/code&gt;. It kicks me to the next page that displays JSON as the source as opposed to an &quot;Entry saved&quot; flash message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;success&quot;:true,&quot;title&quot;:&quot;Services&quot;,&quot;cpEditUrl&quot;:&quot;http:\/\/www.test123.com\/admin\/entries\/pages\/22-services&quot;,&quot;author&quot;:{&quot;id&quot;:&quot;1&quot;,&quot;enabled&quot;:&quot;1&quot;,&quot;archived&quot;:&quot;0&quot;,&quot;locale&quot;:&quot;en_us&quot;,&quot;localeEnabled&quot;:true,&quot;slug&quot;:null,&quot;uri&quot;:null,&quot;dateCreated&quot;:{&quot;date&quot;:&quot;2014-11-04 15:44:04&quot;,&quot;timezone_type&quot;:1,&quot;timezone&quot;:&quot;+00:00&quot;},&quot;dateUpdated&quot;:{&quot;date&quot;:&quot;2014-11-04 15:44:04&quot;,&quot;timezone_type&quot;:1,&quot;timezone&quot;:&quot;+00:00&quot;},&quot;root&quot;:null,&quot;lft&quot;:null,&quot;rgt&quot;:null,&quot;level&quot;:null,&quot;username&quot;:&quot;test123&quot;,&quot;photo&quot;:null,&quot;firstName&quot;:null,&quot;lastName&quot;:null,&quot;email&quot;:&quot;test123@gmail.com&quot;,&quot;preferredLocale&quot;:null,&quot;admin&quot;:&quot;1&quot;,&quot;client&quot;:&quot;0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;lastLoginDate&quot;:{&quot;date&quot;:&quot;2014-11-07 02:01:58&quot;,&quot;timezone_type&quot;:1,&quot;timezone&quot;:&quot;+00:00&quot;},&quot;invalidLoginCount&quot;:null,&quot;lastInvalidLoginDate&quot;:null,&quot;lockoutDate&quot;:null,&quot;passwordResetRequired&quot;:&quot;0&quot;,&quot;lastPasswordChangeDate&quot;:{&quot;date&quot;:&quot;2014-11-04 15:44:04&quot;,&quot;timezone_type&quot;:1,&quot;timezone&quot;:&quot;+00:00&quot;},&quot;unverifiedEmail&quot;:null,&quot;newPassword&quot;:null,&quot;currentPassword&quot;:null,&quot;verificationCodeIssuedDate&quot;:null},&quot;postDate&quot;:&quot;11\/6\/2014&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The page also contains the posted data, so refreshing re-submits the form post. I have disabled JS compression and it worked once (got the &quot;Entry saved&quot; flash message), but now it is back to spitting out JSON.&lt;/p&gt;&#xA;" OwnerUserId="734" LastEditorUserId="734" LastEditDate="2014-11-07T02:24:49.300" LastActivityDate="2014-11-07T02:24:49.300" Title="JSON response displayed as plain text on submission when creating/editing an entry" Tags="&lt;debugging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4622" PostTypeId="2" ParentId="4621" CreationDate="2014-11-07T02:11:28.683" Score="2" Body="&lt;p&gt;I'm guessing you're on MediaTemple?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/forms-returning-json&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/forms-returning-json&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-07T02:11:28.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4623" PostTypeId="2" ParentId="2959" CreationDate="2014-11-07T07:22:50.850" Score="1" Body="&lt;p&gt;You could use Matrix and have one Block Type with an entries field for each of your locales.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-07T09:00:30.477" LastActivityDate="2014-12-07T09:00:30.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4624" PostTypeId="1" CreationDate="2014-11-07T08:45:37.567" Score="2" ViewCount="4770" Body="&lt;p&gt;I have a simple plugin that's expected POST data from a form:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;&amp;quot; accept-charset=&amp;quot;UTF-8&amp;quot;&amp;gt;&#xA;    &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;action&amp;quot; value=&amp;quot;{{ actionUrl('broadbean/jobs/new') }}&amp;quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I submit the form, that fails:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Page Not Found&lt;/p&gt;&#xA;&lt;p&gt;Unable to resolve the request &amp;quot;http:/craft.dev/index.php/admin/actions/broadbean/jobs/new&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If I cut and paste that URL into a new window, I get the plugin response, so what gives here? The plugin is set up to allow anonymous access (but I'm submitting the form from within an admin view anyway).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&lt;/a&gt; I should be able to put the action URL in a hidden field, which I've done. If I dispense with that and instead put the actionUrl() directly in the form's action parameter, everything works.&lt;/p&gt;&#xA;&lt;p&gt;Is this a bug? This is on Craft 2.2.2601.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Controller code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class Broadbean_JobsController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionNew()&#xA;    {    &#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        $result = craft()-&amp;gt;broadbean_jobs-&amp;gt;createJob();&#xA;        &#xA;        var_dump(array(&#xA;            'message' =&amp;gt; ($result['success']) ? Craft::t('Job created.') : Craft::t('Unable to create job.'),&#xA;            'values' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost(),&#xA;            'errors' =&amp;gt; $result['errors']&#xA;        ));&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-11-07T15:47:39.640" Title="Post to an action URL fails, Get works" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="4625" PostTypeId="2" ParentId="4476" CreationDate="2014-11-07T09:50:26.527" Score="1" Body="&lt;p&gt;You'd need to write a separate plugin/template to display custom user data in the control panel - it's not possible to extend the Users page.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-11-07T09:50:26.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4626" PostTypeId="2" ParentId="4624" CreationDate="2014-11-07T10:04:26.503" Score="1" Body="&lt;p&gt;You may need to set up a route using this Hook Reference from the plugin docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function registerCpRoutes()&#xA;    {&#xA;        return array(&#xA;        'cocktails/new'               =&amp;gt; 'cocktails/_edit',&#xA;        'cocktails/(?P&amp;lt;widgetId&amp;gt;\d+)' =&amp;gt; array('action' =&amp;gt; 'cocktails/editCocktail'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2014-11-07T10:04:26.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4627" PostTypeId="2" ParentId="4535" CreationDate="2014-11-07T12:26:50.043" Score="12" Body="&lt;p&gt;In my experience, the &lt;strong&gt;order does matter&lt;/strong&gt;. The array is read in order from top to bottom testing the domain for a match against each criteria (key). If there's a match, that array of settings is used and continues down the list &lt;strong&gt;which can possibly overwrite variables that were previously set&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in this configuration...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Development&#xA;'dev.mywebsite.com' =&amp;gt; array(&#xA;    'database' =&amp;gt; 'dev_mywebsite',&#xA;),&#xA;// Production&#xA;'mywebsite.com' =&amp;gt; array(&#xA;    'database' =&amp;gt; 'prod_mywebsite',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your development site &lt;code&gt;http://dev.mywebsite.com&lt;/code&gt; will be matched &lt;strong&gt;twice&lt;/strong&gt;, once with the full url dev.mywebsite.com and second as a partial match for mywebsite.com. The second match will overwrite the &lt;code&gt;database&lt;/code&gt; setting and your dev site won't load properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot;&gt;Craft documentation example&lt;/a&gt; uses the domain criteria of &lt;code&gt;'.com'&lt;/code&gt; and &lt;code&gt;'.dev'&lt;/code&gt; with &lt;code&gt;'.com'&lt;/code&gt; coming after &lt;code&gt;'.dev'&lt;/code&gt;. That works fine because &lt;code&gt;example.com&lt;/code&gt; will never partially match &lt;code&gt;example.dev&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://craftcookbook.net/recipes/210&quot;&gt;&quot;Foolproof Multi-Environment Config&quot; from Craft Cookbook&lt;/a&gt; works by matching specific server name &lt;code&gt;local.domainname.com&lt;/code&gt; or &lt;code&gt;stage.domainname.com&lt;/code&gt; first and using a the production environment as a fallback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you could use the config order to your advantage and only change settings as they're needed. The &lt;code&gt;'*'&lt;/code&gt; array can be used as a default/fallback environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Default environment: Production&#xA;'*' =&amp;gt; array(&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;    'server'   =&amp;gt; 'localhost',&#xA;    'user'     =&amp;gt; 'xxxxxxxx',&#xA;    'password' =&amp;gt; 'xxxxxxxx',&#xA;    'database' =&amp;gt; 'prod_mywebsite',&#xA;),&#xA;// Development&#xA;'dev.' =&amp;gt; array(&#xA;    'user'     =&amp;gt; 'xxxxxxxx',&#xA;    'password' =&amp;gt; 'xxxxxxxx',&#xA;    'database' =&amp;gt; 'dev_mywebsite',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice this setup doesn't change the &lt;code&gt;server&lt;/code&gt; setting since the dev environment also uses &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I've seen setups where the fallback settings are the Development or Local instead of Production. The advantage there is that your Production&#xA;site data would be protected from errors in your config file. I've actually made a mistake where the staging server domain didn't match the config file and changes from the staging server were happening to the Production database (bad!) because it was the fallback. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example from Focus Lab's EE Master Config for ExpressionEngine:&#xA;&lt;a href=&quot;https://github.com/focuslabllc/ee-master-config/blob/master/config/config.env.php&quot;&gt;https://github.com/focuslabllc/ee-master-config/blob/master/config/config.env.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, the &quot;Foolproof Multi-Environment Config&quot; could probably use the strtolower() function on the 'HTTP_HOST' variable as Bjørn Børresen points out in a commit message in the EE Master Config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch (strtolower($_SERVER['HTTP_HOST']))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;HTTP_HOST should be made lowercase as one cannot guarantee that it always is (most browsers do this, but not all) - in which case the wrong config will be loaded&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="273" LastActivityDate="2014-11-07T12:26:50.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4628" PostTypeId="2" ParentId="4591" CreationDate="2014-11-07T13:50:03.523" Score="1" Body="&lt;p&gt;I fixed this issue by duplicating my host in MAMP PRO without SSL checked, this has to do with the different ports being used for &lt;code&gt;http&lt;/code&gt; and &lt;code&gt;https&lt;/code&gt; by Apache. So I now have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;example.dev&#xA;example.dev with SSL enabled&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http&lt;/code&gt; now redirects to &lt;code&gt;https&lt;/code&gt; using the code from &lt;a href=&quot;http://buildwithcraft.com/help/force-ssl&quot; rel=&quot;nofollow&quot;&gt;How do I force SSL for CP requests&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="970" LastActivityDate="2014-11-07T13:50:03.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4629" PostTypeId="2" ParentId="4624" CreationDate="2014-11-07T15:32:54.050" Score="3" Body="&lt;p&gt;I believe that when you post data using &lt;code&gt;name='action'&lt;/code&gt; from a form that craft automatically uses the &lt;code&gt;actionUrl&lt;/code&gt; to route the request properly, so that if your controller is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/plugins/broadbean/controllers/Broadbean_JobsController.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with a method &lt;code&gt;actionNew&lt;/code&gt;, then craft will create the action route &lt;code&gt;broadbean/jobs/new&lt;/code&gt; automatically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;broadbean/jobs/new&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the other hand if you are linking directly then craft doesn't know to use the action route, so you need to explicitly tell it that this is an action request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl('broadbean/jobs/new', { id: 10 }) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or from javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = Craft.getActionUrl('broadbean/jobs/new', { id: 10 });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you were to call the action externally then you would have to write the full action url without the benefit of using the automatic config routing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/actions/broadbean/jobs/new?id=10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, if the admin had, for example, set up a custom actionUrl in the config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/methods/broadbean/jobs/new?id=10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-07T15:47:39.640" LastActivityDate="2014-11-07T15:47:39.640" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4630" PostTypeId="1" AcceptedAnswerId="4631" CreationDate="2014-11-07T15:42:45.953" Score="1" ViewCount="360" Body="&lt;p&gt;3 sections:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Works&lt;/li&gt;&#xA;&lt;li&gt;Discography&lt;/li&gt;&#xA;&lt;li&gt;Interpretes&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In &quot;Discography&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix block calling entries from &quot;Interpretes&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In &quot;Works&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relational field pulling entries from &quot;Discography&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that Work template I need to display the related entry title from Discography (first part of the code below: working) and the related Interpretes selected in Discography (second part of the code: not working)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This first part displays correctly: #}&#xA;&#xA;{% set relatedRecords = craft.entries.section('contenuDiscographie').relatedTo(entry) %}&#xA;{% for record in relatedRecords %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ record.url }}&quot;&amp;gt;{{ record.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{# And trying to display the related entries from &quot;Interpretes&quot;. That's where I'm stuck: #}&#xA;&#xA;    {% for block in entry.compDiscographie %}&#xA;&#xA;        {% set relatedPerformers = craft.entries.section('interpretes').relatedTo(block) %}&#xA;        {% for performer in relatedPerformers %}&#xA;            {{ performer.title }}&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tried to be as clear as possible...&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="125" LastEditDate="2014-11-07T19:26:33.803" LastActivityDate="2014-11-07T19:26:33.803" Title="How to get related entries from a Matrix block itself related to another section" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4631" PostTypeId="2" ParentId="4630" CreationDate="2014-11-07T19:22:13.567" Score="1" Body="&lt;p&gt;You access the wrong variable to get to you &quot;compDiscographie&quot; Matrix field. It should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in record.compDiscographie %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another thing to change here is to add the &lt;code&gt;type&lt;/code&gt; parameter, as you probably have other Matrix block types in that field (if not, why did you choose Matrix?):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in record.compDiscographie.type('myPerformersBlockTypeName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you should be good. Oh, and you better have that &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; outside your loop!&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-07T19:22:13.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4632" PostTypeId="1" CreationDate="2014-11-07T23:01:17.323" Score="3" ViewCount="192" Body="&lt;p&gt;I am trying to create an easy way to make a sticky post on my blog and I am using an entry field within a global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure where to even start to pull this out in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zH1Rn.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="977" LastEditorUserId="6007" LastEditDate="2019-01-10T20:23:57.360" LastActivityDate="2019-01-10T20:23:57.360" Title="How do you pull a entry field in a global out in a template" Tags="&lt;templating&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4633" PostTypeId="2" ParentId="4632" CreationDate="2014-11-07T23:56:22.907" Score="4" Body="&lt;p&gt;You can access and loop the entrie in any template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in globalSetHandle.entriesFieldHandle %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to change the sort order to show the most recent blog post first use the relatedTo parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.relatedTo(globalSetHandle).order('dateUpdated desc') %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-08T00:25:59.690" LastActivityDate="2014-11-08T00:25:59.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4634" PostTypeId="1" AcceptedAnswerId="36976" CreationDate="2014-11-08T01:30:53.063" Score="6" ViewCount="3687" Body="&lt;p&gt;Has anyone had success with setting up Craft using &lt;a href=&quot;https://www.docker.com/&quot; rel=&quot;noreferrer&quot;&gt;Docker&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've stumbled across some &lt;a href=&quot;https://github.com/eugeneware/docker-wordpress-nginx&quot; rel=&quot;noreferrer&quot;&gt;Dockerfiles for WordPress&lt;/a&gt; and other CMS's but couldn't find much in the way of Craft. I'll be exploring this a bit myself over the next week, but was hoping some people in the community may have a few good pointers or tips or even cautions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To elaborate, I'm looking for alternatives to MAMP as well, or other development environment tools for working with Craft.&lt;/p&gt;&#xA;" OwnerUserId="269" LastActivityDate="2021-01-12T17:58:00.910" Title="Running Craft with Docker (or something similar)" Tags="&lt;environments&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4636" PostTypeId="1" AcceptedAnswerId="4637" CreationDate="2014-11-08T14:22:47.743" Score="2" ViewCount="1055" Body="&lt;p&gt;I have a multi-lingual site with a folder structure set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;/assets&#xA;  -/images&#xA;/nl&#xA;  -index.php&#xA;/fr&#xA;  -index.php&#xA;index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an asset source set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;File system path: assets/images/&#xA;File URL: http://krycer.be/assets/images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This allows me to upload images without any problems and they are uploaded in the correct folder on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use image transforms in my templates by using the &lt;code&gt;{{ asset.getUrl('imageTransformHandle') }}&lt;/code&gt; but this gives me errors. The images are not generated (there is no redirect to the generated image, the URL is linking to the cpResources/transform/ID).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try this code in devMode &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true&lt;/code&gt; it gives me an error that it cannot find the file (allthough it is definitely on the server).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tracked this issue back to the fact that I have sub folders for my languages (nl/fr) and probably the image transform module searches a path from the local index.php file.&#xA;So when I adjust the asset source to &lt;code&gt;../assets/images/&lt;/code&gt; the transforms are generated and I can see the images.&#xA;But then I have the problem that I can no longer upload any images because the path is not correct (because the asset source is probably looking in relation to the top index.php file, being the one above the nl/fr folders).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I fix this and is this a bug or is there an easy idea behind it I do not grasp?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2014-11-08T14:55:36.983" Title="Image Transform path issue" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4637" PostTypeId="2" ParentId="4636" CreationDate="2014-11-08T14:55:36.983" Score="3" Body="&lt;p&gt;The file system path has to be an absolute path from the root of your filesystem, like /Users/myuser/webserver/myproject/public/assets/images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For portability between different environments, it's a good idea to make an environment variable that holds the path to your project, which you can then use in the assets file system path. This is described very nicely in the &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;&quot;Environment-Specific Variables&quot; section of the &quot;Multi-Environment Config&quot; part of the docs&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-11-08T14:55:36.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4638" PostTypeId="1" CreationDate="2014-11-08T22:10:38.803" Score="1" ViewCount="410" Body="&lt;p&gt;I have more than 1000 images that I want to upload on Craft. Is there any way to bulk upload all the images and automatically create one entry for each one of them? Including their fields, like categories and tags?&lt;/p&gt;&#xA;" OwnerUserId="296" LastActivityDate="2014-11-09T08:26:24.157" Title="How to upload several images &amp; automatically create an entry for each one?" Tags="&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4639" PostTypeId="1" AcceptedAnswerId="4640" CreationDate="2014-11-08T22:26:09.507" Score="2" ViewCount="279" Body="&lt;p&gt;I get an error when trying to access CP/Settings/Plugins: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fatal error: Class 'Craft\PluginVariable' not found in folderpath/craft/app/variables/PluginsVariable.php on line 47&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2014-11-09T00:28:31.587" Title="Plugins page inside CP Settings not working" Tags="&lt;plugins&gt;&lt;error-message&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4640" PostTypeId="2" ParentId="4639" CreationDate="2014-11-09T00:28:31.587" Score="4" Body="&lt;p&gt;Sounds like an FTP upload or an unzipping operation didn't finish properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try downloading a fresh copy of Craft from &lt;a href=&quot;http://buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com&lt;/a&gt; and replacing the old &lt;code&gt;craft/app&lt;/code&gt; folder with the new one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-09T00:28:31.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4641" PostTypeId="1" AcceptedAnswerId="4642" CreationDate="2014-11-09T06:01:20.230" Score="2" ViewCount="190" Body="&lt;p&gt;For arguments sake let's say I wanted a plugin that is a basic output: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php echo '&amp;lt;p&amp;gt;Hello World&amp;lt;/p&amp;gt;'; ?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all I am wanting to output is that, and I want that output to be available via twig (ie: {{ helloworld }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not passing any information, not doing anything with the craft database, etc. Just very basic. &lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2014-11-09T08:24:36.867" Title="Is there a very very basic example of simply outputting PHP with a plugin to Twig?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4642" PostTypeId="2" ParentId="4641" CreationDate="2014-11-09T07:24:36.757" Score="8" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;plugin template variables&lt;/a&gt;. You can simply create a method in your plugins variable file that returns anything you want to the template, which would be accessible via &lt;code&gt;{{ craft.myplugin.customVariable }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MypluginVariable&#xA;{&#xA;    public function customVariable($someProperty = 'defaultValueIfNotDefined')&#xA;    {&#xA;        return 'Whatever you want!';&#xA;    };&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-09T08:24:36.867" LastActivityDate="2014-11-09T08:24:36.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4643" PostTypeId="2" ParentId="4638" CreationDate="2014-11-09T07:47:07.500" Score="3" Body="&lt;p&gt;I was going to suggest using the very handy &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import plugin&lt;/a&gt;, but I see that it only supports entries, categories, and users. And unfortunately, I don't see another plugin that does this specifically. But have a look at the &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;craft plugins page&lt;/a&gt; in case I missed something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also be able to extend the &lt;code&gt;Import&lt;/code&gt; plugin (with permission of course) to support assets. I would guess that it would be a similar process. This could potentially allow you to create a CSV file and import it... then upload the images into the location defined in your csv.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-09T08:26:24.157" LastActivityDate="2014-11-09T08:26:24.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4644" PostTypeId="1" AcceptedAnswerId="4645" CreationDate="2014-11-09T19:46:44.917" Score="0" ViewCount="151" Body="&lt;p&gt;I'm building a feed of entries mixed from different sections. One section contains a postDate and a custom field date called releaseDate. I want these entries to appear in the feed with their postDate, but when the releaseDate is equivalent to &lt;code&gt;now&lt;/code&gt; I want the entry to return in the feed in order of appearance. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(['section1', 'section2']).order(['postDate DESC', 'releaseDate DESC'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="970" LastActivityDate="2014-11-09T23:05:20.683" Title="Is there a way of displaying an entry twice depending on postDate and a custom field date in one loop?" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;custom-field&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4645" PostTypeId="2" ParentId="4644" CreationDate="2014-11-09T21:22:50.730" Score="2" Body="&lt;p&gt;You could probably do this purely from Twig / a template, but I think it's going to end up being much easier from a plugin / PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general gist of it would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Grab all entries from section 1 ordered by postDate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Grab all entries from section 2 ordered by releaseDate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new array and loop through 1 and 2 inserting via your custom sorting logic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Return that new sorted array back to the template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-09T21:22:50.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4646" PostTypeId="2" ParentId="4644" CreationDate="2014-11-09T23:05:20.683" Score="1" Body="&lt;p&gt;As an alternative, you could also simply create the first entry as usual, setting the post date to the post date. Then use a plugin like &lt;a href=&quot;https://github.com/am-impact/amcommand&quot; rel=&quot;nofollow&quot;&gt;AM Command&lt;/a&gt; to duplicate the entry, add 'is out now!' to the title, alter any other content as needed, and set the post date to the release date. This would give you a lot more flexibility regarding title and content, etc., and without the need for a custom plugin. The game entry itself could even be in an entirely separate channel and pulled into any news related to it via a related entries field. This would allow you to create other news events as well, such as 'release delayed!', etc.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-09T23:05:20.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4647" PostTypeId="1" CreationDate="2014-11-10T00:01:38.353" Score="0" ViewCount="527" Body="&lt;p&gt;Im only recently noticed that sites with devMode turned on add some helpful information about queries and other logs into the console. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IqTNr.png&quot; alt=&quot;-11-09%2018.55.38.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but im also noticing that some of our sites that also have devMode turned on locally arent showing the console log information?  I cant seem to figure out what else needs to be on to get this output to show up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;related to this is there anyway to add more grouping to the &quot;logs&quot; group to mirror the exiting log folder (ie. give plugins their own group of logs)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-11-10T01:19:22.517" Title="Javascript console logs in devMode not always showing?" Tags="&lt;devmode&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4648" PostTypeId="2" ParentId="4647" CreationDate="2014-11-10T01:19:22.517" Score="1" Body="&lt;p&gt;All that's required for the logging and profiling information to show up in the browser's console is that &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not showing up then, then either you're enabling it in the wrong place in a multi-environment config or you've got a plugin that's &lt;a href=&quot;https://craftcms.stackexchange.com/a/489/57&quot;&gt;explicitly removing the logging routes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-10T01:19:22.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4649" PostTypeId="2" ParentId="4559" CreationDate="2014-11-10T04:30:06.950" Score="2" Body="&lt;p&gt;A better way to tackle something like this would be to use a matrix instead of just a rich text area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a matrix you can have an image block and then in your template you can pull any info you want from the images custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We normally have at least three block types with a normal matrix, text, image, and gallery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text is just a refactor text block.  Image is an image with a &quot;position&quot; field to control alignment (float left/right/center) the a gallery block which lets you select a series of images which display in a slideshow&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-11-10T04:30:06.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4650" PostTypeId="1" AcceptedAnswerId="4652" CreationDate="2014-11-10T06:37:29.877" Score="8" ViewCount="2746" Body="&lt;p&gt;Do you only have to build the .rss template file and then you use that URL for your RSS feed? Based on the documentation at hand, that's what it seems like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to parse an RSS feed using the Google Feed API (&lt;a href=&quot;https://developers.google.com/feed/&quot;&gt;https://developers.google.com/feed/&lt;/a&gt;) and it's having issues reading the output - so I just want to see if anyone else out there is using RSS in Craft so I can see their output vs mine. When I view mine, it doesn't look like a traditional xml output. &lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2019-03-29T00:15:44.087" Title="Any working RSS feed examples out there?" Tags="&lt;rss&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4651" PostTypeId="2" ParentId="4650" CreationDate="2014-11-10T06:49:02.473" Score="3" Body="&lt;p&gt;I just used {% header %} and changed it to application/xml instead of application/rss+xml and got the result I was expecting. &lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2014-11-10T06:49:02.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4652" PostTypeId="2" ParentId="4650" CreationDate="2014-11-10T09:23:12.713" Score="17" Body="&lt;p&gt;Here's the boilerplate I've been using for RSS feed templates. I just name the file rss.html and call it a day. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes a channel is set up with a description and title field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/rss+xml&quot; %}&#xA;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&#xA;&amp;lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&amp;gt;&#xA;&#xA;{% set rss = craft.entries({ section: 'yourChannel' }) %}&#xA;&#xA;&amp;lt;channel&amp;gt;&#xA;  &amp;lt;title&amp;gt;Title Your RSS Feed&amp;lt;/title&amp;gt;&#xA;  &amp;lt;link&amp;gt;http://www.yourlink.com/&amp;lt;/link&amp;gt;&#xA;  &amp;lt;description&amp;gt;Enter a description here&amp;lt;/description&amp;gt;&#xA;  &amp;lt;language&amp;gt;en-us&amp;lt;/language&amp;gt;&#xA;  &amp;lt;atom:link href=&quot;{{ url() }}&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&amp;gt;&#xA;&#xA;  {% for item in rss %}&#xA;  &amp;lt;item&amp;gt;&#xA;    &amp;lt;title&amp;gt;{{ item.title }}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;link&amp;gt;{{ item.url() }}&amp;lt;/link&amp;gt;&#xA;    &amp;lt;description&amp;gt;{{ item.description }}&amp;lt;/description&amp;gt;&#xA;    &amp;lt;pubDate&amp;gt;{{ item.postDate.rfc2822() }}&amp;lt;/pubDate&amp;gt;&#xA;    &amp;lt;guid&amp;gt;{{ item.url() }}&amp;lt;/guid&amp;gt;&#xA;  &amp;lt;/item&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/channel&amp;gt;&#xA;&#xA;&amp;lt;/rss&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2015-03-13T18:16:20.537" LastActivityDate="2015-03-13T18:16:20.537" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4653" PostTypeId="1" AcceptedAnswerId="4660" CreationDate="2014-11-10T12:06:26.737" Score="6" ViewCount="1529" Body="&lt;p&gt;The problem seem to be that the session file in &lt;code&gt;/craft/storage/runtime/sessions&lt;/code&gt; is getting removed any time I refresh the actual page, so that I have to do a new login everytime I've changed content, looked at the site, and then want to add more content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This i running on Apache, PHP 5.3.29, locally through MAMP on Yosemite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some config setting I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="981" LastEditorUserId="250" LastEditDate="2014-11-10T16:26:32.507" LastActivityDate="2018-07-19T07:30:14.440" Title="Getting logged out of admin area when refreshing site" Tags="&lt;users&gt;&lt;admin&gt;&lt;session&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4654" PostTypeId="1" AcceptedAnswerId="4656" CreationDate="2014-11-10T12:09:29.800" Score="2" ViewCount="1863" Body="&lt;p&gt;is it possible to replicate the order of related entries in the front end as they appear in the admin entries panel? (see images below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, in the front end it only sorts the order in which the entries where originally entered (sorted by entry date &amp;amp; time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not is there any other possibility to do so?&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9WUM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cpB4O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2014-11-20T15:39:29.380" Title="Custom order related entries" Tags="&lt;sorting&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4655" PostTypeId="1" AcceptedAnswerId="4659" CreationDate="2014-11-10T12:26:19.647" Score="4" ViewCount="755" Body="&lt;p&gt;I'm trying to create a multi user blog, where multiple authors can edit the same entry. Is this possible with Craft CMS? Is there a way to assign multiple authors to an entry? I only managed to assign one user as an author.&lt;/p&gt;&#xA;" OwnerUserId="982" LastEditorUserId="250" LastEditDate="2014-11-10T16:27:32.673" LastActivityDate="2016-06-07T11:14:57.523" Title="Can an entry have multiple authors?" Tags="&lt;entry&gt;&lt;author&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4656" PostTypeId="2" ParentId="4654" CreationDate="2014-11-10T12:28:58.883" Score="4" Body="&lt;p&gt;The natural sort order for related entries is the order defined in the control panel (not the post date of the related entries), unless you otherwise specify the sort order. Here is an example taken from one of my projects, where related articles are defined within an entries field-type in an article entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedArticles = entry.relatedArticles %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for article in relatedArticles %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;{{ article.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the backend, craft uses the table &lt;code&gt;craft_relations&lt;/code&gt; to create the relationship with the columns &lt;code&gt;sourceId&lt;/code&gt;, &lt;code&gt;targetId&lt;/code&gt;, and &lt;code&gt;sortOrder&lt;/code&gt;. This &lt;code&gt;sortOrder&lt;/code&gt; column defines the default sort order when accessing related entries through the related 'entries' field-type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand, you are accessing related entries using the &lt;code&gt;.relatedTo()&lt;/code&gt; method of the EntryCriteriaModel then you will need to specify the sort order using &lt;code&gt;.order('sortOrder')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the original code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedRecords = craft.entries.section('contenuDiscographie').relatedTo(entry) %} &#xA;{% for record in relatedRecords %} &#xA;    &amp;lt;a href=&quot;{{ record.url }}&quot;&amp;gt;{{ record.title }}&amp;lt;/a&amp;gt;    &#xA;    {% for block in record.discoArtistes %}    &#xA;        {% set relatedPerformers = craft.entries.section('interpretes').relatedTo(block) %}&#xA;        {% for performer in relatedPerformers %}     &#xA;            {{ performer.title }}&#xA;        {% endfor %}    &#xA;    {% endfor %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try using the actual relationship field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedRecords = entry.myRelatedEntriesFieldHandle %} &#xA;{% for record in relatedRecords %} &#xA;    &amp;lt;a href=&quot;{{ record.url }}&quot;&amp;gt;{{ record.title }}&amp;lt;/a&amp;gt;    &#xA;    {% for block in record.myMatrixBlockFieldHandle %}&#xA;        {% set relatedPerformers = block.myRelatedEntriesFieldHandleInsideMatrixField %}&#xA;        {% for performer in relatedPerformers %}      &#xA;            {{ performer.title }}&#xA;        {% endfor %}    &#xA;    {% endfor %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; I edited the code above to be more generic, rather than trying to guess what the field handles are named in your project. You need to change these to your actual field handles. From the picture above I would guess they might be 'entry.relatedRecords', 'record.discoArtistes', and 'block.nom' for example.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-20T15:39:29.380" LastActivityDate="2014-11-20T15:39:29.380" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4657" PostTypeId="2" ParentId="4654" CreationDate="2014-11-10T12:29:43.290" Score="2" Body="&lt;p&gt;Set the &lt;code&gt;order&lt;/code&gt; parameter to &lt;code&gt;'sortOrder'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(entry).order('sortOrder') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or do simply use the &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields#templating&quot; rel=&quot;nofollow&quot;&gt;short syntax&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry.entriesFieldHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-10T12:29:43.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4658" PostTypeId="2" ParentId="4655" CreationDate="2014-11-10T12:34:59.330" Score="1" Body="&lt;p&gt;As far as I know there can only be one author. You would have to create a &lt;code&gt;user group&lt;/code&gt;, assign the editors/users to the group and then in the group settings, 'authorize users to edit entries in that section', and 'allow users to edit entries by other authors'.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-10T12:34:59.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4659" PostTypeId="2" ParentId="4655" CreationDate="2014-11-10T12:35:09.953" Score="4" Body="&lt;p&gt;No, there can only be one author. But what you can do is to add one or more custom &lt;a href=&quot;http://buildwithcraft.com/docs/users-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;user fields&lt;/a&gt; to your entry type and use these to assign different type of users to your entry (all contributing authors, photographers, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set user privileges like Douglas describes in &lt;a href=&quot;https://craftcms.stackexchange.com/a/4658/125&quot;&gt;his answer&lt;/a&gt;, to allow multiple authors to edit entries in your section.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-10T12:35:09.953" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4660" PostTypeId="2" ParentId="4653" CreationDate="2014-11-10T14:00:53.207" Score="10" Body="&lt;p&gt;The problem was actually Chrome using iOS emulation when viewing the site, thus spoofing the UA string into something different than the usual Chrome UA string when logging into the admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution (as suggested by @craftcms on Twitter) was to set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/config/general.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For whatever environment you are having the issue.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2014-11-10T14:00:53.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4661" PostTypeId="1" AcceptedAnswerId="6573" CreationDate="2014-11-10T14:10:16.370" Score="13" ViewCount="27225" Body="&lt;p&gt;I'm running across a problem developing a site locally using OS X 10.10 and MAMP Pro 3.0.5 with PHP 5.5.10. Accessing both the site front-end and the back-end admin interface is  throwing an error 500 Internal Server Error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MAMP Apache log is showing multiple instances of the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Mon Nov 10 14:03:04 2014] [error] [client 127.0.0.1] FastCGI: comm with server &quot;/Applications/MAMP/fcgi-bin/php5.5.10.fcgi&quot; aborted: idle timeout (30 sec), referer: http://jtp.dev:8888/admin/entries/project&#xA;[Mon Nov 10 14:03:04 2014] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server &quot;/Applications/MAMP/fcgi-bin/php5.5.10.fcgi&quot;, referer: http://jtp.dev:8888/admin/entries/project&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once this happens, I can't continue working until I restart my machine. Restarting my Mac and restarting MAMP fixes the error temporarily, but it eventually reappears and prevents me from being able to view the site locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone got any ideas about what may be causing this?&lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2014-11-10T15:09:01.550" LastActivityDate="2018-03-07T09:02:15.173" Title="FastCGI error when accessing a local development site using MAMP Pro" Tags="&lt;error-message&gt;" AnswerCount="4" CommentCount="5" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4662" PostTypeId="1" AcceptedAnswerId="4665" CreationDate="2014-11-10T14:33:53.580" Score="0" ViewCount="222" Body="&lt;p&gt;Is there any way to add your own site configuration or settings into the admin panels? Either a new icon on admin/settings or maybe a section in admin/settings/general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can create a plugin to do it and I can access it, but I was just wondering if there is an area there already.&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2014-11-11T03:39:00.780" Title="Custom site config" Tags="&lt;config&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4663" PostTypeId="1" AcceptedAnswerId="4664" CreationDate="2014-11-10T15:52:59.870" Score="2" ViewCount="250" Body="&lt;p&gt;Is there a way to allow a registrant to choose a user group in the registration form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using the following code but it didn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userGroups&quot; value=&quot;3&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="970" LastEditorUserId="970" LastEditDate="2014-11-10T16:03:04.503" LastActivityDate="2018-10-03T16:39:32.403" Title="How can I get a user to choose in which group he registers using the User Registration Form" Tags="&lt;users&gt;&lt;form&gt;&lt;user-groups&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4664" PostTypeId="2" ParentId="4663" CreationDate="2014-11-10T16:29:40.070" Score="3" Body="&lt;p&gt;As far as I know there is no way to do this without a plugin. However, developing a plugin for this is not difficult. In your form you would want to add an additional drop-down, multi-select, or checkbox field with your groups listed. Then in your plugin, create a listener in your plugin's init method that listens for the &lt;code&gt;users.saveUser&lt;/code&gt; event, and dynamically assigns the user to the selected groups based on the user's selection. For an example see this post explaining &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4259/is-it-possible-to-tell-if-a-user-was-registered-through-the-front-end-or-cp/4274#4274&quot;&gt;how to respond to an onSaveUser event&lt;/a&gt;, and this post on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4197/restrict-user-editing-permissions-within-a-users-group/4202#4202&quot;&gt;assigning groups dynamically&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-11-10T16:29:40.070" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4665" PostTypeId="2" ParentId="4662" CreationDate="2014-11-10T18:06:39.587" Score="2" Body="&lt;p&gt;We currently don't expose either of the two examples you gave for plugins to extend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest to what you're looking for is the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#methods&quot; rel=&quot;nofollow&quot;&gt;hasCpSection&lt;/a&gt;, which will give your plugin a menu item in the top CP header.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-11T03:39:00.780" LastActivityDate="2014-11-11T03:39:00.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4666" PostTypeId="2" ParentId="4165" CreationDate="2014-11-10T18:43:37.673" Score="2" Body="&lt;p&gt;It's relatively simple to tweak the Contact Form plugin to change the required fields. If you open &lt;code&gt;models/ContactFormModel.php&lt;/code&gt; (in the plugin's folder), you can add &lt;code&gt;'required' =&amp;gt; true,&lt;/code&gt; to the &lt;code&gt;fromName&lt;/code&gt; attribute definition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fromName'   =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true, 'label' =&amp;gt; 'Your Name'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried this out, and it seemed to work as expected.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2014-11-10T18:43:37.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4667" PostTypeId="1" CreationDate="2014-11-10T18:46:35.670" Score="2" ViewCount="1374" Body="&lt;p&gt;I'm working on a plugin that lets you create multiple forms. For each form I have a Field Layout Designer that lets you add fields from the fields groups. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can I display those fields on the front end template..say a contact.html single page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the same way you add fields to entry types and they show up when you are adding an entry... but I would like this to render a form on user facing pages with all the fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have so far: &lt;a href=&quot;http://d.pr/f/1bHCX&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://d.pr/f/1bHCX&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is what I have so far, its getting somewhere, sort of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my front end index.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set form = craft.formBuilder.getFormByHandle('testForm') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get fieldLayout id with &lt;code&gt;{{ form.fieldLayoutId}}&lt;/code&gt; = 69&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And inside content block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for item in form.getFieldLayout() %}&#xA;  {% include &quot;_includes/fields&quot; with {&#xA;    fields: item.getFields(),&#xA;    element: form&#xA;  } only %}&#xA;{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get this error &lt;code&gt;Impossible to invoke a method (&quot;getField&quot;) on a string variable (&quot;69&quot;)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N237N.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So its great that I get fieldLayout id for specified form handle but now I need to figure how to get all the fields related to that fieldLayout. I understand the error message but maybe someone knows how to rewrite that &lt;code&gt;for&lt;/code&gt; statement to get results I need?! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I don't know how to query my db for the fields that belong to layoutId 69..&lt;img src=&quot;https://i.stack.imgur.com/HHEab.png&quot; alt=&quot;craft_fieldlayoutfields&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get fieldId 15 and 16 to render on the front end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fJPKL.png&quot; alt=&quot;craft_fields&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="971" LastEditorUserId="971" LastEditDate="2014-11-11T01:29:07.700" LastActivityDate="2014-12-04T04:29:07.107" Title="How can I display fields from Field Layout Designer in the template?" Tags="&lt;field-layout-designer&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4668" PostTypeId="1" AcceptedAnswerId="4681" CreationDate="2014-11-10T20:11:31.503" Score="3" ViewCount="203" Body="&lt;p&gt;A simple question with hopefully a simple answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make the date picker in the admin area start the week (i.e. each new line) with Mondays rather than Sundays?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure it will just be a configuration issue. I just can't see where to change it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="508" LastActivityDate="2014-12-03T16:03:39.027" Title="Change start of the week in Date Picker" Tags="&lt;config&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4669" PostTypeId="1" AcceptedAnswerId="4670" CreationDate="2014-11-11T01:49:28.447" Score="2" ViewCount="586" Body="&lt;p&gt;When two values are displayed for PHP Info, what does that mean? For example,&lt;img src=&quot;https://i.stack.imgur.com/pXRwR.png&quot; alt=&quot;memory_limit 256M/128M&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the two values?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-20T23:05:48.643" Title="What do the values in /admin/utils/phpinfo mean?" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4670" PostTypeId="2" ParentId="4669" CreationDate="2014-11-11T03:08:58.530" Score="1" Body="&lt;p&gt;It's probably a formatting bug in Craft.  We're parsing the output of a call to &lt;a href=&quot;http://php.net/manual/en/function.phpinfo.php&quot; rel=&quot;nofollow&quot;&gt;phpinfo()&lt;/a&gt;, so one of them is probably coming from the &quot;Local Value&quot; column and the other is coming from the &quot;Master Value&quot; column.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-11T03:08:58.530" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4671" PostTypeId="2" ParentId="952" CreationDate="2014-11-11T04:42:24.043" Score="1" Body="&lt;p&gt;OK I have a definite answer to this issue this time...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is caused because craft fails to write out the session files in /craft/storage/runtime/sessions, if you look in there you will see zero byte files :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue seems to be because of vagrant/virtual box syncing files between the host and my pc. So the trick is to get vagrant not to sync the sessions folder. For me this was not that easy, it seems that if you sync the /craft folder it syncs all subfolders even if you tell it not to (by creating another sync and disabling it). So I had to explicitly state which craft folders to sync - ugh! It works which is great, but I am predicting trouble down the track if craft adds another folder to it's top level structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway here is what I put in my vagrant file to get it work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;config.vm.synced_folder &quot;./public&quot;, &quot;/var/www/public&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/app&quot;, &quot;/var/www/craft/app&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/plugins&quot;, &quot;/var/www/craft/plugins&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/config&quot;, &quot;/var/www/craft/config&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/templates&quot;, &quot;/var/www/craft/templates&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/storage/backups&quot;, &quot;/var/www/craft/storage/backups&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/storage/userphotos&quot;, &quot;/var/www/craft/storage/userphotos&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/storage/runtime/assets&quot;, &quot;/var/www/craft/storage/runtime/assets&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/storage/runtime/cache&quot;, &quot;/var/www/craft/storage/runtime/cache&quot;, :mount_options =&amp;gt; ['dmode=777', 'fmode=777']&#xA;config.vm.synced_folder &quot;./craft/storage/runtime/compiled_templates&quot;, &quot;/var/www/craft/storage/runtime/compiled_templates&quot;, :mount_options =&amp;gt; ['dmode=777', &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'fmode=777']&#xA;    config.vm.synced_folder &quot;./craft/storage/runtime/logs&quot;, &quot;/var/www/craft/storage/runtime/logs&quot;, :mount_options =&gt; ['dmode=777', 'fmode=777']&#xA;    config.vm.synced_folder &quot;./craft/storage/runtime/state&quot;, &quot;/var/www/craft/storage/runtime/state&quot;, :mount_options =&gt; ['dmode=777', 'fmode=777']&#xA;    config.vm.synced_folder &quot;./craft/storage/runtime/temp&quot;, &quot;/var/www/craft/storage/runtime/temp&quot;, :mount_options =&gt; ['dmode=777', 'fmode=777']&lt;/p&gt;&#xA;" OwnerUserId="760" LastActivityDate="2014-11-11T04:42:24.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4672" PostTypeId="2" ParentId="4165" CreationDate="2014-11-11T10:33:52.797" Score="3" Body="&lt;p&gt;You could also hand this over to HTML since it &lt;a href=&quot;http://diveintohtml5.info/forms.html#required&quot; rel=&quot;nofollow&quot;&gt;supports form validation&lt;/a&gt; as of version 5.&#xA;Depends on your browser support requirements though. &lt;a href=&quot;http://caniuse.com/#search=required&quot; rel=&quot;nofollow&quot;&gt;This is what “Can i use” says.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2014-11-11T10:33:52.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4673" PostTypeId="1" AcceptedAnswerId="4675" CreationDate="2014-11-11T10:40:10.743" Score="4" ViewCount="462" Body="&lt;p&gt;I have a one-level structure where I am storing a client's projects, with the ability to reorder them by dragging the entries in the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each project has been designed to have multiple subpages of information available, accessible by clicking on tabs, where each tabbed view shows a subset of the project data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, each tab would have its own URL so I can deep-link to the subpages, each served by a different template, but load in the views via ajax when a tab is clicked on. Is it possible to derive multiple child views with distinct templates from a single entry, without having to manually add child tab entries for every project, which I definitely don't want to make the client do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative would be to load in all the tabs on initial page load, and show and hide them as they're clicked on, and use pushstate to deep link to those tabs, but I'd rather have them as proper server side URLs, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if this is possible?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-11-11T16:47:32.753" Title="Is there a way to divide an entry's data into multiple subviews with unique URLs?" Tags="&lt;structure&gt;&lt;ajax&gt;&lt;children&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4674" PostTypeId="1" CreationDate="2014-11-11T11:55:07.697" Score="5" ViewCount="713" Body="&lt;p&gt;I have two seperate clients on different domains but I'm developing very similar websites for each. If I duplicate the entire site and upload to new domain what is the best way of handling the license key for the duplicated site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming if I transfer the license, using the control panel message, then the other website's license will break.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(edit: I want to pay for the license on the duplicated system without losing any data.)&lt;/p&gt;&#xA;" OwnerUserId="650" LastEditorUserId="650" LastEditDate="2014-11-11T13:34:25.413" LastActivityDate="2014-11-11T18:53:54.317" Title="How to handle license when duplicating entire website" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4675" PostTypeId="2" ParentId="4673" CreationDate="2014-11-11T12:30:57.480" Score="4" Body="&lt;p&gt;Disclaimer: I haven't ever used structure, but hopefully the method described below also works for that section type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this quite easily with URL-segments&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a URL like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.domain.com/section/entry/&#xA;&#xA;http://www.domain.com/section/entry/subview-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section/entry route will hit your entry template, but you can create a new route&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;section/{slug}/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And point it to your subview template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There, you ask craft for whatever is in URL segment 3 like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getSegment(3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And display content based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the entry you are on currently, just filter on segment 2 like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('section').slug(craft.request.getSegment(2)) %}&#xA;    {{ entry }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="981" LastActivityDate="2014-11-11T12:30:57.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4676" PostTypeId="1" AcceptedAnswerId="4679" CreationDate="2014-11-11T12:51:42.790" Score="6" ViewCount="541" Body="&lt;p&gt;I'm curious if others are seeing a similar error in their Craft logs.  It says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Buggy iconv installed.  Will fallback to mbstring.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's repeated over and over seemingly with almost every request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a pretty simple server, setup using the default setting from Laravel Forge on Digital Ocean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to fix it?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="340" LastEditDate="2017-05-29T00:54:33.853" LastActivityDate="2017-05-29T00:54:33.853" Title="Craft.log showing Buggy iconv installed. Will fallback to mbstring" Tags="&lt;string&gt;&lt;conversion&gt;&lt;requirements&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4677" PostTypeId="2" ParentId="4674" CreationDate="2014-11-11T13:48:07.540" Score="5" Body="&lt;p&gt;I think it would be enough to delete the license.key file under&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/config&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and purchase a new license. The key file will be re-generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more info in this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1844/how-to-replicate-a-craft-installation-as-a-starting-point?rq=1&quot;&gt;answer&lt;/a&gt;, and here is how Craft decides if it is running on a &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow&quot;&gt;public domain&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastEditorUserId="981" LastEditDate="2014-11-11T18:53:54.317" LastActivityDate="2014-11-11T18:53:54.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4678" PostTypeId="2" ParentId="4673" CreationDate="2014-11-11T15:34:53.340" Score="2" Body="&lt;p&gt;In addition to using the url segments as megatrond suggested. You can also define 'Entry Types', and use &lt;code&gt;if..then&lt;/code&gt; conditionals or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot; rel=&quot;nofollow&quot;&gt;switch&lt;/a&gt; statements in your template to modify the layout or include different sub-templates, as required.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'project' %}&#xA;    {% include '/projects/_tabbed-entry' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore you can use &lt;code&gt;levels&lt;/code&gt; and other heirarchy tools (&lt;code&gt;descendants&lt;/code&gt;, &lt;code&gt;ancestors&lt;/code&gt;, &lt;code&gt;parent&lt;/code&gt;, etc)  to dynamically &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow&quot;&gt;construct navigation&lt;/a&gt; and/or tabs, such that, for example, the top 2 or 3 levels can be used for your primary navigation, and subsequent levels can be used to construct tabs or sub-nav on the page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# build primary nav #}&#xA;{% set navEntries = craft.entries.section('pages').level('&amp;lt;= 2') %}&#xA;&amp;lt;ul class=&quot;nav__level1&quot;&amp;gt;&#xA;    {% nav entry in navEntries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;span&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul class=&quot;nav__level{{ entry.level + 1 }}&quot;&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for tabs (which works equally well for subnav):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# build tabs #}&#xA;{% set tabEntries = entry.parent.descendants(1) %}&#xA;&amp;lt;ul class=&quot;tabs&quot;&amp;gt;&#xA;    {% for tabEntry in tabEntries %}&#xA;        &amp;lt;li class=&quot;tab&quot; &amp;gt;&#xA;            &amp;lt;a href=&quot;{{ tabEntry.url }}&quot; {% if tabEntry.id == entry.id %}class=&quot;selected&quot;{% endif %} &amp;gt;{{ tabEntry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;page-content&quot;&amp;gt;&#xA;    {{ entry.body }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The examples above will link to each sub-page/tab as a unique url. However, if you want to load the tab content via ajax then you can specify which part of the template is returned in the ajax request, using &lt;code&gt;craft.request.isAjax&lt;/code&gt;. This would allow you to essentially load the template into itself if you wanted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;    {# return only the content #}&#xA;{% else %}&#xA;    {# return the full page with header, nav, content, etc. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-11T16:47:32.753" LastActivityDate="2014-11-11T16:47:32.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4679" PostTypeId="2" ParentId="4676" CreationDate="2014-11-11T16:55:04.517" Score="5" Body="&lt;p&gt;Iconv is a system C library that converts string encodings, and is generally preferable to PHP’s &lt;a href=&quot;http://php.net/manual/en/function.mb-convert-encoding.php&quot; rel=&quot;nofollow&quot;&gt;mb_convert_encoding()&lt;/a&gt; because it supports significantly more character encodings. However it’s not guaranteed that it will be available, and if it is, some versions of it have a bug that could put it into an infinite loop in certain circumstances. So Craft’s &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/StringHelper#convertToUTF8-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper::convertToUTF8()&lt;/a&gt; checks for those things before using it, and logs if it’s not available or a buggy version is installed, before falling back on mb_convert_encoding().&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-11-11T22:54:14.833" LastActivityDate="2014-11-11T22:54:14.833" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4680" PostTypeId="1" AcceptedAnswerId="4682" CreationDate="2014-11-11T17:02:33.117" Score="2" ViewCount="1102" Body="&lt;p&gt;I've been looking at &lt;a href=&quot;http://straightupcraft.com/articles/the-definitive-guide-to-validation-in-craft&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/articles/the-definitive-guide-to-validation-in-craft&lt;/a&gt; which seems to concentrate on custom models. However I am looking to validate data posted to a plugin that stores that data as core EntryModels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say you create a Section and assign some Fields in its field layout. You can set each Field to be required but I want to do more than that and check if it's an integer or if it's unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently doing that in my service class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function validateReference()&#xA;{&#xA;    $reference = craft()-&amp;gt;request-&amp;gt;getPost('reference');&#xA;&#xA;    $existingEntryCount = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;total(array(&#xA;        'reference' =&amp;gt; $reference&#xA;    ));&#xA;&#xA;    return ($existingEntryCount === 0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That all works but I am wondering if instead I should be setting the validation properties of each Field in this service and then just running a core validate method?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="57" LastEditDate="2014-11-11T18:46:01.217" LastActivityDate="2014-11-11T18:56:20.073" Title="Adding custom validation to core fields" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4681" PostTypeId="2" ParentId="4668" CreationDate="2014-11-11T17:07:46.393" Score="5" Body="&lt;p&gt;Currently this isn’t configurable, but I suppose it should be. I’ll add it to the list, and update this answer when it’s possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates/2.3&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3&lt;/a&gt;, each user can choose their own preferred week start day from their account settings.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-12-03T16:03:39.027" LastActivityDate="2014-12-03T16:03:39.027" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4682" PostTypeId="2" ParentId="4680" CreationDate="2014-11-11T18:56:20.073" Score="1" Body="&lt;p&gt;Your best bet is going to be to write your own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;field type&lt;/a&gt; for this. You can extend one of the built-in field types if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would put your custom validation logic in your field type’s &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#validate-detail&quot; rel=&quot;nofollow&quot;&gt;validate()&lt;/a&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-11T18:56:20.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4683" PostTypeId="2" ParentId="4589" CreationDate="2014-11-11T19:44:21.440" Score="0" Body="&lt;p&gt;This looks to be a Twig bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the time the Twig exception makes it to Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/errors/ErrorHandler&quot; rel=&quot;nofollow&quot;&gt;ErrorHandler&lt;/a&gt;, the wrong &lt;code&gt;_layout.html&lt;/code&gt; file has already been set on the exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to come up with a barebones reproducible test case and create a Github issue with them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-11T19:44:21.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4685" PostTypeId="1" AcceptedAnswerId="4687" CreationDate="2014-11-12T01:31:33.320" Score="1" ViewCount="664" Body="&lt;p&gt;I'm starting with a clean install, empty database.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the changes needed to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;Nginx configuration&lt;/a&gt; to serve craft from /articles/ instead of &quot;/&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any specific configurations that needs to be done to the Craft configs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried many combinations that all ended in 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current layout:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/srv/www/app/craft &amp;lt;- &quot;craft files&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/srv/www/webroot &amp;lt;- &quot;public webroot&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/srv/www/webroot/articles/ &amp;lt;- &quot;craft index.php here (with path set correctly to craft)&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="985" LastActivityDate="2014-11-12T04:10:15.367" Title="Serving Craft from a sub-directory on Nginx" Tags="&lt;install&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4686" PostTypeId="1" CreationDate="2014-11-12T03:07:06.377" Score="5" ViewCount="112" Body="&lt;p&gt;Is there anything like the &lt;a href=&quot;http://devot-ee.com/add-ons/ndg-masked-input&quot; rel=&quot;nofollow&quot;&gt;EE add-on&lt;/a&gt; for Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be &lt;em&gt;really&lt;/em&gt; useful for part numbers, etc.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="250" LastEditDate="2014-11-15T18:31:51.093" LastActivityDate="2015-01-04T06:35:49.180" Title="Is there a masked input field type for Craft?" Tags="&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4687" PostTypeId="2" ParentId="4685" CreationDate="2014-11-12T03:57:24.380" Score="1" Body="&lt;p&gt;If you want to just adjust the folder for the webroot set the root to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/srv/www/webroot/articles/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in the index.php file make sure the path to the craft folder is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'../../app/craft'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you instead want to leave the webroot as is and just have craft run from yourdomain.com/articles you would need to also update the index.php to make sure the craft path is set correct&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in the nginx file add this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location /articles/ {&#xA;  try_files $uri $uri/ @rewrites;  &#xA;}&#xA;&#xA;location @rewrites {&#xA;   rewrite ^/articles/(.*)$ /articles/index.php?p=$1 last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;put that directly above this line, everything else can be the same&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~ \.php$ {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-11-12T04:10:15.367" LastActivityDate="2014-11-12T04:10:15.367" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4688" PostTypeId="1" AcceptedAnswerId="4692" CreationDate="2014-11-12T08:37:50.363" Score="2" ViewCount="1215" Body="&lt;p&gt;For a project I'm working on I have set up several channels that are related to each other. What the setup comes down to is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Projects&#xA;|- News relations (news is a channel and news entries can be related to a project entry)&#xA;|- Gallery relations (gallery is a channel and galleries can be related to a project entry)&#xA;|- ... and more related content ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I can visit the projects overview on the &lt;code&gt;/projects&lt;/code&gt; path and a project entry on the &lt;code&gt;/projects/{slug}&lt;/code&gt; path. The project entry page shows a short overview of the related content (i.e. 2 or 3 of the related items for the various channels), but will also contain a link to the full listing of all news items/galleries/etc of the requested projected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preferably I would have a url for these subpages to the project on a path like &lt;code&gt;/projects/{slug}/news&lt;/code&gt; and &lt;code&gt;/projects/{slug}/gallery&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I set this up? I've been looking around, but can't find any solution to this.&lt;/p&gt;&#xA;" OwnerUserId="986" LastEditorUserId="784" LastEditDate="2014-11-12T14:41:35.130" LastActivityDate="2014-11-12T16:01:01.453" Title="Creating a related content subpage to a channel entry?" Tags="&lt;structure&gt;&lt;relations&gt;&lt;entry&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4689" PostTypeId="1" CreationDate="2014-11-12T08:43:34.567" Score="1" ViewCount="1164" Body="&lt;p&gt;How can I request the url for a channel index page from another page. I got this message asked on twitter towards craft, but they misunderstood my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The came back to me using craft.request.getSegment(x), but this will only work if I would like the index page of a channel when I'm on the entry page of this channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how would I get the url for the &quot;news&quot; channel index page, when I'm in the &quot;projects&quot; channel section (either the index or an entry) of the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;News is an entry-field of projects btw, so that we can show news related to a project on the site. &lt;/p&gt;&#xA;" OwnerUserId="986" LastEditorUserId="-1" LastEditDate="2014-11-12T14:53:11.093" LastActivityDate="2014-12-15T01:03:16.710" Title="Request the url of a channel index" Tags="&lt;templating&gt;&lt;entries&gt;&lt;url&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4690" PostTypeId="2" ParentId="789" CreationDate="2014-11-12T10:03:21.347" Score="2" Body="&lt;p&gt;You may be able to do the sorting with a bit of manual work. What you would need to do is to convert your &lt;code&gt;ECM&lt;/code&gt; to a &lt;code&gt;DBCommand&lt;/code&gt; and then manually join the matrix-field table that corresponds to the field you want to order by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4600/order-two-entry-types-by-different-date-fields-for-use-in-one-combined-stream&quot;&gt;Order two entry-types by different date fields for use in one combined stream&lt;/a&gt; for the approach I have taken to combine two entry types in a query, where one of them gets ordered by its matrix-field.&lt;/p&gt;&#xA;" OwnerUserId="964" LastActivityDate="2014-11-12T10:03:21.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4691" PostTypeId="1" AcceptedAnswerId="4697" CreationDate="2014-11-12T12:34:24.793" Score="1" ViewCount="1194" Body="&lt;p&gt;I have a section &lt;code&gt;Events&lt;/code&gt; with a matrix field (let's call it &lt;code&gt;dates&lt;/code&gt;). The matrix features a single block type with a single &lt;code&gt;date&lt;/code&gt; field. One &lt;code&gt;Event&lt;/code&gt; can have multiple dates. Think theatre plays with multiple show dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'd like to create a list of all events, ordered by the &lt;code&gt;date&lt;/code&gt; field. This means that the same entry could show multiple times in the list (once for each &lt;code&gt;date&lt;/code&gt; in the matrix field). I want to query all future dates in the matrix, fetch related entries, limit the number of items displayed and support pagination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally there is something like &lt;code&gt;craft.entries&lt;/code&gt; but for matrix fields. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Example&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The following example shows three different &lt;code&gt;Event&lt;/code&gt; entries, ordered by their &lt;code&gt;date&lt;/code&gt;s. Notice how the same entry can appear multiple times.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;14/12/01 @8pm - The Great Gatsby (ID #1)&lt;/li&gt;&#xA;&lt;li&gt;14/12/01 @8pm - Moby Dick (ID #2)&lt;/li&gt;&#xA;&lt;li&gt;14/12/02 @3pm - Snow White (ID #3)&lt;/li&gt;&#xA;&lt;li&gt;14/12/02 @5pm - Snow White (ID #3)&lt;/li&gt;&#xA;&lt;li&gt;15/12/05 @7pm - The Great Gatsby (ID #1)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction? I'm not afraid to dive into plugin development (already created a simple &quot;Address&quot; field type with geocoding support) but is there an easier way? Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="987" LastEditorUserId="144" LastEditDate="2014-11-12T12:50:31.547" LastActivityDate="2014-11-18T09:43:56.273" Title="Query entries by matrix date fields for event calendar" Tags="&lt;matrix&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4692" PostTypeId="2" ParentId="4688" CreationDate="2014-11-12T14:20:18.457" Score="4" Body="&lt;p&gt;Two ways that this can be done is A) use a structure, or B) use &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom routes&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a &lt;code&gt;Structure&lt;/code&gt; with different &lt;code&gt;entry types&lt;/code&gt; defined for the various sub-page types would probably be the most straightforward and flexible. The base of the structure would be projects (but could just as easily start above projects, if you also wanted to use it to &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;generate your site nav&lt;/a&gt;). Your structure might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/project1 (entry type: project)&#xA;   /news (entry type: projectNews)&#xA;   /gallery (entry type: projectGallery)&#xA;/project 2&#xA;   /...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;projectNews&lt;/code&gt; template, you can access the 'project' entry through &lt;code&gt;entry.parent&lt;/code&gt; and can retrieve the news related to the project using &lt;code&gt;relatedTo()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set project = entry.parent %}&#xA;{% set projectNews = craft.entries.section('news').relatedTo(project) %}&#xA;{% for entry in projectNews %}&#xA;    &amp;lt;article&amp;gt;&#xA;        {{ entry.title }}&#xA;        ...&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The advantage of the structure is that: you can selectively add these pages to projects on a case by case basis; you can add additional content to the news or gallery pages as needed, in addition to the related content; and that it automatically generates the uri that your looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option would be to create &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom routes&lt;/a&gt;, using the project slug as one of the uri segments (i.e. &lt;code&gt;projects/{slug}/news&lt;/code&gt;). The variable &lt;code&gt;slug&lt;/code&gt; will be accessible in the templates and can be used to fetch the project using an &lt;code&gt;Element Criteria Model&lt;/code&gt;, and the related content via &lt;code&gt;relatedTo()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set project = craft.entries.section('projects').slug(slug) %}&#xA;{% set projectNews = craft.entries.section('news').relatedTo(entry) %}&#xA;{% for entry in projectNews %}&#xA;    &amp;lt;article&amp;gt;&#xA;        {{ entry.title }}&#xA;        ...&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The advantage here is that you don't need to generate those additional entries, if 'news' and 'gallery' will always be defined. And if you did need some customizable content for those pages, you could easily place that in the projects main entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For another example see this question regarding &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4383/help-with-understanding-how-to-structurally-build-a-sermon-catalogue/4385#4385&quot;&gt;site structure&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-12T16:01:01.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4693" PostTypeId="2" ParentId="4691" CreationDate="2014-11-12T15:40:44.633" Score="1" Body="&lt;p&gt;I think that in order to do this you are going to need to loop through all events; find eventTimes (within the blocks) that are after the selected date; merge those into an array;  and then return the sorted array. However, by doing so you will loose the ability to easily use pagination. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps another solution would be to not use matrix blocks at all and instead create two channels: 1 for 'Shows' and 1 for 'Showtimes' (using your theatre analogy), where 'Showtimes' would be related to 'Shows' using an Entries field-type with limit set to 1. Then finding showtimes would be trivial, and would support pagination, etc. (You could even set the showtimes title to be auto-generated from 'related show title + datetime'.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you wanted to display all the showtimes collected nicely on the Shows entry (for the sake of the client), you can use a nice plugin called '&lt;a href=&quot;https://github.com/iainurquhart/craft_introvert&quot; rel=&quot;nofollow&quot;&gt;introvert&lt;/a&gt;' to show reverse related entries.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-12T15:40:44.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4694" PostTypeId="2" ParentId="4424" CreationDate="2014-11-12T15:57:51.407" Score="2" Body="&lt;h1&gt;Use the assets.onBeforeSaveAsset event&lt;/h1&gt;&#xA;&lt;p&gt;You could write a plugin that listens for when an asset is saved via the &lt;code&gt;assets.onBeforeSaveAsset&lt;/code&gt; event and rename the image before it is saved to the database?&lt;/p&gt;&#xA;&lt;p&gt;So you could have something like this in your plugins init method:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.onBeforeSaveAsset', function(Event $event) {&#xA;&#xA;    // Only rename if it’s a new asset being saved&#xA;    if($event-&amp;gt;params[‘isNewAsset’])&#xA;    {&#xA;        $asset = $event-&amp;gt;params[‘asset’];&#xA;&#xA;        $asset-&amp;gt;setAttribute(‘filename’, ‘SOME_RANDOM_STRING’);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I haven’t tested this code, but from looking at Craft’s source and the docs this should work.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Documentation about events can be found on the Craft website&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-06T17:01:19.837" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4695" PostTypeId="1" CreationDate="2014-11-12T16:25:34.590" Score="2" ViewCount="1193" Body="&lt;p&gt;I am using a phone number in a global variable called &lt;code&gt;{{ global.phone }}&lt;/code&gt; with the format &quot;(555) 555-5555&quot;. I'd like to use that same variable/string and remove spaces, dash, and parenthesis to use for the href tel link. I've tried a few different things from Twig and Craft documentation, but nothing is working. Here's what I have right now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Ph: &amp;lt;a href=&quot;tel:{{ global.phone|trim(' ') }}&quot;&amp;gt;{{ global.phone }}&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do? If so any advise how to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="806" LastActivityDate="2016-05-26T19:27:18.650" Title="Remove white space and parenthsis from global from entry variable" Tags="&lt;templating&gt;&lt;variable&gt;&lt;string&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4696" PostTypeId="2" ParentId="4695" CreationDate="2014-11-12T16:43:21.410" Score="4" Body="&lt;p&gt;I haven't tried this but I think that you can use the twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;nofollow&quot;&gt;replace&lt;/a&gt; function. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ global.phone|replace({&quot;(&quot;:&quot;&quot;, &quot;)&quot;:&quot;&quot;, &quot;-&quot;:&quot;&quot;, &quot; &quot;:&quot;&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; In your case, since the prefix (1-) is required, and &quot;-&quot; are allowable, the replace string for &quot;(555) 555-5555&quot; would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ global.phone|replace({&quot;(&quot; : &quot;1-&quot;, &quot;) &quot; : &quot;-&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-12T16:57:52.410" LastActivityDate="2014-11-12T16:57:52.410" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4697" PostTypeId="2" ParentId="4691" CreationDate="2014-11-12T17:42:31.267" Score="1" Body="&lt;p&gt;You can do this using the Lowblocks plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/low/lowblocks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im using it for exactly the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/39/search-matrix-for-blocks-with-upcoming-dates/41#comment5242_41&quot;&gt;Brandon Kelly has said&lt;/a&gt; he's working on an enhancement in 2.3 to allow filtering Matrix fields by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime I used this temporary workaround...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allDates = craft.lowblocks.blocks.fieldId(136).type('mbDate').order('mfDate').limit(null) %}&#xA;&#xA;{% set upcomingIds = [] %}&#xA;&#xA;{% for item in allDates if item.mfDate &amp;gt; now %}&#xA;&#xA;    {% set upcomingIds = upcomingIds | merge([item.id]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set upcomingDates = craft.lowblocks.blocks.id(upcomingIds).fieldId(136).type('mbDate').order('mfDate').limit(30) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-15T12:51:23.533" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4698" PostTypeId="2" ParentId="4667" CreationDate="2014-11-12T19:33:23.607" Score="1" Body="&lt;p&gt;Ok so I finally got it going with the help of that Inspector plugin. This is what I did..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my front end template..(i used index.html)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;{% set form = craft.formBuilder.getFormByHandle('testTwo') %}&#xA;{% set fields = form.fieldLayout.getFieldLayout().getFields() %}&#xA;&#xA;{% block content %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;&#xA;{% for field in fields %}&#xA;  {% set input = craft.fields.getFieldById(field.fieldId) %}&#xA;  {% set requiredInput = field.required %}&#xA;&#xA;  {% include &quot;_includes/field&quot; with {&#xA;    field: input,&#xA;    required: requiredInput&#xA;  } only %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endblock %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each form will have a formHandle name. With the following line I can target that form in the template (see screenshot 1)..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.formBuilder.getFormByHandle('testForm') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each form has a fieldLayout Builder so I now need to get the fieldLayoutId associated with the &lt;code&gt;form&lt;/code&gt; above. While I'm getting the fieldLayoutId I will ask for &lt;code&gt;fieldId&lt;/code&gt;'s associated with this fieldLayoutId..The bellow will let me get &lt;code&gt;fieldId&lt;/code&gt; (also see screenshot 2 in my question, basically the following line lands me on that table)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = form.fieldLayout.getFieldLayout().getFields() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now that I have &lt;code&gt;fieldId&lt;/code&gt;'s I can use the following line to get all my fields!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set input = craft.fields.getFieldById(field.fieldId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'll need to include that inside my for loop so I can render all the fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is more work for what I need to achieve in this plugin, but this was biggest obstacle for me personally so hope this helps someone too. Thanks for help and info on the Inspector plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 folders you will need to copy from &lt;code&gt;craft/app/templates/&lt;/code&gt; directory into your &lt;code&gt;craft/templates/&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_includes&lt;/code&gt; and &lt;code&gt;_components&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="971" LastEditorUserId="971" LastEditDate="2014-11-12T19:58:03.717" LastActivityDate="2014-11-12T19:58:03.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4699" PostTypeId="1" AcceptedAnswerId="4710" CreationDate="2014-11-12T19:54:24.720" Score="2" ViewCount="2059" Body="&lt;p&gt;I come from expression engine and what I want to do is the following: I have a channel filled with entries. All I want to do is to list all these entries on a page.&#xA;However, I don't want to link through to a detail page. So I disable the &quot;Entries have their own URL's&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can link to this channel by linking to its handle in my url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem now is that I use a structure to build up my navigation. And you can't link to a channel in a structure, only to its entries. So I need to create a (useless) extra single section to link to and list all entries from my channel in that single.&#xA;Shouldn't it be simpler than that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't find a better way to handle navigations yet.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="250" LastEditDate="2014-11-15T18:30:46.957" LastActivityDate="2014-11-15T18:30:46.957" Title="Channel index page linked in a structure" Tags="&lt;templating&gt;&lt;structure&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4700" PostTypeId="2" ParentId="4699" CreationDate="2014-11-12T20:25:24.980" Score="1" Body="&lt;p&gt;Craft is very flexible about what you can display where. You can display channel or structure entries virtually anywhere using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySectionHandle') %}&#xA;    {{ entry.title }}&#xA;    etc ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just paste this into one of your structure templates (or any template). If you only want it to display in one structure entry, then you can place a conditional in that template that only displays the content based on a specific uri segment or the defined &lt;code&gt;Entry Type&lt;/code&gt; for that page/entry or both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check for uri segment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) == &quot;mySection&quot; %}...{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to check for entry type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == &quot;myEntryType&quot; %}...{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; You can also just create an index page in your templates folder in that sections folder (i.e. '/craft/templates/mysection/index.html') and link to that directly (i.e. &lt;code&gt;&amp;lt;a href=&quot;mysection&quot;&amp;gt;mysection title&amp;lt;/a&amp;gt;&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-12T21:22:40.977" LastActivityDate="2014-11-12T21:22:40.977" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4701" PostTypeId="1" AcceptedAnswerId="4706" CreationDate="2014-11-12T21:10:25.717" Score="0" ViewCount="1620" Body="&lt;p&gt;I just uploaded some templates to the server and discovered that some of my url encoded strings are being output with a &quot;+&quot; for spaces instead of the &quot;%20&quot; that is desired. It is fine in my local environment. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/url_encode.html&quot; rel=&quot;nofollow&quot;&gt;twig encode_url documentation&lt;/a&gt; &lt;code&gt;url_encode&lt;/code&gt; now uses php's &lt;code&gt;rawurlencode&lt;/code&gt; by default:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internally, Twig uses the PHP urlencode (or rawurlencode if you pass true as the first parameter) or the http_build_query function. Note that as of Twig 1.16.0, urlencode always uses rawurlencode (the raw argument was removed.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have also tried passing 'true' as the first parameter just in case. No luck.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-13T14:46:07.850" Title="Why would one environment use &quot;+&quot; instead of &quot;%20&quot; for spaces when using url_encode filter?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4702" PostTypeId="1" CreationDate="2014-11-12T22:20:39.027" Score="1" ViewCount="1208" Body="&lt;p&gt;I am trying to create a Newsletter registration form. I just want to collect emails somewhere in the CP, and let the client decide what to do with the list later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone worked on something similar? I don't want to create a registration, just data collection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance &lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2019-01-30T23:12:57.940" Title="Newsletter Sign up" Tags="&lt;control-panel&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4703" PostTypeId="2" ParentId="4702" CreationDate="2014-11-12T22:46:17.337" Score="2" Body="&lt;p&gt;There are several options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You could use the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin. You'd create a section ala &quot;Newsletter Subscribers&quot;, and add a couple fields like Name (&lt;code&gt;subscriberName&lt;/code&gt;) and E-mail (&lt;code&gt;subscriberEmail&lt;/code&gt;). Then could take the form example and add your name and e-mail field to it:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;name&quot; name=&quot;fields[subscriberName]&quot;&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;email&quot;&amp;gt;E-mail&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;email&quot; name=&quot;fields[subscriberEmail]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'd really reccommend you to use a system like MailChimp or Campaign Monitor for this instead. André Elvan built a great plugin to handle the former, &lt;a href=&quot;http://straightupcraft.com/craft-plugins/mailchimp-subscribe&quot; rel=&quot;nofollow&quot;&gt;MailChimp Subscribe&lt;/a&gt;. It's kind of a non-brainer, unless your client already is invested in another system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="480" LastEditorUserId="250" LastEditDate="2014-11-15T18:28:57.463" LastActivityDate="2014-11-15T18:28:57.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4704" PostTypeId="1" AcceptedAnswerId="4705" CreationDate="2014-11-12T23:24:07.417" Score="1" ViewCount="1070" Body="&lt;p&gt;Seems like it should be simple but it's not working for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.contributionType %}&#xA;     &amp;lt;li&amp;gt; {{ option.value }} &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code outputs the option's label instead of  the value. I feel like I'm going crazy.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="250" LastEditDate="2014-11-15T18:28:01.593" LastActivityDate="2014-11-15T18:28:01.593" Title="How do you output the value of a checkbox item?" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4705" PostTypeId="2" ParentId="4704" CreationDate="2014-11-12T23:38:16.983" Score="2" Body="&lt;p&gt;Ok, just figured it out. Apparently, when I changed the value of the fields in the settings I had to re-save all entries that used that field. And not just re-save them, but reset the value in the field as well, because it had lost it's checked value when I opened the entry up to edit it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see now the warning in the field settings I had previously overlooked, &quot;Changing this may result in data loss.&quot;&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-11-12T23:38:16.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4706" PostTypeId="2" ParentId="4701" CreationDate="2014-11-13T05:37:16.793" Score="1" Body="&lt;p&gt;It looks like the twig &lt;code&gt;url_encode&lt;/code&gt; filter uses the php function &lt;code&gt;http_build_query&lt;/code&gt; if parameters are passed to it as an array. i.e. &lt;code&gt;{'key':'value', 'key':'value'}|url_encode&lt;/code&gt;. Otherwise it uses &lt;code&gt;rawurlencode&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http_build_query&lt;/code&gt; was modified in php 5.4 to include a new property &lt;code&gt;enc_type&lt;/code&gt;, that allowed you to specify that it use &lt;code&gt;PHP_QUERY_RFC3986&lt;/code&gt;encoding (which is also what &lt;code&gt;rawurlencode&lt;/code&gt; uses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;url_encode&lt;/code&gt; filter is defined in &lt;code&gt;craft/app/vendor/twig/twig/lib/Twig/Extension/Core.php&lt;/code&gt; on line 596, and contains a clause to make it backwards compatible with php 5.3, but you obviously will loose the encoding type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Options are: upgrade php to 5.4+; do not pass params as an array to the &lt;code&gt;url_encode&lt;/code&gt; filter; or do a string replace on the encoded string.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-13T14:46:07.850" LastActivityDate="2014-11-13T14:46:07.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4707" PostTypeId="2" ParentId="1429" CreationDate="2014-11-13T10:54:54.247" Score="3" Body="&lt;p&gt;It should also be noted that to change your password or email, the current password has to be passed along with the request.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// You must pass your current password to change these fields for an existing user&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="359" LastActivityDate="2014-11-13T10:54:54.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4710" PostTypeId="2" ParentId="4699" CreationDate="2014-11-13T11:38:35.833" Score="2" Body="&lt;p&gt;The reason why there's no automatically set url and template for channel index pages is because Craft tries to be as flexible as possible. In many use cases for channel sections you don't want a index page at all or you could also need multiple of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you already chose a very solid approach by setting up a structure section for your navigation. And no, you don't have to create useless singles for each channel index. I'd rather use entries of that structure itself and would just set up a new entry type for your indexes. See &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; in the Craft Docs on how to link templates to entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it's really nice to have all the site main pages together in one structure. You can easily add fields to your index pages and have your client edit all this rather static content in here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also add you home page to that structure. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1467/add-home-page-to-a-structure&quot;&gt;this Q/A&lt;/a&gt; for how to do that.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-11-13T11:38:35.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4711" PostTypeId="1" AcceptedAnswerId="4713" CreationDate="2014-11-13T11:45:28.707" Score="2" ViewCount="648" Body="&lt;p&gt;I'm trying to set up caching and have it disabled for my local environment using &lt;code&gt;{% cache unless craft.config.devMode %}&lt;/code&gt;. This works fine on non-local environments, but on my local environment I'm getting the error &lt;code&gt;Method &quot;devMode&quot; for object &quot;Craft\ConfigVariable&quot; does not exist&lt;/code&gt;. Even though it does, this is my config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'addTrailingSlashesToUrls' =&amp;gt; true,&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        'cpTrigger' =&amp;gt; 'example-admin',&#xA;        'siteUrl' =&amp;gt; (isset($_SERVER[&quot;HTTPS&quot;]) &amp;amp;&amp;amp; $_SERVER[&quot;HTTPS&quot;] == &quot;on&quot;) ? &quot;https://&quot; : &quot;http://&quot; . $_SERVER['HTTP_HOST'],&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/data/uploads/',&#xA;            'baseURL' =&amp;gt; (isset($_SERVER[&quot;HTTPS&quot;]) &amp;amp;&amp;amp; $_SERVER[&quot;HTTPS&quot;] == &quot;on&quot;) ? &quot;https://&quot; : &quot;http://&quot; . $_SERVER['HTTP_HOST'] . '/data/uploads/',&#xA;        )&#xA;    ),&#xA;    '.local' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I &lt;code&gt;{{ dump(craft.config.devMode) }}&lt;/code&gt; I get &lt;code&gt;bool(true)&lt;/code&gt; so it is being set, it's just when being used in the cache conditional.&lt;/p&gt;&#xA;" OwnerUserId="906" LastEditorUserId="906" LastEditDate="2014-11-13T11:52:27.143" LastActivityDate="2014-11-13T12:01:22.420" Title="Config variable does not exist" Tags="&lt;conditional&gt;&lt;devmode&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4713" PostTypeId="2" ParentId="4711" CreationDate="2014-11-13T12:01:22.420" Score="5" Body="&lt;p&gt;Looks like it was an issue with character encoding. I copied the &lt;code&gt;{% cache unless craft.config.devMode %}&lt;/code&gt; from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag&quot;&gt;What are the best practices for using the {% cache %} tag?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I manually retyped out the conditional it worked properly.&lt;/p&gt;&#xA;" OwnerUserId="906" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-13T12:01:22.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4714" PostTypeId="1" AcceptedAnswerId="4715" CreationDate="2014-11-13T14:47:15.310" Score="4" ViewCount="2265" Body="&lt;p&gt;Is it currently possible to change a user's password in for example the profile edit form? I'm currently using the forgot password approach for this.&lt;/p&gt;&#xA;" OwnerUserId="970" LastEditorUserId="250" LastEditDate="2014-11-15T18:30:10.533" LastActivityDate="2018-08-31T13:39:48.380" Title="Is it possible to change a user's password in the front-end?" Tags="&lt;templating&gt;&lt;form&gt;&lt;password&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4715" PostTypeId="2" ParentId="4714" CreationDate="2014-11-13T15:41:58.990" Score="13" Body="&lt;p&gt;It is! To do so, they will have to be logged in and input their old password. They need the old password to change their email or update a password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        {% for error in errors %}&#xA;            &amp;lt;div class=&quot;error icon-cancel-circled&quot;&amp;gt;{{ error }}&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; id=&quot;action-form&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ getCsrfInput() }} {# Remove this if you aren't using CSRF #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt; {# &quot;users/save-user&quot; if you're on Craft 3 #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;currentPassword&quot;&amp;gt;Current Password&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;currentPassword&quot; name=&quot;password&quot; /&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('currentPassword')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; class=&quot;text&quot; /&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;newPassword&quot;&amp;gt;New Password&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;newPassword&quot; name=&quot;newPassword&quot; /&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('newPassword')) }}&#xA;    {% endif %}&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is code that would be inserted into a new custom front end template.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="8536" LastEditDate="2018-08-31T13:39:48.380" LastActivityDate="2018-08-31T13:39:48.380" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4716" PostTypeId="1" AcceptedAnswerId="4778" CreationDate="2014-11-13T18:11:24.377" Score="8" ViewCount="1642" Body="&lt;p&gt;Here's my record (model is nearly identical):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class Recurly_PlanRecord extends BaseRecord&#xA;{&#xA;&#xA;  public function getTableName()&#xA;  {&#xA;    return 'recurly_plans';&#xA;  }&#xA;&#xA;  protected function defineAttributes()&#xA;  {&#xA;    return array(&#xA;      'sortOrder'      =&amp;gt; AttributeType::SortOrder,&#xA;      'code'           =&amp;gt; AttributeType::String,&#xA;      'max'            =&amp;gt; AttributeType::Number,&#xA;      'min'            =&amp;gt; AttributeType::Number,&#xA;      'annual'         =&amp;gt; AttributeType::Bool,&#xA;      'base_endpoints' =&amp;gt; AttributeType::Number,&#xA;      'endpoint_code'  =&amp;gt; AttributeType::String,&#xA;      'base_cost'      =&amp;gt; array(&#xA;        'type'     =&amp;gt; AttributeType::Number,&#xA;        'decimals' =&amp;gt; 2,&#xA;      ),&#xA;      'endpoint_cost'  =&amp;gt; array(&#xA;        'type'     =&amp;gt; AttributeType::Number,&#xA;        'decimals' =&amp;gt; 2,&#xA;      ),&#xA;    );&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the DB, the column types seem to be set correctly based on this.&#xA;What I can't figure out how to do, is actually get data back in the specified types, not just strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's me using it in a service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = Recurly_PlanRecord::model()-&amp;gt;find();&#xA;var_dump($record-&amp;gt;attributes); // all strings :(&#xA;var_dump($record-&amp;gt;base_cost); // string '1402.50' (length=7)&#xA;&#xA;$model  = Recurly_PlanModel::populateModel($record);&#xA;var_dump($model-&amp;gt;attributes); // all strings :(&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I &lt;em&gt;want&lt;/em&gt; is &lt;code&gt;float 1402.50&lt;/code&gt;. What I get is a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having the same problem with &lt;code&gt;AttributeType::Bool&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2014-11-17T17:24:05.247" LastActivityDate="2014-11-19T22:10:43.267" Title="How do I get model/record attributes in their proper types, and not just strings?" Tags="&lt;plugin-development&gt;&lt;string&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4717" PostTypeId="1" AcceptedAnswerId="4739" CreationDate="2014-11-13T20:30:42.523" Score="3" ViewCount="2267" Body="&lt;p&gt;We are looking for a way to route a subdomain to a specific template to use as a landing page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this without routing through index.html and redirecting to the specified template folder and file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can confirm that using the redirect &lt;strong&gt;does&lt;/strong&gt; lose some of the user information, tracking codes etc. However it does retain the referral url from the 3rd party site.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="250" LastEditDate="2014-11-15T18:23:41.563" LastActivityDate="2014-11-15T18:23:41.563" Title="Is it possible to route a subdomain to specific template group?" Tags="&lt;templating&gt;&lt;routing&gt;&lt;subdomain&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4718" PostTypeId="1" AcceptedAnswerId="5258" CreationDate="2014-11-13T20:55:14.077" Score="1" ViewCount="960" Body="&lt;p&gt;This was working fine previously and not sure what triggered the error. Any idea how to resolve issue?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.servicesItems.type('images') %}&#xA;    &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;&#xA;        {# grab the first image #}&#xA;        {% set image = block.image.first() %}&#xA;&#xA;        {# link to the full sized version #}&#xA;            &amp;lt;a href=&quot;{{ image.getUrl }}&quot;&amp;gt;&#xA;        {# generated the transformed thumbnail version #}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('servicesImageCrop')}}&quot; alt=&quot;{{ block.alt }}&quot; width=&quot;{{ image.getWidth('servicesImageCrop') }}&quot; height=&quot;{{ image.getHeight('servicesImageCrop') }}&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;lightbox-title&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ block.imageTitle }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.imageContent }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastActivityDate="2017-07-23T17:06:24.697" Title="Getting error in template: Impossible to access an attribute (&quot;getUrl&quot;) on a NULL variable (&quot;&quot;)" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;image&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4719" PostTypeId="1" CreationDate="2014-11-13T21:01:24.807" Score="9" ViewCount="2023" Body="&lt;p&gt;Craft deployed and working well on one node.  Now looking into load balancing 3 nodes behind a LTM device (F5 Big-IP).  The server environment is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a GlusterFS replicated &quot;shared&quot; file-system mounted on the 3 nodes&lt;/li&gt;&#xA;&lt;li&gt;Craft app is installed in the &lt;strong&gt;shared&lt;/strong&gt; file-system (so is the webroot and all common files, but Craft itself is outside of the webroot).&lt;/li&gt;&#xA;&lt;li&gt;a replicated MySQL database cluster hosting the Craft database (Percona xtraDB Cluster)&lt;/li&gt;&#xA;&lt;li&gt;Each node is configured with PHP ZendOpcache and Nginx.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently, Craft Vhost is enabled only on one node because I have the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What should I do with the &quot;storage&quot; folder.  Currently, it's on the shared file-system, so all the node share the same folder, is this an issue, i.e. should I move it to a local file system and set CRAFT_STORAGE_PATH accordingly?&lt;/li&gt;&#xA;&lt;li&gt;overridePhpSessionLocation: I set to true (so it does not write to 'storage/runtime/sessions'&lt;/li&gt;&#xA;&lt;li&gt;CacheMethod, is this for OPcaching or user data caching?  (Currently ZendOpcache is configured at the PHP level, but I still see entries in the storage/runtime/cache folder)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any pitfalls I should be aware or specific configuration needed for a load-balanced set of Craft instances?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="985" LastActivityDate="2017-01-11T23:20:09.367" Title="Load balancing nodes configuration (3 Craft nodes behind F5 Big-IP)" Tags="&lt;config&gt;&lt;install&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4720" PostTypeId="1" AcceptedAnswerId="4723" CreationDate="2014-11-13T21:06:09.807" Score="3" ViewCount="1059" Body="&lt;p&gt;Why am I getting only one result with the following query?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;$entryRecord = $query-&amp;gt;select('craft_content.field_releaseDate, craft_content.title, craft_entries.id, craft_entries.dateCreated')-&amp;gt;from('content')-&amp;gt;join('entries', 'craft_content.elementId = craft_entries.id')-&amp;gt;where('craft_entries.sectionId=2')-&amp;gt;queryRow();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also the documentation says that the table prefix isn't required, but this doesn't work most of the time, weird.&lt;/p&gt;&#xA;" OwnerUserId="970" LastActivityDate="2014-11-13T21:51:32.217" Title="Why am I getting only one result with &quot;craft()-&gt;db-&gt;createCommand()&quot;?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;database&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4721" PostTypeId="1" AcceptedAnswerId="4725" CreationDate="2014-11-13T21:24:03.140" Score="2" ViewCount="510" Body="&lt;p&gt;The RelatedTo function keeps puzzeling me. I got it working with categories, but now I want to do something in reverse with users. But I don't fully understand the RelatedTo function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel called &quot;downloads&quot;. I also have some users in the back-end. I have added a custom field to the user section called &quot;selectDownloads&quot;. This field is a relatedEntry field where the admin can select entries from the downloads channel.&#xA;Now I want to list all downloads in my template that the current logged in user may see (so the entries that were selected when creating the user).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read the docs multiple times allready and with some luck and trial and error I got it working on categories. But there I loop through all my products and relate them to a targetSource which is my category by a field that is part of my products channel.&#xA;In this case however, I want to loop through all my downloads, related to a field that is part of my users section (instead of my downloads channel). So the relation is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more dummy proof explanation with some examples of the RelatedTo function would be welcome. I never know which elements I should address:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set ingredients = craft.entries.section('ingredients').relatedTo({&#xA;     sourceElement: cocktail,&#xA;     field: 'ingredients' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;sourceElement&lt;/code&gt; or &lt;code&gt;targetElement&lt;/code&gt;:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a section or field you have to give in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;field&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that a field from the ingredients section or the cocktail section?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="250" LastEditDate="2014-11-15T18:21:02.233" LastActivityDate="2014-11-15T18:21:02.233" Title="RelatedTo with users" Tags="&lt;templating&gt;&lt;relations&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4722" PostTypeId="2" ParentId="4717" CreationDate="2014-11-13T21:26:40.473" Score="2" Body="&lt;p&gt;I know you asked for a way to do this without using a redirect, but if it's handled server-side via twig, it would be transparent and virtually instantaneous:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if siteUrl == &quot;http://subdomain.site.com/&quot;  %}&#xA;    {% redirect 'subdomainFolder' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also redefine the default 'index' template using &lt;code&gt;indexTemplateFilenames&lt;/code&gt; in your config file's multi-environment return array for that subdomain, but that would affect all index files for that subdomain in every uri and be pretty extreme:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * The template filenames Craft will look for within a directory to represent the directory’s “index” template when&#xA; * matching a template path to a file on the front end.&#xA; */&#xA;'indexTemplateFilenames' =&amp;gt; array('index'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I know, I don't believe you can specify a full url in custom routes, only uri patterns — but perhaps someone else with more experience with this can add-in. And there may be some other options as well, that I don't know about.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-13T21:26:40.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4723" PostTypeId="2" ParentId="4720" CreationDate="2014-11-13T21:48:11.407" Score="7" Body="&lt;p&gt;Completely untested but it looks like you're just querying a row instead of all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update &lt;code&gt;queryRow()&lt;/code&gt; to &lt;code&gt;queryAll()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-11-13T21:48:11.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4724" PostTypeId="2" ParentId="4720" CreationDate="2014-11-13T21:51:32.217" Score="4" Body="&lt;p&gt;The table prefix &lt;em&gt;isn't&lt;/em&gt; required, and will mess up your results if you add it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when you refer to a new table (as in &quot;join&quot;), you'll want to alias the table for consistent use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;join('entries entries', 'content.elementId = entries.id')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first &lt;code&gt;entries&lt;/code&gt; is your table reference (sans prefix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second &lt;code&gt;entries&lt;/code&gt; is your new alias, referenced by &lt;code&gt;entries.id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, &lt;a href=&quot;https://craftcms.stackexchange.com/a/4723/45&quot;&gt;Peter's answer&lt;/a&gt; is spot on.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-13T21:51:32.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4725" PostTypeId="2" ParentId="4721" CreationDate="2014-11-13T22:08:14.227" Score="3" Body="&lt;p&gt;You can just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('downloads').relatedTo(currentUser) %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is essentially returning an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; of reverse related entries sorted by entry date by default. You can also access the related entries through the field itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in currentUser.selectDownloads %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will loop through the related entries in the order they are sorted in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to answer your other questions. &lt;code&gt;sourceElement&lt;/code&gt; and &lt;code&gt;targetElement&lt;/code&gt; can be &lt;code&gt;elements&lt;/code&gt; of any element type: entry, category, asset, user, globalSet, tag, etc are all elements. &lt;code&gt;sourceElement&lt;/code&gt; simply refers to which is the source of the relationship; and &lt;code&gt;targetElement&lt;/code&gt; is what it's related to. &lt;code&gt;field&lt;/code&gt; further specifies that you only want to match a specific field rather than using any relationship defined in any field (if you have 2 or more &lt;code&gt;entries&lt;/code&gt; fields defined in a channel that are used for different purposes for example).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-13T22:26:28.993" LastActivityDate="2014-11-13T22:26:28.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4726" PostTypeId="1" AcceptedAnswerId="4730" CreationDate="2014-11-13T22:10:13.823" Score="2" ViewCount="1096" Body="&lt;p&gt;Take the &lt;a href=&quot;http://www.yiiframework.com/wiki/167/understanding-virtual-attributes-and-get-set-methods&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; of a model with a &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can add a &lt;code&gt;getFullName&lt;/code&gt; method to the model, and &lt;code&gt;$model-&amp;gt;fullName&lt;/code&gt; will run through the getter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like the attribute to also remain part of the model (accessible through $model-&gt;attributes), which if I use the getter, it isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the getter AND include the same name in &lt;code&gt;defineAttributes&lt;/code&gt;, the getter is ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="784" LastEditDate="2014-11-13T22:25:11.267" LastActivityDate="2014-11-13T23:37:44.163" Title="How can I have a dynamic/virtual attribute AND have as an attribute of the Model?" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4727" PostTypeId="2" ParentId="1258" CreationDate="2014-11-13T22:32:35.737" Score="7" Body="&lt;p&gt;I spent a couple of hours this evening knocking together a Dash docset for Craft and have posted it up on Github at &lt;a href=&quot;https://github.com/cole007/craftcms-dash/&quot;&gt;https://github.com/cole007/craftcms-dash/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are hotlinked from the source documentation so won't show offline but wanted to keep it lean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please feel free to fork/pull request if you find any errors or can suggest any improvements.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2014-11-13T22:32:35.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4728" PostTypeId="1" CreationDate="2014-11-13T23:24:08.463" Score="11" ViewCount="1851" Body="&lt;p&gt;I'm looking for a way to set up the general.php file's siteUrl to be able to use both http and https. Only the front-end login would be using the https. This is how I currently have it set up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'mysite.com' =&amp;gt; array(&#xA;    'cooldownDuration' =&amp;gt; 0,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; '//mysite.com/',&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with this is when the front-end form is submitted and the user is redirected, the url messes up (i.e.: mysite.com/mysite.com/page-name)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be great!&lt;/p&gt;&#xA;" OwnerUserId="788" LastEditorUserId="57" LastEditDate="2014-11-13T23:49:54.383" LastActivityDate="2015-02-04T06:57:39.957" Title="How to set up {siteUrl} to work with both http and https" Tags="&lt;users&gt;&lt;url&gt;&lt;config&gt;&lt;siteurl&gt;&lt;https&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4729" PostTypeId="2" ParentId="4719" CreationDate="2014-11-13T23:34:17.653" Score="5" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I allowed to change my mind on this? :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My original answer didn't take into account &lt;code&gt;storage/logo&lt;/code&gt;, &lt;code&gt;storage/backups&lt;/code&gt; and anything else that a plugin might be storing in the &lt;code&gt;craft/storage&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's probably going to be much cleaner and safer to have &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt; point to the shared file system.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I would set &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt; and have them write to their local file systems.  That way you have independent logs for each web server.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With that set to 'true', the PHP session files will go to whether PHP/nginx are configured to send them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow noreferrer&quot;&gt;cacheMethod&lt;/a&gt; config setting it purely for data caching. It's set to 'file' by default which will write to &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt;, but you can change that to some other caching method.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Actually, if you do #1, then 2 and 3 would resolve themselves, no? You'd want to make sure that your load balancer has stick sessions enabled so that a user would get sent to the same web server for subsequent requests.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-01-11T23:20:09.367" LastActivityDate="2017-01-11T23:20:09.367" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="4730" PostTypeId="2" ParentId="4726" CreationDate="2014-11-13T23:37:44.163" Score="0" Body="&lt;p&gt;I think you're out of luck.  You can't go through the magic &lt;code&gt;__get()&lt;/code&gt; logic and have a concrete &lt;code&gt;get&lt;/code&gt; method and use both.  How will Yii/PHP know which one you're referring to when you do &lt;code&gt;$model-&amp;gt;fullName&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-13T23:37:44.163" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4731" PostTypeId="1" AcceptedAnswerId="4742" CreationDate="2014-11-13T23:45:26.840" Score="2" ViewCount="530" Body="&lt;p&gt;I haven't used Craft in a while now and I have just revisited it, I'm trying to output an image URL from a global matrix field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in globalName.matrixField %}&#xA;&#xA;    {% if block.type == &quot;blockType1&quot; %}&#xA;&#xA;        {% set image = block.blockType1.first() %}&#xA;&#xA;        &amp;lt;a href=&quot;{{ image.getUrl() }}&quot;&amp;gt;link&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it keeps outputting as: &lt;code&gt;{{ siteUrl }}/resources/images/my-image.jpg&lt;/code&gt; (instead of actually outputting the website URL).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="451" LastActivityDate="2014-11-15T14:33:15.950" Title=".getUrl() outputting {{ siteUrl }} in address" Tags="&lt;matrix&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4732" PostTypeId="2" ParentId="4728" CreationDate="2014-11-13T23:59:32.020" Score="5" Body="&lt;p&gt;Try setting it as the actual &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;siteUrl&lt;/code&gt; config setting&lt;/a&gt;, rather than a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;siteUrl&lt;/code&gt; environment variable&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921&quot;&gt;here&lt;/a&gt; for an explanation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="250" LastEditDate="2014-11-15T18:26:24.430" LastActivityDate="2014-11-15T18:26:24.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4733" PostTypeId="2" ParentId="4731" CreationDate="2014-11-14T00:01:54.730" Score="1" Body="&lt;p&gt;I'm guessing you're defining your siteUrl as an environment variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting it as the actual &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl config setting&lt;/a&gt;, rather than a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;siteUrl environment variable&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921&quot;&gt;here&lt;/a&gt; for an explanation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-14T00:01:54.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4734" PostTypeId="2" ParentId="4728" CreationDate="2014-11-14T00:46:50.200" Score="12" Body="&lt;p&gt;One method is using something like the following in your &lt;code&gt;general.php&lt;/code&gt; file.  Using this method the config settings will take on the scheme of the request being made.  I've set both the &lt;code&gt;siteUrl&lt;/code&gt; and example &lt;code&gt;environmentVariables&lt;/code&gt; below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Ensure our urls have the right scheme&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&#xA;// The site url&#xA;define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;&#xA;// The site basepath&#xA;define('BASEPATH',    realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;&#xA;        'siteUrl' =&amp;gt; SITE_URL,&#xA;&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; SITE_URL,&#xA;            'basePath' =&amp;gt; BASEPATH&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-11-14T00:46:50.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4735" PostTypeId="1" AcceptedAnswerId="4738" CreationDate="2014-11-14T02:25:00.370" Score="1" ViewCount="108" Body="&lt;p&gt;I'd like to create a history section so logged in users can see which pages they have visited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to post an entry without using a form? So the user does not have to click to say he has visited a page, instead as soon as they visit the page it is logged into a history section (the user and the page slug)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've thought about doing it with javascript but it seems a little messy. Is there a native neat way to do this? Or a simple way to achieve it with a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :)&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2014-11-14T07:03:12.197" LastActivityDate="2014-11-14T18:06:08.110" Title="Posting an entry without using a form?" Tags="&lt;entry&gt;&lt;post&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4736" PostTypeId="1" AcceptedAnswerId="4737" CreationDate="2014-11-14T14:49:13.283" Score="1" ViewCount="149" Body="&lt;p&gt;I have an entry that acts as a parent to several children pages. Trying to make so that particular parent isn't clickable AND reroutes to homepage if address url is accessed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if I can work something into existing nav code or if this needs to be done somewhere else, but here's the code, nonetheless. Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% set pages = craft.entries.section('page') %}&#xA;    {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ page.getLink() }}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastActivityDate="2014-11-14T15:42:59.953" Title="Make entry in nav not clickable and reroute" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;redirect&gt;&lt;reroute&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4737" PostTypeId="2" ParentId="4736" CreationDate="2014-11-14T15:37:35.613" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;level&lt;/code&gt; method to determine which iteration of the nav you are on and change the behavior:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% set pages = craft.entries.section('page') %}&#xA;    {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {% if page.level == 1 %}&#xA;                &amp;lt;a href=&quot;/&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                {{ page.getLink() }}&#xA;            {% endif %}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;of if it's only one particular entry, then you can create a conditional to check for that entry (using slug, id, title, or any other attribute or field value).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% set pages = craft.entries.section('page') %}&#xA;    {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {% if page.slug == &quot;myPage&quot; %}&#xA;                &amp;lt;a href=&quot;/&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                {{ page.getLink() }}&#xA;            {% endif %}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the url is accessed directly you can add a redirect to the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == 1 %}&#xA;    {% redirect siteUrl %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-14T15:42:59.953" LastActivityDate="2014-11-14T15:42:59.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4738" PostTypeId="2" ParentId="4735" CreationDate="2014-11-14T18:06:08.110" Score="1" Body="&lt;p&gt;If you're looking for an &quot;audit trail&quot; of pages a user has visited, then a plugin will be the way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd want to track a user by something like their PHP session ID.  And for every request grab that session ID and the URI and save that in a your plugin's dedicated audit table in the database (no need to use entries for this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the user goes to their history page, you'll query your audit table and grab any rows with a matching PHP session ID and display them however you want.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-14T18:06:08.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4739" PostTypeId="2" ParentId="4717" CreationDate="2014-11-14T22:09:20.553" Score="9" Body="&lt;p&gt;For this example we have two domains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.example.com&#xA;http://subdomain.example.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To use different templates for the subdomain, we can accomplished this with these steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Setup subdomain to point to a different directory on your server:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Domain: /home/wherever/public_html&#xA;Sub-domain: /home/wherever/public_html_subdomain&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Copy your index.php file over to your new subdomain directory and update the &lt;code&gt;CRAFT_TEMPLATES_PATH&lt;/code&gt; variable to point to the location you want to have your templates.  In this example, both template folders are above web root.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// index.php for domain&#xA;define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . &quot;/../templates&quot;).'/');&#xA;&#xA;// index.php for subdomain&#xA;define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . &quot;/../templates_subdomain&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your template folders now look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/wherever/public_html&#xA;/home/wherever/public_html_subdomain&#xA;/home/wherever/templates&#xA;/home/wherever/templates_subdomain&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-11-14T22:09:20.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4740" PostTypeId="1" AcceptedAnswerId="4741" CreationDate="2014-11-15T02:45:12.803" Score="2" ViewCount="84" Body="&lt;p&gt;I'm suddenly having issues with multiple Craft builds on my local dev environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tDIKa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tDIKam.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, everything else is working fine but when I edit a field the page breaks. It appears to only be displaying the form with any html, head or body tags. I installed a fresh copy and the issue also occurs on that build. I'm thinking it could be an issue with my version of MAMP or perhaps it's a known issue. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="250" LastEditDate="2014-11-15T18:16:56.970" LastActivityDate="2014-11-15T18:16:56.970" Title="Page breaks when editing a field" Tags="&lt;control-panel&gt;&lt;field&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4741" PostTypeId="2" ParentId="4740" CreationDate="2014-11-15T03:11:23.287" Score="2" Body="&lt;p&gt;Looks like PHP is running out of memory.  You can edit your php.ini file's &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; setting to something higher than &lt;code&gt;32M&lt;/code&gt;, which is probably what it's set to right now.  Bump it up to &lt;code&gt;64M&lt;/code&gt; or &lt;code&gt;128M&lt;/code&gt; and restart Apache and you should be set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-15T03:11:23.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4742" PostTypeId="2" ParentId="4731" CreationDate="2014-11-15T14:33:15.950" Score="3" Body="&lt;p&gt;If your putting the variable in the craft settings input, try wrapping it in single brackets like &lt;code&gt;{siteUrl}&lt;/code&gt; instead of &lt;code&gt;{{ siteUrl }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should do the trick&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-11-15T14:33:15.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4743" PostTypeId="1" AcceptedAnswerId="4744" CreationDate="2014-11-15T21:10:51.207" Score="2" ViewCount="191" Body="&lt;p&gt;I'm building a navigation menu with 2 levels.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a contact page with a subpage thank you, which is hidden.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hide pages from the menu using a lightswitch option and filter these pages out in my entries call.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I check if a page has subpages using hasDescendants(), and if the page does, I add the class &quot;has-dropdown&quot; but my contact menu item contains the class &quot;has-dropdown&quot; too which technically is correct as it has a subpage but is it possible to filter with hasDescendants() ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.find({section: &quot;page&quot;, genericHideFromNavigation: &quot;[0]&quot;}) %}&#xA;{% if pages | length %}&#xA;    &amp;lt;ul class=&quot;main-nav&quot;&amp;gt;&#xA;        {% nav page in pages %}&#xA;            &amp;lt;li class=&quot;{% if page.hasDescendants() %}has-dropdown{% endif %}&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ page.url }}&quot; title=&quot;{{ page.title }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastEditorUserId="57" LastEditDate="2014-11-16T02:07:33.423" LastActivityDate="2014-11-16T02:07:33.423" Title="Is it possible to filter with hasDescendants?" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4744" PostTypeId="2" ParentId="4743" CreationDate="2014-11-15T21:50:52.100" Score="2" Body="&lt;p&gt;What you could do is to get all the descendants and loop them to check if at least one has that lightswitch not set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set showDropdown = 0 %}&#xA;{% for subPage in page.getDescendants() if subPage.genericHideFromNavigation == 0 %}&#xA;    {% set showDropdown = 1 %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;li class=&quot;{% if showDropdown %}has-dropdown{% endif %}&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-15T21:50:52.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4745" PostTypeId="1" CreationDate="2014-11-16T09:52:06.107" Score="2" ViewCount="613" Body="&lt;p&gt;Just installed the cms last night. I am looking for a step-by-step instruction on how to create a gallery and display it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have created the:&#xA;- channel called: Gallery&#xA;- section called: Gallery&#xA;- entry type: Gallery&#xA;- the assets field named: gallery&#xA;- added 4 images&#xA;- created a new entry called: Gallery (only the Title is visible so far) and this is where I got stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="997" LastActivityDate="2014-11-16T16:49:32.767" Title="How to build a simple gallery" Tags="&lt;gallery&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4746" PostTypeId="2" ParentId="4745" CreationDate="2014-11-16T11:31:36.727" Score="3" Body="&lt;p&gt;I'm a beginner myself but have used assets plenty of times. It should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('gallery').first() %}&#xA;{% set assets = entry.gallery %}&#xA;{% if assets | length %}&#xA;    {% for asset in assets %}&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl('imgTransform') }}&quot; width=&quot;{{ asset.getWidth('imgTransform') }}&quot; height=&quot;{{ asset.getHeight('imgTransform') }}&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use a set entry instead of a for loop because I'm assuming you only have one entry (one gallery). Maybe use a single section instead of a channel than? If you have multiple galleries, a channel is perfect, than you can use a for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imgTransform can be set in your assets page in the Control Panel. More info: &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/image-transforms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="784" LastEditDate="2014-11-16T13:29:53.583" LastActivityDate="2014-11-16T13:29:53.583" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4747" PostTypeId="1" AcceptedAnswerId="4750" CreationDate="2014-11-16T14:30:29.603" Score="2" ViewCount="1010" Body="&lt;p&gt;I have a forgotpassword form on my front-end. This works and generates reset password e-mails. But the reset url leads not to the front-end, but to the back-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've already tried to fix the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;setpassword template on the front-end (setpassword.html)&lt;/li&gt;&#xA;&lt;li&gt;route setpassword to setpassword.html&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2014-12-04T03:53:13.167" Title="Forgotpassword: wrong url in reset password e-mail" Tags="&lt;password&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4748" PostTypeId="2" ParentId="4745" CreationDate="2014-11-16T15:07:56.497" Score="1" Body="&lt;p&gt;I thought I might fill in a few extra details to support &lt;a href=&quot;https://craftcms.stackexchange.com/a/4746/784&quot;&gt;Tom De Smet's excellent answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only need one gallery then as Tom suggested you can change the section type from a &lt;code&gt;channel&lt;/code&gt; to a &lt;code&gt;single&lt;/code&gt; in the section's settings. Where you choose to display the gallery is completely up to you. It can either be displayed in it's own template (the one you define in the section's settings), or just as easily in any other template or page on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If displayed in its own template, and if using a &lt;code&gt;single&lt;/code&gt; then the template might be something like &lt;code&gt;gallery.html&lt;/code&gt; or &lt;code&gt;gallery/index.html&lt;/code&gt;, either of which could be accessed by the url &lt;code&gt;mysite.com/gallery&lt;/code&gt;. If using a channel (with one or more gallery entries) then a common convention would be to use &lt;code&gt;gallery/_entry.html&lt;/code&gt;, which could be accessed using the url &lt;code&gt;mysite.com/gallery/my-gallery-slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever a request is made to either of these uri patterns craft will automatically provide an &lt;code&gt;entry&lt;/code&gt; variable to the template populated with an &lt;code&gt;EntryModel&lt;/code&gt; for the gallery entry — in which case you do not need to retrieve the entry using &lt;code&gt;{% set entry = craft.entries.section('gallery').first() %}&lt;/code&gt; as &lt;code&gt;entry&lt;/code&gt; will already be pre-defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand you want to display the gallery somewhere else on your site (in some other template) then you will first need to retrieve the gallery entry using &lt;code&gt;{% set entry = craft.entries.section('gallery').first() %}&lt;/code&gt; or &lt;code&gt;{% set entry = craft.entries.section('gallery').slug('my-gallery-slug') %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep in mind that using a &lt;code&gt;structure&lt;/code&gt; with multiple &lt;code&gt;EntryTypes&lt;/code&gt; defined (one of which could be 'gallery') would be another way to essentially house various 'singles' together with the advantage that you can then generate heirarchical site navigation from the structure.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-16T16:49:32.767" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4749" PostTypeId="1" AcceptedAnswerId="4754" CreationDate="2014-11-16T15:08:19.737" Score="3" ViewCount="144" Body="&lt;p&gt;So I'm attempting to hack together a script to import thousands of entries and hundreds of categories from a bespoke system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have imported all the categories (around 800 of them) successfully. The category group they've been imported into has a 'relatedCategories' field so that each category can optionally be related to other categories in the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now looking to do a second pass to import the related categories,  this is the part I can't quite get my head round.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The story so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $db = new DbConnection(***);&#xA;    $db-&amp;gt;charset = 'utf8';&#xA;&#xA;    $entries = $db-&amp;gt;createCommand()&#xA;        -&amp;gt;setText('SELECT * FROM categories')&#xA;        -&amp;gt;queryAll();&#xA;&#xA;    foreach ($entries as $entry)&#xA;    {&#xA;        $craftcat_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;        $craftcat_criteria-&amp;gt;title = $entry['title'];&#xA;        $craftcat = $craftcat_criteria-&amp;gt;first();&#xA;&#xA;        $related_array = array_filter(explode('#',$entry['similar']));&#xA;&#xA;        $relatedcats = [];&#xA;&#xA;        foreach ($related_array as $related_item)&#xA;        {&#xA;            $related_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;            $related_criteria-&amp;gt;title = $related_item;&#xA;&#xA;            $related_cat = $related_criteria-&amp;gt;first();&#xA;&#xA;            $relatedcats[] = $related_cat-&amp;gt;id;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I have the ElementCriteriaModel for the category and an array containing the ID of each of the related categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going on the basis that it's &lt;code&gt;craft()-&amp;gt;relations-&amp;gt;saveRelations()&lt;/code&gt; I need to use, but I just can't get the syntax right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give me a shove in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-16T18:10:22.783" Title="How to handle 'related' categories within import script" Tags="&lt;categories&gt;&lt;plugins&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4750" PostTypeId="2" ParentId="4747" CreationDate="2014-11-16T15:28:25.847" Score="3" Body="&lt;p&gt;I've found the problem: The test account had control panel privileges and was therefore redirected to the control panel set password page. This behaviour makes absolutely sense.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2014-11-16T15:28:25.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4751" PostTypeId="1" CreationDate="2014-11-16T16:22:53.040" Score="1" ViewCount="308" Body="&lt;p&gt;So I have a 'Single' that uses entries from different 'Structures'. I can choose one or more entries with the fieldtype. But often I want to select an entry that is not created yet .. so I have to go back create that entry and then select it .. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be so much easier if I could just say &quot;create a new entry&quot; right there &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/s/hx75q90umu2wpr3/2014-11-16%20at%2017.18%202x.png&quot; rel=&quot;nofollow&quot;&gt;What I mean&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a plugin for that or anything ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2014-11-16T18:00:04.180" Title="Add entry with the select-entry-modal-field" Tags="&lt;entries&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4752" PostTypeId="2" ParentId="4751" CreationDate="2014-11-16T18:00:04.180" Score="2" Body="&lt;p&gt;There isn't, as far as I'm aware of, but have a look at the &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Craft Plugin Library&lt;/a&gt;. If you write your own, you might have a look at the following to see an example of a modal that craft does use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var modal = Craft.createElementSelectorModal('Entry');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try typing that into your console on any page in the CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories use a different kind of model when double clicking a category item that actually saves data, so might have a look at that as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the &lt;a href=&quot;https://github.com/am-impact/amcommand&quot; rel=&quot;nofollow&quot;&gt;amcommand&lt;/a&gt; plugin provides a nice modal command palette with a command to create entries that also might be worth checking out.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-16T18:00:04.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4753" PostTypeId="1" CreationDate="2014-11-16T18:05:29.507" Score="1" ViewCount="1350" Body="&lt;p&gt;How do you get a list of the fields that are on an entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;{{ dump(entry.subentry) }}&lt;/code&gt; but that isn't any help ...&lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="9" LastEditDate="2014-11-16T18:24:51.673" LastActivityDate="2014-11-16T18:24:51.673" Title="How to get a list of fields on an entry" Tags="&lt;entries&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4754" PostTypeId="2" ParentId="4749" CreationDate="2014-11-16T18:10:22.783" Score="4" Body="&lt;p&gt;Sorted. This seems to work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$catFieldRecord = FieldRecord::model()-&amp;gt;findById(4);&#xA;$catFieldModel = FieldModel::populateModel($catFieldRecord);&#xA;&#xA;craft()-&amp;gt;relations-&amp;gt;saveRelations($catFieldModel, $craftcat, $relatedcats);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-16T18:10:22.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4755" PostTypeId="2" ParentId="4753" CreationDate="2014-11-16T18:24:48.100" Score="3" Body="&lt;p&gt;I think you can use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in entry.subentry[0].getFieldLayout().getFields() %}&#xA;    {{ field.getField().name }} {# or .handle #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might try a great little plugin called &lt;a href=&quot;https://github.com/adrianmacneil/craft-inspector&quot; rel=&quot;nofollow&quot;&gt;inspector&lt;/a&gt; that prints out all of the attributes and methods of an object using either filter &lt;code&gt;{{ entry.subentry|inspect }}&lt;/code&gt; or method &lt;code&gt;{{ inspect(entry.subentry) }}&lt;/code&gt; syntax. Its output is a little cleaner than dump, and nice for following the rabbit-hole.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-16T18:24:48.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4756" PostTypeId="1" CreationDate="2014-11-16T21:19:04.840" Score="2" ViewCount="437" Body="&lt;p&gt;Okay, first I know this question has been asked - specifically here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1643/live-preview-not-automatically-updating&quot;&gt;Live preview not automatically updating&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that suggestion did not help. I have no console errors, no network errors. In fact, when I view the network tab in Chrome I can see it successfully POSTing the changes as I type in live preview mode. I have this set up on MAMP using craft.dev as the hostname.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this in both Chrome and FireFox with no luck, as well as trying a fresh install of Craft with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts are greatly appreciated on what the issue might be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="998" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2019-01-22T11:22:30.350" Title="Live Preview Not Updating - No errors found" Tags="&lt;javascript&gt;&lt;editor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4757" PostTypeId="2" ParentId="4756" CreationDate="2014-11-16T22:36:00.257" Score="2" Body="&lt;p&gt;Okay, so I figured this out and its a very stupid twig template noob mistake on my part. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mistake is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a section called 'demo' with a field called 'demoField' and created a template folder called 'demo' with an index.html file inside. The mistake is that my template had this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('demo').find() %}&#xA;    {{ entry.demoField }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at it now, this won't work, but simply &lt;code&gt;{{ entry.demoField }}&lt;/code&gt; will work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It threw me off because it was still showing the content in the template and saving it to the database, but the live preview would simply not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quite a silly mistake, but just starting out I completely missed this. Hopefully this will help someone in the future.&lt;/p&gt;&#xA;" OwnerUserId="998" LastActivityDate="2014-11-16T22:36:00.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4758" PostTypeId="2" ParentId="4634" CreationDate="2014-11-17T09:39:31.860" Score="1" Body="&lt;p&gt;You might want to check out this tutorial on using vagrant with craft. You could use this as an alternative to MAMP. &#xA;&lt;a href=&quot;http://straightupcraft.com/articles/setting-up-craft-with-vagrant&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/articles/setting-up-craft-with-vagrant&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2014-11-17T09:39:31.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4759" PostTypeId="1" CreationDate="2014-11-17T11:08:22.087" Score="2" ViewCount="253" Body="&lt;p&gt;I'm attempting to pull out a list of categories starting with certain letter(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've come up with so far seems a little excessive and I'm wondering if I've missed something obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can it all be done with just the 'craft.categories...' line?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCats = craft.categories.group('listingCategories').order('title').limit(null).find() %}&#xA;{% set allCatsByLetter = allCats|group('title | first') %}&#xA;&#xA;{% for letter, allCats in allCatsByLetter if letter == &quot;A&quot; %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for cat in allCats %}&#xA;            &amp;lt;li&amp;gt;{{ cat.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-17T17:35:11.217" Title="Selecting categories by first letter" Tags="&lt;templating&gt;&lt;categories&gt;&lt;array&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4760" PostTypeId="2" ParentId="4634" CreationDate="2014-11-17T11:26:46.667" Score="2" Body="&lt;p&gt;I've been using &lt;a href=&quot;http://laravel.com/docs/4.2/homestead&quot; rel=&quot;nofollow&quot;&gt;Laravel Homestead&lt;/a&gt; for local dev (and &lt;a href=&quot;https://forge.laravel.com&quot; rel=&quot;nofollow&quot;&gt;Forge&lt;/a&gt; controlled VPS' for staging). Both have been hugely successful for me – I've not touched MAMP for months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft works off-the-shelf with both.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-17T11:26:46.667" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4761" PostTypeId="1" AcceptedAnswerId="4765" CreationDate="2014-11-17T14:27:21.647" Score="2" ViewCount="1215" Body="&lt;p&gt;I have a simple &lt;a href=&quot;http://buildwithcraft.com/docs/templating/rss-feed&quot; rel=&quot;nofollow&quot;&gt;rss feed&lt;/a&gt; in my Templates directory, appropriately named &quot;feed.rss&quot;. I'm trying to create a link to that file but I don't want that to show up if the file doesn't exist. How might be the best way to only show the link, if the file exists?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-11-17T17:28:58.957" Title="Check if file exists" Tags="&lt;rss&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4762" PostTypeId="1" AcceptedAnswerId="4780" CreationDate="2014-11-17T17:00:02.900" Score="4" ViewCount="2773" Body="&lt;p&gt;I have a local asset folder defined with name 'Local storage' file system path &lt;code&gt;../public/cms/images/&lt;/code&gt;, and URL &lt;code&gt;/cms/images/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create an Assets field named 'Hero image', not restricted to a single folder, with source 'Local storage', and default upload location 'Local storage' with path &lt;code&gt;heroes/{slug}/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd expect uploads for Hero image to land in the &lt;code&gt;/public/cms/images/heroes/{slug}&lt;/code&gt; folder. When I do upload an asset, this folder is created, yet the asset lands in the root &lt;code&gt;/public/cms/images&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why might this be?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2017-08-08T21:47:04.840" Title="Uploaded assets not saving in specified local folder" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4763" PostTypeId="1" CreationDate="2014-11-17T17:11:34.320" Score="2" ViewCount="2794" Body="&lt;p&gt;All of my assets have fields for alt text and I understand how to access that info from an asset field, but can not figure out how to do it when an image has been inserted using Redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2014-11-17T18:00:16.800" Title="Adding alt tag to an image" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4764" PostTypeId="1" AcceptedAnswerId="4767" CreationDate="2014-11-17T17:17:04.927" Score="2" ViewCount="654" Body="&lt;p&gt;This is probably a really basic question, but I can't figure out how to check the status of a page before I link to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a link in my footer to 'Policy' page. But if the page status is inactive, I don't want that link to show. How can I perform this simple check?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="125" LastEditDate="2014-11-17T17:40:16.487" LastActivityDate="2014-11-18T09:44:19.557" Title="How to link to a page, but only if the page status is active" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4765" PostTypeId="2" ParentId="4761" CreationDate="2014-11-17T17:28:58.957" Score="4" Body="&lt;p&gt;I don't think it's possible to do with out-of-the-box Twig/Craft, but it's a super-easy &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; to write.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you'd need is to give your plugin a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt; so that you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.myAwesomePlugin.fileExists('somePath') %}&#xA;    YES&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your &lt;code&gt;MyAwesomePluginVariable&lt;/code&gt; class has a method like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function fileExists($path)&#xA;{&#xA;    return IOHelper::fileExists($path);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-17T17:28:58.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4766" PostTypeId="2" ParentId="4759" CreationDate="2014-11-17T17:35:11.217" Score="2" Body="&lt;p&gt;If you don't mind using the search parameter you could add it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set beer = 'a' %}&#xA;{% set allCats = craft.categories.search('title:' ~ beer ~ '*').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-17T17:35:11.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4767" PostTypeId="2" ParentId="4764" CreationDate="2014-11-17T17:36:33.317" Score="4" Body="&lt;p&gt;This should work. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set policy = craft.entries.section('policy').first() %}&#xA;{% if policy %}&amp;lt;a href=&quot;{{ policy.url }}&quot;&amp;gt;{{ policy.title }}&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ElementCriteriaModel&lt;/code&gt; should only return active records by default.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-17T17:36:33.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4768" PostTypeId="2" ParentId="4763" CreationDate="2014-11-17T17:55:03.263" Score="3" Body="&lt;p&gt;For &lt;code&gt;alt&lt;/code&gt; tag content you can just click the image in the richtext field, hit the 'edit' button and add a title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know there is no way to integrate an &lt;code&gt;alt&lt;/code&gt; text field (or any other fields) from assets without writing a custom redactor plugin. I posted a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4559/is-there-a-way-integrate-redactor-with-your-assets-fields&quot;&gt;similar question here&lt;/a&gt; and the only solution was to use a matrix field instead. But I too would love to hear about any other options.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-17T18:00:16.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4769" PostTypeId="2" ParentId="4763" CreationDate="2014-11-17T18:00:06.353" Score="1" Body="&lt;p&gt;I think you simply can't set it from the redactor editor. But because asset meta fields are saved &quot;globally&quot; and not &quot;per entry&quot;, you can enter the content from the CP's assets section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that probably won't help you much, because there's no out-of-box solution to output the fields data in your template. You would need to extent Redactor with a plugin and I'm not sure if you can modify how images are handled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But like Douglas said, the best solution around this is to use Matrix instead.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-17T18:00:06.353" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4770" PostTypeId="1" CreationDate="2014-11-17T18:21:18.133" Score="2" ViewCount="1158" Body="&lt;p&gt;What is the best way to create a simple (one level) navigation that also have active class?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My section types are singles only for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="997" LastEditorUserId="125" LastEditDate="2014-11-18T12:26:52.863" LastActivityDate="2014-11-18T12:26:52.863" Title="Simple navigation with active class?" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4771" PostTypeId="1" CreationDate="2014-11-17T19:36:20.373" Score="4" ViewCount="305" Body="&lt;p&gt;I have a cool upcoming project which its content will heavily depend on external images. Although I'd like to get rid of WordPress for this project and would love to use Craft, WP has a great plugin called &lt;a href=&quot;https://wordpress.org/plugins/save-grab/&quot; rel=&quot;nofollow&quot;&gt;Grab &amp;amp; Save&lt;/a&gt;, that allows you to grab and save images from remote urls into your own WP media library. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if Craft has a similar plugin or functionality, which it would be a huge time saver for these kind of projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without wanting to sound cheeky, would anyone with a bit of free time care to help me out a noobie and write it for me? I can't make head or tail of programming :/ heh.  &lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2014-11-17T22:12:09.010" LastActivityDate="2015-01-16T23:04:21.523" Title="Grab and save image from url to Craft?" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4772" PostTypeId="2" ParentId="4770" CreationDate="2014-11-17T19:43:23.993" Score="4" Body="&lt;p&gt;If you just want to set the active class on static nav then you can just create a conditional using any defining attribute (i.e. title, slug, id, uri-segment, etc). Here is an example using the uri-segment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set uriSegment = craft.request.segment(1) %}&#xA;&amp;lt;ul class=&quot;primary-nav&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a {% if uriSegment == &quot;about&quot; %}class=&quot;active&quot;{% endif %}&quot; href=&quot;about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a {% if uriSegment == &quot;projects&quot; %}class=&quot;active&quot;{% endif %} href=&quot;projects&quot;&amp;gt;Projects&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a {% if uriSegment == &quot;news&quot; %}class=&quot;active&quot;{% endif %} href=&quot;news&quot;&amp;gt;News&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {li}etc&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more dynamic nav:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singles are not particularly good for creating dynamic nav because there is no built in order or relationship between the items or even a way to identify if they are pages vs some other miscellaneous content. So you will generally have to employ some other strategy instead of, or in addition to, your singles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to create a more dynamic nav, then there are a few ways to go:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a separate &lt;code&gt;structure&lt;/code&gt; (named 'primary-nav' for example) that links to the corresponding &lt;code&gt;singles&lt;/code&gt; via an &lt;code&gt;entries&lt;/code&gt; field (set to limit 1). See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/64/how-to-write-simple-navigation/87#87&quot;&gt;this question&lt;/a&gt; for an example.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of &lt;code&gt;singles&lt;/code&gt;, opt to use a &lt;code&gt;structure&lt;/code&gt; (named 'pages'  for example) with different &lt;code&gt;Entry Types&lt;/code&gt; defined for each of your page layouts. You can then use &lt;code&gt;entry.type&lt;/code&gt; or &lt;code&gt;craft.request.segment(1)&lt;/code&gt; in your template to set the 'active' class and load the appropriate sub-template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use one of the navigation plugins designed specifically to create page navigation, like &lt;a href=&quot;http://straightupcraft.com/craft-plugins/a-m-navigation&quot; rel=&quot;nofollow noreferrer&quot;&gt;a&amp;amp;m navigation&lt;/a&gt; or &lt;a href=&quot;http://straightupcraft.com/craft-plugins/craftnav&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft nav&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2014-11-17T21:26:33.370" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4773" PostTypeId="2" ParentId="4771" CreationDate="2014-11-17T19:46:09.533" Score="1" Body="&lt;p&gt;Until the plugin store officially becomes a thing, the most up-to-date list of plugins available for Craft is &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing anything that does exactly what you're looking for and Craft doesn't have that functionality natively, but it doesn't seem like too difficult of a plugin to write.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-17T19:46:09.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4774" PostTypeId="1" AcceptedAnswerId="4776" CreationDate="2014-11-17T21:08:52.030" Score="2" ViewCount="878" Body="&lt;p&gt;Does Craft have any default keys for flash messages like logging in or updating a profile?&lt;/p&gt;&#xA;" OwnerUserId="970" LastActivityDate="2014-11-17T21:32:37.153" Title="Does Craft have any default keys for flash messages?" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;session&gt;&lt;login&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4775" PostTypeId="1" CreationDate="2014-11-17T21:21:18.737" Score="3" ViewCount="96" Body="&lt;p&gt;I've searched these boards and haven't been able to find the answer to my specific question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on building my navigation, and I want to build it in a structure. It will be a multi-level navigation, which is why it makes sense for a structure. However, I've already built a separate structure for a sermon catalog that I want to keep separate from the navigation structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to be able to link to a separate structure within my navigation structure. Is this possible? Is there a better way to do this that I haven't grasped yet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Navigation Structure Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Home&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.About&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Directions&lt;/li&gt;&#xA;&lt;li&gt;Staff&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;3.Watch (I want this to link to my sermon structure)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4.Kids &amp;amp; Students&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Highschoolers&lt;/li&gt;&#xA;&lt;li&gt;Middleschoolers&lt;/li&gt;&#xA;&lt;li&gt;K-5th&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I've tried adding in an entry type to navigation and linking to the structure, but it won't let me link to the actual structure. Just entries inside the structure. Which is not what I want. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="937" LastEditorUserId="937" LastEditDate="2014-11-17T21:50:20.550" LastActivityDate="2014-11-17T21:50:48.050" Title="Explanation of how to link to a structure from a structure" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4776" PostTypeId="2" ParentId="4774" CreationDate="2014-11-17T21:32:37.153" Score="2" Body="&lt;p&gt;Not particularly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UserSessionService has &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService#setNotice-detail&quot; rel=&quot;nofollow&quot;&gt;setNotice()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService#setError-detail&quot; rel=&quot;nofollow&quot;&gt;setErrors()&lt;/a&gt;, which are just wrappers for Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CWebUser#setFlash-detail&quot; rel=&quot;nofollow&quot;&gt;setFlash()&lt;/a&gt; where we pass in an &lt;code&gt;'error'&lt;/code&gt; or &lt;code&gt;'notice'&lt;/code&gt; for the key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yii will take than and prepend the &lt;code&gt;FLASH_KEY_PREFIX&lt;/code&gt; const which we set to &lt;code&gt;Craft.UserSessionService.flash.&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So an error's key will end up being &lt;code&gt;Craft.UserSessionService.flash.error&lt;/code&gt; and a notice will be &lt;code&gt;Craft.UserSessionService.flash.notice&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-17T21:32:37.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4777" PostTypeId="2" ParentId="4775" CreationDate="2014-11-17T21:50:48.050" Score="3" Body="&lt;p&gt;I'll assume that 'watch' is a landing page in which you want to list out the various sermons from the sermons structure. In which case you can retrieve and display those in the 'watch' template using a &lt;code&gt;for...in&lt;/code&gt; or a &lt;code&gt;nav...in&lt;/code&gt; loop. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sermons = craft.entries.section('sermons').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav sermon in sermons %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ sermon.url }}&quot;&amp;gt;{{ sermon.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% if children %}&#xA;            {% children %}&#xA;        {% endif %}&#xA;    {% end for %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your 'sermons' section settings you can then set the top-level uri to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;watch/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the nested uri to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this way, you can set the uri's to match up nicely, with the index page as 'watch' and the sermon entries as 'watch/sermon-parent-slug/sermon-slug'&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-17T21:50:48.050" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4778" PostTypeId="2" ParentId="4716" CreationDate="2014-11-17T23:40:28.827" Score="3" Body="&lt;p&gt;Currently the only thing Craft does in &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;BaseModel-&gt;setAttribute()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/records/BaseRecord#prepAttributesForUse-detail&quot; rel=&quot;nofollow&quot;&gt;BaseRecord-&gt;prepAttributesForUse()&lt;/a&gt; is some normalization when the attribute in either case happens to be &lt;a href=&quot;http://buildwithcraft.com/classreference/enums/AttributeType&quot; rel=&quot;nofollow&quot;&gt;AttributeType::DateTime or AttributeType::Mixed&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other attribute types will be returned directly as the database returned them (as a string).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I agree with you that we probably should be doing more to return the exact type as the attribute specifies.  Since that's potentially a big breaking change, though, it'll have to wait until Craft 3.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news is, thanks to PHP's loose typing system, you can still workaround most cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example a bool will come back as either the string &lt;code&gt;'1'&lt;/code&gt; or &lt;code&gt;'0'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using that in a PHP conditional &lt;code&gt;if ($myModel-&amp;gt;boolAttribute)&lt;/code&gt; will evaluate to true or false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using your float example: &lt;code&gt;'1402.50' + 100.00&lt;/code&gt;, PHP will properly cast that to &lt;code&gt;1502.50&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-17T23:40:28.827" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4779" PostTypeId="1" AcceptedAnswerId="4781" CreationDate="2014-11-18T00:14:54.600" Score="2" ViewCount="915" Body="&lt;p&gt;I'm trying to set up a front end form where the user can choose their city and state, which are stored as categories. I have states set up as the parent category and individual cities as sub categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to have the two select fields tied together so that when the state is chosen, the other select field is narrowed down to the cities in that state and vice-versa, e.g. if a user chooses Chicago only the Illinois select field should be available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choose San Francisco --&gt; California is selected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choose Colorado -- &gt; Only Colorado cities are available&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the two select fields. I know that using .level('1') and .level('2') is the wrong way, but I'm not sure what the correct way would be.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userOptionIds = user.providerArea.limit(null).ids() %}&#xA;&#xA;&amp;lt;label for=&quot;locationCategories&quot;&amp;gt;Parent locationCategories:&amp;lt;/label&amp;gt;&#xA;{% set parentCategories = craft.categories.group('locationCategories').level('1') %}&#xA;&#xA;    &amp;lt;select id=&quot;providerArea&quot; name=&quot;fields[providerArea][]&quot;&amp;gt;&#xA;    {% for category in parentCategories %}&#xA;        &amp;lt;option id=&quot;locationCategories&quot; name=&quot;fields[locationCategories]&quot; {% if category.id in userOptionIds %}selected{% endif %} value=&quot;{{ category.id }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;locationCategories&quot;&amp;gt;Child locationCategories:&amp;lt;/label&amp;gt;&#xA;{% set childCategories = craft.categories.group('locationCategories').level('2') %}&#xA;&#xA;    &amp;lt;select id=&quot;providerArea&quot; name=&quot;fields[providerArea][]&quot;&amp;gt;&#xA;    {% for category in childCategories %}&#xA;       &amp;lt;option id=&quot;locationCategories&quot; name=&quot;fields[locationCategories]&quot; {% if category.id in userOptionIds %}selected{% endif %} value=&quot;{{ category.id }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}}&#xA;    &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20" LastActivityDate="2014-11-18T03:50:52.177" Title="Tie two select fields together based on category and subcategory?" Tags="&lt;categories&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4780" PostTypeId="2" ParentId="4762" CreationDate="2014-11-18T03:07:55.580" Score="5" Body="&lt;p&gt;This answer really belongs to Brad, as he mentioned it to me. But he doesn't really need the points, does he ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want in that slot is {owner.slug}, and then the proper sub-path will ensue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The explanation is deep in the doc page at: &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields&quot;&gt;http://buildwithcraft.com/docs/assets-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wit, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Note that if you are creating the Assets field within a Matrix field,&#xA;  the source element is going to be the actual Matrix block, not the&#xA;  element that the Matrix field is being created on. So if your Matrix&#xA;  field is attached to an entry, and you want to output the entry ID in&#xA;  your dynamic subfolder path, you would type {owner.id} not just {id}.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="85" LastActivityDate="2014-11-18T03:07:55.580" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="4781" PostTypeId="2" ParentId="4779" CreationDate="2014-11-18T03:50:52.177" Score="2" Body="&lt;p&gt;You would need to implement a front-end solution of some kind using jquery and ajax, that listens to the &lt;code&gt;.on('change')&lt;/code&gt; event on the select fields and loads the corresponding data from a template (i.e. '_cityState.html') using the selected city or state as post parameters; and then repopulate the other select field's options dynamically by setting the html of the select field to the return results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at jquery's &lt;a href=&quot;http://api.jquery.com/on/&quot; rel=&quot;nofollow&quot;&gt;.on('change')&lt;/a&gt; event and &lt;a href=&quot;http://api.jquery.com/jQuery.ajax/&quot; rel=&quot;nofollow&quot;&gt;$.ajax()&lt;/a&gt; and &lt;a href=&quot;http://api.jquery.com/html/&quot; rel=&quot;nofollow&quot;&gt;.html()&lt;/a&gt; methods for more information on the jQuery part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your ajax only '_cityState.html' template you would want something like this: (note: this assumes that cities and states have a 'code' field that will represent the drop-down option value, but modify as needed):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;&#xA;    {# retreive the passed city or state code #}&#xA;    {% set city = craft.request.getParam('city') %}&#xA;    {% set state = craft.request.getParam('state') %}&#xA;&#xA;    {% if city or state %}&#xA;&#xA;        {% if city %}&#xA;&#xA;            {# get all states; set the selected state to parent of 'city' #}&#xA;            {% set entries = craft.categories.group('locationCategories').limit(null).level(1) %}&#xA;            {% set selected = craft.categories.group('locationCategories).code(city).first().parent %}&#xA;&#xA;        {% else %}&#xA;&#xA;            {# get all cities that are a decendent of 'state'; set selected to first city #}&#xA;            {% set entries = craft.categories.group('locationCategories').limit(null).code(state).first().decedents(1) %}&#xA;            {% set selected = entries.first() %}&#xA;&#xA;        {% endif %}&#xA;&#xA;        {# build the return html #}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;option value={{ entry.code }} label=&quot;{{ entry.title }}&quot; {% if entry == selected %}selected{% endif %}/&amp;gt; &#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested. But should be pretty close. If anyone sees any errors, please edit or leave a comment.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-18T03:50:52.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4782" PostTypeId="1" AcceptedAnswerId="4783" CreationDate="2014-11-18T08:40:51.743" Score="6" ViewCount="1309" Body="&lt;p&gt;I have a structure which controls my main site navigation.&#xA;It's the same across the site so it is best to cache globally as opposed to a cache of the navigation or every url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last answer on this pages says that you can use Twig's replace filter to achieve this:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1473/would-you-use-a-structure-as-navigation-over-multiple-sections-channel-entries&quot;&gt;Would you use a Structure as navigation over multiple sections (channel entries, indexes and singles)?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code below shows the active class being placed on the li tag but that doesn't work with the cache globally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can it be done with Twig's replace filter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally for 3 years %}&#xA;  {% set entries = craft.entries.section('navigation') %}&#xA;&#xA;  &amp;lt;ul class=&quot;right&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;    &amp;lt;li class=&quot;{{ entry.hasDescendants() ? 'has-dropdown' : &quot;&quot; }}{{ craft.request.segment(1) == entry.slug ? ' active' : &quot;&quot; }}&quot;&amp;gt;&#xA;      {# Check for entry type / get related entry #}&#xA;      {% if entry.type == 'customLink' %}&#xA;        {# Link to a custom url #}&#xA;        &amp;lt;a href=&quot;{{ entry.customUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;      {% elseif entry.type == 'relatedEntryLink' %}&#xA;        {% set linkedEntry = entry.relatedEntry.limit(1).first() %}&#xA;        &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;      {% else %}&#xA;        {# Link to a structure entry #}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;      {# Repeat this for child entries #}&#xA;      {% ifchildren %}&#xA;      &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endcache %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2018-10-22T10:29:11.300" Title="Adding active class to globally cached navigation" Tags="&lt;cache&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4783" PostTypeId="2" ParentId="4782" CreationDate="2014-11-18T09:09:23.037" Score="18" Body="&lt;p&gt;Yes, you can!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing you need to do is to add the entire cached content into a single variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation %}&#xA;    {% cache globally for 3 years %}&#xA;        {# YOUR CACHED CONTENT #}&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you need to add some dummy placeholder tags on your &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; tag and your &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag which then can be used by &lt;code&gt;|replace&lt;/code&gt; filter to make the replacement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;{{ entry.hasDescendants() ? 'has-dropdown' : &quot;&quot; }} data-class-{{entry.slug}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; (You need to modify this for each different entry type)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url}}&quot; data-url=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After all this you'll have special &quot;tags&quot; in your cached content that you can run some replacement on, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ navigation|replace({('data-url=&quot;' ~ craft.request.getUrl() ~ '&quot;'): 'class=&quot;active&quot;'})|replace({('data-class-' ~ craft.request.segment(1)): 'active'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;You can run two &lt;code&gt;|replace&lt;/code&gt; filters after each other, you could just split them up into two steps. Also, this code is untested - I just wrote it from my head so please be aware there might be some typos etc..&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="6225" LastEditDate="2018-10-22T10:29:11.300" LastActivityDate="2018-10-22T10:29:11.300" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4784" PostTypeId="2" ParentId="4691" CreationDate="2014-11-18T09:43:56.273" Score="1" Body="&lt;p&gt;If the native solutions seem a bit involved, or if you want some additional calendar processing power for your events &lt;em&gt;(recurring events, calendar display, etc.)&lt;/em&gt;, there's also &lt;strong&gt;Craft Calendars&lt;/strong&gt;: &lt;a href=&quot;http://michaelrog.com/craft/calendars&quot; rel=&quot;nofollow&quot;&gt;http://michaelrog.com/craft/calendars&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-11-18T09:43:56.273" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4785" PostTypeId="2" ParentId="4764" CreationDate="2014-11-18T09:44:19.557" Score="0" Body="&lt;p&gt;&lt;strong&gt;Plugin alternative:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function statusIsLive($handle) {&#xA;    $section = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle($handle);&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = $section;&#xA;    return craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-11-18T09:44:19.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4786" PostTypeId="1" CreationDate="2014-11-18T09:53:31.343" Score="4" ViewCount="305" Body="&lt;p&gt;I was looking for a way to set arbitrary PHP constants in the index.php that could then be accessed within templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is particularly useful if you have more than one index/domain pulling content from a core Craft install as the additional domains won't have any configuration files to use, just index.php.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-18T09:53:31.343" Title="Setting arbitrary PHP constants in index.php" Tags="&lt;variable&gt;&lt;php&gt;&lt;index&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4787" PostTypeId="2" ParentId="4786" CreationDate="2014-11-18T09:53:31.343" Score="5" Body="&lt;p&gt;&lt;em&gt;Hat-tip to Brad for finding this answer.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be achieved with something like the following in your index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('BRADS_FAVORITE_HOBBY', &quot;Drinking&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/constant.html&quot; rel=&quot;noreferrer&quot;&gt;power to Twig&lt;/a&gt;, you can then access this in your templates using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ constant('BRADS_FAVORITE_HOBBY') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-18T09:53:31.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4788" PostTypeId="1" CreationDate="2014-11-18T10:01:47.880" Score="1" ViewCount="213" Body="&lt;p&gt;The &lt;code&gt;if&lt;/code&gt; statement on Line 859 of &lt;code&gt;TemplatesService.php&lt;/code&gt; prevent the template service from loading templates from a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a specific reason for this, or is it simply a case that hasn't been needed for the command line interface yet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use the template service to render various things like report emails. Is there another way I can do this from the CLI at the moment?&lt;/p&gt;&#xA;" OwnerUserId="965" LastActivityDate="2015-02-16T20:45:33.943" Title="Plugin template's are not available from console commands" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4789" PostTypeId="1" AcceptedAnswerId="4792" CreationDate="2014-11-18T10:11:18.610" Score="2" ViewCount="573" Body="&lt;p&gt;I'm developing a masonry photo gallery with some filters (colors, style, manufacturer, etc) and I want to use tags to filter them by. I need some navigation which should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;Tag Group 1&#xA;        &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;Tag 1&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;Tag 2&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;Tag Group 2&#xA;        &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;Tag 3&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;tag 4&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I read this article &lt;a href=&quot;https://craftcms.com/support/active-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/active-tags&lt;/a&gt; but I can't figure out how to get all group tags and for them all the tags that are actualy in use. I think i should use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.group('blogTags') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I want to get all the group handles in a loop dynamically.&lt;/p&gt;&#xA;" OwnerUserId="1004" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:49.667" LastActivityDate="2017-11-09T19:38:49.667" Title="How do I list the tag groups that are actually in use?" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;tags&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4790" PostTypeId="1" AcceptedAnswerId="4791" CreationDate="2014-11-18T10:32:49.167" Score="2" ViewCount="1482" Body="&lt;p&gt;The date field is displaying dates in US format (mm/dd/yyyy) but I need the UK (dd/mm/yyyy) format. According to the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Dates and times are both formatted for the user’s preferred locale. They are displayed in the site’s timezone, however they get stored in UTC like all other dates in Craft.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does one set this? The timezone is set correctly in the site config.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-11-18T11:17:40.117" Title="Set site locale to display correct date format in date/time field" Tags="&lt;field&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4791" PostTypeId="2" ParentId="4790" CreationDate="2014-11-18T10:55:09.903" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Dates and times are both formatted for the user’s preferred locale.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You have to select your &quot;preferred locale&quot; when installing Craft. If you chose the wrong one  you (currently) can't undo it from the CP, but have to change it directly in the database (--&gt; &quot;craft_locales&quot; table).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way would be to install a second locale (even if you don't need it at all). Because if your Craft site is multilingual you can switch between installed locales from the user settings in the CP though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kC6BGm.png&quot; alt=&quot;CP user settings - preferred locale&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-18T11:17:40.117" LastActivityDate="2014-11-18T11:17:40.117" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4792" PostTypeId="2" ParentId="4789" CreationDate="2014-11-18T11:34:00.907" Score="4" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter to group your tags by tag groups:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('gallery').limit(null) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;    {# Get all the tags related to our gallery entries and group them by tag group #}&#xA;    {% set allGalleryTags = craft.tags.relatedTo(entries)|group('group') %}&#xA;&#xA;    {# Loop the tag groups #}&#xA;    {% for tagGroup, tagsInGroup in allGalleryTags %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ tagGroup }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;&#xA;                {# Loop the tags of this group #}&#xA;                {% for tag in tagsInGroup %}&#xA;                    &amp;lt;li&amp;gt;{{ tag.name }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-18T11:54:49.110" LastActivityDate="2014-11-18T11:54:49.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4794" PostTypeId="1" CreationDate="2014-11-18T15:49:02.847" Score="0" ViewCount="118" Body="&lt;p&gt;I came across a specific situation where I needed to list out all the values within a collection of Matrix fields on a single entry page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, I had a single entry that needed multiple team groups, each with the name, role, and description of various people. I then wanted to list them all out anywhere on the site (single or entry pages). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this solution helps people out. Feel free to critique.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-11-18T15:49:02.847" Title="How to list all Matrix Blocks from anywhere, using a slug?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4795" PostTypeId="2" ParentId="4794" CreationDate="2014-11-18T15:49:02.847" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% set entry = craft.entries.slug('team').last() %}&#xA;  {% for field in entry.getFieldLayout().getFields() %}&#xA;    {% if field.getField().type == &quot;Matrix&quot; %}&#xA;      {% set fieldHandle = field.getField().handle %}&#xA;      {% set matrixBlocks = entry.__get(fieldHandle).find() %}&#xA;      {% for block in matrixBlocks %}&#xA;        {{ block.team_name }}&#xA;      {% endfor %}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-11-18T15:49:02.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4796" PostTypeId="1" AcceptedAnswerId="4800" CreationDate="2014-11-18T16:07:07.070" Score="5" ViewCount="2045" Body="&lt;p&gt;I would like to fetch all entries apart from those of a specific type: 'chapter'. How do I achieve this with a standard call to 'craft.entries'?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;  'search': query,&#xA;  'order': 'score'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="770" LastActivityDate="2020-09-04T12:03:51.963" Title="Is it possible exclude an entry type from result of craft.entries?" Tags="&lt;entries&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4797" PostTypeId="2" ParentId="4796" CreationDate="2014-11-18T16:14:22.267" Score="1" Body="&lt;p&gt;You can target the entry by ID and tell it 'not' to include it. The example below will exclude the current entry page. You can replace &quot;#{entry.id}&quot; with the ID of the entry you want to exclude.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;  'id': &quot;not #{entry.id}&quot;,&#xA;  'search': query,&#xA;  'order': 'score'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2014-11-18T16:14:22.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4799" PostTypeId="1" AcceptedAnswerId="4815" CreationDate="2014-11-18T16:33:18.017" Score="2" ViewCount="157" Body="&lt;p&gt;The green bubble (status is enabled) next to the category items in the category overview suggests that you can disabled/enable the category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible? And if so, how? &lt;/p&gt;&#xA;" OwnerUserId="1005" LastActivityDate="2014-12-03T13:47:42.217" Title="How can I disable a category" Tags="&lt;category&gt;&lt;status&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4800" PostTypeId="2" ParentId="4796" CreationDate="2014-11-18T16:44:44.087" Score="7" Body="&lt;p&gt;Going through Craft's docs, I found no easy or official way to do this. Fastest possible way, in my opinion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all section IDs #}&#xA;{% set sections = craft.sections.getAllSections() %}&#xA;&#xA;{# get all entry types for sections #}&#xA;{% set entryTypes = [] %}&#xA;{% for section in sections %}&#xA;    {# exclude the entry type you don't want, add the others to 'entryTypes' variable&#xA;       you could, of course, replace handle by ID or whatever you like #}&#xA;    {% for entryType in section.getEntryTypes() if entryType.handle != 'handleToExclude' %}&#xA;        {% set entryTypes = entryTypes | merge([entryType]) %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.section('inhoud').type(entryTypes) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2018-08-17T10:14:35.813" LastActivityDate="2018-08-17T10:14:35.813" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="4802" PostTypeId="1" AcceptedAnswerId="4806" CreationDate="2014-11-18T17:24:39.200" Score="1" ViewCount="1724" Body="&lt;p&gt;Wondered what the best approach would be to get the url for a given entry page using only a slug for reference? I imagined it being something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function getPageURL($slug) {&#xA;    $page = craft()-&amp;gt;elements-&amp;gt;slug($slug);&#xA;    @return getURL($page);&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Usage example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ craft.PLUGINNAME.getPageURL(&quot;staff&quot;) }}&quot;&amp;gt;Staff&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastEditorUserId="125" LastEditDate="2014-11-18T23:25:30.190" LastActivityDate="2014-11-18T23:25:30.190" Title="Get a page URL using only the Slug?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4804" PostTypeId="1" CreationDate="2014-11-18T18:31:02.927" Score="1" ViewCount="229" Body="&lt;p&gt;We are just in the CMS evaluation stage, so, I have some early questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We don't want to create another layer of user logins, can Craft authenticate users using oauth or active directory?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As Craft users -&gt; Why is Craft better than Drupal, Wordpress, Joomla?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1006" LastActivityDate="2014-11-18T21:17:15.050" Title="Just starting to evaluate - some basic questions" Tags="&lt;authentication&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2014-11-18T23:03:55.220" ContentLicense="CC BY-SA 3.0" />
  <row Id="4805" PostTypeId="2" ParentId="4788" CreationDate="2014-11-18T18:31:46.217" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;is it simply a case that hasn't been needed for the command line interface yet?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Most likely this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you send your plugin over to support@buildwithcraft.com and point us to a command that will reproduce it so we can look into it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will update the answer here with what we find.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-18T18:31:46.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4806" PostTypeId="2" ParentId="4802" CreationDate="2014-11-18T18:40:16.277" Score="2" Body="&lt;p&gt;Completely untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getPageUrl($slug)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;slug = $slug;&#xA;    $entry = $criteria-&amp;gt;first();&#xA;&#xA;    if ($entry)&#xA;    {&#xA;        return UrlHelper::getUrl($entry-&amp;gt;uri);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-18T18:40:16.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4807" PostTypeId="2" ParentId="4804" CreationDate="2014-11-18T18:43:38.957" Score="2" Body="&lt;p&gt;For 1), check out Dukt's &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;oAuth plugin&lt;/a&gt; for Craft.  Not aware of any Active Directory plugins that have been written yet and not seeing any on &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question is pretty subjective, so not sure if that's the best type of question for SE, but I'll let someone else take a stab at it if they want.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-18T18:43:38.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4809" PostTypeId="1" AcceptedAnswerId="4814" CreationDate="2014-11-18T20:42:39.287" Score="2" ViewCount="960" Body="&lt;p&gt;I haven't used AJAX a lot, but what I want to do is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a top navigation that outputs entries from a structure which link to various singles that display my data.&#xA;I want my navigation to stay and not reload when going to another page. How would I implement AJAX combined with Craft for that?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2014-11-18T23:52:45.927" Title="Navigation with AJAX" Tags="&lt;navigation&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4810" PostTypeId="2" ParentId="4804" CreationDate="2014-11-18T21:17:15.050" Score="2" Body="&lt;p&gt;For 2, which is indeed subjective but nevertheless: Coming from WordPress, I always tell my customers that Craft is way better for us because I don't have to strip down a CMS before starting a project. WordPress did a lot of things without us even knowing about it. With Craft, I start with a blank sheet and work my way up, knowing exactly why things work the way they work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other plusses:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Flexibility and usability: The combination of Twig and Craft's sections and fields gives you more flexibility than WP would ever give you with custom fields. Twig's learning curve seems steep at first, but once you get used to it, you'll never want anything else.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Caching: Craft's {% cache %} tag makes caching page content easier than ever. No extra plugins needed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiple locales? No problem! Setting up multiple locales takes minutes, not ages. Again, no extra plugins needed (but, to be honest, you'd need Craft's Pro license).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Found a bug? The guys at P&amp;amp;T have proven to be a dedicated and professional team. It wouldn't be the first time I find a bug on thursday, and it's fixed in next friday's update.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matrix field. To hard to explain, look it up (&lt;a href=&quot;http://buildwithcraft.com/features/matrix&quot; rel=&quot;nofollow&quot;&gt;here, for example&lt;/a&gt;). WordPress, eat that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm getting a bit carried away here, and I think these are just a few of the many advantages of Craft over whatever open source CMS out there. If you want to know more, let me know!&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-18T21:17:15.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4812" PostTypeId="1" CreationDate="2014-11-18T21:25:49.113" Score="1" ViewCount="2606" Body="&lt;p&gt;If I enter a query into the search bar I would like to see an excerpt (let's say 140 characters) of each entry that is related to the query. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I use on the search result page to display the results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;{% if entries|length %}&#xA;&amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;&amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I add entry excerpts like: &lt;a href=&quot;https://craftcms.com/search?q=entry&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/search?q=entry&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1008" LastEditorUserId="3951" LastEditDate="2017-10-26T10:13:03.030" LastActivityDate="2017-10-26T10:13:03.030" Title="Get excerpt of entry from search query" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4813" PostTypeId="2" ParentId="4812" CreationDate="2014-11-18T22:07:22.960" Score="3" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter. To return 140 characters max. you would do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.body %}&#xA;    {{ entry.body|slice(0, 140) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/q/4361/125&quot;&gt;this other question&lt;/a&gt; on a similar topic if you want to apply this on a rich text field. Because this solution only works with plain text.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-18T22:16:02.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4814" PostTypeId="2" ParentId="4809" CreationDate="2014-11-18T22:36:52.943" Score="3" Body="&lt;p&gt;I'm not sure this is a really a Craft-specific question, but here's a basic strategy:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Build your nav and pages to work without any Ajax calls. Make sure your nav is output consistently (e.g. in &lt;code&gt;&amp;lt;nav class=&quot;primary-nav&quot;&lt;/code&gt;) as well as the content of the page (e.g. in &lt;code&gt;&amp;lt;div class=&quot;main&quot;&amp;gt;&lt;/code&gt;). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now implement your JavaScript. You want to (a) intercept navigation link clicks to stop a full page reload, (b) Ajax in the new content, (c) move the &lt;code&gt;active&lt;/code&gt; class to the clicked navigation link, and (d) change the URL to the new page address. Make sure to use &lt;a href=&quot;https://github.com/browserstate/history.js/&quot; rel=&quot;nofollow&quot;&gt;History.js&lt;/a&gt; to smooth out any difference in browser implementation of HTML5's history API (including pushState).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;http://jmuspratt.github.io/hijax-demo/&quot; rel=&quot;nofollow&quot;&gt;demo&lt;/a&gt; (and &lt;a href=&quot;https://github.com/jmuspratt/hijax-demo&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;) I cooked up with static HTML. It's based on Andrew Fricke's post titled &lt;a href=&quot;http://uhnomoli.com/2014/01/10/Rolling-your-own-PJAX-implementation-with-History.js/&quot; rel=&quot;nofollow&quot;&gt;Rolling your own PJAX Implementation with History.js&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="125" LastEditDate="2014-11-18T23:06:39.563" LastActivityDate="2014-11-18T23:06:39.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4815" PostTypeId="2" ParentId="4799" CreationDate="2014-11-18T23:35:17.553" Score="2" Body="&lt;p&gt;&lt;s&gt;I don't think you can disable categories with the current version of Craft. But you're right, it currently looks like that categories are prepared to get disabled.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories now have their own edit pages in Craft 2.3, where you can set the status. And you can even set it on a batch from the category index page!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-03T13:47:42.217" LastActivityDate="2014-12-03T13:47:42.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4816" PostTypeId="2" ParentId="4809" CreationDate="2014-11-18T23:52:45.927" Score="3" Body="&lt;p&gt;In addition to James Muspratt's excellent answer, I thought I might share some other tips that I have learned. In your page templates you can use conditionals to modify the behavior based on whether its an ajax request or not. In this way you can design your templates to work both as Ajax requests and as direct requests, which is great for SEO and other uses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem for example with ajax loaded templates is that live preview may not work in the CP if the template is not also designed to load in the header, css, js, nav, etc. One way around this is to extend a different template based on the type of request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends craft.request.isAjax and not craft.request.isLivePreview ? &quot;_ajax&quot; : &quot;_layout&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, if it's ajax I'm extending a template that has nothing but a content block defined; and it's not ajax then I'll extend the full template with head, js, css, nav, etc. The catch is that Live Preview also uses ajax, so we want the full template anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use the same method to return slightly modified content. In this case, I'm just loading the raw _product template for ajax requests and wrapping it as needed for non-ajax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;{% if craft.request.isAjax and not craft.request.isLivePreview %}&#xA;&#xA;    {# return the raw _product template #}&#xA;    {% include 'products/_product.html' %}&#xA;&#xA;{% else %}&#xA;&#xA;    {# return the modified _product template wrapped properly for the full page layout #}&#xA;    &amp;lt;section id=&quot;products&quot; class=&quot;products js-products&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;&#xA;            {% include 'products/_product.html' %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;{% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps a bit, and doesn't make things more confusing.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-18T23:52:45.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4817" PostTypeId="2" ParentId="4812" CreationDate="2014-11-19T09:19:30.850" Score="2" Body="&lt;p&gt;I use &lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Trimmer&quot; rel=&quot;nofollow&quot;&gt;Trimmer&lt;/a&gt; for this, it's pretty much the only plugin I use these days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know for sure, but I suspect P&amp;amp;T may use an 'excerpt' field to store a short sentence for use on the search results page, rather than cropping from longer copy.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-11-19T09:19:30.850" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4818" PostTypeId="1" CreationDate="2014-11-19T10:33:02.513" Score="0" ViewCount="213" Body="&lt;p&gt;I'm wondering: what is the best way to do complex queries for a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I'm building a site that publishes stories and sometimes the same story can be in different languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database tables would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;story { id, author, ...  }&#xA;storyTranslation { id, storyId, storyTitle, storyContent, locale }  &#xA;revision { storyId, storyTranslationId, revision, status }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to use scopes, and criteria but i was not able to make it work in the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to show latest stories (scope for story) that are in the currently selected language (scope for storyTranslation) and that has the latest revision with a status of 1 (scope for revision)  .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment of testing I have 2 stories, both have content in english but one of them does not have a revision data, however I still see this story in the list for some reason. It looks like the scopes are somehow not part of the main query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess i would like to be able to write the following query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM&#xA;    story AS s,&#xA;    storyTranslation AS st,&#xA;    revision AS r&#xA;WHERE&#xA;    st.storyId = s.id AND&#xA;    r.storyTranslationId = st.id AND&#xA;    st.locale = $locale AND&#xA;    r.status = $status&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All the tables have records and all the relations are set up. If I'm just querying using attributes it works but if the query grows longer than just single record I'm starting to get unexpected results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for help in advance. &lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="5437" LastEditDate="2016-08-01T06:32:15.470" LastActivityDate="2016-08-01T06:32:15.470" Title="Complex queries" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;records&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4819" PostTypeId="1" AcceptedAnswerId="4827" CreationDate="2014-11-19T11:11:02.910" Score="2" ViewCount="1749" Body="&lt;p&gt;Just wanted to check in to see if what i'm seeing is reasonable. Just trying to tweak the performance of a single-page Craft site, and basically working backwards to find bottlenecks. Following all the suggested items (devMode off, static assets caching, minimise db calls, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, working my way all the way back to a blank template file (no code at all), no plugins enabled, the page still take 250-300ms to load nothing at all. All this while running locally via MAMP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this an expected speed? I'm aware thats pretty fast, but would've thought locally would be near instantaneous. This will only get worse on a server (especially shared hosting).&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2014-11-20T22:12:12.207" Title="Slightly-slow page load for blank page" Tags="&lt;performance&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4820" PostTypeId="1" CreationDate="2014-11-19T11:17:49.707" Score="1" ViewCount="116" Body="&lt;p&gt;Using Craft Pro 2.2.2601, I am finding the asset selection mechanic a little confusing from a UX perspective when I am using {slug} in the asset field's 'Default Upload Location' to place assets in correct subfolders. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I drag assets directly onto an asset field, it places the asset in the specified subfolder correctly. However, when I click on the Add an Asset button, the asset dialog opens with the root asset folder selected, so clicking the Upload files button causes the file to be added to the root folder by default. When this happens, the {slug} subfolder is generated anyway, with no contents. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would make more sense to me if this generated subfolder was automatically selected so that the asset is placed in there. Having to navigate down the directory structure manually is a bit annoying and fiddly, and if a client forgets to do this then they are left with an empty {slug} subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or intended behaviour?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2014-11-21T18:27:35.263" Title="Should the initial selected subfolder in the 'Add an asset' dialog be the Default Upload Location?" Tags="&lt;assets&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-11-30T04:36:16.423" ContentLicense="CC BY-SA 3.0" />
  <row Id="4821" PostTypeId="1" AcceptedAnswerId="4824" CreationDate="2014-11-19T16:09:15.097" Score="1" ViewCount="656" Body="&lt;p&gt;This is the code used to display entries related to categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue: if an entry belongs to 2 categories, it displays all the categories to which it belongs on the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need Craft to display only the category and entries the (lastSeg) of the slug (selected from a nav).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't find where to start?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('contenuCompositions').relatedTo(category).order('dateYear','comp_opus','title').limit(0) %}&#xA;{% for category in craft.categories.group('compositions').relatedTo(entries).level(2).slug(lastSeg) %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ category }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% for row in entries.relatedTo(category)|batch(3) %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for entry in row %}&#xA;      &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastActivityDate="2014-11-19T17:09:58.047" Title="List entries related to several categories" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4822" PostTypeId="2" ParentId="4819" CreationDate="2014-11-19T16:37:04.513" Score="3" Body="&lt;p&gt;There is an excellent article on &lt;a href=&quot;http://www.patpohler.com/performance-optimization-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;optimizing performance in craft&lt;/a&gt; from Pat Pohler you might want to check out. He goes through every detail meticulously looking for speed load gains. Good read.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-19T16:37:04.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4823" PostTypeId="2" ParentId="4716" CreationDate="2014-11-19T16:59:04.440" Score="3" Body="&lt;p&gt;I ended up overriding BaseModel-&gt;setAttribute() and BaseRecord-&gt;prepAttributesForUse() in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works well! Right now I'm just handling Bool and Number types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Posted this solution here: &lt;a href=&quot;http://craftcookbook.net/recipes/324&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/324&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2014-11-19T22:10:43.267" LastActivityDate="2014-11-19T22:10:43.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4824" PostTypeId="2" ParentId="4821" CreationDate="2014-11-19T17:09:58.047" Score="2" Body="&lt;p&gt;Not sure if this is still what you are after (I removed a lot of parameters), but basically this gets the one (!) category with the unique (!) slug you request from the URL and then lists the entries related to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getLastSegment() %}&#xA;{% set category = craft.categories.group('compositions').slug(categorySlug).first() %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set entries = craft.entries.section('contenuCompositions').relatedTo(category) %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-19T17:09:58.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4826" PostTypeId="1" CreationDate="2014-11-19T17:38:45.030" Score="4" ViewCount="1820" Body="&lt;p&gt;I would like to override or include a custom redactor.css file so that I can match the typography of the rich text editor contents with the site's stylesheet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The path to redactor.css is hard-coded into the application (craft/app/fieldtypes/RichTextFieldType.php - line 281), and obviously I don't want to change this file or the redactor.css file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there at least a way to inject a custom css file into the admin pages so that the core/base styles can be overridden?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Both plugin solutions below worked, but because craft includes redactor.css &lt;em&gt;after&lt;/em&gt; the plugin's css include is inserted, the trick is to make your css selectors more specific, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor_.redactor_editor h1 { font-size: 48px !important; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1013" LastEditorUserId="1013" LastEditDate="2014-11-19T19:46:43.690" LastActivityDate="2014-11-19T19:46:43.690" Title="Custom redactor.css file" Tags="&lt;richtext&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4827" PostTypeId="2" ParentId="4819" CreationDate="2014-11-19T17:48:36.383" Score="3" Body="&lt;p&gt;It's on our list to improve the 2-300ms time to first byte you're seeing as well, but that won't happen until after Yii 2/Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-19T17:48:36.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4828" PostTypeId="2" ParentId="4826" CreationDate="2014-11-19T18:15:28.373" Score="2" Body="&lt;p&gt;Use the &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft/&quot; rel=&quot;nofollow&quot;&gt;RedactorStyles&lt;/a&gt; plugin, and set the &lt;code&gt;Styles Css&lt;/code&gt; field (for inline CSS), or &lt;code&gt;Styles Css File&lt;/code&gt; field (for CSS in a file). It's worked great for me.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-11-19T18:15:28.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4829" PostTypeId="2" ParentId="4826" CreationDate="2014-11-19T18:15:36.903" Score="6" Body="&lt;p&gt;You can override the control panel's CSS with a plugin. Use the popular &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;&quot;Control Panel CSS plugin&quot;&lt;/a&gt; by Lindsey DiLoreto or make your own little one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make use of the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#includeCssResource-detail&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;includeCssResource()&lt;/code&gt;&lt;/a&gt; function and include a CSS file with your custom redactor styles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;myRedactorCssPlugin.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeCssResource('myRedactorCss/redactor.css');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;resources/redactor.css:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor_editor h1 {&#xA;  font-weight: normal !important;&#xA;}&#xA;.redactor_editor p {&#xA;  background-color: #eee;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-11-19T18:15:36.903" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4830" PostTypeId="1" AcceptedAnswerId="4836" CreationDate="2014-11-19T18:31:04.140" Score="1" ViewCount="590" Body="&lt;p&gt;I think I have been staring at this problems too long and I need a kick in the right direction...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have (the content modeling is a tad wonky but this is what we're dealing with):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clients Channel&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Work Samples Matrix Field (1 matrix block inside the matrix field)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category matrix block field pulling from work categories&lt;/li&gt;&#xA;&lt;li&gt;Assets matrix block field to upload images&lt;/li&gt;&#xA;&lt;li&gt;Table matrix block field to enter youtube ID's&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is what I need to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a category is selected by a user I take the user to a category listing page that contains all clients (from the Clients channel) with work samples within that category (categories within the matrix block from each client in the client channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: All clients with &quot;website&quot; samples should be displayed on a page at &lt;a href=&quot;http://domain.tld/category/website&quot; rel=&quot;nofollow&quot;&gt;http://domain.tld/category/website&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most efficient way to pull this off in Craft/twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the Craft docs is getting me about 1/2 there but something in the relationships docs isn't clicking yet.&lt;/p&gt;&#xA;" OwnerUserId="213" LastActivityDate="2014-11-19T21:53:09.393" Title="Is it possible to have category listing page of entries if the category is defined within a matrix block inside said entries?" Tags="&lt;matrix&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4831" PostTypeId="2" ParentId="1927" CreationDate="2014-11-19T19:42:24.950" Score="9" Body="&lt;p&gt;An alternative, if you are getting the tags from the &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields&quot;&gt;Tag Field&lt;/a&gt; type, is the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot;&gt;Join&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if post.tags | length %}&#xA;    Tags: {{ post.tags | join(', ') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="508" LastActivityDate="2014-11-19T19:42:24.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4832" PostTypeId="1" AcceptedAnswerId="4835" CreationDate="2014-11-19T20:19:17.173" Score="5" ViewCount="637" Body="&lt;p&gt;We're looking to output a list of entries and group them by their check box values. Here's what we've got so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for checkbox, entries in craft.entries.section('my_entries').find() | group('checkbox') %}&#xA;   {{ checkbox }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This currently returns &quot;Object of class Craft\MultiOptionsFieldData could not be converted to string&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Is this even possible?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-11-19T21:38:33.430" Title="Is it possible to group entries by checkbox?" Tags="&lt;entries&gt;&lt;group&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4834" PostTypeId="2" ParentId="4832" CreationDate="2014-11-19T21:29:49.240" Score="1" Body="&lt;p&gt;In your example, &lt;code&gt;checkbox&lt;/code&gt; is an instance of &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/MultiOptionsFieldData&quot; rel=&quot;nofollow&quot;&gt;MultiOptionsFieldData&lt;/a&gt;, which behaves like an array of all of the possible checkbox options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't have a &lt;code&gt;__toString()&lt;/code&gt; method on it, which is why you're getting the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume what you want to be doing is grouping by a selected checkbox, no?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-19T21:29:49.240" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4835" PostTypeId="2" ParentId="4832" CreationDate="2014-11-19T21:33:19.283" Score="6" Body="&lt;p&gt;What Brad says, plus an example of grouping by selected checkbox:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('my_entries') %}&#xA;&#xA;{# get all checkbox options #}&#xA;{% set options = entries.first().checkbox.options %}&#xA;&#xA;{% for option in options %}&#xA;    &amp;lt;h2&amp;gt;{{ option }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in entries if entry.checkbox.contains(option) %}&#xA;       &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2014-11-19T21:38:33.430" LastActivityDate="2014-11-19T21:38:33.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4836" PostTypeId="2" ParentId="4830" CreationDate="2014-11-19T21:44:29.510" Score="9" Body="&lt;p&gt;First you need to define the category. If your category group has the “Categories in this group have their own URLs” checkbox checked, and the URL Format is set to &lt;code&gt;category/{slug}&lt;/code&gt;, and this is happening on the template you’ve specified in the Category Template setting, then all the stars have aligned and this step is taken care of for you automatically. The category will already be available to your template, and it will be called &lt;code&gt;category&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise you will have to fetch it yourself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories({&#xA;    group: 'workCategories',&#xA;    slug: craft.request.getSegment(2)&#xA;}).first() %}&#xA;&#xA;{% if not category %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have your category, you can fetch the related Clients using the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;relatedTo&lt;/a&gt; param on a craft.entries query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set clients = craft.entries({&#xA;    section: 'clients',&#xA;    relatedTo: {&#xA;        targetElement: category,&#xA;        field: 'workSamples.myCategoriesField'&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That’s saying: “Give me the entries in the &lt;code&gt;clients&lt;/code&gt; channel, which are related to &lt;code&gt;category&lt;/code&gt; (where &lt;code&gt;category&lt;/code&gt; is the &lt;strong&gt;target&lt;/strong&gt; of the relation), via the &lt;code&gt;myCategoriesField&lt;/code&gt; sub-field of a &lt;code&gt;workSamples&lt;/code&gt; Matrix field.” Make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have those client entries you can loop through them, and show their respective Matrix blocks which are related to the category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for client in clients %}&#xA;    &amp;lt;h3&amp;gt;{{ client.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for workSample in client.workSamples.relatedTo({ targetElement: category }) %}&#xA;        {% for image in workSample.myAssetsField %}&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {% for row in workSample.myTableField %}&#xA;            {{ row.youtubeId }}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there are going to be a lot of clients/Matrix blocks/assets getting looped through, it’s probably going to be a good idea to wrap the whole thing in &lt;code&gt;{% cache %}&lt;/code&gt;...&lt;code&gt;{% endcache %}&lt;/code&gt; tags, as there’s potential for the query count to really pile up here.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-11-19T21:53:09.393" LastActivityDate="2014-11-19T21:53:09.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4839" PostTypeId="1" AcceptedAnswerId="4843" CreationDate="2014-11-20T06:19:56.320" Score="0" ViewCount="101" Body="&lt;p&gt;I have a front end form where I set have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also need to set the postDate to a date in the future. Does setting enabled = 1 reset the postDate in all cases? Or should I just forego the enabled form field altogether in favor of Setting postDate?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-11-20T07:39:32.097" Title="Does setting Enabled = 1 override postDate in front end forms?" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4841" PostTypeId="1" AcceptedAnswerId="4842" CreationDate="2014-11-20T07:07:36.307" Score="2" ViewCount="84" Body="&lt;p&gt;I have a channel projects and a channel wishes (People can submit their 'wishes' for that particular project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a project I made the 'entry field' projectHasWishes to connect wishes to project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we use guestentries plugin to get wishes from the visitors. This form is that particular projectpage on the frontend. How can I relate them easily to the right project? Can I use a hidden field for this? Or something else? Thanks for helping me out. &lt;/p&gt;&#xA;" OwnerUserId="1014" LastActivityDate="2014-11-20T07:32:26.873" Title="Getting related project of a submitted 'wish' through the entry field." Tags="&lt;entries&gt;&lt;form&gt;&lt;relations&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4842" PostTypeId="2" ParentId="4841" CreationDate="2014-11-20T07:32:26.873" Score="4" Body="&lt;p&gt;The way you've set it up now, it won't be possible without doing 2 requests: one to create the wish, and one to alter the project (add the wish relation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd turn it around, and give the wish section a field 'belongsToProject' (or whatever else you'd like to call it), you'd be able to create this hidden input field in your wish form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[belongsToProject][]&quot; value=&quot;{{ project.id }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the &lt;code&gt;[]&lt;/code&gt;. Those are needed because a relation field can have multiple related elements, even if you limit it to have only one.&#xA;On saving, the field will be populated with the project relation you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On viewing your projects and wishes, assuming you have a variable called project with your current project in it, you could simply do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set wishesForProject = craft.entries.find({&#xA;    section: 'wishes',&#xA;    relatedTo: {&#xA;        targetElement: project,&#xA;        field: 'belongsToProject',&#xA;    },&#xA;}) %}&#xA;&#xA;{% for wish in wishesForProject %}&#xA;    {{ wish.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-20T07:32:26.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4843" PostTypeId="2" ParentId="4839" CreationDate="2014-11-20T07:39:32.097" Score="2" Body="&lt;p&gt;Setting &lt;code&gt;enabled = 1&lt;/code&gt; will not alter your postDate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to set a postDate in the future, the entry would simply not show up (by default).&#xA;However, if you'd want enabled entries with a future postDate to show up in your template results, use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set futureEntries = craft.entries.status('pending') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do not use the &lt;code&gt;status&lt;/code&gt; criterium, it will default to &lt;code&gt;live&lt;/code&gt;, which is all enabled entries with a postDate in the past. So, it all depends on how you display the entries, not so much on how you save them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, see &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#status&quot; rel=&quot;nofollow&quot;&gt;this Craft docs information on status&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-20T07:39:32.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4844" PostTypeId="2" ParentId="1384" CreationDate="2014-11-20T11:38:34.573" Score="9" Body="&lt;p&gt;I've been able to render CP templates in the front end using some methods in &lt;code&gt;PathService&lt;/code&gt; and &lt;code&gt;TemplatesService&lt;/code&gt;, which you could use inside your own Template Variable to render the macros:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class YourVariable {&#xA;&#xA;    public function renderFormMacro($macro, array $args)&#xA;    {&#xA;        // Get the current template path&#xA;        $originalPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;&#xA;        // Point Twig at the CP templates&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getCpTemplatesPath());&#xA;&#xA;        // Render the macro.&#xA;        $html = craft()-&amp;gt;templates-&amp;gt;renderMacro('_includes/forms', $macro, array($args));&#xA;&#xA;        // Restore the original template path&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath($originalPath);&#xA;&#xA;        return TemplateHelper::getRaw($html);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which would be used like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.yourVariable.renderFormMacro('textField', { label: 'Name' })&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've not tested it but I think that should be close. &lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-11-20T11:38:34.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4845" PostTypeId="1" AcceptedAnswerId="4868" CreationDate="2014-11-20T12:07:43.473" Score="0" ViewCount="110" Body="&lt;p&gt;Im using a pretty standard method for calling for entries, but with one small caveat in that I'm setting the limit inside a variable which is passed through to an include&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so my index.twig file is like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'homepage/_latest' with {'postCount' : 9} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my &lt;code&gt;homepage/_latest&lt;/code&gt; file has the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;{% set latest = craft.entries.section('blog').limit(postCount ? postCount : 12) %}&#xA;&#xA;&amp;lt;div class=&quot;entries entries--latest&quot;&amp;gt;&#xA;&#xA;    {% for entry in latest %}&#xA;&#xA;    {% include 'blocks/_entry-item-latest' %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that variable the issue for me/ I save a post and it doesnt know up on the homepage. I had it setup to invalidate every 15 minutes, but we put out 3-4 posts a day so theres no real need to invalidate that content every 15 minutes&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2014-11-21T17:48:26.800" Title="Cache Not Invalidating" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4846" PostTypeId="2" ParentId="4654" CreationDate="2014-11-20T12:14:45.103" Score="0" Body="&lt;p&gt;After testing the above solution by Douglas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) If the related entries are not in a Matrix block the following works perfectly. You may put the related entries in any custom order by dragging them around.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedPerformers = entry.performer.order('sortOrder') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) The related entries coming from a Matrix field gives following error:&#xA;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;relatedPerformers&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedPerformers = block.performer.order('sortOrder') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastEditorUserId="785" LastEditDate="2014-11-20T13:48:33.887" LastActivityDate="2014-11-20T13:48:33.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4847" PostTypeId="1" AcceptedAnswerId="4850" CreationDate="2014-11-20T19:58:07.967" Score="0" ViewCount="314" Body="&lt;p&gt;I keep getting a server error when attempting to save data to a table field. This is the code I am using test data insertion. (251 is a valid enteryId)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(251, $localeId = null);&#xA;    $arr = array('col1' =&amp;gt; 'some sku', 'col2' =&amp;gt; 'This is a big fat description', 'col3' =&amp;gt; 495.00, 'col4' =&amp;gt; 0);&#xA;    $arr = json_encode($arr);&#xA;    $entry-&amp;gt;getContent()-&amp;gt;gistDistribution = $arr;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Illegal string offset 'sku'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: sku is a column name in my table field.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-11-20T21:05:47.777" Title="Saving to Table Field Type via Plugin" Tags="&lt;plugin-development&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4848" PostTypeId="1" CreationDate="2014-11-20T20:33:30.310" Score="2" ViewCount="481" Body="&lt;p&gt;Is it possible to use template tags within an entry? Specifically, I'd like to use Globals I've set up within an entry, so I can manage a brand name globally.&lt;/p&gt;&#xA;" OwnerUserId="525" LastActivityDate="2014-11-20T21:23:24.717" Title="Globals (template tags) in entries?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;tags&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4849" PostTypeId="2" ParentId="4848" CreationDate="2014-11-20T21:05:07.133" Score="3" Body="&lt;p&gt;You can, using &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference tags&lt;/a&gt;, but unfortunately they only work in plain text fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1797/reference-tags-in-rich-text-fields-parse-and-converted-on-save&quot;&gt;Reference tags in rich text fields parse and converted on save&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-20T21:05:07.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4850" PostTypeId="2" ParentId="4847" CreationDate="2014-11-20T21:05:47.777" Score="3" Body="&lt;p&gt;NOT TESTED&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I think you can just add an array to gistDistribution, it will get&#xA;json_encoded before saving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I think you'd have to set the variable like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$arr[0] = array(...);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That way, you provide a multidimensional array, which is what a table needs.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-20T21:05:47.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4851" PostTypeId="2" ParentId="4848" CreationDate="2014-11-20T21:23:24.717" Score="1" Body="&lt;p&gt;Not sure from your question where you are trying to display the information. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If displaying in a template then you can access the &lt;a href=&quot;http://buildwithcraft.com/docs/globals#templating&quot; rel=&quot;nofollow&quot;&gt;global&lt;/a&gt; directly &lt;code&gt;{{ globalSetHandle.fieldHandle }}&lt;/code&gt;. &lt;/li&gt;&#xA;&lt;li&gt;If displaying within another textfield then, as Tim suggested, using &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;reference tags&lt;/a&gt; is great idea (I would have never thought of that, Tim!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-20T21:23:24.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4852" PostTypeId="2" ParentId="4819" CreationDate="2014-11-20T22:12:12.207" Score="4" Body="&lt;p&gt;MAMP isn't really tuned for performance either. And also keep in mind Time to First Byte is not the only indicator of a fast website. You should consider overall perceived time and actual download time as factors as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CloudFlare &lt;a href=&quot;http://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles/&quot; rel=&quot;nofollow&quot;&gt;talked about one aspect of this&lt;/a&gt; on their blog... for example: with Gzip compression, the web server has to wait while it compresses the output then send it along. That adds to your TTFB. So on first blush, gzip compression would appear to be a bad thing but in reality, your overall download time and file size shrink, and as a result, it's an easy win.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your content doesn't change all that much, when you get your Craft site up live, you might also want to consider caching on the server level as well, either with Nginx (fastcgi_cache) or something like Varnish in front of Apache. Those layers add complexity (e.g. when and how to clear the cache?) but it'll get you super fast output if that's your goal.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2014-11-20T22:12:12.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4853" PostTypeId="1" AcceptedAnswerId="4855" CreationDate="2014-11-20T22:30:28.717" Score="2" ViewCount="625" Body="&lt;p&gt;I'm trying to set up a front end user profile that will allow the user to use the multi-select field. When I update from the CP, the changes are reflected on the front end, but this isn't working when trying to update from the front end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set languageOptionsIds = user.providerLanguages %}&#xA;&#xA;&amp;lt;label for=&quot;providerLanguages&quot;&amp;gt;What languages do you work with?&amp;lt;/label&amp;gt;&#xA;{% for option in currentUser.providerLanguages.options %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;providerLanguages&quot; name=&quot;fields[providerLanguages][]&quot;&#xA;    {% if option.selected in languageOptionsIds %}checked{% endif %} value=&quot;{{ option.selected }}&quot;&amp;gt;{{ option.label }}&#xA;    &amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20" LastActivityDate="2014-11-20T23:35:07.680" Title="Edit multi-select field from front end" Tags="&lt;templating&gt;&lt;users&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4855" PostTypeId="2" ParentId="4853" CreationDate="2014-11-20T23:35:07.680" Score="3" Body="&lt;p&gt;I believe that you can get the options directly from the 'currentUser' entry, without referring to 'user' separately (they are likely the same thing in this case anyway):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;providerLanguages&quot;&amp;gt;What languages do you work with?&amp;lt;/label&amp;gt;&#xA;{% for option in currentUser.providerLanguages.options %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;providerLanguages&quot; name=&quot;fields[providerLanguages][]&quot;&#xA;    {% if option.selected %}checked{% endif %} value=&quot;{{ option.value }}&quot;&amp;gt;&#xA;        {{ option.label }}&#xA;    &amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value is also available as 'option.value' instead of 'option.selected'.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-20T23:35:07.680" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4856" PostTypeId="1" CreationDate="2014-11-21T00:46:34.607" Score="2" ViewCount="132" Body="&lt;p&gt;We have a Form plugin and an Email plugin.  Users can setup the Email Plugin to send off notification emails when a particular Event happens.   Some users setup a notification email to be sent when a Form is submitted from the Form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a recent upgrade, we needed to migrate all content to the Form plugins entries table.  We did so using the &lt;code&gt;saveFormEntry&lt;/code&gt; method in the Form plugin service layer.  This means, that each time that we call &lt;code&gt;saveFormEntry&lt;/code&gt; in the migration, if somebody has the Email plugin to send out a notification when a Form Entry is saved, the Event fires and the Email plugin tries to do it's thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, this just killed the migration script. Setting the Email plugin to disabled before running the Form migration get's around the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is the best way to handle Events that get triggered during a migration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method we've thought of is to just programmatically set the Email plugin to disabled before running our migration.  That might work for us, but what if other plugins need to do the same?  Do we then need to somehow try to communicate this to everyone who might trigger an email event in a migration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea we've discussed is what if Craft had something like devMode for while migrations were running.  So we could just plan into our Email plugin to only run events when migrationMode = false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a general question, are there any benefits to having Events enabled during migrations?  Are there any benefits to having plugins enabled during migrations?  I'm sure this isn't simply a black and white question, but I'm new to thinking about the complexity of having multiple plugins triggering behaviors in other plugins and don't really like the idea that somebody could accidentally trigger several emails to be sent out while trying to run a migration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on where this is best handled and if we can take any steps to make our code more robust in handling scenarios like these would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-11-21T13:39:56.673" Title="What is the best way to handle Events that get triggered during a migration?" Tags="&lt;migration&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4858" PostTypeId="1" AcceptedAnswerId="4867" CreationDate="2014-11-21T10:48:09.843" Score="4" ViewCount="831" Body="&lt;p&gt;I have an controller action in my custom plugin that processes Paypal IPN requests. How it works is that you provide a URL for Paypal to send it's notification requests to and then process them and send an acknowledgement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;code&gt;{{ actionUrl('plugin/action') }}&lt;/code&gt; in my template to generate the URL that I provide to Paypal, but no matter what I try I can't get it to omit the script name from the URL. &lt;code&gt;$omitScriptNameInUrls&lt;/code&gt; set to true in config has no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is necessary, because I need to do some checking in my config file based on the URL to disable CSRF protection for only the Paypal IPN controller action, as described in this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4553/whats-the-best-way-to-skip-csrf-for-plugin-controllers/4554&quot;&gt;What&amp;#39;s the best way to skip CSRF for plugin controllers?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="359" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-11-21T17:35:33.130" Title="How can I ensure using actionUrl in my template does not show script name in the generated URL?" Tags="&lt;plugin-development&gt;&lt;config&gt;&lt;controller&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4859" PostTypeId="1" AcceptedAnswerId="4891" CreationDate="2014-11-21T11:52:21.633" Score="9" ViewCount="1202" Body="&lt;p&gt;What is the preferred way of loading a third party library in a plugin? I'm trying to develop a plugin to extend SproutForms so that users get signed up to Campaign Monitor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've got an interface in the CP where users can provide their API keys and List ID's into the database, so now I just need to actually add the CM API library. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can just require it, but I was wondering if there is a better way of doing this? Also where would I store the library, just in pluginname/lib/?&lt;/p&gt;&#xA;" OwnerUserId="906" LastActivityDate="2016-10-28T20:36:07.400" Title="Plugin Dev - Load third party library" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4860" PostTypeId="1" AcceptedAnswerId="4862" CreationDate="2014-11-21T13:32:13.623" Score="4" ViewCount="1247" Body="&lt;p&gt;Similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4853/edit-multi-select-field-from-front-end&quot;&gt;this question&lt;/a&gt;, I'm trying to make a table field type editable from a front end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I update from the CP, the changes are reflected on the front end, but the following code doesn't allow updating from the front end form itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(perhaps adding how each field type can be edited from a front end form should be added to the docs)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;    {% for row in currentUser.providerCredentials %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;Institution&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;accreditingInstitution&quot; name=&quot;fields[accreditingInstitution][]&quot; value=&quot;{{ row.accreditingInstitution }}&quot;&amp;gt;&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-11-21T15:32:46.850" Title="Edit a table field type from the front end" Tags="&lt;templating&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4861" PostTypeId="2" ParentId="4856" CreationDate="2014-11-21T13:39:56.673" Score="1" Body="&lt;p&gt;In general it’s best to avoid calling service methods from migration files in the first place. The reason for that is, your services should be able to assume that they’re always working with the latest schema design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine if a month from now you decide you need to add a new column to your &lt;code&gt;formentries&lt;/code&gt; table (or whatever it is). The associated record, model, and service all get updated to work with this new column’s data. And you write a migration that adds the column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;addColumn('formentries', 'newColumnName', ColumnType::Varchar);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You test and everything appears to work great, and then release it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then someone who was running an old version of your plugin tries to update. Before Craft runs the new migration that adds the new &lt;code&gt;formentries&lt;/code&gt; column, it still needs to run your old migration that calls your saveFormEntry() service method. Except that saveFormEntry is now assuming that the new column already exists, and depending on your code, either they run into a validation error (so no form entries get saved) or a MySQL error (because your record is trying to save on a column that doesn’t exist yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in the long run you’ll be better off if you keep all DB-related changes contained to your migration file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;That said,&lt;/strong&gt; Craft does cheat a little here - this is exactly why we have the concept of “breakpoint updates” at our disposal. When we mark a release as a breakpoint, it prevents anyone from updating to a version &lt;em&gt;after&lt;/em&gt; it, until they have updated &lt;em&gt;to&lt;/em&gt; it. So if we do need to call service methods in a migration, then we just need to remember to set a breakpoint at some point before we start making more DB schema changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins will also be able to set breakpoints when Craft 3 comes along. Because of that, this is still a relevant question. I’m thinking that the safest thing to do here is to simply disable event dispatching altogether during updates. A plugin should be in full control over what code gets run when it’s updating itself, with no chance of another plugin intervening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don’t think we have a way to disable Yii’s event system altogether (and probably shouldn’t even if we could), but we could at the very least prevent &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp#on-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;on()&lt;/a&gt; from doing its thing during update requests. Maybe even add a new argument to it that can be set to &lt;code&gt;true&lt;/code&gt; if the event should get fired even if it’s an update request, in case there are any use cases that I’m overlooking.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-21T13:39:56.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4862" PostTypeId="2" ParentId="4860" CreationDate="2014-11-21T14:45:18.660" Score="5" Body="&lt;p&gt;Each input name needs to have the following format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[FieldHandle][RowId][ColId]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn’t matter what you set &lt;code&gt;RowId&lt;/code&gt; to, as long as it’s the same for all of the columns in that row. (Table fields in the CP just get incrementing row IDs - &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt;, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ColId&lt;/code&gt;, on the other hand, needs to be based on your actual column IDs. The only way to get those would be to inspect a Table field’s HTML on your Edit Entry page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DRd3i.png&quot; alt=&quot;Table field’s HTML in Craft CMS&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each column will have an ID in the format of &lt;code&gt;colN&lt;/code&gt;. “&lt;code&gt;N&lt;/code&gt;” won’t necessarily be &lt;em&gt;nth&lt;/em&gt; column in the table though; it will be the &lt;em&gt;nth&lt;/em&gt; column you’ve created in the table since the field was first created, regardless of how they are ordered or whether any columns had ever been deleted. Which is why it’s best to just inspect the table HTML rather than trying to guess what the column ID will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, that &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; line should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;accreditingInstitution&quot; name=&quot;fields[providerCredentials][0][col1]&quot; value=&quot;{{ row.accreditingInstitution }}&quot;&amp;gt;&amp;lt;/td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-11-21T15:32:46.850" LastActivityDate="2014-11-21T15:32:46.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4863" PostTypeId="1" AcceptedAnswerId="4864" CreationDate="2014-11-21T15:42:53.453" Score="0" ViewCount="229" Body="&lt;p&gt;I've got Asset location setup with a Photo Caption field. And a Photo Gallery field which references said Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new entry, I'm uploading images to the Photo Gallery field. When the images are uploaded, double-clicking brings up the modal but the Photo Caption field is &lt;strong&gt;not&lt;/strong&gt; available. Only after saving the entry and then re-opening it to edit is the Photo Caption field available in the Assets modal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the normal behavior? Did I miss something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be ideal for my clients to be able to edit the photo meta information while they're creating a new entry.&lt;/p&gt;&#xA;" OwnerUserId="1019" LastActivityDate="2014-11-21T17:21:41.527" Title="Assets Content/Fields not available until entry is saved?" Tags="&lt;assets&gt;&lt;field&gt;&lt;entry&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4864" PostTypeId="2" ParentId="4863" CreationDate="2014-11-21T17:21:41.527" Score="2" Body="&lt;p&gt;This is an issue with Assets fields if you have a dynamic Subfolder path set on in the field’s settings. It’s been fixed for 2.3 though ;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-21T17:21:41.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4865" PostTypeId="2" ParentId="2502" CreationDate="2014-11-21T17:25:16.800" Score="2" Body="&lt;p&gt;The current solution i know of is to change CLogFilter's default dumper from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public $dumper='var_export';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public $dumper='print_r';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It even has a comment above it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @var callable or function which will be used to dump context information.&#xA; * Defaults to `var_export`. If you're experiencing issues with circular references&#xA; * problem change it to `print_r`. Any kind of callable (static methods, user defined&#xA; * functions, lambdas, etc.) could also be used.&#xA; * @since 1.1.14&#xA; */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My previous answer was criticised because I obviously wasn't clear enough. As for the age of this question, it's only 2 months old.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I've told P&amp;amp;T about this.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastEditorUserId="57" LastEditDate="2014-11-21T18:08:51.230" LastActivityDate="2014-11-21T18:08:51.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4866" PostTypeId="1" CreationDate="2014-11-21T17:28:28.287" Score="4" ViewCount="272" Body="&lt;p&gt;We have a new Craft site that includes front-end member registration. We've heard from the client that many of the activation emails are getting stuck in spam filters (and I just tested with the same result). Is there anything that we can do to avoid this? Perhaps add SPF records?&lt;/p&gt;&#xA;" OwnerUserId="725" LastActivityDate="2014-11-21T18:10:05.913" Title="What can we do to help avoid member activation emails going to spam?" Tags="&lt;emails&gt;&lt;registration&gt;&lt;member&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4867" PostTypeId="2" ParentId="4858" CreationDate="2014-11-21T17:35:33.130" Score="5" Body="&lt;p&gt;&lt;code&gt;actionUrl()&lt;/code&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/UrlHelper#getActionUrl-detail&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;UrlHelper::getActionUrl()&lt;/code&gt;&lt;/a&gt; always force the script name to show up despite the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls&quot; rel=&quot;noreferrer&quot;&gt;omitScriptNameInUrls&lt;/a&gt; config setting for two reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Action URLs are generally not actually visible to end users, so there’s no point in hiding “index.php” from them (computers don’t care about aesthetics).&lt;/li&gt;&#xA;&lt;li&gt;They are often used for POST requests, and your index.php redirect in .htaccess will drop any POST data associated with the request.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That said, if you &lt;em&gt;really&lt;/em&gt; want to create an action URL that omits “index.php”, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url(craft.config.actionTrigger ~ '/your/action/path') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I don’t think your use case is valid though. Just commented on it.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-21T17:35:33.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4868" PostTypeId="2" ParentId="4845" CreationDate="2014-11-21T17:48:26.800" Score="2" Body="&lt;p&gt;If I understand you correctly, you’d basically need it to store separate caches depending on the limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to do that would be to set a custom key on the &lt;code&gt;{% cache %}&lt;/code&gt; tag with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;using key&lt;/code&gt;&lt;/a&gt; param:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if postCount is not defined or not postCount %}&#xA;    {% set postCount = 12 %}&#xA;{% endif %}&#xA;&#xA;{% cache using key &quot;homepage/_latest:&quot;~postCount %}&#xA;    {% set latest = craft.entries.section('blog').limit(postCount) %}&#xA;    ...&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-21T17:48:26.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4869" PostTypeId="1" CreationDate="2014-11-21T17:59:56.977" Score="4" ViewCount="277" Body="&lt;p&gt;I have a single page section titled &quot;About&quot;.  At one point, I had assigned a &quot;text&quot; Rich Text field to the entry type layout.  I then put some filler text in this field and saved the entry.  Later I removed this field from the field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that craft still populates this entry field on the front-end, i.e. &lt;code&gt;{{ entry.text }}&lt;/code&gt; still shows the filler text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is problematic for several reasons, but most importantly (in my scenario) because I am working on a search results template which shows an excerpt from each entry; different entries may have different fields available, so I am doing a basic if/else to see what fields may be available, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.text is defined %}&#xA;    {{ entry.text }}&#xA;{% elseif entry.multiContent.text is defined %}&#xA;    {{ entry.multiContent.text }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This raises two questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is there a way to tell if an field is actually &lt;em&gt;actively&lt;/em&gt; assigned to the entry layout?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I understand why the field data would be retained in the database even though the field was removed from the layout, but under what circumstances would populating 'deleted' fields for entries be desired behavior?  It surely adds overhead, it is counter-intuitive (imo) and has the potential to cause all sort of issues.&lt;/p&gt;&#xA;" OwnerUserId="1013" LastEditorUserId="1013" LastEditDate="2014-11-22T00:17:47.707" LastActivityDate="2014-11-23T18:19:21.450" Title="Entries retain field data that has been removed from entry type layout" Tags="&lt;field&gt;&lt;frontend&gt;&lt;field-layout-designer&gt;&lt;deletion&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4870" PostTypeId="2" ParentId="4859" CreationDate="2014-11-21T18:04:10.890" Score="3" Body="&lt;p&gt;Ideally the third party library would be available as a &lt;a href=&quot;https://getcomposer.org/&quot; rel=&quot;nofollow&quot;&gt;composer&lt;/a&gt; package (you can check on &lt;a href=&quot;http://packagist.org&quot; rel=&quot;nofollow&quot;&gt;http://packagist.org&lt;/a&gt;) and you'd install it via composer.  By default that will put it in a &lt;code&gt;vendor&lt;/code&gt; folder in your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-21T18:04:10.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4871" PostTypeId="2" ParentId="4866" CreationDate="2014-11-21T18:10:05.913" Score="4" Body="&lt;p&gt;This the best article I've read on reliably delivering emails through code: &lt;a href=&quot;http://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&quot; rel=&quot;nofollow&quot;&gt;http://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-21T18:10:05.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4873" PostTypeId="2" ParentId="4820" CreationDate="2014-11-21T18:27:35.263" Score="1" Body="&lt;p&gt;The Default Upload Location setting only applies to drag-n-drop uploads, as well as front-end uploads if you are creating your own entry form with a &lt;code&gt;&amp;lt;input type=&quot;file&quot;/&amp;gt;&lt;/code&gt; input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to force files to be placed in a &lt;code&gt;{slug}&lt;/code&gt; subfolder, you should check the &quot;Restrict uploads to a single folder&quot; checkbox in your Assets field's settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-21T18:27:35.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4874" PostTypeId="1" AcceptedAnswerId="4878" CreationDate="2014-11-21T19:23:56.077" Score="2" ViewCount="129" Body="&lt;p&gt;I’m aware of the &lt;code&gt;relatedTo()&lt;/code&gt; parameter for entries that belong to a category but how can I show entries that are NOT &lt;code&gt;relatedTo()&lt;/code&gt; a certain category?&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2014-11-21T19:56:04.693" Title="How do I show entries that do not have a certain category?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4875" PostTypeId="1" AcceptedAnswerId="4876" CreationDate="2014-11-21T19:31:46.497" Score="2" ViewCount="143" Body="&lt;p&gt;How can I check if multiple asset image widths combined are wider than X?&#xA;So how do i get X?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File 1 = 300px wide&lt;br /&gt;&#xA;File 2 = 200px wide&lt;br /&gt;&#xA;File 3 = 250px wide&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x &amp;gt;= 750px than&amp;lt;br /&amp;gt;&#xA;  Do This&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&#xA;else&amp;lt;br /&amp;gt;&#xA;  Do that&amp;lt;br /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-11-21T19:35:56.593" Title="Combine image assets widths to get total width" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4876" PostTypeId="2" ParentId="4875" CreationDate="2014-11-21T19:35:56.593" Score="2" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalWidth = 0 %}&#xA;&#xA;{% for asset in myAssetList %}&#xA;    {% set totalWidth = totalWidth + asset.width %}&#xA;{% endfor %}&#xA;&#xA;{% if totalWidth &amp;gt; 750 %}&#xA;    Do this.&#xA;{% else %}&#xA;    Do that.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-21T19:35:56.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4877" PostTypeId="1" AcceptedAnswerId="4880" CreationDate="2014-11-21T19:41:59.233" Score="5" ViewCount="1068" Body="&lt;p&gt;Is it possible? I have a situation where a client needs the production site to be completely shut down and void of content updates. They do all of their content management on a staging site, then publish the database when changes are approved.&lt;/p&gt;&#xA;" OwnerUserId="525" LastActivityDate="2019-12-05T23:14:46.560" Title="Can I disable the control panel?" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;login&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4878" PostTypeId="2" ParentId="4874" CreationDate="2014-11-21T19:56:04.693" Score="4" Body="&lt;p&gt;I found this to work, although maybe there’s a better method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludedCategory = craft.categories.id('100') %}&#xA;{% set excludedEntries = craft.entries.section('blog').status('live').relatedTo(excludedCategory).ids() %}&#xA;&#xA;{% set entryIds = craft.entries.section('blog').status('live').ids() | without(excludedEntries) %}&#xA;{% set entries = craft.entries.section('blog').status('live').id(entryIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastActivityDate="2014-11-21T19:56:04.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4879" PostTypeId="2" ParentId="4877" CreationDate="2014-11-21T20:03:42.387" Score="3" Body="&lt;p&gt;Nothing native in Craft that would do this, but I suppose you'd be able to &lt;code&gt;.htaccess&lt;/code&gt; redirect all requests to your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;cpTrigger&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-21T20:03:42.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4880" PostTypeId="2" ParentId="4877" CreationDate="2014-11-21T20:17:27.017" Score="5" Body="&lt;p&gt;Good call Brad! Not sure why that didn't occur to me :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how that's done: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Kill admin access&#xA;RewriteCond %{REQUEST_URI} ^(.*)/admin&#xA;RewriteRule ^(.*)$ - [F,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="525" LastActivityDate="2014-11-21T20:17:27.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4882" PostTypeId="1" AcceptedAnswerId="4883" CreationDate="2014-11-21T22:05:54.693" Score="1" ViewCount="441" Body="&lt;p&gt;This is an extension of a question I posted &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4860/edit-a-table-field-type-from-the-front-end&quot;&gt;here&lt;/a&gt; earlier, but another layer of complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to have a checkbox field &lt;em&gt;within&lt;/em&gt; a table field be checked/unchecked from a front end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a number of scenarios using the example found &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; in the docs, but no dice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;table&amp;gt;&#xA;      {% for row in currentUser.providerPayment %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;Sliding scale?&amp;lt;/td&amp;gt;&#xA;&#xA;        {% for slidingScale in currentUser.providerPayment  %}&#xA;            {% set checked = false %}&#xA;&#xA;            {% if slidingScale.selected %}&#xA;                {% set checked = true %}&#xA;            {% endif %}&#xA;&#xA;            {% if not checked %}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[providerPayment][0][col2]&quot; value=&quot;&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;td&amp;gt;&amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ slidingScale.value }}&quot; name=&quot;fields[providerPayment][0][col2]&quot; {% if checked %} checked=&quot;checked&quot;{% endif %}&amp;gt;&amp;lt;/td&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;   &amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the error it's producing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IIA7A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; Here are my table field settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZqezG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="20" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-21T23:34:37.313" Title="Edit a checkbox field within table field from the front end" Tags="&lt;templating&gt;&lt;form&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4883" PostTypeId="2" ParentId="4882" CreationDate="2014-11-21T23:34:37.313" Score="2" Body="&lt;p&gt;First, when you do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in currentUser.providerPayment %}&#xA;&#xA;    ...&#xA;&#xA;    {% for slidingScale in currentUser.providerPayment %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you’re looping through the &lt;code&gt;currentUser.providerPayment&lt;/code&gt; array (the rows in your providerPayment Table field on the current user) within another loop through the same array. If the table has 2 rows, this is what would be happening:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Row 1 (assigned to &lt;code&gt;row&lt;/code&gt;)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Row 1 (assigned to &lt;code&gt;slidingScale&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Row 2 (assigned to &lt;code&gt;slidingScale&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Row 2 (assigned to &lt;code&gt;row&lt;/code&gt;)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Row 1 (assigned to &lt;code&gt;slidingScale&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Row 2 (assigned to &lt;code&gt;slidingScale&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(Doesn’t make any sense.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only need a single for-loop here, and it’s the outer one. Within that loop, you will be able to access all of the values on the current row, via the &lt;code&gt;row&lt;/code&gt; variable you’ve defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in currentUser.providerPayment %}&#xA;&#xA;    {{ row.averageCostPerSession }}&#xA;    {{ row.slidingScale }}&#xA;    {{ row.acceptedPaymentMethods }}&#xA;    {{ row.acceptedInsuranceCarriers }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does that make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for each row, if you want to output a checkbox input, you would just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in currentUser.providerPayment %}&#xA;    &amp;lt;td&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; value=&quot;1&quot;&#xA;            name=&quot;fields[providerPayment][0][col2]&quot;&#xA;            {% if row.sliderScale %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;/td&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing to keep in mind with checkboxes, though, is that they don’t actually submit any POST data if left unchecked. So to be safe, you should put a hidden input right before the checkbox input, with a blank value, which will act as the default value if the checkbox is left unchecked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set name = 'fields[providerPayment][0][col2]' %}&#xA;&#xA;{% for row in currentUser.providerPayment %}&#xA;    &amp;lt;td&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;{{ name }}&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ name }}&quot; value=&quot;1&quot;&#xA;            {% if row.sliderScale %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;/td&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-11-21T23:34:37.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4884" PostTypeId="2" ParentId="4869" CreationDate="2014-11-22T01:09:07.377" Score="4" Body="&lt;p&gt;Technically, all entries have all fields, regardless of their layout. Field layouts are mostly just a UI thing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Is there a way to tell if an field is actually actively assigned to the entry layout?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It’s a little cumbersome and would require the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;MN Break and Continue&lt;/a&gt; plugin, but yes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for flf in entry.getFieldLayout().getFields() %}&#xA;    {% set field = flf.getField() %}&#xA;&#xA;    {% if field.handle == 'text' %}&#xA;        {{ entry.text }}&#xA;        {% break %}&#xA;    {% elseif field.handle == 'multiContent' %}&#xA;        {{ entry.multiContent.text }}&#xA;        {% break %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) I understand why the field data would be retained in the database even though the field was removed from the layout, but under what circumstances would populating 'deleted' fields for entries be desired behavior? It surely adds overhead, it is counter-intuitive (imo) and has the potential to cause all sort of issues.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actually it’s &lt;em&gt;faster&lt;/em&gt; for Craft to not worry about the field layout, which is why it’s not taken into account right now. Less data to fetch, and logic to run. If you check for &lt;code&gt;entry.text&lt;/code&gt;, Craft just assumes you know what you’re doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a better approach would be to just check the entry type’s ID/name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.typeId in [1,2,3] %}&#xA;    {{ entry.text }}&#xA;{% elseif entry.typeId in [4,5,6] %}&#xA;    {{ entry.multiContent.text }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type.handle in ['one', 'two', 'three'] %}&#xA;    {{ entry.text }}&#xA;{% elseif entry.type.handle in ['four', 'five', 'six'] %}&#xA;    {{ entry.multiContent.text }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-11-23T18:19:21.450" LastActivityDate="2014-11-23T18:19:21.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4885" PostTypeId="1" AcceptedAnswerId="4886" CreationDate="2014-11-22T13:53:45.133" Score="0" ViewCount="832" Body="&lt;p&gt;So I have my dinnermenu at &lt;code&gt;example.com/dinnermenu&lt;/code&gt; but I want to show specific content for the next week if someone asks for it via &lt;code&gt;example.com/dinnermenu/nextWeek&lt;/code&gt; but it should still use the entry data from dinnermenu ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how can I achieve that ?&lt;/p&gt;&#xA;" OwnerUserId="733" LastActivityDate="2014-11-22T17:04:02.300" Title="How to load a template based on the first segment (and ignoring the second)" Tags="&lt;entries&gt;&lt;sections&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4886" PostTypeId="2" ParentId="4885" CreationDate="2014-11-22T15:53:53.283" Score="2" Body="&lt;p&gt;There are a lot of ways to go about this depending on how you have your sections and templates set up, and where you are getting your content from for both 'dinnermenu' and 'nextweek'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Using routes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want 'dinnermenu/nextweek' requests to be directed to the 'dinnermenu' template, then one option would be to set up a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; with a '*' token as the last segment (i.e. &lt;code&gt;dinnermenu/*&lt;/code&gt;). This would route &lt;code&gt;example.com/dinnermenu/any-uri-segment&lt;/code&gt; to your 'dinnermenu' template ('dinnermenu.html' or 'dinnermenu/index.html' or whatever you called it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the dinnermenu template you can then test for the uri segment and display custom 'nextweek' content, in addition to (or instead of) your dinner menu content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segments(2) == 'nextweek' %}&#xA;    // display content for next week&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request&quot; rel=&quot;nofollow&quot;&gt;craft.request&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Using a structure&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more dynamic nav you could also use a 'structure' (with 2 levels). In the template you can then test for the level and include the parent content as needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.level %}&#xA;    {% case &quot;1&quot; %}&#xA;        {% set dinnermenu = entry %}&#xA;    {% case &quot;2&quot; %}&#xA;        {% set dinnermenu = entry.parent %}&#xA;{% endswitch %}&#xA;&#xA;{{ entry.intro }}     // dinnermenu's or nextweek's 'intro' field&#xA;{{ dinnermenu.body }} // with dinnermenu's body field&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Using ElementCriteriaModel&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand, you want to pull your 'dinnermenu' entry into your 'nextweek' template (no matter where it is), then you can use an &lt;code&gt;EntryCriteriaModel&lt;/code&gt; to retrieve and display the 'dinnermenu' entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dinnermenu = craft.entries.slug('dinnermenu').first %}&#xA;{{ dinnermenu.body }}&#xA;etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also just include the whole 'dinnermenu' template in the 'nextweek' template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug('dinnermenu').first %}&#xA;{% include 'dinnermenu.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lot of options.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-22T17:04:02.300" LastActivityDate="2014-11-22T17:04:02.300" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4887" PostTypeId="1" AcceptedAnswerId="4888" CreationDate="2014-11-22T16:08:12.567" Score="1" ViewCount="257" Body="&lt;p&gt;I’m looking to hook into existing modal functionality, if any exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is, what’s the advised approach and considerations required to ensure responsiveness?&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2014-11-22T17:14:38.633" Title="Is there an API for modals?" Tags="&lt;control-panel&gt;&lt;user-interface&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2014-12-09T21:55:21.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="4888" PostTypeId="2" ParentId="4887" CreationDate="2014-11-22T17:14:38.633" Score="3" Body="&lt;p&gt;In the CP you can generate a modal using craft's 'garnish' js as explained in &lt;a href=&quot;https://craftcms.stackexchange.com/a/384/784&quot;&gt;this answer&lt;/a&gt;. On the front-end I believe you would need to develop you own solution.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-22T17:14:38.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4889" PostTypeId="1" AcceptedAnswerId="4890" CreationDate="2014-11-22T17:37:02.870" Score="5" ViewCount="1790" Body="&lt;p&gt;I'm working on validation with Craft. I have a custom plugin that allows public submission. However, I want to make sure I can pass errors back to the template. The key is trying to make my code as &quot;dynamic&quot; as possible. Meaning I do not want to specify the errors one by one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my sample controller (keep in mind I don't care what the model says is required, trying to keep the code agnostic of the model.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSave() {&#xA;&#xA;    // require a post request&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    // assign specific fields we are listening for&#xA;    $post = craft()-&amp;gt;request-&amp;gt;getPost('fields');&#xA;&#xA;    // create a new Request model&#xA;    $model = MyModel::populateModel($post);&#xA;&#xA;    // validate the model attributes&#xA;    if ($model-&amp;gt;validate()) {&#xA;        // save the record&#xA;&#xA;        // redirect to posted url&#xA;    }&#xA;&#xA;    $errors = $model-&amp;gt;getAllErrors();&#xA;&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'errors'    =&amp;gt; $errors&#xA;    ));&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;$model-&amp;gt;getAllErrors()&lt;/code&gt; returns an array as listed below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array&#xA;(&#xA;    0 =&amp;gt; 'Name cannot be blank.'&#xA;    1 =&amp;gt; 'Details cannot be blank.'&#xA;    2 =&amp;gt; 'Email is not a valid email address.'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I return that array to specific fields in my template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errors.email is defined ? errors.email | length %}&#xA;    &amp;lt;div data-alert class=&quot;alert&quot;&amp;gt;&#xA;        {{ errors.email }}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-11-22T18:55:30.640" LastActivityDate="2014-11-22T21:51:09.707" Title="How to return errors from a model back to the template?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;models&gt;&lt;validation&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4890" PostTypeId="2" ParentId="4889" CreationDate="2014-11-22T17:43:40.527" Score="5" Body="&lt;p&gt;If you use &lt;code&gt;$model-&amp;gt;getErrors()&lt;/code&gt; instead, it should return a multidimensional array of errors indexed by attribute name like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'email' =&amp;gt; array(&#xA;        'First email error.',&#xA;        'Second email error.',&#xA;    ),&#xA;    'firstName' =&amp;gt; array(&#xA;        'First firstName error.',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can get errors specifically for an attribute like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model-&amp;gt;getErrors('email');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then update the template to check for the errors, since it is now a multidimensional array that's returned.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errors.email is defined ? errors.email | length %}&#xA;&amp;lt;div data-alert class=&quot;alert&quot;&amp;gt;&#xA;    {% for error in errors.email %}&#xA;        {{ error }}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2014-11-22T21:51:09.707" LastActivityDate="2014-11-22T21:51:09.707" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4891" PostTypeId="2" ParentId="4859" CreationDate="2014-11-22T23:37:13.133" Score="13" Body="&lt;p&gt;I second Brad on this, if there is a composer package, use that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether you use a composer package or a library not found on packagist.org you'll still need to load it so that your plugin can make use of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, there are plenty of places where you can import/require third party libraries from but my recommendation would be to do so from the &lt;code&gt;init()&lt;/code&gt; method in your main &lt;strong&gt;plugin class&lt;/strong&gt;. As far as where to put it, I would go with one of these 5 acceptable directory names used most often in no particular order &lt;code&gt;library&lt;/code&gt;, &lt;code&gt;common&lt;/code&gt;, &lt;code&gt;third&lt;/code&gt;, &lt;code&gt;lib&lt;/code&gt;, or &lt;code&gt;src&lt;/code&gt;. I'll use &lt;code&gt;library&lt;/code&gt; in the following example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've downloaded/installed your third party library, your directory structure might look something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugin&#xA;    PluginClass.php&#xA;    controllers&#xA;    templates&#xA;    ...&#xA;    library&#xA;        campaignmonitor&#xA;    OR&#xA;    library&#xA;        vendor&#xA;            composer&#xA;            campaignmonitor&#xA;            ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given the outlined directory structure above, your &lt;code&gt;init()&lt;/code&gt; method might look something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// PluginClass.php&#xA;public function init()&#xA;{&#xA;    require_once './library/campaignmonitor/SomeClass.php';&#xA;    require_once './library/campaignmonitor/SomeOtherClass.php';&#xA;    ...&#xA;    // If using composer&#xA;    require_once './library/vendor/autoload.php';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd also like to point out that &lt;code&gt;Craft::import()&lt;/code&gt; can theoretically import using &lt;code&gt;glob&lt;/code&gt; as in &lt;code&gt;Craft::import('plugins.pluginname.library.*)&lt;/code&gt; which is cool because those don't get required right away but lazy loaded when needed. However, this only works for class in the Craft namespace so you'll have to stick to a method described above: )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="45" LastEditDate="2016-10-28T20:36:07.400" LastActivityDate="2016-10-28T20:36:07.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4892" PostTypeId="1" AcceptedAnswerId="4893" CreationDate="2014-11-23T07:51:20.610" Score="2" ViewCount="194" Body="&lt;p&gt;I just check the CMS. It looks great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One question about the Globals: Where could they be used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found them in a Navigation-Example. Do you have other examples for me?&lt;/p&gt;&#xA;" OwnerUserId="1029" LastEditorUserId="22" LastEditDate="2017-05-10T00:16:34.323" LastActivityDate="2017-05-10T00:16:34.323" Title="Examples for Globals" Tags="&lt;craft-features&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4893" PostTypeId="2" ParentId="4892" CreationDate="2014-11-23T07:58:16.637" Score="3" Body="&lt;p&gt;That's the beauty of Globals... they can be used anywhere!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common usage examples include (but not limited to):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Content in your header&lt;/li&gt;&#xA;&lt;li&gt;Content in your footer&lt;/li&gt;&#xA;&lt;li&gt;Content in your sidebar&lt;/li&gt;&#xA;&lt;li&gt;Anything else that appears frequently in your website&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's not a strict rule, but Globals tend to work great in situations where you only need a small amount of content to be commonly repeated throughout your site.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-23T07:58:16.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4894" PostTypeId="1" CreationDate="2014-11-23T12:28:19.140" Score="7" ViewCount="592" Body="&lt;p&gt;I am a Joomla developer who has been asked to start developing Craft plugins and I'm afraid my brain is so moulded to the joomla way of doing things that I cannot even see how the template links to the plugin and fires events&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm especially interested in form processing (being the cornerstone of application functionality) and I've been taking a look at the contact form plugin. In the contact.html template I can see {{ getCsrfInput() }} which is twig syntax for calling a method- but there is no method called getCsrfInput() anywhere in the plugin. However it works, hidden fields are returned with an 'action' pointing to contactForm/sendMessage which (I'm assuming the Craft app decides, because there is no form tag action) fires the actionSendMessage event in the contact form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just don't see the sequence! I can program PHP fine, but (perhaps due to ONLY doing things the Joomla way) don't see how plugins are called/included in a page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a silly example, but could someone explain to me how I could get a function to just echo Hello World on a page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;function printHello()&#xA;{&#xA;echo 'Hello world!'&#xA;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this go in the plugin root class? If so, what do I put in the example.html template to call this plugin function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can do that then I can (presumably) use it to do everything else. Just 'including' a PHP function on a page doesn't seem like the Craft way of doing thing- I've read about hooks and events, and they don't make sense to me. Hooks seem to link a plugin to a URI, and it seems to suggest that you don't need to put anything into the template html calling the plugin. The Other, 'Events', is all PHP, so I'm assuming isn't intended to be put into the template files (Any php I put in there is escaped).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in short, how can add a hello world output to a page using a plugin (Stupid, but just to get me started)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought is that as soon as I can do that I can have a function that grabs form data from a previous page and processes it in order to do some real work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Andy&lt;/p&gt;&#xA;" OwnerUserId="1030" LastEditorUserId="22" LastEditDate="2017-05-10T00:14:22.180" LastActivityDate="2017-05-10T00:14:22.180" Title="Hello World Craft Plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4895" PostTypeId="2" ParentId="4894" CreationDate="2014-11-23T15:16:13.043" Score="8" Body="&lt;p&gt;Apart from reading the docs on &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot;&gt;plugin development&lt;/a&gt;, I would suggest checking out a plugin called &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic/&quot;&gt;Business Logic&lt;/a&gt;, which provides a plugin template for creating project specific business logic, with a basic controller, service, and variables file already set up, and doc blocks which explain what the various components do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For just printing a string I would look into creating a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;custom variable&lt;/a&gt; in your plugins 'variable' file. If the method is more complicated then you can use your variable as a wrapper to call one your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot;&gt;service methods&lt;/a&gt; defined in your plugin's 'service' file. Here is an example variables file, with a call to a service method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class MypluginVariable&#xA;{&#xA;    // return the result directly&#xA;    public function exampleVariable()&#xA;    {&#xA;        return 'Anything you want!';&#xA;    }&#xA;    // call a service method and return the result&#xA;    public function exampleServiceMethodWrapper($value)&#xA;    {&#xA;        return craft()-&amp;gt;myPlugin-&amp;gt;myServiceMethod($value);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could call these from your template using &lt;code&gt;{{ craft.myplugin.exampleVariable }}&lt;/code&gt; and &lt;code&gt;{{ craft.myplugin.exampleServiceMethodWrapper('customValue') }}&lt;/code&gt;. These are assuming you want to just print the result of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The contactForm plugin that you are looking at is interacting with the plugin through the hidden form field &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&lt;/code&gt; which directs craft to submit the form to the contactForm's &lt;code&gt;actionSendMessage()&lt;/code&gt; method defined in the plugin's 'controller' file. See &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot;&gt;controller docs&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fyi &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt; is a native craft method so won't be in the plugin.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-11-23T15:58:56.360" LastActivityDate="2014-11-23T15:58:56.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4896" PostTypeId="1" AcceptedAnswerId="4897" CreationDate="2014-11-23T15:24:59.927" Score="1" ViewCount="112" Body="&lt;p&gt;A clean installation of Craft includes a 'News' channel which has confused me slightly. Would it not be better to have a 'Blog' channel with a 'News' category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage to having a dedicated 'News' channel?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-11-26T11:58:57.187" Title="Dedicated channel for news? or a channel for blog with a news category?" Tags="&lt;channels&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4897" PostTypeId="2" ParentId="4896" CreationDate="2014-11-23T15:40:10.970" Score="3" Body="&lt;p&gt;Not every website has a 'blog' section. If your site's other content would, for instance, be something completely different like general company info, it would make perfect sense to have a news section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you do have a blog, it would be perfectly possible to delete the 'news' section and give the blog section an entry type called 'news'. That way you would be able to give news entries their own fields, which is convenient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's all possible with Craft, so it really is up to you.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-23T15:40:10.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4898" PostTypeId="1" AcceptedAnswerId="4899" CreationDate="2014-11-23T17:46:57.520" Score="1" ViewCount="270" Body="&lt;p&gt;How soon is the Craft team planning to upgrade to the latest version of Redactor? Redactor version 10.0 introduced some breaking changes and new formatting options, which are not backwards compatible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;Craft docs&lt;/a&gt; link to Redactor V10 docs, which don't apply to Craft's version (9.2.6),  and I can't find any archived copies of Redactor's docs, so... while not quite a showstopper, it's a bit inconvenient.&lt;/p&gt;&#xA;" OwnerUserId="1027" LastActivityDate="2014-11-23T19:11:56.410" Title="Upgrade Redactor?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4899" PostTypeId="2" ParentId="4898" CreationDate="2014-11-23T19:11:56.410" Score="3" Body="&lt;p&gt;We update all of Craft's dependencies on each point release, so Craft 2.3 will have the latest version of Redactor in it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-23T19:11:56.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4900" PostTypeId="1" AcceptedAnswerId="4903" CreationDate="2014-11-23T21:29:21.117" Score="3" ViewCount="1044" Body="&lt;p&gt;So I'm trying to setup public registration for the first time. I'm running into two problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The users are not getting assigned to the default user group&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The password is not required but fails validation when there is 1-6 characters (as it should).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('username')) }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('email')) }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('password')) }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Must I enforce the password required client side?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: LOGOUT of the admin pages when testing registration (or just go into an icognito window). This fixed the password being blank passing validation issue AND the user group not getting assigned.&lt;/p&gt;&#xA;" OwnerUserId="244" LastEditorUserId="244" LastEditDate="2014-11-25T00:12:54.183" LastActivityDate="2014-11-25T00:12:54.183" Title="Public Registration" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4901" PostTypeId="1" CreationDate="2014-11-23T21:43:44.527" Score="4" ViewCount="208" Body="&lt;p&gt;I'm sure it's obvious, but how do I get the current site name from within a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a few things, including&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;systemSettings-&amp;gt;getSettings('general')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="6007" LastEditDate="2018-05-14T19:36:15.850" LastActivityDate="2018-05-14T19:36:15.850" Title="SiteName in a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4902" PostTypeId="2" ParentId="4901" CreationDate="2014-11-23T23:22:35.457" Score="4" Body="&lt;p&gt;From searching the files (i.e. 'craft/app/Craft.php' line 124) it looks like you can get it using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;getSiteName()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-11-23T23:22:35.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4903" PostTypeId="2" ParentId="4900" CreationDate="2014-11-23T23:28:38.903" Score="6" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;The users are not getting assigned to the default user group.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You're probably testing front-end user registration with an already logged in user account.&lt;/p&gt;&#xA;&lt;p&gt;Make sure you log out of your current one first before you start testing creating new users.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The password is not required but fails validation when there is 1-6 characters (as it should).&lt;/p&gt;&#xA;&lt;p&gt;Must I enforce the password required client side?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yeah... currently you'll need to enforce it client-side for front-end registration.  I'll see what we can do to improve that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-11-24T00:36:30.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4904" PostTypeId="1" CreationDate="2014-11-24T08:31:47.953" Score="0" ViewCount="197" Body="&lt;p&gt;Hello I am migrating our craft install from a Linux server to a Windows IIS based server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far all is working, however the default template is not loading. Any idea why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linux: http:// 70 .32 .84 .65/home&#xA;Windows: &lt;a href=&quot;https://brownbis.com/primer/home&quot; rel=&quot;nofollow&quot;&gt;https://brownbis.com/primer/home&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a PHP module on Windows that I need to enable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help&lt;/p&gt;&#xA;" OwnerUserId="1033" LastActivityDate="2015-11-20T03:10:14.247" Title="migrating from Linux to Windows, but my templates aren't loading" Tags="&lt;templating&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4905" PostTypeId="1" CreationDate="2014-11-24T13:22:15.923" Score="1" ViewCount="296" Body="&lt;p&gt;I hope this is the right place to post this, it's more a question on MVC for plugin development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm developing a plugin to extend SproutForms to add users to Campaign Monitor lists. So far I've got the interface where the user can submit their API key and List ID. I then use these to pull in information about the list and add it to the db in &lt;code&gt;pluginname_forms&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I also want to pull in the custom fields for that list and store them in the &lt;code&gt;pluginname_formFields&lt;/code&gt; table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From an MVC point of view, should I keep this in the service that deals with the list data or create a new service which deals with the custom fields data?  &lt;/p&gt;&#xA;" OwnerUserId="906" LastActivityDate="2014-11-25T21:35:46.463" Title="MVC - Should these be seperate controllers/models etc" Tags="&lt;database&gt;&lt;controller&gt;&lt;models&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4906" PostTypeId="1" CreationDate="2014-11-24T13:46:11.763" Score="1" ViewCount="351" Body="&lt;p&gt;I'm porting a site from EE and I'm running into an issue with an existing URL structure not working using routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Existing URL Structure: /articles/[year]/[month]/[day]/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried creating a route for the above to the articles/index template but it seems no matter what I try I'm returned the 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the nature of the site, we need users to be routed to the articles/index template no matter what the three child slugs are and then we can display appropriate messaging if an article doesn't exist for the specific date/URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would appear this must be user error as now the expected outcome is working correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Route: articles/[year]/[month]/[day]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is properly routing users to the articles/index template whether or not an entry exists.&lt;/p&gt;&#xA;" OwnerUserId="871" LastEditorUserId="871" LastEditDate="2014-11-25T13:57:29.010" LastActivityDate="2014-11-25T13:57:29.010" Title="Catch all routes" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4907" PostTypeId="1" AcceptedAnswerId="4909" CreationDate="2014-11-24T15:18:24.433" Score="2" ViewCount="1813" Body="&lt;p&gt;Is the following possible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set issue = craft.entries(section: 'issues', slug: 'october-2014').first() %}&#xA;&#xA;{% set categoryOne = craft.categories({ group: 'articles', slug: 'category-slug-one'}) %}&#xA;{% set categoryTwo = craft.categories({ group: 'articles', slug: 'category-slug-two'}) %}&#xA;{% set categoryThree = craft.categories({ group: 'articles', slug: 'category-slug-three'}) %}&#xA;&#xA;{% for entry in craft.entries({&#xA;    section: 'articles',&#xA;    relatedTo: ['and',&#xA;        ['or',&#xA;            { targetElement: categoryOne },&#xA;            { targetElement: categoryTwo },&#xA;            { targetElement: categoryThree }&#xA;        ],&#xA;        { targetElement: issue }&#xA;    ]&#xA;}) %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Attempting to return articles associated with a specific issue from within one of three specific categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears the parseRelationParam function looks at the first array element to determine the operator but I'm hoping someone has a solution. &lt;/p&gt;&#xA;" OwnerUserId="871" LastEditorUserId="125" LastEditDate="2014-11-24T15:56:56.427" LastActivityDate="2014-11-25T09:41:59.377" Title="relatedTo 'and' with 'or'" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4908" PostTypeId="2" ParentId="4907" CreationDate="2014-11-24T15:41:43.777" Score="1" Body="&lt;p&gt;Not the way you do it, but Brandon's answer to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or&quot;&gt;this question&lt;/a&gt; is the best workaround.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-24T15:41:43.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4909" PostTypeId="2" ParentId="4907" CreationDate="2014-11-24T16:00:20.767" Score="3" Body="&lt;p&gt;You can simply get all the relevant categories at once and combine your &lt;code&gt;relatedTo&lt;/code&gt; parameters with a single &lt;code&gt;and&lt;/code&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set issue = craft.entries({ section: 'issues', slug: 'october-2014' }).first() %}&#xA;{% set categories = craft.categories({ group: 'articles', slug: 'category-slug-one, category-slug-two, category-slug-three' }) %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'articles',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: issue },&#xA;        { targetElement: categories }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-25T09:41:59.377" LastActivityDate="2014-11-25T09:41:59.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4910" PostTypeId="2" ParentId="4906" CreationDate="2014-11-24T16:03:29.800" Score="2" Body="&lt;p&gt;When you create a route, the slugs that you use ('year', ' month', 'day') will be made available in your templates as variables. You will need to use these to retrieve the entry(ies) your looking for. Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update: Sorry, first version had major errors, should be better now.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set datetime = year ~ '-' ~ month ~ '-' ~ day %}&#xA;{% set entries = craft.entries.section('articles').postDate('and', '&amp;gt;= ' ~ datetime, '&amp;lt; ' ~ datetime|date_modify('+1 day')) %}&#xA;&#xA;{% if entries %}&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;            {{ entry.body }}&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}    &#xA;&#xA;{% else %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;p&amp;gt;There are no entries for this date.&amp;lt;p&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Untested, but should be close. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1821/get-entries-by-date-but-ignore-time&quot;&gt;this question&lt;/a&gt; for another example.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-24T18:14:44.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4911" PostTypeId="1" CreationDate="2014-11-24T16:14:33.053" Score="1" ViewCount="88" Body="&lt;ul&gt;&#xA;&lt;li&gt;System Status is set to &lt;em&gt;off&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create a new user, with permissions to &lt;em&gt;Access the site when the system is off&lt;/em&gt; and &lt;em&gt;Access the CP&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As long as the system is off, the activation email sent to the user is broken, and instead goes to the &quot;Service Unavailable&quot; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this by design? It seems like if those specific permissions are granted when creating the user, they should still be able to activate.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-11-24T20:26:20.317" Title="User activation via email does not work when system status is &quot;off&quot;" Tags="&lt;emails&gt;&lt;activation&gt;&lt;token&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-11-24T21:09:24.423" ContentLicense="CC BY-SA 3.0" />
  <row Id="4912" PostTypeId="1" AcceptedAnswerId="4914" CreationDate="2014-11-24T16:58:34.557" Score="3" ViewCount="147" Body="&lt;p&gt;I am attempting to create an 'a to z' listing on a site with 1000+ entries of people. The catch is that it needs to be indexed by surname unless that person doesn't have a surname, in which case it will use their forename.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know what I need to end up with — an array of 'a' to 'z' as keys, with the value another array of people, indexed by their name with the entry id as the value. I can then iterate over this and create the relevant sections for styling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible in Twig? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-11-24T18:45:13.883" Title="Complicated A-Z problem" Tags="&lt;templating&gt;&lt;entries&gt;&lt;array&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4913" PostTypeId="2" ParentId="4904" CreationDate="2014-11-24T18:32:34.147" Score="1" Body="&lt;p&gt;It looks like your craft/templates folder on the Windows box has the default template that Craft ships out-of-the-box with and not the custom templates and front-end resources that you've designed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure your correct files are actually in &lt;code&gt;craft/templates&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-24T18:32:34.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4914" PostTypeId="2" ParentId="4912" CreationDate="2014-11-24T18:42:21.723" Score="5" Body="&lt;p&gt;I base my example on the assumption that all people are Users (Element type User). If users are entries, you'd have to replace users by entries ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there's a way to do this without iterating through all users first, creating some sort of ordering attribute (&lt;code&gt;if lastName != '' ? lastName : firstName&lt;/code&gt;). Then, you'd be able to group your array by your ordering attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# create a variable to hold all user data you need #}&#xA;{% set allUsers = [] %}&#xA;&#xA;{# loop through users ... #}&#xA;{% for user in craft.users.find() %}&#xA;    {# &#xA;        ... and set variable for each user, containing the info you need&#xA;        and an 'orderMeBy' attribute, set to the uppercased first character of lastName or firstName&#xA;    #}&#xA;    {% set thisUser = [{&#xA;        fullName : user.fullName,&#xA;        orderMeBy : user.lastName != '' ? user.lastName | slice(0,1) | upper : user.firstName | slice(0,1) | upper&#xA;    }] %}&#xA;&#xA;    {# merge this user's info with your allUsers variable #}&#xA;    {% set allUsers = allUsers | merge (thisUser) %}&#xA;{% endfor %}&#xA;&#xA;{# group 'allUsers' variable by 'orderMeBy' attribute #}&#xA;{% set groupedUsers = allUsers | group('orderMeBy') %}&#xA;&#xA;{# create an array of all numbers and letters #}&#xA;{% set numbers = 0..9 %}&#xA;{% set letters = 'A'..'Z' %}&#xA;{% set allChars = numbers | merge(letters) %}&#xA;&#xA;{# loop to chars and, if users in groupedUsers[char], display those users #}&#xA;{% for char in allChars %}&#xA;    {% if groupedUsers[char] is defined %}&#xA;    &amp;lt;h2&amp;gt;{{ char }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for user in groupedUsers[char] %}&#xA;            &amp;lt;li&amp;gt;{{ user.fullName }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone knows a quicker and/or easier way, tell me :)&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-24T18:42:21.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4915" PostTypeId="2" ParentId="4912" CreationDate="2014-11-24T18:45:13.883" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4914/57&quot;&gt;Paul's answer&lt;/a&gt; is good, but I suspect it would end up being a bit easier and cleaner if you just it from a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; so you could do all of your logic from PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The just return your sorted, assembled array back to the template to loop through.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-11-24T18:45:13.883" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4917" PostTypeId="2" ParentId="4911" CreationDate="2014-11-24T20:26:20.317" Score="1" Body="&lt;p&gt;This has been changed on the upcoming Craft 2.3 release such that if the system status is set to &lt;em&gt;off&lt;/em&gt;, account verification and set/forgot password logic will still run.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-24T20:26:20.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4918" PostTypeId="1" CreationDate="2014-11-24T20:38:30.293" Score="3" ViewCount="481" Body="&lt;p&gt;I'm struggling to find a way to use &lt;code&gt;craft.users&lt;/code&gt; to select all users that are not members of any groups. Looking at the User Element Type both the &lt;code&gt;groupId&lt;/code&gt; and &lt;code&gt;group&lt;/code&gt; parameters are used to perform additional queries which will return nothing unless a valid group Id or handle is provided... I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to find users not in groups or will I have to do this post retrieving all users... I need to paginate the results so this is not ideal.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2014-11-25T14:28:58.423" Title="How can I select users that are not members of any user groups?" Tags="&lt;templating&gt;&lt;users&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4919" PostTypeId="1" AcceptedAnswerId="4920" CreationDate="2014-11-24T20:47:16.127" Score="0" ViewCount="89" Body="&lt;p&gt;I am pulling in a feed I know that has two items. When I add caching to craft.feeds.getFeedItems(feedurl, limit, cache) the first items is not pulled in.  However if I remove caching or add &quot;0&quot; that item is pulled in. Would this have something to do with the feed or craft?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2014-11-24T21:53:19.517" Title="RSS caching removes items from feed" Tags="&lt;rss&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4920" PostTypeId="2" ParentId="4919" CreationDate="2014-11-24T21:53:19.517" Score="2" Body="&lt;p&gt;The 3rd parameter passed into &lt;a href=&quot;http://buildwithcraft.com/classreference/services/FeedsService#getFeedItems-detail&quot; rel=&quot;nofollow&quot;&gt;getFeedItems&lt;/a&gt; is for an offset, not caching.  The caching parameter is in the 4th place and accepts any valid &lt;a href=&quot;http://php.net/manual/en/datetime.formats.time.php&quot; rel=&quot;nofollow&quot;&gt;PHP time format&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-24T21:53:19.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4921" PostTypeId="1" AcceptedAnswerId="4923" CreationDate="2014-11-24T22:23:59.530" Score="0" ViewCount="265" Body="&lt;p&gt;Is it possible to limit the number of levels within a Structure element?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say for example, I only want to max of two levels. So there can be only have something like the following with no way to allow a child of a child so to speak:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child&lt;/li&gt;&#xA;&lt;li&gt;Child&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Parent&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Parent&lt;/li&gt;&#xA;&lt;li&gt;Parent&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="329" LastActivityDate="2014-11-24T22:27:09.543" Title="Limit Structure Depth" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4922" PostTypeId="2" ParentId="4918" CreationDate="2014-11-24T22:25:59.633" Score="2" Body="&lt;p&gt;I don't think it's possible, exactly for the reasons you provide: while other criteria accept 'not X', group and groupId explicitly add andWhere criteria with the Ids found with ids or handles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could make a plugin that returns an array containing all users without a user group, but maybe that's a bit far fetched. I do think that's the only way (for now), if you don't want to do it post retrieving ...&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-24T22:25:59.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4923" PostTypeId="2" ParentId="4921" CreationDate="2014-11-24T22:27:09.543" Score="1" Body="&lt;p&gt;Go in to the structured section's settings (Settings-&gt;Sections-&gt;Structure Name)) and set the &quot;Max Levels&quot; property.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-24T22:27:09.543" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4924" PostTypeId="1" CreationDate="2014-11-25T00:24:05.160" Score="1" ViewCount="250" Body="&lt;p&gt;I have implemented the Craft contact form plugin, and have my form set to send to two email addresses. I am receiving messages at one address, but my client is not receiving any messages at the other. Their email address is the same domain as the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="1034" LastEditorUserId="45" LastEditDate="2014-11-25T06:11:55.667" LastActivityDate="2014-11-25T06:11:55.667" Title="Contact Form plugin - Not receiving emails at separate addresses" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4925" PostTypeId="2" ParentId="4924" CreationDate="2014-11-25T02:30:52.287" Score="2" Body="&lt;p&gt;First, make sure you're on the latest version of the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;. There was a bug related to sending to multiple addresses that got fixed several months ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not it, have them check their SPAM folder to see if it's getting trapped in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not in SPAM, then try using a different email protocol under Settings-&gt;Email in the control panel, preferably SMTP based.  phpmail is notoriously unreliable at email delivery. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-25T02:30:52.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4926" PostTypeId="1" CreationDate="2014-11-25T11:19:18.097" Score="1" ViewCount="411" Body="&lt;p&gt;I would like to get all the fields (with their handles and values) for a given global set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example : My set is called 'labels'.&#xA;I know I can get the set by using :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::GlobalSet);&#xA;$criteria-&amp;gt;handle = 'labels';&#xA;$labels = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or with :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$labels = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('labels');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I can get a specific data with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$labels-&amp;gt;myDataHandle&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I get all the data/fields in the set ?&#xA;I would like to have an array or an object with all my labels (in my controller I return the value using returnJson).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help !&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="125" LastEditDate="2014-11-25T14:42:01.680" LastActivityDate="2014-11-25T18:23:14.357" Title="How can i get all values in a global set" Tags="&lt;plugin-development&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4927" PostTypeId="2" ParentId="4603" CreationDate="2014-11-25T11:57:27.490" Score="4" Body="&lt;p&gt;I solved the problem by setting the client_max_body_size to, in my case, 20M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did this using the following nginx_app.conf&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    # try to serve file directly, fallback to rewrite&#xA;    try_files $uri @rewriteapp;&#xA;}&#xA;&#xA;location @rewriteapp {&#xA;    # rewrite all to index.php&#xA;    rewrite ^(.*)$ /index.php?p=$1 last;&#xA;}&#xA;&#xA;location ~ ^/(index)\.php(/|$) {&#xA;    client_max_body_size 20M;&#xA;    fastcgi_pass heroku-fcgi;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.*)$;&#xA;    include fastcgi_params;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;    fastcgi_param HTTPS off;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1036" LastActivityDate="2014-11-25T11:57:27.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4928" PostTypeId="1" AcceptedAnswerId="4932" CreationDate="2014-11-25T13:44:35.583" Score="2" ViewCount="808" Body="&lt;p&gt;Currently it's possible to set a max block value for the collection of block types. However I have a case where it would be great if I could set block type limit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have a situation where I need a carousel matrix. A block type with assests for the carousel but also a heading and text block type describing the carousel. I want the assets block type to have x amount of repeatable entries but the description and title block type limited to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you currently achieve this? Would it be worth requesting adding it to the roadmap?&lt;/p&gt;&#xA;" OwnerUserId="534" LastActivityDate="2016-09-05T12:57:49.890" Title="Matrix max block type limit" Tags="&lt;matrix&gt;&lt;block-types&gt;&lt;blocks&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4929" PostTypeId="1" CreationDate="2014-11-25T14:16:14.103" Score="1" ViewCount="520" Body="&lt;p&gt;The only types in the list are &lt;code&gt;Single-line text&lt;/code&gt;, &lt;code&gt;Multi-line text&lt;/code&gt;, &lt;code&gt;Number&lt;/code&gt; or &lt;code&gt;Checkbox&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="926" LastEditorUserId="926" LastEditDate="2014-11-26T16:27:49.217" LastActivityDate="2014-11-26T16:27:49.217" Title="Can a Table Column be Rich Text / WYSIWYG?" Tags="&lt;richtext&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4930" PostTypeId="2" ParentId="4918" CreationDate="2014-11-25T14:17:26.947" Score="3" Body="&lt;p&gt;You could get the IDs of all users belonging to a group, and use these IDs prefixed with &lt;code&gt;not&lt;/code&gt; as the &lt;code&gt;id&lt;/code&gt; parameter in a second &lt;code&gt;craft.users&lt;/code&gt; ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userIds = craft.users.group('group1, group2, group3').ids() %}&#xA;{% set users = craft.users.id('and, not ' ~ userIds|join(', not ')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-25T14:28:58.423" LastActivityDate="2014-11-25T14:28:58.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4931" PostTypeId="2" ParentId="4929" CreationDate="2014-11-25T14:41:09.100" Score="3" Body="&lt;p&gt;I think that's actually a table field type you are referring to, not a Matrix Field Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix field types can indeed have Rich Text. There are a lot of instances where a Matrix field can be used in place of a table field.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2014-11-25T17:06:33.917" LastActivityDate="2014-11-25T17:06:33.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4932" PostTypeId="2" ParentId="4928" CreationDate="2014-11-25T14:52:42.293" Score="2" Body="&lt;p&gt;Reading your description I see no reason to not use all three fields in a single matrix block. If you need additional control (e.g. for positioning the title), you could add another field to that block that allows you to set your settings (e.g. a dropdown with &quot;Title left&quot; / &quot;Title right&quot; options).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really need a per block type limit (now), you could try fork the matrix field as a plugin and add the necessary conditionals to the JS.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-25T14:59:16.263" LastActivityDate="2014-11-25T14:59:16.263" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4933" PostTypeId="1" AcceptedAnswerId="4934" CreationDate="2014-11-25T15:10:22.650" Score="4" ViewCount="725" Body="&lt;p&gt;I have a custom field type which I need to be unique. So far I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Validates the field values is unique&#xA; *&#xA; * @param mixed $value&#xA; *&#xA; * @return true|string|array&#xA; */&#xA;public function validate($value)&#xA;{&#xA;    $existingEntryCount = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;total(array(&#xA;        $this-&amp;gt;model-&amp;gt;getAttribute('handle') =&amp;gt; $value&#xA;    ));&#xA;&#xA;    return ($existingEntryCount) ? $this-&amp;gt;model-&amp;gt;getAttribute('name') . Craft::t(' must be unique') : true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works in that it returns an error if any entry is found with the value submitted, however I need to restrict the search so that it excludes the current entry from the search query.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-11-26T12:10:57.397" Title="Validating a field value is unique" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4934" PostTypeId="2" ParentId="4933" CreationDate="2014-11-25T15:41:22.763" Score="4" Body="&lt;p&gt;I came up with an answer, but be good to know if there is a better way of doing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Checks if another entry exists with the given reference&#xA; * &#xA; * @param  string $value The reference to check&#xA; * @return bool&#xA; */&#xA;private function referenceExists($value)&#xA;{&#xA;    $existing = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;first(array(&#xA;        $this-&amp;gt;model-&amp;gt;getAttribute('handle') =&amp;gt; $value&#xA;    ));&#xA;&#xA;    return ($existing &amp;amp;&amp;amp; $existing-&amp;gt;getAttribute('id') != $this-&amp;gt;element-&amp;gt;getAttribute('id'));&#xA;}&#xA;&#xA;/**&#xA; * Validates the field values is unique&#xA; *&#xA; * @param mixed $value&#xA; * @return true|string|array&#xA; */&#xA;public function validate($value)&#xA;{&#xA;    return ($this-&amp;gt;referenceExists($value)) ? $this-&amp;gt;model-&amp;gt;getAttribute('name') . Craft::t(' must be unique') : true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-11-25T15:41:22.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4935" PostTypeId="1" CreationDate="2014-11-25T18:14:25.840" Score="5" ViewCount="43701" Body="&lt;p&gt;I am trying to form a url parameter (for Google Maps API) from entry field data. Basically, this is what I would like to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set street = entry.address %}&#xA;&#xA;{% set  city = entry.city %}&#xA;&#xA;{% set urlParam = street.&quot;, &quot;.city.&quot;, UT&quot;  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Twig and, if so, what is the proper syntax for concatenating multiple variables and strings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2016-12-11T20:02:26.007" Title="how to concatenate multiple variables and strings" Tags="&lt;variable&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4936" PostTypeId="1" AcceptedAnswerId="4942" CreationDate="2014-11-25T18:16:02.787" Score="2" ViewCount="927" Body="&lt;p&gt;I'm implementing a custom controller as part of a plugin I'm building. There's some set up work that I'd like to do in the controller's constructor. I created a &lt;code&gt;__construct&lt;/code&gt; method, and it seems to work as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; Is there some reason that I should call &lt;code&gt;parent::__construct()&lt;/code&gt; inside of the constructor? It requires an argument, which looks like it should be an ID of some sort, but I'm not sure where I should get that.&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2014-12-11T23:12:29.650" Title="Constructor in custom controller?" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4937" PostTypeId="2" ParentId="4935" CreationDate="2014-11-25T18:17:47.793" Score="8" Body="&lt;p&gt;Figured it out!  Proper syntax is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set urlParam = street ~&quot;, &quot; ~city ~&quot;, UT&quot;  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="587" LastEditorUserId="344" LastEditDate="2016-06-01T13:56:17.587" LastActivityDate="2016-06-01T13:56:17.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4938" PostTypeId="2" ParentId="4926" CreationDate="2014-11-25T18:23:14.357" Score="1" Body="&lt;p&gt;Have a look at &lt;a href=&quot;https://craftcms.stackexchange.com/a/2928/125&quot;&gt;the answer&lt;/a&gt; given here to someone trying to solve this in the template. With a plugin you'd probably do it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFieldsByEntry($entryModel)&#xA;{&#xA;    $fields = array();&#xA;    $fieldLayoutFields = $entryModel-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;    foreach ($fieldLayoutFields as $fieldLayoutField)&#xA;    {&#xA;        $fields[] = craft()-&amp;gt;fields-&amp;gt;getFieldById($fieldLayoutField-&amp;gt;fieldId);&#xA;    }&#xA;    return $fields;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-25T18:23:14.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4939" PostTypeId="2" ParentId="4935" CreationDate="2014-11-25T18:38:23.067" Score="9" Body="&lt;p&gt;Another option is to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot;&gt;twig join filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set urlParam = [street, city, 'UT']|join(', ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot;&gt;join&lt;/a&gt; concatenates the items in the sequence with the separator of your choice in between.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-11-25T18:38:23.067" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4940" PostTypeId="1" AcceptedAnswerId="4943" CreationDate="2014-11-25T18:45:54.173" Score="1" ViewCount="433" Body="&lt;p&gt;Once I have given an entry an expiration date, is there any way to delete that date so that it never expires?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-11-25T21:04:34.640" Title="Is it possible to remove an entry's Expiration Date?" Tags="&lt;entries&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4941" PostTypeId="1" CreationDate="2014-11-25T20:06:48.800" Score="0" ViewCount="109" Body="&lt;p&gt;I discovered that I can replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.assetFieldHandle %}&#xA;    {{ asset.url }} -- {{ asset.width }} -- {{ asset.height }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From &lt;code&gt;assetFieldHandle&lt;/code&gt; to the name of the handle ... then it works.&#xA;But why not with &lt;code&gt;entry.assetFieldHandle&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.image %}&#xA;    {{ asset.url }} -- {{ asset.width }} -- {{ asset.height }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="997" LastEditorUserId="250" LastEditDate="2014-11-25T21:26:12.540" LastActivityDate="2014-11-25T21:26:12.540" Title="Image in entry only showing when using entry.image instead of entry.assetFieldHandle" Tags="&lt;templating&gt;&lt;entry&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4942" PostTypeId="2" ParentId="4936" CreationDate="2014-11-25T20:38:47.067" Score="5" Body="&lt;p&gt;I'm not a huge fan of it but for this situation it might be more appropriate to use &lt;code&gt;init()&lt;/code&gt;, Looking at &lt;code&gt;Craft\BaseController&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Initializes the controller.  This method is called by the Craft before the controller starts to execute.&#xA; *&#xA; * @throws HttpException&#xA; * @return null&#xA; */&#xA;public function init()&#xA;{&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems a little odd to me to have a constructor for a controller though, what is it you're doing in it? &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/basics.controller#filter&quot;&gt;Yii's Controller filters&lt;/a&gt; might be a better fit.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-11-25T20:38:47.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4943" PostTypeId="2" ParentId="4940" CreationDate="2014-11-25T21:04:34.640" Score="2" Body="&lt;p&gt;You could just empty the expiration date and time field and save the entry. Or do you want to do it in a plugin (using PHP)?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-25T21:04:34.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4944" PostTypeId="2" ParentId="4941" CreationDate="2014-11-25T21:14:47.950" Score="2" Body="&lt;p&gt;I assume you got &lt;code&gt;Entry.assetFieldHandle&lt;/code&gt; from the docs? That's a way of telling you that you should call the asset field you're looking for by its handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd have to use the actual asset field handle of the asset field you're addressing, because an entry could have multiple asset fields (so there is NO attribute &lt;code&gt;assetFieldHandle&lt;/code&gt; within the &lt;code&gt;entry&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that your entry has two asset fields: images (multiple images) and logo (1 image).&#xA;In this case, this would be the way to display those assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get multiple assets from field with handle 'images' #}&#xA;{% for image in entry.images %}&#xA;    {{ image.link }}&#xA;{% endfor %}&#xA;&#xA;{# if you know an asset field only contains 1 asset (because its input is limited to 1)&#xA;   you can use 'first()' to get it without any for loop #}&#xA;{{ entry.logo.first().link }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-25T21:14:47.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4945" PostTypeId="2" ParentId="4905" CreationDate="2014-11-25T21:35:46.463" Score="3" Body="&lt;p&gt;Well, it looks like Sprout Forms itself prefers separate services for everything (they'd be some big services if they weren't,) but Craft does bundle closely-related things together sometimes - &lt;code&gt;FieldsService&lt;/code&gt; deals with both fields and groups, &lt;code&gt;TagsService&lt;/code&gt; with both tags and tag groups for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I just look at how much code there is, if I start getting lost/sick of scrolling and there's more than one 'thing' I'm dealing with, or if the existing service is already pretty big, then I break it out into separate services.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-11-25T21:35:46.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4946" PostTypeId="1" AcceptedAnswerId="5070" CreationDate="2014-11-25T23:13:19.290" Score="2" ViewCount="666" Body="&lt;p&gt;Is there an undocumented shortcoming of Live Preview? Seems to only work where the entry variable is concerned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a Structure section to create pages with &quot;Chapters&quot;. The section (let's call it &lt;strong&gt;Areas&lt;/strong&gt;) has a Max Level of 2. The idea is that level 1 entries  load a template that calls the content from all of that entry's children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, Areas looks like this in the CP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Learning&#xA;-- Our Approach&#xA;-- Design Patterns&#xA;-- etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The front-end works just fine. &lt;code&gt;/areas/learning&lt;/code&gt; loads the &lt;code&gt;areas/_entry&lt;/code&gt; template where I call all of the entry's children and output their content to the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is in Live Preview when editing a child entry, such as &lt;strong&gt;Our Approach&lt;/strong&gt;. It looks like Live Preview only likes using the provided &lt;code&gt;entry&lt;/code&gt; variable, but will not update anything nested, found in a loop, or otherwise loaded into the template's context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, this simplified template code, while rendering as expected, does not update in Live Preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isLivePreview %}&#xA;    {% set myEntry = craft.entries.slug(craft.request.getSegment(2)).first() %}&#xA;{% endif %}&#xA;&#xA;{% set chapters = myEntry.children %}&#xA;&#xA;{{ myEntry }}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for chapter in chapters %}&#xA;    &amp;lt;li&amp;gt;{{chapter}}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I renamed the entry variable as per &lt;a href=&quot;https://craftcms.stackexchange.com/a/1644/1027&quot;&gt;this answer&lt;/a&gt;. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="1027" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-12-04T08:13:36.720" Title="Live Preview only works for Entry variable?" Tags="&lt;templating&gt;&lt;control-panel&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4947" PostTypeId="1" CreationDate="2014-11-26T03:06:37.883" Score="1" ViewCount="186" Body="&lt;p&gt;I understand the rationale of adding one column per custom field to the &lt;code&gt;craft_content&lt;/code&gt; table in the database; but why would this happen for fields that are only used once globally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to define global fields without adding to the entire content table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a better option would be to define a single &quot;Options&quot; matrix field which can be used anywhere, and then use that to store zero-or-more options?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-11-26T07:10:18.380" Title="Global-only fields adding columns to content table?" Tags="&lt;field&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4948" PostTypeId="1" AcceptedAnswerId="4949" CreationDate="2014-11-26T04:31:40.837" Score="1" ViewCount="1216" Body="&lt;p&gt;I want to use the UID to get a user from a url and don't want to use the ID as it is guessable. I know I can do &lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserByUid($uid);&lt;/code&gt; but after getting the uid, the uid is not on the user model which is kinda a pain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example what if i wanted the uid for the currently logged in user?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-09-24T22:34:10.043" Title="Getting the UID of a user model" Tags="&lt;usermodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4949" PostTypeId="2" ParentId="4948" CreationDate="2014-11-26T04:47:19.017" Score="2" Body="&lt;p&gt;Currently, Craft doesn't expose the UID in any of its models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind of a pain, but the only thing I can think of as as a workaround is to write a plugin that has a UserModel with the UID and mimics whatever methods from UsersService that you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-11-26T05:12:04.390" LastActivityDate="2014-11-26T05:12:04.390" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4950" PostTypeId="2" ParentId="4947" CreationDate="2014-11-26T07:10:18.380" Score="1" Body="&lt;p&gt;A field is a field, no matter where you are using it. It doesn't matter to Craft whether you attach your field to a Global Set or a Section (or Users or Assets)... All fields are treated equally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your fields can be shared between Element Types, and often are.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-26T07:10:18.380" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4951" PostTypeId="2" ParentId="4896" CreationDate="2014-11-26T07:11:51.817" Score="1" Body="&lt;p&gt;I think if you compare the default installation of Craft to Wordpress which has two main content types, &quot;Posts&quot; and &quot;Pages,&quot; Craft is subtly trying to tell you it's not just another blogging platform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're right that news entries on a website could just be a &quot;News&quot; category in a larger blog. But the biggest advantage of creating a separate News channel is that it can have it's own set of fields. With separate channels, each type of content can have it's own data tailored to it's specific needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a site might have a page that lists News and upcoming Events together. But Events might need extra information attached to them like an event date, a location, and a price. If these were blog posts with categories like &quot;news&quot; and &quot;events,&quot; that extra event information would have to be added to a large WYSIWYG field making it hard to make sure that information is always formatted properly or consistently, or added to custom fields that would only be used for events and ignored for news articles. Both of these solutions get the job done, but make it harder for content administrators to use and understand when they have to remember these arbitrary rules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas two separate channels for News and Events could have unique fields from each other. This makes everything more straightforward and streamlines the process of adding new content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Lea points out, News and Events could also be two &lt;strong&gt;entry types&lt;/strong&gt; for a Blog channel. The only difference would be they would then share the same URL route like &lt;code&gt;blog/{slug}&lt;/code&gt;. Two separate sections/channels for News and Events could have URL routes like &lt;code&gt;/blog/news/{slug}&lt;/code&gt; and &lt;code&gt;/blog/events/{slug}&lt;/code&gt;. This might make more sense also if you wanted to have a listing page for only Events at &lt;code&gt;/blog/events&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there's any real advantage to setting them up as entry types instead of separate channels. There's no &quot;right&quot; way. It just depends on your situation or personal preference.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2014-11-26T11:58:57.187" LastActivityDate="2014-11-26T11:58:57.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4952" PostTypeId="1" AcceptedAnswerId="4953" CreationDate="2014-11-26T08:07:25.900" Score="2" ViewCount="400" Body="&lt;p&gt;I have a localised site. I want to add in kiss metric and google analytic tracking codes for each locale, however, I don't want the tracking codes to output in staging and dev environments. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I considered using globals, but then I'd need a way to print the global in the template if the environment is production. &lt;/li&gt;&#xA;&lt;li&gt;I have also considered using environment variables for in general.php file for the production environment and print the environment variable in the template.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does anyone have advice on best practice for this. &lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2014-11-26T12:20:40.050" Title="Add localised tracking codes for production environments" Tags="&lt;multi-environment&gt;&lt;analytics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4953" PostTypeId="2" ParentId="4952" CreationDate="2014-11-26T08:49:21.133" Score="7" Body="&lt;p&gt;If people don't need to change these through the control panel, I would put them in the general.php config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I would do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array (&#xA;    // default to not doing analytics&#xA;    'doAnalytics' =&amp;gt; false,&#xA;    // all the analytics codes, by locale&#xA;    'gaCodes' =&amp;gt; array(&#xA;      'fr_fr' =&amp;gt; 'UAxxx',&#xA;      'en_us' =&amp;gt; 'UAxxy'&#xA;    ),&#xA;  ),&#xA;  // CRAFT_ENVIRONMENT is set to one of 'LOCAL', 'STAGING', or 'PRODUCTION' in index.php&#xA;  'LOCAL' =&amp;gt; array (&#xA;  ),&#xA;  'STAGING' =&amp;gt; array (&#xA;  ),&#xA;  'PRODUCTION' =&amp;gt; array (&#xA;    'doAnalytics' =&amp;gt; true,&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.doAnalytics %}&#xA;  ...{{ craft.config.gaCodes[craft.locale] }}...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;{% if ... %}&lt;/code&gt; tests if we want to do analytics, and &lt;code&gt;{{ craft.config.gaCodes[craft.locale] }}&lt;/code&gt; pulls out the gaCode for the current locale.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-11-26T08:49:21.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4954" PostTypeId="2" ParentId="4933" CreationDate="2014-11-26T12:10:57.397" Score="5" Body="&lt;p&gt;If anybody is interested, I created a simple unique text field plugin that extends the core text field: &lt;a href=&quot;https://github.com/fuel-digital/Craft-Unique-Text-FieldType&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/fuel-digital/Craft-Unique-Text-FieldType&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-11-26T12:10:57.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4955" PostTypeId="2" ParentId="4952" CreationDate="2014-11-26T12:20:40.050" Score="3" Body="&lt;p&gt;You could create an array for your analytics codes by local in &lt;code&gt;general.php&lt;/code&gt; and set the &lt;code&gt;devMode&lt;/code&gt; configuration variable to &quot;true&quot; for your dev and staging environments. Then just test for devMode in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in &lt;code&gt;craft/config/general.php&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '*' =&amp;gt; array(&#xA;&#xA;    // local analytics&#xA;    'google_analytics' =&amp;gt; array(&#xA;      'en_us' =&amp;gt; 'UA-xxxx',&#xA;      'fr_fr' =&amp;gt; 'UA-xxxx',&#xA;    ),&#xA;  ),&#xA;&#xA;  // Production env&#xA;  'example.com' =&amp;gt; array(&#xA;  ),&#xA;&#xA;  // Development env&#xA;  'dev.example.com' =&amp;gt; array(&#xA;      'devMode' =&amp;gt; true,&#xA;  ),&#xA;&#xA;  // Staging env&#xA;  'staging.example.com' =&amp;gt; array(&#xA;      'devMode' =&amp;gt; true,&#xA;  ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your templates use a conditional to test if you're not in devMode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.config.devMode %}&#xA;&#xA;  ( Analytics code here... )&#xA;  {{ craft.config.google_analytics[craft.locale] }}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2014-11-26T12:20:40.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4956" PostTypeId="1" AcceptedAnswerId="4957" CreationDate="2014-11-26T16:57:44.973" Score="2" ViewCount="367" Body="&lt;p&gt;I'm trying to add a &quot;convenience&quot; link from within a plugin to it's general settings page. In the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;General Settings&lt;/a&gt; custom cpTriggers and baseCpUrl can be set to custom values and I'm wondering if there is a easy Craft variable to retrieve a link to the site's correct settings page. It would create something like this in a template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/customadminword/settings/plugins/mypluginname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? I could write some logic in the plugin to dig it out but it seems like I might be overlooking something obvious. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2014-11-26T17:05:30.783" Title="Linking to a plugin setting page?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4957" PostTypeId="2" ParentId="4956" CreationDate="2014-11-26T17:05:30.783" Score="9" Body="&lt;p&gt;Add a public &lt;code&gt;getSettingsUrl()&lt;/code&gt; function to your main plugin file that returns a URL string.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A full URL is not required -- you can simply return &amp;quot;pluginname/settings&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;If this is left blank, a simple settings page will be provided, filled with whatever getSettingsHtml() returns.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can then get the URL from elsewhere in Craft using the &lt;code&gt;PluginsService&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginname')-&amp;gt;getSettingsUrl();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or &lt;code&gt;PluginsVariable&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.plugins.getPlugin('pluginname').getSettingsUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2014-11-26T17:05:30.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4958" PostTypeId="1" AcceptedAnswerId="4959" CreationDate="2014-11-26T18:56:06.213" Score="2" ViewCount="2792" Body="&lt;p&gt;I have 3 entries. One of the entries got the entries field where Ive attached the two other entries. Im trying to display all the related entries whether entry 1, 2 or 3 is chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1: Has the entries field. When this entry is selected, I need to show entry 2 and 3&lt;/li&gt;&#xA;&lt;li&gt;Entry 2:  When this entry is selected I need to show entry 1 and 3 &lt;/li&gt;&#xA;&lt;li&gt;Entry 3:  When this entry is selected I need to show entry 1 and 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="125" LastEditDate="2014-11-27T09:00:44.813" LastActivityDate="2014-12-02T05:41:18.103" Title="How can I retrieve all the related entries?" Tags="&lt;templating&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4959" PostTypeId="2" ParentId="4958" CreationDate="2014-11-27T08:59:18.077" Score="3" Body="&lt;p&gt;This is more tricky then I first thought. I hope this is what you need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case the current &lt;code&gt;entry&lt;/code&gt; element is not the source of your relation, find that source entry first. This entry then goes into the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter of a new ElementCriteriaModel, where we exclude the current &lt;code&gt;entry&lt;/code&gt; entry using its ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code is probably more easy to understand than my wobbling english explanation: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{{ entry.body }}&#xA;&#xA;{# Get `allRelatedEntries` if this `entry` is the &quot;source element&quot; of the relation #}&#xA;{% set allRelatedEntries = craft.entries.relatedTo({ sourceElement: entry }) %}&#xA;&#xA;{# Get `allRelatedEntries` if this `entry` is the &quot;target element&quot; of the relation #}&#xA;{% if not allRelatedEntries|length %}&#xA;    {% set sourceElement = craft.entries.relatedTo({ targetElement: entry }).first() %}&#xA;&#xA;    {# Any relations at all? #}&#xA;    {% if sourceElement %}&#xA;        {% set targetElements = craft.entries.relatedTo({ sourceElement: sourceElement }).id('not ' ~ entry.id).find() %}&#xA;        {% if targetElements|length %}&#xA;            {% set allRelatedEntries = targetElements|merge([sourceElement]) %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% if allRelatedEntries|length %}&#xA;&#xA;    &amp;lt;h2&amp;gt;Related Entries&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for relatedEntry in allRelatedEntries %}&#xA;            &amp;lt;li&amp;gt;{{ relatedEntry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-01T10:43:35.800" LastActivityDate="2014-12-01T10:43:35.800" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="4961" PostTypeId="1" CreationDate="2014-11-27T12:31:28.310" Score="1" ViewCount="339" Body="&lt;p&gt;I am trying to create a new entry via a form post that will come from a third party, by doing this in my plugin's service class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = EntryModel::populateModel(array(&#xA;    'sectionId' =&amp;gt; 1, &#xA;    'typeId' =&amp;gt; 2&#xA;));&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('reference', craft()-&amp;gt;request-&amp;gt;getPost('someReferenceField'));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reference field is a custom FieldType (&lt;a href=&quot;https://github.com/fuel-digital/Craft-Unique-Text-FieldType/blob/develop/uniquetextfield/fieldtypes/UniqueTextField_UniqueTextFieldType.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fuel-digital/Craft-Unique-Text-FieldType/blob/develop/uniquetextfield/fieldtypes/UniqueTextField_UniqueTextFieldType.php&lt;/a&gt;) where I am validating the submitted value is unique for this EntryType (in this case an Entry rather than a User/Asset/etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That FieldType works fine in the control panel but I'm getting an error when submitting via my plugin as $this-&gt;element is null within the FieldType's valueExists() method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get around this by creating a new EntryModel like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Checks if another entry exists with the given value&#xA; * &#xA; * @param  string $value The value to check&#xA; * @return bool&#xA; */&#xA;private function valueExists($value)&#xA;{&#xA;    if ( ! $this-&amp;gt;element)&#xA;    {&#xA;        $this-&amp;gt;element = new EntryModel();&#xA;    }&#xA;&#xA;    $existing = craft()-&amp;gt;elements-&amp;gt;getCriteria($this-&amp;gt;element-&amp;gt;elementType)-&amp;gt;first(array(&#xA;        $this-&amp;gt;model-&amp;gt;handle =&amp;gt; $value&#xA;    ));&#xA;&#xA;    return ($existing &amp;amp;&amp;amp; $existing-&amp;gt;id != $this-&amp;gt;element-&amp;gt;id);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that means the FieldType will only work with Entry elements, and not Users, Assets etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the plugin works fine in the control panel, I assume I'm missing something in my plugin service?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-11-27T20:24:56.397" Title="FieldType's element attribute is null" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4962" PostTypeId="1" CreationDate="2014-11-27T15:36:33.630" Score="2" ViewCount="192" Body="&lt;p&gt;this is my first question on StackExchange regarding CraftCMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently im working on a plugin that should insert a relation row (in db) regarding an entry and asset (image). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple and easy way to insert a row in the DB with asset id, source id and field id?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="1041" LastActivityDate="2014-11-27T20:16:13.040" Title="Relation row insertion in DB (plugin)" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4963" PostTypeId="1" CreationDate="2014-11-27T16:22:25.877" Score="1" ViewCount="560" Body="&lt;p&gt;Suddenly getting errors when trying to save entries.&#xA;Have recently upgraded to latest version of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try up update a Single Entry I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to a member function getAttributes() on a non-object in /path-to-site/craft/app/controllers/EntriesController.php on line 484&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When a try to save a Channel in IE11 it pops up - Do you want to open or save - 210-a-new-news-articlef93bf125.json(1.09KB) from domainname.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is causing this problem?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-11-27T16:51:10.227" Title="Errors Saving Entries" Tags="&lt;entries&gt;&lt;error-message&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4964" PostTypeId="2" ParentId="4963" CreationDate="2014-11-27T16:51:10.227" Score="2" Body="&lt;p&gt;Sounds like something may be corrupt in your &lt;code&gt;/app&lt;/code&gt; folder... I'd recommend performing a &lt;a href=&quot;https://craftcms.stackexchange.com/q/329/45&quot;&gt;manual update&lt;/a&gt; to try to fix the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are still experiencing this issue after performing the manual update, I'd recommend contacting Pixel &amp;amp; Tonic directly, to report this as a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can email them at support@buildwithcraft.com, or use the &quot;Send a message to Craft Support&quot; widget on your dashboard.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-27T16:51:10.227" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4965" PostTypeId="2" ParentId="4962" CreationDate="2014-11-27T17:26:17.897" Score="2" Body="&lt;p&gt;If I'm understanding you correctly, what you're looking for is the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/RelationsService.php#L29&quot; rel=&quot;nofollow&quot;&gt;RelationsService's saveRelations()&lt;/a&gt; accessed via &lt;code&gt;craft()-&amp;gt;relations-&amp;gt;saveRelations()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You pass in your $fieldModel, $source ElementModel and an array of $targetIds that you want to created the relations to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-27T17:26:17.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4966" PostTypeId="1" AcceptedAnswerId="4969" CreationDate="2014-11-27T17:28:16.483" Score="1" ViewCount="599" Body="&lt;p&gt;If I have a matrix field with 2 fields &quot;Name&quot; and &quot;Entry&quot; is it possible to lookup the first row in that matrix field which has a specific &quot;Name&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Context: Twig template.&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-11-27T19:30:51.587" Title="Lookup row in matrix field by &quot;Name&quot; column?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4967" PostTypeId="1" AcceptedAnswerId="4968" CreationDate="2014-11-27T18:07:13.747" Score="1" ViewCount="243" Body="&lt;p&gt;The setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Section A&lt;/strong&gt; &lt;em&gt;(entries I want to list)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Section B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entries field (related to 1 entry from SectionA)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My goal is to list all entries from Section A, that are related to an entry in Section B  authored by the currentUser.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now what I'm doing is looping through all entries in Section B authored by the current user and querying/displaying the entry related to it, but it's way too inefficient and eats up a lot of database queries. Was hoping there's a more efficient way of doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure whether or not there's a way to achieve this sort of relation via a complex relatedTo or if I need to go another route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can provide additional information/clarification if anything is unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1048" LastActivityDate="2014-11-27T18:44:00.523" Title="Listing all entries in one section related to entries written by currentUser in another section" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4968" PostTypeId="2" ParentId="4967" CreationDate="2014-11-27T18:44:00.523" Score="7" Body="&lt;p&gt;I think this is what you mean:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionBEntries = craft.entries.section('B').authorId(currentUser.id) %}&#xA;&#xA;{# 'relatedTo' works both ways, so we can use sectionBEntries &#xA;    as input for relatedTo to get all section A entries that have &#xA;    a relation to one of the section B entries by currentUser #}&#xA;{% set sectionAEntries = craft.entries.section('A').relatedTo(sectionBEntries) %}&#xA;&#xA;{% for entry in sectionAEntries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-11-27T18:44:00.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4969" PostTypeId="2" ParentId="4966" CreationDate="2014-11-27T19:30:51.587" Score="3" Body="&lt;p&gt;According to &lt;a href=&quot;https://craftcms.stackexchange.com/a/2357/130&quot;&gt;this answer&lt;/a&gt; the only ways to filter matrix blocks are by type, or by position. So you need to use the &lt;code&gt;if&lt;/code&gt; condition on the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;twig for tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for m in entry.myMatrix if m.theName == nameImLookingFor %}&#xA;  {% if loop.index == 1 %}&#xA;    got the first one, it is {{m.theName}}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't want to loop over all of the blocks, you can also install the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow noreferrer&quot;&gt;mnbreakandcontinue plugin&lt;/a&gt; and break out of the loop after the first match:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for m in entry.myMatrix if m.theName == nameImLookingFor %}&#xA;  got the first one, it is {{m.theName}}&#xA;  {% break %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-11-27T19:30:51.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4971" PostTypeId="2" ParentId="4961" CreationDate="2014-11-27T20:24:56.397" Score="1" Body="&lt;p&gt;Found a solution by how &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry Form&lt;/a&gt; handles it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you've posted fields with names such as jobData[reference]:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldsLocation = craft()-&amp;gt;request-&amp;gt;getParam('fieldsLocation', 'jobData');&#xA;&#xA;$this-&amp;gt;entry-&amp;gt;setContentFromPost($fieldsLocation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The setContentFromPost() method of the EntriesController class sets the ElementType.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-11-27T20:24:56.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4972" PostTypeId="1" AcceptedAnswerId="4974" CreationDate="2014-11-27T23:43:09.287" Score="1" ViewCount="425" Body="&lt;p&gt;What is the recommended way to setup navigation, in a similar way to Wordpress?&#xA;So that certain pages or channels can be added, and some may be excluded from the navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what if I want to add a sub-navigation menu on a page to show the child pages?&lt;/p&gt;&#xA;" OwnerUserId="1049" LastActivityDate="2014-11-28T07:50:45.723" Title="Best way to provide navigation similar to wordpress" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4973" PostTypeId="1" AcceptedAnswerId="8647" CreationDate="2014-11-28T06:14:21.593" Score="3" ViewCount="245" Body="&lt;p&gt;Just wondering there is current any way to control the order of navigation items in the Control Panel. Obviously not a deal-breaker, but was just interested in being ultra-crafty in my Control Panel layout for clients :)&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-03-13T13:14:53.353" Title="Reorder Control Panel Navigation" Tags="&lt;control-panel&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4974" PostTypeId="2" ParentId="4972" CreationDate="2014-11-28T07:50:45.723" Score="3" Body="&lt;p&gt;I would recommend going with a &quot;Structure&quot;. This would be the build in way of doing it. You can setup the Structure to have it's own fields to control different &quot;Pages&quot; OR you can have it only use a related entries field and link to other entries anyway you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This topic has been discussed quite a lot and you have some great posts here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1473/would-you-use-a-structure-as-navigation-over-multiple-sections-channel-entries&quot;&gt;Would you use a Structure as navigation over multiple sections (channel entries, indexes and singles)?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/883/multi-lingual-site-navigation-made-of-singles-channels-and-structure&quot;&gt;Multi-lingual site navigation made of singles, channels and structure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1834/how-do-you-handle-complex-navigation-in-craft&quot;&gt;How do you handle complex navigation in Craft?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There's also &quot;Plugin&quot; solutions out there like &lt;a href=&quot;https://github.com/am-impact/amnav&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/am-impact/amnav&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-11-28T07:50:45.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4975" PostTypeId="2" ParentId="4973" CreationDate="2014-11-28T07:52:22.697" Score="2" Body="&lt;p&gt;I don't believe there is any way to reorder the CP navigation at this moment. The only way you would be able to achieve this is to create your own Plugin which injects some JS-magic on each page that adds your own custom HTML/CSS to replace the navigation or reorder the DOM-HTML tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would not recommend this though..&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-11-28T07:52:22.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4976" PostTypeId="1" AcceptedAnswerId="4990" CreationDate="2014-11-28T10:06:16.350" Score="2" ViewCount="640" Body="&lt;p&gt;I am new to Craft but loving its ease of use so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having a problem however when setting up a plugin to display an error to the user when using the onBeforeSaveEntry hook when a user saves an entry. I am looking to determine the value of a field and then take the user back to the entry page and display an error to the user based on a certain selection. Is this something that can be done with the Craft page when saving an entry?&lt;/p&gt;&#xA;" OwnerUserId="1050" LastEditorUserId="22" LastEditDate="2017-05-10T00:13:47.767" LastActivityDate="2017-05-10T00:13:47.767" Title="Displaying Error onBeforeSaveEntry" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4977" PostTypeId="1" AcceptedAnswerId="4992" CreationDate="2014-11-28T10:48:15.317" Score="0" ViewCount="246" Body="&lt;p&gt;I have an 'whatsOn' structure whose entries include two date fields: 'dateStart' and 'dateEnd'. The end date will be empty if the event is a one-dayer. I want to get all future events using the dateEnd (if not empty) or dateStart if not. So basically, all events that haven't ended yet. How do I add the 'dateEnd' bit to the following query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEvents = craft.entries({&#xA;    section: 'whatsOn',&#xA;    limit: 20,&#xA;    level: 2,&#xA;    order: 'dateStart',&#xA;    dateStart: '&amp;gt;= ' ~ now&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Crucially, I'll be paginating them so I need this to return an ElementCriteriaModel, I can't just do the check inside a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I just noticed that date fields are just empty (not null/undefined) if you don't select or enter a date. Amended question to reflect this.&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="125" LastEditDate="2014-11-29T20:11:13.670" LastActivityDate="2014-11-29T20:13:22.457" Title="Get entries filtered by date fields, one of which might be empty (and paginate them)" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4978" PostTypeId="1" AcceptedAnswerId="4986" CreationDate="2014-11-28T10:49:41.363" Score="2" ViewCount="734" Body="&lt;p&gt;I want to list all entries in a section by custom date time fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A training course has a From field and a To field. These fields are inside a &lt;em&gt;Matrix&lt;/em&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field name storing this info is called &lt;code&gt;trainingDateTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matrix block is called &lt;code&gt;trainingDateTimeDateTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matrix fields in this block are called and &lt;code&gt;dateTimeFrom&lt;/code&gt; and &lt;code&gt;dateTimeTo&lt;/code&gt; both &lt;em&gt;datetime&lt;/em&gt; fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My entries loop so far is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;training&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know you can do order entries by a custom &lt;em&gt;datetime&lt;/em&gt; field using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;training&quot;).customDateTime.('&amp;gt;= ' ~ now).order('customDateTime DESC') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But since I'm using a &lt;em&gt;matrix&lt;/em&gt; field I'm unsure how to approach this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wanting to show all upcoming training courses from the current month up till the next 2 months.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-11-28T15:33:49.623" Title="Get entries by custom matrix / date time field" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;datetime&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4979" PostTypeId="2" ParentId="4341" CreationDate="2014-11-28T10:55:09.303" Score="2" Body="&lt;p&gt;I found this to work for what I needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextImage = image.getNext() %}&#xA;{% if nextImage %}&#xA;&#xA;    {% if nextImage.checkboxFieldHandle.contains('value') %}&#xA;        {# Do something #}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastActivityDate="2014-11-28T10:55:09.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4980" PostTypeId="1" AcceptedAnswerId="4982" CreationDate="2014-11-28T11:21:38.787" Score="3" ViewCount="3218" Body="&lt;p&gt;I can find examples of prev/next style pagination but none of creating proper numeric-style pagination (eg. how Google do it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an example I could use?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2019-05-10T00:31:36.430" Title="Any examples of numeric pagination?" Tags="&lt;pagination&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4981" PostTypeId="1" AcceptedAnswerId="4983" CreationDate="2014-11-28T11:36:27.033" Score="4" ViewCount="244" Body="&lt;p&gt;I've structured my site so that most of the pages are in a single structure section (easier to manage that way and it means all my pages can be outputted and organised in the navigation's &lt;code&gt;{% nav %}&lt;/code&gt; tag).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set up pages that have their own templates and would have been singles as new entry types (e.g. contact page, register form or members area) but it means that the user might try to add another one of those sections in, which I don't want them doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a way to limit how many times an entry type can be used?&lt;/p&gt;&#xA;" OwnerUserId="451" LastEditorUserId="451" LastEditDate="2014-11-28T13:23:38.327" LastActivityDate="2015-08-04T04:47:56.327" Title="Is it possible to limit how many times and entry type can be used?" Tags="&lt;structure&gt;&lt;entry-type&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4982" PostTypeId="2" ParentId="4980" CreationDate="2014-11-28T11:47:16.273" Score="12" Body="&lt;p&gt;Sure, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/templating/paginate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blog').limit(10) as entries %}&#xA;    &amp;lt;a href=&quot;{{ paginate.firstUrl }}&quot;&amp;gt;First Page&amp;lt;/a&amp;gt;&#xA;    {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;    {% for page, url in paginate.getPrevUrls(5) %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;span class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;    {% for page, url in paginate.getNextUrls(5) %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    &amp;lt;a href=&quot;{{ paginate.lastUrl }}&quot;&amp;gt;Last Page&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs something along the lines of: First Page, Previous Page, (nearby page numbers), Next Page, Last Page &lt;/p&gt;&#xA;" OwnerUserId="451" LastEditorUserId="2274" LastEditDate="2016-07-17T05:51:47.600" LastActivityDate="2016-07-17T05:51:47.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4983" PostTypeId="2" ParentId="4981" CreationDate="2014-11-28T13:35:25.173" Score="2" Body="&lt;p&gt;If you're working with frontend forms, set the permission to use any of these entry types to a specific user group or to admins only. Use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;isInGroup&lt;/code&gt;&lt;/a&gt; or the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#admin&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;admin&lt;/code&gt;&lt;/a&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.admin %} ... {% endif %}&#xA;{% if currentUser.isInGroup('usersWithSomeEntryTypesHidden') %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need this in the CP, you could make a plugin that does the same and hides selected entry types from the dropdown using JS. As this is no nice solution, what about making this a feature request to Pixel &amp;amp; Tonic?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-28T13:40:46.063" LastActivityDate="2014-11-28T13:40:46.063" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4984" PostTypeId="1" CreationDate="2014-11-28T14:35:33.537" Score="2" ViewCount="1729" Body="&lt;p&gt;I'm wondering how I would go about limiting the number of results returned from a set using the group filter? I only want four to show, but using the &lt;code&gt;limit()&lt;/code&gt; method seems to throw errors wherever I put it. Here's my template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('recipes').find() %}&#xA;&#xA;{% for category, catEntries in entries | group('cuisineType.first().title') %}&#xA;&#xA;    {% for entry in catEntries %}&#xA;&#xA;       // I only want four entries shown here&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1051" LastEditorUserId="250" LastEditDate="2014-11-28T18:29:46.990" LastActivityDate="2014-11-28T18:29:46.990" Title="How to limit number of entries returned from a group filter?" Tags="&lt;templating&gt;&lt;filter&gt;&lt;category&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4985" PostTypeId="2" ParentId="4984" CreationDate="2014-11-28T15:09:45.727" Score="5" Body="&lt;p&gt;The reason &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot;&gt;&lt;code&gt;limit()&lt;/code&gt;&lt;/a&gt; isn't working is that is a method on the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;&lt;code&gt;ElementCriteriaModel&lt;/code&gt;&lt;/a&gt; you get from &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you're actually dealing with a standard array when you access &lt;code&gt;catEntries&lt;/code&gt;, what you want instead is Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot;&gt;&lt;code&gt;|slice(start, length)&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in catEntries|slice(0, 4) %}&#xA;&#xA;   // You'll only get four entries shown here&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2014-11-28T15:09:45.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4986" PostTypeId="2" ParentId="4978" CreationDate="2014-11-28T15:33:49.623" Score="2" Body="&lt;p&gt;I found the solution by using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = now %}&#xA;{% set endDate = (now | date_modify(&quot;+2 months&quot;)) %}&#xA;{% set allTraining = craft.lowblocks.blocks.fieldId(72).type(&quot;trainingDateTimeDateTime&quot;).order(&quot;dateTimeFrom&quot;).limit(null) %}&#xA;{% set entryIds = [] %}&#xA;{% for course in allTraining %}&#xA;    {% if (course.dateTimeFrom &amp;gt;= startDate) and (course.dateTimeFrom &amp;lt;= endDate) %}&#xA;        {% set entry = course.owner %}&#xA;        {% set entryIds = entryIds | merge([entry.id]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% set entries = craft.entries.section(&quot;training&quot;).id(entryIds).fixedOrder(true).status(&quot;live,pending&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-11-28T15:33:49.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4987" PostTypeId="1" CreationDate="2014-11-28T15:47:06.987" Score="0" ViewCount="129" Body="&lt;p&gt;I'm trying to set up Craft and on deployment to a staging server am getting the following error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An exception has been thrown during the rendering of a template&#xA;  (&quot;Craft can't connect to the database with the credentials in&#xA;  craft/config/db.php.&quot;) in &quot;_layout&quot; at line 39.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The config file in question is posted up at &lt;a href=&quot;https://gist.github.com/cole007/f32c7ba984a3d35b1d24&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/cole007/f32c7ba984a3d35b1d24&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2014-11-28T16:12:24.403" Title="Multi-environment config issue" Tags="&lt;config&gt;&lt;database&gt;&lt;multi-environment&gt;&lt;environments&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4988" PostTypeId="2" ParentId="4987" CreationDate="2014-11-28T16:12:24.403" Score="1" Body="&lt;p&gt;Sorted, thanks. The keen-eyed of you will notice that there was a space character in the server connection details. Idiot&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2014-11-28T16:12:24.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4989" PostTypeId="1" AcceptedAnswerId="4991" CreationDate="2014-11-28T16:39:11.737" Score="1" ViewCount="66" Body="&lt;p&gt;I am working on a plan for a site build that includes national content as well as many chapters' content. The latter has a number of requirements that are leading me to using separate sections including a structure for general pages and news, and events channels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So looking at 3 sections per chapter and starting with around 20 chapters with more to come over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not worried about the manual setup of these (albeit it's not ideal); however, I am concerned about hitting limits either in the interface and/or performance of Craft that I just may not be as familiar with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As chapter numbers grow, will this be too many sections for Craft to handle?&lt;/p&gt;&#xA;" OwnerUserId="329" LastActivityDate="2014-11-29T01:22:09.150" Title="Architecting a Solution with many Sites within a Site (Chapters) - How many sections can Craft Handle?" Tags="&lt;sections&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4990" PostTypeId="2" ParentId="4976" CreationDate="2014-11-28T16:41:04.143" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this something that can be done with the Craft page when saving an entry?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In 2.2, there isn't an easy way.  In the upcoming 2.3 release, we added a &lt;code&gt;$performAction&lt;/code&gt; property to the event, so your can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;addError('attribute', 'MyErrorMessage');&#xA;$event-&amp;gt;performAction = false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And Craft will not save the entry and return to the edit entry page to display any validation errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should post your second question as an entirely new question.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-28T16:41:04.143" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4991" PostTypeId="2" ParentId="4989" CreationDate="2014-11-29T01:22:09.150" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;As chapter numbers grow, will this be too many sections for Craft to handle?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably not.  I suspect as your section list grows to the multi-thousand section range (if it will ever get that large), you'll start to run into MySQL/environmental limitations rather than any Craft ones.  But if  you do run into any UI/architectural limitations, we'd love to hear about them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the upcoming Craft 2.3 release, we spent a great deal of time addressing UI scaling issues around Structured Sections and Categories when they start to approach the multi-thousand range, but we've seem installations with several hundred thousands of Channel entries/assets/users running just fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-29T01:22:09.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4992" PostTypeId="2" ParentId="4977" CreationDate="2014-11-29T01:27:36.073" Score="2" Body="&lt;p&gt;There's no way to simply add it to that query you have. But you can use the following workaround.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You first do all the logic within such conditionals you actually wanted to avoid, but instead of getting the ElementModels directly, you do an extra step and get / collect the entries' IDs using the &lt;code&gt;ids()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're ready, use these IDs with the &lt;code&gt;id&lt;/code&gt; property in a second ElementCriteriaModel. This you can paginate like you want!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;br&gt;Here's some example code!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cutoffDate = 'now'|date_modify('- ' ~ '7' ~ ' days') %}&#xA;{% set events = craft.entries.section('events').order('dateStart desc') %}&#xA;&#xA;{% set eventIds = [] %}&#xA;{% for event in events if (event.dateEnd ? event.dateEnd : event.dateStart) &amp;gt;= cutoffDate %}&#xA;    {% set eventIds = eventIds|merge([event.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set filteredEvents = craft.entries.id(eventIds).fixedOrder('true') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-11-29T20:13:22.457" LastActivityDate="2014-11-29T20:13:22.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4993" PostTypeId="1" AcceptedAnswerId="4994" CreationDate="2014-11-29T03:56:51.147" Score="5" ViewCount="1668" Body="&lt;p&gt;In a follow up to my earlier question, I'm focusing on cleaning up my code to keep it incredibly simple. I've moved on from the Controller and Model to the Model and Service. Typically you would have something like the following in a service method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = new MyRecord();&#xA;&#xA;$record-&amp;gt;name           = $model-&amp;gt;name;&#xA;$record-&amp;gt;anotherField   = $model-&amp;gt;anotherField;&#xA;// etc..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works and you end up defining the attributes in &lt;code&gt;_attributes&lt;/code&gt; as an array like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[*:_attributes] =&amp;gt; array&#xA;    (&#xA;        'uid' =&amp;gt; '0'&#xA;        'name' =&amp;gt; 'My Name'&#xA;        'anotherField' =&amp;gt; 'Another Field'&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The logic that I am looking for, which I'm sure someone will tell me I am just using the wrong method, can be seen in the controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSave()&#xA;    {&#xA;        // require a post request&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // assign the fields from post request&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost('fields');&#xA;&#xA;        // create a model, populate with the assigned fields&#xA;        $model = MyModel::populateModel($post);&#xA;&#xA;        // validate attributes&#xA;        if ($model-&amp;gt;validate()) {&#xA;&#xA;            // save the record&#xA;            craft()-&amp;gt;myPlugin-&amp;gt;saveNew($model);&#xA;&#xA;            // redirect to posted url&#xA;            $this-&amp;gt;redirectToPostedUrl();&#xA;        }&#xA;&#xA;        // grab errors from the model&#xA;        $errors = $model-&amp;gt;getErrors();&#xA;&#xA;        // return errors to the template as 'errors'&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'errors'    =&amp;gt; $errors&#xA;        ));&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the controller code, I'm populating the &lt;code&gt;model&lt;/code&gt; with the &lt;code&gt;post&lt;/code&gt; with this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`$model = MyModel::populateModel($post);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to create the same behavior for the method in the service to &quot;automagically&quot; assign the model attributes to the &lt;code&gt;$record&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2014-11-29T04:04:14.333" LastActivityDate="2014-12-02T16:51:25.013" Title="Populate a record with a model?" Tags="&lt;plugin-development&gt;&lt;best-practice&gt;&lt;models&gt;&lt;records&gt;&lt;services&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4994" PostTypeId="2" ParentId="4993" CreationDate="2014-11-29T04:24:15.853" Score="2" Body="&lt;p&gt;Yii does have the equivalent &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#populateRecord-detail&quot; rel=&quot;nofollow&quot;&gt;populateRecord&lt;/a&gt; and &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#populateRecords-detail&quot; rel=&quot;nofollow&quot;&gt;populateRecords&lt;/a&gt; on &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord&quot; rel=&quot;nofollow&quot;&gt;CActiveRecord&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on both the populateModel(s) and populateRecord(s) methods, you should be very cautious of blindly mass-assigning untrusted inputs to models/records that participate in the Active Record pattern (like Craft/Yii does).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They can be susceptible to what's known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mass_assignment_vulnerability&quot; rel=&quot;nofollow&quot;&gt;Mass Assignment Vulnerability&lt;/a&gt; that many popular frameworks have been a victim of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yii does what it can to protect against this, but my personal preference is to explicitly assign each individual attributes on the model/record in the case of untrusted input to avoid the issue altogether.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-29T04:24:15.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4995" PostTypeId="1" CreationDate="2014-11-29T16:11:57.950" Score="3" ViewCount="109" Body="&lt;p&gt;If I had a structure representing the user guide of a product; is it possible to select a specific version of user guide entries from a URL?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.example.com/myproduct/docs/v2.0/installation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the logic would be something like (pseudo-code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries('myProductDocs').versionLowerOrEqual('2.0').slug('installation')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see that Craft has some provision for versioning entries since you can select from the drop-down in the entry editor interface. Is there a way to tame this?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-11-30T23:26:02.963" Title="Many versions of the same structure of entries?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4996" PostTypeId="1" CreationDate="2014-11-29T17:03:42.313" Score="1" ViewCount="505" Body="&lt;p&gt;Can't install on the production side... Please see error below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/11/29 16:16:38 [warning] [application] 404 - &#xA;2014/11/29 16:16:38 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/saveandl/public_html/craft/app/etc/web/WebApp.php:765&#xA;Stack trace:&#xA;#0 /home/saveandl/public_html/craft/app/etc/web/WebApp.php(194): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /home/saveandl/public_html/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /home/saveandl/public_html/craft/app/index.php(35): CApplication-&amp;gt;run()&#xA;#3 /home/saveandl/public_html/saveandlearn/index.php(14): require_once('/home/saveandl/...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2014/11/29 16:18:33 [warning] [application] Skipping record /home/saveandl/public_html/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;2014/11/29 16:18:33 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'craft_assetfiles' already exists. The SQL statement executed was: CREATE TABLE `craft_assetfiles` (&#xA;    `id` INT(11) NOT NULL PRIMARY KEY,&#xA;    `sourceId` INT(11) NULL,&#xA;    `folderId` INT(11) NOT NULL,&#xA;    `filename` VARCHAR(255) NOT NULL,&#xA;    `kind` VARCHAR(50) NOT NULL DEFAULT &quot;unknown&quot;,&#xA;    `width` SMALLINT(6) UNSIGNED NULL,&#xA;    `height` SMALLINT(6) UNSIGNED NULL,&#xA;    `size` INT(11) UNSIGNED NULL,&#xA;    `dateModified` datetime NULL,&#xA;    `dateCreated` datetime NOT NULL,&#xA;    `dateUpdated` datetime NOT NULL,&#xA;    `uid` CHAR(36) NOT NULL DEFAULT 0&#xA;) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.&#xA;2014/11/29 16:18:34 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'craft_assetfiles' already exists' in /home/saveandl/public_html/craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 /home/saveandl/public_html/craft/app/framework/db/CDbCommand.php(1324): CDbCommand-&amp;gt;execute()&#xA;#1 /home/saveandl/public_html/craft/app/etc/db/DbCommand.php(481): CDbCommand-&amp;gt;createTable('craft_assetfile...', Array, NULL)&#xA;#2 /home/saveandl/public_html/craft/app/records/BaseRecord.php(296): Craft\DbCommand-&amp;gt;createTable('assetfiles', Array, NULL, false)&#xA;#3 /home/saveandl/public_html/craft/app/services/InstallService.php(167): Craft\BaseRecord-&amp;gt;createTable()&#xA;#4 /home/saveandl/public_html/craft/app/services/InstallService.php(56): Craft\InstallService-&amp;gt;_createTablesFromRecords(Array)&#xA;#5 /home/saveandl/public_html/craft/app/controllers/InstallController.php(159): Craft\InstallService-&amp;gt;run(Array)&#xA;#6 /home/saveandl/public_html/craft/app/framework/web/actions/CInlineAction.php(49): Craft\InstallController-&amp;gt;actionInstall()&#xA;#7 /home/saveandl/public_html/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 /home/saveandl/public_html/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 /home/saveandl/public_html/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 /home/saveandl/public_html/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('install')&#xA;#11 /home/saveandl/public_html/craft/app/etc/web/WebApp.php(876): CWebApplication-&amp;gt;runController('install/install')&#xA;#12 /home/saveandl/public_html/craft/app/etc/web/WebApp.php(749): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /home/saveandl/public_html/craft/app/etc/web/WebApp.php(194): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#14 /home/saveandl/public_html/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#15 /home/saveandl/public_html/craft/app/index.php(35): CApplication-&amp;gt;run()&#xA;#16 /home/saveandl/public_html/saveandlearn/index.php(14): require_once('/home/saveandl/...')&#xA;#17 {main}&#xA;REQUEST_URI=/index.php/admin/actions/install/install&#xA;HTTP_REFERER=http://saveandlearn.fami.com.ph/admin/install&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1053" LastEditorUserId="45" LastEditDate="2014-11-29T21:47:06.877" LastActivityDate="2014-11-29T21:53:56.300" Title="Installation error" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4997" PostTypeId="2" ParentId="4996" CreationDate="2014-11-29T21:53:56.300" Score="1" Body="&lt;p&gt;Without digging too deep into what's going on here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like you're trying to install Craft into a database which already contains some tables. I say that because of lines like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'craft_assetfiles' already exists.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would recommend dropping &lt;em&gt;every&lt;/em&gt; &quot;craft_&quot; table in your database, and starting over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, I'd then replace your &lt;code&gt;/app&lt;/code&gt; folder with a brand new copy... make sure the entire folder is FTP'd properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if neither of those suggestions work, I'd contact Pixel &amp;amp; Tonic directly (support@buildwithcraft.com), since you may have stumbled across an obscure bug or weird system configuration issue.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-11-29T21:53:56.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4998" PostTypeId="1" CreationDate="2014-11-30T09:28:58.983" Score="0" ViewCount="94" Body="&lt;p&gt;There seems to be an issue with HelveticaNeue in chrome, on Windows 7. If I manually edit the fontface using dev tools I can get the text to display in the default font. Doing a bit of searching online and this seems to be a bit of chrome bug for certain people, so is there any way to change the font altogether for the cp? Or a chrome fix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wLBka.jpg&quot; alt=&quot;craft font issue&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2014-11-30T11:33:35.833" Title="Strange Font Issue with Control Panel" Tags="&lt;control-panel&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2014-12-01T05:40:28.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="4999" PostTypeId="1" AcceptedAnswerId="5001" CreationDate="2014-11-30T10:22:29.627" Score="2" ViewCount="3711" Body="&lt;p&gt;I have a craft installation (that's up to date), that was installed with english as the system language. Now that Craft has quite a lot of system languages, is there a way to change to another language for the control panel?&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2017-03-16T14:31:33.597" Title="Change system language" Tags="&lt;control-panel&gt;&lt;language&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5000" PostTypeId="2" ParentId="4998" CreationDate="2014-11-30T11:33:35.833" Score="1" Body="&lt;p&gt;Its probably not a good idea to go in and change the fonts for Craft yourself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please submit a bug report to support@pixelandtonic.com, and they will have a look into the issue. &lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-11-30T11:33:35.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5001" PostTypeId="2" ParentId="4999" CreationDate="2014-11-30T17:42:07.400" Score="7" Body="&lt;p&gt;If you're running Craft Personal or Client, you'll need to go to the &lt;code&gt;craft_locales&lt;/code&gt; table in your database and change the locale to one of the support Craft control panel translations (&lt;a href=&quot;http://buildwithcraft.com/help/cp-languages&quot;&gt;http://buildwithcraft.com/help/cp-languages&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running Craft Pro, you can go to Settings-&gt;Locales and add (and re-order) new locales to your site.  Then you can go to your user account settings and set your preferred locale from list of existing site locales and the CP will display in that.  Again assuming it's one of the locales that the control panel has already been translated into.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-30T17:42:07.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5002" PostTypeId="1" AcceptedAnswerId="5006" CreationDate="2014-11-30T19:18:54.327" Score="3" ViewCount="138" Body="&lt;p&gt;I just realized that Craft puts the username into the path of the &lt;code&gt;photoUrl&lt;/code&gt;. Since I use email addresses as usernames, I don’t think it’s a good idea to expose the email addresses of all users on the web.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Is there a way to remove the username (in my case email address) from the photo path and replace it with the users ID for example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to get around adding a new asset field for every user, since the user photo would be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus question:&lt;/strong&gt; is there any way to protect user photos from access at all? It looks to me like the urls to the user photos could be guessed quite easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best, Mark&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2014-11-30T23:47:54.863" Title="Remove username from photoUrl path" Tags="&lt;user-profile&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5004" PostTypeId="2" ParentId="4567" CreationDate="2014-11-30T21:34:59.997" Score="3" Body="&lt;p&gt;You could use the Twig functions &lt;code&gt;merge&lt;/code&gt; and &lt;code&gt;default&lt;/code&gt; to merge the two sets of entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score')|default([]) %}&#xA;{% set authors = craft.users.search('fullName:*' ~ query ~ '*')|default([]) %}&#xA;&#xA;{% if authors %}&#xA;    {% set results = entries|merge(authorArticles) %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;p&amp;gt;&#xA;    You have {{ results|length }} {{ results|length == 1 ? 'result' : 'results' }}.&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;default&lt;/code&gt; function is a handy stand-in for short circuit evaluation in twig, so that you can be sure to at least pass an empty array to &lt;code&gt;merge&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1027" LastActivityDate="2014-11-30T21:34:59.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5005" PostTypeId="2" ParentId="4995" CreationDate="2014-11-30T23:26:02.963" Score="1" Body="&lt;p&gt;I don't know about searching by version ID natively — I don't think Craft has that capability out-of-the-box... but I can envision setting up such a user guide using a Matrix, where each Matrix block represents a revision of content: Each block would have a field denoting which version the content was written for, along with the content itself. By default, you'd display each entry's most recent content by sorting the blocks by version-update number, and selecting the single most recent block from the sorted set. However, you could also display the docs for a 'legacy' version by filtering out blocks where the version-update number is greater than the version of interest.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-11-30T23:26:02.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5006" PostTypeId="2" ParentId="5002" CreationDate="2014-11-30T23:47:54.863" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Since I use email addresses as usernames, I don’t think it’s a good idea to expose the email addresses of all users on the web.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I agree, and that's something we overlooked when we added the '&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#useEmailAsUsername&quot; rel=&quot;nofollow&quot;&gt;useEmailAsUsername&lt;/a&gt;' config setting.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Question: Is there a way to remove the username (in my case email address) from the photo path and replace it with the users ID for example?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Currently not, unfortunately.  And it's hard-coded so there really isn't a chance for a plugin to override the behavior.  And I don't think it's really any better to be displaying a user's ID or UID as well, since people wouldn't expect those to be publicly available by default.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Bonus question: is there any way to protect user photos from access at all? It looks to me like the urls to the user photos could be guessed quite easily.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the proper solution to both problems would be, upon uploading a user profile photo, generate a random string and save that along with the user in the database.  The string would be used in the URL when retrieving the user's profile photo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add it to our list to address.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-11-30T23:47:54.863" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5007" PostTypeId="2" ParentId="4946" CreationDate="2014-12-01T10:21:36.223" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to P&amp;amp;T this workaround is not necessary any more with &lt;a href=&quot;http://buildwithcraft.com/updates#build2616&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2616&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This was my temporary solution / bugfix:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I think you're right, Live Preview seems to only update if changes to the automatically provided &lt;code&gt;entry&lt;/code&gt; EntryModel are detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this causes problems with Live Preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get `entry` manually #}&#xA;{% set home = craft.entries.section('home').first() %}&#xA;{{ home.welcome }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while this works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.welcome }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get Live Preview working with your Chapters example, you'd need to somehow make the connection to the &lt;code&gt;entry&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I came up with is this: you still loop through the &lt;code&gt;chapters&lt;/code&gt; returned from your &lt;code&gt;craft.entries&lt;/code&gt; call. But within the loop you conditionally overwrite the &lt;code&gt;chapter&lt;/code&gt; variable in case it matches your current &lt;code&gt;entry&lt;/code&gt; EntryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also replaced &lt;code&gt;getSegment()&lt;/code&gt; with &lt;code&gt;getAncestors()&lt;/code&gt;, to not rely on any specific paths / routes that might change in the future:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the top level entry #}&#xA;{% if entry.level != 1 %}&#xA;    {% set rootEntry = entry.getAncestors().first() %}&#xA;{% else %}&#xA;    {% set rootEntry = entry %}&#xA;{% endif %}&#xA;&#xA;{{ rootEntry.body }}&#xA;&#xA;{% set chapters = rootEntry.children %}&#xA;{% for chapter in chapters %}&#xA;&#xA;    {# Bugfix for live preview #}&#xA;    {% if chapter.id == entry.id %}{% set chapter = entry %}{% endif %}&#xA;&#xA;    {{ chapter.body }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-04T08:13:36.720" LastActivityDate="2014-12-04T08:13:36.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5009" PostTypeId="2" ParentId="4281" CreationDate="2014-12-01T14:29:49.583" Score="1" Body="&lt;p&gt;I had a similar problem and ended up creating my own fieldtype that extended a RichText field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there is an oversight in Craft, where additional Redactor plugins aren't loaded even if they are specified in the config.json. But perhaps I'm missing something too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple solution would be to hardcode the loading of the plugin in &lt;strong&gt;craft/app/fieldtypes/RichTextFieldType.php&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the function &lt;strong&gt;_includeFieldResources()&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;add the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJsResource('lib/redactor/plugins/subsup.js');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;after the default plugins specified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously modifying a core file is not recommended, but this should enable a temporary fix. I have built a plugin which autoloads js/css depending on what is specified in the config, but this isn't currently ready for general release. Let me know if your interested.&lt;/p&gt;&#xA;" OwnerUserId="724" LastActivityDate="2014-12-01T14:29:49.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5010" PostTypeId="1" CreationDate="2014-12-01T14:34:43.277" Score="2" ViewCount="421" Body="&lt;p&gt;We are running Craft on a site that gets a decent level of traffic, thousands of hits per day. We are running craft caching to try and keep things quick. The caching tables have been growing significantly over the past few days and don't appear to be clearing out. These are the three tables and the row counts. 1+ million rows in two of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;| craft_templatecaches                |      34685 |&#xA;| craft_templatecachecriteria         |    1197874 |&#xA;| craft_templatecacheelements         |    1364424 |&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on why these tables would be growing so large and why they don't appear to be removing any old rows?&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2014-12-01T18:31:38.250" Title="Caching tables not clearing out" Tags="&lt;database&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5011" PostTypeId="1" CreationDate="2014-12-01T17:42:25.400" Score="1" ViewCount="283" Body="&lt;p&gt;I'm trying to using craft caching to cache a page without query string vars. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key craft.request.path  %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;throws an error &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unexpected token &quot;name&quot; of value &quot;using&quot; (&quot;end of statement block&quot; expected) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example is right from the Craft Docs, &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the &quot;using ...&quot; everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="728" LastEditorUserId="57" LastEditDate="2017-08-18T22:02:24.880" LastActivityDate="2017-08-18T22:02:24.880" Title="Cache closing tag error" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5012" PostTypeId="2" ParentId="5010" CreationDate="2014-12-01T18:31:38.250" Score="2" Body="&lt;p&gt;Sounds like you probably have a stuck or error'd &quot;Delete Stale Template Cache&quot; task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell if a task is stuck because there will be a circular progress bar in the upper-right hand corner of the CP that isn't progressing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it error'd, it will be red and you'll have the option to re-try it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, here's the general troubleshooting steps necessary for both cases: &lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-01T18:31:38.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5013" PostTypeId="1" AcceptedAnswerId="5027" CreationDate="2014-12-01T19:07:25.777" Score="3" ViewCount="758" Body="&lt;p&gt;When I upload animated gif assets to a Craft site, they end up static and corrupted, as so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rG72Q.gif&quot; alt=&quot;Holey Seagull&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://thumbpress.com/wp-content/uploads/2014/06/funny-gif-seagull-fighting-worm1.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;Original here&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that what's displayed is the last frame of the animation (which only contains pixels changed from the penultimate frame).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other image resizing functions work. The site is hosted on a dedicated Ubuntu box with PHP 5.3.10. Here's what &lt;code&gt;phpinfo()&lt;/code&gt; says about my ImageMagick/Imagick install.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imagick module version =&amp;gt; 3.1.0RC1&#xA;imagick classes =&amp;gt; Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator&#xA;ImageMagick version =&amp;gt; ImageMagick 6.6.9-7 2014-03-06 Q16 http://www.imagemagick.org&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Calling &lt;code&gt;convert source.gif -resize 123x123 dest.gif&lt;/code&gt; works on the server—the issue seems to lie in the PHP call to ImageMagick rather than in the installation itself. Answers to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2460/gif-animations-not-appearing&quot;&gt;this question&lt;/a&gt; indicate that GIF issues disappear with the proper configuration, but I fail to see what's lacking in this particular setup.&lt;/p&gt;&#xA;" OwnerUserId="763" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-12-02T17:14:00.337" Title="GIF animations garbled and static" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5014" PostTypeId="2" ParentId="5011" CreationDate="2014-12-01T21:19:08.190" Score="3" Body="&lt;p&gt;Make sure you're running the latest version of Craft.  &lt;code&gt;using key&lt;/code&gt; didn't come until Craft 2.2.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-01T21:19:08.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5015" PostTypeId="2" ParentId="4958" CreationDate="2014-12-01T22:20:55.940" Score="1" Body="&lt;p&gt;Here is a bare bones example of how I would deal with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would essentially build an array of the ids I need and then retrieve the entries based on those IDs. It's an &lt;a href=&quot;http://www.webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/&quot; rel=&quot;nofollow&quot;&gt;example of a technique I recently wrote about&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{{ entry.body }}&#xA;&#xA;{# create empty array #}&#xA;{% set relatedItemsIds = [] %}&#xA;&#xA;{# if entry field is not empty, merge entry ids into array #}&#xA;{% if entry.newsRelatedItems|length %}&#xA;  {% set relatedItemsIds = relatedItemsIds|merge(entry.newsRelatedItems.ids()) %}&#xA;{% endif %}&#xA;&#xA;{# find source item in the relationship using the current entry #}&#xA;{% set sourceItem = craft.entries.section('news').relatedTo({&#xA;  targetElement: entry&#xA;}).first() %}&#xA;&#xA;{# &#xA; # if source item is found&#xA; # - merge its id to the array&#xA; # - merge the ids of its target entries to the array but remove the current entry id from that merged array&#xA; #}&#xA;{% if sourceItem %}&#xA;  {% set relatedItemsIds = relatedItemsIds|merge(craft.entries.section('news').id(sourceItem.id).ids()) %}&#xA;  {% set relatedItemsIds = relatedItemsIds|merge(sourceItem.newsRelatedItems.ids())|without(entry.id) %}&#xA;{% endif %}&#xA;&#xA;{# use created array to retrieve an ElementCriteriaModel for the entries you need #}&#xA;{% set relatedItems = craft.entries.section('news').id(relatedItemsIds).fixedOrder(true).find() %}&#xA;&#xA;{# display entries #}&#xA;&amp;lt;h2&amp;gt;Related entries&amp;lt;/h2&amp;gt;&#xA;{% for entry in relatedItems %}&#xA;  &amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;No related entries found&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tested this code on my local sandbox. Can you check if it works for your use case ?&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2014-12-02T05:41:18.103" LastActivityDate="2014-12-02T05:41:18.103" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5016" PostTypeId="1" CreationDate="2014-12-02T00:43:06.357" Score="0" ViewCount="167" Body="&lt;p&gt;This is somewhat related to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1639/how-can-i-display-a-pending-entry-in-my-entry-template&quot;&gt;How can I display a &amp;quot;pending&amp;quot; entry in my &amp;quot;_entry&amp;quot; template?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an 'events' section where some entries have a future date - the above link solved my issue to get those listed in a sidebar and display single entries while ignoring the date. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a homepage slider (a matrix field) where each slide can link to an entry - problem is those entries with a future date from the 'events' section are simply not showing up.(block.slideLink is my entries field inside the matrix)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to get around this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeslider %}&#xA;    {% if block.type == 'slides' %}         &#xA;        &amp;lt;div class=&quot;item {% if loop.first %}active{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ siteUrl }}assets/img/slide-1.jpg&quot; alt=&quot;&quot; /&amp;gt;&#xA;            &amp;lt;div class=&quot;k-carousel-caption pos-2-3-right scheme-dark&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;caption-content&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;caption-title&quot;&amp;gt;{{ block.slideTitle }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ block.slideIntro }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&#xA;                        {% for link in block.slideLink %}&#xA;                        &amp;lt;a href=&quot;{{ link.url }}&quot; class=&quot;btn btn-sm btn-danger&quot;&amp;gt;lees verder...&amp;lt;/a&amp;gt;                                               &#xA;                        {% endfor %}&#xA;                    &amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="166" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-12-02T08:00:50.503" Title="In a matrix, link to entries with a future date" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5017" PostTypeId="2" ParentId="5016" CreationDate="2014-12-02T01:06:45.880" Score="2" Body="&lt;p&gt;Forgot to take the entry status into account + an additional check for the sectionhandle to cover the custom route.&#xA;This solved it for me, if you have a better suggestion I'm all ears.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for link in block.slideLink.status('live', 'pending') %}&#xA;    {% if link.section.handle == 'events' %}&#xA;        &amp;lt;a href=&quot;{{ siteUrl }}events/{{ link.slug }}&quot; class=&quot;btn btn-sm btn-danger&quot;&amp;gt;lees verder...&amp;lt;/a&amp;gt; &#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ link.url }}&quot; class=&quot;btn btn-sm btn-danger&quot;&amp;gt;lees verder...&amp;lt;/a&amp;gt; &#xA;    {% endif %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="166" LastEditorUserId="125" LastEditDate="2014-12-02T08:00:50.503" LastActivityDate="2014-12-02T08:00:50.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5018" PostTypeId="2" ParentId="4281" CreationDate="2014-12-02T06:07:13.233" Score="1" Body="&lt;p&gt;This isn't an answer, but I can't comment yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is out-of-sync with the current version of the Redactor docs. Redactor is on version 10, while the latest Craft build is still on version 9.2.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There were a number of breaking changes and additions to version 10 of Redactor, but for some reason Redactor does not maintain a docs archive. So for the moment, we don't have a reliable source for Redactor docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/a/4899/1027&quot;&gt;this answer&lt;/a&gt; for more from Craft on this.&lt;/p&gt;&#xA;" OwnerUserId="1027" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-12-02T06:07:13.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5019" PostTypeId="1" AcceptedAnswerId="12509" CreationDate="2014-12-02T08:57:30.763" Score="1" ViewCount="912" Body="&lt;p&gt;How can I send a confirmation Mail to the user who submits the form within the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;ContactForm Plugin&lt;/a&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-11-23T14:47:15.000" Title="ContactForm - Send a confirmation mail" Tags="&lt;plugin-contactform&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5020" PostTypeId="1" CreationDate="2014-12-02T09:55:04.183" Score="2" ViewCount="272" Body="&lt;p&gt;The current site that im building has multiple contact forms. The forms are page specific and should send this to a different user (depends on which page the user sends the form).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: is there a way to define per form (page) to which receiver the form should be sent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, &lt;/p&gt;&#xA;" OwnerUserId="1041" LastActivityDate="2014-12-02T13:04:59.507" Title="Multiple contact forms different receiver(s)" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5021" PostTypeId="1" CreationDate="2014-12-02T11:06:38.280" Score="2" ViewCount="257" Body="&lt;p&gt;I want to access for particular information which is contained in event object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) &#xA;    {&#xA;&#xA;        var_dump($event-&amp;gt;params['entry']);&#xA;    });&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it dumps info (brining a needed part)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     ......&#xA;[&quot;_preppedContent&quot;:&quot;Craft\BaseElementModel&quot;:private]=&amp;gt;&#xA;  array(1) {&#xA;    [&quot;tweet&quot;]=&amp;gt;&#xA;    array(23) {&#xA;      [&quot;created_at&quot;]=&amp;gt;&#xA;      string(30) &quot;Thu Nov 13 09:15:40 +0000 2014&quot;&#xA;      [&quot;id&quot;]=&amp;gt;&#xA;      float(5.3282410346476E+17)&#xA;      [&quot;id_str&quot;]=&amp;gt;&#xA;      string(18) &quot;532824103464763392&quot;&#xA;      [&quot;text&quot;]=&amp;gt;&#xA;      string(115) &quot;'The innovation insight you didn't get from Forbes' great blog by @LydiaRagoonanan @nesta_uk http://t.co/PImPVvWeAv&quot;&#xA;      [&quot;source&quot;]=&amp;gt;&#xA;      string(63) &quot;Hootsuite&quot;&#xA;      [&quot;truncated&quot;]=&amp;gt;&#xA;      bool(false)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I extract &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;id_str&lt;/code&gt; information?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1057" LastActivityDate="2015-11-20T23:28:32.213" Title="how to access to event object propereties" Tags="&lt;php&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5022" PostTypeId="2" ParentId="5019" CreationDate="2014-12-02T12:54:42.080" Score="4" Body="&lt;p&gt;Make your own little plugin that listens to the plugin's &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#the-contactformbeforesend-event&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;contactForm.beforeSend&lt;/code&gt;&lt;/a&gt; event&#xA;and sends the confirmation mail.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-02T12:54:42.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5023" PostTypeId="2" ParentId="5020" CreationDate="2014-12-02T13:04:59.507" Score="3" Body="&lt;p&gt;No. It's currently not possible, but you could make this a feature request! If you don't have the time, you could fork the plugin and make the changes yourself.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-02T13:04:59.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5024" PostTypeId="2" ParentId="5021" CreationDate="2014-12-02T15:42:25.257" Score="2" Body="&lt;p&gt;I assume both &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;id_str&lt;/code&gt; are custom fields?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['entry']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;, so you should be able to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $event-&amp;gt;params['entry'];&#xA;$idString = $entry-&amp;gt;id_str;&#xA;$text = $entry-&amp;gt;text;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-02T15:42:25.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5025" PostTypeId="1" CreationDate="2014-12-02T16:05:35.113" Score="4" ViewCount="632" Body="&lt;p&gt;I have an image transform that is designed for images inserted into posts, and I'd like to make sure this is always applied to any image in a post. The problem I'm having is that for images inserted via Rich Text Fields, selecting a transform is optional, and the wrong transform may be selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I'd like to set a default transform so I can tell content editors that they can insert images directly into posts and don't need to do anything with the &quot;Select image transform&quot; option... is there any way of doing this, though? Any help or advice would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-03-01T14:23:07.247" Title="Is there any way of setting / forcing a default image transform for images inserted via rich text blocks?" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;responsive-images&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5026" PostTypeId="2" ParentId="4993" CreationDate="2014-12-02T16:51:25.013" Score="2" Body="&lt;p&gt;Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel#setAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;setAttributes&lt;/a&gt; method is probably a better way to do this than the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#populateRecords-detail&quot; rel=&quot;nofollow&quot;&gt;populateRecords&lt;/a&gt; method, as by default assignments will only be made to safe attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this wiki article, &lt;a href=&quot;http://www.yiiframework.com/wiki/161/&quot; rel=&quot;nofollow&quot;&gt;Understanding &quot;Safe&quot; Validation Rules &lt;/a&gt;, for details on how you can specify what attributes are safe to be massively assigned. This will allow you to protect against unwanted assignment from untrusted sources.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-12-02T16:51:25.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5027" PostTypeId="2" ParentId="5013" CreationDate="2014-12-02T17:14:00.337" Score="2" Body="&lt;p&gt;Updating PHP on the server to at least 5.4 fixed the issue. This is apparently &lt;a href=&quot;https://github.com/mkoppanen/imagick/issues/20&quot; rel=&quot;nofollow&quot;&gt;a known Imagick issue&lt;/a&gt; with PHP 5.3.&lt;/p&gt;&#xA;" OwnerUserId="763" LastActivityDate="2014-12-02T17:14:00.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5028" PostTypeId="1" CreationDate="2014-12-02T17:40:52.943" Score="3" ViewCount="106" Body="&lt;p&gt;Is it possible to route to a nice &quot;Site is currently offline&quot; error page if there is an issue connecting to the database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently you'll see something like the message below which isn't very customer friendly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An exception has been thrown during the rendering of a template (&quot;Craft canâ€™t connect to the database with the credentials in craft/config/db.php.&quot;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-12-03T01:22:56.607" Title="Change message if database error" Tags="&lt;database&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5029" PostTypeId="1" AcceptedAnswerId="5068" CreationDate="2014-12-02T19:19:12.833" Score="3" ViewCount="448" Body="&lt;p&gt;Good chance this is more of a feature request than a question you can help out. But as I am new to Craft plugin development and might oversee something I ask it anyways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that it is possible to customize the index pages in the CP using the plugin hooks &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;modifyEntryTableAttributes&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt;&lt;/a&gt;, what do I have to do to make my custom columns appear in the sort order dropdown / make the entries sortable by my new columns?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2018-09-27T22:07:28.863" LastActivityDate="2018-09-27T22:07:28.863" Title="Set custom sort order for index pages in the CP?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5030" PostTypeId="1" CreationDate="2014-12-02T19:24:15.707" Score="2" ViewCount="162" Body="&lt;p&gt;Is there was a way for a field type to detect if it is being instantiated for the inline editor or even the live preview? I am working on some responsive UI's to make Google Maps for Craft work optimally on all screen sizes, but current smaller screens are posing a problem. Obviously media queries are being used, but was also wondering if I could easily detect where the field type was being instantiated and then I could possible add additional classes to my field type wrapper.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-12-02T21:44:10.057" Title="Can a field type detect if it's being edited inline in Craft 2.3?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5031" PostTypeId="2" ParentId="5030" CreationDate="2014-12-02T20:08:26.520" Score="3" Body="&lt;p&gt;You could check if the whole request is Live Preview using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#isLivePreview&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.isLivePreview&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1027" LastActivityDate="2014-12-02T20:08:26.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5032" PostTypeId="1" CreationDate="2014-12-02T20:58:06.240" Score="3" ViewCount="498" Body="&lt;p&gt;I'm building a widget where I want to list all unpublished drafts (made by users without access to publish live changes), but I can't figure out how to get them. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-03-29T05:32:51.137" Title="How can I get unpublished drafts in my plugin?" Tags="&lt;plugin-development&gt;&lt;draft&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5033" PostTypeId="2" ParentId="5030" CreationDate="2014-12-02T21:44:10.057" Score="2" Body="&lt;p&gt;You would do that with JS, at least this is how it is done to the core fields (see &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/8ea72d1e5503e3ed11aac86fb972eb1fac92e54b/app/resources/js/MatrixInput.js&quot; rel=&quot;nofollow&quot;&gt;MatrixInput.js&lt;/a&gt; line 152 ff.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just check for the container width of your field and then swap your classes / do your responsive design magic.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-02T21:44:10.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5034" PostTypeId="1" CreationDate="2014-12-02T21:55:26.510" Score="3" ViewCount="1195" Body="&lt;p&gt;Something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.isLoggedIn %}&#xA;    {% set slug = craft.request.lastSegment %}&#xA;    {% set entry = craft.entries.slug(slug).status(null).first %}&#xA;{% endif %}&#xA;&#xA;{{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get error page not found. &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-12-03T01:25:58.893" Title="How to display an entry on frontend with status disabled if admin is logged in?" Tags="&lt;entry&gt;&lt;admin&gt;&lt;status&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5035" PostTypeId="2" ParentId="5032" CreationDate="2014-12-02T23:25:29.737" Score="3" Body="&lt;p&gt;Depending on what you want to do with them you can request them using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;craft.entries&lt;/a&gt; but you'll probably need to change the &lt;strong&gt;status&lt;/strong&gt; to &lt;strong&gt;pending&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this doesn't work you'll need to fetch them through a custom controller/service that goes in and fetches the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;entry model&lt;/a&gt; and returns a list that fit you criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-12-02T23:25:29.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5036" PostTypeId="2" ParentId="5028" CreationDate="2014-12-03T01:22:56.607" Score="1" Body="&lt;p&gt;On a default Craft install if I'm logged out and hit the front-end of the site with purposefully messed up database credentials, I get a nicely styled Craft 404 page if there is no &lt;code&gt;craft/templates/404.html&lt;/code&gt; and a front-end 404 page if there is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the issue is that you've got your own front-end 404 template that's also trying to access the database and it can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically the first error is thrown (can't access the database), then another error happens (I &lt;em&gt;really&lt;/em&gt; can't access the database) when trying to tell you about the first error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this point, Yii thinks the error has already been handled, so it falls back to &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.15/framework/base/CApplication.php#L924&quot; rel=&quot;nofollow&quot;&gt;CApplication-&gt;displayException()&lt;/a&gt;.  I assume in this case, some content header or encoding isn't set properly and you see the garbled ’ character.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So until/if we can think of a way to guard against this scenario, your best bet is to make sure that your 404 template isn't triggering a database call.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-03T01:22:56.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5037" PostTypeId="2" ParentId="5034" CreationDate="2014-12-03T01:25:58.893" Score="3" Body="&lt;p&gt;If you're specifically checking for the admin, then it's more like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.admin %}&#xA;    {% set slug = craft.request.lastSegment %}&#xA;    {% set entry = craft.entries.slug(slug).status(null).first %}&#xA;&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're getting a 404, then it's some other routing issues that is occurring.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-03T01:25:58.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5038" PostTypeId="1" CreationDate="2014-12-03T02:48:12.740" Score="0" ViewCount="143" Body="&lt;p&gt;I just tried adding a date field to the bone stock Craft news template to try out the Live Preview and I'm getting a jQuery error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;TypeError: undefined is not an object (evaluating 'a.currentDay=e(&quot;a&quot;,n).html()')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I posted this on the G+, Brad couldn't reproduce, wonder if anyone else is having problems? I know the default Craft install doesn't use any javascript so it's gotta be on Craft's end? I just installed this on my production server as well, same issue, tried different browsers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No other bugs that I can see.  Anyone else getting this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w3HrN.png&quot; alt=&quot;live preview error&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2014-12-03T19:54:58.823" Title="Date picker broken?" Tags="&lt;control-panel&gt;&lt;javascript&gt;&lt;live-preview&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2014-12-03T20:11:40.573" ContentLicense="CC BY-SA 3.0" />
  <row Id="5039" PostTypeId="1" CreationDate="2014-12-03T05:01:26.433" Score="3" ViewCount="36" Body="&lt;p&gt;In the 2.3 release notes, one item reads: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ElementsService is now forgiving of an element type whose populateElementModel() method doesn’t return an actual element model.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm curious what the use case is here — When would populateElementModel not return a BaseElementModel, and why would that be okay?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-12-03T16:02:13.757" Title="Why is ElementsService forgiving of an element type whose populateElementModel() method doesn’t return an actual element model" Tags="&lt;baseelementmodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5040" PostTypeId="2" ParentId="5025" CreationDate="2014-12-03T05:09:15.077" Score="5" Body="&lt;p&gt;I don't think it's possible natively, yet (as of 2.3). However, the &lt;a href=&quot;http://michaelrog.com/craft/imagesmith&quot;&gt;ImageSmith&lt;/a&gt; plugin addresses this need by providing a 'bulk transform' Twig filter which detects images in HTML, applies a specified transform, and rewrites the HTML to reference the transformed images.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-12-03T05:09:15.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5042" PostTypeId="1" CreationDate="2014-12-03T08:43:18.593" Score="4" ViewCount="1725" Body="&lt;p&gt;Scenario:&#xA;I want to use Craft to build a community website for an organisation which uses LDAP and Google Apps. I'd like to users to be able to login to Craft Admin via their existing LDAP account (or via Google Apps OAuth, which is easier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ideal workflow would be something like this:&#xA;1. John Doe is a member of the community and requests access to the Craft site.&#xA;2. Admin user logs into Craft and adds John Doe as a new user with his SSO email address&#xA;3. John Doe can then login to Craft using his SSO login details (either via a custom front-end form, or directly via Craft admin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the available Craft events &amp;amp; hooks, this doesn't seem possible currently without hacking up the Craft internals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: &lt;strong&gt;Is there any way to implement this sort of SSO in a modular fashion in Craft? Or, will it require extensive hacking of Craft internals in a 'brittle' fashion?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Sam.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastActivityDate="2014-12-03T23:30:52.583" Title="Does Craft support a custom authentication backend for Admin?" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5043" PostTypeId="1" CreationDate="2014-12-03T10:29:47.017" Score="1" ViewCount="581" Body="&lt;p&gt;I'm building a site with two languages, and I need a language switcher so wherever you enter the website you can switch the language easily. The website is a onepager, so i can't direct to a specific language URL. Instead i'm thinking of adding a segment (/de /fr) to the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to display the language fields and language globals.&lt;/p&gt;&#xA;" OwnerUserId="1064" LastEditorUserId="125" LastEditDate="2014-12-03T12:53:54.793" LastActivityDate="2014-12-07T22:58:38.427" Title="Build a language switcher for a one page website?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5044" PostTypeId="1" AcceptedAnswerId="5140" CreationDate="2014-12-03T11:17:19.240" Score="2" ViewCount="390" Body="&lt;p&gt;When I view the browser console whilst viewing the Dashboard for instance, I get a whole load of 404s for Javascript .map files. For example on a fresh update to v2.3 I get this lot reported as missing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/admin/resources/lib/garnish-0.1.min.js/garnish-0.1.min.map/&#xA;/admin/resources/js/craft.js/craft.min.map/&#xA;/admin/resources/js/cp.js/cp.min.map/&#xA;/admin/resources/js/QuickPostWidget.js/QuickPostWidget.min.map/&#xA;/admin/resources/js/RecentEntriesWidget.js/RecentEntriesWidget.min.map/&#xA;/admin/resources/js/GetHelpWidget.js/GetHelpWidget.min.map/&#xA;/admin/resources/js/UpdatesWidget.js/UpdatesWidget.min.map/&#xA;/admin/resources/js/FeedWidget.js/FeedWidget.min.map/ &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It just looks like the paths a wrong, if I look in the /js/ folder, the .map files do actually exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it something I should be concerned about? Everything seems like it's all working ok, so it's not a show stopper at all. I just find it a bit annoying to be honest, so if I can do something to turn off the requests that'd be nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per Jason's answer below, I had the following rule in my &lt;code&gt;.htaccess&lt;/code&gt; file to add trailing slashes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_METHOD} !=POST&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.+[^/])$ /$1/ [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I removed that and it has cured the issue. I have subsequently put the rule back in and the problem hasn't returned so it must have been cached somewhere.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2014-12-08T10:39:50.440" LastActivityDate="2015-02-19T14:09:26.413" Title="Missing javascript .map files" Tags="&lt;control-panel&gt;&lt;javascript&gt;&lt;cp-dashboard&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5046" PostTypeId="1" CreationDate="2014-12-03T12:19:24.780" Score="1" ViewCount="1275" Body="&lt;p&gt;I've two user groups; admin and user. The User group does not have access to the Assets tab, which stops them from just browsing all the assets that anyone might have uploaded - which is what I want; no random looking about in the Assets resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've a field type 'Featured Image' that is an asset; and it is restricted to a single upload folder, file type image, with an upload location set to {slug} - this means it will upload files into a folder named the same as the slug for the entry in which it's being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works fine for admins who have privileges to see Assets. I can not upload anything in this field with a user of type User.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This behaviour makes Asset fields essentially useless unless the user group also has privileges to view (and upload/edit) all assets site-wide. Because 'upload' is a child privilege of 'view assets' I can't give the upload rights without also giving them 'browse all the assets everywhere' rights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like these restricted users to be able to upload in that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oddly, I have a Matrix field called Gallery which has an asset field inside it, set to file type image, single upload directory; {owner.slug}/gallery/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That asset field works fine for these users, and they are able to upload into it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd hoped this would be fixed in 2.3, alas it seems not, unless there's something I need to change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my experience as a mini screencast, logged in as a restricted user type (no assets privileges): &lt;a href=&quot;http://viewcreative.co.uk/DELETEME/uploading.gif&quot; rel=&quot;nofollow&quot;&gt;http://viewcreative.co.uk/DELETEME/uploading.gif&lt;/a&gt; And here's the filetype set up and permissions: &lt;a href=&quot;http://viewcreative.co.uk/DELETEME/permissions.gif&quot; rel=&quot;nofollow&quot;&gt;http://viewcreative.co.uk/DELETEME/permissions.gif&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2014-12-03T17:02:42.107" LastActivityDate="2014-12-03T17:02:42.107" Title="Why can't users upload files in this asset?" Tags="&lt;assets&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5047" PostTypeId="1" AcceptedAnswerId="5049" CreationDate="2014-12-03T12:37:25.827" Score="7" ViewCount="1240" Body="&lt;p&gt;Sorry if this is an obvious thing - can't seem to find an answer in the docs.&#xA;Where can I edit the system offline message? &quot;service unavailable&quot;&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="22" LastEditDate="2017-05-10T00:12:55.267" LastActivityDate="2017-05-10T00:12:55.267" Title="Where can I edit the &quot;Service Unavailable&quot; page/template?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5048" PostTypeId="2" ParentId="5043" CreationDate="2014-12-03T12:44:07.763" Score="1" Body="&lt;p&gt;The basics for setting up your localized site are nicely written down in the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;Localization Guide&lt;/a&gt;. This walks you through the steps necessary to make your site being available under their subfolders &lt;code&gt;/de&lt;/code&gt; and &lt;code&gt;/fr&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up correctly, your templates will always show the field content translated to the currently accessed locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your one-pager template is not connected to an entry (case 4 in the &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Routing article&lt;/a&gt;) and you simply save your template files at &lt;code&gt;templates/de/index.html&lt;/code&gt; and &lt;code&gt;templates/fr/index.html&lt;/code&gt; (case 6), have a look at the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; tag, that allows you to maintain one template responsible for all of your locales (e.g. &lt;code&gt;{% include '../de/index.html' %}&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code is a simplified version of the &lt;a href=&quot;https://craftcms.stackexchange.com/a/882/125&quot;&gt;example I wrote down here&lt;/a&gt;, and should do fine for a one-page website:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through selected site locales #}&#xA;{% set locales = ['de', 'fr'] %}&#xA;{% for locale in locales %}&#xA;&#xA;    {# Check if `locale` equals the requested page locale #}&#xA;    {% if locale == craft.locale %}&#xA;        {% set current = true %}&#xA;    {% endif %}&#xA;&#xA;    {# Output a link to the hompage and add a class &quot;current&quot; to the current locale's link #}&#xA;    &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;{{ current ? 'current' }}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-12-03T12:56:50.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5049" PostTypeId="2" ParentId="5047" CreationDate="2014-12-03T13:00:17.610" Score="9" Body="&lt;p&gt;Try creating a &lt;code&gt;503.html&lt;/code&gt; file at the root of your templates folder. This should override the default template located at &lt;code&gt;craft/app/templates/503.html&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-03T13:00:17.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5051" PostTypeId="2" ParentId="5046" CreationDate="2014-12-03T14:19:18.807" Score="2" Body="&lt;p&gt;Have you checked the &lt;a href=&quot;http://buildwithcraft.com/docs/users#user-groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;user group permission settings page&lt;/a&gt;? There you should be able to select which Asset Sources users in a specific user group are able to view, upload files to, etc. If at least one Asset Source is selected then the Assets navigation item will appear for users in that group, otherwise it will be hidden.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r7BP2.png&quot; alt=&quot;Asset Source permissions&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2014-12-03T14:19:18.807" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5053" PostTypeId="1" AcceptedAnswerId="5055" CreationDate="2014-12-03T14:46:07.163" Score="3" ViewCount="300" Body="&lt;p&gt;In Craft 2.3 admins aren't able to edit users passwords. So I'm wondering if they have no access to email how can we give them a temporary password?&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2014-12-03T15:51:07.993" Title="If user has no access to email how to give them a temp password?" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5055" PostTypeId="2" ParentId="5053" CreationDate="2014-12-03T15:51:07.993" Score="5" Body="&lt;p&gt;You can &quot;Copy password reset URL&quot; and give it to them via some other means (IM, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmYQK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-03T15:51:07.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5056" PostTypeId="1" AcceptedAnswerId="6867" CreationDate="2014-12-03T15:59:50.943" Score="3" ViewCount="656" Body="&lt;p&gt;This is a great new feature of Craft 2.3:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is now possible to set custom field parameters on Matrix block queries.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was wondering what would happen, if two or more Matrix Block Types had a field with the same handle (e.g. &lt;code&gt;myLightswitchField&lt;/code&gt;), and if it was possible to query for blocks across Block Types using this field as a parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My example code doesn't return any blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.myLightswitchField('1') %}&#xA;&#xA;Yeah! There's {{ blocks|length }} Matrix blocks enabled.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just an example! I know that you can disable blocks from the block's context menu.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-29T16:53:56.690" LastActivityDate="2015-01-29T20:11:17.277" Title="Query for blocks across Block Types using the new field parameter?" Tags="&lt;matrix&gt;&lt;field&gt;&lt;filter&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5057" PostTypeId="2" ParentId="5039" CreationDate="2014-12-03T16:02:13.757" Score="1" Body="&lt;p&gt;Someone requested it. They had a use case for it where they couldn’t simply prevent the rows from getting selected in the DB query with a conditional (which is still definitely the recommended way to go). The only reason I decided to add it was for the sake of defensive coding.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-12-03T16:02:13.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5058" PostTypeId="1" CreationDate="2014-12-03T16:50:43.387" Score="1" ViewCount="1203" Body="&lt;p&gt;If I want to view the PHP Error logs from craft true utils/logs I get an 403 Forbidden error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;nginx/1.6.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;../admin/utils/logs/phperrors.log&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be wrong?&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-12-03T17:00:10.643" LastActivityDate="2016-03-13T00:20:29.843" Title="PHP Error log in CP gives me 403 forbidden" Tags="&lt;error-message&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5059" PostTypeId="2" ParentId="5058" CreationDate="2014-12-03T17:27:31.377" Score="1" Body="&lt;p&gt;Sounds like a file permission issue. Make sure that &lt;code&gt;phperrors.log&lt;/code&gt; has acceptable read permissions.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-12-03T17:27:31.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5060" PostTypeId="1" AcceptedAnswerId="5073" CreationDate="2014-12-03T18:47:28.463" Score="1" ViewCount="103" Body="&lt;p&gt;In a fresh installation the 'Home Page' seems to make use of the custom 'Heading' field whilst the 'News' channel makes use of the 'Title' field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage of using the 'Heading' field over the 'Title' field?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-12-04T00:47:39.817" Title="Title vs Heading in Fresh Install?" Tags="&lt;sections&gt;&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5061" PostTypeId="1" AcceptedAnswerId="5062" CreationDate="2014-12-03T18:55:20.300" Score="9" ViewCount="958" Body="&lt;p&gt;I updated to Craft 2.3 and noticed that the Table button is now missing from my Rich Text fields? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get that button back?&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-03T09:23:01.963" Title="Table button missing in Rich Text fields?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5062" PostTypeId="2" ParentId="5061" CreationDate="2014-12-03T18:55:20.300" Score="7" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; since version 2.3.2621 Craft comes with Redactor's table plugin preinstalled again. So there's no need to do anything special, simply add it to your Redactor json config.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Craft 2.3 now comes with a new version of Redactor. With the release of Redactor 10 non-essential functionality was removed from Redactor's core and is now released as separate plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to get the Table function back, you have to add the &lt;a href=&quot;http://imperavi.com/redactor/plugins/table/&quot; rel=&quot;nofollow&quot;&gt;Redactor Table plugin&lt;/a&gt; to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download and save the plugin into craft/app/resources/lib/redactor/plugins/ or you can make a little Craft plugin that adds this Redactor plugin to Craft.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-03T09:23:01.963" LastActivityDate="2015-03-03T09:23:01.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5063" PostTypeId="1" AcceptedAnswerId="5065" CreationDate="2014-12-03T18:59:58.653" Score="2" ViewCount="156" Body="&lt;p&gt;How can I cover both &quot;www.domain.com&quot; and &quot;domain.com&quot; with the same settings in my config file? My current file is set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;       // Settings here&#xA;    ),&#xA;&#xA;    // Local&#xA;    'domain.dev' =&amp;gt; array(&#xA;       // Settings here&#xA;    ),&#xA;&#xA;    // Staging&#xA;    'staging.domain.com' =&amp;gt; array(&#xA;        // Settings here&#xA;    ),&#xA;&#xA;    // Production&#xA;    'www.domain.com' =&amp;gt; array(&#xA;       // Settings here&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can I just remove the &lt;code&gt;www&lt;/code&gt; from the last entry under “Production” to have those settings apply to both the naked domain and the &lt;code&gt;www&lt;/code&gt; subdomain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I'm including the &lt;code&gt;www&lt;/code&gt; in my &lt;code&gt;siteUrl&lt;/code&gt; config setting in Production, will that create any conflicts if visitors end up at a naked url without the &lt;code&gt;www&lt;/code&gt; subdomain specified?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-12-03T20:46:58.373" Title="Covering both &quot;www.domain.com&quot; and &quot;domain.com&quot; in config file settings" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5064" PostTypeId="1" AcceptedAnswerId="5102" CreationDate="2014-12-03T19:16:38.763" Score="2" ViewCount="1470" Body="&lt;p&gt;I have a section &quot;Hotel Room&quot; with a field &quot;Sleeps&quot; (number). There is no limit on the values that can be entered. On the frontend I want a list of all existing entered values for this field. So if I have these four entries:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;sleeps=2&lt;/li&gt;&#xA;&lt;li&gt;sleeps=2&lt;/li&gt;&#xA;&lt;li&gt;sleeps=8&lt;/li&gt;&#xA;&lt;li&gt;sleeps=10&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I want an array [2, 2, 8, 10] to iterate over. Bonus points for unique/distinct values, but I'm well aware I can add a Twig filter to &lt;code&gt;array_unique()&lt;/code&gt; it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible using Craft's &lt;code&gt;craft.entries&lt;/code&gt; lookups within Twig?&lt;/p&gt;&#xA;" OwnerUserId="848" LastActivityDate="2014-12-04T23:37:36.547" Title="Fetch values for a single field across all entries in a section" Tags="&lt;templating&gt;&lt;entries&gt;&lt;database&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5065" PostTypeId="2" ParentId="5063" CreationDate="2014-12-03T19:32:50.610" Score="4" Body="&lt;p&gt;What I like to do is explicitly set &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; in my index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch($_SERVER['SERVER_NAME']) {&#xA;  case 'domain.dev':&#xA;    define('CRAFT_ENVIRONMENT', 'LOCAL');&#xA;    break;&#xA;  case 'staging.domain.com':&#xA;    define('CRAFT_ENVIRONMENT', 'STAGING');&#xA;    break;&#xA;  case 'www.domain.com':&#xA;  case 'domain.com':&#xA;    define('CRAFT_ENVIRONMENT', 'PRODUCTION');&#xA;    break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    // Settings here&#xA;  ),&#xA;  'LOCAL' =&amp;gt; array(&#xA;    // Settings here&#xA;  ),&#xA;  'STAGING' =&amp;gt; array(&#xA;    // Settings here&#xA;  ),&#xA;  'PRODUCTION' =&amp;gt; array(&#xA;    // Settings here&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you set &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; you may want to use the switch default for &lt;code&gt;LOCAL&lt;/code&gt; or for &lt;code&gt;PRODUCTION&lt;/code&gt; - there are good arguments for going either way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A separate question is whether you &lt;em&gt;should&lt;/em&gt; have people accessing your site at both &lt;code&gt;www.domain.com&lt;/code&gt; and &lt;code&gt;domain.com&lt;/code&gt;. The answer is most probably &lt;strong&gt;no&lt;/strong&gt;. Pick one, and use .htaccess (on apache) or whatever other method, to redirect either all the www to non-www or the other way around. Otherwise you will have duplicate content, which confuses the search engines (and generally looks unprofessional).&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2014-12-03T20:46:58.373" LastActivityDate="2014-12-03T20:46:58.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5066" PostTypeId="2" ParentId="5038" CreationDate="2014-12-03T19:54:58.823" Score="1" Body="&lt;p&gt;Can confirm this is a bug.  Should have it fixed soon.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-03T19:54:58.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5067" PostTypeId="1" AcceptedAnswerId="5078" CreationDate="2014-12-03T21:34:03.310" Score="10" ViewCount="2629" Body="&lt;p&gt;I am learning craft and trying add settings page for my plugin. I read that need to define settings like,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CocktailRecipesPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    protected function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'cocktailCategories' =&amp;gt; array(AttributeType::Mixed, 'default' =&amp;gt; array('Sours', 'Fizzes', 'Juleps')),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So isn't clear and there is no explanation what the array return and how to use it inside the template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you &lt;/p&gt;&#xA;" OwnerUserId="1057" LastActivityDate="2014-12-04T04:43:17.820" Title="How to use plugin settings" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5068" PostTypeId="2" ParentId="5029" CreationDate="2014-12-03T22:30:35.613" Score="2" Body="&lt;p&gt;You weren’t overlooking anything, we were :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We just released &lt;a href=&quot;http://buildwithcraft.com/updates#build2616&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2616&lt;/a&gt; with four new hooks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySortableAttributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyCategorySortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyCategorySortableAttributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetSortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyAssetSortableAttributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyUserSortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyUserSortableAttributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That should do the trick for you.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-12-03T22:30:35.613" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="5069" PostTypeId="1" AcceptedAnswerId="5090" CreationDate="2014-12-03T22:37:39.713" Score="1" ViewCount="563" Body="&lt;p&gt;I'm getting an interesting (new) error when adding (or editing) entries in Chinese. If the slug is in Chinese I now get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;URI is not a valid URI&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's interesting because I wasn't experiencing that with Craft 2.2. It was allowing me to save entries with Chinese characters in the URI. After upgrading to Craft 2.3.2615 it looks like all Chinese language URIs are now disallowed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this intended behaviour?&lt;/p&gt;&#xA;" OwnerUserId="92" LastActivityDate="2014-12-04T23:52:53.067" Title="URI is not a valid URI" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2014-12-07T23:06:26.207" ContentLicense="CC BY-SA 3.0" />
  <row Id="5070" PostTypeId="2" ParentId="4946" CreationDate="2014-12-03T22:41:07.347" Score="4" Body="&lt;p&gt;We just changed this behavior in &lt;a href=&quot;http://buildwithcraft.com/updates#build2616&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2616&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Live Preview and Share links will now show the unpublished entry/category changes wherever the entry/category are being referenced in the templates (even areas where the entry/category was fetched from the database).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So now Live Preview (and Share links) should work as expected for you.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-12-03T22:41:07.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5071" PostTypeId="2" ParentId="5042" CreationDate="2014-12-03T23:30:52.583" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any way to implement this sort of SSO in a modular fashion in Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of any LDAP plugin for Craft, yet, but OAuth has already been done (&lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net/craft/oauth&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/a/486/57&quot;&gt;here&lt;/a&gt; for a bit on how you'd approach it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-12-03T23:30:52.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5072" PostTypeId="1" CreationDate="2014-12-03T23:39:54.830" Score="2" ViewCount="515" Body="&lt;p&gt;My templates that referenced &lt;code&gt;entry.children&lt;/code&gt; or &lt;code&gt;entry.getChildren()&lt;/code&gt; have started throwing deprecation notices:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Calling getChildren() to fetch an element’s target relations has been deprecated. Use the relatedTo param instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is the preferred way to search for an entry's children — either ALL of its children, or just its direct children — using the &lt;code&gt;relatedTo()&lt;/code&gt; param?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-12-04T14:00:22.693" Title="How to search children with relatedTo param" Tags="&lt;structure&gt;&lt;relations&gt;&lt;children&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5073" PostTypeId="2" ParentId="5060" CreationDate="2014-12-04T00:47:39.817" Score="4" Body="&lt;p&gt;The short answer is, we should probably update that :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The long answer is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The homepage is a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow&quot;&gt;“Single” section&lt;/a&gt;, and originally, Singles couldn’t have dynamic Title fields like Channel and Structure sections; their titles were static, based on the section’s name. So in this case, that Homepage entry’s title was “Homepage”, and the only way to change that would have been to go into the section’s settings and change its name from there. So, back then, if you wanted to give a Single a “Title”-esque field, it had to be a custom one. Which is what that Heading field is – a custom Plain Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow&quot;&gt;Craft 2.2&lt;/a&gt;, however, Singles can now have dynamic Title fields. So at that point we should have updated the default fields to stop giving that Homepage section a custom Heading field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that clears things up a bit. I’ll go ahead and make that change for the next release.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-12-04T00:47:39.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5074" PostTypeId="1" AcceptedAnswerId="8215" CreationDate="2014-12-04T03:44:23.417" Score="3" ViewCount="260" Body="&lt;p&gt;I have a client who wants to use an author (draft) -&gt; editor (publish) workflow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that authors can update existing entries which will create a new draft of the entry. As an editor, I can then visit the edit page for that entry and select the new draft from the &quot;revisions&quot; drop-down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is great if I know that a new draft is waiting to be reviewed, but I couldn't find a way to discover which entries have new drafts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to view which posts have new drafts from the entries index? Otherwise what is the normal practice for editor-type users to know which entries have pending changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4867" LastActivityDate="2015-02-17T21:26:48.660" Title="Filtering by entries which have unpublished draft versions in the admin" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;user-interface&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5075" PostTypeId="2" ParentId="4747" CreationDate="2014-12-04T03:53:13.167" Score="2" Body="&lt;p&gt;Try checking out this config setting &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#setPasswordPath&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#setPasswordPath&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add your path in the craft/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'setPasswordPath' =&amp;gt; 'login/set-password' // or wherever your template is&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="447" LastActivityDate="2014-12-04T03:53:13.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5076" PostTypeId="2" ParentId="4667" CreationDate="2014-12-04T04:29:07.107" Score="1" Body="&lt;p&gt;If anyone is wondering I finally finished the plugin I was working on, you can see it here. &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/roundhouse/FormBuilder-Craft-CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="971" LastActivityDate="2014-12-04T04:29:07.107" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5077" PostTypeId="2" ParentId="4596" CreationDate="2014-12-04T04:33:26.083" Score="1" Body="&lt;p&gt;I have finished the plugin, with much success, if you wondering you can see it here &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/roundhouse/FormBuilder-Craft-CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="971" LastActivityDate="2014-12-04T04:33:26.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5078" PostTypeId="2" ParentId="5067" CreationDate="2014-12-04T04:43:17.820" Score="25" Body="&lt;p&gt;How are you trying to use it in the template? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a very basic way of how to display a setting in a front end twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First define your settings with the defineSettings() method (as you already have).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'mySetting' =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true)&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then create a directory in the root of your plugin folder and call it “templates”. Create a new .html or .twig file in that folder and call it “_settings.html”. Inside of that you could put the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;{{ forms.textField({&#xA;        label: &quot;My Setting&quot;|t,&#xA;        id: 'mySetting',&#xA;        name: 'mySetting',&#xA;        instructions: &quot;Input your setting&quot;|t,&#xA;        value: settings.mySetting,&#xA;        errors: settings.getErrors('mySetting')&#xA;    }) &#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After this go back to your primary plugin class and add the getSettingsHtml() method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return craft()-&amp;gt;templates-&amp;gt;render(‘pluginHandle/_settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, if you go into admin/settings/plugins you can click on your plugin and there will be an input field there where you can save the setting. If you wanted to get this value you could add a method to your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot;&gt;service&lt;/a&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMySetting()&#xA;{&#xA;    $plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin(‘pluginHandle');&#xA;    $settings = $plugin-&amp;gt;getSettings();&#xA;&#xA;    return $settings-&amp;gt;mySetting;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could call this anywhere throughout your plugin like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;pluginHandle_serviceName-&amp;gt;getMySetting(); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To do that on the front end in a twig template, just create a method in the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;variables class&lt;/a&gt;. It would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMySetting()&#xA;{&#xA;    return craft()-&amp;gt;pluginHandle_serviceName-&amp;gt;getMySetting();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your front end twig template you could call it like this; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.pluginHandle.getMySetting() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope any of this clears it up a bit. &lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2014-12-04T04:43:17.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5079" PostTypeId="1" AcceptedAnswerId="5080" CreationDate="2014-12-04T10:47:00.587" Score="2" ViewCount="1448" Body="&lt;p&gt;I have a field 'Event Listing Image' set up as: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Field Type: Asset&lt;/li&gt;&#xA;&lt;li&gt;Restrict uploads to single folder&lt;/li&gt;&#xA;&lt;li&gt;Upload location [Events]{slug}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There's an asset bucket Events:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Local Folder&lt;/li&gt;&#xA;&lt;li&gt;File System Path: {fileSystemPath}/content/events/&lt;/li&gt;&#xA;&lt;li&gt;URL: /content/events/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The field is in a section named Events of type Channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system folder /content/events/ exists and is writable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I edit an existing Entry in that channel, I can click upload in that field, but it errors every time with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upload failed for test.jpg. The error message was: ”Error uploading the file: The folder “/Users/matt/Sites/bs_conwyarts/_bespoke/public/content/events/test-event/” does not exist.“&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know it doesn't, it's dynamic based on the entry slug. Why is Craft not creating the folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Irony: I have a field called Featured Image set up almost identically on a different Channel that does work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Featured Image:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Field Type: Asset&lt;/li&gt;&#xA;&lt;li&gt;Restrict uploads to single folder&lt;/li&gt;&#xA;&lt;li&gt;Upload location [Artists]{slug}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Asset bucket Artists:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Local folder&lt;/li&gt;&#xA;&lt;li&gt;File System Path: {fileSystemPath}/content/artists/&lt;/li&gt;&#xA;&lt;li&gt;URL: /content/artists&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;UPDATE: looks like a bug. It works fine for new entries posted in the Events channel, it does not work for the existing entry in the Channel. I think I added the field in question &lt;em&gt;after&lt;/em&gt; creating the first entry, so it looks like that might be the culprit.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2014-12-04T10:58:33.037" LastActivityDate="2017-08-04T18:39:52.660" Title="Why aren't dynamic folders being generated for assets?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5080" PostTypeId="2" ParentId="5079" CreationDate="2014-12-04T11:07:05.830" Score="2" Body="&lt;p&gt;Problem solved thanks to Craft Twitter support; needed to re-build the Asset Indexes; because I'd added that field after already creating an entry the asset index was stale and needed flushing.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open Craft admin dashboard&lt;/li&gt;&#xA;&lt;li&gt;Click &lt;em&gt;Settings&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Click &lt;em&gt;Update Asset Indexes&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Click &lt;em&gt;Go!&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This process scans through the list of assets in the database and ensures it matches what is in the file system and updates the database as needed.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="5437" LastEditDate="2017-08-04T18:39:52.660" LastActivityDate="2017-08-04T18:39:52.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5081" PostTypeId="1" AcceptedAnswerId="5082" CreationDate="2014-12-04T12:29:08.207" Score="2" ViewCount="563" Body="&lt;p&gt;I'm wondering if there's some build in function in Craft that can &quot;translate&quot; a URL the same as a string?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when I want to translate a static string I'll use the &quot;t&quot; Twig filer like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;String&quot;|t }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say I want to do the same, but with my localized URL's. Imaging this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('a-url-slug')|t }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my translation file I can add different URL's that's localized (but loading the same template, I'm solving this using Routes).&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2014-12-04T12:43:02.497" Title="Can I &quot;translate&quot; static URL's?" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5082" PostTypeId="2" ParentId="5081" CreationDate="2014-12-04T12:43:02.497" Score="2" Body="&lt;p&gt;Not sure if this is a good idea, but it does work. You simply got the syntax wrong, it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('a-url-slug'|t) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-04T12:43:02.497" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5083" PostTypeId="2" ParentId="5072" CreationDate="2014-12-04T14:00:22.693" Score="5" Body="&lt;p&gt;It appears the preferred way is by using &lt;code&gt;getDescendants()&lt;/code&gt; — In fact, the &lt;code&gt;children&lt;/code&gt; property is actually an alias for &lt;code&gt;getDescendants(1)&lt;/code&gt;. (The parameter specifies a maximum distance (i.e. number of levels) of the child from the parent.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2014-12-04T14:00:22.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5084" PostTypeId="1" CreationDate="2014-12-04T15:10:28.283" Score="1" ViewCount="586" Body="&lt;p&gt;This is what I'm trying to accomplish:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All categories displayed on one page, with entries returned from each.&lt;/li&gt;&#xA;&lt;li&gt;Only six entries shown in each category.&lt;/li&gt;&#xA;&lt;li&gt;Categories need to be in a specific order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've got the first two points working, but can't figure out how to change the order of the categories. Am I going about this the wrong way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('entrySection').find() %}&#xA;&#xA;{% for category, catEntries in entries | group('categoryField.first().title') %}&#xA;&#xA;    {% for entry in catEntries|slice(0,6) %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2014-12-04T16:13:04.677" Title="How to order categories in key/value for loop?" Tags="&lt;categories&gt;&lt;forloop&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5085" PostTypeId="2" ParentId="5084" CreationDate="2014-12-04T16:13:04.677" Score="2" Body="&lt;p&gt;Using the &lt;code&gt;group&lt;/code&gt; filter you will always end up with the sort order of your entries. So you would need to sort the entries by your categories field, but this probably doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the categories related to my &quot;entrySection&quot; entries in custom order #}&#xA;{% set entries = craft.entries.section('entrySection') %}&#xA;{% set relatedCats = craft.categories.relatedTo(entries).order('customCatField desc') %}&#xA;&#xA;{# Loop the categories #}&#xA;{% for category in relatedCats %}&#xA;&#xA;    {# Get and loop through the 6 most recent entries related to this cat #}&#xA;    {% set relatedEntries = craft.entries.relatedTo(category).limit('6') %}&#xA;    {% for entry in relatedEntries %}&#xA;        ...&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-04T16:13:04.677" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5086" PostTypeId="1" CreationDate="2014-12-04T16:55:58.300" Score="1" ViewCount="113" Body="&lt;p&gt;there is tool &lt;code&gt;forms&lt;/code&gt;(/craft/app/templates/_includes/). But I cannot find usage manual, ex. options for &lt;code&gt;forms.select&lt;/code&gt; etc. Where is it, guys? Thank you&lt;/p&gt;&#xA;" OwnerUserId="1057" LastActivityDate="2014-12-04T18:13:55.617" Title="where can I find manual for craft forms" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5087" PostTypeId="2" ParentId="5086" CreationDate="2014-12-04T17:24:19.883" Score="5" Body="&lt;p&gt;At this time, there is no manual for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's an incredibly useful chunk of code, but it's buried pretty deep in the system. I think the belief is that &quot;if you're capable of finding it, you're capable of backwards-engineering it.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd actually suggest looking to other parts of Craft (and other plugins) to gain a better understanding of some real-world applications and examples.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-12-04T17:24:19.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5088" PostTypeId="2" ParentId="5086" CreationDate="2014-12-04T18:13:55.617" Score="0" Body="&lt;p&gt;That is not answer just example of one of the tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.select({&#xA;        label: &quot;Default Status&quot;|t,&#xA;        options: { &quot;optval1&quot;: &quot;Text1&quot;, &quot;optval2&quot;: &quot;Text2&quot; },&#xA;        id: 'defaultStatus',&#xA;        name: 'defaultStatus',&#xA;        value: settings.defaultStatus,&#xA;        errors: settings.getErrors('defaultStatus')&#xA;    }) &#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope will be useful for someone&lt;/p&gt;&#xA;" OwnerUserId="1057" LastActivityDate="2014-12-04T18:13:55.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5089" PostTypeId="1" AcceptedAnswerId="5091" CreationDate="2014-12-04T18:21:02.153" Score="2" ViewCount="120" Body="&lt;p&gt;The documentation provides a very &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;comprehensive list of events&lt;/a&gt; provided by Craft  but I would like to know if there is a way to get a list of those events at runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having such list would enable me to display a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; field whereby a user could choose the event that should trigger an action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of it as &lt;strong&gt;dynamic event registration!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-12-04T18:57:34.197" Title="How do I get a list of craft provided events at runtime?" Tags="&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5090" PostTypeId="2" ParentId="5069" CreationDate="2014-12-04T18:27:57.863" Score="1" Body="&lt;p&gt;&lt;del&gt;Turns out this was a bug introduced in 2.3 and will be fixed in the next release.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2617&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2617&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2014-12-04T23:52:53.067" LastActivityDate="2014-12-04T23:52:53.067" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5091" PostTypeId="2" ParentId="5089" CreationDate="2014-12-04T18:52:11.860" Score="3" Body="&lt;p&gt;Events don’t get pre-registered anywhere in Craft, so there’s no way to easily fetch a definitive list of all events that will ever get called, but with a little PHP we can get a pretty good idea of what they all are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’d start by getting a list of all the components on &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;WebApp&lt;/a&gt; (what &lt;code&gt;craft()&lt;/code&gt; returns) by calling its &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModule#getComponents-detail&quot; rel=&quot;nofollow&quot;&gt;getComponents()&lt;/a&gt; method, loop through each of them, use reflection to get each of their methods, and find the ones that start with &lt;code&gt;on&lt;/code&gt;. (By convention, all event methods should start with that, and non-event methods generally shouldn’t start with that, although it’s possible this will yield some false positives, so make sure you double-check the results.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$events = [];&#xA;$components = craft()-&amp;gt;getComponents(false);&#xA;&#xA;foreach ($components as $id =&amp;gt; $component)&#xA;{&#xA;    // Skip some non-existent components&#xA;    if ($id == 'fieldTypes' || $id == 'file')&#xA;    {&#xA;        continue;&#xA;    }&#xA;&#xA;    // If the component hasn't been loaded yet, $component will just be its config array&#xA;    if (is_array($component))&#xA;    {&#xA;        $component = craft()-&amp;gt;getComponent($id);&#xA;    }&#xA;&#xA;    // Find the event methods&#xA;    $class = new \ReflectionClass($component);&#xA;    $methods = $class-&amp;gt;getMethods(\ReflectionMethod::IS_PUBLIC);&#xA;&#xA;    foreach ($methods as $method)&#xA;    {&#xA;        if (strncasecmp($method-&amp;gt;name, 'on', 2) === 0)&#xA;        {&#xA;            $events[] = $id.'.'.$method-&amp;gt;name;&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;// Dump 'em out&#xA;Craft::dd($events);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-12-04T18:57:34.197" LastActivityDate="2014-12-04T18:57:34.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5092" PostTypeId="1" AcceptedAnswerId="9721" CreationDate="2014-12-04T19:04:11.773" Score="3" ViewCount="1160" Body="&lt;p&gt;Ich have a concert entry which I want to expire after the concert is over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to hide past entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set present = now|date_modify(&quot;+1 day&quot;) %}&#xA;{% for entry in craft.entries.section('concert') %}&#xA;     {% if entry.konzertdatum &amp;gt; present %}&#xA;       {{ entry.konzertdatum|date('d. M. Y - H:i')}} - Concert Bla&#xA;     {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But ist it also possible to expire this entry altogether os its marked in the CP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or would it be better to use the post_date as a concert timestamp and then show somehow only future dates?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-05-13T16:02:15.543" Title="Expire an entry according to a date field" Tags="&lt;datetime&gt;&lt;expiration&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5093" PostTypeId="2" ParentId="5092" CreationDate="2014-12-04T19:32:00.743" Score="2" Body="&lt;p&gt;You can set the &lt;code&gt;Expiration Date&lt;/code&gt; in the control panel. It is at the bottom of the column on the right (on wide screens), or at the bottom of the page (on narrow screens). I don't think there is any way to set the Expiration Date from the konzertdatum, so you would have to either use the Expiration Date as the concert date, or maintain both of them.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-04T19:32:00.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5094" PostTypeId="1" AcceptedAnswerId="5101" CreationDate="2014-12-04T21:32:15.963" Score="4" ViewCount="2952" Body="&lt;p&gt;I'm trying to output all the siblings of the current entry in a multi level structure like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sibling in entry.siblings() %}&#xA;    &amp;lt;li&amp;gt;{{ sibling.link }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works well, but how can I make this output all the siblings and the current entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;li&amp;gt;{{ entry.link }}&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;before or after the sibling.link, but that would mess up the sort order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this can't be done this way, maybe I could somehow output the current branch/depth using a different approach? Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2015-09-11T19:28:21.333" Title="How to output siblings including the current entry?" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5095" PostTypeId="1" CreationDate="2014-12-04T21:45:16.967" Score="1" ViewCount="97" Body="&lt;p&gt;I have a list of entries and I would like to filter them into 2 lists.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Entries that have been made a relation in another section&lt;/li&gt;&#xA;&lt;li&gt;Entries that have NOT been made a relation in another section&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I thought about tackling this the other way round and listing the section with the relations but some entires are related multiple times, so and the titles in the list get repeated multiple times. Unless this can filter out the duplicates, but it starts to get messy at this point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas welcome thanks.&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2014-12-05T14:00:23.480" Title="List Entries in a section that are referenced as a relation in another" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5096" PostTypeId="1" AcceptedAnswerId="5097" CreationDate="2014-12-04T21:50:14.337" Score="2" ViewCount="663" Body="&lt;p&gt;How can I make the Redactor toolbar to not affix to the top of my viewport? I tried to modify the config files, but I had no luck!&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-13T23:05:38.283" Title="Make Redactor toolbar not fixed?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5097" PostTypeId="2" ParentId="5096" CreationDate="2014-12-04T21:50:14.337" Score="3" Body="&lt;p&gt;The toolbar is now set to be fixed by default, even if you don't have that setting in your Redactor config file at all (this applies to all Craft installs before &lt;a href=&quot;http://buildwithcraft.com/updates#build2527&quot; rel=&quot;nofollow&quot;&gt;version 2.0.2527&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it scroll with you page again, edit you config file in craft/config/redactor/[config name].json and set or modify the following property to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;toolbarFixed: false&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(This is not a typo! The &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/toolbar/#setting-toolbarFixed&quot; rel=&quot;nofollow&quot;&gt;property name changed&lt;/a&gt; from &lt;code&gt;toolbarFixedBox&lt;/code&gt; to &lt;code&gt;toolbarFixed&lt;/code&gt; with Redactor 10 / Craft 2.3. Craft's default configs &lt;s&gt;will be updated with the next release&lt;/s&gt; got updated with today's release. Thanks to Brandon for the support!!)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-05T07:30:32.270" LastActivityDate="2014-12-05T07:30:32.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5098" PostTypeId="2" ParentId="5092" CreationDate="2014-12-04T22:09:59.360" Score="2" Body="&lt;p&gt;Not that this answers your question (Marion did a good job with that), if you stick to your current code I would change it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set present = now|date_modify(&quot;+1 day&quot;) %}&#xA;{% for entry in craft.entries.section('concert').konzertdatum('&amp;gt; ' ~ present) %}&#xA;    {{ entry.konzertdatum|date('d. M. Y - H:i')}} - Concert Bla&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how I did it for my event dates, where I didn't want the Client to use the default Expiration date field on the right. One reason for this decision was, that I have more than two dates for my Entry Type (that I theoretically could have used Expiration and Post date for). And I don't want them to be edited all over the place.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-04T22:23:53.197" LastActivityDate="2014-12-04T22:23:53.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5099" PostTypeId="1" AcceptedAnswerId="5100" CreationDate="2014-12-04T22:17:19.453" Score="1" ViewCount="226" Body="&lt;p&gt;I am looking to do the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to display a list of entries from two sections. That much is straightforward; however the kicker is that I only want entries related to a specific category of one of the sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Everything from SectionA&lt;/li&gt;&#xA;&lt;li&gt;Only CategoryC from SectionB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Possible?&lt;/p&gt;&#xA;" OwnerUserId="329" LastActivityDate="2014-12-04T22:29:17.700" Title="Content from two sections but one of which is related to a specific category" Tags="&lt;entries&gt;&lt;relations&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5100" PostTypeId="2" ParentId="5099" CreationDate="2014-12-04T22:29:17.700" Score="1" Body="&lt;p&gt;You would do such things by first getting the entries IDs and then do a query to get all entries with these IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIdsA = craft.entries.section('SectionA').ids() %}&#xA;{% set entryIdsB = craft.entries.section('SectionB').relatedTo('CategoryC').ids() %}&#xA;&#xA;{% set allEntryIds = entryIdsA|merge(entryIdsB) %}&#xA;&#xA;{% set allEntries = craft.entries.id(allEntryIds).order('mySortByField desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-04T22:29:17.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5101" PostTypeId="2" ParentId="5094" CreationDate="2014-12-04T22:40:54.057" Score="4" Body="&lt;p&gt;What about doing it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = entry.getParent() %}&#xA;{% set siblingsPlusMe = parent.getDescendants(1) %}&#xA;&#xA;{% for entry in siblingsPlusMe %}&#xA;    &amp;lt;li&amp;gt;{{ entry.link }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-04T22:40:54.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5102" PostTypeId="2" ParentId="5064" CreationDate="2014-12-04T23:17:19.213" Score="2" Body="&lt;p&gt;Getting that array is simple. Prepare an empty array, then loop through your entries and merge the &quot;Sleeps&quot; fields value to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get your array with the unique values, you basically do the same but also save the value as the key on each iteration. If a key already exists in the array the key/value pair gets overwritten (→ good for you)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a strange behaviour that setting custom numeric keys doesn't work with Twig, that's why I composed a string out of the value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Prepare variables #}&#xA;{% set myArray1 = [] %}&#xA;{% set myArray2 = [] %}&#xA;&#xA;{# Loop through entries of the &quot;Hotel Room&quot; section #}&#xA;{% for entry in craft.entries.section('hotelRoom') %}&#xA;&#xA;    {% set value = entry.sleeps %}&#xA;&#xA;    {% set myArray1 = myArray1|merge([value]) %}&#xA;    {% set myArray2 = myArray2|merge({ ('key' ~ value): value }) %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-04T23:37:36.547" LastActivityDate="2014-12-04T23:37:36.547" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5103" PostTypeId="2" ParentId="5095" CreationDate="2014-12-04T23:50:40.487" Score="1" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryParams = {&#xA;    section: mySection1&#xA;} %}&#xA;&#xA;{% set relationParams = {&#xA;    sourceElement: mySection2,&#xA;    field: myEntriesField&#xA;} %}&#xA;&#xA;{% set entriesWithRelation = craft.entries(params).relatedTo(relationParams).find() %}&#xA;{% set entriesWithoutRelation = craft.entries(params)|without(entriesWithRelation) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-05T14:00:23.480" LastActivityDate="2014-12-05T14:00:23.480" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5104" PostTypeId="1" AcceptedAnswerId="9675" CreationDate="2014-12-05T05:50:49.917" Score="4" ViewCount="1933" Body="&lt;p&gt;I've found information on &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot; rel=&quot;nofollow&quot;&gt;how to upload an asset as part of creating an entry&lt;/a&gt;. What I am trying to do is upload an asset from the frontend &lt;em&gt;without&lt;/em&gt; creating an entry. I have a logged in user, and what I would like them to be able to do is upload an asset to a folder that is unique to that user (folder name = username). Help?&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-05-10T23:33:25.503" LastActivityDate="2017-02-20T14:33:32.780" Title="How to upload an asset from a front-end form" Tags="&lt;assets&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="5105" PostTypeId="1" AcceptedAnswerId="5126" CreationDate="2014-12-05T08:50:04.077" Score="0" ViewCount="566" Body="&lt;p&gt;I'm building a Users search page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to search the members group based on the following fields that I've setup for Users:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;First Name&#xA;Last Name&#xA;Company Name (handle: genericCompany, type: Plain Text)&#xA;Company Overview (handle: membersCompanyOverview, type: Rich Text)&#xA;Contact (handle: membersContact, type: Plain Text)&#xA;Contact Email Address (handle: globalEmailAddress, type: Email Address)&#xA;Contact Position (handle: genericPosition, type: Plain Text)&#xA;Services (handle: membersServices, type: Categories)&#xA;Locations (handle: membersLocations, type: Categories)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My HTML form (removed labels etc to keep form example clean):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;directory_search_form&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;keywords&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;services[]&quot; value=&quot;service-1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;services[]&quot; value=&quot;service-2&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;services[]&quot; value=&quot;service-3&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;locations[]&quot; value=&quot;location-1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;locations[]&quot; value=&quot;location-2&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Go&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var form = $(&quot;#directory_search_form&quot;);&#xA;&#xA;form.on(&quot;submit&quot;,function(event) {&#xA;    event.preventDefault();&#xA;&#xA;    var errors = 0;&#xA;&#xA;    if(!$(&quot;#keywords&quot;).val()) {&#xA;        errors++;&#xA;    }&#xA;&#xA;    if(errors == 0) {&#xA;        $.post(&quot;/search&quot;,$(this).serialize()).done(function(result) {&#xA;            $(&quot;#results&quot;).html(result);&#xA;        });&#xA;    } else {&#xA;        alert(&quot;Please enter some keywords and try again.&quot;);&#xA;&#xA;        return false;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Search template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;    {% set params = craft.request.getPost() %}&#xA;    {% set keywords = &quot;&quot; %}&#xA;    {% set serviceCategories = craft.categories.group(&quot;services&quot;) %}&#xA;    {% set locationCategories = craft.categories.group(&quot;locations&quot;) %}&#xA;    {% for key in params | keys %}&#xA;        {% if key == &quot;keywords&quot; %}&#xA;            {% set keywords = params[&quot;keywords&quot;] %}&#xA;            {% set keywords = keywords | trim %}&#xA;        {% endif %}&#xA;        {% if key == &quot;services&quot; %}&#xA;            {% set services = params[&quot;services&quot;] %}&#xA;            {% set servicesCategories = services | join(&quot;, &quot;) | trim %}&#xA;            {% set serviceCategories = craft.categories.group(&quot;services&quot;).slug(servicesCategories) %}&#xA;        {% endif %}&#xA;        {% if key == &quot;locations&quot; %}&#xA;            {% set locations = params[&quot;locations&quot;] %}&#xA;            {% set locationsCategories = locations | join(&quot;, &quot;) | trim %}&#xA;            {% set locationCategories = craft.categories.group(&quot;locations&quot;).slug(locationsCategories) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    {% set members = craft.users.group(&quot;members&quot;).status(&quot;live&quot;).relatedTo([ &quot;and&quot;, { targetElement: serviceCategories }, { targetElement: locationCategories } ]) %}&#xA;    {% if members | length %}&#xA;        {% for member in members %}&#xA;            {{ member.email }}&amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me all members for selected categories.  However I want to hook up the keywords field to further search users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to get only those users that are related in all categories not either categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the keywords but if I add &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.search(&quot;*&quot; ~ keywords ~ &quot;*&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't get any members for my keywords - e.g Operations Manager when there are Members in the system with Contact Position field set to Operations Manager.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to search by multiple keywords and multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="170" LastEditorUserId="170" LastEditDate="2014-12-05T11:59:34.107" LastActivityDate="2014-12-06T11:13:40.997" Title="Searching members fields" Tags="&lt;users&gt;&lt;field&gt;&lt;search&gt;&lt;ajax&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="9" ClosedDate="2014-12-08T04:43:37.113" ContentLicense="CC BY-SA 3.0" />
  <row Id="5107" PostTypeId="1" AcceptedAnswerId="5108" CreationDate="2014-12-05T10:44:01.020" Score="9" ViewCount="5426" Body="&lt;p&gt;Trying to get users in a members group related to multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set services = craft.categories.group('services').slug('service-1, service-2') %}&#xA;{% set locations = craft.categories.group('locations').slug('location-1') %}&#xA;&#xA;{% set members = craft.users.group(&quot;members&quot;).relatedTo(&quot;and&quot;, { targetElement: services }, { targetElement: locations } ) %}&#xA;&#xA;{{ members | length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Number of members returned is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2015-02-13T15:52:34.763" Title="Users relatedTo multiple categories" Tags="&lt;users&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="5108" PostTypeId="2" ParentId="5107" CreationDate="2014-12-05T11:24:51.680" Score="20" Body="&lt;p&gt;Try passing your &lt;code&gt;relatedTo&lt;/code&gt; parameters as an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set members = craft.users.group('members').relatedTo([ 'and', { targetElement: services }, { targetElement: locations } ]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or a little easier to read:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.users({&#xA;    group: 'members',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: services },&#xA;        { targetElement: locations }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get only those users that are related to both services, add another relation to your parameter array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set service1 = craft.categories.group('services').slug('service-1') %}&#xA;{% set service2 = craft.categories.group('services').slug('service-2') %}&#xA;{% set locations = craft.categories.group('locations').slug('location-1') %}&#xA;&#xA;{% set entries = craft.users({&#xA;    group: 'members',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: service1 },&#xA;        { targetElement: service2 },&#xA;        { targetElement: locations }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br&gt;&#xA;&lt;em&gt;(Copied the solution from Sean's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5105/searching-members-fields&quot;&gt;other question&lt;/a&gt;, because it also fits here!)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to add those relations programatically, that's how I would do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Compose the relation param #}&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{# Add to the relation param #}&#xA;{% if condition1 %}&#xA;    {% set service1 = craft.categories.group('services').slug('service-1') %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: service1 }]) %}&#xA;{% endif %}&#xA;&#xA;{% if condition2 %}&#xA;    {% set service2 = craft.categories.group('services').slug('service-2') %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: service2 }]) %}&#xA;{% endif %}&#xA;&#xA;{# Get users of group &quot;member&quot; #}&#xA;{% set users = craft.users.group('members') %}&#xA;&#xA;{# Further filter users - avoid passing an array with `['and']` only #}&#xA;{% if relationParam|length &amp;gt; 1 %}&#xA;    {% set users = users.relatedTo(relationParam) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditorDisplayName="user2301" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-13T15:52:34.763" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5109" PostTypeId="1" AcceptedAnswerId="8309" CreationDate="2014-12-05T11:40:58.190" Score="1" ViewCount="541" Body="&lt;p&gt;I am creating a plugin where the user is submitting data to a controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a successful saving of the data in the controller/service I want to honour the standardised redirect param:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success/{stripeId}&quot;/&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stripeId is a property of the PaymentModel $payment being passed to the redirectToPostedUrl param:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$this-&amp;gt;redirectToPostedUrl($payment);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works in that when the person is redirected the person is brought to page desired with url like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://web.dev/success/ch_5GW2RFTNvW8qeR&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that craft cannot find the success template and the success page does not show since it is trying to find a template a &lt;code&gt;success/&lt;/code&gt; directory called &lt;code&gt;ch_5GW2RFTNvW8qeR.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 Solutions I have found:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1)&lt;/strong&gt; My plugin users need to set up a route manually in the control panel to allow this to resolve correctly (and have full control over where the success page is and what the url looks like):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OxkVk.png&quot; alt=&quot;image of manual route setup&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2)&lt;/strong&gt; The other option is that I use the Plugin hook &lt;code&gt;registerSiteRoutes&lt;/code&gt; to register a front end route to that template. The obvious problem with that is I either need to make that hard coded, or user configurable (pain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I would obviously need to make it user configurable, it kinda defeats the purpose of the user of the plugin being able to decide the &lt;code&gt;name=&quot;redirect&quot; value=&quot;success/{stripeId}&quot;&lt;/code&gt; in the first place. I would imagine I would have to come up with my own redirection/routing config and logic. I understand this is not a problem in the control panel actions since I know what I want my urls to be, but as a plugin developer I want to give flexibility to users of my plugin to choose their front-end urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? I am leaning towards having to put into the documentation of my plugin that they need to do option 1 above, but still think its not optimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &#xA;Just had another idea. &lt;strong&gt;Option 3)&lt;/strong&gt; Since I will be giving my users demo templates for the front end forms on installation - should I possibly create a route in the &lt;code&gt;craft_routes&lt;/code&gt; table for  the user? That way on first install everything should work without needing to manually set up a bunch of routes manually to match my demo templates.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2014-12-05T12:13:40.210" LastActivityDate="2015-02-21T00:48:19.400" Title="redirectToPostedUrl with object (Model) passed to it and keep template resolving" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5111" PostTypeId="1" AcceptedAnswerId="5112" CreationDate="2014-12-05T15:56:48.387" Score="1" ViewCount="2348" Body="&lt;p&gt;I am working on a project where the content manager can add events (entries). These events have a date, starting time and end time. The fields in the cms show the option for adding a date, time and time accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To print them in HTML I do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Date&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{entry.datum}}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Starttime&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{entry.begintijd}}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Endtime&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{entry.eindtijd}}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, only the date is shown, like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2014-11-30&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2014-11-30&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2014-11-30&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I format the result so I get the times in a format like 15:00?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how do I format the date to be shown in Dutch time format, like 1 januari 2015?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="1072" LastActivityDate="2015-05-06T12:55:54.793" Title="How do I format the date and time I got from an entry?" Tags="&lt;entry&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5112" PostTypeId="2" ParentId="5111" CreationDate="2014-12-05T16:07:22.607" Score="3" Body="&lt;p&gt;You can use the Twig &lt;code&gt;.format()&lt;/code&gt; filter to achieve exactly what you are looking for, the reference page for date and time values is &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you would like the date format to show 15:00, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ entry.lorem.format('H:i') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the date format for 1 Januari 2015 will be as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ entry.lorem.format('j F Y') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I say, you can reference the website for which values to use.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-05-06T12:55:54.793" LastActivityDate="2015-05-06T12:55:54.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5113" PostTypeId="1" AcceptedAnswerId="5455" CreationDate="2014-12-05T17:36:32.480" Score="6" ViewCount="1583" Body="&lt;p&gt;I'm in charge of creating a website with a 'most popular' section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was any native way/plugin that lets me sort craft entries based on most popular?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Expression Engine has view tracking, I'm not sure if Craft does anything similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="884" LastActivityDate="2017-11-29T05:07:09.157" Title="Sort entries by most popular" Tags="&lt;entries&gt;&lt;sorting&gt;&lt;custom&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5114" PostTypeId="1" AcceptedAnswerId="5121" CreationDate="2014-12-05T17:53:16.290" Score="4" ViewCount="394" Body="&lt;p&gt;Is there a way to limit the number of sessions per user? That is, I can be logged into one machine/browsers only once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is essential that we limit the number of times a user can be logged in and I can't seem to find a way to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone dealt with this situation?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2021-01-08T00:33:12.070" Title="Limit number of sessions per user" Tags="&lt;users&gt;&lt;session&gt;&lt;configuration&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5115" PostTypeId="2" ParentId="5113" CreationDate="2014-12-05T18:16:50.200" Score="2" Body="&lt;p&gt;Nothing native, but you could probably pull it off either with this &lt;a href=&quot;https://straightupcraft.com/craft-plugins/entry-count&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; or something similar to it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="328" LastEditDate="2016-03-08T17:22:09.467" LastActivityDate="2016-03-08T17:22:09.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5116" PostTypeId="1" AcceptedAnswerId="5123" CreationDate="2014-12-05T19:12:51.120" Score="1" ViewCount="116" Body="&lt;p&gt;I want to do something special in my template if there's an HTML table in the rich text field. I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if &quot;&amp;lt;/table&amp;gt;&quot; in entry.richTextFieldHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it doesn't work. How can I do this? Or can you think of a better way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2014-12-06T00:11:43.813" Title="How to check for an HTML element in a rich text field?" Tags="&lt;templating&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5117" PostTypeId="2" ParentId="5094" CreationDate="2014-12-05T20:00:11.383" Score="1" Body="&lt;p&gt;This will also work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sibling in entry.parent().children() %}&#xA;    &amp;lt;li&amp;gt;{{ sibling.link }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above uses deprecated Craft properties, use this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sibling in entry.getParent().getDescendants(1) %}&#xA;    &amp;lt;li&amp;gt;{{ sibling.link }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="828" LastEditorUserId="828" LastEditDate="2014-12-05T22:22:06.740" LastActivityDate="2014-12-05T22:22:06.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5118" PostTypeId="1" AcceptedAnswerId="5122" CreationDate="2014-12-05T20:27:14.823" Score="1" ViewCount="91" Body="&lt;p&gt;I have two levels of product variants in a table field. If the product uses Secondary Variants, I need a way to search the Primary Variants column for unique values, then output individually grouped Secondary variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Primary and Secondary Variants are unique for each product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this with TWIG/Craft templates? If not, what do you recommend? Query JSON? Plug-in?&lt;/p&gt;&#xA;" OwnerUserId="573" LastActivityDate="2014-12-09T18:50:04.110" Title="Index &quot;Column A&quot; for unique values, then recursively group &quot;Column B&quot; values based on those uniques" Tags="&lt;templating&gt;&lt;array&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5119" PostTypeId="1" AcceptedAnswerId="5120" CreationDate="2014-12-05T21:21:52.353" Score="3" ViewCount="141" Body="&lt;p&gt;I just downloaded the latest version of Craft (2.3.2617) and extracted the zip to check it out. Every file has execute permissions turned on for all users. Is there any reason for this?&lt;/p&gt;&#xA;" OwnerUserId="1073" LastActivityDate="2014-12-17T18:11:39.600" Title="Why are all Craft files executable?" Tags="&lt;install&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5120" PostTypeId="2" ParentId="5119" CreationDate="2014-12-05T22:01:38.320" Score="1" Body="&lt;p&gt;Folders need to be executable for Apache/PHP to be able to open them and read their contents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it's more of a a case of our build script being overly aggressive and setting the execute bit on files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can tell, though, setting the execute bit on a PHP script is effectively pointless.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-05T22:01:38.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5121" PostTypeId="2" ParentId="5114" CreationDate="2014-12-05T23:00:20.280" Score="5" Body="&lt;p&gt;This can be done with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin would create an 'activity' table that saves the current user's ID and a timestamp of their last known activity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can insert the first row by listening to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onLogin&quot; rel=&quot;noreferrer&quot;&gt;onLogin&lt;/a&gt; event and remove their row by listening to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onLogout&quot; rel=&quot;noreferrer&quot;&gt;onLogout&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All subsequent requests, you'd compare the last known activity timestamp to the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#userSessionDuration&quot; rel=&quot;noreferrer&quot;&gt;userSessionDuration&lt;/a&gt; config setting to still see if they have an active session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd also be listening to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;noreferrer&quot;&gt;onBeforeLogin&lt;/a&gt; event. If someone tries to login on another computer, you'd see that they already have a row in the database and their last known activity timestamp is still in a valid userSessionDuration window.  Then you'd pass &lt;code&gt;$performAction = false&lt;/code&gt; as a property of the event, and that will prevent the login action from occurring.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-05T23:00:20.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5122" PostTypeId="2" ParentId="5118" CreationDate="2014-12-05T23:15:34.353" Score="1" Body="&lt;p&gt;Possible, yes. But if you should do it with Twig alone is a totally different thing. There's other ways to do that in Craft,&#xA;e.g. with relations (Entries Fields) and splitting your Products and their variants into separate sections. Or what about using a structure,&#xA;with your variants being child entries to the product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's how you do that with your table field (totally legitimate in my opinion, one advantage being the ease of use for the Client):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Prepare variable before loop #}&#xA;{% set myVariants = [] %}&#xA;&#xA;{% for row in myTableField %}&#xA;&#xA;    {# Concatenate a string to the value to prevent it from being numeric #}&#xA;    {% set variantKey = 'key' ~ row.col1 %}&#xA;&#xA;    {% if variantKey not in myVariants|keys %}&#xA;&#xA;        {# Insert a new key and add the first value to it #}&#xA;        {% set myVariants = myVariants|merge({ (variantKey): [row.col2] }) %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {# The key already exists, so merge the value to the existing ones #}&#xA;        {% set myVariants = myVariants|merge({ (variantKey): myVariants[variantKey]|merge([row.col2]) }) %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how you print it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;variantsLevel1&quot;&amp;gt;&#xA;    {% for variantKey, variantsLevel1 in myVariants %}&#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {# Remove the string from our key again #}&#xA;            {{ variantKey|slice(3) }}&#xA;&#xA;            &amp;lt;ul class=&quot;variantsLevel2&quot;&amp;gt;&#xA;                {% for variantLevel2 in variantsLevel1 %}&#xA;                    &amp;lt;li&amp;gt;{{ variantLevel2 }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-09T18:50:04.110" LastActivityDate="2014-12-09T18:50:04.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5123" PostTypeId="2" ParentId="5116" CreationDate="2014-12-06T00:01:57.090" Score="2" Body="&lt;p&gt;You can get this to work if you first escape your string using Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/escape.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;escape&lt;/code&gt;&lt;/a&gt; filter. Not exactly sure what's going on, but it'll only work for me if I make Twig double escape the string like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set strategy = 'html' %}&#xA;{% set doubleEscapedString = entry.richTextFieldHandle|escape(strategy) %}&#xA;{% set hasTable = '&amp;amp;lt;/table&amp;amp;gt;' in doubleEscapedString %}&#xA;&#xA;&amp;lt;div class=&quot;{{ hasTable ? 'hasTable' : 'hasNoTable' }}&quot;&amp;gt;&#xA;    {{ entry.richTextFieldHandle }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-06T00:11:43.813" LastActivityDate="2014-12-06T00:11:43.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5124" PostTypeId="1" AcceptedAnswerId="5180" CreationDate="2014-12-06T00:03:05.233" Score="1" ViewCount="435" Body="&lt;p&gt;I'm playing around with the modifyEntryTableAttributes() and tried adding a category field. I get an unknown error has occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guessing there's a problem with it being a category field and not being a sortable attribute? Anyone know if this could work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a few things but here's a simple example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;  if ($source == 'section:3')&#xA;  {&#xA;    $attributes['entryCategory'] = Craft::t('Category');&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full stack trace for the error I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/12/08 18:14:07 [error] [php] htmlspecialchars() expects parameter 1 to be string, object given (craft/app/framework/web/helpers/CHtml.php:103)&#xA;Stack trace:&#xA;#0 craft/app/elementtypes/EntryElementType.php(405): Craft\EntryElementType-&amp;gt;getTableAttributeHtml()&#xA;#1 craft/app/variables/ElementTypeVariable.php(91): Craft\EntryElementType-&amp;gt;getTableAttributeHtml()&#xA;#2 unknown(0): Craft\ElementTypeVariable-&amp;gt;getTableAttributeHtml()&#xA;#3 craft/app/vendor/twig/twig/lib/Twig/Template.php(478): call_user_func_array()&#xA;#4 craft/app/etc/templating/BaseTemplate.php(41): __TwigTemplate_e6df1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b-&amp;gt;getAttribute()&#xA;#5 craft/storage/runtime/compiled_templates/e6/df/1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b.php(124): __TwigTemplate_e6df1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b-&amp;gt;getAttribute()&#xA;#6 craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_e6df1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b-&amp;gt;doDisplay()&#xA;#7 craft/app/vendor/twig/twig/lib/Twig/Template.php(253): __TwigTemplate_e6df1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b-&amp;gt;displayWithErrorHandling()&#xA;#8 craft/storage/runtime/compiled_templates/7b/09/b21bca6b1cf8d1781aac559d66197da8067b06ecd6898c5fde93e6d14c12.php(59): __TwigTemplate_e6df1287b446e919fa0265d20996129e1a92548f58c2cf7a03f5f2a65590210b-&amp;gt;display()&#xA;#9 craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_7b09b21bca6b1cf8d1781aac559d66197da8067b06ecd6898c5fde93e6d14c12-&amp;gt;doDisplay()&#xA;#10 craft/app/vendor/twig/twig/lib/Twig/Template.php(253): __TwigTemplate_7b09b21bca6b1cf8d1781aac559d66197da8067b06ecd6898c5fde93e6d14c12-&amp;gt;displayWithErrorHandling()&#xA;#11 craft/app/vendor/twig/twig/lib/Twig/Template.php(264): __TwigTemplate_7b09b21bca6b1cf8d1781aac559d66197da8067b06ecd6898c5fde93e6d14c12-&amp;gt;display()&#xA;#12 craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): __TwigTemplate_7b09b21bca6b1cf8d1781aac559d66197da8067b06ecd6898c5fde93e6d14c12-&amp;gt;render()&#xA;#13 craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render()&#xA;#14 craft/app/elementtypes/BaseElementType.php(233): Craft\TemplatesService-&amp;gt;render()&#xA;#15 craft/app/controllers/ElementIndexController.php(300): Craft\EntryElementType-&amp;gt;getIndexHtml()&#xA;#16 craft/app/controllers/ElementIndexController.php(112): Craft\ElementIndexController-&amp;gt;_getElementHtml()&#xA;#17 craft/app/framework/web/actions/CInlineAction.php(49): Craft\ElementIndexController-&amp;gt;actionGetElements()&#xA;#18 craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#19 craft/app/framework/web/CController.php(286): Craft\ElementIndexController-&amp;gt;runAction()&#xA;#20 craft/app/framework/web/CController.php(265): Craft\ElementIndexController-&amp;gt;runActionWithFilters()&#xA;#21 craft/app/framework/web/CWebApplication.php(282): Craft\ElementIndexController-&amp;gt;run()&#xA;#22 craft/app/etc/web/WebApp.php(754): Craft\WebApp-&amp;gt;runController()&#xA;#23 craft/app/etc/web/WebApp.php(261): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#24 craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#25 craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#26 public/index.php(14): require_once()&#xA;REQUEST_URI=/index.php/admin/actions/elementIndex/getElements&#xA;in craft/app/elementtypes/BaseElementType.php (322)&#xA;in craft/app/elementtypes/EntryElementType.php (405)&#xA;in craft/app/variables/ElementTypeVariable.php (91)&#xA;2014/12/08 18:14:07 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in craft/app/etc/web/WebApp.php (569)&#xA;in craft/app/elementtypes/BaseElementType.php (322)&#xA;in craft/app/elementtypes/EntryElementType.php (405)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="824" LastEditorUserId="824" LastEditDate="2014-12-08T23:54:08.553" LastActivityDate="2016-03-21T20:46:02.263" Title="Possible to add category field to modifyEntryTableAttributes?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5125" PostTypeId="1" AcceptedAnswerId="5138" CreationDate="2014-12-06T11:04:46.080" Score="1" ViewCount="1428" Body="&lt;p&gt;Is there a way to find the current entry's index? So I want to know how many news items has been posted before the current one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I'm looking at the first news item, it should show &quot;no.1&quot;, and for news item 15 show &quot;no.15&quot; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have currently is getting all news items, ordered by date, loop through them until I find the one I'm on, and show the &lt;code&gt;loop.index&lt;/code&gt;, which seems like it might be a bit slow, especially when we get to item number 100, 200 and so on.&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2014-12-09T10:23:26.703" Title="Get entry index" Tags="&lt;entrymodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5126" PostTypeId="2" ParentId="5105" CreationDate="2014-12-06T11:13:40.997" Score="0" Body="&lt;p&gt;Please see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5107/users-relatedto-multiple-categories/5108#5108&quot;&gt;Users relatedTo multiple categories&lt;/a&gt; for improved answer since this questions details are outdated.&lt;/p&gt;&#xA;" OwnerUserId="170" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2014-12-06T11:13:40.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5127" PostTypeId="2" ParentId="5125" CreationDate="2014-12-06T17:10:16.170" Score="0" Body="&lt;p&gt;You can use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;attribute&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For array's it is 0-indexed, so if you want the first element, it's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').find() %}&#xA;&#xA;{% if entries|length %}&#xA;    {{ attribute(entries, 0).title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second would be &lt;code&gt;{{ attribute(entries, 1).title }}&lt;/code&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-06T17:10:16.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5128" PostTypeId="1" CreationDate="2014-12-06T17:43:14.543" Score="2" ViewCount="161" Body="&lt;p&gt;My custom plugin uses a table to display each of my results, works as intended. However, on the mobile device the table does not layout properly as the table has 6 columns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a rather simple task that can be handled with media queries, but is there a way to use the native CSS/tools that craft provides?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-12-08T18:17:53.960" Title="Hiding my plugin table columns for mobile" Tags="&lt;plugin-development&gt;&lt;css&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5129" PostTypeId="1" AcceptedAnswerId="5136" CreationDate="2014-12-06T19:28:05.903" Score="1" ViewCount="8174" Body="&lt;p&gt;I'm trying to show content for only the second entry in a for loop, but can't find any info on how to do specifically this. I'd like to do something like the below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedImage in entry.relatedImages %}&#xA;    {% for images in relatedImage.image %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ relatedImage.url }}&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ images.getUrl('default') }}&quot; alt=&quot;{{ relatedImage.title }}&quot; width=&quot;{{ images.getWidth('default') }}&quot; height=&quot;{{ images.getHeight('default') }}&quot; /&amp;gt;&#xA;             &amp;lt;/a&amp;gt;{% if loop.index == 2 %}&amp;lt;div&amp;gt;&amp;lt;h2&amp;gt;Welcome!&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;         &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="57" LastEditDate="2014-12-06T21:47:25.190" LastActivityDate="2014-12-06T21:57:52.040" Title="Target second (or nth) element in a for loop" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5130" PostTypeId="1" CreationDate="2014-12-06T19:34:15.583" Score="1" ViewCount="408" Body="&lt;p&gt;Is there a way to compress the Craft CSS for a specific environment?&lt;/p&gt;&#xA;&lt;p&gt;Currently there is a setting for Javascript, &lt;code&gt;useCompressedJs&lt;/code&gt;, set to true by default.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;useCompressedJs&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Tells Craft whether to use compressed Javascript files whenever possible, to cut down on page load times.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#useCompressedJs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#useCompressedJs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Is it possible to have a similar option in general.php for CSS?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-26T09:27:55.337" Title="Compress Craft Control Panel CSS and JS per environment" Tags="&lt;control-panel&gt;&lt;multi-environment&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5131" PostTypeId="1" AcceptedAnswerId="5137" CreationDate="2014-12-06T19:43:30.523" Score="3" ViewCount="459" Body="&lt;p&gt;I installed Craft CMS and all seemed great! But the pages are not loading.. So bascially /admin loads but /index.php genrates an error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In dutch: &quot;Interne Serverfout Craft\EntryModel en zijn behaviors hebben geen method of closure met naam &quot;heading&quot;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which translated is something like: &quot;Craft\EntryModel and its behaviours have no method or closure with the name heading&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what's wrong? Can be server-level..&#xA;I run it on a mac mini server, but mysql, php and apache (plus php-modules) are installed, and again, admin works nicely..&#xA;best,&#xA;Bart&lt;/p&gt;&#xA;" OwnerUserId="1074" LastEditorUserId="57" LastEditDate="2014-12-06T21:22:59.363" LastActivityDate="2014-12-06T21:41:00.327" Title="admin pages loading but not site itself, strange error" Tags="&lt;error-message&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2014-12-07T08:11:45.520" ContentLicense="CC BY-SA 3.0" />
  <row Id="5132" PostTypeId="2" ParentId="5129" CreationDate="2014-12-06T19:44:17.927" Score="1" Body="&lt;p&gt;What you need is the twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;loop variable&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedImage in entry.relatedImages %}&#xA;  {% for images in relatedImage.image %}&#xA;    &amp;lt;blah {% if loop.index == 2%}class=&quot;i'm the second&quot;{% endif %} &amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are a number of useful loop variables: &lt;code&gt;first&lt;/code&gt;, &lt;code&gt;last&lt;/code&gt;, &lt;code&gt;index&lt;/code&gt;, &lt;code&gt;revindex&lt;/code&gt;, &lt;code&gt;length&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-06T19:44:17.927" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5133" PostTypeId="2" ParentId="5130" CreationDate="2014-12-06T19:50:43.077" Score="3" Body="&lt;p&gt;I don't think there's anything built into Craft. What I do is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.devMode %}&#xA;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{craft.config.environmentVariables['assetURL']}}css/style.css&quot;&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{craft.config.environmentVariables['assetURL']}}css/style.min.css&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use &lt;code&gt;devMode&lt;/code&gt; to control whether or not I want the minified css, and I use &lt;a href=&quot;http://gruntjs.com/&quot; rel=&quot;nofollow&quot;&gt;grunt&lt;/a&gt;'s &lt;a href=&quot;https://github.com/gruntjs/grunt-contrib-cssmin&quot; rel=&quot;nofollow&quot;&gt;cssmin task&lt;/a&gt; to build my minified css.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-06T19:50:43.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5134" PostTypeId="1" AcceptedAnswerId="5201" CreationDate="2014-12-06T20:12:59.607" Score="5" ViewCount="2331" Body="&lt;p&gt;My main issue is perhaps not totally understanding the unique idioms of Yii, but I need to output data from my custom data tables in a template. So obviously I have a &lt;code&gt;MyPluginVariables&lt;/code&gt; class and a &lt;code&gt;MyPluginService&lt;/code&gt; to handle to actual business logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using my &lt;code&gt;MyPlugin_FooRecord&lt;/code&gt; I can use ActiveRecord to fetch some data. But this obviously returns the actual record objects, when I really just need a model passed to the template. From what I understand, I should use models not the records themselves. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how exactly should I build a chainable syntax, similar to fetching entries in a template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I am trying to get this to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rows = craft.myPlugin.someMethod().limit(10).order('some_col').sort('asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So relating this syntax back to my original question, how would I build this and return an array of models? The &lt;code&gt;ElementCriteriaModel&lt;/code&gt; will automatically execute the &lt;code&gt;find()&lt;/code&gt; method when it's used an array, should I just overriding the &lt;code&gt;__toArray()&lt;/code&gt; method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been searching and looking through the docs, so perhaps I missed something. I have also been looking through the code in Craft, but due to the abstractions and not being familiar with Yii core classes, I am getting a little lost in figuring out how this works.&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="19" LastEditDate="2014-12-06T20:18:30.303" LastActivityDate="2014-12-10T18:49:23.587" Title="What is the proper way to fetch items from a custom db table and output them in twig?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5135" PostTypeId="2" ParentId="5131" CreationDate="2014-12-06T20:54:54.067" Score="1" Body="&lt;p&gt;I don't think the there is anything wrong with your Craft install. It looks like you might have removed a field from a section but it is still being referenced in your template, but because it doesn't exist for that entry anymore Craft is throwing that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look in the template that is being rendered and there will probably be a tag like &lt;code&gt;{{ entry.heading }}&lt;/code&gt; try deleting it and refreshing the page, or alternatively add a 'heading' field to the section the entry belongs to. This should solve the issue and make the error go away.&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2014-12-06T21:30:37.130" LastActivityDate="2014-12-06T21:30:37.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5136" PostTypeId="2" ParentId="5129" CreationDate="2014-12-06T21:22:06.380" Score="3" Body="&lt;p&gt;It's not working because you're using &lt;code&gt;loop.index&lt;/code&gt; in the context of the inner loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your comment, there will only ever be one images selected, so &lt;code&gt;loop.index&lt;/code&gt; will never be 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to move the &lt;code&gt;loop.index&lt;/code&gt; check to the outer loop, then a simple counter will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set counter = 0 %}&#xA;&#xA;{% for relatedImage in entry.relatedImages %}&#xA;    {% set counter = counter + 1 %}&#xA;&#xA;    {% for images in relatedImage.image %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ relatedImage.url }}&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ images.getUrl('default') }}&quot; alt=&quot;{{ relatedImage.title }}&quot; width=&quot;{{ images.getWidth('default') }}&quot; height=&quot;{{ images.getHeight('default') }}&quot; /&amp;gt;&#xA;             &amp;lt;/a&amp;gt;{% if counter == 2 %}&amp;lt;div&amp;gt;&amp;lt;h2&amp;gt;Welcome!&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;         &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-06T21:57:52.040" LastActivityDate="2014-12-06T21:57:52.040" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5137" PostTypeId="2" ParentId="5131" CreationDate="2014-12-06T21:41:00.327" Score="2" Body="&lt;p&gt;Apparently this is a bug in the latest release.  Oops!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default homepage template on a fresh install is referencing an &lt;code&gt;entry.heading&lt;/code&gt; that no longer exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed it for the next release, but in the meantime, you can change line 23 of &lt;code&gt;craft/templates/index.html&lt;/code&gt; from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.heading }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-06T21:41:00.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5138" PostTypeId="2" ParentId="5125" CreationDate="2014-12-06T23:26:15.057" Score="2" Body="&lt;p&gt;There's no way to do that without a query to the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is really faster, but try to only query for the IDs and see how this performs for you. Another thing you could do, is to add your conditional directly to the for loop tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('news').order('postDate asc').ids() %}&#xA;&#xA;{# Get the position of this entry's ID within our IDs array #}&#xA;{% set position = '' %}&#xA;{% for key, value in entryIds if value == entry.id %}&#xA;    {% set position = key + 1 %}&#xA;{% endfor %}&#xA;&#xA;{# Get the amount of total entries #}&#xA;{% set total = entryIds|length %}&#xA;&#xA;{{ entry.title }} (no. {{ position }} / {{ total }})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are not interested in the total number, here's another way to get the position. The syntax is simpler, though it does not perform better, as you still need to query for the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get this entry + all entries posted before it #}&#xA;{% set postDateParam = '&amp;lt;= ' ~ entry.postDate|date('c') %}&#xA;{% set entryIds = craft.entries.section('news').order('postDate asc').postDate(postDateParam).ids() %}&#xA;&#xA;{# Count them #}&#xA;{% set position = entryIds|length %}&#xA;&#xA;{{ entry.title }} (no. {{ position }})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-09T10:23:26.703" LastActivityDate="2014-12-09T10:23:26.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5139" PostTypeId="2" ParentId="4634" CreationDate="2014-12-07T06:22:36.450" Score="3" Body="&lt;p&gt;I am creating an image to help me test Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/gabrielmoreira/docker-craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/gabrielmoreira/docker-craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1076" LastActivityDate="2014-12-07T06:22:36.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5140" PostTypeId="2" ParentId="5044" CreationDate="2014-12-07T09:32:02.863" Score="3" Body="&lt;p&gt;If you are hosting on an Apache server, check your rewrite rules. The output provided appears to be appending a &lt;code&gt;/&lt;/code&gt; to the end of the URL - which would most likely return a 404 error as it thinks the file is actually a directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more specific, check for any rewrite rules that add a trailing slash to directories (or in general). That is most likely the culprit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-12-07T09:32:02.863" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5141" PostTypeId="1" CreationDate="2014-12-07T13:36:59.980" Score="1" ViewCount="488" Body="&lt;p&gt;I've uploaded my site to the live server and i'm getting &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template Error&#xA;&#xA;Variable &quot;heading&quot; does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On a couple of pages. This is only happening to 2 sections, the rest are all fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it then goes onto identify the template and template var that it claims is missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, there is no db or file difference to the local or dev sites!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've cleared caches, double checked permissions, changed php versions to no avail. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update, i had devmode set to true, and have set it to false now, but, now the page renders, it does not output any text content from the cms. Just an image. Odd.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2014-12-07T13:50:24.393" LastActivityDate="2015-01-06T14:09:42.940" Title="Variable 'foo' does not exist in template" Tags="&lt;templating&gt;&lt;error-message&gt;&lt;variable&gt;&lt;server&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5142" PostTypeId="2" ParentId="5141" CreationDate="2014-12-07T14:01:45.117" Score="1" Body="&lt;p&gt;Well, oddly, the answer was instead of {{ heading }} i needed to do {{ entry.heading }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very odd.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2014-12-07T14:01:45.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5143" PostTypeId="1" CreationDate="2014-12-08T05:48:57.757" Score="6" ViewCount="9733" Body="&lt;p&gt;I'm new to Craft and having a very hard time calling the URL from a field I created called &lt;code&gt;imagePrimary&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read this extensively but still no luck. &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/assets-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'header.html' %}&#xA;&#xA;{% block content %}&#xA;&#xA;{% for entry in craft.entries.section('projects').limit(500).find() %}  &#xA;&#xA;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row entry feed linked&quot;&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;title&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;p&amp;gt;&amp;lt;span&amp;gt;{{ entry.studio }}&amp;lt;/span&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;col-xs-12 col-md-8&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;featured image&quot; style=&quot;background-image: url(&#xA;&#xA;                {% for asset in entry.imagePrimary %}&#xA;                     {{ asset.url() }}                                  &#xA;                {% endfor %}&#xA;&#xA;            )&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;col-md-4 secondary&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;featured image secondary&quot; style=&quot;background-image: url()&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;featured image secondary&quot; style=&quot;background-image: url()&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&#xA;{% include 'footer.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1078" LastEditorUserId="3951" LastEditDate="2017-10-24T15:24:28.883" LastActivityDate="2017-10-24T15:25:35.540" Title="How to get asset URL from field in template" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5144" PostTypeId="2" ParentId="5143" CreationDate="2014-12-08T06:24:57.020" Score="9" Body="&lt;p&gt;Hey Jeremy give this a shot to see if it works (from &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.assets&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.imagePrimary %}&#xA;     &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;                               &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this doesn't clear it up, I'd double check the field Handle to make sure it's spelled correctly and there is an image within one of your entries.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:35.540" LastActivityDate="2017-10-24T15:25:35.540" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5145" PostTypeId="1" AcceptedAnswerId="5147" CreationDate="2014-12-08T09:04:32.110" Score="2" ViewCount="842" Body="&lt;p&gt;I'm new to Craft and using Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a matrix field called &lt;code&gt;imageDouble&lt;/code&gt; with two child fields called &lt;code&gt;firstImage&lt;/code&gt; and &lt;code&gt;secondImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template code I have is returning a 500 error. I want it to display &lt;code&gt;firstImage&lt;/code&gt; and &lt;code&gt;secondImage&lt;/code&gt; each in their own separate div. Any help with my structure here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.body %}&#xA;&#xA;    {% if block.type == &quot;text&quot; %}&#xA;&#xA;        &amp;lt;div class=&quot;row text detail&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;col-xs-12 col-md-6 col-md-offset-3&quot;&amp;gt;&#xA;&#xA;                &amp;lt;p&amp;gt;{{ block.textContent }}&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% elseif block.type == &quot;imageDouble&quot; %}&#xA;&#xA;        {% set image = block.image.first() %}&#xA;&#xA;            {% if image %}&#xA;&#xA;            &amp;lt;div class=&quot;row imageDouble detail&quot;&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;col-xs-12 col-md-6&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;img src=&quot;{{ firstImage.getUrl() }}&quot;&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% set image = block.image.first() %}&#xA;&#xA;            {% if image %}&#xA;&#xA;                &amp;lt;div class=&quot;col-xs-12 col-md-6&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;img src=&quot;{{ secondImage.getUrl() }}&quot;&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            {% endif %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1078" LastActivityDate="2014-12-08T09:47:31.950" Title="How to call two separate images from Matrix field" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5146" PostTypeId="1" AcceptedAnswerId="5150" CreationDate="2014-12-08T09:16:48.470" Score="6" ViewCount="719" Body="&lt;p&gt;Everything looks OK but when I submit my form, field doesn't get updated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the page reloads, the checkbox is still showing old state.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Some Option&amp;lt;/label&amp;gt;&#xA;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[membersAvailableForCollaborativeProjects]&quot; value=&quot;1&quot; {% if user.membersAvailableForCollaborativeProjects %}checked=&quot;checked&quot;{% endif %} /&amp;gt; Yes&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;membersAvailableForCollaborativeProjects&lt;/code&gt; is a Lightswitch field type. Treating it the same as a Checkbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My form action is &lt;code&gt;users/saveUser&lt;/code&gt; as I'm trying to update a users profile via the front-end.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-12-08T13:19:40.913" Title="Updating a Lightswitch value not working via front-end" Tags="&lt;user-profile&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5147" PostTypeId="2" ParentId="5145" CreationDate="2014-12-08T09:47:31.950" Score="7" Body="&lt;p&gt;I think the issue here where you are setting your image variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set image = block.image.first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should reference the field handle of the asset you are trying to get the url of, so it should be this instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set image = block.firstImage.first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then where you try and display the image it should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then need to update this for the &lt;code&gt;secondImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be worth mentioning that there is a cleaner way to achieve what you’re after, with just one asset field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can upload multiple images to a single asset field, so assuming &lt;code&gt;firstImage&lt;/code&gt; has two assets attached, your code could be shortened to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% elseif block.type == &quot;imageDouble&quot; %}&#xA;&#xA; {# this has two assets attached #}&#xA; {% set images = block.firstImage %}&#xA;&#xA; {% if images and images|length %}&#xA;&#xA;  &amp;lt;div class=&quot;row imageDouble detail&quot;&amp;gt;&#xA;&#xA;    {# Loop through the images #}&#xA;    {% for image in images %}&#xA;&#xA;      &amp;lt;div class=&quot;col-xs-12 col-md-6&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA; {% endif %}&#xA;&#xA;{% endif %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will help keep your code from repetition and will be easier to maintain in the future :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-12-08T09:47:31.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5150" PostTypeId="2" ParentId="5146" CreationDate="2014-12-08T13:19:40.913" Score="13" Body="&lt;p&gt;After taking a look at this it would seem like the lightswitch is always expecting a value to determine the whether the state should be on or off. When you don’t check the input and submit the form, the field doesn’t get sent to the controller, the value isn’t replaced (as there technically is no value) and nothing updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can work around this by providing a hidden input above the checkbox with a constant value of &lt;code&gt;0&lt;/code&gt;, so when the form submits and there is no check in the checkbox a &lt;code&gt;0&lt;/code&gt; will get sent and will override the &lt;code&gt;1&lt;/code&gt; if already set. If you check the input then the hidden field will be overwritten when the form submits and will update the field value of &lt;code&gt;0&lt;/code&gt; to a &lt;code&gt;1&lt;/code&gt; and will light the switch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete form I have used with success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA; {{ getCsrfInput() }}&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA; &amp;lt;label&amp;gt;Some Option&amp;lt;/label&amp;gt;&#xA; &amp;lt;label&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[membersAvailableForCollaborativeProjects]&quot; value=&quot;0&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[membersAvailableForCollaborativeProjects]&quot; value=&quot;1&quot; {% if user.membersAvailableForCollaborativeProjects %}checked{% endif %} /&amp;gt; Yes&#xA; &amp;lt;/label&amp;gt;&#xA; &amp;lt;input type=&quot;submit&quot; value=&quot;Save user&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-12-08T13:19:40.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5152" PostTypeId="1" CreationDate="2014-12-08T14:35:52.647" Score="0" ViewCount="2306" Body="&lt;p&gt;I try to upload a file larger than the 16 MB Craft limit. The file I try to upload is 61 MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the &lt;code&gt;maxUploadFileSize to 256000000&lt;/code&gt;.&#xA;My hosting company changes the server PhP settings to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_file_uploads = 20&#xA;upload_max_filesize = 256M&#xA;max_input_time = 180&#xA;memory_limit = 256M&#xA;post_max_size = 256M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The file starts to upload but when the progress bar is at 50%, it just stops. It keeps &quot;uploading&quot; (wheel keeps spinning in the top right corner) but nothing happens anymore. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get a front-end error either. But in my browser console it says: ERR_CONNECTION_RESET&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone who can help me find a solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my hosting company made the time-out longer and the error dissapeared. &#xA;But I still can't upload the file as I get this error in the console window now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://krycer.be/index.php/admin/actions/assets/uploadFile 502 (Proxy Error ( The specified network name is no longer available.  ))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I diasble my proxy I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://krycer.be/index.php/admin/actions/assets/uploadFile 500 (( The specified network name is no longer available.  ))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The file upload completes, but the status bar remains visible, allthough full, and the file is not visible in the assets folder.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2014-12-10T15:57:42.167" LastActivityDate="2014-12-10T15:57:42.167" Title="File upload fails without error" Tags="&lt;upload&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="5153" PostTypeId="2" ParentId="5152" CreationDate="2014-12-08T15:14:56.013" Score="1" Body="&lt;p&gt;It would be worth checking &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt;, it's very likely there's a clue in there.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-12-08T15:14:56.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5154" PostTypeId="2" ParentId="5128" CreationDate="2014-12-08T17:13:04.837" Score="3" Body="&lt;p&gt;I have never used it, but there is a method &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#isMobileBrowser&quot; rel=&quot;nofollow&quot;&gt;craft.request.isMobileBrowser()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isMobileBrowser() %}&#xA;    &amp;lt;td&amp;gt;non-mobile browser column&amp;lt;/td&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even better, you could give that column a class, and then include a mobile css file to layout the table for mobile:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isMobileBrowser() %}&#xA;   {% includeCssFile &quot;/assets/css/mobile.css&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-08T18:17:53.960" LastActivityDate="2014-12-08T18:17:53.960" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5155" PostTypeId="1" CreationDate="2014-12-08T17:25:11.080" Score="1" ViewCount="1601" Body="&lt;p&gt;Trying to output navigation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home &lt;/li&gt;&#xA;&lt;li&gt;About &lt;/li&gt;&#xA;&lt;li&gt;Services&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub 1&lt;/li&gt;&#xA;&lt;li&gt;Sub 2&lt;/li&gt;&#xA;&lt;li&gt;Sub 3 &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;List item&lt;/li&gt;&#xA;&lt;li&gt;Testimonials &lt;/li&gt;&#xA;&lt;li&gt;Contact &lt;/li&gt;&#xA;&lt;li&gt;Get Quote&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd like to remove the link to the Services page, preferably to &lt;code&gt;&amp;lt;a href&quot;#&quot;&amp;gt;&lt;/code&gt; and if accessed through url, redirect to homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I'm currently outputting nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {# get menu items #}&#xA;        {% set pageItems = craft.entries.section('services').level('&amp;lt;= 2') %}&#xA;        {# % set pageItems = craft.entries.level('&amp;lt;= 2') %# }&#xA;&#xA;        {# Output the sub menu #}&#xA;        &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% set entry = craft.entries.slug('about').first %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;            {% nav page in pageItems %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;                    {% if page.navigationTitle %}{{ page.navigationTitle|nl2br }}{% else %}{{ page.title }}{% endif %}&#xA;                &amp;lt;/a&amp;gt;&#xA;                {% ifchildren %}&#xA;                &amp;lt;div class=&quot;drop&quot;&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% set entry = craft.entries.slug('testimonials').first %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% set entry = craft.entries.slug('contact').first %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% set entry = craft.entries.slug('get-a-quote').first %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="806" LastActivityDate="2017-06-28T18:52:55.953" Title="Remove page link from navigation" Tags="&lt;navigation&gt;&lt;templating&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5156" PostTypeId="1" AcceptedAnswerId="5158" CreationDate="2014-12-08T17:40:00.743" Score="1" ViewCount="1435" Body="&lt;p&gt;I created a generic 404.html template to replace the default Craft page. I'm getting the following error when forcing a 404 in browser. Any idea what the issue is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Syntax&#xA;&#xA;The filter &quot;match&quot; does not exist. Did you mean &quot;batch&quot; in &quot;404&quot; at line 4 (/Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php:573)&#xA;&#xA;#0 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(437): Twig_ExpressionParser-&amp;gt;getFilterNodeClass('match', 4)&#xA;#1 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(422): Twig_ExpressionParser-&amp;gt;parseFilterExpressionRaw(Object(Twig_Node_Expression_GetAttr))&#xA;#2 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(287): Twig_ExpressionParser-&amp;gt;parseFilterExpression(Object(Twig_Node_Expression_GetAttr))&#xA;#3 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(179): Twig_ExpressionParser-&amp;gt;parsePostfixExpression(Object(Twig_Node_Expression_Name))&#xA;#4 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(84): Twig_ExpressionParser-&amp;gt;parsePrimaryExpression()&#xA;#5 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/ExpressionParser.php(41): Twig_ExpressionParser-&amp;gt;getPrimary()&#xA;#6 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/TokenParser/If.php(38): Twig_ExpressionParser-&amp;gt;parseExpression()&#xA;#7 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Parser.php(187): Twig_TokenParser_If-&amp;gt;parse(Object(Twig_Token))&#xA;#8 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Parser.php(95): Twig_Parser-&amp;gt;subparse(NULL, false)&#xA;#9 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Environment.php(507): Twig_Parser-&amp;gt;parse(Object(Twig_TokenStream))&#xA;#10 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Environment.php(559): Twig_Environment-&amp;gt;parse(Object(Twig_TokenStream))&#xA;#11 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Environment.php(334): Twig_Environment-&amp;gt;compileSource('{% extends &quot;_la...', '404')&#xA;#12 /Applications/MAMP/htdocs/mysite.com/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Environment-&amp;gt;loadTemplate('404')&#xA;#13 /Applications/MAMP/htdocs/mysite.com/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('404', Array)&#xA;#14 /Applications/MAMP/htdocs/mysite.com/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&#xA;#15 /Applications/MAMP/htdocs/mysite.com/craft/app/controllers/TemplatesController.php(190): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&#xA;#16 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#17 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#18 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#19 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#20 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#21 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/base/CErrorHandler.php(331): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#22 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/base/CErrorHandler.php(204): CErrorHandler-&amp;gt;render('error', Array)&#xA;#23 /Applications/MAMP/htdocs/mysite.com/craft/app/etc/errors/ErrorHandler.php(113): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#24 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/base/CErrorHandler.php(129): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#25 /Applications/MAMP/htdocs/mysite.com/craft/app/framework/base/CApplication.php(732): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#26 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#27 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template code causing issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{!-- META TITLE --}&#xA;&amp;lt;title&amp;gt;&#xA;    {% if entry.metaTitle != '' %}&#xA;        {{entry.metaTitle}}&#xA;    {% else %}&#xA;        My Site&#xA;    {% endif %}&#xA;&amp;lt;/title&amp;gt;&#xA;&#xA;{!-- META DESCRPTION --}&#xA;{% if entry.metaDescription != '' %}&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&#xA;{!-- META KEYWORDS --}&#xA;{% if entry.metaKeywords != '' %}&#xA;    &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ entry.metaKeywords }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'global/head.html' %}    &#xA;&#xA;&amp;lt;body&amp;gt;&#xA;    &amp;lt;div class=&quot;side-push&quot;&amp;gt;&#xA;        &amp;lt;div id=&quot;wrapper&quot;&amp;gt;&#xA;            {% include 'global/header.html' %}  &#xA;                {% block home_slider %}&#xA;                {% endblock %}&#xA;                {% block content %}&#xA;                {% endblock %}&#xA;            {% include 'global/footer.html' %}      &#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;window.jQuery || document.write('&amp;lt;script src=&quot;/js/jquery-1.11.1.min.js&quot;&amp;gt;&amp;lt;\/script&amp;gt;')&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;/js/jquery.main.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;header.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;header id=&quot;header&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;header-top&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;slogan&quot;&amp;gt;Family Owned Since 1924&amp;lt;/span&amp;gt;&#xA;            &amp;lt;div class=&quot;logo&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;/images/logo.png&quot; alt=&quot;magoon signs&quot;&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;main-nav&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;opener&quot;&amp;gt;&amp;lt;span&amp;gt;Menu&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;nav id=&quot;nav&quot;&amp;gt;&#xA;                {# get menu items #}&#xA;                {% set pageItems = craft.entries.section('services').level('&amp;lt;= 2') %}&#xA;                {# % set pageItems = craft.entries.level('&amp;lt;= 2') %# }&#xA;&#xA;                {# Output the sub menu #}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% set entry = craft.entries.slug('about').first %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;                    {% nav page in pageItems %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;                            {% if page.navigationTitle %}{{ page.navigationTitle|nl2br }}{% else %}{{ page.title }}{% endif %}&#xA;                        &amp;lt;/a&amp;gt;&#xA;                        {% ifchildren %}&#xA;                        &amp;lt;div class=&quot;drop&quot;&amp;gt;&#xA;                            &amp;lt;ul&amp;gt;&#xA;                                {% children %}&#xA;                            &amp;lt;/ul&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                        {% endifchildren %}&#xA;                    &amp;lt;/li&amp;gt;&#xA;                    {% endnav %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% set entry = craft.entries.slug('testimonials').first %}&#xA;                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% set entry = craft.entries.slug('contact').first %}&#xA;                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% set entry = craft.entries.slug('get-a-quote').first %}&#xA;                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/nav&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/header&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;footer.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;footer id=&quot;footer&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;holder&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;badge&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;/images/img4.png&quot; alt=&quot;image description&quot;&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;                &amp;lt;ul class=&quot;social-networks&quot;&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a class=&quot;linkdin&quot; href=&quot;#&quot;&amp;gt;linkedin&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a class=&quot;facebook&quot; href=&quot;#&quot;&amp;gt;facebook&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ siteName }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;address&amp;gt;{{ companyInfo.address }}&amp;lt;/address&amp;gt;&#xA;                &amp;lt;a class=&quot;tel-link&quot; href=&quot;tel:{{ companyInfo.phoneNumberLink }}&quot;&amp;gt;{{ companyInfo.phoneNumber }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;span class=&quot;timings&quot;&amp;gt;&#xA;                    Open: &amp;lt;time datetime=&quot;2014-08-21&quot;&amp;gt;Mon.-Fri. 8:30am-4pm&amp;lt;/time&amp;gt; Closed Daily from &amp;lt;time datetime=&quot;2014-08-21&quot;&amp;gt;12:00pm-1:00pm&amp;lt;/time&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/footer&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;head.html:&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0 &quot; /&amp;gt;&#xA;&#xA;    {!-- META TITLE --}&#xA;    &amp;lt;title&amp;gt;&#xA;        {% if entry.metaTitle != '' %}&#xA;            {{entry.metaTitle}}&#xA;        {% else %}&#xA;            My Site&#xA;        {% endif %}&#xA;    &amp;lt;/title&amp;gt;&#xA;&#xA;    {!-- META DESCRPTION --}&#xA;    {% if entry.metaDescription != '' %}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {!-- META KEYWORDS --}&#xA;    {% if entry.metaKeywords != '' %}&#xA;        &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ entry.metaKeywords }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;link href='http://fonts.googleapis.com/css?family=Vast+Shadow' rel='stylesheet' type='text/css'&amp;gt;&#xA;    &amp;lt;link media=&quot;all&quot; rel=&quot;stylesheet&quot; href=&quot;/css/all.css&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/css/flexslider.css&quot; type=&quot;text/css&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!--[if lt IE 9]&amp;gt;&amp;lt;script src=&quot;js/ie.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;    {% block css_wufoo %}{% endblock %}&#xA;    {% block css_fancybox %}{% endblock %}&#xA;&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="806" LastEditorUserId="806" LastEditDate="2014-12-08T19:01:06.257" LastActivityDate="2014-12-08T19:46:59.503" Title="404.html template causing twig_error_syntax" Tags="&lt;templating&gt;&lt;error-message&gt;&lt;404-page&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5157" PostTypeId="1" CreationDate="2014-12-08T18:17:28.213" Score="1" ViewCount="201" Body="&lt;p&gt;I'm working on a checkout process for a takeaway restaurant where anonymous visitors can place orders using guest entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this stage the order is saved with a status of &quot;unpaid&quot;. Once a visitor saves the order he's taken to a payment provider service where he pays for his order, once the order is payed the visitor is redirected to a page where the order status would be set to &quot;paid&quot; in a hidden form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to accomplish this the aforementioned saved guest entry would have to be edited from the front-end. Is it possible to anonymously edit an entry?&lt;/p&gt;&#xA;" OwnerUserId="970" LastEditorUserId="970" LastEditDate="2014-12-09T09:38:15.070" LastActivityDate="2014-12-09T11:00:53.497" Title="is it possible to edit an entry from the front-end when you're not logged in?" Tags="&lt;entries&gt;&lt;entry&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5158" PostTypeId="2" ParentId="5156" CreationDate="2014-12-08T18:20:37.780" Score="1" Body="&lt;p&gt;The error indicates you're trying to use a Twig filter that &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/index.html&quot; rel=&quot;nofollow&quot;&gt;doesn't&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters&quot; rel=&quot;nofollow&quot;&gt;exist&lt;/a&gt; in your 404 template at line 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you've got a plugin that added it's own filter, but you don't have the plugin installed or enabled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the follow up comments, the error message is very misleading and not sure where it is coming from.  The 404 template doesn't have an &lt;code&gt;entry&lt;/code&gt; variable defined, so the solution is to wrap any references to it in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ entry.metaTitle }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-08T19:46:59.503" LastActivityDate="2014-12-08T19:46:59.503" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="5159" PostTypeId="1" AcceptedAnswerId="5168" CreationDate="2014-12-08T21:48:17.117" Score="2" ViewCount="7962" Body="&lt;p&gt;I realize this may not be possible to do at all. But I thought I'd go ahead and ask anyway. I'm trying to set up a &quot;hero&quot; image of sorts for specific entries. Here is how I have it setup currently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Series &gt; Series Entries&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each series entry has a series artwork entry that belongs to it. &lt;img src=&quot;https://i.stack.imgur.com/DfiDJ.png&quot; alt=&quot;Here is an example of the &amp;quot;hero&amp;quot; unit I&amp;#39;m trying to add in.&quot;&gt; What I'm trying to do, is have Craft dynamically add the image in based on what series comes up. However, I have it styled just right in my css and I'm using it as background-image: url(). Is it possible to have craft dynamically change it? I tried to using a for loop and putting it in hard coded in the html, but I lose the responsiveness framework of Foundation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section id=&quot;hero&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt; &#xA;    {% endfor %}&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;&#xA;    #hero {&#xA;        background: url(https://s3-us-west-2.amazonaws.com/bridge-     assets/photos/hero_image_blue.jpg) #074e68;&#xA;        background-repeat:no-repeat;&#xA;        background-size:cover;&#xA;        height: 200px;&#xA;        text-align: left;&#xA;        position: relative;&#xA;        width:100%;&#xA;        padding: 100px 20px 0 20px;    &#xA;&#xA;        @media #{$medium-only} {        &#xA;            height:300px;&#xA;       }&#xA;&#xA;       @media #{$large-up} {        &#xA;        height:300px;&#xA;       }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my series page which lists all the series&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_page&quot; %}    &#xA;&#xA;{% block content %}&#xA;  &amp;lt;section id=&quot;hero&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Messages&amp;lt;/h1&amp;gt;&#xA;  &amp;lt;/section&amp;gt;&#xA;&#xA;  &amp;lt;section class=&quot;series&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;    &#xA;      &amp;lt;ul class=&quot;large-block-grid-3 medium-block-grid-2 small-block-grid-1&quot;&amp;gt;&#xA;        {% for series in craft.entries.section('series').level(1).order('postDate desc') %}&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ series.url }}&quot;&amp;gt;&#xA;&#xA;            {% for image in series.seriesArtwork %}    &#xA;                &amp;lt;div id=&quot;overlay&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('seriesThumbnail') }}&quot; alt=&quot;Logo Image&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                  &amp;lt;span class=&quot;series-title&quot;&amp;gt; {{ series.title }}&amp;lt;/span&amp;gt;&#xA;                  &amp;lt;span class=&quot;series-dates&quot;&amp;gt;{{ series.seriesDates }}&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt; &#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;          &amp;lt;/li&amp;gt;    &#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/section&amp;gt;&#xA;&#xA;  &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;img src=&quot;http://placehold.it/60x60&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the css&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;section.series {&#xA;    position: relative;&#xA;    top: 20px;   &#xA;    display: inline;&#xA;&#xA;    li {&#xA;        list-style: none;&#xA;        text-align: left;   &#xA;    }&#xA;&#xA;    #overlay img {    &#xA;        width: 100%;&#xA;        vertical-align: top;&#xA;    }&#xA;&#xA;    img {&#xA;        position: relative;&#xA;    }&#xA;&#xA;   @media #{$medium-up}{&#xA;&#xA;   }&#xA;&#xA;    .card {&#xA;        padding: 10px;&#xA;        margin-top: -10px;&#xA;&#xA;        span.series-dates {&#xA;            display: block;&#xA;            color: #0A9CC9;&#xA;            font-family: 'grota_sansregular';&#xA;            font-size: 14px;&#xA;            margin-top: -5px;&#xA;        }&#xA;&#xA;        span.series-title {&#xA;            font-family: 'grota_sansregular';&#xA;            font-size: 24px;&#xA;            color: #333;&#xA;        }    &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then when you click on a series (still work in progress, just trying to get image working first),&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_page&quot; %}   &#xA;&#xA;{% block content %}&#xA;  {% for image in entry.seriesArtwork %}&#xA;&#xA;    &amp;lt;section id=&quot;hero&quot;&amp;gt;&#xA;      &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt; &#xA;   {% endfor %}&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;    &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    {{ entry.body }}&#xA;    &amp;lt;p&amp;gt;Written by {{ entry.author }} on {{ entry.postDate|date('M d, Y') }}&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="937" LastEditorUserId="344" LastEditDate="2014-12-09T15:59:54.800" LastActivityDate="2014-12-09T15:59:54.800" Title="Dynamically load a background image" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5160" PostTypeId="2" ParentId="5155" CreationDate="2014-12-08T22:44:38.783" Score="5" Body="&lt;p&gt;There are two very different questions here, but I will try my best to answer them both!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first being &quot;&lt;strong&gt;How do I hide a page from the navigation?&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest way I can think of for this, that is also controllable through Craft, is to create a simple &quot;Hide from navigation&quot; &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;Lightswitch&lt;/a&gt; field, and add this to your entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When looping through entries for the navigation, you can check whether the lightswitch has been checked, and if it has, don't show that entry in the nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('lorem').hideFromNavigation(0) %}&#xA;    --&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second question is &quot;&lt;strong&gt;How do I redirect to the homepage if someone visits /services?&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be achieved with the &lt;code&gt;redirect&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;tag&lt;/a&gt;. In your &lt;code&gt;services/index.twig&lt;/code&gt; template file, you can simply add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect siteUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-12-08T22:44:38.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5161" PostTypeId="1" AcceptedAnswerId="5162" CreationDate="2014-12-09T05:28:08.103" Score="1" ViewCount="292" Body="&lt;p&gt;This may sound a little odd so let me explain what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my current setup I have allowed new users to sign up. I want these users to follow this flow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Fill up sign up form and submit&lt;/li&gt;&#xA;&lt;li&gt;Gets redirected to page that warns them of activation email&lt;/li&gt;&#xA;&lt;li&gt;User opens email, clicks on link and is forwarded to his/her profile page&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So far I've been able to do this without any problems. However, I would like to be able to welcome the user when the account is activated without using a new template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this moment &lt;code&gt;'activateAccountSuccessPath'&lt;/code&gt; is set to the profile page, let's call it &lt;code&gt;'members/profile'&lt;/code&gt; I would like to pass a parameter so that I can detect if the account is being activated for the first time and therefore should display a message, e.g.: &lt;code&gt;'members/profile?activated=true'&lt;/code&gt;. As of now, this isn't possible because it looks for the template with that name, not recognizing that it has parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use this same feature for other variables such as &lt;code&gt;'setPasswordSuccessPath'&lt;/code&gt;, which would take you back to the login page, but displaying a message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's impossible to pass arguments this way, how would you recommend going about it?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-12-09T20:05:36.433" Title="Pass URL parameter through General Config file" Tags="&lt;users&gt;&lt;url&gt;&lt;config&gt;&lt;member&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5162" PostTypeId="2" ParentId="5161" CreationDate="2014-12-09T05:52:06.727" Score="3" Body="&lt;p&gt;I think I figured out how to do it but I'd like to get any opinions on this matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I've setup a &lt;strong&gt;dummy template&lt;/strong&gt; which contains a &lt;strong&gt;redirect&lt;/strong&gt; to the URL with the parameter I need. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'activateAccountSuccessPath' =&amp;gt; 'members/activated&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then that template contains:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% redirect 'members/profile?activated=true' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working great. And I guess it's a clean way to do it from the point of view that each variable in the config file has a different target. But is it &quot;cool&quot; to do a redirect just for that?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2014-12-09T05:52:06.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5163" PostTypeId="1" AcceptedAnswerId="5179" CreationDate="2014-12-09T06:33:59.550" Score="4" ViewCount="717" Body="&lt;p&gt;I'm working on a site with a very complex permissions structure (based on groups, dates, dynamic overrides etc). I've written a custom permissions plugin to handle this in a centralized fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this plugin I've exposed some of the functionality through twig variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.permissions.require('update','entry.projects', project.id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function is similar to the {% requireLogin %} where it performs redirects and stops craft processing etc if it fails the permissions check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to somehow execute this as a twig tag so that I can place it outside the {% block content %} tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to create custom twig tags?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Alternatively; &#xA;as a work around I'm using the 'if' tag which is a bit messy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.permissions.require('update','entry.projects', project.id) %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A different tag dedicated to running functions could be useful in the next release, eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% exec craft.permissions.require('update','entry.projects', project.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="972" LastActivityDate="2014-12-09T17:19:24.087" Title="Custom Twig Tags" Tags="&lt;templating&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5164" PostTypeId="1" AcceptedAnswerId="5170" CreationDate="2014-12-09T08:43:12.990" Score="1" ViewCount="786" Body="&lt;p&gt;I know this question has been asked a few times but no of the answers work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a News channel with a Users field type as one of the layout fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find all news entries related to user id X but the entries returned are wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get current member e.g URL /members/1/ #}&#xA;{% set currentMember = craft.users.id(craft.request.segment(2)).first() %}&#xA;&#xA;{# Get current members news entries #}&#xA;{% set currentMemberNews = craft.entries.section(&quot;news&quot;).relatedTo(currentMember) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;currentMemberNews&lt;/code&gt; contains all news. I just want the &lt;code&gt;currentMember&lt;/code&gt; news.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what I am doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-12-09T09:31:32.800" Title="Entries related to Users" Tags="&lt;entries&gt;&lt;users&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5165" PostTypeId="2" ParentId="5164" CreationDate="2014-12-09T09:10:19.180" Score="1" Body="&lt;p&gt;Have you tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentMemberNews = craft.entries.section('news').relatedTo({&#xA;    targetElement: currentMember,&#xA;    field: 'yourFieldHandle',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To specifically define the correct field and the fact that the member is on the target side of this relation?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-12-09T09:10:19.180" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5168" PostTypeId="2" ParentId="5159" CreationDate="2014-12-09T09:24:11.553" Score="10" Body="&lt;p&gt;Adding this from the comments above as a solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;style=&quot;background-image:url({{ image.getURL() }})&quot;&lt;/code&gt; instead, this means you would only overwrite the image and not any of the other background properties&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2014-12-09T09:24:11.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5170" PostTypeId="2" ParentId="5164" CreationDate="2014-12-09T09:31:32.800" Score="1" Body="&lt;p&gt;The problem seemed to be caused by a bad relation. Removing the relation and re-creating the relationship between the User and entries fixed the issue. Dunno what caused it but it was very strange.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2014-12-09T09:31:32.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5171" PostTypeId="2" ParentId="5157" CreationDate="2014-12-09T10:50:47.537" Score="2" Body="&lt;p&gt;You should be able to edit that entry using &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)&lt;/code&gt; with &lt;code&gt;$entry-&amp;gt;authorId&lt;/code&gt; set to a registered user with the necessary permissions. To get the ID of the user that created the entry, access the Guest Entries plugin settings in your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('guestentries')-&amp;gt;getSettings();&#xA;$authorId = $settings-&amp;gt;defaultAuthors[$entry-&amp;gt;section-&amp;gt;handle];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-09T11:00:53.497" LastActivityDate="2014-12-09T11:00:53.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5172" PostTypeId="2" ParentId="3055" CreationDate="2014-12-09T11:43:41.500" Score="3" Body="&lt;p&gt;I think this is what are you searching for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#pageTrigger&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#pageTrigger&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1004" LastActivityDate="2014-12-09T11:43:41.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5173" PostTypeId="1" CreationDate="2014-12-09T12:50:59.020" Score="2" ViewCount="545" Body="&lt;p&gt;is it possible to retrieve for example 50 entries. Show 10 entries on my template and with &quot;more&quot; loading 10 more entries and so on and show them on the same page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats the best practice for this? Do I need a plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2014-12-09T12:50:59.020" Title="can I lazy load entries?" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2014-12-10T18:39:17.120" ContentLicense="CC BY-SA 3.0" />
  <row Id="5174" PostTypeId="1" CreationDate="2014-12-09T14:21:45.933" Score="1" ViewCount="157" Body="&lt;p&gt;Having changed the format of a Dynamic Entry Title, how do I get Craft to re-generate them all? I thought a background task would take care of it but nothing happens.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2014-12-09T16:00:16.727" Title="How to re-generate titles for all entries in a section?" Tags="&lt;entries&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5175" PostTypeId="1" CreationDate="2014-12-09T15:36:01.217" Score="0" ViewCount="1033" Body="&lt;p&gt;when trying to insert a guest entry i get the following response from craft:&#xA;You don’t have the proper credentials to access this page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can i do to avoid this and still insert the entry to craft? It needs to be an anonymous user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;" OwnerUserId="1041" LastActivityDate="2016-11-11T18:06:49.610" Title="You don’t have the proper credentials to access this page" Tags="&lt;guest-entries&gt;&lt;validation&gt;" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5176" PostTypeId="2" ParentId="5174" CreationDate="2014-12-09T15:48:56.460" Score="2" Body="&lt;p&gt;My understanding is that dynamic titles only get updated whenever an entry is saved — so without using a plugin you would have to re-save them each manually. If you wanted to automate this process in a plugin, you would use something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function updateMySectionTitles()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'mySection';&#xA;    $entries = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;    foreach ($entries as $entry) {&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Untested (if anyone sees an error please comment). Also, keep in mind, this might only update the current locale — I'm not sure. You'll need to test, and modify if needed. You could also potentially add this is as a custom command to the &lt;a href=&quot;https://github.com/am-impact/amcommand&quot; rel=&quot;nofollow&quot;&gt;amcommand&lt;/a&gt; plugin for easy access.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-09T16:00:16.727" LastActivityDate="2014-12-09T16:00:16.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5177" PostTypeId="1" CreationDate="2014-12-09T16:40:25.957" Score="3" ViewCount="53" Body="&lt;p&gt;Is it possible to set a list of asset (images) based on their width? So i just want a list of images that are wider than 1000px for example... Without having to check in a for loop. So on the end of - craft.assets for example.&lt;/p&gt;&#xA;" OwnerUserId="1084" LastActivityDate="2014-12-09T18:54:18.560" Title="Asset array by width?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5179" PostTypeId="2" ParentId="5163" CreationDate="2014-12-09T17:19:24.087" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to create custom twig tags?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure.  You can look in &lt;code&gt;craft/app/etc/templating/twigextensions/&lt;/code&gt; to see how Craft creates it's own &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags&quot; rel=&quot;nofollow&quot;&gt;custom Twig tags&lt;/a&gt;, which is how a plugin would do it using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addTwigExtension&quot; rel=&quot;nofollow&quot;&gt;addTwigExtension&lt;/a&gt; hook.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-09T17:19:24.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5180" PostTypeId="2" ParentId="5124" CreationDate="2014-12-09T17:30:29.593" Score="2" Body="&lt;p&gt;In this case, the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntryTableAttributes&lt;/a&gt; hook isn’t quite enough - you also need to use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; hook to customize what actually gets output, since &lt;code&gt;$entry-&amp;gt;entryCategory&lt;/code&gt; returns an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; object, which can’t be output as a string directly.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'entryCategory')&#xA;    {&#xA;        $cat = $entry-&amp;gt;entryCategory-&amp;gt;first();&#xA;        return '&amp;lt;a href=&quot;'.$cat-&amp;gt;getCpEditUrl().'&quot;&amp;gt;'.$cat-&amp;gt;title.'&amp;lt;/a&amp;gt;';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.5+, it's possible to add category fields to element indexes without a plugin, although only the first-selected category will be shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use a plugin to provide a customized cell value, you can use the new &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#defineAdditionalEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;defineAdditionalEntryTableAttributes&lt;/a&gt; hook to register a custom table attribute (this replaces the old modifyEntryTableAttributes hook). You’ll still use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; the same as pre-2.5 (see above example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other key change is that, even with a plugin implementing these two hooks, it is still up to the admin to go to the element index, click the Settings cog icon, and check the box next to the custom table attribute (as admins have full control over which table columns show up now).&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-03-21T20:46:02.263" LastActivityDate="2016-03-21T20:46:02.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5182" PostTypeId="2" ParentId="5177" CreationDate="2014-12-09T17:42:38.890" Score="3" Body="&lt;p&gt;If you want to check all assets across all sources, it'd be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.width('&amp;gt; ' ~ 1000).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want all assets from a particular source, it'd be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.source('sourceHandle').width('&amp;gt; ' ~ 1004).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2014-12-09T18:54:18.560" LastActivityDate="2014-12-09T18:54:18.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5183" PostTypeId="2" ParentId="5161" CreationDate="2014-12-09T20:05:36.433" Score="1" Body="&lt;p&gt;Another possiblity is to have a &lt;code&gt;members/activated&lt;/code&gt; template which does nothing but &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;include&lt;/a&gt; the &lt;code&gt;members/profile&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'members/profile.html' with {'activated': true} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That avoids the html redirect.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-09T20:05:36.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5184" PostTypeId="1" CreationDate="2014-12-09T21:21:48.383" Score="2" ViewCount="287" Body="&lt;p&gt;I'm using &lt;code&gt;{% cache %}&lt;/code&gt; to cache pages, but it seems that the caches are not invalidated after posting new content, which is what I thought should happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've investigated the situation and what I think is happening is this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Post a new entry&lt;/li&gt;&#xA;&lt;li&gt;Caches are then deleted (this process takes a looong time: I noticed that templatecacheelements table was up to something like 450,000 rows)&lt;/li&gt;&#xA;&lt;li&gt;The page in question is accessed by a visitor while the cache is being invalidated, and so the template is cached again before it has been purged&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Because Craft doesn't know about the access to the template during emptying of the caches, I suppose it never will until the cache is purged manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to improve this situation?&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2015-01-08T21:37:12.387" Title="Cache not invalidated on publishing new entry" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5185" PostTypeId="2" ParentId="5184" CreationDate="2014-12-09T21:29:01.187" Score="1" Body="&lt;p&gt;Not the answer you'd be hoping for but the advice I got was to create a plugin to listen and clear the cache when a new entry was published &lt;a href=&quot;https://twitter.com/craftcms/status/541968671300911104&quot; rel=&quot;nofollow&quot;&gt;https://twitter.com/craftcms/status/541968671300911104&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-12-09T21:29:01.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5186" PostTypeId="2" ParentId="5155" CreationDate="2014-12-09T22:06:48.653" Score="2" Body="&lt;p&gt;You need to add a conditional to either only run for the parent items OR exclude the children items. Using depth level would do it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if page.navigationUrlOverride and page.level == '1' %}&#xA;    &amp;lt;a href=&quot;{{ page.navigationUrlOverride }}&quot; /&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;{{page.url}}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2014-12-09T22:06:48.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5187" PostTypeId="2" ParentId="5155" CreationDate="2014-12-09T23:11:59.920" Score="2" Body="&lt;p&gt;As I wrote in the comments section, you could work around this strange behavior of the nav tag by replacing it with nested for loops. Use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getDescendants(1)&lt;/code&gt;&lt;/a&gt; to get the child entries of each top-level entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for page in pageItems %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;            {{ page.navigationTitle ? page.navigationTitle|nl2br : page.title }}&#xA;        &amp;lt;/a&amp;gt;&#xA;&#xA;        {% set subPageItems = page.getDescendants(1) %}&#xA;        {% if subPageItems %}&#xA;            &amp;lt;div class=&quot;drop&quot;&amp;gt;&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% for subPage in subPageItems %}&#xA;                        &amp;lt;a href=&quot;{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}&quot;&amp;gt;&#xA;                            {{ page.navigationTitle ? page.navigationTitle|nl2br : page.title }}&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-09T23:11:59.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5188" PostTypeId="1" AcceptedAnswerId="5189" CreationDate="2014-12-10T00:02:35.900" Score="2" ViewCount="231" Body="&lt;p&gt;I'd like to attach children to a specific Structure entry in a specific order...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Entry A&lt;/li&gt;&#xA;  &lt;li&gt;Entry B&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;em&gt;Imported Entry 2&lt;/em&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;em&gt;Imported Entry 1&lt;/em&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;em&gt;Imported Entry 3&lt;/em&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&lt;/li&gt;&#xA;  &lt;li&gt;Entry C&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've got a &lt;code&gt;$records&lt;/code&gt; array to turn into imported entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'name'      =&amp;gt; 'Whatever',&#xA;    'updated_at' =&amp;gt; '2014-02-27T04:14:29Z',&#xA;    'position'   =&amp;gt; 1, // int representing the sort order&#xA;    [...]&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strike&gt;As I'm looping through my array to create new Craft Structure Entries, I need to be able to define the parent (Entry B), I'm just not sure how.&lt;/strike&gt; I've &lt;a href=&quot;https://buildwithcraft.com/classreference/controllers/EntriesController#actionSaveEntry-detail&quot; rel=&quot;nofollow&quot;&gt;figured out how&lt;/a&gt; to attach new children to &lt;em&gt;Entry B&lt;/em&gt;, I just don't know how to programmatically set their order. My imagination writes code that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$parentCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;$parentCriteria-&amp;gt;search  = 'slug:entry-b';&#xA;$parentCriteria-&amp;gt;section = 'sectionName';&#xA;$parentCriteria-&amp;gt;type    = 'sectionType';&#xA;&#xA;$entries = $parentCriteria-&amp;gt;find();&#xA;$parent = $entries[0];&#xA;&#xA;foreach ($records as $row)&#xA;{&#xA;    $entry = new EntryModel();&#xA;&#xA;    $entry-&amp;gt;sectionId = 4;&#xA;    $entry-&amp;gt;typeId    = 4;&#xA;    $entry-&amp;gt;parentId  = $parent-&amp;gt;id;&#xA;    $entry-&amp;gt;authorId  = 1;&#xA;    $entry-&amp;gt;postDate  = $row-&amp;gt;updated_at;&#xA;    $entry-&amp;gt;title     = $row-&amp;gt;name;&#xA;    $entry-&amp;gt;sortOrder = $row-&amp;gt;position; // ← quite impossible!&#xA;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's &lt;code&gt;$entry-&amp;gt;sortOrder&lt;/code&gt; that's completely made up—&lt;strong&gt;how do you attach an entry to a specific parent in a specific order?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2014-12-10T17:39:05.087" LastActivityDate="2014-12-10T17:39:05.087" Title="How can I append a structure entry and set its order?" Tags="&lt;plugin-development&gt;&lt;structure&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5189" PostTypeId="2" ParentId="5188" CreationDate="2014-12-10T04:31:31.147" Score="2" Body="&lt;p&gt;If you're adding them all as new entries anyway, &lt;strong&gt;why not just sort the records before you create the entries?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;usort($records, array($this, 'sortCategoriesByPosition'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add that before your &lt;code&gt;foreach&lt;/code&gt; loop, then...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function sortCategoriesByPosition($a, $b)&#xA;{&#xA;    if ($a-&amp;gt;position == $b-&amp;gt;position)&#xA;        return 0; &#xA;&#xA;    return ($a-&amp;gt;position &amp;lt; $b-&amp;gt;position) ? -1 : 1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Stop trying to make things harder than they should be.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2014-12-10T04:31:31.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5190" PostTypeId="1" AcceptedAnswerId="5202" CreationDate="2014-12-10T06:37:49.567" Score="3" ViewCount="469" Body="&lt;p&gt;Hello I do not know if this is a bug or something but we just updated to craft 2.3 and got an issue which we did not have previously. &#xA;In user settings we can set the default permissions group but when we do create a new user this group is not applied to that user.Im not sure why this is, maybe something more needs to be done beginning Craft 2.3 but the simple flow of creating a new user worked previously. Upon the user account creation the default group would be set automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your answers. I was mistaken it is assigning the group but I cant get that group on an event trigger.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        var_dump($user-&amp;gt;getGroups()); exit();&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am doing the above in my plugins main PHP file and for some reason before updating it would give me the users group as the default one already assigned. After the update I get a empty array even though going to the control panel after registering I can see that the new user has the group assigned.&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="125" LastEditDate="2015-05-29T15:01:48.683" LastActivityDate="2015-05-29T15:01:48.683" Title="Craft 2.3 new User does not set the default permissions group" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5191" PostTypeId="2" ParentId="4510" CreationDate="2014-12-10T06:45:10.660" Score="4" Body="&lt;p&gt;Unfortunately the drop down options in &lt;a href=&quot;http://straightupcraft.com/craft-plugins/territories-fieldtype&quot; rel=&quot;nofollow&quot;&gt;Territories Dropdown Plugin&lt;/a&gt; are not automatically available in templates.&#xA;It need to be accessed through a field on an element. You're currently trying to access it through 'entry' which i assume doesn't exist in your template (as you would have copied this part).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg. I'm using it on projects in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in project.country.options %}&#xA;&amp;lt;option {% if option.selected %}selected=&quot;selected&quot;{% endif %} value=&quot;{{ option }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For me 'project' is an &lt;a href=&quot;http://buildwithcraft.com/docs/fields&quot; rel=&quot;nofollow&quot;&gt;entry in my section&lt;/a&gt; 'projects' which has been declared above and i have &lt;a href=&quot;http://buildwithcraft.com/docs/fields&quot; rel=&quot;nofollow&quot;&gt;given it the field&lt;/a&gt; 'country' of type 'Territories - Dropdown' in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you want to access the options with out an instance of an entry you'll still need to &lt;a href=&quot;http://buildwithcraft.com/docs/fields&quot; rel=&quot;nofollow&quot;&gt;create a field&lt;/a&gt; with the type 'Territories - Dropdown'. Then replace 'country' in the code below with the handle you give your field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in craft.fields.getFieldByHandle('country').getFieldType.options %}&#xA;&amp;lt;option value=&quot;{{ option }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="972" LastEditorUserId="972" LastEditDate="2014-12-10T08:00:36.353" LastActivityDate="2014-12-10T08:00:36.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5192" PostTypeId="1" AcceptedAnswerId="5193" CreationDate="2014-12-10T10:56:39.940" Score="3" ViewCount="879" Body="&lt;p&gt;I'm working on a website for a music / artist agency.&#xA;On the homepage we need al the artist entries. More than 200. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each artist profile has an image, an image color extruder picker, some tags, relation, etc etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without caching I have a lot of queries. But the page can render. &#xA;If I enable cache, the server runs out of memory sometimes. And when I enable an entry, or edit an entry, the whole cache with the artist loop gets cleared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is my code.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    {% cache for 1 week %}&#xA;        {% set cases = craft.entries({&#xA;            section: 'artist',&#xA;            order: 'title',&#xA;            limit: null&#xA;        }) %}&#xA;&#xA;                {% for entry in cases %}&#xA;                    &amp;lt;article class=&quot;artist filter-{{ entry.title|first|lower }}&quot;&amp;gt;&#xA;                        {% set tags = entry.genre %}&#xA;                        {% set agent = entry.agent %}&#xA;                        {% set image = entry.introFoto.first() %}&#xA;&#xA;                        ...&#xA;                        ... &#xA;                        etc etc&#xA;&#xA;&#xA;                    &amp;lt;/article&amp;gt;&#xA;                {% endfor %}&#xA;    {% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So can I cache individual entries? Like so?&lt;/strong&gt; When someone edits an entry, only that entry cache get cleared?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;        {% set cases = craft.entries({&#xA;            section: 'artist',&#xA;            order: 'title',&#xA;            limit: null&#xA;        }) %}&#xA;&#xA;            {% for entry in cases %}&#xA;                {% cache for 1 week %}&#xA;                    &amp;lt;article class=&quot;artist filter-{{ entry.title|first|lower}}&quot;&amp;gt;&#xA;                        {% set tags = entry.genre %}&#xA;                        {% set agent = entry.agent %}&#xA;                        {% set image = entry.introFoto.first() %}&#xA;&#xA;                        ...&#xA;                        ... &#xA;                        etc etc&#xA;&#xA;&#xA;                    &amp;lt;/article&amp;gt;&#xA;                {% endcache %}&#xA;            {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-12-10T11:40:12.443" Title="Caching and Memory problems. What is best caching method" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5193" PostTypeId="2" ParentId="5192" CreationDate="2014-12-10T11:40:12.443" Score="4" Body="&lt;p&gt;Sure. In my experience it's often better to cache individual entries, rather than whole pages, if the entries have a lot of relations to other elements. It's very resource intensive in Craft to figure out for instance if an image or entry relationship exists. And the more relations you have, the more frequent the cache would break. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The project I'm currently working on has a lot of different landing pages with entry items that have a ton of different images and relations. So I have A LOT of this going on for every single entry in a landing page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if article.commentator | length %}&#xA;  {% if article.commentator.first().profileImage | length %}&#xA;    {% set listImage = article.commentator.first().profileImage.first() %}&#xA;    ...&#xA;  {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found that when I cached the whole page, it would break often, resulting in a serious performance hit. I changed my code to cache individual entries. The difference in load of the page as a whole was small, but the actual impact in percieved performance was huge. In a positive way. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also use the same generated HTML on a lot of different pages, so I also made the caching of these items globally. I create a key that is unique for the different options the block could have. The final cache tag looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key (&quot;article-grid-item-&quot; ~ article.id ~ &quot;-&quot; ~ gridType ~ &quot;-&quot; ~ modifier ~ &quot;-&quot; ~ craft.config.environment) for 3 hours unless craft.config.templateCacheDisabled %}&#xA;...&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the only way to figure out which would be better is to test it on your project. All builds are different, and as far as caching is concerned, there are no simple answers. ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And... I also wish P&amp;amp;T would make this easier/less resource consuming: &lt;code&gt;{% if entry.image | length %}&lt;/code&gt; :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2014-12-10T11:40:12.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5194" PostTypeId="1" CreationDate="2014-12-10T11:59:57.370" Score="1" ViewCount="358" Body="&lt;p&gt;I've a URL /news/archive/2014/12&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A route parses that as going to an archive template and captures a year and month variable. I then want to select all the entries from that month, and I can't work out how. Here's what works for just the year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInPeriod = craft.entries.section('news').limit(null).after(year).before(year+1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the docs say the after and before functions need things specified in the format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;YYYY&#xA;YYYY-MM&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't get that passed in because I don't know how Craft is interpolating the contents of the parenthasise; if I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInPeriod = craft.entries.section('news').limit(null).after(year-month).before(year-month+1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not getting any results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Answer below (use ~ to concat strings) doesn't work correctly because in reality months 'loop' after 12. What gets put in the query when starting in December evaluates to 'month after 12 and before 13', which is garbage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInPeriod = craft.entries.section('news').limit(null).postDate(year~'-'~month) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work, but I can find no documentation on how postDate should be formatted in this use case.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2014-12-10T15:25:01.553" LastActivityDate="2014-12-10T16:24:56.780" Title="How do I pass dynamic year and month to the .after() and .before() functions?" Tags="&lt;entries&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5195" PostTypeId="2" ParentId="5194" CreationDate="2014-12-10T13:05:32.343" Score="4" Body="&lt;p&gt;In Twig, you &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;concatenate strings with the ~ operator&lt;/a&gt;. So, if year and month are variables in your template, you can create a string in the required format like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set yearMonth = year ~ '-' ~ month %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="57" LastEditDate="2014-12-10T15:48:21.080" LastActivityDate="2014-12-10T15:48:21.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5196" PostTypeId="2" ParentId="5194" CreationDate="2014-12-10T16:12:54.923" Score="1" Body="&lt;p&gt;This should solve the month = 13 problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = year ~ '-' ~ month %}&#xA;{% if month == 12 %}&#xA;    {% set endDate = (year + 1) ~ '-01' %}&#xA;{% else %}&#xA;    {% set endDate = year ~ '-' ~ &quot;%02d&quot;|format(month + 1) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries.section('news').limit(null).after(startDate).before(endDate) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-10T16:24:56.780" LastActivityDate="2014-12-10T16:24:56.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5197" PostTypeId="2" ParentId="5194" CreationDate="2014-12-10T16:18:03.800" Score="2" Body="&lt;p&gt;I've worked around this as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if month is not defined %}&#xA;    {% set before = year+1 %}&#xA;    {% set after  = year %}&#xA;{% else %}&#xA;    {% if month == 12 %}&#xA;        {% set yearBefore = year + 1 %}&#xA;        {% set monthBefore = '01' %}&#xA;&#xA;        {% set before = yearBefore~'-'~monthBefore %}&#xA;        {% set after = year~'-'~month %}&#xA;    {% else %}&#xA;        {% set before = year ~ '-' ~ (month+1) %}&#xA;        {% set after  = year ~ '-' ~ month %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% set entriesInPeriod = craft.entries.section('news').limit(null).after(after).before(before) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which seems to be working well. Thanks all.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2014-12-10T16:18:03.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5198" PostTypeId="1" AcceptedAnswerId="5205" CreationDate="2014-12-10T16:28:34.913" Score="0" ViewCount="162" Body="&lt;p&gt;Is there a way to add the validator strings into the translations?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$message=$this-&amp;gt;message!==null?$this-&amp;gt;message:Yii::t('yii','{attribute} cannot be blank.');&#xA;&#xA;/* craft/app/validators/CRequiredValidator.php - line 70 */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to translate that text without changing any of the code (which might be overwritten and lost with an update)&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2014-12-10T19:26:38.160" Title="Translating validator errors" Tags="&lt;language&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5199" PostTypeId="1" CreationDate="2014-12-10T17:30:17.683" Score="2" ViewCount="403" Body="&lt;p&gt;I'm developing a site using a mobile first approach, connecting the phone via USB and using Safari's Web Inspector on iOS8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my local machine, the url for all CSS, JS and href links is &lt;code&gt;http://localhost:8888/&lt;/code&gt; (running MAMP) but on the phone it's my IP or &lt;code&gt;http://00.00.00.00:8888/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, this issue is breaking the entire site when testing on a device. All links are broken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make the Craft variable &lt;code&gt;{{ siteUrl }}&lt;/code&gt;... well variable? &lt;/p&gt;&#xA;" OwnerUserId="1078" LastEditorUserId="25" LastEditDate="2014-12-10T19:13:58.133" LastActivityDate="2016-12-12T22:51:35.333" Title="Making a dynamic {{ siteUrl }} for local mobile testing" Tags="&lt;templating&gt;&lt;multi-environment&gt;&lt;siteurl&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5200" PostTypeId="2" ParentId="5199" CreationDate="2014-12-10T17:38:55.523" Score="3" Body="&lt;p&gt;Hey Jeremy you can actually make siteUrl work using &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Multi-Enviroment Configs&lt;/a&gt; and your general.php file will end up looking something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'*' =&amp;gt; array(&#xA;    // ...&#xA;),&#xA;&#xA;'example.dev' =&amp;gt; array(&#xA;    // ...&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '/users/brandon/Sites/example.dev/public/',&#xA;        'baseUrl'  =&amp;gt; 'http://example.dev/',&#xA;    )&#xA;),&#xA;&#xA;'example.com' =&amp;gt; array(&#xA;    // ...&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '/storage/av12345/www/public_html/',&#xA;        'baseUrl'  =&amp;gt; 'http://example.com/',&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2014-12-10T17:38:55.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5201" PostTypeId="2" ParentId="5134" CreationDate="2014-12-10T18:49:23.587" Score="4" Body="&lt;p&gt;I was able to figure almost all of this stuff out by diving through the code. The only exception is triggering the &lt;code&gt;find()&lt;/code&gt; method automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key here was to follow the code in the &lt;code&gt;ElementCriteriaModel&lt;/code&gt;. First thing I did was create a method in the &lt;code&gt;MyPluginService&lt;/code&gt; class to fetch the data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function foo($criteria = false)&#xA;{&#xA;    return new MyPlugin_MyCriteriaModel($criteria ?: array());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added a wrapper to my &lt;code&gt;MyPluginVariable&lt;/code&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function parcels($criteria = array())&#xA;{&#xA;    return craft()-&amp;gt;myPlugin-&amp;gt;foo($criteria);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will allow for the following syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set data = craft.myPlugin.foo().limit(5).offset(1).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You must define a &lt;code&gt;find()&lt;/code&gt; method in your &lt;code&gt;MyPlugin_MyCriteriaModel&lt;/code&gt; class that will perform the SQL query to actually fetch your data. You also have to loop through the results set and instantiate &lt;code&gt;MyPlugin_FooModel&lt;/code&gt; for each db row if you want to return a &lt;code&gt;Model&lt;/code&gt; to the template instead of a &lt;code&gt;stdObject&lt;/code&gt; or array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, my find method looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function find($attributes = null)&#xA;{   &#xA;    $this-&amp;gt;setAttributes($attributes);&#xA;&#xA;    if (!isset($this-&amp;gt;_matchedObjects))&#xA;    {&#xA;        $objects = craft()-&amp;gt;myplugin_foo-&amp;gt;find($this);&#xA;&#xA;        $this-&amp;gt;setMatchedObjects($objects);&#xA;    }&#xA;&#xA;    return $this-&amp;gt;_matchedObjects;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in &lt;code&gt;MyPlugin_FooService&lt;/code&gt; I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function query(MyPlugin_MyCriteriaModel $criteria)&#xA;{&#xA;    $record = new MyPlugin_FooRecord();&#xA;&#xA;    $query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('*')&#xA;        -&amp;gt;from($record-&amp;gt;getTableName())&#xA;        -&amp;gt;limit($criteria-&amp;gt;limit)&#xA;        -&amp;gt;offset($criteria-&amp;gt;offset)&#xA;        -&amp;gt;order($criteria-&amp;gt;order);&#xA;&#xA;    if($criteria-&amp;gt;id)&#xA;    {&#xA;        $query-&amp;gt;where('id = :id', array(':id' =&amp;gt; $criteria-&amp;gt;id));&#xA;    }&#xA;&#xA;    if($criteria-&amp;gt;uid)&#xA;    {&#xA;        $query-&amp;gt;where('uid = :uid', array(':uid' =&amp;gt; $criteria-&amp;gt;uid));&#xA;    }&#xA;&#xA;    // More conditionals may go here&#xA;&#xA;    return $query;&#xA;}&#xA;&#xA;public function find(MyPlugin_MyCriteriaModel $criteria)&#xA;{&#xA;    $query = $this-&amp;gt;query($criteria);&#xA;&#xA;    return $this-&amp;gt;_populateModelsFromArray($query-&amp;gt;queryAll());&#xA;}&#xA;&#xA;protected function _populateModelsFromArray(Array $array)&#xA;{&#xA;    $models = array();&#xA;&#xA;    foreach($array as $row)&#xA;    {&#xA;        $models[] = MyPlugin_FooModel::populateModel($row);&#xA;    }&#xA;&#xA;    return $models;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19" LastActivityDate="2014-12-10T18:49:23.587" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5202" PostTypeId="2" ParentId="5190" CreationDate="2014-12-10T18:51:03.410" Score="6" Body="&lt;p&gt;The setting still works, but keep in mind that for it to take effect, A) you have to be registering a user through a custom registration form on the front end, and B) you have to be logged out. Without those conditions, it’s not technically &lt;strong&gt;&lt;em&gt;public&lt;/em&gt;&lt;/strong&gt; registration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Default user group assignment has always taken place after the user was saved, and after the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;noreferrer&quot;&gt;users.onSaveUser&lt;/a&gt; event was called. See &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/6d4295d3687e8ddcb3ef96772c032c72d88ac716/app/controllers/UsersController.php#L882-L894&quot; rel=&quot;noreferrer&quot;&gt;these highlighted lines&lt;/a&gt; from UsersController::actionSaveUser() – the onSaveUser event gets called by &lt;code&gt;craft()-&amp;gt;request-&amp;gt;saveUser()&lt;/code&gt;, and default group assignment happens in &lt;code&gt;$this-&amp;gt;_assignDefaultGroupToUser()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-12-11T14:42:33.383" LastActivityDate="2014-12-11T14:42:33.383" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5203" PostTypeId="2" ParentId="5199" CreationDate="2014-12-10T19:03:20.293" Score="1" Body="&lt;p&gt;Not ideal in all situations, but one option is to simply set the Site URL to &lt;code&gt;/&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N1RV5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N1RV5.png&quot; alt=&quot;Site URL&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should make all your links relative, rather than absolute.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="45" LastEditDate="2016-12-12T22:51:35.333" LastActivityDate="2016-12-12T22:51:35.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5204" PostTypeId="2" ParentId="5190" CreationDate="2014-12-10T19:08:40.660" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/5202/45&quot;&gt;Brandon's answer&lt;/a&gt; is correct, as far as how Craft natively handles auto-assignment of user groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you'd like to automatically assign user groups to new users &lt;strong&gt;when you are creating them while logged into the Control Panel&lt;/strong&gt;, you can use this plugin built specifically for this purpose:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-autoassignusergroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auto-Assign User Group&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This will allow you to pre-select user groups, and those groups will be automatically assigned when you create a new user.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-12-10T19:08:40.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5205" PostTypeId="2" ParentId="5198" CreationDate="2014-12-10T19:26:38.160" Score="1" Body="&lt;p&gt;Yii already provides translations for those in multiple languages.  Check in the &lt;code&gt;craft/app/framework/messages&lt;/code&gt; folder to see a list of locales it supports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it in a locale they haven't translated, yet, then you can provide your own &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;static translation&lt;/a&gt; and Craft will use it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-10T19:26:38.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5206" PostTypeId="1" CreationDate="2014-12-10T19:56:37.413" Score="0" ViewCount="375" Body="&lt;p&gt;I've just set up a multi-environment install of Craft but am having an issue on my local install under MAMP Pro. Everything seems to be loading fine except for my index template in the root of the 'templates' directory. It extends a &lt;code&gt;_layout.twig&lt;/code&gt; template but when I load the site locally, only the layout template is being rendered (ie. my block overrides in the index template that extends it aren't being rendered).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this works fine on the remote version of the install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or help would be appreciated as I'm scratching my head at this point...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; - here is the code from &lt;code&gt;_layout.twig&lt;/code&gt; and &lt;code&gt;index.twig&lt;/code&gt;. Pretty straight forward - and these do work expected in the other non-local environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&#xA;&amp;lt;head&amp;gt;&#xA;&#xA;    {% block head %}&#xA;        ...head code in here&#xA;    {% endblock %}&#xA;&#xA;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body&amp;gt;&#xA;&#xA;    {% block bodyContent %}&#xA;        ...presentational code in here&#xA;    {% endblock %}&#xA;&#xA;    {% block footer %}&#xA;        ...presentational code in here&#xA;    {% endblock %}&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout.twig&quot; %}&#xA;&#xA;{% set entries = craft.entries.section('homepage') %}&#xA;&#xA;{% block head %}&#xA;    {{ parent() }}&#xA;&#xA;    ...additional head code&#xA;{% endblock %}&#xA;&#xA;{% block bodyContent %}&#xA;    ... presentational code overriding _layout&#xA;{% endblock %}&#xA;&#xA;{% block footer %}&#xA;    ... presentational code overriding _layout&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="781" LastEditorUserId="115" LastEditDate="2015-08-23T05:40:17.383" LastActivityDate="2015-08-23T05:40:17.383" Title="Only layout template being rendered in local environment" Tags="&lt;templating&gt;&lt;multi-environment&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5207" PostTypeId="2" ParentId="5199" CreationDate="2014-12-10T19:58:26.733" Score="0" Body="&lt;p&gt;If you want to avoid the USB solution and just access your MAMP installation directly over your local network, you can also use a program called SquidMan (which is GUI wrapper for Squid) to set up a local network proxy. Here are &lt;a href=&quot;http://benjaminrojas.net/view-mamp-virtual-hosts-on-your-ipad-and-iphone-over-the-local-network/&quot; rel=&quot;nofollow&quot;&gt;detailed instructions&lt;/a&gt;, but the basics are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Download and launch SquidMan&lt;/li&gt;&#xA;&lt;li&gt;Change the MAMP port to just use the default 80 to avoid many of the environment port config issues.&lt;/li&gt;&#xA;&lt;li&gt;Set your MAMP hosts IP address to your local machine address (which should be available in the 'IP Address' dropdown under the hosts tab).&lt;/li&gt;&#xA;&lt;li&gt;Start both MAMP server and Squid (via SquidMan)&lt;/li&gt;&#xA;&lt;li&gt;Set the phone to use the squid proxy, then access the site normally through your phone using the MAMP address (i.e. &lt;a href=&quot;http://sitename.craft.dev&quot; rel=&quot;nofollow&quot;&gt;http://sitename.craft.dev&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-11T03:20:49.333" LastActivityDate="2014-12-11T03:20:49.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5209" PostTypeId="1" AcceptedAnswerId="5257" CreationDate="2014-12-10T20:37:23.230" Score="2" ViewCount="1774" Body="&lt;p&gt;Within a plugin I am fetching existing entries using the CriteriaModel class as documented here &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements#fetching-elements&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/working-with-elements#fetching-elements&lt;/a&gt;, specifically like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existing = craft()-&amp;gt;elements-&amp;gt;getCriteria($this-&amp;gt;entry-&amp;gt;elementType)-&amp;gt;first(array(&#xA;    'someHandle' =&amp;gt; 'someValue'&#xA;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I am finding this only returns a result if an ENABLED entry is found. I can see that I can search for ONE particular enabled state as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existing = craft()-&amp;gt;elements-&amp;gt;getCriteria($this-&amp;gt;entry-&amp;gt;elementType)-&amp;gt;first(array(&#xA;    'someHandle' =&amp;gt; 'someValue', &#xA;    'enabled' =&amp;gt; 1&#xA;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existing = craft()-&amp;gt;elements-&amp;gt;getCriteria($this-&amp;gt;entry-&amp;gt;elementType)-&amp;gt;first(array(&#xA;    'someHandle' =&amp;gt; 'someValue', &#xA;    'enabled' =&amp;gt; 0&#xA;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I search for ALL entries regardless of the enabled state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also, what is the difference between the status and enabled properties on the model? I can see constants for ENABLED, DISABLED and ARCHIVED. I'm not clear on how this differs from the boolean value that the enabled property has.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-12-15T00:40:15.713" Title="How can I search for entries that are enabled OR disabled?" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5211" PostTypeId="1" AcceptedAnswerId="5214" CreationDate="2014-12-11T01:48:47.483" Score="2" ViewCount="85" Body="&lt;p&gt;Looking to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.images %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot; data-index=&quot;{{ image.index }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems like it should be easy and I feel like I've done it before, however I can't seem to figure it out. Thanks&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="57" LastEditDate="2014-12-11T03:11:43.560" LastActivityDate="2014-12-11T04:13:35.960" Title="How do I display the index of the asset in assets loop?" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5212" PostTypeId="1" CreationDate="2014-12-11T02:22:54.153" Score="1" ViewCount="772" Body="&lt;p&gt;I hope I worded the title correctly. I'm trying to output whatever structure's page I'm on - I want the descendants of whatever page that is. I'm currently using this, which at first appeared to work, but then my css styling doesn't get applied to any of the other entries.  See below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;large-4 columns&quot;&amp;gt;&#xA;  {% set messages = entry.getChildren() %}&#xA;     {% if messages | length %}&#xA;       &amp;lt;ul&amp;gt;&#xA;        {% for entry in messages %}&#xA;          {% for image in entry.seriesArtwork %}&#xA;            &amp;lt;img src=&quot;{{image.getURL('seriesThumbnail')}}&quot;&amp;gt;&#xA;          {% endfor %}&#xA; &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;large-8 columns&quot;&amp;gt;&#xA;      &amp;lt;div id=&quot;message-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div id=&quot;message-speaker&quot;&amp;gt; {{ entry.postDate|date('M j, Y')}} • {{ entry.speaker }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;hr&amp;gt;&#xA;      {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nksL9.jpg&quot; alt=&quot;Example Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="937" LastActivityDate="2014-12-11T02:44:01.057" Title="Output descendants of current structure" Tags="&lt;structure&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5213" PostTypeId="2" ParentId="5212" CreationDate="2014-12-11T02:44:01.057" Score="1" Body="&lt;p&gt;This was an ordering mistake. I didn't setup my grid properly for the loop that has to take place.&lt;/p&gt;&#xA;" OwnerUserId="937" LastActivityDate="2014-12-11T02:44:01.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5214" PostTypeId="2" ParentId="5211" CreationDate="2014-12-11T03:15:38.153" Score="3" Body="&lt;p&gt;This will do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for key, image in block.images %}&#xA;    {{ key }} - &amp;lt;img src=&quot;{{ image.url }}&quot; data-index=&quot;{{ key }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that's a 0 based array, so the first image will output 0, the 2nd 1, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="205" LastEditDate="2014-12-11T04:13:35.960" LastActivityDate="2014-12-11T04:13:35.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5215" PostTypeId="2" ParentId="2894" CreationDate="2014-12-11T05:58:08.887" Score="1" Body="&lt;p&gt;Got testing working by requiring the tests/bootstrap.php  (not app/bootstrap) like here: &lt;a href=&quot;https://github.com/selvinortiz/craft.loath/blob/master/tests/run.sh#L6&quot; rel=&quot;nofollow&quot;&gt;https://github.com/selvinortiz/craft.loath/blob/master/tests/run.sh#L6&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2014-12-11T05:58:08.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5216" PostTypeId="1" AcceptedAnswerId="5221" CreationDate="2014-12-11T08:11:29.277" Score="2" ViewCount="694" Body="&lt;p&gt;I have set up a public registration form simply using the User registration form: &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set it so that when users register they need to be activated by an admin account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently when they register they get an email to verify email address and when they do they get activated.&#xA;If I turn off verify email addresses in user settings they simple get activated automatically.&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="3951" LastEditDate="2017-10-26T10:12:39.130" LastActivityDate="2017-10-26T10:12:39.130" Title="User Registration - Keep as inactive until verified by admin" Tags="&lt;users&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5217" PostTypeId="1" AcceptedAnswerId="5267" CreationDate="2014-12-11T10:23:33.273" Score="5" ViewCount="19877" Body="&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building a .json file for a search component of a used cars website. The file needs to be built from the output of two sections within CraftCMS, Used Cars and Vans &amp;amp; Trucks. It outputs the &quot;make&quot; of vehicle and it's &quot;models&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that there are duplicate &quot;makes&quot;/&quot;models&quot; because they exist in both sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allStock = craft.entries.section(['usedCars','vansTrucks']).level(2) %}&#xA;{% for stock in allStock %}&#xA;{% set models = stock.getChildren() %}&#xA;&quot;{{ stock.make }}&quot; : &quot;{% for stock in models %}{{ stock.model }}{% if not loop.last %}, {% endif %}{% endfor %}&quot;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Holden&quot; : &quot;Commodore, Ute, Viva&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Nissan&quot; : &quot;ATLAS, CARAVAN&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Mazda&quot; : &quot;ATENZA, Axela, CX-7, MAZDA 6, MPV, RX-8, mpv&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Nissan&quot; : &quot;CARAVAN, DUALIS, FAIRLADY, Liberty, Maxima, NAVARA, NOTE&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allStock = craft.entries.section(['usedCars','vansTrucks']).level(2) %}&#xA;{% set newArray = [] %}&#xA;{% for stock in allStock %}&#xA;{% set models = stock.getChildren() %}&#xA;{% if stock.make not in newArray %}&#xA;&quot;{{ stock.make }}&quot; : &quot;{% for stock in models %}{{ stock.model }}{% if not loop.last %}, {% endif %}{% endfor %}&quot;&#xA;{% set newArray = newArray|merge([stock.make]) %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code will remove the duplicate 'make' and merge but it also removes the models with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Holden&quot; : &quot;Commodore, Ute, Viva&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Mazda&quot; : &quot;ATENZA, Axela, CX-7, MAZDA 6, MPV, RX-8, mpv&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Nissan&quot; : &quot;CARAVAN, DUALIS, FAIRLADY, Liberty, Maxima, NAVARA, NOTE&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or direction on how to go about merging the models would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="749" LastEditorUserId="749" LastEditDate="2014-12-12T00:48:59.223" LastActivityDate="2014-12-15T12:14:52.067" Title="Using Twig to merge an array and remove duplicates" Tags="&lt;templating&gt;&lt;array&gt;&lt;merge&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5218" PostTypeId="1" AcceptedAnswerId="5264" CreationDate="2014-12-11T12:07:08.657" Score="5" ViewCount="510" Body="&lt;p&gt;I'm building a site for a multinational company. I have domains set up like this example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;acme.com&lt;/strong&gt; (main portal site, different from local sites, but also aggregating content from all local sites)&#xA;&lt;strong&gt;acmelocal.de&lt;/strong&gt;,&#xA;&lt;strong&gt;acmelocal.fr&lt;/strong&gt;,&#xA;&lt;strong&gt;acmelocal.co.uk&lt;/strong&gt; ... (local sites using the same structure only different languages)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to run everything on the same Craft install to be able to share data. I'll enable certain sections for main portal site only and certain for local sites only - from what I've read, Craft could handle that ... right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I license this? I'm thinking I can buy a pro license for &quot;acme.com&quot; and use all local sites as locales of the main site. Would this work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running everything on a custom server, so I can set up all the domain stuff etc.&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2014-12-15T08:28:53.560" Title="Licensing a multi-lingual site using different domains" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;license&gt;&lt;multi-domain&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5219" PostTypeId="2" ParentId="5218" CreationDate="2014-12-11T12:34:14.023" Score="1" Body="&lt;p&gt;As I understand it, and it's certainly worth getting this checked by the Craft guys themselves, Craft is licensed per install. So if you just have one core Craft install and several domains pulling content from that, you only need the one license.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-12-11T12:34:14.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5220" PostTypeId="2" ParentId="5217" CreationDate="2014-12-11T13:00:03.757" Score="6" Body="&lt;p&gt;The accepted answer &lt;a href=&quot;https://stackoverflow.com/questions/17788424/how-to-remove-duplicated-items-in-array-on-twig&quot;&gt;here&lt;/a&gt; should hopefully help you out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newArray = [] %}&#xA;&#xA;{% for name in array %}&#xA;   {% if name not in newArray %}&#xA;      My name is {{name}}&#xA;      {% set newArray = newArray|merge([name]) %}&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-12-11T13:00:03.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5221" PostTypeId="2" ParentId="5216" CreationDate="2014-12-11T14:40:08.303" Score="2" Body="&lt;p&gt;You could do this in a plugin by listening for some user-related events.  In particular, &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeActivateUser&quot; rel=&quot;nofollow&quot;&gt;onBeforeActivateUser&lt;/a&gt;, where you could cancel user activation by setting &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-11T16:13:17.767" LastActivityDate="2014-12-11T16:13:17.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5223" PostTypeId="2" ParentId="5216" CreationDate="2014-12-11T15:45:15.770" Score="3" Body="&lt;p&gt;Some sort of workaround&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can make a register user group with no permissions.  &lt;/li&gt;&#xA;&lt;li&gt;Than add another group with the permissions you want.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After registration, the admin can put a new user to the new group. &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-12-11T15:45:15.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5224" PostTypeId="1" CreationDate="2014-12-11T19:14:44.487" Score="2" ViewCount="666" Body="&lt;p&gt;So I have a contact form set up in Craft using the Contact Form plugin. I have it rigged up with Mandrill as the SMTP provider and unfortunately with the notifications, the from email address is getting stripped out of the headers by Mandrill. So there's no way to determine who the email came from in order to reply to that person.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is - is there a way to set the replyto to the fromEmail OR is there a way to output the from: email address in the resulting notification message?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance from me and the client dealing with it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;J&lt;/p&gt;&#xA;" OwnerUserId="889" LastActivityDate="2016-01-28T03:56:32.233" Title="Contact Form - ReplyTo or Output fromEmail" Tags="&lt;form&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5225" PostTypeId="1" AcceptedAnswerId="5228" CreationDate="2014-12-11T19:19:38.057" Score="2" ViewCount="130" Body="&lt;p&gt;I have a plugin with a FieldType - I used the CocktailRecipes plugin as a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It extends BaseFieldType; it has 3 methods (getName, defineContentAttribute [AttributeType::Mixed] and getInputHtml)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It it working fine on a local PHP install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on the server, when I create a new field, the plugin's custom field type isn't listed in the drop-down; this works fine on my local PHP install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use my local install connected to the server's database, I can add the field type - but if I look at the field list in the admin back on the server, the field Type isn't the string returned but the getName function in the FieldType model (as it usually is) - it's the full class name, highlighted in red (it has a wrapping element with a class of &quot;error&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see anything in the log files about why - even in dev mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only differences I can think of between my local and the server setups is that the PHP version is higher on the server - and the server OS is case-sensitive for file names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked the casing used, and it looks correct based on the CocktailRecipes plugin example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels like the issue is that the class can't be found on the server, despite it being there; and perhaps a casing issue, which is being masked on my local machine, is the reason the issue isn't occurring locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this issue before? With no error messages being logged, I haven't had much luck digging out the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm basing it on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Ingredients Fieldtype&#xA; *&#xA; * Allows entries to select associated ingredients&#xA; */&#xA;class CocktailRecipes_IngredientsFieldType extends BaseFieldType&#xA;{&#xA;    /**&#xA;     * Get the name of this fieldtype&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Cocktail Ingredients');&#xA;    }&#xA;&#xA;    /**&#xA;     * Get this fieldtype's column type.&#xA;     *&#xA;     * @return mixed&#xA;     */&#xA;    public function defineContentAttribute()&#xA;    {&#xA;        // &quot;Mixed&quot; represents a &quot;text&quot; column type, which can be used to store arrays etc.&#xA;        return AttributeType::Mixed;&#xA;    }&#xA;&#xA;    /**&#xA;     * Get this fieldtype's form HTML&#xA;     *&#xA;     * @param  string $name&#xA;     * @param  mixed  $value&#xA;     * @return string&#xA;     */&#xA;    public function getInputHtml($name, $value)&#xA;    {&#xA;        // call our service layer to get a current list of ingredients&#xA;        $ingredients = craft()-&amp;gt;cocktailRecipes-&amp;gt;getAllIngredients();&#xA;&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('cocktailrecipes/_fieldtypes/ingredients', array(&#xA;            'name'      =&amp;gt; $name,&#xA;            'options'   =&amp;gt; $ingredients,&#xA;            'values'    =&amp;gt; $value,&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What works fine locally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ECOffers_OfferPeriodFieldType extends BaseFieldType {&#xA;&#xA;    public function getName() {&#xA;        return Craft::t('Offer period');&#xA;    }&#xA;&#xA;    public function defineContentAttribute(){&#xA;        return AttributeType::Mixed;&#xA;    }&#xA;&#xA;    public function getInputHtml($name, $value) {&#xA;        $offer_periods = craft()-&amp;gt;eCOffers_offerPeriods-&amp;gt;getOfferPeriodsForLocale($this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;getAttributes()['locale']);&#xA;        $options = array();&#xA;        if ($offer_periods) {&#xA;            foreach ($offer_periods as $offer_period) {&#xA;                $options[] = array(&#xA;                    'label' =&amp;gt; $offer_period-&amp;gt;name.': '.$offer_period-&amp;gt;fromDate-&amp;gt;format('H:i D jS M Y').' - '.$offer_period-&amp;gt;toDate-&amp;gt;format('H:i D jS M Y'),&#xA;                    'value' =&amp;gt; $offer_period-&amp;gt;id&#xA;                );&#xA;            }&#xA;        }&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('ecoffers/_fieldtypes/offerperiods', array(&#xA;            'options' =&amp;gt; $options,&#xA;            'value' =&amp;gt; ((!is_null($value)) ? $value:craft()-&amp;gt;eCOffers_offerPeriods-&amp;gt;getCurrentOfferPeriod($this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;getAttributes()['locale'])-&amp;gt;id)&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MPtNF.png&quot; alt=&quot;Local instance with remote database&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KRZBp.png&quot; alt=&quot;Server instance with same database&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2014-12-11T21:06:57.103" Title="Plugin FieldType giving error on live server - fine locally" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5226" PostTypeId="2" ParentId="5224" CreationDate="2014-12-11T20:50:06.997" Score="2" Body="&lt;p&gt;Not without hacking (boo!) or forking (yay!) the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, the fromEmail is being &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L41&quot; rel=&quot;nofollow&quot;&gt;set&lt;/a&gt; from the email address set in the plugin's setting.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;fromEmail = $emailSettings['emailAddress'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the replyTo is being &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L42&quot; rel=&quot;nofollow&quot;&gt;set&lt;/a&gt; to the email that was supplied on the front-end contact form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;replyTo   = $message-&amp;gt;fromEmail;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is done because some email servers will see that the &lt;code&gt;from&lt;/code&gt; address is different than the domain the email originated on and wrongly mark it as SPAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd adjust those however you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to output the email in the message body, you'd just need to add it to the &lt;code&gt;$message-&amp;gt;message&lt;/code&gt; property in the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/controllers/ContactFormController.php&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can use a more &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;robust form building solution&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-01-27T23:50:56.690" LastActivityDate="2016-01-27T23:50:56.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5227" PostTypeId="1" AcceptedAnswerId="5229" CreationDate="2014-12-11T21:04:19.883" Score="0" ViewCount="455" Body="&lt;p&gt;I've installed Sprout Forms and created a contact form. I'm using displayForm to display the contact form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front end appears it's working as it should. Validation works and the success message works when submitting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issues are I'm not receiving any email notifications (I have defined my email under Notifications &gt; Email Recipients) and I am unable to view entries under the Sprout Forms control panel. When I click on the Sprout Forms tab, I get an orange prompt that flashes &quot;An unknown error occurred&quot; then disappears. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An odd but promising clue is in the admin, when I click on Sprout Forms then Forms, my contact form is showing the total entries that I've been submitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested that PHP Mail works. Does anyone have any clue as to what could be causing this?&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2014-12-11T22:11:17.813" Title="Sprout Forms - An unknown error occurred when trying to view entries in CP" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5228" PostTypeId="2" ParentId="5225" CreationDate="2014-12-11T21:06:57.103" Score="1" Body="&lt;p&gt;I think you're on the right track with the case-sensitivity check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that not only the class names match up case-wise, but the file names on the file system match case-wise as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-11T21:06:57.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5229" PostTypeId="2" ParentId="5227" CreationDate="2014-12-11T21:30:51.940" Score="1" Body="&lt;p&gt;had the same problem. update the plugin to version 0.8.3 fixed the error. &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2014-12-11T21:30:51.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5230" PostTypeId="1" CreationDate="2014-12-11T22:04:29.403" Score="4" ViewCount="3016" Body="&lt;p&gt;Is there any rhyme or reason to the adding of non-breaking spaces or traditional space? It seems to appear at random throughout the content in my rich text fields.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2018-03-13T10:56:44.670" Title="Rich text field adding &amp;nbsp; and normal space char at random" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5231" PostTypeId="2" ParentId="5227" CreationDate="2014-12-11T22:11:17.813" Score="3" Body="&lt;p&gt;You're experiencing two different things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, as Johannes suggested, if you update to the latest version of the plugin (using the same url that you were sent for the private beta), the error in the control panel will be fixed.  This issue was introduced in Craft 2.3 and was resolved in Sprout Forms 0.8.3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, it sounds like you have some issues with Email Notifications.  Assuming you have all the Form Notification settings in place and functioning email, as it sounds like you do, we recently discovered a bug where email notifications are not sent if you are using ajax to submit your forms.  We have a fix we can send you, and it should be resolved once we have a chance to release that and a few other fixes in Sprout Forms 0.8.4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please send us a note if you have any more questions and we'll get you the updated file if you need it before we get those updates into the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ben&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-12-11T22:11:17.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5232" PostTypeId="1" AcceptedAnswerId="5237" CreationDate="2014-12-11T22:19:14.547" Score="2" ViewCount="584" Body="&lt;p&gt;So I have this example database config setup&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$customDbConfig = array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;&#xA;    'test1.foo.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'test1user',&#xA;        'password' =&amp;gt; '',&#xA;        'database' =&amp;gt; '',&#xA;    ),&#xA;&#xA;    'test2.foo.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'test2user',&#xA;        'password' =&amp;gt; '',&#xA;        'database' =&amp;gt; '',&#xA;    ),&#xA;&#xA;    'foo.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'produser',&#xA;        'password' =&amp;gt; '',&#xA;        'database' =&amp;gt; '',&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that when accessing test1.foo.com, the foo.com environment is being loaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the docs again&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When Craft is comparing your config keys with $_SERVER['SERVER_NAME'],&#xA;  it’s only looking for a partial match. So the environment key&#xA;  'example.com' will also work if you’re accessing your site via&#xA;  www.example.com or any other subdomain. You could even just use the&#xA;  TLD if you’re feeling adventurous:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What's the best way to get around this issue, where we want subdomains for dev and test, when they are subdomains of the production domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="13" LastActivityDate="2014-12-12T04:48:11.577" Title="Subdomain database configuration picking up root domain config" Tags="&lt;config&gt;&lt;database&gt;&lt;subdomain&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5233" PostTypeId="1" AcceptedAnswerId="5239" CreationDate="2014-12-11T22:52:09.797" Score="3" ViewCount="187" Body="&lt;p&gt;I'm rebuilding the main website for a small rural local council, and at this stage I am planning on using Craft. The main issue I have is around the management of several hundred PDF documents which fall into different categories (agendas, minutes, policies and a lot a paper-based forms). The current system uses Docman in Joomla, so I need to come up with something equal of better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage my thinking is to create channel entries for each document with a number of metadata fields which would include categories and possibly tags. Each document would be named with a date included to facilitate some level of revision history (requirement by law). I need to present the documents in various ways. Sometimes there will just be links on a webpage, and in other cases I would need to auto-generate an index (e.g. meeting minutes) for a category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, am I going in the right direction, or can someone point me down another road, or try and divert me away from Craft altogether if it is not yet suitable to do the job?  I realise I may not be asking the right sort of StackExchange question, so happy to take advice to make it specific enough to meet any criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(An alternative might be to see if I can extract some sort of feed from Sharepoint which the council uses as a basis for it's intranet. That would have to be a separate question though.)&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2014-12-12T04:54:35.010" Title="Management of large number of downloadable PDFs" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5234" PostTypeId="2" ParentId="4936" CreationDate="2014-12-11T23:12:29.650" Score="1" Body="&lt;p&gt;\Craft\BaseController extends \CController so if you want to have a custom constructor, you should accept the same parameters and call the parent constructor with them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @param string $id id of this controller&#xA; * @param CWebModule $module the module that this controller belongs to.&#xA; */&#xA;public function __construct($id, $module = null)&#xA;{&#xA;    parent::__construct($id, $module);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1068" LastActivityDate="2014-12-11T23:12:29.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5235" PostTypeId="2" ParentId="4634" CreationDate="2014-12-12T00:48:43.893" Score="2" Body="&lt;p&gt;For anyone who is interested - I did a quick mashup of the Craft and Laravel Homestead documentation to outline the process I went through for setting up my first Craft site locally on a Vagrant/Homestead box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to the guys over at Straight Up Craft for the video about Vagrant and Craft which introduced me to Homestead﻿&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/@mattcollins_6/setting-up-a-local-dev-environment-for-craft-cms-using-laravel-homestead-2724be3954a5&quot; rel=&quot;nofollow&quot;&gt;https://medium.com/@mattcollins_6/setting-up-a-local-dev-environment-for-craft-cms-using-laravel-homestead-2724be3954a5&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2014-12-12T00:48:43.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5236" PostTypeId="1" CreationDate="2014-12-12T04:20:37.140" Score="6" ViewCount="119" Body="&lt;p&gt;Just downloaded and am setting up Craft. Super excited! I would like to know the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I am assigning tags to entries in the hopes of using them as an organizational/navigation tool at some point in the future. My question is, how—if at all—can I create a list of tags that can be used IN ADVANCE? In other words, restrict the possible tags that can be assigned to now and future entries?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the admin can only choose/use: &quot;branding&quot;, &quot;design&quot;, and &quot;identity&quot;, for example. And not &quot;copywriting.&quot; Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="1093" LastActivityDate="2014-12-12T22:43:52.630" Title="How can I restrict tags that are able to be used?" Tags="&lt;entries&gt;&lt;tags&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5237" PostTypeId="2" ParentId="5232" CreationDate="2014-12-12T04:48:11.577" Score="0" Body="&lt;p&gt;As long as you have the more specific one at the top of your array like you do, it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like your using some custom (non-stock) Craft config logic judging from the &lt;code&gt;$customDbConfig&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens if you &lt;code&gt;echo $_SERVER['SERVER_NAME'];&lt;/code&gt; from the test1.foo.com domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's an exact match and it is still not selecting the right database, then I'd suspect your custom logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strip all of that out to just Craft's default multi-environment config and see if it works that way. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-12T04:48:11.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5238" PostTypeId="2" ParentId="5236" CreationDate="2014-12-12T04:53:38.273" Score="4" Body="&lt;p&gt;That’s not possible, as tags are meant to be more of a “&lt;a href=&quot;http://en.wikipedia.org/wiki/Folksonomy&quot; rel=&quot;nofollow&quot;&gt;folksonomy&lt;/a&gt;” rather than a strict taxonomy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds to me like &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;categories&lt;/a&gt; would be a better fit for your needs. With those, the options are defined in advance, and &lt;em&gt;chosen&lt;/em&gt; from the fields, rather than &lt;em&gt;created&lt;/em&gt; from the fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We just updated the &lt;a href=&quot;http://buildwithcraft.com/features/categories-and-tags&quot; rel=&quot;nofollow&quot;&gt;Categories and Tags&lt;/a&gt; feature page with a new video that may do a better job showing the difference between the two.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2014-12-12T22:43:52.630" LastActivityDate="2014-12-12T22:43:52.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5239" PostTypeId="2" ParentId="5233" CreationDate="2014-12-12T04:54:35.010" Score="5" Body="&lt;p&gt;I'm not familiar with Docman (or Joomla for that matter), but I think Craft is perfectly capable of doing what you're describing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your strategy of creating an entry per PDF seems reasonable.  Entries get custom fields (of course) and revisions and you can use Entry Types to display them in the various formats that you require.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-12T04:54:35.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5240" PostTypeId="2" ParentId="5224" CreationDate="2014-12-12T13:46:27.167" Score="1" Body="&lt;p&gt;I'm generally including the email in the message body in every project by tweaking the plugin like so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open controllers/ContactFormController.php and look for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$compiledMessage = '';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then, below it, add something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$compiledMessage .= &quot;Please reply to: &quot;;&#xA;$compiledMessage .= $message-&amp;gt;fromEmail;&#xA;$compiledMessage .= &quot;\n\n&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-12-12T13:46:27.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5242" PostTypeId="1" AcceptedAnswerId="5245" CreationDate="2014-12-12T21:16:33.147" Score="1" ViewCount="1097" Body="&lt;p&gt;Is it possible to set up a 404 page, and after x amount of time redirecting to the homepage?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout/_layout&quot; %}&#xA;&#xA;&#xA;{% set metaTitle = &quot;404&quot; %}&#xA;&#xA;&#xA;{% set bodyId           = &quot;404&quot; %}&#xA;{% set bodyClass        = &quot;404&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;section class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;Page not found&amp;lt;/h1&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;What’s worse, a hilarious 404 page can’t be found either.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;!--404 Tracking Google--&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;// &amp;lt;![CDATA[&#xA;    if (document.title.search(/404/i) !== -1) {&#xA;    _gaq.push(['_trackEvent', 'Error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer,,true]);&#xA;     }; &#xA;    // ]]&amp;gt;&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-11-24T15:38:34.900" Title="404 page redirect to homepage" Tags="&lt;redirect&gt;&lt;404&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5243" PostTypeId="1" CreationDate="2014-12-12T21:41:11.430" Score="3" ViewCount="418" Body="&lt;p&gt;I'd like to know if it is possible to have Craft unzip a .zip file that authenticated users have uploaded through the CP. The idea is that the users will prepare several static html, javascript, css and image files -- rather than having them upload them all individually, I'd like to let them zip them, and upload a single file instead, and then use Craft to unzip them in place them in an appropriate spot. I've got the upload figured out - I'm just not sure how to move ahead with the unzip, or if it's even possible.&lt;/p&gt;&#xA;" OwnerUserId="966" LastActivityDate="2014-12-14T00:46:28.303" Title="Unzip zipped file after upload" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5244" PostTypeId="1" CreationDate="2014-12-12T23:55:21.747" Score="1" ViewCount="182" Body="&lt;p&gt;I have public user registration enabled with the &quot;Verify email addresses&quot; setting checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User registration form includes these &quot;action&quot; and &quot;redirect&quot; hidden fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;signup/payment/{id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;User's ID is coming through correctly in the last segment of the URL, but I can't fetch their profile. This is throwing a template error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userId = craft.request.lastSegment() %}&#xA;{% set profile = craft.users.id(userId) | first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I hardcode an existing Active user's ID it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profile = craft.users.id(30) | first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to access a Pending member's (albeit limited) profile info? What I really need to do is insert their email address into a subsequent form on the success page.&lt;/p&gt;&#xA;" OwnerUserId="1097" LastActivityDate="2015-06-01T19:52:34.133" Title="Can't access Pending user's profile info" Tags="&lt;users&gt;&lt;registration&gt;&lt;status&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5245" PostTypeId="2" ParentId="5242" CreationDate="2014-12-13T00:00:27.687" Score="2" Body="&lt;p&gt;You could always use a meta refresh&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;refresh&quot; content=&quot;5; url=http://example.com/&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the number being the amount of time in seconds until the redirect&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-11-24T15:38:34.900" LastActivityDate="2015-11-24T15:38:34.900" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5246" PostTypeId="1" CreationDate="2014-12-13T00:14:32.270" Score="0" ViewCount="78" Body="&lt;p&gt;I'm running Craft 2.3.2620 and installed the Redactor table plugin to &lt;code&gt;/craft/app/resources/lib/redactor/plugins&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is my json:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','table','video'],&#xA;    plugins: ['fullscreen','table','video'],&#xA;    toolbarFixedBox: true,&#xA;    paragraphize: false,&#xA;    linebreaks: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the table button is not showing up. The video and fullscreen plugins are working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug - or is Craft's redactor implementation not compatible with their table plugin?&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="250" LastEditDate="2014-12-14T20:15:59.973" LastActivityDate="2014-12-14T20:15:59.973" Title="Redactor table plugin broken in Craft 2.3.2620?" Tags="&lt;redactor&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2014-12-14T21:45:36.520" ContentLicense="CC BY-SA 3.0" />
  <row Id="5247" PostTypeId="2" ParentId="5243" CreationDate="2014-12-13T00:14:57.757" Score="3" Body="&lt;p&gt;I'm 99% sure the answer is &lt;strong&gt;yes, that's doable&lt;/strong&gt;, although you'd need a custom plugin to handle the bulk of it. You'd need to write some PHP to handle the unzip, and place the files where you want them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to create a plugin with a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controller&lt;/a&gt; to handle the file upload &amp;amp; unzip.  You can use Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/io/Zip#compress-detail&quot; rel=&quot;nofollow&quot;&gt;Zip::compress()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/io/Zip#unzip-detail&quot; rel=&quot;nofollow&quot;&gt;Zip::unzip()&lt;/a&gt; methods to help. Your form will be able to POST directly to that controller.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2014-12-14T00:46:28.303" LastActivityDate="2014-12-14T00:46:28.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5248" PostTypeId="1" CreationDate="2014-12-13T07:51:24.603" Score="1" ViewCount="540" Body="&lt;p&gt;I'm showing entries on a page. Depending on the value of the field &lt;code&gt;postAspectRatio&lt;/code&gt;, I would like the layout of this shown entry to change just slightly and thus requiring it's own unique markup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to do this using what I know about twig IF syntax but it's not working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;{% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}&#xA;&#xA;        {% if entry.postAspectRatio == 'Portrait' %}&#xA;&#xA;        &amp;lt;div class=&quot;title portrait&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;&amp;lt;span&amp;gt;{{ entry.studio }}&amp;lt;/span&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;        {% if entry.postAspectRatio == 'Landscape' %}&#xA;&#xA;        &amp;lt;div class=&quot;title landscape&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;&amp;lt;span&amp;gt;{{ entry.studio }}&amp;lt;/span&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1078" LastActivityDate="2014-12-15T00:19:52.973" Title="How to show entries with IF statement based on field" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5249" PostTypeId="1" CreationDate="2014-12-13T08:53:04.500" Score="3" ViewCount="462" Body="&lt;p&gt;I've got a local db and install of Craft as well as a remote. I'm pushing to bitbucket from my local Mamp environment then pulling from bitbucket to my server via ssh. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently updated Craft by clicking the prompt inside the dashboard. When I did this, it editing nearly every file in &lt;code&gt;/craft/app&lt;/code&gt; leaving a ton of modified files registered in git. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should have had craft/app in my &lt;code&gt;.gitignore&lt;/code&gt; file but I didn't. Now when I try to pull I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error: Your local changes to 'craft/app/Info.php' would be overwritten by merge.  Aborting.&#xA;Please, commit your changes or stash them before you can merge.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I force my remote build to ignore everything in craft/app so I can get back to pushing/pulling. &lt;/p&gt;&#xA;" OwnerUserId="1078" LastEditorUserId="784" LastEditDate="2014-12-14T17:15:35.233" LastActivityDate="2014-12-14T17:15:35.233" Title="Updating Craft cause broken git and merge conflict" Tags="&lt;auto-updates&gt;&lt;deployment&gt;&lt;git&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5250" PostTypeId="2" ParentId="5249" CreationDate="2014-12-13T20:35:57.077" Score="5" Body="&lt;p&gt;The error that you are seeing is because you have changes in your local repo that need to be saved (&lt;code&gt;committed&lt;/code&gt;) first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also a huge Git user and wanted to touch on a few items in your question.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;code&gt;craft/app&lt;/code&gt; folder should always be in your Git repository as its the foundation of making your site run Craft.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to see an example Craft Git project, you can take a look at this repository: &lt;a href=&quot;https://github.com/themccallister/craft-foundation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/themccallister/craft-foundation&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The only directories that should be ignored are &lt;code&gt;storage&lt;/code&gt; (make sure you keep the actually directory using this trick: &lt;a href=&quot;https://stackoverflow.com/questions/115983/add-empty-directory-to-git-repository&quot;&gt;https://stackoverflow.com/questions/115983/add-empty-directory-to-git-repository&lt;/a&gt;) and any directories in &lt;code&gt;public&lt;/code&gt; that will contain user uploaded files (i.e &lt;code&gt;public/images/uploads&lt;/code&gt;). This will ensure that the directory contents are not overwritten during deployment, ensuring that backups, sessions and user content will remain after the deploy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As far as your remote build... The typical workflow for Git should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Download and update Craft locally&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;Commit&lt;/code&gt; your changes to your local environment (should mostly be updates in the &lt;code&gt;craft/app&lt;/code&gt; directory)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;Push&lt;/code&gt; your changes to your remote repository (typically referred to as &lt;code&gt;origin&lt;/code&gt; or &lt;code&gt;upstream&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;Deploy&lt;/code&gt; the update.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you are building using a tool like (&lt;a href=&quot;http://dploy.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dploy.io&lt;/a&gt;) you can login and push the changes to your environment. If you are SSHing into the server and running &lt;code&gt;git pull origin&lt;/code&gt; that would work as well.&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2014-12-13T20:35:57.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5251" PostTypeId="1" AcceptedAnswerId="5253" CreationDate="2014-12-14T01:25:00.150" Score="5" ViewCount="629" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uDqhK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few tabs in my &quot;Field Layout Design&quot;, and I wondered if there was a way to list the titles of each one, in the frontend? Something basic like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;Services&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;Testimonials&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;Gallery&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="45" LastEditDate="2018-08-20T21:40:21.073" LastActivityDate="2020-09-16T14:44:25.260" Title="List out all &quot;Layout Tabs&quot; in the frontend" Tags="&lt;field-layout-designer&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5252" PostTypeId="1" AcceptedAnswerId="5254" CreationDate="2014-12-14T16:21:55.990" Score="1" ViewCount="1628" Body="&lt;p&gt;I have a page that shows all photos in a category, which is set by the last url segment  and then the results re paginated. What i'm trying to do is say that if the last segment is 'all' then show all photos from all categories. So i'm trying the following code, but getting an error and i cannot see why!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryName = craft.request.lastSegment %}&#xA;{% if categoryName == 'all' %}&#xA;    {% paginate craft.entries.section('photo').limit(6) as entries %}&#xA;{% else %}&#xA;{% set category = craft.categories.slug(categoryName) %}&#xA;    {% paginate craft.entries.section('photo').relatedTo(category).limit(6) as entries %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Unexpected tag name &quot;else&quot; (expecting closing tag for the &quot;paginate&quot; tag defined near line 12)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Line 12 is {% else %}, btw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the endPaginate code further down the page after the pagination html, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;button small expand radius&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {% if paginate.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;button small expand radius&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2014-12-14T17:27:25.467" LastActivityDate="2014-12-14T21:55:51.107" Title="Error when using if statement in template" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5253" PostTypeId="2" ParentId="5251" CreationDate="2014-12-14T16:26:45.113" Score="6" Body="&lt;p&gt;Assuming you have an 'entry', this should work:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for tab in entry.getFieldLayout().getTabs() %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;{{ tab.name }}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for field in tab.getFields() %}&#xA;                    &amp;lt;li&amp;gt;{{ field.name }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;if you don't need the fields then just:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for tab in entry.getFieldLayout.getTabs() %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;{{ tab.name }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2020-09-16T14:44:25.260" LastActivityDate="2020-09-16T14:44:25.260" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5254" PostTypeId="2" ParentId="5252" CreationDate="2014-12-14T16:33:07.217" Score="3" Body="&lt;p&gt;It is expecting an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#showing-the-elements&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% endpaginate %}&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set categoryName = craft.request.lastSegment %}&#xA;{% if categoryName == 'all' %}&#xA;    {% paginate craft.entries.section('photo').limit(6) as entries %}&#xA;    ...&#xA;    &lt;b&gt;&lt;i&gt;{% endpaginate %}&lt;/i&gt;&lt;/b&gt;&#xA;{% else %}&#xA;    {% set category = craft.categories.slug(categoryName) %}&#xA;    {% paginate craft.entries.section('photo').relatedTo(category).limit(6) as entries %}&#xA;    ...&#xA;    &lt;b&gt;&lt;i&gt;{% endpaginate %}&lt;/i&gt;&lt;/b&gt;&#xA;{% endif %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update: if you want to define the paginate block separately to keep your code dry you can assign the element criteria model to a variable first. See carlcs' answer above/below for another way to do the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set categoryName = craft.request.lastSegment %}&#xA;{% if categoryName == 'all' %}&#xA;    {% set ecm = craft.entries.section('photo').limit(6) %}&#xA;{% else %}&#xA;    {% set category = craft.categories.slug(categoryName) %}&#xA;    {% set ecm = craft.entries.section('photo').relatedTo(category).limit(6) %}&#xA;{% endif %}&#xA;&#xA;{% paginate ecm as entries %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-14T21:55:51.107" LastActivityDate="2014-12-14T21:55:51.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5255" PostTypeId="2" ParentId="5252" CreationDate="2014-12-14T18:04:28.023" Score="2" Body="&lt;p&gt;Including an &lt;code&gt;{% endpaginate %}&lt;/code&gt; within your if / else statements, like Douglas mentioned should work. If you don't want to repeat the whole code, you could only set the parameters with the conditionals like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: photo,&#xA;    limit: 6&#xA;} %}&#xA;&#xA;{% set categoryName = craft.request.lastSegment %}&#xA;&#xA;{% if categoryName != 'all' %}&#xA;    {% set category = craft.categories.slug(categoryName) %}&#xA;    {% set params = params|merge({ relatedTo: category }) %}&#xA;{% endif %}&#xA;&#xA;{% paginate craft.entries(params) as entries %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-14T18:04:28.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5256" PostTypeId="2" ParentId="5248" CreationDate="2014-12-15T00:19:52.973" Score="1" Body="&lt;p&gt;Your &lt;code&gt;if&lt;/code&gt; statements looks correct. You might check that you are testing the value vs. the name (i.e. 'Portrait' vs 'portrait') or printing out the value (using &lt;code&gt;{{ entry.postAspectRatio }}&lt;/code&gt;) so you can see the output. Also, a 'dryer' way to write this might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;    {% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}&#xA;&#xA;        &amp;lt;div class=&quot;title {{ entry.postAspectRatio|lower }}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;&amp;lt;span&amp;gt;{{ entry.studio }}&amp;lt;/span&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-15T00:19:52.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5257" PostTypeId="2" ParentId="5209" CreationDate="2014-12-15T00:40:15.713" Score="3" Body="&lt;p&gt;I haven't tried this in php, but on the 'template' side there is an attribute called 'status' which you might try. I assume it would work in php as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existing = craft()-&amp;gt;elements-&amp;gt;getCriteria($this-&amp;gt;entry-&amp;gt;elementType)-&amp;gt;first(array(&#xA;    'someHandle' =&amp;gt; 'someValue', &#xA;    'status' =&amp;gt; null&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Default is 'live'; other values would be 'live', 'pending', 'expired', 'disabled', and null. Here's the docs for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#status&quot; rel=&quot;nofollow&quot;&gt;craft.entries.status&lt;/a&gt;. Let us know if it works.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-15T00:40:15.713" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5258" PostTypeId="2" ParentId="4718" CreationDate="2014-12-15T00:55:13.810" Score="2" Body="&lt;p&gt;You can just test if image is defined first using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.image.first() %}&#xA;{% if image %}&#xA;    &amp;lt;a href=&quot;{{ image.getUrl() }}&quot;&amp;gt;...&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2017-07-23T17:06:24.697" LastActivityDate="2017-07-23T17:06:24.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5259" PostTypeId="2" ParentId="4689" CreationDate="2014-12-15T01:03:16.710" Score="2" Body="&lt;p&gt;There is no predefined 'index' page for channels. Channels are simply a collection of entries. If you want an index page then you will need to create it: either as a &lt;code&gt;single&lt;/code&gt;, as an entry within another &lt;code&gt;structure&lt;/code&gt;, or as a stand alone template in your templates directory (i.e. &lt;code&gt;craft/templates/news/index.html&lt;/code&gt; or &lt;code&gt;craft/templates/news.html&lt;/code&gt;). In any case, the url (or uri) is going to be whatever you have defined it as. (i.e. mysite.com/news/). See craft's &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing documentation&lt;/a&gt; for more info on how requests are routed.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-15T01:03:16.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5260" PostTypeId="1" AcceptedAnswerId="5263" CreationDate="2014-12-15T01:57:12.007" Score="3" ViewCount="243" Body="&lt;p&gt;I have a problem which may be very simple to solve, but I just can't get my head around it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to do an alternative landing page if an image has been uploaded to the 'homepage' single entry by the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This part is straightforward as I could just test if the image was there and if so enable a different piece of html from the normal index page of the site, this would function as my main entry page then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I see is once a user clicks the homepage takeover they should be redirected to the normal index page. It seems that this will trigger the same bit of code again and will show the takeover page again though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am probably over-thinking this one but is there a way to show the homepage takeover once and then if the user clicks through or selects the homepage from the nave it won't trigger the takeover to be shown again?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on this would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="650" LastActivityDate="2014-12-15T08:23:40.953" Title="Homepage Takeover" Tags="&lt;url&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5261" PostTypeId="1" CreationDate="2014-12-15T06:51:12.717" Score="1" ViewCount="85" Body="&lt;p&gt;I'm trying to retrieve the data from the database and return it to JSON so that I can access the data in jquery...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;" OwnerUserId="1099" LastActivityDate="2014-12-15T06:51:12.717" Title="How to retrieve a data from a custom table to JSON?" Tags="&lt;json&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2014-12-15T16:47:20.373" ContentLicense="CC BY-SA 3.0" />
  <row Id="5262" PostTypeId="2" ParentId="5260" CreationDate="2014-12-15T07:52:47.953" Score="4" Body="&lt;p&gt;There are a few ways I can think to do this. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create separate 'index.html' and 'home.html' templates.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;'index.html' would have a conditional to display the takeover based on your field value, whereas 'home.html' would not. Both however could make use of the same content using &lt;code&gt;{% include '/home.html' %}&lt;/code&gt; within 'index.html'. The nav would then link to '/home' rather than '/'.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set up a custom route and test for the uri segment.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you want to use the same template you could also set a custom route so that '/home' points to your 'index.html' template, and then test for the uri segment using &lt;code&gt;{% if craft.request.getLastSegment() == 'home' %}... {% endif %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pass a variable to the 'index.html' template when linking via nav&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you pass a variable to your index page when accessed it through the primary nav (i.e. &lt;code&gt;/index.html?t=1&lt;/code&gt;), you can then test for the variable using &lt;code&gt;{% if craft.request.getParam('t') %}... {% endif %}&lt;/code&gt;. If the variable exists then don't display the takeover. Not a very pretty URI though.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Write a small plugin to set a cookie.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You could also write a small plugin, with a variables file that sets a cookie: (not tested)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre&gt;&#xA;class MyPluginVariable&#xA;{&#xA;    public function setTakeoverTimeout()&#xA;    {&#xA;        $cookie = new HttpCookie('takeoverViewed', true);&#xA;        $cookie-&gt;expire = time() + 3600;&#xA;        craft()-&gt;request-&gt;getCookies()-&gt;add($cookie-&gt;name, $cookie);&#xA;    }&#xA;}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in your template file test for (and set) the cookie using,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% if not craft.request.getCookie('takeoverViewed') %}&#xA;    {{ setTakeoverTimeout }}&#xA;    display takeover content here&#xA;{% endif %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another cookie example can be seen &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4583/best-way-to-use-savecookie-and-craft-request-getcookielocation/4585#4585&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-12-15T08:05:50.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5263" PostTypeId="2" ParentId="5260" CreationDate="2014-12-15T08:03:52.273" Score="4" Body="&lt;p&gt;There's this nice little plugin &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow&quot;&gt;&quot;LJ Cookies&quot;&lt;/a&gt; that allows you to set and retrieve cookies from your template. So you don't need to write your own plugin for this. Just install the plugin and use code like this on your landing page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Retrieve the cookie's value #}&#xA;{% set visited = craft.lj_cookies.get('visited') %}&#xA;&#xA;{# Don't show spezial HTML if user visited this page before #}&#xA;{% if visited != 1 %}&#xA;    &amp;lt;h1&amp;gt;Hello stranger!&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Set a cookie on the user's first visit #}&#xA;{% do craft.lj_cookies.set('visited', '1', '', '/') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-15T08:23:40.953" LastActivityDate="2014-12-15T08:23:40.953" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5264" PostTypeId="2" ParentId="5218" CreationDate="2014-12-15T08:28:53.560" Score="5" Body="&lt;p&gt;I got the official answer from Brandon, here is the summary for anyone that might be in a similar situation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do what I need with only one pro license&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the main portal (acme.com) will run the &quot;en&quot; locale&lt;/li&gt;&#xA;&lt;li&gt;additional domains will use different locales (en-uk for UK, etc.)&lt;/li&gt;&#xA;&lt;li&gt;this will work even better in Craft 3.0 - there will be a support for &quot;portal&quot; and separate locales&lt;/li&gt;&#xA;&lt;li&gt;each domain can have its own URL, templates and content&lt;/li&gt;&#xA;&lt;li&gt;I will need to access all administration from a single domain (content editors in another country will have to use acme.com for editing their acmelocal.co.uk)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I will develop on a separate domain first (acme.com is currently live with old site), but I can &lt;a href=&quot;http://buildwithcraft.com/help/license-transferring&quot; rel=&quot;noreferrer&quot;&gt;transfer&lt;/a&gt; the license easily to acme.com when site is finished.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use any local domain for development with this license - more detail &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;noreferrer&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Brandon!&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2014-12-15T08:28:53.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5265" PostTypeId="1" AcceptedAnswerId="5266" CreationDate="2014-12-15T09:40:34.070" Score="1" ViewCount="1015" Body="&lt;p&gt;How do you enable a user to upload a css background Image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you write some inline css in the page header with twig markup?&#xA;Do you write some twig markup inside a css file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do you fake a background image by add an image and then position it absolute?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best practice there?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2014-12-15T11:13:16.257" Title="Enable the user to upload background Image" Tags="&lt;best-practice&gt;&lt;css&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5266" PostTypeId="2" ParentId="5265" CreationDate="2014-12-15T11:13:16.257" Score="4" Body="&lt;p&gt;You can simply add it inline to your &lt;code&gt;body&lt;/code&gt; tag like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body style=&quot;background-image: url({{ myGlobal.myAssetsField.first().url }})&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to only use it with selected templates, you'd better use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includecss&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeCss&lt;/code&gt;&lt;/a&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyCss %}&#xA;    .myBodyClass {&#xA;        background-image: url({{ myGlobal.myAssetsField.first().url }});&#xA;    }&#xA;{% endset %}&#xA;&#xA;{% includeCss bodyCss %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-15T11:13:16.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5267" PostTypeId="2" ParentId="5217" CreationDate="2014-12-15T12:14:52.067" Score="9" Body="&lt;h3&gt;You could do it in the twig template&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;But a template isn't really the best place for something that is this codey, it gets pretty unreadable pretty quick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I start by building arrays of models and afterwards I convert those arrays to the comma seperated strings you require.&lt;/li&gt;&#xA;&lt;li&gt;It is case-sensitive, you probably have models or makes likes HILUX, hilux, Hilux, these sort of duplicates will not be removed. You can achieve a modicum of case-insensitivity by chucking a few &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/lower.html&quot;&gt;lowers&lt;/a&gt; in there.&lt;/li&gt;&#xA;&lt;li&gt;Instead of hand-writing the json, this uses &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/json_encode.html&quot;&gt;twig's json_encode filter&lt;/a&gt;, tweak the options to suit you.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set makes = craft.entries.section(['usedCars','vansTrucks']).level(2) %}&#xA;{% set data = {} %}&#xA;&#xA;{% for make in makes %}&#xA;    {% set make_name = make.make %}&#xA;&#xA;    {# Get the list of models for this make if we have already seen it before, otherwise an empty array #}&#xA;    {% if data[make_name] is not defined %}&#xA;        {% set data = data|merge({(make_name):[]})%}&#xA;    {% endif %}&#xA;    {% set make_data = data[make_name] %}&#xA;&#xA;    {# Build an array of model names #}&#xA;    {% set models = make.getChildren() %}&#xA;    {% for model in models %}&#xA;        {% set model_name = model.model %}&#xA;&#xA;        {# Only add this model if we have not seen it before #}&#xA;        {% if model_name not in make_data %}&#xA;            {% set make_data = make_data|merge([model_name]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% set data = data|merge({(make_name):make_data}) %}&#xA;{% endfor %}&#xA;&#xA;{# Replace the arrays of models we previously built with a comma seperated string of models #}&#xA;{% for make_name, models in data %}&#xA;    {% set models_string = models|join(&quot;,&quot;) %}&#xA;    {% set data = data|merge({(make_name):models_string}) %}&#xA;{% endfor %}&#xA;&#xA;{{ data|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Or do it with code&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Add your own plugin as per the instructions here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot;&gt;Setting things up&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a template variable as per the instructions here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;Template variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your template variable could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyAwesomePluginVariable&#xA;{&#xA;    public function getSearchData()&#xA;    {&#xA;        // find all makes&#xA;        $make_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $make_criteria-&amp;gt;level = 2;&#xA;        $make_criteria-&amp;gt;section = array('usedCars','vansTrucks');&#xA;&#xA;        $data = array();&#xA;&#xA;        $makes = $make_criteria-&amp;gt;find();&#xA;        foreach ($makes as $make) &#xA;        {&#xA;            // build array of models for this make&#xA;            $model_names = array();&#xA;            $models = $make-&amp;gt;getChildren();&#xA;            foreach ($models as $model) {&#xA;                $model_names[]= $model-&amp;gt;model;&#xA;            }&#xA;&#xA;            // combine with previous models for this make and remove duplicates&#xA;            if (array_key_exists($make-&amp;gt;make, $data)) {&#xA;                $data[$make-&amp;gt;make] = array_unique( array_merge($data[$make-&amp;gt;make], $model_names) );&#xA;            } else {&#xA;                $data[$make-&amp;gt;make] = array_unique( $model_names );&#xA;            }&#xA;        }&#xA;&#xA;        // convert model arrays to comma separated strings&#xA;        foreach ($data as $make =&amp;gt; $models) {&#xA;            $data[$make] = implode(&quot;,&quot;, $models);&#xA;        }&#xA;&#xA;        return $data;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myAwesomePlugin.getSearchData|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1100" LastActivityDate="2014-12-15T12:14:52.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5268" PostTypeId="1" CreationDate="2014-12-15T16:05:31.733" Score="3" ViewCount="179" Body="&lt;p&gt;We're building our first project in Craft. It requires an area for users to submit events to the site, and the submissions will wait in an approval queue. We do not want these users to have access to the craft backend. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also we are using Rackspace cloud hosting for images, and we would need the users to be able to submit their own photos to the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are their any mechanisms in place in craft that we could leverage to keep plugin development to a minimum? I understand this is a broad question, but being our first Craft project I'm sure it has a lot of functionality we are not aware of and it would be a shame to recreate it just because we were unaware. &lt;/p&gt;&#xA;" OwnerUserId="1101" LastActivityDate="2018-03-21T19:44:30.393" Title="Building an area for users to add content for Craft site" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;password&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5269" PostTypeId="1" AcceptedAnswerId="5271" CreationDate="2014-12-15T16:13:33.827" Score="2" ViewCount="900" Body="&lt;p&gt;I'm not entirely well versed in how Redis works, but I have an idea that it probably makes the most sense to have the 3 craft sites I have running on the same server, have 3 different redis databases assigned to each?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do so, like in &lt;code&gt;general.php&lt;/code&gt; or &lt;code&gt;db.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;site-one.com&quot; =&amp;gt; {&#xA;    'database' =&amp;gt; 0,&#xA;},&#xA;&#xA;&quot;site-two.com&quot; =&amp;gt; {&#xA;    'database =&amp;gt; 1,&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastEditorUserId="3951" LastEditDate="2018-03-29T19:47:49.073" LastActivityDate="2018-03-29T19:47:49.073" Title="Redis Enviornment Specific DB's" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5270" PostTypeId="2" ParentId="5268" CreationDate="2014-12-15T16:34:00.880" Score="3" Body="&lt;p&gt;Welcome to Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For starters, I would definitely recommend checking out the Pixel and Tonic &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin, brought to you by the guys who built the CMS. As the title suggests, it allows users to create entries from a custom form on the website front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, from your example, you can have an 'Events' channel and allows users to create entries (events) using the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These entries can then be moderated like any normal entry.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2014-12-15T16:34:00.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5271" PostTypeId="2" ParentId="5269" CreationDate="2014-12-15T17:00:25.747" Score="2" Body="&lt;p&gt;You'll want to set your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting to 'redis' and create a &lt;code&gt;rediscache.php&lt;/code&gt; file in &lt;code&gt;craft/config/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That config file is multi-environment aware, just like the other files in &lt;code&gt;craft/config/&lt;/code&gt; and you can see the default settings for Redis in &lt;code&gt;craft/app/etc/config/defaults/rediscache.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-15T17:00:25.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5272" PostTypeId="1" AcceptedAnswerId="5284" CreationDate="2014-12-15T18:52:35.483" Score="5" ViewCount="4712" Body="&lt;p&gt;I have tried everything to install Craft on my server, and I have not been able to do it. I have done this a few times before without any issues, but since version 2.3 was released, I can't access the admin panel to start the installation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have followed all the steps in the &lt;a href=&quot;http://buildwithcraft.com/docs/installing&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt;, I have created new DB, new domains.... nothing! I get a 500 error every time I want to access the admin area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/12/15 19:21:19 [error] [exception.Craft\HttpException.404] exception     'Craft\HttpException' in       /home/content/33/10789233/html/links/craft/app/etc/web/WebApp.php:737&#xA;Stack trace:&#xA;#0 /home/content/33/10789233/html/links/craft/app/etc/web/WebApp.php(176): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /home/content/33/10789233/html/links/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /home/content/33/10789233/html/links/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /home/content/33/10789233/html/links/public/index.php(19):      require_once('/home/content/3...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;2014/12/15 19:21:19 [error] [application] &#xA;2014/12/15 19:21:21 [error] [application] Unable to determine if a script name         redirect is in place on the server: Server error response&#xA;[status code] 500&#xA;[reason phrase] Internal Server Error&#xA;[url] http://website.com/testScriptNameRedirect&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="979" LastEditorUserId="979" LastEditDate="2014-12-15T19:28:10.763" LastActivityDate="2018-08-18T18:33:45.433" Title="500 error on installation since version 2.3" Tags="&lt;error-message&gt;&lt;admin&gt;&lt;installation&gt;" AnswerCount="4" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5273" PostTypeId="1" CreationDate="2014-12-15T19:49:03.117" Score="3" ViewCount="443" Body="&lt;p&gt;I am looking for away to manipulate and record data about an entry before it is returned to the client. I could do this with AJAX after the page is rendered by the browser but I would prefer to do this on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an event or hook I can use to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-12-16T09:24:25.333" Title="onBeforeRender event? Is there an event or hook I can use with my plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5274" PostTypeId="2" ParentId="827" CreationDate="2014-12-15T20:50:58.680" Score="3" Body="&lt;p&gt;I've also seen this triggered by directory/file permission issues, namely that Craft didn't have write access to the image asset directory. Once I fixed the permissions with chmod, my specific problem was solved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chmod 777 -R images&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="966" LastActivityDate="2014-12-15T20:50:58.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5275" PostTypeId="2" ParentId="5273" CreationDate="2014-12-15T22:22:48.287" Score="1" Body="&lt;p&gt;The full list of events that Craft provides is documented &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There currently isn't &lt;code&gt;onBeforeRender&lt;/code&gt; or &lt;code&gt;onRender&lt;/code&gt; events, but it is on our list with no particular ETA.  It gets tricky because it's difficult to distinguish between the main template and any other template that might happen to call &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#render-detail&quot; rel=&quot;nofollow&quot;&gt;TemplateService-&gt;render()&lt;/a&gt; (includes, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-15T23:41:09.160" LastActivityDate="2014-12-15T23:41:09.160" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5277" PostTypeId="2" ParentId="5273" CreationDate="2014-12-16T00:07:37.667" Score="0" Body="&lt;p&gt;Based off the recommendations I am going to use the onLoadPlugins event. I can limit its execution of business logic based on the URL construct. At least until I get a better solution. This should work but assumes that the onLoadPlugins event fires with each page request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code that appears to be working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() &#xA;{&#xA;    craft()-&amp;gt;on('plugins.onLoadPlugins', function(Event $event) {&#xA;       $pageUrl = craft()-&amp;gt;request-&amp;gt;getSegments(); &#xA;       if ( $pageUrl[0] != 'page' ) {&#xA;            // if not /page then exit here&#xA;            return;&#xA;       }&#xA;&#xA;       // place business logic here&#xA;       echo &quot;you're in;&#xA;       exit;&#xA;&#xA;    });&#xA; }   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastEditorUserId="603" LastEditDate="2014-12-16T09:24:25.333" LastActivityDate="2014-12-16T09:24:25.333" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5280" PostTypeId="1" AcceptedAnswerId="5288" CreationDate="2014-12-16T09:32:34.087" Score="2" ViewCount="885" Body="&lt;p&gt;When you create a structure section you set which template that you would like to use. Is there a way to override that for a single entry in that structure? If I have missed it in the docs I apologise but it would appear that setting a &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;route&lt;/a&gt; would not work due to the order things are looked up at.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2014-12-16T16:26:18.583" Title="Overriding a structure section's template for a single structure entry" Tags="&lt;structure&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5281" PostTypeId="2" ParentId="5280" CreationDate="2014-12-16T09:55:15.637" Score="1" Body="&lt;p&gt;You could use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; to load different templates conditionally like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id == '24' %}&#xA;    {% include &quot;_entries/mystructure_special&quot; %}&#xA;{% else %}&#xA;    {% include &quot;_entries/mystructure_base&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also consider if it makes sense to add a new &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;Entry Type&lt;/a&gt; for this one entry and then set things up per this tutorial: &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;&quot;How can I give each Entry Type its own template?&quot;&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-16T09:55:15.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5282" PostTypeId="2" ParentId="1153" CreationDate="2014-12-16T10:22:08.157" Score="1" Body="&lt;p&gt;Try something like this. Remember to check the status. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;slug = $slug;&#xA;$criteria-&amp;gt;status = NULL;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2014-12-16T10:22:08.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5284" PostTypeId="2" ParentId="5272" CreationDate="2014-12-16T12:33:39.357" Score="14" Body="&lt;p&gt;I might be shooting in the sky, but make sure that in your in your .htaccess you have&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;RewriteBase /&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;after&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;RewriteEngine On&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2014-12-16T12:33:39.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5285" PostTypeId="2" ParentId="1153" CreationDate="2014-12-16T12:35:46.773" Score="10" Body="&lt;p&gt;As per the (new) &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot;&gt;&quot;Working with Elements&quot;&lt;/a&gt; guide from the docs, it works the same as from your templates.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The actual list of available parameters depends on the element type. They are identical to the parameters available to your templates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this template example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.entries.section('news').myPlaintextField('xyz').myLightswitchField(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works from your plugin like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section            = 'news';&#xA;$criteria-&amp;gt;myPlaintextField   = 'xyz';&#xA;$criteria-&amp;gt;myLightswitchField = 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using custom field parameters is a fast and reliable solution if you are looking for EXACT matches. I would only use the &lt;code&gt;search&lt;/code&gt; parameter if there's no other solution.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-16T12:35:46.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5286" PostTypeId="1" AcceptedAnswerId="5295" CreationDate="2014-12-16T15:31:41.597" Score="3" ViewCount="3135" Body="&lt;p&gt;I'm trying to get the content of a single using a slug from the url.&#xA;I'm using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set item = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work, returns null, if there is a dash in segment 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have the following url: &lt;a href=&quot;http://craft.dev/this-is-a-segment/segment2&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev/this-is-a-segment/segment2&lt;/a&gt; &#xA;And in craftcms I have a single with title &quot;This is a segment&quot; and url &quot;this-is-a-segment&quot;&#xA;I can't get the content of that single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the slug to camelcase it does work, but I was under the impression that slug and section handle were two different things...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-12-16T22:32:50.250" Title="Get content of single by slug" Tags="&lt;entries&gt;&lt;slug&gt;&lt;singles&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5287" PostTypeId="1" CreationDate="2014-12-16T16:11:08.540" Score="5" ViewCount="598" Body="&lt;p&gt;For a specific entry in a specific section I would like to eager load all associated data from the related elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say that I know the related elements are from the following field types:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An assets field&lt;/li&gt;&#xA;&lt;li&gt;An entries field&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And I know the field handles or IDs. This isn't supposed to be a &quot;catch all&quot; solution, it can be on a case by case basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to eagerly load all of these elements (including their relationships should they have some, i.e., the related entries have related images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about this in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can write a hook or a custom controller action, I'm more curious about how I'd setup the calls themselves. I can't use Yii's &lt;code&gt;with&lt;/code&gt; for Active Record because that isn't setup in the entry record itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;, this is similar to the following question, but more direct:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4176/eager-loading-of-relations-like-yiis-with-function&quot;&gt;&amp;quot;Eager loading&amp;quot; of relations like Yii&amp;#39;s &amp;quot;with&amp;quot; function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-05-03T11:35:25.200" Title="Is there a good way to eager load Craft's Element Relations through a plugin?" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5288" PostTypeId="2" ParentId="5280" CreationDate="2014-12-16T16:26:18.583" Score="3" Body="&lt;p&gt;I think my answer here should provide you with exactly what you need, as well as an elegant and reusable way to do it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/96/how-can-i-route-a-specific-entry-in-a-structure-section-to-its-own-template&quot;&gt;How can I route a specific entry in a structure section to its own template?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-12-16T16:26:18.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5289" PostTypeId="2" ParentId="5286" CreationDate="2014-12-16T16:39:01.010" Score="2" Body="&lt;p&gt;I don't think that either the single's uri or the handle is technically considered a slug per se, although in the case of singles craft likely interprets the handle as such. A more appropriate way to access a single would be by using its section handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(updated) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) == &quot;this-is-a-segment&quot; %}&#xA;    {% set item = craft.entries.section('mySectionHandle').first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-16T17:23:13.550" LastActivityDate="2014-12-16T17:23:13.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5290" PostTypeId="1" CreationDate="2014-12-16T17:53:03.087" Score="1" ViewCount="83" Body="&lt;p&gt;My problem is that the &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer/&quot; rel=&quot;nofollow&quot;&gt;Mailer&lt;/a&gt; plugin (version 0.5) does not work with Craft Pro 2.3.2620. Unfortunately, I get no error message - it still does not send e-mail (the log is empty). Craft in general is able to send e-mails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has someone else the same problem?&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="57" LastEditDate="2018-07-13T18:32:46.107" LastActivityDate="2018-07-13T18:32:46.107" Title="Problem with mailer plugin" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5291" PostTypeId="1" AcceptedAnswerId="10012" CreationDate="2014-12-16T18:18:10.400" Score="8" ViewCount="3384" Body="&lt;p&gt;I understand Craft Templating pretty well, but when it comes to programmation I am entirely lost, I don't get how it works. I used to use CodeIgniter a lot, which is a MVC as you guys may know. In CodeIgniter, everything goes through the controller, then in the controller, I call models. In models, I interact with database and then return the data to the controller and then display a view. In Craft, it doesn't seems to work like this. Is there any good tutorials for &quot;programming&quot; in Craft or develop a plugin? Like how controllers, models, services and events works? Or is there any good people willing to help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use Craft so much, I just need to understand it before I use it at large for my client's projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate your help.&lt;/p&gt;&#xA;" OwnerUserId="1106" LastEditorUserId="22" LastEditDate="2017-05-10T00:12:29.703" LastActivityDate="2018-08-28T03:26:40.370" Title="Any good tutorial for plugin developement? I am entirely lost" Tags="&lt;plugin-development&gt;&lt;resources&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5293" PostTypeId="1" AcceptedAnswerId="5294" CreationDate="2014-12-16T21:03:14.330" Score="0" ViewCount="732" Body="&lt;p&gt;In my template I have the user id variable pulled out of the URL and then I want to search through my entries for posts where that user id is included in a custom field with a users field type as well as the default &quot;author&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've got working for the author field, and I just want to include my custom &quot;coAuthors&quot; field type as well...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a url like &quot;/author/joyce&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set username = craft.request.segment(2) %}&#xA;{% set author = craft.users.username(username).first() %}&#xA;{% set entries = craft.entries.section('blog').authorId(author.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works great, but how can I also include entries where that author id is set in the coAuthors custom field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't even seem to find it separately. This turns up nothing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').search('coAuthors.username:author.id') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="333" LastActivityDate="2015-01-15T22:48:55.547" Title="How can I search for a user id in a custom field in my entries loop?" Tags="&lt;users&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5294" PostTypeId="2" ParentId="5293" CreationDate="2014-12-16T21:55:15.497" Score="1" Body="&lt;p&gt;You would want to use the relatedTo() method of &lt;code&gt;elementCriteriaModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set username = craft.request.segment(2) %}&#xA;{% set author = craft.users.username(username).first() %}&#xA;{% set entries = craft.entries.section('blog').relatedTo(author) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need both then you may need to merge the results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set username = craft.request.segment(2) %}&#xA;{% set author = craft.users.username(username).first() %}&#xA;{% set authorEntries = craft.entries.section('blog').authorId(author.id).find() %}&#xA;{% set coAuthorEntries = craft.entries.section('blog').relatedTo(author).find() %}&#xA;&#xA;{# merge authorEntries and coAuthorEntries #}&#xA;{% set entries = authorEntries|merge(coAuthorEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested. But should be close. Update: added &lt;code&gt;.find()&lt;/code&gt; which will convert the elementCriteriaModel to an array so that the merge filter works properly.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-16T22:12:40.900" LastActivityDate="2014-12-16T22:12:40.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5295" PostTypeId="2" ParentId="5286" CreationDate="2014-12-16T22:32:50.250" Score="2" Body="&lt;p&gt;Singles have no need for slugs, which is why we don't expose them in the CP UI for a single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They only have one in the database because they're technically entries, and entries need slugs. But it's only a concept meant for Channel and Structure entries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-16T22:32:50.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5296" PostTypeId="1" AcceptedAnswerId="5297" CreationDate="2014-12-16T22:44:02.773" Score="3" ViewCount="444" Body="&lt;p&gt;From a plugin, how would I go about detecting if an admin user is using the &quot;Login as User&quot; feature?&lt;/p&gt;&#xA;" OwnerUserId="220" LastActivityDate="2014-12-16T22:49:12.757" Title="Detecting &quot;Login as User&quot; session" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5297" PostTypeId="2" ParentId="5296" CreationDate="2014-12-16T22:49:12.757" Score="4" Body="&lt;p&gt;I believe the way to do this would be to have your plugin listen for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;nofollow&quot;&gt;onBeforeLogin&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From inside there, you'd check to see if the there is an existing session &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;isLoggedIn()&lt;/code&gt; and the current user is an admin &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;isAdmin()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If both of those are true, I believe its going to be a pretty safe assumption that an admin just clicked the &quot;Login as User&quot; button.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-16T22:49:12.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5298" PostTypeId="1" AcceptedAnswerId="5300" CreationDate="2014-12-16T23:28:26.033" Score="1" ViewCount="897" Body="&lt;p&gt;I have succussfully been able to list entries within the 'brandx' category slug, but I can't figure out a way to print specific content &lt;strong&gt;only if&lt;/strong&gt; the current 'product' listing is related to the 'brandx' category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried quite a few things and have come up empty, so I feel like I'm either missing something basic, or there's a trick I can't find in the docs or here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('shopDetails').level(1).limit(24) as postsOnPage %} &#xA;      {% for product in postsOnPage %}&#xA;           …&#xA;            &amp;lt;h5&amp;gt;&#xA;              {% set cat = craft.categories.slug('brandx').first() %}&#xA;              {% set catGroup = craft.entries.relatedTo( cat ) %}&#xA;              {% if product {# is within the catGroup #}  %}&#xA;              Brand X&#xA;              {% endif %}&#xA;              {{ product.title }}&#xA;            &amp;lt;/h5&amp;gt;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="573" LastEditorUserId="573" LastEditDate="2014-12-16T23:33:39.123" LastActivityDate="2014-12-17T07:32:23.267" Title="If Entry is related to Category-A, then print xyz" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5299" PostTypeId="1" CreationDate="2014-12-16T23:41:21.860" Score="2" ViewCount="1472" Body="&lt;p&gt;I'm trying to insert a clip &lt;code&gt;&amp;lt;div class=&quot;my-class&quot;&amp;gt;my text&amp;lt;/div&amp;gt;&lt;/code&gt;. But when I insert the clip, the DIV tags are removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this setting in my Redactor config json: &lt;code&gt;replaceDivs: false&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="125" LastEditDate="2014-12-17T10:10:05.623" LastActivityDate="2014-12-17T10:25:32.123" Title="Redactor clips plugin removes DIV tags from inserted HTML?" Tags="&lt;plugins&gt;&lt;redactor&gt;&lt;plugin-redactorclips&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5300" PostTypeId="2" ParentId="5298" CreationDate="2014-12-17T00:44:12.330" Score="2" Body="&lt;p&gt;All you need to do is this in the &lt;code&gt;product&lt;/code&gt; for Loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.category.first.slug == 'brandx' %}&#xA;    Brand X&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or Shorthand &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ product.category.first.slug == 'brandx' ? 'Brand X' }}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested but thats the gist of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--Edited  &lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="45" LastEditDate="2014-12-17T07:32:23.267" LastActivityDate="2014-12-17T07:32:23.267" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5301" PostTypeId="1" CreationDate="2014-12-17T02:37:51.647" Score="1" ViewCount="1343" Body="&lt;p&gt;For convenience it would be rather useful if there was a way for me to achieve the following inside my main layout template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;template--{{ getNameOfPageTemplateHere|replace({ '/':'-', '_':'' }) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Such that a page rendered using the template &quot;blog/_entry&quot; would have the following body tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;template--blog-entry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-12-17T07:49:11.647" Title="How to get name of template that was chosen for request?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5302" PostTypeId="2" ParentId="5301" CreationDate="2014-12-17T02:53:55.003" Score="1" Body="&lt;p&gt;You can use &lt;code&gt;{% set templateName = _self.getTemplateName() %}&lt;/code&gt; from &lt;code&gt;_edit&lt;/code&gt; and pass that up as a variable that your layout template can utilize.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-17T02:53:55.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5303" PostTypeId="2" ParentId="5301" CreationDate="2014-12-17T07:49:11.647" Score="2" Body="&lt;p&gt;Maybe not the solution you was looking for, but here is an alternative solution I'm using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put a Twig block in your &quot;master template&quot; (_layout.html?) like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;{% block bodyClass %}{% endblock bodyClass %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And from my templates I can &lt;strong&gt;add&lt;/strong&gt; classes to the body tag like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block bodyClass %}{{ parent() }} news-index anotherclass{% endblock bodyClass %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or &lt;strong&gt;replace&lt;/strong&gt; the classes by omitting the parent() like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block bodyClass %}news-index anotherclass{% endblock bodyClass %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="828" LastActivityDate="2014-12-17T07:49:11.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5304" PostTypeId="2" ParentId="5291" CreationDate="2014-12-17T08:37:26.220" Score="6" Body="&lt;p&gt;You can find the plugin development docs &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the &lt;a href=&quot;https://github.com/adrianmacneil/cocktailrecipes/&quot;&gt;cocktail recipes plugin by Adrian Macneil&lt;/a&gt; inspired on the docs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both will give you a pretty good understanding of how plugins, controllers, models, services, ... work&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also find lots of free / open source plugins on &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot;&gt;straightupcraft&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="634" LastActivityDate="2014-12-17T08:37:26.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5305" PostTypeId="1" AcceptedAnswerId="5314" CreationDate="2014-12-17T09:47:06.763" Score="7" ViewCount="1647" Body="&lt;p&gt;On my local machine, every time I've added a new field and want to add content to it for the first time I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbException&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement:&#xA;  SQLSTATE[HY000]: General error: 145 Table&#xA;  './databasename/craft_searchindex' is marked as crashed and should&#xA;  be repaired.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A simple mysql repair table fixes it, but this happens way too often. Is there something I can do to prevent this?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="344" LastEditDate="2015-05-27T14:17:04.983" LastActivityDate="2018-09-27T13:14:10.243" Title="craft_searchindex table keeps crashing" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5306" PostTypeId="2" ParentId="5299" CreationDate="2014-12-17T09:55:12.893" Score="3" Body="&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's other problems / bugs with the Redactor API going on that lead to unexpected behavior on formatting the inserted HTML. The solution provided below does allow to insert HTML with DIV tags only if inserted in a new paragraph, otherwise it strips the tags. Another issue I came across is that I get empty SPAN tags added and I don't know where these come from?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;--&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin uses Redactor API's &lt;a href=&quot;http://imperavi.com/redactor/docs/api/insert/&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;insert.html&lt;/code&gt;&lt;/a&gt; function. Which by default cleans the HTML before inserting it. But there's a parameter to prevent it from doing so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can hack / fork the plugin and set the parameter in redactorclips/resources/clips.js (line 63):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.insert.html(html, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I will create a Github issue for this, because it definitely makes sense to have HTML cleaning disabled by default or at least have a setting for it.&lt;/s&gt; &lt;em&gt;(Edit: makes no sense as long as there's all the other issues with the API!)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-17T10:25:32.123" LastActivityDate="2014-12-17T10:25:32.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5307" PostTypeId="1" AcceptedAnswerId="5308" CreationDate="2014-12-17T13:07:38.583" Score="9" ViewCount="23921" Body="&lt;p&gt;Let's say I have 5 Craft fields named &quot;item1&quot; thru &quot;item5.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of writing out each variable...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.item1 }}&#xA;{{ entry.item2 }}&#xA;{{ entry.item3 }}&#xA;{{ entry.item4 }}&#xA;{{ entry.item5 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I create a loop to do this for me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i is 1..5 %}&#xA;&#xA;    {{ entry.item ~ loop.index }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it returns the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;item&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-04-13T09:31:00.420" Title="Use loop index number in a Twig variable" Tags="&lt;templating&gt;&lt;variable&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5308" PostTypeId="2" ParentId="5307" CreationDate="2014-12-17T13:07:38.583" Score="8" Body="&lt;p&gt;I found the answer in the Twig documentation:&#xA;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#variables&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/templates.html#variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can use a dot (.) to access attributes of a variable (methods or properties of a PHP object, or items of a PHP array), or the so-called &quot;subscript&quot; syntax ([]):&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ foo.bar }}&#xA;{{ foo['bar'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When using the subscript syntax, you can concatenate the loop.index like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i is 1..5 %}&#xA;&#xA;    {{ entry['item' ~ loop.index] }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or even simpler, use the &lt;code&gt;i&lt;/code&gt; variable from the for loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i is 1..5 %}&#xA;&#xA;    {{ entry['item' ~ i] }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-04-13T09:31:00.420" LastActivityDate="2015-04-13T09:31:00.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5309" PostTypeId="1" CreationDate="2014-12-17T14:04:17.633" Score="3" ViewCount="3578" Body="&lt;p&gt;In my local MAMP site I'm not able to upload any files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gives me this error in Chrome:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://nobel.craft.dev:8888/index.php?p=admin/actions/assets/uploadFile&quot; rel=&quot;nofollow&quot;&gt;http://nobel.craft.dev:8888/index.php?p=admin/actions/assets/uploadFile&lt;/a&gt; net::ERR_EMPTY_RESPONSE &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This error in Safari&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Failed to load a resource: The network connection was lost.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things I did&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've checked the asset folder path&lt;/li&gt;&#xA;&lt;li&gt;makes sure folder is writable&lt;/li&gt;&#xA;&lt;li&gt;nothing strange in the craft.log&lt;/li&gt;&#xA;&lt;li&gt;delete cache in admin&lt;/li&gt;&#xA;&lt;li&gt;download new version of craft and replaced the app folder&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2014-12-17T14:57:50.973" LastActivityDate="2016-11-08T19:43:59.503" Title="Error with uploading Asset Files: net::ERR_EMPTY_RESPONSE" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5311" PostTypeId="1" AcceptedAnswerId="5312" CreationDate="2014-12-17T15:54:38.420" Score="4" ViewCount="692" Body="&lt;p&gt;Is there any way to initialize a stdClass? &#xA;Code is simple&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $productOrCategory  =   new stdClass();&#xA;    $productOrCategory-&amp;gt;stockFutureDays = 0;&#xA;    $productOrCategory-&amp;gt;stockFutureDate = date('ymd');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but im getting &lt;b&gt;Fatal error&lt;/b&gt;:  Class 'Craft\stdClass' not found in &lt;b&gt;Controller.php&lt;/b&gt; on line &lt;b&gt;63&lt;/b&gt;&lt;br /&gt; and line 63 is the first line i added as code.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-12-17T16:13:14.360" Title="Class 'Craft\stdClass' not found" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5312" PostTypeId="2" ParentId="5311" CreationDate="2014-12-17T16:13:14.360" Score="7" Body="&lt;p&gt;Solution was to call&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$productOrCategory  =   new \stdClass();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="435" LastActivityDate="2014-12-17T16:13:14.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5313" PostTypeId="1" AcceptedAnswerId="5318" CreationDate="2014-12-17T16:13:48.913" Score="11" ViewCount="29538" Body="&lt;p&gt;I'm essentially looking for a way to have a template that runs through a bunch of &lt;code&gt;set&lt;/code&gt;s that I might use throughout my templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, if I &lt;code&gt;include&lt;/code&gt; in a template with an &lt;code&gt;extends&lt;/code&gt;, it dies up with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A template that extends another one cannot have a body.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '/_resources/variables.twig' %}&#xA;{% extends '/_layouts/default.twig' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some research indicates that maybe this isn't easily done with Twig parsing alone:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/20410194/use-twig-custom-set-variables-from-an-include&quot;&gt;https://stackoverflow.com/questions/20410194/use-twig-custom-set-variables-from-an-include&lt;/a&gt;&#xA;&lt;a href=&quot;https://groups.google.com/forum/#!topic/twig-users/QKdpWAxLdjE&quot; rel=&quot;noreferrer&quot;&gt;https://groups.google.com/forum/#!topic/twig-users/QKdpWAxLdjE&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what would be the best way to achieve this? My initial thought would be a plugin that you gave the path of a template, which preloaded things into variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize some variables (strings) could be done via macros. But, for example, I have a &lt;code&gt;set usStates = {...}&lt;/code&gt; that is a big hash of state codes and names.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2019-01-22T17:39:42.490" Title="Include a template that sets variables (global template variables)" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5314" PostTypeId="2" ParentId="5305" CreationDate="2014-12-17T16:30:07.313" Score="9" Body="&lt;p&gt;TL/DR: MySQL is horrible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft_searchindex&lt;/code&gt; table is the only table that uses MySQL's older MyISAM storage engine, instead of InnoDB (like the rest of the tables), because InnoDB didn't add support for MySQL's full text search capabilities until very recently (version 5.6.4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the many drawbacks of the MyISAM storage engine, as you've discovered, is that the tables using it can crash easily.  The crashes can occur for a variety of reasons... low disk space, firmware issues, buggy MySQL, sudden server reboot, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the command line, you can run a &quot;repair all&quot; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysqlrepair -A --auto-repair&#xA;mysqlrepair -A -o&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or start a test that might help you diagnose why it's crashing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysqlrepair -A -c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, if you know you're running &gt; MySQL 5.6.4 across all of your environments, you can change the storage engine for that table from MyISAM to InnoDB.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-09-19T22:39:32.533" LastActivityDate="2016-09-19T22:39:32.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5315" PostTypeId="2" ParentId="5309" CreationDate="2014-12-17T16:34:25.457" Score="2" Body="&lt;p&gt;That usually means &quot;something fatal happened&quot; when trying to upload the file.  The usual culprits are the php.ini &lt;code&gt;max_execution_time&lt;/code&gt; and &lt;code&gt;memory_limit&lt;/code&gt; settings, but if it's happening for small files too, something else could be going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have also seen it happen when you're uploading an image in a format your underlying image processing library doesn't support.  i.e. your server has &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;GD&lt;/a&gt; installed, but you're trying to upload a 32-bit PNG.  Or you're running an older version of GD or &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagick&lt;/a&gt; that has a bug you're hitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check if you have a &lt;code&gt;craft/storage/runtime/logs/phperrors.log&lt;/code&gt; file.  Any PHP fatal errors will be logged there.  If not, then check the Apache error logs to see if it's an Apache problem.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-11-08T19:43:59.503" LastActivityDate="2016-11-08T19:43:59.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5316" PostTypeId="2" ParentId="5313" CreationDate="2014-12-17T16:59:16.920" Score="3" Body="&lt;p&gt;Another option would be to create a small plugin with a variables file dedicated to storing this data. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable {&#xA;&#xA;    public function exampleVariable($optional = null)&#xA;    {&#xA;        return &quot;Return anything you want.&quot;;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template, you can just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.exampleVariable }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-17T17:22:01.003" LastActivityDate="2014-12-17T17:22:01.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5317" PostTypeId="1" AcceptedAnswerId="5321" CreationDate="2014-12-17T17:00:51.827" Score="0" ViewCount="506" Body="&lt;p&gt;Doing my first site with Craft and UiKit framework I encountered a small problem with dropdown menu. Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% set entries = craft.entries.section('spb') %}&#xA;  {% nav entry in entries %}&#xA;  &amp;lt;li class=&quot;uk-parent&quot; data-uk-dropdown&amp;gt;&#xA;    &amp;lt;a {% if craft.request.getPath() == entry.uri %} class=&quot;active&quot; {% endif %} href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% ifchildren %}&#xA;    &amp;lt;div class=&quot;uk-dropdown&quot;&amp;gt;&#xA;      &amp;lt;ul class=&quot;uk-nav uk-nav-dropdown&quot;&amp;gt;&#xA;        {% children %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The point is that my child element looks exactly like parent because it takes its structure. But I don't need neither &quot;class&quot; nor &quot;data-uk-dropdown&quot; element...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;uk-parent&quot; data-uk-dropdown=&quot;&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;...&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any workaround? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2014-12-18T09:41:36.710" Title="Navigation drop-down problem" Tags="&lt;navigation&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5318" PostTypeId="2" ParentId="5313" CreationDate="2014-12-17T17:02:59.813" Score="17" Body="&#xA;&#xA;&lt;p&gt;There are actually two issues with this approach. The first, and the direct reason you’re getting that Twig error, is that templates that extend another template can only output things within &lt;code&gt;{% block %}&lt;/code&gt; tags. Any HTML that gets output outside of those tags (either directly or via &lt;code&gt;{{ output tags }}&lt;/code&gt;) will result in that Twig error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% include %}&lt;/code&gt; tag is in the same boat. Its only purpose (as far as the parent template is concerned) is to output the results of a child template. So like &lt;code&gt;{{ output tags }}&lt;/code&gt;, you can’t place it outside of &lt;code&gt;{% block %}&lt;/code&gt; tags. If you really want to include a template within these nested templates, you will need to move it to within your &lt;code&gt;{% block %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you did that, though, you’d then run into the second issue: Any variables that are set/modified within an included template will &lt;strong&gt;not&lt;/strong&gt; bubble back up to the parent template. For example, if you had these two templates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;parent template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% include &quot;_inc&quot; %}&#xA;{{ foo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;child template (_inc.html):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set foo = 'bar' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That &lt;code&gt;foo&lt;/code&gt; variable would actually be discarded as soon as Twig was finished rendering _inc.html; nothing that happens in there will have any effect on the parent template. (As I said, the &lt;strong&gt;only&lt;/strong&gt; purpose of the &lt;code&gt;{% include %}&lt;/code&gt; tag as far as the parent template is concerned is to output the rendering result of the included template.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;However,&lt;/em&gt; it’s still probably possible to achieve what you want when you consider the order in which these templates are going to be processed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Everything &lt;em&gt;besides&lt;/em&gt; the &lt;code&gt;{% block %}&lt;/code&gt; tags in the requested template (the one with the &lt;code&gt;{% extends %}&lt;/code&gt; tag)&lt;/li&gt;&#xA;&lt;li&gt;The layout template (_layouts/default.twig), &lt;em&gt;including&lt;/em&gt; its &lt;code&gt;{% block %}&lt;/code&gt; tags&lt;/li&gt;&#xA;&lt;li&gt;The requested template’s &lt;code&gt;{% block %}&lt;/code&gt; tags&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Knowing that, you can probably just set your variables you’re trying to set from within _layouts/default.twig, and they will be available within the requested template’s &lt;code&gt;{% block %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;requested template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends '_layouts/default.twig' %}&#xA;&#xA;{% block content  %}&#xA;    {{ foo }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;layout template (_layouts/default.twig):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Set the variables you were trying to set in _resources/variables.twig #}&#xA;{% set foo = 'bar' %}&#xA;&#xA;{% block content %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2014-12-17T17:02:59.813" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5319" PostTypeId="2" ParentId="5119" CreationDate="2014-12-17T17:58:13.820" Score="1" Body="&lt;p&gt;(I'm fairly new to the Craft CMS Stack Exchange - so I lack the minimum 50 reputation to reply to the comment by @jason-mccallister; apologies in advance for the etiquette faux-pas)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Shebang_(Unix)&quot; rel=&quot;nofollow&quot; title=&quot;Wikipedia: Shebang &amp;#40;Unix&amp;#41;&quot;&gt;Shebang&lt;/a&gt; at the top your PHP file (#!/usr/bin/php or similar), then your script will need the relevant execute bit set (for the user, the file's group, or world).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - if you're calling your PHP script by passing it as an argument to your PHP binary as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/usr/bin/php foo.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you do not need an execute bit set (or the Sheband at the top of the PHP file, for that matter) - only an appropriate read bit.&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="900" LastEditDate="2014-12-17T18:11:39.600" LastActivityDate="2014-12-17T18:11:39.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5321" PostTypeId="2" ParentId="5317" CreationDate="2014-12-17T18:32:26.867" Score="1" Body="&lt;p&gt;You can use &lt;code&gt;entry.level&lt;/code&gt; in a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('spb') %}&#xA;{% nav entry in entries %}&#xA;&#xA;    {% set liTagAttributes = entry.level == 1 ? 'class=&quot;uk-parent&quot; data-uk-dropdown' : 'class=&quot;uk-child&quot;' %}&#xA;&#xA;    &amp;lt;li {{ liTagAttributes|raw }}&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            ...&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I set a intermediate var to keep the template code clean. If you don't have many levels in your structure, you could also consider to not use the &lt;code&gt;nav&lt;/code&gt; tag at all and nest your navigation levels using &lt;code&gt;hasDescendents&lt;/code&gt; and &lt;code&gt;getDescendents(1)&lt;/code&gt; (see the example code I &lt;a href=&quot;https://craftcms.stackexchange.com/a/1847/125&quot;&gt;posted here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-12-18T09:41:36.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5322" PostTypeId="1" AcceptedAnswerId="5324" CreationDate="2014-12-17T18:46:46.790" Score="4" ViewCount="1271" Body="&lt;p&gt;If a Model can be used to save entries, what is a Record for? Is it literally just to define the schema? I've seen a few examples where the defineAttributes methods have duplication of code too, so I'm a little confused...&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-12-17T20:33:13.880" Title="Models v Records - confused" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5324" PostTypeId="2" ParentId="5322" CreationDate="2014-12-17T20:33:13.880" Score="6" Body="&lt;p&gt;I might be wrong here, but I don't think a model can be used to save entries. You populate a model, then populate a record with that model and save it. Once saved, you get data from the db as a record, then populate a model with it to pass that to a view, for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If everything works as it should, a record is never used outside the service.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-12-17T20:33:13.880" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5327" PostTypeId="1" CreationDate="2014-12-18T12:25:57.060" Score="3" ViewCount="756" Body="&lt;p&gt;I'm working on a custom import plugin which needs to import a load of content to fields including categories and tags. Categories is working fine using a comma separated list of category ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $entry = new EntryModel();&#xA;        $entry-&amp;gt;authorId  = $eventObject-&amp;gt;author;&#xA;        $entry-&amp;gt;enabled   = true;&#xA;        $entry-&amp;gt;postDate   = $eventObject-&amp;gt;postDate;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = $eventObject-&amp;gt;title;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'slug' =&amp;gt; $eventObject-&amp;gt;slug,&#xA;            'locationText' =&amp;gt; $eventObject-&amp;gt;locationText,&#xA;            'date' =&amp;gt; $eventObject-&amp;gt;eventDate,&#xA;            'overview' =&amp;gt; $eventObject-&amp;gt;overview,&#xA;            'eventWebsite' =&amp;gt; $eventObject-&amp;gt;eventWebsite,&#xA;            'eventCategories' =&amp;gt; $eventObject-&amp;gt;categories,&#xA;            'location' =&amp;gt; $eventObject-&amp;gt;location,&#xA;            'eventTags' =&amp;gt; 1453,&#xA;        ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just can't get tags importing at all, also need to create new tags where a tag doesn't already exist! Testing with the id 1453which is an existing tag id.&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2014-12-19T11:22:50.620" Title="How do you add tags to tag field when saving an entry?" Tags="&lt;plugin-development&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5328" PostTypeId="1" AcceptedAnswerId="5330" CreationDate="2014-12-18T12:28:38.850" Score="1" ViewCount="519" Body="&lt;p&gt;I would like to order my entries by the entry type they have, so for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('more-info').order('type') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this orders by entry type ID, and not by title, alphabetically. Can this be done? I've tried &lt;code&gt;order('type.title')&lt;/code&gt;, but no luck (= DB error) ...&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2014-12-18T14:06:13.867" Title="Is it possible to order entries by Entry type title/slug" Tags="&lt;templating&gt;&lt;ordering&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5329" PostTypeId="2" ParentId="5313" CreationDate="2014-12-18T13:35:21.273" Score="2" Body="&lt;p&gt;It looks like another good solution is to use a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt;. I just became aware of these, but they look very useful for this type of thing.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-12-18T13:35:21.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5330" PostTypeId="2" ParentId="5328" CreationDate="2014-12-18T14:06:13.867" Score="2" Body="&lt;p&gt;I don't think it's possible to order by the name or handle of Entry Types. To order by the ID of your Entry Types use &lt;code&gt;'typeId'&lt;/code&gt; as the value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('more-info').order('typeId') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you only have to create your Entry Types alphabetically ;)&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2014-12-18T14:06:13.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5331" PostTypeId="1" AcceptedAnswerId="5348" CreationDate="2014-12-18T15:24:55.263" Score="3" ViewCount="474" Body="&lt;p&gt;In my base template extended by all other templates, I import my macros, so I have global use of them throughout my templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1:&lt;/strong&gt;&#xA;Am I taking a performance hit for including these whether or not I'm using them in a given template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2:&lt;/strong&gt;&#xA;Is there any advantage to splitting up macros into different imports, other than just organization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, is there any reason not to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/macros&quot; as macros %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And have &lt;code&gt;_includes/macros&lt;/code&gt; have &lt;em&gt;all&lt;/em&gt; my macros?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2014-12-19T00:22:15.743" Title="What is the advantages/disadvantages of separating macro imports?" Tags="&lt;templating&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5332" PostTypeId="1" AcceptedAnswerId="5336" CreationDate="2014-12-18T15:42:12.933" Score="2" ViewCount="889" Body="&lt;p&gt;I have a rich text field which contains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what is left when you delete all content of a redactor field.&#xA;This can't be deleted without the HTML view of Redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to write a conditional that checks for an empty field ignoring HTML markup?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.poorText is not empty %}&#xA;   {{ entry.poorText }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does not work in this case.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="642" LastEditDate="2019-04-17T12:28:22.940" LastActivityDate="2019-04-17T12:28:22.940" Title="Test for empty RichText field" Tags="&lt;conditional&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5333" PostTypeId="1" AcceptedAnswerId="5338" CreationDate="2014-12-18T15:56:35.460" Score="1" ViewCount="564" Body="&lt;p&gt;I've tried this but it doesn't seem to be working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = EntryModel::populateModel(array(&#xA;    'dateCreated' =&amp;gt; DateTimeHelper::formatTimeForDb($someTimeStamp),&#xA;    'sectionId' =&amp;gt; 1&#xA;    'typeId' =&amp;gt; 1&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-12-18T17:31:22.110" Title="How can I set the dateCreated attribute on an EntryModel?" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5334" PostTypeId="1" AcceptedAnswerId="5387" CreationDate="2014-12-18T16:26:39.437" Score="4" ViewCount="1122" Body="&lt;p&gt;I'm working on a website for a school. Each group has a specific page that has video's for that group only. Members of that group do not need access to the CP. First I noticed that I can only assign specific members to an entry, using the Users field. I'm not able to assign a group at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make it possible for the teacher to assign a group to a video through the CP (not the code), and that only that group can view the page after login?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2014-12-18T17:21:08.370" LastActivityDate="2014-12-23T14:42:08.340" Title="Assign a user group to a structure entry. Restrict permission front end page to that same group" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5335" PostTypeId="1" AcceptedAnswerId="5339" CreationDate="2014-12-18T16:34:36.223" Score="4" ViewCount="963" Body="&lt;p&gt;Trying to build a complex query and I'm sure there is bound to be a better way of doing it that the multiple if statements I currently have.&#xA;URL for the page is /products/(category1)/(category2)/(category3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if any of the categorys in the url is selected it will display that slug other wise it will be all e.g.&#xA;/products/inks/glass/all&#xA;/products/all/glass/catname&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get categories #}&#xA;  {% set catTypeSlug = craft.request.getSegment(2) %}&#xA;  {% if catTypeSlug != 'all' %}&#xA;  {% set catType = craft.categories.slug(catTypeSlug).first() %}&#xA;  {% endif %}&#xA;&#xA;  {% set catSurfaceSlug = craft.request.getSegment(3) %}&#xA;  {% if catSurfaceSlug != 'all' %}&#xA;  {% set catSurface = craft.categories.slug(catSurfaceSlug).first() %}&#xA;  {% endif %}&#xA;&#xA;  {% set catUseSlug = craft.request.getSegment(4) %}&#xA;  {% if catUseSlug != 'all' %}&#xA;  {% set catUse = craft.categories.slug(catUseSlug).first() %}&#xA;  {% endif %}&#xA;&#xA;&#xA;  {# set parameters #}&#xA;  {% if catType is defined and catSurface is defined and catUse is defined %}&#xA;    {% set params = { section: 'productsServices', relatedTo: catType, relatedTo: catSurface, relatedTo: catUse } %}&#xA;&#xA;  {% else %}  &#xA;    {# multiple if statements checking if categories defined #}&#xA;&#xA;  {% endif %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the best way to build my parameters instead of multiple if statements?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2014-12-19T08:59:59.317" Title="Build Query relatedTo multiple categories" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5336" PostTypeId="2" ParentId="5332" CreationDate="2014-12-18T16:34:51.873" Score="6" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;striptags&lt;/code&gt;&lt;/a&gt; filter to remove all HTML tags from your string. With the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/trim.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;trim&lt;/code&gt;&lt;/a&gt; filter you can strip all whitespace from the beginning and the end of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.poorText|striptags|trim %}&#xA;    {{ entry.poorText }}&#xA;{% else %}&#xA;    Here could be a nicely formatted text! &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2014-12-18T18:13:15.963" LastActivityDate="2014-12-18T18:13:15.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5337" PostTypeId="2" ParentId="1545" CreationDate="2014-12-18T16:37:46.713" Score="2" Body="&lt;p&gt;Just tried this again in Craft 2.3 and now it works as most people would expect (I know, not as it should for html purists)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shift Enter = &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regular Enters are coded as &lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt;, forcing an empty line. For me, this works :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is with 'Clean HTML' selected and HTML purifier OFF&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-12-18T16:37:46.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5338" PostTypeId="2" ParentId="5333" CreationDate="2014-12-18T17:31:22.110" Score="0" Body="&lt;p&gt;The &lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;dateUpdated&lt;/code&gt; and &lt;code&gt;uid&lt;/code&gt; columns are more internal Craft auditing columns that Craft manages for every row in every table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe what you're looking for is the &lt;code&gt;postDate&lt;/code&gt; column for entries, which you can set a custom value to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-18T17:31:22.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5339" PostTypeId="2" ParentId="5335" CreationDate="2014-12-18T19:28:16.903" Score="6" Body="&lt;p&gt;Untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set base criteria #}&#xA;{% set params = {&#xA;    section: 'productsServices',&#xA;    limit: null&#xA;} %}&#xA;&#xA;{# set relationship criteria #}&#xA;{% set relationParam = ['and'] %}&#xA;{% for segment in craft.request.segments %}&#xA;    {% if loop.index != 1 and segment != 'all' %}&#xA;        {% set category = craft.categories.slug(segment).first() %}&#xA;        {% set relationParam = relationParam|merge([{ targetElement:category }]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# check to ensure that at least one relationship is defined and merge criteria #}&#xA;{% if relationParam|length &amp;gt; 1 %}&#xA;    {% set params = params|merge({relatedTo: relationParam}) %}&#xA;{% endif %}&#xA;&#xA;{# retrieve entries #}&#xA;{% set entries = craft.entries(params) %}&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; Added a check to ensure that not all segments are set to 'all'; Fixed 'length' syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give credit to carlcs and his &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5107/users-relatedto-multiple-categories/5108#5108&quot;&gt;ElementCriteriaModel Fu in this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2014-12-19T08:59:59.317" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5340" PostTypeId="1" AcceptedAnswerId="5344" CreationDate="2014-12-18T19:41:45.340" Score="1" ViewCount="115" Body="&lt;p&gt;In my matrix field, I want to be able to upload my image, and then upload another asset (in this case it would be a document) so that that image I upload links to that document.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my Matrix field setup like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image -&gt;&#xA;  -Image&#xA;  -linkedDocument&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set up a conditional where only add in the  tag &lt;em&gt;if&lt;/em&gt; I add an asset there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% elseif block.type == &quot;image&quot; %}&#xA;&#xA;        {% set image = block.image.first() %}&#xA;&#xA;        {% if image %}&#xA;            &amp;lt;a href=&quot;{{ image.linkedDocument }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; width=&quot;{{ image.getWidth('thumb') }}&quot; height=&quot;{{ image.getHeight('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="937" LastActivityDate="2014-12-18T21:05:45.380" Title="How to setup conditionals within a matrix?" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5341" PostTypeId="2" ParentId="5340" CreationDate="2014-12-18T20:07:26.697" Score="2" Body="&lt;p&gt;Very close. It just looks like you are trying to reference the 'linkedDocument' through 'image' instead of through the block, and you are not retrieving the url.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;image&quot; %}&#xA;&#xA;    {% set image = block.image.first %}&#xA;    {% set document = block.linkedDocument.first %}&#xA;&#xA;    {% if image %}&#xA;        {% if document %}&amp;lt;a href=&quot;{{ document.url }}&quot;&amp;gt;{% endif %}&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; width=&quot;{{ image.getWidth('thumb') }}&quot; height=&quot;{{ image.getHeight('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;{% if document %}&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update: Added conditional for &lt;code&gt;if document&lt;/code&gt;. Essentially the same answer as Marion's.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-18T21:05:45.380" LastActivityDate="2014-12-18T21:05:45.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5342" PostTypeId="1" CreationDate="2014-12-18T20:09:06.817" Score="0" ViewCount="154" Body="&lt;p&gt;I click on fullscreen button in redactor, However, an error in the console enter code here &lt;code&gt;this.fullscreen.enable is not a function&lt;/code&gt;. And on enter click or paste text in new paragraph is added &lt;code&gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; ???&#xA;In general, there are not the best impressions of working with the editor.&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2014-12-18T21:27:55.063" LastActivityDate="2015-01-19T20:07:00.320" Title="Fullscreen plugin in redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5343" PostTypeId="2" ParentId="5334" CreationDate="2014-12-18T20:50:33.373" Score="3" Body="&lt;p&gt;As far as I know there is no way to assign a 'group' using an entries &lt;code&gt;fieldType&lt;/code&gt;. What I would likely do is create a category group called 'User Groups' (userGroups) that mirror my groups, with fields for 'title' and 'groupId'.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Group Title 1 -&gt; 1,&lt;/li&gt;&#xA;&lt;li&gt;Group Title 2 -&gt; 2,&lt;/li&gt;&#xA;&lt;li&gt;Group Title 3 -&gt; 3, &lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(Unfortunately, I think the only way to get the groupId is to look in the database &lt;code&gt;craft_usergroups&lt;/code&gt; table. Although the code below could probably be adapted to use the group handle if needed.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a categories fieldType called 'authorizedGroups', and add it to the video channel's &lt;code&gt;fieldLayout&lt;/code&gt; (or wherever else you need it). The client would then be able to select groups via the &lt;code&gt;authorizedUserGroups&lt;/code&gt; field that have authorization to the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template(s) you can then check for videos related to the &lt;code&gt;authorizedGroups&lt;/code&gt; that match the &lt;code&gt;currentUser.group&lt;/code&gt; and display content accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, on your videos index page you would only want to only show links to the videos that the user has authorization to view.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {# create an array of the currentUser.groups Ids #}&#xA;    {% set currentUserGroupIds = [] %}&#xA;    {% for group in currentUser.groups %}&#xA;        {% set currentUserGroupIds = currentUserGroupIds|merge([group.id]) %}&#xA;    {% endfor %}&#xA;&#xA;    {# find all userGroupCategories that match currentUserGroupIds #}&#xA;    {% set userGroupCategories = craft.categories.group('userGroups').find({&#xA;        groupId: currentUserGroupIds&#xA;    }) %}&#xA;&#xA;    {# find all the videos related to userGroupCategories #}&#xA;    {% set entries = craft.entries.section('videos').relatedTo(userGroupCategories) %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href={{ entry.url }}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the video detail page you would use a conditional that redirects any unauthorized users to a 401 page (or to any other page that you choose).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userIsAuthorized = false %}&#xA;{% for group in entry.authorizedUserGroups %}&#xA;    {% if currentUser.isInGroup( group.groupId ) %}&#xA;        {% set userIsAuthorized == true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if not userIsAuthorized %}&#xA;    {% redirect 401 %}&#xA;{% endif %}&#xA;&#xA;{# display video #}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: There was a significant code error that did not account for the fact that user.groups returns an array of groups rather than a single group. I rewrote the code to handle this. Untested, and probably still contains errors, but should be closer at least.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-18T22:29:23.423" LastActivityDate="2014-12-18T22:29:23.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5344" PostTypeId="2" ParentId="5340" CreationDate="2014-12-18T20:50:51.663" Score="3" Body="&lt;p&gt;If you have an &lt;code&gt;image&lt;/code&gt;, you want to display it, and if there is also a &lt;code&gt;linkedDocument&lt;/code&gt;, you want the &lt;code&gt;image&lt;/code&gt; to link to that document. This should handle both cases, without too much code duplication.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;image&quot; %}&#xA;&#xA;  {% set image = block.image.first %}&#xA;&#xA;  {% if image %}&#xA;    {# set the imgTag, which we will display regardless #}&#xA;    {% set imgTag %}&#xA;      &amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; width=&quot;{{ image.getWidth('thumb') }}&quot;  height=&quot;{{ image.getHeight('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% endset %}&#xA;&#xA;    {% set linkedDocument = block.linkedDocument.first %}&#xA;&#xA;    {# we may or may not have a linkedDocument. Display the image in either case #}&#xA;    {% if linkedDocument %}&#xA;      &amp;lt;a href=&quot;{{ linkedDocument.url }}&quot;&amp;gt;{{imgTag}}&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;      {{imgTag}}&#xA;    {% endif %}&#xA;  {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-18T20:50:51.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5345" PostTypeId="2" ParentId="1471" CreationDate="2014-12-18T21:27:59.927" Score="3" Body="&lt;p&gt;I'm kinda late to the party here but Brandon suggested I add the technique I use to this thread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do in order for PHPStorm to resolve my own &lt;code&gt;craft()-&amp;gt;myService&lt;/code&gt; is to not use that at all because you can't type hint services that get created at runtime. What I do instead, is to declare a function with the name of my plugin that is properly type hinted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that I have a plugin called &lt;code&gt;PatrolPlugin&lt;/code&gt; with a service called &lt;code&gt;PatrolService&lt;/code&gt; which has a method called &lt;code&gt;protect()&lt;/code&gt;. If I want to navigate to the method definition/declaration for &lt;code&gt;PatrolService.protect()&lt;/code&gt;, I would do something like this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a properly type hinted service getter, this can be a global function or a static method in your plugin class.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * Tells PHPStorm or any other smart IDE that patrol() returns my service&#xA; *&#xA; * @return PatrolService&#xA; */&#xA;function patrol()&#xA;{&#xA;    return Craft::app()-&amp;gt;getComponent('patrol');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Call that function/method instead of using &lt;code&gt;craft()-&amp;gt;patrol&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;patrol()-&amp;gt;protect()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Place the cursor inside &lt;code&gt;protect&lt;/code&gt; and go to definition.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's what I do anyways, and it works for me.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If I had other services that I wanted type hinted, I can just add them as properties of the main service.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * @property Patrol_OtherService $other&#xA; */&#xA;class PatrolService extends BaseApplicationComponent&#xA;{&#xA;    public $other;&#xA;&#xA;    public function init()&#xA;    {&#xA;        $this-&amp;gt;other = Craft::app()-&amp;gt;getComponent('patrol_other');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I'm using &lt;code&gt;Craft::app()-&amp;gt;getComponent('service')&lt;/code&gt; because it is a bit faster than &lt;code&gt;craft()-&amp;gt;service&lt;/code&gt; but they are basically the same.&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2014-12-18T21:27:59.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5346" PostTypeId="1" AcceptedAnswerId="5347" CreationDate="2014-12-18T21:44:06.307" Score="1" ViewCount="2264" Body="&lt;p&gt;I feel like I'm doing this wrong (looping on section fields):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldLayoutField in craft.entries.section('rentalsBulletin').getEntryTypes().first.getFieldLayout().getFields() %}&#xA;    {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}&#xA;    {% include 'rentals-bulletin/_components/form-field-types/' ~ field.type %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Building a front-end &quot;create&quot; page. Goal is loop through fields and depending on type include a snippet to build the form. Basically, get section fields and build the form dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: if you didn't see the accepted answer comments, the way to do this when you don't have an entry to work with is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldLayoutField in craft.sections.getSectionByHandle('rentalsBulletin').getEntryTypes()[0].getFieldLayout().getFields() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="244" LastEditorUserId="244" LastEditDate="2014-12-19T02:58:50.933" LastActivityDate="2014-12-19T02:58:50.933" Title="getting fields of a section (getFields())" Tags="&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5347" PostTypeId="2" ParentId="5346" CreationDate="2014-12-18T23:18:43.333" Score="1" Body="&lt;p&gt;You don't need to go through &lt;code&gt;craft.fields&lt;/code&gt; to get the fields. They are already there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.entries.section('rentalsBulletin').getEntryTypes().first.getFieldLayout().getFields() %}&#xA;{% for field in fields %}&#xA;    {% set type = field.getField().type %}&#xA;    {% include 'rentals-bulletin/_components/form-field-types/' ~ type %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will probably also want to pass some variables into your included templates to actually build the fields with the proper field names as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set properties = { 'name': field.getField().handle } %}&#xA;{% include 'rentals-bulletin/_components/form-field-types/' ~ type with properties %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are also a few plugins &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;available on the plugins page&lt;/a&gt; for form building that you might want to check out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; Looks like &lt;code&gt;craft.entries.section('rentalsBulletin').getEntryTypes()&lt;/code&gt; returns null when there are no entries defined. Instead you can go through a different route that doesn't seem to depend on entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.sections.getSectionByHandle('news').getEntryTypes()[0].getFieldLayout().getFields() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2014-12-19T02:19:38.740" LastActivityDate="2014-12-19T02:19:38.740" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="5348" PostTypeId="2" ParentId="5331" CreationDate="2014-12-19T00:22:15.743" Score="2" Body="&lt;p&gt;This is definitely not a great answer, but I'm not sure anyone's going to be able to really answer this. You'd have to set up some sort of unit tests or something. And it will probably depend a lot on your server environment. But think of all the class files that need to get loaded just to handle a simple request. Personally, I think that the performance hit on an import statement is going to be pretty tiny regardless. I would opt for importing them in whatever way makes the most sense from a development/organizational perspective.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-19T00:22:15.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5349" PostTypeId="1" AcceptedAnswerId="5350" CreationDate="2014-12-19T01:41:14.843" Score="1" ViewCount="635" Body="&lt;p&gt;I have AMPPS installed on my Mac OS X, and am trying to install the CMS. When I browse to &lt;a href=&quot;http://craft.dev/admin&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev/admin&lt;/a&gt; to install, it redirects to &lt;a href=&quot;http://craft.dev/admin/install&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev/admin/install&lt;/a&gt; with the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to undefined function ctype_alpha() in /Users/username/domains/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Lexer.php on line 380&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on fixing the issue?&lt;/p&gt;&#xA;" OwnerUserId="1118" LastActivityDate="2014-12-19T05:03:00.310" Title="Fatal error on install" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5350" PostTypeId="2" ParentId="5349" CreationDate="2014-12-19T05:03:00.310" Score="2" Body="&lt;p&gt;Check that the php ctype extension is installed or enabled.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-19T05:03:00.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5351" PostTypeId="1" AcceptedAnswerId="5370" CreationDate="2014-12-19T08:35:19.703" Score="2" ViewCount="1322" Body="&lt;p&gt;The only thing I don't really like about Craft is that I have to fetch and eventually manipulate my entry in the twig template itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to hook into the current request before the template gets rendered? Like that I could create some kind of Controller where I fetch all the necessary data, prepare it and then pass it on to the template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally this would allow me to use another template engine then twig. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible, would there be a way to only use craft as the backend? From outside of craft, is there an easy way to find out if there are matching entries/singles/categories to the current request? I'm not looking for a complete answer here, more some key points where I could start looking. &lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2014-12-21T22:13:38.103" Title="Hook in before template gets rendered" Tags="&lt;templating&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5352" PostTypeId="2" ParentId="440" CreationDate="2014-12-19T08:46:58.957" Score="4" Body="&lt;p&gt;If you've got New Relic installed on a server containing more than one site, I've found adding:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (extension_loaded('newrelic')) {&#xA;  newrelic_set_appname('NAME OF SITE');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;at the top of Craft's index.php allows me to track them individually in New Relic.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-12-19T08:46:58.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5353" PostTypeId="2" ParentId="4116" CreationDate="2014-12-19T09:27:44.157" Score="2" Body="&lt;p&gt;This method uses New Relic's PHP API, rather than php.ini, and is working well for me. It seems to be catching everything that I need to monitor. Any applications I've not done this for remain in the default application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just stick this in Craft's index.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (extension_loaded('newrelic')) {&#xA;    newrelic_set_appname('NAME OF SITE');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't tried it with ExpressionEngine or Wordpress, but the principle would be the same?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2014-12-19T09:27:44.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5354" PostTypeId="1" AcceptedAnswerId="5356" CreationDate="2014-12-19T10:41:55.283" Score="2" ViewCount="3077" Body="&lt;p&gt;any idea why this: &lt;code&gt;%20AND%20foo%3A%22(.+?)%22&lt;/code&gt; won't match this: &lt;code&gt;%20AND%20foo%3A%22some random string of characters%22&lt;/code&gt; in the Twig &lt;code&gt;|replace&lt;/code&gt; filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = '%20AND%20foo%3A%22some random string of characters%22' %}&#xA;{% set bar = '%20AND%20foo%3A%22(.+?)%22' %}&#xA;{{ foo |replace(bar, 'replaced') }}&#xA;{# OR THIS #}&#xA;{{ foo |replace((bar), 'replaced') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is &lt;code&gt;foo&lt;/code&gt;. Nothing gets replaced. I'd expect the result to be the string &quot;replaced&quot;. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="327" LastActivityDate="2015-08-03T21:23:34.083" Title="Use regex in replace filter" Tags="&lt;regex&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5355" PostTypeId="2" ParentId="5327" CreationDate="2014-12-19T11:22:50.620" Score="3" Body="&lt;p&gt;Like other relational fields, Tags fields’ values need to be set to an array of the tags’ IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s not possible to create tags &lt;em&gt;during&lt;/em&gt; entry creation; you would just need to create it first using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TagsService#saveTag-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;TagsService::saveTag()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$tag = new TagModel();&#xA;$tag-&amp;gt;groupId = 1;&#xA;$tag-&amp;gt;getContent()-&amp;gt;title = 'My Tag';&#xA;&#xA;$success = craft()-&amp;gt;tags-&amp;gt;saveTag($tag);&#xA;&#xA;if ($success)&#xA;{&#xA;    $tagData = array($tag-&amp;gt;id);&#xA;}&#xA;else&#xA;{&#xA;    $tagData = null;&#xA;}&#xA;&#xA;// ...&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    // ...&#xA;    'myTagsField' =&amp;gt; $tagData,&#xA;));&#xA;&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that I’m setting the field value using &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContentFromPost()&lt;/a&gt; instead of directly on the ContentModel. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;This is the recommended way to set your custom field values&lt;/a&gt;, although for relational fields it doesn’t really matter either way.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2014-12-19T11:22:50.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5356" PostTypeId="2" ParentId="5354" CreationDate="2014-12-19T12:14:10.240" Score="3" Body="&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; &lt;a href=&quot;http://buildwithcraft.com/updates#build2579&quot; rel=&quot;nofollow noreferrer&quot;&gt;As of Craft v2.2&lt;/a&gt;, the replace filter now supports regex:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The replace filter now supports regular expressions, by setting the first argument to a string that begins and ends with forward slashes, e.g. '/foo/'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this should work by adding forward slashes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bar = '/%20AND%20foo%3A%22(.+?)%22/' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is particular to Craft and not native to the Twig replace filter.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;I don't think the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig replace filter&lt;/a&gt; will allow for regex matches.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/228/how-can-i-perform-a-regex-match-in-twig&quot;&gt;According to this post&lt;/a&gt;, Twig only uses regular expressions with Comparisons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are third-party plugins which might work:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig PCRE Filters&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/low/low_regex/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Low Regex&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-08-03T21:23:34.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5357" PostTypeId="1" AcceptedAnswerId="5369" CreationDate="2014-12-19T14:34:26.003" Score="4" ViewCount="600" Body="&lt;p&gt;I'm building an API provider using Craft and need to implement some kind of client authentication. I don't need to worry about individual users, but I'd like to require that clients authenticate in some way. My current thinking is the client can pass an authorization header header of some kind, or just use basic authentication to access the content on the Craft CMS site, I'm just not sure how to consume the header on the Craft side &amp;amp; validate it before serving the content. Can anyone offer up some tips on how to implement something like this using Craft?&lt;/p&gt;&#xA;" OwnerUserId="500" LastActivityDate="2015-01-20T01:19:03.720" Title="Craft as an API provider &amp; authenticaton" Tags="&lt;authentication&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5358" PostTypeId="1" AcceptedAnswerId="6817" CreationDate="2014-12-19T15:27:11.477" Score="2" ViewCount="1737" Body="&lt;p&gt;I want to display blog entries within the related entry template linked together with 'entries fields':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-- Entrysection Bla&#xA;&#xA;Blog&#xA;-- Blog entry 1 (Linked to Entrysection Bla via 'entries fields')&#xA;-- Blog entry 2 (no relations)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to display &lt;code&gt;Blog entry 1&lt;/code&gt; in &lt;code&gt;Entrysection Bla&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('bla') %}&#xA;  {% for entries_fields in craft.entries.section('blog'){# related to ??? #} %}&#xA;     &amp;lt;a href=&quot;{{ entries_fields.url }}&quot;&amp;gt;{{ entries_fields.title }}&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figured it has to be done with &lt;code&gt;relatedTo&lt;/code&gt; but I cant get it done. How do I have to write this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my code on &lt;code&gt;Entrysection Bla&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries_fields = craft.entries.section('blog').relatedTo({&#xA;   sourceElement: entry,&#xA;   field: 'blogSaisonKategorie'&#xA;}) %}&#xA;&#xA;{% for xy in entries_fields %}&#xA;   &amp;lt;a href=&quot;{{ xy.url }}&quot;&amp;gt;{{ xy.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That prints out nothing. No error is displayed as well.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2014-12-19T16:44:21.947" LastActivityDate="2015-01-27T09:41:02.990" Title="Display entries based on 'entries fields'" Tags="&lt;relations&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5359" PostTypeId="2" ParentId="5358" CreationDate="2014-12-19T15:46:12.910" Score="2" Body="&lt;p&gt;You are correct in your assumption! Using &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; with the associated field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries_fields = craft.entries.section('blog').relatedTo({&#xA;    sourceElement: entry,&#xA;    field: 'fieldHandle'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;field&lt;/code&gt; can be the field handle of your Entries Field but it can also be a field ID.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2014-12-19T15:46:12.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5360" PostTypeId="1" CreationDate="2014-12-19T22:03:31.507" Score="0" ViewCount="51" Body="&lt;p&gt;I found this ( &lt;a href=&quot;http://www.pbteen.com/products/oversized-chalkboard-organization/&quot; rel=&quot;nofollow&quot;&gt;http://www.pbteen.com/products/oversized-chalkboard-organization/&lt;/a&gt; ) on PB Teens and Pinterest and fell in love. It's perfect for me but at a price of around £200 is a bit ridiculous! Anybody got any ideas on how I might DIY this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :) &lt;/p&gt;&#xA;" OwnerUserId="1123" LastActivityDate="2014-12-20T02:28:26.603" Title="How can I make an oversized chalkboard organiser?" Tags="&lt;tags&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2014-12-20T06:07:54.473" ContentLicense="CC BY-SA 3.0" />
  <row Id="5361" PostTypeId="2" ParentId="5360" CreationDate="2014-12-20T00:47:31.813" Score="5" Body="&lt;p&gt;Definitely use a custom Element Type.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2014-12-20T00:47:31.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5362" PostTypeId="1" AcceptedAnswerId="5364" CreationDate="2014-12-20T00:57:43.980" Score="2" ViewCount="7328" Body="&lt;p&gt;I've run into this error from time to time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Failed to load resource: net::ERR_CACHE_MISS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've seen it being thrown by several different files.  I don't know how to trigger it to better explain how to recreate the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does it mean?  What can I do to get it to disappear?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-11-18T09:10:48.027" Title="Failed to load resource: net::ERR_CACHE_MISS" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5363" PostTypeId="2" ParentId="5360" CreationDate="2014-12-20T02:28:26.603" Score="0" Body="&lt;p&gt;Definitely gotta have a chalkboard font as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.fontspace.com/category/chalkboard&quot; rel=&quot;nofollow&quot;&gt;http://www.fontspace.com/category/chalkboard&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;;)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2014-12-20T02:28:26.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5364" PostTypeId="2" ParentId="5362" CreationDate="2014-12-20T03:30:43.457" Score="3" Body="&lt;p&gt;Nothing related to Craft at all, but a &lt;a href=&quot;https://code.google.com/p/chromium/issues/detail?id=424599#c23&quot; rel=&quot;nofollow&quot;&gt;Chrome bug&lt;/a&gt;.  Has been fixed in v40 in the dev channel and will eventually make it into stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/26408931/bizarre-error-in-chrome-developer-console-failed-to-load-resource-neterr-ca&quot;&gt;https://stackoverflow.com/questions/26408931/bizarre-error-in-chrome-developer-console-failed-to-load-resource-neterr-ca&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I agree, it's a really annoying bug.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-20T03:30:43.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5365" PostTypeId="1" AcceptedAnswerId="5366" CreationDate="2014-12-20T05:35:41.970" Score="6" ViewCount="424" Body="&lt;p&gt;I'm trying to build my blog functionality with craft, and struggling to get the functionality of showing &quot;when&quot; that post was created. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Posted X days ago,&#xA;Posted x Weeks ago,&#xA;Posted x Months ago,&lt;/p&gt;&#xA;" OwnerUserId="937" LastActivityDate="2014-12-20T06:28:48.283" Title="How to replicate &quot;X days posted ago&quot;" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5366" PostTypeId="2" ParentId="5365" CreationDate="2014-12-20T06:28:48.283" Score="8" Body="&lt;p&gt;Straight Up Craft has a solid list of plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nice time is most likely the one you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/craft-plugins/nice-time&quot;&gt;http://straightupcraft.com/craft-plugins/nice-time&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-12-20T06:28:48.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5367" PostTypeId="2" ParentId="5342" CreationDate="2014-12-20T19:09:01.543" Score="1" Body="&lt;p&gt;Like Douglas suggested, you may not have the JS file you need so make sure you download the latest build and upload the files. &lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2014-12-20T19:09:01.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5368" PostTypeId="1" AcceptedAnswerId="5407" CreationDate="2014-12-20T21:14:57.010" Score="2" ViewCount="166" Body="&lt;p&gt;I've developed a custom menus plugin which has been working great&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/familiar-studio/craft-menus&quot; rel=&quot;nofollow&quot;&gt;https://github.com/familiar-studio/craft-menus&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to get it work with the build in template caching and realizing the reorder actions are not triggering the caches to clear properly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template is using the &quot;getNodes(menuHandle)&quot; variable&#xA;&lt;a href=&quot;https://github.com/familiar-studio/craft-menus/blob/master/menus/variables/MenusVariable.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/familiar-studio/craft-menus/blob/master/menus/variables/MenusVariable.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which just uses standard element criteria? We are also using native structures so is there some way to specifically tell it to clear on reordering as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; here is the code thats in my _layout that im hoping will clear when i reorder or add new elements&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  &amp;lt;ul class=&quot;nav navbar-nav navbar-right&quot;&amp;gt;&#xA;      {% nav node in craft.menus.getNodes('utilityMenu') %}&#xA;         &amp;lt;li class=&quot;{{ node.children|length ? 'dropdown' }}&#xA;            {{ node.active ? 'active' }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;a href=&quot;{{node.link}}&quot;&#xA;                {% if node.children|length %}&#xA;                   class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&#xA;                {% endif %}&amp;gt;&#xA;&#xA;                {{ node.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;            {% ifchildren %}&#xA;&#xA;                &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;arrow&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;     {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endcache %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2:&lt;/strong&gt; So on deeper investivation it appears that the issue is only that it doesnt clear the cache when the structure is reordered, editing and saving nodes seems to clear it after all.&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="183" LastEditDate="2014-12-21T01:46:08.213" LastActivityDate="2016-01-14T23:30:29.227" Title="Automatic cache clearing when reordering custom element type" Tags="&lt;cache&gt;&lt;elementtype&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5369" PostTypeId="2" ParentId="5357" CreationDate="2014-12-21T00:47:37.253" Score="1" Body="&lt;p&gt;It sounds like you're not necessarily interested in authenticating against Craft's current users, but you just want &lt;em&gt;some&lt;/em&gt; type of header authentication in place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set those header (via whatever means) in the API request, you can have a plugin's controller read those via &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/HeaderHelper.php#L230&quot; rel=&quot;nofollow&quot;&gt;HeaderHelper::getHelper($headerName)&lt;/a&gt; and perform whatever authentication logic that you require.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If authentication passes, let the request go through, if not, you can &lt;code&gt;throw new HttpException(503);&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-21T00:47:37.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5370" PostTypeId="2" ParentId="5351" CreationDate="2014-12-21T00:58:18.267" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to hook into the current request before the template gets rendered? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure, Craft does this in several places in the Control Panel itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plugin can &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;registerCpRoutes&lt;/a&gt; hook.  From there, you'd define an action route like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'cocktails/(?P&amp;lt;widgetId&amp;gt;\d+)' =&amp;gt; array('action' =&amp;gt; 'cocktails/editCocktail'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will send the request to your plugin's CocktailsController's &lt;code&gt;actionEditCocktail&lt;/code&gt;.  There you can prep any data that you want and pass it off to a template to render:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$variables['name'] = 'Martini';&#xA;$variables['ingredients'] = array('Gin', 'Olives');&#xA;&#xA;$this-&amp;gt;renderTemplate('cocktails/_edit', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And access those from the template via &lt;code&gt;{{ entry.name }}&lt;/code&gt; or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for ingredient in entry.ingredients %}&#xA;    {{ ingredient }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Additionally this would allow me to use another template engine then twig.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing how you'd easily be able to do this, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/a/1407/57&quot;&gt;Hooks&lt;/a&gt;, which might get you where you're going.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2014-12-21T22:13:38.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5371" PostTypeId="2" ParentId="5368" CreationDate="2014-12-21T01:05:17.437" Score="0" Body="&lt;p&gt;It sounds like you're trying to use the cache tag for your plugin's template files from inside the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, don't. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tag was designed purely to be used for front-end site templates.  You'll run into all sorts of weirdness using it from templates in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-21T01:05:17.437" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5372" PostTypeId="1" AcceptedAnswerId="5374" CreationDate="2014-12-21T04:34:24.017" Score="3" ViewCount="848" Body="&lt;p&gt;If I have a section called &quot;news&quot; with section type &quot;channel&quot; with entries having their own URLs, what is best practice for creating an index for when people site.com/news?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I just create an index file in 'template/news' or should I create a route?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Did some more digging! Looks like some users have recommended using Structure to create parent level pages. Is this an ideal method?&lt;/p&gt;&#xA;" OwnerUserId="1124" LastEditorUserId="1124" LastEditDate="2014-12-21T04:52:46.790" LastActivityDate="2014-12-21T06:32:50.060" Title="What's best practice for creating an index page for Channels?" Tags="&lt;routes&gt;&lt;best-practice&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5373" PostTypeId="1" CreationDate="2014-12-21T06:03:33.503" Score="1" ViewCount="235" Body="&lt;p&gt;If I have a rich text field containing a link to an asset and I create the link on my development server &lt;code&gt;sample.craft.dev&lt;/code&gt;, the html in the rich text field contains this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;http://sample.craft.dev/uploads/pdfs/file.pdf#asset:945:url&quot;&amp;gt;the file&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I then move the database to my staging server &lt;code&gt;stage.sample.com&lt;/code&gt;, the html in the rich text field now magically contains the new url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;http://stage.sample.com/uploads/pdfs/file.pdf#asset:945:url&quot;&amp;gt;the file&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How does that happen?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the html in the rich text field on the development server instead contains this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select class=&quot;jumpMenu js_jumpMenu&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot;&amp;gt;-- select brochure --&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;http://stage.sample.com/uploads/pdfs/file.pdf#asset:969:url&quot;&amp;gt;The File&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the url is not rewritten. Why is that?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-21T06:03:33.503" Title="How do asset and entry urls in rich text fields change with the environment?" Tags="&lt;richtext&gt;&lt;multi-environment&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5374" PostTypeId="2" ParentId="5372" CreationDate="2014-12-21T06:32:50.060" Score="3" Body="&lt;p&gt;If you are using a Structure to manage your site hierarchy, and the news index page naturally falls in that hierarchy, then yes, this can work well. Make an &lt;code&gt;entry type&lt;/code&gt; for the index page, and in your template (which is the same for all the entry types),&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ['_page/'~entry.type, '_page/_default'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(So if you haven't defined a template for this &lt;code&gt;entry type&lt;/code&gt; you will use the &lt;code&gt;_page/_default.html&lt;/code&gt; template instead of getting an error).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is a good idea to use an entry for the index page (rather than just an index template) because there is very likely to be some content on that page other than just the list of news items, and you will want the CMS to manage that content for you.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-21T06:32:50.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5375" PostTypeId="1" CreationDate="2014-12-21T14:34:17.160" Score="0" ViewCount="2622" Body="&lt;p&gt;This is my second website I am building with craft cms and I have no prior experience with Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have had a particular issue with echoing image assets from a singles entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The line I copied from my previous website with craft was;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;teamsimagebg&quot; style=&quot;background-image:url({% if entry.teamImage1 | length %}{% for asset in entry.teamImage1 %}{{ asset.url }}{% endfor %}{% endif %});&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Field handles were updated correctly and yet on the template page the image is not displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After looking into this I found the following;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.teamImage1.first() %}&#xA;&#xA;{% if asset %}&#xA;    {{ asset.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This had no effect either.&lt;/p&gt;&#xA;" OwnerUserId="1125" LastActivityDate="2014-12-31T18:52:50.940" Title="Image asset not being displayed" Tags="&lt;templating&gt;&lt;assets&gt;&lt;field&gt;&lt;image&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5376" PostTypeId="1" CreationDate="2014-12-21T17:24:56.047" Score="2" ViewCount="132" Body="&lt;p&gt;In Assets for ExpressionEngine the file chooser will remember the folder from which an image was last selected, even if picking images from across instances of Assets fields in different Matrix rows. It saves a lot of time when populating large galleries such as in a photographic portfolio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing doesn't seem to be true of Assets in Craft though - each time I open the file chooser, unless it's the same Assets field I'm adding to or replacing into, I have to go from the root folder and find the correct sub-folder again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I'm hoping there's a nifty config item somewhere which will set 'remember last folder' to true...?&lt;/p&gt;&#xA;" OwnerUserId="470" LastActivityDate="2014-12-21T17:24:56.047" Title="How to get Assets to remember last folder in file chooser?" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ClosedDate="2015-02-20T00:58:26.797" ContentLicense="CC BY-SA 3.0" />
  <row Id="5377" PostTypeId="1" CreationDate="2014-12-22T00:37:45.820" Score="4" ViewCount="967" Body="&lt;p&gt;Figure I'd query with the geniuses over on StackExchange as I think I've hit a roadblock in my project. I'm building a website containing menus from multiple restaurants with the vision that it could eventually grow to become a local online food ordering marketplace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking into consideration the e-commerce plugins currently in development, I'm going to make an assumption that a single product would constitute as a single entry with these add-ons, so this makes the hierarchy of data a bit of a challenge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some requirements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Menu items need to be associated with a restaurant.&lt;/li&gt;&#xA;&lt;li&gt;Menu items need to be categorized, but categories are unique per&#xA;restaurant&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've played with various configurations thus far and haven't really found a method that I'd deem &quot;ideal.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've considered using Structure exclusively where parent items would be the restaurants and children would be the menu categories with the items nested beneath. What are your thoughts on this? Could use a few different entry types for indexes and one for menu items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I'm using a combination of related entries, an Inverse related entries plugin for informational purposes where restaurants are also channels, but just doesn't seem like a sensible approach so far, so probably scrapping this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts, advice, any feedback really appreciated. Thank you so much!&lt;/p&gt;&#xA;" OwnerUserId="1124" LastActivityDate="2014-12-25T22:54:08.020" Title="Building a website containing restaurant menus from multiple vendors -- need some advice on Section hierarchy of data" Tags="&lt;structure&gt;&lt;sections&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5378" PostTypeId="2" ParentId="5377" CreationDate="2014-12-22T08:01:18.473" Score="4" Body="&lt;p&gt;Ok, just spitballing here, but this is where my brain is going...&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Channel: Restaurants&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each restaurant is a unique entity, correct? So they wouldn't need to be in any specific order, nor nested. (Chain restaurants could be related by other means.) All of your broad restaurant-based fields would be here, including location, phone number, hours of operation, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Channel: Menu&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel the menu should be a separate channel from the parent restaurants for a couple of reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Seasonal/specialty menus:&lt;/strong&gt; One restaurant, many menus.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Chain restaurants would share a menu:&lt;/strong&gt; Many restaurants, one menu.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Within your Restaurants channel, create an Entries field (with a limit of 1) called &quot;Menu&quot;. So each restaurant could select its current menu.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matrix: Menu Items&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within your Menu channel, you'd have a Menu Options matrix field. &lt;strong&gt;Each menu option would be its own matrix block.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use the built-in category system, you may be able to create Category Groups based on different restaurant &lt;em&gt;genres&lt;/em&gt; (Mexican, Thai, etc). You could then simply use those very broadly. However, I'd be concerned that those broad categories don't properly address the needs of each &lt;em&gt;individual&lt;/em&gt; restaurant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you may end up needing to create faux categories... I'm not sure you could get the normal category system to work for you here. There would be such wide-ranging variations between the categories of different restaurants, it would be a nightmare to keep up with that using the standard categorization options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Faux Categories&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially create a dropdown menu to represent your &quot;categories&quot; for a particular restaurant. That faux categories menu could be driven by the amazingly powerful &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;LJ Dynamic Fields plugin&lt;/a&gt;. Might take a little trial &amp;amp; error, but that plugin will allow you to build a dropdown menu to be exactly as you need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this method, you could allow each Menu to have its own definition of categories. Create a table field called &quot;Categories&quot; in your Menu section, and allow LJ Dynamic Fields to take advantage of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;eCommerce Options&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see why you'd gravitate towards making each menu item into its own entry, but I don't believe that's necessary. Take a look at some of the more generic, non-Craft options for building your checkout process. Specifically &lt;strong&gt;Snipcart&lt;/strong&gt; and &lt;strong&gt;Foxycart&lt;/strong&gt; allow you to render a product however you want to, and don't restrict your back-end data to any particular architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My instinct is telling me that your menu options would be much better suited as a matrix field (or even table field), rather than being their own entries.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, even if it just gives you some new ideas to kick around! :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-12-22T08:01:18.473" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5379" PostTypeId="1" CreationDate="2014-12-22T14:37:44.800" Score="2" ViewCount="127" Body="&lt;p&gt;I have code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set tags = entry.q_tags %}&#xA;    {% set entries = craft.entries.relatedTo(tags).order('score').find() %}&#xA;    {% for item in entries %}&#xA;      {% if item.id != entry.id %}&#xA;         .......&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how to do that similar entries displayed order with the greatest coincidence tags?&#xA;Thank you. Sorry for my english&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2014-12-23T11:32:15.410" LastActivityDate="2015-08-23T05:47:52.653" Title="Similar entries with the greatest coincidence tags" Tags="&lt;entries&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5380" PostTypeId="1" CreationDate="2014-12-22T15:50:26.570" Score="4" ViewCount="4357" Body="&lt;p&gt;When i enter HTML into redactor below it will strip out the first closing div and the second opening div leaving one col-md-6.  It actually saves it as I have below but as soon as redactor is re-initialised it strips out the closing and opening tag in the middle again.  This means no one can ever go in an edit the content as it will be a single column again once saved. Current setup of redactor is below and I have unchecked the clean HTML.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;One Col&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;One Col&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Redactor JSON config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;        buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;        plugins: ['fullscreen'],&#xA;        toolbarFixedBox: true,&#xA;        replaceDivs: false&#xA;        replaceDivs: false,&#xA;        paragraphize: false,&#xA;        removeEmpty: ['strong', 'em', 'span', 'p']&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I can get it just to accept the HTML we enter without problems?&lt;/p&gt;&#xA;" OwnerUserId="1128" LastActivityDate="2016-02-18T18:46:32.440" Title="HTML being stripped/replaced by redactor on initialising despite being saved correctly" Tags="&lt;redactor&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5382" PostTypeId="1" CreationDate="2014-12-22T18:39:33.550" Score="2" ViewCount="436" Body="&lt;p&gt;I have a news website build with free version of Craft 2.3. It's obvious that a news website will have a lots of entries and lots of photos per entry. It will have at least one per entry and could go up to 10 or more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after few months I will have 100s of photos and I was thinking how I can manage this? Will this slow down the system when accessing the assets folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I use a field with a subfolder which contains variables like {slug} or {author.username}? But the problem is that I cannot search on assets subfolders or see all the subfolders at the same time so I can search within folder and its subfolders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone came accross to this problem? I'm coming from EE and I love craft just trying to make the transition. In EE I was using devdemon channel images which was creating a subfolder per upload but it had the option to search the subfolders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="1129" LastActivityDate="2014-12-22T20:32:15.587" Title="What's the best way to manage a large number of uploaded photos?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5383" PostTypeId="2" ParentId="5382" CreationDate="2014-12-22T20:32:15.587" Score="2" Body="&lt;p&gt;Sounds like a feature request is in order. It'd be nice to be able to search subfolders for sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, everyone has their own way to organize but you might create folders based on department or whatever category the news is in—sports, politicians, people, religion, places, etc. and then set up the asset to save automatically in that folder based on the category, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As someone who's on that content editing side as well, whatever system you setup, keep it consistent, make sure everyone uses it, is on board with it, and sticks with it. This is not just a technology problem but a people problem. Technology is only as good as the people who are using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I worked for a local TV station doing over the shoulder graphics years ago, we'd have our goto images that we used and I've found over the years doing web it's the same way—people are creatures of habit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the site first launches, you throw tons of content at it but down the road, I've found people tend to reuse a lot of stuff. I mean how many different shots of the grand canyon do you need? I don't think every story, every time is going to have a new image thrown at it, but they will recycle a fair amount, so keep that in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a plugin called Introvert that you can setup so you can see reverse entries. That might be helpful to see which other entries that an asset is using. If it's been used by a lot of other entries, it might be time to say &quot;hey we need another image of this...&quot;&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2014-12-22T20:32:15.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5384" PostTypeId="1" AcceptedAnswerId="5386" CreationDate="2014-12-23T04:39:39.137" Score="4" ViewCount="372" Body="&lt;p&gt;Is it possible to configure redactor so it will only accept a single line of text and not wrap it's content in a paragraph tag? Essentially, I'm looking to allow an editor to submit some formatted text (bold, italic, links) but place that inside an existing paragraph tag that is coming out of my templates.&lt;/p&gt;&#xA;" OwnerUserId="513" LastActivityDate="2015-04-13T13:07:16.570" Title="Redactor Single Line Mode" Tags="&lt;templating&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5385" PostTypeId="1" AcceptedAnswerId="5391" CreationDate="2014-12-23T06:51:14.163" Score="5" ViewCount="1754" Body="&lt;p&gt;I'm testing with the Foxycart Plugin to update the stock in my code.&#xA;In the FoxyCartController.php I'm able to filter through the XML feed ok and get the new Stock value but it's doesn't seem to be getting saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code which picks up the correct product and $newQuantity value ok - but it doesn't seem to save the $newQuantity value back to the stock field in the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//If you have custom code to run for each product, put it here:&#xA;&#xA;$service = craft()-&amp;gt;entries;&#xA;&#xA;    $entry = $service-&amp;gt;getEntryById($product_code);&#xA;&#xA;    if ($entry != null) {&#xA;        $attrs = $entry-&amp;gt;getContent();&#xA;&#xA;        $newQuantity = $attrs['stock'] - $product_quantity;&#xA;&#xA;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'stock' =&amp;gt; $newQuantity&#xA;        ));&#xA;&#xA;        $service-&amp;gt;saveEntry($entry);&#xA;&#xA;        //return $entry;&#xA;    } else {&#xA;        //return null;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="622" LastEditDate="2014-12-23T13:14:23.293" LastActivityDate="2014-12-23T22:21:10.540" Title="Plugin Controller - Save Entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugins&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5386" PostTypeId="2" ParentId="5384" CreationDate="2014-12-23T09:52:54.180" Score="4" Body="&lt;p&gt;In &lt;code&gt;craft/config/redactor/...json&lt;/code&gt; add a line &lt;code&gt;paragraphize: false&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="635" LastActivityDate="2014-12-23T09:52:54.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5387" PostTypeId="2" ParentId="5334" CreationDate="2014-12-23T14:42:08.340" Score="2" Body="&lt;p&gt;I decided to try a different approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made two dropdown fields &quot;studentlevel&quot;, one for the user where the admin can set the level from 1 to 12 and one in a matrix block with the video's, also from 1 to 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.videos %}&#xA;   {% if currentUser.studentlevel &amp;lt;= block.studentlevel %} &#xA;      video here&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the studentgroup has no access to the CP, they can't change it and they'll only see the video up to their skill level.&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2014-12-23T14:42:08.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5388" PostTypeId="1" AcceptedAnswerId="5392" CreationDate="2014-12-23T14:58:02.743" Score="1" ViewCount="961" Body="&lt;p&gt;I've just set up an S3 bucket and have a transform in my template. Should these transformed images be saved on S3? It doesn't look like they are, however my template is pulling out an S3 URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl(resize) }}&quot; width=&quot;{{ asset.getWidth(resize) }}&quot; height=&quot;{{ asset.getHeight(resize) }}&quot; alt=&quot;A photograph of {{ entry.title }}&quot; class=&quot;grayscale grayscale-fade wp-post-image ral-mugshot&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When using a base image at &lt;a href=&quot;http://s3-eu-west-1.amazonaws.com/rallyagency/princess-leia-princess-leia-walking-in-new-york-is-just-plain-awesome.jpeg&quot; rel=&quot;nofollow&quot;&gt;http://s3-eu-west-1.amazonaws.com/rallyagency/princess-leia-princess-leia-walking-in-new-york-is-just-plain-awesome.jpeg&lt;/a&gt;, my template outputs this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;http://s3-eu-west-1.amazonaws.com/rallyagency/_200x200_crop_center-center_75/princess-leia-princess-leia-walking-in-new-york-is-just-plain-awesome.jpeg?mtime=20141217123237&quot; width=&quot;200&quot; height=&quot;200&quot; alt=&quot;A photograph of Ali Meredith&quot; class=&quot;grayscale grayscale-fade wp-post-image ral-mugshot&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the addition of the directory &lt;strong&gt;_200x200_crop_center-center_75&lt;/strong&gt; in the path - that doesn't exist on the S3 bucket.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2014-12-23T16:52:52.097" Title="Asset transforms saved on S3 storage" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5389" PostTypeId="1" AcceptedAnswerId="5464" CreationDate="2014-12-23T15:30:26.513" Score="4" ViewCount="661" Body="&lt;p&gt;Here's my scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure section: &quot;events&quot;. Within that I have three entry types: &quot;events&quot;, &quot;exhibitions&quot;, &quot;specials&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the events to follow the following URL structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{type}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far no problem, since the entry type handles are defined in English. But when it comes to the Norwegian page, I want to use the Norwegian translation for each type: &quot;arrangement&quot;, &quot;utstilinger&quot;, &quot;spesielle&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I added in the translations to my static translation file, and tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{type|translate}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But obviously, since I'm here, I didn't have any luck. Can anyone think of a way to achieve the desired result, without resorting to adding a custom field to each entry type that would need to be filled in for every entry to use in place of &lt;code&gt;{type}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2015-01-05T12:56:10.300" Title="Can I use translated properties for URL formats" Tags="&lt;url&gt;&lt;sections&gt;&lt;entry-type&gt;&lt;slug&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5390" PostTypeId="2" ParentId="5389" CreationDate="2014-12-23T15:54:04.867" Score="1" Body="&lt;p&gt;It works for me to use &lt;code&gt;{type|t}/{slug}&lt;/code&gt; as an url format. Just make sure you make the translations before you save the entry (in the translated language). Or go back and resave the entries. The url is translated and saved at the time you save the entry, it's not updated automatically if you change the translations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;br&gt;&#xA;Sorry, I spoke a bit too fast. After some more testing, it seems like I was fooled by the fact that it actually translates the string to the locale you, as a user, has when editing the entry. So, I made an entry with type exhibition, created the translation to norwegian, resaved the norwegian version of the entry, and confirmed that the type had been translated. But, the next time I saved the english version, that url was translated too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It actually makes sense that this is the way the translate filter works. It translates based on the users current locale, not the locale of the versioned entry. Maybe it would be possible to make a new twig filter (as a plugin), that translates based on the locale of the entry, and use that filter in the url format. Not sure how you'd get the entry local passed to the filter though..&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2014-12-24T11:55:12.793" LastActivityDate="2014-12-24T11:55:12.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5391" PostTypeId="2" ParentId="5385" CreationDate="2014-12-23T16:50:18.797" Score="4" Body="&lt;p&gt;You're likely getting a validation error that you're not checking for.  Do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($entry-&amp;gt;validate())&#xA;{&#xA;    $service-&amp;gt;saveEntry($entry);&#xA;}&#xA;else&#xA;{&#xA;    $errors = $entry-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you get anything if you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$service-&amp;gt;saveEntry($entry))&#xA;{&#xA;    $errors = $entry-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2014-12-23T22:21:10.540" LastActivityDate="2014-12-23T22:21:10.540" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="5392" PostTypeId="2" ParentId="5388" CreationDate="2014-12-23T16:52:52.097" Score="1" Body="&lt;p&gt;If I recall, they should get created on S3 and also cached locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I try to load &lt;a href=&quot;https://s3-eu-west-1.amazonaws.com/rallyagency/_200x200_crop_center-center_75/princess-leia-princess-leia-walking-in-new-york-is-just-plain-awesome.jpeg?mtime=20141217123237&quot; rel=&quot;nofollow&quot;&gt;https://s3-eu-west-1.amazonaws.com/rallyagency/_200x200_crop_center-center_75/princess-leia-princess-leia-walking-in-new-york-is-just-plain-awesome.jpeg?mtime=20141217123237&lt;/a&gt; directly, I'm getting an &quot;Access Denied&quot; error, so it looks like you've got some S3 permission issues.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-23T16:52:52.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5393" PostTypeId="1" CreationDate="2014-12-24T03:17:01.593" Score="0" ViewCount="149" Body="&lt;p&gt;Is it possible to include an &lt;a href=&quot;http://straightupcraft.com/craft-plugins/a-m-navigation&quot; rel=&quot;nofollow&quot;&gt;A&amp;amp;M Nav&lt;/a&gt; menu in an entry? &#xA;I know Wordpress uses shortcodes for such things.  I see there is also a shortcodes plugin, but is it difficult to adapt A&amp;amp;M nav into that?&lt;/p&gt;&#xA;" OwnerUserId="1049" LastEditorUserId="1049" LastEditDate="2014-12-24T19:13:22.687" LastActivityDate="2014-12-24T19:13:22.687" Title="Use A&amp;M Nav menu in entry" Tags="&lt;navigation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5394" PostTypeId="1" AcceptedAnswerId="5396" CreationDate="2014-12-24T11:37:31.377" Score="1" ViewCount="225" Body="&lt;p&gt;I wish to show the search query inside the page template but my logic seems to be off and just shows {{ query }} as a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set title = &quot;Search results for: {{ query }}&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-12-24T16:25:10.787" Title="passing the search query into html title tag" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5395" PostTypeId="2" ParentId="5394" CreationDate="2014-12-24T12:06:58.513" Score="1" Body="&lt;p&gt;Ended up changing the title to a block within my layout template and doing thus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% block title %}Search results for: {{query}}{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2014-12-24T12:06:58.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5396" PostTypeId="2" ParentId="5394" CreationDate="2014-12-24T16:25:10.787" Score="5" Body="&lt;p&gt;You should be able to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;Search results for: &quot; ~ query %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-12-24T16:25:10.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5397" PostTypeId="2" ParentId="5019" CreationDate="2014-12-24T17:01:32.303" Score="2" Body="&lt;p&gt;Just saw this, it is possible without building a plugin by hacking the standard contactform plugin. In the file contactformservive.php add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;cc = array(&#xA;    array('name' =&amp;gt; $message-&amp;gt;fromName, 'email' =&amp;gt; $message-&amp;gt;replyTo)&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;after $email-&gt;body &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will send an EXACT copy to the form submitter. It has one drawback that I noticed; the reply address is also the submitter, so if he/she wants to answer that mail it will return to him/herself. You could add a notion in the body with a standard reply address to prevent this. &lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2015-01-02T13:08:05.780" LastActivityDate="2015-01-02T13:08:05.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5398" PostTypeId="2" ParentId="5380" CreationDate="2014-12-24T19:43:59.627" Score="3" Body="&lt;p&gt;Have you tried using the &lt;code&gt;allowedTags&lt;/code&gt; attribute in your Redactor config?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#redactor').redactor({&#xA;    allowedTags: ['div','p', 'h1', 'h2', 'pre']&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read about that here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-allowedTags&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-allowedTags&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2014-12-24T19:43:59.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5399" PostTypeId="1" CreationDate="2014-12-24T20:49:38.780" Score="1" ViewCount="1469" Body="&lt;p&gt;Hi I was trying to save the matrix field and got the error:&#xA;&quot;Internal Server Error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Undefined index: handle&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked out all fields' handles and they are all in place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any reason causing the error?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CQWq0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3RD79.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1131" LastEditorUserId="1131" LastEditDate="2015-01-05T17:05:46.407" LastActivityDate="2018-06-03T21:01:46.810" Title="Get &quot;Internal Server Error Undefined index: handle&quot;" Tags="&lt;matrix&gt;&lt;database&gt;&lt;server&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5400" PostTypeId="1" AcceptedAnswerId="5420" CreationDate="2014-12-24T21:09:01.107" Score="4" ViewCount="3831" Body="&lt;p&gt;Originally at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5313/include-a-template-that-sets-variables-global-template-variables/5318?noredirect=1#comment6287_5318&quot;&gt;Include a template that sets variables (global template variables)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a number of templates and layouts but every layout includes a global header in which the meta data is displayed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That data always comes from the entry you are viewing and currently I'm setting the variables the global header needs in each template, such as /news/index.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_listing_layout&quot; %}&#xA;&#xA;{% set metaTitle = (entry.metaTitle) ? entry.metaTitle : entry.title %}&#xA;{% set metaDescription = entry.metaDescription %}&#xA;{% set metaKeywords = entry.metaKeywords %}&#xA;{% set metaRobots = entry.metaRobots %}&#xA;{% set openGraphImage = entry.openGraphImage.first() %}&#xA;&#xA;{% if openGraphImage %}&#xA;&#xA;    {% set ogCrop = {&#xA;        mode: 'crop',&#xA;        width: 1200,&#xA;        height: 630,&#xA;        quality: 75,&#xA;        position: 'center'&#xA;    } %}&#xA;&#xA;    {% set openGraphImage = openGraphImage.getUrl(ogCrop) %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% set listingSection = &quot;newsArticles&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% include '_partials/_isotope.html' %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The layout is super simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/_global_header.html' %}&#xA;&#xA;    {% block content %}{% endblock %}&#xA;&#xA;{% if craft.request.firstSegment %}&#xA;&#xA;    {% include '_partials/_global_footer.html' %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% include '_partials/_home_footer.html' %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then the global header partial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;!--[if lt IE 7]&amp;gt;      &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8 lt-ie7&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 7]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 8]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if gt IE 8]&amp;gt;&amp;lt;!--&amp;gt; &amp;lt;html lang=&quot;en-gb&quot; dir=&quot;ltr&quot; class=&quot;no-js&quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;&#xA;&#xA;    &amp;lt;head&amp;gt;&#xA;&#xA;        {# meta #}&#xA;        &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;        &amp;lt;title&amp;gt;{% if metaTitle is defined %}{{ metaTitle }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&#xA;        {# seo #}&#xA;        &amp;lt;meta name=&quot;description&quot; content=&quot;{% if metaDescription is defined %}{{ metaDescription }}{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;meta name=&quot;keywords&quot; content=&quot;{% if metaKeywords is defined %}{{ metaKeywords }}{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;        &amp;lt;meta name=&quot;robots&quot; content=&quot;{% if metaRobots is defined %}{{ metaRobots }}{% else %}index,follow{% endif %}&quot;&amp;gt;&#xA;&#xA;        {# open graph #}&#xA;        &amp;lt;meta property=&quot;og:site_name&quot; content=&quot;{{ siteName }}&quot;&amp;gt;&#xA;        &amp;lt;meta property=&quot;og:type&quot; content=&quot;website&quot;&amp;gt;&#xA;        &amp;lt;meta property=&quot;og:title&quot; content=&quot;{% if metaTitle is defined %}{{ metaTitle }} - {% endif %}{{ siteName }}&quot;&amp;gt;&#xA;        &amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;        &amp;lt;meta property=&quot;og:image&quot; content=&quot;{% if openGraphImage is defined %}{{ openGraphImage }}{% else %}{{ siteUrl }}images/og-default.jpg{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;meta property=&quot;og:description&quot; content=&quot;{% if metaDescription is defined %}{{ metaDescription }}{% endif %}&quot;&amp;gt;&#xA;&#xA;...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I keep this variable code DRY? I've tried putting direct in the header partial and layouts, but that doesn't work. And putting it in an included partial within each template throws a template error on account of the fact the template extends a layout and can't have a body.&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-20T02:41:09.023" Title="How can I globally set variables?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5401" PostTypeId="1" AcceptedAnswerId="5402" CreationDate="2014-12-25T14:55:30.180" Score="3" ViewCount="1692" Body="&lt;p&gt;I'm writing my first plugin and I'm slowly getting there, but I hit on a problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a controller class in which I have a function that sets a cookie.&#xA;I call on this function from within a template with &lt;code&gt;actionUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weird thing is, the cookie is being set (so the controller action is found and executed) but I still get a 404 page on the action path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody has an idea what could be wrong?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2014-12-25T17:34:19.057" Title="Controller action works but still gives 404" Tags="&lt;controller&gt;&lt;404-page&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5402" PostTypeId="2" ParentId="5401" CreationDate="2014-12-25T17:34:19.057" Score="8" Body="&lt;p&gt;You're definitely on the right track, just missing out on a couple of key details!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;actionUrl&lt;/code&gt; function generates a normal, full URL... &lt;em&gt;it's not (by default) an AJAX call&lt;/em&gt;. So your browser is actually navigating away from the previous page, and pinging your controller as a completely separate HTTP request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which leads to the next detail... Unless you're pinging your controller via AJAX, you need to then have your controller tell the request where to go. Don't forget, &lt;strong&gt;the request will continue on&lt;/strong&gt;, even after your controller has worked its magic.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot;&gt;... if the controller doesn’t call a response function, Craft will continue on with its request routing...&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you'll usually want to make sure your controller ends with a directive on what to do next. The most common options are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Render a template&lt;/li&gt;&#xA;&lt;li&gt;Redirect to a new page&lt;/li&gt;&#xA;&lt;li&gt;Return a JSON response (if you called it via AJAX)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The list of options to render/redirect/return are mixed in with the other &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#baseController-methods&quot;&gt;BaseController Methods in the documentation...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2014-12-25T17:34:19.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5403" PostTypeId="2" ParentId="5377" CreationDate="2014-12-25T22:54:08.020" Score="4" Body="&lt;p&gt;As suggested by Lyndsey D, use the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;LJ Dynamic Fields&lt;/a&gt; plugin with the following Twig code to create your dynamic dropdown menu. It appears that Craft doesn't have a built-in way for an entry to self-reference itself as you'd like, but we can use Twig's built in filters to get around this by getting the id directly from the URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisEntry = craft.entries.id(craft.request.getSegment(3) | split(&quot;-&quot;) | first).first %}&#xA;    {% if thisEntry.fauxCategories is defined %}&#xA;        {% for row in thisEntry.fauxCategories %}&#xA;        { &quot;value&quot;:&quot;{{ row.category | raw }}&quot; , &quot;label&quot;:&quot;{{ row.category | raw }}&quot; }&#xA;        {% if not loop.last %},{% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="146" LastActivityDate="2014-12-25T22:54:08.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5404" PostTypeId="1" AcceptedAnswerId="5410" CreationDate="2014-12-26T17:33:41.317" Score="2" ViewCount="244" Body="&lt;p&gt;I'd like to be able to fetch a list of tags from a blog section and then group them into ranges of letters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used this code to fetch and group a list of tags by first letter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;&#xA;{% set allTags = craft.tags.relatedTo({&#xA;  sourceElement: entries&#xA;}).order('name').limit(null) %}&#xA;&#xA;{% set allTagsGrouped = allTags|group('name | first') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what I'd like to do is to have groups for ranges of first letters like A–E, F–J, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end goal is to create an index of all of the tags in use, but group them under ranged letter headers instead of individual letter headers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2014-12-27T03:01:29.443" Title="How can I group a list of tags into ranges of first letters (A–E, F–J, etc.)?" Tags="&lt;tags&gt;&lt;group&gt;&lt;range&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5405" PostTypeId="1" AcceptedAnswerId="5409" CreationDate="2014-12-26T19:56:59.897" Score="2" ViewCount="1292" Body="&lt;p&gt;Several visitors, over the course of weeks, have mentioned receiving the following error when viewing the site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The log file shows the error (below). Not just once, but multiple times within a short time span. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone seen this error? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight as to what's going on here is appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2014/12/24 13:57:46 [warning] [application] The request to freegeoip.net failed: Server error response&#xA;[status code] 502&#xA;[reason phrase] Bad Gateway&#xA;[url] http://freegeoip.net/json/182.171.233.223&#xA;2014/12/24 13:57:46 [error] [system.db.CDbCommand] CDbCommand::fetch() failed: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. The SQL statement executed was: SELECT  'elements'.'id', 'elements'.'type'&#xA;FROM 'craft_elements' 'elements'&#xA;JOIN 'craft_elements_i18n' 'elements_i18n' ON elements_i18n.elementId = elements.id&#xA;WHERE (elements_i18n.uri = :uri) AND (elements_i18n.locale = :locale) AND (elements_i18n.enabled = 1) AND (elements.enabled = 1) AND (elements.archived = 0).&#xA;2014/12/24 13:57:46 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/framework/db/CDbCommand.php:543&#xA;Stack trace:&#xA;&#xA;#0 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/framework/db/CDbCommand.php(415): CDbCommand-&amp;gt;queryInternal('fetch', Array, Array)&#xA;#1 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/services/ElementsService.php(147): CDbCommand-&amp;gt;queryRow()&#xA;#2 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/etc/web/UrlManager.php(278): Craft\ElementsService-&amp;gt;getElementByUri('', 'en_us', true)&#xA;#3 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/etc/web/UrlManager.php(137): Craft\UrlManager-&amp;gt;_getMatchedElementRoute('')&#xA;#4 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/framework/web/CWebApplication.php(140): Craft\UrlManager-&amp;gt;parseUrl(Object(Craft\HttpRequestService))&#xA;#5 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/etc/web/WebApp.php(264): CWebApplication-&amp;gt;processRequest()&#xA;#6 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#7 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#8 /nfs/c06/h06/mnt/187742/domains/obozfootwear.com/html/index.php(14): require_once('/nfs/c06/h06/mn...')&#xA;#9 {main} &#xA;&#xA;REQUEST_URI=/HTTP_REFERER=http://www.google.co.jp/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCAQFjAA&amp;amp;url=http%3A%2F%2Fobozfootwear.com%2F&amp;amp;ei=8MWaVKfVBtGE8gWz-oKIBg&amp;amp;usg=AFQjCNGF_NGGtGdApatcXOoA3BYgIYOnZg&amp;amp;sig2=mmDpzpWjXopxNLsBnUTj6g&amp;amp;bvm=bv.82001339,d.dGc&#xA;&#xA;2014/12/24 13:57:46 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away&#xA;2014/12/24 13:57:46 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. The SQL statement executed was: SELECT `id`, `groupId`, `name`, `handle`, `context`, `instructions`, `translatable`, `type`, `settings`&#xA;FROM `craft_fields`&#xA;WHERE context = :context&#xA;ORDER BY `name`.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="476" LastActivityDate="2014-12-26T21:22:09.557" Title="Error: 2006 MySQL server has gone away" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5406" PostTypeId="1" CreationDate="2014-12-26T20:44:22.243" Score="2" ViewCount="528" Body="&lt;p&gt;I'm still a beginner with PHP so please bear with me. I've installed the Contact Form plugin for Craft by Pixel and Tonic, and have it configured to work as expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to have the form also send the data to a Zapier webhook URL so that it will automatically create a lead in my CRM system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting the webhook URL in the &quot;action&quot; field but does send the data correctly to Zapier, but the user goes to a status page (see screnshot below) and the form isn't mailed out to my email. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c1ahG.png&quot; alt=&quot;Screenshot of status message page.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or suggestions on the best way to accomplish this? &lt;/p&gt;&#xA;" OwnerUserId="1135" LastActivityDate="2014-12-28T06:53:08.933" Title="Pixel &amp; Tonic's Contact Form Plugin - POST submissions to Zapier Webhook URL?" Tags="&lt;form&gt;&lt;plugin-contactform&gt;&lt;hook&gt;&lt;post&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5407" PostTypeId="2" ParentId="5368" CreationDate="2014-12-26T21:00:25.033" Score="2" Body="&lt;p&gt;So i found an answer, was a little more manual but it works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a call back to the onMoveElement to automatically more manually clear the cache.  This was added to my plugins init() function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;structures-&amp;gt;onMoveElement = function(Event $event) {&#xA;      $element = $event-&amp;gt;params['element'];&#xA;      craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementId($element['id']);&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Was interesting to me that i only had to do this for reordering sturctures while adding/deleting elements automatically cleared the cache with no event code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this was a bug or by design?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2014-12-26T21:00:25.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5408" PostTypeId="2" ParentId="5406" CreationDate="2014-12-26T21:18:32.673" Score="2" Body="&lt;p&gt;By putting the webhook URL in the action field, you're completely bypassing the Contact Form's processing of the POST request and getting back a JSON response from Zapier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the correct way to do this would be to write your own custom Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that listens to Contact Form's &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#the-contactformbeforesend-event&quot; rel=&quot;nofollow&quot;&gt;beforeSend&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;event&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that event gets fired, you can make an AJAX request (using Guzzle or whatever) to Zapier's URL passing in the required fields, get the response back, do with it what you will, then let the Contact Form's controller finish executing and send them email.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="25" LastEditDate="2014-12-28T06:53:08.933" LastActivityDate="2014-12-28T06:53:08.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5409" PostTypeId="2" ParentId="5405" CreationDate="2014-12-26T21:22:09.557" Score="2" Body="&lt;p&gt;It looks like you might have the &lt;a href=&quot;https://craftpl.us/plugins/smart-map/&quot; rel=&quot;nofollow&quot;&gt;Smart Maps&lt;/a&gt; plugin installed.  There was a bug with earlier versions of it that had a similar error message.  Update to the latest version and it should be &lt;a href=&quot;https://craftpl.us/plugins/smart-map/change-log&quot; rel=&quot;nofollow&quot;&gt;resolved&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-26T21:22:09.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5410" PostTypeId="2" ParentId="5404" CreationDate="2014-12-27T03:01:29.443" Score="6" Body="&lt;p&gt;You can do this with the &lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE/&quot;&gt;twigPCRE&lt;/a&gt; filter. Once you have your &lt;code&gt;allTags&lt;/code&gt;, group them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTagsGrouped = allTags|group('name|first|upper|preg_replace(&quot;/[A-M]/&quot;, &quot;A-M&quot;, 1)|preg_replace(&quot;/[N-Z]/&quot;, &quot;N-Z&quot;, 1)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This takes the tag name, gets the first character, converts it to uppercase (so 'a' and 'A' are grouped together), and then maps all characters in the range A-M to the string &quot;A-M&quot;, and all characters in the range N-Z to the string &quot;N-Z&quot;. So &lt;code&gt;allTagsGrouped&lt;/code&gt; will have two keys: &lt;em&gt;&quot;A-M&quot;&lt;/em&gt;, and &lt;em&gt;&quot;N-Z&quot;&lt;/em&gt; (assuming all tag names start with letters). Obviously you could use more ranges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ordering &lt;code&gt;allTags&lt;/code&gt; by name appears to be a case insensitive sort, so &lt;code&gt;allTagsGrouped&lt;/code&gt; should still be in the right order.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-27T03:01:29.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5411" PostTypeId="1" AcceptedAnswerId="5412" CreationDate="2014-12-28T15:07:35.700" Score="2" ViewCount="904" Body="&lt;p&gt;I have a channel for products but in some cases I would like to associate a product with a structure containing documentation and release note pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/product/my-product/docs/getting-started&#xA;                          ^--------^      ^-------------^&#xA;                              |                  |&#xA;                           channel             topic (from 'myProductStructure')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there an existing field type (or plugin) which would allow selection of the associated structure type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Title: My Product  [text]&#xA;Doc Source: My Product Structure  [drop-down]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Such that I could use that in templates?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section( product.docSource ).slug( craft.request.lastSegment ) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1028" LastActivityDate="2014-12-28T19:20:59.770" Title="Field type for selecting a section (channel / structure / single)?" Tags="&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5412" PostTypeId="2" ParentId="5411" CreationDate="2014-12-28T19:20:59.770" Score="4" Body="&lt;p&gt;You can do this with &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow&quot;&gt;LJ DynamicFields&lt;/a&gt;. In the plugin docs is an example of how to create a dropdown that is a list of all sections.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-28T19:20:59.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5413" PostTypeId="1" AcceptedAnswerId="5414" CreationDate="2014-12-28T21:14:48.980" Score="0" ViewCount="1912" Body="&lt;p&gt;I created a single page called About, (&lt;a href=&quot;http://sandbox.fusepointe.com/hcnew/about&quot; rel=&quot;nofollow&quot;&gt;http://sandbox.fusepointe.com/hcnew/about&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template directory file structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA; | templates&#xA;     | about&#xA;         | _layout-about.html&#xA;         | index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I setup the single page in Craft, and set it to use the /about/_layout-about template - but I can't seem to get it to connect with the actual index.html page for the about single. If you visit the URL above, it says I haven't set my &lt;code&gt;{% block content %}&lt;/code&gt; yet, but I have... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code for &lt;strong&gt;_layout-about.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;author&quot; content=&quot;&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;icon&quot; href=&quot;{{ siteUrl }}/assets/img/favicon.ico&quot;&amp;gt;&#xA;&#xA;    &amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&#xA;    &amp;lt;!-- Bootstrap core CSS --&amp;gt;&#xA;    &amp;lt;link href=&quot;{{ siteUrl }}/assets/css/bootstrap.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- Custom styles for this template --&amp;gt;&#xA;    &amp;lt;link href=&quot;{{ siteUrl }}/assets/css/ionicons.min.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;    &amp;lt;link href=&quot;{{ siteUrl }}/assets/css/style.css&quot; rel=&quot;stylesheet&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- IE10 viewport hack for Surface/desktop Windows 8 bug --&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ siteUrl }}/assets/js/ie10-viewport-bug-workaround.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;    &amp;lt;!-- TypeKit Fonts --&amp;gt;&#xA;    &amp;lt;script src=&quot;//use.typekit.net/bke8zyg.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script&amp;gt;try{Typekit.load();}catch(e){}&amp;lt;/script&amp;gt;&#xA;&#xA;    &amp;lt;!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --&amp;gt;&#xA;    &amp;lt;!--[if lt IE 9]&amp;gt;&#xA;      &amp;lt;script src=&quot;https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;      &amp;lt;script src=&quot;https://oss.maxcdn.com/respond/1.4.2/respond.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;![endif]--&amp;gt;&#xA;&#xA;  &amp;lt;/head&amp;gt;&#xA;&#xA;  &amp;lt;body&amp;gt;&#xA;    &amp;lt;div id=&quot;h2&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;logo&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;&amp;lt;h2 style=&quot;text-transform:uppercase;&quot;&amp;gt;{{ siteName }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;div class=&quot;horizontal-nav&quot; style=&quot;display: inline;&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;blog&quot;&amp;gt;&amp;lt;h4&amp;gt;Blog&amp;lt;/h4&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;a href=&quot;work&quot;&amp;gt;&amp;lt;h4&amp;gt;Portfolio&amp;lt;/h4&amp;gt;&amp;lt;/a&amp;gt;&#xA;         &amp;lt;a href=&quot;about&quot;&amp;gt;&amp;lt;h4&amp;gt;About&amp;lt;/h4&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!--/logo--&amp;gt;&#xA;  &amp;lt;/div&amp;gt; &amp;lt;!--/H--&amp;gt;&#xA;      &amp;lt;main id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;      {% block content %}&#xA;        &amp;lt;p&amp;gt;This is the _layout-about.html page... If you see me, you haven’t set your &amp;lt;code&amp;gt;{% verbatim %}{% block content %}…{% endblock %}{% endverbatim %}&amp;lt;/code&amp;gt; yet.&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;See Twig’s &amp;lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#template-inheritance&quot;&amp;gt;Template Inheritance&amp;lt;/a&amp;gt; documentation for an explanation.&amp;lt;/p&amp;gt;&#xA;      {% endblock %}&#xA;    &amp;lt;/main&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;f&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row centered&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;col-md-8 col-md-offset-2&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;http://twitter.com/harriscauler&quot;&amp;gt;&amp;lt;i class=&quot;ion-social-twitter&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;http://instagram.com/harrisedmunds&quot;&amp;gt;&amp;lt;i class=&quot;ion-social-instagram&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;http://facebook.com/harriscaulerphotography&quot;&amp;gt;&amp;lt;i class=&quot;ion-social-facebook&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&amp;lt;!--/col-md-8--&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&amp;lt;!--/container--&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!--/.F--&amp;gt;&#xA;&#xA;    &amp;lt;!-- Bootstrap core JavaScript&#xA;    ================================================== --&amp;gt;&#xA;    &amp;lt;!-- Placed at the end of the document so the pages load faster --&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ siteUrl }}/assets/js/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ siteUrl }}/assets/js/bootstrap.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ siteUrl }}/assets/js/retina-1.1.0.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ siteUrl }}/assets/js/custom.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template code for &lt;strong&gt;index.html:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;about/_layout-about&quot; %}&#xA;{% block content %}&#xA;&#xA;      &amp;lt;div id=&quot;meta&quot; style=&quot;padding-top: 40px; padding-bottom: 40px;&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row centered&quot;&amp;gt;&#xA;          &amp;lt;h1&amp;gt;AT A GLANCE&amp;lt;/h1&amp;gt;&#xA;          &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;              &amp;lt;h3&amp;gt;FULL NAME&amp;lt;/h3&amp;gt;&#xA;              &amp;lt;p&amp;gt;Harris Edmunds Cauler&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;              &amp;lt;h3&amp;gt;RESIDENCE&amp;lt;/h3&amp;gt;&#xA;              &amp;lt;p&amp;gt;Moorestown, NJ&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;              &amp;lt;h3&amp;gt;HOBBIES&amp;lt;/h3&amp;gt;&#xA;              &amp;lt;p&amp;gt;Singing, Photography, Web Development, Community Service&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!--/row--&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&amp;lt;!--/.container--&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!--/.meta--&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;container ptb&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-10 col-md-offset-1 post-list&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;row centered&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;ABOUT ME&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;p&amp;gt;I'm a senior graduating in May currently interning at the U.S. Department of Education in Washington, D.C. I'm looking to connect with organizations and individuals in the D.C. Metro Area and hope to return post-graduation in May to work in D.C. full-time in a technology-related or project management position.&amp;lt;/p&amp;gt;&#xA;            &amp;lt;a class=&quot;btn btn-default&quot; href=&quot;about&quot; role=&quot;button&quot;&amp;gt;Learn More&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!--/col-md-4--&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&amp;lt;!--/row--&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- /.container --&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;meta&quot; style=&quot;padding-top: 40px; padding-bottom: 40px;&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row centered&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;          &amp;lt;h2&amp;gt;FROM THE BLOG&amp;lt;/h2&amp;gt;&#xA;            {% for post in entry.featuredBlogPost %}&#xA;              &amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;&#xA;                {% for image in post.featuredImage %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('postGridThumb') }}&quot; style=&quot;margin-left: auto; margin-right: auto;&quot; class=&quot;img-responsive&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;              &amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;&amp;lt;h3&amp;gt;{{ post.title }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;a class=&quot;btn btn-default&quot; href=&quot;blog&quot; role=&quot;button&quot;&amp;gt;All Posts&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&amp;lt;!--/col-md-6--&amp;gt;&#xA;          &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;          &amp;lt;h2&amp;gt;RECENT WORK&amp;lt;/h2&amp;gt;&#xA;            {% for post in entry.featuredPortfolioWork %}&#xA;              &amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;&#xA;                {% for image in post.featuredImage %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('postGridThumb') }}&quot; class=&quot;img-responsive&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;              &amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;&amp;lt;h3&amp;gt;{{ post.title }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;a class=&quot;btn btn-default&quot; href=&quot;work&quot; role=&quot;button&quot;&amp;gt;All Work&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&amp;lt;!--/col-md-6--&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!--/col-md-4--&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!--/meta--&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1136" LastEditorUserId="45" LastEditDate="2014-12-28T23:23:00.313" LastActivityDate="2014-12-28T23:23:00.313" Title="How to properly setup single page templates" Tags="&lt;templating&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5414" PostTypeId="2" ParentId="5413" CreationDate="2014-12-28T21:22:08.960" Score="5" Body="&lt;p&gt;If I've deciphered what you're asking correctly, I think the solution you need is to set the single to use your about/index template, not the about/_layout-about template.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-12-28T21:22:08.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5415" PostTypeId="1" CreationDate="2014-12-28T21:27:58.873" Score="6" ViewCount="4353" Body="&lt;p&gt;No idea why but my local install of CraftCMS (in a MAMP environment) won't let me upload JPGs. PNG, GIF, even TIFF works (just for the heck of it). When I select the file in the browser dialog, it closes then shows the loader bar and spinning gif anim. No progress is ever shown and the spinning continues eternally. &lt;a href=&quot;http://cl.ly/image/1a2l1W2t1P1x&quot; rel=&quot;noreferrer&quot;&gt;http://cl.ly/image/1a2l1W2t1P1x&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft is up to date&lt;/li&gt;&#xA;&lt;li&gt;Uploads on remote install works perfectly&lt;/li&gt;&#xA;&lt;li&gt;Getting this error &lt;code&gt;net::ERR_EMPTY_RESPONSE&lt;/code&gt; along with these details: &lt;a href=&quot;http://cl.ly/image/3D2w1F2l2O1x&quot; rel=&quot;noreferrer&quot;&gt;http://cl.ly/image/3D2w1F2l2O1x&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Checked my php.ini file and it allows JPG uploads&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I realize this may not even be an issue with Craft but a server side issue. I just have no idea how to troubleshoot this. Any help would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also checked my phperrors.log file and I got only this which is from back in early Dec and seemingly unrelated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  [08-Dec-2014 02:47:37 UTC] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 9792 bytes) in /Applications/MAMP/htdocs/sucasa/craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 199&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1078" LastEditorUserId="1078" LastEditDate="2014-12-30T04:40:17.920" LastActivityDate="2018-02-23T22:39:24.897" Title="All images uploading... except JPG files" Tags="&lt;assets&gt;&lt;server&gt;&lt;mamp&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="5416" PostTypeId="1" CreationDate="2014-12-29T06:35:26.503" Score="0" ViewCount="103" Body="&lt;p&gt;I am currently working on a project in EE that involves food delivery services and have run into a block. The project is about users subscribing to a plan and receiving a different dish every day of the week. During signup, users select their meat preferences and any items they're allergic to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the food side, when dishes are added, the type of meat in them is one field and ingredients (ones that users could be allergic to) is another. There will be about a couple of hundred dishes added in total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is select 2-3 types of dishes daily and have them distributed to users based on their meat preference. With EE, I can't figure out of I can create a relationship based on multiple queries (such as select users that have chosen Vegetarian AND chicken or Select Users that have chosen Chicken but NOT vegetarian.) Would this be something Craft is capable of? And What would be the best way of picking a dish and then figuring out which users it can be assigned to and then picking the second dish and assigning to the remaining users and if need be, pick a third dish to assign any users that are left over?&lt;/p&gt;&#xA;" OwnerUserId="1138" LastActivityDate="2015-02-05T03:15:47.250" Title="Building relationships" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5417" PostTypeId="2" ParentId="1301" CreationDate="2014-12-29T16:57:26.923" Score="2" Body="&lt;p&gt;You could use &lt;strong&gt;disabled&lt;/strong&gt; to prevent people from filling it except the admin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if currentUser == 'admin' %}&#xA;      &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;{{currentUser.username}}&quot;&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;{{currentUser.username}}&quot; disabled&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field still get's filled but users are prevented from writing anything on it. Hope this is what you were after.&lt;/p&gt;&#xA;" OwnerUserId="1086" LastActivityDate="2014-12-29T16:57:26.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5418" PostTypeId="1" CreationDate="2014-12-29T18:18:42.163" Score="2" ViewCount="94" Body="&lt;p&gt;I'm working with a fairly large data set in one of my channels and I was hoping there was a way maybe in admin to show me all the live entries where certain fields are empty. I want to be able to easier find where I'm missing data. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="1140" LastActivityDate="2015-01-28T19:06:14.800" Title="Find all empty fields in admin" Tags="&lt;field&gt;&lt;admin&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5419" PostTypeId="2" ParentId="5418" CreationDate="2014-12-29T18:49:53.093" Score="2" Body="&lt;p&gt;I can't think of a super-easy way to figure this out off of the top of my head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of not-so-easy ways to figure it out, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Find the column in the &lt;code&gt;craft_content&lt;/code&gt; (or the equivalent Matrix content table) and find all the rows with empty values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) From either a plugin (PHP) or a template (Twig), write some code that grabs all of the entries you are interested in and loops through them checking if the particular field has a value or not.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-29T18:49:53.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5420" PostTypeId="2" ParentId="5400" CreationDate="2014-12-29T19:26:50.433" Score="4" Body="&lt;p&gt;There are two basic issues with using includes in this scenario, both of which you have discovered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is that included templates do not have access to variables defined in master templates. You would have to specifically pass the variables to the template in the include statement using the &lt;code&gt;with&lt;/code&gt; clause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is that extended templates cannot have a body outside of a declaration block, and includes are by definition expected to return html, and thus throw an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better solution would be to use hierarchical extensions vs includes, placing all shared content together in the parent template. All variables in child templates should bubble up through the template hierarchy and be available to the parent templates. Something like the following for example (I've left out much of the content for brevity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;!--[if lt IE 7]&amp;gt;      &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8 lt-ie7&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 7]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9 lt-ie8&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if IE 8]&amp;gt;         &amp;lt;html class=&quot;no-js lt-ie9&quot; lang=&quot;en&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;!--[if gt IE 8]&amp;gt;&amp;lt;!--&amp;gt; &amp;lt;html lang=&quot;en-gb&quot; dir=&quot;ltr&quot; class=&quot;no-js&quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;&#xA;&#xA;&amp;lt;head&amp;gt;&#xA;    {# meta #}&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;title&amp;gt;{% if metaTitle is defined %}{{ metaTitle }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&#xA;    {# set seo #}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{% if metaDescription is defined %}{{ metaDescription }}{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;keywords&quot; content=&quot;{% if metaKeywords is defined %}{{ metaKeywords }}{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;robots&quot; content=&quot;{% if metaRobots is defined %}{{ metaRobots }}{% else %}index,follow{% endif %}&quot;&amp;gt;&#xA;&#xA;    {# set open graph #}&#xA;    &amp;lt;meta property=&quot;og:site_name&quot; content=&quot;{{ siteName }}&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:type&quot; content=&quot;website&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:title&quot; content=&quot;{% if metaTitle is defined %}{{ metaTitle }} - {% endif %}{{ siteName }}&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:image&quot; content=&quot;{% if openGraphImage is defined %}{{ openGraphImage }}{% else %}{{ siteUrl }}images/og-default.jpg{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:description&quot; content=&quot;{% if metaDescription is defined %}{{ metaDescription }}{% endif %}&quot;&amp;gt;&#xA;&#xA;    ...etc&#xA;&#xA;    {# set default site meta variables, if any #}&#xA;&#xA;    {% block head %}{% endblock %}&#xA;&#xA;&amp;lt;/head&amp;gt;    &#xA;&#xA;&amp;lt;body&amp;gt;&#xA;&#xA;    {% block content %}{% endblock %}&#xA;&#xA;    {% block footer %}{% endblock %}&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_home-layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block head %}&#xA;    {# additional home head content #}&#xA;{% endblock %}&#xA;&#xA;{% block content %}{% endblock %}&#xA;&#xA;{% block footer %}&#xA;    {# home footer content #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_page-layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block head %}&#xA;    {# additional page head content #}&#xA;{% endblock %}&#xA;&#xA;{% block content %}{% endblock %}&#xA;&#xA;{% block footer %}&#xA;    {# page footer content #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;index.html&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_home-layout&quot; %}&#xA;&#xA;{# set home meta variables, etc #}&#xA;&#xA;{% block content %}&#xA;    {# home body content #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;page.html&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_page-layout&quot; %}&#xA;&#xA;{# set page meta variables, etc #}&#xA;&#xA;{% block content %}&#xA;    {# page body content #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this way you can group shared content in the parent template and specific content further down the template hierarchy. How best to structure this hierarchy to keep you code 'dry' will be heavily dependent on the needs of your project so I won't even begin to guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind it is also possible to define blocks of html in variables using conditionals and then place those variables into the block declarations.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.firstSegment %}&#xA;&#xA;    {% set footer %}&#xA;        {# page footer content #}&#xA;    {% endset %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set footer %}&#xA;        {# home footer content #}&#xA;    {% endset %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% block footer %}&#xA;    {{ footer }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-05T19:35:04.120" LastActivityDate="2015-01-05T19:35:04.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5421" PostTypeId="1" CreationDate="2014-12-29T19:57:16.563" Score="2" ViewCount="1082" Body="&lt;p&gt;Finally hopping back into Craft to finish a large project, and am loving so many of the new features added! One thing I am using extensively is the Title Format feature. For one of my entry types, my Title Format field looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{songTitle} - {{ performedWith.entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;performedWith is the name of a field that links to an entry. I assumed I could do entry.title to pull the title from the linked entry, but it is simply showing up blank. Any ideas? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="17" LastActivityDate="2014-12-31T22:54:53.867" Title="Title Format - Auto Generation via linked entry" Tags="&lt;entry&gt;&lt;titles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5422" PostTypeId="2" ParentId="5421" CreationDate="2014-12-29T20:45:53.117" Score="1" Body="&lt;p&gt;If &lt;code&gt;performedWith&lt;/code&gt; is a simple relationship field to another entry, then try it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.performedWith.first.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you're getting the &lt;code&gt;title&lt;/code&gt; from the &lt;code&gt;first&lt;/code&gt; entry listed in your &lt;code&gt;performedWith&lt;/code&gt; field.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2014-12-29T20:53:49.113" LastActivityDate="2014-12-29T20:53:49.113" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5423" PostTypeId="1" CreationDate="2014-12-29T21:22:39.813" Score="1" ViewCount="177" Body="&lt;p&gt;I'm looking for a solution on the best way to setup a macro for buttons that are defined in a matrix fieldtype.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code works fine but it really isn't that DRY and I feel it could be made better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first import my button macro in a main template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/buttons&quot; as buttons %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then my code for the matrix field is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in cube.button %}&#xA;   {{ buttons.span(block.buttonType, block.buttonText, block.buttonColour, block.buttonSize, block.fullWidthButton, cube.linkUrl) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now my not so DRY button macro&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro span(type, text, colour, size, fullWidth, url) -%}&#xA;    &amp;lt;span class=&quot;btn {{ type }} {{ colour }} {{ size }}{% if fullWidth %} btn-block{% endif %}&quot;&amp;gt;{{ text }}&amp;lt;/span&amp;gt;&#xA;{% endmacro -%}&#xA;&#xA;{% macro a(type, text, colour, size, fullWidth, url) -%}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;btn {{ type }} {{ colour }} {{ size }}{% if fullWidth %} btn-block{% endif %}&quot;&amp;gt;{{ text }}&amp;lt;/a&amp;gt;&#xA;{% endmacro -%}&#xA;&#xA;{% macro button(type, text, colour, size, fullWidth, url) -%}&#xA;    &amp;lt;button class=&quot;btn {{ type }} {{ colour }} {{ size }}{% if fullWidth %} btn-block{% endif %}&quot;&amp;gt;{{ text }}&amp;lt;/button&amp;gt;&#xA;{% endmacro -%}&#xA;&#xA;{% macro submit(type, text, colour, size, fullWidth, url) -%}&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;btn {{ type }} {{ colour }} {{ size }}{% if fullWidth %} btn-block{% endif %}&quot; value=&quot;{{ text }}&quot;/&amp;gt;&#xA;{% endmacro -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="76" LastEditorUserId="76" LastEditDate="2014-12-29T22:15:09.037" LastActivityDate="2014-12-29T22:15:09.037" Title="What is the best way to format a button macro?" Tags="&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5424" PostTypeId="2" ParentId="5423" CreationDate="2014-12-29T21:54:47.700" Score="2" Body="&lt;p&gt;You could factor out that repeated &lt;code&gt;class=...&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro _btnClass(type, colour, size, fullWidth) %}&#xA;    class=&quot;btn {{ type }} {{ colour }} {{ size }}{% if fullWidth %} btn-block{% endif %}&quot;&#xA;{% endmacro %}&#xA;&#xA;{% macro span(type, text, colour, size, fullWidth, url) -%}&#xA;{% import _self as self %}&#xA;    &amp;lt;span {{ self._btnClass(type, colour, size, fullWidth) }}&amp;gt;{{ text }}&amp;lt;/span&amp;gt;&#xA;{% endmacro -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is not clear from your question how you decide which buttons macro to call. Perhaps that code needs to be made DRYer.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2014-12-29T21:54:47.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5425" PostTypeId="1" CreationDate="2014-12-29T22:29:39.417" Score="1" ViewCount="107" Body="&lt;p&gt;For a news site I would like to retrieve the number of times an entry has been updated since postDate. Is that possible without using a plugin? Im using craft pro and have versioning enabled for that section. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-04-06T17:29:33.547" Title="How can I retrieve number of times an entry has been updated since postDate" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5426" PostTypeId="1" AcceptedAnswerId="5459" CreationDate="2014-12-29T22:33:08.937" Score="1" ViewCount="223" Body="&lt;p&gt;So I'm working on a prototyping plugin that has its own element type for pages.  My hope was to have a single &lt;code&gt;_page.html&lt;/code&gt; template and much like entries or categories be able to tell Craft to map the routes for all the elements URIs to that template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But not having much luck figuring out how to do that?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have URIs saving with my elements but how do I note which template to load?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume it has something to do with registering routes but I'm not exactly sure where to start?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2014-12-30T03:50:30.503" LastActivityDate="2015-01-05T11:10:58.667" Title="How to define template routes for a custom element type" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5427" PostTypeId="1" CreationDate="2014-12-30T00:02:07.423" Score="1" ViewCount="2090" Body="&lt;p&gt;I'm in the process of installing Craft on my Ubuntu 14.04 server and ran into an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the installer at &lt;a href=&quot;http://example.com/admin&quot; rel=&quot;nofollow&quot;&gt;http://example.com/admin&lt;/a&gt;, I get the &quot;Can't run Craft&quot; error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft requires cURL in order to run&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have these packages installed using sudo apt-get install:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;curl&#xA;libcurl3&#xA;libcurl3-dev&#xA;php5-curl&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No clue what's going on. Could be a configuration issue? or are my packages not properly installed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2014-12-30T19:06:44.500" Title="How to install cURL on Ubuntu 14.04 to run Craft CMS?" Tags="&lt;install&gt;&lt;php&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5429" PostTypeId="2" ParentId="5427" CreationDate="2014-12-30T02:43:29.697" Score="2" Body="&lt;p&gt;You likely need to go to /etc/php5 and either make a link or move curl.ini from the mods-available folder to mods-enabled. (Just did this myself on Ubuntu 14.04 server)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, be sure to restart apache:&#xA;    su apache2ctl restart&lt;/p&gt;&#xA;" OwnerUserId="17" LastActivityDate="2014-12-30T02:43:29.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5430" PostTypeId="2" ParentId="5426" CreationDate="2014-12-30T12:17:12.203" Score="0" Body="&lt;p&gt;You could always route that section through a template that routes based on entry type. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = entry.section.handle|default %}&#xA;{% set entryType = entry.type|default('default') %}&#xA;{% extends [&#xA;  '_sections/' ~ section ~ '/' ~ entryType ~ '.twig',&#xA;  '_sections/' ~ section ~ '/default.twig',&#xA;  '/_layouts/default.twig'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way it will &lt;code&gt;extends&lt;/code&gt; any template matching that type, or fall back to defaults.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="248" LastEditDate="2015-01-05T11:10:58.667" LastActivityDate="2015-01-05T11:10:58.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5431" PostTypeId="2" ParentId="5415" CreationDate="2014-12-30T14:28:41.437" Score="1" Body="&lt;p&gt;From your error, I think the fact that only JPG files are failing is a coincidence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps when you were testing the PNG, GIF and TIFF files were all relatively small, but the JPG files were large enough to bump you over the 32MB limit assigned to PHP in your &lt;code&gt;php.ini&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, if you open up your &lt;code&gt;php.ini&lt;/code&gt; file, find the &lt;code&gt;memory_limit&lt;/code&gt; setting, and bump it up to 128MB (or 256MB if you're feeling saucy), the problem should go away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might have to restart your web server before that setting takes effect.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-30T14:28:41.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5432" PostTypeId="2" ParentId="538" CreationDate="2014-12-30T14:29:17.330" Score="2" Body="&lt;p&gt;I had this issue on my VPS and found out it was due to permissions. I had to chown the craft folder to the Apache group (for Ubuntu, its www-data):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo chown -R sudo_user:www-data /var/www/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replace &quot;sudo_user&quot; with your user, and /var/www/craft to the full path of your craft folder.&lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2014-12-30T14:29:17.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5433" PostTypeId="1" AcceptedAnswerId="5458" CreationDate="2014-12-30T16:20:01.340" Score="3" ViewCount="714" Body="&lt;p&gt;I have a plugin that has an folder inside of it's &lt;code&gt;resources&lt;/code&gt;. I need to iterate through those files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the path, I tried &lt;code&gt;craft()-&amp;gt;resources-&amp;gt;getResourcePath('folder-name')&lt;/code&gt;, but it seems to only succeed if the &lt;em&gt;file&lt;/em&gt; exists, not a folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the folder so I can use &lt;code&gt;IOHelper::getFolderContents($folder)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I just need to build the path myself (&lt;code&gt;$folder = craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'myplugin/resources/svg/';&lt;/code&gt;), or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-01-04T19:40:23.147" Title="getResourcePath() for folders in a plugin" Tags="&lt;plugin-development&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5434" PostTypeId="2" ParentId="5427" CreationDate="2014-12-30T19:06:44.500" Score="1" Body="&lt;p&gt;I re-imaged my VPS and ran a new instance of Ubuntu 14.04. Now its all working.&lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2014-12-30T19:06:44.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5435" PostTypeId="1" CreationDate="2014-12-31T00:12:23.553" Score="5" ViewCount="198" Body="&lt;p&gt;When there are updates to Craft, I perform them locally against a local database. The files are then committed to a repository.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then use Capistrano to deploy the updated installation to various test environments (and eventually production), each of which have their own database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My dilemma is that for the DB updates to run for Craft, I have to hit visit the control panel and initiate them. I need a programmatic solution so that I can ping a URL after the deployment is finished, and initiate the DB updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there already a way to do this or do I need to write a plugin that is a wrapper for &lt;code&gt;craft()-&amp;gt;updates-&amp;gt;updateDatabase()&lt;/code&gt; that is triggered via a custom site route?&lt;/p&gt;&#xA;" OwnerUserId="279" LastActivityDate="2016-11-04T07:50:55.280" Title="DB Update Trigger" Tags="&lt;database&gt;&lt;deployment&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5436" PostTypeId="2" ParentId="5435" CreationDate="2014-12-31T02:34:46.290" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My dilemma is that for the DB updates to run for Craft, I have to hit visit the control panel and initiate them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Currently true, but only if a new database migration has been introduced during the update.  Otherwise, it should be seemless.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I need a programmatic solution so that I can ping a URL after the deployment is finished, and initiate the DB updates. Is there already a way to do this...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is on our list to add support for an endpoint for deployment services that have a post-deployment hook specifically for situations like this one. (We could use it ourselves!)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2014-12-31T02:34:46.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5437" PostTypeId="1" AcceptedAnswerId="5438" CreationDate="2014-12-31T12:13:39.483" Score="10" ViewCount="1745" Body="&lt;p&gt;I've just set up a new S3 account and want to move my assets folders there. But when I try to upload a file, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S3::getObjectInfo(mikkelbang, shallowtree.png): [400] Unexpected HTTP status&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the same goes for when I try to update the Assets index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S3::getBucket(): [InvalidRequest] The authorization mechanism you have provided is not supported.&#xA;Please use AWS4-HMAC-SHA256.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've never used S3 before, so it might be something I need to set up there. But I couldn't find any documentation on setting up S3 with Craft...&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2017-07-18T11:02:13.020" Title="Errors occuring with Assets and Amazon S3" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5438" PostTypeId="2" ParentId="5437" CreationDate="2014-12-31T14:24:30.337" Score="12" Body="&lt;p&gt;There are a few regions that support only S3's v4 of signing requests without the possibility of falling back to v2.  The S3 library that Craft 2 uses only supports S3 v2. Check &lt;a href=&quot;http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region&quot; rel=&quot;nofollow noreferrer&quot;&gt;this table&lt;/a&gt; for reference - if it says &quot;Version 4 only&quot; in the last column then that region can't be used in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're not switching out that library in Craft 2.x, but it won't be a problem in Craft 3, so currently your best bet is to move your bucket to a different region, which also supports S3 v2 signing of requests (any other one, really).&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2017-07-18T11:02:13.020" LastActivityDate="2017-07-18T11:02:13.020" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="5439" PostTypeId="2" ParentId="5425" CreationDate="2014-12-31T18:34:13.807" Score="1" Body="&lt;p&gt;Update: This came up in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9050/how-can-i-display-entry-edit-history-on-the-front-end&quot;&gt;another question&lt;/a&gt; and I think that I may have found a simple way to do this without the use of a plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set versions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}&#xA;{{ versions|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-04-06T17:29:33.547" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5440" PostTypeId="2" ParentId="5375" CreationDate="2014-12-31T18:52:50.940" Score="1" Body="&lt;p&gt;Assuming you have an assets field with the fieldHandle &lt;code&gt;teamImage1&lt;/code&gt; then the following should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.teamImage1|length %}&#xA;    {% set asset = entry.teamImage1.first() %}&#xA;    {{ asset.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-31T18:52:50.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5441" PostTypeId="2" ParentId="5421" CreationDate="2014-12-31T22:54:53.867" Score="4" Body="&lt;p&gt;Lindsey's answer is correct when outputting to a template, however, from within the title field of an Entry Type you would use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{songTitle} - {performedWith.first.title}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry&lt;/code&gt; is not needed, and only need single brackets.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2014-12-31T22:54:53.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5442" PostTypeId="1" AcceptedAnswerId="5443" CreationDate="2014-12-31T23:17:13.300" Score="4" ViewCount="4288" Body="&lt;p&gt;Live Preview isn't working for any kind of entry. Dev or production. I get the following error on chrome's console.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jquery-2.1.1.min.js?d=1409764106:4 &#xA;POST http://undiario.dev/ 500 (Internal Server Error)&#xA;&#xA;jquery-2.1.1.min.js?d=1409764106:4 &#xA;k.cors.a.crossDomain.send&#xA;&#xA;jquery-2.1.1.min.js?d=1409764106:4 &#xA;n.extend.ajax&#xA;&#xA;jquery-2.1.1.min.js?d=1409764106:4 &#xA;n.(anonymous function)&#xA;&#xA;craft.js:10520 &#xA;Craft.LivePreview.Garnish.Base.extend.updateIframe&#xA;&#xA;jquery-2.1.1.min.js?d=1409764106:2 &#xA;n.isFunction.f&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anybody knows why this is happening?&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="365" LastEditDate="2016-11-14T07:52:11.670" LastActivityDate="2018-04-08T22:51:51.887" Title="Live Preview not working" Tags="&lt;control-panel&gt;&lt;live-preview&gt;" AnswerCount="7" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5443" PostTypeId="2" ParentId="5442" CreationDate="2015-01-01T15:03:03.417" Score="2" Body="&lt;p&gt;Looks like it's generating a &lt;code&gt;500 Internal Server Error&lt;/code&gt; which means the underlying error message should be getting logged into your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files.  Just reproduce the problem and check for an entry with &lt;code&gt;[error]&lt;/code&gt; severity.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-01T15:03:03.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5444" PostTypeId="1" CreationDate="2015-01-01T22:03:22.307" Score="1" ViewCount="763" Body="&lt;p&gt;I realise this is very much a Redactor question, but was wondering if anyone has figured out how to apply custom classes to UL's and OL's in Craft using the formattingAdd options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following but it just won't apply to any unordered lists I create:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{&#xA;  tag: 'ul',&#xA;  title: 'Large list',&#xA;  class: 'large'&#xA;}&lt;/p&gt;&#xA;" OwnerUserId="557" LastActivityDate="2015-01-06T10:34:18.770" Title="Styling unordered lists in Craft" Tags="&lt;control-panel&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5445" PostTypeId="1" AcceptedAnswerId="6495" CreationDate="2015-01-02T16:36:07.217" Score="1" ViewCount="187" Body="&lt;p&gt;I've just installed Craft on a new Laravel Homestead environment and all seems to be running fine, with the exception of being able to upload a logo in the General settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logo uploads and displays in the popup for cropping, but when I save it, I get this error flashed up:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Something went wrong when processing the logo.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've checked the permissions and everything seems fine - the storage dir is set to 777 on my local box just to be doubly sure and I can see Craft is creating files and folders in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $imagePath variable in the RebrandController::RebrandController() method is as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/home/vagrant/sites/craft-base/craft/storage/runtime/temp/uploads/Rally-Digital-Logo.png&amp;amp;d=1420216657&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Aside from permissions, what could cause this?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-01-07T07:38:30.117" Title="Something went wrong when processing the logo" Tags="&lt;config&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5447" PostTypeId="1" CreationDate="2015-01-02T19:10:03.837" Score="1" ViewCount="579" Body="&lt;p&gt;Is it possible to set Redactor button to wrap my code snippets inside two tags?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I have so right now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: [&#xA;    {&#xA;        tag: 'code',&#xA;        title: 'Code Inline'&#xA;    },&#xA;    {&#xA;        tag: 'pre',&#xA;        title: 'Code Well'&#xA;    },&#xA;    {&#xA;        tag: 'mark',&#xA;        title: 'Marked'&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But some scripts and Bootstrap wants it wrapped in both of the tags.&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2018-01-11T04:10:39.153" Title="How do I set Redactor formatting button to wrap selected text in two tags? &lt;pre&gt;&lt;code&gt;...&lt;/code&gt;&lt;/pre&gt;" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5448" PostTypeId="1" AcceptedAnswerId="5449" CreationDate="2015-01-03T00:56:03.140" Score="1" ViewCount="489" Body="&lt;p&gt;I have an entry that has a matrix field, which has a table in it; I am trying to pull out 4 rows from the latest block, but if there aren't 4 rows then I would like it to pull out the remainder from the older blocks (So I always have 4 items displayed, even if the latest matrix block only has 1 table row in it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far, but this is pulling out the latest 4 rows from EACH matrix block, so if I have 2 blocks it displays 8 items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if what I'm trying to do is possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionName').find() %}&#xA;    {% for block in entry.matrixField %}&#xA;&#xA;    {% if block.type == &quot;blockType&quot; %}&#xA;&#xA;        {% for row in block.tableField | slice(0, 4) %} &amp;lt;!-- I tried .limit(4) here too --&amp;gt;&#xA;            {{ row.title }}&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="451" LastActivityDate="2015-01-03T08:44:45.133" Title="How do I pull out a total of 4 rows from all my matrix blocks?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5449" PostTypeId="2" ParentId="5448" CreationDate="2015-01-03T08:44:45.133" Score="2" Body="&lt;p&gt;I am assuming you want four rows from each entry. I would do it like this using &lt;code&gt;{% break %}&lt;/code&gt; from the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;break and continue&lt;/a&gt; plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionName').find() %}&#xA;  {# restart our count for the new entry #}&#xA;  {% set numberOfRows = 0 %}&#xA;&#xA;  {% for block in entry.matrixField %}&#xA;    {% if block.type == &quot;blockType&quot; %}&#xA;      {% for row in block.tableField.limit(4) %}&#xA;&#xA;        {# bail if we've done our 4 rows #}&#xA;        {% if 4 &amp;lt;= numberOfRows %} {% break %} {% endif %}&#xA;&#xA;        {{ row.title }}&#xA;        {# done another row, count it #}&#xA;        {% set numberOfRows = numberOfRows + 1 %}&#xA;&#xA;      {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    {# bail if we've done our 4 rows #}&#xA;    {% if 4 &amp;lt;= numberOfRows %} {% break %} {% endif %}&#xA;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, slightly less efficiently (but maybe simpler), like this without that plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionName').find() %}&#xA;  {% set numberOfRows = 0 %}&#xA;  {% for block in entry.matrixField %}&#xA;&#xA;    {% if block.type == &quot;blockType&quot; %}&#xA;      {% for row in block.tableField.limit(4) %}&#xA;&#xA;        {% if numberOfRows &amp;lt; 4 %}&#xA;          {{ row.title }}&#xA;          {% set numberOfRows = numberOfRows + 1 %}&#xA;        {% endif %}&#xA;&#xA;      {% endfor %}&#xA;    {% endif %}&#xA;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't think you pull out the four rows from multiple matrix blocks with a single query.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-03T08:44:45.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5450" PostTypeId="2" ParentId="5447" CreationDate="2015-01-03T20:39:13.570" Score="1" Body="&lt;p&gt;If it were me, I'd try to keep as much formatting cruft out of a wysiwyg as possible, it cleans things up down the road and keeps your content as structured as possible. If you ever change frameworks or anything else, that extra cruft can come back to haunt you because it's all stored in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better way is handle this with a couple &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix blocks&lt;/a&gt;. Set one up for text, and then another one for code snippets. Then in your template when you want to spit out a code snippet, you just wrap it using whatever extra bits you need like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;{% if block.type == &quot;text&quot; %}&#xA;    {# handle text #}&#xA;    {{ block.entryText }}&#xA;&#xA;{% elseif block.type == &quot;code&quot; %}&#xA;&#xA;    &amp;lt;div class=&quot;code-snippet&quot;&amp;gt;&#xA;    &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;{{ block.codeBlock }}&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&#xA;    &amp;lt;/div.&#xA;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The upside here is that it's all built-in, you don't have to modify any redactor defaults to make this work. But the bigger upside is if let's say you're building a library of code snippets, it'd be super easy to query the Matrix fields and get just those snippets you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even completely reformat the page and just show the code snippets, since you have them already broken out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IMO that's what makes Craft so powerful, it's easy to use more structured data unlike other solutions *cough* like WordPress *cough* that put everything in one &quot;field.&quot;&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-01-03T20:39:13.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5451" PostTypeId="1" CreationDate="2015-01-03T22:45:32.010" Score="0" ViewCount="85" Body="&lt;p&gt;This may be more of a feature request but I was curious if this is on the roadmap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen a lot of plugins that are more of a “utility” than something users would interact with. For example look at &lt;a href=&quot;http://straightupcraft.com/craft-plugins/audit-log&quot; rel=&quot;nofollow&quot;&gt;Audit Log&lt;/a&gt;, &lt;a href=&quot;http://straightupcraft.com/craft-plugins/dump&quot; rel=&quot;nofollow&quot;&gt;Dump&lt;/a&gt; and other miscellaneous. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the only real option that exists for plugins is &lt;code&gt;hasCpSection&lt;/code&gt;. It would be really helpful as the plugin ecosystem continues to grow to have plugins that are a “utility” or “settings” with the option to show on the settings page in the Control Panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naming aside as this is just a quick thought, I was thinking something along the lines of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function isSettingsPlugin()&#xA;{&#xA;    return true;&#xA;}&#xA;&#xA;public function getSettingsPluginCategory()&#xA;{&#xA;    return Craft::t(’Tools');&#xA;}&#xA;&#xA;public function getSettingsIconPath()&#xA;{&#xA;    // return the path to the settings icon&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on adding the ability to have plugins as a settings or utility?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="45" LastEditDate="2016-08-13T02:24:32.970" LastActivityDate="2016-08-13T02:24:32.970" Title="Extending options for different plugin types?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5452" PostTypeId="2" ParentId="5451" CreationDate="2015-01-04T00:51:37.077" Score="2" Body="&lt;p&gt;IMHO, there is no need for this and I don't think that there is a problem that needs to be solved by Craft based on what you've outlined. Additionally, putting this on the roadmap may lead to a confusing API or at the very least, it might get us into a convoluted plugin philosophy like in EE, where we have plugins, modules, addons, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, plugins can decide whether they have settings or not and the API that enables that seems very eloquent to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, properly categorizing plugins will be very important and I would bet that the plugin store will address that; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I misunderstood what you were trying to communicate.&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2015-01-04T04:56:10.170" LastActivityDate="2015-01-04T04:56:10.170" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5453" PostTypeId="2" ParentId="4686" CreationDate="2015-01-04T06:35:49.180" Score="1" Body="&lt;p&gt;I just wrote one! &lt;a href=&quot;https://github.com/marionnewlevant/craft-mn_matchinput&quot; rel=&quot;nofollow&quot;&gt;MN Match Input&lt;/a&gt;. You specify an &lt;code&gt;Input Mask&lt;/code&gt; and the entry won't save if &lt;code&gt;preg_match($inputMask, $value)&lt;/code&gt; isn't 1. So you get all the power of &lt;a href=&quot;http://php.net/manual/en/function.preg-match.php&quot; rel=&quot;nofollow&quot;&gt;preg_match&lt;/a&gt; (lots of rope...)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-04T06:35:49.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5454" PostTypeId="1" AcceptedAnswerId="5456" CreationDate="2015-01-04T15:41:12.570" Score="4" ViewCount="962" Body="&lt;p&gt;This is giving me a surprisingly hard time. Has anyone tried to paginate entries by date, in this case, specifically by day; i.e.: First page loads today's posts, next page loads yesterday's, then the day before yesterday, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried grouping items by date, as done in the archive page example, and then paginating the groups but it didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I am using a combination of pagination + ajax to load more content when needed. However the needs of the project have changed, and paginating by number of items isn't the best approach. It'd be better to show content based on the date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2015-01-05T02:47:58.893" Title="Paginate Entries by Day" Tags="&lt;entries&gt;&lt;pagination&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5455" PostTypeId="2" ParentId="5113" CreationDate="2015-01-04T19:16:27.400" Score="7" Body="&lt;p&gt;Depends on how you want to determine &quot;most popular&quot;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to calculate based on &lt;strong&gt;page views&lt;/strong&gt;, then check out Ben Croker's &lt;a href=&quot;https://straightupcraft.com/craft-plugins/entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Entry Count plugin&lt;/strong&gt;&lt;/a&gt; (as Brad mentioned in his answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your users to &lt;strong&gt;vote&lt;/strong&gt; on most popular, then check out my &lt;a href=&quot;https://www.doublesecretagency.com/plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Upvote plugin&lt;/strong&gt;&lt;/a&gt;, designed to emulate Stack Exchange or Facebook &quot;likes&quot;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-11-29T05:07:09.157" LastActivityDate="2017-11-29T05:07:09.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5456" PostTypeId="2" ParentId="5454" CreationDate="2015-01-04T19:22:50.987" Score="4" Body="&lt;p&gt;Instead of using pagination, you might try creating a custom route using tags for year/month/day. Those tags will be available as variables in the template that you can use to load that days entries and generate the nav for next/previous day, etc. Using ajax the uri won't be visible to the user anyway.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set postDate = year ~ '-' ~ month ~ '-' ~ day %}&#xA;{% set nextDate = postdate|date_modify('+1 day')) %}&#xA;{% set previousDate = postdate|date_modify('-1 day')) %}&#xA;&#xA;{% set entries = craft.entries.postDate('and', '&amp;gt;= ' ~ postdate, '&amp;lt; ' ~ nextDate %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'section/' ~ nextDate|date(&quot;Y/m/d&quot;) }}&quot;&amp;gt;next&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'section/' ~ previousDate|date(&quot;Y/m/d&quot;) }} &quot;&amp;gt;previous&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested, but should be close. You'll need to modify the links to work with your ajax of course.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-05T02:47:58.893" LastActivityDate="2015-01-05T02:47:58.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5457" PostTypeId="2" ParentId="1713" CreationDate="2015-01-04T19:33:21.743" Score="2" Body="&lt;p&gt;As far as I'm aware, there is currently no native way to do this without using an ElementType index page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have two options for implementing this yourself. One is to sort the table on user input with the help of the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;registerCpRoutes hook&lt;/a&gt; (with AJAX or by reloading the page). The other is to use a JavaScript solution, as discussed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2821/filtering-and-sorting-lists-in-a-plugin&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-04T19:33:21.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5458" PostTypeId="2" ParentId="5433" CreationDate="2015-01-04T19:40:23.147" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ResourcesService#getResourcePath-detail&quot; rel=&quot;nofollow&quot;&gt;ResourcesService getResourcePath&lt;/a&gt; method will only work for files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/classreference/services/PathService#getResourcesPath-detail&quot; rel=&quot;nofollow&quot;&gt;PathService getResourcesPath&lt;/a&gt; method will get you the resources path, after which you can append your folder name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$folder = craft()-&amp;gt;path-&amp;gt;getResourcesPath() . 'svg/';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-01-04T19:40:23.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5459" PostTypeId="2" ParentId="5426" CreationDate="2015-01-04T19:59:40.703" Score="4" Body="&lt;p&gt;You'll need to override the BaseElementType's &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/BaseElementType#routeRequestForMatchedElement-detail&quot; rel=&quot;nofollow&quot;&gt;routeRequestForMatchedElement method&lt;/a&gt; in your element type class as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function routeRequestForMatchedElement(BaseElementModel $element)&#xA;{&#xA;    return array(&#xA;        'action' =&amp;gt; 'templates/render',&#xA;        'params' =&amp;gt; array(&#xA;            'template' =&amp;gt; '_page',&#xA;            'variables' =&amp;gt; array(&#xA;                'page' =&amp;gt; $element&#xA;            )&#xA;        )&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-01-04T19:59:40.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5460" PostTypeId="1" AcceptedAnswerId="5461" CreationDate="2015-01-05T01:36:15.637" Score="2" ViewCount="587" Body="&lt;p&gt;I purchased a Craft Client license for a staging server we have, which uses Git for deployment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I forgot to copy the license.key file to my local copy of the site before my last git push, and it got clobbered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to retrieve my license? I have contacted Craft support, which I assume is the only way to get it back, however if there is a way to get it back on my own that would be helpful.&lt;/p&gt;&#xA;" OwnerUserId="938" LastActivityDate="2015-01-05T01:56:54.177" Title="How to get my license.key after deleting it via Git" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5461" PostTypeId="2" ParentId="5460" CreationDate="2015-01-05T01:56:54.177" Score="3" Body="&lt;p&gt;Right now, contacting support@buildwithcraft.com is the only way to retrieve a lost &lt;code&gt;license.key&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the future, once we add user accounts to buildwithcraft.com, we'll also be adding order and license management, so you'll be able to retrieve it from there as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've responded to your ticket with your proper &lt;code&gt;license.key&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-05T01:56:54.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5462" PostTypeId="1" CreationDate="2015-01-05T04:43:59.380" Score="4" ViewCount="786" Body="&lt;p&gt;I've been trying to install Craft on a DigitalOcean server. I used DO's LAMP stack application on Ubuntu 14.04 and downloaded the latest version of Craft. After uploading everything to my web root (the default is /var/www/html so the craft folder is at /var/www and the contents of public are at /var/www/html), whenever I try and go to the website, I get an error saying: &lt;code&gt;&quot;Fatal error: Class 'Craft\FileCache' not found in /var/www/craft/app/services/CacheService.php on line 59&quot;&lt;/code&gt;. If I go to example.com/admin, I get an Apache 404 error. If I try example.com/index.php/admin, I get the same fatal error as I described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this means I need to enable mod_rewrite (I've already renamed htaccess to .htaccess), but I should still be seeing something. I'm not sure what to do about the fatal error. I've redownloaded the Craft files to be sure nothing got corrupted in the original download, but I still have the same problem. I've also tried it on a server I have from A Small Orange and got the same thing. I also changed the required folders' permissions to 777 just to rule out any permissions problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2016-02-05T01:14:40.793" Title="Fatal error: Class 'Craft\FileCache' not found when trying to install" Tags="&lt;error-message&gt;&lt;install&gt;&lt;apache&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5463" PostTypeId="1" AcceptedAnswerId="5476" CreationDate="2015-01-05T09:10:46.967" Score="1" ViewCount="444" Body="&lt;p&gt;I have a channel on my site which holds the products and services available.&#xA;Each has various categories to narrow it down. I want to build a product selector and not sure the best method to go about it.&#xA;Concept is in image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5YIfi.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first 3 questions are filters by categories which apply to each product/service. The Q4 is a price which each product/service has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have a page set up with a custom route which filters the products based on the categories e.g:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/products-services/inks/sales-marketing/tiles  which is&#xA;/(to load template)/category/category/category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that currently filters the products as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is my best way to build the product selector? I'm guessing it is to build a url somehow and link to the above route I have already set up?&#xA;Could it be done with a structure with a sub level for each question?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-01-05T19:36:55.547" Title="Best Way to Build a Product Selector" Tags="&lt;entries&gt;&lt;structure&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5464" PostTypeId="2" ParentId="5389" CreationDate="2015-01-05T12:56:10.300" Score="3" Body="&lt;p&gt;This turned out to be easier than expected. It's not documented in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#translate-or-t&quot; rel=&quot;nofollow&quot;&gt;filters section of the docs&lt;/a&gt;, but the t() filter can take other parameters after the  tokenised variables you might want to replace in the string. Paraphrased from the source code of the globally available t() function:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;source: Defines which message source application component to use. Defaults to null, meaning use 'coreMessages' for messages belonging to the 'yii' category and using 'messages' for messages belonging to Craft.&lt;/li&gt;&#xA;&lt;li&gt;language: The target language. If set to null (default), craft()-&gt;getLanguage() will be used.&lt;/li&gt;&#xA;&lt;li&gt;category: The message category. Please use only word letters. Note, category 'craft' is reserved for Craft and 'yii' is reserved for the Yii framework.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, the solution was as simple as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{type|t(null, null, 'nb')}/{slug}&lt;/code&gt; for URL format for Norwegian and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{type|t(null, null, 'en')}/{slug}&lt;/code&gt; for English.&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2015-01-05T12:56:10.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5465" PostTypeId="1" AcceptedAnswerId="5492" CreationDate="2015-01-05T14:08:01.567" Score="1" ViewCount="525" Body="&lt;p&gt;I understand I can use a conditional to output a 'next page' link only when next pages exist, but I am finding a problem with direct URLs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have 20 entries and 10 per page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL &lt;strong&gt;/news&lt;/strong&gt; (or &lt;strong&gt;/news/p1&lt;/strong&gt;) and &lt;strong&gt;/news/p2&lt;/strong&gt; should work, but I would expect &lt;strong&gt;/news/p3&lt;/strong&gt; to show no results or a message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm finding however is that &lt;strong&gt;/news/p3&lt;/strong&gt; and beyond returns the last entry in the collection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(listingSection).order('postDate desc').limit(2) as entriesOnPage %}&#xA;&#xA;    &amp;lt;div class=&quot;ral-loading ral-hero-block ral-headline&quot;&amp;gt;Loading the latest content...&amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;isotope js-isotope&quot; &amp;gt;&#xA;&#xA;        {% for entry in entriesOnPage %}&#xA;&#xA;            {% if entry.section.handle != 'tweet' %}&#xA;&#xA;                {% switch entry.tileSize %}&#xA;&#xA;                    {% case &quot;Single&quot; %}&#xA;&#xA;                        {% include '_partials/_isotope_block_single.html' %}&#xA;&#xA;                    {% case &quot;Double Horizontal&quot; %}&#xA;&#xA;                        {% include '_partials/_isotope_block_horizontal.html' %}&#xA;&#xA;                    {% case &quot;Double Vertical&quot; %}&#xA;&#xA;                        {% include '_partials/_isotope_block_vertical.html' %}&#xA;&#xA;                    {% case &quot;Quadruple&quot; %}&#xA;&#xA;                        {% include '_partials/_isotope_block_big.html' %}&#xA;&#xA;                    {% case &quot;Quote&quot; %}&#xA;&#xA;                        {% include '_partials/_isotope_block_quote.html' %}&#xA;&#xA;                {% endswitch %}&#xA;&#xA;            {% else %}&#xA;&#xA;                {% include '_partials/_isotope_block_tweet.html' %}&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;&#xA;        &amp;lt;div class=&quot;ral-load-more-posts nav-previous&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;                &amp;lt;a class=&quot;ral-load-more-posts-text&quot; href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Load more posts&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-01-05T16:30:47.307" LastActivityDate="2015-01-06T11:51:03.960" Title="Pagination returns a result after last page has been reached" Tags="&lt;entries&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5467" PostTypeId="2" ParentId="1467" CreationDate="2015-01-05T16:03:11.007" Score="32" Body="&lt;p&gt;This isn't documented, so it's subject to change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you set a Single to be the homepage, its slug is automatically set to &lt;code&gt;__home__&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your homepage to be part of a Structure, rather than a separate Single, you can set the slug of a Structure entry to &lt;code&gt;__home__&lt;/code&gt;, which makes it act as the site's homepage and gives it that little Home icon in place of its slug in the structure view.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-01-05T16:03:11.007" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5468" PostTypeId="1" AcceptedAnswerId="5473" CreationDate="2015-01-05T16:21:43.033" Score="1" ViewCount="601" Body="&lt;p&gt;I have a field in my users of type user. This field holds a user's employer (another user).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get a collection of all the employees in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;craft()-&amp;gt;users-&amp;gt;relatedTo($currentUser);&lt;/code&gt; (where &lt;code&gt;$currentUser&lt;/code&gt; is the employer) as that's pretty much how I'd do it in a template, but of course relatedTo isn't part of the usersService.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I do this without just getting every user, checking their employer field and filtering out the matches?&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2015-01-05T17:43:18.510" Title="How can I find users by field value?" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5469" PostTypeId="2" ParentId="5462" CreationDate="2015-01-05T17:00:22.660" Score="4" Body="&lt;p&gt;After checking out the craft/app/etc folder, I noticed the cache folder was missing. It turns out that the problem was with my FTP client ignoring folders named &quot;cache&quot;. So really a dumb mistake on my part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help @BradBell!&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2015-01-05T17:00:22.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5470" PostTypeId="1" AcceptedAnswerId="5493" CreationDate="2015-01-05T17:02:38.150" Score="1" ViewCount="351" Body="&lt;p&gt;I just realized that my page is also accessible when there is a .html extension on the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url would be:&#xA;&lt;a href=&quot;http://musikwerkluzern.ch/programm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://musikwerkluzern.ch/programm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but &lt;a href=&quot;http://musikwerkluzern.ch/programm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://musikwerkluzern.ch/programm.html&lt;/a&gt; works as well but some tags are not being rendered with the html extension attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for some reason the google search results link to the page with .html attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cwqhy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's bad. How can I prevent this? Is this a &lt;code&gt;.htaccess&lt;/code&gt; thing?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-01-06T14:07:56.133" Title="url with .html extension" Tags="&lt;url&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5471" PostTypeId="1" AcceptedAnswerId="5472" CreationDate="2015-01-05T17:04:26.933" Score="2" ViewCount="1072" Body="&lt;p&gt;I'm in the process of creating a multi-environment config and my client has set up a staging server with non-standard ports for the mysql server. I am unsure how to add the port number in the config file. I've tried the following with no success.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'STAGING' =&amp;gt; array(&#xA;        'server' =&amp;gt; '123.456.789.123:3939',&#xA;        'user' =&amp;gt; 'myusername',&#xA;        'password' =&amp;gt; '***********',&#xA;        'database' =&amp;gt; 'mydatabase',&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been able to successfully connect the database when on a completely different server/mysql combo so I know that the config files work. &lt;/p&gt;&#xA;" OwnerUserId="312" LastActivityDate="2015-01-05T21:31:42.097" Title="Multi-Environment Config using port in database server" Tags="&lt;config&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5472" PostTypeId="2" ParentId="5471" CreationDate="2015-01-05T17:28:09.907" Score="4" Body="&lt;p&gt;Try using a port variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'STAGING' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'port' =&amp;gt; '3939',&#xA;    'user' =&amp;gt; 'myusername',&#xA;    'password' =&amp;gt; '***********',&#xA;    'database' =&amp;gt; 'mydatabase',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-05T21:31:42.097" LastActivityDate="2015-01-05T21:31:42.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5473" PostTypeId="2" ParentId="5468" CreationDate="2015-01-05T17:43:18.510" Score="4" Body="&lt;p&gt;&lt;code&gt;ElementCriteriaModel&lt;/code&gt; supports 'users' as well as 'entries'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $currentUser,&#xA;    'field'         =&amp;gt; $employer&#xA;);&#xA;$employees = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-05T17:43:18.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5475" PostTypeId="1" AcceptedAnswerId="5477" CreationDate="2015-01-05T19:23:03.287" Score="1" ViewCount="322" Body="&lt;p&gt;Has anyone out there found a way to do a fuzzy search in the Asset Library? Currently, search only seems to return results that match the exact search query. Any help or plugin link is greatly apprecitated! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-12-04T23:30:53.733" Title="Fuzzy search in Asset Library" Tags="&lt;assets&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5476" PostTypeId="2" ParentId="5463" CreationDate="2015-01-05T19:25:13.117" Score="2" Body="&lt;p&gt;If I understand correctly, it looks like you really only have 2 branches to your tree (products and services). Everything else applies to all products or all services respectively and is one-to-one (except for budget). Instead of using categories, I would probably opt for using &lt;code&gt;Entry Type&lt;/code&gt; to determine whether it's a product or service, and dropdown and/or checkbox fields to determine the product/service attributes, which you can then use to search for products/services directly using an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Channel =&amp;gt; productsServices&#xA;    Entry Type =&amp;gt; product&#xA;        Field =&amp;gt; testingType (dropdown)&#xA;        Field =&amp;gt; surfaceType (dropdown)&#xA;    Entry Type =&amp;gt; service&#xA;        Field =&amp;gt; reportingLevel (dropdown)&#xA;        Field =&amp;gt; isoCertification (checkbox)&#xA;        Field =&amp;gt; price&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you can use javascript to display the correct form questions (based on the answer to the first question) using &lt;code&gt;.on('change', function(event){..}&lt;/code&gt;). Select field options can be set dynamically from the field options. Budget options can perhaps be stored in a separate field in a global set ('budgetOptions') for example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Who will test your self-cleaning surface?&#xA;&amp;lt;select name=&quot;productServiceType&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;product&quot;&amp;gt;I'll test it myself&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;service&quot;&amp;gt;I want the experts&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;product-questions&quot; style=&quot;display:none&quot;&amp;gt;&#xA;    What is the reason for your testing?&#xA;    &amp;lt;select name=&quot;testingType&quot;&amp;gt;...&amp;lt;/select&amp;gt;&#xA;    What surface type will you be testing?&#xA;    &amp;lt;select name=&quot;surfaceType&quot;&amp;gt;...&amp;lt;/select&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;services-questions&quot; style=&quot;display:none&quot;&amp;gt;&#xA;    What level of reporting do you require?&#xA;    &amp;lt;select name=&quot;reportingLevel&quot;&amp;gt;...&amp;lt;/select&amp;gt;&#xA;    Do you require ISO certification?&#xA;    &amp;lt;select name=&quot;isoCertification&quot;&amp;gt;...&amp;lt;/select&amp;gt;&#xA;    What is your budget?&#xA;    &amp;lt;select name=&quot;budget&quot;&amp;gt;...&amp;lt;/select&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then submit the form to your productServices template, retrieve the attributes and find the associated products/services.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set default params #}&#xA;{% set params = {&#xA;    section: 'productsServices',&#xA;    limit: null&#xA;} %}&#xA;&#xA;{# determine productService Type #}&#xA;{% set type = craft.request.getParam('productServiceType') %}&#xA;&#xA;{# set product params #}&#xA;{% if type == &quot;product&quot; %}&#xA;    {% set testingTypeParam = craft.request.getParam('testingType') %}&#xA;    {% set surfaceTypeParam = craft.request.getParam('surfaceType') %}&#xA;    {% set params = params|merge([&#xA;        testingType: testingTypeParam, &#xA;        surfaceType: surfaceTypeParam &#xA;    ]) %}&#xA;{% endif %}&#xA;&#xA;{# set service params #}&#xA;{% if type == &quot;service&quot; %}&#xA;    {% set reportingLevelParam = craft.request.getParam('reportingLevel') %}&#xA;    {% set isoCertificationParam = craft.request.getParam('isoCertification') %}&#xA;    {% set budgetParam = craft.request.getParam('budget') %}&#xA;    {% set params = params|merge( [&#xA;        reportingLevel: reportingLevelParam, &#xA;        isoCertification: isoCertificationParam&#xA;        price: '&amp;gt;= ' ~ budgetParam&#xA;    ]) %}&#xA;{% endif %}&#xA;&#xA;{# retrieve entries #}&#xA;{% set entries = craft.entries(params) %}&#xA;{% for entry in entries %}&#xA;    {{ title }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested, but should be close.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-05T19:36:55.547" LastActivityDate="2015-01-05T19:36:55.547" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="5477" PostTypeId="2" ParentId="5475" CreationDate="2015-01-05T19:32:46.630" Score="3" Body="&lt;p&gt;You can do a fuzzy search using the &lt;code&gt;*&lt;/code&gt; character.  See &lt;a href=&quot;http://buildwithcraft.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for a list of supported syntaxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;As of &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5&lt;/a&gt;, you can enable &lt;a href=&quot;https://craftcms.com/help/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;fuzzy&lt;/a&gt; searching by default.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-04T23:30:53.733" LastActivityDate="2015-12-04T23:30:53.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5478" PostTypeId="1" AcceptedAnswerId="5479" CreationDate="2015-01-05T19:32:55.190" Score="1" ViewCount="285" Body="&lt;p&gt;I'm building out a front end form that users will use to fill out with their information. Naturally, when a user first signs up, their profile fields are empty and a blank space appears for them to add in their info later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works well on all fields on my form &lt;em&gt;except&lt;/em&gt; the table field type. If nothing has been entered the loop will simply display nothing. I've been reading through &lt;a href=&quot;https://craftcms.stackexchange.com/questions/824/test-for-empty-field&quot;&gt;this&lt;/a&gt; answer, but so far checking &lt;code&gt;is empty&lt;/code&gt; or &lt;code&gt;|length&lt;/code&gt; is not working on my form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current loop, which works great as long as the info is entered through the CP. How do I get an empty table field type to display on the front-end so a user can update their profile?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;tr&amp;gt;&#xA;    &amp;lt;td&amp;gt;Institution&amp;lt;/td&amp;gt;&#xA;    {% for row in currentUser.providerCredentials %}&#xA;      &amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;accreditingInstitution&quot; class=&quot;name-field&quot; name=&quot;fields[providerCredentials][0][col1]&quot; value=&quot;{{row.accreditingInstitution}}&quot;&amp;gt;&amp;lt;/td&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/tr&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-01-05T22:49:54.810" Title="How do I get an empty table field type to display on the front-end so a user can update their profile?" Tags="&lt;form&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5479" PostTypeId="2" ParentId="5478" CreationDate="2015-01-05T21:40:57.953" Score="1" Body="&lt;p&gt;As far as I know, I don't think that there is any built-in way to replicate the table fieldtype functionality on the front-end (i.e. with 'add row','remove row', etc.) I think that you would have to create your own buttons and then manipulate the dom using javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template you would want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Provider Credentials&#xA;&amp;lt;table class=&quot;js-providerCredentials&quot;&amp;gt;&#xA;    {% for row in currentUser.providerCredentials %}&#xA;        &amp;lt;tr id=&quot;accreditingInstitution-{{ loop.index }}&quot;&amp;gt;&#xA;            &amp;lt;td&amp;gt;Institution&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; class=&quot;name-field&quot; name=&quot;fields[providerCredentials][{{ loop.index }}][col1]&quot; value=&quot;{{ row.accreditingInstitution }}&quot;&amp;gt;&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&amp;lt;a class=&quot;button add-row&quot; role=&quot;button&quot;&amp;gt;Add row&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your javascript file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.add-row').on('click', function(event){&#xA;    $(this).preventDefault();&#xA;&#xA;    var rowCount = $('.js-providerCredentials').children('tr').length,&#xA;        newRow = '&amp;lt;tr id=&quot;accreditingInstitution-' + (rowCount+1) + '&quot;&amp;gt;&amp;lt;td&amp;gt;Institution&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;input type=&quot;text&quot; class=&quot;name-field&quot; name=&quot;fields[providerCredentials][' + (rowCount+1) + '][col1]&quot; value=&quot;&quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;';&#xA;&#xA;    $('.js-providerCredentials').append(newRow);&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure how your table is set up exactly, but the principle should be the same. For another example of how to format the dom for form submission see the answer to this question,  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4860/edit-a-table-field-type-from-the-front-end&quot;&gt;editing a table field type from the front end&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-01-05T22:49:54.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5481" PostTypeId="1" CreationDate="2015-01-05T22:37:55.743" Score="0" ViewCount="65" Body="&lt;p&gt;I wrote a simple fieldtype that checks that the field value is unique for a specific entry type: &lt;a href=&quot;https://github.com/fuel-digital/Craft-Unique-Text-FieldType&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fuel-digital/Craft-Unique-Text-FieldType&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This worked fine initially but after the recent core updates, $this-&gt;element in the valueExists() method is null on new entries, where previously it was an instance of ElementType::Entry or whatever else the field was attached to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I could instantiate a new ElementType::Entry object if one doesn't exist, this limits the field's use to Entries, and not Assets, Users etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some other way of getting the element's value now? I can't see anything when inspecting the field class.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-01-05T22:37:55.743" Title="Can no longer get the ElementType a field is attached to" Tags="&lt;plugin-development&gt;&lt;entry-type&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5482" PostTypeId="1" AcceptedAnswerId="5501" CreationDate="2015-01-05T23:28:25.727" Score="2" ViewCount="1529" Body="&lt;p&gt;I want to see if a certain field exists in a block of a matrix. Here is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.someStepContainer %}&#xA;  &amp;lt;div class=&quot;each-step&quot;&amp;gt;&#xA;&#xA;    {% if block.type == &quot;someStep&quot; %}&#xA;      &amp;lt;div class=&quot;step-number&quot;&amp;gt;&amp;lt;span&amp;gt;{{loop.index}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;h3 class=&quot;step-title&quot;&amp;gt;{{block.stepTitle}}&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;div class=&quot;step-description&quot;&amp;gt;{{block.stepDescription}}&amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;! -- this is part I'm trying to fix --&amp;gt;&#xA;&#xA;      {% if block.stepAccordionContent %}&#xA;        &amp;lt;div class=&quot;accordion-section&quot;&amp;gt;&#xA;          {% for row in block.stepAccordionContent %}&#xA;            &amp;lt;h3 class=&quot;accordion-control&quot;&amp;gt;{{row.accordionTitle}}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p class=&quot;accordion-content&quot; style=&quot;display: none;&quot;&amp;gt;{{row.accordionContent}}&amp;lt;/p&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;&#xA;&#xA;      &amp;lt;!-- end part --&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.stepAccordionContent | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this still yields an empty&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;accordion-section&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stepAccordionContent&lt;/code&gt; is a table.&lt;/p&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="1152" LastEditDate="2015-01-06T16:21:36.937" LastActivityDate="2015-01-07T01:26:07.343" Title="How can I tell if a field exists in a block of a matrix?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="5483" PostTypeId="1" CreationDate="2015-01-06T00:27:50.610" Score="1" ViewCount="497" Body="&lt;p&gt;I have a long if/else block within a for loop in my template and I wanted to cache all of it (it loops over a Matrix field, checking for different block types on each row and outputs the correct code as needed). However, in one of the ifelse blocks, I have a statement with a RAND parameter that I don't want cached. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.sidebar %}&#xA;    {% if block.type == &quot;someType&quot; %}&#xA;        ...Presentiaon code&#xA;    {% elseif block.type == &quot;someType&quot; %}&#xA;        ...Presentiaon code&#xA;    {% elseif block.type == &quot;someType&quot; %}&#xA;        {% set randomEntry = craft.entries.section(&quot;testimonials&quot;).order('RAND()').first() %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My challenge is trying to find a way to cache this long block but still let the RAND work. My solution was to try to put the matrix field into a variable, cache that variable and then iterate over the variable's data (the thinking here that the variable has all the process-intensive DB queries). Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% set myField = entry.myMatrixField %}&#xA;{% endcache %}&#xA;&#xA;{% for block in myField %}&#xA;    {% if block.type == &quot;someType&quot; %}&#xA;        ...Presentiaon code&#xA;    {% elseif block.type == &quot;someType&quot; %}&#xA;        ...Presentiaon code&#xA;    {% elseif block.type == &quot;someType&quot; %}&#xA;        {% set randomEntry = craft.entries.section(&quot;testimonials&quot;).order('RAND()').first() %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this fails after the template has been cached with an error that the 'myField' variable does not exist. So I'm thinking I can't do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way I could cache this? I considered breaking up the ifelse blocks into separate if/endif clauses and caching each except the one with the RAND paramater in it but I'm thinking that won't improve performance much if the for loop still has to run outside of it uncached.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2015-01-06T19:53:08.160" Title="Caching variables for use elsewhere in a template?" Tags="&lt;cache&gt;&lt;variable&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5484" PostTypeId="2" ParentId="5483" CreationDate="2015-01-06T00:45:29.753" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; This doesn't work. Leaving it here temporarily in case it helps generate more ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Haven't tried this myself, but you might try returning all testimonials and then use twigs &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/random.html&quot; rel=&quot;nofollow&quot;&gt;random&lt;/a&gt; method to select one after the fact.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;&#xA;    {% set myField = entry.myMatrixField %}&#xA;&#xA;    {% for block in myField %}&#xA;        {% if block.type == &quot;someType&quot; %}&#xA;            {% set presentationCode %}&#xA;                ...Presentation code&#xA;            {% endset %}&#xA;        {% elseif block.type == &quot;someType&quot; %}&#xA;            {% set presentationCode %}&#xA;                ...Presentation code&#xA;            {% endset %}&#xA;        {% elseif block.type == &quot;someType&quot; %}&#xA;            {% set randomEntry = craft.entries.section(&quot;testimonials&quot;).find() %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&#xA;{% if randomEntry %}&#xA;    {% set randomEntry = random(randomEntry) %}&#xA;    {% set presentationCode %}&#xA;        ...Presentiaon code&#xA;    {% endset %}&#xA;{% endif %}&#xA;&#xA;{{ presentationCode }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: I suspect that you will need the &lt;code&gt;.find()&lt;/code&gt; on the end of the ElementCriteriaModel statement so that it gets converted to an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; To do this you will also probably need to place all your presentation code in a variable and then display later in the template.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-06T19:14:02.863" LastActivityDate="2015-01-06T19:14:02.863" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5485" PostTypeId="1" AcceptedAnswerId="5488" CreationDate="2015-01-06T03:09:28.047" Score="1" ViewCount="729" Body="&lt;p&gt;Can I set the value of a &lt;a href=&quot;http://buildwithcraft.com/docs/color-fields&quot; rel=&quot;nofollow&quot;&gt;Color Field&lt;/a&gt; to a hex value? Or only if the particular browser's color picker supports this? Maybe this is a feature request: please let us get and set color values in hex.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-06T18:29:01.007" Title="Can I set color fields by hex value" Tags="&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5486" PostTypeId="2" ParentId="5416" CreationDate="2015-01-06T03:10:35.520" Score="2" Body="&lt;p&gt;This is a very difficult problem. And to be honest, I'm not sure if 3 dishes will actually cover the possible combinations in the way that you're asking. Just the common dietPreferences alone could result in 63 combinations (6+15+20+15+6+1). If you add allergens into the mix the numbers get very large very quickly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dietPreferences = ['beef', 'pork', 'chicken', 'fish', 'vegetarian', 'vegan'];&#xA;allergens = ['dairy', 'peanuts', 'gluten', 'shellfish', 'etc', 'etc'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think that you will need to reduce the combinations to something like ['redmeat(including chicken)', 'redmeat+fish', 'fish+vegetarian', 'vegetarian', 'all']; And then always have a meat, fish and vegetarian dish that do not include any allergens. Vegans would not be supported; nor would those allergic to dairy, gluten, and other ingredients that are difficult to avoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as a CMS goes however, craft is as capable as any CMS to tackle the problem, but you would need to establish the parameters carefully first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on relationships check out the documentation for &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt;. You might also do a search on this site for 'relatedTo', 'advanced search' and 'elementCriteriaModel'.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-06T03:10:35.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5488" PostTypeId="2" ParentId="5485" CreationDate="2015-01-06T06:03:52.360" Score="5" Body="&lt;p&gt;If you have created a Color Field the color selector dialogue uses your browsers built-in color selector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Chrome and Firefox, you should see a dialogue like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;| &lt;img src=&quot;https://i.stack.imgur.com/mCOXg.png&quot; alt=&quot;enter image description here&quot;&gt;  | &lt;img src=&quot;https://i.stack.imgur.com/emV3H.png&quot; alt=&quot;enter image description here&quot;&gt; |&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you click over to the 2nd tab (indicated by the sliders) you'll be able to insert a &lt;code&gt;hex&lt;/code&gt; value for the color in the input field at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Firefox you'll need to select RGB Sliders from the dropdown, then you'll see the Hex color input at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nc3j7.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="476" LastEditDate="2015-01-06T18:29:01.007" LastActivityDate="2015-01-06T18:29:01.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5489" PostTypeId="1" AcceptedAnswerId="5491" CreationDate="2015-01-06T09:25:41.470" Score="2" ViewCount="684" Body="&lt;p&gt;I'm new to craft so this is a bit newbie question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category group with a set of categories, each category has a plain text field associated with it. The category group is then used as a field in a Matrix so the user can select one of the categories in the group. Basically all I want to do is list the plain text field from the selected category onto the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried working something out from &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt; (Going through a matrix section) but I just kept breaking everything. Any assistance would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1154" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:41.203" LastActivityDate="2017-11-09T19:38:41.203" Title="How do I output the value of a field from a Category selected from a Matrix?" Tags="&lt;matrix&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5490" PostTypeId="2" ParentId="5444" CreationDate="2015-01-06T10:34:18.770" Score="2" Body="&lt;p&gt;This doesn’t appear to be possible without a plugin. The &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;formattingAdd&lt;/a&gt; will add additional options to the Formatting menu, but will not alter the behavior of any of the other buttons, and you can only set the &lt;code&gt;tag&lt;/code&gt; properties to &lt;code&gt;p&lt;/code&gt;, &lt;code&gt;pre&lt;/code&gt;, &lt;code&gt;blockquote&lt;/code&gt;, and &lt;code&gt;h[1-6]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option might be to use a Matrix field with two block types: Text and List. Text blocks would have a Rich Text field, and List blocks would have a Table field with one column, plus a Dropdown field that specifies what the class should be. From your templates you would do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {% if block.type == 'text' %}&#xA;        {{ block.text }}&#xA;    {% elseif block.type == 'list' %}&#xA;        &amp;lt;ul class=&quot;{{ block.myDropdownField }}&quot;&amp;gt;&#xA;            {% for row in block.myTableField %}&#xA;                &amp;lt;li&amp;gt;{{ row.myColumnHandle }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really want to keep all this within Redactor and go the plugin route, you can use our &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips&quot; rel=&quot;nofollow&quot;&gt;Redactor Clips&lt;/a&gt; plugin as a starting point.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-06T10:34:18.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5491" PostTypeId="2" ParentId="5489" CreationDate="2015-01-06T11:38:55.100" Score="2" Body="&lt;p&gt;Without knowing what your field handles are, this is the gist of how you’d do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;   Loop through each block within your Matrix field,&#xA;   assigning them to a `block` variable:&#xA;#}&#xA;&#xA;{% for block in entry.myMatrixField %}&#xA;&#xA;    {#&#xA;       Loop through each category within this Matrix block,&#xA;       assigning them to a `category` variable:&#xA;    #}&#xA;&#xA;    {% for category in block.myCategoriesField %}&#xA;&#xA;        {#&#xA;           Output the plain text field value:&#xA;        #}&#xA;&#xA;        &amp;lt;p&amp;gt;{{ category.myPlainTextField }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-06T11:38:55.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5492" PostTypeId="2" ParentId="5465" CreationDate="2015-01-06T11:51:03.960" Score="1" Body="&lt;p&gt;You can detect if the requested page is greater than the total available pages for the current list of entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate entries as entriesOnPage %}&#xA;&#xA;    {% if craft.request.getPageNum() &amp;gt; paginate.totalPages %}&#xA;        &amp;lt;p&amp;gt;No results&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;        {% for entry in entriesOnPage %}&#xA;            ...&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than displaying a message, you could also choose to put an &lt;code&gt;{% exit 404 %}&lt;/code&gt; tag in there.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-06T11:51:03.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5493" PostTypeId="2" ParentId="5470" CreationDate="2015-01-06T14:07:56.133" Score="2" Body="&lt;p&gt;Okay. I found the solution If anyone runs into the same issue.&#xA;This must be a server problem which I can't solve so there is a &lt;a href=&quot;https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url&quot;&gt;htaccess solution&lt;/a&gt; to remove the .html extension:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.*)\.html$ /$1 [L,R=301] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-01-06T14:07:56.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5495" PostTypeId="1" CreationDate="2015-01-06T16:50:01.857" Score="2" ViewCount="209" Body="&lt;p&gt;I'm working on a site where the site background is chosen randomly from among the entries in an &quot;artwork&quot; channel. I'm using the following code in my &lt;code&gt;_layout.html&lt;/code&gt; template to get the url for the chosen image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# choose a random entry for the site background #}&#xA;{% set randomArtwork = craft.entries.section('artwork').order('RAND()').first() %}&#xA;&#xA;{# set the url for the background image #}&#xA;{% set backgroundImageUrl = randomArtwork.artImageBkg.first().url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The chosen image is then displayed by adding an inline style to the body tag like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body{% if backgroundImage is defined %} style=&quot;background-image: url({{ backgroundImageUrl }});&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Right now, this code runs on every page request and a different image is displayed on every page load on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to be able to run this code only once per user, per site visit so that the background image will change on repeat visits to the site, but on a single visit, the user will see one persistent image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about doing this in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, I also thought to use Craft's &lt;code&gt;{% cache %}&lt;/code&gt; tags to set my template variables on a timed basis so that visitors in a particular hour would only see one persistent image, but I couldn't figure out how to get this to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I tried to use the &lt;code&gt;{% cache %}&lt;/code&gt; tags on individual templates, I got a warning that a template that extends another (in this case, my &lt;code&gt;_layout.html&lt;/code&gt; template) can't have a body.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And adding the &lt;code&gt;{% cache %}&lt;/code&gt; tags to my &lt;code&gt;_layout.html&lt;/code&gt; template wasn't affecting the persistence of the background image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-01-06T19:00:14.003" Title="How can I set a persistent template variable to use across multiple pages in one site visit?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5496" PostTypeId="2" ParentId="952" CreationDate="2015-01-06T18:50:53.573" Score="4" Body="&lt;p&gt;These are the steps that solved the problem for me (PHP 5.4 , Nginx):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Delete the contents of &lt;code&gt;craft/storage/runtime&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Set the &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow&quot;&gt;correct file permissions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Added &lt;code&gt;'overridePhpSessionLocation' =&amp;gt; true,&lt;/code&gt; to the site configuration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="133" LastActivityDate="2015-01-06T18:50:53.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5497" PostTypeId="2" ParentId="5495" CreationDate="2015-01-06T19:00:14.003" Score="1" Body="&lt;p&gt;Sounds like you need a good &lt;strong&gt;cookie&lt;/strong&gt; solution to keep track of which background has been chosen for each visitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow&quot;&gt;LJ Cookies plugin&lt;/a&gt; to easily set &amp;amp; retrieve the filename of the background image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't believe the &lt;code&gt;cache&lt;/code&gt; tag will be useful to you in this case.)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-01-06T19:00:14.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5498" PostTypeId="1" CreationDate="2015-01-06T19:44:16.497" Score="1" ViewCount="358" Body="&lt;p&gt;Is there any reason why image transformations might not be working locally? I just get a bunch of these &quot;&lt;a href=&quot;http://site.dev/cpresources/transforms/7&quot; rel=&quot;nofollow&quot;&gt;http://site.dev/cpresources/transforms/7&lt;/a&gt; 404 (Not Found)&quot; as error messages. The image directory has the correct permissions...﻿&lt;/p&gt;&#xA;" OwnerUserId="1157" LastActivityDate="2017-02-20T14:25:49.907" Title="Performing Image Transformations Locally" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5499" PostTypeId="2" ParentId="5483" CreationDate="2015-01-06T19:53:08.160" Score="0" Body="&lt;p&gt;Here's another answer, although more of a hack than a solution. Test the output of the cached content and do something else if it's set to some predetermined value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content %}&#xA;    {% cache for 5 mins %}&#xA;        {% if block.type == &quot;someType&quot; %}&#xA;            ...Presentation code&#xA;        {% elseif block.type == &quot;someOtherType&quot; %}&#xA;            triggerTestimonials&#xA;        {% endif %}&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&#xA;{% if content|trim == &quot;triggerTestimonials&quot; %}&#xA;    {% set randomEntry = craft.entries.section(&quot;testimonials&quot;).order('RAND()').first() %}&#xA;    ...&#xA;{% else %}&#xA;    {{ content }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-06T19:53:08.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5500" PostTypeId="1" AcceptedAnswerId="6584" CreationDate="2015-01-06T20:08:20.053" Score="1" ViewCount="613" Body="&lt;p&gt;Is it possible in a front end entry form to pass the URL of a file to an assets field and have it upload that way?  Specifically, I'm trying to move an image from one assets field &amp;amp; upload folder to another in an edit entry form.&lt;/p&gt;&#xA;" OwnerUserId="638" LastActivityDate="2015-01-14T15:42:53.597" Title="Upload file into Assets using URL?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5501" PostTypeId="2" ParentId="5482" CreationDate="2015-01-06T22:13:13.527" Score="1" Body="&lt;p&gt;You can use &lt;code&gt;{% if block.stepAccordionContent|length  %}...{% endif %}&lt;/code&gt; to test if any rows are defined in your table field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: When you create a table field it will have an empty row defined under 'Default Values', which should be removed; otherwise all new instances of the table will have an empty row defined by default causing &lt;code&gt;block.stepAccordionContent|length&lt;/code&gt; to return 1, instead of 0 as expected.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-07T01:26:07.343" LastActivityDate="2015-01-07T01:26:07.343" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5502" PostTypeId="1" AcceptedAnswerId="5503" CreationDate="2015-01-06T22:43:18.170" Score="5" ViewCount="2985" Body="&lt;p&gt;I'm trying to display the file size of a file uploaded in Assets. I can get it to display the number of bytes in the file. &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets#size&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.assets#size&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to format that number to Mb's?&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:47.603" LastActivityDate="2018-12-12T13:51:55.497" Title="Is there a way to format the Asset Size variable to Mb, Kb, etc.?" Tags="&lt;assets&gt;&lt;format&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5503" PostTypeId="2" ParentId="5502" CreationDate="2015-01-06T23:19:08.960" Score="10" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bytes = asset.size %}&#xA;{% set kiloBytes = (bytes / 1024)|round(2) %}&#xA;{% set megaBytes = (kiloBytes / 1024)|round(2) %}&#xA;&#xA;bytes = {{ bytes }}&#xA;kiloBytes = {{ kiloBytes }}&#xA;megaBytes = {{ megaBytes }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can look at Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/number_format.html&quot; rel=&quot;noreferrer&quot;&gt;number_format&lt;/a&gt; filter if you want to get fancy with how to display the numbers.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3951" LastEditDate="2017-10-24T15:27:07.333" LastActivityDate="2017-10-24T15:27:07.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6495" PostTypeId="2" ParentId="5445" CreationDate="2015-01-07T07:38:30.117" Score="1" Body="&lt;p&gt;There was a problem with the URL of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RebrandController class removes '?' querystrings from the URL but in my case I had a '&amp;amp;'. Removing that solved the issue and Brad has confirmed this fix has been rolled into the next release.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-01-07T07:38:30.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6496" PostTypeId="1" AcceptedAnswerId="6540" CreationDate="2015-01-07T09:44:07.980" Score="1" ViewCount="199" Body="&lt;p&gt;This is very odd to me. I am using this in my templates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layoutGist.html&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My layout is showing up in my Google Analytics. GA is showing showing traffic to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/templates/_layoutGist.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seams very peculiar as I would think the file would be fully rendered before Google got ahold of it. Is my tracking code in the wrong place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ExbtT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="603" LastEditDate="2015-01-07T23:40:05.707" LastActivityDate="2015-01-09T15:16:24.983" Title="Why are my template filenames showing up in Google Analytics" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6497" PostTypeId="1" AcceptedAnswerId="6498" CreationDate="2015-01-07T12:18:14.963" Score="2" ViewCount="1514" Body="&lt;p&gt;I have some matrix fields containing a date. I then loop through the entries in a category looking for entries containing a matrix field with a date during the next month. Everytime a matrix field is found, the entry id is added to an array of entries. Like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.entries.section('events').type('eventWithMultipleDays').relatedTo(category).find() %}&#xA;    {% for date in event.dates if date.multiDate &amp;gt;= now | date(&quot;Y-m-d&quot;) and date.multiDate &amp;lt;= now | date_modify('+1 month') %}&#xA;        {# ADD THE FILTERED EVENT TO THE CATEGORYSEVENTS ARRAY #}&#xA;        {# NOTE SQUARE BRACKETS CREATE AN ARRAY - NECESSARY FOR THE MERGE #}&#xA;        {% set categoryEvents = categoryEvents | merge([event]) %}          &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not surprisingly, some entries contain several matrix blocks with dates falling within the next month, which means the array is containing duplicate entries. That means when I output the entries array, I'm getting repetition, using this, as you'd expect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in categoryEvents %}&#xA;    {# details output #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to only get unique values out of this array? Or, if not, a better way to create the array perhaps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Clive&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-01-07T12:22:30.610" Title="Filter out duplicate entries in array?" Tags="&lt;matrix&gt;&lt;datetime&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6498" PostTypeId="2" ParentId="6497" CreationDate="2015-01-07T12:22:30.610" Score="3" Body="&lt;p&gt;Holy moly! I've solved it already, Batman. Check the array before adding the event to it, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event not in categoryEvents %}&#xA;        {% set categoryEvents = categoryEvents | merge([event]) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-01-07T12:22:30.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6499" PostTypeId="1" AcceptedAnswerId="6500" CreationDate="2015-01-07T14:41:22.857" Score="2" ViewCount="2478" Body="&lt;p&gt;I have a template called &lt;code&gt;download&lt;/code&gt; that receives an asset ID, looks it up and should force the browser to download the file. I've gotten this far with the &lt;code&gt;{% headers %}&lt;/code&gt; tag, but I can't figure out how to read the raw contents of the file and output it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.id(craft.request.getLastSegment()).first() %}&#xA;{% header 'Content-Description: File Transfer' %}&#xA;{% header 'Content-Type: '~asset.mimetype %}&#xA;{% header 'Content-Disposition: attachment; filename='~asset.filename %}&#xA;{% header 'Content-Transfer-Encoding: binary' %}&#xA;{% header 'Expires: 0' %}&#xA;{% header 'Cache-Control: must-revalidate' %}&#xA;{% header 'Pragma: public' %}&#xA;{% header 'Content-Length: '~asset.size %}&#xA;{# How to print raw contents of asset.url ??? #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2015-01-07T18:36:44.830" Title="Force download of asset file from template" Tags="&lt;templating&gt;&lt;assets&gt;&lt;url&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6500" PostTypeId="2" ParentId="6499" CreationDate="2015-01-07T18:36:44.830" Score="3" Body="&lt;p&gt;I don't think you're going to be able to do this out-of-the-box, but should be stupidly simple with a quick &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that registers its own Twig extension.  See &lt;a href=&quot;https://github.com/low/low_regex&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That extension would add a Twig function that's basically just a simple wrapper for PHP's &lt;a href=&quot;http://php.net/manual/en/function.file-get-contents.php&quot; rel=&quot;nofollow&quot;&gt;file_get_contents&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your template, you'd do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the file contents #}&#xA;{% set contents = file('/path/to/asset.zip') %}&#xA;&#xA;{# output it #}&#xA;{{ contents }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-07T18:36:44.830" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6502" PostTypeId="1" CreationDate="2015-01-07T20:40:18.823" Score="1" ViewCount="103" Body="&lt;p&gt;I have a title field with value: &quot;Nobel Participatie Portefeuille&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my template I want to trim the word &quot;Nobel&quot;, You can do this with twig trim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;so this is my code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ entry.title | trim('Nobel ') }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my output is &quot;Nobel Cashflow Portefeui&quot; (missing &quot;lle&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other words work normal. &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-01-07T20:47:46.617" Title="Trim part of title. Possible bug?" Tags="&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6503" PostTypeId="2" ParentId="6502" CreationDate="2015-01-07T20:47:46.617" Score="2" Body="&lt;p&gt;So this would be a better solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ entry.title|replace('/^Nobel /', '') }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the support Craft!&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-01-07T20:47:46.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6504" PostTypeId="1" CreationDate="2015-01-07T22:47:11.627" Score="1" ViewCount="308" Body="&lt;p&gt;I'm at a loss. I've set up a font-end user activation workflow that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User registers via a front end form based on Craft's example form&lt;/li&gt;&#xA;&lt;li&gt;User is redirected to a page informing them that they'll be receiving an email with an activation link&lt;/li&gt;&#xA;&lt;li&gt;User clicks the activation link and lands on a welcome page&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Right now my user registration form is working. When a user registers, I can see them added to the CP user list with their email address, firstName and lastName (which I'm also collecting from the registration form). The redirect to the &quot;you'll be receiving an email...&quot; page is working as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I click the activation link to test, I end up on the homepage of my site, not on the uri I've specified in my config settings which look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'defaultImageQuality' =&amp;gt; '65',&#xA;        'useEmailAsUsername' =&amp;gt; true,&#xA;        'loginPath' =&amp;gt; 'member/login',&#xA;        'logoutPath' =&amp;gt; 'member/logout',&#xA;        'postLoginRedirect' =&amp;gt; 'member/my-account',&#xA;        'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;        'activateAccountFailurePath' =&amp;gt; 'member/activation-failed',&#xA;        'activateAccountSuccessPath' =&amp;gt; 'member/activation-success',&#xA;    ),&#xA;other settings below...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm making sure that when I test sign-ups, I'm logged out in a different browser. I've also tried the sequence without &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt; but in that case, I just end up logged out on the homepage of my site rather than on the &lt;code&gt;activation-success&lt;/code&gt; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The activation works, which I can verify in the CP, but I can't figure out why the site isn't respecting my config setting for &lt;code&gt;activateAccountSuccessPath&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="579" LastEditorUserId="579" LastEditDate="2015-01-08T15:01:17.777" LastActivityDate="2015-01-08T15:01:17.777" Title="User activation success path not working (Craft v2.3.2621)" Tags="&lt;config&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6505" PostTypeId="1" CreationDate="2015-01-07T23:12:36.030" Score="10" ViewCount="960" Body="&lt;p&gt;I have 80,000+ files on S3 that need to be added to Craft. The Update Asset Indexes works, but takes over 24 hours and cannot be interrupted. Does anybody have a way to programmatically index assets like this in batches? &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-10-31T16:07:47.540" Title="Update Asset Index in Batches" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;php&gt;&lt;index&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6506" PostTypeId="2" ParentId="6496" CreationDate="2015-01-08T01:06:41.130" Score="2" Body="&lt;p&gt;If your Craft templates folder is above the document root and not public, it couldn't be &quot;real&quot; traffic. Could be residuals left over from testing somehow (like a live preview or test domain or what not.) Not sure I'd worry about it unless they keep increasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did notice you have 2 tracking codes installed... there's one in the head and one in the footer (cranberryburst.com). Could be wrecking havoc?&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-01-08T01:06:41.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6508" PostTypeId="1" CreationDate="2015-01-08T10:57:17.013" Score="0" ViewCount="290" Body="&lt;p&gt;I'm using global fields on a multi language site to get the appropriate content depending on the locales used. Sof far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However on a form page (sproutforms) these globals empty out after the form is submitted while an (input) error occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to overcome this issue?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {# FORM #}&#xA;            &amp;lt;section class=&quot;col-sm-6 col-md-6&quot; style=&quot;padding-bottom: 40px;&quot;&amp;gt;&#xA;&#xA;            {# Prepare our error macro #}&#xA;            {% macro errorList(errors) %}&#xA;                {# To display errors, you want to make sure errors exist, and then you can loop through and display them #}&#xA;                {% if errors %}&#xA;                    {% for error in errors %}&#xA;                        {{ error }}&amp;lt;/br&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endif %}&#xA;            {% endmacro %}&#xA;&#xA;            {% from _self import errorList %}&#xA;&#xA;&#xA;            {# Check if we should display or form or thank you message #}&#xA;            {% if craft.request.getParam('message') == ('thank-you' or 'bedankt-voor-uw-aanvraag') %}&#xA;&#xA;                {# Check for the last entry submitted #}&#xA;                {% set lastEntry = craft.sproutForms.lastEntry() %}&#xA;&#xA;                {% if lastEntry %}&#xA;&#xA;                    {# If the last entry exists, we can output any of the variables that were present in the form submission. #}&#xA;&#xA;                    &amp;lt;div class=&quot;alert fade in&quot;&amp;gt;&#xA;                        &amp;lt;i class=&quot;fa fa-cloud-download alert-icon&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                        &amp;lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot;&amp;gt;×&amp;lt;/button&amp;gt;&#xA;                        &amp;lt;p&amp;gt;Thanks &amp;lt;strong&amp;gt;{{ lastEntry.fullName }}&amp;lt;/strong&amp;gt;! We'll be in touch soon! Did you know you can display any of the values that were submitted in the form?  Here's a list of all the values in the last form submission:&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% else %}&#xA;&#xA;                &amp;lt;form id=&quot;contactform&quot; class=&quot;form-box register-form contact-form&quot; method=&quot;post&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;                    {{ getCsrfInput() }}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;contact&quot;&amp;gt;&#xA;                    {% if craft.locale == 'en_us' %}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/en/contact?message=thank-you&quot;&amp;gt;&#xA;                    {% endif %}&#xA;                    {% if craft.locale == 'nl_nl' %}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/contact?message=bedankt-voor-uw-aanvraag&quot;&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;h3 class=&quot;title&quot;&amp;gt;{{ formsAndButtons.contact }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;div id=&quot;success&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;                    &amp;lt;label class=&quot;control-label&quot; &amp;gt;{{ formsAndButtons.yourName }} &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;form-control&quot;  type=&quot;text&quot; id=&quot;textName&quot; name=&quot;fields[fullName]&quot; {%- if contact is defined %}value=&quot;{{ contact.fullName }}&quot;{% endif -%}&amp;gt;&#xA;                    {% if contact is defined %}&#xA;                    &amp;lt;div class=&quot;error&quot;&amp;gt;&#xA;                        {{ errorList(contact.getErrors('fullName')) }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;label&amp;gt;{{ formsAndButtons.email }} &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;form-control&quot; type=&quot;email&quot; id=&quot;textEmail&quot; name=&quot;fields[email]&quot; {%- if contact is defined %}value=&quot;{{ contact.email }}&quot;{% endif -%}&amp;gt;&#xA;                    {% if contact is defined %}&#xA;                    &amp;lt;div class=&quot;error&quot;&amp;gt;&#xA;                        {{ errorList(contact.getErrors('email')) }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;label&amp;gt;{{ formsAndButtons.telephone }} &amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;form-control&quot;  type=&quot;text&quot; id=&quot;textPhone&quot; name=&quot;fields[phone]&quot; {%- if contact is defined %}value=&quot;{{ contact.phone }}&quot;{% endif -%}&amp;gt;&#xA;                    {% if contact is defined %}&#xA;                    &amp;lt;div class=&quot;error&quot;&amp;gt;&#xA;                        {{ errorList(contact.getErrors('phone')) }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;label&amp;gt;{{ formsAndButtons.comment }} &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;textarea class=&quot;form-control&quot; id=&quot;fields-message&quot; name=&quot;fields[message]&quot;&amp;gt;{%- if contact is defined %}{{ contact.message }}{% endif -%}&amp;lt;/textarea&amp;gt;&#xA;                    {% if contact is defined %}&#xA;                    &amp;lt;div class=&quot;error&quot;&amp;gt;&#xA;                        {{ errorList(contact.getErrors('message')) }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;div class=&quot;clearfix&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;                    &amp;lt;div class=&quot;buttons-box clearfix&quot;&amp;gt;&#xA;                        &amp;lt;input class=&quot;btn btn-default&quot; type=&quot;submit&quot; value=&quot;{{ login.submit }}&quot;&amp;gt;&#xA;                        &amp;lt;span class=&quot;required&quot;&amp;gt;&amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt; {{ login.requiredField }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/form&amp;gt;&#xA;&#xA;            {% endif %}&#xA;            &amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="842" LastActivityDate="2015-01-09T21:03:53.380" Title="Globals fields empty after form errors" Tags="&lt;form&gt;&lt;globals&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6509" PostTypeId="1" AcceptedAnswerId="6510" CreationDate="2015-01-08T12:39:41.037" Score="3" ViewCount="2671" Body="&lt;p&gt;I need to set up a redirect from the www version of my site to the non-www version for SEO. I found a solution that &lt;em&gt;would&lt;/em&gt; work &lt;a href=&quot;https://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www#answer-1270281&quot;&gt;here&lt;/a&gt; if it weren't for the fact that it breaks the index.php redirect that comes with craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me how to implement a generic redirect from &lt;a href=&quot;http://www.site.co.uk&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.site.co.uk&lt;/a&gt; to &lt;a href=&quot;http://site.co.uk&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.co.uk&lt;/a&gt; and still keep the index.php craft redirect working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, does this affect the config.php file, or does that get loaded AFTER the redirect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-01-08T15:18:41.197" Title="htaccess www to non-www redirect (and config.php)" Tags="&lt;redirect&gt;&lt;htaccess&gt;&lt;index&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6510" PostTypeId="2" ParentId="6509" CreationDate="2015-01-08T13:13:35.867" Score="4" Body="&lt;p&gt;Providing you have the necessary permissions to do this, the following in your .htaccess should do the job:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} !^domain\.co\.uk$ [NC]&#xA;RewriteRule ^(.*)$ http://domain.co.uk/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In place, the full file will probably look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Redirect to non-www domain&#xA;RewriteCond %{HTTP_HOST} !^domain\.co\.uk$ [NC]&#xA;RewriteRule ^(.*)$ http://domain.co.uk/$1 [R=301,L]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following seems to work for me as a generic option:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;RewriteCond %{HTTPS} off&#xA;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&#xA;RewriteCond %{HTTPS} on&#xA;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ https://%1/$1 [R=301,L]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2015-01-08T15:18:41.197" LastActivityDate="2015-01-08T15:18:41.197" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6511" PostTypeId="1" AcceptedAnswerId="6518" CreationDate="2015-01-08T13:18:18.270" Score="13" ViewCount="83947" Body="&lt;p&gt;If I write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section not 'Homepage' %}Blabla {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this results in the error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;operator&quot; of value &quot;not&quot; (&quot;end of statement block&quot;&#xA;  expected)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But if I write: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section != 'Homepage' %}Blabla {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;noreferrer&quot;&gt;twig&lt;/a&gt; docs there is no mentioning of &lt;code&gt;!=&lt;/code&gt; as an operator but it seems to be working just fine. Is &lt;code&gt;!=&lt;/code&gt; a craft specific operator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So whats the difference between &lt;code&gt;not&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="8322" LastEditDate="2020-02-10T08:24:41.927" LastActivityDate="2020-02-10T08:24:41.927" Title="How does the negative (not) conditional work in Twig?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6512" PostTypeId="1" CreationDate="2015-01-08T13:19:21.603" Score="0" ViewCount="642" Body="&lt;p&gt;Let's say i have a &lt;code&gt;FooController&lt;/code&gt; extending &lt;code&gt;Craft\BaseController&lt;/code&gt; located somewhere else (not in a plugin). The &lt;code&gt;FooController&lt;/code&gt; is autoloaded via composer and the autoload.php is included in public/index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would there be a way to route to this &lt;code&gt;FooController&lt;/code&gt;? Is it not possible with Craft (or Yii) to just say something laravel like: &lt;code&gt;Route::get('foo/bar', 'FooController@bar')&lt;/code&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; (follow up question):&#xA;If I have something like this in my &lt;code&gt;registerSiteRoutes&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; return [&#xA;     'foo/bar' =&amp;gt; ['action' =&amp;gt; 'plugin/foo/bar', 'additional' =&amp;gt; 'acme'],&#xA; ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would I be able to access the 'additional' information in the controller?&lt;/p&gt;&#xA;" OwnerUserId="1119" LastEditorUserId="1119" LastEditDate="2015-01-08T14:36:56.677" LastActivityDate="2015-01-12T09:35:33.403" Title="Route to Controller action (not in a plugin)" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6513" PostTypeId="1" AcceptedAnswerId="7058" CreationDate="2015-01-08T13:44:44.337" Score="3" ViewCount="1687" Body="&lt;p&gt;Is it possible to manually clean the database caches for templates? Doing it from the CP becomes stuck. &lt;/p&gt;&#xA;" OwnerUserId="327" LastActivityDate="2015-02-09T03:11:05.070" Title="Manually clean database cache" Tags="&lt;database&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6514" PostTypeId="2" ParentId="6511" CreationDate="2015-01-08T13:46:36.953" Score="6" Body="&lt;p&gt;You could write &lt;code&gt;{% if not entry.section == 'Homepage' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;not&lt;/code&gt; to perform a negative test, not a string comparison.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-08T13:46:36.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6515" PostTypeId="2" ParentId="6504" CreationDate="2015-01-08T14:59:27.730" Score="1" Body="&lt;p&gt;The issue was solved by updating Craft to the latest version (2.3.2625), which brought back support for the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; config setting. Thanks to Brandon Kelly for the heads up.&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-01-08T14:59:27.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6516" PostTypeId="1" AcceptedAnswerId="6517" CreationDate="2015-01-08T16:22:26.167" Score="1" ViewCount="387" Body="&lt;p&gt;I've got a frontend user registration form working that's populating a whole set of custom fields I've set up on my user profiles in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've got a set of lightswitch fields on my user profiles that I'm trying to set via checkboxes in the registration form but the values are not transferring over when submitting the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of my checkbox code in the frontend form (the corresponding lightswitch field handle is &lt;code&gt;memberShowEmailLink&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;memberShowEmailLink&quot; name=&quot;fields[memberShowEmailLink]&quot; {% if account is defined %}value=&quot;{{ account.memberShowEmailLink }}&quot; checked=&quot;checked&quot;{% else %}value=&quot;0&quot;{% endif %}&amp;gt;&#xA;    Show a link to contact me via email in the member directory?&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to change it to make this work?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-01-08T17:24:31.447" Title="How can I translate checkboxes on a frontend user registration form to lightswitch custom fields?" Tags="&lt;registration&gt;&lt;custom-field&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6517" PostTypeId="2" ParentId="6516" CreationDate="2015-01-08T16:47:23.887" Score="1" Body="&lt;p&gt;When the checkbox get submitted, it get's transferred with whatever value is set with the value attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, your need to set the value to 1. Your code should be more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;memberShowEmailLink&quot; name=&quot;fields[memberShowEmailLink]&quot; value=&quot;1&quot; {% if account is defined and account.memberShowEmailLink %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;    Show a link to contact me via email in the member directory?&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="579" LastEditDate="2015-01-08T17:24:31.447" LastActivityDate="2015-01-08T17:24:31.447" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6518" PostTypeId="2" ParentId="6511" CreationDate="2015-01-08T17:40:43.057" Score="17" Body="&lt;p&gt;Twig &lt;code&gt;!=&lt;/code&gt; is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot;&gt;comparison&lt;/a&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The following comparison operators are supported in any expression: ==, !=, &amp;lt;, &gt;, &gt;=, and &amp;lt;=&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;code&gt;!=&lt;/code&gt; to compare any two things that php lets you compare, and what you get back is a boolean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig &lt;code&gt;not&lt;/code&gt; is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#math&quot;&gt;logic&lt;/a&gt; operator. (so are &lt;code&gt;and&lt;/code&gt; and &lt;code&gt;or&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;not: Negates a statement.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-08T17:40:43.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6519" PostTypeId="2" ParentId="6513" CreationDate="2015-01-08T18:21:59.620" Score="4" Body="&lt;p&gt;This does not target the database cache specifically but I wrote this simple plugin to clear all caches from outside of the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/themccallister/craft.cache-clear&quot; rel=&quot;nofollow&quot;&gt;https://github.com/themccallister/craft.cache-clear&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would that work for you?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2015-01-08T18:21:59.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6521" PostTypeId="1" AcceptedAnswerId="6522" CreationDate="2015-01-08T19:00:34.763" Score="1" ViewCount="600" Body="&lt;p&gt;Is there a max image file resolution set up in Craft CMS that can be uploaded?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to upload a series of .jpg images in a Matrix to create a gallery, and I've noticed I'm not able to upload any file that is over somewhere around 4000px in width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I believed it was something to do with the PHP file upload limit, but I'm able to upload .jpg files that were over 5mb with a 2880px width.&lt;/p&gt;&#xA;" OwnerUserId="1122" LastActivityDate="2015-01-08T19:10:16.060" Title="Craft CMS max image resolution?" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6522" PostTypeId="2" ParentId="6521" CreationDate="2015-01-08T19:10:16.060" Score="1" Body="&lt;p&gt;Craft does have the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxUploadFileSize&quot; rel=&quot;nofollow&quot;&gt;maxUploadFileSize&lt;/a&gt; config setting (defaults to 16MB).  If what you're trying to upload is under that size, you're probably running into environmental limitations.  I'd check your php.ini file's post_max_size, memory_limit and max_execution_time settings as a starting point.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-08T19:10:16.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6523" PostTypeId="1" AcceptedAnswerId="6530" CreationDate="2015-01-08T21:22:12.163" Score="2" ViewCount="477" Body="&lt;p&gt;I've got a frontend user profile form that is successfully setting the values of custom fields in the backend except for some lightswitch fields I've added to my user profiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code which displays a checkbox on the frontend profile form and sets &lt;code&gt;checked=&quot;checked&quot;&lt;/code&gt; if that switch is &quot;on&quot; in the backend:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; id=&quot;memberShowEmailLink&quot; name=&quot;fields[memberShowEmailLink]&quot; value=&quot;1&quot; {% if currentUser.memberShowEmailLink %}checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;    Show a link to contact me via email in the member directory?&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the lightswitch is set to &quot;off&quot; and I check the box on the frontend form and submit the form, the change is saved and the lightswitch flips to &quot;on&quot; in the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the lightswitch is already &quot;on&quot; and thus the box is already checked, if I uncheck it on the frontend form and submit the form, the change is not saved and there's no change in the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-01-09T02:35:01.930" Title="How do I update the state of lightswitches reliably using checkboxes on a frontend user profile form?" Tags="&lt;user-profile&gt;&lt;frontend&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6524" PostTypeId="1" AcceptedAnswerId="6529" CreationDate="2015-01-08T22:30:17.497" Score="1" ViewCount="236" Body="&lt;p&gt;I've had a potential job come through that I want to run on Craft, but I'm a bit sketchy about one particularly bit. The site is going to include educational modules and tests for each. Test results will be stored in their profile which can be reviewed the admins. I know how to create a new entry for each test submission, but the thing I'm not sure about is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I store whether a question was answered correctly or not?&#xA;Is there a way to display a score based on the test result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, I'm not a plugin developer... if this can be done with template logic that would be perfect.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-01-09T01:32:46.160" Title="Education test website Q&amp;A - how?" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6525" PostTypeId="2" ParentId="6524" CreationDate="2015-01-09T00:17:37.377" Score="3" Body="&lt;p&gt;The catch is, it sounds like you need to &lt;strong&gt;add an entry&lt;/strong&gt; and &lt;strong&gt;modify user data&lt;/strong&gt; all in a single shot. That's not really possible out-of-the-box... different forms will submit to different places.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Edit an Entry&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;Edit a User Profile&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One possible solution is to create an intermediary page:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First page is your test form,&lt;/li&gt;&#xA;&lt;li&gt;Upon submission, creates a new entry. (Edit an Entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Then redirects to a second page,&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Second page displays the results, and offers to &quot;Save the results&quot;,&lt;/li&gt;&#xA;&lt;li&gt;Upon submission, saves results to user profile. (Edit a User Profile)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's pretty rough, to be honest. If you know any PHP at all, I'd highly recommend using this project to teach yourself a little plugin development. If you build some customized Controllers and Services to handle this data, you'll end up with a far more robust solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like a fun project... Let us know what architecture you decide to go with!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-01-09T00:17:37.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6526" PostTypeId="1" CreationDate="2015-01-09T00:32:47.823" Score="5" ViewCount="990" Body="&lt;p&gt;I'm trying to set a 404 HTTP status response code for an ajax controller action in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yii has a response object where the code can be set, but I can't find a way to access it from craft.&lt;/p&gt;&#xA;" OwnerUserId="2160" LastEditorUserId="2160" LastEditDate="2015-01-09T00:40:30.203" LastActivityDate="2021-03-12T13:15:00.953" Title="How can I set the HTTP status code?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;ajax&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6527" PostTypeId="2" ParentId="1767" CreationDate="2015-01-09T00:44:26.173" Score="1" Body="&lt;p&gt;The only way I know how to do this would be to create a different asset channel for each child directory.&lt;/p&gt;&#xA;" OwnerUserId="2160" LastActivityDate="2015-01-09T00:44:26.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6528" PostTypeId="2" ParentId="6526" CreationDate="2015-01-09T00:46:39.817" Score="5" Body="&lt;p&gt;I believe &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/HeaderHelper#setHeader-detail&quot; rel=&quot;nofollow&quot;&gt;HeaderHelper::setHeader()&lt;/a&gt; is what you're looking for in the context of a plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-09T00:46:39.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6529" PostTypeId="2" ParentId="6524" CreationDate="2015-01-09T01:24:08.963" Score="2" Body="&lt;p&gt;This is a very broad question, and I'm not sure you're going to get a very good answer without being more specific. Whether or not this is possible without the aid of a plugin would entirely depend on how you designed the system, and what the needs are. I can certainly imagine ways to accomplish this without the use of a plugin. With that said, I also think that you could probably make for a much more robust system with a better user experience with the aid of some simple plugins. But I also wouldn't let plugins scare you. Writing a plugin is surprisingly easy (depending on the complexity of course). As a front-end developer myself, I have written several with little difficulty, so I can attest to this. I would focus on designing a system that makes the most sense from a user perspective and then build it accordingly, even if that means learning to write some simple plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a starting point (without plugins) you might try and approach the problem this way.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a channel (or structure if multiple tests are used; using a test/question hierarchy) to store question entries, which would include the question, possible answers, and the correct answer (i.e. &lt;code&gt;structure&lt;/code&gt; with handle 'tests' or 'modules' or whatever you want to call it).&lt;/li&gt;&#xA;&lt;li&gt;Create a channel for user submitted answers with the user's answer and related fields to store a reference to the original question, and the user that submitted the answer (i.e. &lt;code&gt;channel&lt;/code&gt; with handle 'testResults' or whatever you want to call it).&lt;/li&gt;&#xA;&lt;li&gt;Create a form that presents a question (from the 'tests' structure) and the possible answers (as a radio button for example if multiple choice) that gets submitted to the 'testResults' channel.&lt;/li&gt;&#xA;&lt;li&gt;Include hidden fields on the form with the question id, and user id, to populate the corresponding related 'entries' and related 'users' fields in the 'testResults' entry.&lt;/li&gt;&#xA;&lt;li&gt;In the form success redirect you can load the form submission as well as the original question/answer, compare them and display if they are correct or not.&lt;/li&gt;&#xA;&lt;li&gt;In the user profile template, you can then load all test entries (questions) and testResult entries (answers) for that user and compare them to display both whether specific questions were answered correctly and their overall test score.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that the data is not stored as part of the user profile per se; rather the user is only associated to the data via a related user field. And if you always look up the questions and answers and compare them to get the score then there would be no real need for a plugin. Where you might want a plugin is if you want to store the test results independently, or their overall progress, or other summary data, etc. But like I said above, writing a plugin to do this is not that complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes of course that the admin would view the user's profile and Q&amp;amp;A via the front-end. This is also by no means the only way, just an example of how it might be done.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-09T01:32:46.160" LastActivityDate="2015-01-09T01:32:46.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6530" PostTypeId="2" ParentId="6523" CreationDate="2015-01-09T02:35:01.930" Score="4" Body="&lt;p&gt;While both lightswitches and checkboxes represent an on/off state, they are quite different. Standard browser behavior is designed to only post checkbox data if the checkbox is checked, otherwise it is ignored. In PHP, when processing the form, you would want to check whether the post-data is present or not; if it's present then the value is checked; otherwise it's unchecked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I haven't reviewed how craft processes checkbox form submissions I would assume that it also performs this check behind the scenes, and converts the value to a 1 or 0 to store the data. However, being a lightswitch, craft probably does not perform this check, so if the field is missing from the post-data (which it would be if unchecked), then craft simply ignores it, as not being part of the form to begin with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be a simpler method built in that I'm not aware of, but one solution would be to create a hidden field with your lightswitch handle, and then set that field using javascript when the user checks or unchecks the checkbox, much the way that craft does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the standard lightswitch html for example so you can see how craft sets this up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;lightswitch&quot; tabindex=&quot;0&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;lightswitch-container&quot; style=&quot;margin-left: -11px;&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;label on&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;handle&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;label off&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[switchHandle]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; class=&quot;js-checkbox&quot; {% if currentUser.memberShowEmailLink %}checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;        Show a link to contact me via email in the member directory?&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; class=&quot;js-lightbox&quot; name=&quot;fields[memberShowEmailLink]&quot; value=&quot;{% if currentUser.memberShowEmailLink %}1{% endif %}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.js-checkbox').on('change', function(event) {&#xA;    if($(this).prop('checked')) {&#xA;        $('.js-lightbox').val(1);&#xA;    } else {&#xA;        $('.js-lightbox').val(0);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: if you leave off the 'name' attribute the dummy checkbox should not get submitted.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-09T02:35:01.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6531" PostTypeId="1" AcceptedAnswerId="6532" CreationDate="2015-01-09T03:49:42.120" Score="0" ViewCount="204" Body="&lt;p&gt;In a plugin I am returning entries from a section. Can I combine a returned entry from that section with data from a custom table into one model for output?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-01-09T03:55:21.007" Title="In plugin combine a returned entry with custom table data" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6532" PostTypeId="2" ParentId="6531" CreationDate="2015-01-09T03:55:21.007" Score="1" Body="&lt;p&gt;Just have your plugin supply a custom &lt;code&gt;MyPluginEntryModel&lt;/code&gt; that extends Craft's &lt;code&gt;EntryModel&lt;/code&gt; and merges in any custom attribute definitions from your custom table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginEntryModel extends EntryModel&#xA;{&#xA;   ....&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array_merge(parent::defineAttributes(), array(&#xA;            'customAttribute1' =&amp;gt; AttributeType::Number,&#xA;            'customAttribute2' =&amp;gt; AttributeType::String,&#xA;        ));&#xA;    }&#xA;&#xA;   ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-09T03:55:21.007" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6533" PostTypeId="1" CreationDate="2015-01-09T04:11:17.360" Score="1" ViewCount="644" Body="&lt;p&gt;I'm wondering how I can dynamically generate a JPG fallback image from an SVG. Can image transforms be modified to handle this?&lt;/p&gt;&#xA;" OwnerUserId="452" LastActivityDate="2015-02-23T08:22:02.007" Title="Dynamically generating a JPG from SVG" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6535" PostTypeId="1" CreationDate="2015-01-09T11:04:00.330" Score="4" ViewCount="2055" Body="&lt;p&gt;I have uploaded a logo in the General Settings, which I understand changes the logo on the login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was anyway to display this same logo in the site's template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can achieve this by hard-coding the same URL (but I presume if the logo is changed, this URL will change also.) My other solution is to add a field to a global set but that requires changing the logo in 2 places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this isn't possible, how can I retrieve the URL in a plugin? (I have a plugin with a few template helper methods.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2155" LastActivityDate="2019-08-23T17:46:47.330" Title="General Settings &gt; logo in the template" Tags="&lt;templating&gt;&lt;config&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6536" PostTypeId="2" ParentId="6535" CreationDate="2015-01-09T13:12:01.320" Score="5" Body="&lt;p&gt;To fetch the logo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.rebrand.logo.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To check if a logo is uploaded:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.rebrand.isLogoUploaded %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-01-09T13:12:01.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6537" PostTypeId="1" CreationDate="2015-01-09T13:23:26.993" Score="1" ViewCount="1825" Body="&lt;p&gt;I'm trying to install the plugin &quot;Download assets&quot; to Craft and I get an error when trying to install. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Directory was unable to install this plugin :(&#xA;No files have been updated and the database has not been touched.&#xA;&#xA;Could not find plugin folder in zip&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do have an external site and a local development site. And this happens on the external site. It does however work &lt;em&gt;correctly&lt;/em&gt; on the local site, and it's the exact same installation. What could be the cause for this issue?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="45" LastEditDate="2016-04-29T16:59:04.210" LastActivityDate="2016-04-29T16:59:04.210" Title="Can't install plugin - Could not find plugin folder in zip" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6538" PostTypeId="1" AcceptedAnswerId="6539" CreationDate="2015-01-09T14:53:26.947" Score="3" ViewCount="579" Body="&lt;p&gt;i.e. is there a type of &lt;code&gt;loginRequired&lt;/code&gt; functionality for assets? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even better - can I restrict access to a single group, or a require a certain permission? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &quot;permissions&quot; tab for users/groups I can only give access to uploading/deleting assets. &lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-01-09T14:58:54.897" Title="Is it possible to restrict access to an asset to logged in users?" Tags="&lt;assets&gt;&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6539" PostTypeId="2" ParentId="6538" CreationDate="2015-01-09T14:58:54.897" Score="3" Body="&lt;p&gt;There is two similar plugins that look's like it might do the job (I have tested neither).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow&quot;&gt;Internal Assets&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://bitbucket.org/jkenters/craft-memberassets/&quot; rel=&quot;nofollow&quot;&gt;MemberAssets&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-01-09T14:58:54.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6540" PostTypeId="2" ParentId="6496" CreationDate="2015-01-09T15:16:24.983" Score="3" Body="&lt;p&gt;From my testing it appears that this is an issue with Google's universal analytics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based off of Clive's recommendation, my solution what to change&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  ga('send', 'page view');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  ga('send', 'pageview', {&#xA;   'page': '/{{entry.slug}}',&#xA;   'title': '{{entry.title}}'&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to be holding up well.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-01-09T15:16:24.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6541" PostTypeId="1" AcceptedAnswerId="6549" CreationDate="2015-01-09T16:32:14.393" Score="3" ViewCount="858" Body="&lt;p&gt;Having issues trying to access the year &amp;amp; month variable when grouping entries by month-year. The code is outputting the desired results (ie. December 2014), however I would like to format the url by 'year/month'.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Archives&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&#xA;    &lt;p&gt;Browse news &amp;amp; articles for the last year.&lt;/p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('news').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for date, entries in allEntries | group('postDate|date(&quot;F Y&quot;)') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ year }}/{{ month }}&quot;&amp;gt;{{ date }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2015-01-09T17:17:15.517" LastActivityDate="2015-01-10T00:56:42.673" Title="Need to access year/month variable when grouping entries by date" Tags="&lt;entries&gt;&lt;group&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6542" PostTypeId="1" AcceptedAnswerId="6545" CreationDate="2015-01-09T17:32:10.607" Score="3" ViewCount="159" Body="&lt;p&gt;When a user switches Entry Types in the control panel, &lt;code&gt;Craft.EntryTypeSwitcher&lt;/code&gt; is trigged which in turn triggers &lt;code&gt;onTypeChange&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there callback that a plugin can access to run some additional JavaScript after this event has occurred?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;===== Edit to show Current work-around as per Justin's answer below ======&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javscript prettyprint-override&quot;&gt;&lt;code&gt;(function($) {&#xA;    Craft.LoadOverride = Garnish.Base.extend({&#xA;        init: function()&#xA;        {&#xA;            this.addListener(Garnish.$win, 'resize', 'runOverride');&#xA;        },&#xA;        runOverride: function()&#xA;        {&#xA;            console.log('Triggered!');&#xA;        }&#xA;    });&#xA;})(jQuery);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2015-01-09T21:07:16.603" LastActivityDate="2015-05-24T14:33:33.213" Title="Is there an accessible callback when Craft.EntryTypeSwitcher is run?" Tags="&lt;plugins&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6543" PostTypeId="2" ParentId="6541" CreationDate="2015-01-09T18:05:04.503" Score="4" Body="&lt;p&gt;The &lt;code&gt;year&lt;/code&gt; and  &lt;code&gt;month&lt;/code&gt; variables are not defined, so you'd first have to get these from the 'date' variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do this by using Twig's &lt;code&gt;split&lt;/code&gt; function and splitting &lt;code&gt;date&lt;/code&gt; by the space in between:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateParts = date | split(' ') %}&#xA;{% set month = dateParts[1] %}&#xA;{% set year = dateParts[0] %}&#xA;&#xA;&amp;lt;a href=&quot;{{ year }}/{{ month }}&quot;&amp;gt;{{ date }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-09T18:05:04.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6544" PostTypeId="2" ParentId="6541" CreationDate="2015-01-09T18:05:17.417" Score="1" Body="&lt;p&gt;I was going to suggest using twig's &lt;code&gt;date&lt;/code&gt; filter to format the date as needed, but as Paul astutely pointed out in his comment, you don't really have a dateTime variable to work with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my answer is use Paul's answer. ;)&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-09T18:30:05.977" LastActivityDate="2015-01-09T18:30:05.977" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6545" PostTypeId="2" ParentId="6542" CreationDate="2015-01-09T20:10:00.190" Score="3" Body="&lt;p&gt;It looks like the only easy way to hook into that event is to listen for the &lt;code&gt;resize&lt;/code&gt; event on the &lt;code&gt;window&lt;/code&gt; object. On line 55, it is triggering &lt;code&gt;resize()&lt;/code&gt;. Looking at the code, I am not seeing any other way to listen for these events. The &lt;code&gt;Craft.EntryTypeSwitcher&lt;/code&gt; class is getting instantiated but not getting assigned to any variable in the DOM, so there is no way for you to grab that instance (from what I can tell anyway).&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-01-09T20:10:00.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6546" PostTypeId="2" ParentId="6508" CreationDate="2015-01-09T21:03:53.380" Score="2" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&#xA;This issue has been resolved and will be available in the next release of &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; (0.8.4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue was caused by our use of &lt;code&gt;context switching&lt;/code&gt; for custom content tables in combination with &lt;code&gt;renderObjectTemplate()&lt;/code&gt;, the latter of which initializes the &lt;code&gt;twig environment&lt;/code&gt; and loads globals if not already loaded. This initialization is &lt;code&gt;context sensitive&lt;/code&gt; so since we needed to switch context and then use &lt;code&gt;renderObjectTemplate()&lt;/code&gt; before we could switch the &lt;code&gt;context&lt;/code&gt; back, &lt;code&gt;globals&lt;/code&gt; would inherit the content model from the form entry itself, not their actual content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We fixed this issue by initializing the environment before any context switching is done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://selv.in&quot; rel=&quot;nofollow&quot;&gt;Selvin Ortiz&lt;/a&gt;&lt;br&gt;&#xA;&lt;strong&gt;Barrel Strength Design&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2015-01-09T21:03:53.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6547" PostTypeId="1" AcceptedAnswerId="6592" CreationDate="2015-01-10T00:00:48.990" Score="1" ViewCount="538" Body="&lt;p&gt;I need to join my &lt;strong&gt;plugin's custom table&lt;/strong&gt; to a an &lt;strong&gt;ElementCriteriaModel (ECM)&lt;/strong&gt;. I am trying to use &lt;strong&gt;modifyElementsQuery&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plugin's custom table, rows can share an element/entry via a separate id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can I achieve this by adding to the modifyElementsQuery? What would the query be to accomplish this?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;*My intention is to have an array of models for each row of my custom table, and each model will include my row data, in addition to the element's content it is related to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wWqpz.png&quot; alt=&quot;Here is a visual helping to explain what I am trying to accomplish.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-01-13T01:23:37.847" LastActivityDate="2015-01-15T06:18:45.603" Title="Using modifyElementsQuery to get plugin's custom table data" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6548" PostTypeId="1" AcceptedAnswerId="6550" CreationDate="2015-01-10T00:29:02.057" Score="3" ViewCount="2127" Body="&lt;p&gt;I'm setting up a new site using Craft and would like to know what's the best way to manage dev and production environments? For instance, keeping entries/fields/ and control panels configurations sane across both environments? &lt;/p&gt;&#xA;" OwnerUserId="2164" LastEditorUserId="125" LastEditDate="2015-05-29T15:01:40.387" LastActivityDate="2015-05-29T15:01:40.387" Title="Correct way to set up development and production environments for Craft?" Tags="&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6549" PostTypeId="2" ParentId="6541" CreationDate="2015-01-10T00:56:42.673" Score="9" Body="&lt;p&gt;If I understand your example correctly, a simple hyphen would do the trick &amp;mdash; &quot;YYYY-MM&quot; is a format the &lt;code&gt;date&lt;/code&gt; filter recognizes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = ... %}&#xA;{% set entriesByMonth = entries|group('postDate|date(&quot;Y-m&quot;)') %}&#xA;{% for month, entries in entriesByMonth %}&#xA;  &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ month|date(&quot;Y&quot;) }}/{{ month|date(&quot;m&quot;) }}&quot;&amp;gt;&#xA;        {{ entries | length }} entries in {{ month|date(&quot;F Y&quot;) }}&#xA;      &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-01-10T00:56:42.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6550" PostTypeId="2" ParentId="6548" CreationDate="2015-01-10T09:50:42.580" Score="6" Body="&lt;p&gt;I'd recommend you take a look at the excellent existing threads on this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/62/480&quot;&gt;Git Workflow and Multi Environment - how to approach&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What's the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;as well as the official documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Environment Configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-10T09:50:42.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6551" PostTypeId="1" CreationDate="2015-01-10T10:33:20.747" Score="8" ViewCount="1101" Body="&lt;p&gt;I have used the following code to allow our users to update their own profile. Everything works fine apart from not being able to update existing Matrix entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New Matrix field entries work fine. Can anyone spot the mistake I've made?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;          {{ getCsrfInput() }}&#xA;          &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/account/profile&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;          &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;firstName&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot;&amp;gt;&#xA;&#xA;          &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;lastName&quot; name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot;&amp;gt;&#xA;&#xA;          &amp;lt;label for=&quot;telephone&quot;&amp;gt;Telephone&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;telephone&quot; name=&quot;fields[telephone]&quot; value=&quot;{{ currentUser.telephone }}&quot;&amp;gt;&#xA;&#xA;          &amp;lt;h3&amp;gt;Additional Contacts&amp;lt;/h3&amp;gt;&#xA;&#xA;          &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[alternativeContacts]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;          {% for block in currentUser.alternativeContacts.type('contact') %}&#xA;          &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][type]&quot; value=&quot;contact&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][fields][firstName]&quot; value=&quot;{{ block.firstName }}&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][fields][lastName]&quot; value=&quot;{{ block.lastName }}&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][fields][telephone]&quot; value=&quot;{{ block.telephone }}&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;email&quot; name=&quot;fields[alternativeContacts][{{ block.id }}][fields][email]&quot; value=&quot;{{ block.email }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;button class=&quot;btn btn-xs btn-danger&quot; data-action=&quot;delete-contact&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;          {% endfor %}&#xA;&#xA;          &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;h6&amp;gt;New Contact&amp;lt;/h6&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[alternativeContacts][new1][type]&quot; value=&quot;contact&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[alternativeContacts][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][new1][fields][firstName]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][new1][fields][lastName]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[alternativeContacts][new1][fields][telephone]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;email&quot; name=&quot;fields[alternativeContacts][new1][fields][email]&quot;&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;&#xA;          &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;      &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="426" LastActivityDate="2015-01-10T10:50:46.210" Title="How to update Matrix field on frontend for user profile" Tags="&lt;matrix&gt;&lt;user-profile&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6552" PostTypeId="2" ParentId="6551" CreationDate="2015-01-10T10:50:46.210" Score="2" Body="&lt;p&gt;Turns out it was a validation issue, it works fine when you make the new contact's first+last name mandatory.&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2015-01-10T10:50:46.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6554" PostTypeId="1" CreationDate="2015-01-10T16:52:28.833" Score="1" ViewCount="104" Body="&lt;p&gt;I would like to protect the viewing of an _entry.html page so that only a user related to that entry can view it.&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2015-01-11T19:22:28.877" Title="Protect entry so that only a &quot;relatedTo&quot; user can see it" Tags="&lt;entry&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6555" PostTypeId="2" ParentId="6554" CreationDate="2015-01-10T21:08:37.683" Score="2" Body="&lt;p&gt;You could loop through the users and compare them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorized = false %}&#xA;{% for user in entry.authorizedUsers %}&#xA;    {% if user == currentUser %}&#xA;        {% set authorized = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if not authorized %}&#xA;    {% redirect 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-11T19:22:28.877" LastActivityDate="2015-01-11T19:22:28.877" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6556" PostTypeId="1" CreationDate="2015-01-11T22:44:50.177" Score="0" ViewCount="288" Body="&lt;p&gt;I currently have a structure called 'Divisions' that includes 'Team' pages as children. On the 'Team', there is an entries field 'Head Coach', which is an entry created on a 'Coaches' channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coach has an account and has created the entry, so he is the author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, assuming the coach is the 'currentUser' is there a way to find the relation between that 'Head Coach' entry and the 'Team' if they are related by the author?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this code so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set coachingTeam = craft.entries.section('divisions').type('team').relatedTo({&#xA;    targetElement: currentUser,&#xA;    field: 'headCoach'&#xA;}).find() %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I've found to do this was to loop through all the teams, and if the currentUser and the author of the 'Head Coach' entry matched, then set the team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems expensive, but I can't figure out how to do this with a relations call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set allTeams = craft.entries.section('divisions').type('team').find() %}&#xA;{% set coachingTeam = '' %}&#xA;{% for team in allTeams %}&#xA;    {% if (team.headCoach|length and team.headCoach.first.author.id == currentUser.id) %}&#xA;        {% set coachingTeam = team %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2156" LastEditorUserId="2156" LastEditDate="2015-01-12T19:48:04.893" LastActivityDate="2015-01-12T19:48:04.893" Title="Getting relation through entry field by author" Tags="&lt;entries&gt;&lt;relations&gt;&lt;search&gt;&lt;entries-field&gt;&lt;author&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6557" PostTypeId="1" CreationDate="2015-01-12T03:29:25.443" Score="2" ViewCount="737" Body="&lt;p&gt;I've finished my site locally, and would like to migrate my data to my production database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already uploaded the templates, assets, etc, but I'm unsure how to 'dump and load' (referenced from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1079/migrating-a-whole-website-between-craft-instances&quot;&gt;this question&lt;/a&gt; ) my database to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize this may be a little bit more phpMyAdmin related, but I thought this question could help others who are just beginning work with Craft CMS!&lt;/p&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2021-03-03T13:02:58.777" Title="What's the easiest way to migrate my local site data to my live site?" Tags="&lt;database&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6558" PostTypeId="2" ParentId="6557" CreationDate="2015-01-12T03:40:35.690" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;Go into Utilities&lt;/li&gt;&#xA;&lt;li&gt;Click &amp;quot;Database Backup&amp;quot;, this will give you a .zip file of your data&lt;/li&gt;&#xA;&lt;li&gt;Go into phpMyAdmin of your production site&lt;/li&gt;&#xA;&lt;li&gt;Find your database, click Import&lt;/li&gt;&#xA;&lt;li&gt;Upload .zip file&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="11131" LastEditDate="2021-03-03T13:02:58.777" LastActivityDate="2021-03-03T13:02:58.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6559" PostTypeId="1" AcceptedAnswerId="6560" CreationDate="2015-01-12T05:07:40.363" Score="1" ViewCount="218" Body="&lt;p&gt;I'm using Redirect Manager (&lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Redirect-Manager&quot; rel=&quot;nofollow&quot;&gt;https://github.com/rkingon/Craft-Plugin--Redirect-Manager&lt;/a&gt;) and I&quot;m trying to redirect:&#xA;&lt;strong&gt;www.website.com/?post_type=testimonials&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To:&#xA;&lt;strong&gt;www.website.com/about-us&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following regex rules with no success (hashes are needed for regex in redirect manager):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;#^\?post_type=testimonials#&lt;/p&gt;&#xA;&#xA;&lt;p&gt;#^\?post_type=testimonials$#&lt;/p&gt;&#xA;&#xA;&lt;p&gt;#post_type=testimonials$#&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of them just stay on the homepage with the query appended when accessing the url. Any ideas on how to fix it or better ways of achieving this would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2169" LastActivityDate="2015-01-12T07:46:47.907" Title="How to redirect a url with a query to one that does not have a query" Tags="&lt;url&gt;&lt;redirect&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6560" PostTypeId="2" ParentId="6559" CreationDate="2015-01-12T07:46:47.907" Score="1" Body="&lt;p&gt;You could add this to the homepage template. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('post_type') == &quot;testimonials&quot; %} &#xA;   {% redirect &quot;/about-us&quot; %} &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-01-12T07:46:47.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6561" PostTypeId="2" ParentId="6556" CreationDate="2015-01-12T08:00:39.947" Score="1" Body="&lt;p&gt;This is untested code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set coachingTeam = craft.entries({&#xA;  section: &quot;divisions&quot;,&#xA;  type: &quot;team&quot;,&#xA;  relatedTo:[&#xA;    'and',&#xA;    { targetElement: currentUser.id },&#xA;    { targetElement: headCoach[0].id }&#xA;  ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-01-12T08:00:39.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6562" PostTypeId="1" AcceptedAnswerId="6564" CreationDate="2015-01-12T09:11:22.837" Score="3" ViewCount="425" Body="&lt;p&gt;I have a site with 2 languages: Nl and En&#xA;Everything translates to Dutch but only the date stays in English...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this to get my news items:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(6).find() %}&#xA;    &amp;lt;li&amp;gt;&#xA;              &amp;lt;p&amp;gt;{{ entry.title}} {{ entry.postDate.format('d M Y') }}&amp;lt;/p&amp;gt;&#xA;              &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The month stays in English, how can I format de post date, with the locale I'm viewing the site?&lt;/p&gt;&#xA;" OwnerUserId="744" LastActivityDate="2015-01-12T09:49:54.647" Title="How to translate de postdate format for a multilanguage site" Tags="&lt;localization&gt;&lt;postdate&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6563" PostTypeId="2" ParentId="6512" CreationDate="2015-01-12T09:35:33.403" Score="1" Body="&lt;p&gt;As it turns out it's not really possible to break out of the intended craft workflow. If you don't want to put additional business logic in plugins, you're only option is changing the index file. Which I did like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;try&#xA;{&#xA;    $app-&amp;gt;run();&#xA;}&#xA;catch(CHttpException $exception)&#xA;{&#xA;    // Implement custom route logic here&#xA;    // If nothing matches your own routes, just rethrow the $exception&#xA;    // like so:&#xA;    //throw $exception;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm more playing around here the learn how craft works, in the end the best solution is probably to just go with a plugin. &lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-01-12T09:35:33.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6564" PostTypeId="2" ParentId="6562" CreationDate="2015-01-12T09:49:54.647" Score="5" Body="&lt;p&gt;Instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate.format('d M Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate | date('d M Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should work.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-12T09:49:54.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6565" PostTypeId="1" CreationDate="2015-01-12T10:20:15.143" Score="1" ViewCount="345" Body="&lt;p&gt;I have a multi language site with /nl and /en in my url.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;mysite.dev/nl&lt;/li&gt;&#xA;&lt;li&gt;mysite.dev/en&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is my configuration on general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'mysite.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'translationDebugOutput' =&amp;gt; false,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'nl' =&amp;gt; '//mysite.dev/nl/',&#xA;        'en' =&amp;gt; '//mysite.dev/en/',&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl'        =&amp;gt; 'http://mysite.dev/',&#xA;        'basePath' =&amp;gt; '/Users/lisavandaele/documents/mysite/public/',&#xA;        'baseUrl'    =&amp;gt; 'http://mysite.dev/'),&#xA;&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my asset transform settings I made: thumb (width 120, height 90, crop)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my twig I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.afbeelding.first() %}&#xA;            {% if asset %}&#xA;                &amp;lt;img src=&quot;{{ asset.getUrl('thumb') }}&quot; width=&quot;{{ asset.getWidth('thumb') }}&quot; height=&quot;{{ asset.getHeight('thumb') }}&quot; alt=&quot;{{entry.title}}&quot; /&amp;gt;&amp;lt;br /&amp;gt;&#xA;             {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url he uses is: //mysite.dev/nl/cpresources/transforms/1?x=UeS4gtVAw&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if I go to the url without the /nl, I can view the image and I see he is rendered in my assets. ==&gt; //mysite.dev/cpresources/transforms/1?x=UeS4gtVAw&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I use the correct url without the language parameter (/nl or /en) so my image transforms and can be viewed on my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried lots of configs, what am I overlooking? &#xA;I also cleared my cache and images evertime I changed my configuration but nothing worked...&lt;/p&gt;&#xA;" OwnerUserId="744" LastActivityDate="2015-01-12T10:20:15.143" Title="Image transform in a multi language site gives wrong getUrl()" Tags="&lt;multi-environment&gt;&lt;image-transforms&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6566" PostTypeId="1" CreationDate="2015-01-12T12:17:41.477" Score="1" ViewCount="122" Body="&lt;p&gt;This &quot;standard&quot; set-up for rendering asset transforms works as expected. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% set image = entry.articleImages %}&#xA;&#xA;                {% if image | length %}&#xA;                    &amp;lt;div class=&quot;col-sm-6 col-md-6&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;work&quot;&amp;gt;&#xA;&#xA;                            {% for asset in image %}&#xA;                                &amp;lt;img src=&quot;{{ asset.getUrl('worksList') }}&quot; alt=&quot;{{ asset.title }}&quot; title=&quot;{{ asset.title }}&quot; height=&quot;{{ asset.getHeight('worksList') }}&quot; width=&quot;{{ asset.getWidth('worksList') }}&quot;&amp;gt;&#xA;                            {% endfor %}&#xA;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I only want the first image out of the assets loop I would normally add .first() to the set image loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.articleImages.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this ends op in unclear error messages while rendering on the front-end ( Impossible to invoke a method (&quot;getUrl&quot;) on a string variable (&quot;111&quot;))!&#xA;Or am I missing out on something?&lt;/p&gt;&#xA;" OwnerUserId="842" LastActivityDate="2015-01-12T13:01:02.890" Title="first() don't seem to work while using an image transform" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6567" PostTypeId="2" ParentId="6566" CreationDate="2015-01-12T13:01:02.890" Score="1" Body="&lt;p&gt;This is where it goes wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in image %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because you use &lt;code&gt;first()&lt;/code&gt;, you end up with an AssetFileModel, not an array of those.&#xA;If you than loop through that AssetFileModel with a for-loop, you get all the values of that Model. They don't have a method called getUrl(), which is what causes the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, skip the for-loop and just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.articleImages.first() %}&#xA;&amp;lt;img src=&quot;{{ asset.url('worksList') }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;url()&lt;/code&gt; method is &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#url&quot; rel=&quot;nofollow&quot;&gt;an alias&lt;/a&gt; for &lt;code&gt;getUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-12T13:01:02.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6568" PostTypeId="1" AcceptedAnswerId="6569" CreationDate="2015-01-12T17:09:20.757" Score="1" ViewCount="151" Body="&lt;p&gt;Hi all… I have a Structure organized like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Arts&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Journals&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Submissions&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Books&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Sciences&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Journals&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Submissions&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Books&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;…etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template, I want to grab the &quot;Section&quot; (e.g. Arts, Sciences) that I'm in and output it at the top of the page, both on the main page and subpages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For decedents I can do that using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set currentSubject = entry.getAncestors().level(1) %}&#xA;    {% for entry in currentSubject %}&#xA;    {{ entry.title }}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I'm on the main page (e.g. Arts, Sciences) itself getAncestors won't help. Is there a smart conditional that will give me the title of the top level page regardless of if I'm on it or a descendent of it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, I find myself hoping this can be done without looking at segments, but maybe that's the best route for this kind of thing?&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2015-01-12T19:47:33.967" Title="Structure Nav: Output &quot;Section&quot; Title on both Landing and Decedents" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6569" PostTypeId="2" ParentId="6568" CreationDate="2015-01-12T19:10:38.480" Score="1" Body="&lt;p&gt;You can test for the entry's &lt;code&gt;level&lt;/code&gt; property. Something like the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == 1 %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.ancestors.first.title }}&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-12T19:47:33.967" LastActivityDate="2015-01-12T19:47:33.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6570" PostTypeId="1" AcceptedAnswerId="6571" CreationDate="2015-01-13T00:00:02.950" Score="3" ViewCount="648" Body="&lt;p&gt;Here's an example, I have three columns in a table: ClassQuarter, Course No, Description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to output rows only with ClassQuarter == '1' in a HTML table, then output rows where ClassQuarter == '2' in another table, then output rows where ClassQuarter == '3' in another table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I able to output rows with a condition for the first column?&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2015-01-13T01:03:02.003" Title="Is there a way to output certain rows (or filter) from a table?" Tags="&lt;templating&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6571" PostTypeId="2" ParentId="6570" CreationDate="2015-01-13T00:37:00.983" Score="2" Body="&lt;p&gt;Since there are a set number of quarters you can probably just collect the entries in a temporary array. Then use those to build your tables.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quarter1 = [] %}&#xA;{% set quarter2 = [] %}&#xA;{% set quarter3 = [] %}&#xA;&#xA;{% for row in entry.courses %}&#xA;&#xA;    {% if row.classQuarter == 1 %}&#xA;        {% set quarter1 = quarter1|merge([row]) %}&#xA;    {% endif %}&#xA;&#xA;    {% if row.classQuarter == 2 %}&#xA;        {% set quarter2 = quarter2|merge([row]) %}&#xA;    {% endif %}&#xA;&#xA;    {% if row.classQuarter == 3 %}&#xA;        {% set quarter3 = quarter3|merge([row]) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;    {% for row in quarter1 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;    &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;    {% for row in quarter2 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;    &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;    {% for row in quarter3 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;    &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also add an 'if' clause in the 'for...in' loop. See the twig docs on &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow&quot;&gt;adding a condition&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;    {% for row in entry.courses if row.classQuarter == 1 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt; &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&amp;lt;table&amp;gt;&#xA;    {% for row in entry.courses if row.classQuarter == 2 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt; &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&amp;lt;table&amp;gt;&#xA;    {% for row in entry.courses if row.classQuarter == 3 %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt; &#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And could also probably condense that using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/range.html&quot; rel=&quot;nofollow&quot;&gt;range&lt;/a&gt; shortcut.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for quarter in 1..4 %}&#xA;    &amp;lt;table&amp;gt;&#xA;        {% for row in entry.courses if row.classQuarter == quarter %}&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ row.courseNumber }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ row.courseDescription }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt; &#xA;        {% endfor %}&#xA;    &amp;lt;/table&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-13T01:03:02.003" LastActivityDate="2015-01-13T01:03:02.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6572" PostTypeId="1" CreationDate="2015-01-13T03:26:17.450" Score="0" ViewCount="499" Body="&lt;p&gt;I was just wondering if anyone has any examples of any mag/newspaper websites that use Craft? I'm interested to see the blend of technology or how the layouts turned out. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="125" LastEditDate="2015-05-29T15:07:03.580" LastActivityDate="2015-05-29T15:07:03.580" Title="Examples of magazine/newspaper publication websites using Craft?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2015-01-13T18:24:14.543" ContentLicense="CC BY-SA 3.0" />
  <row Id="6573" PostTypeId="2" ParentId="4661" CreationDate="2015-01-13T04:26:53.737" Score="22" Body="&lt;p&gt;Following the answer in this issue &lt;a href=&quot;https://stackoverflow.com/questions/15563217/apache2-fastcgi-comm-with-dynamic-server-aborted-first-read-idle-timeout/15565267#15565267&quot;&gt;https://stackoverflow.com/questions/15563217/apache2-fastcgi-comm-with-dynamic-server-aborted-first-read-idle-timeout/15565267#15565267&lt;/a&gt; I was able to successfully run my script without this dreaded timeout and 500 error, like so:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to &lt;code&gt;File &amp;gt; Edit Template &amp;gt; Apache &amp;gt; httpd.conf&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Do a Find &amp;amp; Replace for &lt;code&gt;MAMP_FastCgiServer_MAMP&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Comment out the line &lt;code&gt;MAMP_FastCgiServer_MAMP&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add a config line for your version of PHP, with the desired timeout limit at the end like so: &lt;code&gt;FastCgiServer /Applications/MAMP/fcgi-bin/php5.6.2.fcgi -idle-timeout 3600&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For your version of PHP the code block would look like this, with the two changes being the second and third last lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_fastcgi.c&amp;gt;&#xA;    # URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/&#xA;    Alias /fcgi-bin/ &quot;/Applications/MAMP/fcgi-bin/&quot;&#xA;&#xA;    # Anything in here is handled as a &quot;dynamic&quot; server if not defined as &quot;static&quot; or &quot;external&quot;&#xA;    &amp;lt;Directory &quot;/Applications/MAMP/fcgi-bin/&quot;&amp;gt;&#xA;        SetHandler fastcgi-script&#xA;        Options +ExecCGI&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&#xA;    # Anything with one of these extensions is handled as a &quot;dynamic&quot; server if not defined as&#xA;    # &quot;static&quot; or &quot;external&quot;. Note: &quot;dynamic&quot; servers require ExecCGI to be on in their directory.&#xA;    AddHandler fastcgi-script .fcgi .fpl&#xA;&#xA;    MAMP_ActionPhpCgi_MAMP&#xA;&#xA;    #MAMP_FastCgiServer_MAMP&#xA;    FastCgiServer /Applications/MAMP/fcgi-bin/php5.5.10.fcgi -idle-timeout 3600&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also reference this solution:  &lt;a href=&quot;https://stackoverflow.com/questions/24715426/how-do-you-increase-the-apache-fastcgi-timeout-on-mamp-mamp-pro/24976009#24976009&quot;&gt;https://stackoverflow.com/questions/24715426/how-do-you-increase-the-apache-fastcgi-timeout-on-mamp-mamp-pro/24976009#24976009&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2171" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-08-30T05:48:37.280" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="6574" PostTypeId="2" ParentId="6572" CreationDate="2015-01-13T08:06:52.397" Score="1" Body="&lt;p&gt;Check out the &lt;a href=&quot;http://straightupcraft.com/project-gallery&quot; rel=&quot;nofollow&quot;&gt;Straighupcraft gallery&lt;/a&gt;. Maybe you'll find something there.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-01-13T08:06:52.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6575" PostTypeId="1" CreationDate="2015-01-13T10:20:20.997" Score="0" ViewCount="301" Body="&lt;p&gt;I am located in Austria using Pixel &amp;amp; Tonic's Store Hours Plugin. The Timezone in Craft's settings is set to UTC+1 (CET) - Europe/Vienna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I type in that it's opened from 3 - 6pm it outputs that it's opened from 2 - 5pm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that it is outputting the UTC but I can't really figure out why and how to fix it.&#xA;Is that possibly a bug in the plugin or is it meant to be adjusted in the template anyway?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerDisplayName="user1010" LastActivityDate="2015-01-13T20:59:20.850" Title="Timezone in Store Hours Plugin" Tags="&lt;plugins&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2015-01-15T17:10:43.037" ContentLicense="CC BY-SA 3.0" />
  <row Id="6576" PostTypeId="2" ParentId="3076" CreationDate="2015-01-13T15:39:56.967" Score="2" Body="&lt;p&gt;To anyone wondering, it had to do with the PHP memory limit and max_post_size. If you're coming across this error, increase the limit.&lt;/p&gt;&#xA;" OwnerUserId="884" LastActivityDate="2015-01-13T15:39:56.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6577" PostTypeId="2" ParentId="6575" CreationDate="2015-01-13T20:59:20.850" Score="1" Body="&lt;p&gt;This is going to be a bug in the Store Hours plugin.  I've created an issue in the repo here so we can keep track of it: &lt;a href=&quot;https://github.com/pixelandtonic/StoreHours/issues/3&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/StoreHours/issues/3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-13T20:59:20.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6578" PostTypeId="1" AcceptedAnswerId="6586" CreationDate="2015-01-13T21:04:17.113" Score="1" ViewCount="310" Body="&lt;p&gt;Craft's documentation states: &quot;If the URI matches an entry’s or category’s URI, the section’s/category group’s template will get loaded&quot;.  Instead of loading the template, how can I set the route to run an action instead?  In config/routes.php, I set 'entryurl' =&gt; array('action' =&gt; 'action/path'), but this does not work.&lt;/p&gt;&#xA;" OwnerUserId="2174" LastActivityDate="2015-01-15T18:27:17.293" Title="How do you route an entry or category URI to a plugin controller?" Tags="&lt;entry&gt;&lt;controller&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6579" PostTypeId="1" CreationDate="2015-01-13T21:14:39.940" Score="0" ViewCount="691" Body="&lt;p&gt;I have everything loaded, my path to &quot;craft&quot; is correct and the database credentials are correct but when I go to domain.com/admin, it pulls up a blank screen. Not a 404, server error, of the &quot;oops&quot; screen. It's just blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My folder permissions are also correct. Anyone else had this? I checked the server requirements and those are also within the correct parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeremy&lt;/p&gt;&#xA;" OwnerUserId="2175" LastActivityDate="2015-01-15T17:56:49.187" Title="Blank screen on install" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6580" PostTypeId="1" AcceptedAnswerId="6588" CreationDate="2015-01-14T07:47:56.910" Score="9" ViewCount="6116" Body="&lt;p&gt;I have CSRF enabled on my install. I have a bunch of frontend forms so CSRF is pretty important for me. However, when I use AJAX to post to a controller action I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div id=&quot;message&quot; class=&quot;pane&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;Bad Request&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;p&amp;gt;The CSRF token could not be verified.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my AJAX that I am testing with.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$(function(){&#xA;    var data = { id: 100 };&#xA;    $.post(&quot;/actions/gistClient/exampleAjax&quot;, data, function(response) {&#xA;        console.log(&quot;success&quot;, response, data);&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my controller action&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionExampleAjax()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;    // ... whatever your AJAX does...&#xA;    $response = array('response' =&amp;gt; 'Round trip via AJAX!');&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to disable CSRF for certain routes? Alternatively, how would I pass CSRF through AJAX to the controller action?&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="45" LastEditDate="2015-01-14T18:48:45.497" LastActivityDate="2019-02-04T23:51:52.700" Title="How can I use CSRF protection with AJAX routes?" Tags="&lt;ajax&gt;&lt;csrf&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6581" PostTypeId="1" AcceptedAnswerId="6597" CreationDate="2015-01-14T12:14:59.637" Score="1" ViewCount="962" Body="&lt;p&gt;I'm having a problem getting entries related to a tag with accentuated characters.&#xA;Here is what the URL looks like : fr.craft.dev/actualites/tag/Traçage%20électrique&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same page work fine with a tag without accents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything special to do to fix this on my side ?&#xA;Or is-it a problem with craft ?&#xA;Here is my code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.name(tag).first() %}&#xA;{% set newsCriteria = craft.entries.section('news').relatedTo(tag).limit(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-01-16T10:55:08.520" Title="Problem with accents in tags &amp; URL" Tags="&lt;tags&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6582" PostTypeId="2" ParentId="6581" CreationDate="2015-01-14T14:35:26.493" Score="4" Body="&lt;p&gt;There is a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#limitAutoSlugsToAscii&quot; rel=&quot;nofollow&quot;&gt;general config setting&lt;/a&gt; for it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'limitAutoSlugsToAscii' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Limits automatically-generated slugs to ASCII characters. When there&#xA;  is an obvious ASCII version of a character (e.g. ñ → n), it will be&#xA;  used. Other characters will be removed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2015-01-14T14:41:48.860" LastActivityDate="2015-01-14T14:41:48.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6583" PostTypeId="1" AcceptedAnswerId="6585" CreationDate="2015-01-14T15:11:28.540" Score="4" ViewCount="1165" Body="&lt;p&gt;I have a plugin that makes several and potentially slow database calls that eventually return 8 Entries. Is there a way to make use of Craft's built in caching on the plugin side? Using the {% cache %} tag doesn't seem to be doing the trick. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2019-03-13T22:12:43.953" Title="Cacheing in PHP code for plugin" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6584" PostTypeId="2" ParentId="5500" CreationDate="2015-01-14T15:42:53.597" Score="2" Body="&lt;p&gt;It’s not currently possible to upload assets via URL, but if we’re only talking about images that are already uploaded into Craft, you could have them selected by their existing asset IDs, rather than URLs, and it would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, go into your Assets field settings and check the “Restrict uploads to a single folder” checkbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your entry form, write a UI for selecting an existing asset. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul class=&quot;asset-selector&quot;&amp;gt;&#xA;    {% for image in craft.assets.source('images') %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;radio&quot; name=&quot;fields[myAssetsField][]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;                {% do image.setTransform({ width: 100, height: 100 }) -%}&#xA;                &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;100&quot; height=&quot;100&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-14T15:42:53.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6585" PostTypeId="2" ParentId="6583" CreationDate="2015-01-14T16:57:57.933" Score="8" Body="&lt;p&gt;You want to take a look at the &lt;code&gt;CacheService&lt;/code&gt; class which is the service that allows you to programmatically interact with the internal cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of how to set some cache that expires in 3600 seconds (one hour). Set the expiration to 0 if you never want it to expire.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;cache-&amp;gt;set('some_key', 'some_value', 3600);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just checkout &lt;code&gt;CacheService&lt;/code&gt; for more details, as there are more methods and parameters to make use of, but this should be the basic use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-cacheservice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;CacheService Class Reference&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="4118" LastEditDate="2019-03-13T22:12:43.953" LastActivityDate="2019-03-13T22:12:43.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6586" PostTypeId="2" ParentId="6578" CreationDate="2015-01-14T17:07:41.510" Score="1" Body="&lt;p&gt;You want to take a look at the &lt;code&gt;registerSiteRoutes()&lt;/code&gt; method in your plugin class. In this example, it will route a request to your &lt;code&gt;MyPluginHandle_FooController::actionBar()&lt;/code&gt; method. &lt;code&gt;foo&lt;/code&gt; is obviously the name of the controller, and &lt;code&gt;bar&lt;/code&gt; is the method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'some/route/here' =&amp;gt; array('action' =&amp;gt; 'myPluginHandle/foo/bar'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what the controller would look like with these naming conventions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace&#xA;&#xA;class MyPluginHandle_FooController extends BaseController&#xA;{&#xA;    // Allow anonymous users (users that aren't logged in) to use this controller&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionBar()&#xA;    {&#xA;        // do something&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also do the same thing for CP routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates#dynamic-url-routing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/templates#dynamic-url-routing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="19" LastEditDate="2015-01-15T18:27:17.293" LastActivityDate="2015-01-15T18:27:17.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6587" PostTypeId="1" CreationDate="2015-01-14T18:26:48.250" Score="5" ViewCount="1539" Body="&lt;p&gt;I am looking to add a field (or perhaps a group?) to the userlayout via a database migration.  I've looked over the docs, and found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/763/is-it-possible-to-add-a-custom-field-to-user-model-from-a-plugin&quot;&gt;Is it possible to add a custom field to User model from a plugin?&lt;/a&gt; but that isn't exactly what I want.  I do not wish to delete the layout and then recreate it.  I just want to add a new field to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping to be able to use the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/FieldLayoutModel#getFields-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getFields()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/models/FieldLayoutModel#setFields-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setFields()&lt;/a&gt; methods directly on the FieldLayoutModel but thus far no dice.  Is there a better way to do with, with a service or something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I am:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Creating a new FieldModel, populating it and saving it. &lt;/li&gt;&#xA;&lt;li&gt;Finding the fieldLayout I want through &lt;code&gt;craft()-&amp;gt;fields-&amp;gt;getLayoutByType()&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;Calling getFields() on it and saving the result to a variable &lt;/li&gt;&#xA;&lt;li&gt;Popping my saved field onto the end of that array &lt;/li&gt;&#xA;&lt;li&gt;Calling setFields on the fieldLayout with that new updated array&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But it's not functioning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time!&lt;/p&gt;&#xA;" OwnerUserId="2179" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-12-07T19:34:26.977" Title="Programatically Adding Fields to a Layout" Tags="&lt;field&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6588" PostTypeId="2" ParentId="6580" CreationDate="2015-01-14T18:41:40.313" Score="21" Body="&lt;p&gt;Disabling the CSRF protection is probably a bad idea... it's in there for a reason. But you can easily add your CSRF data to an AJAX call, and it works very well!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is to &lt;strong&gt;make your CSRF token name &amp;amp; value available in your front-end JS&lt;/strong&gt;. You can then pass that into your AJAX call as an additional value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few ways to push the CSRF data to the front-end, so this is simply one example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set csrfToken = {&#xA;    csrfTokenName: craft.app.config.general.csrfTokenName,&#xA;    csrfTokenValue: craft.app.request.csrfToken,&#xA;} %}&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.Craft = {{ csrfToken|json_encode|raw }};&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you've got those values on the front-end, adding them to your AJAX call is relatively easy:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$(function(){&#xA;    var data = { id: 100 };&#xA;    data[window.Craft.csrfTokenName] = window.Craft.csrfTokenValue; // Append CSRF Token&#xA;    $.post(&quot;/actions/gistClient/exampleAjax&quot;, data, function(response) {&#xA;        console.log(&quot;success&quot;, response, data);&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's it! Your AJAX call should now submit properly.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2019-02-04T23:51:52.700" LastActivityDate="2019-02-04T23:51:52.700" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6589" PostTypeId="1" AcceptedAnswerId="8473" CreationDate="2015-01-14T18:44:55.377" Score="1" ViewCount="282" Body="&lt;p&gt;As of right now I have nine or so structures created, each including it's own Image Gallery created in a Matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to give each image inside that matrix a unique URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to accomplish is to be able to create multiple galleries, each gallery when clicked will just pull up into a Fancybox. The problem with this, is there also needs to be social media sharing (Facebook, Twitter, Pinterest, and Google+) for each item in the gallery. After a bit of research the Facebook og:image tag only shares what is in that URL being shared. So I will need to be able to create pages for each item in the gallery. Would this be possible?&lt;/p&gt;&#xA;" OwnerUserId="1122" LastActivityDate="2015-03-03T12:08:57.040" Title="Matrix Gallery, with every image having it's own unique URL?" Tags="&lt;matrix&gt;&lt;url&gt;&lt;gallery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6590" PostTypeId="2" ParentId="6587" CreationDate="2015-01-14T19:00:03.730" Score="3" Body="&lt;p&gt;Check out Craft's own &lt;a href=&quot;http://buildwithcraft.com/classreference/services/InstallService&quot; rel=&quot;nofollow&quot;&gt;InstallService&lt;/a&gt;'s private &lt;code&gt;_createDefaultContent()&lt;/code&gt; method for an example of how to do this programatically.  This is called during installation to create the default content on a fresh Craft install.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-14T19:00:03.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6591" PostTypeId="2" ParentId="6581" CreationDate="2015-01-14T20:33:56.560" Score="1" Body="&lt;p&gt;I suspect it's something else going on in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just did a simple test on a fresh install of Craft after adding one tag called &lt;code&gt;Traçage électrique&lt;/code&gt; to the default entry and tag field that was created:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.name('Traçage électrique').first() %}&#xA;&#xA;Tag Length = {{ tag|length }}&amp;lt;br /&amp;gt;&#xA;&#xA;{% set entries = craft.entries.section('news').relatedTo().limit(5).find() %}&#xA;&#xA;Entry Length = {{ entries|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it appears to be working fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tag Length = 1&#xA;Entry Length = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-14T20:33:56.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6592" PostTypeId="2" ParentId="6547" CreationDate="2015-01-14T21:17:49.690" Score="1" Body="&lt;p&gt;I found out I was not able to accomplish what I needed by using &lt;strong&gt;modifyElementsQuery&lt;/strong&gt;.  So I created my own &lt;strong&gt;ElementCriteriaModel&lt;/strong&gt; &amp;amp; &lt;strong&gt;buildElementsQuery&lt;/strong&gt; for my plugin. This allows the criteria to be built from my table directly instead of elements table.  &lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-01-15T06:18:45.603" LastActivityDate="2015-01-15T06:18:45.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6593" PostTypeId="1" CreationDate="2015-01-14T22:04:59.850" Score="1" ViewCount="86" Body="&lt;p&gt;I was wondering if there was a plugin that would give my client the ability to download an asset – in this case a submitted resume – when viewing an entry in the backend.&lt;/p&gt;&#xA;" OwnerUserId="312" LastActivityDate="2015-01-15T04:30:01.117" Title="Is it possible to download an asset from an entries tab" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6594" PostTypeId="2" ParentId="2772" CreationDate="2015-01-14T22:31:07.217" Score="1" Body="&lt;p&gt;Fred is definitely on the right path -- the setContent() call works just fine and makes a lot more sense then using getContent():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$initialCredits = 100;&#xA;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$user-&amp;gt;setContent(['initialCredits' =&amp;gt; $initialCredits]);&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;P.S.  The way you're getting the current user is redundant.  Just use &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;getUser()&lt;/code&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="2179" LastEditorUserId="2179" LastEditDate="2015-01-14T23:08:09.870" LastActivityDate="2015-01-14T23:08:09.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6595" PostTypeId="2" ParentId="5442" CreationDate="2015-01-15T00:52:07.007" Score="4" Body="&lt;p&gt;Accepted answer helped me, my issue was Ajax related as well! Here is an example of the code I ended up using in my template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends (craft.request.isAjax and not craft.request.isLivePreview) ? &quot;_ajaxLayout&quot; : &quot;_layout&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1154" LastActivityDate="2015-01-15T00:52:07.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6596" PostTypeId="2" ParentId="6593" CreationDate="2015-01-15T04:30:01.117" Score="1" Body="&lt;p&gt;I'm pretty sure there isn't currently a plugin which makes that possible (&lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;complete list is here&lt;/a&gt;), but I'd imagine it's possible to build one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick would be to set it up as a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;Field Type&lt;/a&gt;. Then your field type would have to dynamically figure out what file is supposed to be downloaded, and provide a button for your user to download it.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-01-15T04:30:01.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6597" PostTypeId="2" ParentId="6581" CreationDate="2015-01-15T06:59:30.253" Score="2" Body="&lt;p&gt;I try to avoid using tag titles in urls. Unlike categories, tags don't have a url-friendly slug, and the tag title itself can contain all manner of punctuation. So you have to clean up the tag somehow (&lt;a href=&quot;https://github.com/boboldehampsink/slugify/&quot; rel=&quot;nofollow&quot;&gt;slugify&lt;/a&gt; e.g.), and later you have to try to reconstruct the tag from the slugified value, which isn't always even possible (different tag titles can slugify to the same value). What I use instead is the tag id, which is nicely unambiguous and url-friendly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your route to define the url would still look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;actualites/tag/[tag] -&amp;gt; whatever_template&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you would retrieve the actual tag like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.id(tag).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-15T06:59:30.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6598" PostTypeId="1" AcceptedAnswerId="6609" CreationDate="2015-01-15T09:04:27.843" Score="0" ViewCount="1134" Body="&lt;p&gt;I'm running Craft CMS on OS X Yosemite (Server.app) and cannot upload PNG images. JPG uploads are working as expected. I get a log message like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/01/15 08:39:08 [error] [exception.Imagine\Exception\RuntimeException] exception 'Imagine\Exception\RuntimeException' with message 'Unable to open image .../craft/storage/runtime/temp/assets54b77cabe51c25.46473389.png' in .../craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php:96&#xA;Stack trace:&#xA;#0 /*/craft/app/etc/io/Image.php(136): Imagine\Gd\Imagine-&amp;gt;open('...')&#xA;#1 /*/craft/app/services/ImagesService.php(84): Craft\Image-&amp;gt;loadImage('...')&#xA;#2 /*/craft/app/services/ImagesService.php(153): Craft\ImagesService-&amp;gt;loadImage('...')&#xA;#3 /*/craft/app/assetsourcetypes/BaseAssetSourceType.php(183): Craft\ImagesService-&amp;gt;cleanImage('...')&#xA;#4 /*/craft/app/assetsourcetypes/BaseAssetSourceType.php(145): Craft\BaseAssetSourceType-&amp;gt;insertFileByPath('...', Object(Craft\AssetFolderModel), 'HSS_Highlife_20...')&#xA;#5 /*/craft/app/services/AssetsService.php(673): Craft\BaseAssetSourceType-&amp;gt;uploadFile(Object(Craft\AssetFolderModel))&#xA;#6 /*/craft/app/controllers/AssetsController.php(71): Craft\AssetsService-&amp;gt;uploadFile('1', NULL, 0, NULL)&#xA;#7 /*/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController-&amp;gt;actionUploadFile()&#xA;#8 /*/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#9 /*/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#10 /*/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#11 /*/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('uploadFile')&#xA;#12 /*/craft/app/etc/web/WebApp.php(754): CWebApplication-&amp;gt;runController('assets/uploadFi...')&#xA;#13 /*/craft/app/etc/web/WebApp.php(261): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#14 /*/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#15 /*/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#16 /*/public/index.php(14): require_once('...')&#xA;#17 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/assets/uploadFile&#xA;HTTP_REFERER=http://*/index.php?p=admin/entries/banners/5-highlife-vanguard&#xA;---&#xA;2015/01/15 08:39:08 [error] [application] Unable to open image craft/storage/runtime/temp/assets54b77cabe51c25.46473389.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like a problem with the Imagine library not being able to open the uploaded PNGs?&lt;/p&gt;&#xA;" OwnerUserId="2181" LastActivityDate="2015-01-15T16:53:47.730" Title="Unable to upload PNG images" Tags="&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6599" PostTypeId="1" AcceptedAnswerId="6601" CreationDate="2015-01-15T11:11:08.503" Score="6" ViewCount="1659" Body="&lt;p&gt;I have just started to build my first plugin with Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im at the part where I want to defne my database table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/plugins/database&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the method definedAttributes() what values will the array accept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like I can define values and types, but how do i add field lengths, primarykeys etc.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some other docs that I can look at?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="2182" LastActivityDate="2015-01-15T12:06:31.890" Title="ActiveRecord defineAttributes()" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6600" PostTypeId="1" AcceptedAnswerId="6653" CreationDate="2015-01-15T11:24:49.967" Score="3" ViewCount="1965" Body="&lt;p&gt;I've got an events listings which works pretty well and there is a:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Custom Date field, eventEnd (just date)&lt;/li&gt;&#xA;&lt;li&gt;Custom Start Time, eventStart (just time)&lt;/li&gt;&#xA;&lt;li&gt;Custom End Time, eventEnd (just time)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can list these entries so we list by date then time by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').order('eventDate', 'eventStart').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but eventStart is ignored altogether, even when I would use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').order('eventStart').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would expect:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Event 1: 14:00&#xA;Event 2: 15:00&#xA;Event 3: 16:00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but instead get something more random based I think on post date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions welcome thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my biggest issue is actually being able to list by eventStart at all. Just using {{ eventStart }} reveals the current date. But if I try to boil down to just the hour, it's not a recognised way of ordering (even though it's just a set of numbers?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm not sure where to head with this. I'm sure that if my start time was bundled in with the main date, all would be fine, but it makes the system a bit less obvious and flexible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set completeeventlist = craft.entries.section('events') %}&#xA;{% for x in craft.entries(completeeventlist).order('eventDate') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% set es = x.eventStart|date('H') %}&#xA;        {% for entry in craft.entries(x).order(es) %}&#xA;        &amp;lt;li&amp;gt;{{ entry.id }}{{ es }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="264" LastEditorUserId="264" LastEditDate="2015-01-19T06:44:19.423" LastActivityDate="2015-01-19T08:22:24.857" Title="Order entries by custom time field" Tags="&lt;entries&gt;&lt;order&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6601" PostTypeId="2" ParentId="6599" CreationDate="2015-01-15T12:06:31.890" Score="9" Body="&lt;p&gt;You best bet would be to start by knowing all the exisiting default attribute types in this file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/app/enums/AttributeType.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then look in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/app/helpers/ModelHelper.php&lt;/code&gt;&#xA;and&#xA;&lt;code&gt;craft/app/helpers/DbHelper.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you will find all sorts of properties for column types and their default configs options like maxLength. Here is all the ColumnTypes defaults:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static $attributeTypeDefaults = array(&#xA;    AttributeType::Mixed      =&amp;gt; array('model' =&amp;gt; null, 'column' =&amp;gt; ColumnType::Text),&#xA;    AttributeType::Bool       =&amp;gt; array('maxLength' =&amp;gt; 1, 'default' =&amp;gt; false, 'required' =&amp;gt; true, 'column' =&amp;gt; ColumnType::TinyInt, 'unsigned' =&amp;gt; true),&#xA;    AttributeType::ClassName  =&amp;gt; array('maxLength' =&amp;gt; 150, 'column' =&amp;gt; ColumnType::Varchar),&#xA;    AttributeType::DateTime   =&amp;gt; array('column' =&amp;gt; ColumnType::DateTime),&#xA;    AttributeType::Email      =&amp;gt; array('minLength' =&amp;gt; 5, 'column' =&amp;gt; ColumnType::Varchar),&#xA;    AttributeType::Enum       =&amp;gt; array('values' =&amp;gt; array(), 'column' =&amp;gt; ColumnType::Enum),&#xA;    AttributeType::Handle     =&amp;gt; array('maxLength' =&amp;gt; 255, 'reservedWords' =&amp;gt; 'id,dateCreated,dateUpdated,uid,title', 'column' =&amp;gt; ColumnType::Varchar),&#xA;    AttributeType::Locale     =&amp;gt; array('column' =&amp;gt; ColumnType::Locale),&#xA;    AttributeType::Name       =&amp;gt; array('maxLength' =&amp;gt; 255, 'column' =&amp;gt; ColumnType::Varchar),&#xA;    AttributeType::Number     =&amp;gt; array('min' =&amp;gt; null, 'max' =&amp;gt; null, 'decimals' =&amp;gt; 0),&#xA;    AttributeType::SortOrder  =&amp;gt; array('column' =&amp;gt; ColumnType::TinyInt),&#xA;    AttributeType::Template   =&amp;gt; array('maxLength' =&amp;gt; 500, 'column' =&amp;gt; ColumnType::Varchar),&#xA;    AttributeType::Url        =&amp;gt; array('maxLength' =&amp;gt; 255, 'column' =&amp;gt; ColumnType::Varchar),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will also see in the DbHelper.php how the column types map into the mysql definition of the table like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case ColumnType::Decimal:&#xA;            {&#xA;                $def = 'DECIMAL('.$config['length'].','.$config['decimals'].')';&#xA;                break;&#xA;            }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. I would encourage you to look at all the &lt;code&gt;defineAttributes()&lt;/code&gt; methods in the &lt;code&gt;craft/app/records&lt;/code&gt; directory.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-01-15T12:06:31.890" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6602" PostTypeId="1" AcceptedAnswerId="6604" CreationDate="2015-01-15T12:46:32.160" Score="1" ViewCount="726" Body="&lt;p&gt;With Craft Active Record, using the definedAttributes Method how do I set my Primary Key Field to auto increment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or does it just calculate another number for the field that has not been used when the record gets saved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="2182" LastActivityDate="2015-01-15T14:13:34.233" Title="ActiveRecord Primary Key - Auto increment" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6603" PostTypeId="2" ParentId="6602" CreationDate="2015-01-15T13:32:59.460" Score="2" Body="&lt;p&gt;You don't need to define an &lt;code&gt;id&lt;/code&gt; attribute in your Craft Records Class - it is created automatically for you on plugin install as an auto-incremented int. You do need to define the id attribute on the equivalent Model though, and &lt;code&gt;AttributeType::Number&lt;/code&gt; is fine for that.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-01-15T13:32:59.460" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6604" PostTypeId="2" ParentId="6602" CreationDate="2015-01-15T14:13:34.233" Score="1" Body="&lt;p&gt;Use a 'column' in your defineAttributes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'id_customer'       =&amp;gt; array(AttributeType::Number, 'column' =&amp;gt; ColumnType::PK)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2015-01-15T14:13:34.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6605" PostTypeId="1" AcceptedAnswerId="6613" CreationDate="2015-01-15T15:37:36.530" Score="2" ViewCount="579" Body="&lt;p&gt;I'm building a simple user backend and I would like to use Redactor for a couple fields. I see Redactor is a commercial product.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When I pay for Craft Pro does that include a license to use Redactor?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;From an implementation standpoint, can I use the libraries already available?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I guess I wouldn't mind loading in another version of redactor for my front end. But I'm mostly curious if my craft license covers a redactor license. &lt;/p&gt;&#xA;" OwnerUserId="1101" LastActivityDate="2015-01-15T19:06:14.420" Title="Can I use Redactor on my front end?" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6606" PostTypeId="1" AcceptedAnswerId="6622" CreationDate="2015-01-15T15:52:05.770" Score="1" ViewCount="191" Body="&lt;p&gt;I want to run a search on Assets that are in use within a particular section. The Assets are added to entries via a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search term is provided via a url parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchTerm = craft.request.getParam('q') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Somewhat optimistically I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imagesInUse = craft.assets.relatedTo({&#xA;  targetElement: craft.entries({&#xA;    section : 'agency'&#xA;  }),&#xA;  field : imageList.keyImage&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where imageList is the Matrix field and keyImage is the Assets field. The block name is imageSpread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This apparently returns nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the search part, I'm trying to search within 'imagesInUse':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in imagesInUse.search('*' ~ searchTerm ~ '*').order('score') %} ... {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like a relatively complex query might be required, but I'm not sure where to go from here.&lt;/p&gt;&#xA;" OwnerUserId="470" LastEditorUserId="470" LastEditDate="2015-01-16T11:59:20.637" LastActivityDate="2015-01-17T16:48:56.667" Title="Search Assets in Matrix fields, if they appear in a Section" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;relations&gt;&lt;sections&gt;&lt;search&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6607" PostTypeId="1" AcceptedAnswerId="6760" CreationDate="2015-01-15T16:23:26.050" Score="1" ViewCount="681" Body="&lt;p&gt;We have two sites that more or less share the share the same design, so we're thinking of having a single craft instance, but with DB config pointing to two separate DBs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea being you can manage the content of both sites independently but not have to have the codebase (templates, plugins, frontend assets etc) duplicated across two installs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both sites would be localised so we'd have a number of URLs to configure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this approach work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the things I guess might be a problem is the license.key file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&gt;&gt;&gt;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that I'm happy to keep the same templates across both sites but want to ensure the license works on both domains, I've tried the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Configure domain-a.com to point to a webroot called &lt;strong&gt;./domain-a/&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Configure domain-b.com to point to a webroot called &lt;strong&gt;./domain-b/&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copy the contents of Craft's &lt;strong&gt;./public/&lt;/strong&gt; directory to the directories above&lt;/li&gt;&#xA;&lt;li&gt;In the index.php file in &lt;strong&gt;./domain-a/&lt;/strong&gt; set the &lt;strong&gt;CRAFT_CONFIG_PATH&lt;/strong&gt; PHP constant to point to &lt;strong&gt;../craft/config-domain-a/&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;In the index.php file in .&lt;strong&gt;/domain-b/&lt;/strong&gt; set the &lt;strong&gt;CRAFT_CONFIG_PATH&lt;/strong&gt; PHP constant to point to &lt;strong&gt;../craft/config-domain-b/&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copy the contents of Craft's **./craft/config/* directory to the config directories above.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In theory, that should mean I can have a config - and therefore license.key file - for 2 domains that share the same codebase, including templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the config seems to have an issue in that everything 404s. For example I've set the &lt;strong&gt;cpTrigger&lt;/strong&gt; property in &lt;strong&gt;./craft/config-domain-a/general.php&lt;/strong&gt; and &lt;strong&gt;./craft/config-domain-b/general.php&lt;/strong&gt; to be something other than &lt;strong&gt;admin&lt;/strong&gt;, which works fine until I make all the changes above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT &gt;&gt;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot of more simple setup with config dir renamed to &lt;strong&gt;config-test&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9MfWo.png&quot; alt=&quot;Screenshot of folder structure&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contents of config's general.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; *&#xA; * All of your system's general configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/general.php&#xA; */&#xA;&#xA;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true, &#xA;        'cacheDuration' =&amp;gt; 'P1W', &#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'https://' . $_SERVER['SERVER_NAME'] . '/en/', &#xA;            'es' =&amp;gt; 'https://' . $_SERVER['SERVER_NAME'] . '/es/', &#xA;            'fr' =&amp;gt; 'https://' . $_SERVER['SERVER_NAME'] . '/fr/', &#xA;            'de' =&amp;gt; 'https://' . $_SERVER['SERVER_NAME'] . '/de/', &#xA;            'it' =&amp;gt; 'https://' . $_SERVER['SERVER_NAME'] . '/it/'&#xA;        ),&#xA;        'timezone' =&amp;gt; 'Europe/London', &#xA;        'allowAutoUpdates' =&amp;gt; false, &#xA;        'cpTrigger' =&amp;gt; 'mgmt', &#xA;        'rememberUsernameDuration' =&amp;gt; false,&#xA;        'rememberedUserSessionDuration' =&amp;gt; false,&#xA;        'useEmailAsUsername' =&amp;gt; true&#xA;    ),&#xA;&#xA;    'local.' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true, &#xA;        'overridePhpSessionLocation' =&amp;gt; false, &#xA;        // 'translationDebugOutput' =&amp;gt; true, &#xA;        'allowAutoUpdates' =&amp;gt; true, &#xA;        'rememberUsernameDuration' =&amp;gt; 'P1M',&#xA;        'rememberedUserSessionDuration' =&amp;gt; false,&#xA;    )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;index.php&lt;/strong&gt; file from &lt;strong&gt;public_html/&lt;/strong&gt; (through which we access the admin panel):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;define('CRAFT_CONFIG_PATH', '../craft/config-test');&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally the &lt;strong&gt;index.php&lt;/strong&gt; from &lt;strong&gt;public_html/en/&lt;/strong&gt; (for the default English locale):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the English content&#xA;define('CRAFT_LOCALE', 'en');&#xA;&#xA;define('CRAFT_CONFIG_PATH', '../../craft/config-test');&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-01-15T23:13:39.507" LastActivityDate="2015-01-22T21:39:51.900" Title="Multiple databases, single codebase" Tags="&lt;localization&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6608" PostTypeId="1" CreationDate="2015-01-15T16:49:53.123" Score="3" ViewCount="156" Body="&lt;p&gt;I made two different types of Assets: one for images and one for PDF. &#xA;They works in 2 differents folder to avoid to mix them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using them inside entries it works good, if I try to upload something different I receive an error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I click Assets on the main Menu (not inside entries) I'd like limit the upload to the asset I choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that I would like prevent to upload a pdf on asset images and vice versa and I'd like also to prevent uploading of any different file types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if Im doing something wrong or its the natural behaviour of CRAFT.&lt;/p&gt;&#xA;" OwnerUserId="2183" LastActivityDate="2015-01-15T17:01:05.207" Title="Prevent to upload any kind of file on Asset menu" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6609" PostTypeId="2" ParentId="6598" CreationDate="2015-01-15T16:53:47.730" Score="3" Body="&lt;p&gt;Is there anything special about that PNG file?  It's likely that it's in a PNG format that &lt;a href=&quot;http://php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt; does not support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install &lt;a href=&quot;http://php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; and try again.  It handles a much wider range of formats, is generally less buggy and produces better results.  Craft will automatically use it if it detects that it is installed and available to PHP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-15T16:53:47.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6610" PostTypeId="2" ParentId="6608" CreationDate="2015-01-15T17:01:05.207" Score="2" Body="&lt;p&gt;The ability to restrict the allowed file types is defined on a per-field level.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do what you're looking for, it would have to be defined on a per-asset source level, so no... it's currently not possible natively.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-15T17:01:05.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6611" PostTypeId="2" ParentId="44" CreationDate="2015-01-15T17:24:46.603" Score="10" Body="&lt;p&gt;Thought I would share my language switcher, as it shows languages in their native name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;nav nav--locale&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% set locales = craft.i18n.getSiteLocales() %}&#xA;&#xA;        {% for locale in locales %}&#xA;            {% set entryURL = craft.config.siteUrl[locale.id] %}&#xA;&#xA;            {% if entry is defined %}&#xA;                {% set entryLocal = craft.entries.id(entry.id).locale(locale.id).first %}&#xA;&#xA;                {% if entryLocal.getUrl() is defined %}&#xA;                    {% set entryURL = entryLocal.getUrl() %}&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;li class=&quot;nav__item {% if locale.id == craft.locale %}nav__item--active{% endif %}&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entryURL }}&quot;&amp;gt;{{ locale.nativeName }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;li class=&quot;nav__item {% if locale.id == craft.locale %}nav__item--active{% endif %}&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entryURL }}&quot;&amp;gt;{{ locale.nativeName }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: I have fixed an issue when the entry doesn't have the content in all the different locales. This happens when you turn the default locale off in the section settings. In this case the link will take you back to the home page for that language.&lt;/p&gt;&#xA;" OwnerUserId="2184" LastEditorUserId="2184" LastEditDate="2015-01-16T09:48:54.420" LastActivityDate="2015-01-16T09:48:54.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6612" PostTypeId="2" ParentId="6579" CreationDate="2015-01-15T17:56:49.187" Score="1" Body="&lt;p&gt;I simply deleted everything and re-uploaded and it worked. It must have been a corrupt upload because I'm up and running now. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2175" LastActivityDate="2015-01-15T17:56:49.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6613" PostTypeId="2" ParentId="6605" CreationDate="2015-01-15T19:06:14.420" Score="2" Body="&lt;p&gt;Brandon has answered this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4225/how-do-i-enable-redactor-rich-text-editor-in-a-front-end-form/4238#4238&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tl;dr: technically possible, legally questionable, in practice not a good idea.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-15T19:06:14.420" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6614" PostTypeId="2" ParentId="2419" CreationDate="2015-01-15T19:31:58.420" Score="2" Body="&lt;p&gt;Iain's Introvert plugin shows the relationship on the child entry as well (reverse related entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/craft-plugins/introvert&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/craft-plugins/introvert&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used it for Craft yet, but he wrote one for ExpressionEngine that worked well.&lt;/p&gt;&#xA;" OwnerUserId="2186" LastActivityDate="2015-01-15T19:31:58.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6615" PostTypeId="1" CreationDate="2015-01-15T21:07:24.210" Score="4" ViewCount="2705" Body="&lt;p&gt;Sorry to repeat this question but not yet found a fix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Followed the install and when I try and navigate to:&#xA;site/admin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get: &quot;The requested URL /admin was not found on this server&quot;&#xA;Have tried moving files around/permissions as 777, and changing the $craftpath but no joy as yet.&#xA;I use MAMP set up for other projects so is there an approach &lt;em&gt;without&lt;/em&gt; changing MAMP settings?&#xA;Or am I missing something obvious?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate any help albeit a very basic question as want to get started!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2021-04-05T22:29:04.677" Title="Craft install locally with MAMP Pro" Tags="&lt;mamp&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6616" PostTypeId="1" CreationDate="2015-01-16T07:01:57.597" Score="2" ViewCount="1897" Body="&lt;p&gt;I have a text field in my database in which I'm going to index the contents of a PDF file. Right now the database column for that field is defined as &quot;TEXT&quot; but I need more space since my PDF files can be quite large. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I change this column in the database to MEDIUMTEXT or LONGTEXT or will this be a problem with Craft somehow?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-01-16T07:01:57.597" Title="Can I change TEXT to MEDIUMTEXT/LONGTEXT in database?" Tags="&lt;database&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6617" PostTypeId="2" ParentId="6616" CreationDate="2015-01-16T07:01:57.597" Score="3" Body="&lt;p&gt;The underlying database column for the plain text field type is defined by it's Max Length setting under it's field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set that to something crazy high (like greater than 4294967295), it should use Long Text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that Craft will adapt and change the column type dynamic from how much &quot;data&quot; you need to store/define for the field. Very powerful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note or warning (from Brad Bell at P&amp;amp;T support)&lt;/strong&gt;&#xA;&lt;em&gt;I'd make sure that you really need that much storage space (up to 4GB per row!). You can really start to choke MySQL by abusing that data type. Medium Text stores a very healthy 16MB, which is still a lot of data.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-01-16T07:01:57.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6618" PostTypeId="1" AcceptedAnswerId="6755" CreationDate="2015-01-16T08:38:49.863" Score="2" ViewCount="439" Body="&lt;p&gt;I have had a custom console command running fine for several months now which sent out reminder emails to users when there accounts are about to expire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the latest Craft update (I believe) it stopped working. Here is the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054&#xA;Unknown column 'users.locked' in 'field list'&#xA;exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.locked' in 'field list'' in CDbCommand.php:543&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The lines of code from the plugin service which cause the error are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;&#xA;$user_criteria-&amp;gt;userExpiryDate = date('Y-m-d',strtotime(&quot;+7 days&quot;));&#xA;&#xA;$users = $user_criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically it fails when running the find() method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strangely I haven't managed to replicate the error on my local machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea what might be causing this?&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-01-22T16:08:21.710" Title="Console command runing from Cron job failing after Craft update" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6619" PostTypeId="1" CreationDate="2015-01-16T09:15:13.827" Score="1" ViewCount="919" Body="&lt;p&gt;I have a Structure section (&lt;code&gt;galeriesPhotos&lt;/code&gt;) with two Entry Types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Albums&lt;/strong&gt; - the categories on the index.html page&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Photos&lt;/strong&gt; - the the actual gallery on the &lt;code&gt;entry.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm trying to display the images related to the &quot;Albums&quot; on &lt;code&gt;entry.html&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('galeriesPhotos').getEntryType('Photos') %}&#xA;&#xA;{% for image in entries %}&#xA;  &amp;lt;img src=&quot;{{ image.getUrl }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nothing happens. I get a blank page without any errors. What I am doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="115" LastEditDate="2015-08-23T05:26:54.423" LastActivityDate="2015-08-23T05:32:54.027" Title="Display images from Structure" Tags="&lt;structure&gt;&lt;entry-type&gt;&lt;image&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6620" PostTypeId="2" ParentId="6581" CreationDate="2015-01-16T10:55:08.520" Score="0" Body="&lt;p&gt;I did some digging in the database, following Brad advices.&#xA;First, the code was ok. Here the one I used.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set current_tag = craft.tags.name(tag).first() %}&#xA;{% set newsCriteria = craft.entries.section('news').relatedTo(current_tag).limit(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find out that I had multiple tags names the same in the table &quot;craft_content&quot;.&#xA;I assume that the last one was associated to the news, and the first one was the one queried by the &quot;name(tag).first()&quot; call. And so there was no news associated with this tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deleted all the tags in the craft_content table, and re-created them in the backoffice.&#xA;Now it works perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for all your help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-01-16T10:55:08.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6621" PostTypeId="2" ParentId="2842" CreationDate="2015-01-16T11:10:23.260" Score="8" Body="&lt;p&gt;Here's the approach that work for me. Using &lt;a href=&quot;https://github.com/paulirish/infinite-scroll&quot;&gt;Infinite Scroll&lt;/a&gt; jQuery plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the header, I'm checking whether this is AJAX request or not and use different layout based on that. This is optional though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;{% set layout = &quot;_ajaxLayout&quot; %}&#xA;  {% else %}&#xA;{% set layout = &quot;_layout&quot; %}&#xA;  {% endif %}&#xA;&#xA;{% extends layout %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the content area, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;newsPage&quot; class=&quot;container&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot; id=&quot;newsRow&quot;&amp;gt;&#xA;{% paginate craft.entries.section('news').limit(3) as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;    &amp;lt;div class=&quot;col-md-4 col-sm-6 margin-bottom&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;entry&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;div class=&quot;date&quot;&amp;gt;{{ entry.postDate|date(&quot;M d, Y&quot;) }}&amp;lt;/div&amp;gt;&#xA;                {{ entry.body }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;    &amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}                                           &#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, somewhere in the footer (note the If, I put it to make sure the infinite scroll fors only on first page)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.pageNum==1 %}&#xA;&#xA;{% paginate craft.entries.section('news').limit(3) as entriesOnPage %}&#xA;{% if paginate.nextUrl %}&#xA;&amp;lt;script src=&quot;/resources/js/infinite-scroll/jquery.infinitescroll.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;$('#newsPage').infinitescroll({&#xA; navSelector  : &quot;div.pagination&quot;,            &#xA; nextSelector : &quot;div.pagination a:first&quot;,    &#xA; itemSelector : &quot;#newsPage&amp;gt;div.row&quot;,&#xA; maxPage      : {{paginate.totalPages}},&#xA;});&#xA;&amp;lt;/script&amp;gt;&#xA;{% endif %}&#xA;{% endpaginate %}   &#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2015-01-16T11:10:23.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6622" PostTypeId="2" ParentId="6606" CreationDate="2015-01-16T12:29:15.263" Score="2" Body="&lt;p&gt;Managed to make this work, corrected a couple of things and tidied up, but the main issue was realising the field param has to be a string (duh), not a variable. My code now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.type('artistFolio').limit(null) %}&#xA;&#xA;{% set imagesInUse = craft.assets.relatedTo({&#xA;    sourceElement: entries,&#xA;    field: 'imageList'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me a model with all images appearing inside the Matrix field 'imageList' within the entry type 'artistFolio'. I can then search these as so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchTerm = craft.request.getParam('q') %}&#xA;{% set results = imagesInUse.search('*' ~ searchTerm ~ '*').order('score') %}&#xA;&#xA;{% for image in results %}&#xA;    ...&#xA;{ % endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="470" LastEditorUserId="470" LastEditDate="2015-01-17T16:48:56.667" LastActivityDate="2015-01-17T16:48:56.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6623" PostTypeId="1" CreationDate="2015-01-16T14:14:48.433" Score="1" ViewCount="1446" Body="&lt;p&gt;How can I debug an 'Unknown error' message that I get with every request in Craft?&#xA;Logging says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2015/01/16 14:03:36 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /storage/www/imagecenter/acceptance/craft/app/etc/web/WebApp.php:873&#xA;Stack trace:&#xA;#0 /storage/www/imagecenter/acceptance/craft/app/etc/web/WebApp.php(218): Craft\WebApp-&amp;gt;_processUpdateLogic()&#xA;#1 /storage/www/imagecenter/acceptance/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /storage/www/imagecenter/acceptance/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /storage/www/imagecenter/acceptance/htdocs/index.php(16): require_once('/storage/www/im...')&#xA;#4 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/users/getAuthTimeout&amp;amp;dontExtendSession=1&#xA;HTTP_REFERER=http://acceptance.imagecenter.blinkdev.nl/index.php?p=admin/entries&#xA;---&#xA;2015/01/16 14:03:36 [error] [application]&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1014" LastEditorUserId="45" LastEditDate="2015-01-16T17:53:27.540" LastActivityDate="2015-01-16T18:05:23.550" Title="Best practices in debugging an 'Unknown error'" Tags="&lt;debugging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6625" PostTypeId="1" CreationDate="2015-01-16T15:26:08.830" Score="2" ViewCount="982" Body="&lt;p&gt;I have a Craft application in an intranet behind a proxy.&#xA;I'm struggling to find a way of configuring the application so it can access the internet via the proxy, in particular for the auto updating and license check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using PHP's stream_context_set_default() but cannot get it to work in the admin section. Here's what i did so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a connect.php file in my public folder just to check if my script works.&#xA;It does as i can get the headers for any site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$PROXY_HOST = &quot;url.to.my.proxy&quot;;&#xA;$PROXY_PORT = &quot;8080&quot;;&#xA;$PROXY_USER = &quot;username&quot;;&#xA;$PROXY_PASS = &quot;password&quot;;&#xA;&#xA;$auth = base64_encode(&quot;$PROXY_USER:$PROXY_PASS&quot;);&#xA;stream_context_set_default(&#xA;  array(&#xA;    'http' =&amp;gt; array(&#xA;      'proxy' =&amp;gt; &quot;tcp://$PROXY_HOST:$PROXY_PORT&quot;,&#xA;      'request_fulluri' =&amp;gt; true,&#xA;      'header' =&amp;gt; &quot;Proxy-Authorization: Basic $auth&quot;&#xA;    )&#xA;  )&#xA;);&#xA;&#xA;$url = &quot;https://elliott.buildwithcraft.com/actions/elliott/app/ping&quot;;&#xA;&#xA;print_r( get_headers($url) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there, i'm stuck. I have no idea what to do next to try and inject that into the auto updating part of Craft. I know it's bad to mess with the core, and don't want to, but i have no idea where to go from here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone been in a similar situation ?&lt;br&gt;&#xA;Am i missing something obvious where all of this wouldn't be needed ? (hope so)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Following @BradBell answer i searched for Guzzle information and found this in the &lt;a href=&quot;https://github.com/guzzle/guzzle3/blob/master/docs/http-client/request.rst#request-options&quot; rel=&quot;nofollow&quot;&gt;documentation for Guzzle 3.x&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Requests options can be specified when creating a request or in the request.options parameter of a client. These options can control various aspects of a request including: headers to send, query string data, where the response should be downloaded, proxies, auth, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = $client-&amp;gt;get($url, $headers, array('proxy' =&amp;gt; 'http://proxy.com'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe this can be put to some use in the current Craft install?&lt;br&gt;&#xA;If so, some guidance will be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2189" LastEditorUserId="2189" LastEditDate="2015-01-16T19:29:49.907" LastActivityDate="2015-02-15T19:35:55.477" Title="How to configure Craft to use a Proxy?" Tags="&lt;config&gt;&lt;auto-updates&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6626" PostTypeId="1" CreationDate="2015-01-16T15:41:55.420" Score="3" ViewCount="463" Body="&lt;p&gt;Does anyone else have the same issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Post the recent Craft 2.3 update all image transforms on my server (about 6 craft sites now) are throwing errors on new transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically write errors from the Imagine library's Imagick classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My directories are writable and these sites have been working for some time. No new updates on the server, standard Debian lamp stack.&lt;/p&gt;&#xA;" OwnerUserId="375" LastEditorUserId="375" LastEditDate="2015-01-16T18:42:49.467" LastActivityDate="2015-01-16T18:44:48.657" Title="Errors with Craft 2.3, Imagine and Imagick" Tags="&lt;assets&gt;&lt;config&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6627" PostTypeId="1" CreationDate="2015-01-16T17:27:12.247" Score="1" ViewCount="1209" Body="&lt;p&gt;I'm working with the P&amp;amp;T contact form plugin:&#xA;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I can't figure out how to add additional fields to my email, where do I add the additional field to the email template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks is advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MORE INFO:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error Message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Property &quot;Craft\ContactFormModel.company&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;HTML Email Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;body = &quot;Your Name: &quot;.$message-&amp;gt;fromName.&quot;\n\nCompany:\n\n&quot;.$message-&amp;gt;company.&quot;Email Address: &quot;.$message-&amp;gt;fromEmail.&quot;\n\nPhone Number: &quot;.$message-&amp;gt;phone.&quot;\n\nRequests: &quot;.$message-&amp;gt;message;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2190" LastEditorUserId="5437" LastEditDate="2016-08-01T06:32:25.300" LastActivityDate="2020-06-09T12:13:56.797" Title="Adding additional custom fields to Contact Form Plugin from Pixel &amp; Tonic" Tags="&lt;plugin-contactform&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6628" PostTypeId="2" ParentId="6623" CreationDate="2015-01-16T18:05:23.550" Score="2" Body="&lt;p&gt;&lt;code&gt;Unknown error&lt;/code&gt; messages in the control panel almost always happen over an AJAX request and are usually 500 response code Internal Server Errors, so there isn't an convenient way to display a meaningful error message with a full stack trace to help debug.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you've found the next best thing... the error logs in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually if you see it on every page in the CP, it's from something like Craft trying to write a license file to the &lt;code&gt;craft/config&lt;/code&gt; folder, but it can't. The error you shared is a 503 response, which means &quot;Service Unavailable&quot;.  You'd typically only see that if a request comes into the front-end of the site while Craft is in the middle of an update, or the front-end of the site is offline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm not 100% sure the error you posted is the one that's causing the &quot;unknown error&quot;.  I'd enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, clear out all your log files, reproduce the problem and scour the logs again to see if anything else pops out.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-16T18:05:23.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6629" PostTypeId="2" ParentId="6625" CreationDate="2015-01-16T18:17:05.377" Score="1" Body="&lt;p&gt;I'm not sure I've got a good answer for you here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.x uses &lt;a href=&quot;http://guzzle.readthedocs.org/en/latest/&quot; rel=&quot;nofollow&quot;&gt;Guzzle&lt;/a&gt; 3.x for all of its outbound communications, so I'm not sure if it would be respecting &lt;code&gt;stream_context_set_default&lt;/code&gt; at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I recall, the last time someone brought this up, we looked into it and decided we needed to update to the latest Guzzle (5.x) to properly support it (they release quickly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately both Guzzle 4.x and 5.x introduced breaking changes to Craft.  So it'll have to be Craft 3.x before we add outbound proxy connection configuration options to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only workarounds I can think of until then are to whitelist the IP address(es) of the Craft install to allow direct outbound access if that's possible.  If you can't do that, then maybe you can just get away with manual updates and let license checking silently fail.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-16T18:17:05.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6630" PostTypeId="2" ParentId="6627" CreationDate="2015-01-16T18:24:39.030" Score="2" Body="&lt;p&gt;I'd start by reading the &quot;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#adding-additional-fields&quot; rel=&quot;nofollow&quot;&gt;Adding Additional Fields&lt;/a&gt;&quot; part of the docs. ;)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-16T18:24:39.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6631" PostTypeId="1" CreationDate="2015-01-16T18:37:14.050" Score="1" ViewCount="285" Body="&lt;p&gt;I am developing multi-sites with the locals. Everything is fine. Is it possible to change the name of locals. I 'd like to give some other names to locals so that those can be more clear while managing the contents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please guide me for it.&lt;/p&gt;&#xA;" OwnerUserId="613" LastEditorUserId="125" LastEditDate="2015-01-20T19:06:57.547" LastActivityDate="2015-01-20T19:06:57.547" Title="How to change the locals name in Localized Sites" Tags="&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6632" PostTypeId="2" ParentId="6626" CreationDate="2015-01-16T18:44:48.657" Score="3" Body="&lt;p&gt;I've tracked it down / fixed it by explictly selecting my 'imageDriver' in the config. The docs say this is a new setting in 2.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the default of 'null' is calling 'imagick' but not working, whereas choosing 'imagick' in the config makes it work?&lt;/p&gt;&#xA;" OwnerUserId="375" LastActivityDate="2015-01-16T18:44:48.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6633" PostTypeId="1" AcceptedAnswerId="6702" CreationDate="2015-01-16T19:11:00.393" Score="22" ViewCount="1787" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag is quite powerful, and can be used to greatly increase the performance of templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But ultimately the whole thing is still pretty mysterious. I can see three tables in the database which seem to relate to caching:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_templatecachecriteria&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_templatecacheelements&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;craft_templatecaches&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm still trying to grasp how it all ties together... If I can get a better understanding of how it all works in the &quot;big picture&quot;, it will help me to make better decisions as to when &amp;amp; where to use caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the answer is probably complex, but I'd still love to know... &lt;strong&gt;How does caching work?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-01-20T21:27:46.410" LastActivityDate="2015-01-23T15:15:58.747" Title="How does template caching work?" Tags="&lt;templating&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="6634" PostTypeId="2" ParentId="6615" CreationDate="2015-01-16T20:23:14.980" Score="5" Body="&lt;p&gt;When I'm trying to get past my initial errors, here are some of the things I try. This is assuming you have the usual directory setup, with the webroot &lt;code&gt;public&lt;/code&gt; on the same level as &lt;code&gt;craft&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create &lt;code&gt;foo.html&lt;/code&gt; in &lt;code&gt;public&lt;/code&gt;, and visit &lt;code&gt;yourdomain.com/foo.html&lt;/code&gt;. Good for mamp problems, virtual host problems, permissions problems.&lt;/li&gt;&#xA;&lt;li&gt;edit &lt;code&gt;public\index.php&lt;/code&gt; and add &lt;code&gt;die('made it to index');&lt;/code&gt; right at the top (after the &lt;code&gt;&amp;lt;php?&lt;/code&gt;). Visit &lt;code&gt;yourdomain.com&lt;/code&gt;. Good for some .htaccess problems.&lt;/li&gt;&#xA;&lt;li&gt;edit &lt;code&gt;public\index.php&lt;/code&gt; and add &lt;code&gt;die('index is about to require '.$path);&lt;/code&gt; right above the &lt;code&gt;require&lt;/code&gt; at the bottom (and of course take out the earlier &lt;code&gt;die&lt;/code&gt;). Make sure the craft path is right.&lt;/li&gt;&#xA;&lt;li&gt;edit &lt;code&gt;craft/app/index.php&lt;/code&gt; and add &lt;code&gt;die('made it to craft/app/index');&lt;/code&gt; right at the top. Can expose some php problems (open_basedir e.g.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That's usually enough to get me started.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-16T20:23:14.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6635" PostTypeId="1" CreationDate="2015-01-17T07:43:05.327" Score="1" ViewCount="1070" Body="&lt;p&gt;Hi got past the username etc screen for install but stuck on the 'oops' screen?&#xA;I've tried again and again but same deal, checked db settings just not getting past this, assuming the oops means it can't connect to the db but if the details are correct (I have a pw with its own un and pw with privs for that) and tested with root root, any ideas – seems most people are having no probs with this, then tried logging in and ok, why would it hang do you think on oops when seems to have installed?&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2016-12-23T06:15:02.763" Title="oops screen on Mamp Pro install" Tags="&lt;mamp&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6636" PostTypeId="1" AcceptedAnswerId="6637" CreationDate="2015-01-17T17:49:56.280" Score="2" ViewCount="1004" Body="&lt;p&gt;I have a simple question about Assets. I want to output some HTML around a set of image IF there is more than one image. If there is just one image I would output different HTML. I know how to do this easily within EE's Assets but not sure how to do it in Craft's Assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In EE I would use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{if photo:total_files &amp;gt; &quot;1&quot;} &amp;lt;!-- if there is more than one photo show a slideshow --&amp;gt;&#xA;&amp;lt;ul class=&quot;slider&quot;&amp;gt;&#xA;    &amp;lt;img scr=&quot;&quot;&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{if:else} &amp;lt;!-- if its just one photo show it... --&amp;gt;&#xA;    &amp;lt;img scr=&quot;&quot; class=&quot;single&quot;&amp;gt;&#xA;{/if}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I could target the first image but not sure how to construct the full conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.photos | length %}&#xA;&#xA;{% set image = entry.assetFieldHandle.first() %}&#xA;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;{{ image.getWidth() }}&quot; height=&quot;{{ image.getHeight() }}&quot;&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-01-17T19:10:55.843" Title="Assets count conditional" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6637" PostTypeId="2" ParentId="6636" CreationDate="2015-01-17T19:10:55.843" Score="8" Body="&lt;p&gt;You're close!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numberOfPhotos = entry.photos|length %}&#xA;&#xA;{% if numberOfPhotos &amp;gt; 1 %}&#xA;  {# more than one #}&#xA;{% elseif numberOfPhotos == 1 %}&#xA;  {# exactly one #}&#xA;{% else %}&#xA;  {# no photos (always handle this case...) #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-17T19:10:55.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6638" PostTypeId="1" AcceptedAnswerId="6640" CreationDate="2015-01-18T00:31:23.770" Score="5" ViewCount="3960" Body="&lt;p&gt;I've been struggling all evening with getting the urls of my singles in a menu generator. At first I thought I nailed it, but it turned out it used the title of the singles instead of the url. When I tried to get the url I an error, so clearly I'm doing something wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code to generate the menu:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# generating menu #}&#xA;&amp;lt;nav class=&quot;nav&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;hidden&quot;&amp;gt;&#xA;        {# Get all Sections #}&#xA;        {% set sections = craft.sections.getAllSections() %}&#xA;&#xA;        {# Loop through all single sections #}&#xA;        {% for singleSection in sections if singleSection.type == 'single' %}&#xA;&#xA;            {# Output #}&#xA;            &amp;lt;li class=&quot;&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ singleSection.url }}&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;link&quot;&amp;gt;{{ singleSection }}&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is the &lt;code&gt;singleSection.url&lt;/code&gt; that causes the error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft\SectionModel and its behaviors do not have a method or closure named “url”.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume the SectionModel does not have an Url, but that doesn't bring me any close to solving my problem of getting the url of single pages.&lt;/p&gt;&#xA;" OwnerUserId="1072" LastEditorUserId="57" LastEditDate="2015-01-18T19:39:47.323" LastActivityDate="2020-11-30T18:33:08.070" Title="How do I get the url of single pages?" Tags="&lt;url&gt;&lt;singles&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6639" PostTypeId="2" ParentId="6635" CreationDate="2015-01-18T00:53:37.390" Score="1" Body="&lt;p&gt;If Craft can't connect to the database, it will let you know.  Some other error is occurring. Check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for an &lt;code&gt;[error]&lt;/code&gt; entry, and that will have the error message that is occurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in between installation attempts, be sure to delete any tables that were created in the database from a previous install attempt.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-18T00:53:37.390" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6640" PostTypeId="2" ParentId="6638" CreationDate="2015-01-18T11:39:22.763" Score="7" Body="&lt;p&gt;Craft creates an EntryModel for each Single Section, that allows you to access the URL property you are after. You can get the (one) EntryModel using the Section's ID and the &lt;code&gt;first()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set singleSectionEntry = craft.entries.sectionId(singleSection.id).first() %}&#xA;&#xA;&amp;lt;a href=&quot;{{ singleSectionEntry.url }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;link&quot;&amp;gt;{{ singleSectionEntry.title }}&amp;lt;/div&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-18T11:39:22.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6641" PostTypeId="1" AcceptedAnswerId="6643" CreationDate="2015-01-18T16:10:36.657" Score="2" ViewCount="70" Body="&lt;p&gt;Is there a way to make all templates automatically private? Or do I really have to put an _ before every single one?&lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-01-18T19:03:46.750" Title="All templates automatically private" Tags="&lt;routing&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6642" PostTypeId="1" AcceptedAnswerId="6644" CreationDate="2015-01-18T17:37:16.430" Score="1" ViewCount="473" Body="&lt;p&gt;Is there a setting to get Craft to save user photos to S3 like a regular asset source?&lt;/p&gt;&#xA;" OwnerUserId="2156" LastActivityDate="2018-08-24T04:34:47.183" Title="Saving user profile photos to S3" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6643" PostTypeId="2" ParentId="6641" CreationDate="2015-01-18T19:03:46.750" Score="5" Body="&lt;p&gt;Your templates will be private if they are contained in a folder prefixed with a &quot;_&quot;... So just make a folder like that, and put everything else inside of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/templates/_everything/myprivatefile.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-01-18T19:03:46.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6644" PostTypeId="2" ParentId="6642" CreationDate="2015-01-18T19:38:54.267" Score="3" Body="&lt;p&gt;&lt;strong&gt;Craft 3 Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is currently possible in Craft 3.  Install the &lt;a href=&quot;https://github.com/craftcms/aws-s3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;AWS S3&lt;/a&gt; plugin from the Plugin Store. Make sure you're running Craft Pro.  Create a new Asset Volume using S3.  Go to Settings-&gt;Users-&gt;Settings in the Control Panel and set the &quot;User Photo Location&quot; setting to your S3 volume.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently no, although this is likely to change in the upcoming Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-08-24T04:34:47.183" LastActivityDate="2018-08-24T04:34:47.183" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6645" PostTypeId="1" AcceptedAnswerId="6646" CreationDate="2015-01-18T20:51:59.920" Score="2" ViewCount="281" Body="&lt;p&gt;I'm finding myself using matrices a good deal on my site for a specific client. My client has little experience with any content management systems, and I liked the structure matrices could provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: Instead of having them use the rich text editor, each time of content they can use on a certain page is part of a matrix field. They can add an image, then add a paragraph below, then add a pull quote, then maybe another image or paragraph etc etc. I thought this gave me a great deal of control over the styling as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm wondering if matrices have an effect on performance? I suppose I could use the rich text field, though I would have to hold my client's hand a bit more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm noticing my initial time for anything to load onto the screen is pretty poor. I've followed some steps from &lt;a href=&quot;http://www.patpohler.com/performance-optimization-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;Patrick Pohler on Craft performance optimization&lt;/a&gt;, and after the initial wait time my page loads fine, but I'm wondering if my use of matrices has something to do with my initial load time?&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2015-01-18T21:11:13.457" Title="Performance issues from matrix vs rich text?" Tags="&lt;matrix&gt;&lt;richtext&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6646" PostTypeId="2" ParentId="6645" CreationDate="2015-01-18T21:11:13.457" Score="3" Body="&lt;p&gt;Matrix does have additional overhead, but it's unlikely that it is the sole reason for any slowdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, you can see profiling information for SQL queries as well as code execution in your browser's console to try and track down where any slowness is occurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is ultimately coming from you template, you can look into the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tag to help with initial load time.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-18T21:11:13.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6647" PostTypeId="1" AcceptedAnswerId="6673" CreationDate="2015-01-19T01:47:40.837" Score="4" ViewCount="466" Body="&lt;p&gt;I'm new to Craft and have created some SEO fields &lt;a href=&quot;https://craftcms.stackexchange.com/a/2990/179&quot;&gt;similar to this&lt;/a&gt;, and the template code appears in all templates as shown below. I don't want to be repeating all that code in every template though, so I thought I'd be better of putting it in an include template (assuming that's how best to handle this in Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm getting an error when I try to do this, so can anyone show me the correct way of doing this please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my starting code, where I'm repeating the SEO code in every template (see the start and end comments):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{# START OF SEO CODE #}&#xA;{% if entry.metaTitle != '' %}&#xA;  {% set title = entry.metaTitle %}&#xA;{% else %}&#xA;  {% set title = entry.title %}&#xA;{% endif %}&#xA;&#xA;{% if entry.metaDescription != '' %}&#xA;  {% set description = entry.metaDescription %}&#xA;{% endif %}&#xA;&#xA;{% if entry.metaKeywords != '' %}&#xA;  {% set keywords = entry.metaKeywords %}&#xA;{% endif %}&#xA;{# END OF SEO CODE #}&#xA;&#xA;{% block content %}&#xA;&#xA;  &amp;lt;article class=&quot;grid-60&quot;&amp;gt;&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {{ entry.body }}&#xA;&#xA;  &amp;lt;/article&amp;gt;&amp;lt;!-- grid-60 --&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for completeness, I have the following in my _layout template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set metaTitle = globalMetadata.metaTitle %}&#xA;{% set metaDescription = globalMetadata.metaDescription %}&#xA;{% set metaKeywords = globalMetadata.metaKeywords %}&#xA;&#xA;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }}{% else %}{{ globalMetadata.metaTitle }}{% endif %} | {{ siteName }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{% if description is defined %}{{ description }}{% else %}{{ globalMetadata.metaDescription }}{% endif %}&quot; /&amp;gt;&#xA;&amp;lt;meta name=&quot;keywords&quot; content=&quot;{% if keywords is defined %}{{ keywords }}{% else %}{{ globalMetadata.metaKeywords }}{% endif %}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I've tried moving the SEO code out of the entry template, and into the following include template: _includes/seo_meta:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# START OF SEO CODE #}&#xA;{% if entry.metaTitle != '' %}&#xA;  {% set title = entry.metaTitle %}&#xA;{% else %}&#xA;  {% set title = entry.title %}&#xA;{% endif %}&#xA;&#xA;{% if entry.metaDescription != '' %}&#xA;  {% set description = entry.metaDescription %}&#xA;{% endif %}&#xA;&#xA;{% if entry.metaKeywords != '' %}&#xA;  {% set keywords = entry.metaKeywords %}&#xA;{% endif %}&#xA;{# END OF SEO CODE #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And am trying to call it from my entry template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/seo_meta&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm getting the following error message, and the error is highlighting my include line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A template that extends another one cannot have a body.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help, Stephen.&lt;/p&gt;&#xA;" OwnerUserId="179" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-01-20T00:25:57.987" Title="How to move repeating code into an include template" Tags="&lt;templating&gt;&lt;error-message&gt;&lt;include&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6648" PostTypeId="1" AcceptedAnswerId="6650" CreationDate="2015-01-19T03:05:18.447" Score="2" ViewCount="1806" Body="&lt;p&gt;How can I output a resized Assets image in a single entry template? I'm trying to do what I used to do all the time with CE Image in EE. I'm hoping that I don't have to create an image transform in the CP for every single piece of image resizing that I want to do as that would be very time consuming (compared to using the CE Image parameters for width and height in EE).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.mainImage %}&#xA;  &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for EE users, here's what I'm trying to replicate from EE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{cf_static_image}&#xA;  {exp:ce_img:single src=&quot;{url}&quot; width=&quot;800&quot; height=&quot;600&quot; alt=&quot;{alt_text}&quot;}&#xA;{/cf_static_image}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Here's what my final code looked like after following the example in the link provided by Brad below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = {&#xA;  mode: 'fit',&#xA;  width: 800,&#xA;  height: 600,&#xA;  quality: 80&#xA;} %}&#xA;&#xA;{% for asset in entry.mainImage %}&#xA;  &amp;lt;img src=&quot;{{ asset.getUrl(thumb) }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastEditorUserId="179" LastEditDate="2015-01-20T00:41:29.053" LastActivityDate="2015-01-20T00:41:29.053" Title="How to output a resized Assets image in a template" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6649" PostTypeId="1" AcceptedAnswerId="6651" CreationDate="2015-01-19T03:43:35.287" Score="1" ViewCount="382" Body="&lt;p&gt;I'm trying to write a conditional that adds a class of 'here' to a navigation menu item if segment_1 of the URL matches the URI of the entry I'm specifying. But it isn't outputting anything, so I'd appreciate any help with this, thanks. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set about_entry = craft.entries.id(17).first() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li {% if craft.request.getSegment(1) == '{{ about_entry.uri }}' %}class=&quot;here&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ about_entry.url }}&quot;&amp;gt;{{ about_entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This conditional works fine if I change '{{ about_entry.uri }}' for a hard-coded 'about', but I want the URI to be dynamic in case it gets changed in the future/&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-01-19T05:46:27.790" Title="Conditional to compare segment_1 in the URL with the URI of a specified entry" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6650" PostTypeId="2" ParentId="6648" CreationDate="2015-01-19T03:49:51.097" Score="2" Body="&lt;p&gt;You can dynamically create and specify transform parameters from your templates to achieve what you're looking for.  See &lt;a href=&quot;http://buildwithcraft.com/docs/image-transforms#defining-transforms-in-your-templates&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-19T03:49:51.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6651" PostTypeId="2" ParentId="6649" CreationDate="2015-01-19T03:56:04.343" Score="2" Body="&lt;p&gt;In Twig you'll never, ever need to nest &lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer#logic-tags&quot; rel=&quot;nofollow&quot;&gt;logic tags&lt;/a&gt;, within &lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer#output-tags&quot; rel=&quot;nofollow&quot;&gt;output tags&lt;/a&gt; or visa-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The syntax you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set about_entry = craft.entries.id(17).first() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li {% if craft.request.getSegment(1) == about_entry.uri %}class=&quot;here&quot;{% endif %}&amp;gt;&amp;lt;a href=&quot;{{ about_entry.url }}&quot;&amp;gt;{{ about_entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-01-19T05:46:27.790" LastActivityDate="2015-01-19T05:46:27.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6652" PostTypeId="2" ParentId="6647" CreationDate="2015-01-19T04:41:43.937" Score="4" Body="&lt;p&gt;That seo code will need to be in a block of its own. &#xA;Create a seo block in your _layout template and then wrap your seo code in your include template with block tags of the same name.  &lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2015-01-19T04:41:43.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6653" PostTypeId="2" ParentId="6600" CreationDate="2015-01-19T08:22:24.857" Score="4" Body="&lt;p&gt;Craft always saves a complete DateTime value to the database, even if you only make it set / show the time part of it in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To ignore the date part (which in this case is set to the day you saved your entry) within the &lt;code&gt;order&lt;/code&gt; parameter, you can make use of the &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_time&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;time()&lt;/code&gt;&lt;/a&gt; MySQL function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('events').order('eventDate', 'time(eventStart)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-19T08:22:24.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6654" PostTypeId="2" ParentId="6647" CreationDate="2015-01-19T09:41:56.413" Score="4" Body="&lt;p&gt;What I do is to handle the metadata in a macro that I call from &lt;code&gt;_layout&lt;/code&gt;, which is passed the &lt;code&gt;_context&lt;/code&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#global-variables&quot; rel=&quot;nofollow&quot;&gt;twig global variable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/_metaData' as m_metaData %}&#xA;&amp;lt;head&amp;gt;&#xA;  {{m_metaData.output(_context)}}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the content of &lt;code&gt;_macros/_metaData.html&lt;/code&gt;. The &lt;code&gt;output&lt;/code&gt; macro constructs a metaData object, based on what is in the context, and the &lt;code&gt;_printIt&lt;/code&gt; macro actually outputs the metadata.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro _printIt(m) %}&#xA;  &amp;lt;title&amp;gt;{{m.title ? m.title~' | '}}{{siteName}}&amp;lt;/title&amp;gt;&#xA;  {% if m.description %}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{m.description}}&quot;/&amp;gt;&#xA;  {% endif %}&#xA;  {% if m.keywords %}&#xA;    &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{m.keywords}}&quot;/&amp;gt;&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% macro output(context) %}&#xA;{% import _self as self %}&#xA;  {% if context.meta is defined %}&#xA;    {# if someone gave us a meta object, use that #}&#xA;    {% set metaData = context.meta %}&#xA;  {% elseif context.entry is defined %}&#xA;    {# if we have an entry, use that #}&#xA;    {% set metaData = {&#xA;      title: context.entry.metaTitle|default(context.entry.title),&#xA;      description: context.entry.metaDescription,&#xA;      keywords: context.entry.metaKeywords&#xA;    } %}&#xA;  {% else %}&#xA;    {# we got nothing #}&#xA;    {% set metaData = {&#xA;      title: '',&#xA;      description: '',&#xA;      keywords: ''&#xA;    } %}&#xA;  {% endif %}&#xA;  {{self._printIt(metaData)}}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For regular templates which have an &lt;code&gt;entry&lt;/code&gt;, I don't have to do anything in the template. If there is no entry, but there is some sensible metadata, then I can set it in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set meta = {&#xA;  title: 'some title',&#xA;  description: 'this is the meta description',&#xA;  keywords: 'meta, keywords'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if there is no &lt;code&gt;entry&lt;/code&gt;, and no &lt;code&gt;meta&lt;/code&gt; is set, I get no metadata, but no errors either.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-19T09:41:56.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6655" PostTypeId="1" AcceptedAnswerId="6827" CreationDate="2015-01-19T10:13:56.557" Score="2" ViewCount="830" Body="&lt;p&gt;I have a search form containing 1 text field and 2 checkbox groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text field is called: &lt;code&gt;keywords&lt;/code&gt; and the checkbox groups are called: &lt;code&gt;services[]&lt;/code&gt; and &lt;code&gt;locations[]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search works fine if I don't try to pagination the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to paginate the results, say I set the limit to 9 entries per page, my first page has the 9 entries listed and I get next page link to go to page 2 but when I click the next page link, I don't get the 2nd page as expected. The results have cleared? Page &quot;reset&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I paginate my form containing multiple fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already tried &lt;code&gt;craft.request.getQueryStringWithoutPath()&lt;/code&gt;, the &quot;solution&quot; in another question but it does not work for me with checkbox groups as my 2 other form fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set services = craft.categories.group(&quot;services&quot;).status(&quot;live&quot;).find() %}&#xA;{% set locations = craft.categories.group(&quot;locations&quot;).status(&quot;live&quot;).find() %}&#xA;&#xA;{% set queryKeywords = craft.request.getParam(&quot;keywords&quot;) | trim %}&#xA;{% set queryServices = craft.request.getParam(&quot;services&quot;) %}&#xA;{% set queryLocations = craft.request.getParam(&quot;locations&quot;) %}&#xA;&#xA;&amp;lt;form action=&quot;&quot; method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;keywords&quot; value=&quot;&quot;&amp;gt;&#xA;    {% if services | length %}&#xA;        {% for service in services %}&#xA;        &amp;lt;label&amp;gt;{{ service.title }}&amp;lt;input type=&quot;checkbox&quot; name=&quot;services[]&quot; value=&quot;{{ service.slug }}&quot; /&amp;gt;&amp;lt;/label&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;    {% if locations | length %}&#xA;        {% for location in locations %}&#xA;        &amp;lt;label&amp;gt;{{ location.title }} &amp;lt;input type=&quot;checkbox&quot; name=&quot;locations[]&quot; value=&quot;{{ location.slug }}&quot;/&amp;gt;&amp;lt;/label&amp;gt;                                     &#xA;        {% endfor %}&#xA;    {% endif %}&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Refine&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;{% set originalKeywords = craft.request.getParam(&quot;keywords&quot;) | trim %}&#xA;{% set keywords = originalKeywords | replace({ &quot;*&quot; : &quot;&quot; }) %}&#xA;{% set services = craft.request.getParam(&quot;services&quot;) %}&#xA;{% set locations = craft.request.getParam(&quot;locations&quot;) %}&#xA;&#xA;{% if (keywords | length) or (services | length) or (locations | length) %}&#xA;    {% set relatedTo = [&quot;and&quot;] %}&#xA;&#xA;&#xA;    {% set serviceCategoryIds = [] %}&#xA;    {% set locationCategoryIds = [] %}&#xA;&#xA;&#xA;    {% set serviceCategories = craft.categories.group(&quot;services&quot;) %}&#xA;    {% set locationCategories = craft.categories.group(&quot;locations&quot;) %}&#xA;&#xA;&#xA;    {% set servicesCategories = services | join(&quot;, &quot;) | trim %}&#xA;    {% if services | length %}&#xA;        {% for service in services %}&#xA;            {% set serviceCategoryIds = serviceCategories.slug(servicesCategories).ids() %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;    {% if serviceCategoryIds | length %}&#xA;        {% for serviceCategoryId in serviceCategoryIds %}&#xA;            {% set relatedTo = relatedTo | merge([serviceCategoryId]) %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;&#xA;    {% set locationsCategories = locations | join(&quot;, &quot;) | trim %}&#xA;    {% if locations | length %}&#xA;        {% for location in locations %}&#xA;            {% set locationCategoryIds = locationCategories.slug(locationsCategories).ids() %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;    {% if locationCategoryIds | length %}&#xA;        {% for locationCategoryId in locationCategoryIds %}&#xA;            {% set relatedTo = relatedTo | merge([locationCategoryId]) %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;&#xA;    {% set keywords = &quot;*&quot; ~ keywords | replace({ &quot; &quot; : &quot;* *&quot; }) ~ &quot;*&quot; %}&#xA;&#xA;&#xA;    {% set allMembers = craft.users.group(&quot;members&quot;).status(&quot;live&quot;).search(keywords).order(&quot;score&quot;) %}&#xA;&#xA;&#xA;    {% if (relatedTo | length) &amp;gt; 1 %}&#xA;        {% set allMembers = allMembers.relatedTo(relatedTo) %}&#xA;    {% endif %}&#xA;&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ allMembers | length }} Result{% if (allMembers | length) == 1 %}{% else %}s{% endif %}&amp;lt;/h3&amp;gt;&#xA;&#xA;&#xA;    {% if allMembers | length %}&#xA;        {% paginate allMembers as members %}&#xA;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for member in members %}&#xA;                &amp;lt;li&amp;gt;{{ member.fullName }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;            {% if paginate.totalPages &amp;gt; 1 %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.firstUrl }}&quot; title=&quot;First Page&quot;&amp;gt;&amp;amp;laquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% if paginate.prevUrl %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; title=&quot;Previous Page&quot;&amp;gt;&amp;amp;lsaquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;                {% for page, url in paginate.getPrevUrls(4) %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot; title=&quot;Page {{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;li class=&quot;current&quot;&amp;gt;&amp;lt;a href=&quot;&quot; title=&quot;Page {{ paginate.currentPage }}&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% for page, url in paginate.getNextUrls(4) %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot; title=&quot;Page {{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;                {% if paginate.nextUrl %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; title=&quot;Next Page&quot;&amp;gt;&amp;amp;rsaquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.lastUrl }}&quot; title=&quot;Last Page&quot;&amp;gt;&amp;amp;raquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {% endpaginate %}&#xA;&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Your search didn&amp;amp;#39;t return any members.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastEditorUserId="170" LastEditDate="2015-01-27T11:08:16.780" LastActivityDate="2015-01-27T18:34:06.270" Title="Search Results Pagination with multiple form fields" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6657" PostTypeId="1" CreationDate="2015-01-19T11:49:41.627" Score="2" ViewCount="177" Body="&lt;p&gt;I realise this is probably a duplicate of the other questions just like it but I thought I'd raise it here before filing a bug with P&amp;amp;T. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, when a new entry is added to a section, the template cache isn't invalidating. Here is the template in question, is there anything in the code that would cause this? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% extends &quot;_layouts/two-col&quot; %}&#xA;&#xA;    {% block main %}&#xA;&#xA;        {% cache unless not craft.config.cache %}&#xA;&#xA;        {{entry.body}} &#xA;&#xA;        {% set cutoffDate = now|date_modify('- ' ~ '1' ~ ' days') %}&#xA;        {% set events = craft.entries.section('whatsOn').order('dateStart') %}&#xA;&#xA;        {% set eventIds = [] %}&#xA;        {% for event in events if (event.dateEnd ? event.dateEnd : event.dateStart) &amp;gt;= cutoffDate %}&#xA;          {% set eventIds = eventIds|merge([event.id]) %}&#xA;        {% endfor %}&#xA;&#xA;        {% set allEvents = craft.entries.id(eventIds).fixedOrder('true') %}&#xA;&#xA;        {% paginate allEvents.limit(12) as events %}&#xA;&#xA;        &amp;lt;ul class=&quot;list list--articles&quot;&amp;gt;&#xA;&#xA;            {% for event in events %}&#xA;&#xA;                &amp;lt;li class=&quot;item&quot; itemscope itemtype=&quot;http://schema.org/Event&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;header class=&quot;item__header&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;item__meta&quot;&amp;gt;&#xA;&#xA;                            &amp;lt;time itemprop=&quot;startDate&quot; content=&quot;{{event.dateStart}}&quot; datetime=&quot;{{event.dateStart}}&quot;&amp;gt;{{event.dateStart|date(&quot;jS F Y&quot;)}}&amp;lt;/time&amp;gt;&#xA;&#xA;                            {% if event.dateEnd|length %}&#xA;                                — &amp;lt;time itemprop=&quot;endDate&quot; content=&quot;{{event.dateStart}}&quot; datetime=&quot;{{event.dateStart}}&quot;&amp;gt;{{event.dateEnd|date(&quot;jS F Y&quot;)}}&amp;lt;/time&amp;gt;&#xA;                            {% endif %}&#xA;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                        &amp;lt;h3 class=&quot;item__title h4&quot; itemprop=&quot;name&quot;&amp;gt;&amp;lt;a href=&quot;{{ event.url }}&quot; class=&quot;&quot;&amp;gt;{{ event.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;item__type&quot;&amp;gt;&#xA;                            &amp;lt;span class=&quot;tag tag--{{event.eventType|slugify}}&quot;&amp;gt;{{event.eventType}}&amp;lt;/span&amp;gt;&#xA;                            &amp;lt;span itemprop=&quot;location&quot; itemscope itemtype=&quot;http://schema.org/Place&quot;&amp;gt; {{event.location}}&amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                    &amp;lt;/header&amp;gt;&#xA;&#xA;                    &amp;lt;div class=&quot;item__description&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ event.url }}&quot;&amp;gt;Find out more&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;/li&amp;gt;&#xA;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;        {% if paginate.totalPages &amp;gt; 1 %}&#xA;&#xA;            &amp;lt;nav class=&quot;nav nav--pagination&quot;&amp;gt;&#xA;&#xA;                &amp;lt;ul class=&quot;nav__list&quot;&amp;gt;&#xA;&#xA;                {# &amp;lt;a href=&quot;{{ paginate.firstUrl }}&quot;&amp;gt;First Page&amp;lt;/a&amp;gt; #}&#xA;            {# {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %} #}&#xA;&#xA;            {% for page, url in paginate.getPrevUrls(5) %}&#xA;              &amp;lt;li class=&quot;nav__item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;nav__link&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;li class=&quot;nav__item nav__item--active&quot;&amp;gt;&amp;lt;span class=&quot;nav__link&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;            {% for page, url in paginate.getNextUrls(5) %}&#xA;                &amp;lt;li class=&quot;nav__item&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;nav__link&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;           {#  {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;            &amp;lt;a href=&quot;{{ paginate.lastUrl }}&quot;&amp;gt;Last Page&amp;lt;/a&amp;gt; #}&#xA;&#xA;                &amp;lt;/ul&amp;gt;&#xA;&#xA;            &amp;lt;/nav&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;        {% endpaginate %}&#xA;&#xA;        {% endcache %}  &#xA;&#xA;    {% endblock %}&#xA;&#xA;    {% block sidebar %}&#xA;&#xA;        {% include '_partials/newsletter-signup' with { grid:'false' } %}&#xA;&#xA;        {% include '_partials/social' %}&#xA;&#xA;    {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this all looks normal, I guess it is a bug with Craft?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-01-19T11:49:41.627" Title="Cache not invalidating when new entry is created" Tags="&lt;cache&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6658" PostTypeId="1" CreationDate="2015-01-19T12:15:46.910" Score="1" ViewCount="662" Body="&lt;p&gt;I'm using Craft Pro 2.3.2625&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to write a command-line called script which can call Craft's functions (to create new entries with assets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on Brandon's updated answer here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/608/bootstrap-craft-from-another-app&quot;&gt;Bootstrap Craft from another app&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require 'craft/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in a standalone script should just work after Craft 2.2 - but doing so gives me the following errors (paths tweaked to remove project name):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Notice:  Undefined index: SERVER_NAME in craft/app/bootstrap.php on line 105&#xA;&#xA;Notice: Undefined index: SERVER_NAME in craft/app/bootstrap.php on line 105&#xA;&#xA;Notice: Undefined property: Craft\WebApp::$request in craft/app/controllers/TemplatesController.php on line 156&#xA;&#xA;Fatal error: Call to a member function isSiteRequest() on a non-object in craft/app/controllers/TemplatesController.php on line 156&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="900" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-01-19T19:09:32.627" Title="Bootstrapping Craft gives fatal error" Tags="&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6659" PostTypeId="2" ParentId="6647" CreationDate="2015-01-19T13:12:06.250" Score="2" Body="&lt;p&gt;Another little thing to consider, instead of using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaDescription != '' %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which effectively means 'if this field is not equal to nothing', try using Twigs &lt;code&gt;|length&lt;/code&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot; rel=&quot;nofollow&quot;&gt;filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaDescription|length %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But yes to answer your question, since1976 has already said it but you will just need to wrap your SEO code (from &lt;code&gt;{# START OF SEO CODE #}&lt;/code&gt; to &lt;code&gt;{# END OF SEO CODE #}&lt;/code&gt;) in a block, and then add that block to the template you are including.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-01-19T13:12:06.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6660" PostTypeId="1" CreationDate="2015-01-19T14:22:38.320" Score="1" ViewCount="586" Body="&lt;p&gt;I'm getting mixed results when using a lightswitch field together with &lt;strong&gt;order('RAND()')&lt;/strong&gt; and I wonder if I'm doing something wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this code gives me the correct results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('section').lightSwitchField('1').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... but this selects entries from all entries in my channel instead of just the ones with the lightswitch field switched on.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('section').lightSwitchField('1').order('RAND()').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-01-19T15:01:27.413" Title="How can I get a lightswitch to work with order() in craft.entries?" Tags="&lt;entries&gt;&lt;field&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6661" PostTypeId="2" ParentId="6660" CreationDate="2015-01-19T14:44:07.720" Score="1" Body="&lt;p&gt;Instead of using &lt;code&gt;.first()&lt;/code&gt; try using &lt;code&gt;.limit()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('section').lightSwitchField('1').order('RAND()').limit(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have just ran a test and this is working fine for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using this code without any errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('lorem').lightSwitchField('1').order('RAND()').first %}&#xA;&#xA;{% if entry|length %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-01-19T15:01:27.413" LastActivityDate="2015-01-19T15:01:27.413" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6662" PostTypeId="1" AcceptedAnswerId="6894" CreationDate="2015-01-19T17:43:02.740" Score="1" ViewCount="711" Body="&lt;p&gt;I need to automatically set the expire date of a new entry (only) from a specific section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that it's possible to do this via the frontend twig templates, however I need the user to have the flexibility to change the date from the default that's set if they want to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when they create a new entry it'll have an expiration date of today + 3 months, but if they wanted they could change this date to next Wednesday or whatever they wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2015-05-13T15:58:59.837" Title="Auto Expire on entries" Tags="&lt;entry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6663" PostTypeId="1" CreationDate="2015-01-19T18:16:02.210" Score="2" ViewCount="107" Body="&lt;p&gt;I just switched my company's website to Craft, and I have a lot of already existing static webpages that I would rather not remake as templates and define routes for. I have a single page made in Craft at /events, but when I add the subdirectory events/event-name, going to /events presents a 403 error. I know why this is happening, because of the way Craft handles routing, but is there any way (possibly in my .htaccess file) for going to /events to deliver the single page like normal, despite having the subdirectory in my public folder? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="2199" LastEditorUserId="125" LastEditDate="2015-05-29T15:01:32.937" LastActivityDate="2015-05-29T15:01:32.937" Title="Have Craft deliver single page despite having a directory of the same name in the public folder?" Tags="&lt;routing&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6664" PostTypeId="2" ParentId="6658" CreationDate="2015-01-19T19:09:32.627" Score="3" Body="&lt;p&gt;That bootstrap file is only meant to be used by web applications. Even if you got past this error, the file is still going to give you a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;WebApp&lt;/a&gt; instance, when what you really want to be working with in that environment is a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/console/ConsoleApp&quot; rel=&quot;nofollow&quot;&gt;ConsoleApp&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to load Craft from the command line, use craft/app/etc/console/yiic instead (make sure it has executable permissions), or if you already have a PHP script running, load yiic.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately those files don’t work like bootstrap.php though - they will not only instantiate a ConsoleApp instance, they’ll &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#run-detail&quot; rel=&quot;nofollow&quot;&gt;run it&lt;/a&gt; as well. So you would need to provide your own functionality through a plugin that adds custom &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/topics.console#creating-commands&quot; rel=&quot;nofollow&quot;&gt;console commands&lt;/a&gt;. You would do that by creating a &lt;code&gt;consolecommands&lt;/code&gt; folder in your plugin folder, with files inside it that end with &lt;code&gt;Command.php&lt;/code&gt; (e.g. &lt;code&gt;MyPlugin_UtilsCommand.php&lt;/code&gt;) and a matching class name, which extends &lt;a href=&quot;http://buildwithcraft.com/classreference/consolecommands/BaseCommand&quot; rel=&quot;nofollow&quot;&gt;BaseCommand&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details about how to write the class are available from &lt;a href=&quot;http://buildwithcraft.com/classreference/consolecommands/BaseCommand&quot; rel=&quot;nofollow&quot;&gt;BaseCommand’s class reference&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-19T19:09:32.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6665" PostTypeId="1" CreationDate="2015-01-19T19:22:13.153" Score="1" ViewCount="299" Body="&lt;p&gt;I have a front-end entry form using the Guest Entries plugin, with a file input for the user to upload a photo. I am also using the jQuery Form plugin for AJAX submission, but the behavior is the same if I disable it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form works great with small file sizes, but if the uploaded image is larger than PHP's &lt;code&gt;upload_max_filesize&lt;/code&gt;, I get a fatal error: &lt;code&gt;Imagine\Exception\RuntimeException: Unable to open image&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the uploaded file is larger than PHP's &lt;code&gt;post_max_size&lt;/code&gt;, the page simply reloads - no error is registered. I gather that this error can be difficult to catch, so maybe it's impossible to have a more graceful failure in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for file sizes between upload_max_filesize and post_max_size, shouldn't there be a way to return that as a proper error in the errors array, instead of dying in a way that is unhelpful to the end user?&lt;/p&gt;&#xA;" OwnerUserId="62" LastEditorUserId="62" LastEditDate="2015-01-19T20:12:57.673" LastActivityDate="2015-02-19T00:17:18.347" Title="Catch file-size errors in Guest Entries Form" Tags="&lt;upload&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6666" PostTypeId="2" ParentId="6665" CreationDate="2015-01-19T19:30:55.250" Score="1" Body="&lt;p&gt;What's probably happening on both of your cases is a PHP fatal error, which are notoriously difficult to recover from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upcoming Craft 3 (thanks to some clever tricks in Yii 2), however does handle fatal PHP error much better and in situations like yours, you would be receiving the actually underlying fatal error message.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-01-19T23:31:41.323" LastActivityDate="2015-01-19T23:31:41.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6667" PostTypeId="1" CreationDate="2015-01-19T19:54:40.637" Score="9" ViewCount="1571" Body="&lt;p&gt;I am considering having my site moved from WordPress to Craft CMS (feel free, by all means, to weigh in on this consideration), and wondered how one goes about setting up automatic backups within Craft. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2200" LastActivityDate="2015-01-19T23:17:59.160" Title="How do you set up Craft CMS to back up your site automatically?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6668" PostTypeId="1" AcceptedAnswerId="6674" CreationDate="2015-01-19T21:16:15.600" Score="2" ViewCount="2110" Body="&lt;p&gt;I have created a Structure page 'Products' with a URL of '/products' so that I can write a description etc, but then I would also like to pull in the Products into the template. I'm a little unsure on how best to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Sections are created as follows;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page&lt;br&gt;&#xA;Handle: page&lt;br&gt;&#xA;Type: Structure&lt;br&gt;&#xA;URL Format: {slug}&lt;br&gt;&#xA;Entry Template: page/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Product&lt;br&gt;&#xA;Handle: product&lt;br&gt;&#xA;Type: Channel&lt;br&gt;&#xA;URL Format: products/{slug}&lt;br&gt;&#xA;Entry Template: products/_product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ExpressionEngine I would have pulled in a Channel entries tag for the page and then another entries tag for the products.&lt;/p&gt;&#xA;" OwnerUserId="679" LastEditorUserId="679" LastEditDate="2015-01-19T21:27:48.163" LastActivityDate="2015-01-20T08:25:26.643" Title="Create a Structure page with entries list" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6669" PostTypeId="2" ParentId="6668" CreationDate="2015-01-19T21:22:17.940" Score="1" Body="&lt;p&gt;If your channel is &lt;code&gt;products&lt;/code&gt;, you list them like this on their index page (which is presumably your '/products' page)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for p in craft.entries.section('products') %}&#xA;  {# p is our product. display it however #}&#xA;  {{p.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-19T21:22:17.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6670" PostTypeId="1" AcceptedAnswerId="6672" CreationDate="2015-01-19T21:48:23.517" Score="0" ViewCount="252" Body="&lt;p&gt;In my plugin I need to loop through an entry's fields and if that field is a field type of &quot;Categories&quot; use that entry field value/s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have tried so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(array_key_exists('byCategory', $filterAttributes))&#xA;{&#xA;  foreach ($entry-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $key) &#xA;  {&#xA;      $field = $key-&amp;gt;getField();&#xA;      if($field-&amp;gt;type == &quot;Categories&quot;){&#xA;&#xA;         if(!$this-&amp;gt;addFilterdCategories($field,$filterAttributes))&#xA;         {&#xA;             continue;&#xA;         }&#xA;      }&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-01-19T22:59:06.487" LastActivityDate="2015-01-19T23:57:53.290" Title="Loop through an entry's fields and if the field type is &quot;Categories&quot; get that fields value/s" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6671" PostTypeId="2" ParentId="6667" CreationDate="2015-01-19T23:17:59.160" Score="11" Body="&lt;p&gt;Options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Craft will automatically run a backup of the database anytime an update is performed and save it to &lt;code&gt;craft/storage/backups&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You can manually create a database backup by going to Settings-&gt;Tools-&gt;Create Database Backup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) You can install something like the &lt;a href=&quot;https://github.com/putyourlightson/Craft-Dump&quot;&gt;Dump&lt;/a&gt; plugin and create a cron job that points to it to run the backup on a automated schedule.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-19T23:17:59.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6672" PostTypeId="2" ParentId="6670" CreationDate="2015-01-19T23:57:53.290" Score="2" Body="&lt;p&gt;I believe I have found the answer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(array_key_exists('byCategory', $filterAttributes))&#xA;{&#xA;  foreach ($entry-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $key) &#xA;  {&#xA;      $field = $key-&amp;gt;getField();&#xA;      if($field-&amp;gt;type == &quot;Categories&quot;){&#xA;&#xA;         if(!$this-&amp;gt;addFilterdCategories($entry[$field-&amp;gt;handle],$filterAttributes))&#xA;         {&#xA;             continue;&#xA;         }&#xA;      }&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-01-19T23:57:53.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6673" PostTypeId="2" ParentId="6647" CreationDate="2015-01-20T00:25:57.987" Score="3" Body="&lt;p&gt;I was speaking with Andy Harris on IM earlier, and he told me that there was no need to pass the meta data from the entry template to the layout template. Instead, he said I can just put the metadata code straight into the layout template, and it would parse for the individual entries (I had it in my head that I had to pass this information from the entry template to the layout template).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I no longer have meta code repeated in each template, and instead, I just have the following in my _layout.html template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaTitle %}&#xA;  &amp;lt;title&amp;gt;{{ entry.metaTitle }} | {{ siteName }}&amp;lt;/title&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;title&amp;gt;{{ entry.title }} | {{ siteName }}&amp;lt;/title&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if entry.metaDescription %}&#xA;  &amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot; /&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;meta name=&quot;description&quot; content=&quot;{{ globalMetadata.metaDescription }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if entry.metaKeywords %}&#xA;  &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ entry.metaKeywords }}&quot; /&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ globalMetadata.metaKeywords }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-01-20T00:25:57.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6674" PostTypeId="2" ParentId="6668" CreationDate="2015-01-20T00:59:15.700" Score="1" Body="&lt;p&gt;There are a few ways to deal with this, but it really depends on how you have the rest of your sections set up. If the structure is exclusively products with only a single root level item called &quot;products&quot; then I would probably suggest storing content for the products overview page somewhere else. This will greatly simplify your products structure (you could even change it to a 'channel' if there is no other reason for the hierarchy). Where you decide to store the product index/overview info is up to you. You could, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;create a single called &quot;products&quot; (with uri '/products'), or &lt;/li&gt;&#xA;&lt;li&gt;add it to the &quot;pages&quot; structure as &quot;products&quot; (with a custom Entry Type &quot;products&quot;), or &lt;/li&gt;&#xA;&lt;li&gt;create a template &quot;products/_index.html&quot; with description fields, etc. stored in a global set called &quot;productsDescription&quot; (or whatever you like).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Whichever way you choose the product index page will still be &quot;/products/&quot; and the product detail pages will still be &quot;/products/product-slug/&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do decide to place the products overview in the &quot;pages&quot; section, for example, you can just check for the entry type using a conditional or &lt;code&gt;switch&lt;/code&gt; statement (within the 'page/_entry.html' template), like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == &quot;products&quot; %}&#xA;    {# display products index page template here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However you decide to do it, you can load the actual products like so (as Marion suggested above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for product in craft.entries.section('product') %}&#xA;    {{ product.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="125" LastEditDate="2015-01-20T08:25:26.643" LastActivityDate="2015-01-20T08:25:26.643" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6675" PostTypeId="1" AcceptedAnswerId="6676" CreationDate="2015-01-20T01:06:44.787" Score="3" ViewCount="1703" Body="&lt;p&gt;I'm trying to output an Asset image if the Main Image field is populated, and if it's not populated, I'd like to output a placeholder image. But I'm having problems getting the conditional to work - it outputs the image in the Assets field, but when the field is empty, it's not outputting the placeholder image. Any ideas on what I'm doing wrong here? Thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.mainImage %}&#xA;  {% for asset in entry.mainImage %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;  {% endfor %}&#xA;{% else %}&#xA;  &amp;lt;img src=&quot;http://placehold.it/130x130/f5f5f5/ccc.png&quot; height=&quot;130&quot; width=&quot;130&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2020-03-29T11:33:00.983" Title="How to output a placeholder image if an Assets field is empty" Tags="&lt;templating&gt;&lt;assets&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6676" PostTypeId="2" ParentId="6675" CreationDate="2015-01-20T01:34:21.087" Score="7" Body="&lt;p&gt;Thanks to Brad for the answer, and the solution was to use &lt;code&gt;{% if entry.mainImage|length %}&lt;/code&gt; instead of &lt;code&gt;{% if entry.mainImage %}&lt;/code&gt; for the conditional. So my working code looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.mainImage|length %}&#xA;  {% for asset in entry.mainImage %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;  {% endfor %}&#xA;{% else %}&#xA;  &amp;lt;img src=&quot;http://placehold.it/130x130/f5f5f5/ccc.png&quot; height=&quot;130&quot; width=&quot;130&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-01-20T01:34:21.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6677" PostTypeId="1" AcceptedAnswerId="6678" CreationDate="2015-01-20T02:14:06.327" Score="1" ViewCount="1099" Body="&lt;p&gt;Is it possible to get an entry title and URI from a segment? e.g. If segment 1 has a value of 'about', I'd want to output an entry title of 'About Us', and a URI of 'mysite.com/about', and so on for other segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to code up a breadcrumb menu, and my site has a mixture of Singles, Structures and Channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following _includes/nav_breadcrumb.html template, but I'm hard-coding everything at the moment (and only have it one level deep) so it's not going to be sustainable to keep this up-to-date on anything but the smallest of static sites, hence why I'm wondering about being able to pull in entry details via the segments. Thanks for any help with this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt; &amp;amp;raquo;&#xA;&#xA;{% if craft.request.getSegment(1) == 'about' %}&#xA;  &amp;lt;a href=&quot;{{ siteUrl }}about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&#xA;&#xA;{% elseif craft.request.getSegment(1) == 'news' %}&#xA;  &amp;lt;a href=&quot;{{ siteUrl }}news&quot;&amp;gt;News&amp;lt;/a&amp;gt;&#xA;&#xA;{% elseif craft.request.getSegment(1) == 'contact' %}&#xA;  &amp;lt;a href=&quot;{{ siteUrl }}contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-01-20T06:04:57.760" Title="How to get an entry title and URI from a segment in order to create a breadcrumb navigation" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6678" PostTypeId="2" ParentId="6677" CreationDate="2015-01-20T05:37:51.833" Score="3" Body="&lt;p&gt;If your site is mixture of singles, structures and channels then there is no easy way to get the entry titles and or uris from the segments alone. You would have to add some logic based on your known site structure. And even then, you might need to make a lot of requests to retrieve the data. You would likely need to do a combination of static logic, looking up titles and uris based on section/handle, and looping through ancestors within a structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially use the segments themselves, if you where confident that the slugs always matched the titles (or were close enough), and that the uri's where all valid.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segmentUri = &quot;/&quot; %}&#xA;{% for segment in craft.request.segments %}&#xA;    {% set segmentUri = segmentUri ~ &quot;/&quot; ~ segment %}&#xA;    &amp;lt;a href=&quot;segmentUri&quot;&amp;gt;{{ segment|replace('-',' ')|ucwords }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is also another technique that involves defining the breadcrumb using an entries field on the entry itself that you might consider — which is described in the documentation on &lt;a href=&quot;http://buildwithcraft.com/help/breadcrumbs&quot; rel=&quot;nofollow&quot;&gt;How to create Breadcrumbs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-20T06:04:57.760" LastActivityDate="2015-01-20T06:04:57.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6680" PostTypeId="1" CreationDate="2015-01-20T07:10:33.257" Score="3" ViewCount="291" Body="&lt;p&gt;Just have a question on the way way to approach this: I have entire sections of a website that are per city and the number of cities might grow. I plan to create a city category and add the cities to it, then those cities appear when people add content. Then in the front-end, get those categories into a list and show them so a user can select them. Once selected it would write it to a cookie or localStorage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I organise my content via url like /newyork/ and it would pick up the URL and fetch that data? Or when I visit the site and I have localStorage set, it would redirect me to /mychosencity/ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just trying for the fastest, most efficient way both in terms of redirecting, but also implementing per city content on a whole site as well as in the templates.&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2015-01-21T08:35:20.873" Title="Show content based on chosen city" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6681" PostTypeId="1" AcceptedAnswerId="6692" CreationDate="2015-01-20T09:44:02.417" Score="2" ViewCount="177" Body="&lt;p&gt;A definitive description of the client account would be useful for this. What does a client account get? For example, can they clear the cache?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can login and find this out myself, but it would be helpful to have a go-to article on this for future reference.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-01-20T18:48:19.133" Title="On Craft Client, what does the client account get?" Tags="&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6682" PostTypeId="1" AcceptedAnswerId="6691" CreationDate="2015-01-20T10:05:19.033" Score="1" ViewCount="134" Body="&lt;p&gt;In the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#usage&quot; rel=&quot;nofollow&quot;&gt;Contactform plugin page&lt;/a&gt; there's a code example that's confusing me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only the email and message are required in the code, but the fromName field does have an error syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the use of the getErrors here? I've tried using rare characters, but no errors?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2015-01-20T17:09:22.447" Title="P&amp;T Contacform plugin: what's the use of the errors if fields are not required?" Tags="&lt;plugin-contactform&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6683" PostTypeId="1" CreationDate="2015-01-20T12:27:05.490" Score="6" ViewCount="477" Body="&lt;p&gt;Hi,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft and VERY new to plugin development.  I'd like to display a thumbnail image in my table list view and thought it would be possible to accomplish using a new Custom Element Type.  Does anybody know how to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have managed to output custom fields in the table using defineTableAttributes() but I can't output any related Assets - in particular their filenames. Do I need to define a relation in the ElementCriteriaModel using the defineCriteriaAttributes() function?  Can anyone explain how this is done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="2205" LastActivityDate="2015-01-22T16:29:23.123" Title="Display thumbnail using defineTableAttributes for a custom Element Type" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6684" PostTypeId="1" CreationDate="2015-01-20T12:54:02.780" Score="3" ViewCount="390" Body="&lt;p&gt;I'd like to add the Text extension: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/index.html#extensions-install&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/extensions/index.html#extensions-install&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which seems very useful because of the truncate functionality. Any idea on how to accomplish this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(this could've been installed by default)&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2015-02-01T02:01:00.423" Title="How to get the Twig Text extension loaded" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6686" PostTypeId="1" AcceptedAnswerId="6687" CreationDate="2015-01-20T13:22:34.840" Score="0" ViewCount="177" Body="&lt;p&gt;I've hooked up search and if I run a query on 'Second Presbyterian' for example, I get the expected return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I search for 'Second Pres' I get nothing coming back as a partial match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why would this be?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-01-20T13:56:38.637" Title="search result criteria" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6687" PostTypeId="2" ParentId="6686" CreationDate="2015-01-20T13:56:38.637" Score="2" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;Searching&lt;/a&gt; article in the Docs. If you want to list all entries containing a word that begins with &quot;Second Pres&quot;, you have to use this search term &quot;Second Pres*&quot;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-20T13:56:38.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6689" PostTypeId="1" AcceptedAnswerId="6690" CreationDate="2015-01-20T16:41:10.017" Score="1" ViewCount="423" Body="&lt;p&gt;I have this in my edit form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('jobCategory') %}&#xA;    &amp;lt;label for=&quot;fields[jobCategory]&quot;&amp;gt;Job Category:&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select id=&quot;jobCategory&quot; name=&quot;fields[jobCategory]&quot;&amp;gt;&#xA;        {% for category in categories %}&#xA;            &amp;lt;option value=&quot;{{ category.id }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but can't for the life of me, show select as 'selected' for the category the entry belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Missing something simple I'm sure.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-01-20T17:52:48.823" Title="frontend editing, show selected category" Tags="&lt;categories&gt;&lt;frontend&gt;&lt;category&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6690" PostTypeId="2" ParentId="6689" CreationDate="2015-01-20T17:03:28.400" Score="2" Body="&lt;p&gt;Something like the following should work. This assumes that your category field handle is 'jobCategory', and has a limit set to 1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('jobCategory') %}&#xA;{% set entryCategory = entry.jobCategory.first %}&#xA;&amp;lt;label for=&quot;fields[jobCategory]&quot;&amp;gt;Job Category:&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;jobCategory&quot; name=&quot;fields[jobCategory]&quot;&amp;gt;&#xA;    {% for category in categories %}&#xA;        &amp;lt;option value=&quot;{{ category.id }}&quot; {% if category.title == entryCategory %}selected{% endif %}&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="57" LastEditDate="2015-01-20T17:52:48.823" LastActivityDate="2015-01-20T17:52:48.823" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6691" PostTypeId="2" ParentId="6682" CreationDate="2015-01-20T17:09:22.447" Score="2" Body="&lt;p&gt;In the ContactFormModel you can manage the attribute 'required' =&gt; true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example just show how to use the getErrors for each field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can delete the ones you dont need.&lt;/p&gt;&#xA;" OwnerUserId="2183" LastActivityDate="2015-01-20T17:09:22.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6692" PostTypeId="2" ParentId="6681" CreationDate="2015-01-20T17:47:14.493" Score="3" Body="&lt;p&gt;From &lt;a href=&quot;http://buildwithcraft.com/docs/users#clients-account&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Client’s Account is not an Admin account like yours, so they will not be able to access the Settings section or administrate your Admin account. They’ll be able to do everything else, though.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2015-01-20T18:48:19.133" LastActivityDate="2015-01-20T18:48:19.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6693" PostTypeId="1" AcceptedAnswerId="6694" CreationDate="2015-01-20T18:00:41.433" Score="1" ViewCount="176" Body="&lt;p&gt;I created a custom field type to show user groups in a checkbox layout, e.g. (&lt;a href=&quot;http://cl.ly/image/0A1a140m031h&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/image/0A1a140m031h&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running into one small issue. If I add content with a checkbox(s) option selected and save the entry. Then I try to edit the entry and uncheck all the options, the entry will still have the original checkbox options selected and won't return to the null state as expected. I was trying to use prepValueFromPost but that doesn't seem to run unless the value is set. How do I fix this?&lt;/p&gt;&#xA;" OwnerUserId="2207" LastActivityDate="2019-12-03T17:09:26.630" Title="Custom Fieldtype with Checkboxes - Remove value and set to null when checkboxes are left blank" Tags="&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6694" PostTypeId="2" ParentId="6693" CreationDate="2015-01-20T18:17:38.513" Score="1" Body="&lt;p&gt;This isn't really an answer. But I think I do know what might be happening. The default browser behavior is that checkbox values only get submitted when it has the attribute 'checked' (why? I have no idea). In php you're essentially testing whether the post value exists or not. If it exists, true; if not, false. I assume for the built-in checkbox fieldtype that craft does this for you in the background (by somehow comparing with the original options). You'll have to figure out a way to perform this check yourself. Maybe take a look at the source files and see how craft is handling this.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-20T18:17:38.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6695" PostTypeId="1" CreationDate="2015-01-20T18:19:47.477" Score="0" ViewCount="50" Body="&lt;p&gt;i want to develop a windows phone application and receive notification from my CMS opencart &#xA;So to send notification from my CMS, i must develop a module !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what's the steps can i follow to develop module for send notification from CMS OP to windows phone application?&lt;/p&gt;&#xA;" OwnerUserId="2208" LastEditorUserId="45" LastEditDate="2016-08-13T02:59:30.343" LastActivityDate="2016-08-13T02:59:30.343" Title="what's the steps can i follow to develop module for send notification from CMS OP to windows phone application?" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2015-01-20T18:46:17.707" ContentLicense="CC BY-SA 3.0" />
  <row Id="6696" PostTypeId="2" ParentId="6631" CreationDate="2015-01-20T18:22:55.877" Score="5" Body="&lt;p&gt;You could add new pseudo localization files to Craft &lt;code&gt;craft/app/framework/i18n/data/&lt;/code&gt; and rename (translate) the name of your &quot;language&quot; and other things in these files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd use &lt;code&gt;en.php&lt;/code&gt; as a starting point and save it as &lt;code&gt;en_custom.php&lt;/code&gt;. Then add a new key/value pair &lt;code&gt;'en_custom' =&amp;gt; 'My Custom Country'&lt;/code&gt; to the &lt;code&gt;languages&lt;/code&gt; array (line 205 ff.), which is responsible for the translation of the language names.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-20T18:22:55.877" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6697" PostTypeId="2" ParentId="6695" CreationDate="2015-01-20T18:43:46.147" Score="3" Body="&lt;p&gt;An incredibly broad question deserves an incredibly broad answer... You'll need to build a plugin:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(Apologies for the snarkiness)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-01-20T18:43:46.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6699" PostTypeId="1" AcceptedAnswerId="6700" CreationDate="2015-01-20T19:49:06.690" Score="4" ViewCount="5358" Body="&lt;p&gt;I'm trying to code up a Matrix field for a homepage slider, and it contains a single 'Slide' block type. It has fields for Image (Assets), Heading (Plain Text), Sub-Heading (Plain Text), and Slide Link (Entries). I've got everything working, except for the Slide Link field (where I want to output the entry URI for the entry that was selected in that field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I add &lt;code&gt;{{ block.slideLink }}&lt;/code&gt; to my template, I get the following error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I'm obviously not meant to output a link to an entry (I only have one link being selected in the field) in this way, so can someone help me out with the syntax that I need please? There weren't any Entries examples in the &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix Field docs&lt;/a&gt; that I could copy from, and I couldn't figure out how to adapt the &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries Field examples&lt;/a&gt; to fit in with a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help, and here's my code. The incorrect &lt;code&gt;{{ block.slideLink }}&lt;/code&gt; code is on line 11:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;  &amp;lt;div class=&quot;grid-100 flexslider&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;slides&quot;&amp;gt;&#xA;&#xA;      {% for block in entry.homepageSlideshow %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ block.slideLink }}&quot;&amp;gt;&#xA;&#xA;            {% set largeImage = {&#xA;              mode: 'crop',&#xA;              width: 1180,&#xA;              height: 450,&#xA;              quality: 80&#xA;            } %}&#xA;&#xA;            {% set image = block.image.first() %}&#xA;            {% if image %}&#xA;              &amp;lt;img src=&quot;{{ image.getUrl(largeImage) }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;div class=&quot;flex-caption grid-40&quot;&amp;gt;&#xA;              &amp;lt;h2&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&#xA;              &amp;lt;p style=&quot;font-weight: bold;&quot;&amp;gt;{{ block.subHeading }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&amp;lt;!-- flex-caption --&amp;gt;&#xA;&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&amp;lt;!-- grid-100 --&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-06-30T23:28:51.640" Title="How to output an Entries Field value within a Matrix Field block" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6700" PostTypeId="2" ParentId="6699" CreationDate="2015-01-20T20:32:10.453" Score="13" Body="&lt;p&gt;You get this error because &lt;code&gt;{{ block.slideLink }}&lt;/code&gt; returns an array of EntryModels (even if you set your Entries field up to only allow 1 entry). So you need to add the &lt;code&gt;first()&lt;/code&gt; method to get the first (and only) EntryModel that you are interested in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = block.slideLink.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Access the &lt;code&gt;url&lt;/code&gt; property to return the URL of that entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry %}&#xA;    {{ entry.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-06-30T23:28:51.640" LastActivityDate="2017-06-30T23:28:51.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6701" PostTypeId="2" ParentId="6699" CreationDate="2015-01-20T20:32:20.930" Score="7" Body="&lt;p&gt;All related fields (assets, entries, categories, tags, etc) are designed to store more than one item, and thus always return an &quot;array-like&quot; object (although not technically an array), even if you have the limit set to 1. Thus you first need to either loop through the items or grab the first item using &lt;code&gt;first&lt;/code&gt; or &lt;code&gt;[0]&lt;/code&gt;. In addition, each item is an object model that has various object properties, that you will need to retrieve using dot syntax. So to get your url you would would want something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homepageSlideshow %}&#xA;    &amp;lt;a href=&quot;{{ block.slideLink.first.url }}&quot;&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homepageSlideshow %}&#xA;    &amp;lt;a href=&quot;{{ block.slideLink[0].url }}&quot;&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-20T20:32:20.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6702" PostTypeId="2" ParentId="6633" CreationDate="2015-01-20T22:39:29.643" Score="14" Body="&lt;h3&gt;Cache Creation&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The primary files to look at are &lt;code&gt;Cache_Node.php&lt;/code&gt; in &lt;code&gt;app/etc/templating/twigextensions&lt;/code&gt; and &lt;code&gt;TemplateCacheService.php&lt;/code&gt; in &lt;code&gt;app/services&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Cache Node does some basic checking before deciding what content to output, and what to do with that content. It builds a cache key (either automatically, or uses the one defined), and then looks for an existing cached template. If a cache is found for that key, it is outputted and the template process moves on. If no cache is found for that key, the caching process begins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the cache node is not in a situation where caching is being ignored (either Live Preview or a config setting), then it starts caching with the Template Cache Service. That service has a method called &lt;code&gt;startTemplateCache&lt;/code&gt;. This method creates an array of element queries and element IDs that are stored under the cache key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template within the cache node is then compiled with Twig's subcompile method. While this is happening, the element queries and resulting element IDs are stored in the previously created arrays. The compiled result is then placed in a variable and then given (along with the other cache parameters) to the &lt;code&gt;endTemplateCache&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;endTemplateCache&lt;/code&gt; method stores the cache in the &lt;code&gt;templatecaches&lt;/code&gt; table. It also loops over the element criteria and element id arrays to tag the caches using the &lt;code&gt;templatecachecriteria&lt;/code&gt; and &lt;code&gt;templatecacheelements&lt;/code&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the cache tag outputs the body (cached or otherwise).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Cache Clearing&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When you make changes to elements in the control panel, the Template Cache Service does one or two things to clear caches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If the element was &lt;strong&gt;modified&lt;/strong&gt; or &lt;strong&gt;deleted&lt;/strong&gt;, it will check the &lt;code&gt;templatecacheelements&lt;/code&gt; table to immediately clear any caches that it knows the element was involved in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the element was &lt;strong&gt;added&lt;/strong&gt; or &lt;strong&gt;modified&lt;/strong&gt;, it queues up a new “Delete Stale Template Caches” task, which cycles through the &lt;code&gt;templatecachecriteria&lt;/code&gt; table to see if there are any cached element queries which (if not cached) would have started showing the just-saved element. If the query returns the element, its corresponding cache will be deleted.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="87" LastEditorUserId="9" LastEditDate="2015-01-23T15:15:58.747" LastActivityDate="2015-01-23T15:15:58.747" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6703" PostTypeId="2" ParentId="6680" CreationDate="2015-01-20T22:47:55.783" Score="3" Body="&lt;p&gt;Yes, you can totally do this with categories, but then you have to assign a city category to each entry manually. Another idea would be to use a structure section for all of your entries, with top level entries being entries for the cities and child entries for the stories (you can make use of different entry types).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your cities index page to promt the user for their preferred city would list the categories or the top level entries of your structure. Use a conditional in this page's template that retrieves a cookie and does the redirect in case. To set a cookie you'd need to make a custom plugin or make use of Lewis Jenkins' &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow&quot;&gt;&quot;LJ-Cookies plugin&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your per-city stories index page you would make your new-york/ template list the city specific stories by adding the category relation / the city parent entry as a criteria to the ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose to use categories, &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;see here&lt;/a&gt; how to set up a category template (tick &quot;Categories in this group have their own URLs&quot;). Additionally you probably want to make your categories field required (so that you have to select a city) and set the limit to 1 (max. allowed cities) in the field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the structure solution you may want to read through &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; in the docs, to learn how to give entry types individual templates.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-21T08:35:20.873" LastActivityDate="2015-01-21T08:35:20.873" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6704" PostTypeId="1" CreationDate="2015-01-20T23:17:10.230" Score="4" ViewCount="1069" Body="&lt;p&gt;We have a plugin. Locally, it's working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we push to dev, one of the actions begins to throw a 500 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action is taking place via an ajax call, and the error in the console is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://website.com/admin/pluginName/controller/method 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I expand that error in the console, I see the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k.cors.a.crossDomain.send jquery-2.1.1.min.js?d=1421398025:4 &#xA;n.extend.ajax             jquery-2.1.1.min.js?d=1421398025:4 &#xA;n.(anonymous function)    controller:474 &#xA;(anonymous function)      jquery-2.1.1.min.js?d=1421398025:3 &#xA;n.event.dispatch          jquery-2.1.1.min.js?d=1421398025:3 &#xA;r.handle                  jquery-2.1.1.min.js?x=Q4rOzOLw2:3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Checking the Craft Error Logs I see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level: error&#xA;Category: exception.Guzzle\Http\Exception\ClientErrorResponseException&#xA;Message exception: 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what is different about our dev environment vs. the local environment?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any steps I can take to better diagnose how to solve this issue?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-01-21T04:26:52.847" Title="Controller action throws a 500 error in some environments" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6705" PostTypeId="2" ParentId="373" CreationDate="2015-01-21T03:10:03.197" Score="1" Body="&lt;p&gt;Or, have a look at &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster&lt;/a&gt;, which works a treat!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-01-21T03:10:03.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6706" PostTypeId="1" AcceptedAnswerId="6716" CreationDate="2015-01-21T03:52:20.837" Score="4" ViewCount="12225" Body="&lt;p&gt;I have an old php code in the footer of my site like below. Will like to convert that to twig (which I suspect will be cleaner). I don't know a lick of php hence my question here.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;    &amp;lt;?&#xA;      $startyear = 2010;&#xA;      $currentyear = date(&quot;Y&quot;);&#xA;&#xA;      if ($startyear == $currentyear)&#xA;   {&#xA;      echo &quot;&amp;amp;copy; $startyear Site Name. All Rights Reserved\n&quot;;&#xA;&#xA;      }&#xA;  else&#xA;   {&#xA;     echo &quot;&amp;amp;copy; $startyear - $currentyear Sitename. All Rights Reserved\n&quot;;&#xA;&#xA;    }&#xA;      ?&amp;gt; &#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2211" LastEditorUserId="45" LastEditDate="2015-01-21T17:18:58.917" LastActivityDate="2017-10-13T00:30:49.657" Title="Display a copyright year (or range)" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6707" PostTypeId="2" ParentId="6706" CreationDate="2015-01-21T03:54:44.700" Score="17" Body="&lt;p&gt;You can use Twig's date filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;now&quot;|date('Y') }} Sitename. All rights reserved.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;noreferrer&quot;&gt;More info in the Twig docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="7375" LastEditDate="2017-10-13T00:30:49.657" LastActivityDate="2017-10-13T00:30:49.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6708" PostTypeId="1" CreationDate="2015-01-21T03:59:22.593" Score="7" ViewCount="7113" Body="&lt;p&gt;I built a site locally and moved it up to a remote host. I am getting a page that says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“Service Unavailable Our site is temporarily unavailable. Please try&#xA;  again later.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It’s clearly a page coming from Craft so i know the CraftPath is set up right. I have multi-environment variables set up in config/general.php that seem to be working, i.e. it still works locally and there is a stylesheet being called properly in the error page so i think my {baseUrl} is working. I also have them in config/db.php and at least, the local connection is being made. I have devMode =&gt; true and it's not giving any hints...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i uploaded /craft and /public and imported the database. I’m currently using an IP address because the Url is in use and will be moved later on. I had the IP set up so i get to my /index.php and it seems to go out and find /craft OK. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I don’t have to reinstall craft or anything do i?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The /craft, /public, database, and multi environment variables should do it? Is there some other thing i need to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Would a DB connection error be clear?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-09-25T22:02:03.040" Title="Moved from local to remote &quot;Service Unavailable Our site is temporarily unavailable. Please try again later.&quot;" Tags="&lt;multi-environment&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6709" PostTypeId="2" ParentId="6708" CreationDate="2015-01-21T04:16:24.367" Score="3" Body="&lt;p&gt;That error means your site is currently offline.  Check in the control panel under Settings-&gt;General to see if it's set to offline there.  Or maybe you're using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#isSystemOn&quot; rel=&quot;nofollow&quot;&gt;isSystemOn&lt;/a&gt; config setting and it's set to off on your production environment there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-21T04:16:24.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6710" PostTypeId="2" ParentId="6704" CreationDate="2015-01-21T04:21:19.973" Score="3" Body="&lt;p&gt;Brad's comment above helped us find the solution.  I had been looking at the &lt;code&gt;craft.log&lt;/code&gt; file in the control panel at &lt;code&gt;/admin/utils&lt;/code&gt; and it doesn't output the stack trace.  Look at the actual log file, we got more info on the issue which was that the ajax call was returning:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[status code] 401&#xA;[reason phrase] Unauthorized&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin on the site we have was trying to render a front-end template using Guzzle and the dev site is password protected, and the request was not making it through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible solutions include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Updating the way the template is being processed to not require a front-end request&lt;/li&gt;&#xA;&lt;li&gt;Only use this functionality in locations that are not password protected&lt;/li&gt;&#xA;&lt;li&gt;Hurry up and finish the massive overhaul of the plugin you are working on so this issue doesn't exist any longer!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;#3 it is!&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-01-21T04:26:52.847" LastActivityDate="2015-01-21T04:26:52.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6711" PostTypeId="1" CreationDate="2015-01-21T04:31:54.347" Score="0" ViewCount="1292" Body="&lt;p&gt;I have a couple of youtube iframes loaded into a channel entry. I also have a script running that resizes those iframes. It appears the script fires on window load but it appears that it fires before the iframes load in from craft. Is there any quick fix to this issue and if so how do I fix it?&lt;/p&gt;&#xA;" OwnerUserId="969" LastActivityDate="2015-01-21T19:46:40.683" Title="Javascript loads before iframes" Tags="&lt;javascript&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6712" PostTypeId="1" AcceptedAnswerId="6714" CreationDate="2015-01-21T04:48:02.447" Score="1" ViewCount="515" Body="&lt;p&gt;I'm basically wanting to manipulate user-submitted forms through the use of SproutForms. Basically, the user enters their form data, submits it, where it's recorded as a SproutForm entry. When that happens, I also want it to create an entry in a channel with the same data, so that I can freely use them in templates (showing users a list of their submissions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this would be simpler if SproutForms had some templating tags to output entries, but from looking through the plugin, I don't think thats possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, so an additional plugin could have something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;    // Support Sprout Forms plugin&#xA;    craft()-&amp;gt;on('sproutForms.saveEntry', function(Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't seem to work. Any ideas, or a better suggestion?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-01-21T05:32:37.077" Title="Saving entry from Sprout Forms into channel entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6714" PostTypeId="2" ParentId="6712" CreationDate="2015-01-21T05:32:37.077" Score="2" Body="&lt;p&gt;As of Sprout Forms 0.8.4 this is not possible.  It is on our list to allow more customization over the form entries and how they are output on the front end so this will be possible in the future.  If you'd like us to prioritize this functionality, drop us a note and we're happy to have that conversation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to save a Craft Entry after the Form Entry is saved, you're using the right Event above.  One thing you will want to be careful of is that the Sprout Forms &lt;code&gt;$entry&lt;/code&gt; value is a SproutForms_EntryModel and the variable you need to pass to the &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)&lt;/code&gt; method is a Craft EntryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this you'll need some code to hand off the field values on the Form Entry to the field values on the Craft Entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;    // Support Sprout Forms plugin&#xA;    craft()-&amp;gt;on('sproutForms.saveEntry', function(Event $event) {&#xA;&#xA;        // SproutForms_EntryModel&#xA;        $formEntry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // Craft EntryModel&#xA;        $craftEntry = new EntryModel;&#xA;&#xA;        // Map your Form field values to the Entry field values&#xA;        $craftEntry-&amp;gt;fieldName = $formEntry-&amp;gt;fieldName;&#xA;&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($craftEntry);&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That said, this method feels pretty messy to me.  Duplicating data is a great way to create great pains for yourself down the road. If you're set on doing this on your own, I'd recommend to create a custom plugin with and a variable that queries the Sprout Forms data how you'd like.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userFormSubmissions = craft.myCustomPlugin.sproutFormsQuery(userId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When Sprout Forms gets around to adding this functionality, you can swap out your custom tag for the native Sprout Forms one and ditch the custom plugin.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-01-21T05:32:37.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6715" PostTypeId="1" CreationDate="2015-01-21T06:33:22.343" Score="3" ViewCount="85" Body="&lt;p&gt;We have a site where we want to use email addresses as the username.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site also has a lot of related user content and the administrators on the site know many of the site members by name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, Craft User Relations Fields display the email address of each user.  This gets pretty confusing quick as recognizable names become long strings of letters and numbers after you relate them.  In some cases, we find ourselves triggering the User Relations modal just to figure out who is related to the Entry we are looking at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We require Users to submit First Name and Last Name values so we can ensure that each user has that value. Is there any way to define what values we see for the User Relations Fields?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-01-21T18:40:15.677" Title="Is it possible to use useEmailAsUsername and see User Relations Fields display as First Name + Last Name?" Tags="&lt;users&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6716" PostTypeId="2" ParentId="6706" CreationDate="2015-01-21T07:14:56.283" Score="10" Body="&lt;p&gt;The first two lines of code determine the &lt;strong&gt;start year&lt;/strong&gt; and the &lt;strong&gt;current year&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next block of code compares the two years, and sets the &lt;code&gt;copyrightYears&lt;/code&gt; variable accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we simply output &lt;code&gt;copyrightYears&lt;/code&gt; along with the rest of the copyright text.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set startYear = 2010 %}&#xA;{% set currentYear = now.year %}&#xA;&#xA;{% if startYear == currentYear %}&#xA;    {% set copyrightYears = startYear %}&#xA;{% else %}&#xA;    {% set copyrightYears = startYear ~ ' - ' ~ currentYear %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;p&amp;gt;&amp;amp;copy; {{ copyrightYears }} Site Name. All Rights Reserved&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may want to quickly read about the native &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#year&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;now&lt;/code&gt; variable&lt;/a&gt;, a DateTime object which contains data about this exact moment in time (per your timezone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth mentioning... There are a few shorter ways to do this, this example was written with the purpose of breaking down each step individually. If you'd like to trim this code down further, I'd suggest looking into one or both of these Twig capabilities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;noreferrer&quot;&gt;Ternary statements&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;noreferrer&quot;&gt;Macros&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example of using a ternary statement:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;{% set copyrightYears = ((startYear &amp;lt; currentYear) ? (startYear ~ ' - ' ~ currentYear) : startYear) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example of using a macro:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;amp;copy; {{ myMacroSet.myMacro(2010) }} Site Name. All Rights Reserved&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, don't forget to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/import.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt; &quot;myMacroSet&quot; before you call it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-01-21T17:29:43.383" LastActivityDate="2015-01-21T17:29:43.383" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6717" PostTypeId="2" ParentId="6680" CreationDate="2015-01-21T07:48:43.507" Score="2" Body="&lt;p&gt;Categories is definitely the right idea here! In fact, I'd recommend creating a &lt;strong&gt;Category URL Format&lt;/strong&gt;, and using that to represent each city:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IwioO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Within your &quot;_city-category&quot; template, you would list all entries &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;related to&lt;/a&gt; that particular category (aka: city). The &lt;code&gt;slug&lt;/code&gt; in this case would be your city name (&quot;new-york&quot;, &quot;los-angeles&quot;, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick here is to think of your categories &lt;strong&gt;first&lt;/strong&gt;, and your entries &lt;strong&gt;second&lt;/strong&gt;. Instead of having &quot;entries with categories&quot;, you are creating &lt;strong&gt;&quot;categories which have entries&quot;&lt;/strong&gt;. Make your categories the main attraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/6703/45&quot;&gt;carlcs said in his answer&lt;/a&gt;, you'll probably want to use the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Cookies plugin&lt;/a&gt; to remember which city each visitor has selected. It's pretty easy to generate a list of cities (aka: list of categories), and each city would link to its respective dynamic category page.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-01-21T07:48:43.507" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6719" PostTypeId="1" AcceptedAnswerId="6720" CreationDate="2015-01-21T11:23:56.613" Score="4" ViewCount="3941" Body="&lt;p&gt;I have a series of structure items, each with a product id, based on this id I would like to load in an additional template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embedAsset = entry.productId %}&#xA;{% include &quot;embedAsset&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2204" LastActivityDate="2018-01-19T09:14:26.860" Title="How to dynamically set an include template" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6720" PostTypeId="2" ParentId="6719" CreationDate="2015-01-21T11:46:36.903" Score="9" Body="&lt;p&gt;Your code should work if you remove the quotation marks enclosing your variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embedAsset = entry.productId %}&#xA;{% include embedAsset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want, you can use string concatenation to add a path or extension to it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embedAsset = '_products/' ~ entry.productId ~ '.html' %}&#xA;{% include embedAsset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also add a &quot;fallback template&quot;, that loads in case your dynamic template does not exist (read the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig docs&lt;/a&gt; for more info about this).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embedAsset = '_products/' ~ entry.productId ~ '.html' %}&#xA;{% set defaultAsset = '_products/default.html' %}&#xA;{% include([embedAsset, defaultAsset]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="6628" LastEditDate="2018-01-19T09:14:26.860" LastActivityDate="2018-01-19T09:14:26.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6721" PostTypeId="1" CreationDate="2015-01-21T15:38:49.680" Score="1" ViewCount="4499" Body="&lt;p&gt;I am getting myself confused with how to define variables in craft. I am thinking in expressionengine mode where I can define a custom global variable to be used later in my templates.  I see craft has what it calls &quot;Globals&quot; but i don't see where I can add a custom function for each global variable. Am I looking at this all wrong? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is everything done directly on the template? I am developing using jade, which is then compiled into the final html template. So running into errors adding the twig templating language into my jade templates. &lt;/p&gt;&#xA;" OwnerUserId="2211" LastEditorUserId="22" LastEditDate="2017-05-10T00:12:02.510" LastActivityDate="2017-05-10T00:12:02.510" Title="Defining Variables" Tags="&lt;templating&gt;&lt;variable&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6722" PostTypeId="1" AcceptedAnswerId="6724" CreationDate="2015-01-21T15:51:59.173" Score="4" ViewCount="691" Body="&lt;p&gt;With my plugin I listen for &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; events and make changes to the &lt;code&gt;$entry&lt;/code&gt; EntryModel. It works and I can change most properties from this function, but I have problems updating &lt;code&gt;sectionId&lt;/code&gt;, &lt;code&gt;typeId&lt;/code&gt;, &lt;code&gt;authorId&lt;/code&gt;, &lt;code&gt;postDate&lt;/code&gt; and &lt;code&gt;expiryDate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked up the relevant code in &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/EntriesService.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;EntriesService.php&lt;/code&gt;&lt;/a&gt; and noticed that it might have something to do with a variable &lt;code&gt;$entryRecord&lt;/code&gt; that gets saved to the DB separately (comment in the code: &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/EntriesService.php#L214&quot; rel=&quot;nofollow&quot;&gt;&quot;Save the actual entry row&quot;&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong or is it simply not possible to set these properties from this function. As an alternative solution I could trigger a seperate &lt;code&gt;saveEntry()&lt;/code&gt; from here, but this looks to be not the cleanest solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;{&#xA;    // Disable the entry&#xA;    $event-&amp;gt;params['entry']-&amp;gt;enabled = false;&#xA;&#xA;    // Change the `authorId` (does NOT work!)&#xA;    $event-&amp;gt;params['entry']-&amp;gt;authorId = 1;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-21T15:57:07.043" LastActivityDate="2015-01-21T17:31:35.283" Title="Use `onBeforeSaveEntry` event to update EntryModel properties?" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6723" PostTypeId="1" AcceptedAnswerId="6727" CreationDate="2015-01-21T17:17:06.940" Score="3" ViewCount="474" Body="&lt;p&gt;Does Craft have an answer to ExpressionEngine's &lt;code&gt;{switch}&lt;/code&gt; tag?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{switch=&quot;classOne|classTwo|classThree&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2015-01-21T17:53:39.307" Title="Craft's answer to {switch} from EE" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6724" PostTypeId="2" ParentId="6722" CreationDate="2015-01-21T17:31:35.283" Score="2" Body="&lt;p&gt;Just looking through the source file, it looks like &lt;code&gt;sectionId&lt;/code&gt;, &lt;code&gt;typeId&lt;/code&gt;, &lt;code&gt;authorId&lt;/code&gt;, &lt;code&gt;postDate&lt;/code&gt; and &lt;code&gt;expiryDate&lt;/code&gt; are all set as properties on the &lt;code&gt;$entryRecord&lt;/code&gt; before the &lt;code&gt;onBeforeSaveUser&lt;/code&gt; event is fired. It also looks like &lt;code&gt;$entryRecord&lt;/code&gt; is not accessible from the event, nor is it saved yet such that you could modify it directly. I suspect that you will need to modify these properties after the entry is saved (using the &lt;code&gt;onSaveEntry&lt;/code&gt; event), and then resave the entry. You will also of course need to add conditionals (i.e. compare current authorId to target authorId) and only save the entry if needed, to ensure that you don't create an endless loop.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-21T17:31:35.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6725" PostTypeId="2" ParentId="6723" CreationDate="2015-01-21T17:32:59.237" Score="0" Body="&lt;p&gt;From the documentation site&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch matrixBlock.type %}&#xA;&#xA;    {% case &quot;text&quot; %}&#xA;&#xA;        {{ matrixBlock.textField | markdown }}&#xA;&#xA;    {% case &quot;image&quot; %}&#xA;&#xA;        {{ matrixBlock.image[0].getImg() }}&#xA;&#xA;    {% default %}&#xA;&#xA;        &amp;lt;p&amp;gt;A font walks into a bar.&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;The bartender says, “Hey, we don’t serve your type in here!”&amp;lt;/p&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/switch&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2204" LastActivityDate="2015-01-21T17:32:59.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6726" PostTypeId="2" ParentId="6663" CreationDate="2015-01-21T17:42:26.680" Score="1" Body="&lt;p&gt;You could update the links to your static HTML to point to the files directly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://mygreatnewcraftsite.com/events/myoldstaticfile.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or modify your .htaccess file like I described here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/1966/125&quot;&gt;&quot;Is it possible to tell Craft to ignore requests to under a certain path?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-21T17:42:26.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6727" PostTypeId="2" ParentId="6723" CreationDate="2015-01-21T17:47:49.697" Score="5" Body="&lt;p&gt;Yes, you can do the same in Craft using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/cycle.html&quot; rel=&quot;nofollow&quot;&gt;cycle function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myClasses = ['classOne', 'classTwo', 'classThree'] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ cycle(myClasses, loop.index0) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-21T17:53:39.307" LastActivityDate="2015-01-21T17:53:39.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6728" PostTypeId="2" ParentId="6715" CreationDate="2015-01-21T18:40:15.677" Score="2" Body="&lt;p&gt;Currently, there isn't a native way to do that, but I can see where it'd get confusing.  I'll add it to our list to look into.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-21T18:40:15.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6729" PostTypeId="2" ParentId="2041" CreationDate="2015-01-21T18:54:41.520" Score="1" Body="&lt;p&gt;This happened with my install too. It turns out that the session.save_path was not defined in php.ini. As soon as I set that to a suitable location with read/write permissions, Craft came to life.&lt;/p&gt;&#xA;" OwnerUserId="2213" LastActivityDate="2015-01-21T18:54:41.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6730" PostTypeId="2" ParentId="6721" CreationDate="2015-01-21T19:24:36.403" Score="3" Body="&lt;p&gt;I'm not familiar with Jade so I can't speak to that, however I would suspect that even if Jade did allow Twig syntax it would be mostly redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding variables. There are a number of ways to create variables in craft.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow&quot;&gt;Twig Variables&lt;/a&gt; - defined using &lt;code&gt;{% set variable = 'value' %}&lt;/code&gt;, which can be printed using &lt;code&gt;{{ variable }}&lt;/code&gt; or otherwise referenced by name. You can also assign a block of code to a variable using &lt;code&gt;{% set variable %}...{% endset %}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Globals&lt;/a&gt; - global fields defined within the CP which can be accessed in your templates using &lt;code&gt;{{ globalSetHandle.fieldHandle }}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;nofollow&quot;&gt;Environment Variables&lt;/a&gt; can also be defined in your config file (although these are generally reserved for variables that are unique to a particular environment, i.e. 'BaseUrl' ).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Plugin Template Variables&lt;/a&gt; - defined in php in your plugin's variables files&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You might also want to look at Twigs &lt;code&gt;extends&lt;/code&gt;, &lt;code&gt;include&lt;/code&gt;, and &lt;code&gt;embed&lt;/code&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not exactly sure what you mean by &quot;custom function for each global variable&quot;. Twig has some methods and functions that allow you to manipulate data (see &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/index.html&quot; rel=&quot;nofollow&quot;&gt;twig functions&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions&quot; rel=&quot;nofollow&quot;&gt;craft functions&lt;/a&gt;), as well as &lt;code&gt;macro&lt;/code&gt; functionality for creating reusable code. Although if you are doing anything overly complicated it might be best to create a custom &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-21T19:24:36.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6731" PostTypeId="2" ParentId="6711" CreationDate="2015-01-21T19:46:40.683" Score="2" Body="&lt;p&gt;This seems more like a jquery issue then a craft issue. You might look into jquery's &lt;code&gt;load&lt;/code&gt; method. Doing a quick google search I came up with &lt;a href=&quot;https://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe&quot;&gt;this possible solution&lt;/a&gt;, which you would need to adapt. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function callIframe(url, callback) {&#xA;    $(document.body).append('&amp;lt;iframe id=&quot;myId&quot; ...&amp;gt;');&#xA;    $('iframe#myId').attr('src', url);&#xA;&#xA;    $('iframe#myId').load(function() {&#xA;        callback(this);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-01-21T19:46:40.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6732" PostTypeId="1" CreationDate="2015-01-21T19:53:52.547" Score="18" ViewCount="5768" Body="&lt;p&gt;I was wondering if anyone has stumbled on a good solution for including matrix-like fields within a matrix block. I’m working on a site where each page's is constructed in one big matrix with several block types (each representing a “row&quot; in the page) like…&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Introduction&lt;/li&gt;&#xA;&lt;li&gt;Stats&lt;/li&gt;&#xA;&lt;li&gt;Quotes&lt;/li&gt;&#xA;&lt;li&gt;Bios&#xA;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Blocks like Stats, Quotes, etc. can hold either just one, or several of these items, so right now the subfields look something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Block Title&lt;/li&gt;&#xA;&lt;li&gt;Stat 1: Number&lt;/li&gt;&#xA;&lt;li&gt;Stat 1: Text&lt;/li&gt;&#xA;&lt;li&gt;Stat 2: Number&lt;/li&gt;&#xA;&lt;li&gt;Stat 2: Text …etc. up to Stat 6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Rather than having all these fields in view by default, it would (obviously) be best if the user were just adding Stats as rows in an inner table or Matrix. Initially I thought that using Table fields would be the fix, but in several cases I need to include fields that aren’t natively supported in in Tables (like Assets, Rich Text, etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the very least it would be nice to collapse some of the fields that are likely not going to be needed so they are out of the way (so in the example above, maybe show fields for the first 2 stats, hide field for the next 4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody stumbled on a good solution (maybe a Plugin) for either allowing more field types within Tables, adding a Matrix to a Matrix block, or collapsing fields by default?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also open to other suggestions … seems like a lot of sites take this “stacked rows” approach, so guessing I’m not alone here. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="610" LastEditorUserId="9" LastEditDate="2015-02-04T16:09:17.040" LastActivityDate="2020-08-24T19:01:15.870" Title="Solution for Matrix-within-Matrix (or More Robust Table Fields)" Tags="&lt;matrix&gt;&lt;table-field&gt;&lt;content&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="6733" PostTypeId="2" ParentId="6732" CreationDate="2015-01-21T20:04:21.703" Score="5" Body="&lt;p&gt;An alternate solution that might work is to create separate channels for 'stats' and 'quotes', and then use an &lt;code&gt;entries&lt;/code&gt; field within your matrix block to add them to the 'stats' and 'quotes' blocks. Although not as accessible when creating the entry, it seems like it would potentially be a lot easier to manage all around, with no limitations on filedtypes, etc.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-21T20:04:21.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6734" PostTypeId="2" ParentId="6732" CreationDate="2015-01-21T20:26:25.477" Score="2" Body="&lt;p&gt;Maybe this is not the best idea for your exact use case, but what about using a Structure section for your entries with two levels. Top level entries would be your &quot;actual entries&quot; and their child entries would be a substitute for your current matrix blocks. In the template of top level entries you then collect the content of the children in sort order, conditionally output the data based on the used entry type of the child.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if you are able to use live preview with such an approach though.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-21T20:26:25.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6735" PostTypeId="1" CreationDate="2015-01-21T20:37:35.897" Score="0" ViewCount="479" Body="&lt;p&gt;I've transferred a Craft site (I didn't build it) from staging to production. All the existing content is showing up on the front end but when I try to edit entries that aren't static pages, the edit pages are 404'ing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S6F9v.png&quot; alt=&quot;404&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Update&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the contents of the .htaccess&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; *&#xA; * All of your system's general configuration settings go in here.&#xA; * You can see a list of the default settings craft/app/etc/config/defaults/general.php&#xA;*/&#xA;&#xA;return array(&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2214" LastEditorUserId="125" LastEditDate="2015-05-29T15:01:23.670" LastActivityDate="2015-05-29T15:01:23.670" Title="Admin entries 404'ing" Tags="&lt;entries&gt;&lt;error&gt;&lt;404&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="6736" PostTypeId="2" ParentId="1625" CreationDate="2015-01-21T20:57:11.793" Score="4" Body="&lt;p&gt;I had the same issue. Tried setting a bunch of mysql and php configs for timeouts, packet sizes, etc, and nothing would help. Finally found that turning off dev mode fixed it for me. Don't know why. Just thought I'd throw that out there in case someone else was having the same problem.&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2015-01-21T20:57:11.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6737" PostTypeId="1" AcceptedAnswerId="6740" CreationDate="2015-01-21T21:04:29.687" Score="1" ViewCount="1355" Body="&lt;p&gt;New (local) installation of Craft on Mac OSX Yosemite, working well except uploading an asset doesn't complete. The progress bar hangs and the spinner never stops spinning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft index.php is located in &lt;code&gt;/Users/Penguin2/Sites/craft.dev/&lt;/code&gt;&#xA;Craft application files are in &lt;code&gt;/Users/Penguin2/Sites/craft/&lt;/code&gt;&#xA;PHP open_basedir is &lt;code&gt;/Users/Penguin2/Sites/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PHP log indicates the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[21-Jan-2015 18:04:02 UTC] PHP Warning:  Unknown: open_basedir restriction in effect. File(/var/tmp/) is not within the allowed path(s): (/Users/Penguin2/Sites) in Unknown on line 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume I need to change the location where Craft stores temp files to a directory under the PHP open_basedir but I can't find the setting anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2213" LastEditorUserId="57" LastEditDate="2015-01-21T22:09:48.137" LastActivityDate="2015-01-21T22:11:33.703" Title="Asset uploads failing on new installation of Craft CMS" Tags="&lt;assets&gt;&lt;php&gt;&lt;upload&gt;&lt;installation&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6739" PostTypeId="2" ParentId="6732" CreationDate="2015-01-21T22:03:17.277" Score="20" Body="&lt;p&gt;Rather than trying to store multiple stats together in a single block, another option would be to make a &quot;Stat&quot; (singular) block type, which only holds a single stat, and just have authors create as many of those as they need, positioned together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your template, when looping through blocks, you can check to see if the current block is the first/last of its type, and add some extra HTML when that's the case, so that consecutive Stat blocks still appear grouped together in the rendered HTML. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;    {# Find out if this is the first/last consecutive block of this&#xA;type #}&#xA;    {% set type = block.type.handle %}&#xA;    {% set isFirstConsecutiveBlockOfType = (loop.first or type != block.getPrev().type.handle) %}&#xA;    {% set isLastConsecutiveBlockOfType = (loop.last or type != block.getNext().type.handle) %}&#xA;&#xA;    {% switch type %}&#xA;&#xA;        {% case 'stat' %}&#xA;&#xA;            {% if isFirstConsecutiveBlockOfType %}&#xA;                &amp;lt;div class=&quot;stats&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;!-- Stat block HTML --&amp;gt;&#xA;&#xA;            {% if isLastConsecutiveBlockOfType %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {% case 'quote' %}&#xA;&#xA;            {% if isFirstConsecutiveBlockOfType %}&#xA;                &amp;lt;div class=&quot;quotes&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;!-- Quote block HTML --&amp;gt;&#xA;&#xA;            {% if isLastConsecutiveBlockOfType %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-21T22:03:17.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6740" PostTypeId="2" ParentId="6737" CreationDate="2015-01-21T22:11:33.703" Score="2" Body="&lt;p&gt;You probably just need to set &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.upload-tmp-dir&quot; rel=&quot;nofollow&quot;&gt;upload_tmp_dir&lt;/a&gt; in your php.ini file to be a path under your openbase_dir paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or just remove the openbase_dir restrictions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-21T22:11:33.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6741" PostTypeId="1" AcceptedAnswerId="6751" CreationDate="2015-01-22T00:00:20.337" Score="3" ViewCount="989" Body="&lt;p&gt;I am using a RichText field type of my site content and I am inserting blocks of code within some &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; tags which I add in the HTML view of the editor, however when I leave the HTML view, all of the empty lines within the &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; block are stripped out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried turning off the clean up HTML option etc with no luck. Is there a way to keep the empty lines (multiple consecutive newlines).&lt;/p&gt;&#xA;" OwnerUserId="938" LastEditorUserId="125" LastEditDate="2015-01-22T11:30:17.120" LastActivityDate="2015-01-22T12:10:37.587" Title="Retain empty lines in a RichText field" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6742" PostTypeId="1" AcceptedAnswerId="6743" CreationDate="2015-01-22T00:17:51.153" Score="2" ViewCount="122" Body="&lt;p&gt;My question is closely related to this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2340/how-do-i-display-entries-from-multiple-entry-types&quot;&gt;How do I display entries from multiple entry types?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have two blog post types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Regular blog posts (Title, Body, etc)&lt;/li&gt;&#xA;&lt;li&gt;External links posts (Link out to another site)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I imagined I would display them in the same area, by dates created, like a standard blog, but clicking some of the links would go to external link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make this as easy as possible for my client, so I would like them to be in the same place if possible, but also open to any other solutions. Has anyone done something like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about the possibility of two channels, and combining all posts and ordering by date? Not completely sure how I would go about that though.&lt;/p&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-01-22T01:18:09.000" Title="Is it possible to use a lightswitch (or something similar) for different post types?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6743" PostTypeId="2" ParentId="6742" CreationDate="2015-01-22T01:03:07.687" Score="2" Body="&lt;p&gt;I think your answer is in the post you referenced. Create two entry types in a single section, each of which contains different fields (and/or some in common). Then loop through all the entries and test for entry type in the output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% if entry.type ==  'linklist' %}&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.externalLink }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {{entry.body }&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The user will have to understand how to change the entry type in Craft's UI (it's the dropdown in the right column, but it's pretty clear once they've been shown how to do it once).&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="15" LastEditDate="2015-01-22T01:18:09.000" LastActivityDate="2015-01-22T01:18:09.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6744" PostTypeId="5" CreationDate="2015-01-22T02:02:18.177" Score="0" Body="" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-22T02:02:18.177" LastActivityDate="2015-01-22T02:02:18.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6745" PostTypeId="4" CreationDate="2015-01-22T02:02:18.177" Score="0" Body="Craft configuration and settings." OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-22T02:02:18.177" LastActivityDate="2015-01-22T02:02:18.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6746" PostTypeId="1" AcceptedAnswerId="6747" CreationDate="2015-01-22T02:25:35.287" Score="2" ViewCount="267" Body="&lt;p&gt;Is there a way I can reverse use the User Model to return an &lt;code&gt;authorId&lt;/code&gt; based on the first/last name (John Doe)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I'm converting the first/last to a readable URI segment (using email addresses as username and I want something more readable than an ID in the URL):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.firstName|lower ~ '-' ~ entry.author.lastName|lower }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns: &lt;code&gt;john-doe&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the listing page, grabbing the URI segment, setting that back to a readable name and spliting to array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorName = craft.request.segment(3)|replace({'-':' '})|title|split(' ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives me (the equivalent of):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA;  [0] =&amp;gt; John&#xA;  [1] =&amp;gt; Doe&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to get the author id to return all the entries from said author. I thought something along the lines of below would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set author = craft.users.firstName(authorName.0).lastName(authorName.1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, I get the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, if I return &lt;code&gt;{{ authorName.0 }}&lt;/code&gt; it returns a string.&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2015-01-22T02:42:23.820" LastActivityDate="2015-01-22T02:45:37.677" Title="Find an authorId based on first and/or last name" Tags="&lt;users&gt;&lt;entry&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6747" PostTypeId="2" ParentId="6746" CreationDate="2015-01-22T02:45:37.677" Score="2" Body="&lt;p&gt;Well, I was 1 minute away from solving this, so I'll post my answer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set author = craft.users.firstName(authorName.0).lastName(authorName.1).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once the &lt;code&gt;author&lt;/code&gt; object is set, you can access the &lt;code&gt;{{ author.id }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Allowing me to neatly return author entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').authorId(author.id).limit('10') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastActivityDate="2015-01-22T02:45:37.677" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6748" PostTypeId="1" CreationDate="2015-01-22T10:14:10.493" Score="3" ViewCount="884" Body="&lt;p&gt;Im making a plugin and have come to the stage where im making an edit form, for the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the layout to look like this, with 2 columns and tabs above the left column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/froXR.png&quot; alt=&quot;craft entry layout&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My, question is what is the best way to achive this? currently im using extending _layouts/cp in my template, the page look like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XVymQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for your help&lt;/p&gt;&#xA;" OwnerUserId="2182" LastActivityDate="2015-01-24T20:12:16.607" Title="Plugin custom edit page layout" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6749" PostTypeId="1" AcceptedAnswerId="6759" CreationDate="2015-01-22T10:40:52.330" Score="1" ViewCount="2572" Body="&lt;p&gt;A client we're working with has a requirement to upload one large file (about 320MB) every 2–3 months. Craft has been configured with a local asset source to handle this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to decide the best way to approach this: whether we upload this large file via SFTP for them when required, or if the client can do this through Craft in their own time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/492/when-uploading-assets-what-determines-the-maximum-file-size/&quot;&gt;This previous question&lt;/a&gt; provides some good pointers. I've increased the necessary settings, however when attempting to upload a test file (315MB), Craft displays an alert ‘The file “testfile.zip” could not be uploaded, because it exceeds the maximum upload size of 128.0 MB.’&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't seen any filesize limits of 128MB, so is this value hardwired into the file upload logic? To confirm that the changed settings do work, a test file of 100MB was uploaded fine.&lt;/p&gt;&#xA;" OwnerUserId="148" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-12-09T21:15:44.830" Title="Does Craft enforce a maximum filesize for large files?" Tags="&lt;assets&gt;&lt;upload&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6750" PostTypeId="2" ParentId="6741" CreationDate="2015-01-22T11:07:01.550" Score="2" Body="&lt;p&gt;Im not sure if this is what you mean but you must encode the html you put inside the tag &amp;lt;pre&amp;gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A browser always render html code, so the only way is to encode the html to make it render as text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example for &amp;lt;p&amp;gt; you have to write &lt;code&gt;&amp;amp;lt;p&amp;amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2183" LastActivityDate="2015-01-22T11:07:01.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6751" PostTypeId="2" ParentId="6741" CreationDate="2015-01-22T12:10:37.587" Score="4" Body="&lt;p&gt;Don't use Redactor / a Rich Text field for code blocks is probably the only answer one can give right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you could use a Plain Text field for your article and get the formatting done with markdown. Or you could use Matrix and keep using Redactor for the text parts of your article and have a separate block type for code.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-22T12:10:37.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6753" PostTypeId="1" AcceptedAnswerId="6754" CreationDate="2015-01-22T15:43:46.213" Score="4" ViewCount="1560" Body="&lt;p&gt;For example, in addition to the auto-generated title for an entry is it possible to display another column alongside with another field? I would like data input be as easy as possible for the client. The more information available on this page to view and sort by the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless there is another way to approach this I am not aware of? Would a plugin be required for example?&lt;/p&gt;&#xA;" OwnerUserId="487" LastEditorUserId="487" LastEditDate="2015-03-06T15:20:16.627" LastActivityDate="2017-11-16T12:13:13.240" Title="Is it possible to display additional fields on the entries list in admin?" Tags="&lt;entries&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6754" PostTypeId="2" ParentId="6753" CreationDate="2015-01-22T15:59:24.453" Score="8" Body="&lt;p&gt;Yes, since Craft 2.3 you can edit the CP's index views for entries, assets, etc. from a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the documentation for the hooks &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#defineAdditionalEntryTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;defineAdditionalEntryTableAttributes&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt;&lt;/a&gt; to see some sample code. Making a little plugin for this is easy, simply copy and paste the above sample code into your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;primary plugin class&lt;/a&gt; and then edit the parameters.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-11-16T12:13:13.240" LastActivityDate="2017-11-16T12:13:13.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6755" PostTypeId="2" ParentId="6618" CreationDate="2015-01-22T16:08:21.710" Score="0" Body="&lt;p&gt;This ended up being a case of looking at the wrong database.  The version/build/schema numbers for the correct database were all in sync.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-22T16:08:21.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6756" PostTypeId="1" AcceptedAnswerId="6758" CreationDate="2015-01-22T16:22:00.820" Score="4" ViewCount="334" Body="&lt;p&gt;I've been searching for a method to load in an existing entries drafts. Here is what I am trying to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User can add or edit an entry from the front end of my craft site. They cannot publish.&#xA;Admin can see new drafts and publish them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see how to submit a draft update via the front end using the entryRevisions/saveDraft method. But how can I load in the current entries draft information into a form on the front end for a user to edit? Hopefully I missed this, or is it undocumented. &lt;/p&gt;&#xA;" OwnerUserId="1101" LastActivityDate="2015-01-22T20:18:15.207" Title="Loading an existing entries drafts in template/frontend" Tags="&lt;admin&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6757" PostTypeId="2" ParentId="6683" CreationDate="2015-01-22T16:29:23.123" Score="6" Body="&lt;p&gt;Ok, so I've managed to get an answer to this courtesy of Brandon Kelly.  It's much more simple than I thought.  Firstly, you do not have to specify a relatedTo parameter the defineCriteriaAttributes(). Craft takes care of this automatically.  So in order to retrieve the details of an asset in a table list view you do the following in the getTableAttributeHtml() function in your custom Element Type class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$relatedAsset = $element-&amp;gt;myAssetsField-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This simple line of code gets a related myAssetsField of your element. I'm not sure why, but this object is placed in an array...  Maybe someone can tell me why this is the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then took the fist element of the array and used a the getThumbUrl() function which is really handy for quickly outputting the url to a thumbnail.  I passed a size of 60 pixels.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case 'myAttribute&amp;gt;':&#xA;{   &#xA;   if(count($relatedAsset) &amp;gt; 0) {&#xA;      return '&amp;lt;img src=&quot;'.$relatedAsset[0]-&amp;gt;getThumbUrl(60).'&quot;&amp;gt;';&#xA;   }&#xA;   return '';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is a thumbnail in your table list!&#xA;Hope this helps others....&lt;/p&gt;&#xA;" OwnerUserId="2205" LastActivityDate="2015-01-22T16:29:23.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6758" PostTypeId="2" ParentId="6756" CreationDate="2015-01-22T19:14:42.987" Score="5" Body="&lt;p&gt;After doing some digging around I found the &lt;code&gt;getDraftsByEntryId(entryId, locale)&lt;/code&gt; method of the &lt;code&gt;craft.entryRevisions&lt;/code&gt; service that might help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following should return the first draft of an entry. Note: there is a second argument for 'locale', which defaults to current locale if none provided. Also not sure whether 'first' or 'last' would be considered the most recent draft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;{% if drafts|length %}&#xA;    {% set draft = drafts[0] %}&#xA;    {{ draft.title }}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will need to load the entry manually (i.e. through a custom route of some kind) as the draft's entry is likely to be 'disabled' (although not necessarily) and thus not load through the entry's default url. Something like '/mysection/edit/slug' perhaps (where 'slug' is a custom route token).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries({&#xA;    section: 'mysection',&#xA;    slug: slug&#xA;    status: null&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-22T20:18:15.207" LastActivityDate="2015-01-22T20:18:15.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6759" PostTypeId="2" ParentId="6749" CreationDate="2015-01-22T19:48:08.560" Score="7" Body="&lt;p&gt;The only thing Craft enforces is the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxUploadFileSize&quot; rel=&quot;noreferrer&quot;&gt;maxUploadFileSize&lt;/a&gt; config setting, which by default is set to 16MB.  Outside of that, any limitations you run into will be environmental/server config related.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-22T19:48:08.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6760" PostTypeId="2" ParentId="6607" CreationDate="2015-01-22T21:39:51.900" Score="3" Body="&lt;p&gt;Turns out it was simply a need to add a trailing slash to the CRAFT_CONFIG_PATH constant. I'd followed the docs - which have no trailing slash - and when I fixed that it works.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-01-22T21:39:51.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6761" PostTypeId="1" AcceptedAnswerId="6764" CreationDate="2015-01-22T21:44:44.723" Score="2" ViewCount="639" Body="&lt;p&gt;I'm new to all of this and so far Categories from a templating point of view are confusing me a bit. I'm loving Craft so far but some concepts are causing me some headaches to adjust to!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i'm trying to do is list the sub-categories a blog post is part of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 6 categories and each has 4 sub-categories.&#xA;I only want to list the sub-categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when someone is viewing the site and they click into a full blog post page, at the top i'm listing the title, author, posted date and i want to follow that with a lisrt of the sub-categories applied to that blog post.&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-01-23T00:01:49.927" Title="List the categories an entry is part of?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6762" PostTypeId="1" CreationDate="2015-01-22T21:49:43.683" Score="4" ViewCount="761" Body="&lt;p&gt;In other words, categories must have at least one enabled entry assigned to them.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-07-20T15:40:55.483" Title="How can I output a list of categories that are not empty?" Tags="&lt;categories&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6763" PostTypeId="2" ParentId="6762" CreationDate="2015-01-22T22:21:32.303" Score="5" Body="&lt;p&gt;To get all categories that are related to an entry you would do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.limit(null) %}&#xA;{% set categoriesInUse = craft.categories.relatedTo(allEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to narrow down to a specific category group or any other category property you can do it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsCategories = craft.categories.group('newsCategories').limit(null) %}&#xA;{% set entriesWithNewsCategories = craft.entries.relatedTo(allCategories).limit(null) %}&#xA;{% set newsCategoriesInUse = craft.categories.relatedTo(entriesWithNewsCategories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And yes, you probably want to wrap it together with the loop to print the categories in cache tags!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="328" LastEditDate="2015-07-20T15:40:55.483" LastActivityDate="2015-07-20T15:40:55.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6764" PostTypeId="2" ParentId="6761" CreationDate="2015-01-23T00:01:49.927" Score="5" Body="&lt;p&gt;This will list all the categories that are assigned to the entry regardless of level.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for category in entry.categoriesFieldHandle %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;category.title&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you only want to list the subcategories, (regardless of whether a main category is also assigned) then you can add a test for the category level.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for category in entry.categoriesFieldHandle %}&#xA;        {% if category.level &amp;gt; 1 %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;category.title&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-23T00:01:49.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6765" PostTypeId="1" AcceptedAnswerId="6788" CreationDate="2015-01-23T09:54:34.000" Score="6" ViewCount="1929" Body="&lt;p&gt;I'm a bit confused about the usage of these two. Let's say I want to create a new entry from a controller. For me, the nicer option would be to user something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 4;&#xA;$entry-&amp;gt;typeId = 4;&#xA;&#xA;$entry-&amp;gt;setContent([&#xA;    'foo' =&amp;gt; 'bar',&#xA;    'xyz' =&amp;gt; '456', &#xA;]);&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Somehow this is not working for me. Instead, I have to use the uglier version like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 4;&#xA;$entry-&amp;gt;typeId = 4;&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;foo = 'bar';&#xA;$entry-&amp;gt;getContent()-&amp;gt;xyz = '123';&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas why the first example might be failing? Especially when working with more than two attributes, the first example would be way more easy to handle. &lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-01-25T13:36:22.537" Title="setContent() vs $entry-&gt;getContent()-&gt;foo" Tags="&lt;entries&gt;&lt;services&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6767" PostTypeId="1" CreationDate="2015-01-23T13:36:27.960" Score="2" ViewCount="470" Body="&lt;p&gt;When making any kind of POST to the back-end of my craft install, the server will essentially hang for a significant delay each time. I have researched related issues and have disabled all plugins without any change in performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normal page GET requests are speedy, it is simply an issue of trying to post a change to a page or entry or category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can say that this craft install is fairly built up. There are several sections, matrices, fields, categories, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The delays are significant, around 200s or more. Below is a sample of my profiler output when making a simple entry save:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Time:   297.89855s&#xA;&#xA;pages:554 Memory: 20,753Kb&#xA;&#xA;pages:555 Total Queries: 13&#xA;&#xA;pages:556  count   total   average    min      max   &#xA;pages:558      1  0.00083  0.00083  0.00083  0.00083    system.db.CDbCommand.query(SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`field_body`, `content`.`field_caption`, `content`.`field_dateEnd`, `content`.`field_dateStart`, `content`.`field_heading`, `content`.`field_pageTitle`, `content`.`field_position`, `content`.`field_urlOverride`, `globalsets`.`name`, `globalsets`.`handle`, `globalsets`.`fieldLayoutId`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_globalsets` `globalsets` ON globalsets.id = elements.id&#xA;WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements.enabled = 1)) AND (elements_i18n.enabled = 1)&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `name` LIMIT 100. Bound with :locale='en_us')&#xA;pages:559      1  0.00079  0.00079  0.00079  0.00079    system.db.CDbCommand.query(SELECT *&#xA;FROM `craft_tasks`&#xA;WHERE (lft = 1) AND (status = :status). Bound with :status='running')&#xA;pages:560      1  0.00062  0.00062  0.00062  0.00062    system.db.CDbCommand.query(SHOW TABLES LIKE 'craft_%')&#xA;pages:561      1  0.00047  0.00047  0.00047  0.00047    system.db.CDbCommand.query(SELECT count(`id`)&#xA;FROM `craft_tasks`&#xA;WHERE (lft = 1) AND (status = :status). Bound with :status='pending')&#xA;pages:562      1  0.00022  0.00022  0.00022  0.00022    system.db.CDbCommand.query(SELECT *&#xA;FROM `craft_info` LIMIT 1)&#xA;pages:563      1  0.00019  0.00019  0.00019  0.00019    system.db.CDbCommand.query(SELECT *&#xA;FROM `craft_users`&#xA;WHERE id=:id. Bound with :id='1')&#xA;pages:564      1  0.00015  0.00015  0.00015  0.00015    system.db.CDbCommand.query(SELECT `id`, `groupId`, `name`, `handle`, `context`, `instructions`, `translatable`, `type`, `settings`&#xA;FROM `craft_fields`&#xA;WHERE context = :context&#xA;ORDER BY `name`. Bound with :context='global')&#xA;pages:565      1  0.00014  0.00014  0.00014  0.00014    system.db.CDbCommand.query(SELECT `sections`.`id`, `sections`.`structureId`, `sections`.`name`, `sections`.`handle`, `sections`.`type`, `sections`.`hasUrls`, `sections`.`template`, `sections`.`enableVersioning`, `structures`.`maxLevels`&#xA;FROM `craft_sections` `sections`&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;ORDER BY `name`)&#xA;pages:566      1  0.00011  0.00011  0.00011  0.00011    system.db.CDbCommand.query(SELECT `id`&#xA;FROM `craft_assetsources`)&#xA;pages:567      1  0.00011  0.00011  0.00011  0.00011    system.db.CDbCommand.query(SELECT `id`, `class`, `version`, `settings`, `installDate`&#xA;FROM `craft_plugins`&#xA;WHERE enabled=1)&#xA;pages:568      1  0.00010  0.00010  0.00010  0.00010    system.db.CDbCommand.query(SELECT `id`&#xA;FROM `craft_categorygroups`)&#xA;pages:569      1  0.00009  0.00009  0.00009  0.00009    system.db.CDbCommand.query(SELECT `locale`&#xA;FROM `craft_locales`&#xA;ORDER BY `sortOrder`)&#xA;pages:570      1  0.00008  0.00008  0.00008  0.00008    system.db.CDbCommand.query(SELECT `id`&#xA;FROM `craft_globalsets`)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this point I'm looking for some possible directions solve the issue. I know these issues are tedious and difficult, but I'm willing to take shots in the dark out of desperation!&lt;/p&gt;&#xA;" OwnerUserId="2216" LastActivityDate="2015-01-23T15:45:07.120" Title="Saving entry in back-end with extreme delay" Tags="&lt;control-panel&gt;&lt;performance&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6768" PostTypeId="2" ParentId="6765" CreationDate="2015-01-23T15:07:38.833" Score="4" Body="&lt;p&gt;Have you tried using that form of setting with this method instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(['foo' =&amp;gt; 'bar', 'xyz' =&amp;gt; '123']);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also this method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;'foo' =&amp;gt; 'bar',&#xA;'xyz' =&amp;gt; '123'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As to the specific question of why doesn't setContent() work as expected, I can only guess that it may have to do with the values not being prepared properly.&lt;/p&gt;&#xA;" OwnerUserId="2216" LastActivityDate="2015-01-23T15:07:38.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6769" PostTypeId="2" ParentId="6767" CreationDate="2015-01-23T15:45:07.120" Score="2" Body="&lt;p&gt;It doesn't look like MySQL is the issue from the database profiling info you posted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable devMode, reproduce the issue, then look at your &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt; folder and find the last request, you can see the code profiling/tracing information.  See if you can find out where the 200 second delay is coming from that information.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-23T15:45:07.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6770" PostTypeId="1" AcceptedAnswerId="6775" CreationDate="2015-01-23T15:54:23.390" Score="2" ViewCount="124" Body="&lt;p&gt;In the product overviews and search results on my website are also products listed which are related to passive categories.&#xA;Is there a way to get only entries which are related to active categories?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/otOiL.png&quot; alt=&quot;The product with this category status should not be displayed at the website&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product with this category status should not be displayed at the website&lt;/p&gt;&#xA;" OwnerUserId="390" LastActivityDate="2015-01-23T16:59:12.750" Title="How can I only get the entries that are related to an active category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6771" PostTypeId="1" AcceptedAnswerId="6776" CreationDate="2015-01-23T16:16:05.380" Score="5" ViewCount="1625" Body="&lt;p&gt;I am trying to loop through all the entries in a section and &quot;group&quot; them into items which are in blocks of 9 then wrap them with some html markup so there will be the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selectedWork = craft.entries.section('selectedWork') %}&#xA;&#xA;&amp;lt;div class=&quot;panel panel--1&quot;&amp;gt;&#xA;  &amp;lt;article class=&quot;img-grid&quot;&amp;gt;&#xA;&#xA;    {% for item in selectedWork %}&#xA;    &amp;lt;section class=&quot;img-grid__item&quot;&amp;gt;&#xA;      {{ item.title }}&#xA;    &amp;lt;/section&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;  &amp;lt;/article&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- END .panel --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The outer &lt;code&gt;&amp;lt;div class=&quot;panel panel-1&quot;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; tags need to wrap round the first 9 items then then next 9 etc. etc. Also the panel--1 needs to increment so that each panel goes in order so &lt;code&gt;panel--1&lt;/code&gt; holds 1-9 items then &lt;code&gt;panel--2&lt;/code&gt; holds 9-18 items etc. Is this possible using some kind of array splice or something?&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2015-01-23T17:27:44.647" Title="Group looped entries into blocks and wrap in markup every x number of loops" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6772" PostTypeId="1" CreationDate="2015-01-23T16:32:36.740" Score="2" ViewCount="322" Body="&lt;p&gt;I'm trying to check if a user is part of a user group but not having any success!&#xA;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.groups == 'authors' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But even though the user is definitely in a user group with that handle, the output inside that if statement doesn't show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.admin != 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That DID work, but unfortunately i don't just want to check if the user is not an admin, i want to specifically check their user group.&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-01-23T19:02:50.597" Title="How can i check an entry author's user group?" Tags="&lt;user-groups&gt;&lt;author&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6774" PostTypeId="2" ParentId="6772" CreationDate="2015-01-23T16:54:48.880" Score="5" Body="&lt;p&gt;As Fabio pointed out, i'd managed to miss the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot; rel=&quot;nofollow&quot;&gt;isInGroup&lt;/a&gt; method. Slightly embarrassing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for anyone else looking to do what i asked, i changed my code to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.isInGroup('authors') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it works perfectly now.&lt;/p&gt;&#xA;" OwnerUserId="1151" LastEditorUserId="130" LastEditDate="2015-01-23T19:02:50.597" LastActivityDate="2015-01-23T19:02:50.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6775" PostTypeId="2" ParentId="6770" CreationDate="2015-01-23T16:59:12.750" Score="4" Body="&lt;p&gt;You would first query for all active categories and then get the Product entries that are related to these categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCategories = craft.categories.group('Categorie') %}&#xA;{% set entriesWithActiveCategories = craft.entries.section('Products').relatedTo(allCategories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-23T16:59:12.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6776" PostTypeId="2" ParentId="6771" CreationDate="2015-01-23T17:21:23.193" Score="10" Body="&lt;p&gt;The array slice something you are looking for is Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/batch.html&quot;&gt;&lt;code&gt;batch&lt;/code&gt;&lt;/a&gt; filter. Here's how you'd set up the groups and use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;&lt;code&gt;loop.index&lt;/code&gt;&lt;/a&gt; to generate the class name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Use the `find()` method to return an array of EntryModels #}&#xA;{% set selectedWork = craft.entries.section('selectedWork').find() %}&#xA;&#xA;{# Group entries using the `batch` filter #}&#xA;{% set selectedWorkGrouped = selectedWork|batch(9) %}&#xA;&#xA;{% for group in selectedWorkGrouped %}&#xA;&#xA;    {# Set class using the loop index from outer loop #}&#xA;    {% set panelClass = 'panel--' ~ loop.index %}&#xA;&#xA;    &amp;lt;div class=&quot;panel {{ panelClass }}&quot;&amp;gt;&#xA;&#xA;        {% for entry in group %}&#xA;            &amp;lt;section class=&quot;img-grid__item&quot;&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/section&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/div&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-23T17:27:44.647" LastActivityDate="2015-01-23T17:27:44.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6777" PostTypeId="1" AcceptedAnswerId="7108" CreationDate="2015-01-23T19:30:36.100" Score="0" ViewCount="1698" Body="&lt;p&gt;I tried using the following but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.photoUrl|length %}&#xA;&amp;lt;img src=&quot;{{ entry.author.photoUrl(84) }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;{% else %}&#xA;no photo&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, another question of mine is... when i upload a user photo on the profile tab, am I suppose to see the photo's thumbnail? All I see is the upload box with the button but the file seemed to have uploaded successfully to /craft/storage/userphotos&lt;/p&gt;&#xA;" OwnerUserId="2218" LastActivityDate="2015-02-11T10:58:48.137" Title="How do you display user photo in templates?" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6778" PostTypeId="2" ParentId="6777" CreationDate="2015-01-23T19:47:42.867" Score="2" Body="&lt;p&gt;Yes, you should see the photo thumbnail in the list of users after you upload the photo. Your exact code works for me, so I think something has gone wrong with the photo upload.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-01-23T19:47:42.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6779" PostTypeId="2" ParentId="870" CreationDate="2015-01-24T00:24:13.007" Score="13" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperSort&lt;/a&gt; Plugin is built for use cases exactly such as this. It allows you to render each object in your array using a Twig object template and sort the array based on the rendered value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in OP's case, we could sort the combined array by the &lt;code&gt;created_time&lt;/code&gt; variable like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% set feed = instagram|merge(community) %}&#xA;{% set sortedFeed = feed | supersort('sortAs', '{created_time}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(The plugin parses &lt;code&gt;{created_time}&lt;/code&gt; &amp;mdash; a Craft '&lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#renderObjectTemplate-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;micro-template&lt;/a&gt;' &amp;mdash; into &lt;code&gt;{{object.created_time}}&lt;/code&gt;, which provides the value by which the array is sorted.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the property of interest happened to be different between two arrays, we could include a conditional or ternary operator in the micro-template to differentiate them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortedFeed = feed | supersort('sortAs', '{{ object.current_time is defined ?: object.someOtherProperty }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="4017" LastEditDate="2017-10-30T16:37:00.677" LastActivityDate="2017-10-30T16:37:00.677" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6780" PostTypeId="2" ParentId="2621" CreationDate="2015-01-24T00:28:53.787" Score="2" Body="&lt;p&gt;In this case, I'd probably use the &lt;code&gt;group&lt;/code&gt; filter as described in other answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you had sermons in multiple categories, only grouping them under their &lt;em&gt;first&lt;/em&gt; category might not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, you could query the categories first, and use my &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt; plugin to sort them based on a value computed by Twig, such as the number of related entries. (SuperSort allows you to render each object in an array using a Twig object template and sort the array based on the rendered value.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-01-24T00:28:53.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6781" PostTypeId="2" ParentId="808" CreationDate="2015-01-24T00:32:34.453" Score="3" Body="&lt;p&gt;My &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt; plugin is built for use cases exactly such as this. It allows you to render each object in your array using a Twig object template and sort the array based on the rendered value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortedEntries = entries | supersort('sortAs', '{{ object.myLightswitch == 'y' ? object.dateUpdated: object.postDate }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-01-24T00:32:34.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6782" PostTypeId="2" ParentId="789" CreationDate="2015-01-24T00:36:43.580" Score="8" Body="&lt;p&gt;My &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperSort&lt;/a&gt; plugin is built for use cases exactly such as this. It allows you to render each object in your array using a Twig object template and sort the array based on the rendered value.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="4208" LastEditDate="2017-08-18T14:53:53.950" LastActivityDate="2017-08-18T14:53:53.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6783" PostTypeId="1" AcceptedAnswerId="6784" CreationDate="2015-01-24T16:44:59.717" Score="1" ViewCount="508" Body="&lt;p&gt;Is it possible to set an inline image transform's settings from the output of a Matrix block field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = {&#xA;  mode: 'block.imageMode',&#xA;  width: block.imageWidth,&#xA;  position: 'block.imageFocus'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each time I've tried this, the image gives 404. I know the surrounding code works as expected because hard coding the values, the image displays as we'd expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = {&#xA;  mode: 'crop',&#xA;  width: 300,&#xA;  quality: 70,&#xA;  position: 'center-center'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some surrounding code for context&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.image %}&#xA;&#xA;{% set transform = {&#xA;  mode: block.imageMode,&#xA;  width: block.imageWidth,&#xA;  quality: 70,&#xA;  position: block.focalPoint&#xA;} %}&#xA;&#xA;&amp;lt;div class=&quot;figure  image--{{ block.imagePosition }}&quot;&amp;gt;&#xA;  &amp;lt;p&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ image.getUrl(transform) }}&quot; width=&quot;{{ image.getWidth(transform) }}&quot; height=&quot;{{ image.getHeight(transform) }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% if image.title %}&amp;lt;b class=&quot;figure__caption&quot;&amp;gt;{{ image.title }}&amp;lt;/b&amp;gt;{% endif %}&#xA;  &amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- // .figure --&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2015-01-24T18:35:47.023" LastActivityDate="2015-01-24T18:35:47.023" Title="inline image transforms" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6784" PostTypeId="2" ParentId="6783" CreationDate="2015-01-24T16:55:03.760" Score="2" Body="&lt;p&gt;Try it without the quotes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = {&#xA;       mode: block.imageMode,&#xA;       width: block.imageWidth,&#xA;       position: block.imageFocus&#xA;   }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-24T16:55:03.760" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6785" PostTypeId="2" ParentId="6748" CreationDate="2015-01-24T20:12:16.607" Score="2" Body="&lt;p&gt;It doesn't appear there is an easy way to do this by extending that template. If you take a look at the template &lt;code&gt;templates/entries/_edit.html&lt;/code&gt; you will see how the create/edit entry screen creates this view. It is extending &lt;code&gt;_layouts/cp&lt;/code&gt;, but it's overriding the &lt;code&gt;main&lt;/code&gt; Twig block to do some custom stuff. You can include the tabs in your main block like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block main %}&#xA;&amp;lt;div class=&quot;item&quot; data-position=&quot;left&quot; data-min-colspan=&quot;2&quot; data-max-colspan=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;fields&quot; class=&quot;pane&quot;&amp;gt;&#xA;        {% include &quot;_includes/tabs&quot; %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-01-24T20:12:16.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6786" PostTypeId="2" ParentId="6765" CreationDate="2015-01-24T20:36:49.500" Score="6" Body="&lt;p&gt;I am just iterating on the previous answer to attempt to explain why this is happening. If you take a look at &lt;code&gt;BaseElementModel.php&lt;/code&gt; at the &lt;code&gt;setContent()&lt;/code&gt; method. You'll see that the core code is doing pretty much the exact thing as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'foo' =&amp;gt; 'bar',&#xA;    'xyz' =&amp;gt; '123'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The core confusion seems to be coming from a misunderstanding of how Yii models work. When a model as attributes defined, only those attributes can be set. Any other attribute will be ignored. I am not sure if you are trying to set attributes on a model that doesn't exist, but I used the following and it seems to work for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 4;&#xA;$entry-&amp;gt;typeId = 4;&#xA;&#xA;// Works because title exists in the content model&#xA;$entry-&amp;gt;setContent([&#xA;    'title' =&amp;gt; 'bar'&#xA;]);&#xA;&#xA;// foo and xyz do not exist in the content model, so attributes are ignored&#xA;$entry-&amp;gt;setContent([&#xA;    'foo' =&amp;gt; 'bar',&#xA;    'xyz' =&amp;gt; '123'&#xA;]);&#xA;&#xA;var_dump($entry-&amp;gt;getContent()-&amp;gt;getAttributes());exit();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason why the following works is because you using PHP to set a public property on an object instance. So if you are finding yourself having to rely on something like this, check to see if the attributes exist in the content model using &lt;code&gt;var_dump&lt;/code&gt; or something similar.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;foo = 'bar';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see how the core method works here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContent-detail&quot;&gt;http://buildwithcraft.com/classreference/models/BaseElementModel#setContent-detail&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-01-24T20:36:49.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6787" PostTypeId="1" CreationDate="2015-01-25T06:48:14.890" Score="2" ViewCount="114" Body="&lt;p&gt;I can't use &quot;Categories&quot; in Craft CMS, after hitting &quot;Save&quot; for an entry with Categories set, the page will take ~5minutes to load and typically time out. Usually, it does save the page and update the categories -- however, this is just not practical moving forward. The entire Craft site is unable until it finally times out the save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this and have any idea what's going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried deleting the Categories and creating new ones etc. It happens everytime when saving an entry with categories set. Is it possible that devMode being enable is causing an issue? (See error below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbException&#xA;&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. The SQL statement executed was: SELECT *&#xA;FROM `craft_info` LIMIT 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the following highlighted error line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  if (!$this-&amp;gt;config-&amp;gt;get('devMode') || (craft()-&amp;gt;isInstalled() &amp;amp;&amp;amp; !$this-&amp;gt;userSession-&amp;gt;shouldExtendSession()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning off DevMode stopped the issue. However it still sounds like from the errors above that this isn't good. Hoping to hear some insight!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="125" LastEditDate="2015-05-29T14:59:47.533" LastActivityDate="2015-05-29T14:59:47.533" Title="Timout on Entry Save if using Categories" Tags="&lt;categories&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6788" PostTypeId="2" ParentId="6765" CreationDate="2015-01-25T13:36:22.537" Score="13" Body="&lt;p&gt;You should be using &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContentFromPost()&lt;/a&gt; rather than &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContent-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContent()&lt;/a&gt;, so that field types have a chance to prep the values that you are passing in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See “&lt;a href=&quot;https://craftcms.stackexchange.com/q/4486/9&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;” for more info on how this stuff works.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-25T13:36:22.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6790" PostTypeId="1" AcceptedAnswerId="6794" CreationDate="2015-01-25T19:42:46.293" Score="1" ViewCount="766" Body="&lt;p&gt;I've went through several examples related to my issue, but I quite couldn't find What I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, there &lt;a href=&quot;https://craftcms.stackexchange.com/questions/64/how-to-write-simple-navigation&quot;&gt;was one&lt;/a&gt;, but with pre-defined array. &#xA;What I'm looking for is to only output all my sections, with link and title +  at the matched section's URL, display all entries belonging under relevant section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found here one snippet of code, which logic sounds about right to me, but it's like there's missing something.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = [] %}&#xA;{% for section in craft.sections.getAllSections() %}&#xA;{% if section.type == 'channel' %}&#xA;{% set sections = sections|merge([section]) %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help, or direction would be appreciated and I believe, it would help those, Who are like me at the beginning of this journey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-26T01:54:40.867" Title="How to build a navigation from sections" Tags="&lt;navigation&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6791" PostTypeId="2" ParentId="2788" CreationDate="2015-01-25T21:23:21.460" Score="2" Body="&lt;p&gt;I had a similar problem, ended up using multiple setAttribute() calls instead of setAttributes().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an array of attributes separately and then looped through them and called setAttribute for each one, seemed to do the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($id = $model-&amp;gt;getAttribute('id')) {&#xA;    if (null === ($record = $this-&amp;gt;myRecord-&amp;gt;findByPk($id))) {&#xA;            throw new Exception(Craft::t('Can\'t find item with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;        }&#xA;    } else {&#xA;        $record = $this-&amp;gt;myRecord-&amp;gt;create();&#xA;    }&#xA;&#xA;    /* Not this: */       &#xA;    $record-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;&#xA;    /* This instead: */&#xA;    $attributes = array(&#xA;        'column1' =&amp;gt; $col1,&#xA;        'column2' =&amp;gt; $col2&#xA;    );    &#xA;    foreach($attributes as $k =&amp;gt; $v) $record-&amp;gt;setAttribute($k,$v);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2223" LastActivityDate="2015-01-25T21:23:21.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6792" PostTypeId="1" AcceptedAnswerId="6803" CreationDate="2015-01-25T22:13:41.480" Score="3" ViewCount="1100" Body="&lt;p&gt;I have a category page displaying only the entries associated with the respective category. I have added a dynamic sub nav for categories using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% nav category in craft.categories.group('biographySection') %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to add an active class on the active link. Can’t figure out the best way to do this. Any help is appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code used to display the content from a selected category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bio = craft.entries.section('biographies').relatedTo(category).find() %}&#xA;{% for entry in bio %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2224" LastEditorUserId="2224" LastEditDate="2015-01-26T09:17:14.070" LastActivityDate="2015-01-26T10:29:12.250" Title="Adding active class to category link" Tags="&lt;categories&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6793" PostTypeId="2" ParentId="6792" CreationDate="2015-01-25T23:24:24.287" Score="2" Body="&lt;p&gt;If you're using the nav on an entries page, this is how you'd do that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check if an ElementCriteriaModel with the following criteria returns anything using the &lt;code&gt;length&lt;/code&gt; filter. The ID of the entries must match your current entry's ID and they must be related to the currently looped category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;    {% set activeClass = craft.entries.id(entry.id).relatedTo(category)|length ? 'active' %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;{{ activeClass }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-26T10:29:12.250" LastActivityDate="2015-01-26T10:29:12.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6794" PostTypeId="2" ParentId="6790" CreationDate="2015-01-26T00:14:14.973" Score="2" Body="&lt;p&gt;There is not really a very simple way to do this. One thing to keep in mind is that &lt;code&gt;channels&lt;/code&gt; and &lt;code&gt;structures&lt;/code&gt; do not have an 'index' page defined by default. Essentially there are no uri's for channels and structures as a whole, only for the entries within them. You need to create index pages yourself, using:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Singles&lt;/code&gt; (one for each of your index pages), or&lt;/li&gt;&#xA;&lt;li&gt;a &lt;code&gt;Structure&lt;/code&gt; (using different &lt;code&gt;EntryTypes&lt;/code&gt; for the different levels and/or page types), or&lt;/li&gt;&#xA;&lt;li&gt;Template files (placed directly in your templates folder)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The other problem is that you may have channels that do not represent pages at all, but are just collections of data to be used elsewhere; likewise, sections do not really have a way to define order. Overall not really a good mechanism to generate nav.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are, however, other ways to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution is to use a dedicated &lt;code&gt;Structure&lt;/code&gt; specifically for navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other pages as needed. You can then loop through that structure to generate your nav.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to define all of your top level pages (what might normally be considered singles) within a &lt;code&gt;structure&lt;/code&gt; using &lt;code&gt;EntryTypes&lt;/code&gt; to differentiate the various page types and define the field requirements (i.e. a structure called 'pages' for example). You can then loop through this structure to generate your nav, using the &lt;code&gt;EntryType&lt;/code&gt; to determine which template code to display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either of these techniques can be used with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of good examples of this on the exchange site. Also have a look at &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;craft's &lt;code&gt;nav&lt;/code&gt; tag in the documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-26T01:54:40.867" LastActivityDate="2015-01-26T01:54:40.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6795" PostTypeId="1" AcceptedAnswerId="6796" CreationDate="2015-01-26T02:23:44.353" Score="4" ViewCount="1133" Body="&lt;p&gt;Seems like I can't get the base install URL to work. To get Craft to show posts I have to format the URL as,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/public/index.php?p=news/2015/we-just-installed-craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of just the &lt;code&gt;/news/2015/we-just-installed-craft&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the &lt;code&gt;.htaccess&lt;/code&gt; is getting read because after putting in garbage the server did error out when I used the /public/ URL but not sure what else I'm doing wrong or how I could troubleshoot this.&lt;/p&gt;&#xA;" OwnerUserId="2226" LastEditorUserId="57" LastEditDate="2016-05-31T18:49:09.120" LastActivityDate="2016-05-31T18:49:43.343" Title="URL Redirect Not Working" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6796" PostTypeId="2" ParentId="6795" CreationDate="2015-01-26T02:28:11.917" Score="3" Body="&lt;p&gt;Try setting &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#usePathInfo&quot; rel=&quot;nofollow&quot;&gt;'usePathInfo' =&gt; true&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls&quot; rel=&quot;nofollow&quot;&gt;'omitScriptNameInUrls' =&gt; true&lt;/a&gt; in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-26T02:28:11.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6797" PostTypeId="1" CreationDate="2015-01-26T03:09:13.017" Score="1" ViewCount="50" Body="&lt;p&gt;I have come across a scenario where I need an event like &quot;onAssignUserToGroup&quot;. This is purely for a client request and to modify functionality in the backend CP for my plugin, but this is the second time the need for something like this has arisen in the past one month. I have created the event in the userGroups service for now but it will be overridden by updates hence I would appreciate it if something like this was added to the official craft codebase. If that is not possible then let me know if there is another way to get something similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my craft/app/UserGroupsService.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function assignUserToGroups($userId, $groupIds = null)&#xA;{&#xA;    craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;delete('usergroups_users', array('userId' =&amp;gt; $userId));&#xA;&#xA;    if ($groupIds)&#xA;    {&#xA;        if (!is_array($groupIds))&#xA;        {&#xA;            $groupIds = array($groupIds);&#xA;        }&#xA;&#xA;        foreach ($groupIds as $groupId)&#xA;        {&#xA;            $values[] = array($groupId, $userId);&#xA;        }&#xA;&#xA;        craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;insertAll('usergroups_users', array('groupId', 'userId'), $values);&#xA;&#xA;        *// Custom event&#xA;        $this-&amp;gt;onAssignUserToGroup(new Event($this, array(&#xA;            'userId'   =&amp;gt; $userId,&#xA;            'groupIds' =&amp;gt; $groupIds&#xA;        )));*&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is partly what I have done for now.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-01-26T03:09:13.017" Title="An extra event upon usergroup assignment onAssignUserToGroup" Tags="&lt;users&gt;&lt;user-groups&gt;&lt;services&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2015-02-20T01:24:51.463" ContentLicense="CC BY-SA 3.0" />
  <row Id="6798" PostTypeId="1" AcceptedAnswerId="6800" CreationDate="2015-01-26T05:47:54.633" Score="6" ViewCount="9098" Body="&lt;p&gt;For templating, I need to be able to see what the categories of the current entry is. I'm aware of how to get all categories in craft via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however I haven't come across a way to simple get the categories that are set for the entry. Is there a simple way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2018-10-09T00:52:41.330" Title="Get categories for current page/entry" Tags="&lt;templating&gt;&lt;category&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6799" PostTypeId="1" AcceptedAnswerId="6801" CreationDate="2015-01-26T05:55:03.210" Score="4" ViewCount="1728" Body="&lt;p&gt;We're working on an XML import plugin to migrate content from another CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to create a new category (with a name, slug etc.) and assign it to the entry when running &#xA;&lt;code&gt;$entryModel = new EntryModel();&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2016-12-04T14:16:42.910" Title="Best way to programmatically create categories?" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;import&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6800" PostTypeId="2" ParentId="6798" CreationDate="2015-01-26T06:32:46.080" Score="16" Body="&lt;p&gt;You can access the categories through the category field itself. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.categoryFieldHandle %}&#xA;    {{ category.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-26T06:32:46.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6801" PostTypeId="2" ParentId="6799" CreationDate="2015-01-26T09:06:26.710" Score="6" Body="&lt;p&gt;To create a category, you'd have to use the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/CategoriesService#saveCategory-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;categories-&amp;gt;saveCategory()&lt;/code&gt;&lt;/a&gt; method, and feed it a CategoryModel. Having done that, you can use the ID of your new category to create an array for the entry's category field (in this example its handle is &lt;code&gt;categoryFieldHandle&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$category = new CategoryModel();&#xA;$category-&amp;gt;groupId = 2; // Or whatever ID your new category's group has.&#xA;$category-&amp;gt;getContent()-&amp;gt;title = 'My new category title'; // Slug will be automagically created&#xA;&#xA;if(craft()-&amp;gt;categories-&amp;gt;saveCategory($category)) {&#xA;    $entryModel = new EntryModel();&#xA;    $entryModel-&amp;gt;title = 'My entry's title';&#xA;    $entryModel-&amp;gt;categoryFieldHandle[] = $category-&amp;gt;id;&#xA;&#xA;    if(craft()-&amp;gt;entries-&amp;gt;saveEntry($entryModel)) {&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="67" LastEditDate="2015-01-27T03:33:52.573" LastActivityDate="2015-01-27T03:33:52.573" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6802" PostTypeId="2" ParentId="6798" CreationDate="2015-01-26T09:32:15.807" Score="5" Body="&lt;p&gt;If might be your wording but I can see two potential answers here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You either want to list categories set through a category field on the entry, in that case the code Douglas has supplied will work perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other answer I can see is you have multiple categories that are assigned to an entry, and you want to list those categories out. If so, this will help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the categories related to this entry #}&#xA;{% set categories = craft.categories.relatedTo(entry) %}&#xA;&#xA;{# Output them #}&#xA;{% for category in categories %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully myself and Douglas have covered both bases for you here.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-01-26T09:32:15.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6803" PostTypeId="2" ParentId="6792" CreationDate="2015-01-26T10:16:02.900" Score="2" Body="&lt;p&gt;If you're using the nav on a category page, this should do what you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to name your two category variables differently, so that you can compare them in the &lt;code&gt;nav&lt;/code&gt; loop. So let's get the currently displayed category using &lt;code&gt;getLastSegment()&lt;/code&gt; and save the CategoryModel to a var &lt;code&gt;currentCategory&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getLastSegment() %}&#xA;{% set currentCategory = craft.categories.group('compositions').slug(categorySlug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The CategoryModel that is returned from the loop we simply name &lt;code&gt;category&lt;/code&gt;. Within the loop compare the IDs of the two CategoryModels.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('biographySection') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {% set activeClass = category.id == currentCategory.id ? 'active' %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;{{ activeClass }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-26T10:27:58.180" LastActivityDate="2015-01-26T10:27:58.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6804" PostTypeId="1" AcceptedAnswerId="6806" CreationDate="2015-01-26T10:50:37.517" Score="1" ViewCount="196" Body="&lt;p&gt;Is this the most efficient way to use matrix in a template where different block types need outputting in various area of the HTML markup? I have 9 block types that need to be placed in various areas of the HTML markup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Create a variable with the matrix fields in #}&#xA;{% set var = entry.sofa %}&#xA;&#xA;{# Is the block in the variable #}&#xA;{% if var.block.type('twoSeaterSofa') %}&#xA;&#xA;    {# block is in variable #}&#xA;    {% for block in var.block.type('twoSeaterSofa') %}      &#xA;        {# output block #}&#xA;        {{ block.price }}&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Grateful for any advice or code.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="122" LastEditDate="2015-01-26T13:43:20.023" LastActivityDate="2015-01-26T13:43:20.023" Title="What is the most efficient way to code matrix blocks by type in a template?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6805" PostTypeId="2" ParentId="6804" CreationDate="2015-01-26T11:18:05.467" Score="2" Body="&lt;p&gt;There are multiple ways of doing this, this is mine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through all blocks and include a file with the block's type(slug) #}&#xA;{% for block in entry.matrixFieldHandle %}&#xA;    {% include &quot;includes/blockTypes/_&quot; ~ block.type ignore missing %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, you need a folder, for instance &lt;code&gt;blockTypes&lt;/code&gt;, within a folder &lt;code&gt;includes&lt;/code&gt; (or whatever path you'd want to give those), with a file for every Matrix block type, prepended with '_'. I find this easy to work with, especially when dealing with large numbers of types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;ignore missing&lt;/code&gt; part of the include makes sure that you don't get errors if a file is not found. So, if nothing gets displayed, chances are one or more files don't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within your include, you only use the code needed to show that type's fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.price }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-26T11:18:05.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6806" PostTypeId="2" ParentId="6804" CreationDate="2015-01-26T12:31:32.520" Score="3" Body="&lt;p&gt;The right syntax to filter matrix blocks by block type is this (see &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;Craft docs here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.type('text') %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you only have to remove the extra &lt;code&gt;.block&lt;/code&gt; you have in your example code. I'd save the returned array of MatrixBlockModels to a variable and use the &lt;code&gt;length&lt;/code&gt; filter to see if there are any blocks of this type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set twoSeaterSofas = entry.sofa.type('twoSeaterSofa') %}&#xA;{% set threeSeaterSofas = entry.sofa.type('threeSeaterSofas') %}&#xA;&#xA;&amp;lt;!-- some HTML --&amp;gt;&#xA;&#xA;{% if twoSeaterSofas|length %}&#xA;    {% for block in twoSeaterSofas %}    &#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;!-- more HTML --&amp;gt;&#xA;&#xA;{% if threeSeaterSofas|length %}&#xA;    {% for block in threeSeaterSofas %}    &#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-26T12:31:32.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6807" PostTypeId="1" AcceptedAnswerId="6809" CreationDate="2015-01-26T12:58:14.270" Score="4" ViewCount="440" Body="&lt;p&gt;Just getting around to adding advanced layout features to our site, when I say advanced I just mean floated images left &amp;amp; right. The problem I seem to have though is that &lt;code&gt;left&lt;/code&gt; is always the default position. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a way around it if I disable left &amp;amp; right and use drop-left &amp;amp; drop-right but I think it would be more usable if we were able to set a default.&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-01-26T17:50:32.623" Title="How do I select a default in the Position Select field?" Tags="&lt;field&gt;&lt;position&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6808" PostTypeId="1" AcceptedAnswerId="6810" CreationDate="2015-01-26T15:31:59.280" Score="2" ViewCount="2689" Body="&lt;p&gt;Newbie here with hopefully a simple question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure as per the image below where I want to only show the parent item and it's children on their pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to exclude the other entries but they should show on their own pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bxzXd.jpg&quot; alt=&quot;My structure&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2196" LastActivityDate="2018-01-22T21:57:20.740" Title="Show parent and it's children as a nav" Tags="&lt;structure&gt;&lt;navigation&gt;&lt;children&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6809" PostTypeId="2" ParentId="6807" CreationDate="2015-01-26T16:21:12.430" Score="3" Body="&lt;p&gt;As there's no settings option to define a default, there's two things you can do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Copy / fork the field type and add the option or simply hack it to your needs.&lt;/li&gt;&#xA;&lt;li&gt;Contact P&amp;amp;T and make a feature request for setting field type defaults for Position select (and others).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-26T17:50:32.623" LastActivityDate="2015-01-26T17:50:32.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6810" PostTypeId="2" ParentId="6808" CreationDate="2015-01-26T17:25:29.493" Score="6" Body="&lt;p&gt;You can access children through the entry's &lt;code&gt;descendants&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# display event-information #}&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {# display subsections #}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for subsection in entry.descendants %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ subsection.url }}&quot;&amp;gt;{{ subsection.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use the &lt;code&gt;nav&lt;/code&gt; tag, as described &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More generally speaking, you can use any of the following properties of the &lt;a href=&quot;https://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; to traverse the structure: &lt;code&gt;parent&lt;/code&gt;, &lt;code&gt;children&lt;/code&gt;, &lt;code&gt;descendants&lt;/code&gt;, &lt;code&gt;ancestors&lt;/code&gt;, &lt;code&gt;siblings&lt;/code&gt;, &lt;code&gt;nextSibling&lt;/code&gt;, &lt;code&gt;prevSibling&lt;/code&gt;, and &lt;code&gt;level&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="273" LastEditDate="2018-01-22T21:57:20.740" LastActivityDate="2018-01-22T21:57:20.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6812" PostTypeId="1" CreationDate="2015-01-26T23:42:49.390" Score="2" ViewCount="958" Body="&lt;p&gt;What is the best way to work with non-craft database tables as models?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a given table and I should render its records with multiple filtering and pagination. Importing them to entries is not an option, the table is always changing. So I would like to use as an ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where should I get started? Writing a plugin is the only way? Iy yes, how can I create a model from this external table?&lt;/p&gt;&#xA;" OwnerDisplayName="user516" LastActivityDate="2015-02-01T01:01:42.347" Title="Working with non-craft database table" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6813" PostTypeId="1" CreationDate="2015-01-27T00:04:23.150" Score="1" ViewCount="292" Body="&lt;p&gt;I figure I must need to pass the current user's password along with the updated email address upon form submit. However, I cannot get the email address change to take. Any help is greatly appreciated. Here's my code snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; class=&quot;account-edit&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;password&quot; value=&quot;{{ currentUser.password }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {% if currentUser.firstName %}&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;            &amp;lt;input name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if currentUser.lastName %}&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;            &amp;lt;input name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if currentUser.email %}&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;            &amp;lt;input name=&quot;email&quot; value=&quot;{{ currentUser.email }}&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {# Check to see if the user has a photo  #}&#xA;    {% if currentUser.photoUrl %}&#xA;        &amp;lt;label for=&quot;userPhoto&quot;&amp;gt;Edit Photo&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;figure&amp;gt;&#xA;                &amp;lt;div class=&quot;cover&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ currentUser.photoUrl (100) }}&quot; /&amp;gt;&#xA;                &amp;lt;a href=&quot;#&quot; id=&quot;deleteUserPhotoAction&quot; class=&quot;&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/figure&amp;gt;&#xA;            {# If a photo exists, give the option to change the user photo #}          &#xA;            &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Change Photo&quot;&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;&#xA;    {# If no photo exists, give the option to upload a new one #}&#xA;        &amp;lt;label for=&quot;userPhoto&quot;&amp;gt;Upload Photo&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;figure&amp;gt;&amp;lt;img src=&quot;/assets/img/user.gif&quot; /&amp;gt;&amp;lt;/figure&amp;gt;&#xA;            &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Update Account&quot; class=&quot;btn profile-save&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2229" LastEditorUserId="3951" LastEditDate="2017-12-10T15:21:17.970" LastActivityDate="2017-12-10T15:21:17.970" Title="I cannot get the email address to properly update from my user account management form" Tags="&lt;frontend&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6814" PostTypeId="2" ParentId="6813" CreationDate="2015-01-27T03:24:32.370" Score="3" Body="&lt;p&gt;As of Craft 2.3, the rules for changing an existing password are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're editing your existing account OR you're an administrator OR you have the 'changeUserEmails' permission set on your user account, then you need to supply &lt;em&gt;your&lt;/em&gt; existing user account's password as a hidden input (not the current password for the account you're trying to change).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;currentPassword&quot; name=&quot;password&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3951" LastEditDate="2017-12-04T18:38:22.973" LastActivityDate="2017-12-04T18:38:22.973" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6815" PostTypeId="1" AcceptedAnswerId="6816" CreationDate="2015-01-27T06:40:15.267" Score="1" ViewCount="863" Body="&lt;p&gt;I have a Structure that has the URL setup like this..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top-Level Entries - {slug}&lt;br/&gt;&#xA;Nested Entries - {parent.uri}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I list all entries that have the same segment1 of their URL as to what is on the current page the user is on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e if I am on page  &lt;a href=&quot;http://example.com/vacation&quot; rel=&quot;nofollow&quot;&gt;http://example.com/vacation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to list all structure entries that have 'vacation' as the first segment of the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e &lt;/p&gt;&#xA;&#xA;&lt;p&gt;/vacation/snow&lt;br/&gt;&#xA;/vacation/coastal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it would not show any entries from the structure that are like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/advice/what-to-bring&lt;br/&gt;&#xA;/advice/weather-warnings&lt;br/&gt;&#xA;/contact&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically I want to do this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if segment1 = entry url segment1 display entries.  &lt;/p&gt;&#xA;" OwnerUserId="2196" LastActivityDate="2015-01-27T07:49:34.693" Title="if entry has same url segment" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6816" PostTypeId="2" ParentId="6815" CreationDate="2015-01-27T07:42:41.870" Score="3" Body="&lt;p&gt;Since you already have an &lt;code&gt;entry&lt;/code&gt; in the same &lt;code&gt;structure&lt;/code&gt;, the simplest method is probably to use the &lt;code&gt;parent&lt;/code&gt; and &lt;code&gt;descendants&lt;/code&gt; properties of the &lt;a href=&quot;https://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry.parent.descendants %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A more round about way would be to get the segment through &lt;code&gt;craft.request.segment&lt;/code&gt;, use that to get the entry, and use &lt;code&gt;descendants&lt;/code&gt; to get the children.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment = craft.request.segment(1) %}&#xA;{% set entries = craft.entries.section('myStructureHandle').slug(segment).first.descendants %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you only want the &lt;code&gt;siblings&lt;/code&gt; without the current entry, you could use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry.siblings %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-27T07:49:34.693" LastActivityDate="2015-01-27T07:49:34.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6817" PostTypeId="2" ParentId="5358" CreationDate="2015-01-27T09:33:25.370" Score="1" Body="&lt;p&gt;I had a huge mess and I started all over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats the code which works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {# Gets the bla section #}&#xA;        {% for entry in craft.entries.section('bla') %}&#xA;          {# Gets the blog section related to bla #}&#xA;          {% set relatedBLogs = craft.entries.section('blog').relatedTo(entry) %}&#xA;          {% for entries in relatedBLogs %}&#xA;             &amp;lt;a href=&quot;{{ entries.url }}&quot;&amp;gt;{{ entries.title }}&amp;lt;/a&amp;gt;&#xA;          {% endfor %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought I had to specify the entries fields but Craft determines the relational field without any declaration :O &lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2015-01-27T09:41:02.990" LastActivityDate="2015-01-27T09:41:02.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6818" PostTypeId="1" AcceptedAnswerId="6820" CreationDate="2015-01-27T13:03:45.290" Score="2" ViewCount="1214" Body="&lt;p&gt;I did find &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4796/is-it-possible-exclude-an-entry-type-from-result-of-craft-entries&quot;&gt;this post&lt;/a&gt; while looking to do something similar, but I'm beginning to wonder if there's a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With code along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(&quot;pages&quot;).type(&quot;not landing&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm unexpectedly getting no results. Looking at the logs, it's generating queries that includes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM `craft_entrytypes` `t` WHERE `t`.`handle`='not landing'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to think this is at least partly responsible for getting no results. Could anyone point out if I've got the syntax wrong or something?&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-01-27T15:31:16.343" Title="How to exclude entries by type?" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6819" PostTypeId="1" CreationDate="2015-01-27T14:41:44.860" Score="1" ViewCount="417" Body="&lt;p&gt;Would it be possible to have a cleaner site setup without all those 'locale' subfolders in the webroot? Somehow it looks like there's something similar already done here (&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/services/HttpRequestService.php#L99&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/services/HttpRequestService.php#L99&lt;/a&gt;) if I'm not wrong, wouldn't it be nicer to also just remove the locale if one is detected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus question :) :&#xA;Where in the hell is the actual Entry Slug -&gt; Template resolving done? I know there's a lot of stuff happening with filters, action and resource requests. The closest I could get is that here the template/render controller gets triggered (&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/framework/web/CWebApplication.php#L274&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/framework/web/CWebApplication.php#L274&lt;/a&gt;) which in the end resolves to the action render method in the TemplatesController (&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/controllers/TemplatesController.php#L50&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/controllers/TemplatesController.php#L50&lt;/a&gt;), already with the correct $template parameter set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone guide me in a direction here? &lt;/p&gt;&#xA;" OwnerUserId="1119" LastEditorUserId="57" LastEditDate="2018-02-21T23:42:54.630" LastActivityDate="2018-02-21T23:42:54.630" Title="Multi-lingual site without subfolders" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6820" PostTypeId="2" ParentId="6818" CreationDate="2015-01-27T14:47:17.303" Score="5" Body="&lt;p&gt;&lt;code&gt;.type(&quot;not landing&quot;)&lt;/code&gt; won't work. If you reread the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4796/is-it-possible-exclude-an-entry-type-from-result-of-craft-entries&quot;&gt;post you linked&lt;/a&gt; it also states this — I believe it was more of a feature request. You will need to test each entry and either use it directly or merge it into an array for later use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;pages&quot;) %}&#xA;{% for entry in entries if entry.type != &quot;landing&quot; %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filteredEntries = [] %}&#xA;{% set entries = craft.entries.section(&quot;pages&quot;) %}&#xA;{% for entry in entries if entry.type != &quot;landing&quot; %}&#xA;    {% set filteredEntries = filteredEntries|merge(entry) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a side note, if you are using a &lt;code&gt;structure&lt;/code&gt; with a hierarchy where landing pages are at the root level and all other entries are children, then you can also use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;pages&quot;).level('&amp;gt; 1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-01-27T14:52:31.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6821" PostTypeId="1" CreationDate="2015-01-27T15:30:58.827" Score="3" ViewCount="2519" Body="&lt;p&gt;We're doing a rebrand and web overhaul for a Christian camp, retreat, and conference center. A big part of the site is a registration system where people can register for an event, fill out a detailed form with 30+ fields, then pay for registration. The forms will be pretty complex... people can do partial payments (via stripe), and each of the forms (10 or more) will be unique with conditional fields.  We're also hoping to hand off the form creation process to the client afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only plugin I know that can handle something like this easily is GravityForms for WordPress, but I don't want to go the WP route. Is there anything like it out there for Craft? Or is Craft still too much in its infancy? Maybe a 3rd party form builder that will integrate nicely w/Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or guidance is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2232" LastActivityDate="2018-02-02T21:25:24.467" Title="Robust Form Plugins for Craft?" Tags="&lt;form&gt;&lt;registration&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6822" PostTypeId="2" ParentId="6818" CreationDate="2015-01-27T15:31:16.343" Score="4" Body="&lt;p&gt;What about first getting all the landing page entries, and then use these entries' IDs prefixed with &lt;code&gt;'not'&lt;/code&gt; (works with IDs!) in the ID param of a second ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set landingPageIds = craft.entries.section('pages').type('landing').ids() %}    &#xA;{% set idParam = 'and, not ' ~ landingPageIds|join(', not ') %}&#xA;{% set pagesWithoutLanding = craft.entries.section('pages').id(idParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-27T15:31:16.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6823" PostTypeId="2" ParentId="6821" CreationDate="2015-01-27T15:49:09.403" Score="2" Body="&lt;p&gt;Until the plugin store becomes an official thing, &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt; has the most comprehensive list of plugins available for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Glancing through there, there are &lt;a href=&quot;http://straightupcraft.com/craft-plugins/formerly&quot; rel=&quot;nofollow&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;http://straightupcraft.com/craft-plugins/form-builder&quot; rel=&quot;nofollow&quot;&gt;form&lt;/a&gt; &lt;a href=&quot;http://straightupcraft.com/craft-plugins/sprout-forms&quot; rel=&quot;nofollow&quot;&gt;building&lt;/a&gt; possibilities that might do what you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-27T15:49:09.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6824" PostTypeId="1" CreationDate="2015-01-27T16:57:24.647" Score="1" ViewCount="607" Body="&lt;p&gt;I have two clients using Craft and their hosts will not allow ini_set as they have it as a disabled function in the global php.ini.  I also can't enable in througth a custom php.ini.  Is there any way to modify Craft to get past the ini_set issues?  I have the site all setup, the pages work locally, when I upload to the server we just see a blank page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice is appreciated as they both do not want to change hosts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="125" LastEditDate="2015-05-29T15:07:21.233" LastActivityDate="2015-05-29T15:07:21.233" Title="Any code fixes for &quot;ini_set() has been disabled for security reasons&quot;" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6825" PostTypeId="2" ParentId="6821" CreationDate="2015-01-27T17:18:38.380" Score="3" Body="&lt;p&gt;Commerce is definitely Craft's achilles' heel right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you, I'd love to switch over completely off WP but picking the best tool for the job means either rolling up your sleeves and writing your own or picking the best available solution and unfortunately that could be WP/Gravity... at least right now.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We're also hoping to hand off the form creation process to the client afterwards.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not to go too far off the Craft path here, but from a client services perspective, this part scares the hell of me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forms tend to be tricky beasts to begin with—especially so when you add in the commerce part of it.&lt;br&gt;&#xA;I don't know what your registration forms look like but I'm guessing a lot of them are going to be very similar. Do you actually need a form builder to put in name, address, etc. Or is the only thing that changes on the form the retreat date, lodging location, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do a lot with Craft's custom fields and instead of building up a form like in Gravity or Ninja (like you might do in WP), bake in those fields that won't change in your template and just let the client change a few pieces from the back end—like the date, price, etc.—and compose the rest of the form with Twig and an action handler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless of whatever technology you pick, this kind of project tends to need ongoing support as well so if you can do it, get the client on some kind of monthly retainer; that'll remove a lot of the uncertainty as you move forward. Sometimes what clients say they need and what they actually end up needing is completely  different. Craft is going to grow as a platform too, so basically you're buying some time as the client grows with it. It's a nice sentiment to think you just &quot;hand it off&quot; but in my experience, it rarely works like that. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-01-27T17:24:24.017" LastActivityDate="2015-01-27T17:24:24.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6826" PostTypeId="2" ParentId="6821" CreationDate="2015-01-27T18:10:11.483" Score="1" Body="&lt;p&gt;For the couple projects where I absolutely needed the client to be able to create complex forms like you describe, I ended up just using Wufoo. There's just nothing else available for Craft (that I know of) that is anywhere close to its feature-set. I ended up writing a very simple fieldtype that authenticates with the Wufoo API and allows you to select one of the forms from a drop-down, and then output the embed code into your template with a single tag. You can get it here: &lt;a href=&quot;https://github.com/elivz/VzWoofer-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/elivz/VzWoofer-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple big downsides, though: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Wufoo gives you very limited control over the form styling, so it will probably not look entirely &quot;in place&quot; in your design. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The client still needs to go log into Wufoo to create or edit the forms. I should probably add a shortcut link to the field to make that a little easier.... &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My plugin is definitely beta, but if you decide to use it and run into any problems I will do my best to help, or pull-requests are always welcome!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="62" LastEditorUserId="5437" LastEditDate="2017-11-16T16:06:19.703" LastActivityDate="2017-11-16T16:06:19.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6827" PostTypeId="2" ParentId="6655" CreationDate="2015-01-27T18:34:06.270" Score="5" Body="&lt;p&gt;To get this working, you will need to find a way to continue passing all of your form’s values to each of the additional pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few ways you could do that, but the easiest and best option is to change your search form’s &lt;code&gt;method&lt;/code&gt; attribute to &lt;code&gt;&quot;get&quot;&lt;/code&gt; rather than &lt;code&gt;&quot;post&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;get&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Side note: there’s no need to add &lt;code&gt;action=&quot;&quot;&lt;/code&gt; – the default browser behavior if that attribute is omitted is for the form to submit to the current URL.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when you submit your form you will see all of the form values show up in the resulting page’s query string. While that’s not quite as nice-looking, its advantages outweigh the ugly: browsers won’t ask users if they are sure they want to resubmit a form when they click the Back/Forward buttons, and the URLs will be sharable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to update your pagination links to include the query string, which will effectively pass on the form’s values between each of the pages. We’ll use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getQueryStringWithoutPath&quot;&gt;craft.request.getQueryStringWithoutPath()&lt;/a&gt; for that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set qs = '?' ~ craft.request.getQueryStringWithoutPath() %}&#xA;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.firstUrl ~ qs }}&quot; title=&quot;First Page&quot;&amp;gt;&amp;amp;laquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% if paginate.prevUrl %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.prevUrl ~ qs }}&quot; title=&quot;Previous Page&quot;&amp;gt;&amp;amp;lsaquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;{% for page, url in paginate.getPrevUrls(4) %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url ~ qs }}&quot; title=&quot;Page {{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;li class=&quot;current&quot;&amp;gt;&amp;lt;a href=&quot;&quot; title=&quot;Page {{ paginate.currentPage }}&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% for page, url in paginate.getNextUrls(4) %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url ~ qs }}&quot; title=&quot;Page {{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;{% if paginate.nextUrl %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.nextUrl ~ qs }}&quot; title=&quot;Next Page&quot;&amp;gt;&amp;amp;rsaquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.lastUrl ~ qs }}&quot; title=&quot;Last Page&quot;&amp;gt;&amp;amp;raquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-01-27T18:34:06.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6828" PostTypeId="2" ParentId="6819" CreationDate="2015-01-27T19:41:49.133" Score="2" Body="&lt;p&gt;I'm not exactly sure what you are trying to achieve, but here is a way to have unlimited locales with only a single subfolder in your public root directory.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Put all of your locale subfolders into a single folder, called &lt;code&gt;locales&lt;/code&gt; for example. So your directory structure would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public/locales/de/&#xA;public/locales/es/&#xA;public/locales/fr/&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure you update the craft path in each locale's &lt;code&gt;index.php&lt;/code&gt; file accordingly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../../../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then you just need the following code in your root &lt;code&gt;.htaccess&lt;/code&gt; file to redirect to the appropriate subfolder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect locales&#xA;RewriteCond %{REQUEST_URI} ^/(de|es|fr)/ [NC]&#xA;RewriteRule (.+) /locales/$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-01-27T19:41:49.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6829" PostTypeId="2" ParentId="6824" CreationDate="2015-01-27T20:00:13.860" Score="1" Body="&lt;p&gt;Well, the code fix is to put an @ sign before every call to &lt;code&gt;ini_set&lt;/code&gt; that Craft makes and all of Craft's dependencies in &lt;code&gt;craft/app/vendor&lt;/code&gt; suppressing the error message &lt;code&gt;@ini_set()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I definitely wouldn't recommend that as you'll have to maintain some 40+ hacks across nearly as many files that could get blown away during any auto-update.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-27T20:00:13.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6830" PostTypeId="1" CreationDate="2015-01-27T21:39:02.203" Score="2" ViewCount="604" Body="&lt;p&gt;I have a Structure area where there will be 20-24 top level pages for degrees, each with similar (but different) subpages…&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Masters in Accountancy&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Courses by Year&lt;/li&gt;&#xA;&lt;li&gt;Degree Requirements&lt;/li&gt;&#xA;&lt;li&gt;…etc. x12 or so.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Masters in Business Administration&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Courses by Semester&lt;/li&gt;&#xA;&lt;li&gt;Degree Requirements&lt;/li&gt;&#xA;&lt;li&gt;…etc. x12 or so.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;…etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It would be super ideal (and save a lot of time) is if I could setup the tree for just on of the degrees, then duplicate it 20 times and use it as a starting point for the others degrees. Has anybody managed to pull something like this off? Guessing I'd have to do it directly in the DB? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I should mention that because of the variety/flexibility in content around each degree, having a degree channel isn't a good fit for this case. In total, it's much more like a docs section.)&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2015-01-28T00:13:34.447" Title="Duplicate a Structure &quot;Section&quot;" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6831" PostTypeId="2" ParentId="6830" CreationDate="2015-01-27T22:03:04.897" Score="4" Body="&lt;p&gt;I tend to try hard to avoid making changes directly to the DB if at all possible. It's a good feature idea that isn't built into Craft, so I think a custom plugin might be a good option. It'd be easy enough to build and then you'd have it readily available for other projects in the future.&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2015-01-27T22:03:04.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6832" PostTypeId="1" AcceptedAnswerId="6834" CreationDate="2015-01-27T22:29:38.500" Score="1" ViewCount="676" Body="&lt;p&gt;I have succsefully managed to filter entries by matching an url segment to a Radio Buttons Field in my entries, like this:&#xA;(here &lt;strong&gt;category&lt;/strong&gt; is the field handle of my Radio Buttons field)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filteredEntries = craft.entries.section('news').category(craft.request.getSegment(2)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After having to change the Radio Buttons Field to a Checkboxes Field I tried adapting my code like this:&#xA;(here &lt;strong&gt;category&lt;/strong&gt; is the field handle of my Checkboxes Field)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filteredEntries = craft.entries.section('news').category.contains(craft.request.getSegment(2)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't work. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2015-01-28T12:55:12.767" Title="Filter entries by matching an url segment to Checkboxes Field values" Tags="&lt;entries&gt;&lt;filter&gt;&lt;getsegment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6833" PostTypeId="2" ParentId="6830" CreationDate="2015-01-28T00:13:34.447" Score="3" Body="&lt;p&gt;I wouldn't touch the DB directly but have you considered doing this via a CSV import? You could setup all your pages right in Excel or OpenOffice or whatever you like and then import the content using &lt;a href=&quot;https://github.com/boboldehampsink/import/&quot; rel=&quot;nofollow&quot;&gt;Bob Olde Hampsink's import plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can setup the hierarchy right in the file using the Title as the Parent entry IIRC (in your case the Course name).  I've used this when importing from other CMSes into Craft and it works great but I'd imagine it'd be pretty handy in this case as well. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-01-28T00:13:34.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6834" PostTypeId="2" ParentId="6832" CreationDate="2015-01-28T00:42:45.067" Score="2" Body="&lt;p&gt;This is just a guess, as I've never used the 'contains' method before, but it's possible that it can't be used directly with an ElementCriteriaModel query. You might have to filter the entries after the fact.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;{% for entry in entries if entry.category.contains(craft.request.getSegment(2)) %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This probably defeats the purpose of using it as a psuedo-category selector however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; If &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1979/can-entries-be-returned-based-on-checkbox-selection&quot;&gt;this answer&lt;/a&gt; is any indication it also looks like you could use the &lt;code&gt;search&lt;/code&gt; method. Using this method, however, may not be 100% reliable if the search index becomes outdated for whatever reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entries = craft.entries.section('news').search('category:' ~ craft.request.getSegment(2)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-28T08:59:19.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6835" PostTypeId="2" ParentId="6821" CreationDate="2015-01-28T07:47:48.297" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; (currently 0.8.5) can build Forms with hundreds of fields, tabs, allows you to give your client control over the forms (using the same Field Layout editor as Craft), and can output forms dynamically on the front-end (so your client never needs to touch the templates).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We support several common fields right out of the box, and are working on a way to allow you to add support for additional fields for dynamic output on the front-end based on your project needs. Sprout Forms integrates with &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow&quot;&gt;Sprout Email&lt;/a&gt; if you have needs for lots of control over notifications and &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/reports&quot; rel=&quot;nofollow&quot;&gt;Sprout Reports&lt;/a&gt; if you need to get your data out of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't support conditional fields yet (hoping to piggy back on Craft on that one!), but you could create a custom field and add support to have it output dynamically on the front-end with whatever behavior you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't support payments &lt;em&gt;yet!&lt;/em&gt;, but do have an expertise around e-commerce and interest in adding an e-commerce integration to Sprout Forms at some point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd agree with most other posts here at this time. You're use case is definitely pushing the boundaries of available features right now and need to consider all your options. Conditional fields, more advanced fields, and commerce functionality all may require some degree of custom development to meet your needs.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-01-28T07:47:48.297" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6836" PostTypeId="2" ParentId="1753" CreationDate="2015-01-28T07:52:08.113" Score="1" Body="&lt;p&gt;I looked into this extensively and the one thing I found is that if your element type uses a custom content table, the save procedure will be done properly but when Craft needs to display the asset in the index, inside an asset selection modal, or an asset field, it simply won't look in the right place and unless you copy your asset's locale and title to the Craft content table from your custom content table, it won't show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made @Brad aware of this but they haven't fix it yet, at least not in the last release that I can tell.&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2015-01-28T07:52:08.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6837" PostTypeId="1" AcceptedAnswerId="6838" CreationDate="2015-01-28T10:24:07.217" Score="8" ViewCount="1459" Body="&lt;p&gt;Is it possible to build the following/is it the right way in Craft. Been through the docs and searched but stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just need to build a form on one page with a dropdown select for 2 categories;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Location&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That then takes the user to the results page and returns entries where the location and type match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone be so kind as to provide a sample to get me going please?&lt;/p&gt;&#xA;" OwnerUserId="2236" LastEditorUserId="344" LastEditDate="2015-01-28T17:38:24.793" LastActivityDate="2015-01-29T15:42:46.980" Title="Building a simple search by multiple categories" Tags="&lt;categories&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6838" PostTypeId="2" ParentId="6837" CreationDate="2015-01-28T11:54:26.267" Score="8" Body="&lt;p&gt;Building the form is pretty straightforward, you get the categories from your &quot;locations&quot; and &quot;types&quot; &lt;a href=&quot;http://buildwithcraft.com/docs/categories#category-groups&quot;&gt;category groups&lt;/a&gt; using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot;&gt;&lt;code&gt;craft.categories&lt;/code&gt;&lt;/a&gt;&#xA;and loop them to build your select options. I choose to pass the category's slug as the value to submit and /results as the URL to submit to. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('results') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;location&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;all locations&amp;lt;/option&amp;gt;&#xA;        {% set categories = craft.categories.group('locations') %}&#xA;        {% for category in categories %}&#xA;            &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;label&amp;gt;Type&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;type&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;all types&amp;lt;/option&amp;gt;&#xA;        {% set categories = craft.categories.group('types') %}&#xA;        {% for category in categories %}&#xA;            &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting the entries that are related to categories from both, one or non of your category groups is a little bit more tricky.&#xA;In case a category in both select options is selected, you need to use the following syntax for your &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter&#xA;(see Craft docs: &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&quot;The relatedTo Param - Passing Multiple Relation Criteria&quot;&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cocktails = craft.entries.section('cocktails').relatedTo('and',&#xA;    { sourceElement: currentUser, field: 'favoriteCocktails' },&#xA;    { targetElement: gin, field: 'ingredients' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suggest to compose the value for the &lt;code&gt;relatedTo&lt;/code&gt; parameter starting with an array &lt;code&gt;['and']&lt;/code&gt; and then build upon this array,&#xA;conditionally adding array elements (relation conditions) using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the search data #}&#xA;{% set locationParam = craft.request.getParam('location') %}&#xA;{% set typeParam = craft.request.getParam('type') %}&#xA;&#xA;{# Compose the relation param #}&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{% if locationParam %}&#xA;    {% set location = craft.categories.group('locations').slug(locationParam).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: location }]) %}&#xA;{% endif %}&#xA;&#xA;{% if typeParam %}&#xA;    {% set type = craft.categories.group('types').slug(typeParam).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: type }]) %}&#xA;{% endif %}&#xA;&#xA;{# Avoid passing an array with `['and']` only #}&#xA;{% if relationParam|length &amp;lt; 2 %}&#xA;    {% set relationParam = '' %}&#xA;{% endif %}&#xA;&#xA;{# Find and list matching entries #}&#xA;{% set entries = craft.entries.relatedTo(relationParam) %}&#xA;&#xA;{% if entries|length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    No entries found.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-29T15:42:46.980" LastActivityDate="2015-01-29T15:42:46.980" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6839" PostTypeId="2" ParentId="6832" CreationDate="2015-01-28T12:28:43.080" Score="1" Body="&lt;p&gt;I successfully managed to set this up with Douglas' first solution above combined with another answer also from Douglas about &lt;a href=&quot;https://craftcms.stackexchange.com/a/6571/828&quot;&gt;array merging&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without this merge I had to repeat all my template code first in a 'for' loop without a request segment and then again inside a 'for' loop with a request segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adding the merge I ended up with this working solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) %}&#xA;    {% set newsAll = craft.entries.section('news') %}&#xA;    {% set news = [] %}&#xA;    {% for entry in newsAll if entry.category.contains(craft.request.getSegment(2)) %}&#xA;        {% set news = news|merge([entry]) %}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {% set news = craft.entries.section('news') %}&#xA;{% endif %}&#xA;&#xA;{% for entry in news %}&#xA;    {# My template code for all or filtered entries #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions for further shortening this code is welcome.&lt;/p&gt;&#xA;" OwnerUserId="828" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-28T12:55:12.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6840" PostTypeId="2" ParentId="4149" CreationDate="2015-01-28T13:29:40.190" Score="3" Body="&lt;p&gt;I was about to post a very similar question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have the following plugins available.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Guest Entries:&lt;/strong&gt; &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Like:&lt;/strong&gt; Lets you 'like' Entries, Assets etc - &lt;a href=&quot;https://dukt.net/craft/like&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/like&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Follow:&lt;/strong&gt; Lets you follow users and their entries etc - &lt;a href=&quot;https://dukt.net/craft/follow&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/follow&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Not sure about the folder/collections side of things. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is a plugin coming for social account login but it's not released yet, I emailed the devloper but haven't had a reply - &lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/social&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to go with ExpressionEngine if my deeper research find that Craft comes up short. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I would prefer to use Craft but I'm new to it and am not sure I can to make it do what I need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you ended up going with Craft or went in a different direction. &lt;/p&gt;&#xA;" OwnerUserId="2196" LastEditorUserId="2196" LastEditDate="2015-09-02T08:55:51.713" LastActivityDate="2015-09-02T08:55:51.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6841" PostTypeId="1" CreationDate="2015-01-28T15:13:57.283" Score="5" ViewCount="880" Body="&lt;p&gt;I'm a complete noob in the Craft world but love to give it a whirl for my latest project - just wondering if it can do what I want it to, and to maybe get some starting points from you guys in the know!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building an Author agency website. In addition to their simple static info pages they will need to administer their 250+ clients (Authors,Public Speakers or both) and the 600+ Books by their clients. These will obviously need to be linked (through Entries as I understand it so far). i.e they want a single Author profile page (headshot, bio etc) which also displays a list that author's books, in turn linking to each book's profile page (synopsis, jacket, purchase link etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now clearly I'll need either Client or Pro, as I imagine I will need to achieve this through Channels? Am I on the right track? Is there anything you think I'm missing (plugins?) Or maybe I pissing up the wrong tree?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="2238" LastEditorUserId="22" LastEditDate="2017-05-10T00:11:38.560" LastActivityDate="2017-05-10T00:11:38.560" Title="Craft for Author Agency website?" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6842" PostTypeId="2" ParentId="5415" CreationDate="2015-01-28T15:21:12.910" Score="8" Body="&lt;p&gt;I had the same issue and solved it. This seems to be an issue with the exif lib. Try to disable mbstring overloading by setting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mbstring.func_overload = 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to your php.ini or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;php_admin_value mbstring.func_overload 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in your apache virtual host configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Oliver&lt;/p&gt;&#xA;" OwnerUserId="2239" LastActivityDate="2015-01-28T15:21:12.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6843" PostTypeId="1" AcceptedAnswerId="6846" CreationDate="2015-01-28T17:38:10.540" Score="2" ViewCount="824" Body="&lt;p&gt;I have a blog where page one has a big &quot;feature&quot; thumbnail and after that each subsequent thumbnail is half the size.&#xA;I want that to only happen on page one, which i have done using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate.currentPage == 1 and loop.index == 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works perfectly fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that because of this design choice, page one shows 13 entries, but page two onward needs to show 12, otherwise it will look wonky! Any ideas on how i could achieve this?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-01-28T18:22:47.663" Title="Sensible way to have different number of entries on page one of pagination?" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6844" PostTypeId="1" AcceptedAnswerId="6845" CreationDate="2015-01-28T17:52:42.843" Score="3" ViewCount="850" Body="&lt;p&gt;I'm building a site where I am linking entries based on their tags. If you click on a tag you go to a dedicated page with all entries that share the same tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.relatedTo(entry) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that if a tag has more than 1 word, the URL displays like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http:/site.com/tag/two%20words&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I change &quot;%20&quot; to a dash?&lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="125" LastEditDate="2015-01-28T18:31:14.267" LastActivityDate="2016-07-06T23:00:24.770" Title="How do I make the &quot;%20&quot; in URL's show as &quot;-&quot;" Tags="&lt;templating&gt;&lt;url&gt;&lt;tags&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6845" PostTypeId="2" ParentId="6844" CreationDate="2015-01-28T18:11:12.840" Score="6" Body="&lt;p&gt;&lt;strong&gt;Edited&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just learned this, but as of Craft 2.4, there's a &lt;a href=&quot;https://craftcms.com/docs/templating/filters#kebab&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;kebab&lt;/code&gt; filter&lt;/a&gt; which you can use here. This would probably give you the effect you're after, where the string &quot;two words&quot; would become &quot;two-words&quot;, and punctuation characters are dropped by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | kebab }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;%20&lt;/code&gt; string is being added to replace spaces because you're using the &lt;code&gt;url_encode&lt;/code&gt; filter on &lt;code&gt;tag.title&lt;/code&gt;. A simple (though somewhat naïve) way to to solve this would be to use the replace filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ tag.title | url_encode | replace({&quot;%20&quot;: &quot;-&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, you might still see some &quot;%XX&quot; characters in this string if the &lt;code&gt;tag.title&lt;/code&gt; has other characters that url_encode might want to replace. The &quot;%&quot; character, for example, gets turned into &quot;%25&quot; after being run through &lt;code&gt;url_encode&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also probably won't do what you expect, as the link you're generating for the tag won't work unless you're doing special routing. The problem stems from the fact that tags don't have clean URL slugs at this time, so what you're doing right now is probably the best course of action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've probably already seen this, but there's a &lt;a href=&quot;http://buildwithcraft.com/help/tag-urls&quot; rel=&quot;nofollow&quot;&gt;documentation page specially about linking to tags&lt;/a&gt;. This is the current best practice I know of. If you're really looking for cleaner slugs in URLs, I'd recommend using categories instead of tags if possible.&lt;/p&gt;&#xA;" OwnerUserId="248" LastEditorUserId="248" LastEditDate="2016-07-06T23:00:24.770" LastActivityDate="2016-07-06T23:00:24.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6846" PostTypeId="2" ParentId="6843" CreationDate="2015-01-28T18:12:20.913" Score="7" Body="&lt;p&gt;There's an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#offset&quot;&gt;&lt;code&gt;offset&lt;/code&gt;&lt;/a&gt; parameter that allows you to skip the first entries from your ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would set up two nearly identical ElementCriteriaModels, one exclusivly for your featured entry, using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#first&quot;&gt;&lt;code&gt;first()&lt;/code&gt;&lt;/a&gt; method to only query for the first entry, and to the second one you'd add &lt;code&gt;offset(1)&lt;/code&gt; as a parameter, to get all the other entries for your pagination.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section: 'blog' } %}&#xA;&#xA;{# Get the featured entry #}&#xA;{% set featuredEntry = craft.entries(params).first() %}&#xA;&#xA;{# Get all the other entries #}&#xA;{% set entries = craft.entries(params).offset(1).limit(10) %}&#xA;&#xA;{% paginate entries as entriesOnPage %}&#xA;&#xA;    {# Show featured entry on page one #}&#xA;    {% if paginate.currentPage == 1 %}&#xA;        &amp;lt;img src=&quot;{{ featuredEntry.url('fullwidth') }}&quot; class=&quot;fullwidth&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% for entry in entriesOnPage %}&#xA;        &amp;lt;img src=&quot;{{ entry.url('thumb') }}&quot; class=&quot;thumb&quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-01-28T18:22:47.663" LastActivityDate="2015-01-28T18:22:47.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6847" PostTypeId="2" ParentId="6841" CreationDate="2015-01-28T18:43:19.123" Score="11" Body="&lt;p&gt;Don't be alarmed if this post gets flagged for being off-topic. Typically questions regarding whether &quot;craft is appropriate for x&quot; are considered too broad and opinion based. But I'll try and give you some suggestions anyway, which may give you a head start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer is yes, craft can do all those things. The only point to maybe consider is when you say &quot;purchase&quot;, unless you are just linking to amazon or something. As I'm sure you're aware, E-commerce is not something to take lightly and I would make sure you research your options here, and have a plan. E-commerce solutions for craft are limited at the moment, but keep an eye on the &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot;&gt;plugin page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will likely want to have Craft Pro, so that you can have multiple user accounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is one approach to the basic CMS design, without really knowing anything about your requirements.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a single for your homepage.&lt;/li&gt;&#xA;&lt;li&gt;Create a 'structure' (call it &quot;pages&quot; for example, or whatever you like) to contain all of your static pages and index/landing pages. This would include for example pages like &quot;About us&quot;, &quot;Company&quot;, &quot;Services&quot;, &quot;Authors&quot; index page, &quot;Books&quot; index page, and anything else that you would consider as part of your main nav. 'Entries' within this structure would be defined with unique 'Entry Types' for each unique page layout that you need. Within each 'Entry Type' fields can be defined independently from other 'Entry Types'. In the 'pages/_entry.html' template you can determine which template code to display by checking the &lt;code&gt;entry.type&lt;/code&gt; property. The advantage of using a &lt;code&gt;structure&lt;/code&gt; here (as apposed to &lt;code&gt;channels&lt;/code&gt; and &lt;code&gt;singles&lt;/code&gt;) is that you can use it to generate dynamic navigation. See example below.&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;code&gt;channel&lt;/code&gt; for Authors (called 'authors' or whatever). You can also create &lt;code&gt;users&lt;/code&gt; for this if you ever want to allow clients to log-in for whatever reason. (Note: I would use a &lt;code&gt;channel&lt;/code&gt; regardless because it allows for multiple tabs in the edit page, and link it to &lt;code&gt;users&lt;/code&gt; via a &lt;code&gt;users&lt;/code&gt; field. But that's just me). Another tip: Might also check out a plugin called &lt;a href=&quot;http://straightupcraft.com/craft-plugins/introvert&quot;&gt;Introvert&lt;/a&gt; to display reverse related books from the books channel.&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;code&gt;channel&lt;/code&gt; for Books (called 'books' or 'products' or whatever), with a 'related users' or 'related entries' field for 'authors' (depending on how you dealt with authors above).&lt;/li&gt;&#xA;&lt;li&gt;Create a category group for your books subject taxonomies (I'm just guessing at this point), but you get the idea.&lt;/li&gt;&#xA;&lt;li&gt;Add salt and pepper to taste and serve.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now for some code examples (and useful concepts regardless of your design).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your '_layout.html' master template, to generate nav (copied from the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot;&gt;docs&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages') %}&#xA;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your 'pages/_entry.html' template, to determine the entry type and retrieve related entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.type %}&#xA;    {% case 'about' %}&#xA;        {{ entry.title }}&#xA;        ...&#xA;    {% case 'authors' %}&#xA;        {{ entry.title }}&#xA;        ...&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% set authors = craft.entries.section('authors') %}&#xA;            {% for author in authors %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ author.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;{{ author.firstName }} {{ author.lastName }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt; &#xA;    {% case 'books' %}&#xA;        {# repeat code above but for books, likely with some category break-down based on the categories field #}&#xA;    {% case default %}&#xA;        {# display default template #}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You can also use 'includes' in the switch statement, for better template organization, or use &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot;&gt;this technique&lt;/a&gt; to eliminate the need for the 'switch' statement altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your 'authors/_entry.html' template, to get related books.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;&#xA;   &amp;lt;img src=&quot;{{ entry.headshot.first.url }}&quot; /&amp;gt;&#xA;   {{ entry.bio }}&#xA;   ...&#xA;&amp;lt;/p&amp;gt;&#xA;&amp;lt;h2&amp;gt;Books&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% set books = craft.entries.section('books').relatedTo(entry) %}&#xA;    {% for book in books %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ book.title }}&amp;lt;br&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ book.coverPhoto.first.url }}&quot; /&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your 'books/_entry.html' template, to get authors from the 'authors' entries field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;img src=&quot;{{ entry.coverPhoto.first.url }}&quot; /&amp;gt;&#xA;....&#xA;&amp;lt;h2&amp;gt;Authors&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for author in entry.authors %}&#xA;        &amp;lt;li&amp;gt;{{ author.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-28T18:56:13.893" LastActivityDate="2015-01-28T18:56:13.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6848" PostTypeId="1" CreationDate="2015-01-28T20:33:58.723" Score="0" ViewCount="189" Body="&lt;p&gt;Is there a way to build a protected webpage within craft. Something that can only be accessed if you have the actual link. Something that you can not click to through the website. The point is to have a webpage that only the employees can access. Thanks for the help!!&lt;/p&gt;&#xA;" OwnerUserId="2241" LastActivityDate="2015-01-28T21:44:01.033" Title="Protected Web Page" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6849" PostTypeId="1" CreationDate="2015-01-28T21:00:23.573" Score="1" ViewCount="304" Body="&lt;p&gt;I recently updated some of the photos for a user group. I'm using the default user photo field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm displaying the user photos on the front-end of my site and the images were displaying just fine. After replacing the images the image tag on the front-end of my site is showing a broken image. If I view the image tag &lt;code&gt;src&lt;/code&gt; it points to the old image filename, not the updated file's filename. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have cleared Craft's cache. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I can make &lt;code&gt;getPhotoUrl()&lt;/code&gt; use the new filename?&lt;/p&gt;&#xA;" OwnerUserId="476" LastActivityDate="2015-01-29T02:19:35.737" Title="User photos not showing after replacing photo" Tags="&lt;assets&gt;&lt;users&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6850" PostTypeId="2" ParentId="6848" CreationDate="2015-01-28T21:19:58.600" Score="2" Body="&lt;p&gt;If you want to restrict an entire template, something like the following should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorized = false %}&#xA;{% if currentUser %}&#xA;    {% if currentUser.isInGroup('employee') %}&#xA;        {% set authorized = true %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if not authorized %}&#xA;    {% redirect 401 %}&#xA;{% endif %}&#xA;&#xA;{# display template #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You can redirect anywhere with the &lt;code&gt;redirect&lt;/code&gt; tag. I just used 401 as an example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to designate whether specific entries are viewable then you might want to set a custom field — something like a 'lightbox' field with the handle 'public' for example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorized = false %}&#xA;{% if currentUser %}&#xA;    {% if currentUser.isInGroup('employee') %}&#xA;        {% set authorized = true %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if authorized %}&#xA;    {# show non-public positions #}&#xA;    {% set positions = craft.entries.section('jobPostings').public('0') %}&#xA;    &amp;lt;h2&amp;gt;In-house Job Openings&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for position in positions %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ position.url }}&quot;&amp;gt;{{ position.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# show public positions #}&#xA;&amp;lt;h2&amp;gt;Public Job Openings&amp;lt;/h2&amp;gt;&#xA;{% set positions = craft.entries.section('jobPostings').public('1') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for position in positions %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ position.url }}&quot;&amp;gt;{{ position.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the detail page (if there is a detail page), do the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorized = false %}&#xA;{% if currentUser %}&#xA;    {% if currentUser.isInGroup('employee') %}&#xA;        {% set authorized = true %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if not entry.public and not authorized %}&#xA;    {% redirect 401 %}&#xA;{% endif %}&#xA;&#xA;{# otherwise display entry #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6554/protect-entry-so-that-only-a-relatedto-user-can-see-it/6555#6555&quot;&gt;this answer&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4182/password-protected-area-with-unique-files/4184#4184&quot;&gt;this answer&lt;/a&gt; for more options.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-01-28T21:44:01.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6851" PostTypeId="1" AcceptedAnswerId="6853" CreationDate="2015-01-28T21:48:40.253" Score="2" ViewCount="336" Body="&lt;p&gt;I'd like to run the entry.body content through some PHP functions before the template outputs it, there probably two approaches to this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a twig function via Plug (if possible) and use that in template like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ MyFunction( entry.body ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have function automatically grab the &quot;body&quot; of the current page, run through functions, and update it before template runs it. I'd prefer this method although but have no clue how to go about it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What would be the best approach -- and does anyone have any pointers / samples on how it'd be done? I've been digging through documentation but am struggling to find how to get the current entry.body through a plugin, or how to update it (just for the page rendering + template, not in database.)&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-01-28T22:12:09.333" Title="Update entry.body from Plugin" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6852" PostTypeId="1" AcceptedAnswerId="6854" CreationDate="2015-01-28T22:06:24.387" Score="2" ViewCount="637" Body="&lt;p&gt;Im trying to do an OR filter for craft.entries and not sure of the syntax&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startedThisYear = craft.entries.find({ section: 'exhibitions', startDate: &quot;&amp;gt;= &quot; ~startDate, startDate: &quot;&amp;lt;= &quot; ~endDate, order:'startDate desc'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if i wanted it to be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;startDate: &quot;&gt;= &quot; ~startDate or startDate: &quot;&amp;lt;= &quot; ~endDate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;??&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-01-28T22:50:25.850" Title="Or element criteria model filters" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2015-01-29T15:55:30.970" ContentLicense="CC BY-SA 3.0" />
  <row Id="6853" PostTypeId="2" ParentId="6851" CreationDate="2015-01-28T22:12:09.333" Score="6" Body="&lt;p&gt;There is no event or hook that I'm aware of that can intercept the template rendering process directly. You would likely need to instigate this from within your template. I would suggest perhaps using a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot;&gt;plugin variable&lt;/a&gt; either directly, or as a wrapper for your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot;&gt;plugin service&lt;/a&gt; method (if you need to do something more complicated). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: This is adapted from the '&lt;a href=&quot;http://straightupcraft.com/craft-plugins/business-logic-template&quot;&gt;BusinessLogicTemplate&lt;/a&gt;' plugin which provides a great starting point for plugin development.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class MyPluginVariable&#xA;{&#xA;&#xA;    /**&#xA;     * Whatever you want to output to a Twig tempate&#xA;     * can go into a Variable method.&#xA;     *&#xA;     * HOW TO USE IT&#xA;     * From any Twig template, call it like this:&#xA;     *&#xA;     *     {{ craft.myPlugin.exampleVariable }}&#xA;     *&#xA;     * Or, if your variable requires input from Twig:&#xA;     *&#xA;     *     {{ craft.myPlugin.exampleVariable(twigValue) }}&#xA;     *&#xA;     */&#xA;    public function exampleVariable($optional = null)&#xA;    {&#xA;        return &quot;And away we go to the Twig template...&quot;;&#xA;    }&#xA;    public function formatBody($body)&#xA;    {&#xA;        /* process $body and return it to the template */&#xA;        return $body;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.formatBody(entry.body) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-28T22:12:09.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6854" PostTypeId="2" ParentId="6852" CreationDate="2015-01-28T22:44:22.173" Score="7" Body="&lt;p&gt;I think that you actually want to use 'and' rather than 'or'. 'Or' would return all entries. This is also assuming that you have predefined the 'startDate' and 'endDate' variables.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'exhibitions',&#xA;    startDate: 'and, &amp;gt;= ' ~ startDate ~ ', &amp;lt;= ' ~ endDate,&#xA;    order:'startDate desc'&#xA;} %}&#xA;&#xA;{% set startedThisYear = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you haven't already done so, you may need to format 'startDate' and 'endDate' variables first. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;startDate: 'and, &amp;gt;= ' ~ startDate|date('Y-m-d') ~ ', &amp;lt;= ' ~ endDate|date('Y-m-d')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See this answer for &lt;a href=&quot;https://craftcms.stackexchange.com/questions/168/how-do-i-show-advanced-date-filters-for-events&quot;&gt;another example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-01-28T22:50:25.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6856" PostTypeId="2" ParentId="6849" CreationDate="2015-01-29T02:19:35.737" Score="1" Body="&lt;p&gt;Can I ask why you can't change the filename to the old one? For the new file that is. That will easily solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason it won't show up as per the new file name is that when you upload a profile photo for a user, craft creates a image model for it and when copying over a file directly this image model will not be created hence you either need to use the backend for uploading profile photos or change the filename to the old one. Also you would need to do this in multiple folders as inside &lt;code&gt;userphotos/{username}/&lt;/code&gt; you will see that there are multiple folders, these are folders for different cropped sizes of the profile photo and will be displayed in different locations, Hence you will need to replace the file in all of these locations for the user photo to appear correctly in all places.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-01-29T02:19:35.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6857" PostTypeId="1" AcceptedAnswerId="8306" CreationDate="2015-01-29T09:37:09.053" Score="4" ViewCount="596" Body="&lt;p&gt;I have created a new account and attempted to verify the account by clicking the activation link in the verification email.  On doing so I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bad Request&#xA;Param “id” doesn’t exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I can resolve this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running the latest version of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have replicated the issue locally and on our staging server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="2204" LastActivityDate="2015-08-22T21:41:46.253" Title="Account verification error" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6859" PostTypeId="1" CreationDate="2015-01-29T13:35:32.573" Score="2" ViewCount="324" Body="&lt;p&gt;I've seen plenty examples of using the uri segment like below, but it ain't working for me, anyone had same sort of issue?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment = craft.request.segment(2) %}&#xA;{% set pageCats = craft.categories('photoCategories').slug('segment') %}&#xA;{% set entries = craft.assets.group('photoUpload').relatedTo(pageCats).find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.stuff }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works if I hard code the segment name &lt;code&gt;.slug('skateboards')&lt;/code&gt; and the segment does render when &lt;code&gt;{{ segment }}&lt;/code&gt; on other areas of the same page.&lt;/p&gt;&#xA;" OwnerUserId="852" LastActivityDate="2015-01-29T13:53:05.863" Title="Segment to filter through categories slug" Tags="&lt;categories&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6860" PostTypeId="2" ParentId="6859" CreationDate="2015-01-29T13:53:05.863" Score="4" Body="&lt;p&gt;Try removing the ' ' from segment in line 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageCats = craft.categories('photoCategories').slug(segment) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-01-29T13:53:05.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6861" PostTypeId="1" CreationDate="2015-01-29T15:32:23.463" Score="0" ViewCount="40" Body="&lt;p&gt;I'm trying to get a list of entries that have at least one asset in it (standard assets field) called &quot;assets&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('banks').first.assets.filename(':notempty:').limit(2) %}&#xA;&amp;lt;p&amp;gt; {{ entry.title }} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It don't show anything, no errors either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advice.&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-01-29T15:32:23.463" Title="Display only those entries that have assets" Tags="&lt;assets&gt;&lt;custom-field&gt;&lt;order&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2015-01-29T17:32:42.413" ContentLicense="CC BY-SA 3.0" />
  <row Id="6863" PostTypeId="1" CreationDate="2015-01-29T16:36:01.857" Score="1" ViewCount="461" Body="&lt;p&gt;I would like to modify how assets are displayed within asset fields in the control panel's edit entry page, so that thumbnails are larger and the name is not displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some investigation I found that when assets are added to an entry the following line is called &lt;code&gt;{% hook &quot;cp.elements.element&quot; %}&lt;/code&gt;. This is calling the template service generating the html that displays the thumbnails and the name. ( _getCpElementHtml() is the function that is associated with the hook ) Is there a way to modify this without directly changing the core files?&lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="814" LastEditDate="2015-01-29T17:32:33.170" LastActivityDate="2015-01-30T13:13:07.833" Title="How to change the display of asset fields in the control panel via plugin?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6864" PostTypeId="1" CreationDate="2015-01-29T17:21:13.317" Score="0" ViewCount="590" Body="&lt;p&gt;I am having problems with the ContactForm plugin. It stopped sending mails.&#xA;I'm getting following error after submitting &quot;Could not instantiate mail function.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHPMail should be working.&#xA;I checked with a simple php outside of craft. Also the sendmail option in ContactForm does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't now when it stopped working. I thought when I added a second locale, so I added a new test single including a from with only one locale. But that single cannot send the form, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro 2.3.2626&#xA;ContactFrom 1.4&lt;/p&gt;&#xA;" OwnerUserId="2244" LastActivityDate="2015-02-06T15:39:36.333" Title="ContactForm error on send" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6865" PostTypeId="1" AcceptedAnswerId="6868" CreationDate="2015-01-29T18:34:18.523" Score="7" ViewCount="1875" Body="&lt;p&gt;I'm trying to list my categories (and sub categories, just one sub level) as a nav, and have the number of entries in each of those categories beside each one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another question on here which achieves a simple list &lt;a href=&quot;https://craftcms.stackexchange.com/questions/394/listing-categories-alphabetically-total-post-count&quot;&gt;here&lt;/a&gt; but trying to apply that logic to what i have for my nav is scrambling my brain as everything I've tried throws an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what i have, taken from the &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;Get Help&lt;/a&gt; section of the craft site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav category in craft.categories.group('articleCategories') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how i can get the number of entries each category has in it, in this?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-30T18:44:21.433" Title="Listing categories with post count in a nav?" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6866" PostTypeId="2" ParentId="6864" CreationDate="2015-01-29T18:54:52.443" Score="1" Body="&lt;p&gt;It definitely sounds like whatever mail method you're using isn't configured properly (phpmail or sendmail).  Try swapping to a proper SMTP server and see if that helps or a transactional email provider like Mandrill (&lt;a href=&quot;https://mandrill.com/&quot; rel=&quot;nofollow&quot;&gt;https://mandrill.com/&lt;/a&gt;) and see if that helps.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-29T18:54:52.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6867" PostTypeId="2" ParentId="5056" CreationDate="2015-01-29T19:58:47.040" Score="3" Body="&lt;p&gt;Unfortunately this is a limitation of that feature. In this case, both of your Lightswitch fields will be tweaking the DB query with their own &lt;code&gt;WHERE [field_column_name] = 1&lt;/code&gt;, without knowledge of each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid this, just give each of your Lightswitch fields their own unique handles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get all the blocks where either one of your Lightswitch fields are checked, you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blockIds = entry.matrixField.type('type1').typeOneLightswitchField(1).ids()&#xA;    |merge(entry.matrixField.type('type2').typeTwoLightswitchField(1).ids())&#xA;%}&#xA;&#xA;{% for block in entry.matrixField.id(blockIds) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not exactly a clean solution, but it’ll get the job done.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-01-29T20:11:17.277" LastActivityDate="2015-01-29T20:11:17.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6868" PostTypeId="2" ParentId="6865" CreationDate="2015-01-29T20:00:07.633" Score="12" Body="&lt;p&gt;Within you &lt;code&gt;nav&lt;/code&gt; loop, you would use the method &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#total&quot;&gt;&lt;code&gt;total()&lt;/code&gt;&lt;/a&gt; with an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt; ElementCriteriaModel&lt;/a&gt;, to only count the entries that are related to the category you're looping. Pass the CategoryModel to the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('articleCategories') %}&#xA;&#xA;    {# Get the count of entries related to `category` #}&#xA;    {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;&#xA;    {{ entryCount }}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-01-29T20:00:07.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6869" PostTypeId="1" CreationDate="2015-01-29T21:05:56.523" Score="1" ViewCount="236" Body="&lt;p&gt;I would like to develop a plugin to help better maintain data integrity between related records. Something like the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When deleting an entry, check whether the entry has &quot;reverse related entries&quot; (i.e. other entries that relate to this entry), and if so, interrupt the delete process and show a warning — something like: &quot;This entry is currently being referenced by 'xyz' entry. Are you sure you want to delete this entry?&quot;. If the user selects 'cancel', then cancel the delete process. (Perhaps in a future version of craft this should even happen by default if the entries field is 'required' on the reverse related entry.)&lt;/li&gt;&#xA;&lt;li&gt;Even better, would be an option to cascade delete &quot;reverse-related&quot; entries, with a message that said something like: &quot;Are you sure you want to delete this entry and all related data?&quot;, which would then initiate a cascading delete process. Obviously you would want to specify which 'related entries' fields will initiate the cascade — perhaps a checkbox on the 'related entries' field settings that read &quot;when deleting related entries, provide an option to also delete this entry&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From what I understand, as of a recent update, I believe we can now stop processes from within an event method (i.e. &lt;code&gt;onBeforeDeleteEntry&lt;/code&gt;). So I can see how one might develop the first option fairly easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second option is a bit more complicated, without also developing a 'custom related entries fieldtype'. Something that I would prefer to not do (to maintain future compatibility). Perhaps a separate panel that has a drop down to select from 'all related entries fields', those that should initiate a cascade, that can be used as a lookup table within the &lt;code&gt;onBeforeDeleteEntry&lt;/code&gt; event?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just curious if anyone has attempted anything like this? And/or if anyone can recommend a good approach.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-29T21:59:29.023" LastActivityDate="2015-01-30T04:19:24.057" Title="Plugin to maintain data integrity between related entries?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6870" PostTypeId="2" ParentId="6869" CreationDate="2015-01-30T04:19:24.057" Score="2" Body="&lt;p&gt;I think you've pretty much nailed the options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Seems completely doable and relatively easy as of Craft 2.3 just like you described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Is more difficult. You could go a custom field type route where you have settings defined which define which entry fields the cascading entry deletions occur on.  You could also probably cram your own modal/dialog choices into that event to present to the user for specific cascading deletion options (which is what I think you're also describing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It probably be a lot easier if you didn't need to be concerned about which fields it happened to and you could go scorched earth and just recursively delete &lt;em&gt;all&lt;/em&gt; reverse related entries regardless of the field or depth.  But I doubt that's the desired behavior in most circumstances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also be curious to see what an example of the use-case for this would be. My limited imagination is having a hard time coming up with something.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-01-30T04:19:24.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6871" PostTypeId="1" AcceptedAnswerId="6873" CreationDate="2015-01-30T06:12:38.337" Score="1" ViewCount="151" Body="&lt;p&gt;As best I can tell entries have to be created, tags have to be created, a relationship created and then an update to the original entry. Is this correct or is there a simpler way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a similar question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5327/how-do-you-add-tags-to-tag-field-when-saving-an-entry&quot;&gt;here&lt;/a&gt; which address how to create a tags but I feel like how to relate the new tag(s) to the entry could use some elaboration.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-01-30T16:41:27.293" Title="Best way to create tags under new EntryModel?" Tags="&lt;tags&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6872" PostTypeId="1" AcceptedAnswerId="6875" CreationDate="2015-01-30T11:42:34.607" Score="3" ViewCount="382" Body="&lt;p&gt;Is there a way to output the first image of a rich text field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment the template code is as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The purpose is so that I can use the image in the meta section of the template. If there is no easy solution I could change it to be a Matrix field.&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2017-11-26T07:06:14.560" Title="Pull first image from rich text field" Tags="&lt;entries&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6873" PostTypeId="2" ParentId="6871" CreationDate="2015-01-30T13:01:52.110" Score="3" Body="&lt;p&gt;To relate the tags, all you'd have to do is feed the entry's tag field an array containing tag IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, after creating (or finding existing) tags, you should end up with an array with one or more tag IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, if it's a new entry, you would do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myTagIds = array(1,2,3,4); // your tag IDs&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    // ...&#xA;    'tagFieldHandle' =&amp;gt; $myTagIds,&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-01-30T16:22:12.553" LastActivityDate="2015-01-30T16:22:12.553" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6874" PostTypeId="2" ParentId="6863" CreationDate="2015-01-30T13:13:07.833" Score="1" Body="&lt;p&gt;Short answer: no. The thumbnail size (30x30) is hardcoded into the method you found (_getCpElementHtml), so there's no way you can change that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try extending the control panel's CSS (using &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;this plugin&lt;/a&gt;) to enlarge and/or hide certain elements, but that won't get the thumb any bigger.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-30T13:13:07.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6875" PostTypeId="2" ParentId="6872" CreationDate="2015-01-30T14:11:02.570" Score="4" Body="&lt;p&gt;I think the best way to do this, is by creating a small Twig extension plugin that uses PHP's html parser to find the first occurrence of an IMG tag and return the src of that tag to your template. &lt;a href=&quot;https://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; is a step-by-step explanation of how to create your very own Twig filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ entry.body | firstImageSrc }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it would return the url you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The easiest way, however, is to add an asset field to your Entry Type's field layout and choose a file manually.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-01-30T14:11:02.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6876" PostTypeId="2" ParentId="952" CreationDate="2015-01-30T14:29:55.433" Score="3" Body="&lt;p&gt;For us, we had the same problem but a different root cause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We noticed that we were getting multiple new session files created for each request, all with the same data in them. After a bit of digging, I noticed session.auto_start was On in php.ini, so tried turning it Off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that fixed it, no more surplus session files been created on disk, and no random logging out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So make sure that php.ini has &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;session.auto_start = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2246" LastActivityDate="2015-01-30T14:29:55.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6877" PostTypeId="2" ParentId="2731" CreationDate="2015-01-30T14:34:09.060" Score="4" Body="&lt;p&gt;We were experiencing this issue, as well as the randomly logging out issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/6876/2246&quot;&gt;I answered on that question&lt;/a&gt;, we fixed both these issues by switching session.auto_start to Off&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;session.auto_start = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2246" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-01-30T14:34:09.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6878" PostTypeId="2" ParentId="6865" CreationDate="2015-01-30T18:44:21.433" Score="3" Body="&lt;p&gt;&lt;strong&gt;Bonus Answer.&lt;/strong&gt; If you want to sort by the amount of posts each category has you can do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCats = craft.categories.group('articleCategories').level(1).find() %}&#xA;&#xA;{% set catArray = {} %}&#xA;&#xA;{% for cat in allCats %}&#xA;&#xA;    {% set catArray = catArray | merge({(cat.slug):craft.entries.relatedTo(cat).total() }) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set catArray = catArray|sort|reverse %}&#xA;&#xA;{% for catSlug, count in catArray %}&#xA;&#xA;    {% set category = craft.categories.slug(catSlug).first() %}&#xA;&#xA;    &amp;lt;li class=&quot;categories__item&quot;&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-01-30T18:44:21.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6879" PostTypeId="1" AcceptedAnswerId="6880" CreationDate="2015-01-30T22:35:11.467" Score="2" ViewCount="752" Body="&lt;p&gt;I've built a help site for a client that pre-releases articles to a select group of beta users. The updated articles (Craft entries) are published as drafts until features make it out of beta and into the main release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client has gone and done the clever thing of using the Live Preview URL (&lt;strong&gt;with token&lt;/strong&gt;) to share with the limited group of beta users who should only have read-only access to the article:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://cagedwisdom.com/articles/bloopers?token=3p~rKL53nTcTrO_q1XcWsaBNla5VpzTF&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the token is temporary, this link works for a little while and eventually expires and people can no longer review the draft content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to an entry's latest draft?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's pretend that I have a the query parameter &lt;code&gt;&amp;amp;draft=true&lt;/code&gt; appended to an article URL, and I use that to selectively get the latest draft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('draft') == true %}&#xA;    {% set draftEntry = entry.drafts().order('date desc').first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a not-imaginary way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, my best ideas are...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To create a plugin that'd allow the editor to create a persistent but removable hash for that specific entry that'd allow access to said draft. (So if the article URL is &lt;code&gt;http://cagedwisdom.com/articles/bloopers&lt;/code&gt;, the secret draft share URL would be &lt;code&gt;http://cagedwisdom.com/articles/bloopers&amp;amp;draft=Ag4For3Wom8Ot5eeDd9yAf2g&lt;/code&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Mess with Craft's token expiration values so the shared links last longer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2015-09-17T22:54:04.347" LastActivityDate="2015-09-17T22:54:04.347" Title="Can I select the latest draft of a given entry?" Tags="&lt;entries&gt;&lt;draft&gt;&lt;token&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6880" PostTypeId="2" ParentId="6879" CreationDate="2015-01-30T22:53:37.950" Score="4" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('draft') == true %}&#xA;    {% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;    {% if drafts|length %}&#xA;        {% set entry = drafts[0] %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{{ entry.title }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is assuming of course that the entry is published at all. If it's disabled then the uri will return 404. In which case you would have to retrieve the entry in some other way. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6756/loading-an-existing-entries-drafts-in-template-frontend&quot;&gt;this answer&lt;/a&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-01-30T22:53:37.950" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6881" PostTypeId="1" AcceptedAnswerId="6882" CreationDate="2015-01-31T00:29:07.387" Score="2" ViewCount="186" Body="&lt;p&gt;I have the following code in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() &#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;    // only fire if new user&#xA;    if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;        // business logic&#xA;        // how do i save result to custom user fields etc...&#xA;&#xA;    }         &#xA; });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess my question is whether the userRecod has already saved at this point? If so do I need to create another user object, make changes and call .save again? Or is the user still available to me?   &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-01-31T00:57:07.320" Title="Processing Business Logic on user.saveUser" Tags="&lt;plugins&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6882" PostTypeId="2" ParentId="6881" CreationDate="2015-01-31T00:57:07.320" Score="2" Body="&lt;p&gt;The user has already been saved at this point and is available as &lt;code&gt;$event-&amp;gt;params['user']&lt;/code&gt;. If you modify data and save again, however, you will need to be careful of creating an endless loop — not sure what you are trying to do. In this case you should be ok because of the &quot;IsNewUser&quot; conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() &#xA;{&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;            $user = $event-&amp;gt;params['user'];&#xA;            // update default fields&#xA;            $user-&amp;gt;firstName = &quot;Bob&quot;;&#xA;            // update custom fields&#xA;            $user-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                'phone' =&amp;gt; &quot;222-222-5555&quot;&#xA;            ));&#xA;            // save user&#xA;            $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;            if (!$success) {&#xA;                MyPlugin::log('Couldn’t update user &quot;'.$user-&amp;gt;username.'&quot;', LogLevel::Error);&#xA;            } else {&#xA;                MyPlugin::log('Successfully updated user &quot;'.$user-&amp;gt;username.'&quot;', LogLevel::Info);&#xA;            }&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-01-31T00:57:07.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6885" PostTypeId="1" AcceptedAnswerId="6886" CreationDate="2015-01-31T09:01:55.790" Score="5" ViewCount="171" Body="&lt;p&gt;Craft 101: I have entries with many different fields, so I'm doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = craft.entries.section('foo').slug('bar').first() %}&#xA;&#xA;{% if var %}&#xA;  {{ var.field1 }}&#xA;  {{ var.field2 }}&#xA;  {{ var.field3 }}&#xA;  etc...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does Craft fetch the entry only once or every time the variable is called? I'm guessing only once but I'm not too sure, and some entries have 50+ fields.&lt;/p&gt;&#xA;" OwnerUserId="576" LastEditorUserId="784" LastEditDate="2015-01-31T14:51:17.870" LastActivityDate="2015-01-31T15:12:21.203" Title="Many entry fields, only one db request?" Tags="&lt;database&gt;&lt;elementcriteriamodel&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6886" PostTypeId="2" ParentId="6885" CreationDate="2015-01-31T14:32:47.333" Score="4" Body="&lt;p&gt;The statement is only executed once. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are essentially creating an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;elementCriteriaModel&lt;/a&gt;, returning the first element using the &lt;code&gt;.first()&lt;/code&gt; parameter (which in this case is an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;Entry Model&lt;/a&gt;), and storing it in a variable; which you then can use to access your field values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to further increase performance you can wrap the whole block in a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;cache&lt;/a&gt; tag, which will speed up subsequent requests.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-01-31T15:12:21.203" LastActivityDate="2015-01-31T15:12:21.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6887" PostTypeId="2" ParentId="6812" CreationDate="2015-02-01T01:01:42.347" Score="4" Body="&lt;p&gt;Sounds like a plugin is your best option. Creating a model is simple, but if you want to use ElementCriteriaModel, you need to create a custom entity, which gets a little more complex. Check out &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/Events&lt;/a&gt; for a great example on setting up custom elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to just stick with a model, you could run queries to fetch models using BaseRecord and avoid writing queries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out a these files from a &lt;a href=&quot;https://github.com/aberkie/transit&quot; rel=&quot;nofollow&quot; title=&quot;plugin I wrote&quot;&gt;plugin I wrote&lt;/a&gt;. I am storing API keys in a table with two custom columns, 'service' and 'api_key'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Model (&lt;a href=&quot;https://github.com/aberkie/transit/blob/master/models/Transit_KeyModel.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aberkie/transit/blob/master/models/Transit_KeyModel.php&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Transit_KeyModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'service' =&amp;gt; AttributeType::String,&#xA;            'api_key' =&amp;gt; AttributeType::String&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Record (&lt;a href=&quot;https://github.com/aberkie/transit/blob/master/records/Transit_KeyRecord.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aberkie/transit/blob/master/records/Transit_KeyRecord.php&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Transit_KeyRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'transit_keys';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'service' =&amp;gt; AttributeType::String,&#xA;            'api_key' =&amp;gt; AttributeType::String&#xA;        );&#xA;    }&#xA;&#xA;    public function create()&#xA;    {&#xA;        $class = get_class($this);&#xA;        $record = new $class();&#xA;&#xA;        return $record;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is best to use Services to use the records to get the data and populate the models for use. &#xA;Service (&lt;a href=&quot;https://github.com/aberkie/transit/blob/master/services/Transit_KeyService.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aberkie/transit/blob/master/services/Transit_KeyService.php&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;    &#xA;class Transit_KeyService extends BaseApplicationComponent&#xA;{&#xA;    protected $keyRecord;&#xA;    public function __construct($keyRecord = null)&#xA;    {&#xA;        if(is_null($this-&amp;gt;keyRecord))&#xA;        {&#xA;            $this-&amp;gt;keyRecord = Transit_KeyRecord::model();&#xA;        }&#xA;    }&#xA;&#xA;    public function getKey($service = null)&#xA;    {&#xA;        if($service === null)&#xA;        {&#xA;            $records = $this-&amp;gt;keyRecord-&amp;gt;findAll();&#xA;&#xA;            return Transit_KeyModel::populateModels($records);          &#xA;        } else {&#xA;&#xA;            $condition = &quot;service = '$service'&quot;;&#xA;            $records = $this-&amp;gt;keyRecord-&amp;gt;find($condition);&#xA;&#xA;            $model = Transit_KeyModel::populateModel($records);&#xA;&#xA;            return $model-&amp;gt;api_key;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use Yii's find function on records to limit results and use populateModels to return models. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$condition = &quot;service = '$service'&quot;;&#xA;$records = $this-&amp;gt;keyRecord-&amp;gt;find($condition);&#xA;$model = Transit_KeyModel::populateModel($records);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you didn't want to get this fancy, you could even just write your own mysql queries in your service files using craft()-&gt;db-&gt;createCommand()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;-&amp;gt;select('*')&#xA;-&amp;gt;from('myTable')&#xA;-&amp;gt;where(&quot;myTable.name = '$name'&quot;)&#xA;-&amp;gt;order(&quot;myTable.name&quot;)&#xA;-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps! Long answer short...&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot; title=&quot;look into making a plugin&quot;&gt;look into making a plugin&lt;/a&gt;! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-01T01:01:42.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6888" PostTypeId="1" CreationDate="2015-02-01T01:09:18.003" Score="2" ViewCount="166" Body="&lt;p&gt;What I'm trying to do is to display child pages of a parent page. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% if entry.parent %}&#xA;                    &amp;lt;div class=&quot;widget clearfix&quot;&amp;gt;&#xA;                        &amp;lt;h4 class=&quot;widgettitle&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.parent.url }}&quot;&amp;gt;{{ entry.parent.title }}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;                        &amp;lt;ul class=&quot;clearfix&quot;&amp;gt;&#xA;                        {% set topic = entry.parent.id %}&#xA;                        {% for subsection in craft.entries.descendantOf(topic) if subsection.type != &quot;state&quot; %}&#xA;                            &amp;lt;li class=&quot;cat-item&quot;&amp;gt;&amp;lt;a href=&quot;{{ subsection.url }}&quot;&amp;gt;{{ subsection.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However if the sub page has another child page everything goes wrong as I see the results of the parent page that is a child itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do  I ignore the hierarchy and display the results of level 1 aka grand parent page / topic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-02-01T18:07:22.823" Title="Easy Nav Question" Tags="&lt;navigation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6889" PostTypeId="1" AcceptedAnswerId="6893" CreationDate="2015-02-01T01:23:05.220" Score="4" ViewCount="1016" Body="&lt;p&gt;I'm trying to import data from another database into a 'table' fieldtype via a plugin, and have a couple questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When setting the content on the EntryModel, are there any methods to assist in setting the rows and/or columns, or do I need to just format the data as a string in the expected format?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'tableFieldHandle' =&amp;gt; '[{&quot;col1&quot;:&quot;data&quot;,&quot;col2&quot;:&quot;data&quot;}]'&#xA;    ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Secondly, what's the recommended method to prepare strings for a table field (i.e. so as to escape or encode double and single quotes)?&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-01T02:44:48.213" Title="Inserting data into a table fieldtype via plugin?" Tags="&lt;plugin-development&gt;&lt;import&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6890" PostTypeId="2" ParentId="6537" CreationDate="2015-02-01T01:34:23.170" Score="2" Body="&lt;p&gt;As Brad mentioned in his comments, make sure you have the &lt;a href=&quot;https://github.com/mattstauffer/craftcms-DownloadAssets&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;latest version of the plugin&quot;&gt;latest version of the plugin&lt;/a&gt; uploaded to the craft/plugins directory on your production server. I just tried it for testing sake and it seemed to work fine for me! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are sure they are in the right spot, check out &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1536/two-plugins-not-showing-in-cp-after-pushing-to-staging-server&quot; title=&quot;this answer&quot;&gt;this answer&lt;/a&gt; from a different question, stating to make sure the directory names are all lowercase, so &quot;downloadassets&quot; and not &quot;downloadAssets&quot; or &quot;DownloadAssets,&quot; as many production environments are case-sensitive. &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-01T01:34:23.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6891" PostTypeId="2" ParentId="6888" CreationDate="2015-02-01T01:40:45.843" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;ancestors&lt;/code&gt; property (which is a shortcut to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getAncestors&quot; rel=&quot;nofollow&quot;&gt;getAncestors()&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetEntry = entry %}&#xA;{% if entry.level &amp;gt; 1 %}&#xA;     {% set targetEntry = entry.ancestors.last %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To retrieve an ancestor with a specific level:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetEntry = entry %}&#xA;{% for ancestorEntry in entry.ancestors %}&#xA;    {% if ancestorEntry.level == &quot;2&quot; %}&#xA;        {% set targetEntry = ancestorEntry %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you want a specific distance (i.e. 2 levels above), you can use the distance property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetEntry = entry %}&#xA;{% if entry.level &amp;gt; 1 %}&#xA;    {% set targetEntry = entry.ancestors(2).last %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-01T08:33:27.210" LastActivityDate="2015-02-01T08:33:27.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6892" PostTypeId="2" ParentId="6684" CreationDate="2015-02-01T02:01:00.423" Score="2" Body="&lt;p&gt;Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addTwigExtension&quot; rel=&quot;nofollow&quot;&gt;Craft Plugin documentation on adding a Twig extension with a plugin&lt;/a&gt;. There is no clean way to add extensions manually without a plugin, as the changes might be overridden with Craft updates.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-01T02:01:00.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6893" PostTypeId="2" ParentId="6889" CreationDate="2015-02-01T02:31:58.130" Score="7" Body="&lt;p&gt;The thing to keep in mind here is that a table field contains a simple &lt;strong&gt;JSON string&lt;/strong&gt;. So you can (and should) use PHP's native &lt;a href=&quot;http://php.net/manual/en/function.json-encode.php&quot;&gt;&lt;code&gt;json_encode&lt;/code&gt;&lt;/a&gt; function to prepare your data...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Your data will be an array of arrays:&#xA;$tableData = array(&#xA;    array(&#xA;        &quot;col1&quot; =&amp;gt; &quot;data&quot;,&#xA;        &quot;col2&quot; =&amp;gt; &quot;data&quot;,&#xA;    )&#xA;);&#xA;&#xA;// Then simply encode it when you set your field value:&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'tableFieldHandle' =&amp;gt; json_encode($tableData)&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will also solve any string escaping concerns for you!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-02-01T02:44:48.213" LastActivityDate="2015-02-01T02:44:48.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6894" PostTypeId="2" ParentId="6662" CreationDate="2015-02-01T04:04:05.937" Score="2" Body="&lt;p&gt;Sounds like the work of a plugin! Unfortunately, there is no built in Entry API Event for setting anything when a new entry is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onBeforeSaveEntry&lt;/a&gt; to set $entry-&gt;expiryDate to three months from &quot;now&quot;, but this wouldn't show until the user saved and returned to the entry. Use a function like this in your plugin's main class file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $now = strtotime(date('Y-m-d H:i:s'));&#xA;        $entry-&amp;gt;expiryDate = strtotime(&quot;+3 months&quot;, $now);&#xA;        $save = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-01T04:04:05.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6896" PostTypeId="1" AcceptedAnswerId="6905" CreationDate="2015-02-01T12:22:25.360" Score="2" ViewCount="707" Body="&lt;p&gt;I'm currently creating some standard templates which should help to find good defaults for matrix output. This is where I stumpled upon the somehow &lt;em&gt;weird&lt;/em&gt; structure of table data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simplified structure of what I want to build:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;{% for row in table %}&#xA;  &amp;lt;tr&amp;gt;&#xA;  {% for data in row %}&#xA;    &amp;lt;td&amp;gt;{{ data }}&amp;lt;/td&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputting table content like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in table %}&#xA;  {{ dump(row) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;shows me that each row has double entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(6) {&#xA;  [&quot;col1&quot;]=&amp;gt; string(7) &quot;Hamburg&quot;&#xA;  [&quot;col2&quot;]=&amp;gt; string(7) &quot;1730000&quot;&#xA;  [&quot;col3&quot;]=&amp;gt; string(7) &quot;2600000&quot;&#xA;&#xA;  [&quot;city&quot;]=&amp;gt; string(7) &quot;Hamburg&quot;&#xA;  [&quot;population&quot;]=&amp;gt; string(7) &quot;1730000&quot;&#xA;  [&quot;urbanPopulation&quot;]=&amp;gt; string(7) &quot;2600000&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While this might make sense in some cases, I don't get it. Why is this behavior and in which cases could the convention &quot;col1&quot;, &quot;col2&quot;, etc. make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On first sight, this choice is very unfortunate as it prevents dynamic table output. Sure, you could use hacks like &lt;code&gt;loop.index&lt;/code&gt; to target these, but that makes the code very unreadable and ugly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have the same issue with this?&lt;/p&gt;&#xA;" OwnerUserId="2253" LastEditorUserId="2253" LastEditDate="2015-02-01T15:52:23.840" LastActivityDate="2015-02-03T21:12:49.157" Title="Double storage of values in table-field" Tags="&lt;templating&gt;&lt;table-field&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6897" PostTypeId="2" ParentId="6896" CreationDate="2015-02-01T14:06:08.033" Score="2" Body="&lt;p&gt;Max - it looks like there might be an issue in how you are looping through the table. Table data is stored as JSON in the database, so calling entry.myTable should give you an array of rows, with each row as a sub-array of values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myTable | length %}&#xA;    &amp;lt;table&amp;gt;&#xA;        &amp;lt;thead&amp;gt;&#xA;            &amp;lt;td&amp;gt;City&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;Population&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;Urban Population&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/thead&amp;gt;&#xA;        &amp;lt;tbody&amp;gt;&#xA;        {% for row in entry.myTable %}&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{row.city}}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{row.population}}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{row.urbanPopulation}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;        {% endfor %}        &#xA;        &amp;lt;/tbody&amp;gt;&#xA;    &amp;lt;/table&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will check to see if the table field exists and has data, then will go through each row, returning values by row.columnName.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-01T14:06:08.033" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6898" PostTypeId="1" AcceptedAnswerId="6900" CreationDate="2015-02-01T16:55:12.190" Score="2" ViewCount="148" Body="&lt;p&gt;I am new to Craft and am trying to figure out what the best way to set the &lt;code&gt;$craftPath&lt;/code&gt; PHP variable to something like the other configurations for multi-environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally I have it set up the preferred way, but on my remote server, it's nested an extra level deep in folders (sub domains).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to have the variable be set using the same functionality that Craft uses to determine environments? Or do I have to just manually change the value where the index.php lives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the advice.&lt;/p&gt;&#xA;" OwnerUserId="2250" LastEditorUserId="22" LastEditDate="2017-05-10T00:10:10.430" LastActivityDate="2017-05-10T00:10:10.430" Title="$craftPath multiple enviroments" Tags="&lt;config&gt;&lt;variable&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6899" PostTypeId="1" CreationDate="2015-02-01T17:07:17.017" Score="2" ViewCount="663" Body="&lt;p&gt;I've got a matrix with a Block type called textBlocks which Craft seems to be having trouble seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;textBlocks&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My template code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.clientsContent %}&#xA;&#xA; {% switch block.type %}&#xA;&#xA;{% case &quot;text&quot; %}&#xA;&#xA;&#xA; &amp;lt;div class=&quot;small-{{ block.columns }}&quot;&amp;gt;&#xA;  &amp;lt;h3&amp;gt;{{ block.blockTitle }}&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;p&amp;gt;{{ block.blockContent }}&amp;lt;/p&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;{% case &quot;images&quot; %}&#xA; &amp;lt;ul class=&quot;small-block-grid-{{ block.blockGrid }}&quot;&amp;gt;&#xA;  {% for asset in block.images %}&#xA;   &amp;lt;li&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; alt=&quot;&quot;/&amp;gt;&#xA;   &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&#xA; {% case &quot;textBlocks&quot; %}&#xA; &amp;lt;ul class=&quot;small-block-grid-{{ textBlocks.blockGridNumber }}&quot;&amp;gt;&#xA;  {% for row in block.textBlocks %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;h5&amp;gt;{{ row.title }}&amp;lt;/h5&amp;gt; &amp;lt;p&amp;gt;{{ row.content }}&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA; &amp;lt;/ul&amp;gt;&#xA;{% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am i getting this right here? When you do switch block.type is block.type the Block Type name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See pic for my Matrix setup:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WFn5f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-02-01T17:59:54.503" Title="Switch Matrix block on handle rather than type" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6900" PostTypeId="2" ParentId="6898" CreationDate="2015-02-01T17:55:20.027" Score="2" Body="&lt;p&gt;There is a really nice &lt;a href=&quot;http://craftcookbook.net/recipes/273&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-environment configuration&lt;/a&gt; method defined on the craft cookbook website, that creates a global php variable called &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; in your main &lt;code&gt;index.php&lt;/code&gt;. It seems to me that you could also use this global to define the &lt;code&gt;$craftPath&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch (CRAFT_ENVIRONMENT) {&#xA;    case &quot;dev&quot;:&#xA;        $craftPath = '../craft';&#xA;        break;&#xA;    case &quot;stage&quot;:&#xA;        $craftPath = '../../craft';&#xA;        break;&#xA;    default:&#xA;        // default &quot;production&quot;&#xA;        $craftPath = '../../craft';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I generally use the above method (without the new switch part) in combination with &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4728/how-to-set-up-siteurl-to-work-with-both-http-and-https/4734?s=1%7C0.1884#4734&quot;&gt;this configuration method&lt;/a&gt; in my &lt;code&gt;general.php&lt;/code&gt; config file.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-01T17:55:20.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6901" PostTypeId="2" ParentId="6899" CreationDate="2015-02-01T17:59:54.503" Score="3" Body="&lt;p&gt;I think you already spotted it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;small-block-grid-{{ textBlocks.blockGridNumber }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;small-block-grid-{{ block.blockGridNumber }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-01T17:59:54.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6902" PostTypeId="2" ParentId="6888" CreationDate="2015-02-01T18:07:22.823" Score="0" Body="&lt;p&gt;So, here is my final solution it looks ugly but works. I'm pretty sure that it could be done in a more effective / nicely looking way but this is my first website on Craft :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                        {% set topic = entry.ancestors.first %}&#xA;                        {% if topic %}&#xA;                            &amp;lt;a href=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;                        {% else %}&#xA;                            {{ entry.title }}&#xA;                        {% endif %}&#xA;                        &amp;lt;/h4&amp;gt;&#xA;                        &amp;lt;ul class=&quot;clearfix&quot;&amp;gt;&#xA;                        {% if entry.level &amp;gt; 1 %}&#xA;                        {% for subsection in craft.entries.descendantOf(topic) if subsection.type != &quot;state&quot; %}&#xA;                            &amp;lt;li class=&quot;icon-list&quot;&amp;gt;&#xA;                                &amp;lt;a href=&quot;{{ subsection.url }}&quot;&amp;gt;{{ subsection.title }}&amp;lt;/a&amp;gt;&#xA;                            {% if craft.request.segment(1) == subsection.slug %}&#xA;                                &amp;lt;span class=&quot;thumb-icon-list&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-caret-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&#xA;                            {% endif %}&#xA;                            &amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;&#xA;                        {% else %}&#xA;&#xA;                        {% for subsection in craft.entries.descendantOf(entry.id) if subsection.type != &quot;state&quot; %}&#xA;                            &amp;lt;li class=&quot;icon-list&quot;&amp;gt;&#xA;                                &amp;lt;a href=&quot;{{ subsection.url }}&quot;&amp;gt;{{ subsection.title }}&amp;lt;/a&amp;gt;&#xA;                            {% if craft.request.segment(1) == subsection.slug %}&#xA;                                &amp;lt;span class=&quot;thumb-icon-list&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-caret-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&#xA;                            {% endif %}&#xA;                            &amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-02-01T18:07:22.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6903" PostTypeId="2" ParentId="769" CreationDate="2015-02-01T18:14:47.987" Score="2" Body="&lt;p&gt;As a shorthand, you could also use &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;Reference Tags&lt;/a&gt; along with the &lt;code&gt;parseRefs&lt;/code&gt; filter, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ '{entry:123:url}' | parseRefs }}&quot;&amp;gt;{{ '{entry:123:title}' | parseRefs }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Performance-wise, I'm not actually sure how this compares to spinning up the ElementCriteriaModel. It wouldn't surprise me if Craft caches entry data it queries, so it's not running a separate query for each reference tag... but I'm not sure about that.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-01T18:14:47.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6904" PostTypeId="2" ParentId="2640" CreationDate="2015-02-01T18:23:56.453" Score="2" Body="&lt;p&gt;As a shorthand, you could also use &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reference Tags&lt;/a&gt; along with the &lt;code&gt;parseRefs&lt;/code&gt; filter, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ '{entry:123:url}' | parseRefs }}&quot;&amp;gt;Request a Quote&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Similar question/answer posted &lt;a href=&quot;https://craftcms.stackexchange.com/questions/769/how-do-i-create-a-link-to-an-entry-using-entrys-id&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-01T18:23:56.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6905" PostTypeId="2" ParentId="6896" CreationDate="2015-02-01T18:31:44.993" Score="4" Body="&lt;p&gt;The data is not stored twice in the database. I suspect that craft adds the additional array items when prepping the data, so that they can be referenced by either column number or column title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But with a little finesse, you might be able to do something like the following, using &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#iterating-over-keys-and-values&quot; rel=&quot;nofollow&quot;&gt;key, value in the for loop&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;twig's slice filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;    {% for row in entry.myTableFieldHandle %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            {% for key, data in row if key|slice(0,3) == 'col' %}&#xA;                &amp;lt;td&amp;gt;{{ data }}&amp;lt;/td&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-03T21:12:49.157" LastActivityDate="2015-02-03T21:12:49.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6906" PostTypeId="1" CreationDate="2015-02-01T18:37:44.607" Score="2" ViewCount="398" Body="&lt;p&gt;I have a small menu of fixed entries that forms a sub-nav on a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using Reference Tag parsing to grab links to these entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ '{entry:3666:url}' | parseRefs }}&quot;&amp;gt;Help&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ '{entry:3667:url}' | parseRefs }}&quot;&amp;gt;Donate&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ '{entry:3668:url}' | parseRefs }}&quot;&amp;gt;About Us&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is a really clean/readable way to create this sub-nav, but I'm not sure about the performance implications. I could accomplish the same thing by calling up an ElementCriteriaModel using a fixedOrder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% entries = craft.entries.id(3666, 3667, 3668).fixedOrder(true) %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anybody know if one option is significantly performant over the other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I wouldn't be surprised if Craft is intelligently caching its entry data queries, such that it wouldn't have to create a new element query each time a Reference Tag is encountered/parsed... but I'm not knowledgable enough to say.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Other SE questions about best-practice for linking to single entries:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2640/whats-the-best-way-to-link-to-an-entry-in-a-template&quot;&gt;What&amp;#39;s the best way to link to an entry in a template?&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/769/how-do-i-create-a-link-to-an-entry-using-entrys-id&quot;&gt;How do I create a link to an entry using entry&amp;#39;s id?&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-01T19:02:27.830" Title="Linking to specific entries in Twig: How performant is Reference Tags parsing?" Tags="&lt;entries&gt;&lt;navigation&gt;&lt;performance&gt;&lt;best-practice&gt;&lt;reference-tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6907" PostTypeId="2" ParentId="6906" CreationDate="2015-02-01T18:56:43.877" Score="1" Body="&lt;p&gt;If you turn on debug mode in your config file, and then create an ultra simple template with just these code options in it, you should be able to look at the logs in the console. It should tell you the query time in milliseconds. I've never used reference tags; however, I  would suspect that the performance difference is minimal. I personally would opt for the second method, so that &lt;code&gt;entry.title&lt;/code&gt; is not hard coded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, you can also wrap the code in &lt;code&gt;{% cache %}... {% endcache %}&lt;/code&gt; tags to further increase performance either way.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-01T19:02:27.830" LastActivityDate="2015-02-01T19:02:27.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6908" PostTypeId="2" ParentId="6896" CreationDate="2015-02-01T23:56:57.363" Score="1" Body="&lt;p&gt;Taken from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2148/show-a-table-fields-column-headers-in-template&quot;&gt;carlcs' example&lt;/a&gt;, you'll probably want the clean &quot;human readable&quot; table headers. Looks like those aren't handed out in the template by default but you can get 'em with a trip to getFieldByHandle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('whateverField') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;&amp;lt;tr&amp;gt;&#xA;&amp;lt;thead&amp;gt;&#xA;  {% set field = craft.fields.getFieldByHandle('whateverField') %}&#xA;  {% for column in field.settings.columns %}&#xA;    &amp;lt;th&amp;gt;{{ column.heading }}&amp;lt;/th&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/thead&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The just spit out the rest of the table like normal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;tbody&amp;gt;&#xA;    {% for row in entry.whateverField %}&#xA;      &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;{{ row.col1 }}&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;{{ row.col2 }}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/tbody&amp;gt;        &#xA;&amp;lt;/tr&amp;gt;   &#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your table is within a matrix block—which complicates things—you need to do some additional finagling.  The above link will show how to do that.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-02T00:04:31.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6909" PostTypeId="1" AcceptedAnswerId="6910" CreationDate="2015-02-02T01:13:16.647" Score="4" ViewCount="167" Body="&lt;p&gt;I am attempting to move the database from my local machine running MySQL 5.5.38 to my webhost running 5.1.70. However when I do so I get the following error on at least two tables. I am using a MySQL export/import process.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;#1071 - Specified key was too long; max key length is 1000 bytes&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea how I might overcome this problem, or what is causing it?&lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="45" LastEditDate="2015-08-30T06:06:54.830" LastActivityDate="2015-08-30T06:06:54.830" Title="Moving to another database: &quot;Specified key was too long&quot;" Tags="&lt;database&gt;&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6910" PostTypeId="2" ParentId="6909" CreationDate="2015-02-02T06:23:05.863" Score="5" Body="&lt;p&gt;I bumped into this last week, and it is exactly as you suspect... &lt;strong&gt;your new database does not support InnoDB, which is a requirement of Craft.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest discussing the matter with your hosting company. In my case, the hosting company was unable to offer InnoDB support in any form, therefore disqualifying them as a viable hosting option for our new site.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-02-02T06:23:05.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6911" PostTypeId="1" AcceptedAnswerId="6927" CreationDate="2015-02-02T06:49:28.930" Score="3" ViewCount="1451" Body="&lt;p&gt;I have a series of matrix blocks that use a ton of the same fields and was hoping I could simply duplicate them in the database and update the context and id of the fields. It'd be a LOT faster this way however i'm unsure of the UID column, how/when that is created and if i should leave it blank, or if that column existing means i'm going to have to it all manually&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2019-07-13T07:01:38.920" Title="Clarification on UID creation" Tags="&lt;field&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6912" PostTypeId="1" AcceptedAnswerId="6925" CreationDate="2015-02-02T07:11:47.370" Score="1" ViewCount="140" Body="&lt;p&gt;I have three (3) different channels. One (1) channel have Assets attached to it, and those Assets have a couple of fields attached to them as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make the broadest possible search on all these channels (and the channels Assets and fields) using the &lt;strong&gt;.search()&lt;/strong&gt; function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For clarification; I want to make a search in all channels, and their Assets (and the Assets own fields) with (if possible) one single line of code.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-02T15:18:43.517" Title="How can I make the broadest search possible?" Tags="&lt;entries&gt;&lt;assets&gt;&lt;search&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6913" PostTypeId="1" CreationDate="2015-02-02T10:03:42.900" Score="2" ViewCount="295" Body="&lt;p&gt;I have some channels with entries that I don't want my client to be able to link to using Redactors &quot;Link to entry&quot; feature. Can I disable some channels for a specific field in a specific channel/structure/single?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-02T22:10:40.817" Title="Can I disable channels in Redactor &quot;Link to entry&quot; feature?" Tags="&lt;entries&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6914" PostTypeId="2" ParentId="6896" CreationDate="2015-02-02T10:38:07.860" Score="0" Body="&lt;p&gt;Craft's Table Field Type probably isn't the right choice, if this is what you want to achieve:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So if my client created new tables, which I did not manually implement, they get output fine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Table Field Type isn't really meant to be created by users. Besides column names, the user also has to configure the field handle and add the field to the right Entry Type in the Settings section of the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then there's also the problem with dynamically accessing the field with an unknown handle from the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;{% for row in entry.&lt;b&gt;unknownTableFieldHandle&lt;/b&gt; %}&#xA;{% endfor %}&#xA;&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there's this new plugin by &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/table-maker&quot; rel=&quot;nofollow&quot;&gt;Supercool: Table Maker&lt;/a&gt;. This should do exactly what you want (see the &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/table-maker/docs/templating#templating-tables&quot; rel=&quot;nofollow&quot;&gt;field's template syntax&lt;/a&gt;), plus it allows the user to define the table columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;{% for row in entry.&lt;b&gt;myTableFieldHandle&lt;/b&gt;.rows %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        {% for cell in row %}&#xA;            &amp;lt;td&amp;gt;{{ cell }}&amp;lt;td&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-02T10:38:07.860" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6916" PostTypeId="1" AcceptedAnswerId="6922" CreationDate="2015-02-02T11:34:35.277" Score="1" ViewCount="1585" Body="&lt;p&gt;Is it possible to get the Font Color plugin into Redactor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding it to my redactor json file as below but no luck. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;buttons: ['html','fontcolor','table','formatting','bold','italic','alignment','unorderedlist','horizontalrule','orderedlist','outdent', 'indent','link','image','video'],&#xA;plugins: ['fullscreen','video','table','fontcolor'],&#xA;toolbarFixedBox: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Font Color Redactor Plugin - &lt;a href=&quot;http://imperavi.com/redactor/plugins/font-color/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/plugins/font-color/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what the correct process is to get it working in my Craft admin. &lt;/p&gt;&#xA;" OwnerUserId="2196" LastActivityDate="2015-03-03T09:23:50.890" Title="Font Color in Rich Text field" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6917" PostTypeId="1" AcceptedAnswerId="6921" CreationDate="2015-02-02T11:43:15.147" Score="3" ViewCount="531" Body="&lt;p&gt;Referring to the screenshot below; I've just added a Matrix field to a new site, and I'm not sure what the checkboxes are for? The Matrix field just has two plain text fields. As far as I can tell, checking the box does nothing, and saving the entry unticks it. Might be a bit confusing for the client; any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vdoVQ.png&quot; alt=&quot;checkboxes&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-02-02T13:08:27.690" Title="What is the checkbox for when editing Matrix fields?" Tags="&lt;entries&gt;&lt;user-interface&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6918" PostTypeId="2" ParentId="1653" CreationDate="2015-02-02T11:47:19.230" Score="0" Body="&lt;p&gt;Using tabs is the only way to do this at the moment. As Lindsey says, using a Matrix field adds a table to the database and will slow down your load times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer, like you, to be able to group fields to improve usability for the client, but there's no way to do this at the moment apart from tabs.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-02-02T11:47:19.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6919" PostTypeId="2" ParentId="6913" CreationDate="2015-02-02T12:03:45.990" Score="0" Body="&lt;p&gt;The Entries Field does have configuration options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of Redactor, you could use Matrix and combine an Entries Field with a (Plain) Text Field using Markdown syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example string entered in your Text Field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bla bla [321 link][1] bla bla&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then make your Entries Field return the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1]: http://example.com/entry321&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then combine the strings in the template and apply the markdown filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how the Matrix field would look like in the CP:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/deMHX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-02T13:16:31.307" LastActivityDate="2015-02-02T13:16:31.307" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6920" PostTypeId="2" ParentId="6917" CreationDate="2015-02-02T12:44:38.750" Score="2" Body="&lt;p&gt;As far as i know, it's so you can re-order multiple blocks at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Ah yes, exactly as aberkie says! They are not just for re-ordering but allowing you to make actions affect multiple blocks at once.&lt;/p&gt;&#xA;" OwnerUserId="1151" LastEditorUserId="1151" LastEditDate="2015-02-02T13:08:27.690" LastActivityDate="2015-02-02T13:08:27.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6921" PostTypeId="2" ParentId="6917" CreationDate="2015-02-02T12:47:02.193" Score="6" Body="&lt;p&gt;The checkboxes can be used to select multiple matrix blocks at once to apply any action to the selected group. For example, you can select three different blocks and collapse, disable, or delete all of them using the settings gear on any of the selected blocks. You can also select multiple blocks are drag them all at the same time to re-order.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-02T12:47:02.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6922" PostTypeId="2" ParentId="6916" CreationDate="2015-02-02T13:25:04.530" Score="5" Body="&lt;p&gt;The plugin doesn't come with Craft. You have to manually install it with a Craft plugin, but luckily this is easy to do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set up your new Craft plugin (→ &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;nofollow&quot;&gt;&quot;Plugin Development - Setting Things Up&quot;&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Download the Redactor plugin and copy it to craft/plugins/myplugin/resources/&lt;/li&gt;&#xA;&lt;li&gt;Load the Redactor plugin JS file from the init function:&lt;br&gt;&#xA;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJsResource('myplugin/redactorplugin.js');&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-03T09:23:50.890" LastActivityDate="2015-03-03T09:23:50.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6923" PostTypeId="2" ParentId="6911" CreationDate="2015-02-02T14:34:13.563" Score="1" Body="&lt;p&gt;Don't worry about the UID column. Check out &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6599/activerecord-defineattributes#comment7535_6601&quot;&gt;this comment from Brad Bell&lt;/a&gt;. Craft uses the UID internally, and will add them when needed. You should be fine by leaving them blank.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-02T14:34:13.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6924" PostTypeId="1" AcceptedAnswerId="6926" CreationDate="2015-02-02T15:03:07.790" Score="2" ViewCount="479" Body="&lt;p&gt;I'm attempting to create a plugin that is going to create some basic fields/sections as a post-installation setup. I don't really want to create a full-blown CP entry so is there any way of just doing stuff when the user clicks &quot;save&quot; in the settings template? &lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-02-02T15:32:21.650" Title="Is there any way to hook into saving a plugins settings?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6925" PostTypeId="2" ParentId="6912" CreationDate="2015-02-02T15:18:43.517" Score="4" Body="&lt;p&gt;I gave this a quick test, and it seems that Craft only searches the title field of related assets, when searching entries. What you could do, is first search for all entries with your search term, then all assets with the search term AND related to an entry. Combine those to sets of ids, and you're all set (not really one line of code, though):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# your search term #}&#xA;{% set searchTerm = craft.request.param('q') %}&#xA;&#xA;{# first, search all entries with given search term #}&#xA;{% set entries = craft.entries.search(searchTerm).ids() %}&#xA;&#xA;{# first, search all assets with given search term and their relations #}&#xA;{% set assets = craft.assets.search(searchTerm).ids() %}&#xA;{% set entriesRelatedToAssets = craft.entries.relatedTo(assets).ids() %}&#xA;&#xA;{# Combine those ids to one array #}&#xA;{% set allIds = entries | merge(entriesRelatedToAssets) %}&#xA;&#xA;{# Then get all the entries with the given IDs #}&#xA;{% for entry in craft.entries.id(allIds) %}&#xA;    {{ entry.title }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-02T15:18:43.517" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6926" PostTypeId="2" ParentId="6924" CreationDate="2015-02-02T15:32:21.650" Score="3" Body="&lt;p&gt;Take a loot at the &lt;strong&gt;prepSettings()&lt;/strong&gt; function of your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/plugin-settings&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/plugin-settings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-02T15:32:21.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6927" PostTypeId="2" ParentId="6911" CreationDate="2015-02-02T15:58:20.290" Score="5" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/6923/57&quot;&gt;aberkie&lt;/a&gt; pointed out, Craft does use them internally, but they should not be left blank or you'll potentially run into some issues now and you'll miss out on some upcoming features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can programmatically create one with &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/StringHelper#UUID-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;StringHelper::UUID&lt;/a&gt; or use a site like &lt;a href=&quot;http://www.guidgen.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;guidgen.com&lt;/a&gt; to get a valid one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-02T16:27:00.997" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6928" PostTypeId="1" AcceptedAnswerId="6930" CreationDate="2015-02-02T16:34:35.823" Score="1" ViewCount="244" Body="&lt;p&gt;I have a client website that is reachable at www.mysite.com and mysite.com. Everything on the site functions fine, and the Craft CP can be accessed at either www.mysite.com/admin and mysite.com/admin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When accessed form mysite.com/admin, the user gets the &quot;The license located at config/license.key belongs to mysite.com. Transfer it to this domain?&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This hasn't affected anything yet, but I'm worried that Craft might suspend the license because of the two different domains. It is also worrying the client anytime they login at mysite.com/admin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips on how to permanently clear the message on both domains, or somehow let the licesne know that it is the same site on both www.mysite.com and mysite.com? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-02T17:40:28.537" Title="License alert message for mysite.com, but not www.mysite.com" Tags="&lt;control-panel&gt;&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6929" PostTypeId="1" AcceptedAnswerId="8514" CreationDate="2015-02-02T17:35:30.003" Score="4" ViewCount="651" Body="&lt;p&gt;I'm trying to import data from another database using locales, but am having trouble saving the other locale after the primary locale is saved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($row as $data) {&#xA;&#xA;    $entry = new EntryModel();&#xA;    $entry-&amp;gt;sectionId   = 1;&#xA;    $entry-&amp;gt;typeId      = 1;&#xA;    $entry-&amp;gt;authorId    = 1;&#xA;    $entry-&amp;gt;enabled     = true;&#xA;    $entry-&amp;gt;locale      = &quot;en&quot;;&#xA;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'description' =&amp;gt; $data[&quot;description-en&quot;],&#xA;    ));&#xA;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    if ($success) &#xA;    {&#xA;        ImportPlugin::log('Successfully saved entry &quot;'.$entry-&amp;gt;id.'&quot;', LogLevel::Info);&#xA;&#xA;        $entryEs = craft()-&amp;gt;entries-&amp;gt;getEntryById($entry-&amp;gt;id, &quot;es&quot;);&#xA;        $entryEs-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'description'   =&amp;gt; $data[&quot;description-es&quot;],&#xA;        ));&#xA;&#xA;        // **** The following doesn't work for some reason ****&#xA;&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entryEs);&#xA;    };&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The primary entry saves fine and if I dump vars I can see that both &lt;code&gt;$entry.id&lt;/code&gt; and &lt;code&gt;$entryEs&lt;/code&gt; exist and are formatted as expected — but it doesn't save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it perhaps being overwritten (or ignored) as the content from the primary locale is being copied to the other locales in the background? What's the recommended way to save multiple locales?&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-03-05T00:21:02.350" Title="Save multiple locale data via plugin" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;entry&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6930" PostTypeId="2" ParentId="6928" CreationDate="2015-02-02T17:40:28.537" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm worried that Craft might suspend the license because of the two different domains.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That will never happen, but from what you're describing you shouldn't be getting that alert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you hit up support@buildwithcraft.com with some details about the domain name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, you should probably be picking one of those (domain.com or www.domain.com) and forcing the other domain to redirect to it for &lt;a href=&quot;https://www.mattcutts.com/blog/seo-advice-url-canonicalization/&quot; rel=&quot;nofollow&quot;&gt;SEO reasons&lt;/a&gt;.  Otherwise, the all-mighty Google will treat them as two different domains.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-02T17:40:28.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6931" PostTypeId="2" ParentId="6913" CreationDate="2015-02-02T22:10:40.817" Score="2" Body="&lt;p&gt;Here is a &lt;strong&gt;super&lt;/strong&gt; hacky way to do this...but it does do the trick. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Locate the JS file responsible for rendering the Element Selector Modal (craft/app/resources/js/compressed/RichTextInput.js)&lt;/li&gt;&#xA;&lt;li&gt;Search for: {storageKey:&quot;RichTextFieldType.LinkToEntry&quot;. This is where the modal gets called. &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Nearby, locate &quot;criteria&quot; and change &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{locale:this.elementLocale} to {locale:this.elementLocale, section: ['sectionYouWant','otherSectionYouWant']}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Push this JS file to your server and only the sections you include in the section array above will show entries. The other section titles will show, but no entries will show up to select.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that this adjustment will probably be overriden by any Craft update. I bet building your own redactor plugin would be cleaner.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-02T22:10:40.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6933" PostTypeId="1" CreationDate="2015-02-02T22:27:18.457" Score="2" ViewCount="5744" Body="&lt;p&gt;I am getting this error returned whilst in Debug mode:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Template Error&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Impossible to access an attribute (&quot;gatewayHandle&quot;) on a NULL variable (&quot;&quot;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not sure why this is getting flagged up. It is a variable which is accessed through the Dukt Video plugin? Seems to work when not in debug mode, but I am getting slow initial response times when loading, not sure if this is related to that issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached the relevant page code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Video Link :: if entry is of video type #}&#xA;&#xA;{% if entries.section == &quot;Videos&quot; %}&#xA;&#xA;    {% set video = entries.video %}&#xA;&#xA;    {% if video.gatewayHandle == 'youtube' %}&#xA;        &amp;lt;a&#xA;            data-target=&quot;flare&quot;&#xA;            href=&quot;http://youtu.be/{{ video.id }}&quot;&#xA;        &amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;a&#xA;            data-target=&quot;flare&quot;&#xA;            href=&quot;http://vimeo.com/{{ video.id }}&quot;&#xA;        &amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% else %}&#xA;&#xA;{# Entry link #}&#xA;&#xA;&amp;lt;a href=&quot;{{ entries.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="650" OwnerDisplayName="Daryl Campbell" LastEditorUserId="45" LastEditDate="2015-02-02T22:36:24.910" LastActivityDate="2017-04-04T18:19:45.810" Title="&quot;Impossible to access an attribute on a NULL variable&quot;" Tags="&lt;templating&gt;&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6934" PostTypeId="2" ParentId="6933" CreationDate="2015-02-02T22:40:53.580" Score="2" Body="&lt;p&gt;That message is telling you that &lt;code&gt;gatewayHandle&lt;/code&gt; can't be accessed from &lt;code&gt;video&lt;/code&gt;, because &lt;code&gt;video&lt;/code&gt; is &lt;code&gt;NULL&lt;/code&gt;. You're expecting the videos field to always contain an object, but in this case it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you ensure that &lt;code&gt;video&lt;/code&gt; actually contains a value before you attempt to reference one of its properties...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set video = entries.video %}&#xA;&#xA;{% if video %}&#xA;&#xA;    {% if video.gatewayHandle == 'youtube' %}&#xA;        ...&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-02-02T22:40:53.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6935" PostTypeId="1" AcceptedAnswerId="6936" CreationDate="2015-02-02T22:51:32.337" Score="2" ViewCount="882" Body="&lt;p&gt;Is there a way to dynamically iterate over a matrix block's fields such that the template doesn't need to know the field handles? This doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {% for field in block %}&#xA;        {# do something with field #}       &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems like a simple thing to want to do but I haven't figured out a way to do it.&lt;/p&gt;&#xA;" OwnerUserId="341" LastActivityDate="2015-02-02T23:41:41.343" Title="Dynamically iterate over a matrix block's fields?" Tags="&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6936" PostTypeId="2" ParentId="6935" CreationDate="2015-02-02T23:34:30.903" Score="5" Body="&lt;p&gt;Not sure what you want to do with the fields, but you can access them through fieldLayout.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;    {% for field in block.getFieldLayout().getFields() %}&#xA;&#xA;        {# get properties #}&#xA;        {{ field.getField().name }}&#xA;        {{ field.getField().handle }}&#xA;        {{ field.getField().id }}&#xA;&#xA;        {# get value #}&#xA;        {% set handle = field.getField().handle %}&#xA;        {{ block[handle] }}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You do kind of need to know what the field types are, in order to know how to display them. &lt;code&gt;{{ block[handle] }}&lt;/code&gt; will fail for instance if one of the fields is an 'Entry' field, because you can't convert an ElementCriteriaModel to a string. To check the field type you can use &lt;code&gt;field.getField().type&lt;/code&gt;;&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-02T23:41:41.343" LastActivityDate="2015-02-02T23:41:41.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6937" PostTypeId="1" AcceptedAnswerId="6942" CreationDate="2015-02-02T23:58:45.263" Score="6" ViewCount="1540" Body="&lt;p&gt;I'll do my best to explain this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Portfolio of companies, which I have as a structure, that I need to be able to filter/search through by using up to four different parameters.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keyword&lt;/strong&gt; - a basic search field that a user can type into&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Industry&lt;/strong&gt; - a category field&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Company Status&lt;/strong&gt; - a dropdown field&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Board Members&lt;/strong&gt; - a relation to a different structure&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know how to search these individually but I'm not quite sure how to use any combo of these all at once. Whether that be using a keyword and industry to search, all four items to search, maybe just by industry and board members, or maybe just by industry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is what I have so far. Hoping someone will be able to point me in the right direction or help me piece this together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This handles the search&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{# What is being searched #}&#xA;{% set portfolio = craft.entries.section('portfolio') %}&#xA;&#xA;{# Potential Query Strings #}&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set industryParam = craft.request.getParam('industry') %}&#xA;{% set statusParam = craft.request.getParam('status') %}&#xA;{% set boardMemberParam = craft.request.getParam('boardMember') %}&#xA;&#xA;{# Related to Industry and/or Board Member #}&#xA;{% set industry = craft.categories.group('industries').slug(industryParam).first %}&#xA;&#xA;{# Here's where I'm not sure how to combine the relatedTo for the industry, status, and/or board members #}&#xA;{% set relationParam = industryParam ? {targetElement: industry} : '' %}&#xA;&#xA;{% set entries = portfolio.relatedTo(relationParam).search(query) %}&#xA;&#xA;{# Probably best to not use search, as it's slower than relatedTo, so I commented this out. #}&#xA;{# .search('companyStatus::&quot;' ~ statusParam ~ '&quot;') #}&#xA;&#xA;{# Spit out the entries #}&#xA;{% if entries|length %}&#xA;&#xA;  {% for entry in entries %}&#xA;    &amp;lt;article class=&quot;portfolio-item grid-3&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;portfolio-item-content&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;h3 class=&quot;portfolio-item-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;{% else %} {# If nothing matches the search criteria #}&#xA;&#xA;  &amp;lt;p&amp;gt;Sorry, no results.&amp;lt;/p&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stripped down version of where the user sets the parameters&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('portfolio') }}&quot;&amp;gt;&#xA;  &amp;lt;h3 class=&quot;sidebar-title&quot;&amp;gt;Filter by Keyword&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;&#xA;  &amp;lt;h3 class=&quot;sidebar-title&quot;&amp;gt;Filter by Industry&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;select class=&quot;fancy&quot; name=&quot;industry&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;All Industries&amp;lt;/option&amp;gt;&#xA;&#xA;    {# Only get categories that are being used. #}&#xA;    {# This will definitely need some cache tags. #}&#xA;    {% set categories = craft.categories.group('industries').order('title asc') %}&#xA;    {% set entriesWithCategories = craft.entries.relatedTo(categories) %}&#xA;    {% set categoriesInUse = craft.categories.relatedTo(entriesWithCategories) %}&#xA;&#xA;    {% for category in categoriesInUse %}&#xA;      &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  &amp;lt;h3 class=&quot;sidebar-title&quot;&amp;gt;Filter by Status&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;select class=&quot;fancy&quot; name=&quot;status&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;All Statuses&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;active&quot;&amp;gt;Active&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;past&quot;&amp;gt;Past&amp;lt;/option&amp;gt;&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  &amp;lt;h3 class=&quot;sidebar-title&quot;&amp;gt;Filter by Board Member&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;select class=&quot;fancy&quot; name=&quot;boardMember&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;All Board Memebers&amp;lt;/option&amp;gt;&#xA;    {% set team = craft.entries.section('team') %}&#xA;    {% for member in team %}&#xA;      &amp;lt;option value=&quot;{{ member.slug }}&quot;&amp;gt;{{ member.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if possible, how would I do this with AJAX? This can come later, initial search function is 100% okay. I know I could do the the AJAX filter completely on the Front-End but there's potential that the client will want to eventually add pagination if they start adding a bunch of companies to their portfolio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="44" LastEditorUserId="3951" LastEditDate="2017-11-07T22:51:31.863" LastActivityDate="2017-11-08T04:18:15.510" Title="Searching a specific section by four different types of parameters?" Tags="&lt;relations&gt;&lt;search&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6938" PostTypeId="1" CreationDate="2015-02-03T00:16:05.413" Score="3" ViewCount="614" Body="&lt;p&gt;This is primarily directed to P&amp;amp;T, but I'm working on a project which is heavily using/extending Craft Assets.  I noticed in the Asset Service there is a reference to breaking changes in Craft 3.0.  I don't want to get too far down the road with this to realize it will have to be refactored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure you're not willing to give a 3.0 release date, but any indication to what these change will look like or when they will happen is helpful.&lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="125" LastEditDate="2015-05-29T14:59:58.697" LastActivityDate="2015-05-29T14:59:58.697" Title="Asset Changes in v3.0" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6939" PostTypeId="1" CreationDate="2015-02-03T00:18:10.667" Score="4" ViewCount="731" Body="&lt;p&gt;We use &lt;strong&gt;event&lt;/strong&gt; integration (native and custom) in a lot of the plugins we build and I was wondering if anyone has come up with a simple way to raise those events at will, without having to follow a specific flow of execution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you are listening for &lt;code&gt;entries.saveEntry&lt;/code&gt; and don't want to manually save an entry in order for that event to be raised/triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it would be nice to have a simple way of doing this and interested in seeing if anyone has found the need for such thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With enough patience, one could fake many events and call the service that raises them but I'm sure that there other developer way more clever than me that may have solved this already.&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2015-02-03T00:38:30.207" Title="How do you raise/fake an event so that you can test handlers listening for it?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6940" PostTypeId="2" ParentId="6938" CreationDate="2015-02-03T00:31:04.633" Score="3" Body="&lt;p&gt;Craft’s assets functionality is getting refactored in Craft 3, so anything you do with those APIs today will need to be updated when 3.0 comes out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The silver lining for you is, literally &lt;em&gt;every&lt;/em&gt; plugin will need to be updated for Craft 3 (due to us moving to Yii 2), so we are planning on having a several month-long beta period where we will work with plugin developers to get their plugins updated, before the official public release. So we will be happy to work with you on updating your plugin during that period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as an ETA, I couldn’t say. Craft 2 still has a lot of shelf life ahead of it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-02-03T00:31:04.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6941" PostTypeId="2" ParentId="6939" CreationDate="2015-02-03T00:38:30.207" Score="5" Body="&lt;p&gt;I believe events can be raised programmatically by calling them from services. You could mimic this behavior by creating an Event object (&lt;code&gt;$event&lt;/code&gt;) and calling calling &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;onBeforeSaveEntry($event)&lt;/code&gt; yourself, for example. You would need to set up the event context and create a new Event object as the code does in the Entries Service below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event = new Event($this, array(&#xA;  'entry'      =&amp;gt; $entry,&#xA;  'isNewEntry' =&amp;gt; $isNewEntry&#xA;));&#xA;&#xA;$this-&amp;gt;onBeforeSaveEntry($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/EntriesService.php&quot;&gt;Entries Service&lt;/a&gt; around lines 165 to see how Craft uses events in that context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each event call, the code is calling &lt;code&gt;$this-&amp;gt;raiseEvent('eventName', $event);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I bet with some minimal setup, you could write a test controller that can call these events at will. Good question - I've been going down the manual path for all my testing too! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-03T00:38:30.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6942" PostTypeId="2" ParentId="6937" CreationDate="2015-02-03T01:52:25.827" Score="8" Body="&lt;p&gt;One method is to build your params before performing the search.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# set base params #}&#xA;{% set params = {&#xA;    section: 'portfolio',&#xA;    limit: null&#xA;} %}&#xA;{% set relatedParams = ['and'] %}&#xA;&#xA;{# status #}&#xA;{% if craft.request.getParam('status') %}&#xA;    {% set status = craft.request.getParam('status') %}&#xA;    {% set params = params|merge({'companyStatus':status}) %}&#xA;{% endif %}&#xA;&#xA;{# industry #}&#xA;{% if craft.request.getParam('industry') %}&#xA;    {% set category = craft.categories.group('industries').slug(craft.request.getParam('industry')).first %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:category }]) %}&#xA;{% endif %}&#xA;&#xA;{# board member #}&#xA;{% if craft.request.getParam('boardMember') %}&#xA;    {% set boardMember = craft.entries.section('team').slug(craft.request.getParam('boardMember')).first %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:boardMember }]) %}&#xA;{% endif %}&#xA;&#xA;{# add relatedParams to params #}&#xA;{% if relatedParams|length &amp;gt; 1 %}&#xA;    {% set params = params|merge({'relatedTo':relatedParams}) %}&#xA;{% endif %}&#xA;&#xA;{# perform search #}&#xA;{% set searchParams = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries(params).search(searchParams|trim) %}&#xA;&#xA;{# display results #}&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To AJAX load results you would place this in another template and load it dynamically with jquery. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4414/search-contact-person-plugin-via-ajax/4415#4415&quot;&gt;this answer&lt;/a&gt; for an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To paginate the results you will need to submit your form as &quot;GET&quot; and append the query to your nextPage and prevPage links. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6655/search-results-pagination-with-multiple-form-fields&quot;&gt;this answer&lt;/a&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="3951" LastEditDate="2017-11-08T04:18:15.510" LastActivityDate="2017-11-08T04:18:15.510" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6943" PostTypeId="1" AcceptedAnswerId="6946" CreationDate="2015-02-03T08:26:57.060" Score="1" ViewCount="334" Body="&lt;p&gt;Is there a way to reverse the Assets field keeping the fixed order? I've tried a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myAssetsField.order('fixedOrder desc') //breaks&#xA;myAssetsField.order('id desc') // wrong, since they're not sorted by id&#xA;myAssetsField.reverse() // does nothing&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-02-03T09:11:41.390" Title="Reverse Assets fixedOrder" Tags="&lt;assets&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6944" PostTypeId="1" AcceptedAnswerId="6945" CreationDate="2015-02-03T08:50:31.217" Score="3" ViewCount="576" Body="&lt;p&gt;in order for my client to have the choice of selecting options or not, I entered an empty (blank) option in a dropdown field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frontend, I use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.dropdownFieldHandle|length %}&#xA;&amp;lt;dt&amp;gt;Title&amp;lt;/dt&amp;gt;&#xA;&amp;lt;dd&amp;gt;{{ entry.dropdownFieldHandle }}&amp;lt;/dd&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is even if the client chooses the blank option, it still makes the code appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I wrong?&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2015-02-03T09:02:13.363" Title="Dropdown empty option" Tags="&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6945" PostTypeId="2" ParentId="6944" CreationDate="2015-02-03T09:02:13.363" Score="4" Body="&lt;p&gt;If the client selects an empty value you probably will get an empty value back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Make sure we have a value #}&#xA;{% if entry.dropdownFieldHandle != &quot;&quot; %}&#xA;    &amp;lt;dt&amp;gt;Title&amp;lt;/dt&amp;gt;&#xA;    &amp;lt;dd&amp;gt;{{ entry.dropdownFieldHandle }}&amp;lt;/dd&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-03T09:02:13.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6946" PostTypeId="2" ParentId="6943" CreationDate="2015-02-03T09:08:33.357" Score="4" Body="&lt;p&gt;You could try &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/reverse.html&quot; rel=&quot;nofollow&quot;&gt;twig's reverse filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.assetsField|reverse %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot;/&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-03T09:08:33.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6947" PostTypeId="2" ParentId="6943" CreationDate="2015-02-03T09:11:41.390" Score="3" Body="&lt;p&gt;Set the order parameter to &lt;code&gt;'sortOrder desc'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = myAssetsField.order('sortOrder desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-03T09:11:41.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6948" PostTypeId="1" CreationDate="2015-02-03T10:26:59.633" Score="0" ViewCount="1088" Body="&lt;p&gt;I've had trouble getting animated GIFs to transform properly on my Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've installed Imagick on my server, and set $imageDriver to imagick explicitly. This seems to have allowed some GIFs to transform but not others. I've tried GIFs I've made myself in Photoshop, and GIFs found online, with completely mixed results. No rhyme or reason to it at all as far as I can tell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A GIF that resized correctly: &lt;a href=&quot;http://craft.kingzog.com/img/_thumbnail/OH-TEE.gif&quot; rel=&quot;nofollow&quot;&gt;http://craft.kingzog.com/img/_thumbnail/OH-TEE.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And one that didn't: &lt;a href=&quot;http://craft.kingzog.com/img/_thumbnail/tennis_gif.gif&quot; rel=&quot;nofollow&quot;&gt;http://craft.kingzog.com/img/_thumbnail/tennis_gif.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm not allowed to post too many links, but of course you can remove /_thumbnail from the URLs to view the original, still-animated GIFs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stumped. Anyone have any knowledge about file formatting, config or anything else that might help?&lt;/p&gt;&#xA;" OwnerUserId="2259" LastActivityDate="2015-02-20T01:11:04.187" Title="Animated GIFs not animating - sometimes" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6949" PostTypeId="1" AcceptedAnswerId="6966" CreationDate="2015-02-03T12:05:01.397" Score="1" ViewCount="247" Body="&lt;p&gt;I want to output some code after the 10th &lt;strong&gt;top level&lt;/strong&gt; category in a category listing. For example...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1.1.&lt;/li&gt;&#xA;&lt;li&gt;1.2.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;2.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;2.1.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;3.&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;li&gt;10.&lt;/li&gt;&#xA;&lt;li&gt;Zoiks!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem is, I can't use Twig's loop.index in a conditional because it counts each of the children too (like a flat list). How can I test for the 10th top-level category?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('categoryGroup') %}&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% ifchildren %}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% children %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% if category.level == 1 and loop.index == 10 %}&#xA;    &amp;lt;li&amp;gt;Zoiks! That‘s a lot of categories!&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-02-03T21:08:36.433" Title="Find the nth top-level category in a nav tag" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6950" PostTypeId="2" ParentId="6949" CreationDate="2015-02-03T12:22:32.610" Score="2" Body="&lt;p&gt;Maybe you can add in a little counting magic of your own:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# before the nav tag #}&#xA;{% set topLevelIndex = 1 %}&#xA;&#xA;{# inside nav loop #}&#xA;{% if category.level == 1 and topLevelIndex == 10 %}&#xA;    &amp;lt;li&amp;gt;Zoiks! That‘s a lot of categories!&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;{% if category.level == 1 %}&#xA;    {% set topLevelIndex = topLevelIndex + 1 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This code hasn't been tested...&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-03T12:22:32.610" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6951" PostTypeId="1" CreationDate="2015-02-03T12:43:07.033" Score="3" ViewCount="1596" Body="&lt;p&gt;Is it possible to populate the Craft content database table with entries from a non-craft database (which isn't a live database, it's a local copy). I've set up my channels etc for the incoming data which corresponds to the data from my other db.&lt;/p&gt;&#xA;" OwnerUserId="2257" LastEditorUserId="125" LastEditDate="2015-05-29T15:00:05.847" LastActivityDate="2015-05-29T15:00:05.847" Title="Populating craft database from non-craft data" Tags="&lt;database&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6952" PostTypeId="2" ParentId="6951" CreationDate="2015-02-03T14:15:14.907" Score="1" Body="&lt;p&gt;It's not just the &lt;code&gt;craft_content&lt;/code&gt; table that you'll need to worry about because entry data is stored in multiple tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're going to be better off using an existing import plugin or writing your own custom plugin that interacts with Craft's services... specifically &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5/how-do-i-import-data-into-craft&quot;&gt;here&lt;/a&gt; for more info.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-03T14:15:14.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6953" PostTypeId="2" ParentId="6951" CreationDate="2015-02-03T14:53:23.857" Score="5" Body="&lt;p&gt;Brad is absolutely correct. Better off trying for an existing plugin (we have one in the works over here for very robust Wordpress migrating!!!), but here are a few steps to get you started:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Move the non-craft database tables over to a staging server with your craft tables, and rename them with a craft_ prefix (or whatever you have set as your prefix in config). &#xA;Query for the entries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;-&amp;gt;select('*')&#xA;-&amp;gt;from('your-non-craft-post-table')&#xA;-&amp;gt;where('any conditions')&#xA;-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop through the query results, creating new Entry Models and assigning columns to your fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Go through each $query result&#xA;foreach($query as $old_entry){&#xA;    $entry = new EntryModel();&#xA;    $entry-&amp;gt;sectionId = your_craft_section_id;&#xA;    $entry-&amp;gt;authorId = your_craft_user_id;&#xA;    $entry-&amp;gt;postDate = $old_entry['old_post_date_column'];&#xA;    $entry-&amp;gt;enabled = true;&#xA;&#xA;    //This is the fun part - mapping content to your custom fields&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = $old_entry['old_title_column'];&#xA;    $entry-&amp;gt;getContent()-&amp;gt;yourCustomFieldHandle = $old_entry['column_to_map_to_custom_field'];&#xA;&#xA;    //Use the Entries service to save the new entry&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously there is more to it than that...mapping user accounts, categories, tags, assets, etc. But hopefully this will help you get started!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-03T14:53:23.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6954" PostTypeId="2" ParentId="298" CreationDate="2015-02-03T17:32:08.607" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories#level&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;level&lt;/code&gt;&lt;/a&gt; parameter of a Categories ElementCriteriaModel to get a list of nth-level categories, just to make your category search a bit more robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you can use Twig's &lt;code&gt;without&lt;/code&gt; filter to create the set of entries related to the primary category but &lt;em&gt;not&lt;/em&gt; related to its child categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Identify the primary category you want #}&#xA;{% set cat = craft.categories.title('1.').level(1).first() %}&#xA;&#xA;{# Identify the [child] categories you don't want #}&#xA;{# set childCats = cat.children #}&#xA;&#xA;{# Grab an array of entries related to the primary category #}&#xA;{% set entries = craft.entries.section('mySection').relatedTo(cat).find() %}&#xA;&#xA;{# Get an array of entries related to the child categories #}&#xA;{% set excludedEntries = craft.entries.section('mySection').relatedTo(childCats).find() %}&#xA;&#xA;{# Exclude the second set and loop over the resulting array #}&#xA;{% for entry in entries|without(excludedEntries) %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is still a bit janky, and you'd have to tweak it for performance if you were interested in more than one primary category at a time... but maybe it's a start.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-03T17:32:08.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6955" PostTypeId="1" CreationDate="2015-02-03T17:50:34.310" Score="2" ViewCount="267" Body="&lt;p&gt;Let's say I'm outputting a list/nav of categories, with the count of entries in each category, as described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/395/689&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/a/6868/689&quot;&gt;questions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('...') %}&#xA;   {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;   {{ category.title}} ({{ entryCount }})&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On a site with plenty of categories (more than 100 in this case), that seems like &lt;strong&gt;a lot&lt;/strong&gt; of relatedTo queries. Is there a way I could accomplish the same thing with fewer queries / better performance?&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-03T18:58:39.457" Title="Performance of a categories list with post count" Tags="&lt;categories&gt;&lt;relations&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6956" PostTypeId="2" ParentId="6955" CreationDate="2015-02-03T18:00:27.797" Score="2" Body="&lt;p&gt;I don't think you'll be able to avoid the database queries, but you'll definitely want to use cacheing here, and set a high cache time if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wrap your code in {% cache %} &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;tags&lt;/a&gt; like below: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally for 1 month %}&#xA;{% nav category in craft.categories.group('...') %}&#xA;   {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;   {{ category.title}} ({{ entryCount }})&#xA;{% endnav %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this navigation appears on every page, use the &quot;globally&quot; tag.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-03T18:00:27.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6957" PostTypeId="2" ParentId="6951" CreationDate="2015-02-03T18:40:07.160" Score="3" Body="&lt;p&gt;You might want to consider a CSV import as well.  You could export the data out of the db using something like phpmyadmin's export to csv and then import the content back into Craft using the indispensable  &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;import plugin&lt;/a&gt; by Bob Olde Hampsink to do the dirty work—it'll handle things like which author and mapping the fields and channels to the right places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this will only work on a dump-by-dump case; if you need it continually updated, then writing your own might be the way to go.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-02-03T18:40:07.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6958" PostTypeId="2" ParentId="6951" CreationDate="2015-02-03T18:41:42.893" Score="3" Body="&lt;p&gt;aberkie's answer is spot on. I just spent the last couple days doing exactly this — importing data from a non-craft database — so thought I would share some additional tips and files that helped. I also used 'PDO' to connect to the database instead of the 'Yii' connection method, but use whatever you like.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create your plugin called 'ImportPlugin' (or whatever) with a main plugin file ('import/ImportPlugin.php') and a services file ('import/services/ImportService.php').&lt;/li&gt;&#xA;&lt;li&gt;Recommend installing a plugin called '&lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCIQFjAA&amp;amp;url=https%3A%2F%2Fgithub.com%2Fam-impact%2Famcommand&amp;amp;ei=VwvRVJq7LavdsATYvYGACg&amp;amp;usg=AFQjCNFcGAskzUa5bZsiRnQeCXSbSWgzEw&amp;amp;sig2=vn1Tr5SSu9fN5JE3pWAiFg&amp;amp;bvm=bv.85076809,d.cWc&quot; rel=&quot;nofollow&quot;&gt;amcommand&lt;/a&gt;' which does two things that are really helpful: 1) it creates a command palette with the option to 'delete all data' from a section, so that you can easily try again if something isn't quite right the first time (which it won't be); 2) it lets you define your own commands, by writing a few simple lines in your plugin file, so you can easily trigger your import service methods.&lt;/li&gt;&#xA;&lt;li&gt;Open up your craft database and old database in Sequel Pro for reference.&lt;/li&gt;&#xA;&lt;li&gt;Open up your 'craft.log', 'php_errors.log' and 'import.log' in console windows using &lt;code&gt;tail -f /path/to/craft/runtime/logs/logfile.php&lt;/code&gt; for monitoring ('import.log' will be created automatically the first time you use it).&lt;/li&gt;&#xA;&lt;li&gt;Recommend working on one section at a time, and backing up your craft database after each successfully import.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In craft/plugins/import/ImportPlugin.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ImportPlugin extends BasePlugin&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        return 'Import';&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '0.1';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return craft()-&amp;gt;getSiteName();&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'http://domain.com';&#xA;    }&#xA;&#xA;    public function hasCpSection()&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        /*&#xA;         * This will call your import service method directly when loading&#xA;         * any craft template or viewing any page in the CP.&#xA;         * Useful for testing your output using `var_dump($vars)`.&#xA;         * Not so good for importing — because it may get called more than once.&#xA;         * Uncomment if needed.&#xA;         */&#xA;        //craft()-&amp;gt;import-&amp;gt;importRecords();&#xA;&#xA;    }&#xA;&#xA;    // Add custom commands to the 'amcommand' palette plugin&#xA;    public function addCommands() {&#xA;        $commands = array(&#xA;&#xA;            array(&#xA;                'name' =&amp;gt; 'Import Records',&#xA;                'type' =&amp;gt; 'Custom',&#xA;                'call' =&amp;gt; 'importRecords',&#xA;                'service' =&amp;gt; 'import'&#xA;            ),&#xA;            // add more commands as needed&#xA;&#xA;        );&#xA;        return $commands;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In 'craft/plugins/import/services/ImportService.php' (Every case is different; this is just the process I happened to need. Use aberkie's solution if that is simpler):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ImportService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    public function importRecords()&#xA;    {   &#xA;        $username = 'username';&#xA;        $password = 'password';&#xA;&#xA;        try {&#xA;            $db = new \PDO('mysql:host=localhost;dbname=old_database;charset=utf8', $username, $password);&#xA;            $db-&amp;gt;setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);&#xA;        } catch(PDOException $e) {&#xA;            echo 'ERROR: ' . $e-&amp;gt;getMessage();&#xA;        }&#xA;&#xA;        // Write query as needed (in this example I needed to join content from multiple tables)&#xA;        $query = &#xA;            &quot;SELECT a.id, b.id, b.tableA_id, c.tableB_id, a.field1, a.field2, b.field3, b.field4, c.field5, c.field6, c.field7&#xA;            FROM table_A a&#xA;            LEFT JOIN (table_B b, table_C c)&#xA;            ON (a.id = b.tableA_id AND b.id=c.tableB_id)&#xA;            ORDER BY a.id&#xA;            &quot;;&#xA;&#xA;        $result = $db-&amp;gt;query($query);&#xA;&#xA;        // reformat results for craft&#xA;        $records = [];&#xA;&#xA;        foreach($result as $row)&#xA;        {&#xA;            /* Because of the sql table join I have more than one row&#xA;             * with the same id, so don't recreate the record if it &#xA;             * already exists. Arbitrarily using row['id'] as key to join rows.&#xA;             */ &#xA;            if (!array_key_exists($row['id'])&#xA;            {&#xA;                // map data&#xA;                $records[$row['id']] = array(&#xA;                    'craftfield1'   =&amp;gt; $row['field1'],&#xA;                    'craftfield2'   =&amp;gt; $row['field2'],&#xA;                    'craftfield3'   =&amp;gt; [],&#xA;                );&#xA;            }&#xA;&#xA;            /* if you need to combine data from multiple rows&#xA;             * into a single field in craft for some reason you can do it here.&#xA;             * (i.e. pushing content into a single craft table field)&#xA;             */&#xA;&#xA;            array_push( $records[$row['id']]['craftfield3'] , array(&quot;col1&quot; =&amp;gt; $row['field3'], &quot;col2&quot; =&amp;gt; $row['field4']) );&#xA;&#xA;        }&#xA;&#xA;        // create your craft entries&#xA;        foreach($records as $record) {&#xA;&#xA;            $entry = new EntryModel();&#xA;            $entry-&amp;gt;sectionId   = 1; // Use 'id' from 'craft_sections' table&#xA;            $entry-&amp;gt;typeId      = 1; // Use 'id' from 'craft_entrytypes' table&#xA;            $entry-&amp;gt;authorId    = 1; // Use 'id' from 'craft_users' table&#xA;            $entry-&amp;gt;enabled     = true;&#xA;&#xA;            $entry-&amp;gt;getContent()-&amp;gt;setAttributes($record);&#xA;&#xA;            // Save entry&#xA;            $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;            if (!$success)&#xA;            {&#xA;                $errors = $entry-&amp;gt;getErrors();&#xA;                foreach ($errors as $error) {&#xA;                    ImportPlugin::log('Error:'.$error[0], LogLevel::Error);&#xA;                }&#xA;            }&#xA;            else&#xA;            {&#xA;                ImportPlugin::log('Successfully saved entry &quot;'.$entry-&amp;gt;id.'&quot;', LogLevel::Info);&#xA;            };&#xA;&#xA;            /* Print $records for debugging if needed.&#xA;             * Note: Will only work if calling this service method directly from&#xA;             * plugin's 'init' function, otherwise this will be a background process.&#xA;             */ &#xA;            //var_dump($record);&#xA;            //print_r($record);&#xA;            //echo &quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&quot;;&#xA;        }&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-03T18:41:42.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6959" PostTypeId="1" AcceptedAnswerId="6964" CreationDate="2015-02-03T18:53:12.557" Score="1" ViewCount="1222" Body="&lt;p&gt;I'm trying to write a general purpose matrix template and I've come up on a little snag with tables fields. I see no way to get the column header values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2148/show-a-table-fields-column-headers-in-template&quot;&gt;here&lt;/a&gt; mentions &lt;code&gt;craft.fields.getFieldById(block.fieldId)&lt;/code&gt; but that doesn't appear to exist according to the documentation, nor did it work properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest I've gotten is this dirty slice job and that only gives me the ids of the columns. So I can do some string manipulation to get them close to the value but they can be completely different as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set first = block.table | first %}&#xA;{% set columns = first | keys | slice((first | length) / 2, first | length) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas would be helpful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;  &amp;lt;thead&amp;gt;&#xA;    {{ loop through table headers }}&#xA;  &amp;lt;/thead&amp;gt;&#xA;  &amp;lt;tbody&amp;gt;&#xA;    {{ loop through table data }}&#xA;  &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="54" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-03T20:59:21.510" Title="How do I get the column headers of a table in a matrix?" Tags="&lt;matrix&gt;&lt;templating&gt;&lt;table&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6960" PostTypeId="2" ParentId="6955" CreationDate="2015-02-03T18:58:39.457" Score="2" Body="&lt;p&gt;Another option would be to use the rarely talked about &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; feature in Craft.  The link shows some examples of how to use it and the control panel uses it in one or two places to speed things up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from the PHP side, you'd be able to grab all of the data you'd need from the database (using commandBuilder(), joins, etc.), then return it all to the template formatted in a way it can easily consume.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-03T18:58:39.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6961" PostTypeId="1" CreationDate="2015-02-03T19:28:04.650" Score="1" ViewCount="164" Body="&lt;p&gt;Sometimes my clients site is down and it shows one of the following errors (black text on white screen):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [system.db.CDbCommand] CDbCommand::fetchAll() fout: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp/#sql_135b_0.MYI' &#xA;&#xA;CDbCommand faalde tijdens het uitvoeren van volgend SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'krycer_be_craft.t' doesn't exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are the same errors that are shown in the log files (with a bunch of other stuff).&#xA;The wierd thing is, it doesn't happen all the time. Nothing changed on the site scince a few weeks also. A few weeks ago I restored a database back-up, but everything worked fine untill now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone has an idea? I updated to the latest version and cleared the cache, maybe it'll help but I would like to know the reason behind these errors.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-02-03T19:45:10.317" Title="SQLSTATE[HY000] errors" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6962" PostTypeId="1" AcceptedAnswerId="6967" CreationDate="2015-02-03T19:36:35.010" Score="3" ViewCount="1525" Body="&lt;p&gt;When working with a custom form that posts to a plugin function - what's the best way to return errors that would be displayed like the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/forgot-password-form&quot; rel=&quot;nofollow&quot;&gt;forgot password&lt;/a&gt; code example below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if errors is defined %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2015-02-03T19:51:24.893" LastActivityDate="2015-02-03T21:20:06.433" Title="Returning errors into templates" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;error-templates&gt;&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6963" PostTypeId="2" ParentId="6961" CreationDate="2015-02-03T19:45:10.317" Score="1" Body="&lt;p&gt;If I had to guess, MySQL has ran out of disk space on the volume that it's trying to write to.  Either that, or your host applies some artificial limit to the size of your MySQL databases that you're bumping up against.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-03T19:45:10.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6964" PostTypeId="2" ParentId="6959" CreationDate="2015-02-03T19:58:32.143" Score="2" Body="&lt;p&gt;Updated code to output the entire table (headers and data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('sectionHandle').first %}&#xA;&#xA;{% for block in entry.matrixFieldHandle %}&#xA;&#xA;    {% for field in block.getFieldLayout().getFields() %}&#xA;&#xA;        {% set type = field.getField().type %}&#xA;&#xA;        {% switch type %}&#xA;            {% case 'Table' %}&#xA;&#xA;                &amp;lt;h3&amp;gt;{{ field.getField().name }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                &amp;lt;table&amp;gt;&#xA;                    &amp;lt;thead&amp;gt;&#xA;                        &amp;lt;tr&amp;gt;&#xA;                            {% set columns = field.getField().settings.columns %}&#xA;                            {% for col in columns %}        &#xA;                                &amp;lt;th&amp;gt;{{ col.heading }}&amp;lt;/th&amp;gt;&#xA;                            {% endfor %}&#xA;                        &amp;lt;/tr&amp;gt;&#xA;                    &amp;lt;/thead&amp;gt;&#xA;                    &amp;lt;tbody&amp;gt;&#xA;                            {% set handle = field.getField().handle %}&#xA;                            {% set tableData = block[handle] %}&#xA;                            {% for row in tableData %}&#xA;                                &amp;lt;tr&amp;gt;&#xA;                                    {% for key, col in row if key|slice(0,3) == 'col' %}&#xA;                                        &amp;lt;td&amp;gt;{{ col }}&amp;lt;/td&amp;gt;&#xA;                                    {% endfor %}&#xA;                                &amp;lt;/tr&amp;gt;&#xA;                            {% endfor %}&#xA;                    &amp;lt;/tbody&amp;gt;&#xA;                &amp;lt;/table&amp;gt;&#xA;&#xA;        {% endswitch %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-03T20:59:21.510" LastActivityDate="2015-02-03T20:59:21.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6965" PostTypeId="1" AcceptedAnswerId="6969" CreationDate="2015-02-03T20:37:05.917" Score="0" ViewCount="115" Body="&lt;p&gt;I would like to give my client the client account, but first, I would like to assign my colleague as the client, just so we can see what the process looks like and see how our client will view Craft. Will it be possible to update the name and email address afterwards?&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2015-02-03T22:34:30.107" Title="Can I reassign the client account?" Tags="&lt;users&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6966" PostTypeId="2" ParentId="6949" CreationDate="2015-02-03T21:08:36.433" Score="2" Body="&lt;p&gt;I think you'll just need to put it &lt;em&gt;before&lt;/em&gt; the &lt;code&gt;{% children %}&lt;/code&gt; tags.  Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('categoryGroup') %}&#xA;    &amp;lt;li&amp;gt;&#xA;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% if category.level == 1 and loop.index == 10 %}&#xA;            &amp;lt;li&amp;gt;Zoiks! That‘s a lot of categories!&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {% if category.level == 1 %}&#xA;            {% set topLevelIndex = topLevelIndex + 1 %}&#xA;        {% endif %}&#xA;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-03T21:08:36.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6967" PostTypeId="2" ParentId="6962" CreationDate="2015-02-03T21:20:06.433" Score="4" Body="&lt;p&gt;I just return the form model object back to the template. Yii has built in validation and error handling within the models themselves. In the example &lt;code&gt;email&lt;/code&gt; is the instance of your form's model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if email is not defined %}&#xA;    {% set email = craft.postmaster.email() %}&#xA;{% endif %}&#xA;&#xA;{% for error in email.getAllErrors() %}&#xA;    &amp;lt;p&amp;gt;{{ error }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;p&amp;gt;&#xA;    &amp;lt;label for=&quot;toEmail&quot;&amp;gt;To Email&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;toEmail&quot; name=&quot;toEmail&quot; value=&quot;{{ email.toEmail }}&quot; /&amp;gt;&#xA;    {% if email.getError('toEmail') %}&#xA;    &amp;lt;label for=&quot;toEmail&quot;&amp;gt;{{ email.getError('toEmail') }}&amp;lt;/label&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model = new Postmaster_EmailFormModel(craft()-&amp;gt;request-&amp;gt;getPost());&#xA;&#xA;if(!$model-&amp;gt;validate())&#xA;{ &#xA;    // Prepare a flash error message for the user.&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('The email could not be sent.'));&#xA;&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'email' =&amp;gt; $model&#xA;    ));&#xA;}&#xA;else&#xA;{&#xA;    $event = new Event($this, array(&#xA;        'email' =&amp;gt; $model&#xA;    ));&#xA;&#xA;    craft()-&amp;gt;postmaster_forms-&amp;gt;onEmailFormSend($event);&#xA;&#xA;    $this-&amp;gt;redirect(craft()-&amp;gt;request-&amp;gt;getPost('redirect'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-02-03T21:20:06.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6968" PostTypeId="1" CreationDate="2015-02-03T22:00:55.453" Score="1" ViewCount="48" Body="&lt;p&gt;Craft is looking perfect for a new project I'm starting, but I can't find a good way to integrate a key part of the site. I'll be creating content pages for each individual project that I'm featuring on my website. Ideally, Vanilla would be embedded below the page content and showing the relevant discussion thread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems so simple but I'm having a tough time finding a good solution. Can anyone point me in a direction?&lt;/p&gt;&#xA;" OwnerUserId="2264" LastEditorUserId="22" LastEditDate="2017-05-10T00:09:29.510" LastActivityDate="2017-05-10T00:09:29.510" Title="Create VanillaForum topic from new piece of Craft content?" Tags="&lt;craft-features&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6969" PostTypeId="2" ParentId="6965" CreationDate="2015-02-03T22:34:30.107" Score="4" Body="&lt;p&gt;Sounds like you just need to initially setup the client account with your colleague's email/password/name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have them do their testing and when you're ready to give it to your client, either just update the email/password/name or delete the client account and re-create it for your client.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-03T22:34:30.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6970" PostTypeId="2" ParentId="2822" CreationDate="2015-02-04T00:07:46.773" Score="2" Body="&lt;p&gt;You'll need to approach this in two steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Get all the entries that DO have relationships.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filter those entries out of your ElementCriteriaModel, either by using the &quot;not&quot; syntax on the entries &lt;code&gt;id&lt;/code&gt; parameter of the &lt;code&gt;craft.entries&lt;/code&gt; variable, or by using the &lt;code&gt;without&lt;/code&gt; Twig filter in your loop source.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-04T00:07:46.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6971" PostTypeId="1" CreationDate="2015-02-04T00:50:55.557" Score="2" ViewCount="603" Body="&lt;p&gt;I'm having trouble getting the redactorStyles plugin to work. I am running Craft 2.3.2627&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Redactor Styles v. 0.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the json in the json field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; { &#xA;&quot;btnName&quot;:&quot;Drop Cap&quot;, &#xA;&quot;className&quot;:&quot;redactorDropCap&quot;, &#xA;&quot;spanClass&quot;:&quot;dropCap&quot;, &#xA;&quot;forceBlock&quot;: &quot;-1&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an external stylesheet, the field is set to: /assets/css/redactorStyles.css&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not getting any errors in the CP but I also don't get the styles nor do I see the want icon for the plugin dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the content from the redactor config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],    &#xA;plugins: ['fullscreen','video','styles'],&#xA;toolbarFixed: true,&#xA;stylesJson: RedactorStyles.stylesJson&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me if I am doing something wrong here or if there is a bigger issue? I'm new to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brian&lt;/p&gt;&#xA;" OwnerUserId="2265" LastEditorUserId="45" LastEditDate="2015-05-29T21:48:51.697" LastActivityDate="2015-05-29T21:48:51.697" Title="RedactorStyles Plugin Not Working" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6972" PostTypeId="2" ParentId="2081" CreationDate="2015-02-04T01:00:48.050" Score="2" Body="&lt;p&gt;I had the same issue. But I was using memcache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out it was acually memcached which is a slightly different extension. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enable the setting in the memcache.php config file with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'useMemcached' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="672" LastActivityDate="2015-02-04T01:00:48.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6973" PostTypeId="1" CreationDate="2015-02-04T04:23:14.937" Score="2" ViewCount="187" Body="&lt;p&gt;I have made numerous elementTypes in my plugin that all work perfectly but for some reason one elementType keeps having an error when trying to view the Model's content or custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Property &quot;Craft\Myplugin_OrderModel.locale&quot; is not defined.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything looks exactly the same as all the other models that are elementTypes in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All my plugins elementType models are using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function isLocalized()&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the issue still persists with that one Model.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-02-04T04:23:14.937" Title="Why does my custom element type error around locale being missing on the element types' model?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;baseelementmodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6974" PostTypeId="2" ParentId="6973" CreationDate="2015-02-04T04:23:14.937" Score="3" Body="&lt;p&gt;That's interesting Luke, I had the exact same issue and spent WAY too long on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though I used a diff tool to see the difference between working elementType models and the one with the error I just did not catch the silly difference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;vs the working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array_merge(parent::defineAttributes(), array(&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you need to add the parent attributes that includes attributes like locale :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I knew that all along, but just didn't catch it on multiple re-reviewing of the Model.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-02-04T04:23:14.937" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6975" PostTypeId="2" ParentId="6971" CreationDate="2015-02-04T04:47:18.100" Score="0" Body="&lt;p&gt;Redactor plugins need a little bit of extra work in Craft. They need to be added through a custom Craft plugin first. Take a look at &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips&quot; rel=&quot;nofollow&quot;&gt;this plugin&lt;/a&gt; as an example, particularly where the css and js are stored.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-04T04:47:18.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6976" PostTypeId="2" ParentId="4728" CreationDate="2015-02-04T06:57:39.957" Score="5" Body="&lt;p&gt;I've already answered this question but ran into another situation that I feel merits a separate answer instead of making my first answer more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases, we use Cloudflare Flexible SSL.  Due to the way Cloudflare does SSL, this adds support for SSL but not via a certificate on the server or via the standard SSL port so the common &lt;code&gt;$_SERVER['HTTPS']&lt;/code&gt; variable isn't available to check nor are you able to just check to see if the secure port is in use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution I came across is to check for the &lt;code&gt;$_SERVER['HTTP_X_FORWARDED_PROTO']&lt;/code&gt; variable.  This may not work in all situations, but it worked for me and can be substituted in for the URI_SCHEME check in &lt;a href=&quot;https://craftcms.stackexchange.com/a/4734/115&quot;&gt;the answer above&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']))&#xA;{&#xA;    // Support Cloudflare SSL&#xA;    define('URI_SCHEME', $_SERVER['HTTP_X_FORWARDED_PROTO'].'://');&#xA;}&#xA;else&#xA;{   &#xA;    // Standard SSL support&#xA;    define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone would like to edit and add any other Cloudflare specific fixes, feel free.  I surely don't have the domain knowledge in this area to claim this is a final answer, just one that helped me out in getting assets serving over SSL on a Cloudflare-enabled site.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-04T06:57:39.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6977" PostTypeId="1" CreationDate="2015-02-04T09:41:00.587" Score="1" ViewCount="135" Body="&lt;p&gt;Given an array of field IDs, I want to get all content for those fields.&#xA;So, in this situation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&#xA;&lt;ul&gt;&#xA;&lt;li&gt;field ID 1: 'test'&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;entry 2&#xA;&lt;ul&gt;&#xA;&lt;li&gt;field ID 1: 'test test'&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to end up with &lt;code&gt;array('test', 'test test')&lt;/code&gt;.&#xA;I now iterate through all content from the content table to check the field's handle against the handle of the field I'm looking for, but there must be a better way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/nilsenpaul/nptypeahead/blob/master/nptypeahead/services/NpTypeAhead_DataService.php&quot; rel=&quot;nofollow&quot;&gt;this service&lt;/a&gt; to see what code I use now.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-02-04T14:50:56.460" LastActivityDate="2015-02-04T14:50:56.460" Title="What's the best way to get all content for a field?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6979" PostTypeId="1" AcceptedAnswerId="6980" CreationDate="2015-02-04T13:24:59.963" Score="3" ViewCount="838" Body="&lt;p&gt;This may be a silly question or a pipe dream, but i was wondering if there is a way to have a live preview for entries without a URL. For instance i have a complicated layered slider on the homepage of a site I am building and due to it's complexity it can not simply be a field or series of fields on the homepage entry, thus i've simply created a channel called 'slides' and I include that in my homepage template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be really great if there was someway to allow live-preview to show the slides while editing, or allow editing of them while in live-preview of the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this capability exist or am I out of luck?&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-02-06T15:39:48.920" Title="Live Preview Items Without Entry URL" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6980" PostTypeId="2" ParentId="6979" CreationDate="2015-02-04T14:48:17.580" Score="2" Body="&lt;p&gt;It is (currently) not possible to set an Entry Template without selecting &lt;em&gt;&quot;Entries in this section have their own URLs&quot;&lt;/em&gt; in the settings.&#xA;So to make Live Preview available on your &quot;slides&quot; entries, you have to register the URLs.&#xA;But if you use hidden / pseudo URLs (i.e. &lt;code&gt;hideme/{slug}&lt;/code&gt;) that you don't link to and nobody knows of, this shouldn't be that bad of a workaround:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can check if the page is shown with Live Preview using &lt;code&gt;craft.request.isLivePreview&lt;/code&gt;.&#xA;Use this to redirect normal page views (search engines / accidential URL discoveries) to 404&#xA;and show your slider for Live Preview requests.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the Entry Template to the same file you use for your homepage or a new template file where you include the slider partial.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Conditionally show slider or redirect to 404 #}&#xA;{% if craft.request.isLivePreview %}&#xA;    {% include '_includes/slider' %}&#xA;{% else %}&#xA;    {% redirect 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Live Preview doesn't only work for the Entry variable any more (→ &lt;a href=&quot;http://buildwithcraft.com/updates#build2616&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2616 release notes&lt;/a&gt;). So you can make Live Preview to&#xA;update on changes detected on any entries referenced from the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Unsaved entries are not yet included in such &lt;code&gt;craft.entries&lt;/code&gt; calls (→ &lt;a href=&quot;https://plus.google.com/101325980081569498457/posts/HNDFsLUMNw9&quot; rel=&quot;nofollow&quot;&gt;Brandon's comment&lt;/a&gt; to my question on g+). As a workaround you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_includes/slider.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Show unsaved &quot;slider&quot; entry #}&#xA;{% if not entry.id %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Go through &quot;slider&quot; entries #}&#xA;{% for slide in craft.entries.section('slides') %}&#xA;    {{ slide.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;A dedicated field to set the template (or even multiple of them) used for Live Preview would make a nice feature request though!&lt;/s&gt; &lt;em&gt;→ &lt;a href=&quot;https://plus.google.com/101325980081569498457/posts/7jmcW93Di16&quot; rel=&quot;nofollow&quot;&gt;done&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-06T15:39:48.920" LastActivityDate="2015-02-06T15:39:48.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6981" PostTypeId="1" AcceptedAnswerId="6982" CreationDate="2015-02-04T15:24:40.843" Score="2" ViewCount="1515" Body="&lt;p&gt;I can grab a top/bottom level ancestor with something like entry.ancestors.first/last.title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, say I'm at level 6, is it possible to grab an ancestor at a particular level, like entry.ancestors.level(3).title? Or would you have to grab all the ancestors and loop through them to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New to deep structures and just want to confirm I'm not missing something that would allow me to sidestep a loop. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2015-02-04T18:11:17.957" Title="Get ancestor at a specific level?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6982" PostTypeId="2" ParentId="6981" CreationDate="2015-02-04T15:42:48.960" Score="3" Body="&lt;p&gt;&lt;code&gt;entry.ancestors&lt;/code&gt; returns an ElementCriteriaModel (→ &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getAncestors&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getAncestors()&lt;/code&gt;&lt;/a&gt; in the Craft docs) prepped to return the entry's ancestors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.ancestors.level(3)&lt;/code&gt; makes it return only entry ancestors which are at 3rd level of the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you well pointed out in the comments, an entry can only have one ancestor on a particular structure level. So you can now use the &lt;code&gt;first()&lt;/code&gt; method to get this one entry. Keep in mind that if there's no ancestor at that level, the method won't return anything (&lt;code&gt;null&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ancestorL3 = entry.ancestors.level(3).first() %}&#xA;&#xA;{% if ancestorL3 %}&#xA;    {{ ancestorL3.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-04T18:11:17.957" LastActivityDate="2015-02-04T18:11:17.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6983" PostTypeId="1" AcceptedAnswerId="8225" CreationDate="2015-02-04T16:58:12.500" Score="3" ViewCount="795" Body="&lt;p&gt;I am looking to build a radius search from my field type’s modifyElementsQuery() method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am storing lat/lng values in a separate table, and am trying to integrate the location search based on the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developers.google.com/maps/articles/phpsqlsearch_v3?csw=1#findnearsql&quot; rel=&quot;nofollow&quot;&gt;https://developers.google.com/maps/articles/phpsqlsearch_v3?csw=1#findnearsql&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s my current code. It throws an error saying &quot;unknown column 'distance' in having clause&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, $value)&#xA;{&#xA;&#xA;    if($value !== null)&#xA;    {&#xA;        $settings = $this-&amp;gt;getSettings();&#xA;        $this-&amp;gt;plugin-&amp;gt;pluginLog($value);&#xA;&#xA;        $unitAdjustment = $settings-&amp;gt;unit == 'mi' ? 3959 : 6371;&#xA;        $lat = 37;&#xA;        $lng = -122;&#xA;        $radius = $value;&#xA;&#xA;        $query-&amp;gt;addSelect('( '.$unitAdjustment.' * acos( cos( radians( '.$lat.' ) ) * cos( radians( fruit_geo.lat ) ) * cos( radians( fruit_geo.lng ) - radians( '.$lng.' ) ) + sin( radians( '.$lat.' ) ) * sin( radians( fruit_geo.lat ) ) ) ) as distance');&#xA;        $query-&amp;gt;join('fruit_geo fruit_geo', 'fruit_geo.elementId = content.elementId');&#xA;        $query-&amp;gt;having('distance &amp;lt; '.$radius);&#xA;&#xA;&#xA;        // Here's the SQL statement that will find the closest 20 locations that are within a radius of 25 miles to the 37, -122 coordinate. &#xA;        // It calculates the distance based on the latitude/longitude of that row and the target latitude/longitude, &#xA;        // and then asks for only rows where the distance value is less than 25, orders the whole query by distance, &#xA;        // and limits it to 20 results. To search by kilometers instead of miles, replace 3959 with 6371&#xA;&#xA;        //SELECT id, ( $unitAdjustment * acos( cos( radians( $lat ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( $lng ) ) + sin( radians( $lat ) ) * sin( radians( lat ) ) ) ) AS distance FROM table HAVING distance &amp;lt; $radius&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'distance' in 'having clause'. The SQL statement executed was: SELECT `elements`.`id`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_fruit_geo` `fruit_geo` ON fruit_geo.elementId = content.elementId&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE (((((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2015-02-06 11:57:46') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2015-02-06 11:57:46')))) AND (elements_i18n.enabled = 1)) AND (content.field_date&amp;gt;=:contentfield_date1)) AND (sections.handle=:sectionshandle1)) AND (`elements`.`id` IN ('5747', '5823', '8529', '8865', '8913', '8972', '8973', '8978', '8979', '10228', '10370', '10912', '11780', '13366', '14673', '14675', '14759', '14764', '14770', '20516', '20682', '20683', '21042', '21043', '21143', '22247', '22570', '22814', '22817', '22827', '22830', '22834', '22835', '22836', '22844', '22855', '22859', '22860', '22867', '22899', '22909', '22916', '22945', '22970'))&#xA;GROUP BY `elements`.`id`&#xA;HAVING distance &amp;lt; 50&#xA;ORDER BY `field_date` ASC. Bound with :locale='en_gb', :contentfield_date1='2015-02-06 00:00:00', :sectionshandle1='events' (/var/www/vhosts/findarace.com/beta.findarace.com/craft/app/framework/db/CDbCommand.php:543)&amp;lt;/p&amp;gt;&amp;lt;pre&amp;gt;#0 /var/www/vhosts/findarace.com/beta.findarace.com/craft/app/framework/db/CDbCommand.php(396): CDbCommand-&amp;gt;queryInternal('fetchAll', Array, Array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastEditorUserId="158" LastEditDate="2015-02-06T11:58:58.587" LastActivityDate="2015-02-18T12:13:37.003" Title="Using modifyElementsQuery() to build a Radius Search?" Tags="&lt;plugin-development&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6984" PostTypeId="2" ParentId="6983" CreationDate="2015-02-04T18:10:48.380" Score="2" Body="&lt;p&gt;Here is a plugin that I'm using to geocode entries, and search based on closest within a range of (lat, lang) coordinates. In this case. it's storing the lat/lang fields on the entry itself, but you should be able to adapt it for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the services file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;static private $url = &quot;http://maps.google.com/maps/api/geocode/json?sensor=false&amp;amp;address=&quot;;&#xA;&#xA;public function findClosest($address, $range, $section, $limit = 12) {&#xA;&#xA;    $loc        = self::getLocation($address);&#xA;    $lat        = $loc['lat'];&#xA;    $lng        = $loc['lng'];&#xA;    $section    = $section;&#xA;    $range      = $range;&#xA;    $limit      = $limit;&#xA;&#xA;    // define query&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;    $query-&amp;gt;select(array('elements.id AS id', '( 3959 * acos( cos( radians(' . $lat . ') ) * cos( radians( field_lat ) ) * cos( radians( field_lng ) - radians(' . $lng . ') ) + sin( radians(' . $lat . ') ) * sin(radians( field_lat )) ) ) AS distance'));&#xA;    $query-&amp;gt;andWhere('sections.handle = \''. $section.'\'');&#xA;    $query-&amp;gt;having('distance &amp;lt; ' . $range);&#xA;    $query-&amp;gt;order('distance');&#xA;    $query-&amp;gt;limit($limit);&#xA;&#xA;    $results = $query-&amp;gt;queryAll();&#xA;&#xA;    $locations = '';&#xA;    foreach ($results as $result)&#xA;    {&#xA;        $locations[] = array(&#xA;            'id'        =&amp;gt; $result['id'],&#xA;            'distance'  =&amp;gt; $result['distance'],&#xA;            'entry'     =&amp;gt; craft()-&amp;gt;entries-&amp;gt;getEntryById($result['id'])&#xA;        );&#xA;    }&#xA;    return $locations;&#xA;}&#xA;&#xA;public function geocodeEntry($entry)&#xA;{   &#xA;    $address = $entry-&amp;gt;address.','.$entry-&amp;gt;city.','.$entry-&amp;gt;state.','.$entry-&amp;gt;zip.','.$entry-&amp;gt;country;&#xA;&#xA;    $loc = self::getLocation($address);&#xA;    if ($loc)&#xA;    {&#xA;        $entry-&amp;gt;getContent()-&amp;gt;lat   = $loc['lat'];&#xA;        $entry-&amp;gt;getContent()-&amp;gt;lng   = $loc['lng'];&#xA;    }&#xA;}&#xA;&#xA;static public function getLocation($address)&#xA;{&#xA;    $url = self::$url.urlencode($address);&#xA;    $resp_json = self::curl_file_get_contents($url);&#xA;    $resp = json_decode($resp_json, true);&#xA;&#xA;    if ($resp['status'] == 'OK')&#xA;    {&#xA;        return $resp['results'][0]['geometry']['location'];&#xA;    }&#xA;    else&#xA;    {&#xA;        return false;&#xA;    }&#xA;}&#xA;&#xA;static private function curl_file_get_contents($url)&#xA;{&#xA;    $c = curl_init();&#xA;    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);&#xA;    curl_setopt($c, CURLOPT_URL, $url);&#xA;    $contents = curl_exec($c);&#xA;    curl_close($c);&#xA;&#xA;    if ($contents) &#xA;    {&#xA;        return $contents;&#xA;    }&#xA;    else&#xA;    { &#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the variables file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function closest($address)&#xA;{&#xA;    return craft()-&amp;gt;logic-&amp;gt;findClosest($address, 50, 'SectionName', 9);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The init function within the plugin's main file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.beforeSaveEntry', function(Event $event) &#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        if ($entry-&amp;gt;section-&amp;gt;handle == 'suppliers' || $entry-&amp;gt;section-&amp;gt;handle == 'retailers') &#xA;        {&#xA;            craft()-&amp;gt;myPlugin-&amp;gt;geocodeEntry($entry);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-06T10:46:34.827" LastActivityDate="2015-02-06T10:46:34.827" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6985" PostTypeId="1" CreationDate="2015-02-04T18:29:33.457" Score="3" ViewCount="2573" Body="&lt;p&gt;I'm trying to use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in categories %}&#xA;&#xA;   {{ category.title }}&#xA;&#xA;   {% children %}&#xA;&#xA;   {% if not loop.last %} BLAH {% endif %}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that the &lt;code&gt;{% if not loop.last %}&lt;/code&gt; conditional doesn't work inside of a &lt;code&gt;{% nav %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I target/style the first and last items in each level of a nav structure?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-05T02:35:47.500" Title="How to target first or last item in a nav children loop" Tags="&lt;navigation&gt;&lt;templating&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6986" PostTypeId="2" ParentId="6985" CreationDate="2015-02-04T19:02:59.763" Score="5" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; Sorry, I originally thought you were building nav and just showing simplified code. If you just want to list the categories then this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in categories %}&#xA;    {{- category.title -}}&#xA;    {% if not loop.last %}, {% endif %}&#xA;    {% children %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your trying to build a nav system, then this should work. In either case just place your 'loop' &lt;em&gt;before&lt;/em&gt; the children tag. See &lt;a href=&quot;https://craftcms.stackexchange.com/a/6966/784&quot;&gt;this answer&lt;/a&gt; for another example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav category in categories %}&#xA;&#xA;        {% if loop.first %}&#xA;            &amp;lt;li class=&quot;first&quot;&amp;gt;&#xA;        {% elseif loop.last %}&#xA;            &amp;lt;li class=&quot;last&quot;&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;li&amp;gt;&#xA;        {% endif %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-05T02:35:47.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6987" PostTypeId="1" AcceptedAnswerId="6989" CreationDate="2015-02-04T20:32:41.497" Score="1" ViewCount="458" Body="&lt;p&gt;I have a template variable thus&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function twitterAccounts()&#xA;{&#xA;  return craft()-&amp;gt;myPlugin-&amp;gt;getAllAccounts();&#xA;  //Craft::dd(craft()-&amp;gt;myPlugin-&amp;gt;getAllAccounts());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it calls the following service method&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllAccounts()&#xA;{&#xA;  return MyPlugin_TwitterAccountRecord::model()-&amp;gt;findAll(array('order'=&amp;gt;'oauth_token'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the record is set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_TwitterAccountRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'myPlugin_twitter_accounts';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'screen_name' =&amp;gt; AttributeType::String,&#xA;            'id_str'      =&amp;gt; AttributeType::String,&#xA;            'password'    =&amp;gt; AttributeType::String,&#xA;            'oauth_token' =&amp;gt; AttributeType::String, // this is a reference to the oauth_tokens table ID, not the actual token.&#xA;            'last_tweet'  =&amp;gt; AttributeType::DateTime,&#xA;            'is_company'  =&amp;gt; AttributeType::Bool,&#xA;&#xA;            //array(AttributeType::Enum, 'values' =&amp;gt; &quot;alcohol,mixer,other&quot;),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have three records in that table 2 have values for the oauth_token field and one is NULL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before the NULL value row the following worked fine in a template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set twitterAccounts = craft.myPlugin.twitterAccounts %}&#xA;{% for thisAccount in twitterAccounts %}&#xA;  {% if thisAccount.oauth_token is defined and thisAccount.oauth_token is not null %}&#xA;    {{ thisAccount.screen_name }} is oauthed&#xA;  {% else %}&#xA;    {{ thisAccount.screen_name }} is not oauthed&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but now I'm getting (devmode)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\MyPlugin_TwitterAccountRecord and its behaviors do not have a method or closure named &quot;oauth_token&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The annoying thing is when I comment out the return in the template variable method and use the Craft::dd() I see all three rows with their proper attributes, including the null value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the conditional to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if false and thisAccount.oauth_token is defined and thisAccount.oauth_token is not null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...in order to always be false and skip into the else, it lists all three accounts in there!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction here please? Is there a bug in templating with a NULL value in an activerecord collection? (this happens whether or not I have that orderBy oauth_token in the findAll())&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2015-02-05T02:21:03.083" Title="Template variables from active record on NULL value" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;null&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6988" PostTypeId="2" ParentId="6985" CreationDate="2015-02-04T21:32:02.557" Score="1" Body="&lt;p&gt;I ended up solving this with a recursive &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig macro&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro catObj(category) %}&#xA;    ... blah ...&#xA;    {% if category.children | length %}&#xA;        {% for child in category.children %}&#xA;            {{ _self.catObj( child ) }}&#xA;            {% if not loop.last %},{% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% for category in categories %}&#xA;    {{ _self.catObj( category ) }}&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I appreciate Douglas and others pointing out that the &lt;code&gt;loop&lt;/code&gt; variable is available in the &lt;code&gt;{% nav %}&lt;/code&gt; tag &lt;em&gt;before the &lt;code&gt;{% children %}&lt;/code&gt; tag&lt;/em&gt;, but in this case it seemed like less work to use a macro than to jump through code-rearranging/variable-hoisting hoops.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-04T21:32:02.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6989" PostTypeId="2" ParentId="6987" CreationDate="2015-02-05T02:21:03.083" Score="4" Body="&lt;p&gt;You don't want to expose a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;Record&lt;/a&gt; to the template level for many reasons, including inadvertently letting a template call &lt;code&gt;record.save()&lt;/code&gt; causing unexpected updates to the database, but you also don't want to expose any unnecessary data to the template (like &quot;password&quot;, in your example).  A bit more info on that &lt;a href=&quot;https://craftcms.stackexchange.com/a/2973/57&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow noreferrer&quot;&gt;Models&lt;/a&gt; come in. They don't have the database overhead and you can limit what gets exposed to the template as well as combine data from multiple records into one model for easy consumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a &lt;code&gt;MyPlugin_TwitterAccountModel&lt;/code&gt; class like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_TwitterAccountModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'oauth_token' =&amp;gt; AttributeType::String,&#xA;            'screenname'  =&amp;gt; AttributeType::String,&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(include any other attributes your template might access)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then change your &lt;code&gt;getAllAccounts()&lt;/code&gt; method in your service to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllAccounts()&#xA;{&#xA;    $records = MyPlugin_TwitterAccountRecord::model()-&amp;gt;findAll(array('order'=&amp;gt;'oauth_token'));&#xA;    return MyPlugin_TwitterAccountModel::populateModels($records);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now your template will only have access to your plugin's model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having typed all of that, I literally have no idea if it will solve your original issue.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be some odd bug with Twig's interactions with Records that you're the first to run into since we highly discourage exposing Records to templates.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-05T02:21:03.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6990" PostTypeId="2" ParentId="6971" CreationDate="2015-02-05T12:45:21.193" Score="1" Body="&lt;p&gt;Craft 2.3 upgraded Redactor to version 10, which comes with a completely new API for plugins. This broke RedactorStyles which relied on the old API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated the plugin now, so downloading version 0.3 should make it work with Craft 2.3. Beware that the plugin isn't 100% backwards compatible, due to changes in Redactor and its API, so read the docs.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-02-05T12:45:21.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6991" PostTypeId="1" CreationDate="2015-02-05T13:41:57.227" Score="3" ViewCount="469" Body="&lt;p&gt;When an entry is created and saved in a locale the corresponding entry is created for other locales using the original title. However, when the title of the locale which needs translating is edited the slug isn't auto generated from the new localised title and remains in the original language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the slug can be manually edited but unfortunately the likelihood is that users won't bother, or forget, meaning that the urls for entries won't be localised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be ideal is that on the first edit of the localised version that the slug is auto generated from the title as it is for the initial entry. Is this possible either via a plugin or could it be considered in a future version?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2015-02-06T11:12:49.183" Title="Auto generation of localised slug" Tags="&lt;localization&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6992" PostTypeId="1" AcceptedAnswerId="7002" CreationDate="2015-02-05T14:41:09.057" Score="5" ViewCount="2570" Body="&lt;p&gt;In addition to ‘&lt;a href=&quot;https://craftcms.stackexchange.com/questions/299/what-is-the-current-landscape-regarding-e-commerce-plugins-for-craft&quot;&gt;What is the current landscape regarding e-commerce plugins for Craft?&lt;/a&gt;’, I’m looking for current options for setting up membership subscriptions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a site in development that was using the ‘Commerce’ and ‘Membership’ plugins from Dukt (private beta) but unfortunately they no longer appear to be available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic requirements would be for a user to signup, pay for membership (ideally through Stripe in this case), which then automatically assigns users to different membership groups depending on their subscription level/status when appropriate (e.g. full, trial, expired, etc).&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-07T13:54:35.443" Title="What are the options for taking membership subscriptions via Craft?" Tags="&lt;users&gt;&lt;user-groups&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6993" PostTypeId="1" AcceptedAnswerId="6994" CreationDate="2015-02-05T15:40:45.893" Score="2" ViewCount="270" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I want my client to have the ability to do things like bold, italicize, and hyperlink text, but I would rather them not be able to use some of the other rich text field abilities.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I see from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2277/how-can-i-add-headings-using-the-rich-text-field&quot;&gt;this question&lt;/a&gt; that it may be possible using a 'redactor' plugin? Where is the best place to find information on this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible for some Rich Text Fields to have more styling capabilities than others?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-05T15:57:42.123" Title="Can I limit the available styles from the rich text field?" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6994" PostTypeId="2" ParentId="6993" CreationDate="2015-02-05T15:57:42.123" Score="3" Body="&lt;p&gt;Redactor is the name of the Rich Text field itself, as this is a 3rd party component Craft has taken great use of!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Craft you are able to create custom Redactor configurations whereby you have control over which options you would like useable (bold, italic etc), and these can be set on a per-field basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the Craft site for details on how to set your own custom Redactor configurations: &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you edit a Rich Text field in Craft you will see a 'Config' dropdown. These are the files you have created in &lt;code&gt;craft/config/redactor&lt;/code&gt; (see above link for details)&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-02-05T15:57:42.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6995" PostTypeId="1" AcceptedAnswerId="6996" CreationDate="2015-02-05T16:08:47.033" Score="3" ViewCount="1112" Body="&lt;p&gt;There are several questions like this already but none seem to cover my use case. I have a structure that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Landing Page 1&#xA;- Case Studies&#xA;-- Case Study 1&#xA;-- Case Study 2&#xA;-- Case Study 3&#xA;- Sub page&#xA;- Sub page&#xA;Landing Page 2&#xA;- Case Studies&#xA;-- Case Study 1&#xA;-- Case Study 2&#xA;-- Case Study 3&#xA;- Sub page&#xA;- Sub page&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I'm in any child of the 'Landing Pages' I want to create a nav (as per &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow&quot;&gt;the docs&lt;/a&gt;) but I cant' seem to get all of the pages I need. I can easily get the top level 'landing page': &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.getAncestors().level(1).first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can then get the descendants separately:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.getAncestors().level(1).first().getDescendants()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want a single ElementCriteriaModel with everything from the 'landing page' down in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-02-05T16:39:05.857" Title="Building a nav from the top level page of a structure" Tags="&lt;entries&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6996" PostTypeId="2" ParentId="6995" CreationDate="2015-02-05T16:19:05.427" Score="4" Body="&lt;p&gt;Untested, but you should be able to do this by using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge filter in Twig&lt;/a&gt; to join the two results together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get the top level 'landing page' for this section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set landingPage = entry.getAncestors().level(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get the descendants for this section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set childPages = entry.getAncestors().level(1).getDescendants() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Merge the two results together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionPages = [ landingPage ]|merge(childPages) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now create the navigation for the section using the sectionPages variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav page in sectionPages %}&#xA;            &amp;lt;li&amp;gt;&#xA;                {{ page.getLink() }}&#xA;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="125" LastEditDate="2015-02-05T16:39:05.857" LastActivityDate="2015-02-05T16:39:05.857" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6997" PostTypeId="2" ParentId="6995" CreationDate="2015-02-05T16:32:05.117" Score="4" Body="&lt;p&gt;Basically the same as &lt;a href=&quot;https://craftcms.stackexchange.com/a/6996/125&quot;&gt;Steve suggested&lt;/a&gt;, but I first merged the entries' IDs and then use them as a criteria in another &lt;code&gt;craft.entries&lt;/code&gt; call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set landing = entry.getAncestors().level(1).first() %}&#xA;&#xA;{% set landingId = landing.id %}&#xA;{% set ancestorIds = landing.getDescendants().ids() %}&#xA;{% set entryIds = [ landingId ]|merge( ancestorIds ) %}&#xA;&#xA;{% set entries = craft.entries.id(entryIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-05T16:32:05.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6998" PostTypeId="1" AcceptedAnswerId="6999" CreationDate="2015-02-05T16:48:40.677" Score="2" ViewCount="231" Body="&lt;p&gt;Is there a way to get &quot;vanity URLs&quot; for my assets? Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.example.com/download/asset.pdf&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rather than:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.example.com/several/subfolders/for/organisation/purposes/asset.pdf&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that dumping all assets into a /download folder will work but this is far from an ideal solution. Is there another way?&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2015-02-05T17:00:37.740" Title="Nice-looking URLs for assets" Tags="&lt;assets&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6999" PostTypeId="2" ParentId="6998" CreationDate="2015-02-05T17:00:37.740" Score="5" Body="&lt;p&gt;Perhaps using redirects and Regex in your .htaccess? There's a Craft plugin that would help with this.&#xA;&lt;a href=&quot;https://github.com/rkingon/Craft-Plugin--Redirect-Manager/&quot;&gt;https://github.com/rkingon/Craft-Plugin--Redirect-Manager/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RedirectMatch 301 /download/(.*) /several/subfolders/for/organisation/purposes/$1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would need to refine this for matching several different subfolders.&lt;/p&gt;&#xA;" OwnerUserId="2243" LastActivityDate="2015-02-05T17:00:37.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7001" PostTypeId="2" ParentId="6991" CreationDate="2015-02-05T18:19:45.450" Score="3" Body="&lt;p&gt;Yes, it's possible with a plugin.&#xA;Make it listen to &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; events and look up how often the entry was already saved by counting entry versions using the &lt;code&gt;getVersionsByEntryId&lt;/code&gt; method.&#xA;If it is the entry's second save (one version exists) overwrite the slug with an empty string (will generate a new slug from the title).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should add another conditional to only make it generate a new slug for all locales but the one you first saved in (not exactly sure how to get this), but this should get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entry-&amp;gt;id)&#xA;        {&#xA;            $versionsCount = count(craft()-&amp;gt;entryRevisions-&amp;gt;getVersionsByEntryId($entry-&amp;gt;id, $entry-&amp;gt;locale));&#xA;        }&#xA;&#xA;        // $localeFirstSave = ??&#xA;        // if ($entry-&amp;gt;locale != $localeFirstSave)&#xA;&#xA;        if (isset($versionsCount) &amp;amp;&amp;amp; $versionsCount == 1)&#xA;        {&#xA;            $entry-&amp;gt;slug = '';&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;another variant you could try is to always load the JS that generates the slug on the fly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs('window.slugGenerator = new Craft.SlugGenerator(&quot;#title&quot;, &quot;#slug&quot;);');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-06T11:12:49.183" LastActivityDate="2015-02-06T11:12:49.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7002" PostTypeId="2" ParentId="6992" CreationDate="2015-02-05T18:50:34.847" Score="12" Body="&lt;p&gt;I don't think that there currently is a plugin option right now, but keep an eye on the &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft plugin page&lt;/a&gt;. However, given your requirement to &quot;automatically assign users to different membership groups&quot;, I think you would need to write your own regardless. That is pretty specific and would require that you have your user groups set up to match the subscription plans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently did something similar for a project. Saving for a few issues with javascript and learning the API for stripe it was fairly straightforward. It is currently a bit hard-wired to the specific project, however — I still need to abstract it so that it's more portable. I would be glad to share some tips, if you are up for writing your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZoR9P.png&quot; alt=&quot;stripe subscription plugin - custom field type&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process that I'm using is to store the StripeCustomerId in the custom fieldtype. As far as craft is concerned that's all just 1 field, that is auto-generated and never exposed to the client (i.e. they can't edit the 'stripeCustomerId').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever an 'account' (could also be 'user') is created, I use the &lt;code&gt;onSaveUser&lt;/code&gt; event to generate and store a StipeCustomerId. The rest of the field just sends calls to stripe to add card, delete card, create subscription, cancel subscription, etc. via service methods, and then refresh itself with the most up-to-date customer data from Stripe (doesn't ever store this info, just the customerId).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides this the only thing that you would need to add is to reassign the userGroup based on the plan selection. However, if you want to ensure that the userGroup is always synced with the Stripe account (i.e. if the client, for example, canceled the subscription directly from their Stripe account), you would probably need to create a &lt;a href=&quot;https://stripe.com/docs/webhooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;webhook&lt;/a&gt; to trigger the userGroup re-assignment. Or instruct them to always re-save the user in craft afterwards.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-05T18:50:34.847" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7003" PostTypeId="1" AcceptedAnswerId="7004" CreationDate="2015-02-05T19:00:09.863" Score="1" ViewCount="3110" Body="&lt;p&gt;I have set up a guest entries form that receives data from the textarea snippet below and saves it into a rich text field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;fields[comment]&quot; placeholder=&quot;Join the discussion...&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I view the entry on the front-end there is no formatting, but on the backend there is formatting. Then when I save the entry on the back-end, suddenly there is formatting on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to bypass having to re-save the entry to get the desired formatting?&lt;/p&gt;&#xA;" OwnerUserId="446" LastEditorUserId="446" LastEditDate="2015-02-05T19:32:40.693" LastActivityDate="2015-02-05T20:02:33.497" Title="How do I maintain paragraph formatting on textarea Guest Entries submission?" Tags="&lt;richtext&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7004" PostTypeId="2" ParentId="7003" CreationDate="2015-02-05T19:49:11.473" Score="2" Body="&lt;p&gt;RichText fields make use of the Redactor plugin library, which if I understand correctly, essentially parses line-breaks and wraps lines in properly formatted html &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags via javascript. However, when you save from the front-end, it doesn't have a chance yet to parse the data. Only when you view the data on the back-end and re-save does redactor get a chance to do it's thing.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You could use redactor on the front-end, although this is not recommended for various reasons &lt;a href=&quot;https://craftcms.stackexchange.com/a/4238/784&quot;&gt;as described here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or you could change the fieldtype to a regular textField and wrap everything in a &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; tag in your template. &lt;code&gt;&amp;lt;pre&amp;gt;{{ entry.myTextField }}&amp;lt;/pre&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or you could parse the string yourself via javascript before submitting it, wrapping your own &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags (hopefully it won't get double encoded).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There might be other options as well.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-05T20:02:33.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7005" PostTypeId="1" AcceptedAnswerId="7008" CreationDate="2015-02-05T22:02:01.140" Score="3" ViewCount="571" Body="&lt;p&gt;In a plugin I am creating I want to add a property to some entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally this property would be hidden from the admin user, as I don't want them to edit it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I am trying to do something like this (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'dogs';&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;foreach ($entries as $entry) {&#xA;    $entry-&amp;gt;secretName = urlencode($entry-&amp;gt;title);&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;endforeach;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this produces the error 'Property &quot;Craft\EntryModel.secretName&quot; is not defined.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to do what I am trying to do? Is there a way to set a new property to just this section?&lt;/p&gt;&#xA;" OwnerUserId="508" LastActivityDate="2015-02-05T23:01:37.140" Title="Is there a way to set a new property on an entry" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7008" PostTypeId="2" ParentId="7005" CreationDate="2015-02-05T22:47:09.560" Score="5" Body="&lt;p&gt;You need to create the field in the CMS, however you don't need to assign it to any section. It should still be available to your plugin and twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other reason your code will result in an error is because &lt;code&gt;$entry-&amp;gt;secretName&lt;/code&gt; is in fact being processed by the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#__get-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;BaseElementModel magic getter method&lt;/a&gt;, so is the same as writing &lt;code&gt;$entry-&amp;gt;getFieldValue('secretName')&lt;/code&gt;, which obviously cannot be set to a new value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proper way to do this is using the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContent-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContent method&lt;/a&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'dogs';&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;foreach ($entries as $entry) {&#xA;    $entry-&amp;gt;setContent(array(&#xA;        'secretName' =&amp;gt; urlencode($entry-&amp;gt;title)&#xA;    ));&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;endforeach;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/a/4487/180&quot;&gt;this answer&lt;/a&gt; for a more thorough explanation on setting entry content.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-05T22:54:33.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7009" PostTypeId="1" AcceptedAnswerId="7010" CreationDate="2015-02-06T00:46:57.850" Score="2" ViewCount="355" Body="&lt;p&gt;I'm creating an events system &amp;amp; I want to include the venue in the url of the event along with the event name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now the venue name is just stored using a plain text field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way in craft to convert a string &amp;amp; slugify it? Could I use any filter I add to Craft? Can I do it without a plugin of some sort?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ (eventVenue ? &quot;-&quot; ~ eventVenue | lower | replace(' ', '-') | replace('/[^\w]/','')) }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;along with using Twig PCRE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ (eventVenue ? &quot;-&quot; ~ eventVenue | lower | preg_replace('/[^A-Za-z0-9-]+/') ) }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both of which give the error &lt;code&gt;Expecting name or number&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-02-06T00:58:25.610" Title="How do I use Plain Text Field in URL Format?" Tags="&lt;templating&gt;&lt;url&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7010" PostTypeId="2" ParentId="7009" CreationDate="2015-02-06T00:58:25.610" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://straightupcraft.com/craft-plugins/slugify&quot; rel=&quot;nofollow&quot;&gt;Slugify&lt;/a&gt; plugin has a Twig filter that should do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-06T00:58:25.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7012" PostTypeId="2" ParentId="6983" CreationDate="2015-02-06T08:30:59.330" Score="2" Body="&lt;p&gt;If I recall correctly (I battled this about a year ago)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are calling &quot;the query&quot; is actually a &lt;strong&gt;sub&lt;/strong&gt;-query. Craft is compiling a much larger query to get all the data it needs in a single shot. The problem is, as far as the parent query is concerned, &lt;code&gt;distance&lt;/code&gt; is not a real column. Your &lt;code&gt;distance&lt;/code&gt; specifications are confined to the child query, and never make it out to the larger query where it needs to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, my workaround was to convert the haversine formula into PHP, and process it on that side. It wasn't the prettiest solution, but it's been working well for about a year now.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-02-06T08:30:59.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7013" PostTypeId="1" AcceptedAnswerId="7022" CreationDate="2015-02-06T09:09:34.787" Score="0" ViewCount="1151" Body="&lt;p&gt;After moving a Craft website from Apache server to Nginx, the admin css\js assets url-s stopped resolving.&#xA;For example, on /admin/login page Craft CMS tries connecting to the /admin/resources/lib/jquery.min.js - even though that directory structure doesn't exist, it still connects fine on Apache server, but results in a 404 page on nginx.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these routes generated? What need to be added to vhosts file in order for it to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Craft is used to generate only the part of the website - e.g. www.example.com/craftpages is my Craft homepage.&lt;/p&gt;&#xA;" OwnerUserId="2271" LastEditorUserId="344" LastEditDate="2015-05-01T10:37:06.293" LastActivityDate="2015-05-01T10:37:06.293" Title="How to fix admin assets url-s on nginx?" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7014" PostTypeId="1" AcceptedAnswerId="7061" CreationDate="2015-02-06T10:41:23.910" Score="0" ViewCount="135" Body="&lt;p&gt;Is it possible to add an element to the existing assets list and make it sortable &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i need it because i have made some modifications that allow to group 2 assets together so generally i now have a list of normal assets added to entries and grouped ones that are wrapped in a div with class pair&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i can sort the assets within pairs and assets outside any of the pairs but not the pairs themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MP2kA.png&quot; alt=&quot;an example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the screenshot you can see that there are two pairs with the purple background. Would it be possible to somehow add them to the sorting flow so i could drag them around as well?&lt;/p&gt;&#xA;" OwnerUserId="814" LastActivityDate="2015-02-09T08:06:53.463" Title="cp panel entry assets element sorting" Tags="&lt;entries&gt;&lt;assets&gt;&lt;control-panel&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7016" PostTypeId="1" CreationDate="2015-02-06T12:39:39.933" Score="1" ViewCount="289" Body="&lt;p&gt;After a finally returning to an extensive recode of my first commercial Craft based site, I have successfully implemented several new (to me) features from the latest builds. One thing I am making extensive use of is entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it easy to update my layouts, I have a section called &quot;Widgets&quot;. Each widget entry simply points to a template file via an assets select. Presently I have three kinds of widgets: a side bar widget (Which is more compact as the name would suggest), a primary (much larger widget), and a full page widget. To keep things organized, I am sorting this based on three entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each page of my site (ex: site.com/blog) is part of a structure, which inside the structure is a Matrix field. This allows me to insert inline text, images, and the previously mentioned widgets via a related entry, though there is one major problem... I cannot seem to limit the Widget block in the Matrix field based on entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My workaround I suppose would be to have 3 separate sections: one for each type of Widget, but that solution is far from elegant. SO, any ideas, guys? Here's to hoping that this would be a fairly minor update that could make it out in an upcoming release... Thanks in advance guys!&lt;/p&gt;&#xA;" OwnerUserId="17" LastActivityDate="2015-02-06T13:58:08.727" Title="Limit by entry type in Matrix field" Tags="&lt;matrix&gt;&lt;entry-type&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7017" PostTypeId="2" ParentId="7016" CreationDate="2015-02-06T13:58:08.727" Score="1" Body="&lt;p&gt;I suggest to refactor again and use dropdown fields for the path to your partials instead of the channel entries with asset fields you currently have. This also keeps your twig files more secure (your asset folder is above the web root!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up three dropdown fields ('pathSideBar', 'pathPrimary' and 'pathFullPage') to do&#xA;the grouping and one Matrix Block for each of them. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == 'widgetSideBar' %}&#xA;&#xA;    {% set widgetPath = '_includes/sidebar/' ~ block.pathSideBar ~ '.html' %}&#xA;    {% include widgetPath only %}&#xA;&#xA;{% elseif block.type == 'widgetPrimary' %}&#xA;&#xA;    {# ... #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-06T13:58:08.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7018" PostTypeId="1" CreationDate="2015-02-06T14:43:58.467" Score="1" ViewCount="86" Body="&lt;p&gt;I have a Category group set up with URLs enabled. I'm just wondering if it's possible to link to a Category Index from the Link feature within a Rich Text Field. I realize I can manually create my own link (i.e. /path/to/category) via &quot;Insert Link&quot;  but was looking for a dynamic link along the lines of the &quot;Link to Entry&quot; or &quot;Link to an Asset&quot; methods. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft 2.4 Support added!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8126490-add-a-link-to-a-category-option-to-rich-text-fie&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8126490-add-a-link-to-a-category-option-to-rich-text-fie&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2273" LastEditorUserId="27" LastEditDate="2015-06-03T14:55:53.877" LastActivityDate="2015-06-03T14:55:53.877" Title="Link to Category Index in Rich Text Field" Tags="&lt;categories&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-02-06T17:19:25.150" ContentLicense="CC BY-SA 3.0" />
  <row Id="7019" PostTypeId="2" ParentId="6864" CreationDate="2015-02-06T15:39:36.333" Score="1" Body="&lt;p&gt;OK, it was problem with the provider.&#xA;For all german users using HostEurope here is the solution &lt;a href=&quot;https://faq.hosteurope.de/?cpid=11073&quot; rel=&quot;nofollow&quot;&gt;https://faq.hosteurope.de/?cpid=11073&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2244" LastActivityDate="2015-02-06T15:39:36.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7020" PostTypeId="1" AcceptedAnswerId="7025" CreationDate="2015-02-06T15:44:38.823" Score="1" ViewCount="727" Body="&lt;p&gt;I uploaded and un-tar'ed a bunch of folders containing images under one of our local asset source folder.  After triggering the &quot;Update Asset Indexes&quot; tool, and waiting for its completion, my asset table is still blank.  Under &quot;Assets&quot;, I can see all the new sub-folders but all are empty.  I checked the file and folder permissions on disk, all are ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking into the database, the &quot;craft_assetindexdata&quot; show all the file path, but the &quot;recordId&quot; column indicate &quot;NULL&quot;.  Is there something else I need to trigger for this process to complete?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Craft Pro 2.3.2629&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="985" LastActivityDate="2015-02-06T18:29:28.540" Title="Uploaded assets using ftp, asset not displaying" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7022" PostTypeId="2" ParentId="7013" CreationDate="2015-02-06T16:39:05.850" Score="0" Body="&lt;p&gt;It just sounds like your nginx conf file isn't setup properly.  See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;here&lt;/a&gt; for some working examples.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-06T16:39:05.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7023" PostTypeId="1" AcceptedAnswerId="7024" CreationDate="2015-02-06T17:17:10.903" Score="5" ViewCount="4146" Body="&lt;p&gt;I am attempting to create a &quot;dynamic&quot; button. By that I mean I want the user to be able to update the text and the target (href) of where the button links to when clicked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I created fields: &lt;code&gt;buttonText&lt;/code&gt; and &lt;code&gt;buttonTarget&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;buttonText&lt;/code&gt; is just a plain text field - no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;code&gt;buttonTarget&lt;/code&gt; field type I chose &quot;Entry&quot; and selected the source(s) in the checklist that follows with a limit of one. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my actual entry, I enter the &lt;code&gt;buttonText&lt;/code&gt; of &quot;Hello World&quot;. Preview the page and &quot;Hello World&quot; shows up as the button text. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I have a page called &quot;Hello&quot;. For my &lt;code&gt;buttonTarget&lt;/code&gt; field I click on &quot;Add an Entry&quot; and choose &quot;Hello&quot; from the entry list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I preview my site now, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That makes perfect sense since I need everything to evaluate to a string. I'm not sure how I can output (for lack of better words) the object so that I can see/find what properties are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I am using to display the button:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{entry.buttonTarget}}&quot; class=&quot;btn btn-default&quot;&amp;gt;{{entry.buttonText}}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume I need something like &lt;code&gt;{{entry.buttonTarget.uri}}&lt;/code&gt; but I haven't been able to find out what the actual parameter is I need. &lt;code&gt;{{entry.uri}}&lt;/code&gt; outputs nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing this gets the result I am after: &lt;code&gt;{{entry.slug}}&lt;/code&gt; This uses the current entry's slug instead of the custom field value. Which is ok - I can use the slug as the href target. Ideally I'd like to use the custom field though.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-02-06T17:28:54.203" Title="Link to an entry via Entries field type" Tags="&lt;templating&gt;&lt;entry-type&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7024" PostTypeId="2" ParentId="7023" CreationDate="2015-02-06T17:20:05.267" Score="13" Body="&lt;p&gt;Even if you set the limit to 1, Craft always returns an array of entries. So you need to add &lt;code&gt;first()&lt;/code&gt; to access the first (and only) entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.buttonTargets.first() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It you don't add a property, this returns the entry's title by default. So you additionally need to add &lt;code&gt;url&lt;/code&gt; to output the URL of that entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.buttonTargets.first().url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-06T17:28:54.203" LastActivityDate="2015-02-06T17:28:54.203" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7025" PostTypeId="2" ParentId="7020" CreationDate="2015-02-06T18:29:28.540" Score="2" Body="&lt;p&gt;Looks like you're getting an nginx gateway timeout error.  &lt;a href=&quot;http://www.nginxtips.com/504-gateway-time-out-using-nginx/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is some info on how you can increase the time limit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-06T18:29:28.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7027" PostTypeId="1" AcceptedAnswerId="7028" CreationDate="2015-02-06T23:35:15.510" Score="4" ViewCount="191" Body="&lt;p&gt;Let's say I've got a hot plugin called Cornballer, and I'd like to avoid embarrassing template errors &lt;strong&gt;if I refer to it in a template without yet installing it&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to get away with this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if craft.cornballer %}&#xA;&#xA; {{ craft.cornballer.simulate('little') }}&#xA;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...so that any cornballing is simply ignored and no errors result. But Craft allows no such thing:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Method &quot;cornballer&quot; for object &quot;Craft\CraftVariable&quot; does not exist &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a way?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2015-02-07T02:06:03.797" LastActivityDate="2015-02-07T02:06:03.797" Title="Is there a template conditional to determine whether a plugin is installed?" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7028" PostTypeId="2" ParentId="7027" CreationDate="2015-02-06T23:39:35.807" Score="6" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.cornballer is defined %}&#xA;    Never fear... CornBaller is here.&#xA;{% else %}&#xA;    I'm missing my CornBaller.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-06T23:39:35.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7029" PostTypeId="1" CreationDate="2015-02-07T13:32:44.197" Score="1" ViewCount="298" Body="&lt;p&gt;I've had a look through some previous posts and the craft docs and it doesn't look like anyone has done anything similar to what I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially I have a 'client area' where a user can log in and just see photos and videos that are set on their profile (added by the admin). This all works great but I require functionality so the user can add a comment to said video or photo. I know solutions such as Disqus have been suggested but I can't see away of making them private and locked down so other guests and members cannot get access to the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of any plugins, or methods through Craft that could be a possible solution or starting point to a solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-02-16T15:48:19.200" Title="Looking for a private commenting solution for member area" Tags="&lt;user-profile&gt;&lt;password&gt;&lt;comments&gt;&lt;member&gt;&lt;hiding&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7030" PostTypeId="2" ParentId="6992" CreationDate="2015-02-07T13:54:35.443" Score="0" Body="&lt;p&gt;Would it be possible to initiate the payment first, and then have stripe send an email/receipt that routes the individual to complete the signup from a registration page that assigns all people who register from that page to the appropriate group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let Stripe do the heavy lifting...&lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2015-02-07T13:54:35.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7031" PostTypeId="1" CreationDate="2015-02-07T14:26:42.650" Score="1" ViewCount="362" Body="&lt;p&gt;I must simply be blanking this morning, but for whatever reason, this has me stumped... I have a Structure section I use for the different sections of my site which sets titles for each page, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I have another section called &quot;Widgets&quot;. These widgets are stored in the template folder and each widget is linked up to a dedicated entry in an Asset field. Finally, each Structure entry (take the home page for example) has a Matrix field. This allows me to rapidly add new pages from templates I have already built. Unfortunately this time around I am having trouble pulling the filename for the widgets, though I seem to be able to grab the asset IDs. Following is the code. Thank you in advance for the help; I am sure it is simple but I've been banging my head against my desk for a little too long now...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% block contentPrimary %}&#xA;                {% switch entry.type %}&#xA;                    {% case &quot;mainContentLeft&quot; %}&#xA;                        {% for block in entry.contentPrimary %}&#xA;                            {% switch block.type %}&#xA;                                {% case &quot;text&quot; %}&#xA;                                    {{ block.text }}&#xA;                                {% case &quot;widget&quot; %}&#xA;                                    {% if block.widgetPrimary|length and block.entry[0].widgets|length %}&#xA;                                        {{ block.widgetPrimary[0].widgets[0].filename }}&#xA;                                    {% endif %} &#xA;                            {% endswitch %}&#xA;                        {% endfor %}&#xA;                    {% case &quot;mainContentRight&quot; %}   &#xA;                        Main Content Right&#xA;                    {% case &quot;singleColumn&quot; %}   &#xA;                        Single Column&#xA;                {% endswitch %}&#xA;            {% endblock contentPrimary %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After trying a few different things, I've seen a couple different errors, but the error I see at present states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;widgetPrimary&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thank you again, in advance!&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="17" LastEditDate="2015-02-09T02:55:51.440" LastActivityDate="2015-02-09T02:55:51.440" Title="Retrieve Asset Filename from an entry, inside a matrix field" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;files&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7032" PostTypeId="1" AcceptedAnswerId="8288" CreationDate="2015-02-07T15:50:48.440" Score="6" ViewCount="1562" Body="&lt;p&gt;I've been clattering around the google developers console for a while, and i just can't get it to work with Craft! I figured it'd be simple (and it may well be!) considering in Craft it just asks for two bits of data, &quot;Access Key ID&quot; and &quot;Secret Access Key&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After an age of digging about in the google developes console site and a bit of searching, i  ended up in the Project Dashboard for my Cloud Storage.&#xA;Enabling &quot;Interoperable Access&quot; gave me some new tabs on the side, one of which is &quot;Interoperable Access&quot;, and in there FINALLY i found two strings that have the names &quot;Access Key&quot; and &quot;Secret&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting them into Craft and hitting refresh next to Bucket gives me the error &quot;Credentials rejected by target host&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so now i'm stumped! Does anyone have experience using Google Cloud Storage with Craft who can point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2018-09-03T02:54:46.127" Title="How to set up Craft to use Google Cloud Storage?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7033" PostTypeId="2" ParentId="7031" CreationDate="2015-02-07T17:01:59.777" Score="1" Body="&lt;p&gt;You're problem is with 'block.entry[0].widgets', which I suspect is a typo. Try this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;widget&quot; %}&#xA;    {% if block.widgetPrimary|length %}&#xA;        {% if block.widgetPrimary[0].widgets|length %}&#xA;            {{ block.widgetPrimary[0].widgets[0].filename }}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, be careful of combining conditionals where the second will throw an error if the first fails. (i.e. in the following &lt;code&gt;block.widgetPrimary[0].widgets&lt;/code&gt; will throw an error if &lt;code&gt;block.widgetPrimary|length&lt;/code&gt; fails).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.widgetPrimary|length and block.widgetPrimary[0].widgets|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-07T17:01:59.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7034" PostTypeId="2" ParentId="7031" CreationDate="2015-02-07T17:43:00.597" Score="3" Body="&lt;p&gt;I would first check if you actually set up the Field handles you are currently using in your template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Field handle: 'contentPrimary'&lt;br&gt;&#xA;Block Type handle: 'widget'&lt;br&gt;&#xA;Entries Field handle: 'widgetPrimary'&lt;br&gt;&#xA;Assets Field handle: 'widgets'  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then try to use the &lt;code&gt;first()&lt;/code&gt; method instead of direct access to the array.&#xA;&lt;s&gt;Or use direct access only after adding find() method that creates an array out of your ElementCriteriaModel.&lt;/s&gt; &lt;em&gt;Edit:&lt;/em&gt; Direct access like this: &lt;code&gt;myArray[0]&lt;/code&gt; should also work with an ElementCriteriaModel, but throws errors if no first elements exists (→ read &lt;a href=&quot;https://craftcms.stackexchange.com/a/296/125&quot;&gt;Brandon's answer on this topic&lt;/a&gt; for more info).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentPrimary %}&#xA;    {% switch block.type %}&#xA;        {% case &quot;widget&quot; %}&#xA;            {% set relatedEntry = block.widgetPrimary.first() %}&#xA;            {% if relatedEntry %}&#xA;                {% set asset = relatedEntry.widgets.first() %}&#xA;                {% if asset %}&#xA;                    {{ asset.title }}&#xA;                {% endif %}&#xA;            {% endif %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-07T17:55:29.717" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7035" PostTypeId="2" ParentId="7029" CreationDate="2015-02-07T19:30:49.897" Score="3" Body="&lt;p&gt;Something like this should work, but keep in mind there are lot's of ways to accomplish this. Without knowing your requirements, I'll assume you want an index page of assets, that link to an asset detail page. The detail page would show all comments and provide a form to add new comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your assets index page (i.e. '/clientarea/lightbox'):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %} &#xA;&#xA;{# show user profile information (if needed) #}&#xA;&amp;lt;div class=&quot;user--info&quot;&amp;gt;&#xA;    {{ currentUser.firstName }} {{ currentUser.lasName }}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{# loop through images in Assets field #}&#xA;&amp;lt;h2&amp;gt;Images&amp;lt;/h2&amp;gt;&#xA;&amp;lt;div class=&quot;images&quot;&amp;gt;&#xA;    {% for image in currentUser.assetsFieldHandle %}&#xA;        &amp;lt;div class=&quot;image--details&quot;&amp;gt;&#xA;            {# display image, title and link #}&#xA;            &amp;lt;img src=&quot;{{ image.url}}&quot; alt=&quot;{{ image.title }}&quot;/&amp;gt;&amp;lt;br&amp;gt;&#xA;            {{ image.title }}&amp;lt;br&amp;gt;&#xA;            &amp;lt;a href=&quot;/clientarea/lightbox/media/{{ image.id }}&quot;&amp;gt;View image&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{# repeat for videos, etc #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your asset detail page (i.e. 'clientarea/lightbox/media/123' ). Note: to get this uri, you can either create these folders in your templates folder (i.e. 'clientarea/lightbox/media/_entry.html'), or &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;create a custom route&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %}&#xA;&#xA;{# fetch image #}&#xA;{% set imageId = craft.request.lastSegment %}&#xA;{% set image = craft.assets.id(imageId).first %}&#xA;&#xA;{# check whether image exists, otherwise redirect 404 #}&#xA;{% if not image %}&#xA;    {% redirect 404 %}&#xA;{% endif %}&#xA;&#xA;{# check whether they are authorized to view this asset #}&#xA;{% set authorized = false %}&#xA;{% set authorizedImages = craft.assets.relatedTo(currentUser) %}&#xA;{% for authorizedImage in authorizedImages %}&#xA;    {% if authorizedImage.id == image.id %}&#xA;        {% set authorized = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# if not authorized, redirect to 401 #}&#xA;{% if not authorized %}&#xA;    {% redirect 401 %}&#xA;{% endif %}&#xA;&#xA;{# show user profile information (if needed) #}&#xA;&amp;lt;div class=&quot;user--info&quot;&amp;gt;&#xA;    {{ currentUser.firstName }} {{ currentUser.lasName }}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{# display image details #}&#xA;&amp;lt;div class=&quot;image--details&quot;&amp;gt;&#xA;    {# display image and title #}&#xA;    &amp;lt;img src=&quot;{{ image.url}}&quot; alt=&quot;{{ image.title }}&quot;/&amp;gt;&amp;lt;br&amp;gt;&#xA;    {{ image.title }}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{# fetch comments from the 'clientComments' section that are related to this image #}&#xA;&amp;lt;ul class=&quot;image--comments&quot;&amp;gt;&#xA;    {% set comments = craft.entries.section('clientComments').relatedTo(image) %}&#xA;    {% for comment in comments %}&#xA;        &amp;lt;li&amp;gt;{{ comment.commentTextFieldHandle }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{# display a form to add a new comment #}&#xA;&amp;lt;div class=&quot;commentform&quot;&amp;gt;&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;        {# reload the current page on successful form submission #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.path }}&quot;&amp;gt; &#xA;        {# section id for 'clientComments' #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;2&quot;&amp;gt; &#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        {# hidden field to save the image id #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[commentAssetsFieldHandle]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;comment&quot;&amp;gt;Comment&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;body&quot; name=&quot;fields[commentTextFieldHandle]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Add comment&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will likely also need to add some checks for the asset type, in order to determine how to display the asset. But you get the general idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need to make sure that they have permission to create entries in the clientComments section (but not view or edit other peoples entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if the image or video is displayed on more than one user's profile, then you will also need to factor in the author when searching for comments. Either that, or also add a related users field to the comments section, and then search for comments related to both image and currentUser.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-16T15:48:19.200" LastActivityDate="2015-02-16T15:48:19.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7036" PostTypeId="1" CreationDate="2015-02-07T19:33:42.297" Score="0" ViewCount="102" Body="&lt;p&gt;For theming, I need to get the Section Handle for the current Entry. When using dump(entry), I see &lt;strong&gt;sectionId&lt;/strong&gt; is available. This works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.sectionId }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm not seeing a way to get the &lt;strong&gt;sectionHandle&lt;/strong&gt;. Does anyone know a quick way to get it?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-02-07T19:33:42.297" Title="Get Handle/Name of Entry's Section" Tags="&lt;templating&gt;&lt;entry&gt;&lt;sections&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ClosedDate="2015-02-08T22:18:09.710" ContentLicense="CC BY-SA 3.0" />
  <row Id="7037" PostTypeId="1" CreationDate="2015-02-08T00:43:57.460" Score="4" ViewCount="349" Body="&lt;p&gt;Just ran into this error while developing a plugin.  Not doing much of anything special, just editing and renaming a few templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could cause this error to happen?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-08T00:43:57.460" Title="Undefined property: Craft\WebApp::$cache" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7038" PostTypeId="2" ParentId="7037" CreationDate="2015-02-08T00:43:57.460" Score="3" Body="&lt;p&gt;Upon looking at the &lt;code&gt;craft/runtime/logs/phperrors.log&lt;/code&gt; I noticed the following error being reported:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Maximum function nesting level of '200' reached, aborting! in /Users/username/path/to/website/craft/app/framework/base/CModule.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To fix the issue, I updated the following line in my &lt;code&gt;php.ini&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level=200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To something higher:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level=500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This error might be thrown in other scenarios as well as this fix seems pretty specific to having XDebug installed. In any case, these steps helped me get it resolved.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-08T00:43:57.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7039" PostTypeId="1" AcceptedAnswerId="7040" CreationDate="2015-02-08T02:20:24.507" Score="3" ViewCount="1173" Body="&lt;p&gt;I'd like to have my users automatically verified/activated so they can immediately login after registration. Normally this would be done through the automatic emailer, but I'd like to skip that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any easy changes to do this, or will I have to write a plugin?&lt;/p&gt;&#xA;" OwnerUserId="930" LastActivityDate="2015-02-08T03:08:31.843" Title="What's the simplest way of automatically activating/verifying user accounts?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7040" PostTypeId="2" ParentId="7039" CreationDate="2015-02-08T03:08:31.843" Score="5" Body="&lt;p&gt;If you have Craft Pro edition installed, in the control panel you can go to Settings-&gt;Users-&gt;Settings and uncheck &quot;Verify email addresses?&quot; and check &quot;Allow public registration?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a front-end registration for similar to &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and it should do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-08T03:08:31.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7041" PostTypeId="1" CreationDate="2015-02-08T03:41:11.017" Score="0" ViewCount="586" Body="&lt;p&gt;I need to implement quiz feature in which a few questions will be asked to user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please let me know if there is any plugin for it.&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2015-02-08T06:44:56.080" Title="Need to implement quiz feature" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7042" PostTypeId="2" ParentId="7041" CreationDate="2015-02-08T06:44:56.080" Score="2" Body="&lt;p&gt;Until the plugin store arrives, the complete list of available plugin is here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know of any quiz plugins specifically. I did build a rudimentary quiz for a client, using only a matrix field. Depending on how you wanted to architect your quiz, a plugin may not even be necessary.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-02-08T06:44:56.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7043" PostTypeId="1" AcceptedAnswerId="7137" CreationDate="2015-02-08T11:41:11.053" Score="1" ViewCount="598" Body="&lt;p&gt;I have this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('gigs') %}&#xA;    &amp;lt;h2 class=&quot;{{ cycle(['odd','even'], loop.index0) }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns the same cycles for the last two entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2 class=&quot;odd&quot;&amp;gt;Title 1&amp;lt;/h2&amp;gt;&#xA;&amp;lt;h2 class=&quot;even&quot;&amp;gt;Title 2&amp;lt;/h2&amp;gt;&#xA;&amp;lt;h2 class=&quot;odd&quot;&amp;gt;Title 3&amp;lt;/h2&amp;gt;&#xA;&amp;lt;h2 class=&quot;even&quot;&amp;gt;Title 4&amp;lt;/h2&amp;gt;&#xA;&amp;lt;h2 class=&quot;odd&quot;&amp;gt;Title 5&amp;lt;/h2&amp;gt;&#xA;&amp;lt;h2 class=&quot;odd&quot;&amp;gt;Title 6&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No matter how many entries, the last two entries have always the same class. Why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Okay, I figured the problem. It's not a bug:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I filter the entries by date:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set present = now|date_modify(&quot;-1 day&quot;) %}&#xA;{% for entry in craft.entries.section('gigs') %}&#xA;   {% if entry.datum &amp;lt; present %}&#xA;       &amp;lt;h2 class=&quot;{{ cycle(['odd','even'], loop.index0) }}&quot;&amp;gt;{{ entry.title }&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA; {% endfor %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so the cycle filter works, but since some entries are filtered the odd/even schema doesn't work any longer. I guess I have to filter the entries first and then apply the cycle filter. But how would I have to write do that?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2015-02-12T12:41:08.477" LastActivityDate="2015-02-12T14:05:05.157" Title="Cycle tag - last cycle returns same cycle" Tags="&lt;templating&gt;&lt;cycle&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7044" PostTypeId="1" AcceptedAnswerId="7045" CreationDate="2015-02-08T16:59:59.617" Score="7" ViewCount="1275" Body="&lt;p&gt;Currently my editors do not know when new content submitted by a user without publishing permissions is ready to be reviewed. The status of &quot;disabled&quot; could refer to an in-progress draft or a completed draft ready to be reviewed by an editor. There is no way the user can flag their article as ready and for this to be easily exposed to the editors in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could this be addressed.&lt;/p&gt;&#xA;" OwnerUserId="2279" LastActivityDate="2017-04-26T01:32:47.093" Title="Editorial workflow / custom status" Tags="&lt;workflow&gt;&lt;status&gt;&lt;editor&gt;&lt;draft&gt;&lt;pending&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7045" PostTypeId="2" ParentId="7044" CreationDate="2015-02-08T19:04:02.137" Score="7" Body="&lt;p&gt;One solution that comes to mind is to add your own custom status field (i.e. 'reviewStatus') as a drop-down menu (or checkbox perhaps if only one status). Then add this field as a column in your list view via a small plugin, using the new &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;modifyEntryTableAttributes&lt;/a&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:3')&#xA;    {&#xA;        {# remove a column if desired #}&#xA;        //unset($attributes['expiryDate']);&#xA;&#xA;        {# add a column #}&#xA;        $attributes['reviewStatus'] = Craft::t('Review Status');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Might also check out &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; hook (to customize the HTML display of that column), and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;modifyEntrySortableAttributes&lt;/a&gt; hook (to add this field to the sort options).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To change the column display order you would need to unset all of the native attributes and reset them in the desired order (see &lt;a href=&quot;https://craftcms.stackexchange.com/a/7051/784&quot;&gt;this answer&lt;/a&gt; for example).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-08T19:57:48.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7046" PostTypeId="2" ParentId="412" CreationDate="2015-02-08T19:16:45.313" Score="3" Body="&lt;p&gt;This is now possible using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntryTableAttributes&lt;/a&gt; hook. From the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:3')&#xA;    {&#xA;        unset($attributes['expiryDate']);&#xA;        $attributes['id'] = Craft::t('ID');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See also: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySortableAttributes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-08T19:16:45.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7047" PostTypeId="1" AcceptedAnswerId="7049" CreationDate="2015-02-08T19:23:21.230" Score="3" ViewCount="335" Body="&lt;p&gt;What does the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySources&lt;/a&gt; hook do exactly, and when might one use it? Can someone help clarify this please?&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-08T19:43:11.430" Title="What does the 'modifyEntrySources' hook do?" Tags="&lt;plugin-development&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7049" PostTypeId="2" ParentId="7047" CreationDate="2015-02-08T19:43:11.430" Score="2" Body="&lt;p&gt;&quot;Source&quot; is in the context of &quot;where an element is pulling its data from&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest example is with &lt;a href=&quot;http://buildwithcraft.com/docs/assets&quot; rel=&quot;nofollow&quot;&gt;Assets&lt;/a&gt;, because they have easily defined Asset Sources settings portion of the control panel, but all elements (entries, tags, categories, users, etc.) have sources behind the scenes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources&quot; rel=&quot;nofollow&quot;&gt;CategorySources&lt;/a&gt; plugin for an example of how it might be used (including a screenshot).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-08T19:43:11.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7050" PostTypeId="1" AcceptedAnswerId="7069" CreationDate="2015-02-08T19:48:04.410" Score="3" ViewCount="316" Body="&lt;p&gt;When adding a custom column to an Entry List view using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntryTableAttributes&lt;/a&gt; hook, how would you also set the display order of columns?&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-08T19:58:31.677" LastActivityDate="2015-07-03T18:05:28.213" Title="How to change the display order of columns in Entry List view?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;hook&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7051" PostTypeId="2" ParentId="7050" CreationDate="2015-02-08T19:48:04.410" Score="2" Body="&lt;p&gt;As far as I can tell, you would need to unset all of the native columns and then reset them in the desired order.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:3')&#xA;    {&#xA;        // unset all column attributes&#xA;        unset($attributes['title']);&#xA;        unset($attributes['uri']);&#xA;        unset($attributes['postDate']);&#xA;        unset($attributes['expiryDate']);&#xA;&#xA;        // set column attributes in the desired order&#xA;        $attributes['id'] = Craft::t('ID');&#xA;        $attributes['title'] = Craft::t('Title');&#xA;        $attributes['uri'] = Craft::t('URI');&#xA;        $attributes['postDate'] = Craft::t('Post Date');&#xA;        $attributes['expiryDate'] = Craft::t('Expiry Date');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-08T19:48:04.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7052" PostTypeId="1" AcceptedAnswerId="7062" CreationDate="2015-02-08T21:06:15.050" Score="2" ViewCount="710" Body="&lt;p&gt;I have an entry with two matrix fields and I want to use relations between them using Tags to create a fake nested Matrix functionality for one block type. The &quot;main&quot; matrix field is for creating a typical banded page (several horisontal stripes of content). One of the blocks in this main matrix has to contain a contentSlider, and since in this specific case adding an Assets field is not sufficient we have to nest or merge two matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While looping through the main matrix field using the Switch method I have a block type named &quot;contentSlider&quot;. In this block type I have a Tags field named &quot;showTags&quot;. In my second matrix field named &quot;slidesMatrix&quot; I have a field named &quot;tags&quot;. I want to find blocks in the second matrix (slidesMatrix) related to the current block in the main matrix.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is my attempt, it is not giving me any errors but it is not outputting the &quot;slide.heading&quot; field either so something must be wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;contentSlider&quot; %}&#xA;    {% set tagsToFind = block.showTags %}&#xA;    {% set relatedSlides = entry.slidesMatrix.tags.relatedTo(tagsToFind).order('score').find() %}&#xA;    {% for slide in relatedSlides %}&#xA;        Matched Tag in: {{ slide.heading }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This alternative code works, but it is only matching the first Tag from the current block to all the Tags in the second matrix block (slidesMatrix.tags) and switching to one of the native Craft methods like &quot;relatedTo&quot; would be a more powerful solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;contentSlider&quot; %}&#xA;    {% set tagsToFind = block.showTags %}&#xA;    {% set tagToFind = tagsToFind.first.title %}&#xA;    {% for slide in entry.slidesMatrix if tagToFind in slide.tags %}&#xA;        Matched Tag in: {{ slide.heading }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}            &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To sum this up into one question;&lt;br&gt;&#xA;&lt;strong&gt;How can I loop through a matrix field filtered by Tags contained in a tags fields inside the matrix blocks I want to loop through, using a native Craft feature like 'relatedTo'?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="828" LastEditorUserId="828" LastEditDate="2015-02-09T07:58:09.903" LastActivityDate="2015-02-09T19:53:11.067" Title="Nested Matrix functionality for one block type using Tags" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;tags&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7053" PostTypeId="1" CreationDate="2015-02-08T22:13:44.030" Score="2" ViewCount="180" Body="&lt;p&gt;The Craft docs have a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;good overview of the {% cache %} tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs give a couple examples of when not to use the {% cache %} tag.  In particular, they give this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Don’t use them to cache static text; that will be more expensive than simply outputting the text.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone explain to me the logic behind this statement? How do the two scenarios play out where caching static text is slower than just outputting it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, what if you are caching a page with several queries that includes static text?  Does it follow that you'll want to cache the queries in and of themselves and let the static text remain uncached?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-08T22:34:35.503" Title="Why is using the cache tag more expensive than outputting static text?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7054" PostTypeId="2" ParentId="7053" CreationDate="2015-02-08T22:34:35.503" Score="2" Body="&lt;p&gt;Since the &lt;code&gt;{% cache %}&lt;/code&gt; tag solely stores its information in the database, it has a guaranteed minimum of one database call to make to see if what's inside of it has already been cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    Hi. I'm static text.&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's quite a bit more overhead than simply:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hi. I'm static text.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With no real benefit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-08T22:34:35.503" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7055" PostTypeId="1" AcceptedAnswerId="7068" CreationDate="2015-02-08T22:58:14.390" Score="3" ViewCount="239" Body="&lt;p&gt;I'm not certain if this is expected behavior but if so the user experience is confusing/unexpected:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When viewing a list of entries in the control panel, swapping between locales shows the expected statuses--either enabled or disabled--for each entry. Accordingly, example, an entry that is enabled in English but disabled in Spanish, is properly displayed as such. However, making a change to the status when switched to either locale applies the status to &lt;em&gt;both&lt;/em&gt; locales, rather than just the selected locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to indicate that adjusting statuses through the entries list applies only to the entry's master enabled/disabled status, not the selected locale's status (which was my expectation). Should this be the be case? I found out the hard way by switching to my Spanish locale, selecting all entries, and then setting their status to disabled. Switching to the other status showed that they too had been disabled. Bummer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or similar experiences? Did I miss something in the docs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2015-02-09T14:28:06.973" Title="Changing status via entries list in one locale also (unexpectedly) changes status in other locale(s)" Tags="&lt;entries&gt;&lt;localization&gt;&lt;status&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7056" PostTypeId="2" ParentId="7055" CreationDate="2015-02-08T23:40:09.943" Score="2" Body="&lt;p&gt;I agree this is confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are editing the entry, you can change the status per/locale by selecting the locale in the box in the upper right corner, and then using the lightswitch next to the selected locale.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-02-08T23:40:09.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7057" PostTypeId="1" CreationDate="2015-02-09T00:19:53.023" Score="2" ViewCount="506" Body="&lt;p&gt;Here is my situation: I have a bunch of different series (which are each stored in a channel), and there are a bunch of sermons related to each series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need to do is display the most recent entry of each series. Typically I would do this in a SELECT DISTINCT SQL query; How should I go about doing it in Craft?&lt;/p&gt;&#xA;" OwnerUserId="2282" LastActivityDate="2015-02-09T03:46:25.370" Title="Select distinct entries?" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7058" PostTypeId="2" ParentId="6513" CreationDate="2015-02-09T02:24:07.213" Score="3" Body="&lt;p&gt;There are three database tables that Craft uses to manage template caches:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft_templatecachecriteria&#xA;craft_templatecacheelements&#xA;craft_templatecaches&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can visit each of those tables remove any records in them directly.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="57" LastEditDate="2015-02-09T03:11:05.070" LastActivityDate="2015-02-09T03:11:05.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7059" PostTypeId="2" ParentId="7031" CreationDate="2015-02-09T02:55:16.630" Score="1" Body="&lt;p&gt;Here is the solution I came up with. Hope this can help someone else. Thank you all for your suggestions, too!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch block.type %}&#xA;    {% case &quot;text&quot; %}&#xA;        {{ block.text }}&#xA;    {% case &quot;widget&quot; %}&#xA;        {% include &quot;widgets/primary/&quot;~ block.widgetFile[0].widgetPrimary[0].filename ~&quot;&quot; %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17" LastActivityDate="2015-02-09T02:55:16.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7060" PostTypeId="2" ParentId="7057" CreationDate="2015-02-09T03:46:25.370" Score="2" Body="&lt;p&gt;If I understand your question and structure correctly, then this might work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% entries = craft.entries.section('series').limit(null) %}&#xA;{% mostRecentSermons = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    {# retrieve most recent sermon related to series #}&#xA;    {% set sermon = craft.entries.section('sermons').relatedTo(entry).order('postDate desc').first %}&#xA;&#xA;    {# merge sermon into mostRecentSermons array #}&#xA;    {% set mostRecentSermons = mostRecentSermons|merge([sermon]) %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to worry about duplicates then you can use &lt;code&gt;{% if not sermon in mostRecentSermons %}&lt;/code&gt; before merging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to wrap this in &lt;code&gt;{% cache %}{% endcache %}&lt;/code&gt; tags to improve performance.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-09T03:46:25.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7061" PostTypeId="2" ParentId="7014" CreationDate="2015-02-09T07:55:16.620" Score="0" Body="&lt;p&gt;Found out how to do this. If anyone else needs something similar then adding the new &lt;code&gt;{{ jsClass }}&lt;/code&gt; part of input template into a function and calling it after extra elements are added also makes them sortable.&lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="125" LastEditDate="2015-02-09T08:06:53.463" LastActivityDate="2015-02-09T08:06:53.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7062" PostTypeId="2" ParentId="7052" CreationDate="2015-02-09T09:23:46.587" Score="4" Body="&lt;p&gt;I just tried to replicate your setup (in simplified form), because I thought this is in fact an interesting and creative approach&#xA;to do Matrix nesting that might come handy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code that works great for me. I hope it helps, even though I actually don't see the difference to what you have?!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Go through our Main Matrix blocks #}&#xA;{% for block in entry.mainMatrix.type('mainRelationsBlock') %}&#xA;&#xA;    {# Get the tags selected in the Main Matrix block #}&#xA;    {% set tagsToFind = block.mainTags %}&#xA;&#xA;    {# Try filtering Matrix blocks of our Sub Matrix using `relatedTo` #}&#xA;    {% set relatedBlocks = entry.subMatrix.relatedTo({&#xA;        targetElement: tagsToFind&#xA;    }) %}&#xA;&#xA;    {# Show them #}&#xA;    {% for relatedBlock in relatedBlocks %}&#xA;        &amp;lt;li&amp;gt;{{ relatedBlock.text }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-09T09:23:46.587" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7063" PostTypeId="1" CreationDate="2015-02-09T11:52:01.103" Score="1" ViewCount="828" Body="&lt;p&gt;is it possible to have the public registration form validate the users Email, but still require manual activation by a system administrator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5216/user-registration-keep-as-inactive-until-verified-by-admin&quot;&gt;User Registration - Keep as inactive until verified by admin&lt;/a&gt; which I think will stop a clicked email confirmation link from activating the user...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but from what I can tell Craft's &quot;email confirmation&quot; is really just an &quot;activate user via link&quot;; so it's not really confirming the validity of the email nor storing that confirmation anywhere; it's just activating the user. Is that right or am I mis-understanding it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Matt&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-09T12:47:09.263" Title="User registration; validate email but don't activate automatically" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7064" PostTypeId="1" AcceptedAnswerId="7125" CreationDate="2015-02-09T12:20:43.103" Score="1" ViewCount="403" Body="&lt;p&gt;I've got a plugin which creates an entry on user activation. I'm trying to extend the plugin so that after public registration the account is not activated (i.e., force an Admin to activate the account).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the documentation I'd expect this code block to stop activation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.beforeActivateUser', function(Event $event){&#xA;        // stop the user from being able to activate their account. Forces admins to do so.&#xA;        //if($event-&amp;gt;params['user']-&amp;gt;isInGroup('artists')){&#xA;            $event-&amp;gt;performAction = false;&#xA;        //}&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't. What am I doing wrong? Full plugin code here: &lt;a href=&quot;https://gist.github.com/MattWilcox/1549fb9d5787288b3b84&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/MattWilcox/1549fb9d5787288b3b84&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-02-11T20:29:21.117" Title="$event-&gt;performAction = false; doesn't stop action" Tags="&lt;plugin-development&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2015-02-12T07:20:56.443" ContentLicense="CC BY-SA 3.0" />
  <row Id="7065" PostTypeId="1" AcceptedAnswerId="7073" CreationDate="2015-02-09T12:39:18.533" Score="1" ViewCount="313" Body="&lt;p&gt;Docs say 'Right within Craft. If you’re running Craft Personal or Craft Client, there’s a link at the bottom of every page in the CP, which brings up a modal window that handles the whole process.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just installed Craft Personal 2.3.2629 and there's no link I can see.&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-02-09T19:59:05.353" Title="How can I purchase Craft Client or Craft Pro?" Tags="&lt;upgrades&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2015-02-09T23:56:11.920" ContentLicense="CC BY-SA 3.0" />
  <row Id="7066" PostTypeId="2" ParentId="7063" CreationDate="2015-02-09T12:47:09.263" Score="2" Body="&lt;p&gt;I think the approach &lt;a href=&quot;https://craftcms.stackexchange.com/a/5223/125&quot;&gt;Johannes posted&lt;/a&gt; as an answer to the question you linked to is a good one.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let the user activate the account via email. It makes sure the address exists and he has access to it, because he can't guess the activation URL without the mail.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This activation only makes him become a member of a Users Group without any permissions at all (e.g. 'unverifiedUsers'). To restrict front end access do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('unverifiedUsers') %}&#xA;    &amp;lt;p&amp;gt;You don't have access rights. Please wait until an admin verifies you account. Thank you!&amp;lt;/p&amp;gt;&#xA;{% else %}&#xA;    {% include 'partial' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then let an admin do the manual verification: add the user to a group with the permissions you want.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-09T12:47:09.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7067" PostTypeId="2" ParentId="7065" CreationDate="2015-02-09T13:01:45.470" Score="2" Body="&lt;p&gt;Go to the Settings page (/admin/settings - reached by clicking on the gear icon at the top right of the control panel) and you should see the following link at the bottom of the page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XBF3Z.png&quot; alt=&quot;Upgrade Craft to take your site to the next level. Show me&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Click on the Show me link and the modal window pops up.&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2015-02-09T13:11:38.200" LastActivityDate="2015-02-09T13:11:38.200" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7068" PostTypeId="2" ParentId="7055" CreationDate="2015-02-09T14:28:06.973" Score="2" Body="&lt;p&gt;On localized sites, each entry has two statuses: the primary entry status (the big “Status” lightswitch field at the bottom of the sidebar) and the locale-specific statuses (the small lightswitch field beside the currently selected locale).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an entry to be enabled, both of those lightswitches have to be turned on. But only one of them has to be turned off for it to be disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion here is because the entry index page doesn’t communicate &lt;em&gt;why&lt;/em&gt; an entry is disabled - whether it’s because the entry’s primary status is disabled, or just because the current locale’s status is disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you have an entry whose primary status is disabled, but its locale-specific statuses are enabled, enabling the entry from the index page is going to end up enabling it across all locales, not just the one you’re currently looking at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a common problem for you, you may want to go into your section’s settings and set all of the default locale statuses to disabled. So you will always have to explicitly enable a locale’s status before it starts showing up for that locale.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-02-09T14:28:06.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7069" PostTypeId="2" ParentId="7050" CreationDate="2015-02-09T17:35:01.133" Score="4" Body="&lt;p&gt;You need to reorder the &lt;code&gt;$attributes&lt;/code&gt; array to do this. You can do this in various ways, here is how I would do it depending on the position you wanted for the new column:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:3')&#xA;    {&#xA;        // insert column in first position (using array_merge)&#xA;        $attributes = array_merge(array(['id'] =&amp;gt; Craft::t('ID'), $attributes);&#xA;&#xA;        // insert column in fourth position (using array_splice)&#xA;        array_splice($attributes, 3, 0, array('id' =&amp;gt; Craft::t('ID')));  &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="75" LastEditDate="2015-07-03T18:05:28.213" LastActivityDate="2015-07-03T18:05:28.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7070" PostTypeId="1" CreationDate="2015-02-09T18:04:18.633" Score="1" ViewCount="80" Body="&lt;p&gt;I'm using categories and relating them to entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If using &lt;code&gt;.relatedTo().total()&lt;/code&gt; I'm seeing the total number of ALL entries if none of the entries are related to a particular category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If using &lt;code&gt;.relatedTo().find()|length&lt;/code&gt; then zero is returned as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to output a link list of all categories with their total related entries IF they have any entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I'm using (with a testing snippet to show how &lt;code&gt;|length&lt;/code&gt; is working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = craft.categories.group('topic') %}&#xA;{% for cat in cats %}&#xA;  {% set total = typeEntries.relatedTo({targetElement:cat}).total() %}&#xA;  {% if total %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ urlPrefix ~ '/topic:' ~ cat.slug }}&quot;&amp;gt;{{ cat.title }} ({{ total }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    testing length: {{ typeEntries.relatedTo({targetElement:cat}).find()|length }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2285" LastActivityDate="2015-02-09T18:04:18.633" Title="Is .relatedTo().total() returning all source elements if none are found?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2015-02-20T01:21:06.817" ContentLicense="CC BY-SA 3.0" />
  <row Id="7071" PostTypeId="2" ParentId="7052" CreationDate="2015-02-09T18:37:54.153" Score="0" Body="&lt;p&gt;Here is my initial code with @carlcs solution included:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;contentSlider&quot; %}&#xA;    {% set tagsToFind = block.showTags %}&#xA;&#xA;    {# Match the tags between the current matrix block and another matrix field  #}&#xA;    {% set relatedSlides = entry.slidesMatrix.relatedTo({&#xA;        targetElement: tagsToFind&#xA;    }) %}&#xA;&#xA;    {% for slide in relatedSlides %}&#xA;        Matched Tag in: {{ slide.heading }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great, but I still have my fingers crossed for native support for nested matrix support in Craft! It would be a killer feature and is on the top of my wish-list.&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2015-02-09T18:37:54.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7072" PostTypeId="2" ParentId="7052" CreationDate="2015-02-09T19:53:11.067" Score="1" Body="&lt;p&gt;I have another approach that I prefer. This does not involve multiple matrixes, but instead clever templating. Start with your main matrix. Add the blocks from your slide matrix to the main matrix. When editing the matrix, add slide blocks underneath each Content Slider block. When you're done with slides just add the other blocks as usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The template is where the magic happens!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;contentSlider&quot; %}&#xA;    {% set openSlider = true %}&#xA;    &amp;lt;div class=&quot;contentSlider&quot;&amp;gt;&#xA;&#xA;{% case &quot;imageSlide&quot; %}&#xA;    {% if openSlider %}&#xA;        {{ block.heading }}&#xA;    {% endif %}&#xA;&#xA;{% case &quot;richTextBlock&quot; %}&#xA;    {% if openSlider %}&#xA;        {% set openSlider = false %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;    {{ block.richTextField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what's happening here is when you start a new slider, the openSlider variable tells other blocks when there's a slider being built. When a non-slide shows up, it closes the slider before adding its own content. For slides, they only show their content when there's an open slider. This keeps them from showing up elsewhere in case they are misplaced.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-02-09T19:53:11.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7073" PostTypeId="2" ParentId="7065" CreationDate="2015-02-09T19:59:05.353" Score="2" Body="&lt;p&gt;It was a bug. Brad fixed it. Working now.&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-02-09T19:59:05.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7074" PostTypeId="1" AcceptedAnswerId="7076" CreationDate="2015-02-09T22:31:13.863" Score="3" ViewCount="171" Body="&lt;p&gt;I'm trying to call an image via an image transform from a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;standardImage&quot; %}&#xA;  {% set image = block.imageFile.first() %}&#xA;  {% if image %}&#xA;      &amp;lt;img src=&quot;{{ image.url('generalImageTransform') }}&quot; width=&quot;{{ image.getWidth('generalImageTransform') }}&quot; &#xA;      height=&quot;{{ image.getHeight('generalImageTransform') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;  {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;http://.../cpresources/transforms/1?x=DrK2WYEvg&quot; width=&quot;600&quot; height=&quot;601&quot; alt=&quot;district&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can see the width, height and title are all being called successfully, but the image is broken on the web page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I skip the transform and just use &lt;code&gt;{{ image.url() }}&lt;/code&gt; the image is called successfully with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;/images/general/district.png&quot; width=&quot;600&quot; height=&quot;601&quot; alt=&quot;district&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally when I add this to the config file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a PHP error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Image “district.png” cannot be found.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suspect then that the transformed image is unable to be created, but I don't know how to progress this idea, or if I am on the right track at all.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-02-10T00:10:36.553" Title="Error when calling an image transform from matrix field" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7075" PostTypeId="1" CreationDate="2015-02-09T23:56:37.177" Score="1" ViewCount="408" Body="&lt;p&gt;I am running into an issue with Redactor in Craft and I am wondering if anyone can help me sort it out. I am trying to set up multiple rich text fields with different stylesheets connected to each. I've tried out the redactor styles plugin and while it does connect the custom stylesheet to the field, it only allows me to specify one stylesheet site-wide.I took a look at the redactor docs, and it looks like there is an option in the settings for specifying a custom stylesheet, but I can't find an example of how to implement it, and I've tried adding a line to my config but it doesn't work. Here's an example of what I tried in the config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;buttons: ['html','formatting','bold','italic','link'],  &#xA;plugins: ['styles'],&#xA;toolbarFixed: true, &#xA;stylesheet: &quot;http://mysitedomain.com/assets/css/redactorStylesHeader.css&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The stylesheet item I saw in the docs is here: &lt;a href=&quot;https://www.modmore.com/extras/redactor/documentation/configuration/#stylesheet&quot; rel=&quot;nofollow&quot;&gt;https://www.modmore.com/extras/redactor/documentation/configuration/#stylesheet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I not understanding the docs correctly? I was thinking that you could specify a stylesheet option with a url to the stylesheet you want to use and it would use it as a custom stylesheet in addition to what is loaded into redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help clarify this for me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brian&lt;/p&gt;&#xA;" OwnerUserId="2265" LastActivityDate="2015-02-09T23:56:37.177" Title="Is it Possible to Connect a Custom Stylesheet to Redactor via the Config?" Tags="&lt;redactor&gt;&lt;css&gt;&lt;custom&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2015-02-20T01:19:45.790" ContentLicense="CC BY-SA 3.0" />
  <row Id="7076" PostTypeId="2" ParentId="7074" CreationDate="2015-02-10T00:10:36.553" Score="4" Body="&lt;p&gt;I seem to have worked it out - by specifying &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'imageDriver' =&amp;gt; 'gd'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the config. I first tried to specify 'imageDriver' =&gt; 'imagick', but I was getting path error messages so I'm guessing it is not installed on the PHP installation I am using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info at&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6626/errors-with-craft-2-3-imagine-and-imagick&quot;&gt;Errors with Craft 2.3, Imagine and Imagick&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-10T00:10:36.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7077" PostTypeId="1" AcceptedAnswerId="7079" CreationDate="2015-02-10T06:31:44.757" Score="1" ViewCount="432" Body="&lt;p&gt;When retrieving a record in a service and returning a model the static methods: populateModel and populateModels on BaseModel are useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When eager loading a related model in the record query, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$variantRecord = Market_VariantRecord::model()-&amp;gt;with('product')-&amp;gt;findById($id);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will load the related Record's product into the &lt;code&gt;$variantRecord&lt;/code&gt; accessible with &lt;code&gt;$variantRecord-&amp;gt;product&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when casting this variant record into a Model, using &lt;code&gt;VariantModel::populateModel&lt;/code&gt;, will the product also being retrieved be cast into the &lt;code&gt;model-&amp;gt;product (AttributeType::Mixed)&lt;/code&gt; of the variant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should we manually be manually assigning the -&gt;product attribute as casting it to a model with populate model like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$variant = Market_VariantRecord::model()-&amp;gt;with('product')-&amp;gt;findById($id);&#xA;$variantModel = Market_VariantModel::populateModel($variant);&#xA;$variantModel-&amp;gt;product = Market_ProductModel::populateModel($variant-&amp;gt;product);&#xA;return $variantModel;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems clunky and am looking for suggestions on improving the population of models from records with eager loading of relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one area &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-02-10T08:48:32.977" Title="populateModel usage with eager loading related records" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7078" PostTypeId="1" AcceptedAnswerId="7092" CreationDate="2015-02-10T07:43:37.737" Score="1" ViewCount="427" Body="&lt;p&gt;Hey I have a problem that i need to fix for a client. I have to send emails from different email addresses in different circumstances. Is it possible that I can setup multiple system email addresses and use one of them in my different plugins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to change the fromEmail attribute as well as the sender attribute on the email model but it still sends from the same email (which I thought would be the case ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway please let me know if there is any plugin out there that can do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-02-10T16:37:30.933" Title="Setup Multiple System Email Addresses" Tags="&lt;plugins&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7079" PostTypeId="2" ParentId="7077" CreationDate="2015-02-10T08:48:32.977" Score="2" Body="&lt;p&gt;Would like to know if this is the best solution? Upvote if you think it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is make your own custom populateModel method to catch the eager loaded attributes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @param array|Market_VariantRecord $values&#xA; *&#xA; * @return $this&#xA; */&#xA;public static function populateModel($values)&#xA;{&#xA;    $model = parent::populateModel($values);&#xA;    if (is_object($values) &amp;amp;&amp;amp; $values instanceof Market_ProductRecord) {&#xA;        $model-&amp;gt;product = $values-&amp;gt;product;&#xA;    }&#xA;&#xA;    return $model;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suppose the Craft core BaseModel could check if the value of type BaseRecord and do the same?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-02-10T08:48:32.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7080" PostTypeId="1" AcceptedAnswerId="7093" CreationDate="2015-02-10T10:17:32.467" Score="2" ViewCount="543" Body="&lt;p&gt;Is it possible to start a matrix loop from a particular block ID?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to set a new block called &quot;New Page&quot; so that an author can split an article into multiple pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently it's able to detect a page break and exit out of the block field loop. I have also identified the next block's ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set nextBlockAfterPageBreak = contentBlock.getNext().id %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I'd like to be able to do is to get all blocks from &lt;code&gt;nextBlockAfterPageBreak&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for contentBlock in matrixField where firstBlock = 237 %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know if this is possible?&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2015-02-10T17:31:05.900" Title="Start matrix loop from block ID" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7081" PostTypeId="2" ParentId="7080" CreationDate="2015-02-10T10:32:29.603" Score="2" Body="&lt;p&gt;I managed to solve this by using this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for contentBlock in matrixField.id('&amp;gt;=237') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality 237 is defined in a segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it occurred to me that the ID of the block isn't necessarily the order of the block within the Matrix - for example if I add a new block and that's given an ID of 200, and I drag it up - it still remains as 200.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ID != Position&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to resolve this I took advantage of &lt;code&gt;loop.index0&lt;/code&gt; to identify the true order of the row. I then wrap the switch statement within a conditional...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if loop.index0&amp;gt;=craft.request.getSegment(3) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can output only the rows after the page break.&lt;/p&gt;&#xA;" OwnerUserId="2284" LastEditorUserId="2284" LastEditDate="2015-02-10T10:48:44.463" LastActivityDate="2015-02-10T10:48:44.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7082" PostTypeId="2" ParentId="7078" CreationDate="2015-02-10T10:47:12.470" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster for Craft&lt;/a&gt; by ObjectiveHTML is a powerful notification plugin that can send emails based on a number of different criteria and triggers. It also has it's own API that you can access in your own plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start with Postmaster and see if can do what you want out of the box, then look at possibly exploiting the API if you need a more custom solution.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-02-10T10:47:12.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7083" PostTypeId="1" AcceptedAnswerId="7088" CreationDate="2015-02-10T10:48:20.830" Score="5" ViewCount="3742" Body="&lt;p&gt;I'm wondering if there's any equivalent to the Yii &quot;params&quot; array I can set on Twig code template level for re-use throughout all my templates using Twig syntax?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-02-10T14:20:08.203" Title="How can I create global code variables?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7084" PostTypeId="1" AcceptedAnswerId="9039" CreationDate="2015-02-10T12:12:36.437" Score="1" ViewCount="910" Body="&lt;p&gt;You can listen to &lt;code&gt;entries.onSaveEntry&lt;/code&gt; or &lt;code&gt;entries.onDeleteEntry&lt;/code&gt; events and then get or modify&#xA;the entry via &lt;code&gt;$event-&amp;gt;params['entry'];&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how would I get the entry element and its properties in the event that a user starts editing&#xA;an entry in the CP? I don't (necessarily) need to modify them, simple access is ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can see, there's no event available for this. And if I understand correctly,&#xA;only P&amp;amp;T can add such an &lt;code&gt;entries.onBeforeCpEditEntry&lt;/code&gt;&#xA;event (which would probably go into Entries Controller &lt;code&gt;actionEditEntry&lt;/code&gt; function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do entry edits using front-end forms this is easy, but not so from within the CP it seems.&#xA;Is there anything I overlooked, or is this simply not possible and maybe worth a feature request?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This question is related to this one: &lt;a href=&quot;https://craftcms.stackexchange.com/q/4113/125&quot;&gt;&quot;How to reference the current entry element in custom Control Panel templates?&quot;&lt;/a&gt;&#xA;but it's not quite the same. The solutions / workarounds I posted below have some drawbacks, so &lt;strong&gt;I'm still looking for a better solution!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2018-10-16T11:44:55.547" Title="Get the current entry element in the CP (edit entry view)?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;entry&gt;&lt;entrymodel&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7085" PostTypeId="2" ParentId="7084" CreationDate="2015-02-10T12:12:36.437" Score="1" Body="&lt;p&gt;Depending on what you're trying to acchieve, you could do certain things with Javascript.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var entrySection = $(&quot;#crumbs&quot;).find(&quot;li:last&quot;).text();&#xA;var entryEnabled = $(&quot;#enabled-field&quot;).find(&quot;.lightswitch&quot;).hasClass(&quot;on&quot;);&#xA;&#xA;// do stuff...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure to only parse the DOM for CP views (use &lt;code&gt;craft()-&amp;gt;request-&amp;gt;isCpRequest()&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-10T12:12:36.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7086" PostTypeId="2" ParentId="7084" CreationDate="2015-02-10T12:13:39.363" Score="1" Body="&lt;p&gt;Another workaround would be to add a hidden Field Type with your plugin, a field&#xA;that does not show in the CP's entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry element is available in a Field Type via &lt;code&gt;$this-&amp;gt;element&lt;/code&gt;&#xA;(→ &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types#accessing-contextual-data&quot; rel=&quot;nofollow&quot;&gt;&quot;Field Types: Accessing Contextual Data&quot;&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just make sure to add this field to all sections you need your plugin to work with!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Workaround to get the entry element in the CP&#xA; * Misuse of `getInputHtml`, make it return nothing.&#xA; *&#xA; * @param string $name&#xA; * @param mixed $value&#xA; *&#xA; * @return null&#xA; */&#xA;public function getInputHtml($name, $value)&#xA;{&#xA;    if ($this-&amp;gt;element &amp;amp;&amp;amp; $this-&amp;gt;element-&amp;gt;getElementType() == ElementType::Entry)&#xA;    {&#xA;        $entrySection = $this-&amp;gt;element-&amp;gt;getSection()-&amp;gt;handle;&#xA;        $entryEnabled = $this-&amp;gt;element-&amp;gt;getStatus() != EntryModel::DISABLED;&#xA;&#xA;        // do stuff...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-10T16:50:27.497" LastActivityDate="2015-02-10T16:50:27.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7087" PostTypeId="1" AcceptedAnswerId="7089" CreationDate="2015-02-10T13:50:42.340" Score="1" ViewCount="62" Body="&lt;p&gt;The project I was working on was put on hold a few months back. Back then I was on version 2.1.2570. Now the project is back on. After having gone through the pain of manually restoring the InnoDB tablespaces because I switched development systems in the meanwhile and didn't bother to do a proper mysqldump, I'm now facing the task of upgrading Craft from 2.1.2570 to the latest revision. It fails while updating the database. Is there any place where I can download older releases (i.e. 2.2.2579) to see if they come through?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="457" LastActivityDate="2015-02-10T14:38:45.637" Title="upgrading from 2.1 to 2.3" Tags="&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7088" PostTypeId="2" ParentId="7083" CreationDate="2015-02-10T14:20:08.203" Score="13" Body="&lt;p&gt;Besides saving the variable in a field (e.g. global set) you could also add a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;noreferrer&quot;&gt;&quot;Environment Variable&quot;&lt;/a&gt; to&#xA;your general.php file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'myGlobalVariable' =&amp;gt; 'I am available in all environments'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but you can &lt;strong&gt;only access it&lt;/strong&gt; from Twig, it's not possible to update it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.config.myGlobalVariable }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do need to &lt;strong&gt;update from  your Twig templates&lt;/strong&gt;, you should make a custom plugin / add to your Business Logic plugin.&#xA;There's various options to make a variable available in your Twig templates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;add a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;&quot;Template Variable&quot;&lt;/a&gt; to the &lt;code&gt;{{ craft }}&lt;/code&gt; global variable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or with a Twig Extention:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;add a new &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables&quot; rel=&quot;noreferrer&quot;&gt;Global Variable&lt;/a&gt; using &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/templating/twigextensions/CraftTwigExtension#getGlobals-detail&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;getGlobals()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;add a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#functions&quot; rel=&quot;noreferrer&quot;&gt;Twig function&lt;/a&gt; with &lt;code&gt;new Twig_SimpleFunction()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With a plugin you have these options to save your value (and update with a custom Twig function):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;noreferrer&quot;&gt;Record&lt;/a&gt;, update with &lt;code&gt;$record-&amp;gt;save()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;directly in the plugin settings, update with &lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;savePluginSettings()&lt;/code&gt; (→ &lt;a href=&quot;https://craftcms.stackexchange.com/a/338/125&quot;&gt;read more on SE&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;with a config.php file in the plugin folder, not possible to update with Twig (→ &lt;a href=&quot;https://craftcms.stackexchange.com/a/2000/125&quot;&gt;read more on SE&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;hard code it into the plugin PHP ;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-10T14:20:08.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7089" PostTypeId="2" ParentId="7087" CreationDate="2015-02-10T14:38:45.637" Score="3" Body="&lt;p&gt;Sure, have a look at the Craft site for details about downloading a specifc build of Craft:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/download-previous-versions&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/download-previous-versions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to download 2.2.2579, the URL will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://download.buildwithcraft.com/craft/2.2/2.2.2579/Craft-2.2.2579.zip&quot; rel=&quot;nofollow&quot;&gt;http://download.buildwithcraft.com/craft/2.2/2.2.2579/Craft-2.2.2579.zip&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-02-10T14:38:45.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7090" PostTypeId="2" ParentId="5230" CreationDate="2015-02-10T15:16:03.613" Score="4" Body="&lt;p&gt;I've found that this happens when you end a line or string with a space and put nothing after it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Text &quot;&lt;br&gt; becomes &quot;Text&amp;nbsp;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then copy &quot;Text &quot; and paste it repeatedly you'd end up with &quot;Text&amp;nbsp;Text&amp;nbsp;Text&amp;nbsp;Text&amp;nbsp;Text&amp;nbsp;Text&amp;nbsp;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for a lone space on a line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot; &quot;&lt;br&gt; becomes &quot;;nbsp&quot;&lt;/p&gt;&#xA;" OwnerUserId="2289" LastActivityDate="2015-02-10T15:16:03.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7091" PostTypeId="1" CreationDate="2015-02-10T16:35:45.323" Score="3" ViewCount="1247" Body="&lt;p&gt;We're just looking at potentially using Craft as a CMS to serve up content to a mobile apple/android app. Ideally content would be delivered as JSON and there be some sort of authentication from the app side (like an api key) as some of the content isn't intended to be publicly accessible. Can craft do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="2290" LastActivityDate="2018-04-09T09:10:07.053" Title="Craft as a CMS for mobile app content" Tags="&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7092" PostTypeId="2" ParentId="7078" CreationDate="2015-02-10T16:37:30.933" Score="3" Body="&lt;p&gt;Out of the box, Craft doesn't support sending with multiple email addresses unless you change the email settings each time you need to send from the respective email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does allow plugins to do this though. I know of two to consider, and present them in alphabetical order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster&lt;/a&gt; - Objective HTML&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow&quot;&gt;Sprout Email&lt;/a&gt; - Barrel Strength Design&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-10T16:37:30.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7093" PostTypeId="2" ParentId="7080" CreationDate="2015-02-10T17:31:05.900" Score="4" Body="&lt;p&gt;&lt;code&gt;offset&lt;/code&gt; works for matrix blocks the same way it does for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#offset&quot; rel=&quot;nofollow&quot;&gt;entries&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can do this to skip the first 12&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# skip the first 12 blocks #}&#xA;{% for contentBlock in matrixField.offset(12) %}&#xA;  ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-02-10T17:31:05.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7094" PostTypeId="1" CreationDate="2015-02-10T17:33:35.093" Score="3" ViewCount="186" Body="&lt;p&gt;Is it possible to use the Entries FieldType widget in my plugin and populate the modal with data from a third party REST API? &lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-02-10T19:54:01.187" LastActivityDate="2018-12-11T16:48:40.770" Title="Use Entries fieldtype functionality in plugin populated by REST api data" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7095" PostTypeId="2" ParentId="7091" CreationDate="2015-02-10T18:22:45.670" Score="4" Body="&lt;p&gt;This is most likely possible by serving up restful resources that refer to Craft data with some sort of PHP API that you'll need to write. The APIs you write will just need to grab data using &lt;a href=&quot;http://buildwithcraft.com/classreference&quot; rel=&quot;nofollow&quot;&gt;Craft's API&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for hiding certain content for mobile (or whatever frontend platform), I'd create a Lightswitch field for section that you can use to signify content that is &quot;mobile only&quot; or whatever you'd like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW - your API doesn't even necessarily need to be in PHP - You can probably use AngularJS or some other JS server-side framework and use Twig templating. Someone correct me if I'm wrong about that... The great thing about Craft CMS is it's frontend-agnostic&lt;/p&gt;&#xA;" OwnerUserId="2243" LastEditorUserId="2243" LastEditDate="2015-02-10T18:35:26.000" LastActivityDate="2015-02-10T18:35:26.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7096" PostTypeId="1" AcceptedAnswerId="8307" CreationDate="2015-02-10T19:27:05.603" Score="3" ViewCount="477" Body="&lt;p&gt;Why would the &lt;code&gt;{% cache %}&lt;/code&gt; tag be storing a new cache every time the page loads (instead of just loading the existing cache)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless I'm misunderstanding how caching works, the system should never record duplicate cache keys, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9DVJk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite the data apparently getting cached, the page never feels like it's pulling from cache. Every page load feels long and sluggish.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done some additional testing, and was able to get the caching to perform as expected. Here's what changed...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my original version, I was caching a giant chunk of the template. This included the large database query (100+ records with 100+ fields), some Twig-side data manipulation, and the entire HTML portion of the template. Within the HTML, I am looping through those records and rendering a chunk of HTML for each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the new version, I am &lt;strong&gt;only caching the HTML loop.&lt;/strong&gt; This is making a huge difference, bringing the page load time from ~15 seconds to ~1 second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I've found...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that the offending line which was causing multiple cache keys to be generated is this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').type('myType').limit(null).find %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I still don't know why, and would appreciate an explanation if anyone knows!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-02-10T20:06:10.263" LastActivityDate="2015-11-20T19:14:21.020" Title="{% cache %} always creates new cache data, never uses existing cached data" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7097" PostTypeId="1" AcceptedAnswerId="7098" CreationDate="2015-02-10T19:55:56.930" Score="1" ViewCount="275" Body="&lt;p&gt;I need to output different HTML for children of navigation. When i use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages') %}&#xA;&#xA;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li class=&quot;whatever&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It outputs my children having class=&quot;whatever&quot; as well. I don't want that, i need something else for the children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw the post here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1733/custom-or-complex-nav-tag&quot;&gt;Custom or complex nav tag&lt;/a&gt; about using LEVEL however i don't quite understand how i would write the code for that. Could anybody help? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-23T06:45:56.420" Title="Complex Navigation" Tags="&lt;navigation&gt;&lt;children&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7098" PostTypeId="2" ParentId="7097" CreationDate="2015-02-10T20:21:30.643" Score="5" Body="&lt;p&gt;I think you need to set a conditional for the entry level for the parent, which is &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages') %}&#xA;&#xA;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li{% if entry.level == 1 %} class=&quot;whatever&quot;{% endif %}&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastActivityDate="2015-02-10T20:21:30.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7099" PostTypeId="2" ParentId="7094" CreationDate="2015-02-10T20:52:42.290" Score="3" Body="&lt;p&gt;You are speaking of the Element Selector Modal. It is javascript and available to use by third-party devs, but the code is specific to Craft Elements (Entries, Assets, Users, etc.). I don't think you'll get it to work with information polled from a third-party API. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a post about it in the Craft Dev Google+ group (invite only), but I'm not sure if the info exists anywhere else.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-02-10T20:52:42.290" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7100" PostTypeId="1" CreationDate="2015-02-10T21:07:44.257" Score="1" ViewCount="496" Body="&lt;p&gt;I'm currently creating a plugin for craft and have stumbled across a slight problem. I'll try summarise of what I am doing and what I am trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm trying creating a plugin which will update entries within craft via an external API. I have managed to get the initial save to work using these following lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = $project-&amp;gt;name;&#xA;$entry-&amp;gt;sectionId = 10;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The issue arises when I'm trying to update the model. Obviously, I don't want to duplicate entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the entry using this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EntryRecord::model()-&amp;gt;findById(45);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(this is just used for testing, eventually I will be getting the record via a custom variable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do here is update the title of this record, from what I can see this is stored in the craft_content table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what I'd like to do is something like :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EntryModel::model()-&amp;gt;findByAttributes(array('title'=&amp;gt;$project-&amp;gt;name);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I can then update the content title of that row.&#xA;I can see I can't do it this way, would you be able point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="2291" LastEditorUserId="2243" LastEditDate="2015-02-10T21:59:52.910" LastActivityDate="2015-02-11T02:04:31.060" Title="Finding entry by content" Tags="&lt;database&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7101" PostTypeId="1" CreationDate="2015-02-10T21:16:32.907" Score="3" ViewCount="1069" Body="&lt;p&gt;I would've thought this would be core functionality, but does it require additional plugin functionality?&lt;/p&gt;&#xA;" OwnerUserId="2292" LastEditorUserId="344" LastEditDate="2015-05-01T10:36:31.717" LastActivityDate="2015-05-01T10:36:31.717" Title="Can admin receive email notifications of new user registrations?" Tags="&lt;registration&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7102" PostTypeId="2" ParentId="7101" CreationDate="2015-02-10T21:50:27.627" Score="2" Body="&lt;p&gt;It's not perfect, but maybe a workaround until it's core or available as a plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add to the config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'testToEmailAddress' =&amp;gt; 'me@example.com',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(via &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#testToEmailAddress&quot; rel=&quot;nofollow noreferrer&quot;&gt;config-settings#testToEmailAddress&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, I'd set up a new email account to catch those and also a filter, but that's just me. Again, it's not optimal I realize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/users/784/douglas-mcdonald&quot; title=&quot;Douglas&quot;&gt;Douglas&lt;/a&gt; mentioned in the comments, this really won't work, since it is designed to route ALL emails to the 'testToEmailAddress'. However, &lt;a href=&quot;https://craftcms.stackexchange.com/a/7105/2243&quot;&gt;his own answer is a much better idea&lt;/a&gt;, so vote that up.&lt;/p&gt;&#xA;" OwnerUserId="2243" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-11T00:03:22.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7104" PostTypeId="1" AcceptedAnswerId="7106" CreationDate="2015-02-10T22:43:25.790" Score="7" ViewCount="2786" Body="&lt;p&gt;I want to add an &quot;Edit entry&quot; button on each page for admin users. Am I overlooking a simple way to output the Edit link to the CP edit page for the current entry? Curious if there is something like &lt;code&gt;{{ entry.editLink }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="57" LastEditDate="2016-05-26T04:44:08.010" LastActivityDate="2019-03-30T10:54:43.510" Title="Get Entry Edit Link in Twig" Tags="&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7105" PostTypeId="2" ParentId="7101" CreationDate="2015-02-10T23:07:41.633" Score="6" Body="&lt;p&gt;I believe you would need a plugin for this — but the plugin can be really basic. In your plugin's main file simply add an 'init' method that listens to the 'users.saverUser' event and checks the 'isNewUser' event attribute; then prepare and send your email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process is outlined in this answer that &lt;a href=&quot;https://craftcms.stackexchange.com/a/375/784&quot;&gt;sends out an email to members of a userGroup when an entry is saved&lt;/a&gt;. Same principle would apply, just using &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;users.saveUser&lt;/a&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event)&#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        $isNewUser = $event-&amp;gt;params['isNewUser'];&#xA;&#xA;        if ($isNewUser) {&#xA;            // Send Mail&#xA;            $email = new EmailModel();&#xA;            $email-&amp;gt;toEmail = &quot;user@email.com;&#xA;            $email-&amp;gt;subject = 'New User Registration';&#xA;            $email-&amp;gt;body    = 'New User: '.$user-&amp;gt;firstName.' '.$user-&amp;gt;lastName;&#xA;&#xA;            craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-10T23:16:10.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7106" PostTypeId="2" ParentId="7104" CreationDate="2015-02-10T23:28:59.397" Score="20" Body="&lt;p&gt;There is! It's called &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel#cpEditUrl-detail&quot; rel=&quot;noreferrer&quot;&gt;cpEditUrl&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;   {% if currentUser.isInGroup('admin') %}&#xA;       &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&#xA;   {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or shorter (thanks to MISC):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.admin %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or forget user group altogether (thanks to Phil Gyford and bennobo):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.isEditable() %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-05-27T16:49:17.163" LastActivityDate="2016-05-27T16:49:17.163" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7107" PostTypeId="2" ParentId="7100" CreationDate="2015-02-11T01:08:24.907" Score="2" Body="&lt;p&gt;It sort of depends on what information you have to identify the entry. If your external service knows the entry id that would be the most direct — otherwise you would have to find the entry by some other unique property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To update an entry (given $entryId, $newTitle):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;if ($entry) {&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'title' =&amp;gt; $newTitle&#xA;    ));&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To update an entry (given $sectionHandle, $title, and $newTitle - or other unique property):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = $sectionHandle;&#xA;$criteria-&amp;gt;title = $title;&#xA;$entries = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&#xA;foreach ($entries as $entry) {&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'title' =&amp;gt; $newTitle&#xA;    ));&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could also use the 'search' method (although less reliable):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;search = 'fieldHandle:searchstring';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the last two cases, would need to handle the possibility that more than 1 entry is returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when creating entries might want to include the authorId and typeId, in addition to sectionId:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId  = $sectionId&#xA;$entry-&amp;gt;typeId     = $typeId&#xA;$entry-&amp;gt;authorId   = $authorId;&#xA;$entry-&amp;gt;enabled    = true;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'title' =&amp;gt; $title&#xA;));&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-11T02:04:31.060" LastActivityDate="2015-02-11T02:04:31.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7108" PostTypeId="2" ParentId="6777" CreationDate="2015-02-11T10:58:48.137" Score="2" Body="&lt;p&gt;I realized the image that I was trying to upload had issues. So, my code was working. Image upload had issues and there were no errors to tell you that. But we're good now. Thanks&lt;/p&gt;&#xA;" OwnerUserId="2218" LastActivityDate="2015-02-11T10:58:48.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7109" PostTypeId="1" CreationDate="2015-02-11T11:00:58.817" Score="2" ViewCount="323" Body="&lt;p&gt;I want to be able to display Top Authors based on their entry counts. Has anyone ever tried doing this?&lt;/p&gt;&#xA;" OwnerUserId="2218" LastEditorUserId="125" LastEditDate="2015-02-11T14:01:38.233" LastActivityDate="2015-02-11T19:30:56.247" Title="Get the Top Authors based on entry counts?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;users&gt;&lt;author&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7110" PostTypeId="1" CreationDate="2015-02-11T12:16:29.150" Score="2" ViewCount="241" Body="&lt;p&gt;I'm looking into the possibility of using Foxycart for a multilingual, multi currency site. Currently it is not possible to have multiple currencies in Foxycart so it would require having separate Foxycart accounts for each currency. I would therefore need to store the cart url and api keys for each Foxycart account within the foxycart plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way of going about this? Is it possible to store different plugin setting based on locale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other idea I had was to store the api key etc in the config file but not sure if that is best practice or not.&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-02-11T19:08:43.080" Title="Is it possible to have different plugin settings per locale?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7111" PostTypeId="1" CreationDate="2015-02-11T12:30:09.007" Score="2" ViewCount="1192" Body="&lt;p&gt;I have created an entry that requires users to be logged into to see it. This was just a minor request from our client and we didn't want to spend a lot of time setting up login forms etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I have just added &lt;code&gt;{% requireLogin %}&lt;/code&gt; to the top of the entry's Twig file. This works great, so far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem comes however when a user visits the URL for that page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.foo.com/lorem&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are re-directed to the Craft login, as expected, but once they successfully login, instead of being re-directed back to the page, they are instead taken to the Craft admin dashboard, with the pages' slug at the end. So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.foo.com/admin/lorem&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed some light as to what is going on here? How can I make it so once users are loged in, they are re-directed back to the page? I've seen Craft has a &lt;code&gt;postLoginRedirect&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#postLoginRedirect&quot; rel=&quot;nofollow&quot;&gt;config&lt;/a&gt;, but I'm guessing this can't be set on a per-page basis.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-02-11T15:36:38.197" Title="Re-directing to front-end after login" Tags="&lt;redirect&gt;&lt;login&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7112" PostTypeId="1" AcceptedAnswerId="7113" CreationDate="2015-02-11T12:36:27.297" Score="1" ViewCount="788" Body="&lt;p&gt;I have a 'Profile' channel that gives the profile of people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 'Last name' as the title, 'first name' and I'd like to use first name in the slug rather than have to add the first name to the title and then need to create another field to store the last name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought, similar to {entry.type} I could've gone for {entry.firstName} but that doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-02-11T15:07:27.517" Title="customised slugs using custom field" Tags="&lt;url&gt;&lt;slug&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7113" PostTypeId="2" ParentId="7112" CreationDate="2015-02-11T12:43:29.990" Score="3" Body="&lt;p&gt;Firstly I'd recommend splitting the first name and last name into seperate fields. That way in your templates it would look nicer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ member.firstNameField }} {{ member.lastNameField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;than having:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ member.firstNameField }} {{ member.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when outputting their names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have done that, in your entry type settings you can set the entry title to run off these first name and last name fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{firstNameField} {lastNameField}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The slug will be automatically generated from this as well. I may have mis-understood your question, but I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-02-11T15:07:27.517" LastActivityDate="2015-02-11T15:07:27.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7114" PostTypeId="2" ParentId="7109" CreationDate="2015-02-11T13:34:44.087" Score="3" Body="&lt;p&gt;Here's how I did something similar, now edited the code for you to work with users. The better approach would be to do this with a plugin, because, as you can imagine, the only way doing this with Twig will end up in lots of DB queries, so please make sure to use the &lt;code&gt;cache&lt;/code&gt; tag with this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Build an associative array of user IDs to the count of related entries #}&#xA;{% set userData = [] %}&#xA;&#xA;{# Go through all users #}&#xA;{% for user in craft.users %}&#xA;&#xA;    {# Get total number of entries this user is the author of #}&#xA;    {% set count = craft.entries.authorId(user.id).total() %}&#xA;&#xA;    {# Save entries count and ALL user data we gonna use to our array #}&#xA;    {% set userData = userData|merge([{ entriesCount: count, userId: user.id, userName: user.name }]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Sort, reverse-sort and pick top 10 elements of the array #}&#xA;{% set userData = userData|sort|reverse|slice(0, 10) %}&#xA;&#xA;{# Print the top 10 list #}&#xA;{% for element in userData %}&#xA;    &amp;lt;li&amp;gt;{{ element.userName }} ({{ element.entriesCount }} entries)&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-11T13:58:21.007" LastActivityDate="2015-02-11T13:58:21.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7115" PostTypeId="2" ParentId="7111" CreationDate="2015-02-11T15:36:38.197" Score="2" Body="&lt;p&gt;As far as I understand it, the &lt;code&gt;postLoginRedirect&lt;/code&gt; only affects login forms defined on the the front-end. If a user visits the login page (through a 'login' link for example), then they will be redirected to 'postLoginRedirect' after logging in. They will also be redirected there if they attempt to visit the login form directly when already logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best option is to just create a quick login page template, like &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;the one provided in the docs&lt;/a&gt;. Craft will automatically look for 'login.html' in your templates folder - otherwise you can specify the location using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#loginPath&quot; rel=&quot;nofollow&quot;&gt;loginPath&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that defined, if a user tries to visit any page that has {{ loginRequired }} specified, they will automatically get redirected to the login page and subsequently be redirected back to the original page request after login.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-11T15:36:38.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7116" PostTypeId="1" AcceptedAnswerId="7119" CreationDate="2015-02-11T16:25:12.210" Score="1" ViewCount="897" Body="&lt;p&gt;I have a section of events and am trying to automatically set a readable title on the event entry in the CMS ( such as Jan 5 - 12, 2015 or Jan 5, 2013 - Jan 10, 2016 ). I realize I can do this via a Dynamic Title on the entry type, however my twig logic gets cut off, it seems it won't fit in the allowed character limit (220 ?). My twig code looks like:        &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set start = object.startDate %}&#xA;  {% set end = object.endDate %}&#xA;&#xA;  {{start|date('F j')}}&#xA;  {% if end %}&#xA;    {% if start|date('Y') == end|date('Y') %}&#xA;      {% if start|date('F') == end|date('F') %}&#xA;         – {{end|date('j, Y')}}&#xA;      {% else %}&#xA;        – {{end|date('F j, Y')}}&#xA;      {% endif %}&#xA;    {% else %}&#xA;      {{start|date(', Y')}} – {{end|date('F j, Y')}}&#xA;    {% endif %}&#xA;  {% else %}&#xA;    {{ start|date(', Y') }}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have made numerous attempts at shortening this to fit in the character limit, below is my best attempt:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set s,e = object.startDate,object.endDate %}{{s|date('F j')}}{% if e %}{% if s|date('Y')==e|date('Y') %}{% if s|date('F')==e|date('F') %}–{{e|date('j, Y')}}{% else %} – {{e|date('F j, Y')}}{% endif %}{% else %}{{s|date(', Y')}} – {{e|date('F j, Y')}}{% endif %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's still getting cut off. Perhaps there is an easy solution for this via some Twig magic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then moved to try to do this within a plugin. I put this in my main plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;  {&#xA;      craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event)&#xA;      {&#xA;          $entry = $event-&amp;gt;params['entry'];&#xA;          if($entry-&amp;gt;section['handle'] == 'dates')&#xA;          {&#xA;             $start = $entry-&amp;gt;startDate;&#xA;             $end = $entry-&amp;gt;endDate;&#xA;             $fullTitle = $start . &quot; - &quot; . $end; &#xA;             $entry-&amp;gt;setContentFromPost(array(&#xA;               'title' =&amp;gt; $fullTitle,&#xA;             ));&#xA;          }&#xA;      });&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am fairly certain this code is running on save, however my title isn't updating. Any idea what I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have turned off dynamic titles for this section in the entry settings to ensure that wasn't interfering.&lt;/p&gt;&#xA;" OwnerUserId="2273" LastActivityDate="2015-02-11T18:03:33.097" Title="How to set a dynamic title in plugin on entry save?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7117" PostTypeId="1" AcceptedAnswerId="7120" CreationDate="2015-02-11T16:43:47.347" Score="2" ViewCount="869" Body="&lt;p&gt;I'm just coming over to Craft from Other CMSes Which Shall Not Be Named. Something I typically do for clients is create custom videos showing how to use the CMS. Now that I'm diving into Craft I'm thinking about creating a general Editor's Guide to show all the nice features of this lovely CMS. (realizing that Craft will be customized to each site's needs)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked around and haven't yet found any similar attempt at showing Craft from an editor's perspective. Do you know of one?&lt;/p&gt;&#xA;" OwnerUserId="2285" LastActivityDate="2015-02-11T16:56:30.463" Title="Does a Craft Editor's Guide exist?" Tags="&lt;editor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7118" PostTypeId="2" ParentId="7117" CreationDate="2015-02-11T16:51:09.860" Score="2" Body="&lt;p&gt;The Features section on the Craft site already has some useful videos that may be of interest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://buildwithcraft.com/features/matrix&quot; rel=&quot;nofollow&quot;&gt;https://buildwithcraft.com/features/matrix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-02-11T16:51:09.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7119" PostTypeId="2" ParentId="7116" CreationDate="2015-02-11T16:54:50.370" Score="1" Body="&lt;p&gt;To get more code into the template field that generates the title I tried importing a macro, but this didn't work. So squeezing it into the 255 chars is probably our only chance here. So it would be in fact better to do it with plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get your plugin code working you should use &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt; instead of &lt;code&gt;entries.onSaveEntry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because when this event is triggered, it's already too late to update &lt;code&gt;$event-&amp;gt;params['entry']&lt;/code&gt; properties for your save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to change is &lt;code&gt;setContentFromPost()&lt;/code&gt;. Change the ContentModel directly&lt;br&gt;&#xA;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;title = $fullTitle;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-11T18:03:33.097" LastActivityDate="2015-02-11T18:03:33.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7120" PostTypeId="2" ParentId="7117" CreationDate="2015-02-11T16:56:30.463" Score="2" Body="&lt;p&gt;If you're looking for professional-grade videos showing off what Craft can do, then &lt;a href=&quot;https://craftcms.stackexchange.com/a/7118/45&quot;&gt;Jamie has already pointed you in the right direction...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to add your own content to help your clients find their way through the construction of your particular project, check out the awesome &lt;a href=&quot;https://github.com/70kft/craft-help&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Help plugin&lt;/a&gt;, which allows you to document the details of how moderate that unique site.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-11T16:56:30.463" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7121" PostTypeId="2" ParentId="7110" CreationDate="2015-02-11T16:57:00.170" Score="2" Body="&lt;p&gt;I haven't used foxycart plugin, but looking at the '&lt;a href=&quot;https://github.com/FoxyCart/foxycart-craft/blob/master/foxycart/templates/_settings.html&quot; rel=&quot;nofollow&quot;&gt;_settings.html&lt;/a&gt;' file, it looks like it stores both the 'storedomain' and 'apikey' as part of the plugin settings. I would suspect that you would need to fork the plugin and modify it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could possibly add additional settings to the plugin for the different domains (i.e. storedomain-en, storedomain-es, apikey-en, apikey-es), and then add some logic in the plugins main 'init' method to pick up the different settings based on the current locale.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('foxycart')-&amp;gt;getSettings();&#xA;\FoxyCart_Helper::setSecret($settings['apikey-'.craft()-&amp;gt;language]);&#xA;\FoxyCart_Helper::setCartUrl(&quot;https://&quot; . $settings['storedomain-'.craft()-&amp;gt;language] . &quot;/cart&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, you could set the 'storedomain' and 'apikey' in your multi-environment config array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array( &#xA;    '*' =&amp;gt; array(&#xA;        'storedomain' =&amp;gt; array(&#xA;            'en' =&amp;gt; cart.en.domain.com,&#xA;            'es' =&amp;gt; cart.es.domain.com',&#xA;        ),&#xA;        'apikey' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',&#xA;            'es' =&amp;gt; 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY',&#xA;        ),&#xA;    ),&#xA;    ...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then retrieve them using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('foxycart')-&amp;gt;getSettings();&#xA;$storedomain = craft()-&amp;gt;config-&amp;gt;get('storedomain');&#xA;$apikey = craft()-&amp;gt;config-&amp;gt;get('apikey');&#xA;\FoxyCart_Helper::setSecret($apikey[craft()-&amp;gt;language]);&#xA;\FoxyCart_Helper::setCartUrl(&quot;https://&quot; . $storedomain[craft()-&amp;gt;language] . &quot;/cart&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would probably also need to go and modify some the variable methods to return the localized versions, so that when you asked for 'storedomain', it returned the correct value. I.e. :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;https://{{ craft.foxyCart.storedomain }}/cart&quot; method=&quot;post&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no idea what other integration points the foxycart plugin has with craft however. If it attempts to sync data in any way with foxycart, it might not like switching accounts like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall this sounds pretty messy. I would proceed with caution.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-11T19:08:43.080" LastActivityDate="2015-02-11T19:08:43.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7122" PostTypeId="1" AcceptedAnswerId="7126" CreationDate="2015-02-11T18:35:07.210" Score="1" ViewCount="246" Body="&lt;p&gt;Is it possible to have Craft plugins in subfolders of craft/plugin/ instead of having them right in that folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that I can have a parent directory that is my git repository craft/plugin/mypluginrepo/ containing a README.md and other files and folders besides the actual plugin craft/plugin/mypluginrepo/myplugin/.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can change the plugins path via the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-plugins-path&quot; rel=&quot;nofollow&quot;&gt;PHP Constant&lt;/a&gt;:&lt;br&gt;&#xA;&lt;code&gt;define('CRAFT_PLUGINS_PATH', '../craft/plugins/subfolder/');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unfortunately this only allows me to set one folder.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-11T20:48:23.253" LastActivityDate="2015-02-11T20:54:31.600" Title="Plugin in subfolder for github?" Tags="&lt;plugin-development&gt;&lt;git&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7123" PostTypeId="2" ParentId="7109" CreationDate="2015-02-11T18:38:39.420" Score="3" Body="&lt;p&gt;A plugin approach might be to create a method in your variables file that queries the database directly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function usersByPostCount($limit = '10')&#xA;{&#xA;    $query = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;    $users = $query&#xA;        -&amp;gt;select('craft_entries.authorId id, COUNT(*) count')&#xA;        -&amp;gt;from('entries')&#xA;        -&amp;gt;group('craft_entries.authorId')&#xA;        -&amp;gt;order('count DESC')&#xA;        -&amp;gt;limit($limit)&#xA;        -&amp;gt;queryAll();&#xA;    return $users;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which will return an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array: [{&quot;id&quot;:&quot;4&quot;,&quot;count&quot;:&quot;241&quot;},{&quot;id&quot;:&quot;24&quot;,&quot;count&quot;:&quot;2&quot;},{&quot;id&quot;:&quot;171&quot;,&quot;count&quot;:&quot;2&quot;},{&quot;id&quot;:null,&quot;count&quot;:&quot;1&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that can be accessed using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% set usersByPostCount = craft.myPlugin.usersByPostCount(5) %}&#xA;    {% for data in usersByPostCount %}&#xA;        {% if data.id %}&#xA;            {% set user = craft.users.id(data.id).first %}&#xA;            {% set postCount = data.count %}&#xA;            &amp;lt;li&amp;gt;{{ user.firstName }} {{ user.lastName }} [{{ postCount }}]&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: this only returns users that are the author of at least one entry. In order to get all users you would need to join the users table into the query.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="125" LastEditDate="2015-02-11T19:30:56.247" LastActivityDate="2015-02-11T19:30:56.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7124" PostTypeId="1" CreationDate="2015-02-11T20:14:56.900" Score="7" ViewCount="443" Body="&lt;p&gt;We have a plugin with custom Element Types that allows a user to create a field layout using custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We understand how to setup a localized site and add translation files.  This question is specifically about how to add support for the user to be able to add content in multiple languages via the custom fields as they add new Entries to a Custom Element Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be nice to see a list of all the steps we need to consider.  Ideally, the answer could double as the page we would have read in the documentation instead of posting this question =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, these are the tables that appear to have a &lt;code&gt;locale&lt;/code&gt; column in the default Craft database.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_categorygroups_i18n&lt;/li&gt;&#xA;&lt;li&gt;craft_content&lt;/li&gt;&#xA;&lt;li&gt;craft_elements_i18n&lt;/li&gt;&#xA;&lt;li&gt;craft_entrydrafts&lt;/li&gt;&#xA;&lt;li&gt;craft_entryversions&lt;/li&gt;&#xA;&lt;li&gt;craft_locales&lt;/li&gt;&#xA;&lt;li&gt;craft_matrixblocks (ownerLocale)&lt;/li&gt;&#xA;&lt;li&gt;craft_matrixcontent_body (and any other Matrix field's content table)&lt;/li&gt;&#xA;&lt;li&gt;craft_routes&lt;/li&gt;&#xA;&lt;li&gt;craft_searchindex&lt;/li&gt;&#xA;&lt;li&gt;craft_sections_i18n&lt;/li&gt;&#xA;&lt;li&gt;craft_templatecaches&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-04-06T07:44:18.057" LastActivityDate="2016-09-02T00:31:29.557" Title="How do you add support to manage content in multiple languages in a plugin with a custom Element Type?" Tags="&lt;localization&gt;&lt;elementtype&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7125" PostTypeId="2" ParentId="7064" CreationDate="2015-02-11T20:29:21.117" Score="2" Body="&lt;p&gt;Turns out this was a bug in Craft that's been fixed for the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2629&quot; rel=&quot;nofollow&quot;&gt;post 2.3.2629&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-11T20:29:21.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7126" PostTypeId="2" ParentId="7122" CreationDate="2015-02-11T20:54:31.600" Score="1" Body="&lt;p&gt;I don't think it's currently possible.  There are several places where we're explicitly checking for the plugin's handle as a &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/PluginsService.php#L684&quot; rel=&quot;nofollow&quot;&gt;folder directly underneath&lt;/a&gt; whatever &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/PathService.php#L54&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;path-&gt;getPluginsPath()&lt;/a&gt; is returning.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-11T20:54:31.600" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7127" PostTypeId="1" CreationDate="2015-02-11T22:07:35.687" Score="6" ViewCount="585" Body="&lt;p&gt;I've been trying to follow the docs for creating a plugin migration (&lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/migrations&lt;/a&gt;) but any attempts to run yiic seem to die with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbConnection failed to open the DB connection.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Google-fu has not come up with any relevant answers. This is with Craft setup in a Vagrant box, if that makes a difference. &lt;/p&gt;&#xA;" OwnerUserId="1043" LastEditorUserId="3951" LastEditDate="2017-10-26T10:12:15.170" LastActivityDate="2017-10-26T10:12:15.170" Title="Using Yiic for plugin migration" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7128" PostTypeId="1" CreationDate="2015-02-11T22:46:54.227" Score="5" ViewCount="122" Body="&lt;p&gt;I want to use the standard site search but much prefer that (first) part word search is in place by default. By this I mean if a user searches for dog they will also find dogs, so the term Craft uses would then be dog*.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My strategy would then be to take the search string (e.g. 'dog fee') and remove any commas or fullstops unless the string is in quotes (&quot;dog fee&quot;). I would then split the string using spaces and throw away any empty strings ('dog', 'fee'), and then append the * to each word and send 'dog* fee*' to the search system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the best approach to get what I want, or have I missed a glaringly obvious and easy way of doing it?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-08-15T16:07:42.687" Title="Best way to effect part word searching by default" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7129" PostTypeId="2" ParentId="7127" CreationDate="2015-02-12T00:01:58.000" Score="2" Body="&lt;p&gt;If you're using 'localhost' for the 'server' in &lt;code&gt;craft/config/db.php&lt;/code&gt;, try '127.0.0.1' and visa-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, some environments are picky about that when connecting to MySQL from the CLI.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-12T00:01:58.000" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7130" PostTypeId="1" AcceptedAnswerId="7132" CreationDate="2015-02-12T00:30:29.437" Score="6" ViewCount="2295" Body="&lt;p&gt;Right now I'm trying to accomplish routing users through a controller action before rendering the plugin's CP template...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[Plugin]Plugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ...&#xA;public function registerCpRoutes()&#xA;  {&#xA;    return [&#xA;      'plugin/controller' =&amp;gt; ['action' =&amp;gt; 'plugin/controller/action']&#xA;    ];&#xA;  }&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea here is that I want to perform validation checks in the controller before I serve up the view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running into two issues when it comes to rendering the template from the controller:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The template path is set to the core template directory (which makes plugin templates inaccessible)&lt;/li&gt;&#xA;&lt;li&gt;If I reset the template path to, say, the plugin's directory then I can no-longer extend core layouts (like &lt;code&gt;_layouts/cp&lt;/code&gt;) within my template.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My solution was to then just fetch the plugin's template as a string and then render it using the &lt;code&gt;renderString&lt;/code&gt; method so that way I can use the template without modifying any path variables...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[Plugin]Controller.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ...&#xA;protected function renderPluginTemplate($template, $variables = array())&#xA;  {&#xA;    $oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;    $newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'plugin/templates';&#xA;&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;&#xA;    if(!$templatePath = craft()-&amp;gt;templates-&amp;gt;findTemplate($template)) {&#xA;      throw new Exception(Craft::t('Could not find template with path: ' . $template));&#xA;    } else {&#xA;      $templateContent = file_get_contents($templatePath);&#xA;    }&#xA;&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&#xA;    echo craft()-&amp;gt;templates-&amp;gt;renderString($templateContent, $variables);&#xA;  }&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works &lt;strong&gt;for the most part&lt;/strong&gt;. Now the layout isn't pulling in the right Javascript dependencies – no JS gets fired – so the panel content is hidden and the dropdown menus don't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There must be a better way to do this. I'd be super grateful if anyone could provide any insight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jon&lt;/p&gt;&#xA;" OwnerUserId="2295" LastActivityDate="2015-02-12T01:20:44.450" Title="Rendering templates from plugin controller" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7131" PostTypeId="2" ParentId="5442" CreationDate="2015-02-12T00:40:51.027" Score="6" Body="&lt;p&gt;Just want to mention for anyone running across this thread that if you're having a problem with live preview and seeing dev tools errors of the nature of cors or crossdomain then the first thing you might want to check is that if the domain you're serving the site (the control panel, specifically), is the same as what you have set in &quot;Settings | General Settings&quot; (or in Craft 3, &quot;Settings | Sites&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you serving the site from a &lt;code&gt;example.com&lt;/code&gt; (root domain), and you have &lt;code&gt;www.example.com&lt;/code&gt; in the settings, your live preview will bonk because it's a different domain and the live preview is being served via ajax.&lt;/p&gt;&#xA;" OwnerUserId="607" LastEditorUserId="328" LastEditDate="2018-04-08T22:51:51.887" LastActivityDate="2018-04-08T22:51:51.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7132" PostTypeId="2" ParentId="7130" CreationDate="2015-02-12T01:20:44.450" Score="6" Body="&lt;p&gt;&lt;strong&gt;Figured it out!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went ahead and took at look at how Craft's &lt;code&gt;renderTemplate&lt;/code&gt; method works which cleared it up for me. A few things...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft caches CSS/JS resources inside of &lt;code&gt;getHeadHtml()&lt;/code&gt; and &lt;code&gt;getFootHtml()&lt;/code&gt; which are automatically injected into every template rendered through &lt;code&gt;renderTemplate&lt;/code&gt;. Injecting these into my template fixed the JS problem.&lt;/li&gt;&#xA;&lt;li&gt;I forgot to set both the &lt;code&gt;Content-Type&lt;/code&gt; and &lt;code&gt;charset&lt;/code&gt; headers. Not necessary in my case but it's something that's good to add anyway. &lt;/li&gt;&#xA;&lt;li&gt;To keep things consistent with the way Craft does things I outputted everything into a buffer and terminated the request.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's the working concept of my &lt;code&gt;renderPluginTemplate&lt;/code&gt; method; I borrowed lots from Craft's &lt;code&gt;renderTemplate&lt;/code&gt; function within the &lt;code&gt;BaseController&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function renderPluginTemplate($template, $variables = array())&#xA;  {&#xA;&#xA;    // Grab the new template's content&#xA;    // ---------------------------------------------------------------------&#xA;&#xA;    $oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;    $newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'plugin/templates';&#xA;&#xA;    // Set template path to the plugin directory (temporarily)&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;&#xA;    // Attempt to fetch the template content/extension.&#xA;    if(!$templatePath = craft()-&amp;gt;templates-&amp;gt;findTemplate($template)) {&#xA;      throw new Exception(Craft::t('Could not find template with path: ' . $template));&#xA;    } else {&#xA;      $templateContent   = file_get_contents($templatePath);&#xA;      $templateExtension = IOHelper::getExtension($templatePath, 'html');&#xA;    }&#xA;&#xA;    // Reset the template path&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&#xA;    // Set up the headers and render the template&#xA;    // ---------------------------------------------------------------------&#xA;&#xA;    if($output = craft()-&amp;gt;templates-&amp;gt;renderString($templateContent, $variables)) {&#xA;      // Set the MIME type for the request based on the matched template's file extension (unless the&#xA;      // Content-Type header was already set, perhaps by the template via the {% header %} tag)&#xA;      if (!HeaderHelper::isHeaderSet('Content-Type')) {&#xA;        HeaderHelper::setContentTypeByExtension($templateExtension);&#xA;      }&#xA;&#xA;      // Set the charset header&#xA;      HeaderHelper::setHeader(array('charset' =&amp;gt; 'utf-8'));&#xA;&#xA;      // Are we serving HTML or XHTML?&#xA;      if(in_array(HeaderHelper::getMimeType(), array('text/html', 'application/xhtml+xml'))) {&#xA;        // Are there any header/footer nodes in the queue?&#xA;        $headHtml = craft()-&amp;gt;templates-&amp;gt;getHeadHtml();&#xA;        $footHtml = craft()-&amp;gt;templates-&amp;gt;getFootHtml();&#xA;&#xA;        if($headHtml) {&#xA;          if(($endHeadPos = mb_stripos($output, '&amp;lt;/head&amp;gt;')) !== false) {&#xA;            $output = mb_substr($output, 0, $endHeadPos).$headHtml.mb_substr($output, $endHeadPos);&#xA;          } else {&#xA;            $output .= $headHtml;&#xA;          }&#xA;        }&#xA;        if($footHtml) {&#xA;          if(($endBodyPos = mb_stripos($output, '&amp;lt;/body&amp;gt;')) !== false) {&#xA;            $output = mb_substr($output, 0, $endBodyPos).$footHtml.mb_substr($output, $endBodyPos);&#xA;          } else {&#xA;            $output .= $footHtml;&#xA;          }&#xA;        }&#xA;      }&#xA;&#xA;      // Output it into a buffer, in case TasksService wants to close the connection prematurely&#xA;      ob_start();&#xA;      echo $output;&#xA;&#xA;      // End the request&#xA;      craft()-&amp;gt;end();&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2295" LastActivityDate="2015-02-12T01:20:44.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7133" PostTypeId="1" AcceptedAnswerId="7150" CreationDate="2015-02-12T02:59:35.947" Score="2" ViewCount="406" Body="&lt;p&gt;Is there a way to hide the menu item that plugins add to the control panel menu?  As seen in the picture below, I do not need the &quot;DashCols&quot; link in my main menu, but would like to keep the plugin installed.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/k92GE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1049" LastActivityDate="2015-04-03T11:59:11.077" Title="Hide plugin menu item" Tags="&lt;plugins&gt;&lt;dashboard&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7134" PostTypeId="2" ParentId="7133" CreationDate="2015-02-12T03:19:08.767" Score="3" Body="&lt;p&gt;Option 1) Contact the plugin developer and ask them to make it an optional setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 2) Use a plugin like &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; to hide it via CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 3) Plugins with a CP panel have a permission in the user group permission settings under 'allow cp access' to allow access to the plugin's cp page. You could turn this off for your user group.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="784" LastEditDate="2015-02-12T18:39:57.460" LastActivityDate="2015-02-12T18:39:57.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7135" PostTypeId="1" AcceptedAnswerId="12882" CreationDate="2015-02-12T09:58:48.517" Score="3" ViewCount="1096" Body="&lt;p&gt;I am writing a plugin that imports a large amount of data form an API into some custom element types. I have it all set up and working nicely with Tasks however I am running into a fairly big issue with memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin runs in the following way:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Controlling Task gets set off.&lt;/li&gt;&#xA;&lt;li&gt;It sets off a SubTask twice that gets two different sets of data from the API and saves it to disk.&lt;/li&gt;&#xA;&lt;li&gt;It then sets off another bunch of SubTasks that import that data into my custom element types one element at a time - the number of Tasks at this point depends on how large the saved API data is as I split it into chunks of 100.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In my testing I am skipping point 2 from above, so it is only reading stuff from disk, importing it and repeating. I am finding that no matter what I do I can't stop the memory usage building up. I have used &lt;code&gt;unset()&lt;/code&gt; in various places which has helped a little bit and have turned off the &lt;code&gt;cacheElementQueries&lt;/code&gt; config parameter using &lt;code&gt;craft()-&amp;gt;config-&amp;gt;set('cacheElementQueries', false);&lt;/code&gt; which has also helped but I'm still running into problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some numbers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Resulting files from the API are 2.5MB and 5.3MB of json.&lt;/li&gt;&#xA;&lt;li&gt;Total elements to import from each are 1200 and 2000 respectively.&lt;/li&gt;&#xA;&lt;li&gt;As mentioned above I'm splitting the sets of data in to chunks of 100 to try and conserve memory.&lt;/li&gt;&#xA;&lt;li&gt;php.ini &lt;code&gt;memory_limit&lt;/code&gt; setting is 512M&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm missing something obvious as php doesn't dump the memory until all the Tasks have run, or at least that is what it seems like. I kind of thought that after each Task or SubTask had completed the memory for that would be dumped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to confess I'm still a bit new to serious programming and am only using &lt;code&gt;htop&lt;/code&gt; to monitor the process and can see it going up continually until it reaches my php.ini &lt;code&gt;memory_limit&lt;/code&gt; setting. I know I should probably use xdebug or something but that kind of scares me...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also read this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/740/memory-issue-when-updating-all-entries-from-a-channel-allowed-memory-size-of-x&quot;&gt;Memory issue when updating all entries from a channel (allowed memory size of X bytes exhausted (tried to allocate Y bytes))&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any ideas however wacky to help with plugging my leaky ship I'd be most grateful! I can post up code samples if it will help but I didn't want to make this post too lengthy.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Here is a cut-down set of functions that are used in the process, I've not included lots of little bits that are either just doing processing on non-large variables or other mundane tasks.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Main Task&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function runStep($step)&#xA;{&#xA;&#xA;    // Sync the stored API data to the Craft elements&#xA;    return $this-&amp;gt;runSubTask('MyPlugin_Sync', null, array(&#xA;        'apiElement'         =&amp;gt; $this-&amp;gt;_apiElements[$step]['apiElement'],&#xA;        'apiElementSettings' =&amp;gt; $this-&amp;gt;_apiElements[$step]['apiElementSettings'],&#xA;        'apiService'         =&amp;gt; $service,&#xA;        'offset'             =&amp;gt; $this-&amp;gt;_apiElements[$step]['offset']&#xA;    ));&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sync Task&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getTotalSteps()&#xA;{&#xA;&#xA;    $this-&amp;gt;_apiData = craft()-&amp;gt;myPlugin_ApiService-&amp;gt;getElementsFromFile($this-&amp;gt;_apiElement, $this-&amp;gt;_offset, 100);&#xA;&#xA;    // Check we got something&#xA;    if ( is_array($this-&amp;gt;_apiData) )&#xA;    {&#xA;        return count($this-&amp;gt;_apiData);&#xA;    }&#xA;    else&#xA;    {&#xA;        return 0;&#xA;    }&#xA;&#xA;}&#xA;&#xA;public function runStep($step)&#xA;{&#xA;&#xA;    return craft()-&amp;gt;myPlugin_ImportService-&amp;gt;importElement($this-&amp;gt;_apiService, $this-&amp;gt;_apiElementSettings, array_shift($this-&amp;gt;_apiData));&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;API Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getElementsFromFile($apiElement, $offset = 0, $limit = null)&#xA;{&#xA;&#xA;    // Get the file&#xA;    $filename = $this-&amp;gt;_storage . $apiElement . 's.json';&#xA;&#xA;    $file = IOHelper::getFile($filename);&#xA;&#xA;    $data = json_decode($file-&amp;gt;getContents(), true);&#xA;&#xA;    // Try and help the memory&#xA;    unset($file);&#xA;&#xA;    // Now select the right portion from it using our offset amount&#xA;    return array_slice($data, $offset, $limit);&#xA;&#xA;}&#xA;&#xA;public function mapData($data, $settings)&#xA;{&#xA;&#xA;    $return = array();&#xA;&#xA;    // Boring mapping code using $data&#xA;&#xA;    unset($data);&#xA;&#xA;    return $return;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Import Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function importElement($apiService, $apiElementSettings, $apiData)&#xA;{&#xA;&#xA;    // using the API service, map the data to our fields/attributes held in the plugin settings&#xA;    $mappedData = craft()-&amp;gt;myPlugin_ApiService-&amp;gt;mapData($apiData, $apiElementSettings);&#xA;&#xA;    // We’re done with this now, save our memory&#xA;    unset($apiData);&#xA;&#xA;    // Standard code for getting an existing element and updating it&#xA;    // or creating a new one if none exist&#xA;&#xA;    // Save the thing&#xA;    return craft()-&amp;gt;myPlugin_myElement-&amp;gt;saveMyElement($element);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-12-15T11:28:36.493" Title="Running out of memory in my Task-based plugin" Tags="&lt;plugin-development&gt;&lt;memory&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7136" PostTypeId="1" AcceptedAnswerId="7138" CreationDate="2015-02-12T13:10:20.330" Score="2" ViewCount="411" Body="&lt;p&gt;Consider the following example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;master.twig&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for module in entry.main_contents %}&#xA;  {% include '_modules/' ~ module.type with module only %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;my_awesome_module.twig&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ title }}&amp;lt;/h1&#xA;{{ content | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my case obviously I get the twig error &lt;code&gt;Argument 1 passed to Twig_Template::display() must be of the type array&lt;/code&gt;&#xA;because I cannot pass objects to the include function. In your examples you use the following solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;master.twig&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for module in entry.main_contents %}&#xA;  {% include '_modules/' ~ module.type with {'data': module} only %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;my_awesome_module.twig&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ data.title }}&amp;lt;/h1&#xA;{{ data.content | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Isn't there a way to pass directly the matrix attributes without encapsulating them in an other array?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hooked in also a twig helper method that returns &lt;code&gt;$model-&amp;gt;getContent()-&amp;gt;getAttributes()&lt;/code&gt; but it seems that the array returned looses all its nested properties ( like the &lt;code&gt;assets&lt;/code&gt; list...)&lt;/p&gt;&#xA;" OwnerUserId="2231" LastActivityDate="2015-02-12T18:50:55.713" Title="How to pass the matrix attributes to views without too much ceremony" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7137" PostTypeId="2" ParentId="7043" CreationDate="2015-02-12T13:55:42.863" Score="3" Body="&lt;p&gt;As you already found out, the &lt;code&gt;loop.index&lt;/code&gt; counter increments for each iteration of the loop, not only if you use or print it within your conditional. The best solution to work against it is to get rid of that conditional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case it is in fact possible to catch only those entries you are after, making the conditional redundent&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('gigs').datum('&amp;lt; ' ~ present) %}&#xA;    &amp;lt;h2 class=&quot;{{ cycle(['odd','even'], loop.index0) }}&quot;&amp;gt;{{ entry.title }&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if it wasn't, you could have done your own counter that increments within the conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set index = 0 %}&#xA;{% for entry in craft.entries.section('gigs') %}&#xA;    {% if entry.datum &amp;lt; present %}&#xA;        {% set index = index + 1 %}&#xA;        &amp;lt;h2 class=&quot;{{ cycle(['odd','even'], index) }}&quot;&amp;gt;{{ entry.title }&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-12T14:05:05.157" LastActivityDate="2015-02-12T14:05:05.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7138" PostTypeId="2" ParentId="7136" CreationDate="2015-02-12T14:09:58.820" Score="2" Body="&lt;p&gt;The short answer is &lt;em&gt;no&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The longer answer is you will probably get used to it. Craft twig templates in general look like &lt;code&gt;{{entry.title}}&lt;/code&gt; (or &lt;code&gt;{{data.title}}&lt;/code&gt;) rather than just &lt;code&gt;{{title}}&lt;/code&gt;. I find it easier to read, though you may not.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-02-12T14:09:58.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7139" PostTypeId="2" ParentId="7136" CreationDate="2015-02-12T17:21:05.790" Score="2" Body="&lt;p&gt;It has nothing to do with the template include, if you were to implement this without the include you would still need to access the title and content through the 'module' variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for module in entry.main_contents %}&#xA;    &amp;lt;h1&amp;gt;{{ module.title }}&amp;lt;/h1&#xA;    {{ module.content | raw }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;with&lt;/code&gt; statement allows you explicitly pass variables using &lt;code&gt;{ key:value }&lt;/code&gt; syntax, where 'key' is a variable that you will be able to access by name in your included template. You could just as easily pass multiple variables using: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_modules/' ~ module.type with {'title': module.title, 'content':module.content} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="125" LastEditDate="2015-02-12T18:50:55.713" LastActivityDate="2015-02-12T18:50:55.713" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7140" PostTypeId="1" AcceptedAnswerId="7141" CreationDate="2015-02-12T18:34:32.233" Score="1" ViewCount="761" Body="&lt;p&gt;I imported all of the posts from a WordPress blog, using a regular expression to update the image URLs to their new location in a Craft Asset Source. However, many of the original photos are straight out of the camera - 2000x3000px or whatever. What I would like to do is use that same regex to update them to a transformed version: so /wp-content/uploads/2014/12/photo.jpg would become /media/blog/_fullWidth/photo.jpg. I already set up that replacement and it's working great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the &quot;Full Width&quot; transform hasn't been generated, and just calling the URL from a Rich Text field bypasses Craft, so it never gets generated. Short of manually re-adding every photo through Redactor with the transform, is there any way to force Craft to generate a particular transform on all the images in an asset source? &lt;/p&gt;&#xA;" OwnerUserId="62" LastActivityDate="2015-02-12T19:07:10.507" Title="Any way to manually generate a transform on an asset source?" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;import&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7141" PostTypeId="2" ParentId="7140" CreationDate="2015-02-12T19:07:10.507" Score="2" Body="&lt;p&gt;You could just make a temporary template that makes Craft generate them for you. And depending on how many these are, you better use &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;offset&lt;/code&gt; with your &lt;code&gt;craft.assets&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets.source('myAssetSource').limit(50).offset(0) %}&#xA;{% for image in images %}&#xA;    &amp;lt;img src=&quot;{{ image.url('fullwidth') }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-12T19:07:10.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7142" PostTypeId="2" ParentId="7101" CreationDate="2015-02-12T19:25:38.130" Score="3" Body="&lt;p&gt;No custom plugin necessary if you don't want to write one, as there is already one that exists to do this very task and so much more. Checkout Postmaster for Craft. &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-02-12T19:25:38.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7143" PostTypeId="1" AcceptedAnswerId="7144" CreationDate="2015-02-12T20:11:29.827" Score="0" ViewCount="111" Body="&lt;p&gt;When SVGs are uploaded to assets what media type does CraftCMS associate them with? Image, Document, HTML or XML?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-02-12T20:42:05.320" Title="What media type are SVGs treated as in assets?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7144" PostTypeId="2" ParentId="7143" CreationDate="2015-02-12T20:42:05.320" Score="5" Body="&lt;p&gt;Image. Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets#kind&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;kind&lt;/code&gt;&lt;/a&gt; parameter to filter them out.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-12T20:42:05.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7145" PostTypeId="1" CreationDate="2015-02-12T20:56:52.510" Score="3" ViewCount="322" Body="&lt;p&gt;Is there a method / plugin which allows a cascading deletion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on an author agency site and have set up 2 channels, Authors and Books. The Book entry section has a Field set to Entries which allows me to specify the  Author/s from the Author Channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to happen is, when an Author is deleted from the system so are all their books (unless the books has more than 1 author).&lt;/p&gt;&#xA;" OwnerUserId="2257" LastEditorUserId="125" LastEditDate="2015-05-29T15:00:36.527" LastActivityDate="2015-05-29T15:00:36.527" Title="Cascading deletion" Tags="&lt;relations&gt;&lt;deletion&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7146" PostTypeId="2" ParentId="7145" CreationDate="2015-02-12T22:01:11.747" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;onBeforeDeleteEntry&lt;/code&gt; event in an 'init' method  defined in your plugin's main file to: intercept the delete process; retrieve the related books; check each book for more than one author; and if only one author, delete the book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not tested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.onBeforeDeleteEntry', function(Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $section = $entry-&amp;gt;getSection()-&amp;gt;handle;&#xA;&#xA;        if ($section == 'myAuthorsSectionHandle') {&#xA;&#xA;            // get related book entries&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;            $criteria-&amp;gt;section   = 'myBooksSectionHandle';&#xA;            $criteria-&amp;gt;relatedTo = array(&#xA;                'targetElement' =&amp;gt; $entry,&#xA;                'field'         =&amp;gt; 'myBooksSectionRelatedAuthorsFieldHandle'&#xA;            );&#xA;            $books = $criteria-&amp;gt;find();&#xA;&#xA;            foreach ($books as $book) {&#xA;                $authors = $book-&amp;gt;myBooksSectionRelatedAuthorsFieldHandle;&#xA;                if (count($authors) == 1) {&#xA;                    // delete the book entry&#xA;                    craft()-&amp;gt;entries-&amp;gt;deleteEntry([$book]);&#xA;                } else if (count($authors) &amp;gt; 1) {&#xA;                    // decide what you want to do when more than one author found.&#xA;                    // use `$event-&amp;gt;performAction = false;` to cancel the original delete operation if you need to&#xA;                } else {&#xA;                    throw new Exception('No authors found. This is impossible, my code must have an error somewhere.');&#xA;                }&#xA;            }&#xA;&#xA;        }&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; It appears as though the &lt;code&gt;onBeforeDeleteEntry&lt;/code&gt; event does not get raised when deleting multiple entries from the entry index page (as I would think it should), presumably because it is using elements-&gt;deleteElementById() to do so, thus bypassing the EntriesService event. In any rate, you might try the following instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeDeleteElements', function(Event $event)&#xA;{&#xA;    $elementIds = $event-&amp;gt;params['elementIds'];&#xA;&#xA;    foreach ($elementIds as $elementId) {&#xA;        $element = craft()-&amp;gt;elements-&amp;gt;getElementById($elementId);&#xA;        if ($element-&amp;gt;getElementType() == 'Entry') {&#xA;            $entry = $element;&#xA;            $section = $entry-&amp;gt;getSection()-&amp;gt;handle;&#xA;            if ($section == 'myAuthorsSectionHandle') {&#xA;               // rest of the code as above&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-13T18:47:26.103" LastActivityDate="2015-02-13T18:47:26.103" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7147" PostTypeId="1" AcceptedAnswerId="7148" CreationDate="2015-02-13T03:08:28.073" Score="10" ViewCount="1690" Body="&lt;p&gt;I'd like a more personalized version of the offline page when the System Status is set to: Off. Is there a way to customize the page and/or change the text?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-02-13T03:56:42.410" Title="System Status Off Custom Text" Tags="&lt;templating&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7148" PostTypeId="2" ParentId="7147" CreationDate="2015-02-13T03:56:42.410" Score="23" Body="&lt;p&gt;When the System Status is set to &quot;off&quot;, Craft will return a HTTP 503 response, which will then automatically trigger the &quot;503.html&quot; template in &lt;code&gt;craft/app/templates&lt;/code&gt; to load, which is what you're seeing by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you put your own &quot;503.html&quot; in your &lt;code&gt;craft/templates&lt;/code&gt; folder, Craft will load that one instead.  Same goes for the other HTTP status codes (400, 403, 404, 500, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-13T03:56:42.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7149" PostTypeId="1" AcceptedAnswerId="7151" CreationDate="2015-02-13T10:56:17.907" Score="3" ViewCount="1431" Body="&lt;p&gt;I’m setting up a site that has paid membership. For a visitor to create an account I’ll need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Ask for email and password and create the new user.&lt;/li&gt;&#xA;&lt;li&gt;Take payment and upgrade the user’s status/user group if successful.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This could be part of the same form, or split into two steps. Either way, I’d like to know if it’s possible to auto log in the user once they’ve hit submit on their registration form.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2015-02-13T12:58:45.200" LastActivityDate="2015-02-13T14:47:06.193" Title="Auto log in user" Tags="&lt;users&gt;&lt;registration&gt;&lt;login&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7150" PostTypeId="2" ParentId="7133" CreationDate="2015-02-13T11:54:09.463" Score="2" Body="&lt;p&gt;I just added a setting called &quot;Undercover mode&quot; to DashCols. In Undercover mode, DashCols will keep running, though the plugin's CP section will be inaccessible/hidden, and layout editing will be disabled for all users – including those having access to the plugin via permission settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft&quot; rel=&quot;nofollow&quot; title=&quot;Download v. 1.1.4 from GitHub&quot;&gt;Download v. 1.1.4 from GitHub&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-02-13T11:54:09.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7151" PostTypeId="2" ParentId="7149" CreationDate="2015-02-13T14:47:06.193" Score="16" Body="&lt;p&gt;Check out the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#autoLoginAfterAccountActivation&quot;&gt;&lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; config setting&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To enable it, set it to true in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'autoLoginAfterAccountActivation' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-13T14:47:06.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7152" PostTypeId="1" AcceptedAnswerId="7154" CreationDate="2015-02-13T17:28:15.050" Score="4" ViewCount="4772" Body="&lt;p&gt;I have a public registration form and a plugin which needs to create an entry for a user when that user is activated. That part works. Because I want to force an Admin to activate the user, I am using this code block to stop Craft automatically activating a user on registration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.beforeActivateUser', function(Event $event){&#xA;        // stop the user from being able to activate their account. Forces admins to do so.&#xA;        $event-&amp;gt;performAction = false;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this also stops an Admin from activating the user account via the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't work out how to test that the user performing the event is the admin and therefore skip that blocking code. I'd tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.beforeActivateUser', function(Event $event){&#xA;        // stop the user from being able to activate their account. Forces admins to do so.&#xA;        if($event-&amp;gt;params['user']-&amp;gt;isInGroup('artists')){&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work, presumably because a new registering user doesn't belong to any group at the point that code is run.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-10-11T20:33:55.677" Title="How to identify the logged in user inside a plugin?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7153" PostTypeId="2" ParentId="7152" CreationDate="2015-02-13T18:21:21.960" Score="2" Body="&lt;p&gt;Searching the class reference documentation, I see that the user is available from the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService&quot; rel=&quot;nofollow&quot;&gt;userSession service&lt;/a&gt; — but never tried this personally.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.beforeActivateUser', function(Event $event){&#xA;    // stop the user from being able to activate their account. Forces admins to do so.&#xA;    if(!craft()-&amp;gt;userSession-&amp;gt;isAdmin()) {&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or to just get the current user for other testing, &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;user&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-13T18:29:08.643" LastActivityDate="2015-02-13T18:29:08.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7154" PostTypeId="2" ParentId="7152" CreationDate="2015-02-13T18:45:05.943" Score="12" Body="&lt;p&gt;I'm a bit confused by your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds as though you want to check if the currently logged-in user is an Administrator, but it looks like you're actually checking whether the &lt;em&gt;newly-registered&lt;/em&gt; user is an Administrator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService#getUser-detail&quot;&gt;retrieve the currently logged-in User&lt;/a&gt;, and &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserModel#isInGroup-detail&quot;&gt;check whether they belong&lt;/a&gt; to a specific User Group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function (Event $event)&#xA;{&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;    if ($user &amp;amp;&amp;amp; $user-&amp;gt;isInGroup('groupHandle') {&#xA;        // Do stuff.&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserPermissionsService#doesGroupHavePermission-detail&quot;&gt;check whether the current user has permission&lt;/a&gt; to perform a specific action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($user &amp;amp;&amp;amp; craft()-&amp;gt;userPermissions-&amp;gt;doesUserHavePermission($user-&amp;gt;id, 'registerUsers')) {&#xA;    // Do stuff.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2015-02-13T18:45:05.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7155" PostTypeId="2" ParentId="2622" CreationDate="2015-02-13T19:19:24.757" Score="6" Body="&lt;p&gt;Following from Lindsey D's answer, I just wanted to point out you can skip manually mapping the weekday names by calling &lt;code&gt;craft.i18n.getLocaleData().getWeekDayName()&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's also worth mentioning, you can check for empty values to indicate the store is closed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for dayIndex,dayHours in companyInfo.storeHours %}&#xA;&#xA;  {% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}&#xA;&#xA;  {{day}}: {{ (dayHours.open is empty) ? 'CLOSED' : dayHours.open|date('g:i a') ~ '-' ~ dayHours.close|date('g:i a') }}&#xA;&#xA;  &amp;lt;br&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2304" LastActivityDate="2015-02-13T19:19:24.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7157" PostTypeId="1" CreationDate="2015-02-13T20:57:12.767" Score="2" ViewCount="894" Body="&lt;p&gt;I have a listener for the &lt;code&gt;entries.saveEntry&lt;/code&gt;event that is calling a service, which generates an email from a rendered template. The template is attempting to import macros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MyaddonPlugin.php::init()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    if ($event-&amp;gt;params['isNewEntry']) {&#xA;        craft()-&amp;gt;myaddon_emails-&amp;gt;generateEmail($event-&amp;gt;params['entry']);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Myaddon_EmailsService.php::generateEmail()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$emailHtml = craft()-&amp;gt;templates-&amp;gt;render('myaddon/email');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;plugins/myaddon/templates/email.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/mymacro' as mymacro % }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I attempt to run this I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to find the template “_macros/mymacro”.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When running the same service/render code from a Controller, everything works. It seems like there is a difference with how paths are set or handled in a Controller vs. an event handler. I tried manually setting the template path based on &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt;, but same results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to resolve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="699" LastActivityDate="2015-02-16T20:00:05.437" Title="Issues with Twig template includes when rendering from a service called from a CP-triggered event" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;events&gt;&lt;services&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7158" PostTypeId="1" CreationDate="2015-02-14T18:19:06.513" Score="2" ViewCount="1552" Body="&lt;p&gt;I've recently installed Craft on a Digital Ocean Ubuntu 12.04 droplet. After finally getting all the permissions set and everything set up I get &quot;Page Not Found. The Requested URL was not found on this server.&quot; when I visit the site URL but the admin area loads just fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody have an idea of what could be going on? Or maybe a way to debug it? I've checked the Apache and PHP error logs (I think) but they don't show anything strange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried a brand new install but also had no luck. I'm guessing it's Apache related but I'm not an apache expert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2307" LastEditorUserId="125" LastEditDate="2015-05-29T15:00:47.413" LastActivityDate="2016-03-05T12:58:53.510" Title="Site URL displays &quot;Page Not Found The requested URL was not found on this server.&quot; but the backend loads fine" Tags="&lt;install&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7159" PostTypeId="1" AcceptedAnswerId="7160" CreationDate="2015-02-14T18:26:32.157" Score="2" ViewCount="5817" Body="&lt;p&gt;I've been digging around and haven't found an existing Twig filter for what I'm trying to do. Basically, I'd like a filter that would provide a hash of a phrase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudo-template code would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;my phrase here&quot;|hashwithmd5 }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And would generate this in my rendered template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;6e6d5618f8ab8a302a236eac07c59300&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does something like this exist? Am I going about this in a bad way?&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2021-04-20T08:24:08.977" Title="Craft or Twig filter for MD5 or SHA3 hash creation?" Tags="&lt;filter&gt;&lt;hash&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7160" PostTypeId="2" ParentId="7159" CreationDate="2015-02-14T18:59:56.720" Score="4" Body="&lt;p&gt;sounds like a simple &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; will do the trick for you. You will need to set up your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;nofollow&quot;&gt;main plugin class&lt;/a&gt; and a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;variable class&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your variable class will look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class YourPluginNameVariable&#xA;{&#xA;    public function makeHash($string)&#xA;    {&#xA;        $hashed = md5($string);&#xA;        return $hashed;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can call this in your templates like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{craft.yourpluginname.makeHash('my phrase here')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-14T18:59:56.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7161" PostTypeId="2" ParentId="7158" CreationDate="2015-02-14T19:29:11.777" Score="1" Body="&lt;p&gt;Got it working! Not really sure exactly what was causing it, but it seems to have had something to do with my Capistrano setup not craft or Apache.&lt;/p&gt;&#xA;" OwnerUserId="2307" LastActivityDate="2015-02-14T19:29:11.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7162" PostTypeId="1" CreationDate="2015-02-15T01:14:55.610" Score="3" ViewCount="278" Body="&lt;p&gt;I have a form that spans two pages, with a required field on both pages and an optional field on both pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Form A - Page 1&#xA;- Question 1 (required)&#xA;- Question 2 (optional)&#xA;&#xA;[User submits partial form to database]&#xA;&#xA;Form A - Page 2&#xA;- Question 3 (required)&#xA;- Question 4 (optional)&#xA;&#xA;[User submits partial form to database]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Form is creating an ElementType in Craft and the questions are Custom Fields.  The user who creates the Form can arrange any number of custom fields required or optional on any number of tabs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I think about validation for this workflow? When I create a Model to validate the forms being submitted, required fields should only trigger validation errors when the page they are on is submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm happy to do more digging myself on this one if you can help point me in the right direction, but I'm not sure how to frame what I'd like to do.  Does anyone have a better framework of how to think about how to validate conditionally required fields in the context of Models, Records, Element Types, and Custom Fields?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-15T20:59:21.827" Title="Can a model or record have conditional requirements?" Tags="&lt;plugin-development&gt;&lt;custom-field&gt;&lt;models&gt;&lt;validation&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7163" PostTypeId="2" ParentId="7162" CreationDate="2015-02-15T04:45:43.207" Score="3" Body="&lt;p&gt;I can think of a couple of options and I'll just throw them all out there.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Have a separate model per partial form and each model performs its own validation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have a single model, but have it override the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel#rules-detail&quot; rel=&quot;nofollow&quot;&gt;rules()&lt;/a&gt; method and you can conditionally set what validations methods you want depending on the step you're on. Presumably, you'd want to pass in a step number either through the querystring or through POST.  You can see an example of how we're doing some conditional validation using this method for email settings in &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/EmailSettingsModel.php#L24&quot; rel=&quot;nofollow&quot;&gt;EmailSettingsModel&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Don't worry about any of Craft's/Yii's automagic validation classes and just have the controller manually do its own validation per form and return errors as necessary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-02-15T20:59:21.827" LastActivityDate="2015-02-15T20:59:21.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7164" PostTypeId="1" AcceptedAnswerId="7165" CreationDate="2015-02-15T20:22:26.203" Score="1" ViewCount="818" Body="&lt;p&gt;I'm trying to loop through entries in specific sections and output Entry's:&#xA;    - URL&#xA;    - Title&#xA;    - Type&#xA;    - Asset's image&#xA;    - asset's URL&#xA;    - Section's name&#xA;    - Section's URL&#xA;    - Tag's name&#xA;    - Tag's URL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I came to this with &lt;strong&gt;having difficulties with section's URL&lt;/strong&gt; and &lt;strong&gt;tags&lt;/strong&gt; that belongs to relative entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set entries = craft.entries.section(['worldTechnology','worldTravel']) %}&#xA;        {% for entry in entries %}&#xA;        &amp;lt;div class=&quot;uk-width-medium-1-3&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;uk-panel uk-panel-box uk-panel-box-primary&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;uk-panel-teaser&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                    &amp;lt;img class=&quot;uk-margin-bottom&quot; src=&quot;http://cdni.wired.co.uk/1920x1280/k_n/London_5.jpg&quot; alt=&quot;&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;uk-h3 uk-text-center uk-margin-top uk-panel-header&quot;&amp;gt;{{ entry.title}}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;uk-text-center&quot;&amp;gt;&#xA;                    &amp;lt;em&amp;gt;in&amp;lt;/em&amp;gt;&#xA;                    &amp;lt;span class=&quot;uk-margin-small-left&quot;&amp;gt;&amp;lt;a href=&quot;{{ section.getUrl }}&quot;&amp;gt;{{ entry.section.name }}&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;span class=&quot;uk-margin-small-left&quot;&amp;gt;{{ entry.getType.name }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;ul class=&quot;uk-breadcrumb&quot;&amp;gt;&#xA;                        {% for tag in craft.tags.relatedTo(entries) %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                            &amp;lt;a href=&quot;&quot; class=&quot;uk-badge uk-badge-tag uk-badge-clean&quot;&amp;gt;&#xA;                            &amp;lt;i class=&quot;uk-icon-circle-thin uk-margin-small-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                            {{ tag.title }}&#xA;                            &amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                        {% else %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                            No tags found&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm working on it only in evenings and I'm starting to like Craft and Twig. Hopefully some of you guys, will advice me or give me some direction to go after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for viewing it.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-02-15T22:34:49.810" Title="Output section and tag name with URL in entry loop" Tags="&lt;tags&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7165" PostTypeId="2" ParentId="7164" CreationDate="2015-02-15T22:34:49.810" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel&quot; rel=&quot;nofollow&quot;&gt;Sections&lt;/a&gt; do not have URLs, so &lt;code&gt;section.getUrl&lt;/code&gt; will not return anything for you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to get an index page of all the entries in a section that has a URI, try slicing off the last segment of the entry's URL, and make sure you have an index.html template in that section's template folder. Take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;templating documentation&lt;/a&gt; for more information on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the tags, make sure you call  &lt;code&gt;{% for tag in craft.tags.relatedTo(entry) %}&lt;/code&gt; instead of &lt;code&gt;{% for tag in craft.tags.relatedTo(entries) %}&lt;/code&gt; to get the tags related to the entry you are currently focused on in the for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-15T22:34:49.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7166" PostTypeId="1" AcceptedAnswerId="7167" CreationDate="2015-02-15T23:55:54.813" Score="1" ViewCount="97" Body="&lt;p&gt;Can entries in a category be reordered in a similar way that entries in a Structure can be reordered? If not, how can entries in a category be reordered manually?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-02-16T01:16:58.697" Title="Can entries in a category be reordered?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7167" PostTypeId="2" ParentId="7166" CreationDate="2015-02-16T01:16:58.697" Score="2" Body="&lt;p&gt;There isn't a builtin way to manually sort the entries as you can in a structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When calling the entries in your templates, you can make use of the 'order' parameter to order the entries returned. From the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The order the entries should be returned in. Possible values include&#xA;  'title', 'id', 'authorId', 'sectionId', 'slug', 'uri', 'postDate',&#xA;  'expiryDate', 'dateCreated', and 'dateUpdated', as well as any textual&#xA;  custom field handles. If you want the entries to be sorted in&#xA;  descending order, add “desc” after the property name (ex: 'postDate&#xA;  desc'). The default value is 'postDate desc'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% entries = craft.entries.section('news').order('postDate').limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-16T01:16:58.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7168" PostTypeId="1" AcceptedAnswerId="7169" CreationDate="2015-02-16T01:20:27.143" Score="1" ViewCount="1518" Body="&lt;p&gt;First, a disclamer -- I am new to Craft CMS.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, I am trying to create a category page whereby the page will show the title, description and image of the sub-categories of the current category.  It will do this so long as there are still sub-categories.  When there are no longer sub-categories it will then show the entries for that category.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have figured out the code (see below), but I'm having a problem showing the images.  On one level the images show fine, but on a lower level the images are being shown in reverse order.  I can't figure out why.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set num = 0 %}            &#xA;{% set children = category.getChildren() %}&#xA;        {% if children|length %}&#xA;         {% for child in children %}&#xA;&#xA;        &amp;lt;div id=&quot;teaser&quot; class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;teaser_image&quot; class=&quot;columns left small-12 medium-6&quot;&amp;gt;&#xA;&#xA;&#xA;        {% set assets = craft.assets.relatedTo(children).nth(num) %}           &#xA;            {% if assets %}&#xA;                &amp;lt;img src=&quot;{{ assets.url }}&quot; alt=&quot;{{ assets.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;/div&amp;gt;     &#xA;&#xA;            &amp;lt;div id=&quot;teaser_text&quot; class=&quot;columns right small-12 medium-6&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ child.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ child.description }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% set num = num + 1 %}&#xA;        {% endfor %}&#xA;&#xA;&#xA;            {% else %}    &#xA;            &amp;lt;div id=&quot;teaser&quot; class=&quot;row&quot;&amp;gt;&#xA;                &amp;lt;div id=&quot;teaser_image&quot; class=&quot;columns left small-12 medium-6&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;/images/moses-har-sinai.jpg&quot; alt=&quot;&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div id=&quot;teaser_text&quot; class=&quot;columns right small-12 medium-6&quot;&amp;gt;&#xA;                {% set entries = craft.entries.relatedTo(category).level(1) %}&#xA;                {% for entry in entries %}&#xA;                    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;a class=&quot;button small&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;Learn more&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, on the category page:  /topics/life/ the images are associated with the proper category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on the category page:  topics/life/cells, the order is reversed.  The first category displays the image for the last category and the last category dispalys the image for the first category.  Why is that and what can I do to fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help you can offer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.  Please feel free to let me know if there is a better way to code what I'm trying to do.&lt;/p&gt;&#xA;" OwnerUserId="2309" LastActivityDate="2015-02-16T15:56:38.070" Title="Displaying Sub Categories on Category Page" Tags="&lt;assets&gt;&lt;categories&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7169" PostTypeId="2" ParentId="7168" CreationDate="2015-02-16T08:25:52.753" Score="3" Body="&lt;p&gt;It's hard to figure out exactly what your trying to do, but I can see a few potential problems.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;No need for the 'num' variable, instead use &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7168/displaying-sub-categories-on-category-page&quot;&gt;loop.index&lt;/a&gt; (or &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7168/displaying-sub-categories-on-category-page&quot;&gt;loop.index0&lt;/a&gt; for a zero indexed array); although I don't think you need it at all in this case.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nth()&lt;/code&gt; is currently returning the 'nth' offset of all assets that are related to all children collectively (thus the strange results). I would guess that you want the asset(s) related to the child category in the current loop. I would also guess that the asset(s) are defined in an assets field in the categories field layout, in which case you can get the asset(s) from the field directly, rather than using &lt;code&gt;.relatedto(child)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try the following — without understanding your structure entirely, it might at least be a bit closer to what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category.hasDescendants() %}&#xA;&#xA;    {% for childCategory in category.getDescendants() %}&#xA;&#xA;        &amp;lt;div id=&quot;teaser&quot; class=&quot;row&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div id=&quot;teaser_image&quot; class=&quot;columns left small-12 medium-6&quot;&amp;gt;&#xA;&#xA;                {% set asset = childCategory.myAssetsFieldHandle.first %}&#xA;                {% if asset %}&#xA;                    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;                {% endif %}&#xA;&#xA;            &amp;lt;/div&amp;gt;     &#xA;&#xA;            &amp;lt;div id=&quot;teaser_text&quot; class=&quot;columns right small-12 medium-6&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ childCategory.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ childCategory.description }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&#xA;&amp;lt;div id=&quot;teaser&quot; class=&quot;row&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;teaser_image&quot; class=&quot;columns left small-12 medium-6&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;/images/moses-har-sinai.jpg&quot; alt=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;teaser_text&quot; class=&quot;columns right small-12 medium-6&quot;&amp;gt;&#xA;&#xA;        {% set entries = craft.entries.relatedTo(category) %}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;a class=&quot;button small&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;Learn more&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: this is assuming that you want to show the subcategories and then the entries related to the main category. If not, then I misinterpreted your question and you will want to reconfigure this a bit, but the principles should be the same.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-16T15:56:38.070" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7170" PostTypeId="1" CreationDate="2015-02-16T09:51:13.800" Score="1" ViewCount="471" Body="&lt;p&gt;I am using the Dukt Follow plugin to return 2 arrays which both hold User objects, I am then using the without filter to remove users from the array which are considered friends. Friends are determined by using the intersect filter on the 2 arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works apart from the second without filter which does not work, and returns objects that are in the friends array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Friends, Followers &amp;amp; Following #}&#xA;{% set userFollowing = craft.follow.getFollowing(user.id) %}&#xA;{% set userFollowers = craft.follow.getFollowers(user.id) %}&#xA;&#xA;{% set friends = userFollowing|length and userFollowers|length ? userFollowing|intersect(userFollowers) : null %}&#xA;{% set following = userFollowing|without(friends) %}&#xA;{% set followers = userFollowers|without(friends) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there an obvious reason why this might not be working?&#xA;How is best to debug something like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the output of all the arrays and objects and they do appear to hold the data that they should. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic data stored in each array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;User Following:&#xA;Array: [&quot;Craft\\UserModel: bencallaway&quot;,&quot;Craft\\UserModel: davidwearn&quot;,&quot;Craft\\UserModel: shorn&quot;]&#xA;&#xA;User Followers:&#xA;Array: [&quot;Craft\\UserModel: bencallaway&quot;,&quot;Craft\\UserModel: davidwearn&quot;]&#xA;&#xA;Friends:&#xA;Array: [&quot;Craft\\UserModel: bencallaway&quot;,&quot;Craft\\UserModel: davidwearn&quot;]&#xA;&#xA;Following:&#xA;Array: {&quot;2&quot;:&quot;Craft\\UserModel: shorn&quot;}&#xA;&#xA;Followers:&#xA;Array: [&quot;Craft\\UserModel: bencallaway&quot;,&quot;Craft\\UserModel: davidwearn&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full variable output can be accessed here: &lt;a href=&quot;http://cl.ly/2o292X3O2r0M&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/2o292X3O2r0M&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="158" LastEditorUserId="158" LastEditDate="2015-02-16T17:44:06.140" LastActivityDate="2015-02-17T03:30:24.020" Title="Why is the Craft without filter not working correctly and how to debug?" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7171" PostTypeId="1" AcceptedAnswerId="7173" CreationDate="2015-02-16T11:59:53.733" Score="2" ViewCount="280" Body="&lt;p&gt;I'm using the Guest Entries plugin and it's all working great, the problem is I'm getting spammed like mad. I've got snaptcha installed which seems to be catching some of it but I could do with an IP log so I can see if it is coming from a certain IP or IP range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ideally want the IP logged with the form submission as server access logs are hard to match up.&lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-02-16T15:19:34.670" Title="Logging IP with Guest Entries Plugin" Tags="&lt;guest-entries&gt;&lt;ip-address&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7172" PostTypeId="1" AcceptedAnswerId="7181" CreationDate="2015-02-16T13:14:39.900" Score="2" ViewCount="768" Body="&lt;p&gt;Bit of an awkward one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client wants a system where they send us a link e.g. mycraftsite.com?userid=abc123 and from there we need to populate the user table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to craft but I am assuming the correct way is to use a plugin, grab the header data and somehow insert it using a hook, but I don't see any available for before the site renders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="2311" LastEditorUserId="22" LastEditDate="2017-05-10T00:08:54.947" LastActivityDate="2017-05-10T00:08:54.947" Title="Automatically create users from http header" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7173" PostTypeId="2" ParentId="7171" CreationDate="2015-02-16T15:19:34.670" Score="1" Body="&lt;p&gt;You could add a field &quot;IP Address&quot; to your Entry Type and make the form submit the guest's IP (→ &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService#getIpAddress-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getIpAddress()&lt;/code&gt;&lt;/a&gt; method) via a hidden field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[ipAddress]&quot; value=&quot;{{ craft.request.getIpAddress() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For further improvements you could make your own field type for &quot;IP Address&quot; with a plugin, that adds custom validation (→ block certain IP ranges). You could also hide the field from the CP or make it only readable.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-16T15:19:34.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7174" PostTypeId="1" AcceptedAnswerId="7176" CreationDate="2015-02-16T15:46:34.140" Score="4" ViewCount="589" Body="&lt;p&gt;I've browsed the questions and answers here and i can't find anything that works for what i'm trying to do!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using this as the main menu of my site (so it is in _layout.html)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('artCats') %}&#xA;{% set entryCount = craft.entries.relatedTo(category).total()&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&amp;lt;span&amp;gt;{{ category.title }}&amp;lt;/span&amp;gt;{% if category.level == 2 %}&amp;lt;span class=&quot;postnum&quot;&amp;gt;({{ entryCount }})&amp;lt;/span&amp;gt;{% endif %}&amp;lt;/a&amp;gt;&#xA;  {% ifchildren %}&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% children %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's a drop down menu that shows how many posts are in each sub category. All works nicely!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, no matter what i try, i can't seem to dynamically assign a class to the current page. I think i'm misunderstanding in general how this is done in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a lot of solutions that are basically saying &quot;if url segment is &quot;fishcake&quot; then add my class&quot; but to me, that's not dynamic at all! Dynamic would be if i add a new sub-category, the menu will add my desired class to that menu item if i visit, without me having to add a new if statement in the Twig code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am i able to do something like &quot;if the category.url of this link matches the current url, do this&quot; ?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-02-17T12:37:18.597" Title="How can i apply &quot;current&quot; class for category nav?" Tags="&lt;categories&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7175" PostTypeId="1" AcceptedAnswerId="7183" CreationDate="2015-02-16T16:09:31.373" Score="1" ViewCount="391" Body="&lt;p&gt;Ok, I need a MySQL pro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hundreds of users&lt;/li&gt;&#xA;&lt;li&gt;User can be a child of other users, through relation field 'myParents'&lt;/li&gt;&#xA;&lt;li&gt;I need a list of users, and their child(ren), related to an entry (through relation field &lt;code&gt;belongsToGroups&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't want to use &lt;code&gt;$criteria-&amp;gt;find()&lt;/code&gt;, because it returns objects, which makes it terribly slow. So, I want to create a db query. What I have now, is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$parentsWithChildren = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('u.id userId, u.firstName parentFirstName, u.lastName parentLastName, c.firstName childFirstName, c.lastName childLastName')&#xA;        -&amp;gt;from('users u')&#xA;        -&amp;gt;join('relations r', 'u.id = r.sourceId')&#xA;        -&amp;gt;join('relations uc', 'u.id = uc.targetId')&#xA;        -&amp;gt;join('usergroups_users g', 'u.id = g.userId')&#xA;        -&amp;gt;join('users c', 'uc.sourceId = c.id')&#xA;        -&amp;gt;where('r.targetId = '.$elementId)&#xA;        -&amp;gt;andWhere('uc.fieldId = 92')&#xA;        -&amp;gt;andWhere('g.groupId != 5')&#xA;        -&amp;gt;order('u.id')&#xA;        -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This return a nice list of all users, children included, but only if a user has children. &lt;strong&gt;In short:&lt;/strong&gt; I also need the users without children. Any SQL guru willing to help me out, it's been a long day ;)&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-16T19:39:03.430" Title="Selecting all parent users and their related children" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7176" PostTypeId="2" ParentId="7174" CreationDate="2015-02-16T16:16:56.057" Score="5" Body="&lt;p&gt;You can get the current Category Model via the pre-populated &lt;code&gt;category&lt;/code&gt; variable on all of your category pages. (→ see &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing type no. 4&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you probably know, entry pages come with &lt;code&gt;entry&lt;/code&gt; pre-populated. To get all the Category Models that are related to an entry page with a Categories Field make a &lt;code&gt;craft.categories&lt;/code&gt; call using &lt;code&gt;relatedTo(entry)&lt;/code&gt; as a parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Save the Category Model / -Models to a var outside your &lt;code&gt;nav&lt;/code&gt; loop, so you don't have to make those requests multiple times. And make sure to save the one Category Model on category pages as an array &lt;code&gt;[myCategoryModel]&lt;/code&gt;, so you always end up with your variable being of the same type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within you &lt;code&gt;nav&lt;/code&gt; loop you can now check, if the Category Model of your current loop iteration is within your saved array using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;in&lt;/code&gt;&lt;/a&gt; containment operator.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Is this an entry page with a category field? #}&#xA;{% if entry is defined %}&#xA;    {% set currentCategoryIds = craft.categories.relatedTo(entry).ids() %}&#xA;{# Is this a category page? #}&#xA;{% elseif category is defined %}&#xA;    {% set currentCategoryIds = [category.id] %}&#xA;{# None of both? Set an empty array. #}&#xA;{% else %}&#xA;    {% set currentCategoryIds = [] %}&#xA;{% endif %}&#xA;&#xA;{% nav cat in craft.categories.group('artCats') %}&#xA;&#xA;    {% set class = cat.id in currentCategoryIds ? 'current' : '' %}&#xA;    {% set entryCount = craft.entries.relatedTo(cat).total() %}&#xA;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ cat.url }}&quot; class=&quot;{{ class }}&quot;&amp;gt;{{ cat.title }} ({{ entryCount }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-17T12:37:18.597" LastActivityDate="2015-02-17T12:37:18.597" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="7177" PostTypeId="1" AcceptedAnswerId="7180" CreationDate="2015-02-16T16:18:25.943" Score="2" ViewCount="234" Body="&lt;p&gt;we have a page that can be accessed both via regular HTTP and HTTPS. We now stumbled across an issue that if a page has been loaded via HTTP (and the content has thus been cached) and another user tries to load the same page via HTTPS afterwards, the browser complains about loading non-secure content, as Craft serves the cached content (e.g. URLs to images) that was generated while accessing the page via HTTP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't the {% cache %} tag take the protocol into account when comparing URLs?&#xA;Is there a known workaround or best practice for handling this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clemens&lt;/p&gt;&#xA;" OwnerUserId="964" LastEditorUserId="125" LastEditDate="2015-05-29T14:59:24.093" LastActivityDate="2015-05-29T14:59:24.093" Title="Cache HTTP and HTTPS seperately using {% cache %}" Tags="&lt;cache&gt;&lt;https&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7178" PostTypeId="2" ParentId="7170" CreationDate="2015-02-16T18:01:31.957" Score="1" Body="&lt;p&gt;Try using &lt;code&gt;|without&lt;/code&gt; based on arrays of user IDs, not entire UserModel objects. Behind the scenes, it's just using PHP's &lt;a href=&quot;http://php.net/manual/en/function.in-array.php&quot; rel=&quot;nofollow&quot;&gt;in_array&lt;/a&gt; method, which works much better on simple primitives like ints, strings, etc. instead of complex objects like Models (that has magic methods, other objects, primitives, etc.).  in_array probably doesn't know how deep of a comparison to make on those objects.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-16T18:01:31.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7179" PostTypeId="2" ParentId="7177" CreationDate="2015-02-16T18:12:45.983" Score="2" Body="&lt;p&gt;Something like this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isSecure() %}&#xA;    {% set cacheKey = 'secure' %}&#xA;{% else %}&#xA;    {% set cacheKey = 'insecure' %}&#xA;{% endif %}&#xA;&#xA;{% cache using key cacheKey %}&#xA;    ...&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more info.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-16T18:12:45.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7180" PostTypeId="2" ParentId="7177" CreationDate="2015-02-16T18:13:50.427" Score="2" Body="&lt;p&gt;I've never done this, but you should be able to use the cache &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;using key&lt;/a&gt; parameter with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#isSecure&quot; rel=&quot;nofollow&quot;&gt;craft.request.isSecure&lt;/a&gt; property to do this.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;isSecure&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Whether the current request is over SSL.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key (craft.request.isSecure ? 'https': 'http') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-02-16T18:13:50.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7181" PostTypeId="2" ParentId="7172" CreationDate="2015-02-16T18:27:15.297" Score="4" Body="&lt;p&gt;You would most likely want to add a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; to your custom plugin, with an 'action' method designed to handle the url request and generate a user; using 'post' or 'get' to pass parameters to the controller action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the controller action, you can access your parameters using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = craft()-&amp;gt;request-&amp;gt;getParam('username');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then populate a new User Model using the passed params and save the model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;&#xA;$user-&amp;gt;username   = $username;&#xA;$user-&amp;gt;email      = $email;&#xA;$user-&amp;gt;firstName  = $firstName;&#xA;$user-&amp;gt;lastName   = $lastName;&#xA;$user-&amp;gt;getContent()-&amp;gt;setAttributes([ &#xA;    'customField' =&amp;gt; $customFieldValue&#xA;]);&#xA;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;// We now have a user Id, so assign user to a group&#xA;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;&#xA;// or to multiple groups&#xA;//craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, [$groupId, $otherGroupId]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, by default, controller actions are only accessible to logged-in users. If you want to allow anonymous access you would need to specifically allow it using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;$allowAnonymous property&lt;/a&gt;. This definitely introduces some security issues however, so proceed with caution. For example: definitely do not just assign user group(s) blindly from passed parameters or someone might be able to give themselves admin access!&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="480" LastEditDate="2017-03-16T20:31:29.870" LastActivityDate="2017-03-16T20:31:29.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7183" PostTypeId="2" ParentId="7175" CreationDate="2015-02-16T19:39:03.430" Score="2" Body="&lt;p&gt;One option would be to use &lt;code&gt;leftJoin()&lt;/code&gt; instead of &lt;code&gt;join()&lt;/code&gt;, which will still return the record if the joining table row doesn't exist. The values will be joined as &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.w3schools.com/sql/sql_join_left.asp&quot; rel=&quot;nofollow&quot;&gt;http://www.w3schools.com/sql/sql_join_left.asp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you needed more control, you could always incorporate some aggregate functions in SQL to do a count an the records found, and you could perform additional conditional statements with the &lt;code&gt;HAVING&lt;/code&gt;, instead of &lt;code&gt;WHERE&lt;/code&gt; (which won't work) since aggregate data isn't stored in the db.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-02-16T19:39:03.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7184" PostTypeId="2" ParentId="7157" CreationDate="2015-02-16T19:52:39.607" Score="2" Body="&lt;p&gt;Not 100% sure what is going wrong here, but here is what I would do to debug this on my end:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Simply output the current path the template parser is using in the controller and event handler to see the difference in the values&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump(craft()-&amp;gt;path-&amp;gt;getTemplatesPath());&#xA;exit();&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the values are different, you can override the value to do your parsing as your need it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the current path and save it&#xA;$oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;&#xA;// Set your desired template path&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath('your/new/path');&#xA;&#xA;// Render your template and pass some data to it that will be parsed&#xA;craft()-&amp;gt;templates-&amp;gt;render('your/template', $data = array());&#xA;&#xA;// Set the old path so Craft can resume as normal and you don't break stuff&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One other option is to try to include your macro like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'myplugin/_macros/mymacro' as mymacro % }&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I basically do the exact same thing you are doing with &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster for Craft&lt;/a&gt;. I include my own macros, parse templates and strings during event handlers, it all works perfectly for me using the technique I outlined above. Feel free to take a look at my code if you want to see some more advanced examples of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a side note, I bet Postmaster will do exactly what you want to do in regards to sending an email for new entries. You should give it a shot, it has loads of additional features I bet you could use. No less, I do help this solve your problem either way. Sorry this wasn't really an official answer or a guaranteed fix, but I gave it my best shot without seeing all of your code.&lt;/p&gt;&#xA;" OwnerUserId="19" LastEditorUserId="19" LastEditDate="2015-02-16T20:00:05.437" LastActivityDate="2015-02-16T20:00:05.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7185" PostTypeId="1" AcceptedAnswerId="7200" CreationDate="2015-02-16T20:00:04.303" Score="4" ViewCount="703" Body="&lt;p&gt;I have a template which loops through Matrix Blocks. The site itself correctly ignores any Blocks which are 'disabled', but on viewing the page in the Live Preview, those Blocks are visible. A key part of the reason for using Craft as the CMS for this site was the draw of the Live Preview, so this is important for us to get right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see anything as part of a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow&quot;&gt;Matrix Block Model&lt;/a&gt; which would indicate an assigned status to each Block which I could access. If there was, as there is with a straight entry, I could at least do some sort of a work around e.g. forcing the collation of Blocks to only those with a particular status of 'enabled'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This feels like it might just be a bug; I am seeing other complications with this particular Live Preview, for instance if any offset or limit is given to the Blocks, rearranging the blocks in the Live Preview has no effect either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could shed some light / offer some advice that would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2015-02-17T06:33:27.207" Title="Is it possible to prevent disabled Matrix Blocks showing in a Live Preview?" Tags="&lt;matrix&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7186" PostTypeId="1" AcceptedAnswerId="7192" CreationDate="2015-02-16T20:48:31.203" Score="1" ViewCount="665" Body="&lt;p&gt;I want to create an entry in an existing channel via a webhook from zoho crm. It's pretty straightforward. Like many apps, Zoho's webhook allows you to specify destination url, the method (get or post), and what parameters to pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to create a plugin to receive this form post or is there another way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a plugin newbie, so any links on where to start would be helpful.&lt;/p&gt;&#xA;" OwnerUserId="1020" LastActivityDate="2015-02-16T22:07:34.037" Title="How to create entry from external app webhook?" Tags="&lt;entry&gt;&lt;post&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7187" PostTypeId="1" AcceptedAnswerId="11447" CreationDate="2015-02-16T20:48:42.660" Score="3" ViewCount="1447" Body="&lt;p&gt;I have a multi-locale site set up with the different locales in different domains&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;phoseon.craft.dev - English site&lt;/li&gt;&#xA;&lt;li&gt;phoseon.it.craft.dev - Italian site&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having problems getting Live Preview to work with a locale other than English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page I am trying to get this to work on, &lt;code&gt;test-single&lt;/code&gt;, is a single, with a template that just displays the title (so no complexity there).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to use Live Preview in a locale other than English, I get this error in the console:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at &lt;a href=&quot;http://phoseon.it.craft.dev/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://phoseon.it.craft.dev/&lt;/a&gt;. This can be fixed by moving the resource to the same domain or enabling CORS.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And no Live Preview, just a white screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/a/430/130&quot;&gt;this answer&lt;/a&gt; I added this to .htaccess for &lt;a href=&quot;http://phoseon.it.craft.dev&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://phoseon.it.craft.dev&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header add Access-Control-Allow-Origin &quot;http://phoseon.craft.dev&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now I see these requests, and still a white screen for the Live Preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://phoseon.it/craft.dev/test-single 302 Found&#xA;  Request Headers:&#xA;    Accept  */*&#xA;    Accept-Encoding gzip, deflate&#xA;    Accept-Language en-US,en;q=0.5&#xA;    Content-Length  198&#xA;    Content-Type  application/x-www-form-urlencoded; charset=UTF-8&#xA;    Host  phoseon.it.craft.dev&#xA;    Origin  http://phoseon.craft.dev&#xA;    Referer http://phoseon.craft.dev/admin/entries/testSingle/1742-testsingle/it_it&#xA;    User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:35.0) Gecko/20100101 Firefox/35.0&#xA;  Response Headers:&#xA;    Access-Control-Allow-Orig...  http://phoseon.craft.dev&#xA;    Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0&#xA;    Connection  Keep-Alive&#xA;    Content-Encoding  gzip&#xA;    Content-Length  2346&#xA;    Content-Type  text/html&#xA;    Date  Mon, 16 Feb 2015 20:38:14 GMT&#xA;    Expires Thu, 19 Nov 1981 08:52:00 GMT&#xA;    Keep-Alive  timeout=5, max=100&#xA;    Location  http://phoseon.it.craft.dev/login&#xA;    Pragma  no-cache&#xA;    Server  Apache/2.2.26 (Unix) DAV/2 PHP/5.4.30 mod_ssl/2.2.26 OpenSSL/0.9.8zc&#xA;    Set-Cookie  CraftSessionId=gtm75r2a9it49820uueam9hpe2; path=/; HttpOnly&#xA;    Vary  User-Agent,Accept-Encoding&#xA;    X-Powered-By  PHP/5.4.30&#xA;&#xA;  And the response is the site's 404 page&#xA;&#xA;GET http://phoseon.it.craft.dev/login 404 Not Found&#xA;  Request Headers:&#xA;    Accept  */*&#xA;    Accept-Encoding gzip, deflate&#xA;    Accept-Language en-US,en;q=0.5&#xA;    Content-Type  application/x-www-form-urlencoded; charset=UTF-8&#xA;    Host  phoseon.it.craft.dev&#xA;    Origin  http://phoseon.craft.dev&#xA;    Referer http://phoseon.craft.dev/admin/entries/testSingle/1742-testsingle/it_it&#xA;    User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:35.0) Gecko/20100101 Firefox/35.0&#xA;  Response Headers:&#xA;    Access-Control-Allow-Orig...  http://phoseon.craft.dev&#xA;    Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0&#xA;    Connection  close&#xA;    Content-Encoding  gzip&#xA;    Content-Length  42163&#xA;    Content-Type  text/html; charset=utf-8&#xA;    Date  Mon, 16 Feb 2015 20:38:14 GMT&#xA;    Expires Thu, 19 Nov 1981 08:52:00 GMT&#xA;    Pragma  no-cache&#xA;    Server  Apache/2.2.26 (Unix) DAV/2 PHP/5.4.30 mod_ssl/2.2.26 OpenSSL/0.9.8zc&#xA;    Set-Cookie  CraftSessionId=isldd40afpu41mr9as659f6rs7; path=/; HttpOnly&#xA;    Vary  User-Agent,Accept-Encoding&#xA;    X-Powered-By  PHP/5.4.30&#xA;    charset utf-8&#xA;&#xA;  And the response is agin the site's 404 page&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone else encountered this? Know what's going on? Recommended fixes?&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-02-08T02:12:26.003" Title="Multi locale, multi-domain Live Preview failing" Tags="&lt;htaccess&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7188" PostTypeId="1" AcceptedAnswerId="7190" CreationDate="2015-02-16T20:55:16.423" Score="1" ViewCount="414" Body="&lt;p&gt;The documentation doesn't say much about it, only &lt;a href=&quot;http://buildwithcraft.com/help/locale-data-from-templates&quot; rel=&quot;nofollow&quot;&gt;How to access it&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I'm trying to achieve here?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Display entries only related to a locale.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'll present it you with an example.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 3 targeted locales enabled in 3 sections. 1 entry in each section, created by 3 local users. So math says, that one locale has 3 entries, where the whole example.com has 9 entries together.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, When I try to index entries on selected section I get that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/section1/ -&gt; all entries from all locales are outputted, because entries are targeted in all locales of a section.&lt;/li&gt;&#xA;&lt;li&gt;example.com/locale1/section1/ -&gt; the same situation as with example.com/section1/, except with two differences, that entries's URL has /locale1/section1/{slug} and the locale is matched with active one.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've looked into database, and all entries published are linked with each locale, even when Local User1 published to Local1 only. If that is gonna work, I don't know, if that will have any impact on storage efficiency.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-02-17T21:15:22.410" LastActivityDate="2015-02-23T12:57:14.903" Title="How to output entries related to a locale, IF a section is targeted to all locales?" Tags="&lt;entries&gt;&lt;localization&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7189" PostTypeId="2" ParentId="7185" CreationDate="2015-02-16T20:58:46.673" Score="1" Body="&lt;p&gt;According to Pixel &amp;amp; Tonic Support it is a known issue, submit the problem to PT Support to let them know it is a problem.&lt;/p&gt;&#xA;" OwnerUserId="828" LastEditorUserId="784" LastEditDate="2015-02-16T21:00:12.577" LastActivityDate="2015-02-16T21:00:12.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7190" PostTypeId="2" ParentId="7188" CreationDate="2015-02-16T21:15:04.137" Score="2" Body="&lt;p&gt;Craft always outputs entries in one locale only. If you really want to list all entries in all of their &lt;strong&gt;enabled locales&lt;/strong&gt; you would need to explicitly query for them using the &lt;code&gt;locale&lt;/code&gt; parameter and then merge the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What probably confuses you is that Craft automatically clones an entry on the first save to all other locales. Try to edit an entry / &lt;strong&gt;disable it for one locale only&lt;/strong&gt; and see the differences on you index pages!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really don't get the locale specific content for your different URL formats&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;example.com&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;example.com/locale1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there probably goes something wrong with your setup. The first thing I would check is the &lt;code&gt;index.php&lt;/code&gt; files (→ Localization guide – &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide#step-5-set-up-the-files&quot; rel=&quot;nofollow&quot;&gt;Step 5: Set up the files&lt;/a&gt;)!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-23T12:57:14.903" LastActivityDate="2015-02-23T12:57:14.903" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7191" PostTypeId="1" AcceptedAnswerId="8220" CreationDate="2015-02-16T22:01:54.210" Score="4" ViewCount="6215" Body="&lt;p&gt;I have a bit of code that checks if a page's title has been manually set in a parent template, and if it has to use that, otherwise to use &lt;code&gt;entry.title&lt;/code&gt;. This is what that bit looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set activeTitle %}&#xA;     {% if pageTitle is defined %}&#xA;         {{ pageTitle }}&#xA;     {% else %}&#xA;         {{ entry.title }}&#xA;     {% endif %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I however have some pages like so:&lt;br&gt;&#xA;&lt;a href=&quot;http://example.com/foo/text.html?sectionId=6&amp;amp;handle=bar&amp;amp;entryId=170&amp;amp;slug=somethingclever&quot; rel=&quot;nofollow&quot;&gt;http://example.com/foo/text.html?sectionId=6&amp;amp;handle=bar&amp;amp;entryId=170&amp;amp;slug=somethingclever&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the entry based on the parameters that are defined in the URL? And then use this entry's &lt;code&gt;entry.title&lt;/code&gt; to set my page title?&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="125" LastEditDate="2015-02-18T08:35:02.670" LastActivityDate="2015-02-18T08:42:29.847" Title="Determine Entry based on URL Parameters?" Tags="&lt;templating&gt;&lt;entry&gt;&lt;entrymodel&gt;&lt;params&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7192" PostTypeId="2" ParentId="7186" CreationDate="2015-02-16T22:07:34.037" Score="2" Body="&lt;p&gt;You would need to set this up using a plugin. The plugin would, at a minimum, contain a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt;, with an 'action' method designed to handle the url request and generate an entry; using 'post' or 'get' to pass parameters to the controller action.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionAddEntry()&#xA;{&#xA;    // retrieve parameters&#xA;    $title             = craft()-&amp;gt;request-&amp;gt;getParam('title');&#xA;    $customField1      = craft()-&amp;gt;request-&amp;gt;getParam('customField1');&#xA;    $customField2      = craft()-&amp;gt;request-&amp;gt;getParam('customField2');&#xA;&#xA;    // create a new entry model and set content attributes&#xA;    $entry = new entryModel();&#xA;    $entry-&amp;gt;sectionId  = 2; &#xA;    $entry-&amp;gt;typeId     = 2; &#xA;    $entry-&amp;gt;authorId   = 1; &#xA;    $entry-&amp;gt;enabled    = true;&#xA;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(     &#xA;        'title'        =&amp;gt; $title,     &#xA;        'customField1' =&amp;gt; $customField1,&#xA;        'customField2' =&amp;gt; $customField2,&#xA;    )); &#xA;&#xA;    // save entry&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    // handle success or failure&#xA;    if ($success) {&#xA;        // log result or send yourself an email or whatever&#xA;    } else {&#xA;        // log error&#xA;    }&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default however, controller actions are only accessible to logged-in users. If you want to allow anonymous access you would need to specifically allow it using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;$allowAnonymous property&lt;/a&gt;. This definitely introduces some security issues, so proceed with caution. Ideally you would want to set up some kind of authentication, or only accept requests from known hosts.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-16T22:07:34.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7193" PostTypeId="1" AcceptedAnswerId="8291" CreationDate="2015-02-16T22:07:36.757" Score="0" ViewCount="1133" Body="&lt;p&gt;This is essentially my first project with Craft and my plan is to take a personal photoblog and move it into Craft to learn how everything works before working with clients and craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got craft installed locally at testing.craft.dev and want to import my existing ExpressionEngine entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've renamed the default &quot;news section&quot; to photography, added a new image upload asset and field to the layout. All of which I can see when Igo to Entries &gt; Photography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to import the entries I found &lt;a href=&quot;https://github.com/clearbold/craftimport&quot; rel=&quot;nofollow&quot;&gt;Craft Import&lt;/a&gt;. I've installed this, created an xml file on my EE install.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;xml&amp;gt;&#xA;&amp;lt;blog&amp;gt;&#xA;{exp:channel:entries channel=&quot;photoblog&quot; show_future_entries=&quot;yes&quot; limit=&quot;500&quot;}&#xA;&amp;lt;entry&amp;gt;&#xA;    &amp;lt;entry_date&amp;gt;{entry_date}&amp;lt;/entry_date&amp;gt;&#xA;    &amp;lt;title&amp;gt;{title}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;slug&amp;gt;{url_title}&amp;lt;/slug&amp;gt;&#xA;    &amp;lt;post&amp;gt;&amp;lt;![CDATA[{description}]]&amp;gt;&amp;lt;/post&amp;gt;&#xA;    &amp;lt;images&amp;gt;&#xA;    {photos}&#xA;        {image}&#xA;    {/photos}&#xA;    &amp;lt;/images&amp;gt;&#xA;&amp;lt;/entry&amp;gt;&#xA;{/exp:channel:entries}&#xA;&amp;lt;/blog&amp;gt;&#xA;&amp;lt;/xml&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also set the url to this xml file on line 17 of services/craftservice.php. Where I'm stuck is that I now need to &lt;strong&gt;Update Lines 64-73 to match your Craft configuration and source nodes. Reference inline comments.&lt;/strong&gt; Those lines are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Find these in craft/app/models/EntryModel&#xA;    $entry-&amp;gt;sectionId = $sectionId;&#xA;    $entry-&amp;gt;typeId = $typeId; &#xA;    $entry-&amp;gt;authorId = 1; // 1 for Admin&#xA;    $entry-&amp;gt;enabled = true;&#xA;    $entry-&amp;gt;postDate = $importEntry-&amp;gt;entry_date;&#xA;    $entry-&amp;gt;slug = $importEntry-&amp;gt;slug;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'title' =&amp;gt; $importEntry-&amp;gt;title,&#xA;        'post' =&amp;gt; $post&#xA;    ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I have no idea what I need to put in here. Any advice would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it stands if I try to load entry I get an error, no surprise there.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base&#xA;  table or view not found: 1146 Table 'crafttest.craft_entries_i18n'&#xA;  doesn't exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="193" LastActivityDate="2015-02-20T15:51:45.630" Title="Importing Entries from ExpressionEngine" Tags="&lt;plugins&gt;&lt;import&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7194" PostTypeId="1" AcceptedAnswerId="7196" CreationDate="2015-02-16T22:13:17.217" Score="5" ViewCount="3313" Body="&lt;p&gt;I'm loading a set of entries related to 'category' and ordering them by the value of a Dropdown field in the entries. This work well using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).order('myDropdownField') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I need to change the Dropdown field to a Category field, but I am not able to sort my entries by this new category field by swapping the dropdown with the category field like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).order('myNewCatField') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'departmentCat' in 'order clause'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I also tried to use the Craft &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;noreferrer&quot;&gt;group&lt;/a&gt; filter, but I could not make it work in my setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="828" LastActivityDate="2015-02-16T23:23:27.987" Title="Order entries by category field" Tags="&lt;categories&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7195" PostTypeId="2" ParentId="7194" CreationDate="2015-02-16T22:41:49.177" Score="2" Body="&lt;p&gt;As far as I'm aware, you can only order by columns in the content table. Relationships (like categories) are stored in a separate table, and are returned as arrays (or array-like objects in the case of ElementCriteriaModels) and thus not really possible to sort on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you may need to do is use both 'category' and 'departmentCat' in the ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set departmentCategories = craft.categories.group('departmentCat') %}&#xA;{% for departmentCategory in departmentCategories %}&#xA;    {% set entries = craft.entries.relatedTo(&#xA;        'and', &#xA;        { targetElement: category }, &#xA;        { targetElement: departmentCategory }&#xA;    ).orderBy('title) %}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-16T22:41:49.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7196" PostTypeId="2" ParentId="7194" CreationDate="2015-02-16T23:23:27.987" Score="9" Body="&lt;p&gt;Here's a solution using the group filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesGrouped = craft.entries.relatedTo(category).order('title')|group('myNewCategoriesField.first().title') %}&#xA;&#xA;{% for group in entriesGrouped %}&#xA;    {% for entry in group %}&#xA;&#xA;        {# ... #}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-16T23:23:27.987" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7197" PostTypeId="1" AcceptedAnswerId="7198" CreationDate="2015-02-17T00:21:11.323" Score="2" ViewCount="1146" Body="&lt;p&gt;This is the desired code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl('newsImageHalfWidth') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works. However I want the transform name to be replaced by the contents of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.newsImageSize&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in a kind of pseudocode it would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl('{{entry.newsImageSize}}') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which of course does not work.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-02-17T00:34:54.560" Title="How do I reference a variable/expression inside an expression in twig templating?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7198" PostTypeId="2" ParentId="7197" CreationDate="2015-02-17T00:34:54.560" Score="2" Body="&lt;p&gt;With Twig, you'll never need to nest tags within other tags. In fact, it's impossible to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simply pass your variable into &lt;code&gt;getUrl&lt;/code&gt; &lt;strong&gt;instead&lt;/strong&gt; of using a string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl(entry.newsImageSize) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-02-17T00:34:54.560" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7199" PostTypeId="2" ParentId="7170" CreationDate="2015-02-17T03:30:24.020" Score="1" Body="&lt;p&gt;Hey Sam the answer is in your own dump file. Just look at the userModel Numbers in userFollowing, userFollowers and friends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UserFollowing has [379, 381, 393], &#xA;UserFollowers has [446, 454] and &#xA;friends has [379, 381]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Friends has the same numbers as userFollowing but not the same as userFollowers. Hence when you do the without filter on userFollowers you are basically doing&#xA;[446, 454]|without([379, 381])&#xA;Which will ofcourse return [446, 454]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could ofcourse get the username out for each model and perform the operations on that and since those would be strings this would work.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-02-17T03:30:24.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7200" PostTypeId="2" ParentId="7185" CreationDate="2015-02-17T05:52:41.970" Score="5" Body="&lt;p&gt;It's definitely a bug in live preview but looks like you can work around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't appear documented at all—so be careful—but you can use &lt;code&gt;.status()&lt;/code&gt; to get the block's status. It looks like an IF block is enough to get a matrix block to refresh the live preview.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%for block in entry.matrixBlock %}&#xA;   {% if ( block.type == 'supertable' and block.status == 'enabled') %}&#xA;  {#do whatever #}&#xA;   {%endif %}&#xA;{%endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found out about .status out awhile back messing around trying to figure out if there was a good way to display a &quot;sold out&quot; status for a particular show date (for example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%for thedate in entry.showDates.type('date').status() %}&#xA;&#xA;    {% if thedate.status() == 'disabled' %}&#xA;        &amp;lt;strike&amp;gt;{{thedate.showDate|date('m/d/y')}}&amp;lt;/strike&amp;gt; SOLD OUT! &#xA;    {% else %}&#xA;        {{thedate.showDate|date('m/d/y')}}&#xA;    {%endif%}&amp;lt;br&amp;gt;&#xA;&#xA;{%endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-02-17T06:33:27.207" LastActivityDate="2015-02-17T06:33:27.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7201" PostTypeId="1" CreationDate="2015-02-17T07:17:14.410" Score="0" ViewCount="365" Body="&lt;p&gt;When I use this code (taken straight from the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#redirecting-after-submit&quot; rel=&quot;nofollow&quot;&gt;readme&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;contact/thanks?from={fromName}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The emails sends fine and I get redirected to the page as expected however the url in the title bar is exactly that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://ontherocks.dev/contact/thanks?from={fromName}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this line also straight from the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#redirecting-after-submit&quot; rel=&quot;nofollow&quot;&gt;readme&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Thanks for sending that in, {{ craft.request.getQuery('from') }}!&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;renders as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Thanks for sending that in, {fromName},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No idea what I'm doing wrong, problem something glaringly simple.&#xA;Anyone care to shed some light on the correct way to do this?&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-13T05:27:34.617" LastActivityDate="2015-08-13T05:27:34.617" Title="Redirect URL variables with ContactForm plugin" Tags="&lt;redirect&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7202" PostTypeId="1" CreationDate="2015-02-17T08:14:26.040" Score="3" ViewCount="193" Body="&lt;p&gt;When requesting the control panel I get the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to a member function getTimeFormat() on a non-object in&#xA;/craft/app/etc/requirements/RequirementsChecker.php on line 103&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apparently  &lt;code&gt;craft()-&amp;gt;locale&lt;/code&gt; is null, but I have no idea why this is the case. I'm running craft locally, on &lt;a href=&quot;http://[PROJECT].craft.dev/&quot; rel=&quot;nofollow&quot;&gt;http://[PROJECT].craft.dev/&lt;/a&gt; and installed the Pro version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: this turned out to be a too restrictive gitignore file, ignoring the craft/app/framework/i18n/data folder&lt;/p&gt;&#xA;" OwnerUserId="2316" LastEditorUserId="2316" LastEditDate="2015-04-30T09:47:18.363" LastActivityDate="2018-03-03T19:19:54.773" Title="craft()-&gt;locale-&gt;getTimeFormat() throws Fatal error" Tags="&lt;control-panel&gt;&lt;localization&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7203" PostTypeId="1" CreationDate="2015-02-17T13:30:57.977" Score="1" ViewCount="684" Body="&lt;p&gt;I am managing Tags in Craft. For example, I have a tag called Theme with entries Light, Dark, Grayscale, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to list all tag entries and then toggle their status on/off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added Theme as a tag and created a field layout as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q117G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I now list the tags to access this field?&lt;/p&gt;&#xA;" OwnerUserId="2317" LastActivityDate="2015-02-20T07:04:47.973" Title="Tag: Field Layout" Tags="&lt;tags&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8203" PostTypeId="2" ParentId="7203" CreationDate="2015-02-17T15:05:33.533" Score="2" Body="&lt;p&gt;Craft treats all element types as equal: assets, categories, entries, tags and users. This means that each of these element types can have their own set of custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, you may well not need to create custom fields for things like tags or categories, but it's useful to be able to add them if you need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field layout for a Tag is used for applying custom data fields to each tag, such as a description, not for storing the name of the tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use tags in your Craft site, you must first &lt;a href=&quot;http://buildwithcraft.com/docs/tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a tag group&lt;/a&gt; for each different group of tags you want to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, add a &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;tags field&lt;/a&gt;  and assign it to the entry types that you want to tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when you are adding the content for each entry, you will be able to add a relation to the tag you want to assign to that entry by clicking the plus button in the tags field and typing the name of the tag you want to assign to the entry. As you type a pop-up menu appears showing you the matching existing tags in the system. The last entry in this menu adds the current typed name as a new tag to the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zMFNu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-02-17T15:05:33.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8204" PostTypeId="1" AcceptedAnswerId="8205" CreationDate="2015-02-17T15:56:00.997" Score="3" ViewCount="268" Body="&lt;p&gt;I'm working on a plugin that needs to encrypt some user data. I'm setting an encryption key for SecurityService, but am trying to decide where to store that encryption key so it can be used on subsequent requests to decrypt the data. A few options are coming to mind:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;StatePersister:&lt;/strong&gt; this is where Craft keeps its cookie validation key, but is &lt;a href=&quot;http://buildwithcraft.com/help/craft-storage-gitignore&quot; rel=&quot;nofollow&quot;&gt;likely to be ignored by .gitignore&lt;/a&gt;, so probably wouldn't be persistent for long.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Plugin Settings Table:&lt;/strong&gt; this is the approach being used by the &lt;a href=&quot;https://github.com/t3kila/SecureField-Craft/blob/master/secureField/secureFieldPlugin.php&quot; rel=&quot;nofollow&quot;&gt;SecureField Plugin&lt;/a&gt;. It's very straightforward, but also minimally secure as pretty much any SQL injection attack would compromise the key &lt;em&gt;and&lt;/em&gt; its encrypted data. The upside is that the key's persistence is practically guaranteed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extend CStatePersister:&lt;/strong&gt; This could be used to persist state in a writable location of my plugin's folder. It's more likely that this would be preserved in version control, but &lt;em&gt;not&lt;/em&gt; very likely that the location will be writable on a production server.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As it stands, storing the key in the database is the most likely to work on a wide variety of servers, but probably has the poorest level of security. Am I missing any other options? &lt;/p&gt;&#xA;" OwnerUserId="3317" LastActivityDate="2015-02-17T18:10:13.480" Title="Where should an encryption key be stored?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8205" PostTypeId="2" ParentId="8204" CreationDate="2015-02-17T18:10:13.480" Score="2" Body="&lt;p&gt;I'm hardly a security expert but if someone can get to your filesystem or your db, you'd be screwed either way—so what you're really doing is technically obfuscation and not really encryption. Ideally you'd do the crypto on a different server or have a hardware module that does the encryption and sends the result back but that solution probably won't work here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you mentioned, if you're storing data in the database, don't keep your key in the db. That would be like taping the combination to the outside of a safe. If someone got a dump of the database, they'd be able to use the key to decrypt the data, obviously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep it simple. I'd probably opt for somewhere in the filesystem, like in your plugin's config for example. Leave the key blank until you're ready to use the plugin for production and then have the user fill in the value... maybe with something like &lt;a href=&quot;http://api.wordpress.org/secret-key/1.1/&quot; rel=&quot;nofollow&quot;&gt;WordPress's Secret key generator&lt;/a&gt;... that way, nobody has the same key even if someone were to get a copy of your plugin's source code.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-02-17T18:10:13.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8206" PostTypeId="1" AcceptedAnswerId="8210" CreationDate="2015-02-17T19:05:59.373" Score="1" ViewCount="79" Body="&lt;p&gt;What approach should I take to create a list of previously viewed entries? Including the ability display the list, remove an entry from the list or delete the whole list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The previously viewed entries list would only exist for the duration of a visit.&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-02-17T20:29:55.983" Title="How can I list previously viewed entries?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8207" PostTypeId="1" AcceptedAnswerId="8213" CreationDate="2015-02-17T19:20:36.467" Score="1" ViewCount="1171" Body="&lt;p&gt;I have tried to follow the instructions listed &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;here for checkboxes on frontend forms&lt;/a&gt; but have not been successful in implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;&amp;lt;h3&amp;gt;Push to GistServers for Gist {{ entry.id }}&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;gistClient/pushGistUnits&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&amp;lt;p&amp;gt;Select Gist Categories for Distribution.&amp;lt;/p&amp;gt;&#xA;{% if entry.gistCategories | length == 0 %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for option in entry.gistCategories.options %}&#xA;        &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ option.value }}&quot; name=&quot;fields[gistCategories][]&quot;&amp;gt; {{ option.label }}&amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}    &#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for checkboxOption in entry.gistCategories %}&#xA;        {% set checked = false %}&#xA;&#xA;        {% if checkboxOption.selected %}&#xA;            {% set checked = true %}&#xA;&#xA;        {% endif %}&#xA;&#xA;        {% if not checked %}&#xA;            &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ checkboxOption.value }}&quot; name=&quot;fields[gistCategories][]&quot; {% if checked %} checked=&quot;checked&quot;{% endif %}&amp;gt;{{ checkboxOption.label }}&amp;lt;br&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ checkboxOption.value }}&quot; name=&quot;fields[gistCategories][]&quot; {% if checked %} checked=&quot;checked&quot;{% endif %}&amp;gt;{{ checkboxOption.label }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{%endif%}&#xA;&#xA;{{ getCsrfInput() }}&#xA;{% if entry.socialPush == true %}&#xA;    {% set socialPush = &quot;Push to GistServers&quot;%}&#xA;    {% set socialPushBtn = &quot;default&quot;%}&#xA;{% else %}&#xA;    {% set socialPush = &quot;Push to GistServers&quot;%}&#xA;    {% set socialPushBtn = &quot;success&quot;%}&#xA;{% endif %}&#xA;&#xA;&amp;lt;button class=&quot;btn btn-{{socialPushBtn}}  btn-sm btn &quot; style=&quot;margin:10px 15px 0 0;&quot; type=&quot;submit&quot; name=&quot;fields[gistDraft]&quot; value=&quot;0&quot;&amp;gt;{{ socialPush }}&amp;lt;/button&amp;gt;&#xA;&amp;lt;/div&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for screen caps showing behavior. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before form submit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vaylr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CP View after form submit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vpFIq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frontend form after submit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XC7I6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, After I submit the frontend form my users would be able to see all checkboxes again in case they need to change the selections. I am at a loss and would appreciate some rescue here.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-02-17T20:58:52.070" Title="Getting Checkboxes to work on Frontend Forms" Tags="&lt;frontend&gt;&lt;checkboxes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8208" PostTypeId="1" AcceptedAnswerId="8211" CreationDate="2015-02-17T19:38:50.023" Score="4" ViewCount="731" Body="&lt;p&gt;Is there a way to delete an entry's assets when the entry is deleted? We're going to end up with a lot of orphaned assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is this not a feature because an asset can be shared between entries? Thus requiring me to write a plugin to tie into the onDeleteEntry event (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/797/where-and-how-should-you-listen-for-entry-delete-in-plugin&quot;&gt;Where and how should you listen for entry delete in plugin?&lt;/a&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="244" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-06-30T03:16:37.757" Title="Delete entry assets?" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8209" PostTypeId="1" AcceptedAnswerId="8217" CreationDate="2015-02-17T20:23:54.717" Score="5" ViewCount="429" Body="&lt;p&gt;Suppose I have a section for Products, that uses the template at products/_entry and is set up to have the URL format of 'products/{slug}'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our existing page structure shows a Product page when you go to the URL (such as &lt;code&gt;example.com/products/cool_product&lt;/code&gt;, but we also have a sub-page for &quot;Product Details&quot; which we would get to (using the previous example) by going to &lt;code&gt;example.com/products/cool_product/details&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is something like this possible with Craft routes? I've tried adding a route in &lt;code&gt;craft/config/routes.php&lt;/code&gt; that looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'products/&amp;lt;slug&amp;gt;/details' =&amp;gt; 'products/_details'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however that doesn't do what I'd expect, which is load the product entry using that slug and display the template (which would in turn display the relevant data from that product entry)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to have something in my &lt;code&gt;_layout.html&lt;/code&gt; that catches such a request somehow? I'm a bit confused I guess. I suppose I can handle the request a bit more manually in the template by parsing the request and loading the product that way. I guess I'm hoping there is something a little more elegant (read: I'm lazy )&lt;/p&gt;&#xA;" OwnerUserId="2243" LastEditorUserId="2243" LastEditDate="2015-02-17T20:41:30.487" LastActivityDate="2015-02-18T18:54:45.500" Title="&quot;Subtemplates&quot; for entry using routing?" Tags="&lt;templating&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8210" PostTypeId="2" ParentId="8206" CreationDate="2015-02-17T20:29:55.983" Score="1" Body="&lt;p&gt;Craft doesn't have anything like an &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;onViewEntry&lt;/a&gt; event, which you could listen for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do it would be to have a plugin that listens for &lt;code&gt;onEndRequest&lt;/code&gt;. That plugin would determine if the current URI matches an entry and if so saves it to the database along with the userId.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could build a management page off of that info where you could remove from the history or delete it all-together.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-17T20:29:55.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8211" PostTypeId="2" ParentId="8208" CreationDate="2015-02-17T20:31:04.740" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Or is this not a feature because an asset can be shared between entries? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Bingo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plugin is way to go if that's the behavior you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-17T20:31:04.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8212" PostTypeId="2" ParentId="8207" CreationDate="2015-02-17T20:56:17.500" Score="2" Body="&lt;p&gt;Since the form was already submitted, your code is only looping through the checkboxes that were checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add &lt;code&gt;.options&lt;/code&gt; to your second &lt;code&gt;for&lt;/code&gt; block like you have above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for checkboxOption in entry.gistCategories.options %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That'll loop through all of 'em, checked or not.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-02-17T20:56:17.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8213" PostTypeId="2" ParentId="8207" CreationDate="2015-02-17T20:58:52.070" Score="3" Body="&lt;p&gt;The first loop you're using loops over &lt;code&gt;entry.gistCategories.options&lt;/code&gt;, which contains all the options available. However, in the second loop (when &lt;code&gt;entry.gistCategories|length !== 0&lt;/code&gt;), you're only looping over the options that have been selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.gistCategories | length == 0 %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for option in entry.gistCategories.options %}&#xA;            {# output checkboxes #}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}  &#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for checkboxOption in entry.gistCategories.options %}&#xA;            {# output checkboxes #}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3317" LastActivityDate="2015-02-17T20:58:52.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8214" PostTypeId="1" AcceptedAnswerId="8216" CreationDate="2015-02-17T21:26:40.167" Score="2" ViewCount="1096" Body="&lt;p&gt;I'm  trying to get the _POST data for my form in a plugin, and for whatever reason am unable to get the selected option from a select tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;form class=&quot;parseResults&quot; action=&quot;actions/MyPlugin/myFunctionAjax&quot; method=&quot;post&quot; name=&quot;submitResults&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;submission&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;view&quot;&amp;gt;View&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;submit&quot;&amp;gt;Submit&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;textarea rows=&quot;9&quot; cols=&quot;80&quot; name=&quot;content&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in my plugin, I can get the textarea form content like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $formContent = craft()-&amp;gt;request-&amp;gt;getPost('content');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I try to get the selected option from the #submission select, nothing returns&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $submissionType = craft()-&amp;gt;request-&amp;gt;getPost('submission');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing or doing wrong in order to get the selected option?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-02-17T21:59:07.807" LastActivityDate="2015-02-17T21:59:07.807" Title="Get _POST from Select element in Form" Tags="&lt;form&gt;&lt;php&gt;&lt;post&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8215" PostTypeId="2" ParentId="5074" CreationDate="2015-02-17T21:26:48.660" Score="3" Body="&lt;p&gt;Craft definitely doesn't give you these filtering tools when viewing a list of entries, but the building blocks exist within the framework to allow you to build your own solution. The most straightforward way I can think of would be to create a plugin with its own CP section and show the outstanding drafts there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get a list of all drafts with this little bit of PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EntryDraftRecord::model()-&amp;gt;findAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you expose the list of drafts using a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt;, you could then display links to each of them by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set drafts = craft.myPlugin.getAllDrafts() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for draft in drafts %}&#xA;    {% set draftEntry = craft.entries.getEntryById(draft.entryId)|first %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ draftEntry.getCpEditUrl() }}&quot;&amp;gt;{{ draftEntry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3317" LastActivityDate="2015-02-17T21:26:48.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8216" PostTypeId="2" ParentId="8214" CreationDate="2015-02-17T21:44:03.970" Score="2" Body="&lt;p&gt;Form elements need to have a name attribute. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;submission&quot; id=&quot;submission&quot;&amp;gt;&#xA;&amp;lt;option value=&quot;view&quot;&amp;gt;View&amp;lt;/option&amp;gt;&#xA;&amp;lt;option value=&quot;submit&quot;&amp;gt;Submit&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;textarea name=&quot;content&quot; rows=&quot;9&quot; cols=&quot;80&quot; id=&quot;content&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should do the trick! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-17T21:44:03.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8217" PostTypeId="2" ParentId="8209" CreationDate="2015-02-17T22:24:16.863" Score="6" Body="&lt;p&gt;You might check out the routing docs on &lt;a href=&quot;http://buildwithcraft.com/docs/routing#accessing-subpatterns-in-your-templates&quot; rel=&quot;nofollow&quot;&gt;accessing subpatterns in your templates&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example given in the docs (which provides the variables 'year' and 'month' to the template that correspond to the matched uri segments — which would match `news/2015/02'): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})' =&amp;gt; 'news/_archive',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I would presume you could do the same using your products (I'm terrible with regular expression though, so please check the match syntax).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'products/(?P&amp;lt;slug&amp;gt;[^/]+)/details' =&amp;gt; 'products/_details',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fyi, the variable is defined using &lt;code&gt;(?P&amp;lt;name&amp;gt;...)&lt;/code&gt;, where '...' is the pattern to match. So in this case the variable 'slug' (or whatever you defined it as in your regex pattern) should now be available as a variable in your template, which you can use to retrieve the entry. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('mySectionHandle').slug(slug).first() %}&#xA;{% if entry %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you create the link to that page you would naturally want to include the slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;products/{{ entry.slug }}/details&quot;&amp;gt;View details&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Untested.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-18T18:54:45.500" LastActivityDate="2015-02-18T18:54:45.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8218" PostTypeId="2" ParentId="7191" CreationDate="2015-02-17T23:06:22.713" Score="5" Body="&lt;p&gt;You can access 'post' or 'get' parameters using &lt;code&gt;craft.request.getParam('param')&lt;/code&gt;; and then use them to retrieve the corresponding entry. So, given the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/subsection/filename.html?id=&quot;170&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you would grab the param 'id', and use it to retrieve the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryId = craft.request.getParam('id') %}&#xA;{% set entry = craft.entries.id(entryId).first() %}&#xA;{% if entry %}&#xA;    {% set pageTitle = entry.title %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the use of &lt;code&gt;.first()&lt;/code&gt;. Results from &lt;code&gt;craft.entries&lt;/code&gt; are returned as an ElementCriteriaModel, which is an 'array-like' object, even if only one 'entry' is defined — &lt;code&gt;.first()&lt;/code&gt; returns the first element. To avoid errors if no entries are found matching the criteria, check that 'entry' exists before trying to access its properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, do not try and loop through an entry retrieved using &lt;code&gt;.first()&lt;/code&gt;, which will also throw an error. &lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-17T23:06:22.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8219" PostTypeId="2" ParentId="2816" CreationDate="2015-02-18T06:23:38.143" Score="3" Body="&lt;p&gt;Check and make sure your .htaccess file is in your public HTML folder &lt;code&gt;public/.htaccess&lt;/code&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not include your .htaccess file in your public folder, Craft will display your home page properly, but all other pages will fail to load unless you add &lt;code&gt;index.php?p=&lt;/code&gt; in your URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without &lt;code&gt;.htaccess&lt;/code&gt;:&lt;br&gt;&#xA;&lt;a href=&quot;http://website.com/mypagethatreallyexists&quot; rel=&quot;nofollow&quot;&gt;http://website.com/mypagethatreallyexists&lt;/a&gt; = 404&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without &lt;code&gt;.htaccess&lt;/code&gt;:&lt;br&gt;&#xA;&lt;a href=&quot;http://website.com/index.php?p=mypagethatreallyexists&quot; rel=&quot;nofollow&quot;&gt;http://website.com/index.php?p=mypagethatreallyexists&lt;/a&gt; = Your page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;.htaccess&lt;/code&gt;:&lt;br&gt;&#xA;&lt;a href=&quot;http://website.com/mypagethatreallyexists&quot; rel=&quot;nofollow&quot;&gt;http://website.com/mypagethatreallyexists&lt;/a&gt; = Your page&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-18T06:23:38.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8220" PostTypeId="2" ParentId="7191" CreationDate="2015-02-18T08:28:09.237" Score="6" Body="&lt;p&gt;This is a longer version answer (code wise) to the one Douglas already posted. He did a very nice job of explaining how to get a URL parameter and what to pay attention to handling the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try to show you how to build a query from multiple unknown params, so any of these combinations is possible and potentially return a single (and unique) Entry Model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://example.com/foo?sectionId=6&amp;amp;entryId=170&amp;amp;slug=somethingclever&quot;&gt;http://example.com/foo?sectionId=6&amp;amp;entryId=170&amp;amp;slug=somethingclever&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://example.com/foo?sectionId=6&amp;amp;slug=somethingclever&quot;&gt;http://example.com/foo?sectionId=6&amp;amp;slug=somethingclever&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://example.com/foo?entryId=170&quot;&gt;http://example.com/foo?entryId=170&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also tries to handle the case, the page already comes with an &lt;code&gt;entry&lt;/code&gt; variable pre-populated or there's already a &lt;code&gt;pageTitle&lt;/code&gt; set. So you don't do all the requests / logic on all of your pages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Only try parsing the params, if this page doesn't come with an `entry`&#xA; # var pre-populated and we don't already have `pageTitle` set.&#xA; #}&#xA;{% if not entry and pageTitle is not defined %}&#xA;&#xA;    {# Get URL params #}&#xA;    {% set entryId = craft.request.getParam('entryId') %}&#xA;    {% set entrySlug = craft.request.getParam('slug') %}&#xA;    {% set sectionId = craft.request.getParam('sectionId') %}&#xA;&#xA;    {# Default query #}&#xA;    {% set query = craft.entries %}&#xA;&#xA;    {# Add params to the query if they are not empty #}&#xA;    {% set query = not entryId ? query : query.id(entryId) %}&#xA;    {% set query = not entrySlug ? query : query.slug(entrySlug) %}&#xA;    {% set query = not sectionId ? query : query.sectionId(sectionId) %}&#xA;&#xA;    {# Now try to get that entry and set our own `entry` var #}&#xA;    {% set entry = query.first() %}&#xA;&#xA;{% endif %}&#xA;&#xA;{# Set the entry title. Also handle the case our query didn't find anything #}&#xA;{% set entryTitle = entry ? entry.title : 'Title for a page that doesn’t exist' %}&#xA;&#xA;{# Set the page's title #}&#xA;{% set activeTitle = pageTitle is defined ? pageTitle : entryTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Useful links for this code: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request&quot;&gt;&lt;code&gt;craft.request&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot;&gt;Ternary operator in Twig&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-18T08:42:29.847" LastActivityDate="2015-02-18T08:42:29.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8221" PostTypeId="1" AcceptedAnswerId="8222" CreationDate="2015-02-18T09:56:39.563" Score="1" ViewCount="187" Body="&lt;p&gt;I have a Blog where everything is on one template. The entries don't have an own url.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog') %}&#xA;    {# everything #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to give this page a title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could create a &lt;code&gt;single&lt;/code&gt; called Blog page to have a title and a url. But isn't that a bit much for just a title? I hate to have a &lt;code&gt;single&lt;/code&gt; with almost no content in the control panel.&#xA;Could there be a better way to add a title to that page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Globals?&#xA;Categories?&#xA;Something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you handle that?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-02-18T10:22:53.970" Title="Best practice for adding a title to a channel overview page" Tags="&lt;best-practice&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8222" PostTypeId="2" ParentId="8221" CreationDate="2015-02-18T10:22:53.970" Score="2" Body="&lt;p&gt;If there's only this one page, I'd probably also use a Global Set instead of a Single Section for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a Global Set with the handle &lt;code&gt;siteInfo&lt;/code&gt; and add a Plain Text field &lt;code&gt;title&lt;/code&gt; for your title to it, make sure to mark it as translatable. Then in your template access it via &lt;code&gt;{{ siteInfo.title }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good thing with this approach is that you can allow your client to edit the title (for all locales), without having her edit the template or the static translations file. And! You can later add other fields to it, e.g. for other site metadata (description, open graph, etc.) or to change the site's theme.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-18T10:22:53.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8223" PostTypeId="1" CreationDate="2015-02-18T11:57:08.457" Score="2" ViewCount="942" Body="&lt;p&gt;Is it possible to activate the following Twig extension from within a craft plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/date.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/extensions/date.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-02-18T12:12:53.307" Title="How do you add a core twig extension in plugins using addTwigExtension()?" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8224" PostTypeId="2" ParentId="8223" CreationDate="2015-02-18T12:12:53.307" Score="1" Body="&lt;p&gt;The Twig extension package is not included with your Craft install. So you need to &lt;a href=&quot;https://github.com/twigphp/Twig-extensions&quot; rel=&quot;nofollow&quot;&gt;download&lt;/a&gt; it and add it to your Craft plugin manually.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-18T12:12:53.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8225" PostTypeId="2" ParentId="6983" CreationDate="2015-02-18T12:13:37.003" Score="5" Body="&lt;p&gt;So it turned out that the distance column error was sending us down the wrong path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue was caused by 2 things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) As the original Craft entries query was using ids() any select string added via addSelect was being disregarded, the answer here was to move this logic into the having clause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The second issue that was preventing the having clause from working was a missing groupBy clause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The modifyRadiusQuery code in full:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function modifyRadiusQuery(DbCommand $query, $value)&#xA;{&#xA;    $settings = $this-&amp;gt;getSettings();&#xA;    $measurementUnit = $settings-&amp;gt;unit == 'mi' ? 3959 : 6371;&#xA;&#xA;    $geo = craft()-&amp;gt;logic-&amp;gt;stringToGeo($value['location']);&#xA;&#xA;    if($geo)&#xA;    {&#xA;        $haversine = $this-&amp;gt;haversine($geo['lat'], $geo['lng']);&#xA;&#xA;        // ids()&#xA;        $query-&amp;gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');&#xA;        $query-&amp;gt;having($haversine.' &amp;lt; '.$value['radius']);&#xA;        $query-&amp;gt;group('geo.lat, geo.lng');&#xA;&#xA;        // find()&#xA;        // $haversine = $this-&amp;gt;haversine($geo['lat'], $geo['lng']);&#xA;        // $query-&amp;gt;addSelect($haversine.' AS distance');    &#xA;        // $query-&amp;gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');&#xA;        // $query-&amp;gt;having('distance &amp;lt; '.$value['radius']);&#xA;        // $query-&amp;gt;group('geo.lat, geo.lng');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The DBCommand query that was fixed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $query-&amp;gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');&#xA;        $query-&amp;gt;having($haversine.' &amp;lt; '.$value['radius']);&#xA;        $query-&amp;gt;group('geo.lat, geo.lng');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-02-18T12:13:37.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8226" PostTypeId="1" AcceptedAnswerId="8228" CreationDate="2015-02-18T14:11:51.650" Score="6" ViewCount="1144" Body="&lt;p&gt;I have a site with 10000 events which need to expire once they have happened, the main reason for this is to keep things tidy in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need users to view events that they have completed after they have expired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to render these entries on the front end, without creating a custom route and changing the URL??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the listing is easy enough:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;done: user.eventsDoing.date('&amp;lt;'~ now|date('Y-m-d') ).order('date desc').status('expired')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2016-02-27T02:29:29.203" Title="Is it possible to view 'Expired' entrys on the front end?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8227" PostTypeId="1" CreationDate="2015-02-18T14:12:08.813" Score="2" ViewCount="159" Body="&lt;p&gt;I'd like to be able to select a user for a settings field for my plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a settings AttributeType that matches users? And a corresponding forms template for picking a user? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(also interesting would be picking assets/elements from a certain section)&lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="125" LastEditDate="2015-02-18T14:45:04.787" LastActivityDate="2015-02-18T14:45:04.787" Title="Plugin-settings form field for chosing a user?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;form&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8228" PostTypeId="2" ParentId="8226" CreationDate="2015-02-18T14:31:32.620" Score="7" Body="&lt;p&gt;I don't think you can enable the default Entry Routing for expired entries. So you need to add a custom route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To keep your current URLs, try to rebuild the default Entry Route with a custom one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;news/{slug}&lt;/code&gt;  →  &lt;code&gt;news/_entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expired entries shouldn't return 404 now any more and load your entry template. You now have to get the Entry Model manually though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').slug(slug).status('live, expired').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-27T02:29:29.203" LastActivityDate="2016-02-27T02:29:29.203" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8229" PostTypeId="2" ParentId="8227" CreationDate="2015-02-18T14:42:21.023" Score="2" Body="&lt;p&gt;Copying from the widgets settings I made something that sort of works: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define the setting to be type mixed: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;                 'jobsemail' =&amp;gt; array(AttributeType::Mixed, 'required'=&amp;gt;false),&#xA;                 );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then create a settings.html like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set userInput %}&#xA;    &amp;lt;div class=&quot;select&quot;&amp;gt;&#xA;        &amp;lt;select id=&quot;jobsemail&quot; name=&quot;jobsemail&quot;&amp;gt;&#xA;          &amp;lt;option value=&quot;&quot;&amp;gt;No one&amp;lt;/option&amp;gt;&#xA;            {% for user in craft.users.group('Admin') %}&#xA;          &amp;lt;option value=&quot;{{ user.id }}&quot;{% if user.id == settings.jobsemail %} selected{% endif %}&amp;gt;{{ user.name|t }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endset %}&#xA;&#xA;{{ forms.field({&#xA;    label: &quot;Email recipient&quot;|t,&#xA;    instructions: &quot;This person gets emailed when new jobs are added&quot;|t,&#xA;    id: 'jobsemail',&#xA;}, userInput) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives you a basic SELECT drop-down list. It's ok here, because the number of admin users is low. It would be less suitable if there were 100s of users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a better solution with a real pop-up element picker would be nice!&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-02-18T14:42:21.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8230" PostTypeId="1" AcceptedAnswerId="8231" CreationDate="2015-02-18T16:16:30.740" Score="1" ViewCount="428" Body="&lt;p&gt;We have a client that has a good deal of products in one channel. We're categorizing each product entry with a pretty extensive category tree. The reason we didn't go with a structure is because many products needed to exist in multiple categories and a structure tree would get messy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working great, but they now want to be able to re-order entries by category in the CP and we're sort of stuck. The new Category Sources plugin sort of gets us half way there but it doesn't allow you to reorder and save the order in any way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone run into this sort of issue? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="405" LastEditorUserId="405" LastEditDate="2015-02-18T17:28:27.193" LastActivityDate="2015-02-18T19:07:37.660" Title="Reordering entries tied to categories?" Tags="&lt;control-panel&gt;&lt;structure&gt;&lt;category&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8231" PostTypeId="2" ParentId="8230" CreationDate="2015-02-18T19:07:37.660" Score="3" Body="&lt;p&gt;If you reverse the relationship then you should be able to order the entries (i.e. add products to an entries field within the category, instead of adding categories to a categories field within the product).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of grabbing the products using &lt;code&gt;relatedTo(category)&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.section('products').relatedTo(category) %}&#xA;{% for product in products %}...{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you would be able to grab the products directly from the products entries field in the category using &lt;code&gt;category.productsFieldHandle&lt;/code&gt;, which should be returned in the order defined in the CP.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = category.productsEntriesFieldHandle %}&#xA;{% for product in products %}...{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-18T19:07:37.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8232" PostTypeId="1" AcceptedAnswerId="8234" CreationDate="2015-02-18T20:35:54.233" Score="2" ViewCount="378" Body="&lt;p&gt;I have custom fields for &lt;code&gt;altText&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt; on some asset image locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wondering if there is a good way to have those automatically added when a user puts in an image from a rich text field.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-12-21T16:42:38.620" Title="Adding alt text/title attributes to assets in a rich text field" Tags="&lt;assets&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8233" PostTypeId="1" AcceptedAnswerId="8235" CreationDate="2015-02-18T20:49:01.617" Score="1" ViewCount="519" Body="&lt;p&gt;I'm experiencing the problem that I can't upload large images. Very similar to this problem: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6521/craft-cms-max-image-resolution&quot;&gt;Craft CMS max image resolution?&lt;/a&gt; But I couldn't solve the problem so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is: Where do I have to place the &lt;code&gt;php.ini&lt;/code&gt; so the upload script knows about it? (My web hosters help pages tell me to upload the file in &lt;strong&gt;every&lt;/strong&gt; directory that need the ini files settings) I've tried &lt;code&gt;/craft/app&lt;/code&gt; (next to &lt;code&gt;index.php&lt;/code&gt; and &lt;code&gt;Craft.php&lt;/code&gt;) and &lt;code&gt;/htdocs&lt;/code&gt; (the web root).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus: I've tried to upload the exact same images to Craft at another web hoster where it works fine. But the limitations there are even stricter than where the problem occurs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means: if the location of the &lt;code&gt;php.ini&lt;/code&gt; was right the values of &lt;code&gt;post_max_size&lt;/code&gt;, &lt;code&gt;memory_limit&lt;/code&gt; and &lt;code&gt;max_execution_time&lt;/code&gt; are not the problem. Also it doesn't depend on the file size but on the image resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;image1.jpg | 703 x 951 pixels | ~850,000 Bytes &amp;rarr; &lt;em&gt;does work&lt;/em&gt;&lt;br&gt;&#xA;image2.jpg | 2520 x 1680 pixels | ~750,000 Bytes &amp;rarr; &lt;em&gt;doesn't work&lt;/em&gt;&lt;br&gt;&#xA;image2.jpg | save with same resolution as: &quot;image3.jpg&quot; &amp;rarr; &lt;em&gt;doesn't work&lt;/em&gt;&lt;br&gt;&#xA;image2.jpg | save with lower resolution as: &quot;image4.jpg&quot; &amp;rarr; &lt;em&gt;does work&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what else I could check to solve that problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="520" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-18T21:32:51.533" Title="Server requirements for uploading large images" Tags="&lt;assets&gt;&lt;image&gt;&lt;upload&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8234" PostTypeId="2" ParentId="8232" CreationDate="2015-02-18T21:27:26.750" Score="1" Body="&lt;p&gt;Nothing native that I can think of other than ditch the rich text field and use Matrix with a proper Assets field.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-18T21:27:26.750" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8235" PostTypeId="2" ParentId="8233" CreationDate="2015-02-18T21:32:51.533" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Where do I have to place the php.ini so the upload script knows about it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the same folder that Craft's public index.php lives in should be the only place it's required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can put a &lt;code&gt;phpinfo.php&lt;/code&gt; in that same folder with the contents &lt;code&gt;&amp;lt;?php phpinfo();&lt;/code&gt; and load that page in the browser to see if your php.ini changes have taken affect.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also it doesn't depend on the file size but on the image resolution.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because there isn't a 1:1 correlation because an images size on disk and how much RAM is required to load that image into memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;post_max_size&lt;/code&gt;, &lt;code&gt;memory_limit&lt;/code&gt; and &lt;code&gt;max_execution_time&lt;/code&gt; and &lt;code&gt;upload_max_filesize&lt;/code&gt; are usually the common culprits when dealing with uploading large files in PHP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-18T21:32:51.533" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8236" PostTypeId="1" AcceptedAnswerId="8238" CreationDate="2015-02-18T21:42:57.160" Score="1" ViewCount="673" Body="&lt;p&gt;I have a client that wants to create a short URL to an entry for a mail shot. What would be the best way to do this. I have the &lt;a href=&quot;http://viget.com/extend/reroute-plugin-for-craft&quot; rel=&quot;nofollow&quot;&gt;Reroute plugin&lt;/a&gt; installed which would work (setting to a 302 redirect) but I am wondering if that is the best approach. &lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2015-02-18T22:02:08.547" LastActivityDate="2015-02-18T22:34:31.320" Title="Whats the best way to create short URL's" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8237" PostTypeId="1" AcceptedAnswerId="8240" CreationDate="2015-02-18T22:33:00.097" Score="3" ViewCount="1447" Body="&lt;p&gt;We have only two templates leveraging the cache tag and they both have a construct similar to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;  {% cache globally using key entry.url ~ &quot;relatedArticles&quot; for 1 hour %}&#xA;    ... bunch of relational queries ...&#xA;  {% endcache %}&#xA;  ...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once or twice a day, the &lt;code&gt;DeleteStaleTemplateCaches&lt;/code&gt; get stuck and requires manual &quot;killing&quot;.  For example, when this occurs, the &lt;code&gt;craft_tasks&lt;/code&gt; table indicates say &lt;code&gt;currentStep&lt;/code&gt; 1309 of &lt;code&gt;totalSteps&lt;/code&gt; 12800...  Then, &quot;&lt;em&gt;error'ing&lt;/em&gt;&quot; the task, and choosing the &quot;&lt;em&gt;Retry task&lt;/em&gt;&quot;, generate a new job but will say only 670 &lt;code&gt;totalSteps&lt;/code&gt;...  and of course it succeeds.  Why is the total steps so much different on retry? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no clue in the logs.  Only the logs of the &quot;retried task&quot; that show the steps and its successful result.  Nothing about the stuck task that I killed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, we have 3 nodes sharing a common file system for all (except most of the &quot;runtime folder&quot;) and common database but individual memcached server (one per node).  Craft is configured to use memcached.  Could the issue be that more than one node start the delete task at the same time?  i.e. all try to cleanup the same db table?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beside this specific problem, I would be very grateful if you could explain how the different caching (data, templates, etc.)  works within craft or indicate where I can find the information. i.e. I'm not clear on what is cached in memcached vs the database, vs file system (if anything).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="985" LastActivityDate="2015-02-18T22:58:06.180" Title="DeleteStaleTemplateCaches job getting stuck" Tags="&lt;cache&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8238" PostTypeId="2" ParentId="8236" CreationDate="2015-02-18T22:34:31.320" Score="1" Body="&lt;p&gt;You could make a plugin that generates a short URL using a link-shortener API (e.g. &lt;a href=&quot;http://dev.bitly.com/code_libraries.html&quot; rel=&quot;nofollow&quot;&gt;dev.bitly&lt;/a&gt;) for each of your entries and provides the URL as a custom read-only Field Type.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-18T22:34:31.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8240" PostTypeId="2" ParentId="8237" CreationDate="2015-02-18T22:58:06.180" Score="3" Body="&lt;p&gt;See these for help debugging stuck tasks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2375/generating-pending-image-transforms-stuck-in-process/2389#2389&quot;&gt;Generating pending image transforms stuck in process&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4329/deleting-stale-template-caches-failed/4338#4338&quot;&gt;Deleting Stale Template Caches Failed&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as what cache gets saved where, template caches (the &lt;code&gt;{% cache %}&lt;/code&gt; tag) always get saved in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6633/how-does-template-caching-work&quot;&gt;here&lt;/a&gt; for an explanation on how all of that works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting, which is what you've set to &lt;code&gt;memcache&lt;/code&gt; affects any PHP code in Craft that is using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/CacheService&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;cache&lt;/a&gt; (including plugins).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See these for more discussion on it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4131/how-much-data-can-craft-cache-hold&quot;&gt;How much data can craft()-&amp;gt;cache hold?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4381/use-cache-instead-of-saving-to-database&quot;&gt;Use cache instead of saving to database&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-18T22:58:06.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8241" PostTypeId="1" CreationDate="2015-02-18T23:30:27.327" Score="2" ViewCount="678" Body="&lt;p&gt;can anyone tell me step by step what to do to put google analytics code into a global field? I have read the earlier answer but i am new to craft and i don't know where to start. &lt;/p&gt;&#xA;" OwnerUserId="3321" LastActivityDate="2015-02-19T15:48:38.543" Title="How do i put google analytics code into a Global field?" Tags="&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8242" PostTypeId="2" ParentId="8241" CreationDate="2015-02-19T00:55:25.097" Score="5" Body="&lt;p&gt;You should just be able to put it in a text field and then output it in an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejs&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeJs&lt;/code&gt;&lt;/a&gt; statement. So, add a new global set (called 'googleAnalytics' or whatever); create a text field (called 'text' or whatever); and add the new field to your global set field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template you should be able to access it by the globalSet handle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJs googleAnalytics.text %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested, but I don't see any reason it shouldn't work. If the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejs&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeJs&lt;/code&gt;&lt;/a&gt; statement doesn't like that for some reason you can try the following instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set GACode %}&#xA;    {{ googleAnalytics.text }}&#xA;{% endset %}&#xA;{% includeJs GACode %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="142" LastEditDate="2015-02-19T15:48:38.543" LastActivityDate="2015-02-19T15:48:38.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8243" PostTypeId="1" CreationDate="2015-02-19T04:48:56.090" Score="1" ViewCount="2832" Body="&lt;p&gt;I'm using XAMPP for the very first time and am also new to Craft so any help with this issue would be very much appreciated. I'm attempting to set-up a local dev environment through XAMPP and then be able to make content changes via Craft. I found this set-up guide for MAMP / Craft CMS and have followed it step by step except adapting it for XAMPP: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://unakravets.tumblr.com/post/58150139083/the-absolute-beginners-guide-to-setting-up-craft&quot; rel=&quot;nofollow&quot;&gt;http://unakravets.tumblr.com/post/58150139083/the-absolute-beginners-guide-to-setting-up-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end, when I attempt to go to localhost/Craft/public/admin to access the Craft Admin Panel, I get the following message: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Access forbidden!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't have permission to access the requested object. It is either read-protected or not readable by the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think this is a server error, please contact the webmaster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error 403&lt;/p&gt;&#xA;&#xA;&lt;p&gt;localhost&#xA;Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be causing this and what can I do to fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help!&lt;/p&gt;&#xA;" OwnerUserId="3322" LastEditorUserId="125" LastEditDate="2015-05-29T15:08:10.380" LastActivityDate="2015-05-29T15:08:10.380" Title="How to Fix Error 403 Attempting to Access Craft Admin Page Using XAMPP" Tags="&lt;server&gt;&lt;error&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8244" PostTypeId="1" AcceptedAnswerId="8293" CreationDate="2015-02-19T09:52:35.553" Score="4" ViewCount="1298" Body="&lt;p&gt;I've been looking at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher&quot;&gt;How can I build a language switcher?&lt;/a&gt; but I don't to hit the DB for each entry in the loop, just to get the entry's localised slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I can't see a way to get an entry by ID with anything other than the current or a specific locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So assuming I'm on a template where we have an entry defined, this returns 1 entry in current locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.id(entry.id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this returns 1 entry in a different locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.id(entry.id).locale('es');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I get entries for ALL locales so I can do one DB query rather than one for every locale that's enabled on the site?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-20T16:12:04.883" Title="Retrieving an entry by ID in ALL locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8245" PostTypeId="1" AcceptedAnswerId="8265" CreationDate="2015-02-19T11:08:41.340" Score="1" ViewCount="1330" Body="&lt;p&gt;We have a Laravel app that sets a cookie:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)&#xA;{&#xA;    list($path, $domain) = $this-&amp;gt;getPathAndDomain($path, $domain);&#xA;&#xA;    $time = ($minutes == 0) ? 0 : time() + ($minutes * 60);&#xA;&#xA;    return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The values passed are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array (size=7)&#xA;    0 =&amp;gt; string 'imph_auth' (length=9)&#xA;    1 =&amp;gt; string 'Russ Back' (length=9)&#xA;    2 =&amp;gt; int 2628000&#xA;    3 =&amp;gt; null&#xA;    4 =&amp;gt; null&#xA;    5 =&amp;gt; boolean false&#xA;    6 =&amp;gt; boolean true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried to retrieve that cookie in a Craft template as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getCookie('imph_auth')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I get null when I know that it's been set (I can browse to a Laravel template on the same domain and get the cookie).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I note the JavaScript warning in the Craft docs but this is set in PHP, however I can see the &lt;strong&gt;getCookies()&lt;/strong&gt; method of the &lt;strong&gt;CookieCollection&lt;/strong&gt; class runs each cookie through &lt;strong&gt;craft()-&gt;security-&gt;validateData()&lt;/strong&gt; and fails validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can get around this without resorting to my own PHP in the template or a custom plugin?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-02-19T11:15:51.673" LastActivityDate="2015-02-19T21:51:08.883" Title="Unable to retrieve a cookie set by another application on the same domain" Tags="&lt;security&gt;&lt;session&gt;&lt;cookies&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8246" PostTypeId="1" CreationDate="2015-02-19T12:25:22.533" Score="1" ViewCount="334" Body="&lt;p&gt;I have a question on Craft's Active Record,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; protected function defineAttributes(){&#xA;        'customer_ref' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true&#xA;        ), &#xA;        'fault_code' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true&#xA;        ),&#xA;        'supplier_agent' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true&#xA;        ), &#xA;        'response_delay' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true&#xA;        ) &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have my defined attributes method, when I set &lt;code&gt;required = true&lt;/code&gt;, and the field is empty the record fails to save!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I set it as required = false (or just not add the required part) , the record will save but none of the field values get inserted to the database, I have a blank row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what do i do, I just want it to insert the row, if there is something missing let it be missing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="2182" LastEditorUserId="57" LastEditDate="2015-02-19T21:53:47.103" LastActivityDate="2015-02-19T21:53:47.103" Title="The Active Record" Tags="&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8247" PostTypeId="2" ParentId="8246" CreationDate="2015-02-19T12:52:47.210" Score="1" Body="&lt;p&gt;I found this on the web:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function rules(){&#xA;    return array(&#xA;        array('customer_name,customer_email', 'default', 'setOnEmpty' =&amp;gt; true, 'value' =&amp;gt; null),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/14850081/how-can-i-set-a-date-to-null-in-yii&quot;&gt;https://stackoverflow.com/questions/14850081/how-can-i-set-a-date-to-null-in-yii&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has fixed my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;" OwnerUserId="2182" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-19T12:52:47.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8248" PostTypeId="1" CreationDate="2015-02-19T12:53:47.083" Score="5" ViewCount="234" Body="&lt;p&gt;Using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;redirect&lt;/code&gt;&lt;/a&gt; template tag creates a redirect with a 302 (Moved Temporarily) http status code. How can I force a 301 (Moved Permanently) status code?&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-02-19T12:56:04.807" Title="How do I force a 301 http status code using the redirect tag?" Tags="&lt;templating&gt;&lt;redirect&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8249" PostTypeId="2" ParentId="8248" CreationDate="2015-02-19T12:56:04.807" Score="4" Body="&lt;p&gt;Although it is (as of today) not yet documented, looking through the &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/templating/twigextensions/Redirect_TokenParser&quot; rel=&quot;nofollow&quot;&gt;redirect twig extension&lt;/a&gt; revealed that the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;redirect&lt;/code&gt;&lt;/a&gt; tag can accept a second parameter for the http status code. So forcing a 301 is done as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect 'pricing' 301 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've sent a request to P&amp;amp;T to add this to the docs.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-02-19T12:56:04.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8250" PostTypeId="1" CreationDate="2015-02-19T14:05:41.583" Score="1" ViewCount="184" Body="&lt;p&gt;I do craft development on a local setup (using a virtual .dev host). The one very annoying issue I experienced is a large latency (~10s) I get while using the backend – f.e. saving an fresh entry or creating a new field. The latency vanishes as soon as I disconnect from the internet. Is there any &quot;call home&quot; function build into craft that causes the delay?&lt;/p&gt;&#xA;" OwnerUserId="3323" LastActivityDate="2015-02-25T11:35:01.230" Title="Latency issues on local development server" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8252" PostTypeId="1" AcceptedAnswerId="8258" CreationDate="2015-02-19T14:30:57.533" Score="4" ViewCount="155" Body="&lt;p&gt;Can anyone help direct me to a plugin or way of anonymously liking articles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the Like plugin by Duct (&lt;a href=&quot;https://dukt.net/craft/like&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/like&lt;/a&gt;) but unfortunately it must be associated to a user account to save the entry.&lt;/p&gt;&#xA;" OwnerUserId="2311" LastEditorUserId="22" LastEditDate="2017-05-10T00:08:01.567" LastActivityDate="2017-05-10T00:08:01.567" Title="Anonymous likes for elements" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8253" PostTypeId="1" AcceptedAnswerId="8256" CreationDate="2015-02-19T14:37:22.110" Score="3" ViewCount="238" Body="&lt;p&gt;Not much to add to the question, other than I need to display a global's value in a different locale to the current locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the best way of doing it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.globals.getSetByHandle('localeModal').locale('es').getFieldValue('headline')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-02-19T14:43:44.470" LastActivityDate="2015-02-19T16:33:29.620" Title="How can I retrieve a global value in a different locale?" Tags="&lt;localization&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8255" PostTypeId="1" AcceptedAnswerId="8257" CreationDate="2015-02-19T16:03:24.823" Score="1" ViewCount="110" Body="&lt;p&gt;I have an include that is doing a DB query (it generates a menu of entries) and that's used more than once on a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can cache the first parse for later use to cut down on DB hits?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-02-19T16:41:30.803" Title="Can I cache an include for use elsewhere in a template?" Tags="&lt;templating&gt;&lt;database&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8256" PostTypeId="2" ParentId="8253" CreationDate="2015-02-19T16:33:29.620" Score="3" Body="&lt;p&gt;Yes, that's how you would do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.globals.getSetByHandle('localeModal').locale('es').getFieldValue('headline') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or in shorter syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ localeModal.locale('es').headline }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-19T16:33:29.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8257" PostTypeId="2" ParentId="8255" CreationDate="2015-02-19T16:41:30.803" Score="2" Body="&lt;p&gt;You would wrap the code in your include in &lt;code&gt;cache&lt;/code&gt; tags and use the keyword &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#globally&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;globally&lt;/code&gt;&lt;/a&gt; with it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally for 3 years %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-19T16:41:30.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8258" PostTypeId="2" ParentId="8252" CreationDate="2015-02-19T17:32:14.870" Score="4" Body="&lt;p&gt;There's &lt;a href=&quot;https://craftpl.us/plugins/upvote&quot; rel=&quot;nofollow&quot;&gt;&quot;Upvote&quot;&lt;/a&gt; by Lindsey DiLoreto, which allows anonymous voting. Not sure though, if it makes use of cookies and/or logging of IP addresses to forbid people (read: make it harder for them) to vote multiple times.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-19T17:32:14.870" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8259" PostTypeId="1" AcceptedAnswerId="8263" CreationDate="2015-02-19T18:59:15.883" Score="15" ViewCount="3245" Body="&lt;p&gt;I'm trying to build a search function that excludes results from certain sections all together. This is the code I was trying to use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).section('not testimonials, not authors').id('not 2').order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use just one section, it works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).section('not authors').id('not 2').order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how I could construct this query?&lt;/p&gt;&#xA;" OwnerUserId="446" LastActivityDate="2015-02-19T21:23:23.187" Title="Is it possible to exclude multiple sections from an entry search query?" Tags="&lt;search&gt;&lt;sections&gt;&lt;entrymodel&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8260" PostTypeId="1" CreationDate="2015-02-19T19:40:00.130" Score="1" ViewCount="145" Body="&lt;p&gt;Users, by default, do not have middle names. So let's say I create a table with a foreign key linking to the user id, this table will contain middle names. How would I tell craft to join the middle name data? Could I create a plugin with a hook that gets middle name whenever user data is pulled? Where do I begin?&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-02-19T22:48:58.460" Title="How to pull extra data with a user" Tags="&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8261" PostTypeId="2" ParentId="8260" CreationDate="2015-02-19T19:49:13.527" Score="3" Body="&lt;p&gt;You can add custom fields to users the same way as you do for entries, categories, and all other elements in Craft. Create a custom field for middle name, and go to Settings &gt; Users &gt; Fields and add that field to the field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;br&gt;&#xA;The field will show in the profile tab, and there is no way to properly add fields to the account tab, even with a plugin. But, although a bit hacky, you could do this by just moving the field with javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, install the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS plugin&lt;/a&gt; by Lindsey DiLoreto. Read the docs on how to get the plugin to load your custom js-file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each custom field in the form has an id with the naming convention &lt;code&gt;fields-myCustomFieldHandle-field&lt;/code&gt;. If you name the field &lt;code&gt;middleName&lt;/code&gt; and want to put it before the email field on the account tab, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;    if ($('#userform').length&amp;gt;0) { // just to make sure we're in the user edit page&#xA;       $('#email-field').before($('#fields-middleName-field'));&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting it to appear between the first and last name fields, or making them 100% width and putting the middlename in the middle, would also be possible, but requires a bit more DOM manipulation. Let me know if this is important for you.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-02-19T22:48:58.460" LastActivityDate="2015-02-19T22:48:58.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8263" PostTypeId="2" ParentId="8259" CreationDate="2015-02-19T20:46:08.453" Score="29" Body="&lt;p&gt;The trick is to add &lt;code&gt;and&lt;/code&gt; once before the first &lt;code&gt;not&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).section('and, not this, not that') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2015-02-19T21:23:23.187" LastActivityDate="2015-02-19T21:23:23.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8264" PostTypeId="1" AcceptedAnswerId="8301" CreationDate="2015-02-19T21:13:01.423" Score="3" ViewCount="357" Body="&lt;p&gt;Im using the modifyEntrySources hook in my plugin, when I view the entries based on my custom criteria it doesn't show the checkboxes for element actions, is there a way to get these back or is this a bug? &lt;/p&gt;&#xA;" OwnerUserId="140" LastActivityDate="2015-02-20T22:46:43.347" Title="Element Actions for Entries being viewed from modifyEntrySources" Tags="&lt;entries&gt;&lt;plugins&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8265" PostTypeId="2" ParentId="8245" CreationDate="2015-02-19T21:51:08.883" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any way I can get around this without resorting to my own PHP in the template or a custom plugin?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't have PHP is a Twig template, but I think you'd need a real simple plugin for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would just have an &lt;code&gt;init()&lt;/code&gt; method that did:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;enableCookieValidation = false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just be aware that's going to make it much easier for people to potentially tamper with cookie values.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-19T21:51:08.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8266" PostTypeId="2" ParentId="8250" CreationDate="2015-02-19T22:03:57.887" Score="1" Body="&lt;p&gt;Craft does use cURL to connect to web services at buildwithcraft.com and there is a 30 second timeout if there is no response from our end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will then cache that there was a connection error and not attempt to call home again for the next 5 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a cURL configuration problem, then check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder for any &lt;code&gt;[error]&lt;/code&gt; or &lt;code&gt;[warning]&lt;/code&gt; entries and it will tell you what the error message is.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-19T22:03:57.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8267" PostTypeId="1" AcceptedAnswerId="8270" CreationDate="2015-02-19T22:06:50.517" Score="0" ViewCount="1846" Body="&lt;p&gt;I have created a field for the homepage called icon_font.  I now want to access that field in my template.  What is the best way to do that?  Do I have to use a for loop (even though there is only one homepage)?  Any help is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moshe&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Note, the template in question is NOT my homepage template, but rather a different template which relates to a different section.&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="2309" LastEditDate="2015-02-19T22:34:01.020" LastActivityDate="2015-02-19T23:11:37.943" Title="Getting Attribute for Homepage" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8268" PostTypeId="2" ParentId="8267" CreationDate="2015-02-19T22:26:59.747" Score="0" Body="&lt;p&gt;If your homepage is a Single section and you've checked the &quot;This is for the homepage&quot; checkbox in the section's settings, all you should need to do is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.icon_font }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the template you specified in the section's settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-19T22:26:59.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8269" PostTypeId="1" AcceptedAnswerId="8304" CreationDate="2015-02-19T22:30:40.433" Score="4" ViewCount="1073" Body="&lt;p&gt;I have a situation where I want to assign a default password when a user is registered in the CP, but only if they are assigned to a specific user group. Plugin code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onActivateUser', function(Event $event)&#xA;{&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    // Test to see if a user is in group&#xA;    if ($user-&amp;gt;isInGroup('groupName'))&#xA;    {&#xA;        $user-&amp;gt;newPassword = 'Password123';&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried latching on to both the users.onSaveUser and users.onActivateUser events, and in both situations, there are no groups are assigned to the user. Is there an event that is at the absolute end of user registration that I can watch to access their user groups?&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2015-02-24T00:28:15.870" Title="Create default password for new user registration in CP" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8270" PostTypeId="2" ParentId="8267" CreationDate="2015-02-19T23:11:37.943" Score="2" Body="&lt;p&gt;First you'll need to get your homepage entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homepage = craft.entries.slug('homepage').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can call the field you need from &lt;code&gt;homepage&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{homepage.entry_icon}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-19T23:11:37.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8271" PostTypeId="1" AcceptedAnswerId="8272" CreationDate="2015-02-19T23:42:29.567" Score="6" ViewCount="876" Body="&lt;p&gt;Is it possible to allow the selection of an image transform on an image that's been uploaded into a Redactor field?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2019-03-15T02:24:51.557" Title="apply transform to image uploaded into Redactor?" Tags="&lt;redactor&gt;&lt;image-transforms&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8272" PostTypeId="2" ParentId="8271" CreationDate="2015-02-19T23:51:11.390" Score="9" Body="&lt;p&gt;Sure, from the Redactor &quot;Insert Image&quot; modal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xelsz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="22" LastEditDate="2019-03-14T23:58:41.853" LastActivityDate="2019-03-14T23:58:41.853" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8273" PostTypeId="2" ParentId="8271" CreationDate="2015-02-19T23:51:36.990" Score="2" Body="&lt;p&gt;When it pops up with the Craft UI modal to select an image asset you can select a transform in the bottom right&lt;/p&gt;&#xA;" OwnerUserId="140" LastActivityDate="2015-02-19T23:51:36.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8274" PostTypeId="2" ParentId="4469" CreationDate="2015-02-20T01:09:15.570" Score="5" Body="&lt;p&gt;Craft can delete caches in a few different ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When somebody manually clears the cache via &lt;code&gt;Settings-&amp;gt;Clear Caches&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;When Elements within {% cache %} tag are saved or deleted&lt;/li&gt;&#xA;&lt;li&gt;When a new Element is created&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Regarding #2 and #3, when Craft can identify which Elements you are caching, it stores them in the &lt;code&gt;craft_templatecacheelements&lt;/code&gt; table.  If you save or delete an Element that matches one of the Element IDs that Craft has stored, Craft will clear the related template caches immediately.  In the case where you are creating a new Element, it takes Craft a little bit longer to determine if that Element could be part of a related cached query and once Craft determines that is the case, will clear the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft knows which Element IDs exist if your queries are taking place between the &lt;code&gt;{% cache %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to explore a bit more, a few places to explore would be the &lt;code&gt;craft/services/TemplateCacheService.php&lt;/code&gt; and &lt;code&gt;craft/app/etc/templating/BaseTemplate.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-20T01:09:15.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8275" PostTypeId="2" ParentId="6948" CreationDate="2015-02-20T01:11:04.187" Score="2" Body="&lt;p&gt;I'd make sure you're running the latest stable version of both the &lt;a href=&quot;http://www.imagemagick.org/script/changelog.php&quot; rel=&quot;nofollow&quot;&gt;Imagick library&lt;/a&gt; as well as the &lt;a href=&quot;http://pecl.php.net/package-changelog.php?package=imagick&quot; rel=&quot;nofollow&quot;&gt;Imagick PHP module&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible that older version had bugs in them which might explain what you're seeing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-20T01:11:04.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8276" PostTypeId="2" ParentId="4309" CreationDate="2015-02-20T01:22:44.087" Score="1" Body="&lt;p&gt;I believe you're looking for something like the example posted here which goes into detail on several items necessary to create a working Asset Relations Field in a custom plugin:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/456/115&quot;&gt;https://craftcms.stackexchange.com/a/456/115&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-20T01:22:44.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8277" PostTypeId="2" ParentId="2893" CreationDate="2015-02-20T01:27:00.837" Score="2" Body="&lt;p&gt;I'm adding Brad's comment here as an answer as I think it addressed indirectly this issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft 2.3 should fix the performance problem of Structures and Categories with large amounts of entries.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-20T01:27:00.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8278" PostTypeId="2" ParentId="2728" CreationDate="2015-02-20T01:34:14.453" Score="1" Body="&lt;p&gt;Anyone curious about this answer, can checkout the GitHub thread referred to above:&#xA;&lt;a href=&quot;https://github.com/boboldehampsink/import/issues/14&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/import/issues/14&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most relevant comment for this answer is by &lt;code&gt;boboldehampsink&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;the documentation on category importing isn't complete yet. You have to fill in the complete path with titles, so: Category Title/Subcategory Title/Subsubcategory Title (for example)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-20T01:34:14.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8279" PostTypeId="2" ParentId="7203" CreationDate="2015-02-20T07:04:47.973" Score="3" Body="&lt;p&gt;Depending on your needs, you may want to look into using &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;categories&lt;/a&gt; instead of tags. Categories, like other entries, already have a status that can be turned on and off without creating a custom field. You can also manage categories thru their own section in the control panel like entries and assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tags on the other hand, are kind of weird to manage in Craft. You can only add tags. You can't delete them without updating the database directly. And you can only add tags or update data in their fields by adding it to an entry, asset, or category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot below of how you would change the &quot;oastatus&quot; field for a tag that's been added to an entry. To do this, you would add the tag first, then double click on the tag to bring up this edit dialog of the tag's fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rLJQ0.png&quot; alt=&quot;example of editing a tags custom fields&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If tags is the way you want to go, and you want to display a list of tags and the 'oastatus' field you created with Twig in your templates, you can use the craft.tags ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for tag in craft.tags.group('theme') %}&#xA;    &amp;lt;li&amp;gt;{{ tag.title }} – {{ tag.oastatus }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-02-20T07:04:47.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8280" PostTypeId="1" CreationDate="2015-02-20T11:07:06.730" Score="2" ViewCount="331" Body="&lt;p&gt;Is there currently a way to eager load the matrix values of an element and thus be able to sort by one of its fields? Imagine you have something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;type = 'mytype';&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would create a select from the following tables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FROM   `craft_elements` `elements` &#xA;   JOIN `craft_elements_i18n` `elements_i18n` &#xA;     ON elements_i18n.elementid = elements.id &#xA;   JOIN `craft_matrixblocks` `matrixblocks` &#xA;     ON matrixblocks.id = elements.id &#xA;   JOIN `craft_matrixblocktypes` `matrixblocktypes` &#xA;     ON matrixblocktypes.id = matrixblocks.typeid &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously the most important table for my task at hand is missing: the &lt;code&gt;craft_matrixcontent_mytype&lt;/code&gt; table. I'm not able order by mytable.myfield and additionally, while looping those blocks I have the N+1 problem where it builds an extra query to fetch the actual block content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I somehow able to load all MatrixBlocks of a given type, INCLUDING the values?&lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-02-20T12:28:51.103" Title="Sort by MatrixBlock Field / Eager load Matrix Field" Tags="&lt;matrix&gt;&lt;join&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8281" PostTypeId="1" AcceptedAnswerId="8286" CreationDate="2015-02-20T11:57:31.600" Score="4" ViewCount="96" Body="&lt;p&gt;I have a site that has these different types of content:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Candidates&lt;/li&gt;&#xA;&lt;li&gt;Questions&lt;/li&gt;&#xA;&lt;li&gt;Answers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So there's a list of questions, that have answers that are related to a candidate. I imagine the models look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Question Info&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Answers&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;relatedCandidate&lt;/li&gt;&#xA;&lt;li&gt;relatedQuestion&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Candidate&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Candidate Info&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The main question is is this the best setup for this particular situation? Or should  I have a matrix in Questions with all the answers and then a related field for the candidate and the answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this works if the question section works on it's own, if I ever need to display candidates and then their corresponding answers, I don't know if I can run through the Questions' matrix field and find only that candidate's answer.&lt;/p&gt;&#xA;" OwnerUserId="2313" LastActivityDate="2015-02-20T14:18:12.340" Title="How to model a multiple relation situation?" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8282" PostTypeId="2" ParentId="8280" CreationDate="2015-02-20T12:28:51.103" Score="2" Body="&lt;p&gt;After digging through some code I found out, that the &lt;code&gt;MatrixBlockElementType&lt;/code&gt; just returns a content table (which is necessary for the eager loading part), if a fieldId is given:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;type = 'mytype';&#xA;$criteria-&amp;gt;fieldId = 90;&#xA;$criteria-&amp;gt;order = 'field_mytype_myfield';&#xA;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like this everything seems to work as expected and I'm again in love with crafts flexibility :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right that I have to pass in the id? I can't do it via the field handle 'mymatrixfieldhandle', correct?&lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-02-20T12:28:51.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8283" PostTypeId="1" AcceptedAnswerId="8284" CreationDate="2015-02-20T12:48:03.530" Score="2" ViewCount="632" Body="&lt;p&gt;I’m trying to set data within a global set. I’ve tried the following without success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$globalSetHandle = 'settings';&#xA;$globalSet = craft()-&amp;gt;globals-&amp;gt;getSetByHandle($globalSetHandle);&#xA;&#xA;$globalSet-&amp;gt;fieldHandle = 'value';&#xA;&#xA;craft()-&amp;gt;globals-&amp;gt;saveContent(GlobalSetModel $globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastActivityDate="2017-03-01T05:34:26.587" Title="How to save a global set’s content?" Tags="&lt;plugin-development&gt;&lt;globals&gt;&lt;saving&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8284" PostTypeId="2" ParentId="8283" CreationDate="2015-02-20T13:02:21.870" Score="3" Body="&lt;p&gt;Try using &lt;code&gt;setContentFromPost&lt;/code&gt;, as mentioned in &lt;a href=&quot;https://craftcms.stackexchange.com/a/4487/110&quot;&gt;this answer&lt;/a&gt; from Brandon.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$content = array(&#xA;    'fieldHandle' =&amp;gt; 'value',&#xA;);&#xA;&#xA;$globalSet-&amp;gt;setContentFromPost($content);&#xA;craft()-&amp;gt;globals-&amp;gt;saveContent($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-02-20T13:02:21.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8285" PostTypeId="2" ParentId="1516" CreationDate="2015-02-20T13:03:40.017" Score="7" Body="&lt;p&gt;I've successfully used this entry url format and it works great:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.id(65).first.uri }}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would advise using the entry id over a slug, as it will never change. You also don't need to specify the section if you've included the id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a multi-lingual site, you can specify the locale for each entry url format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.id(65).locale('en_us').first.uri }}/{slug}&#xA;{{ craft.entries.id(65).locale('de').first.uri }}/{slug}&#xA;{{ craft.entries.id(65).locale('fr').first.uri }}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you mention in your comment, you do need to beware of updating the parent entry's slug as uri's are parsed before being stored in the database so it is not truly dynamic. I'm not aware of any workarounds for this that don't involve a plugin.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-02-20T13:03:40.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8286" PostTypeId="2" ParentId="8281" CreationDate="2015-02-20T14:11:10.540" Score="3" Body="&lt;p&gt;I think this is the best way to model the data, and it lends itself very well to how Craft work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess the only reason to go with the Matrix approach instead, would be to ease how the information is published in the control panel. In some cases it might be easier to just publish one question with all the answers, instead of one question and all the answers seperately. But it's hard to say, not knowing the actual content and amount of data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would definitely be possible to go for the Matrix solution too, but it might be a bit more complex to use in your templates, and maybe less efficient. But again, depends on your actual case.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-02-20T14:11:10.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8287" PostTypeId="2" ParentId="8281" CreationDate="2015-02-20T14:11:33.033" Score="1" Body="&lt;p&gt;Personally I wouldn't relate questions and answers from the answer, I'd relate them from the &lt;strong&gt;question&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand your concept here, questions &lt;em&gt;might&lt;/em&gt; have more than one answer, but an answer can't answer more than one question?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, I'd set up 3 channels:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Questions&lt;/li&gt;&#xA;&lt;li&gt;Answers&lt;/li&gt;&#xA;&lt;li&gt;Candidates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And in your Questions channel, I'd have a &lt;code&gt;relatedAnswers&lt;/code&gt; entry field, so answers can be assigned that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything else I'd keep the same as you have suggested, but with a &lt;code&gt;relatedAnswers&lt;/code&gt; field, &lt;code&gt;relatedQuestion&lt;/code&gt; would no longer be needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to also remember that a Candidate might answer more than one question. So having their information in a matrix field on the answer entry would mean a lot of repeated data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up a Candidates channel with entries for each candidate, and add a &lt;code&gt;relatedCandidates&lt;/code&gt; entry field to your answer entries so the candidate(s) can be assigned that way.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-02-20T14:18:12.340" LastActivityDate="2015-02-20T14:18:12.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8288" PostTypeId="2" ParentId="7032" CreationDate="2015-02-20T14:25:16.997" Score="1" Body="&lt;p&gt;As it turns out, the initial issue was my server time not being set as Google Cloud wanted. I'm in the UK and using a server in Germany. I set it so the time synched with time1.google.com and that fixed my first issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem popped up after that (unknown error!) but Craft support got in there and patched the issue for me so i'm good to go (and hopefully others in future wont have that problem! Sweet!) &lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-02-20T14:25:16.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8289" PostTypeId="1" AcceptedAnswerId="8290" CreationDate="2015-02-20T14:47:19.843" Score="3" ViewCount="1248" Body="&lt;p&gt;I have blog articles set up on the site i'm working on to be built using a matrix, much the same way as in the &lt;a href=&quot;http://buildwithcraft.com/features/matrix&quot; rel=&quot;nofollow&quot;&gt;features video&lt;/a&gt; about the matrix field. So it is entirely possible for an article to start with an image or a video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i'd like to be able to do is find the first text entry in the matrix and pull the first 155 characters out of it, creating an excerpt. The point of this is to pass that into a meta og:description tag (and i guess meta description too!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do that with matrix content?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-02-20T18:24:18.010" Title="Is it possible to take an excerpt from the first rich text area in a matrix?" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8290" PostTypeId="2" ParentId="8289" CreationDate="2015-02-20T15:00:38.927" Score="5" Body="&lt;p&gt;You can filter by block type: &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/matrix-fields#filtering-by-block-type&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ogDescription = false %}&#xA;&#xA;{% for block in entry.myMatrixField.type('richText').limit(1) %}&#xA;  {% set ogDescription = block.text | striptags | slice(0, 155) %}&#xA;{% endfor %}&#xA;&#xA;{% if ogDescription %}&#xA;  ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, this was suggested in the comments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myMatrixField.type('richText').first() | striptags | slice(0, 155) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2015-02-20T18:24:18.010" LastActivityDate="2015-02-20T18:24:18.010" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8291" PostTypeId="2" ParentId="7193" CreationDate="2015-02-20T15:51:45.630" Score="2" Body="&lt;p&gt;As per Brandon's request in the comments to the original question here are the steps I used to import. Below is copied from a &lt;a href=&quot;http://caffeinecreations.ca/blog/migrating-content-from-expressionengine-to-craft&quot; rel=&quot;nofollow&quot;&gt;blog post I wrote with screenshots&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOt sure why but my code bits are not displaying even though I've used the code button in the wysiwyg here. To see the full code bits go to my blog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First use a different plugin &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/import&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;copy all files from original site&lt;/li&gt;&#xA;&lt;li&gt;in the Craft CP click the gear icon on the top right, then Assets, New source and fill in the fields. both the path and url can be set to relative paths, but be sure to not use a leading slash. &lt;/li&gt;&#xA;&lt;li&gt;After saving click the gear icon again and go to the lower left and update asset indexes. &lt;/li&gt;&#xA;&lt;li&gt;The next step is to install the Import plugin by putting the files in /craft/plugins then in the CP click gear and plugins and finally install.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This plugin only imports content in CSV format. This requires a new template in ExpressionEngine which will need to be set wiht php turned on in order to force the browser to download the file directly.&lt;/p&gt;&#xA;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The next bit of code contains all our fields and how we want them named. This is important to easily map the fields using the import plugin. Line 20 has entry_date with extra spaces this is due to my blog rendering it and not displaying the code correctly - remove extra spaces for it to work. When migrating images, be sure to only include the image name. My images currently reside in a Matrix field {photos} and a file cell. In order to get just the file name it is necessary to use the file tag pair like this {image}{file_name}{/image} where the outer tag pair is the file field/cell name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;   Title&#xA;    Url Title&#xA;    Entry Date&#xA;    Description&#xA;    Image&#xA;&#xA;{exp:channel:entries channel='photoblog' limit='500' disable=&quot;categories|member_data|pagination|comments&quot; status=&quot;not foo&quot;}&#xA;    &#xA;            Migrating Content from ExpressionEngine to Craft&#xA;            {url_title}&#xA;            { entry_date }&#xA;            {description}&#xA;            {photos}{image}{file_name}{/image}{/photos}&#xA;    &#xA;{/exp:channel:entries}&#xA;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After downloading the file open it in Excel, you may see a warning that the file format doesn't match the extension, open it anyhow. Now do a save as and choose CSV (comma delimited). My research indicated that this extra step is necessary as using the template to save as CSV with content that contains quotes may not work correctly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now to import, click Import in the Nav. Fill in the fields as required and upload your CSV file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to the next page where we map the fields to Craft fields. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="193" LastActivityDate="2015-02-20T15:51:45.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8292" PostTypeId="2" ParentId="8289" CreationDate="2015-02-20T16:01:56.763" Score="2" Body="&lt;p&gt;We've designed &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow&quot;&gt;Sprout SEO&lt;/a&gt; to help you handle situations like these.  Personally, I think it's the easiest path to take for dealing with this situation.  So, my first answer would be to consider using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an example on how to assign meta values in included Matrix blocks in the Sprout SEO docs here &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/examples/extending-a-base-layout&quot; rel=&quot;nofollow&quot;&gt;Extending a Base Layout&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;But, this is a question on StackExchange so that answer alone is unsatisfying. If you'd like to dig into solving this issue yourself, to start, I'd recommend you try to get the best understanding you can of the &lt;a href=&quot;http://straightupcraft.com/index.php/articles/twig-processing-order&quot; rel=&quot;nofollow&quot;&gt;Twig Processing Order&lt;/a&gt;. While part of the challenge your facing is how to grab the specific text you need from the field variable (Bill Chriswell's answer addresses that), another part of it may be where your variable exists in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you are managing your variables in a parent &lt;code&gt;_layout&lt;/code&gt; template and trying to assign your excerpt within a block tag extending it, you're description variable is getting set after you are outputting your meta variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, however you are assigning your meta variables you need to make sure that you are assigning the description variable in a way that it gets updated before you are actually outputting the meta values in your header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll quote a couple paragraphs from the Twig Processing Order article linked above:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[T]he Twig processing order flows down the page. Variables are processed and become available farther down the page to be output.&#xA;  Sometimes however, we can only determine a value farther down the&#xA;  page, and the value itself needs to be output higher on the page.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Out of the box, some scenarios like this can be handled by Twig but things can get messy quick, and code that once felt dry can begin to&#xA;  feel harder to maintain. Other scenarios simply can't be solved&#xA;  without extending Twig or managing your variable with the help of a&#xA;  plugin.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here are three methods mentioned in the article to consider if you want to get around this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Try to set your variables as high on the page as you can. Even&#xA;arrays of data can be queried and set as variables higher on the&#xA;page. Once a variable exists, it's much easier to refer to that&#xA;variable anywhere below it's first instance in your templates.&lt;/li&gt;&#xA;&lt;li&gt;Create your page variables in a plugin. Craft allows you to set up&#xA;routes to point to a Controller action instead of a page template.&lt;/li&gt;&#xA;&lt;li&gt;Consider building a plugin and and managing the variable of the&#xA;content you need access to in a Twig Global or public variable in&#xA;the service layer of your plugin.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-20T16:01:56.763" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8293" PostTypeId="2" ParentId="8244" CreationDate="2015-02-20T16:12:04.883" Score="2" Body="&lt;p&gt;I don't think this is possible witout the use of a plugin. The craft.entries tag works on an entry basis. The slug is saved in the table that houses the localized data for an element, craft_elements_i18n. When you request an entry, (in theory) the craft_entries table is joined with the craft_elements table (based on id), which is then joined with the craft_elements_i18n table (based on locale). There's no way you could join in data from several different locales this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have to do is query the craft_elements_i18n directly, and return all rows based on the entry id (elementId in that table is the entry id), and then you'd get locale, slug, and url. This table isn't exposed in any way to the templates, so you'd need to do it with a small plugin. It will still be one query to do this, though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think maybe this is more work than what it's worth, unless you have loads of locales, the difference in performance will be very, very small. Also, you could cache this in your templates, which would make it even less of an issue.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-02-20T16:12:04.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8294" PostTypeId="1" AcceptedAnswerId="8296" CreationDate="2015-02-20T16:44:05.773" Score="2" ViewCount="1591" Body="&lt;p&gt;I have an advanced search that searches real estate properties by the usual criteria: price range, Bedrooms, Bathrooms... In the form, the default is &quot;Any&quot; if they don't care about a particular option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the results page, I'm checking for a null value in case an option wasn't selected. Despite this, I'm still getting the message 'Key &quot;1&quot; for array with keys &quot;0&quot; does not exist' if the price option is missing. What is causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My search results page looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set price = craft.request.getParam('p') %}&#xA;{% set price = price ? price|split('-') %}&#xA;&#xA;{% set br = craft.request.getParam('br') %}&#xA;{% set br = br ? br %}&#xA;&#xA;{% set ba = craft.request.getParam('ba') %}&#xA;{% set ba = ba ? ba %}&#xA;&#xA;&#xA;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set searchResults = craft.entries({&#xA;    section: 'properties',&#xA;    propertyPrice: price ? ['and', '&amp;gt;= ' ~ price[0],'&amp;lt;= ' ~ price[1]],&#xA;    bedrooms: br ? [ 'and', '&amp;gt;= ' ~ br ],&#xA;    bathrooms: ba ? [ 'and', '&amp;gt;= ' ~ ba ],&#xA;    order: 'score'&#xA;}) %}&#xA;&#xA;{% if searchResults|length %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in searchResults %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}: {{ entry.propertyPrice|currency('USD', true) }}: BR: {{ entry.bedrooms }}, BA: {{ entry.bathrooms }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% else %}&#xA;&amp;lt;h1&amp;gt;No Results Found&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3326" LastActivityDate="2015-02-20T17:00:47.013" Title="Advanced search returning 'Key &quot;1&quot; for array with keys &quot;0&quot; does not exist'" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8296" PostTypeId="2" ParentId="8294" CreationDate="2015-02-20T17:00:47.013" Score="2" Body="&lt;p&gt;This error could happen if the &lt;code&gt;p&lt;/code&gt; param is set to &lt;em&gt;something&lt;/em&gt;, but the value doesn’t actually contain a hyphen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to find out what the problematic value is, enable &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;Dev Mode&lt;/a&gt; and then check your browser console &gt; &lt;strong&gt;&lt;code&gt;Application Log&lt;/code&gt;&lt;/strong&gt; &gt; &lt;strong&gt;&lt;code&gt;GET Info&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;POST Info&lt;/code&gt;&lt;/strong&gt; (depending on the request type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make your code more bulletproof you can replace this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set price = price ? price|split('-') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set price = (price and price matches '/-/') ? price|split('-') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-02-20T17:00:47.013" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8297" PostTypeId="2" ParentId="5384" CreationDate="2015-02-20T17:47:05.157" Score="5" Body="&lt;p&gt;In my tests the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&quot; rel=&quot;nofollow&quot;&gt;paragraphize&lt;/a&gt; setting did not seem to fully prevent paragraphs from being generated. Instead &lt;code&gt;{ linebreaks: true }&lt;/code&gt; seems to reliably convert all would-be paragraphs to &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're really serious about sticking to single lines then you can go even further and block all forms of line breaks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    deniedTags: ['br'],&#xA;    enterKey: false,&#xA;    pastePlainText: true,&#xA;    linebreaks: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only flaw with this seems to be that linebreaks still show up in the editor if they're pasted in, but they are stripped when the entry is saved.&lt;/p&gt;&#xA;" OwnerUserId="3327" LastEditorUserId="3327" LastEditDate="2015-04-13T13:07:16.570" LastActivityDate="2015-04-13T13:07:16.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8298" PostTypeId="2" ParentId="1643" CreationDate="2015-02-20T21:08:24.717" Score="2" Body="&lt;p&gt;&lt;strong&gt;Be sure to look for JavaScript errors as well!&lt;/strong&gt; I was having the same trouble with a CloudFlare-enabled site, and it turned out that the Rocket Loader feature was choking and keeping previews from working properly. Otherwise no &lt;code&gt;entry&lt;/code&gt; variables in play.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2015-02-20T21:08:24.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8299" PostTypeId="1" CreationDate="2015-02-20T22:24:04.777" Score="1" ViewCount="235" Body="&lt;p&gt;Within my matrix I have two blocks: Day and Event. Day is just a date field while the event block has two text fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to wrap the event data, which needs to show up as a table format within this loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This currently spills everything out in the correct order but the table doesn't open and close correctly around the event block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final output should look something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Title (h2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Table open&lt;br&gt;&#xA;TR&lt;br&gt;&#xA;TR&lt;br&gt;&#xA;TR&lt;br&gt;&#xA;Table close&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.scheduleMatrix %}&#xA;&#xA;{% switch block.type %}&#xA;&#xA;{% case 'day' %}&#xA;            &amp;lt;h2&amp;gt;{{ block.day.format('l - F j, Y') }} &amp;lt;/h2&amp;gt;&#xA;&amp;lt;table&amp;gt;&amp;lt;tbody&amp;gt;&#xA;&#xA;{% case 'event' %}&#xA;            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;{{ block.eventTime }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ block.eventName }}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;        &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2015-02-20T22:40:19.590" LastActivityDate="2015-02-20T22:59:07.927" Title="Opening and closing table within a switch" Tags="&lt;table&gt;&lt;switch&gt;&lt;case&gt;" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8300" PostTypeId="2" ParentId="8299" CreationDate="2015-02-20T22:34:58.950" Score="2" Body="&lt;p&gt;I think the opening and closing tags in the table are in the wrong spot. Try opening and closing the table inside the event case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.scheduleMatrix %}&#xA;&#xA;{% switch block.type %}&#xA;&#xA;{% case 'day' %}&#xA;    &amp;lt;h2&amp;gt;{{ block.day.format('l - F j, Y') }} &amp;lt;/h2&amp;gt;    &#xA;{% case 'event' %}&#xA;    &amp;lt;table&amp;gt;&#xA;        &amp;lt;tbody&amp;gt;&#xA;            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;{{ block.eventTime }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ block.eventName }}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#xA;        &amp;lt;/tbody&amp;gt;&#xA;    &amp;lt;/table&amp;gt;    &#xA;{% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-20T22:34:58.950" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8301" PostTypeId="2" ParentId="8264" CreationDate="2015-02-20T22:46:43.347" Score="4" Body="&lt;p&gt;The checkboxes will only show up if there is at least one available &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/element-actions&quot; rel=&quot;nofollow&quot;&gt;element action&lt;/a&gt; for the current source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Element actions are defined by element types’ &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/IElementType#getAvailableActions-detail&quot; rel=&quot;nofollow&quot;&gt;getAvailableActions()&lt;/a&gt; methods, which will vary their response based on the &lt;code&gt;$source&lt;/code&gt; that is passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/EntryElementType&quot; rel=&quot;nofollow&quot;&gt;EntryElementType’s&lt;/a&gt; case, if an unrecognized &lt;code&gt;$source&lt;/code&gt; is passed in, then no actions will be returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/EntryElementType#getAvailableActions-detail&quot; rel=&quot;nofollow&quot;&gt;EntryElementType::getAvailableActions()&lt;/a&gt; does have a hook called &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addEntryActions&quot; rel=&quot;nofollow&quot;&gt;addEntryActions&lt;/a&gt;, which gives plugins the opportunity to add additional actions to its response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on top of using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySources&lt;/a&gt; hook, you can also use the addEntryActions hook to provide the actions that your custom source should have.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function addEntryActions($source)&#xA;{&#xA;    if ($source == 'myCustomSourceKey')&#xA;    {&#xA;        $elementType = craft()-&amp;gt;elements-&amp;gt;getElementType(ElementType::Entry);&#xA;        return $elementType-&amp;gt;getAvailableActions('section:X');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Replace &lt;code&gt;X&lt;/code&gt; with the ID of a section you want to mimic.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-02-20T22:46:43.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8302" PostTypeId="2" ParentId="8299" CreationDate="2015-02-20T22:53:25.197" Score="1" Body="&lt;p&gt;Brandon sent over another post that answer this exact problem: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6732/solution-for-matrix-within-matrix-or-more-robust-table-fields/6739#6739&quot;&gt;Solution for Matrix-within-Matrix (or More Robust Table Fields)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;{# Find out if this is the first/last consecutive block of this type #}&#xA;{% set type = block.type.handle %}&#xA;{% set isFirstConsecutiveBlockOfType = (loop.first or type != block.getPrev().type.handle) %}&#xA;{% set isLastConsecutiveBlockOfType = (loop.last or type != block.getNext().type.handle) %}&#xA;&#xA;{% switch type %}&#xA;&#xA;    {% case 'stat' %}&#xA;&#xA;        {% if isFirstConsecutiveBlockOfType %}&#xA;            &amp;lt;div class=&quot;stats&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- Stat block HTML --&amp;gt;&#xA;&#xA;        {% if isLastConsecutiveBlockOfType %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% case 'quote' %}&#xA;&#xA;        {% if isFirstConsecutiveBlockOfType %}&#xA;            &amp;lt;div class=&quot;quotes&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- Quote block HTML --&amp;gt;&#xA;&#xA;        {% if isLastConsecutiveBlockOfType %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;{% endswitch %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-20T22:53:25.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8303" PostTypeId="2" ParentId="8299" CreationDate="2015-02-20T22:59:07.927" Score="2" Body="&lt;p&gt;An alternate solution would be to add a date field to each event block, you can then group blocks by date on output, and wouldn't have to worry about the client accidentally putting an event in the wrong order. Something like the following (although my syntax might be off a bit).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocksByDate = entry.scheduleMatrix|group(day|date(&quot;Y-m-d&quot;) ) %}&#xA;{% for day, blocks in blocksByDay %}&#xA;    {{ day.format('l - F j, Y') }}&#xA;    &amp;lt;table&amp;gt;&#xA;        &amp;lt;tbody&amp;gt;&#xA;            {% for block in blocks %}&#xA;                &amp;lt;tr&amp;gt;&#xA;                    &amp;lt;td&amp;gt;{{ block.eventTime }}&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;{{ block.eventName }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;/tr&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/tbody&amp;gt;&#xA;     &amp;lt;/table&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-20T22:59:07.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8304" PostTypeId="2" ParentId="8269" CreationDate="2015-02-21T00:02:36.920" Score="1" Body="&lt;p&gt;If you have &quot;Verify Email Addresses&quot; checked in Settings-&gt;Users-&gt;Settings &lt;em&gt;and&lt;/em&gt; you uncheck &quot;Send activation email now?&quot; users will start in a &quot;pending&quot; state, so the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow&quot;&gt;onActivateUser&lt;/a&gt; event won't get fired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you uncheck &quot;Verify Email Addresses&quot; in Settings-&gt;Users-&gt;Settings, the &quot;Send activation email now?&quot; checkbox will disappear when registering a new user, users will start in an &quot;active&quot; state and the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow&quot;&gt;onActivateUser&lt;/a&gt; event will fire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've found, user group information isn't available to the user on the same request they get created in because user group permissions don't get processed until &lt;em&gt;after&lt;/em&gt; the onSaveUser event has fired.  You could use &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow&quot;&gt;onSaveUser&lt;/a&gt;, but you'd run into the same limitation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do, however, is directly check against $_POST (&lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getPost-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;request-&gt;getPost()&lt;/a&gt;) to see if the user group you're interested in is there in the onActivateUser event.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-02-24T00:28:15.870" LastActivityDate="2015-02-24T00:28:15.870" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="8306" PostTypeId="2" ParentId="6857" CreationDate="2015-02-21T00:31:21.007" Score="3" Body="&lt;p&gt;I don't recall the specific version/build and my search-fu is weak today, but this was a bug in Craft that should have been fixed in a semi-recent build.  Try updating to the latest and see if you still have the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time we've been able to investigate this issue so far, it has been because of either .htaccess stripping querystring params behind the scenes (i.e. no &lt;code&gt;[QSA]&lt;/code&gt; flag on the rewrite rule), or the equivalent in nginx-land.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-25T18:38:59.043" LastActivityDate="2015-03-25T18:38:59.043" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8307" PostTypeId="2" ParentId="7096" CreationDate="2015-02-21T00:38:47.867" Score="6" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been fixed for the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2725&quot; rel=&quot;nofollow&quot;&gt;2.4.2725&lt;/a&gt;) release.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Turns out there is a bug in Craft where if you put cache tags around code that doesn't actually output anything, then duplicate keys get created in the &lt;code&gt;craft_templatecaches&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No workaround for it yet (other than to make sure you don't cache an empty string), but it's been logged as a bug.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-20T19:14:21.020" LastActivityDate="2015-11-20T19:14:21.020" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8308" PostTypeId="2" ParentId="5175" CreationDate="2015-02-21T00:46:14.963" Score="3" Body="&lt;p&gt;Be sure that you're testing as a logged-out user on the front-end of the site.  If you have an active Craft session, you could be getting a false positive error message.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-21T00:46:14.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8309" PostTypeId="2" ParentId="5109" CreationDate="2015-02-21T00:48:19.400" Score="1" Body="&lt;p&gt;Maybe not the prettiest URL, but I think the simplest solution would be to redirect to something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://web.dev/success?id=ch_5GW2RFTNvW8qeR&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-21T00:48:19.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8310" PostTypeId="1" AcceptedAnswerId="8311" CreationDate="2015-02-21T05:11:50.960" Score="3" ViewCount="185" Body="&lt;p&gt;A little off-topic, but wondering if someone can shed some light on the &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources&quot; rel=&quot;nofollow&quot;&gt;CategorySources&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A client site has hundreds of articles (in an 'articles' structure) that are currently assigned to categories via a categories field. It would be great if they could view the articles by category (which I assume is what the plugin is for?). I installed, activated, and selected the category groups in the plugin settings, but I'm not seeing any obvious changes to the CP. Where are these mysterious category sources? Or am I missing the point? The plugin docs are a bit light on specifics.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-02-23T18:11:04.957" Title="What does the CategorySources plugin do?" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8311" PostTypeId="2" ParentId="8310" CreationDate="2015-02-21T05:52:42.053" Score="6" Body="&lt;p&gt;IMO, the plugin serves two purposes... one of which is simply to serve as an example for how to use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;modifyEntrySources&lt;/code&gt; hook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, the plugin will provide you with an alternative way to view your Entries. You'll notice that the categories which you selected now appear as &lt;strong&gt;entry sources&lt;/strong&gt; on the left sidebar under the Entries tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and &lt;a href=&quot;http://buildwithcraft.com/updates#build2629&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3.2629 is required...&lt;/a&gt; that's when &lt;code&gt;modifyEntrySources&lt;/code&gt; was introduced.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-02-23T18:11:04.957" LastActivityDate="2015-02-23T18:11:04.957" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8312" PostTypeId="2" ParentId="8310" CreationDate="2015-02-21T05:56:33.370" Score="2" Body="&lt;p&gt;The plugin is mainly an example of how to use the new &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySources&lt;/a&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to the entry index page and you should have the category groups you selected in the menu on the left hand side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, click one of the categories in the left hand menu and you'll see any entries that have category fields with them selected.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-21T05:56:33.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8313" PostTypeId="1" AcceptedAnswerId="8317" CreationDate="2015-02-21T11:18:33.940" Score="1" ViewCount="700" Body="&lt;p&gt;I'm trying to create a podcast feed with Craft, and I seem to have everything working... except I can't find out how to grab the length of an audio file dynamically. I can get the filesize in bytes, and if it's an image asset you can get width... but there doesn't seem to be a way to get the play-time for an audio file; which is needed for the &amp;lt;itunes:duration&amp;gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-03-19T19:43:00.963" Title="Getting the length of an audio asset?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8314" PostTypeId="1" AcceptedAnswerId="8323" CreationDate="2015-02-21T12:34:13.397" Score="1" ViewCount="975" Body="&lt;p&gt;When I edit the homepage in the cp I get a error 403.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But only on the homepage. Very weird. The Error is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You don't have permission to access&#xA;  /public/admin/entries/homepage/2-homepage on this server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is totaly the wrong path so I guess it must be a .htaccess problem.&#xA;It's on a server where I have not much rights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't point the url above the webroot to &lt;code&gt;/public/&lt;/code&gt; so I wrote (or better yet pasted) a htaccess in the webroot to redirect into &lt;code&gt;/public/&lt;/code&gt; and I guess thats the problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- .htaccess {# points to public #}&#xA;- craft&#xA;- public&#xA;-- .htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the root htaccess I wrote:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteEngine on&#xA;    RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]&#xA;    RewriteCond %{HTTP_HOST} ^www.domain.com$&#xA;    RewriteCond %{REQUEST_URI} !public/&#xA;    RewriteRule (.*) /public/$1 [L]&#xA;&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteRule ^([^\.]+)$ $1.html [NC,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in &lt;code&gt;/public/.htaccess&lt;/code&gt; I wrote:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Remove file extensions on hostfactory&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteRule ^(.*)\.html$ /$1 [L,R=301] &#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;  RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]&#xA;&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in &lt;code&gt;/public/index.php&lt;/code&gt; there is &lt;code&gt;$craftPath = '../craft';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something strange in there? I have no idea about htacces.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-08-30T11:07:00.950" Title="403 when editing the Homepage" Tags="&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8316" PostTypeId="1" AcceptedAnswerId="8319" CreationDate="2015-02-21T13:17:52.500" Score="1" ViewCount="325" Body="&lt;p&gt;I've read all posts about localization and translation here and at Craft's documentation, but I still haven't found the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want achieve here is having let's say UK instead of British English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found paragraph in documentation:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;Welcome, {name}&quot;|t({ name: user.friendlyName }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;that says:&lt;/strong&gt; If your text contains dynamic variables, add tokens to the string where they should go, and pass an object to the t filter that contains their values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anything like that work by passing object to _locale.php in /translations folder and set other value? Tried, without effect.&#xA;Theoretically it could work, craft would pass the object of an active locale to our translation's file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice, so I don't waste time on something that can't be done.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2016-01-24T09:36:51.870" Title="Can I translate locale names?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8317" PostTypeId="2" ParentId="8313" CreationDate="2015-02-21T14:33:19.653" Score="6" Body="&lt;p&gt;Craft doesn't come with a PHP library for audio, so there's no core solution for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you could do is to make a plugin, add such a library to it and provide &lt;code&gt;duration&lt;/code&gt; and &lt;code&gt;bitrate&lt;/code&gt; Twig filters to your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try out my new &lt;a href=&quot;https://github.com/carlcs/craft-assetmetadata&quot; rel=&quot;nofollow&quot;&gt;&quot;Asset Metadata&quot;&lt;/a&gt; plugin. It makes use of the &lt;a href=&quot;https://github.com/JamesHeinrich/getID3/&quot; rel=&quot;nofollow&quot;&gt;getID3&lt;/a&gt; PHP library to extract all sort of metadata from your assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make your life a bit easier, I added further beautified metadata properties like a sound file's playtime duration in ISO 8601 date interval format (i.e. &lt;code&gt;PT1H21M48S&lt;/code&gt;), or a photo's exposure time as a ratio.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-19T19:43:00.963" LastActivityDate="2015-03-19T19:43:00.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8318" PostTypeId="1" AcceptedAnswerId="8374" CreationDate="2015-02-21T15:54:48.303" Score="1" ViewCount="164" Body="&lt;p&gt;Just Playing around with Craft and get this kind of error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I create a new locale and go to add it to a previously made section I get&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error -&gt; Undefined offset: 0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I noticed that if I create a section after adding the locale I can then edit/remove/re-add locales without errors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm on osx MAMP PRO - php 5.3.28 a module)&lt;/p&gt;&#xA;" OwnerUserId="3328" LastEditorUserId="125" LastEditDate="2015-02-21T16:43:05.147" LastActivityDate="2015-02-24T21:47:22.830" Title="Add locales to section causes error" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8319" PostTypeId="2" ParentId="8316" CreationDate="2015-02-21T17:05:27.783" Score="3" Body="&lt;p&gt;Can't be done, don't waste your time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only thing that could work is via a &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;static translations&lt;/a&gt; file, but the CP gets locale name data directly from that yii language file, so this is your only chance (see &lt;a href=&quot;https://craftcms.stackexchange.com/q/6631/125&quot;&gt;dupe question&lt;/a&gt;). Other things can be overwritten though, e.g &lt;code&gt;'Users' =&amp;gt; 'Members'&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-21T17:05:27.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8320" PostTypeId="1" AcceptedAnswerId="8322" CreationDate="2015-02-21T17:11:57.250" Score="1" ViewCount="1497" Body="&lt;p&gt;I have two menus.&#xA;One with countries, one with navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Navigation menu must to have a index link of a active locale. &#xA;So if I'm at example.com/uk/section and I go to navigation menu and click at index link, I get index of /uk&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My countries menu code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = ['en', 'en_gb', 'sk'] %}&#xA;    {# Check if locale equals the requested page locale #}&#xA;    {% if locale == craft.locale %}&#xA;        {% set current = true %}&#xA;    {% else %}&#xA;        {% set current = false %}&#xA;    {% endif %}&#xA;    {% set locale = craft.i18n.getCurrentLocale() %}&#xA;      {% for locale in locales %}&#xA;         &amp;lt;li&amp;gt;&#xA;           &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; class=&quot;{{ current ? 'uk-active'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to copy &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; &#xA;class=&quot;{{ current ? 'uk-active'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).name }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and put it to my navigation menu I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error    array_key_exists(): The first argument should be either a string or an integer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it fixable or any other way around?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-02-21T17:22:18.157" Title="Get local's URL for index page" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8321" PostTypeId="2" ParentId="8320" CreationDate="2015-02-21T17:20:39.143" Score="2" Body="&lt;p&gt;When calling this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set locale = craft.i18n.getCurrentLocale() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;locale&lt;/code&gt; is set to a full blown &lt;a href=&quot;http://buildwithcraft.com/classreference/models/LocaleModel&quot; rel=&quot;nofollow&quot;&gt;LocaleModel&lt;/a&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're probably looking for is its &lt;a href=&quot;http://buildwithcraft.com/classreference/models/LocaleModel#getId-detail&quot; rel=&quot;nofollow&quot;&gt;getId()&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.config.siteUrl[locale-&amp;gt;getId()]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-21T17:20:39.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8322" PostTypeId="2" ParentId="8320" CreationDate="2015-02-21T17:22:18.157" Score="3" Body="&lt;p&gt;I probably don't fully understand what you're trying to acchieve, but to get to the index page of your current locale, you'd simply use &lt;code&gt;siteUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-21T17:22:18.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8323" PostTypeId="2" ParentId="8314" CreationDate="2015-02-21T17:57:23.090" Score="3" Body="&lt;p&gt;If I understand this correctly, you can't put the /craft folder above the public root, so you put both /craft and /public inside public root? That's no point, and you need a lot more .htaccess vodoo to get that sorted out. But, if the craft folder has to stay inside the public webroot, you should just move it there, and not have an additional /public folder inside it. Your setup should look like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft&lt;/li&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;li&gt;.htaccess&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;/public/index.php&lt;/code&gt; file you the path to craft to &lt;code&gt;$craftPath = './craft'&lt;/code&gt;; and use the default .htaccess file that comes with Craft (or a more complex one).&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-02-21T17:57:23.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8324" PostTypeId="1" AcceptedAnswerId="8329" CreationDate="2015-02-21T20:50:53.883" Score="1" ViewCount="702" Body="&lt;p&gt;I’m trying to set a custom message for a specific model attribute. I have something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes() {&#xA;    return array(&#xA;        'attributeOne' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true,&#xA;            'label' =&amp;gt; 'Attribute One Label'&#xA;        ),&#xA;        'attributeTwo' =&amp;gt; array(&#xA;            AttributeType::String,&#xA;            'required' =&amp;gt; true,&#xA;            'label' =&amp;gt; 'Attribute Two Label'&#xA;        )&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I customise a specific error message for each attribute so that instead of ‘Attribute One Label cannot be blank’, I get ‘Attribute One Label with my custom message’?&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2015-02-22T00:37:43.993" LastActivityDate="2016-04-01T04:29:39.343" Title="Customise errors when validating model data?" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;validation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8326" PostTypeId="1" AcceptedAnswerId="8330" CreationDate="2015-02-21T21:41:34.157" Score="5" ViewCount="2899" Body="&lt;p&gt;As far as I can tell, it's mandatory to have a Single as the site index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I always use a Structure for organising my pages, and different entry types for different page templates. I intend to use a nav tag to output the menu. However, this time my site nav looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Homepage         (site.com/)&#xA;    Subpage 1    (site.com/subpage-1)&#xA;    Subpage 2    (site.com/subpage-2)&#xA;    Subpage 3    (site.com/subpage-3)&#xA;About            (site.com/about/)&#xA;    Subpage 4    (site.com/about/subpage-4)&#xA;    Subpage 5    (site.com/about/subpage-5)&#xA;Services         (site.com/services/)&#xA;    Subpage 6    (site.com/services/subpage-6)&#xA;    Subpage 7    (site.com/services/subpage-7)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I have to use a Single as the home page, how do I put subpages under the home page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Previously I've used the nav tag, and just hardcoded a link to the home page before the rest of the li's, but that's not going to work this time as the homepage has subpages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've updated my sitemap to include a URL structure, which is the real challenge here.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2015-02-22T11:42:41.280" LastActivityDate="2015-02-22T21:43:18.580" Title="How to use a Structure including a homepage" Tags="&lt;structure&gt;&lt;sections&gt;&lt;singles&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8327" PostTypeId="1" AcceptedAnswerId="8328" CreationDate="2015-02-21T23:14:45.973" Score="0" ViewCount="143" Body="&lt;p&gt;I'm trying to upgrade an Craft site from 1.3 to 2.3 and have gotten into a broken state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The update button failed, so I tried a manual update. This noted that I needed at least version 2.1, which I then downloaded and tried. It throws the following error and reverts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'edition' in 'field list'&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I revert back to 1.3 the admin screen is now blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant versions/schema info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Version: 1.3, Build: 2486, Schema: 1.3.15 (blank login)&lt;/li&gt;&#xA;&lt;li&gt;Version: 2.1, Build: 2570, Schema: 2.1.2 (SQL error)&lt;/li&gt;&#xA;&lt;li&gt;Version: 2.3, Craft Build: 2635, Schema: 2.3.4 (desired version)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The craft_info table shows that I'm running 1.3. The site is up, but I can't access the backend. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3331" LastActivityDate="2015-02-22T00:54:36.780" Title="Borked upgrade from 1.3 to 2.3" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8328" PostTypeId="2" ParentId="8327" CreationDate="2015-02-22T00:54:36.780" Score="0" Body="&lt;p&gt;In between borked update attempts, are you restoring the database to the pre-update state? By default, Craft will create a database backup and place it in the &lt;code&gt;craft/storage/backups&lt;/code&gt; folder during an update that you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files you'll be able to 1) see the error that originally happened to cause the failed update and 2) see the error that's preventing the CP from loading.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-22T00:54:36.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8329" PostTypeId="2" ParentId="8324" CreationDate="2015-02-22T01:05:30.943" Score="1" Body="&lt;p&gt;If you use the &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;static translation&lt;/a&gt; method, then that will override &lt;em&gt;all&lt;/em&gt; &lt;code&gt;{attribute} cannot be blank.&lt;/code&gt; translations, not just for your specific attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attribute validation error messages aren't directly tied to the attribute, but they are tied to a &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CValidator&quot; rel=&quot;nofollow&quot;&gt;validator&lt;/a&gt; that is tied to an attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the proper way to do this would be to have a plugin that provides its own validator (even if it just extends one of Yii's default to change the message) and tell the attribute to use your custom validator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see examples of how to approach that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/wiki/56/&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/wiki/56/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-22T01:05:30.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8330" PostTypeId="2" ParentId="8326" CreationDate="2015-02-22T02:46:42.307" Score="4" Body="&lt;p&gt;&lt;strong&gt;Updated answer to reflect your added uri requirements.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given your desired uri patterns, I would recommend moving 'subpage-1', 'subpage-2', and 'subpage-3' to the root of your structure which will make all the uri's the way you want without needing to define any custom routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For auto-generating the navigation, you can then simply add some logic to either include or exclude those items, depending on how you want your nav to work. You could do this by checking the 'level' and 'hasDescendants()' (if that's consistent) or by entry type (if you want to use something more specific).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you wanted to exclude subpages-1,-2,-3 in the site nav (using entryType), but include them in the homepage page nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageEntries = craft.entries.section('pages') %}&#xA;&#xA;&amp;lt;ul id=&quot;site-nav&quot;&amp;gt;&#xA;    {# skip entries of type 'homepageSubpage' #}&#xA;    {% nav entry in pageEntries if not entry.type == 'homepageSubpage'  %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;ul class=&quot;homepage-nav&quot;&amp;gt;&#xA;    {# only show entries of type 'homepageSubpage' #}&#xA;    {% for entry in pageEntries if entry.type == 'homepageSubpage' %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also of course, leave the 'homepage' entry, sitting next to subpage-1,-2,-3, About, and Services and use the technique as described by carlcs.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-22T20:49:34.110" LastActivityDate="2015-02-22T20:49:34.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8331" PostTypeId="2" ParentId="8326" CreationDate="2015-02-22T02:51:58.867" Score="3" Body="&lt;p&gt;You don't have to use an extra single section for the homepage, see here: &lt;a href=&quot;https://craftcms.stackexchange.com/q/1467/125&quot;&gt;&quot;Add home page to a structure?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; As this question is slightly different to the one I linked to, I will add some more detail&#xA;on how you can keep your &quot;pages&quot; structure as is. To get the &quot;homepage&quot; entry to load for&#xA;visits to myexample.com, add a template file with the following code to your webroot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;index.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the home page's Entry Model via its slug #}&#xA;{% set entry = craft.entries.section('pages').slug('home').first() %}&#xA;&#xA;{# Load the home page's template from the &quot;pages&quot; structure #}&#xA;{% include &quot;_pages/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for the child entries of &quot;homepage&quot; you could do the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;subpage-1.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('pages').slug('subpage-1').first() %}&#xA;{% include &quot;_pages/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or as an alternative solution you could instead add custom routes to config/routes.php&lt;br&gt;&#xA;&lt;code&gt;'(?P&amp;lt;slug&amp;gt;subpage-1)' =&amp;gt; '_pages/_entry'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the get the Entry Model in _pages/_entry.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('pages').slug(slug).first() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-02-22T17:04:56.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8332" PostTypeId="1" CreationDate="2015-02-22T08:10:43.557" Score="0" ViewCount="129" Body="&lt;p&gt;I'm showing a modal using &quot;createElementSelectorModal()&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases I need to pass ids of elements which should be selected right after the modal is created. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="3318" LastEditorUserId="344" LastEditDate="2015-05-29T13:14:22.297" LastActivityDate="2015-05-29T13:14:22.297" Title="How to set selected elements when creating modal with &quot;createElementSelectorModal()&quot;?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8333" PostTypeId="2" ParentId="8324" CreationDate="2015-02-22T13:59:03.113" Score="2" Body="&lt;p&gt;In addition to Brad&amp;#8217;s answer (which is what I was looking for), you could also use template-specific messages using conditionals if for some reason you only needed to override the global error in a certain place. Unlikely but here’s an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errors.attributeOne is defined ? errors.attributeOne | length %}&#xA;    &amp;lt;p class=&quot;alert&quot;&amp;gt;Custom message.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2015-02-22T15:27:48.933" LastActivityDate="2015-02-22T15:27:48.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8334" PostTypeId="1" AcceptedAnswerId="8337" CreationDate="2015-02-22T15:40:15.760" Score="1" ViewCount="802" Body="&lt;p&gt;I'm asking, because I was trying to find out the whole afternoon. Found some posts, but they were related to getting all territories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have locales like English, French, Chinese and I'd like to add country to each related locale from territories, because each locale.php in /data folder has the values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it would looks like: Territory(United Kingdom) locale(English)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code I'm working on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;    {# Configure site locales #}&#xA;    {% set locales = ['en', 'en_gb', 'sk'] %}&#xA;    {# Check if locale equals the requested page locale #}&#xA;    {% if locale == craft.locale %}&#xA;        {% set current = true %}&#xA;    {% else %}&#xA;        {% set current = false %}&#xA;    {% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for locale in locales %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot;&amp;gt;&#xA;         ({{ craft.i18n.getLocaleById(locale).nativeName }})&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is a list of locales with native name:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(English)&lt;/li&gt;&#xA;&lt;li&gt;(British English)&lt;/li&gt;&#xA;&lt;li&gt;(Slovak)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If there would be a way to relate it's country to each locale from territories, that we wouldn't have to touch app folder to customize the lang files, like I read in other posts.&#xA;By doing so, We could achieve this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;World (English)&lt;/li&gt;&#xA;&lt;li&gt;United Kingdom (British English)&lt;/li&gt;&#xA;&lt;li&gt;Slovakia (Slovak)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it moved on a little bit. With the code @carlcs provided, Craft was able to get a territory. There must to be some bug in it, because &lt;strong&gt;from 3 locales, It got assigned to only one territory&lt;/strong&gt; (United Kingdom - British English).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is updated code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;ul class=&quot;uk-nav&quot;&amp;gt;&#xA; {% set locales = ['en', 'en_gb', 'sk'] %}&#xA;   {% for locale in locales %}&#xA;      {% set subTags = locale|split('_') %}&#xA;         {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;             &amp;lt;li&amp;gt;&#xA;                 &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; class=&quot;{{ current ? 'uk-active'}}&quot;&amp;gt;&#xA;                 {% if territory %}{{ territory }}{% endif %} ({{craft.i18n.getLocaleById(locale).nativeName }})&#xA;                 &amp;lt;/a&amp;gt;&#xA;             &amp;lt;/li&amp;gt;&#xA;  {% endfor %} &#xA;  &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-03-01T21:54:42.883" LastActivityDate="2015-03-06T13:21:32.000" Title="Get the territory / country belonging to a locale?" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8335" PostTypeId="2" ParentId="7096" CreationDate="2015-02-22T16:59:28.567" Score="2" Body="&lt;p&gt;I've run into this as well. As Brad points out, this does appear to involve a bug in Craft's cache handling. HOWEVER, if you resort to caching only your HTML output, you don't reap the benefit of actually caching that big database query... What has worked for me is providing an explicit cache key:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path ~ 'someDescriptive/identifyingName' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I've been using descriptors in my cache keys because I've been needing to clear out various subsets of them very frequently, but you don't have to if you just have one &lt;code&gt;{% cache %}&lt;/code&gt; fragment on a page.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-22T16:59:28.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8336" PostTypeId="1" CreationDate="2015-02-22T20:19:52.013" Score="1" ViewCount="737" Body="&lt;p&gt;I'm trying to create a plugin to create/update users' profile data. I figured out how to create a user but updating... not so much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$user-&amp;gt;setContent(array('middleName' =&amp;gt; &quot;Dave&quot;));&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From what I understand the &quot;saveUser&quot; method is used for both creating and updating user data. Whenever I run the code I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-en_us' for key 'craft_content_elementId_locale_unq_idx'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;strong&gt;&quot;saveUser&quot;&lt;/strong&gt; is truly used for creating and updating what am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="784" LastEditDate="2015-02-22T20:24:07.050" LastActivityDate="2015-03-24T21:25:12.467" Title="Update User Profile with Plugin" Tags="&lt;user-profile&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8337" PostTypeId="2" ParentId="8334" CreationDate="2015-02-22T20:36:14.767" Score="3" Body="&lt;p&gt;You can't get a territory name directly from a locale tag (e.g. 'en' or 'en_gb'). But what you could do is to&#xA;take the territory part of the tag (two letter country code; &lt;strong&gt;keep in mind, it's optional&lt;/strong&gt;) and get the territory&#xA;name via &lt;code&gt;getTerritory&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = ['en_gb', 'fr_fr', 'zh_cn'] %}&#xA;&#xA;{% for locale in locales %}&#xA;&#xA;    {% set subTags = locale|split('_') %}&#xA;&#xA;    {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}&#xA;&#xA;    {% set language = craft.i18n.getLocaleById(locale).name %}&#xA;    {% set language = language ?: craft.i18n.getLocaleById(subTags|first).name %}&#xA;    {% set language = language|replace(&quot;/- #{territory}$/&quot;, '') %}&#xA;&#xA;    {% if territory and language %}&#xA;        &amp;lt;li&amp;gt;Territory: {{ territory }}, Language: {{ language }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-06T13:21:32.000" LastActivityDate="2015-03-06T13:21:32.000" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8338" PostTypeId="2" ParentId="8336" CreationDate="2015-02-22T20:37:33.373" Score="3" Body="&lt;p&gt;I'm not sure if this is causing your error, but it's recommended to use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContentFromPost()&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttribute-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getContent()-&gt;setAttributes()&lt;/a&gt; so that craft has a chance to prep the field values, as discussed in this answer, &lt;a href=&quot;https://craftcms.stackexchange.com/a/6788/784&quot;&gt;setContent() vs $entry-&gt;getContent()-&gt;foo&lt;/a&gt;, and &lt;a href=&quot;https://craftcms.stackexchange.com/a/4487/784&quot;&gt;What is getContent()?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$user-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'middleName' =&amp;gt; &quot;Dave&quot;,&#xA;));&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although with that error it's possible that something else is going on in your plugin.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-22T20:37:33.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8339" PostTypeId="2" ParentId="8326" CreationDate="2015-02-22T21:28:06.750" Score="6" Body="&lt;p&gt;You can &lt;a href=&quot;https://craftcms.stackexchange.com/a/5467/689&quot;&gt;place your homepage entry in a Structure&lt;/a&gt; by setting its slug to &lt;code&gt;__home__&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing so causes the entry to answer for the &lt;code&gt;/&lt;/code&gt; &lt;em&gt;(empty)&lt;/em&gt; URI, and it even places the little &quot;home&quot; icon in place of the Entry's slug in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you do this, its best not to nest pages under the homepage, because then their URIs would be of the form: &lt;code&gt;__home__/subPageSlug&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, taking the pages from your example, it's best if your structure can be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Homepage         (site.com/)&#xA;Subpage 1        (site.com/subpage-1)&#xA;Subpage 2        (site.com/subpage-2)&#xA;Subpage 3        (site.com/subpage-3)&#xA;About            (site.com/about/)&#xA;    Subpage 4    (site.com/about/subpage-4)&#xA;    Subpage 5    (site.com/about/subpage-5)&#xA;Services         (site.com/services/)&#xA;    Subpage 6    (site.com/services/subpage-6)&#xA;    Subpage 7    (site.com/services/subpage-7)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want the benefit of placing the homepage in the Structure, but you need to organize some pages as descendants of the homepage, you &lt;em&gt;could&lt;/em&gt;, in theory, rig it up... But it'd get pretty janky:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Give the homepage the special &lt;code&gt;__home__&lt;/code&gt; slug.&lt;/li&gt;&#xA;&lt;li&gt;Build an &lt;code&gt;index&lt;/code&gt; template to answer for the descendant pages by finding the intended entry, setting a &lt;code&gt;entry&lt;/code&gt; variable, and extending your regular Page template.&lt;/li&gt;&#xA;&lt;li&gt;Create an .htaccess rule to remove the &lt;code&gt;__home__&lt;/code&gt; segment from a URL if anybody accidentally lands on it, to prevent duplicate content from appearing at multiple URLs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, there are major drawbacks to this second approach:&lt;/strong&gt; First, you won't be able to use your entries' &lt;code&gt;url()&lt;/code&gt; method... or, you'll have to somehow filter out the offending &lt;code&gt;__home__/&lt;/code&gt; segment out of the URL any time you loop through entries or use the &lt;code&gt;{% nav %}&lt;/code&gt; tag to generate your site nav. Also, this alternative option also foils Craft's built-in slug-uniqueness checking, so if you're not careful you could end up with duplicate slugs for some pages. In general, I don't recommend it... but it's a fun thought exercise.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-02-22T21:43:18.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8340" PostTypeId="1" AcceptedAnswerId="8470" CreationDate="2015-02-22T22:03:52.320" Score="1" ViewCount="277" Body="&lt;p&gt;I'm after using a date-time field within a table cell. I suspect it requires a plugin to make this happen - has anyone done this?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-03-03T10:01:50.077" Title="Date-time field within tables" Tags="&lt;datetime&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8341" PostTypeId="1" AcceptedAnswerId="8343" CreationDate="2015-02-23T00:47:00.593" Score="2" ViewCount="305" Body="&lt;p&gt;Is Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;Search&lt;/a&gt; case-insensitive?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And is there a way to toggle case-sensitivity on/off?)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-11-14T19:24:19.570" Title="Is Craft's search() case-insensitive?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8342" PostTypeId="1" AcceptedAnswerId="8344" CreationDate="2015-02-23T00:48:25.607" Score="2" ViewCount="116" Body="&lt;p&gt;Is Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;.search()&lt;/code&gt;&lt;/a&gt; diacritic-insensitive?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If not, is there a way to make it so?)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-02-23T01:02:41.753" Title="Is Craft's search diacritic-sensitive?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8343" PostTypeId="2" ParentId="8341" CreationDate="2015-02-23T00:49:54.070" Score="4" Body="&lt;p&gt;It depends on the underlying MySQL collation of the database and the tables Craft is searching against.  The MySQL 5.1 rules surrounding this can be found here: &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isn't anything in Craft where you can toggle the case sensitivity of searches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out I was completely wrong on this. Case sensitive searches &lt;em&gt;would&lt;/em&gt; rely on the database's underlying collation if Craft didn't normalize all search keywords to lowercase first.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-11-14T19:24:19.570" LastActivityDate="2016-11-14T19:24:19.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8344" PostTypeId="2" ParentId="8342" CreationDate="2015-02-23T01:02:41.753" Score="3" Body="&lt;p&gt;In pure MySQL land, this will depend on the underlying character set and collation of the underlying database and tables that Craft is searching against.  You can read more on the MySQL 5.1 rules regarding that &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and see an example of how to utilize it &lt;a href=&quot;https://stackoverflow.com/questions/3304464/mysql-diacritic-insensitive-search-spanish-accents&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, however, we will do some normalization and additionally &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/StringHelper.php#L355&quot; rel=&quot;nofollow&quot;&gt;swap any known diacritics&lt;/a&gt; with their ASCII counterparts (ü =&gt; u) among other things before saving to the &lt;code&gt;craft_searchindex&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-23T01:02:41.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8345" PostTypeId="2" ParentId="6533" CreationDate="2015-02-23T01:05:43.943" Score="4" Body="&lt;p&gt;No, Craft will not be able to generate JPGs from SVGs out of the box (I tested it), but it should be relatively easy to write a plugin handling it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As GD doesn't support SVG, ImageMagick support is a must. Craft actually &lt;em&gt;does&lt;/em&gt; use ImageMagick, if its installed on your server – so your first step would be to check for ImageMagick support. An easy way to do that, is to use Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ImagesService#isImagick-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImagesService&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, the actual PHP code generating the JPG should be relatively straight-forward – check &lt;a href=&quot;https://stackoverflow.com/questions/10289686/rendering-an-svg-file-to-a-png-or-jpeg-in-php&quot;&gt;this Stack Overflow thread&lt;/a&gt; for a concise example (not tested the mentioned code myself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Be advised that Craft actually implements all of its image manipulation through the &lt;a href=&quot;https://imagine.readthedocs.org/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagine&lt;/a&gt; library – I'm pretty sure Imagine would handle the generation, but if you need to work with ImageMagick directly you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$factory = new \Imagine\Imagick\Imagine();&#xA;$svg = $factory-&amp;gt;open( $path );&#xA;$imagick = $svg-&amp;gt;getImagick();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, when it comes to implementing the JPG generation you have a few options – for example you could &lt;a href=&quot;https://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a Twig filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ image | svgFallback }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also implement it as a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;template variable method&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ craft.yourPluginName.getSvgFallback( image ) }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you could even hook into &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService events&lt;/a&gt; if you needed to generate the fallback automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated answer: The original question asks if &quot;image transforms can be modified to handle this&quot;. The short answer is no – ideally there would be a &lt;code&gt;beforeTransformApplied&lt;/code&gt; hook or something like that, but as of 2.3 there isn't (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1025/is-it-possible-to-hook-into-image-transforms&quot;&gt;this thread&lt;/a&gt; for reference). My opinion is that your best bet is creating a variable method or Twig filter, as outlined above.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-23T08:22:02.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8346" PostTypeId="2" ParentId="8332" CreationDate="2015-02-23T07:02:15.987" Score="1" Body="&lt;p&gt;If I'm interpreting 'craft.js' correctly, there doesn't seem to be any way to do this, at least not via craft methods. Apart from passing in the initial settings parameter, everything else looks like protected methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially do it manually through javascript however by triggering a 'click' event on the elements directly. You would have to wait until the elements are loaded first however.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.elements tr[data-id=&quot;2201&quot;]').trigger('click');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-23T07:16:27.757" LastActivityDate="2015-02-23T07:16:27.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8347" PostTypeId="1" CreationDate="2015-02-23T12:45:27.830" Score="0" ViewCount="199" Body="&lt;p&gt;Hello Craft Community,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a site which has just over 300 entries but most entries have several asset fields, entry fields, or complex matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that when on an existing entry, I cannot drag-to-reorder any items in an asset or entry field-type. The CP will let me reorder, but saving the entry does not retain my new ordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no console errors related to this problem, so I'm looking for advise on where to start troubleshooting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit: additional note that my PHP runtime config variables seem to be in order, 256M memory, 3000 max_input_vars, etc.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2216" LastEditorUserId="2216" LastEditDate="2015-02-24T20:39:53.457" LastActivityDate="2015-02-24T20:39:53.457" Title="Order of draggable entries and assets won't save" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;entry-type&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-03-01T06:05:20.350" ContentLicense="CC BY-SA 3.0" />
  <row Id="8348" PostTypeId="1" AcceptedAnswerId="8358" CreationDate="2015-02-23T13:29:00.567" Score="6" ViewCount="1043" Body="&lt;p&gt;I've got a plugin with some custom settings, like this: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;                 'serviceendpoint' =&amp;gt; array(AttributeType::String, 'required'=&amp;gt;true),&#xA;                 'passkey' =&amp;gt; array(AttributeType::String, 'required'=&amp;gt;true),&#xA;                 'newregistrationdate' =&amp;gt; array(AttributeType::DateTime, 'required'=&amp;gt;false),&#xA;                 );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I have a _settings template, which renders the form: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;    first:        true,&#xA;    label:        &quot;CRM Endpoint URL&quot;|t,&#xA;    id:           'serviceendpoint',&#xA;    name:         'serviceendpoint',&#xA;    instructions: &quot;The URL for the CRM service .&quot;|t,&#xA;    value:        settings.serviceendpoint,&#xA;    autofocus:    true,&#xA;    placeholder: &quot;https://example.com/api/...&quot;,&#xA;    errors:       settings.getErrors('serviceendpoint')&#xA;}) }}&#xA;&#xA;{{ forms.textField({&#xA;    label:        &quot;The service passkey&quot;|t,&#xA;    id:           'passkey',&#xA;    name:         'passkey',&#xA;    instructions: &quot;&quot;|t,&#xA;    value:        settings.passkey,&#xA;    placeholder: &quot;1234...&quot;,&#xA;    errors:       settings.getErrors('passkey')&#xA;}) }}&#xA;&#xA;&amp;lt;pre&amp;gt;Val: &quot;{{ dump(settings.newregistrationdate) }}&quot;&amp;lt;/pre&amp;gt;&#xA;{{ forms.dateField({&#xA;    label:        &quot;New registrations after this date&quot;|t,&#xA;    id:           'newregistrationdate',&#xA;    name:         'newregistrationdate',&#xA;    instructions: &quot;Users registered after this date will get a welcome email&quot;|t,&#xA;    value:        settings.newregistrationdate.date|default,&#xA;    errors:       settings.getErrors('newregistrationdate')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The String-typed values are saved just fine. But the &lt;code&gt;DateTime&lt;/code&gt; always comes back as &lt;code&gt;false&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding a prepSettings function, and doing: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $settings['newregistrationdate'] = new DateTime($settings['newregistrationdate']['date']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it makes no difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does &lt;code&gt;prepSettings&lt;/code&gt; have to return for &lt;code&gt;DateTime&lt;/code&gt; typed fields? &lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-02-26T14:31:05.970" Title="How do I save a Plugin's date settings-field?" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8349" PostTypeId="1" AcceptedAnswerId="8350" CreationDate="2015-02-23T14:03:13.943" Score="0" ViewCount="220" Body="&lt;p&gt;I've got this code snippet I'm working with and I can't get tags pulled out for related entry in current locale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe worth to mention, that tags is matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set entries = craft.entries %}&#xA;&#xA;  {% for entry in entries %}&#xA;  &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;  {% for tag in craft.tags.relatedTo({&#xA;          sourceElement: entries,&#xA;          sourceLocale: craft.locale&#xA;  }) %}&#xA;     &amp;lt;li&amp;gt;&#xA;     { tag.title }}&#xA;     &amp;lt;/li&amp;gt;&#xA;     {% else %}&#xA;     &amp;lt;li&amp;gt;&#xA;     No tags found&#xA;     &amp;lt;/li&amp;gt;&#xA;     {% endfor %}&#xA;     {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-02-23T15:00:59.310" LastActivityDate="2015-02-23T15:07:31.823" Title="Display tag related to entry in current locale" Tags="&lt;localization&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8350" PostTypeId="2" ParentId="8349" CreationDate="2015-02-23T15:07:31.823" Score="1" Body="&lt;p&gt;As pointed out in the comments to your question, there's no need&#xA;to specify the locale with your &lt;code&gt;relatedTo&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already wrote you in response to your other question, Craft always works in one locale&#xA;only if you don't explicitly make it to do otherwise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for tag in craft.tags.relatedTo(entry) %}&#xA;&#xA;        {{ loop.first ? '&amp;lt;ul&amp;gt;' }}&#xA;        &amp;lt;li&amp;gt;{{ tag.title }}&amp;lt;/li&amp;gt;&#xA;        {{ loop.last ? '&amp;lt;/ul&amp;gt;' }}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;No tags found&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-02-23T15:07:31.823" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8351" PostTypeId="1" AcceptedAnswerId="8354" CreationDate="2015-02-23T17:16:05.197" Score="1" ViewCount="569" Body="&lt;p&gt;Using the code below, Craft was able to get related tags to an entry, before I decided to move TagFieldType to MatrixFieldType.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;   &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;   {% for tag in craft.tags.relatedTo(entry) %}&#xA;&#xA;   &amp;lt;li&amp;gt;&#xA;     { tag.title }}&#xA;   &amp;lt;/li&amp;gt;&#xA;&#xA; {% else %}&#xA;&#xA;   &amp;lt;p&amp;gt;No tags found&amp;lt;/p&amp;gt;&#xA;&#xA; {% endfor %}&#xA;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm quiet struggling to pull tags out so I rather share with you my Field's structure in my CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GaX5u.png&quot; alt=&quot;TagGroup&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Se2Vz.png&quot; alt=&quot;MatrixFields&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LqtmI.png&quot; alt=&quot;TagField&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took many options to consider, Why I can't get it right, even found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5056/query-for-blocks-across-block-types-using-the-new-field-parameter&quot;&gt;the post&lt;/a&gt;, that same handles may cause a problems, so I gave them all unique handles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AWOFG.png&quot; alt=&quot;EntryFieldLayout&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-02-25T17:19:41.840" Title="Output tags from matrix fields related to an entry" Tags="&lt;matrix&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8352" PostTypeId="2" ParentId="8348" CreationDate="2015-02-23T17:48:20.923" Score="3" Body="&lt;p&gt;I didn't have time to setup this scenario locally, but you may want to use AttributeType::Mixed. I believe the dateField macro returns the value as an array, so using AttributeType::Mixed should allow that value to be saved. All your other code looks correct, so it has to be your settings model not getting populated correctly.&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-02-23T17:48:20.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8353" PostTypeId="2" ParentId="1245" CreationDate="2015-02-23T17:56:02.943" Score="4" Body="&lt;p&gt;Here's how you would exclude the current entry from showing within that output if so desired&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  relatedTo:      tags,&#xA;  order:          'score',&#xA;  limit:           4,&#xA;  id:             'not ' ~ entry.id&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-02-23T17:56:02.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8354" PostTypeId="2" ParentId="8351" CreationDate="2015-02-23T18:04:22.147" Score="2" Body="&lt;p&gt;To get tags defined within a matrix field, you will first want to loop through the matrix-blocks in your matrix; and then loop through the tags in your tags field defined in each block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixFieldHandle %}&#xA;    {% for tag in block.myTagsFieldHandle %}&#xA;        {{ tag.title }}&#xA;    {% else %}&#xA;        No Tags found.&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, for retrieving tags defined in a tags field on an entry (as in your example), you can simply retrieve the tags through the tags field directly, rather than using &lt;code&gt;relatedTo(entry)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in entry.myTagsFieldHandle %}&#xA;    {{ tag.title }}&#xA;{% else %}&#xA;    No Tags found.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more information please see the documentation for &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields#templating&quot; rel=&quot;nofollow&quot;&gt;tags&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow&quot;&gt;matrix fields&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to output your tags as you have them displayed in your screenshots, then use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for block in entry.technologyField %}&#xA;        {% if block.type == &quot;tag&quot; %}&#xA;            {% for tag in block.technologyTag %}&#xA;                {{ tag.title }}&#xA;            {% else %}&#xA;                No Tags found.&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I can also see some potential problems with your naming system and how you are using matrix blocks. Here are some suggestions for improvement.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You don't need to end each Tag Group handle with 'TagGroup', as you already know that it's a Tag Group (so instead of 'technologyTagGroup', you can simply call it 'technology').&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You don't need to end each field handle with 'Field', as you already know that it's a field (so instead of 'technologyField', you can simply call it 'technology').&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matrix block types support more than one field — I suspect that instead of having 3 separate block types defined, you actually only want 1 block type defined (let's call it 'technology' for example), with three fields in it: 'text', 'media', and 'tags' (or 'technologyTags' if you prefer).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When using a Tags Field Type (or Assets, Entries, Categories or anything else with more than one item), it is generally a good practice to name the field handle plural so that you always know that it contains more than one of something (so instead of 'tag' the field should be called 'tags').&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you followed #1, #2, #3, #4 above then the code to output your tags would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.technology %}&#xA;    {% for tag in block.tags %}&#xA;        {{ tag.title }}&#xA;    {% else %}&#xA;        No Tags found.&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you later define another Block Type then when looping through the blocks you will need to check &lt;code&gt;block.type&lt;/code&gt;, and only include those that have a Tags Field defined with the handle your looking for ('tags' in this case). For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.technology %}&#xA;    {% if block.type == &quot;technology&quot; %}&#xA;        {% for tag in block.tags %}&#xA;            {{ tag.title }}&#xA;        {% else %}&#xA;            No Tags found.&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-25T17:19:41.840" LastActivityDate="2015-02-25T17:19:41.840" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8356" PostTypeId="2" ParentId="8347" CreationDate="2015-02-23T19:18:32.367" Score="1" Body="&lt;p&gt;From your description, if I had to guess, you're running into a php.ini &lt;a href=&quot;http://php.net/manual/en/info.configuration.php#ini.max-input-vars&quot; rel=&quot;nofollow&quot;&gt;max_input_vars&lt;/a&gt;, &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.post-max-size&quot; rel=&quot;nofollow&quot;&gt;post_max_size&lt;/a&gt; or some other related environmental limitation.  I'd try bumping those as a starting point for debugging.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-23T19:18:32.367" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8357" PostTypeId="1" CreationDate="2015-02-23T19:42:29.237" Score="5" ViewCount="222" Body="&lt;p&gt;I have a client that wants to sell products (digital content) that are only viewable in templates. These are not PDFs. The template page will have content on it that is only available to people that purchased the product. This is not a subscription, but a product sale with unlimited viewing after purchase via a secure login area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good Ecommerce option for this project as there could be multiple products purchased at once? How can I make it so only validated purchasers can see the template content of the products purchased? Snipcart looks cool but no idea how to secure the templates for valid purchasers. Any better way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bryan&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="344" LastEditDate="2015-05-01T10:36:04.597" LastActivityDate="2015-05-01T10:36:04.597" Title="How sell products with Craft and secure the product viewing pages?" Tags="&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8358" PostTypeId="2" ParentId="8348" CreationDate="2015-02-23T20:45:46.860" Score="6" Body="&lt;p&gt;Yup, you need to use &lt;code&gt;AttributeType::Mixed&lt;/code&gt; as Justin Kimbrell suggests. The date will then be escaped and stored in the database like this: *&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&quot;newregistrationdate&quot;:{&quot;date&quot;:&quot;2\/1\/2015&quot;}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the dateField in your settings template will expect a &lt;code&gt;DateTime&lt;/code&gt; object for its value – so just passing &lt;code&gt;getSettings()&lt;/code&gt; as is will make it choke. You can get around that by adding the following to the &lt;code&gt;getSettingsHtml()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = $this-&amp;gt;getSettings();&#xA;if ( isset( $settings[ 'newregistrationdate' ][ 'date' ] ) ) {&#xA;    $settings[ 'newregistrationdate' ] = new DateTime( $settings[ 'newregistrationdate' ][ 'date' ] );&#xA;}&#xA;return craft()-&amp;gt;templates-&amp;gt;render( 'yourPluginHandle/settings', array(&#xA;    'settings' =&amp;gt; $settings,&#xA;) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and then finally, make sure the &lt;code&gt;dateField&lt;/code&gt; constructor looks in the right place for its value by removing the &lt;code&gt;date&lt;/code&gt; key of the &lt;code&gt;settings.newregistrationdate&lt;/code&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.dateField({&#xA;    label:        &quot;New registrations after this date&quot;|t,&#xA;    id:           'newregistrationdate',&#xA;    name:         'newregistrationdate',&#xA;    instructions: &quot;Users registered after this date will get a welcome email&quot;|t,&#xA;    value:        settings.newregistrationdate,&#xA;    errors:       settings.getErrors('newregistrationdate')&#xA; }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Solution is tested.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Note that the date object is actually serialized, escaped and stored properly even if you use &lt;code&gt;AttributeType::DateTime&lt;/code&gt;, however &lt;code&gt;getSettings()&lt;/code&gt; will always return the attribute value as &lt;code&gt;false&lt;/code&gt;. Could be a bug?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-02-23T20:51:29.013" LastActivityDate="2015-02-23T20:51:29.013" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8359" PostTypeId="2" ParentId="8357" CreationDate="2015-02-23T20:58:38.787" Score="2" Body="&lt;p&gt;I can only really comment on securing content as I haven't used any ecommerce solutions with craft. But as far as that is concerned — one approach would be to add a related entries field-type on the users' field layout (called 'purchasedProducts'). When a user purchases a product you can add that entry to their purchased products via a plugin. You can then check the current entry against the related entries to determine if the user is authorized to view the content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorized = false %}&#xA;{% if currentUser %}&#xA;    {% if entry.id in currentUser.purchasedProducts.ids() %}&#xA;        {% set authorized = true %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if not authorized %}&#xA;&#xA;    {% redirect 403 %} &#xA;&#xA;    // or display product teaser and purchase button&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ product.title }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ product.description }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;a href=&quot;purchase/product/path?id={{ product.id }}&quot;&amp;gt;Purchase&amp;lt;/a&amp;gt;&#xA;&#xA;{% else %}&#xA;&#xA;     {# output entry #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To create an index page of all purchased entries, you can loop through the currentUsers purchased entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in currentUser.purchasedProducts %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;li&amp;gt;You have not purchased any products.&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To show all products and add a 'purchase' or 'view' button depending on whether they've purchased the product or not, you can check if the entry is in a 'purchasedProductsIds' array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set purchasedProductsIds = [] %}&#xA;{% if currentUser %}&#xA;    {% set purchasedProductsIds = currentUser.purchasedProducts.ids() %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for product in craft.entries.section('products') %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ product.title }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ product.description }}&amp;lt;/p&amp;gt;&#xA;            {% if product.id in purchasedProductsIds %}&#xA;                &amp;lt;a href=&quot;{{ product.url}}&quot;&amp;gt;View&amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;a href=&quot;purchase/product/path?id={{ product.id }}&quot;&amp;gt;Purchase&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously you will also need to add a small plugin to respond to the purchase process (via a hook or event) and update the user's purchasedProducts. Check out &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;usersService saveUser method&lt;/a&gt; for more info or search this site for many examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as ecommerce solutions, I haven't used any with craft so I can't really comment. However, I did find a tutorial on &lt;a href=&quot;https://snipcart.com/blog/managing-your-craft-inventory-using-snipcart-webhooks&quot; rel=&quot;nofollow&quot;&gt;managing your craft inventory with snip cart&lt;/a&gt;, which should describe everything you need to create the webhook.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-24T00:19:31.740" LastActivityDate="2015-02-24T00:19:31.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8360" PostTypeId="1" CreationDate="2015-02-24T01:15:54.247" Score="11" ViewCount="4449" Body="&lt;p&gt;Is it possible to protect a page with a single password? Instead of using crafts user features, can I allow an admin to set a specific password from the edit page? When a user visits that page, they have to type in that password to view its content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We aren't protecting anything that requires a high level of security. But we would like to prohibit access from any old visitor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possibility I'm considering is to have a password text field associated with that entry. Then when the user submit the login form, we can do a simple logic check to see if the password is valid. If so, we can set a “logged-in” status to either a PHP session or a cookie. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot;&gt;https://github.com/lewisjenkins/craft-lj-cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/stuartalexwhitehead/remember&quot;&gt;https://github.com/stuartalexwhitehead/remember&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if anyone else in the Craft community has tried to implement something like this. &lt;/p&gt;&#xA;" OwnerUserId="3335" LastActivityDate="2017-12-01T15:13:59.343" Title="Protect a page with a single password?" Tags="&lt;plugins&gt;&lt;password&gt;&lt;login&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8361" PostTypeId="1" CreationDate="2015-02-24T03:05:11.720" Score="2" ViewCount="875" Body="&lt;p&gt;I have a Craft site I am building that will be selling about 20 templates with private password protected content (each a product basically). I need to allow people to &quot;buy&quot; access to each page. These purchases are one time and not a recurring subscription. Customers would have lifetime access to each product page content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have use plugins like Charge on other sites with Stripe. This works great for single product sites, but we want to allow people to buy access to more than one product. Is there any way to just build a simple cart with Craft to work with Stripe? Is there any cart code samples for Stripe? My needs are simple but I have been having a hard time finding an option without using a 3rd party solution like Foxy or Snipcart. Any ideas or suggestions. &lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="344" LastEditDate="2015-05-29T13:14:16.737" LastActivityDate="2015-05-29T13:14:16.737" Title="Need a simple shopping cart for Stripe" Tags="&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8362" PostTypeId="2" ParentId="8361" CreationDate="2015-02-24T06:23:22.690" Score="1" Body="&lt;p&gt;It sounds like &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/commerce&quot; rel=&quot;nofollow&quot;&gt;Sprout Commerce&lt;/a&gt; can handle your situation – multiple products, user-specific access, and Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the time of this post, the product is still in private beta but if you'd like to drop us a note with more details (via the 'Request Preview' button on the site), we are happy to talk things through and see if your project would be a good fit.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-02-24T06:23:22.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8363" PostTypeId="1" CreationDate="2015-02-24T09:44:02.560" Score="1" ViewCount="369" Body="&lt;p&gt;I have created a simple task to automatically create some entries if they don't exist and this all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only issue I am having is that if the task is still running and I try and load a page on the site or another control panel page it simply hangs until the task is complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get the task to run in a similar way to the task that runs when updating a section's Entry URL Format (the task spinner and progress bar in the top right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using the &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap&quot; rel=&quot;nofollow&quot;&gt;PowerNap&lt;/a&gt; example and changing the total steps to 100 (to give me enough time to see what is happening) and the same thing happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to create it as a specific background task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; To show sample code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Inception task&#xA; */&#xA;class Bounce_TotalUpdateTask extends BaseTask&#xA;{&#xA;    /**&#xA;     * Defines the settings.&#xA;     *&#xA;     * @access protected&#xA;     * @return array&#xA;     */&#xA;    protected function defineSettings()&#xA;    {&#xA;        return array();&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the default description for this task.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Update Total Record';&#xA;    }&#xA;&#xA;    /**&#xA;     * Gets the total number of steps for this task.&#xA;     *&#xA;     * @return int&#xA;     */&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User, array(&#xA;            &quot;group&quot; =&amp;gt; &quot;members&quot;,&#xA;            &quot;limit&quot; =&amp;gt; null,&#xA;        ))-&amp;gt;total();&#xA;    }&#xA;&#xA;    /**&#xA;     * Runs a task step.&#xA;     *&#xA;     * @param int $step&#xA;     * @return bool&#xA;     */&#xA;    public function runStep($step)&#xA;    {&#xA;        $users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User, array(&#xA;            &quot;group&quot; =&amp;gt; &quot;members&quot;,&#xA;            &quot;limit&quot; =&amp;gt; null,&#xA;        ))-&amp;gt;find();&#xA;&#xA;        $section = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle(&quot;totals&quot;);&#xA;&#xA;        if (isset($users[$step])) {&#xA;            $user = $users[$step];&#xA;&#xA;            $record = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, array(&#xA;                    &quot;section&quot; =&amp;gt; &quot;totals&quot;,&#xA;                    &quot;authorId&quot; =&amp;gt; $user-&amp;gt;id,&#xA;                )&#xA;            )-&amp;gt;first();&#xA;&#xA;            if (!$record) {&#xA;                $entry = new EntryModel();&#xA;                $entry-&amp;gt;sectionId  = $section-&amp;gt;id;&#xA;                $entry-&amp;gt;typeId     = $section-&amp;gt;id;&#xA;                $entry-&amp;gt;authorId   = $user-&amp;gt;id;&#xA;                $entry-&amp;gt;enabled    = true;&#xA;&#xA;                craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;            }&#xA;&#xA;            return true;&#xA;        } else {&#xA;            return &quot;Result &quot; . ($step) . &quot; does not exist&quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="129" LastEditorUserId="129" LastEditDate="2015-02-24T21:01:39.127" LastActivityDate="2015-02-24T21:01:39.127" Title="Creating Task cause Site/CP to hang" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8364" PostTypeId="2" ParentId="658" CreationDate="2015-02-24T12:40:19.853" Score="4" Body="&lt;p&gt;Craft adds those extra elements to each array of table cells only if there's column handles defined in your Table Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to not only access a cell's value via &lt;code&gt;row.col1&lt;/code&gt;, &lt;code&gt;row.col2&lt;/code&gt;, etc. but also using the columns handle, e.g. &lt;code&gt;row.price&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to use this feature or programatically loop the cells, &lt;strong&gt;don't define column handles!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-24T12:45:57.267" LastActivityDate="2015-02-24T12:45:57.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8365" PostTypeId="2" ParentId="8363" CreationDate="2015-02-24T14:04:19.987" Score="1" Body="&lt;p&gt;I recently dealt with a similar issue. Keep your tasks small and quick by using subtasks or by creating multiple instances of your main task. In your example, make each entry creation its own tasks or subtask, so that each step only has one process to take care of. You can have a private array on the task object to store an array of entry data to iterate through. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private $entry_data = array();&#xA;//Fill array with the data you want to use&#xA;&#xA;public function runStep($step)&#xA;{&#xA;&#xA;    $new_entry = $entry_data[$step];&#xA;    //code to create new entry&#xA;&#xA;    return true;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-24T14:04:19.987" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8367" PostTypeId="1" CreationDate="2015-02-24T17:59:29.193" Score="3" ViewCount="549" Body="&lt;p&gt;Has something changed recently regarding the ocalized {siteUrl} setting? I'm setting up a new localized site on MAMP PRO and the old config code I used on several other projects is throwing an error &quot;Array to string conversion&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;),&#xA;&#xA;'pazzo.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'fileSystemPath' =&amp;gt; '/Applications/MAMP/htdocs/pazzo/',&#xA;        'siteUrl' =&amp;gt; 'http://pazzo.dev:8888/'&#xA;    )&#xA;),&#xA;&#xA;'*.pazzo.be' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; false,&#xA;    'cooldownDuration' =&amp;gt; 0,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'fileSystemPath' =&amp;gt; '/opt/www/pocopazzobvba/web/www.pazzo.be/',&#xA;        'siteUrl' =&amp;gt; 'http://www.pazzo.be/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This (what I have used before) throws the error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true&#xA;),&#xA;'pazzo.dev:8888' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'http://pazzo.dev:8888/en/',&#xA;            'fr' =&amp;gt; 'http://pazzo.dev:8888/fr/',&#xA;            'nl' =&amp;gt; 'http://pazzo.dev:8888/'&#xA;        ),&#xA;        'fileSystemPath' =&amp;gt; '/Applications/MAMP/htdocs/pazzo/'&#xA;    )&#xA;),&#xA;'www.pazzo.be' =&amp;gt; array(&#xA;    'cooldownDuration' =&amp;gt; 0,&#xA;    'devMode' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'http://www.pazzo.be/en/',&#xA;            'fr' =&amp;gt; 'http://www.pazzo.be/fr/',&#xA;            'nl' =&amp;gt; 'http://www.pazzo.be/'&#xA;        ),&#xA;        'fileSystemPath' =&amp;gt; '/opt/www/pocopazzobvba/web/www.pazzo.be/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something obvious??&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-02-24T19:34:52.993" Title="Localized {siteUrl} setting - confused" Tags="&lt;localization&gt;&lt;error-message&gt;&lt;mamp&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8368" PostTypeId="1" CreationDate="2015-02-24T18:01:24.720" Score="1" ViewCount="55" Body="&lt;p&gt;It seems HTML markup (tags, classes, etc) is excluded when searching (at least in the CP/Entries page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way around this?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-02-24T18:01:24.720" Title="Searching for HTML markup in Rich Text fields" Tags="&lt;search&gt;&lt;richtext&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8369" PostTypeId="2" ParentId="8367" CreationDate="2015-02-24T18:10:44.410" Score="2" Body="&lt;p&gt;&lt;code&gt;siteUrl&lt;/code&gt; works with an array of locales if you're using the actual &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl config setting&lt;/a&gt;.  What you're currently doing is creating a separate 'siteUrl' environment variable, which places in the control panel aren't expecting to be in array format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More good info on the different ways to set &lt;code&gt;siteUrl&lt;/code&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-24T18:10:44.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8370" PostTypeId="2" ParentId="8360" CreationDate="2015-02-24T18:39:19.977" Score="17" Body="&lt;p&gt;I've actually done this a couple of times... a very simple &quot;password-only&quot; page. Then there would be a large group of people who share that same password, and can gain access to that protected page.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; This example was built using the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;Business Logic plugin template&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many ways to manage your password, but it sounds like you'll want something as simple as a Global field. Create a Global field for your password, and keep track of the &lt;strong&gt;Global Set ID&lt;/strong&gt; and the &lt;strong&gt;field handle&lt;/strong&gt; (you'll need that info in a minute).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your secure page, you'll want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if craft.businessLogic.accessGranted %}&#xA;&#xA;    &amp;lt;!-- Your page content goes here --&amp;gt;&#xA;&#xA;{% else %}&#xA;&#xA;    &amp;lt;h1&amp;gt;Enter your access code:&amp;lt;/h1&amp;gt;&#xA;    {% if error is defined %}&#xA;        &amp;lt;p class=&quot;error&quot;&amp;gt;{{ error }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;businessLogic/authorize&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;pw&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Log In&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Upon submitting that form, your plugin's &lt;strong&gt;Controller&lt;/strong&gt; will authenticate the user, and set a cookie to remember the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this for your plugin's Controller:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class BusinessLogicController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    // Login authorization action&#xA;    public function actionAuthorize()&#xA;    {&#xA;        // Get password&#xA;        $pwSubmitted = craft()-&amp;gt;request-&amp;gt;getPost('pw');&#xA;&#xA;        // Check access&#xA;        if ($this-&amp;gt;_validPassword($pwSubmitted)) {&#xA;&#xA;            // Set access cookie&#xA;            $expires = time() + (60*60*24*7); // One week&#xA;            setcookie(md5('cookieNameToBeHashed'), 1, $expires, '/');&#xA;&#xA;            // Redirect&#xA;            $this-&amp;gt;redirect(craft()-&amp;gt;request-&amp;gt;getPath());&#xA;&#xA;        } else {&#xA;&#xA;            // Output error message&#xA;            craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                'error' =&amp;gt; 'Invalid access code'&#xA;            ));&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    // Check if password is valid&#xA;    private function _validPassword($pwSubmitted)&#xA;    {&#xA;        // Get global set&#xA;        $globalSet = craft()-&amp;gt;globals-&amp;gt;getSetById(156);&#xA;&#xA;        // Get target password&#xA;        $pwTarget = $globalSet-&amp;gt;passwordFieldhandle;&#xA;&#xA;        // Return whether password matches&#xA;        return ($pwSubmitted === $pwTarget);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your plugin's &lt;strong&gt;Variable&lt;/strong&gt; can check if the user is already authorized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this for your plugin's Variable:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class BusinessLogicVariable&#xA;{&#xA;&#xA;    // Check if access cookie is set&#xA;    public function accessGranted()&#xA;    {&#xA;        $cookieName = md5('cookieNameToBeHashed');&#xA;        return array_key_exists($cookieName, $_COOKIE);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which of course, brings it full circle. Your secure page will check if &lt;code&gt;accessGranted&lt;/code&gt; before showing either the secure content, or the login form.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="125" LastEditDate="2015-03-30T12:23:16.540" LastActivityDate="2015-03-30T12:23:16.540" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8371" PostTypeId="2" ParentId="8367" CreationDate="2015-02-24T19:34:52.993" Score="1" Body="&lt;p&gt;So Brad, this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'pazzo.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'fileSystemPath' =&amp;gt; '/Applications/MAMP/htdocs/pazzo/',&#xA;    ),&#xA;    'siteUrl' =&amp;gt; array(&#xA;                 'en' =&amp;gt; 'http://pazzo.dev:8888/en/',&#xA;                 'fr' =&amp;gt; 'http://pazzo.dev:8888/fr/',&#xA;                 'nl' =&amp;gt; 'http://pazzo.dev:8888/'&#xA;             )&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is more like it then? (seems to work fine)&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-02-24T19:34:52.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8372" PostTypeId="1" CreationDate="2015-02-24T20:26:13.163" Score="1" ViewCount="565" Body="&lt;p&gt;Are there any plugins like this Expression Engine feed parser? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://devot-ee.com/add-ons/feed-parser&quot; rel=&quot;nofollow&quot;&gt;https://devot-ee.com/add-ons/feed-parser&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Temporarily cache an XML file from a website or API and list the results using standard Twig templating tags. &lt;/p&gt;&#xA;" OwnerUserId="3335" LastEditorUserId="250" LastEditDate="2015-03-31T22:41:14.310" LastActivityDate="2015-03-31T22:41:14.310" Title="XML Feed Parsing Plugin" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8373" PostTypeId="1" AcceptedAnswerId="8389" CreationDate="2015-02-24T21:22:48.113" Score="5" ViewCount="1691" Body="&lt;p&gt;Say someone searches for &quot;John Smith&quot;. Using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;noreferrer&quot;&gt;search results template on the Craft website&lt;/a&gt;, my search results are then a list of titles for entries that include the term &quot;John Smith&quot;. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dave Taylor wins award&lt;/li&gt;&#xA;&lt;li&gt;New building built&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The user experience is quite poor as there is no indication that these articles are in any way related to &quot;John Smith&quot;. What I'm trying to do is output the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dave Taylor wins award&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...with the help of his brother &lt;strong&gt;John Smith&lt;/strong&gt;,...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;New building built&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...architect &lt;strong&gt;John Smith&lt;/strong&gt; was instrumental...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. something similar to Google search. Any ideas how I could go about this?&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2015-02-26T15:22:47.040" Title="How do I get extracts in search results?" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8374" PostTypeId="2" ParentId="8318" CreationDate="2015-02-24T21:47:22.830" Score="1" Body="&lt;p&gt;This is a bug that's been fixed in the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2635&quot; rel=&quot;nofollow&quot;&gt;2.3.2635&lt;/a&gt;) release of Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-24T21:47:22.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8375" PostTypeId="1" AcceptedAnswerId="8380" CreationDate="2015-02-24T22:29:35.123" Score="1" ViewCount="101" Body="&lt;p&gt;Is it possible to update the config.php file in a plugin outside of manually opening and adjusting the array? I'm hoping there's a way I can have a certain user group be able to change the array values with the plugin's control panel page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The config file is very simple, it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php &#xA;&#xA;return [&#xA;&#xA;    'active_features' =&amp;gt; [&#xA;         'change_team' =&amp;gt; false,&#xA;         'change_series' =&amp;gt; false,&#xA;         'change_user_settings' =&amp;gt; false,&#xA;    ],&#xA;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I need a way for them to be able to toggle, say, 'change_team' to true or false every so often. I've searched around and haven't found anything at all to try. Does this kind of functionality exist at all?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-02-25T03:28:37.113" Title="Update Plugin's config.php" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;php&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8376" PostTypeId="2" ParentId="2108" CreationDate="2015-02-24T23:22:12.447" Score="2" Body="&lt;p&gt;I would like to share with you my &lt;strong&gt;new and improved index.php&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the old version the control panel login didn't work all the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've rearranged the code and replaced&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!isset($_GET['p']) || strncmp($_GET['p'], 'admin', 5) !== 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (strncmp($_SERVER['PATH_INFO'], '/admin', 6) === 0 || strncmp($_GET['p'], 'admin', 5) === 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the complete code example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Make sure this is a Control Panel request&#xA;if (strncmp($_SERVER['PATH_INFO'], '/admin', 6) === 0 || strncmp($_GET['p'], 'admin', 5) === 0)&#xA;{&#xA;&#xA;    // Path to your craft/ folder&#xA;    $craftPath = '../craft';&#xA;&#xA;    // Do not edit below this line&#xA;    $path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;    if (!is_file($path))&#xA;    {&#xA;        if (function_exists('http_response_code'))&#xA;        {&#xA;            http_response_code(503);&#xA;        }&#xA;        exit('Temporary error. Could not find the CMS folder.');&#xA;    }&#xA;    require_once $path;&#xA;&#xA;}&#xA;else&#xA;{&#xA;&#xA;    // Set language paths&#xA;    $paths = array(&#xA;        'de' =&amp;gt; '/de/',&#xA;        'it' =&amp;gt; '/it/',&#xA;        'en' =&amp;gt; '/en/'&#xA;    );&#xA;&#xA;    // Get browser's preferred languages&#xA;    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) &amp;amp;&amp;amp; preg_match_all('/([\w\-_]+)\s*(?:;\s*q\s*=\s*(\d*\.\d*))?/', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches, PREG_SET_ORDER))&#xA;    {&#xA;        $languages = array();&#xA;        $weights   = array();&#xA;&#xA;        // Fill arrays with all matches&#xA;        foreach ($matches as $match)&#xA;        {&#xA;            $languages[] = strtolower(substr($match[1], 0, 2));&#xA;            $weights[]   = !empty($match[2]) ? floatval($match[2]) : 1;&#xA;        }&#xA;&#xA;        // Sort languages by their weight&#xA;        array_multisort($weights, SORT_NUMERIC, SORT_DESC, $languages);&#xA;&#xA;        // Find first match&#xA;        foreach ($languages as $language)&#xA;        {&#xA;            if (isset($paths[$language]))&#xA;            {&#xA;                $matchingLanguage = $language;&#xA;                break;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    // Set default language&#xA;    if (!isset($matchingLanguage))&#xA;    {&#xA;        $matchingLanguage = 'de';&#xA;    }&#xA;&#xA;    // Redirect&#xA;    $url = $paths[$matchingLanguage].(isset($_GET['p']) ? $_GET['p'] : '');&#xA;    header('Location: '.$url, true, 302);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="623" LastActivityDate="2015-02-24T23:22:12.447" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8377" PostTypeId="2" ParentId="8372" CreationDate="2015-02-24T23:53:54.880" Score="3" Body="&lt;p&gt;We're actually working on a plugin for just this at the moment for one of our projects. It's more for populating channels from a feed (like Solspace Importer or DataGrab), but exposing this via a template tag is something we'll look at including.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interested if anyone else has come across anything though!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;Feed Me&lt;/a&gt; plugin added.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-03-02T04:24:21.583" LastActivityDate="2015-03-02T04:24:21.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8378" PostTypeId="1" AcceptedAnswerId="8379" CreationDate="2015-02-24T23:57:18.190" Score="2" ViewCount="813" Body="&lt;p&gt;I have two small arrays I want to store in my plugin settings, though I'm stuck at what the AttributeType:: should be, as well as how to retrieve the actual values. The arrays I want to store look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'active_features' =&amp;gt; [&#xA;     'change_team' =&amp;gt; false,&#xA;     'change_series' =&amp;gt; false,&#xA;     'change_user_settings' =&amp;gt; false,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my plugin file (pluginHandlePlugin.php) I see I can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'pluginSettings1'   =&amp;gt; array(AttributeType::Mixed, 'active_features' =&amp;gt; array('change_team' =&amp;gt; false, 'change_series' =&amp;gt; false, 'change_user_settings' =&amp;gt; false)),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And getting those values through the service file works like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getPluginSettings()&#xA;{&#xA;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle');&#xA;$settings = $plugin-&amp;gt;getSettings();&#xA;&#xA;return $settings;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works, and returns the object for me. However I'm unable to get to the actual key/values from the original array, I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $settings-&amp;gt;pluginSettings1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that returns NULL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do I retrieve the keys/values, and also, what is the best AttributeType:: to set for this? I've looked around for AttributeType:: options and details but didn't find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be GREAT! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-02-25T00:03:29.070" LastActivityDate="2017-02-21T00:56:46.083" Title="Plugin Settings: Attribute Types, and how to receive" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;services&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8379" PostTypeId="2" ParentId="8378" CreationDate="2015-02-25T00:41:03.767" Score="4" Body="&lt;p&gt;As far as accessing the value of the setting, try: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle');&#xA;$plugin-&amp;gt;getSettings()-&amp;gt;getAttribute('pluginSettings1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to access your settings throughout your services file you might also create a global variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PluginHandleService extends BaseApplicationComponent&#xA;{&#xA;    public $settings = array();&#xA;&#xA;    public function __construct()&#xA;    {&#xA;        $this-&amp;gt;settings = $this-&amp;gt;initSettings();&#xA;    }&#xA;&#xA;    private function initSettings()&#xA;    {&#xA;        $plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle');&#xA;&#xA;        $settings = array();&#xA;        $settings['pluginSettings1'] = $plugin-&amp;gt;getSettings()-&amp;gt;getAttribute('pluginSettings1');&#xA;&#xA;        return $settings;&#xA;    }&#xA;&#xA;    // other service methods&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which you can then access like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;settings['pluginSettings1']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to André Elvan for help on &lt;a href=&quot;https://craftcms.stackexchange.com/a/3028/784&quot;&gt;setting up a constructor&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as assigning a value however, I think you may have to use the 'default' property. In the past I have successfully done this with strings like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'pluginSettings1' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; &quot;value&quot;),&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I presume you could do the same with 'Mixed', although never tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'pluginSettings1' =&amp;gt; array(AttributeType::Mixed, 'default' =&amp;gt; 'active_features' =&amp;gt; array('change_team' =&amp;gt; false, 'change_series' =&amp;gt; false, 'change_user_settings' =&amp;gt; false))),&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It might make more sense to break the array into individual settings, however.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'change_team'          =&amp;gt; array(AttributeType::Bool, 'default' =&amp;gt; 'false',&#xA;        'change_series'        =&amp;gt; array(AttributeType::Bool, 'default' =&amp;gt; 'false',&#xA;        'change_user_settings' =&amp;gt; array(AttributeType::Bool, 'default' =&amp;gt; 'false',&#xA;    ),&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-21T00:56:46.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8380" PostTypeId="2" ParentId="8375" CreationDate="2015-02-25T03:28:37.113" Score="2" Body="&lt;p&gt;In this situation you don't want to use a config file and instead you want to use plugin settings. The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/plugin-settings&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/plugin-settings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-02-25T03:28:37.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8381" PostTypeId="1" AcceptedAnswerId="8457" CreationDate="2015-02-25T09:13:33.753" Score="3" ViewCount="950" Body="&lt;p&gt;I'm working on importing entries from EE to Craft. I started with the &lt;a href=&quot;https://github.com/clearbold/craftimport&quot; rel=&quot;nofollow&quot;&gt;craftimport plugin&lt;/a&gt;, and I am expanding it to do a bit more. One of the things I need is to save an image from a remote URL into an entry's assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've only managed to save it to disk, and then I can go into Craft admin and index the assets folder, and re-run the import, which will save the relation between the image and the entry using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$command = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;$imgRecord = $command&#xA;            -&amp;gt;select('id')&#xA;            -&amp;gt;from('assetfiles')&#xA;            -&amp;gt;where(array(&quot;AND&quot;, &quot;filename='&quot; . $images[0]['filename'] . &quot;'&quot;, &quot;folderId=2&quot;))&#xA;            -&amp;gt;queryRow();&#xA;&#xA;if ($imgRecord['id']) {&#xA;    $imgFieldRecord = FieldRecord::model()-&amp;gt;findByPk($imgFieldId);&#xA;    $imgFieldModel = FieldModel::populateModel($imgFieldRecord);&#xA;    craft()-&amp;gt;relations-&amp;gt;saveRelations($imgFieldModel, $entryModel, array($imgRecord['id']));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering if it's possible to do this whole thing in one run instead of two? I guess the only thing the indexing does is look for images and store them in the database. But I can't seem to find anything in the documentation that tells me how to do it.&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-03-02T09:12:35.987" Title="Saving remote image to assets field in entry" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8382" PostTypeId="2" ParentId="8250" CreationDate="2015-02-25T11:35:01.230" Score="2" Body="&lt;p&gt;In the end I resolved my problem - which was unfortunately &lt;em&gt;not related to craft&lt;/em&gt; at all. For unknown reasons there it was just quite evident visible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Facts:&lt;/strong&gt;&#xA;I'm running MAMP on a local OSX (Yosemite) setup. My craft website is running on a virtual domain pointing to localhost. &#xA;PHP 5.4&#xA;Mysql 5.x&#xA;Craft 2.3.26 Pro version&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue:&lt;/strong&gt;&#xA;Long latency (~10s) when editing an entry/adding stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&#xA;In the end it was related to OSX issues with resolving a vhost address and resulting in loopbacks. A detailed description of the issue und how to resolve it can be found on &lt;a href=&quot;https://stackoverflow.com/questions/10064581/how-can-i-eliminate-slow-resolving-loading-of-localhost-virtualhost-a-2-3-secon&quot;&gt;stackoverflow&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="3323" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-25T11:35:01.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8383" PostTypeId="1" AcceptedAnswerId="8385" CreationDate="2015-02-25T14:15:51.103" Score="4" ViewCount="1532" Body="&lt;p&gt;I have started my very first Craft project (coming from EE) - so, apologies if this is a to simple question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the homepage I want to display the latest news entry - and short excerpts from a few older ones. No other type of entries on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Should the section type of the homepage be a &quot;channel&quot; then, or a &quot;single&quot;? Or is there a something completely different way to do this?&lt;/p&gt;&#xA;" OwnerUserId="3344" LastEditorUserId="-1" LastEditDate="2015-02-26T08:31:31.720" LastActivityDate="2015-02-26T08:31:31.720" Title="Display news (from a channel) on the Homepage" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8384" PostTypeId="1" CreationDate="2015-02-25T14:22:38.840" Score="1" ViewCount="663" Body="&lt;p&gt;After a fresh install of Craft on my localhost, two problems occur:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The modal window to upgrade Craft only says &lt;em&gt;&quot;An unknown error occured.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;strong&gt;Newly created singles are not editable&lt;/strong&gt;, the edit pane stays empty with no input fields at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked into craft.log and there seems to be an issue with CHttpRequest.php, but I can't say if this is a local config problem or if it's a bug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2015/02/25 13:08:35 [error] [php] Cannot modify header information - headers already sent (/Users/me/Sites/test-dev-craft/app/framework/web/CHttpRequest.php:1392)&#xA;Stack trace:&#xA;#0 /Users/me/Sites/test-dev-craft/app/framework/web/CHttpRequest.php(1329): Craft\CookieCollection-&amp;gt;remove()&#xA;#1 /Users/me/Sites/test-dev-craft/app/services/UserSessionService.php(1170): Craft\CookieCollection-&amp;gt;add()&#xA;#2 /Users/me/Sites/test-dev-craft/app/framework/web/auth/CWebUser.php(203): Craft\UserSessionService-&amp;gt;renewCookie()&#xA;#3 /Users/me/Sites/test-dev-craft/app/services/UserSessionService.php(91): Craft\UserSessionService-&amp;gt;init()&#xA;#4 /Users/me/Sites/test-dev-craft/app/framework/base/CModule.php(387): Craft\UserSessionService-&amp;gt;init()&#xA;#5 /Users/me/Sites/test-dev-craft/app/etc/web/WebApp.php(569): Craft\WebApp-&amp;gt;getComponent()&#xA;#6 /Users/me/Sites/test-dev-craft/app/framework/base/CModule.php(103): Craft\WebApp-&amp;gt;getComponent()&#xA;#7 /Users/me/Sites/test-dev-craft/app/etc/web/WebApp.php(160): Craft\WebApp-&amp;gt;__get()&#xA;#8 /Users/me/Sites/test-dev-craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#9 /Users/me/Sites/test-dev-craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#10 /Users/me/Sites/test.dev/index.php(19): require_once()&#xA;REQUEST_URI=/test.dev/index.php/admin/actions/tasks/getRunningTaskInfo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my local setup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mac OS X 10.10.2&lt;/li&gt;&#xA;&lt;li&gt;Apache/2.2.29 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_ssl/2.2.29 OpenSSL/1.0.2&lt;/li&gt;&#xA;&lt;li&gt;PHP Version 5.6.5&lt;/li&gt;&#xA;&lt;li&gt;MySQL 5.6.22 - Homebrew&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any help would be highly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3343" LastActivityDate="2015-04-03T17:41:58.740" Title="Content / fields of newly created single don't show up" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;error&gt;&lt;upgrades&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8385" PostTypeId="2" ParentId="8383" CreationDate="2015-02-25T14:24:48.943" Score="7" Body="&lt;p&gt;Hi Magnus and welcome to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your homepage should ideally be a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot;&gt;Single&lt;/a&gt;. As the Craft site says these are one-off pages that have no special requirements or hierarchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then create a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot;&gt;Channel&lt;/a&gt; called News (or Blog, whatever you require) and here you would have entries for each news article on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have everything set up, outputting the latest news article on your homepage is a very simple process:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestNews = craft.entries.section('news').limit(1) %}&#xA;&#xA;{% if latestNews|length %}&#xA;&#xA;    {% for article in latestNews %}&#xA;        &amp;lt;p&amp;gt;{{ article.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code would sit in your &lt;code&gt;index.twig&lt;/code&gt; template and grabs the 1st entry in the News section. Simple!&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-02-25T14:24:48.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8386" PostTypeId="2" ParentId="8384" CreationDate="2015-02-25T15:36:51.637" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Cannot modify header information - headers already sent&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That error means that something, somewhere has already started outputting to the browser before Yii/Craft/PHP expected it to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;99% of the time, it's some whitespace or unintended character that got added to the beginning of one of Craft's files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try doing a fresh upload of all of Craft's files and see if that helps.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-25T15:36:51.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8387" PostTypeId="1" CreationDate="2015-02-25T18:01:18.897" Score="1" ViewCount="439" Body="&lt;p&gt;In my Controller I created a script to add a user to the database, is there a way I can automatically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Log them in and &#xA;2) Set a permanent session cookie or similar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I basically don't want the user to have to ever log in and we will be creating the accounts for them.&lt;/p&gt;&#xA;" OwnerUserId="2311" LastEditorUserId="125" LastEditDate="2015-02-25T18:05:09.160" LastActivityDate="2018-10-06T08:28:08.890" Title="Automatically Log in User" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8388" PostTypeId="2" ParentId="8387" CreationDate="2015-02-25T19:17:38.327" Score="3" Body="&lt;p&gt;You're probably looking for a combination of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-usersessionservice.html#method-login&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft()-&gt;userSession-&gt;login()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-usersessionservice.html#method-loginbyuserid&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft()-&gt;userSession-&gt;loginByUserId()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;along with setting the &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#usersessionduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;userSessionDuration&lt;/a&gt; config setting to a really high value.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-10-06T08:28:08.890" LastActivityDate="2018-10-06T08:28:08.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8389" PostTypeId="2" ParentId="8373" CreationDate="2015-02-25T22:11:19.080" Score="6" Body="&lt;p&gt;I think &lt;a href=&quot;https://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot;&gt;creating your own Twig filter&lt;/a&gt; is your best bet. &#xA;So, create a filter that takes a string, searches that for another string and returns an extract. It could do this by using some regular expression hocus pocus, I guess.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.bodyText | extract('your search term', 3, 3) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would be how you'd use it (assuming, for example, that your filter accepts the three arguments &lt;code&gt;searchTerm&lt;/code&gt;, &lt;code&gt;wordsBefore&lt;/code&gt; and &lt;code&gt;wordsAfter&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-25T22:11:19.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8391" PostTypeId="1" CreationDate="2015-02-26T05:43:19.273" Score="1" ViewCount="833" Body="&lt;p&gt;I'm working on a plugin to do subscription billing with paypal. I have the following controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PaypalSubscription_SubscriptionController extends BaseController {&#xA;&#xA;    public function actionSubscriptions() {&#xA;        // This renders a form that collects some info on subscription options&#xA;    }&#xA;&#xA;    public function actionSubscribe() {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        // This takes data and starts a paypal transaction&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get to the form by going to &lt;code&gt;/actions/paypalSubscription/subscription/subscriptions&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried hard coding the url &lt;code&gt;/actions/paypalSubscription/subscription/subscribe&lt;/code&gt; as well as using &lt;code&gt;actionUrl('/paypalSubscription/subscription/subscribe')&lt;/code&gt;. The &lt;code&gt;actionUrl&lt;/code&gt; call prepends &lt;code&gt;index.php/actions&lt;/code&gt; to the string which is just incorrect, and either way both approaches 404. What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that i'm logged in and that works correctly since I can reach the original form and anonymous access shouldn't be turned on, so I don't believe that's the issue.&lt;/p&gt;&#xA;" OwnerUserId="3348" LastEditorUserId="3348" LastEditDate="2015-02-26T08:09:18.913" LastActivityDate="2015-03-25T22:40:43.030" Title="Trouble posting to plugin controller" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8392" PostTypeId="2" ParentId="8391" CreationDate="2015-02-26T07:07:03.783" Score="1" Body="&lt;p&gt;&lt;strike&gt;Possible that it's just that the first is singular the second is plural.&lt;/strike&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;Perhaps the problem is on your form side then. If you're posting from a form, you do not need 'action' as part of the url. Also might check that you have &lt;code&gt;method=&quot;post&quot;&lt;/code&gt; attribute defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;paypalSubscription/subscription/subscribe&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;subscription-complete&quot;&amp;gt;&#xA;    ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-26T09:06:49.570" LastActivityDate="2015-02-26T09:06:49.570" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8393" PostTypeId="1" CreationDate="2015-02-26T08:14:44.853" Score="1" ViewCount="865" Body="&lt;p&gt;I'm using the following form, and occasionally through testing the e-mail activation link will send, however the majority of time it never gets sent. Did I do something wrong with the form?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/success/&quot;&amp;gt;&#xA;&#xA;        {% macro errorList(errors) %}&#xA;            {% if errors %}&#xA;                &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                    {% for error in errors %}&#xA;                        &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;        {% endmacro %}&#xA;&#xA;        {% from _self import errorList %}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;            {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('username')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;            {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('email')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('password')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-04-27T16:51:07.407" Title="Registration email link not being sent" Tags="&lt;users&gt;&lt;form&gt;&lt;emails&gt;&lt;post&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8394" PostTypeId="1" AcceptedAnswerId="8401" CreationDate="2015-02-26T08:59:20.863" Score="2" ViewCount="137" Body="&lt;p&gt;Is it possible to trigger an update of the asset indices from an url endpoint? I guess not, but is it planned to provide some kind of API?&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-07-21T23:10:50.470" Title="Trigger Update Asset Index from url endpoint" Tags="&lt;assets&gt;&lt;reindex&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8395" PostTypeId="1" AcceptedAnswerId="8402" CreationDate="2015-02-26T11:01:53.000" Score="3" ViewCount="626" Body="&lt;p&gt;I am automatically creating users in a service, is there a way to check if user exists?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to log in id user exist or save a new user if it doesn't, I have the following so far which will add a user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function add($user)&#xA;{&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($username);&#xA;    craft()-&amp;gt;userSession-&amp;gt;loginByUserId($user-&amp;gt;attributes['id']);   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2311" LastActivityDate="2015-02-26T17:42:04.380" Title="How to tell if user exists" Tags="&lt;controller&gt;&lt;services&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8396" PostTypeId="1" AcceptedAnswerId="8404" CreationDate="2015-02-26T14:30:36.453" Score="2" ViewCount="1556" Body="&lt;p&gt;I want to redirect &lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt; to coming-soon.html template, but not index.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible to do it in route settings?&lt;/p&gt;&#xA;" OwnerUserId="768" LastEditorUserId="125" LastEditDate="2015-02-26T19:23:10.943" LastActivityDate="2018-02-17T21:32:29.400" Title="How to redirect to Coming Soon template" Tags="&lt;redirect&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8397" PostTypeId="2" ParentId="8396" CreationDate="2015-02-26T14:43:08.337" Score="4" Body="&lt;p&gt;You can use the &lt;code&gt;redirect&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;tag&lt;/a&gt;. Put this in your &lt;code&gt;index.html&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect &quot;coming-soon&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to stay on the homepage but want to show the template code for another page, you can use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;Twig include&lt;/a&gt;. Put this in your &lt;code&gt;index.html&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;coming-soon&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, just put your Coming Soon template code straight onto &lt;code&gt;index.html&lt;/code&gt;? Either way, this answer should cover everything you need.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-02-26T15:09:28.700" LastActivityDate="2015-02-26T15:09:28.700" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8398" PostTypeId="2" ParentId="8373" CreationDate="2015-02-26T14:54:48.367" Score="4" Body="&lt;p&gt;If I understand you correctly, you want to &quot;highlight&quot; your search query in the results. Your own Twig filter would be the cleanest way to do this, but you don't &lt;em&gt;need&lt;/em&gt; to write one. Beware of putting too much logic in your templates, but this would also work nicely, using the native &lt;code&gt;replace&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the search query and break it into individual terms #}&#xA;{% set query = craft.request.getParam( 'q' ) %}&#xA;{% set searchTerms = query | trim | split( ' ' ) %}&#xA;&#xA;{# Build an associated array w/ terms and the replacement string #}&#xA;{% set replace = {} %}&#xA;{% for term in searchTerms %}&#xA;{% set replace = replace | merge( { (term) : '&amp;lt;strong&amp;gt;' ~ term ~ '&amp;lt;/strong&amp;gt;' } ) %}&#xA;{% endfor %}&#xA;&#xA;{# Loop through your search results, replacing the terms for all neccessary fields..#}&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title | replace( replace ) | raw }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.bodyText | replace( replace ) | raw }}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that, all your search terms will be wrapped in &lt;strong&gt;&lt;/strong&gt; tags – or whatever else you'd want to highlight them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT&lt;/em&gt;: Reading over, I realize I &lt;em&gt;did&lt;/em&gt; misunderstand the question – you need to extract parts of the content matching the search query, not highlight the terms in titles, excerpts or whatever. The commenter above me is correct; you'd need a custom filter to accomplish your goal (without going insane). Apologies for the wrong answer; I'll leave it up, though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-02-26T15:22:47.040" LastActivityDate="2015-02-26T15:22:47.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8399" PostTypeId="1" CreationDate="2015-02-26T15:47:48.657" Score="8" ViewCount="2721" Body="&lt;p&gt;I'm looking to integrate tasks into a plugin I'm building. Whilst I know that the Craft documentation shows the Tasks Service/Model properties/methods in the full class reference, I can't find anything online about best practices regarding using tasks in plugins. Has anyone come across any articles about creating your own tasks?&lt;/p&gt;&#xA;" OwnerUserId="3350" LastActivityDate="2015-02-26T16:46:29.860" Title="Documentation on creating tasks" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8400" PostTypeId="2" ParentId="8393" CreationDate="2015-02-26T16:35:09.710" Score="2" Body="&lt;p&gt;If you're using &lt;code&gt;phpmail&lt;/code&gt; or &lt;code&gt;sendmail&lt;/code&gt; under Settings-&gt;Email in the control panel, they are notoriously unreliable at delivering emails consistently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using a proper SMTP relay or a transactional email provider like &lt;a href=&quot;https://mandrill.com/&quot; rel=&quot;nofollow&quot;&gt;Mandrill&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-26T16:35:09.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8401" PostTypeId="2" ParentId="8394" CreationDate="2015-02-26T16:38:40.047" Score="3" Body="&lt;p&gt;Not natively, but you could easily write a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; with a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; that exposes the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetIndexingService&quot; rel=&quot;nofollow&quot;&gt;AssetIndexingService&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-26T16:38:40.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8402" PostTypeId="2" ParentId="8395" CreationDate="2015-02-26T16:42:27.117" Score="6" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function add($user)&#xA;{&#xA;    $existingUser = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($user-&amp;gt;username);&#xA;&#xA;    if ($existingUser)&#xA;    {&#xA;        // They exist... log them in.&#xA;        craft()-&amp;gt;userSession-&amp;gt;loginByUserId($existingUser-&amp;gt;id);  &#xA;    }&#xA;    else&#xA;    {&#xA;        // They don't exist... create them.&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="784" LastEditDate="2015-02-26T17:42:04.380" LastActivityDate="2015-02-26T17:42:04.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8403" PostTypeId="2" ParentId="8399" CreationDate="2015-02-26T16:46:29.860" Score="5" Body="&lt;p&gt;I'm not aware of any articles or best practice documents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a sample/simple &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap/&quot; rel=&quot;noreferrer&quot;&gt;PowerNap&lt;/a&gt; plugin that shows the basics of creating and running a task as well as the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TasksService&quot; rel=&quot;noreferrer&quot;&gt;TaskService&lt;/a&gt; class reference documentation which you've already found.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-26T16:46:29.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8404" PostTypeId="2" ParentId="8396" CreationDate="2015-02-26T17:54:35.210" Score="12" Body="&lt;p&gt;If you are trying to cover the site from the public while working on it live, i personally would name my coming soon template file &lt;code&gt;503.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the General Settings section of the control panel, switch System Status off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way so long as you are logged in, you can access the site as normal but anyone else visiting your site will see the contents of the &lt;code&gt;503.html&lt;/code&gt; template.&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2015-02-26T17:54:35.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8405" PostTypeId="1" AcceptedAnswerId="10173" CreationDate="2015-02-26T19:02:23.930" Score="0" ViewCount="113" Body="&lt;p&gt;I just installed Craft, linked it to my database (localhost) and then created a new single &quot;about&quot; page. But when I go to edit the single, there are no fields. I haven't changed anything else! When I go to the slug it shows the right template, but there's no content to pull in, since I can't add it in with the dashboard. I've enabled Dev Mode and there are no error logging. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2015-06-15T19:59:39.720" Title="content and fields won't show up on new single" Tags="&lt;templating&gt;&lt;field&gt;&lt;navigation&gt;&lt;singles&gt;&lt;content&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8406" PostTypeId="1" CreationDate="2015-02-26T20:05:01.813" Score="4" ViewCount="241" Body="&lt;p&gt;I'm assessing Craft's suitability for my next project, coming from using HMVC in CodeIgniter with a custom CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In CI all requests go via a controller action which is responsible for inspecting request parameters, loading and filtering data and passing that data to a view. Pretty typical MVC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I've seen so far of Craft and plugins developed for it, the requests are typically forwarded directly to Twig templates and those templates are responsible for analysing query strings and request data and fetching data from exposed template variables or built in &quot;entries&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of a use case where data would need to be displayed and filtered by query string and session criteria and it strikes me that the template would be handling too much of this logic and become bloated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the website I will be developing will get its data in JSON format from a REST API and passing filter criteria from user interaction with forms and UI controls will come up a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is this a typical and recommended approach to using Craft, or should I be using controllers to handle tasks such as filtering and fetching data and passing it to a view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any plugins that I could look at for reference that could help me to understand the flow and process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jamie&lt;/p&gt;&#xA;" OwnerUserId="3352" LastActivityDate="2015-02-26T23:33:47.910" Title="Is it typical that data is fetched from within templates rather than in controllers?" Tags="&lt;templating&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8407" PostTypeId="1" AcceptedAnswerId="8410" CreationDate="2015-02-26T20:11:31.210" Score="2" ViewCount="168" Body="&lt;p&gt;I'm struggling to get an element criteria model of more matrix fields at once for entry related to tagField.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;I have two matrixFields, where I want them in &lt;code&gt;{% for block in entry.matrixFieldhandle %}&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldhandle1 %} My stuff {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldhandle2 %} My stuff {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it's kind of silly to always set element model for each field. Anything simpler?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couldn't find anything explanatory in documentation or here.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="57" LastEditDate="2017-08-08T20:43:02.737" LastActivityDate="2017-08-08T20:43:02.737" Title="Is there a way to output more Matrix fields than one?" Tags="&lt;matrix&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8408" PostTypeId="1" CreationDate="2015-02-26T20:32:35.727" Score="0" ViewCount="1249" Body="&lt;p&gt;I have an instance of a front-end password update form running on one of my Craft Pro 2.3.2635 sites, and it works correctly. If I submit the form with the correct current password and valid new password, it updates the user, and if there is a problem, it displays an error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I use the same code on a new build, if I leave both the current and existing password fields blanks it fails to correctly validate redirects to the page specified in my redirect input field, and the on user save event is fired. The same form on my other build appears to fail validation with the message 'Password  cannot be blank'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other erroring including the password length, and incorrect current password checks seem to run fine. Why might the 'Password cannot be blank' not be working on my new site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've included my form template below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        {% for error in errors %}&#xA;            &amp;lt;li class=&quot;agents-login__error&quot;&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;{% from _self import errorList %}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;{% if not user %}&#xA;    {% redirect &quot;/login&quot; %}&#xA;{% else %}&#xA;&#xA;    &amp;lt;div class=&quot;agents-login&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;agents-login__form-holder&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;/&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;/assets/images/logo.svg&quot; class=&quot;agents-login__logo&quot; width=&quot;158&quot; height=&quot;107&quot; /&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;p class=&quot;message&quot;&amp;gt;Enter your existing password, then choose a new one and click save.&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;form class=&quot;agents-login__form  [ form  form--agents ]&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;                {{ getCsrfInput() }}&#xA;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/agents&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;                {% if account is defined %}&#xA;                    &amp;lt;ul class=&quot;agents-login__errors&quot;&amp;gt;&#xA;                        {{ errorList(account.getErrors('currentPassword')) }}&#xA;                        {{ errorList(account.getErrors('newPassword')) }}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;div class=&quot;[ form__row  form__row--agents ]  layout&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;[ form__cell  form__cell--agents ]  layout__item&quot;&amp;gt;&#xA;                        &amp;lt;label class=&quot;form__label&quot; for=&quot;password&quot; class=&quot;form__label&quot;&amp;gt;Existing Password&amp;lt;/label&amp;gt;&#xA;                        &amp;lt;input class=&quot;form__control&quot; id=&quot;currentPassword&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&amp;lt;div class=&quot;[ form__cell  form__cell--agents ]  layout__item&quot;&amp;gt;&#xA;                        &amp;lt;label class=&quot;form__label&quot; for=&quot;newPassword&quot;&amp;gt;New Password&amp;lt;/label&amp;gt;&#xA;                        &amp;lt;input class=&quot;form__control&quot; id=&quot;newPassword&quot; type=&quot;password&quot; name=&quot;newPassword&quot;&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;[ form__row  form__row--agents ]  layout&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;[ form__cell  form__cell--agents ]  layout__item&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot; class=&quot;[ btn  btn--full ]&quot; /&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;agents-login__back-to-downloads&quot;&amp;gt;&amp;lt;a href=&quot;/agents&quot;&amp;gt;Back to downloads&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="420" LastActivityDate="2015-02-26T20:32:35.727" Title="What could be causing the 'Password cannot be blank' validation check not to run on user update?" Tags="&lt;password&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8409" PostTypeId="2" ParentId="8406" CreationDate="2015-02-26T22:00:20.373" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;From what I've seen so far of Craft and plugins developed for it, the requests are typically forwarded directly to Twig templates and those templates are responsible for analysing query strings and request data and fetching data from exposed template variables or built in &quot;entries&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily required.  You can register a custom CP route in your plugin and have a request routed directly to your plugin's controller action.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'path' =&amp;gt; array('action' =&amp;gt; 'pluginHandle/controllerAction')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And have that controller render a the template directly, passing in whatever variables it needs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('pluginHandle/template', array('foo' =&amp;gt; 'bar');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-26T22:00:20.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8410" PostTypeId="2" ParentId="8407" CreationDate="2015-02-26T23:02:53.467" Score="4" Body="&lt;p&gt;Not sure if this solves your problem, but you could try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allMatrixBlocks = entry.matrixFieldhandle1.find | merge(entry.matrixFieldhandle2.find) %}&#xA;&#xA;{% for block in allMatrixBlocks %} My stuff {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-02-27T15:21:34.460" LastActivityDate="2015-02-27T15:21:34.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8411" PostTypeId="2" ParentId="8406" CreationDate="2015-02-26T23:27:27.820" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is, is this a typical and recommended approach to using Craft, or should I be using controllers to handle tasks such as filtering and fetching data and passing it to a view?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a difficult question to respond to, because there is no definite answer and any advice would be coloured by opinion. I'll share my thoughts on the matter, for what its worth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Typical&lt;/em&gt; – probably, I guess. Twig is a powerful templating language, and with Craft's own extensions on top its quite possible – and often effective – to build fairly complex stuff using only templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At a glance, &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;the official docs&lt;/a&gt; may even give the impression that Craft is primarily a template driven platform, given that they place a certain emphasis on templating as a starting point for building your site. If this is true, I'd guess that it has something to do with the fact that for many people, templating would be the easier approach to building a website, compared to writing plugins implementing custom services and controllers (though Craft makes the latter quite easy, as well). A lower bar is nice, and unlike certain other platforms, this approach isn't necessarily a messy one, either. Your templating structure, filenames, whether you want to use controller templates, wrappers, partials etc. is &lt;em&gt;totally&lt;/em&gt; up to you. Craft makes few assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Recommended&lt;/em&gt; – it all depends. Not only on how you like to structure your applications and code, but also, of course, on the nature of what you're building.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I totally agree that having too much business logic in your views isn't really best practice, and at some point you'll definitely be better off shifting some or all of your code to a plugin. Even if you're not uncomfortable with doing logic based tasks in your views, Twig does have its limits – it's a templating language, after all. From your question, it sounds to me like you'll quickly feel at home with &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;Craft's plugin framework&lt;/a&gt;, which enables you to create an application complete with all the services, controllers and whatever else you'll need. Craft's codebase (built on Yii, as you probably know) is well thought out and super consistent, and in my opinion a joy to work with.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-02-26T23:33:47.910" LastActivityDate="2015-02-26T23:33:47.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8412" PostTypeId="1" AcceptedAnswerId="8413" CreationDate="2015-02-27T00:35:30.750" Score="2" ViewCount="537" Body="&lt;p&gt;I'm trying to pull entries from an events channel where a date field falls in the current month.  Through google and other SE posts I've gotten to the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currMonth = now|date('m') %}&#xA;{% set currMonthFirst = currMonth ~ '/1/' ~ now|date('Y') %}&#xA;{% set nextMonthFirst = currMonthFirst|date_modify('+1 month') %}&#xA;&amp;lt;p&amp;gt;{{ currMonthFirst|date('m/d/Y') }} - {{ nextMonthFirst|date('m/d/Y') }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% set events = craft.entries.section('events').event_startDateTime('&amp;gt;= ' ~ currMonthFirst|date('m/d/Y') ~ ', &amp;lt;' ~ nextMonthFirst|date('m/d/Y')) %}&#xA;&#xA;{% for event in events %}&#xA;    &amp;lt;h1&amp;gt;{{event.title}}&amp;lt;/h1&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;currMonthFirst and nextMonthFirst both output the dates I'd expect, but when I use the set &amp;amp; for loop I get the following error - Fatal error: Call to a member function getTimestamp() on a non-object.  Any idea what I'm doing wrong here or how to make what I'm trying to do work?&lt;/p&gt;&#xA;" OwnerUserId="638" LastActivityDate="2015-02-27T23:02:59.687" Title="Entries where field = current month?" Tags="&lt;datetime&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8413" PostTypeId="2" ParentId="8412" CreationDate="2015-02-27T03:33:57.877" Score="4" Body="&lt;p&gt;This should get it sorted.  There were 2 issues with yours.  First is you were using the wrong 'and' syntax in the &lt;code&gt;craft.entries&lt;/code&gt; call and second you need to use the &lt;code&gt;Y-m-d&lt;/code&gt; pattern so MySQL understands to convert it a proper DateTime field instead of the &lt;code&gt;m/d/Y&lt;/code&gt; format you had.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currMonth = now|date('m') %}&#xA;{% set currMonthFirst = now|date('Y') ~ '-' ~ currMonth ~ '-1'  %}&#xA;{% set nextMonthFirst = currMonthFirst|date_modify('+1 month') %}&#xA;&#xA;&amp;lt;p&amp;gt;{{ currMonthFirst|date('Y-m-d') }} - {{ nextMonthFirst|date('Y-m-d') }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% set events = craft.entries.section('events').event_startDateTime('and', '&amp;gt;= ' ~ currMonthFirst|date('Y-m-d'), '&amp;lt; ' ~ nextMonthFirst|date('Y-m-d')) %}&#xA;&#xA;{% for event in events %}&#xA;    &amp;lt;h1&amp;gt;{{event.title}}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but try using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').event_startDateTime('and', '&amp;gt;= ' ~ currMonthFirst|date('m/d/Y'), '&amp;lt; ' ~ nextMonthFirst|date('m/d/Y')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-02-27T23:02:59.687" LastActivityDate="2015-02-27T23:02:59.687" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8414" PostTypeId="1" AcceptedAnswerId="8417" CreationDate="2015-02-27T10:34:50.690" Score="13" ViewCount="1343" Body="&lt;p&gt;I have used craft for a few medium sites sites and I love it.&#xA;Would Craft be capable of running a large public body website which would be updated with news regularly and have a wealth of information on the wide range of services provided - and likely to be a large number of documents needing accessed.&#xA;On a rough estimate there could be 7-8 structures and maybe 10 channels.&#xA;There will be a small eCommerce requirement on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will Craft handle this all ok?&#xA;Is there any limitations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't want to be running into the problem of developing the site then at launch it and it not being able to cope.&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="125" LastEditDate="2015-05-29T15:10:46.600" LastActivityDate="2017-04-20T18:17:45.423" Title="Is Craft Suitable for Large Public Body website" Tags="&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8415" PostTypeId="1" AcceptedAnswerId="8421" CreationDate="2015-02-27T10:40:17.623" Score="2" ViewCount="133" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;database migrations documentation&lt;/a&gt; does say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Please note that we do &lt;strong&gt;not&lt;/strong&gt; recommend using records directly within a migration&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are there &lt;em&gt;technical reasons&lt;/em&gt; for this recommendation, or is it something you'd just rather not support? I don't mind if I'm on my own as far as support goes, but it seems like I might be able to use migrations to deploy schema changes across environments if I was careful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this would be for private, site-specific plugins, not anything that was going to be publicly released, so I don't think the issue Brandon highlighted &lt;a href=&quot;https://craftcms.stackexchange.com/a/4861/157&quot;&gt;here&lt;/a&gt; would necessarily apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have successfully created a new tag group using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function safeUp()&#xA;{&#xA;    $tagGroup         = new TagGroupModel();&#xA;    $tagGroup-&amp;gt;name   = Craft::t('Tag Group');&#xA;    $tagGroup-&amp;gt;handle = 'tagGroup';&#xA;&#xA;    craft()-&amp;gt;tags-&amp;gt;saveTagGroup($tagGroup);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But obviously this is quite a simple example, and a migration that added fields, sections and entry types (like the InstallService does) would be more complicated and should probably check each record was saved properly before continuing with the next bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are all of Craft's services available while a migration is being run? &lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-02-27T15:53:37.200" Title="Using services/records etc in migrations" Tags="&lt;plugin-development&gt;&lt;migration&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8416" PostTypeId="1" CreationDate="2015-02-27T11:41:09.077" Score="1" ViewCount="915" Body="&lt;p&gt;I have the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A page is loaded via HTTP&lt;/li&gt;&#xA;&lt;li&gt;The user fills out a form and submits its contents via HTTPS&lt;/li&gt;&#xA;&lt;li&gt;The craft CSRF prevention is enabled, so the previousy generated CSRF-Token is submitted along with the form&lt;/li&gt;&#xA;&lt;li&gt;Craft responds with a HTTP 400, because the Token is not valid for the request being send over HTTPS&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use Crafts CSRF prevention feature in this scenaria? So say for example tell Craft to generate the token for an expected HTTPS request?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Clemens&lt;/p&gt;&#xA;" OwnerUserId="964" LastEditorUserId="344" LastEditDate="2015-05-29T13:14:11.317" LastActivityDate="2015-08-27T15:06:46.397" Title="Load a page via HTTP and make an AJAX request via HTTPS afterwards using CSRF-Token" Tags="&lt;csrf&gt;&lt;https&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8417" PostTypeId="2" ParentId="8414" CreationDate="2015-02-27T13:20:40.937" Score="18" Body="&lt;p&gt;One of the biggest Craft projects I've worked on has around 25 sections, 10+ global sets,  250+ fields, and 12,000+ elements across 16 locales (although only 1 locale has launched atm). Craft itself (the CP) has not had any problems I can remember handling it so far, especially with the element index updates that have been introduced over the last few months. I know there must be people running sites &lt;em&gt;much&lt;/em&gt; bigger than that too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end, we definitely had some slow templates where we are looping over a lot of related elements and outputting assets that were generating hundreds of queries per page, but careful planning, template caching, and in some cases using plugin code to pre-fetch data outside of the &lt;code&gt;craft.entries&lt;/code&gt; etc calls in templates helped a lot. You can suffer from &lt;a href=&quot;https://secure.phabricator.com/book/phabcontrib/article/n_plus_one/&quot; rel=&quot;noreferrer&quot;&gt;N+1 problems&lt;/a&gt; with relations and images - as you can with any CMS/website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a small plugin for storing template caches in Craft's data cache (in our case Redis), which I'll see if I can release; we stuck Varnish in front of everything except CP requests; use S3 &amp;amp; CloudFront for serving assets; and while there's still room for improvement, &lt;a href=&quot;http://www.webpagetest.org/result/150227_1F_MWA/&quot; rel=&quot;noreferrer&quot;&gt;we're now getting straight A's on webpagetest.org&lt;/a&gt;, so Craft certainly isn't just for small hobby-projects.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-03-04T21:40:56.460" LastActivityDate="2015-03-04T21:40:56.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8418" PostTypeId="1" CreationDate="2015-02-27T14:23:09.980" Score="3" ViewCount="286" Body="&lt;p&gt;I have a client that is going to use Stripe Checkout (&lt;a href=&quot;https://stripe.com/checkout&quot; rel=&quot;nofollow&quot;&gt;https://stripe.com/checkout&lt;/a&gt;).  We are trying to figure out how we can simply record the sale data into Craft.  We know of other plugins that use Stripe, but we really want to use Stripe Checkout as it is great for mobile.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can we write data to an entry after the Stripe sale?  We would&#xA;need basic things like Customer Name, Item(s) purchased, Order&#xA;Total.  The items would all be entries in Craft already.&lt;/li&gt;&#xA;&lt;li&gt;How can we restrict content viewing based on the items purchased? &#xA;Basically if you buy Product X which is an entry page of content,&#xA;how can I secure that entry so only people who have a confirmed&#xA;purchased can view the template?  Since there will be about 10&#xA;products, we really can't use User Groups for this.  We need the&#xA;permission to be on the item purchased level.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated.  If we need a custom plugin for this would anyone be interested in making one?  Should be pretty simple using the Stripe API I would imagine.&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="344" LastEditDate="2015-05-29T13:13:50.760" LastActivityDate="2015-05-29T13:13:50.760" Title="How can I record sales data from Stripe Checkout and then restrict access to content based on the item purchased?" Tags="&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8419" PostTypeId="1" CreationDate="2015-02-27T15:16:04.693" Score="3" ViewCount="110" Body="&lt;p&gt;I want to create an event that triggers before the site loads to I grab the variables passed in the http header and send them to a plugin I have made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will have a url like &lt;a href=&quot;http://www.foo.com?username=abc123&quot; rel=&quot;nofollow&quot;&gt;http://www.foo.com?username=abc123&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want it immediately trigger a controller method located at: &lt;a href=&quot;http://www.foo.com/actions/myPlugin/myMethod&quot; rel=&quot;nofollow&quot;&gt;http://www.foo.com/actions/myPlugin/myMethod&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im just not sure how to connect the dots.&lt;/p&gt;&#xA;" OwnerUserId="2311" LastActivityDate="2015-05-29T08:02:21.933" Title="Create event before site loads" Tags="&lt;events&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8420" PostTypeId="1" AcceptedAnswerId="8423" CreationDate="2015-02-27T15:17:57.900" Score="1" ViewCount="727" Body="&lt;p&gt;I'm using the Craft Contact Form template.  I need to include some additional content in the notification email.  I can't for the life of me find how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen this:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2232/pt-contact-form-plugin-html-email-templates?rq=1&quot;&gt;P&amp;amp;T Contact Form Plugin: HTML Email Templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But not sure how to apply the additional fields.  Here is my contact form template (markup removed for ease of reading).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# form markup #}&#xA;    &amp;lt;select class='form__input' name=&quot;message[About]&quot;&amp;gt;&#xA;        {% nav link in craft.entries.section('products') %}&#xA;            &amp;lt;option value=&quot;{{ link.title }}&quot;&amp;gt;{{ link.title }}&amp;lt;/option&amp;gt;&#xA;        {% endnav %}&#xA;        &amp;lt;option value=&quot;Services&quot;&amp;gt;Services&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Consultancy&quot;&amp;gt;Consultancy&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;General enquiry&quot;&amp;gt;General enquiry&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;div class='input'&amp;gt;&#xA;        &amp;lt;label class='form__label' for='fromEmail'&amp;gt;Your email address&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input class='form__input' id='fromEmail' name='fromEmail' type='email' placeholder='Email address' value='{% if message is defined %}{{ message.fromEmail }}{% endif %}'&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class='input'&amp;gt;&#xA;        &amp;lt;label class='form__label' for='message'&amp;gt;Details&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea class='form__input form__input--textarea' id='message' name='message' placeholder='Tell us more'&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{# form closing markup/submit button #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;any help, phenomenally appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Dave&lt;/p&gt;&#xA;" OwnerUserId="2204" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-05-29T13:13:45.560" Title="Include additional fields in Craft form notification template" Tags="&lt;templating&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8421" PostTypeId="2" ParentId="8415" CreationDate="2015-02-27T15:53:37.200" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there technical reasons for this recommendation, or is it something you'd just rather not support?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's more along the lines of it's something &lt;em&gt;you're&lt;/em&gt; not going to want to support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that things like services and records change over time.  Methods get renamed/deleted, attributes change, parameters change, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using them in a migration you're assuming that the methods you're calling and the attributes you're using are going to be there for the rest of time and that's not necessarily going to be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A year from now if someone tries to run that migration, there's a chance those services and records are going to look very different and the migration is going to fail because it was written for what the service/record looked like a year ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're much better off thinking of migrations as little self-contained applications with as few dependencies on external Craft classes as possible.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-27T15:53:37.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8422" PostTypeId="1" AcceptedAnswerId="8426" CreationDate="2015-02-27T16:40:00.357" Score="0" ViewCount="643" Body="&lt;p&gt;I’ve tried &lt;code&gt;HeaderHelper::setHeader(array('code' =&amp;gt; 200))&lt;/code&gt; without success.&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2015-02-27T19:35:06.203" Title="How to set a response 200 from a plugin?" Tags="&lt;plugin-development&gt;&lt;json&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8423" PostTypeId="2" ParentId="8420" CreationDate="2015-02-27T17:53:07.430" Score="2" Body="&lt;p&gt;If you look at &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;the GitHub page for the ContactForm plugin&lt;/a&gt; under the section for adding additional fields, you'll see that you need to change the name of the &lt;code&gt;message&lt;/code&gt; field to &lt;code&gt;message[body]&lt;/code&gt;. Try that to see if it helps. I would imagine leaving it as &lt;code&gt;message&lt;/code&gt; means that it overwrites the values of the other additional fields.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-02-27T17:53:07.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8424" PostTypeId="1" CreationDate="2015-02-27T18:50:38.367" Score="1" ViewCount="324" Body="&lt;p&gt;I have a large set of images, stored on Amazon S3. I would like my users to be able to download the original version of an image, rather then watching it in the browser. I know I can do this with PHP by setting headers and such, and I already have a plugin + controller waiting to do this, but is there an easy way to access the image data stored in S3, or should I do this directly through the S3 Class?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-28T18:58:39.423" Title="Can visitors 'force download' images stored on Amazon S3?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;assetfilemodel&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8425" PostTypeId="1" CreationDate="2015-02-27T19:19:55.867" Score="2" ViewCount="228" Body="&lt;p&gt;I've started off with this solution:&#xA;&lt;a href=&quot;http://craftcookbook.net/recipes/330&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/330&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testsByAllergenGroup = {} %}&#xA;{% set entries = craft.entries.section('tests').order('title asc') %}&#xA;{% set groups  = craft.categories.group('allergenGroup') %}&#xA;&#xA;{% for group in groups %}&#xA;  {% set entries = entries.relatedTo(group) %}&#xA;  {% if entries|length %}&#xA;    {% set testsByAllergenGroup = testsByAllergenGroup|merge({&#xA;      (group.title): entries&#xA;    }) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;    {% if groups|length %}&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;small-12 columns&quot;&amp;gt;&#xA;          &amp;lt;ul class=&quot;inline-list&quot;&amp;gt;&#xA;            &amp;lt;li&amp;gt;Allergy Groups:&amp;lt;/li&amp;gt;&#xA;            {% for group in groups %}&#xA;              &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ group.slug }}&quot;&amp;gt;{{ group.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      {% for groupTitle, groupTests in testsByAllergenGroup %}&#xA;        &amp;lt;h2 id=&quot;{{ groupTitle }}&quot;  class=&quot;content__subtitle&quot;&amp;gt;&#xA;          {{ groupTitle }}&#xA;        &amp;lt;/h2&amp;gt;&#xA;        &amp;lt;div class=&quot;content__panel&quot;&amp;gt;&#xA;          {% for entry in groupTests %}&#xA;            &amp;lt;div class=&quot;test-menu-item&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;medium-7 columns&quot;&amp;gt;&#xA;                  &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;medium-5 columns&quot;&amp;gt;&#xA;                  &amp;lt;ul class=&quot;button-group radius even-2&quot;&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;info tiny button&quot;&amp;gt;View Details&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;tiny button&quot;&amp;gt;Add to Cart ($40)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                  &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;              &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;p&amp;gt;&#xA;          &amp;lt;a href=&quot;#top&quot; class=&quot;content__link--top&quot;&amp;gt;BACK TO TOP&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;      {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm hoping to output the group title and slug, but this code will only allow for one variable to be set in the merge set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testsByAllergenGroup = testsByAllergenGroup|merge({&#xA;  (group.title): entries&#xA; }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm hoping to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for group, groupTests in testsByAllergenGroup %}&#xA;  &amp;lt;h2 id=&quot;{{ group.slug }}&quot;  class=&quot;content__subtitle&quot;&amp;gt;&#xA;    {{ group.id }}&#xA;  &amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can you guys help me out? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s. this is my first major Craft CMS project so Twig is new to me ;)&lt;/p&gt;&#xA;" OwnerUserId="3358" LastActivityDate="2015-03-03T08:29:20.653" Title="Grouping by Category with Multiple Keys" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8426" PostTypeId="2" ParentId="8422" CreationDate="2015-02-27T19:35:06.203" Score="3" Body="&lt;p&gt;See &lt;a href=&quot;https://stackoverflow.com/a/12018482/684&quot;&gt;here&lt;/a&gt; for various methods of setting the response code depending on what version of PHP and which PHP module you're running.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-27T19:35:06.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8427" PostTypeId="1" AcceptedAnswerId="8431" CreationDate="2015-02-27T22:39:01.160" Score="5" ViewCount="1414" Body="&lt;p&gt;Just wondering if its possible to output an array to the Plugin::log call? Would be really handy to see if an error occurs, what a data object's values are!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::log(array('test')), LogLevel::Error);&#xA;Plugin::log(json_decode(array('test')), LogLevel::Error);&#xA;Plugin::log(var_dump(array('test')), LogLevel::Error);&#xA;Plugin::log(print_r(array('test')), LogLevel::Error);&#xA;Plugin::log(\CVarDumper::dump(array('test')), LogLevel::Error);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-02-27T23:31:01.663" LastActivityDate="2015-02-28T04:28:49.863" Title="Output array to Plugin::log" Tags="&lt;plugin-development&gt;&lt;logs&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8428" PostTypeId="2" ParentId="8425" CreationDate="2015-02-27T23:04:00.733" Score="1" Body="&lt;p&gt;Try adding square brackets around your object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testsByAllergenGroup = testsByAllergenGroup|merge([{ (group.title): entries }]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing I'd change is to set the object keys to something unique (slug or id works better than title).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To feed the object with all properties you need (so you don't need to do further DB queries later), do the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values of your object can be objects too, this allows you to assign more data to each individual key.&#xA;You could define a custom key for each property you need for your output (i.e. &lt;code&gt;'groupId': group.id&lt;/code&gt;) or&#xA;pass the whole category model (see example code below), which allows you to access all of its properties in the output loop.&#xA;With the entries you need to make sure to assign an array of entry models and not an ElementCriteriaModel! So make sure to&#xA;add the &lt;code&gt;find()&lt;/code&gt; method to your &lt;code&gt;craft.entries&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for group in groups %}&#xA;    {% set entries = entries.relatedTo(group).find() %}&#xA;    {% set testsByAllergenGroup = testsByAllergenGroup|merge([{&#xA;        (group.slug): {&#xA;            'group': group,&#xA;            'entries': entries&#xA;        }&#xA;    }]) %}&#xA;{% endfor %}&#xA;&#xA;{% for key, value in testsByAllergenGroup %}&#xA;    {{ value.group.id }}: {{ value.group.title }}&#xA;    {% for entry in value.entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-03T08:29:20.653" LastActivityDate="2015-03-03T08:29:20.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8429" PostTypeId="2" ParentId="8427" CreationDate="2015-02-27T23:06:40.147" Score="3" Body="&lt;p&gt;Something like this should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::log(\CVarDumper::dumpAsString(array('test')), LogLevel::Error);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the &lt;code&gt;\&lt;/code&gt; in front of &lt;code&gt;CVarDumper&lt;/code&gt; to tell PHP that class is not in the Craft namespace, but in the global one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-02-28T04:28:49.863" LastActivityDate="2015-02-28T04:28:49.863" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8430" PostTypeId="1" CreationDate="2015-02-28T00:19:00.333" Score="1" ViewCount="1217" Body="&lt;p&gt;I've attempted to add an xml sitemap within the /public directory but received a 404 because htaccess is blocking the document. What is the proper location and method to add an xml sitemap to Craft? &lt;/p&gt;&#xA;" OwnerUserId="3332" LastEditorUserId="3332" LastEditDate="2015-03-01T01:43:46.323" LastActivityDate="2015-03-01T01:43:46.323" Title="Adding XML Sitemaps" Tags="&lt;siteurl&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8431" PostTypeId="2" ParentId="8427" CreationDate="2015-02-28T00:35:58.767" Score="6" Body="&lt;p&gt;Passing &lt;code&gt;true&lt;/code&gt; as the second parameter to &lt;a href=&quot;http://php.net/manual/en/function.print-r.php&quot; rel=&quot;noreferrer&quot;&gt;print_r&lt;/a&gt; returns a string that can be written to the log.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::log(print_r(array('test'), true));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-02-28T00:35:58.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8432" PostTypeId="1" AcceptedAnswerId="8433" CreationDate="2015-02-28T04:09:42.467" Score="1" ViewCount="245" Body="&lt;p&gt;I've setup a dev site on a subdomain alongside the production site and modified the config.php and db.php files on both installs for a multi-environment config. Since I only need to work on plugins and template files on the 'dev' site, would it be crazy to have the 'dev' site use the same mysql database as the live site? What would be the downfall in doing this?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-02-28T04:48:01.260" Title="Multi-Env Craft Setup sharing DB" Tags="&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8433" PostTypeId="2" ParentId="8432" CreationDate="2015-02-28T04:48:01.260" Score="4" Body="&lt;p&gt;I wouldn't do it, personally.  Especially if your plugin interacts with the database and you'll be creating/deleting tables, altering the schema, needing to restore the database, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Too much risk in breaking the live site and very little benefit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-28T04:48:01.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8434" PostTypeId="2" ParentId="8419" CreationDate="2015-02-28T05:18:43.797" Score="1" Body="&lt;p&gt;Off the top of my head and in no way tested or thought through, you could put some logic in your plugin's &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    $username = craft()-&amp;gt;request-&amp;gt;getQuery('username');&#xA;&#xA;    if ($username)&#xA;    {&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'username' =&amp;gt; $username&#xA;        ));&#xA;&#xA;        craft()-&amp;gt;runController('myPluginHandle/myPluginActionMethod');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your plugins's controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionDoIt($username)&#xA;    {&#xA;        // Do your thing.&#xA;&#xA;        $this-&amp;gt;redirect('homepage');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-02-28T05:18:43.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8435" PostTypeId="1" AcceptedAnswerId="8437" CreationDate="2015-02-28T10:39:54.043" Score="2" ViewCount="128" Body="&lt;p&gt;I have this supersimple navigation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;   {% for entry in craft.entries.section('homepage, arbeiten, info, kontakt, shop') %}&#xA;       &amp;lt;li&amp;gt;&#xA;         &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add an order filter which orders the entry by the order I wrote the entry handles? I tried to apply &lt;code&gt;.fixedOrder&lt;/code&gt; but that does nothing.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-02-28T12:31:10.630" Title="Orderby writing sequence" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8436" PostTypeId="2" ParentId="8430" CreationDate="2015-02-28T11:35:48.093" Score="3" Body="&lt;p&gt;The default '.htaccess' file that comes with craft should not 'block' or redirect any files that exist; it simply routes what would otherwise be 404 requests (i.e. documents that don't exist) to craft, so that craft can attempt to resolve the route. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your sitemap is a static file, then the correct location would be in your public folder. If you are receiving an error trying to access it, then something else is going on with your site (possibly from a modified '.htaccess' file, or apache configuration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If generating your sitemap dynamically via a craft twig template or plugin, then your sitemap template would likely be in your templates folder. If you are receiving a 404 response then the route to the sitemap has not been properly configured in craft (in your section, plugin, or routes settings depending on how you are defining it).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-02-28T13:49:10.340" LastActivityDate="2015-02-28T13:49:10.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8437" PostTypeId="2" ParentId="8435" CreationDate="2015-02-28T12:22:15.040" Score="2" Body="&lt;p&gt;The &lt;code&gt;fixedOrder&lt;/code&gt; parameter makes your entries to be returned in the same order as the IDs you pass to the &lt;code&gt;id&lt;/code&gt; parameter. So a simple solution would be to look up the entry IDs of your single section entries and get your entries via their IDs instead of the section handles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = [3, 14, 15, 9, 26] %}&#xA;&#xA;{% for entry in craft.entries.id(entryIds).fixedOrder(true) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can eighter look up the IDs in the database, or probably faster: add &lt;code&gt;{{ entry.id }}&lt;/code&gt; to your current nav loop!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; If you have a good reason to get them via their handles, use this snippet to get the entry IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionHandles = ['arbeiten', 'info', 'kontakt', 'shop'] %}&#xA;&#xA;{% cache globally for 3 years %}&#xA;    {% set entryIds = [3] %}&#xA;    {% for handle in sectionHandles %}&#xA;        {% set entryIds = entryIds|merge([ craft.entries.section(handle).first().id ]) %}&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-02-28T12:31:10.630" LastActivityDate="2015-02-28T12:31:10.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8438" PostTypeId="1" AcceptedAnswerId="8440" CreationDate="2015-02-28T14:44:28.363" Score="3" ViewCount="366" Body="&lt;p&gt;For an event page I have the option to filter on cities and countries. Each event has entry fields in which the city and country, of which the values are outputted in a drop down list on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As some events happen in the same country and city I have multipe values that are the same. Is there any chance to filter these values in Craft and output it only ones?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events') %}                      &#xA;    &amp;lt;option value=&quot;{{entry.stad}}&quot; name=&quot;{{ entry.stad }}&quot;&amp;gt;{{ entry.stad }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1072" LastActivityDate="2015-02-28T16:35:54.093" Title="How to check if entry field value is already outputted, and prevent it again?" Tags="&lt;entry&gt;&lt;field&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8439" PostTypeId="2" ParentId="8438" CreationDate="2015-02-28T15:27:31.440" Score="2" Body="&lt;p&gt;As you are outputting the options, build an array of &lt;code&gt;stad&lt;/code&gt; values and check for duplicates on each loop iteration. If the value does not exist in the array, add it to the array and print out the option. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stad_array = [] %}&#xA;&#xA;{% for entry in craft.entries.section('events') %}&#xA;    {% if entry.stad not in stad_array %}&#xA;        {% set stad_array = stad_array|merge([entry.stad]) %}&#xA;        &amp;lt;option value=&quot;{{entry.stad}}&quot; name=&quot;{{ entry.stad }}&quot;&amp;gt;{{ entry.stad }}&amp;lt;/option&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-02-28T15:27:31.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8440" PostTypeId="2" ParentId="8438" CreationDate="2015-02-28T16:35:54.093" Score="3" Body="&lt;p&gt;Craft has a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group filter&lt;/code&gt;&lt;/a&gt;, that does just that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for stad, events in craft.entries.section('events') | group('stad') %}&#xA;    &amp;lt;option value=&quot;{{ stad }}&quot;&amp;gt;{{ stad }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-28T16:35:54.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8441" PostTypeId="1" AcceptedAnswerId="8442" CreationDate="2015-02-28T17:03:07.220" Score="3" ViewCount="728" Body="&lt;p&gt;I am new to Craft from EE. I have a snippet of code which I will be reusing in several templates. I see Globals but that doesn't seem like like what I am looking for. What is the proper method of doing this within Craft? Thanks&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2018-09-28T14:22:39.157" Title="Craft equivalent to EE snippets for use in templates?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8442" PostTypeId="2" ParentId="8441" CreationDate="2015-02-28T18:01:24.530" Score="6" Body="&lt;p&gt;Craft uses Twig, and Twig uses &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;noreferrer&quot;&gt;macros&lt;/a&gt; for reusing snippets of code within templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your macro file (for instance, macro/userMacro.html), you can create a macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro hairColor(user) %}&#xA;    &amp;lt;span class=&quot;hair-{{ user.hairColor }}&quot;&amp;gt;{{ user.hairColor }}&amp;lt;/span&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in any other file (or in your main _layout template, for that matter), you can import and use this macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;macro/userMacro&quot; as userMacro %}&#xA;&#xA;{% for user in craft.users %}&#xA;    {{ userMacro.hairColor }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Place your &lt;code&gt;import&lt;/code&gt;-tag at the top of your _layout file, and you will be able to use it in every template that extends it (or is included by it).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-02-28T18:01:24.530" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="8443" PostTypeId="2" ParentId="8424" CreationDate="2015-02-28T18:58:39.423" Score="1" Body="&lt;p&gt;Headers passed back from S3 have to be set either on object upload or copy. You would have to use S3::copyObject() to copy the object to itself and set the appropriate headers (mentioned here: &lt;a href=&quot;https://stackoverflow.com/a/25933113/2040791&quot;&gt;https://stackoverflow.com/a/25933113/2040791&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can use the method mentioned in the same thread and force a download using HTML5, but that won't work on all browsers.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-02-28T18:58:39.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8448" PostTypeId="2" ParentId="5025" CreationDate="2015-03-01T14:23:07.247" Score="1" Body="&lt;p&gt;I just published a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon HTML&lt;/a&gt; – this includes a Twig filter for applying an image transform (named or inline) to all &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags in arbitrary HTML content (unfortunately only for local assets, for now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Transform&quot; rel=&quot;nofollow&quot;&gt;this Wiki page&lt;/a&gt; for specific instructions on how to apply image transforms with Retcon.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-01T14:23:07.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8449" PostTypeId="1" CreationDate="2015-03-01T14:51:11.833" Score="2" ViewCount="265" Body="&lt;p&gt;I've been trying to adapt &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1723/how-can-i-automatically-generate-responsive-images-from-a-single-hi-res-asset&quot;&gt;this helpful post&lt;/a&gt; to work with Image Transforms, so that the starting point for generating the responsive images is a cropped high resolution original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've defined a Transform called 'fullWidth' in the CMS, and have tried calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do image.setTransform('fullWidth') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tearing my hair out, would someone be kind enough to assist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro srcset(image, maxCssWidth, includeDimensions) %}&#xA;{%- spaceless %}&#xA;    {# Is this a 2X image? #}&#xA;    {% set is2x = image.filename matches '/@2x\\.\\w+$/' %}&#xA;&#xA;    {# Determine the CSS width for the image, if it were output at 100% #}&#xA;    {% set cssWidth = (is2x ? round(image.width / 2) : image.width) %}&#xA;&#xA;    {# Determine the image size that 1X screens should get #}&#xA;    {% set width = (cssWidth &amp;gt; maxCssWidth ? maxCssWidth : cssWidth) %}&#xA;&#xA;    {# Determine the image size that 2X screens should get #}&#xA;    {% set width2x = (width * 2) &amp;gt; image.width ? image.width : (width * 2) %}&#xA;&#xA;    {# Output the srcset= attribute value #}&#xA;    srcset=&quot;{{ image.getUrl(image.width != width ? { width: width }) }}, {{ image.getUrl(image.width != width2x ? { width: width2x }) }} 2x&quot;&#xA;&#xA;    {#- Output the width= and height= attributes if needed #}&#xA;    {%- if includeDimensions %} width=&quot;{{ width }}&quot; height=&quot;{{ image.getHeight({ width: width }) }}&quot;{% endif %}&#xA;{% endspaceless -%}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3363" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-03T22:39:53.610" Title="Generating responsive images from cropped source file" Tags="&lt;image-transforms&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8450" PostTypeId="1" AcceptedAnswerId="8451" CreationDate="2015-03-01T17:40:48.443" Score="3" ViewCount="1576" Body="&lt;p&gt;I use regular file names for template structure from documentation for clearer understanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the template structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;_layouts&#xA;&lt;ul&gt;&#xA;&lt;li&gt;base.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;_includes&#xA;&lt;ul&gt;&#xA;&lt;li&gt;header.twig&lt;/li&gt;&#xA;&lt;li&gt;body.twig&lt;/li&gt;&#xA;&lt;li&gt;foot.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;index.twig&lt;/li&gt;&#xA;&lt;li&gt;de&#xA;&lt;ul&gt;&#xA;&lt;li&gt;_includes&#xA;&lt;ul&gt;&#xA;&lt;li&gt;header.twig&lt;/li&gt;&#xA;&lt;li&gt;body.twig&lt;/li&gt;&#xA;&lt;li&gt;foot.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;index.twig&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So for top level domain, 'index.twig' &lt;code&gt;extends&lt;/code&gt; 'base.twig' and 'base.twig' &lt;code&gt;include&lt;/code&gt; 'header.twig','body.twig' and 'foot.twig'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sub level domain (example.com/de), It's the same scenario as for top level domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All 'index.twig' files in all sub level domains &lt;code&gt;extends&lt;/code&gt; the same file located at '_layouts/base.twig'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;include&lt;/code&gt; filters look like this in my 'base.twig' template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% block header %}{% include '_includes/header' %}{% endblock %}&#xA;{% block body %}{% include '_includes/body' %}{% endblock %}&#xA;{% block foot %}{% include '_includes/foot' %}{% endblock %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All work great, but did I use it correctly?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing that confuses me, is that I didn't have to copy '_layouts' folder with 'base.twig' file to 'de' folder, and modify paths in 'base.twig' for all &lt;code&gt;include&lt;/code&gt; filters. Why is it so? Twig renders files of an active locale? &lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-03-01T18:28:45.410" Title="Do I use Twig filters 'include' and 'extends' for localized site correctly?" Tags="&lt;templating&gt;&lt;filter&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8451" PostTypeId="2" ParentId="8450" CreationDate="2015-03-01T18:28:45.410" Score="3" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide#step-7-update-your-templates&quot; rel=&quot;nofollow&quot;&gt;localization guide&lt;/a&gt; - When Craft is looking for a template, it &lt;em&gt;first&lt;/em&gt; sees if a template with that path exists inside a directory named after the current locale, then for the actual path provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, when you're in the &lt;code&gt;de&lt;/code&gt; locale, it would look for the following templates:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;templates/de/_layouts/base.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;templates/_layouts/base.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;templates/de/_includes/header.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;templates/_includes/header.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;etc, using the first one that exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's little or no difference between how the site behaves in different locales (other than the &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;translated strings&lt;/a&gt;,) then it might not be necessary to override whole templates like that, but it's great when you need it.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-01T18:28:45.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8452" PostTypeId="1" AcceptedAnswerId="8459" CreationDate="2015-03-01T18:35:54.133" Score="2" ViewCount="2105" Body="&lt;p&gt;I am wondering the way to go about modifying the redactor formatting settings either for all the configs or on a per config basis. I want to add custom formatting styles and classes for various text elements. Per the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/http://&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; &#xA;it seems I need to add it with JS (not something I add in a config json file) but i'm not sure where I need to add the file.&lt;/p&gt;&#xA;" OwnerUserId="3366" LastActivityDate="2015-03-02T12:01:46.987" Title="Craft CMS Redactor formatting" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8453" PostTypeId="2" ParentId="6505" CreationDate="2015-03-01T19:43:05.997" Score="3" Body="&lt;p&gt;Your best bet for a quick hacky solution would be to interrupt the indexing process, take a look at craft_assetindexdata table and then write a small plugin that calls craft()-&gt;assetindexing-&gt;processIndexForSource().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would get the sessionId from the craft_assetindexdata table and you'd be able to deduce how far the indexing has gotten by looking at the same table. All the entries that have recordId field set to a value have been processed already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can batch it up however you want.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2015-03-01T19:43:05.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8454" PostTypeId="1" AcceptedAnswerId="8456" CreationDate="2015-03-01T23:19:50.167" Score="2" ViewCount="123" Body="&lt;p&gt;Has anybody compiled (or is it be possible to extract from the system) a master list of all the various permissions one can assign in Craft?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-03-02T04:27:44.370" Title="Is there a master list of user/group permissions in Craft?" Tags="&lt;user-groups&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8455" PostTypeId="1" AcceptedAnswerId="8464" CreationDate="2015-03-01T23:51:16.123" Score="3" ViewCount="677" Body="&lt;p&gt;We have two web servers in a load-balanced setup. Both servers are sharing a single database. The craft and public folders are rsync-ed between the two so changes on those folders in web1 propagate into web2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We tried loading a video atom using the following twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;video&quot; %}&#xA;{{ atom.video(block) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works on our local dev copy and on our staging server at AWS, however on our live site we get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o2Kaf.jpg&quot; alt=&quot;Getting an undefined method error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried copying the whole runtime folder from AWS over to the live web servers but that did not fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to get it to work? I would consider myself a novice to Craft so pardon me if there's something obvious that I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Already figured out that it was an error with the upload. Some macros were not properly copied over into live.&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="1141" LastEditDate="2015-03-02T23:39:24.413" LastActivityDate="2015-09-28T12:39:55.100" Title="Issues with compiled_templates - call to undefined method" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8456" PostTypeId="2" ParentId="8454" CreationDate="2015-03-02T04:27:44.370" Score="0" Body="&lt;p&gt;You can go straight to the source and get the list from &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserPermissionsService.php#L39&quot; rel=&quot;nofollow&quot;&gt;UserPermissionsService-&gt;getAllPermissions()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-02T04:27:44.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8457" PostTypeId="2" ParentId="8381" CreationDate="2015-03-02T09:12:35.987" Score="3" Body="&lt;p&gt;Your best bet to get the image in as an Asset in one go would be to use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath($fileLocation, $fileName, $targetFolderId, AssetConflictResolution::KeepBoth);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$fileLocation would be the file's location on the disk&lt;/li&gt;&#xA;&lt;li&gt;$fileName is the desired file name&lt;/li&gt;&#xA;&lt;li&gt;$targetFolderId is the Assets folder, obviously. Look it up in craft_assetfolders table&lt;/li&gt;&#xA;&lt;li&gt;The last argument is how to resolve any naming conflicts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This will return an AssetOperationResponseModel object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fileId = $response-&amp;gt;getDataItem('fileId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will get you the file Id. For an in-action example, see AssetsController::actionExpressUpload()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This will copy the file to the location. This method is intended for importing a file into an Assets source from a different location, say, a temporary folder. It will probably work alright if the file is already in it's intended place, but I still feel like I need to warn you about this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use this to import images to external sources, by the way.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2015-03-02T09:12:35.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8458" PostTypeId="1" AcceptedAnswerId="8461" CreationDate="2015-03-02T10:45:58.833" Score="2" ViewCount="399" Body="&lt;p&gt;Is it possible to further restrict asset filetypes than just &quot;image&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example only allow .jpg, .jpeg and .png ?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-03-02T16:24:13.157" Title="Restrict asset image filetypes" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8459" PostTypeId="2" ParentId="8452" CreationDate="2015-03-02T11:56:13.970" Score="3" Body="&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; use JavaScript to edit the Redactor settings, but the correct answer here is to add the settings with JSON config files. Those should go into your /craft/config/redactor folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take look at the &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft/&quot; rel=&quot;nofollow&quot;&gt;Redactor Styles&lt;/a&gt; plugin though – it will add a couple of textareas to your CP for adding custom Redactor JSON and/or CSS, which should make this a bit easier.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-02T12:01:46.987" LastActivityDate="2015-03-02T12:01:46.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8460" PostTypeId="1" CreationDate="2015-03-02T14:11:48.097" Score="6" ViewCount="319" Body="&lt;p&gt;In a plugin init function I'm listening to &lt;code&gt;entries.saveEntry&lt;/code&gt; and &lt;code&gt;entries.deleteEntry&lt;/code&gt;. This works perfectly if I'm editing entries from their detail view. If I 'bulk' change or delete entries, these events are not fired. I saw in the &lt;code&gt;SetStatusElementAction&lt;/code&gt; class an event called &lt;code&gt;onSetStatus&lt;/code&gt; is triggered but how can I listen to it? The same goes with the delete action. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somehow the following doesn't get triggered for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.setStatus', function($event){ dd($event); });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2016-04-11T18:16:41.967" Title="Delete / change Status from CP via Ajax (trigger event)" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8461" PostTypeId="2" ParentId="8458" CreationDate="2015-03-02T16:24:13.157" Score="3" Body="&lt;p&gt;It depends. If the only files you want to upload are .jpg, .jpeg, and .png, then yes: set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;allowedFileExtensions&lt;/a&gt; in your &lt;code&gt;config/general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'allowedFileExtensions' =&amp;gt; 'jpg, jpeg, png',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want those to be the only image filetypes, but  to allow other files for non-image assets, then that is harder (and I don't know how to do it).&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-03-02T16:24:13.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8462" PostTypeId="1" CreationDate="2015-03-02T22:09:46.213" Score="0" ViewCount="60" Body="&lt;p&gt;Site is running on MAMP PRO locally.&lt;/p&gt;&#xA;&lt;p&gt;PHP settings:&lt;br&gt;&#xA;max_execution_time = 60&lt;br&gt;&#xA;memory_limit = 128M&lt;br&gt;&#xA;upload_max_filesize = 32M&lt;br&gt;&#xA;post_max_size = 32M&lt;/p&gt;&#xA;&lt;p&gt;I have an Asset source set-up as:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;File system Path: &amp;quot;{basePath}images/main-content/&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;URL: &amp;quot;{baseUrl}images/main-content/&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In my craft/config/general I have Environment-Specific Variables as per the Craft docs &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When I upload an image the progress bar goes across but then stays on screen with the spinner constantly spinning. The files never upload.&lt;/p&gt;&#xA;&lt;p&gt;If I manually drop an image in the images/main-content folder then do &amp;quot;Update Asset Indexes&amp;quot; in Settings the image appears in Assets OK.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Images&amp;quot; and &amp;quot;main-content&amp;quot; are set to 777&#xA;The files aren't particularly big.&lt;/p&gt;&#xA;&lt;p&gt;No errors in PHP logs.&lt;/p&gt;&#xA;&lt;p&gt;Where else should I look&lt;/p&gt;&#xA;" OwnerUserId="3337" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-03-02T22:09:46.213" Title="Assets not uploading but will update manually on local server" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="15" ClosedDate="2015-03-03T03:23:46.280" ContentLicense="CC BY-SA 3.0" />
  <row Id="8463" PostTypeId="1" AcceptedAnswerId="8465" CreationDate="2015-03-02T23:01:14.370" Score="1" ViewCount="418" Body="&lt;p&gt;I've got a Section that uses a Matrix field, that has a block, that has a categories field in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find all entries using this Matrix field, who has a categories field and has a certain category selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at the Relations documentation and trying the following code, but perhaps i'm barking up the wrong tree here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.categories.slug('print') %}&#xA;{% set entries = craft.entries.section('projectsEntries').relatedTo({&#xA;sourceElement: cat,&#xA;field: 'contentBuilder.relatedCategories.content'&#xA;}) %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;{{ entry.title }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2015-03-03T00:17:48.327" LastActivityDate="2019-05-04T05:42:42.623" Title="Find entries that have a category selected from a category field within a matrix block" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8464" PostTypeId="2" ParentId="8455" CreationDate="2015-03-02T23:38:11.037" Score="2" Body="&lt;p&gt;It is my bad. Thanks to Brad Bell, I went to check whether the macros were on both the staging and live servers. The macros existed on staging but not on live.&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="103" LastEditDate="2015-03-03T03:22:27.123" LastActivityDate="2015-03-03T03:22:27.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8465" PostTypeId="2" ParentId="8463" CreationDate="2015-03-02T23:48:18.637" Score="3" Body="&lt;p&gt;Try using &lt;code&gt;targetElement: cat&lt;/code&gt; instead of sourceElement – in my experience the &lt;em&gt;entries&lt;/em&gt; are considered the source of the relation in cases like these, not the categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Also, the &lt;code&gt;field&lt;/code&gt; parameter of the &lt;code&gt;relatedTo&lt;/code&gt; method shouldn't include the Matrix field's block type, only the actual category field – i.e. &lt;code&gt;contentBuilder.content&lt;/code&gt;, not &lt;code&gt;contentBuilder.relatedCategories.content&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-03T00:43:08.657" LastActivityDate="2015-03-03T00:43:08.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8467" PostTypeId="1" CreationDate="2015-03-03T00:16:16.637" Score="0" ViewCount="821" Body="&lt;p&gt;For example have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;       &amp;lt;select&amp;gt;&#xA;               &amp;lt;option&amp;gt;2015&amp;lt;/option&amp;gt;&#xA;               &amp;lt;option&amp;gt;2014&amp;lt;/option&amp;gt;&#xA;               &amp;lt;option&amp;gt;2013&amp;lt;/option&amp;gt;&#xA;               &amp;lt;option&amp;gt;2012&amp;lt;/option&amp;gt;&#xA;      &amp;lt;/select&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;select&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how to get a entries of the selected year?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="125" LastEditDate="2015-03-03T09:05:34.150" LastActivityDate="2015-03-03T09:05:34.150" Title="Form select entries by year" Tags="&lt;templating&gt;&lt;entries&gt;&lt;form&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8468" PostTypeId="1" CreationDate="2015-03-03T02:46:16.450" Score="1" ViewCount="365" Body="&lt;p&gt;It seems strange that this is happening, but our users are being sent the Activate Your Account message first when they initially register (we aren't including the activation link in this email so admin must manually activate)- but then when admin activates, they are sent the same email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't there be a &quot;Your Account Has Been Activated&quot; message available for this instead? Or at least a way to avoid the email being sent twice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are using Pro 2.3.2644, and have &quot;Verify Email Addresses&quot; checked under Users &gt; Settings, and a default user group called &quot;Professionals&quot; - everything else is fairly standard setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't look like a &quot;Your Account has been activated&quot; email message is available- could there be a way for us to hack this in until it's available as a setting in admin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ryan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2248" LastEditorUserId="344" LastEditDate="2015-05-29T13:13:40.390" LastActivityDate="2015-05-29T13:13:40.390" Title="&quot;Activate Your Account&quot; message sent when user signs up, then again when admin activates" Tags="&lt;emails&gt;&lt;registration&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8469" PostTypeId="2" ParentId="8467" CreationDate="2015-03-03T09:02:36.230" Score="2" Body="&lt;p&gt;First thing I recommend is to read through the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;Search Form&lt;/a&gt; guide from the Craft documentation.&#xA;To explain the rest I'll add some comments to the example code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;form.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Use the `group` filter to get the years, entries were posted in #}&#xA;{% set entries = craft.entries.section('news') %}&#xA;{% set entriesByYear = entries|group('postDate|date(&quot;Y&quot;)') %}&#xA;&#xA;&amp;lt;select name=&quot;year&quot;&amp;gt;&#xA;&#xA;    {# Go through the `year` groups #}&#xA;    {% for year, entries in entriesByYear %}&#xA;        &amp;lt;option value=&quot;{{ year }}&quot;&amp;gt;{{ year }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;results.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the params #}&#xA;{% set year = craft.request.getParam('year') %}&#xA;&#xA;{# Compose a param in this format: 'and, &amp;gt;= 2014-01-01, &amp;lt; 2015-01-01' #}&#xA;{% set dateParam = 'and, &amp;gt;= ' ~ year ~ '-01-01, &amp;lt; ' ~ (year + 1) ~ '-01-01' %}&#xA;&#xA;{# Query and loop through the entries #}&#xA;{% set entries = craft.entries.section('news').postDate(dateParam) %}&#xA;&#xA;{% if entries|length %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-03T09:02:36.230" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8470" PostTypeId="2" ParentId="8340" CreationDate="2015-03-03T10:01:50.077" Score="2" Body="&lt;p&gt;Adding more cell types to the Table Fields isn't possible without a plugin. Even with a plugin it's probably not possible to simply extend the default field. I tried to do this and couldn't find a way to extend upon the javascript necessary to add or delete rows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to make more cell types possible I ended up copying the complete Table Field code from Craft core into my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-eventtable&quot; rel=&quot;nofollow&quot;&gt;&quot;Event Table&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone might ask what this is good for, you could use Matrix instead!&#xA;Sure, but sometimes you're in the need for another hierarchy level or you'd simply opt for the cleaner, more compact view of a table field for your date or time inputs.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-03T10:01:50.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8471" PostTypeId="1" AcceptedAnswerId="8474" CreationDate="2015-03-03T11:21:25.600" Score="1" ViewCount="193" Body="&lt;p&gt;Where &lt;strong&gt;entry.type&lt;/strong&gt; is equal to &lt;em&gt;meetingsEventsOverviewPage&lt;/em&gt;, I would expect the following to return true:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type starts with 'meetingsEvents' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However that doesn't happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I test the string explicitly, it &lt;em&gt;does&lt;/em&gt; work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'meetingsEventsOverviewPage' starts with 'meetingsEvents' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'meetingsEventsOverviewPage in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there some kind of parse order going on here that I need to know about?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-03T12:12:13.063" Title="Why am I unable to use Twig conditional on entry.type property?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8473" PostTypeId="2" ParentId="6589" CreationDate="2015-03-03T11:54:45.860" Score="3" Body="&lt;p&gt;You can do this by creating a &quot;single image&quot; template, and point to that template with a URL GET variable containing the Asset ID, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://yoursite.com/gallery/single?assetId=234&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, create a template for your &quot;single&quot; image – e.g &lt;code&gt;/templates/gallery/single.twig&lt;/code&gt; (I like to use the twig extension rather than .html, but its not important).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the following Twig code to your template – it will look at the current request query string for the &lt;code&gt;assetId&lt;/code&gt; variable, and try to pull the relevant Asset:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assetId = craft.request.getParam( 'assetId' ) %}&#xA;{% if assetId %}&#xA;{% set asset = craft.assets.id( assetId ).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can easily output the image in whatever way you want, here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layouts/myGalleryTemplate' %}&#xA;{% block single %}&#xA;    {% if asset is defined %}&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; width=&quot;{{ asset.getWidth() }}&quot; height=&quot;{{ asset.getHeight() }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p class=&quot;error&quot;&amp;gt;The specified image could not be found&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-03T12:08:57.040" LastActivityDate="2015-03-03T12:08:57.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8474" PostTypeId="2" ParentId="8471" CreationDate="2015-03-03T12:04:46.590" Score="2" Body="&lt;p&gt;Your problem is that &lt;strong&gt;entry.type&lt;/strong&gt; is actually not a string, but an instance of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrytypemodel&quot; rel=&quot;nofollow&quot;&gt;EntryTypeModel&lt;/a&gt;. This means that &lt;strong&gt;entry.type&lt;/strong&gt; is an object containing many different properties, among them the &lt;em&gt;handle&lt;/em&gt;, which would be the property that you want to test in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type.handle starts with 'meetingsEvents' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tip: When in doubt about the data your working with, or stuff not working like you'd think, it's often a good idea to &lt;em&gt;dump&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump( entry.type ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output all sorts of useful information about the data, e.g. what it actually is (String, Object etc), all its properties and methods etc.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="125" LastEditDate="2015-03-03T12:12:13.063" LastActivityDate="2015-03-03T12:12:13.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8475" PostTypeId="1" AcceptedAnswerId="8476" CreationDate="2015-03-03T16:16:48.373" Score="3" ViewCount="606" Body="&lt;p&gt;I am trying to use getCriteria() along with buildElementsQuery () in my plugin in order to eventually modify the query.  At the moment, I am not making any modifications to the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when the the fields are outputted in the template, I ended up getting raw html on the screen.  Not nicely formatted HTML.  For example, the paragraph tag shows as &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; and in the source of the page it is &lt;code&gt;&amp;amp;lt;p&amp;amp;gt;&lt;/code&gt;.  The &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; should only be in the source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the template to display the nice html and not the raw html?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMyLibrary()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'library';&#xA;    $criteria-&amp;gt;limit = 10;&#xA;&#xA;    return ($criteria-&amp;gt;find());&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set my_library = craft.accd.my_library() %}&#xA;&#xA;{% for entry in my_library %} &#xA;&#xA;    {{ entry.title }}&#xA;    {{ entry.body}}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works as expected and the rich text html from the body displays correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I change it to use buildElementsQuery as I will modifying the query, the entry.title and entry.body get displayed in the template as raw html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code with the buildElementsQuery added.  I had to also modify the field body to be field_body in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMyLibrary()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'library';&#xA;    $criteria-&amp;gt;limit = 10;&#xA;&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    return ($query-&amp;gt;queryAll());&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set my_library = craft.accd.my_library() %}&#xA;&#xA;{% for entry in my_library %} &#xA;&#xA;    {{ entry.title }}&#xA;    {{ entry.field_body}}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3371" LastActivityDate="2015-03-03T16:26:52.667" Title="When using getCriteria() along with buildElementsQuery() raw html gets displayed by the template" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8476" PostTypeId="2" ParentId="8475" CreationDate="2015-03-03T16:26:52.667" Score="7" Body="&lt;p&gt;&lt;code&gt;$query-&amp;gt;queryAll()&lt;/code&gt; returns &lt;em&gt;raw&lt;/em&gt; arrays of data from the database, this is why you're needing to prepend &lt;code&gt;field_&lt;/code&gt; to each attribute, to get the column name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to populate some &lt;code&gt;EntryModels&lt;/code&gt; before you can use them properly in the templates, with something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;// modify the query here&#xA;&#xA;$results = $query-&amp;gt;queryAll();&#xA;&#xA;return EntryModel::populateModels($results);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-03T16:26:52.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8477" PostTypeId="1" AcceptedAnswerId="8479" CreationDate="2015-03-03T18:02:05.427" Score="1" ViewCount="652" Body="&lt;p&gt;Date fields can have an optional &quot;time&quot; box. This works nicely in the admin, but I can't figure out whether there's any way to access date and time separately when accessing that field via a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case I'm thinking of is an &quot;Event Date&quot; field on an &quot;Event&quot; entry type, which may or may not have a time (because an event may be all day, or may be at a particular time). The way you'd format the date would likely differ depending on whether the time field was filled in or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise there are other ways of achieving this effect (eg. adding an extra &quot;show time&quot; switch), but I'm wondering specifically whether this is currently doable using just a standard Date field's optional time field?&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-03-03T19:22:03.210" Title="Is there any way of distinguishing whether a Date field's &quot;time&quot; is set or not?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8478" PostTypeId="2" ParentId="8477" CreationDate="2015-03-03T18:43:04.963" Score="1" Body="&lt;p&gt;Not from &lt;strong&gt;entry.dateField&lt;/strong&gt; directly, but you can easily use the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/FieldsService&quot; rel=&quot;nofollow&quot;&gt;FieldsService&lt;/a&gt; to pull the field's model and settings, and set a couple of true/false variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following assumes your date field has the handle &quot;dateField&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this (outside your craft.entries loop!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateField = craft.fields.getFieldByHandle( 'dateField' ) %}&#xA;&#xA;{% set showDateFieldTime = dateField and dateField.settings.showTime %}&#xA;{% set showDateFieldDate = dateField and dateField.settings.showDate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, inside your entries loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section( 'events' ).find() %}&#xA;   {% if entry.dateField and showDateFieldDate %}&amp;lt;span class=&quot;date&quot;&amp;gt;{{ entry.dateField | date( 'M j, Y' ) }}&amp;lt;/span&amp;gt;{% endif %}&#xA;   {% if entry.dateField and showDateFieldTime %}&amp;lt;span class=&quot;time&amp;gt;{{ entry.dateField | date( 'h:i:s' ) }}{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: solution is not tested.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-03T19:06:12.770" LastActivityDate="2015-03-03T19:06:12.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8479" PostTypeId="2" ParentId="8477" CreationDate="2015-03-03T19:13:31.430" Score="4" Body="&lt;p&gt;The values entered in Date/Time fields are always saved as Craft datetime objects. This means it doesn't matter if you configure it to show the date, the time or both, Craft always saves them the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make it to show both, so you're able to enter a time for your events, you have to do this in the field's settings for all entries of your &quot;Event&quot; entry type. So to be able to switch input forms (a truly &quot;optional&quot; time field), you would actually need to have two entry types &quot;Event with date&quot; and &quot;Event without date&quot;. Not the cleanest solution in my opinion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd do instead is to use &lt;strong&gt;two separate Date/Time fields&lt;/strong&gt;, one configured to show the date and the other one to show the time. The client would only fill out the time field when necessary. And in the template you'd be able to check for an empty field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.eventDate|date('l, j. F Y') }}&#xA;&#xA;{% if entry.eventTime %}&#xA;    {{ entry.eventTime|date('G:i') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-03T19:22:03.210" LastActivityDate="2015-03-03T19:22:03.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8480" PostTypeId="1" AcceptedAnswerId="8481" CreationDate="2015-03-03T19:52:26.317" Score="11" ViewCount="2117" Body="&lt;p&gt;I'm struggling to set up a listing template and a detail template which will display &quot;event&quot; entries with post date set in the future. I keep getting a 404 error on the detail page. How do I set up Craft &amp;amp; templates to show future dated entries on a listing and detail page?&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2015-03-03T20:50:45.667" LastActivityDate="2017-04-01T14:18:34.473" Title="How do I set up event listing &amp; detail pages with entry post dates that are in the future?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;datetime&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8481" PostTypeId="2" ParentId="8480" CreationDate="2015-03-03T20:09:21.707" Score="12" Body="&lt;p&gt;&lt;strong&gt;STEP ONE:&lt;/strong&gt;&lt;br&gt;&#xA;Create an &quot;Events&quot; section in Craft and uncheck &quot;Entries in this section have their own URLS&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mYFFP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP TWO:&lt;/strong&gt;&lt;br&gt;&#xA;Create your listing page and use &quot;.status('pending')&quot; to have CRAFT return only future dated entries. Also use &quot;.order('postDate')&quot; to have Craft order entries so that the next future dated entry is the first in the list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;events&quot;).order('postDate').status('pending') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP THREE:&lt;/strong&gt;&lt;br&gt;&#xA;In the listing template, you need to manually build the URL to the event's detail page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/events/{{ entry.slug }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP FOUR:&lt;/strong&gt;&lt;br&gt;&#xA;Set up a custom Route to tell Craft which template to load for the URL pattern you're using in STEP THREE.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6B4iQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP FIVE:&lt;/strong&gt;&lt;br&gt;&#xA;Code your event's detail page template to grab the entry's slug from the URL and query the DB to get the right entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.getSegment(2) %}&#xA;{% set entry = craft.entries.section(&quot;events&quot;).slug(slug).status('live', 'pending', 'expired').find()%}&#xA;{% for entry in entry %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE:&lt;/em&gt; I've set the code sample in STEP FIVE to use .status('live', 'pending', 'expired') to show return these types of entries on my event detail page. You can use .status(null) to return ANY/ALL entries on the event detail page... or you can use .status('pending') if you only want future dated events to show and all others to return a 404. This is 100% up to you and based on your project requirements.&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2015-03-03T20:51:26.187" LastActivityDate="2015-03-03T20:51:26.187" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8483" PostTypeId="2" ParentId="8418" CreationDate="2015-03-03T21:37:58.147" Score="1" Body="&lt;p&gt;My understanding of Stripe Checkout is that it doesn't actually charge the user's card. It simply authorises it, and returns a token which you can then use in a server-side script to capture the payment using the Stripe API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, you'll need a server-side component, in the form of a plugin. &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot; title=&quot;Coded by hobbits&quot;&gt;Charge&lt;/a&gt; might provide a decent starting point for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think Charge works with Stripe Checkout as standard, but it's probably worth having a chat with the developer (Joel Bradbury) about the costs of adding this functionality.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2015-03-03T21:37:58.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8486" PostTypeId="2" ParentId="8449" CreationDate="2015-03-03T22:28:46.423" Score="2" Body="&lt;p&gt;Here's what I've ended up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro srcset(image, maxCssWidth, maxCssHeight, includeDimensions) %}&#xA;{%- spaceless %}&#xA;&#xA;    {# Is this a 2X image? #}&#xA;    {% set is2x = image.is2x %}&#xA;&#xA;    {# Determine the CSS width for the image, if it were output at 100% #}&#xA;    {% set cssWidth = (is2x ? round(image.width / 2) : image.width) %}      &#xA;&#xA;    {# Determine the image size that 1X screens should get #}&#xA;    {% set width = (cssWidth &amp;gt; maxCssWidth ? maxCssWidth : cssWidth) %}&#xA;    {% set height = maxCssHeight %}        &#xA;&#xA;    {# Determine the image size that 2X screens should get #}&#xA;    {% set width2x = (width * 2) &amp;gt; image.width ? image.width : (width * 2) %}&#xA;    {% set height2x = (height * 2) &amp;gt; image.height ? image.height : (height * 2) %}&#xA;&#xA;    {# Output the srcset= attribute value #}&#xA;    srcset=&quot;{{ image.getUrl(image.width != width ? { width: width, height: height, mode: 'crop' }) }}, {{ image.getUrl(image.width != width2x ? { width: width2x, height: height2x, mode: 'crop' }) }} 2x&quot;&#xA;&#xA;    {#- Output the width= and height= attributes if needed #}&#xA;    {%- if includeDimensions %} width=&quot;{{ width }}&quot; height=&quot;{{ image.getHeight({ width: width }) }}&quot;{% endif %}&#xA;{% endspaceless -%}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3363" LastEditorUserId="3363" LastEditDate="2015-03-03T22:39:53.610" LastActivityDate="2015-03-03T22:39:53.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8487" PostTypeId="1" AcceptedAnswerId="8492" CreationDate="2015-03-04T00:39:41.680" Score="2" ViewCount="956" Body="&lt;p&gt;Is there a technique for displaying a list of “Next Entries”, which come from the current Channel. The solution I am using at the moment isn’t cutting it…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using an Entry Offset of 1 to display Entries in a sidebar. This works OK if the Entry Detail page the user is looking at happens to be for the most recent Entry, but this quickly breaks down if displaying any other Entry, as the sidebar always displays a list starting at the second most recent Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I display the next entries in the sequence, regardless of which Entry detail page the user is on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="3376" LastActivityDate="2015-03-04T06:59:44.670" Title="How to display a list of next entries" Tags="&lt;entries&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8488" PostTypeId="1" AcceptedAnswerId="8490" CreationDate="2015-03-04T01:22:06.800" Score="1" ViewCount="591" Body="&lt;p&gt;I have an Asset source &quot;Image link gallery&quot; with two custom fields for each Asset: &quot;image title&quot; (text field) &amp;amp; &quot;Image link&quot; (Entries field - can link to multiple sources).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix block &quot;Image link Gallery&quot; with an Assets field &quot;Images&quot; which selects from this Asset source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be be able to select a bunch of images and return the image, title, and link to the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for imageItem in block.images %}&#xA;    &amp;lt;a href=&quot;{{ imageItem.imageLink.uri }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ imageItem.url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;        &amp;lt;span&amp;gt;{{ imageItem.imageTitle }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is returning all the images and titles but no links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="3337" LastActivityDate="2015-03-04T05:59:25.640" Title="Asset with related entry field in Matrix block" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8489" PostTypeId="2" ParentId="8487" CreationDate="2015-03-04T01:33:01.953" Score="5" Body="&lt;p&gt;.getPrev and .getNext sounds like what you're asking for:&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#isSiblingOf&quot;&gt;http://buildwithcraft.com/docs/templating/entrymodel#isSiblingOf&lt;/a&gt;   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'cocktails',&#xA;    order:   'title'&#xA;} %}&#xA;&#xA;{% set prevCocktail = entry.getPrev(params) %}&#xA;{% set nextCocktail = entry.getNext(params) %}&#xA;&#xA;{% if prevCocktail %}&#xA;    &amp;lt;p&amp;gt;Previous: &amp;lt;a href=&quot;{{ prevCocktail.url }}&quot;&amp;gt;{{ prevCocktail.title }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextCocktail %}&#xA;    &amp;lt;p&amp;gt;Next: &amp;lt;a href=&quot;{{ nextCocktail.url }}&quot;&amp;gt;{{ nextCocktail.title }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2015-03-04T01:33:01.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8490" PostTypeId="2" ParentId="8488" CreationDate="2015-03-04T05:59:25.640" Score="2" Body="&lt;p&gt;You said it yourself, the problem is that an Entries field can link to multiple targets. So it is an array of Entry Models you're given here, or more correctly, an ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the first linked entry's Url, all you have to change is to add the &lt;code&gt;first&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ imageItem.imageLink.first().url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you said multiple links are allowed, so to show them all go through them in a loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for imageItem in block.images %}&#xA;    {% for linkedEntry in imageItem.imageLink %}&#xA;        &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ imageItem.url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;            &amp;lt;span&amp;gt;{{ imageItem.imageTitle }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-04T05:59:25.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8491" PostTypeId="1" CreationDate="2015-03-04T06:37:44.210" Score="0" ViewCount="195" Body="&lt;p&gt;&lt;strong&gt;So I have these sections and fields that I'm dealing with:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;candidates&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Name&lt;/li&gt;&#xA;&lt;li&gt;Pic&lt;/li&gt;&#xA;&lt;li&gt;Bio&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;answers&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;relatedQuestion&lt;/li&gt;&#xA;&lt;li&gt;Body&lt;/li&gt;&#xA;&lt;li&gt;relatedCandidate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;questions&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;body&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;candidateGroup&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm outputting a single page using the question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question and Info&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Candidate Group Name&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Candidate&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Answer&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Candidate&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Answer&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;... Repeats ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my current setup looks like this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the answers that are related to the question entry #}&#xA;{% set relatedAnswers = craft.entries.section('answers').relatedTo(entry) %}&#xA;&#xA;{# Loop through categories #}&#xA;{% for category in craft.categories.group('candidateGroup') %}&#xA;&#xA;  {{ category.title }}&#xA;&#xA;  {# Get me the candidates that belong to this category and have an answer related to this question entry #}&#xA;  {% set candidateAnswers = craft.entries.section('candidates').relatedTo('and',&#xA;    category,&#xA;    relatedAnswers&#xA;  ) %}&#xA;  {% for candidateAnswer in candidateAnswers %}&#xA;&#xA;    {# Output the candidate's info and their answer #}&#xA;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I feel like this is right and it seems to be working locally but when I get it live on the site it's having issues recognizing what &quot;entry&quot; it's a part of. No matter what entry I go to via url, it outputs the same answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to do a simple loop to see what relatedAnswers outputs, and it's the right information. It's just getting lost in that inner loop somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;I believe it is working locally just fine. But for some reason, on my Media Temple hosted site, it's not outputting in the same manner. I double and triple checked all the fields and couldn't find any differences?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt;&#xA;I can't figure this out for the life of me. It works fine on local, just not on production. I checked the database to see if there anything out of the ordinary and it looked fine to me. I installed the introvert plugin to see if the relations were working properly and they seem to be just fine. Kind of lost at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated 3&lt;/strong&gt;&#xA;I tried it another way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;question__candidates&quot;&amp;gt;&#xA;  {% for category in craft.categories.group('candidateGroup') %}&#xA;    &amp;lt;div class=&quot;question__row&quot;&amp;gt;&#xA;      &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;      {% for answerEntry in craft.entries.section('answers').relatedTo('and',category,entry) %}&#xA;        &amp;lt;div class=&quot;question__candidates__card&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;question__candidates__card__header&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;question__candidates__card__header__avatar&quot;&amp;gt;&#xA;              {% set relatedCandidate = craft.entries.section('candidates').relatedTo(answerEntry).first() %}&#xA;              {% set asset = relatedCandidate.avatar.first() %}&#xA;              &amp;lt;a href=&quot;{{ relatedCandidate.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;question__candidates__card__header__title&quot;&amp;gt;&#xA;              &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;{{ relatedCandidate.url }}&quot;&amp;gt;{{ relatedCandidate.title }}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;              &amp;lt;p&amp;gt;&#xA;                {% set categoryCandidate = relatedCandidate.group.group('candidateGroup').first() %}&#xA;                {{ categoryCandidate.title }}&#xA;              &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div class=&quot;question__candidates__card__content&quot;&amp;gt;&#xA;            {{ answerEntry.body }}&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% else %}&#xA;        &amp;lt;div class=&quot;slate blank&quot;&amp;gt;&#xA;          There are no answers from candidates in this group yet.&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unlike the other solution, my problem on the server is that it doesn't return any entries at all. I'm assuming it has something to do with that 'relatedTo(entry)'. It's like it doesn't recognize that at all. In the first case it just ignores it and  in this case it's like it can't read it.&lt;/p&gt;&#xA;" OwnerUserId="2313" LastEditorUserId="2313" LastEditDate="2015-03-05T19:59:11.607" LastActivityDate="2015-03-05T19:59:11.607" Title="How to structure this multiple relation?" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8492" PostTypeId="2" ParentId="8487" CreationDate="2015-03-04T06:51:11.823" Score="0" Body="&lt;p&gt;How to query for those entries depends on the sort order of your channel, as you probably want the sort order of your Next Entries to be the same as it is for the channel's index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For news or blog like entries which are ordered by &lt;code&gt;postDate desc&lt;/code&gt; (default) you can make use of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#before&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;before&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEntries = craft.entries.section('news').before(entry.postDate).limit(12) %}&#xA;{% for entry in nextEntries %}&#xA;    {{ entry.title }}&#xA;{% else %}&#xA;    No entries found!&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another possibility to query for past entries is to use &lt;code&gt;postDate&lt;/code&gt; as a parameter (→ allowed &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;syntax for parameter values&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEntries = craft.entries.section('news').postDate('&amp;lt; ' ~ entry.postDate).limit(12) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For other types of channels, that might be ordered by title or ID, here some more examples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEntries = craft.entries.section('books').title('&amp;lt; ' ~ entry.title).order('title desc').limit(40) %}&#xA;{% set nextEntries = craft.entries.section('rum').age('&amp;gt; ' ~ entry.age).order('age').limit(5) %}&#xA;{% set nextEntries = shuffle(craft.entries.section('dreams').id('not ' ~ entry.id).limit(7)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-04T06:59:44.670" LastActivityDate="2015-03-04T06:59:44.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8493" PostTypeId="2" ParentId="8491" CreationDate="2015-03-04T08:25:11.367" Score="1" Body="&lt;p&gt;There could be corrupt data in your remote database. I tried to answer a similar case some weeks ago: &lt;a href=&quot;https://craftcms.stackexchange.com/q/5164/125&quot;&gt;&quot;Entries related to Users&quot;&lt;/a&gt;, where the code was right, but Craft returned the wrong entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd check if it helps to clear the database and do a fresh import from you local environment.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-04T08:25:11.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8494" PostTypeId="1" CreationDate="2015-03-04T10:10:19.327" Score="1" ViewCount="87" Body="&lt;p&gt;I am trying to save comments using the core method &quot;entries/saveEntry&quot;, but every time I submit the form the last comment is overwritten, is there a simple way of submitting this information to insert instead of update all the comments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I the form working in that it relates a comment to an entry using the following form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[usercomments][new1][type]&quot; value=&quot;comments&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[usercomments][new1][fields][commentuser]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[usercomments][new1][fields][commenttext]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just dont get why the comments are being overwritten and how to just insert a new entry.&lt;/p&gt;&#xA;" OwnerUserId="2311" LastActivityDate="2016-08-01T04:56:18.050" Title="Comments being overwritten on save" Tags="&lt;entry&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8495" PostTypeId="1" CreationDate="2015-03-04T11:10:06.843" Score="0" ViewCount="736" Body="&lt;p&gt;I've moved my site from a local install to my server. I'm pretty new at this, so hopefully I've followed the right course:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Edited db.php to reflect the changes &lt;/li&gt;&#xA;&lt;li&gt;Edited index.php to point at the craft folder &lt;/li&gt;&#xA;&lt;li&gt;Had to change the siteUrl in craft_info because it would only show the Craft 404 page (siteUrl was still on localhost)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can see the correct rendered pages now, but as soon as I type /admin or /index.php/admin or /index.php?p=admin I get an Apache 404 error on the /admin/login url&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what should i do now?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2015-03-04T14:21:30.713" LastActivityDate="2015-04-03T22:28:31.753" Title="Accessing admin panel after deploying local MAMP" Tags="&lt;admin&gt;&lt;mamp&gt;&lt;deployment&gt;&lt;404&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8496" PostTypeId="2" ParentId="8418" CreationDate="2015-03-04T13:00:27.223" Score="1" Body="&lt;p&gt;&lt;em&gt;Disclaimer : I'm the developer of &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; so am obviously biased&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; uses the Stripe API directly and doesn't support the Stripe Checkout modal method for payments. It is something I've looked into, but haven't had the opportunity to implement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen's comment is correct - while the front-end form implementation is simplified using Stripe Checkout, a server side component is still required and that's where the majority of the work is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really require Stripe Checkout support it's certainly something that can be added. Get in touch &lt;a href=&quot;http://squarebit.co.uk/contact&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and we can discuss details/requirements&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the side of updating elements on success, that's a feature that's in the next release of Charge (2.0), which I'm prepping right now.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-04T13:00:27.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8497" PostTypeId="2" ParentId="4176" CreationDate="2015-03-04T13:37:44.530" Score="6" Body="&lt;p&gt;I've been thinking about ways to achieve this recently, and I've put together a basic proof-of-concept plugin for fetching one level of relations for a collection of elements, with no more than two extra queries for each element type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One query to get the IDs of the related elements, and then another to actually fetch and return the elements with the &lt;code&gt;ElementsService&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin then matches those related elements back to the entries through a dynamically-added &lt;code&gt;fetched()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you want to fetch all the Assets related through the &lt;code&gt;mainImage&lt;/code&gt; and &lt;code&gt;additionalImages&lt;/code&gt; fields, over a collection of product entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('products').find %}&#xA;{% do craft.fetch.assets(entries, 'mainImage, additionalImages') %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% if entry.fetched('mainImage')|length %}&#xA;        &amp;lt;img src=&quot;{{ (entry.fetched('mainImage')|first).getUrl('large') }}&quot;&amp;gt; &#xA;    {% endif %}&#xA;&#xA;    {% for image in entry.fetched('additionalImages') %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl('medium') }}&quot;&amp;gt; &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wouldn't say it's &lt;em&gt;necessarily&lt;/em&gt; production-ready yet, but I've thrown it up on Github - &lt;a href=&quot;https://github.com/mdcpepper/fetch&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mdcpepper/fetch&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-03-08T04:56:48.553" LastActivityDate="2015-03-08T04:56:48.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8498" PostTypeId="1" CreationDate="2015-03-04T14:31:01.337" Score="1" ViewCount="141" Body="&lt;p&gt;Looking at a small site build, but potentially capturing Names, Email and Addresses /custom fields, then dumping into a csv.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no user activation, but any potential issues with so many entries in the sql database in any one go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User Registration in Craft seems to fit the bill nicely for us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any experience or notes welcome. &lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="57" LastEditDate="2015-03-04T16:30:02.173" LastActivityDate="2015-03-04T16:31:22.357" Title="Looking at potentially 100,000 users/entries to capture data" Tags="&lt;users&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8499" PostTypeId="2" ParentId="8498" CreationDate="2015-03-04T16:31:22.357" Score="2" Body="&lt;p&gt;We've seen Craft installs with several hundred thousand users/assets/entries running along fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll just need to be smart with how you're pulling data out on the template side and use caching where appropriate and you should be fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-04T16:31:22.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8500" PostTypeId="1" AcceptedAnswerId="8504" CreationDate="2015-03-04T18:57:08.777" Score="2" ViewCount="354" Body="&lt;p&gt;I'm not sure if I missed documentation on it, but is there a method to follow when including additional plugin files for services, controllers, variables etc.? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For bigger plugins it'd help to do this, something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- /myplugin&#xA;   -/services&#xA;      -MyPluginService.php&#xA;      -MyPlugin_OtherService.php&#xA;      -MyPlugin_AnotherService.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried doing this and being sure to follow the service structure of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyPlugin_OtherService extends BaseApplicationComponent&#xA;{&#xA;&#xA;  public function testing()&#xA;  {&#xA;      return &quot;success!&quot;;&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when trying to access it from say the myPluginVariable.php file, I get the CException error that the property is not defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;myPlugin_OtherService-&amp;gt;testing();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a step I'm missing? Do I need to declare these extra files somewhere so that they are included?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-03-04T21:12:37.350" Title="Multiple Service/Variable/Controller plugin files" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;include&gt;&lt;function&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8501" PostTypeId="1" CreationDate="2015-03-04T19:11:20.160" Score="2" ViewCount="1203" Body="&lt;p&gt;When hitting the &quot;forgot password&quot; link on the CP login form, an email is sent but the URL provided returns &quot;Bad Request Param &quot;id&quot; doesn't exist.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or have I done something silly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a site running on a local development environment with Craft 2.3.2636&lt;/p&gt;&#xA;" OwnerUserId="181" LastActivityDate="2015-07-03T18:14:03.707" Title="Forgot password URL in email returns an error" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;password&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8502" PostTypeId="1" CreationDate="2015-03-04T19:14:52.233" Score="3" ViewCount="606" Body="&lt;p&gt;A client wants to be able to get URLs for assets (for, eg. pasting a direct link into an email). For images and PDFs, &quot;View file&quot; works nicely (the file opens in a new browser tab), but for other file types which the browser can't display, they download instead. Is there any way of accessing the full URL of an asset from within the admin panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The best I've been able to suggest is that they reconstruct the URL from the folder structure of their assets, so, eg. &quot;Files &gt; Documents &gt; File.xls&quot; becomes &lt;code&gt;/assets/files/Documents/File.xls&lt;/code&gt;, but it would be great if there was a less fiddly way of getting that URL)&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-03-04T20:11:32.347" Title="Is there any easy way (via the admin panel) to get a direct link for an asset?" Tags="&lt;assets&gt;&lt;url&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8503" PostTypeId="2" ParentId="2116" CreationDate="2015-03-04T19:15:26.307" Score="1" Body="&lt;p&gt;I was able to resolve this issue by creating a custom plugin that uses a service and template variables. The service will accept the content object and field name. You can reference how to write a conditional to check if the field is set (&lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldValue-detail&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldValue-detail&lt;/a&gt;). The service is then used in the template variables and will return true or false based on if the field is set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Template Twig Example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (craft.pluginName.isFieldDefined(e, 'someField') ? e.someField : false) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sorry, I can't post a full code example.&lt;/p&gt;&#xA;" OwnerUserId="3378" LastEditorUserId="125" LastEditDate="2015-03-04T20:27:19.063" LastActivityDate="2015-03-04T20:27:19.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8504" PostTypeId="2" ParentId="8500" CreationDate="2015-03-04T19:20:01.480" Score="2" Body="&lt;p&gt;When calling services, you should not include &quot;service&quot; in method name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;return craft()-&amp;gt;myPlugin_other-&amp;gt;testing();&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-03-04T19:20:01.480" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8506" PostTypeId="1" AcceptedAnswerId="8508" CreationDate="2015-03-04T19:37:02.293" Score="3" ViewCount="1927" Body="&lt;p&gt;Is it possible to define custom user permissions in Craft? &#xA;I'm building some front end templates that are only accessible by logged in users. Certain parts of this members page should only be accessible to users with specific permissions. I know that I can create multiple groups and use template logic to show / hide certain pages. However, being able to define custom user permissions would be much more flexible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I want to allow a user to access a form, but I don't want to grant access to the other permissions from a different user group. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.can('submitForm') %}&#xA;    {# show form here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3335" LastActivityDate="2015-03-04T19:57:14.993" Title="Creating Custom User Permissions" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8507" PostTypeId="2" ParentId="8502" CreationDate="2015-03-04T19:57:09.853" Score="2" Body="&lt;p&gt;You could utilize the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyAssetTableAttributes&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getAssetTableAttributeHtml&lt;/a&gt; hooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you would create a plugin, and in the main plugin file you could add something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyAssetTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    $attributes['filePath'] = Craft::t('File Path');&#xA;}&#xA;&#xA;public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)&#xA;{&#xA;    if ($attribute == 'filePath')&#xA;    {&#xA;        $filePath = $asset-&amp;gt;url;&#xA;        return $filePath;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* Edit *&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did test this, and it works, but because of Craft's ability to reorganize Assets (i.e., drag them to a new folder) it's not just a simple matter of highlighting the link, copying, and pasting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, by taking this example a little further, you should be able to add a little JS and have a link or something to that effect output in &lt;code&gt;getAssetTableAttributeHtml&lt;/code&gt; that when clicked copies the URL to the user's clipboard. If you go this route, make sure to include the JS in your plugin's init method. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJsResource('yourplugin/your-js.js');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or (hah), for a &lt;em&gt;really&lt;/em&gt; basic implementation, you could wrap the string in a URL and just have them right click and &quot;Copy Link Address&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAssetTableAttributeHtml(AssetFileModel $asset, $attribute)&#xA;{&#xA;    if ($attribute == 'filePath')&#xA;    {&#xA;        $filePath = '&amp;lt;a href=&quot;'.$asset-&amp;gt;url.'&quot;&amp;gt;' . $asset-&amp;gt;url . '&amp;lt;/a&amp;gt;';&#xA;        return $filePath;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2015-03-04T20:11:32.347" LastActivityDate="2015-03-04T20:11:32.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8508" PostTypeId="2" ParentId="8506" CreationDate="2015-03-04T19:57:14.993" Score="4" Body="&lt;p&gt;You can create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that adds custom user permissions via the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerUserPermissions&quot; rel=&quot;nofollow&quot;&gt;registerUserPermissions&lt;/a&gt; hook.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-04T19:57:14.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8509" PostTypeId="2" ParentId="8502" CreationDate="2015-03-04T19:59:11.733" Score="1" Body="&lt;p&gt;You could modify the table columns shown on the asset index page and have a column for the URL. Setting this up is only possible with a plugin, but all you need to do is to add &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;modifyAssetTableAttributes&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getAssetTableAttributeHtml&lt;/code&gt;&lt;/a&gt; methods to your plugins primary file and modify the table to your need as &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;described in the docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another hook you could look into with your plugin is the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addAssetActions&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;addAssetActions&lt;/code&gt;&lt;/a&gt; hook.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-04T19:59:11.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8510" PostTypeId="2" ParentId="8500" CreationDate="2015-03-04T21:12:37.350" Score="2" Body="&lt;p&gt;Adding my own discovery in case anyone ever runs into this. The format that worked was lower camel for both the plugin name, and also lower camel for the secondary name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the following class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_OtherService extends BaseApplicationComponent&#xA;{&#xA;    public function myfunction() {}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was able to access it like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;myPlugin_other-&amp;gt;myfunction();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a longer name, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_MoreFunctionalityService extends BaseApplicationComponent&#xA;{&#xA;    public function myfunction() {}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The formatting should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;myPlugin_moreFunctionality-&amp;gt;myfunction();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-03-04T21:12:37.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8511" PostTypeId="2" ParentId="8495" CreationDate="2015-03-04T21:42:19.140" Score="1" Body="&lt;p&gt;Apparently what I did was correct, because now it works. I had some EE files right next to the index.php files and these messed things up for some reason. Probably the admin.php file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At least now I know it's easy to deploy Craft with the three steps I mentioned above&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2015-03-04T21:42:19.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8512" PostTypeId="1" CreationDate="2015-03-04T22:36:57.943" Score="1" ViewCount="2338" Body="&lt;p&gt;A little background first; I'm coming from WordPress, along with the Advanced custom fields (ACF) plugin, so my thinking behind this may not be the best way in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ACF I usually set up a field set that consists of an outer repeater field, with a nested flexible content field inside (much like the Matrix field in Craft). Within the repeat field, there are a couple of options that controls the appearance of a section, such as a background colour/image. This is also used in my template to differentiate where a &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; starts and ends, and often has styles associated to style the overall section. Anything within the flexible content fields is contained within this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, within the flexible content field, I define my layout types (title block, two column text, text with image, etc.). An image to describe the layout structure if my description is a little confusing: &lt;img src=&quot;https://i.stack.imgur.com/ZVnCa.jpg&quot; alt=&quot;Sections&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to create a similar sort of set up with Craft. Without an outer repeater field, I'm struggling to think how to achieve the &quot;section&quot; container. What would be a way to achieve this sort of thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3379" LastEditorUserId="3653" LastEditDate="2016-07-16T06:11:21.483" LastActivityDate="2016-07-16T06:11:21.483" Title="Modelling flexible content sections and recommendations" Tags="&lt;matrix&gt;&lt;sections&gt;&lt;best-practice&gt;&lt;content&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8513" PostTypeId="2" ParentId="1653" CreationDate="2015-03-04T23:30:40.800" Score="2" Body="&lt;p&gt;Just in case anyone is interested, I've decided to make a plugin for this. It's pretty basic, but its exactly what I was after. It's essentially a regular Table with a &lt;code&gt;Label&lt;/code&gt; option to provide some read-only text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/SetTable&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/SetTable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-03-04T23:30:40.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8514" PostTypeId="2" ParentId="6929" CreationDate="2015-03-05T00:21:02.350" Score="2" Body="&lt;p&gt;I just tried this and it works with Craft 2.3.2636. The only difference is this isn't using &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ContentModel::setAttributes()&lt;/code&gt;&lt;/a&gt;, but I wouldn't have thought that would affect it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId   = 2;&#xA;$entry-&amp;gt;typeId      = 2;&#xA;$entry-&amp;gt;authorId    = 1;&#xA;$entry-&amp;gt;enabled     = true;&#xA;$entry-&amp;gt;locale      = &quot;en&quot;;&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;title       = &quot;English Title&quot;;&#xA;$entry-&amp;gt;getContent()-&amp;gt;description = &quot;English description.&quot;;&#xA;&#xA;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA;    $entryEs = craft()-&amp;gt;entries-&amp;gt;getEntryById($entry-&amp;gt;id, &quot;es&quot;);&#xA;&#xA;    $entryEs-&amp;gt;getContent()-&amp;gt;title       = &quot;Spanish Title&quot;;&#xA;    $entryEs-&amp;gt;getContent()-&amp;gt;description = &quot;Spanish description.&quot;;&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entryEs);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-05T00:21:02.350" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8515" PostTypeId="2" ParentId="1653" CreationDate="2015-03-05T10:57:40.130" Score="3" Body="&lt;p&gt;As other answers here say, unfortunately creating &lt;em&gt;tabs&lt;/em&gt; is currently the only way to &quot;group&quot; contextually related fields (or create &quot;fieldsets&quot;, as it were).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do, is use either &lt;a href=&quot;http://straightupcraft.com/craft-plugins/fieldnotes&quot; rel=&quot;nofollow&quot;&gt;FieldNotes&lt;/a&gt; or &lt;a href=&quot;http://straightupcraft.com/craft-plugins/entry-instructions&quot; rel=&quot;nofollow&quot;&gt;Entry Instructions&lt;/a&gt; to create messages/headers in your edit tab, visually separating one &quot;group&quot; of fields from another.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-05T10:57:40.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8516" PostTypeId="1" CreationDate="2015-03-05T13:20:06.303" Score="1" ViewCount="204" Body="&lt;p&gt;I have decided to use Structures as a section type for a section of our site. Can anyone point me to some good documentation for this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular I have set up a structure and I have an &lt;code&gt;_entry.html&lt;/code&gt; and an &lt;code&gt;index.html&lt;/code&gt; file in a directory for the structure section. When I call the url &lt;code&gt;domain.com/mystructure&lt;/code&gt; I am served a 404 error page instead of the &lt;code&gt;index.html&lt;/code&gt; page. &lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="344" LastEditDate="2015-03-05T15:02:15.197" LastActivityDate="2015-03-05T15:11:24.023" Title="Templates and structures" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8517" PostTypeId="1" AcceptedAnswerId="11781" CreationDate="2015-03-05T13:21:03.030" Score="3" ViewCount="1186" Body="&lt;p&gt;I'm working on an Element Action that will duplicate some fields from the primary locale, to whatever locale the user is currently in, if those fields are already empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asset fields seem to work fine, but I can't find a way to duplicate Matrix fields with all their content, including their &lt;em&gt;own&lt;/em&gt; relation fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've got:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;foreach ($criteria-&amp;gt;find() as $element)&#xA;{&#xA;    $locale  = $criteria-&amp;gt;locale;&#xA;    $content = $element-&amp;gt;getContent();&#xA;    $gbr     = craft()-&amp;gt;entries-&amp;gt;getEntryById($element-&amp;gt;id, 'en_gb');&#xA;&#xA;    foreach ($element-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $fieldLayoutField)&#xA;    {&#xA;        $field       = $fieldLayoutField-&amp;gt;getField();&#xA;        $fieldHandle = $field-&amp;gt;handle;&#xA;&#xA;        if (in_array((string) $field-&amp;gt;type, array('Assets', 'Entries', 'Categories', 'Tags')))&#xA;        {&#xA;            // only copy the relation's IDs if there's nothing there already&#xA;            if ($element-&amp;gt;$fieldHandle-&amp;gt;total() == 0)&#xA;            {&#xA;                $content-&amp;gt;$fieldHandle = $gbr-&amp;gt;$fieldHandle-&amp;gt;ids();&#xA;            }&#xA;        }&#xA;        elseif ((string) $field-&amp;gt;type == 'Matrix')&#xA;        {&#xA;            if ($element-&amp;gt;$fieldHandle-&amp;gt;total() == 0)&#xA;            {&#xA;                foreach($gbr-&amp;gt;$fieldHandle-&amp;gt;find() as $gbrBlock)&#xA;                {&#xA;                    // not sure what to do here to duplicate $gbrBlock,&#xA;                    // and save it to $locale with the same contents.&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;$element-&amp;gt;setContent($content);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried using &lt;code&gt;craft()-&amp;gt;matrix-&amp;gt;getBlockById($gbrBlock-&amp;gt;id, $locale)&lt;/code&gt; like you do when duplicating whole entries (they're both elements right?) but that always comes back null, so... I need to create a new MatrixBlockModel in that locale?&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-10-06T20:08:58.773" Title="Duplicating Matrix fields with content from another locale" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8518" PostTypeId="1" AcceptedAnswerId="8521" CreationDate="2015-03-05T14:43:45.453" Score="4" ViewCount="829" Body="&lt;p&gt;I'm trying to see if I can get the Date Created on images within an image upload. Not the date the file was created, but the date the picture was taken. If I open an image up in Preview, in the Inspector I can see that the IPTC, EXIF, and TIFF Metadata contains the information I'm looking for. Is that possible? &lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2016-03-09T06:30:12.587" Title="Is there a way to read IPTC, EXIF or TIFF Metadata in an Image uploaded to Assets?" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8519" PostTypeId="2" ParentId="8516" CreationDate="2015-03-05T15:05:49.257" Score="1" Body="&lt;p&gt;If you haven't seen it already there is some good &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Docs&lt;/a&gt; on the Craft site on sections and how to use them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without seeing your Structure settings it is hard to pin-point exactly what the issue is here, but creating a Structure and adding your templates to it is a very easy procedure. I have attached a screenshot of a Structure for a project I am currently working on, so you can reference in case you have made a mistake somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/poiK6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my templates I have created a folder called &lt;code&gt;services&lt;/code&gt;, and in there I have my &lt;code&gt;index.twig&lt;/code&gt; and &lt;code&gt;_entry.twig&lt;/code&gt; files. Try matching your Structure settings with the screenshot and see if that fixes your problems.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-03-05T15:11:24.023" LastActivityDate="2015-03-05T15:11:24.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8520" PostTypeId="1" AcceptedAnswerId="8543" CreationDate="2015-03-05T15:19:32.353" Score="3" ViewCount="1086" Body="&lt;p&gt;For example the template just outputs JSON, which breaks when Craft's devMode logging is added.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-06T12:27:33.140" Title="Is it possible to disable dev output in a template when devMode is true?" Tags="&lt;templating&gt;&lt;javascript&gt;&lt;devmode&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8521" PostTypeId="2" ParentId="8518" CreationDate="2015-03-05T16:29:32.863" Score="2" Body="&lt;p&gt;You can create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that does something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$image = new Image();&#xA;$image-&amp;gt;load('/path/to/image.jpg');&#xA;$exif = $image-&amp;gt;getExifMetadata();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/io/Image&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for other methods on the Image class.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-05T16:29:32.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8522" PostTypeId="2" ParentId="8520" CreationDate="2015-03-05T16:31:41.540" Score="7" Body="&lt;p&gt;You can create a simple plugin with an &lt;code&gt;init()&lt;/code&gt; method like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;log-&amp;gt;removeRoute('WebLogRoute');&#xA;    craft()-&amp;gt;log-&amp;gt;removeRoute('ProfileLogRoute');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will prevent the extra logging and profiling information to be output in the browser's console when devMode is enabled.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-05T16:31:41.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8523" PostTypeId="1" CreationDate="2015-03-05T16:53:36.100" Score="2" ViewCount="617" Body="&lt;p&gt;Craft is a miracle for us but we've hit a snag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have about 100 products with around 10 images each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've scraped the images from the old site and put them into the appropriately named folders in assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each time we add more, we have to run the asset reindexer which will only reindex the entire section. So even if we add a single folder of images, the entire lot are indexed again. If you've ever used the asset indexer you'll know that for whatever reason it is dog slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this?&#xA;Could the immediate folder not be quickly indexed when the asset viewer is opened in the back end or at least provide an option to reindex that specific entrys assets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Future projects may have 10,000 assets+ so it is a concern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm open to better workflow suggestions as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2016-04-28T13:27:32.623" Title="Sluggish Asset Indexing" Tags="&lt;entries&gt;&lt;assets&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8524" PostTypeId="1" CreationDate="2015-03-05T20:12:08.193" Score="2" ViewCount="441" Body="&lt;p&gt;I have the following in my routes.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'articles/(?P&amp;lt;sectionId&amp;gt;\d+)/(?P&amp;lt;offset&amp;gt;\d+)' =&amp;gt; 'articles/index'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And while localhost/articles/4/1, for example, routes properly to the template, localhost/articles/4/0 does not and I instead get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an issue with zeros being picked up as valid URI segments?&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2015-03-08T10:45:08.847" Title="Route that should be matching numbers not matching a zero?" Tags="&lt;routes&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8525" PostTypeId="1" AcceptedAnswerId="8527" CreationDate="2015-03-05T20:34:03.657" Score="0" ViewCount="876" Body="&lt;p&gt;I'm working on a plugin and need a front-end (non CP) form that submits to one of the plugin controllers. Here's my setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- plugins&#xA;  - portal&#xA;    -- PortalPlugin.php&#xA;    - controller&#xA;      -- Portal_AccessController.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Portal_AccessController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Portal_AccessController extends BaseController {&#xA;&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionLogin() {&#xA;&#xA;        echo 'Here';&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then created a front-end form by adding a new template directory in &lt;code&gt;/craft/templates&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- pro-portal&#xA;  -- index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;index.html&lt;/code&gt; containing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;portal/access/login&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; maxlength=&quot;4&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; maxlength=&quot;4&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; maxlength=&quot;4&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; maxlength=&quot;4&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ actionUrl('portal/access/login') }}&quot;&amp;gt;Test me&amp;lt;/a&amp;gt;&#xA;    &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hitting &lt;code&gt;mydomain.com/pro-portal&lt;/code&gt; displays the form. On submit it returns to &lt;code&gt;/pro-portal&lt;/code&gt; but with a 404 error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried creating an action link but that also results in a 404 at &lt;code&gt;/index.php/actions/portal/access/login&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked through answers on similar questions and tried all the solutions but no luck. Am I overlooking something? Missing something?&lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="476" LastEditDate="2015-03-05T21:46:52.447" LastActivityDate="2015-03-05T22:13:50.947" Title="Posting front-end form to plugin controller route results in 404" Tags="&lt;plugin-development&gt;&lt;form&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8526" PostTypeId="1" AcceptedAnswerId="8661" CreationDate="2015-03-05T20:49:56.987" Score="2" ViewCount="132" Body="&lt;p&gt;I'm trying to configure the Dukt Analytics Plugin to a site for my first time. I was able to successfully configure oAuth on my Google account, and get the account connected via the Analytics Plugin panel in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm having some issues getting the web profile dropdown list to populate. While connecting to Google Analytics, the only permissions it asked for was &quot;have offline access&quot; which may be part of the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any sort of troubleshooting methods that can be done to figure out why no web profiles are showing up?&lt;/p&gt;&#xA;" OwnerUserId="1122" LastActivityDate="2015-03-13T21:40:42.140" Title="Dukt Analytics Plugin - Web Profile not showing up" Tags="&lt;plugins&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8527" PostTypeId="2" ParentId="8525" CreationDate="2015-03-05T21:51:56.430" Score="0" Body="&lt;p&gt;You're getting a 404 because your action method isn't telling Craft what do to after it has echo'd 'Here', so &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing&lt;/a&gt; continues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See #3 is that link:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The request doesn’t necessarily end after a controller has been called. The controller may allow it to keep going.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can redirect, end the request, load up a template to display, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;controller&lt;/code&gt; folder needs to be renamed to &lt;code&gt;controllers&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-05T22:13:50.947" LastActivityDate="2015-03-05T22:13:50.947" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8528" PostTypeId="1" AcceptedAnswerId="8532" CreationDate="2015-03-05T22:39:23.117" Score="1" ViewCount="88" Body="&lt;p&gt;I'm trying to get an element from it's URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say we have a url of &lt;code&gt;http://craft.dev/blog/article1&lt;/code&gt;. Is there a function I can call within a plugin and pass over &lt;code&gt;blog/article1&lt;/code&gt; that will return a corresponding element, if one exists, for that specific URL? I'm sure there is a way to do this with the router, I'm just not sure what it is.&lt;/p&gt;&#xA;" OwnerUserId="220" LastActivityDate="2015-03-05T23:33:44.770" Title="Lookup element by URL" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8529" PostTypeId="1" AcceptedAnswerId="8530" CreationDate="2015-03-05T23:10:29.347" Score="7" ViewCount="63490" Body="&lt;p&gt;How do I loop through entries and set a variable if there are any duplicates in the data I'm checking? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I need to check if there are more than one entry per year. The variable I'm setting will be used in a conditional later in the template.&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2015-03-05T23:17:33.500" LastActivityDate="2015-03-07T23:33:42.887" Title="How do I set a variable in Twig if a value exists more than once in a loop?" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8530" PostTypeId="2" ParentId="8529" CreationDate="2015-03-05T23:10:29.347" Score="11" Body="&lt;p&gt;This can be accomplished by creating an array of the entry years. Inside the loop that's building the array, a conditional checks if the year already exists in the array... if the year exists, a variable is set to TRUE which you can use in your conditional later down on the page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set files = craft.entries.section(&quot;downloads&quot;) %}&#xA;{% set dropdown = 0 %}&#xA;{% set yearArray = [] %}&#xA;&#xA;{% for entry in files %}&#xA;    {% set year = entry.fileDate | date('Y') %}&#xA;    {% if year in yearArray %}&#xA;        {% set dropdown = 1 %}&#xA;    {% endif %}&#xA;    {% set yearArray = yearArray | merge([year]) %}&#xA;{% endfor %}&#xA;&#xA;{% if dropdown %}&#xA;    Do this&#xA;{% else %}&#xA;    Do this&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2015-03-05T23:10:29.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8532" PostTypeId="2" ParentId="8528" CreationDate="2015-03-05T23:33:44.770" Score="2" Body="&lt;p&gt;Try using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#getElementByUri-detail&quot; rel=&quot;nofollow&quot;&gt;ElementsService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;elements-&amp;gt;getElementByUri( 'blog/article1' );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-05T23:33:44.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8533" PostTypeId="2" ParentId="44" CreationDate="2015-03-06T00:31:49.453" Score="5" Body="&lt;p&gt;This simple solution has been working brilliantly for me...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set pageUri = craft.request.url|replace(siteUrl, '') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.config.siteUrl['en'] ~ pageUri }}&quot;&amp;gt;English&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.config.siteUrl['fr'] ~ pageUri }}&quot;&amp;gt;Français&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;pageUri&lt;/code&gt; is basically the current URL, minus the localized &lt;code&gt;siteUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Append the clean &lt;code&gt;pageUri&lt;/code&gt; to each localized &lt;code&gt;siteUrl&lt;/code&gt;, and voila... whatever page you are currently on will be linked to it's other-language counterpart.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-06T00:31:49.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8534" PostTypeId="1" AcceptedAnswerId="8537" CreationDate="2015-03-06T00:47:28.150" Score="0" ViewCount="374" Body="&lt;p&gt;Im trying to upload a profile image from a front end form via a controller function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is what i have but the $image keeps returning null?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form name=&quot;updateProfile&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;salesforce/saveContact&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;file&quot; name=&quot;photo&quot; id=&quot;avatarUpload&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;submit&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my controller action is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveContact()&#xA;{&#xA;&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $userPhoto = craft()-&amp;gt;request-&amp;gt;getPost('photo');&#xA;&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUserPhoto('test.jpg',$userPhoto, $user);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what im doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-03-06T07:39:58.097" Title="Upload user profile image from custom plugin controller" Tags="&lt;form&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8535" PostTypeId="1" AcceptedAnswerId="8903" CreationDate="2015-03-06T03:29:18.090" Score="3" ViewCount="2398" Body="&lt;p&gt;I edited .htaccess as described here &lt;a href=&quot;http://buildwithcraft.com/help/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/help/remove-index.php&lt;/a&gt; and added this 'omitScriptNameInUrls' =&gt; true, to craft/config/general.php, but it doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VP9dP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have my .htaccess file set up: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;    RewriteEngine On&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon.ico|apple-touch-icon.*.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This file is inside public folder and I also tried putting in in the directory that contains the public folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens is this: whether 'omitScriptNameInUrls' =&gt; true is added or not, the home displays fine without the index.php, but the internal pages require index.php to display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that happens when I add 'omitScriptNameInUrls' =&gt; true is that the navigation spits out links without the index.php, and so the navigation breaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good people at Craft said that my site (which is a retooling of the Happy Lager demo site) has been changed to a multi-environment config, which is why my config file looks the way it looks. Not sure if there's anything else that needs to me added to a multi-environment config to get the thing to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not been able to get any more clarification from Craft about this issue yet.&lt;/p&gt;&#xA;" OwnerUserId="3381" LastEditorUserId="3381" LastEditDate="2015-03-28T15:20:57.637" LastActivityDate="2015-03-28T18:18:20.090" Title="Can't remove index.php from my URLs" Tags="&lt;multi-environment&gt;&lt;index&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8536" PostTypeId="1" CreationDate="2015-03-06T04:32:06.847" Score="2" ViewCount="650" Body="&lt;p&gt;I am moving a site from EE to Craft and trying to figure out the best Craft approach to something I did with lots of php and url parameters in EE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overview: the site is a Family Counseling Clinic.  As part of their program, they have parents register as users on their site.  The parents create a profile for each of their children and then, for each child, they fill out a number of questionnaires. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic issue is how to set up these relationships, given that I am using front end forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the parent is a registered user and is creating the child profile(s) (as a channel entry), the relationship can be based on entry.authorId(theParent).  No problem there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between child and forms is where I am looking for a Crafty solution.  One obvious approach is to use Structure for the child profiles and have the questionnaires as a &quot;child entries&quot;.  The other possibility that occurs to me is to use an Entries field in a Questionnaire channel that is tied to Child channel entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases the question is whether it is possible to do either one of those using a front end form, which would either require setting the parent entry for the Structure solution or the Entry field for the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this is clear, and thanks for any suggestions! &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2015-03-06T10:53:54.333" Title="Setting User field type from a front end form" Tags="&lt;relations&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8537" PostTypeId="2" ParentId="8534" CreationDate="2015-03-06T07:39:58.097" Score="2" Body="&lt;p&gt;The image data is not going to be in POST variable. You should be using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userPhoto = UploadedFile::getInstanceByName('userPhoto');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastActivityDate="2015-03-06T07:39:58.097" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8538" PostTypeId="1" AcceptedAnswerId="8540" CreationDate="2015-03-06T09:38:53.087" Score="3" ViewCount="1351" Body="&lt;p&gt;I need to loop through the 6 latest entries from 3 different structures. The problem is, the entries are located on different levels. One of the structures has entries on level 3, and the other two has entries on level 1.&lt;/p&gt;&#xA;" OwnerUserId="874" LastEditorUserId="874" LastEditDate="2015-03-06T09:45:54.060" LastActivityDate="2015-03-06T09:51:31.950" Title="Getting entries from different structures and level" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8540" PostTypeId="2" ParentId="8538" CreationDate="2015-03-06T09:51:31.950" Score="5" Body="&lt;p&gt;If you explicitly need &lt;strong&gt;only&lt;/strong&gt; the entries at level 3, and those at level 1, I think combining two queries works best:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get ids for all entries from the different structures and levels #}&#xA;{% set entriesAtLevelThree = craft.entries.section('level-3-section').level(3).limit(6).ids() %}&#xA;{% set entriesAtLevelOne = craft.entries.section(['level-1-section-1', 'level-1-section-2']).level(1).limit(6).ids() %}&#xA;&#xA;{# Combine those IDs #}&#xA;{% set entryIdsCombined = entriesAtLevelThree | merge(entriesAtLevelOne) %}&#xA;&#xA;{# Get all entries (so, no IDs this time), using your IDs #}&#xA;{% set allEntries = craft.entries.id(entryIdsCombined).limit(6).order('postDate DESC') %}&#xA;&#xA;{% for entry in allEntries %}&#xA;    {# do your thing #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can, of course, cache this by wrapping it in &lt;code&gt;{% cache %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-03-06T09:51:31.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8541" PostTypeId="2" ParentId="8536" CreationDate="2015-03-06T10:47:54.083" Score="4" Body="&lt;p&gt;Maybe I don't quite get your problem, but I actually don't see any difference between posting child entries (the patients) related to a parent user and posting questionair entries related to a child entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need a hidden field like this for the child registristration.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% parentId = entry.authorId %}&#xA;...&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[parentUsersField][]&quot; value=&quot;{{ parentId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now link to the child entry and allow the parent to enter the questionair form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set childId = entry.id %}&#xA;...&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[childEntriesField][]&quot; value=&quot;{{ childId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that relation fields can hold multiple elements, even if set a limit in the field settings; so you need to post an array using the syntax show above. There's other more  complete code examples here on Stack Exchange for having relational fields in a from (i.e. &lt;a href=&quot;https://craftcms.stackexchange.com/q/2936/125&quot;&gt;&quot;Creating comments via a related section&quot;&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes, using a channel for the questionairs is a very flexible and clean way to structure the relation in my opinion.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-06T10:53:54.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8542" PostTypeId="1" CreationDate="2015-03-06T10:49:31.337" Score="0" ViewCount="105" Body="&lt;p&gt;I would like to make a page where different groups of users would only have access to the entries created by their own group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can create a group and give it access to a certain section, but ideally I would like all groups to edit the same section, but different entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &quot;edit other people's entries&quot; permission, but not on the group level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Never satisfied, I would ALSO like to be able to limit visibility of the entries a user cannot edit, not just whether they can be edited/deleted? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isn't a &quot;can user view this&quot; hook is there? Or a &quot;visible by X,Y,Z&quot; flag on posts I could set? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-03-06T10:49:31.337" Title="Access-rights at lower granularity than section?" Tags="&lt;user-groups&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8543" PostTypeId="2" ParentId="8520" CreationDate="2015-03-06T12:27:33.140" Score="4" Body="&lt;p&gt;You can't disable the debugging output using Twig/templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Craft will only render the debug data if your document' Content-type header is either &quot;text/html&quot; or &quot;application/xhtml+xml&quot; (&lt;a href=&quot;https://craftcms.stackexchange.com/a/2294/1098&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that if you're outputting JSON, you can set the template's Content-type to &quot;application/json&quot; (using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tags#header&quot; rel=&quot;nofollow noreferrer&quot;&gt;header tag&lt;/a&gt;), preventing Craft from dumping the debug data to the response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-03-06T12:27:33.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8545" PostTypeId="1" AcceptedAnswerId="8604" CreationDate="2015-03-06T16:56:45.490" Score="4" ViewCount="2537" Body="&lt;p&gt;Rather than render content out as HTML, I need to create PDFs for a project I'm working on. I was planning on using &lt;a href=&quot;http://www.tcpdf.org/&quot; rel=&quot;nofollow&quot;&gt;TCPDF&lt;/a&gt; in a custom plugin, but having played around with it a little, it does seem very limited it terms of the HTML/CSS you can throw at it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any better solutions out there? It can either be PHP based or maybe Javascript instead.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2018-08-15T15:49:23.240" Title="Create Plugin to generate PDF files from content" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8546" PostTypeId="2" ParentId="8545" CreationDate="2015-03-06T17:51:39.530" Score="3" Body="&lt;p&gt;Maybe this one could help you: &lt;a href=&quot;https://printmaker.docs.topshelfcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Printmaker&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="142" LastEditDate="2018-08-15T15:49:23.240" LastActivityDate="2018-08-15T15:49:23.240" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8547" PostTypeId="1" AcceptedAnswerId="8548" CreationDate="2015-03-06T18:22:08.610" Score="1" ViewCount="40" Body="&lt;p&gt;I have a section of type structure where I need the url to be /5minutes. I cannot make this work (note that I have changed the handle to fiveminutes. But everything I would like to be 5minutes. I even tried setting a route for 5minutes. My question then is this. Is is simply not possible to begin a route or section with a numerical value?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-03-06T18:51:46.763" Title="Starting a section with a number" Tags="&lt;structure&gt;&lt;sections&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8548" PostTypeId="2" ParentId="8547" CreationDate="2015-03-06T18:51:46.763" Score="1" Body="&lt;p&gt;A section can't have a handle that &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/validators/HandleValidator.php#L22&quot; rel=&quot;nofollow&quot;&gt;starts with a number&lt;/a&gt;, but there is nothing stopping you from using &lt;code&gt;fiveminutes&lt;/code&gt; for the section's handle and setting the section's URL Format to &lt;code&gt;5minutes/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-06T18:51:46.763" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8549" PostTypeId="2" ParentId="8535" CreationDate="2015-03-06T23:10:49.977" Score="4" Body="&lt;p&gt;These are the settings I have in place for config.php and .htaccess file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hBEt8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ukguu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2015-03-06T23:10:49.977" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8550" PostTypeId="1" AcceptedAnswerId="8553" CreationDate="2015-03-07T01:16:46.253" Score="3" ViewCount="743" Body="&lt;p&gt;I'm building a custom plugin and need to have a publicly accessible (non-CP) route as part of the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I've read I can use &lt;code&gt;registerSiteRoutes()&lt;/code&gt; to register non-CP routes within my plugin. However, I'm getting a 404 when I do this. Here's my setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;  class MyPlugin extends BasePlugin {&#xA;&#xA;    ...&#xA;&#xA;    public function registerSiteRoutes() {&#xA;      return array(&#xA;        'myroute'           =&amp;gt; array('action' =&amp;gt; 'myplugin/access/index')&#xA;      );&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin_AccessController.php&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Portal_AccessController extends BaseController {&#xA;&#xA;  protected $allowAnonymous = true;&#xA;&#xA;  public function index() {&#xA;&#xA;    $templatesPath = craft()-&amp;gt;path-&amp;gt;pluginsPath().'myplugin/templates/site/';&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($templatesPath);&#xA;&#xA;    $this-&amp;gt;renderTemplate('index');&#xA;&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have setup a basic template at &lt;code&gt;/plugins/myplugin/templates/site/index.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hitting &lt;code&gt;mydomain.com/myplugin&lt;/code&gt; results in a 404. Am I thinking of this correctly? Is it possible to have a non-CP route that points to a controller method in my plugin?&lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="476" LastEditDate="2015-03-07T01:52:09.757" LastActivityDate="2015-03-07T09:12:12.323" Title="Non-CP routes in plugins" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8552" PostTypeId="2" ParentId="8524" CreationDate="2015-03-07T08:07:31.230" Score="2" Body="&lt;p&gt;An easy fix could be to define an additional route without the offset parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'articles/(?P&amp;lt;sectionId&amp;gt;\d+)' =&amp;gt; 'articles/index',&#xA;    'articles/(?P&amp;lt;sectionId&amp;gt;\d+)/(?P&amp;lt;offset&amp;gt;\d+)' =&amp;gt; 'articles/index',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you'd need to check if the offset parameter is defined, and if not, set it to 0:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ offset | default( 0 ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set offset = offset is defined ? offset : 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to solve this is by making the &lt;em&gt;offset&lt;/em&gt; segment capturing group optional, as per @carlcs' &lt;a href=&quot;https://craftcms.stackexchange.com/a/8569/1098&quot;&gt;answer&lt;/a&gt; to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8568/is-it-possible-to-define-optional-route-segments/8569#8569&quot;&gt;this question&lt;/a&gt; – in my opinion this is a bit more elegant than having two different routes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'articles/(?P&amp;lt;sectionId&amp;gt;\d+)(/(?P&amp;lt;offset&amp;gt;\d+))?' =&amp;gt; 'articles/index',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The trick here is wrapping the last segment in parentheses, appending a question mark at the end.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-08T10:45:08.847" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8553" PostTypeId="2" ParentId="8550" CreationDate="2015-03-07T08:59:05.380" Score="6" Body="&lt;p&gt;There are a couple of issues here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Any action methods in the controller class needs the &quot;action&quot; prefix to their name, i.e. &lt;code&gt;actionIndex()&lt;/code&gt; for your &quot;index&quot; action, or &lt;code&gt;actionLogin()&lt;/code&gt; for another action route calling &quot;myPlugin/access/login&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In other words, rename your &lt;code&gt;index()&lt;/code&gt; method in the controller to &lt;code&gt;actionIndex()&lt;/code&gt;, and it should work.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;For action routes, plugin handles should be written in camelcase – i.e. &quot;&lt;strong&gt;myPlugin&lt;/strong&gt;/access/index&quot;, not &quot;&lt;strong&gt;myplugin&lt;/strong&gt;/access/index&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have a minor typo in the controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$templatesPath = craft()-&gt;path-&gt;&lt;strong&gt;pluginsPath()&lt;/strong&gt;.'myplugin/templates/site/';&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;should read&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$templatesPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'myplugin/templates/site/';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Addendum: this might just be a typo in the question text, but your controller class is actually named&lt;/em&gt; &quot;Portal_AccessController&quot;&lt;em&gt;, so it will obviously not respond to the route &quot;myPlugin/access/index&quot; – the latter should read &quot;portal/access/index&quot; (or the controller should be renamed &quot;MyPlugin_AccessController)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-07T09:12:12.323" LastActivityDate="2015-03-07T09:12:12.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8554" PostTypeId="2" ParentId="2832" CreationDate="2015-03-07T15:56:49.927" Score="3" Body="&lt;p&gt;I hope you figured it out however, I just found adding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteBase /&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;right under RewriteEngine On fixed my issue.&lt;/p&gt;&#xA;" OwnerUserId="3385" LastActivityDate="2015-03-07T15:56:49.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8555" PostTypeId="2" ParentId="8535" CreationDate="2015-03-07T16:08:35.690" Score="1" Body="&lt;p&gt;I had that problem as well. Try adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteBase /&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to just under RewriteEngine On. Worked instantly for me.&lt;/p&gt;&#xA;" OwnerUserId="3385" LastActivityDate="2015-03-07T16:08:35.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8557" PostTypeId="1" AcceptedAnswerId="8560" CreationDate="2015-03-07T17:03:41.163" Score="9" ViewCount="4076" Body="&lt;p&gt;Is there another way of detecting if a page is an 'entry' or a 'category' than the following? Maybe some global variable that I do not know of?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;  &amp;lt;!-- Code here --&amp;gt;&#xA;{% endif %}&#xA;{% if category is defined %}&#xA;  &amp;lt;!-- Code here --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a html code block that is included in both entry pages and category pages hence the need for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3370" LastActivityDate="2015-11-13T00:07:28.250" Title="Detecting if page is a 'category' or 'entry'" Tags="&lt;templating&gt;&lt;entry&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8558" PostTypeId="2" ParentId="8557" CreationDate="2015-03-07T18:28:18.913" Score="6" Body="&lt;p&gt;Testing for the &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;pre-populated variables&lt;/a&gt; is probably the only way to do this. But as you're asking for a single (global) var to test against, I believe you're looking for a way to have clean, dry code in your shared code block without using your posted snippet again and again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry is defined ? entry : null %}&#xA;{% set category = category is defined ? category : null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your two variables &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; will always be defined, which allows you to have very short &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary syntax&lt;/a&gt; in your print expressions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;myDefaultClass{{ entry ? ' myEntryClass' }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another thing you could do is to set a new var &lt;code&gt;model&lt;/code&gt;, which holds either the Entry Model or the Category Model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set model = entry is defined ? entry : category is defined ? category : null %}&#xA;{% set entry = entry is defined ? entry : null %}&#xA;{% set category = category is defined ? category : null %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ model.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-11-13T00:07:28.250" LastActivityDate="2015-11-13T00:07:28.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8560" PostTypeId="2" ParentId="8557" CreationDate="2015-03-07T19:41:16.160" Score="10" Body="&lt;p&gt;It'd be nice to see an example of your HTML block. From your comments it sounds like you may be using the same HTML block for &lt;code&gt;Entry&lt;/code&gt; and &lt;code&gt;Category&lt;/code&gt; pages but need to know which variable to use in the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you know that your code is running on the Entry or Category pages, and that the fields across both your Entries and Categories for this part of the page are the same, you can place your common HTML in an include and pass both the &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; variable to that include with the same variable name.  In the example below, we're handing off the &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; variables and using the variable name &lt;code&gt;object&lt;/code&gt; in the include template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/shared-template' with { object : entry } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_category.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/shared-template' with { object : category } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_partials/shared-template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;&#xA;    {{ object.fieldName }}&#xA;&#xA;    {% for item in object.someOtherFieldName %}&#xA;      {{ item }}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If some of the field names are different, you may need to use some conditional logic or reconsider what variables are being passed to the included template.  You could pass dissimilar variables under the same variable names to a common template in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% include '_partials/shared-template' with { &#xA;        title : entry.title,&#xA;        someOtherVariable: entry.fancyFieldOne&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{% if category is defined %}&#xA;    {% include '_partials/shared-template' with { &#xA;        title : category.title,&#xA;        someOtherVariable: category.fancyFieldTwo&#xA;    } %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_partials/shared-template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;&#xA;    {{ title }}&#xA;&#xA;    {% for item in someOtherVariable %}&#xA;      {{ item }}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-03-07T19:41:16.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8561" PostTypeId="1" AcceptedAnswerId="8562" CreationDate="2015-03-07T20:05:46.643" Score="2" ViewCount="250" Body="&lt;p&gt;I'm working on a plugin where I set a variable from my template. The plugin also provides a Twig filter&#xA;that makes use of that variable. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.myPlugin.setVar('example') %}&#xA;&#xA;{# Filter appends 'example' to the entry title #}&#xA;{{ entry.title|myFilter }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing I'd like to do is to make it possible to set the variable anywhere in my template,&#xA;but still provide it to the Twig filter everywhere it is used (within that template).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title|myFilter }}&#xA;{% do craft.myPlugin.setVar('example') %}&#xA;{{ entry.body|myFilter }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, this probably is a very very stupid question and this cannot be done.&#xA;But maybe there's a chance I'm overlooking something and you can influence the parse order or do some magic to make this possible? Any answers welcome :)&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-07T22:48:46.740" Title="Influence Twig parse order?" Tags="&lt;plugin-development&gt;&lt;variable&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8562" PostTypeId="2" ParentId="8561" CreationDate="2015-03-07T22:48:46.740" Score="3" Body="&lt;p&gt;Short answer: Cannot be done :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig doesn't really have a &quot;parse order&quot;, it compiles to plain old PHP. Upon compilation, this would make your Twig snippet basically this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myVariable = 'someInitialValue';&#xA;echo $entry-&amp;gt;title . $myVariable;&#xA;$myVariable = 'example';&#xA;echo $entry-&amp;gt;title . $myVariable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, setting $myVariable to &quot;example&quot; the second time won't affect the output of the first &lt;code&gt;echo&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An obvious way of accomplishing basically the same thing, would be to wrap the whole template in a &lt;code&gt;{% set %}&lt;/code&gt; call – then your options would be many, you could for instance use placeholders and the replace filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myContent %}&#xA;   {{ entry.title | myFilter }} {# myFilter appends placeholder &quot;%myPlaceholder%&quot; to the input #}&#xA;{% endset %}&#xA;{# Echo the template, replacing the placeholders with whatever #}&#xA;{{ myContent | replace( { &quot;%myPlaceholder%&quot;, craft.myPlugin.getVar } ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get that this is not what you really want though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;really&lt;/em&gt; want to get your hands dirty you can see if you can find a way to manipulate the &lt;a href=&quot;http://twig.sensiolabs.org/doc/internals.html&quot; rel=&quot;nofollow&quot;&gt;Twig internals&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can access the Twig instance in your plugin via the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService&quot; rel=&quot;nofollow&quot;&gt;TemplatesService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$twig = craft()-&amp;gt;templates-&amp;gt;twig;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess that one way to achieve what you want is to write your own &lt;a href=&quot;https://github.com/twigphp/Twig/blob/master/lib/Twig/Lexer.php&quot; rel=&quot;nofollow&quot;&gt;Lexer&lt;/a&gt; – fairly ambitious stuff for doing something easily done by extends, embeds or by output buffering/set and replace as per my example above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other concepts to look at (which may or may not be useful to your quest!) are &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;Template hooks&lt;/a&gt;, &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#globals&quot; rel=&quot;nofollow&quot;&gt;global Twig variables&lt;/a&gt;, &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/embed.html&quot; rel=&quot;nofollow&quot;&gt;template embedding&lt;/a&gt; or &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/template_from_string.html&quot; rel=&quot;nofollow&quot;&gt;Twig's StringLoader extension&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I'm quite curious about the actual use case here. If you'd care to elaborate, I'd love to know &lt;em&gt;why&lt;/em&gt; you need/want to do this.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-07T22:48:46.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8564" PostTypeId="2" ParentId="8529" CreationDate="2015-03-07T23:33:42.887" Score="4" Body="&lt;p&gt;You could use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set files = craft.entries.section(&quot;downloads&quot;) | group('fileDate.year'} %}&#xA;{% set dropdown = false %}&#xA;&#xA;{% for year, filesInYear in files %}&#xA;    {% if filesInYear|length &amp;gt; 1 %}&#xA;        {% set dropdown = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-03-07T23:33:42.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8565" PostTypeId="2" ParentId="1555" CreationDate="2015-03-08T07:14:27.090" Score="2" Body="&lt;p&gt;I needed a 10 minute increment. From the CP side, you can just ignore the dropdown and type in the minutes to override. From frontend forms this is not an issue because you can do whoever you want with your own jquery.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-03-08T07:14:27.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8566" PostTypeId="1" AcceptedAnswerId="8578" CreationDate="2015-03-08T10:00:14.200" Score="1" ViewCount="112" Body="&lt;p&gt;In our Craft Pro site we've enabled public registrations and allow anyone to create an account and make entries in a &quot;blog&quot; channel.  These entries are then filtered via URL segments - so /blog/ will show a listing of entries by each user.  A user can create different entry types (video/audio/text/etc) which are handled by different templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to add the ability for a user to &quot;reblog&quot; or &quot;repost&quot; another user's entry - I'm not sure of the best way to do that though.  The ideas I've had are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a new entry type (reblog), with a field that stores a reference to the original entry ID and allows the user to add a comment&lt;/li&gt;&#xA;&lt;li&gt;Use a custom plugin to create an entry as above&lt;/li&gt;&#xA;&lt;li&gt;Clone the original entry data into a new entry and allow the user to edit it&lt;/li&gt;&#xA;&lt;li&gt;Create a new channel for reblogs which the user doesn't have permission to post to via the CP, and try to hack around that using a plugin and frontend forms&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My issue is that, for usability reasons, I'd very much prefer to hide the original entry ID reference field (if this is handled through the CP) but I don't know if that's possible?  We're relying entirely on the CP for creating entries at the moment, so it'd be a bit clunky if we moved the handling of reposts to a separate section of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if I simply reference the original entry ID in a field, while it would be cleaner than cloning the original entry's content (assets/etc) and creating a new post for the current user, I'll most likely still have to create a new entry type (reblog) to house the new post, which would then appear in the &quot;Entry Type&quot; dropdown when accessing the create entry page, which would be pretty confusing to the end user, unless I made the original entry ID some kind of custom FieldType with a live-search sort of feature?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm beginning to think that perhaps the best way is to handle this through a plugin / frontend form, but that feels super hacky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how best to approach this issue?  I'm totally open to any and all ideas!  &lt;/p&gt;&#xA;" OwnerUserId="3386" LastActivityDate="2015-03-08T23:55:14.187" Title="Multi-user blog &quot;repost entry&quot; functionality" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8567" PostTypeId="2" ParentId="2594" CreationDate="2015-03-08T10:05:09.823" Score="2" Body="&lt;p&gt;Old Question I know, but kept coming across it and I've been digging around as I had the same use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards, to Q1; if you don't give the user's group permission to publish live changes, their new entries will go in as disabled entries (Not a draft, but disabled entries ready for moderation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the admin approves, the entry will be open and the user will not be able to update it. (They receive a permission denied message) You can however use the code as Fred posted to send the action to &lt;code&gt;entryRevisions/saveDraft&lt;/code&gt; and that will store a proper 'draft' in Craft, without affecting the live entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not documented, but after poking around I found and tested a way of retrieving drafts by entry ID on the front-end;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set drafts = craft.entryRevisions.getDraftsByEntryId(229) %}&#xA;&#xA;{% for draft in drafts %}&#xA;    &amp;lt;h2&amp;gt;{{ draft.title }}&amp;lt;/h2&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then check for existing drafts and prevent the user submitting further changes until the draft has been approved/deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone will find this useful!&lt;/p&gt;&#xA;" OwnerUserId="13" LastActivityDate="2015-03-08T10:05:09.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8568" PostTypeId="1" AcceptedAnswerId="8569" CreationDate="2015-03-08T10:13:24.963" Score="2" ViewCount="663" Body="&lt;p&gt;Is it possible to have optional route segments/variables with getCpRoutes() and getSiteRoutes()?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the following route to work, even if the URI only contains one segment (&quot;myplugin&quot;) rather than two (&quot;myplugin/somevalue&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;myplugin/(?P&amp;lt;myVariable&amp;gt;[-\w]+)&quot; =&amp;gt; array( &quot;action&quot; =&amp;gt; &quot;myPlugin/myAction&quot; )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would the regexp look? Is it even possible, or do I need another route pointing to the same action, but omitting the &lt;em&gt;myVariable&lt;/em&gt; segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is kind of a follow up to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8524/route-that-should-be-matching-numbers-not-matching-a-zero/8552#8552&quot;&gt;Route that should be matching numbers not matching a zero?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-08T10:34:26.953" Title="Is it possible to define optional route segments?" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8569" PostTypeId="2" ParentId="8568" CreationDate="2015-03-08T10:34:26.953" Score="4" Body="&lt;p&gt;You can make a capturing group optional, simply append &lt;code&gt;?&lt;/code&gt; to it. In this case you'd need to add an additional group that includes the backslash and make it optional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;myplugin(/(?P&amp;lt;myVariable&amp;gt;[-\w]+))?&quot; =&amp;gt; array(&quot;action&quot; =&amp;gt; &quot;myPlugin/myAction&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-08T10:34:26.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8570" PostTypeId="1" AcceptedAnswerId="8572" CreationDate="2015-03-08T13:22:49.910" Score="1" ViewCount="2005" Body="&lt;p&gt;I have this &lt;a href=&quot;http://getuikit.com/docs/slideshow.html&quot; rel=&quot;nofollow&quot;&gt;slideshow&lt;/a&gt; implementing to entries, which works except Dot navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A count of Dots in navigations depends on manually inputing attributes and assigning &#xA;numbers from 0...∞ ascendingly like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li data-uk-slideshow-item=&quot;0&quot;&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li data-uk-slideshow-item=&quot;1&quot;&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li data-uk-slideshow-item=&quot;2&quot;&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually, I &lt;code&gt;limit(3)&lt;/code&gt; count of entries, so I know that there will be a certain number of dots. However, If there aren't any entries defined or only 1 entry defined, than I always get all three dots appeared, which don't function. So there MUST to be the exact number of dots as entries. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 Entry: 1 Dot&lt;/li&gt;&#xA;&lt;li&gt;2 Entires: 2 Dots&lt;/li&gt;&#xA;&lt;li&gt;3 Entries: 3 Dots&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I'm thinking to go with &lt;code&gt;if&lt;/code&gt; condition or loop through entries, but with my attribute output with number increased by 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I've started with &lt;code&gt;if&lt;/code&gt;, because no need to loop ... and I don't know, if this is right way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Display navigation if the condition is true #}&#xA;{% if craft.entries.section('handle').lightswitchHandle('1') is defined %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{# This is where I end up ... some comparission filter maybe ? #}&#xA;{% if craft.entries.section('handle').lightswitchHandle('1') %}&#xA;  &amp;lt;li data-uk-slideshow-item=&quot;0&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;    &#xA;{% elseif craft.entries.section('handle').lightswitchHandle('1') %}&#xA;  &amp;lt;li data-uk-slideshow-item=&quot;1&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;    &#xA;{% endif %} &#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;food-slideshow&quot; class=&quot;uk-switcher&quot;&amp;gt;&#xA;&amp;lt;div data-uk-slideshow&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;a href=&quot;&quot; data-uk-slideshow-item=&quot;previous&quot;&amp;gt;p&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;a href=&quot;&quot; data-uk-slideshow-item=&quot;next&quot;&amp;gt;n&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&#xA;    {# Get the slides, store in variable called &quot;slides&quot; #}&#xA;    {% set slides = craft.entries.section('food').news('1').limit(3) %}&#xA;&#xA;    {% if slides %}&#xA;        &amp;lt;ul class=&quot;uk-slideshow&quot;&amp;gt;&#xA;        {# Output slides, using the same &quot;slides&quot; variable #}    &#xA;        {# Loop through &quot;news&quot; with lightswitch on #}&#xA;        {% for slide in slides %}&#xA;            {# Entry type - Article #}&#xA;            {% if slides.type == 'article' %}&#xA;                {% include '_includes/components/food/news-article' %}&#xA;            {# Entry type - Person #}   &#xA;            {% elseif slides.type == 'person' %}&#xA;                {% include '_includes/components/food/news-person' %}&#xA;            {# Entry type - Recipe #}&#xA;            {% elseif slides.type == 'recipe' %}&#xA;                {% include '_includes/components/food/news-recipe' %}&#xA;            {% endif %}&#xA;            {% else %}&#xA;                &amp;lt;p&amp;gt;Any Text&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% if craft.entries.section('food').news('1') is defined %}&#xA;{# Output navigation, check length of &quot;slides&quot; variable #}&#xA;&amp;lt;ul class=&quot;uk-dotnav uk-dotnav-contrast uk-position-bottom uk-text-center&quot;&amp;gt;&#xA;     {% for i in 1..slides | length %}&#xA;         &amp;lt;li data-uk-slideshow-item=&quot;{{ i }}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;     {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;  &lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-03-08T20:24:56.813" LastActivityDate="2017-08-26T13:48:58.090" Title="Creating a slideshow with dots navigation" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8571" PostTypeId="1" CreationDate="2015-03-08T13:38:03.503" Score="14" ViewCount="1615" Body="&lt;p&gt;The recent updates to categories have been great and provide a lot of flexibility.  But now I find myself struggling to decide what should be a category group and what should be a structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example we are working on a site where a lot of the content will be segmented by city.  Originally I had just assumed that cities would be a entry section but now feeling like categories make more sense semantically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is what are the functional differences between categories and structures?  As far as I can tell they are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The category fieldtype does not let you reorder the selected categories, the way you can with related entries field.  They always stay in the category groups order&lt;/li&gt;&#xA;&lt;li&gt;Categories don't have a post date or expiration date&lt;/li&gt;&#xA;&lt;li&gt;Categories don't have authors&lt;/li&gt;&#xA;&lt;li&gt;Categories don't have versioning&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there any other important differences I should consider? It seems like the only advantages are that they get their own tab, and that the ordering is consistant across all related entries&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="142" LastEditDate="2015-03-17T12:37:20.610" LastActivityDate="2016-12-05T19:42:40.533" Title="Difference between categories and structures" Tags="&lt;categories&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8572" PostTypeId="2" ParentId="8570" CreationDate="2015-03-08T15:27:34.987" Score="4" Body="&lt;p&gt;First, store your slides in a variable when you fetch them using &lt;code&gt;craft.entries&lt;/code&gt;. Then, you can use the &lt;code&gt;length&lt;/code&gt; property of that variable (which will be equal to the number of slides) to output your dots/navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the slides, store in variable called &quot;slides&quot; #}&#xA;{% set slides = craft.entries.section( 'yourSlideSection' ).limit( 3 ) %}&#xA;&#xA;{% if slides %}&#xA;&amp;lt;ul class=&quot;slideshow&quot;&amp;gt;&#xA;&#xA;    {# Output slides, using the same &quot;slides&quot; variable #}&#xA;    {% for slide in slides %}&#xA;    &amp;lt;li class=&quot;slide&quot;&amp;gt;[Your slide content here]&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if craft.entries.section('handle').lightswitchHandle('1') is defined %}&#xA;    {# Output navigation, check length of &quot;slides&quot; variable #}&#xA;    &amp;lt;ul class=&quot;nav&quot;&amp;gt;&#xA;         {% for i in 0..slides | length - 1 %}&#xA;         &amp;lt;li data-uk-slideshow-item=&quot;{{ i }}&quot;&amp;gt;&#xA;              &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;         {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the inner navigation loop does here, is to increment the variable &lt;code&gt;i&lt;/code&gt; by one, each time the loop runs, until &lt;code&gt;i&lt;/code&gt; is equal to the number of slides (&lt;code&gt;slides | length&lt;/code&gt;). This means you'll always have exactly the same number of dots as slides. Inside the loop, the variable &lt;code&gt;i&lt;/code&gt; is also used for the data attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot; rel=&quot;nofollow&quot;&gt;More on the Twig loop function here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-16T11:58:30.817" LastActivityDate="2015-03-16T11:58:30.817" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="8573" PostTypeId="1" AcceptedAnswerId="8577" CreationDate="2015-03-08T21:47:45.977" Score="1" ViewCount="190" Body="&lt;p&gt;I'm looking for the best way to deal with long lists of items. In this case a subsite is a council library area which must publish a list of new books each month. In a perfect world I would suck this from the library catalogue directly, but that isn't going to happen just yet, so I need a medium term workaround. I also have other similar data lists to manage so need to have some solutions up my sleeve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would have 50-100 list items manually added each month. Each item would consist of Book Title, Author, Some sort of ID number used in a link, and keys to the month (not necessarily published month) and type (e.g. non-fiction, fiction etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of half a dozen ways to do this, but of course am seeking one that is efficient both from a data entry point of view, but also from a system and performance point of view. Ways of doing it might include (just from a brainstorming point of view):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use a channel with each book being an entry (with fields for month and type)&lt;/li&gt;&#xA;&lt;li&gt;Use a channel with each month being an entry and a matrix field for each book&lt;/li&gt;&#xA;&lt;li&gt;Upload the monthly book list as an asset (XML or JSON) and display from there&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The last one is the most appealing if I can work out how to get a non technical website content manager creating files in the right format (Excel should work for this). It also seems a short step from there to using a library catalogue system generated file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not quite up to writing my own plugin just yet, but perhaps it's time for me to learn.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-03-09T00:15:44.077" Title="Dealing with long lists of items" Tags="&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8574" PostTypeId="1" AcceptedAnswerId="9903" CreationDate="2015-03-08T23:19:31.710" Score="9" ViewCount="3468" Body="&lt;p&gt;is it somehow possible to conditionally show or hide fields in the entry editor based on the value of another previously entered field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of this use would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A section has Lightswitch field &quot;hasVideo&quot;&lt;/li&gt;&#xA;&lt;li&gt;User is populating a new entry for this section and sets &quot;hasVideo&quot; to the value of choice.&lt;/li&gt;&#xA;&lt;li&gt;If user sets hasVideo to true, show a text field &quot;productVideo&quot; so that the user can set a link to a youtube video, but hide assets field &quot;productImage&quot;.&lt;/li&gt;&#xA;&lt;li&gt;If user sets hasVideo to false, how Assets field &quot;productImage&quot; so that the user can upload an image, but hide &quot;productVideo&quot; field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This would really help from a usability perspective since the client will only be shown the fields that need to be filled based on what was filled earlier on - creating a sort of entry creation &quot;wizard&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally there might be an alternative route to achieve the same level of usability that I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="3370" LastActivityDate="2018-12-04T00:44:51.880" Title="&quot;Conditional&quot; field layout - hiding or showing fields based on another field" Tags="&lt;field&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8575" PostTypeId="1" CreationDate="2015-03-08T23:22:53.093" Score="1" ViewCount="5927" Body="&lt;p&gt;Our developer hasn't been able to recover his password for the account he used to setup the site, and now he's non-responsive. The site is on my server and I have full access, but his account is the only one we setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're not able to add new companies until we can either recover the account or setup a new one.&lt;/p&gt;&#xA;" OwnerUserId="3388" LastEditorUserId="45" LastEditDate="2015-03-09T05:46:49.757" LastActivityDate="2016-11-15T23:39:41.330" Title="Recovering (or creating a new) admin account" Tags="&lt;users&gt;&lt;admin&gt;&lt;password&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8576" PostTypeId="2" ParentId="8574" CreationDate="2015-03-08T23:37:50.033" Score="5" Body="&lt;p&gt;No, Craft doesn't offer conditionals in field layouts. Coming from Wordpress/ACF, I'd personally like to see something like that implemented in the future, but for now I can think of two possible workarounds for your specific scenario:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Set up two different &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;noreferrer&quot;&gt;Entry Types&lt;/a&gt; for your &quot;products&quot; section, e.g. &quot;Video&quot; and &quot;Image&quot;. Design identical field layouts for the two, apart from including the field &quot;productVideo&quot; for the former, and &quot;productImage&quot; for the latter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use only one entry type, but replace the &quot;productVideo&quot; and &quot;productImage&quot; fields with a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;noreferrer&quot;&gt;Matrix field&lt;/a&gt; called &quot;productMedia&quot; or the like. Set up two block types for the Matrix field; one for &quot;productVideo&quot;, and one for &quot;productImage&quot;. Limit the Matrix field to maximum one block.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-08T23:37:50.033" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8577" PostTypeId="2" ParentId="8573" CreationDate="2015-03-08T23:53:25.917" Score="2" Body="&lt;p&gt;I'd probably prefer to create the data using Craft's control panel UI for tags (→ book type) and dates than typing it all into Excel. So if it was me, I would probably vote for option a or b.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There shouldn't be that much of a speed differences between creating matrix rows or adding new entries for the data entry (there's this nice shortcut for &quot;Save entry and create new one&quot;), so my advice is to keep it simple and use a channel. Besides good performance (no relationship queries etc.), other advantages over matrix rows is to view and sort the books nicely in the CPs index view (customizable since Craft 2.3) or use the default disable switch (with traffic lights on the index view).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives your client a nice and flexible UI today and you can start developing a custom plugin that gets their system data into Craft. Even with that future solution it could make sense to have the entries available in Craft, to add website only data or make relations to other entries for example, and your plugin will be more of a custom import solution than a simple view to the external API data.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-09T00:15:44.077" LastActivityDate="2015-03-09T00:15:44.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8578" PostTypeId="2" ParentId="8566" CreationDate="2015-03-08T23:55:14.187" Score="0" Body="&lt;p&gt;I think it's going to be a lot easier if you go the custom plugin route with your own &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;front-end forms&lt;/a&gt; for everything.  Not hacky at all!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-08T23:55:14.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8579" PostTypeId="2" ParentId="8575" CreationDate="2015-03-09T00:10:18.100" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Download and install a fresh copy of Craft from &lt;a href=&quot;http://buildwithcraft.com&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com&lt;/a&gt; somewhere (doesn't matter if it's the same computer your existing site is on or not).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;During installation, remember the password you entered when setting up the user.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open the database and look in the &lt;code&gt;craft_users&lt;/code&gt; table. Copy what's in the &lt;code&gt;password&lt;/code&gt; column for the user that the installer created over to the &lt;code&gt;password&lt;/code&gt; column in the &lt;code&gt;craft_users&lt;/code&gt; table for the site you're trying to recover.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the &lt;code&gt;locked&lt;/code&gt;, &lt;code&gt;suspended&lt;/code&gt;, &lt;code&gt;pending&lt;/code&gt; or &lt;code&gt;archived&lt;/code&gt; columns have &lt;code&gt;1&lt;/code&gt; in them, set them to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;code&gt;lockoutDate&lt;/code&gt; and/or &lt;code&gt;lastInvalidLoginDate&lt;/code&gt; have values in them, delete them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Login to the site you're trying to recover with the password you created in #2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-09T00:10:18.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8580" PostTypeId="1" AcceptedAnswerId="8592" CreationDate="2015-03-09T01:21:13.137" Score="0" ViewCount="169" Body="&lt;p&gt;This two-part question is half an exact duplicate of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1578/how-do-you-display-a-users-user-group&quot;&gt;How do you display a user&amp;#39;s User Group?&lt;/a&gt; but I'm unable to leave a comment :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to display &amp;amp; check-for the user group a user belongs to on a public profile page. There are coaches and players.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL structure is &lt;code&gt;domain.com/coaches/johnnyappleseed&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Copying the exact example code given in the original question (link above) seems to just return the User's full name, not the group the user belongs to. What could I be missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if johnnyapplseed is a coach, I can still access his profile page by going to &lt;code&gt;domain.com/players/johnnyappleseed&lt;/code&gt; which is why I'm trying to check for the usergroup to begin with. Is checking for the usergroup in each player &amp;amp; coach profile template the correct way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I've attached a screenshot of all the information I think could possibly be relevant. This has to be something simple I'm overlooking!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3CtYV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-03-13T20:48:27.120" Title="Display &amp; check-for User Group on public profile" Tags="&lt;user-groups&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8581" PostTypeId="2" ParentId="44" CreationDate="2015-03-09T05:29:53.380" Score="9" Body="&lt;p&gt;I've created a plugin which makes it incredibly easy to add language-switching links to your website...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-languagelink&quot; rel=&quot;nofollow noreferrer&quot;&gt;Language Link plugin for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h3&gt;Standard Usage&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Add this to your &lt;code&gt;_layout&lt;/code&gt;, or create a separate template to &lt;code&gt;include&lt;/code&gt; in each page:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = null %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.languageLink.url('en', entry) }}&quot;&amp;gt;English&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.languageLink.url('es', entry) }}&quot;&amp;gt;Español&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.languageLink.url('fr', entry) }}&quot;&amp;gt;Français&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ craft.languageLink.url('de', entry) }}&quot;&amp;gt;Deutsch&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This plugin is based on the code I originally &lt;a href=&quot;https://craftcms.stackexchange.com/a/8533/45&quot;&gt;shared here&lt;/a&gt;, taking into account the feedback received from carlcs on that thread. If an entry exists, the plugin will use the proper slug from each locale of an entry (or category, or any other element type). Otherwise, it will simply share the page URI between locales.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-03-09T05:29:53.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8582" PostTypeId="1" AcceptedAnswerId="8583" CreationDate="2015-03-09T08:30:06.893" Score="3" ViewCount="257" Body="&lt;p&gt;I'm trying to create a category through the api to import a load of datas,&#xA;but I'm stuck, the category won't be saved, and the saveCategory() method just returns &lt;em&gt;false&lt;/em&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$category = new CategoryModel();&#xA;$category-&amp;gt;setContentFromPost(array(&#xA;    'groupId'       =&amp;gt;  $this-&amp;gt;category_group_id,&#xA;    'title'         =&amp;gt;  $data[0],&#xA;    'colorCode'     =&amp;gt;  $data[1],&#xA;    'colorPreview'  =&amp;gt;  $data[2]&#xA;));&#xA;$category-&amp;gt;enabled = true;&#xA;$res = craft()-&amp;gt;categories-&amp;gt;saveCategory($category);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can I get a glimpse of what's happening, or the error ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything wrong in this code ?&#xA;Does anyone have a good example/documentation for this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-03-09T10:29:25.787" Title="Saving Category through API" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8583" PostTypeId="2" ParentId="8582" CreationDate="2015-03-09T10:29:25.787" Score="5" Body="&lt;p&gt;You can get any validations errors on the category after you've attempted to save it with &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#getAllErrors-detail&quot;&gt;&lt;code&gt;CategoryModel::getAllErrors()&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel#getErrors-detail&quot;&gt;&lt;code&gt;\CModel::getErrors()&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're also setting the &lt;code&gt;groupId&lt;/code&gt; on the Category's &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ContentModel&quot;&gt;&lt;code&gt;ContentModel&lt;/code&gt;&lt;/a&gt;, but this property is actually on the Category record itself as it sets the relationship directly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$category = new CategoryModel();&#xA;$category-&amp;gt;groupId = $this-&amp;gt;category_group_id;&#xA;&#xA;$category-&amp;gt;SetContentFromPost(array(&#xA;    'title' =&amp;gt; $data[0],&#xA;    'colorCode' =&amp;gt; $data[1],&#xA;    'colorPreview' =&amp;gt; $data[2],&#xA;));&#xA;&#xA;if (craft()-&amp;gt;categories-&amp;gt;saveCategory($category))&#xA;{&#xA;    return true;&#xA;}&#xA;else&#xA;{&#xA;    // dump the error messages&#xA;    Craft::dd($category-&amp;gt;getAllErrors());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-09T10:29:25.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8584" PostTypeId="1" AcceptedAnswerId="8585" CreationDate="2015-03-09T12:04:02.640" Score="1" ViewCount="1048" Body="&lt;p&gt;I want to order entries in an &quot;Entries field&quot; by the order I added them to the field. So Anastasia would be first and Beni would be last.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9fjbH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only idea was &lt;code&gt;.fixedOrder&lt;/code&gt; like you would do it with an asset field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('musiker').relatedTo(entry).fixedOrder(true) %}&#xA;   {{ entry.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that does nothing.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-03-09T12:57:04.870" Title="Order &quot;Entries Fields&quot; by entry order" Tags="&lt;ordering&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8585" PostTypeId="2" ParentId="8584" CreationDate="2015-03-09T12:36:54.930" Score="2" Body="&lt;p&gt;Looking at your screenshot it seems like you just want to list entries straight from the entries field. If that's the case, you won't need to use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo param&lt;/a&gt;. Give this code a try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.fieldHandle %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-03-09T12:36:54.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8586" PostTypeId="2" ParentId="8584" CreationDate="2015-03-09T12:57:04.870" Score="3" Body="&lt;p&gt;It's &lt;code&gt;order('sortOrder')&lt;/code&gt; instead of &lt;code&gt;fixedOrder(true)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    relatedTo: { sourceElement: entry, field: 'entriesFieldHandle' },&#xA;    order: 'sortOrder',&#xA;    limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't make any further modifications to the params (i.e. reverse order, other limit) there's also the short syntax for the above that Jamie already suggested:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry. entriesFieldHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-09T12:57:04.870" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8587" PostTypeId="1" AcceptedAnswerId="8588" CreationDate="2015-03-09T13:47:06.447" Score="1" ViewCount="872" Body="&lt;p&gt;From within a plugin, I’m trying to filter users by a custom field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An external post request will supply a variable which I want to match the custom field to. I then want to respond to that request with other user custom fields as JSON. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the incoming post contains customHandle1=A, I then find all the users where customHandle1=A and return customHandle2 and customHandle3 data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that?&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2015-03-09T14:15:39.857" LastActivityDate="2015-03-09T14:30:16.700" Title="Filter users by a custom field?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8588" PostTypeId="2" ParentId="8587" CreationDate="2015-03-09T14:30:16.700" Score="4" Body="&lt;p&gt;To get a user by a custom field, you would need to create a ElementCriteriaModel like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;fieldName = craft()-&amp;gt;request-&amp;gt;getPost('fieldName');&#xA;&#xA;$users = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you could then loop over $users and use getAttributes() to get the user data, and if you need the attribute names use attributeNames() if you need the users fields. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-03-09T14:30:16.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8589" PostTypeId="1" AcceptedAnswerId="8609" CreationDate="2015-03-09T15:34:06.060" Score="2" ViewCount="799" Body="&lt;p&gt;I`ve got a multilingual site (DE/EN) with a Structures section (pages) and one Single for the homepage.&lt;/p&gt;&#xA;&lt;p&gt;In general.php I set up my localized site as described in the docs for a multi-environment config. German at the top level; English from en/ subfolder:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'domain.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'de' =&amp;gt; 'http://domain.dev/',&#xA;        'en' =&amp;gt; 'http://domain.dev/en/',&#xA;    ),&#xA;),  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Within my public html folder I copied .htaccess and index.php to en/ and added define('CRAFT_LOCALE', 'en'); to index.php&lt;/p&gt;&#xA;&lt;p&gt;Navigating to &lt;strong&gt;domain.dev&lt;/strong&gt; shows the german pages:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Seite 1&lt;/li&gt;&#xA;&lt;li&gt;Seite 2&lt;/li&gt;&#xA;&lt;li&gt;Seite 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Changing the URL manually to &lt;strong&gt;domain.dev/en/&lt;/strong&gt; shows their right translations&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Page 1&lt;/li&gt;&#xA;&lt;li&gt;Page 2&lt;/li&gt;&#xA;&lt;li&gt;Page 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and also their right links, e.g. &lt;a href=&quot;http://domain.dev/en/page-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.dev/en/page-1&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;BUT following the link to &lt;strong&gt;domain.dev/en/page-1&lt;/strong&gt; the german content shows up again and the &lt;strong&gt;navigation switches back to german&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('pages').level(1) %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for page in pages %}&#xA;            &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Going to any other english page (e.g. domain.dev/en/page-2) doesn't show up the english content (a translatable field) at all but neither the german content. So I think there is something wrong with my localization setup. Any ideas? Thanks much!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;UPDATE&lt;/h3&gt;&#xA;&lt;p&gt;I set up a new craft installation and also a Localized Site as described in the docs.&#xA;When defining the site URLs this way everything &lt;strong&gt;works like a charm&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'de' =&amp;gt; 'http://craft.dev/',&#xA;        'en' =&amp;gt; 'http://craft.dev/en/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in combination with my &lt;strong&gt;multi-environment config&lt;/strong&gt; it &lt;strong&gt;is not working&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'craft.dev' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'de' =&amp;gt; 'http://craft.dev/',&#xA;            'en' =&amp;gt; 'http://craft.dev/en/',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So I think my config is missing something to transmit the locale the right way?&lt;/p&gt;&#xA;&lt;p&gt;Is there another way to set up a localized site with multi-environment config?&lt;/p&gt;&#xA;" OwnerUserId="136" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-03-10T23:26:22.130" Title="Problems with Localized Site Navigation" Tags="&lt;localization&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8590" PostTypeId="1" AcceptedAnswerId="8591" CreationDate="2015-03-09T16:50:42.297" Score="1" ViewCount="162" Body="&lt;p&gt;When I get a CategoryGroup with the following  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$category = craft()-&amp;gt;categories-&amp;gt;getGroupByHandle('productEnvironment');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I Just can't figure out how to get the categories inside this category.&lt;br&gt;&#xA;Is-there any kind of relation/method ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-03-09T17:40:26.993" Title="Get all categories from a CategoryGroupModel through API" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8591" PostTypeId="2" ParentId="8590" CreationDate="2015-03-09T17:40:26.993" Score="1" Body="&lt;p&gt;I've found that it was not the best way to to it.&lt;br&gt;&#xA;I used the following code and it cleared my problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'productEnvironment';&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;foreach ($entries as $entry) {&#xA;    echo $entry-&amp;gt;title . '&amp;lt;br&amp;gt;';&#xA;    echo $entry-&amp;gt;mountingPreview[0] . '&amp;lt;br&amp;gt;'; // Dirty get the first assets&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-03-09T17:40:26.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8592" PostTypeId="2" ParentId="8580" CreationDate="2015-03-09T18:20:01.397" Score="2" Body="&lt;p&gt;If you know the user will only belong to one group, something like this should do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.username(craft.request.getSegment(2)).first() %}&#xA;&#xA;{# make sure we found a user %}&#xA;{% if user|length %}&#xA;    {% set groups = user.getGroups() %}&#xA;&#xA;    {# make sure they belong to at least one group #}&#xA;    {% if groups|length %}&#xA;        {# display the name of the first group #}&#xA;        {{ groups[0].name }}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-09T18:20:01.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8593" PostTypeId="1" AcceptedAnswerId="8602" CreationDate="2015-03-09T20:56:33.620" Score="0" ViewCount="3152" Body="&lt;p&gt;I'm trying to figure out how to nest 3 templates and have them inherit the blocks. How can I sometimes reference the child.html when I need a wrapper and sometimes not reference it. Maybe I'm trying to do this the wrong way? Thank you for your feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;parent.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block contentBlock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;child.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;    &#xA;{% extends &quot;parent&quot; %}&#xA;{% block content %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;child-child.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;child&quot; %}&#xA;{{ title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;child2.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;parent.html&quot; %}&#xA;{% block contentBlock %}&#xA;{{ title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-03-10T11:39:38.063" Title="How do I nest multiple templates while keeping a wrapper for some pages" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8594" PostTypeId="1" AcceptedAnswerId="8595" CreationDate="2015-03-09T21:06:55.187" Score="1" ViewCount="199" Body="&lt;p&gt;I'm trying to work locally on a Mac installation of Craft but keep getting permissions errors with Storage, and so on. I don't get these errors when working locally on Windows using these same files (synced using Dropbox).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to fix this without manually changing every file? I've changed the permissions for Storage and Runtime but am now getting &lt;em&gt;Unable to create a cache directory&lt;/em&gt;. Even if there is a fix, will I need to repeat it for each project I create on Windows and later work on using the Mac?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Clive&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-03-09T21:44:35.603" Title="Permissions when crossing over from Windows to Mac" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8595" PostTypeId="2" ParentId="8594" CreationDate="2015-03-09T21:44:35.603" Score="1" Body="&lt;p&gt;I've got a nearly identical setup... a Windows 8.1 box using IIS and an OSX laptop using MAMP with Craft installs that are sync'd with Dropbox between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I recall correctly, the only thing I did was give &quot;Everyone&quot; full recursive access to things like &lt;code&gt;craft/storage&lt;/code&gt; on Windows and &lt;code&gt;chmod -R 777 craft/storage&lt;/code&gt; on the OSX box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Haven't ran into any permission issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will warn you &lt;em&gt;not&lt;/em&gt; to use symlinks in that setup, however, as Dropbox doesn't know how to resolve those cross platform.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-09T21:44:35.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8596" PostTypeId="1" AcceptedAnswerId="8598" CreationDate="2015-03-09T21:54:07.493" Score="3" ViewCount="725" Body="&lt;p&gt;I'm building a plugin and have a form in the plugin's CP page that allows admins to save access codes. The form is a simple &lt;code&gt;textarea&lt;/code&gt; where each line is a separate access code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering what the best practice is in terms of inserting these records into the database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// This returns an array of codes to be inserted&#xA;$codes = explode(&quot;\r\n&quot;, craft()-&amp;gt;request-&amp;gt;getPost('codes'));&#xA;&#xA;foreach($codes as $code) {&#xA;    $codeModel = new Portal_CodeModel();&#xA;    $codeModel-&amp;gt;code = $code;&#xA;    $codeModels[] = $codeModel;&#xA;}&#xA;&#xA;$success = craft()-&amp;gt;portal_code-&amp;gt;addCodes($codeModels);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Service:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCodes($codes) {&#xA;&#xA;    foreach($codes as $code) {&#xA;&#xA;      Portal_CodeRecord::model()-&amp;gt;insert(array(&#xA;          'code'        =&amp;gt; $code,&#xA;          'code_used'   =&amp;gt; 0&#xA;      ));&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Record:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Portal_CodeRecord extends BaseRecord {&#xA;&#xA;    public function getTableName() {&#xA;        return 'portal_codes';&#xA;    }&#xA;&#xA;    protected function defineAttributes() {&#xA;        return array(&#xA;            'code'          =&amp;gt; AttributeType::String,&#xA;            'code_used'     =&amp;gt; AttributeType::Bool&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="476" LastEditorUserId="476" LastEditDate="2015-03-10T15:30:21.113" LastActivityDate="2015-03-10T17:04:25.047" Title="Inserting multiple records in a plugin" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;services&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8597" PostTypeId="2" ParentId="3039" CreationDate="2015-03-09T22:09:57.963" Score="3" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFunctions() {&#xA;    return array (&#xA;        'my_func' =&amp;gt; new \Twig_SimpleFunction('my_func', array($this, 'my_func'), array('is_safe' =&amp;gt; array('html')))&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This being the important part:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array('is_safe' =&amp;gt; array('html'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="855" LastActivityDate="2015-03-09T22:09:57.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8598" PostTypeId="2" ParentId="8596" CreationDate="2015-03-10T03:08:51.533" Score="1" Body="&lt;p&gt;Go with #1.  It looks like you've already got a &lt;code&gt;Portal_CodeModel&lt;/code&gt; created, you just need to populate them from the controller, perform validation (if any), then pass the array of &lt;code&gt;Portal_CodeModel&lt;/code&gt; objects to your service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to remove the &lt;code&gt;Portal_CodeModel&lt;/code&gt; type hint from your service's &lt;code&gt;addCodes&lt;/code&gt; signature (or change it to &lt;code&gt;array&lt;/code&gt;) since you're passing in an array of objects, instead of a single one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example in your controller with any code validation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$codeModels = array();&#xA;$codes = explode(&quot;\r\n&quot;, craft()-&amp;gt;request-&amp;gt;getPost('codes'));&#xA;&#xA;$success = craft()-&amp;gt;portal_code-&amp;gt;addCodes($codes);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCodes($codes)&#xA;{&#xA;&#xA;    foreach($codes as $code)&#xA;    {&#xA;        $existingCode = Portal_CodeRecord::model()-&amp;gt;findByAttributes(array(&#xA;            'code' =&amp;gt; $code,&#xA;        ));&#xA;&#xA;        if ($existingCode)&#xA;        {&#xA;            $existingCode-&amp;gt;code_used = 1;&#xA;            $existingCode-&amp;gt;save();&#xA;&#xA;            {# or whatever else you want to do when the code already exists in the database #}&#xA;        }&#xA;        else&#xA;        {&#xA;            $codeRecord = new Portal_CodeRecord();&#xA;            $codeRecord-&amp;gt;code = $code;&#xA;            $codeRecord-&amp;gt;code_used = 0;&#xA;            $codeRecord-&amp;gt;save();&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="476" LastEditDate="2015-03-10T17:04:25.047" LastActivityDate="2015-03-10T17:04:25.047" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8599" PostTypeId="2" ParentId="8589" CreationDate="2015-03-10T07:29:40.463" Score="1" Body="&lt;p&gt;You may want to specify the &lt;strong&gt;locale&lt;/strong&gt; of your nav links... &lt;code&gt;craft.locale&lt;/code&gt; is the current locale.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set pages = craft.entries.section('pages').locale(craft.locale).level(1) %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for page in pages %}&#xA;            &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are many different ways to create language links, several of which are &lt;a href=&quot;https://craftcms.stackexchange.com/q/44/45&quot;&gt;described in this thread...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-10T07:29:40.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8601" PostTypeId="1" CreationDate="2015-03-10T11:20:36.927" Score="2" ViewCount="902" Body="&lt;p&gt;On a fairly fresh site (and also on some more built up sites) I noticed that Redactor is preventing you from doing the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a heading such as an H1 or H2 with two or more words&lt;/li&gt;&#xA;&lt;li&gt;Select only one of the words in the heading&lt;/li&gt;&#xA;&lt;li&gt;Attempt to apply styling, such as bold or italic to that word&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This should result in some simple markup such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;My list of &amp;lt;strong&amp;gt;words&amp;lt;/strong&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it does not apply this styling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug with redactor? Intended behavior? Do you know a clever work around that would utilize Redactor's native buttons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;Clean Up HTML?&lt;/code&gt; field is unchecked on this redactor settings type.&lt;/li&gt;&#xA;&lt;li&gt;This bug seems to be a redactor bug, it exists on &lt;a href=&quot;http://imperavi.com/redactor/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2216" LastEditorUserId="2216" LastEditDate="2015-03-10T12:07:00.233" LastActivityDate="2015-03-10T12:07:00.233" Title="Redactor won't allow simple styling in heading tags" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="15" ClosedDate="2015-03-14T15:39:56.373" ContentLicense="CC BY-SA 3.0" />
  <row Id="8602" PostTypeId="2" ParentId="8593" CreationDate="2015-03-10T11:39:38.063" Score="3" Body="&lt;p&gt;In my experience, this is the type of situation where you may want to consider having a second layout rather than opting for a more complicated inheritance scheme. If your layouts are somewhat complex and you want to keep your markup DRY I would suggest moving the more complex components of your layout into includes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when I get beyond the Layout &amp;raquo; Template relationship, instead of defining blocks and extending the Template I opt for includes there as well. This makes my workflow efficient because I always consider the Template to be the base point, inheriting up into the Layout and inheriting down into any includes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;layout_1col.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;{% include 'head' %}&#xA;&amp;lt;body&amp;gt;&#xA;  {% include 'header' %}&#xA;  &amp;lt;main&amp;gt;&#xA;    {% block 'main' %}{% endblock %}&#xA;  &amp;lt;/main&amp;gt;&#xA;  {% include 'footer' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;layout_2col.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;{% include 'head' %}&#xA;&amp;lt;body&amp;gt;&#xA;  {% include 'header' %}&#xA;  &amp;lt;main&amp;gt;&#xA;    {% block 'main' %}{% endblock %}&#xA;  &amp;lt;/main&amp;gt;&#xA;  &amp;lt;aside&amp;gt;&#xA;    {% block 'sidebar' %}{% endblock %}&#xA;  &amp;lt;/aside&amp;gt;&#xA;  {% include 'footer' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MyTemplate.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout_1col' %}&#xA;{% block 'main' %}&#xA;  &amp;lt;p&amp;gt;My content&amp;lt;/p&amp;gt;&#xA;  {% include 'mywidget' %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By letting your layouts rely heavily on includes you can let them vary only where needed but keeping your inheritance logic simple and easily extended.&lt;/p&gt;&#xA;" OwnerUserId="2216" LastActivityDate="2015-03-10T11:39:38.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8603" PostTypeId="2" ParentId="8601" CreationDate="2015-03-10T12:04:02.947" Score="0" Body="&lt;p&gt;Rich Text fields in Craft have several options to them that can affect code output. In your field settings, make sure you don't have &lt;code&gt;Clean up HTML?&lt;/code&gt; ticked. As the description reads, this option:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Removes spans, empty tags, and most style attributes on save.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Without seeing your field, this is a wild guess at what could be the problem.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-03-10T12:04:02.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8604" PostTypeId="2" ParentId="8545" CreationDate="2015-03-10T13:44:01.347" Score="5" Body="&lt;p&gt;Just in case anyone was wondering, it looks like I'll be going with &lt;a href=&quot;https://mpdf.github.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;mPDF&lt;/a&gt;, it seems to have better HTML/CSS support than either &lt;a href=&quot;http://www.tcpdf.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;TCPDF&lt;/a&gt; or &lt;a href=&quot;https://github.com/dompdf/dompdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;domPDF&lt;/a&gt; (which &lt;a href=&quot;https://printmaker.docs.topshelfcraft.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Printmaker&lt;/a&gt; seems to be based on).&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2018-08-15T15:48:47.273" LastActivityDate="2018-08-15T15:48:47.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8605" PostTypeId="1" AcceptedAnswerId="8606" CreationDate="2015-03-10T15:50:07.280" Score="5" ViewCount="1053" Body="&lt;p&gt;Does the &quot;Activate your account&quot; link, in emails sent to new users, have an timeframe for expiration?  I've had a few of my users run into a &quot;Invalid verification code&quot; error when clicking on the link, after waiting a couple days. If I resend the email, and they click on it within a few hours there's no issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked through the docs and posts here and don't see any reference to one.  If there is a default expiration, is this something I can override?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2015-03-10T16:49:50.540" Title="New user registration activation timeout?" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8606" PostTypeId="2" ParentId="8605" CreationDate="2015-03-10T16:49:50.540" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#verificationCodeDuration&quot; rel=&quot;nofollow&quot;&gt;verificationCodeDuration&lt;/a&gt; config setting is what you're looking for.  Defaults to 24 hours.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-10T16:49:50.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8607" PostTypeId="1" AcceptedAnswerId="8608" CreationDate="2015-03-10T17:01:37.423" Score="1" ViewCount="1593" Body="&lt;p&gt;I've got a use case where I'd like to be able to not only upload an image for a blog entry's &quot;featuredThumb&quot; but also have the ability to upload a video. I was originally using animated GIFs but they are huge. So much &lt;a href=&quot;http://mashable.com/2014/06/20/twitter-gifs-mp4/&quot; rel=&quot;nofollow&quot;&gt;like twitter&lt;/a&gt; I'm going to switch them for videos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have something that I'm sure you'll be very familiar with. I've got an asset field within my blog section that accepts an image and my template code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').find() %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ entry.featuredThumb.getUrl(&quot;someTransform&quot;) }}&quot; alt=&quot;{{ entry.featuredThumb.title }}&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h3&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to switch the image for a small HTML5 video. This poses a few problems, as numerous video formats are required for cross browser compatibility, along with an image as a poster / fallback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current solution is to switch the &quot;featuredThumb&quot; asset field, for a new matrix field that contains two block types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Image&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset field - Name: Image&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Video&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset field - Name: Videos (allows multiple files so the user uploads MP4, OGV, WebM)&lt;/li&gt;&#xA;&lt;li&gt;Asset field - Name: Fallback Image&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then in my template update to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').find() %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            {% for block in entry.featuredThumb %}&#xA;                {% switch block.type %}&#xA;&#xA;                    {% case &quot;image&quot; %}&#xA;&#xA;                        &amp;lt;img src=&quot;{{ block.image.first().url }}&quot; alt=&quot;{{ block.image.first().title }}&quot;&amp;gt;&#xA;&#xA;                    {% case &quot;video&quot; %}&#xA;&#xA;                        &amp;lt;video width=&quot;320&quot; height=&quot;180&quot; autoplay loop&amp;gt;&#xA;                            {% for video in block.videos %}&#xA;                                &amp;lt;source src=&quot;{{ video.url }}&quot; type=&quot;{{ video.getMimeType() }}&quot;&amp;gt;&#xA;                            {% endfor %}&#xA;                            &amp;lt;!-- Fallback image for browser without &amp;lt;video&amp;gt; support --&amp;gt;&#xA;                            &amp;lt;img src=&quot;{{ block.videos.fallbackImage.first().url }}&quot; alt=&quot;{{ block.videos.fallbackImage.first().title }}&quot;&amp;gt;&#xA;                        &amp;lt;/video&amp;gt;&#xA;&#xA;                {% endswitch %}&#xA;            {% endfor %}&#xA;        &amp;lt;/a&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h3&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the best solution I'm able to come up with, but it seems a little over-engineered. I'd love to see other people's take on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tom&lt;/p&gt;&#xA;" OwnerUserId="3393" LastActivityDate="2018-03-08T07:26:03.057" Title="Featured thumb with image or video" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8608" PostTypeId="2" ParentId="8607" CreationDate="2015-03-10T18:28:47.487" Score="1" Body="&lt;p&gt;Tom, we applied the same technique to several clients. We also tried having one asset input and only allowing images and videos.  Then as we loop through the asset field we check for media type. However I think breaking it up like you have, is a better user experience so they know to add either video or image. We have also added a plain text field and allowed them to add Vimeo/YouTube embed code for the video. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-03-10T18:28:47.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8609" PostTypeId="2" ParentId="8589" CreationDate="2015-03-10T23:26:22.130" Score="2" Body="&lt;p&gt;A multi-environment config needs to have a &lt;code&gt;*&lt;/code&gt; key. This might work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(),&#xA;  'craft.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;      'de' =&amp;gt; 'http://craft.dev/',&#xA;       en' =&amp;gt; 'http://craft.dev/en/',&#xA;    ),&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-03-10T23:26:22.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8610" PostTypeId="1" CreationDate="2015-03-11T09:29:08.797" Score="1" ViewCount="224" Body="&lt;p&gt;Is it possible to install Craft from the command line or without going through the installer screens?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is it as simple as using bootstrap.php and then calling &lt;code&gt;craft()-&amp;gt;install-&amp;gt;run($inputs);&lt;/code&gt; with valid inputs?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-03-11T10:03:21.537" Title="Installing Craft without installer screens" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8611" PostTypeId="2" ParentId="8610" CreationDate="2015-03-11T10:03:21.537" Score="1" Body="&lt;p&gt;Would this be something? Craft &lt;a href=&quot;https://github.com/themccallister/craft&quot; rel=&quot;nofollow&quot;&gt;CLI Installer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-03-11T10:03:21.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8612" PostTypeId="1" CreationDate="2015-03-11T11:16:07.293" Score="2" ViewCount="847" Body="&lt;p&gt;Does anyone know how to query the database to find entry data based on a slug? The only table field I see that contains slug data is in craft_entryversions.data  in json format. Anyone ever tried querying for matches?&lt;/p&gt;&#xA;" OwnerUserId="2218" LastActivityDate="2015-03-11T15:34:13.373" Title="Querying database for slug match?" Tags="&lt;slug&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8614" PostTypeId="1" CreationDate="2015-03-11T13:20:36.293" Score="1" ViewCount="252" Body="&lt;p&gt;I have 2 categories, model and feature which I've added as a field to an entry. I want to find entries with the model category using &quot;or&quot; but the feature category using &quot;and&quot;. I believe the &quot;relatedTo&quot; functionality only allows one kind which is very restrictive.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set model = [24, 25, 26] %}&#xA;{% set feature = ['AND', 46, 47, 48] %}&#xA;&#xA;{%&#xA;    set entries = craft.entries({&#xA;        relatedTo: [model, feature]&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above is an example, but it returns no results.&#xA;How else can I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-03-11T15:33:57.107" Title="Find entries with multiple categories with an and/or twist" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8615" PostTypeId="1" AcceptedAnswerId="8616" CreationDate="2015-03-11T13:47:46.093" Score="1" ViewCount="257" Body="&lt;p&gt;Is it possible to use the search in the CP to search let's say by id? Or even one of the fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;Sidney&lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-03-11T15:01:40.553" Title="Control Panel advanced search?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8616" PostTypeId="2" ParentId="8615" CreationDate="2015-03-11T15:01:40.553" Score="3" Body="&lt;p&gt;You can search any of your fields using the syntax &quot;fieldHandle: search term&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/searching&lt;/a&gt; for more info.&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2015-03-11T15:01:40.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8617" PostTypeId="1" CreationDate="2015-03-11T15:09:23.303" Score="0" ViewCount="485" Body="&lt;p&gt;I'm trying to showcase some responsive code and would like to create entries just with that code example. I would like them to appear in a template that has some js to resize an iframe and show responsiveness of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how I can accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-03-11T17:26:38.837" Title="How would I pass an entry URL to an iframe in a template?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8618" PostTypeId="2" ParentId="8614" CreationDate="2015-03-11T15:33:57.107" Score="1" Body="&lt;p&gt;Ok, I was close :P&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to create an object to pass instead of an array. The documentation for this is sketchy and confusing so I hope this snippet helps someone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice I am setting 'and' at the root of the object, but this only applies to the objects that follow, not to targetElement arrays. So by separating all the features into separate objects, the 'and' is applied to them, but not the models.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set models = [24, 25, 26] %}&#xA;{% set features = [46, 47, 48] %}&#xA;&#xA;{%&#xA;  set relatedTo = ['and', {&#xA;    targetElement: models,&#xA;    field: 'model'&#xA;  }]&#xA;%}&#xA;&#xA;{% for feature in features %}&#xA;  {% set relatedTo = relatedTo|merge([{&#xA;    targetElement: feature,&#xA;    field: 'feature'&#xA;  }]) %}&#xA;{% endfor %}&#xA;&#xA;{%&#xA;  set entries = craft.entries({&#xA;    relatedTo: relatedTo&#xA;  })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-03-11T15:33:57.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8619" PostTypeId="2" ParentId="8612" CreationDate="2015-03-11T15:34:13.373" Score="3" Body="&lt;p&gt;If you're talking about querying using SQL directly, then the &lt;code&gt;craft_elements_i18n&lt;/code&gt; table is where all of the slugs are kept.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-11T15:34:13.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8620" PostTypeId="1" AcceptedAnswerId="8621" CreationDate="2015-03-11T16:18:59.667" Score="1" ViewCount="270" Body="&lt;p&gt;I'm struggling to figure out how to map an array of values in a plugins settings to a group of checkboxes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'createGlobals' =&amp;gt; array(&#xA;            AttributeType::Mixed, 'default' =&amp;gt; array(&#xA;                &quot;twitter&quot; =&amp;gt; true,&#xA;                &quot;facebook&quot; =&amp;gt; true,&#xA;                &quot;linkedIn&quot; =&amp;gt; true&#xA;                )&#xA;            )&#xA;        );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's one checkbox in my plugins template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{  forms.checkboxField({&#xA;  label: &quot;&amp;lt;strong&amp;gt;Twitter&amp;lt;/strong&amp;gt;&quot;|t,&#xA;  name: '???',&#xA;  value: 'on',&#xA;  checked: settings.createGlobals.twitter&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I've omitted the name value. Is there any way of mapping this name to the settings.createGlobals object?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-03-11T17:14:25.543" Title="Mapping plugin settings to checkboxes" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8621" PostTypeId="2" ParentId="8620" CreationDate="2015-03-11T17:14:25.543" Score="4" Body="&lt;p&gt;Sure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{  forms.checkboxField({&#xA;      label: &quot;&amp;lt;strong&amp;gt;Twitter&amp;lt;/strong&amp;gt;&quot;|t,&#xA;      name: 'createGlobals[twitter]',&#xA;      value : 'on',&#xA;      checked: settings.createGlobals.twitter&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-11T17:14:25.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8622" PostTypeId="2" ParentId="8617" CreationDate="2015-03-11T17:26:38.837" Score="2" Body="&lt;p&gt;Load the entries into a div then create several buttons to change the width of the div, or use JS to resize the div. Thus showing your users what happens to the responsiveness of the design at different widths. It doesn't need to be a iframe. Or just send them to a template with a UI element showing them to resize the browser.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-03-11T17:26:38.837" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8623" PostTypeId="1" CreationDate="2015-03-11T20:01:37.610" Score="2" ViewCount="326" Body="&lt;p&gt;I have a plugin that starts a task and subtasks from a CP widget AJAX call. The tasks are running without a hitch, but for some reason on production, the icon does not appear when the tasks start running unless I refresh the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my local dev site (MAMP), the task icon appears as soon as the code below is called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using this code to start the pending tasks I created:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.cp.runPendingTasks();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Is there a different JS command I should be using?&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-21T14:40:02.177" Title="Trigger Task Status Icon" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;javascript&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8624" PostTypeId="1" AcceptedAnswerId="8625" CreationDate="2015-03-11T22:38:17.773" Score="1" ViewCount="455" Body="&lt;p&gt;When creating a record in a plugin it automatically creates &lt;code&gt;dataCreated&lt;/code&gt; and &lt;code&gt;dataUpdated&lt;/code&gt; columns.  However, it doesn't look like the &lt;code&gt;dataUpdated&lt;/code&gt; columns is updated &lt;code&gt;on update&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set the &lt;code&gt;dataUpdated&lt;/code&gt; column attribute to &lt;code&gt;on update CURRENT_TIMESTAMP&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is that column manually updated in the background when using active record's &lt;code&gt;update()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="476" LastActivityDate="2015-03-11T23:18:49.430" Title="Plugin: Making a record's dateUpdated column update to CURRENT_TIMESTAMP" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8625" PostTypeId="2" ParentId="8624" CreationDate="2015-03-11T23:18:49.430" Score="2" Body="&lt;p&gt;How are you inserting the data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're inserting data through any of Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference#craft.app.records&quot; rel=&quot;nofollow&quot;&gt;Active Record&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; classes (&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt;), then Craft will take of updating &lt;code&gt;dateUpdated&lt;/code&gt; for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using raw SQL, then you'll have to keep track of it yourself.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-11T23:18:49.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8626" PostTypeId="1" AcceptedAnswerId="8627" CreationDate="2015-03-11T23:38:19.947" Score="1" ViewCount="216" Body="&lt;p&gt;quick question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrix %}&#xA;    {% if block.type == &quot;seo&quot; %}&#xA;    {% set descr = block.metaDescription %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if descr is defined %}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ descr }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;meta description won't show up? what am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-03-12T16:57:30.797" Title="Set Variables from the Matrix Field - SEO" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8627" PostTypeId="2" ParentId="8626" CreationDate="2015-03-12T00:40:15.743" Score="5" Body="&lt;p&gt;Twig's &lt;code&gt;for&lt;/code&gt; function is &lt;em&gt;scoped&lt;/em&gt;. This means that variables defined inside of it will not be accessible outside the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do, is to declare the variable with an initial value &lt;em&gt;before&lt;/em&gt; the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set descr = null %}&#xA;&#xA;{% for block in entry.matrix %}&#xA;    {% if block.type == &quot;seo&quot; %}&#xA;    {% set descr = block.metaDescription %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if descr != null %}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ descr }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, because in Twig the inner scope (i.e. your loop) will have access to variables belonging to its parent scope, but not vice versa.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-12T00:40:15.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8628" PostTypeId="1" AcceptedAnswerId="8629" CreationDate="2015-03-12T15:06:21.423" Score="1" ViewCount="690" Body="&lt;p&gt;I originally had some content stored in a plain text field but I want to give my co-workers the ability to add anchor links, lists etc.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to change the field type form Plaintext to Rich Text would I lose that content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also right now to output it, I am using the following : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ entry.field }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so I would have to change that to just using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.field }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will converting it to rich text, automatically add paragraph tags for me or would I have to go into each one and resave?&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="57" LastEditDate="2015-03-12T15:31:50.523" LastActivityDate="2015-03-12T15:31:50.523" Title="Is it possible to convert a plain text field to a rich text field, without losing content?" Tags="&lt;field&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8629" PostTypeId="2" ParentId="8628" CreationDate="2015-03-12T15:13:33.643" Score="5" Body="&lt;p&gt;You should be OK converting your Plain Text to Rich Text. I've just tried it in my dev environment and everything was preserved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rich Text will add the paragraph tags as you suggest, so you'll want to remove them from your templates files as you mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're being cautious, you can take a backup of your database in the Settings section of your control panel before changing the field type. It only takes a few seconds, and that way, if anything goes wrong, you can restore.&lt;/p&gt;&#xA;" OwnerUserId="3393" LastActivityDate="2015-03-12T15:13:33.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8630" PostTypeId="1" AcceptedAnswerId="8631" CreationDate="2015-03-12T15:36:07.883" Score="4" ViewCount="304" Body="&lt;p&gt;I have a masonry type image grid layout and I need to specify a different image transform for just the 2nd and fourth images in this grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the image ID relate to the order or to the specific image? How could I include a conditional in my code to output the largeIndexHalf image transform for the 2nd and 4th image?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.portraits %}&#xA;{% if asset | length %}&#xA;{% for asset in entry.portraits %}&#xA;&amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('largeIndex') }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2015-03-12T16:59:23.950" Title="Transform different image if specific id or order" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8631" PostTypeId="2" ParentId="8630" CreationDate="2015-03-12T16:29:24.137" Score="6" Body="&lt;p&gt;You could do that like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.portraits %}&#xA;    {% if loop.index == 2 or loop.index == 4 %}&#xA;        {% set transform = 'largeIndexHalf' %}&#xA;    {% else %}&#xA;        {% set transform = 'largeIndex' %}&#xA;    {% endif %}&#xA;    &amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl(transform) }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or more simply (making use of the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot;&gt;containment operator&lt;/a&gt; (&lt;code&gt;in&lt;/code&gt;) and the ternary operator (&lt;code&gt;? :&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.portraits %}&#xA;    {% set transform = loop.index in [2, 4] ? 'largeIndexHalf' : 'largeIndex' %}&#xA;    &amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl(transform) }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-03-12T16:29:24.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8632" PostTypeId="2" ParentId="8630" CreationDate="2015-03-12T16:30:03.567" Score="3" Body="&lt;p&gt;To better understand, do you want transform for all &lt;strong&gt;even&lt;/strong&gt; iterations on the array? If so, Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/cycle.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cycle&lt;/code&gt;&lt;/a&gt; function should do what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.portraits %}&#xA;{% if asset | length %}&#xA;   {% for asset in entry.portraits %}&#xA;      {% set transform = cycle(['largeIndex', 'largeIndexHalf'], loop.index0) %}&#xA;      &amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl(transform) }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rereading the question and Brandon's answer, I may have misinterpreted that you do indeed &lt;em&gt;just&lt;/em&gt; want the 2nd and 4th image. I'll leave my answer for posterity for people looking to do an even / odd thing though.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2015-03-12T16:59:23.950" LastActivityDate="2015-03-12T16:59:23.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8635" PostTypeId="1" CreationDate="2015-03-12T16:56:35.217" Score="1" ViewCount="56" Body="&lt;p&gt;For example, say I have two sections:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Services&lt;/li&gt;&#xA;&lt;li&gt;Locations&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I make an &lt;code&gt;entries&lt;/code&gt; field called &quot;Services&quot; and add it to the Locations field group, so that on a Location entry you can add &lt;code&gt;n&lt;/code&gt; number of services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I want a little bit of extra info that's unique to that particular pairing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have a location page called &quot;Boston, MA&quot; and a Service called &quot;Window Washing&quot;. Using my &lt;code&gt;entries&lt;/code&gt; field, I create a relationship on my &quot;Boston, MA&quot; page to the &quot;Window Washing&quot; Service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to show a note with this particular relationship that we don't do Skyscraper windows in this location. It's Extra Info for this relationship only and it's variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you solve this problem in Craft?&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2015-03-12T17:07:26.540" LastActivityDate="2015-03-12T17:07:26.540" Title="What's a Craft way to achieve extra info on specific relationships?" Tags="&lt;relations&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8636" PostTypeId="2" ParentId="8635" CreationDate="2015-03-12T16:56:35.217" Score="2" Body="&lt;p&gt;One solution I've come up with is to add a Matrix field that has two fields:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Text Input&lt;/li&gt;&#xA;&lt;li&gt;Entries Field&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Add that field to the &quot;Services&quot; field layout. Then you could add a lookup on the &quot;Boston, MA&quot; page when you iterate over related Services. Do a lookup and say, do they have a Matrix entry that is associated with this entry, and pull in the Extra Info as appropriate.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2015-03-12T16:56:35.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8637" PostTypeId="2" ParentId="8416" CreationDate="2015-03-12T16:57:09.513" Score="1" Body="&lt;p&gt;Completely untested, but try setting the recently added &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#useSecureCookies&quot; rel=&quot;nofollow&quot;&gt;useSecureCookies&lt;/a&gt; setting to &lt;code&gt;false&lt;/code&gt; and see if that works.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-12T16:57:09.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8639" PostTypeId="1" CreationDate="2015-03-12T19:20:12.680" Score="1" ViewCount="1258" Body="&lt;p&gt;I am trying to use a variable, based on an entry field, to load a form with a Twig include. The code is pretty straightforward:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theForm = entry.formSelect %}&#xA;{% include theForm %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing this throws this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Undefined property: Craft\SingleOptionFieldData::$cacheKey&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I print the variable, it looks exactly as you would expect, e.g. forms/_basic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="45" LastEditDate="2015-03-12T21:28:57.937" LastActivityDate="2015-03-12T21:28:57.937" Title="Using a variable with Twig include" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8640" PostTypeId="2" ParentId="8639" CreationDate="2015-03-12T19:50:38.840" Score="3" Body="&lt;p&gt;You need to let Twig interpret the variable as a string. This works for me: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theForm = entry.formSelect %}&#xA;{% include ''~theForm~'' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-03-12T19:50:38.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8641" PostTypeId="1" AcceptedAnswerId="8642" CreationDate="2015-03-12T21:55:52.200" Score="0" ViewCount="1155" Body="&lt;p&gt;Which is better for performance? Using a macro for output in a for loop or calling an include using the 'with' params to pass data? Both are loading a file. But is stacking up a bunch of code in a macro file faster than using an small include file? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entries %}&#xA;    {% include &quot;/components/_item&quot; with { item: item } %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entries %}&#xA;    {{ helpers.item(item) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-03-12T22:10:48.443" Title="For performance is using a macro better than using include with the 'with' statement?" Tags="&lt;performance&gt;&lt;include&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8642" PostTypeId="2" ParentId="8641" CreationDate="2015-03-12T22:10:48.443" Score="4" Body="&lt;p&gt;If I had to guess, I'd say a macro would be faster because it's accessing the file system less.  In any case, unless you're dealing with hundreds of thousands of calls, I'd also guess that's the difference is going to be negligible for most use cases.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-12T22:10:48.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8643" PostTypeId="1" AcceptedAnswerId="8648" CreationDate="2015-03-13T04:22:18.193" Score="4" ViewCount="1194" Body="&lt;p&gt;I see the feature, but would like to read about what and where it finds before replacing.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-05T17:48:35.123" Title="Is the 'find and replace' feature (found in the control panel settings screen) documented?" Tags="&lt;documentation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8646" PostTypeId="1" AcceptedAnswerId="9197" CreationDate="2015-03-13T11:20:16.757" Score="2" ViewCount="256" Body="&lt;p&gt;What I am trying to do is adjust the entry index page to be more specific for our use case, I have already sorted out extra columns but I want to sort or filter by entry type. Of course I can already sort by &lt;code&gt;typeId&lt;/code&gt; using &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt; but this is not ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I either want to be able to sort by an entry type's name using &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt; or better still insert another filter button of all the types in-between the status filter and the search bar, see mock-up below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rmCKd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2015-04-14T22:45:03.730" Title="Can I add another filter option to element index views?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8647" PostTypeId="2" ParentId="4973" CreationDate="2015-03-13T13:14:53.353" Score="4" Body="&lt;p&gt;Thanks to the P&amp;amp;T team and the latests update to Craft (2.3.2640), this is now possible through a plugin! &lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/CPNav&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-03-13T13:14:53.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8648" PostTypeId="2" ParentId="8643" CreationDate="2015-03-13T13:45:26.913" Score="5" Body="&lt;p&gt;There's a short description of what it does in the &lt;a href=&quot;http://buildwithcraft.com/updates#build2524&quot; rel=&quot;noreferrer&quot;&gt;2.0 release notes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added a new Find and Replace tool in Settings, for &lt;strong&gt;finding/replacing text within all Rich/Plain Text fields&lt;/strong&gt; (including ones in a Matrix field).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-13T13:45:26.913" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8649" PostTypeId="1" AcceptedAnswerId="8650" CreationDate="2015-03-13T14:03:34.493" Score="6" ViewCount="869" Body="&lt;p&gt;Quick scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I build a plugin with a database. Few months down the line I want to upgrade this plugin which will alter the plugin DB. If installing an update to a plugin how does craft deal with not over writing the existing database data? I know in EE you set up separate install and update functions but I can't find anything in the documentation in craft regarding this and the plugins I've pulled apart don't seem to include anything to deal with updates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice or pointers to some good documentation on this would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-03-13T14:20:52.243" Title="How does craft deal with Plugin databases when updating plugin versions?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8650" PostTypeId="2" ParentId="8649" CreationDate="2015-03-13T14:20:52.243" Score="6" Body="&lt;p&gt;Every time Craft notices that a plugin's version number has changed (I imagine quite near the start of every request,) it checks for any new &lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot;&gt;Database Migrations&lt;/a&gt;&lt;/strong&gt; in that plugin that might need running in order get the database schema caught up to the code. That link, and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database&quot;&gt;this one for database queries&lt;/a&gt; should be enough to get you started.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-13T14:20:52.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8651" PostTypeId="1" AcceptedAnswerId="8654" CreationDate="2015-03-13T15:01:14.807" Score="0" ViewCount="96" Body="&lt;p&gt;Or do we need to set a specific key that includes something unique?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-13T16:05:02.260" Title="Are caches saved per locale by default?" Tags="&lt;localization&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8654" PostTypeId="2" ParentId="8651" CreationDate="2015-03-13T16:05:02.260" Score="1" Body="&lt;p&gt;I assume you're referring to template caches with the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then yes, the &lt;code&gt;{% cache %}&lt;/code&gt; tag by default will cache it's contents on a per URL and per locale basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#globally&quot; rel=&quot;nofollow&quot;&gt;globally&lt;/a&gt; parameter, then it will just be on a per locale basis.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-13T16:05:02.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8655" PostTypeId="2" ParentId="670" CreationDate="2015-03-13T17:34:26.930" Score="5" Body="&lt;p&gt;I found this post and the answer by @carlcs helpful.  However, I find the phrasing &lt;code&gt;unless not&lt;/code&gt; in the cache logic a bit hard to wrap my head around.  I want to note here an alternative to the syntax above that I found more intuitive:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'live' =&amp;gt; array(&#xA;        'cache' =&amp;gt; true&#xA;    ),&#xA;&#xA;    'local' =&amp;gt; array(&#xA;        'cache' =&amp;gt; false&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;cache tag which only runs in live environment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache if craft.config.cache %}&#xA;   ...&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-03-13T17:34:26.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8656" PostTypeId="1" AcceptedAnswerId="8668" CreationDate="2015-03-13T17:49:16.410" Score="2" ViewCount="568" Body="&lt;p&gt;I'm trying to show related entries for a single item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to look up a specific tag(s), and search for any entries that share the same tag(s) then display those related items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read through the documentation and searched around but couldn't find a solution.&lt;/p&gt;&#xA;" OwnerUserId="3358" LastEditorUserId="45" LastEditDate="2015-03-15T18:15:38.390" LastActivityDate="2015-03-15T18:15:38.390" Title="Find Related Entries with Identical Tags" Tags="&lt;entries&gt;&lt;search&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8657" PostTypeId="2" ParentId="8656" CreationDate="2015-03-13T20:45:04.820" Score="1" Body="&lt;p&gt;When you have your tag[s], fetch the related entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries&#xA;  .relatedTo({&#xA;    targetElement: tag,&#xA;    field: 'tags'&#xA;  })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is assuming the field for the tag is &lt;code&gt;tags&lt;/code&gt;, and the tag[s] you want to match is &lt;code&gt;tag&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can loop through the related entries. If you want to exclude the current entry, your loop might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for e in relatedEntries if e.id != currentEntry.id %}&#xA;  do things with {{e}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-03-13T20:45:04.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8658" PostTypeId="2" ParentId="8580" CreationDate="2015-03-13T20:48:27.120" Score="1" Body="&lt;p&gt;If you only want to get the user if they are A) in the group identified in the 1st segment, and B) have the username in the 2nd segment, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users({&#xA;    group:    craft.request.getSegment(1),&#xA;    username: craft.request.getSegment(2)&#xA;}).first() %}&#xA;&#xA;{# Make sure we found someone #}&#xA;{% if not user %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-03-13T20:48:27.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8659" PostTypeId="1" AcceptedAnswerId="8660" CreationDate="2015-03-13T21:00:33.247" Score="1" ViewCount="664" Body="&lt;p&gt;I am working on a site that has an events calendar with Future, Current and Expired events being shown. Which is completely fine when I am on the index page and have &quot;Entries in this section have their own URLs&quot; checked for that section. The problem I run into then is that the permalink page will only show entries that the are live. Pending and Expired entries will never be shown (As mentioned in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8480/how-do-i-set-up-event-listing-detail-pages-with-entry-post-dates-that-are-in-t&quot;&gt;this&lt;/a&gt; questions and answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a lot of events that have similar or the same name that happen on a weekly or monthly basis. For example &quot;Live Music at Blue Skies Winery&quot; produces a slug of &quot;ive-music-at-blue-skies-winery&quot; when I had Entries in this section have their own URLs it would increment the slug like &lt;code&gt;live-music-at-blue-skies-winery1&lt;/code&gt; and the next one would be &lt;code&gt;live-music-at-blue-skies-winery2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as a result I have disabled it for my event section but as a result now entries with the same title have the same slug of &lt;code&gt;live-music-at-blue-skies-winery&lt;/code&gt; without being incremented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to force the slugs to be unique either by incrementing the slug like happens when I have Entries in this section have their own URLs checked or is it possible to prepend the entry date 03-01-2015 to the slug name?&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-13T21:33:09.057" Title="How to Generate Unique Slugs for a Section without ticking &quot;Entries in this section have their own URLs&quot;" Tags="&lt;entries&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8660" PostTypeId="2" ParentId="8659" CreationDate="2015-03-13T21:33:09.057" Score="4" Body="&lt;p&gt;You should probably just set your event dates using custom Date/Time fields rather than the Post Date and Expiration Date fields. That way you don’t have to fight with Craft’s restrictions on non-live entries.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-03-13T21:33:09.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8661" PostTypeId="2" ParentId="8526" CreationDate="2015-03-13T21:40:42.140" Score="1" Body="&lt;p&gt;After doing the latest Craft Update, the plugin seems to be working fine now. It was either a bug in Craft that has been fixed, or you just have to give Google a few days before it's able to fetch the list of hosted analytics accounts.&lt;/p&gt;&#xA;" OwnerUserId="1122" LastActivityDate="2015-03-13T21:40:42.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8662" PostTypeId="1" CreationDate="2015-03-13T21:56:22.403" Score="5" ViewCount="391" Body="&lt;p&gt;Are there any plugins or best practices for giving authors in Craft the ability to create footnotes within a Rich Text Field? Is anyone doing anything like this?&lt;/p&gt;&#xA;" OwnerUserId="3407" LastActivityDate="2016-06-23T14:27:29.633" Title="Footnotes and Endnotes" Tags="&lt;plugins&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8663" PostTypeId="1" AcceptedAnswerId="8665" CreationDate="2015-03-14T13:40:28.480" Score="7" ViewCount="1613" Body="&lt;p&gt;Probably going to be an easy win for someone here, but being able to do this is currently eluding me. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to output a list of Artist names grouped by first letter but need to ignore 'The ' when it appears at the start of an Artist name. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, I've added a 'Sort Title' field to the Artist entry (as I figured there might be other occasions where this could be useful) - and using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2146/from-a-template-how-can-you-order-entries-by-one-field-and-if-that-field-is-em/2147#2147&quot;&gt;Brad's answer here&lt;/a&gt; this works fine when outputting a standard alphabetical list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there's also a page that needs to display the Artists grouped by first letter. Code for that currently is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for letter, artists in craft.entries.section('lineup').order('title') | group('title|upper|slice(0, 1)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How best could I adapt that to use my sortTitle field (when it isn't empty) to group the Artist entries? I get 'Expected name or number' if I try to use Brad's code in place of 'title'.&lt;/p&gt;&#xA;" OwnerUserId="3363" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-03-14T19:23:09.350" Title="Sorting entries A-Z, ignoring 'The' and grouping by first letter" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8664" PostTypeId="1" CreationDate="2015-03-14T14:04:43.477" Score="1" ViewCount="867" Body="&lt;p&gt;I'm trying to submit entry data via AJAX (using Guest Entries plugin) following what's written in a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2130/ajax-submittions-to-guest-entries&quot;&gt;similar question&lt;/a&gt;, however even though I am not sending the data in JSON format, the data does not seem to want to save and keeps returning a &quot;cannot be blank error&quot; for every field submitted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;errors&quot;:{&quot;title&quot;:[&quot;Title cannot be blank.&quot;],&quot;add01e&quot;:[&quot;Email cannot be blank.&quot;],&quot;firstName&quot;:[&quot;First Name cannot be blank.&quot;],&quot;lastName&quot;:[&quot;Last Name cannot be blank.&quot;]}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are, in reality, are being submitted as can be seen below. What's strange is that the sectionId and action are being processed for the server to respond with the latter list of errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sent Form Data Source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action=guestEntries%2FsaveEntry&amp;amp;sectionId=14&amp;amp;firstName=asdsa&amp;amp;lastName=dsad&amp;amp;add01e=asd%40sd.com&amp;amp;companyName=asd&amp;amp;redirectUrl=%2Fcontent%2Fdownloads%2Fproducts%2Fstrokepad%2F6pm-strokepad-brochure-a4_web_300115.pdf&amp;amp;title=Download+Request&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sent Form Data Parsed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action:guestEntries/saveEntry&#xA;sectionId:14&#xA;firstName:asdsa&#xA;lastName:dsad&#xA;add01e:asd@sd.com&#xA;companyName:asd&#xA;redirectUrl:/content/downloads/products/strokepad/6pm-strokepad-brochure-a4_web_300115.pdf&#xA;title:Download Request&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other details related to the request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Request URL:http://craft.dev/&#xA;Request Method:POST&#xA;Status Code:200 OK&#xA;&#xA;Content-Type:application/x-www-form-urlencoded; charset=UTF-8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS performing the ajax request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var formData = $form.serializeArray();&#xA;formData.push({name:'title',value:'Download Request'});&#xA;$.post('/', formData , function(response) {&#xA;    if (response.success) {&#xA;      //On Submit Success&#xA;    }else{&#xA;      alert('An error occurred. Please try again.');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what I might be doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3370" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-14T14:42:43.863" Title="Submit via ajax to Guest Entries plugin" Tags="&lt;ajax&gt;&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8665" PostTypeId="2" ParentId="8663" CreationDate="2015-03-14T14:14:51.217" Score="7" Body="&lt;p&gt;That SQL code snippet &lt;a href=&quot;https://craftcms.stackexchange.com/a/2147/125&quot;&gt;Brad posted&lt;/a&gt; only works with the order parameter.&#xA;The &lt;code&gt;group&lt;/code&gt; filter doesn't allow SQL, but you could try to replicate the logic using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;ternary operator&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('lineup').order('(CASE WHEN field_sortTitle IS NULL OR field_sortTitle = &quot;&quot; THEN title ELSE field_sortTitle END)') %}&#xA;{% set artistsGrouped = artists|group('{ object.sortTitle ? object.sortTitle[:1]|upper : object.title[:1]|upper }') %}&#xA;&#xA;{% for letter, artistsInGroup in artistsGrouped %}&#xA;    {{ letter }}&#xA;    {% for artist in artistsInGroup %}&#xA;        {{ artist.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To shorten the expression a bit I used the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter's short syntax &lt;code&gt;[:1]&lt;/code&gt; instead of &lt;code&gt;|slice(0, 1)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-14T19:23:09.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8666" PostTypeId="2" ParentId="8664" CreationDate="2015-03-14T14:42:43.863" Score="3" Body="&lt;p&gt;Ok found the solution to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All input fields must have the following format fields[&lt;em&gt;handle&lt;/em&gt;] - i was just using the handle!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;fields[firstName]&quot; id=&quot;firstName&quot; type=&quot;text&quot; placeholder=&quot;First name *&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3370" LastActivityDate="2015-03-14T14:42:43.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8667" PostTypeId="1" CreationDate="2015-03-14T18:42:09.810" Score="1" ViewCount="268" Body="&lt;p&gt;I am new to Craft, but have a lot of experience with other CMS systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a very specific question about Assets.  I have an intern who has been given access to a Craft site; for a particular Asset Source, the intern has &quot;View source&quot; and &quot;Upload files&quot; privileges, but he does not have &quot;Create subfolders&quot; and &quot;Remove files&quot; privileges.  But even though the intern cannot remove a file when logged in, he can still replace it with another.  This seems to be a huge security issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried everything to get around this issue, including configuring the image field to &quot;Restrict uploads to a single folder.&quot;  The problem here again is that I cannot restrict the intern to his folders only; he can see all the Asset folders and can replace any file -- either through malice or incompetence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denying the right to upload files for the intern is not going to work either because I do need him to be uploading files for the entries he is creating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated here as this is a real show-stopper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="3409" LastActivityDate="2015-03-16T16:46:18.257" Title="Is &quot;Replace file&quot; a potential security hole?" Tags="&lt;assets&gt;&lt;security&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8668" PostTypeId="2" ParentId="8656" CreationDate="2015-03-14T19:36:45.653" Score="2" Body="&lt;p&gt;Marion's answer is fine but you can also do it a different way, and move the conditional logic out of the for loop. By adding it to the query, you can ask for a specific amount of items to grab, and it won't mess up the loop.index values if you need them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I would do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries.relatedTo(tag).id('not ' ~ currentEntry.id).limit(4).find() %}&#xA;&#xA;{% if relatedEntries | length %}&#xA;    {% for e in relatedEntries %}&#xA;        {# entry stuff here #}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-03-14T19:36:45.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8670" PostTypeId="1" AcceptedAnswerId="8671" CreationDate="2015-03-14T22:31:51.227" Score="5" ViewCount="1125" Body="&lt;p&gt;Is there a way to programatically update a plugin's settings? I'm experimenting with &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/plugins/BasePlugin#setSettings-detail&quot; rel=&quot;noreferrer&quot;&gt;setSettings()&lt;/a&gt; but not really getting anywhere - I'm still quite new to plugin development so there's a good chance i'm completely off target hehe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some context: I'm trying to update the plugin settings when an event is fired and picked up by a listener as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    // add event listeners&#xA;    craft()-&amp;gt;on('assets.onReplaceFile', function(Event $event) {&#xA;&#xA;        //Load Asset&#xA;        $asset = $event-&amp;gt;params['asset'];&#xA;&#xA;        //Check if asset is the svg sprite&#xA;        if($asset-&amp;gt;getUrl() == $this-&amp;gt;getSettings()-&amp;gt;spritePath){&#xA;            $url = craft()-&amp;gt;getSiteUrl().$this-&amp;gt;getSettings()-&amp;gt;spritePath;&#xA;            $this-&amp;gt;setSettings(array('spriteDefs'=&amp;gt;$this-&amp;gt;getSpriteDefs($url)));&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;getSpriteDefs returns an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3370" LastEditorUserId="3370" LastEditDate="2015-03-14T22:50:25.013" LastActivityDate="2015-03-15T20:11:20.940" Title="How to programmatically update a plugin's settings?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8671" PostTypeId="2" ParentId="8670" CreationDate="2015-03-15T20:05:50.840" Score="10" Body="&lt;p&gt;It's not 100% clear from your question, but I'm guessing that by &quot;update the settings&quot; you mean actually storing the new settings in the database, which the &lt;code&gt;setSettings()&lt;/code&gt; method will not do; it will only update your plugin's settings model. This means that any following calls to e.g. &lt;code&gt;getSettingsHtml()&lt;/code&gt; should return the updated data, but it will not persist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To store the new settings in the database, you'll need to use Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/PluginsService#savePluginSettings-detail&quot;&gt;PluginService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;savePluginSettings( $this, array( 'spriteDefs' =&amp;gt; $this-&amp;gt;getSpriteDefs( $url ) ) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;$this&lt;/code&gt; variable in the call above refers to an instance of &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/plugins/BasePlugin&quot;&gt;BasePlugin&lt;/a&gt; – meaning that the above code will only work if called from your plugins main class. I notice that your code is contained within your plugin's &lt;code&gt;init()&lt;/code&gt; method, so you should be fine, however if you ever want to update a plugin's settings from outside the main class (e.g. through a service), you would first need to fetch an instance of the plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myPlugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin( 'myPluginHandle' );&#xA;craft()-&amp;gt;plugins-&amp;gt;savePluginSettings( $myPlugin, $settings );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-15T20:11:20.940" LastActivityDate="2015-03-15T20:11:20.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8673" PostTypeId="1" AcceptedAnswerId="8675" CreationDate="2015-03-16T02:11:18.570" Score="2" ViewCount="1701" Body="&lt;p&gt;Would I be right in assuming to allow clients to safely paste text from MS word into a WYSIWYG all I need to do is add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pastePlainText: true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to my Redactor json config file? I have done this and it seems to be working but I am aware of the problems concerning MS Word and pasting to wysiwyg's and don't want to encounter them further down the track.&lt;/p&gt;&#xA;" OwnerUserId="3412" LastEditorUserId="45" LastEditDate="2015-03-16T19:13:05.947" LastActivityDate="2015-03-16T19:13:05.947" Title="Paste From MS Word to Redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8674" PostTypeId="2" ParentId="8667" CreationDate="2015-03-16T03:34:33.487" Score="1" Body="&lt;p&gt;I'd classify this as a feature request for a &quot;Replace Asset&quot; user permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it'd be a security related &quot;privilege escalation&quot; bug if we supported it and you found a way to get around it or it just wasn't working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the record, we do check existing permissions on file upload and we also verify that the file you want to replace with is allowed within the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;allowedFileExtensions&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#extraAllowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;extraAllowedFileExtensions&lt;/a&gt; config settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-16T03:52:52.097" LastActivityDate="2015-03-16T03:52:52.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8675" PostTypeId="2" ParentId="8673" CreationDate="2015-03-16T04:03:04.297" Score="3" Body="&lt;p&gt;I haven't directly tried this myself, but I believe the answer is &lt;strong&gt;yes, you are correct.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be fair, this is barely even a Craft question... This is 99% about Redactor, and what it is capable of. Skimming the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean&quot; rel=&quot;nofollow&quot;&gt;Settings &gt; Clean&lt;/a&gt; page of the Redactor docs, it seems like Redactor already takes steps to normalize content from MS Word, and &lt;code&gt;pastePlainText&lt;/code&gt; is simply one piece of the puzzle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some steps you can take to further assess whether you're getting the output you want from your Redactor settings...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Look at how the data is being stored in your database.&lt;/strong&gt; Specifically, keep an eye on your field's column in the &lt;code&gt;craft_content&lt;/code&gt; table.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Try various settings from the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean&quot; rel=&quot;nofollow&quot;&gt;Redactor &quot;Clean&quot; options&lt;/a&gt;&lt;/strong&gt;. The developers behind Redactor are clearly aware of MS Word, and all of it's bizarre behavior. If you don't get the results you want right away, try mixing &amp;amp; matching Redactor settings until you get the desired behavior.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-16T04:03:04.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8676" PostTypeId="1" CreationDate="2015-03-16T09:05:59.217" Score="1" ViewCount="395" Body="&lt;p&gt;In the documentation &quot;search form&quot; example you can run a GET request to a specific template and if you use a Plugin you can run a POST request to a specific controller action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is it possible to run a POST request directly to a template?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2019-10-23T14:05:11.493" Title="Can I POST to a template?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8677" PostTypeId="2" ParentId="8676" CreationDate="2015-03-16T10:41:49.920" Score="2" Body="&lt;p&gt;Sure, works just the same. Just change method=&quot;GET&quot; to method=&quot;POST&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can acquire the POST values by using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('yourPostName')&lt;/code&gt; in your plugin controller or by using &lt;code&gt;{{ craft.request.getPost('yourPostName') }}&lt;/code&gt; in a template.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-03-16T10:41:49.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8678" PostTypeId="1" AcceptedAnswerId="8764" CreationDate="2015-03-16T13:12:38.767" Score="1" ViewCount="225" Body="&lt;p&gt;I'm building a Guest Entry Form, and one of the fields is a dropdown. Everything feeds through fine, but if one of the other fields has a validation error, I can save any inputted data with the code as outlined in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry Form&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;customField&quot; type=&quot;text&quot; name=&quot;fields[customField]&quot;&#xA;{%- if entry is defined %} value=&quot;{{ entry.customField }}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, with the dropdown, I can't get the value to stick, it always defaults to the first option (It's to grab a name title - eg, Mr. Mrs, Miss etc) on an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[honorific]&quot;&amp;gt;&#xA;    {% for honortitle in entry.honorific.options %}&#xA;        &amp;lt;option {%- if entry is defined %} value=&quot;{{ honortitle.value }}{% endif -%}&quot;&amp;gt;{% if entry is defined %}{{ honortitle.value }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, if I've already selected the option at the bottom of the list, how do I get the field to remember what I've selected if there's an error elsewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Simon&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2015-03-20T15:17:56.343" Title="Front-End Entry (Guest) saving correct values on error" Tags="&lt;form&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8679" PostTypeId="1" AcceptedAnswerId="8724" CreationDate="2015-03-16T14:55:28.280" Score="4" ViewCount="1059" Body="&lt;p&gt;I want to set up a form on the front-end of a site to allow logged in users to choose items from a list which represent entries in a channel using checkboxes, then save those entries as relations to an entry that the user is editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8536/setting-user-field-type-from-a-front-end-form&quot;&gt;various&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4841/getting-related-project-of-a-submitted-wish-through-the-entry-field&quot;&gt;questions&lt;/a&gt; here I have got setting a relationship to one entry working. However, I want to allow up to 5 relationships to be set and I can't figure out how to add further relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry field containing the related choices is called &lt;code&gt;choices&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the template code I've got at the moment (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get current list of choices to pre-set checkboxes #}&#xA;{% set choices = entry.choices %}&#xA;{% set choiceList = '' %}&#xA;&#xA;{% for choice in choices %}&#xA;    {% set choiceList = choiceList ~ choice.id ~ &quot;,&quot; %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;form id=&quot;entry-edit-form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;choices-saved&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; id=&quot;choicesList&quot; name=&quot;fields[choices][]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {% for choice in choices %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;input class=&quot;choice-checkbox&quot; type=&quot;checkbox&quot; id=&quot;choice{{ loop.index }}&quot; data-id=&quot;{{ choice.id }}&quot; {% if choice.id in (choiceList|split(',')) %}checked=&quot;checked&quot;{% endif %} /&amp;gt;&#xA;            &amp;lt;label for=&quot;choice{{ loop.index }}&quot;&amp;gt;{{ choice.title }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;Save choices&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I've got some javascript that runs on form submit to loop through the checkboxes and grab the ids of the checked boxes. What format do these need to be saved in as a value to the hidden &lt;code&gt;choicesList&lt;/code&gt; field so that an array of related ids is saved to the correct field in the edited entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there another, simpler, way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-10-05T18:04:50.647" Title="How do set multiple entry relations using checkboxes on a front end form?" Tags="&lt;relations&gt;&lt;form&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8680" PostTypeId="1" AcceptedAnswerId="8693" CreationDate="2015-03-16T15:34:40.090" Score="0" ViewCount="419" Body="&lt;p&gt;I purchased the Dukt Videos plugin and when trying to connect with one of the services (Google or Vimeo) I'm met with the following fatal error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;( ! ) Fatal error: Class 'OAuth\Common\Storage\Session' not found in /home/forge/website.com/craft/plugins/oauth/providers/BaseOAuthProviderSource.php on line 51&#xA;Call Stack&#xA;#   Time    Memory  Function    Location&#xA;1   0.0001  242088  {main}( )   ../index.php:0&#xA;2   0.0002  243000  require_once( '/home/forge/website.com/craft/app/index.php' )   ../index.php:36&#xA;3   0.0392  3729440 CApplication-&amp;gt;run( )    ../index.php:62&#xA;4   0.0392  3731160 Craft\WebApp-&amp;gt;processRequest( ) ../CApplication.php:180&#xA;5   0.0617  4905776 Craft\WebApp-&amp;gt;_processActionRequest( )  ../WebApp.php:263&#xA;6   0.0617  4906040 CWebApplication-&amp;gt;runController( )   ../WebApp.php:756&#xA;7   0.0623  5054240 CController-&amp;gt;run( ) ../CWebApplication.php:282&#xA;8   0.0625  5080680 CController-&amp;gt;runActionWithFilters( )    ../CController.php:265&#xA;9   0.0625  5080792 CController-&amp;gt;runAction( )   ../CController.php:286&#xA;10  0.0626  5081528 CInlineAction-&amp;gt;runWithParams( ) ../CController.php:308&#xA;11  0.0626  5083200 Craft\OauthController-&amp;gt;actionConnect( ) ../CInlineAction.php:49&#xA;12  0.0765  5789632 OAuthProviderSources\BaseOAuthProviderSource-&amp;gt;initializeService( )  ../OauthController.php:120&#xA;13  0.0765  5789672 OAuthProviderSources\BaseOAuthProviderSource-&amp;gt;getStorage( ) ../BaseOAuthProviderSource.php:124&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This aspect of the plugin works on my dev env but when testing this on another separate install on my webserver this error keeps coming up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have an idea how this can be fixed? Assuming it's not a plugin bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have contacted the plugin developer about the issue but I'm concerned that I won't get a reply as I've asked him about another issue I encountered with the plugin about 2 weeks ago (with a follow up last week) and I did not get any reply. I've also seen that &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8526/dukt-analytics-plugin-web-profile-not-showing-up&quot;&gt;another member of this community&lt;/a&gt; had an issue with a plugin from the same developer and received no reply from the developer either. If this was a free plug in I wouldn't be expecting support but when you consider that the plugin costs €49, it's quite disappointing that there isn't a reply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3370" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-17T02:12:13.483" Title="&quot;Fatal Error 'OAuth\Common\Storage\Session' not found&quot; when trying to connect to connect to Google or Vimeo" Tags="&lt;plugins&gt;&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8681" PostTypeId="1" CreationDate="2015-03-16T15:52:45.940" Score="1" ViewCount="86" Body="&lt;p&gt;I've setup a few clients with Google's Cloud storage recently and am thinking of offering it to other clients with image-intensive sites, as a kind of retro-fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option will be to just create new asset folders and start using those instead of the current asset folders, but I'm also wondering if anyone has any experience of switching existing assets from local folders to Google Cloud (or Amazon, etc) and how much work was involved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Clive&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-03-16T15:52:45.940" Title="Moving from local asset folders to Google Cloud, Amazon, etc" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ClosedDate="2015-03-19T22:45:13.133" ContentLicense="CC BY-SA 3.0" />
  <row Id="8682" PostTypeId="1" AcceptedAnswerId="8685" CreationDate="2015-03-16T16:28:24.227" Score="3" ViewCount="524" Body="&lt;p&gt;I need to create several entries in different channels from a single front-end form. I realise that to do this I will need to create a plugin to handle the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I just to iterate over the post values in my controller action, validate them and build the entry models for each new entry, then loop around Craft's EntryService &lt;code&gt;saveEntry()&lt;/code&gt; service for each entry I want to save?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I need to write my own &lt;code&gt;saveEntry()&lt;/code&gt; service to handle saving multiple entries?&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-03-16T17:27:40.900" Title="How do I create a plugin to create and save multiple entries from one front-end form?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8683" PostTypeId="2" ParentId="8667" CreationDate="2015-03-16T16:46:18.257" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem here again is that I &lt;strong&gt;cannot restrict the intern to his folders only;&lt;/strong&gt; he can see all the Asset folders and can &lt;strong&gt;replace any file&lt;/strong&gt; -- either through malice or incompetence.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Unless I'm missing something you want to be able to jail a user to &lt;strong&gt;only his folders?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just tried this. While jailing a user to his own folder &lt;strong&gt;site wide&lt;/strong&gt; isn't (currently) possible, what you're doing should be working;  you have to do that on a field-by-field basis. Make sure you're jailing the the right field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your intern goes to edit an entry, he shouldn't be able to &lt;strong&gt;replace&lt;/strong&gt; an asset file in another folder if he doesn't have upload permission in the asset's source folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure only his asset source is checked.  For example: I created 2 asset sources: &lt;code&gt;Intern Images&lt;/code&gt; and &lt;code&gt;Images&lt;/code&gt;.  As you mentioned, the only folders the intern can view and upload is  &lt;code&gt;Intern Images&lt;/code&gt;; everything else is unchecked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m8HFK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test, I made a sample entry with my admin user and selected a PDF in a source that the intern user doesn't have access to. When I go to edit that entry as my Intern user, I can see the other assets in that folder—unless I've jailed it to a single folder—but I can't replace the actual asset because I don't have upload permission on that asset source. I can of course swap the asset for something else but the original asset FILE (the PDF's content) is left untouched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/36Lfg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're asking about replacing files that the Intern has access to as well, that's a whole other bag of worms and IMO trust issues. Security is a 2-way street. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I wonder if you could write a plugin to intercept the upload request and rename it before Craft has a chance to fire the &quot;would you like to replace the file&quot; so you always have a unique file name? IMO that gets touchy because you start to have 2 or 3 different versions floating around and that ends up causing even more stress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically speaking, WordPress actually does this by default (appending -1, -2 to a file) and in my experience, it can drive users crazy. If you upload a file and you realize you have a typo or some part of your image still needs work after approval—and that file path is already linked from a couple spots on the server—you end up deleting the file and then reuploading again. Craft's method of asset management is so much better in this respect. But with great power comes great responsibility, as they say.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-03-16T16:46:18.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8685" PostTypeId="2" ParentId="8682" CreationDate="2015-03-16T17:27:40.900" Score="3" Body="&lt;p&gt;I'd go with your first option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grab the &lt;code&gt;$_POST&lt;/code&gt; values via &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getPost-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;request-&gt;getPost()&lt;/a&gt;, assemble them in your multiple &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModels&lt;/a&gt;, &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#validate-detail&quot; rel=&quot;nofollow&quot;&gt;validate&lt;/a&gt; each model, then pass them off to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;entry-&gt;saveEntry()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-16T17:27:40.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8686" PostTypeId="1" CreationDate="2015-03-16T18:40:48.660" Score="0" ViewCount="389" Body="&lt;p&gt;We have a new website waiting to be published, and we would like to hire a new web design team, who is not a Craft Pro User...Is there anyway to get our website off of Craft or are we stuck with getting our own Pro Account? Please HELP!&lt;/p&gt;&#xA;" OwnerUserId="3415" LastEditorUserId="115" LastEditDate="2015-03-17T00:38:31.283" LastActivityDate="2015-03-17T00:38:31.283" Title="How can we move a Craft-built website to a new web designer?" Tags="&lt;admin&gt;&lt;license&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8687" PostTypeId="2" ParentId="8686" CreationDate="2015-03-16T18:51:23.743" Score="3" Body="&lt;p&gt;The Craft Pro accounts are per domain, not per user. If you want all the features of Craft Pro, you will need your own license. (&lt;a href=&quot;http://buildwithcraft.com/pricing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/pricing&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-03-16T18:51:23.743" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8688" PostTypeId="2" ParentId="8686" CreationDate="2015-03-16T20:03:54.267" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/8687/45&quot;&gt;Aaron's answer is exactly right...&lt;/a&gt; the &quot;Pro&quot; status refers to the entire website, not an individual user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your old developer has restricted permissions of the other users, here's how you can regain access to the rest of the control panel:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Access the database directly (via phpMyAdmin, Sequel Pro, or a similar tool).&lt;/li&gt;&#xA;&lt;li&gt;Find the &lt;code&gt;craft_users&lt;/code&gt; table.&lt;/li&gt;&#xA;&lt;li&gt;Find the user whom you would like to grant full access of the control panel.&lt;/li&gt;&#xA;&lt;li&gt;Under the &lt;code&gt;admin&lt;/code&gt; column, change the value to &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's it! That user will now have full super-admin access.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you are still looking for a new Craft developer to hire, there are many talented folks out there. The two best places to find someone are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Post to the &lt;a href=&quot;http://straightupcraft.com/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft - Jobs Board&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Tweet about your job opportunity with the hashtag of &lt;a href=&quot;https://twitter.com/search?q=%23craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;#craftcms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-16T20:03:54.267" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8689" PostTypeId="1" AcceptedAnswerId="8691" CreationDate="2015-03-16T20:47:23.977" Score="2" ViewCount="1848" Body="&lt;p&gt;I have this simple element model and I'm trying to add dynamic class within loop.&#xA;So every time a model outputs, It outputs dynamic class. Can't go for another loop within loop, in case I could, therefor It'd be easy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set tags = slide.foodTags %}&#xA;            {% if tags %} &#xA;&#xA;            &amp;lt;div&amp;gt;   &#xA;                  {% for tag in tags %}                     &#xA;                        &amp;lt;span class=&quot;{# dynamic-class #}&quot;&amp;gt;&#xA;                            {{ tag.title }}&#xA;                        &amp;lt;/span&amp;gt;&#xA;                  {% endfor %}&#xA;            &amp;lt;/div&amp;gt; &#xA;&#xA;           {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-05-08T19:56:28.633" Title="Set dynamic class in for Loop" Tags="&lt;forloop&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8690" PostTypeId="1" CreationDate="2015-03-16T22:14:49.440" Score="0" ViewCount="194" Body="&lt;p&gt;I'm using an assets directory with Amazon S3 and I have to manually update the indexes through the control panel after uploading files externally. Does anyone know if it is possible to do anything custom to do this on login. Or is it possible to set up a URL that could be hit with a cron or manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea I had failing any of the above would be to do a custom plugin with just a button to make it a bit quicker than the current method through the settings.&lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-04-16T00:11:12.557" Title="Update Asset Indexes on Login" Tags="&lt;assets&gt;&lt;index&gt;&lt;s3&gt;&lt;reindex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8691" PostTypeId="2" ParentId="8689" CreationDate="2015-03-16T23:12:30.110" Score="3" Body="&lt;p&gt;Not really sure what you're wanting the dynamic portion to be based on, but if it's something like the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;loop count&lt;/a&gt;, then you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = slide.foodTags %}&#xA;&#xA;{% if tags %} &#xA;&#xA;    &amp;lt;div&amp;gt;   &#xA;        {% for tag in tags %}                     &#xA;            &amp;lt;span class=&quot;dynamic-{{ loop.index }}&quot;&amp;gt;&#xA;                {{ tag.title }}&#xA;            &amp;lt;/span&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt; &#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-16T23:12:30.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8692" PostTypeId="2" ParentId="8690" CreationDate="2015-03-16T23:16:59.183" Score="1" Body="&lt;p&gt;Updating Asset indexes is pretty coupled to the tool in the Settings portion of the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you wanted to try and duplicate that functionality in a plugin, you could have it listen for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onLogin&quot; rel=&quot;nofollow&quot;&gt;onLogin&lt;/a&gt; event to do your business.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-16T23:16:59.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8693" PostTypeId="2" ParentId="8680" CreationDate="2015-03-17T02:12:13.483" Score="1" Body="&lt;p&gt;Hey Daniel and sorry for the lack of response. Please get in touch at ben@dukt.net and I'll be happy to offer you the license hoping you'll accept my apologies for the huge delay in my reply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your issue, it looks like some classes haven't been loaded (OAuth\Common\Storage\Session). Can you please check if Session.php file is present in OAuth plugin's folder under &lt;code&gt;oauth/vendor/lusitanian/oauth/src/OAuth/Common/Storage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you might consider get a fresh copy of the latest release of the &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;OAuth plugin&lt;/a&gt; and try to unzip/re-upload the files, I'm thinking you may just have some missing files and that could fix the problem, otherwise we'll dig further.&lt;/p&gt;&#xA;" OwnerUserId="164" LastActivityDate="2015-03-17T02:12:13.483" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8694" PostTypeId="1" CreationDate="2015-03-17T10:32:20.370" Score="4" ViewCount="298" Body="&lt;p&gt;I'm trying to password protect a staging site. So I've put a {% requireLogin %} at the top of my _layout.html inside of a conditional tag. It's working except the redirect after login always goes to the dashboard instead of the original page. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of the possibility of using htaccess protection, but I think doing it the &quot;Craft way&quot; is nicer.&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-01-12T14:07:07.350" Title="Password protect whole staging site. Redirect to original page not working" Tags="&lt;redirect&gt;&lt;password&gt;&lt;login&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8696" PostTypeId="1" CreationDate="2015-03-17T13:47:44.903" Score="0" ViewCount="627" Body="&lt;p&gt;I have an entries field (&lt;code&gt;activityPicker&lt;/code&gt;) that links to other entries in a different section. These other entries have categories (&lt;code&gt;things-to-do&lt;/code&gt; and &lt;code&gt;things-to-eat&lt;/code&gt;), and I'm trying to figure out how to filter these entries by categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first instinct was to do something similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Categories #}&#xA;{% set CatToDo = craft.categories.slug('things-to-do') %}&#xA;{% set CatToEat = craft.categories.slug('things-to-eat') %}&#xA;&#xA;{# Entries #}    &#xA;{% set toDo = entry.activityPicker.relatedTo(catToDo) %}&#xA;{% set toEat = entry.activityPicker.relatedTo(catToEat) %}&#xA;&#xA;{# Output #}&#xA;{% for item in toDo %}&#xA;   {{ item }}&#xA;{% endfor %}&#xA;&#xA;{% for item in toEat %}&#xA;   {{ item }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however that didn't work so I tried playing with &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;sourceElement&lt;/code&gt; in the &lt;code&gt;relatedTo&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set toEat = entry.activityPicker.relatedTo({&#xA;   targetElement: catToEat&#xA;}) %}&#xA;&#xA;[...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this still doesn't work. Basically I get that &lt;code&gt;entry.activityPicker&lt;/code&gt; returns an array of posts, but I haven't figured out how to filter those posts in a meaningful way before they hit the template.&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2015-03-17T14:26:37.287" Title="Entries field: Output entries related to category" Tags="&lt;categories&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8697" PostTypeId="2" ParentId="8696" CreationDate="2015-03-17T14:26:37.287" Score="1" Body="&lt;p&gt;The &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;sourceElement&lt;/code&gt; take either an ID, an Element Model, or an array of either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your example, you'd want to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Categories #}&#xA;{% set CatToDo = craft.categories.slug('things-to-do').first %}&#xA;{% set CatToEat = craft.categories.slug('things-to-eat').first %}&#xA;&#xA;{% set toEat = craft.entries.section('yourSection').relatedTo({&#xA;   targetElement: CatToEat,&#xA;   field: 'activityPicker'&#xA;}) %}&#xA;&#xA;[...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the &lt;strong&gt;.first&lt;/strong&gt; in there as the difference. You will only want the one category since you're passing the slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: This assumes that &lt;code&gt;CatToEat&lt;/code&gt; is indeed the targetElement. See here for more information: &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/relations#the-relatedTo-param&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2015-03-17T14:26:37.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8698" PostTypeId="1" CreationDate="2015-03-17T15:33:17.483" Score="0" ViewCount="76" Body="&lt;p&gt;Any help with this appreciated. A few months ago my colleague installed Craft CMS successfully on our clients server; He got the monkey and everything!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We sort of left it at that, as we had plenty of other things to do as well, but now we're ready to transfer the design into Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We were getting login issues saying the db config was wrong. It transpired&#xA;that the MariaDB had died on the centos server and needed to be restarted. After that was done, everything was working, but a few minutes later it died again. We did a full server reboot and again, Craft worked fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran the update to 2.3 and that apparently installed nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I went to tweak the admin account, when I submitted the save, I received the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 145 Table './Craft/craft_searchindex' is marked as crashed and should be repaired&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've not touched craft since the install and wondering how to go about fixing this, or if anyone else has come across this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated and free hugs and cookies too.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="125" LastEditDate="2015-05-29T15:11:01.627" LastActivityDate="2015-05-29T15:11:01.627" Title="Corrupt DB Error" Tags="&lt;error&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2015-03-17T21:17:46.067" ContentLicense="CC BY-SA 3.0" />
  <row Id="8699" PostTypeId="1" CreationDate="2015-03-17T16:42:49.763" Score="1" ViewCount="128" Body="&lt;p&gt;I'm using the amazon s3 asset source which all connects and works very well, the only trouble is that the assets field folder path is not respected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bucket called 'client' and in there we have three folders:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;audio&lt;/li&gt;&#xA;&lt;li&gt;documents&lt;/li&gt;&#xA;&lt;li&gt;images&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In my asset field which i want users to upload audio to, i set the file path as 'audio', '/audio', '/client/audio' but when i upload a new file via the entry form, it puts the file at the same level as the three folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clues as to why this might be happening?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-03-17T16:42:49.763" Title="Amazon S3 folder path doesn't seem to affect file uploads" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8700" PostTypeId="1" AcceptedAnswerId="8709" CreationDate="2015-03-17T17:26:19.207" Score="0" ViewCount="817" Body="&lt;p&gt;Here is my situation. This is not a whole code, only the part, where I'm having a problem. At the back end, model &lt;code&gt;coverbackup&lt;/code&gt; is populated with files as well as model &lt;code&gt;cover&lt;/code&gt;. If I depopulate &lt;code&gt;cover&lt;/code&gt; (remove image from entry), I want to load model &lt;code&gt;coverbackup&lt;/code&gt;. I was checking over and over, If I got to my file in &lt;code&gt;matrix&lt;/code&gt; field correctly, but It seems I have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than I've tried to check if &lt;code&gt;elseif&lt;/code&gt; statement loads anything on &lt;code&gt;cover&lt;/code&gt;=&lt;code&gt;false&lt;/code&gt;, &lt;strong&gt;I got empty output&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the slides stored in variable &quot;slides&quot; #}&#xA;{% set slides = craft.entries.section('handle').type(['article', 'blog', 'news']).order('RAND()').limit(3) %}&#xA;&#xA;    {% if slides %}&#xA;    &amp;lt;ul class=&quot;uk-slideshow&quot;&amp;gt;&#xA;&#xA;        {% for slide in slides %}  &#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            {% set cover = slide.coverImage %}&#xA;            {% set coverbackup = slide.entryContent %}&#xA;&#xA;                    {% if cover %}    &#xA;                        {% for cover in cover %}&#xA;                            &amp;lt;div class=&quot;uk-panel-teaser&quot;&amp;gt;&#xA;                                &amp;lt;img class=&quot;uk-margin-bottom&quot; src=&quot;{{ cover.getUrl('thumb700') }}&quot; alt=&quot;{{ cover.title }}&quot;&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        {% endfor %}&#xA;&#xA;&#xA;                    {% elseif coverbackup %}&#xA;                        {% for block in coverbackup %}&#xA;                            {% if block.type == &quot;image&quot; %}&#xA;                                {% for image in block.images %}&#xA;                                    &amp;lt;div class=&quot;uk-panel-teaser&quot;&amp;gt;&#xA;                                        &amp;lt;img class=&quot;uk-margin-bottom&quot; src=&quot;{{ image.getUrl('thumb700') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                {% endfor %}&#xA;                            {% endif %}&#xA;                        {% endfor %}&#xA;                    {% endif %}&#xA;&#xA;      &amp;lt;/li&amp;gt;&#xA;     {% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-03-18T21:27:29.023" Title="A problem with {% elseif %} statement" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8702" PostTypeId="1" AcceptedAnswerId="8706" CreationDate="2015-03-17T20:45:49.093" Score="1" ViewCount="240" Body="&lt;p&gt;Specifically, I'm looking at &lt;a href=&quot;https://github.com/yiiext/shopping-cart-component&quot; rel=&quot;nofollow&quot;&gt;https://github.com/yiiext/shopping-cart-component&lt;/a&gt;. Can Yii extensions be made to work with Craft (or work out of the box)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unfamiliar with both, so I'm having a hard time approaching adding a shopping cart to this project, and I think rolling my own would turn out to be a mistake&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="344" LastEditDate="2015-05-28T12:29:04.983" LastActivityDate="2015-05-28T12:29:04.983" Title="Are Yii plugins compatible with craft?" Tags="&lt;plugins&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8703" PostTypeId="1" AcceptedAnswerId="8704" CreationDate="2015-03-17T20:47:23.597" Score="1" ViewCount="209" Body="&lt;p&gt;I've written a short macro to get the first image inside a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro firstImage(entry) %}&#xA;&#xA;    {% set image = 'hello' %}&#xA;&#xA;    {% if entry.sliderMatrix.total() %}&#xA;        {% set block = entry.sliderMatrix|first %}&#xA;        {% set image = block.image|first %}&#xA;    {% endif %}&#xA;&#xA;    {{ image.url }}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code throws this error: Impossible to access an attribute (&quot;url&quot;) on a string variable (&quot;hello&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ image.url }}&lt;/code&gt; inside the if statement works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ image }}&lt;/code&gt; outside the if statement works too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I don't know or it's even a bug?&lt;/p&gt;&#xA;" OwnerUserId="623" LastActivityDate="2015-03-18T11:20:16.780" Title="Problem with scope in macro" Tags="&lt;macro&gt;&lt;scope&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8704" PostTypeId="2" ParentId="8703" CreationDate="2015-03-17T21:11:15.543" Score="2" Body="&lt;p&gt;Your syntax is close, but not quite right and you're setting a variable as a string and later setting it as an Element Model. I think you're searching for something closer to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro firstImage(entry) %}&#xA;&#xA;    {% if entry.sliderMatrix.total() %}&#xA;        {% set block = entry.sliderMatrix.first %}&#xA;        {% set image = block.image.first %}&#xA;    {% endif %}&#xA;&#xA;    {% if image is defined and image %}&#xA;        {{ image.url }}&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="623" LastEditDate="2015-03-18T11:20:16.780" LastActivityDate="2015-03-18T11:20:16.780" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8705" PostTypeId="2" ParentId="8703" CreationDate="2015-03-17T21:12:43.477" Score="3" Body="&lt;p&gt;Hard to say for sure, but here's what I suspect... You may have multiple instances of &lt;code&gt;firstImage&lt;/code&gt; being called from your main template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some of those instances, &lt;code&gt;entry.sliderMatrix.total&lt;/code&gt; is &lt;strong&gt;greater than&lt;/strong&gt; zero. For other instances, &lt;code&gt;entry.sliderMatrix.total&lt;/code&gt; is &lt;strong&gt;equal to&lt;/strong&gt; zero. And of course, when &lt;code&gt;entry.sliderMatrix.total&lt;/code&gt; is equal to zero, your &lt;code&gt;if&lt;/code&gt; statement will be bypassed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Realistically, you shouldn't have the &lt;code&gt;image.url&lt;/code&gt; call outside of your &lt;code&gt;if&lt;/code&gt; statement. Because any time the &lt;code&gt;if&lt;/code&gt; statement evaluates to &lt;em&gt;false&lt;/em&gt;, then the &lt;code&gt;image&lt;/code&gt; variable won't be what you want it to be. In fact, you'll get that exact error, since &lt;code&gt;image&lt;/code&gt; will still be set to a string.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-17T21:12:43.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8706" PostTypeId="2" ParentId="8702" CreationDate="2015-03-17T21:19:10.103" Score="1" Body="&lt;p&gt;No.  Yii's extensions and Craft's plugins are different things, although it's not that difficult to port a Yii extension to a Craft plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-17T21:19:10.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8707" PostTypeId="1" AcceptedAnswerId="8708" CreationDate="2015-03-17T21:28:12.930" Score="5" ViewCount="1437" Body="&lt;p&gt;I have created a Global with the handle 'footer', which contains a Matrix field 'links' and I'm trying to get this into a template, but I can't seem to get this to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'links' Matrix contains a Block Type 'navigation' with a Plain Text field 'navigationHeadline' and a Table field 'navigationLinks'. The table field contains 'linkLabel' and 'linkUrl' columns (see attached image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm ultimately creating my navigation in a Global with a Headline and some Links and the Headline should only appear if each block has some links;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.links %}&#xA;    {% if entry.navigationLinks | length %}&#xA;        &amp;lt;h3&amp;gt;{{ block.navigationHeadline }}&amp;lt;/h3&amp;gt;&#xA;        {# Show the navigationHeadline if it has links #}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for row in entry.navigationLinks %}&#xA;                &amp;lt;li&amp;gt;{{ row.linkLabel }} - {{ row.linkUrl }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wondered if anyone can help me resolve my obvious errors. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OoNwe.png&quot; alt=&quot;Screenshot of Global&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="679" LastActivityDate="2015-03-17T22:08:15.930" Title="Accessing a Matrix field in a Global" Tags="&lt;matrix&gt;&lt;globals&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8708" PostTypeId="2" ParentId="8707" CreationDate="2015-03-17T22:08:15.930" Score="7" Body="&lt;p&gt;Not sure why you're referencing &quot;entry&quot; in your code, I'd think the code should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in footer.links %}&#xA;  {% if block.navigationLinks | length %}&#xA;    &amp;lt;h3&amp;gt;{{ block.navigationHeadline }}&amp;lt;/h3&amp;gt;&#xA;    {# Show the navigationHeadline if it has links #}&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for row in block.navigationLinks %}&#xA;        &amp;lt;li&amp;gt;{{ row.linkLabel }} - {{ row.linkUrl }}&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, &quot;links&quot; is the matrix on your &quot;footer&quot; global, which you can access from anywhere. You loop over that, get a block for each matrix block, and access &quot;navigationHeadline&quot; and &quot;navigationLinks&quot; through that.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-03-17T22:08:15.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8709" PostTypeId="2" ParentId="8700" CreationDate="2015-03-17T22:42:40.923" Score="5" Body="&lt;p&gt;The proper conditional statement in this case would be to test for the &lt;code&gt;length&lt;/code&gt; property of your Asset field, i.e. &lt;em&gt;cover&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cover | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason this works, is that calling &lt;code&gt;slide.coverImage&lt;/code&gt; will – as long as the attribute &quot;coverImage&quot; exists for the &quot;slide&quot; model – never return a falsey value, even if there are no files. It will in fact always return an instance of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; class, i.e. an &lt;em&gt;object&lt;/em&gt; representing your Asset field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the conditional &lt;code&gt;{% if cover | length %}&lt;/code&gt; does is to read the &lt;em&gt;length&lt;/em&gt; property of the ElementCriteriaModel object. The length property will represent the number of images in the Asset field – if it contains 0 images, the conditional will evaluate to &quot;false&quot; – as the number 0 within a conditional is interpreted as a falsey value. If you prefer, you can also write the statement like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cover | length &amp;gt; 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-18T21:27:29.023" LastActivityDate="2015-03-18T21:27:29.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8710" PostTypeId="1" AcceptedAnswerId="8716" CreationDate="2015-03-17T23:30:56.440" Score="1" ViewCount="209" Body="&lt;p&gt;I'm currently writing &lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft&quot; rel=&quot;nofollow&quot;&gt;a plugin&lt;/a&gt; enabling users to easily add custom fields to index tables, using the native field layout designer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current goal is to have any datetime, boolean, string or number fields added to a source's FieldLayout, also automatically be added to the relevant index table's &lt;em&gt;sortable attributes&lt;/em&gt;. Obviously, I've met a stumbling block with &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySortableAttributes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works great on initial pageload (I've found a way to work around the fact that &lt;em&gt;modifyEntrySortableAttributes&lt;/em&gt; doesn't have a clue about the source).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that when navigating between sources, Craft uses AJAX, and the sortable attributes are not updated. Through logging I've confirmed that the &lt;em&gt;modifyEntrySortableAttributes&lt;/em&gt; hook &lt;em&gt;does run&lt;/em&gt; (see footnote!) every time the source changes, and I also know that my fix for identifying the current source also works (i.e. the plugin fetches the correct FieldLayout whenever the source changes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So – as far as I can tell – I'm basically stuck with a CP frontend issue, which is that the &quot;.sortmenubtn&quot; button doesn't refresh its &quot;.menu&quot; container contents when the source changes. I'd be happy to refresh the menu myself through some JS in my plugin, but I've looked at the AJAX calls and can't spot any data related to the sortable attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My backup solution is to create my own AJAX service to fetch the updated attributes, but it would be really cool to do this with a minimal amount of hacks (the plugin already contains a few...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would greatly appreciate any ideas for solving this!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Footnote: It's actually weird that the hook runs when the source changes, as this directly contradicts &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/EntryElementType#defineSearchableAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;the following statement in the docs&lt;/a&gt;:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that this method will only get called once for the entire index; not each time that a new source is selected.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-18T08:10:49.437" LastActivityDate="2015-03-18T11:15:54.173" Title="Updating index tables' sortable attributes on AJAX" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;ajax&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8712" PostTypeId="1" AcceptedAnswerId="8713" CreationDate="2015-03-18T08:00:56.240" Score="6" ViewCount="605" Body="&lt;p&gt;This issue is very similar to the following issue, but this goes a little bit further. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/735/cache-tag-won-t-cache-in-a-template&quot;&gt;Cache tag won’t cache in a template&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page which is made up of hundreds of lazy loaded images similarly to this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;img data-original=&quot;{{ image.getUrl(transform) }}&quot; src=&quot;/img/placeholder.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The page takes anywhere between 2 and 5 seconds to load, and yet the server isn't under powered in any way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The majority of the images on the page aren't transformed within a few page loads. It's quite possible that there are images that no one will ever look at, therefore will never be transformed... Craft will hold off on caching until all the images are transformed; which might never happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could duplicate the template, and turn off lazy loading, and get my client to load that page every time they make changes, but I would prefer not having to ask my client to anything like that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from loading stuff via ajax when needed, does anyone know of an easy way to get all the images transformed or to get caching working so that it doesn't require all assets to be transformed?&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-18T15:59:46.440" Title="Cache/ColdCache &amp; checking for ungenerated image transforms" Tags="&lt;assets&gt;&lt;cache&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8713" PostTypeId="2" ParentId="8712" CreationDate="2015-03-18T08:25:02.330" Score="7" Body="&lt;p&gt;Set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;noreferrer&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; in your &lt;code&gt;config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Configures Craft to generate new image transforms right when getUrl() is called, rather than when the browser first requests the image.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-03-18T08:25:02.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8714" PostTypeId="1" AcceptedAnswerId="8717" CreationDate="2015-03-18T10:24:09.633" Score="0" ViewCount="39" Body="&lt;p&gt;I'm running Craft Pro 2.3.2640.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;{{ siteUrl }}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//localhost:3001/%3C/span%3E&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The opening tag stays intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also struggling to use this variable with functions like &quot;replace&quot; when I need to parse the referral url.&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-03-18T11:16:56.290" Title="Outputting siteUrl consumes next closing tag" Tags="&lt;templating&gt;&lt;siteurl&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8716" PostTypeId="2" ParentId="8710" CreationDate="2015-03-18T11:15:54.173" Score="2" Body="&lt;p&gt;The modifyEntrySortableAttributes technically gets called each time you load new elements on the index page, just so that the controller can confirm that the posted &lt;code&gt;order&lt;/code&gt; attribute is valid. But the only time that your plugin can actually affect what is shown in the dropdown is the first time it’s called, on page load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a better way to go about this would be to have your plugin return all the available options up front, and then simply hide/show them with JavaScript when the source changes.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-03-18T11:15:54.173" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8717" PostTypeId="2" ParentId="8714" CreationDate="2015-03-18T11:16:56.290" Score="2" Body="&lt;p&gt;Try to set the &lt;code&gt;siteUrl&lt;/code&gt; in config/general.php like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;    ),&#xA;    'localhost' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://localhost:3001/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then apply your replace filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;{{ siteUrl|replace({'localhost:3001': 'mysite.com'}) }}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-18T11:16:56.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8718" PostTypeId="1" CreationDate="2015-03-18T12:51:29.393" Score="0" ViewCount="126" Body="&lt;p&gt;I'm trying to programmatically set group permissions. I came across the method saveGroupPermissions(). According to the documentation all you have to do is pass in the group ID and then an array of the permissions you want to apply. Great, seems simple enough. So I attempted the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userPermissions-&amp;gt;saveGroupPermissions($group-&amp;gt;id, array(&quot;accesssitewhensystemisoff&quot;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The string &lt;code&gt;accesssitewhensystemisoff&lt;/code&gt; is a built-in Craft permission, I'm not attempting to set my own custom permission... Not even sure if that's possible but we'll save that discussion for later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway this is not working and I have no idea why. There are literally zero examples of how to properly do this so I'm wondering if anyone else has solved this problem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a related note does anyone know if it's possible to set a group permission that gives access to a plugin? Or do I need to whip up my own plugin to handle that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="57" LastEditDate="2015-03-18T16:54:55.607" LastActivityDate="2015-03-18T17:02:47.243" Title="Save Group Permissions" Tags="&lt;plugin-development&gt;&lt;user-groups&gt;&lt;permissions&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8719" PostTypeId="1" AcceptedAnswerId="8720" CreationDate="2015-03-18T13:03:54.070" Score="2" ViewCount="1224" Body="&lt;p&gt;Is it possible to have &quot;user defined&quot; crop areas (drag and crop) for upload assets of type image? What I had in mind is something exactly like craft has in the Admin &gt; Settings &gt; General Settings &gt; Logo&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3370" LastActivityDate="2016-02-20T07:49:29.370" Title="User defined crop / crop modal for image assets" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8720" PostTypeId="2" ParentId="8719" CreationDate="2015-03-18T14:36:26.537" Score="2" Body="&lt;p&gt;I haven't used this myself, but the Aviary Image Editor plugin should be ideal for what you need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/AviaryImageEditor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They also &lt;a href=&quot;https://twitter.com/fruitstudios/status/573948691029102592&quot; rel=&quot;nofollow&quot;&gt;tweeted&lt;/a&gt; about the plugin with a short video of it doing exactly what you are looking for in Craft. Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-03-18T14:36:26.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8721" PostTypeId="1" AcceptedAnswerId="8725" CreationDate="2015-03-18T15:29:27.080" Score="1" ViewCount="84" Body="&lt;p&gt;Is it dangerous for the longterm stability of the Craft database to modify user privileges (i.e. suspend users or change user group) at a database level?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somebody has gone into the database and suspended specific users and didn't use the Craft CP. Would doing this action in Craft CP modify more tables than just &quot;craft_users&quot;?&lt;/p&gt;&#xA;" OwnerUserId="446" LastActivityDate="2015-03-18T17:15:03.987" Title="What, if any, are the dangers to modifying users directly in the database?" Tags="&lt;users&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8722" PostTypeId="1" AcceptedAnswerId="8733" CreationDate="2015-03-18T15:35:49.497" Score="2" ViewCount="1008" Body="&lt;p&gt;I'm trying out AJAX submission for the PT Contact Form for the first time. I've managed to get errors appearing on the frontend, but I don't feel like I'm doing it the right way. It also doens't integrated at all with the &lt;code&gt;{% macro errorList(errors) %}&lt;/code&gt; code that comes with the form. This is my form JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function(){&#xA;    $('#ajax-form').submit(function(ev) {&#xA;        // Prevent the form from actually submitting&#xA;        ev.preventDefault();&#xA;&#xA;        // Get the post data&#xA;        var data = $(this).serialize();&#xA;&#xA;        // Send it to the server&#xA;        $.post('/', data, function(response) {&#xA;            if (response.success) {&#xA;                $('#thanks').fadeIn();&#xA;            } else {&#xA;                // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;                // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;                if (response.error.fromName) {$('ul.errors').append('&amp;lt;li&amp;gt;'+response.error.fromName+'&amp;lt;/li&amp;gt;');}&#xA;                if (response.error.fromEmail) {$('ul.errors').append('&amp;lt;li&amp;gt;'+response.error.fromEmail+'&amp;lt;/li&amp;gt;');}&#xA;                if (response.error.subject) {$('ul.errors').append('&amp;lt;li&amp;gt;'+response.error.subject+'&amp;lt;/li&amp;gt;');}&#xA;                if (response.error.message) {$('ul.errors').append('&amp;lt;li&amp;gt;'+response.error.message+'&amp;lt;/li&amp;gt;');}&#xA;            }&#xA;        });&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;&amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;    {% for error in errors %}&#xA;    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;ajax-form&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/contact&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;fromName&quot;&amp;gt;Name *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input class=&quot;form-control&quot; id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;    &amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Email *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input class=&quot;form-control&quot; id=&quot;fromEmail&quot; type=&quot;text&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;    &amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input class=&quot;form-control&quot; id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{% if message is defined %}{{ message.subject }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;    &amp;lt;label for=&quot;message&quot;&amp;gt;Message *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;textarea class=&quot;form-control&quot; rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;ul class=&quot;my-errors&quot;&amp;gt;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've had to put a blank &lt;code&gt;&amp;lt;ul class=&quot;my-errors&quot;&amp;gt;&amp;lt;/ul&amp;gt;&lt;/code&gt; under my form, as the &lt;code&gt;.error&lt;/code&gt; ul that comes with the contact form doesn't appear. Where am I going wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Desired result: I get exactly the same error handling as I would if I wasn't submitting via AJAX - i.e., the error messages relating to specific fields appear under those fields in the form.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-04-17T19:45:22.780" Title="How do you correctly handle errors using PT Contact Form when submitting via AJAX?" Tags="&lt;form&gt;&lt;ajax&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8723" PostTypeId="2" ParentId="8718" CreationDate="2015-03-18T17:02:47.243" Score="1" Body="&lt;p&gt;Try using &lt;code&gt;accessSiteWhenSystemIsOff&lt;/code&gt;.  If you're on a case-sensitive file system, that will matter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;does anyone know if it's possible to set a group permission that gives access to a plugin&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'll want a plugin for that. You can use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerUserPermissions&quot; rel=&quot;nofollow&quot;&gt;registerUserPermissions&lt;/a&gt; hook to register a custom permission.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-18T17:02:47.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8724" PostTypeId="2" ParentId="8679" CreationDate="2015-03-18T17:10:55.057" Score="2" Body="&lt;p&gt;OK, so I've come up with a working solution to this. It may not be the most elegant, but it works!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I allow up to 5 choices to be made, so in the form I make sure that there are 5 hidden form fields with the name &lt;code&gt;fields[choices][]&lt;/code&gt;. To output the existing choices so that people can edit them, I loop through the choices they have made, the output any blank value hidden fields to make the total 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my revised template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;entry-edit-form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;choices-saved&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ entry.sectionId }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    {# Get current list of choices to pre-set checkboxes #}&#xA;    {% set choices = entry.choices %}&#xA;    {% set choiceList = '' %}&#xA;    {% set numberOfChoicesMade = 0 %}&#xA;&#xA;    {# Fill out existing values to hidden fields #}&#xA;    {% for choice in choices %}&#xA;        {% set choiceList = choiceList ~ choice.id ~ &quot;,&quot; %}&#xA;        {% set numberOfChoicesMade = numberOfChoicesMade + 1 %}&#xA;        &amp;lt;input type=&quot;hidden&quot; class=&quot;choicesList&quot; name=&quot;fields[choices][]&quot; value=&quot;{{ choice.id }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {# Add as many blank fields as we need #}&#xA;    {% if numberOfChoicesMade &amp;lt; 5 %}&#xA;        {% for i in (numberOfChoicesMade + 1)..5 %}&#xA;            &amp;lt;input type=&quot;hidden&quot; class=&quot;choicesList&quot; name=&quot;fields[choices][]&quot; value=&quot;&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    {% for choice in choices %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;input class=&quot;choice-checkbox&quot; type=&quot;checkbox&quot; id=&quot;choice{{ loop.index }}&quot; data-id=&quot;{{ choice.id }}&quot; {% if choice.id in (choiceList|split(',')) %}checked=&quot;checked&quot;{% endif %} /&amp;gt;&#xA;            &amp;lt;label for=&quot;choice{{ loop.index }}&quot;&amp;gt;{{ choice.title }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;Save choices&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now in my javascript on form submission, I loop through the checkboxes to grab the ids of the checked boxes (from the data-id attribute).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then loop through these values, writing them to the values of the hidden &lt;code&gt;choicesList&lt;/code&gt; fields and deleting any remaining hidden &lt;code&gt;choicesList&lt;/code&gt; fields whose value is blank, before finally submitting the form.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-03-18T17:10:55.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8725" PostTypeId="2" ParentId="8721" CreationDate="2015-03-18T17:15:03.987" Score="2" Body="&lt;p&gt;Manually modifying &lt;em&gt;anything&lt;/em&gt; in the database inherently comes with risks.  The biggest is that you risk corrupting data by getting it in an inconsistent state across tables, which can cause foreign key constraint violation errors later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of suspending/un-suspending a user, that risk is pretty low since it's limited to just the &lt;code&gt;craft_users&lt;/code&gt; table, but in the case of changing user groups, it's higher because now you're talking about &lt;code&gt;craft_users&lt;/code&gt;, &lt;code&gt;craft_usergroups&lt;/code&gt;, &lt;code&gt;craft_usergroups_users&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases, you also need to take into account any plugins that might be using that data as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-18T17:15:03.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8726" PostTypeId="1" AcceptedAnswerId="8728" CreationDate="2015-03-18T17:20:14.310" Score="2" ViewCount="354" Body="&lt;p&gt;I want to get a better understanding of some issues in production surrounding timeouts but as its a high traffic site the craft logs get replaced about every 15 minutes due to the amount of 404's that are requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most are stuff like missing apple-touch-icons or old images from our last version of the site that are now gone. Is there any way to tell craft either to not log those 404s so that craft.log becomes a little more useful?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-03-18T17:54:15.537" Title="Can I disable logging 404 errors in my craft.log file?" Tags="&lt;error&gt;&lt;404&gt;&lt;logging&gt;&lt;timeout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8727" PostTypeId="1" AcceptedAnswerId="8729" CreationDate="2015-03-18T17:23:21.483" Score="0" ViewCount="201" Body="&lt;p&gt;I've checked it with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tagmodel#properties&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; but, tag model doesn't have &lt;code&gt;limit()&lt;/code&gt; property as entries have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wondering, If there is any way around to achieve it?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-03-18T18:19:02.400" LastActivityDate="2015-03-18T18:19:02.400" Title="Is there a way to limit output of Tags related to an entry?" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8728" PostTypeId="2" ParentId="8726" CreationDate="2015-03-18T17:54:15.537" Score="4" Body="&lt;p&gt;Not currently, but I agree it's kind of annoying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought maybe you could pull it off with a plugin since Yii does have an &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail&quot; rel=&quot;nofollow&quot;&gt;onException&lt;/a&gt; event, but there wouldn't be a way to disable logging of 404's without some code changes on our end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added it to our 3.0 list to add a config setting to disable logging of 404's though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-18T17:54:15.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8729" PostTypeId="2" ParentId="8727" CreationDate="2015-03-18T17:58:45.817" Score="3" Body="&lt;p&gt;A limit doesn't make sense on a single element model. But all ElementCriteriaModels have a &lt;code&gt;limit&lt;/code&gt; parameter and for &lt;code&gt;craft.tags&lt;/code&gt; it is &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.tags#limit&quot; rel=&quot;nofollow&quot;&gt;documented here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To limit the tags related to an entry via a Tags field don't use the &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields#templating&quot; rel=&quot;nofollow&quot;&gt;shortcut syntax&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.tagsFieldHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But modify the &lt;code&gt;craft.tags&lt;/code&gt; ElementCriteriaModel instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags({&#xA;    relatedTo: { sourceElement: entry, field: &quot;tagsFieldHandle&quot; },&#xA;    order:     &quot;sortOrder&quot;,&#xA;    limit:     null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-18T18:12:29.703" LastActivityDate="2015-03-18T18:12:29.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8730" PostTypeId="1" AcceptedAnswerId="8731" CreationDate="2015-03-18T20:10:47.030" Score="1" ViewCount="1124" Body="&lt;p&gt;In the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller documentation&lt;/a&gt; for plugins, there's a section that talks about routing to specific actions using a &lt;code&gt;Craft&lt;/code&gt; object like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = Craft.getActionUrl('cocktailRecipes/ingredients/saveIngredient', { id: 10 });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this object is the one in &lt;code&gt;/craft/app/resources/js/craft.js&lt;/code&gt;, but I can't figure out how to make it available. I tried including it via &lt;code&gt;includeJsResource&lt;/code&gt;, but this doesn't appear to be working&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource &quot;resources/js/craft.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I need to include to be able to use this object in my JavaScript (it is not a load ordering issue, the URL generated by includeJsResource goes to the 404 page)?&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="344" LastEditDate="2015-05-28T12:28:58.090" LastActivityDate="2015-05-28T12:28:58.090" Title="Include Craft JS object" Tags="&lt;plugin-development&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8731" PostTypeId="2" ParentId="8730" CreationDate="2015-03-18T21:23:42.437" Score="2" Body="&lt;p&gt;The &lt;code&gt;Craft&lt;/code&gt; global variable is available to any Javascript running in the backend/Control Panel, without including anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not possible to include, reference or use the global for any code running in the frontend.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To provide access to a controller action for frontend Javascript, I'd recommend setting up a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow&quot;&gt;site route&lt;/a&gt; in your plugin's main class. The following will route the URL &lt;code&gt;http://yourbaseurl/myplugin/foobar/add&lt;/code&gt; to &lt;code&gt;ExampleController&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'myplugin/foobar/add' =&amp;gt; array('action' =&amp;gt; 'myPlugin/example/add'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the ExampleController, be sure to set the &lt;code&gt;$allowAnonymous&lt;/code&gt; class variable to &lt;code&gt;true&lt;/code&gt;. This allows visitors that aren't logged in to Craft access (beware that this will make &lt;em&gt;all&lt;/em&gt; your controller´s actions accessible without login):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin_ExampleController extends BaseController&#xA;{&#xA;   protected $allowAnonymous = true;&#xA;   public function actionAdd()&#xA;   {&#xA;       // Your code here           &#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-19T00:57:23.603" LastActivityDate="2015-03-19T00:57:23.603" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="8732" PostTypeId="1" AcceptedAnswerId="8735" CreationDate="2015-03-18T23:03:52.977" Score="3" ViewCount="464" Body="&lt;p&gt;I'd like to use the asterisk token functionality that is available in the CP in my plugin. This way I can have an infinite amount of 'pages' under certain routes. In the CP, it looks like &lt;strong&gt;myroute/*&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible for me to get the same functionality in my plugin routes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes have been working amazing for me via the standard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;    'myroute' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;  );    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Though when I try the asterisk trick, it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;    'myroute/*' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;  );    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if this is possible and/or the way to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-03-19T00:05:54.180" Title="Plugin Routes: Asterisk Token effect from CP Routes" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;php&gt;&lt;token&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8733" PostTypeId="2" ParentId="8722" CreationDate="2015-03-18T23:19:56.687" Score="5" Body="&lt;p&gt;If you want the error messages to be displayed identical to P&amp;amp;T's template/macro default, this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function(){&#xA;    $('#ajax-form').submit( function(ev) {&#xA;&#xA;        // Prevent the form from actually submitting&#xA;        ev.preventDefault();&#xA;&#xA;        // Remove any existing error messages from previous attempts&#xA;        $(this).find( '.errors' ).remove();&#xA;&#xA;        // Get the post data&#xA;        var data = $(this).serialize();&#xA;&#xA;        // Send it to the server&#xA;        $.post('/', data, function(response) {&#xA;&#xA;            if (response.success) {&#xA;&#xA;                // All good!&#xA;                $('#thanks').fadeIn();&#xA;&#xA;            } else {&#xA;&#xA;                // Loop through the errors and append to relevant fields&#xA;                for ( var fieldId in response.error ) {&#xA;&#xA;                    // Create the &amp;lt;ul&amp;gt;&#xA;                    var $errors = $( '&amp;lt;ul class=&quot;errors&quot; /&amp;gt;' );&#xA;&#xA;                    // Wrap the error messages in &amp;lt;li&amp;gt; tags&#xA;                    var messages = $.map(response.error[fieldId], function(message){&#xA;                        return '&amp;lt;li&amp;gt;' + message + '&amp;lt;/li&amp;gt;';&#xA;                    });&#xA;&#xA;                    // Append the error messages to the ul&#xA;                    $errors.append( messages.join( '' ) );&#xA;&#xA;                    // Select the input element and append the .errors &amp;lt;ul&amp;gt; after it.&#xA;                    $('#'+fieldId).after($errors);&#xA;&#xA;                }&#xA;&#xA;            }&#xA;        });&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just to be clear though, the PT Contact Form template doesn't force you to display your error messages in any given way; both the contact form template as a whole, and specifically how error messages are displayed (both the template macro for non-Ajax requests and the stuff in the &lt;code&gt;response.error&lt;/code&gt; object) is obviously totally up to you.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="271" LastEditDate="2015-04-17T19:45:22.780" LastActivityDate="2015-04-17T19:45:22.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8734" PostTypeId="1" AcceptedAnswerId="11921" CreationDate="2015-03-18T23:45:22.123" Score="3" ViewCount="4896" Body="&lt;p&gt;So i'm trying to output blog entries related to a category.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I first created a category group ('categories')&lt;/li&gt;&#xA;&lt;li&gt;I added several categories to the group ('innovation', 'teams', etc)&lt;/li&gt;&#xA;&lt;li&gt;I added a category field to my blog post matrix field (post.category)&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On my blog index page (example.com/blog) I have excerpts of posts and a sidebar which has the categories and their urls&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set categories = craft.categories.group('categories') %}&#xA;&#xA; {% for category in categories %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When I click on the link it goes to the page I expect (example.com/categories/teams) and is using the template i specified for the template group (categories.html)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the template for the category I can list the title and name but I want to get the entries so I:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt; &amp;lt;--- just this works&#xA;{% set posts = craft.entries.relatedTo(category) %}&#xA;{% for post in posts %}&#xA;&amp;lt;p&amp;gt;{{ post.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But this didn't work&lt;/p&gt;&#xA;&#xA;&lt;p&gt;following &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;7&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;then I tried this, thinking specifying the field was necessary&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt; &amp;lt;--- again, this works&#xA;{% set posts = craft.entries({&#xA;section: 'blog',&#xA;relatedTo: {&#xA;targetElement: category,&#xA;field: 'posts.categories'&#xA;}&#xA;}) %}&#xA;&#xA;{% for post in posts %}&#xA;&amp;lt;p&amp;gt;{{ post.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;and this doesn't work either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, i'm not sure where I am going wrong and any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3366" LastActivityDate="2015-10-15T00:30:18.813" Title="Craft entries related on a category page" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8735" PostTypeId="2" ParentId="8732" CreationDate="2015-03-18T23:50:53.137" Score="6" Body="&lt;p&gt;You can't have tokens in your plugin routes, but you can easily add a segment variable that recreates the asterisk token's functionality with some regex. According to the the &lt;a href=&quot;http://buildwithcraft.com/docs/routing#available-tokens&quot; rel=&quot;nofollow noreferrer&quot;&gt;official docs on routing&lt;/a&gt;, the asterisk represents&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(...) any string of characters, except for a forward slash (/)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's what the defintion for a route with a &quot;asterisk-like&quot; segment could look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'myroute/(?P&amp;lt;asteriskToken&amp;gt;[-\w]+)' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;    );    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that the string &quot;asteriskToken&quot; will be the variable name for this route segment's value when it is passed to your controller. It could be named anything.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above route will match any URIs such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/myroute/whatever &lt;em&gt;(asterisk token will be &quot;whatever&quot;)&lt;/em&gt;&lt;br&gt;&#xA;/myroute/123 &lt;em&gt;(asterisk token will be &quot;123&quot;)&lt;/em&gt;&lt;br&gt;&#xA;/myroute//foobar &lt;em&gt;(asterisk token will be &quot;foobar&quot;)&lt;/em&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to your controller, here's how you could look up the asterisk token variable's value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAction( array $variables = array() )&#xA;{&#xA;   $asteriskToken = $variables[ 'asteriskToken' ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be aware that any calls to /myroute (i.e. without the second segment) will now 404. If this is unwanted – or if you want to define a default value for your asterisk variable – you can make the asterisk token segment &lt;em&gt;optional&lt;/em&gt;. This is done by wrapping the segment variable in parentheses and appending a question mark at the end (kudos to &lt;a href=&quot;https://craftcms.stackexchange.com/users/125/carlcs&quot;&gt;@carlcs&lt;/a&gt; for this trick, originally given as an &lt;a href=&quot;https://craftcms.stackexchange.com/a/8569/1098&quot;&gt;answer to my question here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'myroute(/(?P&amp;lt;asteriskToken&amp;gt;[-\w]+))?' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the latter regex, your route will now also match the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/myroute &lt;em&gt;(asterisk token will be &lt;strong&gt;undefined&lt;/strong&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and in your controller, here's how you could define a default value for the asterisk token variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$asteriskToken = isset( $variables[ 'asteriskToken' ] ) ? $variables[ 'asteriskToken' ] : 'myDefaultAsteriskValue';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-19T00:05:54.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8736" PostTypeId="1" CreationDate="2015-03-19T02:32:42.053" Score="3" ViewCount="179" Body="&lt;p&gt;I want to use the note that is optional when saving a versioned entry as part of an activity feed -- like a git commit message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an entry model property for this?&lt;/p&gt;&#xA;" OwnerUserId="3425" LastActivityDate="2015-03-19T04:03:09.330" Title="Displaying the optional note from a versioned entry" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8737" PostTypeId="2" ParentId="8736" CreationDate="2015-03-19T02:52:42.190" Score="4" Body="&lt;p&gt;Indeed... &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/EntryModel.php#L259&quot; rel=&quot;nofollow&quot;&gt;EntryModel-&gt;revisionNotes&lt;/a&gt; is what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through PHP, that's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;revisionNotes&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Through a template, that's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.revisionNotes }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-19T04:03:09.330" LastActivityDate="2015-03-19T04:03:09.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8739" PostTypeId="1" AcceptedAnswerId="8747" CreationDate="2015-03-19T09:21:38.770" Score="5" ViewCount="1004" Body="&lt;p&gt;I'm trying to get elements in a section created on a specific date. How do I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've been trying with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria               = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section  = 'sectionHandle';&#xA;$criteria-&amp;gt;postDate     = '2014-11-04';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-03-19T17:13:54.013" Title="How do I get elements using getCriteria from a specific date?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8741" PostTypeId="1" AcceptedAnswerId="8762" CreationDate="2015-03-19T14:21:33.887" Score="7" ViewCount="368" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;noreferrer&quot;&gt;Craft documentation&lt;/a&gt; on Section Types state that they themselves are created using a Structure. Can someone explain the method they used here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd really like to see is the Twig code for the left hand navigation. Are there multiple Structures here (to account for the headings) and if not, how are the headings set?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2015-03-20T03:20:30.597" Title="How are the Craft docs created?" Tags="&lt;templating&gt;&lt;structure&gt;&lt;navigation&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8742" PostTypeId="1" AcceptedAnswerId="8761" CreationDate="2015-03-19T14:31:53.817" Score="1" ViewCount="413" Body="&lt;p&gt;I have an ee site which I can't move over to Craft yet (need a commenting plugin) but I need to extend the site quite a bit. I'm thinking of either installing Craft in a subdomain or a subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a Friday chat Brandon advised to go with a subdomain, as having Craft in a subfolder of an ee site that I would/might run into session problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is installing Craft into a subfolder of an ee site a complete no no, or are the potential session problems avoidable? Anything else to lookout for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-03-19T23:23:54.693" Title="Install Craft in a subfolder of an ee site?" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8743" PostTypeId="2" ParentId="538" CreationDate="2015-03-19T14:37:36.623" Score="2" Body="&lt;p&gt;Just wanted to add on to &lt;a href=&quot;https://craftcms.stackexchange.com/a/5432/45&quot;&gt;Brian's post&lt;/a&gt; about permissions, for future users who are having a similar issue and stumble across this answer. I was running into similar problems locally using MAMP, and found the Apache group for OS X is _www. Once I did the command &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo chown -R sudo_user:_www /Sites/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;everything loaded as expected. Obviously the &quot;Sites/craft&quot; directory is my own path. Yours will probably be different.&lt;/p&gt;&#xA;" OwnerUserId="895" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-19T22:44:04.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8744" PostTypeId="1" AcceptedAnswerId="8748" CreationDate="2015-03-19T16:08:45.370" Score="11" ViewCount="5822" Body="&lt;p&gt;Currently I am sorting the entries by an ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for gallery in craft.entries.section('Gallery').order('available desc').limit(none) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I would like to show the latest entries on top, currently it shows available first but latest entries ones go to the bottom. How can I mix the above code with something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.order('postDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="979" LastEditorUserId="57" LastEditDate="2015-03-19T17:20:09.547" LastActivityDate="2015-09-01T08:56:38.297" Title="How do I sort entries by two variables?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8745" PostTypeId="2" ParentId="397" CreationDate="2015-03-19T16:44:24.633" Score="4" Body="&lt;p&gt;I have developed a plugin to do this &lt;a href=&quot;https://github.com/james1238/duplicateuserdashboard&quot; rel=&quot;nofollow&quot;&gt;https://github.com/james1238/duplicateuserdashboard&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3429" LastActivityDate="2015-03-19T16:44:24.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8746" PostTypeId="2" ParentId="1029" CreationDate="2015-03-19T16:47:48.443" Score="2" Body="&lt;p&gt;I have just made a plugin to do a similar thing it duplicates a selected users dashboard see &lt;a href=&quot;https://github.com/james1238/duplicateuserdashboard&quot; rel=&quot;nofollow&quot;&gt;https://github.com/james1238/duplicateuserdashboard&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3429" LastActivityDate="2015-03-19T16:47:48.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8747" PostTypeId="2" ParentId="8739" CreationDate="2015-03-19T17:13:54.013" Score="9" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section  = 'sectionHandle';&#xA;$criteria-&amp;gt;postDate = array('and', '&amp;gt; 2014-11-03 23:59:59', '&amp;lt; 2014-11-05 00:00:00');&#xA;$results = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-19T17:13:54.013" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8748" PostTypeId="2" ParentId="8744" CreationDate="2015-03-19T17:21:15.680" Score="17" Body="&lt;p&gt;If you want to order by multiple columns that include custom fields, first make sure you're at least on &lt;a href=&quot;http://buildwithcraft.com/updates#build2684&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.4.2684&lt;/a&gt;, then you'll be able to use this syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for gallery in craft.entries.section('Gallery').order('postDate desc, available desc').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also note that that you should be using &lt;code&gt;limit(null)&lt;/code&gt; instead of &lt;code&gt;limit(none)&lt;/code&gt; if you want to result all results.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2015-09-01T08:56:38.297" LastActivityDate="2015-09-01T08:56:38.297" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8749" PostTypeId="1" AcceptedAnswerId="8750" CreationDate="2015-03-19T17:27:01.097" Score="1" ViewCount="1395" Body="&lt;p&gt;I get &quot;Variable &lt;code&gt;career&lt;/code&gt; does not exist&quot;. I'll just go straight to the code example...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set ECM and get the entries stored in variable &quot;entries&quot; #}&#xA;{% set entries = craft.entries.getAllSections('and, not career').type('news').order('RAND()').limit(3) %}&#xA;&#xA;{# Conditional statement - if more entries than 0, we output them. If false, we set other conditional statement/s. #}&#xA;{% if entries|length &amp;gt; 0 %}&#xA;&#xA;    {# Loop through entries #}&#xA;    {% for entry in entries %}      &#xA;        &amp;lt;li&amp;gt;&#xA;            {# My Stuff #}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {# Set ECM and get the entries stored in variable &quot;career&quot; #}&#xA;    {% set career = craft.entries.section('career').type('news') %}&#xA;&#xA;{% elseif career %}&#xA;&#xA;    {# Loop through career #}&#xA;    {% for career in career %}      &#xA;        &amp;lt;li&amp;gt;&#xA;            {# My Stuff #}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it because of the first variable &lt;code&gt;entries&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="45" LastEditDate="2015-03-19T18:52:03.753" LastActivityDate="2015-03-19T18:52:03.753" Title="Variable doesn't exist" Tags="&lt;variable&gt;&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8750" PostTypeId="2" ParentId="8749" CreationDate="2015-03-19T18:37:50.300" Score="2" Body="&lt;p&gt;The problem is that you are setting &lt;code&gt;career&lt;/code&gt; &lt;strong&gt;inside of&lt;/strong&gt; the &lt;code&gt;if&lt;/code&gt; statement. Defining it there won't make it available for your &lt;code&gt;elseif&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've trimmed down your code so you can see exactly what the problem is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = ... %}&#xA;&#xA;{% if entries|length &amp;gt; 0 %}&#xA;&#xA;    {% set career = ... %}&#xA;&#xA;{% elseif career %}&#xA;&#xA;    ...&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want &lt;code&gt;career&lt;/code&gt; to be available to your &lt;code&gt;elseif&lt;/code&gt; statement, you need to define it &lt;strong&gt;before&lt;/strong&gt; your &lt;code&gt;if&lt;/code&gt; statement.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-19T18:37:50.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8751" PostTypeId="2" ParentId="8518" CreationDate="2015-03-19T19:43:35.827" Score="2" Body="&lt;p&gt;You could try out my new &lt;a href=&quot;https://github.com/carlcs/craft-assetmetadata&quot; rel=&quot;nofollow&quot;&gt;&quot;Asset Metadata&quot;&lt;/a&gt; plugin. It makes use of the &lt;a href=&quot;https://github.com/JamesHeinrich/getID3/&quot; rel=&quot;nofollow&quot;&gt;getID3&lt;/a&gt; PHP library to extract all sort of metadata from your assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make your life a bit easier, I added further beautified metadata properties like a sound file's playtime duration in ISO 8601 date interval format (i.e. &lt;code&gt;PT1H21M48S&lt;/code&gt;), or a photo's exposure time as a ratio.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-19T19:43:35.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8752" PostTypeId="1" AcceptedAnswerId="8759" CreationDate="2015-03-19T19:59:12.057" Score="3" ViewCount="1241" Body="&lt;p&gt;I'm trying to test a new plugin in development, is there any easy way to downgrade the version of craft?&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-03-19T21:56:32.033" Title="How do you downgrade Craft" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8753" PostTypeId="1" CreationDate="2015-03-19T20:10:19.240" Score="2" ViewCount="148" Body="&lt;p&gt;I've been able to customize the locale feature for use in a multi-site project, by creating custom locals in /craft/framework/i18n/data. So now each locale has the site name, instead of a language code like &quot;en_au&quot;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;veerlofts' =&amp;gt; 'Veer Lofts',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'ab' =&amp;gt; 'Abkhazian',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, now I can't delete any of the locales (custom or otherwise) in /admin/settings/locales. It gives me this console error in locales.js:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught TypeError: Cannot read property 'name' of undefined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These older (whether standard out of the box or custom) locales are still defined in /craft/framework/i18n/data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another strange thing, if it helps troubleshoot, is that during the first round of trying to customize the locales, the longer custom names were getting truncated to 12 characters, all lowercase.  Those are the ones I'm trying to delete, so the CMS users won't get confused.See attached screen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/es0TT.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3431" LastActivityDate="2015-03-19T21:46:29.670" Title="Any way to force delete a locale?" Tags="&lt;localization&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8754" PostTypeId="1" AcceptedAnswerId="8760" CreationDate="2015-03-19T20:21:49.317" Score="2" ViewCount="705" Body="&lt;p&gt;After learning how to use dynamic routing in MyPluginPlugin.php, I quickly ran into the issue of if the URL has special characters from url_encode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;return array(&#xA;    'myroute/(?P&amp;lt;myVariable&amp;gt;[-\w]+)' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;);    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I process some variables before rendering the template in myPlugin/myAction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function actionLoadTemplate( array $variables = array() )&#xA; {&#xA;   /*&#xA;   process &amp;amp; build $variables&#xA;   */&#xA;&#xA;    $this-&amp;gt;renderTemplate('layouts/forums/_entry', $variables);&#xA;&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great if the route looks like &lt;code&gt;myroute/check-this-out&lt;/code&gt;, however if the route had a special character in it, say it was &quot;check-this-out!&quot;, it understandably leads to a 404. But with using url_encode on the URL so it looks like &lt;code&gt;myroute/check-this-out%21&lt;/code&gt;, it still leads to a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When testing manually in the CP route section, if I create &lt;code&gt;myroute/*&lt;/code&gt; with the token, I don't get a 404 with those special characters after using url_encode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to modify &lt;code&gt;(?P&amp;lt;myVariable&amp;gt;[-\w]+)&lt;/code&gt; so that it works with url-safe special characters just like the CP version does? &lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-03-19T23:22:10.330" Title="Dynamic routing via plugin with special characters" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8755" PostTypeId="1" CreationDate="2015-03-19T21:02:10.230" Score="0" ViewCount="501" Body="&lt;p&gt;I'm confused about how to use an uploaded asset in a template (or rather why it isn't working).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I create an asset source and folder (Note: I did not add any fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I added this as a field in my entry fields called heroImage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) I uploaded an asset to my single entry for the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) I added this to the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.heroImage %}&#xA;             {{ asset.url() }}&#xA;             XXXX&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;5) I also tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set assets = entry.heroImage %}&#xA;    {% if assets | length %}&#xA;      &amp;lt;h3&amp;gt;Some great assets&amp;lt;/h3&amp;gt;&#xA;      {% for asset in assets %}&#xA;          {{ asset.url }}&#xA;      {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the image on the entry page but the template wont render it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be &lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-03-19T21:12:05.387" Title="Using Asset Field in a Template" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8756" PostTypeId="2" ParentId="8755" CreationDate="2015-03-19T21:12:05.387" Score="4" Body="&lt;p&gt;Unless I'm misunderstanding the question, surely you'll need to use an IMG tag?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in assets %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-03-19T21:12:05.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8758" PostTypeId="2" ParentId="8753" CreationDate="2015-03-19T21:46:29.670" Score="2" Body="&lt;p&gt;You're going to have to remove them directly from the database's &lt;code&gt;craft_locales&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're using &quot;locales&quot; in a way we originally didn't design them for, which is why they're getting truncated at 12 characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're going to do this, you'll need to keep them at 12 characters or less for them to work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-19T21:46:29.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8759" PostTypeId="2" ParentId="8752" CreationDate="2015-03-19T21:56:32.033" Score="2" Body="&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/223/where-can-i-download-previous-versions-of-craft/224#224&quot;&gt;here&lt;/a&gt; for how you can download previous versions of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is replace the existing app folder with the one you just downloaded and restore a database backup that has the same build/version numbers in its &lt;code&gt;craft_info&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-19T21:56:32.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8760" PostTypeId="2" ParentId="8754" CreationDate="2015-03-19T22:20:47.907" Score="4" Body="&lt;p&gt;You'll need to update the regex to allow for additional characters.  For example, if you want to allow &lt;code&gt;!&lt;/code&gt;, then this will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'myroute/(?P&amp;lt;myVariable&amp;gt;[-\w\!]+)' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;\w&lt;/code&gt; is essentially the same as writing &lt;code&gt;[A-Za-z0-9_]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-19T23:22:10.330" LastActivityDate="2015-03-19T23:22:10.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8761" PostTypeId="2" ParentId="8742" CreationDate="2015-03-19T23:23:54.693" Score="2" Body="&lt;p&gt;In additional to the potential session headaches, you'd also have to worry about getting the &lt;code&gt;.htaccess&lt;/code&gt; rewrite rules to play together for each installation considering they inherit from any parent folders.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-19T23:23:54.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8762" PostTypeId="2" ParentId="8741" CreationDate="2015-03-20T03:20:30.597" Score="6" Body="&lt;p&gt;There is a &lt;code&gt;Documentation&lt;/code&gt; structured section with three entry types.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;Heading Only&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Page&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Link&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Getting Started&lt;/code&gt;, &lt;code&gt;Core Concepts&lt;/code&gt;, etc. headers are the &lt;code&gt;Heading Only&lt;/code&gt; entry type. The only field is has is a title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The majority of the docs are using the &lt;code&gt;Page&lt;/code&gt; entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Link&lt;/code&gt; entry type is used for the entries like &lt;code&gt;Full Templating Reference&lt;/code&gt; and &lt;code&gt;Plugin Development&lt;/code&gt; that open into a new window, and those are their own separate structured sections.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-20T03:20:30.597" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8763" PostTypeId="1" AcceptedAnswerId="8784" CreationDate="2015-03-20T09:47:17.853" Score="2" ViewCount="1495" Body="&lt;p&gt;I'm deciding on the best way to have code blocks in my content. I'm doing something similar to Craft Docs. Do you have any best practices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm thinking about having a matrix field for the whole entry content - and then just add a Title block, a Rich text block and a Regular text with line breaks for code. I'd then use Prism.js in the frontend to format the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I could use another field to identify language for syntax highlighting for each Regular text block. Has anyone seen a special field type dedicated for syntax highlighting? I'd love to have syntax highlighting already in the admin and also a better way to choose language type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any insights!&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2015-03-21T23:38:26.347" Title="How to create code blocks with syntax highlighting" Tags="&lt;matrix&gt;&lt;custom-fieldtype&gt;&lt;block-types&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8764" PostTypeId="2" ParentId="8678" CreationDate="2015-03-20T10:30:41.287" Score="1" Body="&lt;p&gt;Digging into a past solution for checkboxes thanks to @bradbell, here's the answer!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;select name=&quot;fields[honorific]&quot;&amp;gt;&#xA;     {% for honortitle in entry.honorific.options %}&#xA;         {% set chosen = false %}&#xA;&#xA;         {% if honortitle.selected %}&#xA;             {% set chosen = true %}&#xA;         {% endif %}&#xA;&#xA;         &amp;lt;option value=&quot;{{ honortitle.value }}&quot;{% if chosen %} selected{% endif %}&amp;gt;{{ honortitle.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA; &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="264" LastEditorUserId="57" LastEditDate="2015-03-20T15:17:56.343" LastActivityDate="2015-03-20T15:17:56.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8765" PostTypeId="1" AcceptedAnswerId="8767" CreationDate="2015-03-20T11:17:32.237" Score="0" ViewCount="677" Body="&lt;p&gt;I have one user group created, several users in it excludes admin.&#xA;I've tested it includes admin to that user group, but with no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create an entry in channel as admin and check at front end for author of the entry, you'll see not admin, but actually the data of a first user created in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it done on purpose? If so, What is it, so I understand that.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="125" LastEditDate="2015-03-20T11:53:35.393" LastActivityDate="2015-03-20T11:53:35.393" Title="How to get the author of an entry?" Tags="&lt;users&gt;&lt;entry&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8766" PostTypeId="1" CreationDate="2015-03-20T11:24:46.387" Score="2" ViewCount="79" Body="&lt;p&gt;For each locale I have a different author which I want to display on the front-end. But at this point author does not seem to per locale? Is the only way to achieve this by adding  a users field?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="344" LastEditDate="2015-03-20T11:57:35.943" LastActivityDate="2015-03-20T11:57:35.943" Title="Author per locale" Tags="&lt;users&gt;&lt;localization&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8767" PostTypeId="2" ParentId="8765" CreationDate="2015-03-20T11:48:46.120" Score="2" Body="&lt;p&gt;You get the author's username of an entry via it's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;entry model&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-20T11:48:46.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8768" PostTypeId="2" ParentId="8766" CreationDate="2015-03-20T11:49:24.153" Score="2" Body="&lt;p&gt;Author fields aren't translatable, so if you change the author in one locale this would apply for all locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you say, you could create a simple User field that is translatable, where you could set a user as being the 'Author' which you could then output on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would work, but in Craft's eyes the true Author will always be the same user for every locale.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-03-20T11:56:30.790" LastActivityDate="2015-03-20T11:56:30.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8769" PostTypeId="1" AcceptedAnswerId="8771" CreationDate="2015-03-20T14:15:07.040" Score="2" ViewCount="382" Body="&lt;p&gt;I'm trying to output a list of Brand names grouped by first letter. But some items have a number or symbol in the name. I want to list first the Numbers and symbols under 0-9 and the rest of the brands under A-Z&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;0-9&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;+People&lt;/li&gt;&#xA;&lt;li&gt;10 Days&lt;/li&gt;&#xA;&lt;li&gt;2Two&lt;/li&gt;&#xA;&lt;li&gt;40 Weft&lt;/li&gt;&#xA;&lt;li&gt;55 DSL&lt;/li&gt;&#xA;&lt;li&gt;81hours&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Acne&lt;/li&gt;&#xA;&lt;li&gt;Adidas&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;B.Young&lt;/li&gt;&#xA;&lt;li&gt;etc etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-03-20T15:43:45.650" Title="List Categories by 0-9 and A-Z" Tags="&lt;templating&gt;&lt;categories&gt;&lt;array&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8771" PostTypeId="2" ParentId="8769" CreationDate="2015-03-20T15:21:27.227" Score="5" Body="&lt;p&gt;To group by the first letter you would simply use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter within Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt;&#xA;filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all non letter characters you can now use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;replace&lt;/code&gt;&lt;/a&gt; filter (it does regex since Craft 2.2)&#xA;and replace them with whatever you want these entries to be sorted by.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesGrouped = entries|group('title|slice(0, 1)|upper|replace(&quot;/[^A-Z]/&quot;, &quot;0-9&quot;)') %}&#xA;&#xA;{% for letter, entriesInGroup in entriesGrouped %}&#xA;    {{ letter }}&#xA;    {% for entry in entriesInGroup %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-20T15:43:45.650" LastActivityDate="2015-03-20T15:43:45.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8772" PostTypeId="2" ParentId="8763" CreationDate="2015-03-20T15:52:05.103" Score="4" Body="&lt;p&gt;On Straight up Craft we use a &lt;a href=&quot;https://github.com/selvinortiz/craft.doxter&quot; rel=&quot;nofollow&quot;&gt;Doxter&lt;/a&gt; Block for Markdown and &lt;a href=&quot;http://craig.is/making/rainbows&quot; rel=&quot;nofollow&quot;&gt;Rainbow.js&lt;/a&gt; with a custom &lt;a href=&quot;https://github.com/BarrelStrength/Craft-Twig-Rainbow.js&quot; rel=&quot;nofollow&quot;&gt;Craft-Twig extension&lt;/a&gt; for syntax highlighting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doxter allows you to identify the code block like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;``` twig&#xA;{{ siteUrl }}&#xA;```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;``` php&#xA;&amp;lt;?php echo &quot;hello world&quot;; ?&amp;gt;&#xA;```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you can view the syntax in highlighting in the CP before you publish using Live Preview.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-03-20T20:11:29.480" LastActivityDate="2015-03-20T20:11:29.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8773" PostTypeId="1" AcceptedAnswerId="8774" CreationDate="2015-03-20T16:23:39.193" Score="4" ViewCount="1171" Body="&lt;p&gt;Is it possible somehow to add custom fields to the users in Craft?&#xA;I'd like the users to be able to add a Bio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can add a channel but wondering if I am missing something obvious or if this would be a good feature request?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to add, bio, social media info ect, about the author etc.&lt;/p&gt;&#xA;" OwnerUserId="774" LastEditorUserId="344" LastEditDate="2015-03-20T16:36:04.350" LastActivityDate="2015-03-20T16:36:04.350" Title="Custom fields on users" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8774" PostTypeId="2" ParentId="8773" CreationDate="2015-03-20T16:33:20.400" Score="8" Body="&lt;p&gt;Yes you can. Go to &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Users&lt;/strong&gt; then the &lt;strong&gt;Fields&lt;/strong&gt; tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can add fields just like you would for categories or entry types.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-03-20T16:33:20.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8775" PostTypeId="1" AcceptedAnswerId="8776" CreationDate="2015-03-20T16:59:38.097" Score="6" ViewCount="882" Body="&lt;p&gt;I'm trying to delete items through the frontend with ajax. It's working now but want to be sure if this is a safe method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;.delete-file&quot;).click(function(){&#xA;    var data = {&#xA;        entryId: $(this).attr(&quot;data-id&quot;), &#xA;    };&#xA;&#xA;    data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;    $.ajax({&#xA;        context: this,&#xA;        type: &quot;post&quot;,&#xA;        dataType: &quot;json&quot;,&#xA;        data: data,&#xA;        url: &quot;/actions/entries/deleteEntry&quot;,&#xA;        success: function(data, response){&#xA;            $(this).parents('.account-item').remove();&#xA;            console.log(&quot;success&quot;, response, data);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastEditorUserId="344" LastEditDate="2015-03-20T17:04:10.143" LastActivityDate="2015-03-20T17:27:24.010" Title="Delete items from frontend with ajax" Tags="&lt;entries&gt;&lt;form&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8776" PostTypeId="2" ParentId="8775" CreationDate="2015-03-20T17:27:24.010" Score="5" Body="&lt;p&gt;That looks perfect!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this code doesn't prompt the user to confirm deletion, but that can easily be added. (Or perhaps you stripped that out of your example.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are specifically doing two things right here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Hitting &lt;code&gt;deleteEntry&lt;/code&gt; directly.&lt;/strong&gt; This ensures that Craft follows all of its necessary internal procedures to properly delete the entry (and kill any relationships it may have).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Including the CSRF token information.&lt;/strong&gt; Not sure if it's currently required for hitting a native Craft method, but it certainly will be when Craft 3 rolls out. Good future-proofing!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Looks great Johannes, go for it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-20T17:27:24.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8777" PostTypeId="1" AcceptedAnswerId="8779" CreationDate="2015-03-20T17:51:32.693" Score="2" ViewCount="3126" Body="&lt;p&gt;I'm trying to grab the query or param from an URL and then add it to an URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;like products?price=15&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add the ?price=15 to a URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like products/category?price=15?&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-03-20T19:13:55.633" Title="How to get query or param from URL and then use in Links?" Tags="&lt;queries&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8778" PostTypeId="1" CreationDate="2015-03-20T17:59:17.073" Score="0" ViewCount="482" Body="&lt;p&gt;I am trying to filter an entry's matrix blocks to just the ones with either operational &lt;strong&gt;OR&lt;/strong&gt; hazardous checked (lightswitch). I can chain it together with one, how do you grab items with &lt;em&gt;either&lt;/em&gt; checked? See the end of the following line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filteredComponents = entry.propertyComponents.relatedTo(category).status('live').order('componentName asc').operational('= 1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2015-03-20T17:59:17.073" Title="Filtering Matrix blocks" Tags="&lt;matrix&gt;&lt;filter&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8779" PostTypeId="2" ParentId="8777" CreationDate="2015-03-20T17:59:48.223" Score="6" Body="&lt;p&gt;Use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getQueryStringWithoutPath&quot; rel=&quot;nofollow&quot;&gt;craft.request.getQueryStringWithoutPath()&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;products/category?{{craft.request.getQueryStringWithoutPath()}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Returns the query string, except for the &lt;code&gt;p=&lt;/code&gt; param (which was probably added by your .htaccess redirect).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;More complicated logic to avoid the &lt;strong&gt;?&lt;/strong&gt; when the query string is empty (one of several ways to do this):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# queryString will include '?' if we have one, otherwise '' #}&#xA;{% set queryString = (craft.request.getQueryStringWithoutPath() ? '?'~craft.request.getQueryStringWithoutPath()) %}&#xA;products/category{{queryString}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-03-20T19:13:55.633" LastActivityDate="2015-03-20T19:13:55.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8780" PostTypeId="1" CreationDate="2015-03-20T18:42:34.920" Score="1" ViewCount="1093" Body="&lt;p&gt;So I have an entry that has some content displayed in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However ahead of displaying that entry, I want a plugin's action to fire, which pulls some data in from a third party API that will display along with the entry content in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data from the plugin would need to be available in the template that gets loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best approach to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my routes.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    'book' =&amp;gt; array(&#xA;        'action' =&amp;gt; 'micros/availability/search'&#xA;    )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Micros_AvailabilityController extends BaseController&#xA;{&#xA;&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionSearch()&#xA;    {&#xA;        Craft::dd('Micros_AvailabilityController-&amp;gt;actionSearch()');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an Entry with a slug of 'book' and that loads a template from the templates directory, so what I'm seeing right now is that template, and I don't get the action method running at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is do something in my action and attach the data to the request and return to whatever template the entry is using.&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-03-20T19:19:04.117" LastActivityDate="2015-03-24T20:04:27.727" Title="How can I fire a controller action for a particular route or entry?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;routes&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="8782" PostTypeId="2" ParentId="4154" CreationDate="2015-03-21T12:12:49.997" Score="1" Body="&lt;p&gt;I noticed that this is only a problem for images directly indexed using the &quot;Update Asset Indexes&quot; tool. If you upload images with the browser, Craft seems to recognise the orientation and apply it to transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;Not sure if this got actually fixed / implemented and it is a bug with the tool?&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I just found out that Craft does in fact rotate the images before transforming them, there's even a config setting for it &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#rotateImagesOnUploadByExifData&quot; rel=&quot;nofollow&quot;&gt;rotateImagesOnUploadByExifData&lt;/a&gt;! So this is in fact just a bug with new images found and indexed by the &quot;Update Asset Indexes&quot; tool.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-21T14:45:19.533" LastActivityDate="2015-03-21T14:45:19.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8783" PostTypeId="1" AcceptedAnswerId="8787" CreationDate="2015-03-21T23:33:42.973" Score="2" ViewCount="448" Body="&lt;p&gt;I have a section of &quot;video&quot; entries which are related to another section via an &quot;area&quot; field in the &quot;video&quot; section. When you do a search  on the front end by area then the related video displays as expected. What I also have in the area section is a text field full of postcodes, what I would like to happen is when you then do a search by postcode then the video displays that is related to that area, is that possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code that works for searches by area:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('search') %}&#xA;{% set searchEntries = craft.entries.search(query).order('score') %}&#xA;&#xA;{% for entry in searchEntries.video(':notempty:') %}&#xA;  {% set video = entry.video %}&#xA;  {{ video.embed({ width: 340, height: 191, showinfo: false }) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2015-03-22T06:23:57.707" LastActivityDate="2015-03-23T07:04:03.930" Title="Get search results by relationship" Tags="&lt;relations&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8784" PostTypeId="2" ParentId="8763" CreationDate="2015-03-21T23:38:26.347" Score="6" Body="&lt;p&gt;There is the &lt;a href=&quot;https://github.com/httpster/Ace-Freely/&quot;&gt;Ace Freely&lt;/a&gt; plugin, which adds an Ace Editor Field Type that would work well in a Matrix field.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-21T23:38:26.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8785" PostTypeId="1" CreationDate="2015-03-22T10:59:40.687" Score="1" ViewCount="210" Body="&lt;p&gt;First sorry for my bad english.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i want to do: display comments on a page, one at the right one at the left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 0.. NbComment %}&#xA;   {% if  (i is divisibleby(2)) or (i == 0) %}&#xA;&#xA;       &amp;lt;!--Right comment--&amp;gt;&#xA;&#xA;   {% else %}&#xA;&#xA;       &amp;lt;!--Left comment--&amp;gt;&#xA;&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works perfectly except when I only have one comment: it display nothing.&#xA;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2015-03-22T12:16:51.450" Title="Twig issue with divisibleby()" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8786" PostTypeId="2" ParentId="8785" CreationDate="2015-03-22T11:39:13.463" Score="2" Body="&lt;p&gt;Instead of &lt;code&gt;divisableby&lt;/code&gt; I think using Twig's built-in &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/odd.html&quot; rel=&quot;nofollow&quot;&gt;odd/even test&lt;/a&gt; might be easier in this case: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 0.. NbComment %}&#xA;&#xA;   {% if i is odd %}&#xA;&#xA;       &amp;lt;!--Right comment--&amp;gt;&#xA;&#xA;   {% else %}&#xA;&#xA;       &amp;lt;!--Left comment--&amp;gt;&#xA;&#xA;   {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And, just to suggest some minor improvements to your Twig, assuming the only difference between your comments is their alignment (left/right), you could do something like this, which would probably be a bit more DRY:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 0.. NbComment %}&#xA;&#xA;   &amp;lt;div class=&quot;comment is-{% i is odd ? 'odd' : 'even' %}&quot;&amp;gt;&#xA;      &amp;lt;!-- Comment content --&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA;&#xA;{% else %}&#xA;&#xA;   &amp;lt;p class=&quot;error&quot;&amp;gt;No comments to display&amp;lt;/p&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above code, your comments will have either the class &lt;code&gt;.is-odd&lt;/code&gt; or the class &lt;code&gt;.is-even&lt;/code&gt; – making it easy to e.g. float comments either &lt;code&gt;left&lt;/code&gt; or &lt;code&gt;right&lt;/code&gt; in your CSS. There's really no need to have a full if/else conditional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, note the &lt;code&gt;{% else %}&lt;/code&gt; statement in the above &lt;code&gt;for&lt;/code&gt; loop. The contained markup will output if there are no comments – which is good practice, and will save you yet another conditional :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-22T12:16:51.450" LastActivityDate="2015-03-22T12:16:51.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8787" PostTypeId="2" ParentId="8783" CreationDate="2015-03-22T19:40:32.837" Score="4" Body="&lt;p&gt;Do another call to &lt;code&gt;craft.entries&lt;/code&gt; when you loop through the &quot;area&quot; entries and include the &lt;code&gt;section&lt;/code&gt; and &lt;code&gt;relatedTo&lt;/code&gt; params:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in searchEntries %}&#xA;    {% set videos = craft.entries.section('videoSectionHandle').relatedTo(entry) %}&#xA;    {% for video in videos %}&#xA;         {# Output video here #}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're trying to maintain a one-to-one relationship it might make sense to limit the relation query to one result, and to include the &lt;code&gt;first&lt;/code&gt; param to return the first (and only) result and not an array – then you can omit the nested &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in searchEntries %}&#xA;    {% set video = craft.entries.section('videoSectionHandle').relatedTo(entry).limit(1).first() %}&#xA;    {{ video ? #--Output video here--# }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;You can read more about the relatedTo param here&lt;/a&gt;, it's pretty powerful.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-23T07:04:03.930" LastActivityDate="2015-03-23T07:04:03.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8788" PostTypeId="1" CreationDate="2015-03-23T00:06:15.677" Score="0" ViewCount="71" Body="&lt;p&gt;I have the following code to display entries based on a single category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Identify the primary category you want #}&#xA;{% set cat = craft.categories.title('events').level(1).first() %}&#xA;&#xA;&#xA;{# Grab an array of entries related to the primary category #}&#xA;{% set entries = craft.entries.section('projects').relatedTo(cat).find() %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;&amp;lt;article class=&quot;&quot;&amp;gt;&#xA;  &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;  &amp;lt;h5 class=&quot;subtitle&quot;&amp;gt;{{ entry.subtitle }}&amp;lt;/h5&amp;gt;&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;button button--ujarak button--border-thin button--text-thick&quot;&amp;gt;Learn more&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;  &amp;lt;hr class=&quot;rule rule--dashed&quot;&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine for the home locale (en) but on the others it displays all entries regardless of whether the category has been applied to it or not.&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2015-03-23T00:26:51.753" Title="Show Entries Based on Category - Localised Site" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8789" PostTypeId="2" ParentId="8788" CreationDate="2015-03-23T00:26:51.753" Score="1" Body="&lt;p&gt;The slugs for the different locales were not the same. Changed those and all fixed.&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2015-03-23T00:26:51.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8790" PostTypeId="1" AcceptedAnswerId="8799" CreationDate="2015-03-23T07:02:45.037" Score="2" ViewCount="615" Body="&lt;p&gt;I am trying to migrate my local dev environment to a staging site, but am receiving &lt;code&gt;You’re running Craft Pro with a Craft Personal license.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I tried access the admin at &lt;code&gt;http://project.staging.company.com/&lt;/code&gt; where I received the upgrade message. After emptying all caches, I then tried accessing from &lt;code&gt;http://staging.project.company.com&lt;/code&gt; and still get the upgrade message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4417/craft-license-what-is-considered-a-dev-sounding-subdomain&quot;&gt;this answer&lt;/a&gt; I assumed Craft would recognise this as a &quot;dev-sounding&quot; domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this still the case? What do I need to go to get this working on staging?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage I am not sure what will be the final domain, so I was hoping not to purchase the licence until we were ready to go live.&lt;/p&gt;&#xA;" OwnerUserId="3439" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-17T20:58:52.860" Title="Getting admin to work on a &quot;dev-sounding&quot; subdomain" Tags="&lt;license&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8791" PostTypeId="1" CreationDate="2015-03-23T10:29:06.293" Score="0" ViewCount="203" Body="&lt;p&gt;For Market commerce, good example templates and snippets of code are very important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a few ways I can give these to the users of my plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Example template folder. The user would manually copy the folder of templates into their templates folder. This folder could include twig macros that they could import to use in their templates and also allows them to modify the snippets easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Render a template partial from a Craft plugin Variable. This seems to be gaining a heap of popularity as I have looked through other plugins, but I don't really like the method as it does not allow users to update the code of the snippet without modifying templates in the plugins template directory. I also believe it is a remnant of eecms devs understanding of a antiquated templating system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Full blown twig extensions. This gives the flexibility of doing native tags for wrapping blocks of code, it also suffers from the same issue as number 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose a good solution would 1 &amp;amp; 3. The ability to easy use macros I make, with the ability to edit, but also an easy way to get core snippets of template functionality without needing to touch the html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this is too open a question for SE, but what do you suggest is the best way to solve these issues. Should people stop putting html snippets into PluginVariables.php?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I suggest to P&amp;amp;T&lt;/strong&gt; to enable a &quot;pluginName/macros&quot; folder to give designers the ability to import macros from the front end that they need without having to copy a whole folder of example code? This would allow the plugin dev to update the supplied macros at any time, but the designer can pick and choose which ones they want to copy into their templates folder and customize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions and Ideas?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2015-03-23T12:09:53.027" LastActivityDate="2015-03-23T12:09:53.027" Title="Macros vs Variables, which one should I choose to give users of my plugin?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;macro&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8792" PostTypeId="2" ParentId="8790" CreationDate="2015-03-23T10:36:21.553" Score="3" Body="&lt;p&gt;The only way to stop the message appearing is using a domain ending in &lt;code&gt;craft.dev&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as your client doesn't mind seeing the message it is not a big issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, licences can easily be moved to a different domain when you go live. Purchase the licence now and when you access the cp from the live domain in production, simple click the 'transfer licence to this domain' button at the top.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-03-23T10:36:21.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8793" PostTypeId="1" AcceptedAnswerId="8800" CreationDate="2015-03-23T12:15:42.407" Score="0" ViewCount="140" Body="&lt;p&gt;When I use the Redactor table plugin everything works but I can't seem to get any extended functions to work like cellpadding, cellspacing, table border color etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-03-23T17:50:29.813" Title="How can I make the redactor table plugin show extened options?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8795" PostTypeId="1" AcceptedAnswerId="8801" CreationDate="2015-03-23T15:08:11.040" Score="1" ViewCount="204" Body="&lt;p&gt;I've worked up this code with big help from @carlcs.&#xA;I want to set up a &lt;code&gt;class&lt;/code&gt; if current locale is turned on. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly, I tried the easiest way by putting &lt;code&gt;{{ current ? 'my-class' }}&lt;/code&gt; into &lt;code&gt;li&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Secondly, I tried to set variable for current locale.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've end up by struggling to answer my question, Why all locales are turned on?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Language switcher #}&#xA;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;&#xA;{# Configure site locales #}&#xA;{% set locales = ['en', 'en_gb'] %}&#xA;&#xA;{# Check if locale equals the requested page locale #}&#xA;{% if locale == craft.locale %}&#xA;    {% set current = true %}&#xA;{% else %}&#xA;    {% set current = false %}&#xA;{% endif %}&#xA;&#xA;{# Give locales class or text #}   &#xA;{% if locale == 'en' %}&#xA;     {% set territoryCode = 'world' %}&#xA;     {% set active = 'uk-active' %}    &#xA;{% endif %}&#xA;&#xA;{% if locale == 'en_gb' %}&#xA;     {% set territoryCode = 'uk' %} &#xA;     {% set active = 'uk-active' %}     &#xA;{% endif %}  &#xA;&#xA;&#xA;{# This is the current locale #}&#xA;&amp;lt;span&amp;gt;{{ territoryCode|upper }}&amp;lt;/span&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% set locales = ['en_001', 'en_gb'] %}&#xA;{% for locale in locales %}&#xA;{% set subTags = locale|split('_') %}&#xA;{% set territory = subTags|length &amp;gt; 1 ?craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;{% set language = craft.i18n.getLocaleById(locale).name %}&#xA;{% set language = language ?: craft.i18n.getLocaleById(subTags|first).name %}&#xA;{% set language = language|replace(&quot;/- #{territory}$/&quot;, '') %}    &#xA;&#xA;&amp;lt;li {% if active %}class=&quot;{{ active }}{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot;&amp;gt;&#xA;       {% if territory and language %}&#xA;            {{ territory }} ({{ language }})&#xA;       {% endif %}&#xA;    &amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% set locales = ['en_001', 'en_gb'] %}  &#xA;&#xA; {% for locale in locales %}    &#xA;&#xA; {# Check if locale equals the requested page locale #}&#xA; {% if locale == craft.locale %}&#xA;      {% set current = true %}&#xA; {% else %}&#xA;      {% set current = false %}        &#xA; {% endif %}&#xA;&#xA; {% set subTags = locale|split('_') %}&#xA; {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA; {% set language = craft.i18n.getLocaleById(locale).name %}&#xA; {% set language = language ?: craft.i18n.getLocaleById(subTags|first).name %}&#xA; {% set language = language|replace(&quot;/- #{territory}$/&quot;, '') %}    &#xA;&#xA;&#xA; &amp;lt;li class=&quot;{{ current is defined ? 'uk-active' }}&quot;&amp;gt;&#xA;     &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot;&amp;gt;&#xA;        {% if territory and language %}&#xA;            {{ territory }} ({{ language }})&#xA;        {% endif %}&#xA;     &amp;lt;/a&amp;gt;&#xA; &amp;lt;/li&amp;gt;&#xA; {% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="125" LastEditDate="2015-03-24T14:30:37.000" LastActivityDate="2015-03-24T14:30:37.000" Title="Add active class and territory name to language switcher" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8797" PostTypeId="1" AcceptedAnswerId="8803" CreationDate="2015-03-23T15:26:46.127" Score="1" ViewCount="254" Body="&lt;p&gt;I've got a news website built and I am in the process of improving it's performance. What would be the best way to measure the performance of my templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use Chrome Developer tools to measure how long it takes for the server to respond but is that the best way of doing it or can I do it internally?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2015-03-23T18:55:23.340" Title="Measuring Template Performance" Tags="&lt;cache&gt;&lt;performance&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8798" PostTypeId="1" CreationDate="2015-03-23T15:48:05.860" Score="1" ViewCount="100" Body="&lt;p&gt;I am writing a plugin which has a controller, service and a model. The model represents some fields which will be POST'd and then emailed via the service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller uses an action to populate the model via the $_POST vars, which is exposed to the template for displaying validation errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fields = BusinessLogic_EventBookingFormModel::populateModel($_POST);&#xA;&#xA;if ($fields-&amp;gt;validate()) {&#xA;    // send the email...&#xA;} else {&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'errors' =&amp;gt; $fields-&amp;gt;getErrors()&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to expose that model to the template before it's populated, I assume via a template variable. What is standard-practise for instantiating and then managing a reference to that model? Where would the instance live? In the service perhaps?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2016-10-17T21:08:52.247" Title="Expose a model to a template?" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8799" PostTypeId="2" ParentId="8790" CreationDate="2015-03-23T17:19:43.980" Score="6" Body="&lt;p&gt;As Luke referenced in &lt;a href=&quot;https://craftcms.stackexchange.com/a/8792/45&quot;&gt;his answer&lt;/a&gt;, you're mixing up two separate (but related) concepts.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Craft License&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Your license key is stored in your &lt;code&gt;craft/config/license.key&lt;/code&gt; file. This file is automatically generated the first time you run Craft, and should always remain a part of your website. If you're using version control, make sure that it's included in your repo.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Craft Edition&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &quot;edition&quot; of your website refers to which version you're using: &lt;strong&gt;Free&lt;/strong&gt;, &lt;strong&gt;Client&lt;/strong&gt;, or &lt;strong&gt;Pro&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whichever edition you are currently using will be stored in your database for immediate reference... However, your site will frequently ping Pixel &amp;amp; Tonic's servers to ensure that it's using the correct edition. While your license key does not &lt;em&gt;directly&lt;/em&gt; contain which edition you should be using, it let's P&amp;amp;T's servers know which website is performing the request, and replies back with the proper edition information.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How it relates to your situation...&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Using a &quot;dev-sounding&quot; domain name only does one thing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can share the same license key file between domains without getting a warning message at the top of each page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The P&amp;amp;T servers will associate your license with only the &lt;strong&gt;non&lt;/strong&gt;-dev-sounding domain... any dev-sounding domains will not be recording with your license key data. So if you try to use the same license key file on multiple non-dev-sounding domains, all but one will display this message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The license located at config/license.key belongs to [OTHER DOMAIN]. Transfer it to this domain?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In regards to your &lt;strong&gt;edition&lt;/strong&gt;... As long as they're sharing the same license, every environment for your site will share the same edition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Luke mentioned, when developing a site in your &lt;strong&gt;local environment&lt;/strong&gt;, you can set the local path to end with &lt;code&gt;craft.dev&lt;/code&gt;. This is considered a very special circumstance... Craft will recognize this special domain and allow you to upgrade your edition for free!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, since that special domain is only available locally, you'll be expected to properly purchase your edition when you move your site to any other domain name (regardless of whether it's &quot;dev-sounding&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, Luke's solution is correct... Purchase the license now, and don't worry about what the final domain will be. It's not relevant. Switching your license to the correct domain is incredibly easy and painless, and happens with a single click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's now possible to try Craft Pro from &lt;em&gt;any&lt;/em&gt; non-public domain:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-17T20:58:52.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8800" PostTypeId="2" ParentId="8793" CreationDate="2015-03-23T17:50:29.813" Score="2" Body="&lt;p&gt;I don't think the features you're asking for are possible with the default &lt;a href=&quot;http://imperavi.com/redactor/plugins/table/&quot; rel=&quot;nofollow&quot;&gt;Redactor Table&lt;/a&gt; plugin Craft comes with, and as far as I know, it is also the only table plugin for Redactor out there.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-23T17:50:29.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8801" PostTypeId="2" ParentId="8795" CreationDate="2015-03-23T17:57:57.517" Score="2" Body="&lt;p&gt;The comparison is meant to be used within the for loop that loops your array of locales. And you can of course only compare the current locale tag &lt;code&gt;craft.locale&lt;/code&gt; to real locale tags and not with fake ones like 'en_001' that Craft doesn't know about.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = ['en', 'en_gb'] %}&#xA;&#xA;{% for locale in locales %}&#xA;    {% set current = (locale == craft.locale) ? true %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you need to find a way to map real locales to your fake ones! The real ones for your &lt;code&gt;craft.locale&lt;/code&gt; comparison and the fake ones to get your territories. But then there would be no need to compose fake ones to start with and you would simply map the real locales you installed and use in Craft to the territory names or territory codes for your output string. So let's do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = {&#xA;    'en':    '001',&#xA;    'en_gb': 'gb',&#xA;    'hu':    'sk',&#xA;    'de':    'sk',&#xA;} %}&#xA;&#xA;{% for locale, territory in locales %}&#xA;&#xA;    {% set current = (locale == craft.locale) ? true %}&#xA;&#xA;    {% set territory = craft.i18n.getLocaleData(craft.locale).getTerritory(territory) %}&#xA;    {% set language = craft.i18n.getLocaleById(locale).name %}&#xA;    {% set language = language|replace(&quot;/- #{territory}$/&quot;, '') %}&#xA;&#xA;    {% if territory and language %}&#xA;        &amp;lt;li class=&quot;{{ current ? 'myCurrentLocale'}}&quot;&amp;gt;&#xA;            Territory: {{ territory }},&#xA;            Language: {{ language }}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-24T13:57:27.953" LastActivityDate="2015-03-24T13:57:27.953" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8802" PostTypeId="1" AcceptedAnswerId="8804" CreationDate="2015-03-23T17:59:17.930" Score="1" ViewCount="235" Body="&lt;p&gt;how can i fill custom fields from the front-end form ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3444" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:25.233" LastActivityDate="2017-10-24T15:25:25.233" Title="How to fill the custom fields of users from the front-end form?" Tags="&lt;users&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8803" PostTypeId="2" ParentId="8797" CreationDate="2015-03-23T18:55:23.340" Score="5" Body="&lt;p&gt;If you enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot;&gt;devMode&lt;/a&gt;, you'll get code profiling information (execution times, memory used, stack traces, etc.) that you can use to debug templates with in your browser's console as well as in the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-23T18:55:23.340" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8804" PostTypeId="2" ParentId="8802" CreationDate="2015-03-23T19:09:36.270" Score="2" Body="&lt;p&gt;You can do so by using the &lt;code&gt;fields[customFieldHandle]&lt;/code&gt; syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here's how you'd populate &lt;code&gt;location&lt;/code&gt; and &lt;code&gt;bio&lt;/code&gt; custom fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;location&quot;&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;location&quot; name=&quot;fields[location]&quot; value=&quot;{{ currentUser.location }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;bio&quot;&amp;gt;Bio&amp;lt;/label&amp;gt;&#xA;&amp;lt;textarea id=&quot;bio&quot; name=&quot;fields[bio]&quot;&amp;gt;{{ currentUser.bio }}&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-23T19:09:36.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8805" PostTypeId="1" AcceptedAnswerId="8808" CreationDate="2015-03-23T19:14:53.523" Score="1" ViewCount="679" Body="&lt;p&gt;I have a table field which is attached to users, before I go ahead and create the logic for adding rows on the front end via ajax, I need to know if I am going to be able to easily add the facility to delete specific rows (ideally without saving all the data again each time)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may well be that depending on complexity that this is more suited to a matrix field or custom database tables via a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way can it be done?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-03-23T20:31:21.940" Title="Can you delete rows from a table field on the front end?" Tags="&lt;frontend&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8806" PostTypeId="1" AcceptedAnswerId="8807" CreationDate="2015-03-23T19:20:33.747" Score="1" ViewCount="1163" Body="&lt;p&gt;I'm trying to send some assets links through email, but using &lt;code&gt;{{ siteUrl  ~ file.link }}&lt;/code&gt; returns an url with double forwards slashes like: &lt;code&gt;http://example.com//public/assets/sdfsdfds.jpeg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't find a method on the &lt;strong&gt;AssetsFileModel&lt;/strong&gt; that generates a direct link to it. Is there an easy way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1103" LastActivityDate="2015-03-23T21:01:54.250" Title="Direct link to asset" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8807" PostTypeId="2" ParentId="8806" CreationDate="2015-03-23T20:02:00.287" Score="3" Body="&lt;p&gt;What if you just use &lt;code&gt;&amp;lt;a href=&quot;{{ file.url }}&quot;&amp;gt;&lt;/code&gt;? So, without the siteUrl part? If your Asset source's URL setting is correct (so, the complete url, preferably using {siteUrl}), that should do the trick ...&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-03-23T21:01:54.250" LastActivityDate="2015-03-23T21:01:54.250" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8808" PostTypeId="2" ParentId="8805" CreationDate="2015-03-23T20:03:54.267" Score="2" Body="&lt;p&gt;It can be done, but only by saving the table field's data completely. There's no controller method to remove a table's row(s). Same would apply for a table within a Matrix block, or for a Matrix block itself. All content gets saved by calling the entries controller (saveEntry) with the new content in a POST.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do: Let your users create one or more matrix blocks, create your own plugin, create a controller with an &lt;code&gt;actionDeleteMatrixBlockById()&lt;/code&gt; method (for instance) and let that controller call &lt;code&gt;craft()-&amp;gt;matrix-&amp;gt;deleteBlockById()&lt;/code&gt; if one of the blocks has to be deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bit of a hassle, though. Don't know your use-case, but seems a bit overkill.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-03-23T20:31:21.940" LastActivityDate="2015-03-23T20:31:21.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8810" PostTypeId="1" AcceptedAnswerId="10259" CreationDate="2015-03-23T21:56:47.260" Score="0" ViewCount="467" Body="&lt;p&gt;I have create a plugin to save information from my form in the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create a row with some data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Email and Number type work well but String is NULL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you any idea ?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;my controller&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveInscription()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    if ($id = craft()-&amp;gt;request-&amp;gt;getPost('inscriptionId')) {&#xA;       $model = craft()-&amp;gt;inscriptionCommunautes-&amp;gt;getInscriptionById($id);&#xA;    } else {&#xA;        $model = craft()-&amp;gt;inscriptionCommunautes-&amp;gt;newInscription($id);&#xA;    }&#xA;&#xA;    $attributes = craft()-&amp;gt;request-&amp;gt;getPost('inscription');&#xA;&#xA;    $model-&amp;gt;setAttributes($attributes);&#xA;&#xA;    if (craft()-&amp;gt;inscriptionCommunautes-&amp;gt;saveInscription($model)) {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Inscription saved.'));&#xA;        $model-&amp;gt;getAttribute('id')));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;My Service (saveAction)&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveInscription(InscriptionCommunautes_InscriptionModel &amp;amp;$model)&#xA;{&#xA;    if ($id = $model-&amp;gt;getAttribute('id')) {&#xA;        if (null === ($record = $this-&amp;gt;inscriptionRecord-&amp;gt;findByPk($id))) {&#xA;            throw new Exception(Craft::t('Can\'t find inscription with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;        }&#xA;    } else {&#xA;        $record = $this-&amp;gt;inscriptionRecord-&amp;gt;create();&#xA;    }&#xA;        $record-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;    if ($record-&amp;gt;save()) {&#xA;        $model-&amp;gt;setAttribute('id', $record-&amp;gt;getAttribute('id'));&#xA;        return true;&#xA;    } else {&#xA;        $model-&amp;gt;addErrors($record-&amp;gt;getErrors());&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;My Model&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'id' =&amp;gt; AttributeType::Number,&#xA;        'communaute' =&amp;gt; AttributeType::String,&#xA;        'nom' =&amp;gt; AttributeType::String,&#xA;        'courriel' =&amp;gt; AttributeType::Email,&#xA;        'telephone' =&amp;gt; AttributeType::String,&#xA;        'entraineurs' =&amp;gt; AttributeType::Number,&#xA;        'accompagnateurs' =&amp;gt; AttributeType::Number,&#xA;        'athletes' =&amp;gt; AttributeType::Number,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;My Record&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTableName()&#xA;{&#xA;    return 'CustomPlugin_Inscriptions';&#xA;}&#xA;&#xA;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'communaute' =&amp;gt; AttributeType::String,&#xA;        'nom' =&amp;gt; AttributeType::String,&#xA;        'courriel' =&amp;gt; AttributeType::Email,&#xA;        'telephone' =&amp;gt; AttributeType::String,&#xA;        'entraineurs' =&amp;gt; AttributeType::Number,&#xA;        'accompagnateurs' =&amp;gt; AttributeType::Number,&#xA;        'athletes' =&amp;gt; AttributeType::Number,&#xA;    );&#xA;}&#xA;&#xA;public function defineIndexes()&#xA;{&#xA;    return array(&#xA;&#xA;    );&#xA;}&#xA;&#xA;public function create()&#xA;{&#xA;    $class = get_class($this);&#xA;    $record = new $class();&#xA;&#xA;    return $record;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Craft::dd($model);&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Craft\InscriptionCommunautes_InscriptionModel#1&#xA;(&#xA;    [*:classSuffix] =&amp;gt; 'Model'&#xA;    [*:strictAttributes] =&amp;gt; true&#xA;    [Craft\BaseModel:_classHandle] =&amp;gt; null&#xA;    [Craft\BaseModel:_attributeConfigs] =&amp;gt; array&#xA;    (&#xA;        'id' =&amp;gt; array&#xA;        (&#xA;            'maxLength' =&amp;gt; 11&#xA;            'min' =&amp;gt; -2147483648&#xA;            'max' =&amp;gt; 2147483647&#xA;            'decimals' =&amp;gt; 0&#xA;            'type' =&amp;gt; 'number'&#xA;            'unsigned' =&amp;gt; false&#xA;            'length' =&amp;gt; 10&#xA;            'column' =&amp;gt; 'integer'&#xA;        )&#xA;        'communaute' =&amp;gt; array&#xA;        (&#xA;            'type' =&amp;gt; 'string'&#xA;        )&#xA;        'nom' =&amp;gt; array&#xA;        (&#xA;            'type' =&amp;gt; 'string'&#xA;        )&#xA;        'courriel' =&amp;gt; array&#xA;        (&#xA;            'maxLength' =&amp;gt; 255&#xA;            'minLength' =&amp;gt; 5&#xA;            'column' =&amp;gt; 'varchar'&#xA;            'type' =&amp;gt; 'email'&#xA;        )&#xA;        'telephone' =&amp;gt; array&#xA;        (&#xA;            'type' =&amp;gt; 'string'&#xA;        )&#xA;        'entraineurs' =&amp;gt; array&#xA;        (&#xA;            'maxLength' =&amp;gt; 11&#xA;            'min' =&amp;gt; -2147483648&#xA;            'max' =&amp;gt; 2147483647&#xA;            'decimals' =&amp;gt; 0&#xA;            'type' =&amp;gt; 'number'&#xA;            'unsigned' =&amp;gt; false&#xA;            'length' =&amp;gt; 10&#xA;            'column' =&amp;gt; 'integer'&#xA;        )&#xA;        'accompagnateurs' =&amp;gt; array&#xA;        (&#xA;            'maxLength' =&amp;gt; 11&#xA;            'min' =&amp;gt; -2147483648&#xA;            'max' =&amp;gt; 2147483647&#xA;            'decimals' =&amp;gt; 0&#xA;            'type' =&amp;gt; 'number'&#xA;            'unsigned' =&amp;gt; false&#xA;            'length' =&amp;gt; 10&#xA;            'column' =&amp;gt; 'integer'&#xA;        )&#xA;        'athletes' =&amp;gt; array&#xA;        (&#xA;            'maxLength' =&amp;gt; 11&#xA;            'min' =&amp;gt; -2147483648&#xA;            'max' =&amp;gt; 2147483647&#xA;            'decimals' =&amp;gt; 0&#xA;            'type' =&amp;gt; 'number'&#xA;            'unsigned' =&amp;gt; false&#xA;            'length' =&amp;gt; 10&#xA;            'column' =&amp;gt; 'integer'&#xA;        )&#xA;    )&#xA;    [Craft\BaseModel:_attributes] =&amp;gt; array&#xA;    (&#xA;        'communaute' =&amp;gt; 'communaute'&#xA;        'nom' =&amp;gt; 'nom'&#xA;        'courriel' =&amp;gt; 'courriel@domaine.com'&#xA;        'telephone' =&amp;gt; '1231231212'&#xA;        'entraineurs' =&amp;gt; '1'&#xA;        'accompagnateurs' =&amp;gt; '2'&#xA;        'athletes' =&amp;gt; '3'&#xA;    )&#xA;    [Craft\BaseModel:_extraAttributeNames] =&amp;gt; null&#xA;    [CModel:_errors] =&amp;gt; array()&#xA;    [CModel:_validators] =&amp;gt; null&#xA;    [CModel:_scenario] =&amp;gt; ''&#xA;    [CComponent:_e] =&amp;gt; null&#xA;    [CComponent:_m] =&amp;gt; null&#xA;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Craft::dd($model-&gt;getAttributes());&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array&#xA;(&#xA;    'id' =&amp;gt; null&#xA;    'communaute' =&amp;gt; 'comm'&#xA;    'nom' =&amp;gt; 'name'&#xA;    'courriel' =&amp;gt; 'email@domaine.com'&#xA;    'telephone' =&amp;gt; '1231231231'&#xA;    'entraineurs' =&amp;gt; '1'&#xA;    'accompagnateurs' =&amp;gt; '2'&#xA;    'athletes' =&amp;gt; '3'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Database Structure Generated&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE IF NOT EXISTS `craft_InscriptionCommunautes_Inscriptions` (&#xA;  `id` int(11) NOT NULL AUTO_INCREMENT,&#xA;  `communaute` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,&#xA;  `nom` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,&#xA;  `courriel` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,&#xA;  `telephone` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,&#xA;  `entraineurs` int(10) DEFAULT NULL,&#xA;  `accompagnateurs` int(10) DEFAULT NULL,&#xA;  `athletes` int(10) DEFAULT NULL,&#xA;  `dateCreated` datetime NOT NULL,&#xA;  `dateUpdated` datetime NOT NULL,&#xA;  `uid` char(36) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',&#xA;  PRIMARY KEY (`id`)&#xA;) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3444" LastEditorUserId="3444" LastEditDate="2015-03-26T01:15:47.833" LastActivityDate="2015-06-21T14:36:20.097" Title="AttributeType::String is NULL in my database" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;models&gt;&lt;records&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="8811" PostTypeId="1" AcceptedAnswerId="8812" CreationDate="2015-03-23T23:31:26.793" Score="2" ViewCount="309" Body="&lt;p&gt;I'm having some difficulty with &quot;Restrict uploads to a single folder?&quot; option on an Assets entry field. I find that when I upload an asset into the field, the asset folder gets created as expected, but the asset does not end up in the folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the author is SomeAuthor, a folder called 'SomeAuthor' gets created in the correct location in the Asset Source using the following dynamic path, set in the field setting as mentioned above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if owner is defined %}{owner.author.username}{% elseif author is defined %}{author.username}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this to allow me to re-use the field on Matrix and non-Matrix sections, but the point is that the folder is created successfully. What isn't so successful is that the file does not end up &lt;em&gt;inside&lt;/em&gt; that folder, but in the root of my Asset Source. I've tried combinations of logging in as the specified author, removing all the assets from the site. Re-indexing etc. etc. all to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps I'm looking in the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any experience trying to achieve what I'm attempting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general context is I have separate users on the system, each responsible for a &quot;project&quot; page, along with permissions to create 'articles' and 'events' in the respective sections/channels. I want to have one asset folder per user, so that no matter where they upload assets, the assets end up in the same folder per user, so that user with username 'SomeAuthor's assets will end up in 'SomeAuthor' folder within my single site source. I am attempting to do this using this snippet above, which in theory should work considering the author.username is not changing...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since posting this, I have discovered that I had another assets field with a simpler &quot;Restrict uploads to a single folder?&quot; setting: &lt;code&gt;{author.username|lower}&lt;/code&gt; that was creating the field, and not the field I was testing with the setting above! Doh...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I supposed the real question is, therefore, how can I get a dynamic path, like the one above, to work?&lt;/p&gt;&#xA;" OwnerUserId="3438" LastEditorUserId="3438" LastEditDate="2015-03-24T00:09:46.810" LastActivityDate="2015-03-24T01:06:49.647" Title="Trouble with &quot;restricted&quot; upload folders" Tags="&lt;assets&gt;&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8812" PostTypeId="2" ParentId="8811" CreationDate="2015-03-24T00:51:54.073" Score="3" Body="&lt;p&gt;Whenever you're not using the shortcut syntax with single braces you need to acces the element via &lt;code&gt;object&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So add that var before &lt;code&gt;owner&lt;/code&gt; etc. and you should be good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I noticed is that you can't use ternary syntax for conditionals within short syntax either but with Twig code you can:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.owner.author ? object.owner.author.friendlyName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-24T01:06:49.647" LastActivityDate="2015-03-24T01:06:49.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8813" PostTypeId="1" CreationDate="2015-03-24T01:39:29.623" Score="1" ViewCount="1202" Body="&lt;p&gt;Is it possible to call a method of a plugin's controller from within a plugin? I don't plan on making a habit of this but sometimes it may be needed. Just trying to plan ahead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-03-24T02:19:41.797" Title="Call Controller Method with Plugin" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8814" PostTypeId="2" ParentId="8813" CreationDate="2015-03-24T02:19:41.797" Score="4" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`craft()-&amp;gt;runController('pluginHandle/controllerId/action');`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although I'd question the decisions you've made to get to the point where you had to ask this question. ;)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-24T02:19:41.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8816" PostTypeId="1" AcceptedAnswerId="8817" CreationDate="2015-03-24T03:02:58.413" Score="1" ViewCount="925" Body="&lt;p&gt;If we are storing a cookie of a locale the user choose, is there a way to detect that cookie in htaccess so the next time they visit the base url of the site it will take them to the same locale?&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-03-24T04:33:01.657" LastActivityDate="2015-03-24T05:58:21.547" Title="Return to specific locale based on cookie?" Tags="&lt;localization&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8817" PostTypeId="2" ParentId="8816" CreationDate="2015-03-24T05:58:21.547" Score="3" Body="&lt;h2&gt;Storing the cookie&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'd recommend using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Cookies plugin&lt;/a&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.lj_cookies.set('locale', craft.locale, '', '/' ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Retrieving the cookie&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The LJ Cookies plugin is also capable of reading cookies, so you could simply put a conditional redirect at the top of your layout...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentLocale = craft.locale %}&#xA;{% set goToLocale = craft.lj_cookies.get('locale') %}&#xA;&#xA;{% if goToLocale and (currentLocale != goToLocale %}&#xA;    {% redirect '/' ~ goToLocale %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you insist on performing the locale redirect at the .htaccess level, that's also possible. It would provide you a small performance improvement, but may not be worth bypassing the simplicity of using LJ Cookies in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using .htaccess to perform a redirect based on a cookie value is beyond my expertise, and somewhat beyond the scope of the Craft SE site. But I did some quick Googling around for &quot;cookie&quot; and &quot;htaccess&quot;, and found a few helpful links:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/3978726/how-to-do-htaccess-redirect-based-on-cookie-value&quot;&gt;https://stackoverflow.com/questions/3978726/how-to-do-htaccess-redirect-based-on-cookie-value&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.askapache.com/htaccess/htaccess-fresh.html#Get_Cookie_Value&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.askapache.com/htaccess/htaccess-fresh.html#Get_Cookie_Value&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-03-24T05:58:21.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8821" PostTypeId="1" AcceptedAnswerId="8837" CreationDate="2015-03-24T10:40:12.807" Score="0" ViewCount="710" Body="&lt;p&gt;I'm having a bit of a problem with using craft currently. My site has a gallery section where I would like to mass-upload image files to an entry which is in the area: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;admin/entries/photos&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I upload the files in the following fashion, by selecting all of the images, uploading them and then inserting them into the photo entry, the desired effect is not found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cuovx.png&quot; alt=&quot;I Upload all of the images and select them in the interface&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BjeaC.png&quot; alt=&quot;I then am met with this screen, with all of the images I selected in one section.&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OImeu.jpg&quot; alt=&quot;However, only the first image from the upload stack is shown on the live page.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I upload all of the images and select them in the interface&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I then am met with this screen, with all of the images I selected in one section.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;However, only the first image from the upload stack is shown on the live page. (The last screenshot is confusing, I have uploaded those photos one by one, the photos I tried to mass up load have not worked.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope this is understandable, I do not want to upload 100++ images one by one when I only need the simple functionality of a gallery. Please feel free to ask me questions.&lt;/p&gt;&#xA;" OwnerUserId="3447" LastEditorUserId="344" LastEditDate="2015-05-27T14:17:32.883" LastActivityDate="2015-05-27T14:17:32.883" Title="Multiple Photos/Assets in one upload entry" Tags="&lt;assets&gt;&lt;entry&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ClosedDate="2015-03-29T19:49:09.437" ContentLicense="CC BY-SA 3.0" />
  <row Id="8822" PostTypeId="1" AcceptedAnswerId="8834" CreationDate="2015-03-24T10:49:24.597" Score="1" ViewCount="160" Body="&lt;p&gt;I've found this in the &lt;a href=&quot;http://buildwithcraft.com/docs/date-time-fields&quot; rel=&quot;nofollow&quot;&gt;documenation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Dates and times are both formatted for the user’s preferred locale.&#xA;  They are displayed in the site’s timezone, however they get stored in&#xA;  UTC like all other dates in Craft.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this timezone: UTC+1 (CET) - Europe/Rome&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As expected everything is saved in the database with an UTC offset of minus one hour exept the expiryDate in the craft_templatecaches table: the UTC offset is minus two hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expiredNews = craft.entries.section('news').order('expiryDate')|first %}&#xA;{% set expiryDate = expiredNews.expiryDate %}&#xA;&#xA;{% cache until expiryDate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;expiryDate in entry: 2015-04-01 00:00:00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;expiryDate in cache: 2015-03-31 22:00:00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is there an offset of two hours and what does that mean for cache invalidation?&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2015-03-24T13:00:02.790" LastActivityDate="2015-03-24T21:24:44.540" Title="expiryDate in craft_templatecaches" Tags="&lt;cache&gt;&lt;datetime&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8823" PostTypeId="1" AcceptedAnswerId="8827" CreationDate="2015-03-24T11:23:49.277" Score="1" ViewCount="201" Body="&lt;p&gt;I have a form that contains a static select input of U.S. States:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;state&quot; name=&quot;state&quot; class=&quot;form-control&quot;&amp;gt;&#xA;&amp;lt;option value=&quot;&quot;&amp;gt; Select &amp;lt;/option&amp;gt;&#xA;&amp;lt;option value=&quot;AL&quot;&amp;gt;Alabama&amp;lt;/option&amp;gt;&#xA;&amp;lt;option value=&quot;AK&quot;&amp;gt;Alaska&amp;lt;/option&amp;gt;&#xA;&amp;lt;option value=&quot;AZ&quot;&amp;gt;Arizona&amp;lt;/option&amp;gt;&#xA;....&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the validation figured out on my form, and also have my text inputs getting repopulated if there are any validation errors. I am curious about the best method to repopulate my select input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the value that was entered via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set state = craft.request.getParam('state') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will give me &quot;AL&quot; or &quot;AK&quot; (whichever was chosen). This is fine, but because my list is static, do I now need to have logic on every option?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;AL&quot; {% if state == AL %}selected=&quot;selected&quot; {%endif%}&amp;gt;Alabama&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, is there a better way all together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, here is how I am repopulating my text inputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;{% if model is defined %}{{ model.name }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-03-24T15:06:17.557" LastActivityDate="2015-03-24T15:06:17.557" Title="Repopulate a static select input" Tags="&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8824" PostTypeId="1" CreationDate="2015-03-24T11:40:42.897" Score="1" ViewCount="1168" Body="&lt;p&gt;I'm trying to update some checkbox fields through the frontend with ajax.&#xA;After clicking / change of the checkbox the form needs to update the profile. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form-horizontal form-ajax&quot; method=&quot;POST&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;notificaties&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;/users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect_&quot; value=&quot;account&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;action-list&quot;&amp;gt;&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;p&amp;gt;&#xA;&#xA;            Ontvang updates over leuke nieuwe producten&#xA;            &amp;lt;span class=&quot;pull-right&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emailUpdates]&quot; value=&quot;0&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;ajaxcheck&quot; type=&quot;checkbox&quot; id=&quot;fields_emailUpdates&quot; name=&quot;fields[emailUpdates]&quot; value=&quot;1&quot; {% if user is defined and user.emailUpdates %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;            &amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;p&amp;gt;&#xA;&#xA;            Ontvang email updates over geinteresseerde kopers&#xA;            &amp;lt;span class=&quot;pull-right&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emailReactie]&quot; value=&quot;0&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;ajaxcheck&quot; type=&quot;checkbox&quot; id=&quot;fields_emailReactie&quot; name=&quot;fields[emailReactie]&quot; value=&quot;1&quot; {% if user is defined and user.emailReactie %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;            &amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;p&amp;gt;&#xA;&#xA;            Ontvang wekelijks een upate over de producten van jou favoriete verkopers&#xA;            &amp;lt;span class=&quot;pull-right&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emailFavorieten]&quot; value=&quot;0&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;ajaxcheck&quot; type=&quot;checkbox&quot; id=&quot;fields_emailFavorieten&quot; name=&quot;fields[emailFavorieten]&quot; value=&quot;1&quot; {% if user is defined and user.emailFavorieten %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;            &amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;p&amp;gt;&#xA;&#xA;            Ontvang email updates van de reacties van jou producten&#xA;            &amp;lt;span class=&quot;pull-right&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emailComments]&quot; value=&quot;0&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;ajaxcheck&quot; type=&quot;checkbox&quot; id=&quot;fields_emailComments&quot; name=&quot;fields[emailComments]&quot; value=&quot;1&quot; {% if user is defined and user.emailComments %} checked=&quot;checked&quot;{% endif %}&amp;gt;&#xA;            &amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA; &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $(&quot;.ajaxcheck&quot;).click(function(){&#xA;    var data = $(this).parents('form').serialize()&#xA;&#xA;    $.ajax({&#xA;        context: this,&#xA;        method: &quot;POST&quot;,&#xA;        dataType: &quot;json&quot;,&#xA;        url: &quot;/actions/users/saveUser&quot;,&#xA;        success: function(data, response){&#xA;            $(this).parents('.account-item').remove();&#xA;            console.log(&quot;success&quot;, response, data);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it gives me an error: GET &lt;a href=&quot;http://shop.craft.dev/actions/users/saveUser&quot; rel=&quot;nofollow&quot;&gt;http://shop.craft.dev/actions/users/saveUser&lt;/a&gt; 400 (Bad Request)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form gets updated. So it works. But it still gives me this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my craft.log file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;exception.Craft\HttpException.400&#xA;Message exception 'Craft\HttpException' in /Volumes/HDD Drive/Sites/Shop/app/controllers/BaseController.php:191&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2015-03-24T17:04:12.573" LastActivityDate="2016-03-22T12:09:01.897" Title="Change profile in frontend with ajax" Tags="&lt;form&gt;&lt;ajax&gt;&lt;frontend&gt;&lt;profile&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8825" PostTypeId="2" ParentId="8824" CreationDate="2015-03-24T11:58:34.040" Score="2" Body="&lt;p&gt;The 400 error you’re getting is coming from &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/BaseController#requirePostRequest-detail&quot; rel=&quot;nofollow&quot;&gt;BaseController::requirePostRequest()&lt;/a&gt;. It’s happening because this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;type: &quot;post&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;method: &quot;POST&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-03-24T12:43:22.283" LastActivityDate="2015-03-24T12:43:22.283" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8826" PostTypeId="1" CreationDate="2015-03-24T12:39:48.877" Score="0" ViewCount="47" Body="&lt;p&gt;Currently I'm seeing them cropped and stored on the remote bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to force them to be stored locally and retrievable via an Asset URL method?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-24T12:39:48.877" Title="Can you store cropped cloud assets locally?" Tags="&lt;assets&gt;&lt;cache&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8827" PostTypeId="2" ParentId="8823" CreationDate="2015-03-24T12:40:53.373" Score="3" Body="&lt;p&gt;No, I don't think there's a better way, you need to add that conditional to each select option.&#xA;But what you could do is to refactor a bit and move that logic to a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig macro&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro stateOption(id, name, selectedId) %}&#xA;    &amp;lt;option value=&quot;{{ id }}&quot;{{ id == selectedId ? ' selected=&quot;selected&quot;' }}&amp;gt;{{ name }}&amp;lt;/option&amp;gt;&#xA;{% endmacro %}&#xA;{% import _self as forms %}&#xA;&#xA;{% set selectedId = craft.request.getParam('state') %}&#xA;&#xA;{% set states = {&#xA;    'AL': 'Alabama',&#xA;    'AK': 'Alaska',&#xA;    'AZ': 'Arizona',&#xA;} %}&#xA;&#xA;&amp;lt;select id=&quot;state&quot; name=&quot;state&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;&#xA;    {# Go through states and use the custom macro to generate the select options #}&#xA;    {% for id, name in states %}&#xA;        {{ forms.stateOption(id, name, selectedId) }}&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-24T12:46:16.400" LastActivityDate="2015-03-24T12:46:16.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8828" PostTypeId="1" AcceptedAnswerId="8833" CreationDate="2015-03-24T13:57:13.077" Score="1" ViewCount="2082" Body="&lt;p&gt;Is there a fundamental difference between a Craft Category and a Tag?  I originally set up a site using Tags before the Category feature was available and now I'm adding a new section and trying to figure out which I should use.&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2020-02-06T19:33:30.647" Title="Category vs Tag" Tags="&lt;categories&gt;&lt;tags&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8829" PostTypeId="1" AcceptedAnswerId="8839" CreationDate="2015-03-24T15:11:19.687" Score="0" ViewCount="541" Body="&lt;p&gt;I want to create a field like categories but using my plugin data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to select one element in entry page to get all the elements from my plugin group base on that selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;do i go with a custom field type or there is another way ?&lt;/p&gt;&#xA;" OwnerUserId="3444" LastActivityDate="2015-03-24T17:32:59.273" Title="Create a custom field with my plugin data" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;custom-fieldtype&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8830" PostTypeId="1" AcceptedAnswerId="8832" CreationDate="2015-03-24T15:15:50.313" Score="1" ViewCount="221" Body="&lt;p&gt;When I hit /login in a browser, I am redirected to the home page (this is on a vanilla install without any entries or routes set up).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a reserved route? &#xA;Can I change that so I can use it for my own route? &#xA;If it's reserved, what other routes are there that we should know about?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-24T15:41:27.487" Title="It seems /login is a reserved route - is that correct?" Tags="&lt;routes&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8831" PostTypeId="2" ParentId="8828" CreationDate="2015-03-24T15:37:52.520" Score="2" Body="&lt;p&gt;from what i know Category is can have a structure &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ex: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cat 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Cat 11&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cat 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cat 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Cat 33&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---- Cat 333&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tag is multiple. good for filter elements&lt;/p&gt;&#xA;" OwnerUserId="3444" LastActivityDate="2015-03-24T15:37:52.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8832" PostTypeId="2" ParentId="8830" CreationDate="2015-03-24T15:41:27.487" Score="3" Body="&lt;p&gt;That is set by the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#loginPath&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;loginPath&lt;/code&gt; config setting&lt;/a&gt; so yes, you can change it in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few other configurable URLs for templates and redirects, all of which are described on that page.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-03-24T15:41:27.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8833" PostTypeId="2" ParentId="8828" CreationDate="2015-03-24T16:32:43.263" Score="3" Body="&lt;p&gt;You probably did not yet come across this site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/features/all#categories-and-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Categories and Tags – Everything in its right place.&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's explanation about Categories:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can set up Category Groups for managing different taxonomies within Craft, and then apply categories to other elements using a Categories field.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And what they have to say about Tags:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft has built-in folksonomy support as well, with tags. You can set up multiple Tag Groups, and each group will have its own unique set of tags. Create tags on the fly from Tags fields.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastEditorUserId="10472" LastEditDate="2020-02-06T19:33:30.647" LastActivityDate="2020-02-06T19:33:30.647" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8834" PostTypeId="2" ParentId="8822" CreationDate="2015-03-24T16:39:06.383" Score="2" Body="&lt;p&gt;The above code example works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short and simple answer: &lt;strong&gt;daylight saving time (DST)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard time: -1 hour in database&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Daylight saving time: -2 hours in database&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2015-03-24T21:24:44.540" LastActivityDate="2015-03-24T21:24:44.540" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8835" PostTypeId="1" AcceptedAnswerId="8943" CreationDate="2015-03-24T16:47:44.323" Score="2" ViewCount="121" Body="&lt;p&gt;We're currently in the process of migrating web server to a new Ubuntu 14.04 box, and we are running into the same problem across our multiple Craft installations which is majorly affecting our workflow across all projects at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we're updating content in Craft, we're frequently clicking 'Save' on categories, entries etc then having the server response timeout on us. The browser says 'Waiting for reply...', but it can take up to 5 minutes for the page to refresh with the saved data, which does appear to eventually being saved correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spoken to our hosting company, and they told me that they couldn't see anything unusual in the logs, and advised that I install New Relic to be able investigate the problem further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I installed the monitoring software along with the PHP service, and added a line at the top of index.php in Craft to identify the individual applications in New Relic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just experienced the problem again on this site, when I was saving a new nested Category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going into New Relic transactions, I see in the transaction breakdown for the saveCategory transaction that 300,000 ms was spent in CInlineAction::runWithParams.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've included the summary trace from NewRelic in the attached image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could this is a bug inside Craft, or if there is anything specific to our server which maybe causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sOu3B.jpg&quot; alt=&quot;New Relic trace&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2015-03-31T18:27:45.013" Title="Saving causes server not to respond" Tags="&lt;newrelic&gt;&lt;timeout&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2015-03-31T19:39:35.117" ContentLicense="CC BY-SA 3.0" />
  <row Id="8836" PostTypeId="2" ParentId="8835" CreationDate="2015-03-24T16:53:19.710" Score="2" Body="&lt;p&gt;The first thing I would try is to &quot;Disable&quot; every single one of your plugins. If that solves the problem, go through and re-&quot;Enable&quot; each one of them until you have pinpointed which plugin is causing the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't help at all, the next thing I'd do is to open up the Craft logs, and see if anything suspicious is in there...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/storage/runtime/logs/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you're still not seeing anything noteworthy, then it might be worth submitting a ticket from the &quot;Get Help&quot; widget on your dashboard. Be sure to include your logs, database export, and files.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-03-24T16:53:19.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8837" PostTypeId="2" ParentId="8821" CreationDate="2015-03-24T17:10:16.583" Score="2" Body="&lt;p&gt;Forget about the front-end for a moment... That would be a separate, unrelated issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you mass-upload, do all files appear on the back-end (screenshot #2)? And then when you hit &quot;Save&quot;, are all of those assets saved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer to either of those questions is &lt;strong&gt;no&lt;/strong&gt;, then you should file a bug report. Use the &quot;Get Help&quot; widget on your Dashboard, and be sure to include your logs, database export, and files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer to both of those questions is &lt;strong&gt;yes&lt;/strong&gt;, then the problem is not with your file upload. The problem is somewhere in your template. In that case, please &lt;a href=&quot;https://craftcms.stackexchange.com/questions/ask&quot;&gt;post a new question&lt;/a&gt; to ask why your template isn't showing all of your uploaded images.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-24T17:10:16.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8839" PostTypeId="2" ParentId="8829" CreationDate="2015-03-24T17:32:59.273" Score="1" Body="&lt;p&gt;The questions is a bit short on details but from what you've posted, it sounds like a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;custom field type&lt;/a&gt; is what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-24T17:32:59.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8840" PostTypeId="2" ParentId="8780" CreationDate="2015-03-24T19:34:40.957" Score="1" Body="&lt;p&gt;It's more clear to me now that I've seen the database and extra description from the ticket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that you've got an entry that already has has the URI of &lt;code&gt;book&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally the code you're trying to use would work, but in &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;resolving a route&lt;/a&gt; Craft matches any entry/category requests (Step 4) before it matches any dynamic routes (Step 5). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're testing the action URL directly in the browser that works because it hits step 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to pull off what you're looking for is to give your plugin a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt;.  Then from the template that loads when &lt;code&gt;book&lt;/code&gt; is hit, you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) == 'book' %}&#xA;    {% hook &quot;myAwesomeHook&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-03-24T20:04:27.727" LastActivityDate="2015-03-24T20:04:27.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8842" PostTypeId="1" AcceptedAnswerId="8863" CreationDate="2015-03-25T02:52:36.057" Score="2" ViewCount="1008" Body="&lt;p&gt;I've been looking around and can't seem to find anything, maybe it's not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a forum plugin I'm toying with, topics use more data outside of the page in craft's db, so I need a way to bust the cache as craft won't be able to detect a change. So is there a way to 'bust' the Craft Cache possibly with a variable? I'd love to be able to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set param = craft.request.getParam( 'newreply' ) %}&#xA;&#xA;{% cache globally using key craft.request.path until param == '1' %}&#xA;    {# generated page content #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way it'd stay cached until the page was requested with &lt;code&gt;?newreply=1&lt;/code&gt;, effectively busting the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to be working though. Does anyone have any ideas how this could be accomplished? If not possible with twig, would there be a way to do it in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, what if I did something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# twig template #}&#xA;&#xA;{{ craft.myplugin.clearcache( craft.request.path ) }}&#xA;&#xA;&#xA;&#xA;{# MyPluginVariable.php #}&#xA;&#xA;public function clearcache($pageid)&#xA;{&#xA;&#xA;    craft()-&amp;gt;templateCache-&amp;gt;deleteCacheById($pageid);&#xA;&#xA;    return true;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That doesn't seem to do anything though&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-03-25T20:00:20.800" LastActivityDate="2018-02-14T06:42:27.553" Title="Busting Craft Cache" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8843" PostTypeId="1" CreationDate="2015-03-25T07:21:02.683" Score="1" ViewCount="152" Body="&lt;p&gt;I have a potential upcoming project which will be the home for a businesses sporting events, they will have multiple event mini sites, about 4 each year. Each event mini-site will have the same structure but they will have different aesthetics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The content areas will be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home (Single)&lt;/li&gt;&#xA;&lt;li&gt;News (Channel)&lt;/li&gt;&#xA;&lt;li&gt;Videos (Channel) &lt;/li&gt;&#xA;&lt;li&gt;Photos (Channel)&lt;/li&gt;&#xA;&lt;li&gt;Results (Single)&lt;/li&gt;&#xA;&lt;li&gt;Media Contacts (Single)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have no problem setting up the site but I would like offer the client the ability to access an edit entries screen that has just the content for that event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e they could choose the Event from an drop down and they would only see the Singles, Channels and Structures related to that event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also adding the ability to restrict some users access to a particular events content&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? Has anyone built a plugin for something like this? or know how to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="2196" LastEditorUserId="2196" LastEditDate="2015-03-25T07:34:27.663" LastActivityDate="2015-03-25T08:49:06.653" Title="Admin - Manage entries based on a field type choice" Tags="&lt;entries&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8844" PostTypeId="2" ParentId="8843" CreationDate="2015-03-25T08:28:58.493" Score="1" Body="&lt;p&gt;Unfortunately Craft doesn't offer any kind of multi-site support (like MSM in ExpressionEngine, or Wordpress Network/MU) – see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/408/are-there-any-intentions-to-release-multisite-support-for-craft&quot;&gt;this question&lt;/a&gt; for more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Events really are complex enough to warrant a multi-site solution, I guess this is one of those (very few!) cases where Craft might not be your best option right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still want to use Craft, I can think of a few possible solutions off the top of my head:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Have one Craft install per Event/mini-site. Use symlinking to share&#xA;things like core and config fils, plugins and templates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create one Structure per event, containing your &quot;Singles&quot;. Create &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Types&lt;/a&gt; in that Structure for &quot;Home&quot;, &quot;Results&quot; and &quot;Media Contacts&quot;. Have News, Videos and Photos be regular/global Channels, but add a required Relationship field where the relevant Event Structure is set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Same as above, except you create one Structure (three levels deep) that holds all Events.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create top level categories representing your Events, and build on that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go all in and create all your neccessary Channels and Singles per Event. Pre- or postfix all sources with the event name, e.g. &quot;News – Superbowl 2015&quot;, &quot;Videos – Superbowl 2015&quot; and restrict access as neccessary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom locale per event, and piggyback on Craft's excellent &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;multilocale&lt;/a&gt; functionality.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-03-25T08:28:58.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8845" PostTypeId="1" CreationDate="2015-03-25T08:30:50.507" Score="1" ViewCount="687" Body="&lt;p&gt;Please refer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8821/multiple-photos-assets-in-one-upload-entry/8837#8837&quot;&gt;to this thread&lt;/a&gt; for information leading up to this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having problems with mass file uploads, the files will upload in my CP for craft, and be present on the assets list, however when I come to post the entry, only one image will show on my live page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout/_layout&quot; %}&#xA;&#xA;{% set bodyClass = &quot;photos&quot; %}&#xA;&#xA;{% block metaTitle %}{{ entry.title }} Photo Gallery{% endblock %}&#xA;{% block metaDescription %}{{ entry.metaDescription }}{% endblock %}&#xA;&#xA;    {% block content %}&#xA;              &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;page-title-heading&quot;&amp;gt;&#xA;                        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;title-border&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;portfolio-container&quot;&amp;gt;&#xA;        {{ entry.body }}&#xA;&#xA;        &amp;lt;ul id=&quot;portfolio-items-one-fourth&quot; class=&quot;portfolio-items-one-fourth clearfix&quot;&amp;gt;&#xA;            {% set photos = entry.photos %}&#xA;            {% if photos | length %}&#xA;            {% for photo in photos %}&#xA;            &amp;lt;li class=&quot;item photo&quot; style=&quot;display: inline-block; opacity: 1;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;item-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;link-holder&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;portfolio-item-holder&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;portfolio-item-hover-content&quot;&amp;gt;&#xA;                                {% set image = photo.uploadPhoto.first() %}&#xA;                                &amp;lt;a href=&quot;{{ image.getUrl('photoLightbox') }}&quot; class=&quot;fancybox&quot; rel=&quot;gallery&quot; title=&quot;{{ photo.photoCaption }}&quot;&amp;gt;&#xA;                                    &amp;lt;img src=&quot;{{ image.getUrl('photoListing') }}&quot; width=&quot;270&quot; class=&quot;portfolio-img&quot;&amp;gt;&#xA;                                &amp;lt;/a&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;            {% endif %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;p class=&quot;next-prev gallery-links&quot;&amp;gt;&#xA;        {% set prev = entry.getPrev({'section' : entry.section.handle}) %}&#xA;        {% set next = entry.getNext({'section' : entry.section.handle}) %}&#xA;        {% if prev %}&amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;amp;laquo; {{ prev }}&amp;lt;/a&amp;gt;{% endif %}&#xA;        {% if next %}&amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;{{ next }} &amp;amp;raquo;&amp;lt;/a&amp;gt;{% endif %}&#xA;    &amp;lt;/p&amp;gt;&#xA;    &amp;lt;p class=&quot;photo-credits gallery-links&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;/photo-credits&quot;&amp;gt;Photographer credits&amp;lt;/a&amp;gt;.&#xA;    &amp;lt;/p&amp;gt;&#xA;&#xA;    {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help with rectifying this code would be absolutely wholeheartedly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3447" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-27T14:17:22.883" Title="Uploaded photos not showing on entry" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8846" PostTypeId="2" ParentId="8843" CreationDate="2015-03-25T08:42:49.120" Score="3" Body="&lt;p&gt;It's not (yet) possible to have multiple websites with dedicated front-end and back-end views within one Craft installation (Multi-site feature). There's some users that mis-use Craft's localization feature for this, but I definitely wouldn't recommend this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is actually not a problem at all to route all your subdomains to individual template folders of a single installation (→ &lt;a href=&quot;https://craftcms.stackexchange.com/q/4717/125&quot;&gt;Is it possible to route a subdomain to specific template group?&lt;/a&gt;). And for the backend, I'd simply create a user group for each of your events and configure the permissions accordingly (→ &lt;a href=&quot;https://buildwithcraft.com/features/users&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assign permissions to users and groups&lt;/a&gt;). So user group &quot;Summer Party&quot; has only access to sections belonging to that sub-site. Individual users can be assigned to more than one group if necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of having lots of single sections (&quot;Summer Party - Home&quot;, &quot;Summer Party - Results&quot;, &quot;Summer Party - Media Contacts&quot;) I would recommend to look into replacing this with a single structure section (&quot;Summer Party - Pages&quot;) with multiple entry types. And for your media channels you could also consider not using entries at all and assign fields to your assets directly.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-03-25T08:49:06.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8847" PostTypeId="2" ParentId="8845" CreationDate="2015-03-25T09:05:36.980" Score="3" Body="&lt;p&gt;It looks like you're trying to access another asset within your assets (asset meta field).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = entry.photos %}&#xA;&#xA;{# Loop assets of `entry.photos` as `photo` #}&#xA;{% for photo in photos %}&#xA;&#xA;    {# Get first `uploadPhoto` element within `entry.photos[nth]` #}&#xA;    {% set image = photo.uploadPhoto.first() %}&#xA;    {{ image.getUrl() }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess that's not what you want. Check your field handles again, you probably only need to do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = entry.photos %}&#xA;&#xA;{% for photo in photos %}&#xA;    {{ photo.getUrl() }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If 'uploadPhoto' is an asset source and you allow users to upload to multiple sources, but only want to loop assets from 'uploadPhoto' in your template, you would do this like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = entry.photos.source('uploadPhoto') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-25T09:38:39.970" LastActivityDate="2015-03-25T09:38:39.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8848" PostTypeId="2" ParentId="4432" CreationDate="2015-03-25T09:36:11.110" Score="3" Body="&lt;p&gt;You're not overlooking anything. What you're asking for is not a core feature of Craft and probably will never be. There's also no plugin yet that does something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the only answer I can give you right now is that you have to find someone who makes such a plugin for you. The &lt;a href=&quot;http://straightupcraft.com/jobs&quot; rel=&quot;nofollow&quot;&gt;jobs board&lt;/a&gt; on straightupcraft.com is probably a good address to find a developer.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-25T09:36:11.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8849" PostTypeId="1" CreationDate="2015-03-25T11:20:45.803" Score="3" ViewCount="250" Body="&lt;p&gt;I'm wondering if anyone has come across this issue I have with the Dukt Video plugin and oAuth using it in a development environment using craft.dev?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google oAuth only excepts top level domains for the re-direct url so the .dev url gets flagged as incorrect so I am unable to add the the redirect url to Google. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also encountered a problem on Vimeo where is throws a cURL error #60 after trying to connect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And trying to use oAuth with Facebook or Twitter throws the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;cURL Error # 60: SSL certificate problem: unable to get local issuer certificate&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I need to test the plugin in a development environment so does anyone know a solution?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="45" LastEditDate="2015-03-31T23:41:24.297" LastActivityDate="2016-05-24T08:10:21.833" Title="Dukt Video plugin oAuth issue with development environment" Tags="&lt;plugin-duktvideos&gt;&lt;plugin-duktoauth&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8850" PostTypeId="1" AcceptedAnswerId="8851" CreationDate="2015-03-25T16:23:20.153" Score="2" ViewCount="1726" Body="&lt;p&gt;Is anyone able to tell me why variables which I've defined inside of a for loop are persisting and retaining their values on into consecutive iterations? In order to overcome this, I've had to set them back to null each time. I'm relatively new to Craft and Twig but this seems like a bug. Has anyone else experienced this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in entries %}&#xA;&#xA;      {# I shouldn't have to set these to null for each loop iteration, #}&#xA;      {# but they seem to be retaining their values #}&#xA;&#xA;      {% set photo = null %}&#xA;      {% set width = null %}&#xA;      {% set height = null %}&#xA;      {% set orientation = null %}&#xA;&#xA;      {% if entry.photo | length %}&#xA;        {% set photo = entry.photo.first() %}&#xA;        {% set width = photo.width %}&#xA;        {% set height = photo.height %}&#xA;        {% set orientation = '' %}&#xA;&#xA;        {% if width &amp;gt; height %}&#xA;          {% set orientation = 'landscape' %}&#xA;        {% elseif height &amp;gt; width %}&#xA;          {% set orientation = 'portrait' %}&#xA;        {% elseif width == height %}&#xA;          {% set orientation = 'square' %}&#xA;        {% endif %}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;article class=&quot;entry{% if orientation %} {{ orientation }}{% endif %}&quot;&amp;gt;&#xA;        {% if entry.photo | length %}&#xA;          &amp;lt;img src=&quot;{{ photo.getUrl('small') }}&quot; width=&quot;{{ photo.getWidth('small') }}&quot; height=&quot;{{ photo.getHeight('small') }}&quot; alt=&quot;{{ photo.title }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;      &amp;lt;/article&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3455" LastActivityDate="2015-03-26T17:54:52.863" Title="Why are variables persisting inside of my for loop?" Tags="&lt;variable&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8851" PostTypeId="2" ParentId="8850" CreationDate="2015-03-25T17:20:41.540" Score="4" Body="&lt;p&gt;This is totally normal and expected behavior. In fact, it's critical for some looping situations, and pretty standard across programming languages. Wouldn't you expect to find this same behavior in PHP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about situations where previous loops build on each other. Here's an example of a situation where loop values &lt;strong&gt;need&lt;/strong&gt; to be retained...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set totalPets = 0 %}&#xA;&#xA;{% for petOwner in craft.entries.section('petOwners').find %}&#xA;&#xA;    {% set totalPets = totalPets + petOwner.numberOwned %}&#xA;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;p&amp;gt;This group of people owns {{ totalPets }} pets total.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ultimately, this is a simple scope issue. Generally speaking, &lt;code&gt;for&lt;/code&gt; loops don't exist in their own scope... they are a part of the scope created by the parent script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to ensure that your logic takes place in a &lt;strong&gt;separate scope&lt;/strong&gt;, take a look into &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig macros...&lt;/a&gt; A macro would probably be very helpful in your situation.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-03-26T17:54:52.863" LastActivityDate="2015-03-26T17:54:52.863" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8852" PostTypeId="1" CreationDate="2015-03-25T18:10:32.930" Score="0" ViewCount="680" Body="&lt;p&gt;I can't find a way to include buttons on the correct place at the sidebar of my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I noticed that on the sidebar markup, there's a div for buttons, there's created automatically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p4vcp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can easily add anything to the sidebar, I can include the buttons on the top, as you can see on the example, but my question is, how do I add the buttons to that div?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't find on the templates the correct place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% includeCssResource &quot;crashC/css/crashC.css&quot; %}&#xA;&#xA;{% set title = &quot;Entries&quot; %}&#xA;{% set selectedTab = 'entries' %}&#xA;{% set elementType = &quot;CrashC&quot; %}&#xA;{% set docsUrl = '' %}&#xA;&#xA;{% block sidebar %}&#xA;  &amp;lt;a href=&quot;http://##&quot; class=&quot;btn submit&quot;&amp;gt;Download CSV&amp;lt;/a&amp;gt;&#xA;  {{ parent() }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for the help!&lt;/p&gt;&#xA;" OwnerUserId="1103" LastEditorUserId="1103" LastEditDate="2015-03-25T18:17:01.547" LastActivityDate="2015-03-25T19:09:47.273" Title="How can I add buttons to the sidebar?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8853" PostTypeId="2" ParentId="8852" CreationDate="2015-03-25T18:48:40.293" Score="2" Body="&lt;p&gt;I found a solution for this one, actually, you can do this with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Javascript&lt;/strong&gt;: &lt;code&gt;Craft.elementIndex.addButton($('&amp;lt;a href=&quot;http:/##&quot; class=&quot;btn submit&quot; /&amp;gt;').html('test'))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template&lt;/strong&gt;: Just add a div with class &lt;code&gt;.buttons&lt;/code&gt;, Craft's javascript will check for that and you won't get duplicated divs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block sidebar %}&#xA;  &amp;lt;div class=&quot;buttons&quot;&amp;gt;&#xA;     &amp;lt;a href=&quot;http://##&quot; class=&quot;btn submit&quot;&amp;gt;Download CSV&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  {{ parent() }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Done.&#xA;I hope this helps others too.&lt;/p&gt;&#xA;" OwnerUserId="1103" LastEditorUserId="1103" LastEditDate="2015-03-25T19:09:47.273" LastActivityDate="2015-03-25T19:09:47.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8854" PostTypeId="1" AcceptedAnswerId="8855" CreationDate="2015-03-25T18:52:35.357" Score="1" ViewCount="1119" Body="&lt;p&gt;How can I redirect a member to account page on first visit with a cookie set? My redirect is looping now. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;   {% set name = currentUser.firstName %}&#xA;   {% do craft.lj_cookies.set('account', name) %}&#xA;&#xA;&#xA;&#xA;   {% set redirect = craft.lj_cookies.get('account') %}&#xA;&#xA;   {% if redirect == name %}&#xA;       {% redirect name %}&#xA;   {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not possible to visit any other URL anymore.&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-03-25T20:07:52.320" Title="How to set cookie and redirect to page one time" Tags="&lt;redirect&gt;&lt;member&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8855" PostTypeId="2" ParentId="8854" CreationDate="2015-03-25T19:46:22.267" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% set name = currentUser.firstName %}&#xA;    {% if craft.lj_cookies.get('account') != name %}&#xA;        {% do craft.lj_cookies.set('account', name) %}&#xA;        {% redirect name %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In you're original code you're setting the cookie before getting it into the redirect variable, so the {% if redirect == name %} conditional is always true.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-03-25T20:07:52.320" LastActivityDate="2015-03-25T20:07:52.320" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8856" PostTypeId="1" CreationDate="2015-03-25T20:40:41.620" Score="0" ViewCount="645" Body="&lt;p&gt;I have a template with just this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'amenities/_types/amenities' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a template error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Never encountered this one before. What is causing this?&lt;/p&gt;&#xA;" OwnerUserId="3326" LastActivityDate="2015-03-25T20:51:09.363" Title="Include results in &quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot;" Tags="&lt;error-templates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8857" PostTypeId="2" ParentId="8856" CreationDate="2015-03-25T20:51:09.363" Score="2" Body="&lt;p&gt;Well I now see this error was caused by the included template and not the fact that I was trying to include a template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that the error message would show the error on the included template that was the actual source of the problem, but it was just referencing the include as the error.&lt;/p&gt;&#xA;" OwnerUserId="3326" LastActivityDate="2015-03-25T20:51:09.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8858" PostTypeId="2" ParentId="8842" CreationDate="2015-03-25T21:00:04.637" Score="1" Body="&lt;p&gt;I haven't tested this but I'm pretty sure what you want is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path unless param == '1' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More information on the unless parameter can be found at &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2015-03-25T21:00:04.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8859" PostTypeId="2" ParentId="8391" CreationDate="2015-03-25T22:40:43.030" Score="2" Body="&lt;p&gt;Does the request requires login?&lt;br&gt;&#xA;If it doesn't, you need to add the exception on the controller&lt;br&gt;&#xA;&lt;code&gt;protected $allowAnonymous = array('actionSubscribe');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, did you try adding &lt;strong&gt;admin&lt;/strong&gt; to your URL?&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;/admin/actions/paypalSubscription/subscription/subscribe&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying to post to an action once through the front-end and it only worked after adding &lt;strong&gt;/admin&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1103" LastActivityDate="2015-03-25T22:40:43.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8860" PostTypeId="1" AcceptedAnswerId="8861" CreationDate="2015-03-25T23:16:10.383" Score="1" ViewCount="713" Body="&lt;p&gt;I have some data I want to store in session:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$data = array&#xA;(&#xA;    'id' =&amp;gt; '23539471'&#xA;    'token' =&amp;gt; 'cf310b81-9431-4303-804d-c1635ae29278'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my plugin I am doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new HttpCookie('myCookieName', $data, [ 'expire' =&amp;gt; time() + 3600 ]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I dd() that I can see the cookie as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\HttpCookie#1&#xA;(&#xA;    [name] =&amp;gt; 'myCookieName'&#xA;    [value] =&amp;gt; array&#xA;    (&#xA;        'id' =&amp;gt; '23539471'&#xA;        'token' =&amp;gt; 'cf310b81-9431-4303-804d-c1635ae29278'&#xA;    )&#xA;    [domain] =&amp;gt; ''&#xA;    [expire] =&amp;gt; 1427328767&#xA;    [path] =&amp;gt; '/'&#xA;    [secure] =&amp;gt; true&#xA;    [httpOnly] =&amp;gt; true&#xA;    [CComponent:_e] =&amp;gt; null&#xA;    [CComponent:_m] =&amp;gt; null&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However on the next page load the cookie is null:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cookie = craft()-&amp;gt;request-&amp;gt;getCookie('myCookieName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;::::EDIT::::&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried this which seems to make the cookie available in the current request, but it's null on the next request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cookie = new HttpCookie('myCookieName', $data);&#xA;$cookie-&amp;gt;expire = time() + 3600;&#xA;&#xA;craft()-&amp;gt;request-&amp;gt;cookies-&amp;gt;add('myCookieName', $cookie);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-03-25T23:43:37.110" LastActivityDate="2015-03-25T23:43:37.110" Title="How should I set an arbitrary session value in a plugin?" Tags="&lt;plugin-development&gt;&lt;security&gt;&lt;cookies&gt;&lt;session&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8861" PostTypeId="2" ParentId="8860" CreationDate="2015-03-25T23:42:23.770" Score="3" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cookie = new HttpCookie('myCookieName', $data, [ 'expire' =&amp;gt; time() + 3600 ]);&#xA;craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add( $cookie-&amp;gt;name, $cookie );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your code for reading the cookie is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also – since you use the term &quot;session value&quot; and tagged your question w/ &quot;security&quot; – I'd like to point out that cookies and session variables are different things. The former is stored on the client (the browser), the latter only on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you specifically need a cookie (e.g. because you want the data to persist a certain amount of time) it might be better to just create a basic session variable, using the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpSessionService&quot; rel=&quot;nofollow noreferrer&quot;&gt;HttpSession&lt;/a&gt; service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add( $key, $value ); // Set the session variable&#xA;craft()-&amp;gt;httpSession-&amp;gt;get( $key ); // Get the session variable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/2240556/when-should-i-use-session-variables-instead-of-cookies&quot;&gt;Read more about session variables vs. cookies here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-03-25T23:42:23.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8862" PostTypeId="1" AcceptedAnswerId="8864" CreationDate="2015-03-26T01:08:29.560" Score="4" ViewCount="2756" Body="&lt;p&gt;&lt;strong&gt;Short Question:&lt;/strong&gt;&#xA;I'm coming from ExpressionEngine where 'dynamic' would do the trick. However I can't seem to figure out how to do this in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to use one Channel to show content in different places on the site. Can Craft look at a particular URL segment and load the entry? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Longer explanation&lt;/strong&gt;&#xA;I have many users who will have their own 'site' on a website. Each 'site' will have four basic pages&#xA;-welcome&#xA;-my story&#xA;-my work&#xA;-blog&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Blog page will show entries authored by them, but all users will share the same channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have it all working for the main pages. I'm creating a Structure section for each user. I point it to a template (_userTemplates/johnDoe) that contains some variables and includes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set author = &quot;12&quot; %}&#xA;{% set sectionName = &quot;johnDoe&quot; %}&#xA;&#xA;{% set content %}&#xA;{% include &quot;_partials/content&quot; %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Layout looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;{% include &quot;_partials/htmlHead&quot; %}&#xA;&amp;lt;body&amp;gt;&#xA;&#xA;{% include &quot;_partials/nav&quot; %}&#xA;&#xA;{{ content }}&#xA;&#xA;{% include &quot;_partials/footer&quot; %}&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_partials/nav has dynamic navigation. It pulls the variable &quot;sectionName&quot; from the user's template to show their navigation links for their structure pages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;desktop {{ type is defined ? type }}&quot; role=&quot;navigation&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% set pages = craft.entries.section(sectionName) %}&#xA;            {% nav page in pages %}&#xA;            &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_partials/content looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(3) != '' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;grid padded full-768&quot;&amp;gt;&#xA;            {% include &quot;_partials/contentBuilder&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;{% elseif craft.request.getSegment(2) == 'blog' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;grid padded full-768&quot;&amp;gt;  &#xA;            {% include &quot;_partials/blogListing&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;{% elseif craft.request.getSegment(3) == '' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;grid padded full-768&quot;&amp;gt;&#xA;            {% include &quot;_partials/contentBuilder&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The template that contains all the content, _partials/contentBuilder, looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;header&amp;gt;&#xA;        &amp;lt;h1 class=&quot;alpha highlighted&quot;&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/header&amp;gt;&#xA;    {% for content in entry.contentEditor %}&#xA;        {% if content.type == 'heading' %}&#xA;            &amp;lt;h2&amp;gt;{{ content.heading }}&amp;lt;/h2&amp;gt;&#xA;        {% elseif content.type == 'subheading' %}&#xA;            &amp;lt;h3&amp;gt;{{ content.subheading }}&amp;lt;/h3&amp;gt;&#xA;        {% elseif content.type == 'image' %}&#xA;            {% for image in content.imageFile %}&#xA;                &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;            {% endfor %}&#xA;        {% elseif content.type == 'text' %}&#xA;            {{ content.text }}&#xA;        {% elseif content.type == 'blockquote' %}&#xA;            &amp;lt;blockquote&amp;gt;{{ content.blockquoteQuote }}&amp;lt;/blockquote&amp;gt;&#xA;            {% if content.blockquoteCitation %}&#xA;            &amp;lt;cite&amp;gt;{{ content.blockquoteCitation }}&amp;lt;/cite&amp;gt;&#xA;            {% endif %}&#xA;        {% elseif content.type == 'video' %}&#xA;            {% if content.videoTitle != '' %}&#xA;                &amp;lt;h3&amp;gt;{{ content.videoTitle }}&amp;lt;/h3&amp;gt;&#xA;            {% endif %}&#xA;            {{ craft.embedder.embed (content.videoUrl) }}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great for the main Structure pages. However when the template route &quot;johndoe/blog/{slug} points to _userTemplates/johnDoe this does not work. I get &quot;Variable &quot;entry&quot; does not exist&quot;. I thought that the template route would look for an entry and then know which entry it is? I will try pulling the entry from the URL segment per one of the answers and see how that works. However I thought the route would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT - Got it working using this in _partials/content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(3) != '' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div &amp;gt;&#xA;            {% for entry in craft.entries.slug(slug).find() %}&#xA;                {% include &quot;_partials/contentBuilder&quot; %}&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;{% elseif craft.request.getSegment(2) == 'updates' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div&amp;gt;   &#xA;            {% include &quot;_partials/updateListing&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;{% elseif craft.request.getSegment(3) == '' %}&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div&amp;gt;&#xA;            {% include &quot;_partials/contentBuilder&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like I was expecting too much from the template route. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of all this is to be able to give people their own &quot;site&quot;, and do it quickly with code that is easy to manage and maintain. This method only requires a new section be created, set up the user with proper permissions, create their template partial, and set up the route. If there is a better way to do this, let me know. &lt;/p&gt;&#xA;" OwnerUserId="49" LastEditorUserId="49" LastEditDate="2015-03-26T16:32:39.890" LastActivityDate="2015-03-26T17:40:11.213" Title="Show entry in channel based on URL segment" Tags="&lt;routing&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8863" PostTypeId="2" ParentId="8842" CreationDate="2015-03-26T02:34:18.967" Score="6" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/updates#build2664&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4&lt;/a&gt; is now available, adding the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/TemplateCacheService#deleteCachesByKey-detail&quot; rel=&quot;nofollow&quot;&gt;deleteCachesByKey&lt;/a&gt; method. This means the following would be the best solution to this question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function clearcache($key)&#xA;{&#xA;    craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByKey($key);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your original attempt using a variable method will actually work (as long as the call to the variable method &lt;code&gt;clearcache&lt;/code&gt; occurs before the cache tag in your template, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Your problem is that the&lt;/em&gt; &lt;code&gt;deleteCacheById()&lt;/code&gt; &lt;em&gt;method expects the template cache's database ID, not the cache key.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, &lt;a href=&quot;https://buildwithcraft.com/classreference/services/TemplateCacheService&quot; rel=&quot;nofollow&quot;&gt;TemplateCacheService&lt;/a&gt; doesn't actually offer an easy way to delete a cache by its key, so you'll need to get your hands dirty with a custom SQL query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function clearcache( $key )&#xA;{&#xA;    craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;delete( 'templatecaches', 'cacheKey=:key', array( ':key'=&amp;gt; $key ) );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: I'd imagine there's a good reason &lt;em&gt;why&lt;/em&gt; there's no core &lt;code&gt;deleteCacheByKey&lt;/code&gt; method, so it'd be great if somebody with a deeper knowledge of template caches could chime in. Might be there's some ramifications or negative side effects to deleting a cache manually like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sidenote 1: Since the &lt;code&gt;clearcache&lt;/code&gt; method shouldn't return any data, consider using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/do.html&quot; rel=&quot;nofollow&quot;&gt;do&lt;/a&gt; method to call it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.myplugin.clearcache( craft.request.path ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sidenote 2: Instead of using a combination of GET variables and plugin variable methods to clear the cache, you might want to consider an implementation where you POST your &quot;replies&quot; form to a &lt;em&gt;controller action method&lt;/em&gt; in your plugin. The controller could then be responsible for &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Saving the reply (possibly to an external application using cURL?)&lt;/li&gt;&#xA;&lt;li&gt;Busting the relevant template cache w/ a custom DbCommand&lt;/li&gt;&#xA;&lt;li&gt;Redirecting back to the referring page&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Having a controller (which in turn might call methods on a &lt;em&gt;service&lt;/em&gt; to execute on the above points) might, in my opinion, make for a cleaner implementation than the proposed solution (just based on the limited information you've provided, of course – I wouldn't know about the details or inner workings of your application).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-03T01:12:45.517" LastActivityDate="2015-06-03T01:12:45.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8864" PostTypeId="2" ParentId="8862" CreationDate="2015-03-26T04:06:12.527" Score="8" Body="&lt;p&gt;You can retrieve the entry by grabbing it from the URL as a variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entrySlug = craft.request.lastSegment %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then using craft.entries to find the matching content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(entrySlug).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively when you set up your route, so that Craft knows which template to load when someone is requesting your entry, you can use the &quot;slug&quot; token which will expose a slug var in your template automatically.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(slug).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if I understood the question correctly and my apologies for saying anything you already knew!&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2015-03-26T04:06:12.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8865" PostTypeId="2" ParentId="8862" CreationDate="2015-03-26T08:14:08.040" Score="6" Body="&lt;p&gt;Alan describes how to setup a route via the &lt;code&gt;Settings-&amp;gt;Routes&lt;/code&gt; area in the CP. If you happen to be managing file based routes you can setup a similar route like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    // Your Custom Section &#xA;    'username/blog/(?P&amp;lt;slug&amp;gt;.*)' =&amp;gt;&#xA;    'blog/_entry'&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The third segment in your route &lt;code&gt;(?P&amp;lt;slug&amp;gt;.*)&lt;/code&gt; creates the variable that will be accessible in your template on that page.  You can name the dynamic route variable whatever you would like (for example, &lt;code&gt;(?P&amp;lt;anythingYouWantHere&amp;gt;.*)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your &lt;code&gt;blog/_entry&lt;/code&gt; template gets loaded.  That &lt;code&gt;slug&lt;/code&gt; variable will be available just like any other global variable.  You can access it using the standard output syntax: &lt;code&gt;{{ slug }}&lt;/code&gt; or by passing it to your &lt;code&gt;craft.entries&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(slug).first() %}&#xA;&#xA;{{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.slug(slug)&lt;/code&gt; will limit your query to just return the entry you want and, &lt;code&gt;.first()&lt;/code&gt; will make sure you can access that entry without needing to treat it like an array and loop through it.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-03-26T17:40:11.213" LastActivityDate="2015-03-26T17:40:11.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8866" PostTypeId="1" CreationDate="2015-03-26T09:49:44.397" Score="0" ViewCount="78" Body="&lt;p&gt;I have one page under &lt;code&gt;https://&lt;/code&gt; how do I deliver the images there via &lt;code&gt;https&lt;/code&gt;? Whith the whole site under &lt;code&gt;https&lt;/code&gt; it's easy via &lt;code&gt;environmentVariables&lt;/code&gt; but what if there is just one secure page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a realtive url transform variable? Or do I need to set a separate &lt;code&gt;environmentVariables&lt;/code&gt; just for the assets on this page?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-03-26T09:49:44.397" Title="Protocol agnostic image transform url's" Tags="&lt;ssl&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8867" PostTypeId="1" AcceptedAnswerId="8872" CreationDate="2015-03-26T10:24:16.270" Score="2" ViewCount="142" Body="&lt;p&gt;I have a 100 articles, and with for each article 1 author. Authors can only edit their own entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every article as an Asset directory called &quot;Photo Album&quot;. This works fine. Beautiful, even. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that, when I enable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- View source&#xA;--- Upload files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.... every author from the group has access to the entire Assets, Photo Album folder, globally, so to all folders. I need to enable the &quot;View source&quot; part because they also need to be able to add a Caption and Copyright notice for each picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under Sections, one could finegrain this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Edit other authors’ entries&#xA;- Edit other authors’ drafts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But not with Assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a fix for this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really expect my editors to start sabotaging each others's articles but it's not very elegant, and mistakes can be made, esp with 100 directories in there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2015-03-26T12:44:09.940" Title="Problem isolating assets" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8868" PostTypeId="2" ParentId="8867" CreationDate="2015-03-26T10:45:29.990" Score="3" Body="&lt;p&gt;As far as I know you can't restrict users to certain folders in the Assets section of Craft, you can only set their permissions for the whole Asset Source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only workaround I can think of for you would be to actually remove Authors permissions on the Assets section of Craft completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way the only way they can make Asset updates is when they are editing an entry, and with the permissions structure you have they can only edit entries they have made themselves anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As they don't have access to other people's entries, they can't edit the assets on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may not be the most elegant approach but it would give you the functionality you are looking for. I'm sure others might have a better way of handling it though. Hope that helps a little.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-03-26T11:23:44.610" LastActivityDate="2015-03-26T11:23:44.610" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8869" PostTypeId="1" AcceptedAnswerId="8870" CreationDate="2015-03-26T11:01:48.907" Score="5" ViewCount="910" Body="&lt;p&gt;Can I use the free version of Craft for a portfolio site?  I know the free version of ee is for personal/non-profit sites only.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2204" LastActivityDate="2015-11-23T14:41:41.707" Title="Craft Personal for portfolio site" Tags="&lt;license&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8870" PostTypeId="2" ParentId="8869" CreationDate="2015-03-26T11:27:31.947" Score="6" Body="&lt;p&gt;As long as the features are sufficient, you can use it for whatever you want. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-03-26T11:27:31.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8871" PostTypeId="2" ParentId="8869" CreationDate="2015-03-26T11:27:42.100" Score="5" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://buildwithcraft.com/pricing&quot; rel=&quot;nofollow&quot;&gt;pricing/edition overview page&lt;/a&gt; and &lt;a href=&quot;https://buildwithcraft.com/license&quot; rel=&quot;nofollow&quot;&gt;license agreement&lt;/a&gt; – neither puts any restrictions on what you can or can't use Craft Personal for.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-03-26T11:27:42.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8872" PostTypeId="2" ParentId="8867" CreationDate="2015-03-26T12:38:46.430" Score="3" Body="&lt;p&gt;I didn't know this yet, but it seem like you can't do Quick Editing asset meta fields from the Edit Entry view for asset sources you don't have editing permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your situation this get's into the way of setting things up like Jamie Wade suggested. But it's actually quite logical: no editing permissions means no permissions anywhere. So what you actually need is to have this setting to be split into:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Edit assets from Assets view&quot;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Edit assets form Edit Entry view&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You could try to convince P&amp;amp;T of the usefulness of such a permission setting by adding a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime you could use a workaround and simply hide the assets panel completely for all users but admins for example. You would give your users the permission to edit all assets from all entries, but they won't find a way to do so as they can't access the UI for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this you can make use of the new &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyCpNav&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;modifyCpNav&lt;/code&gt;&lt;/a&gt; hook in a small &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;businesslogic plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyCpNav(&amp;amp;$nav)&#xA;{&#xA;    if (!craft()-&amp;gt;userSession-&amp;gt;isAdmin())&#xA;    {&#xA;        unset($nav['assets']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-26T12:44:09.940" LastActivityDate="2015-03-26T12:44:09.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8873" PostTypeId="1" AcceptedAnswerId="8893" CreationDate="2015-03-26T12:46:57.337" Score="2" ViewCount="1334" Body="&lt;p&gt;I try go get entries (of channel B) related to an entry (of channel A) within a list of entries (of channel A). All entries of channel B have a relationship field and at least one relation to an entry in channel A. But I get no results from channel B. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('candidates').order('postDate asc') %}&#xA;{% for entry in entries %}&#xA;    {% set feedbacks = craft.entries.section('candidates_feedbacks').relatedTo(entry.id) %}&#xA;    {{ entry.title }}&#xA;    {% for feedback in feedbacks %}&#xA;        {{ feedback.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your feedback.&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="57" LastEditDate="2015-03-26T15:56:42.133" LastActivityDate="2015-03-27T07:52:36.607" Title="Entries related to an entry in a list of entries" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8875" PostTypeId="1" AcceptedAnswerId="8877" CreationDate="2015-03-26T15:53:07.080" Score="2" ViewCount="1003" Body="&lt;p&gt;I'm trying to display a list of favorited entries. I have a wishlist with entry id's build with Shortlist. So now I want to display them but it doesn't work. The first part getting the favorited id's works perfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set favIds = [] %}&#xA;&#xA;        {# LOOP TRUE FAV IDS AND MAKE ARRAY #}&#xA;        {% for list in lists %}&#xA;            {% if list.items is empty %}&#xA;            &amp;lt;p&amp;gt;No wishlist&amp;lt;/p&amp;gt;&#xA;            {% else %}&#xA;                {% for entry in list.items %}&#xA;                    {% set favId = entry.id %}&#xA;                    {% set favIds = favIds|merge([favId]) %}&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        {# CONVERT favIds array in comma separated list #}&#xA;        {% set favIdString = favIds|join(', ') %}&#xA;&#xA;        {% set wishlist = craft.entries.id(favIdString).fixedOrder('true') %}       &#xA;&#xA;        {% for entry in wishlist %}&#xA;            {{ entry.title }}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But nothing shows up. If I output {{ favIdString }} I get a nice list if entry ID's. 9619, 9620, 9621, 9622, 9624, 9625&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2015-03-29T12:48:31.587" LastActivityDate="2015-03-29T12:48:31.587" Title="Get entry's from fixed ID array" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8877" PostTypeId="2" ParentId="8875" CreationDate="2015-03-26T16:24:51.170" Score="3" Body="&lt;p&gt;Turns out... the ID's are wrong. I've listed the shortlist ID's and not the entry ID's. Should use entry.elementId. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the fix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in list.items %}&#xA;      {% set favId = entry.elementId %}&#xA;      {% set favIds = favIds|merge([favId]) %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-03-26T16:24:51.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8878" PostTypeId="1" AcceptedAnswerId="9006" CreationDate="2015-03-26T17:42:05.263" Score="0" ViewCount="564" Body="&lt;p&gt;I'm having some issues with my install of craft on a staging server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm deploying using Capistrano, and (perhaps wrongly) added craft/storage to linked_dirs (to share between deployments). Since doing that, things have not been going so well with my installation. I keep get &quot;No response&quot; screen in the browser, &lt;code&gt;(Error code: ERR_EMPTY_RESPONSE)&lt;/code&gt;. I also get &quot;unknown error occurred&quot; messages when browsing round the admin doing normal things like updating entries etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only consistent error is this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/03/26 17:33:53 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php:916&#xA;Stack trace:&#xA;#0 /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php(230): Craft\WebApp-&amp;gt;_enforceSystemStatusPermissions()&#xA;#1 /var/www/50th/releases/20150326171328/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /var/www/50th/releases/20150326171328/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /var/www/50th/releases/20150326171328/public/index.php(19): require_once('/var/www/50th/r...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;2015/03/26 17:33:53 [error] [application]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's worth noting that the site is in offline-mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;I've found a consistent error message when trying to access &quot;/admin/users&quot;:&#xA;[DOMAINNAME...]/index.php/admin/actions/elementIndex/getElements net::ERR_EMPTY_RESPONSE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is being returned by jQuery trying to access elements. Does this help at all?&lt;/p&gt;&#xA;" OwnerUserId="3438" LastEditorUserId="3438" LastEditDate="2015-03-26T18:49:12.930" LastActivityDate="2015-04-03T08:24:00.213" Title="Craft storage dir as linked in capistrano" Tags="&lt;deployment&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8879" PostTypeId="1" AcceptedAnswerId="8880" CreationDate="2015-03-26T18:36:23.770" Score="2" ViewCount="564" Body="&lt;p&gt;I have problems getting Live Preview to work with this Twig code that gets data from a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.matrixField.type('copy').nth(0).plainText }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As soon as I remove the &lt;code&gt;type&lt;/code&gt; property from the criteria model, it does update on entry changes again!&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2019-05-18T12:31:19.890" Title="Issue with Matrix `type` property and Live Preview?" Tags="&lt;matrix&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8880" PostTypeId="2" ParentId="8879" CreationDate="2015-03-26T19:21:36.463" Score="5" Body="&lt;p&gt;Live preview have gone through a major refactoring for Craft 3.2, which addresses this issue. For Craft 3.1 and below see solutions below.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is happening because Matrix will only show the non-live blocks so long as you don’t set any Matrix parameters in your template. As soon as you tell it to only show blocks of a certain type, it no longer feels confident that the blocks it was going to output are the right ones, so it will dump them and run a new DB query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible way around this would be to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft 2:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isLivePreview %}&#xA;    {% set firstCopyBlock = null %}&#xA;    {% for block in entry.matrixField %}&#xA;        {% if firstCopyBlock == null and block.type.handle == 'copy' %}&#xA;            {% set firstCopyBlock = block %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {% set firstCopyBlock = entry.matrixField.type('copy').first() %}&#xA;{% endif %}&#xA;&#xA;{% if firstCopyBlock %}&#xA;    {{ firstCopyBlock.plainText }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft 3:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.app.request.isLivePreview %}&#xA;    {% set firstCopyBlock = null %}&#xA;    {% for block in entry.matrixField.all() %}&#xA;        {% if firstCopyBlock == null and block.type.handle == 'copy' %}&#xA;            {% set firstCopyBlock = block %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {% set firstCopyBlock = entry.matrixField.type('copy').one() %}&#xA;{% endif %}&#xA;&#xA;{% if firstCopyBlock %}&#xA;    {{ firstCopyBlock.plainText }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="125" LastEditDate="2019-05-18T12:31:19.890" LastActivityDate="2019-05-18T12:31:19.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8881" PostTypeId="1" CreationDate="2015-03-26T19:26:41.063" Score="2" ViewCount="1002" Body="&lt;p&gt;I am using Craft only for the blog section of my HTML site. I have integrated my existing breadcrumbs to the blog, but there is a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I am on the home page of the blog, the word &quot;Blog&quot; in the breadcrumb is linked, and I would rather it &lt;strong&gt;not&lt;/strong&gt; be linked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the word &quot;Blog&quot; in the breadcrumb to be a link only after going to an article on the blog. Please see attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KZuDG.png&quot; alt=&quot;Screen shot comparing the Home page of the blog and an Article page&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I am using right now is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/index.html&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% for crumb in entry.getAncestors() %}&#xA;                &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title() }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am new to Craft - thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="3460" LastActivityDate="2015-03-27T12:29:23.727" Title="Question about breadcrumb links" Tags="&lt;navigation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8882" PostTypeId="2" ParentId="2041" CreationDate="2015-03-26T19:30:15.550" Score="3" Body="&lt;p&gt;I'm documenting this here in case it helps someone else. My white screen during installation was caused by a missing comma between array items in my general.php and db.php config files. Once I added it, the install page loaded correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cOIdf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2015-03-26T20:05:54.253" LastActivityDate="2015-03-26T20:05:54.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8883" PostTypeId="1" AcceptedAnswerId="8891" CreationDate="2015-03-26T20:07:26.937" Score="1" ViewCount="354" Body="&lt;p&gt;I ran into a problem when saving a new record.  I have created a test below.  When saving a record using a db table, the record is saved to the db and the primary key id is updated in the record object.  Works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if the record is saved to a db view (instead of a table), the record is saved to the db but the primary key id is not updated in the record object.  Not working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a third party table that I am using in a plugin that I am developing (in this example, I am calling this third party table craft_test).  I can't changed the name of the table but have created a view name with &quot;craft_&quot; in order to use all of crafts features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my example, I have a custom primary key (Member_ID) that I am using.  The issue still exists if I use the the default primary key of id (by changing the Member_ID column to id in the db, removing the primaryKey() method in the Record declaration, removing Member_ID from defineAttributes in the Record, and rennaming  Member_ID to id in the model defineAttributes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea why the view is not working?  Is there a bug in the craft code?  Or is there a setting that I need to modify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accd_TestModel.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class Accd_TestModel extends BaseModel&#xA;{&#xA;&#xA;public function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'Member_ID'    =&amp;gt; array(AttributeType::Number),&#xA;        'FirstName' =&amp;gt; array(AttributeType::String, 'maxLength' =&amp;gt; 40, 'required' =&amp;gt; true),&#xA;    );&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Accd_testRecord.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Accd_TestRecord extends BaseRecord&#xA;{&#xA;/**&#xA; * Gets the database table name&#xA; *&#xA; * @return string&#xA; */&#xA;public function getTableName()&#xA;{&#xA;   // REMOVE COMMENT BELOW USE VIEW INSTEAD OF TABLE&#xA;   // return 'test_view'; &#xA;   return 'test';   &#xA;}&#xA;&#xA;public function primaryKey()&#xA;{&#xA;   return 'Member_ID';&#xA;}&#xA;&#xA;/**&#xA; * Define columns for our database table&#xA; *&#xA; * @return array&#xA; */&#xA;public function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'Member_ID'    =&amp;gt; array(AttributeType::Number, 'column' =&amp;gt; ColumnType::PK),&#xA;        'FirstName' =&amp;gt; array(AttributeType::String, 'maxLength' =&amp;gt; 40, 'required' =&amp;gt; true),&#xA;    );&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $test_model = new Accd_TestModel();&#xA;    $test_model-&amp;gt;setAttribute('FirstName', 'Bill');&#xA;&#xA;    $test_record = new Accd_TestRecord();&#xA;    $test_record-&amp;gt;setAttributes($test_model-&amp;gt;getAttributes());&#xA;    if ($test_record-&amp;gt;save())&#xA;    {&#xA;        // update Member_ID on model (for new record)&#xA;        $test_model-&amp;gt;setAttribute('Member_ID', $test_record-&amp;gt;Member_ID);&#xA;&#xA;&#xA;        echo '&amp;lt;br&amp;gt;Model FirstName: '.$test_model-&amp;gt;getAttribute('FirstName');&#xA;        echo '&amp;lt;br&amp;gt;Model Member_ID: '.$test_model-&amp;gt;getAttribute('Member_ID');&#xA;        echo '&amp;lt;br&amp;gt;Record FirstName: '.$test_record-&amp;gt;getAttribute('FirstName');&#xA;        echo '&amp;lt;br&amp;gt;Record Member_ID: '.$test_record-&amp;gt;getAttribute('Member_ID');&#xA;&#xA;    }&#xA;    else&#xA;    {&#xA;        echo 'failure';&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Database: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE IF NOT EXISTS `craft_test` (&#xA;`Member_ID` int(11) unsigned NOT NULL AUTO_INCREMENT,&#xA;`FirstName` varchar(40) NOT NULL DEFAULT '',&#xA;`dateCreated` datetime NOT NULL,&#xA;`dateUpdated` datetime NOT NULL,&#xA;`uid` char(36) NOT NULL DEFAULT '0',&#xA;PRIMARY KEY (`Member_ID`)&#xA; ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Database View:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  CREATE VIEW craft_test_view AS SELECT * FROM craft_test&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output to screen when using view:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Model FirstName: Bill&#xA;Model Member_ID: &#xA;Record FirstName: Bill&#xA;Record Member_ID: &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output to screen when using table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Model FirstName: Bill&#xA;Model Member_ID: 7&#xA;Record FirstName: Bill&#xA;Record Member_ID: 7 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3372" LastActivityDate="2015-03-26T22:15:58.533" Title="When using Active Record with a View (instead of Table) the primary key is not set in the record after save" Tags="&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8884" PostTypeId="1" AcceptedAnswerId="8895" CreationDate="2015-03-26T20:13:21.837" Score="4" ViewCount="2354" Body="&lt;p&gt;I have your standard contact form. (Name, email etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the user clicks &quot;save&quot; I want to capture what was entered via a plugin &amp;amp; have a CP page to show the people who have filled out the form. I'll get there eventually, but for now I am stuck actually inserting the record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to insert a record, but it's completely empty. So I know I'm getting close, just not passing off the right information to the right spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Model:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAttributes()&#xA;{&#xA;    return[&#xA;        'firstName' =&amp;gt; [&#xA;          'type' =&amp;gt; AttributeType::String,&#xA;          'required' =&amp;gt; TRUE&#xA;        ]&#xA;     ....&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveContact() {&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $model = new Model();&#xA;&#xA;    $model-&amp;gt;firstName = craft()-&amp;gt;request-&amp;gt;getPost('firstName');&#xA;    ....&#xA;&#xA;    if ($model-&amp;gt;validate())&#xA;    {&#xA;        craft-&amp;gt;service-&amp;gt;saveContact($model);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Service:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveContact(Model, $contact) {&#xA;    error_log(print_r($contact, true));&#xA;&#xA;   // I know the data is showing, I can see it in the log&#xA;   // [_attributes:Craft\BaseModel:private] =&amp;gt; Array(&#xA;   //     [firstName] =&amp;gt; Bob   &#xA;   // )&#xA;&#xA;   // Here is where I am hung up. I don't know what to do next.&#xA;   // $record = new Record();&#xA;   // $record-&amp;gt;save($contact); This creates an empty record in my db&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I feel really silly asking for help on what seems like such an elementary task. I'm close - just need a little shove in the right direction I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you to Mats Mikkel Rummelhoff for your suggestion. It pointed me in the right direction. It seems what I am encountering now has been found in the past? Now it seems I am only saving one field? &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2788/plugin-only-saving-one-column-in-database&quot;&gt;Using this post&lt;/a&gt; I was able to &quot;manually&quot; collect all data and save to my DB. I'm not sure why though - all of the data seemed to be available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;$attributes = array(&#xA;    'firstName' =&amp;gt; $model-&amp;gt;getAttribute( 'firstName' )&#xA;    ....&#xA;);    &#xA;&#xA;foreach($attributes as $k =&amp;gt; $v) {&#xA;    $record-&amp;gt;setAttribute($k,$v);&#xA;}&#xA;&#xA;if ( $record-&amp;gt;save() )&#xA;{&#xA;    error_log('SUCCESS');&#xA;}&#xA;else&#xA;{&#xA;    ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for everyone's contribution(s). I'm going to keep updating this in the event that someone else comes across this same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going along with @Stuart Whitehead comments, right here is proof: &#xA;&quot;AttributeType::String does not apply any validation rules.&quot; Which is why that field was not getting populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is what I was setting as my &lt;code&gt;firstName&lt;/code&gt;, &lt;code&gt;lastName&lt;/code&gt; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also found this article: &lt;a href=&quot;http://straightupcraft.com/articles/the-definitive-guide-to-validation-in-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Definitive Guide to Validation in Craft&lt;/a&gt; Which, is making more and more sense each time I go though it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tricky part (for me) is that there isn't a direct corolation between craft and Yii. Meaning that Yii doesn't have a &lt;code&gt;defineAttributes()&lt;/code&gt; method where the rules are defined. Craft uses this method, and translates it (for lack of better words) into the Yii equivalent. Pretty cool, just increases the learning curve a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Light bulbs are coming on!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably pretty elementry, but I have also discovered that the attribute type that you define in your model, must match the same attribute type in your record. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Record&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAttributes() {&#xA;    'firstName' =&amp;gt; AttributeType::Name,&#xA;    'lastName' =&amp;gt; AttributeType::Name,&#xA;    ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAttributes() {&#xA;    return [&#xA;        'firstName' =&amp;gt; [&#xA;             'type' =&amp;gt; AttributeType::Name,&#xA;             'required' =&amp;gt; TRUE&#xA;         ],&#xA;         'lastName' =&amp;gt; [&#xA;             'type' =&amp;gt; AttributeType::Name,&#xA;             'required' =&amp;gt; TRUE&#xA;         ],&#xA;         ....&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now with things starting to get in the correct way of doing things, &lt;em&gt;gasp&lt;/em&gt; stuff is working. Now using @Mats Mikkel Rummelhoff's comment (having all fields validate now) I am able to use: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record-&amp;gt;setAttributes( $model-&amp;gt;getAttributes() );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-03-27T16:33:04.780" Title="Save contact form data to database" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8885" PostTypeId="2" ParentId="8881" CreationDate="2015-03-26T20:14:07.950" Score="2" Body="&lt;p&gt;A conditional that keys off the presence of the second segment to determine what to show for the &quot;Blog&quot; link/copy will work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seg2 = &quot;&quot; %}&#xA;{% set seg2 = craft.request.getSegment(2) %}&#xA;&#xA;&amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        {% if seg2 == &quot;&quot; %}&#xA;            Blog&#xA;        {% else %}&#xA;            &amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% for crumb in entry.getAncestors() %}&#xA;        &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title() }}&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2015-03-26T20:14:07.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8886" PostTypeId="1" AcceptedAnswerId="8888" CreationDate="2015-03-26T20:45:49.763" Score="5" ViewCount="707" Body="&lt;p&gt;I have PluginA that needs to listen for something that PluginB does. PluginB needs to include a Model in the event data so that PluginA (and any other subscriber) can pick that up and do whatever it needs to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible right now?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-03-26T21:04:26.177" Title="Can a plugin fire a custom event?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8887" PostTypeId="2" ParentId="8884" CreationDate="2015-03-26T20:50:42.537" Score="3" Body="&lt;p&gt;I think your problem is that the record is not being populated – the &lt;code&gt;save()&lt;/code&gt; method does take an array of attributes, but that would be the &lt;em&gt;second&lt;/em&gt; parameter, as per the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CActiveRecord#save-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;CActiveRecord docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = new MyPluginRecord();&#xA;$record-&amp;gt;setAttributes( $contact-&amp;gt;getAttributes() );&#xA;$record-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The BaseRecord's &lt;code&gt;setAttributes&lt;/code&gt; method &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2788/plugin-only-saving-one-column-in-database&quot;&gt;seems a bit unreliable&lt;/a&gt;. If only some values (or none) are saved, you can try multiple calls to &lt;code&gt;$record-&amp;gt;setAttribut()&lt;/code&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$attributes = $contact-&amp;gt;getAttributes();&#xA;foreach ( $attributes as $key =&amp;gt; $value ) {&#xA;   $record-&amp;gt;setAttribute( $key, $value );&#xA;}&#xA;$record-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't had the time to test this, but if you're having trouble saving all attributes using &lt;code&gt;$record-&amp;gt;setAttributes( $model-&amp;gt;getAttributes() );&lt;/code&gt; you could also try flattening the values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record-&amp;gt;setAttributes( $model-&amp;gt;getAttributes( null, true ) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-03-27T08:37:10.710" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8888" PostTypeId="2" ParentId="8886" CreationDate="2015-03-26T21:04:26.177" Score="5" Body="&lt;p&gt;Yes. It's not documented, but by instantiating the &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/events/Event&quot; rel=&quot;nofollow noreferrer&quot;&gt;Event class&lt;/a&gt; (which is just a thin wrapper for &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CEvent&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii's CEvent&lt;/a&gt;) you can create and raise your own events. Obviously you could extend the Event class as well, if need be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Aaron Berkowitz' excellent answer to a similar question for details -&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/a/6941/1098&quot;&gt;https://craftcms.stackexchange.com/a/6941/1098&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, check out the following resource for more on events in Yii: &lt;a href=&quot;http://www.yiiframework.com/wiki/327/events-explained&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.yiiframework.com/wiki/327/events-explained&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-03-26T21:04:26.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8889" PostTypeId="1" CreationDate="2015-03-26T21:38:40.923" Score="2" ViewCount="384" Body="&lt;p&gt;I have a need to set a property on a plugin Model that is an array of one or more valid values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that I can use AttributeType::Enum and record and define a set of values but if I'm not mistaken, that enables me to validate a single value against that set of values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return [&#xA;            'mySetting' =&amp;gt; [ AttributeType::Enum, 'values' =&amp;gt; 'validOption1,validOption2,validOption3' ]&#xA;        ];&#xA;     }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do is enable mySetting to be an array that would be valid when set as &lt;strong&gt;an array containing any combination of the defined options&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyModel::populateModel(['mySetting' =&amp;gt; [&#xA;    'validOption1'&#xA;]]); // is valid&#xA;&#xA;MyModel::populateModel(['mySetting' =&amp;gt; [&#xA;    'validOption1', &#xA;    'validOption3'&#xA;]]); // is valid&#xA;&#xA;MyModel::populateModel(['mySetting' =&amp;gt; [&#xA;    'invalidOption', &#xA;    'validOption3'&#xA;]]); // is *not* valid&#xA;&#xA;MyModel::populateModel(['mySetting' =&amp;gt; []); // is *not* valid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Etc.&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="1098" LastEditDate="2015-03-27T07:37:22.950" LastActivityDate="2015-10-23T06:44:45.613" Title="How do I validate an array model attribute against a set of possible values?" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8890" PostTypeId="2" ParentId="8889" CreationDate="2015-03-26T22:05:23.887" Score="4" Body="&lt;p&gt;Found an answer in the form of a customer validator class on the model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators#newsletter&quot; rel=&quot;nofollow&quot;&gt;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators#newsletter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function validateMySetting($attribute)&#xA;    {&#xA;        $values = (is_array($this-&amp;gt;$attribute)) ? $this-&amp;gt;$attribute : [ $this-&amp;gt;$attribute ];&#xA;&#xA;        $validValues = ['validOption1', 'validOption2', 'validOption3'];&#xA;&#xA;        foreach($values as $value)&#xA;        {&#xA;            if ( ! in_array($value, $validValues))&#xA;            {&#xA;                $this-&amp;gt;addError($attribute, &quot;{$value} is not a valid setting&quot;);&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then to call it, override the parent class' &lt;code&gt;rules&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules ()&#xA;{&#xA;    return array_merge(parent::rules(), [ &#xA;        'someAttributeName', 'validateMySetting'&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-10-23T06:44:45.613" LastActivityDate="2015-10-23T06:44:45.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8891" PostTypeId="2" ParentId="8883" CreationDate="2015-03-26T22:15:58.533" Score="0" Body="&lt;p&gt;This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($test_record-&amp;gt;save()) &#xA;{&#xA;    // update Member_ID on model (for new record)&#xA;    $test_model-&amp;gt;setAttribute('Member_ID', craft()-&amp;gt;db-&amp;gt;getLastInsertId());&#xA;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-26T22:15:58.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8893" PostTypeId="2" ParentId="8873" CreationDate="2015-03-27T07:52:36.607" Score="2" Body="&lt;p&gt;Thank you very much for your support. &lt;strong&gt;The code shown in the question is correct.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have replaced the relationship field - &lt;strong&gt;and now it works perfect&lt;/strong&gt;. The problem could have been that I defined the field first as a number field an then changed to a relationship field - but this is just speculation.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-03-27T07:52:36.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8894" PostTypeId="2" ParentId="8881" CreationDate="2015-03-27T09:45:12.697" Score="2" Body="&lt;p&gt;First, if your Blog section type is a Channel and not a Structure, then &lt;code&gt;{% for crumb in entry.getAncestors() %}&lt;/code&gt; won't return anything. Your entry needs to be in a structure have any ancestors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a rundown of Craft's section types:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/sections-and-entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really going to depend on how you have your templates and sections are setup, but here's how a basic setup for a Blog channel might work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a &lt;strong&gt;Blog&lt;/strong&gt; section that's a &lt;strong&gt;Channel&lt;/strong&gt; section type. In your &lt;code&gt;craft/templates&lt;/code&gt; folder, you have the following folders:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;blog/&#xA;blog/index.html&#xA;blog/_entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the settings for the Blog section, you have...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry URL Format:&lt;/strong&gt; &lt;code&gt;blog/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry Template:&lt;/strong&gt; &lt;code&gt;blog/_entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on an entry page like &lt;code&gt;example.com/blog/what-makes-a-good-logo-design&lt;/code&gt;, Craft will route to the &lt;code&gt;blog/_entry.html&lt;/code&gt; template. In that file your breadcrumb could be just this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/blog&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you go to &lt;code&gt;example.com/blog&lt;/code&gt;, Craft will route to the &lt;code&gt;blog/index.html&lt;/code&gt; template. In that file, you can have a separate breadcrumb like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;Blog&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-03-27T12:29:23.727" LastActivityDate="2015-03-27T12:29:23.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8895" PostTypeId="2" ParentId="8884" CreationDate="2015-03-27T10:35:05.517" Score="7" Body="&lt;p&gt;Stripping this back, your basic problem is saving data to the database from an unreliable source. This is a fundamentally insecure operation—we've got no idea if this user is genuine or attempting something malicious. That's why the underlying Yii framework is trying to protect your install of Craft, and which is the reason you're seeing this ‘buggy’ behaviour with &lt;code&gt;setAttributes()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Yii framework implements a ‘safe’ validator. A key point made in &lt;a href=&quot;http://www.yiiframework.com/wiki/161/understanding-safe-validation-rules/&quot;&gt;this helpful article&lt;/a&gt; is this: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Massive Assignment will &lt;strong&gt;only&lt;/strong&gt; be made for fields which have passed&#xA;  some explicit validation rule.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means that any attributes you define without an explicit validation rule will be considered &lt;em&gt;unsafe&lt;/em&gt;. This will be the reason that only your email field was saving—it has an explicit validation rule (i.e. an email pattern).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you resolve this, then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set attributes explicitly&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, you could explicitly set each attribute like you have been doing. Since this is not a massive assignment, the data is treated as safe and will save OK. Both &lt;code&gt;$record-&amp;gt;setAttribute()&lt;/code&gt; and &lt;code&gt;$record-&amp;gt;attribute()&lt;/code&gt; will work for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Define attributes with explicit validation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution is to define explicit validation rules, and will allow massive assignment on these attributes, but explicit rules only really apply for some data types. What if you want a simple string?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Make existing attributes safe&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution could be to add the &lt;code&gt;safe&lt;/code&gt; rule to your attribute definition. If you follow the definition of attributes down the rabbit hole, you'll find that attribute configs are normalised by &lt;code&gt;ModelHelper::normalizeAttributeConfig()&lt;/code&gt; (and subsequently &lt;code&gt;ModelHelper::getRules()&lt;/code&gt;) which does not cater for this. Now where does that leave us?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible to override (and extend) the inherited &lt;code&gt;rules()&lt;/code&gt; method. Assuming you wanted to make all attributes safe and valid for massive assignment, I reckon something like this would work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;{&#xA;    // Are there any existing rules?&#xA;    $rules = parent::rules();&#xA;&#xA;    // Make all attributes safe&#xA;    $rules[] = array(implode(',', array_keys($this-&amp;gt;getAttributes())), 'safe');&#xA;&#xA;    // Send it on outta here&#xA;    return $rules;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should then be able to massively set attributes with &lt;code&gt;$record-&amp;gt;setAttributes()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="148" LastActivityDate="2015-03-27T10:35:05.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8896" PostTypeId="1" AcceptedAnswerId="8897" CreationDate="2015-03-27T10:54:47.337" Score="1" ViewCount="1351" Body="&lt;p&gt;I have an entry with a matrix field called &lt;code&gt;quantification&lt;/code&gt; containing plain text and asset field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im looping through the matrix field and for each asset quantification I have a new gallery. Each div id needs to be unique, for example &lt;code&gt;&amp;lt;div id=&quot;slider1&quot;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;div id=&quot;slider2&quot;&amp;gt;&lt;/code&gt;, etc. Within the for loop I think I can use &lt;code&gt;&amp;lt;div id=&quot;slider{{ loop.index }}&quot;&amp;gt;&lt;/code&gt; for that, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here comes the tricky part, at least for me. I also have some JS code (look here: &lt;a href=&quot;http://help.dimsemenov.com/kb/royalslider-jquery-plugin-faq/how-to-add-multiple-sliders-to-one-page-and-style-them-differently&quot; rel=&quot;nofollow&quot;&gt;http://help.dimsemenov.com/kb/royalslider-jquery-plugin-faq/how-to-add-multiple-sliders-to-one-page-and-style-them-differently&lt;/a&gt;) which initiates each gallery. How do I dynamically add &lt;code&gt;slider1&lt;/code&gt;, &lt;code&gt;slider2&lt;/code&gt;, etc since this part of the code lives outside of the for loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions with respect to the stylesheet, as I need to add them too there. At this point I'm going for hardcoded.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="45" LastEditDate="2015-03-27T16:45:35.980" LastActivityDate="2015-03-27T16:45:35.980" Title="Creating JS slideshow with Twig &quot;for&quot; loop" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8897" PostTypeId="2" ParentId="8896" CreationDate="2015-03-27T11:55:07.223" Score="3" Body="&lt;p&gt;You didn't mention you want to style your sliders differently. I don't think you have to address them separately form your JS and CSS, if they should all look just the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;HTML:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for slider in entry.myMatrixField.type('slider') %}&#xA;    &amp;lt;div class=&quot;royalSlider&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;JS:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.royalSlider').royalSlider({&#xA;  controlNavigation: 'bullets'&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;CSS:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.royalSlider {&#xA;  width: 300px;&#xA;  height: 200px;&#xA;  background: red;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-27T11:55:07.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8898" PostTypeId="2" ParentId="1638" CreationDate="2015-03-27T13:30:52.947" Score="1" Body="&lt;p&gt;I would use the &quot;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;Feed Me&lt;/a&gt;&quot; plugin which allows to import entries including tags from feeds (XML, RSS, Atom). So you only have to create an XML feed with all the information you want to transfer (which is in EE quite easy).&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-03-27T13:30:52.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8899" PostTypeId="1" CreationDate="2015-03-27T14:24:57.133" Score="1" ViewCount="340" Body="&lt;p&gt;I defined an &lt;code&gt;estateRecord&lt;/code&gt; in my Plugin. Every estate has a set of images that i want to import from a zip file directly via &lt;code&gt;assetsService::insertFileByLocalPath()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;estateRecord&lt;/code&gt; I defined a relation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'assets' =&amp;gt; array(static::HAS_MANY, 'AssetFileRecord', 'id'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i'm stuck to define a 'asset'-field in the estateModel to access the image-sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just find a solution to define the Attribute for one assetId but have no idea how to define the Attribute for the related set of assetIds.&#xA;How can i do this?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2015-03-27T16:10:44.030" LastActivityDate="2015-05-31T23:59:29.510" Title="How to create a relation to multiple assets in my Plugin Model/Record?" Tags="&lt;assets&gt;&lt;plugins&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8900" PostTypeId="1" CreationDate="2015-03-27T19:46:07.227" Score="1" ViewCount="154" Body="&lt;p&gt;I have defined string and mixed attributes for my Record/Model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'titel' =&amp;gt; array(AttributeType::String),&#xA;'lage' =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If i try to save a record, the data will not be saved, if required=true is not defined! That happens with both, string and mixed attribute types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But i want to save the records also with empty values.&#xA;Whats wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;// UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8246/the-active-record&quot;&gt;The Active Record&lt;/a&gt; and added this to my model&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules(){&#xA;    return array(&#xA;        array('title', 'default', 'setOnEmpty' =&amp;gt; true, 'value' =&amp;gt; null),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesnt change anything.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-03-28T10:50:18.327" Title="Record - Mixed/String values will not be saved if attribute not required=true" Tags="&lt;plugins&gt;&lt;records&gt;&lt;attribute&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8902" PostTypeId="2" ParentId="8535" CreationDate="2015-03-28T16:58:37.523" Score="2" Body="&lt;p&gt;I'd put money on your &lt;code&gt;.htaccess&lt;/code&gt; file. Could be a permissions issue or maybe you misspelled &lt;code&gt;.htaccess&lt;/code&gt; when renaming it? (The Craft distro comes without the period.) That's certainly happened to me—it's easy to do that (&lt;code&gt;.htacccess&lt;/code&gt; anyone?) and then overlook everything else...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using a recent version of MAMP (and not MAMP Pro), it also gives you a choice of using nginx as the web server—which will kindly ignore .htaccess files. It's possible that choice got checked inadvertently when setting up the document root?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other longshot is &lt;code&gt;mod_rewrite&lt;/code&gt; got disabled somehow, though since it's a common module, it's less likely.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-03-28T16:58:37.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8903" PostTypeId="2" ParentId="8535" CreationDate="2015-03-28T18:18:20.090" Score="2" Body="&lt;p&gt;Solved! I found the answer here: &lt;a href=&quot;https://stackoverflow.com/questions/7670561/how-to-get-htaccess-to-work-on-mamp&quot;&gt;https://stackoverflow.com/questions/7670561/how-to-get-htaccess-to-work-on-mamp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem was an Apache config setting. The solution was this: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Went to httpd.conf on /Applications/MAMP/conf/apache&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In httpd.conf, found:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&#xA;    Options Indexes FollowSymLinks&#xA;    AllowOverride None&#xA;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Replaced None with All.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Restarted MAMP servers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This solved the problem in my local environment. Don't know what will happen when I put my site in a shared server. Also don't really know what that configuration is at all, all I know is it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the configuration line that has to do with .htaccess was NOT the problem. That one was already set to AllowOverride All as it's supposed to.&lt;/p&gt;&#xA;" OwnerUserId="3381" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-03-28T18:18:20.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8904" PostTypeId="1" AcceptedAnswerId="8905" CreationDate="2015-03-28T18:26:12.313" Score="6" ViewCount="1508" Body="&lt;p&gt;I have a user registration form on the front-end of a site that is working well as a standard form, but when I try to use ajax submission, I'm getting an HTML response rather than JSON. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the javascript I'm using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#register-form').submit(function(ev) {&#xA;    ev.preventDefault();&#xA;&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.post('/', data, function(response) {&#xA;&#xA;        console.log(response);&#xA;&#xA;        if (response.success) {&#xA;            alert(&quot;success&quot;)&#xA;        } else {&#xA;            alert(response.error);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is my form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; id=&quot;register-form&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;Create An Account&amp;lt;/h3&amp;gt;&#xA;&amp;lt;p&amp;gt;By creating an account, you will be able to save your application progress. This is an optional step.&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;email&quot; class=&quot;col-sm-3 control-label&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;email&quot; name=&quot;email&quot; {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group col-6&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; class=&quot;form-control&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group col-6&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;password2&quot;&amp;gt;Confirm Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;password2&quot; class=&quot;form-control&quot; type=&quot;password&quot; name=&quot;password2&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;actions&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;&amp;lt;input type=&quot;submit&quot; id=&quot;form-submit&quot; value=&quot;Register&quot; class=&quot;btn btn-grey&quot;/&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;span class=&quot;center&quot;&amp;gt;Already have an account? &amp;lt;a href=&quot;#&quot; id=&quot;sign-in-form-btn&quot;&amp;gt;Sign In&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response var is returning the entire html page rather than JSON data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to trigger a JSON response for the registration form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, I'm able to use similar code for a front-end login form and it's working well.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2015-06-02T22:34:26.867" Title="Ajax front-end user registration form - not returning JSON" Tags="&lt;form&gt;&lt;ajax&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8905" PostTypeId="2" ParentId="8904" CreationDate="2015-03-28T20:38:56.873" Score="5" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://buildwithcraft.com/updates/2.4&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4 is now available&lt;/a&gt;, and the &lt;a href=&quot;https://buildwithcraft.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;users/saveUser&lt;/a&gt; action will now return a JSON response for AJAX requests.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The original answer is still valid for &amp;lt;2.4 builds:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, there's no way to trigger a JSON response for the &lt;code&gt;users/saveUser&lt;/code&gt; action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow&quot;&gt;UsersController&lt;/a&gt; actions (such as &lt;code&gt;users/login&lt;/code&gt; do return JSON for AJAX requests, so it might be an idea to &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;submit this as a feature request&lt;/a&gt; – as a consistency measure, if nothing else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, here's a couple of ideas for workarounds:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Write a plugin with a controller that wraps the &lt;code&gt;UsersController-&amp;gt;actionSaveUser()&lt;/code&gt; method somehow, or implements its own action (you could basically just &lt;a href=&quot;https://raw.githubusercontent.com/pixelandtonic/Craft-Release/master/app/controllers/UsersController.php&quot; rel=&quot;nofollow&quot;&gt;copy paste the whole &lt;code&gt;actionSaveUser()&lt;/code&gt; from the core &lt;code&gt;UsersController&lt;/code&gt;&lt;/a&gt;, changing it to return some JSON at the end).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can set the &lt;code&gt;redirect&lt;/code&gt; parameter (using a hidden input field in your form) to point to a template where you build the JSON yourself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; id=&quot;register-form&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;     &amp;lt;!-- Your form code --&amp;gt;&#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ url( 'path/to/your/template/or/a/route' }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template for the redirect (notice the JSON header):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;{&#xA;    &quot;success&quot; : {{ account is defined and account.id ? true : false }}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-02T22:34:26.867" LastActivityDate="2015-06-02T22:34:26.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8907" PostTypeId="1" AcceptedAnswerId="8908" CreationDate="2015-03-29T11:00:25.480" Score="1" ViewCount="174" Body="&lt;p&gt;We're developing a client site in CraftCMS that has 2 different frontend user groups. I know it's possible to set up custom fields for users but I'd like to set up different additional profile fields for each Group i.e. Group A has one set of custom fields and Group B has another. Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="3452" LastActivityDate="2015-03-29T15:24:44.540" Title="Is it possible to have different fields associated with users in different groups?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8908" PostTypeId="2" ParentId="8907" CreationDate="2015-03-29T12:43:02.233" Score="3" Body="&lt;p&gt;Currently, this is not possible in Craft via the the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are managing user profiles from the front-end, you can manage different fields for different user groups manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few considerations: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can't set a field to required in Craft if it will be optional for one of the user groups on the front-end and not the other.  You may have to manage required fields in another way.&lt;/li&gt;&#xA;&lt;li&gt;An admin with direct access to Users in the CP will have no signal in the UI as to which fields belong to which User Groups.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-03-29T15:24:44.540" LastActivityDate="2015-03-29T15:24:44.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8909" PostTypeId="1" AcceptedAnswerId="8910" CreationDate="2015-03-29T13:32:16.560" Score="1" ViewCount="210" Body="&lt;p&gt;I am trying allow users to upload keynote and powerpoint files. Powerpoint works fine. Keynote fails. I do not have any asset type restrictions in place. Why am I unable to upload asset type .key?&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="45" LastEditDate="2015-03-29T19:45:53.080" LastActivityDate="2015-03-29T19:45:53.080" Title="File upload error. Cannot upload .key (keynote) files" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8910" PostTypeId="2" ParentId="8909" CreationDate="2015-03-29T15:01:05.897" Score="3" Body="&lt;p&gt;It looks like .key files are not included in the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/general.php#L48&quot; rel=&quot;nofollow&quot;&gt;default allowed file extensions&lt;/a&gt;. But you can manually add it with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#extraAllowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;extraAllowedFileExtensions&lt;/code&gt;&lt;/a&gt; setting in your config/general.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'extraAllowedFileExtensions' =&amp;gt; 'key'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2015-03-29T19:41:31.800" LastActivityDate="2015-03-29T19:41:31.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8911" PostTypeId="1" AcceptedAnswerId="8912" CreationDate="2015-03-29T17:45:52.113" Score="2" ViewCount="1223" Body="&lt;p&gt;I have 2 sections: Gift Cards and Merchants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Gift Cards, I have a entries field that is limited to the Merchants section and limited to 1 selection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Merchants, I have a field merchantId that is a plaintextfield.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin, I would like to return all gift cards that have a merchantId of 123.  I've tried a few different ways, but all ways have either given no results or I get a 'missing index Merchant' error in the FieldServices class. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone here has done something similar and can point me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="3467" LastActivityDate="2015-03-29T21:38:39.387" Title="Get related entries in plugin via Entries field type" Tags="&lt;entries&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8912" PostTypeId="2" ParentId="8911" CreationDate="2015-03-29T21:38:39.387" Score="8" Body="&lt;p&gt;First, you should get all the Merchant Entries with the merchantId of 123&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section('merchants');&#xA;$criteria-&amp;gt;merchantId = '123';&#xA;&#xA;$merchants = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, find all Gift Card entries that are related to the found merchants.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'giftCards';&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $merchants,&#xA;    'field' =&amp;gt; 'YOUR-ENTRIES-FIELD'&#xA;);&#xA;&#xA;$gift_cards = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-03-29T21:38:39.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8914" PostTypeId="1" CreationDate="2015-03-30T08:05:48.180" Score="4" ViewCount="1154" Body="&lt;p&gt;For the Sprout Reports plugin I need to write a custom SQL query to get some Craft data. (We use this plugin so our client can easily generate CSV exports at any time from the CP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As there are multiple relations with both Entries and Users, the query becomes quite tricky.. Any help in the right direction would be awesome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;This is the case:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have subscriptions, which have subscription data and a relationship to a course (Entry) and a school (User). The course has a relationship to a sportsclub (User). We need a &lt;strong&gt;single&lt;/strong&gt; SQL query that pulls all this data from the Craft database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;We have the following tables:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_sections&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|name&#xA;--|-------------&#xA; 1|subscriptions&#xA; 2|courses&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; id|sectionId&#xA;---|---------&#xA; 50|        1       (subscriptions)&#xA; 51|        1       (subscriptions)&#xA; 52|        1       (subscriptions)&#xA;100|        2       (courses)&#xA;102|        2       (courses)&#xA;104|        2       (courses)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_content&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|elementId|name      |gender|city      |course_name     |school_name|club_name&#xA;--|---------|----------|------|----------|----------------|-----------|-----------&#xA; 1|       50|John Doe  |Male  |New York  |                |           |&#xA; 2|       51|Lisa Smith|Female|New Jersey|                |           |&#xA; 3|       52|Brad Bell |Male  |Washington|                |           |   &#xA; 4|      100|          |      |          |Basketballcourse|           |&#xA; 5|      101|          |      |          |                |School 1   |        &#xA; 6|      102|          |      |          |Volleybalcourse |           |&#xA; 7|      103|          |      |          |                |School 2   |        &#xA; 8|      104|          |      |          |Swimmingcourse  |           |&#xA; 9|      105|          |      |          |                |School 3   |&#xA;10|      150|          |      |          |                |           |Sportsclub 1&#xA;11|      151|          |      |          |                |           |Sportsclub 2&#xA;12|      152|          |      |          |                |           |Sportsclub 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;craft_content elementId = craft_entries id and craft_elements id&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_relations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|sourceId|targetId&#xA;--|--------|--------&#xA; 1|      50|     100       (subscription -&amp;gt; course)&#xA; 2|      50|     101       (subscription -&amp;gt; school)&#xA; 3|      51|     102       (subscription -&amp;gt; course)&#xA; 4|      51|     103       (subscription -&amp;gt; school)&#xA; 5|      52|     104       (subscription -&amp;gt; course)&#xA; 6|      52|     105       (subscription -&amp;gt; school)&#xA; 7|     100|     150       (course -&amp;gt; sportsclub)&#xA; 8|     102|     151       (course -&amp;gt; sportsclub)&#xA; 9|     104|     152       (course -&amp;gt; sportsclub)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;sourceId and targetId relate to the craft_elements table, where you can get the type of the element. The Ids also relate to the elemendId in the craft_content table.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_elements&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id |type&#xA;---|-----&#xA; 50|Entry       (subscription)&#xA; 51|Entry       (subscription)&#xA; 52|Entry       (subscription)&#xA;100|Entry       (course)&#xA;101|User        (school)&#xA;102|Entry       (course)&#xA;103|User        (school)&#xA;104|Entry       (course)&#xA;105|User        (school)&#xA;150|User        (sportsclub)&#xA;151|User        (sportsclub)&#xA;152|User        (sportsclub)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_users&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|username&#xA;--|--------&#xA; 1|school_1&#xA; 2|school_2&#xA; 3|school_3&#xA; 4|sportsclub_1&#xA; 5|sportsclub_2&#xA; 6|sportsclub_3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_usergroups&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|name&#xA;--|-----------&#xA; 1|Schools&#xA; 2|Sportsclubs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft_usergroups_users&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|groupId|userId&#xA;--|-------|------&#xA; 1|      1|     1&#xA; 2|      1|     2&#xA; 3|      1|     3&#xA; 4|      2|     4&#xA; 5|      2|     5&#xA; 6|      2|     6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The desired result from the query:&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id|name      |gender|city      |course_name     |school_name|club_name&#xA;--|----------|------|----------|----------------|-----------|------------&#xA; 1|John Doe  |Male  |New York  |Basketballcourse|School 1   |Sportsclub 1&#xA; 2|Lisa Smith|Female|New Jersey|Volleybalcourse |School 2   |Sportsclub 2&#xA; 3|Brad Bell |Male  |Washington|Swimmingcourse  |School 3   |Sportclubs 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2298" LastEditorUserId="344" LastEditDate="2015-05-05T10:30:43.473" LastActivityDate="2015-08-15T00:28:41.743" Title="Complex custom SQL query with multiple relationships (Craft DB)" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8915" PostTypeId="1" AcceptedAnswerId="8916" CreationDate="2015-03-30T09:58:07.440" Score="2" ViewCount="490" Body="&lt;p&gt;I have a scenario where I'm using a Matrix to store and output 'sponsored links' for a page. Each link also has a radio button to select whether to display in a left hand column or a right hand column group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering like this is simple enough:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class='left'&amp;gt;&#xA;&amp;lt;h2&amp;gt;LEFT COLUMN TITLE&amp;lt;/h2&amp;gt;&#xA;{% for sponsor in sponsors.sponsors %}&#xA;    {% if sponsor.grouping == &quot;Left column&quot; %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ sponsor.sponsorUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ sponsor.sponsorLogo.first().getUrl('maxwidth220') }}&quot; alt=&quot;{{ sponsor.sponsorName }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;...&#xA;&amp;lt;div class='right'&amp;gt;&#xA;&amp;lt;h2&amp;gt;RIGHT COLUMN TITLE&amp;lt;/h2&amp;gt;&#xA;{% for sponsor in sponsors.sponsors %}&#xA;    {% if sponsor.grouping == &quot;Right column&quot; %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ sponsor.sponsorUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ sponsor.sponsorLogo.first().getUrl('maxwidth220') }}&quot; alt=&quot;{{ sponsor.sponsorName }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but it will always spit out a wrapping div and section heading, even if there is no content. How do I test to see if there's anything to spit out first?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="1098" LastEditDate="2015-03-30T10:51:38.233" LastActivityDate="2015-03-30T10:51:38.233" Title="Only execute twig block if a Matrix radio has a certain value" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8916" PostTypeId="2" ParentId="8915" CreationDate="2015-03-30T10:28:18.863" Score="4" Body="&lt;p&gt;You can filter Matrix blocks on field values – in your case, the field &quot;grouping&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sponsor in sponsors.sponsors.grouping( 'Left column' ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To conditonally output the whole wrapping div and section heading for the left and right aligned sponsors respectively, you can sort the sponsors into two arrays (left and right) beforehand, and then check the &lt;code&gt;length&lt;/code&gt; property of those arrays before outputting the relevant markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Pull all sponsors from the Matrix field #}&#xA;{% set sponsors = entry.sponsors.type( 'sponsors' ) %}&#xA;&#xA;{# Filter sponsors into two arrays by &quot;grouping&quot; field value #}&#xA;{% set sponsorsLeft = sponsors.grouping( 'Left column' ) %}&#xA;{% set sponsorsRight = sponsors.grouping( 'Right column' ) %}&#xA;&#xA;{# I can haz sponsors in the left column? #}&#xA;{% if sponsorsLeft | length %}&#xA;    &amp;lt;div class='left'&amp;gt;&#xA;    &amp;lt;h2&amp;gt;LEFT COLUMN TITLE&amp;lt;/h2&amp;gt;&#xA;    {% for sponsor in sponsorsLeft %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ sponsor.sponsorUrl }}&quot;&amp;gt;{{ sponsor.sponsorName }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;...&#xA;{# I can haz sponsors in the right column? #}&#xA;{% if sponsorsRight | length %}&#xA;    &amp;lt;div class='right'&amp;gt;&#xA;    &amp;lt;h2&amp;gt;RIGHT COLUMN TITLE&amp;lt;/h2&amp;gt;&#xA;    {% for sponsor in sponsorsRight %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ sponsor.sponsorUrl }}&quot;&amp;gt;{{ sponsor.sponsorName }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-30T10:50:07.313" LastActivityDate="2015-03-30T10:50:07.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8917" PostTypeId="2" ParentId="8915" CreationDate="2015-03-30T10:37:35.327" Score="3" Body="&lt;p&gt;You can filter Matrix blocks by setting a custom field parameter on the block query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am right and in your example code &lt;code&gt;sponsors&lt;/code&gt; is both,&#xA;your entry model and also the handle for your Matrix field, then this should do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if sponsors.sponsors.grouping('Left column')|length %}&#xA;    &amp;lt;div class=&quot;left&quot;&amp;gt;&#xA;        ...&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-30T10:37:35.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8918" PostTypeId="1" CreationDate="2015-03-30T11:26:54.650" Score="1" ViewCount="133" Body="&lt;p&gt;I'm working on a website where members can add entries with the frontend form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After creating the entry I want them to change the &quot;status&quot; with custom field by sending them an email link. The link is send with postmaster after x amount of days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this in a safe way? Using GET (if user is logged in)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;site.com/status/?entry_id=200&amp;amp;status=new_status&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible with just a twig template? &lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-03-30T12:52:37.677" Title="Set custom field true email link" Tags="&lt;entries&gt;&lt;form&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8919" PostTypeId="2" ParentId="8918" CreationDate="2015-03-30T12:46:22.100" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is [updating an entry] possible with just a twig template?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. You'll need to write a plugin.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I [let users update an entry via an URL]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's a few ways to approach this. My recommendation would be to have your plugin expose a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow&quot;&gt;site route&lt;/a&gt; pointing to a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller method&lt;/a&gt;. That controller method would then take care of updating the entry, and possibly redirect the user back to the entry URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you want to send your users links that look like &lt;code&gt;http://example.com/status/1234/live&lt;/code&gt;, here's what the route could look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'status/(?P&amp;lt;entryId&amp;gt;\d+)/(?P&amp;lt;status&amp;gt;[-\w]+)' =&amp;gt; array( 'action' =&amp;gt; 'myPlugin/status/updateStatus' )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above route, all matching URLs will be pointed to a &lt;code&gt;actionUpdateStatus()&lt;/code&gt; action method in a controller named &lt;code&gt;MyPlugin_StatusController&lt;/code&gt;. The controller would then need to handle the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Update the status for the entry matching the $entryId route variable (look at &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements#saving-elements&quot; rel=&quot;nofollow&quot;&gt;Working with Elements&lt;/a&gt; for ways to approach this&lt;/li&gt;&#xA;&lt;li&gt;(Presumably) &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/BaseController#redirect-detail&quot; rel=&quot;nofollow&quot;&gt;redirect the request&lt;/a&gt; back to the entry URI&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I do this in a safe way?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The URLs should probably include some sort of unique key (either as another route variable, or as a query string variable) to verify the request. For example, you could opt to include a &lt;a href=&quot;http://php.net/md5&quot; rel=&quot;nofollow&quot;&gt;hash&lt;/a&gt; of the author's email address; the controller could then decrypt the hash before updating the entry, verifying that the given email address matches the one on file for the entry's author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you should probably verify that the &lt;code&gt;status&lt;/code&gt; route variable matches with a set of allowed statuses, such as &quot;live&quot;, &quot;pending&quot; etc.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-03-30T12:52:37.677" LastActivityDate="2015-03-30T12:52:37.677" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8920" PostTypeId="2" ParentId="2821" CreationDate="2015-03-30T13:10:29.613" Score="3" Body="&lt;p&gt;I don't believe that there is a &lt;em&gt;recommended&lt;/em&gt; way to do this, so I'll attempt to answer this question as best I can. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using an element type, you will be able to use the element index layout for free, with very little setup. That will give you access to native sorting and searching (filtering), along with a bunch of other things such as grouping, statuses, table and thumbnail views, etc. Creating your element type template is as simple as including the following 3 lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;ElementName&quot;|t %}&#xA;{% set elementType = 'PluginName_ElementName' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is not way that I know of to natively allow sorting of a table without using an element type and it doesn't look like &lt;a href=&quot;https://github.com/pixelandtonic/Garnish/tree/master/Source/classes&quot; rel=&quot;nofollow&quot;&gt;Garnish&lt;/a&gt; offers this functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I guess the &lt;em&gt;only&lt;/em&gt; way at present to make this work with JavaScript is to use an external library such as &lt;a href=&quot;http://tablesorter.com/docs/&quot; rel=&quot;nofollow&quot;&gt;tablesorter&lt;/a&gt; or as you mentioned &lt;a href=&quot;http://www.datatables.net/&quot; rel=&quot;nofollow&quot;&gt;DataTables&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-03-30T13:10:29.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8922" PostTypeId="1" CreationDate="2015-03-30T15:35:55.077" Score="2" ViewCount="1110" Body="&lt;p&gt;Is it possible to filter relations entries field by a category in a control panel entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to relate two channels using the entries field but I have 100 source entries so I was hoping to be able to filter the list by category to narrow down what is shown in the target entry. Similar to how EE Playa works which allows me to choose the category in which to pull the related entries from when I initially set up the custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a similar thread:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2118/filtering-searching-for-entries-by-category-in-the-control-panel&quot;&gt;Filtering/searching for entries by category in the control panel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-03-30T17:30:46.273" Title="Filter Entries field by category in the CP?" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;categories&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8923" PostTypeId="1" CreationDate="2015-03-30T16:07:57.420" Score="0" ViewCount="1397" Body="&lt;p&gt;I cant quite wrap my head around the way the way the heroku file system works, so I'd like to use relative paths for my asset File System Paths. Is that even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to use &lt;code&gt;CRAFT_BASE_PATH&lt;/code&gt; in the general settings file to define an environmental variable, but no real luck getting my assets folders to be recognized.&lt;/p&gt;&#xA;" OwnerUserId="3472" LastEditorUserId="250" LastEditDate="2015-03-30T18:08:46.163" LastActivityDate="2015-03-31T23:12:01.177" Title="Using relative paths for assets for heroku deployment" Tags="&lt;assets&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8924" PostTypeId="2" ParentId="8922" CreationDate="2015-03-30T17:18:16.593" Score="1" Body="&lt;p&gt;No, this is currently not possible, but there's a feature request on Craft's feedback site&#xA;that you could vote for: &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7179163--entry-type-setting-for-entries-fields&quot; rel=&quot;nofollow&quot;&gt;&quot;Entry Type&quot; setting for Entries fields&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Lewis Jenkins mentioned there, you could use his plugin &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;Dynamic Fields&lt;/a&gt; as&#xA;a workaround solution in the meantime. Something like this should give you a dropdown field with&#xA;all &quot;myOtherChannel&quot; entries related to a category &quot;myCategory&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('myCategoryGroup').slug('myCategory') %}&#xA;{% set entries = craft.entries.section('myOtherChannel').relatedTo(category).order('title asc') %}&#xA;&#xA;{% for entry in entries %}&#xA;    { &quot;value&quot;: &quot;{{ entry.id }}&quot;, &quot;label&quot;: &quot;{{ entry.title|raw }}&quot; }&#xA;    {% if not loop.last %}, {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-03-30T17:18:16.593" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8925" PostTypeId="2" ParentId="2311" CreationDate="2015-03-30T19:06:40.133" Score="5" Body="&lt;p&gt;I know this is a bit late for your specific question, but &lt;a href=&quot;http://squarebit.co.uk/software/craft/shortlist&quot;&gt;Shortlist for Craft&lt;/a&gt; is designed for exactly this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm the developer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's &lt;a href=&quot;http://squarebit.co.uk/software/expressionengine&quot;&gt;also available for EE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-30T19:06:40.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8926" PostTypeId="1" AcceptedAnswerId="8927" CreationDate="2015-03-30T21:47:41.600" Score="3" ViewCount="481" Body="&lt;p&gt;I have an entries in a section called 'garden', with a matrix field called 'sowing' - this matrix has a block called 'locationDate' and two fields 'sowingDate' and 'sowingLocation'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to loop through and show the last 5 things sown in the garden, so based on other examples and using low blocks, I have this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSown = craft.lowblocks.blocks.fieldId(12).type(&quot;locationDate&quot;).order(&quot;sowingDate&quot;).limit(5) %}&#xA;{% set entryIds = [] %}&#xA;&#xA;{% for sown in allSown %}&#xA;    {% set entry = sown.title %}&#xA;    {% set entryIds = entryIds | merge([entry.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.section(&quot;garden&quot;).id(entryIds).fixedOrder(true).status(&quot;live,pending&quot;) %}&#xA;&#xA;{% for sown in entries %}&#xA;    {{ sown.title }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my question is, why can't I view the entries, and what do I need to do to display the date of the matrix field? It seems like it should working, but I am missing something for sure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;** note I need to have a matix date there as there are often multiple sowing locations and dates per entry. &lt;/p&gt;&#xA;" OwnerUserId="3392" LastActivityDate="2015-03-30T23:34:47.547" Title="How do I sort and display by a matrix date field?" Tags="&lt;matrix&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8927" PostTypeId="2" ParentId="8926" CreationDate="2015-03-30T23:26:13.390" Score="2" Body="&lt;p&gt;I have not worked with Lowblocks yet, but it looks like it returns an array of Matrix block models. To get to the related entries you need to access the &lt;code&gt;owner&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = [] %}&#xA;{% for sown in allSown %}&#xA;    {% set blockId = sown.id %}&#xA;    {% set entryIds = entryIds|merge([blockId.owner.id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But do you really need those entry IDs? You could just display the blocks?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sown in allSown %}&#xA;    {{ sown.owner.title }}&#xA;    {{ sown.sowingLocation }}&#xA;    {{ sown.sowingDate }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-30T23:34:47.547" LastActivityDate="2015-03-30T23:34:47.547" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8929" PostTypeId="2" ParentId="4600" CreationDate="2015-03-31T07:02:58.657" Score="4" Body="&lt;p&gt;My &lt;a href=&quot;http://michaelrog.com/craft/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt; Plugin is built for use cases exactly such as this. It allows you to render each object in your array using a Twig object template and sort the array based on the rendered value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve your particular use case, just fetch both of the arrays, merge them, and SuperSort them by their appropriate date field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = craft.entries.section('foo')... %}&#xA;{% set bar = craft.entries.section('bar')... %}&#xA;{% set feed = foo|merge(bar) %}&#xA;{% set sortedFeed = feed | supersort('sortAs', '{{ object.fooProperty is defined ?: object.barProperty }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The plugin parses the supplied '&lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#renderObjectTemplate-detail&quot; rel=&quot;nofollow&quot;&gt;micro-template&lt;/a&gt;' into its value and sorts the list according to that computed value.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-03-31T07:02:58.657" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8931" PostTypeId="1" CreationDate="2015-03-31T09:53:10.277" Score="2" ViewCount="126" Body="&lt;p&gt;my entries have simple numbers as title (1, 2, 3, ... 10, 11 etc.). I'd like to order them naturally and not 1, 10, 11, 2, 3 etc. Is Craft allowing this? &lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2015-03-31T15:58:07.493" Title="How to order numbers naturally?" Tags="&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8932" PostTypeId="2" ParentId="8931" CreationDate="2015-03-31T10:21:08.107" Score="5" Body="&lt;p&gt;I think the simplest solution is to use a plugin like &lt;a href=&quot;https://github.com/victor-in/Craft-TwigBetterSort/&quot; rel=&quot;nofollow&quot;&gt;Twig Better Sort&lt;/a&gt; or &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt;. With those you would query for your entries as normal and then apply the Twig filter to sort the array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection') %}&#xA;{% set entries = entries|supersort('natsortAs', '{title}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-31T15:58:07.493" LastActivityDate="2015-03-31T15:58:07.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8933" PostTypeId="1" AcceptedAnswerId="8935" CreationDate="2015-03-31T10:23:41.230" Score="1" ViewCount="621" Body="&lt;p&gt;I have this controller, and I've set $allowAnonymous to true, but I'm still getting redirect to CP login:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SitemapController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionXml()&#xA;    {&#xA;        ...&#xA;        $this-&amp;gt;renderTemplate('sitemap/list.xml', array(&#xA;            'entries' =&amp;gt; $entries,&#xA;            'sections' =&amp;gt; $enabledSections&#xA;        ));        &#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-03-31T13:22:07.150" Title="Anonymous access to controller action fails" Tags="&lt;controller&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8934" PostTypeId="1" CreationDate="2015-03-31T11:32:59.927" Score="1" ViewCount="45" Body="&lt;p&gt;I get two errors upon installing the latest build 2.3.2641. The first is a slide function for the &quot;Create Your Account&quot; window and the second is a more severe error of &lt;code&gt;TypeError:Craft.uppercaseFirst is not a function&lt;/code&gt; which prevents installation and causes the busy gif to work continuosly as if something was about to occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;php version 5.4.39&#xA;MySQL Version   10.0.17-MariaDB&lt;/p&gt;&#xA;" OwnerUserId="3478" LastActivityDate="2015-03-31T17:22:26.287" Title="Installation error - Craft.uppercaseFirst is not a function" Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8935" PostTypeId="2" ParentId="8933" CreationDate="2015-03-31T12:21:01.050" Score="4" Body="&lt;p&gt;I think your URL is wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;/index.php/actions/sitemap/sitemap/xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the section of the docs that explains URLs for plugin controllers: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-03-31T13:22:07.150" LastActivityDate="2015-03-31T13:22:07.150" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8936" PostTypeId="1" AcceptedAnswerId="8938" CreationDate="2015-03-31T12:41:52.843" Score="1" ViewCount="115" Body="&lt;p&gt;I've tried the LanguageLink and the last solution described here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher/6611#6611&quot;&gt;How can I build a language switcher?&lt;/a&gt; but it never returns any URI. I'm not using translated slugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As setup I've used: &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/localization-guide&lt;/a&gt;. The language dropdown is part of top.html which I've included in each page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things I have checked:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/config/general.php and that looks fine&lt;/li&gt;&#xA;&lt;li&gt;index.php in public_html/stagingtest/ (for english) and public_html/stagingtest/es/ and public_html/stagingtest/nl/ and appears to be ok&lt;/li&gt;&#xA;&lt;li&gt;when I go to www.example.com/stagingtest/es/report/ its loading fine. craft.locale appears to be ok, but the language uri's are still blank. I can see siteUrl is displaying the correct uri. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-03-23T04:11:43.317" Title="Language link not working for me" Tags="&lt;config&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8938" PostTypeId="2" ParentId="8936" CreationDate="2015-03-31T13:31:25.797" Score="2" Body="&lt;p&gt;I have accidentally add &quot;return array..&quot; two times in my config/general.php file. I removed one and its working fine now. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-03-31T13:31:25.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8939" PostTypeId="1" AcceptedAnswerId="8940" CreationDate="2015-03-31T15:25:18.357" Score="3" ViewCount="605" Body="&lt;p&gt;I applied the superSort plugin function to a list of entries and it works perfectly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionName').type('entryType').order('entryTitle')|supersort('natsort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Trying to apply it to an entry page with this code to get the previous and next entry. It does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set arrowParams = craft.entries.section('sectionName').type('entryType').order('entryTitle')|supersort ('natsort') %}&#xA;{% set prevEntry = entry.getPrev(arrowParams) %}{% set nextEntry = entry.getNext(arrowParams) %}&#xA;  {% if prevEntry %}&#xA;    &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;{{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if nextEntry %}&#xA;    &amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;{{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for helping!&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="125" LastEditDate="2015-03-31T16:34:46.310" LastActivityDate="2015-03-31T16:34:46.310" Title="Using `getPrev` and `getNext` with entries sorted by SuperSort plugin?" Tags="&lt;templating&gt;&lt;sorting&gt;&lt;plugin-supersort&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8940" PostTypeId="2" ParentId="8939" CreationDate="2015-03-31T15:45:53.593" Score="3" Body="&lt;p&gt;It won't work with &lt;code&gt;getPrev&lt;/code&gt; and &lt;code&gt;getNext&lt;/code&gt;, as they only work with ElementCriteriaModels and not with an array of Entry models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that is what you get returned from the plugin. Supersort converts your &lt;code&gt;craft.entries&lt;/code&gt; ElementCriteriaModel into an array of Entry models. This is necessary so that it can do the sorting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only workaround I know of would be to get the IDs of your supersorted entries and pass them to the ID param of a new ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionName').type('entryType') %}&#xA;{% set entriesSorted = entries|supersort('natsortAs', '{title}') %}&#xA;&#xA;{% set entryIds = [] %}&#xA;{% for entry in entriesSorted %}&#xA;    {% set entryIds = entryIds|merge([entry.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set arrowCriteria = craft.entries.id(entryIds).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have an ElementCriteriaModel &lt;code&gt;arrowCriteria&lt;/code&gt;, prepared to get entries in the desired sort order. So now you can use &lt;code&gt;arrowCriteria&lt;/code&gt; with your entry methods.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = entry.getPrev(arrowCriteria) %}&#xA;{% set nextEntry = entry.getNext(arrowCriteria) %}&#xA;&#xA;{% if prevEntry %}&#xA;    &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;{{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextEntry %}&#xA;    &amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;{{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-03-31T16:21:01.333" LastActivityDate="2015-03-31T16:21:01.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8941" PostTypeId="2" ParentId="8939" CreationDate="2015-03-31T15:54:32.993" Score="2" Body="&lt;p&gt;&lt;strong&gt;On &lt;em&gt;natsort&lt;/em&gt;...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're sorting a list of entries, the items being sorted are EntryModel &lt;em&gt;objects&lt;/em&gt;. The &lt;code&gt;natsort&lt;/code&gt; filter won't be very helpful in that case, because &lt;code&gt;natsort&lt;/code&gt; is expecting &lt;em&gt;string&lt;/em&gt; inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you can use the &lt;code&gt;natsortAs&lt;/code&gt; filter as described in the &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;Scraper docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% entries | supersort('natsortAs', '{someStringField}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way, SuperSort knows exactly which value to sort by, and your results will be consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On &lt;em&gt;getPrev()&lt;/em&gt; and &lt;em&gt;getNext()&lt;/em&gt;...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getPrev()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; methods on an EntryModel relate to its order within a specific ElementCriteriaModel, based on the parameters you provided when you fetched the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get the &quot;previous&quot; or &quot;next&quot; item in a sorted array, you can utilize Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;loop&lt;/code&gt; variable&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;loop.first&lt;/code&gt; and &lt;code&gt;loop.last&lt;/code&gt; tell you whether you're at the beginning or end of the loop, and &lt;code&gt;loop.index0 + 1&lt;/code&gt; and &lt;code&gt;loop.index0 - 1&lt;/code&gt; will refer to the indexes of the next and previous items in the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(c.f. &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/tags/for.html&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2015-03-31T16:05:49.993" LastActivityDate="2015-03-31T16:05:49.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8942" PostTypeId="2" ParentId="8934" CreationDate="2015-03-31T17:22:26.287" Score="2" Body="&lt;p&gt;It sounds like some files were not uploaded correctly to your server, or are corrupt/missing from your Craft download.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download a fresh copy of Craft from &lt;a href=&quot;http://buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com&lt;/a&gt; and swap out your existing &lt;code&gt;craft/app&lt;/code&gt; folder with the new, freshly downloaded &lt;code&gt;craft/app&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-31T17:22:26.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8943" PostTypeId="2" ParentId="8835" CreationDate="2015-03-31T18:27:45.013" Score="2" Body="&lt;p&gt;This should no longer be an issue in the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2641&quot; rel=&quot;nofollow&quot;&gt;2.3.2461&lt;/a&gt;) release of Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-03-31T18:27:45.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8944" PostTypeId="1" CreationDate="2015-03-31T21:07:13.970" Score="0" ViewCount="97" Body="&lt;p&gt;I have upgraded to Oauth (0.9.65) and Videos (1.0.23) but i'm getting an 'Recoverable error' when trying to edit a piece of content;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be an array, integer given, called in /craft/plugins/videos/vendor/composer/autoload_real.php on line 38 and defined&#xA;&#xA;/craft/app/vendor/composer/ClassLoader.php(88)&#xA;&#xA;public function addClassMap(array $classMap)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wondered if anyone else has had this issue? I have tried re-uploading both plugins but the only way around at the moment is to disable the Videos plugin.&lt;/p&gt;&#xA;" OwnerUserId="679" LastEditorUserId="45" LastEditDate="2015-03-31T23:37:19.780" LastActivityDate="2015-03-31T23:37:19.780" Title="Recoverable error with dukt video" Tags="&lt;plugin-duktvideos&gt;&lt;plugin-duktoauth&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8945" PostTypeId="1" AcceptedAnswerId="9012" CreationDate="2015-03-31T21:34:39.547" Score="2" ViewCount="1290" Body="&lt;p&gt;The admin panel's icon font refuses to load, throwing a 404 along with the full body of the font file. The result looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QKfXc.png&quot; alt=&quot;The request, as seen in Postman.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zSBYa.png&quot; alt=&quot;Broken icon font :(&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know nginx well, but we recently added a change to the config to categorically lock down cross-domain font usage where &lt;code&gt;suddenvalleydevelopment.com&lt;/code&gt; is our primary domain and &lt;code&gt;balboatowers.com&lt;/code&gt; is another one authorized to use fonts. Relevant lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;map $http_origin $cors_permitted_domain {&#xA;    hostnames;&#xA;    default suddenvalleydevelopment.com;&#xA;    .suddenvalleydevelopment.com $http_origin;&#xA;    .balboatowers.com $http_origin;&#xA;}&#xA;&#xA;location ~* \.(otf|ttf|eot|woff)$ {&#xA;    add_header &quot;Access-Control-Allow-Origin&quot; &quot;$cors_permitted_domain&quot;;&#xA;    add_header 'Vary' 'Origin';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure this created the problem you see above, but I don't understand &lt;em&gt;how&lt;/em&gt; and therefore how to fix it. We know that Craft stores its own font files at craft/app/resources/fonts, and not in public/admin/resources/fonts like you'd expect from the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How does Craft get its icon font (Craft.woff, etc.) to the browser, and why would the CORS provision interfere with that?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2015-04-03T17:54:55.463" Title="Why might the admin panel's font 404?" Tags="&lt;control-panel&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8946" PostTypeId="2" ParentId="8923" CreationDate="2015-03-31T22:47:45.897" Score="2" Body="&lt;p&gt;Take a look at &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Multi-Environment Configs&lt;/a&gt; and specifically &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;nofollow&quot;&gt;environmentVariables&lt;/a&gt;. Then you can &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#setting-support&quot; rel=&quot;nofollow&quot;&gt;add your variables to the settings&lt;/a&gt; in the Craft CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: you'll have to figure out Heroku's paths by trial and error or ask their support staff for help.&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2015-03-31T23:12:01.177" LastActivityDate="2015-03-31T23:12:01.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8947" PostTypeId="1" AcceptedAnswerId="8949" CreationDate="2015-04-01T00:05:51.120" Score="3" ViewCount="1260" Body="&lt;p&gt;I am trying to show an image that is defined on a category - named photos. I have an entry page with a list of all category entries listed at the bottom. I'd like to show this image but I'm still green on Craft categories and I'm getting errors in dev mode. This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sermons').find() %}&#xA;{% for category, catEntries in entries | group('series.first().title') %}&#xA;&#xA; {% if category.photos | length %} {# if a photo exists, show it #}&#xA;    {% for image in category.photos.limit(1) %}&#xA;    {% set params = { width: 300, height: 200 } %}&#xA;        &amp;lt;img  src=&quot;{{ image.getUrl(params) }}&quot; height=&quot;{{ image.getHeight(params) }}&quot; width=&quot;{{ image.getWidth(params) }}&quot; alt=&quot;&quot;&amp;gt;&#xA;    {% endfor %}&#xA;  {% else %} {# if no photo exists, show a default image #}&#xA;        &amp;lt;img  src=&quot;/img/cover-default.jpg&quot; width=&quot;300&quot; height=&quot;200&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;&#xA;&#xA;{# output all category entries #}   &#xA;    &amp;lt;ul class=&quot;sermonadditional&quot;&amp;gt;&#xA;   {% for entry in catEntries %}&#xA;       &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;   {% endfor %}&#xA;   &amp;lt;/ul&amp;gt;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-04-01T05:43:58.303" Title="Category field in entry" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8948" PostTypeId="2" ParentId="8947" CreationDate="2015-04-01T04:59:45.777" Score="2" Body="&lt;p&gt;I am guessing that &lt;code&gt;series&lt;/code&gt; is your category field. In that case, you are grouping your entries by the title of their first (and only?) category. In the loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category, catEntries in entries | group('series.first().title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;category&lt;/code&gt; will be the title of the category, and &lt;code&gt;catEntries&lt;/code&gt; will be the entries whose category has that title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The title of a category is a string, so it makes sense you can't get &lt;code&gt;category.photos&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is a category, not a string. What I would do is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for categorySlug, catEntries in entries | group('series.first().slug') %}&#xA;  {% set category = craft.category.slug(categorySlug).first %}&#xA;  ... rest of your code as before ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am grouping by category slug instead of title, because that is guaranteed to be unique, and then fetching the actual category based on its slug.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-01T04:59:45.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8949" PostTypeId="2" ParentId="8947" CreationDate="2015-04-01T05:37:18.603" Score="3" Body="&lt;p&gt;It wasn't really clear to me if you want to list only those categories that are related to the current entry&#xA;or if you want a list of all categories that are assigned to your sermons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont't think the group filter helps a lot in either case and I'd get the catgories like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sermonCategories = entry.series %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case you don't want them to be ordered by your manual sort order, you need to&#xA;get them using a &lt;code&gt;craft.categories&lt;/code&gt; ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sermonCategories = craft.categories.relatedTo(entry).order('title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get all the categories you'd query for all of your &quot;sermons&quot; entries first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sermons = craft.entries.section('sermons') %}&#xA;{% set sermonCategories = craft.categories.relatedTo(sermons).order('title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The you can start with your loop. I did some small changes, so that only categories with entries related to it will be shown.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in sermonCategories %}&#xA;&#xA;    {% set relatedEntries = craft.entries.relatedTo(category) %}&#xA;&#xA;    {# Only show category if there are related entries #}&#xA;    {% if relatedEntries|length %}&#xA;&#xA;        {% set image = category.photos.first() %}&#xA;        {% set params = { width: 300, height: 200 } %}&#xA;&#xA;        {# If a photo exists, show it, otherwise show a placeholder #}&#xA;        {% if image %}&#xA;            &amp;lt;img  src=&quot;{{ image.getUrl(params) }}&quot; height=&quot;{{ image.getHeight(params) }}&quot; width=&quot;{{ image.getWidth(params) }}&quot; alt=&quot;&quot;&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;img  src=&quot;/img/cover-default.jpg&quot; width=&quot;300&quot; height=&quot;200&quot; alt=&quot;&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;ul class=&quot;sermonadditional&quot;&amp;gt;&#xA;            {% for entry in relatedEntries %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-01T05:43:58.303" LastActivityDate="2015-04-01T05:43:58.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8951" PostTypeId="1" AcceptedAnswerId="8957" CreationDate="2015-04-01T10:28:08.123" Score="7" ViewCount="830" Body="&lt;p&gt;I've setup a localized site (de/en) with custom routing for my categories (which are marked as translatable). I use a &lt;em&gt;tag route&lt;/em&gt; for my categories which points to the same template as my structure. Everything seemed to work fine but then I realized that the custom filter (via relatedTo) also outputs entries that don't belong to the current category locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it clear I'll try to give a rough schemata of my setup (using Craft Pro 2.3.2640):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;section&lt;/strong&gt; &lt;em&gt;projects&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;has the entry url format:&#xA;  de -&amp;gt; projekte/{slug}    &#xA;  en -&amp;gt; projects/{slug}&#xA;entry template path:&#xA;  projects/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;single&lt;/strong&gt; &lt;em&gt;projectsIndex&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;has the entry url format:&#xA;  de -&amp;gt; projekte  &#xA;  en -&amp;gt; projects&#xA;entry template path:&#xA;  projects/index&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;routes&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;de -&amp;gt; projekte/(tag)&#xA;  template path: projects/index&#xA;en -&amp;gt; projects/(tag)&#xA;  template path: projects/index&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;category&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;doesn't have a it's own url&#xA;category field is marked as translatable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;category entries&lt;/strong&gt; (german version and the english translation):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - de -&amp;gt; kultur      en -&amp;gt; culture    | (resp. title and slug)&#xA; - de -&amp;gt; industrie   en -&amp;gt; industry   | (resp. title and slug)&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;project entries&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - Entry A:&#xA;     de -&amp;gt; category relations ['industrie', 'kultur']&#xA;     en -&amp;gt; category relations ['industry']&#xA; - Entry B:&#xA;     de -&amp;gt; category relations ['kultur']&#xA;     en -&amp;gt; category relations ['culture']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template projects/index.html&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% set _filter = tag|default(null) %}&#xA;{% set _category = craft.categories.slug(_filter) %}&#xA;...&#xA;{% for entry in craft.entries.section('projects').relatedTo(_category) %}&#xA;   ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;urls&lt;/strong&gt; (here comes the trouble):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - /projekte&#xA;     -&amp;gt; lists german version of 'Entry A' and 'Entry B'  (expected)&#xA; - /en/projects&#xA;     -&amp;gt; lists english version of 'Entry A' and 'Entry B' (expected)&#xA;&#xA; - /projekte/kultur&#xA;     -&amp;gt; lists german version of 'Entry A' and 'Entry B'  (expected)&#xA; - /en/projects/culture&#xA;     -&amp;gt; lists english version of 'Entry A' (NOT expected) and 'Entry B'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...'Entry A' on '/en/projects/culture' shouldn't show up just because there's the 'kultur' category attached to the german version of this entry!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried to explicitly restrict the '_category' by using the '.locale' method but that didn't help either. Now I wonder if I'm doing something fundamentally wrong or if this is a bug by craft itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips are appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &#xA;Answering my own question &lt;a href=&quot;https://craftcms.stackexchange.com/a/8957/3323&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3323" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-01T17:20:10.820" Title="How to use localized categories properly?" Tags="&lt;localization&gt;&lt;relations&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8952" PostTypeId="2" ParentId="8951" CreationDate="2015-04-01T11:41:12.547" Score="2" Body="&lt;p&gt;An elements &lt;code&gt;slug&lt;/code&gt; property is saved per locale, so you shouldn't get categories with a slug &quot;culture&quot; in your german locale. The &lt;code&gt;locale&lt;/code&gt; property is set to your current locale by default, so there's no need to set that explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just did a simple test to see if there's no exception to category ElementCriteriaModels.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.slug('alkoholfrei') %}&#xA;{{ categories|length ? categories.first().title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can confirm it works as expected, a category with a translated german slug of &quot;alkoholfrei&quot; is not returned in other locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I would recommend to double check your category slugs, you probably only translated the title and your slug is not yet updated.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the actual problem with your code is not how you get the categories, but how you're dealing with them in the &lt;code&gt;craft.entries&lt;/code&gt; ElementCriteriaModel. You should check if there's actually categories found, because otherwise your &lt;code&gt;relatedTo&lt;/code&gt; param doesn't do anything and you simple get all your &quot;project&quot; entries returned.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if categories|length %}&#xA;    {% set entries = craft.entries.section('projects').relatedTo(categories) %}&#xA;    {% for entry in entries %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-01T12:42:17.227" LastActivityDate="2015-04-01T12:42:17.227" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8953" PostTypeId="1" AcceptedAnswerId="8956" CreationDate="2015-04-01T12:31:12.577" Score="4" ViewCount="439" Body="&lt;p&gt;I can sort structures alphabetically, by date or by specific field. Structures also allow me to sort by the order specified in the Control Panel. So what is the use case for using Channels instead of Structures? Is there a performance cost? Is there anything that I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="312" LastActivityDate="2015-09-11T07:06:11.077" Title="Why would I choose Channels as opposed to Structures" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8955" PostTypeId="2" ParentId="8953" CreationDate="2015-04-01T12:56:16.547" Score="1" Body="&lt;p&gt;I don't think you're missing anything, structures are the better channels!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... but things like selecting an entry's parent can contribute to the client's confusion. And that even more in case it doesn't make any sense in the context.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-01T12:56:16.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8956" PostTypeId="2" ParentId="8953" CreationDate="2015-04-01T13:04:31.717" Score="6" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;official docs&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Channels are used for streams of similar content&lt;/p&gt;&#xA;&lt;p&gt;Structures are good for times when you need to store multiple similar entries, and they need to be sorted into a specific order. They can also be hierarchical.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As per your question there's no performance overhead involved, but as a general rule it's usually a good idea to keep things as simple as possible.&lt;/p&gt;&#xA;&lt;p&gt;Channels are bit simpler than Structures and if the content is neither hierarchical nor multi-level, there's no reason to use the latter. A &lt;em&gt;blog&lt;/em&gt; is a good example of an appropriate use case for a Channel.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-09-11T07:06:11.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8957" PostTypeId="2" ParentId="8951" CreationDate="2015-04-01T13:13:28.713" Score="5" Body="&lt;p&gt;To answer my own question see below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/users/125/carlcs&quot;&gt;carlcs&lt;/a&gt; pointed out correctly the problem actually isn't located in getting the category - which works just well and is the right way to do it - but in how the relation to the entries is done.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I should check if the tag (coming from the url) actually resolves to a &quot;real&quot; category, otherwise just all entries will be shown.&lt;/li&gt;&#xA;&lt;li&gt;just handling over the category to the &lt;code&gt;.relatedTo&lt;/code&gt; method on craft.entries won't do it because that just fetches all entries related to this category irrespective to its locale - &lt;code&gt;sourceLocale: craft.locale&lt;/code&gt; needs to be set.&lt;/li&gt;&#xA;&lt;li&gt;Still not finished; because we want to &quot;&lt;em&gt;find elements related to the given element, where the given element is the target of the relation&lt;/em&gt;&quot; – target in this sense is the category – we need to define it as &lt;code&gt;tagetElement&lt;/code&gt; in the &lt;code&gt;relatedTo&lt;/code&gt; method.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the entries should now look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if categories|length %}&#xA;    {% set entries = &#xA;              craft.entries.section('projects').relatedTo({&#xA;                 targetElement: categories,&#xA;                 sourceLocale: craft.locale&#xA;              }) &#xA;    %}&#xA;    {% for entry in entries %}&#xA;    ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the actual title of my question should be &lt;strong&gt;&quot;How to do category relations with locales&quot;&lt;/strong&gt; ;)&lt;/p&gt;&#xA;" OwnerUserId="3323" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-04-01T13:13:28.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8958" PostTypeId="1" CreationDate="2015-04-01T13:26:34.430" Score="1" ViewCount="62" Body="&lt;p&gt;I've encounterd a problem with URL creation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin I have the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes() {&#xA;    return [&#xA;        'korting/zoeken' =&amp;gt; array('action' =&amp;gt; '/discount/discount/index'),&#xA;        'korting/(?P&amp;lt;id\d+&amp;gt;)-(?P&amp;lt;slug&amp;gt;[a-zA-Z0-9-]+)' =&amp;gt; array('action' =&amp;gt; 'discount/discount/view',),&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I'm at the frontend, I use the following to create the URL :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('/discount/discount/view',{id:entry.id,slug:entry.slug}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My plugin gets its data from a solarium document, so its no entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect that my URL would become neat like : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/korting/124-test-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but instead I get : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/korting?id=124&amp;amp;slug=test-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This feature is build in by default in the Yii URL manager, but Craft doesn't make use of it. This is resulting in my problem that Craft doesn't have the abbility to make pathed URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way for me to do this?&lt;/p&gt;&#xA;" OwnerUserId="3482" LastEditorUserId="125" LastEditDate="2015-04-01T13:42:10.407" LastActivityDate="2015-04-01T13:46:21.217" Title="Pathed URL creation from templated files" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8959" PostTypeId="2" ParentId="8958" CreationDate="2015-04-01T13:40:07.177" Score="2" Body="&lt;p&gt;You can use the &lt;code&gt;~&lt;/code&gt; (concatenate string) operator to build the URL manually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('/discount/discount/view/'~entry.id~'-'~entry.slug) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-01T13:46:21.217" LastActivityDate="2015-04-01T13:46:21.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8960" PostTypeId="1" AcceptedAnswerId="8967" CreationDate="2015-04-01T14:21:39.373" Score="2" ViewCount="2783" Body="&lt;p&gt;I'm aware, that this question is a little bit out of scope to Craft, but It relates, when redactor is part of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was playing around and I must tell, that it's horrible to create a text with  redactor. &lt;strong&gt;Especially&lt;/strong&gt;, if you need insert a &lt;code&gt;htmlTag&lt;/code&gt; within &lt;code&gt;paragraph&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In myredactor.json file all formatting features are set according to documentation, but I found out, that redactor by default, doesn't support highlighting text, only through &lt;a href=&quot;http://imperavi.com/redactor/docs/api/selection/&quot; rel=&quot;nofollow&quot;&gt;API&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: Here at stackexchange, you can highlight text to &lt;code&gt;code&lt;/code&gt; or &lt;strong&gt;bold&lt;/strong&gt; or ...etc. in very lovely and clever way. To do it in redactor by highlighting text and selecting a type format from dropdown menu, imposible ... yet.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="125" LastEditDate="2015-04-02T09:34:32.787" LastActivityDate="2015-04-03T22:55:05.497" Title="Apply inline styles to selected text in Redactor" Tags="&lt;control-panel&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8961" PostTypeId="1" CreationDate="2015-04-01T14:37:31.480" Score="4" ViewCount="802" Body="&lt;p&gt;Is there any problem with buying a Craft Client account, working on the website locally (on my pc), and when it´s done move it to the server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this permitted by the license?&lt;/p&gt;&#xA;" OwnerUserId="3483" LastEditorUserId="45" LastEditDate="2015-04-01T17:22:19.750" LastActivityDate="2015-09-15T09:01:23.500" Title="Craft license and develop a website locally?" Tags="&lt;license&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8962" PostTypeId="1" AcceptedAnswerId="8963" CreationDate="2015-04-01T14:40:44.500" Score="7" ViewCount="1207" Body="&lt;p&gt;More of a question than problem; I see this often - templates that start with an underscore. For example, &lt;code&gt;_entry.html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the Craft docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that if any of the URI segments begin with an underscore ('_'), Craft will return a 404, since template path segments that begin with an underscore are considered &quot;hidden&quot; from direct access&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess I'm confused as to what I am hiding &lt;em&gt;from&lt;/em&gt;. Is it so I can't directly browse right to the full path of that template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysite.com/something/something/_template.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you move the craft folder outside of the site root, I can't really get to that file can I? It just isn't obvious to me (yet) what the benefit is and when/where/why I need to start a template with and underscore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2019-12-11T13:59:34.847" LastActivityDate="2019-12-11T13:59:34.847" Title="Routing templates thats start with an underscore" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8963" PostTypeId="2" ParentId="8962" CreationDate="2015-04-01T15:03:52.863" Score="8" Body="&lt;p&gt;Yes, prefixing a template's filename with an underscore does what it says on the box – any underscored template will be excluded from route mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical use case is to use underscores for partials or wrappers, e.g. &quot;_mainmenu.html&quot; or &quot;_baseTemplate.html&quot; – essentially any template that doesn't make any sense to load up or access directly in the browser via that template's path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't a mandatory thing, but a good practice.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-01T15:03:52.863" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8964" PostTypeId="2" ParentId="8961" CreationDate="2015-04-01T15:09:49.890" Score="6" Body="&lt;p&gt;Sebastian, you can always work locally &quot;for free&quot;, using &quot;craft.dev&quot; as host name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the FAQs here at the bottom of the pricing page &lt;a href=&quot;https://buildwithcraft.com/pricing&quot;&gt;https://buildwithcraft.com/pricing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MAMP PRO makes it really easy to setup custom host names, btw. &lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2015-04-01T15:09:49.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8965" PostTypeId="2" ParentId="8571" CreationDate="2015-04-01T15:42:47.730" Score="5" Body="&lt;p&gt;Great question. Categories are used to organize a variety of content including entries, assets, even other categories. Categories themselves do not have content (besides maybe a description and key image), but can be related to content. They are a great way to group related entries together and provide a semantic structure (little s) to your content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Structures (big S) are entries. They are content. The biggest difference between Structure entries and Channel entries is that Structure entries can have children, parent, and sibling entries. Additionally, Structure entries should not be &quot;date driven&quot; like Channel entries would be (blogs, for example, are date driven).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your content needs to be segmented by cities, and is in some way date sensitive, I would recommend setting up city Categories and have a Channel for your entries. Fortunately, Categories can also have parent, children, and siblings, so if you needed to organize your cities by state, you could accomplish that easily with Categories. This is why the category fieldtype does not let you reorder them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quick reference, check out the documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;section types&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;categories&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="5836" LastEditDate="2016-12-05T19:42:40.533" LastActivityDate="2016-12-05T19:42:40.533" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8966" PostTypeId="1" CreationDate="2015-04-01T16:43:07.640" Score="2" ViewCount="497" Body="&lt;p&gt;How can I cache an entry, lets say a product card but exclude an dynamic part? Like amount of favorites / Or link to add or remove to favorite.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set item = craft.shortlist.item(entry.id) %}&#xA;&#xA;{% cache globally using key &quot;product-card-&quot; ~ entry.id until entry.dateUpdated %}&#xA;&#xA;   ...&#xA;&#xA;   {{ entry.title }}&#xA;&#xA;   ...&#xA;&#xA;   // EXCLUDE THIS PART FROM CACHE&#xA;   {% if item.inList %}&#xA;        &amp;lt;a class=&quot;love animating fav&quot; href=&quot;{{ item.removeActionUrl }}&quot; data-id=&quot;{{ entry.id }}&quot;&amp;gt;&amp;lt;i class=&quot;icon icon-heart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;a class=&quot;love animating&quot; href=&quot;{{ item.addActionUrl }}&quot; data-id=&quot;{{ entry.id }}&quot;&amp;gt;&amp;lt;i class=&quot;icon icon-heart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In EE CE Cache there you had {exp:ce_cache:escape}. How can I do this in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Made a feature request for escaping parts of cache for dynamic data.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7412950-exclude-cache-for-dynamic-data&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7412950-exclude-cache-for-dynamic-data&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PLEASE VOTE :-)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="294" LastEditDate="2015-04-01T17:39:39.913" LastActivityDate="2015-04-01T17:39:39.913" Title="Cache entry but escape dynamic data" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8967" PostTypeId="2" ParentId="8960" CreationDate="2015-04-01T16:58:32.947" Score="3" Body="&lt;p&gt;All of Redactor's default Formatting Styles are block elements. But you can add your own styles to it by making use of the newish &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;formattingAdd&lt;/code&gt;&lt;/a&gt; setting. There's an &lt;a href=&quot;http://imperavi.com/redactor/examples/formatting-add/&quot; rel=&quot;nofollow noreferrer&quot;&gt;example editor&lt;/a&gt; on the Imperavi website where they added multiple custom styles to it. Some of them are inline styles (try the style &quot;Big Red&quot; for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to note here is that it adds the format to the existing ones. To prevent your style from doing so you have to add &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;clear: true&lt;/code&gt;&lt;/a&gt; to your style settings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: [&#xA;  {&#xA;    tag: 'span',&#xA;    title: 'Normal inline text',&#xA;    clear: true&#xA;  },&#xA;  {&#xA;    tag: 'span',&#xA;    title: 'Big Red',&#xA;    style: 'font-size: 20px; color: red;',&#xA;    class: 'span-big-red',&#xA;    clear: true&#xA;  },&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I just tried to remove inline styles by applying my &quot;Normal inline text&quot; style to it and it first seemed not to work. But then I did a new text selection that spanned a greater portion of text and it worked. That's a good sign, but still no real solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZalMK.png&quot; alt=&quot;Override inline style set with &amp;lt;code&amp;gt;formattingAdd&amp;lt;/code&amp;gt; setting&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Imperavi didn't respond to previous Email I wrote them (not sure if it's because we, Craft users, are not direct customers of them?), I am going to ask P&amp;amp;T to make them aware of this bug.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-02T09:48:54.190" LastActivityDate="2015-04-02T09:48:54.190" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="8968" PostTypeId="2" ParentId="8966" CreationDate="2015-04-01T17:03:22.877" Score="2" Body="&lt;p&gt;You would simply not wrap it in &lt;code&gt;cache&lt;/code&gt; tags. I don't think there's anything like that EE function to specifically exclude parts within the tag. Might be worth a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; though?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set item = craft.shortlist.item(entry.id) %}&#xA;&#xA;{% cache globally using key &quot;product-card-&quot; ~ entry.id ~ &quot;-1&quot; until entry.dateUpdated %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;    ...&#xA;&#xA;{% endcache %}&#xA;&#xA;// EXCLUDE THIS PART FROM CACHE&#xA;{% if item.inList %}&#xA;    &amp;lt;a class=&quot;love animating fav&quot; href=&quot;{{ item.removeActionUrl }}&quot; data-id=&quot;{{ entry.id }}&quot;&amp;gt;&amp;lt;i class=&quot;icon icon-heart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;a class=&quot;love animating&quot; href=&quot;{{ item.addActionUrl }}&quot; data-id=&quot;{{ entry.id }}&quot;&amp;gt;&amp;lt;i class=&quot;icon icon-heart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% cache globally using key &quot;product-card-&quot; ~ entry.id ~ &quot;-2&quot; until entry.dateUpdated %}&#xA;&#xA;    ...&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-01T17:27:04.133" LastActivityDate="2015-04-01T17:27:04.133" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8969" PostTypeId="2" ParentId="8961" CreationDate="2015-04-01T17:12:42.417" Score="5" Body="&lt;p&gt;When you move the license to production you'll see a warning in the CP - you then have the option to transfer the license to the new domain.  See &lt;a href=&quot;http://buildwithcraft.com/help/license-transferring&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously then you'll get the warning in your development environment but that's something you can live with I assume!&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="57" LastEditDate="2015-04-01T17:58:15.857" LastActivityDate="2015-04-01T17:58:15.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8970" PostTypeId="2" ParentId="8961" CreationDate="2015-04-01T17:34:00.123" Score="3" Body="&lt;p&gt;Short answer is &lt;strong&gt;yes, that is entirely allowed&lt;/strong&gt;. Great information has already been provided in &lt;a href=&quot;https://craftcms.stackexchange.com/a/8964/45&quot;&gt;Tom's answer&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/8969/45&quot;&gt;Adam's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are already certain that you'll be purchasing a Craft Client account, then you won't have to do anything special to get the site working locally. As long as the same &lt;strong&gt;license key&lt;/strong&gt; remains in your site, any purchased upgrades will remain available to you... regardless of whether the site is running locally or on a server!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how familiar you are with this, but you may want to learn more about &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-environment configurations&lt;/a&gt; in Craft. It's incredibly easy to move your website between environments without losing any rights or privileges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can run your site locally without any warnings as long as you're using a &lt;strong&gt;dev-sounding&lt;/strong&gt; domain. Read this article... All of the answers you're looking for should be in here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot; rel=&quot;nofollow noreferrer&quot;&gt;How is Craft’s license agreement enforced?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-01T17:34:00.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8971" PostTypeId="2" ParentId="961" CreationDate="2015-04-01T18:50:04.273" Score="4" Body="&lt;p&gt;craftcms.conf&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;root /srv/http/current-release/src/public;&#xA;&#xA;index index.php index.html index.htm;&#xA;&#xA;charset utf-8;&#xA;&#xA;# Force the latest IE version&#xA;add_header &quot;X-UA-Compatible&quot; &quot;IE=Edge&quot;;&#xA;&#xA;error_page 404 /index.php;&#xA;&#xA;location / {&#xA;    # try_files $uri $uri/ /index.php?$query_string;&#xA;    try_files $uri $uri/ @rewrites;&#xA;}&#xA;&#xA;location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;}&#xA;&#xA;# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&#xA;location ~ \.php$ {&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    # NOTE: You should have &quot;cgi.fix_pathinfo = 0;&quot; in php.ini&#xA;&#xA;    # With php5-cgi alone:&#xA;    # fastcgi_pass 127.0.0.1:9000;&#xA;    fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi_params;&#xA;}&#xA;&#xA;# Expire rules for static content&#xA;&#xA;# No default expire rule. This config mirrors that of apache as outlined in the&#xA;# html5-boilerplate .htaccess file. However, nginx applies rules by location,&#xA;# the apache rules are defined by type. A consequence of this difference is that&#xA;# if you use no file extension in the url and serve html, with apache you get an&#xA;# expire time of 0s, with nginx you'd get an expire header of one month in the&#xA;# future (if the default expire rule is 1 month). Therefore, do not use a&#xA;# default expire rule with nginx unless your site is completely static&#xA;&#xA;# cache.appcache, your document html and data&#xA;location ~* \.(?:manifest|appcache|html?|xml|json)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires -1;&#xA;}&#xA;&#xA;# Feed&#xA;location ~* \.(?:rss|atom)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1h;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;# Media: images, icons, video, audio, HTC&#xA;location ~* \.(?:jpg|jpeg|gif|png|pdf|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1M;&#xA;    access_log off;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;# CSS and Javascript&#xA;location ~* \.(?:css|js)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1y;&#xA;    access_log off;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;# Favicons&#xA;location = /favicon.ico {&#xA;    access_log off;&#xA;    log_not_found off;&#xA;}&#xA;# Robots.txt&#xA;location = /robots.txt {&#xA;    access_log off;&#xA;    log_not_found off;&#xA;}&#xA;&#xA;# Prevent clients from accessing hidden files (starting with a dot)&#xA;# This is particularly important if you store .htpasswd files in the site hierarchy&#xA;location ~* (?:^|/)\. {&#xA;    deny all;&#xA;}&#xA;# Prevent clients from accessing to backup/config/source files&#xA;location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {&#xA;    deny all;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sites-available.conf&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# http://example.com&#xA;# http://www.example.com&#xA;# This server redirects users to the authoritive non-WWW https site.&#xA;server {&#xA;    # don't forget to tell on which port this server listens&#xA;    #listen [::]:80;&#xA;    listen 80;&#xA;    server_name example.com www.example.com;&#xA;    # and redirect to the non-www host (declared below)&#xA;    return 301 https://example.com$request_uri;&#xA;}&#xA;&#xA;# https://www.example.com&#xA;# This server redirects users to the secure non-WWW https site.&#xA;server {&#xA;    listen 443 ssl spdy;&#xA;    # listen on the www host&#xA;    server_name www.example.com;&#xA;    include ssl.conf;&#xA;    # and redirect to the non-www host (declared below)&#xA;    return 301 https://example.com$request_uri;&#xA;}&#xA;&#xA;# http://&amp;lt;IP address&amp;gt;&#xA;# Allows HTTP direct to the IP address of the EC2 node&#xA;server {&#xA;    # don't forget to tell on which port this server listens&#xA;    listen 80 default_server;&#xA;    # listen on the domain name only&#xA;    server_name example.com;&#xA;    include craftcms.conf;&#xA;}&#xA;&#xA;# https://example.com&#xA;# The BE ALL END ALL OF NGINX CONFIGURATIONS AT example.com&#xA;server {&#xA;    # don't forget to tell on which port this server listens&#xA;    listen 443 default_server ssl spdy;&#xA;    # listen on the domain name only&#xA;    server_name naralogics.com;&#xA;    include ssl.conf;&#xA;    include craftcms.conf;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3485" LastEditorUserId="3485" LastEditDate="2015-05-18T15:16:40.203" LastActivityDate="2015-05-18T15:16:40.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8972" PostTypeId="1" AcceptedAnswerId="8975" CreationDate="2015-04-01T19:35:48.860" Score="2" ViewCount="504" Body="&lt;p&gt;I'm relatively new to CraftCMS, so feel free to smack me upside the head if I'm missing something obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an ElasticSearch provider that I'd like to use instead of Craft's default search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file at &lt;code&gt;/app/etc/config/common.php&lt;/code&gt; appears to be a dependency injection system that should make replacing core components relatively easy, and &#xA;the class defined in &lt;code&gt;/app/services/SearchService.php&lt;/code&gt; looks simple enough to replace with a custom solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I'm having trouble finding documentation around replacing core components, and I'm not having much luck finding any way to override the common config file from outside the core application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be that I'm going about this the wrong way, and I'm totally open to suggestions. Either way, thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3486" LastActivityDate="2015-04-01T21:38:57.560" Title="Replacing core services" Tags="&lt;config&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8973" PostTypeId="1" AcceptedAnswerId="8977" CreationDate="2015-04-01T19:46:47.973" Score="8" ViewCount="1238" Body="&lt;p&gt;I'm writing another plugin for my craft app, this time I'm attempting to reuse a MySQL table that's used by other applications as well. I've a class extending the BaseRecord, and &lt;code&gt;getTableName()&lt;/code&gt; will return &lt;code&gt;differentdb.tablename&lt;/code&gt;. Does Craft handle this, or do I have to make a copy of that table in the craft database? (MySQL permissions for the craft user already give it read access to that database)&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="344" LastEditDate="2015-05-05T10:30:31.730" LastActivityDate="2017-03-23T20:49:54.960" Title="Query table in a different database" Tags="&lt;database&gt;&lt;config&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8974" PostTypeId="1" AcceptedAnswerId="8981" CreationDate="2015-04-01T20:08:27.840" Score="1" ViewCount="128" Body="&lt;p&gt;What I'm trying to accomplish is looping through a collection of entries and have them display (&lt;em&gt;with pagination&lt;/em&gt;) in the following order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entries tagged as &lt;strong&gt;Featured&lt;/strong&gt; in alphabetical (title) order&lt;/li&gt;&#xA;&lt;li&gt;entries tagged as &lt;strong&gt;New&lt;/strong&gt; in alphabetical (title) order&lt;/li&gt;&#xA;&lt;li&gt;all remaining entries in alphabetical (title) order&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The following worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({ order: 'featuredLightswitchField desc, title asc' })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it fails to work if you try to use two lightswitch fields (e.g. featured and new) in addition to the title ordering, and I'd prefer to keep things tag-based instead of needing to add lightswitch fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also attempted at creating a custom array of entry IDs in the proper order and passing it to &lt;code&gt;craft.entries.id()&lt;/code&gt;, however I can't find a way of keeping the entries in the order of the array passed to &lt;code&gt;craft.entries.id()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({ id: [3, 1, 2] })&#xA;// can't find a way to keep entries in [3, 1, 2] order.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there was a way to order the entries based off the &lt;code&gt;id&lt;/code&gt; array that would solve the problem, unless there's a better solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can provide additional information if my explanation is insufficient.&lt;/p&gt;&#xA;" OwnerUserId="1048" LastActivityDate="2015-04-02T06:25:14.813" Title="Display entries tagged with specific tag(s) before other entries" Tags="&lt;entries&gt;&lt;tags&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8975" PostTypeId="2" ParentId="8972" CreationDate="2015-04-01T21:38:57.560" Score="2" Body="&lt;p&gt;Currently not possible, but I really like the idea of a plugin being able to swap out what &lt;code&gt;craft()-&amp;gt;search&lt;/code&gt; points to, whether it's &lt;a href=&quot;https://www.elastic.co/products/elasticsearch&quot; rel=&quot;nofollow&quot;&gt;ElasticSearch&lt;/a&gt;, &lt;a href=&quot;https://lucene.apache.org/&quot; rel=&quot;nofollow&quot;&gt;Lucene&lt;/a&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add it to our internal list, but you might want to submit a public &lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; for this as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-01T21:38:57.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8976" PostTypeId="2" ParentId="8899" CreationDate="2015-04-01T22:03:35.270" Score="1" Body="&lt;p&gt;I think what you're asking is how to define the relationship using Active Record in the other direction - going from Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/models/AssetFileModel&quot; rel=&quot;nofollow&quot;&gt;AssetFileRecord&lt;/a&gt; to your plugin's EstateRecord.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the answer is that you can't without hacking the AssetFileRecord and manually adding a BELONGS_TO relation back to your Estate Record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're going to be much better off ditching records and active record for this all-together, I think.  Have your service layer use the &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;Query Builder&lt;/a&gt; &lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt; directly, then you can join in any data you want from any tables outside of the context of active record.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-01T22:03:35.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8977" PostTypeId="2" ParentId="8973" CreationDate="2015-04-01T22:24:38.113" Score="8" Body="&lt;p&gt;Have you tried it? I'm pretty sure that's not going to work as Active Record is tied to the db connection in &lt;code&gt;craft/config/db.php&lt;/code&gt; hanging off of &lt;code&gt;craft()-&amp;gt;db&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to pull it off with a plugin that instantiates its own DbConnection, though and uses &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Query Builder&lt;/a&gt; instead of Active Record.  Completely untested, but something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$otherDbConnection =  Craft::createComponent(array(&#xA;    'emulatePrepare'    =&amp;gt; true,&#xA;    'charset'           =&amp;gt; 'utf8',&#xA;    'tablePrefix'       =&amp;gt; 'craft_',&#xA;    'class'             =&amp;gt; 'Craft\DbConnection',&#xA;    'autoConnect'       =&amp;gt; true,&#xA;));&#xA;&#xA;$otherDbConnection-&amp;gt;connectionString = 'mysql:host=localhost;dbname=otherdb;port=3306';&#xA;$otherDbConnection-&amp;gt;username = $userName;&#xA;$otherDbConnection-&amp;gt;password = $password;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you can do &lt;code&gt;$otherDbConnection-&amp;gt;createCommand()&lt;/code&gt; and grab all of the data you want from the other database.  It's up to you how you'd merge that in with data from your existing database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to get fancy and access the database in other files/places in code, you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;setComponent('otherDb', $otherDbConnection);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And access the other database via: &lt;code&gt;craft()-&amp;gt;otherDb-&amp;gt;createCommand()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="6309" LastEditDate="2017-03-23T20:49:54.960" LastActivityDate="2017-03-23T20:49:54.960" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8978" PostTypeId="1" CreationDate="2015-04-02T02:13:25.873" Score="3" ViewCount="332" Body="&lt;p&gt;I'm not sure what's wrong with this original markup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conditional One (doesn't work)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaTitle is defined %}&#xA;  {{ entry.metaTitle }}&#xA;{% elseif title is defined %}&#xA;  {{ title }}&#xA;{% else %}&#xA;  {{ siteName }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but seems a bit much for some simple checks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conditional Two (does work)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaTitle is defined %}&#xA;  {{ entry.metaTitle }}&#xA;{% endif %}&#xA;{% if (title is defined) and (entry.metaTitle is empty) %}&#xA;  {{ title }}&#xA;{% endif %}&#xA;{% if (title is empty) and (entry.metaTitle is empty) %}&#xA;  {{ siteName }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I'm checking first if &lt;code&gt;metaTitle&lt;/code&gt; is set, then &lt;code&gt;title&lt;/code&gt; then finally fallback to &lt;code&gt;siteName&lt;/code&gt;. Entering data for the first two return results, but not sure why if &lt;code&gt;metaTitle&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt; are empty why &lt;code&gt;siteName&lt;/code&gt; doesn't return in the first conditional&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;#&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8978/conditional-parsing-issues/8979#8979&quot;&gt;Aaron's answer&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried this too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.metaTitle is defined) and (entry.metaTitle is empty)  %}&#xA;  {{ entry.metaTitle }}&#xA;{% elseif title is defined %}&#xA;  {{ title }}&#xA;{% else %}&#xA;  {{ siteName }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;#&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried this, Aaron was missing a &lt;code&gt;(&lt;/code&gt; in his answer :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.metaTitle is defined) and (entry.metaTitle != '')  %}&#xA;  {{ entry.metaTitle }}&#xA;{% elseif title is defined %}&#xA;  {{ title }}&#xA;{% else %}&#xA;  {{ siteName }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work either with the same initial results.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-02T08:44:26.087" Title="Conditional Parsing Issues" Tags="&lt;conditional&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8979" PostTypeId="2" ParentId="8978" CreationDate="2015-04-02T03:07:51.790" Score="4" Body="&lt;p&gt;From what I can tell, the problem is in the first line of the conditional, &lt;code&gt;{% if entry.metaTitle is defined %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are on an entry, &lt;code&gt;entry.metaTitle&lt;/code&gt; will be defined as part of the entry model (even if it is empty), so your conditional returns true. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give this a try: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.metaTitle is defined) and (entry.metaTitle != '')  %}&#xA;  {{ entry.metaTitle }}&#xA;{% elseif title is defined %}&#xA;  {{ title }}&#xA;{% else %}&#xA;  {{ siteName }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-02T03:32:07.637" LastActivityDate="2015-04-02T03:32:07.637" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8980" PostTypeId="2" ParentId="8978" CreationDate="2015-04-02T05:47:22.117" Score="2" Body="&lt;p&gt;I think this is where the problem is...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% elseif title is defined %}&#xA;    {{ title }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd be willing to wager that &lt;strong&gt;&lt;code&gt;title&lt;/code&gt; is always defined&lt;/strong&gt;. Remember, &lt;a href=&quot;https://craftcms.stackexchange.com/a/360/45&quot;&gt;there is a difference between being defined vs. being empty&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your title is defined, but set to &lt;code&gt;null&lt;/code&gt; or an empty string, you'll still be triggering this part of the if/else statement. But when you render the &lt;code&gt;{{ title }}&lt;/code&gt; value, it will render as an empty string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a solution, try writing your second conditional like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% elseif (title is defined) and (title is not empty) %}&#xA;    {{ title }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-02T05:47:22.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8981" PostTypeId="2" ParentId="8974" CreationDate="2015-04-02T06:25:14.813" Score="3" Body="&lt;p&gt;You're on the right track with merging arrays of entry IDs. And to keep the sort order with your new &lt;code&gt;craft.entries&lt;/code&gt; call there's in fact a method for that: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fixedOrder(true)&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-02T06:25:14.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8983" PostTypeId="2" ParentId="8978" CreationDate="2015-04-02T08:44:26.087" Score="9" Body="&lt;p&gt;This looks like a situation where you might get away with just using &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/default.html&quot;&gt;Twig's &lt;code&gt;default&lt;/code&gt; filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.metaTitle|default(title|default(siteName)) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works even with undefined or empty strings, and methods that don't exist on objects that might not be defined themselves.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-04-02T08:44:26.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8984" PostTypeId="1" CreationDate="2015-04-02T09:15:55.540" Score="3" ViewCount="1395" Body="&lt;p&gt;We use an automated deploy system when developing with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a deploy user &quot;deploy&quot; and a web server user &quot;www-data&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deploy is a member of the www-data group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our first few deployments went fine but when we hit the point where the system started deleting old version (15 or so in) we started getting errors where it couldn't delete the old files properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On examination folders created here - &lt;code&gt;/craft/storage/runtime/compiled_templates&lt;/code&gt; have the permission &lt;code&gt;drwxr-xr-x&lt;/code&gt; so only www-data can edit/write to them.  Is there anyway we can make this group writable when created rather than having to do a manual clean up?&lt;/p&gt;&#xA;" OwnerUserId="3488" LastEditorUserId="344" LastEditDate="2015-05-01T10:36:38.910" LastActivityDate="2015-05-01T10:36:38.910" Title="File Permissions on Compiled Templates" Tags="&lt;deployment&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8985" PostTypeId="1" CreationDate="2015-04-02T09:38:01.170" Score="1" ViewCount="159" Body="&lt;p&gt;Can it be that I have hit a limit for amount of admin users? I have only 6 now and I would like to add 3 more. But when I try to set a new one up, it cannot send the verification email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to resend verification, then an internal server error pops up with the message &quot;Could not instantiate mail function.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean my server is the issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any support is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;josh&lt;/p&gt;&#xA;" OwnerUserId="1071" LastEditorUserId="1098" LastEditDate="2015-04-02T17:40:16.700" LastActivityDate="2015-04-02T17:40:16.700" Title="I cannot create any more admin user accounts" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8986" PostTypeId="2" ParentId="8984" CreationDate="2015-04-02T11:04:23.720" Score="5" Body="&lt;p&gt;Normally folders in the /craft/storage/runtime/* directory are just cached files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those files are generated by craft, so really they're generated by php/php-fpm/nginx/apache or what ever you've got setup.&#xA;Maybe check the user that made those folders are in the www-data group if you do want to look into it further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The better solution is to completely ignore that folder... Those files do not need to be deployed at all. They're just cached files generated by Craft. So just ignore that directory from your repo completely.&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2015-04-02T11:04:23.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8987" PostTypeId="2" ParentId="8984" CreationDate="2015-04-02T11:40:48.603" Score="3" Body="&lt;p&gt;When Twig creates folders and files within the &lt;code&gt;runtime/compiled_templates&lt;/code&gt; folder, it will attempt to create them with &lt;code&gt;777&lt;/code&gt; and &lt;code&gt;666&lt;/code&gt; permissions, respectively. However it is restricted by the maximum permissions that server will allow it to use, which is &lt;code&gt;644&lt;/code&gt; by default (preventing files from being set with permissions that would allow them to be overwritten by another user group).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could theoretically work around this by &lt;a href=&quot;http://www.linuxnix.com/2011/12/umask-define-linuxunix.html&quot; rel=&quot;nofollow&quot;&gt;changing your server’s umask&lt;/a&gt;, but you’re probably better off keeping it set to &lt;code&gt;022&lt;/code&gt; and just avoiding deploying anything within the &lt;code&gt;runtime&lt;/code&gt; folder in the first place, since it’s &lt;a href=&quot;http://buildwithcraft.com/help/craft-storage-gitignore&quot; rel=&quot;nofollow&quot;&gt;not necessary&lt;/a&gt; to begin with.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-04-02T11:40:48.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8988" PostTypeId="1" CreationDate="2015-04-02T11:52:00.067" Score="6" ViewCount="854" Body="&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'submissions';&#xA;&#xA;// Loop&#xA;foreach ($criteria as $entry)&#xA;{&#xA;    echo $entry-&amp;gt;id.'&amp;lt;br /&amp;gt;';&#xA;    echo $entry-&amp;gt;title.'&amp;lt;br /&amp;gt;';&#xA;    echo $entry-&amp;gt;sport.'&amp;lt;br /&amp;gt;';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;sport&lt;/strong&gt; field is an Entry field, pointing to an entry in a different channel. My question is, how can I get the data from the related entry (i.e. the title) without an extra query per row? Can I eager load it? Or get the sport entries in a separate query and then combine the data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get the title of the related sport entry. The following works but gives an extra query for every row:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;sport-&amp;gt;first()['title'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="2298" LastActivityDate="2015-04-02T11:53:24.563" Title="Get related entry data within a plugin (ElementCriteriaModel) without extra queries" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8989" PostTypeId="2" ParentId="8988" CreationDate="2015-04-02T11:53:24.563" Score="5" Body="&lt;p&gt;I fixed this now by using the method buildElementsQuery, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria, $contentTable, $fieldColumns);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that, I was able to add custom joins to the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query&#xA;    -&amp;gt;addSelect('sport.title sportTitle')&#xA;    -&amp;gt;leftJoin('relations sportRelation', 'sportRelation.sourceId = elements.id AND sportRelation.fieldId = 71')&#xA;    -&amp;gt;leftJoin('content sport', 'sport.elementId = sportRelation.targetId')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gave me access to the data I need, without running extra queries. Thanks go out to Bob Olde Hampsink for showing me this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to hear though if there is a simpler way that won't require custom SQL, but for now this will do the trick.&lt;/p&gt;&#xA;" OwnerUserId="2298" LastActivityDate="2015-04-02T11:53:24.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8990" PostTypeId="2" ParentId="8960" CreationDate="2015-04-02T14:15:32.623" Score="2" Body="&lt;p&gt;Some inline styles which are missing in the default Redactor toolbar can easily be added by editing your &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor config file&lt;/a&gt; (→ craft/config/redactor/).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  buttons: ['bold', 'italic', 'deleted', 'underline']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;formattingAdd&lt;/code&gt; setting, to add custom styles to the format dropdown, seems to be unpredictable with inline styles (see my other answer). But I noticed that all default formatting styles in there are block type styles (&lt;code&gt;p&lt;/code&gt;, &lt;code&gt;h1&lt;/code&gt;, etc.) and I actually think it's good to keep them seperated from inline styles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my opinion inline styles should get their own buttons and that's why I just made this little plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Inline Styles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yKSCC.png&quot; alt=&quot;Redactor Inline Styles&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Redactor got updated to 10.0.9 with Craft 2.3.2642. This &lt;a href=&quot;http://imperavi.com/redactor/log/&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixes a bug&lt;/a&gt; that made it impossible to switch back to inactive state on inline styles. Yay!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-03T22:55:05.497" LastActivityDate="2015-04-03T22:55:05.497" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8991" PostTypeId="2" ParentId="8985" CreationDate="2015-04-02T15:54:54.307" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not instantiate mail function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That error means that the &lt;a href=&quot;https://php.net/manual/en/function.mail.php&quot; rel=&quot;nofollow&quot;&gt;PHP mail&lt;/a&gt; is not installed and/or configured for use on the server you're currently on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either configure that to properly work, or go under Settings-&gt;Email and choose another mail delivery option that does work for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-02T15:54:54.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8992" PostTypeId="1" AcceptedAnswerId="8999" CreationDate="2015-04-02T15:59:19.340" Score="3" ViewCount="2188" Body="&lt;p&gt;I'm trying to show live entries to user by selecting list of months in a dropdown. Some my entries are live for 2 or 3 months. I having trouble in finding right method. I have tried using &lt;strong&gt;after and before&lt;/strong&gt; but i think these work based on postdate of an entry. Correct me if i'm wrong. This all in template side.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2015-04-02T21:56:42.883" LastActivityDate="2016-10-30T21:04:00.120" Title="How to show entries which are live between dates regardless of postdate or expiry dates?" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8993" PostTypeId="2" ParentId="8992" CreationDate="2015-04-02T17:06:27.140" Score="3" Body="&lt;p&gt;For some ElementCriteriaModel parameters it is possible to define a range of possible values (→ &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;Parameter Value Syntax&lt;/a&gt;). In case of your dropdown field you should be able to filter your entries for value between 1 (January) and 3 (March) like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.myDropdownField('and, &amp;gt;= 1, &amp;lt;= 3') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also define a list of values like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.myDropdownField('or, 1, 2, 3') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-02T17:06:27.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8994" PostTypeId="1" CreationDate="2015-04-02T17:24:32.463" Score="2" ViewCount="307" Body="&lt;p&gt;I save image files from within my plugin through &lt;code&gt;assets-&amp;gt;insertFileByLocalPath()&lt;/code&gt;. &#xA;Unfortunately, i can't give the image title as paramter to the method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the easiest way to change the image title after insert, espacially considering different languages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, i found a solution (moved to the answer), but how do i save values for different languages?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2015-04-03T19:23:47.420" LastActivityDate="2015-04-03T19:25:20.427" Title="Change image title programatically?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8996" PostTypeId="1" AcceptedAnswerId="8997" CreationDate="2015-04-02T18:34:09.300" Score="1" ViewCount="101" Body="&lt;p&gt;I am just experimenting with plugin development and would like to use the existing &lt;a href=&quot;http://buildwithcraft.com/docs/date-time-fields&quot; rel=&quot;nofollow&quot;&gt;dateTime field type&lt;/a&gt;. For no other reason than to maintain consistency throughout my application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to call that field as a macro (for lack of better words) in my template or do I just view the generated source from one spot and copy/paste it into my templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-02T20:05:25.500" Title="Use default field type(s) within my plugin" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8997" PostTypeId="2" ParentId="8996" CreationDate="2015-04-02T20:05:25.500" Score="3" Body="&lt;p&gt;All the default field types are exposed as template &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macros&lt;/a&gt; in &lt;code&gt;/craft/app/templates/_includes/forms.html&lt;/code&gt;. Here's how you could easily create a DateTime input field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_includes/forms' as forms %}&#xA;&#xA;{{ forms.date( {&#xA;    id : 'myDateField',&#xA;    name : 'myDateField',&#xA;    value : myDate | default&#xA;} ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for the date field, &lt;code&gt;value&lt;/code&gt; needs to be a valid DateTime object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other input types – such as a plain text field – are created in a similar manner:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.text( {&#xA;    id: 'myTextField',&#xA;    name: 'myTextField',&#xA;    value : myValue | default,&#xA;    placeholder : 'My Placeholder',&#xA;} ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also note that as &lt;code&gt;_includes/forms&lt;/code&gt; is outside the frontend &lt;code&gt;templates&lt;/code&gt; folder, it will not be easily accessible outside the CP. If you want to include the form macros in a frontend template, see &lt;a href=&quot;https://craftcms.stackexchange.com/a/4844/1098&quot;&gt;the following SE thread&lt;/a&gt; – I'm partial to Mike Pepper's answer, myself.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-02T20:05:25.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8998" PostTypeId="1" CreationDate="2015-04-02T20:46:15.867" Score="5" ViewCount="1748" Body="&lt;p&gt;I need to link to a particular &lt;code&gt;#anchor&lt;/code&gt; on a page from within the WYSIWYG editor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I start by using &lt;em&gt;Link to Entry&lt;/em&gt; in the Rich Text editor, Redactor adds its own 'anchor' (with the same syntax as the Reference Tag for the entry page), and any additional anchors I add to the URL using the &lt;em&gt;Edit Source&lt;/em&gt; functionality are ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you suggest creating enabling users to create links to specific parts of Entry pages from within the Rich Text editor?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-01-22T01:16:41.767" Title="How to link to an anchor on an entry page from within Rich Text editor" Tags="&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8999" PostTypeId="2" ParentId="8992" CreationDate="2015-04-02T22:17:34.937" Score="4" Body="&lt;p&gt;&quot;Live&quot; is determined in part by &lt;code&gt;postDate&lt;/code&gt; and &lt;code&gt;expiryDate&lt;/code&gt; (in addition to &lt;code&gt;status&lt;/code&gt;), so not technically independent, but this may be what you're after. You would still use the technique described in Carlcs' answer, only that the criteria would be searching the entries using the month values passed to your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.param('startMonth') and craft.request.param('endMonth') %}&#xA;&#xA;    {% set startMonth = craft.request.param('startMonth') %}&#xA;    {% set endMonth = craft.request.param('endMonth') %}&#xA;    {% set startDate = now|date(Y) ~ '-' ~ startMonth %}&#xA;    {% set endDate = now|date(Y) ~ '-' ~ endMonth %}&#xA;&#xA;    {% set entries = craft.entries.section('mySectionHandle').postDate('and, &amp;gt;= ' ~ startDate ~ ', &amp;lt;= ' ~ endDate) %}&#xA;&#xA;    {% for entry in entries %}&#xA;    ...&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use &lt;code&gt;.after(starDate).before(endDate)&lt;/code&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; If you want to get entries that are live during a particular month range (rather than posted during the month range) then you could check for &lt;code&gt;postDate&lt;/code&gt; before the selected 'start month' and &lt;code&gt;expiryDate&lt;/code&gt; after the selected 'end month'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.param('startMonth') and craft.request.param('endMonth') %}&#xA;&#xA;    {% set startMonth = craft.request.param('startMonth') %}&#xA;    {% set endMonth = craft.request.param('endMonth') %}&#xA;    {% set startDate = now|date(Y) ~ '-' ~ startMonth %}&#xA;    {% set endDate = now|date(Y) ~ '-' ~ endMonth %}&#xA;&#xA;    {% set entries = craft.entries.section('mySectionHandle').postDate('&amp;lt;= ' ~ startDate).expiryDate('&amp;gt;= ' ~ endDate) %}&#xA;&#xA;    {% for entry in entries %}&#xA;    ...&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="141" LastEditDate="2016-10-30T21:04:00.120" LastActivityDate="2016-10-30T21:04:00.120" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9000" PostTypeId="1" AcceptedAnswerId="9001" CreationDate="2015-04-02T22:21:21.540" Score="2" ViewCount="201" Body="&lt;p&gt;I'm developing a sports league site. The roles I'm setting up are admins, coaches, and players - with myself being the &quot;super&quot; admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first Craft project, so right off the bat I started developing the site by distinguishing the capabilities of each role through the user groups. I'm currently having issues with registering coaches &amp;amp; players to their respective user groups through plugins, though.&#xA;No one other than myself will be using the Craft CP. I'll be creating their own back-end dashboard to manage their own teams, user profiles, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which leads me to the question: Should I even be designating the users to different user groups? Or just throw them into specific categories &amp;amp; check against those with the current logged user? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically they would have all the permissions through Craft, but I'd limit what they can accomplish through the dashboard I create for them.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="57" LastEditDate="2015-04-02T22:55:23.863" LastActivityDate="2015-04-02T22:55:30.787" Title="Could I use categories for users instead of user groups?" Tags="&lt;user-groups&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9001" PostTypeId="2" ParentId="9000" CreationDate="2015-04-02T22:55:30.787" Score="4" Body="&lt;p&gt;If the users will never have access to the Craft CP then you can use categories or any other applicable field type (i.e. dropdown, radio buttons, tags, etc.) to create differentiation between the users. It really just depends on how accessible and/or 'static' you want the groups or sudo-groups to be. Categories and tags for example can be created dynamically, without having field editing privileges like a drop-down field would require. But since you are currently the only admin, it probably won't make much difference in the end. I would however, at a minimum create groups that differentiate between users that have different access privileges to the CP, otherwise it's totally up to you — whatever makes most sense and is easiest to manage.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-02T22:55:30.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9002" PostTypeId="1" AcceptedAnswerId="9061" CreationDate="2015-04-02T22:59:56.063" Score="1" ViewCount="372" Body="&lt;p&gt;I have an array of products that has already been filtered by a brand category. I want to display them in a list ordered by a size category. This is working, but I think there must be a better way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productList = craft.entries(params) %} &#xA;  {# where params includes a relatedTo parameter already #}&#xA;&#xA;    {% for size in sizes %}&#xA;        {% for product in productList %}&#xA;            {% if product.sizeCategory.first.id == size.id %}&#xA;                {{ product.title }}&amp;lt;br /&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2191" LastEditorUserId="2191" LastEditDate="2015-04-06T20:45:56.227" LastActivityDate="2015-04-07T17:21:46.027" Title="Organize filtered entries by a specific category" Tags="&lt;templating&gt;&lt;categories&gt;&lt;sorting&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9003" PostTypeId="2" ParentId="9002" CreationDate="2015-04-02T23:40:59.183" Score="2" Body="&lt;p&gt;You should be able to order them using a combination of the &lt;code&gt;order&lt;/code&gt; method (if needed) and &lt;code&gt;group&lt;/code&gt; twig filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productList = craft.entries.(params).order('title')|group('myCategoriesField.first().title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem here is that the products might end up being displayed in the order that the size categories were created (i.e. postDate) and not the category 'size' title. If this is a problem then your solution may in fact be the only way. Have a look at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7194/order-entries-by-category-field&quot;&gt;this question&lt;/a&gt; for alternative answer and discussion of some of the issues.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-02T23:56:22.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9004" PostTypeId="2" ParentId="8998" CreationDate="2015-04-03T03:21:05.590" Score="1" Body="&lt;p&gt;This is more of a workaround than a truly official method. The &lt;code&gt;#entry:id&lt;/code&gt; you are seeing is more of a reference for Craft to figure out the correct URL when you edit the entry later. If you were to look at the link live, you would notice that the hash is missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workaround is to create a link to an entry. Then, either save and return or toggle &lt;code&gt;Edit Source&lt;/code&gt;. When you return, you can click on the link to find a tiny popup giving you the option to &lt;code&gt;Edit&lt;/code&gt; or &lt;code&gt;Unlink&lt;/code&gt;. When you edit, you can change the hash to anything you like. It should save just fine.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-04-03T03:21:05.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9005" PostTypeId="1" AcceptedAnswerId="15329" CreationDate="2015-04-03T04:30:06.247" Score="4" ViewCount="433" Body="&lt;p&gt;I'm trying to create a sitemap for a site with multiple locales.  An example of the format is described &lt;a href=&quot;https://support.google.com/webmasters/answer/2620865?hl=en&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, but as a quick summary: I need to output locales of related translated pages aside one another.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;url&amp;gt;&#xA;  &amp;lt;loc&amp;gt;http://www.example.com/english/&amp;lt;/loc&amp;gt;&#xA;  &amp;lt;xhtml:link&#xA;     rel=&quot;alternate&quot;&#xA;     hreflang=&quot;de&quot;&#xA;     href=&quot;http://www.example.com/deutsch/&quot;&#xA;     /&amp;gt;&#xA;  &amp;lt;xhtml:link &#xA;     rel=&quot;alternate&quot;&#xA;     hreflang=&quot;de-ch&quot;&#xA;     href=&quot;http://www.example.com/schweiz-deutsch/&quot;&#xA;     /&amp;gt;&#xA;  &amp;lt;xhtml:link &#xA;     rel=&quot;alternate&quot;&#xA;     hreflang=&quot;en&quot;&#xA;     href=&quot;http://www.example.com/english/&quot;&#xA;     /&amp;gt;&#xA;&amp;lt;/url&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To output a list of all entries like this I believe I need to query: &lt;em&gt;All entries, from all locales, grouped by elementId&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to do this using &lt;code&gt;$criteria-&amp;gt;find()&lt;/code&gt; but I seem to run into two problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, there appears to be no way to query all locales.  The best way I've found is to loop through all the locales.  I'm wondering if I'm overlooking something.  Right now I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach (craft()-&amp;gt;i18n-&amp;gt;getSiteLocales() as $locale)&#xA;{&#xA;  ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A potential problem with doing it this way is that I won't be able to group the results of all locales by &lt;code&gt;elementId&lt;/code&gt; during the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, once I have all the entries, I need to make sure they are grouped by &lt;code&gt;elementId&lt;/code&gt;.  This does not happen by default.  The entry for each locale just gets the next available ID when it's created.  It seems the way to do this would be to use &lt;code&gt;$criteria-&amp;gt;order = 'elementId';&lt;/code&gt; however, it doesn't appear Craft supports ordering a result set by &lt;code&gt;elementId&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ideal query would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria            = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;limit     = null;&#xA;$criteria-&amp;gt;status    = 'live';&#xA;$criteria-&amp;gt;sectionId = $sectionId;&#xA;&#xA;// Problem #1: I want to return all locales like you can return all entries using null&#xA;$criteria-&amp;gt;locale    = null; &#xA;&#xA;// Problem #2: I want to group my results by Element ID&#xA;$criteria-&amp;gt;order     = 'elementId';&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what the best approach would be here?  Is there any crafty way of doing this or will I have to resort to using a custom query?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-02T22:16:38.040" Title="How to create a query to group alternate language pages?" Tags="&lt;localization&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9006" PostTypeId="2" ParentId="8878" CreationDate="2015-04-03T08:18:14.443" Score="2" Body="&lt;p&gt;I've eventually tracked down this peculiar &lt;code&gt;ERR_EMPTY_RESPONSE&lt;/code&gt; to a php error buried deep in my apache logs - &lt;code&gt;zend_mm_heap corrupted&lt;/code&gt;. So as it turns out nothing to do with Capistrano (or Craft) at all! This &lt;code&gt;zend_mm_heap&lt;/code&gt; error is a php memory error that I seem to have solved by upgrading my version of PHP after unsuccessfully upping my &lt;code&gt;output_buffer&lt;/code&gt; as suggested in &lt;a href=&quot;https://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean&quot;&gt;this stackoverflow thread&lt;/a&gt;. It's worth noting that there was nothing in the Craft log about this error, no mention of anything untoward. The &lt;code&gt;Craft\HttpException&lt;/code&gt; I found above is, I believe, essentially a '404' error as my site was running in 'offline mode' so requests had to be run through &lt;code&gt;_enforceSystemStatusPermissions&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did initially have some issues with permissions with Capistrano where my server was setting new files created by craft to 644 www-data:www-data and therefore my user couldn't edit these files, despite being in the www-data group, and so Capistrano was having a hard time removing old releases. I've fixed this by adding a umask 002 to /etc/apache2/envvar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that the &lt;code&gt;zend_mm_heap&lt;/code&gt; error seems to be behaving, and my permissions are correct, deploying with Capistrano is working rather well. For future reference, my linked dirs config looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set :linked_dirs, %w{public/resources craft/config/local craft/storage}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public/resources&lt;/code&gt; is my (single) craft asset source, &lt;code&gt;craft/config/local&lt;/code&gt; are my server-specific config files as suggested &lt;a href=&quot;https://github.com/BarrelStrength/Craft-Multi-Environment-Config&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; which is working nicely for me. &lt;code&gt;craft/storage&lt;/code&gt; is obviously the craft storage folder that is shared between releases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of deployment, I think Capistrano (and other tools of a similar ilk) is great. I'm hosting my repository in a private BitBucket account and push new changes onto the master branch. I have two stages set up :production and :staging which deploy to two different vhosts on my server (staging domain is test.domain.com).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My stage configuration looks like this (for staging)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set :stage, :staging&#xA;&#xA;set :deploy_to, &quot;/var/www/domain-test&quot;&#xA;&#xA;# Allow user to define which branch to push, e.g.&#xA;# BRANCH=my-new-feature cap staging deploy&#xA;set :branch, ENV['BRANCH'] || &quot;staging&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This last line is really helpful if I want to quickly test something on the master branch without having to merge it into the staging branch and push and deploy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps someone who comes across a similar issue. If anyone wants more info about my Capistrano set up, let me know. I highly recommend it as a method of deployment, once you figure out your (inevitable and strange) server errors!&lt;/p&gt;&#xA;" OwnerUserId="3438" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-04-03T08:24:00.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9007" PostTypeId="1" CreationDate="2015-04-03T11:31:55.387" Score="0" ViewCount="138" Body="&lt;p&gt;My site is working fine with dukt videos on local and staging but I am getting an error on any page with a dukt video field. Error is on the front end and the dashboard.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Argument 1 passed to Composer\Autoload\ClassLoader::addClassMap() must be of the type array, integer given, called in /homepages/15/d322782150/htdocs/nailcote-craft/craft/plugins/videos/vendor/composer/autoload_real.php on line 38 and defined&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I've emailed support directly but in the meantime if anyone has come across this I would be glad of the help.&lt;/p&gt;&#xA;" OwnerUserId="3337" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-04-03T13:14:24.893" Title="Internal server error with Dukt video" Tags="&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9008" PostTypeId="2" ParentId="2562" CreationDate="2015-04-03T11:55:28.927" Score="2" Body="&lt;p&gt;In case you're still looking, have a look at &lt;a href=&quot;https://github.com/engram-design/Comments&quot; rel=&quot;nofollow&quot;&gt;Comments&lt;/a&gt;. Any suggestions/comments very welcome!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-04-03T11:55:28.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9009" PostTypeId="2" ParentId="7133" CreationDate="2015-04-03T11:59:11.077" Score="4" Body="&lt;p&gt;If you're looking for a more robust and easy-to-use solution, have a look at the &lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow&quot;&gt;CPNav&lt;/a&gt; plugin, which allows you to re-order, rename and hide menu items.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-04-03T11:59:11.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9010" PostTypeId="2" ParentId="3008" CreationDate="2015-04-03T12:03:41.100" Score="5" Body="&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; plugin. It's pretty similar to DataGrab and Importer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the README:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;h1&gt;Feed Me&lt;/h1&gt;&#xA;  &#xA;  &lt;p&gt;Feed Me is a Craft plugin to make it easy to import entries and entry data from XML, RSS, ATOM or JSON feeds. Feeds can be setup as a task in Craft's Control Panel, or called on-demand for use in your twig templates.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;A common use-case for this plugin is to consume external feeds (news, events), but can also be used as a once-off task for importing content when migrating from other sites.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/FeedMe/master/screenshots/main.png&quot; /&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;h2&gt;Features&lt;/h2&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Import data from XML, RSS, ATOM or JSON feeds.&lt;/li&gt;&#xA;  &lt;li&gt;Feeds are saved to allow easy re-processing on-demand, or to be used in a Cron job.&lt;/li&gt;&#xA;  &lt;li&gt;Map feed data to your entry fields. See Supported Fieldtypes.&lt;/li&gt;&#xA;  &lt;li&gt;Duplication handling - control what happens when feeds are processed again.&lt;/li&gt;&#xA;  &lt;li&gt;Uses Craft's Task service to process feeds in the background.&lt;/li&gt;&#xA;  &lt;li&gt;Database backups before each feed processing.&lt;/li&gt;&#xA;  &lt;li&gt;Troubleshoot feed processing issues with logs.&lt;/li&gt;&#xA;  &lt;li&gt;Grab feed data directly from your twig templates.&lt;/li&gt;&#xA;  &lt;li&gt;Craft 2.5 compatible.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclosure: I authored this free plugin. Let me know if I can be of assistance!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="5437" LastEditDate="2016-12-23T03:58:58.383" LastActivityDate="2016-12-23T03:58:58.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9011" PostTypeId="2" ParentId="9007" CreationDate="2015-04-03T13:14:24.893" Score="1" Body="&lt;p&gt;Fixed. I downloaded fresh copies of OAuth and Video plug-ins. Re-uploaded to server and it's all working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess something got missed or corrupted in the initial upload.&lt;/p&gt;&#xA;" OwnerUserId="3337" LastActivityDate="2015-04-03T13:14:24.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9012" PostTypeId="2" ParentId="8945" CreationDate="2015-04-03T13:26:19.363" Score="4" Body="&lt;p&gt;The request for the craft font needs to be rewritten, since the actual file is (usually) outside of the public web root. Usually, this will be handled by the location block in your nginx configuration that rewrites requests to index.php. After you added the location block that adds the CORS header, though, all requests for font files are processed by this block only (see &lt;a href=&quot;https://stackoverflow.com/questions/5238377/nginx-location-priority&quot;&gt;this thread&lt;/a&gt; for more on location priority). nginx only processes one location block pr request, it doesn't &quot;add them up&quot;. The best solution would probably be to make the location block for adding the CORS headers more specific, so that the regexp doesn't match the Craft fonts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example on what I did on a previous project where the fonts were inside my /assets folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* ^/assets/.*\.(?:eot|ttf|woff)$ {&#xA;   add_header Access-Control-Allow-Origin *;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-04-03T13:54:52.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9013" PostTypeId="1" CreationDate="2015-04-03T14:41:38.030" Score="1" ViewCount="279" Body="&lt;p&gt;I'm trying to launch a basic &quot;yiic migrate create BasicMe MyPlugin&quot;&lt;br&gt;&#xA;But every time the memory gets exhausted, whatever memory_limit I set (I even tried 8Gb).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Allowed memory size of 3279945728 bytes exhausted (tried to allocate 72 bytes) in /path/to/craft/app/framework/base/CComponent.php on line 266  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what's causing it ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2015-04-03T14:41:38.030" Title="Yiic migrate command not working (memory exhausted)" Tags="&lt;migration&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9014" PostTypeId="1" CreationDate="2015-04-03T15:39:44.663" Score="1" ViewCount="605" Body="&lt;p&gt;I'm writing a plugin to create users. The problem I'm having is when I create them Craft is automatically setting the user as &quot;active&quot;. I want them to be &quot;inactive&quot; so that I can then send a verification email. I've look through the code and there appears to be no way to Create a user using &lt;strong&gt;craft()-&gt;users-&gt;saveUser($user)&lt;/strong&gt; without having them always be active. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the admin panel I do have the &quot;Verify email addresses?&quot; option checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-03T18:01:33.880" Title="Creating users as inactive" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9015" PostTypeId="1" CreationDate="2015-04-03T17:05:12.503" Score="1" ViewCount="462" Body="&lt;p&gt;I have a fresh Craft install set up locally at mysite.craft.dev. I would like to start building out the features offered by the pro license, but when I click the &quot;Show me&quot; link in the footer, I get &quot;An unknown error occurred.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am seeing this error in craft.log: &#xA;&lt;code&gt;015/04/03 17:13:55 [error] [php] Cannot modify header information - headers already sent (/Users/aaron/Sites/mysite/craft/app/framework/web/CHttpRequest.php:1392)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In potentially related news, tasks do not seem to be behaving correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone ever experience this before? Any help is appreciated :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D5SKm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-03T17:15:24.460" LastActivityDate="2015-04-03T17:40:18.787" Title="Error when trying to test Craft Pro on .dev" Tags="&lt;install&gt;&lt;license&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9016" PostTypeId="2" ParentId="9015" CreationDate="2015-04-03T17:40:18.787" Score="4" Body="&lt;p&gt;I found a solution! I had my local environment setup with homebrew following &lt;a href=&quot;https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew&quot; rel=&quot;nofollow&quot;&gt;this article's instructions&lt;/a&gt;. After looking at the php error logs, I uncommented &lt;code&gt;always_populate_raw_post_data = -1&lt;/code&gt; in the php.ini file found in /usr/local/etc/php/5.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then restarted the brew services with &lt;code&gt;brew services restart php56&lt;/code&gt; (install brew services by tapping gapple/services with &lt;code&gt;brew tap gapple/services&lt;/code&gt;) and restarted apache with &lt;code&gt;apachectl restart&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That did the trick!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-03T17:40:18.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9017" PostTypeId="2" ParentId="8384" CreationDate="2015-04-03T17:41:58.740" Score="2" Body="&lt;p&gt;I was having a similar issue and found a solution that worked for my setup:  &lt;a href=&quot;https://craftcms.stackexchange.com/a/9016/831&quot;&gt;https://craftcms.stackexchange.com/a/9016/831&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-03T17:41:58.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9018" PostTypeId="2" ParentId="9014" CreationDate="2015-04-03T17:47:36.967" Score="2" Body="&lt;p&gt;Matt and I managed to work this out together. Seems like setting the &lt;code&gt;pending&lt;/code&gt; and &lt;code&gt;unverifiedEmail&lt;/code&gt; attributes on the userModel before saving the user does the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;pending = true;&#xA;$user-&amp;gt;unverifiedEmail = &quot;username@domain.com&quot;;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: Might also want to look into another syntax that I noticed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1425/how-to-add-link-an-entry-to-an-object-using-php&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;status = UserStatus::Pending;&#xA;$user-&amp;gt;email = &quot;username@domain.com&quot;;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-03T18:01:33.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9019" PostTypeId="2" ParentId="8945" CreationDate="2015-04-03T17:54:55.463" Score="1" Body="&lt;p&gt;André was right that the font-specific location block needed adjustment, and in this case the block specifically needed help figuring out how to process font files &lt;em&gt;outside&lt;/em&gt; the web root. Rather than adjust the rule to ignore Craft's fonts, we ended up adding &lt;code&gt;try_files $uri $uri/ @rewrites;&lt;/code&gt; after setting the response headers...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(otf|ttf|eot|woff)$ {&#xA;    add_header &quot;Access-Control-Allow-Origin&quot; &quot;$cors_permitted_domain&quot;;&#xA;    add_header 'Vary' 'Origin';&#xA;&#xA;    try_files $uri $uri/ @rewrites;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had lots of help getting here, but my understanding is that the location block processed the font request but wasn't properly serving Craft's control panel fonts because nginx locations need to cascade sufficiently for that to happen. As André noted, the font location block was matched for the request so it lost its ability to creatively serve assets that work fine in other &lt;code&gt;location&lt;/code&gt; blocks.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2015-04-03T17:54:55.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9020" PostTypeId="1" AcceptedAnswerId="9023" CreationDate="2015-04-03T18:54:15.577" Score="1" ViewCount="144" Body="&lt;p&gt;In control panel, specifically when displaying elements table under any section, postDate and expiryDate values are in relative format i.e. Today, Yesterday, Monday, Wednesday, ..etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I disable that and display them in dates only?&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2015-04-04T06:14:54.677" Title="How can I disable relative dates in elements index?" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9021" PostTypeId="2" ParentId="8994" CreationDate="2015-04-03T19:25:20.427" Score="1" Body="&lt;p&gt;Here's how i solved it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$criteria-&amp;gt;id = $assetId;&#xA;$elements = $criteria-&amp;gt;find();&#xA;$element[0]-&amp;gt;getContent()-&amp;gt;title = 'New Title';&#xA;craft()-&amp;gt;elements-&amp;gt;saveElement($element[0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-04-03T19:25:20.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9022" PostTypeId="2" ParentId="9020" CreationDate="2015-04-03T19:25:48.843" Score="1" Body="&lt;p&gt;Currently not possible as it's hard-coded into Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding as a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-03T19:25:48.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9023" PostTypeId="2" ParentId="9020" CreationDate="2015-04-03T21:40:13.567" Score="2" Body="&lt;p&gt;Until this feature get implemented, I think I'll go with the following workaround that I'm using right now.&#xA;It's based on  &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; hook where I reformat the date value to match the user locale preferences.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'postDate')&#xA;    {&#xA;        $localeData = craft()-&amp;gt;i18n-&amp;gt;getLocaleData(craft()-&amp;gt;language);&#xA;        $dateFormatter = $localeData-&amp;gt;getDateFormatter();&#xA;        $format = $dateFormatter-&amp;gt;getDatepickerPhpFormat();&#xA;        return ($entry-&amp;gt;postDate ? $entry-&amp;gt;postDate-&amp;gt;format($format) : '');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or simply&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'postDate')&#xA;    {&#xA;        return $entry-&amp;gt;postDate;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which will return the date in Y-m-d format regardless of locale.&lt;/p&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2015-04-04T06:14:54.677" LastActivityDate="2015-04-04T06:14:54.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9024" PostTypeId="1" CreationDate="2015-04-03T21:49:45.780" Score="0" ViewCount="386" Body="&lt;p&gt;I'm trying to use &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{entry.id}}&quot;&amp;gt;&lt;/code&gt; on a GuestEntries form. However, instead of editing the entry with the set ID, it creates a new post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? Or is this not possible with the GuestEntries plugin. &lt;/p&gt;&#xA;" OwnerUserId="3335" LastActivityDate="2016-03-08T15:17:34.380" Title="Can GuestEntries edit existing entries?" Tags="&lt;guest-entries&gt;&lt;guest&gt;&lt;plugin-guestentries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9025" PostTypeId="1" CreationDate="2015-04-03T21:55:26.457" Score="1" ViewCount="813" Body="&lt;p&gt;Is it possible to use the Mailgun SDK with Craft at this point?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, is it OK to just the composer autoloader as a second autoloader (I'm about to test it, I'm just curious whether it's kosher or there's a different way of doing it that doesn't involve writing another plugin)?&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="344" LastEditDate="2015-05-01T10:37:15.883" LastActivityDate="2015-08-23T01:27:00.290" Title="Using Mailgun with Craft" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9026" PostTypeId="2" ParentId="9024" CreationDate="2015-04-03T22:02:30.463" Score="1" Body="&lt;p&gt;Correct. It currently only allows for creating new entries, not editing existing ones.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-03T22:02:30.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9027" PostTypeId="1" AcceptedAnswerId="9040" CreationDate="2015-04-03T23:19:39.977" Score="2" ViewCount="424" Body="&lt;p&gt;I am attempting to populate a select input on my settings page for a plugin I am working on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;forms.selectField({&#xA;    'label': &quot;myLabel&quot;,&#xA;    'instructions': &quot;My Instructions&quot;|t,&#xA;    'required': true,&#xA;    'id': 'myInput',&#xA;    'name': 'myInput',&#xA;    'options': craft.myPlugin.settings.getOptions&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting the select to render, but it's just not getting any values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.myPlugin.settings.getOptions&lt;/code&gt; links to my variable file for my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginVariable.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getOptions()&#xA;{&#xA;    error_log(__FUNCTION__);  // Never gets executed&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought maybe I could just return a name|value array in my getOptions method. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array('one'=&amp;gt;'one', 'two' =&amp;gt;'two');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value(s) that this select will have are literally that easy and will never change. That's why I was going this route vs. a db lookup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get errors that the value needs to be a string, so I know I can't just have an array right in the settings file. Not exactly sure where to go from here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I &lt;em&gt;may&lt;/em&gt; have a solution, i'm curious if there is a better way though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    $options = array(&#xA;        '' =&amp;gt; 'Select',&#xA;        '1' =&amp;gt; '1',&#xA;        '2' =&amp;gt; '2',&#xA;        '3' =&amp;gt; '3',&#xA;        '4' =&amp;gt; '4',&#xA;        '5' =&amp;gt; '5',&#xA;        '6' =&amp;gt; '6',&#xA;        '7' =&amp;gt; '7',&#xA;        '8' =&amp;gt; '8',&#xA;    );&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render( 'myPlugin/_settings', array(&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;            'options' =&amp;gt; $options&#xA;        ) );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;forms.selectField({&#xA;    'label': &quot;myLabel&quot;,&#xA;    'instructions': &quot;My Instructions&quot;|t,&#xA;    'required': true,&#xA;    'id': 'myInput',&#xA;    'name': 'myInput',&#xA;    'options': options&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-04-04T01:34:57.697" LastActivityDate="2015-04-04T20:56:23.740" Title="Populate select input via static values on plugin settings page" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9028" PostTypeId="1" CreationDate="2015-04-04T02:18:57.043" Score="1" ViewCount="117" Body="&lt;p&gt;I am a site owner who's new to Craft and whose site is nearing completion. I now realize I would like to have multiple versions of text rotate through in the box on the top of my home page, rather than having one &quot;fixed&quot; paragraph of text that doesn't change, unless I change it manually. (Think of scrolling testimonials, even though I don't plan to use it for that ...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will this change in setup require major surgery on the developer's part, minor surgery, or just a simple plugin, for example? Or might this functionality be built into Craft already? What's the upper limit on how many chunks of text I can have cycle through for the viewer to see? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for your help and input!&lt;/p&gt;&#xA;" OwnerUserId="2200" LastActivityDate="2015-04-04T03:04:31.530" Title="How do I set up a section of text on my home page to rotate through, rather than stay static?" Tags="&lt;entries&gt;&lt;plugins&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9029" PostTypeId="1" CreationDate="2015-04-04T02:21:18.843" Score="1" ViewCount="1423" Body="&lt;p&gt;I'm currently developing some templates in Craft. My work flow is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; Make a change to the template file&#xA;&amp;gt; Save the file, which automatically loads to the server&#xA;&amp;gt; Reload a test page in a web browser&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;About half the time, and somewhat erratically the adjusted template does not load. Once it is not loading, no amount of browser reloading, clearing local caches etc will help. The only thing that I have been able to find that will consistently fix this is to go in CP Settings and clear the Compiled Template cache. Obviously this is a pain to do each time, and slows my development time considerably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I tried to set a Craft config of &lt;code&gt;'cache' =&amp;gt; false&lt;/code&gt;, because I read this advice somewhere, but I see it doesn't appear in the documentation, and it doesn't work. I've also tried  &lt;code&gt;'cacheDuration' =&amp;gt; 'PT1S'&lt;/code&gt; to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cacheMethod is set to Default. Craft version is current.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-04-04T14:42:16.297" Title="How can I keep the Compiled Templates from caching during development?" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9030" PostTypeId="2" ParentId="9028" CreationDate="2015-04-04T03:04:31.530" Score="3" Body="&lt;p&gt;This should be relatively simple to implement, although depending on how the page was designed may require reworking some of the existing page layout and css.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as craft is concerned the data could be stored in a few different ways; perhaps in a separate channel, table, or matrix field. Setting this up on the craft-side is trivial, and would not require any special plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end content could all be loaded when the template is initially rendered (by simply adding a few lines of code to the template), or loaded as needed using javascript and ajax (by creating a separate template used to render just the text segments as requested). Although if it's truly only text, I would opt for loading it all at once on initial page load. Transitions would normally be done using some fairly simple javascript and/or css transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There shouldn't be any technical limit on the number of items you could display; but there probably are some practical limits where it would start to get clumsy for one reason or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more specific code examples, please leave a comment, and I can add more detail.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-04T03:04:31.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9031" PostTypeId="2" ParentId="9029" CreationDate="2015-04-04T03:44:29.173" Score="1" Body="&lt;p&gt;If you're in &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, then Twig's compiled templates will be regenerated on every request.  Otherwise, they'll be regenerated when Twig sees that the source template's date modified timestamp has changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of PHP 5.5+, PHP's &lt;a href=&quot;https://php.net/manual/en/book.opcache.php&quot; rel=&quot;nofollow&quot;&gt;opCache&lt;/a&gt; is enabled by default, which might explain what you're seeing. If you're in development, you'll want to disable that to make sure PHP isn't doing any caching at the byte level.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-04T03:44:29.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9032" PostTypeId="1" AcceptedAnswerId="9042" CreationDate="2015-04-04T04:33:15.200" Score="3" ViewCount="1851" Body="&lt;p&gt;I have a search page. I can search either categories or entries using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;{% set categories = craft.categories.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have added quite a bit of content in each category i.e. what it's all about etc. and I would like this content returned like a standard search result going to the category URL (it works when I search categories only)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to merge the above two arrays &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = categories | merge (entries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that's obviously not how you do it because it throws a craft error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I guess I could return the results of one, and then the other, but I was hoping to have the score create a more sensible order of relevant results. &lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="250" LastEditDate="2015-04-04T08:13:32.673" LastActivityDate="2015-04-05T13:20:56.247" Title="How do I combine search for categories and entries into one set of search results?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;search&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9033" PostTypeId="1" CreationDate="2015-04-04T11:12:17.713" Score="6" ViewCount="1477" Body="&lt;p&gt;We are looking at Craft as our CMS but would love to be able to scale the installation across multiple Amazon EC2 instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can all assets uploaded to Craft be pushed to S3? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other data (eg sessions) that are stored on local storage that would likely cause a problem?&lt;/p&gt;&#xA;" OwnerUserId="3496" LastActivityDate="2015-06-08T11:19:02.260" Title="Can Craft easily be hosted across multiple servers?" Tags="&lt;server&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9034" PostTypeId="2" ParentId="9029" CreationDate="2015-04-04T14:42:16.297" Score="1" Body="&lt;p&gt;Maybe a proxy on your side or reverse proxy on server-side.&#xA;Try if adding a random number to the testpage address helps:&#xA;&lt;code&gt;/test-address?rand=27456&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could put a temp reload link in your testpage like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;#&quot; onclick=&quot;location.href=location.href+'?rnd='+Math.random()&quot;&amp;gt;Reload&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-04-04T14:42:16.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9035" PostTypeId="1" AcceptedAnswerId="9037" CreationDate="2015-04-04T15:19:47.980" Score="1" ViewCount="622" Body="&lt;p&gt;I want to display on entry view page, related entries to current tags.&#xA;So far, I came to displaying basic entry's object, but I don't know How to get in matrix field and pull the first image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are stored in &lt;code&gt;matrixFieldHandle&lt;/code&gt; -&gt; &lt;code&gt;blockTypeHandle&lt;/code&gt; -&gt; &lt;code&gt;imageFieldHandle&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For outputting related entries to current tags I use:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set ECM for related entries to current tags #}&#xA;{% set tag = entry.keywords %}&#xA;{% set relatedEntries = craft.entries.relatedTo(tag).id('not ' ~ entry.id).limit(8).find() %}&#xA;&#xA;&#xA;{% for entry in relatedEntries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-05T17:11:49.607" Title="Display first image from matrix field of a related entry to current tags" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9036" PostTypeId="1" CreationDate="2015-04-04T17:31:50.890" Score="1" ViewCount="4543" Body="&lt;p&gt;I’m creating an archive of news article entries. For that purpose, I’m trying to get a value from a dropdown (user-selected year and month) and then assign it to a pagination procedure that calls up all articles of that particular year and month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, from what I’ve read so far, you cannot pass a Javascript variable to Twig. Is there any other possibility of passing on user selection to Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;dropdown&quot; style=&quot;float:left;&quot;&amp;gt;&#xA;&amp;lt;button class=&quot;btn btn-default dropdown-toggle text-sans&quot; type=&quot;button&quot; id=&quot;selectYear&quot; data-toggle=&quot;dropdown&quot;&amp;gt;Year &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;&amp;lt;ul class=&quot;dropdown-menu text-sans&quot; role=&quot;menu&quot; aria-labelledby=&quot;selectYear&quot;&amp;gt;&#xA;    &amp;lt;li role=&quot;presentation&quot;&amp;gt;&amp;lt;a role=&quot;menuitem&quot; tabindex=&quot;-1&quot; href=&quot;#&quot;&amp;gt;2015&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li role=&quot;presentation&quot;&amp;gt;&amp;lt;a role=&quot;menuitem&quot; tabindex=&quot;-1&quot; href=&quot;#&quot;&amp;gt;2014&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;dropdown&quot; style=&quot;float:left; margin:0 0 0 10px;&quot;&amp;gt;&#xA;&amp;lt;button class=&quot;btn btn-default dropdown-toggle text-sans&quot; type=&quot;button&quot; id=&quot;selectMonth&quot; data-toggle=&quot;dropdown&quot;&amp;gt;Month &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;&amp;lt;ul class=&quot;dropdown-menu text-sans&quot; role=&quot;menu&quot; aria-labelledby=&quot;selectMonth&quot;&amp;gt;&#xA;    &amp;lt;li role=&quot;presentation&quot;&amp;gt;&amp;lt;a role=&quot;menuitem&quot; tabindex=&quot;-1&quot; href=&quot;#&quot;&amp;gt;January&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li role=&quot;presentation&quot;&amp;gt;&amp;lt;a role=&quot;menuitem&quot; tabindex=&quot;-1&quot; href=&quot;#&quot;&amp;gt;February&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    ...&#xA;    &amp;lt;li role=&quot;presentation&quot;&amp;gt;&amp;lt;a role=&quot;menuitem&quot; tabindex=&quot;-1&quot; href=&quot;#&quot;&amp;gt;December&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;$('select[id=&quot;selectYear&quot;]').change(function(){&#xA;    var e = document.getElementById(&quot;selectYear&quot;);&#xA;    var JSYEAR = e.options[e.selectedIndex].text;&#xA;})&#xA;$('select[id=&quot;selectMonth&quot;]').change(function(){&#xA;    var e = document.getElementById(&quot;selectMonth&quot;);&#xA;    var JSMONTH = e.options[e.selectedIndex].text;&#xA;})&#xA;&amp;lt;/script&amp;gt;&#xA;&#xA;{% set firstDayOfMonth = JSYEAR ~ &quot;-&quot; ~ JSMONTH ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth  = JSYEAR ~ &quot;-&quot; ~ JSMONTH ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;{% set thisMonthsEntries = craft.entries.section(category).postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;{% paginate thisMonthsEntries as pageEntries %}&#xA;   {% for date, articles in pageEntries | group(&quot;postDate|date('F Y')&quot;) %}&#xA;       ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3497" LastActivityDate="2015-04-04T23:23:45.700" Title="Get value from dropdown and use in Twig" Tags="&lt;templating&gt;&lt;pagination&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9037" PostTypeId="2" ParentId="9035" CreationDate="2015-04-04T17:33:38.600" Score="2" Body="&lt;p&gt;I think &lt;code&gt;entry.matrixFieldHandle.type('blockTypeHandle')&lt;/code&gt; is what you're looking for. Putting it together, it'd be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = entry.keywords %}&#xA;{% set relatedEntries = craft.entries.relatedTo(tag).id('not ' ~ entry.id).limit(8) %}&#xA;&#xA;{% for relatedEntry in relatedEntries %}&#xA;&#xA;    {% set matrixBlock = relatedEntry.matrixFieldHandle.type('blockTypeHandle').first() %}&#xA;&#xA;    {% if matrixBlock %}&#xA;&#xA;        {% set asset = matrixBlock.imageFieldHandle.first() %}&#xA;&#xA;        {% if asset %}&#xA;&#xA;            &amp;lt;h1&amp;gt;{{ relatedEntry.title }}&amp;lt;/h1&amp;gt;&#xA;            {{ asset.img }}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2015-04-05T17:11:49.607" LastActivityDate="2015-04-05T17:11:49.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9038" PostTypeId="2" ParentId="9033" CreationDate="2015-04-04T17:46:43.277" Score="5" Body="&lt;p&gt;Entirely possible. There is some discussion of having Craft installed in a load-balanced environment &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4719/load-balancing-nodes-configuration-3-craft-nodes-behind-f5-big-ip&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to have CRAFT_STORAGE_PATH point to a shared file system for all servers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have sticky sessions enabled at a load-balancer level, then PHP sessions won't be a problem.  If not, then you'll want to set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow noreferrer&quot;&gt;overridePhpSessionLocation&lt;/a&gt; to true and have the PHP session files saved on the same shared file system.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-04T17:46:43.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9039" PostTypeId="2" ParentId="7084" CreationDate="2015-04-04T19:42:24.117" Score="3" Body="&lt;p&gt;I've been able to modify the entry editing form by creating a plugin that will include some javascript into CP layout. Then with javascript, I use some checks to make sure that I'm in the right place before doing any adjustments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the following code, I checked if I'm editing an entry within section 32, then the label of postDate field will be changed, and also the expiryDate field will be hidden.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;    {&#xA;        $postDateLabel = JsonHelper::encode(Craft::t('Issue Date'));&#xA;&#xA;        $js = &amp;lt;&amp;lt;&amp;lt;EOT&#xA;&#xA;if (document.getElementById('entry-form')) {&#xA;    \$(function() {&#xA;        if ( \$('input[name=&quot;sectionId&quot;]').val() == 32 ) {&#xA;            \$('#postDate-field label').html($postDateLabel);&#xA;            \$('#expiryDate-field').addClass('hidden');&#xA;        }&#xA;    });&#xA;}&#xA;&#xA;EOT;&#xA;&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs($js);&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that is what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2015-04-04T19:42:24.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9040" PostTypeId="2" ParentId="9027" CreationDate="2015-04-04T20:56:23.740" Score="2" Body="&lt;p&gt;If your first attempt – using a variable method – failed, it was probably because you had the &quot;path&quot; to that variable method wrong. If your variable method is called &lt;code&gt;getOptions()&lt;/code&gt; and resides in a variable class called &lt;code&gt;MyPluginVariable&lt;/code&gt;, the path should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.myPlugin.getOptions&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;not&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.myPlugin.settings.getOptions&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyway, your current solution is fine. The ideal, &quot;Craft-y&quot; way to do stuff like this would probably be to keep the input options in a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1998/how-does-a-plugin-include-its-own-config-options&quot;&gt;plugin config file&lt;/a&gt; and use a service + variable method to expose the data to the template – but for such a simple case there's really no need to over-engineer things. If you have more fields/options later, or need the data to be dynamic or stored in a database, deal with it then. &lt;em&gt;Don't optimize too early.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I'd consider just hard coding the options in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;forms.selectField({&#xA;    'label': &quot;myLabel&quot;,&#xA;    'instructions': &quot;My Instructions&quot;|t,&#xA;    'required': true,&#xA;    'id': 'myInput',&#xA;    'name': 'myInput',&#xA;    'options': {&#xA;        '' : 'Select',&#xA;        1 : '1',&#xA;        2 : '2',&#xA;        ...&#xA;    }&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-04T20:56:23.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9041" PostTypeId="2" ParentId="9036" CreationDate="2015-04-04T22:22:47.120" Score="4" Body="&lt;p&gt;Twig (and all php) is processed server-side before javascript even gets initiated. And once the page renders in the browser there no way to interact directly with twig. The only two options that you have is to either 1) reload the page or 2) request a page segment via ajax. I would opt for the later in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, you could either listen for an &lt;code&gt;onClick()&lt;/code&gt; event on a submit button of some kind, or listen for &lt;code&gt;onChange()&lt;/code&gt; events on the drop-down menus themselves; which would trigger an ajax call to the server, and display the results in your placeholder 'div'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the craft side you would want to create a separate template that renders just the requested news articles, based on either: variables that you pass to the template via post; or using a custom route that you set up (i.e. '/news/2015/03/').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an example of creating a page template using custom routes and ajax to load entries based on date, &lt;a href=&quot;https://craftcms.stackexchange.com/a/5456/784&quot;&gt;see this example&lt;/a&gt;. You will need to adapt it slightly to only use the month and year (vs. month, day, year).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an ajax example, &lt;a href=&quot;https://craftcms.stackexchange.com/a/4528/784&quot;&gt;see this example&lt;/a&gt; — which links to additional examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a hard time putting the pieces together, leave a comment and I'll try and provide a more specific example.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-04T23:23:45.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9042" PostTypeId="2" ParentId="9032" CreationDate="2015-04-05T13:20:56.247" Score="5" Body="&lt;p&gt;The reason you're getting an error when trying to merge the two search results is that they are not technically arrays, but elementCriteriaModels. To convert them to actual arrays you would need to use the &lt;code&gt;find()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score').find() %}&#xA;{% set categories = craft.categories.search(query).order('score').find() %}&#xA;{% set results = categories|merge(entries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with this is that the sort order will be wrong (showing all categories and then all entries). Although you could potentially sort the results array using something like the &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot;&gt;supersort plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option to consider is redesigning the database so that there is nothing in categories that needed to be searched for, which might simplify things in the end.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-05T13:20:56.247" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9043" PostTypeId="1" AcceptedAnswerId="9045" CreationDate="2015-04-05T18:46:11.167" Score="2" ViewCount="1306" Body="&lt;p&gt;I need to implement Comet Chat, a facebook-chat-like third-party script, into my Craft project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comet Chat can connect to most CMS and PHP framework but there is no Craft integration yet, so I tried to use the &quot;custom coded site&quot; procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cometchat.com/documentation/installing-cometchat/custom-coded-site/php-site/&quot; rel=&quot;nofollow&quot;&gt;http://www.cometchat.com/documentation/installing-cometchat/custom-coded-site/php-site/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comet Chat need to access a session variable to authenticate user. Ex: $_SESSION['userid'].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: Craft write its session variables with some nice sorcelery that makes outside script unable to read it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the Comet Chat is not able to read the userid, even if I made a Craft plugin who writes UserID in $_SESSION['userid'].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried, by the Craft cookie ($_COOKIE values are bidirectionally accessible unlike $_SESSION values, of course) to find some relation or mechanism to tells Comet Chat who's the current user in Craft, unsuccessfuly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps some other PHP scripts or cases may need to read the Craft session, so I'm pretty sure this question can be relevant for more than Comet Chat integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3499" LastActivityDate="2015-10-14T03:27:21.957" Title="CometChat integration" Tags="&lt;users&gt;&lt;session&gt;&lt;usermodel&gt;&lt;current-user&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9044" PostTypeId="2" ParentId="9043" CreationDate="2015-04-05T20:43:24.180" Score="1" Body="&lt;p&gt;You can write a simple Craft plugin that listens for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onLogin&quot; rel=&quot;nofollow&quot;&gt;onLogin&lt;/a&gt; event, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('userSession.onLogin', function(Event $event)&#xA;    {&#xA;        $username=$event-&amp;gt;params['username'];&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($username);&#xA;        $_SESSION['userid'] = $user-&amp;gt;id;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you'll want to write to and read from &lt;code&gt;$_SESSION&lt;/code&gt; directly here instead of going through &lt;code&gt;craft()-&amp;gt;session-&amp;gt;add()&lt;/code&gt; because that will have to additional data hashing that your integration script would need to be aware of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft automatically renames what the PHP session cookie is called from the default &lt;code&gt;PHPSESSID&lt;/code&gt; to &lt;code&gt;CraftSessionId&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your Comet Chat integration script would have to use that same name before it calls &lt;code&gt;session_start()&lt;/code&gt;, otherwise it's going to create a new session cookie with the name &lt;code&gt;PHPSESSID&lt;/code&gt; that won't have your information in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this from your integration script should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!isset($_SESSION))&#xA;{&#xA;    session_name('CraftSessionId');&#xA;    session_start();&#xA;}&#xA;&#xA;if (isset($_SESSION['userId]))&#xA;{&#xA;    $userId = $_SESSION['userId'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-04-05T21:04:13.963" LastActivityDate="2015-04-05T21:04:13.963" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9045" PostTypeId="2" ParentId="9043" CreationDate="2015-04-05T20:43:57.073" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So, the Comet Chat is not able to read the userid, even if I made a Craft plugin who writes UserID in $_SESSION['userid'].&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To access Craft's session variables outside Craft, you need to pull the session ID from the &lt;code&gt;CraftSessionId&lt;/code&gt; cookie, and then use that to revive the session:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sessId = $_COOKIE[ 'CraftSessionId' ] ?: false;&#xA;&#xA;if ( $sessId ) {&#xA;&#xA;    session_id( $sessId );&#xA;    session_start();&#xA;&#xA;    var_dump( $_SESSION );&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The current user ID and username session variables will be named &lt;code&gt;__id&lt;/code&gt; and &lt;code&gt;__name&lt;/code&gt; respectively, but they'll be prefixed with a hash which isn't easily reconstructable outside of Craft (see the Yii class &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/3718e966808e5eb461b4ce42b17e24915af77aba/app/framework/web/auth/CWebUser.php&quot; rel=&quot;nofollow&quot;&gt;CWebUser&lt;/a&gt;, line 547).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To pull the current user's ID from session, that means you could either&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Write a Craft plugin, which sets your own session variable with the current user's ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$_SESSION[ 'craftUserId' ] = $currentUser ? $currentUser-&amp;gt;id : null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;b) ...or loop through the session variables and look for a key ending in &lt;code&gt;__id&lt;/code&gt;, with a valid integer value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftUserId = false;&#xA;&#xA;foreach ( $_SESSION as $key =&amp;gt; $value ) {&#xA;&#xA;    if ( substr( $key, -4 ) === '__id' &amp;amp;&amp;amp; ! is_nan( intval( $value ) ) ) {&#xA;        $craftUserId = $value;&#xA;        break;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Obviously, option a) is your safest bet, as you can never be 100% certain you won't have multiple keys ending in &lt;code&gt;__id&lt;/code&gt;, so if you're able to write a plugin to set your own session variable, that would best.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completions sake, here's what your CometChat &lt;code&gt;getUserId()&lt;/code&gt; method could look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getUserID() {&#xA;&#xA;    $userId = 0; // Return 0 if user is not logged in&#xA;&#xA;    $sessId = $_COOKIE[ 'CraftSessionId' ] ?: false;&#xA;&#xA;    if ( $sessId ) {&#xA;&#xA;        session_id( $sessId );&#xA;        session_start();&#xA;&#xA;        $userId = $_SESSION[ 'craftUserId' ] ?: 0;&#xA;&#xA;    }&#xA;&#xA;    return intval( $userId );&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-05T20:49:03.640" LastActivityDate="2015-04-05T20:49:03.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9046" PostTypeId="2" ParentId="9043" CreationDate="2015-04-05T21:17:27.757" Score="3" Body="&lt;p&gt;The Matt's answer was pretty complete and worked almost, but for the benefit of others, there is the changes required files to make it works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in integration.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;find&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('SET_SESSION_NAME','');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;change for&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('SET_SESSION_NAME','CraftSessionId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and make your getUserID functions look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getUserID() {&#xA;            $userId = 0; // Return 0 if user is not logged in&#xA;&#xA;            if ( $_SESSION[ 'craftUserId' ] ) &#xA;            {&#xA;                $userId = $_SESSION[ 'craftUserId' ]; // Set this session variable in a Craft plugin&#xA;            }&#xA;&#xA;            return intval( $userId );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in a Craft plugin, add this to a init() function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;    {            &#xA;        craft()-&amp;gt;on('userSession.onLogin', function(Event $event) {&#xA;            $currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;            craft()-&amp;gt;httpSession-&amp;gt;add( 'craftUserId', $currentUser ? $currentUser-&amp;gt;id : null );            &#xA;        });&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to be full-padded, you can also add something to unset your CraftUserId variable onLogout event, but I don't think it's needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot to Matt and Brad who helped me out on Easter day!&lt;/p&gt;&#xA;" OwnerUserId="3499" LastEditorUserId="3499" LastEditDate="2015-04-05T21:48:12.117" LastActivityDate="2015-04-05T21:48:12.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9047" PostTypeId="1" AcceptedAnswerId="9048" CreationDate="2015-04-06T09:33:58.580" Score="2" ViewCount="91" Body="&lt;p&gt;I've read &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#when-to-use-cache-tags&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; and it says, that We shouldn't use cache tags on static text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a files, that are static in that way, that the data are pulled from within a file, or in some case, data are pulled from outside a file, where &lt;code&gt;cache&lt;/code&gt; tags are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example - language and territory data, static navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within &lt;code&gt;cache&lt;/code&gt; tags I have pretty computationally statements and looping, where documentation says, that it's exception.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-06T09:57:03.523" Title="Should I use cache on data pulled from within files?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9048" PostTypeId="2" ParentId="9047" CreationDate="2015-04-06T09:57:03.523" Score="3" Body="&lt;p&gt;The reason the documentation says to not use it on static text, is because the cached data will be saved to the database, resulting in at least one database query (two if it needs to update the data). Database operations are fairly expensive compared to reading data from files, or running twig code, so in many cases this will be slower than just showing the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no way to know for sure if using &lt;code&gt;cache&lt;/code&gt; tags will be a benefit in your case. It really depends on what exactly you're doing in your template, and where the bottlenecks in your system is. The only way to know, is to test it. If you &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;turn devMode on&lt;/a&gt;, reload your page with and without the &lt;code&gt;cache&lt;/code&gt; tag enabled, you could compare the response time shown in the console output under &quot;Profiling Summary Report&quot;. This is the time it takes for the page to be generated by craft, which is what you'd seek to minimize using the &lt;code&gt;cache&lt;/code&gt; tag. Remember to reload the page several times for each case and do an average, since the result will vary somewhat depending on what else is going on in your system.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-04-06T09:57:03.523" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9049" PostTypeId="1" AcceptedAnswerId="9051" CreationDate="2015-04-06T15:16:55.447" Score="1" ViewCount="432" Body="&lt;p&gt;I want to ensure that any attempt to set a date attribute on a model by way of populateModel() or myModel-&gt;foo = 'bar' (basically any method of setting a value) is intercepted so I can set a default if the value isn't valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way, if you attempt to set a date prior to today (or a string that's not a date), I want to set the attribute to be today's date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm doing that in my populateModel() method but that doesn't catch the setAttribute('foo') approach or the myModel-&gt;foo approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in Laravel, we can create a setter method: setFooAttribute() so I was hoping for something similar.&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-04-06T15:39:53.890" LastActivityDate="2015-04-06T15:47:11.507" Title="Is there a way to define an attribute setter method on a model?" Tags="&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9050" PostTypeId="1" AcceptedAnswerId="9052" CreationDate="2015-04-06T15:38:42.323" Score="1" ViewCount="291" Body="&lt;p&gt;When editing an entry from the control panel you can switch versions of the entry. I would like to do the same thing but on the front end. Is there any way to do this using native craft functionality or do I need to use a plugin.&lt;/p&gt;&#xA;" OwnerUserId="3501" LastActivityDate="2015-04-06T17:35:33.750" Title="How can I display entry edit history on the front end?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9051" PostTypeId="2" ParentId="9049" CreationDate="2015-04-06T15:47:11.507" Score="2" Body="&lt;p&gt;In your model you can override &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseModel#setAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;setAttribute()&lt;/a&gt;, which covers calling &lt;code&gt;setAttribute('foo', 'bar')&lt;/code&gt; directly as well as &lt;code&gt;$model-&amp;gt;foo = 'bar'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function setAttribute($name, $value)&#xA;{&#xA;    if ($name == 'foo')&#xA;    {&#xA;        // Not sure if your value will be a dateTime object, string, etc.&#xA;        // But check to see if it's &amp;lt; than today's current date.  If so,&#xA;        // set $value = new DateTime();&#xA;    }&#xA;&#xA;    parent::setAttribute($name, $value)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-06T15:47:11.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9052" PostTypeId="2" ParentId="9050" CreationDate="2015-04-06T17:08:14.827" Score="2" Body="&lt;p&gt;Something like this might work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax %}&#xA;&#xA;    {% set versions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}&#xA;&#xA;    Versions: &#xA;    &amp;lt;select class=&quot;js-versions-dropdown&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;Current&amp;lt;/option&amp;gt;&#xA;        {% for versionEntry in versions %}&#xA;            &amp;lt;option value=&quot;{{ versionEntry.versionId }}&quot;&amp;gt;Version {{ loop.index }} ({{ versionEntry.postDate|date('m-d-Y') }} )&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;{% endif %}&#xA;&#xA;{% if craft.request.isAjax %}&#xA;&#xA;    {% if craft.request.param('versionid') %}&#xA;        {% set entry = craft.entryRevisions.getVersionById(craft.request.param('versionid')) %}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&#xA;&amp;lt;div&amp;gt;&#xA;    {{ entry.title }}&#xA;    ...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, you would want to listen for an &lt;code&gt;onChange&lt;/code&gt; event on the dropdown list and reload the template via ajax, passing the 'versionid' as a post variable. Alternatively you could also just reload the whole page, in which case remove the 'if ajax' stuff. In this case, you'll probably also need to add some logic to the drop-down list so as to display the correct 'selected' option in the list.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-06T17:35:33.750" LastActivityDate="2015-04-06T17:35:33.750" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9053" PostTypeId="1" AcceptedAnswerId="9057" CreationDate="2015-04-06T17:30:02.860" Score="0" ViewCount="660" Body="&lt;p&gt;I have a checkbox field that is populate with user choices.  I need to get the values they have selected from within a plugin. Here is my attempt. Not working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry  = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId, $localeId = null);&#xA;    foreach ($entry-&amp;gt;storyCategories-&amp;gt;options as $option) {&#xA;     var_dump($option);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can somebody please show me how to get these selected values?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-04-06T18:57:51.997" Title="Retrieving Checkbox Values from Plugin" Tags="&lt;plugin-development&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9054" PostTypeId="1" CreationDate="2015-04-06T17:36:39.983" Score="2" ViewCount="848" Body="&lt;p&gt;I'm working on a plugin to save user profile data. I have a matrix field called &lt;strong&gt;addressMatrix&lt;/strong&gt;, I've made address a matrix because users can save multiple addresses. Every address entry will have the following fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;streetAddress&lt;/li&gt;&#xA;&lt;li&gt;city&lt;/li&gt;&#xA;&lt;li&gt;stateProvince&lt;/li&gt;&#xA;&lt;li&gt;postalCode&lt;/li&gt;&#xA;&lt;li&gt;country&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;NOTE: I did associate the field with users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I want to do is to be able to save a new address or update an existing address for each user. I have no idea where to begin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at 1 or 2 Stack Exchange posts on the matter but it does not look like anyone else has raised this question. Sorry in advance... I have no code to post as I don't even have a solid starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help you can provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I have thus far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Load the user&#xA;$userModel = craft()-&amp;gt;users-&amp;gt;getUserById($profileDataModel-&amp;gt;userId);&#xA;&#xA;// Load the matrix field&#xA;$addressMatrix = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle(&quot;addressMatrix&quot;);&#xA;&#xA;$block = new MatrixBlockModel();&#xA;$block-&amp;gt;fieldId    = $addressMatrix-&amp;gt;id; // Matrix field's ID&#xA;$block-&amp;gt;ownerId    = $userModel-&amp;gt;id; // ID of entry the block should be added to&#xA;$block-&amp;gt;typeId     = 7; // ID of block type&#xA;&#xA;$block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'streetAddress' =&amp;gt; '1523 Kansas Ave'&#xA;));&#xA;&#xA;$success = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above does work, but what I'm current stumped on is how to get the type ID programmatically. I should be able to get a block ID by the block handle. Looking through the class reference I don't see it.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="57" LastEditDate="2015-04-06T19:40:59.533" LastActivityDate="2015-04-08T12:46:08.040" Title="Creating a matrix entry with a plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9056" PostTypeId="1" CreationDate="2015-04-06T18:29:24.753" Score="5" ViewCount="205" Body="&lt;p&gt;I have a plugin that has a few settings. One of which is a start date and and end date. Everything is set up and working fine. I'd like to validate the start/end dates a a bit though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to use &lt;code&gt;compare&lt;/code&gt; to check that the end isn't before the start, but I'd also like to check that the start (or end) isn't in the past as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-3-attribute-rules&quot;&gt;Using this awesome page on validation&lt;/a&gt; I've seen how to set custom validation via &lt;code&gt;rules&lt;/code&gt;. But, since I'm in a settings file, I'm not exactly sure how this translates over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;defineSettings(){&#xA;    return array(&#xA;        'myStartDate' =&amp;gt; array(&#xA;             AttributeType::DateTime,&#xA;             'required': true,&#xA;             'compare': '&amp;lt;= myEndDate'&#xA;         ),&#xA;         'myEndDate' =&amp;gt; array(&#xA;             AttributeType::DateTime,&#xA;             'required': true,&#xA;             'compare': '&amp;gt;= myStartDate'&#xA;         ),&#xA;    )&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I think I'm trying to get is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;'myStartDate' =&amp;gt; array(&#xA;     AttributeType::DateTime,&#xA;     'required': true,&#xA;     'something': array(&#xA;          'rule': myValidation,&#xA;          'message': 'The start date can not be after the finish date.'&#xA;      ) &#xA; )&#xA;....&#xA;&#xA;function myValidation() {&#xA;    // Do something here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, maybe I'm way off.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-06-21T22:19:21.397" Title="&quot;Custom&quot; validation for plugin settings page" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9057" PostTypeId="2" ParentId="9053" CreationDate="2015-04-06T18:50:32.680" Score="5" Body="&lt;p&gt;You can pull an array of all the options for a checkbox field by calling &lt;code&gt;getOptions()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$options = $entry-&amp;gt;storyCategories-&amp;gt;getOptions();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each option will be an object with three properties, &lt;code&gt;label&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;selected&lt;/code&gt;. To get all selected options for a field, you can loop through the options and test for the &lt;code&gt;selected&lt;/code&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$options = $entry-&amp;gt;storyCategories-&amp;gt;getOptions();&#xA;$selectedOptions = array();&#xA;foreach ( $options as $option ) {&#xA;    if ( $option-&amp;gt;selected ) {&#xA;        $selectedOptions[] = $option;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that this exact code will work for Dropdown, Multi-select and Radio button fields as well.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-06T18:57:51.997" LastActivityDate="2015-04-06T18:57:51.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9060" PostTypeId="1" AcceptedAnswerId="9078" CreationDate="2015-04-06T21:18:55.803" Score="2" ViewCount="216" Body="&lt;p&gt;In my plugin settings page, I have a startDate input which is a dateTime field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{&#xA;    forms.dateField({&#xA;     'label': 'Start Date'|t,&#xA;     'instructions': 'Choose a date'|t,&#xA;     'id': 'myStartDate',&#xA;     'name': 'myStartDate',&#xA;     'placeholder': 'mm/dd/yyyy',&#xA;     'value': settings.myStartDate,&#xA;     'errors': settings.getErrors('myStartDate')&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My data is getting saved correctly - I can see it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  ....&#xA;&quot;myStartDate&quot;: {&#xA;    &quot;date&quot;: &quot;2015-04-13 05:00:00&#xA;}&#xA;  ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I thought cool. I just need: &lt;code&gt;myStartDate.date&lt;/code&gt; and all is well. No luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is curious to me, is when I fill out my start date, but my form fails validation, the date that I have entered is correctly repopulated. I don't have to re-enter the date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, once I successfully submit my settings, and then come back, my date field is no longer populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;myStartDate&lt;/code&gt; and &lt;code&gt;myStartDate.date&lt;/code&gt; and &lt;code&gt;myStartDate|date(&quot;m/d/Y&quot;)&lt;/code&gt; but all with no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm abusing this community with so many questions lately. I know the dateTime field needs to be a dateTime object - and I assume that's why it's not working for me. I'm not passing it what it needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-07T20:00:26.327" Title="Repopulate dateTime field in plugin settings page" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9061" PostTypeId="2" ParentId="9002" CreationDate="2015-04-06T21:55:07.697" Score="2" Body="&lt;p&gt;First, grab the list of your products, filtered by category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productList = craft.entries(...).relatedTo(...) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Group all products by size using the &lt;code&gt;group&lt;/code&gt; filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productList = productList | group('sizeCategory.first.whatever')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have an array of arrays. The keys in the array hold the various values of the size variable, and the values of the array hold the arrays of entries within those size groups. (Within the groups, any ordering parameters you set on the original ElementCriteriaModel should be retained.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sort the groups according to the array size, you can use &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt;'s &lt;code&gt;ksort&lt;/code&gt; functionality:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productList = productList | supersort('ksort', false, SORT_NUMERIC) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To finish, just loop through this list of lists, outputting them in whatever style/markup you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for size, products in productList %}&#xA;&#xA;    {{ size }}&#xA;&#xA;    {% for product in products %}&#xA;&#xA;        {{ size }}&#xA;        {{ product.whatever }}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="2191" LastEditDate="2015-04-07T17:21:46.027" LastActivityDate="2015-04-07T17:21:46.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9062" PostTypeId="1" AcceptedAnswerId="9072" CreationDate="2015-04-06T22:02:50.813" Score="0" ViewCount="250" Body="&lt;p&gt;Whoo, that title is a mouthful...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to check against a unique school &quot;code&quot; that an athlete has to input to register with a team. The code is different based on what team they are trying to join (referenced in a segment of registration page URL). I have no idea what I'm doing when it comes to PHP or plugins but I hope I'm on the right track. I have no idea how to test what values my variables have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've essentially copied the &lt;code&gt;user/SaveUser&lt;/code&gt; controller into my own plugin (I have to place user in Athlete user group &amp;amp; related the specific team entry to user, hence custom plugin) and placed snippet below right before the &lt;code&gt;if (craft()-&amp;gt;users-&amp;gt;saveUser($user))&lt;/code&gt; line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$teamName = craft()-&amp;gt;request-&amp;gt;getPost('fields.teamName');&#xA;//Get team name, set in hidden input in form, which was grabbed from segment&#xA;&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'teams';&#xA;$criteria-&amp;gt;title   = $teamName;&#xA;$criteria-&amp;gt;limit   = 1;&#xA;$entry = $criteria-&amp;gt;first();&#xA;//Find the Team entry in my 'teams' section&#xA;&#xA;$schoolCode = $entry-&amp;gt;schoolCode;&#xA;//Place value of schoolCode field in variable&#xA;&#xA;$codeInput = craft()-&amp;gt;request-&amp;gt;getPost('fields.schoolCode');&#xA;//Grab user's input&#xA;&#xA;if ($schoolCode == $codeInput)&#xA;{ &#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is, of course, not working. I'm not getting any errors either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I anywhere close to doing this right?&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="57" LastEditDate="2015-04-07T02:17:08.330" LastActivityDate="2015-04-07T18:49:38.533" Title="Compare custom-field value of entry to registration-form field value before saving user" Tags="&lt;plugin-development&gt;&lt;registration&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9063" PostTypeId="2" ParentId="9054" CreationDate="2015-04-07T01:39:19.447" Score="2" Body="&lt;p&gt;Getting the block type id is not the easiest, as there can be more than one block and you don't necessarily have a block already defined in which to iterate over. In twig I was able to get to the blockType id by digging into the field layout using the following, which you should be able to adapt to php in your plugin. Not sure if there is an easier way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in entry.getFieldLayout().getFields() %}&#xA;    {% if field.getField().handle == &quot;myFieldHandle&quot; %}&#xA;        {% for blockType in field.getField().getFieldType().getSettings().getBlockTypes() %}&#xA;            {{ blockType.id }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The easiest would be to just hard-code the blockTypeId if that's an option.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-07T01:39:19.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9064" PostTypeId="2" ParentId="3089" CreationDate="2015-04-07T06:44:00.467" Score="3" Body="&lt;p&gt;If you want to use envVars as you would in the control panel i.e. &lt;code&gt;{baseUrl}&lt;/code&gt; but, in your templates, then check out the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-filterenvvar/&quot; rel=&quot;nofollow&quot;&gt;Filter Environment Variables&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Just apply the &lt;code&gt;envvar&lt;/code&gt; filter to your Twig variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myVar = '{baseUrl}/contact-us' %}&#xA;&#xA;{{ myVar | envvar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12" LastActivityDate="2015-04-07T06:44:00.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9065" PostTypeId="1" CreationDate="2015-04-07T07:13:07.157" Score="0" ViewCount="344" Body="&lt;p&gt;I am totally newbie in Craft CMS so don't be harsh to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While coming to my problem I am getting &lt;code&gt;Error : 404&lt;/code&gt; while installing Craft CMS on my local server &lt;code&gt;Linux Mint OS&lt;/code&gt; please someone guide me to install Craft CMS successfully on my local server,I followed below basic steps..&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Created db gave db details in &lt;code&gt;db.php&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Renamed &lt;code&gt;htaccess&lt;/code&gt; to &lt;code&gt;.htaccess&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My folder structure was &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/html/Craftdemo/craft and public&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My local server configured correctly and is working good enough to run&#xA;  my other sites like Wordpress/Magento and some JS files.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="3504" LastEditorUserId="3504" LastEditDate="2015-04-08T05:36:36.547" LastActivityDate="2015-04-08T05:36:36.547" Title="Installing Craft CMS on Linux Mint OS?" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9066" PostTypeId="1" AcceptedAnswerId="9070" CreationDate="2015-04-07T09:43:09.360" Score="0" ViewCount="679" Body="&lt;pre&gt;&lt;code&gt;public function saveGoal(Logic_GoalModel &amp;amp;$model)&#xA;{&#xA;    // New goal&#xA;    $isNewGoal = !$model-&amp;gt;id;&#xA;&#xA;    // Populate record&#xA;    $record = $this-&amp;gt;getGoalRecordById($model-&amp;gt;id);&#xA;    $record-&amp;gt;userId = $model-&amp;gt;userId;&#xA;    $record-&amp;gt;goal = $model-&amp;gt;goal;&#xA;    $record-&amp;gt;complete = $model-&amp;gt;complete;           &#xA;&#xA;    // Save record&#xA;    if($record-&amp;gt;save(false))&#xA;    {&#xA;        // Populate id&#xA;        if($isNewGoal)&#xA;        {&#xA;            $model-&amp;gt;id = $record-&amp;gt;id;&#xA;        }&#xA;&#xA;        return true;&#xA;    }&#xA;    else&#xA;    {&#xA;        return false;&#xA;    }&#xA;}&#xA;&#xA;private function getGoalRecordById($id = null)&#xA;{&#xA;    if($id)&#xA;    {&#xA;        $record = Logic_GoalRecord::model()-&amp;gt;findById($id);&#xA;&#xA;        if (!$record)&#xA;        {&#xA;            throw new Exception(Craft::t('No record exists with the ID “{id}”', array('id' =&amp;gt; $id)));&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        $record = new Logic_GoalRecord();&#xA;    }&#xA;&#xA;    return $record;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-07T16:42:24.833" Title="Is this the correct and safest way to update / save a new record?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9067" PostTypeId="2" ParentId="9065" CreationDate="2015-04-07T14:07:50.667" Score="1" Body="&lt;p&gt;Nobody is going to be harsh here, so don't worry. The Craft community is a nice place :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like the site root is not pointing to the Craft public accessible folder (the one with index.php). Can you open the URL to another file in the site root? Add a test.txt file for example and try to open it in your browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the .htaccess file: You are using apache, right? .htaccess doesn't work for nginx. Might sound obvious, but you wouldn't be the first to make this mistake. ;-)&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-04-07T14:07:50.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9068" PostTypeId="1" AcceptedAnswerId="9073" CreationDate="2015-04-07T16:05:05.620" Score="1" ViewCount="439" Body="&lt;p&gt;I have an API call to make that needs a particular format of data shown below. The &lt;strong&gt;person&lt;/strong&gt; and &lt;strong&gt;addresses&lt;/strong&gt; attributes are currently set as &lt;strong&gt;Mixed&lt;/strong&gt; &lt;em&gt;AttributeTypes&lt;/em&gt; and I'll need to create a manual validation method on the model to make sure they are correctly formatted and populated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$requestModel = Micros_GuestRegistrationRequestModel::populateModel([&#xA;    'username'  =&amp;gt; 'russ01@someemail.com',&#xA;    'password' =&amp;gt; 'secret',&#xA;    'person' =&amp;gt; [&#xA;        'firstName' =&amp;gt; 'Sammy',&#xA;        'lastName' =&amp;gt; 'Davis Junior'&#xA;    ], 'addresses' =&amp;gt; [&#xA;        [&#xA;            'line1' =&amp;gt; 'Any House',&#xA;            'line2' =&amp;gt; 'Any Road',&#xA;            'town' =&amp;gt; 'Anyville',&#xA;            'postcode' =&amp;gt; 'AB1 1AB',&#xA;            'country' =&amp;gt; 'GB',&#xA;            'stateCode' =&amp;gt; 'AL'&#xA;        ]&#xA;    ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm wondering is if &lt;strong&gt;person&lt;/strong&gt; and &lt;strong&gt;addresses&lt;/strong&gt; should be models in their own right, something like this for &lt;strong&gt;person&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$person = Micros_GuestPersonModel::populateModel([&#xA;    'firstName' =&amp;gt; 'Sammy',&#xA;    'lastName' =&amp;gt; 'Davis Junior'&#xA;]);&#xA;&#xA;$requestModel = Micros_GuestRegistrationRequestModel::populateModel([&#xA;    'username'  =&amp;gt; 'russ01@fuel-digital.com',&#xA;    'password' =&amp;gt; 'secret',&#xA;    'person' =&amp;gt; $person,&#xA;    'addresses' =&amp;gt; [&#xA;        [&#xA;            'line1' =&amp;gt; 'Any House',&#xA;            'line2' =&amp;gt; 'Any Road',&#xA;            'town' =&amp;gt; 'Anyville',&#xA;            'postcode' =&amp;gt; 'AB1 1AB',&#xA;            'country' =&amp;gt; 'GB',&#xA;            'stateCode' =&amp;gt; 'AL'&#xA;        ]&#xA;    ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't see a way to set a model attribute to be a particular class like &lt;em&gt;Micros_GuestPersonModel&lt;/em&gt;, so I guess I could pass in the array of data from it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$person = Micros_GuestPersonModel::populateModel([&#xA;    'firstName' =&amp;gt; 'Sammy',&#xA;    'lastName' =&amp;gt; 'Davis Junior'&#xA;]);&#xA;&#xA;$requestModel = Micros_GuestRegistrationRequestModel::populateModel([&#xA;    'username'  =&amp;gt; 'russ01@fuel-digital.com',&#xA;    'password' =&amp;gt; 'secret',&#xA;    'person' =&amp;gt; $person-&amp;gt;getAttributes(),&#xA;    'addresses' =&amp;gt; [&#xA;        [&#xA;            'line1' =&amp;gt; 'Any House',&#xA;            'line2' =&amp;gt; 'Any Road',&#xA;            'town' =&amp;gt; 'Anyville',&#xA;            'postcode' =&amp;gt; 'AB1 1AB',&#xA;            'country' =&amp;gt; 'GB',&#xA;            'stateCode' =&amp;gt; 'AL'&#xA;        ]&#xA;    ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anybody offer advice here on how best to approach this kind of model setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;==== EDIT =====&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my attempt at passing in a &lt;strong&gt;Micros_GuestPersonModel&lt;/strong&gt; and validating it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Class &lt;em&gt;Micros_GuestPersonModel&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Micros_GuestPersonModel extends BaseModel {&#xA;&#xA;    protected function defineAttributes ()&#xA;    {&#xA;        return [&#xA;            'firstName' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::String, 'required' =&amp;gt; TRUE&#xA;            ],&#xA;            'lastName' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::String, 'required' =&amp;gt; TRUE&#xA;            ]&#xA;        ];&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Class &lt;em&gt;Micros_GuestRegistrationRequestModel&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Micros_GuestRegistrationRequestModel extends BaseModel {&#xA;&#xA;    protected function defineAttributes ()&#xA;    {&#xA;        return [&#xA;            'username' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::Email, 'required' =&amp;gt; TRUE&#xA;            ],&#xA;            'password' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::String, 'required' =&amp;gt; TRUE&#xA;            ],&#xA;            'person' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::Mixed, 'required' =&amp;gt; TRUE&#xA;            ],&#xA;            'address' =&amp;gt; [&#xA;                'type' =&amp;gt; AttributeType::Mixed, 'required' =&amp;gt; TRUE&#xA;            ]&#xA;        ];&#xA;    }&#xA;&#xA;    public function rules ()&#xA;    {&#xA;        $rules = parent::rules();&#xA;&#xA;        $rules[] = [ 'person', 'validatePerson' ];&#xA;&#xA;        return $rules;&#xA;    }&#xA;&#xA;    public function validatePerson ($attribute)&#xA;    {&#xA;        if ( ! $this-&amp;gt;$attribute instanceof Micros_GuestPersonModel)&#xA;        {&#xA;            $this-&amp;gt;addError($attribute, &quot;Person should be an instance of Micros_GuestPersonModel&quot;);&#xA;&#xA;            return;&#xA;        }&#xA;&#xA;        if ( ! $this-&amp;gt;$attribute-&amp;gt;validate())&#xA;        {&#xA;            foreach ($this-&amp;gt;$attribute-&amp;gt;getErrors() as $errors)&#xA;            {&#xA;                foreach ($errors as $error)&#xA;                {&#xA;                    $this-&amp;gt;addError($attribute, $error);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And an example controller usage:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $person = Micros_GuestPersonModel::populateModel([&#xA;        'firstName' =&amp;gt; '', // invalid as this is required&#xA;        'lastName' =&amp;gt; 'Davis Junior'&#xA;    ]);&#xA;&#xA;    $requestModel = Micros_GuestRegistrationRequestModel::populateModel([&#xA;        'username'  =&amp;gt; 'russ01@fuel-digital.com',&#xA;        'password' =&amp;gt; 'secret',&#xA;        'person' =&amp;gt; $person,&#xA;        'addresses' =&amp;gt; [&#xA;            [&#xA;                'line1' =&amp;gt; 'Any House',&#xA;                'line2' =&amp;gt; 'Any Road',&#xA;                'town' =&amp;gt; 'Anyville',&#xA;                'postcode' =&amp;gt; 'AB1 1AB',&#xA;                'country' =&amp;gt; 'GB',&#xA;                'stateCode' =&amp;gt; 'AL'&#xA;            ]&#xA;        ]&#xA;    ]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can then capture the errors as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( ! $requestModel-&amp;gt;validate())&#xA;{&#xA;    Craft::dd($requestModel-&amp;gt;getErrors());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works, but is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2015-08-10T09:10:49.997" LastActivityDate="2015-08-10T09:10:49.997" Title="Is there a good way of setting a model attribute to be an instance of another model?" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9070" PostTypeId="2" ParentId="9066" CreationDate="2015-04-07T16:42:24.833" Score="1" Body="&lt;p&gt;It is definitely &lt;em&gt;a&lt;/em&gt; way to save record. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to be more explicit with validation, though.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($record-&amp;gt;validate())&#xA;{&#xA;    // Save record&#xA;    if ($record-&amp;gt;save(false))&#xA;    {&#xA;        // Populate id&#xA;        if($isNewGoal)&#xA;        {&#xA;            $model-&amp;gt;id = $record-&amp;gt;id;&#xA;        }&#xA;&#xA;        return true;&#xA;    }&#xA;    else&#xA;    {&#xA;        return false;&#xA;    }&#xA;}&#xA;else&#xA;{&#xA;    $model-&amp;gt;addErrors($record-&amp;gt;getErrors());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-07T16:42:24.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9071" PostTypeId="1" AcceptedAnswerId="9079" CreationDate="2015-04-07T18:38:05.400" Score="7" ViewCount="16844" Body="&lt;p&gt;I have the following code which works fine. I'm just wondering if there is a more simple way of incrementing the id number?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set counter = '1' %}&#xA;{% for block in entry.news %}&#xA;  {% if block.type == &quot;bodyBlock&quot; %}&#xA;    {{ block.body }}&#xA;  {% elseif block.type == &quot;codeBlock&quot; %}&#xA;  {% set counter = counter + 1%}&#xA;    &amp;lt;div id=&quot;accordion{{ counter }}&quot;&amp;gt;&#xA;    ...&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2016-06-21T19:57:44.020" Title="What's the best way to increment a number of a class or id?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9072" PostTypeId="2" ParentId="9062" CreationDate="2015-04-07T18:49:38.533" Score="1" Body="&lt;p&gt;Thanks to Brad Bell, I was able to troubleshoot using &lt;code&gt;var_dump&lt;/code&gt;. The code above works correctly, but I'm unaware of how to do a simple validation of the code within the controller, w/o creating a new model, &amp;amp; send back a response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead (for simplicity on my end), when the validation fails, I redirected to an error specific page, referencing the code entered &amp;amp; team name.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-04-07T18:49:38.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9073" PostTypeId="2" ParentId="9068" CreationDate="2015-04-07T18:57:10.087" Score="2" Body="&lt;p&gt;In your &lt;code&gt;Micros_GuestRegistrationRequestModel&lt;/code&gt;'s attribute definition, if you define &lt;code&gt;person&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'person' =&amp;gt; array(AttributeType::Mixed, 'model' =&amp;gt; 'Micros_GuestPersonModel');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft should take care of ensuring &lt;code&gt;person&lt;/code&gt; will be an instance of &lt;code&gt;Micros_GuestPersonModel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-07T18:57:10.087" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9075" PostTypeId="1" AcceptedAnswerId="9076" CreationDate="2015-04-07T19:32:17.073" Score="1" ViewCount="2411" Body="&lt;p&gt;I´m having problems loading css files in some templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi have this to load css files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile &quot;assets/html/css/reset.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/css/general.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/css/typography.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/css/layout.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/css/formStyle.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/rs-plugin/css/settings.css&quot; %}&#xA;{% includeCssFile &quot;assets/html/css/slidestyle.css&quot; %}&#xA;{{ getHeadHtml() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This follows this path: &lt;a href=&quot;http://localhost/craft/assets/html/css/filename.css&quot; rel=&quot;nofollow&quot;&gt;http://localhost/craft/assets/html/css/filename.css&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works great , and load the styles for example, in the news section.&#xA;But, when i go to que news detail section, the styles don´t show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The news detail template extends the template layout used for the home page and other sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page looks for styles in this path: &lt;a href=&quot;http://localhost/craft/&quot; rel=&quot;nofollow&quot;&gt;http://localhost/craft/&lt;/a&gt;&lt;strong&gt;news&lt;/strong&gt;/assets/html/css/filename.css   and of course don´t find it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try with routes ( don´t know exacly how it works , but try and didn´t work ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. Sebastian.&lt;/p&gt;&#xA;" OwnerUserId="3505" LastActivityDate="2015-04-07T19:47:30.637" Title="Problem loading css files in some templates" Tags="&lt;css&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9076" PostTypeId="2" ParentId="9075" CreationDate="2015-04-07T19:40:33.110" Score="3" Body="&lt;p&gt;You will want to include the &lt;code&gt;siteUrl&lt;/code&gt; variable before the file path to normalize all the resource URLs. That will also help when you move to production. For example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile siteUrl~'assets/html/css/slidestyle.css' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your general config file, you can set different site URLs based on the server you are on.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(),&#xA;&#xA;    'localhost =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'siteUrl' =&amp;gt; 'http://localhost/craft/'&#xA;    ),&#xA;    'yourProductionDomain.com' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; false,&#xA;        'siteUrl' =&amp;gt; 'http://www.yourProductionDomain.com'    &#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-07T19:47:30.637" LastActivityDate="2015-04-07T19:47:30.637" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9077" PostTypeId="2" ParentId="9071" CreationDate="2015-04-07T19:58:00.710" Score="2" Body="&lt;p&gt;There is no simple &lt;code&gt;counter++&lt;/code&gt; in twig, so your solution is a good way to handle this. What are you trying to do with the counter variable? There are other functions in twig like &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/cycle.html&quot; rel=&quot;nofollow&quot;&gt;cycle&lt;/a&gt; that are often useful in these situations.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-07T19:58:00.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9078" PostTypeId="2" ParentId="9060" CreationDate="2015-04-07T20:00:26.327" Score="2" Body="&lt;p&gt;Long story short, this is a bug in Craft 2.x that's already been fixed in the Craft 3.x branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering there is a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8348/how-do-i-save-a-plugins-date-settings-field/8358&quot;&gt;workaround&lt;/a&gt; for 2.x and the proper fix would be pretty ugly in 2, we're just going to let this one die a slow death with the release of Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-04-07T20:00:26.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9079" PostTypeId="2" ParentId="9071" CreationDate="2015-04-07T20:14:56.467" Score="14" Body="&lt;p&gt;By using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/default.html&quot;&gt;&lt;em&gt;default&lt;/em&gt; filter&lt;/a&gt; you can get away with a single line of Twig to set &lt;em&gt;and&lt;/em&gt; increment the counter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.news %}&#xA;    {% if block.type == &quot;bodyBlock&quot; %}&#xA;        {{ block.body }}&#xA;    {% elseif block.type == &quot;codeBlock&quot; %}&#xA;        {% set counter = ( counter | default(0) ) + 1 %}&#xA;        &amp;lt;div id=&quot;accordion{{ counter }}&quot;&amp;gt;&#xA;            ...&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, I'm guessing you need the accordion elements to be chronologically numbered, but if you &lt;em&gt;don't&lt;/em&gt;, you can use the &lt;code&gt;index&lt;/code&gt; property of the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot;&gt;loop variable&lt;/a&gt;, which is available inside the &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.news %}&#xA;    {% if block.type == &quot;bodyBlock&quot; %}&#xA;        {{ block.body }}&#xA;    {% elseif block.type == &quot;codeBlock&quot; %}&#xA;        &amp;lt;div id=&quot;accordion{{ loop.index }}&quot;&amp;gt;&#xA;            ...&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-07T20:28:21.300" LastActivityDate="2015-04-07T20:28:21.300" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9080" PostTypeId="1" CreationDate="2015-04-08T04:06:42.660" Score="4" ViewCount="310" Body="&lt;p&gt;Question is&#xA;what table can't achieve, can be achieve by matrix but problem is matrix cannot have default row value like table have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway to achieve it?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="768" LastEditorUserId="125" LastEditDate="2015-04-08T14:03:22.983" LastActivityDate="2015-04-08T14:03:22.983" Title="Setup default Matrix blocks and default values for sub-fields?" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9081" PostTypeId="1" AcceptedAnswerId="9083" CreationDate="2015-04-08T05:15:02.787" Score="11" ViewCount="3824" Body="&lt;p&gt;I would like to be able to filter my entries list by multiple categories on the front end. For example, if I first click a category button &quot;lunge&quot; then the results would show entries which are categorized as &quot;lunge&quot;.  If I click a second category button labeled &quot;dumbbell&quot; then the results would be filtered more and show only entries that are categorized as both &quot;lunge&quot; and &quot;dumbbell&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some similar threads but haven't been able to get the suggestions to work for me.  I believe I need to pass the categories into a URL query string like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;www.website.com/training/exercise-list?q=lunge,dumbbell&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;q&lt;/code&gt; is my search query parameter and &lt;code&gt;lunge&lt;/code&gt; and &lt;code&gt;dumbbell&lt;/code&gt; are the categories that were clicked.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Section is called &lt;code&gt;exercisesDb&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Group is called&lt;code&gt;trainingCategoryGroup&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Field in the section is called&#xA;&lt;code&gt;trainingCategory&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks so much!&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2019-10-14T22:52:59.957" Title="How to filter entries by clicking multiple categories on front end" Tags="&lt;categories&gt;&lt;search&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="9082" PostTypeId="1" CreationDate="2015-04-08T05:36:50.353" Score="4" ViewCount="2250" Body="&lt;p&gt;I'm building a travel site containing Campaigns (entries)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of these campaigns has multiple travel dates, modelled by a matrix field of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[startDate, endDate, price]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to do the following searches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Campaigns with a travel startDate next month&lt;/li&gt;&#xA;&lt;li&gt;Campaigns whose duration is more than 30 days and less than 60 days (endDate-startDate)&lt;/li&gt;&#xA;&lt;li&gt;One of those criteria&lt;/li&gt;&#xA;&lt;li&gt;All of the above criteria&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can this be achieved with twig template or custom controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I looked into &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;noreferrer&quot;&gt;relations&lt;/a&gt; but that only applies to &lt;code&gt;entries&lt;/code&gt; field, not matrix, and neither does it allow filtering on the related entity.&lt;/p&gt;&#xA;" OwnerUserId="3508" LastEditorUserId="3508" LastEditDate="2015-04-08T06:14:58.053" LastActivityDate="2015-06-09T17:09:42.933" Title="Search for entries with matrix field's value" Tags="&lt;matrix&gt;&lt;field&gt;&lt;search&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9083" PostTypeId="2" ParentId="9081" CreationDate="2015-04-08T07:18:44.190" Score="10" Body="&lt;p&gt;First, I would use something like &lt;code&gt;training&lt;/code&gt; in your query string. It's a little more readable and you aren't searching for the words &lt;code&gt;lunge&lt;/code&gt; and &lt;code&gt;dumbbell&lt;/code&gt; &lt;em&gt;anywhere&lt;/em&gt; in those entries, just entries related to those category slugs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# First you would find any training categories in the URL query string. #}&#xA;{% set trainingQuery = craft.request.getParam('training') %}&#xA;&#xA;{# Then find categories that match the slugs in your query string. #}&#xA;{% set trainingCategories = craft.categories.group('trainingCategoryGroup').slug(trainingQuery) %}&#xA;&#xA;{# setup your search parameters #}&#xA;{% set searchParams = {&#xA;  relatedTo:  trainingCategories,&#xA;  section: 'exercisesDb'&#xA;} %}&#xA;&#xA;{# Find your entries #}&#xA;{% set entries = craft.entries(searchParams).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your search form just needs to have the checkbox's input name as &lt;code&gt;training[]&lt;/code&gt;. If it's on the same page, test to see if the category slug is in the &lt;code&gt;trainingQuery&lt;/code&gt; array so it can be marked as &lt;code&gt;checked&lt;/code&gt; or not.&#xA;Create this by finding all the categories in the &lt;code&gt;trainingCategoryGroup&lt;/code&gt; group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;http://www.website.com/training/exercise-list&quot;&amp;gt;  &#xA;&#xA;  {% for category in craft.categories.group('trainingCategoryGroup') %}&#xA;    &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;training[]&quot; value=&quot;{{ category.slug }}&quot; {{ category.slug in trainingQuery ? 'checked'}}&amp;gt;{{ category.title }}&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;  &#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then output your list of entries. This is a simple example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries | length %}&#xA;  &amp;lt;ol&amp;gt;&#xA;    {% for entry in entries %}&#xA;      &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ol&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;No results&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the query string is blank, this will show all of your entries. If you want to restrict that, you can wrap the previous code block in this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if trainingQuery %}&#xA;  ... (entries) ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is an &lt;strong&gt;inclusive&lt;/strong&gt; search that will match entries in ANY selected categories. If you want an &lt;strong&gt;exclusive&lt;/strong&gt; search instead (category AND category), you have to do it a little differently.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get search parameters from the URL query string #}&#xA;{% set trainingQuery = craft.request.getParam('training') %}&#xA;&#xA;{# Start an array of search parameters (relationParam) with 'and' to match ALL categories #}&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{# Find categories that match the slugs in your query string... #}&#xA;{% for querySlug in trainingQuery %}&#xA;  {% set trainingCategory = craft.categories.group('trainingCategoryGroup').slug(querySlug) %}&#xA;&#xA;  {# And merge them into the relationParam array. #}&#xA;  {% set relationParam = relationParam|merge([{ targetElement: trainingCategory }]) %}&#xA;{% endfor %}&#xA;&#xA;{# Avoid passing an array with `['and']` only #}&#xA;{% if relationParam|length &amp;lt; 2 %}&#xA;  {% set relationParam = '' %}&#xA;{% endif %}&#xA;&#xA;{% set searchParams = {&#xA;  relatedTo:  relationParam,&#xA;  section: 'exercisesDb'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-04-11T08:56:44.953" LastActivityDate="2015-04-11T08:56:44.953" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="9084" PostTypeId="2" ParentId="9054" CreationDate="2015-04-08T12:46:08.040" Score="3" Body="&lt;p&gt;In case anyone is interested this is how I solved the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First load the matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$addressMatrix = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle(&quot;addressMatrix&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then get all of the blocks of the matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$addressMatrixBlocks = craft()-&amp;gt;matrix-&amp;gt;getBlockTypesByFieldId($addressMatrix-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next iterate over the blocks looking for a specific handle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($addressMatrixBlocks as $key =&amp;gt; $data){ &#xA;&#xA;    if($data-&amp;gt;handle === &quot;address&quot;){ &#xA;&#xA;    $addressBlock = $data; &#xA;    break; &#xA;&#xA;    }; &#xA;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have your block. To get the ID just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo $addressBlock-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-08T12:46:08.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9085" PostTypeId="2" ParentId="9082" CreationDate="2015-04-08T13:26:24.033" Score="2" Body="&lt;p&gt;Yeah you are probably better off putting the startDate, endDate, and price in non matrix fields.  But if you don't something like this should probably work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get your list of entries (you probably don't want to start with all  entries, this is just an example #}&#xA;{% for entry in entries %}&#xA;    {# get the matrix field you want to sort things with #}&#xA;    {% for block in entry.yourTravelMatrix %}&#xA;        {# get the matrix block by type #}&#xA;        {% if block.type == &quot;startDateBlock&quot; %}&#xA;            {# set a variable to be the date in the field  #}&#xA;            {% set startDateVariable = block.startDateField %}&#xA;            {# use the variable to filter the entries #}&#xA;            {% if startDateVariable &amp;gt;= (now | date_modify(&quot;+1 months&quot;) %}&#xA;                {# whatever data you want to show from the entries #}&#xA;                {{ entry.title }}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll probably have to adjust it a bit since dateTime fields are different than plain text fields.  There may be a better way to filter by a Matrix field.  Filtering by fields that aren't in a matrix is a lot easier.  This should basically work though.&lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="125" LastEditDate="2015-04-08T13:45:56.667" LastActivityDate="2015-04-08T13:45:56.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9086" PostTypeId="1" CreationDate="2015-04-08T13:39:29.807" Score="1" ViewCount="131" Body="&lt;p&gt;for the last few hours im trying to come up with a way to use the craft field select in combination with SOLR, all my entries are in solr and i i want to keep using that. ive made it so that solr can populate the baseModels so that isnt an issue, problem is i dont know how i can get the ID's of the solr entry's being saved by craft. and retrieved trough solr when called upon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3482" LastActivityDate="2015-04-08T13:39:29.807" Title="FieldElement Solr" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;&lt;baseelementmodel&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9087" PostTypeId="2" ParentId="9080" CreationDate="2015-04-08T13:59:36.250" Score="5" Body="&lt;p&gt;It's not possible to have default values for most field types and it is also not possible to have default matrix block already added to your new entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there was &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;noreferrer&quot;&gt;an event&lt;/a&gt; that gets raised before an entry is displayed in the Control Panel's &quot;Edit Entry&quot; view, you could set default values rather easily with a custom business logic plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no such event available yet, but you could vote for the feature request I just added:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7494886-raise-an-event-before-entry-is-edited-loaded-in-cp&quot; rel=&quot;noreferrer&quot;&gt;Raise an event before entry is edited/loaded in CP&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-08T13:59:36.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9088" PostTypeId="2" ParentId="2769" CreationDate="2015-04-08T14:24:55.643" Score="2" Body="&lt;p&gt;I just submitted a feature request to have an &lt;code&gt;entries.onBeforeEditEntry&lt;/code&gt; event. This should make it possible to have default values for all sort of field types from a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7494886-raise-an-event-before-entry-is-edited-loaded-in-cp&quot; rel=&quot;nofollow&quot;&gt;Raise an event before entry is edited/loaded in CP&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-08T14:24:55.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9089" PostTypeId="1" CreationDate="2015-04-08T14:39:28.037" Score="2" ViewCount="306" Body="&lt;p&gt;I have a site we are importing into Craft (using &lt;a href=&quot;https://github.com/boboldehampsink/import/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/import/&lt;/a&gt;) and it has about 10 fields setup called feature1, feature2, ... feature10 that are Plain Text. After I import them, rather than leave them all as individual text fields, is there a way to merge them into a matrix block or table field?  I have the data in a CSV as well that I am using for the import.&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="344" LastEditDate="2015-05-05T10:30:23.567" LastActivityDate="2015-05-05T10:30:23.567" Title="Is there a way to merge multiple Plain Text fields into a Matrix or Table field?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9090" PostTypeId="2" ParentId="9082" CreationDate="2015-04-08T15:17:22.500" Score="3" Body="&lt;p&gt;What I've done in a comparable situation is to add a hidden field to that entry type. And then I save Matrix data to that field on every save by listening to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes the access to such processed Matrix data in templates or other parts of your plugin (i.e. &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt;&lt;/a&gt;) very easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Event handler&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if($entry-&amp;gt;section['handle'] == 'campaigns')&#xA;    {&#xA;        $longTravels = false;&#xA;&#xA;        foreach ($entry-&amp;gt;travelDates as $travelDate)&#xA;        {&#xA;            $duration = $travelDate-&amp;gt;startDate-&amp;gt;diff($travelDate-&amp;gt;endDate);&#xA;&#xA;            if ($duration &amp;gt; new DateInterval('P30D') &amp;amp;&amp;amp; $duration &amp;lt; new DateInterval('P60D'))&#xA;            {&#xA;                $longTravels = true;&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        // Set value for hidden field 'longTravels'&#xA;        $entry-&amp;gt;getContent()-&amp;gt;longTravels = $longTravels;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CSS for hidden field type&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set hiddenField %}&#xA;    #fields-{{ id }}-field {&#xA;        display: none;&#xA;    }&#xA;{% endset %}&#xA;&#xA;{% includeCss hiddenField %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-08T15:28:39.410" LastActivityDate="2015-04-08T15:28:39.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9091" PostTypeId="2" ParentId="9089" CreationDate="2015-04-08T15:54:34.177" Score="2" Body="&lt;p&gt;You can obviously perform your import directly from the CSV files (or remote database), reformat the data and then import; or import the data into temporary craft text fields and then in a separate operation, move the data in craft. Personally I would opt for the first solution to avoid the extra work of creating temp fields (and allow me to import again later if needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example is for importing into a table field (importing into a matrix field would be quite different and slightly more complicated).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// loop through each row in your CSV file or results on external database query&#xA;foreach($result as $row)&#xA;{&#xA;    $entry = new EntryModel();&#xA;    $entry-&amp;gt;sectionId   = 1;&#xA;    $entry-&amp;gt;typeId      = 1;&#xA;    $entry-&amp;gt;authorId    = 1;&#xA;    $entry-&amp;gt;enabled     = true;&#xA;&#xA;    // create temp array to store feature data&#xA;    $myTableFieldData = [];&#xA;    array_push($myTableFieldData, array(&quot;col1&quot; =&amp;gt; $row['feature1']));&#xA;    array_push($myTableFieldData, array(&quot;col1&quot; =&amp;gt; $row['feature2']));&#xA;    array_push($myTableFieldData, array(&quot;col1&quot; =&amp;gt; $row['feature3']));&#xA;    // ...&#xA;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'myTableFieldHandle' =&amp;gt; $myTableFieldData,&#xA;    ));&#xA;&#xA;    // if you want to check the data first before importing&#xA;    // uncomment this and comment out saveEntry below&#xA;    //var_dump($entry);&#xA;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    if (!$success)&#xA;    {&#xA;        $errors = $entry-&amp;gt;getErrors();&#xA;        foreach ($errors as $error) {&#xA;            MyImportPlugin::log('Error:'.$error[0], LogLevel::Error);&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        MyImportPlugin::log('Successfully saved entry &quot;'.$entry-&amp;gt;id.'&quot;', LogLevel::Info);&#xA;    };&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-08T15:54:34.177" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="9092" PostTypeId="1" CreationDate="2015-04-08T16:04:57.040" Score="2" ViewCount="124" Body="&lt;p&gt;Is it possible to output asset urls, specifically an image url, as absolute from a rich text field? It looks like craft is automatically changing it back to a relative url.&lt;/p&gt;&#xA;" OwnerUserId="727" LastActivityDate="2015-04-08T16:04:57.040" Title="Absoute urls for assets in rich text fields" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9093" PostTypeId="1" AcceptedAnswerId="9096" CreationDate="2015-04-08T16:09:45.297" Score="3" ViewCount="630" Body="&lt;p&gt;I apologize for opening up a whole new question for this topic since it's been discussed a few times now, however I don't have enough rep yet to comment on the existing questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the answer to this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4699/channel-index-page-linked-in-a-structure/4710&quot;&gt;Channel index page linked in a structure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what this answer is saying is that instead of having a whole separate channel for say, a blog, I should have it set up so that &quot;Blog&quot; is an entry type in my larger structure that also contains the various static pages for my site? if I'm understanding that correctly, doesn't the user lose out on some of the basic feature that a separate channel offers, such as not having to choose where in the structure hierarchy a new blog post should be?&lt;/p&gt;&#xA;" OwnerUserId="3511" LastActivityDate="2015-04-08T17:09:36.063" Title="Linking to channel via structure section" Tags="&lt;structure&gt;&lt;sections&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9094" PostTypeId="2" ParentId="1087" CreationDate="2015-04-08T16:43:18.307" Score="9" Body="&lt;p&gt;If you're looking to check groups and/or permissions from your plugin controller with PHP, you can access the same methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3.0.x:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;//get the current user from craft&#xA;$user = Craft::$app-&amp;gt;getUser();&#xA;&#xA;//check if the current user has permission to edit certain entries&#xA;$user-&amp;gt;getIdentity()-&amp;gt;can('editEntries: 27')&#xA;&#xA;//check if user is in group&#xA;$user-&amp;gt;getIdentity()-&amp;gt;isInGroup('specialGroupHandle'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3.1.x&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Craft 3.1.x not uses ids to check permissions anymore but uids you need to pass the uid of your section&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user-&amp;gt;getIdentity()-&amp;gt;can('editEntries: 86f6afac-1d8c-43ba-8624-12d925ba57f5')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;//get the current user from craft&#xA;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;//check if the current user has permission to edit certain entries&#xA;$checkPerms = $user-&amp;gt;can('editEntries: 27');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$checkPerms will return a boolean&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="5557" LastEditDate="2019-02-23T18:34:31.410" LastActivityDate="2019-02-23T18:34:31.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9095" PostTypeId="1" AcceptedAnswerId="9097" CreationDate="2015-04-08T16:47:20.993" Score="4" ViewCount="930" Body="&lt;p&gt;Is it possible to access twig filters in a plugin? I want to be able to preview how text will look in a textarea using Markdown for a discussion board, it'd be awesome to use ajax to send the content to the controller then return the filtered version for preview, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPreviewContentAjax()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $content = craft()-&amp;gt;request-&amp;gt;getPost('textarea_content');&#xA;&#xA;    // somehow apply twig's &quot;| markdown&quot; filter to $content&#xA;&#xA;    $this-&amp;gt;returnJson( $content );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is twig accessible in this manner or am I out of my mind? :X&lt;/p&gt;&#xA;" OwnerUserId="3462" LastActivityDate="2019-09-06T15:50:07.080" Title="Twig Filter in Plugin/PHP?" Tags="&lt;plugin-development&gt;&lt;filter&gt;&lt;controller&gt;&lt;php&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9096" PostTypeId="2" ParentId="9093" CreationDate="2015-04-08T17:01:06.070" Score="2" Body="&lt;p&gt;I don't think that carlcs was suggesting that you incorporate individual blog posts into the 'pages' structure. He was only suggesting that you place those pages into the structure that you would want in your main navigation (using different &lt;code&gt;entryTypes&lt;/code&gt; defined for each page layout); like your blog index page for example. In your case, what you would likely want to do (assuming you are following this strategy at all), is to create an entry for 'blog' in your structure, with a unique &lt;code&gt;entryType&lt;/code&gt; called 'blogIndex' for example, and a matching template called '_blog.html' or '_blog.twig' which will be your blog landing/index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then create a channel for your individual blog entries, also called 'blog'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way the urls will sync up nicely, such that the uri '/blog' will display your structure entry (which is designed to render, for example, a summary of the first 20 blog entries from your 'blog' channel); and the uri '/blog/my-blog-entry-title' will display your blog entry detail page from your 'blog' channel (assuming the blog entries are long enough that you even need a detail page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;https://craftcms.stackexchange.com/a/6847/784&quot;&gt;this answer&lt;/a&gt; for a more specific example with code examples.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-08T17:09:36.063" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9097" PostTypeId="2" ParentId="9095" CreationDate="2015-04-08T17:22:20.287" Score="4" Body="&lt;p&gt;In one of your plugin services, you can render a template that handles the markdown filter and return the results as an HTML string. You can then send that HTML to wherever you want to preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your controller: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPreviewContentAjax()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $content = craft()-&amp;gt;request-&amp;gt;getPost('textarea_content');&#xA;&#xA;    $html = craft()-&amp;gt;pluginName_serviceName-&amp;gt;renderMarkdown($content);&#xA;&#xA;    $return = array('html' =&amp;gt; $html);&#xA;&#xA;    $this-&amp;gt;returnJson( $return );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function renderMarkdown($content)&#xA;{&#xA;    $rendered = craft()-&amp;gt;templates-&amp;gt;render('path/to/template', array('content' =&amp;gt; $content));&#xA;    return $rendered;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All you would need is a small template that renders your content. If you have this template in your plugin folder, be sure to adjust the template path as &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates#plugin-template-paths-explained&quot; rel=&quot;nofollow&quot;&gt;described here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{content|markdown}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need more help with the writing &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;services&lt;/a&gt;, let me know! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-08T17:22:20.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9098" PostTypeId="2" ParentId="6735" CreationDate="2015-04-08T17:31:47.853" Score="1" Body="&lt;p&gt;I was able to trace my particular issue to an old PCRE version which resulted in long regular expression strings to silently fail... causing the 'preg_match' to not match the edit entries string found here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/app/etc/web/UrlManager.php:387&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A quick test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;$path = 'entries/homepage/1-homepage';&#xA;$regexPattern = 'entries\/(?P&amp;lt;sectionHandle&amp;gt;(?:[a-zA-Z][a-zA-Z0-9_]*))\/(?P&amp;lt;entryId&amp;gt;\d+)(?:-(?:[\p{L}\p{N}\._\-]+))?';&#xA;&#xA;var_dump(preg_match('/^'.$regexPattern.'$/u', $path, $match));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should output in: 1 but was resulting in 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server is running a very old (from 2006) version of PCRE (PHP 5.3.3). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running the following command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pcretest -C&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Resulted in the following version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PCRE version 6.6 06-Feb-2006&#xA;Compiled with&#xA;  UTF-8 support&#xA;  No Unicode properties support&#xA;  Newline character is LF&#xA;  Internal link size = 2&#xA;  POSIX malloc threshold = 10&#xA;  Default match limit = 10000000&#xA;  Default recursion depth limit = 10000000&#xA;  Match recursion uses stack&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This issue does not persist with the following version of PCRE (from a local Vagrant box):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PCRE version 7.8 2008-09-05&#xA;Compiled with&#xA;  UTF-8 support&#xA;  Unicode properties support&#xA;  Newline sequence is LF&#xA;  \R matches all Unicode newlines&#xA;  Internal link size = 2&#xA;  POSIX malloc threshold = 10&#xA;  Default match limit = 10000000&#xA;  Default recursion depth limit = 10000000&#xA;  Match recursion uses stack&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I ended up solving this issue by migrating the sever to an AWS instance running PHP v5.6  You could also upgrade/rebuild PHP, but there are too many dependencies on the server.  I also tried increasing the backtrace and recursion limits, without success:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding this to my .htaccess file (FYI: I do not recommend setting this to 2Mb):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php_value pcre.backtrack_limit 2097152&#xA;php_value pcre.recursion_limit 2097152&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2015-04-08T17:31:47.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9099" PostTypeId="1" AcceptedAnswerId="9112" CreationDate="2015-04-08T18:10:34.500" Score="1" ViewCount="140" Body="&lt;p&gt;I've used &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8348/how-do-i-save-a-plugins-date-settings-field/8358#8358&quot;&gt;this thread&lt;/a&gt; to successfully get my dateTime input fields to repopulate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm seeing now is that while values in the DB are correct, the field input values are always a day behind. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the data in my DB looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;&quot;startDate&quot;:{&quot;date&quot;:&quot;5\/4\/2015&quot;}&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, the value that is getting rendered in the filed (from my settings page) is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;5/3/2015&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I save the settings (no errors). The values in the DB will be &lt;code&gt;5/3/2015&lt;/code&gt; - but then the field on my settings page will show: &lt;code&gt;5/2/2015&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you @carlcs, I am sure you are right - I'm just not doing it...right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// this returns nothing when logged in error_log&#xA;$settings['myStartDate'] = DateTime::createFromString($settings['seasonStartDate']['date'] );&#xA;&#xA;// this returns the date, but one day in the past&#xA;$settings['myStartDate'] = new DateTime( $settings['myStartDate']['date'] );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;defineSettings()&lt;/code&gt; method, I am setting &lt;code&gt;myStartDate&lt;/code&gt; to a &lt;code&gt;Mixed&lt;/code&gt; type as there is a bug with &lt;code&gt;dateTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  ....&#xA;  'myStartDate' =&amp;gt; array(&#xA;       AttributeType::Mixed&#xA;   ),&#xA;   ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not exactly sure where &lt;code&gt;prepSettings()&lt;/code&gt; should live. Here is the whole file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'myOpenings' =&amp;gt; array(&#xA;                AttributeType::Number,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'myStartDate' =&amp;gt; array(&#xA;                AttributeType::Mixed&#xA;            ),&#xA;            'myEndDate' =&amp;gt; array(&#xA;                AttributeType::Mixed&#xA;            )&#xA;        );&#xA;    }&#xA;&#xA;    public function getSettingsHtml()&#xA;    {&#xA;        $settings = $this-&amp;gt;getSettings();&#xA;&#xA;&#xA;        if ( isset( $settings['myStartDate']['date'] ) )&#xA;        {&#xA;            $settings['myStartDate'] = DateTime::createFromString( $settings['myStartDate']['date'] );&#xA;         // $settings['myStartDate'] = new DateTime( $settings['myStartDate']['date'] );&#xA;&#xA;            error_log($settings['myStartDate']);&#xA;        }&#xA;&#xA;        if ( isset( $settings['myEndDate']['date'] ) )&#xA;        {&#xA;            $settings['myEndDate'] = new DateTime( $settings['myEndDate']['date'] );&#xA;        }&#xA;&#xA;        return craft()-&amp;gt;templates-&amp;gt;render( 'plugin/_settings', array(&#xA;                    'settings' =&amp;gt; $settings,&#xA;                ) );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT/SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@carlcs and @Mats Mikkel Rummelhoff for their help. &#xA;For anyone coming to this post, here is what my &quot;final&quot; main plugin class file looks like hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;public function defineSettings() {&#xA;    return array(&#xA;        'myOpenings' =&amp;gt; array(AttributeType::Number, 'required'=&amp;gt;true),&#xA;        'myStartDate' =&amp;gt; array(AttributeType::Mixed, 'required'=&amp;gt;true),&#xA;        'myEndDate' =&amp;gt; array(AttributeType::Mixed, 'required'=&amp;gt;true)&#xA;    );&#xA;}&#xA;&#xA;public function getSettingsHtml() {&#xA;    $settings = $this-&amp;gt;getSettings();&#xA;&#xA;    if(isset($settings['myStartDate']['date']))&#xA;    {&#xA;        $settings['myStartDate'] = DateTime::CreateFromString($settings['myStartDate']);&#xA;    }&#xA;&#xA;    if(isset($settings['myEndDate']['date']))&#xA;    {&#xA;        $settings['myEndDate'] = DateTime::CreateFromString($settings['myEndDate']);&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('myplugin/_settings', array(&#xA;        'settings' =&amp;gt; $settings&#xA;    ));&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-09T17:15:06.050" Title="dateTime values in settings page are always a day behind" Tags="&lt;plugin-development&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9100" PostTypeId="1" AcceptedAnswerId="9102" CreationDate="2015-04-08T18:22:22.497" Score="2" ViewCount="245" Body="&lt;p&gt;There is the one way to build it, I could know, but It's complicated for maintenance, because I may add some new entry by time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out a better way to have entry types related to a section and all sections in dropdown menu. &lt;strong&gt;Namely, sections have some same, some different entry types&lt;/strong&gt;. So, when I click at any entry type at current section page, I get all those related entries to the click. It's more like filter feature, but except filtering on current page, you get redirected to a page with selected entry type's option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better to visualize it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://www.dev.craft/&quot; rel=&quot;nofollow&quot;&gt;http://www.dev.craft/&lt;/a&gt; = all entry's types from all sections) = all entries from all sections and entry's types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://www.dev.craft/entryTypeHandle&quot; rel=&quot;nofollow&quot;&gt;http://www.dev.craft/entryTypeHandle&lt;/a&gt; = entryTypeHandle from all sections) = entries from all sections and entryTypeHandel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://www.dev.craft/sectionHandle/entryTypeHandle&quot; rel=&quot;nofollow&quot;&gt;http://www.dev.craft/sectionHandle/entryTypeHandle&lt;/a&gt;) = entries from sectionHandle and entryTypeHandle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is hard to read. You're welcome for question's comments, if anything unclear.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-08T19:42:41.213" Title="Dropdown menu out of entry types" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9101" PostTypeId="2" ParentId="9099" CreationDate="2015-04-08T18:41:51.163" Score="3" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Sorry dragonslovetacos, I just tested this and found out it doesn't work as expected. It probably is the right way to handle DateTime values &lt;em&gt;when&lt;/em&gt; saved with attribute type DateTime.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You're probably not preparing the value for your template. Before saving your date to the database you convert it to a DateTime object and your system timezone gets calculated into the value. You now need to do the same thing before you render that value in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe it's the other way round, and you're preparing the value for your template and save it unprepared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, the helper function &lt;code&gt;DateTime::createFromString()&lt;/code&gt; should be applied to your value in both, &lt;code&gt;prepSettings()&lt;/code&gt; and &lt;code&gt;getSettingsHtml()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-09T07:20:07.027" LastActivityDate="2015-04-09T07:20:07.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9102" PostTypeId="2" ParentId="9100" CreationDate="2015-04-08T19:17:56.610" Score="3" Body="&lt;p&gt;The only thing I can think of off the top of my head is create custom routes in a plugin dynamically generated from your entryTypes, sectionHandles, and sectionHandle/entryTypes and then point them all to the same template, which would then either display the entries directly (via twig) or dynamically include a corresponding template, based on the handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like the following perhaps? Completely untested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes() {&#xA;&#xA;    // array to store routes&#xA;    $routes = [];&#xA;&#xA;    // get all section and entryType handles&#xA;    foreach(craft()-&amp;gt;sections-&amp;gt;getAllSections() as $section)&#xA;    {&#xA;        // add '/sectionHandle' routes&#xA;        $sectionHandle = $section-&amp;gt;handle;&#xA;        $routes[$sectionHandle] = array('_dynamicTemplates/routeHandler.html');&#xA;&#xA;        foreach($section-&amp;gt;getEntryTypes() as $entryType)&#xA;        {&#xA;            // add '/entryTypeHandle' routes&#xA;            $entryTypeHandle = $entryType-&amp;gt;handle;&#xA;            $routes[$entryTypeHandle] = array('_dynamicTemplates/routeHandler.html');&#xA;&#xA;            // add '/sectionHandle/entryTypeHandle' routes&#xA;            $routes[$sectionHandle.'/'.$entryTypeHandle] = array('_dynamicTemplates/routeHandler.html');&#xA;        }&#xA;    }&#xA;&#xA;    return $routes;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The one thing I don't know is if 'registerSiteRoutes()' gets called on every request, or only once when the plugin gets installed. If not, then you may also need to call it directly from an 'init()' method (or maybe just anytime an entry is saved - so it doesn't get fired on every request).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    parent::init();&#xA;    self::registerSiteRoutes();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The template would then grab the segments, perform an ECM search, and display results (or include a dynamic template based on the segments). Note: you might need to add an 'all' (or something else) to the solo 'entryTypeHandle' routes if there is any chance that your sectionHandle and entryType handles are the same. (i.e. '/all/entryTypeHandle').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory anyway — the whole thing might not work also. Be interested to hear how it goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: there also may be some problems with my routes array. I've never tried creating a dynamic route to a template in this way (might need to explicitly add '/templates/'). If anyone sees a problem please feel free to edit the answer or leave a comment. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I see a potential problem. See &lt;a href=&quot;https://craftcms.stackexchange.com/a/616/784&quot;&gt;this answer&lt;/a&gt; for possible solution. Not sure how to integrate it as part of the answer though. Perhaps send all requests to a controller action, and render the template from there. May have to leave it to you to try and resolve for now — sorry about that.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-08T19:42:41.213" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9103" PostTypeId="1" AcceptedAnswerId="9104" CreationDate="2015-04-08T19:58:36.167" Score="6" ViewCount="2173" Body="&lt;p&gt;i think the following code shows the problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries({ section: 'news', limit: 2, **id: not this_id** }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the big one doesn't work in this way. Has anyone an idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The content of this_id is a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;" OwnerUserId="3513" LastActivityDate="2015-04-08T20:02:27.803" Title="id: 'not' with variable" Tags="&lt;entry&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9104" PostTypeId="2" ParentId="9103" CreationDate="2015-04-08T20:02:27.803" Score="12" Body="&lt;p&gt;It should be a string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not 42' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so concat your variable like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not ' ~ this_id }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-08T20:02:27.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9105" PostTypeId="1" AcceptedAnswerId="9106" CreationDate="2015-04-08T22:28:18.187" Score="1" ViewCount="116" Body="&lt;p&gt;I have a number of different models that have custom validation methods, some of which are shared across models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the combinations I can't use class inheritance to share those methods, so I wondered if traits are supported and if so, what the convention would be?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-08T22:42:32.843" Title="Can traits be loaded in plugins?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9106" PostTypeId="2" ParentId="9105" CreationDate="2015-04-08T22:42:32.843" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://php.net/manual/en/language.oop5.traits.php&quot; rel=&quot;nofollow&quot;&gt;Traits&lt;/a&gt; are just a PHP thing not related to Craft at all so yes, you could use them.  But you'd be limiting your plugin to PHP 5.4+ only since that's when they were introduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.x supports back to &lt;a href=&quot;http://buildwithcraft.com/docs/requirements#server-requirements&quot; rel=&quot;nofollow&quot;&gt;PHP 5.3&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want to look at Yii's &lt;a href=&quot;http://www.yiiframework.com/wiki/44/behaviors-events/#hh1&quot; rel=&quot;nofollow&quot;&gt;Behaviors&lt;/a&gt;, which have similar functionality to traits and works with PHP 5.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.x uses a &lt;a href=&quot;http://buildwithcraft.com/classreference#craft.app.etc.behaviors&quot; rel=&quot;nofollow&quot;&gt;few behaviors&lt;/a&gt; of its own.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-08T22:42:32.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9107" PostTypeId="1" CreationDate="2015-04-08T23:02:50.973" Score="3" ViewCount="1291" Body="&lt;p&gt;I'm essentially in the process of learning Craft and in that process have made some great strides. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today I was examining Craft's tables to see how it was actually storing fields created through Settings-&gt; fields. To my surprise most fields end up as a new column in the content table. To me this seems like a serious flaw as there is a very real limit to the size a table can grow to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this information; what is recommended for developing a site in Craft that needs to have many fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an answer I'd appreciate it. Please make it detailed. I'm at a loss with this one. Hopefully there is something I'm missing because if no... Craft may not be the solution I'm looking for. Which would be unfortunate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerDisplayName="user3514" LastActivityDate="2015-04-09T01:18:30.383" Title="Craft's Content Table" Tags="&lt;field&gt;&lt;custom-field&gt;&lt;content&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9108" PostTypeId="2" ParentId="9107" CreationDate="2015-04-09T00:55:07.710" Score="4" Body="&lt;p&gt;MySQL has a &lt;a href=&quot;https://dev.mysql.com/doc/refman/4.1/en/column-count-limit.html&quot; rel=&quot;nofollow&quot;&gt;hard coded&lt;/a&gt; limit of 4,096 columns per table, although that can be effectively limited by the data types of columns involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix fields get their own tables, so they don't count against the &lt;code&gt;craft_content&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes... if you're planning on having non-Matrix fields in the 2,000 - 4,000 field range, then there's a chance you'll bump into MySQL limitations.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-09T00:55:07.710" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9109" PostTypeId="2" ParentId="9107" CreationDate="2015-04-09T01:18:30.383" Score="4" Body="&lt;p&gt;A huge boon to Craft is the ability to &lt;strong&gt;re-use fields&lt;/strong&gt; across &lt;em&gt;all&lt;/em&gt; your content – sections, categories, entry types or even users. The &lt;em&gt;field groups&lt;/em&gt; are basically only there to make it easier for you to manage your fields in the CP, and impose no limits on where you can use any one field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field re-use means that (at least with a little planning) the number of fields can usually be kept pretty low, even for complex sites.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-09T01:18:30.383" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9110" PostTypeId="1" AcceptedAnswerId="9122" CreationDate="2015-04-09T05:30:59.893" Score="3" ViewCount="367" Body="&lt;p&gt;I've been struggling with automatic slug generation in Czech language: there are letters such as &quot;š&quot; or &quot;č&quot; and Craft has a charactere map hardcoded in craft/app/resources/js/craft.js, resp. craft/app/resources/js/compressed/craft.js, which tells craft to convert &quot;š&quot; to &quot;sh&quot; and &quot;č&quot; to &quot;zh&quot; for instance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Czech language that is not necessary; it's rather bad behavior which I need to change. Letter &quot;š&quot; should become &quot;s&quot; etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any systematic way how to configure this character map? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I technically have no problems with rewriting the table, although that solution might either cause errors with automatic updates or my changes could get rolled back with every update - neither being good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: This issue is NOT related to the same thing as here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2660/how-to-transform-german-umlauts-when-creating-slugs&quot;&gt;How to transform German umlauts when creating slugs?&lt;/a&gt; - the described behavior is in place even with &quot;limitAutoSlugsToAscii == 1&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case this question was not resolved yet or had no solution, here is a minified charmap which works as a hotfix to Craft issues with Czech slugs: &lt;a href=&quot;http://pastebin.com/pc6etBFu&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/pc6etBFu&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works as a drop-in replacement for the same map in craft/app/resources/js/compressed/craft.js. My current version of craft is Craft Pro 2.3.2643&lt;/p&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-26T13:32:18.103" Title="Trouble with transliteration in slug caused by hardcoded charmap in craft.js" Tags="&lt;slug&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9111" PostTypeId="1" CreationDate="2015-04-09T07:01:07.397" Score="1" ViewCount="877" Body="&lt;p&gt;I get the following error message when I try to upload the photo:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Upload failed. The error message was: Error uploading the file: The file system path &quot;/home/tramweb/public_html/craft/assets/content/&quot; set for this source does not exist.&quot;&lt;/p&gt;&#xA;" OwnerUserId="3515" LastActivityDate="2015-04-12T07:13:49.473" Title="How do I upload photos into my assets list/library?" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9112" PostTypeId="2" ParentId="9099" CreationDate="2015-04-09T07:27:52.773" Score="2" Body="&lt;p&gt;This is how it works for me (please don't ask why!) ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'myOpenings' =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true),&#xA;        'myStartDate' =&amp;gt; AttributeType::Mixed,&#xA;        'myEndDate' =&amp;gt; AttributeType::Mixed,&#xA;    );&#xA;}&#xA;&#xA;public function getSettingsHtml()&#xA;{&#xA;    $settings = $this-&amp;gt;getSettings();&#xA;&#xA;    $settings['myStartDate'] = DateTime::createFromString($settings['myStartDate']);&#xA;    $settings['myEndDate'] = DateTime::createFromString($settings['myEndDate']);&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('plugin/_settings', array(&#xA;        'settings' =&amp;gt; $settings&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-09T07:27:52.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9113" PostTypeId="2" ParentId="9110" CreationDate="2015-04-09T07:38:35.553" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;In Czech language that is not necessary; it's rather &lt;strong&gt;bad behavior&lt;/strong&gt; which I need to change.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is true, you should email the issue to P&amp;amp;T and I'm sure they will update the mapping table for the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I don't think there's a (good) workaround, the table is hardcoded into craft.js and the function that generates the slugs only got the option to disable the character replacement completely. You could disable it and try to add your own JS that replicated the functionality with a custom plugin, this might work. But I actually think you should report that issue to P&amp;amp;T and they will probably come up with a solution to make all Czech happy without the need for any plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-09T09:28:19.750" LastActivityDate="2015-04-09T09:28:19.750" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9114" PostTypeId="1" AcceptedAnswerId="9116" CreationDate="2015-04-09T09:57:00.350" Score="1" ViewCount="939" Body="&lt;p&gt;I have a projects section on my website, there can be multiple projects from one client. Each project has at least one image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know if it is possible when uploading assets to a new project entry to be able to create a new subfolder within my specified assets folder for that particular client?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can I either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Create a subfolder when uploading assets.&#xA;b) Use the value of the &quot;client&quot; field to dynamically create a subfolder when uploading images to the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help/direction this would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jay&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-04-09T10:04:57.300" Title="Create assets subfolder on upload based on entry field value?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9116" PostTypeId="2" ParentId="9114" CreationDate="2015-04-09T10:04:57.300" Score="1" Body="&lt;p&gt;Yes that's totally possible, you just need to set your asset field to upload all assets to a single folder and then you can set a sub-folder path that's created dynamically. (→ &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#restricting-uploads-to-a-single-folder&quot; rel=&quot;nofollow&quot;&gt;Restricting Uploads to a Single Folder&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case that path would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;assets/images/projects/{{ object.client.first().friendlyName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or with fallback to a default sub-folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.client.first()|length ? object.client.first().friendlyName : 'Other' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-09T10:04:57.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9118" PostTypeId="1" AcceptedAnswerId="9121" CreationDate="2015-04-09T14:18:42.433" Score="1" ViewCount="2955" Body="&lt;p&gt;I have this simple the loop, and want to assign a unique code, if condition is met.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section().type().limit(20) as entriesOnPage %}    &#xA;&#xA;{% for entry in entriesOnPage %}&#xA;&#xA;{{ entry.type.name }}    &#xA;&#xA;     {% if entry.type('entryTypeHandleA')|length &amp;gt; 0 %}&#xA;          a&#xA;     {% elseif entry.type('entryTypeHandleB')|length &amp;gt; 0 %}&#xA;          b&#xA;     {% endif %}  &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code snippet is the last try, I've tried. I always get printed the first condition, even if it's &lt;code&gt;false&lt;/code&gt;. Without filter &lt;code&gt;length&lt;/code&gt;, I got printed both conditions. &#xA;I'm assuming, that it's ECM that will always exists, so that's why I never get falsey return? &lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-04-09T14:59:02.117" LastActivityDate="2015-04-09T15:27:39.653" Title="Evaluating the if statement in entryType" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9119" PostTypeId="1" CreationDate="2015-04-09T14:27:57.057" Score="3" ViewCount="133" Body="&lt;p&gt;I did a brief search and didn't pull anything up. Is there a native or easy way to &quot;check/uncheck&quot; all matrix blocks? We have a considerable number of them and this would be extremely helpful. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2016-09-24T14:58:40.807" Title="Plugin to &quot;check/uncheck&quot; all matrix blocks while editing entries?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9120" PostTypeId="2" ParentId="9119" CreationDate="2015-04-09T14:38:54.203" Score="5" Body="&lt;p&gt;There's a related feature request for this: &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7425151--expand-collapse-all-ui-for-matrix-fields&quot; rel=&quot;nofollow&quot;&gt;&quot;Expand/collapse all&quot; UI for Matrix fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that feature request, Brandon Kelly explains how this is already supported (it works very well):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is a way to achieve this: Check one of the blocks, then hit&#xA;  &lt;code&gt;Command + A&lt;/code&gt; to select all blocks. Then click the option button on any&#xA;  of the expanded blocks and click &quot;Collapse&quot; to collapse all blocks,&#xA;  and vise-versa to expand all blocks.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastEditorUserId="4466" LastEditDate="2016-09-24T14:58:40.807" LastActivityDate="2016-09-24T14:58:40.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9121" PostTypeId="2" ParentId="9118" CreationDate="2015-04-09T15:27:39.653" Score="3" Body="&lt;p&gt;When you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.type('entryTypeHandleA')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What you're given is an instance of an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryTypeModel&quot; rel=&quot;nofollow&quot;&gt;EntryTypeModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.type('entryTypeHandleA')|length&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EntryTypeModel's &lt;code&gt;__toString()&lt;/code&gt; method will be called, which returns the handle of the entry type ('entryTypeHandleA') and &lt;code&gt;|length&lt;/code&gt; tells you how long that handle is (16 characters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So essentially what you're saying is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 16 &amp;gt; 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is always true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm still not clear exactly what you're trying to compare against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just looking to see if the handle of an entry type is equal to something, then you'd use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type.handle == 'entryTypeHandleA' %}&#xA;    a&#xA;{% elseif entry.type.handle == 'entryTypeHandleB' %}&#xA;    b&#xA;{% endif %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-09T15:27:39.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9122" PostTypeId="2" ParentId="9110" CreationDate="2015-04-09T15:33:32.463" Score="2" Body="&lt;p&gt;Yeah, this is an issue we're aware of of the 2.x branch that's been resolved for Craft 3.x and we probably won't back-port because of the complexity involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in 2.x, we naively assumed that there was going to be a 1:1 mapping between the character that needed to be replaced and it's replacement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out that is by no means the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for Craft 3, we're using the &lt;a href=&quot;https://github.com/danielstjules/Stringy&quot; rel=&quot;nofollow&quot;&gt;Stringy&lt;/a&gt; library and you &lt;a href=&quot;https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php#L487&quot; rel=&quot;nofollow&quot;&gt;can see&lt;/a&gt; they have a 1:many mapping and the &lt;code&gt;š&lt;/code&gt; character properly maps over to &lt;code&gt;s&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-09T15:33:32.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9123" PostTypeId="1" AcceptedAnswerId="9125" CreationDate="2015-04-09T16:35:12.490" Score="2" ViewCount="183" Body="&lt;p&gt;We have been asked to scope a solution for a new site build that we'd like to use Craft for. There is one requirement I'm not sure how we'd approach though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft terms, we would have an Articles channel that has a number of fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Employer (relationship to a single Employer channel entry)&lt;/li&gt;&#xA;&lt;li&gt;Sector (relationship to a single category)&lt;/li&gt;&#xA;&lt;li&gt;Stage (select field)&lt;/li&gt;&#xA;&lt;li&gt;Tag (tag field)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then each logged in User would also have the same fields on their profile. I guess it would be easy enough to query the user attributes and pass those to a craft()-&gt;entries() call, but the requirements call for a very specific sorting algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would work something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Article Employer matches User Employer = score of 10&lt;/li&gt;&#xA;&lt;li&gt;Article Sector matches User Sector = score of 3&lt;/li&gt;&#xA;&lt;li&gt;Article Stage matches User Stage = score of 4&lt;/li&gt;&#xA;&lt;li&gt;Article Tags intersect with User Tags = score of 1 x number of matches&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The result of that score would then be added up and used as a sort dimension against a list all the latest Article entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody suggest a practical (processor efficient) way to achieve this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current thinking this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get all Article entries.&lt;/li&gt;&#xA;&lt;li&gt;Loop through each Article them and add the calculated score to an array containing the entry ID and the score.&lt;/li&gt;&#xA;&lt;li&gt;Order the array by score.&lt;/li&gt;&#xA;&lt;li&gt;Requery all Articles with pagination enabled, passing in a the list of entry IDs in the order defined by the sorted array.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Would that work? In particular the last step - can we define entries be sorted by an array of ID numbers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions would be gladly received.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-09T17:09:30.690" Title="Sorting entries based on an a bespoke algorithm" Tags="&lt;entry&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9124" PostTypeId="1" CreationDate="2015-04-09T16:39:43.147" Score="4" ViewCount="1036" Body="&lt;p&gt;I'm looking for a way to keep matrix inputs populated with their original value after submitting a form containing errors. I'm already aware of the method of doing this for general inputs as shown &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; but I can't find an example of doing the same thing with a matrix field input. Here is my form currently without such functionality.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;5&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    // First goal&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[year][new1][type]&quot; value=&quot;goal&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[year][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;descriptionMeasurement&quot; rows=&quot;4&quot; name=&quot;fields[year][new1][fields][descriptionMeasurement]&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;dueDate&quot; name=&quot;fields[year][new1][fields][dueDate][date]&quot; type=&quot;text&quot; placeholder=&quot;mm/dd/yyyy&quot;&amp;gt;&#xA;    &amp;lt;input id=&quot;weight&quot; type=&quot;number&quot; min=&quot;1&quot; max=&quot;100&quot; name=&quot;fields[year][new1][fields][weight]&quot;&amp;gt;&#xA;&#xA;    // Second Goal&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[year][new2][type]&quot; value=&quot;goal&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[year][new2][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;descriptionMeasurement&quot; rows=&quot;4&quot; name=&quot;fields[year][new2][fields][descriptionMeasurement]&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;dueDate&quot; name=&quot;fields[year][new2][fields][dueDate][date]&quot; type=&quot;text&quot; placeholder=&quot;mm/dd/yyyy&quot;&amp;gt;&#xA;    &amp;lt;input id=&quot;weight&quot; type=&quot;number&quot; min=&quot;1&quot; max=&quot;100&quot; name=&quot;fields[year][new2][fields][weight]&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save Goals&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3501" LastActivityDate="2015-08-15T01:12:57.873" Title="How do I retain form input values after submitting error-ridden form containing matrix field inputs" Tags="&lt;matrix&gt;&lt;form&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9125" PostTypeId="2" ParentId="9123" CreationDate="2015-04-09T17:09:30.690" Score="1" Body="&lt;p&gt;Looks like a solid plan to do this. And to get the entry models it the same order as you're passing the IDs to your ElementCriteriaModel there's this property: &lt;a href=&quot;https://buildwithcraft.com/docs/templating/craft.entries#fixedOrder&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fixedOrder(true)&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other suggestions could only be to do this with plugin code, but I don't think this would speed up thing noticeably.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-09T17:09:30.690" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9127" PostTypeId="2" ParentId="1359" CreationDate="2015-04-09T18:47:21.407" Score="4" Body="&lt;p&gt;With the recent release of &lt;a href=&quot;http://buildwithcraft.com/updates#build2632&quot; rel=&quot;nofollow&quot;&gt;2.3.2632&lt;/a&gt;, I've had success with curling the runPendingTask action as an ajax request.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 2 * * * curl -H &quot;X-Requested-With: XMLHttpRequest&quot; http://example.com/actions/myPlugin/someController/runSomeTask&#xA;9 2 * * * curl -H &quot;X-Requested-With: XMLHttpRequest&quot; http://example.com/actions/tasks/runPendingTasks&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So queue up the tasks, then 9 minutes later, run them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tasks controller will gracefully run the pending tasks. And since the request is an AJAX one, the controller will close the connection so you won't have any open HTTP requests while all of the tasks finish.&lt;/p&gt;&#xA;" OwnerUserId="3459" LastActivityDate="2015-04-09T18:47:21.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9128" PostTypeId="1" AcceptedAnswerId="9130" CreationDate="2015-04-09T22:20:59.230" Score="1" ViewCount="128" Body="&lt;p&gt;Just ran into an issue where one of my users was locked out due to too many login attempts (or at least it seems that way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This caused all sorts of havoc in my site:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The content that was created by that user was not accessible by&#xA;others. &lt;/li&gt;&#xA;&lt;li&gt;The front end broke (though I guess I should've set an &quot;if no&#xA;user rule&quot;) &lt;/li&gt;&#xA;&lt;li&gt;The user couldn't be found in the users list.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In order to fix this I had to go into the database and change the locked status from 1 to 0.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Has anyone else experienced this? &lt;/li&gt;&#xA;&lt;li&gt;Is there a better way of handling it? (while keeping the limit of attempts).&lt;/li&gt;&#xA;&lt;li&gt;Craft Team, can this be modified to cause less trouble? e.g.: lock the users but not their content; make the user unlockable from within the CP&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="47" LastActivityDate="2017-08-03T15:34:37.063" Title="Locked users' content fully blocked and unable to unlock" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9129" PostTypeId="1" AcceptedAnswerId="9131" CreationDate="2015-04-09T22:25:45.003" Score="1" ViewCount="549" Body="&lt;p&gt;I think I might be confused by &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a controller that I want to return a model when validation fails:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;$requestModel = Micros_AuthModel::populateModel($post);&#xA;&#xA;if ( ! $requestModel-&amp;gt;validate())&#xA;{&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'requestModel' =&amp;gt; $requestModel&#xA;    ));&#xA;&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assumed I would have access to requestModel in the template that posted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if requestModel is defined %}&#xA;    {{ inspect(requestModel) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I that inspect() call never fires.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:22.877" LastActivityDate="2017-10-26T09:27:22.877" Title="Can't seem to get variables set in controllers" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9130" PostTypeId="2" ParentId="9128" CreationDate="2015-04-09T23:03:34.573" Score="2" Body="&lt;p&gt;You're likely running into a bug that was fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2636&quot; rel=&quot;nofollow&quot;&gt;2.3.2636&lt;/a&gt; where a locked user could cause all sorts of havoc on the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your version/build is before that, update to the latest and you shouldn't see it again.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-09T23:03:34.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9131" PostTypeId="2" ParentId="9129" CreationDate="2015-04-09T23:17:01.783" Score="1" Body="&lt;p&gt;Close!  You want to redirect on success and let the request continue as normal on validation failure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyPluginAction&#xA;{&#xA;    $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;    $requestModel = Micros_AuthModel::populateModel($post);&#xA;&#xA;    if ($requestModel-&amp;gt;validate())&#xA;    {&#xA;        // Yay! What I did works!&#xA;&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'requestModel' =&amp;gt; $requestModel&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-09T23:17:01.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9134" PostTypeId="2" ParentId="9111" CreationDate="2015-04-10T05:11:23.547" Score="4" Body="&lt;p&gt;Have you created that directory? If not, you need to. Also be sure the directory you create has the correct permissionss (writable by the web server)&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-04-12T07:13:49.473" LastActivityDate="2015-04-12T07:13:49.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9135" PostTypeId="1" AcceptedAnswerId="9136" CreationDate="2015-04-10T05:48:05.590" Score="4" ViewCount="883" Body="&lt;p&gt;Is it possible to group by a field within a matrix field.&#xA;I have a channel of players which holds their details.&#xA;I have a structure for teams which includes a matrix field for a Player.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Player matrix has 2 fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Position (Drop down with: Goalkeeper, Defender, Midfielder)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Entries field linked to Players Channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When accessing the matrix is it possible to Group the blocks by the Position field?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-04-10T06:51:56.870" Title="Group by Field in Matrix Field" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9136" PostTypeId="2" ParentId="9135" CreationDate="2015-04-10T06:51:56.870" Score="5" Body="&lt;p&gt;You should be able to do this with Craft's handy &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set players = entry.myPlayersMatrix %}&#xA;{% set playersGrouped = players|group('myPositionDropdown.label') %}&#xA;&#xA;{% for position, playersInPosition in playersGrouped %}&#xA;    &amp;lt;h2&amp;gt;{{ position }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for player in playersInPosition %}&#xA;        {% set playerData = craft.entries.section('myPlayersChannel').relatedTo(player).first() %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ playerData.fullName }}&#xA;            {{ playerData.age }}&#xA;            ...&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-10T06:51:56.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9137" PostTypeId="1" AcceptedAnswerId="9138" CreationDate="2015-04-10T08:45:16.887" Score="8" ViewCount="1490" Body="&lt;p&gt;I have an entry with a dateOfBirth Date/Time Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to calculate the current age from that field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find a craft/twig function/filter to calculate the difference between 2 dates.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-04-10T09:13:03.743" Title="Get Age from Date of Birth" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9138" PostTypeId="2" ParentId="9137" CreationDate="2015-04-10T09:00:47.663" Score="13" Body="&lt;p&gt;Craft's Date/Time field extends PHP's DateTime class so (since 5.3.0) you can use the &lt;a href=&quot;http://php.net/manual/en/datetime.diff.php&quot;&gt;Diff&lt;/a&gt; method like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yourDateTimeField.diff(now).format('%y')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2015-04-10T09:13:03.743" LastActivityDate="2015-04-10T09:13:03.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9139" PostTypeId="2" ParentId="2328" CreationDate="2015-04-10T09:42:17.803" Score="2" Body="&lt;p&gt;You need to configure both nginx and php to allow upload size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Nginx configuration&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. If size is greater the given one, then the client gets the error &quot;Request Entity Too Large&quot; (413).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20170816152117/http://www.codingslover.com/2015/05/413-request-entity-too-large-error-with.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3523" LastEditorUserId="-1" LastEditDate="2018-02-22T07:37:07.823" LastActivityDate="2018-02-22T07:37:07.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9140" PostTypeId="1" AcceptedAnswerId="9141" CreationDate="2015-04-10T14:40:48.223" Score="1" ViewCount="115" Body="&lt;p&gt;I am testing Craft to see if it would be a good fit for sites I build.  At this point, I do feel it is great and might fit most of the work I do.  The only thing I can't figure out is how I could add a url to images to build a logo gallery (ie: list of logos that link to the partners websites).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this by default?  I can't find any information on it.&lt;/p&gt;&#xA;" OwnerUserId="3524" LastEditorUserId="344" LastEditDate="2015-05-05T10:29:55.093" LastActivityDate="2015-05-05T10:29:55.093" Title="Is there a way to add a url(not to the file itself) to assets?" Tags="&lt;assets&gt;&lt;url&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9141" PostTypeId="2" ParentId="9140" CreationDate="2015-04-10T14:46:50.617" Score="4" Body="&lt;p&gt;You can add any number of fields to your asset sources (just like you can for 'user groups', 'category groups', 'tag groups', or 'entry types'). Under 'settings &gt; assets &gt; sources', click a source (or create new); then click the 'field layout' tab and add your field (field needs to be created first); and save. For a url you would likely just use a textfield.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template you would access it with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myAssetsFieldHandle.first().myLinkUrlFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-10T14:52:07.750" LastActivityDate="2015-04-10T14:52:07.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9143" PostTypeId="1" CreationDate="2015-04-10T17:13:04.707" Score="3" ViewCount="450" Body="&lt;p&gt;Is Craft stable atop MariaDB? The last update concerning MariaDB was October of 2014. &lt;/p&gt;&#xA;" OwnerUserId="3526" LastEditorUserId="22" LastEditDate="2017-05-10T00:07:07.577" LastActivityDate="2018-09-05T23:58:57.683" Title="Updated Information Requested | Craft CMS &amp; MariaDB" Tags="&lt;database&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9144" PostTypeId="2" ParentId="9143" CreationDate="2015-04-10T19:07:13.860" Score="6" Body="&lt;p&gt;We currently have no open tickets or known issues with MariaDB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fun fact: according to our logs roughly 15% of Craft installs are running some version of MariaDB.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-09-05T23:58:57.683" LastActivityDate="2018-09-05T23:58:57.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9145" PostTypeId="1" CreationDate="2015-04-10T22:22:12.937" Score="0" ViewCount="1365" Body="&lt;p&gt;We have a plugin that logs you in and out of a third party service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Login is easy as we can POST to a controller action, but for logout, we have a link that goes straight to an action URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I want to redirect back to the URL the user submitted from, with some data that we use in the view (a message to say you've logged out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;redirectToPostedUrl() is no good as this isn't a POST request, and from what I can see in the docs redirect() doesn't give us the option to add data and anything we add in craft()-&gt;urlManager-&gt;setRouteVariables() doesn't come through when you redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if we &lt;em&gt;don't&lt;/em&gt; redirect or return, we get a 404 as the user is just left on the controller action URL, for which there is no template output.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-11T13:59:15.210" Title="How can I link to a controller and return/redirect with data?" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9146" PostTypeId="2" ParentId="9145" CreationDate="2015-04-11T02:21:58.870" Score="1" Body="&lt;p&gt;&lt;code&gt;$_SERVER['HTTP_REFERER']&lt;/code&gt; should give you the url the request was coming from, which you can then pass in to the redirect function. You could add some URL parameters like &lt;code&gt;?message='Logged%20out!'&lt;/code&gt; and have your template check for the message existing and display it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that this function comes with a small caveat from the PHP documentation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The address of the page (if any) which referred the user agent to the&#xA;  current page. This is set by the user agent. Not all user agents will&#xA;  set this, and some provide the ability to modify HTTP_REFERER as a&#xA;  feature. In short, it cannot really be trusted.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's the full &lt;a href=&quot;http://php.net/manual/en/reserved.variables.server.php&quot; rel=&quot;nofollow&quot;&gt;documentation on the PHP $_SERVER array&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: Other Option Using a Form&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be a little bit clunky, but you would have the like to logout actually be a form submit. You could post the current URL to your controller and use &lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array('message' =&amp;gt; $myMessageObject));&lt;/code&gt; to send your message back to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;{{ actionUrl('pluginHandle/controller/method', { return: 'this/page/url' }) }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;{{ 'Log out'|t }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All you'll need is a little bit of CSS to style the submit link, or even somme javascript to trigger the form submit. If you wanted to get even fancier, you could AJAX the request and avoid the form all together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;documentation on posting to controller actions&lt;/a&gt; for reference.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-11T13:59:15.210" LastActivityDate="2015-04-11T13:59:15.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9147" PostTypeId="2" ParentId="9145" CreationDate="2015-04-11T06:26:17.797" Score="0" Body="&lt;p&gt;I can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl('pluginHandle/controller/method', { return: 'this/page/url' }) }}&quot;&amp;gt;Log out&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my plugin method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionLogout ($return)&#xA;{&#xA;    // do something with an external API here&#xA;&#xA;    $this-&amp;gt;redirect(&quot;{$return}?message=You have been logged out&quot;, $terminate = true, $statusCode = 302);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's OK for a simple message but I was hoping we could pass something back outside of the URL in the same we can with POSTed actions, and also not be limited to what that data is, for example passing back an array or a model instance.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-11T06:26:17.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9148" PostTypeId="1" CreationDate="2015-04-11T16:11:44.910" Score="2" ViewCount="192" Body="&lt;p&gt;I've setup a section for reviews with several fields as numbers for a rating 0-5, I'm trying to figure out how to get the total of all reviews and sum of all reviews to provide a single average for an entry the reviews relate to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best approach to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of my fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Value&#xA;Condition&#xA;Reception&#xA;etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all graded 0-5 (number fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how to go through the foreach and get the sum of all fields from all reviews then divide by total reviews for the related entry to get the average for each field.&lt;/p&gt;&#xA;" OwnerUserId="3528" LastActivityDate="2015-04-12T07:01:46.490" Title="calculating average ratings from a series of review fields" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9150" PostTypeId="1" AcceptedAnswerId="9152" CreationDate="2015-04-11T19:57:14.657" Score="0" ViewCount="5717" Body="&lt;p&gt;I have this situation, where variable &lt;code&gt;param&lt;/code&gt; doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;skeleton.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Inject template #}&#xA;{% block var %}{% endblock %} &#xA;{% include '_includes/template' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to extends &lt;strong&gt;index.twig&lt;/strong&gt; with skeleton.twig and output all rendered data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;skeleton&quot; %}&#xA;&#xA;{% block var %}&#xA;    {# Set parameter #}&#xA;    {% set param = {&#xA;        section: ['handle1', 'handle2']&#xA;    } %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries(param) as entriesOnPage %}&#xA;    {# data #}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I go step by step in rendering process, I think, that the reason Why I'm getting this problem is because, the ECM is printed after &lt;code&gt;{% include '_includes/components/feed/feed' %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise I have no idea, except I put wrong &lt;code&gt;craft.entries(param)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-12T07:36:00.950" Title="Passing variable from block within including template" Tags="&lt;include&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9151" PostTypeId="2" ParentId="9148" CreationDate="2015-04-12T06:54:00.393" Score="5" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reviews = craft.entries.section('reviews').relatedto(entry) %}&#xA;{% set value = 0 %}&#xA;{% set condition = 0 %}&#xA;{% set reception = 0 %}&#xA;{% set count = 0 %}&#xA;{% for review in reviews %}&#xA;    {% set value = value + review.value %}&#xA;    {% set condition = condition + review.condition %}&#xA;    {% set reception = reception + review.reception %}&#xA;    {% set count = loop.index %}&#xA;{% endfor %}&#xA;{% set averageValue = (value / count)|round(1, 'floor') %}&#xA;{% set averageCondition = (condition / count)|round(1, 'floor') %}&#xA;{% set averageReception = (reception / count)|round(1, 'floor') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-12T07:01:46.490" LastActivityDate="2015-04-12T07:01:46.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9152" PostTypeId="2" ParentId="9150" CreationDate="2015-04-12T07:36:00.950" Score="2" Body="&lt;p&gt;Anything that is defined in &lt;code&gt;index.twig&lt;/code&gt; outside of a &lt;code&gt;block&lt;/code&gt; will be available in &lt;code&gt;skeleton.twig&lt;/code&gt;, and so also in &lt;code&gt;template.twig&lt;/code&gt;. This should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;skeleton.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/template' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;skeleton&quot; %}&#xA;&#xA;{# Set parameter #}&#xA;{% set param = {&#xA;    section: ['handle1', 'handle2']&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-12T07:36:00.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9154" PostTypeId="1" AcceptedAnswerId="9156" CreationDate="2015-04-12T09:42:10.057" Score="1" ViewCount="106" Body="&lt;p&gt;I’m trying to append a 'x2' to the end of a variable name to call another variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;imgSize might be set to predefined variables like imgColumn4, imgColumn6 or imgColumn8.&#xA;In that case I would also have imgColumn4x2, imgColumn6x2 and imgColumn8x2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to simplify the variables in a loop, I’d like to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageUrl = image.getUrl(imgSize) %}&#xA;{% set imageUrlx2 = image.getUrl(imgSize ~ 'x2') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;imgSize ~ 'x2'&lt;/code&gt; does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I join 'imgSize' and 'x2'?&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2015-04-12T15:35:35.693" Title="How to extend a variable name to fetch another?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9155" PostTypeId="1" CreationDate="2015-04-12T13:39:14.050" Score="1" ViewCount="283" Body="&lt;p&gt;From &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-2-attributetypes&quot; rel=&quot;nofollow&quot;&gt;this incredibly helpful validation article(s)&lt;/a&gt;, I found that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;AttributeType::Mixed does not apply any validation rules&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Ok cool. I am using two fields that are DateTime fields, but due to a known bug, a work-around is to make the field type &lt;code&gt;Mixed&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working 100% - and I can't thank the community for their help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in my settings page, I would (like) to have my start date (Mixed) and end date (Mixed) fields required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't a make-or-break deal, just curious if there is a way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;'myStartDate' =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true),&#xA;'myEndDate' =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true),&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi Brad, they are attribute settings. I've updated to show the file(s) below. Thank you for your time!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;{{&#xA;    forms.dateField({&#xA;        'label': &quot;Start Date&quot;|t,&#xA;        'instructions': &quot;What week do we start?&quot;|t,&#xA;        'required': true,&#xA;        'id': 'myStartDate',&#xA;        'name': 'myStartDate',&#xA;        'placeholder': 'mm/dd/yyyy',&#xA;        'value': settings.myStartDate,&#xA;        'errors': settings.getErrors('myStartDate')&#xA;    })&#xA;}}&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSettings()&#xA;{&#xA;    return array('myStartDate' =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true),&#xA;                 'myEndDate' =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true)&#xA;        );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I make the field type a DateTime, then the required works. Maybe it's all part of the same bug. If it is, that's cool. It's not a big deal I'm more curious if I'm doing something wrong for the field type since &lt;code&gt;::Mixed&lt;/code&gt; does not apply any validation rules.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-04-13T02:56:04.230" LastActivityDate="2015-11-09T20:30:07.557" Title="How to make a mixed field type required" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9156" PostTypeId="2" ParentId="9154" CreationDate="2015-04-12T15:35:35.693" Score="3" Body="&lt;p&gt;There may be other ways also, but one approach is to use an array with key value pairs, which can be assigned and accessed more dynamically.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ sizeVars[imgSize ~ 'x2'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also might want to check out twigs &lt;code&gt;attribute&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(array, item) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 'item' can be a concatenated string.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-12T15:35:35.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9157" PostTypeId="1" AcceptedAnswerId="9167" CreationDate="2015-04-12T16:37:28.073" Score="2" ViewCount="232" Body="&lt;p&gt;I'm in a situation where I have a handful of matrix blocks which have similar subfields. For example, I have a &quot;Bios&quot; block where there's an intro etc., but the a few repeating fields, imagine:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bio 1 Name (bioName1)&lt;/li&gt;&#xA;&lt;li&gt;Bio 1 Image (bioImage1)&lt;/li&gt;&#xA;&lt;li&gt;Bio 2 Name (bioName2)&lt;/li&gt;&#xA;&lt;li&gt;Bio 2 Image (bioImage2)&lt;/li&gt;&#xA;&lt;li&gt;etc. up to 6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In my template, I have some pretty redundent code when outputting these fields, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if block.bioName1 %}&#xA;    &amp;lt;div class=&quot;bit&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;bio&quot;&amp;gt;&#xA;            {% for asset in block.bioImage1 %}&#xA;            &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;header&amp;gt;&#xA;                &amp;lt;h3&amp;gt;{{ block.bioName1 }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.bioTitle1 }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;            {{ block.bioText1 }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if block.bioName2 %}&#xA;    &amp;lt;div class=&quot;bit&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;bio&quot;&amp;gt;&#xA;            {% for asset in block.bioImage2 %}&#xA;            &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;header&amp;gt;&#xA;                &amp;lt;h3&amp;gt;{{ block.bioName2 }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.bioTitle2 }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;            {{ block.bioText2 }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if it would be possible to somehow set this up as a loop with a counter to increment the vars (the field names always end with the count)? Any ideas? I tried a few things but have had no luck :/ &lt;/p&gt;&#xA;" OwnerUserId="610" LastEditorUserId="610" LastEditDate="2015-04-12T16:59:59.653" LastActivityDate="2015-04-13T09:30:16.050" Title="Loop for Similar Fields" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9158" PostTypeId="1" AcceptedAnswerId="9161" CreationDate="2015-04-12T18:00:25.140" Score="2" ViewCount="518" Body="&lt;p&gt;I'm building an entry type's menu, automatically populated with several sections. A route for dynamic menu had to be also created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionByHandle('sectionHandle') %}&#xA;{% set entryTypes = section.getEntryTypes() %}&#xA;&#xA;{% for entryType in entryTypes %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ section.handle }}{{ url('types/'~entryType.handle) }}&quot;&amp;gt;&#xA;            {{ entryType.name|ucfirst }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft.dev/sectionHandle/types/entryType.handle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I access the link, It gets crazy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft.dev/sectionHandle/types/sectionHandle/types/entryType.handle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I was trying everything I know, but Whatever I add in front of &lt;code&gt;{{url('types/'~entryType.handle) }}&lt;/code&gt;, it gets duplicated.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-13T19:24:02.683" Title="How do I build a link from variables?" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9159" PostTypeId="2" ParentId="9157" CreationDate="2015-04-12T19:48:22.057" Score="1" Body="&lt;p&gt;This solution requires a little bit of set-up code, but it will keep all your HTML dry. Set up arrays with the values from your block fields. Loop through one of the arrays and use &lt;code&gt;loop.index0&lt;/code&gt; to get the values you need in your HTML.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set names = [block.bioName1, block.bioName2, ...] %}&#xA;{% set titles = [block.bioTitle1, block.bioTitle2, ...] %}&#xA;{% set assets = [block.bioImage1, block.bioImage2, ...] %}&#xA;{% set texts = [block.bioText1, block.bioText2, ...] %}&#xA;&#xA;{% for field in nameFields %}&#xA;    {% if field != '' %}&#xA;        &amp;lt;div class=&quot;bit&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;bio&quot;&amp;gt;&#xA;                {% for asset in assets[loop.index0] %}&#xA;                    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;header&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ names[loop.index0] }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ titles[loop.index0] }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/header&amp;gt;&#xA;                {{ block.texts[loop.index0] }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-12T19:48:22.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9160" PostTypeId="2" ParentId="9157" CreationDate="2015-04-12T20:01:43.830" Score="4" Body="&lt;p&gt;I think this is an excellent use case for twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;attribute&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;code&gt;attribute&lt;/code&gt; function can be used to access a &quot;dynamic&quot; attribute of a variable:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 1..6 %}&#xA;  {% if attribute(block, 'bioName'~i) %}&#xA;    &amp;lt;div class=&quot;bit&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;bio&quot;&amp;gt;&#xA;        {% for asset in attribute(block, 'bioImage'~i) %}&#xA;          &amp;lt;img src=&quot;{{asset.url}}&quot;/&amp;gt;&#xA;          ...etc...&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-12T20:01:43.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9161" PostTypeId="2" ParentId="9158" CreationDate="2015-04-12T20:19:03.757" Score="5" Body="&lt;p&gt;Since you are building a custom URL, you shouldn't be using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions#url&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;url()&lt;/code&gt;&lt;/a&gt; here, since it automatically appends your values to the &lt;code&gt;siteUrl&lt;/code&gt;. Try one of these instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url(section.handle ~ '/types/' ~ entryType.handle) }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-or-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl ~ section.handle ~ '/types/' ~ entryType.handle }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-13T19:24:02.683" LastActivityDate="2015-04-13T19:24:02.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9162" PostTypeId="1" AcceptedAnswerId="9184" CreationDate="2015-04-12T23:11:03.763" Score="1" ViewCount="744" Body="&lt;p&gt;Recently changed the URL format for a section. Now I have a red circle in the upper right and an error message of &quot;resaving blog entries - failed&quot;. Trying again results in same error. Any ideas what could be wrong?&lt;/p&gt;&#xA;" OwnerUserId="778" LastActivityDate="2015-04-13T20:18:34.987" Title="Resaving blog entries keeps failing" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9163" PostTypeId="1" CreationDate="2015-04-13T04:52:13.270" Score="5" ViewCount="140" Body="&lt;p&gt;I am attempting to lean how to write a plugin but am having trouble knowing how to work with the &lt;a href=&quot;http://buildwithcraft.com/classreference&quot;&gt;Class Reference documentation&lt;/a&gt;. I understand all of the theory and how object oriented programs work. But I have never actually worked on a real world problem. I have only worked on small programs to learn the concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am overwhelmed by the Class Reference and don't know best practices for attacking a new project and using the Class Reference documentation. I feel overwhelmed and stuck, and so my question is can an experienced developer or two share some guidance as to their methodology for working with a framework in the real world?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin itself is conceptually simple. I'm working on developing a application similar to tinyurl.com.  I need to store data in a database table and then read it back. I also then need to then figure out how to do a redirect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main goal is to get the general guidance on how to approach any new project with regard to how to start. Any guidance on the specific problem is also appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3521" LastEditorUserId="45" LastEditDate="2015-04-13T05:45:55.320" LastActivityDate="2015-04-13T06:13:34.723" Title="How to use Class Reference Classes within the Craft framework for plugin development" Tags="&lt;plugin-development&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9164" PostTypeId="2" ParentId="9163" CreationDate="2015-04-13T06:13:34.723" Score="3" Body="&lt;p&gt;You may already be aware of this, but the Class Reference is a &lt;strong&gt;complete breakdown of the Craft core&lt;/strong&gt;. Everything that exists within the &lt;code&gt;craft/app&lt;/code&gt; folder is documented here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is built upon the &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;nofollow&quot;&gt;Yii framework&lt;/a&gt;. If you dig deep enough, many roads lead back to Yii queries. Fortunately, you'll rarely have to dig that deep! Craft has abstracted away much of the raw Yii commands into all of its &lt;strong&gt;Base&lt;/strong&gt; classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing from there, pretty much everything else that happens in Craft is layered upon the Base classes. You'll notice that most of the common components (Services, Controllers, Records, etc) contain a Base class, and all other classes are extended from there. In general, you can think of the Craft core as being &quot;one big plugin&quot;... In fact, when Craft 3 is released, this will be even more true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to note that &lt;strong&gt;your plugin won't need all of these components&lt;/strong&gt;. Many plugins require only a few of these components to meet their needs. In your case, you may only need a Service, a Controller, a Record, a Model, and a Variable.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Beyond that, I'll skip any recommendations for your specific plugin project. My intention was only to respond to the general purpose of your question... I'd highly recommend &lt;strong&gt;opening a separate question&lt;/strong&gt; with specific points about what you are setting out to accomplish.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-04-13T06:13:34.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9165" PostTypeId="1" AcceptedAnswerId="9168" CreationDate="2015-04-13T08:02:22.273" Score="0" ViewCount="86" Body="&lt;p&gt;When saving a globally used Matrix field, no more than 10 blocks (&lt;strong&gt;of the same type&lt;/strong&gt;) get saved. The Matrix field has no max. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-04-13T10:14:15.887" Title="No more than 10 blocks in globally used Matrix fields get saved" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9166" PostTypeId="1" CreationDate="2015-04-13T08:56:04.837" Score="2" ViewCount="182" Body="&lt;p&gt;I have a plugin with two records with the relationships as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Placid_EndpointRecord&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'resource' =&amp;gt; array(static::BELONGS_TO, 'Placid_ResourceRecord', 'required' =&amp;gt; false, 'onDelete' =&amp;gt; static::SET_NULL)&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Placid_ResourceRecord&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'endpoints' =&amp;gt; array(static::HAS_MANY, 'Placid_EndpointRecord', 'resourceId'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In a service class I have (options being an empty array at this point):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return Placid_ResourceRecord::model()-&amp;gt;with('endpoints')-&amp;gt;findAll($options);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I dump the response from the service method i'm getting back is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\Placid_ResourceModel Object&#xA;    (&#xA;        [classSuffix:protected] =&amp;gt; Model&#xA;        [strictAttributes:protected] =&amp;gt; 1&#xA;        [_classHandle:Craft\BaseModel:private] =&amp;gt; &#xA;        [_attributeConfigs:Craft\BaseModel:private] =&amp;gt; Array&#xA;            (&#xA;                [id] =&amp;gt; Array&#xA;                    (&#xA;                        [maxLength] =&amp;gt; 11&#xA;                        [min] =&amp;gt; -2147483648&#xA;                        [max] =&amp;gt; 2147483647&#xA;                        [decimals] =&amp;gt; 0&#xA;                        [type] =&amp;gt; number&#xA;                        [unsigned] =&amp;gt; &#xA;                        [length] =&amp;gt; 10&#xA;                        [column] =&amp;gt; integer&#xA;                    )&#xA;                [name] =&amp;gt; Array&#xA;                    (&#xA;                        [type] =&amp;gt; string&#xA;                    )&#xA;                [handle] =&amp;gt; Array&#xA;                    (&#xA;                        [type] =&amp;gt; string&#xA;                    )&#xA;                [host] =&amp;gt; Array&#xA;                    (&#xA;                        [type] =&amp;gt; string&#xA;                    )&#xA;            )&#xA;&#xA;        [_attributes:Craft\BaseModel:private] =&amp;gt; Array&#xA;            (&#xA;                [id] =&amp;gt; 1&#xA;                [name] =&amp;gt; Foo&#xA;                [handle] =&amp;gt; Bar&#xA;                [host] =&amp;gt; Bar&#xA;            )&#xA;&#xA;        [_extraAttributeNames:Craft\BaseModel:private] =&amp;gt; &#xA;        [_errors:CModel:private] =&amp;gt; Array&#xA;            (&#xA;            )&#xA;&#xA;        [_validators:CModel:private] =&amp;gt; &#xA;        [_scenario:CModel:private] =&amp;gt; &#xA;        [_e:CComponent:private] =&amp;gt; &#xA;        [_m:CComponent:private] =&amp;gt; &#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be any hint of the endpoints relation, there is definitely a row in the related table but even if not i'd expected to see an empty array of some sorts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything i'm missing or doing wrong? I looked at some of the core files and it seems the records are set up the same way for similar relations and I get no errors so i'm a bit clueless as to what's going wrong. Any help would be awesome, thank you!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-01T14:06:49.410" Title="Plugin eager loading not loading relations" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9167" PostTypeId="2" ParentId="9157" CreationDate="2015-04-13T09:30:16.050" Score="2" Body="&lt;p&gt;You can use the &quot;subscript&quot; variable syntax to add the loop index to your field names automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#variables&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/templates.html#variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 1..6 %}&#xA;  {% if block['bioName'~i] %}&#xA;    &amp;lt;div class=&quot;bit&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;bio&quot;&amp;gt;&#xA;        {% for asset in block['bioImage'~i] %}&#xA;          &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;header&amp;gt;&#xA;          &amp;lt;h3&amp;gt;{{ block['bioName'~i] }}&amp;lt;/h3&amp;gt;&#xA;          &amp;lt;p&amp;gt;{{ block['bioTitle'~i] }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/header&amp;gt;&#xA;        {{ block['bioText'~i] }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I prefer this to the attribute function because it's a little simpler to look at. But the attribute function will work in some circumstances where dot notation and subscript syntax can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is taken from the Twig docs link above:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the attribute contains special characters (like - that would be interpreted as the minus operator), use the attribute function instead to access the variable attribute:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# equivalent to the non-working foo.data-foo #}&#xA;{{ attribute(foo, 'data-foo') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-04-13T09:30:16.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9168" PostTypeId="2" ParentId="9165" CreationDate="2015-04-13T10:14:15.887" Score="2" Body="&lt;p&gt;Brad Bell: &quot;There's about a 99% chance you're bumping into your php.ini file's max_input_vars value and/or its post_max_size. If you bump those to higher values, it should start working as expected&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2765/matrix-field-input-error-from-within-the-control-panel/2777#2777&quot;&gt;Matrix field input error from within the control panel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-13T10:14:15.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9169" PostTypeId="1" CreationDate="2015-04-13T13:01:43.893" Score="3" ViewCount="986" Body="&lt;p&gt;We are launching 2 different sites, using the same craft installation on multiple domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a.com and b.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a.com points to the main craft install&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b.com should point to a subpage/single in this same craft install.&#xA;(So basically could be reached via a.com/subpage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best craft internal way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is mod proxy..but we wanna handle it internally. So basically different &quot;start&quot; points for different domains or subdomains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="608" LastActivityDate="2015-04-13T13:33:57.760" Title="Multi-Domain routing" Tags="&lt;routing&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9170" PostTypeId="2" ParentId="9169" CreationDate="2015-04-13T13:19:15.870" Score="5" Body="&lt;p&gt;To do this, copy index.php and .htaccess from a.com’s webroot into b.com’s, and make sure the &lt;code&gt;$craftPath&lt;/code&gt; variable is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, around where &lt;code&gt;$craftPath&lt;/code&gt; is getting defined, override &lt;code&gt;$_GET['p']&lt;/code&gt; to make Craft think that the URI actually started with &lt;code&gt;subpath&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$craftPath = '../craft';&#xA;&#xA;$_GET['p'] = 'subpath/' . (isset($_GET['p']) ? $_GET['p'] : '');&#xA;&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when you go to b.com/*, it will be the same as going to a.com/subpath/*.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want traffic going to b.com to stay on b.com, you will also need to make sure &lt;code&gt;a.com/subpath&lt;/code&gt; is replaced with &lt;code&gt;b.com&lt;/code&gt; in any Craft-generated URLs:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('foo')|replace('a.com/subpath', 'b.com') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will also affect links on a.com, though. If you still want traffic on a.com/subpath to remain on a.com, then it’s slightly more complicated. In your craft/config/general.php file, add a custom &lt;code&gt;domain&lt;/code&gt; config setting that varies depending on the requested domain:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        // ...&#xA;    ),&#xA;    'a.com' =&amp;gt; array(&#xA;        // ...&#xA;        'domain' =&amp;gt; 'a',&#xA;    ),&#xA;    'b.com' =&amp;gt; array(&#xA;        // ...&#xA;        'domain' =&amp;gt; 'b',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your templates, only run that &lt;code&gt;str_replace&lt;/code&gt; filter when the domain is &lt;code&gt;b&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set url = url('foo') %}&#xA;{{ craft.config.domain == 'b' ? url|replace('a.com/subpath', 'b.com') : url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-04-13T13:33:57.760" LastActivityDate="2015-04-13T13:33:57.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9171" PostTypeId="1" AcceptedAnswerId="9172" CreationDate="2015-04-13T13:21:01.583" Score="9" ViewCount="6548" Body="&lt;p&gt;When looping through a matrix, is there aquick way to check whether or not the block has a particular field (not if the field is empty, but if the field exists at all).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a matrix with ~20 block types, 12 or so have a field called blockTitle. For in-page nav, I'd like to loop through all the blocks and just output blockTitle for those that do have it. I could do this with a conditional for block.type, but am wondering if there's a simpler check (in case we add more block types in the future, don't want to have to update the conditional every time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using {% if block.blockTitle %} will kick back &quot;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;blockTitle&quot;.&quot; for block types without that field, so that's a no go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tks.&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2017-02-09T21:56:56.160" Title="Check to See if Field Exists" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9172" PostTypeId="2" ParentId="9171" CreationDate="2015-04-13T13:37:35.213" Score="15" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block['blockTitle'] is defined %}&#xA;    // Do your thing&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-13T13:37:35.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9173" PostTypeId="1" AcceptedAnswerId="9177" CreationDate="2015-04-13T14:11:24.637" Score="2" ViewCount="808" Body="&lt;p&gt;I'm trying to set up multi-environment configs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have specific db settings I want to change depending on environment. I am using &lt;code&gt;localhost&lt;/code&gt; and my Digital Ocean server IP address in my db.php file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;&#xA;'*' =&amp;gt; array(&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;),&#xA;'localhost' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'something',&#xA;),&#xA;'xxx.xxx.xxx.xxx' =&amp;gt; array(&#xA;            'server' =&amp;gt; 'localhost',&#xA;            'user' =&amp;gt; 'some_user',&#xA;            'password' =&amp;gt; 'some_password',&#xA;            'database' =&amp;gt; 'somethingelse',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried switching the order, that did not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to use a domain name rather than a IP address here?&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2015-04-13T15:30:12.037" Title="Using an IP address in config/db.php" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9174" PostTypeId="2" ParentId="9171" CreationDate="2015-04-13T14:40:49.507" Score="2" Body="&lt;p&gt;It is possible to set custom field parameters on Matrix block queries (→ &lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;nofollow&quot;&gt;Craft 2.3 release notes&lt;/a&gt;). And looking for non empty fields is possible with &lt;code&gt;:nonempty:&lt;/code&gt; (also not documented but mentioned in the &lt;a href=&quot;http://buildwithcraft.com/updates#build2524&quot; rel=&quot;nofollow&quot;&gt;2.0 release notes&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocksWithTitle = entry.myMatrixField.myTitleField(':notempty:') %}&#xA;&#xA;{% for block in blocksWithTitle %}&#xA;    {{ block.myTitleField }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-13T14:40:49.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9175" PostTypeId="2" ParentId="9155" CreationDate="2015-04-13T14:59:45.520" Score="1" Body="&lt;p&gt;100% untested and I haven't had coffee yet, but I think it'd be a combination of a few things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Having your plugin override &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/components/BaseSavableComponentType&quot; rel=&quot;nofollow&quot;&gt;BaseSavableComponentType's&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/components/BaseSavableComponentType#getSettingsModel-detail&quot; rel=&quot;nofollow&quot;&gt;getSettingsModel()&lt;/a&gt; so that it returned a MyPluginSettingsModel().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Have MyPluginSettingsModel override the rules method to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;{&#xA;    $rules = parent::rules();&#xA;&#xA;    $rules[] = array('myStartDate, myEndDate', 'required');&#xA;&#xA;    return $rules;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-13T14:59:45.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9176" PostTypeId="1" CreationDate="2015-04-13T15:07:24.907" Score="1" ViewCount="236" Body="&lt;p&gt;Every couple of weeks or so, all the sites on my server (all running Craft) go down with the error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown storage engine 'InnoDB'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems unique to Craft and unique to this server. None of the sites are particularly busy. It's likely a server thing, I know, but has anyone run into this and got a fix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Clive&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-04-13T16:20:20.173" Title="MySQL keeps crashing" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9177" PostTypeId="2" ParentId="9173" CreationDate="2015-04-13T15:09:07.103" Score="4" Body="&lt;p&gt;The short answer is yes — you need to use a domain names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want to have a look at this &lt;a href=&quot;http://craftcookbook.net/recipes/273&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-environment configuration method&lt;/a&gt; defined on the craft cookbook website that creates a global php variable called CRAFT_ENVIRONMENT in your main index.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generally use that in combination with Ben Parizek technique as described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/4734/784&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-13T15:30:12.037" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9178" PostTypeId="1" AcceptedAnswerId="9249" CreationDate="2015-04-13T15:13:00.857" Score="3" ViewCount="125" Body="&lt;p&gt;I can go to &lt;a href=&quot;http://example.com/admin/entries/sectionHandle&quot; rel=&quot;nofollow&quot;&gt;http://example.com/admin/entries/sectionHandle&lt;/a&gt;, and the Entries list has that source selected, but I can't find a way to do that with sources added through &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;modifyEntrySources&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got two extra sources for entries that have been fully translated, and those that haven't, so we can track our progress as we translate the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can add to the array so that I could link to something like &lt;a href=&quot;http://www.example.com/admin/entries/untranslated&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com/admin/entries/untranslated&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;        $sources[] = array('heading' =&amp;gt; 'Translations');&#xA;&#xA;        $sources['translations:untranslated'] = array(&#xA;            'label' =&amp;gt; Craft::t('Untranslated'),&#xA;            'criteria' =&amp;gt; array('translationCompleted' =&amp;gt; array('0', null))&#xA;        );&#xA;&#xA;        $sources['translations:translated'] = array(&#xA;            'label' =&amp;gt; Craft::t('Translated'),&#xA;            'criteria' =&amp;gt; array('translationCompleted' =&amp;gt; '1')&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-04-16T10:52:10.633" Title="Can custom entry sources have their own URLs?" Tags="&lt;control-panel&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9179" PostTypeId="1" CreationDate="2015-04-13T16:13:36.323" Score="2" ViewCount="261" Body="&lt;p&gt;I want to change the image position dropdown in the &quot;Edit Image&quot; window or add a new one that give me a different way to control image position. Rather than having this dropdown change the float, I want it to add a class to the image. i.e., instead of &quot;float: left&quot; class=&quot;left&quot;. How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="3532" LastActivityDate="2015-04-13T16:13:36.323" Title="Can I change the image position dropdown in Redactor?" Tags="&lt;redactor&gt;&lt;image&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9180" PostTypeId="2" ParentId="9176" CreationDate="2015-04-13T16:20:20.173" Score="2" Body="&lt;p&gt;If you're sure that InnoDB is installed and enabled for MySQL on this server, that error can also happen when InnoDB fails to start - for whatever reason. i.e. insufficient disk space, log file size, corrupt data, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check your MySQL log files for the underlying error.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-13T16:20:20.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9181" PostTypeId="1" CreationDate="2015-04-13T18:39:12.600" Score="1" ViewCount="79" Body="&lt;p&gt;Although undocumented, according to this answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8248/how-do-i-force-a-301-http-status-code-using-the-redirect-tag/8249#8249&quot;&gt;How do I force a 301 http status code using the redirect tag?&lt;/a&gt; adding a 301 parameter to the redirect tag should change the status. I am using this but am still getting a 302 status.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect entry.getChildren().first().url 301 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should this work to create a 301?&lt;/p&gt;&#xA;" OwnerUserId="3337" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-04-13T18:46:12.793" Title="Can the HTTP status be set with the redirect tag" Tags="&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9182" PostTypeId="2" ParentId="9181" CreationDate="2015-04-13T18:46:12.793" Score="3" Body="&lt;p&gt;That should work fine.  I just did a test in a simple template with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect &quot;http://google.com&quot; 301 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can see it's a proper 301 redirect.  Try clearing your browser's cache?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-13T18:46:12.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9183" PostTypeId="1" CreationDate="2015-04-13T20:04:00.463" Score="0" ViewCount="71" Body="&lt;p&gt;I created a custom page for account activation failure and I'm telling Craft to route to my custom page by setting the general config setting &lt;strong&gt;activateAccountFailurePath&lt;/strong&gt;. This works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is prevent users from being able to directly navigate to the custom account activation failure page. I'd prefer this page only be displayed when Craft routes the user to it. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-14T02:43:35.913" Title="Prevent invalid activation page failure" Tags="&lt;users&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9184" PostTypeId="2" ParentId="9162" CreationDate="2015-04-13T20:18:34.987" Score="1" Body="&lt;p&gt;The section that entry #392 belongs to is called &lt;code&gt;blog&lt;/code&gt; and it's &lt;code&gt;Entry URL Format&lt;/code&gt; setting is set to &lt;code&gt;blog/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also have quite a few entries (100 to be precise), with their slug set to: &lt;code&gt;snippet&lt;/code&gt; generating a URI for that slug of &lt;code&gt;blog/snippet&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That works great for the first one, but when you try to save the 2nd one, Craft sees that &lt;code&gt;blog/snippet&lt;/code&gt; is already taken and will start appending numbers to the end to try and find a unique URI like so: &lt;code&gt;blog/snippet-1&lt;/code&gt;, &lt;code&gt;blog/snippet-2&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Craft wants to have a reasonable way to know when to stop trying to find a unique URI, so it will look to the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#maxSlugIncrement&quot; rel=&quot;nofollow&quot;&gt;maxSlugIncrement&lt;/a&gt; config setting and use that, which defaults to 100 - hence the error you're running into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You either need to 1) use something to generate more unique entry slug formats - like post date/time or 2) increase the maxSlugIncrement config setting to a higher value.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-13T20:18:34.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9185" PostTypeId="2" ParentId="9166" CreationDate="2015-04-13T20:57:43.433" Score="0" Body="&lt;p&gt;What happens if you do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$resourceRecords = Placid_ResourceRecord::model()-&amp;gt;with('endpoints')-&amp;gt;findAll($options);&#xA;&#xA;foreach ($resourceRecords as $resourceRecord)&#xA;{&#xA;    echo &quot;Found &quot;.count($resourceRecords).&quot; endpoints for resource: &quot;.$resourceRecord-&amp;gt;id.&quot;&amp;lt;br/&amp;gt;&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-13T20:57:43.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9186" PostTypeId="1" AcceptedAnswerId="9192" CreationDate="2015-04-13T22:08:49.373" Score="2" ViewCount="1400" Body="&lt;p&gt;I'm new to Craft, and am not sure whether I've got something weird happening or if what I'm experiencing is expected behavior. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that when I add new entries containing image assets that get transformed (using a control panel transform in this case), that the images don't get transformed until the (template) page is loaded a second time. Therefore, each new page contains empty images and alt-text on its first load. Once I refresh the page, the images appear as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behavior? Right now this requires me to visit the page of every entry I create, in order to 'seed' it for use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not a deal breaker, but I'm just curious whether there's something I'm doing wrong on my end.&lt;/p&gt;&#xA;" OwnerUserId="3349" LastActivityDate="2019-09-10T16:22:43.103" Title="Image Transforms - Image not processed until second page refresh" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9187" PostTypeId="1" AcceptedAnswerId="9189" CreationDate="2015-04-13T22:32:07.167" Score="1" ViewCount="353" Body="&lt;p&gt;I am storing a plugin model in session:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sessionModel = My_Model::populateModel([&#xA;    'token' =&amp;gt; 'someData'&#xA;]);&#xA;&#xA;craft()-&amp;gt;httpSession-&amp;gt;add('someKey', $sessionModel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I retrieve that later:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sessionModel = craft()-&amp;gt;httpSession-&amp;gt;get('someKey');&#xA;&#xA;Craft::dd($sessionModel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;__PHP_Incomplete_Class#1&#xA;(&#xA;    [__PHP_Incomplete_Class_Name] =&amp;gt; 'Craft\\My_Model'&#xA;    [*:classSuffix] =&amp;gt; 'Model'&#xA;    [*:strictAttributes] =&amp;gt; true&#xA;    [Craft\BaseModel:_classHandle] =&amp;gt; null&#xA;    [Craft\BaseModel:_attributeConfigs] =&amp;gt; array&#xA;    (&#xA;        'token' =&amp;gt; array&#xA;        (&#xA;            'type' =&amp;gt; 'string'&#xA;            'required' =&amp;gt; true&#xA;        )&#xA;    )&#xA;    [Craft\BaseModel:_attributes] =&amp;gt; array&#xA;    (&#xA;        'token' =&amp;gt; array&#xA;        (&#xA;            'token' =&amp;gt; 'someData'&#xA;        )&#xA;    )&#xA;    [Craft\BaseModel:_extraAttributeNames] =&amp;gt; null&#xA;    [CModel:_errors] =&amp;gt; array()&#xA;    [CModel:_validators] =&amp;gt; null&#xA;    [CModel:_scenario] =&amp;gt; ''&#xA;    [CComponent:_e] =&amp;gt; null&#xA;    [CComponent:_m] =&amp;gt; null&#xA;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to store a model in session? Should it be serialised and unserialised in some way?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-14T00:32:44.970" Title="__PHP_Incomplete_Class retrieved from session" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9188" PostTypeId="1" AcceptedAnswerId="9190" CreationDate="2015-04-13T22:33:56.520" Score="2" ViewCount="3128" Body="&lt;p&gt;After updating some fields for entry types and submitting new entries, I'm getting a &lt;code&gt;&quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot;&lt;/code&gt; in the Craft control panel upon trying to access any of the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can still create entries, but once created, I cannot access it again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to troubleshoot this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error it's giving back to me is on line 34&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/app/templates/entries/_edit.html(34)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;22         {% if not isVersion %}&#xA;23             &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ section.id }}&quot;&amp;gt;&#xA;24             {% if entry.id %}&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;{% endif %}&#xA;25             {% if craft.isLocalized() %}&amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;{{ entry.locale }}&quot;&amp;gt;{% endif %}&#xA;26         {% else %}&#xA;27             &amp;lt;input type=&quot;hidden&quot; name=&quot;versionId&quot; value=&quot;{{ entry.versionId }}&quot;&amp;gt;&#xA;28         {% endif %}&#xA;29 &#xA;30         &amp;lt;div class=&quot;grid first&quot;&amp;gt;&#xA;31             &amp;lt;div class=&quot;item&quot; data-position=&quot;left&quot; data-min-colspan=&quot;2&quot; data-max-colspan=&quot;3&quot;&amp;gt;&#xA;32                 &amp;lt;div id=&quot;fields&quot; class=&quot;pane&quot;&amp;gt;&#xA;33                     {% include &quot;_includes/tabs&quot; %}&#xA;34                     {% include &quot;entries/_fields&quot; with {&#xA;35                         static: isVersion&#xA;36                     } %}&#xA;37                 &amp;lt;/div&amp;gt;&#xA;38             &amp;lt;/div&amp;gt;&amp;lt;!--/item--&amp;gt;&#xA;39 &#xA;40             &amp;lt;div class=&quot;item&quot; data-position=&quot;right&quot; data-colspan=&quot;1&quot;&amp;gt;&#xA;41 &#xA;42                 {% if showPreviewBtn %}&#xA;43                     {% include &quot;_includes/previewbtns&quot; %}&#xA;44                 {% endif %}&#xA;45 &#xA;46                 {% if craft.isLocalized() and section.getLocales() | length &amp;gt; 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="57" LastEditDate="2015-04-14T00:45:29.997" LastActivityDate="2015-04-14T00:51:31.947" Title="&quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot; in Craft CP" Tags="&lt;entries&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9189" PostTypeId="2" ParentId="9187" CreationDate="2015-04-14T00:32:44.970" Score="5" Body="&lt;p&gt;Save yourself the headache and don't store an entire Model in session.  More to the point, don't store any complex objects in session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's much better practice to store just the information you need in session to create the model when it's needed (i.e. some unique ID).  You won't run into issues like you're seeing and you won't be using unnecessary server resources serializing and unserializing these complex objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the reason you're getting the error on &lt;a href=&quot;https://php.net/manual/en/oop4.serialization.php&quot; rel=&quot;noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-14T00:32:44.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9190" PostTypeId="2" ParentId="9188" CreationDate="2015-04-14T00:51:31.947" Score="2" Body="&lt;p&gt;This was caused by an incorrectly configured assets field in the entry type. The upload location had an invalid variable set in the path.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-04-14T00:51:31.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9191" PostTypeId="2" ParentId="9183" CreationDate="2015-04-14T02:43:35.913" Score="1" Body="&lt;p&gt;In your config, you can set &lt;code&gt;activateAccountFailurePath&lt;/code&gt; to something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'activationAccountFailurePath' =&amp;gt; 'members/failed?access=1'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template, you can check for the URL parameter 'access' and 404 if it is not set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('access') != '1' %}&#xA;   {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{# rest of your template if parameter is available #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, someone could still access the page if they had the full URL with the parameter, but it should help limit access. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-14T02:43:35.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9192" PostTypeId="2" ParentId="9186" CreationDate="2015-04-14T02:54:30.953" Score="3" Body="&lt;p&gt;In your config file, set &lt;code&gt;generateTransformsBeforePageLoad&lt;/code&gt; to true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    //other configs&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will trigger craft to generate and save transforms ahead of loading the page, as explained in the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation here&lt;/a&gt;, this is will also work if you're using a plugin to provide the images.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="8424" LastEditDate="2018-06-26T21:23:30.977" LastActivityDate="2018-06-26T21:23:30.977" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9194" PostTypeId="1" CreationDate="2015-04-14T06:29:04.443" Score="0" ViewCount="1665" Body="&lt;p&gt;How do I display a variable in my template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class HelloPlugin extends BasePlugin&#xA;{&#xA;    function getName()&#xA;    {&#xA;         return Craft::t('Hello');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;        return 'Richard G.';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;        return 'http://example.com';&#xA;    }&#xA;&#xA;        public function hasCpSection()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;}&#xA;&#xA;plugins/hello/variables/HelloVariable&#xA;&#xA;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class HelloVariable&#xA;{&#xA;    // property&#xA;    $message = 'Hello, World&quot;;&quot;&#xA; }&#xA;&#xA;&#xA;plugins/hello/templates/index.html&#xA;&#xA;{% extends &quot;_layouts/cp&quot; %}&#xA;&#xA;{% set title = &quot;Hello World&quot;|t %}&#xA;&#xA;{% set content %}&#xA;&#xA;&amp;lt;h2&amp;gt;MessageVariable  {{ craft.helloPlugin.HelloVariable.message }}&amp;lt;/h2&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3521" LastEditorUserId="273" LastEditDate="2015-04-14T09:20:10.800" LastActivityDate="2015-04-16T10:07:34.510" Title="Working with Variables" Tags="&lt;plugin-development&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9195" PostTypeId="2" ParentId="9194" CreationDate="2015-04-14T06:50:15.190" Score="6" Body="&lt;p&gt;Within your variables class file you will want to define methods that 'return' values to your template, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class HelloVariable&#xA;{&#xA;    public function message()&#xA;    {&#xA;        return &quot;Hello, world!&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which you would call from your template using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.hello.message }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On a side note, a really good place to start plugin development is to download and install a plugin template such as &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;BusinessLogic&lt;/a&gt;, which provides a basic plugin structure, some sample files, and includes inline documentation for basic business logic kind of functionality.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-14T06:55:30.430" LastActivityDate="2015-04-14T06:55:30.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9196" PostTypeId="1" CreationDate="2015-04-14T07:23:33.503" Score="6" ViewCount="417" Body="&lt;p&gt;What effect, if any, does nesting cache tags have? It seems like it would be redundant, but are there any inherent drawbacks? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, I can across an instance where I was using the &lt;code&gt;{% cache %}&lt;/code&gt; tag in an include to cache a large matrix field. This was very successful at reducing querries and speeding things up on several pages that used that same include.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But one template that included this file used more entries tags so it seemed to make sense to wrap all of them in a cache tag as well. Here's an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_includes/article-body.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% for block in entry.bigMatrixField %}&#xA;    ...&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;blog/_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% for entry in craft.entries.section('blog') %}&#xA;    ...(some expensive queries)...&#xA;  {% endfor %}&#xA;&#xA;  {% include &quot;_includes/article-body&quot; %}&#xA;&#xA;  {% for category in craft.categories.group('blogCategories') %}&#xA;    ...(some more expensive queries)...&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-08-15T00:42:23.940" Title="What effect does nesting cache tags have?" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9197" PostTypeId="2" ParentId="8646" CreationDate="2015-04-14T10:02:30.867" Score="5" Body="&lt;p&gt;I made a small plugin that nests Entry Types under their section in the sources list that might be good enough for what you're after:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/mdcpepper/548fd04939e040507960&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/mdcpepper/548fd04939e040507960&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-04-14T22:45:03.730" LastActivityDate="2015-04-14T22:45:03.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9198" PostTypeId="2" ParentId="8646" CreationDate="2015-04-14T10:40:23.140" Score="1" Body="&lt;p&gt;The &quot;All types&quot; filter button would be sweet, but as far as I know, there's no way to implement that without hacking the CP w/ JS, as Craft doesn't expose any relevant hooks. I'd be a bit cautious with stuff like that, especially now with 3.0 on the horizon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shameless plug:&#xA;The &lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft&quot; rel=&quot;nofollow&quot;&gt;DashCols&lt;/a&gt; plugin (which I wrote) will let you display and sort on entry type. Alas – DashCols uses &lt;code&gt;typeId&lt;/code&gt; for sorting, not the &lt;em&gt;name&lt;/em&gt; like you want. Having the option to sort on the types' ID &lt;em&gt;or&lt;/em&gt; name would be a cool feature, though – I'll try to get that in there some day and will update this answer if/when I do.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-14T10:40:23.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9199" PostTypeId="1" AcceptedAnswerId="9206" CreationDate="2015-04-14T11:22:06.390" Score="5" ViewCount="1019" Body="&lt;p&gt;I'm writing a plugin that adds or updates users profiles in Craft from a JSON file. Every user profile could have a lot of custom fields in the future which store a lot of data.&#xA;To check if a user exist and if its data is up to date with the data in the JSON file, I need to retrieve 2 fields from every user profile. Is that possible with the elementCriteriaModel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen examples of the criteriaModel by which you filter which users are returned by adding parameters. And then you get an array back filled with users that match the criteria and all of their custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I need all users returned, but not with all their custom fields. Because I think that will slow things down.&#xA;Is it possible to fetch all users but returning only 2 specific fields by using the criteria model? Or some other way?&#xA;I know I can filter the results afterwards and return another array, but then the slow database query is allready been made. I want to limit the amount of queries made and the amount of data retrieved to the bare necessities.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-04-15T01:26:13.077" Title="Returning specific fields with elementCriteriaModel" Tags="&lt;database&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9200" PostTypeId="1" AcceptedAnswerId="9203" CreationDate="2015-04-14T11:53:59.533" Score="3" ViewCount="959" Body="&lt;p&gt;I need to filter a sections entries by more than one category but only return entries that belong to all category id's passed in a URL parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can get the correct output if the id's are hard coded but not if contained in the URL parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL: ajax-swatches?cats=171,172,179&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set catPars = craft.request.getParam('cats') %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set swatches = craft.entries({&#xA;    section: 'swatches',&#xA;    relatedTo: ['and',catPars]&#xA;}) %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume the 'relatedTo' section is treating the 'catPars' variable as a single entry and ignoring the ',' and next values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be really appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="835" LastActivityDate="2015-04-14T14:22:40.713" Title="Filter by multiple categories" Tags="&lt;categories&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9201" PostTypeId="1" AcceptedAnswerId="9222" CreationDate="2015-04-14T12:14:23.557" Score="1" ViewCount="1036" Body="&lt;p&gt;In a plugin I am using &lt;code&gt;registerSiteRoutes&lt;/code&gt; to route URL requests to a controller to handle some user validation before rendering the appropriate template. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'some-path-to/(?P&amp;lt;template&amp;gt;template-name)/(?P&amp;lt;entryId&amp;gt;\d+)' =&amp;gt; array('action' =&amp;gt; 'myPlugin/handleRequest'),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;handleRequest&lt;/code&gt; controller looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionHandleRequest(array $variables = array())&#xA;{&#xA;    if (!craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;    {&#xA;        throw new HttpException(404);&#xA;    }&#xA;&#xA;    // Do some conditional checks&#xA;&#xA;    // If everything is OK, load requested template&#xA;    if (craft()-&amp;gt;myPlugin-&amp;gt;doChecks($userId, $entry))&#xA;    {&#xA;        $variables['entry'] = $entry;&#xA;        $this-&amp;gt;renderTemplate('statement/_'.$variables['template'], $variables);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rendered template includes a form that submits to another action controller in the plugin to handle creation of a number of entries based on the submitted values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass the error messages (if any) back to the submitted form (that is accessed via the site route set in the plugin)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried removing the site route and accessing the template directly and this works. However, it also means that I need to add in a load of conditional logic to control access to the template in the template itself. I'd rather extract the logic into a plugin controller as I did before as it makes the templates a lot cleaner and separates out the logic.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-04-15T03:14:47.530" Title="How do I pass existing template variables on to an action controller?" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9202" PostTypeId="1" CreationDate="2015-04-14T12:54:41.527" Score="2" ViewCount="748" Body="&lt;p&gt;This did work until there’s a significant amount of users: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$users = $criteria-&amp;gt;search('customField:' . $someValue);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m using search as I need to find a value within the custom field. The field is typically 1,2,3 and I need to check for one of those values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried to limit it without success.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;groupId = 1;&#xA;$criteria-&amp;gt;limit = null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What’s the best way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The users getting missed are those that had the fields I’m searching populated by another plugin. This looks as though the data is not being saved in the same way as when it’s entered manually in the CP.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2015-04-14T15:59:36.597" LastActivityDate="2015-04-14T15:59:36.597" Title="Best way to search users by a custom field inside a plugin?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9203" PostTypeId="2" ParentId="9200" CreationDate="2015-04-14T13:10:35.630" Score="4" Body="&lt;p&gt;Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; takes a model, an ID, or an array of either of these. So if you're passing &lt;code&gt;'171,172,179'&lt;/code&gt; It's probably coming through as a string and only reading the first ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try making it an array and looping through the values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catPars = craft.request.getParam('cats')|split(',') %}&#xA;{% set related = ['and'] %}&#xA;{% for catPar in catPars %}&#xA;    {% set related = related|merge([{targetElement: catPar}]) %}&#xA;{% endfor %}&#xA;&#xA;&#xA;{% set swatches = craft.entries({ section: 'swatches', relatedTo: related }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without knowing your setup I don't know if it's actually &lt;code&gt;targetElement&lt;/code&gt; or &lt;code&gt;sourceElement&lt;/code&gt;. You can also pass in the &lt;code&gt;field&lt;/code&gt; name as well if you want to get more specific. See the documentation linked above for the definitions of all of those.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2015-04-14T14:22:40.713" LastActivityDate="2015-04-14T14:22:40.713" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9204" PostTypeId="2" ParentId="4600" CreationDate="2015-04-14T13:35:27.950" Score="1" Body="&lt;p&gt;It's useful to note that you can also use SQL comparison functions in the &lt;code&gt;order&lt;/code&gt; param, as explained in this answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/78/689&quot;&gt;How do you sort elements queried from multiple channels&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(This isn't exactly applicable to OP's case, since we need to compare an entry's field value to a Matrix block's field value to determine the appropriate sort order. But it would be super-useful in solving performance issues if all the data was directly in the entry's fields.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-14T13:44:14.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9205" PostTypeId="2" ParentId="9202" CreationDate="2015-04-14T13:45:14.343" Score="1" Body="&lt;p&gt;Does something like this work? You might need to add some wildcards as &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;documented here&lt;/a&gt; to run the right kind of search.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$users = $criteria-&amp;gt;search('customField: *' . $someValue.'*');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-14T13:55:55.427" LastActivityDate="2015-04-14T13:55:55.427" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9206" PostTypeId="2" ParentId="9199" CreationDate="2015-04-14T16:09:25.917" Score="3" Body="&lt;p&gt;Not 100% certain, but I suspect that with a standard ElementCriteriaModel it's all or nothing, as craft generally returns the full userModel including all custom fields. If you're worried about memory limitations, then you might want to either process the users in batches and/or create your own custom query. Something like this perhaps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// define query&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$query-&amp;gt;select(array('elements.id AS id', 'field_extid AS extid', 'field_lastupdatetime AS lastupdatetime'));&#xA;$query-&amp;gt;limit(null);&#xA;$results = $query-&amp;gt;queryAll();&#xA;&#xA;foreach($results as $result)&#xA;{&#xA;    // compare craft values to json&#xA;&#xA;    // var_dump($result['extid']) // uncomment to test&#xA;    // var_dump($result['lastupdatetime']) // uncomment to test&#xA;    // set $userExists equal to true or false if needed&#xA;&#xA;    // create/retrieve user&#xA;    if ($userExists) {&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserById($result['id']);&#xA;    } else {&#xA;        $user = new UserModel();&#xA;    }&#xA;&#xA;    // update, save, etc&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use &lt;code&gt;var_dump($results)&lt;/code&gt; to test whether you are getting the expected results.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-15T01:26:13.077" LastActivityDate="2015-04-15T01:26:13.077" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="9207" PostTypeId="1" CreationDate="2015-04-14T16:27:50.420" Score="5" ViewCount="2909" Body="&lt;p&gt;I have a matrix field with a block called &quot;employment&quot;, under this block are fields, one of those fields is a drop down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to output the drop down field as a select list so users can choose from it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: that I'm NOT trying to output what a user has selected, I just want to output the options from which a user can select.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not really what I'm after. Let me be more clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix field I'm speaking of is attached to the user model but I'm not trying to output the user's data saved for the matrix. What I'm trying to do is simply output a field of a given matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to load the matrix doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrix = craft.fields.getFieldByHandle('employmentMatrix') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how to access the matrix's blocks then fields. I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrix = craft.fields.getFieldByHandle('employmentMatrix') %}&#xA;&#xA;{% set blocks = craft.matrix.getBlockTypesByFieldId(matrix.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get an error saying &quot;matrix&quot; is not a method.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="3325" LastEditDate="2015-04-14T18:09:47.100" LastActivityDate="2021-01-28T05:37:30.113" Title="Output matrix field data" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9208" PostTypeId="1" CreationDate="2015-04-14T17:03:46.807" Score="0" ViewCount="186" Body="&lt;p&gt;I want all categories that have at least one entry that uses it.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-04-14T17:03:46.807" Title="How do I get all categories with at least one entry" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-04-14T20:44:25.137" ContentLicense="CC BY-SA 3.0" />
  <row Id="9209" PostTypeId="2" ParentId="9208" CreationDate="2015-04-14T17:03:46.807" Score="1" Body="&lt;p&gt;You could do it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set categories = craft.categories.relatedTo({&#xA;    sourceElement: craft.entries.limit(null)&#xA;}) %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;reference: &lt;a href=&quot;https://craftcms.slack.com/archives/help/p1429030702000608&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.slack.com/archives/help/p1429030702000608&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-04-14T17:03:46.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9210" PostTypeId="2" ParentId="9207" CreationDate="2015-04-14T17:19:10.370" Score="9" Body="&lt;p&gt;Assuming you have an entry to work with, something like this should work:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixFieldHandle if block.type == &amp;quot;employment&amp;quot; %}&#xA;    &amp;lt;select&amp;gt;&#xA;        {% for option in block.myDropDownFieldHandle.options %}        &#xA;            &amp;lt;option value=&amp;quot;{{ option.value }}&amp;quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Otherwise you may need to get the field through the fieldLayout or by it's handle.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;craft.matrix&lt;/code&gt; is not exposed to twig like it is in php. To get the dropdown field options through the matrix field directly you'll have to go the long way around (matrix &amp;gt; blocktypes &amp;gt; blocktype &amp;gt; fields &amp;gt; field &amp;gt; options)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrixField = craft.fields.getFieldByHandle('employmentMatrix') %}&#xA;{% set blockTypes = matrixField.getFieldType.getSettings.getBlockTypes %}&#xA;{% for blockType in blockTypes if blockType.handle == &amp;quot;myBlockTypeHandle&amp;quot; %}&#xA;    {% for field in blockType.getFields() %}&#xA;        {% if field.handle == &amp;quot;myDropDownFieldHandle&amp;quot; %}&#xA;            &amp;lt;select&amp;gt;&#xA;                {% for option in field.settings.options %}&#xA;                    &amp;lt;option value=&amp;quot;{{ option.value }}&amp;quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;UPDATE: This is for craft 2. For craft 3 see Nathan S answer below.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2021-01-28T05:37:30.113" LastActivityDate="2021-01-28T05:37:30.113" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9211" PostTypeId="1" AcceptedAnswerId="9221" CreationDate="2015-04-14T17:33:24.033" Score="4" ViewCount="4592" Body="&lt;p&gt;I found several solutions to build a dynamic, complex navigation in craft. One is described here:&#xA; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4782/adding-active-class-to-globally-cached-navigation&quot;&gt;Adding active class to globally cached navigation&lt;/a&gt;. Now i would like to create a more powerfull twig filter for &#xA; creating different navigation and breadcrumb types with selecting of active links. I already wrote some test code in plain php and used for this the library simplehtmldom (helper for changing dom elements in php like in jquery). A demonstration about what i want to do can be found here:&#xA; &lt;a href=&quot;http://www.bahu.ch/craft/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.bahu.ch/craft/&lt;/a&gt;. Now i started with creating the twig filter, but i can't include the library in my plugin. Here is a quick overview of my plugin code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;?php &#xA;   namespace Craft;&#xA;   use Twig_Extension;&#xA;&#xA;   use Twig_Filter_Method;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now i need to include the library (i know, that the next line is incorrect)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   include('simple_html_dom.php');&#xA;&#xA;   class k4NavigationTwigExtension extends \Twig_Extension&#xA;&#xA;   {&#xA;&#xA;&#xA;public function getName()&#xA;{&#xA;    return 'k4Navigation';&#xA;}&#xA;&#xA;public function getFilters()&#xA;{&#xA;    return array(&#xA;        'k4Navigation' =&amp;gt; new Twig_Filter_Method($this, 'k4Navigation'),&#xA;    );&#xA;}&#xA;&#xA;public function k4Navigation($navigation)&#xA;{&#xA;&#xA;    $html = str_get_html($navigation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;on the next line the current url should replace the string &quot;test.html&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $selectElem = $html-&amp;gt;find('a[href=&quot;test.html&quot;]')[0];&#xA;&#xA;    if (is_object($selectElem)){&#xA;       // loop li and set class active&#xA;        for ($i = 1; $i &amp;lt;= 20; $i++) {&#xA;            $selectElem-&amp;gt;setAttribute(&quot;class&quot;,&quot;active&quot;);&#xA;            $selectElem =  $selectElem-&amp;gt;parent();&#xA;            if (!is_object($selectElem)){&#xA;                break;&#xA;            }&#xA;        }    &#xA;    }&#xA;&#xA;    return $html;&#xA;&#xA;   }&#xA;&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe someone can give me a hint, how to includ the library and the first example? You can download the full test code and started plugin from here: &lt;a href=&quot;https://github.com/tombauer/k4-navigation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/tombauer/k4-navigation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sunny regards&#xA;Tom&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-08-22T09:18:35.230" Title="How do I create a custom Twig extension which includes third party code?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9212" PostTypeId="1" AcceptedAnswerId="9214" CreationDate="2015-04-14T18:06:08.397" Score="3" ViewCount="3127" Body="&lt;p&gt;I found a solution to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2749/how-do-i-output-entries-by-their-category&quot;&gt;grouping entries by category here&lt;/a&gt; which is working perfectly but I need the categories in the order they were arranged in the categories tab in the Admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, the categories are outputting in the order they were entered but they've been re-ordered since then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using &lt;code&gt;.fixedOrder(true)&lt;/code&gt; in a few places but nothing good happened. This is the current code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'projects'&#xA;}).find() %}&#xA;&#xA;{% for category, catEntries in entries|group('projectCategory.first().title') %}&#xA;    &amp;lt;h4 class=&quot;sc&quot;&amp;gt;{{ category }}&amp;lt;/h4&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;no-bullet&quot;&amp;gt;&#xA;        {% for entry in catEntries %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %} {# -- // for entry -- #}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}{# -- // for category -- #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="649" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-16T22:03:59.103" Title="How Do I group entries by Category and retain fixed Category Order?" Tags="&lt;ordering&gt;&lt;group&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9213" PostTypeId="1" CreationDate="2015-04-14T19:06:21.607" Score="2" ViewCount="421" Body="&lt;p&gt;I can't find the download links for Craft Pro. Where are they?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/try-craft-client-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/try-craft-client-pro&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3536" LastEditorUserId="3951" LastEditDate="2017-10-24T15:24:53.530" LastActivityDate="2017-10-24T15:24:53.530" Title="How can I try Craft Pro?" Tags="&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9214" PostTypeId="2" ParentId="9212" CreationDate="2015-04-14T19:19:16.987" Score="3" Body="&lt;p&gt;Twig is a templating language, and in my opinion this is pushing what it's comfortably meant to do. You might want to consider handling the heavy lifting w/ PHP by writing a small &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;business logic plugin&lt;/a&gt;, or take a look at third party plugins like Micheal Rog's &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt; to help out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, if you want to go plugin-less the following should work (&lt;em&gt;note that you'll need to change &quot;myProjectCategoryHandle&quot; to the actual handle of the category group used for the &lt;code&gt;projectCategory&lt;/code&gt; field&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Pull entries, group by category field &quot;projectCategory&quot; #}&#xA;{% set entries = craft.entries.section( 'projects' ) | group( 'projectCategory.first().title' ) %}&#xA;&#xA;{# Get all category titles for the category group &quot;yourProjectCategoryHandle&quot; #}&#xA;{% set categories = craft.categories.group( 'yourProjectCategoryHandle' ).titles %}&#xA;&#xA;{# Loop through the category title array #}&#xA;{% for category in categories %}&#xA;&#xA;    {# Get the entries grouped under the current category title (if any) #}&#xA;    {% set catEntries = entries[ '' ~ category ] | default( [] ) %}&#xA;&#xA;    {# Print the category title and entries #}&#xA;    {% if catEntries | length %}&#xA;    &amp;lt;h4 class=&quot;sc&quot;&amp;gt;{{ category }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;ul class=&quot;no-bullet&quot;&amp;gt;&#xA;        {% for entry in catEntries %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %} {# -- // for entry -- #}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-14T19:19:16.987" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9215" PostTypeId="2" ParentId="9213" CreationDate="2015-04-14T19:45:33.613" Score="3" Body="&lt;p&gt;Assuming it is already installed and running, there should be a link to upgrade in the footer of the control panel which generates a modal window with options to buy or try. Keep in mind you will need to be running your install on a domain that ends in 'craft.dev' (i.e. mysite.craft.dev). From &lt;a href=&quot;https://craftcms.com/support/try-craft-client-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft won’t automatically upgrade itself; you will still have to do that manually. Click on the upgrade link in the footer of the Craft Control Panel, and you will find new “Test” buttons beside each of the buy buttons:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Otherwise you can download craft from anywhere on the &lt;a href=&quot;https://craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;craftcms&lt;/a&gt; site (link is in the top-right).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="3951" LastEditDate="2017-10-24T13:07:12.640" LastActivityDate="2017-10-24T13:07:12.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9216" PostTypeId="2" ParentId="9213" CreationDate="2015-04-14T20:15:33.093" Score="6" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/9215/45&quot;&gt;Douglas's answer is correct...&lt;/a&gt; Also, if you'd simply like to &lt;strong&gt;try&lt;/strong&gt; Craft Pro before purchasing it, you can do so while running Craft in your &lt;strong&gt;local environment&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/try-craft-client-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/try-craft-client-pro&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's now possible to try Craft Pro from &lt;em&gt;any&lt;/em&gt; non-public domain:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-domain&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="3951" LastEditDate="2017-10-24T13:07:23.633" LastActivityDate="2017-10-24T13:07:23.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9217" PostTypeId="1" CreationDate="2015-04-14T21:33:05.110" Score="1" ViewCount="1949" Body="&lt;p&gt;I am using Craft &lt;strong&gt;only for the blog section&lt;/strong&gt; of my site. The rest is HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I make my site's 404 page come up for errors in the Craft-blog section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I use the errorTemplatePrefix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does that go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What to I put in there if Craft is above root and my page is mydomain.com/404.html&lt;/p&gt;&#xA;" OwnerUserId="3460" LastActivityDate="2016-07-07T05:33:48.037" Title="How to use my site's 404 page?" Tags="&lt;404&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9219" PostTypeId="1" AcceptedAnswerId="11136" CreationDate="2015-04-15T00:06:14.363" Score="4" ViewCount="195" Body="&lt;p&gt;Much of my work is for a corporate organisation, and there is some resistance to having the CP of a CMS externally exposed. Is it possible to run the Craft CP on one internal (not available outside the network) webserver, and the front end on a separate webserver in the external DMZ which has its access to the CP turned off? Both would talk to the same database (I can see how this could work for two full versions). This is how we run our homegrown CMS which also stores all assets (CSS, JS, templates, images and PDFs) in the database, so I know I would have to find a solution for that, but I am imaging a CDN would solve that problem. What are the technical and licensing issues that need to be addressed? I want to ditch the homegrown CMSes in use, for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It isn't just the CP that would only be available inside. I want to make all the end user form data be accessible for view and 'office use' update as well i.e. so the form submissions are managed internally only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I might want to expose separate Sections as standalone websites (these are small 6-10 page medium term sites for conferences, but sometimes have their own domain. The form submissions would be consolidated). These separate sites would all be on the same external server. &lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-08-23T06:18:52.393" Title="Can you run Craft CP on one webserver and serve the front end content on a separate one?" Tags="&lt;server&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9220" PostTypeId="1" CreationDate="2015-04-15T01:18:52.990" Score="2" ViewCount="448" Body="&lt;p&gt;Craft newbie here.  I have been playing with craft now for a few weeks and built out a couple of pages. I am really liking it this CMS.  The one small problem that I just noticed however, is when I tried to go to the news template (for example) by going to &lt;a href=&quot;http://example.com/news&quot; rel=&quot;nofollow&quot;&gt;http://example.com/news&lt;/a&gt; I get a 404 error.  It works fine when going to &lt;a href=&quot;http://example.com/index.php/news&quot; rel=&quot;nofollow&quot;&gt;http://example.com/index.php/news&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something or does the index.php always need to be in the address? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I read the documentations it says either way would work, so I am sure I am doing something wrong or missing something really simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate it if someone can point me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="3480" LastEditorDisplayName="user2256" LastEditDate="2015-05-19T09:21:38.423" LastActivityDate="2015-05-19T09:21:38.423" Title="Get 404 Error When Going to mydomain.com/news" Tags="&lt;url&gt;&lt;error&gt;&lt;404&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9221" PostTypeId="2" ParentId="9211" CreationDate="2015-04-15T02:19:51.740" Score="2" Body="&lt;p&gt;In your plugins main file add the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addTwigExtension()&#xA;{&#xA;    Craft::import('plugins.myplugin.twigextensions.myTwigExtension');&#xA;&#xA;    return new MyTwigExtension();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin folder, add a new folder called 'twigextensions'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the new 'twigextensions' folder, add your twig filter 'MyTwigExtension.php'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;use Twig_Extension;&#xA;use Twig_Filter_Method;&#xA;&#xA;class MyTwigExtension extends \Twig_Extension&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        return 'My Twig Extension';&#xA;    }&#xA;&#xA;    public function getFilters()&#xA;    {&#xA;        $returnArray = array();&#xA;        $methods = array(&#xA;            'myfilter',&#xA;        );&#xA;&#xA;        foreach ($methods as $methodName) {&#xA;            $returnArray[$methodName] = new \Twig_Filter_Method($this, $methodName);&#xA;        }&#xA;&#xA;        return $returnArray;&#xA;    }&#xA;&#xA;    public function myfilter($content)&#xA;    {&#xA;        // perform filter operations&#xA;&#xA;        return &quot;My Filter Result&quot;;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can thank Luke Holder's twig extension &lt;a href=&quot;https://github.com/lukeholder/craft-inflect/releases&quot; rel=&quot;nofollow&quot;&gt;craft-inflect&lt;/a&gt; for this!&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-15T02:19:51.740" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9222" PostTypeId="2" ParentId="9201" CreationDate="2015-04-15T02:40:05.550" Score="2" Body="&lt;p&gt;Not really a direct answer to your question, but you could also perhaps remove the additional controller routing business and move your conditional logic into a plugin variable (or service method called from your variable).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.myPlugin.everythingsOk(entry) %}&#xA;    // everything's ok, render template&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function everythingsOk($entry)&#xA;{&#xA;    // Do some conditional checks&#xA;&#xA;    if (craft()-&amp;gt;myPlugin-&amp;gt;doChecks($userId, $entry))&#xA;    {&#xA;        return true;&#xA;    }&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-15T03:14:47.530" LastActivityDate="2015-04-15T03:14:47.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9223" PostTypeId="2" ParentId="9217" CreationDate="2015-04-15T03:39:01.430" Score="1" Body="&lt;p&gt;Can't think of a native way to do this — a few options come to mind, none of which are ideal.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;recreate your sites 404 page in your 404 template (should be able to just copy/paste for the most part).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;redirect to your site's 404 page from your 404 template (i.e. redirect 'craft/templates/404.html' to 'mydomain.com/404.html'). So in your 404 template you would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%  redirect '/404.html'  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Reaching here, but you could also possibly include your 404 page in an iframe in your 404 template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="784" LastEditorUserId="117" LastEditDate="2016-07-07T05:33:48.037" LastActivityDate="2016-07-07T05:33:48.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9224" PostTypeId="2" ParentId="9194" CreationDate="2015-04-15T08:11:27.873" Score="1" Body="&lt;p&gt;Here is my corrected code ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class HelloVariable&#xA;{&#xA;    public function getMessage($msg)&#xA;    {&#xA;        return $msg;&#xA;    }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and for the template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;&#xA;{% set title = &quot;Hello World&quot;|t %}&#xA;&#xA;{% set content %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{ craft.hello.getMessage('Say something original...') }}&amp;lt;/h2&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which prints in the control panel...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Hello World&#xA;Say something original...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3521" LastActivityDate="2015-04-15T08:11:27.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9225" PostTypeId="1" AcceptedAnswerId="9227" CreationDate="2015-04-15T11:12:06.193" Score="1" ViewCount="1212" Body="&lt;p&gt;How can I determine if the row being returned from a table field in a for loop is the last row?&lt;/p&gt;&#xA;" OwnerUserId="3517" LastEditorUserId="1098" LastEditDate="2015-04-15T11:35:01.593" LastActivityDate="2015-04-15T11:35:01.593" Title="Get last row in table field for loop" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;table-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9226" PostTypeId="2" ParentId="9225" CreationDate="2015-04-15T11:30:32.130" Score="3" Body="&lt;p&gt;In any for loop you can use the &lt;code&gt;loop&lt;/code&gt; variable that twig gives you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in myTable %}&#xA;  {% if loop.last %}&#xA;    This is the last row&#xA;  {% else %}&#xA;    This is anything but the last row&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More information on the loop variable can be found in the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;twig docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2015-04-15T11:30:32.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9227" PostTypeId="2" ParentId="9225" CreationDate="2015-04-15T11:31:20.323" Score="2" Body="&lt;p&gt;Twig's &lt;code&gt;for&lt;/code&gt; loop exposes a &lt;code&gt;loop&lt;/code&gt; variable with a number of useful properties, including &lt;code&gt;last&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in table %}&#xA;    ...&#xA;    {% if loop.last %}&#xA;        // Do stuff&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;the official Twig docs&lt;/a&gt; for more information on the &lt;code&gt;loop&lt;/code&gt; variable and its properties (first, last, index etc).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-15T11:31:20.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9228" PostTypeId="2" ParentId="1938" CreationDate="2015-04-15T12:10:14.337" Score="2" Body="&lt;p&gt;Another approach if you simply want to use a channel as your homepage (rather than redirecting) is to just make your homepage extend the channel's index template. For example, set your homepage template to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;news/index&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and the News channel will appear on your homepage.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-04-15T12:10:14.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9229" PostTypeId="2" ParentId="9220" CreationDate="2015-04-15T13:20:41.613" Score="5" Body="&lt;p&gt;The .htaccess file was missing the period in the filename when initially installed.  &lt;/p&gt;&#xA;" OwnerUserId="3480" LastActivityDate="2015-04-15T13:20:41.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9230" PostTypeId="1" AcceptedAnswerId="9232" CreationDate="2015-04-15T15:17:53.760" Score="1" ViewCount="110" Body="&lt;p&gt;I am trying to understand if it is possible to do a hook on an entry save without creating a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I would like to happen:&#xA;- In my entry, I have some address fields (street, city, province...).&#xA;- I would like to take those info and go grab a lat and long from Google maps and save it with the entry.  The lat and long fields are also available in the entry if people want to fill them or modify them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was doing all this in Wordpress with custom post types, but I'm trying to convert it to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible or do I have to create a plugin to do it?&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2015-04-15T15:31:08.337" Title="How to save extra data when I save an entry" Tags="&lt;plugin-development&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9232" PostTypeId="2" ParentId="9230" CreationDate="2015-04-15T15:31:08.337" Score="1" Body="&lt;p&gt;I think the short answer is yes, you do need a plugin to listen for events or tie into Craft's hooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily if that is all you need to do you can probably get away with writing a plugin that is only the singular plugin class file, you may not need any other plugin classes (models/records/etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems as if you want to listen for &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="559" LastActivityDate="2015-04-15T15:31:08.337" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9233" PostTypeId="1" AcceptedAnswerId="9234" CreationDate="2015-04-15T15:51:17.673" Score="1" ViewCount="324" Body="&lt;p&gt;in my Sections (Single, Channel and Structure) I am using one matrix field containing typical content elements, Text (One Column), Text (Two Columns), Image, Text-Slider, Image-Slider and so on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is the Text-Slider with Richtext and links in it. Unfortunately Matrix field doesn't offer any Repeater or Nested Matrix functionality so I don't know how to build the structure for this element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Image-Slider is a no brainer , I take an asset field and with every image there is another Richtext field I can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Table field has no Richtext field in it... &#xA;There are a lot of small Text-Sliders all over the website.&#xA;Any Ideas? Thanks much! &lt;/p&gt;&#xA;" OwnerUserId="136" LastActivityDate="2015-04-15T16:20:23.223" Title="Text-Slider within Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9234" PostTypeId="2" ParentId="9233" CreationDate="2015-04-15T16:20:23.223" Score="1" Body="&lt;p&gt;You could use your default &quot;Text&quot; Matrix block type for the sliders and have an extra block type as a &quot;Slide Wrapper&quot;, to wrap &quot;Text&quot; (and &quot;Image&quot;) blocks which should go into your slider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this question for an alternative approach, to recognize succeeding blocks of the same type automatically in the template &lt;a href=&quot;https://craftcms.stackexchange.com/a/6739/125&quot;&gt;Solution for Matrix-within-Matrix (or More Robust Table Fields)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-15T16:20:23.223" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9235" PostTypeId="1" CreationDate="2015-04-15T20:52:02.363" Score="1" ViewCount="75" Body="&lt;p&gt;Here's some relevant detail from my config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'rememberUsernameDuration' =&amp;gt; false,&#xA;    'rememberedUserSessionDuration' =&amp;gt; false,&#xA;    'userSessionDuration' =&amp;gt; 'PT30S'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm expecting to see sessions timing out after 30 seconds but they don't seem to be, and if I remove that they are still valid beyond the default time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, one thing I'm doing is setting a session directly in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add('myKey', 'myData');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And retrieving:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;get('myKey');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing something here? The config file definitely affects the Craft CMS login session as with the config above I get constant warnings to keep my session open in the CMS.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-17T19:05:06.500" Title="Session key not timing out when set in a plugin" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9236" PostTypeId="1" AcceptedAnswerId="9237" CreationDate="2015-04-15T22:22:58.877" Score="1" ViewCount="856" Body="&lt;p&gt;Is there anything in craft that can take an xml feed and display it on my site. &#xA;It doesn't need to be saved as entries or anything. Simply just display the data. &#xA;It's a sports xml feed and there will be fixtures/results and league tables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen this: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.feeds&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.feeds&lt;/a&gt;&#xA;But you only seem to be able to access a few fixed fields. &lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="3951" LastEditDate="2017-10-26T02:07:10.550" LastActivityDate="2017-10-26T02:07:10.550" Title="Display xml feed - xml parser" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9237" PostTypeId="2" ParentId="9236" CreationDate="2015-04-15T22:41:11.493" Score="4" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;Feed Me&lt;/a&gt; plugin if you like! While it can save feed items as entries, you can use the &lt;a href=&quot;https://github.com/engram-design/FeedMe#template-example&quot; rel=&quot;nofollow&quot;&gt;template tag&lt;/a&gt; which allows you to simply fetch feed data without actually saving it. Then you can loop through your feed items in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have any issues - I created the plugin, so happy to assist :)&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-04-15T22:41:11.493" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9238" PostTypeId="1" AcceptedAnswerId="9239" CreationDate="2015-04-16T02:47:52.263" Score="2" ViewCount="367" Body="&lt;p&gt;I've already found the entry, and the 'users' field can contain multiple users.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-04-16T03:35:47.233" Title="How to check if currentUser matches a users field within an entry?" Tags="&lt;entries&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9239" PostTypeId="2" ParentId="9238" CreationDate="2015-04-16T02:47:52.263" Score="2" Body="&lt;p&gt;I asked this on the Slack chat and Brad Bell kindly came to the rescue.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set match = false %}&#xA;&#xA;{% for user in entry.users %}&#xA;    {% if user.username == currentUser.username %}&#xA;        {% set match = true %}&#xA;    {% endif %} &#xA;{% endfor %}&#xA;&#xA;{% if match %}&#xA;    User matches!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="57" LastEditDate="2015-04-16T03:35:47.233" LastActivityDate="2015-04-16T03:35:47.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9240" PostTypeId="1" AcceptedAnswerId="9253" CreationDate="2015-04-16T03:02:12.433" Score="1" ViewCount="155" Body="&lt;p&gt;I need to use requirePermission tag to check if one or another permission is active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to reproduce something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.can('perm1') or currentUser.can('perm2')  %}&#xA;   &amp;lt;!-- My page stuff --&amp;gt;&#xA;{% else %}&#xA;   {% exit 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I make this possible &lt;code&gt;{% requirePermission &quot;perm1_or_perm2&quot; %}&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="3499" LastActivityDate="2015-04-16T13:31:01.277" Title="{% requirePermission %} with OR condition" Tags="&lt;templating&gt;&lt;permissions&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9241" PostTypeId="2" ParentId="9217" CreationDate="2015-04-16T06:27:08.270" Score="1" Body="&lt;p&gt;If your current 404 page is a static HTML page, I think the simplest solution would be to just copy your existing 404 HTML page into the craft/templates folder. Craft will display an HTML page just as easily as Twig code. Just make sure the file is named &lt;code&gt;404.html&lt;/code&gt; in your craft/templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make a change to the 404 page later, you would have to change it in two places, but that's really the only downside I can think of.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-04-16T17:40:36.440" LastActivityDate="2015-04-16T17:40:36.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9242" PostTypeId="1" AcceptedAnswerId="9243" CreationDate="2015-04-16T06:51:53.813" Score="7" ViewCount="2312" Body="&lt;p&gt;I'm trying to disable template caching in my development environment. I've tried a few things but thus far nothing has worked. I had thought that just setting devMode to true in the config would do the trick, but I'm still caching. The control panel shows the caution lines to indicate I'm in dev mode, but I still have to manually clear the cache before template changes show up. What am I overlooking?&lt;/p&gt;&#xA;" OwnerUserId="3540" LastEditorUserId="57" LastEditDate="2015-04-16T17:31:41.447" LastActivityDate="2015-07-27T06:15:22.923" Title="How to disable template caching? devMode isn't doing it" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9243" PostTypeId="2" ParentId="9242" CreationDate="2015-04-16T07:04:35.753" Score="8" Body="&lt;p&gt;It is true that devMode does not turn off caching. What I do is define a flag in general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheThings' =&amp;gt; true, // true by default, but usually false for dev&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in my templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache if craft.config.cacheThings %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;update&lt;/strong&gt;&#xA;Since version 2.4 there is a new config value: &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#enableTemplateCaching&quot; rel=&quot;nofollow&quot;&gt;enableTemplateCaching&lt;/a&gt;, so all you need to do now is set this &lt;code&gt;false&lt;/code&gt; in your development environment.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-07-27T06:15:22.923" LastActivityDate="2015-07-27T06:15:22.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9244" PostTypeId="2" ParentId="9212" CreationDate="2015-04-16T07:56:51.923" Score="4" Body="&lt;p&gt;Depending on your needs, you may be able to ditch the group() filter and sort your list however you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get all your entries and categories. Then use the relatedTo functions to filter those lists.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('projectCategories') %}&#xA;{% set projects = craft.entries.section('projects').order('title').limit(null) %}&#xA;&#xA;{% for category in categories.relatedTo(projects) %}&#xA;  &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;  &amp;lt;ul class=&quot;no-bullet&quot;&amp;gt;&#xA;    {% for entry in projects.relatedTo(category) %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One caveat might be that this solution pulls all your entries and categories. This worked for my situation where I had around 50 categories and under 200 entries. I also knew these numbers wouldn't get bigger in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also makes a few other assumptions too...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You DON'T need to show entries with NO related categories like this:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category A&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry&lt;/li&gt;&#xA;&lt;li&gt;entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(No Categories)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, your entries can show up under EACH category they're related to, instead of just the FIRST category like your original code. For example, if Entry 1 has Category A and Category B selected, you'll get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category A&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-04-16T22:03:59.103" LastActivityDate="2015-04-16T22:03:59.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9245" PostTypeId="1" AcceptedAnswerId="9246" CreationDate="2015-04-16T08:11:45.617" Score="3" ViewCount="855" Body="&lt;p&gt;I'm new to all this. Is it possible to use &lt;code&gt;craft.entries&lt;/code&gt; to return all entries with an empty entries field? Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set drinksWithNoIngredients = craft.entries.section(&quot;drinks&quot;).ingredients(&quot;:empty:&quot;) %}&#xA;{% for drink in drinksWithNoIngredients %}&#xA;    &amp;lt;p&amp;gt;Do something with {{ drink.title }}...&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;ingredients&lt;/code&gt; is an entries field handle. This doesn't seem to work on entries fields, though. Or maybe I could do some kind of &lt;code&gt;relatedTo&lt;/code&gt; magic, where the &lt;code&gt;targetElement&lt;/code&gt; is some kind of special null value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative seems to be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set drinksWithNoIngredients = craft.entries.section(&quot;drinks&quot;) %}&#xA;{% for drink in drinksWithNoIngredients %}&#xA;    {% if not drink.ingredients.total() %}&#xA;    &amp;lt;p&amp;gt;Do something with {{ drink.title }}...&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But doing it that way calls &lt;code&gt;.total()&lt;/code&gt; on &lt;em&gt;every&lt;/em&gt; drink. Is that going to cause performance problems if I have a lot of drinks?&lt;/p&gt;&#xA;" OwnerUserId="3542" LastActivityDate="2015-04-16T08:50:31.923" Title="Using craft.entries to return entries with empty entries field" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9246" PostTypeId="2" ParentId="9245" CreationDate="2015-04-16T08:44:45.933" Score="2" Body="&lt;p&gt;You were on the right track using &lt;code&gt;relatedTo&lt;/code&gt;. But as there's no &lt;code&gt;notRelatedTo&lt;/code&gt; parameter, you'd first have to get all drinks that are related to any ingredient and those entries can then be removed from a new ElementCriteriaModel, that returns all your drinks, using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter. Instead of passing whole element models, you should better use this filter with element IDs (→ &lt;a href=&quot;https://craftcms.stackexchange.com/q/7170/125&quot;&gt;Why is the Craft without filter not working correctly and how to debug?&lt;/a&gt;). To get them just make use of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#ids&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ids()&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ingredients = craft.entries.section('ingredients').limit(null) %}&#xA;{% set drinksWithIngredientsIds = craft.entries.section('drinks').relatedTo({targetElement: ingredients}).limit(null).ids() %}&#xA;&#xA;{% set drinksWithNoIngredients = craft.entries.section('drinks')|without(drinksWithIngredientsIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-16T08:50:31.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9248" PostTypeId="1" AcceptedAnswerId="9260" CreationDate="2015-04-16T10:21:18.697" Score="3" ViewCount="826" Body="&lt;p&gt;We have a site deployed in Norway, and people have uploaded PDF-assets with Norwegian non-ascii characters in the filenames. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally this works fine, the URLs are encoded like this and it works: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://[oursite].no/assets/files/downloads/%C3%85rsberetning-2014_kladd.pdf&quot; rel=&quot;nofollow&quot;&gt;http://[oursite].no/assets/files/downloads/%C3%85rsberetning-2014_kladd.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&quot;Årsberetning&quot; - annual report)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But one file didn't want to download, it only gave me 404. However, checking on the server the file was there, and the filename appeared correct. Also, re-scanning asset folders didn't remove it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT - I was not able to rename the file from within craft, nor download it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After much hair-pulling I established that the file on disk had the Å encoded as '\x41\xcc\x8a' whereas craft looked for a &quot;pre-composed&quot; Å ('\xc3\x85'). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOW the question - where did this break? :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft unicode-normalise filenames? &#xA;Does MySQL normalise the unicode it stores? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file has moved around various developer machines and staging servers before making it into production, it could be some other part of the tool-chain that broke it. &lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2016-06-08T19:22:37.643" Title="Asset filename unicode normalisation?" Tags="&lt;assets&gt;&lt;filesystem&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9249" PostTypeId="2" ParentId="9178" CreationDate="2015-04-16T10:52:10.633" Score="2" Body="&lt;p&gt;After a little more digging, I discovered this can be achieved by adding a &lt;code&gt;data&lt;/code&gt; array with a &lt;code&gt;handle&lt;/code&gt; value to the source, so that code becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;        $sources[] = array('heading' =&amp;gt; 'Translations');&#xA;&#xA;        $sources['translations:untranslated'] = array(&#xA;            'label'    =&amp;gt; Craft::t('Untranslated'),&#xA;            'criteria' =&amp;gt; array('translationCompleted' =&amp;gt; array('0', null)),&#xA;            'data'     =&amp;gt; array('handle' =&amp;gt; 'untranslated'),&#xA;        );&#xA;&#xA;        $sources['translations:translated'] = array(&#xA;            'label'    =&amp;gt; Craft::t('Translated'),&#xA;            'criteria' =&amp;gt; array('translationCompleted' =&amp;gt; '1'),&#xA;            'data'     =&amp;gt; array('handle' =&amp;gt; 'translated'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't appear to work for nested sources however.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-04-16T10:52:10.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9250" PostTypeId="1" AcceptedAnswerId="9251" CreationDate="2015-04-16T11:11:58.810" Score="0" ViewCount="73" Body="&lt;p&gt;I've got a logo uploaded through the backend, I've got the file locally &amp;amp; can see it on the craft login screen and the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Colleague can see it fine on the front end on a template, but I cannot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loading it in on the front end with: &lt;code&gt;{{ craft.rebrand.logo.url }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just seems to timeout while the page is being loaded:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LOgv9.png&quot; alt=&quot;network tab&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Storage folder is 777'd recursively, I presume it's loading it through that (due to the /cpresources/ path)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any ideas?&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2015-04-16T12:33:06.673" Title="logo uploaded through backend doesn't come through (on my environment)" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9251" PostTypeId="2" ParentId="9250" CreationDate="2015-04-16T12:33:06.673" Score="1" Body="&lt;p&gt;My colleague had used a  local server name 1 char different to mine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The domain I was using didn't match the &quot;siteUrl&quot; param in the general config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image was loading in with a different domain to what I was on.&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2015-04-16T12:33:06.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9252" PostTypeId="2" ParentId="9240" CreationDate="2015-04-16T12:38:38.110" Score="3" Body="&lt;p&gt;&lt;code&gt;{% requirePermission %}&lt;/code&gt; can only take on parameter. To make your code a little easier to manage, you might want to check for false in your conditional and exit. That way you wont have to worry about closing the if statement later in your template code. You could even stick the code below in a partial &lt;code&gt;_checkPermissions.html&lt;/code&gt; template to include on your pages that require it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% if not currentUser.can('perm1') and not currentUser.can('perm2')  %}&#xA;       {% exit 403 %}&#xA;    {% endif %}&#xA;{% else  %}&#xA;    {% exit 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-16T12:46:01.060" LastActivityDate="2015-04-16T12:46:01.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9253" PostTypeId="2" ParentId="9240" CreationDate="2015-04-16T13:14:02.403" Score="4" Body="&lt;p&gt;The &lt;code&gt;{% requirePermission 'perm1' %}&lt;/code&gt; tag only supports a single permission. Behind the scenes it's &lt;em&gt;effectively&lt;/em&gt; the same as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser.can('perm1') %}&#xA;    {% exit 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I think either what you already have, or this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser.can('perm1') and not currentUser.can('perm2') %}&#xA;    {% exit 403 %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;!-- Your page stuff --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is probably your best bet at the moment. Checking that the user &lt;em&gt;doesn't&lt;/em&gt; have both permissions, is the same as checking they &lt;em&gt;do&lt;/em&gt; have one or the other.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-04-16T13:31:01.277" LastActivityDate="2015-04-16T13:31:01.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9254" PostTypeId="1" AcceptedAnswerId="9261" CreationDate="2015-04-16T13:49:13.967" Score="1" ViewCount="148" Body="&lt;p&gt;Hoping this is possible. I want to split the username and password error message to return it separately depending whether it is username or password that is incorrect and not just a the generic (Invalid username or password) message. How do I go about this? I don't require answers as to whether it is more secure or not just whether it is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-04-16T18:20:45.770" Title="How to split the user login error message between username and password?" Tags="&lt;users&gt;&lt;form&gt;&lt;login&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9255" PostTypeId="1" CreationDate="2015-04-16T14:51:09.177" Score="3" ViewCount="996" Body="&lt;p&gt;Since many of us are coming from EE, I will reference these EE addons as examples:&lt;br&gt;&#xA;- channel polls&lt;br&gt;&#xA;- vwm polls&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this question but it didn't help much:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/641/how-to-deal-with-client-input-your-site&quot;&gt;How to deal with client input your site?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also there is UPVOTE plugin but it's not really polls.&lt;br&gt;&#xA;&lt;a href=&quot;https://www.doublesecretagency.com/plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.doublesecretagency.com/plugins/upvote&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important that it works like field type and that you can add as many options as you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="3545" LastEditorUserId="45" LastEditDate="2019-04-01T17:14:37.393" LastActivityDate="2019-04-01T17:14:37.393" Title="Are there any poll plugins for Craft CMS?" Tags="&lt;plugins&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9256" PostTypeId="2" ParentId="9255" CreationDate="2015-04-16T15:50:36.780" Score="4" Body="&lt;p&gt;The only public listing of plugins that I'm aware of is on the &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;straightupcraft site&lt;/a&gt; — so if nothing is there that meets your requirements then probably not. New plugins are getting added all the time though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your requirements, developing a custom solution would probably not be too difficult though. If you want to give it a shot and have questions feel free to ask.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-16T15:50:36.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9257" PostTypeId="1" AcceptedAnswerId="9259" CreationDate="2015-04-16T16:04:47.573" Score="1" ViewCount="486" Body="&lt;p&gt;I'm trying to build my first, very simple, one file plugin.  I'm having difficulty with a basic task and I can't find any documentation to help me out. Keep in mind that there is no validation whatsoever, I'm just trying to get it to work first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $section = craft()-&amp;gt;sections-&amp;gt;getSectionById($entry['sectionId']);&#xA;        if ($section['handle'] == 'institutions')&#xA;        {&#xA;            $full_address = urlencode(rtrim($entry['adresse'].','.$entry['ville'].','.$entry['province'].','.$entry['codePostal']));&#xA;            $json = json_decode(file_get_contents(&quot;https://maps.googleapis.com/maps/api/geocode/json?address={$full_address}&amp;amp;sensor=false&amp;amp;region=ca&amp;amp;key=AIzaSyDhPYj9UwwUYNZYSz9Fo-j75gCJKWVdFeY&quot;));&#xA;            $entry-&amp;gt;setRawPostContent('latitude' ,$json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lat);&#xA;            $entry-&amp;gt;setRawPostContent('longitude', $json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lng);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a listener on entries.onBeforeSaveEntry and it works well.  I check if the section handle is what I need and then I look into the entry data to grab the address fields and query Google map.  All of that is working like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to put the data back into the entry for the lat and long filed that exists in my entry type.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry['latitude'] = $json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lat;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gives me an error saying latitude is not defined, which is false because I can output the value from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setRawPostContent('latitude' ,$json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lat);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea?  I can't find any documentation or google search that can help me out.&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2015-04-16T17:15:06.833" Title="onBeforeSaveEntry listener to add/modify data of some fields" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9258" PostTypeId="2" ParentId="9257" CreationDate="2015-04-16T16:41:13.147" Score="1" Body="&lt;p&gt;Not sure if this is the recommended way to do this, but this works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;myField = 'myValue';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in your case probably this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;latitude = $json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lat;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-16T16:46:31.210" LastActivityDate="2015-04-16T16:46:31.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9259" PostTypeId="2" ParentId="9257" CreationDate="2015-04-16T17:15:06.833" Score="2" Body="&lt;p&gt;See Brandon's post on this here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust/4487#4487&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically when you're setting new custom field values, you should use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;setContentFromPost&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'latitude' =&amp;gt; $json-&amp;gt;results[0]-&amp;gt;geometry-&amp;gt;location-&amp;gt;lat,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-16T17:15:06.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9260" PostTypeId="2" ParentId="9248" CreationDate="2015-04-16T17:44:01.687" Score="3" Body="&lt;p&gt;I think this is going to be one of those impossible to answer questions because of so many unknown variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MySQL could be screwing it up because it depends on 1) MySQL server configuration and 2) The charset and collation of the database, the tables, the connection strings, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file system itself could be screwing it up because they all tend to have different treatments for character encodings (HFS, NTFS, FAT, EXT, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throw in the fact that you said this has been on various developer machines and touched by an unknown number of other programs, it makes it very difficult to diagnose.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-16T17:44:01.687" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9261" PostTypeId="2" ParentId="9254" CreationDate="2015-04-16T18:20:45.770" Score="1" Body="&lt;p&gt;There is not a built-in way. If you take a look at the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L726&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;UserSessionService&lt;/code&gt;&lt;/a&gt;, you'll see that messages are returned based on an error code. When a username and password combination fail, it triggers this single message to be returned.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-16T18:20:45.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9262" PostTypeId="1" CreationDate="2015-04-16T20:02:31.203" Score="0" ViewCount="62" Body="&lt;p&gt;I would like to add a google map in an entry edit page for certain entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have a plugin started to go and grab the lat and long for the entered address.  What I'm now trying to achieve is to add the map to the admin page. I'd like to put it in the right pane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at &lt;code&gt;hookRegisterCpRoutes()&lt;/code&gt; but I don't think it's possible to override pre-existing routes.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is their a way to achieve my goal or my plugin should be taking care of the entire entry type instead ?&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2015-04-16T20:02:31.203" Title="Can I add information to a CP new entries page?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9263" PostTypeId="1" CreationDate="2015-04-16T21:31:08.857" Score="0" ViewCount="689" Body="&lt;p&gt;In my routes file I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'micros-test/guest-booking/(?P&amp;lt;bookingId&amp;gt;[a-z0-9-]*)' =&amp;gt; 'micros-test/guest-booking',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works fine for URLS like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/en/micros-test/guest-booking/some-valid-alphanumeric-id&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However I need to add another that I can't get working, this time with a querystring value, such as this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/en/micros-test/guest-reset-password?token=some-valid-alphanumeric-id&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I get that to route to my endpoint and pass on the token parameter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this but to no avail:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'micros-test/guest-reset-password/?token=(?P&amp;lt;token&amp;gt;[a-z0-9-]*)' =&amp;gt; 'micros-test/guest-reset-password',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What have I got wrong there?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-17T13:22:58.770" Title="How can I reroute this querystring URL?" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9264" PostTypeId="2" ParentId="9263" CreationDate="2015-04-16T21:53:25.347" Score="2" Body="&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; - looks like it's the specific use of &lt;code&gt;token&lt;/code&gt; as a parameter that's causing the problem.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The route doesn't need to account for the get parameters, so it only needs to be &lt;code&gt;micros-test/guest-reset-password&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then fetch the parameter using &lt;code&gt;craft.request.getParam('token')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2015-04-17T13:22:58.770" LastActivityDate="2015-04-17T13:22:58.770" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9265" PostTypeId="1" AcceptedAnswerId="9267" CreationDate="2015-04-16T21:54:52.160" Score="4" ViewCount="982" Body="&lt;p&gt;We have a site that is performing very poorly with very long load times and I'm guessing it may be related to caching but have no idea how/why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site's homepage was loading very slowly while in development due to a mega menu with a lot of queries to create primary and secondary navigation. I cached that globally while in dev and the page performance improved about 70%. I did some further global caching {% cache globally %} for things like the site footer and than added some regular caching {% cache %} for entry-specific template content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once this was all done, performance was very good. However, then we launched the site and took the site out of dev mode (which is had previously been in). The launch was on the same account - nothing changed - just pointed the DNS to this account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since that time, performance has been poor again. Further, when logging into the control panel, we always see this (which we never saw while in dev mode):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hZX3Q.png&quot; alt=&quot;image of cp stale template progress&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's odd also is the circle and bar progress indicators are always in the exactly pictured state - they're never more or less along in terms of position (over the course of weeks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, if I go into the CP settings area and Clear Caches, performance seems to pick up again for a little while.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm at a complete loss as to what may be happening that is causing these issue and any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Mike&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-10-31T06:16:05.527" Title="Cache issues making site super slow in production but not in dev mode" Tags="&lt;cache&gt;&lt;devmode&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9266" PostTypeId="1" CreationDate="2015-04-16T23:14:13.820" Score="1" ViewCount="1296" Body="&lt;p&gt;I have already retrieved a set of all Entries from a channel and need to now find one in the template without hitting the DB again (this find is in a loop so I don't want to grab a single result from the DB for every iteration through the loop):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').get %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I then pluck out a specific entry by field match? I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entries.find('myFieldHandle', mySearchVariable) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to work for me though in that I don't get a match.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-20T12:24:24.393" Title="How can I filter/find on an ElementCriteriaModel?" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9267" PostTypeId="2" ParentId="9265" CreationDate="2015-04-17T00:07:21.830" Score="4" Body="&lt;p&gt;This article (&lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/stuck-tasks&lt;/a&gt;) from Brad's comment was indeed the way to address this - and our logs did show this exceeding the php execution time. Thanks Brad!&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2015-04-17T00:07:21.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9268" PostTypeId="1" AcceptedAnswerId="9269" CreationDate="2015-04-17T00:41:12.953" Score="2" ViewCount="79" Body="&lt;p&gt;(First off, I apologize for the really long question, but any help I can get would be appreciated!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hello!&#xA;I am taking over a bunch of sites that a developer had created for a company (I am not a developer, but I have some coding knowledge and wordpress experience).  Anyway, I want to switch over the site from just php and sql to a CMS and I feel like Craft might be the one.  However, I feel like it might just be over my head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the cms needs to manage an event (or if 1 instance of Craft can handle multiple events, each with its own website, even better!)&#xA;Each event visits up to 40 cities a year and has up to 3500 attendees at each one.  And all information regarding attendees, venue, host hotel, faculty, schedule, etc. is all stored in a data base.  And all that information is displayed on the site on pages that are created dynamically by the cities name, year, etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How would I transfer all of that into Craft and organize it appropriately?  And would this be possible for someone with limited knowledge of coding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am willing to do all the research necessary, or if its way out of my league, hire a developer to do it for me.  I just need a nudge in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&#xA;-Alex&lt;/p&gt;&#xA;" OwnerUserId="3546" LastEditorUserId="22" LastEditDate="2017-05-10T00:06:40.410" LastActivityDate="2017-05-10T00:06:40.410" Title="Utilizing/ Converting another database with craft" Tags="&lt;database&gt;&lt;craft-features&gt;&lt;conversion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9269" PostTypeId="2" ParentId="9268" CreationDate="2015-04-17T00:59:49.950" Score="3" Body="&lt;p&gt;Welcome to Craft! Craft does not require coding experience to set up fields and relationships (attendees to events, for example). All of that is handled from the control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Displaying the fields on the frontend requires some knowledge of &lt;a href=&quot;http://buildwithcraft.com/docs/twig-primer&quot; rel=&quot;nofollow&quot;&gt;Twig&lt;/a&gt;, the templating engine Craft uses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transferring the data may require some pretty heavy coding, depending on how the data is currently structured. There are a few importing plugins (&lt;a href=&quot;https://github.com/boboldehampsink/import/&quot; rel=&quot;nofollow&quot;&gt;here's a popular one&lt;/a&gt;) that might be able to help. From your numbers above, migrating by hand may not be an option, so you might need to invest in some research or hire a developer to help with that phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft has a lot to offer out of the box in terms of organizing content. I could see you making use out of singles and structures to manage events, hotels, attendees, etc. I recommend reading through the &lt;a href=&quot;http://buildwithcraft.com/docs/introduction&quot; rel=&quot;nofollow&quot;&gt;introduction documentation&lt;/a&gt; to get a hold on how Craft is set up.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-17T01:06:46.877" LastActivityDate="2015-04-17T01:06:46.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9271" PostTypeId="2" ParentId="9266" CreationDate="2015-04-17T03:38:06.150" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;I may have found a better option for you. Looks like you were on the right track after all, but with some quotes misplaced.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection') %}&#xA;{% set entry = entries.find({myFieldHandle:'mySearchVariable'})[0] %}&#xA;{{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although looks like this hits the database again (thanks carlcs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe back to the orginal answer then, which was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection') %}&#xA;{% for entry in entries if entry.myFieldHandle == 'myVariable' %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-17T17:26:43.160" LastActivityDate="2015-04-17T17:26:43.160" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9273" PostTypeId="1" CreationDate="2015-04-17T08:55:08.863" Score="3" ViewCount="376" Body="&lt;p&gt;I have a problem with the admin panel being very slow when saving an entry. It takes about 30 seconds to save an entry. I use a matrix for the different part of the entry (imgs, textfields, titles and so on). Does anyone else have this problem, and have someone found a solution for this? :)&lt;/p&gt;&#xA;" OwnerUserId="874" LastEditorUserId="874" LastEditDate="2015-04-17T09:00:53.990" LastActivityDate="2015-04-17T16:01:12.397" Title="Saving entries in admin panel" Tags="&lt;entry&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9274" PostTypeId="1" AcceptedAnswerId="14517" CreationDate="2015-04-17T10:01:29.637" Score="6" ViewCount="817" Body="&lt;p&gt;I am trying to paginate grouped entries as follows...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchParam = craft.request.getParam('q') %}&#xA;&#xA;{% set groups = craft.entries({&#xA;    search: searchParam&#xA;})|group('section') %}&#xA;&#xA;{% for entries in groups %}&#xA;    {% paginate entries.limit(10) as pageEntries %}&#xA;&#xA;    {% endpaginate %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it is throwing this error on the paginate line: &lt;code&gt;Array to string conversion&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How else can I achieve this functionality?&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2016-04-05T11:33:28.810" Title="Paginate Grouped Entries" Tags="&lt;entries&gt;&lt;pagination&gt;&lt;group&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9275" PostTypeId="1" AcceptedAnswerId="9279" CreationDate="2015-04-17T10:20:41.887" Score="1" ViewCount="129" Body="&lt;p&gt;Using the entries.onSaveEntry event, how would I ensure it's only applied to entries in a particular section? Or is there a way to make a distinction between an entry saved from the control panel and an entry created on a front-end form?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-04-17T11:48:05.650" Title="Calling onSaveEntry event only for one section" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9276" PostTypeId="2" ParentId="9255" CreationDate="2015-04-17T10:30:16.757" Score="-4" Body="&lt;p&gt;Poll need to work as field type  so it can be done per entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as &lt;a href=&quot;https://devot-ee.com/add-ons/channel-polls&quot; rel=&quot;nofollow&quot;&gt;https://devot-ee.com/add-ons/channel-polls&lt;/a&gt;&#xA;or &#xA;&lt;a href=&quot;https://devot-ee.com/add-ons/vwm-polls&quot; rel=&quot;nofollow&quot;&gt;https://devot-ee.com/add-ons/vwm-polls&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its important to not have row limits about voting options..&lt;/p&gt;&#xA;" OwnerUserId="3550" LastActivityDate="2015-04-17T10:30:16.757" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9277" PostTypeId="1" AcceptedAnswerId="9278" CreationDate="2015-04-17T11:16:53.923" Score="2" ViewCount="7297" Body="&lt;p&gt;I have a date field, and I want it to be possible for this to be empty. How it works now is that if you don't enter a value, it takes today's date. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="874" LastEditorUserId="57" LastEditDate="2016-01-20T19:01:30.050" LastActivityDate="2018-07-30T21:48:50.143" Title="Empty date field becomes today's date" Tags="&lt;datetime&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9278" PostTypeId="2" ParentId="9277" CreationDate="2015-04-17T11:37:33.457" Score="8" Body="&lt;p&gt;That happens because the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter returns the current date for null values / empty strings.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the value passed to the date filter is null, it will return the current date by default.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To work around this, you would add a conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myDate %}&#xA;    Date: {{ entry.myDate|date('Y-m-d') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another way to do this is to use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;noreferrer&quot;&gt;ternary operator&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myDate ? entry.myDate|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-17T11:37:33.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9279" PostTypeId="2" ParentId="9275" CreationDate="2015-04-17T11:48:05.650" Score="4" Body="&lt;p&gt;You would compare against the entry's section / entry type in a conditional. The entry modal is available from the event params &lt;code&gt;$event-&amp;gt;params['entry']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if($entry-&amp;gt;section['handle'] == 'mySection' &amp;amp;&amp;amp; $entry-&amp;gt;type['handle'] == 'myEntryType')&#xA;    {&#xA;        // Execute for mySection / myEntryType entries only!&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-17T11:48:05.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9280" PostTypeId="1" CreationDate="2015-04-17T13:08:54.887" Score="1" ViewCount="320" Body="&lt;p&gt;I have a user model that contains several Matrix fields, but for the sake of this question I'll just discuss one of those fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The field we'll discuss is a phoneMatrix.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phoneMatrix data can come in from multiple sources. What I mean is, there is no one place where a user can add/update/delete phone numbers. There will be a user profile page, but other applications on the website will allow for phone numbers to be saved/added/deleted. Given this, it is not optimal for me to use the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser($userModel)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason it is not optimal is because, for whatever unholy reason, Craft assumes that if matrix data does not exist after being set from POST that the missing data should be deleted. This assumption is not conducive to our process, yes we could pull all phone numbers for each save/update but that's unnecessary overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has advice on alternative ways to save user data that avoids this problem it would be very much appreciated. I'll be looking into it on my own and if I find an answer I'll make sure to post it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Thanks in advance for any help!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-17T13:08:54.887" Title="Best way to save user data?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;matrix&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9281" PostTypeId="2" ParentId="9273" CreationDate="2015-04-17T16:01:12.397" Score="1" Body="&lt;p&gt;To debug where the delay is, you can enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, which will write out a bunch of code and database profiling information to your log files in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you do that, save an entry then find that request in the log files.  You can look at the timestamps on that request to see what part of the code the 30 second delay is occurring on, which will point you in the direction of the underlying problem.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-17T16:01:12.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9282" PostTypeId="2" ParentId="9235" CreationDate="2015-04-17T19:05:06.500" Score="1" Body="&lt;p&gt;I think you're confusing Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#userSessionDuration&quot; rel=&quot;nofollow&quot;&gt;userSessionDuration&lt;/a&gt; - which is the amount of time that you can stay logged into the control panel - with PHP's &lt;a href=&quot;https://php.net/manual/en/features.sessions.php&quot; rel=&quot;nofollow&quot;&gt;session&lt;/a&gt; (which is what &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpSessionService&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;httpSession&lt;/a&gt; is a wrapper for).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you get logged out of the control panel, the former userSession is killed, but you still keep the same underlying PHP session ID and cookie.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-17T19:05:06.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9283" PostTypeId="1" AcceptedAnswerId="9286" CreationDate="2015-04-17T20:55:11.493" Score="1" ViewCount="229" Body="&lt;p&gt;I have been staring &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6580/how-can-i-use-csrf-protection-with-ajax-routes&quot;&gt;at this SE post on deleting using ajax&lt;/a&gt; and it's just not clicking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a plugin with a list of users. Each user has a delete icon next to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;&amp;lt;td class=&quot;thin&quot;&amp;gt;&amp;lt;a class=&quot;delete delete-usericon&quot; title=&quot;Delete&quot; role=&quot;button&quot; data-id=&quot;{{user.id}}&quot; data-name={{user.name}}&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get my javascript, I am using the &lt;code&gt;init&lt;/code&gt; method in my main plugin class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft-&amp;gt;request-&amp;gt;isCpRequeset() &amp;amp;&amp;amp; craft()-&amp;gt;userSession-&amp;gt;isLoggedIn())&#xA;{&#xA;    craft-&amp;gt;template-&amp;gt;includeJsResource('path/to/script.js');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far, so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;script.js&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;$('.delete-user').click(function(event){&#xA;    var data = {&#xA;        'id': event.currentTarget.dataset.id,&#xA;        'csrfToken': // this is where i'm stuck&#xA;    };&#xA;&#xA;    $.ajax({&#xA;        'type': 'post',&#xA;        'contentType': 'application/x-www-form-urlencoded; charset=utf-8',&#xA;        'cache': false,&#xA;        'url': 'path/to/deleteUser',&#xA;        'data': data,&#xA;        'dataType': 'json',&#xA;         'timeout': 5000&#xA;    }).done(function(status){&#xA;        console.log(status);&#xA;    }).fail(function(error){&#xA;        console.log(error);&#xA;    })&#xA;});&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UserController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;actionDeleteUser() {&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;    error_log(__FUNCTION__); // to just test im getting this far.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can imagine, I'm getting a &lt;code&gt;400 Bad Request The CSRF token could not be verified.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can put a hidden text field on my users &quot;home page&quot; using &lt;code&gt;{{getCsrfInput}}&lt;/code&gt; and then grab that value no problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I log out my &lt;code&gt;data&lt;/code&gt; object, I can see it's got the correct &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;csrfToken&lt;/code&gt; but I will still get the 400. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to pass the token along with the data to the controller just yet it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I believe I see my error, but I'm confident there is a better way (at least I think there could be)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't passing the correct name/key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;script.js&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;     'id': event.currentTarget.dataset.id,&#xA;     'CRAFT_CSRF_TOKEN': $('[name=&quot;CRAFT_CSRF_TOKEN&quot;]).val()&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting a 404 back now - great. I can figure that out. What i'm curious about is: Is there a better way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put the &lt;code&gt;{{getCsrfInput}}&lt;/code&gt; on my &quot;home&quot; page of my plugin that lists the users. I feel like i've just done a nice hack-job on my plugin.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-17T22:04:16.940" Title="Delete plugin record via ajax" Tags="&lt;plugin-development&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9284" PostTypeId="1" AcceptedAnswerId="9285" CreationDate="2015-04-17T21:58:06.957" Score="0" ViewCount="461" Body="&lt;p&gt;In my plugin, I'd like to catch errors when they appear in the control panel, so I can handle them differently. However, from the front-end, I'd like to keep the &lt;em&gt;default&lt;/em&gt; Craft-style handling of error messages.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;try&#xA;{&#xA;    // Some code which might produce an error&#xA;}&#xA;catch (\Exception $e)&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        // Do something with $e-&amp;gt;getMessage()&#xA;    } else {&#xA;        // Use default Craft error handling&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of that is working for me, just trying to sort out how to do this part...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Use default Craft error handling&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I get my error handling to just go back to what Craft was doing by default?&lt;/strong&gt; I want to make sure my errors still appear in devMode per usual.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-04-17T22:01:08.670" Title="Return to default error handling" Tags="&lt;plugin-development&gt;&lt;error&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9285" PostTypeId="2" ParentId="9284" CreationDate="2015-04-17T22:01:08.670" Score="1" Body="&lt;p&gt;Just re-throw the exception and pretend like nothing ever happened...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;try&#xA;{&#xA;    // Some code which might produce an error&#xA;}&#xA;catch (\Exception $e)&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        // Do something with $e-&amp;gt;getMessage()&#xA;    } else {&#xA;        // Nothing to see here...&#xA;        throw $e;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-17T22:01:08.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9286" PostTypeId="2" ParentId="9283" CreationDate="2015-04-17T22:04:16.940" Score="3" Body="&lt;p&gt;Here's how you can pass in the CSRF token via JavaScript: &lt;a href=&quot;http://buildwithcraft.com/help/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-17T22:04:16.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9287" PostTypeId="1" AcceptedAnswerId="9289" CreationDate="2015-04-17T23:06:29.313" Score="1" ViewCount="349" Body="&lt;p&gt;I have a Matrix field with a single block type and within that, a number of fields that I need to pull out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for roomContent in hotelEntry.roomsAvailable %}&#xA;    {% if roomContent.code == room.roomTypeCode %}&#xA;        &amp;lt;p&amp;gt;room code = {{ roomContent.code }}&amp;lt;br&amp;gt;&#xA;            description = {{ roomContent.description }}&amp;lt;br&amp;gt;&#xA;            {% for image in roomContent.images %}&#xA;                &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ roomContent.description }}&quot; height=&quot;50&quot;&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am doing this on a listing page where there are around 60 entries, so this is resulting in a lot of calls to the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can eager load all of the data for all of the entries outside of this loop so I'm not recursively calling for data?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-18T10:42:57.443" Title="Can I eager load data within a template?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9289" PostTypeId="2" ParentId="9287" CreationDate="2015-04-18T05:08:46.460" Score="1" Body="&lt;p&gt;No you can't with any build in Craft functions. I've added &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7203963-eager-loading-of-field-relations-in-templates&quot; rel=&quot;nofollow&quot;&gt;a feature request for this on Crafts feedback site&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do for now is to use Mike Peppers excellent Plugin &quot;Fetch&quot; which pre-fetch relations for you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ser here &lt;a href=&quot;https://github.com/mdcpepper/fetch&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mdcpepper/fetch&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="1098" LastEditDate="2015-04-18T10:42:57.443" LastActivityDate="2015-04-18T10:42:57.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9290" PostTypeId="1" CreationDate="2015-04-18T17:34:05.583" Score="0" ViewCount="188" Body="&lt;p&gt;I have a matrix that contains a block with a category field. I want to loop over the matrix models, &lt;strong&gt;&lt;em&gt;in PHP&lt;/em&gt;&lt;/strong&gt;, to get data. Here's what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($user-&amp;gt;networksMatrix as $key =&amp;gt; $networkLink)&#xA;{&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networktype&quot;] = $networkLink-&amp;gt;networktype;&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networkUrl&quot;] = $networkLink-&amp;gt;networkUrl;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;networktype&lt;/strong&gt; is a category field. How do I get the get the ID of the category a user selected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I discovered that the following works: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($user-&amp;gt;networksMatrix as $key =&amp;gt; $networkLink)&#xA;{&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networktype&quot;] = $networkLink-&amp;gt;networktype-&amp;gt;ids()[0];&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networkUrl&quot;] = $networkLink-&amp;gt;networkUrl;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since &lt;strong&gt;networktype&lt;/strong&gt; is a categories field and that field is limited to 1 category I'll only ever get a single result from the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So... I just do this and I'm good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$networkLink-&amp;gt;networktype-&amp;gt;ids()[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="273" LastEditDate="2015-04-20T13:32:25.223" LastActivityDate="2015-08-23T01:31:01.153" Title="Get user field category" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9291" PostTypeId="1" AcceptedAnswerId="9294" CreationDate="2015-04-18T19:43:42.647" Score="2" ViewCount="128" Body="&lt;p&gt;On our play pages (ex. &lt;a href=&quot;http://actors-express.com.s102768.gridserver.com/plays/liaisons&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://actors-express.com.s102768.gridserver.com/plays/liaisons&lt;/a&gt;), we list our each of the cast members, their headshot and role. We did this by creating a matrix field that pulls in the Entry for each person and relates it to the specifics for the show.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iGcS2.png&quot; alt=&quot;List of Cast Members, Headshot and Role&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to write code on the template for their bio page (ex. &lt;a href=&quot;http://actors-express.com.s102768.gridserver.com/people/kristin-butler&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://actors-express.com.s102768.gridserver.com/people/kristin-butler&lt;/a&gt;) that will scan through all those matrices on play pages and find out which plays they have been in, then display a list of plays with links to each of their URLs. It would be nice to pull in what their role was in the play, but that's not a requirement at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qS9ZE.png&quot; alt=&quot;List of Past Plays and Widget for Upcoming Play&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would also perform a lookup and see if one of the plays was currently on stage (a flag on our play entry type), or if it was upcoming to pull it into the module above on the right.&lt;/p&gt;&#xA;" OwnerUserId="3554" LastActivityDate="2015-04-19T19:20:33.480" Title="Pulling Data Across Entry Types" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;entry-type&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9292" PostTypeId="1" AcceptedAnswerId="9346" CreationDate="2015-04-18T20:02:44.760" Score="2" ViewCount="116" Body="&lt;p&gt;We have hundreds of photos on our theater website from past performances. In order to sustainably manage the relationship between cast members and which photos they were in, we wanted to explore setting up some type of tagging system. Would there be a way to associating a person (Entry type) with a photo (Asset Type) at the asset level? That way, we could query the database for any photos a person is in from their bio page and assemble them into a slider.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CNbmz.jpg&quot; alt=&quot;Image Slider via FlexSlider&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3554" LastEditorUserId="3554" LastEditDate="2015-04-21T13:04:21.313" LastActivityDate="2015-04-21T13:04:36.293" Title="Tagging and Associating Photos with Entry Type" Tags="&lt;assets&gt;&lt;entry&gt;&lt;image&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9293" PostTypeId="2" ParentId="9292" CreationDate="2015-04-18T23:19:32.790" Score="2" Body="&lt;p&gt;Assets can have custom fields just like entries. You can create an entry field for the person section, and add it to the asset source field layout from your asset settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then use relations to query for the right assets or entries as you see fit!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-18T23:19:32.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9294" PostTypeId="2" ParentId="9291" CreationDate="2015-04-18T23:49:48.860" Score="4" Body="&lt;p&gt;To access related entries stored in a matrix field, you need to specify the &lt;code&gt;targetElement&lt;/code&gt; (actor/entry) and the &lt;code&gt;matrix field&lt;/code&gt; (using dot syntax 'matrixFieldHandle.entriesFieldHandle') from 'plays'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your actor biography template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Actor: {{ entry.title }}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% set plays = craft.entries.section('plays').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'actorsMatrixFieldHandle.actor'&#xA;}) %}&#xA;&#xA;Plays:&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for play in plays %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ play.title }}&amp;lt;br&amp;gt;&#xA;            {% if play.onStage %}&#xA;                &amp;lt;span class=&quot;onstage&quot;&amp;gt;ON STAGE&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the role is little more difficult — you first need to find the actor's &lt;code&gt;matrix block&lt;/code&gt; in the related 'play' record. We can do this by testing each block to see if it matches the current &lt;code&gt;entry&lt;/code&gt; (actor), or use an &lt;code&gt;if&lt;/code&gt; clause in the loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for play in plays %}&#xA;&#xA;        {% set role = '' %}&#xA;        {% for block in play.actorsMatrixFieldHandle if block.actor.first.title == entry.title %}&#xA;            {% set role = block.role %}&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            {{ play.title }}&amp;lt;br&amp;gt; &#xA;            {{ role }}&amp;lt;br&amp;gt;&#xA;            {% if play.onStage %}&#xA;                &amp;lt;span class=&quot;onstage&quot;&amp;gt;ON STAGE&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also try to set the &lt;code&gt;title&lt;/code&gt; field as a parameter to the Matrix block query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set actorBlocks = play.actorsMatrixFieldHandle.title(entry.title) %}&#xA;{% set role = actorBlocks|length ? actorBlocks.first().role : '' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="125" LastEditDate="2015-04-19T19:20:33.480" LastActivityDate="2015-04-19T19:20:33.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9295" PostTypeId="1" AcceptedAnswerId="9298" CreationDate="2015-04-19T01:49:54.943" Score="7" ViewCount="1549" Body="&lt;p&gt;Is it possible to provide different possible values per case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following formats without success.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;A&quot; or &quot;B&quot; or &quot;C&quot; %}&#xA;  {# run this if case matches A or B or C #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I saw this done somewhere else so I thought I'd give it a shot&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;A&quot; %}&#xA;{% case &quot;B&quot; %}&#xA;{% case &quot;C&quot; %}&#xA;  {# run this if case matches A or B or C #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the documentation it doesn't seem like this would be possible but wanted to check just in case. If not, any chance we'll see this sometime in the future?&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="45" LastEditDate="2015-04-19T04:37:11.767" LastActivityDate="2016-04-27T16:51:19.953" Title="&quot;A&quot; or &quot;B&quot; in switch statements?" Tags="&lt;templating&gt;&lt;switch&gt;&lt;case&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9296" PostTypeId="1" AcceptedAnswerId="9297" CreationDate="2015-04-19T02:52:17.660" Score="8" ViewCount="831" Body="&lt;p&gt;I want to include a conditional for when the 'Text' block type is returned for the first time in a loop. In css it would be first-of-type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if type == 'text' and loop.first %}&#xA;    &amp;lt;div class=&quot;centered spacer-icon m-all t-all d-all&quot;&amp;gt;&amp;lt;img src=&quot;resources/img/minus-icon.svg&quot; alt=&quot;Minus Icon&quot; width=&quot;30&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this instance my text block type is loop index 3 but I want to adjust the conditional because it is the first text type in the matrix field.&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="57" LastEditDate="2015-04-19T04:04:28.747" LastActivityDate="2015-04-19T04:04:28.747" Title="How Can I Include a Conditional for First Type of Matrix" Tags="&lt;matrix&gt;&lt;conditional&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9297" PostTypeId="2" ParentId="9296" CreationDate="2015-04-19T03:16:09.050" Score="15" Body="&lt;p&gt;You could first set a variable to test against and then change it the first time the block type appears.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstTime = true %}&#xA;&#xA;{% for block in entry.matrixField %}&#xA;&#xA;    {% if block.type == &quot;text&quot; and firstTime == true %}&#xA;&#xA;        ...Do something once...&#xA;&#xA;        {% set firstTime = false %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastActivityDate="2015-04-19T03:16:09.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9298" PostTypeId="2" ParentId="9295" CreationDate="2015-04-19T04:36:36.953" Score="12" Body="&lt;h3&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#build2771&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.6&lt;/a&gt;, this is now possible!&lt;/h3&gt;&#xA;&lt;p&gt;In fact, it works exactly like your first example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% case &amp;quot;A&amp;quot; or &amp;quot;B&amp;quot; or &amp;quot;C&amp;quot; %}&#xA;  {# run this if case matches A or B or C #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Original answer...&lt;/h3&gt;&#xA;&lt;p&gt;&lt;s&gt;&lt;strong&gt;Your first example&lt;/strong&gt; is not currently possible, but might make for a good &lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;noreferrer&quot;&gt;feature request&lt;/a&gt;.&lt;/s&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Your second example&lt;/strong&gt; is not possible, and most likely never will be. If it were added in the future, that would likely have a major (breaking) impact on all existing uses of the &lt;code&gt;switch&lt;/code&gt; statement.&lt;/p&gt;&#xA;&lt;p&gt;The way that Craft has implemented the &lt;code&gt;case&lt;/code&gt; statement is by making it completely unnecessary to supply a &lt;code&gt;break&lt;/code&gt; statement. In fact, the &lt;code&gt;break&lt;/code&gt; statement doesn't even exist natively (though can be added with the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue/&quot; rel=&quot;noreferrer&quot;&gt;MN Break and Continue&lt;/a&gt; plugin). The &lt;code&gt;case&lt;/code&gt; statement will automatically end when it hits the next &lt;code&gt;case&lt;/code&gt; statement, or the &lt;code&gt;endswitch&lt;/code&gt; statement.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;An actual solution&lt;/strong&gt; would be to use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;noreferrer&quot;&gt;macro&lt;/a&gt; or &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;noreferrer&quot;&gt;include&lt;/a&gt;. If you have multiple &lt;code&gt;case&lt;/code&gt; statements which should trigger the same behavior, I'd recommend wrapping that behavior into a macro/include, and calling that macro/include for each relevant &lt;code&gt;case&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-04-27T16:51:19.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9299" PostTypeId="1" AcceptedAnswerId="9300" CreationDate="2015-04-19T17:54:07.257" Score="1" ViewCount="122" Body="&lt;p&gt;I have two instances of Craft on the same server. From within a plugin controller in Craft #1, I want to be able to get entries from Craft #2. Can this be done and if so, how?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-10-16T23:11:15.830" Title="Is it possible to get another Craft's webApp from within a Craft plugin controller" Tags="&lt;plugin-development&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9300" PostTypeId="2" ParentId="9299" CreationDate="2015-04-19T19:30:27.963" Score="1" Body="&lt;p&gt;Indeed... this will do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require '../other/craft/app/bootstrap.php';&#xA;$entry = $craft-&amp;gt;entries-&amp;gt;getEntryById($id);&#xA;&#xA;echo 'Other Craft install entry title:'.$entry-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-16T23:11:15.830" LastActivityDate="2015-10-16T23:11:15.830" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9301" PostTypeId="1" AcceptedAnswerId="9302" CreationDate="2015-04-19T20:50:18.987" Score="3" ViewCount="1974" Body="&lt;p&gt;I'm having issues with getting results from a query. I have 2 search parameters which i have set to variables. I would like to match both of these to get results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment the query is returning zero results. I think this is because it is turning the variables into strings. Replacing the variables with hardcoded values does return results. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryKeyword = craft.request.getParam('q') %}&#xA;{% set queryLocation = craft.request.getParam('l') %}&#xA;&#xA;{%&#xA;    set entries = craft.entries.section('schools').find({&#xA;       search: 'body:queryKeyword categories:queryLocation'&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;    set entries = craft.entries.section('schools').find({&#xA;       search: 'body:' + queryKeyword + 'categories:' + queryLocation,&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very new to Craft CMS and am not very experienced in PHP/MySQL so any help would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3556" LastActivityDate="2015-04-20T09:16:33.827" Title="How to query using variables" Tags="&lt;entries&gt;&lt;search&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9302" PostTypeId="2" ParentId="9301" CreationDate="2015-04-19T21:34:14.827" Score="5" Body="&lt;p&gt;I think you are using the wrong string concatination operator. &lt;code&gt;~&lt;/code&gt; is the twig string concatination operator (vs &lt;code&gt;.&lt;/code&gt; for php and &lt;code&gt;+&lt;/code&gt; for javascript).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;  set entries = craft.entries.section('schools').find({&#xA;   search: 'body:' ~ queryKeyword ~ ' categories:' ~ queryLocation,&#xA;  })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-04-20T03:29:48.570" LastActivityDate="2015-04-20T03:29:48.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9303" PostTypeId="2" ParentId="8571" CreationDate="2015-04-20T02:22:06.723" Score="3" Body="&lt;p&gt;You touch on many of the important differences already, but one of the key factors that influences whether I choose a category or structure is whether I need to manually order the members of the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when listing all entries in a certain &lt;em&gt;category&lt;/em&gt;, you can choose to order them by various criteria using the &lt;code&gt;order&lt;/code&gt; parameter on &lt;code&gt;craft.entries&lt;/code&gt;. From the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Possible values include 'title', 'id', 'authorId', 'sectionId', 'slug', 'uri', 'postDate', 'expiryDate', 'dateCreated', and 'dateUpdated', as well as any textual custom field handles.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I don't think you can drag and drop them into the order you want in the same way you can with entries in a &lt;em&gt;structure&lt;/em&gt;. When listing all the entries in a structure, you can choose an arbitrary order in which to list them.&lt;/p&gt;&#xA;" OwnerUserId="3542" LastActivityDate="2015-04-20T02:22:06.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9306" PostTypeId="1" AcceptedAnswerId="9308" CreationDate="2015-04-20T04:07:46.367" Score="2" ViewCount="648" Body="&lt;p&gt;I'm struggling with how to do this in Twig... I feel like it would be easier in a full programming language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an entry's categories look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A&#xA;    - A1&#xA;    - A2&#xA;B&#xA;C&#xA;    - C1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to output a list like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A &amp;gt; A1&#xA;A &amp;gt; A2&#xA;B&#xA;C &amp;gt; C1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to figure out how to avoid printing all the top-level categories on their own. This is what I've managed to output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A&#xA;A &amp;gt; A1&#xA;A &amp;gt; A2&#xA;B&#xA;C&#xA;C &amp;gt; C1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a feeling I'm going to feel dumb when someone answers this, but any help is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: I've found &lt;em&gt;a&lt;/em&gt; solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before listing the categories, I run a &lt;code&gt;for&lt;/code&gt; loop on just the entry's level 2 categories and collect their parents' IDs using an empty array and the &lt;code&gt;merge&lt;/code&gt; filter. Then, when listing the categories, I put a conditional so that level 1 categories are not listed if their ID is in the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems an awkward way to do it, and I'm still interested in better solutions.&lt;/p&gt;&#xA;" OwnerUserId="3542" LastEditorUserId="3542" LastEditDate="2015-04-20T07:04:31.460" LastActivityDate="2015-04-20T11:11:35.043" Title="Display an entry's level 1 categories only if the entry is not related to any of that category's children" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9307" PostTypeId="2" ParentId="9306" CreationDate="2015-04-20T07:47:06.233" Score="1" Body="&lt;p&gt;I also had to make an array of categories that have children related to the entry. Then hide those categories when running the output loop. This is as concise as I could make the code. Assuming your category field name is &lt;code&gt;myCats&lt;/code&gt;, this will do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set hiddenCats = [] %}&#xA;{% for category in entry.myCats.level(2) %}&#xA;  {% set hiddenCats = hiddenCats|merge([category.parent.id]) %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for category in entry.myCats if category.id not in hiddenCats %}&#xA;    &amp;lt;li&amp;gt;&#xA;      {% if category.parent %}&#xA;        {{ category.parent.title }} &amp;amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {{ category.title }}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2015-04-20T11:11:35.043" LastActivityDate="2015-04-20T11:11:35.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9308" PostTypeId="2" ParentId="9306" CreationDate="2015-04-20T08:12:48.503" Score="2" Body="&lt;p&gt;Collecting all of the categories' ancestors is probably the way to go in that case. So the solution you already posted within your question is more or less the same as I was about to post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of having a conditional in the output loop, you could also prepare an array of your bottom level category models using Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter (I always try to separate output from query / logic blocks in my templates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works with any number of category levels.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCategories = craft.categories.relatedTo(entry) %}&#xA;&#xA;{% set ancestorCatIds = [] %}&#xA;{% for category in allCategories %}&#xA;    {% set ancestorCatIds = ancestorCatIds|merge(category.ancestors.ids()) %}&#xA;{% endfor %}&#xA;&#xA;{% set bottomCatIds = allCategories.ids()|without(ancestorCatIds) %}&#xA;{% set bottomCategories = craft.categories.id(bottomCatIds) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for category in bottomCategories %}&#xA;        &amp;lt;li&amp;gt;{{ macros.catBreadcrumbs(category) }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I made a macro that outputs the category breadcrumbs, to have even less logic in the output block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro catBreadcrumbs(category) %}&#xA;    {% set ancestorCategories = category.ancestors.find() %}&#xA;    {% set ancestorCategories = ancestorCategories|merge([category]) %}&#xA;    {{ ancestorCategories|join(' &amp;gt; ') }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-20T09:22:09.937" LastActivityDate="2015-04-20T09:22:09.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9309" PostTypeId="1" CreationDate="2015-04-20T08:24:41.717" Score="7" ViewCount="849" Body="&lt;p&gt;When I write an article and save it, I want to verify my text. &#xA;I don't want publish my article immediately.&#xA;If I'm tired, I sometimes forget to disable the Lightswitch 'Status'.&#xA;So, how can I disable it by default?&lt;/p&gt;&#xA;" OwnerUserId="3558" LastEditorUserId="273" LastEditDate="2015-04-20T13:32:17.650" LastActivityDate="2017-10-11T11:54:32.990" Title="Change default status of entry publication (Lightswitch 'Status')" Tags="&lt;entries&gt;&lt;status&gt;&lt;lightswitch&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9310" PostTypeId="2" ParentId="9309" CreationDate="2015-04-20T08:40:58.317" Score="1" Body="&lt;p&gt;There's no setting to define a default master status for entries, but there's locale specific statuses that can be set to a default in the section's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This requires Craft Pro and more than one locale configured though.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-20T08:40:58.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9311" PostTypeId="2" ParentId="9301" CreationDate="2015-04-20T09:16:33.827" Score="1" Body="&lt;p&gt;Assuming your &quot;categories&quot; field is in fact a &lt;a href=&quot;http://buildwithcraft.com/docs/categories-fields&quot; rel=&quot;nofollow&quot;&gt;categories field&lt;/a&gt; then I'd recommend to&#xA;use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter to filter by that category instead of throwing everything into the &lt;a href=&quot;http://buildwithcraft.com/docs/searching#templating&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;search&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryLocation = craft.request.getParam('l') %}&#xA;{% set queryKeyword = craft.request.getParam('q') %}&#xA;&#xA;{# Set relationParam only if the param is set and a category with that slug exists #}&#xA;{% set category = craft.categories.group('location').slug(queryLocation).first() %}&#xA;{% set relationParam = queryLocation and category ? {targetElement: category} : '' %}&#xA;&#xA;{# Set searchParam only if the param is set #}&#xA;{% set searchParam = queryKeyword ? 'body:' ~ queryKeyword : '' %}&#xA;&#xA;{# Get the filtered entries #}&#xA;{% set entries = craft.entries.section('news').relatedTo(relationParam).search(searchParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-20T09:16:33.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9312" PostTypeId="1" AcceptedAnswerId="9324" CreationDate="2015-04-20T10:04:19.980" Score="1" ViewCount="369" Body="&lt;p&gt;Is there an existing plugin or a built-in way of adding an &quot;add me to mailing list&quot; button to a contact form? Not just that it gets stored in the database as a lightswitch, but so it actually subscribes them (or at least sends them a sign-up confirmation email)?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="57" LastEditDate="2015-04-20T16:38:49.090" LastActivityDate="2015-04-20T19:55:48.287" Title="Adding a mailing list subscribe to contact form" Tags="&lt;plugins&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9313" PostTypeId="1" CreationDate="2015-04-20T10:19:48.637" Score="0" ViewCount="164" Body="&lt;p&gt;I want to ensure that cache is set per domain at a config level. So rather than saying something like this in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key craft.config.getHostInfo ~ '.' ~ entry.slug ~ '.masterPrimaryNav' %}&#xA;    foo&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to set this in config so the cache key is prepended automatically. I had hoped that the general appId would help this on config, but I can't see that being set in the cache key when I set it: &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#appId&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-20T17:17:32.947" Title="How is appID used in caching?" Tags="&lt;config&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9314" PostTypeId="2" ParentId="9309" CreationDate="2015-04-20T11:33:29.603" Score="6" Body="&lt;p&gt;If you're using a Craft Client or Craft Pro, you can save your entry as a draft and review it later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CH23G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't foolproof either. If you wanted to really try to restrict yourself, you could set up another user account that doesn't have privileges to &quot;Publish live changes.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rwUrR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But again, this would require either a Craft Client or Craft Pro license.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-04-20T11:33:29.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9315" PostTypeId="2" ParentId="9266" CreationDate="2015-04-20T12:24:24.393" Score="0" Body="&lt;p&gt;In my experience the &lt;code&gt;search&lt;/code&gt; function is a little more forgiving to work with than &lt;code&gt;find&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;Searching&lt;/a&gt; in the Craft documentation for the syntax and available search attributes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection') %}&#xA;{% set searchResults = entries.search('myFieldHandle:mySearchVariable') %}&#xA;&#xA;{% if searchResults %}&#xA;  {% for entry in searchResults %}&#xA;    {{ entry.title }}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to avoid the for loop and you're feeling lucky about the search result, you can always limit your search with &lt;code&gt;first()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entries.search('myFieldHandle:mySearchVariable').first() %}&#xA;&#xA;{% if entry %}&#xA;  {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does add extra queries for each search you run, tho.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your goal is to avoid db queries, use a for loop to match against your search criteria. Optionally, you can use the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;MN Break and Continue&lt;/a&gt; plugin to stop looping after the first match is made.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries if entry.myFieldHandle == 'myVariable' %}&#xA;  {{ entry.title }}&#xA;  {% break %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-04-20T12:24:24.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9316" PostTypeId="2" ParentId="9313" CreationDate="2015-04-20T14:04:14.637" Score="1" Body="&lt;p&gt;&lt;code&gt;appId&lt;/code&gt; wont help you there. If you take a look at the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/general.php#L55&quot; rel=&quot;nofollow&quot;&gt;source code&lt;/a&gt;, you'll see how the &lt;code&gt;appId&lt;/code&gt; is used in sessions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of an automatic way to prepend cache keys.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-20T17:17:32.947" LastActivityDate="2015-04-20T17:17:32.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9317" PostTypeId="1" AcceptedAnswerId="9319" CreationDate="2015-04-20T14:17:36.367" Score="1" ViewCount="83" Body="&lt;p&gt;I was going through my code for testing purposes and found out, that When entry's first time created, it also outputs data from the field &quot;dateUpdated&quot;. &#xA;I'm assuming, when an entry is first time created it is also first time updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to write a conditional statement to not output &quot;dateUpdated&quot; for entries, that were first time created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I didn't come up with anything, because I'm not sure If what I'm assuming is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the start.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Date #}&#xA;&amp;lt;span&amp;gt;&#xA;     {{ &quot;published&quot;|t|ucwords }}: {{ entry.dateCreated is empty ? &quot;&quot; : entry.dateCreated|date(&quot;d.m.Y&quot;) }},&#xA;&amp;lt;/span&amp;gt;&#xA;{% if entry.dateUpdated %}&#xA;      &amp;lt;span class=&quot;uk-text-success-alert&quot;&amp;gt;&#xA;            {{ &quot;updated&quot;|t|ucwords }}: {{ entry.dateUpdated is empty ? &quot;&quot; : entry.dateUpdated|date(&quot;d.m.Y&quot;) }},&#xA;      &amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;{% if entry.expiryDate %}&#xA;      &amp;lt;span class=&quot;uk-text-danger&quot;&amp;gt;&#xA;            {{ &quot;expire&quot;|t|ucwords }}: {{ entry.expiryDate is empty ? &quot;&quot; : entry.expiryDate|date(&quot;d.m.Y&quot;) }},&#xA;      &amp;lt;/span&amp;gt;  &#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-20T15:03:22.567" Title="Set conditional parameter to not output &quot;dateUpdated&quot; field, when entry is first time created" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9318" PostTypeId="1" CreationDate="2015-04-20T14:46:21.853" Score="0" ViewCount="178" Body="&lt;p&gt;We have a single DB and multiple web servers and are finding that unless we enable sticky sessions on the load balancer, we aren't able to login (or we can login then lose the session).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see a sessions table and there appears to be no config setting, so what might be going wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we need to set overridePhpSessionLocation to false?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-04-20T17:06:47.903" Title="Unable to login on multi-node install" Tags="&lt;session&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9319" PostTypeId="2" ParentId="9317" CreationDate="2015-04-20T15:03:22.567" Score="2" Body="&lt;p&gt;Here's where I'm going to be more help in theory, rather than code. But maybe something like this? I'm happy to revise if someone sees a typo.    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Date #}&#xA;&amp;lt;span&amp;gt;&#xA;     {{ &quot;published&quot;|t|ucwords }}: {{ entry.dateCreated is empty ? &quot;&quot; : entry.dateCreated|date(&quot;d.m.Y&quot;) }},&#xA;&amp;lt;/span&amp;gt;&#xA;{% if entry.dateCreated != entry.dateUpdated %}&#xA;      &amp;lt;span class=&quot;uk-text-success-alert&quot;&amp;gt;&#xA;            {{ &quot;updated&quot;|t|ucwords }}: {{ entry.dateUpdated is empty ? &quot;&quot; : entry.dateUpdated|date(&quot;d.m.Y&quot;) }},&#xA;      &amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;{% if entry.expiryDate|length %}&#xA;      &amp;lt;span class=&quot;uk-text-danger&quot;&amp;gt;&#xA;            {{ &quot;expire&quot;|t|ucwords }}: {{ entry.expiryDate is empty ? &quot;&quot; : entry.expiryDate|date(&quot;d.m.Y&quot;) }},&#xA;      &amp;lt;/span&amp;gt;  &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-20T15:03:22.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9320" PostTypeId="1" AcceptedAnswerId="9321" CreationDate="2015-04-20T15:11:12.343" Score="2" ViewCount="927" Body="&lt;p&gt;I can't find a way for a section (a channel in this case) to require the use to enter an expiration date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could add a new field and require that field, but that would get rid of the default functionality of entry/expire date fields.&lt;/p&gt;&#xA;" OwnerUserId="97" LastActivityDate="2021-05-14T02:07:03.643" Title="Is there a way to require the Expiration date" Tags="&lt;expiration&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9321" PostTypeId="2" ParentId="9320" CreationDate="2015-04-20T15:50:31.363" Score="4" Body="&lt;p&gt;You could do this with a little custom plugin. All you need to do is to listen to &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; events&#xA;and check if there's an &lt;code&gt;expiryDate&lt;/code&gt; submitted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if($entry-&amp;gt;section['handle'] == 'news' &amp;amp;&amp;amp; $entry-&amp;gt;type['handle'] == 'news')&#xA;    {&#xA;        if ($entry-&amp;gt;expiryDate === null)&#xA;        {&#xA;            $event-&amp;gt;params['entry']-&amp;gt;addError('expiryDate', Craft::t('Expiration Date cannot be blank.'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-20T16:04:29.557" LastActivityDate="2015-04-20T16:04:29.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9322" PostTypeId="1" CreationDate="2015-04-20T16:16:54.030" Score="3" ViewCount="1413" Body="&lt;p&gt;I have a category that I'm trying to load via a plugin. Looking at the categories service I see there is a function called &quot;getCategoryById&quot; but I don't know what the ID is so instead I'm loading the category group thinking that the ID provided there is what I need, apparently it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kinda of stumped on this one. Any advice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-29T17:42:17.337" Title="Load Category in Plugin" Tags="&lt;plugin-development&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9323" PostTypeId="2" ParentId="9322" CreationDate="2015-04-20T16:32:19.220" Score="2" Body="&lt;p&gt;Depending on what you are searching by, you can use something similar to this. You can see the properties you can search by &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot; rel=&quot;nofollow&quot;&gt;in the documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'CategoryGroupName';&#xA;$criteria-&amp;gt;title = 'CategoryTitle';&#xA;$criteria-&amp;gt;limit = 1;&#xA;&#xA;$category = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-04-20T16:49:25.640" LastActivityDate="2015-04-20T16:49:25.640" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="9324" PostTypeId="2" ParentId="9312" CreationDate="2015-04-20T16:39:58.443" Score="2" Body="&lt;p&gt;There isn't a native way to to do that... it would have to be done with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if there is an existing one, but &lt;a href=&quot;http://straightupcraft.com/&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt; currently has the most up-to-date list of available Craft plugins, so that would be a good starting point.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-20T16:39:58.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9325" PostTypeId="2" ParentId="9318" CreationDate="2015-04-20T17:06:47.903" Score="3" Body="&lt;p&gt;As of Craft 2.3, &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow&quot;&gt;overridePhpSessionLocation&lt;/a&gt; is set to false by default.  Meaning that wherever Apache (or whatever web server you're using) and PHP is configured to save the PHP session files, that's where they will go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set &lt;code&gt;overridePhpSessionLocation&lt;/code&gt; to true, then the session files will be saved in &lt;code&gt;craft/storage/runtime/session&lt;/code&gt;. Just be aware there is a bug in PHP that will prevent session garbage collection from running if you override the default session save path (which is what that config setting does). So you'll want to provide your own external method of session file garbage collection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your options are to 1) enable sticky session as the load balancer level to ensure that a user will always get sent back to the same server that their session was created on or 2) provide an external shared storage drive that all of your web servers can write the PHP session files and point each web server to use that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I'd just enable stick sessions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-20T17:06:47.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9326" PostTypeId="1" AcceptedAnswerId="9329" CreationDate="2015-04-20T17:24:29.270" Score="1" ViewCount="127" Body="&lt;p&gt;I'm trying to limit the total number of images shown to 5. The below clearly isn't correct but gives a rough idea of what i want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One entry could contain 1 image and the next entry 3 images. So i can't set a limit on the craft.entries tag because of the unknown number of images in an entry. It's on the images for loop i want to limit to 5.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for images in craft.entries.section('pages').type('events').order('eventDate desc').eventDate('&amp;lt;=' ~ now).search('gallery:*') %}&#xA;    {% for image in images.gallery.limit(5) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{image.getUrl}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image.getUrl('smallImage')}}&quot; alt=&quot;{{image.title}}&quot; class=&quot;image-link&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3489" LastActivityDate="2015-04-21T06:41:49.160" Title="Limiting image rows by 5 but an unknown number of section entries" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9327" PostTypeId="2" ParentId="9326" CreationDate="2015-04-20T17:39:47.623" Score="3" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for images in craft.entries.section('pages').type('events').order('eventDate desc').eventDate('&amp;lt;=' ~ now).search('gallery:*') %}&#xA;&#xA;    {% set image_set = images.gallery %}&#xA;    {% for i in 0..4 %}&#xA;        {% if image_set[i] is defined %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{image_set[i].getUrl}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image_set[i].getUrl('smallImage')}}&quot; alt=&quot;{{image_set[i].title}}&quot; class=&quot;image-link&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-20T17:39:47.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9328" PostTypeId="1" CreationDate="2015-04-20T17:51:34.953" Score="2" ViewCount="733" Body="&lt;p&gt;Has anyone ever limited access to Craft's back-end via ip address? What paths should I limit if I'm wanting to ensure only certain ip addresses can post updates? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="677" LastEditorUserId="677" LastEditDate="2015-04-20T18:29:06.917" LastActivityDate="2015-04-20T20:51:50.327" Title="Restrict control panel by ip address?" Tags="&lt;control-panel&gt;&lt;security&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9329" PostTypeId="2" ParentId="9326" CreationDate="2015-04-20T17:56:56.793" Score="1" Body="&lt;p&gt;You could introduce a counter and count the images actually displayed in your nested for loops. Then add a conditional to the loops to stop the iteration at your set limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that many parameters set on your &lt;code&gt;craft.entries&lt;/code&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; I would really recommend to use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;object syntax&lt;/a&gt; to set them. And instead of using the &lt;code&gt;search&lt;/code&gt; parameter to check if there's images set to your entries, you would better use &lt;code&gt;relatedTo&lt;/code&gt; and filter by entries with relations to an image model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.limit(null) %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'pages',&#xA;    type: 'events',&#xA;    eventDate: '&amp;lt;= ' ~ now,&#xA;    relatedTo: assets,&#xA;    order: 'eventDate desc',&#xA;}) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% set count = 0 %}&#xA;    {% for entry in entries if count &amp;lt; 5 %}&#xA;        {% for image in entry.gallery if count &amp;lt; 5 %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('smallImage') }}&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% set count = count + 1 %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-21T06:41:49.160" LastActivityDate="2015-04-21T06:41:49.160" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9330" PostTypeId="1" AcceptedAnswerId="9334" CreationDate="2015-04-20T19:20:36.093" Score="2" ViewCount="1071" Body="&lt;p&gt;I think I've just about hit my wits end here. I'm trying to get set up on a new Rackspace server and I can't seem to get my URL rewriting to work properly. Here's what I got so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Craft install is in &lt;code&gt;/var/www/html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;apache2.conf&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory /&amp;gt;&#xA;        Options FollowSymLinks&#xA;        AllowOverride None&#xA;        Require all denied&#xA;&amp;lt;/Directory&amp;gt;&#xA;&#xA;&amp;lt;Directory /usr/share&amp;gt;&#xA;        AllowOverride None&#xA;        Require all granted&#xA;&amp;lt;/Directory&amp;gt;&#xA;&#xA;&amp;lt;Directory /var/www/&amp;gt;&#xA;        Options Indexes FollowSymLinks&#xA;        AllowOverride All&#xA;        Require all granted&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;000-default.conf&lt;/strong&gt; (my vHost configuration)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;&#xA;        ServerAdmin webmaster@localhost&#xA;        DocumentRoot /var/www/html/www&#xA;&#xA;&#xA;        ErrorLog ${APACHE_LOG_DIR}/error.log&#xA;        CustomLog ${APACHE_LOG_DIR}/access.log combined&#xA;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and then within my craft install in &lt;code&gt;/var/www/html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;config/general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '-- omitted --' =&amp;gt; array(&#xA;    'devMode'              =&amp;gt; true,&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'siteUrl'            =&amp;gt; 'http://-- ommitted --/',&#xA;      'fileSystemPath'     =&amp;gt; '/var/www/html/www'&#xA;    ),&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;www/.htaccess&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;  # Send would-be 404 requests to Craft&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;  RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing any configuration here? I can't access any of my entries or the admin panel without appending &lt;code&gt;index.php&lt;/code&gt; before the path. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2295" LastActivityDate="2015-08-06T19:34:17.023" Title="omitScriptNameInUrls is not working" Tags="&lt;url&gt;&lt;config&gt;&lt;install&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9331" PostTypeId="2" ParentId="9312" CreationDate="2015-04-20T19:55:48.287" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft/&quot; rel=&quot;nofollow&quot;&gt;MailChimp Subscribe&lt;/a&gt; plugin might be the one you want.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-20T19:55:48.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9332" PostTypeId="2" ParentId="9328" CreationDate="2015-04-20T20:51:50.327" Score="3" Body="&lt;p&gt;If you're looking to only allow certain IP addresses to access the &lt;em&gt;entire&lt;/em&gt; control panel, you're best bet would be to whitelist them via an &lt;code&gt;.htaccess&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Limit GET POST&amp;gt;&#xA;    order deny,allow&#xA;    deny from all&#xA;    allow from 1.2.3.4&#xA;&amp;lt;/Limit&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're looking to just allow certain Craft-specific actions by IP address, then you'd have to write a plugin.  For example, if you only want certain IP addresses to be able to create an entry, the plugin would listen for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry&lt;/a&gt; event, make sure it's a new entry, check if the user has &lt;a href=&quot;http://buildwithcraft.com/docs/users#permissions&quot; rel=&quot;nofollow&quot;&gt;createEntry&lt;/a&gt; permissions, if so &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getIpAddress-detail&quot; rel=&quot;nofollow&quot;&gt;grab their IP address&lt;/a&gt; and make sure it falls in your whitelist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just be aware that IP address detection can be spoofed, so you shouldn't be relying on this for any critically sensitive data.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-20T20:51:50.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9334" PostTypeId="2" ParentId="9330" CreationDate="2015-04-20T22:26:16.893" Score="7" Body="&lt;p&gt;On recent Ubuntu systems (for sure on 14.04), &lt;code&gt;mod_rewrite&lt;/code&gt; is installed but not enabled within Apache. You may just need to enable the rewrite module and restart Apache.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ sudo a2enmod rewrite&#xA;$ sudo service apache2 restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3317" LastEditorUserId="57" LastEditDate="2015-08-06T19:34:17.023" LastActivityDate="2015-08-06T19:34:17.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9335" PostTypeId="1" AcceptedAnswerId="9336" CreationDate="2015-04-20T23:00:44.550" Score="1" ViewCount="328" Body="&lt;p&gt;I'm trying to find a way to get tag data from a Model. Currently, I have a template that makes use of tags in an entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Codes: {% for tag in entry.codes %} {{ tag.title }}; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I create this template, I also need to send some of the data (specifically this data) to an API. Assuming I have an &lt;code&gt;$entry&lt;/code&gt; object, how do I iterate through the tags that I need, or get an array with all the tags associated with an entry?&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="344" LastEditDate="2015-05-05T10:29:34.317" LastActivityDate="2015-05-05T10:29:34.317" Title="Getting an entry's tags" Tags="&lt;plugin-development&gt;&lt;tags&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9336" PostTypeId="2" ParentId="9335" CreationDate="2015-04-21T00:36:27.020" Score="2" Body="&lt;p&gt;If you have &lt;code&gt;$entry&lt;/code&gt;, you should be able to get the tags by the field name, (&lt;code&gt;codes&lt;/code&gt;, in your case). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tags = $entry-&amp;gt;codes;&#xA;foreach($tags as $tag)&#xA;{&#xA;    echo &quot;&amp;lt;li&amp;gt;&quot;.$tag-&amp;gt;title.&quot;&amp;lt;/li&amp;gt;&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-21T00:36:27.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9337" PostTypeId="1" AcceptedAnswerId="9338" CreationDate="2015-04-21T00:56:29.100" Score="6" ViewCount="1011" Body="&lt;p&gt;Currently I am using twig's replace filter to replace the tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set str = block.body | raw %}&#xA;{{ str | replace('&amp;lt;p&amp;gt;', '&amp;lt;p class=&quot;myClass&quot; data-wow-duration=&quot;1s&quot;&amp;gt;') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But on output it's not outputting the actual tags but:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;p class=&amp;amp;quot;myClass&amp;amp;quot; data-wow-duration=&amp;amp;quot;1s&amp;amp;quot;&amp;amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I keep the tags as tags?&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="3560" LastEditDate="2015-04-21T01:15:34.480" LastActivityDate="2015-04-21T01:30:29.403" Title="Replace &lt;p&gt; with &lt;p class=&quot;myClass&quot;&gt;" Tags="&lt;templating&gt;&lt;string&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9338" PostTypeId="2" ParentId="9337" CreationDate="2015-04-21T01:16:49.510" Score="7" Body="&lt;p&gt;Use the &lt;code&gt;raw&lt;/code&gt; filter on the replaced string (output), not &lt;code&gt;block.body&lt;/code&gt; (input):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set str = block.body %}&#xA;{{ str | replace('&amp;lt;p&amp;gt;', '&amp;lt;p class=&quot;myClass&quot; data-wow-duration=&quot;1s&quot;&amp;gt;') | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, some friendly advice: I'd like to point out that rewriting HTML in this way is &lt;a href=&quot;http://blog.codinghorror.com/parsing-html-the-cthulhu-way/&quot;&gt;pretty risky&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Shameless plug alert&lt;/em&gt;, but I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot;&gt;Retcon HTML&lt;/a&gt; which lets you manipulate your HTML content using PHP's &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot;&gt;DOMDocument&lt;/a&gt; – a far safer approach :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you could achieve your specific goal using Retcon's &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr&quot;&gt;Attr method&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.body | retconAttr( 'p', { 'class' : 'myClass', 'data-wow-duration' : '1s' } ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-21T01:30:29.403" LastActivityDate="2015-04-21T01:30:29.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9339" PostTypeId="1" CreationDate="2015-04-21T03:54:59.540" Score="0" ViewCount="121" Body="&lt;p&gt;With a &lt;code&gt;$user&lt;/code&gt; object, we can verify the user against a permission setting with the &lt;code&gt;can()&lt;/code&gt; method. However, how can I retrieve all users who have a specific permission, including those under a group with the permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This needs to be generic PHP code as it's located in a service.&lt;/p&gt;&#xA;" OwnerUserId="3531" LastActivityDate="2015-04-21T22:17:11.670" Title="Retrieving all users with specified permission" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9340" PostTypeId="1" CreationDate="2015-04-21T07:05:32.627" Score="0" ViewCount="461" Body="&lt;p&gt;I have implemented vanilla forums as a discussion solution for my website. I have made it embed into my parent site and also setup jsConnect to auto sign in the user if he/she is logged into my parent craft website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used this tutorial to set things up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.vanillaforums.com/jsconnect-technical-documentation-for-embedded-sso/&quot; rel=&quot;nofollow&quot;&gt;http://blog.vanillaforums.com/jsconnect-technical-documentation-for-embedded-sso/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can now sign in to vanilla forums using my craft user but next I also want to assign the group permissions to the user. I will define the roles in vanilla forum to match with the user groups in craft but I have no idea how to use jsConnect to assign user roles. Anybody have any experience with such a problem or can help in any way please do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Forum Page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% extends &quot;_layout&quot; %}&#xA;&#xA;    {% block content %}&#xA;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div id=&quot;vanilla-comments&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;&#xA;        /*** Required Settings: Edit BEFORE pasting into your web page ***/&#xA;&#xA;        var vanilla_forum_url = 'http://ght.butter.dev/vanilla'; // The full http url &amp;amp; path to your vanilla forum&#xA;        var vanilla_identifier = ''; // Your unique identifier for the content being commented on&#xA;        var vanilla_sso = '{{craft.myPlugin.authenticateUser()}}'; // Your SSO string.&#xA;&#xA;        /*** DON'T EDIT BELOW THIS LINE ***/&#xA;&#xA;        (function() {&#xA;        var vanilla = document.createElement('script');&#xA;        vanilla.type = 'text/javascript';&#xA;        var timestamp = new Date().getTime();&#xA;        vanilla.src = vanilla_forum_url + '/js/embed.js';&#xA;&#xA;        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(vanilla);&#xA;        })();&#xA;&#xA;        &amp;lt;/script&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Variable function (craft.myPlugin.authenticateUser()):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function authenticateUser(){&#xA;        $userModel = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $clientID = &quot;[clientId]&quot;;&#xA;        $secret = &quot;[secret]&quot;;&#xA;&#xA;        if($userModel)&#xA;            $signedIn = true;&#xA;&#xA;        $user = array();&#xA;&#xA;        if($signedIn)&#xA;        {&#xA;            $user['uniqueid'] = $userModel-&amp;gt;id;&#xA;            $user['name'] = $userModel-&amp;gt;username;&#xA;            $user['email'] = $userModel-&amp;gt;email;&#xA;            $user['photourl'] = $userModel-&amp;gt;photo;&#xA;            $user['client_id'] = $clientID;&#xA;        }&#xA;&#xA;        $user = json_encode($user);&#xA;        $signature_string = base64_encode($user);&#xA;        $signature_string = $this-&amp;gt;getStr2Hex($signature_string);&#xA;        $timestamp = time();&#xA;&#xA;        $signature = hash_hmac(&quot;sha1&quot;, &quot;{$signature_string} {$timestamp}&quot;, $secret);&#xA;&#xA;        $result = $signature_string.&quot; &quot;.$signature.&quot; &quot;.$timestamp.&quot; hmacsha1&quot;;&#xA;&#xA;        return $result;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-04-21T07:05:32.627" Title="Vanilla Forum Embedded SSO Export User Groups as Roles" Tags="&lt;plugin-development&gt;&lt;variable&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9341" PostTypeId="1" CreationDate="2015-04-21T08:34:02.240" Score="2" ViewCount="276" Body="&lt;p&gt;I was wondering if anyone else has experienced a serious performance hit when implementing pagination?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By just using Safari's timeline, I can see my page takes 500ms to generate.  After introducing JUST the paginate tag (not including any loops etc), it now takes 1.5s!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal behaviour?  If not, what should I be doing to improve the performance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  Thanks for the suggestions regarding caching.  I am aware of the cache tag however, the paginated entries are the results of a search query with various filters so I'm concerned that the caching will have little effect.  Or am I wrong?&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2015-04-21T16:01:58.217" LastActivityDate="2015-04-21T16:01:58.217" Title="Paginate performance issue" Tags="&lt;performance&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9342" PostTypeId="1" CreationDate="2015-04-21T10:44:18.150" Score="1" ViewCount="637" Body="&lt;p&gt;I have a site where I serve quite the amount of images which are saved on Google Cloud Storage. I have set &lt;a href=&quot;https://craftcms.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;nofollow&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; to true in my general config because I'm caching the output for &lt;a href=&quot;https://www.fastly.com/&quot; rel=&quot;nofollow&quot;&gt;Fastly&lt;/a&gt; (based on Varnish). The downside is that on first request it's awfully slow and at one point even returns a 503 error.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way that assets can be transformed before &lt;code&gt;getUrl()&lt;/code&gt; is being called? Other solutions are more than welcome. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="57" LastEditDate="2016-05-15T21:02:00.003" LastActivityDate="2016-05-16T08:32:37.067" Title="Is there a way to manually trigger an asset transform before calling getUrl()?" Tags="&lt;image-transforms&gt;&lt;varnish&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9343" PostTypeId="1" AcceptedAnswerId="9349" CreationDate="2015-04-21T12:07:28.680" Score="1" ViewCount="174" Body="&lt;p&gt;When I try to output the day name (l or D) or month name (F or M) i get a number instead of the day/month-name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.end|date(&quot;j. F Y&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;turns into:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. 9 2015&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expected output would be &lt;code&gt;1. oktober 2015&lt;/code&gt; (site language is Norwegian (nb)) or even &lt;code&gt;1. October 2015&lt;/code&gt; (if internationalization did not work).&lt;/p&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2015-04-21T14:55:00.890" Title="Day and month names ignore certain formats in date filter and revert to number" Tags="&lt;datetime&gt;&lt;filter&gt;&lt;language&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9344" PostTypeId="1" AcceptedAnswerId="9345" CreationDate="2015-04-21T12:40:58.883" Score="2" ViewCount="1355" Body="&lt;p&gt;I'm trying to paginate a channel of entries but I also need to exclude any entries that relate to a specific category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set insightCategory = craft.categories({&quot;slug&quot;: &quot;insights&quot;}).first() %}&#xA;{% set insightsEntryIds = craft.entries.section('blogChannel').relatedTo({targetElement: insightCategory}).limit(null).ids() %}&#xA;&#xA;{% paginate craft.entries.section('blogChannel')|without(insightsEntryIds) as entries %}&#xA;    {% for blogEntry in entries %}&#xA;        &amp;lt;p&amp;gt;{{ blogEntry.title }} ({{ blogEntry.id }})&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the pagination doesn't seem to work with the |without filter. How can I achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2015-04-22T08:37:01.820" Title="Exclude category from channel entries (with pagination)" Tags="&lt;filter&gt;&lt;pagination&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9345" PostTypeId="2" ParentId="9344" CreationDate="2015-04-21T12:52:16.037" Score="6" Body="&lt;p&gt;The &lt;code&gt;without&lt;/code&gt; filter converts your ElementCriteriaModel into an array of entry models (the same as &lt;code&gt;find()&lt;/code&gt; does). But that array won't work with &lt;code&gt;paginate&lt;/code&gt;, as explained in the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This parameter needs to be an actual ElementCriteriaModel object; not an array of elements. So don’t call find() on the object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you need to query for the entries you're after directly with an ElementCriteriaModel. The workaround to get there would be to pass an array of entry IDs into the &lt;code&gt;id()&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoriesToExclude = craft.categories({slug: 'berlin'}) %}&#xA;{% set entriesToExcludeIds = craft.entries.section('news').relatedTo(categoriesToExclude).limit(null).ids() %}&#xA;{% set entryIds = craft.entries.section('news').limit(null).ids()|without(entriesToExcludeIds) %}&#xA;&#xA;{% set entries = craft.entries.id(entryIds) %}&#xA;&#xA;{% paginate entries as entriesOnPage %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not recommended to use the &lt;code&gt;without&lt;/code&gt; filter with objects anyways (→ see &lt;a href=&quot;https://craftcms.stackexchange.com/a/7178/125&quot;&gt;Brad's answer&lt;/a&gt; to a related question)!&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-04-22T08:36:47.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9346" PostTypeId="2" ParentId="9292" CreationDate="2015-04-21T13:04:36.293" Score="1" Body="&lt;p&gt;I tried putting together the code, and resolved the issue. Here's the solution for anyone else out there looking to do something similar:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The asset handle is &quot;productionPhotos&quot;.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/z4ZzD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within &quot;productionPhotos&quot;, there is a field &quot;imageTags&quot; so that I can add multiple people as tagged in the photo. I used a Matrix field type. The block type name is &quot;person&quot; and the Field name is &quot;taggedPerson&quot; with a field type of &quot;Entries&quot;.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yyBEG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;slider&quot;&amp;gt;&#xA;  {% set photos = craft.assets.section('productionPhotos').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'imageTags.taggedPerson'&#xA;   }) %}&#xA;  &amp;lt;ul class=&quot;slides&quot;&amp;gt;&#xA;    {% for image in photos %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('sliderImage') }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}    &#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3554" LastActivityDate="2015-04-21T13:04:36.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9347" PostTypeId="1" CreationDate="2015-04-21T13:13:50.170" Score="6" ViewCount="196" Body="&lt;p&gt;I have a pretty simple Craft site running a Digital Ocean Ubuntu droplet and for some reason it can sometimes take several minutes to save an entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this might be something to do with sessions as, when it happens, the site stops responding completely for that browser unless I quit and re-open it. Whilst it is happening, accessing the website via another browser works fine. There's nothing in the phperrors.log or the craft.log that even relate to the time the problem happens but there's something in the Application Logs that seem relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a sample of the 'Profiling Summary Report' where you can see it took 300s to respond but none of the queries takes anything other than milliseconds: &lt;a href=&quot;http://pastebin.com/pbf7bj2e&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/pbf7bj2e&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting bit is is the Application Log where you can see the timestamps jump from 13:00 to 13:05 on line 58:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pastebin.com/gdCgTUSC&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/gdCgTUSC&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is happening there that took 5 minutes?&lt;/p&gt;&#xA;" OwnerUserId="770" LastEditorUserId="125" LastEditDate="2015-05-29T15:06:02.917" LastActivityDate="2015-09-12T21:14:35.773" Title="Craft sometimes takes several minutes to respond to a request" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9348" PostTypeId="2" ParentId="9341" CreationDate="2015-04-21T13:57:02.447" Score="1" Body="&lt;p&gt;Add the following tags around your &lt;code&gt;{% pagination %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those tags will refresh every time the content changes, and when the content hasn't changed, it'll reduce your database queries significantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;The craft docs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag&quot;&gt;What are the best practices for using the cache tag&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-04-21T13:57:02.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9349" PostTypeId="2" ParentId="9343" CreationDate="2015-04-21T14:55:00.890" Score="3" Body="&lt;p&gt;This is a bug in the latest version of Craft specific to Norwegian locales that will be fixed in the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2643&quot; rel=&quot;nofollow&quot;&gt;2.3.2643&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-21T14:55:00.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9350" PostTypeId="1" CreationDate="2015-04-21T16:27:25.713" Score="3" ViewCount="203" Body="&lt;p&gt;I have three models / records - Journals, Issues, and Articles. Articles each BELONG_TO an Issue. Issues each BELONG_TO a journal. Issues have a date on which they've been published, and I am trying to find the most recent issue (by cover date) for a given journal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code in a method in the IssueService: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Articles_Issue');&#xA;$criteria-&amp;gt;journalId = $journal-&amp;gt;id;&#xA;$criteria-&amp;gt;limit = 1;&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$query-&amp;gt;order('issues.coverDate desc');&#xA;&#xA;$issue = Articles_IssueModel::populateModel($query-&amp;gt;queryRow());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works well and good and I am returned the appropriate Article_IssueModel. However, when trying to access $issue-&gt;articles, I get zero back. Normally when I load the issue through &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;findByElementId($issue-&amp;gt;id);&lt;/code&gt;, the articles in the relationship are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Editing the code I pasted above to include the following (after populating issue model): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Articles_Article');&#xA;$criteria-&amp;gt;issueId = $issue-&amp;gt;id;&#xA;$art = $criteria-&amp;gt;findAll();&#xA;print_r(count($issue-&amp;gt;articles));&#xA;print_r(count($art));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;prints 0, followed by 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems to me that calling BaseModel::populateModel is not enough to load the model's relationships. I recognize that I am (possibly?) skipping a step in not instantiating any Records, but if I change the issue loading code to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$issueRecord = Articles_IssueRecord::model();&#xA;$issueRecord-&amp;gt;populateRecord($query-&amp;gt;queryRow());&#xA;$issue = Articles_IssueModel::populateModel($issueRecord);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I still get zero articles when accessed via &lt;code&gt;$issue-&amp;gt;articles&lt;/code&gt;. Is there a way to get the issue to load its related articles without manually loading them via &lt;code&gt;ElementsService&lt;/code&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, I am building many other service calls and views using this plugin, and I have double checked that foreign keys are being populated and the relationships defined on the records are working properly. Also, I can post additional code if I've missed something.&lt;/p&gt;&#xA;" OwnerUserId="559" LastActivityDate="2015-04-21T16:27:25.713" Title="How do I traverse relationships when populating models from queries?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9352" PostTypeId="1" CreationDate="2015-04-21T19:10:18.137" Score="1" ViewCount="269" Body="&lt;p&gt;I have a very simple plugin to update a user's name. All I'm doing is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $userId = craft()-&amp;gt;userSession-&amp;gt;id;&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;    $user-&amp;gt;firstName = $post[&quot;firstName&quot;];&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is after the page reloads from the POST submit the output still shows the old name, but then if I refresh the page without resubmitting I see the new name. Point is the name is changing but it seems like maybe this data is cached somewhere? How do I fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more clear, this does not happen on all field types. First name and last name do it. Custom plain text fields do not. Category fields do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I'm using in one of my controllers. This will not be the final code but I don't feel like that matters. Just these few lines will produce the problem I'm talking about:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionEditContactInfo()&#xA;{&#xA;    $userId = craft()-&amp;gt;userSession-&amp;gt;id;&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;    $user-&amp;gt;firstName = $post[&quot;firstName&quot;];&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For AJAX calls I'm doing a little bit more:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionEditContactInfo()&#xA;{&#xA;    $userId = craft()-&amp;gt;userSession-&amp;gt;id;&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;    $user-&amp;gt;firstName = $post[&quot;firstName&quot;];&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    $editUser = $user-&amp;gt;getContent();&#xA;&#xA;    $template = craft()-&amp;gt;templates-&amp;gt;render(&quot;users/profile-form/_contact-info-form&quot;, array(&quot;editUser&quot; =&amp;gt; $editUser));&#xA;&#xA;    $this-&amp;gt;returnJson(array('template' =&amp;gt; $template ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In both cases not all fields display the updated content after a form submit is made. Custom plain text fields seem to be ok. The default user model first name and last name are problematic as are category fields. Not sure about other field types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been brought to my attention that I should probably be more clear in my explanation of this problem. Here it goes from top to bottom:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a form with 2 fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A category field&lt;/li&gt;&#xA;&lt;li&gt;A plain text field&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The form submits data to the server by making an AJAX call to a controller. The controller updates the info as needed then renders a template representing the updated form. The template is then encapsulated in a JSON array and passed to a JavaScript function which updates the user's browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm experiencing is not that the data is not saving, but that when the new form is re-rendered not all of the fields reflect the changes. But if I refresh the page after saving everything is fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of the two fields mentioned above, plain text works as expected but the category field is problematic. Even if I dump() the user data in the re-rendered template I am given the old value for the category field even though it was updated. Here is my controller code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionEditNetworks()&#xA;{&#xA;&#xA;    $userId = craft()-&amp;gt;userSession-&amp;gt;id;&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    $user-&amp;gt;setContentFromPost('fields');&#xA;&#xA;    // Save the user&#xA;    $result = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    $editUser = $user-&amp;gt;getContent();&#xA;&#xA;    $template = craft()-&amp;gt;templates-&amp;gt;render(&quot;users/profile-form/_network-links-form&quot;, array(&quot;editUser&quot; =&amp;gt; $editUser));&#xA;&#xA;    $this-&amp;gt;returnJson(array('template' =&amp;gt; $template));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="3325" LastEditDate="2015-04-23T17:54:05.913" LastActivityDate="2015-04-23T17:54:05.913" Title="Possible cache issue? Not sure" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9353" PostTypeId="1" AcceptedAnswerId="9356" CreationDate="2015-04-21T19:54:26.420" Score="1" ViewCount="945" Body="&lt;p&gt;I have two structures: Focus Areas &amp;amp; Initiatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to associate the two of these structures. Here's a potential example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Focus Areas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sports&lt;/li&gt;&#xA;&lt;li&gt;Music&lt;/li&gt;&#xA;&lt;li&gt;Art&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Initiatives:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Basketball&lt;/li&gt;&#xA;&lt;li&gt;Soccer&lt;/li&gt;&#xA;&lt;li&gt;Trumpet&lt;/li&gt;&#xA;&lt;li&gt;Painting&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My organization has a number of Initiatives, each fit under a certain Focus Area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under, but am having trouble thinking of how to further narrow down entries to show from the example below (which shows all initiatives):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('initiatives') %}&#xA;{% for entry in entries %}&#xA;    {{entry.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would this be an appropriate use case for Categories? Should I instead be using Entry Types for each Focus area?&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2015-04-21T21:33:35.127" Title="Using Categories with Structures?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9355" PostTypeId="1" AcceptedAnswerId="9714" CreationDate="2015-04-21T21:15:17.087" Score="1" ViewCount="317" Body="&lt;p&gt;I would like to loop through entries only if the current date/time is before 5am on the following day from when the entry's eventDate (custom field mind you)is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words I may have an event at 10pm on May/1/2015 and i want to loop through that date as long as it is not 5am (or later) on May/2/2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have currently is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for slide in craft.entries.section('events').featured('1').order('dateTime asc').limit(5).find() if (slide.dateTime|date(&quot;c&quot;,&quot;+8hours&quot;)) &amp;gt;= now|date(&quot;c&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However as you might have guessed, as far as i understand it, this loops through all entries as long as the current date/time is less than 8 hours AFTER the date/time of the event entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to my understanding (Based on what i have observed) this will loop the entry up until 6am May/2/2015 which is not what i want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short. I'd like to ignore the 'time' portion of my date/time field as if it were May 1, 2015 12:00AM and add 29 hours, rather than including the time parameter of my date/time field and doing the math based on that which outputs variable results based on the time of the event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if i need to clarify any, I hope i've been clear. Also please let me know if there is anything else wrong with my For loop, it seems to work exactly how it should minus the date issue, but i'm always open to improvement.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2015-04-21T21:23:37.497" LastActivityDate="2015-05-13T11:46:08.727" Title="Loop based on date (with math)" Tags="&lt;datetime&gt;&lt;forloop&gt;&lt;math&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9356" PostTypeId="2" ParentId="9353" CreationDate="2015-04-21T21:23:56.873" Score="3" Body="&lt;p&gt;There are a number of ways to organize this using any combination of channels, structures, or categories — it's hard to give a recommendation on which way is better without knowing a little more about your site requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much will depend on things like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Will there be pages for both 'focus-areas' and 'initiatives' (or is one just used for organization)?&lt;/li&gt;&#xA;&lt;li&gt;How the uri's should look? (i.e. 'focus-area/initiative/' or '/focus-areas/focus-area/' &amp;amp; '/initiatives/initiative')&lt;/li&gt;&#xA;&lt;li&gt;Are the relationships 'one-to-one' or 'many-to-one'?&lt;/li&gt;&#xA;&lt;li&gt;Are the pages hierarchical and/or need a specific order defined?&lt;/li&gt;&#xA;&lt;li&gt;Do the pages need entryTypes (because the layout and/or field requirements are unique for different pages)?&lt;/li&gt;&#xA;&lt;li&gt;Do you need to generate site-navigation dynamically?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Answering these questions will generally narrow down the options.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Typically, instead of a radioButton, you would create a relationship between any two channels/structures/categories using the &lt;code&gt;EntriesFieldType&lt;/code&gt;. Once you have added the field to your focus-areas field layout, and added some related initiative entries, you can access the related initiatives using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for initiative in entry.initiatives %}&#xA;    &amp;lt;li&amp;gt;{{ initiative.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set initiatives = craft.entries.section('initiatives').relatedTo(entry) %}&#xA;{% for initiative in initiatives %}&#xA;    &amp;lt;li&amp;gt;{{ initiative.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would this be an appropriate use case for Categories?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe. If you want to conceptually consider them as categories (and categories fit all your other needs) then go for it. Otherwise the difference between categories and structures/channels is pretty minor (with the exception that categories do not support &lt;code&gt;entryTypes&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I instead be using Entry Types for each Focus area?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe. &lt;code&gt;EntryTypes&lt;/code&gt; are generally used when the field and/or layout requirements are unique in some way for the various entries. If the relationship between 'focus-areas' and 'initiatives' is one-to-one, and if you want the uri's to be 'focus-area/initiative' then a good option might be to combine the two structures together hierarchically and use &lt;code&gt;EntryTypes&lt;/code&gt; to define the unique layout and fields requirements for each. In your template you would then check the entry's type and change the layout or include a sub-template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type = &quot;initiative&quot; %}&#xA;    {% include '_initiative.html' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use this approach site-wide to generate more dynamic site navigation, using craft's &lt;code&gt;nav&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-21T21:23:56.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9357" PostTypeId="2" ParentId="9353" CreationDate="2015-04-21T21:33:35.127" Score="3" Body="&lt;p&gt;It sounds like Focus Areas could logically be a category and Initiatives a structure. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8571/difference-between-categories-and-structures&quot;&gt;They work very similarly with a few differences&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories can use their own template and routing which is handy. You can also associate as many fields as you want with them just like Entries so you could flesh out a category page with headings, rich-text, matrix fields, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you are on a Focus Area page, Craft will automatically set a &lt;code&gt;category&lt;/code&gt; variable to use when the URL matches the category route just like it sets an &lt;code&gt;entry&lt;/code&gt; variable on entry URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, on the &lt;code&gt;http://example.com/focus-area/sports&lt;/code&gt; page, you could use &lt;code&gt;{{ category.title }}&lt;/code&gt; that would give you the output &lt;code&gt;Sports&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a category page, you can use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relatedTo parameter&lt;/a&gt; to find Initiatives entries related to that category like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('initiatives').relatedTo(category) %}&#xA;{% for entry in entries %}&#xA;    {{entry.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The other option that may make sense would be to make everything one nested Structure since it looks like Initiatives are exclusive to only one Focus Group.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sports&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Basketball&lt;/li&gt;&#xA;&lt;li&gt;Soccer&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Music&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Trumpet&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Art&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Painting&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The potential drawback is that they're in the same section so they will use the same template routing. You could use Entry Types to manage different content for Focus Areas and Initiatives. You can't however force an Entry Type to be used like level 1 entries need to be entry type X and level 2 entry type Y. So someone could accidentally set up &quot;Trumpet&quot; as a Focus Area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a list of Initiative from a Focus Group page you could use the &lt;code&gt;descendantOf&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').descendantOf(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also the &lt;code&gt;type&lt;/code&gt; parameter if you want to filter only certain Entry Types.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').type('initiatives').descendantOf(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-04-21T21:33:35.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9358" PostTypeId="2" ParentId="9339" CreationDate="2015-04-21T22:17:11.670" Score="1" Body="&lt;p&gt;I don't think there is a clean or particularly efficient way of doing this using Craft's current services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd have to be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Grab all users&#xA;2. Loop through them calling craft()-&amp;gt;userPermissions-&amp;gt;doesUserHavePermission()&#xA;3. If true, save user in success array.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could use &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; to query the database directly for the info you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-21T22:17:11.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9359" PostTypeId="2" ParentId="9352" CreationDate="2015-04-21T22:23:41.980" Score="1" Body="&lt;p&gt;If I had to guess, you need to add a &lt;code&gt;$this-&amp;gt;redirectToPostedUrl();&lt;/code&gt; after your call to &lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser($user);&lt;/code&gt; to cause a proper redirect/page refresh after submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're doing this over AJAX, then you're going to be responsible for updating any DOM elements with their new values, or reloading/redirecting the page so they'll display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a non-AJAX context, a call to &lt;code&gt;$this-&amp;gt;redirectToPostedUrl();&lt;/code&gt; will do the redirect for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-04-23T16:57:21.543" LastActivityDate="2015-04-23T16:57:21.543" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9360" PostTypeId="2" ParentId="9355" CreationDate="2015-04-21T22:24:42.037" Score="3" Body="&lt;p&gt;You could try using the &lt;code&gt;date_modify&lt;/code&gt; filter with a &lt;a href=&quot;http://php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow&quot;&gt;relative DateTime format&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if slide.dateTime|date_modify('tomorrow 5am')|date('U') &amp;lt; now|date('U') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you want to limit the entries to be displayed, you should not use the &lt;code&gt;limit&lt;/code&gt; parameter for that. Your&#xA;ElementCriteriaModel doesn't take your DateTime conditional into account, so it requires a custom solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slides = craft.entries.section('events').featured('1').order('dateTime asc').limit(null) %}&#xA;&#xA;{% set count = 0 %}&#xA;{% for slide in slides %}&#xA;    {% if count &amp;lt; 5 and slide.dateTime|date_modify('tomorrow 5am')|date('U') &amp;lt; now|date('U') %}&#xA;        {{ slide.dateTime }}&#xA;        {% set count = count + 1 %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-04-22T06:05:18.330" LastActivityDate="2015-04-22T06:05:18.330" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9361" PostTypeId="2" ParentId="8790" CreationDate="2015-04-21T22:33:11.113" Score="2" Body="&lt;p&gt;Found your question while troubleshooting a similar issue (setting up a dev subdomain after getting the pro license for a live site). We share a codebase across multiple domains, each with their own license key, so the keys are ignored in version control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysite.com&lt;/code&gt; was used to generate &lt;code&gt;/craft/config/license.key&lt;/code&gt;. As noted in the other answers, you could also generate this key on another domain and transfer it later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without the &lt;code&gt;license.key&lt;/code&gt; if you visit the admin control panel on your dev sounding subdomains (or local installs), a personal license will be generated and (if you've got pro features) the modal will pop up and lock you out of the cp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After copying the pro &lt;code&gt;license.key&lt;/code&gt; file from the live site, I still had to clear out &lt;code&gt;/craft/storage/runtime/cache/&lt;/code&gt; before clicking the &quot;check for updates&quot; link in the cp footer to force a call to craft's web services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back in business.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastActivityDate="2015-04-21T22:33:11.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9362" PostTypeId="1" AcceptedAnswerId="9363" CreationDate="2015-04-21T22:59:36.667" Score="0" ViewCount="329" Body="&lt;p&gt;&lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators&quot; rel=&quot;nofollow&quot;&gt;Using this fantastic article on validation,&lt;/a&gt; I have written a custom validator class. Everything is working, but I'm curious about the &lt;code&gt;rules&lt;/code&gt; and &lt;code&gt;defineAttributes&lt;/code&gt; method(s). Most likely I'm just misunderstanding how it all works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyModel.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'firstName' =&amp;gt; array(&#xA;                'type' =&amp;gt; AttributeType::Name,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'lastName' =&amp;gt; array(&#xA;                'type' =&amp;gt; AttributeType::Name,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'email' =&amp;gt; array(&#xA;                'type' =&amp;gt; AttributeType::Email,&#xA;                'required' =&amp;gt; true&#xA;            ),&#xA;            'phone' =&amp;gt; array(&#xA;                'type' =&amp;gt; AttributeType::ClassName,&#xA;                'maxLength' =&amp;gt; 14&#xA;            )&#xA;        );&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;&#xA;        $rules[] = ['email', 'Craft\MyPlugin_EmailValidator'];&#xA;&#xA;        return $rules;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do I really need both? I (thought) that &lt;code&gt;defineAttributes&lt;/code&gt; was the &lt;code&gt;rules&lt;/code&gt; method. Everything is working properly; I'm doing a check to make sure the email is unique. I have a unique key defined on the record as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-04-21T23:05:49.930" LastActivityDate="2015-04-22T00:55:28.443" Title="defineAttributes and rules" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9363" PostTypeId="2" ParentId="9362" CreationDate="2015-04-22T00:55:28.443" Score="0" Body="&lt;p&gt;You need both because there is no way to define custom validation rules from &lt;code&gt;defineAttributes()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately things like &lt;code&gt;'maxLength' =&amp;gt; 14&lt;/code&gt; in &lt;code&gt;defineAttributes()&lt;/code&gt; automagically get normalized down to the &lt;code&gt;$rules&lt;/code&gt; array that gets returned from the &lt;code&gt;rules&lt;/code&gt; method, so you're just appending your custom rule onto that when you call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$rules = parent::rules();&#xA;$rules[] = ['email', 'Craft\MyPlugin_EmailValidator'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-22T00:55:28.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9365" PostTypeId="1" AcceptedAnswerId="9382" CreationDate="2015-04-22T08:23:09.797" Score="2" ViewCount="116" Body="&lt;p&gt;We've been using bootstrap.php to have a basic PHP file run parts of some content-sync from a plugin we've written. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sync is run from cron and this works great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT - when the sync runs from the bootstrapped file - there are no logging info stored. I.e. the sync code works fine, but nothing is logged to: &lt;code&gt;craft/storage/runtime/logs/&amp;lt;pluginname&amp;gt;.log&lt;/code&gt; - when triggering the sync from within the CP as a full-craft request, logging works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get the bootstrap app to setup logging, so that logging from my plugin would work?&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-04-22T20:39:22.167" Title="Logging from Bootstrap mode?" Tags="&lt;plugin-development&gt;&lt;bootstrap-craft&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9366" PostTypeId="2" ParentId="9344" CreationDate="2015-04-22T08:37:01.820" Score="4" Body="&lt;p&gt;The probably more elegant way to handle this is to not use the &lt;code&gt;without&lt;/code&gt; filter at all and simply&#xA;list the categories you want to exclude prefixed with &lt;code&gt;not&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories({&#xA;    group: 'location',&#xA;    slug: [&#xA;        'and',&#xA;        'not berlin',&#xA;        'not amsterdam',&#xA;    ],&#xA;    limit: null,&#xA;}) %}&#xA;&#xA;{% set entries = craft.entries.section('news').relatedTo(categories) %}&#xA;&#xA;{% paginate entries as entriesOnPage %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-22T08:37:01.820" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9367" PostTypeId="1" AcceptedAnswerId="9368" CreationDate="2015-04-22T09:09:17.443" Score="9" ViewCount="7294" Body="&lt;p&gt;Does Craft CMS have an API that third-party webapps can access? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a REST API which you can log in to and send GET, PUT, POST, DELETE commands to, from a third-party app?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like it should have an API, by the statement of the creator:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A key part of the architecture is our service layer. All of the&#xA;  business logic in Craft happens in service classes, which provide APIs&#xA;  that anything else in the system (including other services) can talk&#xA;  to.&#xA;   - &lt;a href=&quot;http://www.thenerdary.net/post/48123188844/interview-with-brandon-kelly-creator-of-craft&quot;&gt;http://www.thenerdary.net/post/48123188844/interview-with-brandon-kelly-creator-of-craft&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But then again, some other people who have tried integrating towards Craft CMS says it doesn't:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I ran into some trouble with the API. Shit, Craft doesn’t freakin’&#xA;  have one! I assumed it would, oops.. So I researched how to do it. I&#xA;  knew I could probably fake it and output json using template tags but&#xA;  no-one wants to do that. I looked at some API controllers but non of&#xA;  them worked very well. In the end I found a nice plugin called JSON&#xA;  Expand that converts entries from Twig into JSON. - &#xA;  &lt;a href=&quot;http://abandon.ie/notebook/using-angularjs-with-craft-cms&quot;&gt;http://abandon.ie/notebook/using-angularjs-with-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm confused. If it has an API, what kind is it, and what protocol does it use? REST? SOAP? RPC? Something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And where is it documented? A simple 'hello world' or 'transmit som data into Craft CMS' example would be really helpful.&lt;/p&gt;&#xA;" OwnerUserId="3569" LastEditorUserId="3569" LastEditDate="2015-04-22T09:53:15.880" LastActivityDate="2017-07-23T06:11:07.320" Title="Does Craft CMS have an API?" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9368" PostTypeId="2" ParentId="9367" CreationDate="2015-04-22T09:34:50.307" Score="9" Body="&lt;p&gt;No, Craft doesn't have a REST API (edit: or any other web service) built-in. The &quot;API&quot; mentioned in the first quote (and elsewhere related) would be the more generic meaning of the term and refers to the &lt;a href=&quot;https://buildwithcraft.com/classreference#craft.app.services&quot; rel=&quot;nofollow noreferrer&quot;&gt;service layer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a very consistent MVC based architecture based on &lt;a href=&quot;http://www.yiiframework.com/wiki/175/how-to-create-a-rest-api/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt;, Craft is well suited for REST implementation, though. See &lt;a href=&quot;https://plus.google.com/108374347584100012430/posts/3v9MSFhT8nr&quot; rel=&quot;nofollow noreferrer&quot;&gt;this G+ thread&lt;/a&gt; for P&amp;amp;T weighing in on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a native REST API isn't part of the core, one would have to added to Craft via a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's at least &lt;a href=&quot;https://github.com/wesrice/rest-easy&quot; rel=&quot;nofollow noreferrer&quot;&gt;one plugin out there&lt;/a&gt;, though I haven't tried it (or any others) myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be mentioned that after I wrote the above answer, Pixel and Tonic has released the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API plugin&lt;/a&gt; - making it easy to build a REST API with Craft. Element API is pretty basic (only GET requests), but can probably be extended with a custom plugin to support additional HTTP methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P&amp;amp;T has also stated that they want Craft 3 to have a full, built-in REST API at some point.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-07-23T06:11:07.320" LastActivityDate="2017-07-23T06:11:07.320" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9369" PostTypeId="1" AcceptedAnswerId="9381" CreationDate="2015-04-22T10:58:39.733" Score="0" ViewCount="796" Body="&lt;p&gt;Hi wondering if this is possible. I have a custom checkbox field for user interests added to the user profile. Is there a way to populate the checkbox options dynamically using tag data?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-04-22T20:08:42.107" Title="How to populate a custom checkbox field with tag data dynamically?" Tags="&lt;tags&gt;&lt;checkboxes&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9370" PostTypeId="2" ParentId="9369" CreationDate="2015-04-22T11:32:33.753" Score="1" Body="&lt;p&gt;There's plugin for populating fields with dynamic data: &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;Dynamic Fields&lt;/a&gt;. But I'm not sure if it works, when pulling data from the same entry you're rendering the field into.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-22T11:32:33.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9371" PostTypeId="1" AcceptedAnswerId="9379" CreationDate="2015-04-22T11:50:28.700" Score="0" ViewCount="228" Body="&lt;p&gt;Hi I'm sure this is simple but it is eluding me. I want to pull out all the user profile fields with twig as an array that I can then check. When I dump the user or currentUser data it does not show any of the profile fields I have created in the returned object. I can however still access these fields with user.customfieldname. How can I return the array I am looking for?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-04-22T18:22:51.327" Title="How can I return all user custom profile fields in an array?" Tags="&lt;templating&gt;&lt;user-profile&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9372" PostTypeId="2" ParentId="8501" CreationDate="2015-04-22T13:40:01.593" Score="3" Body="&lt;p&gt;I know why this happens - we have the same problem. It is related to the escaping of the &lt;code&gt;&amp;amp;&lt;/code&gt; in the password reset URL not being escaped: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;somehow, this arrives at our (and your I guess) server as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;amp;id=1234&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the code is &lt;code&gt;abcd&lt;/code&gt; and a parameter called &lt;code&gt;amp;id&lt;/code&gt; is &lt;code&gt;1234&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, we have craft setup to send HTML emails, and have an email template like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Click here to reset your password: {{link}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and end up with the link &lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234&lt;/code&gt; directly in the HTML - this is &lt;em&gt;WRONG&lt;/em&gt;, since the &lt;code&gt;&amp;amp;&lt;/code&gt; symbol has to be escaped as &lt;code&gt;&amp;amp;amp;&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we could compensate, and make our template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Click here to reset: {{link|escape}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then we get correct HTML, but the plain-text version of the email is now broken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;AFAIK there is no way to have separate templates for text and html emails in craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess your problem is also HTML emails, OR you have a user with an overzealous email client, that adds the escape of the &lt;code&gt;&amp;amp;&lt;/code&gt; for you. &lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="45" LastEditDate="2015-07-03T18:14:03.707" LastActivityDate="2015-07-03T18:14:03.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9373" PostTypeId="2" ParentId="9207" CreationDate="2015-04-22T14:34:02.037" Score="4" Body="&lt;p&gt;There's an error in Douglas McDonald's answer, here is the correction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set matrixField = craft.fields.getFieldByHandle('employmentMatrix') %}&#xA;        {% set blockTypes = matrixField.getFieldType.getSettings.getBlockTypes %}&#xA;        {% for blockType in blockTypes %}&#xA;            {% if blockType.handle == &quot;myBlockTypeHandle&quot; %}&#xA;                {% for field in blockType.getFields() %}&#xA;                    {% if field.handle == &quot;myDropDownFieldHandle&quot; %}&#xA;                        &amp;lt;select&amp;gt;&#xA;                            {% for option in field.settings.options %}&#xA;                                &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;                            {% endfor %}&#xA;                        &amp;lt;/select&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error was, in order to access a field's options you have to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;... field.settings.options NOT field.options&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-22T14:34:02.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9374" PostTypeId="2" ParentId="6732" CreationDate="2015-04-22T15:41:25.520" Score="17" Body="&lt;p&gt;Folks may also want to checkin the Super Table plugin that just came out. It allows you to create table fields that include almost any field type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, though, that in many cases this may make your CMS/data pretty dependent on a plugin.&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2015-04-22T15:41:25.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9375" PostTypeId="1" AcceptedAnswerId="9377" CreationDate="2015-04-22T15:52:19.477" Score="1" ViewCount="508" Body="&lt;p&gt;When you click in search form and press 'Enter' or 'Submit' button, it returns all entries, that exist in database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I display some message rather than all entries?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-22T17:01:27.080" Title="Search result on blank search query" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9376" PostTypeId="1" CreationDate="2015-04-22T16:47:48.450" Score="1" ViewCount="92" Body="&lt;p&gt;I'm writing a plugin that gathers up all the assets from an entry and saves it out as a zip (along with a JSON file with information from the entry).  Any advice regarding a better method is appreciated, but right now I add the code in on('entries.saveEntry'), like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $outputArray = array();&#xA;&#xA;        /* &#xA;        business logic filling variables removed for the sake of brevity &#xA;        */&#xA;&#xA;        if (($entry['sectionId'] == 3) &amp;amp;&amp;amp; ($entry['buildPage'] == 1)) {&#xA;            file_put_contents(getcwd().&quot;/build/videos.json&quot;, json_encode($outputArray));&#xA;&#xA;            $assetGroup[] = getcwd().&quot;/build/videos.json&quot;;&#xA;            $zipfile = craft()-&amp;gt;buildPage-&amp;gt;create_zip($assetGroup, $entry['uri'], getcwd().&quot;/build/&quot;);&#xA;            $filename = substr($zipfile,strrpos($zipfile,'/')+1);&#xA;&#xA;            if (file_exists($zipfile)) {&#xA;                craft()-&amp;gt;request-&amp;gt;sendFile($filename, file_get_contents( $zipfile ), array('forceDownload' =&amp;gt; true), false);&#xA;            }&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works, except that my sendFile call prevents the user from being returned to the Entries page (or stating a new entry, etc.), if that was their intent.  Is it possible to capture where they were headed before I stopped them, so that I can send them on their way?  Or is that not possible the way I have things written?&lt;/p&gt;&#xA;" OwnerUserId="34" LastActivityDate="2015-04-22T22:48:03.823" Title="Can I capture the users intent ('Save' vs 'Save and continue editing') for craft()-&gt;on('entries.saveEntry'" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugins&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9377" PostTypeId="2" ParentId="9375" CreationDate="2015-04-22T16:48:44.130" Score="2" Body="&lt;p&gt;You could use a conditional to check if your &quot;search term&quot; parameter has a value. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{% if query|length  %}&#xA;&#xA;    {% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;    {% if entries|length %}&#xA;        &amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;You forgot to enter a search term.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(This code is modified from the examples in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;Craft docs for &quot;Search Form&quot;&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2015-04-22T17:01:27.080" LastActivityDate="2015-04-22T17:01:27.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9379" PostTypeId="2" ParentId="9371" CreationDate="2015-04-22T18:22:51.327" Score="2" Body="&lt;p&gt;Custom field data is accessible via &lt;code&gt;currentUser.getContent()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;dump&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(currentUser.getContent()) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or to output as string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.getContent()|join(', ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-22T18:22:51.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9380" PostTypeId="2" ParentId="9369" CreationDate="2015-04-22T18:52:24.500" Score="2" Body="&lt;p&gt;Not tested. But it would seem to me that you could use a tags field on the backend, and a checkbox field on the front-end (built dynamically from the tags). To submit the data you could either: format the data on the front-end via javascript before form submission, or submit to a custom plugin controller that converts the checkbox data format to the expected tags format, before saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I can't tell you what the proper format for submitting tag data is from a form (I assume an array of tagIds?). If anyone knows please leave a comment and I'l update the answer (or feel free to edit the answer yourself). Might even be as simple as setting the option values to the tagId values — idk.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-22T18:52:24.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9381" PostTypeId="2" ParentId="9369" CreationDate="2015-04-22T20:01:49.717" Score="4" Body="&lt;p&gt;I don't have enough reputation to post this as a comment, but this should help you pull the data on the front end with the LJ Dynamic Fields plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;LJ Dynamic Fields&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a 'Checkboxes (dynamic)' field with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags %}&#xA;   { &quot;value&quot;:&quot;{{ tag.id }}&quot; , &quot;label&quot;:&quot;{{ tag }}&quot; }&#xA;   {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Front-end template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags %}&#xA;    &amp;lt;label&amp;gt;{{ tag }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ tag.id }}&quot; {{ tag.id in entry.myCheckboxesDynamicField ? 'checked=&quot;checked&quot;' }}&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="146" LastEditorUserId="146" LastEditDate="2015-04-22T20:08:42.107" LastActivityDate="2015-04-22T20:08:42.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9382" PostTypeId="2" ParentId="9365" CreationDate="2015-04-22T20:39:22.167" Score="3" Body="&lt;p&gt;If you're doing it from a custom bootstrap script, you'd need to do something like this for plugin logging to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require '../craft/app/bootstrap.php';&#xA;&#xA;craft()-&amp;gt;plugins-&amp;gt;loadPlugins();&#xA;MyPlugin::log('My Message', LogLevel::Error);&#xA;craft()-&amp;gt;end();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-22T20:39:22.167" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9384" PostTypeId="2" ParentId="9376" CreationDate="2015-04-22T22:48:03.823" Score="2" Body="&lt;p&gt;The 4th parameter to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#sendFile-detail&quot; rel=&quot;nofollow&quot;&gt;HttpRequestService-&gt;sendFile()&lt;/a&gt; is &lt;code&gt;$terminate = true&lt;/code&gt;, which will by default, terminate the request after the file is sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set that to &lt;code&gt;false&lt;/code&gt; and let the request continue as usual and you should be set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-22T22:48:03.823" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9385" PostTypeId="1" AcceptedAnswerId="9396" CreationDate="2015-04-23T00:28:56.393" Score="1" ViewCount="257" Body="&lt;p&gt;Is it possible to use a different html template for each system message email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively can you determine which system email is being sent from within the template that you can set in the Craft email settings?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-23T16:45:02.123" Title="Can you use a different html template for each system message email?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9386" PostTypeId="1" CreationDate="2015-04-23T01:15:20.063" Score="1" ViewCount="204" Body="&lt;p&gt;I'm using the Barrel Stength &lt;a href=&quot;https://github.com/BarrelStrength/Craft-Multi-Environment-Config&quot; rel=&quot;nofollow&quot;&gt;Craft-Multi-Environment-Config&lt;/a&gt; to have a dev and live site configuration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my local dev install, under Settings &gt; General I've changed to Site URL to {siteURL}. On logging into the admin, I'm redirected to the dev url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also changed the Assets path and URL in the admin to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Path: {basePath}../public/my_assets_folder&#xA;URL: {siteUrl}my_assets_folder/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Images on the live frontend aren't displaying - they're served by HTTPS. Dev site is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DB settings are working as expected. I just can't login to the live admin and the images aren't displaying on the dev frontend. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="3560" LastEditDate="2015-04-23T01:20:42.867" LastActivityDate="2015-08-23T00:57:24.027" Title="Craft-Multi-Environment-Config redirects to dev url on admin login" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9387" PostTypeId="1" AcceptedAnswerId="9525" CreationDate="2015-04-23T01:47:28.877" Score="1" ViewCount="592" Body="&lt;p&gt;I have entries that contain a single graphic asset. I'm trying to use the graphic as a background image in my template. However, I'm unable to output the URI for the asset. I'm using &lt;code&gt;entry.graphic.first().url&lt;/code&gt; but I get an error that the property is null. I'm using the dbug plugin to look at the properties and can see that the asset is being returned, however the URI property is null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looping through entries and am unable to return the URI for any of the graphics. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Sorry for the lack of code, guys! Below is my whole content block for the page so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container archive&quot;&amp;gt;&#xA;  &amp;lt;h1&amp;gt;Video Archives&amp;lt;/h1&amp;gt;&#xA;&#xA;  {% for entry in craft.entries.section('watch').order('seriesStart desc').type('series') %}&#xA;    {% set thumb = entry.graphic.first() %}&#xA;    &amp;lt;div class=&quot;col-md-3 seriesthumb&quot; style=&quot;background-image: url('{{thumb.url}}');&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="1150" LastEditorUserId="1150" LastEditDate="2015-04-23T16:18:33.707" LastActivityDate="2015-04-29T23:40:24.837" Title="Image asset URI returning null" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9388" PostTypeId="1" AcceptedAnswerId="9389" CreationDate="2015-04-23T03:12:15.633" Score="7" ViewCount="882" Body="&lt;p&gt;I'm working off of a linux machine (Apache) I don't use the web.config that's found in &lt;code&gt;/public/web.config&lt;/code&gt;. I will use the &lt;code&gt;.htaccess&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious if I can remove the &lt;code&gt;web.config&lt;/code&gt; file from &lt;code&gt;/craft/&lt;/code&gt; since I am not in a windows environment. I have been removing it, but not sure if that's exactly a great idea...&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-23T03:48:30.413" Title="Do I need the web.config file in the craft root directory?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9389" PostTypeId="2" ParentId="9388" CreationDate="2015-04-23T03:48:30.413" Score="8" Body="&lt;p&gt;If you're not specifically running IIS on Windows, then you can safely remove it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-23T03:48:30.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9390" PostTypeId="2" ParentId="2328" CreationDate="2015-04-23T04:38:01.860" Score="1" Body="&lt;p&gt;Spent a whole day working with the administrator at our web host trying to solve this problem. All the fixes suggested here and other sites did not help. The problem turned out to be with my third party VPN. Once that connections was turned off I was able to upload and install a Joomla extension without problem.  So if you are getting a 413 message and nothing seems to fix it check that your VPN is not the culprit.&lt;/p&gt;&#xA;" OwnerUserId="3575" LastActivityDate="2015-04-23T04:38:01.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9391" PostTypeId="1" AcceptedAnswerId="9392" CreationDate="2015-04-23T05:37:37.060" Score="0" ViewCount="515" Body="&lt;p&gt;In the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;official documentation&lt;/a&gt; it explains how to let users customize user fields in the frontend, such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;bio&quot;&amp;gt;Bio&amp;lt;/label&amp;gt;&#xA;&amp;lt;textarea id=&quot;bio&quot; name=&quot;fields[bio]&quot;&amp;gt;{{ currentUser.bio }}&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I set some user profile fields that are Radio Buttons and can't find anywhere on how to output the field options in a form. I want to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;radioButtons&quot; name=&quot;fields[radioButtons]&quot;&amp;gt;&#xA;  {% for option in fields.profile.myRadioButtons %}&#xA;    &amp;lt;option value=&quot;option&quot;&amp;gt;{{ option | title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But obviously 'fields' isn't a twig variable. Is there a way to do something similar to the above?&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2015-04-23T06:07:27.873" Title="Frontend Profile - Listing out Radio Buttons" Tags="&lt;templating&gt;&lt;form&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9392" PostTypeId="2" ParentId="9391" CreationDate="2015-04-23T06:07:27.873" Score="2" Body="&lt;p&gt;You can access the field using &lt;code&gt;currentUser.fieldHandle&lt;/code&gt;; and the 'labels' and 'values' of the field by looping through the &lt;code&gt;options&lt;/code&gt; attribute. You can also set the selected state by checking each option for the &lt;code&gt;option.selected&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;radioButtons&quot; name=&quot;fields[myRadioButton]&quot;&amp;gt;&#xA;    {% for option in currentUser.myRadioButton.options %}&#xA;        &amp;lt;option value=&quot;{{ option.value }}&quot; {% if option.selected %}checked{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-23T06:07:27.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9393" PostTypeId="1" CreationDate="2015-04-23T10:31:50.093" Score="3" ViewCount="295" Body="&lt;p&gt;My search form is returning all of the sites pages, regardless of the search term used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if I search for a load of random letters (dfbdsufbsf) all pages are returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my search form code.  I've tried changing the button to and  but no joy&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;form class='form form--search' role='search' action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;        &amp;lt;fieldset&amp;gt;&#xA;          &amp;lt;div class='input'&amp;gt;&#xA;            &amp;lt;label class='hidden' for='q'&amp;gt;Search&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input class='form__input form__input--search' placeholder=&quot;Search&quot; name='q' id=&quot;q&quot; tabindex='1' type='search'&amp;gt;&#xA;            &amp;lt;button class='form--search__button' type=&quot;submit&quot;&amp;gt;&amp;lt;/button&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;      &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is my search results page (search/results.html) (markup removed)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Search template&#xA; # ---------------&#xA;#}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;  {% set query = craft.request.getParam('q') %}&#xA;  {% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;    &amp;lt;h1 class='hero__title hero__title--news'&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;    {% if entries|length %}&#xA;        &amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&#xA;    {% if entries|length %}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this is happening.  I'm using the latest version of Craft.  This is happening locally and on production.&lt;/p&gt;&#xA;" OwnerUserId="2204" LastActivityDate="2015-08-06T01:02:38.143" Title="Search form returning all pages" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9394" PostTypeId="2" ParentId="9393" CreationDate="2015-04-23T10:46:33.077" Score="2" Body="&lt;p&gt;Sorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was a .htaccess issue&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of my redirects had a typo in it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^old-page$ /new-page [R=301,L#]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^old-page$ /new-page [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2204" LastEditorUserId="2204" LastEditDate="2015-04-23T20:08:23.917" LastActivityDate="2015-04-23T20:08:23.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9395" PostTypeId="1" CreationDate="2015-04-23T12:46:41.297" Score="4" ViewCount="1645" Body="&lt;p&gt;How would you &lt;strong&gt;redirect users&lt;/strong&gt; with an &quot;english browser&quot; &lt;strong&gt;automatically&lt;/strong&gt; to the english site? I have no idea if this can be made with craft or if this is an apache webserver thing. Any idea? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'domain.de' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'de' =&amp;gt; 'http://domain.de/',&#xA;        'en' =&amp;gt; 'http://domain.de/en/',&#xA;    ),&#xA;), &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="136" LastActivityDate="2017-04-26T19:21:37.903" Title="Localized Site -&gt; howto redirect Browser" Tags="&lt;redirect&gt;&lt;language&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9396" PostTypeId="2" ParentId="9385" CreationDate="2015-04-23T16:45:02.123" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Alternatively can you determine which system email is being sent from within the template that you can set in the Craft email settings?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not currently, but in the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2644&quot; rel=&quot;nofollow&quot;&gt;post 2.3.2644&lt;/a&gt;) release, there will be an &lt;code&gt;emailKey&lt;/code&gt; variable available to the template so you can see which email is being sent.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-23T16:45:02.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9397" PostTypeId="1" CreationDate="2015-04-23T18:01:46.140" Score="3" ViewCount="883" Body="&lt;p&gt;I am thinking about switching to Craft from EE but need various add-ons such as a discussion forum and ratings function (with the ability to have sub-ratings), and advanced search. I did not see anything like that in the plugins page but wanted to be sure before making this decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Geoff&lt;/p&gt;&#xA;" OwnerUserId="3578" LastActivityDate="2015-04-23T18:18:05.257" Title="Does Craft have a discussion forum and ratings add-on?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9398" PostTypeId="1" CreationDate="2015-04-23T18:02:06.953" Score="1" ViewCount="210" Body="&lt;p&gt;I have a set of parameters that need to be checked before outputting an entry in a particular section of a website. The code for that looks somewhat like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for slide in craft.entries.section('events').featured('1').order('dateTime asc').limit(2) if (slide.dateTime|date_modify(&quot;tomorrow 5am&quot;)|date(&quot;c&quot;)) &amp;gt;= now|date(&quot;c&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that it obviously is looping through all entries, even those that do not match my conditional based on the date. Is there a way to prevent the loop through entries that don't match that condition to prevent bloat as there will eventually be thousands of entries that it would be looped through that do not end up being output due to the conditional.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-04-23T19:56:07.627" Title="Prevent queries based on condition" Tags="&lt;forloop&gt;&lt;queries&gt;&lt;params&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9399" PostTypeId="2" ParentId="9397" CreationDate="2015-04-23T18:18:05.257" Score="4" Body="&lt;p&gt;There is no discussion forum available in craft as of now but people that need that function seem to be using Vanila Forums and just integrating with single sign-on which seems to work just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is this which could work for ratings: &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/button-box&quot; rel=&quot;nofollow&quot;&gt;http://plugins.supercooldesign.co.uk/plugin/button-box&lt;/a&gt; which is a bit simple but depends on what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also this which could allow 'likes' &lt;a href=&quot;https://dukt.net/craft/like&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/like&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I had seen something with a bit more advanced ratings but can't seem to find it now. At the end of the day though Craft &gt; ExpressionEngine in pretty much every way. There are very few things EE can do better than Craft and even then it's usually due to a third party add-on being available there that is not yet available in Craft due to it's maturity.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-04-23T18:18:05.257" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9400" PostTypeId="1" CreationDate="2015-04-23T18:35:07.087" Score="15" ViewCount="10455" Body="&lt;p&gt;Looking through the &lt;a href=&quot;https://plus.google.com/communities/106505340287442511226&quot;&gt;Google Plus&lt;/a&gt; community and &lt;a href=&quot;http://buildwithcraft.com/community&quot;&gt;Slack&lt;/a&gt; chat history, there have been many suggestions regarding hosting for Craft websites. It may not be possible to get a single conclusive answer, but I still want to know...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What hosting company do you recommend for a Craft website?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2020-11-23T14:11:15.227" Title="Recommended hosting company for a Craft site?" Tags="&lt;hosting&gt;" AnswerCount="24" CommentCount="0" FavoriteCount="7" CommunityOwnedDate="2015-04-23T18:35:07.087" ContentLicense="CC BY-SA 3.0" />
  <row Id="9401" PostTypeId="2" ParentId="9400" CreationDate="2015-04-23T18:35:07.087" Score="25" Body="&lt;h3&gt;TL;DR&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.digitalocean.com/&quot; rel=&quot;noreferrer&quot;&gt;DigitalOcean&lt;/a&gt; (droplet running Ubuntu 14.04)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://serverpilot.io/&quot; rel=&quot;noreferrer&quot;&gt;ServerPilot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Email hosted &lt;a href=&quot;https://www.zoho.com/mail/&quot; rel=&quot;noreferrer&quot;&gt;elsewhere&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Personally, I've had great experience with &lt;a href=&quot;https://www.digitalocean.com/&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;DigitalOcean&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is a VPS solution with virtually nothing pre-installed. I've found it to be amazingly fast and stable, even for sites with a high volume of traffic. Spinning up a new VPS &amp;quot;droplet&amp;quot; is incredibly simple and painless.&lt;/p&gt;&#xA;&lt;p&gt;Since it's basically an &amp;quot;empty&amp;quot; server when you create a new droplet, I've found that DigitalOcean pairs well with &lt;a href=&quot;https://serverpilot.io/&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;ServerPilot&lt;/strong&gt;&lt;/a&gt;. Keep in mind that ServerPilot requires your droplet to be created with Ubuntu 14.04, and must run its setup before you do anything else with your droplet.&lt;/p&gt;&#xA;&lt;p&gt;ServerPilot gives you an easy interface to setup the common software you'll need to run your site... namely PHP &amp;amp; MySQL. Using both services combined, we're able to easily spin up a new droplet, set it up with ServerPilot, and be up and running quickly!&lt;/p&gt;&#xA;&lt;p&gt;Only downside... email hosting is not included in either service. So you'd need to find a separate service to handle email hosting. (We use &lt;a href=&quot;https://www.zoho.com/mail/&quot; rel=&quot;noreferrer&quot;&gt;Zoho&lt;/a&gt;, which I find to be adequate. I'm still on the lookout for the &amp;quot;perfect&amp;quot; email solution, but that's a topic for another day.)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-04-23T18:58:23.067" CommentCount="5" CommunityOwnedDate="2015-04-23T18:35:07.087" ContentLicense="CC BY-SA 3.0" />
  <row Id="9402" PostTypeId="2" ParentId="9400" CreationDate="2015-04-23T18:41:53.847" Score="3" Body="&lt;p&gt;I use both DigitalOcean like Lindsey as well as Rackspace Cloud Sites. Cloud Sites includes email so that's a perk, but it is essentially shared hosting where as with DO you have a VPS.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-04-23T18:41:53.847" CommentCount="0" CommunityOwnedDate="2015-04-23T18:41:53.847" ContentLicense="CC BY-SA 3.0" />
  <row Id="9403" PostTypeId="1" AcceptedAnswerId="9405" CreationDate="2015-04-23T18:46:37.913" Score="3" ViewCount="2743" Body="&lt;p&gt;I'm trying to get the actual file name of each images when looping through the image assets folder, which looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.kind('image').folderId('1').order('filename') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to be able to include the filename of the image as a data attribute in the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag. I tried all sorts of variations of {{ image.fileName }} but have had no luck. Can't find a solution searching here. Does anyone know how? Better yet - is there a documentation somewhere showing all the available twig attributes for assets/images?&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2015-04-23T18:56:15.237" Title="Get Asset Image File Name" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9404" PostTypeId="2" ParentId="9400" CreationDate="2015-04-23T18:52:13.183" Score="12" Body="&lt;p&gt;If you're looking for a fully-managed hosting provider, &lt;a href=&quot;https://www.arcustech.com/managed/craftcms-hosting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ArcusTech&lt;/a&gt; is top-notch.  Their servers run Craft very well and we've rarely had any issues with them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="24" LastEditDate="2017-08-17T23:40:30.880" LastActivityDate="2017-08-17T23:40:30.880" CommentCount="0" CommunityOwnedDate="2015-04-23T18:52:13.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="9405" PostTypeId="2" ParentId="9403" CreationDate="2015-04-23T18:55:01.543" Score="5" Body="&lt;p&gt;&lt;code&gt;image.filename&lt;/code&gt; should work unless I'm missing something. Note that it is case-sensitive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation on &lt;code&gt;AssetFileModel&lt;/code&gt; can be found here:&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/templating/assetfilemodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="57" LastEditDate="2015-04-23T18:56:15.237" LastActivityDate="2015-04-23T18:56:15.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9406" PostTypeId="2" ParentId="9398" CreationDate="2015-04-23T19:56:07.627" Score="1" Body="&lt;p&gt;I don't think you're going to be able to do what you're looking for purely through Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, however, write a plugin that either uses a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;service&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;variable&lt;/a&gt; or a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;Template Hook&lt;/a&gt;, so you can drop down to the PHP level and use &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand's&lt;/a&gt; &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#where-detail&quot; rel=&quot;nofollow&quot;&gt;where&lt;/a&gt; to apply your extra date conditionals to your SQL query directly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-23T19:56:07.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9407" PostTypeId="1" AcceptedAnswerId="9409" CreationDate="2015-04-23T20:55:58.990" Score="0" ViewCount="91" Body="&lt;p&gt;I'm trying to set the URL of my product entry's to be dynamically created based on 3 category fields and 2 number fields. The category fields are required, but I need to add some logic for the number fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's all taking up so much space that upon saving the section's settings, the URL Format field cuts off some of my code. I'm sure there is a great reason that this field has a character limit so is there anything else I can do? I tried importing a macro, but couldn't get that to work. Do I have to create a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the content I need to use in my Entry URL Format that is too long with my variable names:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;some-text-here/{%if object.mfgCategory.first.slug==&quot;1hack&quot;%}hack{%else%}{mfgCategory.first.slug}{%endif%}-{%for c in object.series%}{c.slug}-{%endfor%}{sizeCategory.first.slug}-{%if object.num1=='0'%}00{%else%}{number1}{%endif%}-{%if object.number2=='0'%}00{%else%}{number2}{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2191" LastEditorUserId="57" LastEditDate="2015-04-23T21:25:31.953" LastActivityDate="2015-04-23T21:25:31.953" Title="My Entry URL Format needs are too long for the field restrictions" Tags="&lt;control-panel&gt;&lt;url&gt;&lt;format&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9408" PostTypeId="2" ParentId="9407" CreationDate="2015-04-23T21:01:28.930" Score="2" Body="&lt;p&gt;You could refactor it using &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary syntax&lt;/a&gt; and see if it fits. Otherwise you could also do it with a plugin and listen to &lt;code&gt;beforeSaveEntry&lt;/code&gt; events.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-23T21:01:28.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9409" PostTypeId="2" ParentId="9407" CreationDate="2015-04-23T21:07:17.067" Score="1" Body="&lt;p&gt;One thing that might help is to use the Ternary Operator described here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/templates.html#other-operators&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{object.mfgCategory.first.slug==&quot;1hack&quot;?'hack':mfgCategory.first.slug}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%if object.mfgCategory.first.slug==&quot;1hack&quot;%}hack{%else%}{mfgCategory.first.slug}{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's slightly shorter so might help a bit.&lt;/p&gt;&#xA;" OwnerUserId="146" LastActivityDate="2015-04-23T21:07:17.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9410" PostTypeId="1" AcceptedAnswerId="9412" CreationDate="2015-04-23T21:21:48.893" Score="1" ViewCount="848" Body="&lt;p&gt;Just starting to play with Craft going to be a learning curve coming from wp and processwire etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a custom Global Set and called it Logo which I assumed I could use in the _layout.html template to show a logo in the header and make it easy to change etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I called the set Logo and it has a handle of logo. This created the Globals option in the top nav. Here I was able to upload a logo from my assets etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the _layout.html template I am trying to access this image by using the following but nothing shows up.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ Logo.logo }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on the docs it says:&#xA;You can access your Global Sets from any template via their handles. For example, if you have a Global Set with the handle “companyInfo”, and it has a field with the handle “yearEstablished”, you can access that field anywhere using this code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ companyInfo.yearEstablished }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ Logo.logo.url() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong am I going about this the wrong way?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-04-23T22:10:26.510" Title="Accessing Global Set Variable" Tags="&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9411" PostTypeId="2" ParentId="9400" CreationDate="2015-04-23T21:44:04.530" Score="7" Body="&lt;p&gt;I've got Craft sites running well on both &lt;a href=&quot;https://www.webfaction.com&quot;&gt;WebFaction&lt;/a&gt; and &lt;a href=&quot;https://www.tsohost.com&quot;&gt;Tsohost&lt;/a&gt;'s cloud hosting platform.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-04-23T21:44:04.530" CommentCount="3" CommunityOwnedDate="2015-04-23T21:44:04.530" ContentLicense="CC BY-SA 3.0" />
  <row Id="9412" PostTypeId="2" ParentId="9410" CreationDate="2015-04-23T22:03:41.390" Score="3" Body="&lt;p&gt;Image fields are an array, because you can have multiple images within that field. Usually you would loop through the array to output your images:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if Logo.logo | length %}&#xA;    {% for image in Logo.logo %}&#xA;        {{ image.url }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you only have a single image in the array, you can just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = Logo.logo.first() %}&#xA;&#xA;{% if image %}&#xA;    {{ image.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on Asset templating &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#templating&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="146" LastEditorUserId="146" LastEditDate="2015-04-23T22:10:26.510" LastActivityDate="2015-04-23T22:10:26.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9413" PostTypeId="1" AcceptedAnswerId="9418" CreationDate="2015-04-23T22:14:57.053" Score="0" ViewCount="388" Body="&lt;p&gt;Im trying to render a site macro from my plugin, i’m getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Argument 1 passed to Twig_Template::display() must be of the type array, object given, called in /path/to/file.php on line 51 and defined in &quot;_macros/elements&quot; at line 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My service contains the following method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function renderSiteMacro($template, $macro, array $args)&#xA;{&#xA;    // Get the current template path&#xA;    $originalPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;&#xA;    // Point Twig at the site templates&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath());&#xA;&#xA;    // Render the macro.&#xA;    $html = craft()-&amp;gt;templates-&amp;gt;renderMacro($template, $macro, $args);&#xA;&#xA;    // Restore the original template path&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($originalPath);&#xA;&#xA;    return TemplateHelper::getRaw($html);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And i'm calling it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$args = array(&#xA;    'entry' =&amp;gt; $user,&#xA;    'layout' =&amp;gt; 'friend'&#xA;);&#xA;&#xA;$userHtml = craft()-&amp;gt;logic-&amp;gt;renderSiteMacro('_macros/elements', 'listing', $args);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The issue appears to be with the include line in my macro template file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro listing(config) %}&#xA;{% include &quot;_macros/elements/listing&quot; with config only %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what i'm missing?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-24T08:09:44.660" Title="How to render a macro from a plugin?" Tags="&lt;plugin-development&gt;&lt;macro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9414" PostTypeId="1" AcceptedAnswerId="9416" CreationDate="2015-04-23T23:33:25.013" Score="0" ViewCount="131" Body="&lt;p&gt;Im creating a gallery for Fancybox and only wish to show the first image. The rest are hidden in a container and only referenced so that Fancybox can call on these latter. I've tried two approaches: anchor tag with and without the image tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure that this is a recent change as I have been using this technique on earlier craft versions and gettting good results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;hide&quot;&amp;gt;&#xA;  &amp;lt;a title=&quot;{{ image.title }}&quot; href=&quot;{{ image.getUrl('wide') }}&quot; class=&quot;fb&quot; rel=&quot;fb-{{ ind }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ image.getUrl('wide') }}&quot; title=&quot;{{ image.title }}&quot; style=&quot;display: block!important&quot; /&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The image is generated but it looks like in a temporary location &quot;...cpresources/transforms...&quot; to which Fancybox doesn't recognise.&lt;/p&gt;&#xA;" OwnerUserId="3478" LastEditorUserId="3478" LastEditDate="2015-04-23T23:49:27.260" LastActivityDate="2015-04-24T05:00:35.423" Title="Why does asset creation not work for hidden images?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9415" PostTypeId="2" ParentId="9400" CreationDate="2015-04-24T02:48:54.000" Score="0" Body="&lt;p&gt;I have all my hosting through &lt;a href=&quot;http://mediatemple.net/&quot; rel=&quot;nofollow&quot;&gt;Media Temple&lt;/a&gt; I've never had a problem - love the support.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-24T02:48:54.000" CommentCount="9" CommunityOwnedDate="2015-04-24T02:48:54.000" ContentLicense="CC BY-SA 3.0" />
  <row Id="9416" PostTypeId="2" ParentId="9414" CreationDate="2015-04-24T05:00:35.423" Score="2" Body="&lt;p&gt;Set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;nofollow&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; in your config/general.php file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Configures Craft to generate new image transforms right when getUrl()&#xA;  is called, rather than when the browser first requests the image.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3478" LastActivityDate="2015-04-24T05:00:35.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9417" PostTypeId="2" ParentId="9413" CreationDate="2015-04-24T05:36:43.313" Score="2" Body="&lt;p&gt;The format of the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;include tag&lt;/a&gt; is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'template' with {var1: value1, var2: value2} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What you need after the &lt;code&gt;with&lt;/code&gt; is an associative array (an array with keys and values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific case you want this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_macros/elements/listing&quot; with {config: config} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-24T05:36:43.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9418" PostTypeId="2" ParentId="9413" CreationDate="2015-04-24T08:09:44.660" Score="2" Body="&lt;p&gt;Searching for uses of &lt;code&gt;renderMacro&lt;/code&gt; in the Craft code I see that it is always called like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;renderMacro('_includes/forms', 'textield', array(&#xA;  array(&#xA;    'name' =&amp;gt; 'find',&#xA;    'placeholder' =&amp;gt; Craft::t('Find'),&#xA;  )&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, what you want is probably&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = craft()-&amp;gt;templates-&amp;gt;renderMacro($template, $macro, array($args));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is not at all clear from the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#renderMacro-detail&quot; rel=&quot;nofollow&quot;&gt;renderMacro&lt;/a&gt; documentation...&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-24T08:09:44.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9419" PostTypeId="1" CreationDate="2015-04-24T08:57:00.097" Score="2" ViewCount="235" Body="&lt;p&gt;There is Yii demo tutorial at &lt;a href=&quot;http://www.yiiframework.com/screencasts/&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/screencasts/&lt;/a&gt; that uses the Yii Code Generator. Are there similar Code Generator tools in Craft?&lt;/p&gt;&#xA;" OwnerUserId="3521" LastActivityDate="2015-06-22T19:10:33.127" Title="Are there any tools for Craft similar to the Yii Code Generator?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9420" PostTypeId="1" CreationDate="2015-04-24T09:14:12.437" Score="2" ViewCount="164" Body="&lt;p&gt;Im running in to issues with returnJson not returning html or just returning and empty object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userHtml = craft()-&amp;gt;logic-&amp;gt;renderSiteMacro('_macros/elements', 'listing', $args);&#xA;&#xA;$this-&amp;gt;returnJson(array(&#xA;     'success' =&amp;gt; true,&#xA;     'existing' =&amp;gt; $userHtml&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The return JSON is always:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;success&quot;:true,&quot;existing&quot;:{}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have double checked the html output exists and the issue persists: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Whether returning a simple string or large chunk of html&lt;/li&gt;&#xA;&lt;li&gt;And with and without single quotes&lt;/li&gt;&#xA;&lt;li&gt;When renderSiteMacro functions runs the code through the raw filter and not&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-24T10:36:03.357" Title="Issues with returnJson not returning html?" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9421" PostTypeId="1" CreationDate="2015-04-24T09:20:07.467" Score="4" ViewCount="279" Body="&lt;p&gt;I have a bunch of entries in a section called 'artikkel'. The 14 first of these entries are listed out in another section called 'forside'. Now I need to list out the entries that's not already been shown. Printing out the first 14 entries looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.artikkelbolk1.limit(14) %}&#xA;    &amp;lt;div class=&quot;older_articles&quot;&amp;gt;&#xA;        &amp;lt;!--print out article content--&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rest of the articles that I'm loading in with ajax is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}&#xA;    &amp;lt;div class=&quot;older_articles ajax_article&quot;&amp;gt;&#xA;        &amp;lt;!--print out article content--&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course the last one now prints all the articles that's already been printed before. PS: This is the first time I'm working with Craft.&lt;/p&gt;&#xA;" OwnerUserId="3581" LastEditorUserId="125" LastEditDate="2015-04-24T09:31:34.707" LastActivityDate="2018-04-30T11:43:18.333" Title="Get entries that's not already listed" Tags="&lt;templating&gt;&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9423" PostTypeId="2" ParentId="9420" CreationDate="2015-04-24T10:21:50.890" Score="4" Body="&lt;p&gt;It appears whitespace was the cause here, just running a quick whitespace filer on the return value resolved the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userHtml = craft()-&amp;gt;logic-&amp;gt;renderSiteMacro('_macros/elements', 'listing', $args);&#xA;&#xA;$userHtml = preg_replace('~&amp;gt;\\s+&amp;lt;~m', '&amp;gt;&amp;lt;', $userHtml);&#xA;&#xA;$this-&amp;gt;returnJson(array(&#xA;    'success' =&amp;gt; true,&#xA;    'existing' =&amp;gt; $userHtml&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastEditorUserId="158" LastEditDate="2015-04-24T10:36:03.357" LastActivityDate="2015-04-24T10:36:03.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9424" PostTypeId="2" ParentId="9421" CreationDate="2015-04-24T11:10:50.553" Score="3" Body="&lt;p&gt;This is how you're getting your &lt;em&gt;&quot;Forside&quot; articles&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.artikkelbolk1.limit(14) %}&#xA;    &amp;lt;!--print out article content--&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this let me assume you're using an entries field to &quot;collect&quot; articles from your &quot;artikkelbolk1&quot; section.&#xA;The Twig syntax you're using is actually a shortcut for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries({&#xA;    relatedTo: { sourceElement: entry, field: 'artikkelbolk1' },&#xA;    order:     'sortOrder',&#xA;    limit:     14&#xA;}) %}&#xA;    &amp;lt;!--print out article content--&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it get's you all entries related to your current &lt;code&gt;entry&lt;/code&gt;, the preset entry model of your &quot;forside&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get &lt;em&gt;all articles not listed on &quot;Forside&quot;&lt;/em&gt; you'd do this. First, grab those &quot;forside&quot; entries again, but you're only interested in the IDs&#xA;of the entry models, that's why you now append the &lt;code&gt;ids()&lt;/code&gt; method. Then join the IDs into a string with the following syntax (use Twig's &lt;code&gt;join&lt;/code&gt; filter for that!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'and, not 42, not 82, not 20'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it basically lists all entry IDs prefixed with &lt;code&gt;'not'&lt;/code&gt;; the &lt;code&gt;'and'&lt;/code&gt; at the beginning just makes Craft aware that you're listing multiple values. With this string you can now go ahead and exclude your entries from an ElementCriteriaModel. To do that simply pass the string into the &lt;code&gt;id&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set forside = craft.entries.section('forside').first() %}&#xA;&#xA;{% set forsideEntriesIds = craft.entries({&#xA;    relatedTo: { sourceElement: forside, field: 'artikkelbolk1' },&#xA;    order:     'dateCreated desc',&#xA;    limit:     14&#xA;}).ids() %}&#xA;&#xA;{% set idParam = 'and, not ' ~ forsideEntriesIds|join(', not ') %}&#xA;&#xA;{% for entry in craft.entries.section('artikkel').id(idParam).order('dateCreated desc') %}&#xA;    &amp;lt;!--print out article content--&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-04-30T11:43:18.333" LastActivityDate="2018-04-30T11:43:18.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9425" PostTypeId="1" AcceptedAnswerId="10196" CreationDate="2015-04-24T11:17:53.360" Score="5" ViewCount="732" Body="&lt;p&gt;I've read somewhere you can't rename files on Amazon S3, which might explain my not being able to rename assets hosted on S3? Or, have P&amp;amp;T found a way around this and I've just not set the right user permissions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current permissions for this user are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &quot;Action&quot;: [&#xA;            &quot;s3:ListAllMyBuckets&quot;,&#xA;            &quot;s3:PutObject&quot;,&#xA;            &quot;s3:PutObjectAcl&quot;,&#xA;            &quot;s3:DeleteObject&quot;&#xA;        ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Clive&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-06-18T16:12:23.270" Title="Renaming files on Amazon S3 through Craft backend" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9426" PostTypeId="1" AcceptedAnswerId="9427" CreationDate="2015-04-24T14:28:19.093" Score="2" ViewCount="353" Body="&lt;p&gt;So I was reading an article on craft, and found an example of something I am trying to do. Creating a global for header/footer links etc so they can be managed dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of what they did.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qP0yS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I setup a Header global and Header goup for a matrix field. Any idea what field type they used to Add a row for the links?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't think of any field options in this matrix block to allow this kind of option. Seems like maybe this would be a custom plugin field type or something that creates this kind of option. Clicking Add a row could popup a modal to choose an entry, then inserts the url and label with the label being editable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea how they did this?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I ended up finding a Craft menus plugin which is great and is now what I am going to use for my menus. You can find it here if anyone is looking for a menu system:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/familiar-studio/craft-menus&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/familiar-studio/craft-menus&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="45" LastEditDate="2015-04-25T06:26:17.883" LastActivityDate="2015-04-25T06:26:17.883" Title="Found cool example of Header Globals what field type is used for this?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;fieldtypes&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9427" PostTypeId="2" ParentId="9426" CreationDate="2015-04-24T14:31:55.763" Score="4" Body="&lt;p&gt;Looks to me like a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;matrix&lt;/code&gt;&lt;/a&gt; field with 1 block (Navigation) and two fields :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plain-text-fields&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;Plain Text&lt;/code&gt;&lt;/a&gt; - Headline&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;Table&lt;/code&gt;&lt;/a&gt; - 2 columns with headings Label (&lt;code&gt;Single-line text&lt;/code&gt;) and URL (&lt;code&gt;Single-line text&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's worth noting that the &lt;code&gt;table&lt;/code&gt; field doesn't have a &lt;code&gt;relations&lt;/code&gt; column, so they're probably inserting these URLs manually.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2015-04-24T14:31:55.763" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9428" PostTypeId="2" ParentId="9419" CreationDate="2015-04-24T14:49:15.087" Score="1" Body="&lt;p&gt;I believe you're referring to &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/topics.gii&quot; rel=&quot;nofollow&quot;&gt;Gii&lt;/a&gt;, Yii's CRUD code generation tool.  We specifically removed that from Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of any Craft-specific code generation tools.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-24T14:49:15.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9429" PostTypeId="1" AcceptedAnswerId="9439" CreationDate="2015-04-24T15:28:57.493" Score="1" ViewCount="64" Body="&lt;p&gt;I think this is some kind of a Redactor bug. This used to work just fine but within the last couple of Craft updates all of my words styled with the  within a paragraph tag ends up unstyled with a &quot;&quot; before the words that were styled with with this tag when saved, when loading a saved Entry Redactor loads it this way. It seems to happen only to the second styled  instances. I've contacted support but they didn't have an answer. I'm quite desperate to fix this as it's messing up our style guide Craft based site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0M3ZI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-04-24T18:21:53.630" Title="How do I keep the 2nd &lt;code&gt; styled inside a &lt;p&gt; in my Rich Text (Redactor) editor?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9430" PostTypeId="1" CreationDate="2015-04-24T16:16:19.517" Score="0" ViewCount="96" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/A-P/Embedder&quot; rel=&quot;nofollow&quot;&gt;Embedder&lt;/a&gt; offers up some cool functionality, but I don't see where it explains how to set video parameters. It says you can, but not seeing how. Anyone successfully done this?&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="130" LastEditDate="2015-04-24T18:05:55.207" LastActivityDate="2015-04-24T18:05:55.207" Title="Using parameters with Embedder" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9431" PostTypeId="2" ParentId="9430" CreationDate="2015-04-24T16:22:26.420" Score="2" Body="&lt;p&gt;You have to use the previous example and format your own code to match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;youtube_showinfo=&quot;0&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it goes in as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;youtube_showinfo:0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="377" LastActivityDate="2015-04-24T16:22:26.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9432" PostTypeId="2" ParentId="9430" CreationDate="2015-04-24T16:22:46.460" Score="2" Body="&lt;p&gt;The documentation has an example and a list of supported parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You basically pass a configuration object into the Embedder function. For example in this case I am setting &lt;code&gt;max_width&lt;/code&gt; and &lt;code&gt;max_height&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.embedder.embed (entry.videoField, {max_width:500, max_height:800}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Are you looking for a specific parameter?&lt;/p&gt;&#xA;" OwnerUserId="1060" LastActivityDate="2015-04-24T16:22:46.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9433" PostTypeId="1" CreationDate="2015-04-24T17:17:36.270" Score="2" ViewCount="137" Body="&lt;p&gt;We just have experienced a massive hit (traffic) on our site due to a campaign and have noticed that the craft caching solution is not really working well for the templates/html. We are wondering if there is anything else and how we can set it up to cache to MEMCACHED or any other system instead of the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some interesting posts on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2464/is-there-a-way-to-override-the-template-caching-system&quot;&gt;Is there a way to override the template caching system?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS also the render controller is not performing and is taking over 1s to complete. Any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="3334" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-05-24T20:43:03.387" Title="Caching and Rendering" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9434" PostTypeId="1" CreationDate="2015-04-24T17:34:38.360" Score="2" ViewCount="52" Body="&lt;p&gt;This may be basic but not finding the right way to do it so here is a question.&#xA;I have a category page where each has its own url and have custom fields on it. But for some reason the author is not showing on the right side like the entries do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reason categories dont have authors or am i missing something?&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-04-24T17:43:09.373" Title="Can a Category Entry have an Author" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9435" PostTypeId="2" ParentId="9434" CreationDate="2015-04-24T17:42:54.033" Score="3" Body="&lt;p&gt;Categories do not have authors. They should not be considered &quot;content&quot; like entries in channels or structures, but as a way to relate entries or assets together. If you needed to associate a category with a particular person, you can create a user field and add it to the categories custom fields. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-24T17:42:54.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9436" PostTypeId="2" ParentId="9434" CreationDate="2015-04-24T17:43:09.373" Score="2" Body="&lt;p&gt;As far as I am aware, &lt;code&gt;categories&lt;/code&gt; do not support authors. And I would guess that it was just a best-use-case decision in the design of craft; generally categories would be to used to organize entries independent of author. If you need author support, then I would suggest using a structure or channel, which in most other respects can serve the same purpose and be used in the same way.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-24T17:43:09.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9437" PostTypeId="1" AcceptedAnswerId="9438" CreationDate="2015-04-24T17:49:19.147" Score="1" ViewCount="1484" Body="&lt;p&gt;I have some validation that checks for a unique email when creating a new person. Works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I am updating the person, it's no surprise the system won't let me save because the email I am saving already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a condition that compares the id to the existing person to who is getting updated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin_EmailValidator.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$person = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('id, 'firstName, lastName')&#xA;    -&amp;gt;from('people')&#xA;    -&amp;gt;where('email=:email', array(':email' =&amp;gt; $model['email']))&#xA;    -&amp;gt;queryRow();&#xA;&#xA;if(!empty($person)) {&#xA;    error_log('MATCH FOUND');&#xA;&#xA;   // I have the id of the existing account. Need to compare against uri segment?&#xA;  $existingId = $person['id];&#xA;  $segment = craft()-&amp;gt;request-&amp;gt;getLastSegment();&#xA;&#xA;  error_log($segment); // error!&#xA;&#xA;   $message = Craft::t(&quot;Email already exists.&quot;);&#xA;   $this-&amp;gt;addError($model, $attribute, $message);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what my url looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/admin/plugin/controller/update/123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see examples of using the request methods within twig, i'm trying to access it via php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getQuery('update');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will run without error, but it also returns nothing.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-04-24T18:13:39.133" Title="How do I get the last uri segment from within a plugin (php)" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9438" PostTypeId="2" ParentId="9437" CreationDate="2015-04-24T18:00:36.123" Score="3" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#segments-detail&quot; rel=&quot;nofollow&quot;&gt;segments&lt;/a&gt; property (shortcut for &lt;code&gt;getSegments()&lt;/code&gt; method) of the HttpRequestServices class, which returns an array of uri segments.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;segments;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the last segment you could use php's &lt;code&gt;end()&lt;/code&gt; or &lt;code&gt;array_pop()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$segments = craft()-&amp;gt;request-&amp;gt;segments;&#xA;echo end($segments);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-24T18:13:39.133" LastActivityDate="2015-04-24T18:13:39.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9439" PostTypeId="2" ParentId="9429" CreationDate="2015-04-24T18:21:53.630" Score="3" Body="&lt;p&gt;Looks like a Redactor bug to me as I can reproduce it on their demo site: &lt;a href=&quot;http://imperavi.com/redactor/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a support ticket with them reporting the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-24T18:21:53.630" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9440" PostTypeId="2" ParentId="9433" CreationDate="2015-04-24T18:44:09.247" Score="1" Body="&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag will only write to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't provide many details, so all I can do is offer some general advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd double check how you're using the &lt;code&gt;{% cache %}&lt;/code&gt; and make sure that you're not over-caching your data or caching lots of static data that might not need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can always through something like &lt;a href=&quot;https://www.varnish-cache.org/&quot; rel=&quot;nofollow&quot;&gt;Varnish&lt;/a&gt;/&lt;a href=&quot;https://www.fastly.com/&quot; rel=&quot;nofollow&quot;&gt;Fastly&lt;/a&gt; in front of Craft to help with template caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell Craft to use things like memcache with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting, but that only affects Craft's non-template data caches.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-24T18:44:09.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9441" PostTypeId="1" AcceptedAnswerId="9442" CreationDate="2015-04-24T20:52:45.357" Score="2" ViewCount="211" Body="&lt;p&gt;I'm trying to adjust a google maps so have pins that correspond with my posts. I'm nearly there but I'm trying to load info into the info window. I can set it's content already by hand. And I have turned the info i want in the bubble into a html result. All I need to do is alter this so that the twig commands create a string I can pass on in the function that will add the pin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to create a string result from the code below, which has all the results in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I got (and this works to produce the HTML I want to put in the info window of the pin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;—&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resultsNum = 0 %}&#xA;&#xA;&amp;lt;h3&amp;gt;{{ block.location }}&amp;lt;/h3&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;{% set searchString = block.location %}&#xA;{% for entry in craft.entries.section('journal').find() %}&#xA;{% for block in entry.locations %}&#xA;    {% if block.type == &quot;location&quot; %}&#xA;        {% if block.location == searchString %}&#xA;            {% set resultsNum = resultsNum+1 %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url() }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;—&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting string would go here (this code works already if i set my own string of html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set marker = {&#xA;    lat: result.geometry.location.lat,&#xA;    lng: result.geometry.location.lng,&#xA;    content: infoHTML &#xA;    } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help!&lt;/p&gt;&#xA;" OwnerUserId="3583" LastEditorUserId="3583" LastEditDate="2015-04-24T21:27:58.680" LastActivityDate="2015-04-24T22:42:08.207" Title="Twig result/contents into string" Tags="&lt;string&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9442" PostTypeId="2" ParentId="9441" CreationDate="2015-04-24T22:42:08.207" Score="2" Body="&lt;p&gt;You can wrap your HTML in a &lt;code&gt;{% set myString %}&lt;/code&gt; block and use &lt;code&gt;myString&lt;/code&gt; however you need too. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myString %}&#xA;{% set resultsNum = 0 %}&#xA;&amp;lt;h3&amp;gt;{{ block.location }}&amp;lt;/h3&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;{% set searchString = block.location %}&#xA;{% for entry in craft.entries.section('journal').find() %}&#xA;{% for block in entry.locations %}&#xA;    {% if block.type == &quot;location&quot; %}&#xA;    {% if block.location == searchString %}&#xA;        {% set resultsNum = resultsNum+1 %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url() }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-24T22:42:08.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9443" PostTypeId="1" AcceptedAnswerId="9445" CreationDate="2015-04-25T05:55:26.380" Score="2" ViewCount="131" Body="&lt;p&gt;Been playing with a hero matrix field and can't seem to get this working correctly when all block types are not used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have four possible block types for this hero matrix field. Image, Heading, Sub Heading, and CTA. If I use each block type it will display fine, if I don't use all of the block types the rest of the page content ends up in my container for the headings and cta of the hero image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example I create a hero but don't add a cta button so I only used 3 of the 4 types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty sure this has something to do with my if statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.hero %}&amp;lt;!-- For each hero matrix field --&amp;gt;&#xA;    {% if block.type == &quot;image&quot; %}&#xA;        {% set image = block.heroimage.first() %}&#xA;        &amp;lt;div class=&quot;hero&quot; style=&quot;background: url('{{ image.url }}') no-repeat scroll 50% 50% / 100% auto rgba(0, 0, 0, 0);&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;container&quot; style=&quot;color:white;&quot;&amp;gt;&#xA;                {% elseif block.type == &quot;heading&quot; %}&#xA;                    &amp;lt;h1&amp;gt;{{ block.heading }}&amp;lt;/h1&amp;gt;&#xA;                {% elseif block.type == &quot;subHeading&quot; %}&#xA;                    &amp;lt;h2&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&#xA;                {% elseif block.type == &quot;cta&quot; %}&#xA;                    {% set ctaURL = block.ctaURL.first() %}&#xA;                    {% set ctaText = block.ctaText %}&#xA;                    {% if ctaURL %}&#xA;                        &amp;lt;a href=&quot;{{ ctaURL.url }}&quot; class=&quot;button&quot;&amp;gt;{{ ctaText }}&amp;lt;/a&amp;gt;   &#xA;                    {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}  &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of my matrix config.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9Gy0n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-04-25T14:34:55.420" LastActivityDate="2015-04-28T15:37:10.483" Title="Problem with matrix if statement for hero image other content ends up in my div" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9444" PostTypeId="1" AcceptedAnswerId="9447" CreationDate="2015-04-25T11:24:38.697" Score="2" ViewCount="208" Body="&lt;p&gt;The goal is to have single site (subdomain.domain.dev) with single locale(en_gb) in it and with one craft installation shared with this site only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if I configured &lt;em&gt;general.php&lt;/em&gt; and &lt;em&gt;db.php&lt;/em&gt; correctly to get subdomain.domain.dev loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Production steps of What I did:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Set up host to point to subdomain - subdomain.craft.dev&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folders structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;craft&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;craft.dev&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;subdomain.craft.dev&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Created database - subdomain_dev&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Uploaded necessary files to subdomain folder and edited one line of code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;// Tell Craft to serve the subdomain content&#xA;define('CRAFT_LOCALE', 'subdomain');&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Uploaded en_gb templates to &lt;em&gt;../craft/templates/en_gb&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure, If I also should edit &lt;code&gt;$craftPath&lt;/code&gt; to point to templates files for &lt;em&gt;en_gb&lt;/em&gt; locale.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edited &lt;em&gt;general.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;&#xA;// All environments&#xA;'*' =&gt; array(),&#xA;// Development environment - Locale&#xA;'craft.dev' =&gt; array( &#xA;    'devMode' =&gt; true,&#xA;    'siteUrl' =&gt; array(&#xA;        'en' =&gt; '&lt;a href=&quot;http://craft.dev&quot; rel=&quot;nofollow&quot;&gt;http://craft.dev&lt;/a&gt;',&#xA;        'en_gb' =&gt; '&lt;a href=&quot;http://subdomain.craft.dev&quot; rel=&quot;nofollow&quot;&gt;http://subdomain.craft.dev&lt;/a&gt;'&#xA;    )&#xA;)&#xA;);&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edited &lt;em&gt;db.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&lt;code&gt;&#xA;// All environments&#xA;'*' =&gt; array(&#xA;    'tablePrefix' =&gt; 'craft',&#xA;),&#xA;&#xA;// Development environment - Locale&#xA;'craft.dev' =&gt; array(&#xA;    'server' =&gt; 'localhost',&#xA;    'user' =&gt; 'root',&#xA;    'password' =&gt; '********',&#xA;    'database' =&gt; 'craft_dev',&#xA;    ),&#xA;// Development environment - Locale&#xA;'subdomain.craft.dev' =&gt; array(&#xA;    'server' =&gt; 'localhost',&#xA;    'user' =&gt; 'root',&#xA;    'password' =&gt; '********',&#xA;    'database' =&gt; 'subdomain_dev',&#xA;    )   &#xA;&lt;/code&gt;&#xA;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Locale en_gb was also created from back-end.&#xA;When I load the &lt;a href=&quot;http://subdomain.craft.dev&quot; rel=&quot;nofollow&quot;&gt;http://subdomain.craft.dev&lt;/a&gt;, I get Twig_Error_Runtime saying, that &lt;code&gt;variable&lt;/code&gt; doesn't exist.It's like templates in &lt;em&gt;../craft/templates/en_gb&lt;/em&gt; wasn't found?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-04-25T16:50:55.203" LastActivityDate="2015-04-25T16:51:44.287" Title="Separated DB for each locale in subdomain with no shared Craft installation" Tags="&lt;multi-environment&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9445" PostTypeId="2" ParentId="9443" CreationDate="2015-04-25T15:04:46.387" Score="4" Body="&lt;p&gt;The problem is that the &lt;code&gt;if&lt;/code&gt; statements are not nested properly. If your matrix does not contain the cta block for example then the 2 closing &lt;code&gt;div&lt;/code&gt; tags will never be output, which obviously destroys the layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bigger question for me is why you would want to separate the fields into different blockTypes at all. An easier approach would be to create one blockType (called 'imageHero' for example) with all 5 fields in it ('image', 'heading', 'subHeading', 'ctaEntry', 'ctaText'), which you could access directly. In this way, the blockTypes could be used for different 'types' of hero, rather than for separating out a single hero's fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.hero %}&#xA;&#xA;    {% if blocktype == 'imageHero'%}&#xA;&#xA;        {% set image = block.heroimage.first() %}&#xA;        {% if image %}&#xA;            &amp;lt;div class=&quot;hero&quot; style=&quot;background: url('{{ image.url }}') no-repeat scroll 50% 50% / 100% auto rgba(0, 0, 0, 0);&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;container&quot; style=&quot;color:white;&quot;&amp;gt;&#xA;                    {% if block.heading %}&#xA;                        &amp;lt;h1&amp;gt;{{ block.heading }}&amp;lt;/h1&amp;gt;&#xA;                    {% endif %}&#xA;                    {% if block.subHeading %}&#xA;                        &amp;lt;h2&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&#xA;                    {% endif %}&#xA;                    {% if block.ctaEntry and block.ctaText %}&#xA;                        &amp;lt;a href=&quot;{{ block.ctaEntry.first.url }}&quot; class=&quot;button&quot;&amp;gt;{{ block.ctaText }}&amp;lt;/a&amp;gt;&#xA;                    {% endif %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-28T15:37:10.483" LastActivityDate="2015-04-28T15:37:10.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9446" PostTypeId="1" AcceptedAnswerId="9449" CreationDate="2015-04-25T15:49:50.300" Score="3" ViewCount="96" Body="&lt;p&gt;Sometimes I have long running requests that do imports or similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently logging using &lt;code&gt;MyPlugin::log&lt;/code&gt; is only actually written to file once the request is done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to trigger log-flushing mid-request?&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-04-25T22:14:21.570" Title="Flushing logs halfway through a request?" Tags="&lt;plugin-development&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9447" PostTypeId="2" ParentId="9444" CreationDate="2015-04-25T15:58:51.410" Score="4" Body="&lt;p&gt;Generally speaking, locales are designed to share the same templates, so craft is not necessarily looking for a &lt;code&gt;/template/[locale]/&lt;/code&gt; folder to find the correct templates to load. You may have to specify the different locale template paths as part of your section settings in that locales database. As far as I know the only automatic locale routing happens in your public folder, if craft is trying to resolve a route for a static page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious as to why you would want to point the different locales to different databases? Keep in mind that structure and data are both stored in the craft database, so if you point 'locale1' at 'db1', and 'locale2' at 'db2', you are essentially loading two entirely separate sites (with their own CP, users, sections, fields, etc). This might make sense if you want to share templates and resources between the two sites. However, if you are also not sharing templates, then it might make more sense to just create two separate installations of craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding licensing and subdomains. My understanding is that you can use the same craft license on more than one craft install as long as they share the same primary domain (subdomains are ok). In your case you would set up your local dev environment to be something like: 'project.craft.dev' and 'localeA.project.craft.dev'; and the production environment to be 'domain.com' and 'localeA.domain.com'. You can then purchase the license on 'domain.com' and copy the license file (&lt;code&gt;craft/config/license.key&lt;/code&gt;) over to 'localeA.domain.com'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is presuming of course that they share the same primary domain. What you can NOT do is create 'domain-localeA.com' and 'domain-localeB.com' using the same license.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-25T16:51:44.287" LastActivityDate="2015-04-25T16:51:44.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9449" PostTypeId="2" ParentId="9446" CreationDate="2015-04-25T22:14:21.570" Score="2" Body="&lt;p&gt;You should be able to do that with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::getLogger()-&amp;gt;flush();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-25T22:14:21.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9450" PostTypeId="1" AcceptedAnswerId="9451" CreationDate="2015-04-25T22:16:45.213" Score="2" ViewCount="268" Body="&lt;p&gt;Can I somehow set the expiration date of an entry based on a custom-field. I ask this because I don't want the site-owner to have to manually set the expiration date (for multiple reasons)but they are setting a 'start' date in a custom field. I am currently outputting entries and limiting them by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in entries %}&#xA;                    {% set count = 0 %}&#xA;                    {% if count &amp;lt; 5 and event.dateTime|date_modify('tomorrow 5am')|date('U') &amp;gt; now|date('U') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be really fantastic though if i was able to use that same date_modify to expire the entry and remove the entries from the loop all-together due to being expired.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-04-30T03:52:59.483" Title="Dates Expiring By Custom Field date_modify" Tags="&lt;datetime&gt;&lt;expiration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9451" PostTypeId="2" ParentId="9450" CreationDate="2015-04-25T23:04:31.370" Score="3" Body="&lt;p&gt;You could write a fairly simple plugin to automatically set the expiration based off of another field value or calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugin's main file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entry-&amp;gt;section == 'Events') {&#xA;&#xA;            if (empty($entry-&amp;gt;expiryDate)) {&#xA;                $date = new DateTime($entry-&amp;gt;dateTime);&#xA;                $modifiedDate = date_modify($date, 'tomorrow 5am');&#xA;                $entry-&amp;gt;expiryDate = $modifiedDate;&#xA;                craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;            }&#xA;&#xA;        }&#xA;&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated Code&lt;/strong&gt; fixed syntax errors and added a check to see if expiration date is already set, otherwise created an endless loop (and may overwrite a manual setting).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-30T03:52:59.483" LastActivityDate="2015-04-30T03:52:59.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9453" PostTypeId="1" AcceptedAnswerId="9460" CreationDate="2015-04-26T01:23:46.947" Score="1" ViewCount="738" Body="&lt;p&gt;How do you display select Fields from a Matrix Block Type when there are multiple Fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 1 Matrix Field with Handle ‘Quotation’&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The configuration for this Matrix is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 Block Type with handle ‘quote’&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Block Type has 3 plain text Fields:&#xA;‘Quotetext’&#xA;‘QuoteBy’&#xA;‘QuoteUrl’&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I havent been able to get any output at all from this Matrix following the documentation and into following HTML structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&#xA;    &amp;lt;p&amp;gt;Quotetext&amp;lt;/p&amp;gt;&#xA;    &amp;lt;cite&amp;gt;QuoteBy&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;a href=&quot;QuoteUrl&quot;&amp;gt;QuoteUrl&amp;lt;a&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me solve this issue?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="3376" LastActivityDate="2015-04-26T08:29:52.643" Title="How do you display select Fields from a Matrix Block Type when there are multiple Fields?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9454" PostTypeId="2" ParentId="648" CreationDate="2015-04-26T01:45:56.023" Score="6" Body="&lt;p&gt;I wrote a plugin similar to lj_cookies that accomplishes this for both regular and craft secure cookies: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 2.x: &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Craft 3.x: &lt;a href=&quot;https://github.com/nystudio107/craft-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...enjoy.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-05-20T21:42:57.007" LastActivityDate="2018-05-20T21:42:57.007" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9455" PostTypeId="1" CreationDate="2015-04-26T03:51:46.010" Score="1" ViewCount="1439" Body="&lt;p&gt;I have the following code in the “main.twig” template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    {% block head %}&#xA;        &amp;lt;meta property=&quot;og:image&quot; content=&quot;{% block pageImage %}{% endblock %}&quot; /&amp;gt;&#xA;    {% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I’m trying to populate the image URL into the &amp;lt; meta &gt; tag from a Matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;templates/main&quot; %}&#xA;{% for block in entry.articleBody %}&#xA;    {% if block.type == &quot;articleImage&quot; %}&#xA;        {% set image = block.articleImage.first().getUrl() %}&#xA;        {% block pageImage %}{{ image }}{% endblock %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% block head %}{{ parent() }}{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, no URL is outputted. Does anyone know why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3497" LastEditorUserId="3497" LastEditDate="2015-04-26T03:57:01.470" LastActivityDate="2015-04-26T17:04:03.210" Title="getUrl() not working" Tags="&lt;matrix&gt;&lt;url&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9456" PostTypeId="2" ParentId="9455" CreationDate="2015-04-26T05:06:07.093" Score="4" Body="&lt;p&gt;Twig generally doesn't like nested/un-nested blocks like this. A better way to deal with this would be to just set a variable; and since twig renders templates from the inside-out, any variables that you define in child-templates should be available to the parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in 'main.twig':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:image&quot; content=&quot;{% if seoImage is defined %}{{ seoImage }}{% endif %}&quot; /&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your child-template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;templates/main&quot; %}&#xA;&#xA;{# note: needs to be defined outside the 'for' loop to become available #}&#xA;{% set seoImage=&quot;&quot; %} &#xA;{% for block in entry.articleBody %}&#xA;    {% if block.type == &quot;articleImage&quot; %}&#xA;        {% set seoImage = block.articleImage.first().getUrl() %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can still use blocks of course in addition to this technique, but generally best to keep them in the same nesting order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a side-note: I don't think you need the 'templates/' part of the extends statement (unless you have a 'templates' folder inside 'templates'). Normally you would just use &lt;code&gt;{% extends &quot;_main&quot; %}&lt;/code&gt;. The underscore in the name also prevents the template from being loaded directly.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-04-26T17:04:03.210" LastActivityDate="2015-04-26T17:04:03.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9457" PostTypeId="2" ParentId="4583" CreationDate="2015-04-26T05:28:27.467" Score="2" Body="&lt;p&gt;I wrote a plugin similar to lj_cookies that accomplishes this for both regular and craft secure cookies: &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...enjoy.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="5437" LastEditDate="2019-03-16T00:32:52.067" LastActivityDate="2019-03-16T00:32:52.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9458" PostTypeId="2" ParentId="9453" CreationDate="2015-04-26T05:35:54.253" Score="1" Body="&lt;p&gt;Since matrix blocks support more than one block you generally want to loop through the blocks, then grab the fields from each block (even if there is only one block defined).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.quotation %}&#xA;    {% if block.type == 'quote' %}&#xA;        &amp;lt;blockquote&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ block.quoteText }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;cite&amp;gt;{{ block.quoteBy }}&amp;lt;/cite&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ block.quoteUrl }}&quot;&amp;gt;QuoteUrl&amp;lt;a&amp;gt;&#xA;        &amp;lt;/blockquote&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fyi... I'm using camel case in the example for all the field handles as it's the craft standard, but use whatever you use — just make sure it's actually the field 'handle' and not the field 'name'.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-26T05:35:54.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9459" PostTypeId="1" AcceptedAnswerId="9463" CreationDate="2015-04-26T06:35:57.517" Score="2" ViewCount="319" Body="&lt;p&gt;I replicated what was mentioned here: (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1738/plugins-managing-related-records/1739#1739&quot;&gt;Plugins: Managing Related Records&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm not seeing any new table created to on plugin install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &quot;LeaderRecord&quot; with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'trips'     =&amp;gt; [static::MANY_MANY, 'pluginexample_TripRecord', 'pluginexample_trip_leaders(tripId, leaderId)']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with the same relation defined in a &quot;TripRecord&quot;, am I missing something to have the tabled created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="96" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-26T18:18:57.880" Title="MANY_MANY relationships in plugins" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9460" PostTypeId="2" ParentId="9453" CreationDate="2015-04-26T08:22:14.893" Score="2" Body="&lt;p&gt;It might seem counter-intuitive in cases where you only have 1 &lt;em&gt;block type&lt;/em&gt; (i.e. &lt;code&gt;quote&lt;/code&gt;) and only a single block, but your Matrix field will always be an &lt;em&gt;array&lt;/em&gt;, where the blocks (i.e. the &quot;children&quot; of the Matrix array) aren't directly accessible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.quotation&#xA;    - block1 (quote)&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Usually, you'll output your blocks by &lt;em&gt;looping&lt;/em&gt; through the Matrix field, checking each block's type. I find that using a &lt;code&gt;{% switch %}&lt;/code&gt; statement is often cleaner than an if/else:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.quotation %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;         {% case 'quote' %}&#xA;         &amp;lt;blockquote&amp;gt;&#xA;             &amp;lt;p&amp;gt;{{ block.quoteText }}&amp;lt;/p&amp;gt;&#xA;             &amp;lt;cite&amp;gt;{{ block.quoteBy }}&amp;lt;/cite&amp;gt;&#xA;             &amp;lt;a href=&quot;{{ block.quoteUrl }}&quot;&amp;gt;QuoteUrl&amp;lt;a&amp;gt;&#xA;         &amp;lt;/blockquote&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can, however, opt to only output blocks of a certain type. This is done by &quot;filtering&quot; the Matrix field using the &lt;code&gt;type&lt;/code&gt; method, and removes the need for the &lt;code&gt;switch&lt;/code&gt; or if/else statement. This is convenient in cases where you know you'll only have 1 block type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for quote in entry.quotation.type( 'quote' ) %}&#xA;    &amp;lt;blockquote&amp;gt;&#xA;         &amp;lt;p&amp;gt;{{ quote.quoteText }}&amp;lt;/p&amp;gt;&#xA;         &amp;lt;cite&amp;gt;{{ quote.quoteBy }}&amp;lt;/cite&amp;gt;&#xA;         &amp;lt;a href=&quot;{{ quote.quoteUrl }}&quot;&amp;gt;QuoteUrl&amp;lt;a&amp;gt;&#xA;     &amp;lt;/blockquote&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you know there's only 1 block, you can even remove the loop entirely by explicitly targeting the &lt;code&gt;first&lt;/code&gt; block for your filtered block type. The actual amount of code will be about the same as the above example, though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quote = entry.quotation.type( 'quote' ).first %}&#xA;{% if quote %}&#xA;    &amp;lt;blockquote&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ quote.quoteText }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;cite&amp;gt;{{ quote.quoteBy }}&amp;lt;/cite&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ quote.quoteUrl }}&quot;&amp;gt;QuoteUrl&amp;lt;a&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-26T08:29:52.643" LastActivityDate="2015-04-26T08:29:52.643" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9461" PostTypeId="1" AcceptedAnswerId="9462" CreationDate="2015-04-26T12:44:05.360" Score="2" ViewCount="1069" Body="&lt;p&gt;I was playing around that quiet long time, because I didn't want to post the question right away I encounter on some difficulties. But here I go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The goal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is to have separate craft installs for each subdomain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I hit enter to start installation, I get this &lt;strong&gt;The requested URL /admin was not found on this server.&lt;/strong&gt; Have tried with *index.php?p=admin *, but with no effect.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I've set up virtual host &lt;em&gt;subdomain.craft.dev&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Checked, if the host loads anything. It does.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Uploaded public files to &lt;em&gt;subdomain.craft.dev&lt;/em&gt; and edited &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../subdomain.craft/craft';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S Could I simply use &lt;code&gt;$craftPath = '../subdomain.craft';&lt;/code&gt;? I've tried it at first without positive results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Created folder &lt;em&gt;subdomain.craft&lt;/em&gt; above the webroot. In it, uploaded &lt;em&gt;craft&lt;/em&gt; folder and set the permission for required directories recursively.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edited &lt;em&gt;db.php&lt;/em&gt; to the needs of Craft's installation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Run the install by visiting the host address &lt;em&gt;subdomain.craft.dev:8888/admin&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-04-27T17:27:37.817" Title="Multiple Craft install configuration in subdomains" Tags="&lt;install&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9462" PostTypeId="2" ParentId="9461" CreationDate="2015-04-26T16:18:08.110" Score="3" Body="&lt;p&gt;I also use MAMP. Here's my general process (I've used generic names in this example; but feel free to rename folders, hosts, as needed):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;create the folders for your two sites:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Applications/MAMP/htdocs/domain.craft.dev&#xA; /Applications/MAMP/htdocs/subdomain.domain.craft.dev&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Download craft, unzip and copy the &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;craft&lt;/code&gt; folders to your new folders:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Applications/MAMP/htdocs/domain.craft.dev/craft&#xA; /Applications/MAMP/htdocs/domain.craft.dev/public&#xA; /Applications/MAMP/htdocs/subdomain.domain.craft.dev/craft&#xA; /Applications/MAMP/htdocs/subdomain.domain.craft.dev/public&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create two new hosts in MAMP, 'domain.craft.dev' and 'subdomain.domain.craft.dev'; set the 'document root' to the respective '/public' folders; start server. (I also have the server set to serve on port 80 instead of the default 8080; which avoids problems with your craft configuration).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using Sequel Pro (phpMyAdmin), create two new databases. 'craft_domain' and 'craft_domain_subdomain'.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In each of the sites. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rename 'public/htaccess' to 'public/.htaccess'&lt;/li&gt;&#xA;&lt;li&gt;Set permissions on the following folders and all contents to 777 (for now; will want this &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;more restrictive&lt;/a&gt; on public servers)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft/app&lt;/li&gt;&#xA;&lt;li&gt;craft/storage&lt;/li&gt;&#xA;&lt;li&gt;craft/config (technically only need it on the license.key file)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;(optional) delete 'web.config' from 'public' and 'craft' folders (assuming you don't need them)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open 'craft/config/db.php' and set the database connection details (server, port, user, password, database).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open 'craft/config/general.php' and set your config settings, if any.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open 'public/index.php' and confirm that $craftPath = '../craft'&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Navigate to your site in the browser (domain.craft.dev) and (subdomain.domain.craft.dev) and follow on screen instructions to continue install.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have a beer and celebrate. (maybe 2... one for each site?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(Did I miss anything?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advanced. For steps 6, 7 and 8 above, I actually use a slightly different setup. Instead I use this &lt;a href=&quot;http://craftcookbook.net/recipes/273&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-environment configuration method&lt;/a&gt; from the craft cookbook site which allows you to define your environments from within your 'index.php' file; combined with Ben Parizek's technique as described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/4734/784&quot;&gt;this answer&lt;/a&gt; for automatically configuring 'siteUrl' and 'basePath' environment variables. Note: doesn't work well if MAMP is set to serve on port 8080.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-04-26T16:49:23.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9463" PostTypeId="2" ParentId="9459" CreationDate="2015-04-26T18:18:57.880" Score="2" Body="&lt;p&gt;Craft won't create the join table for you when specifying a MANY_MANY relationship.  You'll still need to manually create a record for that join table.  See Craft's own &lt;code&gt;craft/app/records/UserGroup_UserRecord.php&lt;/code&gt; as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it will do, as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1738/plugins-managing-related-records/1739#1739&quot;&gt;mentioned in the answer you linked to&lt;/a&gt; is keep the data up-to-date in the join table without having to specifically reference it in your queries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-26T18:18:57.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9464" PostTypeId="1" AcceptedAnswerId="9465" CreationDate="2015-04-26T19:34:56.187" Score="5" ViewCount="1053" Body="&lt;p&gt;I'm running PHP 5.3.3, which the docs say is supported, but if I try to go to the main admin page or go to add a field, I'm getting an error: &#xA;    Use of undefined constant JSON_HEX_TAG - assumed 'JSON_HEX_TAG'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything I'm finding online points to this being an outdated PHP issue, but thought I would check since I am running a supported version of PHP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3587" LastActivityDate="2015-04-26T20:18:57.723" Title="Use of undefined constant JSON_HEX_TAG" Tags="&lt;error-message&gt;&lt;php&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9465" PostTypeId="2" ParentId="9464" CreationDate="2015-04-26T20:18:57.723" Score="4" Body="&lt;p&gt;You're likely missing the PHP &lt;a href=&quot;https://php.net/manual/en/book.json.php&quot; rel=&quot;nofollow&quot;&gt;JSON extension&lt;/a&gt;, which is a &lt;a href=&quot;http://buildwithcraft.com/docs/requirements#required-php-extensions&quot; rel=&quot;nofollow&quot;&gt;requirement&lt;/a&gt; to run Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-26T20:18:57.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9466" PostTypeId="2" ParentId="6542" CreationDate="2015-04-27T01:16:54.723" Score="3" Body="&lt;p&gt;The most reliable way I've found to listen for the entry type switching would be to add an &lt;code&gt;ajaxComplete&lt;/code&gt; listener to the &lt;code&gt;document&lt;/code&gt; object, testing the call's URL for the &lt;code&gt;switchEntryType&lt;/code&gt; action handle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ajaxComplete(myAjaxCompleteHandler);&#xA;&#xA;function myAjaxCompleteHandler( e, status, requestData )&#xA;{&#xA;    if ( requestData.url.indexOf( 'switchEntryType' ) &amp;gt; -1 ) {&#xA;        // Entry type switched. Do your stuff!&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need the new/active entry type's ID after the switch, the easiest way to get that would be by getting the entry type dropdown's value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var entryTypeId = $( '#entryType' ).val();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other data, like all the fields and the section ID, is available as part of the &lt;code&gt;requestData&lt;/code&gt; object, specifically as a serialized string under &lt;code&gt;requestData.data&lt;/code&gt;. Here's a very basic deserialization to get to the entry type and section IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {},&#xA;    params = $.map( unescape( requestData.data ).split( '&amp;amp;' ), function ( param ) {&#xA;        param = param.split( '=' );&#xA;        data[ param[ 0 ] ] = param[ 1 ] || null;&#xA;    } ),&#xA;    sectionId = parseInt( data.sectionId ),&#xA;    entryTypeId = parseInt( data.typeId );&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field data is more complex – many fields will be &lt;em&gt;arrays&lt;/em&gt; which aren't handled well by the above example – but there's several jQuery plugins to help out with that stuff if you need it :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-24T14:33:33.213" LastActivityDate="2015-05-24T14:33:33.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9467" PostTypeId="1" AcceptedAnswerId="10481" CreationDate="2015-04-27T09:29:26.390" Score="5" ViewCount="1017" Body="&lt;p&gt;We have a problem related to the escaping of the &lt;code&gt;&amp;amp;&lt;/code&gt; in the password reset URL not being escaped. This link:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;somehow, this arrives at our server as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;amp;id=1234&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the code is &lt;code&gt;abcd&lt;/code&gt; and a parameter called &lt;code&gt;amp;id&lt;/code&gt; is &lt;code&gt;1234&lt;/code&gt;, and the error &quot;Bad Request Param &quot;id&quot; doesn't exist.&quot; is thrown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, we have craft setup to send HTML emails, and have an email template like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Click here to reset your password: {{link}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and end up with the link &lt;code&gt;http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234&lt;/code&gt; directly in the HTML - this is &lt;em&gt;WRONG&lt;/em&gt;, since the &lt;code&gt;&amp;amp;&lt;/code&gt; symbol has to be escaped as &lt;code&gt;&amp;amp;amp;&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we could compensate, and make our template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Click here to reset: {{link|escape}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then we get correct HTML, but the plain-text version of the email is now broken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there no way to have separate templates for text and html emails in craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do other people solve this?&lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="45" LastEditDate="2015-07-03T18:14:58.810" LastActivityDate="2015-07-03T20:59:53.863" Title="How to encode links in email templates?" Tags="&lt;emails&gt;&lt;escape&gt;&lt;html-entities&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9468" PostTypeId="1" AcceptedAnswerId="9470" CreationDate="2015-04-27T12:46:28.250" Score="0" ViewCount="890" Body="&lt;p&gt;I'm trying to figure out how to get the current image and text when it comes to Facebook popup sharing. I'm using the script from this answer:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/14829040/facebook-sharer-popup-window/14829742#14829742&quot;&gt;https://stackoverflow.com/questions/14829040/facebook-sharer-popup-window/14829742#14829742&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I for example want to use the image in the current article shown to share this on Facebook, how would you do it? My images for example looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for block in entry.bildekarusell %}&#xA;        {% if block.type == &quot;bilde&quot; %}&#xA;            {% for image in block.bilde %}&#xA;                &amp;lt;section&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('artikkelKarusell') }}&quot; &#xA;                     alt=&quot;{{ image.title }}&quot; &#xA;                     width=&quot;{{ asset.getWidth('artikkelKarusell') }}&quot; &#xA;                          height=&quot;{{ asset.getHeight('artikkelKarusell') }}&quot;&amp;gt;&#xA;                    {% if block.bildetekst|length &amp;gt;= 1 %}&#xA;                    &amp;lt;div class=&quot;carousel_text&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ block.bildetekst }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %} &#xA;                &amp;lt;/section&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}    &#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to I get this image when sharing on Facebook?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function fbShare(url, title, descr, image, winWidth, winHeight) {&#xA;        var winTop = (screen.height / 2) - (winHeight / 2);&#xA;        var winLeft = (screen.width / 2) - (winWidth / 2);&#xA;        window.open('http://www.facebook.com/sharer.php?s=100&amp;amp;p[title]=' + title + '&amp;amp;p[summary]=' + descr + '&amp;amp;p[url]=' + url + '&amp;amp;p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Updated text:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = entry.title %}&#xA;{% set description = entry.title %}&#xA;&#xA;{% block content %}&#xA;&amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;category&quot;&amp;gt;&#xA;    {% for category in entry.kategorier %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %} &#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;div id=&quot;authorAndTime&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;author&quot;&amp;gt;Tekst {{ entry.forfatter }} &amp;amp;bull;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span class=&quot;time&quot;&amp;gt;{{ entry.postDate|date('j. F Y') }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- End show category, title, author and time --&amp;gt;&#xA;&amp;lt;!-- Start carousel --&amp;gt;&#xA;&amp;lt;div id=&quot;carousel&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;articleslideshow&quot;&amp;gt;&#xA;    {% for block in entry.bildekarusell %}&#xA;        {% if block.type == &quot;bilde&quot; %}&#xA;            {% for image in block.bilde %}&#xA;                &amp;lt;section&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('artikkelKarusell') }}&quot; &#xA;                     alt=&quot;{{ image.title }}&quot; &#xA;                     width=&quot;{{ asset.getWidth('artikkelKarusell') }}&quot; &#xA;                          height=&quot;{{ asset.getHeight('artikkelKarusell') }}&quot;&amp;gt;&#xA;                    {% if block.bildetekst|length &amp;gt;= 1 %}&#xA;                    &amp;lt;div class=&quot;carousel_text&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ block.bildetekst }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %} &#xA;                &amp;lt;/section&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}    &#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- End carousel --&amp;gt;&#xA;&amp;lt;!-- Start ingress --&amp;gt;&#xA;&amp;lt;div id=&quot;ingress&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ entry.ingress }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- End ingress --&amp;gt;&#xA;&amp;lt;!-- Start tags: Do not show if empty--&amp;gt;&#xA;{% if entry.tags|length &amp;gt;= 1 %}&#xA;&amp;lt;ul class=&quot;tags&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;title&quot;&amp;gt;tags:&amp;lt;/li&amp;gt;&#xA;    {% for category in entry.tags %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}        &#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;!--End tags--&amp;gt;&#xA;&amp;lt;!--Start share this article--&amp;gt;&#xA;&amp;lt;div class=&quot;sharearticle&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;Del denne artikkelen:&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;button class=&quot;facebookbtn&quot;&amp;gt;&#xA;        &amp;lt;!-- share category title and image --&amp;gt;&#xA;    &amp;lt;/button&amp;gt;&#xA;    &amp;lt;button class=&quot;twitterbtn&quot;&amp;gt;Twitter&amp;lt;/button&amp;gt;&#xA;    &amp;lt;button class=&quot;pinterestbtn&quot;&amp;gt;Pinterest&amp;lt;/button&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- End share --&amp;gt;&#xA;&amp;lt;!-- Show article content --&amp;gt;&#xA;{% for block in entry.innhold %}&#xA;    {% if block.type == &quot;tekstblokk&quot; %}&#xA;        &amp;lt;article class=&quot;textblock&quot;&amp;gt;&#xA;            {{ block.tekst }}&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% elseif block.type == &quot;uthevetblokk&quot; %}&#xA;            &amp;lt;div class=&quot;highlighted&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ block.tittel }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;blockquote&amp;gt;{{ block.sitat }}&amp;lt;/blockquote&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;    {% elseif block.type == &quot;produktblokk&quot; %}&#xA;        &amp;lt;div id=&quot;products&quot; class=&quot;productlist&quot;&amp;gt;&#xA;        {% for image in block.bilde1 %}&#xA;        &amp;lt;div class=&quot;product&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('produktblokkbilde') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ block.tekstTilBilde1 }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;        {% for image in block.bilde2 %}&#xA;        &amp;lt;div class=&quot;product&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('produktblokkbilde') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ block.tekstTilBilde2 }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;        {% for image in block.bilde3 %}&#xA;        &amp;lt;div class=&quot;product&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('produktblokkbilde') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ block.tekstTilBilde3 }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;    &#xA;        {% endfor %}&#xA;{% endfor %}&#xA;&amp;lt;!-- End article content --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;    {% endblock %}&lt;/p&gt;&#xA;" OwnerUserId="3581" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-04-30T10:02:18.607" Title="Social media sharing" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9469" PostTypeId="1" AcceptedAnswerId="9473" CreationDate="2015-04-27T16:14:10.803" Score="2" ViewCount="184" Body="&lt;p&gt;Having a bit of an issue with user accounts. I created a new user account group (Super Admin) and assigned my user account to this group. Now that I've done that, I can no longer access the main settings area to edit file permissions, fields, sections, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I reset my user account so I can access the settings? More importantly, how will I be able to add additional users with the same admin level as my user account?&lt;/p&gt;&#xA;" OwnerUserId="3551" LastActivityDate="2015-04-27T17:07:07.517" Title="CP Gear Icon missing? Created new Super Admin account" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9470" PostTypeId="2" ParentId="9468" CreationDate="2015-04-27T16:28:36.270" Score="2" Body="&lt;p&gt;You will either want to construct a javascript link in twig with the populated variables, or grab the data from the DOM and call the function dynamically.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.bildekarusell %}&#xA;    {% if block.type == &quot;bilde&quot; %}&#xA;&#xA;        {% for image in block.bilde %}&#xA;&#xA;            {% set url    = entry.url %}&#xA;            {% set title  = image.title %}&#xA;            {% set descr  = block.bildetekst %}&#xA;            {% set image  = image.getUrl('artikkelKarusell') %}&#xA;            {% set height = asset.getHeight('artikkelKarusell') %}&#xA;            {% set width  = asset.getWidth('artikkelKarusell') %}&#xA;&#xA;            &amp;lt;section&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image }}&quot; alt=&quot;{{ title }}&quot; width=&quot;{{ width }}&quot; height=&quot;{{ height }}&quot; /&amp;gt;&#xA;                {% if descr %}&#xA;                    &amp;lt;div class=&quot;carousel_text&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ desc }}&amp;lt;/p&amp;gt;&#xA;&#xA;                        {# option 1: construct data link #}&#xA;                        &amp;lt;a class=&quot;fb-share&quot; data-url=&quot;{{ url }}&quot; data-descr=&quot;{{ descr }}&quot; data-title=&quot;{{ title }}&quot; data-image=&quot;{{ image }}&quot; data-winWidth=&quot;600px&quot; data-winHeight=&quot;400px&quot; &amp;gt;Share on Facebook&amp;lt;/a&amp;gt;&#xA;&#xA;                        {# option 2: call javascript function directly #}&#xA;                        &amp;lt;a class=&quot;fb-share&quot; href=&quot;javascript: fbShare({{ url }}, {{ title }}, {{ descr }}, {{ image }}, '600px', '400px'); &quot; &amp;gt;Share on Facebook&amp;lt;/a&amp;gt;&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/section&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    {% endif %}    &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are using the 'data' method (option 1 above), then you would want something like this in your js file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.fb-share').on('click', function(event) {&#xA;    event.preventDefault();&#xA;&#xA;    var url         = $(this).attr('data-url'),&#xA;        descr       = $(this).attr('data-descr'),&#xA;        title       = $(this).attr('data-title'),&#xA;        image       = $(this).attr('data-image'),&#xA;        winWidth    = $(this).attr('data-winWidth'),&#xA;        winHeight   = $(this).attr('data-winHeight');&#xA;&#xA;    fbShare(url, title, descr, image, winWidth, winHeight);&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-27T16:28:36.270" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9471" PostTypeId="2" ParentId="9469" CreationDate="2015-04-27T16:33:30.493" Score="1" Body="&lt;p&gt;I have a solution: I ended up clearing out all data in the &lt;code&gt;craft_usergroups&lt;/code&gt;, &lt;code&gt;craft_usergroups_users&lt;/code&gt;, &lt;code&gt;craft_userpermissions&lt;/code&gt;, &lt;code&gt;craft_userpermissions_usergroups&lt;/code&gt;, &lt;code&gt;craft_userpermissions_users&lt;/code&gt; tables, then in &lt;code&gt;craft_users&lt;/code&gt;, I reset the &quot;Admin&quot; field to &quot;1&quot; from &quot;0&quot; and this has solved my problem.&lt;/p&gt;&#xA;" OwnerUserId="3551" LastActivityDate="2015-04-27T16:33:30.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9472" PostTypeId="1" CreationDate="2015-04-27T17:03:05.877" Score="1" ViewCount="61" Body="&lt;p&gt;I have my users setup with a category field that links to a category of countries and each country has states/provinces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my form setup to only display the states listed under United States. The plugin I created saves this data as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is accessing the state which was saved for the user. This is my current code. It works BUT there has to be a better way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if user.addressMatrix | length %}&#xA;&#xA;    {% for addressInfo in user.addressMatrix %}&#xA;&#xA;        {% set cat = addressInfo.region[1] %}&#xA;&#xA;        {{ cat.title }}&#xA;&#xA;   {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise and thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastEditorUserId="1098" LastEditDate="2015-04-27T17:33:29.673" LastActivityDate="2015-04-28T14:37:03.893" Title="Get saved sub category on user" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9473" PostTypeId="2" ParentId="9469" CreationDate="2015-04-27T17:07:07.517" Score="4" Body="&lt;p&gt;'Admin' permission is set on the user level, whereas 'userGroup' permissions are set on the userGroup level. And as far as I know, 'admin' permission should trump any userGroup permissions. I'm not sure how you got locked out, unless you unchecked the 'Admin' checkbox on your user profile settings perhaps? Regardless, setting the 'admin' value to 1 in the &lt;code&gt;craft_users&lt;/code&gt; table should be sufficient to restore privileges, without clearing out the other tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way to create other Admins is to check the 'Admin' checkbox on the user profile permissions tab. The next best thing is create a userGroup (called 'administrator' for example) with all of the permission boxes checked. Keep in mind however, that userGroup permissions need to be set explicitly, so if you create a new section, you may need to update the userGroup permissions to allow the new section.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-27T17:07:07.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9474" PostTypeId="2" ParentId="9461" CreationDate="2015-04-27T17:27:37.817" Score="2" Body="&lt;p&gt;Get a copy of MAMP Pro and save yourself the hassle of creating virtual hosts, hacking /etc/hosts, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do 90% of what Douglas does but with some slight modifications, mostly to simplify permissions.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Serve out of your own Sites folder:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Set up a new site in ~/Sites. Then when you're creating a new subdomain, just point MAMP to the public folder inside of that subdomain. So inside ~/Sites it'll look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;New Site (whatever.craft.dev)&#xA;   - craft&#xA;   - public&lt;/code&gt; &amp;lt;-- point MAMP to this folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Another new site (another.craft.dev)&#xA;   - craft&#xA;   - public&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Run Apache/nginx as the current user:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;That way you don't have to wrestle with permissions since Apache (or nginx) will run as the account that you're logged into. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;As an aside:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Mac OS X used to ship with a copy of BIND so you could do wildcard DNS. That would allow you to setup one virtual host block and use Apache to do something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;Virtualhost *:80&amp;gt;&#xA;      VirtualDocumentRoot /Users/yourusername/Sites/%0/public/&#xA; &amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... basically mapping the hostname to the folder, so all you have to do when making a new dev site is to create a new dev folder (like &lt;code&gt;mynewsite.craft.dev&lt;/code&gt;). Some &lt;a href=&quot;http://passingcuriosity.com/2013/dnsmasq-dev-osx/&quot; rel=&quot;nofollow&quot;&gt;more reading&lt;/a&gt; on that.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-04-27T17:27:37.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9475" PostTypeId="1" AcceptedAnswerId="9483" CreationDate="2015-04-27T20:33:50.280" Score="4" ViewCount="1464" Body="&lt;p&gt;I'm writing a plugin where I need to render some semi-complex HTML clientside at runtime (all inside the CP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Garnish (or any other library/framework/JS-thingamabob shipped with Craft) offer any built-in JS templating functionality a'la &lt;a href=&quot;http://handlebarsjs.com/&quot; rel=&quot;nofollow&quot;&gt;Handlebars&lt;/a&gt; or &lt;a href=&quot;http://underscorejs.org/#template&quot; rel=&quot;nofollow&quot;&gt;Underscore&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-04-27T22:36:35.937" LastActivityDate="2015-04-28T12:09:17.650" Title="JS templating in Craft CP" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9477" PostTypeId="1" AcceptedAnswerId="9478" CreationDate="2015-04-27T22:02:44.867" Score="2" ViewCount="228" Body="&lt;p&gt;I have 1 Matrix field:&#xA;contentBlock&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With 2 Block types:&#xA;text&#xA;photo&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With nested fields:&#xA;text -&gt; text&#xA;photo -&gt; photo&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt at using if statements, which didn't work, to toggle between text and photo looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentBlock %}&#xA;    {% if block.type == 'text' %}&#xA;        {{ block.text }}&#xA;    {% endif %}&#xA;    {% elseif block.type == 'image' %}&#xA;        {% set image = block.image.first() %}&#xA;            {% if image %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would using {% switch %} be a better method, or was I close to correct using the if statements?&#xA;I think getting the hang of this will open up the true posibilities of using Craft Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any input on this question.&lt;/p&gt;&#xA;" OwnerUserId="3376" LastActivityDate="2015-04-29T01:23:18.507" Title="How do you use a Matrix to toggle between multiple fields from multiple blocks?" Tags="&lt;matrix&gt;&lt;switch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9478" PostTypeId="2" ParentId="9477" CreationDate="2015-04-27T22:17:18.373" Score="3" Body="&lt;p&gt;Using switch is a good way to handle this, but it looks like your conditionals are just a little off:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentBlock %}&#xA;    {% if block.type == 'text' %}&#xA;        {{ block.text }}&#xA;    {% elseif block.type == 'photo' %}&#xA;        {% set photo = block.photo.first() %}&#xA;        {% if photo %}&#xA;            &amp;lt;img src=&quot;{{ photo.getUrl('thumb') }}&quot; alt=&quot;{{ photo.title }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same thing with the switch syntax would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentBlock %}&#xA;&#xA;    {% switch block.type %}&#xA;        {% case &quot;text&quot; %}&#xA;            {{ block.text }}&#xA;        {% case &quot;photo&quot; %}&#xA;            {% set photo = block.photo.first() %}&#xA;            {% if photo %}&#xA;                &amp;lt;img src=&quot;{{ photo.getUrl('thumb') }}&quot; alt=&quot;{{ photo.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="93" LastEditorUserId="93" LastEditDate="2015-04-29T01:23:18.507" LastActivityDate="2015-04-29T01:23:18.507" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9479" PostTypeId="1" AcceptedAnswerId="9481" CreationDate="2015-04-27T22:25:08.977" Score="2" ViewCount="51" Body="&lt;p&gt;I have setup a category group to use Url's. When navigating to that url does the template have direct access to that category's inputs like you would with and entry? Or do you have to use the segment and get the data that way?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-04-27T22:35:08.300" Title="When accessing a Category url is there direct access to the Category's fields?" Tags="&lt;categories&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9481" PostTypeId="2" ParentId="9479" CreationDate="2015-04-27T22:35:08.300" Score="3" Body="&lt;p&gt;Yes, the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;CategoryModel&lt;/a&gt; for your category will be available to the template as the variable &lt;code&gt;category&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2 class=&quot;categoryTitle&quot;&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;{{ dump(category) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-04-27T22:35:08.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9482" PostTypeId="2" ParentId="9475" CreationDate="2015-04-27T22:39:26.277" Score="3" Body="&lt;p&gt;There is no built in client side/JS templating available out of the box that I know of. You can always render Twig templates via Ajax by &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&quot; rel=&quot;nofollow&quot;&gt;calling a plugin controller&lt;/a&gt; and returning a rendered HTML string, but that doesn't seem to fit your use case.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-27T22:39:26.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9483" PostTypeId="2" ParentId="9475" CreationDate="2015-04-28T05:34:54.097" Score="8" Body="&lt;p&gt;The only JS library that ships with Craft (besides the Craft-specific &lt;a href=&quot;https://github.com/pixelandtonic/Garnish&quot;&gt;Garnish&lt;/a&gt;) is jQuery. Of course, jQuery is a helpful JS library, but by no means a full-fledged framework. Fortunately, adding a separate JS library is painfully easy!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to CDN from a Twig template...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile '//full/path/to/cdn.js' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to CDN from PHP...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJsFile('//full/path/to/cdn.js');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includejsfile&quot;&gt;&lt;strong&gt;&lt;code&gt;includeJsFile&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt;, it wraps your path in a standard &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag... It doesn't matter where the file is, as long as the path is valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, a PHP call will take effect in both the back-end &lt;em&gt;and&lt;/em&gt; front-end of your site. So to keep the file loaded &lt;em&gt;only&lt;/em&gt; in your CP, make sure to wrap a conditional around it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJsFile('//full/path/to/cdn.js');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't want to CDN? No problem! The best place to store local JS files would be in a &lt;code&gt;resources&lt;/code&gt; folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;  /plugins&#xA;    /myplugin&#xA;      /resources&#xA;        /js&#xA;          /handlebars.min.js&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In that case, you can use &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/resources&quot;&gt;&lt;strong&gt;&lt;code&gt;includeJsResource&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; instead of &lt;code&gt;includeJsFile&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-04-28T05:34:54.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9484" PostTypeId="1" AcceptedAnswerId="9492" CreationDate="2015-04-28T11:04:13.687" Score="1" ViewCount="131" Body="&lt;p&gt;I'm trying to list entries in a section which are documents. Those documents are grouped by checkbox. I'd like to list the document title and the asset in the entry's url. I only want to list assets which have a specific checkbox ticket. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to output and group the assets by checkbox, but I'm struggling to find that entries asset url. Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('documentLibrary')%}&#xA;&#xA;{# get all checkbox options #}&#xA;{% set options = entries.first().documentType.options %}&#xA;{% set assets = entry.documents %}&#xA;&#xA; {% for entry in entries if entry.documentType.contains('Report') %}&#xA;    {% for asset in assets %}&#xA;       &amp;lt;a href=&quot;{{ asset.url }}&quot; type=&quot;application/pdf;&quot; class=&quot;list-group-item active&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately as expected the &lt;code&gt;{{ asset.url }}&lt;/code&gt; returns the url of the entry and not of the asset documents which is attached to the entry.&lt;/p&gt;&#xA;" OwnerUserId="3390" LastEditorUserId="3390" LastEditDate="2015-04-28T11:12:16.480" LastActivityDate="2015-04-28T16:04:41.683" Title="List entries of documents in a section grouped by checkbox" Tags="&lt;entries&gt;&lt;assets&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9486" PostTypeId="2" ParentId="9475" CreationDate="2015-04-28T12:09:17.650" Score="3" Body="&lt;p&gt;There's also &lt;a href=&quot;http://paularmstrong.github.io/swig/&quot; rel=&quot;nofollow&quot;&gt;Swig&lt;/a&gt;. We've successfully been able to share JS templating with Craft templates, and it's worked &lt;em&gt;pretty&lt;/em&gt; well. Not without it's caveats, though. Mostly coming from slight syntax differences and available filters.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-04-28T12:09:17.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9487" PostTypeId="1" CreationDate="2015-04-28T12:19:06.297" Score="1" ViewCount="56" Body="&lt;p&gt;I need to run validation in a custom fieldtype but only if a field is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you determine if the current field is required from within a fieldtype class?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-29T06:39:06.417" Title="How do you determine if the current field is required from a fieldtype class?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9488" PostTypeId="1" CreationDate="2015-04-28T12:21:29.333" Score="1" ViewCount="139" Body="&lt;p&gt;I´m working in a buggy´s website, and i want to implement a &quot;compare&quot; functionality, where the clients can check some products from the list ( a checkbox in each product ) and be able to compare the products features side by side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that i shold pass the array of values in the url from the checked products and in the compare page takes this values and filter the products. The only thing is that i don´t know how to implement it :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is welcome, thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sebastián.&lt;/p&gt;&#xA;" OwnerUserId="3505" LastEditorUserId="344" LastEditDate="2015-05-05T10:29:25.060" LastActivityDate="2015-05-05T10:29:25.060" Title="Implement a compare products funcionality" Tags="&lt;templating&gt;&lt;frontend&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9489" PostTypeId="2" ParentId="9472" CreationDate="2015-04-28T14:37:03.893" Score="1" Body="&lt;p&gt;Ok so I figured out the issue. I had the category field setup to have a limit of 1, which I assumed would be ok. My thinking was that you're only choosing 1 state. But because state is a sub category of country I need to allow for country and state AKA a limit of 2. Once I did this I was able to structure my template accordingly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if user.addressMatrix | length %}&#xA;&#xA;    {% for addressInfo in user.addressMatrix %}&#xA;&#xA;         {% if addressInfo.type == &quot;address&quot; %}&#xA;&#xA;            {% for item in addressInfo.region %}&#xA;&#xA;                {% if item.level == 2 %}&#xA;&#xA;                {{ item.title }}&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        {% endif %}&#xA;&#xA;   {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think that future releases of Craft ought to have more options for category fields, like: Restricting selections to a sub category, limiting the number of sub categories. &lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-04-28T14:37:03.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9490" PostTypeId="1" AcceptedAnswerId="9491" CreationDate="2015-04-28T15:22:09.313" Score="2" ViewCount="750" Body="&lt;p&gt;Our university is made up of many small sites.  I'd like to use craft for this.  Love the auto update feature.  I want each site to share template styles (ie. staff directories, document listings, etc.) but I want to be able to update this global library of templates as time goes on so all sites have access to the latest options.  Also being able to make a change to a global navigation and footer and have all sites updated at the same time would be key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions on how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="3595" LastActivityDate="2015-04-28T15:34:46.383" Title="Multiple sites sharing global templates" Tags="&lt;multi-environment&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9491" PostTypeId="2" ParentId="9490" CreationDate="2015-04-28T15:34:46.383" Score="1" Body="&lt;p&gt;Global templates are absolutely possible by taking advantage of the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% extends %}&lt;/code&gt;&lt;/a&gt; tag. You can read more about &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#template-inheritance&quot; rel=&quot;nofollow&quot;&gt;template inheritance in Twig's documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set up multiple sections, you can assign certain users edit privileges to their appropriate sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set up your navs and footers as &lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Globals&lt;/a&gt; (or use a &lt;a href=&quot;http://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;), you can set editing privileges just to admins. Simply create a header and footer partial template and &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;include&lt;/a&gt; them in a main template file that your other templates extend. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-04-28T15:34:46.383" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9492" PostTypeId="2" ParentId="9484" CreationDate="2015-04-28T16:04:41.683" Score="1" Body="&lt;p&gt;Your assets variable is defined outside the entries loop so it is still referring to the page entry. If you move it inside the loop it should work as expected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('documentLibrary') %}&#xA;{% for entry in entries if entry.documentType.contains('Report') %}&#xA;    {% for asset in entry.documents %}&#xA;       &amp;lt;a href=&quot;{{ asset.url }}&quot; type=&quot;application/pdf;&quot; class=&quot;list-group-item active&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than doing this manually however, you might also have a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;group&lt;/a&gt; filter, which can group the entries array by document type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('documentLibrary').find() %}&#xA;{% set groupedEntries = entries|group('documentType') %}&#xA;&#xA;{% for type, entriesByType in groupedEntries %}&#xA;    &amp;lt;h2&amp;gt;{{ type }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entriesByType %}&#xA;            {% for asset in entry.documents %}&#xA;                &amp;lt;a href=&quot;{{ asset.url }}&quot; type=&quot;application/pdf;&quot; class=&quot;list-group-item active&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: Also if each 'document' only contain one and only one 'asset' (i.e. pdf), then you can also get rid of the asset loop and just use &lt;code&gt;{{ entry.document.first.url }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-28T16:04:41.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9493" PostTypeId="1" AcceptedAnswerId="9495" CreationDate="2015-04-28T16:22:09.590" Score="2" ViewCount="122" Body="&lt;p&gt;Is it possible to set up predefined tags in craft which can then be used as either a select list or checkbox selection by editors, so as to only give them the option of adding preset tags as opposed to adding any tag they want?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-04-28T17:05:39.430" Title="Predefined Tags For Editors" Tags="&lt;tags&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9494" PostTypeId="2" ParentId="9487" CreationDate="2015-04-28T16:32:27.523" Score="1" Body="&lt;p&gt;In Craft 1/2, there isn't a particularly clean or easy way to do this because &lt;code&gt;$this-&amp;gt;model-&amp;gt;required&lt;/code&gt; is only set in the context of when it's being called from a field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of a field type, Craft doesn't set it because &lt;code&gt;required&lt;/code&gt; is a concept that belongs to a field layout and a given field can belong to multiple field layouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This whole process has been refactored and is much cleaner in Craft 3 so that &lt;code&gt;$this-&amp;gt;model-&amp;gt;required&lt;/code&gt; works in the context of a field type where you'd expect it to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-04-29T06:39:06.417" LastActivityDate="2015-04-29T06:39:06.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9495" PostTypeId="2" ParentId="9493" CreationDate="2015-04-28T17:05:39.430" Score="2" Body="&lt;p&gt;Not really (or not without a custom solution anyway) — tags are designed to be added by anyone. You might be better off using &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;categories&lt;/a&gt; for this, which you can resist access to via userGroup permissions.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-28T17:05:39.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9497" PostTypeId="1" AcceptedAnswerId="9549" CreationDate="2015-04-28T19:37:46.453" Score="2" ViewCount="1060" Body="&lt;p&gt;I want to get the first category of the deepest level for an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if the category structure looks like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ocean Life &gt; Fish &gt; Gold Fish&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want &quot;Gold Fish&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I've come up with so far. Is there a more elegant solution that I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set primaryCategory = entry.categories.level(3).first %}&#xA;            {% if primaryCategory is empty %}&#xA;                {% set primaryCategory = entry.categories.level(2).first %}&#xA;            {% endif%}&#xA;            {% if primaryCategory is empty %}&#xA;                {% set primaryCategory = entry.categories.level(1).first %}&#xA;            {% endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="196" LastActivityDate="2019-05-16T21:41:58.480" Title="Getting the first category of the deepest level for an entry" Tags="&lt;categories&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9498" PostTypeId="1" CreationDate="2015-04-28T19:47:14.870" Score="2" ViewCount="231" Body="&lt;p&gt;My plugin has a many-to-many relationship and I would like to build a &quot;associate&quot; form with search/sort, and an icon to save selected record in the assoication table.   It would be great to leverage the Craft AdminTable feature, but I need to extend the 'deleteIcon' action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3597" LastActivityDate="2015-04-29T00:34:01.637" Title="Is there documentation on Craft.AdminTable?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9499" PostTypeId="1" AcceptedAnswerId="9519" CreationDate="2015-04-28T19:53:43.327" Score="3" ViewCount="2322" Body="&lt;p&gt;I am trying to set up a form with checkboxes that allows users to filter entries by selecting multiple categories, but I am not quite getting it right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently this is my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set subcategoryParam = craft.request.getParam('subcategory') %}&#xA;{% set subcategories = craft.categories.group('partnerAreas').find() %}&#xA;&#xA;&amp;lt;form action=&quot;{{ craft.request.url }}&quot;&amp;gt;&#xA;&#xA;  {% for subcategory in subcategories %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ subcategory.slug }}&quot; id=&quot;{{ subcategory.slug }}&quot; name=&quot;subcategory&quot; {{ subcategory.slug in subcategoryParam ? 'checked'}}&amp;gt;&#xA;    &amp;lt;label class=&quot;label__checkbox&quot; for=&quot;{{ subcategory.slug }}&quot;&amp;gt;&#xA;      {{ subcategory.title }}&#xA;    &amp;lt;/label&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;&#xA;    Search&#xA;  &amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Submitting this form gets me URL query strings like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?subcategory=sourcing-local-products&amp;amp;subcategory=communication&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I am using &lt;code&gt;craft.request.getParam('subcategory')&lt;/code&gt;, only the last selected subcategory gets picked up (as you would expect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting the name on the checkbox field to &lt;code&gt;subcategory[]&lt;/code&gt;, but that gets me an &lt;code&gt;array to string conversion&lt;/code&gt; template error and the URL query string then looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?subcategory%5B%5D=sourcing-local-products&amp;amp;subcategory%5B%5D=communication&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to do to get a comma separated list for the subcategory parameter like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?subcategory=sourcing-local-products,communication&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And once that is working, how do I then get all the entries that have &lt;strong&gt;any&lt;/strong&gt; of the selected categories assigned via a Matrix field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've currently got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set subcategoryParam = craft.request.getParam('subcategory') %}&#xA;{% set selectedSubcategories = craft.categories.slug(subcategoryParam) %}&#xA;{% set entries = craft.entries({&#xA;  section: listingType,&#xA;  relatedTo: {&#xA;    targetElement: selectedSubcategories,&#xA;    field: 'involvementAreas.area'&#xA;  }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I imagine that's not quite right if I want to account for an array of selected categories...&lt;/p&gt;&#xA;" OwnerUserId="176" LastEditorUserId="176" LastEditDate="2015-04-29T15:13:48.337" LastActivityDate="2016-04-12T15:06:15.400" Title="Filter entries by multiple categories" Tags="&lt;categories&gt;&lt;filter&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9500" PostTypeId="2" ParentId="9499" CreationDate="2015-04-28T22:35:59.163" Score="2" Body="&lt;p&gt;If multiple are passed &lt;code&gt;subcategoryParam&lt;/code&gt; should be an array. So I believe you will need to process the data differently to get the categories. If you pass the id instead of the slug you could do this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;targetElement: subcategoryParam|join(',')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-04-28T22:35:59.163" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9501" PostTypeId="1" CreationDate="2015-04-28T23:03:48.890" Score="2" ViewCount="6231" Body="&lt;p&gt;This is an .htaccess question which I found the answer to but, I need to integrate it with the .htaccess that comes with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to add trailing slashes to the end of all URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is a General Config Setting for &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#addTrailingSlashesToUrls&quot; rel=&quot;nofollow&quot;&gt;adding trailing slashes to URLs&lt;/a&gt; to &quot;dynamically-generated URLs&quot; but, in the case there are any hard coded urls with out the trailing slashes or if someone links to the site without trailing slashes it would be nice to set it and forget it via the htaccess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://mydomain.dev/news/news-entry&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;would 301 redirect to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://mydomain.dev/news/news-entry/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what comes with Craft by default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2015-04-28T23:07:16.167" LastActivityDate="2016-02-24T19:30:18.427" Title="Force trailing slash on URLs" Tags="&lt;url&gt;&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9502" PostTypeId="2" ParentId="9501" CreationDate="2015-04-28T23:05:29.580" Score="4" Body="&lt;p&gt;I found by just adding the code from the &lt;a href=&quot;http://www.paulund.co.uk/using-htaccess-to-force-trailing-slash&quot; rel=&quot;nofollow&quot;&gt;following site&lt;/a&gt; it will add slashes via a 301 redirect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} /+[^\.]+$&#xA;RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now my .htaccess file looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # 301 redirect with trailing slash&#xA;    RewriteCond %{REQUEST_URI} /+[^\.]+$&#xA;    RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is another version/option which seems to work as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteRule ^(.*[^/])$ /$1/ [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a third option which seems to work as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Always append a trailing slash&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !/$&#xA;RewriteRule . %{REQUEST_URI}/ [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'll update once I've researched and settled upon the best option.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2015-04-29T00:52:53.693" LastActivityDate="2015-04-29T00:52:53.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9503" PostTypeId="1" CreationDate="2015-04-28T23:14:24.960" Score="1" ViewCount="342" Body="&lt;p&gt;I am having issues debugging craft tasks where the issue is caused by validation errors rather than php syntax / environment issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you debug validation errors in craft tasks?&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-29T00:36:36.007" Title="Task Validation Debugging" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9504" PostTypeId="2" ParentId="9498" CreationDate="2015-04-29T00:34:01.637" Score="1" Body="&lt;p&gt;None of Craft's JavaScript is documented.  Your best bet is going to be to look at the source itself in &lt;code&gt;craft/app/resources/js&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-29T00:34:01.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9505" PostTypeId="2" ParentId="9497" CreationDate="2015-04-29T00:34:34.073" Score="4" Body="&lt;p&gt;Assuming you are only assigning one category (and thus by default all of that categories ancestors), then getting the 'last' returned category should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.categories.last() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you will need some logic of some kind. What you have works, or perhaps something where you don't need to know how many levels there are.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set level = 0 %}&#xA;{% for category in entry.categories %}&#xA;    {% set level = category.level &amp;gt; level ? category.level : level %}&#xA;{% endfor %}&#xA;{% set category = entry.categories.level(level).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this will still not retrieve all the categories if there is more than one category set with same level.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2019-05-16T20:28:49.717" LastActivityDate="2019-05-16T20:28:49.717" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9506" PostTypeId="2" ParentId="9503" CreationDate="2015-04-29T00:36:36.007" Score="1" Body="&lt;p&gt;Validation errors will still get logged to &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; with a &lt;code&gt;[warning]&lt;/code&gt; label.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, you options are just like you'd debug anything else in PHP.  Preferably with &lt;a href=&quot;http://xdebug.org/&quot; rel=&quot;nofollow&quot;&gt;xDebug&lt;/a&gt;, but you can always manually &lt;code&gt;Craft::log()&lt;/code&gt; and read the log files, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-29T00:36:36.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9507" PostTypeId="1" CreationDate="2015-04-29T02:33:39.067" Score="1" ViewCount="251" Body="&lt;p&gt;I have a section where each item has its own URL e.g:&#xA;news/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Entry Template for this section is:&#xA;news/news_detail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each post I would like to have a link to a unique page which is populated with information from the fields from the parent post/group, e.g news.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slug would look something like:&#xA;news/{slug}/extra&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Entry Template for the news_detail page has a rich text field:&#xA;additional&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this more complicated, the link to this page will be visible only if the &quot;additional&quot; field is populated with data.&#xA;And finally each &quot;extra&quot; page should have a link back to the originating post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had considered using a simple JavaScript toggle, but having urls for the content is more important in this instance, so not an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any pointers as I am not sure where to start.&lt;/p&gt;&#xA;" OwnerUserId="3376" LastActivityDate="2015-04-29T09:49:25.213" Title="How to create an auxiliary page with sub url?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;field&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9508" PostTypeId="2" ParentId="9400" CreationDate="2015-04-29T07:49:24.263" Score="2" Body="&lt;p&gt;You can check out  &lt;a href=&quot;https://www.WebhostingUK.Com&quot; rel=&quot;nofollow&quot;&gt;Web Hosting UK&lt;/a&gt; or &lt;a href=&quot;https://www.rshosting.Com&quot; rel=&quot;nofollow&quot;&gt;Rshosting&lt;/a&gt; , user friendly support with SSD server to help better performance.&lt;/p&gt;&#xA;" OwnerUserId="3600" LastActivityDate="2015-04-29T07:49:24.263" CommentCount="0" CommunityOwnedDate="2015-04-29T07:49:24.263" ContentLicense="CC BY-SA 3.0" />
  <row Id="9509" PostTypeId="2" ParentId="9507" CreationDate="2015-04-29T09:49:25.213" Score="2" Body="&lt;p&gt;First you'll want 3 templates — I'll call them 'news/index.html', 'news/_entry.html', and 'news/_extra.html'. (fyi... using an underscore before the template name is good practice as it prevents the template from being loaded directly; which would likely throw an error because no entry would be defined.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll then want to create a custom route to the 'extra' page in settings, using the 'slug' token for one of the segments.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If your url looks like this: news/slug/extra (where 'slug' is the slug token)&lt;/li&gt;&#xA;&lt;li&gt;Load this template: news/_extra.html&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the '_entry.html' template, you'll want to check your 'additional' field and create a link to your '/extra' page. Note: 'entry.url' should already include the 'news/slug' portion of the uri — we'll just be adding the '/extra' segment.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.additional %}&#xA;    &amp;lt;a href=&quot;{{ entry.url ~ '/extra' }}&quot;&amp;gt;extra page&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the '_extra.html' template, there should now be a 'slug' variable available to your entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsEntry = craft.entry.section('news').slug(slug) %}&#xA;{% set newsIndex = craft.entry.section('pages').slug('news') %}&#xA;{{ newsIndex.title }} — {{ newsEntry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: I don't know in what section your 'news' index page is. I just picked something at random — you'll need to change that to match your structure.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-04-29T09:49:25.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9510" PostTypeId="1" AcceptedAnswerId="9521" CreationDate="2015-04-29T10:26:58.210" Score="1" ViewCount="202" Body="&lt;p&gt;Hi I have a plugin which is basically a form. This form has upload file field which I added in the backend side in Assets fields so I have something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                &amp;lt;fieldset&amp;gt;&#xA;                    &amp;lt;div class=&quot;file-upload btn btn-primary&quot;&amp;gt;&#xA;                        &amp;lt;span&amp;gt;Upload File&amp;lt;/span&amp;gt;&#xA;                        &amp;lt;input type=&quot;file&quot; name=&quot;fields[myAssetNameHandle]&quot;&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;              &#xA;                &amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I send the form to the server with ajax like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    var formData = new FormData($form[0]);&#xA;    $.ajax({&#xA;        type: 'POST',&#xA;        dataType: 'json',&#xA;        url: '{{ actionUrl(&quot;myplugin/sendApplication&quot;) }}',&#xA;        data: formData,&#xA;        processData: false,&#xA;        contentType: false,&#xA;    ......&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the myPluginController I have validation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $model = new myModel();&#xA;    $model-&amp;gt;test_var = craft()-&amp;gt;request-&amp;gt;getPost('test_var');&#xA;&#xA;    if ( $model-&amp;gt;validate() ) {&#xA;&#xA;    }else{&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Evrithing works fine except that I did some restriction to upload files on that asset field for example only documents so when I upload an image I do not have any errors. So how can I get the errors for that field and if there are no erorrs how can I get the name so After validation to add the file into the db? Thank you in advance and sorry for my English if is not so good.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-04-29T18:58:48.280" Title="Get file errors after upload" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9511" PostTypeId="1" CreationDate="2015-04-29T10:42:52.270" Score="2" ViewCount="1498" Body="&lt;p&gt;Craft seems to create asset files and folders with permissions 775 and 664. My host has restrictions in place to not serve folders/files with these permissions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I change this?&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-04-29T10:47:00.347" Title="Asset file/folder permissions issue" Tags="&lt;assets&gt;&lt;permissions&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9512" PostTypeId="2" ParentId="9511" CreationDate="2015-04-29T10:47:00.347" Score="4" Body="&lt;p&gt;Of course as soon as I post this, I find the answer.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/app/etc/config/defaults/general.php&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;'defaultFilePermissions' =&gt; 0664,&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;'defaultFolderPermissions' =&gt; 0775,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The default settings are there, I just need to add them to my own config.&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-04-29T10:47:00.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9513" PostTypeId="1" CreationDate="2015-04-29T12:14:29.953" Score="2" ViewCount="648" Body="&lt;p&gt;Just received this deprecated warning in the dashboard. However the file it refers to does not contain the deprecated code. Any ideas? I can locate the deprecated function in several core files though. I have the latest upgrade so not sure why it is returning this error? Anyone come across this as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling getChildren() to fetch an element’s target relations has been deprecated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Full stack Trace:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;29  Deprecation error: Calling getChildren() to fetch an element’s target relations has been deprecated. Use the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; param instead. &#xA;Called from /serverpath/craft/app/models/BaseElementModel.php (545)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;28  Craft\UserModel::getChildren()&#xA;27  call_user_func_array(array(Craft\UserModel, &quot;getChildren&quot;), array()) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (478)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;26  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::getAttribute(Craft\UserModel, &quot;getChildren&quot;, array(), &quot;method&quot;) &#xA;Called from /serverpath/craft/app/etc/templating/BaseTemplate.php (41)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;25  Template: user/profile (13) &#xA;Called from /serverpath/craft/storage/runtime/compiled_templates/c9/31/853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484.php (43)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;24  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::block_main(array(&quot;craft&quot; =&gt; Craft\CraftVariable, &quot;blx&quot; =&gt; Craft\CraftVariable, &quot;now&quot; =&gt; Craft\DateTime, &quot;loginUrl&quot; =&gt; &quot;&lt;a href=&quot;http://domainname/login&quot; rel=&quot;nofollow&quot;&gt;http://domainname/login&lt;/a&gt;&quot;), array(&quot;extraHead&quot; =&gt; array(__TwigTemplate_9b802816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27, &quot;block_extraHead&quot;), &quot;main&quot; =&gt; array(__TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484, &quot;block_main&quot;))) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (144)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;23  Template: user/_layout (101)&lt;br&gt;&#xA;Called from /serverpath/craft/storage/runtime/compiled_templates/9b/80/2816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27.php (227)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;22  __TwigTemplate_9b802816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27::doDisplay(array(&quot;craft&quot; =&gt; Craft\CraftVariable, &quot;blx&quot; =&gt; Craft\CraftVariable, &quot;now&quot; =&gt; Craft\DateTime, &quot;loginUrl&quot; =&gt; &quot;&lt;a href=&quot;http://domainname/login&quot; rel=&quot;nofollow&quot;&gt;http://domainname/login&lt;/a&gt;&quot;), array(&quot;extraHead&quot; =&gt; array(__TwigTemplate_9b802816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27, &quot;block_extraHead&quot;), &quot;main&quot; =&gt; array(__TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484, &quot;block_main&quot;))) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (279)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;21  __TwigTemplate_9b802816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27::displayWithErrorHandling(array(&quot;craft&quot; =&gt; Craft\CraftVariable, &quot;blx&quot; =&gt; Craft\CraftVariable, &quot;now&quot; =&gt; Craft\DateTime, &quot;loginUrl&quot; =&gt; &quot;&lt;a href=&quot;http://domainname/login&quot; rel=&quot;nofollow&quot;&gt;http://domainname/login&lt;/a&gt;&quot;), array(&quot;extraHead&quot; =&gt; array(__TwigTemplate_9b802816e813e2db8b5808c859ea97942fccd5b7f9bec86451c103eb6b2e5f27, &quot;block_extraHead&quot;), &quot;main&quot; =&gt; array(__TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484, &quot;block_main&quot;))) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (253)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;20  Template: user/_layout (1)&lt;br&gt;&#xA;Called from /serverpath/craft/storage/runtime/compiled_templates/c9/31/853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484.php (31)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;19  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::doDisplay(array(&quot;craft&quot; =&gt; Craft\CraftVariable, &quot;blx&quot; =&gt; Craft\CraftVariable, &quot;now&quot; =&gt; Craft\DateTime, &quot;loginUrl&quot; =&gt; &quot;&lt;a href=&quot;http://domainname/login&quot; rel=&quot;nofollow&quot;&gt;http://domainname/login&lt;/a&gt;&quot;), array(&quot;main&quot; =&gt; array(__TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484, &quot;block_main&quot;))) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (279)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;18  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::displayWithErrorHandling(array(&quot;craft&quot; =&gt; Craft\CraftVariable, &quot;blx&quot; =&gt; Craft\CraftVariable, &quot;now&quot; =&gt; Craft\DateTime, &quot;loginUrl&quot; =&gt; &quot;&lt;a href=&quot;http://domainname/login&quot; rel=&quot;nofollow&quot;&gt;http://domainname/login&lt;/a&gt;&quot;), array(&quot;main&quot; =&gt; array(__TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484, &quot;block_main&quot;))) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (253)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;17  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::display(array()) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Template.php (264)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;16  __TwigTemplate_c931853f702811dd00a8d276cbef73ef24b391da71bd1ae0c434f5db4f701484::render(array()) &#xA;Called from /serverpath/craft/app/vendor/twig/twig/lib/Twig/Environment.php (292)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;15  Twig_Environment::render(&quot;user/profile&quot;, array()) &#xA;Called from /serverpath/craft/app/services/TemplatesService.php (220)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;14  Craft\TemplatesService::render(&quot;user/profile&quot;, array()) &#xA;Called from /serverpath/craft/app/controllers/BaseController.php (74)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;13  Craft\TemplatesController::renderTemplate(&quot;user/profile&quot;, array()) &#xA;Called from /serverpath/craft/app/controllers/TemplatesController.php (55)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;12  Craft\TemplatesController::actionRender(&quot;user/profile&quot;, array())&lt;/p&gt;&#xA;&#xA;&lt;p&gt;11  ReflectionMethod::invokeArgs(Craft\TemplatesController, array(&quot;user/profile&quot;, array())) &#xA;Called from /serverpath/craft/app/framework/web/actions/CAction.php (108)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10  CInlineAction::runWithParamsInternal(Craft\TemplatesController, ReflectionMethod, array(&quot;p&quot; =&gt; &quot;user/profile&quot;, &quot;variables&quot; =&gt; array(), &quot;template&quot; =&gt; &quot;user/profile&quot;)) &#xA;Called from /serverpath/craft/app/framework/web/actions/CInlineAction.php (47)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;9   CInlineAction::runWithParams(array(&quot;p&quot; =&gt; &quot;user/profile&quot;, &quot;variables&quot; =&gt; array(), &quot;template&quot; =&gt; &quot;user/profile&quot;)) &#xA;Called from /serverpath/craft/app/framework/web/CController.php (308)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8   Craft\TemplatesController::runAction(CInlineAction) &#xA;Called from /serverpath/craft/app/framework/web/CController.php (286)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7   Craft\TemplatesController::runActionWithFilters(CInlineAction, array()) &#xA;Called from /serverpath/craft/app/framework/web/CController.php (265)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6   Craft\TemplatesController::run(&quot;render&quot;) &#xA;Called from /serverpath/craft/app/framework/web/CWebApplication.php (282)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5   Craft\WebApp::runController(&quot;templates/render&quot;) &#xA;Called from /serverpath/craft/app/framework/web/CWebApplication.php (141)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4   Craft\WebApp::processRequest() &#xA;Called from /serverpath/craft/app/etc/web/WebApp.php (266)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3   Craft\WebApp::processRequest() &#xA;Called from /serverpath/craft/app/framework/base/CApplication.php (180)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2   Craft\WebApp::run() &#xA;Called from /serverpath/craft/app/index.php (62)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1   require_once(&quot;/serverpath/craft/app/index.php&quot;) &#xA;Called from /serverpath/public/index.php (19)&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-04-30T10:09:01.463" LastActivityDate="2015-04-30T10:09:01.463" Title="Deprecated Warning" Tags="&lt;updating&gt;&lt;function&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9514" PostTypeId="1" AcceptedAnswerId="9517" CreationDate="2015-04-29T12:33:27.230" Score="4" ViewCount="3089" Body="&lt;p&gt;I am trying to remove the &lt;code&gt;http://&lt;/code&gt; and trailing slash from a string, so my replace filter looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;website|replace({ 'http://': '', '/\\/$/': '' })&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;http://&lt;/code&gt; part works, the trailing slash one doesn't. Why not?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2015-05-17T19:47:31.040" Title="Regex to remove trailing slash not working" Tags="&lt;regex&gt;&lt;replace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9515" PostTypeId="1" AcceptedAnswerId="9516" CreationDate="2015-04-29T12:59:11.203" Score="3" ViewCount="205" Body="&lt;p&gt;Is this normal behavior?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %} &#xA;{{ cycle(['&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;', '2', '3', '4'], loop.index0) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&#xA;&#xA;2&#xA;&#xA;3&#xA;&#xA;4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is there a way to force the output as it is?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2015-04-29T14:00:33.707" Title="Cycle outputs plain text, should be html" Tags="&lt;cycle&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9516" PostTypeId="2" ParentId="9515" CreationDate="2015-04-29T14:00:33.707" Score="3" Body="&lt;p&gt;You can use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;&quot;raw&quot; filter&lt;/a&gt; to prevent the HTML from being escaped&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cycle(['&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;', '2', '3', '4'], loop.index0)|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastActivityDate="2015-04-29T14:00:33.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9517" PostTypeId="2" ParentId="9514" CreationDate="2015-04-29T14:47:01.757" Score="7" Body="&lt;p&gt;I think you are getting the twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;noreferrer&quot;&gt;replace&lt;/a&gt; filter (which does not have the regex capability) instead of the Craft &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;noreferrer&quot;&gt;replace&lt;/a&gt; filter (which does).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is a bug in Craft, in that their filter is masked by the twig one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/trim.html&quot; rel=&quot;noreferrer&quot;&gt;trim&lt;/a&gt; filter to remove trailing &lt;code&gt;/&lt;/code&gt;s:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;website|replace({'http://':''})|trim('/')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could use one of Victor's &lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE/&quot; rel=&quot;noreferrer&quot;&gt;Twig PCRE Filters&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-04-29T14:47:01.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9519" PostTypeId="2" ParentId="9499" CreationDate="2015-04-29T16:44:38.103" Score="4" Body="&lt;p&gt;I had to get this working just the other day. Here is what I did:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the relevant entries #}&#xA;{% set categoryQuery = craft.request.getParam('category') %}&#xA;{% set categories = craft.categories.group('sectionName').slug(categoryQuery) %}&#xA;&#xA;{# Set the search parameters #} &#xA;{% set searchParams = {&#xA;    relatedTo: categories,&#xA;    section: 'sectionName'&#xA;} %}&#xA;&#xA;{# Get the relevant entries #}&#xA;{% set relevantEntries = craft.entries(searchParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the form I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;&#xA;{% for category in craft.categories.group('services') %}&#xA;    &amp;lt;input id=&quot;{{category.slug}}&quot; type=&quot;checkbox&quot; name=&quot;category[]&quot;  value=&quot;{{ category.slug }}&quot; {{ category.slug in categoryQuery or categoryQuery == null  ? 'checked'}}&amp;gt;&#xA;    &amp;lt;label for=&quot;{{ category.slug }}&quot; &amp;gt;{{ category.title }}&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to work for me.&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-04-29T16:44:38.103" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9521" PostTypeId="2" ParentId="9510" CreationDate="2015-04-29T18:58:48.280" Score="1" Body="&lt;p&gt;You can get the errors from the model by using &lt;code&gt;$model-&amp;gt;getErrors()&lt;/code&gt;.  That will return an array of errors indexed by the attribute name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you submitted over AJAX, you'll want to use &lt;code&gt;$this-&amp;gt;returnErrorJson()&lt;/code&gt; to return them and have your JavaScript parse the errors out to display them to the user.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-29T18:58:48.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9522" PostTypeId="2" ParentId="9513" CreationDate="2015-04-29T19:02:50.290" Score="1" Body="&lt;p&gt;It's hard to tell without seeing the actual error message and stack trace, but there is a button next to the deprecation message that you can click that will show the full stack trace to see where the message originated from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most like it's coming from a template, but you can update your original message with the stack trace so we can be sure.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-29T19:02:50.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9523" PostTypeId="2" ParentId="9400" CreationDate="2015-04-29T20:17:18.747" Score="1" Body="&lt;p&gt;I use Rackspace Cloud Sites and Arcustech&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2015-04-29T20:17:18.747" CommentCount="1" CommunityOwnedDate="2015-04-29T20:17:18.747" ContentLicense="CC BY-SA 3.0" />
  <row Id="9524" PostTypeId="1" AcceptedAnswerId="9528" CreationDate="2015-04-29T23:32:59.263" Score="2" ViewCount="147" Body="&lt;p&gt;This post may scream ignorance (Still delving into the plugin world). I'm coming from a background using mostly laravel for PHP application development and building a few plugins now on Craft has felt a bit verbose to access related objects. Is there any &quot;nice&quot; way to allow something like the following in Craft?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$phone = User::find(1)-&amp;gt;phone;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in terms of craft plugins, just include related data in the model itself instead of having dozens of findXbyId methods littering the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;related: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7077/populatemodel-usage-with-eager-loading-related-records&quot;&gt;populateModel usage with eager loading related records&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any generic solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="96" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-04-30T04:01:32.027" Title="Possible to Directly access related records (Laravel ORM style)?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9525" PostTypeId="2" ParentId="9387" CreationDate="2015-04-29T23:40:24.837" Score="1" Body="&lt;p&gt;Through Pixel and Tonic's support email, I figured out what the issue was. It turns out one of my entries didn't have a thumbnail and that was why the image was null. Stupid user error! I thought I had checked to make sure everything was good but I guess not. Thanks for the help @BradBell.&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2015-04-29T23:40:24.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9526" PostTypeId="1" AcceptedAnswerId="9527" CreationDate="2015-04-30T01:33:32.463" Score="1" ViewCount="170" Body="&lt;p&gt;I am trying to group entries based on week and then paginate them the same way. I'm not quite sure how to go about setting each page to be a separate week/group though. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-04-30T05:06:22.783" Title="Paginate by Group" Tags="&lt;datetime&gt;&lt;pagination&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9527" PostTypeId="2" ParentId="9526" CreationDate="2015-04-30T02:40:27.857" Score="1" Body="&lt;p&gt;The &lt;code&gt;paginate&lt;/code&gt; tag isn't really designed to be used in this way. Instead you might want to look into creating a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom route&lt;/a&gt; using 'year','month','day' segment tags. These segment tags will be available as variables in your template, which you can use to grab the corresponding entries for that week (by calculating the start and end date of the week and grabbing entries with a postDate between these dates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then create 'next' and 'previous' links to link to a day at the start of the previous/next week by adding or subtracting 7 days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer shows an example using this &lt;a href=&quot;https://craftcms.stackexchange.com/a/5456/784&quot;&gt;technique for paginating by day&lt;/a&gt;. That should get you most of the way there. Leave a comment if you still need help, and I can try and mock something up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &#xA;Another option is to create a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#accessing-subpatterns-in-your-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom route&lt;/a&gt; using 'subpatterns' defined in your config file for 'events/year/week':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'events/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;week&amp;gt;\d{2})' =&amp;gt; 'events/_weekindex',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will make the variables &lt;code&gt;{{year}}&lt;/code&gt; and &lt;code&gt;{{week}}&lt;/code&gt; available to your template, which you can use to grab the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can convert weekNo to date using &lt;code&gt;{{ date.setISODate(year, weekNo) }} and date to week using&lt;/code&gt;{{ now|date('Y/W') }}`.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-04-30T05:06:22.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9528" PostTypeId="2" ParentId="9524" CreationDate="2015-04-30T04:01:32.027" Score="0" Body="&lt;p&gt;Not 100% sure I'm following what you're looking for, but if you have a &lt;code&gt;UserRecord&lt;/code&gt; defined with a &lt;code&gt;phone&lt;/code&gt; relation, then something like this should do what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$phone = UserRecord::model()-&amp;gt;with('phone')-&amp;gt;findById(1)-&amp;gt;phone;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-04-30T04:01:32.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9529" PostTypeId="1" CreationDate="2015-04-30T05:03:34.043" Score="1" ViewCount="241" Body="&lt;p&gt;When querying for entries, I'm stuck on how to query for &quot;selected&quot; fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The query I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section('athletes');&#xA;$criteria-&amp;gt;sport = 'tennis';&#xA;&#xA;$players = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works just fine, but I also need to query further using a field that is a multi-select field. I'd like to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;tournaments-&amp;gt;wimbledon = &quot;selected&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This obviously doesn't work though. Does anyone know if this is possible and/or how to accomplish this? &lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2015-04-30T05:03:34.043" Title="Get entries using Multi-Select Field as Criteria" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;field&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9530" PostTypeId="1" AcceptedAnswerId="9563" CreationDate="2015-04-30T06:06:15.503" Score="1" ViewCount="948" Body="&lt;p&gt;Trying to get an element setup but when index is loaded, I get a &quot;Unknown Error has occurred&quot;, diving into logs I found a 500 error was being thrown from the &lt;code&gt;admin/actions/elementIndex/getElements&lt;/code&gt; url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full Element type code shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * GoWander - Trip element type&#xA; */&#xA;class GoWander_TripElementType extends BaseElementType&#xA;{&#xA;    /**&#xA;     * Returns the element type name.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Trips');&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns whether this element type has content.&#xA;     *&#xA;     * @return bool&#xA;     */&#xA;    public function hasContent()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns whether this element type has titles.&#xA;     *&#xA;     * @return bool&#xA;     */&#xA;    public function hasTitles()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns this element type's sources.&#xA;     *&#xA;     * @param string|null $context&#xA;     * @return array|false&#xA;     */&#xA;    public function getSources($context = null)&#xA;    {&#xA;        $sources = array(&#xA;            '*' =&amp;gt; array(&#xA;                'label'    =&amp;gt; Craft::t('All Trips'),&#xA;            )&#xA;        );&#xA;&#xA;        foreach (craft()-&amp;gt;goWander_template-&amp;gt;findAll() as $template)&#xA;        {&#xA;            $key = 'template:'.$template-&amp;gt;id;&#xA;&#xA;            $sources[$key] = array(&#xA;                'label'    =&amp;gt; $template-&amp;gt;name,&#xA;                'criteria' =&amp;gt; array('templateId' =&amp;gt; $template-&amp;gt;id)&#xA;            );&#xA;        }&#xA;&#xA;        return $sources;&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the attributes that can be shown/sorted by in table views.&#xA;     *&#xA;     * @param string|null $source&#xA;     * @return array&#xA;     */&#xA;    public function defineTableAttributes($source = null)&#xA;    {&#xA;        return array(&#xA;            'title'     =&amp;gt; Craft::t('Title'),&#xA;        );&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the table view HTML for a given attribute.&#xA;     *&#xA;     * @param BaseElementModel $element&#xA;     * @param string $attribute&#xA;     * @return string&#xA;     */&#xA;    public function getTableAttributeHtml(BaseElementModel $element, $attribute)&#xA;    {&#xA;        return parent::getTableAttributeHtml($element, $attribute);&#xA;    }&#xA;&#xA;    /**&#xA;     * Defines any custom element criteria attributes for this element type.&#xA;     *&#xA;     * @return array&#xA;     */&#xA;    public function defineCriteriaAttributes()&#xA;    {&#xA;        return array(&#xA;            'price'   =&amp;gt; AttributeType::Mixed,&#xA;        );&#xA;    }&#xA;&#xA;    /**&#xA;     * Modifies an element query targeting elements of this type.&#xA;     *&#xA;     * @param DbCommand $query&#xA;     * @param ElementCriteriaModel $criteria&#xA;     * @return mixed&#xA;     */&#xA;    public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)&#xA;    {&#xA;        $query&#xA;            -&amp;gt;addSelect('gowander_trips.templateId')&#xA;            -&amp;gt;join('gowander_trips trips', 'trips.id = elements.id');&#xA;&#xA;        if ($criteria-&amp;gt;price) {&#xA;&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('gowander_trips.price', $criteria-&amp;gt;price, $query-&amp;gt;params));&#xA;        } &#xA;&#xA;    }&#xA;&#xA;    /**&#xA;     * Populates an element model based on a query result.&#xA;     *&#xA;     * @param array $row&#xA;     * @return array&#xA;     */&#xA;    public function populateElementModel($row)&#xA;    {&#xA;        return GoWander_TripModel::populateModel($row);&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the HTML for an editor HUD for the given element.&#xA;     *&#xA;     * @param BaseElementModel $element&#xA;     * @return string&#xA;     */&#xA;    public function getEditorHtml(BaseElementModel $element)&#xA;    {&#xA;        // Start/End Dates&#xA;        $html = craft()-&amp;gt;templates-&amp;gt;render('events/_edit', array(&#xA;            'element' =&amp;gt; $element,&#xA;        ));&#xA;&#xA;        // Everything else&#xA;        $html .= parent::getEditorHtml($element);&#xA;&#xA;        return $html;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'gowander_trips.templateId' in 'field list'. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `gowander_trips`.`templateId`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="96" LastEditorUserId="96" LastEditDate="2015-04-30T14:01:14.460" LastActivityDate="2015-05-03T19:25:43.163" Title="500 error on admin/actions/elementIndex/getElements" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9531" PostTypeId="1" AcceptedAnswerId="9532" CreationDate="2015-04-30T08:25:59.300" Score="5" ViewCount="8997" Body="&lt;p&gt;If i provide the week#, how might i go about getting the first day (and month) and the last day (and month) of that particular week?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This week for instance would be April 26 and May 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know in PHP i can do the first and last day of the week like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$day = date('w');&#xA;$week_start = date('m-d-Y', strtotime('-'.$day.' days'));&#xA;$week_end = date('m-d-Y', strtotime('+'.(6-$day).' days'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i'm not sure how to translate that to twig and of course also include the month.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2015-04-30T08:55:21.810" LastActivityDate="2019-05-17T07:44:10.803" Title="First and Last day of Week + Month in Twig" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9532" PostTypeId="2" ParentId="9531" CreationDate="2015-04-30T09:31:37.877" Score="8" Body="&lt;p&gt;That code in Twig would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set day = now|date('w') %}&#xA;{% set weekStart = now|date_modify(&quot;-#{day} days&quot;)|date('m-d-Y') %}&#xA;{% set weekEnd = now|date_modify(&quot;+#{6-day} days&quot;)|date('m-d-Y') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-04-30T09:31:37.877" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9533" PostTypeId="1" AcceptedAnswerId="9534" CreationDate="2015-04-30T11:54:20.077" Score="3" ViewCount="182" Body="&lt;p&gt;I've created a custom route for my entries based on week like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'events/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;week&amp;gt;\d{2})' =&amp;gt; 'events/_weekindex',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know i can group entries by week like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntriesByWeek = allEntries|group('postDate|date('Y-W')') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What i'm not quite sure how to do is how to show navigation ONLY for weeks that have entries present, and then of course output the entries in my template when those navigation items are clicked.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-05-01T10:44:56.967" Title="Pagination / Custom Routes (Based on Entry Existing)" Tags="&lt;entries&gt;&lt;routes&gt;&lt;pagination&gt;&lt;array&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9534" PostTypeId="2" ParentId="9533" CreationDate="2015-04-30T12:38:45.740" Score="4" Body="&lt;p&gt;For generating the nav, this should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntriesByWeek = allEntries|group(&quot;postDate|date('Y-W')&quot;) %}&#xA;{% for week, entry in allEntriesByWeek %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;events/{{ week|replace('-','/') }}&quot;&amp;gt;{{ week }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For grabbing entries (using the 'week' and 'year' variables passed via the route).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = now.setISODate(year, week) %}&#xA;{% set endDate = startDate|date_modify(&quot;+7 days&quot;) %}&#xA;{% set entries = craft.entries.section('events').postDate('and', '&amp;gt;= ' ~ startDate, '&amp;lt; ' ~ endDate ) %}&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For pagination.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;events/{{ startDate|date_modify('+7 days')|date('Y/W') }}&quot;&amp;gt;Next Week&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;events/{{ startDate|date_modify('-7 days')|date('Y/W') }}&quot;&amp;gt;Previous Week&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-01T10:44:56.967" LastActivityDate="2015-05-01T10:44:56.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9535" PostTypeId="1" CreationDate="2015-04-30T13:11:45.957" Score="3" ViewCount="895" Body="&lt;p&gt;I have a custom field where I'm defining &lt;strong&gt;&lt;em&gt;AttributeType::Mixed&lt;/em&gt;&lt;/strong&gt; in order to achieve the affect of saving multiple pieces of data for a single field. The data gets stored as JSON as expected. Quick example shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;&#xA;    return AttributeType::Mixed;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was wondering though, is it possible to define multiple columns for a single field? If so will the field then require its own table? Not sure where to begin with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-08-14T23:40:26.600" Title="Can You Make a Custom Field with multiple columns?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9536" PostTypeId="1" AcceptedAnswerId="9575" CreationDate="2015-04-30T13:23:11.927" Score="4" ViewCount="944" Body="&lt;p&gt;Ok I can do this in twig but after searching high and low I can't find a good example of how to do it in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a user profile field called interests which holds an array of what they are interested in. I want to pull out all entries that are related to the category id's held in the interests array. So in twig I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for interest in userinterests %}&#xA;    {% for entry in entries.relatedTo(craft.categories(interest)) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}           &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my plugin function I currently have this but it is not returning anything in the array so I'm currently stuck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userinterests = craft()-&amp;gt;users-&amp;gt;getUserById($userid)-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'sourceElement' =&amp;gt; $categories&#xA;);&#xA;$relatedEntries = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what I am supposed to be adding to the relatedTo array but it also could be something else as I'm still trying to get my head around craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-05T09:22:09.377" Title="Related to entries in categories in a plugin" Tags="&lt;categories&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9538" PostTypeId="1" CreationDate="2015-04-30T14:35:26.750" Score="1" ViewCount="626" Body="&lt;p&gt;Is it obvious why the task validation errors are not getting output in my log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function runStep($step)&#xA;{&#xA;    try&#xA;    {&#xA;        $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($this-&amp;gt;_entryIds[$step], $this-&amp;gt;_localeId);&#xA;&#xA;        if (!$entry)&#xA;        {&#xA;            return true;&#xA;        }&#xA;&#xA;        $newExpiryDate = new DateTime($entry-&amp;gt;date);&#xA;        $newExpiryDate-&amp;gt;add(new DateInterval('P1D'));&#xA;&#xA;&#xA;        // Update Expiry Date&#xA;        if($entry-&amp;gt;expiryDate != $newExpiryDate)&#xA;        {&#xA;            $entry-&amp;gt;expiryDate = $newExpiryDate-&amp;gt;format('Y-m-d');&#xA;        }&#xA;&#xA;        // Update Status&#xA;        $entry-&amp;gt;enabled = true;&#xA;&#xA;        // Save Entry&#xA;        if(craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;        {&#xA;            return true;    &#xA;        }&#xA;        else&#xA;        {&#xA;            $error = 'Encountered the following validation errors when trying to save entry with the ID &quot;'.$entry-&amp;gt;id.'&quot;:';&#xA;&#xA;            foreach ($entry-&amp;gt;getAllErrors() as $attributeError)&#xA;            {&#xA;                $error .= &quot;\n - {$attributeError}&quot;;&#xA;            }&#xA;&#xA;            return $error;              &#xA;        }&#xA;&#xA;        return true;&#xA;    }&#xA;    catch (\Exception $e)&#xA;    {&#xA;        return 'An exception was thrown while trying to save the entry with the ID “'.$this-&amp;gt;_entryIds[$step].'”: '.$e-&amp;gt;getMessage();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This task step is based on one of the Craft default steps but the error gets output without the specific validation issues:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Encountered an error running task 1191 (Logic_UpdateEvents), step 1 of 1440: Encountered the following validation errors when trying to save entry with the ID &quot;10295&quot;:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-04-30T14:35:26.750" Title="Debugging Validation Errors In Craft" Tags="&lt;plugin-development&gt;&lt;tasks&gt;&lt;debugging&gt;" AnswerCount="0" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9540" PostTypeId="1" AcceptedAnswerId="9541" CreationDate="2015-04-30T19:44:26.937" Score="2" ViewCount="465" Body="&lt;p&gt;I have a field (mdFeatured) set up as a lightswitch field type. I am trying to retrieve both featured and non-featured entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntries = craft.entries.section('merchantDirectory').mdFeatured(true).relatedTo(category).find() %}&#xA;{% set normalEntries = craft.entries.section('merchantDirectory').mdFeatured(false).relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The featured entries are being retrieved properly, but the normal entries are returning both featured entries and normal entries mixed together. Any possibly know why this is not working? I tried replacing &quot;true&quot; and &quot;false&quot; with &quot;1&quot; and &quot;0&quot; but that did not seem to work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="220" LastActivityDate="2019-07-14T03:00:26.943" Title="Querying by lightswitch field type in template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9541" PostTypeId="2" ParentId="9540" CreationDate="2015-04-30T23:00:32.477" Score="4" Body="&lt;p&gt;You could try looking for an empty string: &lt;code&gt;mdFeatured('')&lt;/code&gt; or prefix 1 or true with not: &lt;code&gt;mdFeatured('not 1')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-04-30T23:00:32.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9542" PostTypeId="1" AcceptedAnswerId="9543" CreationDate="2015-04-30T23:23:57.847" Score="2" ViewCount="374" Body="&lt;p&gt;I have a list of &quot;meetings&quot; as entries and I want to show only the last two ordered by meetingDate, and show any other meetings marked as sticky, without doubling up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have so far is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stuck = craft.entries.section('meetings').relatedTo(subcategory).sticky('1').order('meetingDate desc').find() %}&#xA;{% set entries = craft.entries.section('meetings').relatedTo(subcategory).order('meetingDate desc').limit(2).find() %}&#xA;{% set entries = entries|merge(stuck) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this works except that if an entry marked as Sticky is one of the first two, then it shows twice. I understand it is bad practice to try and manipulate data using Twig, and that rather I should aim on getting the right data out of the entries first up. &lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-05-01T11:04:34.763" Title="How do I limit entries retrieved except those with a sticky lightswitch on the entry?" Tags="&lt;entries&gt;&lt;lightswitch&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9543" PostTypeId="2" ParentId="9542" CreationDate="2015-05-01T00:53:53.837" Score="4" Body="&lt;p&gt;One method is to check to see if item is not in array before merging. The downside is that the entries will just be appended vs sorted by meetingDate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stuck = craft.entries.section('meetings').relatedTo(subcategory).sticky('1').order('meetingDate desc').find() %}&#xA;{% set entries = craft.entries.section('meetings').relatedTo(subcategory).order('meetingDate desc').limit(2).find() %}&#xA;&#xA;{% for stuckEntry in stuck %}&#xA;    {% if stuckEntry not in entries %}&#xA;        {% set entries = entries|merge([stuckEntry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The other method is to grab the ids from the 2 queries and then merge them together, and perform a new query which can be sorted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stuckIds = craft.entries.section('meetings').relatedTo(subcategory).sticky('1').ids() %}&#xA;{% set entryIds = craft.entries.section('meetings').relatedTo(subcategory).limit(2).ids() %}&#xA;&#xA;{% for id in stuckIds %}&#xA;    {% if id not in entryIds %}&#xA;        {% set entryIds = entryIds|merge([id]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.id(entryIds).order('meetingDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-01T11:04:34.763" LastActivityDate="2015-05-01T11:04:34.763" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9544" PostTypeId="2" ParentId="9542" CreationDate="2015-05-01T09:19:51.407" Score="0" Body="&lt;p&gt;So, this is what I ended up with, thanks @douglas-mcdonald and @carlcs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stuck = craft.entries.section('meetings').relatedTo(subcategory).sticky('1').order('meetingDate desc').find() %}&#xA;{% set entries = craft.entries.section('meetings').relatedTo(subcategory).order('meetingDate desc').limit(2).find() %}&#xA;{% set idArray=[] %} &#xA;{% for entry in entries %}&#xA;    {% set idArray = idArray|merge([entry.id]) %}&#xA;{% endfor %}&#xA;{% for entry in stuck %}&#xA;    {% set idArray = idArray|merge([entry.id]) %}&#xA;{% endfor %}&#xA;{% set unique=[] %} &#xA;{% for entry in idArray %}&#xA;    {% if entry not in unique %}&#xA;        {% set unique = unique|merge([entry]) %}&#xA;    {% endif %} &#xA;{% endfor %}&#xA;{% set publish=[] %}&#xA;{% for entry in unique %}&#xA;  {% set publishItem = craft.entries.id(entry).first() %}&#xA;  {% set publish = publish|merge([publishItem]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-05-01T09:19:51.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9545" PostTypeId="1" AcceptedAnswerId="9546" CreationDate="2015-05-01T11:07:02.957" Score="2" ViewCount="419" Body="&lt;p&gt;I’m trying to build an XML sitemap that contains all entries including those in a different locale. I thought the &lt;code&gt;localeEnabled(false)&lt;/code&gt; would allow entries for all locales to be displayed, however, the following doesn’t seem to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('pages').status('live').localeEnabled(false) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If is assign a locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('pages').status('live').locale('de') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then the entry is displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using &lt;code&gt;.locale(null)&lt;/code&gt; and &lt;code&gt;.localeEnabled(null)&lt;/code&gt; without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3611" LastActivityDate="2017-01-06T22:04:57.850" Title="Display entries including all locales for XML sitemap" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9546" PostTypeId="2" ParentId="9545" CreationDate="2015-05-01T11:33:05.583" Score="2" Body="&lt;p&gt;Not sure, but I think the only way is to query for each locale and merge.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set siteLocales = craft.i18n.getSiteLocales %}&#xA;{% set pages = [] %}&#xA;{% for locale in siteLocales %}&#xA;    {% set localePages = craft.entries.section('pages').locale(locale.getId).find() %}&#xA;    {% set pages = pages|merge(localePages) %}&#xA;{% endfor %}&#xA;&#xA;{% for page in pages %}&#xA;    {{ page.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-05-01T11:33:05.583" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9547" PostTypeId="2" ParentId="9166" CreationDate="2015-05-01T14:06:49.410" Score="1" Body="&lt;p&gt;What strikes me as interesting here is your dump contains a Model instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you said:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When I dump the response from the service method i'm getting back is:&#xA;  Craft\Placid_ResourceModel Object&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I query findAll through a CActiveRecord derived class I get an array of Records. In order to populate this into models, the populateModel(s) methods are typically used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a relation at the ActiveRecord level, it is a pseudo-attribute and will only be carried through to the model if the attribute is defined as defined attributes can only be mass assigned. Yii also supports rules definitions to mark attributes as safe, but this is almost entirely optional. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is really why you have a model being output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. for me the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$records = SomePlugin_ProductRecord::model()-&amp;gt;with('pricing')-&amp;gt;findAll($criteria);&#xA;var_dump($records[0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(Craft\SomePlugin_ProductRecord)#179 (14) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you have any code which is auto inflating into a model? or are you calling populateModel(s)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then you have made the correct call of creating the attribute in your model if you want to access it from there, as far as I've experienced.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2015-05-01T14:06:49.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9548" PostTypeId="2" ParentId="2645" CreationDate="2015-05-01T14:13:06.303" Score="1" Body="&lt;p&gt;It is worth noting for anyone else that if you need to escape the current namespace back to root, prefix your namespace with a backslash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the context of a plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use /Namespace/Outside/of/Craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The previous use statement results in Namespace/Outside/of/Craft as you would expect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Namespace/Inside/of/Craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The previous use statement results in Craft/Namespace/Inside/of/Craft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I work with many developers and I see that this is a common pitfall of those not up to date with namespacing in PHP, particular when using composer libraries and PSR-4 compatible autoloading.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2015-05-01T14:13:06.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9549" PostTypeId="2" ParentId="9497" CreationDate="2015-05-01T14:41:31.027" Score="0" Body="&lt;p&gt;I think the best approach for the time being is the code sample in the question. Always open to explore new ideas in the future.&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2015-05-01T14:41:31.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9550" PostTypeId="1" AcceptedAnswerId="9552" CreationDate="2015-05-01T14:47:40.007" Score="4" ViewCount="308" Body="&lt;p&gt;I'd like to define the SMTP server deets in my local config as I regularly need to push/pull databases between environments and will have different settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be any of doing this currently. Are there any workarounds? I thought maybe I could just put the SMTP deets in my code (testing for current enviroment) but the EmailModel class doesn't accept any of the SMTP-related properties of PHPMailer.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2017-08-02T12:52:09.577" Title="Define email environment-specific email settings?" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9551" PostTypeId="1" AcceptedAnswerId="9553" CreationDate="2015-05-01T17:32:46.360" Score="1" ViewCount="144" Body="&lt;p&gt;I think I have been staring at this one too long because conceptually it seems fairly straightforward but I can't seem to pull it off. I am pretty sure I am going nowhere due to how complicated I am making my twig code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is what I have:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;News&quot; channel that holds news entries that can be optionally related to either a Program 1 entry or Program 2 entry.&lt;/li&gt;&#xA;&lt;li&gt;Program Type 1 channel.&lt;/li&gt;&#xA;&lt;li&gt;Program Type 2 channel.&lt;/li&gt;&#xA;&lt;li&gt;In the news entry there are two fields, one to relate Program 1 entries to the news item and another to relate Program 2 entries to the news item. They are being used similarly to categories in this case.&lt;/li&gt;&#xA;&lt;li&gt;News entries can have one or both of the related entries fields populated  &lt;/li&gt;&#xA;&lt;li&gt;This is in a module that is shared throughout the site so I am not on a &quot;news entry&quot; page (if that makes sense), it will be an include that is included where needed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is what I need to do&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to display a list of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the four most recently updated Program 1 or Program 2 NEWS items (combined list order by dateUpdated)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thinking out loud it looks like I can grab a listing of each and then merge them together but I would love to see how smarter folks would handle this in the most efficient way.&lt;/p&gt;&#xA;" OwnerUserId="213" LastActivityDate="2015-05-01T23:38:55.157" Title="Display entries filtered by one or two related entry fields ordered by &quot;dateUpdated&quot;" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9552" PostTypeId="2" ParentId="9550" CreationDate="2015-05-01T17:41:03.330" Score="3" Body="&lt;p&gt;Currently email settings aren't multi-environment aware, so there is no native way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding to the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feedback&lt;/a&gt; site, as this has come up before, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-01T17:41:03.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9553" PostTypeId="2" ParentId="9551" CreationDate="2015-05-01T18:12:33.700" Score="3" Body="&lt;p&gt;If I understand your structure correctly, something like this should work. First grab the ids, merge them (if they don't already exist in the id array), then query for entries based on ids with sort order defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set programs1 = craft.entries.section('programs1') %}&#xA;{% set programIds = craft.entries.section('news').relatedTo(programs1).ids() %}&#xA;{% set programs2 = craft.entries.section('programs2') %}&#xA;{% set program2Ids = craft.entries.section('news').relatedTo(programs2).ids() %}&#xA;&#xA;{% for id in program2Ids %}&#xA;    {% if id not in programIds %}&#xA;        {% set programIds = programIds|merge(id) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set programEntries = craft.entries.section('news').id(programIds).order(dateUpdated).limit(4) %}&#xA;&#xA;{% for entry in programEntries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-01T23:38:55.157" LastActivityDate="2015-05-01T23:38:55.157" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9555" PostTypeId="1" AcceptedAnswerId="9558" CreationDate="2015-05-02T14:23:45.037" Score="1" ViewCount="288" Body="&lt;p&gt;I'm writing a plugin to import posts from a WordPress blog. The source post formats are inconsistent, some coming with full HTML (&lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags wrapping each paragraph, etc.), while others seem to just have tags added for formatting and emphasis—newlines but no paragraphs or &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;'s.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $entry-&amp;gt;setContentFromPost(array(&#xA;     'body' =&amp;gt; $post['content'],&#xA; ));&#xA;&#xA; $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So without any adjustment, many of the imported posts look crappy on the front end when they're just dropped into a template with &lt;code&gt;{{ entry.body }}&lt;/code&gt; (Rich Text). The missing paragraph tags look less than stellar, and they're semantically uncool as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Redactor handles this just fine, so viewing and saving the imported entry in Craft is a breeze. It's not ideal, however, to go back and manually re-save each entry. &lt;strong&gt;Is there a way to re-save a cleaned Rich Text field via Craft's API, or do I need to standardize post HTML prior to my Craft import process?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2015-05-02T17:53:38.803" LastActivityDate="2015-05-02T19:01:25.313" Title="Is there a way to programmatically clean/Redactorize HTML?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9556" PostTypeId="1" AcceptedAnswerId="9594" CreationDate="2015-05-02T17:37:04.193" Score="3" ViewCount="359" Body="&lt;p&gt;I am creating an ecommerce plugin in Craft, and trying to take advantage of the ElementType. My goal is to list the orders, and also the items ordered in a single column. &lt;strong&gt;Is it possible to eager load Element Type's relations for the ElementIndex view?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two records: OrderRecord and ItemRecord, with relations defined like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// OrderRecord (the ElementType)&#xA;    public function defineRelations(){&#xA;      return array(&#xA;                'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;                'items'   =&amp;gt; array(static::HAS_MANY, 'Shopping_ItemRecord', 'orderId', 'onDelete' =&amp;gt; static::CASCADE))&#xA;    }&#xA;&#xA;// ItemRecord&#xA;public function defineRelations(){&#xA;  return array(&#xA;    'order' =&amp;gt; array(static::BELONGS_TO, 'Shopping_OrderRecord', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE)&#xA;  )&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loading the records from a service using &lt;code&gt;OrderRecord::model()-&amp;gt;with('items')-&amp;gt;find()&lt;/code&gt; works really well, but i am struggling with translating this to the ElementType (if it's even possible, i don't know). I tried to using the &lt;code&gt;OrderElementType::modifyElementsQuery()&lt;/code&gt; function to add the item columns, but there are a few problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The query is not allowing me to specify a different order-by, resulting in MySQL ambigous column error. The query is only containing &quot;order by ´id´&quot; without any alias name, which makes this query fail: &lt;code&gt;select order.customerName, items.*&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Joining in the items table, and grouping by anything else than the default &lt;code&gt;´elements´.´id´&lt;/code&gt; results in duplicate rows in the view. This is my biggest concern about this question, how can i translate several rows from the result to a single OrderModel?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My current solution to this is to query the items from the &lt;code&gt;OrderModel::populateModel($values)&lt;/code&gt;, but this feels very slow and inefficient, i would like to avoid calling 50 extra queries every time the getMoreElements() is called&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-05-06T11:33:49.217" Title="Eager loading relations in Plugins Element Type" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9557" PostTypeId="1" CreationDate="2015-05-02T18:49:48.333" Score="4" ViewCount="357" Body="&lt;p&gt;I am new to Craft and have been attempting to write  a plugin but keep getting stuck on how to read and write to the database. I have been working through cocktailrecipesPlugin and am attemting to use it to better understand how to do database CRUD. In this attempt I am replacing coctailrecipes with projectmanager, ingredients with staff, and ingredient with staffMember. The Cocktail Recipe plugin is confusing because it uses objects and properties with the same name and I am unsure if this is the required. I am having difficulty understanding how services and variable and models interact. It appears that services is where the property ingredient is defined, but I am puzzled. I wish there was better documentation explaining the interaction of the various components. I have been banging my head against the wall trying to understand the Craft api and how the pieces work together. The documenation seem sparse and the code sample in the documenation are snippets which make it difficult to understand how everything fits together. I wish the cocktailRecipiesPlugin was better explained. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cocktail Recipes &amp;lt;=&gt; Project Manager&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ingredients &amp;lt;=&gt; staff&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ingredient &amp;lt;=&gt; staffmember&lt;/p&gt;&#xA;" OwnerUserId="3521" LastActivityDate="2015-05-03T19:39:16.167" Title="How do variables, services and models fit together?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9558" PostTypeId="2" ParentId="9555" CreationDate="2015-05-02T19:01:25.313" Score="1" Body="&lt;p&gt;The &lt;em&gt;Purify&lt;/em&gt; setting for the Rich Text field will run the data through &lt;a href=&quot;http://htmlpurifier.org/&quot; rel=&quot;nofollow&quot;&gt;HTMLPurifier&lt;/a&gt;, which will do its best to try and remove any malicious code from the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you're seeing is Redactor itself cleaning the rogue HTML elements before submitting to POST/Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it's probably going to be easier trying to clean your HTML with some custom logic/regex before saving rather than trying to figure out how to spin up Redactor to do the cleaning.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-02T19:01:25.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9560" PostTypeId="2" ParentId="5287" CreationDate="2015-05-03T11:35:25.200" Score="1" Body="&lt;p&gt;I wanted to do this too but none of the relationships are defined in the record classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An approach to achieving this would be to extend the Craft record classes in your own record classes and override the defineRelations method. This does however require that you understand CActiveRecord relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need any pointers give me a hollar.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2015-05-03T11:35:25.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9561" PostTypeId="1" CreationDate="2015-05-03T18:13:18.033" Score="1" ViewCount="164" Body="&lt;p&gt;I am trying to initiate multiple Google Map instances on a page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to set a dynamic ID for each one. I've tried doing it with &lt;code&gt;loop.index&lt;/code&gt; but no joy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for marker in event.eventMap.getMarkers() %}&#xA;    &amp;lt;div class=&quot;google-maps&quot;&amp;gt;&#xA;        {% set options = {&#xA;            id: 'map',&#xA;            width: '100%',&#xA;            height: '150px',&#xA;            options: {&#xA;                disableDoubleClickZoom: true,&#xA;                maxZoom: 15,&#xA;                minZoom: 5,&#xA;                scrollwheel: false&#xA;            }&#xA;        } %}&#xA;&#xA;        {{ craft.googleMaps.map() }}&#xA;&#xA;        {{ craft.googleMaps.data('map', event.eventMap) }}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="57" LastEditDate="2015-05-04T04:50:01.690" LastActivityDate="2015-05-04T17:59:32.120" Title="Initiate Multiple Google Maps Instances" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9562" PostTypeId="1" AcceptedAnswerId="9733" CreationDate="2015-05-03T18:43:08.750" Score="0" ViewCount="150" Body="&lt;p&gt;For two channels that restricts uploads to subdirectory/{owner.slug}, when I want to add an image in an existing entry, the Add an Asset modal window doesn't list the existing images (this is a matrix field that supports multiple images). All other cases where the restricted directory isn't a dynamic asset folder work fine. I've updated Asset Indexes and Cleared Caches, but still no luck. Any idea what's up? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3615" LastActivityDate="2015-05-14T05:04:19.223" Title="Current assets don't display in Add an Asset modal for matrix field; using {owner.slug} in path" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9563" PostTypeId="2" ParentId="9530" CreationDate="2015-05-03T19:25:43.163" Score="0" Body="&lt;p&gt;Finally discovered the solution to this, it was as Brad had suggested due to the query - however it was my incidental prepending of the plugin name to the table. ie. &quot;gowander_trips&quot; vs. &quot;trips&quot;. After some digging and looking at other plugins it seems Craft does add the plugin name for you.&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-05-03T19:25:43.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9564" PostTypeId="2" ParentId="9557" CreationDate="2015-05-03T19:39:16.167" Score="9" Body="&lt;p&gt;For starters, I believe the Cocktail Recipes plugin is grossly out of date. It was originally built when Craft was in beta, and hasn't really been updated much since. There's a rumor that someone has forked &amp;amp; updated it, but I don't have the full story there.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Regarding your actual question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Models&lt;/strong&gt; - Think of a Model as a &quot;jar&quot; of related data, about one specific thing. This parallels pretty closely to most other programming languages and design patterns. As for Craft specifically, the Model is really the &lt;em&gt;right&lt;/em&gt; way to pass a related group of data between components (Controllers, Services, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt; - A plugin Variable is simply a way to make your data easily available to front-end Twig templates. A large majority of the time, a Variable is simply a wrapper for some other method (like a Service call).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Services&lt;/strong&gt; - Services can be anything and everything. It's a complete blank slate, and really the best place for your plugin to do any heavy lifting. If you ever have to interact with the database directly (via Records), it's virtually required that you run that DB interaction through a Service method.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here are two resources which may help shed a little more light on how it all ties together...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Business Logic plugin template...&lt;/a&gt; Originally intended as a quick way to insert business logic into your site via PHP, it's become a useful learning resource as well. It focuses mainly on Variables, Services, and Controllers, and is completely documented in the code comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, here's a diagram which I put together as I was learning plugin development. Keep in mind, this is not a 100% 1:1 representation of every-plugin-ever. Any given plugin can contain more or less of these components... this is simply a basic illustration of how the components tie together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2NTDZ.png&quot; alt=&quot;Craft Plugin Structure&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-05-03T19:39:16.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9565" PostTypeId="1" AcceptedAnswerId="9567" CreationDate="2015-05-04T03:46:36.127" Score="1" ViewCount="172" Body="&lt;p&gt;Hi I'm trying to template out a simple conditional that shows content if the date set in a date field is greater or equal to today, and I can't seem to get the syntax quite right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.promoEndDate|date ('&amp;gt;= ' ~ now) %}&#xA;    &amp;lt;p class=&quot;price--notes&quot;&amp;gt;Price valid until {{ entry.promoEndDate | date('d M Y') }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.promoEndDate | date &amp;gt;= now | date %}&#xA;    &amp;lt;p class=&quot;price--notes&quot;&amp;gt;Price valid until {{ entry.promoEndDate | date('d M Y') }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both don't yield the result I'm looking for.&#xA;Probably missing something really simple here but looked at it too long now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2015-05-04T06:12:41.670" Title="Date specific conditional" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9566" PostTypeId="1" AcceptedAnswerId="9588" CreationDate="2015-05-04T05:15:11.680" Score="1" ViewCount="318" Body="&lt;p&gt;I use an assets.onSaveAsset Event in my plugin to update a field with the IPTC-Data of the image. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $asset-&amp;gt;getContent()-&amp;gt;keywords = $this-&amp;gt;get_iptc_keywords($imgPath);&#xA;  craft()-&amp;gt;elements-&amp;gt;saveElement($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It updates the field values of the asset, but it does not update the search index. When i resave the asset, the searchindex table is updatet and works. Is this a craft bug and is there a craft way to update the search index for a single element (not the full index). Otherwise do i need to update the index by writing plain sql update/insert statements? Thanks for any help...&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="3535" LastEditDate="2015-05-05T16:35:17.750" LastActivityDate="2015-05-05T17:02:52.157" Title="Update search index after assets.onSaveAsset Event" Tags="&lt;plugins&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9567" PostTypeId="2" ParentId="9565" CreationDate="2015-05-04T05:51:40.163" Score="1" Body="&lt;p&gt;You should be able to just compare the two dates directly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.promoEndDate &amp;gt;= now %}&#xA;    &amp;lt;p class=&quot;price--notes&quot;&amp;gt;Price valid until {{ entry.promoEndDate|date('d M Y') }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-04T06:12:41.670" LastActivityDate="2015-05-04T06:12:41.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9568" PostTypeId="1" AcceptedAnswerId="9569" CreationDate="2015-05-04T06:00:30.760" Score="4" ViewCount="888" Body="&lt;p&gt;I am stuck on saving entry with a category field.&#xA;The error message I get is about not being able to create/update the entry in the relations table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$accomodationTypecategory = ['title'=&amp;gt;'Hotel']&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 3;&#xA;$entry-&amp;gt;typeId = 3;&#xA;$entry-&amp;gt;authorId = 1;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;setContent(&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes([&#xA;        'title' =&amp;gt; 'Test Entry', &#xA;        'body' =&amp;gt; &quot;Testing&quot;, &#xA;        'address'=&amp;gt;&quot;101 Silver Avenue&quot;,&#xA;        'phone'=&amp;gt;'0209900292092',&#xA;        'websiteAddress'=&amp;gt;'www.example.com',&#xA;        'towns'=&amp;gt;'Newy', &#xA;        'accommodationType'=&amp;gt;$accomodationTypecategory&#xA;    ]);&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="57" LastEditDate="2015-05-04T17:21:49.087" LastActivityDate="2015-05-08T00:57:50.453" Title="Saving Entry with Category field" Tags="&lt;categories&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9569" PostTypeId="2" ParentId="9568" CreationDate="2015-05-04T06:49:49.643" Score="6" Body="&lt;p&gt;To set a related category (or any other kind of element) you will want to pass an array of categoryIds (elementIds) — even if, as in this case, there is only one category or element. You can either set the ID as a static value if it's predefined or dynamically look it up based on the title, slug or any other unique element attribute.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;title = 'Hotel';&#xA;$accomodationTypeCategory = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 3;&#xA;$entry-&amp;gt;typeId = 3;&#xA;$entry-&amp;gt;authorId = 1;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'title'             =&amp;gt; 'Test Entry', &#xA;    'body'              =&amp;gt; 'Testing', &#xA;    'address'           =&amp;gt; '101 Silver Avenue',&#xA;    'phone'             =&amp;gt; '0209900292092',&#xA;    'websiteAddress'    =&amp;gt; 'www.example.com',&#xA;    'towns'             =&amp;gt; 'Newy', &#xA;    'accommodationType' =&amp;gt; array(&#xA;        $accomodationTypeCategory[0]-&amp;gt;id&#xA;    )&#xA;);&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-08T00:57:50.453" LastActivityDate="2015-05-08T00:57:50.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9570" PostTypeId="2" ParentId="9561" CreationDate="2015-05-04T17:20:07.193" Score="3" Body="&lt;p&gt;Something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for marker in event.eventMap.getMarkers() %}&#xA;    {% set mapId = 'map' ~ loop.index %}&#xA;    &amp;lt;div class=&quot;google-maps&quot;&amp;gt;&#xA;        {% set options = {&#xA;            id: mapId,&#xA;            width: '100%',&#xA;            height: '150px',&#xA;            options: {&#xA;                disableDoubleClickZoom: true,&#xA;                maxZoom: 15,&#xA;                minZoom: 5,&#xA;                scrollwheel: false&#xA;            }&#xA;        } %}&#xA;&#xA;        {{ craft.googleMaps.map() }}&#xA;&#xA;        {{ craft.googleMaps.data(mapId, event.eventMap) }}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="344" LastEditDate="2015-05-04T17:59:32.120" LastActivityDate="2015-05-04T17:59:32.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9571" PostTypeId="1" AcceptedAnswerId="9591" CreationDate="2015-05-04T22:01:59.227" Score="3" ViewCount="1029" Body="&lt;p&gt;I've got a front-end user profile form working on a client site I'm developing, but the one thing that I'm having trouble with is allowing users to change the email address associated with their account via this form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use my email field to attempt an email address change, I get a verification email generated by Craft sent to the new email address, but the email change is not reflected in either the CP or on the front-end when I refresh the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've pasted an abbreviated version of my form below with some irrelevant fields omitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt; &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/my-account?m=updated&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            {% for error in errors %}&#xA;                &amp;lt;p class=&quot;error-block&quot;&amp;gt;{{ error }}&amp;lt;/p&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot; value=&quot;{{ currentUser.username}}&quot;&amp;gt;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('username')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;First name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName}}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;lastName&quot; type=&quot;text&quot; name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;        &amp;lt;p&amp;gt;Fill in both fields below to change the email address associated with your account&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; value=&quot;{{ currentUser.email }}&quot;&amp;gt;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('email')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;label for=&quot;password&quot;&amp;gt;Current Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; id=&quot;currentPassword&quot; name=&quot;password&quot; /&amp;gt;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('currentPassword')) }}&#xA;        {% endif %}&#xA;    &amp;lt;/fieldset&amp;gt;      &#xA;&#xA;    &amp;lt;input class=&quot;btn btn-primary btn-large&quot; type=&quot;submit&quot; value=&quot;Save changes&quot; /&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="579" LastEditorUserId="3951" LastEditDate="2017-12-04T20:56:56.830" LastActivityDate="2017-12-04T20:56:56.830" Title="Allow users to change email address on front-end form" Tags="&lt;user-profile&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9572" PostTypeId="1" CreationDate="2015-05-05T02:18:09.817" Score="0" ViewCount="1329" Body="&lt;p&gt;So not sure what the problem is really have tried a few ways but I can't get font-files to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have placed my font files in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; root/craft/templates/assets/fonts/bootstrap&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an example of @font-face that I am using...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@font-face {&#xA;    font-family: &quot;Glyphicons Halflings&quot;;&#xA;    src: &#xA;    url(&quot;{{ siteUrl }}/assets/fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix&quot;) format(&quot;embedded-opentype&quot;), &#xA;    url(&quot;{{ siteUrl }}/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2&quot;) format(&quot;woff2&quot;), &#xA;    url(&quot;{{ siteUrl }}/assets/fonts/bootstrap/glyphicons-halflings-regular.woff&quot;) format(&quot;woff&quot;), &#xA;    url(&quot;{{ siteUrl }}/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf&quot;) format(&quot;truetype&quot;), &#xA;    url(&quot;{{ siteUrl }}/assets/fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular&quot;) format(&quot;svg&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In firebug I get &quot;NetworkError: 500 Internal Server Error - &lt;a href=&quot;http://example.com/assets/fonts/bootstrap/glyphicons-halflings-regular.woff&quot; rel=&quot;nofollow&quot;&gt;http://example.com/assets/fonts/bootstrap/glyphicons-halflings-regular.woff&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to access the file directly I get the following message with craft styling etc so this is a craft error not a typical 500 error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Unexpected character &quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if I try to access a css file it works fine, but my font files are returning 500 errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have placed my css files in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; root/craft/templates/assets/css&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-05-05T16:38:03.477" Title="Problem with @font-face url 500 server error craft style" Tags="&lt;templating&gt;&lt;assets&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9573" PostTypeId="1" CreationDate="2015-05-05T05:46:14.977" Score="1" ViewCount="267" Body="&lt;p&gt;I'm trying to programatically create a user (once the user submits a form through Sprout Forms). The user doesn't seem to appear in the Users section of the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've ensured the user is being added correctly - I can even see a row in the craft_users database table. Going directly to admin/users/349 (the ID of the newly added user) shows all the user details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been suggested that I need to index the new element data - but not sure how to do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$content = $entry-&amp;gt;getContent();&#xA;&#xA;$user = new UserModel();&#xA;$user-&amp;gt;username         = $content['email'];&#xA;$user-&amp;gt;email            = $content['email'];&#xA;$user-&amp;gt;unverifiedEmail  = $content['email'];&#xA;$user-&amp;gt;firstName        = $content['firstName'];&#xA;$user-&amp;gt;lastName         = $content['lastName'];&#xA;$user-&amp;gt;newPassword      = $content['password'];&#xA;$user-&amp;gt;pending          = true;&#xA;&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;if ($success) {&#xA;    craft()-&amp;gt;search-&amp;gt;indexElementAttributes($user);&#xA;&#xA;    // Assign them to the default user group&#xA;    craft()-&amp;gt;userGroups-&amp;gt;assignUserToDefaultGroup($user);&#xA;&#xA;    // Send the activation email&#xA;    craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user);&#xA;&#xA;    // Update the Element Index&#xA;    craft()-&amp;gt;search-&amp;gt;indexElementAttributes($user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-05-07T00:52:41.587" LastActivityDate="2015-05-07T00:52:41.587" Title="Programatically creating a user not appearing in Users index table" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9575" PostTypeId="2" ParentId="9536" CreationDate="2015-05-05T09:22:09.377" Score="2" Body="&lt;p&gt;Ok worked this one out eventually myself. If anyone else finds this helpful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userinterests = craft()-&amp;gt;users-&amp;gt;getUserById($userid)-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;        'targetElement' =&amp;gt; $userinterests['relevantFieldToCheckAgainst'],&#xA;        'field' =&amp;gt; 'EntryFieldToCheckIn'&#xA;);&#xA;$relatedEntries = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-05T09:22:09.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9576" PostTypeId="1" CreationDate="2015-05-05T13:54:17.053" Score="2" ViewCount="303" Body="&lt;p&gt;User photos don't appear to be saved in the same method as Assets. I'm looking to do a remote image (from plugin) as the user profile image. I've got the path saving to the column, but the image is not rendering. Anything special I need to do to get that to render?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;$user-&amp;gt;photo = $gravatarPath;&#xA;craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2015-05-05T22:45:15.260" LastActivityDate="2015-05-05T22:45:15.260" Title="Can a user photo support a remote image?" Tags="&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9577" PostTypeId="1" AcceptedAnswerId="9579" CreationDate="2015-05-05T14:20:07.697" Score="2" ViewCount="267" Body="&lt;p&gt;How can I set different assets fields depending on the URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) == 'special' %}&#xA;   {% set assetfield = variantfield1 %}&#xA;{% endif %}&#xA;&#xA;{% for asset in entry.assetfield %}     &#xA;     ...&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doen't change &lt;code&gt;entry.assetfield&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="57" LastEditDate="2015-05-05T19:06:17.790" LastActivityDate="2015-05-05T19:06:17.790" Title="Setting a variable assets field, depending on the URL?" Tags="&lt;assets&gt;&lt;conditional&gt;&lt;segments&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9578" PostTypeId="1" AcceptedAnswerId="9580" CreationDate="2015-05-05T14:24:55.663" Score="4" ViewCount="503" Body="&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('entertainmentEvents').status('live','pending').search('entertainmentBanner:*').order('RAND()').limit(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working to show 3 random entries from the full list of all entries with the entertainmentBanner field populated. How would I limit it to the first ten entries by entry date and then 3 at random from within them?&lt;/p&gt;&#xA;" OwnerUserId="3337" LastActivityDate="2015-05-05T15:08:02.267" Title="How can I show 3 entries at random from within the next 10" Tags="&lt;templating&gt;&lt;entries&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9579" PostTypeId="2" ParentId="9577" CreationDate="2015-05-05T14:55:26.640" Score="4" Body="&lt;p&gt;I'd probably do it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) == 'special' %}&#xA;    {% set assets = entry.assetfield_1 %}&#xA;{% else %}&#xA;    {% set assets = entry.assetfield_2 %}&#xA;{% endif %}&#xA;&#xA;{% for asset in assets %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-05T14:55:26.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9580" PostTypeId="2" ParentId="9578" CreationDate="2015-05-05T15:04:06.697" Score="6" Body="&lt;p&gt;You could use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions#shuffle&quot;&gt;&lt;code&gt;shuffle()&lt;/code&gt;&lt;/a&gt; function to randomize your &lt;code&gt;postDate&lt;/code&gt; ordered array of entry models:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'entertainmentEvents',&#xA;    entertainmentBanner: ':notempty:',&#xA;    status: 'live, pending',&#xA;    order: 'postDate desc',&#xA;    limit: 10&#xA;}) %}&#xA;&#xA;{% set entries = shuffle(entries) %}&#xA;&#xA;{% for entry in entries|slice(0, 3) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-05T15:08:02.267" LastActivityDate="2015-05-05T15:08:02.267" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9581" PostTypeId="2" ParentId="9577" CreationDate="2015-05-05T15:35:03.537" Score="4" Body="&lt;p&gt;The issue with your original code is that you're looping through the &quot;default&quot; field, i.e. &lt;code&gt;entry.assetfield&lt;/code&gt;, not the variable you set (&lt;code&gt;assetfield&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@carlcs' answer should do it, though you could also set the variable w/ a &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary operator&lt;/a&gt; to make it a one-liner:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assetField = craft.request.getSegment(1) == 'special' ? entry.assetFieldSpecial : entry.assetField %}&#xA;&#xA;{% for assets in assetField %}&#xA;    ....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-05-05T15:35:03.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9582" PostTypeId="1" AcceptedAnswerId="9583" CreationDate="2015-05-05T15:41:27.987" Score="2" ViewCount="4160" Body="&lt;p&gt;How do comments work in Craft? I mean inline and multiline comments, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HTML: &amp;lt;!--xxx--&amp;gt; m&#xA;  JS:   /*xxx*/  m   //xxx i&#xA; PHP:   /*xxx*/  m   //xxx i   #xxx i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3606" LastEditorUserId="57" LastEditDate="2015-05-05T19:06:59.810" LastActivityDate="2015-05-05T19:06:59.810" Title="Inline and multiline comments in Craft?" Tags="&lt;templating&gt;&lt;comments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9583" PostTypeId="2" ParentId="9582" CreationDate="2015-05-05T15:43:43.217" Score="7" Body="&lt;p&gt;There's only one comment syntax for Craft / Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# ... #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anything in between won't be parsed by Twig, so you can comment out multiple lines of Twig and HTML like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &#xA;    {% set var = value %}&#xA;    {% for item in seq %}&#xA;        &amp;lt;p&amp;gt;{{ item }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As with many other languages you &lt;strong&gt;can't nest comments&lt;/strong&gt;! So if you want to comment out some lines of code that already have comments, you can't do that like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &#xA;    {#&#xA;     # Lots of comments going on here&#xA;     #}&#xA;    {% set var = value %}&#xA;&#xA;    {# I warned you #}&#xA;    {% for item in seq %}&#xA;        &amp;lt;p&amp;gt;{{ item }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The best workaround I found is to use HTML comments in combination with Twigs &lt;code&gt;verbatim&lt;/code&gt; tags (disables Twig parsing).&#xA;I added a snippet to my editor for this and use it regularly since:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% verbatim %}&#xA;&amp;lt;!--&#xA;    {#&#xA;     # Lots of comments going on here&#xA;     #}&#xA;    {% set var = value %}&#xA;&#xA;    {# I warned you #}&#xA;    {% for item in seq %}&#xA;    {% endfor %}&#xA;--&amp;gt;&#xA;{% endverbatim %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-05T16:05:03.607" LastActivityDate="2015-05-05T16:05:03.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9584" PostTypeId="1" AcceptedAnswerId="9585" CreationDate="2015-05-05T15:47:52.010" Score="2" ViewCount="449" Body="&lt;p&gt;We use a matrix field for the article content on our site. We have different blocks for different content (text, images, embed etc..) and we have optional fields that are outside of the matrix that  only need to be defined once, like a related article or place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code to output the matrix is as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.postBody %}&#xA;&#xA;{% include 'blog/blocks/_' ~ block.type ignore missing with {&quot;block&quot;:block} only %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to float my related related restaurant section (which is optional) after either&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the second instance of a &lt;code&gt;text&lt;/code&gt; block&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the last &lt;code&gt;text&lt;/code&gt; block. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some of my blocks are elements that take up the entire width of the section, so I want to attach it to a text block so that it floats neatly alongside the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I select the second or last instance of a certain block type within my for loop?&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-05-05T16:47:01.253" Title="How Do I Select the second instance of a certain block type" Tags="&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9585" PostTypeId="2" ParentId="9584" CreationDate="2015-05-05T16:27:14.110" Score="4" Body="&lt;p&gt;You could save that second text block's ID to a variable and compare against that in your text partial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_entry.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set textBlocksIds = entry.postBody.type('text').ids() %}&#xA;{% set secondTextBlockId = textBlocksIds|length &amp;gt;= 2 ? textBlocksIds[2] : textBlocksIds[1] %}&#xA;&#xA;{% for block in entry.postBody %}&#xA;    {% include 'blog/blocks/_' ~ block.type ignore missing with {&#xA;        'block': block,&#xA;        'secondTextBlockId': secondTextBlockId&#xA;    } only %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;blog/blocks/_text.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.id == secondTextBlockId %}&#xA;    {% include 'blog/partials/_restaurants' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-05T16:27:14.110" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9586" PostTypeId="2" ParentId="9572" CreationDate="2015-05-05T16:31:34.207" Score="3" Body="&lt;p&gt;Your css and your fonts should be in the public section of the craft website. So put your css in &quot;root/public/assets/css&quot; and &quot;root/public/assets/fonts/bootstrap&quot;. Than remove the {{ siteurl }} twig code (in this therme only use plain css).&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="3535" LastEditDate="2015-05-05T16:38:03.477" LastActivityDate="2015-05-05T16:38:03.477" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9587" PostTypeId="2" ParentId="9584" CreationDate="2015-05-05T16:39:58.797" Score="2" Body="&lt;p&gt;Getting the second instance of a particular block type is fairly easy. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set textBlockCount = 0 %}&#xA;{% for block in entry.postBody %}&#xA;&#xA;    {% include 'blog/blocks/_' ~ block.type ignore missing with {&quot;block&quot;:block} only %}&#xA;&#xA;    {% if block.type == &quot;text&quot; %}&#xA;        {% set textBlockCount = textBlockCount + 1 %}&#xA;    {% endif %}&#xA;&#xA;    {% if textBlockCount == 2 %}&#xA;        {# insert optional content here #}&#xA;        {% set textBlockCount = 0 %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you can get the last block (ignoring blockType) using a &lt;code&gt;{% if loop.last %}...{% endif %}&lt;/code&gt; conditional. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, getting the last instance of a blocktype is a bit more difficult, because it would require you to be able to &quot;look ahead&quot; in the loop to determine if it is the last of its type, which isn't really possible. I would suggest perhaps adding the optional data into one of the blocktypes directly or adding a lightswitch or checkbox field to the blocktype to trigger the optional include).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == 'text' and block.includeOptional %}&#xA;    {# insert optional content here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-05T16:47:01.253" LastActivityDate="2015-05-05T16:47:01.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9588" PostTypeId="2" ParentId="9566" CreationDate="2015-05-05T17:02:52.157" Score="1" Body="&lt;p&gt;You could try and listen to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#onBeforeSaveAsset-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSaveAsset&lt;/code&gt;&lt;/a&gt; events instead of &lt;code&gt;onSaveAsset&lt;/code&gt;. With &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#onBeforeSaveAsset-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSaveAsset&lt;/code&gt;&lt;/a&gt; you can modify the asset model before being saved, so you don't have to do that manually.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-05T17:02:52.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9589" PostTypeId="2" ParentId="9576" CreationDate="2015-05-05T19:03:44.690" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can a user photo support a remote image?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer to that is currently &quot;no&quot;, in Craft 2.x.  However in the upcoming Craft 3.x, user profile photos are proper &quot;assets&quot; and can be saved to any asset source.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm looking to do a remote image (from plugin) as the user profile image. I've got the path saving to the column, but the image is not rendering. Anything special I need to do to get that to render?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I assume you're just ignoring Craft's default user profile &quot;photo&quot; field and adding your own custom one?  Or are you trying to replace the profile field that Craft uses to display profile photos in the CP with your own custom one.  I'm having a hard time seeing how you'd pull off the later in the current version of Craft 2.x.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-05T19:03:44.690" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9590" PostTypeId="2" ParentId="9400" CreationDate="2015-05-05T19:07:12.253" Score="3" Body="&lt;p&gt;I use...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ramnode.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RamNode&lt;/a&gt; and &lt;a href=&quot;http://www.webmin.com/virtualmin.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Virtualmin GPL&lt;/a&gt; for fast, powerful, inexpensive development boxes that take &lt;em&gt;minimal&lt;/em&gt; maintenance/sysadmin time (check out &lt;a href=&quot;http://www.webmin.com/vinstall.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Virtualmin GPL's super-easy install script&lt;/a&gt;!)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.webfaction.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Webfaction&lt;/a&gt; for modest production sites that need to be inexpensive and fast with &lt;em&gt;zero&lt;/em&gt; required sysadmin time&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.arcustech.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ArcusTech&lt;/a&gt; for client production sites where I shouldn't be relied on as a sysadmin (which is &lt;em&gt;all&lt;/em&gt; client production sites)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://aws.amazon.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amazon AWS&lt;/a&gt; when clients have web teams that would laugh at the quaintness of a single server instance&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This basically has me covered at any scale, and I'm happy with each provider. Transactional mail goes through &lt;a href=&quot;https://mandrillapp.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mandrill&lt;/a&gt; when I can help it, as it's usually free and &lt;em&gt;always&lt;/em&gt; fast and reliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also in Seattle (United States), so when I say &lt;em&gt;fast&lt;/em&gt; it's a geographically-relative term. Most of the above offer servers in various cities+countries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update May 2019&lt;/strong&gt;: I no longer use Webfaction after its acquisition by GoDaddy, and I've settled on using &lt;a href=&quot;https://forge.laravel.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laravel Forge&lt;/a&gt; with &lt;a href=&quot;https://www.digitalocean.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Ocean&lt;/a&gt;, &lt;a href=&quot;https://www.linode.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linode&lt;/a&gt;, or &lt;a href=&quot;https://www.vultr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vultr&lt;/a&gt; for most new production projects. I &lt;a href=&quot;https://workingconcept.com/blog/2018-budget-vps-survey&quot; rel=&quot;nofollow noreferrer&quot;&gt;published a blog post last year comparing VPS providers&lt;/a&gt;, some of which are great for powerful+cheap development boxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For transactional email, I almost always use &lt;a href=&quot;https://www.mailgun.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mailgun&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2019-05-01T16:04:21.210" LastActivityDate="2019-05-01T16:04:21.210" CommentCount="5" CommunityOwnedDate="2015-05-05T19:07:12.253" ContentLicense="CC BY-SA 4.0" />
  <row Id="9591" PostTypeId="2" ParentId="9571" CreationDate="2015-05-05T19:20:15.467" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;When I use my email field to attempt an email address change, I get a verification email generated by Craft sent to the new email address, but the email change is not reflected in either the CP or on the front-end when I refresh the form.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The user's email address won't actually update until you click the link in the verification email the user receives.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-05T19:20:15.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9592" PostTypeId="1" CreationDate="2015-05-05T19:25:36.733" Score="2" ViewCount="1395" Body="&lt;p&gt;I can't for the life of me figure out what's going on. When assets are added, they upload fine but when I add them to entries or try to view them in the browser, they won't display and show a 403 Forbidden page instead. &#xA;Help! :)&lt;/p&gt;&#xA;" OwnerUserId="3622" LastActivityDate="2017-04-19T13:34:25.140" Title="403 Forbidden Assets" Tags="&lt;assets&gt;&lt;image&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9593" PostTypeId="1" CreationDate="2015-05-06T05:13:40.823" Score="1" ViewCount="373" Body="&lt;p&gt;Anyone ever encounter this error when trying to view an asset (image) after upload? I'm working in homestead and everything appears to be compiling correctly, however the images don't render in the browser. The path shows up in dev tools and looks correct...any thoughts?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Craft\TemplateLoaderException&lt;/p&gt;&#xA;&lt;p&gt;Unable to find the template “_layout”. (/home/vagrant/sites/my-craft-sites/wcs/craft/app/etc/templating/twigextensions/TemplateLoader.php:123)&lt;/p&gt;&#xA;&lt;p&gt;#0 /home/vagrant/sites/my-craft-sites/wcs/craft/app/etc/templating/twigextensions/TemplateLoader.php(71): Craft\TemplateLoader-&amp;gt;_findTemplate('_layout')&lt;br /&gt;&#xA;#1 /home/vagrant/sites/my-craft-sites/wcs/craft/app/vendor/twig/twig/lib/Twig/Environment.php(265): Craft\TemplateLoader-&amp;gt;getCacheKey('_layout')&lt;br /&gt;&#xA;#2 /home/vagrant/sites/my-craft-sites/wcs/craft/app/vendor/twig/twig/lib/Twig/Environment.php(323): Twig_Environment-&amp;gt;getTemplateClass('_layout', NULL)&lt;br /&gt;&#xA;#3 /home/vagrant/sites/my-craft-sites/wcs/craft/storage/runtime/compiled_templates/fc/9e/d83ba99cc7bfbe696da10fbdcf65536dc4ae270165035f00e6cfb3c5b953.php(10): Twig_Environment-&amp;gt;loadTemplate('_layout')&lt;br /&gt;&#xA;#4 /home/vagrant/sites/my-craft-sites/wcs/craft/app/vendor/twig/twig/lib/Twig/Environment.php(345): __TwigTemplate_fc9ed83ba99cc7bfbe696da10fbdcf65536dc4ae270165035f00e6cfb3c5b953-&amp;gt;__construct(Object(Twig_Environment))&lt;br /&gt;&#xA;#5 /home/vagrant/sites/my-craft-sites/wcs/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Environment-&amp;gt;loadTemplate('404')&lt;br /&gt;&#xA;#6 /home/vagrant/sites/my-craft-sites/wcs/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('404', Array)&lt;br /&gt;&#xA;#7 /home/vagrant/sites/my-craft-sites/wcs/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&lt;br /&gt;&#xA;#8 /home/vagrant/sites/my-craft-sites/wcs/craft/app/controllers/TemplatesController.php(203): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&lt;br /&gt;&#xA;#9 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&lt;br /&gt;&#xA;#10 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&lt;br /&gt;&#xA;#11 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&lt;br /&gt;&#xA;#12 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&lt;br /&gt;&#xA;#13 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('renderError')&lt;br /&gt;&#xA;#14 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/base/CErrorHandler.php(331): CWebApplication-&amp;gt;runController('templates/rende...')&lt;br /&gt;&#xA;#15 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/base/CErrorHandler.php(204): CErrorHandler-&amp;gt;render('error', Array)&lt;br /&gt;&#xA;#16 /home/vagrant/sites/my-craft-sites/wcs/craft/app/etc/errors/ErrorHandler.php(128): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&lt;br /&gt;&#xA;#17 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/base/CErrorHandler.php(129): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&lt;br /&gt;&#xA;#18 /home/vagrant/sites/my-craft-sites/wcs/craft/app/framework/base/CApplication.php(732): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&lt;br /&gt;&#xA;#19 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&lt;br /&gt;&#xA;#20 {main}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3624" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-12-02T20:13:04.843" Title="Receiving 'template loader exception' when trying to view asset (image) after upload" Tags="&lt;assets&gt;&lt;database&gt;&lt;config&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9594" PostTypeId="2" ParentId="9556" CreationDate="2015-05-06T10:38:07.187" Score="1" Body="&lt;p&gt;Ok, so i managed to solve my problem without actually fetching any extra records, but instead using mysql &lt;code&gt;group_concat&lt;/code&gt; function for the fields i need to display. Posting this here for anyone else that might need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In OrderElementType:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria){&#xA;&#xA;    $query&#xA;      -&amp;gt;addSelect('group_concat(items.productName separator \';\') as productnames')&#xA;      -&amp;gt;join('orders orders', 'orders.id = elements.id')&#xA;      -&amp;gt;leftJoin('items items', 'orders.id = items.orderId'&#xA;      -&amp;gt;group('elements.id');&#xA;}&#xA;&#xA;public function populateElementModel($row){&#xA;  $model = OrderModel::populateModel($row);&#xA;  $products = explode(';', $row['productnames']);&#xA;  foreach($products as $product){&#xA;    $item = new ItemModel();&#xA;    $item-&amp;gt;productName = $product;&#xA;    if(!$model-&amp;gt;items){&#xA;      $model-&amp;gt;setAttribute('items', array());&#xA;    }&#xA;    $model-&amp;gt;setAttribute('items', array_merge($model-&amp;gt;items, array($item)));&#xA;&#xA;  }&#xA;  return $model;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastEditorUserId="2300" LastEditDate="2015-05-06T11:33:49.217" LastActivityDate="2015-05-06T11:33:49.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9595" PostTypeId="1" CreationDate="2015-05-06T11:41:44.147" Score="1" ViewCount="249" Body="&lt;p&gt;I'm trying to get the next and previous entries in a structure but I only want the next or previous ones within the same category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set next = entry.getNext().relatedTo(category).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-05-06T11:57:43.147" Title="Way to getNext() within the same category" Tags="&lt;relations&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9596" PostTypeId="2" ParentId="9595" CreationDate="2015-05-06T11:51:36.563" Score="1" Body="&lt;p&gt;You're close! &lt;code&gt;getNext&lt;/code&gt; and &lt;code&gt;getPrev&lt;/code&gt; take an ElementCriteriaModel as a parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('news').relatedTo(category) %}&#xA;&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you prefer, a params array (same as you would pass to &lt;code&gt;craft.entries&lt;/code&gt; ElementCriteriaModel):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'news',&#xA;    relatedTo: category,&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-06T11:57:43.147" LastActivityDate="2015-05-06T11:57:43.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9597" PostTypeId="1" CreationDate="2015-05-06T12:06:20.553" Score="1" ViewCount="382" Body="&lt;p&gt;I'm trying to find the next event after today (now) from a series of entries. This code however outputs all upcoming events after today but I'm just looking for the first (next) event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEvent =  craft.events.events.find() %}&#xA;{% for entry in nextEvent %}&#xA;    {% if entry.startDate &amp;gt; now %}&#xA;    &amp;lt;span class=&quot;text-primary&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&#xA;    {{ entry.startDate|date('d F Y ') }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2015-05-06T14:25:12.720" Title="Find next event" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;events&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9598" PostTypeId="2" ParentId="9597" CreationDate="2015-05-06T12:22:40.180" Score="3" Body="&lt;p&gt;When you are setting &lt;code&gt;nextEvent&lt;/code&gt;, you can limit only events that are upcoming and only output the first result you get back like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.startDate('&amp;gt;= ' ~ now).first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can take that and update your code like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEvent = craft.entries.section('events').order('startDate').startDate('&amp;gt;= ' ~ now).first() %}&#xA;&#xA;{% if nextEvent %}&#xA;    foo&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have assumed you have a section called 'Event's until we get some clarification as to what &lt;code&gt;craft.events.events&lt;/code&gt; is.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="125" LastEditDate="2015-05-06T12:34:32.827" LastActivityDate="2015-05-06T12:34:32.827" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9599" PostTypeId="2" ParentId="9597" CreationDate="2015-05-06T13:15:14.970" Score="2" Body="&lt;p&gt;P&amp;amp;T's events plugin available on GitHub &lt;a href=&quot;http://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow&quot;&gt;http://github.com/pixelandtonic/Events&lt;/a&gt; is actually not meant to be used at all. It was just a demo to show the potential of custom element types!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest to use a channel section for your events, and with the code Jamie provided you're already done figuring out how to find your &quot;next event&quot;! You could also collect events with a matrix field, if you have a need for an extra level of hierarchy and if that's still not enough you could have your events in a table in that matrix (using the &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;&quot;Super Table&quot;&lt;/a&gt; plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also two other plugins: &lt;a href=&quot;https://github.com/tippingmedia/craft.events&quot; rel=&quot;nofollow&quot;&gt;&quot;Events&quot;&lt;/a&gt; and &lt;a href=&quot;http://michaelrog.com/craft/calendars/introduction&quot; rel=&quot;nofollow&quot;&gt;&quot;Calendar&quot;&lt;/a&gt;, but I'm not sure if they are still under development and I'd probably stick to core Craft features (channels / matrix) for now.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-06T13:15:14.970" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9600" PostTypeId="1" CreationDate="2015-05-06T14:06:47.790" Score="1" ViewCount="1334" Body="&lt;p&gt;I need to get blog posts from hubspot api using this approach. &#xA;&lt;a href=&quot;http://developers.hubspot.com/docs/methods/blogv2/get_blog_posts&quot; rel=&quot;nofollow&quot;&gt;http://developers.hubspot.com/docs/methods/blogv2/get_blog_posts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since craft uses twig I'm unable to use php in the templates, so I thought I could just use jQuery getJson but this causes a cross origin request blocked error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is creating a plugin and using php my only option to get json results from an api call?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone used hubspot api?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="125" LastEditDate="2015-05-06T14:35:13.567" LastActivityDate="2015-05-06T22:14:37.830" Title="Best solution for get json results from third party api?" Tags="&lt;templating&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9601" PostTypeId="1" AcceptedAnswerId="9688" CreationDate="2015-05-06T14:10:32.127" Score="2" ViewCount="232" Body="&lt;p&gt;I've been asked about doing a Russian version of a website. I've set up a new locale in the Locale settings, as well as an &lt;code&gt;ru/&lt;/code&gt; folder with &lt;code&gt;index.php&lt;/code&gt; and &lt;code&gt;.htaccess&lt;/code&gt;. Adding a news story in Russian works fine, though changing a &lt;em&gt;Global&lt;/em&gt; section to Russian brings up a &quot;&lt;strong&gt;Page Cannot be Found&lt;/strong&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The address for this is &lt;a href=&quot;http://example.com/admin/globals/ru/globals&quot; rel=&quot;nofollow&quot;&gt;http://example.com/admin/globals/ru/globals&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this look right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://example.com/',&#xA;        'en_gb' =&amp;gt; 'http://example.com/',&#xA;        'ru' =&amp;gt; 'http://dropinn.net/ru',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/site/ru&lt;/strong&gt; Folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Tell Craft to serve the Russian content&#xA;define('CRAFT_LOCALE', 'ru');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="823" LastActivityDate="2015-05-11T19:32:50.263" Title="Locale Global section in CP bringing back page can not be found" Tags="&lt;control-panel&gt;&lt;localization&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9602" PostTypeId="1" CreationDate="2015-05-06T14:12:58.197" Score="3" ViewCount="771" Body="&lt;p&gt;If I want to create fields that get set to a custom content table rather than craft_content how would I do that?&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-05-08T14:45:08.877" Title="Creating and using custom content tables" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;content&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9603" PostTypeId="2" ParentId="9597" CreationDate="2015-05-06T14:25:12.720" Score="2" Body="&lt;p&gt;To break a for loop you could have a variable and check against its value in your loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set breakLoop = false %}&#xA;&#xA;{% for entry in nextEvent %}&#xA;&#xA;    {% if (entry.startDate &amp;gt; now) and (breakLoop == false) %}&#xA;        {{ entry.startDate }}&#xA;        {% set breakLoop = true %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or – if you have a need to break loops more often – use the plugin &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;&quot;Break and Continue&quot;&lt;/a&gt;, that gives you a Twig tag for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in nextEvent %}&#xA;&#xA;    {% if entry.startDate &amp;gt; now %}&#xA;        {{ entry.startDate }}&#xA;        {% break %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-06T14:25:12.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9604" PostTypeId="1" AcceptedAnswerId="9606" CreationDate="2015-05-06T14:28:39.327" Score="0" ViewCount="739" Body="&lt;p&gt;Just downloaded FeedMe, and it seems like a great solution to what I want to do, but I can't get it to succesfully run a json import on a feed generated by instagram. When I hit 'Save and Continue', I get a PHP warning:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;file_get_contents(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's on this line: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function getRawData($url)&#xA;     {&#xA;     if (file_get_contents(__FILE__) &amp;amp;&amp;amp; ini_get('allow_url_fopen')) {&#xA;         $content = file_get_contents($url);&#xA;     } else if (function_exists('curl_version')) {&#xA;         $curl = curl_init();&#xA;         curl_setopt($curl, CURLOPT_URL, $url);&#xA;         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);&#xA;         $content = curl_exec($curl);&#xA;         curl_close($curl);&#xA;     }&#xA;&#xA;     return ($content) ? $content : false;&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's worth noting, I have no idea what to set the Primary Element as. Didn't see any documentation for JSON on the readme&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="377" LastEditDate="2015-05-06T14:37:10.140" LastActivityDate="2015-05-06T15:06:54.953" Title="Using FeedMe with the instagram API" Tags="&lt;json&gt;&lt;feed&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9605" PostTypeId="2" ParentId="9600" CreationDate="2015-05-06T14:48:53.003" Score="4" Body="&lt;p&gt;This works great for templates too: &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just tested it for a RSS feed, but apparently it also supports JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RSS example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    url: 'http://url.to/feed.rss',&#xA;    type: 'rss',&#xA;    element: 'item',&#xA;    cache: 60,&#xA;} %}&#xA;&#xA;{% set feed = craft.feedme.feed(params) %}&#xA;{% for node in feed %}&#xA;    Title: {{ node.title }}&#xA;    Publish Date: {{ node.pubdate }}&#xA;    Content: {{ node.description }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-05-06T14:48:53.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9606" PostTypeId="2" ParentId="9604" CreationDate="2015-05-06T15:06:54.953" Score="3" Body="&lt;p&gt;Sounds like a server (DNS) configuration issue. PHP can't open the URL because it can't resolve the domain.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-05-06T15:06:54.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9607" PostTypeId="1" AcceptedAnswerId="9623" CreationDate="2015-05-06T15:25:36.710" Score="0" ViewCount="1453" Body="&lt;p&gt;In trying to test for the existence of a field within a Matrix block I think I may have stumbled upon a bug, or I'm missing something and approaching this the wrong way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've setup a simple test using a fresh, standard Craft install with a very basic Matrix setup. I've pasted the Matrix template code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if entry.matrix is defined and entry.matrix|length %}&#xA;&#xA;        {% for block in entry.matrix %}&#xA;&#xA;            {% if block.type == &quot;richText&quot; %}&#xA;&#xA;                {{ block.richText }}&#xA;&#xA;            {% elseif block.type == &quot;plainText&quot; %}&#xA;&#xA;                {{ block.plainText|markdown }}&#xA;&#xA;            {% elseif block.type == &quot;blockquote&quot; %}&#xA;&#xA;                {% if block.test is defined %}&#xA;                    &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Uh oh! This field doesn't actually exist.&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;blockquote&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ block.quote }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;cite&amp;gt;– {{ block.attribution }}&amp;lt;/cite&amp;gt;&#xA;                &amp;lt;/blockquote&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within the blockquote block I am checking if &lt;code&gt;block.test&lt;/code&gt; is defined, this check always evaluates to true despite the fact that it doesn't exist and if I add any additional checks it bombs out the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3628" LastEditorUserId="344" LastEditDate="2015-05-06T15:52:18.997" LastActivityDate="2015-05-06T23:05:31.093" Title="Checking for existence of a field within a Matrix block" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9608" PostTypeId="2" ParentId="9593" CreationDate="2015-05-06T15:27:46.483" Score="1" Body="&lt;p&gt;I assume this is all in context of the control panel and not the front-end, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so and I had to guess, it looks like you're missing some Craft files on your box.  Try downloading a fresh copy of Craft from &lt;a href=&quot;http://buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com&lt;/a&gt; and replace your existing &lt;code&gt;craft/app&lt;/code&gt; folder with the freshly downloaded one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-06T15:27:46.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9609" PostTypeId="2" ParentId="309" CreationDate="2015-05-06T16:11:27.463" Score="4" Body="&lt;p&gt;I built the &lt;a href=&quot;https://github.com/sjelfull/Craft-CacheWarmer&quot; rel=&quot;nofollow&quot;&gt;Cache Warmer&lt;/a&gt; plugin recently, which takes a blanket approach to refreshing your pages cache, by getting entries url with the .getUrl() method, and then send of batch requests to those url's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using it together with the &lt;a href=&quot;https://github.com/themccallister/craft.cache-clear/&quot; rel=&quot;nofollow&quot;&gt;Cache Clear&lt;/a&gt; plugin, when deploying changes to our site, and it's working well. This is a very simplistic approach to a potentially complex problem, so I would say a more granular cache invalidation/refresh strategy might be needed, depending on your use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think there is something to be said for this approach on small to medium sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to at least add some hooks, so that you can warm up single entries/elements as well. My plugin doesn't know which pages your cached elements are living on, but there is a big chance those pages will be hit and warmed up - as long as they're located in a section, and that section is toggled in the plugin settings.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-05-06T16:11:27.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9610" PostTypeId="1" AcceptedAnswerId="9612" CreationDate="2015-05-06T16:24:54.103" Score="0" ViewCount="1568" Body="&lt;p&gt;I have an asset field (dataCard) which I use to upload a single PDF file tied to an entry. I'm trying, unsuccessfully, to display the asset tied to the entry on a page listing multiple entries. How would I do this? This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.dataCard.first() %}&#xA;&#xA;{% if asset %}&#xA;    &amp;lt;a href=&quot;{{ asset.url }}&quot;&amp;gt;{{category.title}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="735" LastActivityDate="2015-05-06T17:52:50.367" Title="How do you display a file asset (PDF) in the template?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9611" PostTypeId="1" CreationDate="2015-05-06T17:31:38.897" Score="2" ViewCount="2123" Body="&lt;p&gt;I am trying to list the months (January, Febuary etc) between two dates.&#xA;I have a start date: &lt;code&gt;5/4/2015&lt;/code&gt; and an end date: &lt;code&gt;9/25/2015&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/range.html&quot; rel=&quot;nofollow&quot;&gt;range&lt;/a&gt; I am able to return the month numbers, but just can't figure out the correct syntax to convert &lt;code&gt;5&lt;/code&gt; into &lt;code&gt;May&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've got so far, maybe there is a better way all together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TWIG&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startMonth = craft.plugin.getStartDate() %} // returns 5/4/2015&#xA;{% set endMonth = craft.plugin.getEndData() %} // returns 9/25/2015&#xA;&#xA;{% for month in range(startMonth, endMonth, 1) %}&#xA;    {{ month }}  // returns 5 6 7 8 9&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried doing something like: &lt;code&gt;{{ month|date('F') }}&lt;/code&gt; but that returns &lt;code&gt;December&lt;/code&gt; for each result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll eventually need days within this month range, but I am hoping from this I can figure that out.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="125" LastEditDate="2015-05-06T18:18:08.070" LastActivityDate="2015-05-07T21:56:20.763" Title="List months between a given date range" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9612" PostTypeId="2" ParentId="9610" CreationDate="2015-05-06T17:52:50.367" Score="2" Body="&lt;p&gt;What do you mean by 'display the asset'? Showing a thumbnail is not an option, because no thumbs are made for PDF files. If you'd want to show the filename, for example, use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel#filename&quot; rel=&quot;nofollow&quot;&gt;filename&lt;/a&gt; property of the asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the page contains multiple entries, you'd have to loop through the entries first. Then, for each entry, check if it has an asset in the desired field (by using &lt;code&gt;| length&lt;/code&gt;, after which you can display the asset.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('bla').relatedTo('bla') %}&#xA;    {% if entry.dataCard | length %}&#xA;        {% set asset = entry.dataCard.first() %}&#xA;        &amp;lt;a href=&quot;{{ asset.url }}&quot;&amp;gt;{{ asset.filename }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-05-06T17:52:50.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9613" PostTypeId="2" ParentId="9611" CreationDate="2015-05-06T18:01:04.910" Score="2" Body="&lt;p&gt;Ok, there must be a better way, but if you want to also show the days eventually, try this approach (As hinted by &lt;a href=&quot;https://stackoverflow.com/questions/24078884/twig-date-loop-each-day-in-a-period&quot;&gt;this answer&lt;/a&gt;, you basically loop through the seconds, in steps of 86400 (= one day)):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = craft.plugin.getStartDate() %} // returns 5/4/2015&#xA;{% set end = craft.plugin.getEndData() %} // returns 9/25/2015&#xA;&#xA;{% set currentMonth = null %}&#xA;{% for day in range(start | date('U'), end | date('U'), 86400) %}&#xA;    {% set month = day | date('F') %} {# create a month variable #}&#xA;    {% if month != currentMonth %}&#xA;        {{ month }} {# display the month, once #}&#xA;        {% set currentMonth = month %}&#xA;    {% endif %}&#xA;&#xA;    {{ day | date('d') }} {# display the day #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-05-06T18:07:35.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9614" PostTypeId="1" CreationDate="2015-05-06T18:02:28.553" Score="0" ViewCount="247" Body="&lt;p&gt;Trying to get Placid working but I can't get Twitter to Connect. The keys are all set correctly, but when I click 'Connect', I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\OauthService and its behaviors do not have a method or closure named &quot;encodeToken&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On line 266 of /home/rizen/sites/rizencreative.com/craft/app/framework/base/CComponent.php(266)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named &quot;{name}&quot;.',&#xA;    array('{class}'=&amp;gt;get_class($this), '{name}'=&amp;gt;$name)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="377" LastEditorUserId="344" LastEditDate="2015-05-28T12:28:40.247" LastActivityDate="2015-05-29T11:50:12.103" Title="Twitter, Dukt OAuth, and Placid error" Tags="&lt;plugin-duktoauth&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9615" PostTypeId="1" AcceptedAnswerId="9633" CreationDate="2015-05-06T18:03:10.647" Score="1" ViewCount="750" Body="&lt;p&gt;One of my biggest issues with craft so far is having to type out which template file a section is using, I don't understand why we don't have a location to enter all our possible templates, which could then be chosen when creating sections &quot;new pages&quot; etc. Or having craft know which template files exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could this be possible via a plugin, or would the core need to be modified. Having to explain to a client they need to know the name and location of a template file when creating new pages isn't great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated Scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple example, say I have news post, and events, and I want an index of both as well as single news post and single events both using different templates. When a client wants to create a new event, they would need to know the name of the template that is used for single events otherwise it would default to index.html if the auto generated entry-template name doesn't exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new entry craft defaults to a news item or I call it a news &quot;post&quot;. So to create a new event, I need to create a new section, and then specify the entry-template otherwise it defaults to the name of the section, and if no template exists for that entry template &quot;which ends up being the name of the section&quot; it defaults to the index.html template. Then they still need to assign fields to each section that is created. The assigning fields can be simplified by creating a group say called Single Events, with all the possible fields allowed for that type of section &quot;page&quot; this case being single events...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only easy solution I can think of is to not use groups at all for fields, and just throw every field into each section, then in the index.html template check for each field and if it exists before displaying it. But what about not wanting to display it or displaying dynamic content based on the entry type news post vs single event vs team members vs resources vs contact forms. A solution to that is creating another field called content type with a drop down for single event, team member, resources, contact form... then in the index.html template check the value of the drop down before determining what is going to be displayed and what isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My whole point is it seems like this could all be simplified by having a drop down to choose a template when creating a section since a section needs to be created so that you can create a new entry that is not a news post, and I also think once you create a new section it should allow you to either start editing that section, or take you to the field selection to add fields to that section, after you save a section it just takes you back to the sections which you then have to click edit entry types to choose which fields are used for that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me it would make more sense to have fields assigned to templates, and sections are just holders for &quot;entries&quot; or what I call pages. Example basic-page.template has a bunch of fields assigned to it. I create a section called about us, and choose basic-page.template after saving the section allow me to start editing the entry for that &quot;section&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the wall of text just trying to give some examples and I hope they make sense. Just trying to understand the concept of some of this, I'm getting by but it seems odd not to allow to choose a template that is used unless you are a dev on the project and know exactly the name of the template.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-05-07T14:23:14.763" LastActivityDate="2015-05-07T20:03:03.683" Title="Any plugins to add drop down for selecting template?" Tags="&lt;templating&gt;&lt;config&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9616" PostTypeId="2" ParentId="9611" CreationDate="2015-05-06T18:09:48.240" Score="2" Body="&lt;p&gt;You could solve this with a recursive macro and add a day / month to the &lt;code&gt;startDate&lt;/code&gt; with each iteration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro listDays(startDate, endDate) %}&#xA;    {% import _self as self %}&#xA;&#xA;    {% if startDate &amp;lt;= endDate %}&#xA;        {{ startDate|date('F-d') }}&#xA;        {{ self.listDays(startDate|date_modify('+ 1 day'), endDate) }}&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then call it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ macros.listDays(startDate, endDate) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-06T18:31:26.873" LastActivityDate="2015-05-06T18:31:26.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9617" PostTypeId="1" AcceptedAnswerId="9723" CreationDate="2015-05-06T19:03:52.657" Score="1" ViewCount="151" Body="&lt;p&gt;I've got a navigation bar that displays different links for logged in users using {% if currentUser %}. However, when clicking through links, sometimes it won't pick up that someone is logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same issue crops up occasionally with &quot;denied permissions&quot; error pages. Again, reloading the page will pick up the user session and display the template normally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's inconsistent which pages (and servers) it happens on. I'm not using any {% cache %} tags in the twig templates either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a cp setting or config/general.php option I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Looks like the autogenerated appId based on filepath must have been the issue.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="3512" LastEditDate="2015-05-13T16:27:37.877" LastActivityDate="2015-05-13T16:27:37.877" Title="sessions being read inconsistently" Tags="&lt;templating&gt;&lt;users&gt;&lt;cache&gt;&lt;session&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9618" PostTypeId="1" AcceptedAnswerId="9657" CreationDate="2015-05-06T19:16:00.320" Score="2" ViewCount="317" Body="&lt;p&gt;Is there a particular school of thought on which is best to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They both appear to offer the same thing - exposing data and functionality to templates.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-05-08T09:39:54.600" Title="Plugin variables class versus twig functions/filters class" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9619" PostTypeId="2" ParentId="9611" CreationDate="2015-05-06T20:07:58.623" Score="3" Body="&lt;p&gt;I made a Craft plugin that simply wraps PHP DatePeriod: &lt;a href=&quot;https://github.com/carlcs/craft-dateperiod&quot; rel=&quot;nofollow&quot;&gt;&quot;Date Period plugin for Craft&quot;&lt;/a&gt;. The plugin provides a &lt;code&gt;datePeriod&lt;/code&gt; Twig function. It works really simple, your give it a start date, an end date and an interval to create a DatePeriod object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;datePeriod( startDate, endDate, interval )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This DatePeriod object you can now iterate over to get the dates, recurring at the set interval, over the period spanning your start and end date. By default the interval is set to 1 day, but you can modify that with the (optional) parameter. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set datePeriod = datePeriod(startDate, endDate, '1 month') %}&#xA;&#xA;{% for month in datePeriod %}&#xA;    {{ month|date('F') }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To also list the days in between, you would add Craft's &lt;code&gt;group&lt;/code&gt; filter like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set datePeriod = datePeriod(startDate, endDate) %}&#xA;&#xA;{% for month, daysInMonth in datePeriod|group('{ object|date(&quot;F&quot;) }') %}&#xA;    {{ month }}&#xA;    {% for day in daysInMonth %}&#xA;        {{ day|date('d') }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-07T05:27:14.130" LastActivityDate="2015-05-07T05:27:14.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9620" PostTypeId="2" ParentId="9614" CreationDate="2015-05-06T22:10:07.990" Score="2" Body="&lt;p&gt;Are you using the 0.9.60 version of OAuth? There are some issues with Placid and the latest OAuth version, which will be fixed in Placid 2.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-05-06T22:10:07.990" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9622" PostTypeId="2" ParentId="9615" CreationDate="2015-05-06T22:39:54.440" Score="1" Body="&lt;p&gt;There is a template select plugin, I've used it before and it worked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://straightupcraft.com/craft-plugins/template-select&quot; rel=&quot;nofollow&quot;&gt;http://straightupcraft.com/craft-plugins/template-select&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="3362" LastEditDate="2015-05-06T22:51:41.750" LastActivityDate="2015-05-06T22:51:41.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9623" PostTypeId="2" ParentId="9607" CreationDate="2015-05-06T22:45:31.080" Score="9" Body="&lt;p&gt;Use brackets instead of dot notation for the field handle when you test for &lt;code&gt;defined&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% if block['test'] is defined %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-06T23:05:31.093" LastActivityDate="2015-05-06T23:05:31.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9624" PostTypeId="2" ParentId="9607" CreationDate="2015-05-06T22:57:51.267" Score="3" Body="&lt;p&gt;This is a known bug we've tracked back to Twig. We've got it on our list to look into, and hopefully provide a patch and tests to Sensio, but haven't gotten to it, yet.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-06T22:57:51.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9625" PostTypeId="1" AcceptedAnswerId="9654" CreationDate="2015-05-07T00:26:22.877" Score="5" ViewCount="1009" Body="&lt;p&gt;What's the correct way to create a conditional so that a field won't display if it's empty? Is it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myentry | length %}&#xA;    ...&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myentry %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried both and both seem to work, but I want to make sure they're both correct.&lt;/p&gt;&#xA;" OwnerUserId="3381" LastEditorUserId="57" LastEditDate="2015-05-07T03:42:55.757" LastActivityDate="2015-05-07T22:21:23.923" Title="Correct code for a conditional field?" Tags="&lt;conditional&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9626" PostTypeId="2" ParentId="9573" CreationDate="2015-05-07T00:51:04.763" Score="2" Body="&lt;p&gt;For anyone's future benefit - this happens due to the fact I'm adding the user in the &lt;code&gt;sproutForms.saveEntry&lt;/code&gt; hook. That happens after it messes around with the &lt;code&gt;fieldContext&lt;/code&gt; and &lt;code&gt;contentTable&lt;/code&gt; options for the Entry. As such, the user is getting saved to the wrong context, so it won't appear...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick workaround for this is to move the following lines in &lt;code&gt;SproutForms_EntriesService.php:133-135&lt;/code&gt; to lines 120. This resets the field context back before the hook is called.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($transaction !== null)&#xA;{&#xA;    $transaction-&amp;gt;commit();&#xA;&#xA;    SproutFormsPlugin::log('Transaction committed');&#xA;}&#xA;&#xA;// Reset our field context and content table to what they were previously&#xA;craft()-&amp;gt;content-&amp;gt;fieldContext = $oldFieldContext;&#xA;craft()-&amp;gt;content-&amp;gt;contentTable = $oldContentTable;&#xA;&#xA;Craft::import('plugins.sproutforms.events.SproutForms_OnSaveEntryEvent');&#xA;&#xA;$event = new SproutForms_OnSaveEntryEvent(&#xA;    $this, array(&#xA;        'entry'      =&amp;gt; $entry,&#xA;        'isNewEntry' =&amp;gt; $isNewEntry,&#xA;        'event'      =&amp;gt; 'saveEntry',&#xA;        'entity'     =&amp;gt; $entry,&#xA;    )&#xA;);&#xA;&#xA;craft()-&amp;gt;sproutForms-&amp;gt;onSaveEntry($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-05-07T00:51:04.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9627" PostTypeId="2" ParentId="9625" CreationDate="2015-05-07T03:33:29.927" Score="8" Body="&lt;p&gt;It depends. Technically to determine if a variable is not empty (keep in mind '0' or 'false' are not considered empty), you can use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/empty.html#empty&quot; rel=&quot;nofollow&quot;&gt;'is not empty'&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myField is not empty %}...{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in most situations where '0' and/or 'false' are not expected values, then  anything that evaluates to '0', 'false' or 'null' will also work. So,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myField %}...{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myField|length %}...{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the field is not defined in the field layout however, these may also return an error. In which case you might want to use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/defined.html#defined&quot; rel=&quot;nofollow&quot;&gt;'is defined'&lt;/a&gt; first, before checking if the field is empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`{% if entry.myField is defined %}...{% endif %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In most cases, I just use &lt;code&gt;{% if entry.myField %}...{% endif %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-07T07:10:39.407" LastActivityDate="2015-05-07T07:10:39.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9628" PostTypeId="1" AcceptedAnswerId="9629" CreationDate="2015-05-07T03:45:03.927" Score="7" ViewCount="1734" Body="&lt;p&gt;I just moved my site from one MediaTemple (gs) instance to another. I copied and recreated the database on the new server, moved over all the files, and updated the internal references that pointed to the old site. I even cleared out the 'craft/storage/runtime/' folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I am logged in, I almost instantly get logged out. Typically, this is after 30-60 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wt8lm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether or not I enter in the correct password, the same message comes back up. However, I can go back to the main admin page, and I'm still logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what's going on? It seems to be a caching and session issue of some sort, but there is no caching setup on our server, and I cleared my browser cache completely.&lt;/p&gt;&#xA;" OwnerUserId="3554" LastEditorUserId="344" LastEditDate="2015-05-28T12:28:34.567" LastActivityDate="2015-05-28T12:28:34.567" Title="Migrated Server, Now Getting Logged Out Constantly" Tags="&lt;admin&gt;&lt;migration&gt;&lt;login&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9629" PostTypeId="2" ParentId="9628" CreationDate="2015-05-07T04:06:23.610" Score="10" Body="&lt;p&gt;Most likely wherever Apache/PHP is configured to save session files doesn't exist or isn't writable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've got the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot;&gt;overridePhpSessionLocation&lt;/a&gt; config setting set to &lt;code&gt;true&lt;/code&gt;, then that will be in &lt;code&gt;craft/storage/runtime/sessions&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-07T04:06:23.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9630" PostTypeId="1" CreationDate="2015-05-07T04:22:56.220" Score="1" ViewCount="251" Body="&lt;p&gt;How anyone have any server or database optimization recommendations for running Craft CMS on MediaTemple's GridServer (gs)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it's a shared server, I know there's not as much as you could do with a VPS or dedicated server, but I hope there is something beyond the default settings we can do to keep the site running smoothly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3554" LastEditorUserId="344" LastEditDate="2015-05-28T12:28:27.467" LastActivityDate="2015-05-28T12:28:27.467" Title="Optimization on GridServer (gs)" Tags="&lt;server&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9632" PostTypeId="1" CreationDate="2015-05-07T08:55:59.957" Score="2" ViewCount="678" Body="&lt;p&gt;I have an asset field within a matrix block, for which uploads are restricted to a single folder. The upload location path is set to &lt;code&gt;{owner.section.handle}/{owner.slug}&lt;/code&gt;. Using this pattern the asset is uploaded to the correct folder on save, however it's not possible (even after the entry has been saved previously) to view and pick existing assets from this folder - it always appears empty in the asset picker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like it's related to this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4863/assets-content-fields-not-available-until-entry-is-saved&quot;&gt;Assets Content/Fields not available until entry is saved?&lt;/a&gt; but specifically to do with accessing the &lt;code&gt;{owner.section.handle}&lt;/code&gt; of the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use-case for this is that it allows a single matrix field (with asset pickers) to be shared between sections but still have the assets saved to a section-specific subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume this is a bug? If so, is there any other way to achieve this behaviour to prevent me having to duplicate the matrix field and hard-code the section in the path for each section?&lt;/p&gt;&#xA;" OwnerUserId="3629" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-05-07T08:55:59.957" Title="Asset dynamic subfolder paths referencing entry section not available until saved" Tags="&lt;assets&gt;&lt;entry&gt;&lt;field&gt;&lt;sections&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9633" PostTypeId="2" ParentId="9615" CreationDate="2015-05-07T09:12:50.163" Score="5" Body="&lt;p&gt;Short answer – no, there isn't any way to add a dropdown for template selection to Sections without modifying the core (which is never a good idea).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, its difficult to advice without a brief description on what you're attempting to build. Craft is generally perfect for flexible, modular content and layouts, and what you want to achieve is most likely very doable – but I suspect your approach may be a little misguided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;Sections&lt;/a&gt; in Craft are the basic containers for your content, and creating a whole new Section should never be part of the basic editorial workflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If the OP provides a little bit more context, I'll try update this answer with a suggested approach.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem is that you're using Singles – one of three possible Section types – as entries in a stream of content (&lt;em&gt;events&lt;/em&gt;). This is not a feasible workflow. Singles are meant as one-offs; completely unique bits of content that doesn't fit anywhere else and needs its own, unique field layout and/or template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any content that is part of a &lt;em&gt;stream&lt;/em&gt;, such as a blog post, news item or event listing should be published as &lt;em&gt;actual&lt;/em&gt; entries to either a &lt;strong&gt;Channel&lt;/strong&gt; or a &lt;strong&gt;Structure&lt;/strong&gt; Section (in your case I'd use Channels for both news and events; the latter is only appropriate if you need to nest entries or put them in a specific order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a Channel or Structure means that whatever template you specified when you created the Section will be automatically loaded for all its individual entries, and your client will also not need to re-create the field layout every time they want to publish something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Obviously, with Craft Personal edition, you're limited to only one Channel – and you specifically need two. You have two options:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upgrade to Craft Client/Pro. If you want to test it out before purchasing, see &lt;a href=&quot;http://buildwithcraft.com/help/try-craft-client-pro&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for info.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Delete the &lt;em&gt;News&lt;/em&gt; channel and create a new, generic channel called &quot;Content&quot; or the like. Create two different &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;Entry Types&lt;/a&gt; for the channel, called &quot;News&quot; and &quot;Events&quot;. This would enable you to create different field layouts for news and event entries. In your channel's entry template, you could then do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% if entry.type == 'event' %}&#xA;    {% include 'event.html' %}&#xA;{% else %}&#xA;    {% include 'news.html' %}&#xA;{% endif %}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that this solution will not really scale well at all, and the editorial workflow would also be subpar compared to having separate channels. I'd &lt;em&gt;strongly&lt;/em&gt; recommend the first approach :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I'm not familiar with ProcessWire and couldn't advice which is better for your specific project, although your site would be a &lt;em&gt;doozy&lt;/em&gt; to set up in Craft – as long as you apply its concepts and tools the way they're meant to be used. Obviously, if you're coming from ProcessWire or any other CMS (like Wordpress or ExpressionEngine) it can take a little time to adapt to a different terminology, toolset and workflow and to absorb platform best practices. I'd advise you to read through the &lt;a href=&quot;http://buildwithcraft.com/docs/introduction&quot; rel=&quot;nofollow&quot;&gt;basic docs&lt;/a&gt; (they're quite concise) for a better understanding of how Craft manages content, and to give Craft Client or Pro a test run before deciding.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-07T20:03:03.683" LastActivityDate="2015-05-07T20:03:03.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9634" PostTypeId="1" AcceptedAnswerId="9635" CreationDate="2015-05-07T09:35:47.897" Score="1" ViewCount="294" Body="&lt;p&gt;I have a site governed by a structure, including the homepage.  I have several &quot;parental&quot; landing pages with research areas (Atlantic, Pacific, Midwest etc ) intended to be the gateway to  the children entries in that area. (Boston, New York, DC etc).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have categories (without urls) corresponding to the landing pages (Atlantic, Pacific, Midwest etc ) and would like to pull teasers from each child entry onto the landing page, so that the Atlantic landing page has teasers from the Atlantic children's entries pulled in via the category field, the Pacific landing page has teasers from the Pacific children's entries via category etc...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would like to do this in one template, rather than using multiple entry types.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can get entries by an array of sections&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section([atlantic, pacific, midwest]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My mind cannot bend around how I could start at&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('pages') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and trek on from there to grab both the appropriate landing page and the categories that go with it dynamically.  Can I keep using arrays in both the page id's and the categories?  How would can I make a template know to grab the Atlantic and fill it with teasers from the Atlantic category?  Is it even possible?  &lt;/p&gt;&#xA;" OwnerUserId="2310" LastEditorUserId="125" LastEditDate="2015-05-07T09:59:40.040" LastActivityDate="2015-05-07T09:59:40.040" Title="Getting Entry By Category for Landing Pages In A Structure" Tags="&lt;entries&gt;&lt;categories&gt;&lt;structure&gt;&lt;array&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9635" PostTypeId="2" ParentId="9634" CreationDate="2015-05-07T09:48:23.633" Score="1" Body="&lt;p&gt;You need to find a way to get the right &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;category model&lt;/a&gt; to be able to receive all entries related to it.&#xA;As you didn't set up our categories to have their own URL, you could find it using the relevant slug in your URL.&#xA;Assuming that maches your categories slugs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getLastSegment() %}&#xA;{% set category = craft.categories.slug(categorySlug).first() %}&#xA;&#xA;{% if category %}&#xA;&#xA;    {% set entries = craft.entries.relatedTo(category).limit(12) %}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another, probably more elegant way would be to access a token set via a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'regions/[SLUG]' =&amp;gt; 'regions/_index'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would now be able to access that token from a variable &quot;slug&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(slug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-07T09:57:48.207" LastActivityDate="2015-05-07T09:57:48.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9636" PostTypeId="1" AcceptedAnswerId="9649" CreationDate="2015-05-07T10:59:58.090" Score="2" ViewCount="128" Body="&lt;p&gt;So I'm setting up a system with 3 tiers of users.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Admin&lt;/li&gt;&#xA;&lt;li&gt;Officers&lt;/li&gt;&#xA;&lt;li&gt;Managers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want Officers to be able to administer managers. Any of you know if this is doable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say an Officer could login (&lt;strong&gt;not in the CP&lt;/strong&gt;) and view a list of its managers and change let's say, their password...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any light on this would be great :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-05-07T20:14:19.210" Title="Can a user edit another user" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9637" PostTypeId="1" AcceptedAnswerId="9644" CreationDate="2015-05-07T11:48:42.860" Score="1" ViewCount="128" Body="&lt;p&gt;I'm using the dukt.net Twitter plugin, in a Matrix field. It works fine locally, but on our dev server, something odd is happening, when I enter a Tweet url, like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://twitter.com/POLITICOEurope/status/596249628892364800&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It fetches the tweet from the API correctly, but then displays it in the CP and in the templates as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://twitter.com/POLITICOEurope/status/5.96249628892E+17&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it converts it to a float. However, in the &quot;fields_tweets_tweet&quot; field in the database, it lists the correct long ID: 596249628892364800&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the odd thing is that it's happening on the dev server, but not locally. Anyone an idea where to start?&lt;/p&gt;&#xA;" OwnerUserId="185" LastEditorUserId="125" LastEditDate="2015-05-07T13:03:38.603" LastActivityDate="2015-05-08T15:18:00.967" Title="Dukt Twitter plugin float issue" Tags="&lt;plugins&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9638" PostTypeId="1" CreationDate="2015-05-07T11:58:03.323" Score="1" ViewCount="1804" Body="&lt;p&gt;Probably something really silly I'm missing here but I'm trying to test out Craft with a look at purchasing but can't even get to a first step in installing it :-(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell the server requirements are all covered. All files have been uploaded to FTP although I have my &lt;strong&gt;domain.com&lt;/strong&gt; and then a &lt;strong&gt;craftcms&lt;/strong&gt; folder then within that folder I have the &lt;strong&gt;craft&lt;/strong&gt; and &lt;strong&gt;public&lt;/strong&gt; folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have had to do things like this as can't place craft as the main folder on the server due to the server already having a site on it although I'm fairly certain I should be able to run the craft site in this way shouldn't I? From a sub-folder I mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway when I go to &lt;strong&gt;domain.com/craftcms/admin&lt;/strong&gt; I get an Apache 500 Internal Server Error and not really much more information. I have also tried going to the alternative admin URLs to see if one of those works and they all come up with the same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering if I'm missing something obvious here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best wishes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-07T11:58:03.323" Title="500 Internal Server Error on trying to install" Tags="&lt;install&gt;&lt;error&gt;&lt;apache&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9639" PostTypeId="2" ParentId="9602" CreationDate="2015-05-07T12:33:45.687" Score="1" Body="&lt;p&gt;I've created a custom Element Type, and used the &lt;code&gt;getContentTableForElementsQuery()&lt;/code&gt; to set where the element's content is stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, the default BaseElement class defines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getContentTableForElementsQuery(ElementCriteriaModel $criteria)&#xA;{&#xA;    return 'content'; // table craft_content&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, you would simply provide the table you want to store your data in, rather than &lt;code&gt;content&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when going to save the field(s), you need to set the contentTable like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$originalContentTable = craft()-&amp;gt;content-&amp;gt;contentTable;&#xA;&#xA;craft()-&amp;gt;content-&amp;gt;contentTable = 'mycontenttable';&#xA;&#xA;// Save your fields&#xA;&#xA;craft()-&amp;gt;content-&amp;gt;contentTable = $originalContentTable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FYI - I learnt this from looking at how SproutForms works, which uses its own content table for fields.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-05-07T13:54:34.510" LastActivityDate="2015-05-07T13:54:34.510" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9640" PostTypeId="1" AcceptedAnswerId="9641" CreationDate="2015-05-07T12:41:34.840" Score="1" ViewCount="1231" Body="&lt;p&gt;My entry has a custom field to set a social image for Facebook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the entry template, I'm defining the output like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set social_image = &quot;&quot; %}&#xA;  {% for image in entry.metaImage %}&#xA;    {% set social_image = image.getUrl() %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the layout I have this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;{% if social_image is defined %}{{ social_image }}{% endif %}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this works great. However, when that field hasn't been, I want to fallback to a custom field that will always have an image set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to change the layout to &lt;code&gt;{% if social_image is not null %}{{ social_image }}{% else %}{{ social_image_fallback }}{% endif %}&lt;/code&gt; setting social_image_fallback within the entry template of course, but that outputs a null value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I originally had &lt;code&gt;{% if social_image is defined %}&lt;/code&gt; but of course if defined would always evaluate to true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm missing something simple here right?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-05-07T12:52:12.563" Title="Unexpected output from Twig set variable" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;variable&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9641" PostTypeId="2" ParentId="9640" CreationDate="2015-05-07T12:46:57.227" Score="2" Body="&lt;p&gt;Try &lt;code&gt;{{ social_image|default(social_image_fallback) }}&lt;/code&gt;. I've had good results using Twig's default filter over testing variables, even with multiple fallbacks. (&lt;a href=&quot;https://craftcms.stackexchange.com/a/8983/157&quot;&gt;like this&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-07T12:46:57.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9642" PostTypeId="2" ParentId="9640" CreationDate="2015-05-07T12:48:27.107" Score="1" Body="&lt;p&gt;I'd use the &lt;code&gt;length&lt;/code&gt; filter to see if there is an image and then access it using the &lt;code&gt;first()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.metaImage|length %}&#xA;    {% set social_image = entry.metaImage.first().getUrl() %}&#xA;{% else %}&#xA;    {% set social_image = '/assets/img/social_image.jpg' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you prefer ternary syntax it would be like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set social_image = entry.metaImage|length ? entry.metaImage.first().getUrl() : '/assets/img/social_image.jpg' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using it like so you separate logic and output in your template.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-07T12:48:27.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9643" PostTypeId="2" ParentId="9640" CreationDate="2015-05-07T12:52:12.563" Score="1" Body="&lt;p&gt;If you use &lt;code&gt;defined&lt;/code&gt; it'll always be true because you at the minimum are defining an empty string. &lt;code&gt;not null&lt;/code&gt; won't work because a null is different from a false condition (which an empty string matches).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@mike-pepper and @carlcs both have good suggestions for getting what you need. My personally suggestion would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set social_image = &quot;&quot; %}&#xA;{% for image in entry.metaImage %}&#xA;    {% set social_image = image.getUrl() %}&#xA;{% else %}&#xA;    {% set social_image = fallbackField.first().getUrl() %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way you can just output &lt;code&gt;social_image&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-05-07T12:52:12.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9644" PostTypeId="2" ParentId="9637" CreationDate="2015-05-07T12:58:56.853" Score="2" Body="&lt;p&gt;Pretty sure PHP is interpreting that string as an &lt;code&gt;int&lt;/code&gt;. Doing a &lt;code&gt;var_dump&lt;/code&gt; on the variable shows &lt;code&gt;int(596249628892364800)&lt;/code&gt;. That's pretty much PHP's type casting at work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you could cast the variable as a string, there's actually an unused variable called &lt;code&gt;id_str&lt;/code&gt; which is ideal to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit the file &lt;code&gt;twitter\fieldtypes\Twitter_TweetFieldType.php&lt;/code&gt;. Replace line 48 from: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = 'https://twitter.com/'.$tweet['user']['screen_name'].'/status/'.$tweet['id'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = 'https://twitter.com/'.$tweet['user']['screen_name'].'/status/'.$tweet['id_str'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-05-08T15:18:00.967" LastActivityDate="2015-05-08T15:18:00.967" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9645" PostTypeId="1" AcceptedAnswerId="9650" CreationDate="2015-05-07T16:43:28.967" Score="1" ViewCount="302" Body="&lt;p&gt;Here are my channels and fields I need to get to work together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blog Channel (blog)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Matrix Field (bodyMatrix)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Gallery Block (gallery)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Gallery Field (galleryInclude [entries])&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Gallery Channel (gallery)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Matrix Field (galleryMatrix)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Slide Block (slide)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Slide Image Field (slideImage [assets])&lt;/li&gt;&#xA;&lt;li&gt;Slide Text Field (slideText)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In my Blog Channel, I have a Gallery block inside a Body Matrix field. This Gallery block contains just an Entries relationship field that is pulling from my Gallery channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the Gallery channel is a Matrix field as well, with a single block for slideImage and slideText.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This being my second day working with Craft, but years of experience with EE, how do I pull in the content from that Gallery entry and it's Gallery Matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been able to pull in that Gallery title, but can't at all get the Gallery Matrix to output anything.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for gallery in block.galleryInclude %}&#xA;  {{ gallery.title }}&#xA;&#xA;  &amp;lt;figure&amp;gt;&#xA;    {% Gallery Matrix %}&#xA;      &amp;lt;div&amp;gt;&amp;lt;img src={{gallery image url}}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% end Gallery Matrix %}&#xA;  &amp;lt;/figure&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not even sure when I use 'gallery' above, if that's the right variable to use, but it works.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2015-05-07T16:50:31.937" LastActivityDate="2015-05-07T20:28:42.573" Title="Getting Matrix content from within a relationship field" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9646" PostTypeId="1" AcceptedAnswerId="9647" CreationDate="2015-05-07T16:55:11.253" Score="0" ViewCount="121" Body="&lt;p&gt;Hey guys I was wondering if anyone could help me...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to link from a readmore button in a single( it's like a services page) to pages in a structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of having a top level services page in the structure, having it as a single and all the services together in a structure and linking to them from the single is this possible? if so, how can i do it?&lt;/p&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2015-05-07T17:21:22.483" Title="Click read more on a single and it takes you to items in a structure" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9647" PostTypeId="2" ParentId="9646" CreationDate="2015-05-07T17:13:40.870" Score="1" Body="&lt;p&gt;You can access any information from just about anywhere in craft. In fact, the only thing that distinguishes one 'page' from another is that craft conveniently populates a predefined 'entry' variable populated with the 'current' entry (EntryModel) using the template that you defined in your section settings. But you can choose to use that 'entry', ignore it, redefine it, or grab entirely different content altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand your requirements, it sounds like you are trying to create an 'index' page of sorts in your single, which links to entries in your structure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title}}&amp;lt;/h1&amp;gt;&#xA;{% set entries = craft.entries.sections('myStructureHandle').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.description }}&amp;lt;br&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Read more&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-07T17:21:22.483" LastActivityDate="2015-05-07T17:21:22.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9648" PostTypeId="1" AcceptedAnswerId="9651" CreationDate="2015-05-07T19:44:01.500" Score="4" ViewCount="2422" Body="&lt;p&gt;Guess this is a stupid question, but I'm trying to sort a table based on which column the user wants to sort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for row in entry.tablefield|sort %}&lt;/code&gt; (No effect)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for row in entry.tablefield.order('firstName') %}&lt;/code&gt; (Error message)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone who know if this is possible or know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="3634" LastEditorUserId="125" LastEditDate="2015-05-07T21:04:40.730" LastActivityDate="2015-05-07T21:04:40.730" Title="Want to sort a table field from Twig" Tags="&lt;templating&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9649" PostTypeId="2" ParentId="9636" CreationDate="2015-05-07T20:14:19.210" Score="0" Body="&lt;p&gt;You can do what you're looking for with some caveats from the front-end of a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If officers have the &lt;code&gt;editUsers&lt;/code&gt; permissions, then they can edit most other things about other users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two exceptions are their email address, which requires the &lt;code&gt;changeUserEmails&lt;/code&gt; permission and the password, which they can't change at all.  The only person that can change the password is the user it belongs to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-07T20:14:19.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9650" PostTypeId="2" ParentId="9645" CreationDate="2015-05-07T20:28:42.573" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow&quot;&gt;Twig&lt;/a&gt; is quite different from the EE parser – much more in line with how PHP is interpreted (Twig actually compiles to PHP before rendering).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the use of &lt;code&gt;gallery&lt;/code&gt; in your &lt;code&gt;for&lt;/code&gt; loop is arbitrary – its just the name you pick for the variable containing the currently iterated item, and its completely up to you. So this would work just as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for galleryEntry in block.galleryInclude %}&#xA;    {{ galleryEntry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second, there are a couple of issues with your code. For one, you'll need to use another &lt;code&gt;for&lt;/code&gt; loop to access the slides inside the &lt;code&gt;galleryMatrix&lt;/code&gt; field. Note that you can use &quot;block&quot; as the variable name here as well (unless you need to access any of the outer &lt;code&gt;block&lt;/code&gt; variable's properties), but let's call it &quot;slide&quot; for clarity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for slide in gallery.galleryMatrix %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if your &lt;code&gt;galleryMatrix&lt;/code&gt; field contains multiple block types and you're only interested in the &quot;slide&quot; block type, you can for test the &lt;code&gt;slide.type&lt;/code&gt; property inside the loop, or use the &lt;code&gt;type&lt;/code&gt; method to filter the &lt;code&gt;galleryMatrix&lt;/code&gt; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for slide in gallery.galleryMatrix.type('slide') %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore – this is a common gotcha for new Craft users – &lt;em&gt;even if there's only 1 asset&lt;/em&gt;, you'll always need to loop through any Asset field; you can't just put &lt;code&gt;assetField.getUrl()&lt;/code&gt;. So, you'll need another loop to pull your slide image(s) inside the galleryMatrix loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in slide.slideImage %}&#xA;    &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Sidenote; when there's only a single asset you could also do the following, but as you'll need an &lt;code&gt;if&lt;/code&gt; statement the amount of code won't be any less:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slideImage = slide.slideImage.first() %}&#xA;{% if slideImage %}&#xA;    &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Putting it together, here's what your full code should look like (not tested, but should work based on the info you gave):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for gallery in block.galleryInclude %}&#xA;    {{ gallery.title }}&#xA;&#xA;    &amp;lt;figure&amp;gt;&#xA;        {% for slide in gallery.galleryMatrix %}&#xA;            {% for image in slide.slideImage %}&#xA;                &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;   &amp;lt;/figure&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-05-07T20:28:42.573" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9651" PostTypeId="2" ParentId="9648" CreationDate="2015-05-07T20:36:07.710" Score="5" Body="&lt;p&gt;You can't do that with core Craft functionality or Twig filters, but as Mats already suggested in the comments, you can do it with a plugin like &lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;&quot;Super Sort&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template code to sort the array returned from the table field with that plugin would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.tablefield|supersort('sortAs', '{{ object.firstName }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-07T21:03:37.157" LastActivityDate="2015-05-07T21:03:37.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9652" PostTypeId="2" ParentId="9618" CreationDate="2015-05-07T21:04:32.930" Score="2" Body="&lt;p&gt;I'd say; use twig functions/filters when the data you want to operate on comes from your template, plugin variables when you need to operate on data from your plugin/another source. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, to my knowledge, do the exact same things with both. But the purpose of twig filters is to manipulate data in your templates. If the filter relies on tapping into Craft to work, I'd rethink using one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that's just my opinion, I don't think there's been a lot of discussion about this in the community. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-05-07T21:04:32.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9653" PostTypeId="2" ParentId="9611" CreationDate="2015-05-07T21:56:20.763" Score="2" Body="&lt;p&gt;I have this macro in my _macros/_utils.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro monthNameFromNumber(monthNumber) %}&#xA;  {# monthNumber will be 00-12. we use that to construct a date string,&#xA;     convert it to date and then pick the month name out of that #}&#xA;  {{ date('2014-' ~ monthNumber ~ '-01') | date('F') }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import _macros/utils as m_utils %}&#xA;&#xA;{% for month in range(startMonth, endMonth, 1) %}&#xA;  {{ m_utils.monthNameFromNumber(month) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-05-07T21:56:20.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9654" PostTypeId="2" ParentId="9625" CreationDate="2015-05-07T22:21:23.923" Score="4" Body="&lt;p&gt;It depends on the field type. If it is an entry (or asset or user), then &lt;code&gt;entry.myentry&lt;/code&gt; will be an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which even if there are no elements will always be 'truthy'. In that case, you need &lt;code&gt;entry.myentry|length&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, depending on what you want to do about the field being &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; you may want one of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;entry.myentry&lt;/code&gt; : true/false determined as in php. &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/if.html&quot; rel=&quot;nofollow&quot;&gt;twig if documentation explains this.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;entry.myentry is not empty&lt;/code&gt; - false for &lt;code&gt;null&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt;, empty array or empty string. (&lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/empty.html&quot; rel=&quot;nofollow&quot;&gt;empty&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;entry.myentry is not null&lt;/code&gt; - false for &lt;code&gt;null&lt;/code&gt;. (&lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/null.html&quot; rel=&quot;nofollow&quot;&gt;null&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;entry.myentry|length&lt;/code&gt; - this will be &lt;code&gt;0&lt;/code&gt; if entry.myentry is &lt;code&gt;false&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; if entry.myentry is &lt;code&gt;0&lt;/code&gt;. (&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/length.html&quot; rel=&quot;nofollow&quot;&gt;length&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I personally would &lt;code&gt;{{ dump(entry.myentry) }}&lt;/code&gt; for one of your &quot;empty&quot; entries to get more clarity on which of these would be best.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-05-07T22:21:23.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9655" PostTypeId="1" AcceptedAnswerId="9661" CreationDate="2015-05-08T00:48:03.287" Score="0" ViewCount="346" Body="&lt;p&gt;I am trying to update the value of an &lt;code&gt;Entries&lt;/code&gt; field on an &lt;code&gt;EntryModel&lt;/code&gt;, however I am having a lot of trouble getting it to update correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried allocating both an entire &lt;code&gt;EntryModel&lt;/code&gt; and its &lt;code&gt;id&lt;/code&gt; but neither seems to set the value, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$comment = new EntryModel();&#xA;$comment-&amp;gt;sectionId = $commentSectionId;&#xA;&#xA;$comment-&amp;gt;setContent(array(&#xA;    'createdBy' =&amp;gt; $user // or&#xA;    'createdBy' =&amp;gt; $user-&amp;gt;id&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($comment);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;$user&lt;/code&gt; is a valid &lt;code&gt;EntryModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The comment saves fine, the &lt;code&gt;createdBy&lt;/code&gt; field just has no value. I guess I am using the wrong data from &lt;code&gt;$user&lt;/code&gt; but I have having a very hard time finding any thorough documentation around setting different kinds of EntryModel data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the entire bit of code I have, if it helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Bugr_CommentService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    public function post(EntryModel $user, EntryModel $ticket, $body)&#xA;    {&#xA;        $comment = new EntryModel();&#xA;        $comment-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('comments')-&amp;gt;id;&#xA;&#xA;        $comment-&amp;gt;setContent(array(&#xA;            'createdBy' =&amp;gt; $user,&#xA;            'ticket' =&amp;gt; $ticket,&#xA;            'body' =&amp;gt; $body&#xA;        ));&#xA;&#xA;        return craft()-&amp;gt;entries-&amp;gt;saveEntry($comment);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="938" LastActivityDate="2015-05-08T16:53:20.943" Title="Set EntryModel data on an element" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9656" PostTypeId="1" CreationDate="2015-05-08T06:10:53.987" Score="2" ViewCount="873" Body="&lt;p&gt;Have tried getting Craft working on Google App Engine (GAE) using the GAE SDK and after defining CRAFT_STORAGE_PATH first up in the index.php, setting it to a Google Cloud Storage path eg. gs://craft-gae-storage/ I found I had to uncomment the workings of craft_ensureFolderIsReadable function in bootstrap.php so it didn't fail on the folder checks, but then it still dies with the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fatal error: Class 'Craft\PhpMessageSource' not found in /Users/.../Craft-gae-HappyLager/craft/app/framework/YiiBase.php on line 213&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the HappyLager demo combined with the Yii GAE codebase from &lt;a href=&quot;https://github.com/poul-kg/yii-app-engine&quot; rel=&quot;nofollow&quot;&gt;https://github.com/poul-kg/yii-app-engine&lt;/a&gt; with a slightly modified base setup to try to get craft working:&#xA;&lt;a href=&quot;https://github.com/moldedjelly/craft-gae&quot; rel=&quot;nofollow&quot;&gt;https://github.com/moldedjelly/craft-gae&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3637" LastEditorUserId="3637" LastEditDate="2015-05-14T07:11:42.390" LastActivityDate="2015-06-10T18:11:35.720" Title="Craft hosted on Google App Engine - failing to load Craft classes?" Tags="&lt;filecache&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9657" PostTypeId="2" ParentId="9618" CreationDate="2015-05-08T09:39:54.600" Score="4" Body="&lt;p&gt;The following answer is all personal opinion of course, but here's a key quote from the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Many of your template variable methods will likely be simple wrappers for your service API methods.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you look at &lt;a href=&quot;https://buildwithcraft.com/classreference#craft.app.variables&quot; rel=&quot;nofollow&quot;&gt;Craft's built-in Variables&lt;/a&gt;, they're all about &lt;em&gt;exposing data&lt;/em&gt;. Personally, I like to think of Variables as &lt;em&gt;template APIs&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig Filters, on the other hand, is all about &lt;em&gt;modifying&lt;/em&gt; data (e.g. capitalizing strings, rounding numbers, formatting dates, sorting arrays etc). If you compare Craft's built-in Variables to its &lt;a href=&quot;https://buildwithcraft.com/classreference/etc/templating/twigextensions/CraftTwigExtension&quot; rel=&quot;nofollow&quot;&gt;Filters&lt;/a&gt;, I think the distinction between the two starts to become fairly clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To exemplify:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bad use of Variables:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortedEntries = craft.myPlugin.sortByAwesomeLevel( entries ) %}&#xA;{{ craft.myPlugin.makeEntryTitleAwesome( entry.title ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The above template code use&lt;/em&gt; Variable &lt;em&gt;methods to modify data already present in the template. It works, but it looks pretty convoluted and doesn't really make sense, neither from a&lt;/em&gt; Twig &lt;em&gt;nor&lt;/em&gt; Craft &lt;em&gt;point of view. Here, using&lt;/em&gt; Filters &lt;em&gt;would be much more appropriate:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortedEntries = entries | sortBy( 'awesomeLevel' ) %}&#xA;{{ entry.title | makeAwesome }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Good use of Variables:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set awesomeEntries = craft.myPlugin.getAwesomeEntries %}&#xA;{% set sortedAwesomeEntries = craft.myPlugin.getAwesomeEntries( { 'sortBy' : 'awesomeLevel' } ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Here, MyPlugin exposes a &quot;template API&quot; method called &lt;code&gt;getAwesomeEntries&lt;/code&gt;. The only thing it does, is to pull entries that are awesome, optionally taking an arguments object for sorting or the like. Obviously, this would not be feasible to implement as a Filter:&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set awesomeEntries = entries | getAwesomeEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In short – if you need to &lt;em&gt;expose&lt;/em&gt; data, use a Variable. If you need to &lt;em&gt;modify&lt;/em&gt; data, use Filters.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-05-08T09:39:54.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9658" PostTypeId="2" ParentId="9602" CreationDate="2015-05-08T14:45:08.877" Score="3" Body="&lt;p&gt;Okie doke. After bashing my head against the wall &lt;strong&gt;&lt;em&gt;THIS&lt;/em&gt;&lt;/strong&gt; is how you create your very own super deluxe content table. Allow me to explain...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;strong&gt;&lt;em&gt;element class&lt;/em&gt;&lt;/strong&gt; you will need to specify the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function hasContent()&#xA;  {&#xA;    return true; // You definitely will need this&#xA;  }&#xA;&#xA;  public function hasTitles()&#xA;  {&#xA;    return true; // This is optional&#xA;  }&#xA;&#xA;  public function isLocalized()&#xA;  {&#xA;&#xA;    return false; // This is optional&#xA;&#xA;  }&#xA;&#xA;  public function getContentTableForElementsQuery(ElementCriteriaModel $criteria){&#xA;&#xA;    return &quot;custom_content_table_name&quot;; // You definitely will need this&#xA;&#xA;  }&#xA;&#xA;  public function getFieldsForElementsQuery(ElementCriteriaModel $criteria)&#xA;  {&#xA;&#xA;      // NOTE: I do not have any custom fields set to this table. If you have custom fields you should return them here so that they are included in the criteria query. If you also do not have custom fields just do what I'm doing here and return an empty array. &#xA;&#xA;       $fields = array();&#xA;&#xA;       return $fields;&#xA;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;strong&gt;&lt;em&gt;element's model class&lt;/em&gt;&lt;/strong&gt; you'll need to do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function getContentTable(){&#xA;&#xA;    return &quot;custom_content_table_name&quot;; // you will need this&#xA;&#xA;  }&#xA;&#xA;  public function getFieldContext()&#xA;  {&#xA;&#xA;    return 'custom_content_table_name'; // I have NO idea what this is and the Craft documentation is not clear about it.&#xA;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, your record for the content table will have to make the following columns:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;elementId&lt;/li&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;locale&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's basically it. If you run into any errors make sure you're not including extra non-existent fields in the criteria queries when querying content. Check the Craft logs to see exactly what's happening if you encounter any problems.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-05-08T14:45:08.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9659" PostTypeId="1" AcceptedAnswerId="9666" CreationDate="2015-05-08T15:29:41.553" Score="1" ViewCount="684" Body="&lt;p&gt;Banging my head on this one and have not been able to come up with a solution to this. I'm wanting to create a default template for all single entries that checks for all of the fields I have created if they exist and the position in that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This template would have all code for all possible field types. So far this doesn't work the way I was hoping it would as it renders the page based on the order of the code in the template. So if a client adds a new field to a section it doesn't matter what order they put the field in the list of fields, in the end it is determined by where the code to render that field is in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have developed with wordpress, acf, and visual page builders where you can drag drop elements into different positions which are just shortcodes but the page ends up rendering based on the position of the elements &quot;shortcodes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this at all possible? Here is some examples of some code in said template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Testimonials Block --&amp;gt;&#xA;{% if entry.testimonials|length %}&#xA;&amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;        {% for block in entry.testimonials %}&#xA;            {% if block.type == &quot;testimonial&quot; %}&#xA;                {% set image = block.image.first() %}&#xA;                &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                    &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;                        &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/footer&amp;gt;&#xA;                    &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/blockquote&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %} &#xA;        &amp;lt;div class=&quot;list-inline&quot;&amp;gt;&#xA;        {% for block in entry.testimonials %}&#xA;            {% if block.type == &quot;testimonial&quot; %}&#xA;                {% set image = block.image.first() %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %} &#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;!-- Impact Statement --&amp;gt;&#xA;{% if entry.impactStatement|length %}&#xA;    {% for block in entry.impactStatement %}&#xA;        {% if block.type == &quot;impactStatement&quot; %}&#xA;            &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;text-center impact-highlight&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{block.heading}}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %} &#xA;{% endif %}&#xA;&#xA;&amp;lt;!-- Large Headline Blocks --&amp;gt;&#xA;{% if entry.largeHeadline|length %}&#xA;&amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for block in entry.largeHeadline %}&#xA;            {% if block.type == &quot;headline&quot; %}&#xA;                {% set image = block.image.first() %}&#xA;                    &amp;lt;div class=&quot;col-sm-6 col-md-10 col-md-push-1 add-top&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;col-sm-6 hidden-xs {{block.imagePosition}}&quot;&amp;gt;&#xA;                                &amp;lt;!-- Img Logo --&amp;gt;&#xA;                                &amp;lt;img src=&quot;{{image.url}}&quot;/&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;                                &amp;lt;h3 class=&quot;remove-top&quot;&amp;gt;{{block.heading}}&amp;lt;/h3&amp;gt;&#xA;                                &amp;lt;small&amp;gt;{{block.paragraph}}&amp;lt;/small&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;    {% endfor %} &#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;hr class=&quot;add-top&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see this is just three field types but I have a lot. But for this example the template has them in this order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Testimonials Matrix Field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impact Statement&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Large Headline&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I move impact statement in the section above testimonials, that has no relation on where that impact statement gets rendered in the entry...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to do ifelse thinking it would loop through the template outputting the blocks in the order they are in the section for that single if they exist. But this just outputs the testimonials block and stops haha.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.testimonials|length %}&#xA;//Block Code&#xA;{% elseif entry.testimonials|length %}&#xA;//Block Code&#xA;{% elseif entry.testimonials|length %}&#xA;//Block Code&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought one way to solve it would just be to have one matrix field with all of the possible fields as a block with each field in that block, but then I think I run into issues wrapping each element in a container as for each block I end up outputting a container so they end up nested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any solutions or possible tips would be great. Hope this makes sense.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-05-09T10:46:17.127" Title="Solution to default template with all possible fields and determine position" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;config&gt;&lt;field&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9660" PostTypeId="2" ParentId="9659" CreationDate="2015-05-08T16:40:54.200" Score="1" Body="&lt;p&gt;You could possibly loop through the field layout for that section, and then output the fields in the order that they are defined. In this example, I'm using macros, but you could just as easily place the code within the switch statement directly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro testimonials(matrix) %}&#xA;    {% import _self as self %}&#xA;&#xA;    &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;&#xA;                {% for block in matrix %}&#xA;                    {% if block.type == &quot;testimonial&quot; %}&#xA;&#xA;                        &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                            &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;                                &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{ block.sourceTitle }}&amp;lt;/span&amp;gt;&#xA;                            &amp;lt;/footer&amp;gt;&#xA;                            &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{ block.lead }}”&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;/blockquote&amp;gt;&#xA;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;&#xA;                &amp;lt;div class=&quot;list-inline&quot;&amp;gt;&#xA;&#xA;                    {% for block in matrix %}&#xA;                        {% if block.type == &quot;testimonial&quot; %}&#xA;                            {% set image = block.image.first() %}&#xA;                            &amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        {% endif %}&#xA;                    {% endfor %}&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&#xA;{% macro impactStatment(matrix) %}&#xA;    {% import _self as self %}&#xA;    {# format/output matrix data #}&#xA;{% endmacro %}&#xA;&#xA;{% macro largeHeadline(matrix) %}&#xA;    {% import _self as self %}&#xA;    {# format/output matrix data #}&#xA;{% endmacro %}&#xA;&#xA;&#xA;{% for tab in entry.getFieldLayout.getTabs %}&#xA;&#xA;    {% for field in tab.getFields %}&#xA;&#xA;        {% switch field.getField.handle %}&#xA;&#xA;            {% case 'testimonials' %}&#xA;                {{ macros.testimonials(entry.testimonials) }}&#xA;&#xA;            {% case 'impactStatement' %}&#xA;                {{ macros.impactStatement(entry.impactStatement) }}&#xA;&#xA;            {% case 'largeHeadline' %}&#xA;                {{ macros.largeHeadline(entry.largeHeadline) }}&#xA;&#xA;        {% endswitch %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would obviously need to process and format the output (i.e. loop through the matrix, add html formatting, etc.)&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-08T18:20:29.523" LastActivityDate="2015-05-08T18:20:29.523" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9661" PostTypeId="2" ParentId="9655" CreationDate="2015-05-08T16:53:20.943" Score="1" Body="&lt;p&gt;To assign a related Element (i.e. related User, Category, Entry, Tag, Asset) the value should be set to an array of element ids (even if there is only one element).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function post(UserModel $user, EntryModel $ticket, $body)&#xA;{&#xA;    $comment = new EntryModel();&#xA;    $comment-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('comments')-&amp;gt;id;&#xA;&#xA;    $comment-&amp;gt;setContent(array(&#xA;        'createdBy' =&amp;gt; array($user-&amp;gt;id),&#xA;        'ticket'    =&amp;gt; array($ticket-&amp;gt;id),&#xA;        'body'      =&amp;gt; $body&#xA;    ));&#xA;&#xA;    return craft()-&amp;gt;entries-&amp;gt;saveEntry($comment);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-05-08T16:53:20.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9662" PostTypeId="1" CreationDate="2015-05-08T18:02:04.787" Score="1" ViewCount="668" Body="&lt;p&gt;I'm getting started with the Google Maps plugin. I have experience with the EE version but not understanding some of the Craft version. I'm trying to output a set of markers from entries. Currently nothing outputs at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imported all the addresses and then added a GoogleMap field to the entries. When I check the entries it all looks correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    id: 'map', &#xA;    width: '950px', &#xA;    height: '500px',&#xA;} %}&#xA;&#xA;{{ craft.googleMaps.map(options) }}&#xA;{% for entry in craft.entries.section('maps').limit(10) %}&#xA;&#xA;    {{ craft.googleMaps.data('map', entry.mapData) }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried this for the markers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('maps').limit(100).find() %}&#xA;    &amp;lt;!-- {{ entry.title }} --&amp;gt;&#xA;    {% set marker = {&#xA;        address: '{{ entry.mapData }}',&#xA;        content: '{{ entry.title }}',&#xA;        clustering: true&#xA;    } %}&#xA;    {{ craft.googleMaps.marker('map', marker) }}&#xA;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-05-09T00:42:54.190" Title="Google Map setup for markers" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9663" PostTypeId="2" ParentId="9662" CreationDate="2015-05-08T18:50:47.387" Score="1" Body="&lt;p&gt;Your first example essentially looks correct — and I don't know if it makes a difference, but the syntax that I have used in the past looks something like this, where I output the map after setting the data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    id: 'map', &#xA;    width: '950px', &#xA;    height: '500px',&#xA;} %}&#xA;&#xA;{% set map = craft.googleMaps.map(options) %}&#xA;&#xA;{% for entry in craft.entries.section('maps').limit(10) %}&#xA;    {{ craft.googleMaps.data('map', entry.mapData) }}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&quot;map&quot;&amp;gt;&#xA;    {{ map }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-05-08T18:50:47.387" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9664" PostTypeId="2" ParentId="9662" CreationDate="2015-05-09T00:42:54.190" Score="1" Body="&lt;p&gt;Thanks to Douglas I got code that works. Instead of trying to use a map field per entry I just need to output the address and have one map instance plot all the markers. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    id: 'map', &#xA;    width: '950px', &#xA;    height: '500px',&#xA;    clustering: true,&#xA;} %}&#xA;&#xA;{% set map = craft.googleMaps.map(options) %}&#xA;&#xA;{% for entry in craft.entries.section('maps').order('title asc').limit(250) %}&#xA;    {% set marker = {&#xA;       address: entry.address ~ ', ' ~entry.city ~ ', ' ~ entry.state ~ ' ' ~ entry.zip, &#xA;       content: entry.title&#xA;    } %}&#xA;    {{ craft.googleMaps.marker('map', marker) }}&#xA;{% endfor %}&#xA;&#xA;{{ map }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-05-09T00:42:54.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9665" PostTypeId="1" AcceptedAnswerId="9676" CreationDate="2015-05-09T06:55:39.383" Score="0" ViewCount="490" Body="&lt;p&gt;I have a listing of entries at /events that loads events/index&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a custom route setup to be able to list 'live' entries by week&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'events/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;week&amp;gt;\d{2})' =&amp;gt; 'events/_weekindex',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also have a page events/past that should load past entries by loading the template events/past&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That all works exactly how it should. UNTIL i set a route for events/{slug} to use the template events/_entry where i have this defined at the top of the template to allow for entries expired or live to be shown without a 404.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('events').slug(slug).status('live', 'expired') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once that route is set, going to events/past no longer loads the events/past template it now attempts to load the events/_entry template. This obviously throws errors as there is no slug defined given /past is suppose to be a listing page not a single-entry page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if i do load an expired entry i get an error &quot;Variable &quot;slug&quot; does not exist&quot;. Do i need to specify which segment the slug is in instead of just doing (slug) have a pre set defining slug as craft.request.getSegment(2) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at the end of the day i have 2 problems here. 1 the slug is not defined based on that set. And 2 the route is causing events/past to be re-directed even though it should not be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should note i tried also setting a route for events/past to route to events/past template but that did not do anything. I should also note the other route i set for the year/week still works after setting the other route for events/_entry, that route is not effected at all and continues to function properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Posted this in the slack but I think everybody is sleeping, holding my breath people are still awake on the stackexchange. :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE::&lt;/strong&gt; I set the route for events/past BEFORE the route for events/{slug} and now the events/{slug} route does not interfere with the events/past route (that i did not even think should be necessary in the first place, nor did i know that the order mattered, is this intentional or a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt; I've resolved the issue by wrapping everything in a for loop instead of using set like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').slug(slug).status('live', 'expired') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing the set as listed above did not work. So my pages are now working but i'd still like some clarification on the routing, the set, and the slug issues i was having regardless. Although everything is working it almost feels like i'm doing a work-around rather than how it's SUPPOSE to be done.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2015-05-09T07:50:30.827" LastActivityDate="2015-05-11T10:06:17.060" Title="Routes + Expired + Slugs" Tags="&lt;entries&gt;&lt;routes&gt;&lt;routing&gt;&lt;expired&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9666" PostTypeId="2" ParentId="9659" CreationDate="2015-05-09T10:39:10.630" Score="1" Body="&lt;p&gt;If I understand you correctly, you need to be able to create unique &quot;pages&quot;, and through some sort of &quot;layout/page builder&quot; create those page's layouts on a page-by-page basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Singles sections to achieve this is the &lt;strong&gt;wrong&lt;/strong&gt; approach, in my opinion – in fact, creating/managing sections should &lt;strong&gt;never&lt;/strong&gt; be part of the regular editorial workflow, and honestly I can't really imagine a use case where such an approach would even be needed. If it exists, I'd say Craft may not be the best platform for your project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, I'd suggest creating a Structure or Channel section called &quot;Pages&quot; to hold your &quot;page&quot; entries. If you want to be able to nest your pages – or need them to be in a specific order – use a Structure, if not a Channel will suffice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For building the layout, I'd add a single Matrix field to the &quot;Pages&quot; section's entry type, called &quot;Layout&quot; or the like, containing all the possible &quot;fields&quot; or layouts (like &quot;Impact statement&quot;) as block types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one thing I'm a bit confused about is your issue about having &quot;nested containers&quot; with the above approach. I'm not seeing the problem as you could basically just use your current markup like this, and you would have the same end result as you currently have, only with the correct order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageLayout %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'impactStatement' %}&#xA;        &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                 &amp;lt;div class=&quot;text-center impact-highlight&quot;&amp;gt;&#xA;                     &amp;lt;p&amp;gt;{{block.heading}}&amp;lt;/p&amp;gt;&#xA;                 &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% case 'largeHeading' %}&#xA;        ...&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-09T10:46:17.127" LastActivityDate="2015-05-09T10:46:17.127" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9667" PostTypeId="1" AcceptedAnswerId="9669" CreationDate="2015-05-09T14:45:35.650" Score="2" ViewCount="471" Body="&lt;p&gt;I have several entry types, where I want to set a special element criteria for the &lt;code&gt;entryTypeHandleX&lt;/code&gt; entry type, and simultaneously loop through all entry types included &lt;code&gt;entryTypeHandleX&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The criteria I want to set is to skip first X entries for &lt;code&gt;entryTypeHandleX&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set ECM for all sections and entry types #}&#xA;{% set params = craft.entries.section().types() %} &#xA;&#xA;{# Set ECM for all channels and special entry type #}&#xA;{% set special = craft.entries.section().type('entryTypeHandleX').offset(X) %} &#xA;&#xA;{# Set ECM for entries. Check var 'params', Where the data are coming from!!! #}&#xA;{% set entries = params.limit(10) %}&#xA;&#xA;{% paginate entries as entriesOnPage %}&#xA;&#xA;{% for entry in entriesOnPage %}&#xA;{# entry #}&#xA;{% endfor %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-05-27T17:27:05.437" LastActivityDate="2015-05-28T10:40:48.677" Title="Include single entry type with custom parameters in the for loop within multiple entry types" Tags="&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9669" PostTypeId="2" ParentId="9667" CreationDate="2015-05-09T18:42:23.283" Score="3" Body="&lt;p&gt;One way to merge two distinct elementCriteriaModels is to perform each query separately grabbing their 'ids', then merge the 'ids', and perform a new query using the 'ids' as the only parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set first10 = craft.entries.type('entryTypeHandle').limit(10).ids() %}&#xA;{% set all = craft.entries.ids() %}&#xA;{% set first10-All = all|without(first10) %} &#xA;{% set entryIds = craft.entries.limit(10).id(first10-All).ids() %}&#xA;{% set specialIds = craft.entries.type('entryTypeHandle').offset(10).ids() %}&#xA;{% set entryIDs = entryIds|merge(specialIds) %}&#xA;&#xA;{% set entries = craft.entries.id(entryIds) %}&#xA;{% paginate entries as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;        {# entry #}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also notice a few other issues in your example, that might be causing you some problems. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I see a lot of empty query parameters which are not needed — keep in mind that empty parameters will not really affect the results. (i.e. &lt;code&gt;craft.entries.section().types()&lt;/code&gt; is really the same as just &lt;code&gt;craft.entries&lt;/code&gt;, which, in this case, will return all entries).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By modifying an existing query, you are essentially creating two queries to the database, which may not be what you're after.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section().types() %}&#xA;{% set entries = params.limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but you are essentially querying the database twice, creating two elementCriteriaModels. A better way to do this is to use a parameters array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;   section: 'mySectionHandle'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you later need to add more parameters, you can do so using the &lt;code&gt;merge&lt;/code&gt; filter, before running the query. The result is that you will only be querying the database once.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = params|merge({ limit:10 }) %}&#xA;{% set entries = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="784" LastEditorUserId="2167" LastEditDate="2015-05-28T10:40:48.677" LastActivityDate="2015-05-28T10:40:48.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9670" PostTypeId="1" AcceptedAnswerId="9671" CreationDate="2015-05-09T21:13:05.407" Score="1" ViewCount="267" Body="&lt;p&gt;I have a set of checkboxes to show content on a page. I have one instance where I'd like to show something if either checkboxes are selected. I have searched around but couldn't find how to combine multiple value. Here's what I have now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.pageOptions.contains('testimonials') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I want it to be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.pageOptions.contains('anotheroption|testimonials') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-05-09T22:00:40.910" Title="Multiple checkbox conditional" Tags="&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9671" PostTypeId="2" ParentId="9670" CreationDate="2015-05-09T22:00:40.910" Score="5" Body="&lt;p&gt;That &lt;code&gt;contains&lt;/code&gt; test just does a smple string comparison. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.pageOptions.contains('anotheroption')&#xA;     or entry.pageOptions.contains('testimonials') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-05-09T22:00:40.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9672" PostTypeId="1" AcceptedAnswerId="9674" CreationDate="2015-05-11T00:02:20.560" Score="0" ViewCount="1266" Body="&lt;p&gt;I have setup a few different navigation lists through the Menus 0.9 plugin by Familiar. Within my website, I have setup several different site sections all through the same structure called, &quot;General&quot;. They all share the same page template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to run a check to see if the page is &quot;About&quot; or is a child of &quot;About&quot; (all within the &quot;General Structure&quot;). If it is &quot;About&quot; or a child of &quot;About&quot;, I would like to server it a specific sub-nav.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code to run that subnav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav node in craft.menus.getNodes('aboutSubnav') %}&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do the lookup to see what page it is? I tried the following code, but it did not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry in craft.entries.section('general').descendantOf(42) %}&#xA; {% nav node in craft.menus.getNodes('aboutSubnav') %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3554" LastEditorUserId="344" LastEditDate="2015-05-27T14:18:42.517" LastActivityDate="2015-05-27T14:18:42.517" Title="Check Structure for Entry or Child of Entry" Tags="&lt;entries&gt;&lt;structure&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9673" PostTypeId="2" ParentId="9672" CreationDate="2015-05-11T00:20:22.497" Score="1" Body="&lt;p&gt;I was able to make some progress here. Below is the proper navigation aligned for the parent entries, but not the children.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id == 174 %}&#xA; {% nav node in craft.menus.getNodes('ticketsSubnav') %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;{% endif %}&#xA;&#xA;{% if entry.id == 53 %}&#xA; {% nav node in craft.menus.getNodes('visitSubnav') %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;{% endif %}&#xA;&#xA;{% if entry.id == 42 %}&#xA; {% nav node in craft.menus.getNodes('aboutSubnav') %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;{% endif %}&#xA;&#xA;{% if entry.id == 57 %}&#xA; {% nav node in craft.menus.getNodes('supportSubnav') %}&#xA; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{node.link}}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's still not the answer yet, but closer.&lt;/p&gt;&#xA;" OwnerUserId="3554" LastActivityDate="2015-05-11T00:20:22.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9674" PostTypeId="2" ParentId="9672" CreationDate="2015-05-11T05:58:57.560" Score="2" Body="&lt;p&gt;The containment operator in does have problems working with whole element models. I'd try and modify your conditional to compare entry IDs instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id in craft.entries.section('general').descendantOf(42).ids() %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To include that parent page ID to that array you would do that with the merge filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aboutPagesIds = craft.entries.section('general').descendantOf(42).ids() %}&#xA;{% set aboutPagesIds = aboutPagesIds|merge([42]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-11T11:10:43.250" LastActivityDate="2015-05-11T11:10:43.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9675" PostTypeId="2" ParentId="5104" CreationDate="2015-05-11T07:17:02.383" Score="9" Body="&lt;p&gt;That's not going to be possible to do without a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin would need to provide its own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controller&lt;/a&gt; which does the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Grab info about the uploaded file using &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/UploadedFile#getInstanceByName-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;UploadedFile::getInstanceByName()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Determine the ID of the asset &lt;em&gt;folder&lt;/em&gt; you want to upload the file to using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#findFolder-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService::findFolder()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Move the file into the folder using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/AssetsService#insertFileByLocalPath-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService::insertFileByLocalPath()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here’s an example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Get info about the uploaded file&#xA;$file = UploadedFile::getInstanceByName('fileInputName');&#xA;$tempFilePath = $file-&amp;gt;getTempName();&#xA;&#xA;// Find the target folder&#xA;$folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'sourceId' =&amp;gt; 1,&#xA;    'path'     =&amp;gt; 'subfolder/path/'&#xA;));&#xA;&#xA;// Turn the file into a managed asset within that folder&#xA;craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $tempFilePath,&#xA;    $file-&amp;gt;getName(),&#xA;    $folder-&amp;gt;id,&#xA;    AssetConflictResolution::KeepBoth);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastEditorUserId="5740" LastEditDate="2017-02-20T14:33:32.780" LastActivityDate="2017-02-20T14:33:32.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9676" PostTypeId="2" ParentId="9665" CreationDate="2015-05-11T10:06:17.060" Score="1" Body="&lt;p&gt;UPDATE:: I set the route for events/past BEFORE the route for events/{slug} and now the events/{slug} route does not interfere with the events/past route (that i did not even think should be necessary in the first place, nor did i know that the order mattered, is this intentional or a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update 2 I've resolved the issue by wrapping everything in a for loop instead of using set like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').slug(slug).status('live', 'expired') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing the set as listed above did not work. So my pages are now working but i'd still like some clarification on the routing, the set, and the slug issues i was having regardless. Although everything is working it almost feels like i'm doing a work-around rather than how it's SUPPOSE to be done.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-05-11T10:06:17.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9678" PostTypeId="1" CreationDate="2015-05-11T12:29:59.690" Score="0" ViewCount="1504" Body="&lt;p&gt;Can't seem to get past the install screen for some reason or other... I fill in the relevant information, it starts to install then I get the OOPS screen... I looked in the log and I'm seeing the following ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Mon May 11 13:25:08 2015] [error] [client ::1] FastCGI: comm with server &quot;/Applications/MAMP/fcgi-bin/php5.3.29.fcgi&quot; aborted: idle timeout (30 sec), referer: http://travelexperience/admin/install&#xA;[Mon May 11 13:25:08 2015] [error] [client ::1] FastCGI: incomplete headers (0 bytes) received from server &quot;/Applications/MAMP/fcgi-bin/php5.3.29.fcgi&quot;, referer: http://travelexperience/admin/install&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I have no idea what's up...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay I'm getting the following error in the craft log...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/05/11 12:48:19 [warning] [application] Skipping record /sites/travelexperience/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3645" LastEditorUserId="45" LastEditDate="2015-05-11T15:26:29.733" LastActivityDate="2015-05-11T18:44:01.200" Title="Can't get past the install on local MAMP Pro install... &quot;Oops screen&quot;" Tags="&lt;error&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9679" PostTypeId="1" AcceptedAnswerId="9681" CreationDate="2015-05-11T13:37:18.077" Score="0" ViewCount="1244" Body="&lt;p&gt;My file structure is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;User/me/www/Craft-2.3.2644/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using MAMP and MAMP Points to this folder as my 'server root'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything inside and including my web root has 777 permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside this folder are three items:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public/&#xA;readme.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a MySQL database:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Domain: localhost&#xA;User: root&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have pointed the db.php file to my server, with 'root' as the password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My index.php file in my public folder points to &lt;code&gt;../craft&lt;/code&gt; which reroutes to &lt;code&gt;/app/index.php&lt;/code&gt; (a file that does exist in that location).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most positive result I can get when surfing to &lt;code&gt;localhost/public/index.php&lt;/code&gt; is a message that reads as below...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Page not found&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;What’s worse, a hilarious 404 page can’t be found either.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;With any other permissions I cannot access the folder because I'm not allowed (oops message).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And with any other mapping in the index file I receive a message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;File not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3646" LastEditorUserId="45" LastEditDate="2015-05-11T15:14:31.693" LastActivityDate="2015-05-11T15:14:31.693" Title="&quot;Page not found. What’s worse, a hilarious 404 page can’t be found either.&quot;" Tags="&lt;installation&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9680" PostTypeId="1" AcceptedAnswerId="9682" CreationDate="2015-05-11T14:03:28.510" Score="7" ViewCount="1113" Body="&lt;p&gt;I'm trying to get the locale title (dutch: nl_nl) of an entry, in the english version of the same post. I want to do this so that on hover it shows the English title's Dutch version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3583" LastActivityDate="2017-06-15T13:18:07.773" Title="Get locale entry.title in other languages" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9681" PostTypeId="2" ParentId="9679" CreationDate="2015-05-11T14:05:16.530" Score="2" Body="&lt;p&gt;You need to point your webserver to the &lt;code&gt;public&lt;/code&gt; directory as stated in the docs &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-1-upload-the-files&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. So in your case that would mean setting your vhost to point to: &lt;code&gt;User/me/www/Craft-2.3.2644/public&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that public folder you will find an &lt;code&gt;index.php&lt;/code&gt; file, which tells php where Craft can be found, by default (which yours is) that will be &lt;code&gt;../craft&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2015-05-11T14:05:16.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9682" PostTypeId="2" ParentId="9680" CreationDate="2015-05-11T15:32:37.287" Score="10" Body="&lt;p&gt;You can use the 'locale' and 'id' attributes in your query to request the same entry in another locale.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&amp;lt;br&amp;gt;&#xA;{{ craft.entries.id([entry.id]).locale('nl_nl').first.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update.&lt;/strong&gt; If there is any chance that the entry/section is disabled for that locale you can also check it first, like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nlEntry = craft.entries.id([entry.id]).locale('nl_nl').first %}&#xA;{% if nlEntry %}&#xA;    {{ nlEntry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-12T04:52:37.960" LastActivityDate="2015-05-12T04:52:37.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9683" PostTypeId="1" AcceptedAnswerId="9684" CreationDate="2015-05-11T17:19:20.260" Score="1" ViewCount="6196" Body="&lt;p&gt;I have a Video section with a field called &lt;code&gt;videoCategory&lt;/code&gt;. I'm trying to pull in the first category on the _entry.html template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty much following the the last example in the documentation at: &lt;a href=&quot;http://buildwithcraft.com/docs/categories-fields&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/categories-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entryCategory = entry.videoCategory.first() %}&#xA; {% if entryCategory %}&#xA;   &amp;lt;h1&amp;gt;{% for category in entryCategory %}&amp;lt;a href=&quot;&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt; {% endfor %}&amp;lt;/h1&amp;gt;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't get around this error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Impossible to access an attribute (&quot;title&quot;) on a string variable (&quot;19&quot;)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is it that I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2015-05-11T17:35:36.173" Title="Impossible to access an attribute (title) on a string variable" Tags="&lt;categories&gt;&lt;entry&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9684" PostTypeId="2" ParentId="9683" CreationDate="2015-05-11T17:35:36.173" Score="4" Body="&lt;p&gt;entryCategory is already a single category because of &quot;first()&quot;. So no need for the for loop. Just {{ entryCategory.title }} should do the trick here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryCategory = entry.videoCategory.first() %}&#xA;{% if entryCategory %}&#xA;    &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;{{ entryCategory.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-05-11T17:35:36.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9685" PostTypeId="1" AcceptedAnswerId="9687" CreationDate="2015-05-11T18:15:46.750" Score="1" ViewCount="187" Body="&lt;p&gt;I used &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4650/any-working-rss-feed-examples-out-there&quot;&gt;this example&lt;/a&gt; to create an RSS feed in Craft, saved it as “rss.html”, uploaded it into the “craft/templates” directory, and created a custom route rss =&amp;gt; templates/rss.&lt;/p&gt;&#xA;&lt;p&gt;However, when I load our website to &lt;a href=&quot;http://www.progress.org/rss&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.progress.org/rss&lt;/a&gt; I get the following error: “error on line 13 at column 9: Opening and ending tag mismatch: meta line 0 and head”&lt;/p&gt;&#xA;&lt;p&gt;Any help is appreciated... Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3497" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-05-12T21:15:31.343" Title="Error for RSS feed" Tags="&lt;rss&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9686" PostTypeId="2" ParentId="9678" CreationDate="2015-05-11T18:19:28.207" Score="2" Body="&lt;p&gt;See this answer for how to work around the MAMP &lt;code&gt;incomplete headers&lt;/code&gt; bug: &lt;a href=&quot;https://craftcms.stackexchange.com/a/6573/57&quot;&gt;https://craftcms.stackexchange.com/a/6573/57&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;[warning] [application] Skipping record...&lt;/code&gt; log entry isn't an error at all and is completely normal to see during installation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-11T18:44:01.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9687" PostTypeId="2" ParentId="9685" CreationDate="2015-05-11T18:22:33.053" Score="1" Body="&lt;p&gt;If you view the source of the RSS page you're linked to, you'll see the underlying error causing your feed to mess up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;pageDescription&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You didn't share your template code, but most like likely you're doing an &lt;code&gt;entry.pageDescription&lt;/code&gt; somewhere, but there isn't a field called &lt;code&gt;pageDescription&lt;/code&gt; setup for that particular entry.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-11T18:22:33.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9688" PostTypeId="2" ParentId="9601" CreationDate="2015-05-11T19:32:50.263" Score="2" Body="&lt;p&gt;All of your settings look fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely what happened is that when you added the new Russian locale under Settings-&gt;Locales, the &quot;Resave All Elements&quot; task that needs to run either didn't get a chance to complete or just ran into an error and failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have any Russian content yet, try deleting the locale and re-adding it - making sure that the task in the upper right hand corner completes.  If you already have Russian content, temporarily add any new locale, let the task complete, then delete the temporary locale.  That will also fix it for the Russian locale.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-11T19:32:50.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9689" PostTypeId="1" CreationDate="2015-05-11T20:20:17.373" Score="1" ViewCount="327" Body="&lt;p&gt;I want to display first 100 characters from a rich text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sumtext =  entry.bodyContent.type('text').first().text|hacksaw(chars='100', append='...') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if there was a new paragraph in the first 100 characters and no full stop - both paragraphs are just joined together without a space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sumtext =  entry.bodyContent.type('text').first().text|hacksaw(allow='&amp;lt;p&amp;gt;', chars='100', append='...') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the &lt;p&gt; gets displayed on the screen instead of the new line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is my best method to display the first 100 characters from a rich text field?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-05-11T21:23:51.280" Title="hacksaw plugin - displaying first 100 characters" Tags="&lt;plugins&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9690" PostTypeId="2" ParentId="9689" CreationDate="2015-05-11T21:23:51.280" Score="4" Body="&lt;p&gt;In my opinion, the first thing you should do is &lt;strong&gt;remove all HTML tags&lt;/strong&gt;. It's not just paragraph tags which could cause you problems... what about &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags which get cut off?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For legibility sake, let's also break this down into multiple steps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set textBlock = entry.bodyContent.type('text').first() %}&#xA;{% set plainText = textBlock.text|striptags %}&#xA;{% set sumtext   = plainText|hacksaw(chars='100', append='...') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally, if you &lt;strong&gt;do&lt;/strong&gt; want your text wrapped in a paragraph tag, just reapply that when you output it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ sumtext }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since you mentioned having an issue with two paragraphs getting mushed together, let me address that too... You'll want to make use of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;Craft &lt;code&gt;replace&lt;/code&gt; filter&lt;/a&gt;, which can handle regex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couple of ways you could tackle that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{% set plainText = plainText|replace('/\. */', '. ') %}&lt;/code&gt; (ensures periods are followed by a single space)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{% set textBlock = textBlock|replace('/&amp;lt;\/p&amp;gt; *&amp;lt;p&amp;gt;/', ' ') %}&lt;/code&gt; (gracefully combines paragraphs with a space in between)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-05-11T21:23:51.280" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9691" PostTypeId="1" AcceptedAnswerId="9705" CreationDate="2015-05-12T02:07:15.980" Score="1" ViewCount="1140" Body="&lt;p&gt;Anyone know if it's possible to check what the current field is while in a loop of a matrix block? Running into an issue with a matrix block in my loop for how I want to output the content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case 'testimonials' %}&#xA;{% if block.getPrev() %}&#xA;    {# if the previous block isn't the &quot;testimonials&quot; block start container #}&#xA;    {% if block.getPrev().type != 'testimonials' %}&#xA;    &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;    {% endif %}&#xA;    {# if there isn't a previous block start a div could be the first block#}&#xA;    {% else %}&#xA;    &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;{% endif %}&#xA;&#xA;            {# Output Content #}&#xA;            {# Output each testimonial here #}&#xA;            &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;                    &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/footer&amp;gt;&#xA;                &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/blockquote&amp;gt;&#xA;&#xA;            {% if block.getPrev().type != 'testimonials' %}&#xA;            &amp;lt;ul class=&quot;list-inline&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {# Output image for each testimonial here #}&#xA;            {% set image = block.image.first() %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;            {% if block.getNext().type != 'testimonials' %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;            {# Output Content #}&#xA;&#xA;{# if this is the &quot;testimonials&quot; block type #}&#xA;{% if block.type == 'testimonials' %}&#xA;    {# if there is another block to check #}&#xA;    {% if block.getNext() %}&#xA;&#xA;    {# if the next block isn't the &quot;testimonials&quot; block end div #}&#xA;    {% if block.getNext().type != 'testimonials' %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {# if there isn't another block end a ul might be the last block#}&#xA;    {% else %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&amp;lt;!-- End Testimonials Block --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if I enter three testimonials I want the content to appear like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;    &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;        &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/footer&amp;gt;&#xA;    &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;    &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;        &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/footer&amp;gt;&#xA;    &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;    &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;        &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/footer&amp;gt;&#xA;    &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&amp;lt;ul class=&quot;list-inline&quot;&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before changing to use a switch I was using the following which worked great, just can't think of an equivalent for switch.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Testimonials Block --&amp;gt;&#xA;{% if entry.testimonials|length %}&#xA;&amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;        {% for block in entry.testimonials %}&#xA;            {% if block.type == &quot;testimonial&quot; %}&#xA;                {% set image = block.image.first() %}&#xA;                &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                    &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;                        &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/footer&amp;gt;&#xA;                    &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/blockquote&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %} &#xA;        &amp;lt;div class=&quot;list-inline&quot;&amp;gt;&#xA;        {% for block in entry.testimonials %}&#xA;            {% if block.type == &quot;testimonial&quot; %}&#xA;                {% set image = block.image.first() %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %} &#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-05-12T02:35:32.030" LastActivityDate="2015-05-13T01:02:14.177" Title="Matrix loop nesting issue using switch" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9692" PostTypeId="1" AcceptedAnswerId="9695" CreationDate="2015-05-12T05:28:40.587" Score="3" ViewCount="380" Body="&lt;p&gt;Making a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get this &lt;code&gt;{% set leads = craft.lead_infopack.getPacks() %}&lt;/code&gt; to fire from within a template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin name: lead&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a look inside my variables class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lead_InfopackVariable.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Lead_InfopackVariable&#xA;{ &#xA;    public function getPacks()&#xA;    {&#xA;        return craft()-&amp;gt;lead_infopack-&amp;gt;leads();&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The leads function calls a service that outputs all entries within my 'infopack' table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I write it like this it works &lt;code&gt;{% set leads = craft.lead.getPacks() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LeadVariable.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class LeadVariable&#xA;{ &#xA;    public function getPacks()&#xA;    {&#xA;        return craft()-&amp;gt;lead_infopack-&amp;gt;leads();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="749" LastEditorUserId="57" LastEditDate="2015-05-12T17:39:26.547" LastActivityDate="2015-05-12T17:56:35.653" Title="Namespace issues when calling a plugin variable" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9693" PostTypeId="2" ParentId="9691" CreationDate="2015-05-12T05:37:16.473" Score="2" Body="&lt;p&gt;I think you're going to drive yourself crazy with all the if then statements ;) — I might suggest you try a different approach to make this a bit more manageable. I can think of a few options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1&lt;/strong&gt;. Create a 'testimonials' matrix field and a 'layout' matrix field. The 'testimonials' matrix can be used to organize the testimonials, and the 'layout' matrix can be used to define the page layout order — you can then simply include the testimonials by adding a 'dummy' testimonials blockType to the layout matrix with no content in it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.layout %}&#xA;    {% switch entry.layout %}&#xA;&#xA;        {% case 'testimonials'%}&#xA;&#xA;            &amp;lt;div class=&quot;container-fluid add-top&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;text-center testimonials&quot;&amp;gt;&#xA;&#xA;                        {% set imageHTML = '' %}&#xA;                        {% for block in entry.testimonials %}&#xA;&#xA;                            &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                                &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;                                    &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{block.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;                                &amp;lt;/footer&amp;gt;&#xA;                                &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{block.lead}}”&amp;lt;/p&amp;gt;&#xA;                            &amp;lt;/blockquote&amp;gt;&#xA;&#xA;                            {% set image = block.image.first() %}&#xA;                            {% set imageHTML = imageHTML ~ '&amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;%url%&quot; width=&quot;%width%&quot; height=&quot;%height%&quot;/&amp;gt;&amp;lt;/li&amp;gt;'|replace({&#xA;                                %url%: image.getUrl('testimonials'),&#xA;                                %height%: image.getWidth('testimonials'), &#xA;                                %width%: image.getHeight('testimonials')    &#xA;                            }) %}&#xA;&#xA;                        {% endfor %}&#xA;&#xA;                        {% if imageHTML %}&#xA;                            {{ imageHTML }}&#xA;                        {% endif %}&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% case 'someOtherBlock' %}&#xA;&#xA;            {# output other blocks as needed #}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2&lt;/strong&gt;. Something else to consider is to use the 'superTable' plugin, which if I understand correctly, can be placed inside a matrix field. You can then loop through the matrix (i.e. 'layout') using switch, and then loop through the 'testimonials' inside the table. Unlike the solution above this would allow for multiple testimonial areas on your page, if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 3&lt;/strong&gt;. You might also consider creating a separate channel for your 'testimonials', and then use an entries fieldType to include multiple testimonials in your testimonials blocktype. While slightly more difficult for data entry, the advantage would be that you could reuse your testimonials on multiple pages. This would also allow for multiple testimonial areas on the same page.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-12T15:58:32.973" LastActivityDate="2015-05-12T15:58:32.973" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9695" PostTypeId="2" ParentId="9692" CreationDate="2015-05-12T06:21:07.543" Score="4" Body="&lt;p&gt;I think you can only have one variable class. So the solution you posted is the only way that works.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-12T06:21:07.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9696" PostTypeId="1" CreationDate="2015-05-12T09:41:16.840" Score="2" ViewCount="109" Body="&lt;p&gt;I've just noticed on a site that the Disqus comment embed is suggesting other articles but they're adding a token to the end of the URL, for example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://australia.thegospelcoalition.org/article/blessed-to-be-rich-a-biblical-theology-of-blessing?token=_g6RQbb8oD9~uxEUu8u6~c9875m17~jo&quot; rel=&quot;nofollow&quot;&gt;http://australia.thegospelcoalition.org/article/blessed-to-be-rich-a-biblical-theology-of-blessing?token=_g6RQbb8oD9~uxEUu8u6~c9875m17~jo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this returns a 404 in Craft. Works fine without that query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas to resolve?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2018-10-02T12:28:58.317" Title="404 when clicking on the Disqus embed urls" Tags="&lt;url&gt;&lt;entry&gt;&lt;404&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9699" PostTypeId="1" AcceptedAnswerId="9701" CreationDate="2015-05-12T13:18:02.487" Score="3" ViewCount="1085" Body="&lt;p&gt;I have a Assets folder (local) with 100 assets in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have a new Assets folder connected to Amazon s3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I just drag-n-drop my assets from my local folder over to my s3 folder and keep all relationships for those assets to my elements (entries)?&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-05-12T13:39:32.247" Title="Can I move a local Asset to S3 and keep relations?" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9700" PostTypeId="2" ParentId="9696" CreationDate="2015-05-12T13:31:38.823" Score="2" Body="&lt;p&gt;Not sure why they add this param for you; on my own weblog all the suggested links are without ?token. Maybe you previewed that page and had the Disqus embed showing for the preview as well? Best not to include it for previews and older versions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, as explained above by default Craft also uses the 'token' param to preview previous versions of the page. That's probably why it's not working now; this token has expired so Craft can't find any version of that page using the requested token anymore and displays a 404 page instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fix is relatively easy: just change the 'tokenParam' config setting to something else: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft v2 - &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#tokenparam&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#tokenparam&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft v3 - &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#tokenparam&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/config-settings.html#tokenparam&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then Craft will just ignore it and show the correct page. Just don't forget to also hide the embed for previews otherwise you will get exactly the same problem soon with the new token param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work to prevent this in the future:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isLivePreview() and not craft.request.getParam( craft.config.get('tokenParam') ) %}&#xA;    ... embed code here ..&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user155" LastEditorUserId="142" LastEditDate="2018-10-02T12:28:58.317" LastActivityDate="2018-10-02T12:28:58.317" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9701" PostTypeId="2" ParentId="9699" CreationDate="2015-05-12T13:39:32.247" Score="6" Body="&lt;p&gt;Yes you can. Just remember to add your new Assets folder as an assets source to your old Asset fields (fields that are &quot;Asset&quot; types) so users still can add/edit/change their assets.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-05-12T13:39:32.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9702" PostTypeId="1" AcceptedAnswerId="9703" CreationDate="2015-05-12T14:20:09.947" Score="0" ViewCount="745" Body="&lt;p&gt;I have a controller function creating attributes for a model from posted data and sending them to a service to save the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything seems to be working correctly if I do a print_r in the service function before using setAttributes it is returning the posted data correctly with the changed attribute value. However when I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The array that is printed after is using the database values so it is not setting the new attribute as the function suggests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read other posts which suggest there may be a bug with the setAttributes function and a work around setting each post item individually (not ideal) plus I have tried this and it produces the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something obvious as to why the setAttributes is not updating the $record variable with the new $model attributes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers &lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-12T14:26:14.683" Title="setAttribute Issue" Tags="&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9703" PostTypeId="2" ParentId="9702" CreationDate="2015-05-12T14:26:14.683" Score="1" Body="&lt;p&gt;Are you/how are you validating the values?&#xA;What I found was that it was a validation issue. If a value isn't considered valid, it will be ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Going along with @Stuart Whitehead comments, right here is proof: &quot;AttributeType::String does not apply any validation rules.&quot; Which is why that field was not getting populated.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8884/save-contact-form-data-to-database&quot;&gt;Check out this thread&lt;/a&gt; I think it will have everything you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-05-12T14:26:14.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9704" PostTypeId="1" AcceptedAnswerId="9711" CreationDate="2015-05-12T16:54:46.580" Score="0" ViewCount="125" Body="&lt;p&gt;When uploading an asset through either the assets tab, or within an asset field - the asset uploads successfully but doesn't get automatically selected for insertion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get around the issue I have to search for asset filename and then select it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally the asset should get selected by default ready to be inserted by clicking 'select'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have quite a few assets, so there is auto pagination/load more which might be causing the issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3649" LastActivityDate="2015-05-13T09:35:19.263" Title="When uploading an asset, the asset is not selected after upload" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9705" PostTypeId="2" ParentId="9691" CreationDate="2015-05-12T17:11:58.197" Score="1" Body="&lt;p&gt;The way you describe the output you want (3 blockquotes followed by a list of 3 images), you are going to need to loop over the testimonials twice. Here is a solution detects the first of the testimonials blocks and starts a secondary loop for the blockquotes. You will need the &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;break and continue&lt;/a&gt; plugin to exit out of that inner loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixField %}&#xA;  {% switch block.type %}&#xA;    {% case 'testimonials' %}&#xA;&#xA;      {# is this the first or last block ? #}&#xA;      {% set isFirst = not block.getPrev() or block.getPrev().type != 'testimonials' %}&#xA;      {% set isLast = not block.getNext() or block.getNext().type != 'testimonials' %}&#xA;&#xA;      {% if isFirst %}&#xA;        {# we are going to fake a loop for the blockquotes #}&#xA;        {% set currentBlock = block %}&#xA;        {# twig has no while loop, so... #}&#xA;        {% for x in [1..1000] %}&#xA;&#xA;          {% if not currentBlock or currentBlock.type != 'testimonials' %}&#xA;            {% break %} {# from the breakandcontinue plugin #}&#xA;          {% endif %}&#xA;&#xA;          &amp;lt;blockquote class=&quot;blockquote-unstyled&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;            &amp;lt;footer class=&quot;text-uppercase&quot;&amp;gt;&#xA;              &amp;lt;span title=&quot;Source Title&quot;&amp;gt;{{currentBlock.sourceTitle}}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/footer&amp;gt;&#xA;            &amp;lt;p class=&quot;lead&quot;&amp;gt;“{{currentBlock.lead}}”&amp;lt;/p&amp;gt;&#xA;          &amp;lt;/blockquote&amp;gt;&#xA;&#xA;          {# on to the next #}&#xA;          {% set currentBlock = currentBlock.getNext() %}&#xA;        {% endfor %}&#xA;&#xA;        {# first one, so open the image list #}&#xA;        &amp;lt;ul class=&quot;list-inline&quot;&amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {# Output image for this testimonial here #}&#xA;      {% set image = block.image.first() %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;img class=&quot;img-responsive img-circle&quot; alt=&quot;Profile&quot; src=&quot;{{ image.getUrl('testimonials') }}&quot; width=&quot;{{ image.getWidth('testimonials') }}&quot; height=&quot;{{ image.getHeight('testimonials') }}&quot;/&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;      {% if isLast %} {# last one, close the list #}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endif %}&#xA;    {# other cases here... #}&#xA;  {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-05-13T01:02:14.177" LastActivityDate="2015-05-13T01:02:14.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9706" PostTypeId="2" ParentId="9692" CreationDate="2015-05-12T17:56:35.653" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/9695/57&quot;&gt;carlcs&lt;/a&gt; is correct (as usual).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can only have one variable class that maps to &lt;code&gt;craft.pluginName&lt;/code&gt;, but you can have methods inside that class that map to other variable classes.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-12T17:56:35.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9707" PostTypeId="2" ParentId="9704" CreationDate="2015-05-12T18:10:08.897" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;We have quite a few assets, so there is auto pagination/load more which might be causing the issue?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You nailed it. It's a known issue and we just haven't figured out a clean way to to select the items when they show up in a different page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest adding this to the feedback site as it feels more like a feature request than anything.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-12T18:10:08.897" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9708" PostTypeId="1" CreationDate="2015-05-12T20:54:23.883" Score="1" ViewCount="142" Body="&lt;p&gt;I've looked around a good bit to see if I could solve this problem on my own. I've managed to get close I believe, but I think I don't quite understand Craft's relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I have a related projects section on my site. I'm allowing the user to select the related projects with an Entries tag within my matrix. I would then like to compare their selected Entries with projects already added to a Structure - then output attributes that exist only in the Structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as far as I've gotten:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Structure Content&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('homePageBanners').limit(3) %}&#xA;    {% for block in entry.banner.limit(3) %}&#xA;&#xA;        {{ block.client }}&#xA;        {{ block.bannerImage }}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Matrix Entries Block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in block.projectsEntry %}&#xA;    &amp;lt;a href=&quot;{{ entry.getUrl() }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to compare them &amp;amp; pull content based on what the user selects. I looked into relatedTo(), but didn't have much luck with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not clear, I can try to be more specific -- please go easy on me, I'm pretty new to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this will help clarify&#xA;    {% for entry in block.projectsEntry %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for project in craft.entries.section('homePageBanners').limit(3) %}&#xA;  {% set relatedProjects = craft.entries.section('homePageBanners').relatedTo(project) %}&#xA;   {% for project in relatedProjects %}&#xA;    &amp;lt;a href=&quot;{{ project[0].getUrl() }}&quot;&amp;gt;{{ project[0].title }}&amp;lt;/a&amp;gt;&#xA;   {% endfor %}&#xA;  {% endfor %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="344" LastEditDate="2015-05-27T14:18:23.043" LastActivityDate="2015-05-27T14:18:23.043" Title="Related Projects (Structure + Channel Matrix)" Tags="&lt;matrix&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9710" PostTypeId="2" ParentId="2832" CreationDate="2015-05-12T21:45:37.760" Score="0" Body="&lt;p&gt;From what I gather, I think the problem is that your &lt;code&gt;.htaccess&lt;/code&gt; is not in the webroot. try putting it in the same dir as &lt;code&gt;web.config&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also bare in mind that there are two &lt;code&gt;.htaccess&lt;/code&gt;, the other is in /craft dir, and that one should stay there and not edited.&lt;/p&gt;&#xA;" OwnerUserId="3652" LastActivityDate="2015-05-12T21:45:37.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9711" PostTypeId="2" ParentId="9704" CreationDate="2015-05-12T22:40:32.800" Score="1" Body="&lt;p&gt;You could try and have them ordered by &quot;Date Modified - Descending&quot;, so that any new asset will always be on top of the list. Even if does not get selected automatically (could work because it's on the first pagination page), it's a very easy way to find it! ;) &lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-13T09:35:19.263" LastActivityDate="2015-05-13T09:35:19.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9712" PostTypeId="1" CreationDate="2015-05-13T09:05:58.923" Score="0" ViewCount="360" Body="&lt;p&gt;Hi I'm getting this error when I try to validate a model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft\mymodelModel and its behaviors do not have a method or closure named &quot;getTableSchema&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code in the controller function that calls the save. It saves the data fine but I want to validate the model first before it does so but this is throwing the above error. What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model-&amp;gt;setAttributes($attribute);&#xA;&#xA;if($model-&amp;gt;validate()) {&#xA;    // code that sends model off to be saved&#xA;} else {&#xA;    $model-&amp;gt;getErrors();    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Model class code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;    /**&#xA;    * myModel Model&#xA;    *&#xA;    * Provides a read-only object representing a myModel, which is   returned&#xA;    * by our service class and can be used in our templates and controllers.&#xA;    */&#xA;    class myModels_myModelModel extends BaseModel&#xA;   {&#xA;    /**&#xA;     * Defines what is returned when someone puts {{ myModel }} directly&#xA;     * in their template.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;     public function __toString()&#xA;   {&#xA;       return $this-&amp;gt;name;&#xA;   }&#xA;&#xA;   /**&#xA;     * Define the attributes this model will have.&#xA;     *&#xA;     * @return array&#xA;     */&#xA;     public function defineAttributes()&#xA;     {&#xA;        return array(&#xA;            'id'    =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true, 'unique' =&amp;gt; true),&#xA;        'field1'    =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true),&#xA;        'field2' =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; &quot;value1,value2&quot;),&#xA;        'field3'  =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; &quot;value1,value2,value3&quot;, 'required' =&amp;gt; true, 'default' =&amp;gt; 'value1'),&#xA;        'field4' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field5' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field6' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field7' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field8' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field9' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field10' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field11' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field12' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;        'field13' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false)&#xA;        );&#xA;    }&#xA;&#xA;    /**&#xA;     * Get User&#xA;     */&#xA;    public function getmyModel()&#xA;    {&#xA;        if ($this-&amp;gt;userId)&#xA;        {&#xA;            return craft()-&amp;gt;users-&amp;gt;getUserById($this-&amp;gt;userId);&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-05-13T14:02:32.973" LastActivityDate="2015-06-12T15:01:27.920" Title="Error with model validation" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9713" PostTypeId="1" AcceptedAnswerId="9717" CreationDate="2015-05-13T11:37:19.827" Score="4" ViewCount="1010" Body="&lt;p&gt;I was hoping someone could shed some light on this issue I'm having. I'm trying to update a relationship field through a plugin, without much success, the entry looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tkV0g.jpg&quot; alt=&quot;Entry page&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw a post on here regarding something similar here:  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4962/relation-row-insertion-in-db-plugin&quot;&gt;Relation row insertion in DB (plugin)&lt;/a&gt; so going from that my code at the moment looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// The id of the entry i want to attach to the relation&#xA;$storeId = $formData['storeId'];&#xA;&#xA;// The entry as shown above&#xA;$source = craft()-&amp;gt;elements-&amp;gt;getElementById($entryId);&#xA;&#xA;foreach($blocks as $blockId =&amp;gt; $value)&#xA;{&#xA; // The matrix block with the relation&#xA; $matrixBlock = craft()-&amp;gt;matrix-&amp;gt;getBlockById($blockId);&#xA;&#xA; // Get the 'stores' field&#xA; $fieldId = $matrixBlock-&amp;gt;stores-&amp;gt;relatedTo['field'];&#xA; $field = craft()-&amp;gt;fields-&amp;gt;getFieldById($fieldId);&#xA;&#xA; // Save the relationship&#xA; craft()-&amp;gt;relations-&amp;gt;saveRelations($field , $source, array($storeId));&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$blocks&lt;/code&gt; is just an array like: &lt;code&gt;array('1092' =&amp;gt; 0)&lt;/code&gt; and &lt;code&gt;$value&lt;/code&gt; will just be determining whether to set or unset the relation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the above through a controller, no errors appear but no relation actually takes place on the &lt;code&gt;stores&lt;/code&gt; field. Are there any glaring mistakes i'm making? any help would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-02-01T05:36:23.353" Title="Inserting Relationship Into Entries Field - Plugin Not Saving Relation" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9714" PostTypeId="2" ParentId="9355" CreationDate="2015-05-13T11:46:08.727" Score="2" Body="&lt;p&gt;You could use my &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;Auto Expire&lt;/a&gt; plugin to make those entries expire the next morning 5 AM after the event. Just add a new expiration rule with the expiration date set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ dateTime|date_modify('tomorrow 5am')|date('U') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you can now remove the logic from the templates. A nice side-effect is that expired entries are indicated with red traffic lights in the CP index view.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-13T11:46:08.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9716" PostTypeId="1" AcceptedAnswerId="9808" CreationDate="2015-05-13T12:26:19.553" Score="2" ViewCount="1017" Body="&lt;p&gt;I'm adding validation errors to fields using &lt;code&gt;addErrors($record-&amp;gt;getErrors())&lt;/code&gt; which then read like e.g. &quot;My Field cannot be blank.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm wondering where I can translate the field name, which I think is generated from the ID attribute &lt;code&gt;myField&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;example/saveExample&quot;&amp;gt;&#xA;&#xA;{{ forms.textField({&#xA;    label: 'My Field'|t,&#xA;    id: 'myField',&#xA;    name: 'myField',&#xA;    value: null,&#xA;    errors: example is defined ? example.errors('myField'),&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Service function called from &lt;code&gt;actionSaveExample&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveExample(ExampleModel $example)&#xA;{&#xA;    $exampleRecord = ExampleRecord::model()-&amp;gt;findById($example-&amp;gt;id);&#xA;    $exampleRecord-&amp;gt;myField = $example-&amp;gt;myField;&#xA;&#xA;    if ($exampleRecord-&amp;gt;validate())&#xA;    {&#xA;        // save&#xA;    }&#xA;    else&#xA;    {&#xA;        $rule-&amp;gt;addErrors($ruleRecord-&amp;gt;getErrors());&#xA;&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-14T17:32:15.453" LastActivityDate="2015-05-19T13:01:20.520" Title="Translate field name displayed within validation error messages?" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9717" PostTypeId="2" ParentId="9713" CreationDate="2015-05-13T12:51:49.170" Score="7" Body="&lt;p&gt;Figured it out, trying to use the Entry as the source was wrong as the 'stores' relationship field actually belongs to the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by setting the matrix field as the source this is now working just fine!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;relations-&amp;gt;saveRelations($field , $matrixBlock, $relations);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-13T12:51:49.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9718" PostTypeId="2" ParentId="9716" CreationDate="2015-05-13T14:38:56.987" Score="1" Body="&lt;p&gt;Craft/Yii sees that string as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'{attribute} cannot be blank.' =&amp;gt; '{attribute} darf nicht leer sein.',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;{attribute}&lt;/code&gt; is the dynamic part - in this case your field handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm understanding your question correctly, there isn't a way to translate that field handle in this context because you're in charge of what it's called to begin with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would assume, for example, if you're using the German locale, that you would already have a German context field handle name in place already.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-05-13T18:05:30.303" LastActivityDate="2015-05-13T18:05:30.303" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9719" PostTypeId="2" ParentId="9712" CreationDate="2015-05-13T14:41:53.233" Score="1" Body="&lt;p&gt;I just had a bit more of a look into this, I got the same error as you but by changing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'id' =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true, 'unique' =&amp;gt; true),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id =&amp;gt; AttributeType::Number&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It fixed the issue and I was able to validate on it no problem, I don't think you need to worry about the ID being unique or being set on the model as this will be handled automatically by your record when you use it to save to the database, so you can be certain that every models id will always be unique.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-13T14:41:53.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9720" PostTypeId="2" ParentId="6662" CreationDate="2015-05-13T15:58:59.837" Score="3" Body="&lt;p&gt;If you haven't solved it yet with a custom solution, have a look at my &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;Auto Expire&lt;/a&gt; plugin. You would add a new expiration rule with the expiration date set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ 'now'|date_modify('+3 month 5am')|date('c') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ postDate|date_modify('+3 month 5am')|date('c') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and make sure the option to allow user changes is checked.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-13T15:58:59.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9721" PostTypeId="2" ParentId="5092" CreationDate="2015-05-13T16:02:15.543" Score="1" Body="&lt;p&gt;You could use my &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;Auto Expire&lt;/a&gt; plugin to make those entries expire after the event is over. Just add a new expiration rule for that section with the expiration date set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ konzertdatum|date_modify('+3 days 5am')|date('c') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-13T16:02:15.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9722" PostTypeId="2" ParentId="2008" CreationDate="2015-05-13T16:03:55.937" Score="2" Body="&lt;p&gt;You could use my &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;Auto Expire&lt;/a&gt; plugin for this. Just add a new expiration rule with the expiration date set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ postDate|date_modify('+14 days 5am')|date('c') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-13T16:03:55.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9723" PostTypeId="2" ParentId="9617" CreationDate="2015-05-13T16:26:47.310" Score="1" Body="&lt;p&gt;The site was on amazon AWS (without load balancing), so I set an appId in the config/general.php file to keep the session &quot;sticky&quot;, even if the filepaths were &quot;inconsistent&quot; on a single server instance. The autogenerated appId based on filepath must have been interacting weird with Amazon's cloud setup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;    'appId' =&amp;gt; 'myAppId',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3512" LastActivityDate="2015-05-13T16:26:47.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9724" PostTypeId="1" CreationDate="2015-05-13T17:33:21.583" Score="4" ViewCount="754" Body="&lt;p&gt;Is it possible to turn a query into an element criteria model? Currently I'm doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Conference_Session');&#xA;$criteria-&amp;gt;conferenceId = $conferenceModel-&amp;gt;id;&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$query-&amp;gt;order(&quot;conference_session.cs_start_time ASC&quot;);&#xA;&#xA;$queryResult = $query-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would prefer to be able to be able to add my MySQL commands then turn it back into a element criteria. I don't &lt;strong&gt;have&lt;/strong&gt; to do this but I want to know if I could.&lt;/p&gt;&#xA;" OwnerUserId="3325" LastActivityDate="2015-06-10T18:48:09.357" Title="Query to element criteria" Tags="&lt;elementcriteriamodel&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9725" PostTypeId="2" ParentId="1117" CreationDate="2015-05-13T19:33:12.960" Score="8" Body="&lt;p&gt;I'm not sure if this feature is newer than this question but you can also say &lt;code&gt;{{ tag.slug }}&lt;/code&gt; to get &lt;code&gt;apples-and-carrots&lt;/code&gt;. All letters become lowercase as well so the result is more &quot;scripting-friendly&quot;.&lt;/p&gt;&#xA;" OwnerUserId="520" LastActivityDate="2015-05-13T19:33:12.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9726" PostTypeId="1" CreationDate="2015-05-13T20:53:44.957" Score="1" ViewCount="45" Body="&lt;p&gt;According to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;the docs&lt;/a&gt;, if I call a hook from within my template:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The $context argument will be the current Twig context array, which you’re free to manipulate.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I have a loop in my template where summary is a model I've created:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for summary in bookings %}&#xA;    {% hook 'microsGetBooking' %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, the $context variable passed to my hook should be a reference to that summary object. However it always appears to be an EntryModel (in this case the template I'm calling this on has a URL that matches an entry in the CMS).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-05-13T21:55:28.403" Title="Hook calls within a loop always get the Entry, not the loop context?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9727" PostTypeId="1" CreationDate="2015-05-13T21:23:58.007" Score="2" ViewCount="298" Body="&lt;p&gt;When using Inline Transforms in a template and also when the image transform is set in the Image Transforms section of the control panel then say my images folder is located at :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/images&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And say I create an Image Transform called Square 100 [square100] &lt;em&gt;(in either way mentioned above)&lt;/em&gt;, the folder with the transformed images get saved to :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/images/_square100&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to prevent this because I'd like to be able to upload images to a certain folder but then have the URL not shown in any way so people can't find the original files. At the moment you can tell that they are in a folder called images and all you'd need to do to access them is to delete the &lt;strong&gt;/_square100&lt;/strong&gt; part from the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried taking a look at the config variables but couldn't see anything pertaining to this sort of thing or perhaps I'm missing it somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="3631" LastEditDate="2015-05-13T22:55:40.453" LastActivityDate="2015-05-14T02:28:44.880" Title="Possibility to change where Image Transform folders are stored?" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9728" PostTypeId="1" CreationDate="2015-05-13T21:36:17.180" Score="1" ViewCount="60" Body="&lt;p&gt;When adding an image from an Assets field or uploading one to the Assets section &lt;em&gt;(or anywhere there is an Assets field for that matter)&lt;/em&gt; if you have subfolders then it currently shows the main folder but closed so you have to click on the arrow to unfold the main folder structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore looking for a way to have the folder structures already opened to save a click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="3631" LastEditDate="2015-05-13T22:55:54.950" LastActivityDate="2015-05-14T05:36:40.243" Title="Is it possible to always show Assets folders as opened?" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9729" PostTypeId="2" ParentId="9726" CreationDate="2015-05-13T21:55:28.403" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If I understand correctly, the $context variable passed to my hook should be a reference to that summary object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope... &lt;code&gt;$context&lt;/code&gt; is a reference to the entire Twig rendering context of which your &lt;code&gt;bookings&lt;/code&gt; objects will be a part of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use xDebug or &lt;code&gt;var_dump&lt;/code&gt; to see where your &lt;code&gt;bookings&lt;/code&gt; objects are stored and loop though them as necessary from PHP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-13T21:55:28.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9730" PostTypeId="1" CreationDate="2015-05-13T22:25:11.033" Score="0" ViewCount="304" Body="&lt;p&gt;Hope I'm not posting incorrectly here but don't have enough reputation yet &lt;em&gt;(really don't understand that system at all)&lt;/em&gt; to be able to comment on another post here on the exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original Post - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6783/inline-image-transforms&quot;&gt;inline image transforms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to get this to work but not having any luck at all. This is my code in my template so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixBlocks %}&#xA;&#xA;    {% if block.type == &quot;text&quot; %}&#xA;&#xA;    &amp;lt;p&amp;gt;{{ block.text }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% elseif block.type == &quot;quote&quot; %}&#xA;&#xA;    &amp;lt;blockquote class=&quot;{{ block.floatPosition }}&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ block.quote }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;&#xA;    {% elseif block.type == &quot;image&quot; %}&#xA;&#xA;    {% set smallImage&#xA;        = {&#xA;        mode: 'fit',&#xA;        width: 600,&#xA;        height: 200,&#xA;        quality: {{ block.quality.value }},&#xA;        position: 'top-center'&#xA;        }&#xA;    %}&#xA;&#xA;    {% for asset in block.image %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl(smallImage) }}&quot;&#xA;    width=&quot;{{ asset.getWidth(smallImage) }}&quot;&#xA;    height=&quot;{{ asset.getHeight(smallImage) }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;quality&lt;/strong&gt; in &lt;em&gt;{{ block.quality.value }}&lt;/em&gt; is the name &lt;strong&gt;(handle)&lt;/strong&gt; of a field I have storing a number from &lt;strong&gt;1-100&lt;/strong&gt; in my Matrix Block. I am using &lt;a href=&quot;https://github.com/MaxLazar/mx-rangeslider-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Max Lazars range field&lt;/a&gt; to store the number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon trying this say by Live Preview the page never refreshes. If I change the &lt;strong&gt;{{ block.quality.value }}&lt;/strong&gt; to a number then it all works again as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would love to get this working so any help would be greatly appreciated to let me know where I'm going wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-13T22:54:24.603" Title="Inline image transform using Matrix field for image quality?" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;image&gt;&lt;range&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9731" PostTypeId="2" ParentId="9730" CreationDate="2015-05-13T22:54:24.603" Score="1" Body="&lt;p&gt;Aha!!! Got it working at last!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I was using Live Preview, even though I was set to Dev Mode for any errors, they weren't showing in the Live Preview pane &lt;em&gt;(maybe that should be a feature request?)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I tested it out on the live page I saw an error and it told me to place parentheses around an expression so I did this instead :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;quality: (block.quality.value)&lt;/strong&gt; and all is good with the world now!! :-)&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-13T22:54:24.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9732" PostTypeId="2" ParentId="9727" CreationDate="2015-05-14T02:28:44.880" Score="2" Body="&lt;p&gt;Currently the answer is no.  Those paths are hard set in the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like something for the &lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;nofollow&quot;&gt;feedback site&lt;/a&gt;, though.  Be sure and share your use case.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-14T02:28:44.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9733" PostTypeId="2" ParentId="9562" CreationDate="2015-05-14T05:04:19.223" Score="1" Body="&lt;p&gt;It's because of how Craft resolves dynamic paths (paths with {variables}) in them. For freshly created Matrix blocks haven't been saved yet and therefore don't have an {owner} yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a dynamic path cannot be resolved, then Craft will point it to a temporary folder that is unique per user per field, but, as soon as you save the Entry and the Matrix block has an {owner}, it will resolve to where it should and all the Assets from the temporary folder that were selected will be move to the resolved folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Assets that have not been selected will remain in the temporary folder. This also holds true for unsaved Entries if you're using {slug}, for example.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2015-05-14T05:04:19.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9734" PostTypeId="2" ParentId="9728" CreationDate="2015-05-14T05:36:40.243" Score="1" Body="&lt;p&gt;From what I know this isn't possible in Craft2 (it's a known issue). P&amp;amp;T has probably addressed this in Craft3 with the many updates to Assets in that release. &lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-05-14T05:36:40.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9735" PostTypeId="1" AcceptedAnswerId="9736" CreationDate="2015-05-14T09:38:17.423" Score="1" ViewCount="73" Body="&lt;p&gt;I'm needing to allow users who aren't logged in to post new entries, but of course it always redirects to login. Any way I can allow saveEntry to be anonymous, preferably for a single entry type?&lt;/p&gt;&#xA;" OwnerUserId="3658" LastActivityDate="2015-05-14T10:07:06.970" Title="Anonymous saveEntry?" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9736" PostTypeId="2" ParentId="9735" CreationDate="2015-05-14T10:07:06.970" Score="1" Body="&lt;p&gt;saveEntry will always require an authenticated user with the correct permissions to post the entry, but you can use the guest entries plugin from Pixel &amp;amp; Tonic to allow for guest submissions :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-14T10:07:06.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9737" PostTypeId="1" CreationDate="2015-05-14T11:44:53.010" Score="5" ViewCount="801" Body="&lt;p&gt;I am having a problem with record and model attribute types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a frontend user form with some textfields which require a TEXT type field in the database to hold the data. So far I have tried setting the attribute type to String which creates a varchar(255) which isn't big enough to hold the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried Mixed which creates the TEXT type but does not populate the data when the form is submitted. Reading further and based on a previous problem I had I think this is due to the lack of validation on the Mixed attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how do I get my form to submit this data if the attribute I create is causing the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to ignore the Mixed fields data. Or is there another attribute that would work better something like Text?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also what would be useful to know is if there is any resource which describes the different attributes with examples of how to set them up for records and models as I can't seem to find anything that describes this process clearly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-14T12:29:16.513" Title="What attribute type should I set in the record or model to create a TEXT type in the database?" Tags="&lt;models&gt;&lt;records&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9738" PostTypeId="2" ParentId="9737" CreationDate="2015-05-14T12:29:16.513" Score="14" Body="&lt;p&gt;Ok worked out a solution to the attributes. You can set them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text,  'required' =&amp;gt; false)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By defining the column, so hopefully this will help someone else.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-14T12:29:16.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9739" PostTypeId="1" AcceptedAnswerId="9742" CreationDate="2015-05-14T14:56:35.783" Score="2" ViewCount="722" Body="&lt;p&gt;Sorry if this is asked/answered elsewhere. I tried to search for it with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a common group of fields that I want to include in different entry types, and each entry will have unique data entered in the fields. A concrete example is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SEO / Meta&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;meta title&lt;/li&gt;&#xA;&lt;li&gt;meta description&lt;/li&gt;&#xA;&lt;li&gt;meta keywords&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Later on I want to remove the &quot;meta keywords&quot; field from every entry type that has this &quot;field group&quot;. Is there a way — &lt;em&gt;preferably with core Craft abilities&lt;/em&gt; — to set it up so I can update the field group in one place and not have to touch every entry type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A matrix field with max 1 would get the job done but feels plain wrong for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the feeling there is another way I just don't know about yet.&lt;/p&gt;&#xA;" OwnerUserId="2285" LastActivityDate="2015-05-14T15:56:15.153" Title="Is it possible to create a field group that can be modified across entry types?" Tags="&lt;entry-type&gt;&lt;fieldtypes&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9740" PostTypeId="1" CreationDate="2015-05-14T15:06:39.427" Score="2" ViewCount="290" Body="&lt;p&gt;Question: I am at early stages of setting up Craft.  I plan on installing on Apache &amp;amp; IIS to compare.  Anything I should be thinking about as I do this? Reasons one platform is better or worse than the other? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3660" LastActivityDate="2015-05-15T08:45:33.437" Title="Apache vs IIS - reasons for either" Tags="&lt;apache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9741" PostTypeId="1" CreationDate="2015-05-14T15:37:22.570" Score="4" ViewCount="2887" Body="&lt;p&gt;I keep getting the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mydomain.com/craft/storage/runtime isn't writable by PHP. Please fix that.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am running Redhat, and have set the folder permissions to 777, any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="2311" LastEditorUserId="22" LastEditDate="2017-05-10T00:05:10.913" LastActivityDate="2017-05-10T00:05:10.913" Title="runtime isn't writable by PHP. Please fix that" Tags="&lt;error-message&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9742" PostTypeId="2" ParentId="9739" CreationDate="2015-05-14T15:56:15.153" Score="1" Body="&lt;p&gt;No, field groups are just a way to have your fields grouped in the field layout designer and fields index page. Another advantage is the possibility to drag a whole group in the designer to create a new tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approaches, other than a max 1 Matrix field you mentioned, that I can think of are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;multiple predefined rows in a Table field&lt;/li&gt;&#xA;&lt;li&gt;multiple predefined rows in a &lt;a href=&quot;https://github.com/engram-design/SetTable&quot; rel=&quot;nofollow&quot;&gt;Set Table&lt;/a&gt; field, which allows you to have a read only &quot;Label&quot; column and set a max rows&lt;/li&gt;&#xA;&lt;li&gt;custom solution implementing a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;new field type&lt;/a&gt; that has multiple input fields&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-14T15:56:15.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9743" PostTypeId="1" AcceptedAnswerId="9745" CreationDate="2015-05-14T16:37:06.150" Score="3" ViewCount="87" Body="&lt;p&gt;I want to apologize if I'm not asking the question correctly, but basically this is what I want to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this craft.entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('example').limit(10) as entriesOnPage %}&#xA;  {% for entry in entriesOnPage %}&#xA;    &amp;lt;li class=&quot;class-A&quot;&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I insert another list-item with a different class that has to always stay in same position. For this example in the 3rd spot, to look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;class-A&quot;&amp;gt;I'm a title&amp;lt;/li&amp;gt;&#xA;&amp;lt;li class=&quot;class-A&quot;&amp;gt;I'm a title&amp;lt;/li&amp;gt;&#xA;&amp;lt;li class=&quot;class-B&quot;&amp;gt;I'm am different&amp;lt;/li&amp;gt;&#xA;&amp;lt;li class=&quot;class-A&quot;&amp;gt;I'm a title&amp;lt;/li&amp;gt;&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once again, I apologize if I'm not using the right terms, but hopefully the code can explain it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2015-05-14T17:09:02.900" Title="How do I insert a special entry into a sections list?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sorting&gt;&lt;custom&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9744" PostTypeId="1" AcceptedAnswerId="9757" CreationDate="2015-05-14T16:43:17.577" Score="2" ViewCount="486" Body="&lt;p&gt;I am trying to set the locale in the index.php file using&lt;br&gt;&#xA;&lt;code&gt;define(&quot;CRAFT_LOCALE&quot;, &quot;de&quot;);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is causing an error:&lt;br&gt;&#xA;array_merge(): Argument #2 is not an array&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i take the define out, then the site works fine, except in the default locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be awesome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#0  &#xA; unknown(0): CApplication-&amp;gt;handleError(2, &quot;array_merge(): Argument #2 is not an array&quot;, &quot;/Applications/MAMP/htdocs/craft/app/etc/i18n/PhpMessageSource.ph...&quot;, 70, ...)&#xA;#1  &#xA;+  /Applications/MAMP/htdocs/craft/app/etc/i18n/PhpMessageSource.php(70): array_merge(array(&quot;A PHP extension stopped the file upload.&quot; =&amp;gt; &quot;Der Datei-Upload wurde von einer PHP-Erweiterung angehalten.&quot;, &quot;CSecurityManager::generateRandomString() cannot generate random string in the current environment.&quot; =&amp;gt; &quot;CSecurityManager::generateRandomString() ist auf diesem System n...&quot;, &quot;Only SHA1 and MD5 hashing algorithms are supported when using PHP 5.1.1 or below.&quot; =&amp;gt; &quot;PHP 5.1.1 oder kleiner unterstützt nur die Hashing-Algorithmen ...&quot;, &quot;Script HTML options are not allowed for &quot;CClientScript::POS_LOAD&quot; and &quot;CClientScript::POS_READY&quot;.&quot; =&amp;gt; &quot;Für &quot;CClientScript::POS_LOAD&quot; and &quot;CClientScript::POS_READY&quot; is...&quot;, ...), 1)&#xA;#2  &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/i18n/CMessageSource.php(103): Craft\PhpMessageSource-&amp;gt;loadMessages(&quot;yii&quot;, &quot;de&quot;)&#xA;#3  &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/i18n/CMessageSource.php(85): CMessageSource-&amp;gt;translateMessage(&quot;yii&quot;, &quot;Property &quot;{class}.{property}&quot; is not defined.&quot;, &quot;de&quot;)&#xA;#4  &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/YiiBase.php(585): CMessageSource-&amp;gt;translate(&quot;yii&quot;, &quot;Property &quot;{class}.{property}&quot; is not defined.&quot;, null)&#xA;#5  &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/base/CComponent.php(131): YiiBase::t(&quot;yii&quot;, &quot;Property &quot;{class}.{property}&quot; is not defined.&quot;, array(&quot;{class}&quot; =&amp;gt; &quot;Craft\EntryModel&quot;, &quot;{property}&quot; =&amp;gt; &quot;bannerHeading&quot;))&#xA;#6  &#xA;+  /Applications/MAMP/htdocs/craft/app/models/BaseModel.php(87): CComponent-&amp;gt;__get(&quot;bannerHeading&quot;)&#xA;#7  &#xA;+  /Applications/MAMP/htdocs/craft/app/models/BaseElementModel.php(136): Craft\BaseModel-&amp;gt;__get(&quot;bannerHeading&quot;)&#xA;#8  &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/base/CModel.php(596): Craft\BaseElementModel-&amp;gt;__get(&quot;bannerHeading&quot;)&#xA;#9  &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(365): CModel-&amp;gt;offsetGet(&quot;bannerHeading&quot;)&#xA;#10 &#xA;+  /Applications/MAMP/htdocs/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Craft\EntryModel, &quot;bannerHeading&quot;, array(), &quot;any&quot;, ...)&#xA;#11 &#xA;+  /Applications/MAMP/htdocs/craft/storage/runtime/compiled_templates/1b/87/50f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5.php(34): Craft\BaseTemplate-&amp;gt;getAttribute(Craft\EntryModel, &quot;bannerHeading&quot;, array())&#xA;#12 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5-&amp;gt;block_content(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#13 &#xA;+  /Applications/MAMP/htdocs/craft/storage/runtime/compiled_templates/e2/48/edc3e9732159262e50359543af294ec04d2fbb2fecd5c02c3c6070bad1a9.php(115): Twig_Template-&amp;gt;displayBlock(&quot;content&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#14 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_e248edc3e9732159262e50359543af294ec04d2fbb2fecd5c02c3c6070bad1a9-&amp;gt;doDisplay(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#15 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#16 &#xA;+  /Applications/MAMP/htdocs/craft/storage/runtime/compiled_templates/1b/87/50f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5.php(26): Twig_Template-&amp;gt;display(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#17 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5-&amp;gt;doDisplay(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#18 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_1b8750f950fbf3fbcf1358ed32a1bf140e55bf6f0b6c9f33524bc9cffb0ce2e5, &quot;block_content&quot;)))&#xA;#19 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#20 &#xA;+  /Applications/MAMP/htdocs/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#21 &#xA;+  /Applications/MAMP/htdocs/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render(&quot;_pages/home&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#22 &#xA;+  /Applications/MAMP/htdocs/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render(&quot;_pages/home&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#23 &#xA;+  /Applications/MAMP/htdocs/craft/app/controllers/TemplatesController.php(55): Craft\BaseController-&amp;gt;renderTemplate(&quot;_pages/home&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#24 &#xA; unknown(0): Craft\TemplatesController-&amp;gt;actionRender(&quot;_pages/home&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#25 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/actions/CAction.php(108): ReflectionMethod-&amp;gt;invokeArgs(Craft\TemplatesController, array(&quot;_pages/home&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel)))&#xA;#26 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Craft\TemplatesController, ReflectionMethod, array(&quot;variables&quot; =&amp;gt; array(&quot;entry&quot; =&amp;gt; Craft\EntryModel), &quot;template&quot; =&amp;gt; &quot;_pages/home&quot;))&#xA;#27 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;variables&quot; =&amp;gt; array(&quot;entry&quot; =&amp;gt; Craft\EntryModel), &quot;template&quot; =&amp;gt; &quot;_pages/home&quot;))&#xA;#28 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(CInlineAction)&#xA;#29 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(CInlineAction, array())&#xA;#30 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run(&quot;render&quot;)&#xA;#31 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController(&quot;templates/render&quot;)&#xA;#32 &#xA;+  /Applications/MAMP/htdocs/craft/app/etc/web/WebApp.php(266): CWebApplication-&amp;gt;processRequest()&#xA;#33 &#xA;+  /Applications/MAMP/htdocs/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#34 &#xA;+  /Applications/MAMP/htdocs/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#35 &#xA;+  /Applications/MAMP/htdocs/public/de/index.php(22): require_once(&quot;/Applications/MAMP/htdocs/craft/app/index.php&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2184" LastEditorUserId="2184" LastEditDate="2015-05-15T08:10:27.663" LastActivityDate="2015-05-15T11:08:48.327" Title="define CRAFT_LOCALE causing error" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9745" PostTypeId="2" ParentId="9743" CreationDate="2015-05-14T16:44:35.520" Score="3" Body="&lt;p&gt;There's a special &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;loop&lt;/code&gt;&lt;/a&gt; variable available in for loops which provides info about the iteration.&#xA;In your case you'd just insert that list item after the 2nd iteration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entriesOnPage %}&#xA;    &amp;lt;li class=&quot;class-A&quot;&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;&#xA;    {% if loop.index == 2 %}&#xA;        &amp;lt;li class=&quot;class-B&quot;&amp;gt;I'm am different&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to do this only on select pagination pages, you'd additionally compare  against the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#the-paginate-variable&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;paginate&lt;/code&gt;&lt;/a&gt; variable available in between &lt;code&gt;paginate&lt;/code&gt; tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index == 2 and paginate.currentPage == 12 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-14T17:09:02.900" LastActivityDate="2015-05-14T17:09:02.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9746" PostTypeId="2" ParentId="9743" CreationDate="2015-05-14T16:55:32.407" Score="1" Body="&lt;p&gt;You could add a new entry type to your &quot;example&quot; section with a single field of type entries field and use that to &quot;pull in&quot; your special entry into your section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within your entries loop you can check for the entry's entry type to switch classes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set class = entry.type == 'special' ? 'class-B' : 'class-A' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or to include different template partials:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/example_index/' ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-14T17:07:05.397" LastActivityDate="2015-05-14T17:07:05.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9747" PostTypeId="1" AcceptedAnswerId="9748" CreationDate="2015-05-14T17:37:47.253" Score="2" ViewCount="520" Body="&lt;p&gt;I've looped through individual category groups to find each parent/child category, but is there a way to loop through and only show Category Group names?&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2015-05-14T17:46:50.003" LastActivityDate="2015-05-14T20:57:47.373" Title="Loop through category groups" Tags="&lt;categories&gt;&lt;category&gt;&lt;group&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9748" PostTypeId="2" ParentId="9747" CreationDate="2015-05-14T20:52:09.310" Score="3" Body="&lt;p&gt;I'm not seeing any obvious ways to access groups directly in Twig. There may be a more direct way, idk — but this should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryGroupNames = [] %}&#xA;{% for category in craft.categories %}&#xA;    {% set groupName = category.getGroup.name %}&#xA;    {% if groupName not in categoryGroupNames %}&#xA;        {% set categoryGroupNames = categoryGroupNames|merge([groupName]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for groupName in categoryGroupNames %}&#xA;    {{ groupName }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-14T20:57:47.373" LastActivityDate="2015-05-14T20:57:47.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9749" PostTypeId="1" CreationDate="2015-05-14T22:09:16.187" Score="3" ViewCount="1054" Body="&lt;p&gt;I have an for entry loop in which I need to look for two different field conditions. Separately they are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.eventStartDate('&amp;gt;=' ~ (now.date))&#xA;&#xA;craft.entries.genericEventDate(':notempty:’)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I ask craft to look to see if &lt;strong&gt;either&lt;/strong&gt; of these parameters is true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A work around is to pull the query without these paramaters and then run an if statement like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.eventStartDate &amp;gt;= now.date or entry.genericEventDate is not empty %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works but it's not really ideal since the query is pulling more entries than necessary.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2015-05-15T16:56:58.803" LastActivityDate="2015-05-15T20:18:01.597" Title="Multiple craft.entries field parameters" Tags="&lt;entries&gt;&lt;entries-field&gt;&lt;params&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9750" PostTypeId="1" AcceptedAnswerId="9768" CreationDate="2015-05-15T03:26:50.473" Score="2" ViewCount="640" Body="&lt;p&gt;How do you handle “catching” errors in a plugin service and return the error to&#xA;the plugins controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more specific... I am sending an Ajax request to a controller, that controller is performing a few checks (is the user logged in for example, if not logged in - return a json response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the below &lt;code&gt;controller&lt;/code&gt; code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyController($elementId)&#xA;{&#xA;    if ($this-&amp;gt;notLoggedIn()) {&#xA;        return;&#xA;    }&#xA;}&#xA;&#xA;protected function notLoggedIn()&#xA;{&#xA;    if (!craft()-&amp;gt;userSession) {&#xA;        return $this-&amp;gt;returnJson('You must be logged in!');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when those conditions are met the data is passed to the plugin service. In this case &lt;code&gt;$elementId&lt;/code&gt; and &lt;code&gt;$userId&lt;/code&gt;. Before creating the record, I'm performing additional checks on the data. When those checks fail, it should return additional JSON responses to the controller to display on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the below &lt;code&gt;service&lt;/code&gt; code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveThing($elementId, $userId)&#xA;{&#xA;    $this-&amp;gt;validateUser($userId);&#xA;&#xA;    $this-&amp;gt;validateElement($elementId);&#xA;&#xA;    // populate the model&#xA;&#xA;    // save the record and etc.&#xA;&#xA;}&#xA;&#xA;protected function validateUser($userId)&#xA;{&#xA;    if ($userId == craft()-&amp;gt;getUser()-&amp;gt;id) {&#xA;        return true;&#xA;    }&#xA;&#xA;    // return json to the controller?&#xA;}&#xA;&#xA;protected function validateElement($elementId)&#xA;{&#xA;    $element = craft()-&amp;gt;elements-&amp;gt;getElementById($elementId);&#xA;&#xA;    if (is_null($element)) {&#xA;        // return json to the controller?&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So when the conditionals fail on the service, we need to return a response to the controller. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="41" LastEditDate="2015-05-15T03:36:42.033" LastActivityDate="2015-05-15T16:32:36.757" Title="How to catch errors in a service and return to a controller?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;services&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9751" PostTypeId="2" ParentId="9749" CreationDate="2015-05-15T05:29:35.517" Score="1" Body="&lt;p&gt;Hmm, I can't think of how you would do this in Twig. But you may want to jump into PHP and perform your query a little more manually... &lt;a href=&quot;https://craftcms.stackexchange.com/a/723/45&quot;&gt;This answer&lt;/a&gt; provides a few good ways to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I'd take a look into either a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom variable&lt;/a&gt; or a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;template hook&lt;/a&gt;. I'm personally a huge fan of the &lt;strong&gt;template hook&lt;/strong&gt;... it feels like unlimited power in a tiny package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you're in PHP, you can use Craft's &lt;code&gt;buildElementsQuery&lt;/code&gt; along with Yii's &lt;code&gt;DbCommand&lt;/code&gt; to generate your own complex query. For a rough example, check out &lt;a href=&quot;https://craftcms.stackexchange.com/q/2786/45&quot;&gt;this question and answer...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-15T05:29:35.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9752" PostTypeId="1" AcceptedAnswerId="9760" CreationDate="2015-05-15T07:05:19.970" Score="3" ViewCount="379" Body="&lt;p&gt;I'm having a problem with my ajax-loading when I'm on the english version of my page (My main language is Norwegian). I have a file named loadmore.html that I'm loading in on index.html when pressing a button. The problem is that this page won't show me the English version when I'm on the english version of the site. I really appreciate all your help. There's my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.showmemore_inner h2').on(&quot;click&quot;, function(e){&#xA;    $('.third_article_module').load('/loadmore.html');&#xA;    $('h2.lasterinn').css('display', 'block');&#xA;    return false;&#xA;    e.preventDefault();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loadmore.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;div class=&quot;older_articles_container older_articles_loadmore&quot;&amp;gt;&#xA;        {% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}&#xA;        &amp;lt;div class=&quot;ajax_article&quot; data-id='{{ entry.id }}'&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;            {% for block in entry.bildekarusell.limit(1) %}&#xA;                {% if block.type == &quot;bilde&quot; %}&#xA;                    &amp;lt;div id=&quot;img_blocks&quot;&amp;gt;&#xA;                        {% for image in block.bilde %}&#xA;                        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                            &amp;lt;picture&amp;gt;&#xA;                                &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;video style=&quot;display: none;&quot;&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;                                &amp;lt;source srcset=&quot;{{ image.getUrl('hovedsideSekscolBilde') }}&quot; media=&quot;(min-width: 990px)&quot;&amp;gt;&#xA;                                &amp;lt;source srcset=&quot;{{ image.getUrl('hovedsideSekscolBilde2') }}&quot; media=&quot;(max-width: 990px) and (min-width: 625px)&quot;&amp;gt;&#xA;                                &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;/video&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;                                &amp;lt;img srcset=&quot;{{ image.getUrl('hovedsideSekscolBildeMobil') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;                            &amp;lt;/picture&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}    &#xA;            {% endfor %}&#xA;            &amp;lt;/li&amp;gt;&#xA;            &amp;lt;div class=&quot;group_sixcol&quot;&amp;gt;&#xA;                &amp;lt;li&amp;gt;&#xA;                    {% for category in entry.kategorier %}&#xA;                        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;                    {% endfor %} &#xA;                &amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;span class=&quot;time&quot;&amp;gt;{{ entry.postDate|date(&quot;M Y&quot;) }}&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I tried this code in my _layout.html file but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    $('.showmemore_inner h2').on(&quot;click&quot;, function(e){&#xA;        if ( '{{ craft.i18n.getCurrentLocale() }}' == '{{ craft.i18n.getPrimarySiteLocale() }}' {&#xA;            var url = '/loadmore.html';&#xA;        } else {&#xA;            var url = '/loadmore.html{{ craft.i18n.getCurrentLocale() }}/';&#xA;        }&#xA;&#xA;        $('.third_article_module').load(url);&#xA;        $('h2.lasterinn').css('display', 'block');&#xA;        return false;&#xA;        e.preventDefault();&#xA;    });            &#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3581" LastEditorUserId="3581" LastEditDate="2015-05-15T07:35:39.090" LastActivityDate="2015-05-15T19:08:31.227" Title="Load correct language Ajax" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;ajax&gt;&lt;language&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9753" PostTypeId="1" AcceptedAnswerId="9764" CreationDate="2015-05-15T07:18:26.210" Score="1" ViewCount="195" Body="&lt;p&gt;I want to migrate some entries and its content to a new table in our plugin. Below is a simplified SQL that seems to do the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;insert into craft_myplugintable(id, field1, field2, field3, dateCreated, dateUpdated, uid)&#xA;select entries.id, content.field_field1, content.field_field2, content.field_field3, entries.dateCreated, entries.dateUpdated, entries.uid&#xA;from craft_elements elements&#xA;  join craft_entries entries on elements.id = entries.id&#xA;  join craft_entrytypes types on entries.typeId = types.id&#xA;  join craft_content content on entries.id = content.elementId&#xA;where types.handle = 'mySection';&#xA;&#xA;update craft_elements elements&#xA;  join craft_myplugintable myplugin on elements.id = myplugin.id&#xA;set type = 'Plugin_ElementType';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this method safe? Should i use a migration file and let craft set the UID? I'm not sure what the UID field is for. Keep in mind that we no longer need the entries, so they can be deleted if this is wrong.&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-05-15T14:57:18.160" Title="Migrating entries to custom element and UID" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9754" PostTypeId="2" ParentId="9749" CreationDate="2015-05-15T08:00:10.337" Score="0" Body="&lt;p&gt;I may be wrong here as only just started learning Craft and its template system but would this not work? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (&#xA;&#xA;    craft.entries.eventStartDate|date('U') &amp;gt;= now|date('U')&#xA;    or&#xA;    craft.entries.genericEventDate != &quot;&quot;&#xA;)&#xA;%}&#xA;&#xA;&amp;lt;p&amp;gt;Show this text!!&amp;lt;/p&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="3631" LastEditDate="2015-05-15T14:37:21.943" LastActivityDate="2015-05-15T14:37:21.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9755" PostTypeId="2" ParentId="9740" CreationDate="2015-05-15T08:45:33.437" Score="3" Body="&lt;p&gt;Apache is generally hosted on Linux which the vast majority of web hosting services use. IIS is Microsofts platform and is much more difficult to set up as well as less common with hosting providers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just use Apache.&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-05-15T08:45:33.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9756" PostTypeId="1" AcceptedAnswerId="9759" CreationDate="2015-05-15T09:34:53.527" Score="8" ViewCount="8865" Body="&lt;p&gt;I want to calculate the remaining days between the current day (now) and a future date set as a date field in {{ inschrijven.datumEvenement }} globals&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ inschrijven.datumEvenement.diff(now).format('%d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I came up with but it doesn't generate the right number of days left. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using now = 05-15-2015, inschrijven.datumEvenement = 08-30-2015 the above tag generates &quot;14&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2016-08-22T08:51:31.377" Title="How to calculate the number of days left?" Tags="&lt;datetime&gt;&lt;globals&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9757" PostTypeId="2" ParentId="9744" CreationDate="2015-05-15T11:08:48.327" Score="4" Body="&lt;p&gt;Solved the problem, so answering for anyone else who has the same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error was due to having a blank translation file in &lt;code&gt;/craft/translations/de.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I populated that (or removed it), it was all fine.&lt;/p&gt;&#xA;" OwnerUserId="2184" LastActivityDate="2015-05-15T11:08:48.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9758" PostTypeId="2" ParentId="9756" CreationDate="2015-05-15T13:09:19.947" Score="2" Body="&lt;p&gt;This makes sense. The output of &quot;diff&quot; is a date object and you are requesting the days of the formatted date (03-15-0000), in this case 15 days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to extract the days from the object rather than from the formatted date.&#xA;Try...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{{ inschrijven.datumEvenement.diff(now).days }}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-05-15T13:09:19.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9759" PostTypeId="2" ParentId="9756" CreationDate="2015-05-15T13:11:54.207" Score="8" Body="&lt;p&gt;You want to use &quot;a&quot; as your &lt;a href=&quot;http://php.net/DateInterval.format&quot; rel=&quot;noreferrer&quot;&gt;DateInterval format parameter&lt;/a&gt; instead of &quot;d&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you may need to use &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/date.html&quot; rel=&quot;noreferrer&quot;&gt;Twig's date function&lt;/a&gt; on the end date, which &quot;converts an argument to a date to allow date comparison&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should give you the correct number of days between now and the future date:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date( inschrijven.datumEvenement|date ).diff( now ).format('%a') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date( inschrijven.datumEvenement|date ).diff( now ).days }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2015-05-15T22:55:26.550" LastActivityDate="2015-05-15T22:55:26.550" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9760" PostTypeId="2" ParentId="9752" CreationDate="2015-05-15T13:35:11.203" Score="2" Body="&lt;p&gt;One issue may be that your javascript is requesting a specific url as defined from the site root, thus not giving craft the opportunity to do it's locale routing magic (keep in mind the url for languages other than the default locale may actually be '/no/loadmore.html' — or however you have defined the locale routes in your config settings). So just changing the request url in javascript may solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.third_article_module').load('loadmore');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another thing to keep in mind in general is that you can always specify a locale as part of the query, if you ever need to bypass or override craft's locale routing for some reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;{% set entries = craft.entries.section('artikkel').locale(locale).order('dateCreated desc') %}&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another thing worth mentioning is that you could potentially also ajax load content from the current page template by using an &lt;code&gt;isAjax&lt;/code&gt; conditional, thus eliminating the need for a separate 'loadmore' template altogether.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax %}&#xA;    {# render page content #}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.isAjax %}&#xA;    {# render loadmore content #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then just pass the entry url to your javascript and ajax load the current page (in this case I'm passing the url by defining a 'data-url' attribute on the &lt;code&gt;.showmemore_inner h2&lt;/code&gt; dom element; i.e. &lt;code&gt;&amp;lt;h2 data-url=&quot;{{ entry.url }}&quot;&amp;gt;&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.showmemore_inner h2').on(&quot;click&quot;, function(e){&#xA;    e.preventDefault();&#xA;    var url = $(this).attr('data-url');&#xA;    $('.third_article_module').load(url);&#xA;    $('h2.lasterinn').css('display', 'block');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: also &lt;code&gt;e.preventDefault()&lt;/code&gt; should come before any &lt;code&gt;return&lt;/code&gt; statement or else it will never get a chance to fire.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-05-15T13:35:11.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9761" PostTypeId="1" CreationDate="2015-05-15T14:05:41.993" Score="0" ViewCount="179" Body="&lt;p&gt;I have an upload form working in my templates (on the frontend), however if I try to upload a file with the same name as an existing asset the file isn't uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice instead a prompt message comes back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I'm not sure how to deal with this, I presume some AJAX call is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I would prefer it if I could send a value which tells Craft to keep both files without prompting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way of handling this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I've tried is below, using jquery fileupload.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = '/actions/assets/uploadFile',&#xA;    uploadButton = $('&amp;lt;button/&amp;gt;')&#xA;        .addClass('btn btn-primary')&#xA;        .prop('disabled', true)&#xA;        .text('Processing...')&#xA;        .on('click', function () {&#xA;            var $this = $(this),&#xA;                data = $this.data();&#xA;            $this&#xA;                .off('click')&#xA;                .text('Abort')&#xA;                .on('click', function () {&#xA;                    $this.remove();&#xA;                    data.abort();&#xA;                });&#xA;            data.submit().always(function () {&#xA;                $this.remove();&#xA;            });&#xA;        });&#xA;&#xA;$('#images-upload').fileupload({&#xA;    url: url,&#xA;    dataType: 'json',&#xA;    formData: [&#xA;        { name: 'folderId', value: 1 }&#xA;    ],&#xA;    autoUpload: true,&#xA;    acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,&#xA;    maxFileSize: 7000000, // 7 MB&#xA;    // Enable image resizing, except for Android and Opera,&#xA;    // which actually support image resizing, but fail to&#xA;    // send Blob objects via XHR requests:&#xA;    disableImageResize: /Android(?!.*Chrome)|Opera/&#xA;        .test(window.navigator.userAgent),&#xA;    previewMaxWidth: 100,&#xA;    previewMaxHeight: 100,&#xA;    previewCrop: true,&#xA;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And also&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    window.csrfTokenName = &quot;{{ craft.config.get('csrfTokenName') }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.request.getCsrfToken }}&quot;;&#xA;&#xA;&#xA;var url = '/actions/assets/expressUpload',&#xA;    uploadButton = $('&amp;lt;button/&amp;gt;')&#xA;        .addClass('btn btn-primary')&#xA;        .prop('disabled', true)&#xA;        .text('Processing...')&#xA;        .on('click', function () {&#xA;            var $this = $(this),&#xA;                data = $this.data();&#xA;            $this&#xA;                .off('click')&#xA;                .text('Abort')&#xA;                .on('click', function () {&#xA;                    $this.remove();&#xA;                    data.abort();&#xA;                });&#xA;            data.submit().always(function () {&#xA;                $this.remove();&#xA;            });&#xA;        });&#xA;&#xA;$('#images-upload').fileupload({&#xA;    url: url,&#xA;    dataType: 'json',&#xA;    formData: [&#xA;        { name: 'elementId', value: $('input[name=entryId]').val() }, &#xA;        { name: 'fieldId', value: 8 },&#xA;        { name: window.csrfTokenName, value: window.csrfTokenValue }&#xA;    ],&#xA;    autoUpload: true,&#xA;    acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,&#xA;    maxFileSize: 7000000, // 7 MB&#xA;    // Enable image resizing, except for Android and Opera,&#xA;    // which actually support image resizing, but fail to&#xA;    // send Blob objects via XHR requests:&#xA;    disableImageResize: /Android(?!.*Chrome)|Opera/&#xA;        .test(window.navigator.userAgent),&#xA;    previewMaxWidth: 100,&#xA;    previewMaxHeight: 100,&#xA;    previewCrop: true,&#xA;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="426" LastEditorUserId="426" LastEditDate="2015-05-15T14:39:50.337" LastActivityDate="2015-05-15T15:08:53.130" Title="Allow uploading of asset with same name as existing asset" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9762" PostTypeId="2" ParentId="9761" CreationDate="2015-05-15T14:16:49.180" Score="2" Body="&lt;p&gt;I haven't tested this but from a brief look into how assets are uploaded you might be able to pass a &lt;code&gt;userResponse&lt;/code&gt; value through post, it seems the options you can pass are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;keepBoth&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, &lt;code&gt;cancel&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I guess you would need to include the field in the form you are using to upload the asset like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userResponse&quot; value=&quot;keepBoth&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I said I haven't tried this before and i'm assuming you're hitting the &lt;code&gt;UploadFile&lt;/code&gt; action on the assets controller...&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-15T14:16:49.180" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9763" PostTypeId="1" AcceptedAnswerId="9773" CreationDate="2015-05-15T14:52:27.730" Score="5" ViewCount="1446" Body="&lt;p&gt;I will build a group site in craft which will have the main domain and multiple sub domains.&#xA;e.g. &#xA;domain.com&#xA;property.domain.com&#xA;connect.domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The news feed on each sub domain will be different but it will all display on the main domain news feed. The site build etc for each will be similar but content will be different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to set this up in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the following something which can be done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use Multi Environment Config to set the SiteURL for each domain.&#xA;Point all the domain/sub domains to the 1 public folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my main _layout.html template file detect what the siteurl is and based on that include different header and footer files for each sub domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same news template files can then be used. &#xA;And just use a different structure for the nav on each sub domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that workable and the best way to do it or should I be having different root folders for each sub domain?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-05-15T21:08:38.917" Title="Site set up with mutiple sub domains" Tags="&lt;multi-environment&gt;&lt;multi-domain&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9764" PostTypeId="2" ParentId="9753" CreationDate="2015-05-15T14:57:18.160" Score="1" Body="&lt;p&gt;If you want to be future-proof, then yes - you should create a new UUID for each new row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use MySQL's &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_uuid&quot; rel=&quot;nofollow&quot;&gt;uuid()&lt;/a&gt; method for that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-15T14:57:18.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9765" PostTypeId="2" ParentId="9761" CreationDate="2015-05-15T15:08:53.130" Score="1" Body="&lt;p&gt;Turns out the original code was working fine and uploading the asset. It just wasn't returning a 'data.result.success' value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you still get the fileId... so just check for that instead :)&lt;/p&gt;&#xA;" OwnerUserId="426" LastActivityDate="2015-05-15T15:08:53.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9766" PostTypeId="1" CreationDate="2015-05-15T15:11:50.190" Score="1" ViewCount="164" Body="&lt;p&gt;just bought the Sprout Business Collection since i've been playing around with Sprout forms during the beta periode and now needed to implement email features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem i'm running into. After installation i tried to create a new notification. First screen no problem. Enter name, template, field layout. After saving the ADD NOTIFICATION ENTRY button appears. But clicking that gives me the following error (translated from dutch so possibly not exact).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attribute &quot;Craft\WebApp.userGroups&quot; is not defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you'll find a link to the craft.log since it contained more detailed information about the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/svebqtfgppnhvug/sprout_email_error_craft.log?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/svebqtfgppnhvug/sprout_email_error_craft.log?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bas&lt;/p&gt;&#xA;" OwnerUserId="3617" LastEditorUserId="115" LastEditDate="2015-05-15T16:54:42.427" LastActivityDate="2015-06-28T18:21:58.127" Title="Sprout Email: Notification unable to create &quot;Craft\WebApp.userGroups" Tags="&lt;emails&gt;&lt;error&gt;&lt;plugin-sproutemail&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9767" PostTypeId="2" ParentId="9766" CreationDate="2015-05-15T15:37:48.383" Score="1" Body="&lt;p&gt;Looks like it needs Craft Pro and you're running either Personal or Client which don't have user groups.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-05-15T15:37:48.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9768" PostTypeId="2" ParentId="9750" CreationDate="2015-05-15T16:32:36.757" Score="4" Body="&lt;p&gt;There are several ways you could go about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One that I tend to prefer is to go ahead and have your controller grab whatever data it needs from POST and populate a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Model&lt;/a&gt; with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That model is what gets passed into your service layer.  Your service layer can run validation on the model (if any validation fails, you can retrieve the errors with &lt;code&gt;$model-&amp;gt;getErrors()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can perform any additional custom logic and if any of that fails, use &lt;code&gt;$model-&amp;gt;addError()&lt;/code&gt; and return false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the model will have been passed in by reference, your controller can see that false was returned and call &lt;code&gt;$model-&amp;gt;getErrors()&lt;/code&gt;, format those however you need and use &lt;code&gt;$this-&amp;gt;returnJson($myErrors)&lt;/code&gt; to send the errors back to the browser as JSON.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-15T16:32:36.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9770" PostTypeId="2" ParentId="9749" CreationDate="2015-05-15T20:18:01.597" Score="2" Body="&lt;p&gt;The only possible core solution to query for these entries in Twig is to query for entry IDs first, process them with &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; and then pass the IDs to the &lt;code&gt;id&lt;/code&gt; parameter of a new ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than your solution implementing a conditional in the for loop this works with &lt;code&gt;paginate&lt;/code&gt; and &lt;code&gt;getNext&lt;/code&gt; tags, you only query for the entry models you're after, but the cost of this is the extra queries you need to get the IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set futureEventsIds = craft.entries.eventStartDate('&amp;gt;=' ~ (now.date)).ids() %}&#xA;{% set specialEventsIds = craft.entries.genericEventDate(':notempty:').ids() %}&#xA;{% set idParam = futureEventsIds|merge(specialEventsIds) %}&#xA;&#xA;{% set allEvents = craft.entries.id(idParam).order('GREATEST(eventStartDate, genericEventDate) desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-15T20:18:01.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9771" PostTypeId="2" ParentId="1831" CreationDate="2015-05-15T20:35:54.520" Score="12" Body="&lt;p&gt;A simpler way to do this might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2285" LastActivityDate="2015-05-15T20:35:54.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9772" PostTypeId="1" AcceptedAnswerId="9774" CreationDate="2015-05-15T20:43:32.360" Score="5" ViewCount="2702" Body="&lt;p&gt;is there any resource that list all the steps to publish a local finished website to the final server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="344" LastEditDate="2015-05-27T14:18:16.970" LastActivityDate="2015-05-27T14:18:16.970" Title="Steps to publish a craft website from local to server" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9773" PostTypeId="2" ParentId="9763" CreationDate="2015-05-15T21:08:38.917" Score="3" Body="&lt;p&gt;The approach you described is interesting and should actually work. Separate root folders would allow you to define the template folders individually (→ see &lt;a href=&quot;https://craftcms.stackexchange.com/a/4739/125&quot;&gt;Ben's answer&lt;/a&gt; on how to set this up), but it looks like that's not what you need and your subdomains are more part of one and the same site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even with multiple root and template folders you could still include shared template partials, but sharing CSS, JS and assets would be troublesome. But, then again, more easy to have these individually for each subdomain.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-15T21:08:38.917" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9774" PostTypeId="2" ParentId="9772" CreationDate="2015-05-15T21:11:50.093" Score="5" Body="&lt;p&gt;It probably depends most on your hosting but following these instructions are probably your best bet: &lt;a href=&quot;http://buildwithcraft.com/docs/installing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/installing&lt;/a&gt; The only exception being instead of &quot;installing&quot; you'd move your files up and import your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using github, it's as easy as &quot;pulling&quot; your code to your production server and importing the database into production database as well (local mysql, cloud db etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably be best off looking at &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt; so you can create settings for both your local environment and production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's an example of a sample craft database file:&lt;/strong&gt; &lt;a href=&quot;https://gist.github.com/mccombs/5e17c84743a25dafddb9&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/mccombs/5e17c84743a25dafddb9&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's an example of a sample craft general config file:&lt;/strong&gt;&#xA;&lt;a href=&quot;https://gist.github.com/mccombs/b6a161cabc064d1f51b3&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/mccombs/b6a161cabc064d1f51b3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="67" LastEditDate="2015-05-17T01:37:45.570" LastActivityDate="2015-05-17T01:37:45.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9775" PostTypeId="1" CreationDate="2015-05-16T06:54:14.593" Score="3" ViewCount="259" Body="&lt;p&gt;I have a plugin which&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;uploads one or more files&lt;/li&gt;&#xA;&lt;li&gt;creates a new entry with those files as new assets in a subfolder whose name is the new entry's slug&lt;/li&gt;&#xA;&lt;li&gt;sends e-mail which includes links to the new assets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that the url for the new assets is not their final url (in the subfolder), but &lt;code&gt;/cpresources/tempassets/field_###/filename&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant bit of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA;  // send the e-mail&#xA;  ... here when I send the e-mail, the url is wrong ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I need to do after the &lt;code&gt;saveEntry&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-05-18T07:33:01.703" Title="Plugin uploads an asset, need the final url" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9776" PostTypeId="1" CreationDate="2015-05-16T10:45:46.923" Score="3" ViewCount="958" Body="&lt;p&gt;I have an existing ExpressionEngine site which I'm looking at moving to using Craft instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only really had a quick cursory glance at the system so far but a little confused on a few things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have top level menu with items such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home&#xA;Services&#xA;Company&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance let's say in the services menu there are some subpages such as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Service 1&#xA;Service 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so on and so forth. On the existing site we are using the Structure module which allowed each of those services to have a url such as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mysite.com/services/service_1&quot; rel=&quot;nofollow&quot;&gt;http://www.mysite.com/services/service_1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so on. That's all fine so far as long as each item in that menu is a service. Now let's say for arguments sake that we want a standard informational page thrown into that menu. From what I see so far with Craft (really hoping I'm wrong on this though) if I create say an information section and then link to that in my navigation then I'm going to end up with something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mysite.com/information/my_information_page&quot; rel=&quot;nofollow&quot;&gt;http://www.mysite.com/information/my_information_page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to end up with however would be :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mysite.com/services/my_information_page&quot; rel=&quot;nofollow&quot;&gt;http://www.mysite.com/services/my_information_page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes more sense to me with the menus and URLs for people to remember. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I must be missing something obvious here but just not quite seeing what yet? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is just a very literal example but the whole site is like this in that the subsections can contain any kind of content but they still follow a good URL scheme. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help with this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best wishes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-16T21:51:25.607" Title="Custom navigation URLs?" Tags="&lt;url&gt;&lt;navigation&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9777" PostTypeId="2" ParentId="9776" CreationDate="2015-05-16T12:03:18.747" Score="3" Body="&lt;p&gt;I think you're looking for &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;entry types&lt;/a&gt; - when you open a new 'services' entry you could pick from &quot;service&quot; or &quot;service-information&quot; entry types. Each entry type has it's own field layouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would mean your URLs can follow the same structure without writing new routes etc.&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2015-05-16T12:03:18.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9778" PostTypeId="2" ParentId="9776" CreationDate="2015-05-16T12:16:47.463" Score="2" Body="&lt;p&gt;&lt;strong&gt;The closest thing to EE's Structure module in Craft would be to build your site using a single Structure section w/ multiple entry types, and to set the URL format for that section to&lt;/strong&gt; &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AFAIK, this is the only way to achieve both a site-wide, global hierarchy encompassing all content, as well as a uniform, hierarchical URL format for any content type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Obviously though, dumping all your content in a single Section might not be ideal (depending on the complexity of your site).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach – and this is the one I'd recommend – would be to create a separate &quot;Navigation&quot; or &quot;Site structure&quot; section with an Entry field (or use a plugin like &lt;a href=&quot;https://github.com/am-impact/amnav&quot; rel=&quot;nofollow&quot;&gt;A&amp;amp;M Nav&lt;/a&gt; or &lt;a href=&quot;https://github.com/familiar-studio/craft-menus&quot; rel=&quot;nofollow&quot;&gt;Menus&lt;/a&gt;, which basically does the same thing but with more specific UI). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, this approach means that creating content and adding content to the site's navigation/structure hiearchy is a two-step process. This approach also doesn't solve your URL issue, as the structure you build for your &quot;Navigation&quot; structure won't carry over to its linked entries. I'd recommend letting that slide, but if you're determined to go the extra mile, you could possibly hack it like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set the &quot;Navigation&quot; section's URL format to &lt;code&gt;{{parent.uri}}/{slug}&lt;/code&gt;, and add a template – &lt;em&gt;navItem.html&lt;/em&gt; – to it.&lt;/li&gt;&#xA;&lt;li&gt;Output your nav using the nav items' URI and not the linked entry's URI for the &lt;code&gt;href&lt;/code&gt; attributes – i.e. you'll treat your &quot;Navigation&quot; entries' URIs as your entry permalinks&lt;/li&gt;&#xA;&lt;li&gt;In the Navigation section's template – where all requests to the Navigation entries' URIs will end up – do something like this:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;navItem.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Cache the nav item entry to another variable #}&#xA;{% set navEntry = entry %}&#xA;{# Cache the linked entry to the &quot;entry&quot; variable (this assumes your Entry field for the Navigation section has the handle &quot;linkedEntry&quot; #}&#xA;{% set entry = navEntry.linkedEntry %}&#xA;&#xA;{# Use a switch statement to include a different template based on the linked entry's section #}&#xA;{% switch entry.section.handle #}&#xA;    {% case 'services' %}&#xA;        {% include 'entry.services.html' %}&#xA;    ...&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pretty cumbersome, and a hack for sure – but the effect would be that you'd have contextual, hierarchical URIs, whilst still retaining your content in separate sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise neither of these approaches are ideal, but right now I'm pretty sure those are your best options.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-16T21:51:25.607" LastActivityDate="2015-05-16T21:51:25.607" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9781" PostTypeId="1" CreationDate="2015-05-17T09:47:41.013" Score="7" ViewCount="815" Body="&lt;p&gt;When logging in indicates the 'account has not been activated', how do I create a link for resending the activation email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;I want users to be able to enter their email address in an input field and have that resend their activation link. Not in the backend, just frontend only!&lt;/p&gt;&#xA;" OwnerUserId="3664" LastEditorUserId="5437" LastEditDate="2017-05-02T02:57:10.603" LastActivityDate="2017-05-02T02:57:10.603" Title="Code for resending the activation email" Tags="&lt;frontend&gt;&lt;login&gt;&lt;activation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9782" PostTypeId="2" ParentId="9781" CreationDate="2015-05-17T17:07:08.107" Score="5" Body="&lt;p&gt;Go to the Users section of the Control Panel (mysite.com/admin/users/). Click on the user account that needs to be activated. Click on the settings cog on the right side (see attached image), and choose which option works for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HGPPs.png&quot; alt=&quot;Settings for unverified user&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-05-17T17:07:08.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9783" PostTypeId="2" ParentId="9514" CreationDate="2015-05-17T19:47:31.040" Score="2" Body="&lt;p&gt;Craft's replace filter only supports doing multiple strings replacements at once.  If you want to do a regex replacement, it will have to be it's own separate call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you'd have to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set url =  &quot;http://www.google.com/&quot;|replace('http://', '') %}&#xA;{{ url|replace('/\\/$/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-17T19:47:31.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9784" PostTypeId="1" AcceptedAnswerId="9785" CreationDate="2015-05-17T21:08:10.070" Score="3" ViewCount="353" Body="&lt;p&gt;I prefer my cp in English but I've noticed that it also sets the locale to &quot;en_us&quot; for the entire site. I need that locale to be &quot;nl&quot; since the site is in Dutch. Any idea how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2017-07-17T20:09:24.863" Title="How do I have my control panel in English but my site locale to Dutch?" Tags="&lt;localization&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9785" PostTypeId="2" ParentId="9784" CreationDate="2015-05-17T21:12:29.397" Score="1" Body="&lt;p&gt;If you're running Craft Pro, you can go to your account's profile page where you can set your user's preferred language to English and the CP will display in English.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-05-17T21:33:07.603" LastActivityDate="2015-05-17T21:33:07.603" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9786" PostTypeId="2" ParentId="9781" CreationDate="2015-05-17T21:30:44.330" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to be able that users can enter their emailaddress in an input and that the activation link gets resend&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'll need to write a &lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;, which can generate activation URLs using the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/UsersService&quot; rel=&quot;nofollow&quot;&gt;UsersService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo craft()-&amp;gt;users-&amp;gt;getPasswordResetUrl($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to send the user an activation email instead of echoing a link in the frontend, you can use the &lt;code&gt;sendActivationEmail&lt;/code&gt; method instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for both methods, &lt;code&gt;$user&lt;/code&gt; should be an instance of &lt;a href=&quot;https://buildwithcraft.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt;, meaning you'll first need to pull the relevant user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserByEmail($userEmail);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the actual plugin implementation, it depends what you need/want (I'm guessing you're building your own login form/logic?). You could go with a basic &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variable&lt;/a&gt; to output the activation URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ craft.myPlugin.getActivationUrl }}&quot;&amp;gt;Click here to activate your account now&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you could create a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; which would provide a link for re-sending the activation email:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl( 'myPlugin/sendActivationEmail' ) }}&quot;&amp;gt;Click to resend activation email&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-18T16:43:57.363" LastActivityDate="2016-08-18T16:43:57.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9787" PostTypeId="1" CreationDate="2015-05-18T06:10:56.320" Score="3" ViewCount="467" Body="&lt;p&gt;I have managed to sort most Craft CMS questions out by reading the docs and feedback on StackExchange but am having issues with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page with a list of entries down the right side and the main entry content to the left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The list is paginated.  When I go to say page 2 of the pagination and click on an entry, the page reloads with the page 1 pagination list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the page to remember that the entry belongs to page 2?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('orchard').limit('5').id('not ' ~ entry.id)  as entriesOnPage %}&#xA;&#xA; {% for entry in entriesOnPage %}&#xA;   {% for asset in entry.mediaThumb %}&#xA;     &amp;lt;div class=&quot;shuntalittle&quot;&amp;gt;&#xA;      &amp;lt;h6&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h6&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl('thumbTransform') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;   {% endfor %}    &#xA; {% endfor %}&#xA;&#xA;  &amp;lt;div class=&quot;pagination-centered shuntalittle&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;pagination&quot;&amp;gt;&#xA;      {% if paginate.prevUrl %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;arrow&quot;&amp;gt;&amp;amp;laquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;      {% for page, url in paginate.getPrevUrls(5) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;li class=&quot;current&quot;&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% for page, url in paginate.getNextUrls(5) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;      {% if paginate.nextUrl %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;arrow&quot;&amp;gt;&amp;amp;raquo;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks, Alex&lt;/p&gt;&#xA;" OwnerUserId="3670" LastEditorUserId="643" LastEditDate="2015-05-18T10:13:57.050" LastActivityDate="2015-05-19T07:26:52.480" Title="relate pagination to entry on page" Tags="&lt;pagination&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9788" PostTypeId="2" ParentId="9775" CreationDate="2015-05-18T07:21:32.460" Score="3" Body="&lt;p&gt;I think your best bet here would be to make use of the &lt;code&gt;entries.onSaveEntry&lt;/code&gt; event, because at the moment &lt;code&gt;$entry&lt;/code&gt; doesn't relate to the entry you have just saved, but the entry you wanted to save so it makes sense the entry asset paths are still pointing to the temp locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as i'm aware &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt; just returns a bool, whether or not the save was a success, and not the entry model that was just saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your controller could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA; // Only worry if something goes wrong&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in an &lt;code&gt;init&lt;/code&gt; function in your main plugin class you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event){&#xA;&#xA; // Is this a new entry?&#xA; if($event-&amp;gt;params['isNewEntry'])&#xA; {&#xA;    // This is an EntryModel object of the entry that was just saved&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    // Is the entry in the right section?&#xA;    if($entry-&amp;gt;sectionId == 1)&#xA;    {&#xA;      // Send the $entry to your email function&#xA;      craft()-&amp;gt;yourPlugin-&amp;gt;sendEmail($entry);&#xA;    }&#xA; }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would assume at this point the asset paths are all correct as it would have been saved to the database and all the backend work done etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would help you out in the future as well as it wouldn't matter where the entry was created, whether in the admin or through your plugin or anywhere else, and you could be sure the email will still get triggered :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failing that you could also try the &lt;code&gt;assets.onSaveAsset&lt;/code&gt; event and see if you get better results with that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/events-reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps in some way!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-05-18T07:33:01.703" LastActivityDate="2015-05-18T07:33:01.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9789" PostTypeId="2" ParentId="9787" CreationDate="2015-05-18T09:48:37.533" Score="1" Body="&lt;p&gt;You would need to pass the current pagination page number with your entry links and than make Craft&#xA;respond to URLs in a format like this: example.com/my-section/p2/my-entry-slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this is more complicated than you'd think, as this is probably not possible to do with&#xA;the default &lt;code&gt;paginate&lt;/code&gt; tag and its preset routes. And I also don't know of a way to combine the &lt;code&gt;paginate&lt;/code&gt;&#xA;tag's page token with custom routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I believe there's no other choice left than replacing &lt;code&gt;paginate&lt;/code&gt; with a custom solution replicating its&#xA;functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is possible with &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routes&lt;/a&gt; and some logic in your templates. So you'd first have to set up a route&#xA;with a &lt;code&gt;[page]&lt;/code&gt; and a &lt;code&gt;[slug]&lt;/code&gt; token, which you can then access in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;my-section/p[page]/[slug]&lt;/code&gt; and&lt;br&gt;&#xA;&lt;code&gt;my-section/p[page]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll give some example code (untested and incomplete), to help you get started with the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the pagination links build upon the route's &lt;code&gt;page&lt;/code&gt; variable used in &lt;code&gt;craft.entries&lt;/code&gt;'s &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#offset&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;offset&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#limit&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;limit&lt;/code&gt;&lt;/a&gt; parameters. With custom routes you also have to query for your &lt;code&gt;entry&lt;/code&gt; entry model manually, I set it up to get the page's first entry&#xA;if there's no &lt;code&gt;slug&lt;/code&gt; variable set from your route.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set params #}&#xA;{% set params = {section: 'orchard'} %}&#xA;{% set entriesPerPage = 5 %}&#xA;&#xA;{% if page is defined %}&#xA;    {% set offsetParam = (page - 1) * entriesPerPage %}&#xA;    {% set pageSegment = '/p' ~ page %}&#xA;{% else %}&#xA;    {% set offsetParam = 0 %}&#xA;    {% set pageSegment = '' %}&#xA;{% endif %}&#xA;&#xA;{# Get the entry model #}&#xA;{% if slug is defined %}&#xA;    {% set entry = craft.entries.slug(slug).first() %}&#xA;{% else %}&#xA;    {% set entry = craft.entries(params).offset(offsetParam).first() %}&#xA;{% endif %}&#xA;&#xA;{# Get pagination params #}&#xA;{% if page is defined %}&#xA;    {% set entriesOnNextPage = craft.entries(params).offset(offsetParam + 1) %}&#xA;&#xA;    {% if entriesOnNextPage|length %}&#xA;        {% set nextPageSegment = '/p' ~ page + 1 %}&#xA;    {% endif %}&#xA;&#xA;    {% if page == 1 %}&#xA;        {% set prevPageSegment = '' %}&#xA;    {% else %}&#xA;        {% set prevPageSegment = '/p' ~ page - 1 %}&#xA;    {% endif %}&#xA;{% else %}&#xA;    {% set entriesOnNextPage = craft.entries(params).offset(entriesPerPage) %}&#xA;&#xA;    {% if entriesOnNextPage|length %}&#xA;        {% set nextPageSegment = '/p2' %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;article&amp;gt;&#xA;    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;&#xA;&amp;lt;nav&amp;gt;&#xA;    {% set entriesOnPage = craft.entries(params).offset(offsetParam).limit(entriesPerPage) %}&#xA;&#xA;    {% for entry in entriesOnPage %}&#xA;        {% set image = entry.mediaThumb.first() %}&#xA;&#xA;        &amp;lt;a href=&quot;/my-section{{ pageSegment }}/{{ entry.slug }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if prevPageSegment is defined %}&#xA;        &amp;lt;a href=&quot;/my-section{{ prevPageSegment }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if nextPageSegment is defined %}&#xA;        &amp;lt;a href=&quot;/my-section{{ nextPageSegment }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-18T09:48:37.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9790" PostTypeId="1" AcceptedAnswerId="9791" CreationDate="2015-05-18T11:13:30.360" Score="4" ViewCount="294" Body="&lt;p&gt;Ok this should be pretty simple I feel! But I can't find the documentation for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can set assign a user to a user group within a plugin with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($userid, $groupid);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do the reverse and remove a user from a user group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-18T11:22:32.193" Title="How to remove a user from a user group?" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9791" PostTypeId="2" ParentId="9790" CreationDate="2015-05-18T11:22:32.193" Score="4" Body="&lt;p&gt;&lt;code&gt;assignUserToGroups&lt;/code&gt; has &lt;code&gt;$groupIds&lt;/code&gt; parameter (int / array) preset to &lt;code&gt;null&lt;/code&gt;. From &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService#assignUserToGroups-detail&quot; rel=&quot;nofollow&quot;&gt;the docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;assignUserToGroups($userId, $groupIds = null)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So calling the function without that parameter set should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups(1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-18T11:22:32.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9792" PostTypeId="1" AcceptedAnswerId="9794" CreationDate="2015-05-18T16:20:51.463" Score="2" ViewCount="172" Body="&lt;p&gt;So I have some exceptions being caught in a plugin, and have to assume that in some cases a 500 error is going to occur at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we set up Craft so that a server error displays a template rather than the default message display (assuming devMode is OFF)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be something we'd want working across the whole site, not just on one plugin.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-05-18T16:49:27.557" Title="How can I handle exceptions on the front end" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9793" PostTypeId="1" CreationDate="2015-05-18T16:38:54.757" Score="3" ViewCount="512" Body="&lt;p&gt;When you are in the backend and go to a user &gt; profile tab. You'll see a very nice photo upload. I want to build this for the frontend users as well. I have a basic form and I'm loading in the following js files&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/build/libs/jquery-ui.min.js&quot; %}&#xA;{% includeJsFile &quot;/build/libs/jquery.iframe-transport.js&quot; %}&#xA;{% includeJsFile &quot;/build/libs/jquery.fileupload.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My HTML frontend form looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; accept-charset=&quot;UTF-8&quot; data-saveshortcut=&quot;&quot; data-saveshortcut-redirect=&quot;gebruiker/profielfoto&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}  &#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;gebruiker/profielfoto&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input id=&quot;image-upload&quot; type=&quot;file&quot; name=&quot;image-upload&quot; style=&quot;display: none;&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;progress&quot;&amp;gt;&amp;lt;div class=&quot;bar&quot; style=&quot;width: 0%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;btn btn-primary upload-photo&quot;&amp;gt;upload&amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here comes my JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;    $('#image-upload').fileupload({&#xA;        dataType: 'json',&#xA;        type: 'POST',&#xA;        url: 'actions/users/saveUser',&#xA;&#xA;        progressall: function (e, data) {&#xA;            console.log('progressall');&#xA;            console.log(e, data);&#xA;&#xA;            var progress = parseInt(data.loaded / data.total * 100, 10);&#xA;            $('#progress .bar').css(&#xA;                'width',&#xA;                progress + '%'&#xA;            );&#xA;        },&#xA;&#xA;        add: function (e, data) {&#xA;            console.log('add');&#xA;            console.log(e, data);&#xA;&#xA;            data.context = $('&amp;lt;p/&amp;gt;').text('Uploading...').appendTo(document.body);&#xA;            data.submit();&#xA;        },&#xA;&#xA;        done: function (e, data) {&#xA;            console.log('done');&#xA;            console.log(e, data);&#xA;&#xA;            data.context.text('Upload finished.');&#xA;            $('&amp;lt;p/&amp;gt;').text(file.name).appendTo(document.body);&#xA;        },&#xA;&#xA;        fail: function(e, data) {&#xA;            console.log('fail');&#xA;            console.log(e, data);&#xA;        }&#xA;  });&#xA;&#xA;  $('.upload-photo').on('click', function() {&#xA;      console.log('upload-photo trigger');&#xA;      $('#image-upload').trigger('click');&#xA;  });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The fileupload jquery keeps triggering its fail function. When I log the data I see that it throws and unexepected error on the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone lead me in the right direction and try to mimic the same profile photo upload WITH cropping tool?&lt;/p&gt;&#xA;" OwnerUserId="3664" LastActivityDate="2018-07-26T12:30:32.260" Title="Upload and crop profile photo in frontend" Tags="&lt;upload&gt;&lt;profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9794" PostTypeId="2" ParentId="9792" CreationDate="2015-05-18T16:49:27.557" Score="2" Body="&lt;p&gt;If you put a &lt;code&gt;500.html&lt;/code&gt; template in your &lt;code&gt;craft/templates&lt;/code&gt; folder, then that will get displayed on the front end when a exception bubbles all the way to the top.  The same will work for other HTTP status codes as well (&lt;code&gt;404.html&lt;/code&gt;, &lt;code&gt;503.html&lt;/code&gt;, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-18T16:49:27.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9795" PostTypeId="1" AcceptedAnswerId="9797" CreationDate="2015-05-18T17:52:30.143" Score="1" ViewCount="696" Body="&lt;p&gt;Hi guys does anyone know how I might go about creating a dynamic navigation using a global with the navigation items as fields, is this even possible?&lt;/p&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2015-05-18T18:42:32.460" Title="Dynamic navigation using a global" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9797" PostTypeId="2" ParentId="9795" CreationDate="2015-05-18T18:36:40.537" Score="4" Body="&lt;p&gt;Global is not really the best option for dynamic navigation, because by definition it is designed to contain just one of something — and while it supports multiple fields, it only supports one instance of each field. Technically you could use a field within the global that supports multiple items (i.e. &lt;code&gt;table&lt;/code&gt; fieldtype or &lt;code&gt;matrix&lt;/code&gt; fieldtype), but none of the fieldTypes support hierarchical structures natively, so I don't see the advantage. Or you could simply paste static HTML into a text field, but I wouldn't really classify that as dynamic. Overall, not a particularly good option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably be looking into using a 'structure' (or to a lesser extent 'categoryGroup'), where each entry would represent a page or nav item, organized hierarchically. In this way you can reuse the same field within each entry (i.e. 'title') and loop through the entries to dynamically generate the nav, with the added benefit of being able to reorganize the nav easily using drag-and-drop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Documentation on using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;nav&lt;/a&gt; tag.&lt;/li&gt;&#xA;&lt;li&gt;Documentation on &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;giving each Entry Type it's own template&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Answers from previous questions, such as &lt;a href=&quot;https://craftcms.stackexchange.com/a/6847/784&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/4772/784&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Check out some of the dedicated nav building plugins, such as &lt;a href=&quot;http://straightupcraft.com/craft-plugins/a-m-navigation&quot; rel=&quot;nofollow noreferrer&quot;&gt;a&amp;amp;m navigation&lt;/a&gt; or &lt;a href=&quot;http://straightupcraft.com/craft-plugins/craftnav&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft nav&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-18T18:42:32.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9798" PostTypeId="1" AcceptedAnswerId="9799" CreationDate="2015-05-18T18:43:36.967" Score="2" ViewCount="998" Body="&lt;p&gt;I'm trying to limit the amount of characters by adding the 'limiter' plugin to the redactor field which can be found here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/plugins/limiter/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/plugins/limiter/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added the limiter.js file to my /craft/app/resources/lib/redactor/plugins folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I changed the Standard.json in /craft/config/redactor/Standard.json to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA; focus: true,&#xA; limiter: 20,&#xA; buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA; plugins: ['fullscreen','limiter'],&#xA; toolbarFixedBox: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately it doesn't work. Anybody a good suggestion how I can fix this easily. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1014" LastActivityDate="2015-05-18T19:45:44.810" Title="Limit characters in redactor wysiwyg field" Tags="&lt;redactor&gt;&lt;fieldtypes&gt;&lt;wysiwyg&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9799" PostTypeId="2" ParentId="9798" CreationDate="2015-05-18T19:45:44.810" Score="1" Body="&lt;p&gt;You have to add the JS with a Craft plugin, either a custom one making use of &lt;code&gt;includeJsResource&lt;/code&gt; (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a-plugin-add-js-or-css-to-the-control-panel&quot;&gt;this answer&lt;/a&gt; for code example) or with the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel JS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-18T19:45:44.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9800" PostTypeId="1" AcceptedAnswerId="9801" CreationDate="2015-05-18T20:08:44.490" Score="12" ViewCount="3156" Body="&lt;p&gt;I'm now setting myself to learn about AWS. Has anybody documented their experiences with &lt;a href=&quot;http://aws.amazon.com/cloudfront/&quot;&gt;CloudFront&lt;/a&gt; and Craft?&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="22" LastEditDate="2015-10-15T21:56:24.957" LastActivityDate="2020-01-27T20:19:35.023" Title="How to set up CloudFront for a Craft site" Tags="&lt;s3&gt;&lt;deployment&gt;&lt;aws&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9801" PostTypeId="2" ParentId="9800" CreationDate="2015-05-18T22:01:40.653" Score="12" Body="&lt;p&gt;I'm running Amazon S3+CloudFront on several of my sites. There's not really much to it, Craft makes it really easy: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a new Amazon S3 assets source in Craft.&lt;/li&gt;&#xA;&lt;li&gt;Set up CloudFront in AWS (&lt;a href=&quot;http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/GettingStarted.html&quot;&gt;see this link&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;In the settings for your assets source, add your cloudfront url (something like &lt;a href=&quot;http://xxxxxxxxx.cloudfront.net/&quot;&gt;http://xxxxxxxxx.cloudfront.net/&lt;/a&gt;, or your custom CNAME if you set one up) to the &quot;URL Prefix&quot; field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That should be it!&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-05-18T22:01:40.653" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9802" PostTypeId="2" ParentId="9708" CreationDate="2015-05-19T01:34:53.283" Score="2" Body="&lt;p&gt;I'm not sure I totally understand your issue, but give this a try in your Matrix code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in block.projectsEntry %}&#xA;    &amp;lt;a href=&quot;{{ entry[0].getUrl() }}&quot;&amp;gt;{{ entry[0].title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Are you getting any errors in devMode?&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-05-19T01:34:53.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9803" PostTypeId="1" CreationDate="2015-05-19T03:20:24.757" Score="1" ViewCount="143" Body="&lt;p&gt;We have created a site with locales (English, German and Italian). We want to add an extra locale to the home page so we went into the locales admin area and added the new locale. But when we edit the home page this new locale does not show up, it seems like the locale list for a page is setup when the page is created and the new locales are only available to newly created pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Andrew&lt;/p&gt;&#xA;" OwnerUserId="3673" LastEditorUserId="344" LastEditDate="2015-05-27T14:18:10.950" LastActivityDate="2015-05-27T14:18:10.950" Title="new locales not showing up" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9805" PostTypeId="2" ParentId="9787" CreationDate="2015-05-19T06:14:38.787" Score="1" Body="&lt;p&gt;Thank you so much for your detailed response Carl. As I was working to implement this solution I decided to go back and take a look at url segments (I am used to ExpressionEngine).   I found that craft.request has a whole series of properties including getPageNum() which gets the pagination page number from the url.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the urls link in my pagination list to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}/p{{ craft.request.getPageNum() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that maintained the pagination position in the url which basically does what I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alex&lt;/p&gt;&#xA;" OwnerUserId="3670" LastEditorUserId="125" LastEditDate="2015-05-19T07:26:52.480" LastActivityDate="2015-05-19T07:26:52.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9806" PostTypeId="2" ParentId="9803" CreationDate="2015-05-19T07:42:47.137" Score="2" Body="&lt;p&gt;You have to activate the new locale in the section's settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-19T07:42:47.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9807" PostTypeId="1" AcceptedAnswerId="9810" CreationDate="2015-05-19T11:25:51.730" Score="5" ViewCount="386" Body="&lt;p&gt;does anyone know if there is a flag, accessible at template level, that indicates whether the &quot;System Status&quot; lightswitch in Settings -&gt; General menu is on or off? (I'm thinking something similar to craft.config.devMode)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried craft.config.isSystemOn but it did not work since the setting is not defined in the general.php config but rather via the user interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to give some context, I'd like to add extra items to the template for logged in admin users to see on the website only when system status is set to off (like a warning bar).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&#xA;Daniel&lt;/p&gt;&#xA;" OwnerUserId="3370" LastActivityDate="2015-05-19T13:42:15.693" Title="System Status flag in template context" Tags="&lt;templating&gt;&lt;status&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9808" PostTypeId="2" ParentId="9716" CreationDate="2015-05-19T13:01:20.520" Score="1" Body="&lt;p&gt;I just ran into the same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the defineAttributes() method in your model, you can set a &quot;label&quot;, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Plugin_ExampleModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'quality'  =&amp;gt; array(&#xA;                AttributeType::Number,&#xA;                'label' =&amp;gt; Craft::t('Quality'),&#xA;                'min' =&amp;gt; 0,&#xA;                'max' =&amp;gt; 100,&#xA;                'required' =&amp;gt; TRUE&#xA;            )&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By using &lt;strong&gt;Craft::t()&lt;/strong&gt; on that label, it will be translated in your template when the error is shown. Of course the corresponding label should be present in your plugin's translations file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this will help!&lt;/p&gt;&#xA;" OwnerUserId="2298" LastActivityDate="2015-05-19T13:01:20.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9809" PostTypeId="1" AcceptedAnswerId="9811" CreationDate="2015-05-19T13:26:49.813" Score="2" ViewCount="290" Body="&lt;p&gt;I am trying to get started with Craft, and was added to an existing project as an admin. I have little experience working with CMS, and am having trouble figuring out how to access the actual html/css files, rather than just the dashboard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've downloaded the Craft files locally, and have been looking through documentation, but any additional pointers to resources would be appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3675" LastActivityDate="2015-05-19T14:16:31.680" Title="Accessing Files" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9810" PostTypeId="2" ParentId="9807" CreationDate="2015-05-19T13:36:56.937" Score="8" Body="&lt;p&gt;You could use &lt;code&gt;craft.app.isSystemOn&lt;/code&gt;. This will return &lt;code&gt;1&lt;/code&gt; if the System Status is &quot;on&quot; in Settings -&gt; General in the control panel. It will also respect the value of the &lt;code&gt;isSystemOn&lt;/code&gt; config setting if you're setting it in general.php&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2015-05-19T13:42:15.693" LastActivityDate="2015-05-19T13:42:15.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9811" PostTypeId="2" ParentId="9809" CreationDate="2015-05-19T14:16:31.680" Score="2" Body="&lt;p&gt;Generally when you are looking at the folder structure of a craft install your template files will be in &lt;code&gt;craft/templates/&lt;/code&gt; (from doc root)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft/templates/ #&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This is where all of your site’s templates go.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can get more info about Craft's folder structure from the docs here: &lt;a href=&quot;http://buildwithcraft.com/docs/folder-structure&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/folder-structure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft has a standard template path format that applies to each of&#xA;  these cases: a Unix-style file system path to the template file,&#xA;  relative from your craft/templates folder.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you have a template located at craft/templates/foo/bar.html, the&#xA;  following template paths would point to it:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;foo/bar&lt;/li&gt;&#xA;  &lt;li&gt;foo/bar.html&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Index Templates&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you name your template “index.html”, you don’t need to specify it&#xA;  in the template path.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, if you have a template located at&#xA;  craft/templates/foo/bar/index.html, the following template paths would&#xA;  point to it:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;foo/bar&lt;/li&gt;&#xA;  &lt;li&gt;foo/bar/index&lt;/li&gt;&#xA;  &lt;li&gt;foo/bar/index.html&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you need more information about templating you can also find that in the docs here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating-overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the CSS files etc, it would really depend on the developer who set the site up, but the first place I would look is inside the &lt;code&gt;public&lt;/code&gt; folder or whichever folder is considered the document root of the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps get you started!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-19T14:16:31.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9812" PostTypeId="1" AcceptedAnswerId="9814" CreationDate="2015-05-19T14:35:14.753" Score="1" ViewCount="1579" Body="&lt;p&gt;Seems like a basic question but I can’t figure out a way to do this out of the box, or reference to it in the Redactor docs. &lt;code&gt;‘&amp;amp;nbsp;’&lt;/code&gt; always gets stripped out.&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2019-12-29T20:50:30.323" Title="How to add a non-breaking space to a rich text field?" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9813" PostTypeId="1" AcceptedAnswerId="9815" CreationDate="2015-05-19T15:51:16.067" Score="2" ViewCount="1228" Body="&lt;p&gt;I have a front end form based on the entry form example provided by craft documentation which allows logged in users to submit an entry to a specific section. Form validation is not working in that required fields are not being picked up on submission. So if the field is empty it still submits the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the user group set up so users are not able to use the CP or submit live entries so the entry is sent through as disabled so that the admin users can monitor entries before enabling them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct in thinking that because the entry is being saved as disabled that craft does not validate the post data? If this is correct what is the work around as I do not want users to be able to post live entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-19T22:28:33.047" Title="Entry Form Validation on Front End Form" Tags="&lt;entries&gt;&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9814" PostTypeId="2" ParentId="9812" CreationDate="2015-05-19T18:59:08.777" Score="3" Body="&lt;p&gt;What about using CSS &lt;code&gt;white-space: nowrap;&lt;/code&gt; instead of &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt; characters? I guess that's semantically more correct and this also allows you to prevent your text to break at any other character (great for phone numbers etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.nobr {&#xA;  white-space: nowrap;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;my phone number is &amp;lt;span class=&quot;nobr&quot;&amp;gt;+1 800-275-8777&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To add this easily to your Redactor fields markup, have a look at the &lt;a href=&quot;http://imperavi.com/redactor/docs/api/inline/&quot; rel=&quot;nofollow&quot;&gt;inline format&lt;/a&gt; API or the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;formattingAdd&lt;/a&gt; config setting (I actually had mixed experiences with that setting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to be able to add this with the click of a button, I also just added this to my &lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot; rel=&quot;nofollow&quot;&gt;Redactor Inline Styles&lt;/a&gt; plugin, which is a collection of (optional) buttons to apply inline styles to your Redactor texts (Quotes, Code, etc.).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-19T18:59:08.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9815" PostTypeId="2" ParentId="9813" CreationDate="2015-05-19T21:49:26.480" Score="2" Body="&lt;p&gt;You're correct. Craft will &lt;em&gt;not&lt;/em&gt; run validation upon saving disabled elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a bug – it's just designed that way (as far as I can tell from looking at the relevant source code in the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/ElementsService#saveElement-detail&quot; rel=&quot;nofollow&quot;&gt;ElementsService&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;As for a workaround – you'll need a plugin&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the easiest approach I can think of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Listen for the &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt; event&lt;/li&gt;&#xA;&lt;li&gt;In the event handler, validate the entry model manually, if the entry is disabled&lt;/li&gt;&#xA;&lt;li&gt;If validation fails, add error messages to the model and set the &lt;code&gt;$event&lt;/code&gt; object's &lt;code&gt;performAction&lt;/code&gt; attribute to false&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This should stop the entry from going through, and should also display any error messages in your form:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.beforeSaveEntry',function(){&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    if(!$entry-&amp;gt;enabled &amp;amp;&amp;amp; !craft()-&amp;gt;content-&amp;gt;validateContent($entry))&#xA;    {&#xA;        $entry-&amp;gt;addErrors($entry-&amp;gt;getContent()-&amp;gt;getErrors());&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    return $event;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyway, since I wanted to test the above before responding here, I wrote the plugin. It seems to do the job, so hopefully it'll help you out!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/AlwaysValidate-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/AlwaysValidate-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-19T22:28:33.047" LastActivityDate="2015-05-19T22:28:33.047" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9816" PostTypeId="1" AcceptedAnswerId="9817" CreationDate="2015-05-19T23:49:10.147" Score="4" ViewCount="1037" Body="&lt;p&gt;Using the example code from &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;the docs&lt;/a&gt;, I'm attempting to add a value from my custom field to the Entries listing. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'index')&#xA;    {&#xA;        unset($attributes['expiryDate']);&#xA;        $attributes['id'] = Craft::t('ID');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I go about accessing additional attributes on the Entries? The custom field data is stored in &lt;code&gt;MyPluginName&lt;/code&gt;'s table and doesn't appear to be available in the attributes of the EntryElement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any pointers you may have!&lt;/p&gt;&#xA;" OwnerUserId="3678" LastActivityDate="2015-05-21T07:36:21.210" Title="Adding additional attributes to modifyEntryTableAttributes()" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9817" PostTypeId="2" ParentId="9816" CreationDate="2015-05-20T05:36:50.057" Score="5" Body="&lt;p&gt;See this question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/5124/possible-to-add-category-field-to-modifyentrytableattributes&quot;&gt;Possible to add category field to modifyEntryTableAttributes?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, you need to use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; hook to get the actual content to the table cells in addition to the &lt;code&gt;modifyEntryTableAttributes&lt;/code&gt;. You can do queries here if you need to get the data if you can not access it from the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'index')&#xA;    {&#xA;        // This will be the header name of the column, the &amp;lt;th&amp;gt;&#xA;        $attributes['myCustomField'] = Craft::t('My Label');&#xA;    }&#xA;}&#xA;&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'myCustomField')&#xA;    {&#xA;        // Fetch the related data from your plugin. This will be placed in the &amp;lt;td&amp;gt;'s&#xA;        $fieldData = craft()-&amp;gt;myPlugin-&amp;gt;getFieldData($entry);&#xA;        // OR $entry-&amp;gt;myCustomField-&amp;gt;first(); if myCustomField is an ElementCriteriaModel.&#xA;        return $fieldData;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Think of it this way: when craft is loading up the entries (or any of the element types) to display on the index page, it has to know what fields are going to show. These fields are &lt;em&gt;defined&lt;/em&gt; in the &lt;code&gt;EntryElementType::defineTableAttributes&lt;/code&gt;. This method returns an array of attributes, where the key is whatever you want, and the value is what is displayed in the tables &lt;code&gt;&amp;lt;th&amp;gt;&lt;/code&gt; tags. In this function, the entry type is defining some standard fields to show (title, uri, postdate etc), but Craft is nice enough to let plugins &lt;em&gt;modify&lt;/em&gt; this array before it is returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does the array of attributes go after? The function for populating the &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; tags of the table, the &lt;code&gt;EntryElementType::getTableAttributeHtml($entry, $attribute)&lt;/code&gt;. The first thing this function does it to let plugins decide what to do, so it calls the &lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt; which is the function you should implement. The $attribute parameter is the key you defined. Here you have a chance to tell Craft how the data is displayed. If you in the first function defined &lt;code&gt;$attributes['id']&lt;/code&gt; and did nothing in the second function, the default way Craft is getting this data is doing &lt;code&gt;$entry-&amp;gt;$attribute&lt;/code&gt; (or $entry-&gt;id in this case), which would display the entry's id in the column. If $entry-&gt;$attribute is an array, or an object without a &lt;code&gt;__toString&lt;/code&gt;, this will not work, so you will have to tell Craft explicitly how to represent this field, e.g.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($attribute = 'myArrayOfSpecialFields'){&#xA;  return $entry-&amp;gt;myArrayOfSpecialFields['indexOfStringToDisplay'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are tons of useful information on this in the EntryElementType, you can just follow the flow in the code (perhaps start in the &lt;code&gt;ElementIndexController&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes things more clear&lt;/p&gt;&#xA;" OwnerUserId="2300" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-21T07:36:21.210" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9818" PostTypeId="1" AcceptedAnswerId="9820" CreationDate="2015-05-20T05:51:42.097" Score="1" ViewCount="1689" Body="&lt;p&gt;I have searched and tried a few different ways but none have worked so not sure what is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example say I have a few categories case studies, featured, articles, videos...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this way&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('resource').relatedTo(&#xA;    'and',&#xA;    { targetElement: featured },&#xA;    { targetElement: case studies }&#xA;) %}&#xA;{% set entries = craft.entries.relatedTo(category).limit(3).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried this way&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories({&#xA;    group: 'resource',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: featured },&#xA;        { targetElement: case-studies }&#xA;    ]&#xA;}) %}&#xA;{% set entries = craft.entries.relatedTo(category).limit(3).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am wanting to find entries that use two categories together example case studies, and featured category.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-05-20T06:18:07.630" Title="Get entries relatedTo multiple categories" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9819" PostTypeId="1" CreationDate="2015-05-20T06:07:30.687" Score="1" ViewCount="178" Body="&lt;p&gt;I have site with a few hundred entries in a structure section. About 95% of these pages use the same template, with the remainder (about 20 pages) needing a special template. I manage this the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section (main) has a template called _entry.html which consists only of the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [entry.uri, &quot;main/_main&quot;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then match the uri in the templates folder and that template also extends main/_main with a block override to deal with the special case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of this works very well until the content editor moves the special entry in the structure, and then of course it loses its template and goes back to the default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there way I can &quot;lock&quot; an entry to a specific template (which still inherits) so that when the entry is moved in the structure it does not &quot;disconnect&quot;.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-05-20T09:44:27.753" Title="Permanently connecting templates to entries" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9820" PostTypeId="2" ParentId="9818" CreationDate="2015-05-20T06:11:01.223" Score="6" Body="&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; parameter's &lt;code&gt;targetElement&lt;/code&gt; property has to be an ElementCriteriaModel or a single category model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featured = craft.categories.group('myCatGroup').slug('featured').first() %}&#xA;{% set caseStudies = craft.categories.group('myCatGroup').slug('case-studies') %}&#xA;&#xA;{% set entries = craft.users({&#xA;    group: 'resource',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: featured },&#xA;        { targetElement: caseStudies }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-20T06:18:07.630" LastActivityDate="2015-05-20T06:18:07.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9821" PostTypeId="2" ParentId="9819" CreationDate="2015-05-20T07:20:24.213" Score="4" Body="&lt;p&gt;I guess I'd refactor this and introduce different &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;entry types&lt;/a&gt; for your section. Besides being able to &quot;lock&quot; each entry type to a specific template (→ &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;&quot;How can I give each Entry Type its own template?&quot;&lt;/a&gt;), you can also have the CP fields (slightly) different. Maybe it makes sense to have extra fields for your special entries, if it doesn't, just add the same fields to each entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be to have a dropdown field to select the template, but I like that the entry type dropdown is in the right panel in the CP.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-20T07:20:24.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9822" PostTypeId="2" ParentId="9819" CreationDate="2015-05-20T07:46:03.083" Score="3" Body="&lt;p&gt;The entries' IDs or slugs doesn't change, so you could compare against that to include your partials dynamically.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set specialPages = ['sitemap', 'contact-form', ...] %}&#xA;&#xA;{% if entry.slug in specialPages %}&#xA;    {% include '_partials/' ~ entry.slug %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-20T07:57:47.970" LastActivityDate="2015-05-20T07:57:47.970" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9823" PostTypeId="1" AcceptedAnswerId="9825" CreationDate="2015-05-20T09:09:44.823" Score="2" ViewCount="1350" Body="&lt;p&gt;in &lt;strong&gt;short&lt;/strong&gt;:&#xA;Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also: Is there a way to &quot;enforce&quot; presence (installation and activation) of &quot;related&quot; plugins (&quot;must use&quot; plugins) so I can develop a theme with functions/features related to other plugins I do not own?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&#xA;I am starting over (again) with craft, simply as I am fed up managing plugins (i.e. with wordpress). One thing that I am really missing - which may be due to limited coding experience with craft - is a simple way to add my &quot;defaults&quot; (css, js, fields, forms, groups &amp;amp; related (test)users,...) to the system to proceed creating templates (internal as well as customers). In wordpress I could simply extend the functions.php or use a custom site or template related plugin providing me the basics I want/need to proceed developing themes or plugins. In craft I don't get the point / simply don't understand where to start just to add custom fields and relations. I also don't see how I could use a plugin to create t theme / copy the related files and have them &quot;managed&quot; by my plugin.&lt;/p&gt;&#xA;" OwnerUserId="726" LastActivityDate="2015-05-20T17:19:39.667" Title="How to use a plugin to add own fields, values, forms,...?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9824" PostTypeId="2" ParentId="9819" CreationDate="2015-05-20T09:44:27.753" Score="3" Body="&lt;p&gt;There are obviously many ways to skin this cat. Thanks to those that offered answers. The one that I think works the best for me is the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/template-select&quot; rel=&quot;nofollow&quot;&gt;Template Select plugin&lt;/a&gt;. The added advantage is that when the special template is used more than once I won't have to go and edit the template code to call it for that entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I had to work my around was the plugin help that said&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In general.php, add this line:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;'templateselectSubfolder' =&amp;gt; 'subfolder'&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;whereas to make it work I had to add a trailing slash&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'templateselectSubfolder' =&amp;gt; 'subfolder/'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-05-20T09:44:27.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9825" PostTypeId="2" ParentId="9823" CreationDate="2015-05-20T12:20:28.143" Score="5" Body="&lt;p&gt;I'll try and cover as much as I can:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can you please point to some (working?) sample of implementing a barebone default / dev setup (css, js, basic templates, custom fields, groups, users, matrix forms, front-end forms,...) using a plugin?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there would be anything where this is implemented with a plugin (unless i'm mistaken), but P&amp;amp;T have an installation of Craft you can either clone on Github or generate from their website called HappyLager, this contains a bunch of boilerplate to you get you started including sections, entry types, matrix fields, relations, assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is anything with users on there though due to licencing, Craft personal only allows one user and Client 1 Admin and 1 Client account : &lt;a href=&quot;http://buildwithcraft.com/pricing&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/pricing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Generate a site for you to log in to: &lt;a href=&quot;https://demo.buildwithcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://demo.buildwithcraft.com/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Download the Repo and install it to your own server: &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/HappyLager&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to &quot;enforce&quot; presence (installation and activation) of &quot;related&quot; plugins (&quot;must use&quot; plugins) so I can develop a theme with functions/features related to other plugins I do not own?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is sort of a way to do this I believe, you would need to have a set of dependancies you could define as an array in your main plugin class, then when your plugin's CP/settings page is loaded, do the checks through a controller to see if the correct plugins are installed and proceed with notifications, errors when conditionals are met etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a plugin i've seen that has done this is the Twitter plugin from Dukt, its free so you should be able to download it and find what you need. &lt;code&gt;TwitterPlugin.php&lt;/code&gt; is where the logic is (from what I can see) then &lt;code&gt;controllers/TwitterController.php&lt;/code&gt; to put it all together and then  &lt;code&gt;templates/settings/_dependancies.html&lt;/code&gt; is how it's dealt with in the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dukt.net/craft/twitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net/craft/twitter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be worth having a read about plugin development: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think in your themes readme, a simple list of required plugins with links on how to get them would be good enough for most situations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In craft I don't get the point / simply don't understand where to start just to add custom fields and relations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be solved or become apparent in the HappyLager demo? if not the documentation is quite helpful with this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/sections-and-entries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/fields&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/relations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I also don't see how I could use a plugin to create a theme / copy the related files and have them &quot;managed&quot; by my plugin.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the problem with building a theme is there are so many factors involved with regards to how someone might have their backend set up (if retro fitting a theme) as you if you had something like &lt;code&gt;craft.entries.section('news')&lt;/code&gt; in one of your templates but the section is called &lt;code&gt;blog&lt;/code&gt; your theme isn't going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a clean install your problem might be with licensing, I'm not an expert on it by any means so if anyone else knows more information please edit this answer, but I would assume you would need to be careful how you add sections and users at the least.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin could generate sections on it's install, it could even generate users but I would probably check with Craft directly with this or read their &lt;a href=&quot;http://buildwithcraft.com/license&quot; rel=&quot;nofollow noreferrer&quot;&gt;license&lt;/a&gt; to be sure, but the methods to create such things are there in the internal API, you could take a look at the full class reference to see whats going on and whats available: &lt;a href=&quot;http://buildwithcraft.com/classreference&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/classreference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to template files, you can change the location of these file, see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4307/custom-template-location&quot;&gt;Custom template location&lt;/a&gt;, but I don't think you can get your plugin to do this, unless i'm mistaken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for theme files etc you could have a set directory structure when people install your theme and then use something like the &lt;code&gt;File&lt;/code&gt; class to interact with these files &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/io/File&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/classreference/etc/io/File&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps you get off to a start with building on Craft&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-05-20T12:20:28.143" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9826" PostTypeId="1" CreationDate="2015-05-20T12:48:27.103" Score="1" ViewCount="1725" Body="&lt;p&gt;I am new to Craft.. &#xA;I created the Entries but didn't understood how to setup them to display as a menu. Seen the documentation, templating references.. But not get any idea about how to add navigation menu for the entries type. I am using the default template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="3647" LastEditorUserId="344" LastEditDate="2015-05-20T12:59:14.580" LastActivityDate="2015-05-20T16:07:07.953" Title="Adding Navigation Menu" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9827" PostTypeId="1" AcceptedAnswerId="9829" CreationDate="2015-05-20T13:18:14.243" Score="1" ViewCount="368" Body="&lt;p&gt;I want to add a batch filter with a variable number depending on a conditional. Is this even possible this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category.id == '647' %}&#xA;    {% set nr = '5' %}&#xA;{% else %}&#xA;    {% set nr = '4' %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% for batch in craft.entries.section('xy')|batch('{{ nr }}') %}&#xA;    {{ batch.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work. How should I write &lt;code&gt;{{ nr }}&lt;/code&gt; or is it impossible due to things like parse order?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-05-20T13:47:11.653" Title="Add batch filter as variable" Tags="&lt;filter&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9828" PostTypeId="1" CreationDate="2015-05-20T13:28:22.703" Score="1" ViewCount="1469" Body="&lt;p&gt;I'm trying to update from &lt;code&gt;2.3.2640&lt;/code&gt; to &lt;code&gt;2.3.2644&lt;/code&gt;, but I get a 500 error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;The server encountered an internal error or&#xA;misconfiguration and was unable to complete&#xA;your request.&#xA;Please contact the server administrator,&#xA;you@example.com and inform them of the time the error occurred,&#xA;and anything you might have done that may have&#xA;caused the error.&#xA;More information about this error may be available&#xA;in the server error log.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I look a the logs I can see that the backup was successful&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/05/20 13:23:15 [info] [application] [Forced] Finished backing up database.&#xA;in /xxx/craft/app/services/UpdatesService.php (399)&#xA;in /xxx/craft/app/controllers/UpdateController.php (317)&#xA;in /xxx/craft/app/etc/web/WebApp.php (869)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the sql file is in the backup folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea where I might look to fix this error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I see that it's timing out at 30 seconds. I've set my php file to have &lt;code&gt;max_execution_time = 60&lt;/code&gt;, but it's still timing out at 30 seconds...&lt;/p&gt;&#xA;" OwnerUserId="968" LastEditorUserId="968" LastEditDate="2015-05-20T13:39:39.953" LastActivityDate="2018-12-05T13:24:25.040" Title="500 error on updating Craft" Tags="&lt;updates&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9829" PostTypeId="2" ParentId="9827" CreationDate="2015-05-20T13:47:11.653" Score="6" Body="&lt;p&gt;Thought I would add this as an answer instead as it should solve your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the issue with writing it like &lt;code&gt;batch('{{ nr }}')&lt;/code&gt; is that twig sees whatever is in &lt;code&gt;''&lt;/code&gt; as a string, so is seeing &lt;code&gt;{{ nr }}&lt;/code&gt; as it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also don't need to echo a variable as a function parameter i.e &lt;code&gt;batch({{ nr }})&lt;/code&gt;, you just need to reference the variable itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by just writing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for batch in craft.entries.section('xy')|batch(nr) %}&#xA; {{ batch.title }}&#xA;{% endfor %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Twig will take the value for &lt;code&gt;nr&lt;/code&gt; set above and use it as the parameter :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-20T13:47:11.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9830" PostTypeId="1" AcceptedAnswerId="9831" CreationDate="2015-05-20T13:52:56.497" Score="2" ViewCount="1121" Body="&lt;p&gt;I have a frontend form that has a select list for language. This field will allow for one language to be selected. In the backend I have a field set up for my entries as a category field populated by country categories set as required. I can not seem to get the database to update this category field from my frontend form. The select field is set up as follows for the form field handle language.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;language&quot; name=&quot;fields[language]&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;English&quot;&amp;gt;English&amp;lt;/option&amp;gt;&#xA;    etc&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anything I am missing to get this to populate correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-20T16:11:31.187" Title="How to populate Category field form frontend form?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;form&gt;&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9831" PostTypeId="2" ParentId="9830" CreationDate="2015-05-20T15:28:57.840" Score="4" Body="&lt;p&gt;Couple things. First, I believe you need to add an extra set of brackets to the name attribute. The reason being that category fields (as well as all 'related' fieldTypes) store more than one element, even if as in this case there is only one category being assigned. Secondly you'll need to assign the category id as the value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;language&quot; name=&quot;fields[language][]&quot;&amp;gt;&#xA;    {% for category in craft.categories.group('languages') %}&#xA;         &amp;lt;option value=&quot;{{ category.id }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-05-20T16:11:31.187" LastActivityDate="2015-05-20T16:11:31.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9832" PostTypeId="2" ParentId="9826" CreationDate="2015-05-20T16:07:07.953" Score="2" Body="&lt;p&gt;I'm assuming that you are trying to create an 'index' page for your channel entries. There are a few ways to do this depending on the requirements of your site, but a very simple way is to create a 'single'. In the template for the single you can request the channel entries, and loop through the response to generate your index navigation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('myChannelSectionHandle').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want the uri's to match up nicely then you can set the 'uri' of the single to be &lt;code&gt;mySectionName&lt;/code&gt; and the 'uri' of the channel entries to be &lt;code&gt;mySectionName/{slug}&lt;/code&gt; in the section settings — such that to the end user, it will simply feel like they are all part of the same section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some slightly more complex options, see these answers, &lt;a href=&quot;https://craftcms.stackexchange.com/a/4385/784&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/6847/784&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-05-20T16:07:07.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9833" PostTypeId="2" ParentId="9823" CreationDate="2015-05-20T17:19:39.667" Score="5" Body="&lt;p&gt;Just my two cents, as &lt;a href=&quot;https://craftcms.stackexchange.com/a/9825/45&quot;&gt;Alec has already provided an excellent answer...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like what you're looking for isn't necessarily a collection of plugins, but really a way to manage a &lt;strong&gt;base installation&lt;/strong&gt;. You would then use this base installation as a starting point for your other projects, thus minimizing the amount of setup time you'd need for each new project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've done exactly that, and it works beautifully! We've got a Git repo setup with a clean Craft installation, plus the plugins which we use on virtually every project. Any common database changes have already been made, and an export of the database is included within the repo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the base install is simple... Just download the project, install the database, and voila!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Make sure the &lt;code&gt;.git&lt;/code&gt; folder does not end up in your new project, since you'll probably be setting it up in a new repo.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Make sure your &lt;code&gt;/config/license.key&lt;/code&gt; file is omitted!&lt;/strong&gt; The new project will create one automatically the first time it runs, and that license key file is crucial for identifying your site as a unique installation. Upgrades to your Craft edition (Client, Pro) are tied directly to that license file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This system has worked fantastically for us. It seems like this may be more along the lines of what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-20T17:19:39.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9834" PostTypeId="2" ParentId="9828" CreationDate="2015-05-20T18:15:24.603" Score="1" Body="&lt;p&gt;If you put a &lt;code&gt;phpinfo.php&lt;/code&gt; file in your public HTML folder with this in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php phpinfo();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then load that page in your browser and search for &lt;code&gt;max_exection_time&lt;/code&gt;, do you see your 60 second change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running nginx/php-fpm, they have their own, separate execution time settings you'll need to adjust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on Apache and running Suhosin or mod_security, they have additional execution times that you'll need to adjust as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="130" LastEditDate="2015-12-17T18:38:40.567" LastActivityDate="2015-12-17T18:38:40.567" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9835" PostTypeId="1" AcceptedAnswerId="9836" CreationDate="2015-05-20T19:56:28.790" Score="2" ViewCount="336" Body="&lt;p&gt;I've built a custom field that stores its data in its own table. How can I get data from MyCustomField to show up as a column in the Entries Table? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My custom field is made up of multiple fields, in this case a Date/Time field and a text field.&lt;/li&gt;&#xA;&lt;li&gt;My custom field is is returned as an array by the &lt;code&gt;prepValue()&lt;/code&gt; function in my fieldtype file.&lt;/li&gt;&#xA;&lt;li&gt;Not every entry will have a record in my custom field's table&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I check to see if a value exists in my custom field's table for an entry and display it in the Entries Table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'm copying this over from the Craft Slack channel so we don't lose the solution.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3678" LastActivityDate="2015-05-20T19:56:28.790" Title="How can I add data from my custom plugin to the Entry Listing table?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9836" PostTypeId="2" ParentId="9835" CreationDate="2015-05-20T19:56:28.790" Score="4" Body="&lt;p&gt;It will take two hooks in the &lt;code&gt;MyCustomPlugin.php&lt;/code&gt; file to display data from the custom field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == '*')&#xA;    {&#xA;        unset($attributes['expiryDate']);&#xA;        $attributes['whatever-you-want'] = Craft::t('Desired Table Heading');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;modifyEntryTableAttributes()&lt;/code&gt; hook will allow us to add/remove columns from the Entries Listing table. Note that the &lt;code&gt;$attributes[]&lt;/code&gt; variable will automatically try to match up whatever you put in there with an attribute on the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably all you need to drop a standard custom field into the table. However, since my custom field is an array, holding multiple bits of data, we need to use the &lt;code&gt;getEntryTableAttributes()&lt;/code&gt; hook to dig in to my custom field and grab the item we want to display.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'whatever-you-want')&#xA;    {&#xA;        // Assign my custom field to a variable&#xA;        $fieldData = $entry-&amp;gt;mycustomfield;&#xA;&#xA;        // Check if there is any data in the variable&#xA;        if (!empty($fieldData)) {&#xA;&#xA;            // If so, return the specific key AS A STRING to the table&#xA;            return $fieldData['myCustomDate']-&amp;gt;format('n/j/y');&#xA;        }&#xA;&#xA;        return '';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the &lt;code&gt;return '';&lt;/code&gt; at the end? That's important, because if an entry DOESN'T have my custom field attached to it, it will try to look up the &lt;code&gt;$attribute['whatever-you-want']&lt;/code&gt; assuming that's a legitimate DB column, and will fail. &lt;/p&gt;&#xA;" OwnerUserId="3678" LastActivityDate="2015-05-20T19:56:28.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9838" PostTypeId="1" AcceptedAnswerId="9839" CreationDate="2015-05-20T20:20:24.697" Score="3" ViewCount="259" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9835/how-can-i-add-data-from-my-custom-plugin-to-the-entry-listing-table&quot;&gt;Now that I have my custom field displaying in the Entries Table&lt;/a&gt;, how can I set up sources to view entries containing specific data from my custom field? My custom field holds several different values, but I want to have a filter set up to view specific things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: this is being copied from the Craft Slack channel so we don't lose it&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3678" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-05-20T20:20:24.697" Title="How can I set up sources based on my custom field data?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9839" PostTypeId="2" ParentId="9838" CreationDate="2015-05-20T20:20:24.697" Score="3" Body="&lt;p&gt;Setting up the sources in the sidebar isn't difficult. Add the &lt;code&gt;modifyEntrySources()&lt;/code&gt;(&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;) hook to &lt;code&gt;MyCustomPlugin.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;        $sources[] = array('heading' =&amp;gt; 'My Custom Heading');&#xA;&#xA;        $sources['mypluginhandle:mysectionname'] = array(&#xA;            'label' =&amp;gt; 'My Section Name',&#xA;            'criteria' =&amp;gt; array('myPluginHandle' =&amp;gt; 'SQL CODE HERE')&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this point you should have a new entry heading and source in the Entries Listing page. Clicking on it isn't going to filter your data as you may expect... yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the &lt;code&gt;'criteria' =&amp;gt; array('myPluginHandle' =&amp;gt; 'SQL CODE HERE')&lt;/code&gt;? This is what you are going to use to filter the entries according to what you want to see. Everything that is in the value of the 'myPluginHandle' array will be passed over to the &lt;code&gt;modifyElementsQuery()&lt;/code&gt; (&lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/BaseFieldType#modifyElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;) method in the &lt;code&gt;MyCustomFieldtype.php&lt;/code&gt; file. This is where you can build out your SQL statement accordingly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, $params)&#xA;{&#xA;    if ($params != null) {&#xA;&#xA;        // whatever you need to do to dig in to your custom fields' data...&#xA;        // using the code above, $params would be equal to 'SQL CODE HERE'&#xA;&#xA;        $query-&amp;gt;where($params);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should be all you need to filter your entries by your custom field!&lt;/p&gt;&#xA;" OwnerUserId="3678" LastActivityDate="2015-05-20T20:20:24.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9841" PostTypeId="1" AcceptedAnswerId="9845" CreationDate="2015-05-21T03:26:11.387" Score="6" ViewCount="704" Body="&lt;p&gt;When trying to fetch an entry with special characters in the title, it doesn't seem to match.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;title = &quot;Title,with,commas&quot;;&#xA;$entry = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried a few other characters such as &lt;code&gt;#&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;, and &lt;code&gt;$&lt;/code&gt; with the same result - &lt;code&gt;$entry&lt;/code&gt; is empty.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-05-21T09:53:38.207" Title="Fetch entries with special characters in title" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9843" PostTypeId="2" ParentId="9841" CreationDate="2015-05-21T08:09:42.120" Score="1" Body="&lt;p&gt;I'm not entirely sure why &lt;code&gt;$criteria-&amp;gt;title&lt;/code&gt; doesn't work (maybe someone can shed some light), but I did try these other two methods and they both pulled an entry with special characters like you describe above.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;getContent()-&amp;gt;title = 'Some$other$message';&#xA;&#xA;$criteria-&amp;gt;search = 'Some$other$message';`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess &lt;code&gt;$criteria-&amp;gt;getContent()-&amp;gt;title&lt;/code&gt; is more explicit and more what you need, as search would match more than just the titles.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-21T08:09:42.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9844" PostTypeId="2" ParentId="9841" CreationDate="2015-05-21T09:14:58.543" Score="2" Body="&lt;p&gt;You have to escape your commas, or craft wil interpret that as if your searching for several titles. Notice the where clause, &quot;contenttitle1, contenttitle2, contenttitle3&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;title = 'Title,with,commas';&#xA;$entry = $criteria-&amp;gt;first();&#xA;&#xA;// will result in this query:&#xA;SELECT &amp;lt;a bunch of fields&amp;gt;&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;...&#xA;WHERE (((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2015-05-21 09:08:27') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2015-05-21 09:08:27')))) AND ((content.title=:contenttitle1) OR (content.title=:contenttitle2) OR (content.title=:contenttitle3))) AND (elements_i18n.enabled = 1)&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `lft`, `postDate` DESC LIMIT 1. Bound with :locale='en', :contenttitle1='Title', :contenttitle2='with', :contenttitle3='commas')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;title = 'Title\,with\,commas';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-05-21T09:14:58.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9845" PostTypeId="2" ParentId="9841" CreationDate="2015-05-21T09:53:38.207" Score="9" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/DbHelper#parseParam-detail&quot;&gt;&lt;code&gt;DbHelper::parseParam&lt;/code&gt;&lt;/a&gt; docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the $value is a string, it will automatically be converted to an array, split on any commas within the string (via ArrayHelper::stringToArray()). If that is not desired behavior, you can escape the comma with a backslash before it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To escape the comma and other characters treated as special in &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/DbHelper#parseParam-detail&quot;&gt;&lt;code&gt;DbHelper::parseParam&lt;/code&gt;&lt;/a&gt; use the &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/DbHelper#escapeParam-detail&quot;&gt;&lt;code&gt;DbHelper::escapeParam&lt;/code&gt;&lt;/a&gt; helper:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;title = DbHelper::escapeParam(&quot;Title, with, commas&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-21T09:53:38.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9847" PostTypeId="1" CreationDate="2015-05-21T15:17:02.990" Score="2" ViewCount="102" Body="&lt;p&gt;I would like to include a Users picker in a custom field type. Not sure if this is possible and practical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know how I can accomplish this, or can you point me in the right direction for self-education?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is no users macro in &lt;code&gt;/app/templates/_includes/forms.html&lt;/code&gt;, &lt;code&gt;/app/fieldtypes/UsersFieldType.php&lt;/code&gt; has almost nothing in it, and I don't know enough about the system yet to know where else to look for ideas.&lt;/p&gt;&#xA;" OwnerUserId="2285" LastActivityDate="2015-05-21T18:09:32.307" Title="How can I include a Users picker in a custom field type?" Tags="&lt;users&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9848" PostTypeId="1" CreationDate="2015-05-21T17:30:59.570" Score="1" ViewCount="99" Body="&lt;p&gt;How does craft manage the counts? And how do I set it to a specific number? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried to do it manually with something along the lines of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ALTER TABLE tablename AUTO_INCREMENT = 1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that doesn't really do the trick. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also noticed that there is no auto_increment setting in the table structures. Can someone please point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3685" LastEditorUserId="22" LastEditDate="2017-05-10T00:04:15.800" LastActivityDate="2017-05-10T00:04:15.800" Title="Reset db &quot;auto_increment&quot; count?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9849" PostTypeId="2" ParentId="9847" CreationDate="2015-05-21T17:41:34.697" Score="2" Body="&lt;p&gt;I don't know your requirements, but you could build a &quot;Users Picker&quot; with the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;Dynamic Fields&lt;/a&gt; plugin. You would basically need to do the same in its settings to build your select options as you'd do in a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get your users with &lt;code&gt;craft.users&lt;/code&gt; and then build an array with &quot;label&quot; and &quot;value&quot; keys using the &lt;code&gt;merge&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pass that array into the Dynamic Fields' settings or build the select options with the &lt;code&gt;forms.selectField&lt;/code&gt; macro in your own plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.group('clients') %}&#xA;&#xA;{% set userOptions = [] %}&#xA;{% for user in users %}&#xA;    {% set userOptions = userOptions|merge([{ label: user.friendlyName, value: user.id }]) %}&#xA;{% endfor %}&#xA;&#xA;{{ forms.selectField({&#xA;    label: 'User'|t,&#xA;    id: id,&#xA;    name: name,&#xA;    options: userOptions,&#xA;    value: value ? value&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-21T18:09:32.307" LastActivityDate="2015-05-21T18:09:32.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9850" PostTypeId="2" ParentId="9848" CreationDate="2015-05-21T19:28:01.870" Score="2" Body="&lt;p&gt;I assume you're referring to the auto incrementing primary key values in the tables.  Craft doesn't manage that at all, but relies on MySQL to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://stackoverflow.com/questions/8923114/how-to-reset-auto-increment-in-mysql&quot;&gt;here&lt;/a&gt; for discussion on how to do it, just keep in mind that there's a pretty high chance you'll be breaking foreign key constraints on existing data.  And I'm pretty sure you'll need to truncate the table first before running the command you tried.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've also noticed that there is no auto_increment setting in the table structures.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure it does. Check the primary key of any table and you'll see the auto increment bit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-21T19:28:01.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9851" PostTypeId="1" CreationDate="2015-05-21T21:43:30.760" Score="0" ViewCount="104" Body="&lt;p&gt;I'm thinking this isn't possible but would be nice if it were?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering if you have loads of different entry types for a section then it would be nice if there was a way of creating a new entry with a certain entry type &lt;em&gt;instead&lt;/em&gt; of having to go to create a new entry and &lt;em&gt;then&lt;/em&gt; select the entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be slightly less confusing for clients and would stop some errors in that they would hopefully always get the right entry type instead of typing into the first entry type that shows up.&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-22T04:15:26.820" Title="Any way to create new entry using certain entry type?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9852" PostTypeId="1" CreationDate="2015-05-21T22:13:04.403" Score="0" ViewCount="131" Body="&lt;p&gt;I'm having a hard time getting our navigation to output properly.&#xA;Anyone mind helping me fix whatever I've done wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how the original, untouched code look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Main Navigation --&amp;gt;&#xA;            &amp;lt;div class=&quot;contain-to-grid fixed&quot;&amp;gt;&#xA;                &amp;lt;nav class=&quot;top-bar&quot; data-topbar role=&quot;navigation&quot;&amp;gt;&#xA;                    &amp;lt;ul class=&quot;title-area&quot;&amp;gt;&#xA;                        &amp;lt;li class=&quot;name&quot;&amp;gt;&#xA;                            &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-home fa-fw&quot;&amp;gt;&amp;lt;/i&amp;gt; {{ siteUrl }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;toggle-topbar menu-icon&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Menu&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;&#xA;                    &amp;lt;section class=&quot;top-bar-section&quot;&amp;gt;&#xA;                        &amp;lt;!-- Right Nav Section --&amp;gt;&#xA;                        &amp;lt;ul class=&quot;right&quot;&amp;gt;&#xA;                            &amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Right Button Active&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                            &amp;lt;li class=&quot;has-dropdown&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Right Button Dropdown&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;First link in dropdown&amp;lt;/a&amp;gt;&#xA;                                            &amp;lt;li class=&quot;has-dropdown&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Right Button sub-Dropdown&amp;lt;/a&amp;gt;&#xA;                                                &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                                                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;First link in sub-dropdown&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                                    &amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Second (Active) link in sub dropdown&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                                &amp;lt;/ul&amp;gt;&#xA;                                            &amp;lt;/li&amp;gt;&#xA;                                        &amp;lt;/li&amp;gt;&#xA;                                        &amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Second (Active) link in dropdown&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                    &amp;lt;/ul&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/nav&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- /Main Navigation --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's my attempt at solving it (with the help of an other thread in here)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;!-- Main Navigation --&amp;gt;&#xA;            &amp;lt;div class=&quot;contain-to-grid fixed&quot;&amp;gt;&#xA;                &amp;lt;nav class=&quot;top-bar&quot; data-topbar role=&quot;navigation&quot;&amp;gt;&#xA;                    &amp;lt;ul class=&quot;title-area&quot;&amp;gt;&#xA;                        &amp;lt;li class=&quot;name&quot;&amp;gt;&#xA;                            &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-home fa-fw&quot;&amp;gt;&amp;lt;/i&amp;gt; {{ siteUrl }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;toggle-topbar menu-icon&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Menu&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;&#xA;                    &amp;lt;section class=&quot;top-bar-section&quot;&amp;gt;&#xA;                        &amp;lt;!-- Right Nav Section --&amp;gt;&#xA;                        &amp;lt;ul class=&quot;right&quot;&amp;gt;&#xA;&#xA;                            {# Get top-level entries in pages structure (exclude home page)  #}&#xA;                            {% set pages = craft.entries.section('pages').id('not 1').level(1) %}&#xA;&#xA;                            {# Loop through top-level entries #}&#xA;                            {% for page in pages %}&#xA;&#xA;                            {# Check if entry has descendants #}&#xA;                            {% if not page.hasDescendants %}&#xA;&#xA;                            {# List navigation item if entry has NO child entries #}&#xA;                            &amp;lt;li class=&quot;active&quot;&amp;gt;&#xA;                                &amp;lt;a href=&quot;{{ page.getUrl }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;&#xA;                            {% else %}&#xA;&#xA;                            {# List navigation item if entry DOES have child entries #}&#xA;                            &amp;lt;li class=&quot;has-dropdown&quot;&amp;gt;&amp;lt;a href=&quot;{{ page.getUrl }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;&#xA;                                    {# Get child entries of current iteration's top-level entry #}&#xA;                                    {% set subPages = page.getChildren() %}&#xA;&#xA;                                    {# Loop through those 2nd-level entries #}&#xA;                                    {% for subPage in subPages %}&#xA;&#xA;                                        {# This is the place where you'd nest the next menu hierarchy !! #}&#xA;&#xA;                                        {# List sub-menu navigation item #}&#xA;                                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ subPage.getUrl }}&quot;&amp;gt;{{ subPage.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;                                    {% endfor %}&#xA;&#xA;                                    &amp;lt;/ul&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;                            {% endif %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endfor %}&#xA;&#xA;                &amp;lt;/nav&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- /Main Navigation --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Main Navigation --&amp;gt;&#xA;            &amp;lt;div class=&quot;contain-to-grid fixed&quot;&amp;gt;&#xA;                &amp;lt;nav class=&quot;top-bar&quot; data-topbar role=&quot;navigation&quot;&amp;gt;&#xA;                    &amp;lt;ul class=&quot;title-area&quot;&amp;gt;&#xA;                        &amp;lt;li class=&quot;name&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-home fa-fw&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                                {% set image = entry.logo.first() %}&#xA;                                {% if image %}&#xA;                                &amp;lt;img src=&quot;{{ image.getUrl( logo ) }}&quot; alt=&quot;{{ image.link }}&quot;&amp;gt;&#xA;                                {{ endif }}&#xA;                            &amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;toggle-topbar menu-icon&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Meny&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;                    &amp;lt;!-- Right Nav Section --&amp;gt;&#xA;                    &amp;lt;section class=&quot;top-bar-section&quot;&amp;gt;&amp;lt;ul class=&quot;right&quot;&amp;gt;&#xA;                        {{ craft.amNav.getNav(&quot;mainMenu&quot;, {&#xA;                            id: 'navigation',&#xA;                            class: 'right',&#xA;                            classActive: 'active',&#xA;                            classChildren: 'has-dropdown',&#xA;                            classLevel2: 'dropdown',&#xA;                            classLevel3: 'dropdown',&#xA;                        }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I ended up solving it this way instead.&lt;/p&gt;&#xA;" OwnerUserId="346" LastEditorUserId="346" LastEditDate="2015-05-22T07:49:39.017" LastActivityDate="2015-05-22T07:49:39.017" Title="Need help fixing my navigations code" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9853" PostTypeId="2" ParentId="9851" CreationDate="2015-05-22T04:15:26.820" Score="1" Body="&lt;p&gt;I assume you're talking about from the control panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, then the answer is no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it sounds like you're asking for a way to maybe set a default entry type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, this sounds more like a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-22T04:15:26.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9854" PostTypeId="2" ParentId="9852" CreationDate="2015-05-22T07:04:01.350" Score="1" Body="&lt;p&gt;You forgot to close the &lt;code&gt;&amp;lt;section class=&quot;top-bar-section&quot;&amp;gt;&lt;/code&gt; tag, have a look at your inspector to see what this does. And you should better have some logic to output &lt;code&gt;active&lt;/code&gt; class to just one menu item. As these are all entries of your structure, you should probably solve this with a comparison like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set active = entry.id == page.id ? 'class=&quot;active&quot;' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then add that to your list items:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li {{ active }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to also make this work in your dropdowns, you should probably be save renaming the variable that holds your second level entry models in the for tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for page in subPages %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-22T07:04:01.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9855" PostTypeId="2" ParentId="5175" CreationDate="2015-05-22T08:58:22.303" Score="2" Body="&lt;p&gt;I ran into this issue too, but there is another cause to this error. Go into Settings &gt; Users &gt; Settings in the Control Panel and ensure &quot;Allow public registration?&quot; is checked, it's unchecked by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it's also worth adding a conditional to the registration page to test if they are logged in or not, to ensure the error can never be triggered for a logged in user too. &lt;/p&gt;&#xA;" OwnerUserId="117" LastActivityDate="2015-05-22T08:58:22.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9856" PostTypeId="1" AcceptedAnswerId="9857" CreationDate="2015-05-22T09:31:18.080" Score="1" ViewCount="2012" Body="&lt;p&gt;I have a Matrix field with 4 Block types. I loop through them like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixFieldHandle %}&#xA;    {% set type = block.type.handle %}&#xA;&#xA;    {% switch type %}&#xA;        {% case 'BlockType1' %}&#xA;            {{ block.fieldHandle }}&#xA;&#xA;        {% case 'BlockType2' %}&#xA;            {{ block.fieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within one of these cases, I need to loop through the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case 'BlockType3' %}&#xA;    {% for row in block|batch(2) %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;&#xA;        {% for block in row %}&#xA;            &amp;lt;div class=&quot;col&quot;&amp;gt;{{ block.fieldHandle }}&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The html output is close, but I do not get any content displayed. What is wrong?&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="57" LastEditDate="2015-05-22T19:27:18.377" LastActivityDate="2015-05-22T19:27:18.377" Title="Loop through entries in a Matrix block type" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9857" PostTypeId="2" ParentId="9856" CreationDate="2015-05-22T10:48:58.163" Score="4" Body="&lt;p&gt;I'm assuming you are talking about your block type having a Entries field within.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You simply loop through it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case 'BlockType3' %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;{% for entry in block.entriesFieldHandle %}&#xA;    &amp;lt;div class=&quot;col&quot;&amp;gt;{{ entry.title }}&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-05-22T10:48:58.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9858" PostTypeId="1" CreationDate="2015-05-22T11:33:27.100" Score="1" ViewCount="96" Body="&lt;p&gt;From a craft matrix block how do i get the field names when no data has yet been entered?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i can write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$o_matrix_block-&amp;gt;getContent()-&amp;gt;getAttributeConfigs();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this will give me an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Array&#xA;                    (&#xA;                        [id] =&amp;gt; Array&#xA;                            (&#xA;                                [maxLength] =&amp;gt; 11&#xA;                                [min] =&amp;gt; -2147483648&#xA;                                [max] =&amp;gt; 2147483647&#xA;                                [decimals] =&amp;gt; 0&#xA;                                [type] =&amp;gt; number&#xA;                                [unsigned] =&amp;gt; &#xA;                                [length] =&amp;gt; 10&#xA;                                [column] =&amp;gt; integer&#xA;                            )&#xA;&#xA;                        [elementId] =&amp;gt; Array&#xA;                            (&#xA;                                [maxLength] =&amp;gt; 11&#xA;                                [min] =&amp;gt; -2147483648&#xA;                                [max] =&amp;gt; 2147483647&#xA;                                [decimals] =&amp;gt; 0&#xA;                                [type] =&amp;gt; number&#xA;                                [unsigned] =&amp;gt; &#xA;                                [length] =&amp;gt; 10&#xA;                                [column] =&amp;gt; integer&#xA;                            )&#xA;&#xA;                        [locale] =&amp;gt; Array&#xA;                            (&#xA;                                [column] =&amp;gt; locale&#xA;                                [default] =&amp;gt; en_gb&#xA;                                [type] =&amp;gt; locale&#xA;                            )&#xA;&#xA;                        [title] =&amp;gt; Array&#xA;                            (&#xA;                                [required] =&amp;gt; &#xA;                                [maxLength] =&amp;gt; 255&#xA;                                [label] =&amp;gt; Title&#xA;                                [type] =&amp;gt; string&#xA;                            )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I only get the array, when I have entered data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with out getcontent() but the array elements are wrong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pls help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;:)&lt;/p&gt;&#xA;" OwnerUserId="2182" LastActivityDate="2015-05-22T12:44:54.260" Title="With Matrix blocks how can i get the column names" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9859" PostTypeId="1" AcceptedAnswerId="9864" CreationDate="2015-05-22T11:52:19.207" Score="6" ViewCount="8690" Body="&lt;p&gt;I'm using a Rich Text field for captions beneath images, so that I can add bold, italic and links. But I'd like the output HTML to be a single line; ie, no block-level tags like &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, or line breaks. At the moment Redactor automatically adds &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags, around a single line of text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting both &lt;code&gt;paragraphize&lt;/code&gt; and &lt;code&gt;replaceDivs&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; in my Redactor config JSON, as suggested &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3063/rich-text-editor-redactor-adding-additional-paragraph-p-tags&quot;&gt;in this answer&lt;/a&gt; but that seems to have no effect for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic', 'link'],&#xA;    minHeight: 50,&#xA;    paragraphize: false,&#xA;    replaceDivs: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2019-07-10T21:32:24.320" Title="Stop Redactor adding paragraph tags" Tags="&lt;redactor&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9860" PostTypeId="2" ParentId="9858" CreationDate="2015-05-22T11:54:54.643" Score="1" Body="&lt;p&gt;My guess is the array is empty because there is no content.&lt;br&gt;&#xA;Try &lt;code&gt;$o_matrix_block-&amp;gt;getType()-&amp;gt;getFields();&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-05-22T11:54:54.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9861" PostTypeId="1" AcceptedAnswerId="9862" CreationDate="2015-05-22T12:23:50.993" Score="1" ViewCount="56" Body="&lt;p&gt;I have a plugin with record and model both setting required to true for a frontend form entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fieldName' =&amp;gt;  array(AttributeType::Name, 'required' =&amp;gt; true),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it is still validating the select option even when there is no value so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;fieldName&quot; name=&quot;fieldName&quot;&amp;gt;&#xA;    &amp;lt;option&amp;gt;--select one--&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=''&amp;gt;--select one--&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still validates as true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get around this?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-05-22T12:29:59.727" Title="Select statement validating as true when no value selected?" Tags="&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9862" PostTypeId="2" ParentId="9861" CreationDate="2015-05-22T12:29:59.727" Score="1" Body="&lt;p&gt;You could try setting a minimum length:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fieldName' =&amp;gt;  array(AttributeType::Name, 'minLength' =&amp;gt; 1, 'required' =&amp;gt; true),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-22T12:29:59.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9863" PostTypeId="2" ParentId="9858" CreationDate="2015-05-22T12:44:54.260" Score="1" Body="&lt;p&gt;my genius colleague found the answer, this will print out the matrix field column names.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$o_user_model = craft()-&amp;gt;userSession-&amp;gt;getUser(); // Get current user&#xA;&#xA;$o_matrix_block_type_model = craft()-&amp;gt;matrix-&amp;gt;getBlockTypeById(5);&#xA;&#xA;$a_fields = $o_matrix_block_type_model-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&#xA;foreach($a_fields as $o_field_layout_field_model) {&#xA;&#xA;    $o_field = $o_field_layout_field_model-&amp;gt;getField();&#xA;    var_dump($o_field-&amp;gt;handle);  &#xA;}&#xA;&#xA;die;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2182" LastActivityDate="2015-05-22T12:44:54.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9864" PostTypeId="2" ParentId="9859" CreationDate="2015-05-22T13:03:47.100" Score="8" Body="&lt;p&gt;Adding these 2 lines worked for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;linebreaks: true,&#xA;enterKey: false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the entire config is now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic', 'link'],&#xA;    minHeight: 50,&#xA;    paragraphize: false,&#xA;    replaceDivs: false,&#xA;    linebreaks: true,&#xA;    enterKey: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-05-22T13:03:47.100" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9865" PostTypeId="1" CreationDate="2015-05-22T13:44:14.433" Score="0" ViewCount="250" Body="&lt;p&gt;I have a problem with multi-environment variables.&#xA;I have used this before on a site and it worked perfectly, but now I'm on a different host and it seems that my SERVER_NAME isn't checked.&#xA;Every setting I put in the '*' =&gt; array is working fine, but in the 'domain.com' =&gt; array, it doesn't work at all.&#xA;It's like the domain isn't checked upon and I have no clue what this could be as I use the exact same code that worked on my previous host for another site.&#xA;I also did a test to check if my SERVER_NAME is correct and it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Config file&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls'  =&amp;gt; true,&#xA;        'devMode'               =&amp;gt; true,&#xA;        'cache'                 =&amp;gt; false&#xA;    ),&#xA;&#xA;    'cmgg.buthost.com' =&amp;gt; array( // Use basePath and baseUrl in asset sources&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath'              =&amp;gt; '/home/butpanel/public_html/cmgg/public/',&#xA;            'baseUrl'               =&amp;gt; 'http://cmgg.buthost.com/',&#xA;        ),&#xA;&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'nl' =&amp;gt; 'http://cmgg.buthost.com/nl/',&#xA;            'fr' =&amp;gt; 'http://cmgg.buthost.com/fr/',&#xA;            'en' =&amp;gt; 'http://cmgg.buthost.com/en/'&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2015-05-26T07:42:27.397" LastActivityDate="2015-05-26T07:42:27.397" Title="Multi-environment config SERVER_NAME not working" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9866" PostTypeId="2" ParentId="9859" CreationDate="2015-05-22T13:44:37.667" Score="5" Body="&lt;p&gt;I found that to get rid of &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags &lt;em&gt;and&lt;/em&gt; stop it appending &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;s to the end of the string, I had to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic', 'link'],&#xA;    toolbarFixed: true,&#xA;    minHeight: 50,&#xA;    linebreaks: true,&#xA;    deniedTags: ['br'],&#xA;    enterKey: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, no need for &lt;code&gt;paragraphize&lt;/code&gt;, but need to stop it printing the &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-05-22T13:44:37.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9867" PostTypeId="1" CreationDate="2015-05-22T14:24:19.957" Score="1" ViewCount="238" Body="&lt;p&gt;I already have Craft running on a single domain name successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my client, we've bought a second domain name for a mini site for SEO purposes, some of which we'd like to use Craft on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are my options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to try to use the same Craft login to manage both sites for the client. The site uses almost identical resources, it would just need a different index page and unique named pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I have to go down the vhosts route?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="125" LastEditDate="2015-05-29T14:59:12.993" LastActivityDate="2015-05-29T14:59:12.993" Title="Two domains, one server with Craft installed" Tags="&lt;url&gt;&lt;server&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9868" PostTypeId="2" ParentId="146" CreationDate="2015-05-22T16:10:32.387" Score="6" Body="&lt;p&gt;Thanks to Kieth for posting an ajax solution. I just wanted to expand on it a little bit to figure out when we are at the end of the entries etc so we can hide loading more buttons etc. Here is what I did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my example I am only loading 2 entries for each click so I'm setting the count to 2, and then incrementing the count on each click by 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I am getting the total count for the entries above and putting this in a hidden input field inside my main container for the ajax section. Don't mind the .id('and, not '~featuredArticleIdsString) as I am just getting featured entries above this and then getting those id's so I can exclude them from the ajax section as I don't want to duplicate those entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('resource') %}&#xA;{% set featuredArticleIds = craft.entries.relatedTo(category).limit(3).ids() %}&#xA;{% set featuredArticleIdsString = featuredArticleIds | join(', not ') %}&#xA;{% set totalEntries = craft.entries.relatedTo(category).id('and, not '~featuredArticleIdsString).find() %}&#xA;{% set totalCount = totalEntries | length %}&#xA;&amp;lt;!-- Ajax Container Start --&amp;gt;&#xA;&amp;lt;div class=&quot;container-fluid add-top resources&quot;&amp;gt;&#xA;    &amp;lt;!-- Set the total count of entries we will have access to in this section--&amp;gt;&#xA;    &amp;lt;input id=&quot;totalResourceCount&quot; type=&quot;hidden&quot; value=&quot;{{totalCount}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then here is the ajax section...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pagingJs %}&#xA;$(function () {&#xA;    var page = 2;&#xA;    // Since we are getting two entries per click we need to set count to 2 to start&#xA;    var count = 2&#xA;   // Get the total count that we set above&#xA;    var totalCount = $(&quot;#totalResourceCount&quot;).val();&#xA;    $('#loadMore').click (function (e) {&#xA;        e.preventDefault();&#xA;        // Check if count is less than totalCount&#xA;        if(count &amp;lt; totalCount){&#xA;            $('#loading').show();&#xA;&#xA;            $.get( &quot;/resource-ajax/p&quot;+page, function( data ) {&#xA;&#xA;                $( &quot;#featuredResults&quot; ).prepend( data ).fadeIn(&quot;slow&quot;);&#xA;                $('#loading').hide();&#xA;                page++;&#xA;                // Increment count by 2 entries&#xA;                count = (count) + 2;&#xA;                // Check if count is greater than or equal to the total count. If so hide the load more button. We need to check if count is greater than since we are incrementing an even number in case are total count is an odd. For example if we have total of 5 entries the second click would set the count to 6...&#xA;                if(count &amp;gt;= totalCount){&#xA;                    $(&quot;#loadMore&quot;).hide();&#xA;                }&#xA;            });&#xA;        }&#xA;    });&#xA;});&#xA;{% endset %}&#xA;{% includeJs pagingJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-05-22T16:10:32.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9869" PostTypeId="1" AcceptedAnswerId="9871" CreationDate="2015-05-22T16:12:13.643" Score="3" ViewCount="502" Body="&lt;p&gt;I'm attempting to build a filter that queries entries of a section based on two criteria: A selection of one or more categories (inclusive), and a single related entry (exclusive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, the entries are from the &quot;technologies&quot; section. Each technology is related to one or more categories and a single &quot;institution&quot; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is to allow a user to, for example, select two categories (like &quot;Information Technology&quot; and &quot;Medical Devices&quot;) and have the results be inclusive. Easily done with a relatedTo &quot;or&quot; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But next, I'd like the user to be able to select a single institution, and return only the previous results that are also associated with that institution (like &quot;UW-Oshkosh&quot;). This filter requires an additional relatedTo &quot;and&quot; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt to add two different relatedTo parameters to the same query (detailed below) doesn't fly -- it will only honor the last relatedTo request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'technologies',&#xA;    limit: null&#xA;} %}&#xA;&#xA;{% if technologyIds|length %}&#xA;    {% set paramTechnologyRelation = ['or'] %}&#xA;    {% for technologyId in technologyIds %}&#xA;        {% set paramTechnologyRelation = paramTechnologyRelation|merge([{ targetElement:technologyId }]) %}&#xA;    {% endfor %}&#xA;    {% set params = params|merge({relatedTo: paramTechnologyRelation}) %}&#xA;{% endif %}&#xA;&#xA;{% if institutionId != &quot;&quot; %}&#xA;    {% set paramInstitutionRelation = ['and'] %}&#xA;    {% set paramInstitutionRelation = paramInstitutionRelation|merge([{ targetElement:institutionId }]) %}&#xA;    {% set params = params|merge({relatedTo: paramInstitutionRelation}) %}&#xA;{% endif %}&#xA;&#xA;{% set technologyResults = craft.entries(params) %}&#xA;&#xA;{% paginate technologyResults.limit(10) as technologies %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to think of other approaches -- Is is possible to run a second query on an array of entries? Any ideas on how to best approach this? Thanks for any insights.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2015-05-22T16:28:46.403" Title="RelatedTo Query Using Both &quot;and&quot; and &quot;or&quot;" Tags="&lt;templating&gt;&lt;relations&gt;&lt;queries&gt;&lt;logic&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9870" PostTypeId="1" AcceptedAnswerId="9886" CreationDate="2015-05-22T16:25:43.537" Score="0" ViewCount="299" Body="&lt;p&gt;&lt;code&gt;{% import _self as mcr_home %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is throwing&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How is this possible and how do I fix it?&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-05-23T20:48:17.283" Title="import _self throwing ElementCriteriaModel could not be converted to string" Tags="&lt;templating&gt;&lt;import&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9871" PostTypeId="2" ParentId="9869" CreationDate="2015-05-22T16:28:46.403" Score="5" Body="&lt;p&gt;Crisis averted, thanks largely in part to the versitile nature of the relatedTo targetElement processing. The relevation came that I could feed an array of category ids (inclusive) into that element, and use a single relatedTo &quot;and&quot; parameter overall to get my intended filtering:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'technologies',&#xA;    limit: null&#xA;} %}&#xA;&#xA;{% set paramRelation = ['and'] %}&#xA;{% if technologyIds|length %}&#xA;    {% set paramRelation = paramRelation|merge([{ targetElement:technologyIds }]) %}&#xA;{% endif %}&#xA;{% if institutionId != &quot;&quot; %}&#xA;    {% set paramRelation = paramRelation|merge([{ targetElement:institutionId }]) %}&#xA;{% endif %}&#xA;{% if paramRelation|length &amp;gt; 1 %}&#xA;    {% set params = params|merge({relatedTo: paramRelation}) %}&#xA;{% endif %}&#xA;&#xA;{% set technologyResults = craft.entries(params) %}&#xA;&#xA;{% paginate technologyResults.limit(10) as technologies %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's actually more simple this way as well, but I had initially underestimated how much heavy lifting the targetElement piece could do. Once again, Craft exceeds expectations. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2015-05-22T16:28:46.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9872" PostTypeId="1" CreationDate="2015-05-22T16:31:42.720" Score="2" ViewCount="921" Body="&lt;p&gt;On a fresh install of &lt;em&gt;Craft&lt;/em&gt; 2.3.2644, using the hostname alone, &lt;code&gt;example.com&lt;/code&gt; returns an error, &quot;&lt;em&gt;The page cannot be displayed because an internal server error has occurred&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I include &lt;code&gt;/index.php&lt;/code&gt; (&lt;code&gt;example.com/index.php&lt;/code&gt;), then the expected &lt;code&gt;index&lt;/code&gt; template is returned, displaying the &quot;Welcome to...&quot; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;code&gt;example.com/news&lt;/code&gt; returns the &lt;code&gt;news&lt;/code&gt; template correctly, even without &lt;code&gt;index.php&lt;/code&gt; in the URI.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 2.3.2644&lt;/li&gt;&#xA;&lt;li&gt;Windows Server 2008 R2&lt;/li&gt;&#xA;&lt;li&gt;IIS 7.5&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;web.config&lt;/code&gt; file included with the &lt;em&gt;Craft&lt;/em&gt; install is present at web root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2015-11-18T23:34:05.827" Title="Home page won't load without 'index.php'" Tags="&lt;url&gt;&lt;config&gt;&lt;install&gt;&lt;index&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9873" PostTypeId="1" CreationDate="2015-05-22T17:44:56.247" Score="2" ViewCount="503" Body="&lt;p&gt;So doing some entries loading via ajax from this question which I expanded on.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/9868/3579&quot;&gt;https://craftcms.stackexchange.com/a/9868/3579&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious about setting up a route for the actual ajax file since it seems a route is needed otherwise it doesn't work, and will 404. In my example you can see I am setting the ajax url as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.get( &quot;/resource-center-ajax/p&quot;+page, function( data ) {//do stuff}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so I setup a route with the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URI resource-center-ajax&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template /resource-center/_resource-center-ajax&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual Template file _resource-center-ajax.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to example.com/resource-center-ajax it will show the results from my ajax file which is just a plain page since I am not including the layout file in that template file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for me to prevent people from accessing this url directly and make it only used for the ajax request? Maybe check if its an ajax request if not redirect to the homepage or something?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-05-22T19:53:53.227" Title="Using ajax with routes is it right?" Tags="&lt;templating&gt;&lt;routes&gt;&lt;ajax&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9874" PostTypeId="2" ParentId="9872" CreationDate="2015-05-22T19:37:14.530" Score="1" Body="&lt;p&gt;If I recall, IIS doesn't include &lt;code&gt;index.php&lt;/code&gt; as a default document when looking for a page to load in a directory, but only things like &lt;code&gt;index.html&lt;/code&gt;, &lt;code&gt;index.htm&lt;/code&gt;, &lt;code&gt;deafult.html&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://technet.microsoft.com/en-us/library/cc771439%28v=ws.10%29.aspx&quot; rel=&quot;nofollow&quot;&gt;Here's how to change it.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-22T19:37:14.530" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9875" PostTypeId="2" ParentId="9873" CreationDate="2015-05-22T19:53:53.227" Score="4" Body="&lt;p&gt;Sure, you can do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax() %}&#xA;  {% redirect siteUrl %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-22T19:53:53.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9876" PostTypeId="1" CreationDate="2015-05-22T20:24:40.960" Score="1" ViewCount="255" Body="&lt;p&gt;We are enabling SSL initially via cloudflare and their free flexible SSL. This works great for the site content, but on the dashboard for craft, if I login, any icons are converted into words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cloudflare.com/ssl&quot; rel=&quot;nofollow&quot;&gt;https://www.cloudflare.com/ssl&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am seeing that the page is serving mixed secure content, but wonder if there is a way to make craft happy with this situation and render the font icon properly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will eventually implement a full SSL cert, but this will be in place for a while.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks :)&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="344" LastEditDate="2015-05-27T08:32:03.717" LastActivityDate="2015-05-27T08:32:03.717" Title="Dashboard icons missing with flexible SSL" Tags="&lt;cp-dashboard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9877" PostTypeId="2" ParentId="9876" CreationDate="2015-05-22T21:15:51.417" Score="3" Body="&lt;p&gt;This is a bit of a stab in the dark, but have you tried forcing SSL for all CP requests?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/force-ssl&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/force-ssl&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately your .htaccess would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA; RewriteEngine On&#xA;&#xA; # Force SSL for CP requests&#xA; RewriteCond %{HTTP_HOST} example\.com [NC]&#xA; RewriteCond %{REQUEST_URI} ^/admin/ [NC]&#xA; RewriteCond %{HTTPS} !=on&#xA; RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-22T21:15:51.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9878" PostTypeId="1" AcceptedAnswerId="9883" CreationDate="2015-05-22T22:18:41.083" Score="2" ViewCount="1812" Body="&lt;p&gt;I'm using &lt;code&gt;getURL()&lt;/code&gt; as follows in my Craft template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sharingImageURL = entry.sharingImage[0].getUrl('socialMedia') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Every time the output is a root relative URL and I'd like it to be a complete URL (including &lt;code&gt;http://www.mydomain.com&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to make that work. Can I do it with &lt;code&gt;getURL()&lt;/code&gt; or is there a different method I should be using? Would appreciate some guidance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="57" LastEditDate="2015-05-22T22:48:09.777" LastActivityDate="2015-05-23T16:55:30.643" Title="How to Make getURL Output Complete URL (rather than root relative)" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9880" PostTypeId="1" AcceptedAnswerId="9884" CreationDate="2015-05-23T14:11:33.877" Score="1" ViewCount="397" Body="&lt;p&gt;my client is looking to move away from ExpressionEngine. One of the reasons for this is that we are approaching the maximum number of sites we can run from MSM due to the limit on the number of columns we can create in MySQL for the data table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Managing Multiple Sites&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it possible to run multiple sites using Craft?&lt;/li&gt;&#xA;&lt;li&gt;Can you provide a login for users that would give them access to just their site?&lt;/li&gt;&#xA;&lt;li&gt;Can you share content from the a global site across local sites?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Forms&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a plugin like Solspace Freeform for creating and managing forms?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Search&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How does site searching work. Would there be a way to tie this in to display local sites only?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Appreciate the help.&lt;/p&gt;&#xA;" OwnerUserId="3692" LastEditorUserId="22" LastEditDate="2017-05-10T00:03:42.980" LastActivityDate="2017-09-07T07:03:34.760" Title="Switching to Craft from ExpressionEngine" Tags="&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9881" PostTypeId="1" CreationDate="2015-05-23T14:31:37.040" Score="2" ViewCount="3257" Body="&lt;p&gt;I would like to install a Redactor plugin (&lt;a href=&quot;http://imperavi.com/redactor/plugins/font-color/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/plugins/font-color/&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I placed the fontcolor.js into &lt;strong&gt;craft/app/ressources/lib/redactor/plugins&lt;/strong&gt;&#xA;and added&lt;br&gt;&#xA;    buttons: ['fontcolor', 'backcolor']&#xA;    plugins: ['fontcolor'] to my redactor json config file.&#xA;but without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Antoine&lt;/p&gt;&#xA;" OwnerUserId="3693" LastActivityDate="2016-02-16T14:57:47.340" Title="Install Redactor plugin" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9882" PostTypeId="2" ParentId="9881" CreationDate="2015-05-23T16:48:13.563" Score="2" Body="&lt;p&gt;You have to add the JS with a Craft plugin, either a custom one making use of &lt;code&gt;includeJsResource&lt;/code&gt; (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a-plugin-add-js-or-css-to-the-control-panel&quot;&gt;this answer&lt;/a&gt; for code example) or with the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel JS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-05-23T16:48:13.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9883" PostTypeId="2" ParentId="9878" CreationDate="2015-05-23T16:55:30.643" Score="3" Body="&lt;p&gt;Craft should actually output absolute URLs when using &lt;code&gt;getUrl&lt;/code&gt;. But you need to set &lt;code&gt;siteUrl&lt;/code&gt; to make this work, so check if you have it set in Settings → General or with a &lt;code&gt;siteUrl&lt;/code&gt; property in your general.php config file.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-23T16:55:30.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9884" PostTypeId="2" ParentId="9880" CreationDate="2015-05-23T18:53:38.667" Score="4" Body="&lt;p&gt;You ask multiple questions at once – some of them quite broad. I'd recommend you create separate threads for each of your questions, and to try to be as specific as possible – e.g. elaborate a little on what you mean by &quot;run multiple sites&quot;. That being said, in the event this thread isn't closed for being too broad I'll try to answer some of your main questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to run multiple sites using Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't have an MSM-type feature, so short answer is no. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/408/are-there-any-intentions-to-release-multisite-support-for-craft&quot;&gt;See this thread&lt;/a&gt; for some further details and alternative solutions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a plugin like Solspace Freeform for creating and managing&#xA;  forms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure is. There's &lt;a href=&quot;https://straightupcraft.com/craft-plugins/sprout-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt; which is a commercial, full-featured forms plugin, as well as a few free, smaller plugins such as &lt;a href=&quot;https://straightupcraft.com/craft-plugins/form-builder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Builder&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How does site searching work. Would there be a way to tie this in to display local sites only?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd suggest you look at the &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;official docs on searching&lt;/a&gt; in Craft, as well as the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;example search form&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-05-24T07:13:17.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9885" PostTypeId="1" CreationDate="2015-05-23T19:33:55.743" Score="0" ViewCount="159" Body="&lt;p&gt;Anyone know how to utilise the &lt;strong&gt;getActivePageIdForLevel&lt;/strong&gt; function that AM Nav (&lt;a href=&quot;https://github.com/am-impact/amnav&quot; rel=&quot;nofollow&quot;&gt;https://github.com/am-impact/amnav&lt;/a&gt;) now has? Would really like to be able to have a secondary menu on a page which just has the navigation items that are for that current section. Can't see how to use it in the Docs though?&lt;/p&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="45" LastEditDate="2015-05-23T20:35:30.347" LastActivityDate="2015-05-23T20:35:30.347" Title="AM Nav - startFromId - how?" Tags="&lt;plugins&gt;&lt;navigation&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9886" PostTypeId="2" ParentId="9870" CreationDate="2015-05-23T20:48:17.283" Score="3" Body="&lt;p&gt;In short, those two have nothing to do with each other. What's more likely is that the error is being triggered &lt;strong&gt;by the imported script&lt;/strong&gt;. It's possible that your stack trace is just giving you a red herring by pointing to the import itself.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your Twig code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/import.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt; pulls in a macro (or macros).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_self&lt;/code&gt; just means &quot;this template file&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;mcr_home&quot; is just how you're referring to your imported macro(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the error message:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ElementCriteriaModel&lt;/code&gt;&lt;/a&gt; is simply &lt;a href=&quot;https://craftcms.stackexchange.com/q/2763/45&quot;&gt;a model representing a Craft content search&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;could not be converted to string&quot; is telling you that the model cannot be read as a string.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Obviously there is no correlation there. Take a closer look at the macro(s) you are importing... I'm certain you will find an ElementCriteriaModel which is attempting to be used as a string.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-23T20:48:17.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9887" PostTypeId="1" CreationDate="2015-05-24T05:27:59.080" Score="1" ViewCount="994" Body="&lt;p&gt;I know there are some similar questions out there but none of the solutions suits my needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is to display some related entries (from another section) within my blog posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have right now. Not working (obviously, it's me :))&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries %}&#xA;    {% for block in entry.matrix %}&#xA;        {% if block.type == &quot;body&quot; %}&#xA;&#xA;                {% for recipe in craft.entries.section('recipes').search('block.body:pizza').order('score') %}&#xA;                    {{ recipe.title }}&#xA;                {% endfor %}&#xA;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="57" LastEditDate="2015-05-24T05:36:56.030" LastActivityDate="2015-08-19T07:13:33.817" Title="Search within Matrix Field" Tags="&lt;matrix&gt;&lt;field&gt;&lt;search&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9888" PostTypeId="1" AcceptedAnswerId="9901" CreationDate="2015-05-24T11:50:10.150" Score="3" ViewCount="1753" Body="&lt;p&gt;I’ve got a small, low traffic site that I’ve rewritten with Craft and a Bootstrap responsive grid, mainly as a learning exercise. The original site has just a dozen static pages, and is hosted with Fasthosts UK-based shared hosting. My new site, although small, makes extensive use of Craft’s Matrix. I’ve learned a lot and I’m really pleased with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve started to install the new site (alongside the old one) and I’ve discovered that Fasthosts shared hosting doesn’t allow the new index.php file to be located inside a ‘public’ sub-folder – it has to be at the root of the htdocs folder. So my first option seems to be to empty the contents of my ‘public’ folder into my htdocs folder, to live alongside the craft folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are stern, but mysterious, warnings about doing this in Craft’s installation documentation: &quot;We recommend that you upload the folder above your web root if possible, which will ensure that no one can access any of its files directly. (Your web root is the folder that your domain name points to.) That’s not a requirement, but do it if you can. For the children.” &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please explain what bad things might happen if I take this first option?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a bit of research before I posted this question, and I came across a second option to leave everything in the public folder and to use mod_rewrite code in the .htaccess file to re-route requests for index.php into the public folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, I found a third option of creating an extra index.php file located in the htdocs folder to point to index.php the public folder, with this re-direction code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;?php&#xA;header('Location: http://mydomain.com/public');&#xA;exit;&#xA;?&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of these three options is the best compromise from a security / SEO / performance perspective?&lt;/p&gt;&#xA;" OwnerUserId="3695" LastActivityDate="2015-05-26T05:07:30.997" Title="How do I install Craft in shared hosting that doesn't allow index.php in a sub-folder" Tags="&lt;install&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9889" PostTypeId="2" ParentId="9888" CreationDate="2015-05-24T14:09:03.300" Score="5" Body="&lt;p&gt;It's not so much that you can't have the index.php file in a subfolder that might be an issue; it is that you can't put the &lt;code&gt;craft&lt;/code&gt; folder above your webroot. If you have access to the folder that &lt;code&gt;htdocs&lt;/code&gt; is inside, you should try putting the &lt;code&gt;craft&lt;/code&gt; folder inside that. It might not be obvious, but there's no reason that the &lt;code&gt;public&lt;/code&gt; folder has to be named public. It could be &lt;code&gt;html&lt;/code&gt;, &lt;code&gt;htdocs&lt;/code&gt;, or &lt;code&gt;whatever&lt;/code&gt;. The point is that you're suppose to put the &lt;code&gt;craft&lt;/code&gt; folder above this folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On many &quot;simple&quot; webhosts, you may not be allowed to do this, and you have to put the &lt;code&gt;craft&lt;/code&gt; folder within your &lt;code&gt;public&lt;/code&gt; folder. The security risk involved with doing this is, as the warning states, related to your &lt;code&gt;craft&lt;/code&gt; folder being directly accessible through a webbrowser. For instance, you're &lt;code&gt;db.php&lt;/code&gt; config file would now be &quot;accessible&quot; by going to &lt;code&gt;http://yourdomain.com/craft/config/db.php&lt;/code&gt;. As long as your webserver is configured correctly, and there are no security holes to exploit, this doesn't really matter, since the file will be processed as php, and doesn't output anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, in theory, if a malicious user manages to, for instance, crash the php process, he'd see the file as pure text. Or, if he's able to initiate a download of a file inside your public root, he'd be able to get to all your configuration files. But, then again, you might have problems even if the craft folder is outside of your public root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't put &lt;code&gt;craft&lt;/code&gt; outside your public root folder, options 2) and 3) doesn't really help, they just introduce more problems. Just put the files in your &lt;code&gt;public&lt;/code&gt; folder, and the &lt;code&gt;craft&lt;/code&gt; folder, inside your &lt;code&gt;htdocs&lt;/code&gt; folder, and reconfigure the path to craft in index.php to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = './craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, make sure that inside your &lt;code&gt;craft&lt;/code&gt; folder the .htaccess file that comes with Craft is still there. It's suppose to say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;deny from all&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should, under normal circumstances, deny direct access to the &lt;code&gt;craft&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-05-24T14:09:03.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9890" PostTypeId="1" AcceptedAnswerId="9891" CreationDate="2015-05-24T15:37:05.560" Score="6" ViewCount="11878" Body="&lt;p&gt;How do I display my entry post date, formated as &quot;May 24, 2015&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a very basic question, but I can never find these easy answers in either the Craft or Twig documentation.&lt;/p&gt;&#xA;" OwnerUserId="3381" LastActivityDate="2015-05-24T18:57:35.093" Title="Display entry post date" Tags="&lt;entry&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9891" PostTypeId="2" ParentId="9890" CreationDate="2015-05-24T15:47:48.840" Score="20" Body="&lt;pre&gt;&lt;code&gt;{{ entry.postDate | date(&quot;M d, Y&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside the date filter, you use the date formatting values documented in the &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;noreferrer&quot;&gt;PHP date() documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, see &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime&quot; rel=&quot;noreferrer&quot;&gt;Craft's DateTime documentation&lt;/a&gt;, and the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;noreferrer&quot;&gt;Twig date() filter documentation&lt;/a&gt; for more information on the topic.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-05-24T18:57:35.093" LastActivityDate="2015-05-24T18:57:35.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9892" PostTypeId="1" CreationDate="2015-05-25T11:24:24.130" Score="1" ViewCount="99" Body="&lt;p&gt;I am writing a plugin to that will map &lt;a href=&quot;http://short.com/e9DG&quot; rel=&quot;nofollow&quot;&gt;http://short.com/e9DG&lt;/a&gt; to http:/longdomainname.com/longsubpagename&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I need to use the config/routes.php but am having struggling to understand how how to set this up. I keep getting 404 as it cannot resolve the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a test I have the foloing code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'e9DG' =&amp;gt; array('action' =&amp;gt; '/cocktailrecipes/ingredients/new'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3521" LastActivityDate="2015-05-26T05:26:21.350" Title="How to route short tag to external web site" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9893" PostTypeId="2" ParentId="5175" CreationDate="2015-05-25T14:28:27.203" Score="1" Body="&lt;p&gt;It sounds like all you need is the guest entries plugin from Pixel &amp;amp; Tonic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-25T14:28:27.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9894" PostTypeId="1" AcceptedAnswerId="9900" CreationDate="2015-05-25T14:47:50.290" Score="1" ViewCount="206" Body="&lt;p&gt;complete newbie question here. Craft is so well designed, I could probably work it out, but it seems like this simple info might help others as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here goes, a two part question:&#xA;1. Is there a simple list of the types of pages Craft outputs?&#xA;   (like single-entry, single-category, search-results, etc)&#xA;2. What are all the variables available to each of those?&#xA;   (single-entry has a variable called 'entry', plus the globals, I think)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-26T05:31:09.760" Title="What variables are available to what template types?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9895" PostTypeId="1" AcceptedAnswerId="9899" CreationDate="2015-05-25T15:49:23.043" Score="1" ViewCount="1104" Body="&lt;p&gt;I'm trying to setup a virtual host to access my craft project through ontherocks.dev, without any success yet.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;www.ontherocks.dev&lt;/strong&gt; : correct response&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;www.ontherocks.dev/admin&lt;/strong&gt; : Apache 404&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;www.ontherocks.dev/index.php/admin&lt;/strong&gt; : redirected to &lt;em&gt;www.ontherocks.dev/admin/install&lt;/em&gt; with an Apache 404&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I didnt &quot;install&quot; craft yet, which explains the redirect. Here are my config files for the virtual host :&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;httpd-vhosts.conf&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;  ServerName ontherocks.dev&#xA;  DocumentRoot &quot;C:\wamp\www\y-lynx&quot;&#xA;  ServerAlias www.ontherocks.dev&#xA; DirectoryIndex index.php&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;hosts file in system32/drivers/etc&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# localhost name resolution is handled within DNS itself.&#xA;#   127.0.0.1       localhost&#xA;#   ::1             localhost&#xA;127.0.0.1       ontherocks.dev&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="344" LastEditDate="2015-05-27T08:31:58.430" LastActivityDate="2015-05-27T08:31:58.430" Title="Using a virtual host result in internal error" Tags="&lt;environments&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9896" PostTypeId="2" ParentId="9892" CreationDate="2015-05-25T18:04:57.237" Score="3" Body="&lt;p&gt;With the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;registerSiteRoutes&lt;/code&gt;&lt;/a&gt; hook you can route &lt;a href=&quot;http://short.com/e9DG&quot; rel=&quot;nofollow&quot;&gt;http://short.com/e9DG&lt;/a&gt; requests to any template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'e9DG' =&amp;gt; '/mysection/mytemplate.html',&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getUrl&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;redirect&lt;/code&gt;&lt;/a&gt; accessible via &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;request&lt;/code&gt;&lt;/a&gt; you can set up server redirects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = craft()-&amp;gt;request-&amp;gt;getUrl();&#xA;&#xA;if ($url == 'http://short.com/e9DG')&#xA;{&#xA;    craft()-&amp;gt;request-&amp;gt;redirect('http:/longdomainname.com/longsubpagename', true, 301);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-25T18:04:57.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9897" PostTypeId="1" AcceptedAnswerId="9898" CreationDate="2015-05-26T01:03:58.800" Score="1" ViewCount="314" Body="&lt;p&gt;I'm working on a plugin with it's own CP section as described in the docs &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates#giving-your-plugin-its-own-cp-section&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. What is the appropriate way to include CSS styling for that page?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-26T01:48:17.830" Title="&quot;Giving your Plugin its own CP Section&quot; What about the CSS?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9898" PostTypeId="2" ParentId="9897" CreationDate="2015-05-26T01:48:17.830" Score="3" Body="&lt;p&gt;You can include CSS for your plugin one of two ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) Inline CSS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can include CSS snippets by using &lt;code&gt;{% includeCss myCss %}&lt;/code&gt;. This is great if you are just wanting to include a few lines of CSS. Read more here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/includecss&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/includecss&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Reference a Resource CSS file&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually contained in your /resources folder inside your plugin you can include a CSS file by using &lt;code&gt;{% includeCssResource &quot;pluginName/styles.css&quot; %}&lt;/code&gt; You can read more here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/resources&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/resources&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2015-05-26T01:48:17.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9899" PostTypeId="2" ParentId="9895" CreationDate="2015-05-26T03:25:26.623" Score="2" Body="&lt;p&gt;Looks like the &lt;code&gt;.htaccess&lt;/code&gt; file included with Craft is not being read or you didn't rename it (should be &lt;code&gt;.htaccess&lt;/code&gt; with the period at the beginning). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why &lt;code&gt;/index.php/admin&lt;/code&gt; is working but &lt;code&gt;/admin/&lt;/code&gt; is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other possibility is Apache is setup to ignore .htaccess files. If that's the case, add this to your &lt;code&gt;httpd-vhosts.conf&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory &quot;C:\wamp\www\y-lynx&quot;&amp;gt;&#xA;    AllowOverride All&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(If you already have a &lt;code&gt;&amp;lt;Directory &quot;C:\wamp\www\y-lynx&quot;&amp;gt;&lt;/code&gt; block, just add in &lt;code&gt;AllowOverride All&lt;/code&gt; somewhere inside.)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-05-26T03:25:26.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9900" PostTypeId="2" ParentId="9894" CreationDate="2015-05-26T04:35:57.187" Score="2" Body="&lt;p&gt;It looks like you're coming from some other system? When I see &quot;single-whatever&quot; I think of WordPress' specific template structure... which may or may not have any meaning in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike something like WordPress where there's a very specific structure to how you get information and what template determines how it behaves, Craft is a bit more open-ended (and DIY) in that regard and that can lead to some confusion, especially if you try to setup something like a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;search page&lt;/a&gt; and then try to use &lt;code&gt;entry&lt;/code&gt; as variable (which won't be defined, unless you define it yourself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1. Is there a simple list of the types of pages Craft outputs?&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other content management systems, Craft really doesn't have a concept of &quot;page types&quot;. One of the great things about Craft (and probably slightly confusing when you first start) is how you reference content throughout the system in the same, simple way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably know that Craft holds your &quot;page&quot; content in what are called &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;Entries&lt;/a&gt;. Think of Entries like Pages since they can map to a URL but they don't necessarily have to...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. What are all the variables available...&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Templates more or less work the same throughout. Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Globals&lt;/a&gt; are available no matter which template you're in, but Craft really allows you to fetch any piece of content (user, asset, tag, entry, etc.) anywhere you need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I think you're kind of asking about is when you view an entry or category specifically...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you setup your sections/categories to have a URL/slug that Craft knows about, Craft automatically will populate the &lt;code&gt;entry&lt;/code&gt; or &lt;code&gt;category&lt;/code&gt; variable for you so you can access things like title, slug, and any custom fields you might also have on that entry or category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's basically a shortcut so you don't have to get it yourself and determine what kind of &quot;page&quot; you're on when you're in a template. Plugins can also inject their own variables into the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's documentation on &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing&lt;/a&gt; is a good place to reference on this as well, especially if you're used to another system where a certain file/folder structure is implied. Everything is up to you so your templates can be as messy or clean as you want them to be. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-05-26T05:31:09.760" LastActivityDate="2015-05-26T05:31:09.760" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9901" PostTypeId="2" ParentId="9888" CreationDate="2015-05-26T05:07:30.997" Score="1" Body="&lt;p&gt;As André mentioend, everything inside your &lt;code&gt;public&lt;/code&gt; folder should go inside FastHosts' &lt;code&gt;htdocs&lt;/code&gt; folder. Public is just what Craft says should go in your publicly accessible web &quot;root&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On most hosts I've seen, you should be able to put the Craft folder on the same level where &lt;code&gt;htdocs&lt;/code&gt; lives. Generally I've found shared hosting to look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/yourhomefolder/domain.com/htdocs/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an htdocs folder, everything inside what's in your &lt;code&gt;public&lt;/code&gt; folder will go in there and the &lt;code&gt;craft&lt;/code&gt; folder will go inside your domain.com folder, up one level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the host is running something like cpanel, you can usually change which folder your website domain's root is going to be. In that case, just keep your public folder, and then point the domain's &quot;root&quot; to be that folder, instead of htdocs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/yourhomefolder/domain.com/htdocs/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have a control panel option, sometimes contacting support and asking them if that's possible can help.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-05-26T05:07:30.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9902" PostTypeId="2" ParentId="9892" CreationDate="2015-05-26T05:26:21.350" Score="1" Body="&lt;p&gt;Take a look at &lt;a href=&quot;https://github.com/aberkie/craft-shortener&quot; rel=&quot;nofollow&quot;&gt;Shortener&lt;/a&gt; and &lt;a href=&quot;https://github.com/davist11/craft-reroute/&quot; rel=&quot;nofollow&quot;&gt;Reroute&lt;/a&gt; for inspiration as well ( might save you some trouble if you're just trying to write a general URL shortener!)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-05-26T05:26:21.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9903" PostTypeId="2" ParentId="8574" CreationDate="2015-05-26T05:43:38.237" Score="9" Body="&lt;p&gt;The &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7185745-conditionals-in-field-layouts&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request for this&lt;/a&gt; has been very popular since day one, so hopefully it's something P&amp;amp;T adds to the core some day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the interim I just published a small plugin called Reasons, which will add simple field/value based conditionals to entry type field layouts - pretty much exactly like the OP describes it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download from GitHub: &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mmikkel/Reasons-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&#xA;P&amp;amp;T retired the UserVoice page; &lt;a href=&quot;https://github.com/craftcms/cms/issues/805&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is the new home for the feature request&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-12-04T00:44:51.880" LastActivityDate="2018-12-04T00:44:51.880" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9905" PostTypeId="1" AcceptedAnswerId="9906" CreationDate="2015-05-26T11:56:03.617" Score="0" ViewCount="204" Body="&lt;p&gt;For some reason there is not really a clear mention on the Craft documentation about this. And I couldn't really find anything in here that explains it either. I know this is kind of basic knowledge for Craft, so here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a single section called 'work' and a folder of the same name in my templates folder (with an index.html inside). I try to link to it with &lt;a href=&quot;http://www.mydomain.com/work/&quot; rel=&quot;nofollow&quot;&gt;http://www.mydomain.com/work/&lt;/a&gt; but it doesn't work! It gives a 404 error. I don't understand why it doesn't work. I don't remember having trouble with this before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can possibly go wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create simple links like this to other singles?&lt;/p&gt;&#xA;" OwnerUserId="3697" LastEditorUserId="344" LastEditDate="2015-05-27T08:31:23.287" LastActivityDate="2015-05-27T08:31:23.287" Title="Simple linkage to singles" Tags="&lt;url&gt;&lt;sections&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9906" PostTypeId="2" ParentId="9905" CreationDate="2015-05-26T12:11:24.523" Score="1" Body="&lt;p&gt;You made the template filename and folder match the URI (&lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing case 6&lt;/a&gt;), which is not necessary for entries. Because you probably also set a template in the section setting, this is getting loaded for &lt;a href=&quot;http://example.com/work/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/work/&lt;/a&gt; (&lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing case 4&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think you should just edit the single section's settings and point to the right template.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-26T12:11:24.523" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9907" PostTypeId="1" AcceptedAnswerId="9910" CreationDate="2015-05-26T12:51:23.973" Score="2" ViewCount="338" Body="&lt;p&gt;I found this post about restricting an entire asset source and placing it below the root level: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/804/is-it-possible-to-have-secure-private-assets&quot;&gt;Is it possible to have secure (private) assets?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd really like to do is be able to set the members-only restriction on a per-file basis, perhaps with a lightswitch field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imagined flow would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;user clicks a file link (anywhere, or even has a direct URL to the file)&lt;/li&gt;&#xA;&lt;li&gt;.htaccess sends all .pdf, .doc, etc requests to a download checker page&lt;/li&gt;&#xA;&lt;li&gt;download checker page sees if the requested file has the lightswitch checked&lt;/li&gt;&#xA;&lt;li&gt;if no, download the file&lt;/li&gt;&#xA;&lt;li&gt;if yes, &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if logged in, download the file&lt;/li&gt;&#xA;&lt;li&gt;if not logged in, show the registration / login page&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;upon login or registration, start the file download&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm still relatively new to Craft and have the feeling there may be specific twig/craft abilities that make this — or something very similar — simple. I don't necessarily need the code handed to me, just some ideas about what tools are available to help with this process.&lt;/p&gt;&#xA;" OwnerUserId="2285" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-05-26T14:29:32.267" Title="How can I restrict assets on a per-file basis?" Tags="&lt;assets&gt;&lt;member&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9908" PostTypeId="1" CreationDate="2015-05-26T13:53:02.617" Score="2" ViewCount="143" Body="&lt;p&gt;I'm looking to combine three different channels on the homepage, ordered by date, unless the client rearranges the hierarchy in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low Reorder for EE had this customization, where entries would come into the plugin ordered by date, but you could drag and drop entries to the top if you wanted to rearrange the hierarchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Structures is close, but 1) I need to combine three different channels into one hierarchy, and 2) these channels will grow immensely over time, so Structures will become cumbersome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are my options, if any? Is there a Low Reorder-type plugin out there?&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2015-05-26T14:58:55.893" Title="Ordering homepage posts by date, but give customized ordering option in CP" Tags="&lt;entries&gt;&lt;structure&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9909" PostTypeId="1" AcceptedAnswerId="10034" CreationDate="2015-05-26T14:29:24.570" Score="0" ViewCount="230" Body="&lt;p&gt;The goal is to have a &lt;strong&gt;variable&lt;/strong&gt;(link) merged with prefix &quot;any special character&quot;, that will not break the URL(&lt;em&gt;this was pointed to my about character in URL lately, but in this question, We use &quot;#&quot;)&lt;/em&gt;. So the final output would be &quot;site.com/#variable&quot; (in my case it is the author of an entry and a link to author's profile. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I'd have to route it to get the correct template loaded. The whole reason behind is, that the current prefix would avoid of potential conflicts with other templates in case, some username will be 'index'.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-06-04T17:48:25.187" LastActivityDate="2015-06-05T07:54:17.377" Title="Is it achievable to route a dynamic URI with prefixed character?" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9910" PostTypeId="2" ParentId="9907" CreationDate="2015-05-26T14:29:32.267" Score="2" Body="&lt;p&gt;Why don't you just set up two separate asset sources, one default one with files being freely accessible and one source with access for logged-in users only by making use of that &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow&quot;&gt;Internal Assets Plugin&lt;/a&gt; you mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of managing the rights with a lightswitch you would upload or move the assets in the right source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be to have two asset fields for your entry type, one configured for each source. And you could then always hide one of them with a lightswitch using the brand new &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow&quot;&gt;Reasons&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-26T14:29:32.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9911" PostTypeId="2" ParentId="9908" CreationDate="2015-05-26T14:58:55.893" Score="1" Body="&lt;p&gt;For me this looks like a perfect fit for one structure with different entry types for each of your content types (text, video and recipes). Each entry type can have it's own set of fields, so there's no difference to individual channels (with one entry type each).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simply have the entry type's handle in your URIs, as the &lt;code&gt;{type}&lt;/code&gt; tag is available in section URL settings (→ see &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-urls&quot; rel=&quot;nofollow&quot;&gt;help article&lt;/a&gt;), or you'd set up custom &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via the entry's &lt;code&gt;entry.type&lt;/code&gt; property you can include individual template partials for each entry type on your index page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;        {% include '/blog/_partials/' ~ entry.type %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same for your _entry.html file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '/blog/' ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I've heard that structures with many hundreds or thousands of entries is no problem for the control panel. I think it was Craft 2.0 that had many optimizations in that respect.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-26T14:58:55.893" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9913" PostTypeId="1" AcceptedAnswerId="9914" CreationDate="2015-05-27T00:08:33.767" Score="3" ViewCount="668" Body="&lt;p&gt;I need to group and order member profiles alphabetically but I can't get it to work. Have a look here: &lt;a href=&quot;http://ffsd.de.w0129b45.kasserver.com/mitglieder&quot; rel=&quot;nofollow&quot;&gt;http://ffsd.de.w0129b45.kasserver.com/mitglieder&lt;/a&gt;&#xA;(It's german but you should get the idea :))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In everything I tried either the groups are ordered correctly or the contents (profiles) of the group are… but never both. Here's the relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProfiles = craft.entries.section('members').order('profileLastname').limit(null) %}&#xA;{% for letter, profiles in allProfiles|group(&quot;profileAlphabet&quot;) %}&#xA;    &amp;lt;ul class=&quot;member__index&quot;&amp;gt;&#xA;        &amp;lt;li class=&quot;item letter&quot;&amp;gt;&#xA;            &amp;lt;span id=&quot;{{ letter }}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;avatar&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;initials letter&quot;&amp;gt;{{ letter }}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/span&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% for profile in profiles %}&#xA;            &amp;lt;li class=&quot;item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ profile.url }}&quot;&amp;gt;&amp;lt;h3&amp;gt;{{ profile.title }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I'd like to order the profiles by the custom field &quot;profileLastname&quot; and the groups by &quot;profileAlphabet&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="174" LastActivityDate="2020-11-10T22:51:10.717" Title="Order grouped entries" Tags="&lt;templating&gt;&lt;entries&gt;&lt;group&gt;&lt;order&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9914" PostTypeId="2" ParentId="9913" CreationDate="2015-05-27T07:10:13.813" Score="5" Body="&lt;p&gt;The probably most easy way to do this is to sort the grouped array by key, which unfortunatelly is only possible with&#xA;a plugin, as Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/sort.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;sort&lt;/code&gt;&lt;/a&gt; filter only allows to sort by value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I'm using Michael Rog's &lt;a href=&quot;https://topshelfcraft.com/lagniappe/supersort&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supersort&lt;/a&gt;, but there are also other plugins that do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProfiles = craft.entries.section('members').order('profileLastname').limit(null) %}&#xA;{% set allProfilesGrouped = allProfiles|group(&quot;profileAlphabet&quot;)|supersort('ksort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3951" LastEditDate="2017-08-02T17:33:41.170" LastActivityDate="2017-08-02T17:33:41.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9915" PostTypeId="1" AcceptedAnswerId="9919" CreationDate="2015-05-27T08:40:47.077" Score="5" ViewCount="1334" Body="&lt;p&gt;How can I add a CSS class to all images inserted into a rich text field ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie. so an image inserted has style= &quot;image fit&quot; added to the img selector&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2019-11-22T11:14:48.097" Title="Adding class to images in rich text" Tags="&lt;redactor&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9916" PostTypeId="1" CreationDate="2015-05-27T08:50:28.347" Score="0" ViewCount="76" Body="&lt;p&gt;I just moved my website on my production environment, and when I try to login, I get the &quot;MySQL 5.1.0 is required...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I did a &lt;code&gt;phpinfo()&lt;/code&gt; and got &lt;code&gt;Client API version  5.1.73&lt;/code&gt; for MySQL.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/J9Kyb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did I do wrong ?&#xA;Thanks a lot !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2015-05-27T08:50:28.347" Title="Craft requires MySQL 5.1, got 5.1.73 and an error" Tags="&lt;database&gt;&lt;requirements&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9917" PostTypeId="1" CreationDate="2015-05-27T09:26:59.647" Score="1" ViewCount="177" Body="&lt;p&gt;Is there a way to add an nofollow option to the rich text editor? Just like new window option.&#xA;The only thing I found is a Redactor config to make &lt;em&gt;all&lt;/em&gt; links nofollow. But I need it optional per link.&lt;/p&gt;&#xA;" OwnerUserId="2244" LastActivityDate="2015-06-26T18:22:22.980" Title="nofollow option for rich texts" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9918" PostTypeId="2" ParentId="9915" CreationDate="2015-05-27T09:48:23.433" Score="1" Body="&lt;p&gt;There's a plugin that's supposed to do what you want: &lt;a href=&quot;https://github.com/nilsenpaul/redactoraddattributes/&quot; rel=&quot;nofollow&quot;&gt;Redactor Add Attributes&lt;/a&gt;, but unfortunately it doesn't work with Craft newer that 2.0 (which includes the completely refactored Redactor 10).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-05-27T10:14:39.253" LastActivityDate="2015-05-27T10:14:39.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9919" PostTypeId="2" ParentId="9915" CreationDate="2015-05-27T11:57:02.517" Score="6" Body="&lt;p&gt;I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;noreferrer&quot;&gt;Retcon HTML&lt;/a&gt; which will solve this nicely using PHP's &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; rel=&quot;noreferrer&quot;&gt;DOMDocument&lt;/a&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to use the &lt;code&gt;attr&lt;/code&gt; filter, which is documented &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.richTextField | retconAttr( 'img', { 'class' : 'image fit' }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-27T13:20:18.477" LastActivityDate="2015-05-27T13:20:18.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9920" PostTypeId="1" CreationDate="2015-05-27T12:24:06.103" Score="1" ViewCount="876" Body="&lt;p&gt;Ok this is now a general question as I managed to import the user table to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately it appears that whilst the users all show in the database they do not show in the CMS. Digging a bit deeper it seems they are related to the elements table as each appear to have an entry with a type User.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question now is how can you import your existing user list into a new craft set up without breaking it or anything else. With over 10000 users this is not one to be done manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-05-27T16:22:26.410" LastActivityDate="2015-05-27T18:04:39.613" Title="How to import existing users into database" Tags="&lt;users&gt;&lt;database&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9921" PostTypeId="1" AcceptedAnswerId="9924" CreationDate="2015-05-27T15:30:10.370" Score="1" ViewCount="1427" Body="&lt;p&gt;Sorry if this question is starting off too abstract. I'm porting a calendar plugin from Textpattern and WordPress into Craft.  Basic workflow for the output has been (in twig terms):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = &quot;now&quot;|date(&quot;Y-m-d&quot;) %}&#xA;{{ craft.Calendar37.calendar_full(start)|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the plugin php does all the work of querying the db and producing the calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm up against is getting the db query right. It seems pretty abstract to get all the fields related to an entry--in particular working out the query to get the category from a category field in the entry. Probably I can work that out, but here's my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be possible or better to do more of the work with Twig, and less in php?  I.e. once the php db query knows the entries and i could put that into (I suppose) a model, then can Twig figure out the rest using (I haven't tried this, just working it out in my mind):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = &quot;now&quot;|date(&quot;Y-m-d&quot;) %}&#xA;{% craft.Calendar37.initialize(start) %}  {# just does the DB query #}&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;  ...&#xA;  &amp;lt;td&amp;gt;&#xA;    {% set event_instances = craft.Calendar37.getInstances(date) %}&#xA;    {% for instance in event_instances %}&#xA;       {% set entry = craft.entries.id(instance.entryId) %}&#xA;       &amp;lt;li title='{{ entry.tip }}'&amp;gt;&#xA;          &amp;lt;a href='{{ siteUrl }}{{ entry.category }}'&amp;gt;&#xA;             {{ instance.time }} - {{ craft.entries.id(instance.entryId).title }}&#xA;          &amp;lt;/a&amp;gt;&#xA;       &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wonder about efficiency.  One big, but precise query in php is probably better than going back from twig for every event on each day of the month as shown in the second part here.  This is the query so far; it doesn't find the category, or slug, or several other things yet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$events = $query&#xA;    -&amp;gt;select('*') //c37.event_id, dateYmd, timestr, alt_text, css_class, entries.id as event_id, title as event_title, slug')&#xA;    -&amp;gt;from('calendar37 c37')&#xA;    -&amp;gt;join('entries entries', 'c37.event_id = entries.id')&#xA;    -&amp;gt;join('content content', 'entries.id = content.elementId')&#xA;    -&amp;gt;join('elements_i18n elements_i18n', 'entries.id = elements_i18n.elementId')&#xA;    -&amp;gt;where(&quot;c37.dateYmd &amp;gt;= $fromDateYmd&quot;)&#xA;    -&amp;gt;andWhere(&quot;c37.dateYmd &amp;lt;= $toDateYmd&quot;) &#xA;    //-&amp;gt;andWhere('STATUS = published, pending, etc')&#xA;    -&amp;gt;order('dateYmd ASC, timestr ASC')&#xA;    -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any advice!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-27T17:49:47.290" Title="db query to get fields related to entry" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;database&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9922" PostTypeId="1" CreationDate="2015-05-27T17:24:21.113" Score="1" ViewCount="164" Body="&lt;p&gt;I have a need to be able to upload a zip file into assets. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-05-27T18:10:06.253" Title="Is it possible to upload a zip file via Assets?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9923" PostTypeId="2" ParentId="9917" CreationDate="2015-05-27T17:43:59.033" Score="2" Body="&lt;p&gt;There's nothing native in Craft that would allow you do to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be possible via a Craft and Redactor custom plugin, though, I'd guess.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-27T17:43:59.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9924" PostTypeId="2" ParentId="9921" CreationDate="2015-05-27T17:49:47.290" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I wonder about efficiency.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You're right to worry.  Doing this from PHP (even if you break it up into multiple SQL queries to get the data you need) is going to be much faster and less resource intensive than doing it from Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I'd look at though, instead of querying data directly against the database, is to see if you can get what you need going through Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference#craft.app.services&quot; rel=&quot;nofollow&quot;&gt;services&lt;/a&gt; in &lt;code&gt;craft/app/services/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you don't have to worry about your plugin breaking in the event that the underlying database structure changes during an update.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-27T17:49:47.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9925" PostTypeId="2" ParentId="9920" CreationDate="2015-05-27T18:04:39.613" Score="1" Body="&lt;p&gt;You can use an &lt;a href=&quot;https://straightupcraft.com/craft-plugins/feed-me&quot; rel=&quot;nofollow&quot;&gt;existing&lt;/a&gt; &lt;a href=&quot;https://straightupcraft.com/craft-plugins/import&quot; rel=&quot;nofollow&quot;&gt;import&lt;/a&gt;/&lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow&quot;&gt;export&lt;/a&gt; plugin that supports handling users, or you can write your own plugin that calls Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersService-&gt;saveUser()&lt;/a&gt;, which takes care of saving the right data into the right tables in the database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-27T18:04:39.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9926" PostTypeId="2" ParentId="9922" CreationDate="2015-05-27T18:10:06.253" Score="3" Body="&lt;p&gt;Yes, you can upload zip files from the main Assets table in the control panel as well as from an Assets field type assuming 1) you haven't removed 'zip' from the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;allowedFileExtensions&lt;/a&gt; config setting and 2) you haven't restricted the allowed file types in the field's settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-27T18:10:06.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9927" PostTypeId="1" CreationDate="2015-05-27T18:11:53.053" Score="0" ViewCount="1105" Body="&lt;p&gt;I am trying to display entries based on the last segment in the url and then paginate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far but it's not displaying any entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getLastSegment() %}&#xA;  {% set category = craft.categories.slug(categorySlug).first() %}&#xA;&#xA;  {% if category %}&#xA;&#xA;      {% set entries = craft.entries.relatedTo(category).limit(12) %}&#xA;      &amp;lt;ul&amp;gt;&#xA;&#xA;      {% paginate entries as entries %}&#xA;&#xA;      {% for entry in entries %}&#xA;&#xA;      {% for block in entry.resource.type('resource') %}&#xA;&#xA;      &amp;lt;li class=&quot;summary m-all t-all d-all&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;      &amp;lt;article&amp;gt;&#xA;      &amp;lt;header class=&quot;article-header&quot;&amp;gt;&#xA;      &amp;lt;h1&amp;gt;{{ block.resourceTitle }}&amp;lt;/h1&amp;gt;&#xA;      &amp;lt;h5&amp;gt;{{ block.resourceAuthors }}&amp;lt;/h5&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ block.resourceSummary }}&#xA;      &amp;lt;span class=&quot;link&quot;&amp;gt;Read more&amp;lt;/span&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;/header&amp;gt;&#xA;      &amp;lt;/article&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;      &amp;lt;hr class=&quot;m-all t-all d-all&quot;&amp;gt;&#xA;&#xA;      {% endfor %}&#xA;&#xA;      {% endfor %}&#xA;&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;      {% if paginate.prevUrl %}&#xA;          &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {% if paginate.nextUrl %}&#xA;          &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;      {% endpaginate %}&#xA;&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even this simplified version outputs zero entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set categorySlug = craft.request.getLastSegment() %}&#xA;  {% set category = craft.categories.slug(categorySlug).first() %}&#xA;&#xA;  {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;  {# Output them #}&#xA;  {% for entry in entries %}&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="116" LastEditDate="2015-05-27T19:09:25.130" LastActivityDate="2015-05-27T23:27:22.873" Title="Display Category Entries Based on Slug" Tags="&lt;entries&gt;&lt;categories&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9928" PostTypeId="1" AcceptedAnswerId="9945" CreationDate="2015-05-27T18:17:16.200" Score="1" ViewCount="74" Body="&lt;p&gt;That question will almost certainly need to be rewritten, but at the moment I don't have the language to write it well (sorry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a restricted item (asset, in this case) that successfully triggers the login form and then redirects the viewer to the restricted item after login. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about if the viewer is not registered yet? We have a working registration form set up and auto-activation enabled. How can the referring restricted item be passed from the login form to the registration form and then have that restricted item shown immediately after registering?&lt;/p&gt;&#xA;" OwnerUserId="2285" LastEditorUserId="2285" LastEditDate="2015-05-27T18:24:37.137" LastActivityDate="2015-05-28T09:55:25.200" Title="How to do &quot;restricted page/asset&quot;-&gt;login-&gt;register-&gt;&quot;restricted page/asset&quot;?" Tags="&lt;redirect&gt;&lt;registration&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9929" PostTypeId="1" AcceptedAnswerId="9931" CreationDate="2015-05-27T20:01:56.710" Score="1" ViewCount="141" Body="&lt;p&gt;I usually use &lt;code&gt;{% block %}{% endblock %}&lt;/code&gt; to build my template but for the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/examples/extending-a-base-layout&quot; rel=&quot;nofollow&quot;&gt;SEO plugin&lt;/a&gt; I'll be needing &lt;code&gt;{% set %}{% endset %}&lt;/code&gt;. However my pages don't seem to render. If I change it to &lt;code&gt;{% block %}{% endblock %}&lt;/code&gt; it works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what is causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my base file _master.html (partly):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;boxed bg-cover&quot; style=&quot;background-image: url(img/backgrounds/street.jpg)&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;global-wrap&quot;&amp;gt;&#xA;     {% set header %}&#xA;     {% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is my index.html (partly):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_master&quot; %}&#xA; {% set header %}&#xA;   {% include 'header.html' %}&#xA; {% endset %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="440" LastEditorUserId="45" LastEditDate="2015-05-27T21:23:02.433" LastActivityDate="2015-05-27T21:23:02.433" Title="Problem using &quot;set&quot; with Sprout SEO" Tags="&lt;templating&gt;&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9930" PostTypeId="2" ParentId="9927" CreationDate="2015-05-27T20:07:12.257" Score="1" Body="&lt;p&gt;I'm rolling the same thing with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layouts/_entry_layout' %}&#xA;{# sets the name for the css file to be pulled #}&#xA;{% set pageType = 'search' %}&#xA;{% set catSlug = craft.request.getSegment(2) %}&#xA;{% set title = craft.categories.slug(catSlug).first() ~ ' Channel' %}&#xA;&#xA;{% block content %}&#xA;&#xA;&amp;lt;section class=&quot;search-results&quot;&amp;gt;&#xA;&#xA;{% paginate craft.entries.relatedTo(category) as entriesOnPage %}&#xA;&#xA;&#xA;&amp;lt;h1 class=&quot;category__title&quot;&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% for entry in entriesOnPage %}&#xA;        {% include 'modules/_article_listing' %}&#xA;    {% endfor %}&#xA;&#xA;{% include 'inc/_pagination' %}&#xA;&#xA;{% endpaginate %}&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my article listing module contains the usual things like {{ entry.title }} etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and pagination include is like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate %}&#xA;&#xA;{% set currentPage = paginate.currentPage %}&#xA;{% set startPage = currentPage - 2 %}&#xA;{% set endPage = currentPage + 2 %}&#xA;{% if query is defined %}&#xA;{% set queryString = &quot;?q=&quot; ~ query %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% if paginate.totalPages &amp;gt; 1 %}&#xA;&amp;lt;nav class=&quot;pagination&quot; role=&quot;navigation&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ol class=&quot;pagination__list&quot;&amp;gt;&#xA;&#xA;        {% if paginate.prevUrl %}&#xA;        &amp;lt;li class=&quot;pagination__item&quot;&amp;gt;&#xA;            &amp;lt;a class=&quot;btn  btn-2  btn-2a&quot; href=&quot;{{ paginate.prevUrl }}{% if queryString is defined %}{{ queryString }}{% endif %}&quot;&amp;gt;&#xA;                &amp;amp;larr;&#xA;                &amp;lt;span class=&quot;visuallyhidden&quot;&amp;gt;Previous Page&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;        {% for i in startPage..endPage %}&#xA;        {% if paginate.getPageUrl( i ) %}&#xA;        {% if i != currentPage %}&#xA;&#xA;        &amp;lt;li class=&quot;pagination__item&quot;&amp;gt;&#xA;            &amp;lt;a class=&quot;btn  btn-2  btn-2a&quot; href=&quot;{{ paginate.getPageUrl( i ) }}{% if queryString is defined %}{{ queryString }}{% endif %}&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;visuallyhidden&quot;&amp;gt;Page &amp;lt;/span&amp;gt;{{ i }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;        &amp;lt;li class=&quot;pagination__item btn  -current&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;visuallyhidden&quot;&amp;gt;Current Page &amp;lt;/span&amp;gt;{{ i }}&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&#xA;    &amp;lt;li class=&quot;pagination__item&quot;&amp;gt;&#xA;        &amp;lt;a class=&quot;btn  btn-2  btn-2a&quot; href=&quot;{{ paginate.nextUrl }}{% if queryString is defined %}{{ queryString }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;visuallyhidden&quot;&amp;gt;Next Page&amp;lt;/span&amp;gt;&#xA;            &amp;amp;rarr;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/ol&amp;gt;&#xA;&#xA;&#xA;&#xA;&amp;lt;/nav&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-05-27T20:07:12.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9931" PostTypeId="2" ParentId="9929" CreationDate="2015-05-27T20:24:32.427" Score="5" Body="&lt;p&gt;I think that's just the way they have set up the templates in the example, so what you're doing is just fine (using &lt;code&gt;{% block %}&lt;/code&gt;), if that's how your templates are set up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is by using &lt;code&gt;{% set %}&lt;/code&gt; you are just setting your content to a variable which would be &lt;code&gt;{{ echoed }}&lt;/code&gt; into the layout file that you extend. Whereas using &lt;code&gt;{% block %}&lt;/code&gt; you are telling twig what block of content should be inherited into the layout you are extending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The twig docs probably explain it better:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot;&gt;http://twig.sensiolabs.org/doc/tags/extends.html&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot;&gt;http://twig.sensiolabs.org/doc/tags/set.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the looks of it with the plugin in question, providing you add &lt;code&gt;{{ craft.sproutSeo.optimize() }}&lt;/code&gt; into your layout template you should be all good to go. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Example with &lt;code&gt;{% set %}&lt;/code&gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;  {{ content }}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set content %}&#xA; Some content&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Example with &lt;code&gt;{% block %}&lt;/code&gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;  {% block content %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% block content %}&#xA; Some content&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-27T20:24:32.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9932" PostTypeId="1" CreationDate="2015-05-27T22:01:04.460" Score="4" ViewCount="1535" Body="&lt;p&gt;Is there a way to get the session id from craft.session in a twig template without needing to create a new filter?&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2017-03-11T15:12:49.027" Title="Getting session Id in twig template" Tags="&lt;session&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9933" PostTypeId="2" ParentId="9932" CreationDate="2015-05-27T22:07:50.607" Score="1" Body="&lt;p&gt;I assume you're referring to the PHP session ID (wrapped by &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpSessionService&quot; rel=&quot;nofollow&quot;&gt;HttpSessionService&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, the answer is no - Craft doesn't expose that to the templates.  You'd have to write a plugin that did.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-27T22:07:50.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9934" PostTypeId="1" CreationDate="2015-05-27T22:24:27.377" Score="3" ViewCount="891" Body="&lt;p&gt;I'm building out my first Craft site and learning a whole lot so far. Coming from ExpressionEngine, this really seems like what EE should have been. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I'm trying to find a way divide up content from a table field into three even columns. For example, if I have content in 9 rows in a table, I would like to have 3 items per column. Is this possible with Twig?  Here is the HTML.  Thank you!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;medium-3 medium-offset-2 small-centered medium-uncentered columns&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;medium-3 medium-offset-2 small-centered medium-uncentered columns&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;medium-3 medium-offset-2 small-centered medium-uncentered columns&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;item&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3677" LastEditorUserId="344" LastEditDate="2015-05-28T08:52:06.383" LastActivityDate="2015-05-28T08:52:06.383" Title="Evenly dividing up table items in columns" Tags="&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9935" PostTypeId="1" AcceptedAnswerId="9940" CreationDate="2015-05-27T22:57:38.693" Score="0" ViewCount="1471" Body="&lt;p&gt;In a plugin, I've been advised to try to use craft built-in &lt;a href=&quot;http://buildwithcraft.com/classreference#craft.app.services&quot; rel=&quot;nofollow&quot;&gt;services&lt;/a&gt; instead of direct db queries. So can anyone help with this:  For an entry type that includes a categories field, how to get all the categories related to an entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I suppose this might work as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$category = craft()-&amp;gt;categories-&amp;gt;getCategoryById($categoryId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't find anything intelligible to me under the relations service. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: On a related note, I see &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; that in twig you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(10) %}&#xA;&amp;lt;article&amp;gt;&#xA;    &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;    {{ entry.summary }}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereby Craft/Twig does all the work to find and return the 'summary' field related to each entry. Is there any php statement like this next confused one, following which I could get the categories related to each event?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$events = craft()-&amp;gt;entries.section('events').start('&amp;lt;=$toDateYmd').end('OR', '&amp;gt;=$fromDateYmd', '').status('publish');&#xA;foreach ($events as $event)&#xA;   $categories = $event.category;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2015-05-28T05:21:55.670" LastActivityDate="2015-05-28T07:15:30.863" Title="Using Services to get all the Categories related to an Entry?" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;services&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9936" PostTypeId="2" ParentId="9927" CreationDate="2015-05-27T23:27:22.873" Score="0" Body="&lt;p&gt;My category field was inside a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These links helped with the twig logic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4830/is-it-possible-to-have-category-listing-page-of-entries-if-the-category-is-defin?rq=1&quot;&gt;Is it possible to have category listing page of entries if the category is defined within a matrix block inside said entries?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8463/find-entries-that-have-a-category-selected-from-a-category-field-within-a-matrix&quot;&gt;Find entries that have a category selected from a category field within a matrix block&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2015-05-27T23:27:22.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9937" PostTypeId="1" CreationDate="2015-05-27T23:28:20.157" Score="1" ViewCount="192" Body="&lt;p&gt;I have a large site running Yii (1.1.x), complete with many controllers for specific applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A big section of the site is &quot;static&quot; pages, which use Yii to render out using a site layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in migrating the &quot;static&quot; portions of the site into content management, but I need to keep my applications. Is there an easy way to create Craft plugins that will call my existing Yii controllers? Or is there some other way to port the functionality without rewriting everything?&lt;/p&gt;&#xA;" OwnerUserId="3701" LastActivityDate="2015-08-24T01:28:46.663" Title="Migrating a Yii site to Craft" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9938" PostTypeId="2" ParentId="9937" CreationDate="2015-05-28T02:27:54.133" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there an easy way to create Craft plugins that will call my existing Yii controllers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There might be a way, but I'm not sure how easy it'd be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it'd be a more guaranteed easy path if you were to take your existing Yii controllers and turn them into Craft plugin &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controllers&lt;/a&gt;, but I'm not sure of the extent and complexity of your existing application.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-06-27T05:08:43.607" LastActivityDate="2015-06-27T05:08:43.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9939" PostTypeId="2" ParentId="9934" CreationDate="2015-05-28T03:45:19.080" Score="7" Body="&lt;p&gt;It's actually quite simple! What you're looking for is &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/batch.html&quot; rel=&quot;noreferrer&quot;&gt;Twig's &lt;code&gt;batch&lt;/code&gt; filter...&lt;/a&gt; Ironically, the example given on that page is nearly identical to what you are requesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've adapted the example to more closely match what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myData = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}&#xA;&#xA;{% for column in myData|batch(3, 'No item') %}&#xA;    &amp;lt;div class=&quot;medium-3 medium-offset-2 small-centered medium-uncentered columns&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for item in column %}&#xA;                &amp;lt;li&amp;gt;{{ item }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-05-28T03:45:19.080" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9940" PostTypeId="2" ParentId="9935" CreationDate="2015-05-28T07:13:25.437" Score="3" Body="&lt;p&gt;If you have an EntryModel and know the category field's handle, you don't really need a service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categories = $entry-&amp;gt;categoryFieldHandle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other cases, you can construct an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; to search for related elements (categories, entries, users or assets), using a number of different variables. Easy example to get related categories from an entry ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;relatedTo = array($entryId);&#xA;$categories = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-05-28T07:13:25.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9941" PostTypeId="2" ParentId="9935" CreationDate="2015-05-28T07:15:30.863" Score="1" Body="&lt;p&gt;OK, here is what I worked out, through hours of trial and error. A hint came from the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This should be the starting point any time you want to fetch elements&#xA;  in Craft.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$criteria-&gt;section = 'news';&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$entries = $criteria-&gt;find();&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In my plugin's services file this produces the desired results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set up the criteria&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'events';&#xA;$criteria-&amp;gt;startDate = array(&quot;&amp;lt;=$toDateYmd&quot;, NULL);&#xA;$criteria-&amp;gt;endDate = array(&quot;&amp;gt;=$fromDateYmd&quot;, NULL);&#xA;&#xA;$entries = $criteria-&amp;gt;find();  //Do the query&#xA;&#xA;foreach ($entries as $entry) {&#xA;    $categories = $entry-&amp;gt;categories;&#xA;    echo &quot;&amp;lt;br&amp;gt;title: $entry-&amp;gt;title Start: $entry-&amp;gt;startDate&amp;lt;br&amp;gt;&amp;lt;pre&amp;gt;&quot;;&#xA;    echo &quot;Categories:&amp;lt;/br&amp;gt;&quot;;&#xA;    foreach ($categories as $k =&amp;gt; $v) echo &quot; [$k] =&amp;gt; $v&amp;lt;br&amp;gt;&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When adding the criterias, each array is basically doing an 'OR'.  So it's &#xA;&lt;em&gt;if startDate &amp;lt;= $toDateYmd OR startdate = NULL&lt;/em&gt;.  I just happen to need to accept NULL as a value here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has a better way of doing it, please let me know, but code-wise this seems quite concise.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-28T07:15:30.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9942" PostTypeId="1" AcceptedAnswerId="9944" CreationDate="2015-05-28T08:19:26.180" Score="2" ViewCount="2077" Body="&lt;p&gt;As some of you may have seen I've been asking on here and on Slack regarding the best way to go about creating a navigation on a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As yet, nothing I have tried is working and any code that I've been given to try also hasn't worked. &lt;em&gt;(Thanks to everyone who has given code so far though)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I have literally stripped down &lt;strong&gt;everything&lt;/strong&gt; in the hope that someone might be able to tell me where I'm going wrong as I'm sure that something as simple as this &lt;strong&gt;shouldn't&lt;/strong&gt; be as difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a completely fresh install of Craft 2 with the standard templates that come with Craft and I have then created a &lt;strong&gt;Structure&lt;/strong&gt; called &lt;em&gt;(creatively enough)&lt;/em&gt; &lt;strong&gt;Navigation&lt;/strong&gt; of which the hierarchy can be seen below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Home&#xA;Services&#xA;---- Service 1&#xA;---- Service 2&#xA;--------- Sub Service 1&#xA;---- Service 3&#xA;Galleries&#xA;---- Gallery 1&#xA;---- Gallery 2&#xA;............&#xA;&lt;/code&gt;&#xA;The above is actually just an example but reflects the sort of items that could go into the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any of the items above could also be either an entry, a single or a template that has a channel on it and so on and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First up I'm not sure if I actually need to place any information into the &lt;strong&gt;Entry URL Format&lt;/strong&gt; and &lt;strong&gt;Entry Template&lt;/strong&gt; settings for the section as I'm &lt;em&gt;guessing&lt;/em&gt; these aren't maybe all that important as the section is literally just being used for creating navigation on the site. That said I did fill them out with standard information just in case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next on the standard &lt;strong&gt;news/_entry.html&lt;/strong&gt; template I placed this code :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set pages = craft.entries.section('navigation') %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav page in pages %}&#xA;            &amp;lt;li&amp;gt;&#xA;                {{ page.getLink() }}&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows me to spit out the entire navigation which is good so far but in my Structure section I have an &lt;strong&gt;Entries&lt;/strong&gt; field which allows me to choose an entry. I first of all have no idea of how to spit out this as the link instead of the &lt;code&gt;{{ page.getLink() }}&lt;/code&gt; code above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;strong&gt;Entries&lt;/strong&gt; field is called &lt;strong&gt;singleEntrySelector&lt;/strong&gt; and I tried &lt;code&gt;{{ page.singleEntrySelector }}&lt;/code&gt; to see if it would spit anything out but that didn't work and I got an error on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering how do I go about spitting out the content of the &lt;strong&gt;singleEntrySelector&lt;/strong&gt; field so that my navigation items can point to the correct URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once that is working I'd like to have it so that when I'm on say &lt;strong&gt;Sub Service 1&lt;/strong&gt; that I can create a secondary navigation on the page which will show me everything from &lt;strong&gt;Services&lt;/strong&gt; down to &lt;em&gt;(in this example)&lt;/em&gt; &lt;strong&gt;Service 3&lt;/strong&gt; so pretty much a very standard secondary navigation output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should &lt;em&gt;(I'm hoping)&lt;/em&gt; allow me to do what I need here although I am definitely open to other ways of approaching this if I'm completely seeing things wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I'd also like to be able to in the end spit out the navigation using whatever HTML code I need to as I will be utilising this on a responsive site and so have no idea yet as to what code I will need to encapsulate it all in. Therefore if the &lt;code&gt;{% nav %}&lt;/code&gt; tag isn't the right fit here in that it won't allow me to do that then I'd really appreciate being shown how to spit it out in some other way that will allow me to do just that.&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-30T14:07:01.850" Title="Navigation, Structure, Usage, WOES!" Tags="&lt;structure&gt;&lt;navigation&gt;&lt;output&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9944" PostTypeId="2" ParentId="9942" CreationDate="2015-05-28T09:38:30.470" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;First up I'm not sure if I actually need to place any information into the Entry URL Format and Entry Template settings for the section&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope, you can probably just un-check the &lt;em&gt;Entries in this section have their own URLs&lt;/em&gt; checkbox in the Section settings and don't worry about it – I'm guessing the nav items should only function as pointers to &quot;actual&quot; entries, and won't need their own URLs or template.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[...] in my Structure section I have an Entries field which allows me to&#xA;  choose an entry. I first of all have no idea of how to spit out this&#xA;  as the link instead of the {{ page.getLink() }} code above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't use the &lt;code&gt;getLink()&lt;/code&gt; function when the URL you want is the URL for the entry in the Entries field, and not the actual URL for the nav item (phew). You'll have to build the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag yourself – something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('navigation') %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ page.singleEntrySelector.first().url|default }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The crucial part here is the &lt;code&gt;page.singleEntrySelector.first().url|default&lt;/code&gt; part for the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags's &lt;code&gt;href&lt;/code&gt; attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to realize that whenever you call an Entries attribute/field – such as &lt;code&gt;page. singleEntrySelector&lt;/code&gt; in this case – Craft returns an instance of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which essentially is an array-like object. That means that even if the Entries field only has 1 entry inside it, you can't call &lt;code&gt;page. singleEntrySelector.url&lt;/code&gt; directly – you'll need to explicitly select an entry inside the model, either by looping over it, calling a specific index (&lt;code&gt;page. singleEntrySelector[0].url&lt;/code&gt;) or use the &lt;code&gt;first()&lt;/code&gt; method to return the first entry. This is true for Asset, Tags, User and Category fields as well – basically any fieldtype that returns one or more related elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wondering about the &lt;code&gt;|default&lt;/code&gt; filter applied to the URL, that's there to prevent Craft from throwing an error if the &lt;code&gt;page&lt;/code&gt; doesn't actually have an entry selected in the &lt;code&gt;singleEntrySelector&lt;/code&gt; field. If you make the latter a required field, you can skip the &lt;code&gt;|default&lt;/code&gt; part.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[...] I'd like to have it so that when I'm on say Sub&#xA;  Service 1 that I can create a secondary navigation on the page which&#xA;  will show me everything from Services down to (in this example)&#xA;  Service 3 so pretty much a very standard secondary navigation output.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To output a sub navigation containing all nav &quot;descendants&quot; of the current entry, you'll first need to find the relevant nav item using the current entry in a relation query. Then, you can use the &lt;code&gt;descendantOf()&lt;/code&gt; method to build the &lt;code&gt;pages&lt;/code&gt; array, using the nav item as the ancestor: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navItem = craft.entries.section('navigation').relatedTo(entry).first() %}&#xA;{% if navItem %}&#xA;{% set pages = craft.entries.descendantOf(navItem) %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav page in pages %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ page.singleEntrySelector.first().url | default }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;            ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want the sub nav to display the &lt;em&gt;entire&lt;/em&gt; sub tree for the current entry – not just the &lt;em&gt;descendents&lt;/em&gt; – this is how that could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the related nav item for the current entry #}&#xA;{% set navItem = craft.entries.section('navigation').relatedTo(entry).first() %}&#xA;{% if navItem %}&#xA;    {# Get the top level item #}&#xA;    {% set topItem = navItem.getAncestors().level(1).first()|default(navItem) %}&#xA;    {# Build a &quot;pages&quot; array w/ the top item and its descendents (child entries) #}&#xA;{% set pages = craft.entries.id([topItem.id]|merge(topItem.getDescendants().ids()|default([]))) %}&#xA;&amp;lt;nav&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: If you use the same Entry for the Entries field multiple times in your Navigation Structure, results may vary. The examples above will pull the first nav item that has a relationship with the current entry, and disregard any others. However, a many-to-one relationship between the Navigation Structure's entries and the entries in the Entries field, with single sub tree output for the sub nav doesn't really compute – so I've disregarded that particular issue and assumed the relationship will always be one-to-one.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-05-30T14:07:01.850" LastActivityDate="2015-05-30T14:07:01.850" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="9945" PostTypeId="2" ParentId="9928" CreationDate="2015-05-28T09:55:25.200" Score="2" Body="&lt;p&gt;You should be able to get the return url from craft. I just did a quick test and it seemed to carry over to a registration page from a log in page that happened due to a restricted page, so maybe try something like this in your registration template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set redirectUrl = (craft.session.getReturnUrl() ?: '/') %}&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ redirectUrl }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way after they register they will be redirected to the restricted page, asked to log in and then craft should redirect them to the restricted page automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-28T09:55:25.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9947" PostTypeId="1" AcceptedAnswerId="9959" CreationDate="2015-05-28T14:43:19.620" Score="2" ViewCount="397" Body="&lt;p&gt;I have a channel section called Members. I have 2 category groups (categoriesMembres &amp;amp; cantons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal: show entries only related to a specific category in categoriesMembres and loop through the cantons:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canton1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Canton2&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 3&lt;/li&gt;&#xA;&lt;li&gt;entry 4&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Right now the code below display it like that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canton1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;li&gt;entry 3&lt;/li&gt;&#xA;&lt;li&gt;entry 4&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Canton2&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;li&gt;entry 3&lt;/li&gt;&#xA;&lt;li&gt;entry 4&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The code (I stripped out html for clarity)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set membersCat = craft.categories.group('categoriesMembres').title('Membre').first() %}&#xA;{% set entries = craft.entries.section('listeMembres').relatedTo(membersCat) %}&#xA;{% set cantonsCat = craft.categories.group('cantons').relatedTo(entries) %}&#xA;&#xA;{% for canton in cantonsCat %}&#xA;   {{ canton.title }}&#xA;   {% for row in entries|batch(3) %}&#xA;    {% for entry in row %}&#xA;     {{ entry.title }}&#xA;    {% endfor %}&#xA;    {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I overseeing or doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="785" LastEditDate="2015-05-29T07:56:19.907" LastActivityDate="2015-05-29T08:41:56.687" Title="Multiple categories filter" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9948" PostTypeId="1" AcceptedAnswerId="9949" CreationDate="2015-05-28T15:09:29.397" Score="0" ViewCount="761" Body="&lt;p&gt;My plugin has a tab in the CP. On that tab is a form. What's the way for PHP to generate a CSRF token that can be output to the form with echo?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT to document the final answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$token = craft()-&amp;gt;request-&amp;gt;getCsrfToken();&#xA;$out .= &amp;lt;&amp;lt;&amp;lt;MYFORM&#xA;   &amp;lt;form action=&quot;#&quot; method=&quot;post&quot;&amp;gt;&#xA;      &amp;lt;input type='hidden' name=&quot;CRAFT_CSRF_TOKEN&quot; value='$token'&amp;gt;&#xA;      ...&#xA;   &amp;lt;/form&amp;gt;&#xA;MYFORM;&#xA;return $out;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And make sure that /craft/config/general.php includes this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;       'enableCsrfProtection' =&amp;gt; true,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2015-05-28T20:18:25.023" LastActivityDate="2015-05-28T20:18:25.023" Title="In a plugin, what's the way in PHP to output a CSRF token?" Tags="&lt;plugin-development&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9949" PostTypeId="2" ParentId="9948" CreationDate="2015-05-28T15:15:40.450" Score="2" Body="&lt;p&gt;Maybe try &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getCsrfToken()&lt;/code&gt;, see if that does it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, misunderstood the question, since you are saying your plugin has a CP section then i'm assuming you're actually looking for a twig way to output the CSRF input, not so much a PHP way. To output the CRSF input in your template simply do &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-05-28T19:55:18.770" LastActivityDate="2015-05-28T19:55:18.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9950" PostTypeId="1" AcceptedAnswerId="9958" CreationDate="2015-05-28T17:33:26.373" Score="5" ViewCount="2566" Body="&lt;p&gt;I have a site which has two blog-like sections, which I'll call Blog and News. Each has a few categories. The categories are different in each section. An article always has (only) 1 category assigned to it. I want the URLs to be like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/blog/                            # index page&#xA;/blog/category-slug               # listing all articles in category&#xA;/blog/category-slug/article-slug  # an article&#xA;/news/&#xA;/news/category-slug&#xA;/news/category-slug/article-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm struggling with how to construct this nicely out of Craft's Fields, Sections, Channels, Entries... I imagine I may need some custom routing, but haven't even got that far. Should I have two separate Channels and two separate Category sets? One Channel with two Entry Types and two Category sets? One Category structure with 'blog' and 'news' at the top level? How do I generate URLs for an Entry that will include &lt;code&gt;/news/category-slug/...&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going round and round in circles. I've tried things from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1291/how-would-i-include-the-first-category-slug-in-the-sections-entry-url-format&quot;&gt;answers here&lt;/a&gt; but haven't yet managed to display an entry at any URLs I expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As an added wrinkle, I want the &lt;code&gt;/blog/&lt;/code&gt; and &lt;code&gt;/news/&lt;/code&gt; pages to appear to the user to be pages within a separate Structure... but I was going to worry about that once I've got the basic channel/category/entry stuff working!)&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-20T14:41:01.243" Title="Showing categories in Channel Entry URLs" Tags="&lt;categories&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9951" PostTypeId="1" AcceptedAnswerId="9952" CreationDate="2015-05-28T19:31:31.083" Score="0" ViewCount="32" Body="&lt;p&gt;So I've been having so much trouble finding adequate examples of how to do things when writing a plugin. How do you find more?  (see below for my own answer)&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-28T19:34:46.077" Title="How do you find more documentation about queries, services, plugins, etc?" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9952" PostTypeId="2" ParentId="9951" CreationDate="2015-05-28T19:34:46.077" Score="1" Body="&lt;p&gt;Click on the little triangle! It gives nice examples.  &lt;img src=&quot;https://i.stack.imgur.com/zO3WL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-05-28T19:34:46.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9955" PostTypeId="1" AcceptedAnswerId="9956" CreationDate="2015-05-29T00:06:40.903" Score="2" ViewCount="2827" Body="&lt;p&gt;I've got a website that has a resource center, news center and blog where each of those sections has a high quantity of assets that can be filtered by topic / type / date, etc. Additionally, due to the quantity of assets, we're using pagination to spread the assets across multiple pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the filtering and pagination creates a variety of worthless but currently crawlable URLs that we'd like to hide from the search engines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to deploy the meta name=&quot;robots&quot; content=&quot;noindex, follow&quot; tag to all of the paginated / filtered URLs while keeping the overview pages indexed. It seems that the most logical way to do that is based on a consistent URL string that appears in both pagination and filtering instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add a rule within my template that will insert the meta tag based on whether or not a string exists in the current URL appearing in a user's browser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="125" LastEditDate="2015-05-29T08:52:12.770" LastActivityDate="2015-05-29T08:52:12.770" Title="If URL Contains x Then Do Y in Twig / Craft Template?" Tags="&lt;templating&gt;&lt;pagination&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9956" PostTypeId="2" ParentId="9955" CreationDate="2015-05-29T00:53:35.043" Score="3" Body="&lt;p&gt;If the string you're looking for is part of the URI segment, then something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (craft.request.getSegment(3) == 'mySpecialKey') %}&#xA;    &amp;lt;meta name=&quot;robots&quot; content=&quot;noindex, follow&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Adjusting the 3 for whichever part of the segment it's actually in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if it's part of the querystring, then use &lt;code&gt;craft.request.getParam('mySpecialKey')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-29T00:53:35.043" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9957" PostTypeId="2" ParentId="9942" CreationDate="2015-05-29T01:49:49.713" Score="1" Body="&lt;p&gt;Lots of different ways to skin the snake here but depending on how big your site site is, why create a separate structure section to begin with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a recent build,  I created a &quot;Pages&quot; structure section and put most of the relevant content in there. For &quot;feeds&quot; of data, like a Gallery or News or Employees and what not, you definitely want to use separate Channel sections for those, though, and just pull in the relevant channel from your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming from WordPress, it always annoyed me having to do the 2-step of creating a page and then hooking it up to the navigation and I found my clients agreed. They like that approach of mirroring the site structure with how the navigation actually works on the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That allows them (or you) to rearrange content very easily if necessary.  In the Pages Structure, I also put a separate lightswitch that allows them to hide or show that page in the navigation depending on how they're using... for example, a landing page or something that they don't want to go &quot;live&quot; with just yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code from that site (put this in your &lt;code&gt;_layout.html&lt;/code&gt; file or whatever you're using as main site&quot;shell&quot;) if you want to use it sitewide:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              {% macro addClass(t) %}&#xA;                 {%if t.level == 1 and t.slug != &quot;news&quot; %}has-dropdown{%endif%}&#xA;                 {%if t.slug == &quot;login&quot; %} hide-for-large-up{%endif%}&#xA;              {% endmacro %}&#xA;&#xA;              {% set pages = craft.entries({&#xA;                             section: 'pages',entryType:'not landingPage'&#xA;                             }).showInNavigation('1').level('&amp;lt;=2') &#xA;              %}&#xA;&#xA;          &amp;lt;ul&amp;gt;&#xA;            {% nav page in pages %}&#xA;&#xA;                &amp;lt;li class=&quot;{{ _self.addClass(page)}}&quot;&amp;gt;&#xA;&#xA;                    {% switch page.type %}&#xA;&#xA;                    {%case &quot;linkToPage&quot; %}&#xA;                         &amp;lt;a href=&quot;{{page.pageLink}}&quot;&amp;gt;{{page.title}}&amp;lt;/a&amp;gt;&#xA;&#xA;                    {% default %}&#xA;                        {{ page.getLink() }}&#xA;                    {%endswitch%}&#xA;&#xA;&#xA;                    {% ifchildren %}&#xA;                        &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endifchildren %}&#xA;&#xA;                &amp;lt;/li&amp;gt;&#xA;&#xA;&#xA;            {% endnav %}&#xA;         &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an entry type called &lt;code&gt;linktoPage&lt;/code&gt; which has a &lt;code&gt;pageLink&lt;/code&gt; field on there (so the client can put in links to outside Craft install, for example their portal). There's some Foundation 5 presentation stuff in there (addClass) to get the top nav working. I hate sub navigation on drop down menus so I'm only telling Craft to spit out the first 2 levels there but to get multiple nested child levels like in your example just remove &lt;code&gt;.level('&amp;lt;=2')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, YMMV, especially on what content you have.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-05-29T01:49:49.713" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9958" PostTypeId="2" ParentId="9950" CreationDate="2015-05-29T03:30:00.727" Score="11" Body="&lt;p&gt;There's a lot here but I'd start by create 2 different channel &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;noreferrer&quot;&gt;sections&lt;/a&gt;: Blog and News. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the front end, that makes it easy to see which entries are associated with what sections and easy to post content into each one. It also makes it easy to filter in your templates what section you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get your entry URLs setup, it's a little tricker but you can pull it off with some Craft/Twig magic. Setup a new field, make the handle &lt;code&gt;blogCategory&lt;/code&gt;, make it a Category relational field, lock it down to 1 category that pulls from your Blog Category Group, and assign it as a field to your Blog section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U2vPA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're creating the channel, set the URL format in your Channel to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;blog/{blogCategory.first().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QYRUs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That little bit of code basically tells Craft to use the category slug of the &lt;code&gt;blogCategory&lt;/code&gt;custom field we just created in part of the url and the slug of the current entry to make the url. Craft treats categories, assets, entries, etc. and other relational fields as an &quot;array&quot; even if you only have one selected so we need to use &lt;code&gt;.first()&lt;/code&gt; to use the first one Craft sees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when you go create your blog entry, you're able to set a blog category and Craft will also use it as part of the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW: There's no problem routing the Blog/News index pages to a page in a structure but you have to do the heavy lifting that Craft usually automatically routes for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your _layout.html template, you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%if craft.request.firstSegment() is &quot;news&quot; %}&#xA;    {#load up news template #}&#xA;    {% include '_news/index.html' %}&#xA;{%elseif craft.request.firstSegment() is &quot;blog&quot; %}&#xA;    {#load up news template #}&#xA;    {% include '_blog/index.html' %}&#xA;{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's more to it than that, of course but hopefully that might get you started. It takes a little while to get your head around Twig and how powerful it is to use in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to also setup URLs for your &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;noreferrer&quot;&gt;Categories&lt;/a&gt; to have Craft load the appropriate template for each. Understanding the basics of how Craft &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;noreferrer&quot;&gt;routes&lt;/a&gt; requests is helpful as well. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-05-29T14:55:22.727" LastActivityDate="2015-05-29T14:55:22.727" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9959" PostTypeId="2" ParentId="9947" CreationDate="2015-05-29T08:41:56.687" Score="2" Body="&lt;p&gt;You missed to filter for entries related to your &quot;Canton&quot; category only within your cantons loop.&#xA;Add another ElementCriteriaModel and get entries related to both &lt;code&gt;membersCat&lt;/code&gt; and &lt;code&gt;canton&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for canton in cantonsCat %}&#xA;    {% set entriesInCanton = craft.entries.section('listeMembres').relatedTo('and', membersCat, canton) %}    &#xA;    {% for row in entriesInCanton|batch(3) %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach (only works if there's one &quot;Canton&quot; max per entry!) would be to make use of Craft's &lt;code&gt;group&lt;/code&gt; filter. This is probably the better way to solve your problem, because it doesn't add extra DB queries for each &quot;Canton&quot; iterated over in your loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set membersCat = craft.categories.group('categoriesMembres').title('Membre').first() %}&#xA;{% set cantonsCats = craft.categories.group('cantons') %}&#xA;{% set cantonsCatsInUse = craft.categories.group('cantons').relatedTo(entries) %}&#xA;&#xA;{% set entries = craft.entries.section('listeMembres').relatedTo('and', membersCat, cantonsCats) %}&#xA;{% set entriesByCanton = entries|group('myCantonCategoryField.first()') %}&#xA;&#xA;{% for canton, entriesInCanton in entriesByCanton %}&#xA;    {% for row in entriesInCanton|batch(3) %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This probably won't output the cantons in the sort order you whish, but this fortunatelly can be solved easily.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByCanton = entriesByCanton|supersort('ksort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-29T08:41:56.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9960" PostTypeId="1" CreationDate="2015-05-29T09:15:06.037" Score="2" ViewCount="844" Body="&lt;p&gt;I can't get rid of that pesky index.php?p= from my urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/index.php?p=about/people&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/index.php?p=about/people&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I manually remove index.php?p= e.g. &lt;a href=&quot;http://mysite.com/about/people&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/about/people&lt;/a&gt; it works, but then goes back to adding the index.php?p= as soon as I navigate away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding 'usePathInfo' =&gt; true, and 'omitScriptNameInUrls' =&gt; true, to general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PathInfo works, &lt;a href=&quot;http://mysite.com/index.php/testPathInfo&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/index.php/testPathInfo&lt;/a&gt; = 'success'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I add garbage to htaccess I get server error, so htaccess works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have another site with a very similar build on the same server that's working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I can look at?&lt;/p&gt;&#xA;" OwnerUserId="852" LastActivityDate="2016-09-15T17:10:57.070" Title="Another index.php?p= problem" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9961" PostTypeId="1" AcceptedAnswerId="9993" CreationDate="2015-05-29T09:22:47.970" Score="0" ViewCount="850" Body="&lt;p&gt;I'm getting a couldnt save entry error, but all the fields are filled and there are no additional errors or input highlighting. Has anyone has this problem? Tried clearing the cache and checking the logs but nothing, I was able to fill it in fine before but no longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a screen shot of the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KKOuP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3705" LastEditorUserId="125" LastEditDate="2015-05-29T14:58:35.747" LastActivityDate="2015-06-01T18:35:49.260" Title="I'm getting a 'couldnt save entry' error for a single but all required fields etc are filled" Tags="&lt;error&gt;&lt;saving&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9962" PostTypeId="1" AcceptedAnswerId="9976" CreationDate="2015-05-29T09:26:13.200" Score="1" ViewCount="40" Body="&lt;p&gt;I am trying to debug a &quot;clean template cache&quot; task that gets stuck. However, it only happens intermittently, and whenever I notice any errors has already been rotated out of the log files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set the &lt;code&gt;maxLogFiles&lt;/code&gt; of the &lt;code&gt;FileLogRoute&lt;/code&gt;?  either through the config files, or through php code in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Setting &lt;code&gt;$rotateByCopy&lt;/code&gt; to true would also be nice!)&lt;/p&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-05-29T17:37:12.267" Title="Is it possible to configure the FileLogRoute?" Tags="&lt;config&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9963" PostTypeId="1" AcceptedAnswerId="9965" CreationDate="2015-05-29T10:20:01.883" Score="2" ViewCount="270" Body="&lt;p&gt;I am in the process of migrating a website from Wordpress to Craft and need to redirect the blog entries. In the existing site, the entries are in the root of the site, eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;example.com/this-is-a-blog-post&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the Craft site, the post will be under a &lt;code&gt;/blog&lt;/code&gt; subdirectory like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;example.com/blog/this-is-a-blog-post&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming the slugs are the same, how would I go about creating 301 redirects for all existing posts?&lt;/p&gt;&#xA;" OwnerUserId="770" LastActivityDate="2015-05-29T10:36:46.863" Title="How to redirect requests from root to subfolder (if they exist)?" Tags="&lt;entries&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9964" PostTypeId="2" ParentId="9961" CreationDate="2015-05-29T10:20:28.620" Score="0" Body="&lt;p&gt;Not sure if &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;Dev Mode&lt;/a&gt; is just for front end problem solving but if not then might be worth a shot trying to enable that and see if it comes up with anything more descriptive then. &lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-29T10:20:28.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9965" PostTypeId="2" ParentId="9963" CreationDate="2015-05-29T10:36:46.863" Score="3" Body="&lt;p&gt;There's a plugin to set up custom routes: &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow&quot;&gt;Reroute&lt;/a&gt; by Trevor Davis, but this would require you to set them all up manually. If there's lots and lots of blog entries, you would probably want to avoid this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said your slugs do match, you could just set up an ElementCriteriaModel with the &lt;code&gt;slug&lt;/code&gt; parameter set to the relevant URI segment and see if there's an entry for that; and if that's the case redirect to that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would do this with this simple PHP code form a custom plugin. &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;nofollow&quot;&gt;Set up a plugin&lt;/a&gt; and place the snippet in the &lt;code&gt;init()&lt;/code&gt; method of your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;nofollow&quot;&gt;primary plugin class&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;{&#xA;    $inRoot = ((craft()-&amp;gt;request-&amp;gt;getSegment(2) === null) &amp;amp;&amp;amp; (craft()-&amp;gt;request-&amp;gt;getSegment(1) !== null));&#xA;&#xA;    if ($inRoot)&#xA;    {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;section = 'blog';&#xA;        $criteria-&amp;gt;slug = craft()-&amp;gt;request-&amp;gt;getSegment(1);&#xA;        $entry = $criteria-&amp;gt;first();&#xA;&#xA;        if ($entry)&#xA;        {&#xA;            craft()-&amp;gt;request-&amp;gt;redirect($entry-&amp;gt;url, true, 301);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-29T10:36:46.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9966" PostTypeId="1" CreationDate="2015-05-29T11:30:34.180" Score="1" ViewCount="1972" Body="&lt;p&gt;In the general config settings, one can set a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#logoutPath&quot; rel=&quot;nofollow&quot;&gt;logoutPath&lt;/a&gt;, and one can use it using the &lt;code&gt;logoutUrl&lt;/code&gt; Global. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it says also in the docs: Note that Craft will automatically redirect users to your homepage after going here; there’s no such thing as a “logout page”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short; is there any other way to log a user out, besides &quot;triggering&quot; a visit to the predefined &lt;code&gt;logoutPath&lt;/code&gt;, which logs users out, but immediately redirects them to the homepage; as it would be more elegant and userfriendly to show some kind of &quot;you've been logged out&quot; message instead first.&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2020-07-03T14:26:53.633" Title="Logging out users - logoutPath &amp; logoutUrl" Tags="&lt;login&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9967" PostTypeId="2" ParentId="9614" CreationDate="2015-05-29T11:50:12.103" Score="3" Body="&lt;p&gt;@crawf was right with his answer, but I recently saw the preview release for Craft 3, so Placid 2 is going to wait and be written for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought I should fix the current version of Placid to work with the latest version of OAuth (currently &lt;code&gt;0.9.71&lt;/code&gt;) and as a brucie bonus you can now connect to more than just the twitter api :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/alecritson/Placid&quot; rel=&quot;nofollow&quot;&gt;You can get the latest version (&lt;code&gt;1.3.0&lt;/code&gt;) on github&lt;/a&gt; and any issues just give us a shout on the repo (or here, whichever you feel most relevant)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-29T11:50:12.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9968" PostTypeId="1" AcceptedAnswerId="9969" CreationDate="2015-05-29T12:14:31.523" Score="0" ViewCount="55" Body="&lt;p&gt;Im looking up the last 2 entries like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('report').limit(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My entry got an assets field called 'portfolio'. I would like to retrieve 8 images in random order. How would I do this?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="344" LastEditDate="2015-05-29T12:31:49.547" LastActivityDate="2015-05-29T12:31:49.547" Title="retrieve assets from an entries" Tags="&lt;templating&gt;&lt;entries&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9969" PostTypeId="2" ParentId="9968" CreationDate="2015-05-29T12:19:31.637" Score="2" Body="&lt;p&gt;You could try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;  {% for image in entry.portfolio.orderBy('RAND()').limit(8)&#xA;    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-29T12:19:31.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9970" PostTypeId="1" AcceptedAnswerId="9971" CreationDate="2015-05-29T14:23:43.973" Score="0" ViewCount="100" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/5067/how-to-use-plugin-settings&quot;&gt;This answer&lt;/a&gt; has given me most of what I need, but I'd like to hide certain settings based on the status of other settings. CP seems to have nice functionality built in for conditionally hiding/showing parameters. For example, when changing a field from Rich Text to Plain Text, several options disappear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, only if the preceding checkbox is checked do I want it to give an input field for the category field handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my /craft/plugins/calendar37/templates/_settings.html file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.checkBox({&#xA;        label: &quot;Event Hyperlinking&quot;|t,&#xA;        id: 'eventClickDestination',&#xA;        name: 'eventClickDestination',&#xA;        instructions: &quot;If checked, clicking on an event goes to Category page. Otherwise, unchecked it will go an Entry page&quot;|t,&#xA;        value: settings.eventClickDestination,&#xA;        errors: settings.getErrors('eventClickDestination')&#xA;    })&#xA;}}&#xA;&#xA;{{ forms.textField({&#xA;        label: &quot;Category Field's Handle&quot;|t,&#xA;        id: 'categoryFieldHandle',&#xA;        name: 'categoryFieldHandle',&#xA;        instructions: &quot;&quot;|t,&#xA;        value: settings.categoryFieldHandle,&#xA;        errors: settings.getErrors('categoryFieldHandle')&#xA;    }) &#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note, I'd like to work out similar functionality with a 3-part radio button, but haven't figured out how to do radio buttons yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-05-29T14:44:56.447" Title="How to conditionally hide particular plugin settings?" Tags="&lt;plugin-development&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9971" PostTypeId="2" ParentId="9970" CreationDate="2015-05-29T14:44:56.447" Score="2" Body="&lt;p&gt;I'm not sure how to do a 3 way toggle with radio boxes, it might involve writing your own JS... but for the checkbox toggle it's pretty straight forward :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.checkboxField({&#xA;    ...&#xA;    toggle : 'toggleThis'&#xA;}) }}&#xA;&#xA;&amp;lt;div id=&quot;toggleThis&quot; {% if settings.eventClickDestination is not defined or not settings.eventClickDestination %} class=&quot;hidden&quot;{% endif %}&amp;gt;&#xA;  //.. Form input goes in here&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft will then take care of the toggling for you when the box is checked/unchecked&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-05-29T14:44:56.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9972" PostTypeId="1" AcceptedAnswerId="9973" CreationDate="2015-05-29T15:12:42.833" Score="1" ViewCount="200" Body="&lt;p&gt;A project I'm working on needs to show a daily reading depending on the date you access the page. I plan to create entries for each day of the year, and each year it will show the post for that day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I'll create an entry with a post date of May 1, 2015. That entry should show on May 1, 2016/2017/2018, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried only putting in MM-DD in the postDate parameter, but no luck; that throws a PHP error. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2015-05-29T15:39:00.340" Title="Show entry on certain date, regardless of year" Tags="&lt;entries&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9973" PostTypeId="2" ParentId="9972" CreationDate="2015-05-29T15:39:00.340" Score="1" Body="&lt;p&gt;I fear this is not possible with a simple &lt;code&gt;postDate&lt;/code&gt; parameter and you have to find a workaround.&#xA;The Twig apporach would be to loop all events and filter the right ones with a simple conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').limit(null).order('postDate asc') %}&#xA;{% for event in events %}&#xA;    {% if event.postDate|date('m-d') == now|date('m-d') %}&#xA;        ...&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you'd like to paginate the results, collect / merge entry IDs within the for loop first and&#xA;then prepare another ElementCriteriaModel with these IDs in its &lt;code&gt;id&lt;/code&gt; param, to get the entries.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-05-29T15:39:00.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9974" PostTypeId="1" AcceptedAnswerId="9981" CreationDate="2015-05-29T15:43:00.400" Score="2" ViewCount="285" Body="&lt;p&gt;I have some categories, and with the use of a category field a user can select these from within his / her profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is shown in the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jHWe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my Twig template I can get the user selections out using the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set property_prefs = craft.categories({&#xA;    relatedTo: { sourceElement: currentUser, field: &quot;propertyPreference&quot; },&#xA;    limit:     null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what I want to know is how can I programmatically save a user selection using the API from within my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, which table are these stored in?&lt;/p&gt;&#xA;" OwnerUserId="2182" LastEditorUserId="45" LastEditDate="2015-05-29T17:59:08.053" LastActivityDate="2015-05-31T09:13:52.647" Title="Save a selected category for a user (using a plugin)" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;users&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9975" PostTypeId="1" AcceptedAnswerId="9979" CreationDate="2015-05-29T16:20:52.073" Score="0" ViewCount="89" Body="&lt;p&gt;Let's start with this I have Jobs, which would be added from the front end and backend as well, thouse jobs have to have Clients and Workers attached to them, which are basically users with differnt fields, the workers they have to have ability to login in the system, the clients maybe too in the future, that's why I would like to ask which will be the best way to accomplish this? I did some basic plugins in craft, but this one is more complicated and I woud like to ask for the best way of doing it. I was thinking if it's possible to use UserElementType to accomplish this.  I'm very new in craft so some plugin or some code snipped would be veryhelpful for me thanks in advanced!&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-05-29T18:53:11.107" Title="Create Plugin, Elementtype suggestion" Tags="&lt;elementtype&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9976" PostTypeId="2" ParentId="9962" CreationDate="2015-05-29T17:37:12.267" Score="1" Body="&lt;p&gt;Currently not without hacking the core files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our list to make log routing more configurable for Craft 3, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-29T17:37:12.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9977" PostTypeId="2" ParentId="9966" CreationDate="2015-05-29T17:41:02.263" Score="2" Body="&lt;p&gt;Might be going overboard, but you could have a plugin with it's own controller that provided different logout behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it sounds like to me what you're looking for is something like a 'logoutRedirect' config setting.  Probably worth adding to the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feedback site&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-05-29T17:41:02.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9978" PostTypeId="1" CreationDate="2015-05-29T18:45:27.150" Score="1" ViewCount="430" Body="&lt;p&gt;On my homepage I have one entry that is constantly there. Below that entry I want to display 2 different types of entries in an alternate order (gallery, update, gallery, update...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I have it so that I'm getting all the sections, setting it to a variable and looping through doing a entry.type check so it renders according to it's type. What would happen now is that it would display everything according to the posts' time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts? Ideas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# story #}&#xA; {% for entry in craft.entries.section('stories').limit(1) %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;large-6 large-centered columns test&quot;&amp;gt;&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.body.getPage(1) }}&#xA;        &amp;lt;img src=&quot;{{ entry.mainFeaturedImage.first().url }}&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{# end of story #}&#xA;&#xA;{% set entry3 = craft.sections.getAllSections() %}  &#xA;&amp;lt;div id=&quot;next-entries&quot;&amp;gt;&#xA;{% paginate craft.entries(entry3).limit(2) as entries %}&#xA;{% for entry in entries %}&#xA;{% if entry.type == 'carousels' %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;large-12 large-centered columns&quot;&amp;gt;&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;                    {# {{ entry.body.getPage(1) }} #}&#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;fade&quot;&amp;gt;&#xA;                    {% for block in entry.gallery.limit(3).find() %}&#xA;                    {% set asset = block.galleryImage.first() %}&#xA;                    {# {% set asset2 = block.galleryImage.nth(2) %} #}&#xA;                        &amp;lt;img class=&quot;large-4 columns carousel-image&quot; src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;&#xA;                    {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% elseif entry.type == 'updates' %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;large-6 large-centered columns&quot;&amp;gt;&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;                    {{ entry.body.getPage(1) }}&#xA;                    &amp;lt;img src=&quot;{{ entry.mainFeaturedImage.first().url }}&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;{% endpaginate %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3708" LastEditorUserId="3716" LastEditDate="2015-06-03T01:17:09.790" LastActivityDate="2015-06-04T07:19:13.537" Title="How to render entries on a singles page in a specific pattern/order?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;array&gt;&lt;singles&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9979" PostTypeId="2" ParentId="9975" CreationDate="2015-05-29T18:53:11.107" Score="3" Body="&lt;p&gt;You likely won't need to write a plugin at all – you can easily create different user groups (e.g. &quot;Workers&quot; and &quot;Clients&quot;) from the Control Panel, and grant those groups different &lt;em&gt;permissions&lt;/em&gt;. An example of a permission is &quot;Access the CP&quot;. The user group permissions will be automatically applied to any new users added to the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create a user group, visit &lt;em&gt;Settings -&gt; Users&lt;/em&gt; in the CP. The edit form for a user group will have a plethora of checkboxes for every possible permission. Note that when checked, many of these checkboxes will actually reveal even more checkboxes, for even more fine grained control over permissions.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-05-29T18:53:11.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9980" PostTypeId="1" CreationDate="2015-05-29T20:28:11.330" Score="1" ViewCount="527" Body="&lt;p&gt;I have a category group called &quot;Resource Categories&quot; and categories within it have their own urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category Url Formats:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;top-level categories: resources/{slug}&#xA;nested categories: {parent.uri}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category Template:&#xA;resources/_category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sbF8y.png&quot; alt=&quot;Category Setup&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a category template which is here:&#xA;resources/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is add a Landing page at /resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be a standard entry page ideally created within my Pages channel using the pages/_entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failing that I could also create an index page inside the resources folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I keep getting 403 forbidden when visiting site.com/resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried creating a route but that doesn't help the issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'resources' =&amp;gt; 'pages/_entry'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastActivityDate="2015-06-01T22:02:12.177" Title="Landing Page with Same URL Structure as Category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9981" PostTypeId="2" ParentId="9974" CreationDate="2015-05-31T09:13:52.647" Score="1" Body="&lt;p&gt;I had to do something similar to this in a plugin recently, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9713/inserting-relationship-into-entries-field-with-plugin-not-saving-relation&quot;&gt;Inserting Relationship Into Entries Field - Plugin Not Saving Relation&lt;/a&gt;, I know it's users to an entry field but I would assume the methods are similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you will need 3 things in order to save a users categories&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. The &lt;code&gt;Craft\FieldModel&lt;/code&gt; of the field which has the associations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$field = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('propertyPreference');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. The source, in this case the matrix block that has the field&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$source = craft()-&amp;gt;matrix-&amp;gt;getBlockById(&amp;lt;someId&amp;gt;);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. An array of element id's you wish to relate to the field&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$relations = $user-&amp;gt;propertyPreference-&amp;gt;ids();&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have those you can edit the &lt;code&gt;$relations&lt;/code&gt; array however you see fit and then simply save the relations back&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;relations-&amp;gt;saveRelations($field , $source, $relations);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/RelationsService#saveRelations-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;You can find out more about the save relations function in the class reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for which table, I would assume they are in &lt;code&gt;craft_relations&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-05-31T09:13:52.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9982" PostTypeId="1" CreationDate="2015-06-01T02:39:42.340" Score="0" ViewCount="667" Body="&lt;p&gt;I'm working on a basic portfolio site wherein each entry or &quot;project&quot; has a body Matrix field with various blocks for various types of images. I'd like to make an index of all projects showing one slideshow/carousel for each project containing all images within that project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I don't know how to query all images at once = All images, all blocks, in the order they appear in the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my specific code in use. It's almost there but due to the &lt;code&gt;0&lt;/code&gt; in &lt;code&gt;image[0]&lt;/code&gt; it's only pulling in the first image from each instance of each Matrix Block. For example, there are two instances of the block called &lt;code&gt;imageHalf&lt;/code&gt; and it pulls the first image from each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how to avoid this integer....&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.body %}&#xA;&#xA;{% switch block.type %}&#xA;&#xA;{% case &quot;imageFull&quot; %}&#xA;&#xA;{% set image = block.image.total() %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img data-lazy=&quot;&#xA;        {{ block.image[0].getUrl() }}&#xA;    &quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;{% case &quot;imageHalf&quot; %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img data-lazy=&quot;&#xA;        {{ block.image[0].getUrl() }}&#xA;    &quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;{% case &quot;imageCouple&quot; %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img data-lazy=&quot;&#xA;        {{ block.image[0].getUrl() }}&#xA;    &quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3710" LastEditorUserId="1098" LastEditDate="2015-06-01T06:24:23.637" LastActivityDate="2015-06-01T06:24:23.637" Title="How to pull all images in [body] Matrix fields" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9983" PostTypeId="2" ParentId="9982" CreationDate="2015-06-01T02:59:02.390" Score="1" Body="&lt;p&gt;I think you need to use a &lt;code&gt;{% switch %}&lt;/code&gt; statement like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch matrixBlock.type %}&#xA;&#xA;{% case &quot;text&quot; %}&#xA;&#xA;    {{ matrixBlock.textField | markdown }}&#xA;&#xA;{% case &quot;image&quot; %}&#xA;&#xA;    {{ matrixBlock.image[0].getImg() }}&#xA;&#xA;{% default %}&#xA;&#xA;    &amp;lt;p&amp;gt;A font walks into a bar.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;The bartender says, “Hey, we don’t serve your type in here!”&amp;lt;/p&amp;gt;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/switch&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2015-06-01T02:59:02.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9984" PostTypeId="2" ParentId="9982" CreationDate="2015-06-01T05:53:18.790" Score="1" Body="&lt;p&gt;An Assets field always returns an instance of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; – essentially an array-like object – even if there's only 1 (or even 0) files in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why things like &lt;code&gt;matrixBlock.image[0]&lt;/code&gt; – or &lt;code&gt;matrixBlock.image.first()&lt;/code&gt; – is needed to pull an actual asset, that you can call &lt;code&gt;getUrl()&lt;/code&gt; and other related methods on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;To output all images in an Assets field, you need to&lt;/em&gt; loop &lt;em&gt;over the field:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.image %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;img data-lazy=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To put it all together, in this case it probably makes sense to &lt;strong&gt;filter&lt;/strong&gt; the Matrix field using the &lt;code&gt;type&lt;/code&gt; method, in order to only loop over the image blocks. This is especially useful if your Matrix block also contains other, non-image blocks – this way, you don't need the &lt;code&gt;switch&lt;/code&gt; statement, and can get away with a minimal amount of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageBlocks = entry.body.type('imageFull, imageHalf, imageCouple') %}&#xA;{% if imageBlocks | length %}&#xA;    {% for block in imageBlocks %}&#xA;        {% for image in block.image %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img data-lazy=&quot;{{ image.getUrl() }}&quot; class=&quot;{{ block.type }}&quot; /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-01T05:53:18.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9985" PostTypeId="2" ParentId="9960" CreationDate="2015-06-01T10:19:41.013" Score="1" Body="&lt;p&gt;Have you seen this on the Craft site: &lt;a href=&quot;http://buildwithcraft.com/help/why-index.php&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/why-index.php&lt;/a&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="549" LastActivityDate="2015-06-01T10:19:41.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9986" PostTypeId="1" AcceptedAnswerId="9992" CreationDate="2015-06-01T11:25:22.443" Score="2" ViewCount="218" Body="&lt;p&gt;So what I'd like is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If URI would look like {username}, load _thisTemplate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couldn't find the way without solid point like author ID.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-12-07T08:03:51.297" Title="Is it possible to route to www.site.com/username?" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9987" PostTypeId="1" AcceptedAnswerId="9988" CreationDate="2015-06-01T14:59:53.870" Score="1" ViewCount="73" Body="&lt;p&gt;When saving a whole bunch of users through a plugin I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1835217 bytes) in /home/butpanel/public_html/cmgg/craft/app/etc/logging/FileLogRoute.php on line 59&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The users are saved none the less.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-06-01T15:53:27.430" Title="FileLogRoute.php maximum size error" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9988" PostTypeId="2" ParentId="9987" CreationDate="2015-06-01T15:53:27.430" Score="0" Body="&lt;p&gt;Looks like your php.ini file's &lt;a href=&quot;https://php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; is set to 64M.  Bump it up to something higher like 128M or 256M.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-01T15:53:27.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9989" PostTypeId="1" AcceptedAnswerId="9990" CreationDate="2015-06-01T16:17:44.430" Score="7" ViewCount="3059" Body="&lt;p&gt;My plugin init function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init(){&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;onSaveEntry = function(Event $event) {&#xA;&#xA;        //redirect to wanted url&#xA;&#xA;    };&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a fancy way to redirect to my plugin url if, for example the entry channel is jobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or I have to use header() function. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2019-09-18T20:30:28.677" Title="How to redirect from plugin?" Tags="&lt;plugin-development&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9990" PostTypeId="2" ParentId="9989" CreationDate="2015-06-01T16:39:37.997" Score="14" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService&quot;&gt;HttpRequestService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;redirect($myAwesomeUrl);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-01T16:39:37.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9991" PostTypeId="1" CreationDate="2015-06-01T17:33:29.403" Score="1" ViewCount="93" Body="&lt;p&gt;I had a section called vision which i renamed to articles. I did so by going in to sections and clicking the section and then changing..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Handle, Entry URL Format and Entry Template. I also copied and renamed all the template files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i can load up the main page as server/articles. But none of the entry pages will load and I get a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i look at the entries they are still there and now say the uri is: articles/article-name and the data is all there..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did i miss something that needs to happen to rename a section?&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-06-01T19:18:31.123" Title="Problem after renaming section" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9992" PostTypeId="2" ParentId="9986" CreationDate="2015-06-01T17:55:00.217" Score="10" Body="&lt;p&gt;I would not particularly advise creating a uri pattern that was just 'www.site.com/username' because usernames can essentially be anything which might cause routing conflicts (i.e. if the username is 'index' for example). You could however use something like 'www.site.com/members/username' or 'www.site.com/u/username'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do this would be to add a route using a 'subpattern'. For more info check out the routing docs on &lt;a href=&quot;http://buildwithcraft.com/docs/routing#accessing-subpatterns-in-your-templates&quot;&gt;accessing subpatterns in your templates&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example given in the docs, which provides the variables 'year' and 'month' to the template that correspond to the matched uri segments (i.e.  `news/2015/02'):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})' =&amp;gt; 'news/_archive',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could essentially do the same thing but with a 'username' variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'u/(?P&amp;lt;username&amp;gt;[^\/]+)' =&amp;gt; '_thisTemplate',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use the 'username' variable in your template to retrieve the corresponding user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.username(username).first() %}&#xA;{% if user %}&#xA;    {{ user.firstName }}&#xA;    ...&#xA;{% else %}&#xA;    {% redirect 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-06-01T21:34:52.187" LastActivityDate="2015-06-01T21:34:52.187" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9993" PostTypeId="2" ParentId="9961" CreationDate="2015-06-01T18:35:49.260" Score="1" Body="&lt;p&gt;Under your single's section settings, you had an invalid URI format for the &lt;code&gt;cy_gb (Welsh)&lt;/code&gt; locale: &lt;code&gt;ein heiddo&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URI's can't have spaces in them.  It'd be nice if Craft could warn you that the URI format is invalid (no spaces, all URL safe characters, etc), but it's difficult because Twig code is allowed in those fields and all sorts of characters that aren't URL safe are allowed in Twig markup.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-01T18:35:49.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9994" PostTypeId="2" ParentId="9991" CreationDate="2015-06-01T19:18:31.123" Score="1" Body="&lt;p&gt;Thanks. I think this is what happened. When i saved the entry change i did change the Enrty Template name. However, it seemed to have generated it back to articles/_entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then i went in again and updated the name back to the real name i was using.&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-06-01T19:18:31.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9995" PostTypeId="2" ParentId="5244" CreationDate="2015-06-01T19:52:34.133" Score="2" Body="&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.id(craft.request.lastSegment).status('pending').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1097" LastActivityDate="2015-06-01T19:52:34.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9996" PostTypeId="1" CreationDate="2015-06-01T20:24:29.417" Score="2" ViewCount="507" Body="&lt;p&gt;I've written a plugin to update some user profile fields via ajax. It works great for normal text fields like this 'myWooly' field, ex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class ProfileUpdateController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    /**&#xA;     * updateWooly&#xA;     */&#xA;    public function actionUpdateWooly()&#xA;    {&#xA;        $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;        // get current user's profile info&#xA;        $currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $profile = $currentUser-&amp;gt;getContent();&#xA;&#xA;        $currentUser-&amp;gt;getContent()-&amp;gt;myWooly = $post['myWooly'];&#xA;&#xA;        if (craft()-&amp;gt;users-&amp;gt;saveUser($currentUser)) {&#xA;            $response = 'success';&#xA;        }&#xA;        else {&#xA;            $response = 'error';&#xA;        }&#xA;&#xA;        $this-&amp;gt;returnJson($response);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've created a Matrix field with each block having its own Wooly, ex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Kids (Matrix field)&#xA; - kid (block type)&#xA;  + firstName&#xA;  + wooly&#xA; - kid&#xA;  + firstName&#xA;  + wooly&#xA; - etc. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and now I need for users to update the 'wooly' within each Matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated my AJAX call to POST a Matrix Block ID and updated my actionUpdateWooly() action to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function actionUpdateWooly()&#xA;    {&#xA;        $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;        // get current user's profile info&#xA;        $currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $profile = $currentUser-&amp;gt;getContent();&#xA;&#xA;        // SAVE WOOLY IN KIDS MATRIX FIELD&#xA;        if (isset($post['kidId'])) {&#xA;&#xA;            $kidsMatrix = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle(&quot;kids&quot;);&#xA;&#xA;            $kidsMatrixBlocks = craft()-&amp;gt;matrix-&amp;gt;getBlockTypesByFieldId($kidsMatrix-&amp;gt;id);&#xA;            foreach ($kidsMatrixBlocks as $key =&amp;gt; $data) {&#xA;                if ($data-&amp;gt;handle === &quot;kid&quot;) {&#xA;                    $kidBlock = $data;&#xA;                    break;&#xA;                };&#xA;            };&#xA;&#xA;            $block = new MatrixBlockModel($post['kidId']);&#xA;            $block-&amp;gt;fieldId    = $kidsMatrix-&amp;gt;id; // Matrix field's ID, 'Kids'&#xA;            $block-&amp;gt;ownerId    = $currentUser-&amp;gt;id; // ID of entry the block should be added to&#xA;            $block-&amp;gt;typeId     = $kidBlock-&amp;gt;id; // ID of block type, 'kid'&#xA;            $block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                'wooly' =&amp;gt; $post['myWooly'],&#xA;            ));&#xA;&#xA;            $response = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&#xA;        }&#xA;&#xA;        // WOOLY STORED AT TOP-LEVEL OF ACCOUNT&#xA;        else {&#xA;            $currentUser-&amp;gt;getContent()-&amp;gt;myWooly = $post['myWooly'];&#xA;        }&#xA;&#xA;        if (craft()-&amp;gt;users-&amp;gt;saveUser($currentUser)) {&#xA;            $response = 'success';&#xA;        }&#xA;        else {&#xA;            $response = 'error';&#xA;        }&#xA;&#xA;        $this-&amp;gt;returnJson($response);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is successfully CREATING NEW matrix blocks in the correct field, but it's not UPDATING the one I'm expecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect this to get the Matrix block by ID but apparently it's not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block = new MatrixBlockModel($post['kidId']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, I've made sure the Matrix Block ID &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody spot what I should be doing differently to get a specific matrix block and updated it within a user profile?&lt;/p&gt;&#xA;" OwnerUserId="1097" LastActivityDate="2015-06-05T17:13:35.587" Title="Updating user profile matrix block with plugin" Tags="&lt;matrix&gt;&lt;plugins&gt;&lt;ajax&gt;&lt;profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9998" PostTypeId="2" ParentId="9980" CreationDate="2015-06-01T22:02:12.177" Score="1" Body="&lt;p&gt;You've hit on most of the options — all of which should work fine.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming you have a structure called 'pages', with the 'uri' set to &lt;code&gt;{slug}&lt;/code&gt;, 'parent uri' set to &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;, and template set to 'pages/_entry'; create a new entry 'resources' which should route to your template at 'pages/_entry.html', or&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you do not have a 'pages' structure you can also just create a template at 'templates/resources.html', or 'templates/resources/index.html', or&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a route &lt;code&gt;'resources' =&amp;gt; 'pages/_entry'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If those aren't working, then you might check that the template itself isn't creating any restrictions, and/or that you don't have any other routes defined (i.e. in your config file) that might be creating conflicts.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-06-01T22:02:12.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9999" PostTypeId="1" AcceptedAnswerId="10153" CreationDate="2015-06-02T14:41:13.540" Score="3" ViewCount="641" Body="&lt;p&gt;I've the following situation:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Accommodations (entry)&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;description (textfield)&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;li&gt;linkedTo (matrix block)&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sport (category)&lt;/li&gt;&#xA;&lt;li&gt;targetGroup (category)&lt;/li&gt;&#xA;&lt;li&gt;minimumAge (number)&lt;/li&gt;&#xA;&lt;li&gt;maximumAge (number)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is fetch all entries (accommodations) related to a sport and targetGroup for a person of a certain age. E.g.: Entries for children with the age of 11 years in the targetGroup 'men/boys' and the sport 'football'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding elements using &lt;code&gt;relatedTo&lt;/code&gt; works for me, except I'm not able to filter the age. I'm pretty sure I'm doing something wrong here. I think it's not possible in craft to find textfield values via the relatedTo method, but the question is: How should I do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function get ()&#xA;{&#xA;    $sport      = $this-&amp;gt;findSelectedBySlug('football');&#xA;    $targetGroup    = $this-&amp;gt;findSelectedBySlug('men-boys');&#xA;    $age            = 11;&#xA;&#xA;    $wheres = [&#xA;        &quot;and&quot;,&#xA;        [&#xA;            'targetElement' =&amp;gt; $sport,&#xA;            'field' =&amp;gt; &quot;linkedTo.sport&quot;&#xA;        ],&#xA;        [&#xA;            'targetElement' =&amp;gt; $targetGroup,&#xA;            'field' =&amp;gt; &quot;linkedTo.targetGroup&quot;&#xA;        ],&#xA;        [&#xA;            'targetElement' =&amp;gt; &quot;&amp;lt;= {$age}&quot;,&#xA;            'field' =&amp;gt; &quot;linkedTo.minimumAge&quot;&#xA;        ],&#xA;        [&#xA;            'targetElement' =&amp;gt; &quot;&amp;gt; {$age}&quot;,&#xA;            'field' =&amp;gt; &quot;linkedTo.maximumAge&quot;&#xA;        ]&#xA;    ];&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'accomodations';&#xA;    $criteria-&amp;gt;relatedTo = $wheres;&#xA;&#xA;    return $criteria-&amp;gt;find();&#xA;}&#xA;private function findSelectedBySlug ($slug)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;&#xA;    $criteria-&amp;gt;slug = $slug;&#xA;&#xA;    return $criteria-&amp;gt;first();&#xA;}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3714" LastEditorUserId="831" LastEditDate="2015-06-12T02:21:18.627" LastActivityDate="2015-06-14T14:22:20.093" Title="Filtering Matrix through field value and multiple relations" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10000" PostTypeId="1" AcceptedAnswerId="10001" CreationDate="2015-06-02T18:00:09.247" Score="0" ViewCount="860" Body="&lt;p&gt;What is the best way to set a logic order on a channel of entries. I'd like to be able to set the order of each entry (any unset can default to date afterwards).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the best way be just a text field and enter a number? Or is there some other structure?&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-06-02T18:12:37.390" Title="Set Order of Entries" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10001" PostTypeId="2" ParentId="10000" CreationDate="2015-06-02T18:12:37.390" Score="4" Body="&lt;p&gt;If you explicitly want a &lt;em&gt;Channel&lt;/em&gt; of entries, then you should go with a number field. If, however, you'd use a &lt;em&gt;Structure&lt;/em&gt; (with 1 level max), you'd be able to drag and drop entries and use that to order 'em.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-06-02T18:12:37.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10002" PostTypeId="2" ParentId="9978" CreationDate="2015-06-03T04:10:27.880" Score="1" Body="&lt;p&gt;How are the entries ordered (by date in a channel, manually in a structure or other?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you using the entries anywhere elsewhere at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of ways you could go, If the Galleries are related to the Updates, you could create a relationship from one to another using an entries field, and then just have the parent render the child in the same loop to different single page entry templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how the URLs need to be, you could use two different entry types in the same channel or structure.  If you need different URL structure you could always use {type} in the 'Entry URL Format' setting and then use custom routes if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think you need to get as complex with arrays or anything.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-06-03T04:10:27.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10003" PostTypeId="1" CreationDate="2015-06-03T04:55:22.357" Score="-1" ViewCount="234" Body="&lt;p&gt;I got a Craft-style 404 page when deployed to server. The homepage displays fine in local/development environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the server, the admin interface works fine though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'loginPath' =&amp;gt; 'users/login',&#xA;    'logoutPath' =&amp;gt; 'users/logout',&#xA;    'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;    'defaultFilePermissions' =&amp;gt; 0664,&#xA;    'defaultFolderPermissions' =&amp;gt; 0775,&#xA;    'devMode' =&amp;gt; true,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone has a clue on how to debug this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will a mismatch in the license's domain name cause this?&lt;/p&gt;&#xA;" OwnerUserId="3531" LastEditorUserId="344" LastEditDate="2015-06-03T08:58:56.943" LastActivityDate="2015-06-04T23:26:33.080" Title="404 homepage on deployment" Tags="&lt;deployment&gt;&lt;404&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10004" PostTypeId="1" CreationDate="2015-06-03T04:58:55.943" Score="4" ViewCount="611" Body="&lt;p&gt;I have Structure-type Section for entries and want to pragmatically populate a large list of multi-tiered entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see you can create an entry like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'New Page';&#xA;$entry-&amp;gt;getContent()-&amp;gt;body = null;&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do is add the parent(s) of the entry, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'New Page';&#xA;$entry-&amp;gt;getContent()-&amp;gt;body = null;&#xA;&#xA;// this entry would be a child in order of Sports -&amp;gt; Tennis -&amp;gt; This Entry&#xA;$entry-&amp;gt;getContent()-&amp;gt;parent = sports-&amp;gt;tennis;&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do something like that?&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2015-11-23T20:33:18.460" Title="Set Structure Parent when creating Entry in Plugin" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;entry-type&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10005" PostTypeId="1" CreationDate="2015-06-03T08:21:03.597" Score="2" ViewCount="418" Body="&lt;p&gt;Suddenly, when I try to enter an article to edit it, I get the error message&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Internal Server Error - Cannot find the target folder.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find the reason why this happens, or how to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This error happens on both my local install and prod. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error log of the incident: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/06/03 08:04:55 [error] [exception.Twig_Error_Runtime] exception 'Craft\Exception' with message 'Finner ikke målmappen.' in /home/sites/prod/mallpaper/craft/app/fieldtypes/AssetsFieldType.php:414&#xA;Stack trace:&#xA;#0 /home/sites/prod/mallpaper/craft/app/fieldtypes/AssetsFieldType.php(565): Craft\AssetsFieldType-&amp;gt;_resolveSourcePathToFolderId('1', 'produktbilder')&#xA;#1 /home/sites/prod/mallpaper/craft/app/fieldtypes/AssetsFieldType.php(346): Craft\AssetsFieldType-&amp;gt;_determineUploadFolderId(Object(Craft\Model))&#xA;#2 /home/sites/prod/mallpaper/craft/app/fieldtypes/BaseElementFieldType.php(390): Craft\AssetsFieldType-&amp;gt;getInputSources()&#xA;#3 /home/sites/prod/mallpaper/craft/app/fieldtypes/BaseElementFieldType.php(222): Craft\BaseElementFieldType-&amp;gt;getInputTemplateVariables('bilde1', NULL)&#xA;#4 [internal function]: Craft\BaseElementFieldType-&amp;gt;getInputHtml('bilde1', NULL)&#xA;#5 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(478): call_user_func_array(Array, Array)&#xA;#6 /home/sites/prod/mallpaper/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Object(Craft\AssetsFieldType), 'getInputHtml', Array, 'method', false, false)&#xA;#7 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/83/de/5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f.php(52): Craft\BaseTemplate-&amp;gt;getAttribute(Object(Craft\AssetsFieldType), 'getInputHtml', Array, 'method')&#xA;#8 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_83de5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f-&amp;gt;doDisplay(Array, Array)&#xA;#9 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#10 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/74/a6/fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7.php(65): Twig_Template-&amp;gt;display(Array)&#xA;#11 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_74a6fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7-&amp;gt;doDisplay(Array, Array)&#xA;#12 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#13 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(Array)&#xA;#14 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#15 /home/sites/prod/mallpaper/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('_includes/field...', Array)&#xA;#16 /home/sites/prod/mallpaper/craft/app/fieldtypes/MatrixFieldType.php(611): Craft\TemplatesService-&amp;gt;render('_includes/field...', Array)&#xA;#17 /home/sites/prod/mallpaper/craft/app/fieldtypes/MatrixFieldType.php(238): Craft\MatrixFieldType-&amp;gt;_getBlockTypeInfoForInput('innhold')&#xA;#18 [internal function]: Craft\MatrixFieldType-&amp;gt;getInputHtml('innhold', Object(Craft\ElementCriteriaModel))&#xA;#19 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(478): call_user_func_array(Array, Array)&#xA;#20 /home/sites/prod/mallpaper/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Object(Craft\MatrixFieldType), 'getInputHtml', Array, 'method', false, false)&#xA;#21 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/83/de/5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f.php(52): Craft\BaseTemplate-&amp;gt;getAttribute(Object(Craft\MatrixFieldType), 'getInputHtml', Array, 'method')&#xA;#22 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_83de5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f-&amp;gt;doDisplay(Array, Array)&#xA;#23 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#24 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/74/a6/fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7.php(43): Twig_Template-&amp;gt;display(Array)&#xA;#25 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_74a6fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7-&amp;gt;doDisplay(Array, Array)&#xA;#26 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#27 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/6e/76/5e65bc52da97e7432cefa6ece2851b07770b0c3bdda4d2979169b3ea55f7.php(55): Twig_Template-&amp;gt;display(Array)&#xA;#28 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_6e765e65bc52da97e7432cefa6ece2851b07770b0c3bdda4d2979169b3ea55f7-&amp;gt;doDisplay(Array, Array)&#xA;#29 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#30 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/22/14/970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958.php(108): Twig_Template-&amp;gt;display(Array)&#xA;#31 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_2214970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958-&amp;gt;block_main(Array, Array)&#xA;#32 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/66/f0/f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a.php(450): Twig_Template-&amp;gt;displayBlock('main', Array, Array)&#xA;#33 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_66f0f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a-&amp;gt;block_body(Array, Array)&#xA;#34 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/72/b4/b075fd2a11a6105035a02658170b9bf08d8d85b929f8a4fbf5e90bfbfdb5.php(42): Twig_Template-&amp;gt;displayBlock('body', Array, Array)&#xA;#35 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_72b4b075fd2a11a6105035a02658170b9bf08d8d85b929f8a4fbf5e90bfbfdb5-&amp;gt;doDisplay(Array, Array)&#xA;#36 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#37 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/49/c7/342f46e011d39a17a8f80067b9f6acd5bfe5198c69fd8d27f216e15db654.php(83): Twig_Template-&amp;gt;display(Array, Array)&#xA;#38 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_49c7342f46e011d39a17a8f80067b9f6acd5bfe5198c69fd8d27f216e15db654-&amp;gt;doDisplay(Array, Array)&#xA;#39 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#40 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/66/f0/f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a.php(112): Twig_Template-&amp;gt;display(Array, Array)&#xA;#41 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_66f0f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a-&amp;gt;doDisplay(Array, Array)&#xA;#42 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#43 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/22/14/970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958.php(53): Twig_Template-&amp;gt;display(Array, Array)&#xA;#44 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_2214970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958-&amp;gt;doDisplay(Array, Array)&#xA;#45 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#46 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(Array)&#xA;#47 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#48 /home/sites/prod/mallpaper/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('entries/_edit', Array)&#xA;#49 /home/sites/prod/mallpaper/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('entries/_edit', Array)&#xA;#50 /home/sites/prod/mallpaper/craft/app/controllers/EntriesController.php(331): Craft\BaseController-&amp;gt;renderTemplate('entries/_edit', Array)&#xA;#51 [internal function]: Craft\EntriesController-&amp;gt;actionEditEntry(Array)&#xA;#52 /home/sites/prod/mallpaper/craft/app/framework/web/actions/CAction.php(108): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\EntriesController), Array)&#xA;#53 /home/sites/prod/mallpaper/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\EntriesController), Object(ReflectionMethod), Array)&#xA;#54 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#55 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#56 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#57 /home/sites/prod/mallpaper/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('editEntry')&#xA;#58 /home/sites/prod/mallpaper/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('entries/editEnt...')&#xA;#59 /home/sites/prod/mallpaper/craft/app/etc/web/WebApp.php(266): CWebApplication-&amp;gt;processRequest()&#xA;#60 /home/sites/prod/mallpaper/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#61 /home/sites/prod/mallpaper/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#62 /home/sites/prod/mallpaper/index.php(18): require_once('/home/sites/pro...')&#xA;#63 {main}&#xA;&#xA;Next exception 'Twig_Error_Runtime' with message 'An exception has been thrown during the rendering of a template (&quot;Finner ikke målmappen.&quot;) in &quot;_includes/field&quot; at line 14.' in /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php:294&#xA;Stack trace:&#xA;#0 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#1 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/74/a6/fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7.php(65): Twig_Template-&amp;gt;display(Array)&#xA;#2 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_74a6fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7-&amp;gt;doDisplay(Array, Array)&#xA;#3 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#4 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(Array)&#xA;#5 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#6 /home/sites/prod/mallpaper/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('_includes/field...', Array)&#xA;#7 /home/sites/prod/mallpaper/craft/app/fieldtypes/MatrixFieldType.php(611): Craft\TemplatesService-&amp;gt;render('_includes/field...', Array)&#xA;#8 /home/sites/prod/mallpaper/craft/app/fieldtypes/MatrixFieldType.php(238): Craft\MatrixFieldType-&amp;gt;_getBlockTypeInfoForInput('innhold')&#xA;#9 [internal function]: Craft\MatrixFieldType-&amp;gt;getInputHtml('innhold', Object(Craft\ElementCriteriaModel))&#xA;#10 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(478): call_user_func_array(Array, Array)&#xA;#11 /home/sites/prod/mallpaper/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Object(Craft\MatrixFieldType), 'getInputHtml', Array, 'method', false, false)&#xA;#12 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/83/de/5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f.php(52): Craft\BaseTemplate-&amp;gt;getAttribute(Object(Craft\MatrixFieldType), 'getInputHtml', Array, 'method')&#xA;#13 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_83de5aae689a7a2ceed7cb3d4f79a20330c4d1a3c155a3da3631021f8de0792f-&amp;gt;doDisplay(Array, Array)&#xA;#14 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#15 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/74/a6/fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7.php(43): Twig_Template-&amp;gt;display(Array)&#xA;#16 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_74a6fc70902e227816c7ca0a2e8fa14c2d32a084005c1965cf7b6827bfb7a1f7-&amp;gt;doDisplay(Array, Array)&#xA;#17 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#18 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/6e/76/5e65bc52da97e7432cefa6ece2851b07770b0c3bdda4d2979169b3ea55f7.php(55): Twig_Template-&amp;gt;display(Array)&#xA;#19 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_6e765e65bc52da97e7432cefa6ece2851b07770b0c3bdda4d2979169b3ea55f7-&amp;gt;doDisplay(Array, Array)&#xA;#20 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#21 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/22/14/970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958.php(108): Twig_Template-&amp;gt;display(Array)&#xA;#22 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_2214970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958-&amp;gt;block_main(Array, Array)&#xA;#23 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/66/f0/f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a.php(450): Twig_Template-&amp;gt;displayBlock('main', Array, Array)&#xA;#24 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_66f0f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a-&amp;gt;block_body(Array, Array)&#xA;#25 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/72/b4/b075fd2a11a6105035a02658170b9bf08d8d85b929f8a4fbf5e90bfbfdb5.php(42): Twig_Template-&amp;gt;displayBlock('body', Array, Array)&#xA;#26 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_72b4b075fd2a11a6105035a02658170b9bf08d8d85b929f8a4fbf5e90bfbfdb5-&amp;gt;doDisplay(Array, Array)&#xA;#27 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#28 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/49/c7/342f46e011d39a17a8f80067b9f6acd5bfe5198c69fd8d27f216e15db654.php(83): Twig_Template-&amp;gt;display(Array, Array)&#xA;#29 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_49c7342f46e011d39a17a8f80067b9f6acd5bfe5198c69fd8d27f216e15db654-&amp;gt;doDisplay(Array, Array)&#xA;#30 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#31 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/66/f0/f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a.php(112): Twig_Template-&amp;gt;display(Array, Array)&#xA;#32 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_66f0f48de5f00171ebea218e4debc13fea39cecbdccf332a34226b375ccd781a-&amp;gt;doDisplay(Array, Array)&#xA;#33 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#34 /home/sites/prod/mallpaper/craft/storage/runtime/compiled_templates/22/14/970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958.php(53): Twig_Template-&amp;gt;display(Array, Array)&#xA;#35 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_2214970554d4e69573d2ccb13d92b486587fa2a6f77527248ad150d83559c958-&amp;gt;doDisplay(Array, Array)&#xA;#36 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#37 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&amp;gt;display(Array)&#xA;#38 /home/sites/prod/mallpaper/craft/app/vendor/twig/twig/lib/Twig/Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#39 /home/sites/prod/mallpaper/craft/app/services/TemplatesService.php(220): Twig_Environment-&amp;gt;render('entries/_edit', Array)&#xA;#40 /home/sites/prod/mallpaper/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('entries/_edit', Array)&#xA;#41 /home/sites/prod/mallpaper/craft/app/controllers/EntriesController.php(331): Craft\BaseController-&amp;gt;renderTemplate('entries/_edit', Array)&#xA;#42 [internal function]: Craft\EntriesController-&amp;gt;actionEditEntry(Array)&#xA;#43 /home/sites/prod/mallpaper/craft/app/framework/web/actions/CAction.php(108): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\EntriesController), Array)&#xA;#44 /home/sites/prod/mallpaper/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\EntriesController), Object(ReflectionMethod), Array)&#xA;#45 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#46 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#47 /home/sites/prod/mallpaper/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#48 /home/sites/prod/mallpaper/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('editEntry')&#xA;#49 /home/sites/prod/mallpaper/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('entries/editEnt...')&#xA;#50 /home/sites/prod/mallpaper/craft/app/etc/web/WebApp.php(266): CWebApplication-&amp;gt;processRequest()&#xA;#51 /home/sites/prod/mallpaper/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&amp;gt;processRequest()&#xA;#52 /home/sites/prod/mallpaper/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#53 /home/sites/prod/mallpaper/index.php(18): require_once('/home/sites/pro...')&#xA;#54 {main}&#xA;REQUEST_URI=/admin/entries/artikkel/756-style-guide-daddy-cool&#xA;HTTP_REFERER=http://mallpaper.pico.dev/admin/entries&#xA;---&#xA;2015/06/03 08:04:55 [error] [application] An exception has been thrown during the rendering of a template (&quot;Finner ikke målmappen.&quot;).&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3717" LastActivityDate="2015-09-01T21:06:21.910" Title="&quot;Internal Server Error - Cannot find the target folder.&quot; When trying to edit an article" Tags="&lt;database&gt;&lt;error-message&gt;&lt;server&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10007" PostTypeId="1" AcceptedAnswerId="10017" CreationDate="2015-06-03T09:12:50.910" Score="2" ViewCount="54" Body="&lt;p&gt;So I'm guessing this is just a basic error but I can't for the life of me figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to create a new user, set some attributes and add them to a group I've already made. The following code all works but for the line:&#xA;&lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($newUser-&amp;gt;getContent()-&amp;gt;id, 11);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSendSignup()&#xA;{&#xA;   $this-&amp;gt;requirePostRequest();&#xA;&#xA;   $user = new UserModel();&#xA;   $user-&amp;gt;username  = craft()-&amp;gt;request-&amp;gt;getPost('memberEmail');&#xA;   $user-&amp;gt;unverifiedEmail  = craft()-&amp;gt;request-&amp;gt;getPost('memberEmail');&#xA;&#xA;   $data = [&#xA;       &quot;firstName&quot; =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('memberFirstName'),&#xA;       &quot;lastName&quot; =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('memberLastName'),&#xA;       &quot;email&quot; =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('memberEmail'),&#xA;   ];&#xA;&#xA;   $user-&amp;gt;setAttributes($data);&#xA;   $user-&amp;gt;pending = true;&#xA;&#xA;   $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;   if ($success) {&#xA;       craft()-&amp;gt;search-&amp;gt;indexElementAttributes($user);&#xA;&#xA;&#xA;       // Assign them to my user group 11&#xA;       craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($newUser-&amp;gt;getContent()-&amp;gt;id, 11);&#xA;&#xA;       // Update the Element Index&#xA;       craft()-&amp;gt;search-&amp;gt;indexElementAttributes($user);&#xA;   }&#xA;&#xA;   return $this-&amp;gt;returnJson($user-&amp;gt;getContent());&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The get id returns a number that appears right (it's a low integer), but I get a SQL error on adding the row to the join table users_usergroups and the userId doesn't match the user that was created in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing I'm misunderstanding the user id field?&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2015-06-03T15:06:11.923" Title="UserId Not correct" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10010" PostTypeId="1" AcceptedAnswerId="10024" CreationDate="2015-06-03T12:58:18.813" Score="2" ViewCount="211" Body="&lt;p&gt;I have matrix fields where I dont have translation on the whole matrix, but only on the fields within a certain block. Nothing complicated or fancy. When I add a new matrix block in the admin, it will result in a locale that is not the same as the one I'm editing at the moment: I have two locales installed (sv and en). Everything works fine. But its just that when I'm editing the swedish (sv) entries I can see that the locale-indicator next to the matrix text-field says &quot;en&quot;. But when I edit the swedish locale, I want to start adding text in the locale that I'm editing at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft Pro 2.4.2668&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BwZ7c.jpg&quot; alt=&quot;screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above is a screenshot from the admin, with the locale-indicator (screenshot taken right after klicking the &quot;+ Menu item&quot;-button&lt;/p&gt;&#xA;" OwnerUserId="3720" LastEditorUserId="3720" LastEditDate="2015-06-03T15:32:55.087" LastActivityDate="2015-06-03T21:08:19.907" Title="Adding new matrix block will result in wrong locale" Tags="&lt;matrix&gt;&lt;localization&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10011" PostTypeId="1" AcceptedAnswerId="10013" CreationDate="2015-06-03T13:55:04.237" Score="1" ViewCount="63" Body="&lt;p&gt;I'm using &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Records&lt;/a&gt; to create some new tables for use by my plugin. I now need to add some initial data to one of the these tables. What's the best way of accomplishing this on install?&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-06-03T14:39:41.657" Title="Populate tables on Plugin install" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10012" PostTypeId="2" ParentId="5291" CreationDate="2015-06-03T14:17:52.637" Score="10" Body="&lt;p&gt;We just published a video course on Craft plugin development that might help you. &lt;a href=&quot;https://mijingo.com/products/screencasts/craft-plugin-development/&quot;&gt;https://mijingo.com/products/screencasts/craft-plugin-development/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2015-06-03T14:17:52.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10013" PostTypeId="2" ParentId="10011" CreationDate="2015-06-03T14:39:41.657" Score="4" Body="&lt;p&gt;Looks like overriding the &lt;code&gt;onAfterInstall()&lt;/code&gt; method in the main Plugin class is where I should be adding this sort of stuff. Amazing what you find when you actually read the instructions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#methods&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-06-03T14:39:41.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10014" PostTypeId="1" AcceptedAnswerId="10019" CreationDate="2015-06-03T14:45:47.587" Score="3" ViewCount="407" Body="&lt;p&gt;Is it possible to add another link to admin navigation? For example I have plugin clients which has it's own Button in the admin menu, in the same plugin i have newsletter so I would like to have that Newsletter in that menu as well.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2018-10-22T10:28:51.927" Title="Can plugin have two links in admin navigation?" Tags="&lt;plugin-development&gt;&lt;navigation&gt;&lt;admin&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10015" PostTypeId="2" ParentId="10014" CreationDate="2015-06-03T14:55:06.050" Score="3" Body="&lt;p&gt;Do you mean have multiple tabbed content within your plugin admin area? If so yes that's possible you just need to add a tabs array in your template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tabs = {&#xA; tab1: { label: &quot;Tab 1&quot;|t, url: url('plugin') },&#xA; tab2: { label: &quot;Tab 2&quot;|t, url: url('plugin/tab2') },&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then to make a tab active in the navigation you would just add this to the relevant template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selectedTab = 'tab2' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are referring to having both &lt;code&gt;clients&lt;/code&gt; and &lt;code&gt;newsletter&lt;/code&gt; in the top navigation I don't think so, I think it's one section per plugin (but I could be mistaken)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry I should have elaborated, you will also need to register additional pages in your main plugin class, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;  return array(&#xA;    'pluginHandle/some-page' =&amp;gt; 'pluginHandle/_someTemplate'&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/templates#extending-the-cp-layout&quot; rel=&quot;nofollow&quot;&gt;There is a bunch of info about this in the plugin docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-06-03T15:06:57.733" LastActivityDate="2015-06-03T15:06:57.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10016" PostTypeId="2" ParentId="10005" CreationDate="2015-06-03T15:01:55.893" Score="2" Body="&lt;p&gt;You probably need to update any Asset fields you have under Settings-&gt;Fields that were pointing to your local folder over to your S3 source now.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-06-03T20:06:45.313" LastActivityDate="2015-06-03T20:06:45.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10017" PostTypeId="2" ParentId="10007" CreationDate="2015-06-03T15:06:11.923" Score="1" Body="&lt;p&gt;&lt;code&gt;$newUser-&amp;gt;getContent()-&amp;gt;id&lt;/code&gt; will return the primary key from the &lt;code&gt;craft_content&lt;/code&gt; table, not from the &lt;code&gt;craft_users&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to use &lt;code&gt;$newUser-&amp;gt;id&lt;/code&gt;, instead.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-03T15:06:11.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10019" PostTypeId="2" ParentId="10014" CreationDate="2015-06-03T18:16:04.193" Score="6" Body="&lt;p&gt;The top links in the CP header are often called &lt;em&gt;nav tabs&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond the &quot;default&quot; nav tab for your plugin (pointing to the plugin's &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/templates.html#giving-your-plugin-its-own-cp-section&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP section&lt;/a&gt;), it's possible to declare additional tabs via the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyCpNav&quot; rel=&quot;nofollow noreferrer&quot;&gt;modifyCpNav&lt;/a&gt; hook (added in &lt;a href=&quot;https://github.com/craftcms/cms/blob/master-v2/CHANGELOG-v2.md#232640---2015-03-12&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.3.2640&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyCpNav(&amp;amp;$nav)&#xA;{&#xA;    $nav['mypluginhandle-newsletter'] = array('label' =&amp;gt; 'Newsletter', 'url' =&amp;gt; 'mypluginhandle/newsletter');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this will only create a tab with a link pointing to whatever you put in the &lt;code&gt;url&lt;/code&gt; property. If you haven't already created the page for the newsletter, you'll need to do so by creating a &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;route&lt;/a&gt; to a template or controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'mypluginhandle/newsletter' =&amp;gt; 'myPluginHandle/newsletter',&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Read more about the &lt;code&gt;registerCpRoutes&lt;/code&gt; hook in the &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/hooks-reference.html#registercproutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;official docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both the &lt;code&gt;modifyCpNav()&lt;/code&gt; and &lt;code&gt;registerCpRoutes()&lt;/code&gt; methods should go in your plugin's main class.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="3951" LastEditDate="2018-10-22T10:28:51.927" LastActivityDate="2018-10-22T10:28:51.927" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10021" PostTypeId="2" ParentId="9395" CreationDate="2015-06-03T18:28:04.467" Score="5" Body="&lt;p&gt;Here is what i have done. Not sure if it helps you. I can't add comments. So here you go. This is based on &lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;noreferrer&quot;&gt;geo&lt;/a&gt; plugin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin serviceclass:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&lt;code&gt;&#xA;//to get local ele&#xA;private function getLocalElement()&#xA;    {&#xA;        $source=craft()-&gt;request-&gt;getRequestUri();&#xA;         if($source==''){&#xA;             $source = 'home';&#xA;         }&#xA;        return  craft()-&gt;elements-&gt;getElementByUri($source);&#xA;    }&#xA;&#xA;//finds locale and redirect&#xA;private function redirectToLang()&#xA;   {&#xA;       $value=$this-&gt;detectBrowserLang().&quot;_&quot;.strtolower($this-&gt;detectCountryCode());&#xA;       if(in_array($value, craft()-&gt;i18n-&gt;siteLocaleIds)==1){&#xA;            $element=$this-&gt;getLocalElement();&#xA;            if(!is_null($element)){&#xA;                $localElementUri = craft()-&gt;elements-&gt;getElementUriForLocale($element-&gt;id, $value);&#xA;                header('Location: '.$this-&gt;configBaseUrl().'/'.$value.'/'.$localElementUri, true, 302); &#xA;            }            &#xA;        }      &#xA;&#xA;   }&#xA;&#xA;//browser lang&#xA;private function detectBrowserLang()&#xA;   {&#xA;        $browserLang=craft()-&gt;request-&gt;getBrowserLanguages();&#xA;        if(isset($browserLang)){&#xA;            $lang=substr(strtolower($browserLang[0]),0,2); &#xA;            return $lang;&#xA;        }&#xA;   }&#xA;&#xA;//detect country code by geo&#xA;private function detectCountryCode()&#xA;    {&#xA;        $info=$this-&gt;getInfoGeo();&#xA;        $countryCode=strtoupper($info[&quot;country_code&quot;]);      &#xA;        return $countryCode;          &#xA;    }&#xA;&#xA;&lt;/code&gt;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically checking browser lang and country code(geo) with craft locales.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2015-06-03T18:34:46.030" LastActivityDate="2015-06-03T18:34:46.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10022" PostTypeId="1" AcceptedAnswerId="10023" CreationDate="2015-06-03T19:29:16.640" Score="2" ViewCount="61" Body="&lt;p&gt;Is it possible, on a model, to get only the fields that were marked as required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have an entry which has just been saved and I can get it's content like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;getAttributes()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I need to filter it out by the only the fields that were required, because it already has a section assigned and is saved I thought this might be possible...I tried &lt;code&gt;$entry-&amp;gt;getRequiredFields()&lt;/code&gt; but that didn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then I tried these to no avail&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;getRequiredAttributes()&#xA;$entry-&amp;gt;getContent()-&amp;gt;getRequiredFields()&#xA;$entry-&amp;gt;getRequiredAttributes()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this actually achievable? any help or pointers would be much appreciated! :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-03T20:55:47.460" Title="Can you get only fields marked as required via a plugin?" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10023" PostTypeId="2" ParentId="10022" CreationDate="2015-06-03T20:47:05.340" Score="3" Body="&lt;p&gt;Your &lt;code&gt;$entry&lt;/code&gt; variable – i.e. an instance of &lt;a href=&quot;https://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt; – has an attribute called &lt;code&gt;fieldLayout&lt;/code&gt;, which will return the field layout (&lt;a href=&quot;https://buildwithcraft.com/classreference/models/FieldLayoutModel&quot; rel=&quot;nofollow&quot;&gt;FieldLayoutModel&lt;/a&gt;) for this entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via the field layout, you can loop over all fields for the entry (each field will be an instance of &lt;a href=&quot;https://buildwithcraft.com/classreference/models/FieldLayoutFieldModel&quot; rel=&quot;nofollow&quot;&gt;FieldLayoutFieldModel&lt;/a&gt;), checking their &lt;code&gt;required&lt;/code&gt; attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get all fields for this entry&#xA;$fields = $entry-&amp;gt;fieldLayout-&amp;gt;fields;&#xA;&#xA;// Loop over fields, check required attribute&#xA;$requiredFields = array();&#xA;foreach ($fields as $fieldModel) {&#xA;    if ($fieldModel-&amp;gt;required) {&#xA;        $requiredFields[] = $fieldModel-&amp;gt;field;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example, &lt;code&gt;$requiredFields&lt;/code&gt; will be an array of required fields, i.e. FieldLayoutFieldModels. If you only need an array of the required attribute names for your entry, you can opt to only store the field &lt;em&gt;handles&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$requiredAttributes = array();&#xA;foreach ($fields as $fieldModel) {&#xA;    if ($fieldModel-&amp;gt;required) {&#xA;        $requiredAttributes[] = $fieldModel-&amp;gt;field-&amp;gt;handle;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-03T20:55:47.460" LastActivityDate="2015-06-03T20:55:47.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10024" PostTypeId="2" ParentId="10010" CreationDate="2015-06-03T21:08:19.907" Score="1" Body="&lt;p&gt;This is a UI bug when saving a &lt;em&gt;new&lt;/em&gt; Matrix block in an new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you save, the data is saved into the correct locale and the fields in Matrix blocks will display their correct locales (in your case &lt;code&gt;sv&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-03T21:08:19.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10025" PostTypeId="2" ParentId="9978" CreationDate="2015-06-04T00:04:39.270" Score="1" Body="&lt;p&gt;To list entries of two sections in alternating order, I would do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#ids&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ids&lt;/code&gt;&lt;/a&gt; method to get an array of entry IDs for both of your sections. Then combine those arrays of IDs by &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot; rel=&quot;nofollow&quot;&gt;iterating over a sequence '0..x'&lt;/a&gt;, and for each step pull one ID from each of the individual arrays with &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt;. You can now use that array of IDs in a new ElementCriteriaModel to get the entries you're after.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set galleryEntriesIds = craft.entries.section('gallery').limit(null).ids() %}&#xA;{% set updateEntriesIds = craft.entries.section('update').limit(null).ids() %}&#xA;&#xA;{% set mixedEntriesIds = [] %}&#xA;&#xA;{% for key in 0..50 %}&#xA;&#xA;    {% if galleryEntriesIds[key] is defined %}&#xA;        {% set mixedEntriesIds = mixedEntriesIds|merge(galleryEntriesIds[key]) %}&#xA;    {% endif %}&#xA;&#xA;    {% if updateEntriesIds[key] is defined %}&#xA;        {% set mixedEntriesIds = mixedEntriesIds|merge(updateEntriesIds[key]) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set mixedEntries = craft.entries.id(mixedEntriesIds).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getSection&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getSection&lt;/code&gt;&lt;/a&gt; to check which section an entry belongs to within your loops.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate mixedEntries as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;&#xA;        {% if entry.getSection().handle == 'gallery' %}&#xA;            ...&#xA;        {% else %}&#xA;            ...&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-06-04T07:19:13.537" LastActivityDate="2015-06-04T07:19:13.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10026" PostTypeId="1" AcceptedAnswerId="10032" CreationDate="2015-06-04T08:23:31.590" Score="0" ViewCount="98" Body="&lt;p&gt;I am trying to loop through a matrix to output three blocks but also I want to pull in 3 images from 3 different sections. The images are asset fields in 3 other sections. should i loop through those sections using craft.entries or craft.assests? below is an example of what i have been trying out. thanks in advance for any help&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeMatrix %}&#xA;        {% if block.type == &quot;homeMatrix&quot; %}&#xA;                &amp;lt;a class=&quot;half-box full-box&quot; href=&quot;{{ block.entry.first().url }}&quot;&amp;gt;&#xA;                    {% for image in craft.assets.kind('image') %}&#xA;                    &amp;lt;picture class=&quot;box-image&quot;&amp;gt;&#xA;                        &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;video style=&quot;display: none;&quot;&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;                            &amp;lt;source srcset=&quot;{{ entry.lTopBannerImg.first().url('gridImages480X340') }}&quot; media=&quot;(min-width: 45em)&quot;&amp;gt;&#xA;                            &amp;lt;source srcset=&quot;{{ entry.lTopBannerImg.first().url('gridImageOdd559X315') }}&quot; media=&quot;(min-width: 28.4375em)&quot;&amp;gt;&#xA;                            &amp;lt;source srcset=&quot;{{ entry.lTopBannerImg.first().url('gridImages560X520') }}&quot;&amp;gt;&#xA;                        &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;/video&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;                        &amp;lt;img alt=&quot;{{ entry.lTopBannerImgAltText.first().title }}&quot; srcset=&quot;{{ entry.lTopBannerImg.first().url('gridImages480X340') }}&quot;&amp;gt;&#xA;                    &amp;lt;/picture&amp;gt;&#xA;                    {% endfor %}&#xA;                    &amp;lt;div class=&quot;box-bar&quot;&amp;gt;&#xA;                        &amp;lt;h2&amp;gt;{{ block.url }}&amp;lt;/h2&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;see-more&quot;&amp;gt;&amp;lt;span class=&quot;plus&quot;&amp;gt;Click to see more information&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2015-06-04T19:09:47.617" Title="pulling in an image from another section within a matrix loop" Tags="&lt;matrix&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10028" PostTypeId="1" AcceptedAnswerId="10048" CreationDate="2015-06-04T12:25:35.210" Score="2" ViewCount="209" Body="&lt;p&gt;We are looking to log searches so we can report on them. Are there any hooks or events we can use to get this data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, then how can a custom plugin log the initial search parameters, call the underlying core Craft search, and finally log the results?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="1098" LastEditDate="2015-06-06T09:06:54.460" LastActivityDate="2015-06-06T15:37:59.803" Title="Is there a hook or event we can use to intercept a search request?" Tags="&lt;plugin-development&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10029" PostTypeId="2" ParentId="2825" CreationDate="2015-06-04T12:33:03.947" Score="3" Body="&lt;p&gt;I ran into the same problem lately, but got no clues from the accepted answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 2.4 though, is a &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;config setting&lt;/a&gt; that limits asset filenames to ASCII, so I'm happy with this workaround:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'convertFilenamesToAscii' =&amp;gt; true&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When storing assets in folders derived from the entry slug, you will additionally need to add the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'limitAutoSlugsToAscii' =&amp;gt; true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Minor hassle: These settings naturally won't rename existing files and entries, so you need to touch each one in the control panel to take effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm not completely convinced this filename issue is Craft's fault, since the file paths are broken/garbled in Coda, Safari and Safari for iOS – but work just fine in Firefox and Chrome by way of in-browser url-encoding.)&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2015-06-04T12:33:03.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10030" PostTypeId="1" AcceptedAnswerId="10059" CreationDate="2015-06-04T14:15:13.833" Score="2" ViewCount="155" Body="&lt;p&gt;I have a plugin. In this plugin I did elementtype which extends the user one, but with only one source &quot;clients&quot;. I have and New Client button which points to my plugin &lt;code&gt;Plugin_ClientController&lt;/code&gt; which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Plugin_ClientController extends UsersController&#xA;{&#xA;&#xA;    public function actionIndex( array $variables = array() ) {&#xA;&#xA;       $this-&amp;gt;renderTemplate('plugin/client/_index');&#xA;&#xA;    }&#xA;&#xA;    public function renderTemplate($path, array $variables = array()) {&#xA;&#xA;        $path = str_replace('users/', 'plugin/client/', $path);&#xA;        parent::renderTemplate($path, $variables);&#xA;&#xA;    }   &#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is the right way to do this, but it seems to work,&#xA;so like this I can have my one view for Client edit, which is almost the same as users one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My elementtype is look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Plugin_ClientElementType extends UserElementType&#xA;{&#xA;&#xA;    public function getSources($context = null)&#xA;    {&#xA;        $sources = array(&#xA;            '*' =&amp;gt; array(&#xA;                'label'    =&amp;gt; Craft::t('Clients'),&#xA;                'criteria'  =&amp;gt; array('groupId' =&amp;gt; 1),&#xA;                'hasThumbs' =&amp;gt; true&#xA;            )&#xA;        );&#xA;        return $sources;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all fine up to here. The problem is in that list:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SUbB8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I list all my clients the url on the title in my case now &lt;code&gt;User1&lt;/code&gt; is pointing to &lt;code&gt;admin/users/[ID]&lt;/code&gt;&#xA;I would like to change it to &lt;code&gt;plugin/client/[ID]&lt;/code&gt; if that possible I know that it has to be in the model like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Pluign_ClientModel extends UserModel&#xA;{&#xA;&#xA;    protected $elementType = 'Plugin_Client';&#xA;&#xA;&#xA;    public function getCpEditUrl()&#xA;    {&#xA;        return UrlHelper::getCpUrl('plugin/client/' . $this-&amp;gt;id);&#xA;    }&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it seems that it's not coming from there. If someone can help me with this would be great. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="22" LastEditDate="2017-05-10T00:03:20.593" LastActivityDate="2017-05-10T00:03:20.593" Title="Change title url of elementtype in the list" Tags="&lt;plugin-development&gt;&lt;admin&gt;&lt;elementtype&gt;&lt;extends&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10031" PostTypeId="2" ParentId="10028" CreationDate="2015-06-04T17:41:18.757" Score="1" Body="&lt;p&gt;It sounds like what you'd need would be an &lt;code&gt;onBeforeSearch&lt;/code&gt; or &lt;code&gt;onSearch&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There currently isn't anything like that in Craft, but would probably be worth adding as a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-04T17:41:18.757" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10032" PostTypeId="2" ParentId="10026" CreationDate="2015-06-04T19:09:47.617" Score="3" Body="&lt;p&gt;I'm not sure what &lt;code&gt;{% for image in craft.assets.kind('image') %}&lt;/code&gt; is all about in your code since the &lt;code&gt;image&lt;/code&gt; variable isn't being used anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's the basic structure on how you could loop through 3 separate Asset fields in 3 different single sections inside of a Matrix block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeMatrix %}&#xA;    {% if block.type == &quot;homeMatrix&quot; %}&#xA;&#xA;        {% set firstSingle = craft.entries.section('myFirstSection').first() %}&#xA;        {% set secondSingle = craft.entries.section('mySecondSection').first() %}&#xA;        {% set thirdSingle = craft.entries.section('myThirdSection').first() %}&#xA;&#xA;        {% if firstSingle.myAssetField|length %}&#xA;            {% for image in firstSingle.myAssetField %}&#xA;                {{ image.url }}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&#xA;        {% if secondSingle.myAssetField|length %}&#xA;            {% for image in secondSingle.myAssetField %}&#xA;                {{ image.url }}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&#xA;        {% if thirdSingle.myAssetField|length %}&#xA;            {% for image in thirdSingle.myAssetField %}&#xA;                {{ image.url }}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-04T19:09:47.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10033" PostTypeId="2" ParentId="10003" CreationDate="2015-06-04T23:26:33.080" Score="3" Body="&lt;p&gt;I was being silly here. We have separate folder for all frontend assets (including twig templates), which will be copied over to the craft folder on build. The target files are gitignored and need to be force add to git. I added the files under web but missed out on the craft/templates folder.&lt;/p&gt;&#xA;" OwnerUserId="3531" LastActivityDate="2015-06-04T23:26:33.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10034" PostTypeId="2" ParentId="9909" CreationDate="2015-06-05T07:21:41.810" Score="4" Body="&lt;p&gt;So from reading your updated answer and looking at the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9986/is-it-possible-to-route-to-www-site-com-username/9992#9992&quot;&gt;other question you mentioned&lt;/a&gt; I would assume you are trying to create prefixed dynamic links that don't conflict with your routing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;code&gt;site.com/about&lt;/code&gt; would link to your about page and &lt;code&gt;site.com/#about&lt;/code&gt; would load up your custom template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with using a &lt;code&gt;#&lt;/code&gt; for your trigger is that really this should be used for linking to internal sections on a page and with the above &lt;code&gt;site.com/#about&lt;/code&gt; would actually just link to your index page and if you had a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; with an id of &lt;code&gt;about&lt;/code&gt; you'd find the scroll position at that div, so I think using a &lt;code&gt;#&lt;/code&gt; is going to give you a lot of headaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps use the &lt;code&gt;@&lt;/code&gt; sign? if it's good enough for twitter to use then I don't think you'll have many problems using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your &lt;code&gt;config/routes.php&lt;/code&gt; you would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA; '(?P&amp;lt;username&amp;gt;\@\w+)' =&amp;gt; '_someCustomTemplate',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will match anything starting with an &lt;code&gt;@&lt;/code&gt;, assign it to &lt;code&gt;username&lt;/code&gt; a variable in your template and load it up, I tested on the Happy Lager install and it worked like a charm, &lt;code&gt;/about&lt;/code&gt; goes to the about page &lt;code&gt;/@about&lt;/code&gt; goes to my custom template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your custom template you could have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This will get rid of the @ #}&#xA;{% set username = username|replace({'@': ''}) %}&#xA;&#xA;{% set user = craft.users.username(username) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to change the trigger to something else, just change &lt;code&gt;@&lt;/code&gt; in the route expression and then in the replace filter, but that should do the trick for you and avoid conflicts!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;on a side note, I replaced &lt;code&gt;@&lt;/code&gt; with a &lt;code&gt;#&lt;/code&gt; and it didn't work, just went to the home page&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-05T07:54:17.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10035" PostTypeId="1" CreationDate="2015-06-05T08:36:34.937" Score="1" ViewCount="1172" Body="&lt;p&gt;I have a blog section on my site and would like a &quot;More posts by this author&quot; list. How would I go about this, the logic is clear but the syntax to write for it is not forthcoming.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-06-08T10:05:45.330" Title="Display entries by current entry author?" Tags="&lt;loop&gt;&lt;author&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10036" PostTypeId="2" ParentId="10035" CreationDate="2015-06-05T08:52:48.920" Score="2" Body="&lt;p&gt;You can get entries by an author like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorPosts = craft.entries.section('posts').authorId(entry.authorId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this returns an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; so you could do things like &lt;code&gt;.first()&lt;/code&gt; &lt;code&gt;.limit(1)&lt;/code&gt; etc but you can use it in a twig loop as is.&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-06-08T10:05:45.330" LastActivityDate="2015-06-08T10:05:45.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10037" PostTypeId="1" AcceptedAnswerId="10038" CreationDate="2015-06-05T09:12:57.420" Score="1" ViewCount="131" Body="&lt;p&gt;I am trying to enable the user to have mutliple full width css background images, my loop works going through the matrix and grabbing the images but the trouble is they all have the same css class mid-banner and one overrides the other so they all end up being the same image, how can I make it so that each one has a different class as it loops through, or each have an individual id would probably make more sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeMatrix %}&#xA;    {% if block.type == &quot;homeMatrix&quot; %}&#xA;    {% set oddOrEven = cycle(['even', 'odd'], loop.index0) %}&#xA;        &amp;lt;section class=&quot;section {{ oddOrEven }}&quot;&amp;gt;&#xA;            &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;{{ block.txtTitle }}&amp;lt;/h1&amp;gt;&#xA;                {{ block.txt }}&#xA;            &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/section&amp;gt;  &#xA;        {% for image in block.image %}&#xA;        &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;            .mid-banner{&#xA;                background-repeat:no-repeat;&#xA;                background-size:contain;&#xA;                background-position:center;&#xA;                background-size:cover;&#xA;                background-image: url({{ image.getUrl() }});&#xA;            }&#xA;        &amp;lt;/style&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;section class=&quot;section mid-banner&quot;&amp;gt;&#xA;            &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;{{ block.imageTitle }}&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/section&amp;gt;            &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2015-06-11T10:54:05.180" Title="Enable the user to upload multiple background Images that come from a matirx loop" Tags="&lt;matrix&gt;&lt;image&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10038" PostTypeId="2" ParentId="10037" CreationDate="2015-06-05T09:43:36.613" Score="1" Body="&lt;p&gt;So I have figured out the answer to my own questions it turns out that I needed to use a {{ counter }} that incremented the class name in both the  tag where the .mid-banner class is defined so that each time the loop runs it add 1 to the class. The stars show the code i have added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeMatrix %}&#xA;    {% if block.type == &quot;homeMatrix&quot; %}&#xA;    {% set oddOrEven = cycle(['even', 'odd'], loop.index0) %}&#xA;        &amp;lt;section class=&quot;section {{ oddOrEven }}&quot;&amp;gt;&#xA;            &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;{{ block.txtTitle }}&amp;lt;/h1&amp;gt;&#xA;                {{ block.txt }}&#xA;            &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/section&amp;gt;  &#xA;&#xA;        **{% set counter = ( counter | default(0) ) + 1 %}**&#xA;        {% for image in block.image %}&#xA;        &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;            .mid-banner**{{ counter }}**{&#xA;                background-image: url({{ image.getUrl() }});&#xA;            }&#xA;        &amp;lt;/style&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;section class=&quot;section mid-banner**{{ counter }}**&quot;&amp;gt;&#xA;            &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;{{ block.imageTitle }}&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;/article&amp;gt;&#xA;        &amp;lt;/section&amp;gt;            &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2015-06-05T09:43:36.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10039" PostTypeId="1" AcceptedAnswerId="10047" CreationDate="2015-06-05T13:34:28.133" Score="6" ViewCount="448" Body="&lt;p&gt;This may sound paradoxal but here it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Membership based site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A new user starts as suspended.&#xA;An admin unsuspends.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The user uses the system.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If a membership expires, a user gets suspended again (in the cp).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want (in the cp again, from a plugin) a list of of suspended users who have never logged in. New users basically...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.status('suspended').lastLoginDate(NULL)&#xA;craft.users.status('suspended').lastLoginDate('')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Neither of these work. Any light?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.status('suspended')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then this in the actual loop works&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if user.lastLoginDate is null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just wonder why I can't just fetch it all in one go :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2015-06-05T13:44:46.467" LastActivityDate="2015-06-05T23:32:53.657" Title="Suspended users who have never logged in" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;login&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10040" PostTypeId="1" AcceptedAnswerId="10042" CreationDate="2015-06-05T14:29:47.613" Score="1" ViewCount="319" Body="&lt;p&gt;I'm picking a season category (spring, summer, fall, winter)  in a global variable that should dictate what entries come to the top of non-season category pages. These entries are already on a category page, sorted by their main category. I need extra sorting to showcase the &quot;Spring&quot; entries, for instance. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Without the season global variable chosen&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Test post 1 (Summer)&lt;/li&gt;&#xA;&lt;li&gt;Test post 2 (Spring)&lt;/li&gt;&#xA;&lt;li&gt;Test post 3 (Spring)&lt;/li&gt;&#xA;&lt;li&gt;Test post 4 (Winter)&lt;/li&gt;&#xA;&lt;li&gt;Test post 5 (Winter)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;With the global variable &quot;Spring&quot; chosen&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Test post 2 (Spring)&lt;/li&gt;&#xA;&lt;li&gt;Test post 3 (Spring)&lt;/li&gt;&#xA;&lt;li&gt;Test post 1 (Summer)&lt;/li&gt;&#xA;&lt;li&gt;Test post 4 (Winter)&lt;/li&gt;&#xA;&lt;li&gt;Test post 5 (Winter)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to bring the entries that are using the chosen Global Variable Category to the top, the remaining entries can be sorted by postDate descending. These entries are in a Structure btw, if that matters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Structure = 'generalContent'&lt;br&gt;&#xA;Category Field = 'season'&lt;br&gt;&#xA;Global Variable = 'season.season'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplified code of my category page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('generalContent').relatedTo(category).order('lft desc') as entries %}&#xA;  {% for entry in entries %}&#xA;    {{ entry.title }}&amp;lt;br&amp;gt;&#xA;  {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2015-06-10T16:02:23.833" Title="Sort entries by global variable category" Tags="&lt;structure&gt;&lt;globals&gt;&lt;sorting&gt;&lt;plugin-supersort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10041" PostTypeId="2" ParentId="10039" CreationDate="2015-06-05T14:52:29.113" Score="2" Body="&lt;p&gt;You should able to use &lt;code&gt;search&lt;/code&gt; with &lt;code&gt;craft.users&lt;/code&gt; something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.search('suspended: 1 lastLoginDate: NULL')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;search docs&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-06-05T14:52:29.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10042" PostTypeId="2" ParentId="10040" CreationDate="2015-06-05T16:21:45.313" Score="4" Body="&lt;p&gt;One solution is to retrieve the entry ids for the season entries and all entries separately; subtract the 'season entry ids' from 'all entry ids' (using craft's &lt;code&gt;without&lt;/code&gt; twig filter); then merge the two arrays back together (using twig's &lt;code&gt;merge&lt;/code&gt; filter) in the proper order. You can then use this new id array to generate an elementCriteriaModel which can be used in your &lt;code&gt;paginate&lt;/code&gt; expression.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% set season = season.season.first() %}&#xA;    {% set seasonEntryIds = craft.entries.section('generalContent').relatedTo(season).order('lft desc').ids() %}&#xA;    {% set allEntryIds = craft.entries.section('generalContent').order('lft desc').ids() %}&#xA;    {% set nonSeasonEntryIds = allEntryIds|without(seasonEntryIds) %}&#xA;    {% set sortedEntryIds = seasonEntryIds|merge(nonSeasonEntryIds) %}&#xA;&#xA;    {% paginate craft.entries.id(sortedEntryIds).fixedOrder(true) as entries %}&#xA;        {% for entry in entries %}&#xA;            {{ entry.title }}&amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;    {% endpaginate %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since there are a lot of queries happening here, it might also be a good idea to wrap the code in 'cache' tag.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-06-10T16:02:23.833" LastActivityDate="2015-06-10T16:02:23.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10043" PostTypeId="2" ParentId="9996" CreationDate="2015-06-05T16:21:55.777" Score="2" Body="&lt;p&gt;I believe this is the correct way to get an existing Matrix block. Found this gem after digging around in the Google group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block = craft()-&amp;gt;matrix-&amp;gt;getBlockById(blockId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I updated my plugin code above to this and it seems to work properly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// THIS DOESN'T WORK&#xA;// $block = new MatrixBlockModel($post['kidId']);&#xA;&#xA;// THIS WORKS&#xA;$block = craft()-&amp;gt;matrix-&amp;gt;getBlockById($post['kidId']);&#xA;&#xA;$block-&amp;gt;fieldId    = $kidsMatrix-&amp;gt;id; // Matrix field's ID, 'Kids'&#xA;$block-&amp;gt;ownerId    = $currentUser-&amp;gt;id; // ID of entry the block should be added to&#xA;$block-&amp;gt;typeId     = $kidBlock-&amp;gt;id; // ID of block type, 'kid'&#xA;$block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'wooly' =&amp;gt; $post['myWooly'],&#xA;));&#xA;&#xA;$response = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1097" LastEditorUserId="1097" LastEditDate="2015-06-05T17:13:35.587" LastActivityDate="2015-06-05T17:13:35.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10044" PostTypeId="2" ParentId="10035" CreationDate="2015-06-05T16:57:56.560" Score="5" Body="&lt;p&gt;In order to display all other entries by an author except the current one, you will need to perform another step — either by filtering out the current entry from the query or adding a conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorId = entry.author.id %}&#xA;{% set allEntryIds = craft.entries.section('blog').authorId(authorId).limit(null).ids() %}&#xA;{% set otherEntryIds = allEntryIds|without(entry.id) %}&#xA;{% set otherEntries = craft.entries.section('blog').id(otherEntryIds) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in otherEntries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorId = entry.author.id %}&#xA;{% set authorEntries = craft.entries.section('blog').authorId(authorId).limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for authorEntry in authorEntries %}&#xA;        {% if not authorEntry.id == entry.id %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-06-05T17:04:07.680" LastActivityDate="2015-06-05T17:04:07.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10045" PostTypeId="1" AcceptedAnswerId="10046" CreationDate="2015-06-05T16:59:01.233" Score="4" ViewCount="337" Body="&lt;p&gt;I've got a client project which utilizes the Users section of craft pretty heavily. I am trying to figure out if it is possible in vanilla craft to move a user from one group to another say, from the 'employee' group to the 'manager' group. I have seen some code to do it in a custom controller action in a few other posts on here, but I'd rather avoid creating a custom plugin for this if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is this possible? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3688" LastActivityDate="2015-06-05T17:57:09.063" Title="Change User Group Front-End" Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10046" PostTypeId="2" ParentId="10045" CreationDate="2015-06-05T17:57:09.063" Score="4" Body="&lt;p&gt;You'd need to do this from a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that has a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; that calls &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService#assignUserToGroups-detail&quot; rel=&quot;nofollow&quot;&gt;UserGroupsService-&gt;assignUserToGroups()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-05T17:57:09.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10047" PostTypeId="2" ParentId="10039" CreationDate="2015-06-05T23:32:53.657" Score="5" Body="&lt;p&gt;This probably works: &lt;code&gt;craft.users.status('suspended').lastLoginDate(':empty:')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-05T23:32:53.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10048" PostTypeId="2" ParentId="10028" CreationDate="2015-06-06T09:11:55.177" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;We are looking to log searches so we can report on them. Are there any&#xA;  hooks or events we can use to get this data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, there aren't any hooks or events related to searching, currently (Craft 2.4). Like Brad says, you can &lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;nofollow&quot;&gt;add a feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[...] how can a custom plugin log the initial search parameters, call the&#xA;  underlying core Craft search, and finally log the results?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;&#xA;    public function search($query = '', ElementType $elementType = null)&#xA;    {&#xA;&#xA;        MyPluginPlugin::log($query);&#xA;&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria($elementType ?: ElementType::Entry);&#xA;        $criteria-&amp;gt;search = $query;&#xA;&#xA;        MyPluginPlugin::log(count($criteria));&#xA;&#xA;        return $criteria;&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.myPlugin.search('body:foo -body:bar') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-06T15:37:59.803" LastActivityDate="2015-06-06T15:37:59.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10049" PostTypeId="1" CreationDate="2015-06-06T18:10:56.293" Score="2" ViewCount="613" Body="&lt;p&gt;As best I can tell, the 'mockBuilder' function is exactly what I want, and based on other examples, should work.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something?&#xA;How can I stub out the global craft() object?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;under test:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;&#xA;class JobsVariable&#xA;{&#xA;&#xA;     // Grab all Jobss&#xA;     public function jobs()&#xA;      {&#xA;            return craft();&#xA;      }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;test file:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;&#xA;    namespace Craft;&#xA;&#xA;    require_once 'www/craftcms/plugins/jobs/variables/JobsVariable.php';&#xA;&#xA;&#xA;    class JobsVariableTest extends \PHPUnit_Framework_TestCase&#xA;    {&#xA;&#xA;&#xA;&#xA;        public function testJobs()&#xA;        {&#xA;&#xA;&#xA;            $craft = $this-&amp;gt;getMockBuilder('\\Craft')&#xA;                -&amp;gt;disableOriginalConstructor()&#xA;                -&amp;gt;setMethods(array('craft'))&#xA;                -&amp;gt;getMock();&#xA;&#xA;&#xA;            $craft-&amp;gt;method('craft')-&amp;gt;willReturn('xxx');&#xA;&#xA;&#xA;            $jobs = new \Craft\JobsVariable();&#xA;            $this-&amp;gt;assertEquals('xxx', $jobs-&amp;gt;jobs());&#xA;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;output:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Call to undefined function Craft\craft()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3713" LastEditorUserId="22" LastEditDate="2017-05-09T23:58:40.057" LastActivityDate="2017-05-09T23:58:40.057" Title="Stub out the global craft() object for PHPUnit tests" Tags="&lt;php&gt;&lt;tests&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10050" PostTypeId="2" ParentId="10049" CreationDate="2015-06-06T21:06:28.037" Score="1" Body="&lt;p&gt;Whew...this seems to do the trick!&#xA;Hopefully this is an appropriate way to handle things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a new Craft class file in the 'tests' dir.  There I can stub out any &lt;code&gt;\Craft\craft()&lt;/code&gt; methods the class under test depends on.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;stub class \tests\Craft&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;class Craft {&#xA;&#xA;    public function __construct()&#xA;    {&#xA;    }&#xA;&#xA;    public function jobs()&#xA;    {&#xA;        return 'xxx';&#xA;    }&#xA;    public function getJobs()&#xA;    {&#xA;        return 'xxx';&#xA;    }&#xA;&#xA;    public function craft()&#xA;    {&#xA;        return $this;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;in the test class&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;require_once '/www/craftcms/plugins/jobs/variables/JobsVariable.php';&#xA;require_once '/www/craftcms/tests/Craft.php';&#xA;&#xA;&#xA;class JobsVariableTest extends \PHPUnit_Framework_TestCase&#xA;{&#xA;&#xA;    public function testJobs()&#xA;    {&#xA;        $jobs = new \Craft\JobsVariable();&#xA;        $this-&amp;gt;assertEquals('xxx', $jobs-&amp;gt;jobs());&#xA;&#xA;    }&#xA;}&#xA;function craft()&#xA;{&#xA;    return new \Craft;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;allows me to test this function...&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function jobs()&#xA;{&#xA;    return craft()-&amp;gt;jobs();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3713" LastActivityDate="2015-06-06T21:06:28.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10051" PostTypeId="2" ParentId="10049" CreationDate="2015-06-06T22:13:09.447" Score="1" Body="&lt;p&gt;...and because the actual test method to get mocked looks like this:&#xA;&lt;code&gt;craft()-&amp;gt;jobs-&amp;gt;getJobs()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can mock this up by adding a class to my stubbed out \test\Craft class;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;class Craft {&#xA;&#xA;    public $jobs;&#xA;&#xA;    public function __construct()&#xA;    {&#xA;        $this-&amp;gt;jobs = new Jobs;&#xA;    }&#xA;}&#xA;&#xA;&#xA;class Jobs{&#xA;&#xA;    public function __construct(){&#xA;        var_dump('new jobs');&#xA;    }&#xA;&#xA;&#xA;    public function getJobs(){&#xA;        return 'xxx';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I can return dummy test data ('xxx'), instead of letting the code make  network requests for real data.&lt;/p&gt;&#xA;" OwnerUserId="3713" LastActivityDate="2015-06-06T22:13:09.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10052" PostTypeId="2" ParentId="1870" CreationDate="2015-06-06T22:45:07.850" Score="4" Body="&lt;p&gt;I built &lt;a href=&quot;http://www.progress.org&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Progress.org&lt;/strong&gt;&lt;/a&gt; using Craft and Bootstrap—and it only took me about two months of part-time work. I’d say Craft and Bootstrap together are a match made in heaven. Here’s why:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Bootstrap is an out-of-the-box template that gives you great flexibility if you want to design your website how &lt;em&gt;you&lt;/em&gt; want it to look. I found other frameworks like WordPress overly constraining.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Craft allows for near unlimited customizations as long as you know your front-end HTML/CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know your HTML/CSS, then a Bootstrap/Craft combination is ideal, in my experience.&lt;/p&gt;&#xA;" OwnerUserId="3497" LastEditorUserId="3497" LastEditDate="2015-06-08T16:27:08.970" LastActivityDate="2015-06-08T16:27:08.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10053" PostTypeId="1" AcceptedAnswerId="10054" CreationDate="2015-06-08T08:52:31.387" Score="0" ViewCount="364" Body="&lt;p&gt;I have a &lt;code&gt;{{ siteURL }}&lt;/code&gt; tag inside a matrix plain text field. But it does only render as a tag and isn't beeing converted to the actual url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accoring to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1268/is-it-possible-to-use-twig-in-a-rich-text-field&quot;&gt;this post&lt;/a&gt; one way is to use &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference tags&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I write inside the matrix plain text field: &lt;code&gt;{ globalset:siteUrl }&lt;/code&gt; and in the template I write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in siteDropdown.matrixDropdown %}&#xA;   &amp;lt;li&amp;gt;&#xA;     &amp;lt;a href=&quot;{{ block.cellLink|parseRefs|raw }}&quot;&amp;gt;{{ block.cellLinkTitle }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this does nothing but print the tag itself. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-08T19:50:08.117" Title="Reference tags inside Matrix textfield" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;globals&gt;&lt;reference-tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10054" PostTypeId="2" ParentId="10053" CreationDate="2015-06-08T10:07:56.233" Score="2" Body="&lt;p&gt;You'll need to use the global set's element ID as the &lt;em&gt;reference&lt;/em&gt; part (second segment) of the &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{globalset:51:siteUrl}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To find the global set's ID, go to CP -&gt; Settings -&gt; Globals. The URL to the global set will have the ID as the last segment (e.g. &lt;code&gt;http://yoursite.craft.dev/admin/settings/globals/51&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, see the this SE thread for a little more info: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1796/how-can-i-use-a-reference-tag-with-a-global-set-using-the-handle-not-the-id&quot;&gt;How can I use a reference tag with a global set using the handle (not the ID)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-08T19:50:08.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10055" PostTypeId="1" AcceptedAnswerId="10057" CreationDate="2015-06-08T10:39:42.583" Score="7" ViewCount="1749" Body="&lt;p&gt;From a template or a plugin, how can I get the value of admin/Settings/System Email Address ?&#xA;Thanks for your help&#xA;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2018-08-08T02:27:35.157" Title="How do I get the Settings System email Address?" Tags="&lt;templating&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10056" PostTypeId="2" ParentId="9033" CreationDate="2015-06-08T11:19:02.260" Score="1" Body="&lt;p&gt;Along with Brad's helpful answer, I can certainly verify that the &quot;Pro&quot; level of Craft does support S3 perfectly. If you implement that for all your assets, and then track any other site/template code and graphics in something like Git, you can easily roll out an auto-scaling group in EC2 that could expand dynamically with traffic, behind an ELB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just be sure that when a new instance is spun up you use something like the user-data field to initiate a bootstrapping script to &lt;code&gt;git pull&lt;/code&gt; and sync up the new instance with any changes to the current repository.&lt;/p&gt;&#xA;" OwnerUserId="3729" LastActivityDate="2015-06-08T11:19:02.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10057" PostTypeId="2" ParentId="10055" CreationDate="2015-06-08T12:50:24.893" Score="13" Body="&lt;p&gt;You can get this in a template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# returns an array of your email settings #}&#xA;{% set settings = craft.systemSettings.email %}&#xA;&#xA;{# returns the email address #}&#xA;{{ settings.emailAddress }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in a plugin you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;systemSettings-&amp;gt;getSetting('email', 'emailAddress')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-08T12:50:24.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10059" PostTypeId="2" ParentId="10030" CreationDate="2015-06-08T14:42:12.733" Score="3" Body="&lt;p&gt;I found the solution of this was under my nose,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function populateElementModel($row){&#xA;&#xA;  $model = Plugin_ClientModel::populateModel($row);&#xA;  return $model;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;Plugin_ClientElementType&lt;/code&gt; and then &lt;code&gt;getCpEditUrl()&lt;/code&gt; it works.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-06-08T14:42:12.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10060" PostTypeId="1" AcceptedAnswerId="10082" CreationDate="2015-06-08T19:47:32.483" Score="2" ViewCount="1598" Body="&lt;p&gt;Is there a way to save a new entry with a template form, then pass the ID of that new entry along to the redirect location? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case is, I'm interacting with a scheduling service and want to pass along the new craft entry ID in a query string to their API. The service has a webhook that fires on successful scheduling (and provides an appointment ID). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm getting the user's email address returned from the API, then &lt;em&gt;assuming&lt;/em&gt; that user's most recent section/entry in craft is the one I'm looking for. After that, I can unambiguously handle reschedules and cancellations by referencing the appointment ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form has the following inputs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/schedule&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I'd like the /schedule page to get a entryId passed into it&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="3512" LastEditDate="2015-06-09T18:36:40.423" LastActivityDate="2015-06-12T16:20:27.687" Title="Get the ID of a new entry when it's saved" Tags="&lt;form&gt;&lt;entry&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10061" PostTypeId="2" ParentId="10060" CreationDate="2015-06-08T20:37:43.653" Score="3" Body="&lt;p&gt;In a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt; you can hook into the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;saveEntry&lt;/a&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event)]&#xA;{&#xA;&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    // GET ENTRY ID&#xA;    $entryId = $entry-&amp;gt;id &#xA;&#xA;    // DO YOUR STUFF&#xA;    ...&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="1098" LastEditDate="2015-06-09T09:03:53.030" LastActivityDate="2015-06-09T09:03:53.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10062" PostTypeId="1" CreationDate="2015-06-09T02:06:52.947" Score="5" ViewCount="1551" Body="&lt;p&gt;Any recommendations as to whether it is better to use Apache or Nginx for a Craft website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &quot;it depends&quot;, could you please delineate some of the advantages and disadvantages of each option?&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="45" LastEditDate="2015-06-09T04:06:36.863" LastActivityDate="2015-06-10T19:37:23.947" Title="Apache or Nginx for a Craft site" Tags="&lt;install&gt;&lt;nginx&gt;&lt;apache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10063" PostTypeId="2" ParentId="10062" CreationDate="2015-06-09T06:45:31.310" Score="6" Body="&lt;p&gt;There is no &quot;this over that&quot; for Craft specifically. Your own statement &quot;it depends&quot; plays a big role. I would read this pretty extensive post on DigitalOcean &quot;Apache vs Nginx: Practical Considerations&quot; as a good start on what software to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.digitalocean.com/community/tutorials/apache-vs-nginx-practical-considerations&quot;&gt;https://www.digitalocean.com/community/tutorials/apache-vs-nginx-practical-considerations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me personally this has always been the key difference in choosing between the two:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;In terms of real world use-cases, one of the most common comparisons between Apache and Nginx is the way in which each server handles requests for static and dynamic content.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Usually you don't need all the extra features Apache comes bundled with. You have your Craft website, that's it. Nginx (for me) has all the functions it requires and can handle a lot of requests on lower hardware. For me personally that's key.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-06-09T06:45:31.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10064" PostTypeId="1" AcceptedAnswerId="10072" CreationDate="2015-06-09T09:27:29.680" Score="2" ViewCount="1264" Body="&lt;p&gt;First question I guess is &quot;should I be using &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCriteria&quot; rel=&quot;nofollow&quot;&gt;CDbCriteria&lt;/a&gt; at all, or am I overcomplicating things&quot;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly if I'm ok using it, how do I achieve the following SQL query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM myTable &#xA;WHERE cottage=3 &#xA;AND (fromDate BETWEEN '2015-01-01' AND '2015-01-11' &#xA;OR toDate BETWEEN '2015-01-01' AND '2015-01-11');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far I've got this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = new \CDbCriteria();&#xA;$criteria-&amp;gt;addCondition('cottage=' . $booking-&amp;gt;cottage);&#xA;$criteria-&amp;gt;addBetweenCondition('fromDate', $booking-&amp;gt;fromDate, $booking-&amp;gt;toDate);&#xA;$criteria-&amp;gt;addBetweenCondition('toDate', $booking-&amp;gt;fromDate, $booking-&amp;gt;toDate, 'OR');&#xA;$previousBookings = BookingEngine_BookingsRecord::model()-&amp;gt;findAll($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which nearly gets me there, the only issue is when I dump the &lt;code&gt;$criteria-&amp;gt;condition&lt;/code&gt;, the brackets are in the wrong place. So I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;((cottage=3) AND (fromDate BETWEEN :ycp2 AND :ycp3)) OR (toDate BETWEEN :ycp4 AND :ycp5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;cottage&lt;/code&gt; and &lt;code&gt;fromDate&lt;/code&gt; are bracketed together, whereas I want the &lt;code&gt;fromDate&lt;/code&gt; and &lt;code&gt;toDate&lt;/code&gt; bracketed together instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than manually writing the SQL, is there a more straightforward way of doing this, I feel I'm really overdoing a seemingly easy query!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I did rearrange the &lt;code&gt;addCondition&lt;/code&gt; and &lt;code&gt;addBetweenCondition&lt;/code&gt; calls as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = new \CDbCriteria();&#xA;$criteria-&amp;gt;addBetweenCondition('fromDate', $booking-&amp;gt;fromDate, $booking-&amp;gt;toDate);&#xA;$criteria-&amp;gt;addBetweenCondition('toDate', $booking-&amp;gt;fromDate, $booking-&amp;gt;toDate, 'OR');&#xA;$criteria-&amp;gt;addCondition('cottage=' . $booking-&amp;gt;cottage);&#xA;$previousBookings = BookingEngine_BookingsRecord::model()-&amp;gt;findAll($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that did in fact solve the problem. However it does feel like it's working by accident rather than by design. I think Jørgen's answer below  is a bit more straightforward, so I went with that instead.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2015-06-09T15:45:24.667" LastActivityDate="2015-06-09T15:45:24.667" Title="Using Yii CDbCriteria to query a table in a plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10065" PostTypeId="1" AcceptedAnswerId="10068" CreationDate="2015-06-09T10:00:08.180" Score="8" ViewCount="17135" Body="&lt;p&gt;Is there any way to use a macro in twig to define a variable outside that macro?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you want to use a macro to set a variable that stores an entry's parent (I know you can do this much simply, but I have my reasons to want to do it like this), I would intuitively want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro getParentEntry(thisEntry) %}&#xA;&#xA;    {% import _self as self %}&#xA;&#xA;    {% if thisEntry.parent|length %}&#xA;&#xA;        {% set parent = thisEntry %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {% set parent = false %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&#xA;{% import _self as self %}&#xA;{% set parent = self.getParentEntry( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this clearly isn't quite right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something, or is this just not possible. (I couldn't find any mention of anything like this in the twig documentation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="467" LastEditorUserId="467" LastEditDate="2015-06-09T11:01:17.753" LastActivityDate="2017-12-14T18:38:27.333" Title="Use a Twig macro to set a variable" Tags="&lt;templating&gt;&lt;variable&gt;&lt;macro&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10066" PostTypeId="1" CreationDate="2015-06-09T11:44:57.667" Score="1" ViewCount="361" Body="&lt;p&gt;We built a small conference site last year that had a Speakers channel. At the time, we used the title field to store the last name of a speaker. That was fine but for editors, where there are speakers with the same last name, it's become confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought we'd be able to switch to using title format of &lt;code&gt;{title}, {speakerFirstName}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works but involves having to resave the entries which isn't a huge deal but would be great if there was a way to update these all at once?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-06-09T11:44:57.667" Title="changing from title to title format" Tags="&lt;entries&gt;&lt;channels&gt;&lt;titles&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2015-06-11T22:58:17.140" ContentLicense="CC BY-SA 3.0" />
  <row Id="10067" PostTypeId="1" AcceptedAnswerId="10069" CreationDate="2015-06-09T12:53:01.157" Score="1" ViewCount="82" Body="&lt;p&gt;At the bottom of an entry I want to display links for eight other posts. To make this useful, what I'd like to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;start with entries that are related to the post currently being viewed by category (generally there are 4-5 of these)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then fill in the remain slots with the other posts (not related by category), newest first&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a simple-ish way to do this? I started down the path of separate queries, counting, and merging results but something about that feels more complicated that it should be. I'm wondering if this can be achieved via ordering or grouping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2015-06-09T14:20:34.363" Title="Entries Related by Category with Filler Entries After" Tags="&lt;categories&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10068" PostTypeId="2" ParentId="10065" CreationDate="2015-06-09T13:10:45.130" Score="12" Body="&lt;p&gt;I think the issue with trying to set a variable in a macro is that the variable is limited to the scope of the macro you are triggering, so &lt;code&gt;{% set parent = thisEntry %}&lt;/code&gt; is available within the scope of your macro, but doesn't define it for the rest of your template.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Macros are comparable with functions in regular programming languages. They are useful to put often used HTML idioms into reusable elements to not repeat yourself.  &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Macros differs from native PHP functions in a few ways:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Default argument values are defined by using the default filter in the macro body;  &lt;/li&gt;&#xA;  &lt;li&gt;Arguments of a macro are always optional.&lt;/li&gt;&#xA;  &lt;li&gt;But as with PHP functions, &lt;strong&gt;macros don't have access to the current template variables&lt;/strong&gt;.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot;&gt;Taken from the Twig docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So due to the limitations in scope and the nature of macros, they are meant to be used to just output reusable code, not set and define logic in your templates. So everything is just rendered as a string (models have their &lt;code&gt;__toString()&lt;/code&gt; method called)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way you could get this to work for you is to just output whether or not the logic in your macro is true or null, then do the rest of the logic in your template, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro hasParentEntry(thisEntry) %}&#xA;&#xA; {% import _self as self %}&#xA;&#xA; {% if thisEntry.parent|length %}&#xA;&#xA;   {# would output 1 #}&#xA;   {{ true }}&#xA;&#xA; {% else %}&#xA;&#xA;   {# or just output null #}&#xA;   {{ null }}&#xA;&#xA; {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This will either be true or null #}&#xA;{% set parent = self.hasParentEntry( entry ) %}&#xA;&#xA;{% if parent %}&#xA;&#xA; {# this will set your parent variable to the entry model or leave the variable as null #}&#xA; {% set parent = entry.parent %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-09T13:10:45.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10069" PostTypeId="2" ParentId="10067" CreationDate="2015-06-09T14:20:34.363" Score="2" Body="&lt;p&gt;This is probably pretty much the same code you already have, but I can't think of a more elegant solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntriesIds = craft.entries.section('news').relatedTo(entry).limit(8).ids() %}&#xA;&#xA;{% if relatedEntriesIds|length &amp;lt; 8 %}&#xA;    {% set moreRelatedEntriesIds = craft.entries.section('news').limit(8 - relatedEntries|length).ids() %}&#xA;    {% set relatedEntriesIds = relatedEntriesIds|merge([moreRelatedEntriesIds]) %}&#xA;{% endif %}&#xA;&#xA;{% set relatedEntries = craft.entries.id(relatedEntriesIds).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-09T14:20:34.363" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10070" PostTypeId="1" CreationDate="2015-06-09T14:49:58.697" Score="1" ViewCount="124" Body="&lt;p&gt;I have a website where the client can add links to assets (pdf, doc, etc.) anywhere on a page. So I would like to avoid having a assetField on every template. I would like them to upload all assets in the CP on the assets page and than link to them from a page. That's doable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I have one page where I need to list all assets from a certain source. Also doable. But that source has 3 subfolders, one for every locale. However, when files are uploaded in the CP on the assets page, they automatically have properties for all locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only want to fetch the files for a given locale (so a given subfolder). I can do that by using folderId.&#xA;But if a file doesn't exist in one locale, I'd like to default to the same file in another locale. That is the issue I can't get right. How would I proceed? There is no real link between different files which are essentialy the same files but in different languages.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-06-09T14:49:58.697" Title="How to seperate asset folders by locale?" Tags="&lt;assets&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10071" PostTypeId="1" AcceptedAnswerId="10075" CreationDate="2015-06-09T15:23:31.927" Score="2" ViewCount="267" Body="&lt;p&gt;Is there a way to be able to use &lt;code&gt;entry.getNext(params)&lt;/code&gt; to return back to the first entry when you're viewing the last entry in the parameters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the result of looping/cycling through all entries and returning to the original.&lt;/p&gt;&#xA;" OwnerUserId="3734" LastEditorUserId="344" LastEditDate="2015-06-09T16:04:54.267" LastActivityDate="2015-06-09T17:29:11.523" Title="Next / Prev and looping/cycling entries instead of reaching the end of the selected results" Tags="&lt;entries&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10072" PostTypeId="2" ParentId="10064" CreationDate="2015-06-09T15:24:18.763" Score="3" Body="&lt;p&gt;Try this (untested)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = 'cottage = :cottage and ((fromdate between :d1 and :d2) or(toDate between :d1 and :d2))';&#xA;$params = array('cottage' =&amp;gt; $booking-&amp;gt;cottage, 'd1' =&amp;gt; $booking-&amp;gt;fromDate, 'd2' =&amp;gt; $booking-&amp;gt;toDate);&#xA;$previousBookings = BookingEngine_BookingsRecord::model()-&amp;gt;findAll($criteria, $params);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-06-09T15:24:18.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10073" PostTypeId="1" CreationDate="2015-06-09T15:34:07.940" Score="3" ViewCount="573" Body="&lt;p&gt;I'm trying to configure a rich text field to allow script tags for a demo section on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the following settings and linked this to the field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {&#xA;  buttons: ['html','bold','italic','unorderedlist','orderedlist','link','image'],&#xA;  plugins: ['fullscreen'],&#xA;  toolbarFixedBox: true,&#xA;  replaceDivs: false,&#xA;  paragraphize: false,&#xA;  replaceDivs: false,&#xA;  deniedTags: [],&#xA;  removeComments: false,&#xA;  cleanSpaces: false,&#xA;  cleanOnPaste: false,&#xA;  removeDataAttr: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, The script tag is still always removed on save. Is there some other setting i am missing?&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2015-06-26T09:52:09.367" Title="Allow Script Text in Rich Text" Tags="&lt;entries&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10074" PostTypeId="2" ParentId="9082" CreationDate="2015-06-09T17:09:42.933" Score="1" Body="&lt;p&gt;I would like to propose something similar to this as a potential solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Matrix Search - Reasonably Elegant Solution #}&#xA;&#xA;{# Initialise Matrix Block Owner IDs array #}&#xA;{% set matrixBlockOwnerIds = [] %}&#xA;&#xA;{# This seems to be the easiest way to get the criteria in the shortest route #}&#xA;{% set ecm = craft.entries.section('mySectionHandle').type('myEntryTypeHandle').first().someMatrixBlockTypeHandle %}&#xA;&#xA;{# Reset the owner ID because it was set by the first search #}&#xA;{% do ecm.setAttribute('ownerId', NULL) %}&#xA;&#xA;{# Up the limit for a test - can be removed #}&#xA;{% do ecm.setAttribute('limit', 1000) %}&#xA;&#xA;{# Set some search criteria #}&#xA;{% do ecm.setAttribute('startDate', '&amp;gt;= 2015-06-01') %}&#xA;{% do ecm.setAttribute('endDate', '&amp;lt;= 2015-07-01') %}&#xA;&#xA;{# Find matching blocks #}&#xA;{% set matrixBlocks = ecm.find() %}&#xA;&#xA;{# Iterate blocks and extract owner IDs (entry IDs) #}&#xA;{% for block in matrixBlocks %}&#xA;    {% set matrixBlockOwnerIds = matrixBlockOwnerIds|merge([block.ownerId]) %}&#xA;{% endfor %}&#xA;&#xA;{# Query the entries by ID #}&#xA;{% set entries = craft.entries.find({'id': matrixBlockOwnerIds}) %}&#xA;&#xA;{# Iterate entries #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;    {# Unfortunately we need to get the matrix blocks again, but this will include all blocks for the entry of that type #}&#xA;    {% for block in entry.someMatrixBlockTypeHandle.find() %}&#xA;        {# Output some block values #}&#xA;        &amp;lt;p&amp;gt;{{ block.valueA }} - {{ block.valueB }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn't exact to your needs but I'm pretty sure it can be adjusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also do this for numeric ranges: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do ecm.setAttribute('someNumericValue', ['and', '&amp;gt; 10', '&amp;lt; 20') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to combine AND and OR for the same field you'd have to repeat the search with the 'and' set to or, but not reset the matrixBlockOwnerIds array ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do ecm.setAttribute('someNumericValue', ['and', '&amp;gt; 10', '&amp;lt; 20') %}&#xA;&#xA;{% set matrixBlocks = ecm.find() %}&#xA;&#xA;{% for block in matrixBlocks %}&#xA;    {% set matrixBlockOwnerIds = matrixBlockOwnerIds|merge([block.ownerId]) %}&#xA;{% endfor %}&#xA;&#xA;{% do ecm.setAttribute('someNumericValue', ['and', '&amp;gt; 10', '&amp;lt; 20') %}&#xA;&#xA;{% set matrixBlocks = ecm.find() %}&#xA;&#xA;{% for block in matrixBlocks %}&#xA;    {% set matrixBlockOwnerIds = matrixBlockOwnerIds|merge([block.ownerId]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need any help with these examples, just give me a message.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2015-06-09T17:09:42.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10075" PostTypeId="2" ParentId="10071" CreationDate="2015-06-09T17:29:11.523" Score="1" Body="&lt;p&gt;If there isn't a &quot;next&quot; sibling, &lt;code&gt;entry.getNext()&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt; – in which case you can use Twig's &lt;code&gt;default&lt;/code&gt; filter to set an alternative value (i.e. your &lt;em&gt;first&lt;/em&gt; entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextEntry = entry.getNext|craft.entries.section('mySectionHandle').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-09T17:29:11.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10076" PostTypeId="1" AcceptedAnswerId="10081" CreationDate="2015-06-09T20:47:14.183" Score="2" ViewCount="480" Body="&lt;p&gt;I'm trying to create a structure using &lt;code&gt;onBeforeInstall()&lt;/code&gt; that will be ready for a client to use after the plugin is installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code for &lt;code&gt;onBeforeInstall()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforeInstall()&#xA;{&#xA;    $section = new SectionModel();&#xA;    $section-&amp;gt;name = 'Demo';&#xA;    $section-&amp;gt;handle = 'demo';&#xA;    $section-&amp;gt;type = 'structure';&#xA;    $section-&amp;gt;hasUrls = 1;&#xA;    $section-&amp;gt;template = 'demo/page';&#xA;    $section-&amp;gt;enableVersioning = 1;&#xA;    $locale = craft()-&amp;gt;sections-&amp;gt;getSectionLocales(1)[0];&#xA;    $locale-&amp;gt;urlFormat = 'demo/{slug}';&#xA;    $locale-&amp;gt;nestedUrlFormat = '{parent.uri}/{slug}';&#xA;    $section-&amp;gt;setLocales([ $locale ]);&#xA;&#xA;    $response = craft()-&amp;gt;sections-&amp;gt;saveSection($section);&#xA;    if ($response) {&#xA;        var_dump(&quot;IT WORKED!&quot;);&#xA;        var_dump($response);&#xA;    } else {&#xA;        var_dump(&quot;nope.avi&quot;);&#xA;        var_dump($response);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I get a &lt;code&gt;CDbException&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`craft`.`craft_sections_i18n`, CONSTRAINT `craft_sections_i18n_locale_fk` FOREIGN KEY (`locale`) REFERENCES `craft_locales` (`locale`) ON DELETE CASCADE ON UPDATE CASCADE). The SQL statement executed was: INSERT INTO `craft_sections_i18n` (`sectionId`, `locale`, `enabledByDefault`, `urlFormat`, `nestedUrlFormat`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, :row0_col2, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7). Bound with :row0_col0='7', :row0_col1=0, :row0_col2=1, :row0_col3='demo/{slug}', :row0_col4='{parent.uri}/{slug}', :row0_col5='2015-06-09 20:33:00', :row0_col6='2015-06-09 20:33:00', :row0_col7='864207ba-6e43-46cf-9fdb-3a72cda4c2df'`&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was basing my code loosely on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6799/best-way-to-programmatically-create-categories&quot;&gt;this Stack Exchange question and answer&lt;/a&gt;, but for some reason I can't get structures to cooperate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I'm not setting the locale properly.  Is there a better way to set the locale, or am I overlooking something else?&lt;/p&gt;&#xA;" OwnerUserId="3584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-10T07:50:25.563" Title="Create Structure on Plugin Install" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10077" PostTypeId="1" AcceptedAnswerId="10078" CreationDate="2015-06-09T21:13:04.120" Score="4" ViewCount="1506" Body="&lt;p&gt;I'm using &lt;code&gt;MyPlugin::log&lt;/code&gt; to separate the errors for my plugin. However, I'm only able to log a simple message using this technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have that output the &lt;strong&gt;full stack trace&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'm getting (note the general format)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/06/09 20:41:42 [error] [plugin] My example error message.&#xA;in /craft/app/etc/plugins/BasePlugin.php (65)&#xA;in /craft/plugins/businesslogic/services/BusinessLogicService.php (194)&#xA;in /craft/plugins/businesslogic/controllers/BusinessLogic_ActivitiesController.php (47)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But here's what I &lt;strong&gt;want&lt;/strong&gt; (again, note the general format)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/06/09 20:39:25 [error] [exception.CException] exception 'CException' with message 'Craft\BusinessLogic_ActivitiesController and its behaviors do not have a method or closure named &quot;handleError&quot;.' in /craft/app/framework/base/CComponent.php:266&#xA;Stack trace:&#xA;#0 /craft/plugins/businesslogic/controllers/BusinessLogic_ActivitiesController.php(47): CComponent-&amp;gt;__call('handleError', Array)&#xA;#1 /craft/plugins/businesslogic/controllers/BusinessLogic_ActivitiesController.php(47): Craft\BusinessLogic_ActivitiesController-&amp;gt;handleError()&#xA;#2 /craft/app/framework/web/actions/CInlineAction.php(49): Craft\BusinessLogic_ActivitiesController-&amp;gt;actionUpdate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get the #0, #1, #2, etc. to show up?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-09T21:22:24.757" Title="How can I get a full stack trace in my custom plugin log?" Tags="&lt;plugin-development&gt;&lt;logging&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10078" PostTypeId="2" ParentId="10077" CreationDate="2015-06-09T21:22:24.757" Score="5" Body="&lt;p&gt;By default a full stack trace will only be assembled and logged if an exception is thrown (which is what you're looking at in your 2nd example) mainly for performance reasons - cycling through the backtrace and assembling all of that info is a relatively expensive operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard calls to &lt;code&gt;MyPlugin::log&lt;/code&gt; or &lt;code&gt;Craft::log&lt;/code&gt; will get a partial backtrace added to each message.  The depth of that is controlled by the &lt;code&gt;YII_TRACE_LEVEL&lt;/code&gt; PHP constant, which Craft sets to 3 by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have them log deeper into the trace, set that to a higher number in your public index.php file, just be aware of the performance implications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some discussions of that constant here in the Yii docs: &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/topics.logging#logging-context-information&quot;&gt;http://www.yiiframework.com/doc/guide/1.1/en/topics.logging#logging-context-information&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-09T21:22:24.757" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10080" PostTypeId="1" AcceptedAnswerId="10083" CreationDate="2015-06-10T07:37:45.513" Score="1" ViewCount="57" Body="&lt;p&gt;I have two channels, Courses and Instructors. In Courses I'd like to have a an entries field called &quot;Instructor&quot; so that this will display on the courses page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to figure out how to do this. I have found a few tutes but nothing I have tried has worked. Whats the best way of doing this?  &lt;/p&gt;&#xA;" OwnerUserId="3737" LastActivityDate="2015-06-10T11:46:13.320" Title="Trying to relate 2 Entries together" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10081" PostTypeId="2" ParentId="10076" CreationDate="2015-06-10T07:43:22.090" Score="2" Body="&lt;p&gt;I haven't used locales before so i'm not entirely sure, but when I looked in the craft service that saves a section there is a bit that looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($sectionLocales as $localeId =&amp;gt; $sectionLocale)&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which I assume then means your array needs to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA; 'en' =&amp;gt; // model&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas yours was looking like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA; 0 =&amp;gt; // model&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So craft was seeing &lt;code&gt;0&lt;/code&gt; as the locale id and it was failing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I managed to get this to work by using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforeInstall()&#xA;{&#xA;  // Get the current locales ID&#xA;  $currentLocale = craft()-&amp;gt;locale-&amp;gt;getId();&#xA;&#xA;  $section = new SectionModel();&#xA;  $section-&amp;gt;name = 'Demo';&#xA;  $section-&amp;gt;handle = 'demo';&#xA;  $section-&amp;gt;type = 'structure';&#xA;  $section-&amp;gt;hasUrls = 1;&#xA;  $section-&amp;gt;template = 'demo/page';&#xA;  $section-&amp;gt;enableVersioning = 1;&#xA;&#xA;  // Index the locales by their ID e.g en returns array&#xA;  $locales = craft()-&amp;gt;sections-&amp;gt;getSectionLocales(1, 'locale');&#xA;&#xA;  // Target the locale we want by the key in the array&#xA;  $locales[$currentLocale]-&amp;gt;urlFormat = 'demo/{slug}';&#xA;  $locales[$currentLocale]-&amp;gt;nestedUrlFormat = '{parent.uri}/{slug}';&#xA;&#xA;  $section-&amp;gt;setLocales($locales);&#xA;&#xA;  $response = craft()-&amp;gt;sections-&amp;gt;saveSection($section);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Demo section was added and I got the 'IT WORKED' response, I hope that helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose if you didn't want all the locales to be saved to a section you could just do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$specificLocales = array();&#xA;&#xA;// After setting the locale attributes&#xA;$specificLocales[$currentLocale] = $locales[$currentLocale];&#xA;&#xA;$section-&amp;gt;setLocales($specificLocales);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-06-10T07:50:25.563" LastActivityDate="2015-06-10T07:50:25.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10082" PostTypeId="2" ParentId="10060" CreationDate="2015-06-10T08:05:17.703" Score="4" Body="&lt;p&gt;If you wanted to do this without having to write your own plugin, you can achieve this with a simple custom route and an extra parameter in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your hidden fields could look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;schedule/{id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in &lt;code&gt;config/routes.php&lt;/code&gt; put&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'schedule/(?P&amp;lt;id&amp;gt;\d+)' =&amp;gt; 'scheduleTemplate',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When craft saves the entry, it will redirect you to &lt;code&gt;schedule&lt;/code&gt; with the ID of the entry that was just saved as the last segment. The custom route will pick up any digit on the end of the url and assign it to a variable called &lt;code&gt;id&lt;/code&gt; which you can then use in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some behind the scenes clearance, based on your comment&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No they aren't twig variables as the replacement is doing through php (although apparently you can use Twig tags).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you save an entry the new entry object gets passed in &lt;code&gt;redirectToPostedUrl&lt;/code&gt; which, if there is an object passed will call the function &lt;code&gt;renderObjectTemplate&lt;/code&gt; in the templates service, this will swap out any &lt;code&gt;{single}&lt;/code&gt; or &lt;code&gt;{{twig}}&lt;/code&gt; tags with the appropriate attribute and you will get the finished URL returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two links to the class reference so you can see what I mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/BaseController#redirectToPostedUrl-detail&quot; rel=&quot;nofollow&quot;&gt;The &lt;code&gt;redirectToPostedUrl&lt;/code&gt; function&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#renderObjectTemplate-detail&quot; rel=&quot;nofollow&quot;&gt;The &lt;code&gt;renderObjectTemplate&lt;/code&gt; function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-06-12T16:20:27.687" LastActivityDate="2015-06-12T16:20:27.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10083" PostTypeId="2" ParentId="10080" CreationDate="2015-06-10T08:40:16.867" Score="4" Body="&lt;p&gt;Everything you need to know is in the &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;Relations&lt;/a&gt; part of the official documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You essentially want to add an &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries&lt;/a&gt; field to your &lt;code&gt;Courses&lt;/code&gt; channel and then when you set it up pick &lt;code&gt;Instructors&lt;/code&gt; as the source. If you only want to pick one instructor, just set the &lt;code&gt;limit&lt;/code&gt; to 1. How you then use this in the templates can be found &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields#templating&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2015-06-10T11:46:13.320" LastActivityDate="2015-06-10T11:46:13.320" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10084" PostTypeId="2" ParentId="9724" CreationDate="2015-06-10T09:20:07.480" Score="2" Body="&lt;p&gt;I think you want to have the same result as with an ElementCriteriaModel, instead of getting an ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to do is mimic &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;findElements()&lt;/code&gt;, and put your own &lt;code&gt;$query&lt;/code&gt; in it. This will more or less put the results in their models. You can just copy this function and replace the second line (where &lt;code&gt;$query&lt;/code&gt; is defined) with your logics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also do something like &lt;code&gt;Conference_SessionModel::populateModels($queryResult)&lt;/code&gt;, but by the way Craft joins the content table in findElements this would be rather slow, as it would make a new query for every content field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be really nice is if you could specify &lt;code&gt;$query&lt;/code&gt; in findElements, too bad Craft doesn't support this (yet?)&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="57" LastEditDate="2015-06-10T18:48:09.357" LastActivityDate="2015-06-10T18:48:09.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10085" PostTypeId="1" CreationDate="2015-06-10T09:30:17.863" Score="2" ViewCount="169" Body="&lt;p&gt;I have a plugin that has an onBeforeSaveUser event. This fires the mailchimpsubscribe plugin to subscribe users to selected newsletters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works correctly the user is subscribed and then the saveUser function saves the users newsletter preferences to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now trying to get it to work with an ajax call, which again works correctly and subscribes the user to mailchimp. However after sending the json response it does not appear that the saveUser function is being fired as nothing is updated in the database for the selections made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could the ajax be stopping the saveUser from being fired?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ajax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the post data&#xA;var data = $(this).serialize();&#xA;&#xA;// Send it to the server&#xA;$.post('/', data, function (response) {&#xA;&#xA;    if (response.success) {&#xA;      $form.parents('.question-box').fadeOut(function () {&#xA;        $(this).remove();&#xA;        $('.question-box').first().fadeIn();&#xA;      });&#xA;    } else {&#xA;        var message = response.message;&#xA;      alert('Unfortunately, we were unable to save your data at this point. Please try again later.'+message);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Mailchimp Plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($api-&amp;gt;errorCode) { // an api error occured &#xA;&#xA;      // Respond appropriately to Ajax Requests.....&#xA;&#xA;} else { // list subscribe was successful&#xA;&#xA;      // Respond appropriately to Ajax Requests&#xA;      if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest())&#xA;      {&#xA;        return $this-&amp;gt;returnJson(array(&#xA;          'success' =&amp;gt; true,&#xA;          'errorCode' =&amp;gt; 1,&#xA;          'values' =&amp;gt; array(&#xA;            'email' =&amp;gt; $email,&#xA;            'vars' =&amp;gt; $vars&#xA;          )&#xA;        ));&#xA;      }&#xA;&#xA;      //..... &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-06-10T09:55:17.593" LastActivityDate="2015-06-10T14:18:17.047" Title="ajax call breaking onBeforeSaveUser" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;events&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10086" PostTypeId="1" AcceptedAnswerId="10092" CreationDate="2015-06-10T12:45:45.820" Score="4" ViewCount="1297" Body="&lt;p&gt;We would like to geolocate visitor IP addresses, and for US-based addresses render a portion of the page to display state-specific options. I actually have the PHP working well to pull the 2-letter state value from a Geocoding API, but am wondering the best way to plug that into Craft PRO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming the logic should look something like this in the end:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check user for geo-cookie.&lt;/li&gt;&#xA;&lt;li&gt;If not present, geolocate the user with their 2-letter abbreviation and set the geo-cookie.&lt;/li&gt;&#xA;&lt;li&gt;If present, read the geo-cookie.&lt;/li&gt;&#xA;&lt;li&gt;With that value in hand, render page elements accordingly, using the 2-letter abbreviation as a filter. If the user has no 2-letter value (perhaps an international user), present some fall-back &quot;default&quot; content in those areas of the page. (And yes, I am well aware that these services aren't 100% accurate but some providers are fairly close and we can live with that.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have found &lt;a href=&quot;https://github.com/khalwat/cookies/&quot; rel=&quot;noreferrer&quot;&gt;Khalwat's cookie plugin for Craft&lt;/a&gt;, which looks like it should suit nicely. But as a newbie to both Craft and Twig, how do I now bring it all together? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;OR&lt;/strong&gt; should we just adapt Craft PRO's localization options for this instead, since it's built in? And if so, how would we pass the 2-letter value along to use that?&lt;/p&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="3729" LastEditDate="2015-06-10T12:51:18.077" LastActivityDate="2015-06-15T14:06:09.443" Title="Change page elements based on geolocation" Tags="&lt;plugins&gt;&lt;localization&gt;&lt;cookies&gt;&lt;craft-pro&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10087" PostTypeId="1" AcceptedAnswerId="10089" CreationDate="2015-06-10T13:29:57.927" Score="2" ViewCount="943" Body="&lt;p&gt;I've set up a site with SSL, and finally got everything to load over https as well in the CP. But now I'm getting an error when trying to log in. When I look at the logs it says that the username cannot be blank. Which is weird, since I filled it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also seeing the &lt;code&gt;insecure&lt;/code&gt; symbol on the login button. But not sure why it's there.&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-06-10T16:40:25.747" Title="cp login over https gives error" Tags="&lt;login&gt;&lt;https&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10088" PostTypeId="2" ParentId="10085" CreationDate="2015-06-10T14:18:17.047" Score="3" Body="&lt;p&gt;Had a response from Pixel &amp;amp; Tonic on this. Which explains the process.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The problem you're seeing is caused by returnJson() as that also ends the process after outputting the JSON data. Most likely onSaveUser (without Before) is a better place for this code; that ensures the user has been saved to the database before running the event code.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-06-10T14:18:17.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10089" PostTypeId="2" ParentId="10087" CreationDate="2015-06-10T16:40:25.747" Score="5" Body="&lt;p&gt;This could be a couple things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Server config&lt;/li&gt;&#xA;&lt;li&gt;.htaccess file&lt;/li&gt;&#xA;&lt;li&gt;SSL Certificate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But it sounds to me like the insecure login button means those assets are not being served over SSL. How'd you confirm the site is served over https?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's control panel resources are not actually in the document root so what's happening is Craft's controller (index.php) is handling those would-be 404 requests and spitting out the cp resource in question from the backend via php.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Server Config&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you can access a static file over https in the document root (say something like &lt;code&gt;https://yoursite.com/images/sitelogo.png&lt;/code&gt; or your main CSS file) and your browser is showing the padlock and not an error, that means your virtual host is setup correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the first thing I'd rule out. If you're not getting your browser's padlock on a simple request like that, your SSL setup needs tweaking, probably a bad virtual host config. For good measure, most certs allow www- and non www so check www.yoursite.com as well. (It's easy to forget to put in a &lt;code&gt;ServerAlias&lt;/code&gt; in the VirtualHost block to handle both hostnames and then try to access the site and wonder what's going on, I've done it!)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;.htaccess&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Another source of trouble could be if you have some additional rewrite rules in your .htaccess file. A common one is to rewrite from &lt;code&gt;www.sitename.com&lt;/code&gt; to &lt;code&gt;sitename.com&lt;/code&gt; or vice versa for example—that could actually be redirecting to the insecure resource instead of over SSL, depending on your rewrite rules. So Craft wouldn't actually be serving your site over SSL because your rules would always say to rewrite the request to an insecure resource.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;SSL Certificate&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Browsers can do weird things if you your SSL cert is not installed correctly.  I like &lt;a href=&quot;https://ssltools.websecurity.symantec.com/checker/views/certCheck.jsp&quot;&gt;Symantec's SSL checker&lt;/a&gt; for this sort of thing. If you're using domain based validation, like the regular comodo or geotrust certs, some of them require additional &quot;chained&quot; or intermediate certificates to work correctly. Besides checking your server config and certificate, that checker will also make sure the chain of trust is in the right &quot;order&quot;. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-06-10T16:40:25.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10090" PostTypeId="1" AcceptedAnswerId="10099" CreationDate="2015-06-10T16:44:30.653" Score="2" ViewCount="1518" Body="&lt;p&gt;I have a single that has 5 banner images. I would like to load a different image each time the page loads. I want to do this with twig not JS, is this possible if so could somone point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance &lt;/p&gt;&#xA;" OwnerUserId="3398" LastActivityDate="2020-02-21T11:10:32.237" Title="Load an asset at random each page load" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10091" PostTypeId="1" AcceptedAnswerId="10103" CreationDate="2015-06-10T16:48:30.267" Score="1" ViewCount="71" Body="&lt;p&gt;We're using Craft CMS (pro) across multiple application servers and using reddis to manage the sessions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're needing to click on 'log-out' twice, sometimes several times before it actually logs us out of the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what could be causing this?&lt;/p&gt;&#xA;" OwnerUserId="3731" LastActivityDate="2015-06-10T18:55:56.883" Title="Mutliple logouts required on Multiple App Servers" Tags="&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10092" PostTypeId="2" ParentId="10086" CreationDate="2015-06-10T17:13:10.707" Score="4" Body="&lt;p&gt;Let's get the easy question out of the way first... Don't use Craft's localization to handle this task. While the localization feature is amazing and powerful, it doesn't fit the needs you're describing. Localization is mainly geared towards handling &lt;em&gt;different languages&lt;/em&gt; for &lt;em&gt;different countries&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's the best way to handle this? Fortunately, it sounds like you've already worked out the hard part:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I actually have the PHP working well to pull the 2-letter state value from a Geocoding API&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All that's left now is to integrate that business logic into your Craft site! There are a few different ways to approach this, but I'll lay it out in a way that's simple, straightforward, and &lt;em&gt;best fits your current scenario&lt;/em&gt;...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Grab and install the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic plugin&lt;/a&gt; (unless you've already got a custom plugin installed, in which case you can just build on that).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new function in the &lt;strong&gt;Variable&lt;/strong&gt; file. Let's name it something like &lt;code&gt;detectState&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Put all of your existing PHP logic into that function. You can even &lt;strong&gt;get, set, and check your cookies&lt;/strong&gt; straight from this function. Using a separate cookie plugin may not even be necessary in this situation, since it's easy to manage cookies directly from PHP.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have your function return the 2-letter state code.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Twig, you'd call your new function similarly to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stateCode = craft.businessLogic.detectState %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Voila! You can now use &lt;code&gt;stateCode&lt;/code&gt; to handle whatever Twig switching logic you need.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-10T17:13:10.707" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10093" PostTypeId="2" ParentId="10086" CreationDate="2015-06-10T17:13:20.033" Score="3" Body="&lt;p&gt;I think that you've outlined the process perfectly. To put the pieces together I would suggest that you create a small plugin (perhaps using the trusty &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;BusinessLogic plugin&lt;/a&gt; as a starting point). To communicate with your plugin, add a 'template variable' method to your plugin's variables file, and your geolocation php. For more info see the docs on &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your template first renders, check for your geo-cookie and assign it to a variable. If the cookie doesn't exist then perform the 'geolocation' using your plugin's template variable method (i.e. 'geoCode'), and set the cookie (i.e. 'myGeoCookie').&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if getCookie('myGeoCookie') %}&#xA;    {% set geoCode = getCookie('myGeoCookie') %}&#xA;{% else %}&#xA;    {% set geoCode = craft.businessLogic.geoCode %}&#xA;    {% 'myGeoCookie'|setCookie(geoCode, now | date_modify(&quot;+120 days&quot;).timestamp ) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin's template variable 'geoCode' method you can either perform your geolocation lookup directly and return the resulting 2 letter code, or use it as a wrapper to call a corresponding 'service' method which then passes back the result to the variable, which then returns it to the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function geoCode()&#xA;{&#xA;    // perform lookup&#xA;    return geoCode;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now with the 'geoCode' variable in your template, you can use it to lookup and display the state specific content from your 'states' section in craft (i.e. called 'stateContent' or whatever you want to call it), which also has a corresponding 'geoCode' field or other identifying attribute (i.e. title). Otherwise display your default content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if geocode %}&#xA;    {% set stateEntry = craft.entries.section('stateContent').geoCode(geoCode).first() %}&#xA;    {{ stateEntry.body }}&#xA;{% else %}&#xA;    {% otherwise display default content %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not tested. But should be a good starting point.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-06-10T17:31:34.790" LastActivityDate="2015-06-10T17:31:34.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10094" PostTypeId="1" AcceptedAnswerId="10098" CreationDate="2015-06-10T17:33:22.677" Score="2" ViewCount="3925" Body="&lt;p&gt;Is there a way—using Twig—to check if a variable is set based on a string of the same name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example below, &lt;code&gt;editLink.object&lt;/code&gt; is a string with the value of &quot;entryAlias&quot;. I want to check to see if a variable, &lt;code&gt;entryAlias&lt;/code&gt;, has been set and to see if it's an entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if &quot;#{editLink.object}&quot; is same as(editLink.object) %}&#xA;    it workes&#xA;{% else %}&#xA;    not so much&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've looked into &lt;code&gt;same as&lt;/code&gt; and &lt;code&gt;is&lt;/code&gt;, but I think the problem I'm having is converting the string to an object. Also, I'm pretty sure this can just be done using PHP, but I'd like to see if it can be done within Craft's Twig so this can be cached as part of a template.&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2015-06-10T18:41:18.530" Title="Checking for an object, based on a string, using Twig" Tags="&lt;templating&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10095" PostTypeId="2" ParentId="9656" CreationDate="2015-06-10T18:11:35.720" Score="3" Body="&lt;p&gt;I got the same error and started debugging with XDebug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put some hours in this and my conclusion is: You can't run Craft on GAE. It gets worse: You can't even run Yii1 (the framework Craft was built on) on GAE. So that's where it stops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did manage to get Craft running on a GAE development server instance, but to do that I had to uncomment every filesystem check in both Craft and Yii (functions like is_dir(), etc). These functions don't even work with the gs:// wrapper.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-10T18:11:35.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10096" PostTypeId="1" AcceptedAnswerId="10097" CreationDate="2015-06-10T18:21:20.797" Score="1" ViewCount="481" Body="&lt;p&gt;I'm getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unexpected end of template. Twig was looking for the following tags &quot;case&quot;, &quot;default&quot;, or &quot;endswitch&quot; to close the &quot;switch&quot; block started at line 11)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the contents of my _macros template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set backgrounds = {&#xA;    white: { class: &quot;white-bg&quot;, value: &quot;White&quot; },&#xA;    grey: { class: &quot;grey-bg&quot;, value: &quot;Grey&quot; },&#xA;    black: { class: &quot;black-bg&quot;, value: &quot;Black&quot; },&#xA;    highlight: { class: &quot;highlight-bg&quot;, value: &quot;Highlight&quot; },&#xA;    base: { class: &quot;base-bg&quot;, value: &quot;Base&quot; }&#xA;    }&#xA;%}&#xA;&#xA;{% macro backgrounds(backgrounds, fieldName) %}&#xA;    {% switch fieldName %}&#xA;        {% for background in backgrounds %}&#xA;            {% case &quot;{{ background.value }}&quot; %}&#xA;                {{ background.class }}&#xA;        {% endfor %}&#xA;    {% endswitch %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is my template that is throwing the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros' as siteMacros %}&#xA;&amp;lt;section class=&quot;content-35&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;content-35-customPager&quot;&amp;gt;&#xA;        &amp;lt;li class=&quot;menuicon&quot;&amp;gt;&#xA;            &amp;lt;span aria-hidden=&quot;true&quot; class=&quot;fui-list&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% for slide in block.slides %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a {% if loop.first %}class=&quot;active&quot;{% endif %} data-slide-index=&quot;{{ loop.index0 }}&quot;&amp;gt;&#xA;                {{ slide.slideTitle }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;ul class=&quot;content-35-slider&quot;&amp;gt;&#xA;        {% for slide in block.slides %}&#xA;            &amp;lt;li class=&quot;&#xA;            content-35-slider-item &#xA;            {{ siteMacros.backgrounds(backgrounds, slide.backgroundColor ) }}&#xA;            &quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;background landscape&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;col-sm-4&quot;&amp;gt;&#xA;                                &amp;lt;div&amp;gt;&#xA;                                    {% for image in slide.slideImage %}&#xA;                                        &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;&quot;&amp;gt;&#xA;                                    {% endfor %}&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;col-sm-5 col-sm-offset-5&quot;&amp;gt;&#xA;                            {% if slide.heading|length %}&#xA;                                &amp;lt;h2&amp;gt;&#xA;                                    {{ slide.heading }}&#xA;                                &amp;lt;/h2&amp;gt;&#xA;                            {% endif %}&#xA;                            {% if slide.intro|length %}&#xA;                                {{ slide.intro|replace({'&amp;lt;p&amp;gt;' : '&amp;lt;p class=&quot;lead&quot;&amp;gt;'})| raw }}&#xA;                            {% endif %}&#xA;                            {% if slide.text|length %}&#xA;                                {{ slide.text }}&#xA;                            {% endif %}&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field slide.backgroundColor is a dropdown with all the values that are also listed in the Set for the backgrounds. Any help would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-06-10T18:26:35.743" Title="Switch in a Macro" Tags="&lt;macro&gt;&lt;switch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10097" PostTypeId="2" ParentId="10096" CreationDate="2015-06-10T18:26:35.743" Score="3" Body="&lt;p&gt;You can't nest a for loop within a &lt;code&gt;switch&lt;/code&gt;, but outside of a &lt;code&gt;case&lt;/code&gt;. Try this for brevity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro backgrounds(backgrounds, fieldName) %}&#xA;    {% for background in backgrounds %}&#xA;        {{ fieldName == background.value ? background.class : '' }}&#xA;    {% endfor %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, your backgrounds array won't work sitting in the macro file. It needs to be either in the template, or included in from another template.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-06-10T18:26:35.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10098" PostTypeId="2" ParentId="10094" CreationDate="2015-06-10T18:31:29.607" Score="2" Body="&lt;p&gt;I don't think &lt;code&gt;same as&lt;/code&gt; is what you're looking for in this case. Try the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;Twig &lt;code&gt;attribute&lt;/code&gt; function&lt;/a&gt; instead...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're dealing with the global scope, it would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(_context, 'myVariable') is defined ? 'Variable exists' : 'Variable does not exist' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can always use &lt;code&gt;_context&lt;/code&gt; to reference your current scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're testing to see if an object/array &lt;strong&gt;contains&lt;/strong&gt; a property, it's practically identical:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(myObject, 'myProperty') is defined ? 'Property exists' : 'Property does not exist' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Building off of that...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;attribute(x, y) is defined&lt;/code&gt; will return a boolean, whether or not it exists.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{% set value = attribute(x, y) %}&lt;/code&gt; will return the value (assuming it exists).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-10T18:31:29.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10099" PostTypeId="2" ParentId="10090" CreationDate="2015-06-10T18:35:13.433" Score="5" Body="&lt;p&gt;Simply using &lt;code&gt;'RAND()'&lt;/code&gt; in the order parameter does the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.banner.limit(1).order('RAND()') %}&#xA;  {{ image.url }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2015-06-10T18:35:13.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10100" PostTypeId="2" ParentId="10094" CreationDate="2015-06-10T18:41:18.530" Score="3" Body="&lt;p&gt;After a Slack conversation with @carlcs, we discovered another slick solution...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'myVariable' in _context|keys }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;in&lt;/code&gt; operator&lt;/a&gt; works much like PHP's &lt;code&gt;in_array&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/keys.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;keys&lt;/code&gt; filter&lt;/a&gt; works just like PHP's &lt;code&gt;array_keys&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-10T18:41:18.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10101" PostTypeId="1" CreationDate="2015-06-10T18:48:46.807" Score="2" ViewCount="1334" Body="&lt;p&gt;This answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9081/how-to-filter-entries-by-clicking-multiple-categories-on-front-end&quot;&gt;here&lt;/a&gt; helped me get multiple same-name parameters to filter entries: &#xA;(ex: &lt;code&gt;?recipe=healthy&amp;amp;recipe=salad&amp;amp;recipe=dinner&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm looking for a way to get multiple &lt;em&gt;different&lt;/em&gt; parameters to help sort entries on the front-end. Something like:&lt;br&gt;&#xA;&lt;code&gt;?collection=healthy&amp;amp;ingredient=salad&amp;amp;meal=dinner&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I have now is this (pretty much verbatim what came from the answer linked above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get search parameters from the URL query string #}&#xA;{% set collectionQuery = craft.request.getParam('collection') %}&#xA;&#xA;{# Start an array of search parameters (relationParam) with 'and' to match ALL categories #}&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{# Find categories that match the slugs in your query string... #}&#xA;{% for querySlug in collectionQuery %}&#xA;  {% set collectionCategory = craft.categories.group('recipes').slug(querySlug) %}&#xA;&#xA;  {# And merge them into the relationParam array. #}&#xA;  {% set relationParam = relationParam|merge({targetElement: collectionCategory}) %}&#xA;{% endfor %}&#xA;&#xA;{# Avoid passing an array with `['and']` only #}&#xA;{% if relationParam|length &amp;lt; 2 %}&#xA;  {% set relationParam = '' %}&#xA;{% endif %}&#xA;&#xA;{% set searchParams = {&#xA;  relatedTo:  relationParam,&#xA;  section: 'generalContent',&#xA;  type: 'recipes'&#xA;} %}&#xA;&#xA;&amp;lt;form action=&quot;/recipes&quot;&amp;gt;&#xA;  {% for category in craft.categories.group('recipes').level('1') %}&#xA;    &amp;lt;div style=&quot;display: inline-block;&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;{{ category.slug }}[]&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;      &amp;lt;option name=&quot;{{ category.slug }}[]&quot; value=&quot;&quot;&amp;gt;Any {{ category.title }}&amp;lt;/option&amp;gt;&#xA;&#xA;      {% for categoryChild in category.children() %}&#xA;        &amp;lt;option name=&quot;{{ category.slug }}[]&quot; value=&quot;{{ categoryChild.slug }}&quot;{{ categoryChild.slug in collectionQuery  ? 'selected'}}&amp;gt;{{ categoryChild.title }}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% paginate craft.entries(searchParams) as entries %}&#xA;    ...&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-06-15T22:10:23.370" Title="Filtering entries by multiple URL parameters on the front end" Tags="&lt;filter&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10102" PostTypeId="2" ParentId="10091" CreationDate="2015-06-10T18:52:35.193" Score="0" Body="&lt;p&gt;It sounds like the PHP session file isn't being removed from Reddis when you click logout the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing I'd do is, after clicking logout one time, query Reddis to see if that file still exists in memory.  If it does, there is probably some other configuration issue causing it from being deleted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-10T18:52:35.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10103" PostTypeId="2" ParentId="10091" CreationDate="2015-06-10T18:55:56.883" Score="3" Body="&lt;p&gt;It sounds like your sessions are not being sticky. How many servers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you having to login multiple times as well to get things done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from what Brad mentioned, couple things I'd try if you haven't already:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set an &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#appId&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;appId&lt;/code&gt;&lt;/a&gt; in the config settings. You didn't mention AWS but setting an appId seems to have &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9617/sessions-being-read-inconsistently/9723#9723&quot;&gt;solved it&lt;/a&gt; for at least one other poster using multiple servers.&lt;/li&gt;&#xA;&lt;li&gt;Set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;overridePhpSessionLocation&lt;/code&gt;&lt;/a&gt; and feed it your redis server (or auto). (It's possible Craft isn't even using Redis if it's not getting set correctly.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-10T18:55:56.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10104" PostTypeId="2" ParentId="10062" CreationDate="2015-06-10T19:18:30.597" Score="6" Body="&lt;p&gt;Putting aside Craft for a moment, it's not just Craft, you'll usually end up throwing more things on a web server as time goes by. If those scripts/apps are expecting an .htaccess file and you're using nginx, you have to do some extra work to get those rewrite rules or additional pieces of magic working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As someone who cut his teeth on Apache, I've swung both ways to being an Apache fanboy to being indifferent about it. It's the status quo and it'll really handle anything you throw at it but nginx is really the better web server these days.  It has a more saner, albeit longer learning curve when it comes to configuration, but once you get it, it's hard to look at Apache's jumble of XML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does a lot of stuff really really well, including caching and serving static files extremely quickly. And it's also the little things. You can also log different aspects much easier; Apache logs by vhost, but nginx allows you to log requests based on location or not log them at all. (For example: there's not really a great way to not log things like favicons or static files in Apache; in nginx it's just a simple &lt;code&gt;location /favicon.ico { access_log off }&lt;/code&gt; block. It also has throttling and other resource management features built in to help keep the bots and script kiddies from eating up your resources. nginx caching can help prevent knocking out your server if it becomes DOSed since it's serving up a static files (instead of tearing into php).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, on a low traffic server, you probably won't see much difference. For Apache, I use mpm_worker combined with php fpm and that seems to be working out pretty well. I'm actually in the process of putting up a new server and that one will be nginx but right now Apache is working great too.  Apache prefork's mpm tends to eat memory if you're not careful so avoid that mpm if you can, especially if you're on a VPS, because every resource it serves will have php loaded up already.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-06-10T19:37:23.947" LastActivityDate="2015-06-10T19:37:23.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10105" PostTypeId="1" AcceptedAnswerId="10182" CreationDate="2015-06-10T21:09:03.920" Score="4" ViewCount="1149" Body="&lt;p&gt;I want to use SSL (https) for my entire website which is hosted on Arcustech.  I came across two instructions, one on Craft's site which discusses forcing SSL on the CP and the other is from Arcustech's site which discusses forcing SSL on entire site.  I'm not sure if I can just use the Arcustech's version or if I need a combo because I want the CP to be SSL too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code for the two versions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Forcing SSL on CP (&lt;a href=&quot;http://buildwithcraft.com/help/force-ssl&quot; rel=&quot;nofollow&quot;&gt;direct link&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Force SSL for CP requests&#xA;RewriteCond %{HTTP_HOST} example\.com [NC]&#xA;RewriteCond %{REQUEST_URI} ^/admin/ [NC]&#xA;RewriteCond %{HTTPS} !=on&#xA;RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arcustech Forcing SSL for entire site&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !^https&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lori&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-10-26T00:37:52.860" Title="Using SSL for entire website on Arcustech server" Tags="&lt;htaccess&gt;&lt;ssl&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10106" PostTypeId="2" ParentId="10105" CreationDate="2015-06-10T22:02:46.903" Score="3" Body="&lt;p&gt;The second one will force SSL no matter which page you're on, including any control panel requests, which is what you're after. As mentioned in the docs, make sure that goes above Craft's default rewrite code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only other thing you'll want to do is change the site URL in Craft itself; you can do that in &lt;code&gt;Settings -&amp;gt; General&lt;/code&gt; so Craft knows to spit out secure versions of any links or assets in your site, otherwise your visitors be redirecting from non SSL to SSL with every link (which will slow your server down and potentiallly confuse google).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RRnyB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, Arcustech's config didn't work for me, probably difference in server setups since I don't host with them, but I usually use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On &#xA;RewriteCond %{SERVER_PORT} 80 &#xA;RewriteRule ^(.*)$ https://yoursite.com/$1 [R,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That basically means if it's on port 80 (non SSL), redirect to the secure version.  Use whichever works for you.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-06-10T22:02:46.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10107" PostTypeId="1" AcceptedAnswerId="10109" CreationDate="2015-06-11T07:22:44.773" Score="1" ViewCount="774" Body="&lt;p&gt;I'm trying to learn how to add and delete records using Active Record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$instance = new Calendar37Record;&#xA;$instance-&amp;gt;timestr = $timestr;&#xA;$success = $instance-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given that I know the id of the record to delete, is the process to find the record and then delete it? Or can you just delete it?  I tried this, but it doesn't seem to find the record, and it complains 'The active record cannot be deleted because it is new.':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$instance = new Calendar37Record;&#xA;$instance-&amp;gt;findByPk($id); &#xA;$success = $instance-&amp;gt;delete(); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-06-11T08:43:04.050" Title="How to find and delete with Active Record" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10108" PostTypeId="1" AcceptedAnswerId="10112" CreationDate="2015-06-11T07:23:50.973" Score="1" ViewCount="67" Body="&lt;p&gt;I have a check box field called &lt;code&gt;requiredPrograms&lt;/code&gt;, in it it has a selection of programs you can choose from. This is within a matrix field called &lt;code&gt;Work shop Instructor&lt;/code&gt; which is for my workshop channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my outside workshop page I'd like to display what programs are required for all the teachers at the workshop in the one spot. On the inner page they would be broken into separate programs per instructor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done the inner page with no issue but I cannot figure out a way to do the outer one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.workshopInstructor[0] and entry.workshopInstructor[1] %}&#xA;   {% if block.requiredPrograms.contains('Photoshop')%}&#xA;      &amp;lt;p&amp;gt;Foo&amp;lt;/p&amp;gt;&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is my current attempt but this results in nothing being displayed and other attempts have only produced the output twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="142" LastEditDate="2015-06-11T16:26:22.957" LastActivityDate="2015-06-11T16:26:22.957" Title="Is it possible to combine information from two blocks from a matrix to an if function?" Tags="&lt;matrix&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10109" PostTypeId="2" ParentId="10107" CreationDate="2015-06-11T08:43:04.050" Score="4" Body="&lt;p&gt;Have you tried  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$instance = new Calendar37Record;&#xA;$instance-&amp;gt;deleteByPk($id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-11T08:43:04.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10110" PostTypeId="1" AcceptedAnswerId="10111" CreationDate="2015-06-11T09:47:42.377" Score="5" ViewCount="841" Body="&lt;p&gt;My usual development process is to build the site locally, then upload on a staging subdomain for client reviews, going back and fourth between the two environments for updates, before deploying it on its live environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand you can use the one licence key on multiple environments but you can only then login to the Admin area from one of them? Which would cause me issue when I have the staging site up but I'm working between that and the dev version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively I can use Craft for 'Free' using a appropriate .dev or staging URL (eg. &lt;a href=&quot;http://staging-subdomain.mysite.com&quot;&gt;http://staging-subdomain.mysite.com&lt;/a&gt;) and then make sure the paid for license is in place on the live version. Is that correct? &lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-06-12T07:32:02.370" Title="License for multiple domains" Tags="&lt;license&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10111" PostTypeId="2" ParentId="10110" CreationDate="2015-06-11T10:04:00.077" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;From what I understand you can use the one licence key on multiple&#xA;  environments but you can only then login to the Admin area from one of&#xA;  them?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sort of – you'll be able to login everywhere, but if the license isn't valid the CP will be blocked behind a &quot;upgrade-wall&quot;, prompting you to purchase a valid license or downgrading to Personal (the free edition). The frontend will continue to function as normal, though.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Alternatively I can use Craft for 'Free' using a appropriate .dev or&#xA;  staging URL (eg. &lt;a href=&quot;http://staging-subdomain.mysite.com&quot; rel=&quot;nofollow&quot;&gt;http://staging-subdomain.mysite.com&lt;/a&gt;) and then make&#xA;  sure the paid for license is in place on the live version. Is that&#xA;  correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. From the &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You’re allowed to run a single Craft license on multiple domains (e.g.&#xA;  example.com and example.fr), so long as they’re all a part of the same&#xA;  website. In order to enforce that, Craft does have one technical&#xA;  limitation: you may only access Craft’s control panel from one public&#xA;  domain per Craft license. (There is no such restriction on non-public&#xA;  domains, though.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One of the ways Craft determines if the domain is non-public, is if the site has a dev-sounding sub domain (e.g. &lt;code&gt;dev&lt;/code&gt;, &lt;code&gt;local&lt;/code&gt;, &lt;code&gt;stage&lt;/code&gt;, or &lt;code&gt;staging&lt;/code&gt;). This means that a Client or Pro license registered to &lt;code&gt;www.mysite.com&lt;/code&gt; should also work for a staging site at &lt;code&gt;http://stage.mysite.com&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-12T07:32:02.370" LastActivityDate="2015-06-12T07:32:02.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10112" PostTypeId="2" ParentId="10108" CreationDate="2015-06-11T10:40:32.327" Score="2" Body="&lt;p&gt;The question is a little unclear, is this what you are looking for?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set requiredProgram = false %}&#xA;{% for block in entry.workshopInstructor %}&#xA;   {% if block.requiredPrograms.contains('Photoshop')%}&#xA;      {% set requiredProgram = true %}&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if requiredProgram %}&#xA;  Photoshop is enabled on one of this entry's blocks field.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2015-06-11T10:47:02.833" LastActivityDate="2015-06-11T10:47:02.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10113" PostTypeId="2" ParentId="10037" CreationDate="2015-06-11T10:44:34.810" Score="0" Body="&lt;p&gt;The same outcome could be achieved without the need to us a counter that adds a class/id at all if you use an inline style....&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homeMatrix %}&#xA;{% if block.type == &quot;homeMatrix&quot; %}&#xA;{% set oddOrEven = cycle(['even', 'odd'], loop.index0) %}&#xA;    &amp;lt;section class=&quot;section {{ oddOrEven }}&quot;&amp;gt;&#xA;        &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ block.txtTitle }}&amp;lt;/h1&amp;gt;&#xA;            {{ block.txt }}&#xA;        &amp;lt;/article&amp;gt;&#xA;    &amp;lt;/section&amp;gt;  &#xA;&#xA;    {% for image in block.image %}&#xA;    &amp;lt;section class=&quot;section&quot; style=&quot;background-image: url({{ image.getUrl() }});&quot;&amp;gt;&#xA;        &amp;lt;article class=&quot;box&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ block.imageTitle }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    &amp;lt;/section&amp;gt; &#xA;    {% endfor %}           &#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastEditorUserId="3398" LastEditDate="2015-06-11T10:54:05.180" LastActivityDate="2015-06-11T10:54:05.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10114" PostTypeId="1" AcceptedAnswerId="10122" CreationDate="2015-06-11T11:39:57.857" Score="0" ViewCount="1127" Body="&lt;p&gt;I have set up Craft on my local computer and now wish to move it online.  However, I am having some difficulty doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this method:  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1079/migrating-a-whole-website-between-craft-instances&quot;&gt;Migrating a whole website between Craft instances&lt;/a&gt;, but with no success.  By no success I mean that none of my entries, assets, fields or sections are transferred over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of transferring the database, I tried downloading it via the Settings page and uploading it via phpmyadmin.  Nothing got transferring.  I then tried downloading the database from the original site via phpmyadmin and uploading it to my new site (again via phpmyadmin, after having dumped all the tables).  Again, nothing was transferred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have tried using various plugins to transfer fields, sections and entries with partial success (but with a lot of manual work left to do).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There must be some way to easily transfer/migrate a site.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I have my entries, assets, fields and sections which I want to transfer from one site to another without having to manually set everything up again.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moshe&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADDITIONAL INFORMATION&lt;/strong&gt;&#xA;I wrote that I am ready to move the site online, but what I did was to first set up ANOTHER Craft site on my local server so that I could make sure that I got the process of transfer done properly and then transfer online.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is to that second install of Craft that I am trying to transfer my site to and which I am having no success.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, on my local (Windows) computer I have localhost/mysite1 and localhost/mysite2.  I have the site set up properly on mysite1 and am trying to transfer it to mysite2.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, on phpmyadmin I have mysitedb1 and mysitedb2.  What I have been doing is selecting mysitedb2, clicking on the Import tab and then importing the sql file.  phpmyadmin indicates that the import is successful, but nothing changes on the site itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FURTHER UPDATE&lt;/strong&gt;&#xA;I did a fresh install, made sure that the db.php file is correct and made sure to transfer ALL of the files from the craft folder.  I then downloaded a new database backup file from the settings page of my original install and imported that into the new database for the new install.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I received a message which made it seem like everything went smoothly: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Import has been successfully finished, 2080 queries executed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, when I look at the tables for the database I do not see any of the new data there.  I checked the sql file for the names of some of my entry types and they are in the file, but they do not appear in the entrytypes table (other tables also don't have any of the new data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what is going wrong?&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-06-11T21:33:57.683" Title="Can't Transfer Site" Tags="&lt;database&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10115" PostTypeId="1" CreationDate="2015-06-11T12:28:56.533" Score="0" ViewCount="481" Body="&lt;p&gt;have update craft and when uploading an SVG to Assets nothing happens? The upload bar pops up but the file is not uploaded and is not on the server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?  Thanks&lt;/p&gt;&#xA;" OwnerUserId="3744" LastActivityDate="2015-06-11T16:08:08.960" Title="Craft 2.4.2669 and SVG's?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2015-06-11T19:55:07.510" ContentLicense="CC BY-SA 3.0" />
  <row Id="10116" PostTypeId="2" ParentId="10110" CreationDate="2015-06-11T14:00:26.063" Score="4" Body="&lt;p&gt;Alternative for your local site is to create something like &lt;code&gt;mysite.craft.dev&lt;/code&gt; and that will allow you in Pro mode permanently.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-06-11T14:00:26.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10117" PostTypeId="1" AcceptedAnswerId="10181" CreationDate="2015-06-11T15:15:55.777" Score="3" ViewCount="130" Body="&lt;p&gt;I've created my first new &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;ElementType&lt;/a&gt; based on the &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow&quot;&gt;Events example&lt;/a&gt;. The only thing which doesn't seem to be working is the search bar above the listing in the CP. When I type anything into it I just get a blank results returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it's something to do with me not using &lt;code&gt;Titles&lt;/code&gt;, I'm using a property on the Model called &lt;code&gt;name&lt;/code&gt; instead. I had to override the &lt;code&gt;__toString&lt;/code&gt; method in the model to get it to populate the first column in the listing, so I'm guessing there is some way to also overriding what is used by default for the search as well. Is that the case, and if so how do it do it? &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-06-16T09:05:41.180" Title="Filtering list in CP index page for new ElementType" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10118" PostTypeId="2" ParentId="10114" CreationDate="2015-06-11T15:43:14.763" Score="2" Body="&lt;p&gt;As an aside from what Phil mentioned, change your &lt;code&gt;craft/config/db.php&lt;/code&gt; file to point to the online server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, make sure there is actually an instance of phpmyadmin on your remote server and you're uploading to it.  I've made this mistake before... (For example: if there's too many phpmyadmin windows/tabs floating around and you upload  the database to the testing server instead of the new one... it'll drive you crazy!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically there's 2 parts to every Craft install: the database and the file system. Craft's &lt;code&gt;db.php&lt;/code&gt; lets it know where to find the database information so when you move an install from another server (or 2 another database, in this case), you'll need to let Craft in on the new information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you transfer an existing Craft installation to a new server, make sure everything in the &lt;code&gt;craft&lt;/code&gt; folder also goes along for the ride (especially the &lt;code&gt;plugins&lt;/code&gt; and &lt;code&gt;templates&lt;/code&gt; folders).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you get the basics down, a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#adding-multi-environment-configs-to-db-php&quot; rel=&quot;nofollow&quot;&gt;multi environment config&lt;/a&gt; can save you some hassle later on when it's time to move the site. (Hat tip: Lindsey D.)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-06-11T17:46:53.300" LastActivityDate="2015-06-11T17:46:53.300" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="10119" PostTypeId="1" AcceptedAnswerId="10131" CreationDate="2015-06-11T15:48:51.923" Score="0" ViewCount="356" Body="&lt;p&gt;I am setting up a photo gallery and below is what I have right now. My problem is when I go the next page /2 it says that entry does not exist. I have routes set up as /gallery/slug/*, and pointing to this template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to paginate images like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% paginate entry.images.limit(20) as imagesOnPage %}&#xA;  {% for image in imagesOnPage %}&#xA;    &amp;lt;div class=&quot;thumb col-1-4&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ image.getUrl() }}&quot; data-fresco-group=&quot;{{ entry.id }}&quot; data-fresco-caption=&quot;{{ image.title }}&quot; title=&quot;{{ image.title }}&quot; class=&quot;fresco&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('galleryThumbnail') }}&quot; title=&quot;{{ image.title }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;          &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;    {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;prev&quot;&amp;gt;◄&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;    {% for page, url in paginate.getPrevUrls(5) %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;span class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;    {% for page, url in paginate.getNextUrls(5)  %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;page-numbers&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;next&quot;&amp;gt;►&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3652" LastActivityDate="2015-06-12T06:54:28.950" Title="Paginate Assets" Tags="&lt;pagination&gt;&lt;gallery&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10120" PostTypeId="2" ParentId="10115" CreationDate="2015-06-11T16:08:08.960" Score="1" Body="&lt;p&gt;Check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder for the underlying error message, but most likely you're using &lt;a href=&quot;https://php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt; instead of &lt;a href=&quot;https://php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt;, which is required for SVG thumbnails/transforms to work properly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-11T16:08:08.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10121" PostTypeId="1" CreationDate="2015-06-11T21:27:39.933" Score="0" ViewCount="185" Body="&lt;p&gt;I just uploaded my website on my server and I have a problem regarding the admin area. When I arrive on the /admin page, no CSS and no JS have been loaded (after inspection, they all 404'd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to fix this like in the general config ? Thanks a lot !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The .htaccess is working (404 act differently). &lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="3696" LastEditDate="2015-06-11T22:15:26.527" LastActivityDate="2015-06-11T22:15:26.527" Title="Admin area can't load any assets" Tags="&lt;assets&gt;&lt;admin&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10122" PostTypeId="2" ParentId="10114" CreationDate="2015-06-11T21:33:57.683" Score="3" Body="&lt;p&gt;It seems that I was doing one of two things wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most likely problem is that I didn't quite understand how to transfer the database.  I was doing a new install of Craft and then uploading the database.  The right way to go is NOT to install Craft, but rather to just transfer the files and the database and Craft will then automatically be installed (thanks Lindsey D for teaching me this) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possible factor is that I had changed the Tableprefix, perhaps that was also causing a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, it's works now :).  Thanks one and all for your help.&lt;/p&gt;&#xA;" OwnerUserId="2309" LastActivityDate="2015-06-11T21:33:57.683" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10123" PostTypeId="1" AcceptedAnswerId="10257" CreationDate="2015-06-11T22:10:21.337" Score="2" ViewCount="323" Body="&lt;p&gt;Is there any way, upon creating new entries via front-end form, to &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; have all locale versions of those entries active?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’d like to think I could just set something like&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;en_us”&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2015-06-23T16:31:18.260" LastActivityDate="2015-06-23T18:26:24.780" Title="Activate correct locale upon front-end entry" Tags="&lt;entries&gt;&lt;localization&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10124" PostTypeId="2" ParentId="10119" CreationDate="2015-06-11T23:32:19.410" Score="1" Body="&lt;p&gt;The &lt;code&gt;{% paginate %}&lt;/code&gt; tag requires the ElementCriteriaModel to be passed through first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you were requesting &lt;code&gt;entry.images.limit(20)&lt;/code&gt; to be paginated, I suspect you have your images set up within a single images asset. Instead you will need to set up your images within a channel or structure if you would like Craft to paginate the gallery between several pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This hasn't been tested, although spot the differences with the inclusion of the &lt;code&gt;craft&lt;/code&gt; prefix within the ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(&quot;gallery&quot;).limit(20) as imagesOnPage %}&#xA;&#xA;    {% for entry in imagesOnPage %}&#xA;        &amp;lt;div class=&quot;thumb col-1-4&quot;&amp;gt;&#xA;&amp;lt;a href=&quot;{{ entry.image.getUrl() }}&quot; data-fresco-group=&quot;{{ entry.id }}&quot; data-fresco-caption=&quot;{{ entry.image.title }}&quot; title=&quot;{{ entry.image.title }}&quot; class=&quot;fresco&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ entry.image.getUrl('galleryThumbnail') }}&quot; title=&quot;{{ entry.image.title }}&quot; alt=&quot;{{ entry.image.title }}&quot;&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;  &amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;    {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;prev&quot;&amp;gt;◄&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;    {% for page, url in paginate.getPrevUrls(5) %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;span class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;    {% for page, url in paginate.getNextUrls(5)  %}&#xA;        &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;page-numbers&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;next&quot;&amp;gt;►&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endpaginate %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sources: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/paginate&lt;/a&gt;,&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/elementcriteriamodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3735" LastEditorUserId="3735" LastEditDate="2015-06-11T23:37:42.780" LastActivityDate="2015-06-11T23:37:42.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10125" PostTypeId="1" AcceptedAnswerId="10126" CreationDate="2015-06-12T02:26:48.933" Score="2" ViewCount="2395" Body="&lt;p&gt;I am trying to display the assets on entries. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I created the assets group.&lt;/li&gt;&#xA;&lt;li&gt;Uploaded the bunch of images to that group.&lt;/li&gt;&#xA;&lt;li&gt;Added assets to the entries. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now I didn't understood how to write a code in templates/index.html to display those images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I want to understood how to display one image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3647" LastEditorUserId="22" LastEditDate="2017-05-09T23:56:41.820" LastActivityDate="2018-03-28T16:50:09.657" Title="Displaying Image Assets to Home Entries" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10126" PostTypeId="2" ParentId="10125" CreationDate="2015-06-12T02:36:12.737" Score="4" Body="&lt;p&gt;Have you tried something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.myImageFieldHandle.first() %}&#xA;&amp;lt;img src='{{image.getUrl()}}' /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you want a specific image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.myImageFieldHandle[3] %}&#xA;&amp;lt;img src='{{image.getUrl()}}' /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-12T02:36:12.737" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10127" PostTypeId="1" CreationDate="2015-06-12T03:50:54.470" Score="5" ViewCount="1490" Body="&lt;p&gt;My question could seem obvious but I don't find the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to make a search on two fields, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('pages').search('foo:bar foo2:bar2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;search('foo:bar', 'foo2:bar4')&#xA;search('foo:bar and foo2:bar2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;none of these seem to work&lt;/p&gt;&#xA;" OwnerUserId="3747" LastActivityDate="2015-06-12T05:27:24.477" Title="multiple search" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10128" PostTypeId="1" AcceptedAnswerId="10130" CreationDate="2015-06-12T05:11:17.070" Score="4" ViewCount="233" Body="&lt;p&gt;The plugin docs are a good reference but can be a bit daunting when piecing things together, any good plugins from the community that are well commented/built etc. ? Especially in regard to elements.&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2019-04-01T17:20:26.757" Title="Best Practices for plugin development" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10129" PostTypeId="2" ParentId="10127" CreationDate="2015-06-12T05:27:24.477" Score="6" Body="&lt;p&gt;Your search syntax of &lt;code&gt;craft.entries.section('pages').search('foo:bar foo2:bar2')&lt;/code&gt; should work and is the equivalent of saying &quot;give me all of the entries in the &lt;code&gt;pages&lt;/code&gt; section where the field &lt;code&gt;foo&lt;/code&gt; is equal to &lt;code&gt;bar&lt;/code&gt; &lt;strong&gt;and&lt;/strong&gt; the field &lt;code&gt;foo2&lt;/code&gt; is equal to &lt;code&gt;bar2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something that trips people up often is that Craft doesn't do fuzzy searching by default. So &lt;code&gt;foo:bar&lt;/code&gt; will match &lt;em&gt;exactly&lt;/em&gt; &lt;code&gt;bar&lt;/code&gt;, but it will not match &lt;code&gt;bars&lt;/code&gt;.  You'd need to use &lt;code&gt;foo:bar*&lt;/code&gt; for that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-12T05:27:24.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10130" PostTypeId="2" ParentId="10128" CreationDate="2015-06-12T05:39:48.080" Score="7" Body="&lt;p&gt;Mijingo has a great video on plugin development at &lt;a href=&quot;https://mijingo.com/products/screencasts/craft-plugin-development/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mijingo.com/products/screencasts/craft-plugin-development/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside of that I'd take a look at the plugins at &lt;a href=&quot;https://straightupcraft.com/craft-plugins/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="45" LastEditDate="2019-04-01T17:20:26.757" LastActivityDate="2019-04-01T17:20:26.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10131" PostTypeId="2" ParentId="10119" CreationDate="2015-06-12T06:54:28.950" Score="0" Body="&lt;p&gt;You should actually go to /p2 - this has been a bug in some 2.4 releases, so can you tell me if you are on the latest version?&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-12T06:54:28.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10132" PostTypeId="1" AcceptedAnswerId="10152" CreationDate="2015-06-12T07:52:01.723" Score="3" ViewCount="190" Body="&lt;p&gt;It seems that something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array('calupdateResponse' =&amp;gt; $out));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;works in a Controller so that {{ calupdateResponse }} has a value, but it doesn't work in a function in a plugin's Services (no error, just no values show up in twig).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wishing that a single function in Services can output a number of variables to twig for templating. What is the most straightforward way?   Is it necessary to create a function for each one in PluginVariables.php?  Then I have many functions instead of just one.  This is for a CP page, if that makes a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a related note, is it possible for twig to instantiate a plugin's model, with access to all it's properties?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-06-13T18:09:22.517" Title="Can setRouteVariables be in Services?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10133" PostTypeId="1" AcceptedAnswerId="10146" CreationDate="2015-06-12T15:30:02.920" Score="2" ViewCount="280" Body="&lt;p&gt;I can't seem to find anywhere mentioning what the max # of versions a given entry can have--I would assume its unlimited (given unlimited DB space).&lt;/p&gt;&#xA;" OwnerUserId="3749" LastActivityDate="2018-02-21T23:44:39.963" Title="What is the max # of version history for any given entry?" Tags="&lt;entries&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10134" PostTypeId="1" AcceptedAnswerId="10136" CreationDate="2015-06-12T16:21:13.917" Score="2" ViewCount="1303" Body="&lt;p&gt;I have a Plain Text field used for product names. Some of these product names have a Registration Mark or a Trademark, which needs to be formatted within a superscript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is code within my template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ product.name | replace({'®': '&amp;lt;sup&amp;gt;®&amp;lt;/sup&amp;gt;' }) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which publishes this:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Acme ABC Widget&amp;lt;sup&amp;gt;®&amp;lt;/sup&amp;gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;When what I really want to achieve is this:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Acme ABC Widget&lt;sup&gt;®&lt;/sup&gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Does Craft persistently render Plain Text fields as raw text? I was hoping Twig filters could extend the use of Craft's Plain Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My preference is to continue using the Plain Text field to avoid additional formatting breaking the layout.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2015-12-15T19:13:37.527" Title="How do you wrap text with HTML within a Plain Text field?" Tags="&lt;templating&gt;&lt;field&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10135" PostTypeId="1" AcceptedAnswerId="10138" CreationDate="2015-06-12T16:39:41.107" Score="2" ViewCount="775" Body="&lt;p&gt;On my search results page I want to add a section filter depending on the different sections that are included in all of the returned entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting all the sections like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(['inspirationArticles', 'pages', 'pressArticles', 'products']).search(searchQuery).order('score') %}&#xA;{% set entrySections = entries.getAllSections() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then loop through them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entrySection in entrySections %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when trying to access the sections’s names or handles via &lt;code&gt;{{ entrySection.name }}&lt;/code&gt; or &lt;code&gt;{{ entrySection.handle }}&lt;/code&gt;, I get a &lt;code&gt;CException&lt;/code&gt; error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;handle&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it looks like it isn't actually accessing the SectionModel. Am I missing a step?&lt;/p&gt;&#xA;" OwnerUserId="176" LastEditorUserId="176" LastEditDate="2015-06-12T16:47:02.140" LastActivityDate="2015-06-12T17:07:36.883" Title="How do I loop through and access all sections of returned entries?" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10136" PostTypeId="2" ParentId="10134" CreationDate="2015-06-12T16:55:08.453" Score="4" Body="&lt;p&gt;You can use the &lt;code&gt;raw&lt;/code&gt; Twig filter. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ product.name | replace({'®': '&amp;lt;sup&amp;gt;®&amp;lt;/sup&amp;gt;' })|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-12T16:55:08.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10137" PostTypeId="1" CreationDate="2015-06-12T17:07:15.583" Score="15" ViewCount="4459" Body="&lt;p&gt;Does anyone know of a way to instruct PHPStorm to treat Craft templates as Twig files, without globally assigning all &lt;code&gt;.html&lt;/code&gt; files to be interpreted as Twig? Since Craft templates don't use the &lt;code&gt;.twig&lt;/code&gt; extension, PHPStorm thinks they're HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On that note, why doesn't Craft use .twig extensions? I assume P&amp;amp;T doesn't want to scare away users who are comfortable with HTML but not Twig?&lt;/p&gt;&#xA;" OwnerUserId="3750" LastActivityDate="2018-11-14T18:27:01.367" Title="Twig syntax highlighting in PHPStorm?" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10138" PostTypeId="2" ParentId="10135" CreationDate="2015-06-12T17:07:36.883" Score="4" Body="&lt;p&gt;Entries to not have a &lt;code&gt;getAllSections&lt;/code&gt; method. You can use the &lt;code&gt;group&lt;/code&gt; filter to group your entries by their sections.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(['inspirationArticles', 'pages', 'pressArticles', 'products']).search(searchQuery).order('score') %}&#xA;{% set grouped = entries|group('section') %}&#xA;&#xA;{% for section, entriesInGroup in grouped %}&#xA;    &amp;lt;h2&amp;gt;Section: {{ section }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entriesInGroup %}&#xA;            &amp;lt;li&amp;gt;{{entry}}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's some &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; to help!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-12T17:07:36.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10139" PostTypeId="1" AcceptedAnswerId="10141" CreationDate="2015-06-12T17:20:16.947" Score="3" ViewCount="4440" Body="&lt;p&gt;I've got a craft field where I have an such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Learn more about this great %Job Title% job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm then using Twig Replace to insert the actual entry.jobTitle into the %Job Title% space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But visually, I'd like to highlight the job entry. So I'm wrapping it in a span tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of the output I want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;Fantastic opportunity for a &amp;lt;span class=&quot;highlight&quot;&amp;gt;Head Chef&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So at the moment I've got it looking like this, pulling in the jobStatement (The line with %Job Title% somewhere in it):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;{{ jobs.jobStatement|replace({'%Job Title%': &quot;&amp;lt;span class='highlight'&amp;gt;&quot; ~ jobs.jobTitle ~ &quot;&amp;lt;/span&amp;gt;&quot; }) }}&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alas, when the template is rendered, it is rendering the entries as text. How can I insert the HTML span tags around the Job Title area?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-06-12T17:52:28.683" Title="Get a twig | replace to output html rather than the text" Tags="&lt;templating&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10141" PostTypeId="2" ParentId="10139" CreationDate="2015-06-12T17:52:28.683" Score="5" Body="&lt;p&gt;Try using twig's &lt;code&gt;raw&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;{{ jobs.jobStatement|replace({'%Job Title%': &quot;&amp;lt;span class='highlight'&amp;gt;&quot; ~ jobs.jobTitle ~ &quot;&amp;lt;/span&amp;gt;&quot; })|raw }}&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-06-12T17:52:28.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10142" PostTypeId="1" AcceptedAnswerId="10144" CreationDate="2015-06-12T19:14:07.900" Score="1" ViewCount="343" Body="&lt;p&gt;I'm trying to add an entry form outside CP (for users with proper permissions), using this example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but there's no mentioning of how/where to add a page/template that will house the form. One place I was able to place it is the actual template for the entry which is also used for viewing the entry, but that's not what I need. I need a separate URL pattern and separate template file. E.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysite.com/recipes/{slug}/edit&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysite.com/edit-recipes/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3745" LastEditorUserId="22" LastEditDate="2017-05-09T23:56:00.790" LastActivityDate="2017-05-09T23:56:00.790" Title="Where to place a front-end 'entry form'?" Tags="&lt;templating&gt;&lt;form&gt;&lt;url&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10143" PostTypeId="2" ParentId="10137" CreationDate="2015-06-12T19:21:49.887" Score="14" Body="&lt;p&gt;Under the PhpStorm preferences, go Editor-&gt;File Types-&gt;Twig and add &lt;code&gt;*.html&lt;/code&gt; as a Registered Pattern.&lt;img src=&quot;https://i.stack.imgur.com/WP3hz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-12T19:21:49.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10144" PostTypeId="2" ParentId="10142" CreationDate="2015-06-12T19:25:47.560" Score="0" Body="&lt;p&gt;You'd put it in your &lt;code&gt;craft/templates&lt;/code&gt; folder at something like &lt;code&gt;craft/templates/recipes/new.html&lt;/code&gt;.  Then you'd be able to load that from &lt;code&gt;http://mysite.com/recipes/new&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a good templating overview in the docs &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-12T19:25:47.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10145" PostTypeId="2" ParentId="2854" CreationDate="2015-06-12T22:28:58.240" Score="3" Body="&lt;p&gt;Here's what I did. You'll need to set &lt;code&gt;sectionId&lt;/code&gt; first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set thing = craft.sections.getSectionById(sectionId) %}&lt;/code&gt;&#xA;&lt;code&gt;{{thing.getUrlFormat()|split('/')[0]}}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3751" LastActivityDate="2015-06-12T22:28:58.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10146" PostTypeId="2" ParentId="10133" CreationDate="2015-06-13T02:51:31.183" Score="3" Body="&lt;p&gt;There is no set maximum number of versions an entry can have, assuming you have unlimited database space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the source code in the &lt;code&gt;EntryRevisionsService&lt;/code&gt; for more information: &lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/services/EntryRevisionsService.php#L148&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/services/EntryRevisionsService.php#L148&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="57" LastEditDate="2018-02-21T23:44:39.963" LastActivityDate="2018-02-21T23:44:39.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10147" PostTypeId="1" AcceptedAnswerId="10148" CreationDate="2015-06-13T03:26:08.367" Score="5" ViewCount="864" Body="&lt;p&gt;I'd like to make the Entry URL format of a channel look like this: /news/2015/06/my-slug-here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would I need to enter into the Entry URL Format field in order to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest I could manage was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/{postDate|date(&quot;Y&quot;)}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that only outputs this: /news/2015/my-slug-here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-06-13T03:45:21.783" Title="How to add year and month to Entry URL Format" Tags="&lt;url&gt;&lt;entry&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10148" PostTypeId="2" ParentId="10147" CreationDate="2015-06-13T03:45:21.783" Score="8" Body="&lt;p&gt;You're close! For the month part you need &lt;code&gt;postDate|date(&quot;m&quot;)&lt;/code&gt; (&lt;a href=&quot;http://php.net/manual/en/function.date.php&quot;&gt;this page&lt;/a&gt; has the php date formats).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/{postDate|date(&quot;Y&quot;)}/{postDate|date(&quot;m&quot;)}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-13T03:45:21.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10149" PostTypeId="1" CreationDate="2015-06-13T06:51:40.533" Score="3" ViewCount="687" Body="&lt;p&gt;Say I have a channel with a matrix field which has two block types - text and video. Is there any way to select all entries in that channel that have a video block?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Idea 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the Low Blocks plugin to query all video block types, then get their owner IDs, then use those to grab the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Idea 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a light switch field to the channel called &quot;hasVideo&quot;. Update this field programmatically using the onSave event and a plugin. Then I can select all entries if hasVideo is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-06-14T18:54:40.893" Title="How do I select entries that have a particular block type?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;block-types&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10150" PostTypeId="1" CreationDate="2015-06-13T06:51:40.420" Score="0" ViewCount="114" Body="&lt;p&gt;I moved my website from my local dev environment to my production server, but my admin assets are not resolving. I tried everything but didn't work. In fact it's probably a problem on the server side, but I cant do anything about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, is there a way to hardcode those assets in the admin pages ?&#xA;Thanks for your help !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2015-06-13T06:51:40.420" Title="Hardcoding admin assets urls" Tags="&lt;assets&gt;&lt;admin&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10151" PostTypeId="1" AcceptedAnswerId="10156" CreationDate="2015-06-13T15:13:08.987" Score="2" ViewCount="321" Body="&lt;p&gt;I have created several asset sources in craft and now i created user groups, with different view rights to this sources. When a user with restricted rights goes to the &quot;assets&quot; tab in craft, the rights management works as excepted: the user only see assets sources, where he has access to. But in redactor wysiwyg editor, using the insert image button or link to a asset function, it shows always all asset sources, even if the user has no view access to. Is there a way to restrict this list, based on users &quot;view&quot; permissions?  Maybe i missed it and there is something like a global config option (for example: restrictAssetsInRedactor = true)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i look in firebug, i see, that the modal window is called without any sources. Is there a way to modify/overwrite this call with a custom plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qtbFs.png&quot; alt=&quot;Post variables of modal window in redactor&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="3535" LastEditDate="2015-06-15T05:02:37.640" LastActivityDate="2015-06-15T17:14:02.523" Title="Restricted access to assets in Redactor" Tags="&lt;assets&gt;&lt;redactor&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10152" PostTypeId="2" ParentId="10132" CreationDate="2015-06-13T18:09:22.517" Score="4" Body="&lt;p&gt;Services are not meant for rendering templates, but for business logic, saving data, and retrieving data. The &lt;code&gt;setRouteVariables&lt;/code&gt; method should only be used in a controller to send some information to a variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use a controller to reach out to a service for some data, then use the controller to report that data back to the view for display using the &lt;code&gt;setRouteVariables&lt;/code&gt; function. You can skirt around this by using &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Variables&lt;/a&gt; to directly call services, using a separate variable for each service function.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;On a related note, is it possible for twig to instantiate a plugin's&#xA;  model, with access to all it's properties?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not directly, and this shouldn't be done. It is best practice to not have views directly instantiating models, but to have controllers and services act as the middle-men. It will help keep your code testable, reusable, and readable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Craft documentation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Generally speaking, controllers are the middlemen between the front&#xA;  end of the CP/website and your plugin’s services. They contain action&#xA;  methods which handle individual tasks.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;Services&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;All of your plugin’s business logic should go in services, including&#xA;  saving data, retrieving data, etc. They provide APIs that your&#xA;  controllers, template variables, and other plugins can interact with.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-13T18:09:22.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10153" PostTypeId="2" ParentId="9999" CreationDate="2015-06-14T14:22:20.093" Score="1" Body="&lt;p&gt;You're right, this isn't possible with setting &lt;code&gt;relatedTo&lt;/code&gt; parameters. But you can pass your ElementCriteriaModel (with all other parameters set) to the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;buildElementsQuery&lt;/code&gt;&lt;/a&gt; method, to prepare a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; object. You can now modify the query as you need (→ Craft documentation for &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;Database Queries&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand#join-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;join&lt;/code&gt;&lt;/a&gt; to bring in the &quot;matrixblocks&quot; table and also your Matrix field's content table &quot;matrixcontent_&lt;em&gt;mymatrixfield&lt;/em&gt;&quot;. Then add the min. and max age conditions with &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand#andWhere-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;andWhere&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function addAgeCriteria(ElementCriteriaModel $criteria, $age)&#xA;{&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    $params = array(&#xA;        ':age' =&amp;gt; $age&#xA;    );&#xA;&#xA;    $conditions = array('and',&#xA;        'matrixcontent_mymatrixfield.field_linkedTo_minimumAge &amp;lt;= :age',&#xA;        'matrixcontent_mymatrixfield.field_linkedTo_maximumAge &amp;gt;= :age'&#xA;    ),&#xA;&#xA;    $query-&amp;gt;andWhere($conditions, $params);&#xA;&#xA;    $query-&amp;gt;join('matrixblocks matrixblocks', 'matrixblocks.ownerId = entries.id');&#xA;    $query-&amp;gt;join('matrixcontent_mymatrixfield matrixcontent_mymatrixfield', 'matrixcontent_mymatrixfield.elementId = matrixblocks.id');&#xA;&#xA;    $results = $query-&amp;gt;queryAll();&#xA;&#xA;    return EntryModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-14T14:22:20.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10154" PostTypeId="2" ParentId="10149" CreationDate="2015-06-14T14:24:20.630" Score="2" Body="&lt;p&gt;You can write a custom plugin and make use of Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;buildElementsQuery&lt;/code&gt;&lt;/a&gt;, to be able to add &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;custom query statements&lt;/a&gt; to your ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give your plugin a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt; &lt;code&gt;addVideoBlockCriteria&lt;/code&gt; and with some lines of plugin code you will be able to do something like this from your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = craft.entries.section('blog').order('title asc') %}&#xA;{% set entries = craft.businesslogic.addVideoBlockCriteria(criteria) %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make your Template Variable pass the criteria to a plugin service, run them through &lt;code&gt;buildElementsQuery&lt;/code&gt;, and you can now modify the query with some &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommands&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addVideoBlockCriteria(ElementCriteriaModel $criteria)&#xA;{&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    $query-&amp;gt;andWhere('matrixcontent_article.field_video_videoUrl is not null');&#xA;&#xA;    $query-&amp;gt;join('matrixblocks matrixblocks', 'matrixblocks.ownerId = entries.id');&#xA;    $query-&amp;gt;join('matrixcontent_article matrixcontent_article', 'matrixcontent_article.elementId = matrixblocks.id');&#xA;&#xA;    $results = $query-&amp;gt;queryAll();&#xA;&#xA;    return EntryModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;join&lt;/code&gt; to bring in the &quot;matrixblocks&quot; table and also your Matrix field's content table &quot;matrixcontent_&lt;em&gt;mymatrixfield&lt;/em&gt;&quot;. And add the conditions with &lt;code&gt;andWhere&lt;/code&gt;;  the Matrix field's fields column names follow a scheme &quot;field_&lt;em&gt;myMatrixBlockType&lt;/em&gt;_&lt;em&gt;myFieldInMatrixBlock&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-14T14:24:20.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10155" PostTypeId="2" ParentId="10149" CreationDate="2015-06-14T18:54:40.893" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Idea 2 [...] Add a light switch field to the channel called &quot;hasVideo&quot;. Update this field programmatically using the onSave event and a plugin. Then I can select all entries if hasVideo is true.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you're going to write your own plugin I would encourage you to implement carlcs' solution, which is a solid one, rather than going for what is basically a hack.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you do decide to use &lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow&quot;&gt;Low Blocks&lt;/a&gt; instead and do the heavy lifting in your template, here's how that could work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get blocks, using the field ID, filtering by block type #}&#xA;{% set blocks = craft.lowblocks.blocks.fieldId(22).type('video') %}&#xA;&#xA;{# Get entry IDs #}&#xA;{% set entryIds = [] %}&#xA;{% for block in blocks %}&#xA;    {% set entryId = block.owner.id %}&#xA;    {% set entryIds = entryIds|merge([entryId]) %}&#xA;{% endfor %}&#xA;&#xA;{# Get entries #}&#xA;{% set entries = craft.entries({ id : entryIds }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not super elegant, but it should work. Personally I'm a big fan of keeping templates as logic-free and simple as possible, so I'd probably go for carlcs' solution, myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Be sure to switch out the number &lt;code&gt;22&lt;/code&gt; in my example Twig for the actual ID of your Matrix field.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-14T18:54:40.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10156" PostTypeId="2" ParentId="10151" CreationDate="2015-06-15T02:33:46.070" Score="3" Body="&lt;p&gt;There is no native way to limit which sources appear in the asset window. I imagine it can be accomplished with a custom field type. This would be a great feature for future releases; I recommend adding it to the &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;Feature Requests forum&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-15T02:33:46.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10158" PostTypeId="1" AcceptedAnswerId="10168" CreationDate="2015-06-15T10:21:02.110" Score="1" ViewCount="151" Body="&lt;p&gt;Is there a way to detect when a task is finished with js, for example I have a task running I can see the progress bar in the top right corner I would like to attach an event so when the task is done to do some js. Is that possible at this stage of craft. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-06-15T14:33:31.270" Title="Detect task is finished" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10159" PostTypeId="1" CreationDate="2015-06-15T12:39:28.187" Score="2" ViewCount="1994" Body="&lt;p&gt;I'm using the SuperTable plugin to create Matrix fields inside a super Table. It's looking great in the front-end but I can't find any documentation on how to template the fields. This is my code so far: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;div class=&quot;article-blocks&quot;&amp;gt;&#xA;            {% for block in entry.informasjon %}&#xA;&#xA;                {% if block.type == &quot;innhold&quot; %}&#xA;&#xA;                    {% for row in entry.velg1Av3BildeVideo %}&#xA;&#xA;                        &amp;lt;div class=&quot;image-container&quot;&amp;gt;&#xA;                            {% for image in entry.bilde1 %}&#xA;                                &amp;lt;img src=&quot;/{{ image.getUrl('artikkelBlokk1Lite') }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;                            {% endfor %}&#xA;                            {% for image in entry.bilde2 %}&#xA;                                &amp;lt;img src=&quot;/{{ image.getUrl('artikkelBlokk1Stor') }}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&#xA;                            {% endfor %}&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                    {% endfor %}     &#xA;&#xA;                {% endif %}  &#xA;&#xA;            {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3581" LastEditorUserId="45" LastEditDate="2015-06-15T23:31:11.657" LastActivityDate="2018-02-28T21:31:52.540" Title="Templating SuperTable" Tags="&lt;matrix&gt;&lt;plugins&gt;&lt;table&gt;&lt;plugin-supertable&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10160" PostTypeId="1" CreationDate="2015-06-15T12:57:10.003" Score="1" ViewCount="322" Body="&lt;p&gt;I have a matrix block which has an asset field inside of it. I want to know how many assets are inside the block, is there a way to do so?&lt;/p&gt;&#xA;" OwnerUserId="3760" LastActivityDate="2015-06-15T13:39:36.540" Title="How to find number of assets inside a matrix block?" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10161" PostTypeId="1" AcceptedAnswerId="10176" CreationDate="2015-06-15T13:00:45.950" Score="3" ViewCount="1365" Body="&lt;p&gt;Most of the pages in my Craft site are contained in one big Structure. There are a couple of pages whose content needs to exist in two locations within the structure. I'm not sure how best to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could probably hack something together with a bespoke route that loads a template which sets variables related to the navigation, then loads the content from the Entry defined in the CMS... but that seems like a horrible hack, and at that point I'd start to think I should just manually copy and paste the content between the two Entries in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ideas? Ideally I'd like it to be manageable in the CMS so it's not too hidden away from the client.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-06-18T11:14:12.790" Title="How to duplicate a page within a Structure?" Tags="&lt;structure&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10162" PostTypeId="1" AcceptedAnswerId="10163" CreationDate="2015-06-15T13:19:11.980" Score="6" ViewCount="1256" Body="&lt;p&gt;I have a plugin that needs to perform some custom validation on one of its settings. How would I go about doing that?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-01-31T20:15:55.473" Title="How can I add custom validation rules to my plugin settings?" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10163" PostTypeId="2" ParentId="10162" CreationDate="2015-06-15T13:19:11.980" Score="7" Body="&lt;p&gt;The gist is, you will need to give your plugin a dedicated Settings model class, where you will have complete control over its validation rules and errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s how to set that up:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new Model class whose defineAttributes() method is based on your plugin's current defineSettings() method.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class Foo_SettingsModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'settingName' =&amp;gt; AttributeType::String,&#xA;            // ...&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Give your plugin a getSettingsModel() function (instead of defineSettings()), which will return a new instance of your settings model.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class FooPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    protected function getSettingsModel()&#xA;    {&#xA;        return new Foo_SettingsModel();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To perform the actual validation, you have &lt;strong&gt;two options&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom validator class (see the ones in craft/app/validators/ for examples), and make your plugin’s rules() method include it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class FooPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;        $rules[] = array('settingName', 'Craft\Foo_CustomValidatorClassName');&#xA;&#xA;        return $rules;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Override your plugin’s validate() method and just perform the validation directly from there:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class FooPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    public function validate($attributes = null, $clearErrors = true)&#xA;    {&#xA;        $validates = parent::validate($attributes, $clearErrors);&#xA;&#xA;        if ($attributes === null || in_array('settingName', $attributes))&#xA;        {&#xA;            // Perform custom validation here&#xA;            // ...&#xA;&#xA;            if (!$settingNameValidates)&#xA;            {&#xA;                $this-&amp;gt;addError('settingName', 'Error message');&#xA;                $validates = false;&#xA;            }&#xA;        }&#xA;&#xA;        return $validates;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Finally, the last thing you’ll need to ensure is that your plugin’s settings template is actually showing the error messages associated with this setting:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ forms.textField({&#xA;    ...&#xA;    errors: info.getErrors('settingName')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="7715" LastEditDate="2018-01-31T20:15:55.473" LastActivityDate="2018-01-31T20:15:55.473" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10164" PostTypeId="2" ParentId="10160" CreationDate="2015-06-15T13:39:36.540" Score="3" Body="&lt;p&gt;Yeah you should be able to do something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ block.assetField|length }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-15T13:39:36.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10165" PostTypeId="2" ParentId="10161" CreationDate="2015-06-15T13:48:46.433" Score="2" Body="&lt;p&gt;Theres a button in the edit entry page that allows you to save the current entry as a new one, just click the arrow next to the save button and you should see the option in the dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0AQKB.jpg&quot; alt=&quot;dupe entry button&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will essentially duplicate the entry :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-15T13:48:46.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10166" PostTypeId="2" ParentId="10161" CreationDate="2015-06-15T13:49:17.563" Score="4" Body="&lt;p&gt;There are two easy ways to avoid copying and pasting or having duplicate entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you can use &lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Globals&lt;/a&gt; to store the shared information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, your second entry/template can just ask for the data from the entry of the first entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shared_information = craft.entries.slug('my-first-entry-slug').first() %}&#xA;&#xA;&amp;lt;p&amp;gt;{{shared_information.customFieldWithSharedInformation}}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-15T13:49:17.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10167" PostTypeId="2" ParentId="10086" CreationDate="2015-06-15T14:06:09.443" Score="0" Body="&lt;p&gt;I'm very glad to have written this myself -- it's working well, and I plugged into the GeoIPs (paid) service for reverse-IP geolocation. &lt;a href=&quot;http://www.geoips.com/en/&quot; rel=&quot;nofollow&quot;&gt;http://www.geoips.com/en/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I also found this great plugin that seems to do the trick right out of the box, though it is not cookie-based. &lt;a href=&quot;https://github.com/lukeholder/craft-geo/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lukeholder/craft-geo/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3729" LastActivityDate="2015-06-15T14:06:09.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10168" PostTypeId="2" ParentId="10158" CreationDate="2015-06-15T14:33:31.270" Score="1" Body="&lt;p&gt;In one of my plugins I inject a little bit of javascript that polls &lt;code&gt;Craft.cp.runningTaskInfo&lt;/code&gt; for changes to detect if a task is finished.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-15T14:33:31.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10171" PostTypeId="2" ParentId="10151" CreationDate="2015-06-15T17:14:02.523" Score="1" Body="&lt;p&gt;I found a solution to change the allowed asset sources in redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you like to change the allowed asset sources global without making any difference between users/groups, than you can use the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open the javascript file &quot;/craft/app/resources/js/RichTextInput.js&quot;&lt;/li&gt;&#xA;&lt;li&gt;Add the following code on line 100: &quot;sources: ['folder:1', 'folder:2'],&quot; (the id's represents your asset source ids)&lt;/li&gt;&#xA;&lt;li&gt;Replace the file &quot;/craft/app/resources/js/compress/RichTextInput.js&quot; with your file (optional: for better performance compress the javscript file after replacing)&lt;/li&gt;&#xA;&lt;li&gt;Refresh your craft dashboard in the browser&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The second option would be to include a second, modified RichTextInput.js File in Craft backend. So it would be possible to write a plugin checking the &quot;View&quot; rights of the user and set the asset sources in the javascript dynamically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice: I have tested to include the same, modified file a second time and was able to overwrite the assets sources in this way, but i did not wrote any plugin yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A craft update could update also update the RichTextInput.js file - so you should test the functionality after each update.&lt;/li&gt;&#xA;&lt;li&gt;It's not a real &quot;permission&quot; check, it only hide/show asset sources&lt;/li&gt;&#xA;&lt;li&gt;The solution is only testet with local asset sources (but should work with other as well)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And finally: I know, the solution is really &lt;strong&gt;quick and dirty&lt;/strong&gt;, but better than nothing... I hope a Craft update coming soon and brings a real solution for this issue.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2015-06-15T17:14:02.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10172" PostTypeId="1" AcceptedAnswerId="10174" CreationDate="2015-06-15T18:27:41.240" Score="3" ViewCount="707" Body="&lt;p&gt;I'm wondering if I might have a little too much inception madness in my thinking with this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enhancing a site we built for a conference last year. As there's an annual conference each year and some of the speakers are the same, we decided to reevaluate the approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we have now is 2 channels, &lt;code&gt;Speaker&lt;/code&gt; and &lt;code&gt;Conference&lt;/code&gt;. Speaker contains all the speakers that could ever make an appearance at the conference and Conference contains the specific details about that conference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within conference, we have a Matrix field called &lt;code&gt;Talks&lt;/code&gt; with a &lt;code&gt;workshop&lt;/code&gt;, &lt;code&gt;general&lt;/code&gt; and &lt;code&gt;special event&lt;/code&gt; block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to group talk blocks by their block type, is that possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going a step further, in the case of a &lt;code&gt;workshop&lt;/code&gt; - that block has a &lt;code&gt;workshopRound&lt;/code&gt; select field of 1, 2 or 3 - I'd love to be able to then group entries with those blocks by their round number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how this could be achieved?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-06-15T20:04:20.703" Title="group Matrix blocks and also order by Matrix field for a given block" Tags="&lt;matrix&gt;&lt;group&gt;&lt;blocks&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10173" PostTypeId="2" ParentId="8405" CreationDate="2015-06-15T19:59:39.720" Score="3" Body="&lt;p&gt;I fixed it... I hadn't assigned a field to the section.&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2015-06-15T19:59:39.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10174" PostTypeId="2" ParentId="10172" CreationDate="2015-06-15T20:04:20.703" Score="6" Body="&lt;p&gt;This is a great chance to use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot;&gt;group&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, get all your matrix blocks as an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set talkBlocks = entry.talks.find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then group them by type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set talksByCategories = talkBlocks|group('type') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this point, you have an associative array where the keys are the block types, and the values are arrays of the blocks with that type. So &lt;code&gt;talksByCategories.workshop&lt;/code&gt; or &lt;code&gt;talksByCategories['workshop']&lt;/code&gt; will be the workshops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can group the workshops by round:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set workshopsByRound = talksByCategories.workshop|group('workshopRound.value') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should check that there were any workshops first (twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/defined.html&quot;&gt;defined&lt;/a&gt; test):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if talksByCategories['workshop'] is defined %} ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-15T20:04:20.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10175" PostTypeId="1" CreationDate="2015-06-15T20:14:36.507" Score="2" ViewCount="682" Body="&lt;p&gt;Getting this error in the PHP error log file while trying to install craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP Fatal error:  Class 'Craft\DbCommand' not found&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file is there, permissions are granted and I've tried reinstalling twice. Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="3351" LastEditorUserId="22" LastEditDate="2017-05-09T23:54:18.547" LastActivityDate="2017-05-09T23:54:18.547" Title="Class 'Craft\DbCommand' not found" Tags="&lt;database&gt;&lt;error-message&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10176" PostTypeId="2" ParentId="10161" CreationDate="2015-06-15T21:53:26.220" Score="4" Body="&lt;p&gt;You could add a new entry type &quot;Duplicate&quot; to your section with just an entries field &quot;Use content from entry&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template you can now overwrite your &lt;code&gt;entry&lt;/code&gt; variable with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry.type == 'dupe' ? craft.entries.id(entry.contentFrom.first().id).first() : entry %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use the &quot;Duplicate&quot; entry type to link to the same entry / URL twice from your navigation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in entries %}&#xA;    {% if entry.type == 'dupe' %}&#xA;        {% set entry = craft.entries.id(entry.contentFrom.first().id).first() %}&#xA;    {% endif %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in case someone &quot;guesses&quot; the URL, simply redirect them to the original entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'dupe' %}&#xA;    {% set entry = craft.entries.id(entry.contentFrom.first().id).first() %}&#xA;    {% redirect entry.url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-06-18T11:14:12.790" LastActivityDate="2015-06-18T11:14:12.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10177" PostTypeId="2" ParentId="10159" CreationDate="2015-06-15T21:59:11.897" Score="8" Body="&lt;p&gt;There's no block types with SuperTable, so no need to check that. Other that that it works just the same as Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in superTableField %}&#xA;    {{ row.textFieldInSuperTableField }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-15T21:59:11.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10178" PostTypeId="2" ParentId="10101" CreationDate="2015-06-15T22:10:23.370" Score="1" Body="&lt;p&gt;You need to get each parameter from the URL separately and repeat the steps you already did for &quot;collection&quot;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get search parameters from the URL query string&lt;/li&gt;&#xA;&lt;li&gt;Find categories that match the slugs in your query string&lt;/li&gt;&#xA;&lt;li&gt;And merge them into the relationParam array.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-15T22:10:23.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10179" PostTypeId="1" AcceptedAnswerId="10180" CreationDate="2015-06-16T08:49:41.297" Score="1" ViewCount="3207" Body="&lt;p&gt;I try to pass a variable from to a macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set syName = {&#xA;   x: { name: &quot;Schön&quot;},&#xA;   y: { name: &quot;Leicht bewölkt&quot;},&#xA;   z: { name: &quot;Stark Bewölkt&quot;},&#xA;    } &#xA;%}&#xA;&#xA;{% macro prognose(symbol, syName) %}&#xA;   &amp;lt;img src=&quot;test/{{ symbol }}.png&quot;&amp;gt;&#xA;   {% for alt in syName %}&#xA;      {{ alt.name }}&#xA;   {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{{ _self.prognose(  '1' , syName ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far so good. But this passes all the content from the variable into the macro. I want to trigger x, y, z individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried to write it like this: &lt;code&gt;{{ _self.prognose(  '1' , syName.x ) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives the error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;name&quot;) on a string variable&#xA;  (&quot;Schön&quot;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I have to write this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-06-16T11:52:16.863" Title="Pass a variable array to a macro" Tags="&lt;variable&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10180" PostTypeId="2" ParentId="10179" CreationDate="2015-06-16T09:03:38.023" Score="5" Body="&lt;p&gt;The first example makes sense because you are passing a multidimensional  array (&lt;code&gt;syName&lt;/code&gt;), looping through that array, assigns each array within to &lt;code&gt;alt&lt;/code&gt; allowing you to then access the values through dot notation (&lt;code&gt;{{ alt.name }}&lt;/code&gt;), because &lt;code&gt;alt&lt;/code&gt; is an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your second example you are passing through just one array, so when you loop through it, the value in &lt;code&gt;name&lt;/code&gt; is assigned to &lt;code&gt;alt&lt;/code&gt; as a string. (the value in the array) so you can echo it out just by doing &lt;code&gt;{{ alt }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your code could look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro prognose(symbol, syName) %}&#xA;   &amp;lt;img src=&quot;test/{{ symbol }}.png&quot;&amp;gt;&#xA;   {% for name in syName %}&#xA;      {{ name }}&#xA;   {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{{ _self.prognose(  '1' , syName.x ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output &lt;code&gt;Schön&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make things even easier for yourself, if you are passing just one array i.e &lt;code&gt;syName.x&lt;/code&gt; You don't even need the loop as you can just access the value through dot notation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set syName = {&#xA;   x: { name: &quot;Schön&quot;},&#xA;   y: { name: &quot;Leicht bewölkt&quot;},&#xA;   z: { name: &quot;Stark Bewölkt&quot;},&#xA;}%}&#xA;&#xA;{% macro prognose(symbol, syName) %}&#xA;    &amp;lt;img src=&quot;test/{{ symbol }}.png&quot;&amp;gt;&#xA;    {{ syName.name }} &#xA;{% endmacro %}&#xA;&#xA;{{ _self.prognose('1', syName.x) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output &lt;code&gt;Schön&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-06-16T11:52:16.863" LastActivityDate="2015-06-16T11:52:16.863" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10181" PostTypeId="2" ParentId="10117" CreationDate="2015-06-16T09:05:41.180" Score="4" Body="&lt;p&gt;In case anyone else comes up against this, here's what I did to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;PluginName_MyElementType&lt;/code&gt; class which inherits from &lt;code&gt;BaseElementType&lt;/code&gt;, you need to override the &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/BaseElementType#defineSearchableAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;defineSearchableAttributes&lt;/code&gt;&lt;/a&gt; method, returning an array containing all the names of the properties of your &lt;code&gt;Model&lt;/code&gt; which need to be searchable. So in my case it's just &lt;code&gt;name&lt;/code&gt;. The reason you don't need to worry about adding &lt;code&gt;title&lt;/code&gt; is it's already done for you under the hood, it's just that I wasn't using it in this case. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSearchableAttributes()&#xA;{&#xA;     return array('name');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-06-16T09:05:41.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10182" PostTypeId="2" ParentId="10105" CreationDate="2015-06-16T13:18:37.750" Score="8" Body="&lt;p&gt;This worked for me on the Arcustech server:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put this code in the root .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;# SSL only&#xA;RewriteEngine On&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !^https&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As RitterKnight mentioned you also need to modify your site's &quot;Site URL&quot; in &lt;code&gt;Settings&amp;gt;General&lt;/code&gt; to be &lt;code&gt;https://&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2015-06-16T13:18:37.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10183" PostTypeId="1" CreationDate="2015-06-16T16:53:26.130" Score="1" ViewCount="392" Body="&lt;p&gt;I need to set some cookies based on some CTA button links. I will later be checking for these cookies to determine what content to display on the entry with the cta on the next visit and other entries etc. Seems like I would need to set the cookie via javascript on click event and then direct them to the url they clicked, anyone know of a way to do this without javascript and have an event handler for the cta clicks?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-06-16T19:31:24.200" Title="Setting cookies from CTA before directing to url?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10184" PostTypeId="1" CreationDate="2015-06-16T17:35:24.497" Score="1" ViewCount="140" Body="&lt;p&gt;This might be a little complex, but here it goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; For any given entry, determine where it's located. (Ex. Entry XYZ exists in a news entry, global field, single (page), etc...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt;&#xA;So far I figured I could go the custom SQL route until I learned more about craft internals, so what I did was create a Service that does the following query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('element.*, detail.type, relation.fieldId AS sectionId, section.handle, section.name, section.hasUrls')&#xA;        -&amp;gt;from('elements_i18n AS element')&#xA;        -&amp;gt;join('relations AS relation', 'relation.sourceId = element.elementId')&#xA;        -&amp;gt;join('elements AS detail', 'detail.id = element.elementId')&#xA;        -&amp;gt;join('sections AS section', 'section.id = relation.fieldId AND section.hasUrls = 1')&#xA;        -&amp;gt;where('relation.targetId = :id', array(&#xA;            ':id' =&amp;gt; $elementID&#xA;        ));&#xA;&#xA;    $results = $query-&amp;gt;queryAll();&#xA;    $results = MyPlugin_EntryRelationshipModel::populateModels($results);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;code&gt;MyPlugin_EntryRelationshipModel&lt;/code&gt; as a Facade and it extends &lt;code&gt;Craft\ElementCriteriaModel&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; This works flawlessly until a Matrix field comes into play.&lt;/p&gt;&#xA;" OwnerUserId="3749" LastEditorUserId="45" LastEditDate="2015-06-16T19:18:43.493" LastActivityDate="2015-06-16T21:31:00.717" Title="Get Entrys relationships regardless of context" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10185" PostTypeId="2" ParentId="10183" CreationDate="2015-06-16T18:56:44.707" Score="3" Body="&lt;p&gt;One option would be to set a query string on your cta urls, have your template look for that, and change your content accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't set a cookie in Twig directly but there's a few plugins to help you out, like the handy &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow&quot;&gt;LJ Cookies&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on your CTA you might do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/cta-link-to/?cta=button2&quot; class=&quot;cta-button&quot;&amp;gt;Buy now!&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the template it links to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('cta') is not empty and craft.request.getParam('cta') == &quot;button2&quot; %}&#xA;    {# set the cookie #}&#xA;    {% do craft.lj_cookies.set('ctabuttonclicked', 'button2') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To check for the cookie later on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.lj_cookies.get( 'ctabuttonclicked' ) == 'button2' %}&#xA; .. do something ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a quick aside, depending on how you want to track things, you may want to throw in a quick redirect to dump the query string off the URL before you spit out the subsequent page. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('cta') is not empty and craft.request.getParam('cta') == &quot;button2&quot; %}&#xA;    {# set the cookie #}&#xA;    {% do craft.lj_cookies.set('ctabuttonclicked', 'button2') %}&#xA;&#xA;    {# redirect to the same page but dump the query string#}&#xA;    {%redirect entry.getUrl() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it really depends on your campaign and how you want that content shared and consumed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Just a quick example: if someone hits your CTA from an e-mail you sent and really likes what they see and posts that link with the special query string to all their friends on Facebook, everyone is going to get that event cookie set and those deals, for better or worse.  It could also piss people off if you don't have it... &quot;What? I don't see those deals you sent me...&quot; But that's a can of worms for another time...)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-06-16T19:31:24.200" LastActivityDate="2015-06-16T19:31:24.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10186" PostTypeId="2" ParentId="10184" CreationDate="2015-06-16T21:31:00.717" Score="3" Body="&lt;p&gt;So I found this: &lt;a href=&quot;https://github.com/iainurquhart/craft_introvert&quot; rel=&quot;nofollow&quot;&gt;https://github.com/iainurquhart/craft_introvert&lt;/a&gt; which is exactly what I wanted to do. Hope this helps anyone else!&lt;/p&gt;&#xA;" OwnerUserId="3749" LastActivityDate="2015-06-16T21:31:00.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10187" PostTypeId="1" AcceptedAnswerId="10188" CreationDate="2015-06-17T00:38:42.140" Score="2" ViewCount="1388" Body="&lt;p&gt;I'm trying to use a conditional to do something if the first segment matches This &lt;em&gt;or&lt;/em&gt; That. But I'm unable to come up with the right operator for the &quot;or&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif craft.request.firstSegment == 'This' || 'That' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the proper operator here? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3767" LastEditorUserId="45" LastEditDate="2015-06-17T04:52:44.630" LastActivityDate="2015-06-17T04:52:44.630" Title="Comparison &quot;or&quot; conditional" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10188" PostTypeId="2" ParentId="10187" CreationDate="2015-06-17T02:38:56.177" Score="11" Body="&lt;p&gt;You want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.firstSegment == 'This' or craft.request.firstSegment == 'That' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.firstSegment in ['This', 'That'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-17T02:38:56.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10190" PostTypeId="1" CreationDate="2015-06-17T11:53:38.570" Score="1" ViewCount="193" Body="&lt;p&gt;Interner Serverfehler&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Weder Craft\EntryModel noch zugehörige Behavior haben einen Scope &quot;competitionTitel&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is wrong… it works fine til i delete one point in the menu&lt;/p&gt;&#xA;" OwnerUserId="3769" LastActivityDate="2015-06-17T15:13:30.043" Title="Interner Serverfehler" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10191" PostTypeId="1" AcceptedAnswerId="10193" CreationDate="2015-06-17T12:34:14.947" Score="1" ViewCount="533" Body="&lt;p&gt;In my template I have this,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &#xA;    craft.fields&#xA;    .getFieldByHandle('ethnicOrigin')&#xA;    .getFieldType()&#xA;    .getInputHtml( 'fields[ethnicOrigin]', '') | raw&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which returns me a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; html element Is it possible to add specific class to this select and or &lt;code&gt;data-&lt;/code&gt; attribute?&lt;/p&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="57" LastEditDate="2015-06-17T15:14:09.370" LastActivityDate="2015-06-17T16:47:55.633" Title="How can I add attributes to craft field?" Tags="&lt;field&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10192" PostTypeId="2" ParentId="10190" CreationDate="2015-06-17T15:13:30.043" Score="1" Body="&lt;p&gt;Somewhere in your templates, you're referencing a custom field &lt;code&gt;competitionTitel&lt;/code&gt; that doesn't exist. It sounds like you might have recently deleted it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will probably look something like &lt;code&gt;entry.competitionTitel&lt;/code&gt; in your template.  You either need to create that field or adjust your templates to not call it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-17T15:13:30.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10193" PostTypeId="2" ParentId="10191" CreationDate="2015-06-17T15:40:25.553" Score="2" Body="&lt;p&gt;If you take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;FieldType&lt;/a&gt; documentation it looks as the you need to create a template for the input field in which you can specify the actual html for your field. The example in the documentation is for a &lt;code&gt;textarea&lt;/code&gt; but in your case you can substitute this for a &lt;code&gt;select&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then once you've done that just override the &lt;code&gt;getInputHtml&lt;/code&gt; method to render your new template.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2015-06-17T16:47:55.633" LastActivityDate="2015-06-17T16:47:55.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10194" PostTypeId="1" CreationDate="2015-06-17T18:23:15.077" Score="1" ViewCount="115" Body="&lt;p&gt;I’m building a site that needs to upload large video files to Amazon S3. We have run into limitations with our host where they will only increase the memory_limit to 512mb and it’s likely that there will be video files in excess of this. It seems that Craft stages the video file on the server before sending it to S3. Is there a way around this so we can bypass the hosting limits on file uploads and memory and not make the user use an FTP client to upload bigger files?&lt;/p&gt;&#xA;" OwnerUserId="288" LastActivityDate="2016-07-12T01:02:19.513" Title="Bypass server memory_limits for Cloud Asset resources" Tags="&lt;assets&gt;&lt;server&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10195" PostTypeId="2" ParentId="1164" CreationDate="2015-06-17T18:37:40.343" Score="5" Body="&lt;p&gt;You're in luck... &lt;strong&gt;Backup Pro for Craft&lt;/strong&gt; was released just this week:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://mithra62.com/projects/view/backup-pro&quot;&gt;https://mithra62.com/projects/view/backup-pro&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-17T18:37:40.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10196" PostTypeId="2" ParentId="9425" CreationDate="2015-06-17T18:44:05.187" Score="3" Body="&lt;p&gt;This is definitely possible in Craft PRO -- I just tested with fine results (latest ver. 2.4.2670). So I would look at your IAM policy. If you have your policy statement scoped to the one bucket in question (and not to all buckets in your account), you could use some wildcard permissions for your main actions, like this, and I think you should be able to rename:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Action&quot;: [&#xA;    &quot;s3:Delete*&quot;,&#xA;    &quot;s3:Get*&quot;,&#xA;    &quot;s3:List*&quot;,&#xA;    &quot;s3:Put*&quot;&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no &quot;Update&quot; call into S3 since it is object storage, and any change means a full rewrite of the file.&lt;/p&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="3729" LastEditDate="2015-06-18T16:12:23.270" LastActivityDate="2015-06-18T16:12:23.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10197" PostTypeId="2" ParentId="10194" CreationDate="2015-06-17T19:01:43.960" Score="1" Body="&lt;p&gt;I don't think there is anything native in Craft that is going to help you here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FTP is probably the best bet.  Only images get downloaded from external sources during indexing, so it's a simple as FTP'ing up the files and rebuild the asset source indexes (which could be automated via cron job).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-17T19:01:43.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10198" PostTypeId="1" AcceptedAnswerId="10209" CreationDate="2015-06-17T19:21:37.733" Score="4" ViewCount="566" Body="&lt;p&gt;Is it possible to have all Matrix rows in the Control Panel entry be in the collapsed state by default?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&#xA;Lori&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2015-06-18T16:58:14.343" Title="Possible have matrix rows collapsed by default in the Control Panel?" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10199" PostTypeId="2" ParentId="10198" CreationDate="2015-06-17T19:52:49.137" Score="2" Body="&lt;p&gt;Not that I'm aware of, but this feature request and response may at least help a bit. &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7425151--expand-collapse-all-ui-for-matrix-fields&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7425151--expand-collapse-all-ui-for-matrix-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2015-06-17T19:52:49.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10200" PostTypeId="1" AcceptedAnswerId="10203" CreationDate="2015-06-17T21:43:18.440" Score="1" ViewCount="430" Body="&lt;p&gt;If &lt;code&gt;template2.html&lt;/code&gt; contains &lt;code&gt;{% extends 'template1.html' %}&lt;/code&gt; &#xA;and &lt;code&gt;template3.html&lt;/code&gt; contains &lt;code&gt;{% extends 'template2.html' %}&lt;/code&gt;, what happens to things like &lt;code&gt;{% block %}{% endblock %}&lt;/code&gt; and variables?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="344" LastEditDate="2015-06-18T15:50:57.977" LastActivityDate="2015-06-18T15:50:57.977" Title="What happens when extending an extended template?" Tags="&lt;templating&gt;&lt;extends&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10201" PostTypeId="1" AcceptedAnswerId="10207" CreationDate="2015-06-18T02:11:14.107" Score="1" ViewCount="629" Body="&lt;p&gt;How would I get a list of all the checkbox options associated with a specific field, without having an entry to loop over? I'm using the same form for creating new entries and editing existing ones. Been using &lt;em&gt;{{ entry.fieldValue | default( ) }}&lt;/em&gt; for almost everything else.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.id is not empty %}&#xA;    {% for option in entry.myFieldOptions.options %}&#xA;        &amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;            {% set checked = false %}&#xA;&#xA;            {% if option.selected %}&#xA;                {% set checked = true %}&#xA;            {% endif %}&#xA;&#xA;            {% if not checked %}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myFieldOptions][]&quot; value=&quot;&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ option.value }}&quot; name=&quot;fields[myFieldOptions][]&quot; {% if option.selected %} checked=&quot;checked&quot;{% endif %}&amp;gt;{{ option.label }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% else %}&#xA;    //hardcoded values&#xA;    //is there a way to reference available checkbox options directly?&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="1098" LastEditDate="2015-06-18T07:51:10.337" LastActivityDate="2015-06-18T07:51:10.337" Title="Getting checkbox options for a new entry, without having an entry" Tags="&lt;templating&gt;&lt;entry&gt;&lt;fieldtypes&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10202" PostTypeId="1" AcceptedAnswerId="10204" CreationDate="2015-06-18T02:24:47.350" Score="2" ViewCount="373" Body="&lt;p&gt;having issues doing the classic element type query, works fine with numerical criteria (id, price etc.) but fails on strings, (code, name etc.). It just returns all elements.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('GoWander_Trip');&#xA;$criteria-&amp;gt;code = $code;&#xA;return $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any step im missing in the setup of the element itself (code below)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria) {&#xA;&#xA;    $query&#xA;        -&amp;gt;addSelect('&#xA;            trips.code, &#xA;            trips.templateId, &#xA;            trips.start, &#xA;            trips.end, &#xA;            trips.assetId, &#xA;            trips.price, &#xA;            trips.spots, &#xA;            trips.spotsAvailable,&#xA;            trips.elements,&#xA;            trips.shortDescription&#xA;        ')&#xA;        -&amp;gt;join('gowander_trips trips', 'trips.id = elements.id');&#xA;&#xA;    if ($criteria-&amp;gt;templateId) {&#xA;&#xA;        $query-&amp;gt;andWhere(DbHelper::parseParam('trips.templateId', $criteria-&amp;gt;templateId, $query-&amp;gt;params));&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-06-18T03:51:42.377" Title="Why does a Element Criteria Model Query with Strings on a custom element type not filtering?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10203" PostTypeId="2" ParentId="10200" CreationDate="2015-06-18T03:41:59.250" Score="3" Body="&lt;p&gt;So I tried it, made three files, one extending the first, and another extending the second, and it all worked more or less as one would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;bozo.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    {% set title = title ~ 'Main' %}&#xA;    &amp;lt;title&amp;gt;{{ title }}&amp;lt;/title&amp;gt;&#xA;  &amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt;&#xA;    Where was {% block whereWasBozo %}Bozo?{% endblock whereWasBozo %}&amp;lt;br&amp;gt;&#xA;    Variable A is {{ a }}&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ex1_bozo.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'bozo.html' %}&#xA;{% set title = title ~ 'Bozo 1 = ' %}&#xA;{% set a = 'ex1' %}&#xA;{% block whereWasBozo %}&#xA;  Bozo wasn't here. &#xA;{% endblock whereWasBozo %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ex2_bozo.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'ex1_bozo.html' %}&#xA;{% set title = 'Bozo 2 + ' %}&#xA;{% set a = 'ex2' %}&#xA;{% block whereWasBozo %}&#xA;Bozo was in Bozoland.&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I pulled up page ex2_bozo.html, the end result was the page title said: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bozo 2 + Bozo 1 = Main&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the web page said:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Where was Bozo was in Bozoland.&#xA;Variable A is ex1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the blocks extend all the way through. The variables are first set in the file you initially call. They are modified in the middle 'extension' and modified again in the final extension.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-06-18T03:41:59.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10204" PostTypeId="2" ParentId="10202" CreationDate="2015-06-18T03:51:42.377" Score="5" Body="&lt;p&gt;Found the answer, simple mistake.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($criteria-&amp;gt;code) {&#xA;   $query-&amp;gt;andWhere(DbHelper::parseParam('trips.code', $criteria-&amp;gt;code, $query-&amp;gt;params));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;was needed along with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineCriteriaAttributes() {&#xA;&#xA;    return array(&#xA;        'templateId'    =&amp;gt; AttributeType::Mixed,&#xA;        'code'          =&amp;gt; AttributeType::String,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopes that helps anyone else who comes across something like this.&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-06-18T03:51:42.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10205" PostTypeId="1" AcceptedAnswerId="10206" CreationDate="2015-06-18T04:14:12.577" Score="0" ViewCount="178" Body="&lt;p&gt;In ExpressionEngine you can rearrange the field types from inside the entry. I was wondering if there was any feature like this in Craft? I've got a lot of different types of entries so it's a pain to jump back and forth between sections and entries to see if the organisation is correct, plus it would just be easier to organise if I can see what the final product would be.&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:53:40.140" LastActivityDate="2017-05-09T23:53:40.140" Title="Change field arrangement from the entries page" Tags="&lt;control-panel&gt;&lt;fieldtypes&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10206" PostTypeId="2" ParentId="10205" CreationDate="2015-06-18T05:09:09.290" Score="5" Body="&lt;p&gt;No, that's not possible with Craft at the moment (2.4). You'll have to use the Field Layout Designer from Settings -&gt; Sections -&gt; {Section} -&gt; {Entry Type} to manage your fields and tabs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could always &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot;&gt;add a feature request&lt;/a&gt; if you feel this is something that should be included in the core.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-18T05:09:09.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10207" PostTypeId="2" ParentId="10201" CreationDate="2015-06-18T07:49:39.077" Score="4" Body="&lt;p&gt;You can pull the field directly using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.fields&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.fields&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myFieldOptions = craft.fields.getFieldbyHandle('myFieldOptions') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The options will be available under the field's &lt;code&gt;settings.options&lt;/code&gt; property. Each option will have attributes for &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;label&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in myFieldOptions.settings.options %}&#xA;    {{ option.label }} {{ option.value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-06-18T07:49:39.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10208" PostTypeId="1" AcceptedAnswerId="10210" CreationDate="2015-06-18T08:32:40.197" Score="1" ViewCount="283" Body="&lt;p&gt;I have a matrix field (events), each of this blocks (event) contains a table (dates) with individual rows (date), those have a start date and a start time. I would like to sort the events (matrix blocks) by the earliest start date / start time. Also at some point I would only want to display future events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats the &quot;best&quot; way to achieve this kind of sorting in a template (twig)? Would I have to loop through them and sort them &quot;manually&quot;? I think about something around sorting the child tables first and then sort the blocks by their first table rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event A [&lt;em&gt;matrixblock&lt;/em&gt;]&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dates [&lt;em&gt;table&lt;/em&gt;]&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Date 1 | (12/12/2015) [&lt;em&gt;datetimefield&lt;/em&gt;] | (10:00) [&lt;em&gt;datetimefield&lt;/em&gt;]&lt;/li&gt;&#xA;&lt;li&gt;Date 2 | (10/10/2015) [datetimefield] | (10:00) [&lt;em&gt;datetimefield&lt;/em&gt;]&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Event B [matrixblock]&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dates [table]&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Date 1 | (09/09/2015) [&lt;em&gt;datetimefield&lt;/em&gt;] | (10:00) [&lt;em&gt;datetimefield&lt;/em&gt;]&lt;/li&gt;&#xA;&lt;li&gt;Date 2 | (10/10/2015) [&lt;em&gt;datetimefield&lt;/em&gt;] | (10:00) [&lt;em&gt;datetimefield&lt;/em&gt;]&lt;/li&gt;&#xA;&lt;li&gt;Date 3 | (11/11/2015) [&lt;em&gt;datetimefield&lt;/em&gt;] | (10:00) [&lt;em&gt;datetimefield&lt;/em&gt;]&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This simple case would sort Event B, Event A. Because of the earliest date being Date 1 of Event B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate any input. Cheers.&lt;/p&gt;&#xA;" OwnerUserId="149" LastActivityDate="2015-06-18T12:29:32.727" Title="Sorting matrixblocks by earliest date from child table" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10209" PostTypeId="2" ParentId="10198" CreationDate="2015-06-18T11:55:40.093" Score="8" Body="&lt;p&gt;Inject this piece of JS in your CP and they will always be closed by default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.matrixblock').each(function() {&#xA;    $(this).addClass('collapsed');&#xA;    Craft.MatrixInput.rememberCollapsedBlockId($(this).data('id'));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's an example plugin that will inject it in the CP: &lt;a href=&quot;https://gist.github.com/boboldehampsink/6bb9e5296977a99c39b1&quot; rel=&quot;noreferrer&quot;&gt;https://gist.github.com/boboldehampsink/6bb9e5296977a99c39b1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="165" LastEditDate="2015-06-18T16:58:14.343" LastActivityDate="2015-06-18T16:58:14.343" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10210" PostTypeId="2" ParentId="10208" CreationDate="2015-06-18T12:29:32.727" Score="4" Body="&lt;p&gt;This is a bit tricky to do from the template, but what I would suggest is to query for the Matrix blocks once,&#xA;than loop through the blocks and store the data to a new custom array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is, to build that array in a way that ensures, you can later apply &lt;code&gt;sort&lt;/code&gt; and &lt;code&gt;group&lt;/code&gt; Twig filters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allDates = [] %}&#xA;{% for block in entry.myEventsMatrix %}&#xA;    {% for row in block.myDatesTable %}&#xA;&#xA;        {% set allDates = allDates|merge([{&#xA;            datetime: (row.myDateTime|date('c')),&#xA;            eventId: (block.id),&#xA;            event: block&#xA;        }]) %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When sorting an array of arrays with the &lt;code&gt;sort&lt;/code&gt; filter, the inner array's first value is relevant, so make sure this is the&#xA;DateTime you want to sort by. Besides that, I included the block's ID &quot;eventID&quot; and the complete block model &quot;event&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set datesGrouped = allDates|sort|group('eventId') %}&#xA;&#xA;{% for eventId, datesInEvent in datesGrouped %}&#xA;    &amp;lt;h3&amp;gt;{{ eventId }}&amp;lt;/h3&amp;gt;        &#xA;    {% for date in datesInEvent %}&#xA;        {{ date.datetime|date('Y-m-d') }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outside the &quot;datesInEvent&quot; loop you can access the events model with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set event = datesInEvent[0].event %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-06-18T12:29:32.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10211" PostTypeId="1" CreationDate="2015-06-18T12:41:14.287" Score="0" ViewCount="1279" Body="&lt;p&gt;I'm trying to upload own assets, but it occurs always the error that the file path &quot;{assetsBasePath}/sites/&quot; doesn't exist. Why and how can I fix it?&lt;/p&gt;&#xA;" OwnerUserId="3768" LastActivityDate="2015-06-18T13:22:14.197" Title="Assets Upload Error" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10212" PostTypeId="2" ParentId="10211" CreationDate="2015-06-18T13:22:14.197" Score="4" Body="&lt;p&gt;Apparently, there's no environmentVariable &lt;code&gt;assetsBasePath&lt;/code&gt; in your &lt;code&gt;config/general.php&lt;/code&gt;. Without it, Craft can not replace the &lt;code&gt;{assetsBasePath}&lt;/code&gt; part of the url by the correct path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;code&gt;config/general.php&lt;/code&gt; should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://www.yourdomain.com/assets/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'assetsUrl' =&amp;gt; 'http://www.yourdomain.com/assets/',&#xA;        'assetsBasePath' =&amp;gt; '/path/to/your/public/folder/assets/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-06-18T13:22:14.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10213" PostTypeId="1" AcceptedAnswerId="10216" CreationDate="2015-06-18T14:00:08.147" Score="5" ViewCount="2084" Body="&lt;p&gt;A &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3089/grab-environmentvariables-with-a-tag&quot;&gt;similar question was answered before&lt;/a&gt;, but I was wonder how I might be able to return the same query from within a plugin (php)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Convert this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.environmentVariables.baseUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To something like this&lt;/strong&gt;: &lt;em&gt;(not correct)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;config-&amp;gt;get('environmentVariables.baseUrl');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would be the correct syntax?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Mark.&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-18T14:20:12.610" Title="Getting environmental variable via plugin" Tags="&lt;config&gt;&lt;variable&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10214" PostTypeId="1" AcceptedAnswerId="10217" CreationDate="2015-06-18T14:08:51.467" Score="3" ViewCount="72" Body="&lt;p&gt;I have an Assets field which I want to be required only if a separate Lightswitch field on the same Entry is 'on'. I'm currently trying to implement this with a simple plugin that creates a custom field type (&lt;a href=&quot;https://github.com/rally-agency/Craft-Unique-Text-FieldType&quot; rel=&quot;nofollow&quot;&gt;along these lines&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in my Field Type's &lt;code&gt;validation()&lt;/code&gt; method I can't work out how to access the Lightswitch field's value on this same Entry, in order see if it's 'on' or not.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-06-18T14:25:49.483" Title="A plugin to validate a field depending on another field's value" Tags="&lt;plugins&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10215" PostTypeId="1" AcceptedAnswerId="10218" CreationDate="2015-06-18T14:14:52.417" Score="1" ViewCount="313" Body="&lt;p&gt;I have a Matrix field setup and working perfectly except for one problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I'm using &lt;code&gt;.limit&lt;/code&gt; to only pull the first two items from the matrix field &lt;em&gt;(I can't use max in the field settings as I'm using the same field on other pages that allow more than two blocks to show)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following line to pull the Matrix blocks works fine in the live preview.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for serviceBlock in entry.serviceBlocks %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But adding the limit stops Craft showing the blocks in the live preview. Though the rest of the template loads and updates perfectly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for serviceBlock in entry.serviceBlocks.limit(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not getting any errors, and if I save the page and reload the live preview it will render the blocks perfectly, but not update the content live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this problem, or have an idea that might help?&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-06-18T14:51:53.803" Title="When using .limit on matrix blocks they don't show in live preview" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;live-preview&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10216" PostTypeId="2" ParentId="10213" CreationDate="2015-06-18T14:20:12.610" Score="10" Body="&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;config-&amp;gt;get('environmentVariables')['baseUrl'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-06-18T14:20:12.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10217" PostTypeId="2" ParentId="10214" CreationDate="2015-06-18T14:25:49.483" Score="3" Body="&lt;p&gt;In your FieldType you have &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; available, representing the Element the field is in. If you use &lt;code&gt;$this-&amp;gt;element-&amp;gt;lightSwitchHandle&lt;/code&gt; you can access its value.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-18T14:25:49.483" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10218" PostTypeId="2" ParentId="10215" CreationDate="2015-06-18T14:51:53.803" Score="5" Body="&lt;p&gt;I noticed the same issue with live preview, but using the &lt;code&gt;type&lt;/code&gt; property on the Matrix field: &lt;a href=&quot;https://craftcms.stackexchange.com/q/8879/125&quot;&gt;Issue with Matrix &lt;code&gt;type&lt;/code&gt; property and Live Preview?&lt;/a&gt; According to Brandon's answer this is a current bug / limitation of the Matrix field that you have to find a workaround for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case this is rather easy, get all the blocks and use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter to loop over a subset:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for serviceBlock in entry.serviceBlocks|slice(0, 2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-18T14:51:53.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10219" PostTypeId="1" CreationDate="2015-06-18T15:52:10.933" Score="2" ViewCount="1057" Body="&lt;p&gt;I'd like to create a template that lets visitors either a) register a new account or b) sign in to an existing account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a sample public registration form here: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/user-registration-form&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't find any examples of how to enable a visitor with an existing account to sign into it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if I'm missing an obvious link somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you do this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3776" LastActivityDate="2015-06-18T15:59:33.320" Title="End user sign in and/or registration template example" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10220" PostTypeId="2" ParentId="10219" CreationDate="2015-06-18T15:59:33.320" Score="1" Body="&lt;p&gt;Here is an example of how to do a login form for users with existing accounts: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see more form examples in the left hand menu of that page.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-18T15:59:33.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10221" PostTypeId="1" AcceptedAnswerId="10232" CreationDate="2015-06-18T16:03:34.783" Score="3" ViewCount="286" Body="&lt;p&gt;i wrote a plugin with an additional dashboard widget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have to refresh the widget data every hour with ajax. so i added a plugin controller in my plugin directory with the idea of re-rendering the widget template (called through ajax).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) how can i (correctly) access the widget instance from the controller (or service)?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my try is &lt;em&gt;$widget = craft()-&gt;dashboard-&gt;getWidgetType('name')&lt;/em&gt;. this gives me the correct instance. is this the right way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) no settings data from widget (needed in widget template)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the widget template i need access to the widget settings (defined in the widget class with defineSettings()).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the controller, i get the widget instance (as described in point 1) and do &lt;em&gt;$widget-&gt;getBodyHtml()&lt;/em&gt;, but the settings attributes are empty. all other parts of the template are rendered correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when the widget is rendered the first time (no ajax request), anything seems to be fine (settings loaded correctly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone explain my fault?&lt;/p&gt;&#xA;" OwnerUserId="3775" LastEditorUserId="3775" LastEditDate="2015-06-18T16:15:55.763" LastActivityDate="2016-08-04T10:11:43.260" Title="Dashboard Widget: Access widget settings from controller / service" Tags="&lt;controller&gt;&lt;dashboard-widgets&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10222" PostTypeId="1" CreationDate="2015-06-18T19:12:59.107" Score="0" ViewCount="67" Body="&lt;p&gt;Does anyone know of a way to append another field to the entry title displayed in an entries field? I'd like to try and append an entry_version field to the title displayed so I get something like &quot;Entry Title - v1&quot; instead of just &quot;Entry Title&quot; when selecting related entries in a parent entry.&lt;/p&gt;&#xA;" OwnerUserId="500" LastActivityDate="2015-06-18T20:50:42.243" Title="Possible to append another field to entries field title?" Tags="&lt;fieldtypes&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10223" PostTypeId="1" CreationDate="2015-06-18T19:23:03.727" Score="3" ViewCount="671" Body="&lt;p&gt;So I'm using cookies to determine what entries I want to display on some specific pages. I have a lot of different cookies which will change which entries I should be displaying. I currently have around 12 different cookies so would end up with over a thoasad different possiblities. Here is an example if a person has a both the below cookies, they should see entries from all of the below sets so I would need to either merge or join these if that specific cookie was found and the entries for that match were set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if getCookie('cookie1') %}&#xA;{% set cookie1Entries = craft.categories.group('resource').slug('slug1') %}&#xA;{% set cookie1Entries2 = craft.categories.group('resource').slug('slug2') %}&#xA;{% set cookie1Entries3 = craft.categories.group('resource').slug('slug3') %}&#xA;&#xA;{% set entriescookie1 = craft.entries({&#xA;    group: 'resource',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: cookie1Entries },&#xA;        { targetElement: cookie1Entries2 },&#xA;        { targetElement: cookie1Entries3 }&#xA;    ]&#xA;}).limit(3).find() %}&#xA;{% endif %}&#xA;&#xA;{% if getCookie('cookie2') %}&#xA;{% set cookie2Entries = craft.categories.group('resource').slug('slug4') %}&#xA;{% set cookie2Entries2 = craft.categories.group('resource').slug('slug5') %}&#xA;{% set cookie2Entries3 = craft.categories.group('resource').slug('slug6') %}&#xA;&#xA;{% set entriescookie2 = craft.entries({&#xA;    group: 'resource',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: cookie2Entries },&#xA;        { targetElement: cookie2Entries2 },&#xA;        { targetElement: cookie2Entries3 }&#xA;    ]&#xA;}).limit(3).find() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to merge all of these at the end of checking for cookies, and also prevent from showing duplicate entries? Not sure how I would go about joining or merging these entries, as I would need to check if entriescookie1 or entriescookie2 was also set.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-06-18T19:29:02.073" LastActivityDate="2015-06-20T12:39:23.160" Title="Set multiple entries from different categories merge or join?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10224" PostTypeId="2" ParentId="10222" CreationDate="2015-06-18T20:50:42.243" Score="1" Body="&lt;p&gt;Under the Section's entry type settings, you can uncheck the &quot;Show the Title Field&quot; checkbox and set the title format to be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`{title} - v{myVersionFieldHandle}` &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-18T20:50:42.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10225" PostTypeId="1" AcceptedAnswerId="10249" CreationDate="2015-06-18T21:03:34.267" Score="1" ViewCount="828" Body="&lt;p&gt;I am relatively new to Craft and I came across the lovely plugin &lt;a href=&quot;https://github.com/A-P/Embedder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedder&lt;/a&gt; and I have managed to make good use of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, I don't manage to apply the paramters. I have followed the advice on the following &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9430/using-parameters-with-embedder&quot;&gt;post&lt;/a&gt; but still, don't manage to apply the vimeo paramters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code looks like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set video = craft.embedder.url(entry.workVideo, {max_width:5000, max_height:8000, vimeo_color:ffffff}) %}&#xA;&#xA;{% if video %}&#xA;    &amp;lt;div class=&quot;work_video&quot;&amp;gt;&#xA;        {{ video.embed_code }}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All is fine beside the fact that the &lt;code&gt;vimeo_color&lt;/code&gt; parameter doesn't work. I have tried other parameters like &lt;code&gt;vimeo_autoplay:true&lt;/code&gt; also with no success.&lt;/p&gt;&#xA;" OwnerUserId="3777" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-20T00:16:14.487" Title="Vimeo video with Embedder plugin" Tags="&lt;plugin-embedder&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10226" PostTypeId="2" ParentId="10225" CreationDate="2015-06-18T21:29:53.227" Score="3" Body="&lt;p&gt;Did you try to format the parameter like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vimeo_color: 'FFFFFF'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is the right code I posted. So make sure to wrap the value in quotes, as otherwise Twig reads &lt;code&gt;FFFFFF&lt;/code&gt; as a variable. Only numbers or a boolean &lt;code&gt;false&lt;/code&gt; or &lt;code&gt;true&lt;/code&gt; can be passed without.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And then, after you got your syntax right&lt;/strong&gt;, go to CP Settings → Tools → Empty Cache and clear your &quot;Data Caches&quot;. I just installed the plugin to test it and found out it uses caching and doesn't take into account that the user could change these parameters.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-06-19T20:12:26.083" LastActivityDate="2015-06-19T20:12:26.083" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10227" PostTypeId="1" AcceptedAnswerId="10231" CreationDate="2015-06-18T23:10:47.540" Score="0" ViewCount="243" Body="&lt;p&gt;I am trying to learn how to create plugins using craft and am having a small problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the templates/settings.html page I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.lightswitchField({&#xA;    label: &quot;Lightswitch Label&quot;|t,&#xA;    instructions: &quot;Lightswith Instructions&quot;|t,&#xA;    name: 'lightSwitchName',&#xA;    on: settings.lightSwitchName,&#xA;}) }}&#xA;&#xA;&#xA;&#xA;{{ forms.radioGroup({&#xA;    label: &quot;Radio Group Label&quot;|t,&#xA;    instructions: &quot;Radio Group Instructions&quot;|t,&#xA;    name: 'radioGroupName',&#xA;    options:{ &quot;option_1&quot; : &quot;option_1&quot;, &quot;option_2&quot; : &quot;option_2&quot;},&#xA;    value: settings.radioGroupName&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is interesting is that on the settings page for this plugin (in the admin control panel) the label and instructions only show up for lightswitch field and not for the radio group.  Here is a screen shot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://content.screencast.com/users/SEMCourses/folders/Jing/media/17547054-15e7-4b7b-aec2-ab25656ba297/2015-06-19_0202.png&quot; alt=&quot;screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong?  Is there a way to display a title and instructions for a radiogroup?  If so, can someone please tell me how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moshe&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:49.790" LastActivityDate="2015-06-19T04:48:29.883" Title="Problems Displaying Label and Instructions in Forms" Tags="&lt;plugin-development&gt;&lt;lightswitch&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10228" PostTypeId="1" AcceptedAnswerId="10234" CreationDate="2015-06-18T23:23:18.447" Score="1" ViewCount="841" Body="&lt;p&gt;I have another plugin development question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now trying to learn how to work with the database.  To that extent, I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the templates/settings.html page I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.radioGroup({&#xA;    label: &quot;Radio Group Label&quot;|t,&#xA;    instructions: &quot;Radio Group Instructions&quot;|t,&#xA;    name: 'radioGroupName',&#xA;    options:{ &quot;option_1&quot; : &quot;option_1&quot;, &quot;option_2&quot; : &quot;option_2&quot;},&#xA;    value: settings.radioGroupName&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the records/PluginNameRecord.php page, I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginNameRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'pluginname';&#xA;    }&#xA;&#xA;&#xA;    public function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'radioGroupName' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'option_1')&#xA;        );&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the code for the models/PluginNameModel.php file (I don't know if this is relevant or not, but I'm including it just in case):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginNameModel extends BaseModel&#xA;{&#xA;&#xA;    public function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'radioGroupName' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'option_1')&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, I have tested this and it creates a table and column in mysql.  However, I cannot update the data in the database.  That is to say, if I select option_2 nothing happens in mysql.  The same default value of option_1 still shows up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please let me know what I am doing wrong?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moshe&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="1098" LastEditDate="2015-06-19T11:37:06.060" LastActivityDate="2015-06-19T11:37:06.060" Title="Updating the Database for plugin settings" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10229" PostTypeId="1" CreationDate="2015-06-18T23:37:32.477" Score="1" ViewCount="131" Body="&lt;p&gt;Please someone tell me where I'm going wrong with this. I have a Matrix field called Page Builder &lt;em&gt;(pageBuilder)&lt;/em&gt; and have different matrix blocks for outputting information in different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code in the entry template works fine for every field except for the one called Placement &lt;em&gt;(placement)&lt;/em&gt; which is a position select field. I can't for the life of me get it to output anything at all :-(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please tell me where I'm going wrong on this one as I'm sure it's going to be something stupid with my code syntax somewhere but just can't tell where for the life of me!!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageBuilder %}&#xA;&#xA;{% switch block.type %}&#xA;&#xA;    {% case &quot;textBlock&quot; %}&#xA;&#xA;        {{ block.text }}&#xA;&#xA;    {% case &quot;callToAction&quot; %}&#xA;&#xA;        &amp;amp;lt;h3&amp;amp;gt;{{ block.blockColour }}&amp;amp;lt;/h3&amp;amp;gt; {{ block.text }}&#xA;&#xA;    {% case &quot;sectionBlock&quot; %}&#xA;&#xA;        {{ block.text}}&#xA;&#xA;    {% case &quot;threeColumn&quot; %}&#xA;&#xA;        {{ block.column1 }}&#xA;        {{ block.column2 }}&#xA;        {{ block.column3 }}&#xA;&#xA;    {% case &quot;smallColumnLargeColumn&quot; %}&#xA;&#xA;        {# CAN'T GET THIS NEXT BIT WORKING #}&#xA;        {% switch block.placement %}&#xA;                {% case &quot;left&quot; %}&#xA;                &amp;lt;p&amp;gt;Code to output if left&amp;lt;/p&amp;gt;&#xA;                {% case &quot;right&quot; %}&#xA;                &amp;lt;p&amp;gt;Code to output if right&amp;lt;/p&amp;gt;&#xA;        {% endswitch %}&#xA;        {# ----------------------------------- #}&#xA;&#xA;        {{ block.column1 }}&#xA;        {{ block.column2 }}&#xA;&#xA;{% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3631" LastEditorUserId="3631" LastEditDate="2015-06-19T18:33:42.903" LastActivityDate="2015-06-19T18:33:42.903" Title="Unable to output position select value" Tags="&lt;output&gt;&lt;position&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10230" PostTypeId="2" ParentId="10229" CreationDate="2015-06-19T00:10:32.907" Score="2" Body="&lt;p&gt;If you're looking to just output the value of the PositionSelect field, it's &lt;code&gt;block.placement&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here for more info: &lt;a href=&quot;http://buildwithcraft.com/docs/position-select-fields#templating&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/position-select-fields#templating&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-19T00:10:32.907" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10231" PostTypeId="2" ParentId="10227" CreationDate="2015-06-19T04:48:29.883" Score="2" Body="&lt;p&gt;You should be using &lt;code&gt;forms.radioGroupField&lt;/code&gt; instead of &lt;code&gt;forms.radioGroup&lt;/code&gt;, just like you're using &lt;code&gt;forms.lightswitchField&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-19T04:48:29.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10232" PostTypeId="2" ParentId="10221" CreationDate="2015-06-19T08:14:20.137" Score="3" Body="&lt;p&gt;found a way to solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;feels a bit 'dirty' to iterate over all active widgets to get the one i need (in the service class). the other option is &lt;code&gt;craft()-&amp;gt;dashboard-&amp;gt;getUserWidgetById()&lt;/code&gt;, but how the heck can i get the id of the widget by given type in a simple way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how ever, this solution works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;controller method (requested through ajax)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpdateWidget()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    try&#xA;    {&#xA;        echo craft()-&amp;gt;showcase_widget-&amp;gt;get()-&amp;gt;getBodyHtml();&#xA;    }&#xA;    catch (Exception $ex)&#xA;    {&#xA;        echo $ex-&amp;gt;getMessage();&#xA;    }&#xA;&#xA;    craft()-&amp;gt;end();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;service class&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?&#xA;&#xA;namespace craft;&#xA;&#xA;use Exception;&#xA;&#xA;class Showcase_WidgetService extends BaseApplicationComponent&#xA;{&#xA;    protected $widgetType = 'Showcase_Feedback';&#xA;&#xA;    public function get()&#xA;    {&#xA;        $widget = null;&#xA;        $userWidgets = craft()-&amp;gt;dashboard-&amp;gt;getUserWidgets();&#xA;&#xA;        foreach ($userWidgets as $userWidget)&#xA;        {&#xA;            if ($userWidget-&amp;gt;type === $this-&amp;gt;widgetType)&#xA;            {&#xA;                $widget = craft()-&amp;gt;dashboard-&amp;gt;populateWidgetType($userWidget);&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        if (!$widget)&#xA;        {&#xA;             throw new Exception(craft::t('Widget not found'));&#xA;        }&#xA;&#xA;        return $widget;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3775" LastActivityDate="2015-06-19T08:14:20.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10234" PostTypeId="2" ParentId="10228" CreationDate="2015-06-19T09:23:32.150" Score="5" Body="&lt;p&gt;You don't need to create Records, Models or interact with the database to store your plugin settings – Craft handles this for you out of the box. Here's how:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your main plugin file (PluginNamePlugin.php):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'radioGroupName' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'option_1')&#xA;    );&#xA;}&#xA;&#xA;public function getSettingsHtml()&#xA;{&#xA;   return craft()-&amp;gt;templates-&amp;gt;render('pluginname/settings', array(&#xA;       'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;   ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At a glance, your settings template looks fine, and should be placed within the &lt;code&gt;pluginname/templates/&lt;/code&gt; directory (filename &lt;code&gt;settings.html&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to retrieve a setting somewhere else within your plugin's main class, you can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = $this-&amp;gt;getSettings();&#xA;$radioGroupName = $settings-&amp;gt;radioGroupName;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To read the settings outside the main plugin class, you'll first need to pull the plugin instance, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginName');&#xA;$settings = $plugin-&amp;gt;getSettings();&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to retrieve your setting(s) for use in &lt;em&gt;templates&lt;/em&gt;, you'll need to create a template &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;Variable&lt;/a&gt; class for your plugin in order to expose the data. Here's a quick example for your use case (the following would go into the file &lt;code&gt;pluginname/variables/PluginNameVariable.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PluginNameVariable&#xA;{&#xA;    public function settings()&#xA;    {&#xA;        $plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginName');&#xA;        return $plugin-&amp;gt;getSettings();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set settings = craft.pluginName.settings %}&#xA;{{ settings.radioGroupName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For more info on plugin settings, see the official docs on the subject:&lt;/em&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/plugin-settings&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/plugins/plugin-settings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-06-19T09:49:39.097" LastActivityDate="2015-06-19T09:49:39.097" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10235" PostTypeId="1" CreationDate="2015-06-19T09:46:35.553" Score="3" ViewCount="3748" Body="&lt;p&gt;I read the documentation but I'm still confused about the Structure sections..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What they are usually used for? What are the advantages of using it?&#xA;And most important how to use them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please can you explain with some examples?&lt;/p&gt;&#xA;" OwnerUserId="3606" LastEditorUserId="1098" LastEditDate="2015-06-19T10:35:27.207" LastActivityDate="2015-06-19T10:57:29.997" Title="How does the Structure section type work?" Tags="&lt;structure&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10236" PostTypeId="2" ParentId="10235" CreationDate="2015-06-19T10:30:44.627" Score="12" Body="&lt;p&gt;I don't know if its possible to be much clearer than &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;noreferrer&quot;&gt;the official docs&lt;/a&gt; on this matter, but basically a Structure is needed if your entries needs to be in &lt;em&gt;a specific order&lt;/em&gt; (and you want to manage that order w/ an easy to use, drag-n-drop interface within the Control Panel), or if they need to be &lt;em&gt;nested&lt;/em&gt; (i.e. hierarchical, with parent/child entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative to a Structure is a Channel. A Channel doesn't have the ability to nest entries – in other words, it's a flat &lt;em&gt;stream&lt;/em&gt; of content – nor can entries be sorted in a specific order; you're stuck with sorting by published date, title, ID or other &quot;standard&quot; meta data. The best example of a good use case for a Channel I can think of is a &lt;em&gt;blog&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create a Channel and later realize that it should've been a Structure, you can convert it by visiting that Section's settings and choosing &quot;Structure&quot; for its type. You can also convert a Structure to a Channel, although if you later convert it back to a Structure your ordering/nesting data will be lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some good use cases for a Structure could be:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &quot;Documentation&quot; type section, with &quot;main&quot; entries (e.g. &quot;Javascript&quot;) and sub entries (e.g. &quot;Javascript / jQuery&quot;). &lt;a href=&quot;http://buildwithcraft.com/docs/introduction&quot; rel=&quot;noreferrer&quot;&gt;The official Craft docs&lt;/a&gt; are built using a Structure, where child entries (e.g. &quot;Requirements&quot;) are nested under parent entries (e.g. &quot;Installing and updating&quot;). See &lt;a href=&quot;https://craftcms.stackexchange.com/a/8762/1098&quot;&gt;this answer from Brad Bell&lt;/a&gt; for a bit more information on how P&amp;amp;T built the docs.&lt;/li&gt;&#xA;&lt;li&gt;A &quot;Navigation&quot; type section – some people like to build their site's navigation using a Structure, which makes it easy to edit the order of the nav items, create dropdowns/sub menus etc. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9942/navigation-structure-usage-woes&quot;&gt;Here's a thread with some information more information on this approach&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A &quot;Recipes&quot; section, where you could easily sort the different recipes after course types (meat/vegetarian)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;As for using Structures&lt;/em&gt;, I'm assuming you're talking about how to display the entries in a template – as the usage within the Control Panel should be fairly self-explanatory. Basically, outputting entries from a Structure is no different from the other section types:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('myStructureSectionHandle') %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if your Structure's entries are nested, using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;nav&lt;/code&gt;&lt;/a&gt; tag instead of the basic &lt;code&gt;for&lt;/code&gt; loop can be helpful in displaying the hierarchical content, because it can recursively output child entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in craft.entries.section('myStructureSectionHandle') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond this, I think your question is a bit too open-ended to answer in detail, and you should probably create separate questions for any specific issues or problems you encounter working with Structures.    &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-19T10:57:29.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10237" PostTypeId="1" AcceptedAnswerId="10238" CreationDate="2015-06-19T11:10:16.833" Score="3" ViewCount="269" Body="&lt;p&gt;Is it possible to check a matrix array for an ID?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a entries field which functions as a navigation.&#xA;Now if the user decides to remove one entry I want the specific template to return a 404&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aOUb2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought something like (Assuming we are in the &quot;Journalismus&quot; template):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for navi in navigation.navi %}&#xA;    {% if '4' not in navi.id %}&#xA;        {% exit 404 %}&#xA;    {% endif %}&#xA;{% endfor  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that does pass the 404 always.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-06-19T11:50:52.617" Title="If loop contains id `X`" Tags="&lt;matrix&gt;&lt;conditional&gt;&lt;entries-field&gt;&lt;id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10238" PostTypeId="2" ParentId="10237" CreationDate="2015-06-19T11:50:52.617" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% if '4' not in navigation.navi.ids() %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-19T11:50:52.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10239" PostTypeId="1" CreationDate="2015-06-19T15:06:30.017" Score="5" ViewCount="264" Body="&lt;p&gt;Is it possible to refresh an element's list when closing a modal? I have a modal ready with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;onHide : function(){&#xA;    //but all what I tried doesn't work here&#xA;&#xA;    //1: This will do the trick, but there is some bug with &quot;Double-instantiating a select on an element&quot; then the check box for the actions appear multiple times.&#xA;    Craft.elementIndex = Craft.createElementIndex('Plugin_ElementType', $('#main'), {&#xA;        context:        'index',&#xA;        storageKey:     'elementindex.Plugin_ElemenetType'&#xA;    });&#xA;&#xA;    //2 I was searching for some global function as updateElements&#xA;    something like this: Craft.cp.updateElements()&#xA;    or: Craft.Plugin_ElementType.updateElements(); but no success&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need this because in that modal I change, delete data from my elements so I have to update the list, if is possible without to reload the page of course. Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="57" LastEditDate="2015-06-27T01:02:46.380" LastActivityDate="2016-04-05T11:39:03.743" Title="How to trigger updateElements when hide modal?" Tags="&lt;elementtype&gt;&lt;javascript&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10240" PostTypeId="1" CreationDate="2015-06-19T16:26:34.283" Score="0" ViewCount="226" Body="&lt;p&gt;I've followed &lt;a href=&quot;https://craftcms.stackexchange.com/a/9170/3686&quot;&gt;this answer&lt;/a&gt; for running a Craft install based on two domain names. I thought it was working but either I was wrong, or something's changed, because it's not now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a.com (where the Craft install is) and b.com. In b.com's &lt;code&gt;index.php&lt;/code&gt; I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../craft';&#xA;&#xA;$_GET['p'] = 'subpath/' . (isset($_GET['p']) ? $_GET['p'] : '');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that if I go to &lt;code&gt;b.com/directory&lt;/code&gt; it loads a page as if it was &lt;code&gt;a.com/subpath/directory&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Except it's not - it's as if it's trying to load &lt;code&gt;a.com/directory&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I put this in b.com's &lt;code&gt;index.php&lt;/code&gt; (after the above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump($_GET['p']);&#xA;exit();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I see &quot;subpath/directory&quot;, as expected. But if in my base layout template I put this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request.getQueryString() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it shows &quot;p=directory&quot;. So it seems like &quot;subpath/&quot; is going missing somewhere? I'm stumped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I request &lt;code&gt;b.com/index.php?p=directory&lt;/code&gt; then I get the page I expect (ie, &lt;code&gt;/subpath/directory&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-07T11:29:12.837" Title="Multi-domain routing not working" Tags="&lt;routing&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10241" PostTypeId="1" AcceptedAnswerId="14681" CreationDate="2015-06-19T16:37:47.747" Score="7" ViewCount="2307" Body="&lt;p&gt;Is there an option for storing the pages generated by Craft CMS as flat, static HTML files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The model used by static driver from ExpressionEngine's CE Cache add-on works pretty well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each page request hits a mod_rewrite rule, which checks to see if an HTML file for that page exists in the static cache directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If said file exists, it gets served to the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the file doesn't exist, the CMS generates the output, which is then saved as a cache file for the next user who hits that URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It only works in cases where the entire page can be saved, but, it's insanely fast and pretty easy to implement compared to other caching solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... is there anything like that available for Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="776" LastActivityDate="2017-06-27T05:45:25.177" Title="Are there any file-based static cache options for Craft CMS?" Tags="&lt;cache&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10242" PostTypeId="1" CreationDate="2015-06-19T17:08:56.513" Score="0" ViewCount="563" Body="&lt;p&gt;Craft 2.4. Unusual bug. Adding an alt tag to an image within a rich text field via its Edit button, that's in a matrix, works just fine the first time the entry is saved. However, re-saving the entry breaks the code to the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;img alt=&quot;test&quot; src=&quot;/resources/images/someimage.png#asset:1844:url&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Becomes this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;img alt=&quot;test&quot; resources=&quot;&quot; images=&quot;&quot; someimage.png#asset:1844:url&quot;=&quot;&quot;&lt;/p&gt;&#xA;" OwnerUserId="3780" LastActivityDate="2015-06-28T22:45:49.103" Title="Adding alt tag to image in a rich text field via its Edit button, within a matrix - breaks code link to the image" Tags="&lt;matrix&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2015-06-28T22:47:50.887" ContentLicense="CC BY-SA 3.0" />
  <row Id="10243" PostTypeId="2" ParentId="10241" CreationDate="2015-06-19T17:10:36.447" Score="2" Body="&lt;p&gt;Nothing that I'm aware of and a scan through Straight Up Craft's &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;plugin directory&lt;/a&gt; isn't revealing anything, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are, however, some that integrate with &lt;a href=&quot;https://github.com/onedesign/craft-fastly&quot; rel=&quot;nofollow&quot;&gt;Fastly&lt;/a&gt; and &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/cache-monster&quot; rel=&quot;nofollow&quot;&gt;Varnish&lt;/a&gt;, where you could do all sorts of static caching strategies.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-19T17:10:36.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10245" PostTypeId="2" ParentId="10242" CreationDate="2015-06-19T18:38:03.177" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure you're on the latest release.  In &lt;a href=&quot;http://buildwithcraft.com/updates#build2670&quot; rel=&quot;nofollow&quot;&gt;2.4.2670&lt;/a&gt;, we updated Redactor to the latest so that might have fixed some bugs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I can't reproduce what you're seeing. The modal that comes up from the Redactor edit image button doesn't have an &quot;alt&quot; field, so I'm not sure where you're seeing that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If view source and manually add the alt tag, it behaves as expected no matter how many times I save/edit the entry.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bug reports are better off &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285224-bugs&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. :)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-19T18:38:03.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10246" PostTypeId="2" ParentId="10240" CreationDate="2015-06-19T20:25:53.863" Score="2" Body="&lt;p&gt;I've found an answer, but I don't know if it's going to cause me any problems or not. Looking at the debug output in the JS Console I noticed that although&lt;br&gt;&#xA;&lt;code&gt;$_GET['p']&lt;/code&gt; was set correctly to &lt;code&gt;subpath/directory&lt;/code&gt;,&lt;br&gt;&#xA;&lt;code&gt;$_SERVER['REQUEST_URI']&lt;/code&gt; was only set to &lt;code&gt;/directory&lt;/code&gt; and&lt;br&gt;&#xA;&lt;code&gt;$_SERVER['QUERY_STRING']&lt;/code&gt; was only set to &lt;code&gt;p=directory&lt;/code&gt;. Maybe Craft or Yii uses the &lt;code&gt;REQUEST_URI&lt;/code&gt; rather than &lt;code&gt;$_GET['p']&lt;/code&gt; at some crucial stage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've replaced the &lt;code&gt;$_GET['p']...&lt;/code&gt; line in my &lt;code&gt;b.com/index.php&lt;/code&gt; with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_SERVER['REQUEST_URI'] = 'subpath/' . (isset($_GET['p']) ? $_GET['p'] : '');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That seems to fix things. Any reason this might be bad and wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Looking back at my code now, it seems that both lines were required, to cover all occasions. So I now have this in &lt;code&gt;b.com/index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_SERVER['REQUEST_URI'] = 'subpath/' . (isset($_GET['p']) ? $_GET['p'] : '');&#xA;&#xA;$_GET['p'] = 'subpath/' . (isset($_GET['p']) ? $_GET['p'] : '');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="3686" LastEditDate="2016-03-07T11:29:12.837" LastActivityDate="2016-03-07T11:29:12.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10247" PostTypeId="1" AcceptedAnswerId="10248" CreationDate="2015-06-19T21:40:53.880" Score="0" ViewCount="110" Body="&lt;p&gt;With help from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1776/using-an-if-statement-to-define-the-entry-url-format&quot;&gt;this answer&lt;/a&gt;, I've got an Entry Url Format that can include top, 2nd, or 3rd-level categories.  It works for any of these situations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;top-level-category/entry.slug&#xA;top-level-category/second-level-category/entry.slug&#xA;top-level-category/second-level-category/third-level-category/entry.slug&#xA;&#xA;{% if object.mainCategory.last().level == 3 %}{mainCategory.last().parent.parent.slug}/{% endif %}{% if object.mainCategory.last().level &amp;gt; 1 %}{mainCategory.last().parent.slug}/{% endif %}{mainCategory.last().slug}/{postDate.year}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's ugly, but it works. But I'm wondering if it is slowing things down a bit.  Does anyone have any knowledge in this area?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-19T22:13:43.973" Title="Performance hit from Entry Url Format with multiple {% if %} clauses?" Tags="&lt;categories&gt;&lt;url&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10248" PostTypeId="2" ParentId="10247" CreationDate="2015-06-19T22:13:43.973" Score="3" Body="&lt;p&gt;As far as Craft is concerned whatever is in the &lt;code&gt;Entry URL Format&lt;/code&gt; field is just another Twig snippet of code.  It gets rendered down super fast just like any other Twig code.  A few &lt;code&gt;if&lt;/code&gt; conditionals aren't going to have any measurable impact on that process.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-19T22:13:43.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10249" PostTypeId="2" ParentId="10225" CreationDate="2015-06-20T00:16:14.487" Score="5" Body="&lt;p&gt;Author of the plugin here - @Lindsey is correct - wrapping the color in quotes is the correct syntax. If you test it with this video, it works fine:&#xA;&lt;a href=&quot;https://vimeo.com/130900978&quot;&gt;https://vimeo.com/130900978&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to note - with Vimeo, a video owner can overwrite this option - so if they set it to a specific theme color, you can't change it through this embed parameter. For more info on the Vimeo API, you can see this documentation: &lt;a href=&quot;https://developer.vimeo.com/player/embedding&quot;&gt;https://developer.vimeo.com/player/embedding&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="290" LastActivityDate="2015-06-20T00:16:14.487" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10250" PostTypeId="1" CreationDate="2015-06-20T09:53:45.400" Score="4" ViewCount="134" Body="&lt;p&gt;How can i edit Link-Title in Redactor Richtext-Editor? Didn't found any config options or plugins for that. Can't believe this is not possible yet.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-06-20T12:21:11.237" Title="Is there an option to edit title-parameter for Links in Redactor?" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10251" PostTypeId="2" ParentId="10250" CreationDate="2015-06-20T12:21:11.237" Score="2" Body="&lt;p&gt;There's currently no out-of-the-box way with Redactor, other than to open the HTML source view and adjust the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag manually to be something like &lt;code&gt;&amp;lt;a href=&quot;yourlink&quot; title=&quot;yourtitle&quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All Redactor settings regarding links can be found here: &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/links/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/links/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-20T12:21:11.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10252" PostTypeId="2" ParentId="10223" CreationDate="2015-06-20T12:31:49.293" Score="3" Body="&lt;p&gt;Use Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#indexBy&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;indexBy&lt;/code&gt;&lt;/a&gt; and index them by ID. If then you use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; function the duplicates will be removed and everything will be available in one array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And may I suggest that if you're going to have a lot of logics in your templates, you'd better move this to a plugin and rewrite it in PHP. Templates should mostly be about templating, not about logics.&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="165" LastEditDate="2015-06-20T12:39:23.160" LastActivityDate="2015-06-20T12:39:23.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10253" PostTypeId="1" CreationDate="2015-06-20T14:37:01.010" Score="1" ViewCount="1742" Body="&lt;p&gt;I succeeded to add the image and file upload buttons to my rich text redactor field with the fileupload param in the json config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JRQZu.png&quot; alt=&quot;redactor toolbar&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video','table','file'],&#xA;    plugins: ['fullscreen','video','table',''],&#xA;    toolbarFixed: true,&#xA;    fileUpload: 'fichiers/'&#xA;}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it does not work : when I drap and drop a file or an image it shows the top bar indicating upload in progress but it finish without anything inserted in my field.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-06-20T16:25:10.557" Title="Redactor upload image and file does not work" Tags="&lt;redactor&gt;&lt;upload&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10254" PostTypeId="2" ParentId="10253" CreationDate="2015-06-20T16:25:10.557" Score="1" Body="&lt;p&gt;Craft's default Redactor implementation comes with image selection and uploading out-of-the-box that ties to its &lt;a href=&quot;http://buildwithcraft.com/docs/assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets sources&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you click this button:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o0RIX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll get a modal where you can select already uploaded Assets or upload new ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ofyyh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-20T16:25:10.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10255" PostTypeId="1" AcceptedAnswerId="10256" CreationDate="2015-06-20T18:19:32.813" Score="1" ViewCount="40" Body="&lt;p&gt;Anyone have an idea on how to incorporate a service mark (SM) into the title of an entry? I've tried just doing &lt;sup&gt;SM&lt;/sup&gt;, tried the code for SM &amp;amp; # 8 4 8 0 ; (without the spaces), and nothing works. I even tried creating a new rich text field so I could do it there and have a conditional to show that field instead of the title field, but that makes it so that it can't be used in different headline tags on different pages, as its auto-enclosed into a pargraph or h3 or whatever. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or ideas are greatly appreciated!!&lt;/p&gt;&#xA;" OwnerUserId="3587" LastActivityDate="2015-06-20T20:06:41.587" Title="Service Mark in title" Tags="&lt;richtext&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10256" PostTypeId="2" ParentId="10255" CreationDate="2015-06-20T20:06:41.587" Score="2" Body="&lt;p&gt;I think the issue is that craft will sanitise (escape) any code before it goes into the database, to prevent any code injection and twig will also do the same at a template level (to prevent script injection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have your entry title as &lt;code&gt;DIVA! Becomes Famous &amp;amp;#8480&lt;/code&gt; for example, it will appear like that in craft and in your templates, but if you do &lt;code&gt;{{ entry.title|raw }}&lt;/code&gt; it will actually output ℠ in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the twig docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The raw filter marks the value as being &quot;safe&quot;, which means that in an environment with automatic escaping enabled this variable will not be escaped if raw is the last filter applied to it&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;See more in twig docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-20T20:06:41.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10257" PostTypeId="2" ParentId="10123" CreationDate="2015-06-20T21:39:27.490" Score="3" Body="&lt;p&gt;Using &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;en_us”&amp;gt;&lt;/code&gt; works as expected, as long as the section settings for that entry has all the locales set to be disabled by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon creating a new entry via front-end form, only the specific locale was activated. However, creating the entry in the admin panel, they are all left off by default. (Seems correct, just remind any clients that might be using the admin panel to enable whichever locale).&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2015-06-23T18:26:24.780" LastActivityDate="2015-06-23T18:26:24.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10258" PostTypeId="2" ParentId="4321" CreationDate="2015-06-21T14:27:25.647" Score="2" Body="&lt;p&gt;You can listen to the add button's &lt;code&gt;click&lt;/code&gt; event like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.matrix &amp;gt; .buttons &amp;gt; .add').on('click', function(e) {&#xA;    // your js&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-21T14:27:25.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10259" PostTypeId="2" ParentId="8810" CreationDate="2015-06-21T14:36:20.097" Score="1" Body="&lt;p&gt;Use &lt;code&gt;AttributeType::Name&lt;/code&gt; instead, this will undergo validation&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-21T14:36:20.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10260" PostTypeId="2" ParentId="8623" CreationDate="2015-06-21T14:40:02.177" Score="5" Body="&lt;p&gt;I use this to force the task icon to show up immediately:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.cp.setRunningTaskInfo({&#xA;    &quot;id&quot;: &quot;task ID&quot;,&#xA;    &quot;level&quot;: &quot;0&quot;,&#xA;    &quot;description&quot;: &quot;description&quot;,&#xA;    &quot;status&quot;: &quot;running&quot;,&#xA;    &quot;progress&quot;: 0&#xA;});&#xA;Craft.cp.trackTaskProgress();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-21T14:40:02.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10261" PostTypeId="2" ParentId="8494" CreationDate="2015-06-21T14:42:02.390" Score="1" Body="&lt;p&gt;You'll have to resubmit all the previous comments through hidden fields aswell. You can achieve this by looping through them in the form, and put their values into hidden inputs.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-21T14:42:02.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10262" PostTypeId="1" CreationDate="2015-06-21T18:56:36.777" Score="1" ViewCount="102" Body="&lt;p&gt;Got the following issue:&#xA;Building a site in 3 languages, Dutch, French &amp;amp; English&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All working fine, except the siteurl for building the href link that's going wrong.&#xA;EN &amp;amp; NL ok, FR won't output.&#xA;If I call craft.locale, it says nl_be instead of fr.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I must be missing something...&lt;/p&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2015-06-21T19:18:22.390" Title="Locale gives wrong output" Tags="&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10263" PostTypeId="2" ParentId="10262" CreationDate="2015-06-21T19:18:22.390" Score="2" Body="&lt;p&gt;Question can be deleted, just found my mistake...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently I've forgot to create the 'fr' folder and the index.php etc.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working like a charm now!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Post, can be deleted as it won't be helping others&lt;/p&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2015-06-21T19:18:22.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10264" PostTypeId="2" ParentId="9056" CreationDate="2015-06-21T22:19:21.397" Score="3" Body="&lt;p&gt;It sounds like you're on the right track. You could create a custom validator, &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators&quot; rel=&quot;nofollow&quot;&gt;as detailed here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;use Carbon\Carbon;&#xA;&#xA;class MyPlugin_ExampleModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return [&#xA;            'startDate' =&amp;gt; [&#xA;                'type'     =&amp;gt; AttributeType::DateTime,&#xA;                'required' =&amp;gt; true,&#xA;                'compare'  =&amp;gt; '&amp;lt;= endDate',&#xA;            ],&#xA;            'endDate' =&amp;gt; [&#xA;                'type'     =&amp;gt; AttributeType::DateTime,&#xA;                'required' =&amp;gt; true,&#xA;                'compare'  =&amp;gt; '&amp;gt;= startDate',&#xA;            ],&#xA;        ];&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;&#xA;        $rules[] = ['startDate', 'validateFutureDate'];&#xA;        $rules[] = ['endDate', 'validateFutureDate'];&#xA;&#xA;        return $rules;&#xA;    }&#xA;&#xA;    public function validateFutureDate($attribute)&#xA;    {&#xA;        $value = $this-&amp;gt;$attribute;&#xA;&#xA;        if ($value &amp;amp;&amp;amp; Carbon::now()-&amp;gt;gte($value)) {&#xA;            $message = Craft::t(&quot;Date must be in the future&quot;);&#xA;            $this-&amp;gt;addError($attribute, $message);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also extract the validation into a separate class, which would make it easier to test (details are in the aforementioned article).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Caveats and disclaimers&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This code is completely untested. In particular, I'm not sure whether the date comparison will work with the attribute value as-is. You'll probably also want to check what happens to the custom validation if the value contains an invalid date-time string.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2015-06-21T22:19:21.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10265" PostTypeId="1" CreationDate="2015-06-22T04:40:22.587" Score="2" ViewCount="218" Body="&lt;p&gt;How to Use defineAttributes  To Specify NOT NULL and DEFAULT '1' in MySQL Record&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am porting a plugin from another framework and it has the following&#xA;MySql tables structure. Is there an easy way to create the same&#xA;table structure within craft plugin?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;CREATE TABLE IF NOT EXISTS `exp_shortcut_shortcuts` (&#xA;`shortcut_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&#xA;`site_id` smallint(3) unsigned NOT NULL default '1',&#xA;`entry_id` smallint(3) unsigned NOT NULL default '0',&#xA;`field_id` smallint(3) unsigned NOT NULL default '0',&#xA;`autogenerated` char(1) NOT NULL default 'y',&#xA;`shortcut` varchar(100) NOT NULL default '',&#xA;`full_url_model` varchar(255) NOT NULL default '',&#xA;`full_url` varchar(255) NOT NULL default '',&#xA;`entry_date` int(11) unsigned NOT NULL default '0',&#xA;`edit_date` int(11) unsigned NOT NULL default '0',&#xA;PRIMARY KEY (`shortcut_id`),&#xA;INDEX (`shortcut`)&#xA;) ;;&#xA;&#xA;namespace Craft;&#xA;&#xA;class ShortcutRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'shortcut_shortcuts';&#xA;    }&#xA;&#xA;    public function primaryKey()&#xA;    {&#xA;       return 'shortcut_id';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'shortcut_id' =&gt; array(AttributeType::Number, 'column' =&gt; ColumnType::PK),&#xA;            'site_id' =&gt; array(AttributeType::Number, 'column' =&gt; ColumnType::TinyInt),&#xA;&lt;/pre&gt;                      &#xA;&#xA;&lt;p&gt;I see how to add TinyInt. How do I specify NOT NULL and default '1'? &lt;/p&gt;&#xA;" OwnerUserId="3521" LastEditorUserId="3521" LastEditDate="2015-06-22T04:56:49.473" LastActivityDate="2015-06-22T05:30:23.150" Title="How to Use defineAttributes To Specify NOT NULL and DEFAULT '1' in MySQL Record" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10266" PostTypeId="2" ParentId="10265" CreationDate="2015-06-22T05:00:24.583" Score="3" Body="&lt;p&gt;For &lt;code&gt;NOT NULL&lt;/code&gt; use &lt;code&gt;'required' =&amp;gt; true&lt;/code&gt; and to default to 1 use &lt;code&gt;'default' =&amp;gt; 1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-06-22T05:30:23.150" LastActivityDate="2015-06-22T05:30:23.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10267" PostTypeId="1" CreationDate="2015-06-22T09:12:11.263" Score="3" ViewCount="216" Body="&lt;p&gt;Is there a way to pre-populate the 'New Entry' form in the back end? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context here is a calendar where you can click on a day and see a list of events and have a &quot;New Event&quot; button. The &quot;New Event&quot; button should ideally open the CMS backend and pre populate the event date (and some other fields). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've chosen not to build a a whole new form because the events are quite complex, containing more than one matrix and assets, and it'll only be admins creating events (they don't need all the glitz).&lt;/p&gt;&#xA;" OwnerUserId="3790" LastActivityDate="2015-06-22T10:53:59.060" Title="Pre populated New Entry" Tags="&lt;entry&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10268" PostTypeId="1" AcceptedAnswerId="10269" CreationDate="2015-06-22T09:27:21.630" Score="9" ViewCount="894" Body="&lt;p&gt;Below is my code for sending mail and this is working fine but when i set cc or bcc mail is not sent them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $email = new EmailModel();&#xA;    $emailSettings = craft()-&amp;gt;email-&amp;gt;getSettings();&#xA;&#xA;    $email-&amp;gt;fromEmail = $emailSettings['emailAddress'];&#xA;    $email-&amp;gt;replyTo   = $message-&amp;gt;fromEmail;&#xA;    $email-&amp;gt;sender    = $emailSettings['emailAddress'];&#xA;    $email-&amp;gt;fromName  = $settings-&amp;gt;prependSender . ($settings-&amp;gt;prependSender &amp;amp;&amp;amp; $message-&amp;gt;fromName ? ' ' : '') . $message-&amp;gt;fromName;&#xA;    $email-&amp;gt;toEmail   = $toEmail;&#xA;    $email-&amp;gt;cc   = explode(',', $message-&amp;gt;fromEmail);&#xA;    $email-&amp;gt;subject   = $settings-&amp;gt;prependSubject . ($settings-&amp;gt;prependSubject &amp;amp;&amp;amp; $message-&amp;gt;subject ? ' - ' : '') . $message-&amp;gt;subject;&#xA;    $email-&amp;gt;body      = $message-&amp;gt;message;&#xA;&#xA;    if ($message-&amp;gt;attachment)&#xA;    {&#xA;        $email-&amp;gt;addAttachment($message-&amp;gt;attachment-&amp;gt;getTempName(), $message-&amp;gt;attachment-&amp;gt;getName(), 'base64', $message-&amp;gt;attachment-&amp;gt;getType());&#xA;    }&#xA;&#xA;    craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please correct me where i wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3791" LastActivityDate="2015-06-22T17:31:11.653" Title="How to set CC or BCC emails to EmailModel?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10269" PostTypeId="2" ParentId="10268" CreationDate="2015-06-22T09:32:09.700" Score="9" Body="&lt;p&gt;The way you do it now only adds email addresses as an array. You'll have to specify both email and name keys too, so it becomes like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;cc = array(&#xA;    array('email' =&amp;gt; 'email@email.com', 'name' =&amp;gt; 'Name')&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastEditorUserId="57" LastEditDate="2015-06-22T17:31:11.653" LastActivityDate="2015-06-22T17:31:11.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10270" PostTypeId="2" ParentId="10267" CreationDate="2015-06-22T10:53:59.060" Score="1" Body="&lt;p&gt;You can have placeholders and default values, but I guess that won't be enough for you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a plugin that injects some javascript into the new entry page that executes an AJAX call and fills these fields in.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T10:53:59.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10271" PostTypeId="1" AcceptedAnswerId="10273" CreationDate="2015-06-22T11:21:27.013" Score="7" ViewCount="818" Body="&lt;p&gt;I have written a plugin that checks if an entry has been saved and sends the user an email from within an onSaveEntry event. This works fine. But I now need to also update this entry to flag that an email has been sent so that subsequent saves do not fire the event. I have tried adding the following but these lines do not work and cause an infinite loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(['emailSent' =&amp;gt; '1']);&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to re-save the entry after the email has been sent so as just to update the emailSent field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onSaveEntry(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    if($entry-&amp;gt;sectionId == '12345') {&#xA;        if($user = craft()-&amp;gt;users-&amp;gt;getUserById($entry-&amp;gt;authorId)) {&#xA;            if($entry-&amp;gt;enabled &amp;amp;&amp;amp; !$user-&amp;gt;admin &amp;amp;&amp;amp; !$entry-&amp;gt;emailSent) {&#xA;&#xA;                // Send Approved Mail&#xA;                $email = new EmailModel();&#xA;                $email-&amp;gt;fromEmail = 'me@mydomain.com';&#xA;                $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;                $email-&amp;gt;subject = 'Email Subject';&#xA;                $email-&amp;gt;body    = '&amp;lt;p&amp;gt;Email Body&amp;lt;/p&amp;gt;';&#xA;                craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&#xA;                $entry-&amp;gt;setContentFromPost(['emailSent' =&amp;gt; '1']);&#xA;                craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;            }&#xA;        }&#xA;    }&#xA;    return $event;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-06-22T11:25:34.410" Title="Updating an entry after an event action within onSaveEntry" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10273" PostTypeId="2" ParentId="10271" CreationDate="2015-06-22T11:25:34.410" Score="7" Body="&lt;p&gt;Use &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement&lt;/code&gt; the second time. It will work exactly the same but won't trigger the onSaveEntry event.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T11:25:34.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10275" PostTypeId="1" AcceptedAnswerId="10285" CreationDate="2015-06-22T12:39:03.127" Score="2" ViewCount="522" Body="&lt;p&gt;I'm trying to come up with a nice UI experience for people to upload a CV and covering letter and I'm considering using something like &lt;a href=&quot;http://www.dropzonejs.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.dropzonejs.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how this would work with sprout forms because you have to put a action in the form to make it work (from what I can tell anyways)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution for this or is there an alternative approach you know that would work?&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-06-22T19:16:38.833" Title="Is it possible to use something like dropzone.js for file uploads with sprout forms?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10276" PostTypeId="1" AcceptedAnswerId="10277" CreationDate="2015-06-22T12:44:05.797" Score="1" ViewCount="206" Body="&lt;p&gt;I am quite new to Craft and I am not sure how to get a prev/next link only for entries with related data in a specific field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My situation:&#xA;I have a Structure (let's call it &lt;code&gt;sourceEntry&lt;/code&gt;) with an optional field (can be empty or can have related data, let's call this one &lt;code&gt;relatedData&lt;/code&gt;). That field is of type entries. So &lt;code&gt;sourceEntry&lt;/code&gt; is related to other entries (I'll call them &lt;code&gt;targetEntry&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I am on the entry's detail page (so, my &lt;code&gt;sourceEntry&lt;/code&gt; object is just accessible via &lt;code&gt;entry&lt;/code&gt; in my twig template) I would do this to link to previous/next entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{% set criteria = {section: 'sourceEntry' } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;{% set next = entry.getNext(criteria) %}&#xA;{# …and then just insert the links… #}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in my case I need to get the prev/next entry that has set &lt;code&gt;relatedData&lt;/code&gt; respectively I'd link to the prev/next entry that is related to &lt;code&gt;targetEntry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;br/&gt;&#xA;I have five entries of type &lt;code&gt;sourceEntry&lt;/code&gt;: A, B, C, D, E.&lt;br/&gt;&#xA;The &lt;code&gt;relatedData&lt;/code&gt; field for two of them is empty: B, C.&lt;br/&gt;&#xA;The others are related to posts of type &lt;code&gt;targetEntry&lt;/code&gt;: A, D, E.&lt;br/&gt;&#xA;When loading the detail page for A there should be a next link to D, on detail page for D there should be a next link to E and a prev link to A and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How am I able to achieve this? Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the solution for those who are too lazy to click the link in Bob Olde Hampsink's answer:&#xA;&lt;code&gt;&#xA;{% set criteria = {section: 'sourceEntry', relatedTo: craft.users } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;{% set next = entry.getNext(criteria) %}&#xA;{# …and then just insert the links… #}&#xA;&lt;/code&gt;&#xA;I feel kind of dumb now not even been trying this on my own before (although I knew about relations, but I wasn't sure how to set the criteria object properly). Thanks, Bob Olde Hampsink!&lt;/p&gt;&#xA;" OwnerUserId="3792" LastEditorUserId="3792" LastEditDate="2015-06-22T14:13:04.230" LastActivityDate="2015-06-22T14:13:04.230" Title="How to link to prev/next entry depending on related data?" Tags="&lt;relations&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10277" PostTypeId="2" ParentId="10276" CreationDate="2015-06-22T13:06:23.890" Score="1" Body="&lt;p&gt;Add the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; param to your criteria&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T13:06:23.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10278" PostTypeId="1" AcceptedAnswerId="10279" CreationDate="2015-06-22T13:09:21.440" Score="3" ViewCount="1223" Body="&lt;p&gt;Is there a way to hide or disable an entry field in the CMS so that the field still exists in the database but can not be edited by a user. The field will only ever be altered dynamically from a plugin?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="45" LastEditDate="2016-08-13T02:57:06.300" LastActivityDate="2016-08-13T06:42:00.577" Title="Disable or hide an entry field in the CMS" Tags="&lt;field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10279" PostTypeId="2" ParentId="10278" CreationDate="2015-06-22T13:12:38.497" Score="3" Body="&lt;p&gt;You could &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;inject some CSS&lt;/a&gt; to hide it specifically.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T13:12:38.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10280" PostTypeId="1" CreationDate="2015-06-22T15:15:28.017" Score="2" ViewCount="452" Body="&lt;p&gt;Has anyone experienced any issues with hotmail not receiving user confirmation emails? Our site is set up on a staging server and confirmation emails seem to work for all other email addresses we have tested apart from hotmail. Can't see anything in the logs that would suggest any problem.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-06-22T16:15:01.773" Title="User confirmation email not being received by hotmail?" Tags="&lt;users&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10281" PostTypeId="2" ParentId="10280" CreationDate="2015-06-22T16:15:01.773" Score="3" Body="&lt;p&gt;Turns out it was being rejected by Hotmail. Not appearing in junk mail being bounced at server level. Switched to using SMTP and problem solved. Possibly due to over testing with emails to the same address.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-06-22T16:15:01.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10282" PostTypeId="1" AcceptedAnswerId="10284" CreationDate="2015-06-22T17:03:40.260" Score="1" ViewCount="49" Body="&lt;p&gt;In Craft, is it possible to make an edit to an already existing (live) page but be able to set a particular point in time that you want to change to go live?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that you can set the post date and time for when you're implementing a new page but curious if there's a similar capability for implementing a change to that page after it's already live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2015-06-22T19:15:06.710" Title="How to Make a Change to an Existing Page Go Live at a Particular Point in Time" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10283" PostTypeId="2" ParentId="9419" CreationDate="2015-06-22T18:35:01.037" Score="2" Body="&lt;p&gt;There are third-party code generators, such as the &lt;a href=&quot;https://github.com/boboldehampsink/element-type-generator&quot; rel=&quot;nofollow&quot;&gt;Element Type Generator&lt;/a&gt; or the &lt;a href=&quot;https://github.com/timkelty/generator-craft-plugin&quot; rel=&quot;nofollow&quot;&gt;Craft Plugin Generator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also have the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;migration tools&lt;/a&gt; that generate code. Using the querygen command you can output Records as db query commands.&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="165" LastEditDate="2015-06-22T19:10:33.127" LastActivityDate="2015-06-22T19:10:33.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10284" PostTypeId="2" ParentId="10282" CreationDate="2015-06-22T19:15:06.710" Score="3" Body="&lt;p&gt;Currently, there is not. I've dealt with this before and I actually created 2 pages, one with the future post date, and one with an expiry date. And so the future page will become active over the page that will expire, simulating the requested functionality (although this is not the preferred method, I concur)&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T19:15:06.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10285" PostTypeId="2" ParentId="10275" CreationDate="2015-06-22T19:16:38.833" Score="4" Body="&lt;p&gt;You will have to upload the files and index them as assets, then return the asset id's to your form. You can then use these asset id's in your form so you can post them to the server, effectively creating the relations you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put up a little gist that does this for jQuery File Upload - you can use it as a reference for any other upload mechanisms: &lt;a href=&quot;https://gist.github.com/boboldehampsink/2e645655d613574ec4b7&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/boboldehampsink/2e645655d613574ec4b7&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-22T19:16:38.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10286" PostTypeId="1" AcceptedAnswerId="10383" CreationDate="2015-06-22T19:58:05.817" Score="3" ViewCount="842" Body="&lt;p&gt;Is there a way to hide a section from the Entries tab based on user permissions? Whether it means creating a user permission in a plugin, or hiding the section selection tab from Entries altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel that users with a certain permission can create entries in using a front-end form. Once created, I don't want the user to see the entry in the CP or to have the ability to edit it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to still allow them to see other entries in the &quot;All entries&quot; tab, so my original plan to hide these sections through CPCSS doesn't work. Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2015-06-27T14:35:04.023" Title="Hide section on &quot;Entries&quot; tab" Tags="&lt;entries&gt;&lt;users&gt;&lt;control-panel&gt;&lt;permissions&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10287" PostTypeId="1" AcceptedAnswerId="10289" CreationDate="2015-06-22T22:29:02.557" Score="4" ViewCount="741" Body="&lt;p&gt;A portion of my template is being cached, using the standard &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;cache tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within that cached section of the template, I'm using a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;template hook&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook 'myTemplateHook' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within that template hook, I'm collecting entry data via a normal ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'mySection';&#xA;$myEntries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering... &lt;strong&gt;Will my PHP-based query be cached?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like for the caching of this query to mimic any caching that would take place via Twig templates. &lt;strong&gt;What do I need to do to ensure this follows normal caching patterns?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great answers so far, but they don't really touch on the heart of my concern...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normal Twig-based caches actually record all &lt;em&gt;criteria&lt;/em&gt; and &lt;em&gt;elements&lt;/em&gt; used in the cached HTML, for the purpose of invalidating that cache when either of those things change. What I really want to know is, &lt;strong&gt;would my PHP-based criteria and resulting elements be recorded as well?&lt;/strong&gt; Since the criteria is built in PHP, and the elements are collected in PHP, I'd like to know if they are being stored (as they normally would via Twig).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This obviously makes a difference for cache invalidation... If an element fetched via PHP is updated or deleted, I'd like to be confident that the cache would be cleared as well.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2017-12-06T18:59:20.577" LastActivityDate="2017-12-06T20:11:14.157" Title="Template Hook + Caching" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;cache&gt;&lt;elementcriteriamodel&gt;&lt;hook&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10288" PostTypeId="1" CreationDate="2015-06-22T23:57:03.853" Score="1" ViewCount="599" Body="&lt;p&gt;Part of our go live process is to put caching in place for the site. It is a great feature. But I am unsure on the best strategy, not from a technical perspective but from a non-technical cms editor perspective...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we usually setup the cache on the header and footer includes on our templates. I like to set it up for 1 hour, that way it will clear reasonably often. That way if the editor changes some header or footer markup they just need to wait an hour for the new content to appear. Which brings me to the issue, our cms editors find this all a bit confusing, they are never sure what will be cached and what won't, if you show them how to clear the cache they end up doing it almost every edit just to be sure. Or they make edits and when it doesn't look they way they want they think it must be the cache and leave it looking odd for days before they admit something must be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do other people deal with this? I am thinking we might write a plugin to clear the entire cache on any entry save or structure modification. But this seems a bit crude.&lt;/p&gt;&#xA;" OwnerUserId="3673" LastActivityDate="2015-06-23T05:52:56.620" Title="Best Caching strategy" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10289" PostTypeId="2" ParentId="10287" CreationDate="2015-06-23T01:40:22.397" Score="3" Body="&lt;p&gt;Yes, sort of. As soon as the rendering template hits a &lt;code&gt;{% cache %}&lt;/code&gt; tag, Craft grabs the outputted content from the cache table in the database and ignores all other template logic until the &lt;code&gt;{% endcache %}&lt;/code&gt; tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the &lt;strong&gt;results&lt;/strong&gt; of the PHP-based query will be cached with the rest of whatever is between the tags only for use in that instance as HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your hook is called anywhere else, Craft will make the PHP query again, as the query itself is not cached independently. In order to accomplish that (if you want), you will need to implement some plugin-level cacheing using the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/CacheService&quot; rel=&quot;nofollow&quot;&gt;Cache Service&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For cache invalidation, here is what Brandon has to say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any time ElementCriteriaModel::find() et al. is called within &lt;code&gt;{% cache %}&lt;/code&gt; tags, it will be recorded, however you will have to manually register any elements that should be associated with the cache, using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Don't initialize the CacheService if we don't have to&#xA;$cacheService = craft()-&amp;gt;getComponent('templateCache', false);&#xA;&#xA;if ($cacheService)&#xA;{&#xA;    $cacheService-&amp;gt;includeElementInTemplateCaches($elementId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-06-23T14:01:10.187" LastActivityDate="2015-06-23T14:01:10.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10290" PostTypeId="2" ParentId="10287" CreationDate="2015-06-23T01:42:20.220" Score="2" Body="&lt;p&gt;My understanding is that the &lt;code&gt;{% cache %}&lt;/code&gt; tag operates like a conditional. If it succeeds (cache hit), then output the cached value. If it fails (cache miss), then calculate the value (run everything between the &lt;code&gt;{% cache %}&lt;/code&gt; and &lt;code&gt;{% endcache %}&lt;/code&gt; tags), cache it for later, and output it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I don't think you need to do anything special. Your hook will be run (and the result cached) only when the code inside the &lt;code&gt;{% cache %}&lt;/code&gt; tag is run, which is whenever there is a cache miss.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-23T01:42:20.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10291" PostTypeId="2" ParentId="10288" CreationDate="2015-06-23T05:52:56.620" Score="3" Body="&lt;p&gt;I am by no means a caching expert, but here's what I do know...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you wrap a chunk of Twig code in a &lt;code&gt;cache&lt;/code&gt; tag, it processes that chunk of code all the way down to HTML, then stores that HTML in the database. A cache key references this pre-parsed HTML code, so it can be easily called up later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in addition to the HTML itself, two other pieces of data are stored alongside it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A list of &lt;strong&gt;criteria&lt;/strong&gt; used to generate the HTML&lt;/li&gt;&#xA;&lt;li&gt;A list of &lt;strong&gt;elements&lt;/strong&gt; used to generate the HTML&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The main reason that criteria and elements are also recorded is for the purpose of &lt;strong&gt;cache invalidation&lt;/strong&gt;... So for example, if someone were to change an element associated with a cached chunk, that chunk would &lt;em&gt;immediately&lt;/em&gt; become invalidated. You wouldn't need to write a separate plugin in that case, the cache would be invalidated simply by updating a corresponding element. Something similar happens to criteria, if the criteria results would have changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6633/how-does-template-caching-work&quot;&gt;this question&lt;/a&gt; which I asked awhile ago... It goes into greater depth about the related caching tables, and how they work together to make sure your cache stays fresh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, make sure you've reviewed the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache#when-to-use-cache-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;official recommendations&lt;/a&gt; about the proper usage of cache tags, to figure out the best times to use (and not to use) the tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, I'd recommend taking the time to watch this excellent &lt;a href=&quot;https://straightupcraft.com/articles/the-cache-tag&quot; rel=&quot;nofollow noreferrer&quot;&gt;video from Barrel Strength Design&lt;/a&gt; about the wonders of the cache tag. There is a lot to be learned from that video, and it's a great way to get your bearings on caching in general.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-06-23T05:52:56.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10292" PostTypeId="1" AcceptedAnswerId="13449" CreationDate="2015-06-23T09:25:45.717" Score="2" ViewCount="101" Body="&lt;p&gt;I recently made &lt;a href=&quot;https://github.com/supercool/Cache-Monster&quot; rel=&quot;nofollow&quot;&gt;a plugin&lt;/a&gt; that tries to keep the existing cache warm. It does this by listening to the &lt;code&gt;elements.onBeforeSaveElement&lt;/code&gt; event, grabbing the id of that element and finding all the paths in the &lt;code&gt;craft_templatecaches&lt;/code&gt; table then calls them with Guzzle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part I'm struggling with is the element id - when the event fires I just get the id of the element that first fired, in most cases the Entry. How do I ensure I get all of the correct &lt;code&gt;cacheIds&lt;/code&gt; from the &lt;code&gt;craft_templatecacheelements&lt;/code&gt; table? I only have the one element id, is there a way of ensuring I have all of the involved element ids?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried getting element ids from &lt;code&gt;craft_relations&lt;/code&gt; by &lt;code&gt;sourceId&lt;/code&gt; but still don't seem to be able to replicate the same kind of behaviour that the native cache clearing does. When I save an entry I get a bunch of element ids in the DeleteStaleTemplateCaches Task settings but can't find a way to get that same set of ids before the element saves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm missing something fundamental ...&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2016-01-29T09:48:09.743" Title="How can I get the same element ids that the DeleteStaleTemplateCaches Task ends up with before the element has saved?" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10293" PostTypeId="1" AcceptedAnswerId="10295" CreationDate="2015-06-23T10:26:35.847" Score="2" ViewCount="655" Body="&lt;p&gt;Morning Craft folks, I've had a look and play but can't seem to find an answer for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a global variable with a company's various phone numbers in, stored in a table field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The table shows the city, then the phone number for the company's numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the navigation, I want to show just the first phone number in the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.first()&lt;/code&gt; and &lt;code&gt;.limit(1)&lt;/code&gt; don't seem to work in this situation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;    {% if companyDetails.telephoneNumbers | length %}&#xA;        {% for row in companyDetails.telephoneNumbers %}&#xA;            &amp;lt;a href=&quot;#contact-us&quot; role=&quot;menuitem&quot; aria-selected=&quot;false&quot;&amp;gt;{{ row.number }}&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;span&amp;gt;Call us&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="57" LastEditDate="2015-06-23T17:25:08.497" LastActivityDate="2015-06-23T17:25:08.497" Title="Show just the first row of a table (stored in globals)" Tags="&lt;globals&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10294" PostTypeId="1" AcceptedAnswerId="10301" CreationDate="2015-06-23T10:39:40.107" Score="3" ViewCount="706" Body="&lt;p&gt;I'm running into a nesting level error when looping through matrix blocks, and I can't quite figure out what the problem is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem arises when I use a variable to track the type of the previous element in the matrix. I want to be able to know within the sub-template that an element is the n&lt;sup&gt;th&lt;/sup&gt; of the same type (for adding a container around some matrix block types to group them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I replace line 7 below with, eg. &lt;code&gt;{% set n = (element.type == 'product') ? n + 1 : 0 %}&lt;/code&gt; (ie. a named element type rather than a variable) it works as expected, but as soon as I compare &lt;code&gt;element.type&lt;/code&gt; to &lt;code&gt;prevElementType&lt;/code&gt; I get a &lt;code&gt;Fatal error: Nesting level too deep - recursive dependency?&lt;/code&gt; error. Some of the partial templates that may be included in the loop check &lt;code&gt;prevElementType&lt;/code&gt;, but none of them modify it, so I can't see what's causing the recursion. I'd be grateful for any help with this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.contentBlocks is not empty %}&#xA;  {% set prevElementType = false %}&#xA;&#xA;  {% for element in entry.contentBlocks %}&#xA;&#xA;  {# Let's use a counter for multiple blocks of the same type: #}&#xA;  {% set n = (element.type == prevElementType) ? n + 1 : 1 %}&#xA;&#xA;  {# Include the partial for this block: #}&#xA;  {% include &quot;_pageelements/&quot; ~ element.type|lower %}&#xA;&#xA;  {# Track this element's type for the next iteration: #}&#xA;  {% set prevElementType = element.type %}&#xA;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-06-23T17:18:17.267" Title="Nesting level too deep when looping through matrix blocks" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;&lt;error&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10295" PostTypeId="2" ParentId="10293" CreationDate="2015-06-23T10:42:46.573" Score="2" Body="&lt;p&gt;&lt;code&gt;first()&lt;/code&gt; and &lt;code&gt;limit()&lt;/code&gt; are methods of the &lt;code&gt;ElementCriteriaModel&lt;/code&gt;. Since a table is not an element, but just a plain array, you should use array filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;    {% if companyDetails.telephoneNumbers | length %}&#xA;        {% for row in companyDetails.telephoneNumbers | slice(0, 1) %}&#xA;        &amp;lt;a href=&quot;#contact-us&quot; role=&quot;menuitem&quot; aria-selected=&quot;false&quot;&amp;gt;{{ row.number }}&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;    &amp;lt;span&amp;gt;Call us&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-23T10:42:46.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10297" PostTypeId="1" AcceptedAnswerId="10304" CreationDate="2015-06-23T11:40:49.083" Score="1" ViewCount="290" Body="&lt;p&gt;I am trying to add file attachments on the notification emails sent out by sprout forms plugin. Looking in the docs it looks like I need to add hidden config setting within the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a config.php file in the plugin directory and put the following code in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;&#xA;'sproutForms' =&amp;gt; 'enableFileAttachments',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I receive a notification email it still doesn't have the attachment. Can anyone suggest what I'm doing wrong? &lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2015-06-23T18:46:02.870" Title="How to add attachments to emails with sprout forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10298" PostTypeId="1" AcceptedAnswerId="10300" CreationDate="2015-06-23T13:59:48.303" Score="4" ViewCount="577" Body="&lt;p&gt;I'm looking at how best to incorporate various sets of data from another MySQL database into a Craft site. Using &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Feed Me plugin&lt;/a&gt; would be one way, if the data source had feeds, but I'm thinking about alternatives. Does this make sense:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is an Entry whose page should display data from the external DB.&lt;/li&gt;&#xA;&lt;li&gt;The admin user can, using standard Fields, select the criteria for which data it is (eg, category, number of items, timespan, etc).&lt;/li&gt;&#xA;&lt;li&gt;In the Entry's template, a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;template hook&lt;/a&gt; calls a Craft plugin.&lt;/li&gt;&#xA;&lt;li&gt;The plugin makes a request to the external DB, tidies the returned data, and renders it into the page with a twig template.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Does that make sense? Anything that sounds impossible or stupid? Can you think of a better solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10287/template-hook-caching&quot;&gt;looks like&lt;/a&gt; I could cache that part of the template so that it didn't make requests to the external DB with every page request. Is that right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For context: I haven't used hooks yet, and have only written the most basic of Craft plugins. I have years of general PHP experience, but little with Craft or Yii.)&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-23T14:33:52.313" Title="Incorporating data from an external database into Craft pages" Tags="&lt;plugins&gt;&lt;database&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10299" PostTypeId="1" CreationDate="2015-06-23T14:12:59.177" Score="1" ViewCount="76" Body="&lt;p&gt;I uploaded a couple mp4 video files via FTP. One is 3.28GB, the other is 5.53GB. I updated Asset Indexes in Settings, but they are not showing up in Assets. I checked the DB and they do not show up there either. No errors are in the logs concerning them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to get them to appear under Assets?&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-06-23T14:12:59.177" Title="Indexing Large Files in Assets" Tags="&lt;assets&gt;&lt;index&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10300" PostTypeId="2" ParentId="10298" CreationDate="2015-06-23T14:33:52.313" Score="4" Body="&lt;p&gt;That solution makes sense! I have used a similar strategy. You should absolutely cache around the template hook, or cache the database calls in the plugin itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;Yii Query Builder&lt;/a&gt; to see how Yii/Craft handles MySQL queries. You can also look at examples &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/ElementsService.php#L142&quot; rel=&quot;nofollow&quot;&gt;Craft source code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-23T14:33:52.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10301" PostTypeId="2" ParentId="10294" CreationDate="2015-06-23T17:18:17.267" Score="3" Body="&lt;p&gt;&lt;code&gt;element.type&lt;/code&gt; is not a simple string (add &lt;code&gt;{{dump(element.type)}}&lt;/code&gt; to your loop to see this). What you should use is &lt;code&gt;element.type.handle&lt;/code&gt;. So the assignment is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevElementType = element.type.handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the comparison (now of two strings, so no recursion) is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;element.type.handle == prevElementType&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-23T17:18:17.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10302" PostTypeId="1" CreationDate="2015-06-23T17:43:19.190" Score="2" ViewCount="376" Body="&lt;p&gt;i'm running centos 6.6, nginx 1.7.7, mysql and php-fpm (i believe 5.5.3) and craft 2.4.2669.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i enable a new language and let all the background tasks complete (the default data copied to the templates is english) and followed the steps here: &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/localization-guide&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the localized home page works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i've tried this, with a little luck: &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx&quot;&gt;Locales sub directories on Nginx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my language picker doesn't work right: where i send users to the localized version of the page if it exists (otherwise they go to the home page). same code works fine on my local dev (mamp). similar to: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher&quot;&gt;How can I build a language switcher?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;anyone have any luck using localization on craft with nginx? help asap please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks,&#xA;jeremy&lt;/p&gt;&#xA;" OwnerUserId="3798" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-23T20:18:14.213" Title="localization is NOT working" Tags="&lt;localization&gt;&lt;nginx&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10303" PostTypeId="2" ParentId="10286" CreationDate="2015-06-23T17:53:30.727" Score="2" Body="&lt;p&gt;Under Settings/Users, you can create user groups and set what each different group has access to. So if there is a channel or section you don't want one group touching, then you can toggle it off for that group.&lt;/p&gt;&#xA;" OwnerUserId="495" LastActivityDate="2015-06-23T17:53:30.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10304" PostTypeId="2" ParentId="10297" CreationDate="2015-06-23T18:46:02.870" Score="1" Body="&lt;p&gt;It looks like your on the right track but there may be a couple issues that we need to address:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The hidden config setting should be set in the &lt;code&gt;craft/config/general.php&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;code&gt;enableFileAttachments&lt;/code&gt; config setting should also be within an array and set to &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  'sproutForms' =&amp;gt; array(&#xA;    'enableFileAttachments' =&amp;gt; true,&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: As of this posting, we handle this functionality as a hidden config setting because we are still refining it's behavior. At some point, this will likely be easier to do directly from the Control Panel.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-06-23T18:46:02.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10305" PostTypeId="2" ParentId="1651" CreationDate="2015-06-23T18:55:13.223" Score="16" Body="&lt;p&gt;When viewing an entry, click the arrow on the save button and you'll see an option to &quot;Save as new entry&quot;. This duplicates the entry and you can immediately begin editing the new entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is what you mean by &quot;use one article as template for the others&quot; or not. It seems you can either manually create a new entry and then copy and paste content, or use this method. &lt;/p&gt;&#xA;" OwnerUserId="495" LastActivityDate="2015-06-23T18:55:13.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10307" PostTypeId="1" CreationDate="2015-06-24T00:04:47.197" Score="4" ViewCount="248" Body="&lt;p&gt;I'm trying to list out a select element with option groups and options using the awesome for macro that Pixel and Tonic created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have imported the macros and am calling the select one like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.select({&#xA;          id: 'ccs',&#xA;          label: &quot;Collection store:&quot;,&#xA;          class: '',&#xA;          name: 'fulfilmentStore',&#xA;          hasOptgroups: true,&#xA;          options: [&#xA;            {'optgroup':'North Island', 'value': 'NI1',},&#xA;            {'optgroup':'South Island'}&#xA;          ],&#xA;        }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I pretty sure I have to have another lot of options sitting under the optGroup but can't get the syntax right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2015-08-14T13:01:47.423" Title="How can I add an option group to the select Macro from CraftCMS forms macros" Tags="&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10308" PostTypeId="1" AcceptedAnswerId="10309" CreationDate="2015-06-24T00:07:12.093" Score="2" ViewCount="1778" Body="&lt;p&gt;I'm looking for a way to show or hide fields when editing an entry based on items selected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to manage a list of businesses and my plan is to have a channel to hold them all. But based on the type of business, there are different pieces of information I need to collect.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;They all have common attributes (Name, Description, Location, Phone, etc.)&lt;/li&gt;&#xA;&lt;li&gt;There are many types (Restaurant, Recreation, Venue, etc.)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Many types have subtypes, but not all (Restaurant: American, Chinese, Casual)&lt;/li&gt;&#xA;&lt;li&gt;Some have additional Info based on their type (Venu includes a list of meeting rooms with Names, Dimensions, Amenities, etc.)&lt;/li&gt;&#xA;&lt;li&gt;Businesses can have more than one type (Restaurant, Venu)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is be able to show different sets of inputs based on what categories are selected. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Check Restaurant &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reveal a list of Restaurant types, because that is relevant only to restaurants. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Check Venue&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reveal a table field type so you can enter a list of room names with corresponding features and amenities. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way in Craft, or is there a plugin that lets you run logic based on inputs to show or hide other inputs?&lt;/p&gt;&#xA;" OwnerUserId="495" LastActivityDate="2015-06-24T00:10:39.653" Title="Conditional Logic to show or hide fields in the admin?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;conditional&gt;&lt;logic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10309" PostTypeId="2" ParentId="10308" CreationDate="2015-06-24T00:10:26.867" Score="5" Body="&lt;p&gt;Check out the &lt;strong&gt;Reasons&lt;/strong&gt; plugin... sounds like exactly what you need:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft/&quot;&gt;https://github.com/mmikkel/Reasons-Craft/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-24T00:10:26.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10310" PostTypeId="2" ParentId="10308" CreationDate="2015-06-24T00:10:39.653" Score="2" Body="&lt;p&gt;There's nothing native, but this is the &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7185745-conditionals-in-field-layouts&quot; rel=&quot;nofollow&quot;&gt;highest requested feature&lt;/a&gt; on the feedback site!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there is also &lt;a href=&quot;https://straightupcraft.com/craft-plugins/reasons&quot; rel=&quot;nofollow&quot;&gt;this plugin&lt;/a&gt;, which might do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-24T00:10:39.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10311" PostTypeId="1" AcceptedAnswerId="10313" CreationDate="2015-06-24T02:20:36.987" Score="1" ViewCount="143" Body="&lt;p&gt;I'm looking to create a select (dropdown) form field that includes the days and dates for the next 14 days, starting from today, as options. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thoughts on how to construct this would be to set today &lt;code&gt;{% set today = now|date(&quot;l dS F Y&quot;) %}&lt;/code&gt; and then set a date 13 days from now &lt;code&gt;{% set finalDate = now|date_modify(&quot;+13 day&quot;)|date(&quot;l dS F Y&quot;) %}&lt;/code&gt; and then somehow put that into a range loop. It is the last part I'm having trouble getting working, if it is at all possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I have that range I would ultimately like to pass it as option values to the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10307/how-can-i-add-an-option-group-to-the-select-macro-from-craftcms-forms-macros&quot;&gt;select macro mentioned in another question&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.select({&#xA;    options: ['Today', 'Tomorrow', ...]&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-06-25T20:15:10.853" Title="How would I create a select element with the 14 days from today as options" Tags="&lt;datetime&gt;&lt;macro&gt;&lt;range&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10312" PostTypeId="1" CreationDate="2015-06-24T05:01:29.123" Score="2" ViewCount="46" Body="&lt;p&gt;Is there a JavaScript equivalent to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#namespaceInputName-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;namespaceInputName&lt;/code&gt;&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My fieldtype settings are doing some interesting JavaScript gymnastics. Part of the process involves &lt;strong&gt;creating an array on the fly&lt;/strong&gt; (so when the fields are submitted, the array will be stored properly). Currently, it's working great using JS code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;function(subfield, type, value) {&#xA;    var name = 'types[MyPlugin_MyFieldtype][dataArray][' + subfield + '][' + type + ']';&#xA;    var hidden = '&amp;lt;input type=&quot;hidden&quot; name=&quot;' + name + '&quot; value=&quot;' + value + '&quot; /&amp;gt;';&#xA;    // Then add that hidden field to the DOM&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's where it gets interesting... This prefix works great as long as I'm building a normal field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;types[MyPlugin_MyFieldtype]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, it stops working when I try to build my field &lt;em&gt;within a Matrix&lt;/em&gt;. Because when my field is nested within a Matrix, the prefix &lt;strong&gt;should&lt;/strong&gt; look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;types[Matrix][blockTypes][4][fields]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way (in JavaScript) to automatically set that prefix properly?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-24T05:01:29.123" Title="JavaScript equivalent to &quot;namespaceInputName&quot;?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;javascript&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10313" PostTypeId="2" ParentId="10311" CreationDate="2015-06-24T05:08:01.717" Score="5" Body="&lt;p&gt;You're close! If there's one thing I've learned about Twig, it's easy to overthink it... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create an array with the first date, then &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge&lt;/a&gt; the rest of dates into the same array with a for loop. Just increment the day in the range:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set rangeOfDates = [ now|date(&quot;l dS F Y&quot;) ] %}&#xA;&#xA; {% for i in range (1,13) %}&#xA;&#xA;     {% set rangeOfDates = rangeOfDates|merge( [ now|date_modify(&quot;+&quot; ~ i ~ &quot; day&quot;)|date(&quot;l dS F Y&quot;) ]) %}&#xA;&#xA;{%endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your forms macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.select({&#xA;    options: rangeOfDates&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-06-25T20:15:10.853" LastActivityDate="2015-06-25T20:15:10.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10315" PostTypeId="1" AcceptedAnswerId="10384" CreationDate="2015-06-24T10:48:45.850" Score="2" ViewCount="602" Body="&lt;p&gt;The problem is that I have a register page where I have 3 fields, Username, Email, Password. There is another page with some more fields which are required. So when I try to register a user form my register page I get errors about my required fields which I don't have in the register page. How can I skip them form cheking on my register page, but still have them as required on my profile page? Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="3602" LastEditDate="2015-06-26T11:55:38.040" LastActivityDate="2015-06-27T20:22:03.833" Title="How can I skip a required field if is not in the form?" Tags="&lt;users&gt;&lt;field&gt;&lt;frontend&gt;&lt;required&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10316" PostTypeId="1" CreationDate="2015-06-24T12:48:41.907" Score="3" ViewCount="161" Body="&lt;p&gt;I'm using the standard P&amp;amp;T contact form plugin. I have a website with 3 locales in a folder structure where every locale has its own folder:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Public&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- EN&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- FR&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- NL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The contact form has the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; data-abide&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;thanks?from={fromName}&quot;&amp;gt;&#xA;&#xA;        // Rest of code: fields, etc.&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The redirect template is called &lt;strong&gt;thanks&lt;/strong&gt; and it works as it should except that the thanks page is always redirecting to the EN locale.&#xA;When I manualy navigate my browser to go to the thank you page in another locale it works too. But after submitting the form, it just does not redirect to the current locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing &lt;code&gt;?from{fromName}&lt;/code&gt; does not resolve the issue&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;siteUrl&lt;/code&gt; is set in the config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(    &#xA;'siteUrl' =&amp;gt; array(&#xA;                'nl' =&amp;gt; 'http://cmgg.buthost.com/nl/',&#xA;                'fr' =&amp;gt; 'http://cmgg.buthost.com/fr/',&#xA;                'en' =&amp;gt; 'http://cmgg.buthost.com/en/'&#xA;            )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sidenote: the whole website is almost final and everything with the locales is working as it should except the contact form redirect.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2015-06-24T12:55:40.927" LastActivityDate="2018-08-13T03:30:44.203" Title="Contact Form Plugin P&amp;T redirect issue with locales" Tags="&lt;localization&gt;&lt;redirect&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10317" PostTypeId="1" CreationDate="2015-06-24T14:19:18.520" Score="2" ViewCount="252" Body="&lt;p&gt;Looking at the docs, i can see that the category {% nav %} loop uses the categoryGroup as the starting point. But, i want the first top level category within the category group as the starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, i want to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.slug('my-first-top-level-cat).first().getChildren() %}&#xA;&#xA;{% nav category in categories %}&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ category.title }}&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA; {% ifchildren %}&#xA;&#xA;   {% children %}&#xA;&#xA; {% endifchildren %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, doing this only returns the top level, no sub levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, i want to be able to limit the amount of children output as the there are a few sub trees.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2015-06-24T14:44:21.977" LastActivityDate="2015-06-24T15:02:46.750" Title="Category Nav tag with control over the depth that {% children %} goes" Tags="&lt;categories&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10318" PostTypeId="2" ParentId="10317" CreationDate="2015-06-24T15:02:46.750" Score="4" Body="&lt;p&gt;i did {% set categories = craft.categories.descendantOf(1066) %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then i did&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% nav category in categories.level(2) %}&#xA;{% endnav %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Always get the answer myself just after i post these damn things.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-06-24T15:02:46.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10319" PostTypeId="1" CreationDate="2015-06-24T16:32:23.227" Score="1" ViewCount="112" Body="&lt;p&gt;Say i have a url: &lt;code&gt;/lists/more-lists/even-more-lists&lt;/code&gt; and i have a route  &lt;code&gt;lists/more-lists/*&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i hit &lt;code&gt;example.com/lists/more-lists/even-more-lists&lt;/code&gt; then it tries to load the index template (not the template defined by my route)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i hit  &lt;code&gt;example.com/lists/more-lists/foo&lt;/code&gt; then it loads the template defined by my template route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add, that the url segments are category url's.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-07-25T15:43:52.890" Title="Template routes not respecting URL" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10320" PostTypeId="1" AcceptedAnswerId="10322" CreationDate="2015-06-24T17:50:05.080" Score="1" ViewCount="1748" Body="&lt;p&gt;I'm moving a craft install from a development to production server and am getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ERROR ERROR&#xA;Craft can’t connect to the database with the credentials in craft/config/db.php.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've triple checked the db credentials and permissions and everything is correct. Here's my db.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// uncommenting this gives me a 'connected okay' so I know that the credentials are correct.&#xA;// if ($con=mysqli_connect(&quot;localhost&quot;,&quot;thandtho_db&quot;,&quot;*********&quot;,&quot;thandtho_production&quot;)) // {&#xA;//  die('connected okay');&#xA;// } else {&#xA;//  die('couldn\'t connect');&#xA;// } &#xA;&#xA;/**&#xA; * Database Configuration&#xA; *&#xA; * All of your system's database configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA; */&#xA;&#xA;// Import your local config settings&#xA;require( 'config.local.php' );&#xA;&#xA;return array(&#xA;    '*'=&amp;gt; array(&#xA;        // Database Info&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    // Production Domain&#xA;    '9thandthomas.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'thandtho_db',&#xA;        'password' =&amp;gt; '***********',&#xA;        'database' =&amp;gt; 'thandtho_production'&#xA;    ),&#xA;    ),&#xA;    // Dev&#xA;    '9thandthomas.transomco.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'ninththomas_dev',&#xA;        'password' =&amp;gt; '4iJoi58@',&#xA;        'database' =&amp;gt; 'ninththomas_dev'&#xA;    ),&#xA;    // Local&#xA;    // Needs to be placed after production since subdomain&#xA;    // is similar to production domain name.&#xA;    $localConfig['envUrl'] =&amp;gt;  array (&#xA;        'server' =&amp;gt; $localDatabase['server'],&#xA;        'user' =&amp;gt; $localDatabase['user'],&#xA;        'password' =&amp;gt; $localDatabase['password'],&#xA;        'database' =&amp;gt; $localDatabase['database'],&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;************************** ANSWER **************************&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I moved the database details from beneath the * and it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;db.php now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;/**&#xA; * Database Configuration&#xA; *&#xA; * All of your system's database configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA; */&#xA;&#xA;// Import your local config settings&#xA;require( 'config.local.php' );&#xA;&#xA;return array(&#xA;    '*'=&amp;gt; array(&#xA;        // Database Info&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    // Production Domain&#xA;    '9thandthomas.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'thandtho_db',&#xA;        'password' =&amp;gt; 'wR39fy2!k',&#xA;        'database' =&amp;gt; 'thandtho_production'&#xA;    ),&#xA;    // Dev&#xA;    '9thandthomas.transomco.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'ninththomas_dev',&#xA;        'password' =&amp;gt; '4iJoi58@',&#xA;        'database' =&amp;gt; 'ninththomas_dev'&#xA;    ),&#xA;    // Local&#xA;    // Needs to be placed after production since subdomain&#xA;    // is similar to production domain name.&#xA;    $localConfig['envUrl'] =&amp;gt;  array (&#xA;        'server' =&amp;gt; $localDatabase['server'],&#xA;        'user' =&amp;gt; $localDatabase['user'],&#xA;        'password' =&amp;gt; $localDatabase['password'],&#xA;        'database' =&amp;gt; $localDatabase['database'],&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3808" LastEditorUserId="3808" LastEditDate="2015-06-24T18:03:55.170" LastActivityDate="2015-06-25T06:47:29.433" Title="Need help troubleshooting DB connection" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10321" PostTypeId="1" AcceptedAnswerId="10370" CreationDate="2015-06-24T17:55:30.587" Score="8" ViewCount="2159" Body="&lt;p&gt;Previously on EE I've used Low Search to generate a filter based search form, based on categories. But with Craft I can't seem to find an add-on - Or even know if I need one!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to achieve is a filer menu with categories e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ ] Category 1&#xA;[x] Category 2&#xA;[ ] Category 3&#xA;[x] Category 4&#xA;   [ ] Category 4.1&#xA;   [ ] Category 4.2&#xA;[ ] Category 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been reading over the documentation over at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/search-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/search-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm struggling to see how I can make this work within a search form itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking I can generate a query fine to search the categories. But I can't work out how to link what is checked with a query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be gooooood :)&lt;/p&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="3951" LastEditDate="2017-10-24T15:24:36.117" LastActivityDate="2017-10-24T15:24:36.117" Title="Filter based Search Form" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10322" PostTypeId="2" ParentId="10320" CreationDate="2015-06-24T17:57:36.413" Score="3" Body="&lt;p&gt;I had a similar issue where my '*' was being chosen all of the time, meaning all my environments used the same DB details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly try splitting it up, and not have a '*' for your DB details, for any environment?&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2015-06-24T17:57:36.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10323" PostTypeId="2" ParentId="10321" CreationDate="2015-06-24T19:02:21.797" Score="3" Body="&lt;p&gt;Well, would this be what you are looking for? - &lt;a href=&quot;https://github.com/iainurquhart/FacetedNav_CraftPlugin&quot; rel=&quot;nofollow&quot;&gt;https://github.com/iainurquhart/FacetedNav_CraftPlugin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-06-24T19:02:21.797" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10324" PostTypeId="1" AcceptedAnswerId="10342" CreationDate="2015-06-24T19:51:36.940" Score="0" ViewCount="194" Body="&lt;p&gt;I've got a structure setup, and one of the entries under it is called &quot;Our people&quot; at the top level, in the &quot;About&quot; structure. So the url would look like this: &lt;code&gt;/about/our-people&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a template setup at: &lt;code&gt;craft/templates/about/our-people.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When browsing &lt;code&gt;/about/our-people&lt;/code&gt; it does not route there, though &lt;code&gt;/about/our-people.html&lt;/code&gt; works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general config I have &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&lt;/code&gt; set.&#xA;Only weird thing I have is a &quot;Single&quot; entry is setup to deal with the top level &quot;about&quot; page viewable at &lt;code&gt;/about&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2015-06-25T07:05:37.843" Title="need file extension in url to access template" Tags="&lt;templating&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10325" PostTypeId="1" AcceptedAnswerId="10332" CreationDate="2015-06-24T20:09:48.403" Score="1" ViewCount="203" Body="&lt;p&gt;I have a page with a slider on it, which includes three rotating slides. In Craft, I am currently setting up each slide as an entry under a &quot;Home Page Content&quot; channel, and then creating an entry field for them on the home page single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that the simplest/correct way to do it? Is there an alternate way that allows me to enter the number of slides and the information for each directly on the home page single?&lt;/p&gt;&#xA;" OwnerUserId="3801" LastActivityDate="2015-06-24T20:54:08.100" Title="Organizing repeating content on a single page" Tags="&lt;relations&gt;&lt;structure&gt;&lt;channels&gt;&lt;singles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10326" PostTypeId="1" AcceptedAnswerId="18782" CreationDate="2015-06-24T20:09:53.673" Score="16" ViewCount="1678" Body="&lt;p&gt;Are there any Craft 3 plugins yet? They would be useful as examples for porting/writing other Craft 3 plugins.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="45" LastEditDate="2016-09-20T02:38:59.427" LastActivityDate="2019-05-31T18:05:57.930" Title="Are there any plugins for Craft 3?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" CommunityOwnedDate="2015-06-24T20:46:51.863" ContentLicense="CC BY-SA 3.0" />
  <row Id="10327" PostTypeId="2" ParentId="10326" CreationDate="2015-06-24T20:09:53.673" Score="11" Body="&lt;p&gt;Here are some.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/StoreHours/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;Store Hours (P&amp;amp;T)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-mn_matchinput/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;match input&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/Mandrill&quot; rel=&quot;nofollow&quot;&gt;Mandrill (P&amp;amp;T)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;Entry Count&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nystudio107/minify/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;Minify&lt;/a&gt; (9/17/2016)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;MN Twig Perversion&lt;/a&gt; (9/19/2016)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/aelvan/Stamp-Craft/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;Stamp&lt;/a&gt; (9/21/2016)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/aelvan/Inlin-Craft/tree/craft3&quot; rel=&quot;nofollow&quot;&gt;Inlin&lt;/a&gt; (9/21/2016)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Mention more in the comments, and I will add to this list.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2016-09-23T21:35:49.393" LastActivityDate="2016-09-23T21:35:49.393" CommentCount="1" CommunityOwnedDate="2015-06-24T20:46:51.863" ContentLicense="CC BY-SA 3.0" />
  <row Id="10328" PostTypeId="2" ParentId="10325" CreationDate="2015-06-24T20:39:07.510" Score="1" Body="&lt;p&gt;You could use a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix Field&lt;/a&gt;! Each block in your matrix field can be a slide with whatever information you need inside. While your method will work fine, using a matrix will help keep your content organized on a single entry.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-24T20:39:07.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10329" PostTypeId="1" CreationDate="2015-06-24T20:40:18.400" Score="2" ViewCount="252" Body="&lt;p&gt;I have a job board running on Craft. We're &quot;auto expiring&quot; the posts from listing pages based on the post date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to redirect the actual entry page to either a 'this job has expired' page in cases where some one is linking from an external site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible? &lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2015-06-24T20:56:03.303" LastActivityDate="2015-06-25T18:57:28.460" Title="Redirect 'expired' or deleted entries" Tags="&lt;templating&gt;&lt;entries&gt;&lt;error-templates&gt;&lt;expired&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10330" PostTypeId="1" AcceptedAnswerId="10333" CreationDate="2015-06-24T20:41:17.303" Score="1" ViewCount="898" Body="&lt;p&gt;Here's my code block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;p&amp;gt;TEST EDIT 8&amp;lt;/p&amp;gt;&#xA;        {% for block in entry.blogPost %}&#xA;            &amp;lt;p&amp;gt;heading - {{ block.heading }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;sub heading - {{ block.subHeading }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;accolade- {{ block.accolade }}&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iZ3vj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the error message I am getting on an inconsistent basis:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;heading&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've tried to remove the other Matrix fields from the template, and just isolate on the 'block.heading' field, and I get really strange behaviors. Sometimes the template renders fine, and the dynamic value gets rendered by the page. Sometimes, with a different content entry, the same template gives the above error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm brand new to CraftCMS. Is there an obvious syntax mistake I'm making?&lt;/p&gt;&#xA;" OwnerUserId="3809" LastActivityDate="2015-06-24T21:27:59.837" Title="confused by inconsistent behavior of matrix" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10331" PostTypeId="2" ParentId="10329" CreationDate="2015-06-24T20:45:30.293" Score="3" Body="&lt;p&gt;Hadn't thought about using simple &lt;code&gt;if&lt;/code&gt; logic here in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.postDate &amp;lt;= now|date_modify('-90 days') %}&#xA;    {% redirect 'jobs/expired' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2015-06-25T18:39:51.900" LastActivityDate="2015-06-25T18:39:51.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10332" PostTypeId="2" ParentId="10325" CreationDate="2015-06-24T20:54:08.100" Score="1" Body="&lt;p&gt;I tend to use individual Entries within a Structure for slider / slideshow type content when I think the users will want to temporarily disable a slide and re-enable it in the future or for users that will want to schedule slides to be shown / expire at certain times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other times I use a Matrix Field because I have found that most people like to see all of that kind of content in one place.&lt;/p&gt;&#xA;" OwnerUserId="2191" LastActivityDate="2015-06-24T20:54:08.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10333" PostTypeId="2" ParentId="10330" CreationDate="2015-06-24T21:27:59.837" Score="5" Body="&lt;p&gt;Since you have 3 block types in your Matrix, you need to check for the block type before trying to call an inner field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;p&amp;gt;TEST EDIT 8&amp;lt;/p&amp;gt;&#xA;        {% for block in entry.blogPost %}&#xA;            {% if block.type == 'imageCaption' %}&#xA;                &amp;lt;p&amp;gt;heading - {{ block.heading }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p&amp;gt;sub heading - {{ block.subHeading }}&amp;lt;/p&amp;gt;&#xA;            {% elseif block.type == 'WhateverTypeAccoladeIsIn' %}&#xA;                &amp;lt;p&amp;gt;accolade- {{ block.accolade }}&amp;lt;/p&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should add that check before &lt;code&gt;block.accolade&lt;/code&gt; as well for whichever block type accolade is in.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-24T21:27:59.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10335" PostTypeId="1" AcceptedAnswerId="10445" CreationDate="2015-06-24T23:51:06.810" Score="2" ViewCount="294" Body="&lt;p&gt;When trying to login to the administration section on a server running &lt;a href=&quot;https://www.litespeedtech.com&quot; rel=&quot;nofollow&quot;&gt;LiteSpeed&lt;/a&gt;, half the time LiteSpeed triggers a 403 Forbidden message and locks that computer out of the entire server Craft is running on. I'm assuming Craft is doing something that LiteSpeed deems as suspicious but I have no idea what that could be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently trying to get access to the logs but the host is taking it's sweet time. In an ideal world I would just find another host but in this situation that's just not feasible. I'm pulling my hair out trying to get this to work, and I found love with Craft that I don't want to deny.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could point me in the right direction I would be so grateful!&lt;/p&gt;&#xA;" OwnerUserId="3811" LastActivityDate="2015-07-01T23:39:15.577" Title="Craft CMS and LiteSpeed (403 error on login)" Tags="&lt;error&gt;&lt;login&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10336" PostTypeId="1" CreationDate="2015-06-25T00:10:07.230" Score="3" ViewCount="648" Body="&lt;p&gt;I'm creating a multi-page form on the front end of a site where different data is added to the entry depending on the page they are on. Originally I was going to create the entries using P&amp;amp;T's guest entries, but that doesn't allow the user to edit an entry once it's submitted, so I created a plugin based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/583/how-do-i-save-a-matrix-field-with-an-asset-block-programmatically&quot;&gt;this question&lt;/a&gt; to handle saving the entry as a user with sufficient privileges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is that once a user submits new data from the front-end that doesn't include the data already saved to the entry, the previously saved information is erased. I am hoping to avoid including the existing data on each submission to keep things easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use something similar &lt;code&gt;$entry-&amp;gt;setContentFromPost('fields');&lt;/code&gt; while updating existing entries?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Plugin_Controller extends BaseController&#xA;{&#xA;    /**&#xA;     * @var Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionSaveEntry()&#xA;    {       &#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        $entryId = craft()-&amp;gt;userSession-&amp;gt;getState('entryId');&#xA;&#xA;        $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;        if (!$entry)&#xA;        {&#xA;            // Fields&#xA;            $entry = new EntryModel();&#xA;            $entry-&amp;gt;sectionId  = 1;&#xA;            $entry-&amp;gt;locale     = 'en_us';&#xA;            $entry-&amp;gt;postDate   = date('Y-m-d');&#xA;            $entry-&amp;gt;authorId   = 1;&#xA;        }&#xA;&#xA;        // Tell our content model where to look for custom fields&#xA;        $entry-&amp;gt;setContentFromPost('fields');&#xA;&#xA;        // Content&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = &quot;Title&quot;;&#xA;&#xA;        // Save the entry content&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Front-end Form&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;plugin/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/builder?step={{ nextStep }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; value=&quot;{{ title }}&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrix][new1][type]&quot; value=&quot;service&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrix][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrix][new1][fields][entry]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[matrix][new1][fields][entry][]&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;    &amp;lt;button&amp;gt;Update&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how I could accomplish this with the least amount of non-core code possible?&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-25T00:10:07.230" Title="What's the easiest way to update an entry from the front end as a guest user and only post the data that needs to be updated?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;entrymodel&gt;&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10337" PostTypeId="1" CreationDate="2015-06-25T00:10:25.560" Score="3" ViewCount="999" Body="&lt;p&gt;I just need to return the latitude and longitude of my Google Maps marker.  I do not want to make a request to Google, nor do I need to display a map with javascript.  I need to create markers inside of blog entries and only return the coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can the Google Maps plugin do this?  Can I pass the lat and lng to text fields when i save the entry?&lt;/p&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2015-06-30T20:48:58.877" Title="Google Maps Plugin return coordinates" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10338" PostTypeId="1" AcceptedAnswerId="10339" CreationDate="2015-06-25T00:21:16.190" Score="1" ViewCount="464" Body="&lt;p&gt;In a custom plugin, I'm able to easily add a new Category:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$category = new CategoryModel();&#xA;$category-&amp;gt;groupId = 1;&#xA;$category-&amp;gt;getContent()-&amp;gt;title = $categoryName;&#xA;craft()-&amp;gt;categories-&amp;gt;saveCategory($category);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That part works great! But for some reason, I can't figure out how to save a &lt;strong&gt;nested&lt;/strong&gt; category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd imagine it's something like this, but it doesn't seem to be working:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$childCategory = new CategoryModel();&#xA;$childCategory-&amp;gt;groupId = 1;&#xA;$childCategory-&amp;gt;level = 2;&#xA;$childCategory-&amp;gt;parent = $parentCategory-&amp;gt;id;&#xA;$childCategory-&amp;gt;getContent()-&amp;gt;title = $childCategoryName;&#xA;craft()-&amp;gt;categories-&amp;gt;saveCategory($childCategory);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that code is giving me an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Trying to get property of non-object&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And if I drop the &lt;code&gt;-&amp;gt;id&lt;/code&gt; portion of this line:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$childCategory-&amp;gt;parent = $parentCategory;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... it will save the category, but it &lt;em&gt;won't be nested&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am I doing wrong?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-11-04T16:53:21.327" Title="Create nested Category via PHP" Tags="&lt;plugin-development&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10339" PostTypeId="2" ParentId="10338" CreationDate="2015-06-25T00:53:35.157" Score="5" Body="&lt;p&gt;Assuming &lt;code&gt;$parentCategory&lt;/code&gt; is an existing &lt;code&gt;CategoryModel&lt;/code&gt; (your error says that &lt;code&gt;$parentCategory&lt;/code&gt; is not an object):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$childCategory = new CategoryModel();&#xA;$childCategory-&amp;gt;groupId = 1;&#xA;$childCategory-&amp;gt;newParentId = $parentCategory-&amp;gt;id;&#xA;$childCategory-&amp;gt;getContent()-&amp;gt;title = $childCategoryName;&#xA;&#xA;craft()-&amp;gt;categories-&amp;gt;saveCategory($childCategory);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see how Craft does it for it's own categories in &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/CategoriesController.php#L360&quot; rel=&quot;nofollow noreferrer&quot;&gt;CategoriesController-&gt;saveCategory()&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/classreference/services/CategoriesService#saveCategory-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;CategoriesService-&gt;saveCategory()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="5818" LastEditDate="2016-11-04T16:53:21.327" LastActivityDate="2016-11-04T16:53:21.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10341" PostTypeId="2" ParentId="10320" CreationDate="2015-06-25T06:47:29.433" Score="3" Body="&lt;p&gt;Assuming that really was your db.php, you have &lt;code&gt;'9thandthomas.com'&lt;/code&gt; &lt;em&gt;inside&lt;/em&gt; the &lt;code&gt;*&lt;/code&gt; array, not &lt;em&gt;beneath&lt;/em&gt; it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    ...&#xA;    '9thandthomas.com' =&amp;gt; array( ... )&#xA;  ),&#xA;  // '9thandthomas.com' SHOULD BE HERE&#xA;  ...&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-25T06:47:29.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10342" PostTypeId="2" ParentId="10324" CreationDate="2015-06-25T07:05:37.843" Score="3" Body="&lt;p&gt;The documentation for how Craft picks a template is &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Two of the relevant steps are:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;4&quot;&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Is it an entry/category request?&lt;/strong&gt;&#xA;  If the URI matches an entry’s or category’s URI, the section’s/category group’s template will get loaded, and the matched element will be made available to the template via a pre-populated entry or category variable.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;6&quot;&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Does the URI match a template?&lt;/strong&gt;&#xA;  Finally, Craft will see if the URI is a valid template path. If it is, it will return the matched template.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/about/our-people&lt;/code&gt; matches #4, and you get the &lt;code&gt;about/_entry.html&lt;/code&gt; template. &lt;code&gt;/about/our-people.html&lt;/code&gt; matches #6, so you get the &lt;code&gt;about/our-people.html&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing is that Craft uses the &lt;strong&gt;first&lt;/strong&gt; rule that matches.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-25T07:05:37.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10343" PostTypeId="1" AcceptedAnswerId="10353" CreationDate="2015-06-25T08:55:14.407" Score="1" ViewCount="751" Body="&lt;p&gt;I'm working on creating a simple calendar based on only native Craft fields. While coding this, I'm having a hard time getting the pagination to work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The calendar currently lists all upcoming events this current month. Next/Previous should then paginate the calendar 1 full month forward/backward (not 1 month backwards from todays date, but all entries in the next/previous month).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Brandon, paginate.prevUrl/nextUrl won't map to specific date-based starting points. So, how do I tackle this problem then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;small-12 medium-12 large-12 columns&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;widget_event single_widget box_shadow&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;Hva skjer i Filadelfia&amp;lt;/h3&amp;gt;&#xA;&#xA;            {% set startDateTime = now|date_modify('0:00')|date('c') %}&#xA;            {% set endDateTime = now|date_modify('first day of next month 4:00')|date('c') %}&#xA;&#xA;            {% set startDateParam = 'and, &amp;gt;= ' ~ startDateTime ~ ', &amp;lt; ' ~ endDateTime %}&#xA;&#xA;            {% set events = craft.entries.section('calendar').limit('15').startDate(startDateParam).order('startDate asc') %}&#xA;&#xA;{% for event in events %}&#xA;    &amp;lt;div class=&quot;event_list&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;single_event&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;date_left&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;date&quot;&amp;gt;{{ event.startDate | date(&quot;d&quot;) }}.&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;day&quot;&amp;gt;{{ event.startDate | date(&quot;M&quot;) }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;title_middle&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;title&quot;&amp;gt;{{ event.title }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;desc&quot;&amp;gt;{{ event.body | hacksaw(words='75', allow='&amp;lt;b&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;i&amp;gt;&amp;lt;em&amp;gt;') }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;time&quot;&amp;gt;{{ event.startDate | date(&quot;H:i&quot;) }}&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA;{% paginate craft.entries.section('calendar').limit(15) as pageEvents %}&#xA;    {% for month, entries in pageEvents | group(&quot;postDate | date('F')&quot;) %}&#xA;        &amp;lt;div class=&quot;event_nav text-center&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;left left_arrow&quot;&amp;gt;{% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous Month&amp;lt;/a&amp;gt;{% endif %}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;right right_arrow&quot;&amp;gt;{% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next Month&amp;lt;/a&amp;gt;{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="346" LastActivityDate="2015-06-27T16:43:04.140" Title="Paginate based on date-based starting points" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10344" PostTypeId="1" AcceptedAnswerId="10345" CreationDate="2015-06-25T10:35:23.900" Score="2" ViewCount="1083" Body="&lt;p&gt;&lt;strong&gt;This question is a summary of my working with tags yesterday, I'm posting my findings to SE so other people can benefit.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the purposes of this question, I'm going to be using a tag with the title 'Two Words'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to add a tags listing and filtering system to a blog. As tags don't have a 'slug' property, I've been having issues using them in URLs. If I use the following links:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;    &amp;lt;a href=&quot;/news/tags/{{ tag.title }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you get unfriendly urls such as &lt;code&gt;http://craft.dev/news/tags/Two%20Words&lt;/code&gt;. If I use :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search(craft.request.getSegment(3)) %}&#xA;{% for entry in craft.entries.relatedTo(tag) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get a list of articles that may contain the term &quot;two words&quot;, but aren't actually tagged with &lt;code&gt;Two Words&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to list articles related to the tag in the URL, so how can I pull the specific tag from the url, making sure it stays 'url-friendly'?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-05-05T19:57:43.143" Title="How can I use tag slugs in URLs?" Tags="&lt;entries&gt;&lt;relations&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10345" PostTypeId="2" ParentId="10344" CreationDate="2015-06-25T10:35:23.900" Score="4" Body="&lt;p&gt;The key to this is to use the &lt;code&gt;|kebab&lt;/code&gt; filter and the &lt;code&gt;relatedTo&lt;/code&gt; params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Listing:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in relatedTags %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/news/tags/{{ tag.title|kebab }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fetch related articles&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search(craft.request.getSegment(4)) %}&#xA;&#xA;{% for entry in craft.entries.relatedTo({ targetElement: tag[0], field: tagField }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;tag[0]&lt;/code&gt; is necessary, as &lt;code&gt;{{ craft.tags.search() }}&lt;/code&gt; will return an array (even if there's only one tag returned).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This finds entries that are specifically related to &lt;code&gt;Two Words&lt;/code&gt; (a tag object, pulled from the URL), and searches in the &lt;code&gt;tagField&lt;/code&gt; specified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative to the above is to use &lt;code&gt;{{ tag.id }}&lt;/code&gt; and &lt;code&gt;{{ craft.tags.id() }}&lt;/code&gt;, but that isn't URL/SEO friendly.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-06-25T10:35:23.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10346" PostTypeId="1" CreationDate="2015-06-25T13:30:21.367" Score="0" ViewCount="76" Body="&lt;p&gt;I have a template inside a folder located in &lt;code&gt;/templates&lt;/code&gt; that is not related to any entry or section:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/folder/test.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set title            = 'myTitle' %}&#xA;{% set description      = 'myDescription' %}&#xA;{% set variable3        = 'hello' %}&#xA;&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ description }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I want to create a link to this page, I can use the &lt;code&gt;url()&lt;/code&gt; function like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url('folder/test') }}&quot;&amp;gt;test&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I access the variables declared on this page?&lt;/p&gt;&#xA;" OwnerUserId="3606" LastEditorUserId="642" LastEditDate="2015-06-25T15:16:29.140" LastActivityDate="2015-06-25T15:16:29.140" Title="How can I access variables only declared in a template?" Tags="&lt;url&gt;&lt;variable&gt;&lt;function&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10347" PostTypeId="2" ParentId="10346" CreationDate="2015-06-25T14:02:16.440" Score="1" Body="&lt;p&gt;I don't think you can. I think the best way to access 'unattached' variables is to create a global field set and attach fields to it. That way you'll be able to access them anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ globalSet1.title }}&lt;/code&gt;&#xA;&lt;code&gt;{{ globalSet1.description }}&lt;/code&gt;&#xA;&lt;code&gt;{{ globalSet1.variable3 }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-06-25T14:02:16.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10348" PostTypeId="2" ParentId="10073" CreationDate="2015-06-25T14:29:24.897" Score="3" Body="&lt;p&gt;Script tags should be put in plain text field types (if they need to be editable by the client at all, otherwise put them in the templates).&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2015-06-26T09:52:09.367" LastActivityDate="2015-06-26T09:52:09.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10349" PostTypeId="1" CreationDate="2015-06-25T14:30:02.317" Score="2" ViewCount="1241" Body="&lt;p&gt;We've set up a task that's supposed to run through an external folder with images and resize them into 3 sizes each. This results in about 13000 tasks (one task per image). I thought each task was on a separate thread? But now the tasks are running for only 60 seconds (max_execution_time), then stopping. The task says &lt;code&gt;running&lt;/code&gt; in the database, but it has just stopped, and the error log says max execution time was exceeded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way around this? Would sub tasks change any behaviour?&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-10-23T20:39:14.660" Title="Problems with tasks and max execution time" Tags="&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10350" PostTypeId="2" ParentId="10319" CreationDate="2015-06-25T14:50:00.293" Score="2" Body="&lt;p&gt;So, if a category section has &quot;has it's own url's&quot; ticked, then the template defined there will take precedence over the custom route. Custom routes i'm told are a fallback and will not override already set routing.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-06-25T14:50:00.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10351" PostTypeId="1" CreationDate="2015-06-25T15:14:57.360" Score="1" ViewCount="151" Body="&lt;p&gt;I am new to Craft and have a decent handle on the basics, but I am struggling a little getting this to work.  Here is what I would like to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a banner with bxslider which will be looping through images in a matrix field.  This is for a church site and this template will be used for all their ministries.  Each ministry will have it's own photos, but right now assets is returning images for all entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif craft.request.segment(2) == &quot;crosstrainers&quot; %}&#xA;&#xA;&amp;lt;div class=&quot;banner-slider-block&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;banner-slider-list&quot;&amp;gt;&#xA;&#xA;        {% for entry in craft.entries&#xA;            .section('site_content')&#xA;            .find() &#xA;        %}&#xA;&#xA;        {% for block in entry.slider %}     &#xA;        &amp;lt;li&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;banner-slide-block&quot;&amp;gt;&#xA;&#xA;                    {% for image in block.sliderImage.limit(1) %}&#xA;                        &amp;lt;img class=&quot;slider-image&quot; src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;                    {% endfor %}&#xA;&#xA;                    &amp;lt;div class=&quot;page-wrapper&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;slider-text-box {{ block.sliderTextBoxLocation }}&quot;&amp;gt;&#xA;&#xA;                            &amp;lt;h3 class=&quot;slider-header&quot;&amp;gt;{{ block.sliderHeader}}&amp;lt;/h3&amp;gt;&#xA;&#xA;                            &amp;lt;p class=&quot;slider-text&quot;&amp;gt;{{ block.sliderText}}&amp;lt;/p&amp;gt;&#xA;&#xA;                            &amp;lt;a class=&quot;slider-button&quot; href=&quot;&quot;&amp;gt;&amp;lt;div class=&quot;linked-button&quot;&amp;gt;{{ block.sliderButtonText}}&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                    &amp;lt;/div&amp;gt;          &#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to limit the asset results to each ministry.&lt;/p&gt;&#xA;" OwnerUserId="3816" LastActivityDate="2015-06-25T17:36:02.770" Title="Using categories to filter assets" Tags="&lt;assets&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10352" PostTypeId="1" AcceptedAnswerId="10354" CreationDate="2015-06-25T15:52:52.307" Score="3" ViewCount="718" Body="&lt;p&gt;I am fairly new to Craft CMS coming from ruby on rails and angularjs.  I am running into an issue with attempting to display images on a home page based on whether or not the radio button titled &quot;featured&quot; ( a field) is selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have searched around but was unable to find something addressing this, or at least in a way I understood to solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying variations of... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if thumbnails.featured %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...hoping it would only display what has &quot;featured&quot; selected but it either breaks and shows nothing or shows all the images.  Based on what I have found I think I have to &quot;set&quot; something but am unable to figure out exactly how that is set up.  This is exactly what I have right now and it is showing all images.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for thumbnails in craft.assets.thumbnails %}&#xA;    {% if thumbnails.featured %}&#xA;        &amp;lt;div class=&quot;rollover-item wd ux dv print&quot;&amp;gt;              &#xA;            &amp;lt;img src=&quot;assets/img/{{ thumbnails.filename }}&quot; alt=&quot;{{ thumbnails.filename }}&quot;&amp;gt;&#xA;                    &amp;lt;a class=&quot;preview&quot; href=&quot;work/{{ thumbnails.clientname }}&quot;&amp;gt;{{ thumbnails.caption }}&amp;lt;/a&amp;gt;                     &#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone could suggest a solution or even point me in the right direction it would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="22" LastEditDate="2017-05-09T23:52:46.047" LastActivityDate="2017-05-09T23:52:46.047" Title="How to filter what is showed based on radio button checked" Tags="&lt;templating&gt;&lt;filter&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10353" PostTypeId="2" ParentId="10343" CreationDate="2015-06-25T16:05:40.230" Score="1" Body="&lt;p&gt;Instead of using pagination you might want to look into setting up a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; in the format &quot;calendar/[year]/[month]&quot;. Adding 'year' and 'month' tags to your route will essentially pass those values as named variables to your template, which you can use to retrieve and display entries, as well as generate navigation to next/previous month's events. If you want the uri '/calendar' (without the 'year/month' uri segments) to link to the current months events you can test for the existence of the 'year' and 'month' variables, and if not defined, set the start month to the first day of the current month.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if year is defined and month is defined %}&#xA;    {% set startMonth = year ~ '-' ~ month ~ '-' ~ 1 %}&#xA;{% else %}&#xA;    {% set startMonth = now|date_modify(&quot;first day of this month&quot;) %}&#xA;{% endif %}&#xA;{% set nextMonth = startMonth|date_modify('+1 month')) %}&#xA;{% set previousMonth = startMonth|date_modify('-1 month')) %}&#xA;&#xA;{% set entries = craft.entries.section('calendar').postDate('and', '&amp;gt;= ' ~ startMonth, '&amp;lt; ' ~ nextMonth %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'events/' ~ nextMonth|date(&quot;Y/n&quot;) }}&quot;&amp;gt;next month&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'events/' ~ previousMonth|date(&quot;Y/n&quot;) }} &quot;&amp;gt;previous month&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If required, within any month you could also use a pagination tag if you needed to limit the number of events displayed on any one page to 15.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For additional examples see these answers, &lt;a href=&quot;https://craftcms.stackexchange.com/a/5456/784&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/9527/784&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-06-27T16:43:04.140" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10354" PostTypeId="2" ParentId="10352" CreationDate="2015-06-25T16:46:24.603" Score="1" Body="&lt;p&gt;You will want to first create an 'elementCriteriaModel' to retrieve only the 'featured' images from the 'thumbnails' asset group, which will return an array like object (not technically an array) which you can loop through to display.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets.group('thumbnails').featured(1) %}&#xA;{% for image in images %}&#xA;    &amp;lt;div class=&quot;rollover-item wd ux dv print&quot;&amp;gt;              &#xA;        &amp;lt;img src=&quot;assets/img/{{ image.filename }}&quot; alt=&quot;{{ image.filename }}&quot;&amp;gt;&#xA;        &amp;lt;a class=&quot;preview&quot; href=&quot;work/{{ image.clientname }}&quot;&amp;gt;{{ image.caption }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another method that might be easier to manage from a client perspective is to add an &lt;code&gt;assets&lt;/code&gt; fieldType to your homepage section (called 'featuredImages' or whatever; limited of course to the 'thumbnails' asset group) which the client can use to add and/or reorder the featured thumbnails to be displayed. In which case the code would look something more like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.featuredImages|length %}&#xA;    {% for image in entry.featuredImages %}&#xA;        &amp;lt;div class=&quot;rollover-item wd ux dv print&quot;&amp;gt;              &#xA;            &amp;lt;img src=&quot;assets/img/{{ image.filename }}&quot; alt=&quot;{{ image.filename }}&quot;&amp;gt;&#xA;            &amp;lt;a class=&quot;preview&quot; href=&quot;work/{{ image.clientname }}&quot;&amp;gt;{{ image.caption }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-06-25T16:54:05.453" LastActivityDate="2015-06-25T16:54:05.453" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10355" PostTypeId="2" ParentId="10351" CreationDate="2015-06-25T17:36:02.770" Score="1" Body="&lt;p&gt;From your example, it is a bit hard to tell how your site is organized, but it sounds like you want to set up content specific to each ministry (which is stored in the top-level of your &quot;site_content&quot; structure?), which will be shared across all of that ministry's sub-pages. Regardless, you will essentially want to retrieve the entry where the slider data is stored, and loop through the matrix data from there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segment(2) == &quot;crosstrainers&quot; %}&#xA;    {% set entry = craft.entries.section('site_content').slug('crosstrainers') %}&#xA;    {% for block in entry.slider %}&#xA;        {# prevent error if no slider image is defined #}&#xA;        {% if block.sliderImage|length %}&#xA;            {% set image = block.sliderImage.first() %}&#xA;            &amp;lt;img class=&quot;slider-image&quot; src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;            ...&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-06-25T17:36:02.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10356" PostTypeId="2" ParentId="10349" CreationDate="2015-06-25T17:53:25.613" Score="2" Body="&lt;p&gt;Tasks are just another PHP request and they are subject to the same web server and &lt;code&gt;php.ini&lt;/code&gt; limitations as a &quot;normal&quot; request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like you just need to up your &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;nofollow&quot;&gt;max_execution_time&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-25T17:53:25.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10357" PostTypeId="1" CreationDate="2015-06-25T18:16:09.717" Score="0" ViewCount="288" Body="&lt;p&gt;I’ve been carefully following the instructions laid out at &lt;a href=&quot;http://una.im/2013/08/13/the-absolute-beginners-guide-to-setting-up-craft-on-mac.html#&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://una.im/2013/08/13/the-absolute-beginners-guide-to-setting-up-craft-on-mac.html#&lt;/a&gt; and &lt;a href=&quot;http://a73cram5ay.blogspot.com/2015/04/installing-craft-cms-on-mac-os-x-using.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://a73cram5ay.blogspot.com/2015/04/installing-craft-cms-on-mac-os-x-using.html&lt;/a&gt; to get Craft up and running. I’ve meticulously followed the steps on both, but am stuck in the same place either way. I’m a total noob, so hoping it isn’t something stupid I’ve overlooked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 5 in the Almost Profound guide and P5 in the a73cram5ay guide are not working for me. I have the MAMP site started and the tab is open in my browser (Chrome). I’ve tried both the socket and standard connections (images of my settings attached). Still, neither will connect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Connection Failed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unable to connect to host 127.0.0.1, or the request timed out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am the administrator and have privileges…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? I really want to try out Craft : (&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shawn&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iF2qA.png&quot; alt=&quot;Socket&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cCthf.png&quot; alt=&quot;Standard&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3819" LastActivityDate="2015-06-25T18:16:09.717" Title="Quick Getting Started Issue" Tags="&lt;mamp&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10358" PostTypeId="2" ParentId="10329" CreationDate="2015-06-25T18:57:28.460" Score="2" Body="&lt;p&gt;For SEO purposes, it might actually be better to keep the listing live, but clearly mark it as expired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I ended up doing was just having an additional field in my section that defined my own internal status of the entry, and then adjusted the display based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If simple expiration is enough for you, then it probably doesn't matter, though.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-06-25T18:57:28.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10359" PostTypeId="1" CreationDate="2015-06-26T00:27:30.110" Score="2" ViewCount="377" Body="&lt;p&gt;I'm wondering how to conduct a site search that takes search words and matches them in more than one field. So for example if I have an entry with fields that contain the following words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Description Field: foo&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Body Field: bar baz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A search for 'foo', or 'bar', or 'bar baz' finds the entry, but a search for 'foo bar' does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have rebuilt the search index.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-08-25T02:40:38.990" Title="Site search that matches in more than one field" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10360" PostTypeId="2" ParentId="10359" CreationDate="2015-06-26T00:40:25.623" Score="1" Body="&lt;p&gt;&lt;code&gt;foo bar&lt;/code&gt; implies &lt;code&gt;foo AND bar&lt;/code&gt; by default.  What you're probably looking for is &lt;code&gt;foo OR bar&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at &lt;code&gt;craft_searchindex&lt;/code&gt;, you can see that keywords for fields are indexed on a per field basis, which is why you'd need the &lt;code&gt;OR&lt;/code&gt; to search across multiple fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can omit &lt;code&gt;OR&lt;/code&gt; if you already know the field names ahead of time, though. &lt;code&gt;field1:foo field2:bar&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see more search syntax options &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-06-26T01:04:55.810" LastActivityDate="2015-06-26T01:04:55.810" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10361" PostTypeId="1" CreationDate="2015-06-26T05:14:19.027" Score="1" ViewCount="399" Body="&lt;p&gt;I want to search for Entries of the same channel/section based on their type. Let's say, we are a travel company with two types of tours: &quot;guided group&quot; and &quot;private&quot;. For group tours, we want trips associated with a particular provider. For private tours, we want trips less than a certain price (this field is N/A for group journeys).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteriaFilters = [&#xA;    'section'=&amp;gt;'journeys',&#xA;    'relatedTo'=&amp;gt; [&amp;lt;ids of the provider&amp;gt;],// Should be for group only&#xA;    'price'=&amp;gt;'&amp;lt;10', // Should be for private tour only&#xA;];&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(&#xA;    ElementType::Entry,&#xA;    $criteriaFilters&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to retrieve them all in an ElementCriteriaModel object, via one SQL query. I don't want to get all private and guided tours separately and then combine them because that doesn't work well with pagination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think is best to achieve this? (in PHP, not Twig)&lt;/p&gt;&#xA;" OwnerUserId="3531" LastActivityDate="2015-08-29T04:45:27.290" Title="Complex search (and/or)" Tags="&lt;search&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10362" PostTypeId="2" ParentId="2085" CreationDate="2015-06-26T09:57:23.100" Score="3" Body="&lt;p&gt;I hate messing with .htaccess files across multiple environments. I also find .htaccess a bit of black magic as I don't understand regex :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's my approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In index.php - right after the opening PHP tag - drop this in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($_SERVER['SERVER_ADDR'] == '127.0.0.1') {&#xA;&#xA;  $username = 'username';&#xA;    $password = 'password';&#xA;&#xA;  if (!(isset($_SERVER['PHP_AUTH_USER']) &amp;amp;&amp;amp; ($_SERVER['PHP_AUTH_USER']==$username &amp;amp;&amp;amp; $_SERVER['PHP_AUTH_PW']==$password)))  {&#xA;        header('WWW-Authenticate: Basic realm=&quot;This site is protected&quot;');&#xA;        header('HTTP/1.0 401 Unauthorized');&#xA;        // Fallback message when the user presses cancel / escape&#xA;        echo 'Access denied';&#xA;      exit;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously replace the IP address with the server IP you want to protect and an appropriate username and password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will only impact things routed through index.php - you'd still be able to access static html files and such but this works for most PHP apps I've found.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-06-26T09:57:23.100" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10363" PostTypeId="1" AcceptedAnswerId="10364" CreationDate="2015-06-26T10:05:10.750" Score="10" ViewCount="3666" Body="&lt;p&gt;Migrated from a Slack #help channel question&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Jason Mayo [09:53 16/6/15]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to output what file type an assets file is? E.g. if its a Jpeg, SVG or Gif etc.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-06-26T10:05:10.750" Title="How can I access the file extension of an asset?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10364" PostTypeId="2" ParentId="10363" CreationDate="2015-06-26T10:05:10.750" Score="14" Body="&lt;p&gt;Yes, you can access a number of properties on assets. You can get the &quot;file group&quot; (whether it's a document, image, video etc) using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ asset[0].kind }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, you can access the file extension using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ asset[0].extension }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full list in the documentation at: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot;&gt;http://buildwithcraft.com/docs/templating/assetfilemodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-06-26T10:05:10.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10365" PostTypeId="2" ParentId="10316" CreationDate="2015-06-26T12:50:34.510" Score="1" Body="&lt;p&gt;Remove 'usePathInfo' =&gt; true, from your /craft/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fixed a similar error on my site. &lt;/p&gt;&#xA;" OwnerUserId="3580" LastActivityDate="2015-06-26T12:50:34.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10366" PostTypeId="1" CreationDate="2015-06-26T12:56:49.797" Score="5" ViewCount="221" Body="&lt;p&gt;Does Craft have a styleguide for the admin, like Bootstrap? I'd like to know how to create plugin interfaces that match with Craft&lt;/p&gt;&#xA;" OwnerUserId="3822" LastActivityDate="2015-06-26T13:00:21.900" Title="Does Craft have a styleguide for the admin, like Bootstrap?" Tags="&lt;plugin-development&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10367" PostTypeId="2" ParentId="10366" CreationDate="2015-06-26T13:00:21.900" Score="3" Body="&lt;p&gt;Already found the answer, it seems it has a js lib called Garnish for UI interaction, and some grid system. Both are undocumented as of yet.&lt;/p&gt;&#xA;" OwnerUserId="3822" LastActivityDate="2015-06-26T13:00:21.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10368" PostTypeId="1" AcceptedAnswerId="10369" CreationDate="2015-06-26T13:03:31.037" Score="1" ViewCount="391" Body="&lt;p&gt;I'm writing a plugin which has a hook like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook('myHook', function(&amp;amp;$context)&#xA;{&#xA;    return array('hello', 'there');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While I can call it in a template with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook myHook %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an &quot;Array to string conversion&quot;, understandably. But I can't work out how to treat the returned data like an array. How can I use &lt;code&gt;hook 'myHook'&lt;/code&gt; in a &lt;code&gt;for&lt;/code&gt; loop, or &lt;code&gt;set&lt;/code&gt; it to a variable? It must be simple, but I've exhausted my random attempts.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-06-26T14:22:27.597" Title="Displaying an array returned from a hook" Tags="&lt;templating&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10369" PostTypeId="2" ParentId="10368" CreationDate="2015-06-26T14:22:27.597" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;Template hooks&lt;/a&gt; are useful if you need to change the current twig context array somewhere inside of a template. If you make any changes to &lt;code&gt;$context&lt;/code&gt; inside of your hook's function, those changes will be available after your hook tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just need to return some text or an array, a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;variable&lt;/a&gt; will do the trick just fine! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-06-26T14:22:27.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10370" PostTypeId="2" ParentId="10321" CreationDate="2015-06-26T14:49:09.303" Score="9" Body="&lt;p&gt;I managed to figure this out by looking through a few other posts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1878/advanced-search&quot;&gt;Advanced Search&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6837/building-a-simple-search-by-multiple-categories?rq=1&quot;&gt;Building a simple search by multiple categories&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4571/building-results-from-advanced-search-form?rq=1&quot;&gt;Building Results From Advanced Search Form&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9081/how-to-filter-entries-by-clicking-multiple-categories-on-front-end?rq=1&quot;&gt;How to filter entries by clicking multiple categories on front end&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2086/fetching-entries-from-an-advanced-search-form-on-the-front-end?rq=1&quot;&gt;Fetching entries from an advanced search form on the front end&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which I then took their knowledge and put together my own form and results template. With the results I wanted the same code &amp;amp; template to be used for search results AND the general &quot;knowledge&quot; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filter Form&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('knowledge') }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;        {% set categoryEntries = craft.entries.limit(null) %}&#xA;&#xA;        {% for category in craft.categories.group('knowledge') %}&#xA;&#xA;            {% set categoriesEntryCount = categoryEntries.relatedTo(category).total() %}&#xA;&#xA;            &amp;lt;li&amp;gt;&#xA;              &amp;lt;input type=&quot;checkbox&quot; name=&quot;category[]&quot; value=&quot;{{ category.slug }}&quot; id=&quot;{{ category.slug }}&quot;&amp;gt;&#xA;              &amp;lt;label for=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }} ({{ categoriesEntryCount }})&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set parameters =&#xA;        {&#xA;            section: 'channelKnowledge',&#xA;            limit: '1'&#xA;        }&#xA;    %}&#xA;&#xA;    {% set categoryQuery = craft.request.getParam('category') %}&#xA;&#xA;    {% if categoryQuery %}&#xA;        {% set categoryQueryCategories = craft.categories.group('knowledge').slug(categoryQuery) %}&#xA;        {% set entries = craft.entries(parameters).relatedTo(categoryQueryCategories).order('score') %}&#xA;    {% else %}&#xA;        {% set entries = craft.entries(parameters) %}&#xA;    {% endif %}&#xA;&#xA;    {% paginate entries as channelKnowledgeEntries %}&#xA;&#xA;    {% if entries|length %}&#xA;&#xA;        {% for entry in channelKnowledgeEntries %}&#xA;&#xA;            {{ entry.title }}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;No Results&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;    {% if paginate %}&#xA;&#xA;        &amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;            {% if paginate.prevUrl %}&#xA;                &amp;lt;span&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;back&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for page, url in paginate.getPrevUrls(5) %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;&quot; class=&quot;active&quot;&amp;gt;&#xA;                        {{ paginate.currentPage }}&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;                {% for page, url in paginate.getNextUrls(5) %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% if paginate.nextUrl %}&#xA;                &amp;lt;span&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;forward&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-06-26T14:49:09.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10371" PostTypeId="1" CreationDate="2015-06-26T16:54:54.357" Score="5" ViewCount="1011" Body="&lt;p&gt;I have been trying two separate methods to accomplish and both keep resulting in the same errors no matter what I try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry I am saving has a few fields the last of which is a matrix block (I am able to save the entry fine when not trying to save the matrix field to it.). This matrix block has two entry field types and the last field is a table field. I do not need to save actual data to these fields; it's fine that they are null/empty. I made sure that in the matrix block settings for these fields are not marked as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am testing this via ajax calls in jQuery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Method (described &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1101/how-to-save-a-matrix-content-of-a-new-entry-in-my-plugin&quot;&gt;here&lt;/a&gt;):&#xA;Craft sends back an error stating that...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Argument 1 passed to Craft\MatrixService::validateBlock() must be an instance&#xA;of Craft\MatrixBlockModel, array given, called in &#xA;/path/to/project/app/fieldtypes/MatrixFieldType.php &#xA;on line 393 and defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears to me that craft is expecting a matrix block model not an array. But even Brandon Kelly shows an example &lt;a href=&quot;https://gist.github.com/brandonkelly/8149062&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; of this method working...so what am I doing wrong..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _buildEntry ($college, $now, &amp;amp;$data) {&#xA;    $entry = new EntryModel();&#xA;    $matrixData = array();&#xA;    $entry-&amp;gt;sectionId = 4;&#xA;    $entry-&amp;gt;authorId = 1;&#xA;    $entry-&amp;gt;typeId = 1;&#xA;    $entry-&amp;gt;enabled = 1;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = $college-&amp;gt;collegeName.&quot; &quot;.$now;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;timeEntryStartDate = $now;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;timeEntryCollege = array($college-&amp;gt;id);&#xA;&#xA;    //set up the matrix data&#xA;    $matrixData['new1'] = array(&#xA;        'type'      =&amp;gt; 'weekBlock',&#xA;        'enabled'   =&amp;gt; true&#xA;    );&#xA;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;timeEntryWeek = $matrixData;&#xA;&#xA;    //save the new entry&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    if(!$success){&#xA;        Craft::log('Could not save the entry &quot;'.$entry-&amp;gt;title.'&quot;', LogLevel::Error);&#xA;    } else {&#xA;        Craft::log('Saved the entry! '.$entry-&amp;gt;title.'&quot;', LogLevel::Error);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second Method (described &lt;a href=&quot;https://gist.github.com/bwlng/5c0bdeff62fabe247c87&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;): Craft sends back an error stating that...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Trying to get property of non-object&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code for this second part which I call after craft successfully saves the entry (which works fine)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionTest($id = 3) {&#xA;&#xA;    $block = new MatrixBlockModel();&#xA;&#xA;    $block-&amp;gt;fieldId    = 20; // Matrix field's ID&#xA;    $block-&amp;gt;ownerId    = 178; // ID of entry the block should be added to&#xA;    $block-&amp;gt;typeId     = 6;&#xA;    $block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'timeEntryHouse' =&amp;gt; array(183),&#xA;        'timeEntryEmployee' =&amp;gt; array(1),&#xA;        'timeEntryDays' =&amp;gt; null&#xA;    ));&#xA;&#xA;    $success = craft()-&amp;gt;matrix-&amp;gt;saveBlock($block, false);&#xA;    if (!$success)&#xA;    {&#xA;        Craft::log('Couldn’t save the entry &quot;'.$id.'&quot;', LogLevel::Error);&#xA;    } else {&#xA;        $this-&amp;gt;returnJson('worked');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3688" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-29T19:38:09.133" Title="Save matrix block to new entry in plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10372" PostTypeId="1" CreationDate="2015-06-26T17:32:53.827" Score="2" ViewCount="269" Body="&lt;p&gt;I have a template, &lt;em&gt;/calendar&lt;/em&gt;, which outputs a list of all entries from the &lt;em&gt;events&lt;/em&gt; channel. If a user clicks a link for &quot;July 2015&quot;, I want the same template to load showing only the events for July 2015. I can fetch the entries for a given month with something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set setMonth = '2015-07' %}&#xA;&#xA;{% set firstDay, lastDay&#xA;   =&#xA;   setMonth ~ '-01', &#xA;   setMonth ~ '-' ~ setMonth|date('t')&#xA;%}&#xA;{% set after, before&#xA;   =&#xA;   firstDay|date_modify('-1 day')|date('Y-m'), &#xA;   lastDay|date_modify('+1 day')|date('Y-m')&#xA;%}&#xA;&#xA;{% set events = craft.entries.section('events').after(after).before(before)&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to pass the date that will be assigned to &lt;code&gt;setMonth&lt;/code&gt; in the URL using something like &lt;em&gt;/calendar/2015-07&lt;/em&gt;, but I currently get a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass the date in the URL without throwing a 404?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it even more complex, this template can also be filtered by category, so there would also be times the URL would look something like &lt;em&gt;/calendar/catslug/2015-07&lt;/em&gt;. In this case, the template should display only the July events from the catslug category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I can conquer the aforementioned 404 problem, will Craft still recognize &lt;em&gt;/calendar/catslug/2015-07&lt;/em&gt; as a category-triggering URL, or will the addition of the date segment break that functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this isn't as difficult as I'm making it, so any assistance is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2015-06-29T17:36:49.867" Title="Setting Date from URL" Tags="&lt;entries&gt;&lt;url&gt;&lt;filter&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10373" PostTypeId="2" ParentId="10371" CreationDate="2015-06-26T18:07:57.443" Score="3" Body="&lt;p&gt;ok just found out the answer to the second method. I was using the incorrect typeId apparently. I wasn't able to find this in any of the error logs, so this was just luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make sure you get the correct typeId do so in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrix = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle(&quot;fieldHandle&quot;); //look in craft_fields table&#xA;$matrixBlocks = craft()-&amp;gt;matrix-&amp;gt;getBlockTypesByFieldId($matrix-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can iterate through $matrixBlocks and look at each blocks id but in my case I knew there was only one block so I just accessed the id like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$typeId = $matrixBlocks[0]['id'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3688" LastEditorUserId="3688" LastEditDate="2015-06-29T19:38:09.133" LastActivityDate="2015-06-29T19:38:09.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10374" PostTypeId="2" ParentId="10337" CreationDate="2015-06-26T18:26:13.587" Score="3" Body="&lt;p&gt;I don’t know about ObjectiveHTML’s Google Maps plugin, but this is easy to do using Lindsey DiLoreto’s &lt;a href=&quot;https://craftpl.us/plugins/smart-map/&quot; rel=&quot;nofollow&quot;&gt;Smart Map&lt;/a&gt; plugin, which comes with an “Address” field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per the “&lt;a href=&quot;https://craftpl.us/plugins/smart-map/docs/using-an-address-field&quot; rel=&quot;nofollow&quot;&gt;Using an Address Field&lt;/a&gt;” documentation, you can output latitude and longitude values like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;Latitude: {{ entry.address.lat }}&amp;lt;br /&amp;gt;&#xA;Longitude: {{ entry.address.lng }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(In that example, &lt;code&gt;entry&lt;/code&gt; is an entry that has an Address field called &lt;code&gt;address&lt;/code&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-06-26T18:26:13.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10375" PostTypeId="1" CreationDate="2015-06-26T18:27:22.143" Score="2" ViewCount="986" Body="&lt;p&gt;I have a client who uses Office 365 for email.  Using the basic phpMail config in Craft fails when I try to direct an email to any of the clients email addresses, including user registration and, more importantly, when sending a message from the Contact Form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried in vain to change the Craft email settings to SMTP, using credentials that have been tested with a desktop email client.  I am sure there is something I am missing, e.g. some server config thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roi&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2015-06-27T01:06:04.663" LastActivityDate="2015-06-27T01:06:04.663" Title="Help Understanding Craft Email Settings" Tags="&lt;plugin-contactform&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10376" PostTypeId="2" ParentId="10375" CreationDate="2015-06-26T18:29:44.467" Score="1" Body="&lt;p&gt;It could be your server blocks outgoing mail on the default port (25). Try port 587 instead.&lt;/p&gt;&#xA;" OwnerUserId="165" LastActivityDate="2015-06-26T18:29:44.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10377" PostTypeId="1" AcceptedAnswerId="10378" CreationDate="2015-06-27T01:29:51.943" Score="1" ViewCount="374" Body="&lt;p&gt;I've noticed lately, maybe after the last Craft update or two, that internal 500 errors no longer show information or error traces. I simply get a message like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Undefined offset: 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that's all it will show. I've checked that devmode is set to true, and in dashboard it shows that devmode is on. Is there a particular reason this would be happening? Maybe because the error is coming from a plugin and not twig? Or a general setting I'm not aware of for more detailed errors? It used to show all the information I needed.&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2015-06-27T02:49:45.737" Title="DevMode not showing detailed Internal 500 Errors" Tags="&lt;php&gt;&lt;error&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10378" PostTypeId="2" ParentId="10377" CreationDate="2015-06-27T02:49:45.737" Score="2" Body="&lt;p&gt;I confirmed this was a regression with the Yii 1.1.16/Craft 2.4 update and it's been fixed for the next &lt;a href=&quot;http://buildwithcraft.com/updates#build2670&quot; rel=&quot;nofollow&quot;&gt;post 2.4.2670&lt;/a&gt; update.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-27T02:49:45.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10379" PostTypeId="1" CreationDate="2015-06-27T05:39:07.653" Score="1" ViewCount="149" Body="&lt;p&gt;I've just moved a site from a subdomain to the root. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've updated the index.php file and also the settings in the control panel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;System-&gt;General-&gt;SiteUrl &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to reflect the new path of the craft directory and index.php relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the admin backend but the actual site gives the craft styled &quot;Page not found.&quot;&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-06-27T06:41:40.023" Title="What needs updating when moving site from subdomain to root?" Tags="&lt;subdomain&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10380" PostTypeId="2" ParentId="10379" CreationDate="2015-06-27T06:35:11.543" Score="2" Body="&lt;p&gt;Ok so on this site: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I forgot that I'd moved the templates folder outside the craft folder for easy access with this in the index.php &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_PLUGINS_PATH',realpath(dirname(__FILE__)./../plugins&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Making sure the assets sources url are changed is essential to get the site working.&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="57" LastEditDate="2015-06-27T06:41:40.023" LastActivityDate="2015-06-27T06:41:40.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10381" PostTypeId="1" AcceptedAnswerId="10382" CreationDate="2015-06-27T09:47:31.470" Score="0" ViewCount="1833" Body="&lt;p&gt;below is my categories url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://example.com/index.php?p=categories/vaporizers&quot; rel=&quot;nofollow&quot;&gt;http://example.com/index.php?p=categories/vaporizers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i create a template files for categories like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/categories/index.html&#xA;templates/categories/_entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my index.html is not called when categories view. please tell me where i create a mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3791" LastActivityDate="2015-06-27T12:24:48.133" Title="How to create a template file for Categories?" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10382" PostTypeId="2" ParentId="10381" CreationDate="2015-06-27T12:24:48.133" Score="6" Body="&lt;p&gt;When you create a category you will need to tell craft which template to load:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BpLKS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for your example you would put &lt;code&gt;categories/index&lt;/code&gt; in there and you should find the template gets loaded when you visit the category url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;noreferrer&quot;&gt;See more about templating in the docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-06-27T12:24:48.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10383" PostTypeId="2" ParentId="10286" CreationDate="2015-06-27T14:35:04.023" Score="3" Body="&lt;p&gt;There’s no way to give a user group permission to create entries but not see those entries they created in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way to achieve what you want would be to write a plugin that provides its own “save-entry” controller action, which allows users to create the entries without actually having the permission. The &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin would be a good starting point - it has a &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/guestentries/controllers/GuestEntriesController.php&quot; rel=&quot;nofollow&quot;&gt;GuestEntriesController&lt;/a&gt; with an &lt;code&gt;actionSaveEntry()&lt;/code&gt; method that behaves very similar to Craft’s built-in EntriesController::actionSaveEntry(), but it skips the normal permission-based authorization logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you might still want some level of authorization. For example, you can verify that there’s a currently logged-in user, and that they belong to a certain group. If that’s the case you’ll want to &lt;strong&gt;not&lt;/strong&gt; add this line:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;protected $allowAnonymous = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And at the top of your &lt;code&gt;actionSaveEntry()&lt;/code&gt; method, add this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;if (!$user-&amp;gt;isInGroup('authors'))&#xA;{&#xA;    throw new HttpException(403, Craft::t('This action may only be performed by authors.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-06-27T14:35:04.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10384" PostTypeId="2" ParentId="10315" CreationDate="2015-06-27T20:22:03.833" Score="3" Body="&lt;p&gt;If they're required, then they're &lt;em&gt;required&lt;/em&gt;... it doesn't matter if the form is being submitted on the front-end or back-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest solution to this would be to simply provide that data as &lt;strong&gt;hidden inputs&lt;/strong&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myRequiredField]&quot; value=&quot;default value&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-27T20:22:03.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10385" PostTypeId="2" ParentId="10242" CreationDate="2015-06-28T12:36:22.217" Score="1" Body="&lt;p&gt;Looks like this is a Redactor bug. See the last line of the 10.2 changelog: &quot;In Firefox when a title was added to an image, it received improper empty tags&quot;. Craft currently contains Redactor 10.1.3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/log/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/log/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been fixed for the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2670&quot; rel=&quot;nofollow&quot;&gt;2.4.2670&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastEditorUserId="57" LastEditDate="2015-06-28T22:45:49.103" LastActivityDate="2015-06-28T22:45:49.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10386" PostTypeId="2" ParentId="935" CreationDate="2015-06-28T14:01:49.753" Score="2" Body="&lt;p&gt;I've run into a similar situation. I was able to get things working in my situation using Twig's &lt;code&gt;_context&lt;/code&gt; variable. The object I needed was available to the page, but the object name was only known as a string on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set the object on the page, by accessing it with the string I had via the &lt;code&gt;_context&lt;/code&gt; object. &lt;code&gt;_context&lt;/code&gt; is a Global Variable in Twig, which contains all currently defined variables on the page. This made sure that I was accessing the form object being returned to the page (not redefining the object from the database).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submittedFormModel = (_context[entry.formField.first().handle] is defined &#xA;                            ? _context[entry.formField.first().handle] &#xA;                            : null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there, I could access the errors via Twig's &lt;code&gt;attribute&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set errors = attribute(submittedFormModel, 'getErrors') %}&#xA;&#xA;{% for error in errors %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, via the object as normal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for error in submittedFormModel.getErrors() %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-06-28T14:17:14.817" LastActivityDate="2015-06-28T14:17:14.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10387" PostTypeId="2" ParentId="9766" CreationDate="2015-06-28T18:21:58.127" Score="3" Body="&lt;p&gt;This issue has been resolved in &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/updates#release-v1.0.4&quot; rel=&quot;nofollow&quot;&gt;Sprout Email v1.0.4&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-06-28T18:21:58.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10388" PostTypeId="1" CreationDate="2015-06-28T23:08:26.370" Score="1" ViewCount="687" Body="&lt;p&gt;I'm trying to install craft, but I have 4 errors like this on the screen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Utime failed: Operation not permitted in craft/app/helpers/IOHelper.php on line 1540&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are possible causes, and how can I fix it and install properly craft?&lt;/p&gt;&#xA;" OwnerUserId="3606" LastActivityDate="2015-06-28T23:31:24.893" Title="Utime failed: Operation not permitted in craft/app/helpers/IOHelper.php on line 1540" Tags="&lt;install&gt;&lt;error&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10389" PostTypeId="2" ParentId="10388" CreationDate="2015-06-28T23:31:24.893" Score="1" Body="&lt;p&gt;It &lt;a href=&quot;https://stackoverflow.com/questions/1676743/why-would-file-put-contents-succeed-but-touch-fail&quot;&gt;looks like&lt;/a&gt; a permissions related issue.  Check the &lt;code&gt;user:group&lt;/code&gt; owner of all of the files in the &lt;code&gt;craft/app&lt;/code&gt; folder and make sure that they are set to the same &lt;code&gt;user:group&lt;/code&gt; that your PHP installation is running as.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-06-28T23:31:24.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10390" PostTypeId="1" AcceptedAnswerId="10391" CreationDate="2015-06-29T06:33:18.217" Score="3" ViewCount="986" Body="&lt;p&gt;Below is my paginate code and it's working fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('products').limit(9) as entriesOnPage %}&#xA;&#xA;{% for entry in entriesOnPage %}&#xA;    &amp;lt;div class=&quot;product-box&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;product&quot;&amp;gt;&#xA;            &amp;lt;p class=&quot;product-name&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.category.first().url }}&quot;&amp;gt;{{ entry.category.first().title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if paginate.nextUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below is my code to display specific category data with pagination. and it's not working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set requestCategory = craft.request.getLastSegment() %}&#xA;&#xA;{% paginate craft.entries.section('products').find({&#xA;    search: 'categories:' ~ requestCategory,&#xA;  }).limit(9) as entriesOnPage %}&#xA;&#xA;{% for entry in entriesOnPage %}&#xA;    &amp;lt;div class=&quot;product-box&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;product&quot;&amp;gt;&#xA;            &amp;lt;p class=&quot;product-name&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.category.first().url }}&quot;&amp;gt;{{ entry.category.first().title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if paginate.nextUrl %}&#xA;    &amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i want to add category filter on that but not working how can i add a category filter?&lt;/p&gt;&#xA;" OwnerUserId="3791" LastEditorUserId="57" LastEditDate="2015-06-29T16:05:32.523" LastActivityDate="2015-06-29T16:05:32.523" Title="Paginate with category filter?" Tags="&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10391" PostTypeId="2" ParentId="10390" CreationDate="2015-06-29T07:32:36.703" Score="4" Body="&lt;p&gt;Try using the relatedTo() filter as explained here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/help/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('products').relatedTo(requestCategory).limit(9) as entriesOnPage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-06-29T07:32:36.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10392" PostTypeId="1" AcceptedAnswerId="10395" CreationDate="2015-06-29T09:58:50.463" Score="4" ViewCount="797" Body="&lt;p&gt;Se need to import a large user table to a Craft installation. Unfortunately, the passwords in the imported data are SHA1 encrypted (and salted).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to enable the login of the users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We thought that we add an extra column to the table which defined if the hash is standard or SHA1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user logs in where the password is SHA1, then we check if it's the correct password and change it to the standard hash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be the most comfortable way for the existing users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Is this a possible solution, especially is it possible to hook up into the login process to create the logic for the check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or would you recommend other solutions?&lt;/p&gt;&#xA;" OwnerUserId="3826" LastEditorUserId="57" LastEditDate="2015-06-29T16:08:33.577" LastActivityDate="2016-04-05T15:33:56.083" Title="How can I import existing users with passwords stored in a different format than Craft's hash format?" Tags="&lt;users&gt;&lt;password&gt;&lt;import&gt;&lt;hash&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10393" PostTypeId="1" AcceptedAnswerId="10397" CreationDate="2015-06-29T13:39:44.010" Score="0" ViewCount="574" Body="&lt;p&gt;Is there any way to link to a global using a field in a entry form, much like you would use the &quot;Entries&quot; fieldtype to link to entries?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2015-06-29T17:20:26.350" Title="Link to Global Fields like you can with the entries fieldtype" Tags="&lt;fieldtypes&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10394" PostTypeId="1" AcceptedAnswerId="10399" CreationDate="2015-06-29T16:31:28.667" Score="3" ViewCount="734" Body="&lt;p&gt;I'm trying to check to see if a particular category (In a loop) exists in a query submitted from a search form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I'm doing this inside a 'childCategory' loop...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for childCategory in childCategories %}&#xA;&#xA;    {% for category in query %}{% if childCategory.slug == category.slug %} checked{% endif %}{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EUGH right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way (Surely!) to check to see if the cateogry exists? I've tried the length and indexOf filters as well as an IN conditional. Nothing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The query is being set like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('category') %}&#xA;{% set queryCategories = craft.categories.group('opportunities').slug(query) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-12-08T10:23:11.157" Title="Check if Category is in Query" Tags="&lt;categories&gt;&lt;search&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10395" PostTypeId="2" ParentId="10392" CreationDate="2015-06-29T16:51:13.810" Score="4" Body="&lt;p&gt;Short answer, it can't be done. Possibly with some extensive hacking, but I would &lt;em&gt;highly&lt;/em&gt; caution against that.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Directly importing passwords isn't really possible, since the original passwords are unknown.&lt;/li&gt;&#xA;&lt;li&gt;Adding a custom password column to the database is a bad idea, since Craft user/password management is pretty deeply embedded within the system.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's what I would recommend instead... &lt;strong&gt;Prompt your users to reset their passwords.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this idea doesn't seem ideal initially, but it is not unprecedented. People are used to changing their passwords occasionally, and will generally be very understanding about it. Many folks have dealt with systems that force them to change their password every 3 months, and &lt;em&gt;everyone&lt;/em&gt; has forgotten a password at one time or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently had to do this for a website with several hundred users. We ported from EE to Craft, leaving the front-end visually identical. Here's the message we showed to users after the switch:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Our login system has recently changed.&lt;/strong&gt; Please note:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you haven't logged in since January 10th, &lt;strong&gt;you will be required to &lt;a href=&quot;http://example.com/reset-password&quot; rel=&quot;nofollow&quot;&gt;reset your password&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-29T16:51:13.810" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10396" PostTypeId="2" ParentId="10392" CreationDate="2015-06-29T17:13:17.580" Score="2" Body="&lt;p&gt;Your way sounds possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to write a Craft plugin that listened for the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeLogin&lt;/a&gt; event.  Only the &lt;code&gt;username&lt;/code&gt; is passed in as a parameter, but you can grab the submitted password though POST with &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('password')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin would have a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;record&lt;/a&gt; that has two columns.  One is the SHA1 hash from the old system and the other is a &lt;code&gt;userId&lt;/code&gt; column with a foreign key constraint to Craft's &lt;code&gt;craft_users&lt;/code&gt; table on the &lt;code&gt;id&lt;/code&gt; column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would them take the submitted password and verify the SHA1 hash matches.  If so, take the same submitted password, run it through &lt;a href=&quot;http://buildwithcraft.com/classreference/services/SecurityService#hashPassword-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft()-&gt;security-&gt;hashPassword()&lt;/a&gt; and updated the appropriate &lt;code&gt;password&lt;/code&gt; column in the &lt;code&gt;craft_users&lt;/code&gt; table for the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can have them reset their password as &lt;a href=&quot;https://craftcms.stackexchange.com/a/10395/57&quot;&gt;Lindsey points out&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-06-29T17:13:17.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10397" PostTypeId="2" ParentId="10393" CreationDate="2015-06-29T17:20:26.350" Score="5" Body="&lt;p&gt;Not directly. You could have a dropdown of all the global set handles (use &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;noreferrer&quot;&gt;Dynamic Fields Plugin&lt;/a&gt; if you don't want to maintain this dropdown manually), and then in your template fetch the global set from its handle with &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.globals#getSetByHandle&quot; rel=&quot;noreferrer&quot;&gt;getSetByHandle&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set globalSet = craft.globals.getSetByHandle(entry.globalSetHandle.value) %}&#xA;{% if globalSet %} {# could conceivably be null #}&#xA;  ... {{ globalSet.someField }} ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-29T17:20:26.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10398" PostTypeId="2" ParentId="10372" CreationDate="2015-06-29T17:25:37.883" Score="2" Body="&lt;p&gt;As mentioned in the comments, using a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; is good method to create a date based uri (i.e. 'calendar/[year]-[month]'). See &lt;a href=&quot;https://craftcms.stackexchange.com/a/10353/784&quot;&gt;this answer&lt;/a&gt; for an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding 'category' into the route is a little more difficult, since there is no 'category' tag built into the dynamic route settings. However, you can use the wildcard &lt;code&gt;*&lt;/code&gt; as part of the route for what would be the category (or anything else for that matter) — and then retrieve it using &lt;code&gt;craft.request.segment&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dynamic route&lt;/strong&gt; (which points to your 'calendar' template)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;calendar/[*]/[year]-[month]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(note: using &lt;code&gt;calendar/[slug]/[year]-[month]&lt;/code&gt; might also resolve to a category entry — don't know, but worth a try.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Calendar template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.segment(2) %}&#xA;{% set category = craft.category.slug(categorySlug).first %}&#xA;{% if year is defined and month is defined %}&#xA;    {% set startMonth = year ~ '-' ~ month ~ '-' ~ 1 %}&#xA;{% else %}&#xA;    {% set startMonth = now|date_modify(&quot;first day of this month&quot;) %}&#xA;{% endif %}&#xA;{% set nextMonth = startMonth|date_modify('+1 month')) %}&#xA;{% set previousMonth = startMonth|date_modify('-1 month')) %}&#xA;&#xA;{% set entries = craft.entries.section('calendar').postDate('and', '&amp;gt;= ' ~ startMonth, '&amp;lt; ' ~ nextMonth).relatedTo(category) %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'events/' ~ category ~ '/' ~ nextMonth|date(&quot;Y-n&quot;) }}&quot;&amp;gt;next month&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ 'events/' ~ category ~ '/' ~ previousMonth|date(&quot;Y-n&quot;) }} &quot;&amp;gt;previous month&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Advanced route method&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be more specific in your route, then you can also set up an &lt;a href=&quot;http://buildwithcraft.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;advanced route&lt;/a&gt; using named sub-patterns, which you can add to &lt;code&gt;craft/config/routes.php&lt;/code&gt;, that will provide named variables to your template for 'category', 'year' and 'month'. Something like,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'calendar/(?P&amp;lt;category&amp;gt;\w+)/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})' =&amp;gt; 'calendar/_index',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-06-29T17:36:49.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10399" PostTypeId="2" ParentId="10394" CreationDate="2015-06-29T17:32:45.173" Score="3" Body="&lt;p&gt;I would construct an array of the category slugs outside of your childCategories loop (using twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryCatSlugs = [] %}&#xA;{% for category in query %}&#xA;  {% set queryCatSlugs = queryCatSlugs|merge([category.slug]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your childCategories loop can use twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator0&quot; rel=&quot;nofollow&quot;&gt;containment operator&lt;/a&gt; (&lt;code&gt;in&lt;/code&gt;) for the test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for childCategory in childCategories %}&#xA;  {% if childCategory.slug in queryCatSlugs %}&#xA;    ... matches ...&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-29T17:32:45.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10401" PostTypeId="1" AcceptedAnswerId="10406" CreationDate="2015-06-29T19:21:19.333" Score="1" ViewCount="133" Body="&lt;p&gt;I'm building a site that contains a listing of products and distributors. I have a channel for each, and each entry in the distributors channel contains a relationship field to tie it to any number of entries in the products channel. There are about 20 entries in each channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to set up a page with a table that includes all of the products across the top, and all of the distributors in the left column, with a check box in each cell where there is a relationship between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to just use standard related entries tags to output the distributors and list out the related products for each, but is there a way get it into the table format, without a ridiculous number of queries?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2015-06-29T21:23:35.217" Title="Display all related entries in a table" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10402" PostTypeId="1" AcceptedAnswerId="10404" CreationDate="2015-06-29T20:03:55.993" Score="1" ViewCount="497" Body="&lt;p&gt;I created an environment variable (in &lt;em&gt;config/general.php&lt;/em&gt;) called &lt;code&gt;{baseAssetPath}&lt;/code&gt; which contains the server path to the folder where all my assets are stored. This makes it easier to populate the &lt;em&gt;Path&lt;/em&gt; field in &lt;em&gt;Assets&lt;/em&gt; settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this variable does not appear to work to configure the &lt;em&gt;Upload Location&lt;/em&gt; when setting up an &lt;em&gt;Assets&lt;/em&gt; field. Now, when I attempt to add an asset, or edit an existing entry, I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Craft\EntryModel and its behaviors do not&#xA;have a method or closure named&#xA;&quot;baseAssetPath&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is &lt;em&gt;Upload Location&lt;/em&gt; looking for a server path or a URL path?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's looking for a server path, why doesn't my &lt;code&gt;{baseAssetPath}&lt;/code&gt; variable work here?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2015-06-29T20:27:48.083" Title="Environment variable doesn't work in Assets field settings" Tags="&lt;assets&gt;&lt;field&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10403" PostTypeId="1" CreationDate="2015-06-29T20:15:49.217" Score="3" ViewCount="2863" Body="&lt;p&gt;I have the following problem: I would like to have one craft backend / one installation for different one pager sites on different domains. The reason is, that we have one HTML template we would like to use for our landing pages for different purposes (e.g. landingpage with different testimonials) and we would like to use a different domain for each version of the landingpage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought was, to build a channel and to setup it up like www.domain.com/landingpage01, www.domain.com/landingpage02 etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I route mycooldomain.com to /landingpage01 and myothercooldomain.com to /landingpage02?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or are there any other solutions for my problem?&lt;/p&gt;&#xA;" OwnerUserId="3827" LastActivityDate="2015-06-30T14:28:10.290" Title="Multi-Site | Multi-Domain?" Tags="&lt;multi-domain&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10404" PostTypeId="2" ParentId="10402" CreationDate="2015-06-29T20:27:48.083" Score="1" Body="&lt;p&gt;&quot;Upload Location&quot; doesn't reference you're environment variables. Instead, you've got a dropdown menu of your pre-defined Assets sources. Whichever one you choose will be used as the base of your file path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything you put in curly braces after that will become a &lt;em&gt;subfolder&lt;/em&gt; of that asset source. So your subfolder names will be created based on whichever &lt;strong&gt;Entry fields&lt;/strong&gt; you define.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nXkBV.png&quot; alt=&quot;Upload Location&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-06-29T20:27:48.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10405" PostTypeId="2" ParentId="10403" CreationDate="2015-06-29T20:49:20.217" Score="2" Body="&lt;p&gt;One way to do this, is use different environments for each domain and set a variable (for instance, an entry ID) for each environment. So, your &lt;code&gt;config/general.php&lt;/code&gt; would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;   '*' =&amp;gt; array(&#xA;       // Every config setting that's the same for all domains (like devMode, omitScriptNameInUrls, etc.&#xA;   ),&#xA;   'firstDomain.com' =&amp;gt; array(&#xA;       'siteUrl' =&amp;gt; 'http://www.firstDomain.com/',&#xA;       'environmentVariables' =&amp;gt; array(&#xA;           'baseUrl' =&amp;gt; 'http://www.firstDomain.com/', // For use in asset source, for example&#xA;           'basePath' =&amp;gt; '/path/to/public/folder/', // Same for this&#xA;           'entryId' =&amp;gt; 5 // Or whatever the ID of your entry is&#xA;       ),&#xA;   ),&#xA;   'secondDomain.com' =&amp;gt; array(&#xA;       'siteUrl' =&amp;gt; 'http://www.secondDomain.com/',&#xA;       'environmentVariables' =&amp;gt; array(&#xA;           'baseUrl' =&amp;gt; 'http://www.secondDomain.com/', // For use in asset source, for example&#xA;           'basePath' =&amp;gt; '/path/to/public/folder/', // Same for this&#xA;           'entryId' =&amp;gt; 8 // Or whatever the ID of your entry is&#xA;       ),&#xA;   ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in your template (entry.html or whatever file you use as your section's template), you get the data like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(craft.config.environmentVariables['entryId']).first() %}&#xA;&#xA;&amp;lt;h4&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-06-29T20:49:20.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10406" PostTypeId="2" ParentId="10401" CreationDate="2015-06-29T21:18:21.233" Score="2" Body="&lt;p&gt;Let me show you the quickest solution I could think of. &#xA;If you put it in &lt;code&gt;{% cache %}&lt;/code&gt; tags, you should be fine. You could also create a little plugin that returns the required data from one big-ass query, if you're into building plugins. If you have &lt;em&gt;any&lt;/em&gt; plugin experience, then building a plugin is what I would do.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set distributors = craft.entries.section('distributors').limit(null) %}&#xA;{% set allRelatedProducts = craft.entries.section('products').relatedTo(distributors).limit(null) %}&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;    &amp;lt;thead&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;th&amp;gt;Distributor&amp;lt;/th&amp;gt;&#xA;            {% for product in allRelatedProducts %}&#xA;                &amp;lt;th&amp;gt;{{ product.title }}&amp;lt;/th&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;/thead&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;        {% for distributor in distributors %}&#xA;            {# Get ids for all products related to distributor #}&#xA;            {% set productsForDistributor = craft.entries.section('products').relatedTo(distributor).limit(null).ids() %}&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ distributor.title }}&amp;lt;/td&amp;gt;&#xA;                {% for product in allRelatedProducts %}&#xA;                    {# &#xA;                     # Check if product ID is in array containing this distributor's products&#xA;                     # and display value accordingly&#xA;                     #}&#xA;                    &amp;lt;td&amp;gt;{{ product.id in productsForDistributor ? 'yes' : 'no' }}&amp;lt;/td&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/tr&amp;gt;&#xA;       {% endfor %}&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-06-29T21:23:35.217" LastActivityDate="2015-06-29T21:23:35.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10407" PostTypeId="1" AcceptedAnswerId="10408" CreationDate="2015-06-29T21:45:44.997" Score="2" ViewCount="2310" Body="&lt;p&gt;I have composer setup at the root of the plugin folder with a few dependencies. I have custom classes in a folder at root we can call pluginX, I am autoloading its namespace with composer like such.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;autoload&quot;:{&#xA;    &quot;psr-0&quot;: {&quot;PluginX&quot;: &quot;PluginX/&quot;}&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;andrefelipe/orchestrate-php&quot;: &quot;0.14.0&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however when I try and use my class which resides at &quot;PluginX/Models/Trips&quot; like below I get a &quot;Fatal Error: Class Not found...&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;use \GoWander\Models\Trips;&#xA;use \andrefelipe\Orchestrate;&#xA;use \GuzzleHttp\Client as GuzzleClient;&#xA;&#xA;class PluginX_TripController extends BaseController {&#xA;&#xA;    protected $allowAnonymous = false;&#xA;&#xA;    public function actionIndex() {&#xA;&#xA;        // let's instantiate a Http client programatically&#xA;        $clientConfig = Orchestrate\default_http_config();&#xA;        $httpClient = new GuzzleClient($clientConfig);&#xA;&#xA;        // instatiate the collection&#xA;        $trips = new Trips($httpClient);&#xA;&#xA;        $trip = $trips-&amp;gt;item('ING');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2016-06-10T16:15:49.787" Title="PSR-0 Composer Autoloading causing class not found in plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10408" PostTypeId="2" ParentId="10407" CreationDate="2015-06-30T02:49:41.620" Score="2" Body="&lt;p&gt;Problem was with how composer handles psr-0 and psr-4 autoloading, so by changing the &lt;code&gt;composer.json&lt;/code&gt; like such, the classes were loaded.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;autoload&quot;:{&#xA;    &quot;psr-4&quot;: {&quot;PluginX\\&quot;: &quot;PluginX/&quot;}&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;andrefelipe/orchestrate-php&quot;: &quot;0.14.0&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-06-30T02:49:41.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10409" PostTypeId="2" ParentId="10361" CreationDate="2015-06-30T04:00:03.667" Score="1" Body="&lt;p&gt;I don't think it's possible to do what you're trying to do in a single ElementCriteriaModel query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or&quot;&gt;These&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/q/587/57&quot;&gt;questions&lt;/a&gt; are basically asking the same thing and can confirm it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-06-30T04:00:03.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10410" PostTypeId="1" AcceptedAnswerId="10411" CreationDate="2015-06-30T06:35:54.323" Score="3" ViewCount="491" Body="&lt;p&gt;I am new in Craft CMS and this is my first plugin. Below is my code to get products.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.entries.section('products').limit(9) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is working fine but can I use this code in my controller for getting products?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3791" LastEditorUserId="22" LastEditDate="2017-05-09T23:52:03.997" LastActivityDate="2017-05-09T23:52:03.997" Title="can i used craft.entries.section into my Controller" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10411" PostTypeId="2" ParentId="10410" CreationDate="2015-06-30T07:16:11.340" Score="4" Body="&lt;p&gt;If you want to use ElementCriteria in your controller, this is how to go about it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section('products');&#xA;$criteria-&amp;gt;limit = 9;&#xA;&#xA;$products = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Read &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for more info on the subject.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-06-30T07:16:11.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10412" PostTypeId="1" AcceptedAnswerId="10417" CreationDate="2015-06-30T07:50:05.703" Score="1" ViewCount="184" Body="&lt;p&gt;My IDE knows about craft() from an autocomplete and code validation point of view, but it knows nothing about the plugin services that have to be accessed in this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how this could be improved to aid with easier development? Is it an IDE issue, or perhaps a Craft 3 feature request?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-06-30T15:58:19.807" Title="Autocomplete of craft()-&gt;craft_pluginservice-&gt;foo()" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10413" PostTypeId="1" CreationDate="2015-06-30T08:47:52.503" Score="0" ViewCount="842" Body="&lt;p&gt;There seem to be some issues with asset uploading, and i can't figure out what the problem is. Here's a summary:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;After uploading an asset it doesn't show up in the Assets listing&lt;/li&gt;&#xA;&lt;li&gt;If i do a 'Update Assets Indexes' it says this about files 'The following files could not be found. Should they be deleted from the index?'&lt;/li&gt;&#xA;&lt;li&gt;If i run 'Update Assets Indexes' again, a couple (but not all) of the uploaded files appear in the Assets listing?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The assets file path seems to be in order. The log files says:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'[error] [application] Could not delete the file' ... 'because the file does not exist.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pointing to a file in 'craft/storage/runtime/assets/sources/'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried loads of stuff already, including uploading all craft files again in a new folder, but no dice.. Does anyone have a clue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Bob&lt;/p&gt;&#xA;" OwnerUserId="3829" LastActivityDate="2015-06-30T08:47:52.503" Title="Assets upload and Update Asset Indexes issues" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10414" PostTypeId="1" CreationDate="2015-06-30T10:38:01.743" Score="4" ViewCount="118" Body="&lt;p&gt;below is my controller code for getting a data of prodcuts.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$service = craft()-&amp;gt;entries;&#xA;$entry = $service-&amp;gt;getEntryById(108);&#xA;&#xA;$title = $entry-&amp;gt;getTitle();&#xA;$description = $entry-&amp;gt;description;&#xA;$overview = $entry-&amp;gt;productOverview;&#xA;$price = $entry-&amp;gt;price;&#xA;&#xA;$slider = $entry-&amp;gt;productSlider;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i store a slider data into matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Block type = productSlider&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fields is = images,title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3791" LastActivityDate="2015-06-30T10:38:01.743" Title="How to get data of matrix fields?" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2016-06-03T03:03:43.530" ContentLicense="CC BY-SA 3.0" />
  <row Id="10415" PostTypeId="2" ParentId="10403" CreationDate="2015-06-30T14:28:10.290" Score="1" Body="&lt;p&gt;Found the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did as written above and added&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;landingpages/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to my index.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. I &amp;lt;3 Craft.&lt;/p&gt;&#xA;" OwnerUserId="3827" LastActivityDate="2015-06-30T14:28:10.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10416" PostTypeId="1" CreationDate="2015-06-30T15:30:42.570" Score="3" ViewCount="410" Body="&lt;p&gt;Not sure what is happening but &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchQuery = craft.request.getParam('q') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does not seem to be working at all on a different server than staging. Anyone seen this before? Any ideas what could be preventing getParam from working? Here is what the end of my url looks like with the param: &lt;code&gt;results?q=test&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then later try to display the search parameter like.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1 class=&quot;text-uppercase&quot;&amp;gt;Search Results {{searchQuery}}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it only displays Search Results leaving the parameter empty... and my search results seem to be returning everything since it is basically doing a wildcard search since I'm using this below to query the matching results...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.search(searchQuery).order('score').limit(10) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works as expected on staging server.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="45" LastEditDate="2015-06-30T16:56:43.437" LastActivityDate="2015-07-02T00:33:54.520" Title="getParam not working on live server?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;params&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10417" PostTypeId="2" ParentId="10412" CreationDate="2015-06-30T15:42:58.977" Score="1" Body="&lt;p&gt;It's 95% an IDE issue.  Craft can take advantage of this because it provides PHP DocBlock &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/web/WebApp.php#L5&quot; rel=&quot;nofollow&quot;&gt;property information&lt;/a&gt; in &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;WebApp&lt;/a&gt; (which is what &lt;code&gt;craft()&lt;/code&gt; is a reference to) and IDE's like PhpStorm are smart enough to analyze that and find the classes you're referencing for autocompletion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's impossible for Craft to let plugins dynamically add properties to that DocBlock, but I have seen some clever &lt;a href=&quot;https://github.com/selvinortiz/craft.spamguard&quot; rel=&quot;nofollow&quot;&gt;plugins&lt;/a&gt; provide their own abstraction around &lt;code&gt;craft()&lt;/code&gt; so they can add their own &lt;a href=&quot;https://github.com/selvinortiz/craft.spamguard/blob/master/SpamGuardPlugin.php#L161&quot; rel=&quot;nofollow&quot;&gt;plugin specific DocBlock info&lt;/a&gt; that enables autocompletion around services.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-06-30T15:58:19.807" LastActivityDate="2015-06-30T15:58:19.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10418" PostTypeId="1" CreationDate="2015-06-30T16:50:57.920" Score="0" ViewCount="582" Body="&lt;p&gt;Looking to loop through and filter based on possible values in a text entry field...I have a text field called storeBanner that has 11 possible values (but could have more). Just need a way to go through every entry and create an array with all possible values.&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="377" LastEditDate="2015-06-30T16:59:30.140" LastActivityDate="2015-06-30T17:49:07.820" Title="Is there an easy way to loop through all existing values of an entry field and store them in an array?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10419" PostTypeId="2" ParentId="10418" CreationDate="2015-06-30T17:49:07.820" Score="1" Body="&lt;p&gt;I'm not sure about an array of the &lt;em&gt;possible&lt;/em&gt; values. But you can get the &lt;em&gt;actual&lt;/em&gt; values. You can do this with twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge filter&lt;/a&gt;. First get all the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('whatever') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop over the entries and add them to an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allValues = [] %}&#xA;&#xA;{% for oneEntry in allEntries %}&#xA;  {% if oneEntry.storeBanner not in allValues %}&#xA;    {% set allValues = allValues | merge([oneEntry.storeBanner]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;allValues&lt;/code&gt; will be an array of the values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things to notice:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You need to set &lt;code&gt;allValues&lt;/code&gt; outside of the for-loop. Otherwise it will only exist in the scope of the for loop, and not afterwards - ouside it.&lt;/li&gt;&#xA;&lt;li&gt;You need to pass an array as the parameter of &lt;code&gt;merge&lt;/code&gt;. In this case an array with one value: &lt;code&gt;[oneEntry.storeBanner]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-06-30T17:49:07.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10421" PostTypeId="2" ParentId="492" CreationDate="2015-06-30T18:49:58.980" Score="3" Body="&lt;p&gt;Keep in mind that f you're running a &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment config&lt;/a&gt;, and have configured your local environment (i.e. craft.dev) to point to a remote database, you'll need to make any php.ini changes on your local machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the location of your php.ini file with &lt;code&gt;php --ini&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3832" LastActivityDate="2015-06-30T18:49:58.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10422" PostTypeId="1" CreationDate="2015-06-30T19:32:13.660" Score="1" ViewCount="1667" Body="&lt;p&gt;I apologize if this question has been asked before. I'm new at this and am struggling to figure out if what I need to do is possible/the right way to do it or if I need to structure my content differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My entries in a section have a field that use a checkbox field type. I would like to display entries that have a matching value based on that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA; Field: Vitamins,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Field Type: Checkboxes&#xA;              Option: Vitamin A  | Value: a&#xA;              Option: Vitamin B  | Value: b&#xA;              Option: Vitamin C  | Value: c&#xA;&#xA;Section: Vegetables&#xA;&#xA; -Entry: Broccoli&#xA;       Vitamins Field Values: a, c&#xA;&#xA; -Entry: Corn&#xA;       Vitamins Field Values: a, b&#xA;&#xA; -Entry: Squash&#xA;       Vitamins Field Values: a, b, c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out how to display all entries that contain Vitamin A.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-10-06T17:45:31.737" Title="Display entries with matching checkbox field values" Tags="&lt;entries&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10423" PostTypeId="1" AcceptedAnswerId="10431" CreationDate="2015-06-30T19:58:22.737" Score="3" ViewCount="390" Body="&lt;p&gt;I love that Redactor lets you choose existing entries, categories, and assets!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to set up a 'Files' source whose File System Path would be something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/hostingaccount/craft/files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where index.php is at &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/hostingaccount/public_html/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what source URL can point to that file location? It doesn't like &lt;code&gt;http://mydomain.com/files&lt;/code&gt;. Or am I all wrong, and the assets have to be in something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/hostingaccount/public_html/files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2015-06-30T20:03:46.523" LastActivityDate="2015-07-01T05:42:36.420" Title="Do assets have to be below public_html to access them in redactor?" Tags="&lt;assets&gt;&lt;url&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10424" PostTypeId="1" AcceptedAnswerId="10433" CreationDate="2015-06-30T20:12:39.543" Score="3" ViewCount="186" Body="&lt;p&gt;Is there any way to change the default configuration for the Dashboard globally, or per user group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't mind &lt;code&gt;Sysadmins&lt;/code&gt; seeing the &lt;em&gt;Blog &amp;amp; Tonic&lt;/em&gt; feed, but I don't want &lt;code&gt;Members&lt;/code&gt; (who access the CP only to add calendar events) to see &lt;em&gt;Blog &amp;amp; Tonic&lt;/em&gt;. It will just cause confusion for those users.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2015-07-01T06:12:48.207" Title="Global Dashboard Configuration" Tags="&lt;dashboard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10425" PostTypeId="2" ParentId="10422" CreationDate="2015-06-30T20:40:34.330" Score="3" Body="&lt;p&gt;After I posted my question I ended up coming with something that works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in craft.entries.section('Vegetables') if entry.Vitamins.contains('a') %}&#xA;      &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-06-30T20:40:34.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10426" PostTypeId="2" ParentId="10337" CreationDate="2015-06-30T20:48:58.877" Score="4" Body="&lt;p&gt;Was out of town so couldn't answer this question until now. With Google Maps for Craft you can do so like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set marker = entry.yourMapField.getMarker(0) %}&#xA;&#xA;{{ marker.lat }} {{ marker.lng }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can loop through all the markers on the map like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news') %}&#xA;&#xA;    {% for marker in entry.yourMapField.getMarkers() %}&#xA;&#xA;        {{ marker.address }}&amp;lt;br&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/objectivehtml/Google-Maps-for-Craft/wiki/Getting-Address-From-Map-Markers&quot; rel=&quot;nofollow&quot;&gt;https://github.com/objectivehtml/Google-Maps-for-Craft/wiki/Getting-Address-From-Map-Markers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19" LastActivityDate="2015-06-30T20:48:58.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10427" PostTypeId="2" ParentId="10422" CreationDate="2015-06-30T22:07:04.800" Score="1" Body="&lt;p&gt;I posted a similar question the other week, I managed to figure it out and I posted my code. Hope it helps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10321/filter-based-search-form/10370&quot;&gt;Filter based Search Form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-06-30T22:07:04.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10428" PostTypeId="1" AcceptedAnswerId="10429" CreationDate="2015-07-01T02:29:28.003" Score="1" ViewCount="126" Body="&lt;p&gt;I would like to use Composer to manage dependencies for my site, like Twitter's Bootstrap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a recommended way to integrate Composer with Craft to support managing this type of Global dependency (as opposed to managing dependencies for an individual plugin)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I make a plugin that somehow sets up Bootstrap as the theme for my site?&lt;/p&gt;&#xA;" OwnerUserId="3834" LastActivityDate="2015-07-01T03:29:35.973" Title="Using Composer to Manage Site-Level Dependencies" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10429" PostTypeId="2" ParentId="10428" CreationDate="2015-07-01T03:29:35.973" Score="3" Body="&lt;p&gt;I think what you really want is something like Bower:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://bower.io&quot; rel=&quot;nofollow&quot;&gt;http://bower.io&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has Bootstrap in its manifest, amongst many others.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-07-01T03:29:35.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10431" PostTypeId="2" ParentId="10423" CreationDate="2015-07-01T05:42:36.420" Score="3" Body="&lt;p&gt;Your Asset source file system path needs to be under your &lt;code&gt;public_html&lt;/code&gt; folder, so your 2nd example is correct: &lt;code&gt;/home/hostingaccount/public_html/files&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your corresponding Asset source URL would be &lt;code&gt;http://mydomain.com/files&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correct that, then Asset related functionality (including Redactor's) should start working.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-01T05:42:36.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10432" PostTypeId="2" ParentId="10424" CreationDate="2015-07-01T05:46:22.053" Score="0" Body="&lt;p&gt;There is currently no native way to do this in Craft, although it's probably worth an addition to the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feedback site&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-01T05:46:22.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10433" PostTypeId="2" ParentId="10424" CreationDate="2015-07-01T06:12:48.207" Score="3" Body="&lt;p&gt;Have a look at &lt;a href=&quot;https://github.com/boboldehampsink/onedashboard&quot; rel=&quot;nofollow&quot;&gt;One Dashboard&lt;/a&gt; which works nicely. I've used it to set each users Dashboard to show a collection of pre-defined Analytics widgets.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-07-01T06:12:48.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10434" PostTypeId="1" AcceptedAnswerId="10440" CreationDate="2015-07-01T07:33:22.100" Score="3" ViewCount="100" Body="&lt;p&gt;What would be a good approach to integrate a service like &lt;a href=&quot;http://bugsnag.com&quot; rel=&quot;nofollow&quot;&gt;Bugsnag&lt;/a&gt;? Is there some kind of global Error/Exception Handler where everything is routed through and I could hook in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Find the finished Plugin here: &lt;a href=&quot;https://github.com/Goldinteractive/craft-bugsnag&quot; rel=&quot;nofollow&quot;&gt;craft-bugsnag&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1119" LastEditorUserId="1119" LastEditDate="2015-07-02T20:04:07.740" LastActivityDate="2015-07-02T20:04:07.740" Title="Integrate Bugsnag" Tags="&lt;plugin-development&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10435" PostTypeId="1" CreationDate="2015-07-01T14:17:51.767" Score="0" ViewCount="154" Body="&lt;p&gt;I have the plugin Dukt Videos installed to latest version 1.0.31.  I setup a Matrix block field with these settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field handle: videos&#xA;Matrix Block handle: videoBlock&#xA;Matrix Video Field: videoURL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason this will not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for video in entry.videos %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;title: {{ video.title }}&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;url: {{ video.url }}&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;embed: {{ video.embed({ width: 300, height: 200 }) }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this error: Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;embed&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try this it also does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for blockMedia in entry.videos %}&#xA;    {{ blockMedia.videoUrl }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this error: Internal Server Error. Object of class Craft\Videos_VideoModel could not be converted to string&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong with this Dukt Videos Plugin?&lt;/p&gt;&#xA;" OwnerUserId="186" LastActivityDate="2015-07-02T10:12:08.980" Title="I can't get Dukt Videos working in a Matrix field?" Tags="&lt;plugin-duktvideos&gt;&lt;plugin-duktoauth&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10437" PostTypeId="2" ParentId="10435" CreationDate="2015-07-01T14:53:02.927" Score="3" Body="&lt;p&gt;I'm sure the documentation could be better, but this has nothing to do with Duct Video, it's simply a user error. Although a common one, when accessing things inside a matrix, assets field, or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for video in entry.videos %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;video&lt;/code&gt; is a matrix block. Not the field you've created inside that matrix blocktype. When accessing video.videoUrl, you get the an object of type Videos_VideoModel, same as when you add this field directly to an entry type. The correct way to do this (disregarding that videoUrl is a bad name for the video field) would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.videos %}&#xA;  {% set video = block.videoUrl %}&#xA;  &amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;title: {{ video.title }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;url: {{ video.url }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;embed: {{ video.embed({ width: 300, height: 200 }) }}&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-07-02T10:12:08.980" LastActivityDate="2015-07-02T10:12:08.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10438" PostTypeId="1" AcceptedAnswerId="10439" CreationDate="2015-07-01T15:14:02.520" Score="1" ViewCount="1429" Body="&lt;p&gt;How would I write a variable to detect if the current page/Url I'm viewing is for an entry, rather than a section home page or a single?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if I'm currently viewing an entry %}&#xA;    do this&#xA;{% else %}&#xA;    do this&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2015-07-01T16:42:09.317" Title="Variable to check if viewing an entry?" Tags="&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10439" PostTypeId="2" ParentId="10438" CreationDate="2015-07-01T16:42:09.317" Score="4" Body="&lt;p&gt;There are three &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow&quot;&gt;types of sections&lt;/a&gt; in Craft: singles, structures, and channels. You can use &lt;code&gt;entry.section.type&lt;/code&gt; to test if the current page is displaying one of these section types.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section.type == &quot;channel&quot; %}&#xA;&#xA;    &amp;lt;p&amp;gt;This is a channel&amp;lt;/p&amp;gt;&#xA;&#xA;{% elseif entry.section.type == &quot;single&quot; %}&#xA;&#xA;    &amp;lt;p&amp;gt;This is a single&amp;lt;/p&amp;gt;&#xA;&#xA; {% elseif entry.section.type == &quot;structure&quot; %}&#xA;&#xA;    &amp;lt;p&amp;gt;This is a structure&amp;lt;/p&amp;gt;&#xA;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastActivityDate="2015-07-01T16:42:09.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10440" PostTypeId="2" ParentId="10434" CreationDate="2015-07-01T17:45:20.503" Score="2" Body="&lt;p&gt;Yii does have &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onError-detail&quot; rel=&quot;nofollow&quot;&gt;onError&lt;/a&gt; and &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail&quot; rel=&quot;nofollow&quot;&gt;onException&lt;/a&gt; events that get raised when PHP errors/warnings/notices and exceptions happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to write a plugin that listened to those and did the Bugsnag magic, then.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-01T17:45:20.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10442" PostTypeId="2" ParentId="10416" CreationDate="2015-07-01T20:30:12.643" Score="3" Body="&lt;p&gt;The client must have added a new rule which was causing the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;changed from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule (.+) index.php?p=$1 [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule (.+) index.php [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not exactly sure why they added that but...&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-07-02T00:33:54.520" LastActivityDate="2015-07-02T00:33:54.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10443" PostTypeId="1" CreationDate="2015-07-01T22:08:02.957" Score="1" ViewCount="352" Body="&lt;p&gt;I created a simplistic Console Command class in my plugin folder containing this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionTest () {&#xA;    craft()-&amp;gt;templates-&amp;gt;renderString('index');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run the command: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;./yiic &amp;lt; plugin &gt; Test&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the follwing error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Property &quot;Craft\ConsoleApp.session&quot; is not defined.&#xA;exception 'CException' with message 'Property &quot;Craft\ConsoleApp.session&quot; is not defined.' in /Users/&amp;lt; username &amp;gt;/Sites/&amp;lt; project &amp;gt;/craft/app/framework/base/CComponent.php:130&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thoughts? The end goal here is to be able to render HTML emails and them at specific intervals, but for some reason when using craft services, I get session errors.&lt;/p&gt;&#xA;" OwnerUserId="3749" LastActivityDate="2015-08-28T17:32:17.663" Title="Session Error from Console Command" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10444" PostTypeId="1" AcceptedAnswerId="10446" CreationDate="2015-07-01T23:38:33.160" Score="2" ViewCount="769" Body="&lt;p&gt;I've recently built a site on Craft, and while developing it locally I had purchased a license for Craft Client. After publishing the website to the production server the administration panel is showing a modal window with the text &quot;You're running Craft Client with a Craft Personal license.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked and made sure the license.key file is where it's supposed to be, and that the file is accessible. I've built a couple of websites on Craft before and have not had this issue until now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried re-uploading the site to a different server/domain, and it said in the admin panel that the license didn't belong to this domain, but the other domain it was originally uploaded under. So it obviously is reading the license file. I clicked to transfer the license to the new domain, and the same issue started occurring (modal window the the message &quot;You're running Craft Client with a Craft Personal license. What would you like to do?&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Craft initially read the license file (otherwise how would it know that the site didn't belong to the domain?), it means the license file exists and is valid, so I suspect it's an issue on Craft's side. Unfortunately their support is taking a little long so I thought I'd come to the community to hopefully get some help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Ben.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; From what I remember from a year ago, this was entirely my own fault. I had purchased the license on the staged version of the site. My bad.&lt;/p&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="3811" LastEditDate="2016-05-18T23:45:12.020" LastActivityDate="2016-05-18T23:45:12.020" Title="Issue with Craft license not validating" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10445" PostTypeId="2" ParentId="10335" CreationDate="2015-07-01T23:39:15.577" Score="2" Body="&lt;p&gt;It turns out mod_security was the culprit, so disabling it got Craft working.&lt;/p&gt;&#xA;" OwnerUserId="3811" LastActivityDate="2015-07-01T23:39:15.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10446" PostTypeId="2" ParentId="10444" CreationDate="2015-07-01T23:43:56.720" Score="2" Body="&lt;p&gt;You can try clearing your cache, and/or emptying the contents of the &lt;code&gt;/craft/storage/runtime/&lt;/code&gt; folder. If it's just some cached data causing a problem, that would fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, I'd recommend waiting for P&amp;amp;T to get back to you... they're really the only ones who can &lt;em&gt;verify&lt;/em&gt; and &lt;em&gt;correct&lt;/em&gt; your licensing issues.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-01T23:43:56.720" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10447" PostTypeId="1" AcceptedAnswerId="10467" CreationDate="2015-07-02T05:16:46.230" Score="1" ViewCount="121" Body="&lt;p&gt;I'm trying to make a plugin more generally usable (so others could use it). For my own use, it uses a category field called 'mainCategory' but I'd like that the field handle could be specified in the plugin settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I imagine is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = $entry-&amp;gt;mainCategory-&amp;gt;last()-&amp;gt;uri;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin');&#xA;$settings = $plugin-&amp;gt;getSettings();&#xA;$fieldHandle = $settings-&amp;gt;categoryFieldHandle;&#xA;&#xA;$url = $entry-&amp;gt;getField($fieldHandle)-&amp;gt;last()-&amp;gt;uri;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-07-03T01:24:09.927" Title="How to use a dynamically defined field handle in a plugin?" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10448" PostTypeId="1" AcceptedAnswerId="10449" CreationDate="2015-07-02T09:37:27.407" Score="3" ViewCount="1482" Body="&lt;p&gt;I am pretty new to craft (just came from EE) and trying to output the last entry from a matrix field in my template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.gallery.last() %}&#xA;    {% set image = block.image.first() %}&#xA;    &amp;lt;img class=&quot;lazy&quot; src=&quot;{{ siteUrl }}img/assets/loader.gif&quot; data-src=&quot;{{ image.getUrl('galleryThumb') }}&quot; data-src-retina=&quot;{{ image.getUrl('galleryThumbRetina') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this isn't working as I thought, i've done some snooping but have had no luck, any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;-Graham&lt;/p&gt;&#xA;" OwnerUserId="3839" LastEditorUserId="22" LastEditDate="2017-05-09T23:50:53.560" LastActivityDate="2017-05-09T23:50:53.560" Title="How do I output the last matrix block?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10449" PostTypeId="2" ParentId="10448" CreationDate="2015-07-02T09:55:08.443" Score="1" Body="&lt;p&gt;Untested, but this should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the number of matrix blocks in the matrix field by using the Twig length filter like this (&lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;see Matrix documentation&lt;/a&gt; - scroll to the end):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numberOfBlocks = entry.gallery | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should then be able to get the last block by directly referencing it like this (since the array of matrix blocks is zero-based):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastBlock = entry.gallery[numberOfBlocks - 1] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have the last block, accessing the image field should work as you had in your original code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = lastBlock.image.first() %}&#xA;&amp;lt;img class=&quot;lazy&quot; src=&quot;{{ siteUrl }}img/assets/loader.gif&quot; data-src=&quot;{{ image.getUrl('galleryThumb') }}&quot; data-src-retina=&quot;{{ image.getUrl('galleryThumbRetina') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-07-02T09:55:08.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10450" PostTypeId="2" ParentId="10448" CreationDate="2015-07-02T10:10:57.807" Score="4" Body="&lt;p&gt;Twig comes with a &lt;code&gt;last&lt;/code&gt; filter which you should be able to use, so with your &lt;code&gt;entry.gallery&lt;/code&gt;  you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastBlock = entry.gallery|last %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will return the last element in the sequence, there's more info in the twig docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The last filter returns the last &quot;element&quot; of a sequence, a mapping, or a string:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/last.html&quot; rel=&quot;nofollow&quot;&gt;Twig last filter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-07-02T10:10:57.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10451" PostTypeId="1" CreationDate="2015-07-02T11:46:41.930" Score="4" ViewCount="12552" Body="&lt;p&gt;I have this loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for div in myHandleHere %}&#xA;&#xA;    &amp;lt;div&amp;gt; {{ block.text }} &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That actually outputs something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt; one &amp;lt;/div&amp;gt;&#xA;&amp;lt;div&amp;gt; two &amp;lt;/div&amp;gt;&#xA;&amp;lt;div&amp;gt; three &amp;lt;/div&amp;gt;&#xA;&amp;lt;div&amp;gt; ... &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want is, every 2 div, put them in a new container, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt; one &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt; two &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt; three &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt; ... &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please help&lt;/p&gt;&#xA;" OwnerUserId="3606" LastActivityDate="2015-07-02T20:03:31.013" Title="twig for loop put every 2 elements in a new container" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10452" PostTypeId="2" ParentId="10443" CreationDate="2015-07-02T12:52:37.543" Score="0" Body="&lt;p&gt;I received an email from craft:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Hey Frederick,&lt;/p&gt;&#xA;&lt;p&gt;This looks to be a bug in Craft. We're looking into it and will let you know what we find!&lt;/p&gt;&#xA;&lt;p&gt;-Brad&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3749" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-07-02T12:52:37.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10454" PostTypeId="1" AcceptedAnswerId="10469" CreationDate="2015-07-02T14:44:42.567" Score="0" ViewCount="702" Body="&lt;p&gt;Doing my first Craft job and stuck with a reverse related entries thing. &#xA;I’ve got a channel of “Sectors” and a channel of “News”. The entries in news have a relationship field back to the “Sectors”.&#xA;When I’m viewing a “Sector” entry, I want to show links to entries in News that have a relationship to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried a few things but essentially I’ve got this…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;div class=&quot;panel&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {{ entry.body }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% for entry in craft.entries.section('news').relatedTo(entry) %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, even though I have a news entry related to a specific Sector entry, the above code doesn't show any related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oddly, if I do this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').relatedTo(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get some output but it shows me something from a different channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m confused. Can someone help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Schoolboy error alert!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2015-07-02T15:36:06.190" LastActivityDate="2015-07-03T12:17:25.330" Title="Reverse Relationships" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10455" PostTypeId="2" ParentId="10451" CreationDate="2015-07-02T15:14:25.643" Score="5" Body="&lt;p&gt;I think &lt;code&gt;batch&lt;/code&gt; that @Alec Ritson mentioned is definitely the way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, here's another approach for fun.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/cycle.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;cycle&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cycle('&amp;lt;div&amp;gt;', '') }}&#xA;  {{ foo }}&#xA;{{ cycle('&amp;lt;/div&amp;gt;', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But let me repeat: I really think &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/batch.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;batch&lt;/code&gt;&lt;/a&gt; is the way to go.&lt;/p&gt;&#xA;" OwnerUserId="54" LastActivityDate="2015-07-02T15:14:25.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10456" PostTypeId="1" CreationDate="2015-07-02T15:49:15.170" Score="3" ViewCount="2811" Body="&lt;p&gt;is it possible to grab all the entries in a section that arent related to a category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('news').relatedTo('not',category)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doesnt seem to work but is there some other syntax?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2016-03-09T00:20:56.100" Title="Get entries NOT related to categories" Tags="&lt;relations&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10457" PostTypeId="2" ParentId="10456" CreationDate="2015-07-02T17:11:27.803" Score="1" Body="&lt;p&gt;Not sure if this will help much, but I did something similar with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set allNews = craft.entries.section('news') %)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in allNews.id(&quot;not #{category.id}&quot;)&lt;/code&gt; ... &lt;code&gt;{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps in some way. &lt;/p&gt;&#xA;" OwnerUserId="200" LastEditorUserId="200" LastEditDate="2015-07-02T17:20:11.073" LastActivityDate="2015-07-02T17:20:11.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10458" PostTypeId="1" AcceptedAnswerId="10459" CreationDate="2015-07-02T19:17:57.753" Score="1" ViewCount="852" Body="&lt;p&gt;In my 404 template I am extending a layout template. Inside that layout template I want to hide a section use an &lt;code&gt;{% if craft.request... == 404 %}&lt;/code&gt; test. Any ideas on how I can accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2015-07-02T19:39:43.903" Title="How can I test if a request returns a 404?" Tags="&lt;404-page&gt;&lt;404&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10459" PostTypeId="2" ParentId="10458" CreationDate="2015-07-02T19:39:43.903" Score="1" Body="&lt;p&gt;That solution is viable. You can just test to see if the entry or the template matches your 404 template/entry. If you routed everything correctly to display a 404 in case of error, you should be fine.&lt;/p&gt;&#xA;" OwnerUserId="3650" LastActivityDate="2015-07-02T19:39:43.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10460" PostTypeId="2" ParentId="10456" CreationDate="2015-07-02T19:43:33.303" Score="5" Body="&lt;p&gt;I got this to work with &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;noreferrer&quot;&gt;search&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set uncategorizedEntries&#xA;  = craft.entries.section('news').search('-category:*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;category&lt;/code&gt; is the category field. You are searching everything in &lt;code&gt;news&lt;/code&gt; which does &lt;em&gt;not&lt;/em&gt; have a &lt;code&gt;category&lt;/code&gt; field that matches &lt;code&gt;*&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-02T19:43:33.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10461" PostTypeId="1" AcceptedAnswerId="10466" CreationDate="2015-07-02T20:02:46.173" Score="5" ViewCount="831" Body="&lt;p&gt;Trying to create an archive page for each of my blog types within Craft. The page sorts by year and by month. (&lt;code&gt;year&lt;/code&gt; and &lt;code&gt;month&lt;/code&gt; are coming from my routes in this code.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using the following, I can print out each month with posts and the number of posts the month has. My problem is that I also need to print out the months with no post count and can't seem to figure out how to do that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInYear = craft.entries.section('pressReleases').limit(null).after(year).before(year+1) %}&#xA;&#xA;{% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will yield me a printout of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;April (7)&lt;/li&gt;&#xA;&lt;li&gt;March (4)&lt;/li&gt;&#xA;&lt;li&gt;February (1)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I just need to also print out all the months in between with a &lt;code&gt;(0)&lt;/code&gt; indicator.&lt;/p&gt;&#xA;" OwnerUserId="3842" LastEditorUserId="45" LastEditDate="2015-07-02T22:46:31.290" LastActivityDate="2015-07-02T22:46:31.290" Title="Creating an archive page with full year and month list" Tags="&lt;templating&gt;&lt;entries&gt;&lt;datetime&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10462" PostTypeId="2" ParentId="10451" CreationDate="2015-07-02T20:03:31.013" Score="8" Body="&lt;p&gt;I usually do this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in blocks %}&#xA;  {% if loop.index0 % 2 == 0 %}&#xA;    &amp;lt;div&amp;gt;&#xA;  {% endif %}&#xA;   {# other stuff #}&#xA;  {% if loop.index0 % 2 == 1 or loop.last %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, more generally,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cols = 2 %}&#xA;{% for block in blocks %}&#xA;  {% if loop.index0 % cols == 0 %}&#xA;    &amp;lt;div&amp;gt;&#xA;  {% endif %}&#xA;   {# other stuff #}&#xA;  {% if (loop.index0 % cols == cols - 1 or loop.last) %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-02T20:03:31.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10463" PostTypeId="1" AcceptedAnswerId="10472" CreationDate="2015-07-02T20:10:30.737" Score="2" ViewCount="401" Body="&lt;p&gt;Using this handy thing (&lt;a href=&quot;http://buildwithcraft.com/help/entry-archive&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/entry-archive&lt;/a&gt;) to create an archive page, but not quite doing what I need it to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up as a route to call &lt;code&gt;/year/month&lt;/code&gt;, replacing year with current year if not provided and replacing month with most recent month that has posts in it if not provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This version will print out all posts from a single year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInYear = craft.entries.section('pressReleases').limit(null).after(year).before(year+1) %}&#xA;&#xA;{% for entry in entriesInYear %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this version will print out the entire year into groups based on month:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;    &amp;lt;h2&amp;gt;{{ month }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what I need is to only get the posts from the month in the url and am not sure how to get there... basically an &lt;code&gt;entriesInMonth&lt;/code&gt; variable as opposed to an &lt;code&gt;entriesInYear&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3842" LastEditorUserId="45" LastEditDate="2015-07-02T22:17:53.290" LastActivityDate="2015-07-03T15:59:05.977" Title="Archive page - only show posts from certain month" Tags="&lt;templating&gt;&lt;entries&gt;&lt;datetime&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10464" PostTypeId="1" AcceptedAnswerId="10465" CreationDate="2015-07-02T21:56:53.833" Score="2" ViewCount="191" Body="&lt;p&gt;So I have &lt;code&gt;/calendar&lt;/code&gt; and linking previous/next months on that template. The previous/next month urls are &lt;code&gt;/calendar/2015-08&lt;/code&gt; and &lt;code&gt;/calendar/2015-08&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this custom route setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SFz3u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my &lt;code&gt;/calendar/2015-08&lt;/code&gt; I'm getting this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of my template looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_inc/_layout' %}&#xA;&#xA;{% block meta %}&#xA;&amp;lt;title&amp;gt;{% if entry.metaTitle|length %}{{ entry.metaTitle }}{% else %}{{ entry.title }}{% endif %}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot; /&amp;gt;&#xA;&amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ entry.metaKeywords }}&quot; /&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know why this happening but my question is how do I circumvent this? I want some of the same data on &lt;code&gt;/calendar&lt;/code&gt; to be on subsequent monthly calendar pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2015-07-02T22:49:12.860" Title="Monthly Calendar || Month View" Tags="&lt;children&gt;&lt;calendar&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10465" PostTypeId="2" ParentId="10464" CreationDate="2015-07-02T22:06:16.720" Score="3" Body="&lt;p&gt;Craft won't set the &lt;code&gt;entry&lt;/code&gt; variable automatically unless the route matches a particular entry. If you're sharing a template between routes that may or may not correspond to an entry, you need to make sure that var gets set explicitly by you if not automatically by Craft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.section('myStructure').slug('calendar').first %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="45" LastEditDate="2015-07-02T22:49:12.860" LastActivityDate="2015-07-02T22:49:12.860" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10466" PostTypeId="2" ParentId="10461" CreationDate="2015-07-02T22:18:36.730" Score="9" Body="&lt;pre&gt;&lt;code&gt;{% set groupedEntries = entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will give you an associative array where the keys are the months, and the values are the entries for that month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to loop over all the months, not just the ones in the &lt;code&gt;groupedEntries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make an array of all the months.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTheMonths = ['January', 'February', 'March', ... 'December'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make an array of all the months that have entries (twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/keys.html&quot;&gt;keys filter&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthsWithEntries = groupedEntries | keys %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop over the months (all of them), and output either the number of entries (&lt;code&gt;groupedEntries[month]|length&lt;/code&gt;) or &lt;code&gt;0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for month in allTheMonths %}&#xA;  {% if month in monthsWithEntries %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ groupedEntries[month]|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% else %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ month }}&amp;amp;nbsp;(0)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-02T22:18:36.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10467" PostTypeId="2" ParentId="10447" CreationDate="2015-07-03T01:24:09.927" Score="3" Body="&lt;p&gt;This should do it for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;$fieldHandle-&amp;gt;last()-&amp;gt;uri;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-03T01:24:09.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10468" PostTypeId="1" AcceptedAnswerId="10474" CreationDate="2015-07-03T11:51:17.597" Score="1" ViewCount="57" Body="&lt;p&gt;We've recently updated and now find that in debug mode we sometimes don't get the expected stack trace on error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a 500.twig file in place it displays that, otherwise we get the default Internal Server Error summary view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something that broke in the recent update?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-07-03T16:00:31.733" Title="Is there an issue with debug mode in 2.4?" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-07-03T18:22:35.633" ContentLicense="CC BY-SA 3.0" />
  <row Id="10469" PostTypeId="2" ParentId="10454" CreationDate="2015-07-03T12:17:25.330" Score="1" Body="&lt;p&gt;Schoolboy error alert!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the wrong field in my news entries. There was a category field set up which had the same values as the sector names. Once I'd replaced the field with the proper one it all worked as expected!&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2015-07-03T12:17:25.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10470" PostTypeId="1" CreationDate="2015-07-03T15:10:40.220" Score="3" ViewCount="643" Body="&lt;p&gt;In a template for a category page, I'm trying to output a list of links through to all categories within a category group but exclude the category that the user is on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that make sense? What I'm trying doesn't work, but I'm new to Craft and Twig!&lt;/p&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2015-07-03T16:00:27.100" Title="Display a list of categories excluding the current one" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10471" PostTypeId="1" CreationDate="2015-07-03T15:49:36.133" Score="4" ViewCount="416" Body="&lt;p&gt;I am relatively new to Craft and I am having a little trouble understanding how to build a simple search which will allow me to have dropdown of my categories which will return the selected category and return results on /products/results page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category called &quot;Products&quot; and have the following categories &quot;Fruit&quot;, &quot;Vegetables&quot;, &quot;Dairy&quot;, &quot;Herbs&quot;, &quot;Eggs&quot;, and &quot;Misc&quot;.  I would like to have these categories in a dropdown menu which would allow visitor to select the category they would like to view.  I also need it to show all product when they select &quot;All Products&quot;, with &quot;All Products&quot; being the default value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="3816" LastActivityDate="2015-08-15T16:23:53.047" Title="Simple search using a single category in Craft CMS" Tags="&lt;categories&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10472" PostTypeId="2" ParentId="10463" CreationDate="2015-07-03T15:59:05.977" Score="3" Body="&lt;p&gt;There's probably a cleaner way to go about this, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# These are probably coming from the querystring, but I'll hard code them here #}&#xA;{% set year = 2015 %}&#xA;{% set month = 'July' %}&#xA;&#xA;{% set entriesInYear = craft.entries.section('news').limit(null).after(year).before(year+1) %}&#xA;{% set groupedEntries =  entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{ month }}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in groupedEntries[month] %}&#xA;        &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll probably want to add error checking and validation in case no entries exist for the month or the month/year is invalid, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-03T15:59:05.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10473" PostTypeId="2" ParentId="10470" CreationDate="2015-07-03T16:00:27.100" Score="5" Body="&lt;p&gt;With a little help I got there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('developmentType').id('not ' ~ category.id) %}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for category in categories %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;btn&quot;&amp;gt;{{ category }} Opportunities&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2015-07-03T16:00:27.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10474" PostTypeId="2" ParentId="10468" CreationDate="2015-07-03T16:00:31.733" Score="1" Body="&lt;p&gt;There is a bug in the &lt;a href=&quot;http://buildwithcraft.com/updates#build2670&quot; rel=&quot;nofollow&quot;&gt;current release&lt;/a&gt; that's been fixed for the next one where PHP Errors/Warnings/Notices won't have the full stack trace shown even if the site is in devMode.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-03T16:00:31.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10476" PostTypeId="1" CreationDate="2015-07-03T18:14:46.123" Score="0" ViewCount="535" Body="&lt;p&gt;I've just made my first craft application and I'm ready to launch it. After looking at some topics I've decided I should go with DigitalOcean and ServerPilot. I have a domain, the only thing is that I don't know how to start. I've been hosting simple, static sites without databases and stuff before, but this seems complicated. Anyone know about a guide or tutorial or can share some knowledge on how to proceed to get the site online?&lt;/p&gt;&#xA;" OwnerUserId="3581" LastActivityDate="2015-07-06T17:30:33.553" Title="Host a Craft app" Tags="&lt;database&gt;&lt;deployment&gt;&lt;hosting&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10477" PostTypeId="2" ParentId="10476" CreationDate="2015-07-03T18:47:47.340" Score="3" Body="&lt;p&gt;If you've never built a site with a database before, I'd caution against going straight to DigitalOcean &amp;amp; ServerPilot. Those services are designed for people who have several years worth of experience dealing with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Databases&lt;/li&gt;&#xA;&lt;li&gt;.htaccess files&lt;/li&gt;&#xA;&lt;li&gt;Apache and/or Nginx&lt;/li&gt;&#xA;&lt;li&gt;Command-line tools&lt;/li&gt;&#xA;&lt;li&gt;Separate email management&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's like saying, &quot;I've never driven a car before, how does this Ferrari work?&quot; *&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* No disrespect, just meant as a joke.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I'd highly recommend a hosting service that will provide you with cPanel. While cPanel definitely has its flaws, it's an existing industry standard and a great way to get your feet wet with some of the more intricate aspects of web hosting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DigitalOcean &amp;amp; ServerPilot are great... I just wouldn't want you to get in over your head at this point.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-03T18:47:47.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10479" PostTypeId="2" ParentId="10456" CreationDate="2015-07-03T19:48:12.907" Score="7" Body="&lt;p&gt;If you want to do it in a single query, &lt;a href=&quot;https://craftcms.stackexchange.com/a/10460/45&quot;&gt;Marion's answer&lt;/a&gt; is probably the best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set idsHavingCategory = craft.entries.section('news').relatedTo(category).limit(null).ids() %}&#xA;&#xA;{% set omitIds = 'and, not ' ~ idsHavingCategory|join(', not ') %}&#xA;&#xA;{% set entries = craft.entries.section('news').id(omitIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inspired by this article, which shows how to (1) grab ids, and (2) query against them:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also references related solutions found in these answers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4930/45&quot;&gt;https://craftcms.stackexchange.com/a/4930/45&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4573/45&quot;&gt;https://craftcms.stackexchange.com/a/4573/45&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-07-03T19:48:12.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10480" PostTypeId="1" CreationDate="2015-07-03T20:27:58.727" Score="1" ViewCount="276" Body="&lt;p&gt;I'm working on a sign language dictionary project. Each individual sign (or word) is an entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to have an area that shows words that are similar to the word that is being currently viewed. I'm looking for a way to create reciprocal relationships between word entries to show these similar words. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I want to say that word A is related to word B. Then I'd like for word B to also be automatically related to word A without having to go into word B and manually create the relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to make this kind of reciprocal relationship in craft? Thanks for any ideas.&lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2015-07-03T20:27:58.727" Title="Is there any way to create reciprocal related entries?" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10481" PostTypeId="2" ParentId="9467" CreationDate="2015-07-03T20:59:53.863" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there no way to have separate templates for text and html emails in craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct.  That's something we're going to try to address in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the ampersand encoding, I can't reproduce that locally.  Maybe your email client is encoding it or there is an overly aggressive &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow&quot;&gt;mod_security&lt;/a&gt; / &lt;a href=&quot;https://suhosin.org&quot; rel=&quot;nofollow&quot;&gt;Suhosin&lt;/a&gt; / Apache setting that's doing it?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-03T20:59:53.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10482" PostTypeId="1" AcceptedAnswerId="10484" CreationDate="2015-07-03T22:17:06.950" Score="1" ViewCount="138" Body="&lt;p&gt;I'm trying to update the expiry field—based on an existing field (in this case &lt;code&gt;classDate&lt;/code&gt;)—as soon as an entry is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6662/auto-expire-on-entries&quot;&gt;this answer&lt;/a&gt;, the clever recursion code in carlcs' &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire/blob/master/autoexpire/AutoExpirePlugin.php#L61&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auto Expire&lt;/a&gt; plugin, I was able to get it working with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if ($entry-&amp;gt;section-&amp;gt;name == &quot;Classes&quot;)&#xA;    {&#xA;        $entry-&amp;gt;expiryDate = $entry-&amp;gt;classDate;&#xA;&#xA;        static $recursionLevel = 0;&#xA;&#xA;        if ($recursionLevel == 0)&#xA;         {&#xA;            $recursionLevel++;&#xA;            $saved =   craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;         }&#xA;&#xA;    }&#xA;&#xA;&#xA;});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that seems a little dirty because &lt;code&gt;saveEntry&lt;/code&gt; is going to get called again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to handle the recursion? &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10271/updating-an-entry-after-an-event-action-within-onsaveentry&quot;&gt;Bob's answer here&lt;/a&gt; leads me to believe you can call &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement&lt;/code&gt; which won't raise the &lt;code&gt;saveEntry&lt;/code&gt; event again but I couldn't get that to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? Seems too easy...&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-04T13:54:20.133" Title="Handling Endless Recursion in saveEntry?" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10483" PostTypeId="1" CreationDate="2015-07-03T23:51:13.360" Score="2" ViewCount="1305" Body="&lt;p&gt;With PHP 5.4+ we get a built-in webserver, &lt;a href=&quot;http://php.net/manual/en/features.commandline.webserver.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/features.commandline.webserver.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone had luck setting this up with Craft? It seems like it could be pretty straightforward, but I am not sure how to wire up a mysql database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular I am hoping to run this with Gulp/BrowserSync so that I can just fire up a livereload instance of Craft quick and easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a very basic pass-through I just did, it seems to kind of work - except it just has 404 pages and a &quot;Craft can’t connect to the database&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my gulpfile.js for reference: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gulp.task('php', function() {&#xA;    php.server({ base: 'public', port: 8010, keepalive: true});&#xA;});&#xA;&#xA;gulp.task('serve', ['php'], function() {&#xA;    browserSync.init({&#xA;        notify: false,&#xA;        reloadOnRestart: true,&#xA;        open: false,&#xA;        proxy: '127.0.0.1:8010'&#xA;    });&#xA;    gulp.watch('*.js').on('change', reload);&#xA;    gulp.watch(&quot;*.html&quot;).on('change', reload);&#xA;    gulp.watch(&quot;*.php&quot;).on('change', reload);&#xA;});&#xA;&#xA;gulp.task('default', ['serve']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: I connected to mysql without much problem (installed using Homebrew, and connecting with 127.0.0.1), but now I am getting:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Your server doesn’t meet the following requirements to run Craft:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Mcrypt is required.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="501" LastEditorUserId="501" LastEditDate="2015-07-04T00:21:54.773" LastActivityDate="2015-07-05T18:46:11.780" Title="Craft with the PHP Built-in server?" Tags="&lt;php&gt;&lt;server&gt;&lt;mcrypt&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10484" PostTypeId="2" ParentId="10482" CreationDate="2015-07-04T00:46:57.010" Score="2" Body="&lt;p&gt;I'm not sure if it's any less dirty, but another way you could do it would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entry-&amp;gt;section-&amp;gt;name == &quot;Classes&quot;)&#xA;        {&#xA;            craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update(&#xA;                'entries',&#xA;                array('expiryDate' =&amp;gt; DateTimeHelper::formatTimeForDb($entry-&amp;gt;classDate)),&#xA;                array('id' =&amp;gt; $entry-&amp;gt;id)&#xA;            );&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-07-04T13:54:20.133" LastActivityDate="2015-07-04T13:54:20.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10485" PostTypeId="2" ParentId="10483" CreationDate="2015-07-04T01:11:59.860" Score="0" Body="&lt;p&gt;Mcrypt is a &lt;a href=&quot;http://buildwithcraft.com/docs/requirements#required-php-extensions&quot; rel=&quot;nofollow&quot;&gt;requirement&lt;/a&gt; for Craft to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some &lt;a href=&quot;https://secure.php.net/manual/en/mcrypt.installation.php&quot; rel=&quot;nofollow&quot;&gt;general&lt;/a&gt; Mcrypt installation instructions and a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1611/mcrypt-is-required-on-os-x-mavericks-10-9-4&quot;&gt;few&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/262/mcrypt-is-required-on-ubuntu-14-04&quot;&gt;posts&lt;/a&gt; specifically about installing it for Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-04T01:11:59.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10486" PostTypeId="1" CreationDate="2015-07-04T03:16:03.227" Score="5" ViewCount="517" Body="&lt;p&gt;I've got a basic portfolio website which has &quot;prev project&quot; and &quot;next project&quot; buttons on each entry detail page. I'd like for when you reach the last project for the &quot;next project&quot; button to simply link back to the first instead of simply not appearing at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how this could be done? Thanks so much in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Prev Project&amp;lt;/a&amp;gt;{% endif %}&#xA; {% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Next Project&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3710" LastActivityDate="2015-07-04T22:20:24.123" Title="How to make next/prev links for entries circular/endless" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10487" PostTypeId="2" ParentId="10486" CreationDate="2015-07-04T08:27:56.250" Score="2" Body="&lt;p&gt;Could you do something like (untested)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextUrl = nextEntry is defined and nextEntry ? nextEntry.url : url('portfolio/root') %}&#xA;&amp;lt;a href=&quot;{{ nextUrl }}&quot;&amp;gt;Next page&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, for probably better usability &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if nextEntry %}&#xA;  &amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next Project&amp;lt;/a&amp;gt;&#xA; {% else %}&#xA;   &amp;lt;a href=&quot;{{ url('portfolio/root') }}&quot;&amp;gt;back to start&amp;lt;/a&amp;gt;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-07-04T08:27:56.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10488" PostTypeId="2" ParentId="10486" CreationDate="2015-07-04T22:20:24.123" Score="7" Body="&lt;p&gt;I'm going to assume your project section is named &lt;code&gt;projects&lt;/code&gt;, if it's not, replace it with you section name. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if nextEntry %}&#xA;    {% set nextEntryUrl = nextEntry.url %}&#xA;{% else %}&#xA;    {% set firstEntry = craft.entries.section('projects').first() %}&#xA;    {% set nextEntryUrl = firstEntry.url %}&#xA;{% endif %}&#xA;&#xA;{% if prevEntry %}&#xA;    {% set prevEntryUrl = prevEntry.url %}&#xA;{% else %}&#xA;    {% set lastEntry = craft.entries.section('projects').last() %}&#xA;    {% set prevEntryUrl = lastEntry.url %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;a href=&quot;{{ prevEntryUrl }}&quot;&amp;gt;Prev Project&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ nextEntryUrl }}&quot;&amp;gt;Next Project&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-04T22:20:24.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10489" PostTypeId="2" ParentId="10483" CreationDate="2015-07-05T18:46:11.780" Score="1" Body="&lt;p&gt;Brad Bell &lt;a href=&quot;https://craftcms.stackexchange.com/a/1142/1016&quot;&gt;mentions this about Craft&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Being a self-hosted PHP web application is a hard life. Your parents try to raise you correctly and equip you with the tools necessary to successfully go out into the world and live on some stranger's unknown, unfriendly and oftentimes hostile server environment so you can serve up web pages, but things are stacked against you.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's a great read. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hate to be &lt;em&gt;that&lt;/em&gt; guy, but any reason why you don't want to run something more common like MAMP? I haven't used PHP's built in server but there might be little things here and there that you'll pull your hair out over as to why your installation is functioning weirdly and it ends up being a little &quot;quirk&quot; with the PHP web server performing oddly with Yii or something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you're just fooling around, it's ideal to run the same software locally as you do on a &quot;live&quot; web server. Some people go so far as to clone the environment they're in (like Vagrant or some other virtual machine), but MAMP works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used Home Brew and I've even compiled PHP/MySQL/Apache manually on a Mac. It's a great exercise in dependency management, using the command line, and seeing what other packages all go into PHP—there's a ton!—but that's really where it ends. The web server stack is just a tool and MAMP gives me all of that in a simple download that you can easily move/remove. If you have more than one computer, you're going to have to repeat those home brew commands on every Mac you want to test on; MAMP is 3 clicks and I have the stack.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-07-05T18:46:11.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10490" PostTypeId="1" CreationDate="2015-07-05T22:36:51.283" Score="1" ViewCount="117" Body="&lt;p&gt;New Relic reporting seems to show a strong correlation between the &lt;code&gt;previewEntry&lt;/code&gt; method's transactions and a couple of recent apdex-based alerts (the periods indicated by the pink background):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qHYAn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The third period of previewing shown near the end of the chart is my failed attempt to trigger an alert; perhaps my test entry was less intensive than the client's.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To cut down on the number of previews generated, how can I set a minimum interval between preview update POSTs, such as five seconds?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: we think it likely that the alert from New Relic was not actually a problem in terms of performance, and that it's simply a case of all/most of the requests during those periods taking longer than usual. It's a relatively quiet site, and so the live preview POST requests can easily represent 100% of requests. So I'm not so worried about this now, but it might still be nice to be able to set a minimum interval between live updates when the live update feature has been activated.&lt;/p&gt;&#xA;" OwnerUserId="975" LastEditorUserId="975" LastEditDate="2015-07-06T19:16:12.077" LastActivityDate="2015-09-04T20:30:40.127" Title="How can I set live preview's minimum interval?" Tags="&lt;performance&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10491" PostTypeId="1" AcceptedAnswerId="10494" CreationDate="2015-07-06T07:53:03.860" Score="0" ViewCount="324" Body="&lt;p&gt;The typical way to get your user's IP address via PHP is with &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt;. This is pretty solid, but can lead to some IP detections that are surprisingly far away from the user's actual location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft also has it's own IP detection with &lt;code&gt;craft()-&amp;gt;request-&amp;gt;userHostAddress&lt;/code&gt;. This jumps through a few more hoops before finally falling back to &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which is better in terms of geolocation accuracy?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft docs say &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getIpAddress-detail&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Considering any of these server vars besides REMOTE_ADDR can be spoofed, this method should not be used when you need a trusted source for the IP address. Use &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt; instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think my source needs to be that &quot;trusted&quot;. I'm using the IP address for &lt;em&gt;best-guess geolocation&lt;/em&gt;, not for any sort of security purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm just looking for whichever one will pinpoint closest to the human user.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I'm well aware that IP detection is a lousy way to pinpoint users, and that HTML5 / JS offers much more accurate geolocation results. But when using that method, geolocation is optional &lt;em&gt;to the user&lt;/em&gt;, and they may deny permission to share their location. It's good to have the IP detection as a fallback.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-06T13:25:56.677" Title="$_SERVER['REMOTE_ADDR'] vs craft()-&gt;request-&gt;userHostAddress" Tags="&lt;plugin-development&gt;&lt;ip-address&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10492" PostTypeId="1" AcceptedAnswerId="10495" CreationDate="2015-07-06T12:50:43.820" Score="1" ViewCount="1173" Body="&lt;p&gt;I want to let my customer decide if they want a 2 or 3 column page so I made a radio button but now I need to show different content if they select one of them but I cant get the syntax right.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.column.contains ('two') %}&#xA;   content here for two columns&#xA;{% endif %}&#xA;&#xA;{% if entry.column.contains ('three') %}&#xA;   content here for three columns&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="22" LastEditDate="2017-05-09T23:50:28.670" LastActivityDate="2017-05-09T23:50:28.670" Title="Displaying content defined by radio button in admin panel" Tags="&lt;templating&gt;&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10493" PostTypeId="2" ParentId="10490" CreationDate="2015-07-06T13:19:08.143" Score="1" Body="&lt;p&gt;If you're referring to the time it takes between you click the &quot;Live Preview&quot; button and the time the actual Live Preview pane shows up, then that's currently not configurable in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might be worth adding to the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feedback&lt;/a&gt; site, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-06T13:19:08.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10494" PostTypeId="2" ParentId="10491" CreationDate="2015-07-06T13:25:56.677" Score="1" Body="&lt;p&gt;Between the two, I'd say that &lt;code&gt;craft()-&amp;gt;request-&amp;gt;userHostAddress&lt;/code&gt; is going to be a more reliable method.   It tries to take into account things like clients going though proxy servers, shared ISP IP addresses, etc. whereas you don't know any of that just relying on &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, as you pointed out, none of this is guaranteed to be reliable.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-06T13:25:56.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10495" PostTypeId="2" ParentId="10492" CreationDate="2015-07-06T14:15:55.577" Score="2" Body="&lt;p&gt;Close! You can get the selected &lt;a href=&quot;http://buildwithcraft.com/docs/radio-buttons-fields&quot; rel=&quot;nofollow&quot;&gt;radio button&lt;/a&gt; by its label (what the user sees) or the value you setup in the admin. I'm assuming you're using the value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.column == &quot;two&quot; %}&#xA;    {# show 2 column content #}&#xA;    2 columns&#xA;{% elseif entry.column == &quot;three&quot; %}&#xA;    {# show 3 column content #}&#xA;    3 columns&#xA;{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also try a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot; rel=&quot;nofollow&quot;&gt;switch&lt;/a&gt; statement. That gives you a way to fall back to a default option, which might be useful, and a cleaner way to check for more than a couple options (say the client wants a 3 column option with some a special sidebar that doesn't really fit):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.column %}&#xA;&#xA;    {% case &quot;two&quot; %}&#xA;&#xA;       {# show 2 column content #}&#xA;       {% include &quot;layouts/_2columns.html&quot; %}&#xA;&#xA;    {% case &quot;three&quot; %}&#xA;&#xA;       {# show 3 column content #}&#xA;       {% include &quot;layouts/_3columns.html&quot; %}&#xA;&#xA;    {% case &quot;threespecialsidebar&quot; %}&#xA;&#xA;       {# show 3 column content #}&#xA;       {% include &quot;layouts/_3column_sidebar.html&quot; %}&#xA;&#xA;   {% case &quot;default&quot; %}&#xA;&#xA;      {# default to a 1 column layout #}&#xA;      {% include &quot;layouts/_default.html&quot; %}&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To keep yourself sane, in the &lt;code&gt;switch&lt;/code&gt; example, also consider using a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; which will bring in a corresponding layout file, depending on which layout you want.  (A stray &lt;code&gt;div&lt;/code&gt; for example will drive you crazy.... consider putting your markup in separate files.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last thing: from a client standpoint, depending on what you're doing, an &lt;a href=&quot;http://buildwithcraft.com/features/entry-types&quot; rel=&quot;nofollow&quot;&gt;entry type&lt;/a&gt; might be a better way to handle multiple layouts or if there needs to be additional options/fields in a  certain layout. (In that case, use &lt;code&gt;entry.type&lt;/code&gt; instead of &lt;code&gt;entry.column&lt;/code&gt; but the rest of the syntax posted above would be exactly the same).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-07-06T14:26:25.520" LastActivityDate="2015-07-06T14:26:25.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10496" PostTypeId="2" ParentId="10476" CreationDate="2015-07-06T15:25:19.620" Score="2" Body="&lt;p&gt;I agree and disagree with &lt;a href=&quot;https://craftcms.stackexchange.com/a/10477/1016&quot;&gt;Lindsey's answer&lt;/a&gt;. Hosting really depends on how much downtime can you live with and what you have to spend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a professional job (where a client is paying you money), I'd heed his advice. It sounds like you want it on online pretty soon.  There's a lot of guides on getting a stack running (like &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;) but that can be a catch 22—you really need to get to a certain proficiency before all that will actually start working reliably. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just screwing around, though, there's no better way than to jump right in and start learning. I was in your shoes. In the last decade or so, shared hosting has gotten to be so terrible that a VPS—where you control what software you want to run—is ideal. I bet the bullet and started with a VPS myself (it was like a 384 MB RAM instance back in those days!). There were no clients on the line so it was a great way to learn.   Nowadays, I have a few clients who pay me for hosting and keeping their Craft (and WordPress) instances up to date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In additional to the Digital Ocean with a Server Pilot front end that you mentioned, I'm a big fan of Linode as well. I haven't used their &lt;a href=&quot;https://www.linode.com/managed&quot; rel=&quot;nofollow noreferrer&quot;&gt;managed service&lt;/a&gt; but they will set things up for you and do the grunt work for a little extra $$$ per month.  That lets you poke behind the curtain and see how the wizard set things up (without taking a chance on some dicey freelancer or something from e-lance). They can even setup something like cpanel for you if you need it to be more like &quot;shared&quot; hosting. That gives you most of the benefit of a private cloud server but without the cost of dedicated, managed server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if you want to stick with those unmanaged services, get someone who knows what they're doing, have them set it up for you and then help you maintain it while you get your feet wet. I haven't used server pilot, it seems interesting, though it really helps to know what's going on &quot;behind the scenes&quot;... 'nix is based on the command line so if you're not comfortable there, maintaining a server long term is going to be an upward battle no matter if you're using server pilot, webmin, ispconfig, etc.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-07-06T15:52:51.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10497" PostTypeId="2" ParentId="10476" CreationDate="2015-07-06T17:30:33.553" Score="3" Body="&lt;p&gt;In light of &lt;a href=&quot;https://craftcms.stackexchange.com/a/10496/45&quot;&gt;RitterKnight's answer&lt;/a&gt;, perhaps you deserve a real answer to your question... You asked &quot;where can I learn&quot;, and I said &lt;a href=&quot;https://craftcms.stackexchange.com/a/10477/45&quot;&gt;&quot;don't try this at home&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RitterKnight said:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;If you're just screwing around, though, there's no better way than to jump right in and start learning.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the stakes are low, go ahead and give it a shot... We've all been there before, so who am I to tell you not to try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ServerPilot + DigitalOcean&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://serverpilot.io/community/articles/connect-a-digitalocean-server.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Connect a DigitalOcean Server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.digitalocean.com/community/questions/how-to-best-set-up-serverpilot-to-work-with-digital-ocean-server&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to best set up ServerPilot to work with Digital Ocean server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DigitalOcean without ServerPilot&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://clearfirestudios.com/blog/setting-up-a-digital-ocean-droplet-for-expressionengine-or-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a DigitalOcean Droplet for ExpressionEngine or Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Misc.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/installing#additional-resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;Additional Resources&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/articles/setting-up-craft-with-vagrant&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up Craft with Vagrant&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-07-06T17:30:33.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10498" PostTypeId="1" CreationDate="2015-07-06T17:34:17.617" Score="2" ViewCount="542" Body="&lt;p&gt;I am having some issues understanding why validation is not working on my entry forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got an entry with several field types which aren't of type &quot;entries&quot; and the required validation is working properly on my front end forms using craft's error macro&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        {% for error in errors %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The validation is NOT working on my fields which are of type &quot;entries&quot;. Do you have to pass in the error object differently to the macro since &quot;entries&quot; are an array?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried calling the error macro like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ formErrors.errorList(entry.getErrors('houseCollege[0]')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ formErrors.errorList(entry.getErrors('houseCollege[]')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ formErrors.errorList(entry.getErrors('houseCollege')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and yes, I have this field marked as required in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I don't know how relevant this is, but in the form this value is being filled by a select element.&lt;/p&gt;&#xA;" OwnerUserId="3688" LastActivityDate="2016-12-19T00:14:53.997" Title="Entries Field Type Validation" Tags="&lt;form&gt;&lt;frontend&gt;&lt;entries-field&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10499" PostTypeId="1" AcceptedAnswerId="10626" CreationDate="2015-07-06T21:13:08.397" Score="1" ViewCount="844" Body="&lt;p&gt;I have a long list of categories in a specific category group, but only want to show a list of the categories from this group that currently have an entry associated with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to implement the solution that I found at this thread: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6762/how-can-i-output-a-list-of-categories-that-are-not-empty&quot;&gt;How can I output a list of categories that are not empty?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only categories with related entries are showing. However, it's not being narrowed down to specific to a specific category group. Here's my code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handshapeCategories = craft.categories.group('handshape').limit(null) %}&#xA;{% set entriesWithHandshapeCategories = craft.entries.relatedTo( handshapeCategories ).limit(null) %}&#xA;{% set handshapeCategoriesInUse = craft.categories.relatedTo(entriesWithHandshapeCategories) %}&#xA;&#xA;{% for handshapeCategory in handshapeCategoriesInUse %}&#xA;    &amp;lt;h3&amp;gt;{{ handshapeCategory }}&amp;lt;/h3&amp;gt;&#xA;{% endfor %}       &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas why the shown categories are not being limited to categories from the 'handshape' category group?&lt;/p&gt;&#xA;" OwnerUserId="3835" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-20T16:10:13.900" Title="Trouble getting a list of categories that have entries for a specific category group" Tags="&lt;categories&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10500" PostTypeId="1" CreationDate="2015-07-06T22:33:20.560" Score="2" ViewCount="1597" Body="&lt;p&gt;I have read previous questions and answers about the redactor rich text editor but in this version of Craft i only found simple.json and standard.json under &lt;strong&gt;craft/config/redactor&lt;/strong&gt;. I have tried with both but &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags are still replaced by &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;. Is there another way to add &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; into a redactor rich text field?&lt;/p&gt;&#xA;" OwnerUserId="3851" LastEditorUserId="218" LastEditDate="2015-07-07T16:06:02.333" LastActivityDate="2015-07-07T16:06:02.333" Title="&lt;div&gt; being replaced by &lt;p&gt; tags in redactor rich text editor" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10502" PostTypeId="2" ParentId="10500" CreationDate="2015-07-07T09:19:00.103" Score="2" Body="&lt;p&gt;Adding &lt;code&gt;&quot;replaceDivs&quot;: false&lt;/code&gt; to the config file should prevent this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I add a div in code view and save the entry, the div is still there when I open the entry again. Once I remove this setting the div is gone once I re-open the entry.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-07-07T09:19:00.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10503" PostTypeId="2" ParentId="10499" CreationDate="2015-07-07T10:49:27.683" Score="1" Body="&lt;p&gt;In order to limit the related categories to a specific category group I needed to add &lt;code&gt;.group('desiredCategoryGroup')&lt;/code&gt; to the last line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of what I came up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsCategories = craft.categories.group('news').limit(null) %}&#xA;{% set soriesWithNewsCategory = craft.entries.relatedTo( newsCategories ).limit(null) %}&#xA;{% set newsCategoriesInUse = craft.categories.relatedTo(soriesWithNewsCategory).group('news') %}&#xA;&#xA;&amp;lt;h2&amp;gt;List of News Categories in Use:&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for category in newsCategoriesInUse %}&#xA;        &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2015-07-07T10:49:27.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10504" PostTypeId="2" ParentId="2377" CreationDate="2015-07-07T12:21:54.067" Score="1" Body="&lt;p&gt;You can output tags as a list (using &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; tags) and add commas and &lt;code&gt;and&lt;/code&gt; with CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;li {display:inline}&#xA;li:before {content:', ';}&#xA;li:first-child:before {content:'';}&#xA;li:last-child:before {content:' and ';}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will require that all the spaces between tags be removed so that your template code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}{{ tag }}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2015-07-07T12:21:54.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10505" PostTypeId="2" ParentId="10500" CreationDate="2015-07-07T13:36:43.303" Score="3" Body="&lt;p&gt;You can create a new redactor config under craft/config/redactor named Simple-With-Divs.json with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic'],&#xA;    toolbarFixed: true,&#xA;    replaceDivs: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can select Simple With Divs under the Rich Text field type.&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2015-07-07T13:36:43.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10506" PostTypeId="2" ParentId="5442" CreationDate="2015-07-07T13:57:54.577" Score="2" Body="&lt;p&gt;Another possible source of Live Preview not working is your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt; config setting pointing to the wrong environment in a multi-environment setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had this problem when I'd set siteUrl globally in the config but had forgotten to override it for the staging environment that Live Preview was failing in. Adding a siteUrl for the staging environment fixed that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; false,&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://example.com/'&#xA;  ),&#xA;  '.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://example.dev/'&#xA;  ),&#xA;  'stage.example.com' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://stage.example.com/'&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-07-07T13:57:54.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10507" PostTypeId="1" AcceptedAnswerId="10509" CreationDate="2015-07-07T14:10:10.877" Score="3" ViewCount="51" Body="&lt;p&gt;Ok little stuck on this. I am trying to return the number of users registered after a specific date. So far I have tried the below using after but it is still returning all users regardless of the date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.status('active,pending').after('2015-06-22').total()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-07-07T20:18:00.050" Title="How can I return the number of users registered after a specified date?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10509" PostTypeId="2" ParentId="10507" CreationDate="2015-07-07T20:18:00.050" Score="1" Body="&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.status('active,pending').dateCreated('&amp;gt; 2015-06-22').total()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-07T20:18:00.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10512" PostTypeId="1" CreationDate="2015-07-08T09:18:49.047" Score="0" ViewCount="298" Body="&lt;p&gt;Thanks in advance to anyone who can help me :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a table field in Craft that my template is pulling in data from... the issue is that in the box at the start of each row I want a different image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time the loop goes round and pulls in the data for each row from the table in Craft I also want it to pull in an image using &lt;code&gt;craft.assets.folderId()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code so far.. it pulls in the individual images but it repeats the the first row of the table for each image... and then it pulls in all the the images again repeating the next row and so on...&#xA;please see this link to get an idea of what I mean: &lt;a href=&quot;http://code7dev11.co.uk/how-it-works&quot; rel=&quot;nofollow&quot;&gt;http://code7dev11.co.uk/how-it-works&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.howItWorksTable | length %}&#xA;        &amp;lt;table&amp;gt;&#xA;            {% for row in entry.howItWorksTable %}&#xA;                {% for image in craft.assets.folderId('2') %}&#xA;                &amp;lt;tr&amp;gt;&#xA;                    &amp;lt;td&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;{{ row.stages }}&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;{{ row.skillsLearnt }}&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;{{ row.classes }}&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;{{ row.price }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;/tr&amp;gt;  &#xA;                {% endfor %}&#xA;            {% endfor %}&#xA;        &amp;lt;/table&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastEditorUserId="57" LastEditDate="2015-07-08T17:33:58.633" LastActivityDate="2015-07-09T15:59:29.287" Title="Pull in images to table rows using craft.assets wilst looping through a table field" Tags="&lt;assets&gt;&lt;table&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10516" PostTypeId="1" CreationDate="2015-07-08T15:27:49.187" Score="2" ViewCount="277" Body="&lt;p&gt;I have a record for an entity my plugin needs and that may be related to many Entries, so I have a pivot table, much like Craft's usergroups_user table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm creating and updating my table fine and I'm not looking at my pivot table. I notice the the user group approach is to delete any entries before creating new ones:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function assignUserToGroups($userId, $groupIds = null)&#xA;{&#xA;    craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;delete('usergroups_users', array('userId' =&amp;gt; $userId));&#xA;&#xA;    if ($groupIds)&#xA;    {&#xA;        if (!is_array($groupIds))&#xA;        {&#xA;            $groupIds = array($groupIds);&#xA;        }&#xA;&#xA;        foreach ($groupIds as $groupId)&#xA;        {&#xA;            $values[] = array($groupId, $userId);&#xA;        }&#xA;&#xA;        craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;insertAll('usergroups_users', array('groupId', 'userId'), $values);&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I take it this is the best way to handle pivot tables and there is no 'sync' functionality similar to that found on Laravel's Eloquent class &lt;a href=&quot;http://laravel.com/docs/5.1/eloquent-relationships&quot; rel=&quot;nofollow&quot;&gt;http://laravel.com/docs/5.1/eloquent-relationships&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-07-08T17:39:54.370" Title="How to create plugin pivot table entries?" Tags="&lt;plugin-development&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10518" PostTypeId="2" ParentId="10516" CreationDate="2015-07-08T17:39:54.370" Score="1" Body="&lt;p&gt;There isn't an explicit &lt;code&gt;sync&lt;/code&gt; command, but Yii does support &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.arr#declaring-relationship&quot; rel=&quot;nofollow&quot;&gt;MANY_MANY&lt;/a&gt; relationships through Active Record and will &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1738/plugins-managing-related-records/1739#1739&quot;&gt;keep the data in the join table up-to-update automatically&lt;/a&gt; if you stick purely with Active Record.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-08T17:39:54.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10519" PostTypeId="2" ParentId="936" CreationDate="2015-07-08T19:20:39.523" Score="2" Body="&lt;p&gt;Have you tried setting Redactor's &lt;code&gt;paragraphize&lt;/code&gt; setting to &lt;code&gt;false&lt;/code&gt; for your Rich Text field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3360" LastActivityDate="2015-07-08T19:20:39.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10520" PostTypeId="1" CreationDate="2015-07-08T20:23:09.157" Score="5" ViewCount="710" Body="&lt;p&gt;If I have multiple paragraphs of text in a rich text field, and I select them all and select &quot;Quote&quot; from the formatting menu, the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags are stripped out and replaced with double &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tags, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&#xA;This is some text.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;Here's some more text.&amp;lt;br&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to preserve the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags, like so?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&#xA;    &amp;lt;p&amp;gt;This is some text.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;Here's some more text.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been through the Redactor documentation and config settings and haven't found anything that seems relevant.&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2016-02-15T16:10:55.217" Title="Preserving &lt;p&gt; tags inside a &lt;blockquote&gt; tag in a Redactor rich text field" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10521" PostTypeId="1" CreationDate="2015-07-09T01:24:08.703" Score="0" ViewCount="971" Body="&lt;p&gt;I would like to change the root folder name where my Craft install is currently at.  for example: website.com/dev to website.com/draft1.  When changing the folder name on my server and the site URL in the Craft admin settings to match, I get an error.  What am I missing?  Will I need to reinstall Craft from scratch under the new URL?&lt;/p&gt;&#xA;" OwnerUserId="3858" LastActivityDate="2015-09-10T06:22:21.747" Title="Changing root folder name" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10522" PostTypeId="2" ParentId="4510" CreationDate="2015-07-09T05:38:44.757" Score="4" Body="&lt;p&gt;This doesn't really address the problem either, but for anyone looking for &quot;States&quot; data (to replicate what Douglas McDonald did), here it is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;options&quot;:[{&quot;label&quot;:&quot;Alabama&quot;,&quot;value&quot;:&quot;AL&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Alaska&quot;,&quot;value&quot;:&quot;AK&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Arizona&quot;,&quot;value&quot;:&quot;AZ&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Arkansas&quot;,&quot;value&quot;:&quot;AR&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;California&quot;,&quot;value&quot;:&quot;CA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Colorado&quot;,&quot;value&quot;:&quot;CO&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Connecticut&quot;,&quot;value&quot;:&quot;CT&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Delaware&quot;,&quot;value&quot;:&quot;DE&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;District of Columbia&quot;,&quot;value&quot;:&quot;DC&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Florida&quot;,&quot;value&quot;:&quot;FL&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Georgia&quot;,&quot;value&quot;:&quot;GA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Hawaii&quot;,&quot;value&quot;:&quot;HI&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Idaho&quot;,&quot;value&quot;:&quot;ID&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Illinois&quot;,&quot;value&quot;:&quot;IL&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Indiana&quot;,&quot;value&quot;:&quot;IN&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Iowa&quot;,&quot;value&quot;:&quot;IA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Kansas&quot;,&quot;value&quot;:&quot;KS&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Kentucky&quot;,&quot;value&quot;:&quot;KY&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Louisiana&quot;,&quot;value&quot;:&quot;LA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Maine&quot;,&quot;value&quot;:&quot;ME&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Maryland&quot;,&quot;value&quot;:&quot;MD&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Massachusetts&quot;,&quot;value&quot;:&quot;MA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Michigan&quot;,&quot;value&quot;:&quot;MI&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Minnesota&quot;,&quot;value&quot;:&quot;MN&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Mississippi&quot;,&quot;value&quot;:&quot;MS&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Missouri&quot;,&quot;value&quot;:&quot;MO&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Montana&quot;,&quot;value&quot;:&quot;MT&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Nebraska&quot;,&quot;value&quot;:&quot;NE&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Nevada&quot;,&quot;value&quot;:&quot;NV&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;New Hampshire&quot;,&quot;value&quot;:&quot;NH&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;New Jersey&quot;,&quot;value&quot;:&quot;NJ&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;New Mexico&quot;,&quot;value&quot;:&quot;NM&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;New York&quot;,&quot;value&quot;:&quot;NY&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;North Carolina&quot;,&quot;value&quot;:&quot;NC&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;North Dakota&quot;,&quot;value&quot;:&quot;ND&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Ohio&quot;,&quot;value&quot;:&quot;OH&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Oklahoma&quot;,&quot;value&quot;:&quot;OK&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Oregon&quot;,&quot;value&quot;:&quot;OR&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Pennsylvania&quot;,&quot;value&quot;:&quot;PA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Rhode Island&quot;,&quot;value&quot;:&quot;RI&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;South Carolina&quot;,&quot;value&quot;:&quot;SC&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;South Dakota&quot;,&quot;value&quot;:&quot;SD&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Tennessee&quot;,&quot;value&quot;:&quot;TN&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Texas&quot;,&quot;value&quot;:&quot;TX&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Utah&quot;,&quot;value&quot;:&quot;UT&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Vermont&quot;,&quot;value&quot;:&quot;VT&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Virginia&quot;,&quot;value&quot;:&quot;VA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Washington&quot;,&quot;value&quot;:&quot;WA&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;West Virginia&quot;,&quot;value&quot;:&quot;WV&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Wisconsin&quot;,&quot;value&quot;:&quot;WI&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;Wyoming&quot;,&quot;value&quot;:&quot;WY&quot;,&quot;default&quot;:&quot;&quot;}]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a dropdown field.&lt;/li&gt;&#xA;&lt;li&gt;Navigate to the &lt;code&gt;craft_fields&lt;/code&gt; table&lt;/li&gt;&#xA;&lt;li&gt;Locate the row with your &lt;code&gt;states&lt;/code&gt; handle&lt;/li&gt;&#xA;&lt;li&gt;Add the data to the &lt;code&gt;settings&lt;/code&gt; column&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Output states in a dropdown&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for state in craft.fields.getFieldByHandle('states').getFieldType.options %}&#xA;    &amp;lt;option value=&quot;{{ state.value }}&quot;&amp;gt;{{ state.label }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Even better, create a reusable macro:&#xA;&lt;pre&gt;&lt;code&gt;&#xA;{% macro stateDropdownOptions(currentState) %}&#xA;    &amp;lt;option&gt;Select One&amp;lt;/option&gt;&#xA;    {% for state in craft.fields.getFieldByHandle('states').getFieldType.options %}&#xA;        &amp;lt;option value=&quot;{{ state.value }}&quot;{{ currentState is defined and state.value == currentState ? ' selected' : '' }}&gt;&#xA;            {{ state.label }}&#xA;        &amp;lt;/option&gt;&#xA;    {% endfor %}&#xA;{% endmacro %}&#xA;&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and use it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;{% import 'macros/form' as formMacros %}&#xA;&#xA;...&#xA;&#xA;&amp;lt;select name=&quot;states&quot;&gt;&#xA;    {{ formMacros.stateDropdownOptions(row.state) }}&#xA;&amp;lt;/select&gt;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastEditorUserId="270" LastEditDate="2015-07-13T21:32:22.140" LastActivityDate="2015-07-13T21:32:22.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10523" PostTypeId="1" AcceptedAnswerId="13127" CreationDate="2015-07-09T07:26:44.233" Score="2" ViewCount="485" Body="&lt;p&gt;I use craft transformations for resizing images. The transformation of jpg files works as exepted, but the transformation of a tif image does not work. Imagick is installed and in the backend it creats and shows thumbnails of the images. When i rename the image from .tif to .jpg it performs the transformation also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Twig code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.getUrl('preview') }}&quot; width=&quot;200&quot; height=&quot;200&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output HTML Code of a tif image looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;http://www.am-sb-coop.ch/internal/img/AM_HC16_KW00_Broccoli_rl_ZTG_DL.tif&quot; width=&quot;200&quot; height=&quot;200&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output HTML Code of a jpg image looks like this:&#xA;&lt;code&gt;&amp;lt;img src=&quot;http://www.am-sb-coop.ch/internal/img/_preview/AM_FOOD_KW28_Prix_Gar_Konfi_mg_01_ZTG_DL.jpg&quot; width=&quot;200&quot; height=&quot;200&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or have i missed a config setting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some images for explanation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mcRaO.jpg&quot; alt=&quot;Output in Browser&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UbCoa.jpg&quot; alt=&quot;Backend shows Thumbnails&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jZuC5.jpg&quot; alt=&quot;Transformation settings&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2017-02-23T15:50:38.650" Title="Image transformation of tif image does not work" Tags="&lt;image-transforms&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10524" PostTypeId="1" AcceptedAnswerId="11637" CreationDate="2015-07-09T11:51:50.440" Score="3" ViewCount="640" Body="&lt;p&gt;Is there an alternative to the Aviary plugin (&lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/AviaryImageEditor&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only need to be able to offer the client a visual interface for cropping (in 1 aspect ratio only). &#xA;While Aviary works great, it's limited at the moment to low res images and I really need high res images as I use them full screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know an alternative?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-09-26T03:29:11.180" Title="HighRes image crop tool (not Aviary plugin)" Tags="&lt;plugins&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10525" PostTypeId="1" CreationDate="2015-07-09T12:03:00.057" Score="2" ViewCount="116" Body="&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo/&quot; rel=&quot;nofollow&quot;&gt;Sprout SEO&lt;/a&gt; has a setting in the admin screens to &quot;Select the character that will be used between Title segments&quot;. I think it's called &lt;code&gt;seoDivider&lt;/code&gt;, but I can't see how to use this in my templates, and can't see any reference to it in the documentation.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-07-09T15:21:46.547" Title="Using Sprout SEO, how do I use the seoDivider setting in templates?" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10526" PostTypeId="1" CreationDate="2015-07-09T12:47:42.170" Score="5" ViewCount="1220" Body="&lt;p&gt;I have a field defined in my plugin called &lt;code&gt;video&lt;/code&gt; with &lt;code&gt;AttributeType::Mixed&lt;/code&gt; where I store a video_id and a title of a video. I need to look up the entry by the video_id (I can't do it via the the entry ID).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$entry-&amp;gt;section = 'video';&#xA;$entry-&amp;gt;search('video: video_id=' . $videoID);&#xA;return $entry-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but there has to be a better solution?&lt;/p&gt;&#xA;" OwnerUserId="402" LastEditorUserId="831" LastEditDate="2015-07-20T20:15:23.457" LastActivityDate="2015-07-21T07:41:35.173" Title="Get entry by value from custom field" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10527" PostTypeId="2" ParentId="10525" CreationDate="2015-07-09T15:21:46.547" Score="1" Body="&lt;p&gt;The SEO Divider setting will be used if you select the &lt;em&gt;&quot;Append Site Name to all Titles&quot;&lt;/em&gt; setting on the Basic SEO tab of your Default, and then override your title via code or a Meta Basic Field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the pipe character is selected as the divider:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Code Override Blog Post Name | Website Name&#xA;&#xA;Meta Basic Field Override Title Value | Website Name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-07-09T15:21:46.547" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10528" PostTypeId="2" ParentId="10512" CreationDate="2015-07-09T15:59:29.287" Score="1" Body="&lt;p&gt;Here is what I would do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, make an actual array of all the images (using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#find&quot; rel=&quot;nofollow&quot;&gt;find&lt;/a&gt; to make the array):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageArray = craft.assets.folderId('2').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, loop over the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.howItWorksTable %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in that loop each time you display a row, you can get the corresponding image (using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;loop variable&lt;/a&gt; &lt;code&gt;index0&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = imageArray[loop.index0] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Putting it all together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageArray = craft.assets.folderId('2').find() %}&#xA;&#xA;{% if entry.howItWorksTable | length %}&#xA;  &amp;lt;table&amp;gt;&#xA;    {% for row in entry.howItWorksTable %}&#xA;      &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot;&amp;gt;{{ row.stages }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ row.skillsLearnt }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ row.classes }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ row.price }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;/tr&amp;gt;  &#xA;    {% endfor %}&#xA;  &amp;lt;/table&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-09T15:59:29.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10529" PostTypeId="1" AcceptedAnswerId="10532" CreationDate="2015-07-10T00:03:27.677" Score="2" ViewCount="876" Body="&lt;p&gt;We've tried moving an existing, live Craft site to a new host (where we currently just have http access via an IP). We simply copied all files (all 'craft' files, the index.php file and our related assets) across to the new host and updated permissions where necessary. We then moved across the DB and updated config settings to connect to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, something is wrong. On the front end we get this message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Our site is temporarily unavailable. Please try again later.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when trying to access the CP, all we get is this message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Oops!&#xA;&#xA;Craft does not support backtracking to this version. Please upload Craft 2670 or later.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No idea what this means. As well, the version that the message references (2670) is the version we have installed on the live site and are trying to migrate across. Any help would be much appreciated - and I can share the dev URL non-publicly if needed.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2015-07-10T03:18:21.040" Title="Issues migrating Craft site to a new host" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10530" PostTypeId="1" AcceptedAnswerId="10629" CreationDate="2015-07-10T02:35:18.417" Score="5" ViewCount="423" Body="&lt;p&gt;Does &lt;code&gt;{{ url('handle') }}&lt;/code&gt; output the right url for localized sites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a fr/en site and both lang output the english paths, but shows the right content and language/strings on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit confused. How do you guys build your navigation?&lt;/p&gt;&#xA;" OwnerUserId="903" LastEditorUserId="57" LastEditDate="2015-07-10T03:13:02.280" LastActivityDate="2015-07-20T20:07:30.103" Title="Output localized urls in navigation" Tags="&lt;url&gt;&lt;localization&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10531" PostTypeId="2" ParentId="10523" CreationDate="2015-07-10T03:02:33.260" Score="1" Body="&lt;p&gt;Currently, only &lt;code&gt;jpg&lt;/code&gt;, &lt;code&gt;jpeg&lt;/code&gt;, &lt;code&gt;gif&lt;/code&gt;, &lt;code&gt;png&lt;/code&gt;, &lt;code&gt;wbmp&lt;/code&gt; and &lt;code&gt;xbm&lt;/code&gt; files are supported for image transforms using &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; and &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt;.  Additionally, if you have Imagick installed, Craft will also transform &lt;code&gt;svg&lt;/code&gt; files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-10T03:02:33.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10532" PostTypeId="2" ParentId="10529" CreationDate="2015-07-10T03:18:21.040" Score="3" Body="&lt;p&gt;Sounds like the database you restored on the new server isn't matching the files that are in place on that server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the &lt;code&gt;craft/app/Info.php&lt;/code&gt; file's &lt;code&gt;CRAFT_BUILD&lt;/code&gt; and &lt;code&gt;CRAFT_VERSION&lt;/code&gt; numbers and make sure they match what's in the &lt;code&gt;version&lt;/code&gt; and &lt;code&gt;build&lt;/code&gt; in the &lt;code&gt;craft_info&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to download a previous version of Craft to get a different build/version of the files, you can do so like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/223/where-can-i-download-previous-versions-of-craft/224#224&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-10T03:18:21.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10534" PostTypeId="2" ParentId="10523" CreationDate="2015-07-10T11:47:27.827" Score="3" Body="&lt;p&gt;I found the way to create thumbnails of tif files. You have to change the function isImageManipulatable in the file /craft/app/helpers/ImageHelper.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function isImageManipulatable($extension)&#xA;{&#xA;    $extensions = array('jpg', 'jpeg', 'gif', 'png', 'wbmp', 'xbm');&#xA;&#xA;   if (craft()-&amp;gt;images-&amp;gt;isImagick())&#xA;    {&#xA;        $extensions[] = 'svg';&#xA;    }&#xA;&#xA;    return in_array(mb_strtolower($extension), $extensions);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function isImageManipulatable($extension)&#xA;{&#xA;    $extensions = array('jpg', 'jpeg', 'gif', 'png', 'wbmp', 'xbm');&#xA;&#xA;   if (craft()-&amp;gt;images-&amp;gt;isImagick())&#xA;    {&#xA;        $extensions[] = 'svg';&#xA;        $extensions[] = 'tif';&#xA;    }&#xA;&#xA;    return in_array(mb_strtolower($extension), $extensions);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know, changing core code is not a real solution: i posted this change as a Craft feature request -&gt; &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8794456-better-support-of-image-types-in-image-transformat&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8794456-better-support-of-image-types-in-image-transformat&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2015-07-10T11:47:27.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10535" PostTypeId="1" CreationDate="2015-07-10T12:00:54.330" Score="1" ViewCount="64" Body="&lt;p&gt;I've got exactly the same issue reported here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/3023/plugin-wont-enable&quot;&gt;Plugin won&amp;#39;t enable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a really simple plugin that works fine on my local environment but won't enable on my remote dev server. I've followed the advice in that Question and checked all the file and class names but with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be any indication of problems in the logs either. I'm stumped. =(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code as requested:&#xA;FirstImagePlugin.php - &lt;a href=&quot;http://pastebin.com/ehVHF9vk&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/ehVHF9vk&lt;/a&gt;&#xA;FirstImageTwigExtension.php - &lt;a href=&quot;http://pastebin.com/D5C8QnjK&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/D5C8QnjK&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directory structure is simply just:&#xA;/plugins/firstimage/twigextensions&lt;/p&gt;&#xA;" OwnerUserId="3864" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-07-10T13:52:58.573" Title="Plugin won't enable on remote dev enviornment" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10536" PostTypeId="1" AcceptedAnswerId="10537" CreationDate="2015-07-10T20:32:50.177" Score="2" ViewCount="583" Body="&lt;p&gt;I have a &quot;/5minutes&quot; url in routes.php and people keep typing in &quot;fiveminutes&quot;. Is there a way to call a 301 redirect directly in routes.php or would I need to set up an action in my plugin (or alternatively mess with server settings)?&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="57" LastEditDate="2015-07-10T20:44:39.280" LastActivityDate="2015-07-11T03:22:19.327" Title="Setting up redirects from routes.php" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;routes&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10537" PostTypeId="2" ParentId="10536" CreationDate="2015-07-10T20:44:29.797" Score="3" Body="&lt;p&gt;I'd try and avoid the &lt;code&gt;routes.php&lt;/code&gt; route (pun intended).  There isn't any need to get Craft involved in a redirect when your web server (Apache?) can handle it much faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using Apache, then adding something like this to your public &lt;code&gt;.htaccess&lt;/code&gt; file should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^fiveminutes$ /5minutes [NC,R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Missed the part where you said this was in a plugin.  In that case you'd want to setup something like this in your main plugin's class file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'fiveminutes' =&amp;gt; array('action' =&amp;gt; 'myPluginController/fiveMinuteRedirect'),&#xA;   );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from your &lt;code&gt;MyPluginController.php&lt;/code&gt; class have an &lt;code&gt;actionFiveMinuteRedirect()&lt;/code&gt; method that simply did a permanent &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/BaseController#redirect-detail&quot; rel=&quot;nofollow&quot;&gt;redirect&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`$this-&amp;gt;redirect('5minutes', true, 301);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-07-11T03:22:19.327" LastActivityDate="2015-07-11T03:22:19.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10538" PostTypeId="1" CreationDate="2015-07-10T23:39:00.913" Score="2" ViewCount="403" Body="&lt;p&gt;So I have a few different channels for different types of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One called pages which is just for regular web pages. All of those entries work uppercase or lowercase so example.com/About and example.com/about both work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Entry URL Format for pages is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Entry Template is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/_page&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a problem with a few of my channels for blog entries and I believe it is because of the Entry URL Format being used, but at the same time that doesn't make sense since it works fine for the page channel. Example channel is called Articles and the Entry URL Format is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles/{postDate.year}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the Entry Template is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The main Articles page which shows the index of all articles etc is using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles/index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the articles directory which is probably causing the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem ends up being that example.com/articles works but example.com/Articles does not and goes to a 404. Now if I am inside of a single entry it can have caps so example.com/Articles/this-is-an-Article works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is hosted on a linux server. Only reason I mention that is because how linux handles cases differently, on the staging server which is windows they all work fine. So not sure if I would need to setup 301's for those blog channels using the index.html files inside each channel folder. Or if there is another way of handling this. Possibly a route, or a single but I don't see why that would be needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some singles setup like this as well but they work with or without caps... so something seems odd about these channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any thoughts on that.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-07-11T00:07:06.740" LastActivityDate="2016-03-11T00:24:26.780" Title="Case sensitive Channel urls problem" Tags="&lt;templating&gt;&lt;entries&gt;&lt;url&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10539" PostTypeId="2" ParentId="10538" CreationDate="2015-07-11T03:37:56.790" Score="3" Body="&lt;p&gt;It's not just Windows / Linux / OSX that have different file system case sensitivities, but even different distributions of Linux can have them.  Or the same distribution, but with different file systems.  Or the same distribution and same file system, but one has been configured to be case sensitive and the case insensitive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of accounting for all of the different possibilities for a given route (&lt;code&gt;example.com/articles&lt;/code&gt;, &lt;code&gt;example.com/Articles&lt;/code&gt;, &lt;code&gt;example.com/aRticles&lt;/code&gt;, &lt;code&gt;example.com/ArTiClEs&lt;/code&gt;), it's going to be much less of a headache to just force lowercase at the &lt;a href=&quot;https://stackoverflow.com/questions/19048192/force-lower-case-of-urls-override-previous-rules&quot;&gt;web server&lt;/a&gt; &lt;a href=&quot;https://www.simonholywell.com/post/2012/11/force-lowercase-urls-rewrite-php/&quot; rel=&quot;nofollow&quot;&gt;level&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-11T03:37:56.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10540" PostTypeId="1" CreationDate="2015-07-12T01:24:52.507" Score="2" ViewCount="1750" Body="&lt;p&gt;I've followed &lt;a href=&quot;https://craftcms.stackexchange.com/users/666/shanti&quot;&gt;Shanti's&lt;/a&gt; advice when &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2782/url-rewrite-not-working&quot;&gt;something similar&lt;/a&gt; happened to her. However, it hasn't resolved my problem and I think something else is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GoDaddy's support are quite usless (bascially just sales people). Having installed Craft as I normally would, I'm getting this &lt;strong&gt;Internal Server Error&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zSc5l.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't even get to the point of installing craft; even if I try going to &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;www.domain.com/index.php?p=admin/install&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have a feeling it's something to do with how the directories are structured for people with multiple domains on a host/reseller account. It looks something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FzAOP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website is setup to point to the &lt;strong&gt;&quot;/website3/public&quot;&lt;/strong&gt; directory. I know I could put the &lt;em&gt;Craft&lt;/em&gt; directory into the &lt;em&gt;Public&lt;/em&gt; folder and fiddle with the index.php &lt;strong&gt;$craftPath&lt;/strong&gt; variable. But I want to keep true to &lt;a href=&quot;http://buildwithcraft.com/docs/installing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Crafts Installation guide&lt;/a&gt;, and keep those files secure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you have a similar setup; how might I go about trouble shooting the problem of getting things pointing in the right directions?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-12T13:03:46.233" Title="Can't install Craft on a GoDaddy shared hosting server" Tags="&lt;installation&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10541" PostTypeId="2" ParentId="10521" CreationDate="2015-07-12T05:10:20.023" Score="4" Body="&lt;p&gt;No need to go through the installation process again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that &lt;code&gt;/dev&lt;/code&gt; is a folder under your public html folder that Craft's public index.php file lives in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So Craft's index.php lives in something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/path/to/public_html/dev/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And what you want to do is change the site to live in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/path/to/public_html/draft1/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that's the case, you'd just need to move anything in the &lt;code&gt;public_html/dev&lt;/code&gt; folder over to &lt;code&gt;public_html/draft1&lt;/code&gt; and update your &lt;code&gt;siteUrl&lt;/code&gt;.  That's either been defined in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file or under Settings-&gt;General in the control panel, depending on how your site is setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've defined any custom environment paths in &lt;code&gt;craft/config/general.php&lt;/code&gt;, they might need to be updated as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-12T05:10:20.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10542" PostTypeId="1" AcceptedAnswerId="10546" CreationDate="2015-07-12T10:44:54.510" Score="7" ViewCount="807" Body="&lt;p&gt;I want to display the current entry's index - like in this post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5125/get-entry-index&quot;&gt;Get entry index&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However my entries are in a structure section type not a channel, so they are not ordered by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is is possible to edit the solution (below) from the above post so that it is not sorting the entries by date but rather retaining the custom order of the structure?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get this entry + all entries posted before it #}&#xA;{% set postDateParam = '&amp;lt;= ' ~ entry.postDate|date('c') %}&#xA;{% set entryIds = craft.entries.section('news')&#xA;  .order('postDate asc').postDate(postDateParam).ids() %}&#xA;&#xA;{# Count them #}&#xA;{% set position = entryIds|length %}&#xA;&#xA;{{ position }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3867" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2019-03-05T20:15:36.310" Title="Get entry index - structure not channel" Tags="&lt;entry&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10543" PostTypeId="2" ParentId="10540" CreationDate="2015-07-12T13:03:46.233" Score="3" Body="&lt;p&gt;Thanks for the advice guys. It's helped me rule out the directories being an issue (sort of). Turns out that I was able to access the files in the craft directory all along. My issue related to the database settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, the 'server' setting in the 'craft/config/db.php' folder is set to 'localhost'. But for GoDaddy you need to use your hostname. Get that by &lt;a href=&quot;https://www.godaddy.com/help/viewing-your-database-details-with-shared-hosting-accounts-39&quot; rel=&quot;nofollow&quot;&gt;following these instructions.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need to amend your 'craft/config/general.php' settings to include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this time, I am unable to get clean-urls working on my Craft install. When 'omitScriptNameInUrls' is set to &lt;strong&gt;true&lt;/strong&gt;, and I try to access any page (besides the homepage), I get that &lt;strong&gt;Internal Server Error&lt;/strong&gt; again. I may open an new question for this as it seems to be slightly unrelated now. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-07-12T13:03:46.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10544" PostTypeId="2" ParentId="2782" CreationDate="2015-07-12T13:45:51.703" Score="5" Body="&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Quick answer (as per &lt;a href=&quot;https://craftcms.stackexchange.com/users/1016/ritterknight&quot;&gt;RitterKnight's&lt;/a&gt; comment)... just add &lt;code&gt;RewriteBase /&lt;/code&gt; to the top of your &lt;strong&gt;.htaccess&lt;/strong&gt; file in the root of your public/public_html directory.  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am on the same type of shared GoDaddy server, and continued to experience the same issue regardless of wether 'omitScriptNameInUrls' was set to true. I would get an &quot;Internal Server Error&quot; on all pages, apart from the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have since &lt;a href=&quot;https://stackoverflow.com/questions/17101600/htaccess-not-working-on-godaddy/23519720#23519720&quot;&gt;found a solution&lt;/a&gt; which is specifically tailored to GoDaddy sufferers. My .htaccess file now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DirectoryIndex index.php&#xA;AddDefaultCharset utf-8&#xA;&#xA;RewriteEngine on&#xA;Options +FollowSymlinks -MultiViews -Indexes   &#xA;&#xA;RewriteBase /&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;   RewriteEngine On&#xA;   # Send would-be 404 requests to Craft&#xA;   RewriteCond %{REQUEST_FILENAME} !-f&#xA;   RewriteCond %{REQUEST_FILENAME} !-d&#xA;   RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;   RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Success! I now have a Craft installation on a GoDaddy shared server, with clean-urls working!&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-08-15T21:09:34.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10545" PostTypeId="2" ParentId="2782" CreationDate="2015-07-12T14:03:10.260" Score="3" Body="&lt;p&gt;I have lord knows how many sites on GoDaddy (too many). The key to it is &lt;code&gt;RewriteBase&lt;/code&gt;. Just add it to the default &lt;code&gt;.htaccess&lt;/code&gt; and you're all set.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-07-12T14:03:10.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10546" PostTypeId="2" ParentId="10542" CreationDate="2015-07-12T17:35:08.520" Score="10" Body="&lt;p&gt;I found the clue for how to do this in the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling&quot;&gt;getPrevSibling&lt;/a&gt; documentation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;getPrevSibling() will return the previous sibling whether or not it’s enabled. If you want to get the closest enabled sibling, you can do this instead:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;{% set prevSibling = craft.entries.positionedBefore(entry).order('lft desc').first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this query will get the number of enabled previous siblings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevSibsCount = craft.entries.positionedBefore(entry).total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then your position will be that + 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set position = prevSibsCount + 1 %}&#xA;{{ position }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-12T17:35:08.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10547" PostTypeId="1" CreationDate="2015-07-13T05:50:16.100" Score="1" ViewCount="238" Body="&lt;p&gt;What I'm doing is fairly simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% set jobs = craft.entries.section('job').find({ order: 'dateCreated asc', limit: 0 }) %}&#xA;    {% for job in jobs %}&#xA;        {{ macros.jobProfile(job) }}&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... where the macro simply renders a block with a couple of things in it. I need to display all 200 entries I have, but Craft usually times out on that query (128MB RAM set).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to tell Craft to not fetch all fields of that query, so I can optimize it directly at that point? I believe I have some content blocks in there, which probably go into RAM and eat it up, but are not needed at that time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other recommendations are highly welcome. (I don't wanna write a plugin, or paginate at this point.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro jobProfile(job) %}&#xA;&#xA;    {% import _self as macros %}&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        {% cache %}&#xA;            {% set attributes = job.jobProfileAttributes %}&#xA;            {% set attributeStr = &quot;&quot; %}&#xA;            {% set counter = 0 %}&#xA;            {% for attr in attributes %}&#xA;                {% if counter == 0 %}&#xA;                    {% set attributeStr = attr.slug%}&#xA;                {% else %}&#xA;                    {% set attributeStr = attributeStr ~&quot; &quot; ~attr.slug%}&#xA;                {% endif %}&#xA;&#xA;                {% set counter = counter + 1 %}&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;div style=&quot;background-image: url({{ macros.renderImageUrl(job.jobProfileImage, 'teaser1') }})&quot;&#xA;                data-jobProfileAttributes=&quot;{{ attributeStr }}&quot;&amp;gt;&#xA;                &amp;lt;a class=&quot;teaserLink&quot; href=&quot;{{ url(job.uri) }}&quot;&amp;gt;&#xA;                    &amp;lt;h4&amp;gt;{{ job.jobProfileDesignation|raw }}&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endcache %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="608" LastEditorUserId="608" LastEditDate="2015-07-14T18:18:48.070" LastActivityDate="2015-07-14T18:18:48.070" Title="Limit fields in query / Optimize query" Tags="&lt;cache&gt;&lt;queries&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10549" PostTypeId="1" CreationDate="2015-07-13T08:42:32.333" Score="0" ViewCount="170" Body="&lt;p&gt;I am currently dynamically loading a background image using the style tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li style=&quot;background-image: url({{ project.portfolioImage.first().url }})&quot;&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to add support for retina screens, so I want to also upload a hi-res version as well as the standard one and serve whichever is applicable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use &lt;code&gt;{% includeHiResCss %}&lt;/code&gt; to do that? &lt;/p&gt;&#xA;" OwnerUserId="3867" LastEditorUserId="344" LastEditDate="2015-07-13T13:00:23.457" LastActivityDate="2015-07-13T18:36:48.660" Title="Dynamically load either standard res or hi-res background image" Tags="&lt;assets&gt;&lt;css&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10550" PostTypeId="1" AcceptedAnswerId="10555" CreationDate="2015-07-13T12:13:28.400" Score="3" ViewCount="110" Body="&lt;p&gt;Is there a plugin that allows to add a category via an entry page? I like how you're able to add categories in Wordpress admin right on a post page, not only via Categories section — this seems to facilitate the categorization of content by editors. It's possible that they'd rather skip the &lt;code&gt;Assign a category&lt;/code&gt; button than do some extra work to create the required categories, and ability to enter new categories within the entry page would help to avoid that.&lt;/p&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2015-12-01T02:52:00.557" Title="Plugin for creating categories on an entry page in Control Panel" Tags="&lt;categories&gt;&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10551" PostTypeId="2" ParentId="10550" CreationDate="2015-07-13T12:22:24.150" Score="1" Body="&lt;p&gt;Can you use tags maybe? I think they work kind of the same, and u're able to add new ones right in the entry.&lt;/p&gt;&#xA;" OwnerUserId="874" LastActivityDate="2015-07-13T12:22:24.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10552" PostTypeId="1" AcceptedAnswerId="10553" CreationDate="2015-07-13T13:17:16.427" Score="2" ViewCount="130" Body="&lt;p&gt;As I understand, I have (at least) the following two possibilities to list entries of a channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibility 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('example').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Possibility 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('example') %}&#xA;{% for entry in entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I am not experienced enough to understand the advantages and the disadvantates of these both possibilities (e.g. performance related etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I see: in possibility 2 I can reuse &quot;entries&quot; within the same template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be grateful for some further information on the differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&#xA;MISC&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="344" LastEditDate="2015-07-13T14:35:35.713" LastActivityDate="2015-07-13T15:22:22.407" Title="SET versus FIND" Tags="&lt;entries&gt;&lt;variable&gt;&lt;forloop&gt;&lt;set&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10553" PostTypeId="2" ParentId="10552" CreationDate="2015-07-13T15:22:22.407" Score="6" Body="&lt;p&gt;&lt;strong&gt;You're exactly right: The advantage of using the variable is that you can re-use it throughout your template, which helps keep things DRY.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you use &lt;code&gt;craft.entries&lt;/code&gt; in your template, Craft serves up an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt; — This is an object that &lt;em&gt;knows how&lt;/em&gt; to query the system for a set of entries... but it doesn't actually perform that query until you either &lt;em&gt;(a)&lt;/em&gt; call the &lt;code&gt;.find()&lt;/code&gt; method, or &lt;em&gt;(b)&lt;/em&gt; use the object as an interable in a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the first time you try to get an Array from the ElementCriteriaModel (either by creating the array explicitly with &lt;code&gt;find()&lt;/code&gt; or by creating it implicitly by treating it as an Array — THAT'S when Craft does the work of perofmring the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you need to do an operation directly on the array, you don't actually need to call the &lt;code&gt;.find()&lt;/code&gt; method. It's perfectly acceptable to let Craft do the smart thing automatically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(...) %}&#xA;{% for entry in entries %}&#xA;   ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's often a slight advantage to doing it this way, because it means if that variable never gets used (perhaps it's hidden away in an unsatisfied conditional or something), Craft never does the work of performing the query.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-07-13T15:22:22.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10554" PostTypeId="1" CreationDate="2015-07-13T16:50:23.183" Score="1" ViewCount="498" Body="&lt;p&gt;So I have some gated content entries and need to prevent these from being indexed by search engines etc. Currently using draft pages but the tokens expire which then causes a 404 if someone is to land on that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway to prevent these tokens from expiring? Or does anyone have any suggestions on a field to prevent specific entries from being indexed by search engines. Or any options for saving as hidden entry, would be nice if this was built into craft as it seems like a pretty common feature.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-07-13T17:58:50.817" LastActivityDate="2015-07-13T20:30:58.333" Title="Is it possible to disable token expiration? Or prevent follow from bots?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;entries&gt;&lt;draft&gt;&lt;token&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10555" PostTypeId="2" ParentId="10550" CreationDate="2015-07-13T18:00:09.427" Score="1" Body="&lt;p&gt;At this time, I don't believe such a plugin exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a complete listing of existing Craft plugins:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And if you'd like to submit a formal feature request for Craft, you can do so here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It would probably make more sense to request this for Craft's core (rather than a plugin), but you could also request it specifically as a plugin:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285730-plugin-ideas&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285730-plugin-ideas&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-13T18:00:09.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10556" PostTypeId="2" ParentId="1853" CreationDate="2015-07-13T18:03:34.567" Score="1" Body="&lt;p&gt;I know this is an old thread, but a solution has since been created...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the awesome &lt;strong&gt;&lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow&quot;&gt;Control Panel Nav&lt;/a&gt;&lt;/strong&gt; plugin, which lets you add whatever custom links you'd like!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-13T18:03:34.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10557" PostTypeId="2" ParentId="10554" CreationDate="2015-07-13T18:03:52.890" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Anyway to prevent these tokens from expiring?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#defaultTokenDuration&quot; rel=&quot;nofollow&quot;&gt;defaultTokenDuration&lt;/a&gt; to some really high value.  Just keep in mind this affects &lt;em&gt;all&lt;/em&gt; tokens on the site including the ones used for email account verification and password resetting.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or does anyone have any suggestions on a field to prevent specific entries from being indexed by search engines.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you know the URLs, you could list them in &lt;a href=&quot;https://en.wikipedia.org/wiki/Nofollow&quot; rel=&quot;nofollow&quot;&gt;nofollow&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-13T18:03:52.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10558" PostTypeId="2" ParentId="10554" CreationDate="2015-07-13T18:18:43.450" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Or does anyone have any suggestions on a field to prevent specific entries from being indexed by search engines.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could create a sitemap file that excludes those entries (based on some field in the entry), and include that sitemap in your robots.txt. That should discourage well-behaved search engines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you could &lt;a href=&quot;http://buildwithcraft.com/docs/templating/requirelogin&quot; rel=&quot;nofollow&quot;&gt;requireLogin&lt;/a&gt; on those pages, which would make them inaccessible to anyone not logged in (which would include bots).&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-13T18:18:43.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10559" PostTypeId="2" ParentId="10549" CreationDate="2015-07-13T18:36:48.660" Score="1" Body="&lt;p&gt;This is actually a difficult problem, and there are many possible solutions, none of which are optimal (until &lt;a href=&quot;http://caniuse.com/#feat=srcset&quot; rel=&quot;nofollow noreferrer&quot;&gt;img srcsets&lt;/a&gt; are better supported).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I would probably go about doing this, depends on a couple of factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is important to show &lt;em&gt;something&lt;/em&gt; on load, you need to include an initial image in the markup, like you have already. If that is not an issue, I would include the two different resolutions in data-attributes on the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;, and then add the appropriate one with Javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would probably go a little like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;markup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;li class=&quot;js-resp-bg-img&quot; data-low-res=&quot;{{ lowresimage.getUrl() }}&quot; data-high-res=&quot;{{ highresimage.getUrl() }}&quot;&amp;gt;....&amp;lt;/li&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;js: (not tested, probably needs tweaking to work)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function() {&#xA;    var windowWidth = window.innerWidth || $(window).width();&#xA;    var threshold = 600;&#xA;    $('.js-resp-bg-img').each(function(idx, elem) {&#xA;        var bgImageUrl = $(elem).attr('data-low-res');&#xA;        if (windowWidth &amp;gt; threshold) {&#xA;            bgImageUrl = $(elem).attr('data-high-res');&#xA;        }&#xA;        $(elem).css({&#xA;            backgroundImage: 'url(' + bgImageUrl + ')'&#xA;        });&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need something to display on load, you put the low res image in the style tag, and switch it out only when appropriate. Downside with this is you'll load the asset twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in my example I'm only testing for window width, if you need to you can do additional tests, for example testing for retina with &lt;a href=&quot;https://stackoverflow.com/questions/19689715/what-is-the-best-way-to-detect-retina-support-on-a-device-using-javascript&quot;&gt;this method.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-07-13T18:36:48.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10560" PostTypeId="2" ParentId="10554" CreationDate="2015-07-13T20:30:58.333" Score="2" Body="&lt;p&gt;I ended up adding a lightswitch for do not index. I am checking if this value exists in _layout.html if it does I am adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.noIndex %}&amp;lt;meta name=&quot;robots&quot; content=&quot;noindex,nofollow&quot;&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also updated my search results, sitemap entry template to check for the same thing and not include it in the sitemap file or the search results. As well as the dynamic sitemap.xml file. I believe this should be good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I extended the token expiration but I think with the above approach, we will just publish like normal and remove the token expiration.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-07-13T20:30:58.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10561" PostTypeId="1" AcceptedAnswerId="10574" CreationDate="2015-07-13T20:57:09.663" Score="1" ViewCount="326" Body="&lt;p&gt;Seriously considering installing Craft on CentOS w/SELinux.  I currently have it running on Ubuntu.  Anyone have any problems with that type of install?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chip&lt;/p&gt;&#xA;" OwnerUserId="1006" LastActivityDate="2015-09-16T18:41:13.267" Title="Any problems installing Craft on CentOS with SELinux enabled?" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10562" PostTypeId="1" AcceptedAnswerId="10564" CreationDate="2015-07-13T22:34:39.523" Score="2" ViewCount="283" Body="&lt;p&gt;I'm using sprouts form for craft and I built a form with a file upload field. It works fine but the problem is that in the backend form entries, I can only see the uploaded image as a thumbnail (img attached). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to download the image from the backend? or at list get the link to open it with the browser in full size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EusXc.png&quot; alt=&quot;Image uploaded in backend&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3871" LastActivityDate="2015-07-14T00:47:48.143" Title="Download images uploaded in backend with Sprout Form Plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10563" PostTypeId="2" ParentId="10562" CreationDate="2015-07-13T23:05:33.397" Score="1" Body="&lt;p&gt;Yes, is the current answer, but unfortunately it's not obvious or easy yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem, in my view, is actually the behavior allowed with the Craft Assets field, but the workflow where an admin user arrives at an asset field that was submitted by a user and that they wish to download is more likely to be encountered in a Form workflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have talked through the issue for a workflow like this with Pixel &amp;amp; Tonic and it's on their radar, but can't speak to how or when it might be addressed.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Right now, if you want do download that image you have to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Note down the name of the image&lt;/li&gt;&#xA;&lt;li&gt;Go to the Assets tab and find the image where it was uploaded &lt;/li&gt;&#xA;&lt;li&gt;Select the checkbox next to the image&lt;/li&gt;&#xA;&lt;li&gt;Select &quot;View Image&quot; from the dropdown (&lt;a href=&quot;http://cl.ly/image/0U3o2e3X122R&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/image/0U3o2e3X122R&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Download the image from your browser&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's as painful for me to write those steps as it is for you to read them!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some alternatives to consider, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use Sprout Email to send links&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could consider using custom emails with Sprout Email, and having your templates output the full URL to the assets you want to allow to be downloaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attach the files to your emails using Sprout Forms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add a hidden config setting to your &lt;code&gt;craft/config/general.php&lt;/code&gt; which enables the default Sprout Forms Notifications to add file attachments to the notification emails, and just download the files from the email notifications.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'sproutForms' =&amp;gt; array(&#xA;    'enableFileAttachments' =&amp;gt; true,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the long run, I hope my answer becomes dated and you will see:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assets Field allows users to right click and view or download images directly (Pixel &amp;amp; Tonic, I can't make any claims here)&lt;/li&gt;&#xA;&lt;li&gt;Sprout Email Notifications allow file attachments (Barrel Strength Design, it's on our list)&lt;/li&gt;&#xA;&lt;li&gt;Sprout Forms moves the option for file attachments into the Control Panel and out of a hidden config (Barrel Strength Design, it's on our list)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-07-13T23:05:33.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10564" PostTypeId="2" ParentId="10562" CreationDate="2015-07-14T00:47:48.143" Score="2" Body="&lt;p&gt;Here's a plugin that will add Download (well, open in new tab) links to files in the Assets fields when editing entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Hambrook/AssetLinks&quot; rel=&quot;nofollow&quot;&gt;AssetLinks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-07-14T00:47:48.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10565" PostTypeId="1" AcceptedAnswerId="10568" CreationDate="2015-07-14T01:44:26.227" Score="2" ViewCount="74" Body="&lt;p&gt;We are working on a help guide solution for Craft and our hope is to have all the guide content live in a single master Craft setup and then our client's sites could read and display this content in their admins through a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have the rough outlines of a proof of concept for it, the missing piece is sharing the content.  We are thinking of using RSS or JSON to do this but wanted to see if there was any other ways we should consider?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2015-07-14T02:11:37.883" LastActivityDate="2015-07-14T04:31:32.433" Title="How could I load content from one Craft install into a template of another" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10566" PostTypeId="1" AcceptedAnswerId="10567" CreationDate="2015-07-14T02:00:14.930" Score="0" ViewCount="49" Body="&lt;p&gt;I am trying to add a link around a section of code that I have made previously because the client wanted me to. The problem is the link doesn't work how it should. Instead of appearing around the the div it is appearing inside of the div but not only that it is appearing multiple times and has even rearranged elements of the div. I believe that this must have something to do with Craft because it is not an issue I have ever come across before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I am using is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('courses') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a class=&quot;course-link&quot; href=&quot;/courses/course&quot;&amp;gt;&#xA;            &amp;lt;h3 class=&quot;grey-box-h3&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;            {% for instructors in entry.instructor %}&#xA;                &amp;lt;p class=&quot;teacher&quot;&amp;gt;{{ instructors.title }}&amp;lt;/p&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;img src=&quot;{{ entry.banner[0].getUrl('courseImage') }}&quot; width=&quot;{{ entry.image[0].getWidth('courseImage') }}&quot; height=&quot;{{ entry.image[0].getHeight('courseImage') }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;list-info&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;price&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ entry.price }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;WACOM included*&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                {% for block in entry.terms.limit(1) %}&#xA;                    &amp;lt;ul class=&quot;dates&quot;&amp;gt;&#xA;                        &amp;lt;li&amp;gt;{{ block.time }} ({{ block.hours }} hrs)&amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li&amp;gt;{{ block.date }} {{ block.year }}&amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li&amp;gt;8 Weeks - {{ block.day }}&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endfor %}&#xA;&#xA;                &amp;lt;p class=&quot;desc&quot;&amp;gt;{{ entry.shortCourseDescription }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;div class=&quot;req&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Req:&amp;lt;/p&amp;gt;&#xA;&#xA;                    {% if entry.requiredPrograms.contains('Photoshop') %}&#xA;                        &amp;lt;a class=&quot;photoshop&quot; target=&quot;_blank&quot; href=&quot;http://www.adobe.com/au/products/photoshop.html&quot;&amp;gt;Photoshop&amp;lt;/a&amp;gt;&#xA;                    {% endif %}                                    &#xA;&#xA;                    {% if entry.requiredPrograms.contains('Sketch Up') %}&#xA;                        &amp;lt;a class=&quot;sketch-up&quot; target=&quot;_blank&quot; href=&quot;http://www.sketchup.com/&quot;&amp;gt;Sketch Up&amp;lt;/a&amp;gt;&#xA;                    {% endif %}                      &#xA;&#xA;                    {% if entry.requiredPrograms.contains('Maya') %}&#xA;                        &amp;lt;a class=&quot;maya&quot; target=&quot;_blank&quot; href=&quot;http://www.autodesk.com.au/products/maya/overview&quot;&amp;gt;Maya&amp;lt;/a&amp;gt;&#xA;                    {% endif %}                   &#xA;&#xA;                    {% if entry.requiredPrograms.contains('Zbrush') %}&#xA;                        &amp;lt;a class=&quot;zbrush&quot; target=&quot;_blank&quot; href=&quot;http://pixologic.com/&quot;&amp;gt;Zbrush&amp;lt;/a&amp;gt;&#xA;                    {% endif %}  &#xA;&#xA;                    {% if entry.requiredPrograms.contains('After Effects') %}&#xA;                        &amp;lt;a class=&quot;after-effects&quot; target=&quot;_blank&quot; href=&quot;http://www.adobe.com/au/products/aftereffects.html&quot;&amp;gt;After Effects&amp;lt;/a&amp;gt;&#xA;                    {% endif %}                      &#xA;&#xA;                    {% if entry.requiredPrograms.contains('Mud Box') %}&#xA;                        &amp;lt;a class=&quot;mudbox&quot; target=&quot;_blank&quot; href=&quot;http://www.autodesk.com/products/mudbox/overview&quot;&amp;gt;Mud Box&amp;lt;/a&amp;gt;&#xA;                    {% endif %} &amp;lt;/div&amp;gt;&#xA;&#xA;                    &amp;lt;a class=&quot;button&quot; href=&quot;{{ entry.getURL }}&quot;&amp;gt;More Info&amp;lt;/a&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the code that is appearing is this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;  &amp;lt;a class=&quot;course-link&quot; href=&quot;/courses/course&quot;&amp;gt;&#xA;  &amp;lt;h3 class=&quot;grey-box-h3&quot;&amp;gt;Intro to Drawing and Character Design&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;p class=&quot;teacher&quot;&amp;gt;Tim McBurnie&amp;lt;/p&amp;gt;&#xA;  &amp;lt;img src=&quot;http://cdwstudios.com/uploads/images/banners/_courseImage/course-introCHARACTER.jpg&quot; width=&quot;350&quot; height=&quot;165&quot;&amp;gt; &amp;lt;/a&amp;gt;&#xA;  &amp;lt;div class=&quot;list-info&quot;&amp;gt;&amp;lt;a class=&quot;course-link&quot; href=&quot;/courses/course&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;price&quot;&amp;gt;&#xA;      &amp;lt;p&amp;gt;$595.00&amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;WACOM included*&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;ul class=&quot;dates&quot;&amp;gt;&#xA;      &amp;lt;li&amp;gt;Time&amp;lt;/li&amp;gt;&#xA;      &amp;lt;li&amp;gt;Date&amp;lt;/li&amp;gt;&#xA;      &amp;lt;li&amp;gt;Date2&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;p class=&quot;desc&quot;&amp;gt;content&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;    &amp;lt;div class=&quot;req&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;course-link&quot; href=&quot;/courses/course&quot;&amp;gt;&#xA;      &amp;lt;p&amp;gt;Req:&amp;lt;/p&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=&quot;photoshop&quot; target=&quot;_blank&quot; href=&quot;http://www.adobe.com/au/products/photoshop.html&quot;&amp;gt;Photoshop&amp;lt;/a&amp;gt; &#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;a class=&quot;button&quot; href=&quot;http://cdwstudios.com/courses/introduction-to-drawing-character-design&quot;&amp;gt;More Info&amp;lt;/a&amp;gt; &#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/li&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice how the  is appearing multiple times and has actually change the order of the divs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why it is doing this?&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:49:50.240" LastActivityDate="2017-05-09T23:49:50.240" Title="Link tag appearing in a completely different spot than where I placed it. Best guess because of Craft" Tags="&lt;templating&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10567" PostTypeId="2" ParentId="10566" CreationDate="2015-07-14T02:39:43.930" Score="2" Body="&lt;p&gt;Was just cleaning up the formatting of your HTML and noticed that you seem to be missing the closing &lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt; for &lt;code&gt;&amp;lt;div class=&amp;quot;list-info&amp;quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It also looks like you've got nested anchor tags, which W3 defines as illegal:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements.&lt;/p&gt;&#xA;&lt;p&gt;Since the DTD defines the LINK element to be empty, LINK elements may not be nested either.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-07-14T02:39:43.930" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10568" PostTypeId="2" ParentId="10565" CreationDate="2015-07-14T04:31:32.433" Score="4" Body="&lt;p&gt;I think your idea of RSS or JSON would work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only reason I can think of to use RSS over JSON would be if there was a possibility you wanted RSS readers to be able to consume the content as well.  Otherwise, I'd just stick with JSON and expose it over a web accessible API.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-14T04:31:32.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10569" PostTypeId="1" AcceptedAnswerId="10570" CreationDate="2015-07-14T07:49:53.807" Score="4" ViewCount="527" Body="&lt;p&gt;So I'm setting up a multi-lingual site for the first time, and I'm having some problems with the urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;guide&lt;/a&gt;, step by step. I've set up the &lt;code&gt;siteUrl&lt;/code&gt; in &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'DEV' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'no' =&amp;gt; 'http://teknologi.dev/no/',&#xA;        'en' =&amp;gt; 'http://teknologi.dev/en/',&#xA;        'es' =&amp;gt; 'http://teknologi.dev/es/'&#xA;    ),&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I guess that works, since I get a message in General settings that the siteUrl has been defined elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5o1bS.png&quot; alt=&quot;General settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I have a section called &quot;Videos&quot;, which I've set up like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DPeqe.png&quot; alt=&quot;Videos section&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I list out all the entries, the URL to one entry looks right, but I'm getting a 404. If I however change the Entry URL Format to include the locale letters, ex: &lt;code&gt;no/videoer/{slug}&lt;/code&gt;, it works. But that makes the URLs write out the locales twice, so a URL might look like: &lt;code&gt;http://teknologi.dev/no/no/videoer/orkanger&lt;/code&gt;, which of course gives a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there some step I've missed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I also have this structure in my &lt;code&gt;www&lt;/code&gt; folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- .htaccess&#xA;- index.php // I needed this one for admin to work?&#xA;- no/&#xA;  - .htaccess&#xA;  - index.php&#xA;- en/&#xA;  - .htaccess&#xA;  - index.php&#xA;- es/&#xA;  - .htaccess&#xA;  - index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in each of the localized index files I have changed the &lt;code&gt;craftPath&lt;/code&gt; and the &lt;code&gt;CRAFT_LOCALE&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../../craft';&#xA;define('CRAFT_LOCALE', 'no');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While the root index.php points &lt;code&gt;craftPath&lt;/code&gt; to &lt;code&gt;../craft&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt; I tried deleting the root &lt;code&gt;index.php&lt;/code&gt;, and while &lt;code&gt;/no/&lt;/code&gt; still worked, every subpage (ex: &lt;code&gt;/no/videoer/&lt;/code&gt;) gave this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The requested URL /index.php was not found on this server.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do I need to do anything in my &lt;code&gt;.htaccess&lt;/code&gt; for locales?&lt;/p&gt;&#xA;" OwnerUserId="968" LastEditorUserId="968" LastEditDate="2015-07-14T08:20:54.157" LastActivityDate="2015-07-14T08:30:31.717" Title="Problems with channel and locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10570" PostTypeId="2" ParentId="10569" CreationDate="2015-07-14T08:30:31.717" Score="6" Body="&lt;p&gt;Okay, so I found the answer. And the reason it wasn't working is because I've been using another &lt;code&gt;.htaccess&lt;/code&gt; (a hybrid of h5bp and Craft) than the default that comes with the Craft download. And this &lt;code&gt;.htaccess&lt;/code&gt; included a &lt;code&gt;RewriteBase&lt;/code&gt;, which was set to &lt;code&gt;/&lt;/code&gt;. So when one tried to access &lt;code&gt;/no/{slug}&lt;/code&gt; the &lt;code&gt;RewriteBase&lt;/code&gt; would send it up one folder, basically. So I had to go into each of the locales &lt;code&gt;.htaccess&lt;/code&gt; and set their &lt;code&gt;RewriteBase&lt;/code&gt; to &lt;code&gt;/no&lt;/code&gt; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just gonna leave it here, and I'm pretty sure I'm gonna find this post again the next time I'm making a multi-lingual site and don't understand why all of my links are broken...&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-07-14T08:30:31.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10571" PostTypeId="1" AcceptedAnswerId="12031" CreationDate="2015-07-14T11:14:25.860" Score="2" ViewCount="609" Body="&lt;p&gt;I'm been kicking myself for hours and going round in circles trying to get list of entries displayed by category when the category is selected from within a SuperTable (static table) row. I would really appreciate if someone could please help point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure entries section named &quot;services&quot; with a number of entries created.&#xA;I have a category group named &quot;serviceCategories&quot;&#xA;I have a &quot;SuperTable&quot; static table field handle named &quot;service&quot;&#xA;In my SuperTable I have a row named &quot;serviceCategory&quot; which allows me to select a single category from the category group named &quot;serviceCategories&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to create a standalone web page that displays all the category titles with the list of related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('serviceCategories') %}&#xA;{% for category in categories %}&#xA;&#xA;  {{ category.title }}&#xA;&#xA;  {% set services = craft.entries.section('services').relatedTo(&#xA;    { targetElement: row.serviceCategory }&#xA;  ) %}&#xA;&#xA;  {% for service in services %}&#xA;    {{ service.title }}&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2197" LastActivityDate="2015-10-21T15:28:01.307" Title="Display entries by Category (Category in Super Table)" Tags="&lt;categories&gt;&lt;category&gt;&lt;plugin-supertable&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10572" PostTypeId="2" ParentId="10571" CreationDate="2015-07-14T13:07:06.803" Score="1" Body="&lt;p&gt;Do you need the targetElement option? Could you not just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set services = craft.entries.section('services').relatedTo(row.serviceCategory) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also where is &lt;code&gt;row&lt;/code&gt; coming from, because your not defining that anywhere? &lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2015-07-14T13:07:06.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10573" PostTypeId="1" AcceptedAnswerId="10576" CreationDate="2015-07-14T13:56:21.527" Score="1" ViewCount="398" Body="&lt;p&gt;I have just one locale (German, de). Now, I've changed my CP language to English ('defaultCpLanguage' =&gt; 'en' in general.php).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now, all my entries have disappeared in the CP (Craft Pro 2.4.2670).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help!&#xA;MISc&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-09-11T09:12:01.477" Title="German locale &amp; English CP language resulting in disappeared entries" Tags="&lt;control-panel&gt;&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10574" PostTypeId="2" ParentId="10561" CreationDate="2015-07-14T16:19:42.837" Score="2" Body="&lt;p&gt;Someone with more CentOS experience will probably want to chime in—like you I'm more familiar with Debian/Ubuntu—but I can't imagine it wouldn't work, assuming you configure SELinux correctly and you're &lt;a href=&quot;https://community.webfaction.com/questions/15849/craft-cms-needs-mysql-510-or-higher-to-run&quot; rel=&quot;nofollow noreferrer&quot;&gt;using&lt;/a&gt; at least CentOS 6, preferably the latest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, SELinux is an kernel level gatekeeper, preventing or allowing certain processes from reading/writing to parts of the file system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of how that affects Craft, you'll need to make sure it knows that Apache/PHP is allowed to write to &lt;code&gt;/craft/app&lt;/code&gt;, &lt;code&gt;craft/config&lt;/code&gt; and &lt;code&gt;craft/storage&lt;/code&gt; and whatever upload directories you have setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just perusing the SELinux docs and problems people have had with Yii and WordPress, assuming your Craft install is at &lt;code&gt;/var/www/craft/&lt;/code&gt; running something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /var/www/craft/&#xA;chcon -R -v -t public_content_rw_t app/ config/ storage/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... should open up the permissions. There's more to it than that obviously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you run PHP as an &lt;a href=&quot;http://forums.fedoraforum.org/showthread.php?t=288728&quot; rel=&quot;nofollow noreferrer&quot;&gt;FPM pool/CGI&lt;/a&gt;, as I do, that's &lt;a href=&quot;https://serverfault.com/questions/596790/selinux-label-for-php-fpm-sockets&quot;&gt;going to affect permissions&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://edvoncken.net/2010/06/configuring-selinux-for-wordpress/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; is based around setting up permissions for WordPress but it's still applicable for Craft.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:14:55.733" LastActivityDate="2015-07-14T17:19:10.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10575" PostTypeId="1" AcceptedAnswerId="10580" CreationDate="2015-07-14T18:37:06.460" Score="1" ViewCount="264" Body="&lt;p&gt;When you set up a table field column through the admin cp, you assign a name and a handle. When I var_dump the table field, all row data is referenced by column number. (e.g. col1, col5, col2, col3, col4)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $partnerProducts = $currentPartner['0']-&amp;gt;getContent()-&amp;gt;productInfo;&#xA;    foreach ($partnerProducts as $pp){ echo ($pp['col2']); }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These columns may not be in order depending on how they were drag and dropped in the admin control panel, which is super confusing from the PHP plugin side. Is there any way to reference the table items by their cp handle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You CAN do this from the twig side.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for partnerProduct in partner.productInfo %}&#xA;        {{ partnerProduct.sku  }}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm still not sure what the difference between &lt;code&gt;$currentPartner['0']-&amp;gt;getContent()-&amp;gt;productInfo;&lt;/code&gt; and &lt;code&gt;$currentPartner['0']-&amp;gt;productInfo&lt;/code&gt; is but the latter works.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="3512" LastEditDate="2015-07-23T22:45:00.933" LastActivityDate="2015-07-23T22:45:00.933" Title="Interacting with table fields via plugin" Tags="&lt;plugins&gt;&lt;fieldtypes&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10576" PostTypeId="2" ParentId="10573" CreationDate="2015-07-14T18:39:38.403" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#defaultCpLanguage&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The default language that the Control Panel should be rendered in, for users that haven’t specified their Preferred Locale.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;defaultCpLanguage&lt;/code&gt; is only applied for users that don't have a Preferred Locale set in their user profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your entries disappeared because you don't have any entries created in the English locale, yet.  You might need to enable &lt;code&gt;en&lt;/code&gt; under the Section's settings before that's an option.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-14T18:39:38.403" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10577" PostTypeId="1" AcceptedAnswerId="10590" CreationDate="2015-07-14T19:33:59.357" Score="0" ViewCount="636" Body="&lt;p&gt;I would like to use a &quot;dynamic&quot; variable (for lack of better words) in my plugin settings. I am sending whomever fills out my contact form a welcome email. I'd like to be able to include the persons name if I could.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my settings file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{&#xA;forms.textareaField({&#xA;    label:        &quot;Welcome email Message&quot;|t,&#xA;    id:           'welcomeEmailMessage',&#xA;    name:         'welcomeEmailMessage',&#xA;    instructions: &quot;The email message that is sent to that the person who filled out the contact form.&quot;|t,&#xA;    value:        (settings.welcomeEmailMessage ? settings.welcomeEmailMessage : &quot;Thank you {firstName} from {siteName}&quot;|t({ siteName: craft.app.siteName })),&#xA;    errors:       settings.getErrors('welcomeEmailMessage')&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know &lt;code&gt;{siteName}&lt;/code&gt; is a variable that's available everywhere. &lt;code&gt;{firstName}&lt;/code&gt; is the name of my form input that I'd like to somehow hook into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have all of the information I need to send the email to the user - just not sure how to connect the dots between the service that sends the email and the settings so I can use &lt;code&gt;{firstName}&lt;/code&gt; and it will get replaced with the value of the &lt;code&gt;firstName&lt;/code&gt; input field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my service if it helps to see what I'm trying to do...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;    $email-&amp;gt;toEmail = $contact-&amp;gt;email;&#xA;    $email-&amp;gt;subject = $settings-&amp;gt;guestSubject;&#xA;    $email-&amp;gt;body = $settings-&amp;gt;welcomeEmailMessage;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;Sorry, this is kind of hard to describe. I'll keep going maybe that will help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a contact form plugin, that has a setting of &lt;code&gt;welcomeEmailMessage&lt;/code&gt;. That setting allows the admin to set the text to the email that is sent to whomever filled out my form. Think of it like a confirmation email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, instead of just saying &quot;Hi there...&quot; I was trying to grab the value of the &lt;code&gt;firstName&lt;/code&gt; input and inject that into the email message that resides in the plugin settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email could then read: &quot;Hi there Bob...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached a screen shot of my settings page.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7i3Pm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can see in the image I have &lt;code&gt;{firstName}&lt;/code&gt; in the textarea. I'm struggling on how to grab the value from the contact form - and inject it into that template variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like it's very similar to the &quot;Email Settings&quot; area within the CP. Only instead of getting the dynamic parts from the install settings, I want to get the values from the form that was submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wWzdi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading though the comments, I'm struggling a little about how to implement them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &lt;code&gt;welcomeEmailMessage&lt;/code&gt;. It's located in my plugin's directory/templates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;        &amp;lt;div&amp;gt;&#xA;            Hello, {{ firstName }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my service I now have this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = new EmailModel();&#xA;craft()-&amp;gt;templates-&amp;gt;renderString($settings-&amp;gt;welcomeEmailMessage, ['firstName' =&amp;gt; $contact-&amp;gt;firstName]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now it seems like I need to tell my plugin how to get to that template?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-07-16T17:17:10.313" LastActivityDate="2015-07-17T05:48:40.957" Title="How do I use dynamic variables for plugin settings?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10578" PostTypeId="1" AcceptedAnswerId="10583" CreationDate="2015-07-15T00:30:46.860" Score="3" ViewCount="2190" Body="&lt;p&gt;I'm trying to create a route for an RSS feed which allows for the following routes. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain/feed&#xA;domain/category/feed&#xA;domain/category/subcategory/feed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the first two routes working and the category fetching logic looks okay to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far in my routes file I have the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'feed' =&amp;gt; 'feed/_index.twig',&#xA;'(?P&amp;lt;slug&amp;gt;[^/]+)/feed' =&amp;gt; 'feed/_index',&#xA;&#xA;// Additional New route&#xA;'(?P&amp;lt;slug&amp;gt;[^/]+)/(?P&amp;lt;slug&amp;gt;[^/]+)/feed' =&amp;gt; 'feed/_index',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That last line was added recently as I thought the child category would include the parent category in its route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I either get a 404 error without that new route, or when I do add that third route I get the following error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;preg_match(): Compilation failed: two named subpatterns have the same    &#xA;name at offset 27 (craft/app/etc/web/UrlManager.php:387)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-07-15T06:03:46.650" Title="How do I create an advanced route with multiple slugs?" Tags="&lt;routes&gt;&lt;php&gt;&lt;slug&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10579" PostTypeId="1" AcceptedAnswerId="10581" CreationDate="2015-07-15T01:59:30.490" Score="1" ViewCount="153" Body="&lt;p&gt;I am trying to set an &lt;code&gt;if&lt;/code&gt; statment that will show a &lt;code&gt;li&lt;/code&gt; if there is only one entry displaying. The issue I am having is that this entry is put into two different places via checking if it contains a checkbox.&#xA;I can only seem to managed to get it to display all the time or not at all&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I have at the moment is this&#xA;    &lt;code&gt;{% if entry.ENTRYNAME.contains('CHECKBOX OPTION') == 0 %} &amp;lt;li&amp;gt;CONTENT&amp;lt;/li&amp;gt; {% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that does not seem to work.&#xA;I am using the Check box contains option else where and it works fine. It's  just the value check that I cannot seem to get to work. I've also tried adding both &lt;code&gt;.length&lt;/code&gt; and &lt;code&gt;|length&lt;/code&gt; but neither of those seem to work. &lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:48:58.270" LastActivityDate="2017-05-09T23:48:58.270" Title="How do you set an &quot;If&quot; option on an entry that includes &quot;contains&quot;" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10580" PostTypeId="2" ParentId="10575" CreationDate="2015-07-15T02:22:49.877" Score="1" Body="&lt;p&gt;If you use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$partnerProducts = $currentPartner['0']-&amp;gt;productInfo;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you should be able to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($partnerProducts as $pp)&#xA;{&#xA;    echo ($pp['sku']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-15T02:22:49.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10581" PostTypeId="2" ParentId="10579" CreationDate="2015-07-15T03:34:23.193" Score="2" Body="&lt;p&gt;OKay so the solution I found is this. It was much more complicated than I wanted it to be but it works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set VARIABLE = 0 %}&#xA;{% for entry in craft.entries.section('ENTRY') %}&#xA;    {% if entry.FIELDNAME.contains('CHECKBOX OPTION') %}&#xA;        {% set VARIABLE = VARIABLE + 1 %}&#xA;        &amp;lt;li&amp;gt;CONTENT&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% if VARIABLE &amp;lt;= 1 %}&#xA;    &amp;lt;li&amp;gt;CONTENT&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3737" LastActivityDate="2015-07-15T03:34:23.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10582" PostTypeId="2" ParentId="10579" CreationDate="2015-07-15T04:05:20.523" Score="2" Body="&lt;p&gt;I'm not entirely sure what you're trying to do, so I don't know if these suggestions will help at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to check if a checkbox field only has one option checked then you can simply use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.FIELDNAME|length == 1 %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're trying to show it in one location if a certain checkbox is checked, and a different location if a different checkbox is checked, then try...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# location one (maybe header) #}&#xA;{% if entry.FIELDNAME.contains(&quot;Use Location 1&quot;) %}&#xA;    &amp;lt;li&amp;gt;CONTENT&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# elsewhere, location two (maybe footer) #}&#xA;{% if entry.FIELDNAME.contains(&quot;Use Location 2&quot;) %}&#xA;    &amp;lt;li&amp;gt;CONTENT&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-07-15T04:05:20.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10583" PostTypeId="2" ParentId="10578" CreationDate="2015-07-15T06:03:46.650" Score="6" Body="&lt;p&gt;Brad nails the problem in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10578/how-do-i-create-an-advanced-route-with-multiple-slugs#comment13751_10578&quot;&gt;his comment&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The error is because you've got two named subpatterns with the same name (&lt;code&gt;&amp;lt;slug&amp;gt;&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And the solution is simple... &lt;strong&gt;Change the name(s) of your subpattern(s)&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;code&gt;slug&lt;/code&gt; is just a convention of Craft. It doesn't matter what the names are, they can be anything useful to you:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;(?P&amp;lt;domain&amp;gt;[^/]+)/(?P&amp;lt;category&amp;gt;[^/]+)/feed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whatever values match those named patterns are automatically &lt;strong&gt;passed into the Twig template as &quot;magic&quot; variables&lt;/strong&gt;. So your Twig template can now make use of the &lt;code&gt;domain&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; values.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-15T06:03:46.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10584" PostTypeId="1" AcceptedAnswerId="10637" CreationDate="2015-07-15T11:11:50.010" Score="1" ViewCount="942" Body="&lt;p&gt;I get a 404 page when I try to open an Italian page. Homepage &lt;code&gt;www.domain.com/it/&lt;/code&gt; works, but when I proceed to &lt;code&gt;www.domain.com/it/assistenza-e-supporto&lt;/code&gt; it gives me a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;English version works. Any idea where I should look to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've followed the steps as desribed here: &#xA;&lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Config looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'cpTrigger' =&amp;gt; 'admin',&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_US' =&amp;gt; 'http://local.crafttraining.craft.dev/',&#xA;        'es' =&amp;gt; 'http://local.crafttraining.craft.dev/es/',&#xA;        'it' =&amp;gt; 'http://local.crafttraining.craft.dev/it/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;After a day of trying and searching I found out that once I remove the omitScriptNameInUrls from the general.php it works fine, but I would like to have nice url's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;.htaccess looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-bsh prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong. Thanks for helping me out with this.  &lt;/p&gt;&#xA;" OwnerUserId="1014" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:11.923" LastActivityDate="2017-11-09T19:38:11.923" Title="404 when opening a localized page" Tags="&lt;localization&gt;&lt;404&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10585" PostTypeId="1" AcceptedAnswerId="10593" CreationDate="2015-07-15T12:23:48.557" Score="1" ViewCount="252" Body="&lt;p&gt;I need to serve different home pages (structure entries) depending on the subdomain. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foo.example.com -&amp;gt; this will render an entry with slug &quot;foo&quot; &#xA;bar.example.com -&amp;gt; this will render an entry with slug &quot;bar&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far I created a plugin and fetched the proper entry based on the subdomain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class LocationsPlugin extends BasePlugin&#xA;{&#xA;    (...)&#xA;    public function init()&#xA;    {&#xA;        if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {&#xA;            (...)&#xA;            // at this point $entry is the entry I want to render &#xA;            // the problem is the following doesn't work:&#xA;            craft()-&amp;gt;templates-&amp;gt;render(&quot;subdomains/_entry&quot;, [&quot;entry&quot; =&amp;gt; $entry]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the layout rednered but without the content. Twig's blocks aren't rendered at all and I suspect init() hook is called before some initializations required by render().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question: How can I, having $entry in init(), just render it instead of the main page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;Jan&lt;/p&gt;&#xA;" OwnerUserId="3873" LastActivityDate="2015-07-16T08:57:21.980" Title="Custom subdomain routing with a pluign" Tags="&lt;routing&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10586" PostTypeId="1" CreationDate="2015-07-15T13:21:27.237" Score="2" ViewCount="587" Body="&lt;p&gt;I am making/trying to make a reservation system with Craft. Logged-in members should be able to make a reservation for a hotel room on the front-end, and change it later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am keeping a stock for the available hotel rooms in entries. I have channel section called &quot;rooms&quot;. In that section are 2 entries (= 2 different hotels). Every entry has information about the hotel (name, location,...) and has a matrix field with avaialble dates and stock for that date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do: a logged-in user can choose a date and choose a number of rooms on that date. He should also fill in all his personal details. I was thinking about making entries of that info in a new channel (e.g. &quot;reservations&quot;). The hard part is: when a user selects a number of rooms, I want the stock of that night edited in the rooms entry. So if we heve 20 rooms available, and a member makes a reservation for 2, the stock should be set to 18.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess the first answer to this will be &quot;write a plugin&quot;, but I have never written a plugin before, and I have no idea what's the best practice or where to start. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2016-01-12T00:15:34.537" Title="Edit multiple entries at once through the front-end" Tags="&lt;entries&gt;&lt;users&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10587" PostTypeId="1" AcceptedAnswerId="10589" CreationDate="2015-07-15T16:23:54.240" Score="3" ViewCount="230" Body="&lt;p&gt;We are migrating our site into Craft, which is by and far easy and pleasant. But I'm trying to match our old CMS's permalink structure, which used 2-character months in the URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When defining the structure to contain our old content, I'm unable to format the &lt;strong&gt;postDate.month&lt;/strong&gt; as I'd like. I thought the Twig below would work, but it's giving me the wrong digit for the month (or example it should be '07' but consistently gives me '12'):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{postDate.year}/{postDate.month|date('m') }/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure this is pretty simple, but I can't pin down the syntax. Could someone please give me a hand?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a URI like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/07/here-is-my-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3729" LastActivityDate="2015-07-15T16:42:11.723" Title="Formatting Slug {postDate.month} to 2 characters" Tags="&lt;postdate&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10588" PostTypeId="1" AcceptedAnswerId="10591" CreationDate="2015-07-15T16:34:31.907" Score="3" ViewCount="1044" Body="&lt;p&gt;When you create a new user in the craft backend CMS, it used to be possible to set (and change for existing users) the password.  It appears recently (last 6 months+) that this feature has been removed, is there a simple way to re-instate this feature or is the only way to set the password the password re-set url feature?&lt;/p&gt;&#xA;" OwnerUserId="685" LastEditorUserId="45" LastEditDate="2016-08-13T02:56:56.547" LastActivityDate="2016-08-13T02:56:56.547" Title="Set Users' passwords" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10589" PostTypeId="2" ParentId="10587" CreationDate="2015-07-15T16:42:11.723" Score="5" Body="&lt;p&gt;You should just be able to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;postDate|date('m')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;postDate&lt;/code&gt; by itself should give you a DateTime object which you can then apply the filter to.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-07-15T16:42:11.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10590" PostTypeId="2" ParentId="10577" CreationDate="2015-07-15T17:22:49.070" Score="3" Body="&lt;p&gt;First - you don't need a template file. You can type the template right into the settings textarea like you already had, and like the other email twig templates do it. Then, in your service, you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;body = craft()-&amp;gt;templates-&amp;gt;renderString($settings-&amp;gt;welcomeEmailMessage, ['firstName'=&amp;gt;$firstName]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The settings textarea then need to have something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hello {{firstName}}, welcome!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you should be all set!&lt;/p&gt;&#xA;" OwnerUserId="981" LastEditorUserId="981" LastEditDate="2015-07-17T05:48:40.957" LastActivityDate="2015-07-17T05:48:40.957" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10591" PostTypeId="2" ParentId="10588" CreationDate="2015-07-15T17:27:08.060" Score="8" Body="&lt;p&gt;For security reasons, this was changed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2615&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.3...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Admins are no longer allowed to change other users’ passwords.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But savvy admins can still pull it off... Simply click the gear icon in the right sidebar, and select &quot;Copy password reset URL&quot;. Then, instead of sending that URL to the user, just use it yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xNuA1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-15T17:27:08.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10592" PostTypeId="2" ParentId="10586" CreationDate="2015-07-15T19:23:44.900" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I guess the first answer to this will be &quot;write a plugin&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess you're right. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin would have a controller that your front-end form posts to.  From there you grab all of the needed data from POST and perform any custom business logic you want, including saving multiple entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The official plugin docs are here: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a &lt;a href=&quot;https://mijingo.com/products/screencasts/craft-plugin-development/&quot; rel=&quot;nofollow&quot;&gt;Craft Plugin Development&lt;/a&gt; course on &lt;a href=&quot;https://mijingo.com&quot; rel=&quot;nofollow&quot;&gt;Mijingo&lt;/a&gt; that I've heard good things about.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-15T19:23:44.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10593" PostTypeId="2" ParentId="10585" CreationDate="2015-07-16T08:57:21.980" Score="3" Body="&lt;p&gt;So I've been playing around with this and got stuck a few times, but I think I have a solution that could work for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the problem is actually because &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render()&lt;/code&gt; simply just gives you the compiled template back, it doesn't try and render it in the browser. So your plugins &lt;code&gt;init&lt;/code&gt; method is being hit, everything is working just fine, then it just goes past it and just keeps going until the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a controller method for rendering a template which is called like &lt;code&gt;$this-&amp;gt;renderTemplate&lt;/code&gt; which according to the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This is a shortcut for TemplatesService::render(), but rather than returning the rendered template, it will output it to the browser and end the request. It will also include any CSS and JS that is queued up via includeCssFile(), includeJsFile(), et al., and it will set the appropriate MIME type header based on the template file’s extension.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/BaseController#renderTemplate-detail&quot; rel=&quot;nofollow&quot;&gt;You can see the method from the Class reference here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I don't think you can or should try and call controller methods from within your plugin's &lt;code&gt;init&lt;/code&gt;, so I think you need to do something inspired by this method i.e just echo the content and end the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is what I have used and it worked for me just fine, it might need some tweaking and more inspiration from the &lt;code&gt;renderTemplate&lt;/code&gt; method, but it works as a start.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {&#xA;&#xA;  // Get your entry however you wish&#xA;  $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(264);&#xA;&#xA;  // Render the template with $entry and set it to output&#xA;  $output = craft()-&amp;gt;templates-&amp;gt;render('arena', [&quot;entry&quot; =&amp;gt; $entry]);&#xA;&#xA;  // ** From renderTemplate **&#xA;&#xA;  // Output it into a buffer, in case TasksService wants to close the connection prematurely&#xA;  ob_start();&#xA;&#xA;  echo $output;&#xA;&#xA;  // End the request&#xA;  craft()-&amp;gt;end();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From this i got a rendered template in the browser, output the entries title using &lt;code&gt;{{ entry.title }}&lt;/code&gt; and also all the &lt;code&gt;{% extends %}&lt;/code&gt; &lt;code&gt;{% block %}&lt;/code&gt; tags and everything else seemed to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a better solution then i'm all ears, but this is what I could come up with from looking around the source/docs/stackexchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-07-16T08:57:21.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10594" PostTypeId="1" AcceptedAnswerId="10596" CreationDate="2015-07-16T10:13:39.737" Score="3" ViewCount="560" Body="&lt;p&gt;Ok scenario that I'd like to create.&#xA;Create a custom field type lets call it videos. In this field type you would have 5 separate fields title, description, caption, link, thumb. This would make up the field type which could then be selected from the field type when creating a new field in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The objective is that this grouped field type could then be re-used within separate matrix fields or as a field in it's own right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can create field types for plugins but is there a way to create the above?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-07-16T11:23:44.130" LastActivityDate="2015-07-16T17:42:16.420" Title="Custom field type that has multiple fields to extend the default field types" Tags="&lt;field&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10596" PostTypeId="2" ParentId="10594" CreationDate="2015-07-16T11:17:29.113" Score="3" Body="&lt;p&gt;I would say you can do this yeah, it just take a little figuring out is all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your input template could look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;{{ name }}[title]&quot; value=&quot;{{ value.title is defined ? value.title }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;{{ name }}[description]&quot; value=&quot;{{ value.description is defined ? value.description }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;{{ name }}[caption]&quot; value=&quot;{{ value.caption is defined ? value.caption }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;{{ name }}[thumb]&quot; value=&quot;{{ value.thumb is defined ? value.thumb }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your fieldtypes main class, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;&#xA;    // If value is null, we set it to an array to prevent template errors&#xA;    if(!$value)&#xA;    {&#xA;      $value = array();&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('bosh/input', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value&#xA;    ));&#xA;}&#xA;&#xA;public function prepValueFromPost($value)&#xA;{   &#xA;    return json_encode($value);&#xA;}&#xA;&#xA;public function prepValue($value)&#xA;{&#xA;    return json_decode($value, TRUE);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically you are settings the fieldtype value to an array of &lt;code&gt;pluginHandle[field]&lt;/code&gt; which then you &lt;code&gt;json_encode&lt;/code&gt; so it can all go into database without any issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then when you retrieve the value from the DB, its a string, so you &lt;code&gt;json_decode&lt;/code&gt; it into an array. The &lt;code&gt;TRUE&lt;/code&gt; part states you want an associative array, rather than a &lt;code&gt;stdClass&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats pretty much it at a basic level :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="45" LastEditDate="2015-07-16T17:42:16.420" LastActivityDate="2015-07-16T17:42:16.420" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10597" PostTypeId="1" CreationDate="2015-07-16T15:01:45.277" Score="2" ViewCount="869" Body="&lt;p&gt;I have a plugin that creates custom field types to extend crafts default field types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The custom field types hold several different form input fields. For example the field may be called video and contain a title field, caption field, video slug field and a thumbnail field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the plugin is installed these fields appear in the default field dropdown list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now want to change the html template in the plugin so that the thumbnail field makes use of the default assets field built into craft. So I'd like to know if there is a way to add an asset field to the twig template in my plugin. The plugin does not need to use it's own database so can make use of the existing assets database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the fieldtype class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    // If value is null, we set it to an array to prevent template errors&#xA;    if(!$value)&#xA;    {&#xA;      $value = array();&#xA;    }&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('customfieldtypes/video', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value&#xA;    ));&#xA;}&#xA;public function prepValueFromPost($value)&#xA;{   &#xA;    return json_encode($value);&#xA;}&#xA;&#xA;public function prepValue($value)&#xA;{&#xA;    return json_decode($value, TRUE);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the video template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;{{ name }}[title]&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;&amp;lt;input class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; name=&quot;{{ name }}[title]&quot; value=&quot;{% if value %}{{ value.title }}{% else %}{{ null }}{% endif %}&quot;&amp;gt;&amp;lt;br /&amp;gt;&#xA;&amp;lt;label for=&quot;{{ name }}[description]&quot;&amp;gt;Description&amp;lt;/label&amp;gt;&#xA;&amp;lt;textarea class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; name=&quot;{{ name }}[description]&quot;&amp;gt;{% if value %}{{ value.description }}{% else %}{{ null }}{% endif %}&amp;lt;/textarea&amp;gt;&amp;lt;br /&amp;gt;&#xA;&amp;lt;label for=&quot;{{ name }}[caption]&quot;&amp;gt;Caption&amp;lt;/label&amp;gt;&#xA;&amp;lt;input class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; name=&quot;{{ name }}[caption]&quot; value=&quot;{% if value %}{{ value.caption }}{% else %}{{ null }}{% endif %}&quot;&amp;gt;&amp;lt;br /&amp;gt;&#xA;&amp;lt;label for=&quot;{{ name }}[link]&quot;&amp;gt;Link&amp;lt;/label&amp;gt;&#xA;&amp;lt;input class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; name=&quot;{{ name }}[link]&quot; value=&quot;{% if value %}{{ value.link }}{% else %}{{ null }}{% endif %}&quot;&amp;gt;&amp;lt;br /&amp;gt;&#xA;&amp;lt;label for=&quot;{{ name }}[thumb]&quot;&amp;gt;Thumb&amp;lt;/label&amp;gt;&#xA;&amp;lt;input class=&quot;text nicetext fullwidth&quot; type=&quot;text&quot; name=&quot;{{ name }}[thumb]&quot; value=&quot;{% if value %}{{ value.thumb }}{% else %}{{ null }}{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-07-22T10:22:15.007" LastActivityDate="2017-04-06T04:12:30.597" Title="Add an assets field to a field type plugin template" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;plugins&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10598" PostTypeId="1" AcceptedAnswerId="10599" CreationDate="2015-07-16T21:47:13.810" Score="0" ViewCount="697" Body="&lt;p&gt;I tried to upload an image in the backend, but I always get the error: &lt;code&gt;Upload failed for 'image.jpg'&lt;/code&gt;. In the logs is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[16-Jul-2015 21:33:48 UTC] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4966029 bytes) in /var/www/virtual/conwave/html/service/cgk/craft/app/vendor/imagine/imagine/lib/Imagine/Image/Metadata/ExifMetadataReader.php on line 72&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody help me? I have no idea what the problem is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="642" LastEditDate="2015-07-17T14:12:18.880" LastActivityDate="2015-07-17T14:12:18.880" Title="Upload failed for 'image.jpg'" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10599" PostTypeId="2" ParentId="10598" CreationDate="2015-07-16T22:20:25.173" Score="2" Body="&lt;p&gt;You're running out of PHP memory as it's processes the image when it's uploaded. The fix for this is to increase the memory limit, which you normally need to get your hosting company to do for you. Try 512mb.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-07-16T22:20:25.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10601" PostTypeId="1" CreationDate="2015-07-17T10:16:55.797" Score="1" ViewCount="203" Body="&lt;p&gt;Is it possible to pragmatically delete a matrix block based on its content? I have a channel called &quot;Artist&quot;, which has a matrix field with concerts. It'll be about 5-600 concerts in total every year, so it's a bit of a hassle to manually remove old concerts. Every block has a field with the concert date. Is it possible to remove matrix blocks based on that date?&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2015-07-17T10:16:55.797" Title="Delete matrix blocks based on their content" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10602" PostTypeId="1" CreationDate="2015-07-17T13:07:43.297" Score="2" ViewCount="728" Body="&lt;p&gt;I'm wondering if something is possible in Twig/Craft CMS that I used to do in ExpressionEngine and CE Image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to output company logo images, but as they're all different shapes and sizes, I want to merge them with a white rectangle background image so that the page looks neat and tidy, e.g. &lt;a href=&quot;https://www.dropbox.com/s/2lvogxax2wcna1b/Screenshot%202015-07-17%2013.56.47.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;like this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I did this in EE (using CE Image's watermark feature, so the logo is essentially a watermark on the white background):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{exp:ce_img:pair src=&quot;{my_logo_image}&quot; width=&quot;250&quot; height=&quot;150&quot; allow_scale_larger=&quot;yes&quot; parse=&quot;inward&quot;}&#xA;  {exp:ce_img:single src=&quot;{my_white_rectangle_background_image}&quot; width=&quot;300&quot; height=&quot;200&quot; crop=&quot;yes&quot; allow_scale_larger=&quot;yes&quot; watermark=&quot;{made}&quot;}&#xA;{/exp:ce_img:pair}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how I'd do this in Craft at all? I'm not even sure where to start. I'm currently using the following, but this just outputs the logos/images, without even trying to merge them with the white rectangle background image, so any help on this would be appreciated, thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumbnailImage = {&#xA;  mode: 'fit',&#xA;  width: 300,&#xA;  height: 200,&#xA;  quality: 80&#xA;} %}&#xA;&#xA;&#xA;{% for asset in entry.mainImage %}&#xA;  &amp;lt;img src=&quot;{{ asset.getUrl(thumbnailImage) }}&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2015-07-17T16:11:38.837" Title="How to add dynamic watermarks to images in Craft/Twig" Tags="&lt;templating&gt;&lt;image&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10603" PostTypeId="1" AcceptedAnswerId="10606" CreationDate="2015-07-17T15:41:56.517" Score="3" ViewCount="425" Body="&lt;p&gt;I need my client (typical editor account in CMS) to be able to add/modify/delete users in the CP. I don't want him to have access to groups/permissions for users, but I need to put every user he creates into the same group (Site Users).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The existing plugin - &lt;a href=&quot;https://github.com/lindseydiloreto/craft-autoassignusergroup&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-autoassignusergroup&lt;/a&gt; - doesn't work if the client doesn't have the &quot;Assign user groups and permissions&quot; checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to force every new user created in the CP by the client into a default group? Or a way to give him &quot;Assign user groups&quot; but not &quot;and permissions&quot;?&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2015-07-17T18:08:15.927" Title="Enable client to add users to user group but not set permissions" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10604" PostTypeId="1" AcceptedAnswerId="10607" CreationDate="2015-07-17T15:45:37.397" Score="7" ViewCount="811" Body="&lt;p&gt;I'd like to add an ordinal suffix to the &lt;code&gt;loop.index&lt;/code&gt; variable within a &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1st&#xA;2nd&#xA;3rd&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="176" LastEditorUserId="9" LastEditDate="2015-07-17T20:05:05.787" LastActivityDate="2015-07-17T20:05:05.787" Title="Add ordinal suffix to loop.index" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10605" PostTypeId="2" ParentId="10602" CreationDate="2015-07-17T16:11:38.837" Score="3" Body="&lt;p&gt;You'd definitely need a plugin for this. Craft's native abilities don't cover watermarks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never attempted it myself, so these are just &quot;best guesses&quot;... but give the following plugins a shot:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/AviaryImageEditor/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://michaelrog.com/craft/imagesmith&quot; rel=&quot;nofollow&quot;&gt;http://michaelrog.com/craft/imagesmith&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As always, you can find a full list of existing plugins here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If none of those work for you, you may need to develop your own custom plugin to handle it.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-17T16:11:38.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10606" PostTypeId="2" ParentId="10603" CreationDate="2015-07-17T18:08:15.927" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;doesn't work if the client doesn't have the &quot;Assign user groups and permissions&quot; checked.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's not a limitation of the plugin, but a requirement of Craft.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to force every new user created in the CP by the client into a default group?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, that's what the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-autoassignusergroup&quot; rel=&quot;nofollow&quot;&gt;previously linked plugin&lt;/a&gt; will do, with the caveat that the currently logged in user has to have &lt;code&gt;assignUserPermissions&lt;/code&gt; permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can think of to do what you're trying to accomplish is build the user administration stuff for your client on the front-end of the site.  That way - though a plugin - you've got complete control over the user management business logic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-17T18:08:15.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10607" PostTypeId="2" ParentId="10604" CreationDate="2015-07-17T18:14:39.113" Score="5" Body="&lt;p&gt;You'd want to write a plugin that added an &lt;code&gt;|ordinal&lt;/code&gt; Twig &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters&quot; rel=&quot;noreferrer&quot;&gt;filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your template, you would do: &lt;code&gt;loop.index|ordinal&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logic in the plugin would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function ordinal($number)&#xA;{&#xA;    $ends = array('th','st','nd','rd','th','th','th','th','th','th');&#xA;&#xA;    if ((($number % 100) &amp;gt;= 11) &amp;amp;&amp;amp; (($number % 100) &amp;lt;= 13))&#xA;    {&#xA;        return $number.'th';&#xA;    }&#xA;    else&#xA;    {&#xA;        return $number.$ends[$number % 10];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-07-17T19:25:08.920" LastActivityDate="2015-07-17T19:25:08.920" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10609" PostTypeId="1" AcceptedAnswerId="10614" CreationDate="2015-07-17T19:33:34.440" Score="1" ViewCount="745" Body="&lt;p&gt;We're using Guest Entries for comments. When the user posts an entry it automatically appears as a published entry. I'd like to change this functionality so that the entry will enter as a draft until approved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the user's permissions to &quot;edit entry&quot; but that doesn't seem to do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3332" LastActivityDate="2016-04-04T23:58:15.930" Title="Guest Entries - Saving entries as drafts" Tags="&lt;entries&gt;&lt;guest-entries&gt;&lt;permissions&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10610" PostTypeId="2" ParentId="10604" CreationDate="2015-07-17T20:03:07.733" Score="7" Body="&lt;p&gt;This can also be done with a Twig macro, rather than creating a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro ordinal(number) %}&#xA;    {%- spaceless %}&#xA;    {% if ((number % 100) &amp;gt;= 11) and ((number % 100) &amp;lt;= 13) %}&#xA;        {{ number }}th&#xA;    {% else %}&#xA;        {% set ends = ['th','st','nd','rd','th','th','th','th','th','th'] %}&#xA;        {{ number ~ ends[number % 10] }}&#xA;    {% endif %}&#xA;    {% endspaceless -%}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import ordinal %}&#xA;&#xA;{% for entry in craft.entries %}&#xA;    &amp;lt;li&amp;gt;{{ ordinal(loop.index) }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-07-17T20:03:07.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10611" PostTypeId="1" AcceptedAnswerId="10612" CreationDate="2015-07-17T20:48:09.423" Score="0" ViewCount="114" Body="&lt;p&gt;I need a guestbook for a website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this plugin: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/verbb/comments&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/comments&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but it doesn't work.&#xA;And I also tried this: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But my changes will not be save. And I don't, if this is the right way to build a guestbook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an other plugin for Craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or any idea how i can build a guestbook in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:04.840" LastActivityDate="2017-11-09T19:38:04.840" Title="Guestbook for Craft" Tags="&lt;plugins&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10612" PostTypeId="2" ParentId="10611" CreationDate="2015-07-17T22:42:37.380" Score="2" Body="&lt;p&gt;I built one using a channel and the Guest Entries plugin. You can easily create whatever fields you want. I'd Name, Comments, Reply, IP Address, verified. &#xA;Or are you after something more complex?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-07-17T22:42:37.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10613" PostTypeId="1" AcceptedAnswerId="10620" CreationDate="2015-07-18T10:26:10.143" Score="3" ViewCount="71" Body="&lt;p&gt;So, i must write this Craft plugin to index documents as soon as they are published, though a special publication field used amongst different pages templates (including a matrix field !).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i use the publish event to detect that this special kind of assets (assets belonging to a special directory) have been used ?&lt;/p&gt;&#xA;" OwnerUserId="3884" LastActivityDate="2015-08-18T21:34:15.857" Title="How can i detect that an asset has been published from a plugin?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10614" PostTypeId="2" ParentId="10609" CreationDate="2015-07-18T12:07:29.077" Score="3" Body="&lt;p&gt;&lt;strong&gt;Edited based on comment below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No sorry I see what you mean now. But I think with entry drafts you need to have first published an entry, then you create a draft from that entry, essentially creating two versions of the same one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think for approving entries as comments this is going to lead to a lot of complexity and you might struggle to get the results you want, and to do this the way you want would probably require writing your own plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin would listen to when an entry is saved, get that new entry id, create a new &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryDraftModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;EntryDraftModel&lt;/code&gt;&lt;/a&gt; and then save it via &lt;code&gt;craft()-&amp;gt;entryRevisions-&amp;gt;saveDraft()&lt;/code&gt; method. You would then need to set your new entry to &lt;code&gt;disabled&lt;/code&gt; anyway (to stop it from showing) as creating a draft won't affect the newly created entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to approve an entry you would go into the newly created entry, switch to the draft (which would most likely be the same) and then apply it and enable the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a complex process when your entire workflow could be condensed to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new entry as disabled&lt;/li&gt;&#xA;&lt;li&gt;Enable an entry to approve it&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Setting all new entries to disabled and then setting ones to active you want to approve will make your life easier and keep your build streamlined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is extensive info about drafts in particular but it might be worth checking the &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; but essentially they are intended for entry revisions, not so much approving whole entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So...you can set entries to be disabled when they are submitted from within the guest entries plugin itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pZ1cF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just make sure the light switch is off for the correct section and entries wont be published. Then you will be able to set them to enabled as part of your approval process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Doing this with a standard entry form&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to do this using crafts native entry form (with a logged in user), you would need to set the status at a template level&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// entry form ...&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But a quick test revealed this &lt;strong&gt;didn't have any effect&lt;/strong&gt; when using the guest entries plugin.&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-07-18T20:34:15.860" LastActivityDate="2015-07-18T20:34:15.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10615" PostTypeId="1" AcceptedAnswerId="10616" CreationDate="2015-07-18T13:00:22.660" Score="1" ViewCount="655" Body="&lt;p&gt;I have a template that fails to load intermittently, resulting in a 404. I haven't been able to debug it since 99% of the time the page loads perfectly.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2015/07/18 12:18:57 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /var/www/html/cotm_2015/craft/app/controllers/TemplatesController.php:59&#xA;  Stack trace:&#xA;  0 [internal function]: Craft\TemplatesController-&gt;actionRender('30-days-of-pray...', Array)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3886" LastActivityDate="2015-07-18T18:16:48.737" Title="Template fails to load intermittently" Tags="&lt;templating&gt;&lt;routes&gt;&lt;404&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10616" PostTypeId="2" ParentId="10615" CreationDate="2015-07-18T18:16:48.737" Score="2" Body="&lt;p&gt;When a connection to the database can't be made Craft throws a 404. This sound like it might be your problem because you say it happens intermittently.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-07-18T18:16:48.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10617" PostTypeId="1" CreationDate="2015-07-19T11:18:07.707" Score="0" ViewCount="1119" Body="&lt;p&gt;Today I wanted to add a contact form to my webpage, and I chose the Form Builder plugin for its ease of use. So far all went well, and I managed to display the form in the page (not that difficult), but when testing the form I got an undefined error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of now I have no idea what is undefined. I checked the code, the fields I use (they are all Form Builder fields, the email and the plain text), and I checked the settings of Form Builder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you guys help me out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The link to my website: www.evinwijninga.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- CONTACT FORM --&amp;gt;&#xA;&#xA;{% set form = craft.formBuilder.getFormByHandle('contactForm') %}&#xA;{% set tabs = form.fieldLayout.getFieldLayout().getTabs() %}&#xA;{% set pluginScripts = craft.formBuilder.pluginScripts(form) %}&#xA;&#xA;&amp;lt;div class=&quot;grid-100&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;How to contact me&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;utf-8&quot; name=&quot;{{ form.handle }}&quot; class=&quot;formbuilder-form grid-60 prefix-20 suffix-20 {{ form.handle }}&quot; id=&quot;{{ form.handle }}&quot; data-parsley-errors-container=&quot;.formbuilder-notification&quot;{% if form.hasFileUploads %} enctype=&quot;multipart/form-data&quot; {% endif %}&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;formBuilder/entries/saveFormEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;formredirect&quot; data-redirect=&quot;{{form.successPageRedirect}}&quot; value=&quot;{{form.redirectUrl}}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;formHandle&quot; value=&quot;{{form.handle}}&quot;&amp;gt;&#xA;&#xA;        {% for tab in tabs %}&#xA;        {% set fields = tab.getFields() %}&#xA;&#xA;        &amp;lt;fieldset class=&quot;{{loop.index}}&quot;&amp;gt;&#xA;            &amp;lt;legend&amp;gt;{{ tab.name }}&amp;lt;/legend&amp;gt;&#xA;            {% for field in fields %}&#xA;            {% set input = craft.formBuilder.getInputHtml(field) %}&#xA;            &amp;lt;div class=&quot;grid-100 grid-parent&quot;&amp;gt;{{ input | raw }}&amp;lt;/div&amp;gt;&#xA;            {% endfor %} &#xA;        &amp;lt;/fieldset&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {# Error/Success Messages #}&#xA;        {% if craft.session.hasFlash('error') or craft.session.hasFlash('success') %}&#xA;        {% if craft.session.hasFlash('error') %}&amp;lt;div class=&quot;formbuilder-notification&quot;&amp;gt;&amp;lt;p class=&quot;error-message&quot;&amp;gt;{{ craft.session.getFlash('error') | raw }}&amp;lt;p&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;        {% if craft.session.hasFlash('success') %}&amp;lt;div class=&quot;formbuilder-notification success&quot;&amp;gt;&amp;lt;p class=&quot;success-message&quot;&amp;gt;{{ craft.session.getFlash('success') | raw }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;        {% else %}&#xA;        &amp;lt;div class=&quot;formbuilder-notification&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;button type=&quot;submit&quot; class=&quot;grid-100&quot;&amp;gt;Submit Message&amp;lt;/button&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0efkD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the settings in Form Builder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xqfvm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the latest error entry. The timestamp however is different than the time when I tested the form (which was later):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PckSA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1072" LastEditorUserId="1072" LastEditDate="2015-07-20T09:43:16.487" LastActivityDate="2015-09-07T14:58:37.543" Title="Form Builder plugin returns 'undefined' when I submit" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10618" PostTypeId="1" AcceptedAnswerId="10623" CreationDate="2015-07-19T17:19:09.170" Score="1" ViewCount="73" Body="&lt;p&gt;It is possible to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/225/is-there-a-way-i-can-programmatically-download-the-latest-version-of-craft/226#226&quot;&gt;programmatically download the latest version of craft&lt;/a&gt;. But is it also possible to get this file's md5 sum directly from the server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking about something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://buildwithcraft.com/latest.hash&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am asking this because I'm currently writing a &lt;a href=&quot;http://docs.saltstack.com/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Salt&lt;/a&gt; formula to install Craft. I intend to use &lt;a href=&quot;http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed&quot; rel=&quot;nofollow noreferrer&quot;&gt;salt.states.files.managed&lt;/a&gt;, which is capable of downloading a file only if it has a different md5 sum than an already downloaded version of the file.&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-07-20T03:55:26.413" Title="Is it possible to get the md5 hash of Craft's latest version from the download server?" Tags="&lt;install&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10619" PostTypeId="2" ParentId="10613" CreationDate="2015-07-19T20:48:49.980" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/iainurquhart/craft_introvert&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Introvert&lt;/a&gt; might be what you're looking for...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4FkwX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-07-19T20:48:49.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10620" PostTypeId="2" ParentId="10613" CreationDate="2015-07-19T21:01:20.043" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onSaveEntry&lt;/a&gt; event to get entries as they're saved, check the publish date, then loop through its properties, and check the paths on any assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd probably also want to hook into &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onDeleteEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onDeleteEntry&lt;/a&gt; to de-index any assets from entries that get deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Please note:&lt;/strong&gt; this won't auto-index entries that were scheduled to publish at a later date.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-07-19T21:01:20.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10621" PostTypeId="1" AcceptedAnswerId="10622" CreationDate="2015-07-19T21:40:36.290" Score="3" ViewCount="183" Body="&lt;p&gt;Is there any reason why min/max value are limited to the following?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[9999999999999]&#xA;- Min is too big (maximum is 2147483647)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to add &lt;strong&gt;ISBN&lt;/strong&gt; numbers which are 13-digits. Is there a reason for this min/max length, and can it be increased?&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2015-07-19T22:00:16.320" Title="Error: min/max value in number fields" Tags="&lt;field&gt;&lt;fieldtypes&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10622" PostTypeId="2" ParentId="10621" CreationDate="2015-07-19T22:00:16.320" Score="3" Body="&lt;p&gt;Numbers have certain limits in computer systems and storing (as well as working with) exceptionally large ones is cumbersome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.6/en/integer-types.html&quot; rel=&quot;nofollow&quot;&gt;database&lt;/a&gt;, the &lt;code&gt;int&lt;/code&gt; (integer, a whole number) is limited to a range from -2147483648 to 2147483647. A &lt;code&gt;bigint&lt;/code&gt; can range from -9223372036854775808 to 9223372036854775807 but is less common. And I don't think Craft uses &lt;code&gt;bigint&lt;/code&gt;s anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's purely numerical, but could your ISBN numbers use a text field? Unless you're doing math on it then this should suffice. If you really want you could a new fieldtype that validates an ISBN number but saves as a &lt;code&gt;varchar&lt;/code&gt; in the DB.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-07-19T22:00:16.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10623" PostTypeId="2" ParentId="10618" CreationDate="2015-07-20T03:55:26.413" Score="3" Body="&lt;p&gt;Currently not, but that's not a bad idea and probably worth adding to &lt;a href=&quot;https://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;https://feedback.buildwithcraft.com&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During an auto-update, the file name of the patch file that is downloaded happens to be the MD5 sum of the file so the Craft client can verify the integrity of the downloaded file, but there isn't a mechanism like that in place currently for full Craft downloads.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-20T03:55:26.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10625" PostTypeId="2" ParentId="10499" CreationDate="2015-07-20T15:48:08.347" Score="1" Body="&lt;p&gt;I don't know how it compares efficiency-wise, but another approach to this (which I personally find much easier to read) would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for handshapeCategory in craft.categories.group('handshape') %}&#xA;    {% if craft.entries.relatedTo(handShapeCategory).limit(1).getOne() is not empty %}&#xA;      &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words, for each category in the group, if we can fetch an entry for that category, display the title.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-07-20T15:48:08.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10626" PostTypeId="2" ParentId="10499" CreationDate="2015-07-20T16:10:13.900" Score="5" Body="&lt;p&gt;I would reverse your logic:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;get all entries in whatever channel&lt;/li&gt;&#xA;&lt;li&gt;display only categories (from a certain group) that have entries fetched in step 1 attached to them&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('myChannel').limit(null) %}&#xA;{% set activeCategories = craft.categories.group('myCatgroup').relatedTo(entries).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use a simple &lt;code&gt;for&lt;/code&gt; loop to display only the active categories&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2015-07-20T16:10:13.900" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10627" PostTypeId="1" AcceptedAnswerId="10628" CreationDate="2015-07-20T19:44:11.573" Score="1" ViewCount="156" Body="&lt;p&gt;I've been referring to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1308/user-profile-public-page&quot;&gt;this question&lt;/a&gt; (can't comment as I don't have enough cred) — The most popular answer works, but I can't for the life of me figure out why Brad's version doesn't. When I try I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&#xA;&#xA;{# Not Working (Brad's version) #}&#xA;{% set notWorkingUserId = craft.request.getSegment(2) %}&#xA;{% set notWorkingUser = craft.users.id(notWorkingUserId) %}&#xA;&#xA;{# Working #}&#xA;{% set workingUser = craft.users.username( craft.request.segment(2) ).first() %}&#xA;&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;h1&amp;gt;Not Working: {{ notWorkingUser.email }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Working: {{ workingUser.email }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {{notWorkingUser}} {# Throws an error #}&#xA;    {{workingUser}}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using the dynamic url routing mentioned in the most popular example, with the username. I also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users.username(notWorkingUserId)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which throws the same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as far as I understand it (I've only been working with Craft for a short period), .first() is only required when it's an array. But Brad's version is passing the actual ID so shouldn't be required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain this in simple terms? Craft is great, but for beginners it can get a bit confusing.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-20T20:03:14.463" Title="Public profile page: requesting user ID with dynamic url routing" Tags="&lt;url&gt;&lt;routing&gt;&lt;error&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10628" PostTypeId="2" ParentId="10627" CreationDate="2015-07-20T20:03:14.463" Score="1" Body="&lt;p&gt;&lt;code&gt;.first()&lt;/code&gt; is going to be required... I updated the answer in the original question, but here it is for posterity, too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notWorkingUserId = craft.request.getSegment(2) %}&#xA;{% set notWorkingUser = craft.users.id(notWorkingUserId).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can access the properties of that user because it's a proper &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;notWorkingUser.email&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-20T20:03:14.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10629" PostTypeId="2" ParentId="10530" CreationDate="2015-07-20T20:07:30.103" Score="3" Body="&lt;p&gt;Yes, &lt;code&gt;{{url('handle')}}&lt;/code&gt; will output the correct URL for whichever localization your user is currently in. Be sure to adjust your &lt;code&gt;siteUrl&lt;/code&gt; configuration in your &lt;code&gt;app/config/general.php&lt;/code&gt; file. Depending on your set up, it can look something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://mysite.com/en',&#xA;        'fr' =&amp;gt; 'http://mysite.com/fr'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more information, check out &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide#step-4-define-your-site-uRLs&quot; rel=&quot;nofollow&quot;&gt;Step 4 in the Localization Guide&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-07-20T20:07:30.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10631" PostTypeId="2" ParentId="4669" CreationDate="2015-07-20T22:59:10.497" Score="2" Body="&lt;p&gt;I just made a change on my server (DigitalOcean w/ ServerPilot) which resulted in a double-value... Before my change, there was only a single value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iuufU.png&quot; alt=&quot;max_input_vars&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can confirm that &lt;strong&gt;the top value is overriding the bottom value&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My server default was set to 1000. I used a &lt;code&gt;.user.ini&lt;/code&gt; file to override that to 5000.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;ServerPilot: How to Change PHP Settings&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://serverpilot.io/community/articles/how-to-change-php-settings.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://serverpilot.io/community/articles/how-to-change-php-settings.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-07-20T23:05:48.643" LastActivityDate="2015-07-20T23:05:48.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10632" PostTypeId="1" AcceptedAnswerId="10636" CreationDate="2015-07-20T23:06:41.133" Score="12" ViewCount="2767" Body="&lt;p&gt;As the title suggests, I was wondering how to check if a certain plugin exists (and has been installed). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And secondly, check that the plugin is actually enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2019-05-15T07:41:39.897" Title="How can I check if a plugin is installed and enabled?" Tags="&lt;plugins&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10633" PostTypeId="2" ParentId="10632" CreationDate="2015-07-20T23:16:18.137" Score="3" Body="&lt;p&gt;It should show up in the control panel in the plugins section. It will show the name of the plugin and if it is enabled. I've had issues when i didn't setup the folder correctly. Double check the plugin documentation, it should tell you what folder to place within the craft plugins directory. &lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2015-07-20T23:16:18.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10634" PostTypeId="1" AcceptedAnswerId="10646" CreationDate="2015-07-21T06:47:06.033" Score="1" ViewCount="1493" Body="&lt;p&gt;I have setup an asset pool for all files our customer wants to upload using {basePath} and {baseUrl} variables which are defined in the configuration file.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Uploading files &lt;strong&gt;works&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Selecting files to assign them to content &lt;strong&gt;works&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;displaying the files on the front page &lt;strong&gt;works&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;thumbnail generation in the backend does &lt;strong&gt;not work&lt;/strong&gt; - returning 404 for the resized url&lt;/li&gt;&#xA;&lt;li&gt;custom transforms for thumbnails on the front page do &lt;strong&gt;not work&lt;/strong&gt; - 0-byte images get created which are of course empty&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Nothing gets logged in the errorlog - everything seems to work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm kind of lost currently - Project working nicely local but not on our server.&#xA;Any help on how to debug and solve this problem? Looks like an inconsistency problem inside of craft as some methods are accessing the assets correctly while others don't.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here some files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php return [&#xA;    'allowAutoUpdates'     =&amp;gt; false, // Using shared craft, disable update triggering for customer - TODO: Completely hide update stuff in backend.&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; [&#xA;        'baseUrl' =&amp;gt; CRAFT_SITE_URL,&#xA;        'basePath' =&amp;gt; CRAFT_SITE_PATH&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;define('CRAFT_CONFIG_PATH',       'assets/configs/');&#xA;define('CRAFT_PLUGINS_PATH',      'assets/plugins/');&#xA;define('CRAFT_TEMPLATES_PATH',    'assets/templates/');&#xA;define('CRAFT_TRANSLATIONS_PATH', 'assets/translations/');&#xA;define('CRAFT_STORAGE_PATH',      'cache/');&#xA;&#xA;define('CRAFT_SITE_URL',  substr($_SERVER['SCRIPT_NAME'], 0, -9));&#xA;define('CRAFT_SITE_PATH', substr(__FILE__, 0, -9));&#xA;&#xA;require '../_craft/app/index.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;.htaccess&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Compression&#xA;SetOutputFilter DEFLATE&#xA;&#xA;RewriteEngine On&#xA;&#xA;# No duplicate rewriting.&#xA;#TODO Remove and use [END] when Apache 2.4 is available on production.&#xA;RewriteCond %{ENV:REDIRECT_STATUS} 200&#xA;RewriteRule ^ - [L]&#xA;&#xA;# Sass and JavaScript compilation and minification - except for admin backend.&#xA;RewriteCond %{REQUEST_URI} !admin/ [NC]&#xA;RewriteRule \.css$ scss.php [L]&#xA;RewriteCond %{REQUEST_URI} !admin/ [NC]&#xA;RewriteRule \.js$ js.php [L]&#xA;&#xA;# Make bootstrap fonts available.&#xA;RewriteRule ^assets/bootstrap/(.+)$ vendor/twbs/bootstrap-sass/assets/fonts/bootstrap/$1 [L]&#xA;&#xA;# Let craft handle everything else.&#xA;RewriteRule ^assets/icons/ - [L]&#xA;RewriteRule ^assets/images/ - [L]&#xA;RewriteRule .* index.php [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Both Environments have Imagick and GD available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Environment Development: Ubuntu, Apache 2.4, PHP 5.6, MySQL 5.6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Environment Production: Debian, Apache 2.2, PHP 5.5, MySQL 5.5&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2015-07-21T16:03:32.560" Title="Image transforms not working" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10635" PostTypeId="2" ParentId="10526" CreationDate="2015-07-21T07:41:35.173" Score="2" Body="&lt;p&gt;It's actually not SQL friendly at all to store multiple values (Title and Video ID) in a single column. The data is stored as a serialized string and all you can do is to use the pattern matching operator &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;LIKE&lt;/code&gt;&lt;/a&gt; to get the row you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For best performance you should refactor your fields and store each of them individually. If all the data has to be in one field, store the field in its own table (like Matrix fields do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is no option for you, I would recommend to not use the &lt;code&gt;search&lt;/code&gt; parameter with your ElementCriteriaModel, but to prepare a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; object using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;buildElementsQuery&lt;/a&gt; and add your &quot;Video ID condition&quot; using the &lt;code&gt;LIKE&lt;/code&gt; operator I mentioned above, so you don't rely on up-to-date search indexes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'video';&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$params = array(&#xA;    ':video_id' =&amp;gt; '%video_id='.$video_id.'%',&#xA;);&#xA;$query-&amp;gt;andWhere('entries.video LIKE :video_id', $params);&#xA;$result = $query-&amp;gt;queryRow();&#xA;&#xA;return EntryModel::populateModel($result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-21T07:41:35.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10636" PostTypeId="2" ParentId="10632" CreationDate="2015-07-21T07:52:05.853" Score="16" Body="&lt;p&gt;On top of checking within the admin area, there are some other ways you can do this, both in templates and in your plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In a template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Second argument is if you want enabled only #}&#xA;{% set plugin = craft.plugins.getPlugin('pluginHandle', false) %}&#xA;&#xA;{# Now you have access to these methods... #}&#xA;{{ plugin.isEnabled() }}&#xA;{{ plugin.isInstalled() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a full list of methods, see &lt;a href=&quot;https://buildwithcraft.com/classreference/variables/PluginVariable&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;PluginVariable&lt;/code&gt;&lt;/a&gt; in craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info on how to get plugins within your templates, see the &lt;a href=&quot;https://buildwithcraft.com/classreference/variables/PluginsVariable&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;PluginsVariable&lt;/code&gt;&lt;/a&gt;, note this is different from &lt;code&gt;PluginVariable&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check a plugin from within your own plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Again, second arg is if you just want enabled plugins&#xA;$plugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle', false);&#xA;&#xA;// Then you can do things like:&#xA;$plugin-&amp;gt;isInstalled&#xA;$plugin-&amp;gt;isEnabled;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/PluginsService&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;PluginService&lt;/code&gt;&lt;/a&gt; and also the &lt;a href=&quot;https://buildwithcraft.com/classreference/etc/plugins/BasePlugin&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;BasePlugin&lt;/code&gt;&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="45" LastEditDate="2017-01-08T05:57:26.440" LastActivityDate="2017-01-08T05:57:26.440" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10637" PostTypeId="2" ParentId="10584" CreationDate="2015-07-21T08:09:07.803" Score="0" Body="&lt;p&gt;Found it (at last). The thing was that the . before .htaccess was removed when copying the files to the /it/ folder on OSx&lt;/p&gt;&#xA;" OwnerUserId="1014" LastActivityDate="2015-07-21T08:09:07.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10638" PostTypeId="1" CreationDate="2015-07-21T11:55:30.863" Score="2" ViewCount="1095" Body="&lt;p&gt;How can I get the screen size in craft cms? I mean the device width in px, so for example I can get a static map image with the exact size to fit the device screen&lt;/p&gt;&#xA;" OwnerUserId="3606" LastEditorUserId="141" LastEditDate="2015-07-22T10:07:01.400" LastActivityDate="2015-07-22T17:37:15.177" Title="Detect device screen size in craft cms" Tags="&lt;responsive-images&gt;&lt;craft-pro&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10639" PostTypeId="1" AcceptedAnswerId="10640" CreationDate="2015-07-21T12:33:35.057" Score="1" ViewCount="279" Body="&lt;p&gt;I want to use one structure section for multiple menu's (navigations). So I want all pages under topmenu in the topmenu (header) and I want all pages in the bottommenu in a menu in the footer. How can I accomplish this most easily in my twig file?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rSTI2.png&quot; alt=&quot;example of my structure lay-out&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1014" LastActivityDate="2015-07-21T13:44:10.433" Title="One structure section for multiple menu's (navigations)" Tags="&lt;templating&gt;&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10640" PostTypeId="2" ParentId="10639" CreationDate="2015-07-21T13:01:40.640" Score="1" Body="&lt;p&gt;This is something i've used, it should work for you, the only downside to it is there being a hardcoded &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nav = craft.entries.section('yourStructureSection') %}&#xA;&#xA;{% set headerItems = nav.descendantOf(TopMenuId) %}&#xA;&#xA;{% set footerItems = nav.descendantOf(BottomMenuId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you would just replace &lt;code&gt;TopMenuId&lt;/code&gt; with the entry &lt;code&gt;id&lt;/code&gt; of &lt;code&gt;Topmenu&lt;/code&gt; and &lt;code&gt;BottomMenuId&lt;/code&gt; with the entry id of &lt;code&gt;Bottommenu&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you will be able to loop through each nav :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA; {% nav entry in craft.entries.section('contentPages').descendantOf(13) %} &#xA;    &amp;lt;li&amp;gt; &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }} &amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt; {% children %} &amp;lt;/ul&amp;gt; &#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt; &#xA; {% endnav %}&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-07-21T13:44:10.433" LastActivityDate="2015-07-21T13:44:10.433" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10641" PostTypeId="2" ParentId="10638" CreationDate="2015-07-21T13:08:31.203" Score="3" Body="&lt;p&gt;I think you are going to struggle with this in Craft, you would need to do it through Javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft runs off PHP which is a server side scripting language, you need a client side scripting language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a good question which should help you with this: &lt;a href=&quot;https://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window&quot;&gt;Get the size of the screen, current web page and browser window&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-07-21T13:08:31.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10642" PostTypeId="1" CreationDate="2015-07-21T13:10:48.337" Score="2" ViewCount="442" Body="&lt;p&gt;How can I limit the output of assets based on this criteria?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;search all entries randomly in section &quot;homes&quot; for only entries with at least one asset image&lt;/li&gt;&#xA;&lt;li&gt;limit those results to 8 random assets&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I tried this but it does not always show exactly 8 asset images as the random is called first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.limit(null) %}&#xA;&#xA;{% for homesEntry in craft.entries.section('homes').limit(8).order('RAND()') %}&#xA;    {% if homesEntry.homeImages|length %}&#xA;        {% set asset = homesEntry.homeImages.first() %}&#xA;&#xA;        {% if asset %}&#xA;            &amp;lt;a href=&quot;{{ homesEntry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url('homeImages') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="57" LastEditDate="2015-07-21T16:06:33.727" LastActivityDate="2015-07-21T16:06:33.727" Title="How can I limit the output of assets randomly if an asset exists?" Tags="&lt;assets&gt;&lt;limit&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10643" PostTypeId="2" ParentId="10642" CreationDate="2015-07-21T13:56:46.550" Score="3" Body="&lt;p&gt;This is how you do it in case anyone is looking for this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.limit(null) %}&#xA;&#xA;{% set randomEntry = craft.entries.section('homes').order('RAND()').relatedTo({&#xA;    targetElement: assets,&#xA;    field: 'homeImages'&#xA;}) %}&#xA;&#xA;{% for homesEntry in randomEntry.limit(6) %}&#xA;    {% set asset = homesEntry.homeImages.first() %}&#xA;&#xA;    {% if asset %}&#xA;        &amp;lt;a href=&quot;{{ homesEntry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url('galleryImages') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="186" LastEditorUserId="57" LastEditDate="2015-07-21T16:06:05.430" LastActivityDate="2015-07-21T16:06:05.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10644" PostTypeId="1" CreationDate="2015-07-21T14:14:55.323" Score="3" ViewCount="377" Body="&lt;p&gt;Is there any way to have some entries exist as flat files? Considering moving my blog over from Statamic where I have a boatload of Markdown files that work as article entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like Craft can do anything! I wonder if there's someway to do a combo thing where some entries exist in the database and others in a directory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="778" LastActivityDate="2015-07-21T19:35:13.940" Title="Entries as Flat Files" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10645" PostTypeId="2" ParentId="10597" CreationDate="2015-07-21T14:57:06.887" Score="0" Body="&lt;p&gt;You can't just compose a new field type from multiple other fields by adding some Twig macro to you field's template!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of work to do to make things work. You need to store your field in its own database table, so each child field gets its own column, you also need to design and set up field settings to make configuration of child fields possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that you're currently storing multiple custom text fields as a serialized string in a single column (content attribute set to &lt;code&gt;AttributeType::Mixed&lt;/code&gt;); this works for simple text, but not for more complex data.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-21T14:57:06.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10646" PostTypeId="2" ParentId="10634" CreationDate="2015-07-21T16:03:32.560" Score="2" Body="&lt;p&gt;It sounds like you're running into a bug in the latest version of Craft (&lt;a href=&quot;http://buildwithcraft.com/updates#build2675&quot; rel=&quot;nofollow&quot;&gt;2.4.2675&lt;/a&gt;) where transforms are broken for source asset files that end in an uppercase file extension (.JPG, .GIF, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's already been fixed for the next release, but as a workaround you can rename the extensions to be lowercase and re-index your assets.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-21T16:03:32.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10647" PostTypeId="2" ParentId="10644" CreationDate="2015-07-21T16:20:20.577" Score="5" Body="&lt;p&gt;Short answer; no. Craft uses a database to store and query for content and doesn't have any way to work with content in files the way that Statamic has. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, migrating the content into Craft's database doesn't have to be a big challenge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're a PHP-developer, creating a plugin that parses the files and inserts the content into Craft is a breeze. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not a developer (or if you are, but prefer a less code intensive way of doing it), there're several plugins for Craft that helps you importing content into the Craft database. Have a look at &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;Feed Me from engram design&lt;/a&gt;, or &lt;a href=&quot;https://github.com/boboldehampsink&quot; rel=&quot;nofollow&quot;&gt;Import from Bob Olde Hampsink&lt;/a&gt;. You'd then create a simple front-end template in Statamic that queries the data you want to move over, outputs xml or json, and then send that data to the plugin which do the heavy lifting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used Feed Me on several occasions to move data from ExpressionEngine sites to Craft, and it works great.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-07-21T19:35:13.940" LastActivityDate="2015-07-21T19:35:13.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10648" PostTypeId="1" AcceptedAnswerId="10649" CreationDate="2015-07-21T18:42:24.907" Score="4" ViewCount="242" Body="&lt;p&gt;I'm currently building a site with a comprehensive pattern library (along the lines of &lt;a href=&quot;http://rizzo.lonelyplanet.com/styleguide/ui-components/cards&quot; rel=&quot;nofollow&quot;&gt;Lonely Planet's&lt;/a&gt;), which Craft seems very well suited to. Each pattern is a partial template and I include it in a page like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/card' with {&#xA;  title: 'Something',&#xA;  description: 'A bit of text',&#xA;  image: 'http://lorempixel.com/400/200/'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above, with dummy data, allows me to create an example for the pattern library, but I can then easily reuse the above partial with real data by changing the string values to, eg. &lt;code&gt;entry.title&lt;/code&gt;, &lt;code&gt;entry.description&lt;/code&gt;, etc. This seems to work pretty well for everything apart from for assets: &lt;code&gt;entry.image&lt;/code&gt; is not a string, so there's a type difference with my placeholder image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've got around this problem with a bit of logic that sets &lt;code&gt;image&lt;/code&gt; to &lt;code&gt;entry.image.first().getUrl()&lt;/code&gt; if &lt;code&gt;entry.image&lt;/code&gt; exists. But it feels like this should really happen inside the partial: firstly it's messy and non-DRY to do this every time / everywhere I include it; secondly, the partial itself should really be able to be responsible for specifying the image transform (if there is one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems to me there are two possible solutions, but I can't quite figure out how to achieve either. The two options are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Allow the partial to accept &lt;strong&gt;either&lt;/strong&gt; a string &lt;strong&gt;or&lt;/strong&gt; an asset as its &lt;code&gt;image&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Create a mock asset object in my pattern page that will behave more like an asset if I feed it into the partial, so the partial will work unproblematically when I give it an &lt;code&gt;entry.image&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the former case, I can't figure out a neat way to handle an input that might be a string or an asset field (Twig doesn't seem to have, eg. an &lt;code&gt;is string&lt;/code&gt; test). In the latter case I have no idea how you'd go about it or even whether it's possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any ideas or experience of how you might achieve the above, I'd be really grateful!&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-07-21T19:52:09.950" Title="How to handle mock / placeholder assets in a pattern library?" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10649" PostTypeId="2" ParentId="10648" CreationDate="2015-07-21T19:52:09.950" Score="2" Body="&lt;p&gt;Two ideas come to mind. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, it would be a lot easier to check if an image exists if you send in &lt;code&gt;null&lt;/code&gt; in the include instead of an url to the placeholder image, and then let the cart template know what to do if there isn't an actual image. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/card' with {&#xA;  title: 'Something',&#xA;  description: 'A bit of text',&#xA;  image: null&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in _partials/card:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if image!=null %}&#xA;  &amp;lt;img src=&quot;{{ image.getUrl({ width: 400, height: 200 }) }}&quot;&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;img src=&quot;http://lorempixel.com/400/200/&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second option is to have a dummy image in your Assets library, with a known id, and pass that to the card template. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/card' with {&#xA;  title: 'Something',&#xA;  description: 'A bit of text',&#xA;  image: craft.assets({ id: 99 }).first()&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The logic in the card template would be a little bit simpler that way I guess. But maybe you risk that the image is deleted at some point and then everything fails? Depending on the images in your Assets library, maybe you could just pick one at random? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/card' with {&#xA;  title: 'Something',&#xA;  description: 'A bit of text',&#xA;  image: craft.assets({ order: 'RAND()' }).first()&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Might give some weird results, but.. Depends on your project. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-21T19:52:09.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10650" PostTypeId="1" AcceptedAnswerId="10651" CreationDate="2015-07-21T20:14:13.277" Score="2" ViewCount="59" Body="&lt;p&gt;I'm doing, what I think should work fine, however, I'm still getting a blank table output on the page if the table field is left unfilled when creating the entry. It's like the &quot;if&quot; check is being ignored for some reason. The table with data outputs as expected fine. What am I missing here? Gotta be something simple. Here's a link to the page in question: &lt;a href=&quot;http://nightowlmusic.org/family/rotiron&quot; rel=&quot;nofollow&quot;&gt;http://nightowlmusic.org/family/rotiron&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.discography | length %}&#xA;        &amp;lt;table class=&quot;discography&quot;&amp;gt;&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;th colspan=&quot;3&quot;&amp;gt;Discography&amp;lt;/th&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;            {% for row in entry.discography %}&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td class=&quot;release&quot;&amp;gt;{{ row.releaseName }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td class=&quot;year&quot;&amp;gt;{{ row.releaseYear }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td class=&quot;purchaseLink&quot;&amp;gt;&#xA;                    {% if row.purchaseLink %}&amp;lt;a href=&quot;{{ row.purchaseLink }}&quot; title=&quot;Purchase the Release&quot;&amp;gt;Click here to purchase&amp;lt;/a&amp;gt;{% endif %}&#xA;                &amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/table&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-07-21T20:45:35.320" Title="How do you not output table field if there are no values?" Tags="&lt;table-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10651" PostTypeId="2" ParentId="10650" CreationDate="2015-07-21T20:45:35.320" Score="3" Body="&lt;p&gt;When you define a table field, it comes with one row by default. I'm not sure why this is. You can remove this row by clicking on the - icon: &lt;img src=&quot;https://i.stack.imgur.com/yXBW3.png&quot; alt=&quot;screen shot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To filter out those rows in twig, try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.discography if row.releaseName %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-21T20:45:35.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10652" PostTypeId="1" CreationDate="2015-07-21T22:06:26.393" Score="4" ViewCount="564" Body="&lt;p&gt;I ran into problems with the performance of one of our Craft sites. This showed up as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MySQL running out of memory and crashing, because Apache was using up all the memory in backgrounds tasks,&lt;/li&gt;&#xA;&lt;li&gt;Sometimes getting blank, white pages back from the cache instead of real results, and&lt;/li&gt;&#xA;&lt;li&gt;background tasks hanging and failing to clear out stale cached pages.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The website we've built uses caching on nearly every page.&lt;/p&gt;&#xA;" OwnerUserId="3895" LastActivityDate="2015-07-21T22:06:26.393" Title="How can I mitigate caching performance issues with Craft?" Tags="&lt;performance&gt;&lt;tasks&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10653" PostTypeId="2" ParentId="10652" CreationDate="2015-07-21T22:06:26.393" Score="7" Body="&lt;p&gt;First off:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft stores cached content in the &lt;code&gt;templatecaches&lt;/code&gt; table.&lt;/li&gt;&#xA;&lt;li&gt;Craft stores criteria mapping to the cached versions in &lt;code&gt;templatecachecriteria&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Make sure Craft isn't caching too much.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Originally, we were using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% cache using key craft.request.path if not craft.config.devMode %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We discovered it's &lt;strong&gt;critical&lt;/strong&gt; to use the globally keyword:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% cache globally using key craft.request.path if not craft.config.devMode %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without the 'globally' keyword, Craft continues to collect query string variables and will make a record in &lt;code&gt;templatecaches&lt;/code&gt; for each unique set of query string variables. That means that things like CRM mailers which may include a unique query string in every email will create tons of entries in &lt;code&gt;templatecaches&lt;/code&gt;. I'm not sure why you would ever want to use &lt;code&gt;{% cache using key %}&lt;/code&gt; without the globally keyword, as it seems like without the globally keyword, the key isn't being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Reduce 'criteria'.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When caching a &lt;code&gt;{% cache %}&lt;/code&gt; tag, it looks like Craft tracks all of the 'criteria' to determine when this chunk of content should be invalidated. Examples of criteria are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Building entries from &lt;code&gt;craft.entries&lt;/code&gt;,&lt;/li&gt;&#xA;&lt;li&gt;Building related entries from an entry, or&lt;/li&gt;&#xA;&lt;li&gt;Getting all the assets for a particular field on an entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, for example, if you Are showing a list of the five most recent blog articles, you might have&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 Criteria for building the list of recent entries,&lt;/li&gt;&#xA;&lt;li&gt;1 Criteria for each entry getting a cover photo,&lt;/li&gt;&#xA;&lt;li&gt;1 Criteria for each entry getting the author, and&lt;/li&gt;&#xA;&lt;li&gt;1 Criteria for each entry getting the author's photo.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, that's 16 criteria for this example. Some of the pages on our site did had as many as 247 associated criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Criteria are stored as JSON within MySQL. For each one, Craft has to decode the JSON and compare it to determine whether it should be cleaned up or not, so if you end up with a really high number of criteria, the background tasks will take longer and longer, and in our experience, eventually get stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Linking to transformed images might prevent for your page from caching.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you link to a transformed asset but don't include it on the page (say, as the target for &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; but not the src for an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag.) then you may interfere with the caching of your page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't generate transformed assets until they are requested, which is fine for &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags but not for &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags. Instead, it returns a special URL that, when requested, will generate the transformed asset on demand. After the asset is generated, Craft will simply return a link to the generated asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Craft &lt;strong&gt;will not&lt;/strong&gt; cache any page which has these special URLs in it. For example, if you're caching a page with an image gallery with thumbnails that need to be clicked through to the larger (but still transformed) version, Craft will not cache that page &lt;em&gt;until after&lt;/em&gt; all of the large versions have been generated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm interested to know if anyone else has run into these issues, whether there's any other tips worth knowing for controlling performance of Craft's caching.&lt;/p&gt;&#xA;" OwnerUserId="3895" LastActivityDate="2015-07-21T22:06:26.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10654" PostTypeId="2" ParentId="2140" CreationDate="2015-07-21T22:27:45.927" Score="1" Body="&lt;p&gt;This has nothing specifically to do with the question, but this post was very helpful in figuring out how to get all entries that are &lt;strong&gt;channels&lt;/strong&gt;. Just wanted to share in case someone else came across this thread. This will return all entries for every channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getAllSections() %}&#xA;{% for channelSection in sections if channelSection.type == 'channel' %}  &#xA;&#xA;    {% set channelEntry = craft.entries.sectionId(channelSection.id) %}&#xA;        {% for entry in channelEntry %}&#xA;            &amp;lt;div class=&quot;block {{ channelSection.handle }}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;block-header&quot;&amp;gt;&#xA;                    &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;block-summary&quot;&amp;gt;&#xA;                    {{ entry.summary }}&#xA;                    &amp;lt;p&amp;gt;&#xA;                        &amp;lt;small&amp;gt;(In {{ channelSection }})&amp;lt;/small&amp;gt;&#xA;                    &amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;block-footer text-right&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;fa fa-ellipsis-h&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ channelSection.handle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To generate something like &lt;code&gt;myChannelHandle&lt;/code&gt; which (could) is useful for creating hooks for css/js.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-07-21T22:27:45.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10655" PostTypeId="1" CreationDate="2015-07-21T23:41:35.603" Score="3" ViewCount="1336" Body="&lt;p&gt;I have a section that needs to display a certain block type (heroVideo) if a lightswitch (displayHeroVideo) within it is active. Otherwise, it should display a different block type (heroImage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I write a conditional to accommodate this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have already which outputs both blocks if the lightswitch is active. How do I apply the conditional earlier?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Start hero section #}&#xA;{% for entry in entry.heroFeatured.limit(1) %}&#xA;  {% for block in entry.hero %}&#xA;&#xA;  {% if block.type == &quot;heroVideo&quot; and block.displayHeroVideo == &quot;1&quot; %}&#xA;&#xA;  &amp;lt;h1&amp;gt;Hero Video Markup&amp;lt;/h1&amp;gt;&#xA;&#xA;  {% else %}&#xA;&#xA;  &amp;lt;h1&amp;gt;Hero Image Markup&amp;lt;/h1&amp;gt;&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="831" LastEditDate="2015-07-22T13:48:13.040" LastActivityDate="2017-07-31T18:38:20.177" Title="If Conditional for Lightswitch in Matrix Field" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10657" PostTypeId="1" AcceptedAnswerId="10665" CreationDate="2015-07-22T07:56:49.700" Score="2" ViewCount="770" Body="&lt;p&gt;I am very new to Craft CMS and going through the introduction videos on Mijingo.  I am new developer also so please answer in easy terms if you can. I need to know what the difference is between an image I might drop straight into the assets file (if I choose) or the uploaded ones through Craft. I understand that you want to use images in the CMS they NEED to be uploaded through Craft. BUT why would you use &quot;static&quot; images straight into the assets file? My colleague said if you want to use interface pictures you drop them straight in. But I don't understand what that means. Thanks very much and have a great day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jason&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Please say why if this was a bad question so I can become better at asking on Stack Exchange. Thanks again!&lt;/p&gt;&#xA;" OwnerUserId="3889" LastEditorUserId="22" LastEditDate="2017-05-09T23:41:48.100" LastActivityDate="2017-10-19T07:46:36.283" Title="Images uploaded or static" Tags="&lt;assets&gt;&lt;craft-features&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10658" PostTypeId="2" ParentId="10657" CreationDate="2015-07-22T08:30:34.300" Score="2" Body="&lt;p&gt;Can't speak for anyone else, but I have an &lt;code&gt;img&lt;/code&gt; and a &lt;code&gt;fonts&lt;/code&gt; directory in my &lt;code&gt;public&lt;/code&gt; directory, where I put static image files and fonts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One positive about putting it in the assets is that you have transforms available for them, and you can attach metadata if you want to. There might be performance implications to it though, but I can't imagine that would matter unless you have a lot of traffic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a &lt;a href=&quot;https://www.npmjs.com/package/generator-origin-craft&quot; rel=&quot;nofollow&quot;&gt;Yeoman generator&lt;/a&gt; to quickly scaffold everything (directory structure, build system, commonly used frameworks). It's using Grunt for builds, and packs everything into a nice little tarball that you can move when you need to deploy it.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-22T08:30:34.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10659" PostTypeId="1" AcceptedAnswerId="10858" CreationDate="2015-07-22T09:00:46.113" Score="6" ViewCount="2256" Body="&lt;p&gt;I’m trying to implement &lt;strong&gt;different hyperlink styles&lt;/strong&gt; within a rich-text field by adding formatting options via a Redactor config file.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;&quot;formattingAdd&quot;: [&#xA;  {&#xA;    &quot;title&quot;: &quot;Button&quot;,&#xA;    &quot;tag&quot;: &quot;a&quot;,&#xA;    &quot;class&quot;: &quot;button&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn’t working as expected though. The above, for example, adds a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; around or within the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag, occasionally removing the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to add classes to hyperlinks within a rich-text field?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This rich-text field is already within a containing Matrix field, so that’s not an option.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2018-10-10T08:46:46.887" Title="Rich-Text/Redactor hyperlink classes" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10660" PostTypeId="2" ParentId="10638" CreationDate="2015-07-22T10:04:50.863" Score="2" Body="&lt;p&gt;As Alec says, the server doesn't know details about the users screen, that has to be fetched with javascript client-side. But the information can be exchanged through a cookie so that the server can act according to it. When used in the manner you outline, this is known as &lt;a href=&quot;http://www.lukew.com/ff/entry.asp?1392&quot; rel=&quot;nofollow&quot;&gt;Responsive design + Server Side Component&lt;/a&gt;s, or RESS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a plugin (a long time ago) named &lt;a href=&quot;https://github.com/aelvan/RESS-Toolbox-Craft&quot; rel=&quot;nofollow&quot;&gt;RESS Toolbox for Craft&lt;/a&gt;, which I think will do what you want. Make sure you read the warning regarding caching first, though, there are a lot of caveats when it comes to RESS. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-22T10:04:50.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10661" PostTypeId="2" ParentId="10655" CreationDate="2015-07-22T14:18:31.677" Score="6" Body="&lt;p&gt;You're close! The way you have your conditional set up now will print Hero Image Markup if either of your conditionals fail. By checking if &lt;code&gt;block.displayHeroVideo&lt;/code&gt; is 1 on a block type that doesn't have that field, Twig will still return 0. You should only check &lt;code&gt;displayHeroVideo&lt;/code&gt; when you know you are inside of a &lt;code&gt;heroVideo&lt;/code&gt; block. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.heroFeatured.limit(1) %}&#xA;    {% for block in entry.hero %}&#xA;&#xA;        {% if block.type == &quot;heroVideo&quot; %}&#xA;&#xA;            {% if block.displayHeroVideo == &quot;1&quot; %} &#xA;&#xA;                &amp;lt;h1&amp;gt;Hero Video Markup&amp;lt;/h1&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% else %}&#xA;&#xA;            &amp;lt;h1&amp;gt;Hero Image Markup&amp;lt;/h1&amp;gt;&#xA;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2017-07-31T18:38:20.177" LastActivityDate="2017-07-31T18:38:20.177" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10662" PostTypeId="1" AcceptedAnswerId="10663" CreationDate="2015-07-22T16:19:16.907" Score="4" ViewCount="293" Body="&lt;p&gt;In my particular case I need to be able to switch the layout that the template extends. Is this possible to do using locales?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2015-07-27T15:31:24.427" Title="Can locales be used to switch layouts?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10663" PostTypeId="2" ParentId="10662" CreationDate="2015-07-22T16:59:34.403" Score="7" Body="&lt;p&gt;Untested, but should be fairly straightforward.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.locale == 'de' %}&#xA;    {% set template = '_layout_de.html' %}&#xA;{% else %}&#xA;    {% set template = '_layout.html' %}&#xA;{% endif %}&#xA;{% extends template %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends craft.locale == 'de' ? '_layout_de.html' : '_layout.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or using a locale folder (thank josh baker)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends craft.locale ~ '/_layout' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2015-07-27T15:31:24.427" LastActivityDate="2015-07-27T15:31:24.427" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10664" PostTypeId="2" ParentId="10638" CreationDate="2015-07-22T17:37:15.177" Score="2" Body="&lt;p&gt;You can only do this reliably in JavaScript with &lt;code&gt;window.screen.width&lt;/code&gt; and &lt;code&gt;window.screen.height&lt;/code&gt; (&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Screen&quot; rel=&quot;nofollow&quot;&gt;MDN&lt;/a&gt;), or &lt;code&gt;$(window).width()&lt;/code&gt; and &lt;code&gt;$(window).height()&lt;/code&gt; when using jQuery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s possible to use a server side directory of device sizes and compare the user agent, however this solution quickly falls down when screen orientation is taken into account, not to mention that it’ll be time consuming to maintain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blog.cloudflare.com/introducing-mirage-intelligent-image-loading/&quot; rel=&quot;nofollow&quot;&gt;CloudFlare’s Mirage&lt;/a&gt; solution, which resizes images in the way you propose, might be worth looking at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;P.s. It might be worth posting a question with what you’re actually trying to do as it sounds like you might be approaching the problem in the wrong way.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2015-07-22T17:37:15.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10665" PostTypeId="2" ParentId="10657" CreationDate="2015-07-22T18:36:04.827" Score="4" Body="&lt;p&gt;Great question! Let's define some terminology to make this easier to discuss...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Static images:&lt;/strong&gt; Uploaded via FTP (or similar). Not tied into the CMS in any meaningful way.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Dynamic images:&lt;/strong&gt; Uploaded via the Control Panel (or synced after FTP upload). Can easily be related to entries and other elements, or even have fields assigned &lt;em&gt;directly to your assets&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Static images are the more &quot;traditional&quot; way of storing images, just as you would with a non-CMS website. There are absolutely some good reasons to use static images... for example, anything on your website which will basically never change (like the company logo).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dynamic images (aka &quot;Assets&quot;) are ideal for dynamic content. If you're writing articles with images, this is a perfect use-case. There are far more complex examples as well, but this is a great starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an image makes more sense being &lt;em&gt;static&lt;/em&gt;, then let it be static. Conversely, if you believe it needs to be &lt;em&gt;dynamic&lt;/em&gt;, then make it dynamic. &lt;strong&gt;Don't try to force an image to be something that it's not.&lt;/strong&gt; With just a little bit more experience, it will quickly become obvious which kinds of images should be static vs dynamic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I've got my folder structure setup...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;/public&#xA;    /assets&#xA;        /(ASSET SOURCE FOLDER 1)&#xA;        /(ASSET SOURCE FOLDER 2)&#xA;        /(ASSET SOURCE FOLDER 3)&#xA;    /resources&#xA;        /css&#xA;        /js&#xA;        /images&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;strong&gt;static&lt;/strong&gt; images go into &lt;code&gt;/public/resources/images&lt;/code&gt;. They are then referenced just as if the site were not using a CMS at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;strong&gt;dynamic&lt;/strong&gt; images go into various subfolders within &lt;code&gt;/public/assets&lt;/code&gt;. Each subfolder maps directly to an Asset Source, defined in the CMS control panel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Make sure your assets subfolders have proper read/write permissions! Craft will need to interact with those files when uploading, and also when creating image transforms.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Permissions for your static folder can be much stricter... Those will only need to be read, never written to.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, this all assumes that you're storing your dynamic images in a &lt;strong&gt;local folder&lt;/strong&gt;... Things are slightly different when you want to keep your assets in the cloud (S3, Rackspace, Google), but that's a &lt;a href=&quot;https://craftcms.stackexchange.com/q/574/45&quot;&gt;different conversation altogether&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-22T18:36:04.827" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10666" PostTypeId="1" CreationDate="2015-07-22T18:54:44.707" Score="0" ViewCount="126" Body="&lt;p&gt;I've got an even notifier plugin I have been working on for a specific client project. Sending an email to a single address works fine, but when I loop through a table containing email addresses it is sending duplicate addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a global table field (adminEmails) which has two columns, one for a name and the other for an email address.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          $adminGlobal = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('admin');&#xA;          foreach($adminGlobal-&amp;gt;adminEmails as $key =&amp;gt; $admin){&#xA;            $email-&amp;gt;toEmail = $admin['emailAddress'];&#xA;            $body .= &quot;Manager &quot;.$manager-&amp;gt;fullName.&quot; has submitted an event for approval.\n\n&quot;;&#xA;            $body .= &quot;Start Date &amp;amp; Time: &quot;.$entry-&amp;gt;eventStartDate-&amp;gt;format('m/d/Y g:i A'). &quot;\n\n&quot;;&#xA;            $body .= &quot;House: &quot;.$house-&amp;gt;houseName.&quot;\n\n&quot;;&#xA;            $body .= &quot;School: &quot;.$college-&amp;gt;collegeName.&quot;\n\n&quot;;&#xA;            $body .= $entry-&amp;gt;url;&#xA;            $email-&amp;gt;body = $body;&#xA;            if($email-&amp;gt;toEmail != &quot;&quot;){&#xA;              craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;            }&#xA;          }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have been testing with two email addresses and both addresses receive the same email twice. Not sure what could be causing this. I tried creating a new email model object inside each foreach loop but that didn't help either. Any ideas what's happening here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I dump $admin you see the following,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array&#xA;(&#xA;'col1' =&amp;gt; 'John Doe'&#xA;'col2' =&amp;gt; 'some.email@gmail.com'&#xA;'adminName' =&amp;gt; 'John Doe'&#xA;'emailAddress' =&amp;gt; 'some.email@gmail.com'&#xA;) 0 array&#xA;(&#xA;'col1' =&amp;gt; 'Andrew Clinton'&#xA;'col2' =&amp;gt; 'some.email@anecka.com'&#xA;'adminName' =&amp;gt; 'Andrew Clinton'&#xA;'emailAddress' =&amp;gt; 'some.email@anecka.com'&#xA;) 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I was expecting..so why is it sending the same email twice to both addresses?&lt;/p&gt;&#xA;" OwnerUserId="3688" LastEditorUserId="3688" LastEditDate="2015-07-24T18:17:54.460" LastActivityDate="2015-07-24T18:17:54.460" Title="Plugin Emails Being Sent Twice" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10667" PostTypeId="1" AcceptedAnswerId="10675" CreationDate="2015-07-22T23:52:27.070" Score="12" ViewCount="2861" Body="&lt;p&gt;I've been working on a site for a while in beta. The number of versions for all the pages is getting big and the database is now over 2MB. I'd love to just delete all the old versions of all pages when I go live with the site. Is there any easy way to do this?&lt;/p&gt;&#xA;" OwnerUserId="3902" LastEditorUserId="125" LastEditDate="2015-07-23T08:13:30.393" LastActivityDate="2020-04-20T14:36:42.020" Title="Delete all old versions from the database" Tags="&lt;entries&gt;&lt;entry-versions&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10668" PostTypeId="2" ParentId="10667" CreationDate="2015-07-23T00:43:59.913" Score="3" Body="&lt;p&gt;You should be able to just safely delete them from the &lt;code&gt;craft_entryversions&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this deletes all your entry versions, so each entry will just exist at its last known 'live' state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, backup your database first. :)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-23T00:43:59.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10669" PostTypeId="1" CreationDate="2015-07-23T01:50:04.500" Score="3" ViewCount="738" Body="&lt;p&gt;Any code that I previously inserted using the html button on the rich text wysiwyg is removed when I click into edit the html within a post. Only &lt;code&gt;&amp;lt;p&gt;&lt;/code&gt; tags remain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have turned off the &quot;Clean html&quot; and the &quot;Purify html&quot; in the settings for the body field (rich text field), and have tried to enter iframes (videos).  I can insert them initially, but if I go back to the edit as rich text, and then click to edit the html, any iframes, divs or tags other than &lt;code&gt;&amp;lt;p&gt;&lt;/code&gt; tags are stripped out of the code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot edit html in any posts that have videos else the videos are stripped out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also downloaded a fresh install of Craft to make sure that it wasn't just my install.  I encountered the same issue.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone tell me what is going on? &lt;/p&gt;&#xA;" OwnerUserId="3361" LastEditorUserId="3959" LastEditDate="2015-08-19T23:21:07.653" LastActivityDate="2015-09-22T22:13:00.013" Title="WYSIWYG removes HTML button all non-&lt;p&gt; tags when view source" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10670" PostTypeId="1" AcceptedAnswerId="10677" CreationDate="2015-07-23T05:55:38.223" Score="6" ViewCount="4031" Body="&lt;p&gt;Just giving Craft CMS a test drive. Setup a local site using MAMP Pro. Got the basic site up and running ok, admin as well. Then i wanted to try out image assets, so I created an Asset Source for images, local folder. Created my &quot;images&quot; folder under the public dir, and specified &quot;images/&quot; as the file system path for my asset source. Added an image transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I try and upload an image, and it fails, with the ajax call &quot;/index.php/admin/actions/assets/uploadFile&quot; returning a 500 error. I tried checking the log files but there are no error messages relating to this failed ajax call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I am doing wrong? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2016-04-14T01:22:33.323" Title="Getting a &quot;500 Internal Server Error&quot; when uploading an image asset" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10671" PostTypeId="1" CreationDate="2015-07-23T06:02:27.570" Score="2" ViewCount="460" Body="&lt;p&gt;I set a matrix block field for a blog's channel and when I try to create a new entry, It is empty&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I change the matrix field with another field, it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have an idea? Thanks in advance :)&lt;/p&gt;&#xA;" OwnerUserId="948" LastEditorUserId="948" LastEditDate="2015-07-23T06:19:45.513" LastActivityDate="2016-02-28T02:19:46.177" Title="Blank entry page in CP" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10672" PostTypeId="1" AcceptedAnswerId="10673" CreationDate="2015-07-23T07:05:23.100" Score="4" ViewCount="900" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/functions#url&quot; rel=&quot;nofollow&quot;&gt;The &lt;code&gt;url()&lt;/code&gt; function&lt;/a&gt; won't work with a leading slash as it's path parameter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this: &lt;code&gt;{{ url('jobs') }}&lt;/code&gt;&lt;br&gt;&#xA;Outputs: &lt;code&gt;http://example.com/jobs&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this: &lt;code&gt;{{ url('/jobs') }}&lt;/code&gt;&lt;br&gt;&#xA;Just outputs: &lt;code&gt;/jobs&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easy enough to remember for developers, but if you're passing a variable from a user input field like &lt;code&gt;{{ url(entry.myField) }}&lt;/code&gt;, users can accidentally break a link if they add a leading slash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make the &lt;code&gt;url()&lt;/code&gt; function more resilient when relying on an unknown variable?&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-07-23T07:05:23.100" Title="How do I use a leading slash with the url() function?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10673" PostTypeId="2" ParentId="10672" CreationDate="2015-07-23T07:05:23.100" Score="4" Body="&lt;p&gt;Use the &lt;code&gt;trim&lt;/code&gt; filter to automatically remove leading and trailing slashes like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url( entry.myField | trim('/') )  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-07-23T07:05:23.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10675" PostTypeId="2" ParentId="10667" CreationDate="2015-07-23T07:59:47.820" Score="14" Body="&lt;p&gt;I just wrote a plugin that deletes all versions (truncates the &lt;code&gt;craft_entryversions&lt;/code&gt; table) and then saves a new version for each of your entries, so you can later revert back to it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-deleteallentryversions&quot;&gt;Delete All Entry Versions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-23T07:59:47.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10676" PostTypeId="1" CreationDate="2015-07-23T09:43:45.593" Score="2" ViewCount="458" Body="&lt;p&gt;I'm looking to change a select fields options with the onChange event from another select fields chosen option. Obviously this can be done with js on the frontend as per &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4779/tie-two-select-fields-together-based-on-category-and-subcategory&quot;&gt;this post&lt;/a&gt; but has anyone done this for the control panel? I imagine it will need to be done via a fieldType plugin, but wondered if anything already exists for this type of functionality before I attempt to build something.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-14T05:49:51.233" Title="Populate or change the selection options in one field based on selected option in another field in the CP" Tags="&lt;field&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10677" PostTypeId="2" ParentId="10670" CreationDate="2015-07-23T09:49:43.910" Score="6" Body="&lt;p&gt;ok i solved the problem by following the answer to this question here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4661/fastcgi-error-when-accessing-a-local-development-site-using-mamp-pro&quot;&gt;FastCGI error when accessing a local development site using MAMP Pro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;even though the ajax call didn't generate an apache error at the moment it was called, it must have been something to do with fastcgi in general, cos the answer to that question worked for me! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have never had this problem before, and i have heaps of other local sites which also do file/image uploading. so strange. and uploading of other file types (eg pdf) into the assets area worked no problem! doesn't make sense. but as a developer, sometimes you just accept the mystery of it all...&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;UPDATE&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;the problem started rearing it's ugly head again, even though i hadn't touched the &lt;code&gt;httpd.conf&lt;/code&gt; edit i did to fix it. so i just deactivated the fastcgi module on the MAMP Pro dashboard. et voila, we're back in business....&lt;/p&gt;&#xA;" OwnerUserId="3789" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-14T01:22:33.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10678" PostTypeId="1" AcceptedAnswerId="10683" CreationDate="2015-07-23T09:53:51.873" Score="3" ViewCount="676" Body="&lt;p&gt;Context: we sell some magazines and other newspapers on our site, and updating all the cover images manually is a hassle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the ability to write a url in a field (www.myimageprovider.com/product1) and set a cron job to fetch any new images for the day, for that specific product, and update the entry with the new image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a hard time figuring out how to &quot;fake&quot; a file upload from a craft controller/service, as if it was uploaded from the CP form. I have tried something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$file = array();&#xA;$url = $entry-&amp;gt;getFieldValue('imagefetchurl'); // somegoogleimageurl.com/image.png&#xA;$tmpfname = tempnam(&quot;/tmp&quot;, &quot;UL_IMAGE&quot;);&#xA;$img = file_get_contents($url);&#xA;file_put_contents($tmpfname, $img);&#xA;$file['size'] = filesize($tmpfname); // 245 kB&#xA;$file['name'] = basename($url); // image.png&#xA;$file['tmp_name'] = $tmpfname; // C:\\Windows\\Temp\\UL_XXXX.tmp&#xA;&#xA;$_FILES['assets-upload'] = $file;&#xA;$assetOperationResponseModel = craft()-&amp;gt;assets-&amp;gt;uploadFile(1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws an error&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;PHP notice&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;getimagesize(): Read error!&lt;/em&gt; - in ...craft\app\services\ImagesService.php(114)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that the image get downloaded, the size and name is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers and ideas are greatly appreciated&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;EDIT&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;After some digging, looks like i have to write my own upload handler for this task. &lt;a href=&quot;http://www.1-script.com/forums/php/simulate-file-upload-so-that-move-uploaded-file-succeeds-124012-.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.1-script.com/forums/php/simulate-file-upload-so-that-move-uploaded-file-succeeds-124012-.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Basically not possible unless you change the PHP source&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I suppose i could override the function, but my instinct tells me that's a bad idea. I will have to go with an alternative approach&lt;/p&gt;&#xA;" OwnerUserId="2300" LastEditorUserId="2300" LastEditDate="2015-07-23T12:05:31.160" LastActivityDate="2016-06-12T02:28:06.380" Title="How to upload assets without user interaction?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10679" PostTypeId="1" AcceptedAnswerId="10701" CreationDate="2015-07-23T11:48:12.417" Score="1" ViewCount="530" Body="&lt;p&gt;I'm having a little trouble wrapping my head around &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;Relations&lt;/a&gt; through a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix&lt;/a&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow&quot;&gt;Structure&lt;/a&gt; called &lt;code&gt;exhibitors&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix field on a Page called &lt;code&gt;rooms&lt;/code&gt;, This has one block type &lt;code&gt;room&lt;/code&gt; and within that block there is an entries relationship field called &lt;code&gt;exhibitors&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wanting to do is loop through the &lt;code&gt;exhibitor&lt;/code&gt; entries and for each one, I want to find the first room they are related to via the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried various flavours of the &lt;code&gt;relatedTo&lt;/code&gt; method, but I just can't seem to get them related, I just get null back from every one I've tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of one I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exhibitors = craft.entries.section('exhibitors').order('title') %}&#xA;&#xA;{% for exhibitor in exhibitors %}&#xA;    {% set room = entry.rooms.relatedTo({&#xA;        sourceElement: exhibitor,&#xA;        field: 'room.exhibitors'&#xA;    }).first() %}&#xA;&#xA;{{ room }} &amp;lt;-- Always a null entry&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-07-24T13:04:25.143" Title="Relationship through Matrix field" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10680" PostTypeId="1" AcceptedAnswerId="10687" CreationDate="2015-07-23T12:14:23.460" Score="2" ViewCount="3248" Body="&lt;p&gt;Is there a straightforward way of creating a GUID or some other type of unique identifier within a Twig Template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/StringHelper#UUID-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper.UUID&lt;/a&gt; (mentioned in a different question), but it doesn't look like I can use it directly in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm comfortable creating a small plugin to expose this, or alternatively creating a twig filter to use a relevant PHP method, I just didn't want to go re-inventing the wheel if there's already a good solution I don't know about. &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-07-23T17:40:41.233" Title="Create a GUID in a template" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10681" PostTypeId="2" ParentId="10676" CreationDate="2015-07-23T12:25:49.563" Score="2" Body="&lt;p&gt;I would write a custom fieldtype (&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/field-types&lt;/a&gt;) with two selects. Makes sense to make it as one field if they are dependent of eachother.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just store the field as json (AttributeType::Mixed) and inject your own javascript in the fields &lt;code&gt;getFieldHtml()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-07-23T12:25:49.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10683" PostTypeId="2" ParentId="10678" CreationDate="2015-07-23T13:04:47.143" Score="3" Body="&lt;p&gt;Answering my own question for reference.&lt;/p&gt;&#xA;&lt;p&gt;I was tunneling too hard on the PHP, a simple bash script takes care of the upload.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# assuming the image is already downloaded and no CP-login required&#xA;curl -F assets-upload=@/path/to/image mycraftsite/admin/actions/assets/uploadFile&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3&gt;EDIT&lt;/h3&gt;&#xA;&lt;p&gt;Better answer: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8994/change-image-title-programatically&quot;&gt;Thanks to this answer&lt;/a&gt; I discovered the &lt;code&gt;insertFileByLocalPath()&lt;/code&gt; function in AssetsService.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($id);&#xA;  if($entry &amp;amp;&amp;amp; isset($entry[&amp;quot;imageFetchUrl&amp;quot;])) {&#xA;    $url = $entry-&amp;gt;getFieldValue(&amp;quot;imageFetchUrl&amp;quot;);&#xA;    $tmpfname = tempnam(&amp;quot;/tmp&amp;quot;, &amp;quot;UL_IMAGE&amp;quot;);&#xA;    $img = file_get_contents($url);&#xA;    file_put_contents($tmpfname, $img);&#xA;    craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath($tmpfname, 'fetchedImg.jpg', $myFolderId);&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-07-24T12:46:25.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10684" PostTypeId="1" CreationDate="2015-07-23T13:31:04.490" Score="0" ViewCount="234" Body="&lt;p&gt;I've just started my first Craft site locally and it's all good so far.. a little further down the road, I'll need to then deploy regularly to integration/test/stage and production environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just wondering how people manage DB syncing across these different environments?&lt;/p&gt;&#xA;" OwnerUserId="3761" LastActivityDate="2015-07-23T13:46:38.837" Title="How do you manage master db across multiple environments?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2015-07-23T16:42:13.160" ContentLicense="CC BY-SA 3.0" />
  <row Id="10685" PostTypeId="2" ParentId="10684" CreationDate="2015-07-23T13:46:38.837" Score="2" Body="&lt;p&gt;See carlcs' comment. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What&amp;#39;s the best practice for handling data migration and organization across development environments?&lt;/a&gt; is one of the biggest discussions on this S/E.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-07-23T13:46:38.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10686" PostTypeId="1" AcceptedAnswerId="10689" CreationDate="2015-07-23T14:59:14.817" Score="3" ViewCount="1056" Body="&lt;p&gt;So I've setup locales following the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;official guide&lt;/a&gt; and am going with the option where English (en_gb) is the default and Danish (da_dk) is in a sub-folder:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com&lt;/a&gt;      --&gt; en default&lt;br&gt;&#xA;&lt;a href=&quot;http://mysite.com/dk/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com/dk/&lt;/a&gt;  --&gt; dk sub-folder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, I've set the locales in Settings -&gt; Locales&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/geZQZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/geZQZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've enabled them for my section (which is a channel):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nZBxB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nZBxB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the siteURL array (single domain config):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://mysite.com',&#xA;    'dk' =&amp;gt; 'http://mysite.com/dk/',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've created the folder structure and copied the index.php file and .htaccess file across to the &lt;code&gt;dk/&lt;/code&gt; folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public_html/            --&amp;gt; mysite.com/&#xA;    .htaccess&#xA;    index.php&#xA;    dk/                 --&amp;gt; mysite.com/dk/&#xA;        .htaccess&#xA;        index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I've made the edit to the &lt;code&gt;dk/index.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the Danish content&#xA;define('CRAFT_LOCALE', 'dk');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Viewing my entry in English works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/segment/title  --&amp;gt; Shows in English&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Viewing the same entry in Danish directs to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/danishsegment/title --&amp;gt; Missing /dk/ in URL. Nothing shown&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the preview link for Denmark doesn't include the country segment in the URL (&lt;code&gt;dk/&lt;/code&gt;) and results in a 404. Even manually adding &lt;code&gt;dk/&lt;/code&gt; to the URL results in a 404. It doesn't seem to be recognising the Danish locale at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas as to what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the contents of my .htaccess files. All standard Craft with a Type to ensure PHP 5.6 is used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AddType x-httpd-php56 .php&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'Offers' section (Channel) is set to have a different URL for each Locale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a4rD5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a4rD5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="3481" LastEditDate="2015-07-23T18:15:28.150" LastActivityDate="2015-07-23T19:24:15.053" Title="Can't get locales to work properly" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10687" PostTypeId="2" ParentId="10680" CreationDate="2015-07-23T17:05:24.430" Score="3" Body="&lt;p&gt;If a simple timestamp is unique enough, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ now|date('YmdHis') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will give you something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;20150723170500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-23T17:05:24.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10688" PostTypeId="2" ParentId="10680" CreationDate="2015-07-23T17:40:41.233" Score="1" Body="&lt;p&gt;If you truly need a GUID, then a small plugin that adds it's own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addTwigExtension&quot; rel=&quot;nofollow&quot;&gt;Twig extension&lt;/a&gt; can add a &lt;code&gt;{{ getUUID() }}&lt;/code&gt; method that would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getUUID()&#xA;{&#xA;    return StringHelper::UUID();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or for other random strings, &lt;code&gt;{{ getRandomString(12, true) }}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getRandomString($length = 36, $extendedChars = false)&#xA;{&#xA;    return StringHelper::randomString($length, $extendedChars);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-23T17:40:41.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10689" PostTypeId="2" ParentId="10686" CreationDate="2015-07-23T19:24:15.053" Score="2" Body="&lt;p&gt;Have you tried putting &lt;code&gt;da_dk&lt;/code&gt; in as the key in the siteUrl array?&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-23T19:24:15.053" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10690" PostTypeId="1" AcceptedAnswerId="10694" CreationDate="2015-07-23T20:11:51.710" Score="0" ViewCount="348" Body="&lt;p&gt;Trying to get the &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster plugin&lt;/a&gt; working for user activation emails, instead of the default Craft setup (had issue with Mandrill setup, Use SMTP authentication throws an error).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It doesn't seem that Postmaster disables the default Craft email setup, is there a way to do this within Craft?&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming (1), what is the correct &lt;code&gt;{{ link }}&lt;/code&gt; variable as currently I'm seeing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template Error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Variable &quot;link&quot; does not exist&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Users/.../site/craft/templates/postmaster/user/activation.txt(5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hey {{user.friendlyName}},&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for creating an account with the Postmaster {{siteName}}! To  activate your account, click the following link:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{link}}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you weren't expecting this email, just ignore it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem there is currently a way to do this.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="3888" LastEditDate="2015-07-23T20:34:27.617" LastActivityDate="2015-07-23T22:43:55.110" Title="Postmaster plugin: user activation link" Tags="&lt;emails&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10691" PostTypeId="1" CreationDate="2015-07-23T20:40:46.927" Score="2" ViewCount="331" Body="&lt;p&gt;I'm currently able to add a user with the following code (from &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;the Docs&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;username  = 'tommy';&#xA;$user-&amp;gt;firstName = 'Tom';&#xA;$user-&amp;gt;lastName  = 'Foolery';&#xA;$user-&amp;gt;email     = 'tom@thefoolery.com';&#xA;&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;if (!$success)&#xA;{&#xA;    Craft::log('Couldn’t save the user &quot;'.$user-&amp;gt;username.'&quot;', LogLevel::Error);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I also set the Profile Company name??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;company = 'ACME';&#xA;&#xA;$user-&amp;gt;setContent([ 'fields' =&amp;gt; ['company' =&amp;gt; 'ACME'] ]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1011" LastActivityDate="2015-07-23T22:54:38.670" Title="How do I programmatically set a Users company field?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10692" PostTypeId="1" CreationDate="2015-07-23T22:15:46.653" Score="4" ViewCount="658" Body="&lt;p&gt;So I am working on a project that includes an online product catalog. Is there a recommended way of setting up a catalog regarding the use of structure(s) vs. categories or a combination both? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will have &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;brands with a couple of product families and a few products in every&#xA;family&lt;/li&gt;&#xA;&lt;li&gt;accessories by the same brand for the whole family &lt;/li&gt;&#xA;&lt;li&gt;accessories by the same brand for various product families&lt;/li&gt;&#xA;&lt;li&gt;accessories by the same brand for only certain products&lt;/li&gt;&#xA;&lt;li&gt;accessories by other brands for a whole product family &lt;/li&gt;&#xA;&lt;li&gt;accessories by other brands for a certain product only&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Wondering if one structure or two (for brands and products) and relations would work and be efficient and flexible, or if I should work with categories as well? In total, it will be about 100 to 150 items in the catalog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for opinions!&lt;/p&gt;&#xA;" OwnerUserId="549" LastEditorUserId="549" LastEditDate="2015-07-24T09:30:08.683" LastActivityDate="2015-08-02T14:39:28.413" Title="Structure(s) vs. Categories for product catalog" Tags="&lt;categories&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10693" PostTypeId="1" AcceptedAnswerId="10697" CreationDate="2015-07-23T22:37:23.780" Score="3" ViewCount="347" Body="&lt;p&gt;I've got a clean install of Craft with just some initial configuration of entry types, categories, assets, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any image I upload (either directly into assets or via an image field) has almost all of its EXIF metadata stripped out. Most of the removed info I don't care about, but it's essential that the embedded copyright, geolocation and keyword information is retained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume this has something to do with the configuration of ImageMagick/GD (whichever Craft uses by default). Is there a way I can create a configuration that specifies which EXIF fields to preserve in the uploaded image?&lt;/p&gt;&#xA;" OwnerUserId="3903" LastActivityDate="2019-08-12T13:46:31.637" Title="Uploaded images stripped of EXIF data" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10694" PostTypeId="2" ParentId="10690" CreationDate="2015-07-23T22:43:55.110" Score="2" Body="&lt;p&gt;In Craft 2.x, it isn't possible for plugins to provide their own email providers that the entire Craft installation can use.  They can provide their own that they can use for themselves, but it won't affect things like when Craft sends an activation email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's changed in the upcoming &lt;a href=&quot;http://buildwithcraft.com/3&quot; rel=&quot;nofollow&quot;&gt;Craft 3&lt;/a&gt;, though.  There is an example Mandrill plugin &lt;a href=&quot;https://github.com/pixelandtonic/Mandrill&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; on how to pull that off.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-23T22:43:55.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10695" PostTypeId="2" ParentId="10691" CreationDate="2015-07-23T22:54:38.670" Score="1" Body="&lt;p&gt;Close! You should be using &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;setContentFromPost()&lt;/a&gt; for this.  See &lt;a href=&quot;https://craftcms.stackexchange.com/a/6788/57&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;here&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You code would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;username  = 'tommy';&#xA;$user-&amp;gt;firstName = 'Tom';&#xA;$user-&amp;gt;lastName  = 'Foolery';&#xA;$user-&amp;gt;email     = 'tom@thefoolery.com';&#xA;$user-&amp;gt;setContentFromPost(array('company' =&amp;gt; 'ACME'));&#xA;&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;if (!$success)&#xA;{&#xA;    Craft::log('Couldn’t save the user &quot;'.$user-&amp;gt;username.'&quot;', LogLevel::Error);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-07-23T22:54:38.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10696" PostTypeId="1" CreationDate="2015-07-24T04:34:21.933" Score="1" ViewCount="123" Body="&lt;p&gt;I am transferring a site from CakePhp to Craft CMS. The old site has a ton of images which I need to import into the new site. I know i can drop the images in the right folder and do an &quot;Update Asets Indexes&quot;, but I also need to bring across some meta data, which will end up as field values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to Craft, but from what I can tell, I need to create console plugin, and from within that plugin do all the neat stuff to do the actual import. I have come across this blog entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://spin.atomicobject.com/2015/06/16/craft-console-plugin/&quot; rel=&quot;nofollow&quot;&gt;http://spin.atomicobject.com/2015/06/16/craft-console-plugin/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which I think looks pretty solid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, once I get a bare bones plugin up and running, what is the code I need to import an image file on disk into the Craft database, with field values set as required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2015-07-24T04:34:21.933" Title="Importing Images Via CLI" Tags="&lt;plugin-development&gt;&lt;image&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10697" PostTypeId="2" ParentId="10693" CreationDate="2015-07-24T05:20:45.897" Score="3" Body="&lt;p&gt;Currently the images are being cleansed on upload, which means that they are being re-saved to make sure that no malicious code is injected in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this means that EXIF data gets stripped out along the way, but since Craft already uses &lt;a href=&quot;https://github.com/lsolesen/pel&quot; rel=&quot;nofollow&quot; title=&quot;PEL&quot;&gt;PEL&lt;/a&gt;, it should be possible to tweak Craft a bit so that the EXIF metadata is preserved during this operation. We'll look into that and, hopefully, this will make it to a release pretty soon.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2015-07-24T05:20:45.897" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10698" PostTypeId="1" AcceptedAnswerId="10770" CreationDate="2015-07-24T08:25:42.047" Score="1" ViewCount="1033" Body="&lt;p&gt;My question is related to this page... &lt;a href=&quot;https://craftcms.stackexchange.com/questions/554/how-can-i-add-a-dynamic-active-css-class-to-the-navigation-on-any-given-page&quot;&gt;How can I add a dynamic &amp;quot;active&amp;quot; CSS class to the navigation on any given page?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance my code is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;slide-in&quot;&amp;gt; &#xA;    {% nav menu in craft.entries.section('mainMenu') %}&#xA;        &amp;lt;li class=&quot;{{ menu.id == entry.id ? 'active' }}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ menu.menuLink[0].url }}&quot;&amp;gt;{{ menu.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using Ben's code from this page but I am struggling to get this method working. I was wondering if someone could help me get to the bottom of this. I assume &lt;code&gt;menu.id&lt;/code&gt; does not match &lt;code&gt;entry.id&lt;/code&gt; and therefore the class is not added but how can I check the two id's are matching?&lt;/p&gt;&#xA;" OwnerUserId="3398" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-07-30T02:19:41.063" Title="Dymanic 'active' class using nav tag looping through a structure" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10699" PostTypeId="1" CreationDate="2015-07-24T08:32:48.920" Score="1" ViewCount="521" Body="&lt;p&gt;On my MAMP development server, SVG files display like this in the Assets section of the Control Panel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xd2Rt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xd2Rt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my live server, they get a black background:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ayjO0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ayjO0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use an SVG file inside an &lt;code&gt;img&lt;/code&gt; tag with an transform like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ iconSVG.getUrl(iconSize) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got this working fine on the MAMP server, but on the live server the file gets transformed into a PNG with a black background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't necessarily have to use a transform on the SVGs, so could leave that out, but the black thumbs in the Assets isn't that pretty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked both servers, and a possibly relevant difference I can see is that the MAMP does not have &lt;strong&gt;imagick&lt;/strong&gt;, whereas the live server does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix the black thumbnail issue? Would I need to disable &lt;strong&gt;imagick&lt;/strong&gt; on the live server somehow?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2015-07-24T17:50:52.523" Title="SVG thumbnails black on live server" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10700" PostTypeId="2" ParentId="10692" CreationDate="2015-07-24T09:57:53.153" Score="2" Body="&lt;p&gt;I find it difficult sometimes to choose between a category group and a structure, so for me it mostly boils down to semantics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A brand can be both a structure entry and a category. If you're going to have pages with information about the brand/product faily/product, and they will be available in some kind of menu to be browsed &lt;em&gt;by itself&lt;/em&gt;, I think I'd go with a structure. If, on the other hand, they are only going to be used for filtering and organizing, a category group feels more appropriate to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what you've described, I think I'd go with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Products (structure)&lt;/li&gt;&#xA;&lt;li&gt;Accessories (structure)&lt;/li&gt;&#xA;&lt;li&gt;Brands (category)&lt;/li&gt;&#xA;&lt;li&gt;Product family (category)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But as I said, it depends a lot on the specifics of your content.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-24T09:57:53.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10701" PostTypeId="2" ParentId="10679" CreationDate="2015-07-24T13:04:25.143" Score="1" Body="&lt;p&gt;So, it looks as though I was overcomplicating things! All it needs to be is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exhibitors = craft.entries.section('exhibitors').order('title') %}&#xA;&#xA;{% for exhibitor in exhibitors %}&#xA;    {% set room = entry.rooms.relatedTo(exhibitor).first() %} &#xA;&#xA;    {{ room }} &amp;lt;-- No longer a null entry&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2015-07-24T13:04:25.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10702" PostTypeId="2" ParentId="9242" CreationDate="2015-07-24T14:35:43.800" Score="5" Body="&lt;p&gt;Not that creating an additional variable is that much effort, but since I only want to &lt;strong&gt;not&lt;/strong&gt; cache if in &lt;code&gt;devMode&lt;/code&gt;, I based my solution on Marion's utilizing the same &lt;code&gt;devMode&lt;/code&gt; variable I'm using elsewhere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{% cache if not craft.config.devMode %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2015-07-24T14:35:43.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10703" PostTypeId="2" ParentId="10699" CreationDate="2015-07-24T17:50:52.523" Score="1" Body="&lt;p&gt;Craft requires &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; to do any SVG transforms, so that fact that it is working on your MAMP install without it is the only weird thing I see here. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will attempt to use Imagick if it is available on the server and fallback to GD otherwise or you can explicitly tell it which one to use via the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#imageDriver&quot; rel=&quot;nofollow&quot;&gt;imageDriver&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to why it's all black on production, make sure you're using a recent version of both the Imagick &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;PHP extension&lt;/a&gt; as well as the underlying &lt;a href=&quot;http://www.imagemagick.org/script/index.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; library.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-24T17:50:52.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10704" PostTypeId="1" AcceptedAnswerId="10706" CreationDate="2015-07-24T19:19:26.040" Score="1" ViewCount="300" Body="&lt;p&gt;I've encountered on a problem with escaping, where I want some parts of code, not being translated by Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Straight to the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://elements.polymer-project.org/elements/iron-media-query&quot; rel=&quot;nofollow&quot;&gt;Polymer&lt;/a&gt;, uses the same marking for variables as Twig, and I'm not sure, if it's possible to escape variable as a Twig's variable and transform it to a Polymer's variable&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By Twig's documentation, I've end up with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iron-media-query query=&quot;(min-width: 600px)&quot; query-matches=&quot;'{{'{{queryMatches}}'}}'&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where it translates to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iron-media-query query=&quot;(min-width: 600px)&quot; query-matches=&quot;'{{queryMatches}}'&quot;&amp;gt;&amp;lt;/iron-media-query&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The goal is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iron-media-query query=&quot;(min-width: 600px)&quot; query-matches=&quot;{{queryMatches}}&quot;&amp;gt;&amp;lt;/iron-media-query&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-07-24T20:39:24.500" Title="Ignore Twig's variable and transform it to Polymer's variable." Tags="&lt;escaping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10705" PostTypeId="1" AcceptedAnswerId="10726" CreationDate="2015-07-24T20:20:08.113" Score="1" ViewCount="1321" Body="&lt;p&gt;Ok, so I've tidied up the code a bit and using &lt;code&gt;option.selected&lt;/code&gt; instead of &lt;code&gt;option&lt;/code&gt; to see if the option is selected. But, it isn't behaving how I'd expect it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for telephone in user.profilePhone.type('details') %}&#xA;    &amp;lt;li&amp;gt;&#xA;      {% if telephone.type == 'details' %}&#xA;        {% for option in telephone.icon.options %}&#xA;            {% if option.selected == 'mobile' %}&#xA;                &amp;lt;i class=&quot;fa fa-fw fa-mobile&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            {% elseif option.selected == 'home' %}&#xA;                &amp;lt;i class=&quot;fa fa-fw fa-home&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;i class=&quot;fa fa-fw fa-phone&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;        {% if telephone.country %}{{ telephone.country }}{% endif %}&#xA;        {{ telephone.number }}&#xA;      {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this is how I read it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Loop through all Block Types &lt;code&gt;details&lt;/code&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As I understood from the docs, there is no need to be specific if there's only one Block Type (regardless of max blocks setting). The extra &lt;code&gt;if&lt;/code&gt; conditional seems redundant?&lt;/li&gt;&#xA;&lt;li&gt;I also understood that a &lt;code&gt;for loop&lt;/code&gt; would act as a conditional anyway, so it would return false if no Blocks existed?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Loop through the &lt;code&gt;icon&lt;/code&gt; dropdown options&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Whichever one is selected, display it's corresponding icon.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But what it actually outputs is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EGvf6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EGvf6.png&quot; alt=&quot;Wrong icon output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's outputting all of the available options, not just the selected one (and not even the correct icons). I've managed (with separate if statements for just &lt;code&gt;'home'&lt;/code&gt; and &lt;code&gt;'mobile'&lt;/code&gt; to get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zEZaX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zEZaX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's still outputting all options declared in the if statement, instead of the desired single icon. Here are the dropdown options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MzO6o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MzO6o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to programming, so perhaps I'm getting muddled up with things, but it seems like it should only output the icon I want, not the entire dropdown list (I realise I may need another conditional for if &lt;code&gt;'other'&lt;/code&gt; or &lt;code&gt;'work'&lt;/code&gt; is selected)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the issue is you can't check in the &lt;code&gt;for loop&lt;/code&gt; for &lt;strong&gt;just&lt;/strong&gt; the selected option with an &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow noreferrer&quot;&gt;if condition&lt;/a&gt;. Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for option in telephone.icon.options if option.selected %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="3888" LastEditDate="2015-07-26T15:30:06.333" LastActivityDate="2015-07-27T06:48:16.687" Title="Conditional if statement for Matrix dropdown option" Tags="&lt;matrix&gt;&lt;field&gt;&lt;conditional&gt;&lt;fieldtypes&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10706" PostTypeId="2" ParentId="10704" CreationDate="2015-07-24T20:39:24.500" Score="2" Body="&lt;p&gt;You forgot to remove the outer single quotes in your first example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iron-media-query query=&quot;(min-width: 600px)&quot; query-matches=&quot;{{'{{queryMatches}}'}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try the &lt;code&gt;raw&lt;/code&gt; filter if that doesnt work. More info on it &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2015-07-24T20:39:24.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10707" PostTypeId="1" AcceptedAnswerId="10711" CreationDate="2015-07-24T20:41:52.907" Score="2" ViewCount="1536" Body="&lt;p&gt;Can you do something similar to using &quot;with&quot; in twig's include tag (&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/tags/include.html&lt;/a&gt;), but instead with includeJsFile?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a plugin to filter my entries by their tags. The js initiation for this plugin requires me to list all the tags I'm using as a variable. I'd love to assign a variable to the tag group I'm using and pass it to the javascript file, rather than hard code the tag names. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2015-07-24T21:37:02.907" Title="Can you pass a variable with includeJsFile?" Tags="&lt;variable&gt;&lt;javascript&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10708" PostTypeId="1" AcceptedAnswerId="10738" CreationDate="2015-07-24T20:53:51.827" Score="3" ViewCount="460" Body="&lt;p&gt;I have created a search form which allows user to search multiple categories groups and multiple categories within those groups. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Type &#xA;&#xA;[] Category 1&#xA;&#xA;[x] Category 2&#xA;&#xA;[] Category 3&#xA;&#xA;...&#xA;&#xA;&#xA;Location&#xA;&#xA;[] Category 1&#xA;&#xA;[x] Category 2&#xA;&#xA;[] Category 3&#xA;&#xA;[] Category 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've chosen to use slugs as the search parameter for usability purposes but that means that I have to get the element of each slug and then pass it into the entries query. Long story short,lots of queries to my database before I even get started outputting the categories above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in caching the category queries and I'm doing as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key &quot;restaurant-filter-type&quot; %}&#xA;&#xA;    {% set typeList = craft.categories.group('restaurantType') %}&#xA;&#xA;    {% for type in typeList %}&#xA;&#xA;        &amp;lt;div class=&quot;field field--checkbox&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;type[]&quot; id=&quot;{{ type.slug }}&quot; value=&quot;{{ type.slug }}&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;{{ type.slug }}&quot;&amp;gt;{{ type.title }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;   {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I run into is when the user submits the form and the checked form elements arent being persistent because of the caching I've set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried looking at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4782/adding-active-class-to-globally-cached-navigation&quot;&gt;this SE question&lt;/a&gt; to help but the stumbling block for this is that there is the possibility that the parameter holding my restaurant type slugs may hold multiple values, hence the &lt;code&gt;name=&quot;type[]&quot;&lt;/code&gt;. A simple &lt;code&gt;replace&lt;/code&gt; filter doesn't look likely to work in that situation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone have any ideas how I could get around this?  &lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-07-28T12:05:54.170" Title="Is it possible to cache a faceted search form?" Tags="&lt;form&gt;&lt;cache&gt;&lt;search&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10709" PostTypeId="1" CreationDate="2015-07-24T21:10:10.340" Score="2" ViewCount="639" Body="&lt;p&gt;I installed craftcms on a regular .com root folder, and everything worked fine. I can go to .com/news and it will go to my /templates/news.html file, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my client wants their site on a subdirectory. I copied over all the files to the new subdirectory, but now when i go to .com/subdirectory/news, I get a 404 page. I checked that the .htaccess was correct, I just don't know what else I have to change to make the new site work on the new subdirectory. Please help! &lt;/p&gt;&#xA;" OwnerUserId="3906" LastActivityDate="2015-07-30T20:33:07.623" Title="I moved my craft site to a subdirectory, and things are broken now, help!" Tags="&lt;install&gt;&lt;redirect&gt;&lt;404&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10711" PostTypeId="2" ParentId="10707" CreationDate="2015-07-24T21:37:02.907" Score="5" Body="&lt;p&gt;You can't pass a JS variable into a JS file (that doesn't quite make sense). What you &lt;em&gt;can&lt;/em&gt; do is to &lt;em&gt;create&lt;/em&gt; a JS variable, and make it accessible to the script you are including.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd include your JS file as you are already doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile 'path/to/file' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you would create your variable, and &lt;strong&gt;in JavaScript&lt;/strong&gt; pass that variable back into the script which you called.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;{% includejs %}&#xA;    var myData = 'whatever your data needs to be';&#xA;    functionFromIncludedScript(myData);&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The snag you're going to run into here is, &lt;strong&gt;the order matters&lt;/strong&gt;. When you use Craft's &lt;code&gt;include&lt;/code&gt; methods, they will always include any &lt;em&gt;files&lt;/em&gt; before any &lt;em&gt;raw scripts&lt;/em&gt;. So using this method, your variable will be defined after the file has already been included.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It's important to note, the &quot;files before raw scripts&quot; will happen &lt;strong&gt;regardless&lt;/strong&gt; of which order you defined them in Twig.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Similarly, be aware that your file include and raw script include will both happen &lt;strong&gt;at the bottom of the page&lt;/strong&gt;, just before the closing &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now I'm going to make an assumption... You're about to say &quot;But I need my variable declared before the file is included!&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fair enough, and the solution is pretty simple. Just declare your JS variable &lt;strong&gt;in the middle of the page&lt;/strong&gt;, while you're rendering the main Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    var myData = 'whatever your data needs to be';&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So your variable declaration gets rendered along with the rest of your HTML, and your &lt;code&gt;includeJsFile&lt;/code&gt; still happens at the bottom of the page. By the time that file is included, your JS variable is sitting around waiting for it.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-24T21:37:02.907" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10714" PostTypeId="1" AcceptedAnswerId="10718" CreationDate="2015-07-25T17:54:43.837" Score="3" ViewCount="181" Body="&lt;p&gt;I have a case where I need to access a previous matrix field's value (if it exists) in the next matrix loop result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for contentBlock in entry.contentBlocks %}&#xA;    {% if contentBlock.prev %}&#xA;        {% if contentBlock.getPrev().matrixField | length %}&#xA;            {{ contentBlock.getPrev().matrixField }}&#xA;        {% endif %}&#xA;    {% endif &#xA;    ....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that my issue is with &lt;code&gt;{{ contentBlock.getPrev().matrixField }}&lt;/code&gt; but I am not sure how to access the field value after trying several methods.  I'm sure it's something simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-07-25T20:30:18.403" Title="How to access a previous matrix field value" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10715" PostTypeId="1" AcceptedAnswerId="10717" CreationDate="2015-07-25T17:56:05.200" Score="2" ViewCount="190" Body="&lt;p&gt;I'd like to set the screen_name for a list of tweets using Dukt Twitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The screen_name is set in an entry as a plain text field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('contactPage') %}&#xA;{% for entry in entries %}&#xA;{% if entry.twitterHandle|length %}&#xA;{% set tweets = craft.twitter.get(&quot;statuses/user_timeline.json?screen_name='~ entry.twitterHandle ~'&amp;amp;count=3&quot;) %}&#xA;    {% if tweets %}&#xA;      &amp;lt;h2&amp;gt;Recent Tweets&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;div class=&quot;tweets&quot;&amp;gt;&#xA;    {% for tweet in tweets %}&#xA;        &amp;lt;div class=&quot;tweet&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;text&quot;&amp;gt;{{ tweet.text|autoLinkTweet }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;date&quot;&amp;gt;{{ tweet.created_at|date('M j Y') }}&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h2&amp;gt;Recent Tweets&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;No recent tweets at this time.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not possible? No matter what I try, I only get the feed for the oauth user. Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="442" LastActivityDate="2015-07-25T20:23:47.273" Title="Passing a screen_name to Dukt Twitter" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10716" PostTypeId="1" CreationDate="2015-07-25T19:24:34.890" Score="1" ViewCount="128" Body="&lt;p&gt;i just started using craft on a local domain and i have some issues.&#xA;my stylesheet(a few files) are loaded using html&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;style/style.css&quot;&amp;gt;&lt;/code&gt;, and it works great for css and js files, but files requested from within the css aren't loading.&#xA;for example the Font Awesome @fontface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? and the is any issue using html instead of the {{ getHeadHtml() }} method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks Ahead!&lt;/p&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-08-13T11:26:38.260" Title="Issues loading files from within css files" Tags="&lt;css&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10717" PostTypeId="2" ParentId="10715" CreationDate="2015-07-25T20:23:47.273" Score="6" Body="&lt;p&gt;Accomplished this by setting the get request url, then passing it into tweets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handle = entry.twitterHandle %}&#xA;{% set url = 'statuses/user_timeline.json?screen_name=' ~ handle ~ '&amp;amp;count=3&amp;amp;exclude_replies=true' %}&#xA;{% set tweets = craft.twitter.get(url) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else. Thx!&lt;/p&gt;&#xA;" OwnerUserId="442" LastActivityDate="2015-07-25T20:23:47.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10718" PostTypeId="2" ParentId="10714" CreationDate="2015-07-25T20:30:18.403" Score="3" Body="&lt;p&gt;As it turns out, you must use bracketed and not dotted syntax for matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for contentBlock in entry.contentBlocks %}&#xA;    {% if contentBlock.prev %}&#xA;        {% if contentBlock.prev[matrixField] is defined %}&#xA;            {{ contentBlock.prev[matrixField] }}&#xA;        {% endif %}&#xA;    {% endif &#xA;    ....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fixed this issue for me :)&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-07-25T20:30:18.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10719" PostTypeId="1" AcceptedAnswerId="10720" CreationDate="2015-07-25T21:32:57.420" Score="3" ViewCount="103" Body="&lt;p&gt;I have a simple and maybe a stupid question, it´s my first Craft Website...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I´m listing  a news section, the news can be categorized ( max two categories ), and i don´t know how to show the category name in the news list items, the category field name is &quot;&lt;strong&gt;categoriaNot&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for blog in craft.entries.section('noticias').limit(10) %}&#xA;&#xA;    &amp;lt;!--inicia noticia--&amp;gt;&#xA;    &amp;lt;div class=&quot;item noticiaItem&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;noticiaImg&quot;&amp;gt;&#xA;            {% set imagen = blog.imagenNot.first() %}&#xA;&#xA;            {% if imagen %}&#xA;                &amp;lt;a href=&quot;{{ blog.url }}&quot; title=&quot;{{ blog.title }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ imagen.getUrl('thumb') }}&quot;  alt=&quot;&quot; class=&quot;img-responsive&quot;/&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endif %} &#xA;        &amp;lt;/div&amp;gt; &#xA;        &amp;lt;div class=&quot;noticiaTxtWrap&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;catNoticia&quot;&amp;gt;&#xA;                **** CATEGORY NAME HERE ****&#xA;            &amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;a class=&quot;tituloNoticia&quot; href=&quot;{{ blog.url }}&quot;&amp;gt; {{ blog.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;span class=&quot;dateNoticia&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-calendar&quot;&amp;gt;&amp;lt;/i&amp;gt; Publicado el: {{ blog.postDate.format('d.m.Y') }}&amp;lt;/span&amp;gt;&#xA;&#xA;            &amp;lt;span class=&quot;resumenNoticia&quot;&amp;gt;&#xA;                {{ blog.resumenNot }}&#xA;            &amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;!--finaliza noticia--&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help will be welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sebastián.&lt;/p&gt;&#xA;" OwnerUserId="3909" LastEditorUserId="57" LastEditDate="2015-07-25T22:00:14.340" LastActivityDate="2015-07-25T22:06:58.327" Title="Show the entry category, that´s it" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10720" PostTypeId="2" ParentId="10719" CreationDate="2015-07-25T22:06:58.327" Score="2" Body="&lt;p&gt;If I'm following you correctly, it should be as simple as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&quot;catNoticia&quot;&amp;gt;&#xA;    {% if blog.myCategoryFieldHandle|length %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for category in blog.myCategoryFieldHandle %}&#xA;                &amp;lt;li&amp;gt;{{ category.title }}&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-25T22:06:58.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10721" PostTypeId="1" AcceptedAnswerId="10733" CreationDate="2015-07-25T23:49:00.217" Score="2" ViewCount="70" Body="&lt;p&gt;I want to show some fields depending in the category selected for the entry but within the editing stage. is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, then how can i check if the entry is in a category in the template and output a field group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks ahead!&lt;/p&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-07-27T16:10:10.157" Title="Is it possible to assign fields to entries by category?" Tags="&lt;categories&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10722" PostTypeId="1" AcceptedAnswerId="10724" CreationDate="2015-07-26T20:26:55.290" Score="1" ViewCount="134" Body="&lt;p&gt;is it possible to change the name of the &quot;New Entry&quot; button? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case the user can add a new program part. And so the button should call &quot;New program&quot; or something like that.&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T23:39:07.703" LastActivityDate="2017-05-09T23:39:07.703" Title="Change name of &quot;New Entry&quot; button" Tags="&lt;control-panel&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10723" PostTypeId="2" ParentId="10722" CreationDate="2015-07-26T20:51:47.650" Score="0" Body="&lt;p&gt;I have a way to do this. But i think its not the best:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change line 21 and 31 in craft/app/templates/entries/index.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fear a new update will turn it back. But maybe not...&lt;/p&gt;&#xA;" OwnerUserId="3513" LastActivityDate="2015-07-26T20:51:47.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10724" PostTypeId="2" ParentId="10722" CreationDate="2015-07-26T21:04:07.007" Score="3" Body="&lt;p&gt;You can do this without hacking core files using Craft's &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;static translation&lt;/a&gt; support.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-26T21:04:07.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10725" PostTypeId="1" AcceptedAnswerId="10734" CreationDate="2015-07-27T06:09:25.913" Score="3" ViewCount="324" Body="&lt;p&gt;I am trying to write a console plugin for yiic so that I can import data programmatically from an old site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a multi configuration setup for the craft site. Is there an elegant way to tell yiic which configuration I am targeting (so that it opens the right database etc)?&lt;/p&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2016-05-14T08:47:54.160" Title="Elegant Way To Pass Configuration To yiic?" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10726" PostTypeId="2" ParentId="10705" CreationDate="2015-07-27T06:48:16.687" Score="1" Body="&lt;p&gt;If I understand things correctly, you have a matrix block &lt;code&gt;telephone&lt;/code&gt;, which contains a dropdown field &lt;code&gt;telephone.icon&lt;/code&gt;, and you want the value of the selected dropdown option. That value is &lt;code&gt;telephone.icon.value&lt;/code&gt; (which will be one of &lt;em&gt;mobile&lt;/em&gt;, &lt;em&gt;home&lt;/em&gt;, &lt;em&gt;work&lt;/em&gt;, or &lt;em&gt;other&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for telephone in user.profilePhone %}&#xA;  &amp;lt;li&amp;gt;&#xA;    {% if telephone.icon.value == 'mobile' %}&#xA;      &amp;lt;i class=&quot;fa fa-fw fa-mobile&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    {% elseif telephone.icon.value == 'home' %}&#xA;      &amp;lt;i class=&quot;fa fa-fw fa-home&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;i class=&quot;fa fa-fw fa-phone&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if telephone.country %}{{ telephone.country }}{% endif %}&#xA;    {{ telephone.number }}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-07-27T06:48:16.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10727" PostTypeId="1" CreationDate="2015-07-27T10:29:30.210" Score="0" ViewCount="618" Body="&lt;p&gt;I'm trying to understand how most people deal with this likely common issue, I've been looking around for answers, apologies if this is a subjective question, but I imagine there is a 'correct way' of doing this and I'm just missing something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding Craft is supposed to make implementation and management of content modules very simple, primarily through the use of Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to build a truly modular content management back end, where the user can add any predefined modules of content, and then reorder them with drag and drop, as far as I can see this will have to be done with a matrix field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a seemingly clumsy way of achieving this would be define a single matrix field which has all types of content module in as Block types. ie. 'Hero module', 'text columns', 'Latest clients', then in the admin the user adds this global matrix field and adds the required modules. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is the matrix field doesn't seem to be designed to be used like that. If I define a matrix field for the whole page, then a Block within is a module, and within each Block a field is say a title or an image; but if I want to add a position field that image, you can't go down another level - the position would be added to the module, or Block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I don't understand why it simply isn't possible to create several separate Matrix fields and then drag and drop order them in the page admin. Or any field for that matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, if you need further clarification I can mock up a diagram or something! And I'm on the Craft Slack if anyone would be rather reply on there :)&lt;/p&gt;&#xA;" OwnerUserId="3890" LastActivityDate="2015-08-14T20:03:21.850" Title="Is it possible to reorder fields with drag and drop?" Tags="&lt;matrix&gt;&lt;sections&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10728" PostTypeId="1" AcceptedAnswerId="10757" CreationDate="2015-07-27T10:39:59.797" Score="3" ViewCount="311" Body="&lt;p&gt;I have my image transforms set to crop centre-centre with quality 100, but for some reason the images that are rendered have a high change of having 1 or 2 pixels of white added to at least one set of parallel sides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See below for an example of what is being output (black background added after the fact for emphasis):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ph8aT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ph8aT.jpg&quot; alt=&quot;Example of issue&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original image was a JPG with no white border. As far as I can tell, the issue is most prevalent when trying to crop in only one direction. For example, the the image above should only be being cropped on the top and bottom, as the width of the original is the same as the width of the outputted image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else come across this issue? If so, is there a fix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Running locally on MAMP with PHP 5.6.10, using GD. Craft Pro 2.4.2679&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2015-08-11T08:26:08.453" Title="Image Transforms adding white to edges of image" Tags="&lt;image&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10729" PostTypeId="1" CreationDate="2015-07-27T11:28:28.353" Score="0" ViewCount="493" Body="&lt;p&gt;My pictures were not showing - even if everything looked great (files were available at the right place, template code was correct, ...). My first reaction was to check the htaccess file, but (see my answer below).&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-07-27T11:28:28.353" Title="Pictures (Assets) not showing (error 404)" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10730" PostTypeId="2" ParentId="10729" CreationDate="2015-07-27T11:28:28.353" Score="1" Body="&lt;p&gt;I called my directory &quot;icons&quot; (www.example.com/icons/) which was obviously not a good idea. After renaming the directory to &quot;img/icons&quot; it works perfect!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-07-27T11:28:28.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10731" PostTypeId="1" CreationDate="2015-07-27T14:03:13.920" Score="1" ViewCount="440" Body="&lt;p&gt;When i try to add an image in a bit of text, it does not show up. I get the assets model and can choose an image, but the image itself seems broken in the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also see this error in the craft.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/07/27 13:57:03 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /Applications/AMPPS/www/jipfish/craft/app/controllers/TemplatesController.php:59&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('entries/over/as...', Array)&#xA;#1 /Applications/AMPPS/www/jipfish/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /Applications/AMPPS/www/jipfish/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /Applications/AMPPS/www/jipfish/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /Applications/AMPPS/www/jipfish/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /Applications/AMPPS/www/jipfish/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /Applications/AMPPS/www/jipfish/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /Applications/AMPPS/www/jipfish/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /Applications/AMPPS/www/jipfish/craft/app/etc/web/WebApp.php(279): CWebApplication-&amp;gt;processRequest()&#xA;#9 /Applications/AMPPS/www/jipfish/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /Applications/AMPPS/www/jipfish/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /Applications/AMPPS/www/jipfish/index.php(19): require_once('/Applications/A...')&#xA;#12 {main}&#xA;REQUEST_URI=/jipfish/admin/entries/over/assets/article/bolderkar_01.jpg&#xA;HTTP_REFERER=http://localhost/jipfish/admin/entries/over/5-about&#xA;---&#xA;2015/07/27 13:57:03 [error] [application] &#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyobe know what is up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Bob&lt;/p&gt;&#xA;" OwnerUserId="3829" LastEditorUserId="643" LastEditDate="2015-07-27T15:00:26.133" LastActivityDate="2015-07-27T15:00:26.133" Title="Image not showing up in Redactor text editor" Tags="&lt;redactor&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10732" PostTypeId="1" CreationDate="2015-07-27T16:06:30.263" Score="2" ViewCount="123" Body="&lt;p&gt;Is it possible to do anything with Craft's &lt;code&gt;getPhotoUrl()&lt;/code&gt; function to allow images to be processed in a similar way like assets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example for our profile photos I'd like them to be returned 45x45 cropped from centre. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently if a user were to upload a landscape photo they would see something like 45x25 because the height isn't being maintained.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="1128" LastEditorUserId="57" LastEditDate="2015-07-27T18:06:37.220" LastActivityDate="2015-07-27T18:11:17.997" Title="create a fixed height and width for profile photos" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10733" PostTypeId="2" ParentId="10721" CreationDate="2015-07-27T16:10:10.157" Score="1" Body="&lt;p&gt;Could you use the entry types to achieve the same thing?&#xA;&lt;a href=&quot;https://buildwithcraft.com/features/entry-types&quot; rel=&quot;nofollow&quot;&gt;https://buildwithcraft.com/features/entry-types&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1128" LastActivityDate="2015-07-27T16:10:10.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10734" PostTypeId="2" ParentId="10725" CreationDate="2015-07-27T17:22:07.753" Score="2" Body="&lt;p&gt;If you use the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-environment&quot; rel=&quot;nofollow&quot;&gt;CRAFT_ENVIRONMENT&lt;/a&gt; PHP constant at the beginning of &lt;code&gt;yiic.php&lt;/code&gt;, then you'll be able to tell it which multi-environment config to use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_ENVIRONMENT', 'dev');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-27T17:22:07.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10735" PostTypeId="2" ParentId="10732" CreationDate="2015-07-27T18:11:17.997" Score="2" Body="&lt;p&gt;Kind of.  They currently aren't technically true &quot;Assets&quot; like in the rest of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most you can do is pass in a size to the method &lt;code&gt;getPhotoUrl(45)&lt;/code&gt; and you'll get a 45 x 45 square result back.  I believe it will crop from the center only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have plans for Craft 3 so they'll be treated like 1st class Assets and you'll be able to perform transforms on them like any other Asset.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-27T18:11:17.997" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10736" PostTypeId="2" ParentId="2204" CreationDate="2015-07-27T23:41:42.573" Score="4" Body="&lt;p&gt;For anyone looking for more information, you can find all of the form macros for _includes/forms here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/app/templates/_includes/forms.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the child templates here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/app/templates/_includes/forms/&amp;lt;filename&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2015-07-27T23:41:42.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10737" PostTypeId="1" CreationDate="2015-07-28T07:23:07.700" Score="2" ViewCount="110" Body="&lt;p&gt;I'm trying to create some relational tables from 2 records but I keep getting the mysql error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1005 Can't create table 'craft1.#sql-75c_603' (errno: 150)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship is between 2 tables: quote and quotedItem. I based the code off the relationship seen here: &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.arr&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/doc/guide/1.1/en/database.arr&lt;/a&gt; between the Post and User tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tables create fine without the relationship defined (I've also noticed they create with the relationship but I also get the above mysql error when installing the plugin so I presume it hasn't worked correctly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to making plugins so there's probably something obvious I'm doing wrong but if someone could point me in the right direction that would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code for quoted Item: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ShoppingCart_QuotedItemRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'shoppingcart_quoteditems';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'quoteId' =&amp;gt; AttributeType::String,&#xA;            'itemId' =&amp;gt; AttributeType::String,&#xA;            'quantity' =&amp;gt; AttributeType::String&#xA;        );&#xA;    }&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'quote' =&amp;gt; array(static::BELONGS_TO, 'ShoppingCart_QuoteRecord', 'quoteId'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's quote:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ShoppingCart_QuoteRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'shoppingcart_quotes';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'title' =&amp;gt; AttributeType::String,&#xA;            'country' =&amp;gt; AttributeType::String,&#xA;            'name' =&amp;gt; AttributeType::String,&#xA;            'email' =&amp;gt; AttributeType::String,&#xA;            'company' =&amp;gt; AttributeType::String,&#xA;            'phone' =&amp;gt; AttributeType::String,&#xA;            'department' =&amp;gt; AttributeType::String,&#xA;            'reference' =&amp;gt; AttributeType::String,&#xA;            'questions' =&amp;gt; AttributeType::String&#xA;        );&#xA;    }&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'quotedItems' =&amp;gt; array(static::HAS_MANY, 'ShoppingCart_QuotedItemsRecord', 'quoteId'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3913" LastActivityDate="2015-07-28T13:32:02.413" Title="Mysql error when defining related tables" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;relations&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10738" PostTypeId="2" ParentId="10708" CreationDate="2015-07-28T11:59:08.350" Score="4" Body="&lt;p&gt;There're various ways of doing this. The simplest would be to just use the submitted slugs to generate a new cache key for each different search, like Jamie suggests. This is a very straightforward and readable solution, which in most cases would probably yield a &quot;good enough&quot; performance boost. You'd simply create a key based on the params that are used in your cached content, so something like (could be made a bit less verbose if you prefer):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submittedTypesArray = craft.request.getParam('type') %}&#xA;{% set submittedTypesString = submittedTypesArray | join('-') %}&#xA;&#xA;{% cache using key &quot;restaurant-filter-type-&quot; ~ submittedTypesString %}&#xA;    {% set typeList = craft.categories.group('restaurantType') %}&#xA;&#xA;    {% for type in typeList %}&#xA;        &amp;lt;div class=&quot;field field--checkbox&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;type[]&quot; id=&quot;{{ type.slug }}&quot; value=&quot;{{ type.slug }}&quot;{% if type.slug in submittedTypesArray %} checked{% endif %}&amp;gt;&#xA;            &amp;lt;label for=&quot;{{ type.slug }}&quot;&amp;gt;{{ type.title }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The backdraw of this solution is that it generates one cache entry for every different combination of the types. If this is &quot;good enough&quot; depends on your project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use the approach naboovalley describes in the linked answer, here is a rewrite for your usecase:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set typeCategories %}&#xA;    {% cache using key &quot;restaurant-filter-type&quot; %}&#xA;        {% set typeList = craft.categories.group('restaurantType') %}&#xA;&#xA;        {% for type in typeList %}&#xA;            &amp;lt;div class=&quot;field field--checkbox&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; name=&quot;type[]&quot; id=&quot;{{ type.slug }}&quot; value=&quot;{{ type.slug }}&quot; data-type-{{ type.slug }}&amp;gt;&#xA;                &amp;lt;label for=&quot;{{ type.slug }}&quot;&amp;gt;{{ type.title }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&#xA;{% set types = craft.request.getParam('type') %}    &#xA;{% for type in types %}&#xA;    {% set typeCategories = typeCategories | replace('data-type-' ~ type, 'checked')  %}&#xA;{% endfor %}&#xA;&#xA;{{ typeCategories }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be possible to do this with several category groups inside one variable/cache entry, but you'd have to give them different data-names to make sure that you don't run into problems if two categories in different groups have the same slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there's a wicked elegant way to do the replace without the for loop, I just couldn't wrap my head around it right now. ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, just to add more options, if this was a really high traffic site (or the server that hosts the site is really crappy), I'd actually update the status of the checkboxes with javascript on the client, instead of doing it with Craft. Even though it would maybe annoy a user that has javascript turned off and has to check all the checkboxes for every search, nothing would break. And you can't beat the performance of doing something on the client instead of on the server.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-07-28T12:05:54.170" LastActivityDate="2015-07-28T12:05:54.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10739" PostTypeId="1" AcceptedAnswerId="10740" CreationDate="2015-07-28T12:53:31.343" Score="1" ViewCount="140" Body="&lt;p&gt;I am using Michael Rog's Calendar plug-in and am trying to pass the calendar ID to an include.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parent template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/_calendar' with {'calendarId': '1'} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_includes/_calendar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    calendarId: '{{ id }}',&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: '+36 months'&#xA;} %}&#xA;&#xA;{% for entry in craft.calendars.eventData(params).events %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;time&amp;gt;{{ entry.startDate  | date(&quot;D d M&quot;) }}&amp;lt;/time&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ entry.element.title }}&amp;lt;/h3&amp;gt;&#xA;        {{ entry.element.eventDescription }}&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not getting any results for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the params to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    calendarId: '1',&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: '+36 months'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the results for the correct calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used includes with variables like this before. Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="3337" LastActivityDate="2015-07-28T12:59:31.183" Title="How to pass Calendar ID to include" Tags="&lt;variable&gt;&lt;include&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10740" PostTypeId="2" ParentId="10739" CreationDate="2015-07-28T12:59:31.183" Score="2" Body="&lt;p&gt;Two things, the variable you send in is called calendarId, not id. Also, inside twig code (like the set function), you don't use twig tags, just the variables directly. Try to change the params object to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    calendarId: calendarId,&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: '+36 months'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-28T12:59:31.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10741" PostTypeId="2" ParentId="10737" CreationDate="2015-07-28T13:32:02.413" Score="1" Body="&lt;p&gt;Ok, so I figured it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason it fails to create the tables is because the foreign key has to be of the same type as the primary key it's relating to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I just changed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'quoteId' =&amp;gt; AttributeType::String,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'quoteId' =&amp;gt; AttributeType::Number,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it worked!&lt;/p&gt;&#xA;" OwnerUserId="3913" LastActivityDate="2015-07-28T13:32:02.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10742" PostTypeId="1" CreationDate="2015-07-28T14:29:13.047" Score="0" ViewCount="1134" Body="&lt;p&gt;I have included the navigation using Bootstrap 3 navbar. It is put together using Craft entries. I need the 'What we do' dropdown to be triggered when pressing the text or caret arrow but at the minute they are displaying as two different menu li as shown.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('navigation') %}&#xA;&#xA;&amp;lt;nav class=&quot;navbar navbar-default navbar-fixed-top&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;navbar-header&quot;&amp;gt;&#xA;            &amp;lt;button type=&quot;button&quot; class=&quot;navbar-toggle collapsed&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse-ptm&quot; aria-expanded=&quot;false&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;sr-only&quot;&amp;gt;Toggle navigation&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/button&amp;gt;&#xA;            &amp;lt;a class=&quot;navbar-brand&quot; href=&quot;/&quot;&amp;gt;&amp;lt;img src=&quot;{{ siteUrl }}assets/images/logo.png&quot; width=&quot;300px;&quot; alt=&quot;PTM Calibration Logo&quot;/&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;collapse navbar-collapse navbar-right&quot; id=&quot;collapse-ptm&quot;&amp;gt;&#xA;            {% nav entry in entries %}&#xA;&#xA;            &amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; {% ifchildren %}&#xA;                    &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot; role=&quot;button&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&amp;gt;&amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                        {% endifchildren %}&#xA;                    &amp;lt;/li&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;!-- /.navbar-collapse --&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- /.container-fluid --&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iGqJl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iGqJl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3917" LastEditorUserId="125" LastEditDate="2015-07-29T05:23:18.673" LastActivityDate="2015-07-29T12:27:49.923" Title="Bootstrap 3 Navbar dropdown problem" Tags="&lt;templating&gt;&lt;entries&gt;&lt;structure&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10743" PostTypeId="1" CreationDate="2015-07-28T16:01:47.067" Score="1" ViewCount="707" Body="&lt;p&gt;we have a problem over and over again and I wonder if we're missing something. &#xA;Using bootstrap we have a matrix field, let's call it Grid, that has blocks like &quot;full column&quot; &quot;half column&quot; etc. It's extremely usable across all pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the issue is we can have only one such matrix per template. And a standard page looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[some title]&#xA;[some grid] &amp;lt;- Grid&#xA;[some hero image]&#xA;[again some grid] &amp;lt;- Grid&#xA;[some other stuff]&#xA;[even more grid at the end!] &amp;lt;- Grid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only solution is to create yet another Grid field that uses the same twig code for rendering only to use it again on the same side. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution would be a way to put a field in an entry type but with ability to manually set the handle. So we could put the same field (Grid) and refer to them using topGrid, middleGrid and bottomGrid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to solve this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&#xA;Jan&lt;/p&gt;&#xA;" OwnerUserId="3873" LastActivityDate="2015-07-28T22:17:15.993" Title="Using a field multiple times in a single template" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;field&gt;&lt;field-layout-designer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10744" PostTypeId="1" CreationDate="2015-07-28T16:51:30.203" Score="1" ViewCount="116" Body="&lt;p&gt;I have a custom fieldtype that I have built in a plugin. I want to validate these fields inside of field settings when data is added. I saw there was a &lt;code&gt;getErrors&lt;/code&gt; method in the model however I am unsure on how to post errors to this field settings page. Can anyone point me in the right direction for what method I should be doing this in so that you cant save unless these fields validate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3918" LastEditorUserId="57" LastEditDate="2015-07-28T17:35:19.383" LastActivityDate="2015-07-28T17:35:19.383" Title="Custom Drop Down Field Type Validation" Tags="&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10745" PostTypeId="2" ParentId="10659" CreationDate="2015-07-28T17:38:23.507" Score="2" Body="&lt;p&gt;I don't think this is possible using &lt;code&gt;formattingAdd&lt;/code&gt;.  From Redactor's &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;formattingAdd can only be applied to p, pre, blockquote and header tags.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-28T17:38:23.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10746" PostTypeId="1" AcceptedAnswerId="10747" CreationDate="2015-07-28T17:47:09.900" Score="1" ViewCount="361" Body="&lt;p&gt;As a follow-up to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5067/how-to-use-plugin-settings&quot;&gt;this&lt;/a&gt; thread, I would like to know how to create custom validation rules for plugin settings, or at least how to return field errors to the plugin settings view. I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class SamplePlugin extends BasePlugin {&#xA;&#xA;    function getName() { ... }&#xA;    function getVersion() { ... }&#xA;    function getDeveloper() { ... }&#xA;    function getDeveloperUrl() { ... }&#xA;&#xA;    public function getSettingsHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('sample/settings', [&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;        ]);&#xA;    }&#xA;&#xA;    public function prepSettings($settings)&#xA;    {&#xA;        // I'm currently doing my 'custom' validation here. But if&#xA;        // there's an error, how do I display errors on the settings page?&#xA;&#xA;        return $settings;&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        // Tried this, but since SamplePlugin isn't a Model, it does nothing.&#xA;    }&#xA;&#xA;    protected function defineSettings()&#xA;    {&#xA;        return [&#xA;            'mySetting' =&amp;gt; [&#xA;                AttributeType::String,&#xA;                'required' =&amp;gt; true,&#xA;                // Can custom validation rules be set here?&#xA;            ]&#xA;        ];&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3750" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-07-28T18:26:11.270" Title="Custom validation for plugin settings" Tags="&lt;plugin-development&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10747" PostTypeId="2" ParentId="10746" CreationDate="2015-07-28T18:26:11.270" Score="3" Body="&lt;p&gt;The solution provided &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10162/how-can-i-add-custom-validation-rules-to-my-plugin-settings&quot;&gt;here&lt;/a&gt; actually required some adjustments. Here is what ended up working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;craft/plugins/sample/SamplePlugin.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class SamplePlugin extends BasePlugin {&#xA;&#xA;    function getName() { ... }&#xA;    function getVersion() { ... }&#xA;    function getDeveloper() { ... }&#xA;    function getDeveloperUrl() { ... }&#xA;&#xA;    public function getSettingsHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('sample/settings', [&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;        ]);&#xA;    }&#xA;&#xA;    protected function getSettingsModel()&#xA;    {&#xA;        return new Sample_SettingsModel();&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;craft/plugins/sample/models/Sample_SettingsModel.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class Sample_SettingsModel extends BaseModel {&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return [&#xA;            'mySetting' =&amp;gt; [&#xA;                AttributeType::String,&#xA;                'required' =&amp;gt; true&#xA;            ]&#xA;        ];&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;        $rules[] = ['mySetting', 'validateMySetting'];&#xA;&#xA;        return $rules;&#xA;    }&#xA;&#xA;    public function validateMySetting($attribute)&#xA;    {&#xA;        $value = $this-&amp;gt;$attribute;&#xA;&#xA;        if ( /* validation condition */) {&#xA;            $message = Craft::t(&quot;Error message&quot;);&#xA;            $this-&amp;gt;addError($attribute, $message);&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3750" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-28T18:26:11.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10748" PostTypeId="2" ParentId="10659" CreationDate="2015-07-28T21:01:14.007" Score="6" Body="&lt;p&gt;If you only want to style how the link looks visually, and need a work-around, you could use my &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft&quot; rel=&quot;noreferrer&quot;&gt;Redactor Styles for Craft&lt;/a&gt; plugin. If you add an inline style to the plugins Styles JSON object like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;btnName&quot;:&quot;Action button&quot;, &#xA;    &quot;className&quot;:&quot;btn-action&quot;, &#xA;    &quot;spanClass&quot;:&quot;btn-action&quot;&#xA;  }&#xA;] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on which order the user creates the link and marks the text/link and select style, you now can get the following markup from your rich text field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&quot;btn-action&quot;&amp;gt;&amp;lt;a href=&quot;http://loremipsum.net&quot;&amp;gt;A link&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&amp;lt;a href=&quot;http://loremipsum.net&quot;&amp;gt;&amp;lt;span class=&quot;btn-action&quot;&amp;gt;A link&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this works for you or not depends on your design. Unless there are some styles on the  that can't be removed, you could style it so that it looks the same by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.btn-action &amp;gt; a,&#xA;a &amp;gt; .btn-action { ... }  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also instruct your users to always create the link, then select the style, or the other way around. But, it's of course a very fragile solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking of making a new plugin just for creating more advanced links, the built in one doesn't really cut it.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-07-28T21:27:24.213" LastActivityDate="2015-07-28T21:27:24.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10750" PostTypeId="2" ParentId="10743" CreationDate="2015-07-28T22:17:15.993" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The only solution is to create yet another Grid field that uses the same twig code for rendering only to use it again on the same side.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do you need to enforce that structure or is it a &quot;soft&quot; restriction (meaning things won't go south if the blocks get turned around)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were me, I would treat Matrix more or less like a site builder.  &lt;code&gt;[some hero image]&lt;/code&gt; and &lt;code&gt;[other stuff]&lt;/code&gt; could also be blocks in that matrix, alongside &lt;code&gt;full column&lt;/code&gt; and &lt;code&gt;half column&lt;/code&gt;, you just need the appropriate code to &quot;close up&quot; the grid when necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would have different blocks (like Grid, Hero Unit, Ad space, etc.) and then when building the page, just insert them in the appropriate spots. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the canonical use of Matrix of course. If you need full control over how things are presented you don't necessarily have to build out the page in the order the blocks appear in. If you name various blocks you could filter by block type and then spit out only the blocks that would appear in that area. For example, even if there is only one hero unit, you can specify it should only appear once and then spit out the hero where it needs to go (say at the top).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're doing this for a client, it might be helpful to number the blocks so they put the blocks in the intended order to avoid surprises but with matrix it's pretty open ended which might be less likely what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally we should be able to have some &quot;default&quot; blocks and lock 'em in place so they can't be moved or disabled... maybe in a &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;future version&lt;/a&gt; of Craft.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-07-28T22:17:15.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10751" PostTypeId="2" ParentId="2077" CreationDate="2015-07-29T06:07:21.343" Score="4" Body="&lt;p&gt;Your interpretation of why you're getting duplicate columns when looping your  your table field is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each column &lt;em&gt;is always&lt;/em&gt; accessible via a automatically generated column handle (&lt;code&gt;col1&lt;/code&gt;, &lt;code&gt;col2&lt;/code&gt;, etc.), so that's not old and left over column names you're seeing there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you define custom handles in the Table field's settings, the cells' data will  be available via those properties as well, so you can then access the value via both &lt;code&gt;row.price&lt;/code&gt; and &lt;code&gt;row.col1&lt;/code&gt;. This feature is designed with direct access of columns / cells in mind, but gets in the way when looping through a row's cells. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Craft doesn't force you to define custom handles, so you can simply remove them in your field's settings and your &quot;old data&quot; will be removed.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-29T06:07:21.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10752" PostTypeId="1" AcceptedAnswerId="10769" CreationDate="2015-07-29T08:17:49.673" Score="2" ViewCount="1991" Body="&lt;p&gt;I have a client who requires more advanced formatting options than the current Redactor editor provides, like editing table cells, merging cells, background colors, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plan is to integrate CKEditor into Craft as a custom field type and a plugin - and basically switch out the current limited editor with CKEditor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has no one else needed a more advanced editor than the stock?  Am I heading down the wrong path?&lt;/p&gt;&#xA;" OwnerUserId="3919" LastEditorUserId="57" LastEditDate="2015-08-01T05:35:01.953" LastActivityDate="2017-04-10T03:49:53.843" Title="Craft WYSIWYG editor and CKEditor" Tags="&lt;redactor&gt;&lt;editor&gt;&lt;wysiwyg&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10753" PostTypeId="2" ParentId="10742" CreationDate="2015-07-29T08:31:32.307" Score="2" Body="&lt;p&gt;If i'm understanding this correctly, it looks like you just have your loop starting a little early in the markup, so at the moment you are creating a new &lt;code&gt;&amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&lt;/code&gt; item for every entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does moving the &lt;code&gt;{% nav entry in entries %}&lt;/code&gt; loop within the first &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; help at all? like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA; {% nav entry in entries %}&#xA;     &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;           &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;             &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot; role=&quot;button&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&amp;gt;&amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;              &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;               {% children %}&#xA;              &amp;lt;/ul&amp;gt;&#xA;           &amp;lt;/li&amp;gt;&#xA;        {% endifchildren %}&#xA;     &amp;lt;/li&amp;gt;&#xA; {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additionally&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst writing this answer out I noticed that your &lt;code&gt;{% endifchildren %}&lt;/code&gt; tag comes before a closing &lt;code&gt;&amp;lt;/li&amp;gt;&lt;/code&gt; tag, so it might just be that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;  &amp;lt;li&amp;gt;&#xA;     &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;     {% ifchildren %}&#xA;       &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;         &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot; role=&quot;button&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&amp;gt;&amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;           &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;              {% children %}&#xA;           &amp;lt;/ul&amp;gt;&#xA;          {# endifchildren was originally here #}&#xA;        &amp;lt;/li&amp;gt;&#xA;     {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-07-29T08:39:22.483" LastActivityDate="2015-07-29T08:39:22.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10755" PostTypeId="2" ParentId="10742" CreationDate="2015-07-29T12:27:49.923" Score="2" Body="&lt;p&gt;I'm viewing this on a phone on a plane right now (forgive the terrible explanation), but it looks like your &lt;code&gt;&amp;lt;li class=&quot;dropdown&quot;&amp;gt;&lt;/code&gt; is being toggled on the children. The .dropdown class needs to be added on the parent  &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; item. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it is being toggled on the first child, that is why your caret is being rendered as a separate nav link.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-07-29T12:27:49.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10756" PostTypeId="1" AcceptedAnswerId="10771" CreationDate="2015-07-29T13:16:51.257" Score="0" ViewCount="84" Body="&lt;p&gt;I am writing a console plugin to import a load of gallery images from an old site into a new craft site. I need to create folders in the assets area, import the images, then create custom entries to represent the galleries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hitting a hurdle at the first task, creating a folder. It fails with a general message like &quot;Error creating folder&quot;. I assume it's because I am not &quot;logged in&quot; and therefore have no permission to create the assets folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried to do a &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;loginByUserId(1)&lt;/code&gt; but I got the complaint about no ip address or user agent string. I checked the code and saw that there is a config item to turn this check off, but the method &lt;code&gt;loginByUserId()&lt;/code&gt; doesn't use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to force a login from a console plugin so that I can do privileged operations?&lt;/p&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2015-07-30T05:31:35.113" Title="&quot;Logging In&quot; From a Console Plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10757" PostTypeId="2" ParentId="10728" CreationDate="2015-07-29T13:28:20.087" Score="1" Body="&lt;p&gt;As @BradBell says, using Imagick fixed this for me.&lt;br&gt;&#xA;Following &lt;a href=&quot;https://stackoverflow.com/a/16154605/662826&quot;&gt;https://stackoverflow.com/a/16154605/662826&lt;/a&gt; I uncommented the Imagick extension, reuploaded and the compression was much better and white line gone.&lt;/p&gt;&#xA;" OwnerUserId="3890" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-07-29T13:28:20.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10758" PostTypeId="2" ParentId="10752" CreationDate="2015-07-29T14:51:04.630" Score="2" Body="&lt;p&gt;From my experience, I try to strip out as much formatting options as I can from any wysiwyg editor. Otherwise you'll end up with large, purple text with a red background (or some other crazy style the client thinks looks good).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the client wants to construct a table - then alter the table along with the graphics etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;matrix field&lt;/a&gt;, then within that have a block for the &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;rich text area&lt;/a&gt;, then another block that is of &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow&quot;&gt;type table&lt;/a&gt;? I'm not 100% on what capabilities that the table field type has. That should allow them to create the table and work with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would then have some sort of pre-defined css that took over for them, rather than giving the client free reign on the design.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-07-29T14:51:04.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10759" PostTypeId="2" ParentId="10752" CreationDate="2015-07-29T14:58:58.110" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Am I heading down the wrong path?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you gotta ask that question, sometimes it's a self-fullilling prophecy! ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the big reasons people use Craft is it does a great job of separating &lt;em&gt;content&lt;/em&gt; from layout, which is becoming important when trying to build for all types of screens as Damon also alluded to in &lt;a href=&quot;https://craftcms.stackexchange.com/a/10758/1016&quot;&gt;his answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tables are tough. I try to avoid them if possible because they can break mobile layouts and a lot of clients still want to use them for presentation instead of what they're intended for... tabular content. When I get a request like this from a client, I always look &lt;em&gt;why&lt;/em&gt; the client asking for more advanced table fuctionality. Is there something else we can do to fulfill that request that Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;built-in table field&lt;/a&gt; can't handle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kinds of table content are they needing to create? You might want to look at &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt;. That gives you a fighting chance of having the client enter their content while still having some control over the design. It's a bit like souped up Matrix field but designed with tables in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going the opposite direction, Redactor also has a very simple &lt;a href=&quot;http://imperavi.com/redactor/plugins/table/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Table plugin&lt;/a&gt; too. It likely won't work in your case but it can do the job for simple, one-off tables, depending on the client's use case. (For example you can get the table started for them and if it needs changes, they can pop those in).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-07-29T15:22:21.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10760" PostTypeId="2" ParentId="10443" CreationDate="2015-07-29T16:44:41.683" Score="1" Body="&lt;p&gt;The OP was running an older version of Craft. Resolved the issue by updating to the latest.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-29T16:44:41.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10761" PostTypeId="1" AcceptedAnswerId="10762" CreationDate="2015-07-29T17:08:47.023" Score="3" ViewCount="263" Body="&lt;p&gt;My client has a private Craft site only accessible to their employees. To access the site they all use the same username and password on a front-end login form. They are now wanting to link to this site from their intranet and have the username and password form values auto-populated (only when accessed from the intranet). I have come up with a way using a Craft route (example.com/login/user/username/password/actualpassword) and craft.request.segment to auto-populate the form input values. This works but I was wondering if anyone else has a solution that doesn't require the password being in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2240" LastActivityDate="2015-08-03T11:25:21.723" Title="Auto-populate login form when accessed via client intranet" Tags="&lt;form&gt;&lt;login&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10762" PostTypeId="2" ParentId="10761" CreationDate="2015-07-29T17:30:39.347" Score="3" Body="&lt;p&gt;Couldn't you set the password to a variable on the login page if it is the correct intranet url?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getUrl() == &quot;intranet.net&quot; %}&#xA; {% set pass = &quot;password&quot; %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;input type=&quot;password&quot; value=&quot;{{ pass|default('') }} name=&quot;password&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-07-29T17:39:07.010" LastActivityDate="2015-07-29T17:39:07.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10763" PostTypeId="1" CreationDate="2015-07-29T18:32:33.210" Score="1" ViewCount="456" Body="&lt;p&gt;We are setting our Cache-Control headers in the layout file for all templates.  However some templates the Cache-Control is being overridden.  Why might this be?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expiry = now|date_modify('+10 minutes') %}&#xA;{% header &quot;Cache-Control: max-age=&quot; ~ (expiry.timestamp - now.timestamp) %}&#xA;{% header &quot;Pragma: cache&quot; %}&#xA;{% header &quot;Expires: &quot; ~ expiry|date('D, d M Y H:i:s', 'GMT') ~ &quot; GMT&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-07-29T18:32:33.210" Title="Set Cache-Control is being overridden" Tags="&lt;cache&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10764" PostTypeId="1" AcceptedAnswerId="10803" CreationDate="2015-07-29T18:57:27.313" Score="2" ViewCount="246" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; Emails only send out when you're not logged in as admin from the registration form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No errors received in dev mode, user created, but no activation email sent. Definitely not getting passed to Mandrill as &lt;a href=&quot;https://www.obdev.at/products/littlesnitch&quot; rel=&quot;nofollow&quot;&gt;Little Snitch&lt;/a&gt; checks outgoing connections.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The weird thing is, user activation from the admin &lt;strong&gt;does&lt;/strong&gt; send an activation email.&lt;/li&gt;&#xA;&lt;li&gt;Verify email addresses? in &lt;code&gt;system &amp;gt; users&lt;/code&gt; is selected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It should send an activation email out, right? Or are you supposed to activate every new user via admin?&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="3888" LastEditDate="2015-07-31T16:41:46.517" LastActivityDate="2015-07-31T16:46:50.967" Title="Mandrill integration not sending email for front-end registration form" Tags="&lt;form&gt;&lt;emails&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10765" PostTypeId="1" AcceptedAnswerId="10802" CreationDate="2015-07-29T19:22:23.773" Score="2" ViewCount="221" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; For anyone else having a braindead moment, registration form errors only display for &lt;code&gt;password&lt;/code&gt; when logged out. If you're logged in as admin they won't display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User posted even though using an empty password. According to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3060/what-password-requirements-exist-for-new-users&quot;&gt;this post&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;this form template&lt;/a&gt; an empty password box (or less than 6 characters) should fail and return an error yes?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid-item 1/1&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-item xs-1/1 md-1/3 mb&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;form-label&quot; for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; class=&quot;form-input&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;      &amp;lt;small&amp;gt;6 characters or more — keep it secret, keep it safe.&amp;lt;/small&amp;gt;&#xA;&#xA;          {% if account is defined %}&#xA;            {{ errorList(account.getErrors('password')) }}&#xA;          {% endif %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;input class=&quot;btn btn-primary&quot; type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Screenshots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iLqvJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iLqvJ.png&quot; alt=&quot;No error messages&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/syaRY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/syaRY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-07-31T16:44:44.003" Title="Password should fail on front-end registration form" Tags="&lt;error-message&gt;&lt;error&gt;&lt;registration&gt;&lt;password&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10766" PostTypeId="1" AcceptedAnswerId="10767" CreationDate="2015-07-29T20:17:51.627" Score="4" ViewCount="249" Body="&lt;p&gt;I have a string in my plugin that contains environment variables. How can I parse them the same way Craft does?&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-29T20:17:51.627" Title="How can I parse environment variables in a string?" Tags="&lt;plugin-development&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10767" PostTypeId="2" ParentId="10766" CreationDate="2015-07-29T20:17:51.627" Score="4" Body="&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;parseEnvironmentString($string)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-07-29T20:17:51.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10768" PostTypeId="2" ParentId="4981" CreationDate="2015-07-29T20:18:19.750" Score="2" Body="&lt;p&gt;If you make your own plugin, you can check the number of entries in a section before saving it using &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;events&lt;/a&gt;. Following code would go in your main plugin file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;section = 'mySection';&#xA;        $criteria-&amp;gt;status = 'null';&#xA;        $myEntries = $criteria-&amp;gt;find();&#xA;&#xA;        if (count($myEntries) &amp;gt; 99) {&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could add an admin or permissions check if an admin should be able to add 101 entries.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastActivityDate="2015-07-29T20:18:19.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10769" PostTypeId="2" ParentId="10752" CreationDate="2015-07-29T22:27:20.033" Score="2" Body="&lt;p&gt;Thanks guys - yes I'm fully aware of the downfall of letting clients run free with the editor, and we've had discussions internally about tables &amp;amp; trying to stop the client from using them but in this particular case there's a real need for an editor which is more fully featured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am however looking for a solution, and CKEditor seems like the best.  I've looked at the likes of Super Table and the matrix options but they don't provide the ability to edit content inline like we need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I asked the original question I was hoping that there was more featured wysiwyg plugin out there, or perhaps extra config options on redactor which I had missed, but unfortunately it seems this isn't the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime I've gone down the route of integrating CKEditor and it looks promising, I'll post back here with some 'learnings' later today once I've finished testing the new plugin &amp;amp; custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those who are interested, I've integrated CKEditor into the site I'm working on.  The process was relatively painless and look just a few hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I created a new craft plugin which consists of a Custom Field Type and a Template&lt;/li&gt;&#xA;&lt;li&gt;The template is simple, just includes the Textarea for displaying on the page&lt;/li&gt;&#xA;&lt;li&gt;I then queue in the CKEditor javascript files, and my own custom JS file which triggers the CKEDITOR.replace function&lt;/li&gt;&#xA;&lt;li&gt;I then wanted the Image button on the toolbar to link to the Craft asset dialoog, so I copied the Image dialog code from the RichText plugin and added it to CKEditor as a new plugin, then added a custom button to the editor toolbar&lt;/li&gt;&#xA;&lt;li&gt;I noticed that the current/old Body text from Craft referred to asset:url in the output for images rather than image paths, so I created a RegEx to display these correctly; this regex runs in the prepValue() function of the custom field&lt;/li&gt;&#xA;&lt;li&gt;I didnt need a prepValuePost() function&lt;/li&gt;&#xA;&lt;li&gt;And then on my website pages, {{ entry.body }} was outputting escaped HTML characters, so I adjusted this to {{ entry.body|raw }}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The end result is pretty good, works well and was surprisingly quick to implement.&lt;/p&gt;&#xA;" OwnerUserId="3919" LastEditorUserId="3919" LastEditDate="2015-08-01T03:28:48.713" LastActivityDate="2015-08-01T03:28:48.713" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10770" PostTypeId="2" ParentId="10698" CreationDate="2015-07-30T02:19:41.063" Score="8" Body="&lt;p&gt;My recommendation is to match the slugs as opposed to the ids as this is much easier to debug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;slide-in&quot;&amp;gt; &#xA;    {% nav menu in craft.entries.section('mainMenu') %}&#xA;        DEBUG: Entry.slug={{ entry.slug }} &#xA;        DEBUG: menu.slug={{ menu.slug }} &#xA;        &amp;lt;li class=&quot;{{ menu.slug == entry.slug ? 'active' }}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ menu.menuLink[0].url }}&quot;&amp;gt;{{ menu.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then obviously remove the debug lines once everything is working as intended :)&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-07-30T02:19:41.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10771" PostTypeId="2" ParentId="10756" CreationDate="2015-07-30T05:31:35.113" Score="2" Body="&lt;p&gt;Craft 2 doesn't really have the concept of sessions or logging in for it's console app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had to guess that error is more about file system permissions, but you'd want to check your log files for a full stack trace to see where it's originating from.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-30T05:31:35.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10772" PostTypeId="1" AcceptedAnswerId="10776" CreationDate="2015-07-30T09:56:25.480" Score="3" ViewCount="1359" Body="&lt;p&gt;I have a structure as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child 1&lt;/li&gt;&#xA;&lt;li&gt;Child 2&lt;/li&gt;&#xA;&lt;li&gt;Child 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Parent 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child 1&lt;/li&gt;&#xA;&lt;li&gt;Child 2&lt;/li&gt;&#xA;&lt;li&gt;Child 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Parent 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child 1&lt;/li&gt;&#xA;&lt;li&gt;Child 2&lt;/li&gt;&#xA;&lt;li&gt;Child 3&#xA;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On my Child entry pages I want to pull out the other child entries under that parent to use as navigation. I think this should be fairly straight forward but I can not find any documentation on it. So far I have the below but this pulls out all level 2 child entries and not just the entries for the specified parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for subnav in craft.entries.section('mySection').level(2).find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ subnav.url }}&quot;&amp;gt;{{ subnav.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2018-09-06T18:38:49.947" Title="How do you pull out second level structure entries based on their parent?" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10774" PostTypeId="2" ParentId="10772" CreationDate="2015-07-30T10:19:14.630" Score="1" Body="&lt;p&gt;For this you should be able to use the getSibling() method which:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Returns an ElementCriteriaModel object prepped to return the entry’s siblings (if it lives in a Structure section).&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/templating/entrymodel.html#getsiblings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/entrymodel.html#getsiblings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set siblings = entry.getSiblings().all() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for page in siblings %}&#xA;        &amp;lt;li class=&quot;item-contentmenu&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1083" LastEditorUserId="57" LastEditDate="2018-09-06T18:38:49.947" LastActivityDate="2018-09-06T18:38:49.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10776" PostTypeId="2" ParentId="10772" CreationDate="2015-07-30T11:23:42.730" Score="5" Body="&lt;p&gt;Ok I've worked this out from above and adding some other code and now it works as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = entry.getAncestors().first() %}&#xA;{% for subnav in craft.entries.section('mySection').descendantOf(parent).descendantDist('1') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ subnav.url }}&quot;&amp;gt;{{ subnav.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this assists someone else.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-07-30T11:23:42.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10777" PostTypeId="1" AcceptedAnswerId="10792" CreationDate="2015-07-30T13:05:58.247" Score="0" ViewCount="64" Body="&lt;p&gt;Here’s an example: I have a job listing at www.example.com/designer and the user hits &quot;apply&quot; on that page. The user is then taken to a form. How can I know that the user came from www.example.com/designer and not www.example.com/developer?&lt;/p&gt;&#xA;" OwnerUserId="2224" LastEditorUserId="2224" LastEditDate="2015-07-31T12:36:22.370" LastActivityDate="2015-07-31T12:36:22.370" Title="How do I create a page with a dynamic id?" Tags="&lt;form&gt;&lt;php&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10778" PostTypeId="1" AcceptedAnswerId="10779" CreationDate="2015-07-30T14:39:10.053" Score="1" ViewCount="904" Body="&lt;p&gt;I'm trying to change Redactor's settings by editing &lt;code&gt;craft/config/Standard.json&lt;/code&gt; (and &lt;code&gt;Simple.json&lt;/code&gt;) but it doesn't seem to have any effect at all. I logged out, emptied Craft's and browser cache and still don't see any changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this feature broken in the current Craft version or am I missing something? I edit the file by removing/adding buttons, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;html&quot;,&quot;formatting&quot;,&quot;bold&quot;,],&quot;plugins&quot;:[&quot;fullscreen&quot;,&quot;video&quot;],&#xA;    &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3873" LastEditorUserId="57" LastEditDate="2015-07-30T16:31:29.350" LastActivityDate="2015-07-30T16:31:29.350" Title="Changing Redactor settings doesn't work" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10779" PostTypeId="2" ParentId="10778" CreationDate="2015-07-30T15:25:06.043" Score="2" Body="&lt;p&gt;You have to select that config file you edited in your Richtext field's settings. See the settings options for &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow&quot;&gt;&quot;Rich Text fields&quot;&lt;/a&gt; in the Craft Docs.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-30T15:25:06.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10780" PostTypeId="1" AcceptedAnswerId="10787" CreationDate="2015-07-30T15:50:26.680" Score="1" ViewCount="86" Body="&lt;p&gt;I'm having problems setting up an event. It gets triggered and I can access the event's params array, but I can't override the value like I can with Craft's default events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MyPlugin_myServiceService.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function setTest()&#xA;{&#xA;    $test = true;&#xA;&#xA;    $event = new Event($this, array(&#xA;        'test' =&amp;gt; $test&#xA;    ));&#xA;&#xA;    $this-&amp;gt;onAfterSetTest($event);&#xA;&#xA;    return $test;&#xA;}&#xA;&#xA;public function onAfterSetTest(Event $event)&#xA;{&#xA;    $this-&amp;gt;raiseEvent('onAfterSetTest', $event);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MyOtherPluginPlugin.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('myPlugin_myService.afterSetTest', function(Event $event)&#xA;{  &#xA;    $event-&amp;gt;params['test'] = false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what I'm doing wrong but &#xA;&lt;code&gt;craft()-&amp;gt;myPlugin_myService-&amp;gt;setTest()&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-31T08:00:55.233" Title="Override an event's param array?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10781" PostTypeId="2" ParentId="10780" CreationDate="2015-07-30T16:02:32.853" Score="2" Body="&lt;p&gt;It looks like it doesn't updated the variables passed to the event directly (referenced) and you have to access the value from the &lt;code&gt;$event&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function setTest()&#xA;{&#xA;    // ...&#xA;&#xA;    $test = $event-&amp;gt;params['test']&#xA;&#xA;    return $test;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-07-30T16:10:56.157" LastActivityDate="2015-07-30T16:10:56.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10782" PostTypeId="1" AcceptedAnswerId="10789" CreationDate="2015-07-30T20:04:26.693" Score="4" ViewCount="951" Body="&lt;p&gt;Can someone explain how to set up PhpStorm so that I can use it to develop/debug a plugin? I have&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;local webserver set up&lt;/li&gt;&#xA;&lt;li&gt;craft files in the usual place above the webroot&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The new project wizard gives me a choice between &lt;strong&gt;&quot;Web server is installed locally, source files are located under its document root&quot;&lt;/strong&gt; and &lt;strong&gt;&quot;Web server is installed locally, source files are located elsewhere locally. (Source files are copied to project root, then synchronized with server when necessary.)&quot;&lt;/strong&gt; Neither of which seems quite right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Directory structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;app&lt;/li&gt;&#xA;&lt;li&gt;plugins&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;myplugin&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;public &amp;lt;== this is webroot&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;.htaccess&lt;/li&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-07-31T06:10:46.400" LastActivityDate="2015-07-31T10:21:41.270" Title="How do I set up PhpStorm for plugin development" Tags="&lt;plugin-development&gt;&lt;debugging&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10783" PostTypeId="2" ParentId="10709" CreationDate="2015-07-30T20:33:07.623" Score="2" Body="&lt;p&gt;So I figured it out! my htaccess did not have the &quot;.&quot; in front of them. So my htaccess in my subdirectory was not being read. Once I renamed it to .htaccess, it worked fine! &lt;/p&gt;&#xA;" OwnerUserId="3906" LastActivityDate="2015-07-30T20:33:07.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10784" PostTypeId="1" CreationDate="2015-07-31T02:43:12.147" Score="1" ViewCount="97" Body="&lt;p&gt;I have a website with a shop section with the following URL structure: &lt;code&gt;homepage/shop/category/the-product&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to add a page after the category to filter between post types within that category, and I want to be able to access it through the entry type slug in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also need to change the template to match the Entry Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is possible, how do I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks ahead!&lt;/p&gt;&#xA;" OwnerUserId="3908" LastEditorUserId="642" LastEditDate="2015-08-12T22:18:37.387" LastActivityDate="2015-08-13T04:54:54.027" Title="Is it possible to create a page that shows only a specific post type with its own url?" Tags="&lt;templating&gt;&lt;entry-type&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10785" PostTypeId="2" ParentId="10782" CreationDate="2015-07-31T03:34:37.777" Score="1" Body="&lt;p&gt;I've never actually used the PhpStorm new project wizard, but I believe what it's asking is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are your source repo files &lt;em&gt;also&lt;/em&gt; where your web server is pointing when you go to &lt;code&gt;yourdomain.com&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Do you have a source repo directory and a separate sites directory where your web server is pointing for &lt;code&gt;yourdomain.com&lt;/code&gt;? In this scenario you'd need to copy over the source repo files to the site directory manually or setup a way to sync them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A common plugin development scenario is more of a modification of the 2nd option.  You'll have a source repo with your plugin files in it and a separate Craft installation that &lt;code&gt;yourdomain.com&lt;/code&gt; points to, but from the &lt;code&gt;craft/plugins&lt;/code&gt; folder your make a symlink to your plugin repo so that you can make changes directly in the repo and immediately test them on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wouldn't bother using the new project wizard at all.  Just open the source repo using &lt;code&gt;File-&amp;gt;Open Directory&lt;/code&gt; and setup everything up externally.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-31T03:34:37.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10786" PostTypeId="1" CreationDate="2015-07-31T07:30:33.733" Score="1" ViewCount="141" Body="&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class Test_FormsController extends BaseController&#xA;{&#xA;&#xA;   protected $allowAnonymous = true;&#xA;   public $session_id;&#xA;&#xA;    public function actionApply(){&#xA;        $appl_template = &quot;1&quot;;&#xA;        $this-&amp;gt;session_id = 15558145;&#xA;        return $this-&amp;gt;renderTemplate(&quot;apply/step&quot;.$appl_template.&quot;.html&quot;);&#xA;    }&#xA;&#xA;    public function actionSaveDataStruct(){&#xA;        echo 'session:'.$this-&amp;gt;session_id.'&amp;lt;br /&amp;gt;';&#xA;        exit();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hi guys i'm newbie on Craft and my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;acctionApply&lt;/code&gt; loads form which will send to &lt;code&gt;actionSaveDataStruct&lt;/code&gt;, I set a class variable &lt;code&gt;$session_id&lt;/code&gt; on &lt;code&gt;actionApply&lt;/code&gt; but whenever the form submitted and goes to &lt;code&gt;actionSaveDataStruct&lt;/code&gt;, &lt;code&gt;$this-&amp;gt;session_id&lt;/code&gt; become null again, how do I set variable that will never reset whenever the page load?&lt;/p&gt;&#xA;" OwnerUserId="3923" LastEditorUserId="57" LastEditDate="2015-07-31T16:32:30.803" LastActivityDate="2017-03-28T20:37:19.703" Title="How to store class variable inside a Craft controller" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10787" PostTypeId="2" ParentId="10780" CreationDate="2015-07-31T08:00:55.233" Score="1" Body="&lt;p&gt;Thanks to Lindsey D's comment to my first answer, I had a closer look at &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#hooks&quot; rel=&quot;nofollow&quot;&gt;custom hooks&lt;/a&gt; and found out that this is indeed the better solution to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MyPlugin_myServiceService.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function setTest()&#xA;{&#xA;    $test = true;&#xA;&#xA;    craft()-&amp;gt;plugins-&amp;gt;call('modifyTest', array(&amp;amp;$test));  &#xA;&#xA;    return $test;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MyOtherPluginPlugin.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyTest(&amp;amp;$test)&#xA;{&#xA;    $test = false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-31T08:00:55.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10788" PostTypeId="1" CreationDate="2015-07-31T08:05:11.090" Score="3" ViewCount="328" Body="&lt;p&gt;Got a client who uses his iPhone and iPad to update his site (he doesn't have a laptop!). Craft does a much better job than most as a mobile CMS, but he's running into issues with file uploads. When uploading from his Camera Roll he gets the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upload failed for image.jpg. The error message was: &quot;Error uploading&#xA;  the file: This file type is not allowed&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've tried too and get same response. In config.php jpeg and jpg are set in allowedFileExtensions, and maxUploadFileSize is ample if that matters. Wondering if there's some weird proprietary stuff with iOS files that's causing this? Anyone else experienced this before?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2015-10-16T08:45:51.743" Title="File upload issues on iOS" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10789" PostTypeId="2" ParentId="10782" CreationDate="2015-07-31T10:21:41.270" Score="3" Body="&lt;p&gt;I point &lt;code&gt;File-&amp;gt;Open Directory&lt;/code&gt; at &lt;code&gt;craft/..&lt;/code&gt;, and PhpStorm pick up everything for me. You probably have to set up path mappings to make debugging work properly, but PhpStorm will alert you to that and launch the mapping UI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sandbox Craft install running at &lt;code&gt;local.sandbox.dev&lt;/code&gt; and I create a git repo in the &lt;code&gt;plugins&lt;/code&gt; directory, and develop the plugin in there. That way I can have multiple plugins in this sandbox, all with different repos, whereas the Craft install itself is not version controlled. Makes it easy also to dump the entire installation and replace it whenever the database becomes too mangled.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-31T10:21:41.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10790" PostTypeId="1" AcceptedAnswerId="10793" CreationDate="2015-07-31T10:31:30.697" Score="2" ViewCount="2260" Body="&lt;p&gt;This question relates to my &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9756/how-to-calculate-the-number-of-days-left&quot;&gt;previous&lt;/a&gt; question on stackexchange about the difference in days between 2 dates. This ended up being the working solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date( inschrijven.datumEvenement|date ).diff( now ).days }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the same question applies but this time how can I calculate the number of hours left between ( now ) and a future date {{ inschrijven.datumEvenement }}?&lt;/p&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-07-31T12:57:15.570" Title="How to calculate the number of hours left?" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10791" PostTypeId="2" ParentId="10786" CreationDate="2015-07-31T11:32:26.590" Score="1" Body="&lt;p&gt;You can use cookies from craft to store / retrieve and delete the session id. Craft checks if the value isn't tampered with and hashed the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating a cookie:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie('session_id', $this-&amp;gt;session_id, $duration);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where duration is in seconds, don't know what happens if you use 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For retrieving the cookie value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sessionId = craft()-&amp;gt;userSession-&amp;gt;getStateCookieValue('sessionId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to delete the cookie in the final step.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;deleteStateCookie('session_id');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="3821" LastEditorUserId="57" LastEditDate="2015-07-31T16:42:27.123" LastActivityDate="2015-07-31T16:42:27.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10792" PostTypeId="2" ParentId="10777" CreationDate="2015-07-31T11:42:04.633" Score="3" Body="&lt;p&gt;Depending on how your redirect works, you can redirect and get the param in the template where the form is via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set param_name = craft.request.param('param_name') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then set this param in your form template and post it to your action controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type='hidden' name='param_name' value='{{ param_name }}' /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your action controller you can retrieve it by getting it from the post.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$param_name = craft()-&amp;gt;request-&amp;gt;getPost('param_name');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this anything you can use? Or need? Good luck!&lt;/p&gt;&#xA;" OwnerUserId="3821" LastActivityDate="2015-07-31T11:42:04.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10793" PostTypeId="2" ParentId="10790" CreationDate="2015-07-31T12:57:15.570" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter to format the DateInterval to your needs, I guess you&#xA;are looking for the total hours until the event, so you have to do some math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because there's still some strange things going on with Craft DateTime objects, do what I&#xA;recommended in the question you mentioned, convert it to a string in a common format &lt;em&gt;that includes time and timezone information&lt;/em&gt;&#xA;and then use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; function to convert it to a Twig DateTime object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a &quot;DateTime string&quot; in ISO8601 or UNIX format use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#iso8601&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;iso8601&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/docs/templating/datetime#getTimestamp&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getTimestamp&lt;/code&gt;&lt;/a&gt; method or the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter with the &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow&quot;&gt;corresponding parameter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateTimeEvent = date(inschrijven.datumEvenement|date('c')) %}&#xA;{% set dateTimeNow = date(now.iso8601) %}&#xA;&#xA;{% set dateInterval = dateTimeNow.diff(dateTimeEvent) %}&#xA;&#xA;{% set days = dateInterval|date('%a') %}&#xA;{% set hours = dateInterval|date('%h') %}&#xA;{% set totalHours = days * 24 + hours %}&#xA;&#xA;{% set upcoming = dateInterval|date('%R') == '+' ? true %}&#xA;&#xA;{% if upcoming %}&#xA;    Event start in {{ totalHours }} hours.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-31T12:57:15.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10794" PostTypeId="1" AcceptedAnswerId="10801" CreationDate="2015-07-31T14:48:13.470" Score="2" ViewCount="75" Body="&lt;p&gt;I'm only using Globals for the editable site footer content. Explaining to the user they need to look in &quot;Globals&quot; is a minor thing, but one extra step toward making a system less user friendly. If I can rename the tab to Footer it'll be a lot easier for the user to find by themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to mess with the Craft build itself as I like to keep it up to date. Any ideas, is this something I can do with a plugin?&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-07-31T16:32:00.300" Title="Rename the Globals Tab" Tags="&lt;user-interface&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10795" PostTypeId="1" AcceptedAnswerId="10807" CreationDate="2015-07-31T15:06:44.087" Score="3" ViewCount="935" Body="&lt;p&gt;Trying to get 10 entries related to the current entry categories excluding a category called featured. I don't have the category name(s) in the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This currently what I tried but this does not work, confused about how to do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the categories related to this entry excluding the featured category#}&#xA;{% set categories = craft.categories.relatedTo(entry) %}&#xA;&#xA;{# Output them #}&#xA;{% set thecategory = [] %}&#xA;&#xA;{% for category in categories %}&#xA;    {% set thecategory = craft.categories.group('resource').slug(category.slug) %}&#xA;{% endfor %}&#xA;&#xA;{# Set featured category name to exclude #}&#xA;{% set category = craft.categories.group('resource').title('featured') %}&#xA;{# Set featured ID's we dont want to show... #}&#xA;{% set featuredArticleIds = craft.entries.section('articles').relatedTo(category).ids() %}&#xA;{% set featuredArticleIdsString = featuredArticleIds | join(', not ') %}&#xA;&#xA;{% set entries = craft.entries.section(articles).relatedTo('and', thecategory|join(',')).id('and, not '~featuredArticleIdsString).limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2015-07-31T17:30:06.477" LastActivityDate="2015-07-31T21:19:26.950" Title="Getting entries related to current entries categories" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10796" PostTypeId="1" AcceptedAnswerId="10797" CreationDate="2015-07-31T15:12:44.240" Score="1" ViewCount="320" Body="&lt;p&gt;I'm very new to this so any guidance is greatly appreciated. I've written a couple of simple plugins that will send an email to admins on new user save and and on new entry creation. What I need to do now is to send a weekly email with all new entries created in the last 7 days to a particular user group. I figured it'd be pretty efficient to set up an online CRON job to hit a site url, and on load of that page, trigger my email plugin. However, I'm not sure how to trigger my plugin on page load. Any suggestions? &lt;/p&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-07-31T15:28:48.057" Title="Is it possible to have Craft send an email on page load?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10797" PostTypeId="2" ParentId="10796" CreationDate="2015-07-31T15:28:48.057" Score="4" Body="&lt;p&gt;I would think you would want to instead set up a controller action, as URLs route directly to them, rather than use the overhead of a page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your cron job could hit the corresponding Controller Action URL (i.e., &lt;a href=&quot;http://mysite.com/actions/myplugin/entriescreated/weekly&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/actions/myplugin/entriescreated/weekly&lt;/a&gt;), and run your job like that. Note, where you're accessing an action via cron you would have to set it to allow anonymous access to the action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2015-07-31T15:28:48.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10800" PostTypeId="2" ParentId="10794" CreationDate="2015-07-31T16:30:14.583" Score="1" Body="&lt;p&gt;You can either use Craft's static translation support (which will rename it anywhere in the control panel) to rename it or something like the handy &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS&lt;/a&gt; plugin just to target that tab and rename it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-07-31T16:30:14.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10801" PostTypeId="2" ParentId="10794" CreationDate="2015-07-31T16:32:00.300" Score="3" Body="&lt;p&gt;Yup! The &lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow&quot;&gt;Control Panel Nav&lt;/a&gt; plugin is exactly what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It allows you to easily rename, rearrange, or hide any of your tabs. It also lets you create additional custom tabs, using any URL you want.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-07-31T16:32:00.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10802" PostTypeId="2" ParentId="10765" CreationDate="2015-07-31T16:44:44.003" Score="1" Body="&lt;p&gt;Registration form errors &lt;strong&gt;only display for &lt;code&gt;password&lt;/code&gt; when logged out&lt;/strong&gt;. If you're logged in as admin they won't display.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2015-07-31T16:44:44.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10803" PostTypeId="2" ParentId="10764" CreationDate="2015-07-31T16:46:50.967" Score="3" Body="&lt;p&gt;Emails only send out when you're &lt;strong&gt;not logged in as admin&lt;/strong&gt; from the front-end registration form.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2015-07-31T16:46:50.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10804" PostTypeId="2" ParentId="10786" CreationDate="2015-07-31T16:54:04.113" Score="2" Body="&lt;p&gt;In addition to passing the value along through a &lt;a href=&quot;https://craftcms.stackexchange.com/a/10791/57&quot;&gt;cookie&lt;/a&gt;, you could also do it through PHP's session support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add('sessionId', '123456');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Retrieving:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sessionId = craft()-&amp;gt;httpSession-&amp;gt;get('sessionId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Deleting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;remove('sessionId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-03-28T20:37:19.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10807" PostTypeId="2" ParentId="10795" CreationDate="2015-07-31T17:28:18.430" Score="3" Body="&lt;p&gt;This solution should also remove your &quot;featured&quot; category entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.relatedTo(entry) %}&#xA;{% set featuredCategory = craft.categories.slug('featured').first() %}&#xA;&#xA;{% set allIds = [] %}&#xA;{% for id in categories.ids() if id != featuredCategory.id %}&#xA;    {% set allIds = allIds|merge([id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(allIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-07-31T17:47:35.223" LastActivityDate="2015-07-31T17:47:35.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10808" PostTypeId="1" AcceptedAnswerId="10809" CreationDate="2015-07-31T18:42:02.000" Score="3" ViewCount="331" Body="&lt;p&gt;I'm trying to create a category driven gallery. My setup (right or wrong) is this:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users create a new entry within a Structure, title it, add photos and then assign the entry to a pre-defined gallery category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is that when a visitor lands on the 'Gallery' page they see a 'grid' of latest photos (this is a question which might appear here later), with a navigation on the side which allows them to browse the other galleries (categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do I list out the categories and associated entries for this navigation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Title One&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Title of the entry1&lt;/li&gt;&#xA;&lt;li&gt;Title of the entry2&lt;/li&gt;&#xA;&lt;li&gt;Title of the entry3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Title Two&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Title of the entry4&lt;/li&gt;&#xA;&lt;li&gt;Title of the entry5&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Title Three&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Title of the entry6&lt;/li&gt;&#xA;&lt;li&gt;Title of the entry7&lt;/li&gt;&#xA;&lt;li&gt;Title of the entry8&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Title Four&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Title of the entry9&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't want the Category Titles to be links, just the entries within them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this makes sense and someone can provide a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-07-31T18:53:58.410" Title="List Categories AND their associated entries" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10809" PostTypeId="2" ParentId="10808" CreationDate="2015-07-31T18:53:58.410" Score="3" Body="&lt;p&gt;Something along the line of this should do that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for category in craft.categories.group('categoryGroupHandle') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ category.title }}&#xA;        {% for entry in craft.entries.section('sectionHandle').relatedTo(category) %}&#xA;            {% if loop.first %}&amp;lt;ul&amp;gt;{% endif %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Probably some bugs in here, but should be enough to get you started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also probably smart to wrap this in &lt;code&gt;{% cache %}&lt;/code&gt; tags, as it probably will trigger a lot of database queries.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-07-31T18:53:58.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10810" PostTypeId="1" AcceptedAnswerId="10811" CreationDate="2015-07-31T19:48:53.603" Score="2" ViewCount="589" Body="&lt;p&gt;My plugin function is ignoring the dateUpdated criteria. Any clue as to why? I'm guessing it's syntax, but I cannot find any examples online as to how to format correctly. I can make this work in a template just fine. I'm new to plugins and PHP. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'guide';&#xA;    $criteria-&amp;gt;order = 'postDate desc';&#xA;    $criteria-&amp;gt;dateUpdated  &amp;gt; '(&quot;now&quot;|date_modify(&quot;-7 days&quot;))';&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    if ($entries) {&#xA;        //Do that thing with my code&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-07-31T21:05:46.860" Title="Plugins - Element Criteria Model. Can I return only entries with a updated date in the last 7 days?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10811" PostTypeId="2" ParentId="10810" CreationDate="2015-07-31T21:05:46.860" Score="6" Body="&lt;p&gt;I'm not sure if there's some other Craft helpers / static variables that you could use, but this technique works. Create a DateTime object without the param set to get the current time, modify it and format it for use in the query like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$date = new DateTime();&#xA;$date-&amp;gt;modify('-7 days');&#xA;&#xA;// Format datetime for use in query&#xA;$timezone = new \DateTimeZone(DateTime::UTC);&#xA;$date = $date-&amp;gt;format(DateTime::MYSQL_DATETIME, $timezone);&#xA;&#xA;$criteria-&amp;gt;dateUpdated = '&amp;gt; '.$date;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-07-31T21:05:46.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10812" PostTypeId="1" AcceptedAnswerId="10817" CreationDate="2015-07-31T21:53:27.463" Score="15" ViewCount="3714" Body="&lt;p&gt;I have some csv files uploaded as assets and now I need to &lt;code&gt;fopen()&lt;/code&gt; them from my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an &lt;code&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/models/AssetFileModel&quot;&gt;AssetFileModel&lt;/a&gt;&lt;/code&gt; but I have not been able to work out how to construct a full path to the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the filename like: &lt;code&gt;$asset-&gt;filename&lt;/code&gt; which gives me &lt;code&gt;my_csv_file.csv&lt;/code&gt; but this is not enough for &lt;code&gt;fopen()&lt;/code&gt; to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the absolute path to the asset file? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or at least a path that I can use with &lt;code&gt;fopen()&lt;/code&gt; to find the file?&lt;/p&gt;&#xA;" OwnerUserId="1100" LastActivityDate="2020-03-02T15:15:15.693" Title="How to get absolute path to asset file?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10813" PostTypeId="1" AcceptedAnswerId="10816" CreationDate="2015-08-01T05:58:57.440" Score="2" ViewCount="64" Body="&lt;p&gt;I'm trying to check my craft locale to offer language switching but it seems that my french locale returns the &quot;en&quot; value???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the following:&#xA;&lt;code&gt;{% if craft.locale == 'fr' %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I instead get the contents of:&#xA;&lt;code&gt;{% if craft.locale == 'en' %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone experiencing this? I don't see any code that could be messing with the code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the site url outputs just fine: &lt;code&gt;mysite.dev/fr/&lt;/code&gt; BUT if I print &lt;code&gt;{{ craft.locale }}&lt;/code&gt; I get &quot;en&quot;.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2015-08-01T07:06:49.417" Title="French local returns &quot;en&quot;?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10814" PostTypeId="1" AcceptedAnswerId="10815" CreationDate="2015-08-01T06:05:59.613" Score="3" ViewCount="488" Body="&lt;p&gt;Is it possible to loop through locales? For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% locale in craft.locales %}&#xA;    {# get link for each locale available #}&#xA;    &amp;lt;a href=&quot;{{ locale.getUrl }}&quot;&amp;gt;{{ locale.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="47" LastActivityDate="2015-08-01T06:44:41.867" Title="Is it possible to loop through locales?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10815" PostTypeId="2" ParentId="10814" CreationDate="2015-08-01T06:44:41.867" Score="4" Body="&lt;p&gt;You can try to use the following code to loop through the locales:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = craft.i18n.getSiteLocaleIds()%}&#xA;&#xA;{% for locale in locales %}&#xA;    {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;    &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot;&amp;gt;{{ localeEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A full solution for a language switcher is described under &lt;a href=&quot;https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher&quot;&gt;How can I build a language switcher?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-08-01T06:44:41.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10816" PostTypeId="2" ParentId="10813" CreationDate="2015-08-01T07:06:49.417" Score="3" Body="&lt;p&gt;You probably forgot to set the CRAFT_LOCALE constant for your French site in /fr/index.php, to tell Craft which locale's content to serve.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-01T07:06:49.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10817" PostTypeId="2" ParentId="10812" CreationDate="2015-08-01T12:07:22.263" Score="15" Body="&lt;p&gt;You can get the rest of the path from your asset's source and folder, I think something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$source = $asset-&amp;gt;getSource();&#xA;&#xA;if ($source-&amp;gt;type != 'Local')&#xA;{&#xA;    throw new Exception(Craft::t('Paths not available for non-local asset sources'));&#xA;}&#xA;&#xA;$sourcePath = $source-&amp;gt;settings['path'];&#xA;$folderPath = $asset-&amp;gt;getFolder()-&amp;gt;path;&#xA;&#xA;$assetFilePath = $sourcePath.$folderPath.$asset-&amp;gt;filename;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-08-01T16:54:31.740" LastActivityDate="2015-08-01T16:54:31.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10818" PostTypeId="1" AcceptedAnswerId="10820" CreationDate="2015-08-01T16:41:57.187" Score="1" ViewCount="70" Body="&lt;p&gt;I'm trying to upload an asset based on this code &lt;a href=&quot;https://gist.github.com/sathoro/8178981&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/sathoro/8178981&lt;/a&gt;&#xA;which works fine, but how can I add additional content fields during the upload? I would like to set the caption an additional fields like credit during the upload?&lt;/p&gt;&#xA;" OwnerUserId="3928" LastActivityDate="2015-08-02T22:00:51.823" Title="How can I add field content to an asset in code?" Tags="&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10819" PostTypeId="2" ParentId="10692" CreationDate="2015-08-02T14:39:28.413" Score="2" Body="&lt;p&gt;I mostly agree with megatrond, with a few added suggestions. Since products and accessories will probably share a lot of similar fields, I recommend using the &lt;a href=&quot;https://buildwithcraft.com/features/entry-types&quot; rel=&quot;nofollow&quot;&gt;Entry Type&lt;/a&gt; feature. You can &lt;a href=&quot;https://buildwithcraft.com/docs/templating/craft.entries#type&quot; rel=&quot;nofollow&quot;&gt;include or exclude entry types easily in your entry query&lt;/a&gt;. This method might help simplify your queries, since you will only be searching against and sorting from one structure instead of two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using relations to connect accessories to products to brands to product families is a great way to organize.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Products and Accessories (Structure)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product (Entry Type)&lt;/li&gt;&#xA;&lt;li&gt;Accessory (Entry Type) &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Brands (Structure)&lt;/li&gt;&#xA;&lt;li&gt;Product family (Category)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-08-02T14:39:28.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10820" PostTypeId="2" ParentId="10818" CreationDate="2015-08-02T22:00:51.823" Score="2" Body="&lt;p&gt;It propbably works to store the custom field directly with your new element model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assetFileModel-&amp;gt;setContentFromPost(array(&#xA;    'captionFieldHandle' =&amp;gt; $myCaption,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-02T22:00:51.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10821" PostTypeId="1" AcceptedAnswerId="10831" CreationDate="2015-08-03T03:34:59.957" Score="2" ViewCount="41" Body="&lt;p&gt;I have a categories field where I would like to be able to include the same category more than once. Any suggestions on how to do this?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-03T17:14:16.377" Title="Categories field that allows duplicate values" Tags="&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10822" PostTypeId="1" AcceptedAnswerId="10823" CreationDate="2015-08-03T08:09:52.107" Score="2" ViewCount="493" Body="&lt;p&gt;I have a complex html/css structure per 'row' that I would like to use Matrix to populate. Design markup as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!--- feature left --&amp;gt;&#xA;&amp;lt;section class=&quot;features-inner dark-bg-container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row collapse small-uncollapse&quot; &amp;gt;&#xA;        &amp;lt;div class=&quot;medium-5 small-12 columns end dark-bg&quot; &amp;gt;&#xA;            &amp;lt;h3&amp;gt;Title&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p&amp;gt;Lorem Ipsum...&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;medium-5 medium-push-2 small-12 columns end dark-bg-icon&quot; &amp;gt;&#xA;            &amp;lt;img src=&quot;img/image.svg&quot; class=&quot;feature-image&quot;/&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&amp;lt;!--- end of feature left --&amp;gt;&#xA;&#xA;&amp;lt;!--- feature right --&amp;gt;&#xA;&amp;lt;section class=&quot;features-inner gold-bg-container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row collapse small-uncollapse&quot; &amp;gt;&#xA;        &amp;lt;div class=&quot;medium-5 medium-push-7 small-12 columns gold-bg&quot; &amp;gt;&#xA;            &amp;lt;h3&amp;gt;Title&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p&amp;gt;Lorem Ipsum...&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;medium-5 medium-pull-5 small-12 columns end gold-bg-icon&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;img/image.svg&quot; class=&quot;feature-image&quot;/&amp;gt;&#xA;        &amp;lt;/div&amp;gt;  &#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&amp;lt;!--- end of feature right --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I get Matrix to change the markup per 'row'? I looked at switch but that seems to be for types of block content/types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TIA.&lt;/p&gt;&#xA;" OwnerUserId="2236" LastEditorUserId="344" LastEditDate="2015-08-03T10:59:40.990" LastActivityDate="2015-08-03T10:59:40.990" Title="Change HTML and CSS per Matrix row" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10823" PostTypeId="2" ParentId="10822" CreationDate="2015-08-03T09:17:24.667" Score="3" Body="&lt;p&gt;When looping through Matrix rows, you can use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;{{ loop.index }} or {{ loop.index0 }}&lt;/a&gt; to see which row you're at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With loop.index, you could create html for each row number, or (for instance) create different html for even/uneven:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.matrixFieldHandle %}&#xA;    {% if loop.index is divisible by(2) %}&#xA;        &amp;lt;p class=&quot;even&quot;&amp;gt;{{ row.text }}&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p class=&quot;uneven&quot;&amp;gt;{{ row.text }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-08-03T09:17:24.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10824" PostTypeId="2" ParentId="10761" CreationDate="2015-08-03T11:25:21.723" Score="1" Body="&lt;p&gt;The above answer is great, but I'd just like to add that if the client site is public, and the company have a set of internal static IPs that users would always be accessing it from then I would add an IP check to the if statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using only getUrl() someone accessing the site could simply add an entry to their host file to use that URL, and the login box would be auto populated. I realise that may be a fringe case, but you can never be too careful.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-08-03T11:25:21.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10825" PostTypeId="1" AcceptedAnswerId="10826" CreationDate="2015-08-03T14:21:17.010" Score="3" ViewCount="159" Body="&lt;p&gt;I have a form that consists of two dropdown boxes. These dropdowns contain values that relate to two sets of categories for one type of entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when the search form is submitted there are two params that are passed, an interest and a destination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result I need, if I were to write it literally would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Select all the courses where INTEREST = [interest] &lt;strong&gt;AND&lt;/strong&gt; DESTINATION = [destination]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having a hard time figuring out how this is done in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated. &lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-08-03T17:10:26.090" Title="Search entries based on two form values" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10826" PostTypeId="2" ParentId="10825" CreationDate="2015-08-03T14:50:15.477" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;http://buildwithcraft.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt;, this is how it's done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search('interest:interestSearchValue destination:destinationSearchValue) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, using the posted variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search('interest:' ~ craft.request.param('interest') ~ ' destination:' ~ craft.request.param('destination')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="157" LastEditDate="2015-08-03T17:10:26.090" LastActivityDate="2015-08-03T17:10:26.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10827" PostTypeId="1" CreationDate="2015-08-03T15:27:09.557" Score="2" ViewCount="341" Body="&lt;p&gt;I've got a plugin which needs to be able to access all the blocks in a matrix - regardless of if the blocks are enabled or disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry objects returned by the likes of &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;getEntryById&lt;/code&gt; only seem to include blocks in the matrix fields which are enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to access this information through a service - or do I need to work out how this is handled in the control panel (which does show disabled matrix blocks)?&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="57" LastEditDate="2015-08-03T16:01:41.313" LastActivityDate="2015-08-03T17:13:04.757" Title="Accessing disabled matrix blocks in a plugin" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10828" PostTypeId="2" ParentId="10827" CreationDate="2015-08-03T16:36:23.013" Score="2" Body="&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;status = null;&#xA;$find = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;code&gt;status&lt;/code&gt; to null will return all elements regardless of their status.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-03T16:36:23.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10829" PostTypeId="2" ParentId="10827" CreationDate="2015-08-03T17:13:04.757" Score="1" Body="&lt;p&gt;If you already have an entry object, and know the handle for the Matrix field, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;fieldId = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('matrixFieldHandle')-&amp;gt;id;&#xA;$criteria-&amp;gt;ownerId = $entry-&amp;gt;id;&#xA;$criteria-&amp;gt;status = null;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="900" LastActivityDate="2015-08-03T17:13:04.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10831" PostTypeId="2" ParentId="10821" CreationDate="2015-08-03T17:14:16.377" Score="2" Body="&lt;p&gt;I'd probably go with a Matrix field, with one block type containing the Categories field. This would also allow you to include other fields for some extra meta data to distinguish one category assignment from another, otherwise identical one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use your playlist example, the Matrix blocks would let you set the order of the tracks as well.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-08-03T17:14:16.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10834" PostTypeId="1" CreationDate="2015-08-03T18:14:48.070" Score="3" ViewCount="4073" Body="&lt;p&gt;Redactor provides a way to specify custom styles for content in the editor. It's documented here: &lt;a href=&quot;http://imperavi.com/redactor/examples/typography/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/examples/typography/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use this approach with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already added custom formatting options to the menu via formattingAdd. That works great and the corresponding custom CSS classes are being applied in the formatting menu, the editor text, and on the site front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the items in the formatting menu and the editor just look like standard paragraph elements and don't reflect any of the styles that they will have on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do I put the CSS so that when my clients are working in the control panel, the styles are visible in the formatting menu and the editor when they are applied?&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-08-03T19:31:38.903" Title="Where do I add custom css for the Redactor editor in the Craft control panel?" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10835" PostTypeId="2" ParentId="10834" CreationDate="2015-08-03T18:22:59.873" Score="4" Body="&lt;p&gt;What you want is the &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft/&quot; rel=&quot;nofollow&quot;&gt;Redactor Styles&lt;/a&gt; plugin&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the CSS field you set up any CSS you need to customize the redactor fields in the control panel.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-03T18:22:59.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10836" PostTypeId="1" AcceptedAnswerId="10839" CreationDate="2015-08-03T18:50:24.500" Score="2" ViewCount="312" Body="&lt;p&gt;I have entries in a channel called &quot;shorts&quot;.&#xA;Each of those entries has a field called &quot;size&quot; that can be a value of small, medium or large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a form where I want users to be able to filter entries where the field could match small and medium (for example). I am using checkboxes on my front end form and a drop down field on the Craft admin form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL I'm utilizing looks like this: &lt;a href=&quot;http://domain.com/search/results?size=small&amp;amp;size=medium&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/search/results?size=small&amp;amp;size=medium&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But only the mediums are being displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code. I am not sure how to join the two together so smalls and mediums are displayed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {section: 'shorts', limit: null}&#xA;{% if craft.request.getParam('size') %}&#xA;{% set params = params|merge({'size':size}) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-08-03T20:34:21.183" Title="Find Entries with Multiple Matches in a Single Field" Tags="&lt;filter&gt;&lt;queries&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10837" PostTypeId="2" ParentId="10834" CreationDate="2015-08-03T19:31:38.903" Score="7" Body="&lt;p&gt;I ended up using the Control Panel CSS plugin by Lindsey D to do this. Installed the plugin and then pointed it to an external style sheet with my redactor styles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the plugin:&#xA;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in my stylesheet, the styles look like the below. These examples are for a custom item I added to the redactor formatting menu with a class &lt;code&gt;pullquote__quote&lt;/code&gt;. The first style the menu item in the formatting dropdown menu. The second style the text in the editor.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor-dropdown .redactor-formatting-p-pullquote__quote {&#xA;  font-size: 20px;&#xA;  font-weight: bold;&#xA;  color: #ffcb00;&#xA;}&#xA;&#xA;.redactor-editor .pullquote__quote {&#xA;  font-size: 20px;&#xA;  font-weight: bold;&#xA;  color: #ffcb00;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my redactor config file for this rich text field has this corresponding addition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: [&#xA;    {&#xA;        tag: 'p',&#xA;        title: 'Big quote',&#xA;        class: 'pullquote__quote'&#xA;    }       &#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="579" LastActivityDate="2015-08-03T19:31:38.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10838" PostTypeId="1" AcceptedAnswerId="10847" CreationDate="2015-08-03T19:58:49.240" Score="4" ViewCount="181" Body="&lt;p&gt;I've got a plugin with a custom element. It evolved based on the basics laid out in the &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow noreferrer&quot;&gt;P&amp;amp;T Events sample plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my element's index page, there's a big button to create a &quot;New Element&quot;. When you click on it, you see a dropdown list of every available group for the new element:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wsaqe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wsaqe.png&quot; alt=&quot;Current button format&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the result generated by &lt;a href=&quot;https://github.com/pixelandtonic/Events/blob/master/events/templates/_index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the code in the Events example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I really want a &lt;strong&gt;split button format&lt;/strong&gt;, like Craft provides for its entries:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VLeAB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VLeAB.png&quot; alt=&quot;Desired button format&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage there would be the &quot;one click&quot; add, if you're already viewing the target group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried copy &amp;amp; pasting various HTML from the &lt;code&gt;entries&lt;/code&gt; template, but that doesn't really seem to be doing the trick. I suspect JS is playing a large role in generating that menu, but I haven't quite figured it out yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I make a split-style button for my custom element?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-04T17:26:41.700" Title="Split-style button for &quot;New&quot; custom element" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10839" PostTypeId="2" ParentId="10836" CreationDate="2015-08-03T20:34:21.183" Score="3" Body="&lt;p&gt;The main problem is your URL isn't formatted correctly. You need brackets after each 'size' parameter to make an array of those values. Otherwise, it only picks up the last value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://domain.com/search/results?size[]=small&amp;amp;size[]=medium&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sizeQuery = craft.request.getParam('size') %}&#xA;&#xA;{% set params = {section: 'shorts', limit: null} %}&#xA;&#xA;{% if sizeQuery %}&#xA;  {% set params = params|merge({'size':sizeQuery}) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, you can use the dump() function to test what craft.request.getParam('size') is finding in your URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(sizeQuery) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This URL: &lt;a href=&quot;http://domain.com/search/results?size=small&amp;amp;size=medium&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/search/results?size=small&amp;amp;size=medium&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... returns &lt;code&gt;string(5) &quot;medium&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this URL: &lt;a href=&quot;http://domain.com/search/results?size[]=small&amp;amp;size[]=medium&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/search/results?size[]=small&amp;amp;size[]=medium&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... returns &lt;code&gt;array(2) { [0]=&amp;gt; string(5) &quot;small&quot; [1]=&amp;gt; string(5) &quot;medium&quot; }&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2015-08-03T20:34:21.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10840" PostTypeId="1" AcceptedAnswerId="10849" CreationDate="2015-08-04T00:10:48.427" Score="2" ViewCount="547" Body="&lt;p&gt;So i added a route to a template that shows entries by entry types.&#xA;the way the template does it is by taking the last segment of the url, and using it as an entry slug for this filter:&#xA;&lt;code&gt;craft.entries.type(craft.request.getSegment(3)).relatedTo(category)&lt;/code&gt;&#xA;So, how can i check if the string in the segment matches any of the entry types in that section, and if not - redirect to 404 page?&lt;/p&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-08-04T20:01:54.617" Title="check if a route segment matches a section entry type" Tags="&lt;routes&gt;&lt;filter&gt;&lt;entry-type&gt;&lt;category&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10841" PostTypeId="1" AcceptedAnswerId="10843" CreationDate="2015-08-04T04:27:38.227" Score="5" ViewCount="1861" Body="&lt;p&gt;Is there a way to &quot;undelete&quot; an entry that has been deleted? (Kind of like the &quot;Trash/Recycling Bin&quot; functionality of our computer OS.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see any obvious way to do this, but since Craft Pro has page versioning it seems like perhaps there should be a way to restore an old version of a page that has since been removed?&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2019-08-28T13:06:34.810" Title="Undeleting entries (or restore previous version of deleted entry?)" Tags="&lt;entries&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10842" PostTypeId="2" ParentId="4981" CreationDate="2015-08-04T04:47:56.327" Score="1" Body="&lt;p&gt;This is such a good question! (I'm new to Craft, and am &lt;em&gt;very&lt;/em&gt; surprised this isn't possible out-of-the-box.) I figured out a hacky but not-too-crazy way to hide entry types from the select menu (as opposed to an event that prevents it from being saved after it is selected, which is a bad user experience):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install this nifty &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Control Panel CSS plugin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Figure out the entry type id (look in the database or inspect the source of the dashboard page and see what the option values are in the entry types dropdown).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add some CSS like the following to that plugin's CP page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;#entry-form #entryType option:not(:checked)[value=&quot;4&quot;] { display: none; }&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add as many of those lines as you need for each of your entry types you want to hide.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Or if you'd rather go off the entry name instead of id (or you don't want to rely on those CSS3 selectors due to old browser support), you could achieve the same thing with some jquery, using the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS plugin&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function() {&#xA;    var hiddenEntryTypes = [&#xA;        'Blog Index',&#xA;        'Employees Index',&#xA;        'Some other entry type name'&#xA;    ];&#xA;    $('#entry-form #entryType option:not(:selected)').each(function() {&#xA;        if (hiddenEntryTypes.indexOf($(this).html()) &amp;gt; -1) {&#xA;            $(this).hide();&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2015-08-04T04:47:56.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10843" PostTypeId="2" ParentId="10841" CreationDate="2015-08-04T05:14:32.403" Score="2" Body="&lt;p&gt;Currently not... Craft does a &quot;hard&quot; delete for its elements instead of a &quot;soft&quot; delete like what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably pull off something close to what you're looking for with a plugin that listened to many of Craft's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;onBeforeDelete*&lt;/a&gt; events, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, sounds like a good feature request for the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feedback site&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-04T05:14:32.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10844" PostTypeId="2" ParentId="554" CreationDate="2015-08-04T05:47:55.070" Score="4" Body="&lt;p&gt;I think comparing the entry id's is the best way to go for the current page. But for determining if a certain page is a parent of the current page, I combined answers from @tim-kelty and @carlcs to come up with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;  {% set isInSection = craft.request.firstSegment == entry.uri|split('/')[0] %}&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ isInSection ? 'active' : '' }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: I realized my above code does something slightly different than I originally thought: it will add the 'active' class to any items that are in the current' page's section... which includes siblings. If that's what you want, then it's great. But if you only want to indicate the actual top-level section parent page, then you should do this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;  {% set isTopParent = craft.request.firstSegment == entry.uri %}&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;{{ isTopParent ? 'active' : '' }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Last but not least, if you want to hilite all pages that are in the parent &quot;path&quot; of the current page (which is what I most often need in my menus), you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# use different var name in the loop because we assume `entry` is already set to the currently-viewed page #}&#xA;{% for page in entries %}&#xA;  {% set isInPath = entry.uri matches '{^' ~ page.uri ~ '}' %}&#xA;  &amp;lt;a href=&quot;{{ page.url }}&quot; class=&quot;{{ isInPath ? 'active' : '' }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've posted a full example that encompasses a lot of &quot;denote the active page or its parents&quot; logic here: &lt;a href=&quot;http://craftcookbook.net/recipes/388&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/388&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="3931" LastEditDate="2015-08-05T17:45:17.493" LastActivityDate="2015-08-05T17:45:17.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10845" PostTypeId="2" ParentId="981" CreationDate="2015-08-04T09:56:28.163" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/boboldehampsink/translate&quot; rel=&quot;nofollow&quot;&gt;Translate plugin&lt;/a&gt; does what you need, it scans templates and plugins, and also provides an interface for translation.&lt;/p&gt;&#xA;" OwnerUserId="3427" LastActivityDate="2015-08-04T09:56:28.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10846" PostTypeId="2" ParentId="150" CreationDate="2015-08-04T17:01:39.677" Score="1" Body="&lt;p&gt;In addition to the $49 plugin mentioned in other answers, there's also a more basic one that is free: &lt;a href=&quot;https://github.com/xodigital/SimpleSitemap&quot; rel=&quot;nofollow&quot;&gt;https://github.com/xodigital/SimpleSitemap&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2015-08-04T17:01:39.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10847" PostTypeId="2" ParentId="10838" CreationDate="2015-08-04T17:26:41.700" Score="4" Body="&lt;p&gt;Those split-style buttons are just multiple regular buttons (&lt;code&gt;.btn&lt;/code&gt;) next to each other, wrapped in a &lt;code&gt;.btngroup&lt;/code&gt; div:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;btngroup submit&quot;&amp;gt;&#xA;  &amp;lt;a class=&quot;btn submit&quot; href=&quot;#&quot;&amp;gt;Button One&amp;lt;/a&amp;gt;&#xA;  &amp;lt;a class=&quot;btn submit&quot; href=&quot;#&quot;&amp;gt;Button Two&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to make one of your buttons trigger a dropdown menu, give it the class &lt;code&gt;.menubtn&lt;/code&gt;, and add your &lt;code&gt;.menu&lt;/code&gt; div right after it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;btngroup submit&quot;&amp;gt;&#xA;  &amp;lt;a class=&quot;btn submit&quot; href=&quot;#&quot;&amp;gt;Button One&amp;lt;/a&amp;gt;&#xA;  &amp;lt;div class=&quot;btn menubtn submit&quot; href=&quot;#&quot;&amp;gt;Menu Button&amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;menu&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Option One&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Option Two&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as this HTML is in the page’s initial HTML, Craft will automatically initialize the menu. If you’re adding it in JavaScript later on, you will need to initialize the menu yourself, by calling the &lt;code&gt;menubtn()&lt;/code&gt; jQuery function on it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$('#mycontainer .menubtn').menubtn();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-04T17:26:41.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10848" PostTypeId="1" AcceptedAnswerId="10856" CreationDate="2015-08-04T18:07:43.017" Score="2" ViewCount="717" Body="&lt;p&gt;What is the cleanest way to validate if a checkbox (i.e. agree to legal terms) is checked? &lt;/p&gt;&#xA;" OwnerUserId="608" LastEditorUserId="125" LastEditDate="2015-08-05T08:30:34.370" LastActivityDate="2015-08-05T08:32:20.060" Title="Contact Form Plugin: Validate if a checkbox is checked?" Tags="&lt;validation&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10849" PostTypeId="2" ParentId="10840" CreationDate="2015-08-04T20:01:54.617" Score="3" Body="&lt;p&gt;Take a look at the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/exit&quot; rel=&quot;nofollow&quot;&gt;{% exit %}&lt;/a&gt; tag. You should be able to do something very similar, since your search will return no results if the entry type does not exist.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.type(craft.request.getSegment(3)).relatedTo(category) %}&#xA;&#xA;{% if not entries %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-08-04T20:01:54.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10850" PostTypeId="1" CreationDate="2015-08-04T20:32:24.030" Score="4" ViewCount="316" Body="&lt;p&gt;I attempted to set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#privateTemplateTrigger&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;privateTemplateTrigger&lt;/code&gt;&lt;/a&gt; to an empty string in my config/general.php file, because I don't &lt;em&gt;ever&lt;/em&gt; want Craft to serve up a template file on its own just because a visitor happens to put in a URL that matches its name, and I was hoping to avoid prefixing every single file in my /templates directory with an underscore. Unfortunately doing so breaks several CP pages (like Globals and Plugins)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it's because some CP files are relying on this feature? Surely there must be some way to disable this &quot;direct rendering of template files&quot; thing that doesn't break the CP?&lt;/p&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="45" LastEditDate="2015-08-04T20:40:45.503" LastActivityDate="2015-08-04T20:40:45.503" Title="Prevent ALL templates from being rendered directly?" Tags="&lt;control-panel&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2015-08-05T19:29:15.900" ContentLicense="CC BY-SA 3.0" />
  <row Id="10851" PostTypeId="1" CreationDate="2015-08-04T20:35:12.347" Score="2" ViewCount="6435" Body="&lt;p&gt;Is it possible to determine whether or not a query string has a param with no value. For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.test.com?myparam&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Technically that's a valid url but the craft.request object doesn't appear to have a way to see that. craft.request.getParam('myparam') returns nothing as does craft.request.getQuery('myparam'). I have tried using an explicit test for 'true' and 'false' but no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm grabbing the entire query string value and then using the 'in' to find the param name but thats pretty fragile is another param or value contains the same string.&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2015-08-05T09:54:23.780" Title="Get query string param that has no value" Tags="&lt;url&gt;&lt;request&gt;&lt;querystring&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10852" PostTypeId="2" ParentId="10850" CreationDate="2015-08-04T20:39:39.043" Score="6" Body="&lt;p&gt;This is very, very simple to do... just put &lt;strong&gt;every single template&lt;/strong&gt; into a specific folder, then prefix the folder with an underscore:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/templates/_everything/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template files beginning with underscores are hidden, similarly, template &lt;strong&gt;folders&lt;/strong&gt; beginning with an underscore hide &lt;strong&gt;everything inside&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-04T20:39:39.043" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10853" PostTypeId="1" AcceptedAnswerId="10854" CreationDate="2015-08-05T01:48:09.643" Score="0" ViewCount="232" Body="&lt;p&gt;So i'm trying to pass the variables from a dynamic route to a template and then to use those variables to filter trough entries.&#xA;the catch is that the same template is used to display an &quot;organic&quot;(by organic i mean that it is set up from the CP) category as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the routes.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'shop/(?P&amp;lt;segmentCategory&amp;gt;(new|used))/(?P&amp;lt;segmentEntryType&amp;gt;[a-z]+)' =&amp;gt; 'shop/category',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is from the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if segmentCategory is defined %}&#xA;    {% set category = craft.categories(segmentCategory) %}&#xA;    {% set games = craft.entries({&#xA;        type: segmentEntryType,&#xA;        relatedTo: ['and',&#xA;            { sourceElement: craft.entries.section(segmentEntryType).status(null) },&#xA;            { targetElement: category }&#xA;        ]&#xA;    }) %}&#xA;{% else %}&#xA;    {% set entries = craft.entries.relatedTo(category) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Object of class Craft\ElementCriteriaModel could not be converted to string&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;craft/templates/shop/category.html(47)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;47 {% extends &quot;_layout&quot; %} ||||||||||||||(Highlighted)||||||||||||||||&#xA;48 {% block content %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-08-05T04:42:33.927" Title="Error while trying to use dynamic routing to pass variables to the template and using them" Tags="&lt;filter&gt;&lt;entry-type&gt;&lt;routing&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10854" PostTypeId="2" ParentId="10853" CreationDate="2015-08-05T04:42:33.927" Score="3" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories(segmentCategory).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without the &lt;code&gt;first&lt;/code&gt; at the end, you're setting &lt;code&gt;category&lt;/code&gt; to an ElementCriteriaModel. Which would be fine in many cases, but it's not an &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;acceptable variable type&lt;/a&gt; for &lt;code&gt;targetElement&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ditto for the &lt;code&gt;sourceElement&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(segmentEntryType).status(null).first&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-05T04:42:33.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10855" PostTypeId="2" ParentId="10851" CreationDate="2015-08-05T06:51:13.143" Score="1" Body="&lt;p&gt;You can use the &lt;code&gt;defaultValue&lt;/code&gt; to determine if the value is there or not. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('myVar', -1) != -1 %}&#xA;  myVar is here!&#xA;{% else %}&#xA;  myVar is missing...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-08-05T06:51:13.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10856" PostTypeId="2" ParentId="10848" CreationDate="2015-08-05T08:32:20.060" Score="3" Body="&lt;p&gt;There's no clean way doing this without making changes to the plugin itself. The  &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#the-contactformbeforesend-event&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;contactForm.beforeSend&lt;/code&gt;&lt;/a&gt; event makes it possible to prevent the email from being sent from another plugin, but you're only being passed the compiled email message as a string. It's probably possible to post you checkbox data with that string and parse for it in your event listener, but you asked for a clean solution! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So fork the plugin and add a new attribute to the ContactFormModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'agreedToTerms' =&amp;gt; array(AttributeType::Enum, 'required' =&amp;gt; true, 'values' =&amp;gt; array(true)),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And make the ContactFormController get the attribute value from your form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$message-&amp;gt;agreedToTerms = craft()-&amp;gt;request-&amp;gt;getPost('agreedToTerms');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're now all set add a checkbox &quot;agreedToTerms&quot; to your form and add a custom error message in case the model attribute failed validation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;agreedToTerms&quot; value=&quot;true&quot; {{ message is defined and message.agreedToTerms ? 'checked' }}&amp;gt; Agree the Terms and Conditions&amp;lt;/label&amp;gt;&#xA;&#xA;{% if message is defined and message.hasErrors('agreedToTerms') %}&#xA;    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&amp;lt;li&amp;gt;{{ 'You must agree the Terms and Conditions'|t }}&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-05T08:32:20.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10857" PostTypeId="2" ParentId="10851" CreationDate="2015-08-05T09:54:23.780" Score="4" Body="&lt;p&gt;A parameter with no value set returns an empty string &lt;code&gt;''&lt;/code&gt; for &lt;code&gt;craft.request.getParam()&lt;/code&gt;. But if the whole parameter is not included at all, it returns &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means you can test for &lt;code&gt;null&lt;/code&gt; (→ &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/null.html&quot; rel=&quot;nofollow&quot;&gt;see Twig docs&lt;/a&gt;) like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('myparam') is not null %}&#xA;    My Parameter is included in the query string!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-05T09:54:23.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10858" PostTypeId="2" ParentId="10659" CreationDate="2015-08-05T11:19:24.677" Score="3" Body="&lt;p&gt;I tried a few different solutions but didn’t find anything user friendly enough, and ended up writing a Redactor plugin that adds a button to toggle a class on any selected links.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var RedactorPlugins = window.RedactorPlugins || {};&#xA;&#xA;RedactorPlugins.toggleButton = function()&#xA;{&#xA;    return {&#xA;        init: function()&#xA;        {&#xA;            var button = this.button.add('toggle-button', 'Toggle Button');&#xA;&#xA;            this.button.setAwesome('toggle-button', 'fa-minus-square-o');&#xA;&#xA;            this.button.addCallback(button, function()&#xA;            {&#xA;                this.link.toggleClass('button');&#xA;                this.code.sync();&#xA;            });&#xA;        }&#xA;    };&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There’s some extra styles to keep things tidy but the actual functionality is covered in the above-pasted snippet.&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2015-08-05T11:19:24.677" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10859" PostTypeId="1" CreationDate="2015-08-05T14:30:13.220" Score="1" ViewCount="130" Body="&lt;p&gt;I'll explain a bit of the structure of the content and then proceed to the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i have a website with a shop in it with the url mysite.com/shop/,&#xA;it is an channel section, and its template is located at craft/templates/shop/index.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shop is divided in to 2 categories - &quot;new&quot;, and &quot;used&quot;,&#xA;the url for each is mysite.com/shop/(used or new), and its template is located at craft/templates/shop/category.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section(channel) shop that is mentioned above also has multiple entry types, for example &quot;televisions&quot;, &quot;consoles&quot;, &quot;computers&quot;... and each one has a required category field to chose one of the above(new or used), and the url for those entries is 'shop/{condition.first().slug}/{type}/{slug}'&#xA;(the condition field is the category).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to what i'm trying to do, and whats the issue.&#xA;I want the user to be able to filter through entry types within the category template. what i mean is that te used could click &quot;show only tv's&quot;&#xA;and a url with the new filter will load but with the same template, so the url would look like that:&#xA;mysite.com/shop/used/television/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To accomplish that i've made a new dynamic route by adding the nex line to my routes.php:&#xA;&lt;code&gt;'shop/(?P&amp;lt;segmentCategory&amp;gt;(new|used))/(?P&amp;lt;segmentEntryType&amp;gt;[a-z]+)' =&amp;gt; 'shop/category',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the template goes like this(the twig part only):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if segmentCategory is defined %}&#xA;    {% set category = craft.categories.slug(segmentCategory).first() %}&#xA;    {% set entries = craft.entries({&#xA;        type: segmentEntryType,&#xA;        relatedTo: ['and',&#xA;            { sourceElement: category },&#xA;            { targetElement: craft.entries.type(segmentEntryType).status(null).first }&#xA;        ]&#xA;    }) %}&#xA;    {% if not entries %}&#xA;        {% exit 404 %}&#xA;    {% endif %}&#xA;{% else %}&#xA;    {% set entries = craft.entries.relatedTo(category) %}&#xA;{% endif %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% else %}&#xA;    There are no entries matching you criteria right no, please try again in a few days.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having two issues with this code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First:&lt;/strong&gt; &lt;code&gt;{% if not entries %}&lt;/code&gt; never executes, even if i enter complete nonsense in the url.&#xA;&lt;strong&gt;Second:&lt;/strong&gt; the array &lt;code&gt;entries&lt;/code&gt; is never outputs anything...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks ahead!&lt;/p&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-08-06T13:14:56.727" Title="Looping through returns nothing after using dynamic routes to get the entry type and category" Tags="&lt;categories&gt;&lt;routes&gt;&lt;entry-type&gt;&lt;forloop&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10860" PostTypeId="2" ParentId="10859" CreationDate="2015-08-05T15:06:00.790" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;{% if not entries %}&lt;/code&gt; never executes, even if i enter complete nonsense in the url.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You’re not ensuring that &lt;code&gt;segmentCategory&lt;/code&gt; is a valid category slug anywhere. If it’s not, then &lt;code&gt;category&lt;/code&gt; will get set to &lt;code&gt;null&lt;/code&gt;, which will basically prevent it from affecting the following &lt;code&gt;relatedTo&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So right after grabbing the &lt;code&gt;category&lt;/code&gt; you should make sure it exists;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(segmentCategory).first() %}&#xA;{% if not category %}&#xA;  {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the array entries is never outputs anything&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think this is because your &lt;code&gt;relatedTo&lt;/code&gt; parameter isn’t set up correctly. If the used/new categories are being assigned to the entries via a Categories field on the entry, then the category should be set to the &lt;code&gt;targetElement&lt;/code&gt; property, not &lt;code&gt;sourceElement&lt;/code&gt;, since the category is the &lt;em&gt;target&lt;/em&gt; element of the relation. And you can just get rid of the current &lt;code&gt;targetElement&lt;/code&gt; stuff, which should have been &lt;code&gt;sourceElement&lt;/code&gt;, but is redundant and doesn’t need to be specified anyway.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    type: segmentEntryType,&#xA;    relatedTo: { targetElement: category }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Ok, now i get the posts, but if i pass an invalid string to the segmentEntryType the template still loads.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entries|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(At this point in your template, &lt;code&gt;entries&lt;/code&gt; will be a defined ElementCriteriaModel regardless of whether it matches any entries. Including the &lt;code&gt;length&lt;/code&gt; filter in your conditional will force it to execute the DB query and return the actual results.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-08-06T13:14:56.727" LastActivityDate="2015-08-06T13:14:56.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10861" PostTypeId="1" AcceptedAnswerId="10874" CreationDate="2015-08-05T15:45:33.670" Score="2" ViewCount="613" Body="&lt;p&gt;I'm struggling to figure out how to do this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We have a bunch of entries in single a channel.&lt;/li&gt;&#xA;&lt;li&gt;There are two category groups an entry can be assigned to, with multiple categories in each group.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We want to show all entries, but grouped in a nested format as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Loop through Category Group One and get the entries grouped by each category.&lt;/li&gt;&#xA;&lt;li&gt;Within each Group One category, loop through Category Group Two, to output entries grouped by Category Group Two categories.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've found Relations hard enough to wrap my head around when I'm passing just a single category, but this has melted my mind completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more specifics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Group One has categories which are days of the week: Mon, Tue, Wed, Thus, Fri, Sat, Sun.&lt;/li&gt;&#xA;&lt;li&gt;Category Group Two has categories that are activities: Walking, Running, Skiing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The output ought to be grouped something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mon - Walking [entry title, entry title, entry title]&#xA;Mon - Running [entry title]&#xA;Mon - Skiing  [entry title, entry title]&#xA;Tue - Walking [...]&#xA;Tue - Running [...]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the code I've got closest with, but it's outputting duplicate entries within each day group...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set days       = craft.categories.group('day') %}&#xA;{% set activities = craft.categories.group('activity') %}&#xA;&#xA;{% for day in days %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ day.title }}&#xA;        {% for activity in activities %}&#xA;            {{ activity.title }}&#xA;            {% for entry in craft.entries.section('attractions').relatedTo(&#xA;                'and',&#xA;                { targetElement: day },&#xA;                { targetElement: activity }&#xA;            ) %}&#xA;                    {% if loop.first %}&amp;lt;ul&amp;gt;{% endif %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2015-08-05T16:13:12.800" LastActivityDate="2019-01-07T02:29:58.347" Title="Sorting Entries by category, from multiple category groups" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10862" PostTypeId="1" AcceptedAnswerId="10863" CreationDate="2015-08-05T16:15:56.000" Score="4" ViewCount="755" Body="&lt;p&gt;I have a case where I need to use a numeric field which also has a default value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;numericField&lt;/code&gt; needs to have a minimum value of 100 and a max value of 1000, but when the user adds a new entry, the field value should default to 256 in the entry form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I cannot trust the user to enter the correct default value, even if it is clearly indicated in the field notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, when the user adds a new entry, &lt;code&gt;numericField&lt;/code&gt; will always be set to 100 the minimum value.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another integer field type which would work as I have described?&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="57" LastEditDate="2015-08-05T16:20:54.560" LastActivityDate="2015-08-05T16:34:22.307" Title="How to use a Numeric Field with a Default Value" Tags="&lt;field&gt;&lt;integer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10863" PostTypeId="2" ParentId="10862" CreationDate="2015-08-05T16:34:22.307" Score="2" Body="&lt;p&gt;You can:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Write a plugin that extends Craft's native Number field type and adds the functionality you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Make a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; for a default value for the native Number field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Potentially fake it using something like the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-05T16:34:22.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10864" PostTypeId="2" ParentId="1834" CreationDate="2015-08-05T17:47:44.163" Score="2" Body="&lt;p&gt;I've posted a recipe for dynamically-generated nav menus which encompasses a lot of logic to determine the active page/section/etc: &lt;a href=&quot;https://craftcookbook.net/recipes/fully-dynamic-hierarchical-nav-menu-template&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fully Dynamic Hierarchical Nav Menu Template&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="3931" LastEditDate="2017-04-07T15:01:02.270" LastActivityDate="2017-04-07T15:01:02.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10866" PostTypeId="1" AcceptedAnswerId="10869" CreationDate="2015-08-06T00:23:30.007" Score="0" ViewCount="84" Body="&lt;p&gt;I'm gungho to get started building in Craft but I don't want the complications of moving the site over from a development directory. Is there a way to easily do this while the current site is up and running?&lt;/p&gt;&#xA;" OwnerUserId="3936" LastActivityDate="2015-08-06T08:07:58.377" Title="Can you beta build a Craft site in the www directory while the current site is still running?" Tags="&lt;installation&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10868" PostTypeId="1" AcceptedAnswerId="10873" CreationDate="2015-08-06T07:40:36.200" Score="3" ViewCount="83" Body="&lt;p&gt;I have a split-style &lt;code&gt;+ New Element&lt;/code&gt; button for my custom element type. Thanks to &lt;a href=&quot;https://craftcms.stackexchange.com/q/10838/45&quot;&gt;this previous thread&lt;/a&gt;, the right-side dropdown menu is working perfectly!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4lqDA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4lqDA.png&quot; alt=&quot;Split button&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question now is, &lt;strong&gt;how do I get the &lt;code&gt;+ New Element&lt;/code&gt; side of it working?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I keep studying the &lt;code&gt;entries&lt;/code&gt; templates, to see how it's done over there. But I've noticed that when you navigate between entry sources, &lt;em&gt;the page URL actually changes&lt;/em&gt;. When navigating between my custom element sources, the page URL does not change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I help the &lt;code&gt;+ New Element&lt;/code&gt; button detect what source is currently being viewed?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-08-06T13:26:22.280" Title="Detect currently selected source of custom elements" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10869" PostTypeId="2" ParentId="10866" CreationDate="2015-08-06T08:07:58.377" Score="2" Body="&lt;p&gt;In general, developing a website on the live server is a risky thing. Should something go wrong while you're developing then you risk the live website. It's unlikely, but an accidental upload to the wrong folder, or a wonky SQL statement, or anything like that can happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you must run the site on the live server though, your best bet is to set up a sub-domain such as beta.mywebsite.com. Host that on your live server and do all the development there. Then, when it's time to retire the old site and make the new one 'live', you can move the files across from the beta directory to the www one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wouldn't recommend doing that though. Much less risky to get your local machine set up as a development server, do it all on that, and then put the site live.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-08-06T08:07:58.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10870" PostTypeId="1" AcceptedAnswerId="10881" CreationDate="2015-08-06T09:42:48.233" Score="3" ViewCount="412" Body="&lt;p&gt;My orignal website is a Onepager but I am creating a individual news page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to extend a block to another page taking over the content from that single? I have a block filled with a really big Matrix field which I cant have on my other page cause I only need a small amount of content from it. This content is placed inside a block so I need to extend just that block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I need is to extend the {% block navigation %} and not the entire page&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See it as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block navigation %}&#xA;  {% for block in entry.blokken %}&#xA;    {% if block['opnemenInNavigatie'] is defined and block.opnemenInNavigatie %}&#xA;       &amp;lt;li&amp;gt;&#xA;        {% if block.navigatieNaam | slugify == 'news' %}&#xA;         &amp;lt;a href=&quot;/{{ block.navigatieNaam | slugify }}&quot;&amp;gt;          &#xA;          {{ block.navigatieNaam }} &#xA;        &amp;lt;/a&amp;gt;&#xA;       {% endif %}&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    {% for block in entry.blokken %}&#xA;        {% include 'blocks/' ~ block.type ~ '.html' %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="22" LastEditDate="2017-05-09T23:38:30.420" LastActivityDate="2017-05-09T23:38:30.420" Title="Extending a block from another page" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10871" PostTypeId="1" AcceptedAnswerId="10892" CreationDate="2015-08-06T11:02:17.837" Score="1" ViewCount="114" Body="&lt;p&gt;I am getting a strange whitespace character when using a different language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All languages use the same templates/database/plugins etc.&#xA;But when I go to any other language except the default I get a whitespace character before the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what this is coming form. Its there when I disable all plugins and use a blank template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ilgtt.png&quot; alt=&quot;Screenshot of whitspace&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2184" LastActivityDate="2015-08-07T13:41:15.823" Title="Whitespace created a start of HTML" Tags="&lt;templating&gt;&lt;error&gt;&lt;whitespace&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10872" PostTypeId="1" CreationDate="2015-08-06T12:24:11.117" Score="2" ViewCount="400" Body="&lt;p&gt;I am trying to check if a value provided by the user (url segment) matches an entry type, and if not redirect to 404.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionByHandle('shop') %}&#xA;{% set entryTypes = section.getEntryTypes('handle') %}&#xA;{% if not segmentEntryType in entryTypes|keys %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;segmentEntryType&lt;/code&gt; is the string from the segment.&#xA;i get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An exception has been thrown during the compilation of a template (&quot;Node &quot;1&quot; does not exist for Node &quot;Twig_Node&quot;.&quot;).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2015-08-06T12:24:11.117" Title="Checking if a value matches an entry type handle" Tags="&lt;error-message&gt;&lt;entry-type&gt;&lt;array&gt;&lt;segments&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10873" PostTypeId="2" ParentId="10868" CreationDate="2015-08-06T13:26:22.280" Score="3" Body="&lt;p&gt;You can see how this is working by opening craft/app/resources/js/craft.js and searching for the &lt;code&gt;Craft.EntryIndex&lt;/code&gt; class definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft.EntryIndex is an extension of Craft.BaseElementIndex, and is used to govern &lt;em&gt;all&lt;/em&gt; Entry indexes in Craft (including Entry selection modals). We pull that off with this line of code, which you’ll find immediately after the class definition:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;Craft.registerElementIndexClass('Entry', Craft.EntryIndex);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The logic governing the “New Entry” button is a little complicated, and it relies on an initial version of the button HTML already being available on the page (thanks to the craft/app/templates/entries/_edit.html template), but all the magic happens within its onSelectSource() method, including updating the URL.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-06T13:26:22.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10874" PostTypeId="2" ParentId="10861" CreationDate="2015-08-06T14:44:54.187" Score="3" Body="&lt;p&gt;Finally figured it out, I had been so close! The following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set days       = craft.categories.group('day') %}&#xA;{% set activities = craft.categories.group('activity') %}&#xA;&#xA;    {% for day in days %}&#xA;        &amp;lt;h2&amp;gt;{{ day.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% for activity in activities %}&#xA;            {% set entries = craft.entries.section('attractions').relatedTo(&#xA;              'and',&#xA;              { targetElement: day },&#xA;              { targetElement: area }&#xA;            ) %}&#xA;&#xA;            {% if entries | length %}&#xA;                &amp;lt;h3&amp;gt;{{ area.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                {% for entry in entries %}&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; {{ entry.startTime|date('H:i') }}&amp;lt;/p&amp;gt;&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-08-06T14:44:54.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10875" PostTypeId="1" AcceptedAnswerId="10879" CreationDate="2015-08-06T14:49:07.347" Score="4" ViewCount="649" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; to find locations ordered by distance. But I can only set 3 parameters: target, range and units. However, when my range goes beyond the country borders I obviously get results in other countries. I want to list all locations within a country by distance, but limited to that country.&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to do this? I tried related items, but can't seem to get it to work. And I don't see any option in Smart Map either.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="45" LastEditDate="2021-01-01T06:20:32.227" LastActivityDate="2021-01-01T06:21:38.443" Title="Filter locations by country in Smart Map" Tags="&lt;relations&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10876" PostTypeId="1" CreationDate="2015-08-06T16:29:24.903" Score="0" ViewCount="469" Body="&lt;p&gt;I've put together an entry form with a front end file upload, following the excellent answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2113/does-anyone-have-a-working-example-of-frontend-form-with-multiple-file-upload-d&quot;&gt;here&lt;/a&gt;. It works perfectly, for logged in users only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering is this method is at all workable for guests? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I attempt a file upload via the front end form when not logged in, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/login&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The form submission works with text data, but the file field is not populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to accept resume pdfs on a public job application form, hence the need for this to work for non-authenticated users. &lt;/p&gt;&#xA;" OwnerUserId="2273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-08-06T16:55:36.093" Title="Front End Upload Form for guests" Tags="&lt;assets&gt;&lt;form&gt;&lt;entry&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10878" PostTypeId="2" ParentId="10875" CreationDate="2015-08-06T16:45:53.023" Score="5" Body="&lt;p&gt;What I've done to do something very similar is to add a template variable to my BusinessLogic plugin, that takes the ElementCriteriaModel, prepared with all other parameters e.g. section, limit and SmartMap set. The plugin then translates the model into a &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii CDbCommand&lt;/a&gt; using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;buildElementsQuery&lt;/code&gt;&lt;/a&gt;, adds the additional conditions to the query and returns the further filtered entry models to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my service function with modifications for your country filtering needs. It#s untested but should probably work as is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCountryCriteria(ElementCriteriaModel $criteria, $country)&#xA;{&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    // Add where condition for country filter&#xA;    $params = array(':country' =&amp;gt; $country);&#xA;    $conditions = array('smartmap_addresses.country = :country');&#xA;&#xA;    $query-&amp;gt;andWhere($conditions, $params);&#xA;&#xA;    // Join addresses table to bring in the state&#xA;    $query-&amp;gt;leftJoin('smartmap_addresses smartmap_addresses', 'smartmap_addresses.elementId = entries.id');&#xA;&#xA;    // Get query results and populate entry models&#xA;    $results = $query-&amp;gt;queryAll();&#xA;&#xA;    return EntryModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also have a look at my other answers on how to add conditions to CDbCommand from the template:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/10149/125&quot;&gt;How do I select entries that have a particular block type?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/9999/125&quot;&gt;Filtering Matrix through field value and multiple relations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-08-06T16:45:53.023" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10879" PostTypeId="2" ParentId="10875" CreationDate="2015-08-06T16:48:15.370" Score="4" Body="&lt;p&gt;At the moment, there's no in-plugin way to handle this. However, you can probably do it out-of-plugin, once you've retrieved a larger set of results.&lt;/p&gt;&#xA;&lt;p&gt;So first, you'd &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/&quot; rel=&quot;nofollow noreferrer&quot;&gt;get the largest possible results set:&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    target: targetLocation,&#xA;    range:  10000,&#xA;    units:  'kilometers'&#xA;} %}&#xA;&#xA;{% set entries = craft.entries.myFieldHandle(params).order('distance').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, you'd cycle through those results to filter only the entries from your desired country:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set desiredCountry = 'France' %}&#xA;{% set filteredByCountry = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% if entry.myFieldHandle.country == desiredCountry %}&#xA;        {% set filteredByCountry = filteredByCountry|merge([entry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once you've done that, you'll have a &lt;code&gt;filteredByCountry&lt;/code&gt; array of entries, which should be exactly the results set you were looking for.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:21:38.443" LastActivityDate="2021-01-01T06:21:38.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10881" PostTypeId="2" ParentId="10870" CreationDate="2015-08-06T17:00:27.500" Score="3" Body="&lt;p&gt;I'd just put whatever you want to share into an include. Also you shouldn't need the &lt;code&gt;.html&lt;/code&gt; either as craft should find the file&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2015-08-06T17:00:27.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10882" PostTypeId="1" AcceptedAnswerId="10886" CreationDate="2015-08-06T17:30:59.930" Score="4" ViewCount="549" Body="&lt;p&gt;I'll start off by saying my plugin is working perfectly locally. The problem is when I upload to my server. My plugin is for a contact form. It handles the submission, and logs the entry in the db.&lt;/p&gt;&#xA;&lt;p&gt;I have a page in the CP for it as well - this is the page that is giving me the white screen.&lt;/p&gt;&#xA;&lt;p&gt;With &lt;code&gt;devMode&lt;/code&gt; I am seeing this in the logs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /path-to-my-site/craft/app/controllers/TemplatesController.php:59&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So I looked up that file, and to me it seems that the system can't find a template?&lt;/p&gt;&#xA;&lt;p&gt;I don't get any errors - although when I try to submit my form, I do get a 500 error. Could it be a permissions problem?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Everything else in the entire site/app is working perfectly, so I know it's something with the plugin page.&lt;/p&gt;&#xA;&lt;p&gt;My plugin &amp;quot;settings&amp;quot; page renders/works fine. It's when I click on the top &amp;quot;tab&amp;quot; to access my plugin's page within the CP that fails.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering if it's a case-sensitive thing now though. I don't see that exact error in the log file anymore.&lt;/p&gt;&#xA;&lt;p&gt;I know with CodeIgniter, locally things work great, but when I upload to my server (CentOS) I get white screens. It's because of the case is all strange.&lt;/p&gt;&#xA;&lt;p&gt;I have followed the suggested guidelines for plugin development:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;controllers&#xA;    ContactFormPlugin.php&#xA;    controllers&#xA;        ContactFormController.php&#xA;            class ContactFormController extends BaseController {...}&#xA;    models&#xA;        ContactFormModel.php&#xA;            class ContactFormModel extends BaseModel{...}&#xA;&#xA;   records&#xA;        ContactFormRecord.php&#xA;            class ContactFormRecord extends BaseRecord{...}&#xA;   &#xA;   resources&#xA;        ...&#xA;&#xA;   services&#xA;         ContactFormService.php&#xA;             class ContactFormService extends BaseApplicationComponent {...}&#xA;&#xA;   templates&#xA;       ...&#xA;&#xA;   variables&#xA;       ContactFormVariable.php&#xA;           class ContactFormVariable {...}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;...and so on.&lt;/p&gt;&#xA;&lt;p&gt;My host is Rackspace, has anyone experienced this?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-08-07T04:22:30.367" Title="Plugin CP page causes white screen" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10883" PostTypeId="2" ParentId="1834" CreationDate="2015-08-06T18:30:59.007" Score="0" Body="&lt;p&gt;IMO, this is a much more flexible soloution, albeit a plugin: &lt;a href=&quot;https://github.com/am-impact/amnav/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/am-impact/amnav/&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the methods above, but kept running into issues where a client's single exception to the navigation structure would cause a bunch of extra work.  For example, they might want a single in the middle of a structure hierarchy or a channel entry as the child of a single, typical requests for clients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a dedicated structure for the menus and another for the content only confuses clients and they end up messing things up in result.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the A&amp;amp;M nav plugin solved most of these issues. You can change the Menu label to whatever you want, and having a menu called 'Menus' is much easier for the client than searching through the entries for the 'menu structure' The only drawback to the plugin is that the menus must be added to the manually, however there is a handy Navigation field type to handle that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-08-06T18:30:59.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10884" PostTypeId="1" CreationDate="2015-08-06T19:55:53.647" Score="3" ViewCount="183" Body="&lt;p&gt;Hi is there a way that we can manage the S3 bucket and configuration from craft general default config per envirenmont?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are doing automated deployments to different envirenmonts which migrate the databases but are still manually changing the s3 bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ian&lt;/p&gt;&#xA;" OwnerUserId="3940" LastActivityDate="2018-04-19T16:21:47.273" Title="Multiple Environments Multiple S3" Tags="&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10885" PostTypeId="2" ParentId="10884" CreationDate="2015-08-06T23:30:26.477" Score="2" Body="&lt;p&gt;Currently not, but there probably &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;should be&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is already a somewhat related, similar &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7179038-cloud-based-asset-sources-should-support-environme&quot; rel=&quot;nofollow&quot;&gt;feature request here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-06T23:30:26.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10886" PostTypeId="2" ParentId="10882" CreationDate="2015-08-07T04:22:30.367" Score="3" Body="&lt;p&gt;Brad, Thank you again for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the problem, although I'm not sure of &quot;why&quot;. In my service file, I have this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;body = craft()-&amp;gt;templates-&amp;gt;renderString($settings-&amp;gt;welcomeEmailMessage, ['firstName' =&amp;gt; $contact-&amp;gt;firstName]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After digging though log file(s), I found the error. &quot;Unexpected '['&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It needed to be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;body = craft()-&amp;gt;templates-&amp;gt;renderString($settings-&amp;gt;welcomeEmailMessage, array('firstName' =&amp;gt; $contact-&amp;gt;firstName));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because everything was working perfectly on my local machine, (newer version of php) I wonder if that's the root cause.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-08-07T04:22:30.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10887" PostTypeId="1" CreationDate="2015-08-07T08:19:58.063" Score="1" ViewCount="429" Body="&lt;p&gt;I am using the Craft Prune plugin (&lt;a href=&quot;https://github.com/mattstauffer/craftcms-prune&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mattstauffer/craftcms-prune&lt;/a&gt;) to pull out a JSON array of entries from a section of my site with the aim of integrating the data into a typeahead search field as autocomplete data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I seem to be having is that the JSON array structure needs to be simplified for use as a datasource with typeahead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the current JSON data structure is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{&quot;title&quot;:&quot;Entry One Title&quot;}, {&quot;title&quot;:&quot;Entry Two Title&quot;}, {&quot;title&quot;:&quot;Entry Three Title&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I actually need the structure to be is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;Entry One Title&quot;, &quot;Entry Two Title&quot;, &quot;Entry Three Title&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have already tried using the jQuery $.each() function and the jQuery $.map() function but they both simply return an array of objects not a simple JS array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-08-07T13:06:34.887" Title="Using Craft Prune - convert JSON Array of Objects to simple array" Tags="&lt;javascript&gt;&lt;array&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10888" PostTypeId="1" AcceptedAnswerId="10895" CreationDate="2015-08-07T08:48:07.757" Score="2" ViewCount="787" Body="&lt;p&gt;I have a includeJS variable set that populates a javascript calendar from an entries loop, with a large amount of entries which needs to be cached. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I cache this section I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error while sending QUERY packet. PID=11878&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the problem here?&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-12T09:49:45.113" LastActivityDate="2015-12-09T00:20:53.803" Title="Error while sending QUERY packet" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10889" PostTypeId="1" CreationDate="2015-08-07T09:17:15.017" Score="2" ViewCount="584" Body="&lt;p&gt;I have just discovered that all Craft sites on our server no longer let users upload PNG files and I'm struggling to find the issue / fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The craft.log simply says 'Save operation failed' and the JS console mentions 500 internal server error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried various PNG formats, and weirdly other systems on our server using Imagemagick are running fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone had a similar issue / suggestions for debugging?&lt;/p&gt;&#xA;" OwnerUserId="375" LastActivityDate="2015-08-07T09:44:55.503" Title="PNG 500 error - Save operation failed" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10890" PostTypeId="2" ParentId="10889" CreationDate="2015-08-07T09:44:55.503" Score="2" Body="&lt;p&gt;If other image formats are working fine, then maybe check that you have Imagick installed and enabled on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install imagemagick php5-imagick&#xA;sudo service apache2 reload&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're on a shared host then either consult their knowledge base or contact support to check for Imagick availability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some servers/hosts only have the GD library installed by default, which isn't so good with PNG files.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-08-07T09:44:55.503" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10891" PostTypeId="2" ParentId="10887" CreationDate="2015-08-07T13:06:34.887" Score="2" Body="&lt;p&gt;Ended up working out a solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var myData = {{ craft.entries.section('sectionName').find() | prune(['title']) | json_encode() | raw  }};&#xA;    var myArray = $.makeArray(myData);&#xA;    var newArray = new Array();&#xA;    $.each( arr, function(key, value) {&#xA;        $.each(value, function(keyNew, valueNew){&#xA;            newArray.push(valueNew);&#xA;        });&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-08-07T13:06:34.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10892" PostTypeId="2" ParentId="10871" CreationDate="2015-08-07T13:41:15.823" Score="3" Body="&lt;p&gt;I finally found what the problem was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The translations files (/craft/translations/de.php) were encoded as &quot;UTF-8 with BOM&quot;&#xA;I opened these files in Sublime text and saved them as regular old UTF-8, which fixed the issue.&lt;/p&gt;&#xA;" OwnerUserId="2184" LastActivityDate="2015-08-07T13:41:15.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10893" PostTypeId="1" AcceptedAnswerId="13728" CreationDate="2015-08-07T17:13:28.060" Score="0" ViewCount="225" Body="&lt;p&gt;I've been having trouble getting a front-end profile template to save any data.&#xA;It was quite complex so I've gone back to a base install of Craft with no custom fields for a User.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the example code from the docs it still doesn't save any data.&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/user-profile-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is running the full version of Craft on localhost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a custom route of /profile set to a template called 'profile'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loading the page loads all currently stored data exactly the same as the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Submitting the form reloads the page but none of the input data is saved and redisplayed. Going to the CP also shows nothing was saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a few hours of trouble-shooting I discovered, on submit from the front-end template, the &lt;code&gt;saveUser&lt;/code&gt; method was not running. It was from the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding &lt;code&gt;action=&quot;{{ siteUrl }}&quot;&lt;/code&gt; to the form gets it working. But oddly then introduces the front controller in to the URL after submit, eg. &lt;a href=&quot;http://localhost/index.php/profile&quot; rel=&quot;nofollow&quot;&gt;http://localhost/index.php/profile&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no mention in the example code of a form requiring an &lt;code&gt;action&lt;/code&gt; value. I can't work out why the example code doesn't work or why I need &lt;code&gt;action&lt;/code&gt;. I'd rather not have the pretty URLs messed up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Profile&amp;lt;/h1&amp;gt;&#xA;&#xA;&amp;lt;form action=&quot;{{ siteUrl }}&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;profile&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;fieldset&amp;gt; &#xA;        &amp;lt;legend class=&quot;visually-hidden&quot;&amp;gt;Personal details&amp;lt;/legend&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;First name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot; placeholder=&quot;Jane&quot; required=&quot;required&quot; aria-required=&quot;true&quot; autofocus=&quot;autofocus&quot;&amp;gt;&#xA;&#xA;   &amp;lt;/fieldset&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Update 10-08-2015&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The profile form submitting seems to be a red-herring. When installing Craft I couldn't get it to work with clean URLs so I edited Apache's config to set 404s to redirect to crafts index.php. I'd since forgot. Local config:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mac OS X 10.10.4&lt;/li&gt;&#xA;&lt;li&gt;MAMP (not pro)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By default MAMP has &lt;code&gt;AllowOverride None&lt;/code&gt;. That was stopping the .htaccess file from working. I'm using vhosts so I've manually set this in the vhost config. Another gotcha is Crafts config of &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; and &lt;code&gt;usePathInfo&lt;/code&gt;. Craft caches test results for 24 hours, so I had to clear the cache before my updated vhost config worked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory &quot;/path/to/craft/public&quot;&amp;gt;&#xA;    Options FollowSymLinks&#xA;    AllowOverride All&#xA;    Order Allow,Deny&#xA;    Allow From All&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The title of this SE question is all wrong now but it's valuable info. OK to change? I'd also say this is a common enough set-up to be in the official docs?&lt;/p&gt;&#xA;" OwnerUserId="1069" LastEditorUserId="1069" LastEditDate="2015-08-10T14:39:25.737" LastActivityDate="2016-02-16T18:10:57.243" Title="Front end profile does not save data - form action" Tags="&lt;user-profile&gt;&lt;htaccess&gt;&lt;404&gt;&lt;mamp&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10894" PostTypeId="1" AcceptedAnswerId="10896" CreationDate="2015-08-08T00:29:52.883" Score="-6" ViewCount="1125" Body="&lt;p&gt;We would like to create custom blocks. Is it possible to create custom blocks? if yes, do you have a good tutorial?&lt;/p&gt;&#xA;" OwnerUserId="3942" LastActivityDate="2015-08-09T01:43:53.547" Title="How to create custom blocks" Tags="&lt;block-types&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10895" PostTypeId="2" ParentId="10888" CreationDate="2015-08-08T11:04:20.500" Score="4" Body="&lt;p&gt;So turns out this is to do with the size of the packet being sent to the database cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My server had a limit of: &#xA;max_allowed_packet = 1M&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doubling this solved my problem.&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-08T11:04:20.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10896" PostTypeId="2" ParentId="10894" CreationDate="2015-08-09T01:43:53.547" Score="3" Body="&lt;p&gt;I believe you're referring to &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix&lt;/a&gt; block types.  You can create additional block types for a Matrix field, or edit existing ones by going to that Matrix's &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields#settings&quot; rel=&quot;nofollow&quot;&gt;field settings&lt;/a&gt; under &lt;code&gt;Settings-&amp;gt;Fields-&amp;gt;(your matrix field)&lt;/code&gt; in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-09T01:43:53.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10897" PostTypeId="1" AcceptedAnswerId="10898" CreationDate="2015-08-09T20:36:12.093" Score="1" ViewCount="807" Body="&lt;p&gt;I am trying to set up a channel that uses different content for a series of Google Adwords landing pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set up the channel template as /landing-pages/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to remove the /landing-pages/ piece of the title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'd like short simple url, which is effectively the slug title, which would be something like /chef-jobs for this client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to achieve this with Craft? Redirects or Routing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The routing method doesn't call the entry and just shows a blank template, how can I feed the route address across if I use this method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help, much appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-08-09T22:42:31.760" Title="Redirects or Routing for Landing Page URL's?" Tags="&lt;redirect&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10898" PostTypeId="2" ParentId="10897" CreationDate="2015-08-09T22:34:30.640" Score="4" Body="&lt;p&gt;You can either set the URL Format of the landing pages channel to &lt;code&gt;{slug}&lt;/code&gt; (the same as your normal pages)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could try putting the landing pages in the normal pages structure, but give them a new entry type so you can use different fields.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-08-09T22:34:30.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10899" PostTypeId="2" ParentId="10897" CreationDate="2015-08-09T22:42:31.760" Score="3" Body="&lt;p&gt;No redirects or custom routes needed, just set the URI to &lt;code&gt;{slug}&lt;/code&gt; in your channel settings. The path to your template setting &lt;code&gt;landing-pages/_entry&lt;/code&gt; is only necessary for Craft internally, it does not affect the URL.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-09T22:42:31.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10900" PostTypeId="1" CreationDate="2015-08-10T09:47:20.627" Score="5" ViewCount="1400" Body="&lt;p&gt;I have a gallery which is categorised. The gallery is a Structure section where the user adds an entry and then assigns it to a category - all good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, when clicking on an entry title the URL is &lt;em&gt;mysite.com/gallery/entry-slug&lt;/em&gt;  but I would like it to be &lt;em&gt;mysite.com/gallery/&lt;strong&gt;category-name&lt;/strong&gt;/entry-slug&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked around the Docs and StackExchange for a simple answer (assuming it would just be the addition of a tag) but the solutions seem very convoluted and way outside my grasp of understanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2018-11-07T06:11:42.313" Title="Get the Category name into the URL for an entry" Tags="&lt;categories&gt;&lt;url&gt;&lt;tags&gt;&lt;category&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10901" PostTypeId="2" ParentId="10900" CreationDate="2015-08-10T10:28:47.163" Score="6" Body="&lt;p&gt;A Categories field can be related to several categories. So you'll either need to limit your Category field to a single Category relationship or you'll need to make some assumption in how you build your URL as to which category will appear in the URL. The simplest assumption to make will be that you will always return the first category for your URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry URL Format in the Section Settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gallery/{categories.one().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Entry Page URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/gallery/category-slug/entry-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the Entry URL Format setting above, you are telling your slug to return the &lt;code&gt;slug&lt;/code&gt; of the first item in your array of categories using this line: &lt;code&gt;{categories.first().slug}&lt;/code&gt; where &lt;code&gt;categories&lt;/code&gt; is the handle of your Categories Relations field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to ensure your Categories Relations field is required.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-11-07T06:11:42.313" LastActivityDate="2018-11-07T06:11:42.313" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10902" PostTypeId="1" CreationDate="2015-08-10T11:53:22.790" Score="0" ViewCount="562" Body="&lt;p&gt;I am exporting some fields to an XML feed. There is a rich text field with typically 4 paragraphs in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default export kicks out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Some text&amp;lt;/p&amp;gt; tags as well as stuff like &amp;lt;strong&amp;gt;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is easy to remove with |striptags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this results in text that doesn't have proper spacing and removes any intended carriage returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can fix the spacing with a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|replace(&quot;.&quot;, &quot;. &quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'd rather have the the Paragraphs to still have carriage returns as intended. I know I can add in the right UTF-8 symbol, but I don't want this in the data, I just want the spacing and carriage returns as if it were a plain text field and not to have the UTF-8 symbols in the feed itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.fileformat.info/info/unicode/char/000D/index.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.fileformat.info/info/unicode/char/000D/index.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help, much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-08-10T18:32:00.973" Title="Can I convert rich text field to have plain text output - with carriage returns?" Tags="&lt;replace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10903" PostTypeId="1" AcceptedAnswerId="10905" CreationDate="2015-08-10T13:07:01.233" Score="2" ViewCount="563" Body="&lt;p&gt;I have a website setup in Craft multi-environment config for git workflow with a development branch automatically deploying via deploybot from a bitbucket repository.   I want to add an additional live server for manual deployment via deploybot, but I'm concerned about the folder structure.  I know the &lt;code&gt;public&lt;/code&gt; folder in Craft is just a stand in for &lt;code&gt;web_root&lt;/code&gt;, but if I allow git to deploy to the server root, won't it try to make a new &lt;code&gt;public&lt;/code&gt; folder by default?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Staging setup&#xA;&lt;code&gt;/home/user/public_html/staging/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Live site &#xA;&lt;code&gt;/home/user/public_html/index.php&lt;/code&gt; instead of &#xA;&lt;code&gt;/home/user/public/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen where I can add a symlink to point one folder to another, but I don't think I can point &lt;code&gt;public_html&lt;/code&gt; to a new public folder as I have other subdomains stored in &lt;code&gt;public_html&lt;/code&gt;.   Should I just rename &lt;code&gt;public&lt;/code&gt; in my Craft files to &lt;code&gt;public_html&lt;/code&gt; in the local and staging files, or can I symlink &lt;code&gt;public&lt;/code&gt; to &lt;code&gt;public_html&lt;/code&gt; without abandoning my existing files?&lt;/p&gt;&#xA;" OwnerUserId="519" LastEditorUserId="57" LastEditDate="2015-08-10T18:33:52.817" LastActivityDate="2015-08-11T02:11:33.710" Title="public vs public_html for git workflow deployment in apache?" Tags="&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10904" PostTypeId="1" AcceptedAnswerId="10910" CreationDate="2015-08-10T13:27:04.723" Score="1" ViewCount="82" Body="&lt;p&gt;any help on this one appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an entry url that is automated to take several fields and make the the uri.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It pulls the jobTitle, jobCity and jobId fields and then... well... this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jobs/{jobTitle|lower|url_encode|replace(&quot;%20&quot;, &quot;-&quot;)|replace(&quot;%2C&quot;,&quot;&quot;)|replace(&quot;%80&quot;,&quot;&quot;)|replace(&quot;%E2&quot;,&quot;&quot;)|replace(&quot;%8B&quot;, &quot;&quot;)}-{jobCity|lower|url_encode|replace(&quot;%20&quot;, &quot;-&quot;)|replace(&quot;%27&quot;, &quot;&quot;)}-{jobId}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see... it is a tad... long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is the % stuff that creeps in. Some times the job titles have odd characters that the url encode converts into % symbols. These then break the url and stop craft from displaying the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My short term solution has been to add lots of replace's for each one, but is there way to make a replace that uses a wildcard - so if it sees % it replaces the next two characters as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|replace(&quot;%wildcard&quot;,&quot;-&quot;) etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The current replaces work, but it just feels unwieldy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any advice.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-08-10T17:39:02.663" Title="Is it possible to create a cleaner replace?" Tags="&lt;templating&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10905" PostTypeId="2" ParentId="10903" CreationDate="2015-08-10T14:06:19.740" Score="3" Body="&lt;p&gt;Generally, you can make the Craft &lt;code&gt;public&lt;/code&gt; folder whatever you want it to be. That allows you to deploy to any folder you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I deploy to a &lt;code&gt;public_html&lt;/code&gt; on one server, &lt;code&gt;public&lt;/code&gt; on another and &lt;code&gt;web&lt;/code&gt; on another server. Each of those directories are the web root of their respective site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing(s) within the &lt;code&gt;public&lt;/code&gt; (or whatever you call it) directory is/are the index.php file (and whatever other js/css etc type files) you may have. As long as you can tell that file where the &lt;code&gt;craft&lt;/code&gt; directory is (usually one level above the web root) - you should be golden!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-08-11T02:11:33.710" LastActivityDate="2015-08-11T02:11:33.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10906" PostTypeId="1" CreationDate="2015-08-10T17:18:01.100" Score="1" ViewCount="91" Body="&lt;p&gt;For some reason that I cannot figure out, my plugin is sending 2 emails to each user instead on one. It sends the email on hit of an action url. Below is the function in my controller. Any help is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSendEmail()&#xA;{&#xA;&#xA;    $date = new DateTime();&#xA;    $date-&amp;gt;modify('-7 days');&#xA;&#xA;    // Format datetime for use in query&#xA;    $timezone = new \DateTimeZone(DateTime::UTC);&#xA;    $date = $date-&amp;gt;format(DateTime::MYSQL_DATETIME, $timezone);&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'guide';&#xA;    $criteria-&amp;gt;order = 'postDate desc';&#xA;    $criteria-&amp;gt;dateUpdated = '&amp;gt; '.$date;&#xA;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    if ($entries) {&#xA;&#xA;        $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;        $user_criteria-&amp;gt;groupId = '9';&#xA;        $users = $user_criteria-&amp;gt;find();&#xA;&#xA;        //Send to each User&#xA;        foreach ($users as $user) {&#xA;            //Send Mail&#xA;            $email = new EmailModel();&#xA;            $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;            $email-&amp;gt;subject = 'Updated in the Last 7 Days';&#xA;            $email-&amp;gt;htmlBody    = 'Body Goes Here';&#xA;&#xA;            craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;        }&#xA;&#xA;    // Redirect after sending to each user in the loop to avoid 404&#xA;    $this-&amp;gt;redirect('/');&#xA;&#xA;    }&#xA;    else {&#xA;        // do nothing and redirect to avoid 404&#xA;       $this-&amp;gt;redirect('/');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-08-10T18:37:57.710" Title="Help! My plugin is sending my email twice" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10907" PostTypeId="1" AcceptedAnswerId="10937" CreationDate="2015-08-10T17:26:24.280" Score="1" ViewCount="158" Body="&lt;p&gt;I've launched a site recently which is being hosted on Vidahost's &lt;a href=&quot;https://www.vidahost.com/page/cloud-hosting-feature-list&quot; rel=&quot;nofollow&quot;&gt;Cloud servers&lt;/a&gt;. After exactly 1 minute of inactivity, anyone using the control panel is signed out. Except that if you refresh the page when you're &quot;signed out&quot;, you're actually still signed in (but you lose any changes you were making).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've tried changing the config setting &lt;code&gt;overridePhpSessionLocation&lt;/code&gt; to auto, false and true, and nothing has changed. I've also tried changing the PHP version from 5.4 to 5.5 to no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I stop this from happening?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-08-12T12:44:33.617" Title="Getting 'signed out' after exactly 1 minute of inactivity" Tags="&lt;control-panel&gt;&lt;php&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10908" PostTypeId="1" CreationDate="2015-08-10T17:27:21.463" Score="5" ViewCount="1085" Body="&lt;p&gt;I want to have a public and private (logged in users) section on the front-end. Is that possible on craft?&lt;/p&gt;&#xA;" OwnerUserId="3949" LastActivityDate="2020-04-13T17:42:35.777" Title="Is it possible to have entries only visible to logged-in users?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10909" PostTypeId="2" ParentId="10908" CreationDate="2015-08-10T17:36:05.400" Score="8" Body="&lt;p&gt;Yes. You need to build a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot;&gt;frontend login form&lt;/a&gt; and then block non logged in users from seeing the entries with something along the lines of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.isLoggedIn %}&#xA;    {# put content here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also check if the user belongs to a specific group with &lt;code&gt;isInGroup('groupHandle')&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot;&gt;(more here)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-08-10T17:36:05.400" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10910" PostTypeId="2" ParentId="10904" CreationDate="2015-08-10T17:39:02.663" Score="3" Body="&lt;p&gt;I'm just gonna post my comment as an answer, because I think it's the way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#kebab&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;kebab&lt;/code&gt; filter&lt;/a&gt; instead of &lt;code&gt;url_encode&lt;/code&gt;, like this: &lt;code&gt;{jobTitle|kebab}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-08-10T17:39:02.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10911" PostTypeId="2" ParentId="10902" CreationDate="2015-08-10T18:32:00.973" Score="2" Body="&lt;p&gt;Completely untested, but you should be able to do use something like the &lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot; rel=&quot;nofollow&quot;&gt;Craft-TwigPCRE&lt;/a&gt; plugin and some variation of this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set text = &quot;&amp;lt;p&amp;gt;Some text&amp;lt;/p&amp;gt; tags as well as stuff like &amp;lt;strong&amp;gt;.|preg_replace('/\&amp;lt;p\&amp;gt;/', '') %}&#xA;&#xA;{% set text = text|preg_replace('/\&amp;lt;\/p\&amp;gt;/', '\\n') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;\n&lt;/code&gt; is the Line Feed control character for Unix/OSX.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-10T18:32:00.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10912" PostTypeId="2" ParentId="10906" CreationDate="2015-08-10T18:37:57.710" Score="2" Body="&lt;p&gt;So, this was being caused by selecting my action url from Chrome's url complete suggestions. Apparently, this submits the page twice. If the action url is typed in, pasted in or hit by my Chron job it works as expected. Firefox url suggest selection causes no problems.&lt;/p&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-08-10T18:37:57.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10913" PostTypeId="2" ParentId="10728" CreationDate="2015-08-11T08:26:08.453" Score="0" Body="&lt;p&gt;I think this might have happened due to a Craft update. You can see the difference between these two blog posts&lt;/p&gt;&#xA;&#xA;&lt;p&gt;July 16 - &lt;a href=&quot;http://roseandmary.com/blog/2015/friends-family-tasting-event&quot; rel=&quot;nofollow&quot;&gt;http://roseandmary.com/blog/2015/friends-family-tasting-event&lt;/a&gt;&lt;br&gt;&#xA;July 07- &lt;a href=&quot;http://roseandmary.com/blog/2015/the-rose-mary-team&quot; rel=&quot;nofollow&quot;&gt;http://roseandmary.com/blog/2015/the-rose-mary-team&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last post image doesn't have the border and every image uploaded since gets a single px white border.&lt;/p&gt;&#xA;" OwnerUserId="3734" LastActivityDate="2015-08-11T08:26:08.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10914" PostTypeId="1" AcceptedAnswerId="10917" CreationDate="2015-08-11T11:12:50.137" Score="4" ViewCount="483" Body="&lt;p&gt;I have content editors that speaks different languages. Is there a way to translate the name and introduction of a field in the control panel? A simple {{ &quot;value&quot;|t }} seams not to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: English content editors should see &quot;surname&quot; as field name and german speaking editors should see &quot;Nachname&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/90FR0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/90FR0.png&quot; alt=&quot;Field configuration&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2015-08-11T13:24:40.093" Title="Is it possible to translate the name of a field in the CP?" Tags="&lt;localization&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10915" PostTypeId="1" AcceptedAnswerId="10916" CreationDate="2015-08-11T11:15:33.620" Score="2" ViewCount="56" Body="&lt;p&gt;Super simple request, not sure if it's possible...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we pull all entries that were posted on a Monday, for example? Or pull all entries but group them by the day name they were posted on?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-08-11T12:40:47.537" Title="Getting all entries posted on any given weekday" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10916" PostTypeId="2" ParentId="10915" CreationDate="2015-08-11T12:40:47.537" Score="3" Body="&lt;p&gt;Can't think of a way how to query posts from a certain day, but you can certainly group entries by day they were posted on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog').limit(null) %}&#xA;{% for day, entries in allEntries | group(&quot;postDate|date('l')&quot;) %}&#xA;    &amp;lt;h2&amp;gt;{{ day }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-11T12:40:47.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10917" PostTypeId="2" ParentId="10914" CreationDate="2015-08-11T13:24:40.093" Score="4" Body="&lt;p&gt;Static text on the front-end and Craft CP translations are handled through your &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;translation files&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is name your fields without the translate filter and make sure they have suitable translation arrays in your translation files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth mentioning you will need &lt;a href=&quot;http://buildwithcraft.com/pricing&quot; rel=&quot;nofollow&quot;&gt;Craft Pro&lt;/a&gt; to take advantage of localisation and translation features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example to get you started, this will be added to the translation file for your German locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'Surname' =&amp;gt; 'Nachname',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-08-11T13:24:40.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10918" PostTypeId="1" CreationDate="2015-08-11T13:49:45.733" Score="2" ViewCount="1140" Body="&lt;p&gt;I have a channel that has three different entry types. The client has decided that two of those post types should be in a separate channel. This is an existing site with a few dozen entries currently in the channel, so I'm wondering if there's any easy way of splitting a channel like this that won't require me to manually set up a duplicate of the channel and then manually copy entries across, one by one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way of duplicating a channel with all its entries, so I can then just batch delete some entries within each channel? Or is there a way (a plugin, perhaps?) of moving entries of a particular type into a new channel? ...or would it be easier to keep the existing structure and via templates and routing create the appearance of two channels on the front end? (That's the best solution I've been able to come up with so far)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be very grateful for any advice / suggestions!&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-08-11T14:00:09.357" Title="How to move entries from one channel to another" Tags="&lt;entries&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10919" PostTypeId="2" ParentId="10918" CreationDate="2015-08-11T14:00:09.357" Score="3" Body="&lt;p&gt;Currently there isn't any core functionality in Craft for duplicating/moving entries between sections. I think this has been brought up a few times before, but I'd recommend heading over to &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Feedback&lt;/a&gt; and posting up about it there!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, back to your question. I did &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4433/move-entry-from-one-structure-to-another-with-parenting&quot;&gt;post something&lt;/a&gt; similar to this at the end of last year. I haven't used this particular code in a long time, and I'm afraid I can't currently test it for you right now, but it might be worth giving a try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth noting to take database backups before trying this in-case things start getting scary!&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-08-11T14:00:09.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10920" PostTypeId="1" AcceptedAnswerId="10921" CreationDate="2015-08-11T16:36:38.483" Score="2" ViewCount="348" Body="&lt;p&gt;I'm embarking on my first plugin build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs are OK, but lacking in some areas or maybe I'm just looking in the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The settings page allows you to define any settings and when rending out the template view, pass through those settings.&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/plugin-settings&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/plugin-settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It makes sense that all of the settings are going to be form fields. Where's the documentation for form helpers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking around at other plugins I can see an include to Craft's form templates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where's the docs on how to use these form fields? Is this a Twig thing and I should be looking at those docs? Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2015-08-11T16:54:47.860" Title="Plugin development: Forms" Tags="&lt;plugin-development&gt;&lt;form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10921" PostTypeId="2" ParentId="10920" CreationDate="2015-08-11T16:54:47.860" Score="2" Body="&lt;p&gt;There currently aren't any docs for &lt;code&gt;_includes/forms&lt;/code&gt;... you'll need to backwards engineer it. You'll notice some common patterns as you dig in there, which gives great insight into the overall Craft structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That file (or batch of files) is one of the most commonly backwards engineered parts of the core code. You may be able to find other posts (on Stack Exchange or blog posts) which describe it in some detail, but you'll still want to investigate on your own.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-11T16:54:47.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10922" PostTypeId="1" AcceptedAnswerId="10923" CreationDate="2015-08-11T19:48:40.147" Score="5" ViewCount="1208" Body="&lt;p&gt;The images I upload to Craft lose their quality :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without applying any transformation, the original file is blurred and has a smaller size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read this on another question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Currently the images are being cleansed on upload, which means that they are being re-saved to make sure that no malicious code is injected in them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;&lt;strong&gt;There is a way to get Craft uploading my pixel-perfect images without re-save them?&lt;/strong&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;An example of the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XKbNn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XKbNn.png&quot; alt=&quot;An example of the problem&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3955" LastEditorUserId="3955" LastEditDate="2015-08-11T19:55:16.200" LastActivityDate="2017-02-07T13:04:19.600" Title="Images lose quality when I upload to Craft" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10923" PostTypeId="2" ParentId="10922" CreationDate="2015-08-11T20:07:15.140" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;There is a way to get Craft uploading my pixel-perfect images without re-save them?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can upload via FTP and then run the &lt;code&gt;Update Asset Indexes&lt;/code&gt; tool from the Settings page in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to continue uploading from the control panel make sure that you're using &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; instead of &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will use Imagick if it is available to PHP by default or you can force Craft to use one or the other via the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#imageDriver&quot; rel=&quot;nofollow&quot;&gt;imageDriver&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-08-13T17:24:03.877" LastActivityDate="2015-08-13T17:24:03.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10924" PostTypeId="1" CreationDate="2015-08-11T20:20:46.737" Score="0" ViewCount="76" Body="&lt;p&gt;When using the live preview pane, each time I type something or move a block, the preview pane jumps to the top. When editing anywhere but the top, this is not ideal. Is this a bug? I also checked it on a previous site that I had built in Craft and I'm getting the same behavior.&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2015-08-11T21:37:20.343" Title="Live Preview is jumping to top of page on edit" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-08-12T19:10:46.137" ContentLicense="CC BY-SA 3.0" />
  <row Id="10925" PostTypeId="2" ParentId="10924" CreationDate="2015-08-11T21:37:20.343" Score="1" Body="&lt;p&gt;I have also noticed this happening, but the Craft Stack Exchange is not the best place to post about potential bugs/issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be worth submitting a bug report to support@pixelandtonic.com as they are best suited to take things from here!&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-08-11T21:37:20.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10926" PostTypeId="1" CreationDate="2015-08-11T22:11:40.990" Score="0" ViewCount="249" Body="&lt;p&gt;the file upload always does not finish and it shows no error alert. Also in the logs there is no error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only find an error in the browser debugger on actions/assets/uploadFile . Maybe the error helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n.ajaxTransport.k.cors.a.crossDomain.send @ jquery-2.1.4.min.js?d=1436808909:4n.extend.ajax @ jquery-2.1.4.min.js?d=1436808909:4$.widget._onSend.send @ jquery.fileupload.js?d=1436808910:880(anonymous function) @ jquery-2.1.4.min.js?d=1436808909:2n.Callbacks.j @ jquery-2.1.4.min.js?d=1436808909:2n.Callbacks.k.add @ jquery-2.1.4.min.js?d=1436808909:2(anonymous function) @ jquery-2.1.4.min.js?d=1436808909:2n.extend.each @ jquery-2.1.4.min.js?d=1436808909:2(anonymous function) @ jquery-2.1.4.min.js?d=1436808909:2n.extend.Deferred @ jquery-2.1.4.min.js?d=1436808909:2n.extend.Deferred.d.then @ jquery-2.1.4.min.js?d=1436808909:2$.widget._onSend @ jquery.fileupload.js?d=1436808910:924(anonymous function) @ jquery.ui.widget.js?d=1436808910:105$.widget._addConvenienceMethods.data.submit @ jquery.fileupload.js?d=1436808910:648(anonymous function) @ craft.js:13685n.extend.proxy.n.isFunction.f @ jquery-2.1.4.min.js?d=1436808909:2n.Callbacks.j @ jquery-2.1.4.min.js?d=1436808909:2n.Callbacks.k.add @ jquery-2.1.4.min.js?d=1436808909:2Craft.Uploader.Garnish.Base.extend.onFileAdd @ craft.js:13653n.extend.proxy.n.isFunction.f @ jquery-2.1.4.min.js?d=1436808909:2n.event.dispatch @ jquery-2.1.4.min.js?d=1436808909:3n.event.add.r.handle @ jquery-2.1.4.min.js?d=1436808909:3n.event.trigger @ jquery-2.1.4.min.js?d=1436808909:3(anonymous function) @ jquery-2.1.4.min.js?d=1436808909:3n.extend.each @ jquery-2.1.4.min.js?d=1436808909:2n.fn.n.each @ jquery-2.1.4.min.js?d=1436808909:2n.fn.extend.trigger @ jquery-2.1.4.min.js?d=1436808909:3$.Widget._trigger @ jquery.ui.widget.js?d=1436808910:487(anonymous function) @ jquery.fileupload.js?d=1436808910:1008n.extend.each @ jquery-2.1.4.min.js?d=1436808909:2$.widget._onAdd @ jquery.fileupload.js?d=1436808910:1001(anonymous function) @ jquery.ui.widget.js?d=1436808910:105(anonymous function) @ jquery.fileupload.js?d=1436808910:1200n.Callbacks.j @ jquery-2.1.4.min.js?d=1436808909:2n.Callbacks.k.add @ jquery-2.1.4.min.js?d=1436808909:2n.extend.Deferred.d.always @ jquery-2.1.4.min.js?d=1436808909:2$.widget._onChange @ jquery.fileupload.js?d=1436808910:1190(anonymous function) @ jquery.ui.widget.js?d=1436808910:105handlerProxy @ jquery.ui.widget.js?d=1436808910:406n.event.dispatch @ jquery-2.1.4.min.js?d=1436808909:3n.event.add.r.handle @ jquery-2.1.4.min.js?d=1436808909:3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anybody help me?&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="45" LastEditDate="2015-08-11T22:34:51.803" LastActivityDate="2015-08-12T14:05:52.703" Title="upload doesn't finish" Tags="&lt;upload&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10927" PostTypeId="1" CreationDate="2015-08-11T23:30:34.813" Score="1" ViewCount="1061" Body="&lt;p&gt;When my plugin runs, I'm getting a PHP Mailer Exception error stating:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;Could not access file: &lt;a href=&quot;http://s3.amazonaws.com/patternmanager/clients/healthstream/question-attachments/download.jpeg&quot; rel=&quot;nofollow&quot;&gt;http://s3.amazonaws.com/patternmanager/clients/healthstream/question-attachments/download.jpeg&lt;/a&gt;&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url being pulled in is correct, and the file exists. I'm still very new to this, but the best I can figure out is that this is some kind of permissions issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something in my code that might be causing a problem? Am I calling in the attachments correctly? Any direction is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    //Event: onSaveEntry&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event)&#xA;    {&#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $isNewEntry = $event-&amp;gt;params['isNewEntry'];&#xA;        $entrySection = $entry-&amp;gt;section;&#xA;&#xA;        $attachments = $entry-&amp;gt;questionAttachments;&#xA;&#xA;        if ($isNewEntry and $entrySection == 'Questions')  {&#xA;            //Get all users from UserGroup&#xA;            $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;            $user_criteria-&amp;gt;groupId = '9';&#xA;            $users = $user_criteria-&amp;gt;find();&#xA;&#xA;            //Send to each User&#xA;            foreach ($users as $user) {&#xA;                //Send Mail&#xA;                $email = new EmailModel();&#xA;                $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;                $email-&amp;gt;subject = 'New Question';&#xA;                $email-&amp;gt;htmlBody    =&#xA;&#xA;                'A new question has been posted: &amp;lt;a href=&quot;'.$entry-&amp;gt;url.'&quot; title=&quot;'.$entry-&amp;gt;title.'&quot;&amp;gt;'.$entry-&amp;gt;title.'&amp;lt;/a&amp;gt;';&#xA;&#xA;                if ($attachments) {&#xA;                    foreach ($attachments as $attachment) {&#xA;                        $email-&amp;gt;addAttachment($attachment-&amp;gt;url, $attachment-&amp;gt;filename, 'base64', $attachment-&amp;gt;kind);&#xA;                    }&#xA;                }&#xA;&#xA;                craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3894" LastActivityDate="2015-08-12T02:55:08.150" Title="Getting a phpmailerException error due to my attachments when my plugin runs" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10928" PostTypeId="2" ParentId="10927" CreationDate="2015-08-11T23:37:46.030" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/Synchro/PHPMailer&quot; rel=&quot;nofollow&quot;&gt;PHPMailer&lt;/a&gt; is only going work with local files for attachments, so you'll need to download the file from S3 into a known location, and pass that location in as the first parameter to &lt;code&gt;addAttachment&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-08-12T02:55:08.150" LastActivityDate="2015-08-12T02:55:08.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10929" PostTypeId="1" AcceptedAnswerId="10930" CreationDate="2015-08-12T02:04:26.560" Score="1" ViewCount="722" Body="&lt;p&gt;How do I include block types that don't all sit under the one directory? My folder structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - images&#xA;  - _blockName.html&#xA; - mockups&#xA;  - ...&#xA; - text&#xA; - special&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How I'm currently including the blocks (which isn't working):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% for block in entry.widgets %}&#xA;        {% include &quot;widgets/_&quot; ~ block.type ignore missing %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I let craft know to look under each subdirectory?&lt;/p&gt;&#xA;" OwnerUserId="3560" LastActivityDate="2015-08-12T05:27:54.393" Title="Including block templates under different subdirectories" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10930" PostTypeId="2" ParentId="10929" CreationDate="2015-08-12T05:27:54.393" Score="3" Body="&lt;p&gt;It could get unwieldy if you have too many subfolder options, BUT... You CAN supply a list of templates to Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; tag. Twig checks each option, and includes the first template in the list that exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include&#xA;   [&#xA;    '_widgets/_images/_'  ~ block.type,&#xA;    '_widgets/_mockups/_' ~ block.type,&#xA;    '_widgets/_text/_'    ~ block.type,&#xA;    '_widgets/_special/_' ~ block.type&#xA;   ]&#xA;   ignore missing&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(The &lt;code&gt;ignore missing&lt;/code&gt; tells Twig to fall back to rendering nothing if none of the templates exist. Otherwise it would throw an exception. A popular alternative is to have a default fallback template as the last item in the list.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus 2¢: I think it's good practice to keep include templates in hidden folders (i.e. &lt;code&gt;_widgets/&lt;/code&gt; instead of &lt;code&gt;widgets/&lt;/code&gt;) — to signify to yourself and others that the directory does not match with a public route, and that its contents are never meant to be displayed directly.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-08-12T05:27:54.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10931" PostTypeId="2" ParentId="9400" CreationDate="2015-08-12T06:58:40.910" Score="2" Body="&lt;p&gt;We're using AWS to host Craft and it's worked out very well. We're using elastic beanstalk, as well, which has been super helpful with deployments.&lt;/p&gt;&#xA;" OwnerUserId="3956" LastActivityDate="2015-08-12T06:58:40.910" CommentCount="0" CommunityOwnedDate="2015-08-12T06:58:40.910" ContentLicense="CC BY-SA 3.0" />
  <row Id="10932" PostTypeId="2" ParentId="9400" CreationDate="2015-08-12T09:30:54.653" Score="1" Body="&lt;p&gt;I've been using WiredTree for a couple of years and am very happy with their service. They are very helpful and quick to respond to inquiries 24/7 to any issues and queries you have with the server.&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-12T09:30:54.653" CommentCount="0" CommunityOwnedDate="2015-08-12T09:30:54.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="10933" PostTypeId="1" CreationDate="2015-08-12T09:40:49.020" Score="0" ViewCount="74" Body="&lt;p&gt;I'm trying to extend a plugin to allow for a limit to be added to the database call but it's throwing an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Missing argument 1 for Craft\Curate_UsersContentService::getRank(),&#xA;  called&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The services file has a function in it called &lt;code&gt;getRank()&lt;/code&gt; and I've added a &lt;code&gt;$count&lt;/code&gt; variable to it &lt;code&gt;getRank($count)&lt;/code&gt;. My twig template then calls it with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set count = 10 %}&#xA;{% set rank = craft.curate.getRank(count) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the above error is thrown. What an I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clues appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="344" LastEditDate="2015-08-12T09:54:39.970" LastActivityDate="2015-08-12T10:43:12.737" Title="Plugin function throwing error for missing argument" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10934" PostTypeId="1" AcceptedAnswerId="10957" CreationDate="2015-08-12T10:38:34.913" Score="2" ViewCount="388" Body="&lt;p&gt;I'm displaying lists of members grouped by their surname initial which the user navigates using a list of letters from A to Z. This part was straightforward enough and the following code works to return all members with a particular initial.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchString = 'surname:' ~ searchLetter ~ '*' %}&#xA;{% set members = craft.entries.section('members').search(searchString).order('surname', 'firstName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I'm struggling is listing only the letters for which there are members to use for navigation, or to be able to list them all but disable those that don't have members.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I just loop over the characters in the alphabet and output all of them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set characters = 'a'..'z' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If someone clicks on a letter that has no members they get a blank list, but this isn't ideal as it would be better if there wasn't a link to this page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know with SQL I could do something like a &lt;code&gt;SELECT DISTINCT&lt;/code&gt; with grouping to return just a list of initials in use, but is this possible with Twig or would I need to look at writing a plugin?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2015-08-13T09:01:57.067" Title="Omitting unused letters from A to Z list" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10935" PostTypeId="2" ParentId="10933" CreationDate="2015-08-12T10:43:12.737" Score="1" Body="&lt;p&gt;Ok so worked this out whilst working on another plugin. I had to add a variable to the CurateVariable file in order for the template to be able to use the function. Problem solved.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-12T10:43:12.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10936" PostTypeId="2" ParentId="10934" CreationDate="2015-08-12T11:48:54.487" Score="7" Body="&lt;p&gt;[untested]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for letter, members in craft.entries.section('members').order('surname', 'firstname') | group('surname|slice(0,1)') %}&#xA;    &amp;lt;h1&amp;gt;{{ letter }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for member in members %}&#xA;        &amp;lt;li&amp;gt;{{ member.surname }}, {{ member, firstname }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-08-12T11:48:54.487" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10937" PostTypeId="2" ParentId="10907" CreationDate="2015-08-12T12:44:33.617" Score="3" Body="&lt;p&gt;This was related to the place that the sessions were being stored with my hosting company (Vidahost). Using the Utils section in Craft2, we managed to track it down to being stored with memcache. This meant that &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;auto&lt;/code&gt; wouldn't work, and we had to set the override to &lt;code&gt;false&lt;/code&gt;. False is meant to be the default anyway, but it seems to be working now that it's hardcoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key lines to look for when debugging this are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;session.save_handler    memcache&#xA;session.save_path       tcp://10.168.1.55:11211?persistent=0&amp;amp;amp;weight=1&amp;amp;amp;timeout=5&amp;amp;amp;retry_interval=15`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-08-12T12:44:33.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10939" PostTypeId="1" CreationDate="2015-08-12T16:35:05.933" Score="2" ViewCount="1209" Body="&lt;p&gt;I have an issue with rendering a template from within my controller in my plugin. It just seems to re-direct to the dashboard instead of bringing up the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a widget on the dashboard that calls an action in my plugin's controller file. This works as I can print_r the object I am creating. However when it gets to the render code it just keeps re-directing back to the dashboard. I've even tried stripping out all the code apart from the render call and it still does it. The code making the call is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;templates-&amp;gt;render('pluginName/index.html');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is currently the only code in the plugin function. The plugin has a templates folder where the index.html is held. I've also stripped the template down so it only contains the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set centered = true %}&#xA;{% set title = &quot;The Title&quot;|t %}&#xA;&#xA;{% set content %}&#xA;&#xA;&amp;lt;p&amp;gt;List the users&amp;lt;/p&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any clues anyone. &lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-17T08:38:03.813" Title="Issue with rendering a template from a plugin function" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10940" PostTypeId="1" AcceptedAnswerId="10941" CreationDate="2015-08-12T16:42:11.933" Score="3" ViewCount="1983" Body="&lt;p&gt;I dont understand why we need the &lt;code&gt;robots.txt&lt;/code&gt;file in the Craft CMS package. I think it is confusing. (I had a problem with Google indexing one of my BETA hidden website because of that.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason : When I initiate my domain name on the hosting it creates automatically a &lt;strong&gt;public folder&lt;/strong&gt; inside the &lt;strong&gt;virtual host main folder&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example my hosting server make the domain name point to &lt;code&gt;/lamp0/web/vhosts/public/&lt;/code&gt;. So I just have to upload &lt;code&gt;craft&lt;/code&gt; and &lt;code&gt;public&lt;/code&gt; folders below in &lt;code&gt;/lamp0/web/vhosts/&lt;/code&gt;.&lt;br&gt;&#xA;Then I just have to rename &lt;code&gt;public&lt;/code&gt; in &lt;code&gt;htdocs&lt;/code&gt; and no need of &lt;code&gt;robots.txt&lt;/code&gt; file because &lt;code&gt;craft&lt;/code&gt; folder is below domain name root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KEwFe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KEwFe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Don't allow web crawlers to index Craft&#xA;User-agent: *&#xA;Disallow: /craft/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;=========================&lt;br&gt;&#xA;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;br&gt;&#xA;OK I see now in the Craft install documentation (see below). I missed it sorry.&lt;br&gt;&#xA;Perhaps would it be good to insert a &lt;code&gt;README.txt&lt;/code&gt; file in the package next to robots.txt file to explain that again :)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JKDJ6.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JKDJ6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-12T17:17:57.270" LastActivityDate="2015-08-12T17:17:57.270" Title="File robots.txt needed in Craft package?" Tags="&lt;config&gt;&lt;installation&gt;&lt;seo&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10941" PostTypeId="2" ParentId="10940" CreationDate="2015-08-12T16:55:01.117" Score="3" Body="&lt;p&gt;I think it's there to protect those who can't have craft/ below web root. In your case it can't be found by search engines, so you &lt;em&gt;can&lt;/em&gt; delete it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-12T16:55:01.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10942" PostTypeId="2" ParentId="10940" CreationDate="2015-08-12T16:59:58.013" Score="4" Body="&lt;p&gt;The specific directive to disallow the &lt;code&gt;/craft/&lt;/code&gt; directory isn't necessary if your craft folder is below the webroot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's good practice to have a &lt;code&gt;robots.txt&lt;/code&gt; for each site, so I don't recommend deleting it altogether. You can change the directives to fit whatever robots criteria you need for your site. (For example, if you launch a beta site, you'd want to Disallow the whole thing to avoid duplicate content penalties.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-08-12T16:59:58.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10943" PostTypeId="1" AcceptedAnswerId="10944" CreationDate="2015-08-12T17:16:02.893" Score="2" ViewCount="440" Body="&lt;p&gt;This is somewhat related to the question at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2665/where-should-a-plugin-create-temporary-files&quot;&gt;Where should a plugin create temporary files&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that needs to store temporary files. Do I need to worry about cleaning up the craft/storage/runtime/temp after I'm done with them, or do they get deleted automatically on some kind of recurring basis?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-08-12T17:44:51.380" Title="Do temporary files stored in craft/storage/runtime/temp get automatically deleted?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10944" PostTypeId="2" ParentId="10943" CreationDate="2015-08-12T17:44:51.380" Score="2" Body="&lt;p&gt;The only two times Craft clears that folder is 1) at the end of an automatic or manual update and 2) when you have the &quot;Temp files&quot; checkbox checked under the &quot;Clear Caches Tool&quot; under &lt;code&gt;Settings-&amp;gt;Tools&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-12T17:44:51.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10948" PostTypeId="2" ParentId="10939" CreationDate="2015-08-12T19:38:08.313" Score="6" Body="&lt;p&gt;I haven't tried calling a template from a controller, so I may not be any help but I've used&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...-&amp;gt;render(...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in my main plugin Class like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;templates-&amp;gt;render('myplugin/_settings', array('settings' =&amp;gt; $this-&amp;gt;getSettings()));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe the render method is looking for another argument?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh wait... I was wrong, it looks like I do...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$vars['users'] = craft()-&amp;gt;user-&amp;gt;listUsers();&#xA;$this-&amp;gt;renderTemplate('myplugin/index', $vars);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I have a variables file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginVariable.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getContacts()&#xA;{&#xA;    return craft()-&amp;gt;contactForm-&amp;gt;getUsers();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which ties back to the my service:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getUsers()&#xA;{&#xA;    return MyPluginRecord::model()-&amp;gt;findAll(array('order' =&amp;gt; 'dateCreated desc'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe that will help get you rolling?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-08-12T21:55:28.327" LastActivityDate="2015-08-12T21:55:28.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10949" PostTypeId="1" AcceptedAnswerId="10952" CreationDate="2015-08-12T20:49:41.147" Score="2" ViewCount="29295" Body="&lt;p&gt;This came out of a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10707/can-you-pass-a-variable-with-includejsfile&quot;&gt;previous question&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to set a variable of a tag group that I can reference in jquery for use with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm declaring this variable in a  tag so my included js files can access it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I &lt;em&gt;want&lt;/em&gt; to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var gameTags = {{ craft.tags.group('gameTags') }};&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Javascript clearly doesn't like that syntax, so I tried setting the variable with Twig and calling that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set gameTags = craft.tags.group('gameTags') %}&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;   var gameTags = gameTags;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS considered that undefined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm probably going about this the wrong way. I'm relatively new to javascript and very new to craft, so I'm a little stumped.&lt;/p&gt;&#xA;" OwnerUserId="3900" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-08-12T21:29:25.660" Title="Can I set a JS variable to a Twig output tag?" Tags="&lt;variable&gt;&lt;javascript&gt;&lt;jquery&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10950" PostTypeId="2" ParentId="10949" CreationDate="2015-08-12T21:13:52.447" Score="1" Body="&lt;p&gt;You probably just need to wrap the twig output in a string, if that's what you need in your javascript. Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;  var gameTags = &quot;{{ craft.tags.group('gameTags') }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-08-12T21:13:52.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10951" PostTypeId="2" ParentId="10949" CreationDate="2015-08-12T21:27:10.100" Score="4" Body="&lt;p&gt;In your first example, you are outputting an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;. That is a query for tags rather than the tags themselves. It doesn't output anything usable by JS You're almost doing the same in the second example, except that your reference to &lt;code&gt;gameTags&lt;/code&gt; in the JS is just referencing itself rather than any Twig output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to do is to query the tags and output in the way that JS can use. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var gameTags = [{% for tag in craft.tags.group('gameTags') %}&quot;{{ tag.title }}&quot;,{%endfor %}];&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should output a JS array of strings with each string being a tag. Something like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var gameTags = [&quot;action&quot;,&quot;adventure&quot;,&quot;platform&quot;,&quot;rpg&quot;,&quot;sports&quot;,];&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're a stickler for commas in arrays, there's ways to not output that after the last tag.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-08-12T21:27:10.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10952" PostTypeId="2" ParentId="10949" CreationDate="2015-08-12T21:29:25.660" Score="4" Body="&lt;p&gt;Looks like you're actually off-track in a couple of different ways...&lt;/p&gt;&#xA;&lt;h3&gt;ElementCriteriaModel&lt;/h3&gt;&#xA;&lt;p&gt;This code is going to return an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;craft.tags.group('gameTags')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Think of an ElementCriteriaModel as being a &lt;em&gt;pending search query&lt;/em&gt;... The only reason you'd need one is to either &lt;strong&gt;adjust the query further&lt;/strong&gt; or &lt;strong&gt;run the query to get results&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Fortunately Craft is smart enough to automatically run an ElementCriteriaModel if you use it an another context. In fact, it will be automatically parsed as &lt;strong&gt;an array of the query results&lt;/strong&gt;. When you let the query run automatically, it's as if you had appended &lt;code&gt;.find&lt;/code&gt; to the original line of code. If you append something like &lt;code&gt;.first&lt;/code&gt; to your code, it'll return only a single element.&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel#fetching-the-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Fetching the Elements&amp;quot;&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&lt;h3&gt;JavaScript&lt;/h3&gt;&#xA;&lt;p&gt;As André pointed out in &lt;a href=&quot;https://craftcms.stackexchange.com/a/10950/45&quot;&gt;his answer&lt;/a&gt;, you'd want to wrap a string in quotes when passing it to JavaScript.&lt;/p&gt;&#xA;&lt;p&gt;However, it looks like you're returning an array. So you'd probably need to manipulate that array however you'd like in Twig, before passing it to JavaScript as either a string or an array.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;// Setting a string&#xA;var gameTags = &amp;quot;{{ myString }}&amp;quot;;&#xA;&#xA;// Setting an array&#xA;var gameTags = [&amp;quot;{{ myArray | join('&amp;quot;,&amp;quot;') }}&amp;quot;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This operates under the assumption that &lt;code&gt;myArray&lt;/code&gt; is already an array of strings. But be careful... When you run your ElementCriteriaModel, you'll end up with an array of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/tagmodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;TagModels&lt;/strong&gt;&lt;/a&gt;. You may need to extract the &lt;code&gt;title&lt;/code&gt; of each TagModel before throwing them to JavaScript.&lt;/p&gt;&#xA;&lt;p&gt;Take note also of the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;join&lt;/code&gt;&lt;/a&gt; filter. That will combine your array of strings into a &amp;quot;superstring&amp;quot;, which you can pass to JavaScript to build your JS array.&lt;/p&gt;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-08-12T21:29:25.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10953" PostTypeId="2" ParentId="10784" CreationDate="2015-08-13T04:54:54.027" Score="1" Body="&lt;p&gt;Certainly possible and simple too :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First in the CP go to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category-&amp;gt;Settings &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll want to set your &lt;code&gt;Category URL formats&lt;/code&gt; and &lt;code&gt;Category Template&lt;/code&gt; to reflect your URL scheme and desired location of your template file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create an _entry template in the directory you specified above for example &lt;code&gt;/categories/_entry.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you head to the URL above your template will load with an entry variable that reflects whichever category you are browsing to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;_entry&lt;/code&gt; template to get all the entries related to the current category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(note this will default to 100 entries if you want more append &lt;code&gt;.limit(101)&lt;/code&gt; etc. or &lt;code&gt;.limit(null)&lt;/code&gt; to get them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and finally to load a layout based on the entry.type simply:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include [&quot;_layouts/types/&quot; ~ entry.type, &quot;_layouts/types/default&quot;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the default layout is for all entries that don't need any special layout.&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-13T04:54:54.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10954" PostTypeId="2" ParentId="10716" CreationDate="2015-08-13T05:23:08.887" Score="1" Body="&lt;p&gt;For static assets I usually use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.debugMode %}&#xA;    {% set assetsUrl = siteUrl %}&#xA;{% else %}&#xA;    {% set assetsUrl = &quot;assets.mysite.com&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I can set assets URL's the same way as navigation URLs. ie.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile assetsUrl ~ &quot;js/init.js&quot; %}&#xA;&#xA;{% includecss %}&#xA;body.landing #page-wrapper {&#xA;    background-image: url(&quot; {{ assetsUrl }}img/pic01.jpg  }}&quot;);&#xA;&#xA;}&#xA;{% endincludecss %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-13T11:26:38.260" LastActivityDate="2015-08-13T11:26:38.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10955" PostTypeId="2" ParentId="1723" CreationDate="2015-08-13T05:53:27.937" Score="7" Body="&lt;p&gt;There is a great article here which I thoroughly recommend reading. It  goes into this in great detail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It even includes a twig macro that deals with both retina images as well as responsive images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/articles/responsive-images-with-twig-macros&quot;&gt;https://straightupcraft.com/articles/responsive-images-with-twig-macros&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-13T11:29:42.520" LastActivityDate="2015-08-13T11:29:42.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10956" PostTypeId="1" CreationDate="2015-08-13T08:25:34.797" Score="1" ViewCount="135" Body="&lt;p&gt;I'm looking for a way to add entry ID's to an array in either a session cookie or a session variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've installed the LJ Cookies plugin (&lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lewisjenkins/craft-lj-cookies&lt;/a&gt;) in the hope that it is possible with this, however I am stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give an idea of the user process for this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I have channel entries that are courses&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When a user goes to a course there will be a &quot;Save this course&quot; button&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When the user clicks the button it will add the ID of the course to a session variable/session cookie array&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;These saved courses will then be available to the user if they click on a &quot;View saved courses&quot; button during their session&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Once their session is over, the cookie can be deleted&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any help on this will be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2015-08-13T08:25:34.797" Title="Add entry ids to a session cookie/variable array on button click?" Tags="&lt;entries&gt;&lt;session&gt;&lt;cookies&gt;&lt;saving&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10957" PostTypeId="2" ParentId="10934" CreationDate="2015-08-13T08:55:52.720" Score="4" Body="&lt;p&gt;The answer is that it is possible in Twig but not very efficient so I ended up writing a very simple plugin with just two files (aside from the main plugin file).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One in &lt;code&gt;variables&lt;/code&gt; subfolder &lt;code&gt;MyPluginVariable.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;class MyPluginVariable&#xA;{&#xA;public function getAToZ()&#xA;{&#xA;    return craft()-&amp;gt;myPlugin_members-&amp;gt;getAToZ();&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the other in &lt;code&gt;services&lt;/code&gt; subfolder &lt;code&gt;MyPlugin_MembersService.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_MembersService extends BaseApplicationComponent&#xA;{&#xA;public function getAToZ()&#xA;{   &#xA;    $query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;selectDistinct('SUBSTRING(field_surname,1,1) AS letter')&#xA;        -&amp;gt;from('content')&#xA;        -&amp;gt;order('letter asc')&#xA;        -&amp;gt;queryAll();&#xA;    return($query);&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I could access the data in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for letter in craft.myPlugin.getAToZ() %}&#xA;{{ letter['letter'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To loop over the letters. There is a very noticeable improvement in performance doing it this way.&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2015-08-13T09:01:57.067" LastActivityDate="2015-08-13T09:01:57.067" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10958" PostTypeId="1" CreationDate="2015-08-13T10:48:01.450" Score="1" ViewCount="111" Body="&lt;p&gt;I am building plugin which has a function to return any users that have a specific interest checked in their profile. The interests field is an array. What I need to do is check if the specific interest is in the interests array and only return users that have selected that interest. So far I have the following but this returns all users and not just users with the flagged interest. So how can I use the criteria model to check if the interest exists in the array?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$interest = craft()-&amp;gt;request-&amp;gt;getPost('interest');&#xA;&#xA;//Get all users with specified interest&#xA;$user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$user_criteria-&amp;gt;interests = $interest;&#xA;$users = $user_criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-13T10:48:01.450" Title="How do you check for a value in an array with the criteria model?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;elementcriteriamodel&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10959" PostTypeId="1" AcceptedAnswerId="10960" CreationDate="2015-08-13T10:50:50.877" Score="2" ViewCount="376" Body="&lt;p&gt;I have already downgraded from Craft PRO to Craft Client and am wondering if I can downgrade again from Craft Client to Craft Personal as the project I'm working on does not need anything more.&lt;/p&gt;&#xA;" OwnerUserId="3917" LastActivityDate="2015-08-13T12:33:42.780" Title="Can I downgrade my craft version from Client to Personal using the CP?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10960" PostTypeId="2" ParentId="10959" CreationDate="2015-08-13T12:33:42.780" Score="2" Body="&lt;p&gt;Yes you can. If you click the Settings icon in Craft, at the bottom of the screen you will see a box that reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upgrade Craft to take your site to the next level. Show me.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Click on that and a window will pop-up with the versions of Craft you can install. Yours will look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ux5tO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ux5tO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just click the &lt;strong&gt;Uninstall&lt;/strong&gt; button and you will be downgraded to Craft Personal.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-08-13T12:33:42.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10961" PostTypeId="1" CreationDate="2015-08-13T13:09:20.173" Score="2" ViewCount="1364" Body="&lt;p&gt;Currently we're highlighting the active page in our navigation by having a structure of menu items with a &quot;menuLink&quot; field and comparing that to the current entry uri. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav link in Menu %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {% if link.menuLink|length %}&#xA;            &amp;lt;a{% if link.slug == entry.uri %} class=&quot;active&quot;{% endif %} href=&quot;{{ link.menuLink[0].url }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;a href=&quot;{{ link.customUrl }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt; &#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't work for children of structures or channels. We could change the if statement to look for the entry.uri OR the entry.section as below but obviously that only works if the section/channel has the same name as the link.slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if link.slug == entry.uri or link.slug == entry.section %} class=&quot;active&quot;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I searched through the previous questions but all the answers to this problem seem to involve reading a section of the URL but we want to be able to control the URLs and have some structure children have a top level URL rather than a /structure-name/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we could have a field on the structure itself to say which menu item to highlight then you could just say something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if entry.section.type == channel or structure then active menu item = entry.section.menuItem &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but you can't have a field on a structure/channel as far as I'm aware?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a way of solving this problem without the use of URL segments?&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-08-13T14:28:41.780" Title="Set navigation menu item to active for child pages" Tags="&lt;structure&gt;&lt;navigation&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10962" PostTypeId="2" ParentId="10961" CreationDate="2015-08-13T14:21:34.890" Score="1" Body="&lt;p&gt;Try using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set pageIsActive = (page.id == entry.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then testing for that in your if statements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftcookbook.net/recipes/388&quot; rel=&quot;nofollow&quot;&gt;This article&lt;/a&gt; covers pretty much every eventuality when it comes to classes and navigation and should help you achieve the markup you are after.&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-13T14:28:41.780" LastActivityDate="2015-08-13T14:28:41.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10963" PostTypeId="1" CreationDate="2015-08-13T15:48:57.383" Score="1" ViewCount="251" Body="&lt;p&gt;i'm developing on a dedicated root server and all works fine. &#xA;The whole installation (database and all files except &lt;code&gt;/craft/storage&lt;/code&gt;) is then pushed to an git repository and will be deployed to the production server from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The production server is a cloud server and i can not log in the CP on this server. I can load the admin page, but if i try to login, nothing happens.&#xA;The XHR-Request gives back following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Server Error&#xA;session_regenerate_id(): Session object destruction failed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found this &lt;a href=&quot;https://github.com/yiisoft/yii/issues/2376&quot; rel=&quot;nofollow&quot;&gt;https://github.com/yiisoft/yii/issues/2376&lt;/a&gt; but i think a custom fix to the yii framework is not the right solution for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks and brgrds &#xA;Stephan&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-08-13T15:48:57.383" Title="Login Problem on Cloud Server" Tags="&lt;control-panel&gt;&lt;error-message&gt;&lt;login&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10964" PostTypeId="1" AcceptedAnswerId="10971" CreationDate="2015-08-13T20:09:58.347" Score="3" ViewCount="537" Body="&lt;p&gt;So I am trying to hide (or disable) a field in the &quot;Edit Entry&quot; view in the CP.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to test a user group :&lt;br&gt;&#xA;&lt;code&gt;{% if currentUser.isInGroup('groupHandle') %}&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot find a hook in Craft Doc to change the rendering of my field ?&#xA;Perhaps with &lt;code&gt;getInputHtml()&lt;/code&gt;? But I dont understand exactly how...&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-13T23:27:27.467" LastActivityDate="2015-08-13T23:27:27.467" Title="Hide (or disable) an entry field in CP depending on user group permission?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;entries-field&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10965" PostTypeId="1" CreationDate="2015-08-13T20:36:14.437" Score="0" ViewCount="80" Body="&lt;p&gt;i have a big problem on my site. One for loop requires more than 30 seconds. When i put the loop in a comment, the page loads shortly. So the loop must be the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any trick to accelerate a loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the loop code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for program in craft.entries.section('program_point').order('program_number') %}&#xA;    {% if program.block.first().title == program_block.title %}&#xA;        &amp;lt;div class=&quot;seminar-box&quot;&amp;gt;&#xA;            {% if program.type == &quot;seminar&quot; %}&amp;lt;a href=&quot;{{ program.url }}&quot;&amp;gt;{% endif %}&#xA;            &amp;lt;h4&amp;gt;&amp;lt;span&amp;gt;{% if program.type != &quot;seminar&quot; %}#{% endif %}{{ program.program_number }}&amp;lt;/span&amp;gt;{{ program.title }}&amp;lt;/h4&amp;gt;&#xA;            {% if program.short_description|length %}&#xA;                &amp;lt;p&amp;gt;{{ program.short_description }}&amp;lt;/p&amp;gt;&#xA;            {% endif %}&#xA;            {% if program.type == &quot;seminar&quot; %}&amp;lt;/a&amp;gt;{% endif %}&#xA;            {% if program.program_referents|length %}&#xA;                &amp;lt;span&amp;gt;&#xA;                    {% set i = 1 %}&#xA;                    {% for referent in program.program_referents %}&#xA;                        &amp;lt;!-- &amp;lt;a href=&quot;{{ referent.url }}&quot; class=&quot;referent-link&quot;&amp;gt;--&amp;gt; {{ referent.referent_name }}&amp;lt;!--&amp;lt;/a&amp;gt;--&amp;gt; {% if i != program.program_referents|length %}, {% endif %}&#xA;                        {% set i = i+1 %}&#xA;                    {% endfor %}&#xA;                &amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T23:37:04.210" LastActivityDate="2017-05-09T23:37:04.210" Title="TTBF about 30 seconds" Tags="&lt;templating&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="10966" PostTypeId="1" AcceptedAnswerId="10972" CreationDate="2015-08-13T21:19:36.407" Score="1" ViewCount="177" Body="&lt;p&gt;In CP Craft Admin in the entries table view I d like to display some authors meta info.&lt;br&gt;&#xA;How could I do that in my plugin?&lt;br&gt;&#xA;I know &lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&lt;/code&gt; and &lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&lt;/code&gt;and but I cannot make it work.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-13T21:44:15.790" LastActivityDate="2015-08-14T01:30:00.257" Title="Add entry author meta field in entries listing table in CP?" Tags="&lt;entries-field&gt;&lt;author&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10967" PostTypeId="1" AcceptedAnswerId="10969" CreationDate="2015-08-13T22:22:14.270" Score="2" ViewCount="1381" Body="&lt;p&gt;I'd like to understand how to combine these two elements into a twig set vars.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Context: I'm building a dynamic template that will list entries from which ever section the URL segment loads. For example /news will be news articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each template will have a page title variable that I'm sending up to the _layout master. The page title's are input using craft.global's I have them setup like this {{ news.pageTitle }}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my dynamic template I'm trying to load everything from the URL slug. For example if it loaded the /notices URL the template would render the global: {{ notices.pageTitle }}. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft global:&lt;/strong&gt; &lt;code&gt;{{ news.pageTitle }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;URL Segment (/news):&lt;/strong&gt; &lt;code&gt;{% set getSegment = craft.request.getSegment(1) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works: &lt;code&gt;{% set pageTitle = news.pageTitle %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this doesn't: &lt;code&gt;{% set pageTitle = getSegment.pageTitle %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="749" LastEditorUserId="749" LastEditDate="2015-08-13T23:06:26.053" LastActivityDate="2015-08-13T23:11:31.327" Title="Trying to set a dynamic twig variable using craft.request and a craft global" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10968" PostTypeId="1" AcceptedAnswerId="10975" CreationDate="2015-08-13T22:26:03.613" Score="2" ViewCount="803" Body="&lt;p&gt;If I’m finding all the entries that are related to a user, how could I get the field handle that the found user is referenced from?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').relatedTo(user) %}&#xA;{% for event in events %}&#xA;&#xA;  {# What goes here? Hypothetical code based on non-existent method would be: #}&#xA;&#xA;  {% set field = craft.fields.relatedTo(user) %}&#xA;  {{ field.title }}&#xA;&#xA;{# Obviously this isn't possible. Any way to accomplish something like this? #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are multiple users fields in the found entries, and there will be different logic depending on which field the user is found.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2015-08-14T00:13:13.780" LastActivityDate="2015-08-15T20:05:25.310" Title="Find entries related to user and display field name" Tags="&lt;relations&gt;&lt;field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10969" PostTypeId="2" ParentId="10967" CreationDate="2015-08-13T23:06:16.260" Score="3" Body="&lt;p&gt;Are you trying to look up the global variable &lt;code&gt;{{ news.pageTitle }}&lt;/code&gt; by having the &lt;code&gt;news&lt;/code&gt; part be dynamically set from the first segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/703/calling-variables-dynamically&quot;&gt;This answer here&lt;/a&gt; might help explain. Then try this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set pageTitle = _context[craft.request.getSegment(1)].pageTitle|default(&quot;News&quot;) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that's the best way to set the displayed page title for your sections, but I believe that's what you're trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A slightly nicer way would be to also create a page for each section/channel root and have its URL be the same as the base path you use for the entries in those sections. Then you could dynamically look up the page attached to any entry by using this (sorry it's complicated)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set page = craft.enties.url(entry.section.urlFormat|split(&quot;{&quot;)[0]) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should find the page with the URL that matches the URL of the section entries (up until the first dynamic part). Then you can use the page title, banner, or any other fields you've put on the page.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-08-13T23:11:31.327" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10970" PostTypeId="2" ParentId="10966" CreationDate="2015-08-13T23:07:34.287" Score="1" Body="&lt;p&gt;From what I understand I think the methods you reference are for when you create a plugin with its own custom element type, I don't think you can interact with the entry listing as standard without a plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do think there is a plugin which might help you achieve this though without having to write your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/DashCols-Craft/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the looks of things this should let you add custom fields to the entry listing page, I haven't actually used this but it looks solid.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-13T23:07:34.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10971" PostTypeId="2" ParentId="10964" CreationDate="2015-08-13T23:25:29.113" Score="4" Body="&lt;p&gt;OK so here is my solution :&lt;br&gt;&#xA;1/ define a custom permission for user groups&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerUserPermissions()&#xA;{&#xA;    return array(&#xA;        'updateTopNews' =&amp;gt; array('label' =&amp;gt; Craft::t('Update Top News')),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2/ simply add css to hide the field when user has not the permission in my plugin init function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function init () {&#xA;    parent::init();&#xA;&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    if ( craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; $user ) {&#xA;&#xA;        if ( !$user-&amp;gt;can('updateTopNews') ) {&#xA;            craft()-&amp;gt;templates-&amp;gt;includeCss('#fields-topNews-field { display: none; }');&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-08-13T23:25:29.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10972" PostTypeId="2" ParentId="10966" CreationDate="2015-08-14T01:30:00.257" Score="2" Body="&lt;p&gt;You're on the right track with both of those. First, &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modifyEntryTableAttributes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gives plugins a chance to modify the table columns shown on the entry index page.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This lets you name the column for your author info. It's a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#hooks&quot; rel=&quot;nofollow&quot;&gt;hook&lt;/a&gt;, so you'll need to add a public method with the same name as that that to your main plugin class. You can also limit the column to particular section by checking the &lt;code&gt;$source&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:3')&#xA;    {&#xA;        $attributes['author'] = Craft::t('Author');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then to actually return the information, you need &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gives plugins a chance to customize the HTML of the table cells on the entry index page.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here you can just check for the attribute you set above, and return a string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'author')&#xA;    {&#xA;        return $entry-&amp;gt;getAuthor()-&amp;gt;getFriendlyName();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-08-14T01:30:00.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10973" PostTypeId="1" CreationDate="2015-08-14T03:32:09.220" Score="1" ViewCount="62" Body="&lt;p&gt;Well I like in the entries listing the possibility to toggle a structure entry type between Structured and List view.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iGd3s.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iGd3s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I d like to do same for my assets because I got a structured assets tree with plenty of subfolders and I want to see also the assets as a listing...&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dd18I.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dd18I.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do that?&lt;br&gt;&#xA;(&lt;code&gt;ElementActions&lt;/code&gt; are only used for triggering action on selected elements)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In resume :&lt;br&gt;&#xA;1/ &lt;strong&gt;How to add a button in the main menu bar, beside the search field on the right for example...&lt;/strong&gt;&lt;br&gt;&#xA;2/ &lt;strong&gt;How to hook into assets listing ? (when button clicked)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-14T14:10:12.083" LastActivityDate="2015-08-14T14:10:12.083" Title="How to flatten assets listing view (remove subfolders constraint)" Tags="&lt;assets&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10974" PostTypeId="1" AcceptedAnswerId="10996" CreationDate="2015-08-14T03:43:49.060" Score="4" ViewCount="330" Body="&lt;p&gt;I want to disable the modification of both the file name and title of a specific asset type.&lt;br&gt;&#xA;How can I do that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nt1xH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nt1xH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3959" LastEditDate="2015-08-19T19:20:44.387" LastActivityDate="2015-08-19T19:20:44.387" Title="Disable modification of assets title and name" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;permissions&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10975" PostTypeId="2" ParentId="10968" CreationDate="2015-08-14T06:10:48.963" Score="4" Body="&lt;p&gt;What could work for you is to get the events for each field separatly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEvents = craft.entries.section('events').relatedTo({&#xA;    element: user,&#xA;    field: 'firstEntriesField'&#xA;}) %}&#xA;&#xA;{% set secondEvents = craft.entries.section('events').relatedTo({&#xA;    element: user,&#xA;    field: 'secondEntriesField'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need them combined in one loop, I can't think of another way other than to query x + 1 times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEvents = craft.entries.section('events').relatedTo({&#xA;    element: user,&#xA;}) %}&#xA;&#xA;{% set firstEventsIds = craft.entries.section('events').relatedTo({&#xA;    element: user,&#xA;    field: 'firstEntriesField'&#xA;}).ids() %}&#xA;&#xA;{% set secondEventsIds = craft.entries.section('events').relatedTo({&#xA;    element: user,&#xA;    field: 'secondEntriesField'&#xA;}).ids() %}&#xA;&#xA;{% for event in allEvents %}&#xA;    {% if event.id in firstEventsIds %}&#xA;        {# Event related through firstEntriesField #}&#xA;    {% elseif event.id in secondEventsIds %}&#xA;        {# Event related through secondEntriesField #}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3380" LastEditDate="2015-08-15T20:05:25.310" LastActivityDate="2015-08-15T20:05:25.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10976" PostTypeId="1" AcceptedAnswerId="11135" CreationDate="2015-08-14T10:58:26.017" Score="2" ViewCount="222" Body="&lt;p&gt;i've got this error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[error] [exception.CDbException] SQLSTATE[HY000] [2000] mysqlnd&#xA;  cannot connect to MySQL 4.1+ using the old insecure authentication.&#xA;  Please use an administration tool to reset your password with the&#xA;  command SET PASSWORD = PASSWORD('your_existing_password'). This will&#xA;  store a new, and more secure, hash value in mysql.user. If this user&#xA;  is used in other scripts executed by PHP 5.2 or earlier you might need&#xA;  to remove the old-passwords flag from your my.cnf file&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;i've already set a new password in the webspace, but the error is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T23:35:23.793" LastActivityDate="2017-05-09T23:35:23.793" Title="db password problem" Tags="&lt;database&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10977" PostTypeId="1" CreationDate="2015-08-14T12:36:22.207" Score="0" ViewCount="140" Body="&lt;p&gt;When I'm using devmode to dump out a twig variable the site will no longer work saying that entry = NULL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This only happens when I have some twig logic at the top of my template e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set metaDescription = entry.metaDescription %}&#xA;    {% set metaPageTitle = entry.metaPageTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;do I need to move this logic elsewhere in order for devMode to work?&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-08-14T13:41:47.333" Title="Devmode entry variable NULL" Tags="&lt;templating&gt;&lt;entry&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10978" PostTypeId="2" ParentId="10307" CreationDate="2015-08-14T13:01:47.423" Score="2" Body="&lt;p&gt;I had the same issue and managed to get it working like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.selectField({&#xA;    options :[&#xA;     {optgroup:'North Island'},&#xA;     {label : 'Foo', value: 'foo'},&#xA;     {label : 'Bar', value: 'bar'},&#xA;     {optgroup:'South Island'},&#xA;     {label : 'Baz', value: 'baz'}&#xA;    ],&#xA;    name: name,&#xA;    value : value&#xA;})}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I guess in php (if working from a plugin) your array would need to look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA; array('optgroup' =&amp;gt; 'North Island'),&#xA; array('label' =&amp;gt; 'Foo', 'value' =&amp;gt; 'foo'),&#xA; array('label' =&amp;gt; 'Bar', 'value' =&amp;gt; 'bar')&#xA; array('optgroup' =&amp;gt; 'South Island'),&#xA; array('label' =&amp;gt; 'Baz', 'value' =&amp;gt; 'baz')&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This then would output it like this in the admin area&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QM2aj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QM2aj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-14T13:01:47.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10979" PostTypeId="1" AcceptedAnswerId="10980" CreationDate="2015-08-14T13:04:30.990" Score="2" ViewCount="1227" Body="&lt;p&gt;I haven't used categories before so maybe I'm looking at this the wrong way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a category group named products with the following structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Featured&#xA;Fruit&#xA;----Apple&#xA;----Banana&#xA;Veg&#xA;----Turnip&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I can do the following to show just the subcategories of fruit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for cat in craft.categories.group('productCategories').descendantOf(&quot;fruit ID&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I get the &quot;fruit ID&quot; when I'm on the on the fruit page?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft.categories.relatedTo(entry)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns all the categories in products but I want just the current category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3965" LastEditorUserId="57" LastEditDate="2015-08-15T15:51:53.967" LastActivityDate="2015-08-15T15:51:53.967" Title="Get current entry category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10980" PostTypeId="2" ParentId="10979" CreationDate="2015-08-14T13:19:21.097" Score="2" Body="&lt;p&gt;I take it you are on the category template as defined in &lt;code&gt;admin/settings/categories/:id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should have a model representation of the category assigned to &lt;code&gt;category&lt;/code&gt; in the template, so you should be able to get the current category id by simply doing &lt;code&gt;{{ category.id }}&lt;/code&gt; in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your code could look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;for cat in craft.categories.group('productCategories').descendantOf(category.id)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-14T13:19:21.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10981" PostTypeId="2" ParentId="10977" CreationDate="2015-08-14T13:41:47.333" Score="1" Body="&lt;p&gt;This is because I was on a category page not an entry page, so the entry variable didn't exist!&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-08-14T13:41:47.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10982" PostTypeId="2" ParentId="10979" CreationDate="2015-08-14T14:14:48.133" Score="1" Body="&lt;p&gt;When you are on a category page you can simply use the category variable just like you would use the entry variable...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.id }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-14T14:14:48.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10983" PostTypeId="1" CreationDate="2015-08-14T15:26:04.117" Score="2" ViewCount="175" Body="&lt;p&gt;I made a plugin which customize columns table view for all my elements and using a filter on the source :  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries: &lt;strong&gt;section&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    // set fields for one section&#xA;    if ($source == 'section:8' )&#xA;    {&#xA;        unset($attributes['expiryDate']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;User Groups : &lt;strong&gt;group&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyUserTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'group:6' )&#xA;    {&#xA;        $attributes['unepRegionDelegateMember'] = Craft::t('Région');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is working great for these two but I got a problem with the assets source param, it just does not work, I tried &lt;strong&gt;folder&lt;/strong&gt; as explained in Craft Doc but does not work:&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyAssetTableAttributes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assets: &lt;strong&gt;folder&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyAssetTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'folder:2')&#xA;    {&#xA;        unset($attributes['dateModified']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;br&gt;&#xA;In fact my problem was that I was mistaken by the asset &lt;code&gt;sourceID&lt;/code&gt; which has nothing to do with the &lt;code&gt;folderID&lt;/code&gt; requested by the function &lt;code&gt;modifyAssetTableAttributes&lt;/code&gt;. See what I mean here:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;strong&gt;entries&lt;/strong&gt; or &lt;strong&gt;user groups&lt;/strong&gt; you can find the ID in CP in the section/usergroup page, the CP page URL contains the ID:&lt;br&gt;&#xA;&lt;code&gt;http://craft.dev/admin/settings/sections/5&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;http://craft.dev/admin/settings/users/groups/5&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the &lt;strong&gt;assets&lt;/strong&gt; the ID in the url is not the folderID : &#xA;&lt;code&gt;http://craft.dev/admin/settings/assets/sources/2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SO MY REAL QUESTION IS:&lt;br&gt;&#xA;Is there a function to retrieve the main folder ID from an asset source handle to do &lt;code&gt;$folderId = craft()-&amp;gt;assets-&amp;gt;source(‘asset-handle’)-&amp;gt;id&lt;/code&gt;&lt;br&gt;&#xA;So we could easily use function &lt;code&gt;modifyAssetTableAttributes&lt;/code&gt; and provide source filter &lt;code&gt;if ($source == 'folder:51’)&lt;/code&gt;&lt;br&gt;&#xA;On the same pattern as for section : &lt;code&gt;$sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('handle')-&amp;gt;id;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ELEMENT MODEL + GETCRITERIA&lt;/strong&gt; &#xA;I tried this&lt;br&gt;&#xA;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;$criteria-&amp;gt;source = ‘asset-handle’;&lt;/code&gt;&lt;br&gt;&#xA;&lt;em&gt;But I dont see how to get to main folder ID after...&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-14T23:54:43.083" LastActivityDate="2015-08-14T23:54:43.083" Title="Manipulating CP Elements List view with source filtering does not work for assets" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10984" PostTypeId="1" AcceptedAnswerId="11048" CreationDate="2015-08-14T16:18:42.877" Score="2" ViewCount="1595" Body="&lt;p&gt;I am tearing my hair out with this!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have a variable file setup as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TrackrVariable&#xA;{&#xA;    public function startTrace()&#xA;    {&#xA;        if(!isset($_COOKIE['trackr_sess'])):&#xA;            $sess = StringHelper::randomString(40, TRUE);&#xA;            $expire = time()+60*60*24*120; // 120 days&#xA;            setcookie('trackr_sess', $sess, $expire);&#xA;            $_COOKIE['trackr_sess'] = $sess;&#xA;        else:&#xA;            $sess = $_COOKIE['trackr_sess'];&#xA;        endif;&#xA;&#xA;        $trace = new Trackr_TraceModel();&#xA;        $trace-&amp;gt;entry_id = 1;&#xA;        $trace-&amp;gt;sess_id = $sess;&#xA;        craft()-&amp;gt;trackr_trace-&amp;gt;saveTrace($trace);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and I am calling the function in my template using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.trackr.startTrace() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I create the model and set the attributes and hand off to a service. The model looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Trackr_TraceModel extends BaseModel&#xA;{&#xA;   public function rules()&#xA;    {&#xA;        // Are there any existing rules?&#xA;        $rules = parent::rules();&#xA;&#xA;        // Make all attributes safe&#xA;        $rules[] = array(implode(',', array_keys($this-&amp;gt;getAttributes())), 'safe');&#xA;&#xA;        // Send it on outta here&#xA;        return $rules;&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return [&#xA;            'entry_id' =&amp;gt; [&#xA;                 'type' =&amp;gt; AttributeType::Number,&#xA;                 'required' =&amp;gt; TRUE&#xA;             ],&#xA;             'sess_id' =&amp;gt; [&#xA;                 'type' =&amp;gt; AttributeType::String,&#xA;                 'required' =&amp;gt; TRUE&#xA;             ]&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the service looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Trackr_TraceService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    protected $traceRecord;&#xA;&#xA;    public function __construct($traceRecord = null)&#xA;    {&#xA;        $this-&amp;gt;traceRecord = $traceRecord;&#xA;        if(is_null($this-&amp;gt;traceRecord))&#xA;        {&#xA;            $this-&amp;gt;traceRecord = Trackr_TraceRecord::model();&#xA;        }   &#xA;    }&#xA;&#xA;    public function saveTrace(Trackr_TraceModel &amp;amp;$trace)&#xA;    {&#xA;&#xA;        if ($id = $trace-&amp;gt;getAttribute('id')) :&#xA;            if ($this-&amp;gt;traceRecord-&amp;gt;findByPk($id) === NULL):&#xA;                throw new Exception(Craft::t('Can\'t find trace with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;            endif;&#xA;        else:&#xA;            $this-&amp;gt;traceRecord-&amp;gt;create();&#xA;        endif;&#xA;&#xA;        if ($trace-&amp;gt;validate()):&#xA;&#xA;            $dt = DateTimeHelper::currentTimeForDb();&#xA;            $attributes = array(&#xA;                'entry_id' =&amp;gt; $trace-&amp;gt;entry_id,&#xA;                'sess_id' =&amp;gt; $trace-&amp;gt;sess_id,&#xA;                'dateCreated' =&amp;gt; $dt,&#xA;                'dateUpdated' =&amp;gt;$dt,&#xA;                'uid' =&amp;gt; StringHelper::UUID(),&#xA;                'id' =&amp;gt; 0&#xA;            );    &#xA;            foreach($attributes as $k =&amp;gt; $v) $this-&amp;gt;traceRecord-&amp;gt;setAttribute($k,$v);&#xA;&#xA;            if($this-&amp;gt;traceRecord-&amp;gt;save()):&#xA;                // update id on model (for new records)&#xA;                $trace-&amp;gt;setAttribute('id', $this-&amp;gt;traceRecord-&amp;gt;getAttribute('id'));&#xA;                return TRUE;&#xA;            else:&#xA;                $model-&amp;gt;addErrors($this-&amp;gt;traceRecord-&amp;gt;getErrors());&#xA;                return FALSE;&#xA;            endif;&#xA;&#xA;        endif;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my mind, the service should be accepting the model, assigning it's attributes to the record and saving the record to the database. Currently, $record-&gt;save() is returning TRUE and therefore passing the conditional but no record is created in the dataset, no errors, no trace of any issues whatsoever!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I though it might be a 'safe validation' issue as outlined in &lt;a href=&quot;https://craftcms.stackexchange.com/a/8895/3968&quot;&gt;this answer&lt;/a&gt; but, as far as I am aware, I am following all of the advice there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I want to be able to do is create a random string, store it in a cookie, as use that cookie to track resources that users view by storing the entry IDs in a table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I print out the record and the model separately, the data is being assigned to the attributes just fine, and the cookie bit works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!&#xA;Dan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Record file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Trackr_TraceRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'trackr_trace';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'entry_id' =&amp;gt; AttributeType::Number,&#xA;            'sess_id' =&amp;gt; AttributeType::String&#xA;        );&#xA;    }&#xA;    public function defineIndexes()&#xA;    {&#xA;        return array(&#xA;            array('columns' =&amp;gt; array('sess_id'), 'unique' =&amp;gt; TRUE),&#xA;        );&#xA;    }&#xA;&#xA;    /**&#xA;     * Create a new instance of the current class.&#xA;     *&#xA;     * @return BaseRecord&#xA;     */&#xA;    public function create()&#xA;    {&#xA;        $class = get_class($this);&#xA;        $record = new $class();&#xA;        return $record;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3968" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-08-18T12:37:26.790" Title="Craft CMS Plugin Save Record to DB from Variable" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10985" PostTypeId="1" CreationDate="2015-08-14T16:41:23.190" Score="1" ViewCount="899" Body="&lt;p&gt;I'm trying to do a form, I'm using FormBuilder plugin.&#xA;I have the form and the fields, but when I try to acess ../admin/entries to manage the content of the page, I have this error, why is that? What did I miss?&#xA;I The code in that page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;utf-8&quot; name=&quot;{{ form.handle }}&quot; class=&quot;formbuilder-form&quot; id=&quot;{{ form.handle }}&quot; data-parsley-errors-container=&quot;.formbuilder-notification&quot;{% if form.hasFileUploads %} enctype=&quot;multipart/form-data&quot; {% endif %}&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;formBuilder/entries/saveFormEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;formredirect&quot; data-redirect=&quot;{{form.successPageRedirect}}&quot; value=&quot;{{form.redirectUrl}}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;formHandle&quot; value=&quot;{{form.handle}}&quot;&amp;gt;&#xA;&#xA;{% for tab in tabs %}&#xA;  {% set fields = tab.getFields() %}&#xA;&#xA;  &amp;lt;fieldset class=&quot;{{loop.index}}&quot;&amp;gt;&#xA;    &amp;lt;legend&amp;gt;{{ tab.name }}&amp;lt;/legend&amp;gt;&#xA;    {% for field in fields %}&#xA;      {% set input = craft.formBuilder.getInputHtml(field) %}&#xA;      {{ input | raw }}&#xA;    {% endfor %}&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Error/Success Messages #}&#xA;{% if craft.session.hasFlash('error') or craft.session.hasFlash('success') %}&#xA;  {% if craft.session.hasFlash('error') %}&amp;lt;div class=&quot;formbuilder-notification&quot;&amp;gt;&amp;lt;p class=&quot;error-message&quot;&amp;gt;{{ craft.session.getFlash('error') | raw }}&amp;lt;p&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;  {% if craft.session.hasFlash('success') %}&amp;lt;div class=&quot;formbuilder-notification success&quot;&amp;gt;&amp;lt;p class=&quot;success-message&quot;&amp;gt;{{ craft.session.getFlash('success') | raw }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&#xA;{% else %}&#xA;  &amp;lt;div class=&quot;formbuilder-notification&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;button type=&quot;submit&quot;&amp;gt;Submit Message&amp;lt;/button&amp;gt;&#xA;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8IeHB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8IeHB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3969" LastActivityDate="2015-08-18T23:27:15.683" Title="FormBuilder - PHP notice Trying to get property of non-object" Tags="&lt;plugins&gt;&lt;form&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10986" PostTypeId="2" ParentId="10974" CreationDate="2015-08-14T17:25:09.723" Score="1" Body="&lt;p&gt;You can disable the capacity to upload, remove, or create subfolders for assets to whomever you wish through the users control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially solve this problem by limiting the users control to allow them only to upload and not change folders or delete. (see image below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y1npQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y1npQ.png&quot; alt=&quot;Craft User Limitation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3959" LastActivityDate="2015-08-14T17:25:09.723" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10987" PostTypeId="1" AcceptedAnswerId="11046" CreationDate="2015-08-14T17:36:53.100" Score="1" ViewCount="1088" Body="&lt;p&gt;For a big client we are required to set up their blog on their Hubspot account. However we are developing everything else in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the easiest way to make the connection so the client can use Hubspot to post blog entries into our Craft site?&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="57" LastEditDate="2015-08-18T15:54:35.843" LastActivityDate="2015-08-18T17:32:12.230" Title="How to integrate with Hubspot" Tags="&lt;templating&gt;&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10988" PostTypeId="1" AcceptedAnswerId="11006" CreationDate="2015-08-14T18:03:49.863" Score="4" ViewCount="73" Body="&lt;p&gt;Just figuring out the craft interface and finding all sorts of useful features. Just can't figure out what the purpose of &quot;categories&quot; is in the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be much appreciated if anyone could please tell me how this function is intended to be used and set-up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="22" LastEditDate="2017-05-09T23:35:01.787" LastActivityDate="2017-05-09T23:35:01.787" Title="What is the intended use of categories?" Tags="&lt;categories&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10989" PostTypeId="1" AcceptedAnswerId="11007" CreationDate="2015-08-14T18:11:15.540" Score="3" ViewCount="591" Body="&lt;p&gt;Lets say I have four different pages I set up on a channel to have four different directories. ie ... hello/1, hello/2, hello/3, hello/4. But they are all using the same template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could an engineer adjust in craft to be different between the four pages vs. not be able to adjust if they can't touch the html template or CSS?&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="125" LastEditDate="2015-08-15T07:29:44.450" LastActivityDate="2015-08-15T07:29:44.450" Title="Making multiple pages different with the same template" Tags="&lt;entries&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10990" PostTypeId="1" AcceptedAnswerId="10991" CreationDate="2015-08-14T18:13:55.200" Score="4" ViewCount="590" Body="&lt;p&gt;I have setup a global set for images i use across the site. I have one for seo - where I have images for a twitter card and Facebook image in my seo settings. There is only one image for each field ( so hoping to avoid using the array syntax )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I am not sure how to access the images uploaded into this global variable. My global set has a handle &quot;seo&quot; and the image's handle is &quot;twittercard&quot;. This isn't working :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;meta(name='twitter:image:', content='{{ image.getUrl('seo.twittercard') }}')&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is this the most efficient way to store images used globally across the site? ( via global image variables?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="916" LastEditorUserId="22" LastEditDate="2017-05-09T23:34:34.887" LastActivityDate="2020-12-15T21:14:26.277" Title="Global Image Variables?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10991" PostTypeId="2" ParentId="10990" CreationDate="2015-08-14T18:25:02.180" Score="5" Body="&lt;p&gt;&lt;code&gt;seo.twittercard&lt;/code&gt; is an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;. To access the actual asset, you need to use &lt;code&gt;seo.twittercard.first&lt;/code&gt; (or equivalently: &lt;code&gt;seo.twittercard.first()&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you should always check that this exists before referencing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if seo.twittercard|length %}&#xA;  &amp;lt;meta(name='twitter:image:', content='{{ seo.twittercard.first.getUrl() }}')&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And yes, this is a fine way to store images used globally across the site.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-08-14T19:02:02.820" LastActivityDate="2015-08-14T19:02:02.820" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10992" PostTypeId="2" ParentId="10669" CreationDate="2015-08-14T18:29:57.733" Score="1" Body="&lt;p&gt;From my personal experience, this is the type of thing that occurs when PHP/HTML set-up has a bug. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could be having an issue using the Rich Text input for entering HTML for that reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you could try making the edit in your website templates/css directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find tutorials to help you on &lt;a href=&quot;http://buildwithcraft.com/docs/introduction&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="3959" LastEditDate="2015-08-19T19:10:34.103" LastActivityDate="2015-08-19T19:10:34.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10993" PostTypeId="1" AcceptedAnswerId="10995" CreationDate="2015-08-14T18:42:28.147" Score="1" ViewCount="94" Body="&lt;p&gt;I only want one block on the home page, other pages can loop through all of them. Is there a more efficient way to write this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) is empty %}&#xA;        {% for block in memberships.memberships.limit(1) %}&#xA;        &amp;lt;a href=&quot;{{ block.urlLocation }}&quot; class=&quot;center&quot; target=&quot;_blank&quot;&amp;gt;&#xA;            {% for asset in block.logo %}&#xA;                &amp;lt;img src=&quot;{{ asset.url('memberships')}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        {% for block in memberships.memberships %}&#xA;        &amp;lt;a href=&quot;{{ block.urlLocation }}&quot; class=&quot;center&quot; target=&quot;_blank&quot;&amp;gt;&#xA;            {% for asset in block.logo %}&#xA;                &amp;lt;img src=&quot;{{ asset.url('memberships')}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="101" LastActivityDate="2015-08-14T22:42:57.300" Title="Home page loop once, other pages loop through all" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10994" PostTypeId="2" ParentId="8360" CreationDate="2015-08-14T18:42:50.490" Score="10" Body="&lt;p&gt;The easiest way I have found to password protect page content is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('password') == 'password_you_want' %}&#xA;    &amp;lt;h2&amp;gt;This is your content&amp;lt;/h2&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h2&amp;gt;Not authorized&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;form action=&quot;{{ craft.request.getUrl() }}&quot; method=&quot;POST&quot; accept-charset=&quot;utf-8&quot; class=&quot;form-inline&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;password&quot; name=&quot;password&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;button type=&quot;submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You put your password protected content in the first half of the if loop and the second half of the loop appears the first time you load the page; prompting you with a password form that resubmits to the same page looking for the correct 'password_you_want'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes simple is best.&lt;/p&gt;&#xA;" OwnerUserId="454" LastEditorUserId="27" LastEditDate="2015-08-15T15:51:11.890" LastActivityDate="2015-08-15T15:51:11.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10995" PostTypeId="2" ParentId="10993" CreationDate="2015-08-14T18:59:31.350" Score="3" Body="&lt;p&gt;You could do it this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blockLimit = entry.section.isHomepage() ? 1 : null %}&#xA;&#xA;{% for block in memberships.memberships.limit(blockLimit) %}&#xA;  &amp;lt;a href=&quot;{{ block.urlLocation }}&quot; class=&quot;center&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    {% for asset in block.logo %}&#xA;      &amp;lt;img src=&quot;{{ asset.url('memberships')}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.section&lt;/code&gt; returns the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/sectionmodel&quot; rel=&quot;nofollow&quot;&gt;SectionModel&lt;/a&gt; for the entry, and &lt;code&gt;isHomepage()&lt;/code&gt; tells you whether that section is the homepage. Then you set your &lt;code&gt;limit&lt;/code&gt; accordingly.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2015-08-14T22:42:57.300" LastActivityDate="2015-08-14T22:42:57.300" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10996" PostTypeId="2" ParentId="10974" CreationDate="2015-08-14T19:58:33.093" Score="5" Body="&lt;p&gt;I guess this feature request will solve my problem... in the future:&lt;br&gt;&#xA;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7197199-ability-to-hide-or-disable-fields-based-on-a-user&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7197199-ability-to-hide-or-disable-fields-based-on-a-user&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the meantime I did it with a small css hacking (no choice): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;protected function includeResources()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch ( $segments[ 0 ] ) {&#xA;    case 'entries' : case 'categories' : case 'assets' :&#xA;        craft()-&amp;gt;templates-&amp;gt;includeCssResource( 'plugin/styles.css' );&#xA;        break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;style.css&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// remove title and name fields from modal editor in CP assets page&#xA;    .hud {&#xA;        .body.elementeditor {&#xA;            .field[id$=&quot;filename-field&quot;], .field[id$=&quot;-title-field&quot;] {&#xA;                display: none;&#xA;            }&#xA;            .field {&#xA;                margin-top: 0px;&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works fine :&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3SNix.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3SNix.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-15T11:39:02.907" LastActivityDate="2015-08-15T11:39:02.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10997" PostTypeId="2" ParentId="10727" CreationDate="2015-08-14T20:03:21.850" Score="1" Body="&lt;p&gt;To answer just the initial question. &quot;Is it possible to reorder fields with drag and drop?&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, Settings &gt; Fields &gt; Set up as Matrix &gt; You can then add/delete or reorder there using a drag method within the matrix you set-up. (See image below)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yQuSc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yQuSc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you are looking for is more control than this. While having some the same issues learning more about the use of Sections and Channels at &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/sections-and-entries&lt;/a&gt; has proven quite useful to me.&lt;/p&gt;&#xA;" OwnerUserId="3959" LastActivityDate="2015-08-14T20:03:21.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10998" PostTypeId="1" CreationDate="2015-08-14T20:16:50.123" Score="1" ViewCount="49" Body="&lt;p&gt;When a locale is first created, it seems it receives all of the default locales content. Is it possible to have this happen for a specific field after the fact? I have a large matrix (with subtle locale differences) I'm hoping to not re-enter a second time ;)&lt;/p&gt;&#xA;" OwnerUserId="677" LastActivityDate="2015-08-14T20:16:50.123" Title="Possible to repopulate locale defaults?" Tags="&lt;matrix&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11000" PostTypeId="2" ParentId="9535" CreationDate="2015-08-14T23:40:26.600" Score="3" Body="&lt;p&gt;If your custom field needs more than the default column to store it's data you can create your own custom table (or tables) and store your data however you need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This involves a few things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a Record that defines your database table&lt;/li&gt;&#xA;&lt;li&gt;Save the data to the custom table&lt;/li&gt;&#xA;&lt;li&gt;Retrieve the data from the custom table&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Create a Record that defines your database table&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create a Record, take a look at the Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Records documentation&lt;/a&gt;.  The Record defines the columns in your database table and that custom table will get created when you install your plugin, and removed when you uninstall your plugin. So, after you create your Record, go ahead and re-install your plugin to get the database table to appear in the database and ensure it's the schema you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Save the data to the custom table&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you have your custom table, you can save data to it.  In your Fieldtype Class &lt;code&gt;CustomPlugin_CustomFieldType.php&lt;/code&gt; you can do so using the &lt;code&gt;onAfterElementSave()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;  // $this-&amp;gt;element will give you access access to the Element Model  &#xA;  // your field is associated with (For example, EntryModel, CategoryModel, etc).&#xA;&#xA;  // $this-&amp;gt;model will give you access access to the FieldModel &#xA;  // your field is associated with.&#xA;&#xA;  // craft()-&amp;gt;request-&amp;gt;post will give you access to the post data &#xA;  // submitted on the request.&#xA;&#xA;  // Once you have retrieved and modified the data you want to save,&#xA;  // you can go ahead and save it to your custom table &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Retrieve the data from the custom table&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To populate your field, you'll retrieve your data from your custom tables in the &lt;code&gt;getInputHtml()&lt;/code&gt; method.  In the example below, I'm using calling the &lt;code&gt;getCustomFieldValues()&lt;/code&gt; method from the service layer which would query the database and give me back the data I need to hand off to my template to display:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    $values = craft()-&amp;gt;customPlugin-&amp;gt;getCustomFieldValues();&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('customplugin/fields/input', array(&#xA;        'name'       =&amp;gt; $name,&#xA;        'values'     =&amp;gt; $values&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-14T23:40:26.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11001" PostTypeId="1" AcceptedAnswerId="11002" CreationDate="2015-08-15T00:00:41.740" Score="2" ViewCount="144" Body="&lt;p&gt;I got an asset field called &lt;code&gt;docs&lt;/code&gt; which is contained in 2 different entries.&lt;br&gt;&#xA;Those entries are in different sections and they contain the &lt;code&gt;docs&lt;/code&gt; field &lt;strong&gt;directly&lt;/strong&gt; or through a &lt;strong&gt;matrix&lt;/strong&gt; field called &lt;code&gt;articleBody&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made two queries relatedTo and merge them thereafter.&lt;br&gt;&#xA;It works but would it be a better way by combining the two queries in one &lt;strong&gt;relatedTo&lt;/strong&gt; call?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Query 1: &lt;code&gt;pages&lt;/code&gt; section entries contain &lt;code&gt;docs&lt;/code&gt; field inside a matrix field called &lt;code&gt;articleBody&lt;/code&gt;&lt;br&gt;&#xA;Query 2: &lt;code&gt;library&lt;/code&gt; section entries contain &lt;code&gt;docs&lt;/code&gt; field directly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $criteria1 = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria1-&amp;gt;section = 'pages';&#xA;        $criteria1-&amp;gt;relatedTo = array(&#xA;            'targetElement' =&amp;gt; $asset-&amp;gt;id,&#xA;            'field' =&amp;gt; 'articleBody.docs'&#xA;        );&#xA;&#xA;        $criteria2 = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria2-&amp;gt;section = 'library';&#xA;        $criteria2-&amp;gt;relatedTo = array(&#xA;            'targetElement' =&amp;gt; $asset-&amp;gt;id,&#xA;            'field' =&amp;gt; 'docs'&#xA;        );&#xA;&#xA;        $criteria = array_merge($criteria1, $criteria2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-15T11:12:19.247" LastActivityDate="2015-08-15T11:12:19.247" Title="Get different kind of entries relatedTo one asset (many to one)?" Tags="&lt;relations&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11002" PostTypeId="2" ParentId="11001" CreationDate="2015-08-15T00:19:56.357" Score="2" Body="&lt;p&gt;OK in fact it was very simple: criteria params accept arrays...  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;        $fields = [&#xA;            'articleBody.efficyDocuments',&#xA;            'efficyDocuments'&#xA;        ];&#xA;&#xA;        $criteria-&amp;gt;relatedTo = array(&#xA;            'targetElement' =&amp;gt; $asset-&amp;gt;id,&#xA;            'field' =&amp;gt; $fields,&#xA;        );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-08-15T00:19:56.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11003" PostTypeId="2" ParentId="8914" CreationDate="2015-08-15T00:28:41.743" Score="1" Body="&lt;p&gt;I'll be happy to see the SQL answer if anybody posts it but I expect this is a very complex query to write manually for anyone without advanced SQL knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this isn't an answer that solves the immediate question, I think a fair answer is that this type of query is complex enough that it probably makes sense to build a custom solution (as it sounds like you did) or wait until Sprout Reports (or another alternative exists) that makes it easier to extend the plugin to run more programmatic or memory-intensive queries for use cases like the one you describe.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T00:28:41.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11004" PostTypeId="2" ParentId="9196" CreationDate="2015-08-15T00:42:23.940" Score="2" Body="&lt;p&gt;Nesting cache tags shouldn't cause any new problems (assuming you've taken into account all the fun problems already caused by cache).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each cache tag will store it's contents in a database table for easier access. We can illustrate this a bit easier using cache tags with keys.  Take the following example with two cache tags using the keys &lt;code&gt;dog&lt;/code&gt; and &lt;code&gt;cat&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key 'dog' %}&#xA;    BUSTER&#xA;    {% cache using key 'cat' %} &#xA;        KITTEN&#xA;    {% endcache %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the cache tags are run they store the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; stores the value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;KITTEN&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;dog&lt;/code&gt; stores the value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BUSTER&#xA;KITTEN&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spacing in my example above may not be perfectly accurate but the gist of what content is stored should be. In the case that the page is loaded a second time, when the &lt;code&gt;dog&lt;/code&gt; cache tag is found, Craft will pull it's content from the database.  The &lt;code&gt;cat&lt;/code&gt; cache tag will never get run, but it doesn't matter, because the full contents of the wrapping &lt;code&gt;dog&lt;/code&gt; cache tag have already been retrieved.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T00:42:23.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11005" PostTypeId="2" ParentId="9124" CreationDate="2015-08-15T01:12:57.873" Score="4" Body="&lt;p&gt;As you've discovered, your Matrix Field behaves a bit differently than many other basic fields.  The Matrix Field, is composed of several Matrix Blocks and, like Entries themselves, Matrix Blocks are Element Types.  So, you can access your value on a &lt;code&gt;MatrixBlockModel&lt;/code&gt; in the familiar way that you know how to do already on your &lt;code&gt;EntryModel&lt;/code&gt;, however, first you need to get to it which requires an extra step from the &lt;code&gt;EntryModel&lt;/code&gt; you get back when a form fails validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your Form fails validation, an EntryModel gets returned to the page.  This &lt;code&gt;EntryModel&lt;/code&gt; can't be accessed directly but its attributes and methods can be accessed.  From the example you referenced:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Our Title can be found on our EntryModel like so #}&#xA;{% if entry is defined %}{{ entry.title }}{% endif -%}&#xA;&#xA;{# And errors can be accessed on our EntryModel too #}&#xA;{{ entry.getErrors('title') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can access our Matrix Field like our Title field or any other custom field, but since it's not a simple field, it gives us back an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; and we can't output anything without navigating further into the model and accessing each block and the fields within each block directly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This will thrown an error &quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot; #}&#xA;{{ entry.matrixFieldHandle }}&#xA;&#xA;{# But we can access the first block just like we would a single Entry or Asset #}&#xA;{{ entry.matrixFieldHandle.first() }}&#xA;&#xA;{# And a field within that block in the same way we would a field on the EntryModel #}&#xA;{{ entry.matrixFieldHandle.first().fieldHandle }}&#xA;&#xA;{# And the errors of those fields within a block in the same way we would a field on the EntryModel #}&#xA;{{ entry.matrixFieldHandle.first().getError('fieldHandle') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To navigate all the retained values and errors for your Matrix Field, you'll need to loop through the &lt;code&gt;MatrixBlockModel&lt;/code&gt;s of your matrix &lt;code&gt;entry.matrixFieldHandle&lt;/code&gt; and output the values and errors within your template.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T01:12:57.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11006" PostTypeId="2" ParentId="10988" CreationDate="2015-08-15T01:20:58.060" Score="4" Body="&lt;p&gt;The Categories Settings let you set up &lt;a href=&quot;http://buildwithcraft.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;Category Groups&lt;/a&gt;, define some behaviors for your Category Groups (for example, if you want them to have URLs and the pattern of those URLs), and assign Custom Fields to those Category Groups (which would allow all categories in that group to have custom fields just like all Entries have the same custom fields in a section).&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T01:20:58.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11007" PostTypeId="2" ParentId="10989" CreationDate="2015-08-15T01:43:14.220" Score="4" Body="&lt;p&gt;You could try creating a different entry &lt;em&gt;type&lt;/em&gt; for your &quot;hello&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I am building a site for a restaurant. The &quot;food&quot; section is a structure. Each entree is the same template, each &quot;category&quot; uses the same section, but a different entry type. That way the admin only has to click &quot;new entry&quot;, then choose either &quot;entree&quot; or &quot;category&quot; as the entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each category gives me the titles, &quot;sandwiches&quot; &quot;burgers&quot; etc, then my entree type is the actual food item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on what they pick, input fields will be different, however the markup on the page remains the same.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-08-15T01:43:14.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11008" PostTypeId="1" CreationDate="2015-08-15T02:13:15.767" Score="3" ViewCount="161" Body="&lt;p&gt;For simplicity, I'm building a site for a restaurant. The &quot;Menu&quot; page has the following url(s):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/food/appetizers&#xA;mysite.com/food/sandwiches&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;food&lt;/code&gt; is a structure. It contains every entree the restaurant has. I've nested the actual entree to under the corresponding category. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/food/appetizers&#xA;                         /cheese-curds&#xA;                         /french-fries &#xA;&#xA;mysite.com/food/sandwiches&#xA;                        /whole-sandwich&#xA;                        /half-sandwich&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;..and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;code&gt;mysite.com/food/&lt;/code&gt; I can render all entrees under thier corresponding category like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('food') %}&#xA;&#xA; {% for entry in entries %}&#xA;       {% if entry.type == 'category' %}  &#xA;           &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;       {% endif %}&#xA;&#xA;       {% set children = entry.getChildren() %}&#xA;       {% for child in children %}&#xA;           &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;{{ child.getUrl }}&quot;&amp;gt;{{ child.title }}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;       {% endfor %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is working great. All entrees are listed below their corresponding &quot;category&quot; on my &lt;code&gt;/food/&lt;/code&gt; page. I can click on each individual entree &quot;cheese-curds&quot; for example, and can get the entry details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For templates I have &lt;code&gt;_entry&lt;/code&gt; and &lt;code&gt;index&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;index&lt;/code&gt; is used on &lt;code&gt;mysite.com/food&lt;/code&gt; &lt;code&gt;_entry&lt;/code&gt; is used on each entree. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I'm stuck is how to render the entries for the current category. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/food/appetizers&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure How to get past my initial command of getting ALL entires:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entries = craft.entries.section('food') %}&#xA;&#xA; {% for entry in entries %}&#xA;       {% if entry.type == 'category' %}&#xA;       ....&#xA;       .... &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To only this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'category' %}&#xA;  ....&#xA;  ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that I am only listing out the entries for the current category. It's OK if I need to create a new template, I'm not sure how to tell Craft how to do that. Or is there a better approach to getting all entries for the structure? It seems simple enough in theory, I keep talking myself in circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you @j00lz&#xA;Your solution makes perfect sense. I think I either don't &lt;em&gt;quite&lt;/em&gt; understand, or I'm still at the same spot I was before.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.level %}&#xA;    {% case 1 %}        &#xA;        {# this is mysite.com/food #}&#xA;        {# outputs #}&#xA;        Appetizers&#xA;            Cheese Curds&#xA;            French Fries&#xA;        Sandwiches&#xA;            Sandwich One&#xA;            Sandwich Two&#xA;    {% case 2 %}&#xA;        {# this is mysite.com/food/appetizers&#xA;        {# outputs #}&#xA;        Appetizers&#xA;            Cheese Curds&#xA;            French Fries&#xA;    {% case 3 %}&#xA;        {# this is mysite.com/food/appetizers/french-fries&#xA;        {# outputs #}&#xA;            French Fries&#xA;            French fries are awesome!&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, it's like I need another template to only show the 2nd case on the page.&#xA;I can list all foods, and the actual entrée (3rd case) using 2 templates. I'm hung up on that middle page where it would only list the title of the entrée, and then the children entrée.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about putting an &lt;code&gt;if&lt;/code&gt; statement at the top of the page that checks the URL level. If it's only &lt;code&gt;/food/&lt;/code&gt; do &quot;x&quot;, if its &lt;code&gt;/food/appetizers&lt;/code&gt; do &quot;y&quot;, but that seems to assume an awful lot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there is a better route to go all together. I only had a structure in mind because of the nested elements that I wanted to be able to control where they were.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="27" LastEditDate="2015-08-16T21:16:55.547" LastActivityDate="2015-08-16T21:16:55.547" Title="How do I render specific child entries of a structure based on url segment" Tags="&lt;structure&gt;&lt;children&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11009" PostTypeId="1" CreationDate="2015-08-15T02:48:52.787" Score="3" ViewCount="68" Body="&lt;p&gt;I've noticed something odd and I can't find anything in the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm writing a plugin and when I use &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to find an existing entry like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'entryHandle';&#xA;$criteria-&amp;gt;title = 'The Title &amp;amp; Stuff';&#xA;$existingEntry = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The entry is not found, and I believe it's because of the punctuation. The entry is clearly in the &lt;code&gt;craft_content&lt;/code&gt; table (with the exact title including punctuation). Is there some sort of processing I need to do before setting the title criterion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3943" LastActivityDate="2015-09-14T20:37:01.830" Title="Problems with Punctuation in Title using ElementCriteriaModel" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11010" PostTypeId="2" ParentId="11008" CreationDate="2015-08-15T04:58:13.553" Score="1" Body="&lt;p&gt;Probably the simplest way is to split the code up like this in your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.level %}&#xA;    {% case 1 %}        &#xA;        {# all the food #}&#xA;    {% case 2 %}&#xA;        {# course level #}&#xA;    {% case 3 %}&#xA;        {# one dish #}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This give you a lot of fine control over each level of your structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even simpler:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('food').descendantOf( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and run the same loop regardless of which level you are on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also have a look at &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; to see how to create a navigation for a structured section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you want elaborately styled menus check out &lt;a href=&quot;http://craftcookbook.net/recipes/388&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-15T05:14:54.977" LastActivityDate="2015-08-15T05:14:54.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11011" PostTypeId="2" ParentId="8662" CreationDate="2015-08-15T16:01:53.970" Score="2" Body="&lt;p&gt;I don't know of a solution for footnotes within Rich Text fields aside from the plugin referenced in the comments of the question. As an alternative, consider having a read over &lt;a href=&quot;https://experiencehq.net/blog/craft-with-markdown-and-matrix&quot; rel=&quot;nofollow&quot;&gt;Craft Your Content With Markdown And Matrix&lt;/a&gt; by Stephen Lewis.  He explains how he handles footnotes using Matrix and smartdown.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T16:01:53.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11012" PostTypeId="2" ParentId="7128" CreationDate="2015-08-15T16:07:42.687" Score="4" Body="&lt;p&gt;This sounds like a good approach and could be done using a twig filter on your search string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the first two lines of the example from the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query|customFilter).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example &lt;code&gt;query&lt;/code&gt; is now modified by &lt;code&gt;customFilter&lt;/code&gt; and can be updated in your Twig filter to behave however you like.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T16:07:42.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11013" PostTypeId="2" ParentId="10471" CreationDate="2015-08-15T16:23:53.047" Score="2" Body="&lt;p&gt;You can build you categories dropdown using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.categories&lt;/code&gt; tag&lt;/a&gt;.  Your Form submission field will end up looking something like this in HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;search/results&quot; method=&quot;get&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;querySlug&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;*&quot;&amp;gt;All products&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;fruit&quot;&amp;gt;Fruit&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;vegetables&quot;&amp;gt;Vegetables&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;dairy&quot;&amp;gt;Dairy&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your results page will behave similar to the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;example results page&lt;/a&gt; in the Craft docs, except, instead of passing your query to a &lt;code&gt;craft.entries.search()&lt;/code&gt; tag, you'll want to pass it to the &lt;code&gt;craft.categories.slug()&lt;/code&gt; tag and then hand off the CategoryModel you get back to the &lt;code&gt;craft.entries&lt;/code&gt; tag using &lt;code&gt;relatedTo()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set querySlug = craft.request.getParam('querySlug') %}&#xA;{% set category = craft.categories.group('productCategories').slug(querySlug) %}&#xA;{% set entries = craft.entries.section('products').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All categories are returned by default, so you just have to handle that in a conditional if somebody selects that option.  Here is a simple way you could do that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set querySlug = craft.request.getParam('querySlug') %}&#xA;{% set category = craft.categories.group('productCategories').slug(querySlug) %}&#xA;&#xA;{% if querySlug == &quot;*&quot; %}   &#xA;    {% set products = craft.entries.section('products') %}&#xA;{% else %}&#xA;    {% set products = craft.entries.section('products').relatedTo(category) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T16:23:53.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11014" PostTypeId="1" AcceptedAnswerId="11015" CreationDate="2015-08-15T17:32:41.397" Score="10" ViewCount="5675" Body="&lt;p&gt;I have a channel of events with a field ‘eventDate’ for the date/time of the event. Within that there are ‘types’ of events ‘eventType’. What would be the most efficient way of outputting the NEXT (future date from now) that is of the ‘eventType’ equal to ‘Green’?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far i’ve got &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.entries.section('events').order('eventDate asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will output the entries in the correct order based on the eventDate, but can i filter the query even further to include the conditionals to only output if the date is in the future like this conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.eventDate|date(&quot;c&quot;) &amp;gt; now|date('c') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also include the conditional to only output if the eventType == ‘green’ like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.eventType == ‘green’ %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that i can set the ‘limit’ to whatever i want and ONLY have the entries that meet the conditionals be included before that limit is applied?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that i can use the 'Search' like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.entries.section('events').search('eventType:green').order('eventDate asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But A. Is that the most efficient and B. How do i also include only entries that are in the FUTURE from NOW based on the eventDate field?&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2015-08-15T17:45:46.930" LastActivityDate="2015-08-15T17:53:59.903" Title="Advanced query/filter based on date and values" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;search&gt;&lt;forloop&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11015" PostTypeId="2" ParentId="11014" CreationDate="2015-08-15T17:53:59.903" Score="14" Body="&lt;p&gt;You're actually closer than you might think. All you need to do is add your field handles as parameters. I prefer to use the hash style of declaring parameters but either way will work, I just find this easier to read.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;  section : 'events',&#xA;  order : 'eventDate asc',&#xA;  eventDate : '&amp;gt;=' ~ now,&#xA;  eventType : 'green',&#xA;  limit : '10'&#xA;} %}&#xA;&#xA;{% for event in craft.entries(params) %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method also allows you to easily modify the params hash for whatever reason. For example you might want to set the &lt;code&gt;eventType&lt;/code&gt; value to be something else based on the value of a query parameter. To do that you could use the merge tag like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('eventType') not empty %}&#xA;&#xA;  {% set params = params | merge({&#xA;    eventType : craft.request.getParam('eventType')&#xA;  }) %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="144" LastActivityDate="2015-08-15T17:53:59.903" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="11016" PostTypeId="2" ParentId="11009" CreationDate="2015-08-15T20:05:10.743" Score="1" Body="&lt;p&gt;I've tested your code with a similar query in a local database and am getting the results you'd expect. So the code seems accurate. Aside from environmental variables that may be at play, the only part of the example code above that I see a potential issue with the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;section = 'entryHandle'; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's unclear what you may mean by &lt;code&gt;entryHandle&lt;/code&gt;.  This value should be the &lt;code&gt;sectionHandle&lt;/code&gt;. If &lt;code&gt;entryHandle&lt;/code&gt; means &lt;code&gt;slug&lt;/code&gt;, then the &lt;code&gt;$criteria-&amp;gt;section&lt;/code&gt; may need to get updated to be &lt;code&gt;$criteria-&amp;gt;slug = 'entryHandle';&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-15T20:05:10.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11017" PostTypeId="1" AcceptedAnswerId="11020" CreationDate="2015-08-15T20:22:47.117" Score="4" ViewCount="165" Body="&lt;p&gt;I am making a dashboard widget to trigger the assets indexing action.&#xA;I got the controller ready but I do not understand then how to trigger the action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I go with &lt;code&gt;AssetIndexTool&lt;/code&gt;? Then &lt;code&gt;performAction()&lt;/code&gt;?&lt;br&gt;&#xA;Or using &lt;code&gt;ToolsController&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am really lost. Thanks for help!  &lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-08-16T12:57:18.283" Title="Assets indexing from plugin controller" Tags="&lt;assets&gt;&lt;controller&gt;&lt;reindex&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11018" PostTypeId="1" CreationDate="2015-08-16T02:16:00.250" Score="3" ViewCount="501" Body="&lt;p&gt;I am using a global set to store image assets used across the site.  I am not sure how to reference a specific image. I know how to get the image if its just one, using :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ design.imgs | length ? design.imgs.first().getUrl() : '' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What if there are several images and I am looking for a specific one?&lt;/p&gt;&#xA;" OwnerUserId="916" LastEditorUserId="22" LastEditDate="2017-05-09T23:33:44.070" LastActivityDate="2017-05-09T23:33:44.070" Title="Find specific image from global image set?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11019" PostTypeId="2" ParentId="11018" CreationDate="2015-08-16T07:33:31.140" Score="1" Body="&lt;p&gt;When you call &lt;code&gt;myGlobalSet.myAssetsField&lt;/code&gt;, you're creating an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;ElementCriteriaModel&lt;/strong&gt;&lt;/a&gt;. This is significant, because an ElementCriteriaModel is basically a &quot;search object&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;design.imgs&lt;/code&gt; call produces an ElementCriteriaModel based on &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;code&gt;craft.assets&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt;. It will return only the assets which are &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;related to&lt;/a&gt; your global field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can manipulate your ElementCriteriaModel in whatever way you want!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myAsset = design.imgs.kind('image').sourceId(1).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-16T07:33:31.140" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11020" PostTypeId="2" ParentId="11017" CreationDate="2015-08-16T07:58:07.193" Score="5" Body="&lt;p&gt;I guess you would need to have your own method in your controller to fire up the indexing tool. From what it looks like, you need a few things to get going:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The classname of the tool i.e &lt;code&gt;AssetIndex&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;An array of asset sources or &lt;code&gt;*&lt;/code&gt; for them all&lt;/li&gt;&#xA;&lt;li&gt;An indexing session id&lt;/li&gt;&#xA;&lt;li&gt;An array of parameters to send to the tool&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I managed to get something working with the following code (this would go in your plugin controller)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpdateIndex()&#xA;{&#xA;  // Get the AssetIndex tool&#xA;  $tool = craft()-&amp;gt;components-&amp;gt;getComponentByTypeAndClass(ComponentType::Tool, 'AssetIndex');&#xA;&#xA;  // Generate an AssetIndex session id for us to use&#xA;  $sessionId = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexingSessionId();&#xA;&#xA;  // Set up some params&#xA;  $params = array(&#xA;    'start' =&amp;gt; '1', // Tells the tool this is the initial request&#xA;    'sources' =&amp;gt; '*', // All of them or [1,2,3] just ids1&#xA;  );&#xA;&#xA;  // Get an initial response from the tool, will contain an array containing the assets to index&#xA;  $response = $tool-&amp;gt;performAction($params);&#xA;&#xA;  // See [1]&#xA;  foreach($response['batches'] as $key =&amp;gt; $value)&#xA;  {&#xA;    foreach($value as $key =&amp;gt; $batch)&#xA;    {&#xA;       // All the needed params are set in the array to do the index&#xA;       $tool-&amp;gt;performAction($batch['params']);&#xA;    }&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each time you call &lt;code&gt;$tool-&amp;gt;performAction($batch['params']);&lt;/code&gt; you will an array back, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA; [success] =&amp;gt; 1&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[1]&lt;/strong&gt; Because this is the initial request craft will return an array with a &lt;code&gt;batches&lt;/code&gt; index, which we then have to do a few loops through, it looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA; [batches] =&amp;gt; Array&#xA;  (&#xA;   [0] =&amp;gt; Array&#xA;    (&#xA;     [0] =&amp;gt; Array&#xA;      (&#xA;       [params] =&amp;gt; Array&#xA;        (&#xA;         [sessionId] =&amp;gt; 6d08c5ba-169f-4b99-a7bd-cdc26c9428c7&#xA;         [sourceId] =&amp;gt; 1&#xA;         [total] =&amp;gt; 12&#xA;         [offset] =&amp;gt; 0&#xA;         [process] =&amp;gt; 1&#xA;        )&#xA;&#xA;       )&#xA;&#xA;      )&#xA;&#xA;    )&#xA;&#xA; [total] =&amp;gt; 0&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is the absolute best way to do it, I was learning as I was going, but this worked for me so hopefully it'll work for you too :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-08-16T12:57:18.283" LastActivityDate="2015-08-16T12:57:18.283" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="11022" PostTypeId="1" AcceptedAnswerId="11041" CreationDate="2015-08-16T11:06:21.963" Score="2" ViewCount="259" Body="&lt;p&gt;I would like to install the happylager demo site on my server instead of installing it locally,&lt;br&gt;&#xA;but all i get is 404 pages when i visit &lt;a href=&quot;http://adamridovics.com/happylager.dev/admin&quot; rel=&quot;nofollow&quot;&gt;http://adamridovics.com/happylager.dev/admin&lt;/a&gt;&lt;br&gt;&#xA;Is this possible at all, or i am doing something worong?&lt;/p&gt;&#xA;" OwnerUserId="3927" LastActivityDate="2015-08-17T23:06:28.160" Title="Installing happylager demo site on own server (not locally)" Tags="&lt;install&gt;&lt;404&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11023" PostTypeId="1" AcceptedAnswerId="11024" CreationDate="2015-08-16T11:12:11.483" Score="3" ViewCount="258" Body="&lt;p&gt;I couldn't find anything on here about this. Maybe I'm the only one, but for example when you log in there is a session notice with the message &quot;Logged in.&quot;, but I want it to display something like &quot;Good to see you&quot; or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the notices are set via &lt;code&gt;Craft::t()&lt;/code&gt;, so I would assume they are translatable somehow, so can I do this through configuration files or a plugin init method or something?&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="392" LastEditDate="2015-08-16T21:17:20.127" LastActivityDate="2015-08-16T21:17:20.127" Title="Is it possible to override the default session notices?" Tags="&lt;templating&gt;&lt;config&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11024" PostTypeId="2" ParentId="11023" CreationDate="2015-08-16T11:24:07.813" Score="4" Body="&lt;p&gt;If you place a PHP file in &lt;code&gt;craft/translations&lt;/code&gt; named after a locale ID and returning an array, those values will be used instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/translations/en.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'Logged in.' =&amp;gt; 'Good to see you.',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft's own CP translation files can be found in &lt;code&gt;craft/app/translations&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about it here: &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/static-translations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="57" LastEditDate="2015-08-16T16:37:23.543" LastActivityDate="2015-08-16T16:37:23.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11025" PostTypeId="2" ParentId="11018" CreationDate="2015-08-16T18:31:24.757" Score="1" Body="&lt;p&gt;If you have a smallish (under a dozen or so), pre-determined set of distinguished images, then I would create a separate global asset for each of them. So you would have &lt;code&gt;design.logo&lt;/code&gt;, &lt;code&gt;design.facebookIcon&lt;/code&gt;, etc. And then just refer to them that way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if design.logo|length %}&#xA;  {{ design.logo.first.getUrl() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Always check that an asset exists before you use it. Otherwise you will have your site front-end mysteriously crashing at some point in the future when that asset is not there&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-16T18:31:24.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11026" PostTypeId="1" CreationDate="2015-08-16T18:48:26.640" Score="3" ViewCount="175" Body="&lt;p&gt;I'm in the middle of a very long project developing a league site for the National Collegiate Wrestling Association in my spare time (once finished, could be a great showcase for Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm trying to implement a points system, where athletes accumulate points based on the matches they win &amp;amp; &lt;em&gt;how&lt;/em&gt; they win them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of an athletes stat page (wip) &lt;a href=&quot;http://cl.ly/image/3L2A0e2x1q3v&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/image/3L2A0e2x1q3v&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the results are tied to an event, so the points can be recalculated easily if an event has to be removed for whatever reason, or a coach inputs the wrong kid by accident. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is quite a bit of logic being done here, but manageable, and can be cached- but teams &lt;em&gt;also&lt;/em&gt; accumulate points based on the points of the top 11 athletes in their roster!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means the points will have to be calculated and displayed on &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Team's page (11x the queries) &lt;/li&gt;&#xA;&lt;li&gt;The Index page of all Teams&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently, the only way I know how to do this, will be some heavy nesting of conditionals in loops- repeating the process of each athlete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know doing it this way, all in the templates, is extremely unorthodox. I'm 99.9% this would be much easier to implement with plugins somehow, but unfortunately I don't know PHP nor do I have the time to invest in the trial/error learning process of how to write plugins in the time needed. So I'm kinda up against a wall here and looking for solutions to smooth out this process, regardless of how hacky it may be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there's a way to only perform these massive queries in the middle of the night, and the points total only updates once per day, no matter how many results are inputted in the 24-hour period? I don't know. Please help me, very kind Craft community :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Added requested template logic... Removed extra unnecessary code for readability &amp;amp; sake of space. Team pages &amp;amp; Teams Index page won't require all the information displayed in screenshot (date, opponent, score/time, pt diff)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set athlete = craft.users.id( craft.request.lastSegment ).first %}&#xA;{% set results = craft.entries.section('results').relatedTo({&#xA;    targetElement: athlete,&#xA;    field: 'matches',&#xA;}) %}&#xA;{% set points = 0 %}&#xA;{% if results|length %}&#xA;&#xA;  {% for result in results %}&#xA;    {% for block in result.matches %}&#xA;      {% if (athlete.id == block.winner.first.id) or (athlete.id == block.loser.first.id) %}&#xA;&#xA;          {% if block.winner|length and (athlete.id == block.winner.first.id) %}&#xA;            {% if (block.result == &quot;Maj&quot;) or (block.result == &quot;Dec&quot;) %}&#xA;               {% set points = (points + 5) %}&#xA;               {% set difference = &quot;+5&quot; %}&#xA;              {% else %}&#xA;                {% set points = (points + 6.1) %}&#xA;                {% set difference = &quot;+6.1&quot; %}&#xA;            {% endif %}&#xA;          {% endif %}&#xA;&#xA;          {% if block.loser|length and (athlete.id == block.loser.first.id) %}&#xA;            {% if athlete.id == block.loser.first.id %}&#xA;              Lost by {{ block.result.label }}&#xA;                {% set points = points - 1.75 %}&#xA;                {% set difference = &quot;-1.75&quot; %}&#xA;                {% set negative %}{% endset %}&#xA;            {% endif %}&#xA;          {% endif %}&#xA;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;&#xA;&#xA;{% set tournaments = craft.entries.section('results').relatedTo({&#xA;  targetElement: athlete,&#xA;  }) %}&#xA;{% if tournaments|length %}&#xA;  {% for tournament in tournaments %}&#xA;&#xA;    {% if tournament.type.handle == 'minorTournament' %}&#xA;      {% for w in 1..3 %}&#xA;        {% for p in 1..3 %}&#xA;          {% if (tournament['w'~w~'p'~p]|length) and (tournament['w'~w~'p'~p].first.id == athlete.id) %}&#xA;&#xA;            {% switch loop.index %}&#xA;              {% case &quot;1&quot; %}&#xA;              {% set points = (points + 6) %}&#xA;              {% case &quot;2&quot; %}&#xA;              {% set points = (points + 4) %}&#xA;              {% case &quot;3&quot; %}&#xA;              {% set points = (points + 2) %}&#xA;            {% endswitch %}&#xA;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;      {% endfor %}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;Points:&amp;gt;{{points}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2015-08-17T20:57:47.350" LastActivityDate="2015-08-18T07:31:41.680" Title="Help developing point system for sports league (w/o plugins)" Tags="&lt;templating&gt;&lt;relations&gt;&lt;forloop&gt;&lt;math&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11027" PostTypeId="1" CreationDate="2015-08-16T20:08:06.627" Score="3" ViewCount="313" Body="&lt;p&gt;In my template I'm displaying all entries of a structure: ('areas').level(1) using a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to display the number of children entries in each of the 'areas'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like: &quot;Area 1, 4 properties&quot;, &quot;Area 2, 7 properties&quot;, &quot;Area 3, 5 properties&quot; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone?&lt;/p&gt;&#xA;" OwnerUserId="3973" LastActivityDate="2015-08-17T14:18:56.443" Title="Output number of children in a structure" Tags="&lt;structure&gt;&lt;children&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11028" PostTypeId="2" ParentId="11027" CreationDate="2015-08-16T20:39:29.583" Score="1" Body="&lt;p&gt;You could get the number of direct children using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numChildren = entry.children().count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if there's an efficient solution to getting the full number of children, grandchildren etc. without just comparing against the URL which seems like a workaround.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastEditorUserId="27" LastEditDate="2015-08-17T14:18:56.443" LastActivityDate="2015-08-17T14:18:56.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11029" PostTypeId="2" ParentId="11027" CreationDate="2015-08-17T02:35:15.037" Score="2" Body="&lt;p&gt;If you want all the descendent too you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalDescendents = entry.getDescendants().count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://buildwithcraft.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow&quot;&gt;https://buildwithcraft.com/docs/templating/entrymodel#getDescendants&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-08-17T02:35:15.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11030" PostTypeId="1" CreationDate="2015-08-17T06:46:42.493" Score="7" ViewCount="3153" Body="&lt;p&gt;It's my first website using Craft.&#xA;I'm trying to figure out how to loop Matrix. I have created a field called &lt;code&gt;bannerMatrix&lt;/code&gt; with a block type called &lt;code&gt;banner&lt;/code&gt; that has 3 fields:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Image (assets)&lt;/li&gt;&#xA;&lt;li&gt;Heading (plain text)&lt;/li&gt;&#xA;&lt;li&gt;Subheading (plain text)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.bannerMatrix %}&#xA;    {% if block.type == &quot;banner&quot; %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ block.image }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;hero_msg&quot;&amp;gt;&#xA;                &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ block.subheading }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anything will be helpful.&#xA;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@JamieWade, thanks a lot for the super fast answer! &#xA;Unfortunately, the code above still doesnt work for me :(&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.bannerMatrix %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ block.image.first().title }}&quot; alt=&quot;&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;hero_msg&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;h4&amp;gt;{{ block.subheading }}&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.image.first() %}&#xA;{% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl('image') }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I dont get anything as well :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if my structure is correct. So I attached a screenshot.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7Z2C9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Z2C9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Alec, yes there is content in the entry(I attached a screenshot). Now I'm even more curious, what's missing here. I also added the path to subfolder in the Field Setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t0Zr5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t0Zr5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5oJUD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5oJUD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/26Zfm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/26Zfm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3974" LastEditorUserId="3974" LastEditDate="2015-08-20T05:24:23.253" LastActivityDate="2015-08-20T22:35:41.523" Title="Templating Matrix Block" Tags="&lt;matrix&gt;&lt;blocks&gt;" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11031" PostTypeId="2" ParentId="11030" CreationDate="2015-08-17T06:58:11.373" Score="2" Body="&lt;p&gt;Hi Sylvia and welcome to Craft. You are almost there with your markup, there are only 2 little things I can spot straight away:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Line 4&lt;/strong&gt; you are calling &lt;code&gt;{{ image.title }}&lt;/code&gt; however the &lt;code&gt;image&lt;/code&gt; variable doesn't exist anywhere from what I can see in your code.&#xA;In &lt;strong&gt;Line 1&lt;/strong&gt; you are looping through your Matrix field with a &lt;code&gt;block&lt;/code&gt; variable: &lt;code&gt;{% for block in ... %}&lt;/code&gt;, so this means each time you reference a field you will need to start it with &lt;code&gt;{{ block. }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change &lt;strong&gt;Line 4&lt;/strong&gt; to &lt;code&gt;{{ block.image.first().title }}&lt;/code&gt; then you will get what you are trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if your Matrix field only has one block type, there is no need to check that block type when looping through it. You can remove &lt;code&gt;{% if block.type == &quot;banner&quot; %}&lt;/code&gt; and everything will still work like before.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2015-08-18T05:54:44.777" LastActivityDate="2015-08-18T05:54:44.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11033" PostTypeId="1" CreationDate="2015-08-17T08:53:14.323" Score="1" ViewCount="304" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://dukt.net/craft/twitter&quot; rel=&quot;nofollow&quot;&gt;Dukt Twitter&lt;/a&gt; plugin which requires the &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;Dukt OAuth&lt;/a&gt;  plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are working perfectly on both my local Dev environment and the remote Staging environment, but not on the Live site. Both plugins install with no errors or problems. Configuring the OAuth plugin (for Twitter only) is fine as well - it accepts the keys/credentials generated from the Twitter API Management Console and shows as &quot;configured&quot; on it's status screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I then go to the actual Twitter plugin config and hit the &quot;Connect to Twitter&quot; button, I get this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Class 'League\OAuth1\Client\Server\Twitter' not found in /webserver/domains/[CLIENT]/live/craft/plugins/oauth/providers/Twitter.php on line 46&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea what this error message means?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect it's more to do with the server or site config than the actual plugin but I'm not sure where to start looking as I don't understand why it can't find that namespace&lt;/p&gt;&#xA;" OwnerUserId="3864" LastEditorUserId="57" LastEditDate="2015-08-17T17:46:14.260" LastActivityDate="2015-08-19T12:25:29.737" Title="Help understanding an error message from Dukt OAuth plugin" Tags="&lt;plugin-duktoauth&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11034" PostTypeId="1" CreationDate="2015-08-17T09:18:36.200" Score="2" ViewCount="290" Body="&lt;p&gt;Is there a way to add new items in a structure to the top of the list? Now I have to drag it from the bottom to the top.&lt;/p&gt;&#xA;" OwnerUserId="3975" LastActivityDate="2015-08-17T10:15:48.070" Title="Adding new structure items to top of structure" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11035" PostTypeId="2" ParentId="11034" CreationDate="2015-08-17T10:15:48.070" Score="2" Body="&lt;p&gt;As far as I'm aware there is nothing like that natively to Craft. You can either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Submit a &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;Feature Request&lt;/a&gt; for adding pages to the top of structures&lt;/li&gt;&#xA;&lt;li&gt;Develop your own &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up&quot; rel=&quot;nofollow&quot;&gt;Craft plugin&lt;/a&gt; that provides this functionality&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-08-17T10:15:48.070" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11036" PostTypeId="1" CreationDate="2015-08-17T10:39:36.100" Score="0" ViewCount="151" Body="&lt;p&gt;Our client wants to have an English back-end, but a German front-end (for now, other languages later). Any idea how to handle this?&lt;/p&gt;&#xA;" OwnerUserId="3827" LastEditorUserId="57" LastEditDate="2015-08-17T17:48:08.467" LastActivityDate="2015-08-17T17:50:07.130" Title="How do I change the default front-end language in Craft Personal?" Tags="&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11037" PostTypeId="1" AcceptedAnswerId="11042" CreationDate="2015-08-17T10:49:15.147" Score="8" ViewCount="900" Body="&lt;p&gt;I need to get entries which are only in current category, not child categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I have a category structured like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Food&#xA;----Fruit&#xA;-------Apples&#xA;-------Bananas&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've got a categories template and I'm on the page for the Fruit category I want to know whether there's any entries just in the Fruit category and not all the entries in the Apples and Bananas categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current I'm doing this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft.entries.relatedTo(category)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm getting all the entries from the children categories as well, how do I get only the entries related to this specific category not child categories?&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-08-18T02:34:36.317" Title="How to get entries related to current category only (not children)" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11038" PostTypeId="1" CreationDate="2015-08-17T12:23:33.473" Score="0" ViewCount="305" Body="&lt;p&gt;I have recently uploaded our dev site to the live server so we can populate with correct assets and deploy once complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set all variables I can think of to reflect the new environment, but for some reason no entries are showing and 'Unknown error has occurred' is shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is now on a subdir of a domain whereas before it was at the root. Also we're now using a Craft personal license as for this site we don't need more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone shine some light on what's happened please?! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, &#xA;Tom&lt;/p&gt;&#xA;" OwnerUserId="3856" LastActivityDate="2015-08-17T12:23:33.473" Title="No entries showing: Unknown error has occurred" Tags="&lt;entries&gt;&lt;singles&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11039" PostTypeId="1" CreationDate="2015-08-17T16:01:05.223" Score="2" ViewCount="65" Body="&lt;p&gt;Is there a way to pull out all entry fields for an entry by their handle so they can be looped through?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example rather than doing each field manually like &lt;code&gt;{{ entry.title }}&lt;/code&gt;, &lt;code&gt;{{ entry.description }}&lt;/code&gt; and &lt;code&gt;{{ entry.date }}&lt;/code&gt;, just do a loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in entry %}&#xA;    {{ field.fieldHandle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="344" LastEditDate="2015-08-18T07:57:27.977" LastActivityDate="2015-08-18T07:57:27.977" Title="Return all entry types or entry fields for one entry object" Tags="&lt;entries&gt;&lt;field&gt;&lt;entries-field&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2015-08-18T16:50:47.070" ContentLicense="CC BY-SA 3.0" />
  <row Id="11040" PostTypeId="2" ParentId="11036" CreationDate="2015-08-17T17:50:07.130" Score="1" Body="&lt;p&gt;Only Craft Pro supports multiple locales for a site.  You can see the feature matrix for the different editions here: &lt;a href=&quot;http://buildwithcraft.com/pricing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/pricing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-17T17:50:07.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11041" PostTypeId="2" ParentId="11022" CreationDate="2015-08-17T23:06:28.160" Score="2" Body="&lt;p&gt;Thanks @BradBell , your comment made me recheck everything - i just &lt;strong&gt;forgot to take out the files from the public folder&lt;/strong&gt;... now everything looks fine.&lt;/p&gt;&#xA;" OwnerUserId="3927" LastActivityDate="2015-08-17T23:06:28.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11042" PostTypeId="2" ParentId="11037" CreationDate="2015-08-18T02:34:36.317" Score="7" Body="&lt;p&gt;Since Apples and Bananas are children of Fruit, all entires that are related to Apples or Bananas are also related to Fruit, which is why you are getting the the results you are getting. If you need to exclude entries related to the subcategories, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dontInclude = [] %}&#xA;&#xA;{% for child in craft.categories.descendantOf(category) %}&#xA;    {% set dontInclude = dontInclude|merge(craft.entries.relatedTo(child).ids) %}&#xA;{% endfor %}&#xA;&#xA;{% set str = dontInclude|join(', not ') %}&#xA;&#xA;{% set fruitEntries =  craft.entries({&#xA;    relatedTo: category,&#xA;    id: 'and, not '~str&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code will loop through Fruit's categories (Apple, Banana) and retrieve all the related entires and merging them into one array. Using the expanded &lt;code&gt;craft.entries&lt;/code&gt;, you can exclude the entries related to Apple or Banana using the &lt;code&gt;id: 'and, not'&lt;/code&gt; code. Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-08-18T02:34:36.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11043" PostTypeId="2" ParentId="11026" CreationDate="2015-08-18T02:53:09.693" Score="1" Body="&lt;p&gt;Without wanting to go into any PHP or plugin development, your best bet is to set a 24 hour &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;cache&lt;/a&gt; on your chunk of processing code. As you suggested, it is probably smart to not have the cache clear itself when an entry is saved. To accomplish this, just set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheElementQueries&quot; rel=&quot;nofollow&quot;&gt;cacheElementQueries&lt;/a&gt; to false in your general config file. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-08-18T02:53:09.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11045" PostTypeId="2" ParentId="11026" CreationDate="2015-08-18T07:31:41.680" Score="1" Body="&lt;p&gt;From the looks of your code, I don't think its actually too bad, I mean there is a lot of logic going on but if its manageable for you, then really thats all that matters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig is also just a template engine for PHP:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means that if you're template logic is from memory then it should be super quick, which it looks like yours is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem would be if you had database queries nested within your &lt;code&gt;{% for %}&lt;/code&gt; loops, this is when it gets pretty intensive and would slow your templates down, but as it looks like all your queries take place out of the loops, so you shouldn't be in too much trouble and as Aaron states, you can easily set a cache which will speed things up even more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, if your templates are loading quick enough for you and you feel your code is manageable, then don't worry too much. The thing I try and personally keep to is &lt;em&gt;keep database queries out of loops as much as possible&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-18T07:31:41.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11046" PostTypeId="2" ParentId="10987" CreationDate="2015-08-18T08:58:38.990" Score="5" Body="&lt;p&gt;I would say you would need to create a custom plugin and use &lt;a href=&quot;http://developers.hubspot.com/docs/methods/workflows/webhook_information&quot; rel=&quot;nofollow&quot;&gt;Hubspot webhooks&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within this plugin you would have a controller method that, when you visit the action url, will take a response and convert it to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example if your plugin was called &lt;code&gt;hubspotentries&lt;/code&gt;, you could have a controller &lt;code&gt;HubspotEntries_WebhookController.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then inside that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class HubspotEntries_WebhookController extends BaseController {&#xA;&#xA; protected $allowAnonymous = true;&#xA;&#xA;&#xA; public function actionSync()&#xA; {&#xA;&#xA;   // If the webhook POSTS to the action url, get the php input and decode it&#xA;   $webhook = json_decode(file_get_contents('php://input'), true);&#xA;&#xA;   //....Go through webhook and save entries etc.&#xA;&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your action url would be something like &lt;code&gt;http://domain.com/actions/hubspotEntries/webhook/sync&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then give this url to Hubspot and set up it so when an event occurs, they will POST or GET to this url and you'll be able to create the entries. I did something similar to this before (not hubspot but another service) and it works like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Useful Craft Documentation links&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;Plugin development introduction&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers in plugins&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hubspot Help&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://help.hubspot.com/articles/KCS_Article/Workflows/How-do-I-use-webhooks-with-HubSpot-Workflows&quot; rel=&quot;nofollow&quot;&gt;How do I use webhooks with HubSpot Workflows&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps you get started!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-08-18T17:32:12.230" LastActivityDate="2015-08-18T17:32:12.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11047" PostTypeId="1" CreationDate="2015-08-18T10:57:45.033" Score="1" ViewCount="60" Body="&lt;p&gt;I have a field in a site I'm creating which is weather and uses a TABLE field in order to enter the MONTH, TEMP, RAIN etc etc. Im using 2 locales within the site, EN and FR... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I've setup the default values for the MONTH to include JANUARY &gt; DECEMBER which is great, i don't really want the client to have to re-enter this information each time. But is it then possible to set the DEFAULT french values for this field too? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cant see to find a way around this... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;B.&lt;/p&gt;&#xA;" OwnerUserId="3645" LastActivityDate="2015-08-18T12:55:07.677" Title="Default values when using 2 locales" Tags="&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11048" PostTypeId="2" ParentId="10984" CreationDate="2015-08-18T12:15:21.380" Score="2" Body="&lt;p&gt;I’m seeing a few issues with this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Service classes aren’t created with any arguments*, so the &lt;code&gt;$traceRecord&lt;/code&gt; argument in your &lt;code&gt;__construct()&lt;/code&gt; method is pointless.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Setting &lt;code&gt;$this-&amp;gt;traceRecord&lt;/code&gt; to &lt;code&gt;Trackr_TraceRecord::model()&lt;/code&gt; is really weird. When you call &lt;code&gt;::model()&lt;/code&gt; you’re getting a “meta” version of your record class, which should only be used to call things like &lt;code&gt;find()&lt;/code&gt;, and those functions will return the actual record instances. (It’s basically just an awkward workaround for the fact that Yii 1 didn’t require PHP 5.3+, so they couldn’t rely on Late Static Bindings support, which would have made it possible to do things like &lt;code&gt;MyServiceClass::find()&lt;/code&gt; directly - as you can in Yii 2.) Point is, you shouldn’t be storing a reference to the meta record returned by &lt;code&gt;::model()&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;$trace-&amp;gt;getAttribute('id')&lt;/code&gt; implies that your Trackr_TraceModel class has an &lt;code&gt;id&lt;/code&gt; attribute, but it doesn’t, unless you didn’t post all of your model attributes code.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calling &lt;code&gt;if ($this-&amp;gt;traceRecord-&amp;gt;findByPk($id) === NULL)&lt;/code&gt; works as a conditional statement, but it looks like your logic is assuming that if a record was actually found, that &lt;code&gt;$this-&amp;gt;traceRecord&lt;/code&gt; would be set to that new record. That won’t actually be the case unless you write &lt;code&gt;$this-&amp;gt;traceRecord = ...&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Records don’t have a &lt;code&gt;create()&lt;/code&gt; method. I’m not sure why that’s not throwing a PHP error for you. Did you add that method yourself? If you want to create a new record instance, you should be typing &lt;code&gt;$this-&amp;gt;traceRecord = new Trackr_TraceRecord();&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I’d suggest you remove your service’s &lt;code&gt;__construct()&lt;/code&gt; method, and also its protected &lt;code&gt;$traceRecord&lt;/code&gt; property. Then update its &lt;code&gt;saveTrace()&lt;/code&gt; method to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveTrace(Trackr_TraceModel &amp;amp;$trace)&#xA;{&#xA;&#xA;    if ($id = $trace-&amp;gt;getAttribute('id'))&#xA;    {&#xA;        $traceRecord = Trackr_TraceRecord::model()-&amp;gt;findById($id);&#xA;&#xA;        if (!$traceRecord)&#xA;        {&#xA;            throw new Exception(Craft::t('Can\'t find trace with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        $traceRecord = new Trackr_TraceRecord();&#xA;    }&#xA;&#xA;    if ($trace-&amp;gt;validate())&#xA;    {&#xA;        $dt = DateTimeHelper::currentTimeForDb();&#xA;        $attributes = array(&#xA;            'entry_id' =&amp;gt; $trace-&amp;gt;entry_id,&#xA;            'sess_id' =&amp;gt; $trace-&amp;gt;sess_id,&#xA;            'dateCreated' =&amp;gt; $dt,&#xA;            'dateUpdated' =&amp;gt;$dt,&#xA;            'uid' =&amp;gt; StringHelper::UUID(),&#xA;            'id' =&amp;gt; 0&#xA;        );&#xA;&#xA;        foreach($attributes as $k =&amp;gt; $v)&#xA;        {&#xA;            $traceRecord-&amp;gt;setAttribute($k,$v);&#xA;        }&#xA;&#xA;        if ($traceRecord-&amp;gt;save())&#xA;        {&#xA;            // update id on model (for new records)&#xA;            $trace-&amp;gt;setAttribute('id', $traceRecord-&amp;gt;getAttribute('id'));&#xA;            return true;&#xA;        }&#xA;        else&#xA;        {&#xA;            $model-&amp;gt;addErrors($traceRecord-&amp;gt;getErrors());&#xA;            return false;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;* Unless you’re creating an instance of your class in some other way besides calling &lt;code&gt;craft()-&amp;gt;trackr_trace&lt;/code&gt;, but you shouldn’t be.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-18T12:15:21.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11049" PostTypeId="2" ParentId="11047" CreationDate="2015-08-18T12:55:07.677" Score="2" Body="&lt;p&gt;It's not possible to have different defaults per locale with the Table field type. Also keep in mind that the content from the first locale you edit is copied over to all other locales on the first save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how about using numbers for the months in the table and to show the full month names in your templates get them from &lt;code&gt;craft.i18n.getLocaleData&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in myTableField %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ craft.i18n.getLocaleData().getMonthName(row.col1) }}:&#xA;        {{ row.col2 }}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another way would be to use the &lt;code&gt;date&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ ('2015-' ~ row.col1 ~ '-1')|date('F') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-18T12:55:07.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11050" PostTypeId="1" CreationDate="2015-08-18T13:24:42.917" Score="4" ViewCount="368" Body="&lt;p&gt;I want to sort an array of entries in a specific order. Every entry has a 'shoptype' and I want to show all entries for type A, than type B, than type C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A partial solution would be to iterate over them &lt;code&gt;(if shoptype == A){ then show all A entries}&lt;/code&gt; but than I can't write a conditonal around it to hide the title when there are no shops of type A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I group them using the group twig filter and hide if the group has no items. But I can't sort them the way I like (it's not alphabetical, it's a fixed order that I want).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Idealy I would need something like this in supersort: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'SortAs', ['shoptype A', 'shoptype B', 'shoptype C']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So an array of strings that my shopType field can contain which my array is grouped by.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2021-01-13T17:48:41.353" Title="Sorting an array of entries according to a fixed list/array of items" Tags="&lt;sorting&gt;&lt;plugin-supersort&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11051" PostTypeId="2" ParentId="11050" CreationDate="2015-08-18T13:34:47.203" Score="3" Body="&lt;p&gt;&lt;strong&gt;Edit: This strategy still works, but see my &lt;a href=&quot;https://craftcms.stackexchange.com/a/36981/689&quot;&gt;updated answer&lt;/a&gt; for more up-to-date solution.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Prior to SuperSort 3.1.0, you might achieve this by using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/replace.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;replace&lt;/code&gt;&lt;/a&gt; filter inside SuperSort's micro-template:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = craft.entries.section('foo')... %}&#xA;&#xA;{% set sortedFoo = foo | supersort('sortAs', '{ shopType | replace({&#xA;    'ShopType1': &amp;quot;A&amp;quot;,&#xA;    'ShopType2': &amp;quot;B&amp;quot;,&#xA;    'ShopType3': &amp;quot;C&amp;quot;&#xA;}) }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The first parameter you pass to &lt;em&gt;SuperSort&lt;/em&gt; specifies the &lt;strong&gt;sort method&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The second parameter provides a &lt;strong&gt;value template&lt;/strong&gt; for the sorting function: Under the hood, the system parses &lt;code&gt;{ shopType | replace(...) }&lt;/code&gt; — a Craft &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#renderObjectTemplate-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;'micro-template'&lt;/a&gt; — into &lt;code&gt;{{ object.shopType | replace(...) }}&lt;/code&gt;. The plugin parses that template by passing in your array item as the &lt;code&gt;object&lt;/code&gt; and uses the output value to sort by.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;n.b. You need to specify that replacement list directly in the object template. Passing in a Twig variable doesn't work because the object template doesn't share the same context as the parent template.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strike&gt;The syntax in your original question would actually not be a bad addition for use-cases like this; I'll look into adding something like that to SuperSort when I get some downtime.&lt;/strike&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;As of SuperSort 3.1.0, you &lt;a href=&quot;https://craftcms.stackexchange.com/a/36981/689&quot;&gt;can now use a custom-order sort method&lt;/a&gt;, similar to what you originally suggested.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2021-01-13T17:48:41.353" LastActivityDate="2021-01-13T17:48:41.353" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11052" PostTypeId="1" AcceptedAnswerId="11053" CreationDate="2015-08-18T14:01:32.490" Score="5" ViewCount="64" Body="&lt;p&gt;Is it possible to hide the preview shown by default when Matrix blocks are collapsed?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can collapse Matrix blocks by clicking the “Collapse” menu option,&#xA;  or by double-clicking on a block’s title bar. When a block is&#xA;  collapsed, its title bar will show a preview of its content, so you&#xA;  can still identify which block it is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's useful to just be able to see the content outline made up by block types clear and simple. A lot of the time in my case the preview is irrelevant so it would be great to turn this off across the board by default.&lt;/p&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="344" LastEditDate="2015-08-18T14:24:17.663" LastActivityDate="2015-08-18T14:25:11.693" Title="Matrix: Hide preview" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11053" PostTypeId="2" ParentId="11052" CreationDate="2015-08-18T14:25:11.693" Score="3" Body="&lt;p&gt;There is no out-of-the-box way to do this, but you can make use of a plugin like &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Lindsey Diloreto's CPCSS&lt;/a&gt; to set &lt;code&gt;display: none&lt;/code&gt; on the &lt;code&gt;body.ltr .matrixblock &amp;gt; .titlebar &amp;gt; .preview&lt;/code&gt; class. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-08-18T14:25:11.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11054" PostTypeId="1" AcceptedAnswerId="11056" CreationDate="2015-08-18T14:31:57.570" Score="2" ViewCount="1333" Body="&lt;p&gt;Our Craft installation is now working on the Production Cloud-Server, except that if I'm logged in the CP, after maybe 30 sec the login-modal pops up and says that the session has expired.&#xA;If I just reload the CP, I'm in again without the need to login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That behaviour didn't show up on the development server.&#xA;I didn't make any Configuration Settings like userSessionDuration or something like that, that's all default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorDisplayName="user1080" LastEditDate="2017-05-29T05:43:13.290" LastActivityDate="2017-05-29T05:43:13.290" Title="CP Session expires after short time" Tags="&lt;control-panel&gt;&lt;login&gt;&lt;session&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11056" PostTypeId="2" ParentId="11054" CreationDate="2015-08-18T17:33:26.770" Score="1" Body="&lt;p&gt;99% of the time when you see this behavior, it's because wherever your server is configured to save PHP's session files to either doesn't exist or isn't writable by PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check where that path is by going to &lt;code&gt;yourdomain.com/admin/utils/phpinfo&lt;/code&gt; and searching for &lt;code&gt;session.save_path&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow&quot;&gt;overridePhpSessionLocation&lt;/a&gt; config setting set to &lt;code&gt;true&lt;/code&gt;, then Craft will set that path to &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-08-18T18:03:16.380" LastActivityDate="2015-08-18T18:03:16.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11057" PostTypeId="2" ParentId="11030" CreationDate="2015-08-18T17:57:29.307" Score="2" Body="&lt;p&gt;I would try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.bannerMatrix %}&#xA;  &amp;lt;div&amp;gt;&#xA;    {% set blockImage = block.image.first %}&#xA;    {% if blockImage %}&#xA;      &amp;lt;img src=&quot;{{ blockImage.getUrl() }}&quot; alt=&quot;{{ blockImage.filename }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;div class=&quot;hero_msg&quot;&amp;gt;&#xA;      &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;h4&amp;gt;{{ block.subheading }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You loop over all the blocks :&lt;code&gt;{% for block in entry.bannerMatrix %}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;block.image&lt;/code&gt; will be an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which is &lt;strong&gt;not&lt;/strong&gt; an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/assetfilemodel&quot; rel=&quot;nofollow&quot;&gt;asset&lt;/a&gt;, but a way to get an asset.&lt;/li&gt;&#xA;&lt;li&gt;Set &lt;code&gt;blockImage&lt;/code&gt; to the first (and only) asset if it exists, and otherwise &lt;code&gt;null&lt;/code&gt;: &lt;code&gt;{% set blockImage = block.image.first %}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Only try to use the image if it exists: &lt;code&gt;{% if blockImage %}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Assets don't have a &lt;code&gt;title&lt;/code&gt;, so &lt;code&gt;{{ blockImage.title }}&lt;/code&gt; won't work. You can use &lt;code&gt;{{ blockImage.filename }}&lt;/code&gt;, or you could assign another field in the asset's Field Layout, and then use that: &lt;code&gt;{{ blockImage.altText }}&lt;/code&gt; for example.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-18T17:57:29.307" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11058" PostTypeId="1" AcceptedAnswerId="11060" CreationDate="2015-08-18T18:13:29.743" Score="3" ViewCount="706" Body="&lt;p&gt;I have created an Entry Type with the &quot;Show the Title field&quot; option not checked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating an entry of this type, I am given a generic &quot;Couldn't save entry&quot; error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking in craft.log, I see the Title field is failing validation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/08/18 18:07:29 [trace] [system.CModule] Loading &quot;templates&quot; application component&#xA;in /Users/Sites/craft-test/web/craft/app/etc/web/WebApp.php (584)&#xA;in /Users/Sites/craft-test/web/craft/app/services/EntriesService.php (157)&#xA;in /Users/Sites/craft-test/web/craft/app/controllers/EntriesController.php (450)&#xA;2015/08/18 18:07:29 [trace] [system.db.CDbConnection] Starting transaction&#xA;in /Users/Sites/craft-test/web/craft/app/services/EntriesService.php (160)&#xA;in /Users/Sites/craft-test/web/craft/app/controllers/EntriesController.php (450)&#xA;in /Users/Sites/craft-test/web/craft/app/etc/web/WebApp.php (784)&#xA;2015/08/18 18:07:29 [trace] [system.CModule] Loading &quot;elements&quot; application component&#xA;in /Users/Sites/craft-test/web/craft/app/etc/web/WebApp.php (584)&#xA;in /Users/Sites/craft-test/web/craft/app/services/EntriesService.php (176)&#xA;in /Users/Sites/craft-test/web/craft/app/controllers/EntriesController.php (450)&#xA;2015/08/18 18:07:29 [warning] [application] Craft\ContentModel-&amp;gt;title failed validation: Title cannot be blank.&#xA;in /Users/Sites/craft-test/web/craft/app/models/BaseModel.php (510)&#xA;in /Users/Sites/craft-test/web/craft/app/models/ContentModel.php (89)&#xA;in /Users/Sites/craft-test/web/craft/app/services/ContentService.php (218)&#xA;2015/08/18 18:07:29 [trace] [system.db.CDbTransaction] Rolling back transaction&#xA;in /Users/Sites/craft-test/web/craft/app/services/EntriesService.php (183)&#xA;in /Users/Sites/craft-test/web/craft/app/controllers/EntriesController.php (450)&#xA;in /Users/Sites/craft-test/web/craft/app/etc/web/WebApp.php (784)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is on Craft Pro 2.4.2684 on Apache/2.4.10 (Unix) PHP/5.5.24.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried clearing caches to no avail, and confirmed that the same issue exists with newly created Entry types with the Title field hidden.&lt;/p&gt;&#xA;" OwnerUserId="857" LastActivityDate="2015-08-18T19:52:26.013" Title="Cannot create entry when Entry Type has Title field hidden" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11059" PostTypeId="1" CreationDate="2015-08-18T19:39:16.600" Score="1" ViewCount="718" Body="&lt;p&gt;I have a login area on a site which basically just shows a users profile fields. I'm using the {{ logoutUrl }} tag for my logout link and when the user goes to the logoutUrl they're redirected to the homepage however if they visit the profile page URL again, they can still see the content (as if they're logged in) until they do a hard refresh (CMD + SHIFT + R). This seems to be the case in three different browsers. I have tried both of the following to determine if the user is logged in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.isLoggedIn %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both seem to be effective at showing the content once they login but it's as if the session is being cached or something as these tests are still true after logging out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this happens when I either click a link to the profile URL or manually type it in the address bar. I am not clicking back in the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I have also set a custom path with &quot;logoutPath&quot; in the config but this doesn't seem to be affecting the issue I'm having.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-09-17T21:34:43.680" Title="User not being logged out when visiting {{ logoutUrl }} link" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;login&gt;&lt;session&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="11060" PostTypeId="2" ParentId="11058" CreationDate="2015-08-18T19:52:26.013" Score="2" Body="&lt;p&gt;I was using the Twig template syntax (&lt;code&gt;{{varName}}&lt;/code&gt;) in the Title Format field on the Entry Type instead of the proper syntax (&lt;code&gt;{varName}&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="857" LastActivityDate="2015-08-18T19:52:26.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11061" PostTypeId="1" CreationDate="2015-08-18T21:38:12.720" Score="3" ViewCount="158" Body="&lt;p&gt;I have a &quot;Categories&quot; field in my section. I want to perform some JavaScript actions when a category is selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any built-in event which will be triggered at that point?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-01-29T00:16:59.163" Title="Garnish - Event when selecting a category" Tags="&lt;categories&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11062" PostTypeId="1" CreationDate="2015-08-18T21:46:18.160" Score="2" ViewCount="188" Body="&lt;p&gt;I've noticed that Live Preview mode includes fields from &lt;strong&gt;all&lt;/strong&gt; tabs. Is it possible to specify tabs to be left out of the Live Preview display? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have an 'SEO' tab which consists of meta data it's not relevant to include this in the Live Preview mode whilst constructing the page. With lots of tabs this just becomes confusing for the user when only a few of them are relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to exclude set tabs or fields?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2017-03-17T18:09:32.567" Title="Live Preview: Hide tabs from live preview" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11063" PostTypeId="2" ParentId="10985" CreationDate="2015-08-18T23:27:15.683" Score="2" Body="&lt;p&gt;I had the same issue. My problem stemmed from the fact that I had put all of the form fields that I created into the field layout for my form page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NqO9Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NqO9Z.png&quot; alt=&quot;Design Field Layout with Form Fields needing removal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was used to putting all the fields directly on to the page. Once I removed all the form fields from my field layout, I was able to successfully access the page to manage my content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems as though your fields for forms should be treated separately and not put directly into the page. They should be added through the formbuilder plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BFFGH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BFFGH.png&quot; alt=&quot;Adding form fields using formbuilder correctly&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3978" LastActivityDate="2015-08-18T23:27:15.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11064" PostTypeId="2" ParentId="11062" CreationDate="2015-08-19T00:50:34.013" Score="2" Body="&lt;p&gt;There is currently no out-of-the-box way to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You &lt;em&gt;might&lt;/em&gt; be able to pull it off with something like the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP-CSS&lt;/a&gt; plugin, but I'm not sure how you'd just target the tab when the Live Preview pane is open.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you can always make a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-03-17T18:09:32.567" LastActivityDate="2017-03-17T18:09:32.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11065" PostTypeId="1" CreationDate="2015-08-19T02:07:44.353" Score="5" ViewCount="2076" Body="&lt;p&gt;I'm trying to update my plugin to Craft 3 and I'm getting this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to locate message source for category ''.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What does it mean?!&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-19T02:21:21.877" Title="Unable to locate message source for category ''" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11066" PostTypeId="2" ParentId="11065" CreationDate="2015-08-19T02:07:44.353" Score="5" Body="&lt;p&gt;In Craft 2, the Craft default Yii translation method was overridden to only require one value, the value of the translatable string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::t('My Translatable String');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, Craft reverts to using the &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail&quot; rel=&quot;noreferrer&quot;&gt;default Yii behavior&lt;/a&gt; for the Translate method &lt;code&gt;t()&lt;/code&gt; and there are two arguments needed.  The first argument is now the &lt;code&gt;category&lt;/code&gt; and the second is the translatable string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::t('pluginhandle', 'My Translatable String');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding the category back allows translations from different contexts to avoid conflicts with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft uses the &lt;code&gt;app&lt;/code&gt; category.  Yii uses the &lt;code&gt;yii&lt;/code&gt; category.  And plugins should use their own plugin handles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front-end of a site should use &lt;code&gt;site&lt;/code&gt; category, and the actual translation files should be saved in &lt;code&gt;translations/locale/category.php&lt;/code&gt; (whether that's in &lt;code&gt;craft/&lt;/code&gt; or &lt;code&gt;craft/plugins/mypluginname/&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Hat tip to Brandon Kelly for helping me understand this better on Craft Slack)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-08-19T02:21:21.877" LastActivityDate="2015-08-19T02:21:21.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11067" PostTypeId="2" ParentId="9887" CreationDate="2015-08-19T07:13:33.817" Score="2" Body="&lt;p&gt;From your code example, it looks like you have several potential issues.  I'll outline them here and might need to revise this answer after you provide an update on how these things pan out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's unclear if you are trying to do this on an individual blog post page that has the &lt;code&gt;entry&lt;/code&gt; variable already available to the template or if you are trying to do something more complex. If this is individual blog page as you mention in your comments the &lt;code&gt;entry&lt;/code&gt; variable should already be available for you and you may need to remove the for loop (&lt;code&gt;{% for entry in craft.entries %}&lt;/code&gt;) you have wrapped around your Matrix field code which is trying to loop through all your blog entries. On an individual entry page in a Section with URLs enabled, you can access your matrix field directly using &lt;code&gt;entry.matrixHandle&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# You can probably remove this wrapping for loop #}&#xA;{% for entry in craft.entries %}&#xA;&#xA;  {# You can start looping through your matrix here #}&#xA;  {% for block in entry.matrix %}&#xA;&#xA;    {# This is good, you want to make sure you are within the&#xA;       block you are trying to access #}&#xA;    {% if block.type == &quot;body&quot; %}&#xA;&#xA;      {# I've moved your SEARCH code below so we can focus on it a bit more easily. We'll put it back here afterwards. #}&#xA;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;{# You can probably remove this wrapping endfor loop #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like you also may have the wrong syntax or approach for your search query (&lt;code&gt;.search('block.body:pizza')&lt;/code&gt;).  You're right that you can dynamically pass content to the search parameter within your matrix loop but:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You are trying to pass data from a Rich Text field which will not have a single word, but a whole bunch of words and not make for a very specific search.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your syntax is incorrect.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Try simplifying your search to something hard coded that you know exists to get this to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('recipes').search('pizza')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that works, they you need to sort out how to pass a more specific dynamic variable.  I don't think this is going to work from your &lt;code&gt;body&lt;/code&gt; field, but it could work from a more targeted field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('recipes').search(block.keywordField)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this second example, I'm passing the variable directly, not wrapping it in quotation marks.  And I'm targeting a field called 'keywordField' that just has the word I want to search for not a big paragraph of text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you may not be trying to search for a keyword available in your Matrix, and you may just be trying to find related content in your Recipes section to your blog post using a Entries Relations Field.  If this is the case, you may not need the search parameter at all, but relatedTo instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('recipes').relatedTo(entry)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the end, you're loop may look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrix %}&#xA;&#xA;  {% if block.type == &quot;keywordField&quot; %}&#xA;&#xA;    {# Using a more targeted keyword field for the search #}&#xA;    {% for recipe in craft.entries.section('recipes').search(block.keywordField).order('score') %} &#xA;        {{ recipe.title }}&#xA;    {% endfor %}&#xA;&#xA;  {% endif %}&#xA;&#xA;  {% if block.type == &quot;body&quot; %}&#xA;&#xA;    {# Pulling in entries from an Entries Relations field #}&#xA;    {% for recipe in craft.entries.section('recipes').relatedTo(entry) %}&#xA;        {{ recipe.title }}&#xA;    {% endfor %}&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-19T07:13:33.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11068" PostTypeId="1" CreationDate="2015-08-19T11:02:57.497" Score="1" ViewCount="1438" Body="&lt;p&gt;Ok this is similar to a previously asked question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2926/how-to-display-all-fields-belonging-to-current-entry&quot;&gt;How to display all fields belonging to current entry?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'd like to extend this so that it deals with matrix entry types. I have the following but I just need to know how to loop through all the blocks and pull out each blocks entry field handle and content. Any help appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# loop through the fields in the entries fieldLayout Model #}&#xA;{% for fieldLayoutField in entry.getFieldLayout().getFields() %}&#xA;&#xA;    {# get the field Model from the fieldId #}&#xA;    {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}&#xA;&#xA;    {% if field.type == 'Matrix' %}&#xA;        {% set matrixHandle = field.handle %}&#xA;        {% for field in matrixHandle %}&#xA;            ...loop through matrix blocks fields and pull out field handles and content...&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        {# print the field handle and the field content  #}&#xA;        {{ field.handle }} : {{ entry.getContent()[field.handle] }}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-03-23T20:06:14.930" Title="How to loop through matrix block fields and pull out handle and content?" Tags="&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11069" PostTypeId="2" ParentId="11033" CreationDate="2015-08-19T12:25:29.737" Score="1" Body="&lt;p&gt;It was indeed missing files, as suggested by Alec and Benjamin. All down to some non-specific .gitignore rules that meant it was ignoring all &quot;src&quot; folders - which is one of the folders created by the composer install&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help guys!&lt;/p&gt;&#xA;" OwnerUserId="3864" LastActivityDate="2015-08-19T12:25:29.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11070" PostTypeId="1" CreationDate="2015-08-19T14:13:31.103" Score="5" ViewCount="327" Body="&lt;p&gt;I deleted a locale and checked to transfer all its contents to a different locale, but now the other locale still shows no entries.  I'm sure all the entries are still in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="3980" LastEditorUserId="57" LastEditDate="2017-06-05T17:34:18.457" LastActivityDate="2017-06-05T17:34:18.457" Title="Deleted Locale, Entries all gone now" Tags="&lt;entries&gt;&lt;localization&gt;&lt;database&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11071" PostTypeId="1" CreationDate="2015-08-19T14:26:16.430" Score="0" ViewCount="100" Body="&lt;p&gt;I have an older site that has been chugging along nicely so I haven't updated it in a while. I had an issue with an older version of SmartMap that was suddenly causing a 503 on the site so I fixed that and while I was updating things I thought I'd go ahead an update Craft to the latest version. When I do the automatic update I get the following error message and the update fails:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before I do a manual update I wanted to see if there was something I could do to resolve this and still have the automatic update work.&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="57" LastEditDate="2015-08-19T17:07:16.050" LastActivityDate="2015-08-19T17:07:16.050" Title="Upgrading site from 2.3.2636 to 2.4.2684" Tags="&lt;error-message&gt;&lt;updating&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11072" PostTypeId="2" ParentId="11068" CreationDate="2015-08-19T15:16:00.403" Score="5" Body="&lt;p&gt;I find accessing content like this pretty unintuitive, but I think you will need to use the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot;&gt;&lt;code&gt;attribute&lt;/code&gt; method&lt;/a&gt;.  Hopefully the below can help keep you moving in the right direction.  I've simplified to just accessing the Matrix Field and I've made an assumption that you know the Matrix field handles you will want to access.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldLayoutField in entry.getFieldLayout().getFields() %}&#xA;  {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}&#xA;&#xA;  {% if field.type == 'Matrix' %}&#xA;&#xA;    {# Dynamically access the Matrix Field on the Entry Model #}&#xA;    {% set matrixField = attribute(entry, field.handle) %}&#xA;    {% for block in matrixField %}&#xA;&#xA;      {# Output your Matrix Field Handle #}&#xA;      {{ field.handle }}&#xA;&#xA;      {# Output your specific fields content #}&#xA;      {{ block.fieldHandle }}&#xA;&#xA;    {% endfor %}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may also want to take a look at how Craft handles outputting Forms in the CP in the &lt;code&gt;app/templates/_includes&lt;/code&gt; folder, starting with &lt;code&gt;forms.html&lt;/code&gt; and reviewing the many related files.   Doing a task like this cleanly really requires a pretty deep level of abstraction if you don't want to make any assumptions about your variable names.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-19T15:16:00.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11073" PostTypeId="2" ParentId="11071" CreationDate="2015-08-19T15:23:48.943" Score="1" Body="&lt;p&gt;Probably a timeout on the MySQL side. You could try making a database backup manually and then changing this config value to false before trying the update again: &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#backupDbOnUpdate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way Craft will skip the database backup during the update, saving some time and hopefully preventing a timeout. Just remember to make a backup every time you update from then on though.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-08-19T15:23:48.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11074" PostTypeId="1" CreationDate="2015-08-19T16:15:30.773" Score="4" ViewCount="725" Body="&lt;p&gt;I want let the editor to choose an optional color via the color picker, but this didn't have the option 'no color' (or transparent).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution to this? I use it a lot and have always to add a boolean switch so the editor can switch it on and off, but that's not the best way to do this.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2015-08-19T17:08:05.487" LastActivityDate="2015-08-20T11:25:33.893" Title="Color Picker with &quot;no color&quot; option?" Tags="&lt;matrix&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11075" PostTypeId="2" ParentId="11074" CreationDate="2015-08-19T16:48:31.900" Score="2" Body="&lt;p&gt;At the moment there is no better solution for this. You could write a plugin that defines a new fieldtype.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-19T16:48:31.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11076" PostTypeId="2" ParentId="9367" CreationDate="2015-08-19T18:06:14.300" Score="6" Body="&lt;p&gt;If you only need to create a JSON API for fetching existing entries, etc., check out the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot;&gt;Element API&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-19T18:06:14.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11077" PostTypeId="2" ParentId="20" CreationDate="2015-08-19T18:15:58.280" Score="26" Body="&lt;p&gt;Twig is great for outputting HTML/XML markup, but it’s not exactly the best option when you just want to output some data as JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;noreferrer&quot;&gt;Element API&lt;/a&gt; plugin aims to make outputting entries (and other element types) as JSON as easy as possible, and it’s completely customizable from its PHP-based API configuration file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To achieve your desired JSON output, you would set your craft/config/elementapi.php file to this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;&#xA;        'entries.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'body' =&amp;gt; (string) $entry-&amp;gt;body&#xA;                ];&#xA;            }&#xA;        ],&#xA;&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="5186" LastEditDate="2018-02-12T21:32:33.113" LastActivityDate="2018-02-12T21:32:33.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11078" PostTypeId="1" CreationDate="2015-08-19T19:24:06.873" Score="2" ViewCount="237" Body="&lt;p&gt;I have several Listing channels that all use the same templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Templates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/templates/view/overview.html&lt;/li&gt;&#xA;&lt;li&gt;/templates/view/detail.html&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Channels&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;li&gt;Research Updates&lt;/li&gt;&#xA;&lt;li&gt;Upcoming Events&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I only list the entries for each channel at their respective URL without having to duplicate the templates? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;http://mysite.com/news&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/news&lt;/a&gt;&quot; should only list the the latest 20 news stories with links to the detail page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news', 'research', 'events').limit(20).find() %}&#xA;&amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;    &amp;lt;h2 class=&quot;Heading&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;p class=&quot;Date&quot;&amp;gt;{{entry.postDate|date('M j, Y')}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ excerpt|length &amp;gt; 250 ? excerpt|slice(0, 200) ~ '...' : excerpt  }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;{{ entry.title }}&quot; class=&quot;ReadMore&quot;&amp;gt;Read More&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;                          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endfor %}&lt;/p&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2015-08-19T21:05:54.827" Title="Need help: Multiple Listing channels with one template. DRY" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11079" PostTypeId="2" ParentId="11078" CreationDate="2015-08-19T20:25:46.860" Score="3" Body="&lt;p&gt;A good option here is to make use of &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request&quot; rel=&quot;nofollow&quot;&gt;craft.request&lt;/a&gt;. As long as the URL is the section handle, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% current_section = craft.request.firstSegment %}&#xA;&#xA;{% for entry in craft.entries.section(current_section).limit(20).find() %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the url is mysite.com/news, &lt;code&gt;firstSegment&lt;/code&gt; will return 'news', which you can use in your &lt;code&gt;craft.entries&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your URLs need to be different than the section handles, make use of Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html#include&quot; rel=&quot;nofollow&quot;&gt;include with&lt;/a&gt; tag. For each section, you will need an index.html template with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set current_section = 'thisSectionHanle' %}&#xA;{% include listPage.html with current_section %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;listPage.html can be the template that has the actual fetch and display logic. Using &lt;code&gt;include with&lt;/code&gt;, listPage.html will have access to the &lt;code&gt;current_section&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So not &lt;em&gt;perfectly&lt;/em&gt; dry, but the main logic chunk will not have to be repeated. &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-08-19T21:05:54.827" LastActivityDate="2015-08-19T21:05:54.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11080" PostTypeId="1" AcceptedAnswerId="11081" CreationDate="2015-08-20T01:48:36.717" Score="2" ViewCount="889" Body="&lt;p&gt;In each matrix block, I'm allowing users to set a background image, background color etc with a settings field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In each matrix block template, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;  {% set backgroundColor = '' %}&#xA;  {% set backgroundImage = '' %}&#xA;&#xA;  {% for row in block.settings %}&#xA;    {% set backgroundColor %}background-color: {{ row.backgroundColor }};{% endset %}&#xA;    {% set backgroundImage %}background-image: url({{ row.backgroundImage.first().url }});{% endset %}&#xA;    ... more fields go here...&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;div style=&quot;{{ backgroundColor }} {{ backgroundImage }}&quot;&amp;gt;&#xA;    ... content here ...&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;{% block content %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than repeating &lt;code&gt;{% for row in block.settings %}&lt;/code&gt; in each template, is there a way that I could write it once and reuse it using a single include call? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_widgets/_settings&quot; with { &#xA;  backgroundColor: backgroundColor,&#xA;  backgroundImage: backgroundImage&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't really reduce the amount of code duplication. Ideally I like to use a single of code to make these variables available.&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="3560" LastEditDate="2015-08-20T06:43:30.227" LastActivityDate="2015-08-20T14:24:26.383" Title="Including and reusing common code per matrix block" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11081" PostTypeId="2" ParentId="11080" CreationDate="2015-08-20T02:15:38.750" Score="3" Body="&lt;p&gt;Take 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you may be looking to use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig Macro&lt;/a&gt;. Here's the gist of that approach, but I don't fully understand the layout of your template yet, so my answer may be a bit out of context until I do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to create your macro higher in your template or in a separate file and import it into the template you are working in. (See the docs linked above on how to import a macro for your situation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then simplify your block output to something like this.  I'm using fairly verbose names for this example but you can shorten the variable names to have less code if you prefer.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_widgets/_settings.html&quot; as settingsMacro %}&#xA;{% set settings = block.settings %}&#xA;&#xA;&amp;lt;div style=&quot;{{ settingsMacro.backgroundColor(settings) }} {{ settingsMacro.backgroundImage(settings) }}&quot;&amp;gt;&#xA;  ... content here ...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your macro file, you'll take those settings and process them as you need to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_widgets/_settings.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro backgroundColor(settings) %}&#xA;  {% set backgroundColor = '' %}&#xA;&#xA;  {% for row in settings %}&#xA;    background-color: {{ row.backgroundColor }};&#xA;  {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{% macro backgroundImage(settings) %}&#xA;  {% set backgroundImage = '' %}&#xA;&#xA;  {% for row in settings %}&#xA;    background-image: url({{ row.backgroundImage.first().url }});&#xA;  {% endfor %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think, due to how many matrix blocks are fairly short templates, the amount of code you may need to avoid reuse still may be a couple lines after you import a macro and call the specific macros.  But like the include, this could be another way to help ensure consistency in the code being used in multiple places. Hopefully this gives you a few more ideas to work with to find a satisfying solution. I'd need to have a better understanding of your full template picture to offer a more specific solution on how to implement.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Take 1: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, I believe one way you can do what you are trying to do is by using the &lt;code&gt;include with&lt;/code&gt; syntax and making sure you are passing your variables to the include template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_widgets/_settings&quot; with { &#xA;  backgroundColor: backgroundColor,&#xA;  backgroundImage: backgroundImage&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This assumes that you are defining &lt;code&gt;backgroundColor&lt;/code&gt; and &lt;code&gt;backgroundImage&lt;/code&gt; before your include, and that the include has the following code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div style=&quot;{{ backgroundColor }} {{ backgroundImage }}&quot;&amp;gt;&#xA; ... content here ...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also note, adding the underscore to your folder path hides all files within it.  So, if you don't want to have to add underscores in front of every file, you still have hidden files if they are within a hidden folder, i.e: &lt;code&gt;_widgets/settings&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-08-20T14:24:26.383" LastActivityDate="2015-08-20T14:24:26.383" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11082" PostTypeId="1" CreationDate="2015-08-20T06:47:17.797" Score="5" ViewCount="230" Body="&lt;p&gt;I need to show a list of users (around 400). No problem, the list loads in 1.5s, for which I could use &lt;code&gt;{% cache %}&lt;/code&gt; to speed it up.&#xA;Now, the problem arises whenever I want to display the title of an entry related to the user. The log shows 400 extra queries, so a query per user, if I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for user in user %}&#xA;    {{ user.relationFieldName.first() }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems a bit faster, but not fast:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for user in user %}&#xA;    {{ user.relationFieldName.find()[0] }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get this information directly when querying for users? Or is there another way to speed this up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would eager loading these relations through a plugin help? And if so, what service/model/record would I have to extend to go about this?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-08-20T07:36:41.610" LastActivityDate="2015-08-20T17:18:52.710" Title="How could I make related entries load faster?" Tags="&lt;templating&gt;&lt;database&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11083" PostTypeId="2" ParentId="11030" CreationDate="2015-08-20T08:11:56.863" Score="3" Body="&lt;p&gt;From your last update it looks like you simply need to get the entry that contains that matrix block, the error &lt;code&gt;Variable &quot;entry&quot; doesn't exist&lt;/code&gt; simply means nothing is assigned to &lt;code&gt;entry&lt;/code&gt; in your templates. There are a couple of ways you can solve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1&lt;/strong&gt; - Tell Craft which template to load for this entry  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go into your section settings, there will be a field called &lt;code&gt;Entry template&lt;/code&gt; which if, for example, you put &lt;code&gt;about&lt;/code&gt; in this craft would look for either &lt;code&gt;about.html&lt;/code&gt; or &lt;code&gt;about/index.html&lt;/code&gt; in your &lt;code&gt;craft/templates&lt;/code&gt; folder and would automatically assign a variable &lt;code&gt;entry&lt;/code&gt; to your template when you visit the &lt;code&gt;/about&lt;/code&gt; url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an option &lt;code&gt;This is for the homepage&lt;/code&gt; in the settings which, if checked, will assign the entry to &lt;code&gt;index.html&lt;/code&gt; in your templates (but i don't think this will show if there is already a section checked elsewhere)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see more about this in the craft docs: &lt;a href=&quot;http://buildwithcraft.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating-overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2&lt;/strong&gt; - Fetch the entry in your template using twig tags&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are numerous ways to do this, but given you are using a single you should just be able to use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('homePageBanner').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might need to adjust the &lt;code&gt;homePageBanner&lt;/code&gt; part if that isn't the handle of your section, but this will then give you an &lt;code&gt;entry&lt;/code&gt; variable to work with in your template and hopefully you'll find you will get the matrix content back :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need some more details on how &lt;code&gt;craft.entries&lt;/code&gt; works then the docs are a great place to find out more: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/craft.entries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-20T08:11:56.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11084" PostTypeId="2" ParentId="11074" CreationDate="2015-08-20T11:04:11.453" Score="0" Body="&lt;p&gt;I just put together a fieldtype using the jQuery colour picker &lt;a href=&quot;https://bgrins.github.io/spectrum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spectrum&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cJCzU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cJCzU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It supports selecting no color and outputs a HEX of the colour, if chosen :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/alecritson/craft-spectrum-fieldtype&quot; rel=&quot;nofollow noreferrer&quot;&gt;Get the fieldtype on Github&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-08-20T11:25:33.893" LastActivityDate="2015-08-20T11:25:33.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11085" PostTypeId="1" AcceptedAnswerId="11102" CreationDate="2015-08-20T11:35:07.433" Score="1" ViewCount="304" Body="&lt;p&gt;I can do the following to pull out the page title after parsing in just the page slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$page = 'about';&#xA;$entry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;first();&#xA;$entry-&amp;gt;slug = $page;&#xA;echo $entry-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I understand this is overkill, but an answer to this question will help me answer further questions I dare not try to explain here). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, the slug doesn't need to be unique if other sections/channels/singles use the same name, and the method above only calls out the first instance of &quot;about&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I define what section is being referred to?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will update the handle, but has no effect on the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;section-&amp;gt;handle = &quot;pages&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a Read Only error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;section = &quot;Pages&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\EntryModel.section&quot; is read only.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2015-08-20T11:50:49.123" LastActivityDate="2015-08-20T18:47:08.047" Title="Refer to specific section handle when querying an element by 'getCriteria'" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11086" PostTypeId="1" CreationDate="2015-08-20T11:51:12.353" Score="2" ViewCount="429" Body="&lt;p&gt;I have an asset folder images and I have created a subfolder in the images folder so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;images&#xA;   |&#xA;subfolder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my entry fields I am not seeing the subfolder in the asset selection pop-up. Any ideas why this would be?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-20T12:23:02.527" Title="Asset subfolder is not showing in the entry field as a folder option" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11087" PostTypeId="2" ParentId="4812" CreationDate="2015-08-20T11:56:39.057" Score="3" Body="&lt;p&gt;Looking at the Happy Lager demo site there's a Short Description field, which functions as an excerpt for indexes and search results. I imagine P&amp;amp;T use something similar for the Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also force your results onto one line and trim it with css, which is how P&amp;amp;T do it on the Craft docs search results page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3983" LastActivityDate="2015-08-20T11:56:39.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11088" PostTypeId="2" ParentId="11086" CreationDate="2015-08-20T11:58:19.737" Score="0" Body="&lt;p&gt;If you didnt create the folder in the assets pop-up i.e you just created a new folder manually, then you will need to update your asset indexes in the settings page for it to appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create subfolders within the pop-up, just right click a directory name and a  &lt;code&gt;new subfolder&lt;/code&gt; button will appear. The new folder will then display automatically without having to manually re-index&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-08-20T11:58:19.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11089" PostTypeId="2" ParentId="11086" CreationDate="2015-08-20T12:23:02.527" Score="3" Body="&lt;p&gt;Worked this out. In the entry field I was limiting uploading an image to one folder. Once this was unchecked and only images selected in the folder list the subfolder appeared.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-20T12:23:02.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11090" PostTypeId="1" AcceptedAnswerId="11092" CreationDate="2015-08-20T15:06:08.727" Score="1" ViewCount="541" Body="&lt;p&gt;My client has been adding some new entries in a channel called Products. These are using different templates that are selected when creating the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries on a few different template types are no longer appearing in the last few days. I have checked that the templates have all the correct field handles and there doesn't seem to be anything missing. I have also tried clearing the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea why new entries may not be appearing?&lt;/p&gt;&#xA;" OwnerUserId="3836" LastEditorUserId="3836" LastEditDate="2015-08-21T11:22:20.953" LastActivityDate="2015-08-21T11:22:20.953" Title="New entries not appearing on template page" Tags="&lt;templating&gt;&lt;entries&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11091" PostTypeId="1" CreationDate="2015-08-20T15:08:18.173" Score="1" ViewCount="344" Body="&lt;p&gt;This complex query makes the server cpu run at 100%.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;      section: sectionParam,&#xA;      search: searchParam,&#xA;      relatedTo: relatedToParams,&#xA;      condition: conditionParam,&#xA;      price: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ pricesParam|split(';')[0],&#xA;          '&amp;lt;= ' ~ pricesParam|split(';')[1]&#xA;      ],&#xA;      priceOffer: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ pricesParam|split(';')[0],&#xA;          '&amp;lt;= ' ~ pricesParam|split(';')[1]&#xA;      ],&#xA;      specsMtplm: weightParam,&#xA;      specInternalLengthFeet: lengthParam,&#xA;      priceOffer: '',&#xA;      specsBerthSleeps: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ berthsParam|split(';')[0],&#xA;          '&amp;lt;= ' ~ berthsParam|split(';')[1]&#xA;      ],&#xA;      spectransmission: transParam,&#xA;      seatbelts: seatbeltsParam&#xA;&#xA;}).order('dateCreated desc').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I optimise this twig so it doesn't kill the server each time it runs?&lt;/p&gt;&#xA;" OwnerUserId="3338" LastActivityDate="2015-08-20T17:48:09.947" Title="How do I optimise this colossal query?" Tags="&lt;entries&gt;&lt;database&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11092" PostTypeId="2" ParentId="11090" CreationDate="2015-08-20T15:15:20.213" Score="5" Body="&lt;p&gt;Are there more than 100 entries in the products channel? If so, you'll need to specify the limit. All Craft requests are limited to 100 by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.products.limit(null) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, please post your template code :)&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-08-20T15:15:20.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11093" PostTypeId="1" AcceptedAnswerId="11099" CreationDate="2015-08-20T15:19:58.560" Score="1" ViewCount="15135" Body="&lt;p&gt;I got a Twig &lt;code&gt;switch&lt;/code&gt; in a template like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch bodyClass %}&#xA;&#xA;    {% case 'A' %}&#xA;        ...&#xA;&#xA;    {% case 'B' %}&#xA;        ...&#xA;&#xA;    {% default %}&#xA;        ...&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to add another possible value for the first &lt;code&gt;case&lt;/code&gt;.&lt;br&gt;&#xA;So I would have &lt;code&gt;case 'A' or 'C'&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible in Twig syntax?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=================================&lt;br&gt;&#xA;&lt;strong&gt;EDIT CRAFT BUG ?&lt;/strong&gt;&lt;br&gt;&#xA;OK lets try to rephrase, sorry for my english not easy to explain for me sometimes :)&lt;br&gt;&#xA;So when the &lt;code&gt;or&lt;/code&gt; syntax is added, then the 2nd and 3rd cases &lt;code&gt;B&lt;/code&gt; or &lt;code&gt;default&lt;/code&gt; (after &lt;code&gt;'A1' or 'A2'&lt;/code&gt; case) are never reached anymore.&lt;br&gt;&#xA;The switch always say &lt;code&gt;TRUE&lt;/code&gt; to 1st case (even if it is wrong...).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch bodyClass %}&#xA;&#xA;    {% case 'A1' or 'A2' %}&#xA;        ...&#xA;&#xA;    {% case 'B' %}&#xA;        ...&#xA;&#xA;    {% default %}&#xA;        ...&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-08-21T20:04:49.967" LastActivityDate="2015-08-28T19:13:49.063" Title="Switch Twig condition Case with OR condition (two values in the case)" Tags="&lt;templating&gt;&lt;switch&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ClosedDate="2015-08-28T19:10:49.880" ContentLicense="CC BY-SA 3.0" />
  <row Id="11094" PostTypeId="1" AcceptedAnswerId="11097" CreationDate="2015-08-20T15:31:18.363" Score="3" ViewCount="941" Body="&lt;p&gt;I'm developing a plugin, bumping the version number to run the migrations I'm creating but then, for sanity, checked they run when the plugin is installed for the first time, which doesn't seem to be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone clarify how to get the migrations to run on install? &lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2017-11-29T10:20:07.240" Title="Does a plugin runs it's migrations on install?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11095" PostTypeId="2" ParentId="11093" CreationDate="2015-08-20T15:46:57.630" Score="1" Body="&lt;p&gt;The &lt;code&gt;switch&lt;/code&gt; tag is a Twig extension that comes as part of Craft. From looking at the code for the &lt;code&gt;Switch_TokenParser&lt;/code&gt; in the Craft &lt;a href=&quot;https://buildwithcraft.com/classreference/etc/templating/twigextensions/Switch_TokenParser&quot; rel=&quot;nofollow&quot;&gt;full class reference&lt;/a&gt; it looks as if it is expecting an expression after &lt;code&gt;case&lt;/code&gt; so you should be able to put in any valid Twig expression that equates to &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-08-20T15:46:57.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11097" PostTypeId="2" ParentId="11094" CreationDate="2015-08-20T16:37:18.357" Score="6" Body="&lt;p&gt;The object of migrations is to provide a way for existing installations of your plugin to get the updated db schema as you update your plugin, without having to uninstall (which would mean they would lose all plugin data) and then reinstall your plugin.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If your schema changes over the life of your plugin, you can write a migration to keep existing installations updated with the latest schema. Craft automatically checks for new migrations whenever a plugin’s version number changes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/migrations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because when a plugin is installed, Craft/Yii will go through your records and create the needed tables/columns as you have defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user downloads the updated plugin and replaces the current version, they won't have the new columns and things could break as they navigate and try to add data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where migrations play an important role, they are to prevent existing users having to lose all plugin data by uninstalling and reinstalling, so when you change your plugin version, Craft will see there is an update and run through all the migrations to bring them up to the current version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is especially handy if for example someone has version &lt;code&gt;0.1.0&lt;/code&gt; and they update to version &lt;code&gt;1.0.0&lt;/code&gt;, which could be quite a leap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in short, if you add new attributes to your plugin record, they will be added for &lt;strong&gt;new installations&lt;/strong&gt; but migrations are only for &lt;strong&gt;existing installations&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="142" LastEditDate="2017-11-29T10:20:07.240" LastActivityDate="2017-11-29T10:20:07.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11098" PostTypeId="2" ParentId="11082" CreationDate="2015-08-20T17:18:52.710" Score="1" Body="&lt;p&gt;You could use a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; to eager load the related data from a plugin and cache the results for future requests.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-20T17:18:52.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11099" PostTypeId="2" ParentId="11093" CreationDate="2015-08-20T17:28:53.900" Score="3" Body="&lt;p&gt;This currently isn't a supported syntax for the Twig switch statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will take that line and compile it down to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case (&quot;A1&quot; || &quot;A2&quot;):&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will always evaluate to &lt;code&gt;true&lt;/code&gt;, which is why you always get the first result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for it to work, it would need to be either:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case &quot;A1&quot;:&#xA;case &quot;A2&quot;:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To take advantage of PHP's fall-through support or the more ugly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case ($context[&quot;bodyClass&quot;] == &quot;A1&quot; || $context[&quot;bodyClass&quot;] == &quot;A2&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2015-08-28T19:13:49.063" LastActivityDate="2015-08-28T19:13:49.063" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="11100" PostTypeId="2" ParentId="11091" CreationDate="2015-08-20T17:48:09.947" Score="4" Body="&lt;p&gt;This is really difficult to provide a proper answer for in its current form, so I'll give some general advice when troubleshooting things like this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Try to limit the complexity of the Twig code building the query.  It might help to break it up into multiple, smaller queries instead of executing everything as one monolithic query.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Don't do this in Twig. Break out into a plugin/PHP using a &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hook&lt;/a&gt; and grab only the data you need using &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;query builder&lt;/a&gt;. Again, it might help to break things up into multiple, smaller queries even from PHP.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Enable &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; and find the resulting SQL that is generated.  Use standard MySQL &lt;a href=&quot;https://www.google.com/search?q=debugging%20mysql%20slow%20queries&quot; rel=&quot;nofollow&quot;&gt;slow query debugging techniques&lt;/a&gt; to see where the bottleneck is and optimize from that information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, you can try to throw more resources at your server and brute force your way though it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-20T17:48:09.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11101" PostTypeId="1" AcceptedAnswerId="11104" CreationDate="2015-08-20T18:06:44.960" Score="5" ViewCount="2171" Body="&lt;p&gt;I have a structure called &quot;locations&quot; that contains two entry types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;State&lt;/li&gt;&#xA;&lt;li&gt;Location&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd like to access specific states at the URL &lt;code&gt;locations/ny.json&lt;/code&gt;, for example, and get a JSON object with all the location entries nested under that state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries are already properly nested for HTML output, but I'm trying to get the JSON to match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my &lt;code&gt;elementsapi.php&lt;/code&gt; file right now:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'locations.json' =&amp;gt; [&#xA;      'elementType' =&amp;gt; 'Entry',&#xA;      'criteria' =&amp;gt; [&#xA;        'section' =&amp;gt; 'locations',&#xA;        'type' =&amp;gt; 'location'&#xA;      ],&#xA;      'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        return [&#xA;          'title' =&amp;gt; $entry-&amp;gt;title,&#xA;          'url' =&amp;gt; $entry-&amp;gt;url,&#xA;          'latitude' =&amp;gt; $entry-&amp;gt;latitude,&#xA;          'longitude' =&amp;gt; $entry-&amp;gt;longitude,&#xA;          'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;locations/{$entry-&amp;gt;id}.json&quot;)&#xA;        ];&#xA;      },&#xA;    ],&#xA;    'locations/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;      return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;          'section' =&amp;gt; 'locations',&#xA;          'type' =&amp;gt; 'state',&#xA;          'slug' =&amp;gt; $slug&#xA;        ],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;          return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            'latitude' =&amp;gt; $entry-&amp;gt;latitude,&#xA;            'longitude' =&amp;gt; $entry-&amp;gt;longitude,&#xA;            'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;locations/{$entry-&amp;gt;id}.json&quot;)&#xA;          ];&#xA;        },&#xA;      ];&#xA;    },&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second endpoint is currently returning a single state entry, but I would like it to return all locations that are a descendant of that state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible using a criteria param such as &lt;code&gt;descendantOf&lt;/code&gt;?&#xA;What criteria params are available?&lt;/p&gt;&#xA;" OwnerUserId="3986" LastEditorUserId="57" LastEditDate="2015-08-20T19:14:25.130" LastActivityDate="2015-08-20T19:14:25.130" Title="What criteria can the Element API plugin accept?" Tags="&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11102" PostTypeId="2" ParentId="11085" CreationDate="2015-08-20T18:19:02.700" Score="1" Body="&lt;p&gt;You've got a couple of incorrect things going on in your current example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)&lt;/code&gt; returns an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's what you want to set the parameters on for the entries you're searching for. Stuart sums it up well &lt;a href=&quot;https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By calling &lt;code&gt;-&amp;gt;first()&lt;/code&gt; on it immediately, you're going to get the defaults, which for entries is by post date in descending order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;slug = $page;&#xA;echo $entry-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You are actually updating the slug for the entry that was returned to be something new.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work for what you're trying to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;slug = 'about';&#xA;    $criteria-&amp;gt;section = 'news';&#xA;    $entry = $criteria-&amp;gt;first();&#xA;    $title = $entry-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-08-20T18:47:08.047" LastActivityDate="2015-08-20T18:47:08.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11103" PostTypeId="1" AcceptedAnswerId="11107" CreationDate="2015-08-20T18:41:38.277" Score="2" ViewCount="64" Body="&lt;p&gt;We have various clients who already have websites but would like us to optimize them a little bit and set them up on craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more efficient way to do this than just hand coding all of the PHP and blocks for every page to align to be editable on craft?&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="22" LastEditDate="2017-05-09T23:33:15.753" LastActivityDate="2017-05-09T23:33:15.753" Title="Best practices of converting an already created site into Craft CMS?" Tags="&lt;craft-features&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11104" PostTypeId="2" ParentId="11101" CreationDate="2015-08-20T19:10:48.240" Score="6" Body="&lt;p&gt;The &lt;code&gt;$entry&lt;/code&gt; variable that is passed to your endpoint’s transformer function will be an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot;&gt;EntryModel&lt;/a&gt; object - the same type of object you use when interacting with entries in your templates. So everything you can do in your templates you can also do from this function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to get a Structure section entry’s children is with the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getChildren-detail&quot;&gt;getChildren()&lt;/a&gt; function, which will actually give you a new ElementCriteriaModel object with the &lt;code&gt;descendantOf&lt;/code&gt; and &lt;code&gt;descendantDist&lt;/code&gt; params pre-set for you. So here’s what your transformer function might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $state) {&#xA;  $locations = $state-&amp;gt;getChildren()-&amp;gt;type('location')-&amp;gt;find();&#xA;  $locationsInfo = [];&#xA;&#xA;  foreach ($locations as $location) {&#xA;    $locationsInfo[] = [&#xA;      'title' =&amp;gt; $location-&amp;gt;title,&#xA;      'url' =&amp;gt; $location-&amp;gt;url,&#xA;      // ...&#xA;    ];&#xA;  }&#xA;&#xA;  return [&#xA;    'title' =&amp;gt; $state-&amp;gt;title,&#xA;    'url' =&amp;gt; $state-&amp;gt;url,&#xA;    'latitude' =&amp;gt; $state-&amp;gt;latitude,&#xA;    'longitude' =&amp;gt; $state-&amp;gt;longitude,&#xA;    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;locations/{$state-&amp;gt;id}.json&quot;),&#xA;    'locations' =&amp;gt; $locationsInfo&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Since you’re dealing with multiple entries within your transformer function, I also went ahead and renamed &lt;code&gt;$entry&lt;/code&gt; to &lt;code&gt;$state&lt;/code&gt;, just so it didn’t get confusing.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-08-20T19:10:48.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11105" PostTypeId="5" CreationDate="2015-08-20T19:14:33.720" Score="0" Body="&lt;p&gt;For more information visit the plugin’s &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-08-20T19:14:33.720" LastActivityDate="2015-08-20T19:14:33.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11106" PostTypeId="4" CreationDate="2015-08-20T19:14:33.720" Score="0" Body="Plugin that makes it easy to create a JSON API for your elements, from Pixel &amp; Tonic." OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-08-20T19:14:33.720" LastActivityDate="2015-08-20T19:14:33.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11107" PostTypeId="2" ParentId="11103" CreationDate="2015-08-20T19:22:04.240" Score="4" Body="&lt;p&gt;If you're not already on a CMS, I'd recommend migrating to Craft sooner rather than later. Sounds like you're definitely planning on migrating to Craft, so I see no valuable reason to delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pros of migrating now:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Awesome Craft features, like Matrix&lt;/li&gt;&#xA;&lt;li&gt;Plugins&lt;/li&gt;&#xA;&lt;li&gt;Twig&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cons of migrating later:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;More legacy code to port&lt;/li&gt;&#xA;&lt;li&gt;More legacy data to restructure&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll notice that both of those lists reinforce the idea of migrating now. ;)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-08-20T19:22:04.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11108" PostTypeId="1" AcceptedAnswerId="11120" CreationDate="2015-08-20T20:04:45.173" Score="3" ViewCount="183" Body="&lt;p&gt;I am using &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries Field&lt;/a&gt; to display related content. I have several Entries Field in an article and i also want to display the fields that are empty, but with their section name.... Is this even possible? I am quite new to Craft, so don't know if I am even in a right direction... Help will be highly appriciated!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.entries({&#xA;  relatedTo: { &#xA;    sourceElement: entry, &#xA;      field: ['entry','entry2','entry3']&#xA;    },&#xA;    order:     &quot;sortOrder&quot;,&#xA;    limit:     null&#xA;  })  &#xA;%}&#xA;&#xA;{% if assets %}&#xA;  {% for asset in assets %}&#xA;      {% if asset|title %}&#xA;        {{ asset.section.name }}: {{ asset.title }}&#xA;      {% else }&#xA;        {{ asset.section.name }}: Empty&#xA;      {% endif }&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3988" LastEditorUserId="125" LastEditDate="2015-08-22T15:08:25.267" LastActivityDate="2015-08-22T16:11:16.957" Title="Multiple Entries fields, show empty ones?" Tags="&lt;elementcriteriamodel&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11109" PostTypeId="2" ParentId="11030" CreationDate="2015-08-20T22:33:32.253" Score="2" Body="&lt;p&gt;thanks a lot for all the answers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I finally got my entries to show up! What I did was move that entry to Homepage section(like what Alec Ritson suggested) together with other entry I already have in Homepage and wrapped the block code with&#xA;    {% for entry in craft.entries.section('homepage') %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the full code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('homepage') %}&#xA;    {% for block in entry.bannerMatrix %}&#xA;        &amp;lt;div&amp;gt;&#xA;            {% set blockImage = block.image.first() %}&#xA;&#xA;            {% if blockImage %}&#xA;                &amp;lt;img src=&quot;{{ blockImage.getUrl() }}&quot; alt=&quot;{{ block.heading }}&quot; title=&quot;{{ block.heading }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;div class=&quot;hero_msg&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;caption_top&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;caption&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                    &amp;lt;h4&amp;gt;&#xA;                        &amp;lt;span class=&quot;rsep&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                        {{ block.subheading }}&#xA;                        &amp;lt;span class=&quot;lsep&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/h4&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;caption_bot&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3974" LastEditorUserId="57" LastEditDate="2015-08-20T22:35:41.523" LastActivityDate="2015-08-20T22:35:41.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11113" PostTypeId="1" AcceptedAnswerId="11114" CreationDate="2015-08-21T13:55:52.420" Score="11" ViewCount="418" Body="&lt;p&gt;We build a lot of Craft site's these days, and now we ave a lot of experience we find we are &lt;em&gt;always&lt;/em&gt; having to re-do the same few dozen things at the start of every project, such as setting up a Matrix field called 'Mixed Content' with a bunch of entry types in it, and the same for 'SEO' fields. These are always identical, but they take half an hour or so to set up, every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The templates aren't an issue, we have those stored somewhere and can just copy them in, but getting the database stuff done is becoming a chore and it's time that's adding up. How do you handle this?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="22" LastEditDate="2017-05-09T23:32:08.100" LastActivityDate="2017-12-14T09:43:16.770" Title="How do you manage your Craft 'starting point'?" Tags="&lt;workflow&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11114" PostTypeId="2" ParentId="11113" CreationDate="2015-08-21T14:18:12.340" Score="11" Body="&lt;p&gt;I have a Craft boilerplate installed on my local machine - like a self-contained website with all the stuff I use on every project (I also keep my front-end framework in here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I start a new project:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Duplicate the &lt;code&gt;boilerplate&lt;/code&gt; site folder&lt;/li&gt;&#xA;&lt;li&gt;Create an entry in MAMP&lt;/li&gt;&#xA;&lt;li&gt;Delete the &lt;code&gt;.git&lt;/code&gt; folder&lt;/li&gt;&#xA;&lt;li&gt;Duplicate the local database for the new site (SequalPro, Navicat)&lt;/li&gt;&#xA;&lt;li&gt;Delete &lt;code&gt;/craft/config/license.key&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Bingo, new site is ready to go with all the fields and front end stuff I need for a new project.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2017-12-14T09:43:16.770" LastActivityDate="2017-12-14T09:43:16.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11115" PostTypeId="2" ParentId="11113" CreationDate="2015-08-21T14:55:55.880" Score="4" Body="&lt;p&gt;We have a bash script that does a whole bunch of things the key ones being the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Downloads the latest Craft install, unpacks it and sorts it out&lt;/li&gt;&#xA;&lt;li&gt;Clones in our default templates and config files&lt;/li&gt;&#xA;&lt;li&gt;Clones in a bunch of plugins&lt;/li&gt;&#xA;&lt;li&gt;Makes a vhost and database&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We then have a plugin that sets up a bunch of fields and plugins that we always want and voilá!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve ported a version of it over &lt;a href=&quot;https://gist.github.com/joshangell/8f54e2647a07c942fecd&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; in case anyone finds it helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be honest we’re thinking of doing away with the plugin method of setting up fields and plugins etc as it is becoming a bit of a pain to maintain. We’ll likely go with a db dump of what we want the starting point to be and then just update that now and again.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2015-08-21T15:02:34.517" LastActivityDate="2015-08-21T15:02:34.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11116" PostTypeId="1" CreationDate="2015-08-21T21:57:27.437" Score="2" ViewCount="63" Body="&lt;p&gt;This may just be a 5PM Friday issue, but I'm scratching my head over here. I'm trying to associate a string of related entry id's represented by a variable with a new entry via the API. When I pass the variable, only the first one gets inserted into the DB. If I use the string they all get inserted. Here's the insert code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $article_countries = &quot;1021,1047,1076,1123&quot;; &#xA;&#xA; $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;   'article_countries' =&amp;gt; array(&#xA;     $articleCountries&#xA;    )&#xA; ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is the string working where the variable isn't?&lt;/p&gt;&#xA;" OwnerUserId="500" LastEditorUserId="125" LastEditDate="2015-08-22T15:05:14.457" LastActivityDate="2015-08-24T14:42:25.570" Title="Associating related entries to a new entry when using the API" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11117" PostTypeId="1" AcceptedAnswerId="11118" CreationDate="2015-08-21T22:20:20.027" Score="2" ViewCount="173" Body="&lt;p&gt;I'm new to craft, in fact I haven't built a site with it yet, but am looking forward to getting my teeth into this interesting and seemingly very flexible CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am about to embark on a medium sized website build and have a question that is kind of a deal breaker for choosing the CMS. My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I create users that have their own profile page, who can only edit their own page and do nothing else? This won't be a public registration, but administered internally, however they must be able to maintain a profile containing images, text and predetermined layouts that they can choose between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks guys!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Brad, &#xA;Thanks so much for your response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the URL - could it be configured to be something like mydomain.com/members/membername instead of passing a url option?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2015-08-22T07:17:20.897" LastActivityDate="2015-08-22T07:17:20.897" Title="User Profile page - one user can only access one page" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11118" PostTypeId="2" ParentId="11117" CreationDate="2015-08-21T23:31:55.607" Score="0" Body="&lt;p&gt;Absolutely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the template side you'd do something like this to ensure they're editing their own page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# assuming the URL structure for the profile page looks something like http://mydomain.com/users?id=5 %}&#xA;&#xA;{% set editUserId = craft.request.getParam('id') %}&#xA;&#xA;{% if editUserId and currentUser.id == editUserId %}&#xA;    You're in!&#xA;{$ else %}&#xA;    {% exit 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;a href=&quot;http://buildwithcraft.com/docs/templating/global-variables#currentUser&quot; rel=&quot;nofollow&quot;&gt;currentUser&lt;/a&gt; is a global variable that's a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; object.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-21T23:31:55.607" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11119" PostTypeId="2" ParentId="11116" CreationDate="2015-08-22T14:29:08.250" Score="1" Body="&lt;p&gt;I dont think you can build arrays in PHP that way and you end up passing &lt;code&gt;array(0 =&amp;gt; '1021,1047,1076,1123')&lt;/code&gt; to the param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not shure if passing the string is supported:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'article_countries' =&amp;gt; $article_countries&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If not you could build the array like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'article_countries' =&amp;gt; array_map('trim', explode(',', $article_countries))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-22T14:29:08.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11120" PostTypeId="2" ParentId="11108" CreationDate="2015-08-22T15:03:00.950" Score="1" Body="&lt;p&gt;It's probably not possible to get the sections you limited your entries field to from the template and if there's no entry selected that's what you'd need to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I'd recommend and what's generally a pretty solid approach in such situations is to build an associative array with all the necessary data and loop through that array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relationsGroups = {&#xA;    'entriesField1': 'Heading Relations 1',&#xA;    'entriesField2': 'Heading Relations 2',&#xA;    'entriesField3': 'Heading Relations 3',&#xA;} %}&#xA;&#xA;{% for fieldHandle, heading in relationsGroups %}&#xA;    {% set assets = craft.entries({&#xA;        relatedTo: {&#xA;            sourceElement: entry,&#xA;            field: fieldHandle&#xA;        }&#xA;        order: 'sortOrder',&#xA;        limit: null&#xA;    }) %}&#xA;&#xA;    {% for asset in assets %}&#xA;        &amp;lt;li&amp;gt;{{ heading }}: {{ asset.title }}&amp;lt;/li&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;li&amp;gt;{{ heading }}: Empty&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-08-22T16:11:16.957" LastActivityDate="2015-08-22T16:11:16.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11122" PostTypeId="1" CreationDate="2015-08-22T22:49:19.927" Score="3" ViewCount="637" Body="&lt;p&gt;I'm new to Craft CMS and can't figure out how to link images with the code below to its own page. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.mainImages %}&#xA;&#xA;    &amp;lt;a href=&quot;{# link to the image's page #}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.url('thumb') }}&quot;&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3995" LastEditorUserId="125" LastEditDate="2015-08-23T15:38:00.117" LastActivityDate="2015-08-23T15:38:00.117" Title="How do I link an image to its own page?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11123" PostTypeId="2" ParentId="2684" CreationDate="2015-08-23T00:29:21.567" Score="3" Body="&lt;p&gt;You're running into an issue with the way you are setting variables in the processing order. I believe &lt;code&gt;{% block %}&lt;/code&gt; tags are processed after all other tags in the template, and then they are processed all at once, with any variables available at that point in time, and the related content in their respective block tags in the parent templates. So while you are creating your &lt;code&gt;slideImg&lt;/code&gt; variable higher on the page, the &lt;code&gt;hero&lt;/code&gt; and &lt;code&gt;footerJs&lt;/code&gt; blocks are not processed from top to bottom on the page, they are processed simultaneously, and independently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you set &lt;code&gt;{% set slideImg = block.heroImg.first().url %}&lt;/code&gt; within your Matrix loop, it's already too late to have that variable available modify the existing &lt;code&gt;slideImg&lt;/code&gt; variable that you set outside of the block tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are three approaches I can think of to address the issue:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use &lt;code&gt;set&lt;/code&gt; tags instead of &lt;code&gt;block&lt;/code&gt; tags&lt;/li&gt;&#xA;&lt;li&gt;Process your matrix field outside of the &lt;code&gt;block&lt;/code&gt; tags higher on the page&lt;/li&gt;&#xA;&lt;li&gt;Write a plugin to help you out (I won't go into an example of this one here)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h3&gt;1. Use &lt;code&gt;set&lt;/code&gt; tags instead of &lt;code&gt;block&lt;/code&gt; tags&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;While most of the examples in learning Twig use &lt;code&gt;block&lt;/code&gt; tags for page layouts, it's less common to see people actually using them in a way that takes advantage of their uniqueness and very frequently you can just swap them out for &lt;code&gt;set&lt;/code&gt; tags and get the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this, you'd need to modify your layout template and page template accordingly.  Here's a simplified example of your code above that should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if hero is defined %}&#xA;    {{ hero }}&#xA;{% endif %}&#xA;&#xA;{% if footerJs is defined %}&#xA;    {{ footerJs }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;layout&quot; %}&#xA;&#xA;{% set slideImg = &quot;&quot; %}&#xA;&#xA;{% set hero %}&#xA;  {% set slideImg = &quot;image.png&quot; %}&#xA;{% endset %}&#xA;&#xA;{% set footerJs %}&#xA;  {{ slideImg }}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe in this example, all that you would need to update to use the &lt;code&gt;set&lt;/code&gt; tag is the &lt;code&gt;hero&lt;/code&gt; block, and if you left the &lt;code&gt;footerJs&lt;/code&gt; as a block, things would still work out because you'd be processing the Matrix block within the set tag higher on the page, and the variable would be updated by the time Twig was processing the &lt;code&gt;block&lt;/code&gt; tag in your footer.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;2. Process your matrix field outside of the &lt;code&gt;block&lt;/code&gt; tags higher on the page&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;In this workaround, the goal is to process the variables you need outside of the &lt;code&gt;block&lt;/code&gt; tags higher on the page, so the variables you set will be available to all of the &lt;code&gt;block&lt;/code&gt; tags on your page when they get processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplified example below, I assume your parent template stays the same and uses &lt;code&gt;block&lt;/code&gt; tags for &lt;code&gt;hero&lt;/code&gt; and &lt;code&gt;footerJs&lt;/code&gt;, and set a new variable at the top of the page called &lt;code&gt;{{ heroContent }}&lt;/code&gt; where we can loop through our Matrix blocks, set additional variables that are available to us in the page template, and that later gets output farther down the page within the &lt;code&gt;hero&lt;/code&gt; block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% set slideImg = &quot;&quot; %}&#xA;&#xA;{% set heroContent %}&#xA;    {% for block in entry.hero %}&#xA;&#xA;      {% set slideImg = block.heroImg.first().url %}&#xA;&#xA;      {# Everything else you want to output in your hero block #}&#xA;&#xA;    {% endfor %}&#xA;{% endset %}&#xA;&#xA;{% block hero %}&#xA;  {{ heroContent }}&#xA;{% endblock %}&#xA;&#xA;{% block footerJs %}&#xA;  {{ slideImg }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a longer discussion of the Twig processing order and there is a related article on Straight Up Craft called &lt;a href=&quot;https://straightupcraft.com/articles/twig-processing-order&quot; rel=&quot;nofollow&quot;&gt;The Twig processing order in Craft templates&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T00:29:21.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11124" PostTypeId="2" ParentId="9386" CreationDate="2015-08-23T00:57:24.027" Score="3" Body="&lt;p&gt;If the environment that you are working in is behaving like the settings that you have set for another environment, it's likely that the settings from that other environment are the ones that are being read by Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common situation where I've seen this take place is based on the way that the Craft multi-environment config matches patterns for each environment you are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have three environments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;website.com&lt;/li&gt;&#xA;&lt;li&gt;dev.website.com&lt;/li&gt;&#xA;&lt;li&gt;localwebsite.dev&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unless you are overriding the &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; variable in your &lt;code&gt;index.php&lt;/code&gt; file, you may have a situation the keys of the multi-environment settings array match the pattern of the URL from the environment you are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an abbreviated example multi-env settings array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    '*' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; 'website.com',&#xA;        ),&#xA;    ),&#xA;    'dev' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; 'dev.website.com',&#xA;        ),&#xA;    ),&#xA;);&#xA;&#xA;// The Barrel Strength Multi-env config checks for an&#xA;// additional local config here.  In our example, that &#xA;// would be for the environment `localwebsite.dev`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, 2 of your 3 environments are going to trigger the configuration for your dev site, and none are going to trigger the configuration for your local setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;code&gt;dev.website.com&lt;/code&gt; and &lt;code&gt;localwebsite.dev&lt;/code&gt; will trigger the settings in the &lt;code&gt;dev&lt;/code&gt; configuration in the array as Craft takes the first configuration that matches the pattern in the URL, and the word &lt;code&gt;dev&lt;/code&gt; will match both of those environment URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the other comments have noted on the primary post, this is really just guesswork until we see the specific config settings you are using. I've tried to approach my answer as one that at least applies to a similar situation to the issue described even if it turns out that it doesn't help resolve the immediate question.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T00:57:24.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11125" PostTypeId="2" ParentId="5290" CreationDate="2015-08-23T01:09:16.173" Score="2" Body="&lt;p&gt;While this question is a bit old, for the sake of completeness I'll echo what Brad mentioned in the comment above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin bugs are best handled by notifying the developer directly. This plugin happens to be on Github and it appears that the developer has responded to all open &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer/issues&quot; rel=&quot;nofollow&quot;&gt;issues&lt;/a&gt; and closed them out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the convention for tagging Stack Exchange posts that are related to plugins is to prefix the plugin's name with the word &lt;code&gt;plugin&lt;/code&gt;. In this case, a good tag may be &lt;code&gt;plugin-craftmailer&lt;/code&gt; or &lt;code&gt;plugin-mailer&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T01:09:16.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11126" PostTypeId="2" ParentId="9025" CreationDate="2015-08-23T01:27:00.290" Score="4" Body="&lt;p&gt;The asker was able to solve their question and confirm that MailGun can be used with Craft. In the comment they state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Just FYI: requiring vendor/autoload.php (from my plugin) worked and&#xA;  correctly loads Mailgun. So I guess it works, it's just (more than a&#xA;  little) ugly&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We have had success integrating Craft with MailGun in our plugins as well.  While we have not released our integration publicly, we have a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow&quot;&gt;Sprout Email&lt;/a&gt; MailGun integration used by our direct customers and we were able to successfully integrate with Email Lists and Campaigns, and allow users to build Emails using Craft templates with Live Preview and send them through the MailGun API.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T01:27:00.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11127" PostTypeId="2" ParentId="9290" CreationDate="2015-08-23T01:31:01.153" Score="4" Body="&lt;p&gt;For the sake of completeness, the question was resolved by the asker and I will quote his answer here, so this fine question is recognized by Stack Exchange as answered!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt V says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I discovered that the following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($user-&amp;gt;networksMatrix as $key =&amp;gt; $networkLink)&#xA;{&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networktype&quot;] = $networkLink-&amp;gt;networktype-&amp;gt;ids()[0];&#xA;    $netArr[$networkLink-&amp;gt;id][&quot;fields&quot;][&quot;networkUrl&quot;] = $networkLink-&amp;gt;networkUrl;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;Since networktype is a categories field and that field is limited to 1&#xA;  category I'll only ever get a single result from the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;So... I just do this and I'm good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$networkLink-&amp;gt;networktype-&amp;gt;ids()[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T01:31:01.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11128" PostTypeId="2" ParentId="11122" CreationDate="2015-08-23T02:24:19.710" Score="3" Body="&lt;p&gt;It's not clear what exactly you mean by 'its own page'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you want to have an entry for each image? or a twig template that displays that image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you access a page by default &lt;code&gt;{{ entry.url }}&lt;/code&gt; refers to the entry of the page you are currently on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can link to the &lt;code&gt;{{ asset.url }}&lt;/code&gt; but I'm not certain that is what you are trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please update your question so we can help you further.&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="27" LastEditDate="2015-08-23T13:44:00.627" LastActivityDate="2015-08-23T13:44:00.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11129" PostTypeId="2" ParentId="2271" CreationDate="2015-08-23T04:53:42.630" Score="3" Body="&lt;p&gt;One small detail that can cause the front-end and back-end of your site to result in a blank white page, is if you have a syntax error in your &lt;code&gt;general.php&lt;/code&gt; file, such as a missing comma at the end of a line.  If you've just made a recent edit to your config files, take a closer look at them and make sure that you don't have any small errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the following multi-environment config is missing a comma at the end of the &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; setting, and that minor detail would make both the front-end and back-end of a site result in a blank white page: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true&#xA;        'devMode' =&amp;gt; false&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T04:53:42.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11130" PostTypeId="2" ParentId="2813" CreationDate="2015-08-23T05:06:28.290" Score="9" Body="&lt;p&gt;I've run into this situation in various scenarios as well where a front-end entry form fails to save anything and just seems to be reloading the page. Almost always it has had to do with overlooking a required field or some other small detail, as Douglas mentions in his comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all of your fields are not required, make sure you are still setting fields like the &lt;code&gt;Title&lt;/code&gt; field, which are necessary for your Entry to save properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to help troubleshoot is to take a look at all of the errors you are getting back. If you are just trying to output errors for the fields you are submitting you may be missing seeing an error for another field that is giving you an error but that you are not outputting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a front-end entry form fails to submit, Craft will add any errors to the &lt;code&gt;EntryModel&lt;/code&gt; and return it to the page. If you have &lt;code&gt;devMode&lt;/code&gt; enabled, you can dump all of the errors from your submission with the following line of code to help troubleshoot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;{{ dump(entry.getErrors()) }}&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T05:06:28.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11131" PostTypeId="2" ParentId="4403" CreationDate="2015-08-23T05:22:56.733" Score="2" Body="&lt;p&gt;As you've noted, this is a complex and would require a proper discovery and planning phase to sort out all the details.  Here are a few thoughts on each stage of the process that you discussed. It looks like Luke has approached the problem in a similar way in the comments above.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;User1 has a login to the site, and has access to user_1_report.pdf&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This could potentially be handled by a Craft Entries or Users Relations field.  You could let somebody relate a Report to the specific User who should be able to see it, or allow a User Profile to be related to several differnet Reports.  In whichever case, you could limit who has visibility to the reports in the front-end by only displaying Reports to Users who have the right relationship to them.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;User2 logs in and sends a request to User1 to view user_1_report.pdf&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This will need to be handled with a plugin.  I would approach the problem in two steps.  The first part of the problem is an email notification problem, and the second part is an action that will required changing the relationship or permissions of who has access to something. Depending on how secure you need things to be, there may also be a validation component to ensure that only a User that has received an invite is able to accept that invite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are likely some Email plugins that could help get you started with the Email notification part of this. We have built similar authentication workflows using Sprout Email. For the particular approval action that you need, it's likely you'll need to approach that as a separate custom plugin that handles the specific action you need.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;User1 receives a notification in their members area and can click Approve / Deny&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is mostly addressed in my previous comment. When you trigger the notification email, you can make sure that the notification email includes a link to help the user Approve/Deny the request. In my discussion above, those Approve or Deny actions would probably be links to controller actions that handle the behavior you need, or to a page on your site that then allows the user to trigger the right action.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;User2 gains access to the user_1_report.pdf as a download link in their members area.&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Once the approval workflow is sorted out, this will likely just be handled in the same way as the first scenario – via a Relations field or some permission and the standard Twig code needed to output that data.  One option could be to have an &quot;Approved Users&quot; field on a Report Entry, and your custom action would trigger adding the invited user as a Relation to the Report that they were invited to.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T05:22:56.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11132" PostTypeId="2" ParentId="6619" CreationDate="2015-08-23T05:32:54.027" Score="2" Body="&lt;p&gt;In the example code above, the query is retrieving a list of Entries and setting it to the variable &lt;code&gt;entries&lt;/code&gt;.  Then, you are trying to loop through those Entries and treat them like they are a list of Assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As noted in the comments, this was complicating the situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that, on the &lt;code&gt;entry.html&lt;/code&gt; page, the &lt;code&gt;entry&lt;/code&gt; variable was already available, as Craft makes that &lt;code&gt;entry&lt;/code&gt; variable to all individual entry pages in Sections that have URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes accessing the Assets field on that page as simple as accessing a field, rather than needing to create a separate query to find the data.  From the comments above, the solution was to just access the appropriate Assets field on the Entry Page template and loop through them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.entryFieldHandle %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T05:32:54.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11133" PostTypeId="2" ParentId="5379" CreationDate="2015-08-23T05:47:52.653" Score="2" Body="&lt;p&gt;Please correct me if I am making an incorrect assumption. From your example, it looks like you're passing multiple tags to the search query, and by &lt;em&gt;greatest coincidence&lt;/em&gt; you mean that you want the Entries that have the most matching tags that are part of your search, to appear higher in the results than Entries that may just have a single matching tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe this is possible without an additional plugin that helps with modifying the scoring and order of the search results.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-08-23T05:47:52.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11134" PostTypeId="2" ParentId="9937" CreationDate="2015-08-23T06:05:38.483" Score="2" Body="&lt;p&gt;I don't think there is going to be an easy one-to-one mapping for migrating a Yii site to Craft. There may be several areas you can reuse code, but I expect you'll need to restructure things a bit to fit the Craft plugin architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also mention a handful of static pages. It sounds like these pages are not pulling from a database already but that you will want to migrate them into Craft.  For these, you'll likely need to migrate things into the Craft database and then update your existing code to be integrated with this data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's hard to be too specific without understanding more about how your current data is stored and what types of specific applications you'd need to be porting over.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-08-24T01:28:46.663" LastActivityDate="2015-08-24T01:28:46.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11135" PostTypeId="2" ParentId="10976" CreationDate="2015-08-23T06:13:04.990" Score="3" Body="&lt;p&gt;This problem was solved via the related question on Stack Overflow here: &lt;a href=&quot;https://stackoverflow.com/a/1576473/1586560&quot;&gt;Cannot connect to MySQL 4.1+ using old authentication&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-08-23T06:13:04.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11136" PostTypeId="2" ParentId="9219" CreationDate="2015-08-23T06:18:52.393" Score="4" Body="&lt;p&gt;It looks like this question was resolved via some extended sleuthing in the comments above:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4877/can-i-disable-the-control-panel&quot;&gt;Can I disable the control panel?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/38/how-can-i-run-the-control-panel-from-a-separate-domain&quot;&gt;How can I run the Control Panel from a separate domain?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Overall, it looks like the answer is yes, however some part of the solution lies in settings around the server environment and routing rules outside of Craft.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-08-23T06:18:52.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11137" PostTypeId="1" AcceptedAnswerId="11146" CreationDate="2015-08-23T07:33:11.357" Score="5" ViewCount="743" Body="&lt;p&gt;I have a webhook that fetches an entry, modifies one of its custom Text field values and then saves the entry. However there is also a required Categories field on the entry, and when I do this, I get a validation error because the Categories field is blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s the relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'myTextField' =&amp;gt; $newValue&#xA;));&#xA;&#xA;// Let's see if it saves.&#xA;// Field validation should happen automatically&#xA;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA;    Craft::log('Entry updated (ID: '.$entry-&amp;gt;id.').');&#xA;}&#xA;else&#xA;{&#xA;    Craft::log('Could not updated the entry (ID: '.$entry-&amp;gt;id.').', LogLevel::Error);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I save the entry without losing its existing Categories field value?&lt;/p&gt;&#xA;" OwnerUserId="3836" LastEditorUserId="9" LastEditDate="2015-08-24T14:04:01.530" LastActivityDate="2019-05-31T20:35:04.963" Title="Categories field is losing its value when programmatically updating other fields’ values" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11139" PostTypeId="2" ParentId="11122" CreationDate="2015-08-23T14:41:38.413" Score="5" Body="&lt;p&gt;In Craft assets do not get &quot;their own page&quot; by default, but you can easily create them with a &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot;&gt;Dynamic Route&lt;/a&gt;. So go to Settings → Routes and add a new route with a number token, e.g. &lt;code&gt;assets/&amp;lt;number&amp;gt;&lt;/code&gt; and route those URIs to a new template, e.g. &lt;code&gt;assets/_entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this route set up you can now link to an asset's entry page like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url('assets/' ~ asset.id) }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ asset.url('thumb') }}&quot;&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your assets/_entry.html template you do now &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.assets&quot;&gt;query for your asset&lt;/a&gt; via its ID, which is now available as a variable named &quot;number&quot;. Use the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/exit&quot;&gt;&lt;code&gt;exit&lt;/code&gt;&lt;/a&gt; tag to 404 the request in case no asset was found for the given ID.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.id(number).first() %}&#xA;&#xA;{% if not asset %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;figure&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ asset.url('fullscreen') }}&quot;&amp;gt;&#xA;    &amp;lt;figcaption&amp;gt;{{ asset.caption }}&amp;lt;/figcaption&amp;gt;&#xA;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-08-23T14:49:36.917" LastActivityDate="2015-08-23T14:49:36.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11140" PostTypeId="2" ParentId="11137" CreationDate="2015-08-23T15:26:56.130" Score="1" Body="&lt;p&gt;I'm probably missing something here, but can't you just query for the entry model&#xA;and only modify the field you want to change?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;id = 1;&#xA;$entries = $criteria-&amp;gt;first();&#xA;&#xA;if ($entry)&#xA;{&#xA;    $entry-&amp;gt;setContentFromPost(array(&#xA;        'fieldToChange' =&amp;gt; 'newValue'&#xA;    ));&#xA;&#xA;    // Validate the entry model here if necessary&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-23T15:26:56.130" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11141" PostTypeId="1" AcceptedAnswerId="12344" CreationDate="2015-08-23T17:25:17.780" Score="1" ViewCount="170" Body="&lt;p&gt;I want to provide an easy way to make exponent style text in the Redactor field type.&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mAchv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mAchv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a Redactor plugin to do that?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If no what is the best way to handle that?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/ HTML superscript tag  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;p&amp;gt;This text contains &amp;lt;sup&amp;gt;superscript&amp;lt;/sup&amp;gt; text.&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;br&gt;&#xA;2/ CSS custom Redactor class  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.sup { &#xA;    vertical-align: super;&#xA;    font-size: smaller;&#xA;}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-11-11T12:02:00.260" Title="Make exponent style in Riche Text field" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11142" PostTypeId="2" ParentId="11141" CreationDate="2015-08-23T18:20:19.533" Score="5" Body="&lt;p&gt;In &lt;code&gt;craft/config/redactor&lt;/code&gt; you can either add your own setting file, or edit one of the ones already there. If you add the following JSON:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;formattingAdd&quot;: [&#xA;  {&#xA;    &quot;tag&quot;: &quot;sup&quot;,&#xA;    &quot;title&quot;: &quot;Superscript&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will have access to a &lt;code&gt;Superscript&lt;/code&gt; choice under the &lt;code&gt;Formatting&lt;/code&gt; buttons dropdown menu. This will wrap the selected text in a &lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I'm not sure if this is the correct way of adding stuff like this, I just tested it and it does work.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-08-23T18:20:19.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11143" PostTypeId="1" CreationDate="2015-08-24T02:51:19.090" Score="1" ViewCount="86" Body="&lt;p&gt;Are normal workflow involves developing the site locally but making all the database level changes (fields and data) on the sever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick has always been assets.  We don't bother syncing assets, just the database which works fine except when it comes to newly defined image transforms.  They need to be run on the server first to work properly locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We end up using Amazon s3 mostly to get around this exact issue but it would be better if I could somehow set a config setting that would tell all my image transforms to use the staging domain.  Is that possible somehow?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-08-24T02:51:19.090" Title="Render image transforms on the staging server" Tags="&lt;image-transforms&gt;&lt;s3&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11144" PostTypeId="1" AcceptedAnswerId="11155" CreationDate="2015-08-24T06:32:23.453" Score="1" ViewCount="125" Body="&lt;p&gt;It looks like redactor is adding a rel attribute to images as they are added to content via the RTE. Removing the rel attribute and then switching views adds it back in again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I remove the rel attribute as it's affecting validation: &lt;a href=&quot;https://validator.w3.org/nu/?doc=http%3A%2F%2Fgrowthwise.com.au%2Fnews%2F2015%2Fgetting-organised-for-tax-sucks-is-there-an-easier-way&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://validator.w3.org/nu/?doc=http%3A%2F%2Fgrowthwise.com.au%2Fnews%2F2015%2Fgetting-organised-for-tax-sucks-is-there-an-easier-way&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jcLNS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jcLNS.png&quot; alt=&quot;WYSIWYG View&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eqy1b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eqy1b.png&quot; alt=&quot;Source View&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="963" LastActivityDate="2015-08-24T17:40:25.687" Title="Why is craft adding a rel attribute with inline styles in my textarea?" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11145" PostTypeId="1" CreationDate="2015-08-24T09:25:26.460" Score="1" ViewCount="336" Body="&lt;p&gt;All of a sudden, saving entries became really slow (up to a minute). Regardless of entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came across this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9273/saving-entries-in-admin-panel&quot;&gt;Saving entries in admin panel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is when I turn on devMode saving goes without a problem and only takes a second, so I am unable to debug it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why saving all of a sudden is very slow, and/or why saving is fast only with devMode true?&lt;/p&gt;&#xA;" OwnerUserId="94" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-08-27T07:00:42.007" Title="Slow saving when devMode false, but not while true" Tags="&lt;devmode&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11146" PostTypeId="2" ParentId="11137" CreationDate="2015-08-24T13:18:01.897" Score="5" Body="&lt;p&gt;&lt;strong&gt;Update - Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been fixed. The relational field will retain its original value when an entry is re-saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You no longer need to apply a workaround to get the expected behavior.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original - Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, admittedly, super awkward right now. To prevent a relational field from losing its value when saving an entry, you have to explicitly set its value to &lt;code&gt;null&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'myCategoriesField' =&amp;gt; null&#xA;    // ...&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this only works for relational fields that &lt;em&gt;aren’t&lt;/em&gt; set to Required. If the field &lt;em&gt;is&lt;/em&gt; set to Required, you have to just re-set the field to the same element IDs that were already selected:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'myCategoriesField' =&amp;gt; $entry-&amp;gt;myCategoriesField-&amp;gt;ids()&#xA;    // ...&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(FWIW, this will stop being awkward in Craft 3, as we done some major refactoring under the hood to fix issues like this.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="45" LastEditDate="2019-05-31T20:35:04.963" LastActivityDate="2019-05-31T20:35:04.963" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11147" PostTypeId="2" ParentId="11116" CreationDate="2015-08-24T14:42:25.570" Score="0" Body="&lt;p&gt;Thanks carlcs, your comment &amp;amp; fresh eyes set me on the right track this morning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not real sure why I was wrapping the $article_countries var in another array...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this will help somebody else out at 5PM on a Friday...&lt;/p&gt;&#xA;" OwnerUserId="500" LastActivityDate="2015-08-24T14:42:25.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11148" PostTypeId="1" AcceptedAnswerId="11153" CreationDate="2015-08-24T14:43:04.020" Score="2" ViewCount="153" Body="&lt;p&gt;Ok I'm buliding a plugin which changes the category of a news article if another article is set to the same category so that only one article is set as the featured category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have the onSaveBeforeEntry event working ok I'm just stuck on the updating the existing featured article. This is the flow so far followed by the code I'm having an issue with.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First check the article being saved to see if the category is set.&lt;/li&gt;&#xA;&lt;li&gt;If it is check it has not changed.&lt;/li&gt;&#xA;&lt;li&gt;If it has changed and it has changed to 'Featured' use getCriteria to find the entry that is currently set to 'Featured'&lt;/li&gt;&#xA;&lt;li&gt;(the sticking point) set the existing featured entry category to 'Latest' and save it.&lt;/li&gt;&#xA;&lt;li&gt;Finish off saving the entry.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Point 4 is not changing the existing featured article data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I have is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the current featured news entry&#xA;$entry_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$entry_criteria-&amp;gt;section = 'news';&#xA;$entry_criteria-&amp;gt;search = 'category:Featured';&#xA;$featuredEntry = $entry_criteria-&amp;gt;first();&#xA;&#xA;// update exiting featured article and mark as latest&#xA;$featuredEntry-&amp;gt;setContentFromPost(array('category' =&amp;gt; 'Latest'));&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($featuredEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting the existing entry works, changing the category and re-saving does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ta&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-24T17:13:12.720" Title="Changing an entries data in onBeforeSaveEntry event depending on data set in saved entry" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11149" PostTypeId="1" AcceptedAnswerId="11154" CreationDate="2015-08-24T15:39:11.893" Score="1" ViewCount="91" Body="&lt;p&gt;I written a plugin which doesn't work on PHP 5.3 but does work on 5.4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem to be even routing to the function as if I I add a die(&quot;dead&quot;) to the controller function I still just get a 500 error if using ajax or a blank page if going straight to the actions URL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The craft requirements say PHP 5.3 and above, is this not the case for plugins?&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-08-24T17:22:44.843" Title="Plugin not working on PHP 5.3" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11150" PostTypeId="1" AcceptedAnswerId="11156" CreationDate="2015-08-24T15:43:44.597" Score="2" ViewCount="143" Body="&lt;p&gt;Trying to find out where the source email comes from with the ContactForm Plugin. The plugin is perfect and saved me a lot of time, so thank you guys!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alas, my client is getting emails from the site in my name, yet I can't see where this is being sourced form - except possibly my profile page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a place I can configure the email for the ContactForm plugin other than changing the email address for the admin account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stephen&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-08-24T17:55:11.460" Title="ContactForm Plugin - Where does the email source come from?" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11151" PostTypeId="1" AcceptedAnswerId="11172" CreationDate="2015-08-24T16:27:37.607" Score="2" ViewCount="264" Body="&lt;p&gt;Is there a way to only fetch categories that have been assigned to a minimum of entries, i.e. &lt;code&gt;4&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I fetch categories like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productIds = craft.entries.section('products').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: productIds }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I can now do the following to only display content for categories which have been assigned to at least  four entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('products').relatedTo(category) %}&#xA;{% if entries|length &amp;gt; 4 %}&#xA;  ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But is there a way to apply this logic to the &lt;code&gt;craft.categories&lt;/code&gt; query?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2015-08-25T10:43:14.437" Title="Only fetch categories that are related to a minimum of entries" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11152" PostTypeId="1" AcceptedAnswerId="11157" CreationDate="2015-08-24T17:02:33.730" Score="3" ViewCount="510" Body="&lt;p&gt;I am setting up a multi-language site so far so good - everything is pretty obvious what to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious if there is a way/best practice to have the &lt;code&gt;environmentVariables&lt;/code&gt; array configured so that it knows which key to use based on the current &lt;code&gt;siteUrl&lt;/code&gt; key?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize the syntax is incorrect/wrong but this is just an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://local.mysite.dev/',&#xA;        'fr' =&amp;gt; 'http://local.mysite.dev/fr/',&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'en' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/path-to-mysite/public/',&#xA;            'baseUrl' =&amp;gt; 'http://local.mysite.dev/',&#xA;         ),&#xA;        'fr' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/path-to-mysite/public/fr/',&#xA;            'baseUrl' =&amp;gt; 'http://local.mysite.dev/fr/',&#xA;        )&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, is that something I just append to any path(s) in my template given the current section/segment etc?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="125" LastEditDate="2015-08-24T18:07:19.720" LastActivityDate="2018-06-20T08:33:58.830" Title="Localized Environment Variables Based On siteUrl?" Tags="&lt;localization&gt;&lt;config&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11153" PostTypeId="2" ParentId="11148" CreationDate="2015-08-24T17:13:12.720" Score="1" Body="&lt;p&gt;You need to set an array of category IDs to your categories field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$featuredEntry-&amp;gt;setContentFromPost(array(&#xA;    'category' =&amp;gt; array(42)&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Query for it with an &lt;code&gt;craft.categories&lt;/code&gt; criteria model or if you're hardcoding it anyways you could just look it up in the CP:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;example.com/admin/categories/myCategoryGroup/&lt;strong&gt;42&lt;/strong&gt;-myCategoryHandle&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-24T17:13:12.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11154" PostTypeId="2" ParentId="11149" CreationDate="2015-08-24T17:22:44.843" Score="2" Body="&lt;p&gt;In theory, all plugins should be 5.3 compatible... but of course, it's up to the plugin developer to decide their own minimum requirements. 99% of publicly available plugins seem to be 5.3 compatible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The biggest &quot;gotcha&quot; between 5.3 and 5.4 is the &lt;strong&gt;simplified array notation.&lt;/strong&gt; In 5.4, you can declare arrays with simple square brackets (&lt;code&gt;[]&lt;/code&gt;), instead of the more verbose &lt;code&gt;array()&lt;/code&gt; syntax. That's one of the most notable changes between versions. Although, this doesn't seem to be the problem you're having. You'd at least see the plugin load, and kick up some sort of error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that you're testing the 5.3 vs 5.4 requirements on two separate servers? If so, you're probably running into an &lt;strong&gt;uppercase/lowercase&lt;/strong&gt; problem. This actually has nothing to do with the version of PHP... Some servers care about casing, while others don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this thread for a full explanation on casing, and why it might be causing your problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1537/45&quot;&gt;https://craftcms.stackexchange.com/a/1537/45&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-08-24T17:22:44.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11155" PostTypeId="2" ParentId="11144" CreationDate="2015-08-24T17:40:25.687" Score="3" Body="&lt;p&gt;Looks like this was a Redactor bug they fixed back in &lt;a href=&quot;http://imperavi.com/redactor/log&quot; rel=&quot;nofollow&quot;&gt;10.1&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The latest version of Craft (&lt;a href=&quot;http://buildwithcraft.com/updates#build2684&quot; rel=&quot;nofollow&quot;&gt;2.4.2684&lt;/a&gt;) is currently running Redactor 10.2.2, so make sure you're Craft installation is up-to-date.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-24T17:40:25.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11156" PostTypeId="2" ParentId="11150" CreationDate="2015-08-24T17:55:11.460" Score="2" Body="&lt;p&gt;The email's &quot;from&quot; field is set to the system email that is under &lt;code&gt;Settings-&amp;gt;Email&lt;/code&gt; in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email's &quot;reply to&quot; field is set to the &quot;fromEmail&quot; hidden input you set on the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done because many email servers will see that the &quot;from&quot; domain is different than the domain the email originated from and mark it as SPAM.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-24T17:55:11.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11157" PostTypeId="2" ParentId="11152" CreationDate="2015-08-24T18:07:53.273" Score="3" Body="&lt;p&gt;I also set up those two environment variables (totally custom variables, with the one specialty that they &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;are passed to the CP&lt;/a&gt;)&#xA;for my multilibgual sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have both &lt;code&gt;basePath&lt;/code&gt; and &lt;code&gt;baseUrl&lt;/code&gt; &lt;strong&gt;combined for all my locales&lt;/strong&gt;!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://local.mysite.dev/',&#xA;        'fr' =&amp;gt; 'http://local.mysite.dev/fr/',&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '/path-to-mysite/public/',&#xA;        'baseUrl' =&amp;gt; 'http://local.mysite.dev/',&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use these variables for two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Make assets from local asset sources available to all my locales. I set them absolutely, because relative paths don't&#xA;do it in this case, as the path to the assets' folder and the URL is a different one from &lt;a href=&quot;http://example.com/fr/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/fr/&lt;/a&gt; as it is from &lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Build absolute URLs to static files from my templates, e.g.&#xA;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{ craft.config.environmentVariables.baseUrl }}stylesheets/site.css&quot; /&amp;gt;&lt;/code&gt;&#xA;Both, the &lt;code&gt;url()&lt;/code&gt; function and the &lt;code&gt;siteUrl&lt;/code&gt; variable don't work in this case, they always return the site's URL including the locale part.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So it's basically just a way to build &lt;strong&gt;absolute&lt;/strong&gt; URLs to Craft assets and files for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm actually not totally sure how much of this could be solved with &lt;strong&gt;root relative&lt;/strong&gt; paths, but in my case I've also&#xA;at least one environment where the path from web root to the craft site is differently to my other environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For testing sites on mobile devices where I can't set virtual domains, I have an environment to access the site via the&#xA;local machine's IP address. As there's multiple sites on that machine, they are all in subfolders under web root.)&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-08-24T18:15:38.157" LastActivityDate="2015-08-24T18:15:38.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11159" PostTypeId="2" ParentId="11151" CreationDate="2015-08-24T21:20:20.090" Score="1" Body="&lt;p&gt;What you can always do in situations, where the default parameters are not enough,&#xA;is to &quot;collect&quot; element IDs and pass them to the &lt;code&gt;id&lt;/code&gt; param of a new criteria model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So loop through all categories and merge the category IDs matching you condition to an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topCategoriesIds = mainCategoriesIds|merge([category.id]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you're done, get your filtered categories from these IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.id(topCategoriesIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-24T21:20:20.090" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11160" PostTypeId="1" AcceptedAnswerId="11171" CreationDate="2015-08-24T21:20:42.020" Score="3" ViewCount="60" Body="&lt;p&gt;I am using Michael Rog's Calendar add-on with these params:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch craft.request.getSegment(2) %}&#xA;    {% case '' %}&#xA;        {% set thisCalendar  = '2,3' %}&#xA;        {% set calendarTitle = 'Full Calendar' %}&#xA;    {% case 'mts' %}&#xA;        {% set thisCalendar  = '2' %}&#xA;        {% set calendarTitle = 'MTS Calendar' %}&#xA;    {% case 'day-school' %}&#xA;        {% set thisCalendar  = '3' %}&#xA;        {% set calendarTitle = 'Day School Calendar' %}&#xA;{% endswitch %}&#xA;&#xA;{% set calendarParams = {&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: '+36 months',&#xA;    calendarId: thisCalendar&#xA;    } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The individual calendars are working and showing the correct entries but without a segment 2 I am only getting the events from Calendar ID 2 but not from ID 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% case '' %}&#xA;        {% set thisCalendar  = '3,2' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get events from Calendar ID 3 but not from ID 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get events from all calendars? Is comma separated the correct syntax? Should this be working?&lt;/p&gt;&#xA;" OwnerUserId="3337" LastEditorUserId="6007" LastEditDate="2018-06-09T04:37:46.277" LastActivityDate="2018-06-09T04:37:46.277" Title="How to show multiple calendars" Tags="&lt;calendar&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11161" PostTypeId="1" CreationDate="2015-08-24T22:48:22.530" Score="2" ViewCount="469" Body="&lt;p&gt;Normally I'm not working that much with craft and twig syntax, so first of all sorry if I'm not that much into that topic (normaly html,css,js,jquery).&#xA;There is one site which need so much time to load. There is much data to load but that can't be the reason that the server needs about 25s to respond.&#xA;Do you have any performance tips?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Live Example: &lt;a href=&quot;http://www.christlicher-gesundheitskongress.de/program.html&quot; rel=&quot;nofollow&quot;&gt;http://www.christlicher-gesundheitskongress.de/program.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably this snippet is responsible for the long load time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set z = 0 %}&#xA;            {% for program_block in craft.categories.group('program_block') %}&#xA;            &amp;lt;div class=&quot;program-block&quot; data-index=&quot;{{z}}&quot; id=&quot;{{z}}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;block-header&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ program_block.title }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;h5&amp;gt;&amp;lt;span&amp;gt;{{ program_block.program_date | date ('l, d. F') }} von &amp;lt;/span&amp;gt;{{ program_block.time_start | date('H:i')  }} - {{ program_block.time_end | date('H:i')  }}&amp;lt;/h5&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;block-body double&quot;&amp;gt;&#xA;                    {# {% cache %} #}&#xA;                    {% for program in craft.entries.section('program_point').order('program_number') %}&#xA;                        {% if program.block.first().title == program_block.title %}&#xA;                            &amp;lt;div class=&quot;seminar-box&quot;&amp;gt;&#xA;                                {% if program.type == &quot;seminar&quot; %}&amp;lt;a href=&quot;{{ program.url }}&quot;&amp;gt;{% endif %}&#xA;                                &amp;lt;h4&amp;gt;&amp;lt;span&amp;gt; {# {% if program.type != &quot;seminar&quot; %}#{% endif %} #} {{ program.program_number }}&amp;lt;/span&amp;gt;{{ program.title }}&amp;lt;/h4&amp;gt;&#xA;                                {% if program.short_description|length %}&#xA;                                    &amp;lt;p&amp;gt;{{ program.short_description }}&amp;lt;/p&amp;gt;&#xA;                                {% endif %}&#xA;                                {% if program.type == &quot;seminar&quot; %}&amp;lt;/a&amp;gt;{% endif %}&#xA;                                {% if program.program_referents|length %}&#xA;                                &amp;lt;span&amp;gt;&#xA;                                    {% set i = 1 %}&#xA;                                    {% for referent in program.program_referents %}&#xA;                                        &amp;lt;!-- &amp;lt;a href=&quot;{{ referent.url }}&quot; class=&quot;referent-link&quot;&amp;gt;--&amp;gt; {{ referent.referent_name }}&amp;lt;!--&amp;lt;/a&amp;gt;--&amp;gt; {% if i != program.program_referents|length %}// {% endif %}&#xA;                                    {% set i = i+1 %}&#xA;                                    {% endfor %}&#xA;                                &amp;lt;/span&amp;gt;&#xA;                                {% endif %}&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        {% endif %}&#xA;                    {% endfor %}&#xA;                    {# {% endcache %} #}&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;seminar-box fill_up&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% set z = z+1 %}&#xA;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4004" LastActivityDate="2015-09-09T06:29:18.737" Title="Server respond is very long (25s). Is there a way to optimize the perfomance?" Tags="&lt;server&gt;&lt;performance&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11163" PostTypeId="2" ParentId="11161" CreationDate="2015-08-24T23:32:42.647" Score="7" Body="&lt;p&gt;Let me try to turn this into a more valuable StackExchange for others who will find it, since the original poster apparently got help and solved his problem without participating here. We can see so on the linked site, which is now running as expected for Craft, quite rapidly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is suggest a less awkward way to approach his task. We can do that much more nicely due to Craft's actual abilities, and then there will be no need for index counters, full table scans of data, and so forth as in the original code. The site will then also be more efficient, offering something to the original question, while also having some convenient extra features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data involved is naturally hierarchic - Seminar 'plenums' with sessions within them. The sessions are run by speakers, whose information pages are linked. Speakers might be in more than one session, and it's possible that sessions would also be repeated in other plenums, so both should be independent data sets. By using Matrix variables, we can make it very easy to organize plenums, and provide per-plenum information such as times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus in Craft terms, we should have a Channel of plenums, a Channel of sessions, and a Channel of speakers. To give the ordering flexibility, own times etc., and ease of relations, the plenums channel should have a Matrix variable for sessions scheduling. The sessions channel can even more easily use an Entries variable to hold details of the speakers for each session. Otherwise, the channels will contain simple Craft types for each of their data fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a design will replace the originally posted code with something like the following, which is much more simple and direct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% foreach plenum in plenums %}&#xA;  ...print plenum fields information&#xA;  {% foreach session in plenum.sessions %}&#xA;    ...print general session fields information&#xA;    ...print plenum-session-specific information, such as location and times&#xA;    &amp;lt;a href=&quot;{{speaker.link}}&quot;&amp;gt;{{ speaker.speaker_name }}&amp;lt;/a&amp;gt; &#xA;     {% if not loop.last %}// {% endif %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that highly efficient database queries will eliminate table scans and index variables, with the Craft-Twig loop variable supporting clean formatting of single or multiple speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft control panel will let us just pull around sessions within plenums to reorder them, while entering  any changed times or places very easily. Simple variations on this design would allow us as easily to change speakers when necessary for instances of a session, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the sessions are only related to plenums, they can appear in multiple plenums just by adding them to the Matrix variable for each. Not much extra work would allow the Matrix variables to hold or over-ride date-times, locations, or even alternate speakers, etc., adding flexibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original poster's site presentation design was appreciated as quite nice for its type, and this picture should show that Craft makes an appropriate data and code design for it just as nice and clean.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2015-09-09T06:29:18.737" LastActivityDate="2015-09-09T06:29:18.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11164" PostTypeId="1" CreationDate="2015-08-24T23:57:03.993" Score="0" ViewCount="90" Body="&lt;p&gt;Im getting an expecting string given array error on a variable in my fieldtype. When output / dumped to the template it is a string. This only happens when used within matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trim function here is the specific line throwing the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings['colours'] = explode(',', str_replace(' ', '', trim($settings['colours'])));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;getInputHtml() &amp;amp; prepValue()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValue($value)&#xA;{&#xA;    $colour = new FruitStyle_PaletteModel();&#xA;&#xA;    if(is_array($value))&#xA;    {&#xA;        $colour-&amp;gt;hex = $value['hex'];&#xA;        $colour-&amp;gt;opacity = $value['opacity'];&#xA;    }&#xA;&#xA;    return $colour;&#xA;}&#xA;&#xA;public function getInputHtml($name, $value)&#xA;{&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJsResource('fruitstyle/js/FruitPalette.js');&#xA;    craft()-&amp;gt;templates-&amp;gt;includeCssResource('fruitstyle/css/palette.css');&#xA;    craft()-&amp;gt;templates-&amp;gt;includeCssResource('fruitstyle/fonts/fruiticons/style.css');&#xA;&#xA;    $id = craft()-&amp;gt;templates-&amp;gt;formatInputId($name);&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJs('new FruitPalette(&quot;'.craft()-&amp;gt;templates-&amp;gt;namespaceInputId($id).'&quot;);');&#xA;&#xA;    // String or JSON&#xA;    $settings = $this-&amp;gt;getSettings();&#xA;    if(filter_var($settings['colours'], FILTER_VALIDATE_URL))&#xA;    {&#xA;        $ch = curl_init();&#xA;        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);&#xA;        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);&#xA;        curl_setopt($ch, CURLOPT_URL, $settings['colours']);&#xA;        $colours = curl_exec($ch);&#xA;        curl_close($ch);&#xA;        $settings['colours'] = JsonHelper::decode($colours, true);&#xA;    }&#xA;    else&#xA;    {&#xA;        $settings['colours'] = explode(',', str_replace(' ', '', trim($settings['colours'])));&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('fruitstyle/_fieldtype/palette/input', array(&#xA;        'id' =&amp;gt; $id,&#xA;        'name' =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value,&#xA;        'settings' =&amp;gt; $settings,&#xA;        'specialOptions' =&amp;gt; $this-&amp;gt;_getSpecialOptions(),&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j29XG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j29XG.png&quot; alt=&quot;PHP Error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-08-25T02:10:01.887" Title="Array expecting string error when fieldtype is used within matrix" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11165" PostTypeId="2" ParentId="11164" CreationDate="2015-08-25T02:10:01.887" Score="2" Body="&lt;p&gt;It appears as though &lt;code&gt;$settings['colours']&lt;/code&gt; is an array... which you're then trying to trim and explode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you &lt;code&gt;var_dump($settings['colours'])&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s. Nice to see &quot;colours&quot; spelt &quot;correctly&quot; :)&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-08-25T02:10:01.887" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11166" PostTypeId="2" ParentId="1022" CreationDate="2015-08-25T02:54:27.747" Score="3" Body="&lt;p&gt;Doing this with &lt;code&gt;mod_geoip2&lt;/code&gt; on the server with a local geolocation database is definitely the best approach here, but if your not able to do that for whatever reason then an alternative is to use an API like &lt;a href=&quot;http://ipinfo.io&quot; rel=&quot;nofollow&quot;&gt;http://ipinfo.io&lt;/a&gt;. It returns lots of details for a given IP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ curl ipinfo.io&#xA;{&#xA;  &quot;ip&quot;: &quot;208.54.39.191&quot;,&#xA;  &quot;hostname&quot;: &quot;mbf2736d0.tmodns.net&quot;,&#xA;  &quot;city&quot;: &quot;Los Angeles&quot;,&#xA;  &quot;region&quot;: &quot;California&quot;,&#xA;  &quot;country&quot;: &quot;US&quot;,&#xA;  &quot;loc&quot;: &quot;34.0522,-118.2437&quot;,&#xA;  &quot;org&quot;: &quot;AS21928 T-Mobile USA, Inc.&quot;,&#xA;  &quot;postal&quot;: &quot;90013&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You just need the country though, so you can speed things up a tiny bit by requesting just that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ curl ipinfo.io/country&#xA;US&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can request this information for the current user and redirect them to a different URL if they're not on the correct one. Here's what the javascript code to do that would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.get('http://ipinfo.io/country', function(country) {&#xA;    var country_is_no = country.trim() == 'NO';&#xA;    if(country_is_no and document.location.pathname != '/no') {&#xA;        document.location = '/no';&#xA;    }&#xA;    if(!country_is_no &amp;amp;&amp;amp; document.location.pathname != '/en') {&#xA;        document.location = '/en';  &#xA;    }&#xA;}, &quot;jsonp&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That only allows you to have 2 pages though (/no, and /en). That might be fine for your purposes, but an alternative would be to have no and en subdomains, and keep the rest of the content in the same place, just like wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Wikipedia&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Wikipedia&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://no.wikipedia.org/wiki/Wikipedia&quot; rel=&quot;nofollow&quot;&gt;https://no.wikipedia.org/wiki/Wikipedia&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you were to setup the 2 subdomains then you could extract that with the following javascript, and then redirect based on that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var subdomain = document.location.hostname.split('.')[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4006" LastActivityDate="2015-08-25T02:54:27.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11167" PostTypeId="1" AcceptedAnswerId="11169" CreationDate="2015-08-25T03:09:58.723" Score="0" ViewCount="136" Body="&lt;p&gt;Im working on a school website where the client would like a global date that is the start and finish of all the classes. This part is easy as I have made a Global where you enter the Start and End dates for the semester. At the moment this is just a text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next challenge is to make it add days onto the start and end date depending on what day a class starts on.&#xA;So for example:&#xA;If I say the week starts on a Monday and set the starting date to the 20/10/2015. If the class is also on a Monday it will not change the date. But if the class is a Tuesday it will add +1 to the date making the starting date the 21st. (Wednesday +2, Thursday +3, Friday +4, Saturday, +5, Sunday +6) This would be easy except that if the day goes above how many days there are in a month. for example if the starting date is 28/10/2015 on Friday it would list as 32/10/2015 but would need to be changed to the 01/11/2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a way that I can write this? Would using the date field make this easier?&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:31:42.423" LastActivityDate="2017-05-09T23:31:42.423" Title="Date changing algorithm" Tags="&lt;datetime&gt;&lt;math&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11169" PostTypeId="2" ParentId="11167" CreationDate="2015-08-25T07:03:44.123" Score="1" Body="&lt;p&gt;Yes, a date field is a good idea. For the following example I'm using a date field &quot;startDate&quot; in a global set &quot;classes&quot;. And for the classes entries I set up a dropdown field &quot;weekday&quot; with values &quot;monday, thuesday, ...&quot; and localized labels &quot;Montag, Dienstag, ...&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date_modify.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date_modify&lt;/code&gt;&lt;/a&gt; filter does all the calculation for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set weekday = entry.weekday %}&#xA;{% set classDate = classes.startDate|date_modify(weekday) %}&#xA;&#xA;{{ classDate|date('l, F j, Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-25T07:03:44.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11170" PostTypeId="1" CreationDate="2015-08-25T10:05:45.073" Score="1" ViewCount="439" Body="&lt;p&gt;A user group cannot be given access to a plugin without the plugin having hasCpSection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to give anonymous access to the plugin's methods; is there not an option to have a plugin listed for user group permission allocation without it having an cp tab? Too many cp tabs cause a JS error - but that's another issue...&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="900" LastEditDate="2015-08-25T16:55:28.343" LastActivityDate="2018-10-09T16:01:34.963" Title="Cannot grant user group plugin permission without hasCpSection" Tags="&lt;plugin-development&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11171" PostTypeId="2" ParentId="11160" CreationDate="2015-08-25T10:28:38.950" Score="1" Body="&lt;p&gt;Posting comment as answer, since the suggested solution solved it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pass the IDs as an array instead of comma separated: &lt;code&gt;{% set thisCalendar = [3,2] %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-08-25T10:28:38.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11172" PostTypeId="2" ParentId="11151" CreationDate="2015-08-25T10:43:14.437" Score="1" Body="&lt;p&gt;Short answer: There is no way to apply this sort of logic to the &lt;code&gt;craft.categories&lt;/code&gt; query. The way I have set this up is good. It can be improved performance wise by wrapping the queries around a &lt;code&gt;{% cache %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Carl has pointed out in &lt;a href=&quot;https://craftcms.stackexchange.com/a/11159/176&quot;&gt;his answer&lt;/a&gt;, the matching categories could also be merged into an array and added to a new query, which could then be used for pagination etc.&lt;/p&gt;&#xA;" OwnerUserId="176" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-08-25T10:43:14.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11173" PostTypeId="1" CreationDate="2015-08-25T10:49:50.497" Score="2" ViewCount="850" Body="&lt;p&gt;I have a Craft-based website and need to make a complex multi-'page' form on one page. The form isn't related to any Craft Entries etc, and doesn't need to save the submitted data to Craft's database (it's sent to a different database).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having looked at a few form-related Craft plugins, I think I'll be best writing this from scratch. I'm experienced with PHP, but not Yii and I'm not quite sure how best to structure this within a page that will be generated by Craft (an Entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing I could write a plugin and a variable in it is used in the Craft template to generate the form. Given that, some questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Should I create a series of &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-start-forms.html&quot; rel=&quot;nofollow&quot;&gt;Yii forms&lt;/a&gt;, one per 'page' of the form, and use the one indicated by a hidden 'step' form field?&lt;/li&gt;&#xA;&lt;li&gt;Is there any issue with saving data to Yii sessions (for each form step's inputs) within a Craft site?&lt;/li&gt;&#xA;&lt;li&gt;I could have templates for the different form 'pages' in my plugin. How would I pass data from the form (fields, submitted data, error messages) to the template?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I guess I'm also looking for general responses of either &quot;This looks like a sensible route to explore&quot; or &quot;OMG don't go that way, there are monsters!&quot; :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I think I should be using the plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers&lt;/a&gt; to handle form submission, passing data to templates etc. Rather than having a plugin variable in a Craft Entry's template. Maybe I can integrate Yii forms with those Controllers?&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="3686" LastEditDate="2015-08-25T11:22:18.880" LastActivityDate="2015-08-25T17:49:34.073" Title="Multi-page form with Yii in a Craft site?" Tags="&lt;form&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11174" PostTypeId="1" CreationDate="2015-08-25T13:53:59.323" Score="4" ViewCount="4915" Body="&lt;p&gt;Quick preface - i'm a new to managing my own servers. I'm on Ubuntu 14.04 running Apache. I ran into some problems setting up Craft which i was hoping someone might be able to shed a bit of light on what i got wrong. I have a user with sudo privileges, lets say 'user1'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used a simple PHP script to find out what user PHP is running as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php echo exec('whoami'); ?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which came out as 'www-data'. In terminal as 'user1' i created a new group 'craftpermissions' and added 'user1' and 'www-data' to this group. I then set the group 'craftpermissions' as the owner of the following directories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/app/&#xA;/craft/config/&#xA;/craft/storage/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then set permissions on those three folders to 775 using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo chmod -R 775 /var/www/myvirtualhostaddress/craft/app/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when i visited &lt;code&gt;mydomainname.com/index.php/admin/&lt;/code&gt; i still got the error saying php could not write to the /config folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end i set permissions on the folder to 777 so i could crack on with installation and it worked fine, but i'd like to do it properly as i think 777 is a bit of a no-no? Or does it not matter too much if craft folder is one directory above my web root?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;code&gt;/craft/app&lt;/code&gt; everything is owned by craftpermissions except &lt;code&gt;..&lt;/code&gt; which is owned by the group created when i made user1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;drwxr-xr-x  7 user1 user1 4096 Aug 25 06:44 ..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;does this refer to the directory above it? When i run on /craft/storage/ it appears as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;drwxrwxrwx 3 user1 craftpermissions 4096 Aug 25 09:18 .&#xA;drwxr-xr-x 7 user1 user1       4096 Aug 25 06:44 ..&#xA;drwxr-xr-x 6 www-data   www-data         4096 Aug 25 09:19 runtime.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/craft/config&lt;/code&gt; appears as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;drwxrwxrwx 3 user1 craftpermissions 4096 Aug 25 09:19 .&#xA;drwxr-xr-x 7 user1 user1       4096 Aug 25 06:44 ..&#xA;-rwxrwxrwx 1 user1 craftpermissions  671 Aug 25 06:44 db.php&#xA;-rwxrwxrwx 1 user1 craftpermissions  220 Aug 25 06:44 general.php&#xA;-rw-r--r-- 1 www-data   www-data          255 Aug 25 09:19 license.key&#xA;drwxrwxrwx 2 user1 craftpermissions 4096 Aug 25 06:45 redactor&#xA;-rwxrwxrwx 1 user1 craftpermissions  844 Aug 25 06:44 routes.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3941" LastEditorUserId="22" LastEditDate="2017-05-09T23:30:21.250" LastActivityDate="2017-05-09T23:30:21.250" Title="Unix permissions for Craft" Tags="&lt;installation&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11175" PostTypeId="1" CreationDate="2015-08-25T14:35:57.377" Score="2" ViewCount="162" Body="&lt;p&gt;Does anyone know how to solve the problem of duplicate meta descriptions appearing when a category has multiple pages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category: Telephones&lt;/li&gt;&#xA;&lt;li&gt;Pages: 5 pages&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All 5 pages end up with the same meta description, titles and keywords. Only the content is changeable?&lt;/p&gt;&#xA;" OwnerUserId="4013" LastEditorUserId="45" LastEditDate="2016-08-13T02:58:35.353" LastActivityDate="2016-08-13T02:58:35.353" Title="Duplicate meta descriptions when category has multiple pages" Tags="&lt;meta&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11176" PostTypeId="1" AcceptedAnswerId="14392" CreationDate="2015-08-25T15:41:44.737" Score="4" ViewCount="325" Body="&lt;p&gt;I have a set of entries which each have 0 or more tags (no limit). For each entry, I am aiming to display 3 'related entries', related by the tags field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. If entry 1 is tagged with 'apples', 'bananas' and 'pears', then the first results returned would be entries with all 3 tags, followed by 2, followed by just one, then those with none of the tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I can't see anything in the documentation about ordering by relevance of the 'relatedTo' parameter.&lt;/p&gt;&#xA;" OwnerUserId="2314" LastEditorUserId="125" LastEditDate="2015-09-08T15:08:22.827" LastActivityDate="2016-03-30T15:17:08.150" Title="Is it possible to order related entries by relevance of tags?" Tags="&lt;entries&gt;&lt;relations&gt;&lt;tags&gt;&lt;sorting&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11178" PostTypeId="1" CreationDate="2015-08-25T16:45:39.207" Score="3" ViewCount="514" Body="&lt;p&gt;Maybe I'm going mad here, but I can't figure out how to get all entries which are in a certain category. &#xA;Following the syntax laid out here: &lt;a href=&quot;http://buildwithcraft.com/help/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/entries-related-to-category&lt;/a&gt;&#xA;you'd think something like this would work, but I get nothing:&lt;br&gt;&#xA;&lt;code&gt;{% for entry in craft.entries.relatedTo('Naming') %}&lt;/code&gt;&#xA;&lt;br&gt;&lt;br&gt;&#xA;'Naming' is my category, and I have several case study entries with that category attributed.&#xA;I also tried adding more params, like restricting it to just the case study section:&lt;br&gt;&#xA;&lt;code&gt;{% for entry in craft.entries.section('ourWork').relatedTo('Naming') %}&lt;/code&gt;&lt;br&gt;&lt;br&gt;&#xA;This would be outside the category page or related case study page btw, ie on the homepage. &lt;/p&gt;&#xA;" OwnerUserId="3890" LastActivityDate="2015-08-25T16:52:42.573" Title="Get all entries attributed with category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11179" PostTypeId="2" ParentId="11178" CreationDate="2015-08-25T16:52:42.573" Score="5" Body="&lt;p&gt;Found an answer to this here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/4132/3890&quot;&gt;https://craftcms.stackexchange.com/a/4132/3890&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing to note is when you're using &lt;code&gt;relatedTo&lt;/code&gt; you're not passing a slug, you're passing a whole object. So just &lt;code&gt;.relatedTo('category-name')&lt;/code&gt; won't work. &lt;/p&gt;&#xA;" OwnerUserId="3890" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-08-25T16:52:42.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11180" PostTypeId="2" ParentId="11173" CreationDate="2015-08-25T17:49:34.073" Score="2" Body="&lt;p&gt;I wouldn't worry going so far outside of Craft and using Yii's forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like all you need is a Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.  Use normal HTML &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt;s from  your template and have them post to your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controller&lt;/a&gt;.  Each step in the form can be another &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;action&lt;/a&gt; on the controller.  You can persist data between form steps by saving to Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpSessionService&quot; rel=&quot;nofollow&quot;&gt;HttpSessionService&lt;/a&gt;, which is just a thin wrapper for PHP's global &lt;code&gt;$_SESSION&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add($key, $value)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;get($key)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-25T17:49:34.073" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11181" PostTypeId="1" CreationDate="2015-08-25T18:48:45.993" Score="2" ViewCount="163" Body="&lt;p&gt;I am creating a site that has a list of events that I need to be able to sort by different fields. I know how to do it statically in my templates but I want to enable it in the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the example, each event will have three different sorting fields - 'Teacher', 'Country' and 'Event Date'. The initial order will be according to date but I want that the user will be able to choose from an option button a specific value (with all the available options of this field) and to see only events from a specific teacher or specific country.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any help on how to start such a thing. Again, I know how to create static sorting in the templates but not live one being done in the front-end...&lt;/p&gt;&#xA;" OwnerUserId="3777" LastActivityDate="2015-08-31T23:56:31.373" Title="Changing the frontend sorting according to different fields" Tags="&lt;frontend&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11182" PostTypeId="1" AcceptedAnswerId="11472" CreationDate="2015-08-26T01:22:57.740" Score="4" ViewCount="515" Body="&lt;p&gt;Looks like caching paginated content globally forces any following pages (p2,p3, etc) to just echo the same content as the first page. Using a regular &lt;code&gt;cache&lt;/code&gt; tag works as desired, but I don't want to cache the same content across all locales, nor generate new cache any time the same template is accessed through one of the several locales. Has anyone run into this? Is this a problem or am I confusing the functionality of the &lt;code&gt;cache globally&lt;/code&gt; tag?&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-09-15T10:45:00.850" Title="Troubleshooting paginated content cached globally" Tags="&lt;cache&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11183" PostTypeId="1" CreationDate="2015-08-26T02:22:20.520" Score="1" ViewCount="688" Body="&lt;p&gt;This is my first Craft site, I inherited it. I've manually set a link tag to my favicon in my templates/_layouts/_header.twig file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything else in that /dist/img folder renders fine - .png, .jpg, .gif. Everything inside the other /dist subdirs renders fine - /css, /js, /pdf... What am I missing? Going directly to the favicon.ico url, I get a blank page with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Unable to find the template â€œ_layoutâ€.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand the routing - but that feels like a red herring here anyway. I don't have any routes set up in the cms, and everything else in the /dist directory renders fine when I link directly to it. Thanks for any ideas.&lt;/p&gt;&#xA;" OwnerUserId="4015" LastActivityDate="2015-08-26T22:00:33.083" Title="favicon.ico throwing 404 TemplateLoader exception" Tags="&lt;error-message&gt;&lt;404&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11186" PostTypeId="1" AcceptedAnswerId="11187" CreationDate="2015-08-26T10:39:39.057" Score="2" ViewCount="330" Body="&lt;p&gt;I have a plugin using the onBeforeSaveEntry event. Is there a simple way to check if the entry being saved is a brand new entry i.e. Add New Entry or if it currently exists and is just being updated?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-08-26T11:41:39.877" Title="Check saved entry is a brand new entry" Tags="&lt;entries&gt;&lt;plugins&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11187" PostTypeId="2" ParentId="11186" CreationDate="2015-08-26T10:44:45.710" Score="4" Body="&lt;p&gt;You should be able to check for this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($params['isNewEntry'])&#xA;{&#xA; // The entry is new&#xA;{&#xA;else&#xA;{&#xA; // The entry is being updated&#xA;{&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See here in the docs: &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-08-26T11:41:39.877" LastActivityDate="2015-08-26T11:41:39.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11189" PostTypeId="1" AcceptedAnswerId="11190" CreationDate="2015-08-26T11:37:48.083" Score="3" ViewCount="323" Body="&lt;p&gt;Not sure on the gitignore pattern I need to add to ignore craft's image transforms it automatically generates. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3560" LastActivityDate="2015-08-26T12:05:34.553" Title="Gitignore pattern to remove image transforms" Tags="&lt;image-transforms&gt;&lt;git&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11190" PostTypeId="2" ParentId="11189" CreationDate="2015-08-26T12:05:34.553" Score="4" Body="&lt;p&gt;Those image transform folders all start with an underscore. The following pattern should work, if you don't set up underscore folders yourself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public/assets/**/[_]*/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-26T12:05:34.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11191" PostTypeId="1" AcceptedAnswerId="11192" CreationDate="2015-08-26T12:47:57.247" Score="2" ViewCount="1723" Body="&lt;p&gt;I guess this isn't possible as it would mean the content is essentially a Global, but I would like to be able use a block from a matrix field from another entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I have a parent page with a block of content, which I would like to replicate on all of it's child pages. I don't want to make the user repeat it on each child page, but I don't want to hardcode it. &lt;/p&gt;&#xA;" OwnerUserId="3890" LastActivityDate="2015-08-26T13:08:55.767" Title="Possible to get content block from another entry?" Tags="&lt;matrix&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11192" PostTypeId="2" ParentId="11191" CreationDate="2015-08-26T13:08:55.767" Score="4" Body="&lt;p&gt;You can query for that parent page's entry model with a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;new ElementCriteriaModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainEntry = craft.entries.id(100).first() %}&#xA;&#xA;{% if mainEntry %}&#xA;    {% set matrixField = mainEntry.matrixFieldHandle %}&#xA;    {% set firstContentBlock = matrixField.type('content').first() %}&#xA;&#xA;    {% if firstContentBlock %}&#xA;        {{ firstContentBlock.myRichTextFieldHandle }}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of using the entry's ID as the link to that entry, you can also use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;other parameters&lt;/a&gt; to query for the entry model. Here's an example using slug and section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainEntry = craft.entries.section('news').slug('main-news').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-26T13:08:55.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11194" PostTypeId="1" AcceptedAnswerId="11195" CreationDate="2015-08-26T15:20:06.107" Score="1" ViewCount="272" Body="&lt;p&gt;I'll give you my specific use-case here and then see if it might also be more generally applicable in other scenarios: We have a new Craft PRO site running happily, and in our &lt;code&gt;/templates/&lt;/code&gt; we have a &lt;code&gt;_layout.html&lt;/code&gt; file that every other template then uses and extends. That &lt;code&gt;_layout&lt;/code&gt; includes common &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; content, main navigation, footers, etc. Nothing surprising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on one sub-page we are displaying Google Maps using various calls to Google's Mapping API. One requirement for the Google Maps, however, is that the  tag trigger Google's JS when the page loads and unloads:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;body onload=&quot;load()&quot; onunload=&quot;GUnload()&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently that &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag is in &lt;code&gt;_layout.html&lt;/code&gt; so that it can be consumed by the mapping page. But for all other pages it's superfluous, and throws a minor error in the JS console when you inspect the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Is there a way to write a page template so that it &lt;code&gt;_extends&lt;/code&gt; another base template but also overwrites just a small portion of it? For instance, could I remove the &lt;code&gt;onload&lt;/code&gt; / &lt;code&gt;onunload&lt;/code&gt; values from _layout.html and somehow have my mapping page INSERT them back into the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag for just that page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a more elegant way to have my mapping page draw upon &lt;code&gt;_layout.html&lt;/code&gt; but keep the &lt;code&gt;onload&lt;/code&gt; / &lt;code&gt;onunload&lt;/code&gt; calls isolated to just that page? Or maybe have _layout.html look for what page is calling it and then return one &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag for the mapping and another &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag for all other pages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Google Maps API makes it pretty clear that this JS function be called at the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; level, and not just on a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="125" LastEditDate="2015-08-26T17:02:11.880" LastActivityDate="2015-08-26T17:02:11.880" Title="Override a portion of an extends template" Tags="&lt;templating&gt;&lt;extends&gt;&lt;google-maps&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11195" PostTypeId="2" ParentId="11194" CreationDate="2015-08-26T16:33:02.910" Score="3" Body="&lt;p&gt;You could define a variable in you child template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyAttributes = 'onload=&quot;load()&quot; onunload=&quot;GUnload()&quot;' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then output the value in your parent _layout.html template. Use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/defined.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;is defined&lt;/code&gt;&lt;/a&gt; test, so that not every template extending this file has to have that variable defined. I'm using &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary syntax&lt;/a&gt; here, to keep the code nice and lean:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body {{ bodyAttributes is defined ? bodyAttributes : '' }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I generally like to have as few logic in my Twig output tags as possible (in particular when they output classes and attributes to already cluttered HTML tags), I would write that code like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyAttributes = bodyAttributes is defined ? bodyAttributes %}&#xA;&#xA;&amp;lt;body {{ bodyAttributes }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-26T16:33:02.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11196" PostTypeId="1" CreationDate="2015-08-26T17:03:01.710" Score="0" ViewCount="1780" Body="&lt;p&gt;I'm getting confused with how to submit forms to a plugin controller as shown briefly &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;in the docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm making a multi-page form, which saves the data on each page to the session, sending it elsewhere at the end of the process. None of the data is related to things (Entries, etc) in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't understand how to do the:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Display form&lt;/li&gt;&#xA;&lt;li&gt;POST form&lt;/li&gt;&#xA;&lt;li&gt;Either:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Validation passes, so save the data and redirect to the next page&lt;/li&gt;&#xA;&lt;li&gt;Or, fail validation and display the same form again&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's say the first page asks for firstname and surname, and the second for date of birth. I have a model per form page, for validation, so there's &lt;code&gt;plugins/myform/models/myForm_NameModel.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyForm_NameModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'firstname' =&amp;gt; array(AttributeType::Name, 'maxLength' =&amp;gt; 100),&#xA;            'surname' =&amp;gt; array(AttributeType::Name, 'maxLength' =&amp;gt; 100),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'll have a similar model for the form on the date of birth page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I have &lt;code&gt;plugins/myform/controllers/myForm_FormController.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyForm_FormController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    // Display name form.&#xA;    public function actionName()&#xA;    {&#xA;        $this-&amp;gt;renderTemplate('myForm/forms/name');&#xA;    }&#xA;&#xA;    public function actionSaveName()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;        $nameModel = MyForm_NameModel::populateModel($post);&#xA;&#xA;        if ($nameModel-&amp;gt;validate()) {&#xA;            // TODO: Store in session.&#xA;            $this-&amp;gt;redirectToPostedUrl();&#xA;        }&#xA;        else&#xA;        {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError('Error!');&#xA;            craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                'nameModel' =&amp;gt; $nameModel&#xA;            ));&#xA;        }&#xA;    }&#xA;&#xA;    // Display date of birth form.&#xA;    public function actionDob()&#xA;    {&#xA;        $this-&amp;gt;renderTemplate('myForm/forms/dob');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in &lt;code&gt;plugins/myform/templates/forms/name.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myForm/form/name&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;myForm/form/dob&quot;&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;First name: &amp;lt;input type=&quot;text&quot; name=&quot;firstname&quot; value=&quot;{% if nameModel is defined %}{{ nameModel.firstname }}{% endif %}&quot;&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;Surname: &amp;lt;input type=&quot;text&quot; name=&quot;surname&quot; value=&quot;{% if nameModel is defined %}{{ nameModel.surname }}{% endif %}&quot;&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm missing something at the moment because all I get is the name form, and submitting it simply refreshes the page; no errors, no submitted values displayed. I think I'm confused by the &lt;code&gt;action&lt;/code&gt; and &lt;code&gt;redirect&lt;/code&gt; in the form template, and exactly what the controller actions should be doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also not sure if using &lt;code&gt;AttributeType::foo&lt;/code&gt; is correct when defining these models, seeing as they're not things that will be saved in the database?&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="3686" LastEditDate="2015-08-26T21:25:22.197" LastActivityDate="2015-11-24T22:12:59.543" Title="Plugin Controller actions for entering data and redisplaying form or redirecting" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11197" PostTypeId="1" CreationDate="2015-08-26T20:48:52.107" Score="2" ViewCount="172" Body="&lt;p&gt;Using the Sprout Email plugin. The only notification triggers that are working are related to users. Any notifications with triggers related to entries (created, updated, deleted) do not send an email, not even a test email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft Client 2.4.2688.&lt;/p&gt;&#xA;" OwnerUserId="2282" LastEditorUserId="2282" LastEditDate="2015-08-26T21:34:01.290" LastActivityDate="2015-09-02T05:04:03.150" Title="Entry saved trigger not working" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11198" PostTypeId="2" ParentId="11196" CreationDate="2015-08-26T21:12:35.487" Score="1" Body="&lt;p&gt;I have something working, although I'm not sure it's the &quot;correct&quot; way of doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got rid of the &lt;code&gt;actionSaveName()&lt;/code&gt; method and my &lt;code&gt;actionName()&lt;/code&gt; method in the Controller is now like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionName()&#xA;{   &#xA;    $templateVars = array();&#xA;&#xA;    if (craft()-&amp;gt;request-&amp;gt;isPostRequest())&#xA;    {&#xA;        // The form was submitted.&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;        $nameModel = MyForm_NameModel::populateModel($post);&#xA;&#xA;        if ($nameModel-&amp;gt;validate()) {&#xA;            // Successfully posted the name.&#xA;            // TODO: Store in session.&#xA;            $this-&amp;gt;redirectToPostedUrl();&#xA;        }&#xA;        else&#xA;        {&#xA;            // Something was wrong with the submitted names.&#xA;            $templateVars['errors'] = $nameModel-&amp;gt;getErrors();&#xA;            $templateVars['nameModel'] = $nameModel;&#xA;        }&#xA;    }&#xA;&#xA;    // Either the first time viewing the form, or there were errors.&#xA;    $this-&amp;gt;renderTemplate('myForm/forms/dob', $templateVars);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then &lt;code&gt;plugins/myform/templates/forms/name.html&lt;/code&gt; is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myForm/form/name&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ actionUrl('myForm/form/dob') }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- Just a quick example of error output. ---&amp;gt;&#xA;    {% if errors is defined %}&#xA;        {% if errors.firstname is defined %}&#xA;            {{ errors.firstname[0] }}&#xA;        {% endif %}&#xA;        {% if errors.surname is defined %}&#xA;            {{ errors.surname[0] }}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;p&amp;gt;First name: &amp;lt;input type=&quot;text&quot; name=&quot;firstname&quot; value=&quot;{% if nameModel is defined %}{{ nameModel.firstname }}{% endif %}&quot;&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;Surname: &amp;lt;input type=&quot;text&quot; name=&quot;surname&quot; value=&quot;{% if nameModel is defined %}{{ nameModel.surname }}{% endif %}&quot;&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to work fine but feels wrong in a few little ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The hidden &lt;code&gt;action&lt;/code&gt; input is ignored; I can put anything in that and nothing changes; I really don't understand how that is supposed to be used.&lt;/li&gt;&#xA;&lt;li&gt;If the submission is successful the URL redirected to is like &lt;code&gt;/index.php?p=actions/myForm/form/dob&lt;/code&gt; rather than &lt;code&gt;/actions/myForm/dob&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Mainly, that it feels quite different from the description in &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers&lt;/a&gt; .&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-08-26T21:12:35.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11199" PostTypeId="2" ParentId="11183" CreationDate="2015-08-26T22:00:33.083" Score="2" Body="&lt;p&gt;I don't think you can open a .ico file with the browser directly, that's why the request 404s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's two ways to make it do its thing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;simply place it in the web root, e.g. public/favicon.ico&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;use this link tag in your document head: &lt;code&gt;&amp;lt;link rel=&quot;icon&quot; href=&quot;{{ url('dist/img/favicon.ico') }}&quot; type=&quot;image/x-icon&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-26T22:00:33.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11200" PostTypeId="2" ParentId="11170" CreationDate="2015-08-26T22:41:31.933" Score="2" Body="&lt;p&gt;The only point of those permissions is to determine whether the user has access to the plugins’ sections, so it would be pretty pointless to show the permissions for plugins that don’t have sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion here is probably just in the wording of the permissions. “Access [Plugin]” isn’t very clear on which aspect of the plugin you’re granting access to. So maybe we should change that to “Access [Plugin]’s CP section” or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a plugin that offers functionality that warrants user permissions, register your own custom user permissions using the &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/hooks-reference.html#registeruserpermissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;registerUserPermissions hook&lt;/a&gt;, and verify that the user has those permissions using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserSessionService#checkPermission-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft()-&gt;userSession-&gt;checkPermission()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="142" LastEditDate="2018-10-09T16:01:34.963" LastActivityDate="2018-10-09T16:01:34.963" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11201" PostTypeId="1" AcceptedAnswerId="11204" CreationDate="2015-08-26T22:52:45.700" Score="2" ViewCount="310" Body="&lt;p&gt;I've been trying to build a category filter. I managed to make my buttons respond with categories but the returned entries on the page stay the same. So when I click one of the links &quot;/?category=koop&quot; gets added to the URL, but my entries don't respond upon that URL. I do have added the categories in the CP and assigned them to my entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code of my filters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('offerCategory') is not null %}&#xA;&#xA;    {% set offerCategory = craft.categories.slug(craft.request.getParam('offerCategory')) %}&#xA;    {% set offers = craft.entries.section('offers').relatedTo(offerCategory).find() %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set offers = craft.entries.section('offers').find() %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my button list&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for offerCategory in craft.categories.group('offerTypes').find() %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a class=&quot;mart-button&quot; href=&quot;{{craft.request.url}}/?category={{ offerCategory.slug }}&quot;&amp;gt;{{ offerCategory.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm quite new to Craft. One of the resources I'm using to build this is: &lt;a href=&quot;http://craftcookbook.net/recipes/197&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/197&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows what I'm overseeing, thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2015-08-27T03:50:51.033" Title="Category filter returning all entries" Tags="&lt;categories&gt;&lt;relations&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11203" PostTypeId="1" CreationDate="2015-08-26T23:52:47.803" Score="0" ViewCount="64" Body="&lt;p&gt;I have an ongoing issue with the admin. It seems to stop responding periodically. For example, I just created a new section in a site I am developing and hit save, I get spinner and it just sits there and doesn't respond. I look on the server and there is no activity. There are no javascript errors. If I reload the page the details have saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a recent version of Chrome on Windows 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to happen maybe every 1 out of 10 admin setting type pages&lt;/p&gt;&#xA;" OwnerUserId="3673" LastActivityDate="2015-08-26T23:52:47.803" Title="Admin not responding" Tags="&lt;admin&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11204" PostTypeId="2" ParentId="11201" CreationDate="2015-08-27T03:50:51.033" Score="3" Body="&lt;p&gt;I suggest changing the couple places where you use getParam('offerCategory') to getParam('category') so it matches the parameter set in the URL. &lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2015-08-27T03:50:51.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11205" PostTypeId="2" ParentId="11145" CreationDate="2015-08-27T07:00:42.007" Score="1" Body="&lt;p&gt;I cleared all caches and updated file index, and now everything runs smooth. No idea why, but it fixed the problem.&lt;/p&gt;&#xA;" OwnerUserId="94" LastActivityDate="2015-08-27T07:00:42.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11206" PostTypeId="2" ParentId="5415" CreationDate="2015-08-27T10:17:49.960" Score="4" Body="&lt;p&gt;I kept bumping into the same kind of issue. Even when I applied a fix mentioned here or in another topic. After a while the same issue would arise again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What finally did the trick for me - in MAMP, was to add additional parameters to the host-file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MAMP, select the desired host. On the right side choose the Extended tab. Where it says 'Additional parameters for ' add this line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;AddHandler fastcgi-script .fcgi&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks a lot like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4661/fastcgi-error-when-accessing-a-local-development-site-using-mamp-pro&quot;&gt;the solution mentioned here&lt;/a&gt;, but for some reason it didn't stick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Restart server (in later versions MAMP restarts itself) and you should be good to go! &lt;/p&gt;&#xA;" OwnerUserId="282" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-08-27T10:17:49.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11207" PostTypeId="1" AcceptedAnswerId="11210" CreationDate="2015-08-27T11:13:13.950" Score="1" ViewCount="295" Body="&lt;p&gt;I have a structure that I am using for a schedule, it has 1 entry per day (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is only show the 3 days from the current day. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e if today is Thursday, it will show the Thursday, Friday &amp;amp; Saturday entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the following to control the offset which works great. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('schedule').offset(now|date('w')).limit(3).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is, when I get to Friday or Saturday it wont show Sunday because that is the first entry of the structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway I can have it loop around to start the list of entries again?&lt;/p&gt;&#xA;" OwnerUserId="2196" LastActivityDate="2015-08-27T14:23:53.760" Title="Repeat entries but starting from offset" Tags="&lt;entries&gt;&lt;structure&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11208" PostTypeId="1" AcceptedAnswerId="11211" CreationDate="2015-08-27T11:21:38.937" Score="3" ViewCount="109" Body="&lt;p&gt;So this is just a question to see if something is actually doable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you double click an asset, you get a little modal opening where you can see see custom field attached to said asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be possible (plugin work I'm guessing) to open this model as a full publish form like entries have..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering... :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-09-02T13:55:15.877" Title="Editing assets custom fields in a full page publish form" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11210" PostTypeId="2" ParentId="11207" CreationDate="2015-08-27T14:18:40.063" Score="2" Body="&lt;p&gt;You can't do this with the criteria parameters offset and limit. I would suggest to first get all the IDs of your section and then use Twig's handy &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/cycle.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cycle&lt;/code&gt;&lt;/a&gt; function to get those entry IDs you're interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That function starts to read an array from the beginning again, when it reaches it end, so that's exacly what you need here. So when you want to get the 8th element of an array of length 7, it returns the first element (monday)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first element / ID of your array is in position 0, so I sustracted 1 from the week day number before passing it to the &lt;code&gt;cycle&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allIds = craft.entries.section('schedule').ids() %}&#xA;{% set nextIds = [] %}&#xA;&#xA;{% set start = now|date('w') - 1 %}&#xA;{% set end = start + 2 %}&#xA;&#xA;{% for i in start..end %}&#xA;    {% set id = cycle(allIds, i) %}&#xA;    {% set nextIds = nextIds|merge([id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.id(nextIds).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-08-27T14:23:53.760" LastActivityDate="2015-08-27T14:23:53.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11211" PostTypeId="2" ParentId="11208" CreationDate="2015-08-27T14:33:49.090" Score="1" Body="&lt;p&gt;Sure, this should be possible from a plugin. But you could also suggest this as a new core feature on the &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;Craft Feedback&lt;/a&gt; page. I'd definitly vote for this! ;)&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-27T14:33:49.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11213" PostTypeId="1" AcceptedAnswerId="11214" CreationDate="2015-08-27T15:41:06.037" Score="1" ViewCount="1195" Body="&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;&#xA;        'journal/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['id' =&amp;gt; $entryId, 'section'=&amp;gt;'journal'],&#xA;                'first' =&amp;gt; true,&#xA;                'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                    $nextEntry = $entry-&amp;gt;getNextSibling();&#xA;                    // also tried getNext()&#xA;&#xA;                    $upNext = [];&#xA;                    $upNext[&quot;title&quot;] = $nextEntry-&amp;gt;title;&#xA;                    // errs out here ...&#xA;                }&#xA;            ];&#xA;        }&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm missing something obvious, but how do I get the next sibling of an entry using Element API?  Would it be easier/better to pass both the current entry ID and the next entry ID (which I have available) into the criteria to make it easier to grab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4019" LastActivityDate="2015-08-27T18:54:44.423" Title="Using Element API, how do I get the next entry?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11214" PostTypeId="2" ParentId="11213" CreationDate="2015-08-27T18:01:08.210" Score="3" Body="&lt;p&gt;Depends on what you mean by “next”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the entry is within a Structure section and you want whatever entry is positioned after it, you’d use &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getNextSibling-detail&quot; rel=&quot;nofollow&quot;&gt;getNextSibling()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$nextSibling = $entry-&amp;gt;getNextSibling();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise you want &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getNext-detail&quot; rel=&quot;nofollow&quot;&gt;getNext()&lt;/a&gt;. But you need to keep in mind that &lt;em&gt;which&lt;/em&gt; entry is next can vary in infinite ways, so you really need to supply that &lt;code&gt;$criteria&lt;/code&gt; argument here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of the &lt;code&gt;$criteria&lt;/code&gt; argument is to define a collection of entries in a specific order, in which &lt;code&gt;$entry&lt;/code&gt; is one of them, and Craft uses that to determine which entries come immediately before and after it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your example code shows that you are returning Journal entries, so I’ll assume that you want &lt;code&gt;$nextEntry&lt;/code&gt; to be the journal entry that was written &lt;em&gt;after&lt;/em&gt; &lt;code&gt;$entry&lt;/code&gt; – so the entries should be sorted in chronological order. If that’s the case, here’s the code you should use:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$nextEntry = $entry-&amp;gt;getNext([&#xA;    'section' =&amp;gt; 'journal',&#xA;    'order' =&amp;gt; 'postDate asc'&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as what you can pass into that argument, all of the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#parameters&quot; rel=&quot;nofollow&quot;&gt;craft.entries parameters&lt;/a&gt; are fair game here, with the exact same value syntax. Just keep in mind that it’s PHP code and not Twig, so instead of something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;.postDate('&amp;lt;= 2013-06-04')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it would be:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'postDate' =&amp;gt; '&amp;lt;= 2013-06-04',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also pass in an actual &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; object, with its values set ahead of time:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'journal';&#xA;$criteria-&amp;gt;postDate = '&amp;lt;= 2013-06-04';&#xA;$criteria-&amp;gt;order = 'postDate asc';&#xA;&#xA;$nextEntry = $entry-&amp;gt;getNext($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-08-27T18:54:44.423" LastActivityDate="2015-08-27T18:54:44.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11215" PostTypeId="1" AcceptedAnswerId="12115" CreationDate="2015-08-27T18:40:18.640" Score="1" ViewCount="780" Body="&lt;p&gt;I'm trying to build a category filter on a page that lists houses that are for sale. The idea of the filter is to make it possible to select houses which, for example, are for sale or rent, have a certain amount of rooms, a minimum/maximum price and eventually a search option to search at location, postal code or street address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first built one filter, which filters if a house is for sale or for rent. This filter works with two anchor buttons in a list. I now want to add the next filter, which is the amount of rooms. This filter should be a dropdown (a select tag with options in it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got both filters to work, but I want them to stack upon each other. So when the houses that are for sale are being shown and the user clicks on houses with 4+ rooms, it shows the houses that are for sale AND have 4+ rooms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I came up with so far&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter for sale/rent houses&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;button-group round&quot;&amp;gt;&#xA; {% for offerCategory in craft.categories.group('offerTypes').find() %}&#xA;  &amp;lt;li&amp;gt;&#xA;   &amp;lt;a class=&quot;mart-button&quot; href=&quot;{{craft.request.url}}/?category={{ offerCategory.slug }}&quot;&amp;gt;{{ offerCategory.title }}&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA; {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The filter for the amount of rooms&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select onChange=&quot;window.location.href=this.value&quot;&amp;gt;&#xA; {% for offerRooms in craft.categories.group('offerRoomTypes').find() %}&#xA;  &amp;lt;option value=&quot;{{craft.request.url}}/?category={{ offerRooms.slug }}&quot; name&amp;gt;{{ offerRooms.title }}&amp;lt;/option&amp;gt;&#xA; {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the rest&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('category') is not null %}&#xA;&#xA; {% set offerCategory = craft.categories.slug(craft.request.getParam('category')) %}&#xA; {% set offerRooms = craft.categories.slug(craft.request.getParam('category')) %}&#xA;&#xA; {% set offers = craft.entries({&#xA;    section: 'offers',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: offerCategory },&#xA;        { targetElement: offerRooms }&#xA;    ]&#xA; }) %}&#xA;&#xA;{% else %}&#xA;&#xA; {% set offers = craft.entries.section('offers').find() %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The URL that's being fetched is now: .../?category=forsale and when selecting rooms .../?category=4rooms. What I want to achieve is something like .../?category=forsale,4rooms (I'm nog sure if that's the right way). &#xA;If someone also can tell me directly how the search should be implemented that's welcome as well ;). Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2015-10-27T03:40:58.947" Title="Filtering entries by multiple categories with multiple filters" Tags="&lt;entries&gt;&lt;categories&gt;&lt;filter&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11216" PostTypeId="1" AcceptedAnswerId="11217" CreationDate="2015-08-27T21:59:37.913" Score="3" ViewCount="72" Body="&lt;p&gt;I'm trying to bind to the onEditionChange event with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('onEditionChange', function (Event $event) {&#xA;    craft()-&amp;gt;womb-&amp;gt;sendEvent($event);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, i'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined offset: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seems it expects an dot in there. Is there another way to bind to this event?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-08-27T22:04:40.463" Title="Getting PHP error when trying to bind to onEditionChange event" Tags="&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11217" PostTypeId="2" ParentId="11216" CreationDate="2015-08-27T22:04:40.463" Score="2" Body="&lt;p&gt;Because that particular event is raised from &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/behaviors/AppBehavior&quot; rel=&quot;nofollow&quot;&gt;AppBehavior&lt;/a&gt; (and therefore &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp&quot; rel=&quot;nofollow&quot;&gt;WebApp&lt;/a&gt;), it doesn't follow the same &lt;code&gt;component.eventName&lt;/code&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;syntax&lt;/a&gt; that the other Craft events use and you can't use &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp#on-detail&quot; rel=&quot;nofollow&quot;&gt;craft-&gt;on()&lt;/a&gt; to register to listen to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can register to listen to it through the traditional &lt;a href=&quot;http://www.yiiframework.com/wiki/327/events-explained&quot; rel=&quot;nofollow&quot;&gt;Yii method&lt;/a&gt;, though.  This should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;onEditionChange = function (Event $event) {&#xA;    craft()-&amp;gt;womb-&amp;gt;sendEvent($event);&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-27T22:04:40.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11218" PostTypeId="1" CreationDate="2015-08-28T09:13:08.437" Score="1" ViewCount="168" Body="&lt;p&gt;we're using the Dukt Twitter plugin 0.9.25 and it works fine with calling the user's timeline:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set tweets = craft.twitter.get('statuses/user_timeline', {count:1}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If we request any other data like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set tweets = craft.twitter.get('search/tweets', {q:'#craftcms',}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we're receiving two tweets which are empty. Anyone else having these problems and found a solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Lars&lt;/p&gt;&#xA;" OwnerUserId="4020" LastActivityDate="2015-10-23T13:37:11.987" Title="Dukt Twitter Plugin, problem with &quot;search/tweets&quot; or request to Twitter REST API" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11219" PostTypeId="1" CreationDate="2015-08-28T12:08:54.080" Score="1" ViewCount="343" Body="&lt;p&gt;I want to change the title in the index of an custom element.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTableAttributeHtml(BaseElementModel $element, $attribute)&#xA;{&#xA;    switch ($attribute)&#xA;    {&#xA;        case 'title' :&#xA;        {&#xA;            return $element-&amp;gt;attribute . 'blabla';&#xA;        }&#xA;&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But whatever I try, the title field didn't change. Other fields are no problem.&#xA;How can i do this?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2016-11-23T16:23:44.943" LastActivityDate="2016-11-23T16:23:44.943" Title="Change custom element Index title via getTableAttributeHtml?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;index&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11220" PostTypeId="1" CreationDate="2015-08-28T12:41:10.437" Score="1" ViewCount="1114" Body="&lt;p&gt;Are there any LMS (Learning Management System) solutions that can integrate easily into Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I am looking to create a site similar to Lynda.com (not in subject matter, but in functionality).  I.e., a site that offers courses, with those courses broken down into chapters and individual lessons.  Each course will feature a combination of a video and an article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas of how to do this with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="2309" LastActivityDate="2019-04-01T17:25:45.843" Title="LMS and Craft CMS" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11221" PostTypeId="2" ParentId="11220" CreationDate="2015-08-28T13:20:57.380" Score="4" Body="&lt;p&gt;Go to themeforest.  Grab this template &lt;a href=&quot;http://themeforest.net/item/learning-app-learning-management-system-template/10759166&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://themeforest.net/item/learning-app-learning-management-system-template/10759166&lt;/a&gt;.  You might have to add the article function, but you can just suck their blog in and turn it into an article. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turn it into programatic Craft/twig templates.  Challenging, but fun.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will want &lt;a href=&quot;https://dukt.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net&lt;/a&gt; video plugin if you want to see all the available videos in your control panel, otherwise there are generic, free plugins that will allow you to pull outside video in.  If you want to stream your own video, then you will know how to pull an RTMP or HTML5 feed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to have quizzes, &lt;a href=&quot;http://barrelstrengthdesign.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://barrelstrengthdesign.com&lt;/a&gt; has a forms plugin that will handle this quickly.  If time is not money, you can make your own plugin to handle that functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to publish a certificate of completion after somebody completes a course &lt;a href=&quot;https://printmaker.docs.topshelfcraft.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://printmaker.docs.topshelfcraft.com&lt;/a&gt; is a plugin that prints from html to pdf - so you design the quiz in a form, validate it as they take the quiz, and if they pass you spit out a certificate.  Again, if time is money, this is your solution, if you have all the time in the world, you can create your own custom plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BAM. Fini.&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="45" LastEditDate="2019-04-01T17:25:45.843" LastActivityDate="2019-04-01T17:25:45.843" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11222" PostTypeId="1" CreationDate="2015-08-28T13:29:39.617" Score="1" ViewCount="253" Body="&lt;p&gt;I'm using the element API to get the url of an asset from angular with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'image' =&amp;gt; $entry-&amp;gt;playerImage-&amp;gt;first()-&amp;gt;getUrl(&quot;square&quot;), &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Problem is until i visit that image in the browser the url doesn't work, does someone know of a nice way of dealing with this?&lt;/p&gt;&#xA;" OwnerUserId="3965" LastActivityDate="2015-09-08T12:16:22.607" Title="Avoiding initial load for image transform" Tags="&lt;image-transforms&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11223" PostTypeId="1" AcceptedAnswerId="11224" CreationDate="2015-08-28T14:52:08.250" Score="4" ViewCount="1140" Body="&lt;p&gt;I have a plugin Controller that accepts a POSTed form, including an uploaded file. If I make an Assets Source I can successfully save the file into its folder like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$file = UploadedFile::getInstanceByName('myFieldName');&#xA;&#xA;$folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'sourceId' =&amp;gt; 3, // My Asset Source's ID.&#xA;));&#xA;&#xA;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $file-&amp;gt;getTempName(), // Local path to file.&#xA;    $file-&amp;gt;getName(), // Name file should be given when saved.&#xA;    $folder-&amp;gt;id,&#xA;    AssetConflictResolution::KeepBoth&#xA;);&#xA;&#xA;if ($response-&amp;gt;isSuccess()) {&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to upload the file to a folder that's &lt;em&gt;not&lt;/em&gt; an Asset Source - for security reasons I don't want these particular files to be visible in any way in the CMS. Is there a way to do this, eg, by using a filepath rather than an Asset Source?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm also not sure how to validate the file, in terms of its file extension, size, etc. I can see &lt;a href=&quot;http://www.yiiframework.com/wiki/56/#hh12&quot; rel=&quot;nofollow&quot;&gt;how to do this in Yii&lt;/a&gt; but I'm not sure how to do it having uploaded the file as above.)&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="3686" LastEditDate="2015-08-28T15:28:45.787" LastActivityDate="2015-08-28T15:42:51.600" Title="Upload file from plugin's Controller to a non-Assets folder" Tags="&lt;plugin-development&gt;&lt;upload&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11224" PostTypeId="2" ParentId="11223" CreationDate="2015-08-28T15:26:26.523" Score="6" Body="&lt;p&gt;Ahh, a bit of fiddling and poking around later...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$file = UploadedFile::getInstanceByName('myFieldName');&#xA;$fileName = AssetsHelper::cleanAssetName($file-&amp;gt;getName());&#xA;&#xA;// Make fileName uniqueish by adding a timestamp to it.&#xA;$fileParts = explode(&quot;.&quot;, $fileName);&#xA;$extension = array_pop($fileParts);&#xA;$fileName = join(&quot;.&quot;, $fileParts) .'_'. time() .'.'. $extension;&#xA;&#xA;$filePath = '/path/to/my/folder/' . $fileName;&#xA;&#xA;$response = $file-&amp;gt;saveAs($filePath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seems to work OK!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unique filename stuff seems not entirely great. Might be better to see if the file exists first, and if so, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/a2683e81f67eb7e90dd753f0e9b0163abfd6a334/app/assetsourcetypes/LocalAssetSourceType.php#L354&quot; rel=&quot;noreferrer&quot;&gt;make a new name&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just need to work out how to validate my Model now...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Oh, that was quick. So now I do:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;$myModel = MyForm_FilesModel::populateModel($post);&#xA;&#xA;// All the file-handling stuff as above.&#xA;&#xA;$myModel-&amp;gt;myAttribute = $file;&#xA;&#xA;if ($myModel-&amp;gt;validate()) {&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where my model is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyForm_FilesModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'myAttribute' =&amp;gt; array(AttributeType::Name),&#xA;        );&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        return array(&#xA;            array('UploadPassport', 'file',&#xA;            'allowEmpty' =&amp;gt; false,&#xA;            'maxFiles' =&amp;gt; 1,&#xA;            'maxSize' =&amp;gt; 5 * 1000000, // 5MB&#xA;            'tooLarge' =&amp;gt; 'Sorry, the maximum file size is 5MB',&#xA;            'types' =&amp;gt; array('jpg', 'png', 'pdf'),&#xA;            'wrongType' =&amp;gt; 'Files must be one of jpg, png or pdf',&#xA;            'message' =&amp;gt; 'Please upload a file'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The &lt;code&gt;defineAttributes()&lt;/code&gt; stuff feels very wrong, as this isn't a proper Craft model - I'm not saving any of this as an Entry etc defined in the Craft Admin. But I can't see how else to make this stuff work.)&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="3686" LastEditDate="2015-08-28T15:42:51.600" LastActivityDate="2015-08-28T15:42:51.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11225" PostTypeId="1" AcceptedAnswerId="11226" CreationDate="2015-08-28T18:02:20.967" Score="2" ViewCount="205" Body="&lt;p&gt;I can't figure out what I'm doing wrong, but trying to convert single digit months to their name representations (ex. '4' to 'April' in English) but am just getting December printed out for every single one. I can't compare to month names because the site is in quite a few languages, so need to actually use the date functionality.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEntries = entriesInYear | group(&quot;postDate|date('n')&quot;) %}&#xA;&#xA;{% for key, eachMonth in groupedEntries %}&#xA;    {% set monthName = date(key) | date('F') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ craft.languageLink.url(craft.locale, urlParam) }}&quot;&#xA;            {{ monthName }}, {{ eachMonth|length }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'Key' is the month representation with no leading 0's (4, 3, and 2 for posts that exist in April, March and February).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting output as:&#xA;December, 4&#xA;December, 4&#xA;December, 2&#xA;(following number is number of posts in that month)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WHAT the heck am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="3842" LastActivityDate="2015-08-28T19:43:01.183" Title="Date conversion returning December for every single digit month representation" Tags="&lt;datetime&gt;&lt;archives&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11226" PostTypeId="2" ParentId="11225" CreationDate="2015-08-28T18:53:30.890" Score="2" Body="&lt;p&gt;You can't create a date from a single digit. This is what I would do instead:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Get the localized names from Craft's data set with this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthName = craft.i18n.getLocaleData().getMonthName(key)|date('F') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There some info about that &lt;code&gt;craft.i18n.getLocaleData&lt;/code&gt; in a Craft help article: &lt;a href=&quot;http://buildwithcraft.com/help/locale-data-from-templates&quot; rel=&quot;nofollow&quot;&gt;&quot;How do I access locale data from my templates?&quot;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a placeholder date:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthName = date('2000-' ~ key ~ '-01')|date('F') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To make this work you have to adjust the parameter in the group filter to use leading zero with the month numbers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEntries = entriesInYear|group(&quot;postDate|date('m')&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-08-28T19:43:01.183" LastActivityDate="2015-08-28T19:43:01.183" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11227" PostTypeId="2" ParentId="11225" CreationDate="2015-08-28T18:56:11.980" Score="3" Body="&lt;p&gt;Here's what's happening... Every time you get &quot;December&quot;, it's because the date is being parsed as &lt;strong&gt;December 31, 1969&lt;/strong&gt; (aka, just before the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix_time&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unix Epoch&lt;/a&gt;). Basically, it's &lt;em&gt;failing&lt;/em&gt; to parse the date properly, and thus defaulting back to the Epoch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's why... &lt;code&gt;date(key)&lt;/code&gt; is basically saying &quot;Get the date of 4&quot;. Which obviously doesn't make any sense. So the &quot;date of 4&quot; is a fail, and you get the Epoch default instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's what I recommend instead... replace this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthName = date(key) | date('F') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... with something more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch key %}&#xA;    {% case 1 %}&#xA;        {% set monthName = 'January'|t %}&#xA;    {% case 2 %}&#xA;        {% set monthName = 'February'|t %}&#xA;    {% case 3 %}&#xA;        {% set monthName = 'March'|t %}&#xA;    {% case 4 %}&#xA;        {% set monthName = 'April'|t %}&#xA;    {% case 5 %}&#xA;        {% set monthName = 'May'|t %}&#xA;    {% case 6 %}&#xA;        {% set monthName = 'June'|t %}&#xA;    {% case 7 %}&#xA;        {% set monthName = 'July'|t %}&#xA;    {% case 8 %}&#xA;        {% set monthName = 'August'|t %}&#xA;    {% case 9 %}&#xA;        {% set monthName = 'September'|t %}&#xA;    {% case 10 %}&#xA;        {% set monthName = 'October'|t %}&#xA;    {% case 11 %}&#xA;        {% set monthName = 'November'|t %}&#xA;    {% case 12 %}&#xA;        {% set monthName = 'December'|t %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's a big chunk of code, I know. So feel free to offload that to a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macro&lt;/a&gt; if it's more convenient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternately, you could use a &lt;em&gt;placeholder&lt;/em&gt; date, as &lt;a href=&quot;https://craftcms.stackexchange.com/a/11226/45&quot;&gt;carlcs suggested in his answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-08-28T18:56:11.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11229" PostTypeId="1" AcceptedAnswerId="11230" CreationDate="2015-08-28T21:12:51.593" Score="1" ViewCount="267" Body="&lt;p&gt;I got a list of entries &lt;code&gt;news&lt;/code&gt; (channel type).&lt;br&gt;&#xA;They are created by &lt;code&gt;users&lt;/code&gt; (or &lt;code&gt;author&lt;/code&gt;).&lt;br&gt;&#xA;These users have a category &lt;code&gt;region&lt;/code&gt; assigned to them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My point is to list the &lt;code&gt;news&lt;/code&gt; entries that have the same &lt;code&gt;author's category&lt;/code&gt; than the &lt;code&gt;currentUser's category&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying with relatedTo but I am stuck here:   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% set userRegion = currentUser.region.first() %}&#xA;{% endif %}&#xA;&#xA;{% set regionNews = craft.entries.section('news').relatedTo('and',&#xA;    { sourceElement: currentUser, field: 'unepRegion' },&#xA;    { targetElement: author, field: 'unepRegion' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Really don't know where I am going with this.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorDisplayName="user1080" LastEditDate="2016-10-07T04:05:32.800" LastActivityDate="2016-10-07T04:05:32.800" Title="Get entries filtered by author's category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11230" PostTypeId="2" ParentId="11229" CreationDate="2015-08-29T08:07:32.070" Score="2" Body="&lt;p&gt;You probably have to query twice, first get all the users and then get all news entries&#xA;published by any of these users using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#authorId&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;authorId&lt;/code&gt;&lt;/a&gt; parameter on your criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userRegion = currentUser.region.first() %}&#xA;{% set regionUsersIds = craft.users.relatedTo(userRegion).limit(null).ids() %}&#xA;&#xA;{% set regionNews = craft.entries.section('news').authorId(regionUsersIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-29T08:07:32.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11231" PostTypeId="1" AcceptedAnswerId="11235" CreationDate="2015-08-29T14:00:08.560" Score="6" ViewCount="2554" Body="&lt;p&gt;I have a category group with parents each with 1 level of children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my category entry page I want to list JUST the children of the current category being viewed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure it's simple but I can't figure what to put in my category template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-08-29T18:59:06.420" Title="Showing just the child category titles of a parent" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11232" PostTypeId="2" ParentId="11231" CreationDate="2015-08-29T14:11:51.727" Score="1" Body="&lt;p&gt;Of course after posting my question I immediately &lt;a href=&quot;https://craftcms.stackexchange.com/questions/718/how-do-you-only-show-children-of-active-parent-using-categories&quot;&gt;find an answer&lt;/a&gt;!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be good if someone can confirm this is the best way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% set categories = craft.categories.group('areaOfPractice') %}&#xA;        {% for category in categories %}&#xA;          {% set thisIsActiveCategory = (category.slug == craft.request.segment(2)) %}&#xA;            {% if thisIsActiveCategory %}&#xA;              {% set subCategories = craft.categories.descendantOf(category) %}&#xA;              &amp;lt;ul&amp;gt;&#xA;                {% for subCat in subCategories %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ subCat.url }}&quot;&amp;gt;{{ subCat.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;              &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="189" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-08-29T14:11:51.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11233" PostTypeId="1" AcceptedAnswerId="11234" CreationDate="2015-08-29T15:53:03.597" Score="3" ViewCount="146" Body="&lt;p&gt;I have a list of people with skills defined by a category group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category field within the '&lt;strong&gt;people&lt;/strong&gt;' Section so when a new person (entry) is created, the category field allows the admin to assign appropriate &lt;strong&gt;skills&lt;/strong&gt; to that new profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a series of category entries for the 'skills' available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a user visits an &quot;Our Skills&quot; entry page, I need to display the title (name) of the people who have had that particular skill assigned to their profile via the category field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is reverse relations but I can't get my head around it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would appreciate some help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-08-29T18:56:53.107" Title="Showing entries within a category" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11234" PostTypeId="2" ParentId="11233" CreationDate="2015-08-29T18:56:53.107" Score="1" Body="&lt;p&gt;Yes, you're right, one could call this a reverse-relation. The field you created the relation from is the &quot;people&quot; entry and you're looking at it from the category element's page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To describe this direction in Craft &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter, you define whether the element you're dealing with is the &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;sourceElement&lt;/code&gt;&lt;/a&gt; of that relation, which means it is the element with the field, or if it is a &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;targetElement&lt;/code&gt;&lt;/a&gt;, one of the elements selected in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on your &quot;Our Skills&quot; page you have a category element that &lt;em&gt;got&lt;/em&gt; selected from a categories field, this makes it a &lt;code&gt;targetElement&lt;/code&gt;. I'm also setting that categories field's handle here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set individuals = craft.entries({&#xA;    section: 'people',&#xA;    relatedTo: {&#xA;        targetElement: category,&#xA;        field: 'mySkillsFieldHandle'&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In most cases you could just use the &lt;code&gt;element&lt;/code&gt; property, because there are no other relations between both elements. But I actually like to always define my relations precisely, because who knows what we add to the site in the future, that potentially breaks loose definitions.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-29T18:56:53.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11235" PostTypeId="2" ParentId="11231" CreationDate="2015-08-29T18:59:06.420" Score="5" Body="&lt;p&gt;You should actually already have a variable named &quot;category&quot;&#xA;pre-assigned by Craft, if you've set up your categories to have URLs in the category settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this simplified code is probably all you need.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set subCategories = craft.categories.descendantOf(category) %}&#xA;&#xA;{% if subCategories|length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for category in subCategories %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    {% exit 404 %}    &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To have different template code for your sub-category pages you're linking to, I would&#xA;put the code above in a partial _partials/mainCategory and include it with the &lt;code&gt;include&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category.level == 1 %}&#xA;    {% include '_partials/mainCategory' %}&#xA;{% else %}&#xA;    {% include '_partials/subCategory' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-29T18:59:06.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11236" PostTypeId="1" CreationDate="2015-08-29T22:25:09.643" Score="2" ViewCount="524" Body="&lt;p&gt;I can see the simple matrix field data in the &lt;code&gt;craft_matrixcontent_MYMATRIX&lt;/code&gt;table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft_matrixcontent_MYMATRIX&#xA;---------------------------&#xA;id | elementId | locale | field_BLOCKTYPE_FIELDHANDLE | field_BLOCKTYPE_FIELDHANDLE | dateCreated | dateUpdated | uid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I need to query upon those fields, I can thanks to some of the great posts to this site. But those fields are simple text fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an Entries field in my matrix. Where can I find this relationship in the database? It doesn't exist in the &lt;code&gt;craft_matrixcontent_MYMATRIX&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="3943" LastEditorUserId="3943" LastEditDate="2015-08-29T22:41:37.567" LastActivityDate="2015-08-30T04:03:07.613" Title="Where are Matrix Entries Fields Relationships in the Database?" Tags="&lt;matrix&gt;&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11237" PostTypeId="2" ParentId="11236" CreationDate="2015-08-30T00:53:57.253" Score="1" Body="&lt;p&gt;All relational fields (Entries, Assets, Categories, Tags, etc.) store their relationship information in the boringly named &lt;code&gt;craft_relationships&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you can see the field ID, source and target ID as well as the source locale and sort order.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-30T00:53:57.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11238" PostTypeId="2" ParentId="11236" CreationDate="2015-08-30T04:03:07.613" Score="2" Body="&lt;p&gt;I think I've figured it out. The sourceId of the &lt;code&gt;craft_relations&lt;/code&gt; table is the elementId of the custom matrix table. And the targetId of the &lt;code&gt;craft_content&lt;/code&gt; table is the elementId of the `craft_content table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uWuBm.png&quot; alt=&quot;Table relationships&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I was trying to do. I needed to filter entries based on a field value in an Entries matrix field on another entry. Whew.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'FIRSTCOOLTHING';&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;$query-&amp;gt;join('matrixblocks matrixblocks', 'matrixblocks.ownerId = entries.id');&#xA;$query-&amp;gt;join('matrixcontent_MYMATRIX matrixcontent_MYMATRIX', 'matrixcontent_MYMATRIX.elementId = matrixblocks.id');&#xA;$query-&amp;gt;join('relations relations', 'relations.sourceId = matrixcontent_MYMATRIX.elementId');&#xA;$query-&amp;gt;join('content SECONDCOOLTHING', 'SECONDCOOLTHING.elementId = relations.targetId');&#xA;&#xA;$query-&amp;gt;andWhere('SECONDCOOLTHING.field_FIELDHANDLE = '.$THINGTOSEARCHFOR);&#xA;&#xA;$query-&amp;gt;order('title asc');&#xA;&#xA;$queryResults = $query-&amp;gt;queryAll();&#xA;return EntryModel::populateModels($queryResults);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3943" LastActivityDate="2015-08-30T04:03:07.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11239" PostTypeId="1" CreationDate="2015-08-30T12:41:09.503" Score="2" ViewCount="218" Body="&lt;p&gt;I've been reading a lot of documentation (getSiblings, getDescendants etc) but can't get this to work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure, named 'areas'. When showing an entry that is a child of an area in 'areas', I would like to list its siblings (that is in the same place in the hierarchy). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example on the url &lt;a href=&quot;http://localhost/areas/some-area/very-nice-area-number-1&quot; rel=&quot;nofollow&quot;&gt;http://localhost/areas/some-area/very-nice-area-number-1&lt;/a&gt;, I would like to list very-nice-area-number-2, very-nice-area-number-3, very-nice-area-number-4 and so on (but not the current one (very-nice-area-number-1), of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To explain further, using the getNext function is the closest I've come, except that it only gives me one entry, and I want all other entries that holds the same place in the hierarchy under 'some-area'. &lt;/p&gt;&#xA;" OwnerUserId="3973" LastEditorUserId="125" LastEditDate="2015-08-31T22:43:34.720" LastActivityDate="2015-08-31T22:43:34.720" Title="List related siblings" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11240" PostTypeId="1" AcceptedAnswerId="11251" CreationDate="2015-08-30T17:24:45.320" Score="3" ViewCount="403" Body="&lt;p&gt;I have a field type that needs to do some processing, based on the data in the element it belongs to, when an element (entry, category, user, etc) is saved, and save it to the field. I'm hooking into &lt;code&gt;onAfterElementSave&lt;/code&gt; and my code (simplified) is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    $fieldHandle = $this-&amp;gt;model-&amp;gt;handle;&#xA;    $elementId = $this-&amp;gt;element-&amp;gt;id;&#xA;    $elementType = $this-&amp;gt;element-&amp;gt;getElementType();&#xA;    $elementLocale = $this-&amp;gt;element-&amp;gt;locale;&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria($elementType);&#xA;    $criteria-&amp;gt;id = $elementId;&#xA;    $criteria-&amp;gt;locale = $elementLocale; &#xA;    $element = $criteria-&amp;gt;first();&#xA;&#xA;    if ($element!==null) {&#xA;        $myData = $element-&amp;gt;title; // just an example&#xA;        if ($this-&amp;gt;element-&amp;gt;$fieldHandle != $myData) {&#xA;            $newData = array($fieldHandle =&amp;gt; $myData);&#xA;            $element-&amp;gt;setContent($newData);&#xA;            craft()-&amp;gt;elements-&amp;gt;saveElement($element);&#xA;        }&#xA;    } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine on existing entries, but when I create new entries, $element is null, so the field isn't updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's going on and how can I fix this? Isn't onAfterElementSave actually after element save? :) &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2019-12-18T17:17:31.933" Title="onAfterElementSave and new elements" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11241" PostTypeId="1" AcceptedAnswerId="11242" CreationDate="2015-08-30T20:10:39.287" Score="2" ViewCount="1289" Body="&lt;p&gt;I'm making a one-button form, to add an entry to an entries field.&#xA;Adding seems pretty straightforward, but it overwrites any previous entry that occupied the entries field. How would I append an entry to the entries field, or remove an entry?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{currentUrl}}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tournamentTeams][]&quot; value=&quot;{{team.id}}&quot;&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Add {{team.title}} to this Tournament&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My guess is, I will have to populate the entries field input value with the already-added entries to append the entry, and do the same kinda deal upon removing the entry- no idea how I would detect and remove the entry though!&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-09-21T17:00:49.380" Title="Add, remove, and append entries to an entries field via frontend form" Tags="&lt;form&gt;&lt;entries-field&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11242" PostTypeId="2" ParentId="11241" CreationDate="2015-08-30T22:02:47.570" Score="3" Body="&lt;p&gt;You guessed right, you have to set all already added entries again. To do this,&#xA;just have some Twig logic when outputting the fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for currentTeam in entry.tournamentTeams %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tournamentTeams][]&quot; value=&quot;{{ currentTeam.id }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tournamentTeams][]&quot; value=&quot;{{ team.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To remove the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for currentTeam in entry.tournamentTeams if currentTeam.id != team.id %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tournamentTeams][]&quot; value=&quot;{{ currentTeam.id }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; What I'm not sure about is if the above code works when trying to remove the last remaining entry. If it doesn't work I'd try and add something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.tournamentTeams|length == 1) and (entry.tournamentTeams.first().id == team.id) %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tournamentTeams]&quot; value=&quot;&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3380" LastEditDate="2015-09-21T17:00:49.380" LastActivityDate="2015-09-21T17:00:49.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11243" PostTypeId="2" ParentId="11239" CreationDate="2015-08-30T22:28:16.047" Score="3" Body="&lt;p&gt;As already mentioned in the comments, &lt;code&gt;getSiblings&lt;/code&gt; should do exactly what you need.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sibling in entry.getSiblings() %}&#xA;    {{ sibling.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-30T22:28:16.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11245" PostTypeId="1" AcceptedAnswerId="11266" CreationDate="2015-08-31T03:57:37.767" Score="4" ViewCount="578" Body="&lt;p&gt;I've had this issue for a while now and have never been able to get it solved - even after chatting in Slack about it with some people. Basically whenever I go to update an entry, Craft hangs and locks up Apache. It times out in about 5 minutes or if I manually restart Apache, things go back to normal. The entry is updated after the server restarts so it appears that the database write is successful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's becoming a huge problem as I'm finishing up a site for a client and they're needing to put content in. I'm running this on a Google VM and have tried installing it on a fresh server with no luck. I'm running Ubuntu 14.0.3. I'm running other Craft sites on Google and have no issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a few steps a while back (I can't remember what exactly), I believe I increased a couple parameters in PHP.ini but I honestly can't remember. I used to be getting the zend_mm_heap_corrupted error but that's gone away now from my Apache error log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. It's getting sort of urgent at this point since my deadline is approaching and entries need to be worked on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Apache version is 2.4.7 if that makes any difference.&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2016-03-23T12:27:46.897" Title="Craft hangs when updating entry" Tags="&lt;entries&gt;&lt;server&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="11246" PostTypeId="1" CreationDate="2015-08-31T05:08:17.370" Score="2" ViewCount="513" Body="&lt;p&gt;I am trying to update an entry in a structure but getting the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nisp.craft_matrixcontent_colcontent' doesn't exist. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `matrixblocks`.`fieldId`, `matrixblocks`.`ownerId`, `matrixblocks`.`ownerLocale`, `matrixblocks`.`typeId`, `matrixblocks`.`sortOrder`&#xA; FROM `craft_elements` `elements`&#xA; JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA; JOIN `craft_matrixcontent_colcontent` `content` ON content.elementId = elements.id&#xA; JOIN `craft_matrixblocks` `matrixblocks` ON matrixblocks.id = elements.id&#xA; WHERE ((((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements.enabled = 1)) AND (elements_i18n.enabled = 1)) AND (matrixblocks.fieldId=:matrixblocksfieldId1)) AND (matrixblocks.ownerId=:matrixblocksownerId1)&#xA; GROUP BY `elements`.`id`&#xA; ORDER BY `matrixblocks`.`sortOrder` LIMIT 100. Bound with :locale='en_gb', :matrixblocksfieldId1='285', :matrixblocksownerId1='1656' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The table it mentions is a matrix related table which does not exist - it was deleted a while back.&#xA;It was used in a Matrix - Super Table - Matrix test but I was getting errors with it and decided not to use this then so deleted it.&#xA;I only started to get this error when I added a new Matrix Field to this entryType. But I have emvoed the Matrix field and now I am still getting the error and can't update.&#xA;Any idea's as to the resolution?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2019-10-25T15:56:42.890" Title="Unable to Update Entry - Table doesn't exist" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11247" PostTypeId="1" AcceptedAnswerId="11540" CreationDate="2015-08-31T06:56:35.503" Score="1" ViewCount="152" Body="&lt;p&gt;I'm working on a website for a school and need to create a system where students can login, check assignments and upload homework that the teacher can then view easily and give feedback on. I am only a front and programmer so I am hoping there is some form of pre-built plugin for Craft that I can use and then modify to suit our needs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently we use Blogger and it does an alright job for what we need. But we would prefer to have all the interactions for students to be done through own website and not a third party.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it's a complicated question here is a very basic outline of what I am trying to achieve:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UmndT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UmndT.png&quot; alt=&quot;Example Image&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:30:06.200" LastActivityDate="2017-05-09T23:30:06.200" Title="Blog Integration or Creation?" Tags="&lt;plugins&gt;&lt;craft-features&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11250" PostTypeId="1" AcceptedAnswerId="11252" CreationDate="2015-08-31T09:58:34.890" Score="4" ViewCount="1318" Body="&lt;p&gt;I have a loop to go through my products which go in batches because they need to show detail info every third entry. When the Website is viewed from a mobile device, Tablet or Mobile I want it to loop in Batches of 2 instead of 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I get when I make an &quot;if&quot; statement is errors about the for loop not closing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if craft.request.isMobileBrowser %}&#xA;        {% for batch in craft.entries.section('afval')|batch(2) %}&#xA;    {% else %}&#xA;        {% for batch in craft.entries.section('afval')|batch(3) %}&#xA;    {% endif %}&#xA;    lots of content here...&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So how can I get the loop to go in 2 entries per batch instead of 3 when reached &quot;col-sm&quot;(bootstrap) or atleast when a mobile device is detected.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="125" LastEditDate="2015-08-31T12:36:45.433" LastActivityDate="2015-09-01T22:39:33.497" Title="Is it possible to change a loop if mobile browser is detected?" Tags="&lt;entries&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11251" PostTypeId="2" ParentId="11240" CreationDate="2015-08-31T10:02:18.187" Score="4" Body="&lt;p&gt;You should be using it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    $fieldHandle = $this-&amp;gt;model-&amp;gt;handle;&#xA;    if ($this-&amp;gt;element!==null) {&#xA;        $myData = $this-&amp;gt;element-&amp;gt;title; // just an example&#xA;        if ($this-&amp;gt;element-&amp;gt;$fieldHandle != $myData) {&#xA;            $this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;setAttribute($fieldHandle, $myData);&#xA;            craft()-&amp;gt;elements-&amp;gt;saveElement($this-&amp;gt;element);&#xA;        }&#xA;    } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="165" LastEditorUserId="5275" LastEditDate="2019-12-18T17:17:31.933" LastActivityDate="2019-12-18T17:17:31.933" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11252" PostTypeId="2" ParentId="11250" CreationDate="2015-08-31T10:35:45.230" Score="6" Body="&lt;p&gt;You should close your for-tag pair within the &lt;code&gt;{% if ... %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isMobileBrowser %}&#xA;    {% for batch in craft.entries.section('afval')|batch(2) %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {% for batch in craft.entries.section('afval')|batch(3) %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, even better:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set batch = craft.request.isMobileBrowser ? 2 : 3 %}&#xA;&#xA;{% for batch in craft.entries.section('afval') | batch(batch) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-08-31T10:35:45.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11253" PostTypeId="2" ParentId="11250" CreationDate="2015-08-31T12:20:06.917" Score="3" Body="&lt;p&gt;I wouldn't use Craft's &lt;code&gt;isMobileBrowser&lt;/code&gt; detection here. It's the &lt;strong&gt;viewport width&lt;/strong&gt; you are actually interested in and not whether the visitors is viewing your site from a mobile, tablet or desktop device. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'd do instead is to add a css class to the last item in each row and&#xA;hide that item for the viewport widths in question with css. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for batch in craft.entries.section('afval')|batch(3) %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        {% for item in batch %}&#xA;            {% set lastItemClass = loop.last ? 'col-xs-hidden' %}&#xA;&#xA;            &amp;lt;div class=&quot;col-xs-6 col-md-4 {{ lastItemClass }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.col-xs-hidden {display: none;}&#xA;&#xA;@media (min-width: @screen-md-min) {&#xA;  .col-xs-hidden {display: block;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-09-01T22:39:33.497" LastActivityDate="2015-09-01T22:39:33.497" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11254" PostTypeId="2" ParentId="11219" CreationDate="2015-08-31T12:33:47.320" Score="1" Body="&lt;p&gt;As a workaround you could hide the default title column and add your own:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source)&#xA;{&#xA;    if ($source == 'section:2')&#xA;    {&#xA;        $attributes = array();&#xA;        $attributes['myOwnTitle'] = Craft::t('Title');&#xA;        $attributes['uri'] = Craft::t('URI');&#xA;        $attributes['postDate'] = Craft::t('Post Date');&#xA;        $attributes['expiryDate'] = Craft::t('Expiry Date');&#xA;    }&#xA;}&#xA;&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    switch ($attribute)&#xA;    {&#xA;        case 'myOwnTitle':&#xA;        {&#xA;            return 'blabla';&#xA;        }&#xA;&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-08-31T12:33:47.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11255" PostTypeId="1" AcceptedAnswerId="11256" CreationDate="2015-08-31T14:30:48.363" Score="2" ViewCount="94" Body="&lt;p&gt;I would like to make instruction field info on multiple lines in CP to improve legibility.&lt;br&gt;&#xA;You can make a line return when you input the field instructions but it does not work.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wDKDi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wDKDi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EoaeI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EoaeI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-08-31T14:34:11.227" Title="CP entry instructions on multiple lines" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11256" PostTypeId="2" ParentId="11255" CreationDate="2015-08-31T14:34:11.227" Score="2" Body="&lt;p&gt;OK I got it. Just after posting this I had a last intuition of trying markdown stuff and it works! Cf Stackexchange line return...&lt;br&gt;&#xA;&lt;em&gt;Asking the question gives you the answer!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So just add 2 spaces at end of line!&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qJNBJ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qJNBJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-08-31T14:34:11.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11257" PostTypeId="1" CreationDate="2015-08-31T14:36:41.050" Score="0" ViewCount="207" Body="&lt;p&gt;I have a client with &lt;em&gt;very&lt;/em&gt; stringent concerns over acurate color in thier images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have noticed that image resized from Craft have some dramatic color discrepancies, which I have verified. It's nothing you'd probably notice in a regular photo, but these are actual fabric swatch images, so the color is crucial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway - first thing I verified was that Imagick was being used, which it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I look at the file info, it still says something about &lt;code&gt;gd-jpeg&lt;/code&gt; which concerning...not sure if that is just a red herring though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;❯ file resized-720.jpeg&#xA;resized-720.jpeg: JPEG image data, JFIF standard 1.01, comment: &quot;CREATOR: gd-jpeg v1.0 (using IJ&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this more appropriately posted as an issue for &lt;a href=&quot;https://github.com/avalanche123/Imagine&quot; rel=&quot;nofollow&quot;&gt;https://github.com/avalanche123/Imagine&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-08-31T15:13:07.130" Title="Asset transform messing with color" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11259" PostTypeId="2" ParentId="11257" CreationDate="2015-08-31T15:13:07.130" Score="1" Body="&lt;p&gt;Somehow, the images were created thinking Imagick wasn't installed. Clearing the cache forced the images to be recreated and seems to have fixed it.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-08-31T15:13:07.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11260" PostTypeId="2" ParentId="11246" CreationDate="2015-08-31T17:26:11.770" Score="1" Body="&lt;p&gt;Does your database have InnoDB enabled and are all of Craft's tables using it (except for &lt;code&gt;searchindex&lt;/code&gt;, which is MyISAM)? Sounds like maybe when you deleted the field some cascading deletes that are set on foreign keys didn't occur and that can happen if you're on MyISAM (which doesn't have foreign key support).&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-08-31T21:12:25.263" LastActivityDate="2015-08-31T21:12:25.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11261" PostTypeId="2" ParentId="11247" CreationDate="2015-08-31T18:06:20.990" Score="1" Body="&lt;p&gt;It's certainly doable, but I think there will be some significant plugin and templating work needed, even when starting with something like the the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin that Jamie mentioned.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-08-31T18:06:20.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11262" PostTypeId="1" CreationDate="2015-08-31T18:46:22.743" Score="0" ViewCount="55" Body="&lt;p&gt;I ask this question a few weeks ago, but could not fix this problem. Now i have minimize my code.&#xA;i use this loop: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for program in craft.entries.section('program_point').order('program_number') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it takes 25s. The loop returns 81 data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to speed this up?&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T23:29:22.650" LastActivityDate="2017-05-09T23:29:22.650" Title="25s TTFB for one for-loop" Tags="&lt;templating&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="12" ClosedDate="2015-09-03T18:31:23.393" ContentLicense="CC BY-SA 3.0" />
  <row Id="11263" PostTypeId="1" CreationDate="2015-08-31T20:02:50.580" Score="4" ViewCount="75" Body="&lt;p&gt;I have a structure, holding areas (level 1), and properties (level 2). I use entry types to pick what template will be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my entry type 'area' template I'm listing the children of 'area' ('properties'). &#xA;The children (entry type 'property', has an image field that I want to pull into my area template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set properties = entry.getChildren() %}&#xA;{% if properties | length %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;  &amp;lt;h2&amp;gt;Properties&amp;lt;/h2&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for property in properties %}&#xA;    &amp;lt;div class=&quot;col-md-6 col-lg-4&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;{{property.url}}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;module&quot; style=&quot;background-image: url('???');&quot;&amp;gt;&#xA;          &amp;lt;span&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{property.title}}&amp;lt;/h2&amp;gt;&#xA;          &amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, except I can't figure out how to pull the imageurl from the asset 'imageBackground' that sits in the entry type 'property' field layout. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone?&lt;/p&gt;&#xA;" OwnerUserId="3973" LastActivityDate="2015-08-31T20:57:07.483" Title="How do I pull an image from a child entry of a structure" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11264" PostTypeId="2" ParentId="11263" CreationDate="2015-08-31T20:57:07.483" Score="2" Body="&lt;p&gt;&lt;code&gt;property.imageBackground&lt;/code&gt; is an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which is to say that it always behaves much like an array of assets (even if you are sure there is only one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the short answer is that you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;style=&quot;background-image: url({{ property.imageBackground.first.url }});&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The catch here is that this will fail if there is for some reason no such asset. This can happen even if the field is required, and so you should always check. There are several ways to check. This is straightforward:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if property.imageBackground|length %}&#xA;  {{ property.imageBackground.first.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use a loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for background in property.imageBackground %}&#xA;  {{ background.url }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or a default (this uses twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;?:&lt;/a&gt; operator, and relies on some global image always being there, but you now only have one image to make certain is &lt;strong&gt;always&lt;/strong&gt; there):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set background = property.imageBackground.first&#xA;   ?: g_config.defaultBackgroundImage.first&#xA;%}&#xA;{{ background.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-08-31T20:57:07.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11265" PostTypeId="2" ParentId="11181" CreationDate="2015-08-31T23:56:31.373" Score="1" Body="&lt;p&gt;Use Categories for Teacher &amp;amp; Country.  Add inputs for those categories to your Section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create your select inputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('events').ids() %}&#xA;{% set teachers = craft.categories.relatedTo({ sourceElement: entryIds }).group('teacher').find() %}&#xA;{% set countries = craft.categories.relatedTo({ sourceElement: entryIds }).group('country').find() %}&#xA;&amp;lt;select&amp;gt;&#xA;  {% for item in teachers %}&#xA;       &amp;lt;option value='{{ item.title }}'&amp;gt;{{ item.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;select&amp;gt;&#xA;  {% for item in countries %}&#xA;       &amp;lt;option value='{{ item.title }}'&amp;gt;{{ item.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when you submit these as a form or via javascript on your filtered page you would do something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filterId = craft.request.getParam('id') %}&#xA;{% set events = craft.entries.section('events').relatedTo({targetElement:filterId}).startDate('and', '&amp;gt;= ' ~ now) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you needed to filter for more than one category group:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'events',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: craft.request.getParam('teacherId') },&#xA;        { targetElement: craft.request.getParam('countryId') }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-08-31T23:56:31.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11266" PostTypeId="2" ParentId="11245" CreationDate="2015-09-01T01:41:58.283" Score="5" Body="&lt;p&gt;It turns out that I was running a dev release of PHP 5.6 from a PPA and not the official Ubuntu release. With Brad Bell's help (thank you so much!) I got on the right track to looking into PHP and realized that that was the problem. After purging the PPA and reverting to PHP 5.5.9 on the official Ubuntu repo, the problem seems to have gone away. Hopefully never to return again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again, Brad!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; As I said below, the problem appeared again. It seems to have been solved when I disabled Craft's devMode in my environment variables. I'm not sure what would cause that to be an issue, but devMode is something I can live without for now since the site is near going live. Brad, if you have any insight as to why devMode would be causing the issues, I'd love to hear it :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1150" LastEditorUserId="1150" LastEditDate="2015-09-02T04:12:02.047" LastActivityDate="2015-09-02T04:12:02.047" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="11267" PostTypeId="1" AcceptedAnswerId="11270" CreationDate="2015-09-01T10:31:51.303" Score="4" ViewCount="109" Body="&lt;p&gt;With regards to logging in your own plugin, is there a point which could be considered &quot;You are logging too much&quot; For example. In a service I currently have something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSomeRecordsByParentId($id)&#xA;{&#xA;  FooPlugin::log(Craft::t(&quot;Getting all records for parent id {$id}&quot;), LogLevel::Info);&#xA;&#xA;  // .. do service logic here&#xA;&#xA;  FooPlugin::log(Craft::t(&quot;Found {$recordCount} records for parent with id {$id}&quot;), LogLevel::Info);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then again&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getRecordById($id)&#xA;{&#xA;    FooPlugin::log(Craft::log(&quot;Trying to find record with an id of {$id}&quot;), LogLevel::Info);&#xA;&#xA;    $record = FooRecord::model()-&amp;gt;findByPk($id);&#xA;&#xA;    if(!$record)&#xA;    {&#xA;        FooPlugin::log(Craft::log(&quot;Unable to find record with id {$id}&quot;), LogLevel::Error);&#xA;        throw new HttpException(404);&#xA;    }&#xA;&#xA;    return FooModel::populateModel($record);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I'm only doing two per function at the moment but when they are all called it can really start to stack up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess what i'm asking is are there any real performance hits that are going to be noticeable or has anyone noticed anything from logging a lot of things?&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-01T17:14:36.450" Title="When should I log in a plugin?" Tags="&lt;plugin-development&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11269" PostTypeId="1" CreationDate="2015-09-01T14:39:59.797" Score="5" ViewCount="683" Body="&lt;p&gt;I've created a lightswitch field that defaults to &quot;On&quot;, and it works fine for new entries, but for all existing entries it is set to &quot;Off&quot;. I'm keen to avoid having to manually go through all existing entries switching it to &quot;On&quot; - is there a way of making existing entries respect the default value of this new field (rather than treating the absence of a value for it from when they were created as &quot;Off&quot;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Or alternatively: is there an easy way to set a field to &quot;On&quot; for all existing entries?)&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="328" LastEditDate="2015-09-01T15:09:50.293" LastActivityDate="2017-08-20T16:38:57.893" Title="Can I add an enabled-by-default lightswitch field to existing entries?" Tags="&lt;field&gt;&lt;lightswitch&gt;&lt;default&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11270" PostTypeId="2" ParentId="11267" CreationDate="2015-09-01T14:47:36.393" Score="4" Body="&lt;p&gt;A few things to keep in mind.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;LogLevel::Info&lt;/code&gt;is only going to be logged when &lt;code&gt;devMode&lt;/code&gt; is enabled, so any overhead from excessive logging won't be an issue in production.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Excessive logging will consume extra memory because all logging information on a given request is stored in memory and flushed to disk at the end of the request, but overall I imaging that the performance hit will be negligible.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Excessive logging will cause your log files to rotate out quicker.  By default Craft will cap each log file at 1MB worth of data and will start to rotate out the older files after 6MB worth of data has been hit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-09-01T17:14:36.450" LastActivityDate="2015-09-01T17:14:36.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11271" PostTypeId="2" ParentId="11269" CreationDate="2015-09-01T15:10:06.250" Score="8" Body="&lt;p&gt;If there was no default set beforehand, then your previous elements will have a value of &lt;code&gt;null&lt;/code&gt; for that field. You should be able to include those in your &quot;on&quot; queries by querying for that null value &lt;em&gt;as well as&lt;/em&gt; the &quot;on&quot; value in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set onEntries = craft.entries.yourLightswitch([null, '1']).find %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This won't actually change the value of your previous elements though. One way to do that would be using a SQL query against the &lt;code&gt;craft_content&lt;/code&gt; table to update rows (elements) that have &lt;code&gt;null&lt;/code&gt; in that column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UPDATE `craft_content` SET `field_yourLightswitch` = 1 WHERE `field_yourLightswitch` IS NULL;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-09-01T15:10:06.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11273" PostTypeId="2" ParentId="5380" CreationDate="2015-09-01T17:09:33.700" Score="2" Body="&lt;p&gt;For me adding &lt;code&gt;replaceDivs: false&lt;/code&gt; in redactor config file fixed my issue on div tag removal.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-09-01T17:09:33.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11274" PostTypeId="1" CreationDate="2015-09-01T18:19:56.067" Score="3" ViewCount="304" Body="&lt;p&gt;I've looked at and tried a couple of solutions on here but struggling to apply them to my circumstance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my current code.  I would like a 'default' asset (image) to be used if one hasn't been specified by the admin.  This is so that the front end doesn't have gaps in the gallery.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;photListing&quot;&amp;gt;&#xA;{% cache %}&#xA;  {% for entry in craft.entries.section('people').find() %}&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;      &amp;lt;figure&amp;gt;&#xA;      {% for block in entry.basicProfileInfo %}&#xA;      {% set varBarrPic = block.mx_peoplePhoto.first() %}&#xA;        &amp;lt;img src=&quot;{{ varBarrPic.url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;          &amp;lt;figcaption&amp;gt;&amp;lt;span&amp;gt;{{ block.mx_positionWithinBusiness }}&amp;lt;/span&amp;gt; {{ entry.title }}&amp;lt;/figcaption&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;/figure&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this is a simple solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-09-02T03:52:24.803" Title="Output a default asset if one hasn't been specified" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11275" PostTypeId="1" AcceptedAnswerId="11281" CreationDate="2015-09-01T19:01:13.367" Score="7" ViewCount="2247" Body="&lt;p&gt;Is Craft mature enough to build a robust rental property management system like &lt;a href=&quot;http://www.appfolio.com/features&quot; rel=&quot;noreferrer&quot;&gt;http://www.appfolio.com/features&lt;/a&gt; or &lt;a href=&quot;https://www.tenantcloud.com&quot; rel=&quot;noreferrer&quot;&gt;https://www.tenantcloud.com&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, are there any existing plugins that can handle any of the complex features? I will need to build or contract out the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Required Features: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;site visitors can search for rental units (on Map too)&lt;/li&gt;&#xA;&lt;li&gt;tenants can pay rent online &lt;/li&gt;&#xA;&lt;li&gt;tenants can make maintenance requests online&lt;/li&gt;&#xA;&lt;li&gt;landlords can look at their accounts (income, expenses, past due, etc)&lt;/li&gt;&#xA;&lt;li&gt;landlords, agents or admins can add new properties to the system&lt;/li&gt;&#xA;&lt;li&gt;landlords or agents can book showings&lt;/li&gt;&#xA;&lt;li&gt;automated notifications/emails (rent due, maintenance complete, etc)&lt;/li&gt;&#xA;&lt;li&gt;lease document signing (DocuSign API or?)&lt;/li&gt;&#xA;&lt;li&gt;calendar to schedule maintenance&lt;/li&gt;&#xA;&lt;li&gt;e-commerce and accounting integration (possibly Quickbooks and banks API)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've also been researching using ExpressionEngine or using an existing service like the ones mentioned above or even open source, but I really want to use Craft or even EE if possible for flexibility now and in the future.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="22" LastEditDate="2017-05-09T23:28:10.030" LastActivityDate="2018-07-23T04:19:12.600" Title="Build a Property Management System with Craft CMS?" Tags="&lt;craft-features&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11276" PostTypeId="2" ParentId="11274" CreationDate="2015-09-01T20:55:59.103" Score="1" Body="&lt;p&gt;You can test if your &lt;code&gt;first()&lt;/code&gt; method returns an asset model. &#xA;And depending on that have different image URLs, the (transformed) asset's one or the URL of your placholder image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.mx_peoplePhoto.first() %}&#xA;{% set imageUrl = image ? image.url('500x500') : url('images/_static/placeholder.jpg') %}&#xA;&#xA;&amp;lt;img src=&quot;{{ imageUrl }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also consider to get that placeholder image from a &lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;global set&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-01T20:55:59.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11277" PostTypeId="2" ParentId="11275" CreationDate="2015-09-01T20:56:34.527" Score="4" Body="&lt;p&gt;It is, but will require a lot of custom code work. You won't get these functions build in. If you are an experienced coder you'll love the yii structure and easy to use integration with Crafts core. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are planing on building a PMS with rate codes, multi channel push support and so on I think a custom system will fit better. &lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-09-01T20:56:34.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11278" PostTypeId="2" ParentId="11275" CreationDate="2015-09-01T21:29:23.750" Score="6" Body="&lt;p&gt;You're asking a lot here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say Craft is capable of a lot of it but how much do you want to spend on development? It's a bit like asking &quot;Can xxx be the next Facebook?&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just going over your list:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.doublesecretagency.com/plugins/smart-map&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; could be a great fit here.&lt;/li&gt;&#xA;&lt;li&gt;I just did a project integrating Stripe into Craft. Stripe's API is fantastic but anything with card processing, make sure test the hell of it.&lt;/li&gt;&#xA;&lt;li&gt;Forms are relatively simple to setup in Craft but what do you want to do after the request is made? Do you need tracking done (a la zen desk) or something else?&lt;/li&gt;&#xA;&lt;li&gt;Including 5 / 6 as well:  Craft's permissions are great for sectioning off users and moving content in an out of the system. Again, the devil is in the details.&lt;/li&gt;&#xA;&lt;li&gt;^^ &lt;/li&gt;&#xA;&lt;li&gt;^^^ &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Postmaster&lt;/a&gt; handles e-mail and SMS which could be useful.&lt;/li&gt;&#xA;&lt;li&gt;I don't know of any off-the-shelf plugins that work with DocuSign; definitely new ground.&lt;/li&gt;&#xA;&lt;li&gt;Could be pretty straightforward. After a request comes through, it becomes a new maintenance entry which you could query for.&lt;/li&gt;&#xA;&lt;li&gt;Anything having to do with accounting and e-commmece, the universe is the limit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/11277/1016&quot;&gt;naboovalley mentioned&lt;/a&gt;, it's going to be a lot of custom code no matter how many pieces are already &quot;done&quot;. Depending on specifics, you could be easily be at 6 figures of dev before you even get off the ground. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IMO that's a lot of money to recoup but it's not impossible if you can get traction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you mentioned, systems like AppFolio, TenantCloud, and PropertyWare are already available so if you're going to be attracting potential landlords to your system, your solution better be superior to get them to switch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TBH, Craft is awesome for content management; this solution blurs the line between SaaS and an app. If it were me, I'd also look at something custom within the Rails community too. Once your code is bound to Craft, you're tied there, for better or worse.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="45" LastEditDate="2018-07-23T04:19:12.600" LastActivityDate="2018-07-23T04:19:12.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11279" PostTypeId="2" ParentId="11161" CreationDate="2015-09-01T21:52:39.507" Score="4" Body="&lt;p&gt;You have a lot of matrix blocks; I'm guessing that's why your output is slow.  It looks like your initial query doesn't depend on any other input, so you could probably cache the whole thing.  I would put cache tags before and after your whole snippet, before the first &lt;code&gt;for&lt;/code&gt; loop near the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like you commented out your &lt;code&gt;cache&lt;/code&gt; tags, probably because they won't work where you have them.  Cache tags can't go inside a &lt;code&gt;for&lt;/code&gt; loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way Craft's caching tag works is it takes the output of whatever is between the cache tags and sends it to database. The next time Craft fetches your template, it looks to see if that output is already in the cache; If it is, it reaches for the cache. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-09-01T21:57:57.740" LastActivityDate="2015-09-01T21:57:57.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11280" PostTypeId="2" ParentId="11275" CreationDate="2015-09-01T22:04:36.550" Score="5" Body="&lt;p&gt;Is Craft mature enough? Probably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These very specific requirements are looking for a web application framework. There's no getting around that most of this will be custom code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't think of a CMS (primarily publishing platforms) that will get more than 5% of the way there. Drupal &lt;em&gt;maybe&lt;/em&gt; but the learning curve would probably offset the value and the technical debt would cost more later. The only solid piece of this a CMS gets you is a user registration and authentication system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like a Laravel app to me. It also sounds like something Laravel Spark promises to bridge the gap for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck!&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2015-09-01T22:04:36.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11281" PostTypeId="2" ParentId="11275" CreationDate="2015-09-01T23:16:49.550" Score="11" Body="&lt;p&gt;I think the other answers here are accurate in saying that this could very well be a use case for a more specific application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, I'm optimistic that this would be possible on Craft with enough planning, budget, and development time; and our own efforts while building out the Sprout Plugin Suite have had use cases like this in mind. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm going to try to answer how I'd approach this as a Craft project. There would be lots of questions to get answered along the way, so this is really just a very top level overview of where I'd start to look and ask questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll frame my answer around the plugins I'm most familiar with.  It's likely with the amount of custom development necessary, multiple plugins or starting points would take a similar amount of time.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. site visitors can search for rental units (on Map too)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this requirement, I'd look into &lt;a href=&quot;https://www.doublesecretagency.com/plugins/smart-map&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; and reach out to Lindsey DiLoreto if you have specific questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. tenants can pay rent online&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is possible in some form or another with &lt;a href=&quot;https://straightupcraft.com/craft-plugins/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt;, &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Commerce&lt;/a&gt;, and &lt;a href=&quot;https://buildwithcraft.com/commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce&lt;/a&gt;.  The latter two are in private and public beta as of this posting. Specific details would need to be explored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. tenants can make maintenance requests online&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fairly customized workflow is possible for this with normal Entries or &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt;, and &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt;. When an Entry for a particular Section is saved via an Entry Form, or an Entry for a Form is submitted via a Form, an event will fire and you can setup a Notification in Sprout Email to trigger emails to different people (admins and users) based on different types of maintenance requests.  You have full control over the custom HTML in your notification emails and can customize the message with the information from the submitted Entry or Form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any specific questions around Sprout Commerce, Sprout Email, or Sprout Forms, you can reach out to Barrel Strength Design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Views into your Element Listing Pages can be controlled via &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#element-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Hooks&lt;/a&gt; to help manage workflows and bring key information to the top level, such as the status of a request. For more specific needs, a plugin may be necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. landlords can look at their accounts (income, expenses, past due, etc)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be possible with default Craft functionality for a member section and you can pull data in from any native elements or any plugins that store their data in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. landlords, agents or admins can add new properties to the system&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is possible with the default Craft functionality and customizing Member Group permissions to your needs.  You'll need to build out the front-end interface, but all you need to allow people to submit data is there.  If you want to trigger email notifications when certain types of properties get added, Sprout Email has a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;customizable Event API&lt;/a&gt; so you could write or ask someone to write a custom plugin that allows emails to be triggered when certain conditions are met.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;6. landlords or agents can book showings&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's unclear to me if this ties in to Calendar needs as discussed in #9 or a more general Event question where you have a showing and many people can come. Craft is pretty powerful out of the box and more specific event needs would probably need to be described for a more specific answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;7. automated notifications/emails (rent due, maintenance complete, etc)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have automated notifications planned (at some point) for Sprout Email, and we've worked on a some projects where we have initial implementations of this behavior. Some custom development would be needed here, but it's possible, and the notifications could be managed right in Sprout Email to make their content easy to update and manage for a non-technical user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For things like notifying somebody when maintenance is complete, you could create a custom Email Event to allow you to trigger an email to the particular user who submitted the request when a maintenance work updates a custom field from one status to another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;8. lease document signing (DocuSign API or?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some Digital Signature programs allow you to embed certain document types on your website and allow them to be submitted by multiple people. I've seen various implementations of this functionality - however in my quick search around I'm not finding many examples that don't rely to some extent on the API.  I still believe they exist, but for now, my list to you is just this one:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.pandadoc.com/faqs/can-embed-template-website-viewers-sign&quot; rel=&quot;nofollow noreferrer&quot;&gt;PandaDoc&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;9. calendar to schedule maintenance&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few Calendar plugins to take a look at (in alphabetical order):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://solspace.com/craft/calendar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Calendar&lt;/a&gt; by Solspace&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://michaelrog.com/craft/calendars&quot; rel=&quot;nofollow noreferrer&quot;&gt;Calendars&lt;/a&gt; by Top Shelf Craft&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://tippingmedia.com/venti/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Venti&lt;/a&gt; by Tipping Media  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd recommend reaching out to each respective developer for specific questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;10. e-commerce and accounting integration (possibly Quickbooks and banks API)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably going to be the most challenging item to answer without a more detailed spec and understanding of what your budget is. Custom e-commerce and complex integrations, in general, take time to do well and get things right – especially when people are making decisions around the financial data and using that data to run the business.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Sprout Commerce and Craft Commerce are being built out with flexibility in mind, but I don't think either of them will be planning to integrate with Quickbooks, Xero, or banks before the more standard Commerce use cases are solved, if at all. It's likely what you're looking for here is a more custom integration targeted specifically at your accounting software and banks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your budget, you may want to consider alternative workflows here too that combine programmatic and manual steps.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It's worth noting that most of us plugin developers are pretty friendly, and if you found yourself in a situation where Calendars or SmartMap weren't communicating with Sprout Email in a way that allowed you to send notifications like you need to, or vice versa, we like hearing about it and learning how we can help make the whole plugin ecosystem play more nicely together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, I think these types of applications are a very fine line between custom application and CMS. On one hand, they are going to require customization and the app may be the better route.  On the other hand, enough components of the project revolve around general content management needs that a CMS like Craft already solves well and saves the trouble of managing your own admin UI and many other concepts that are already well established in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a project as complex as yours, it may be worthwhile to consider a hybrid approach too. It may be that 80% of your project is a really good fit for Craft and that it makes sense to outsource certain functionality like Scheduling or Commerce to another platform.  Over time, maybe there will be an opportunity to migrate those types of features to Craft at a lower cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of trade-offs like that are hard to make, but putting a price tag on your options helps you and your client choose the best approach for the current budget, and prioritize improvements down the road.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="45" LastEditDate="2018-07-23T04:18:31.290" LastActivityDate="2018-07-23T04:18:31.290" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11282" PostTypeId="2" ParentId="11274" CreationDate="2015-09-01T23:29:17.190" Score="0" Body="&lt;p&gt;I have a macro that I use for all images that falls back to our logo if an image is not supplied to it for whatever reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro imageTransform(image, transform, caption, extraHTML) %}&#xA;{# Fallback to our logo if the image is null... #}&#xA;{% if not image|length %}&#xA;    {% set image = craft.assets.id('84').first() %}&#xA;{% endif %}&#xA;&amp;lt;img src=&quot;{{ image.getUrl( transform ) }}&quot; width=&quot;{{ image.getWidth( transform ) }}&quot; height=&quot;{{ image.getHeight( transform ) }}&quot; title=&quot;{{ caption|default('') }}&quot; alt=&quot;{{ caption|default('') }}&quot;{% if extraHTML %} {{ extraHTML }}{% endif %}&amp;gt;    &#xA;{% endmacro %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is  a sample use of it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in imagesTable %}&#xA;    &amp;lt;div class=&quot;gallery-block__item&quot;&amp;gt;&#xA;        {% set image = row.image.first() %}             &#xA;        {% set caption = row.caption %}&#xA;        {% set transform = 'fit500By500' %}&#xA;        {% set extraHTML = &quot;class=gallery-block__item-image&quot; %}&#xA;        {{ imageLib.imageTransform( image, transform, caption, extraHTML) }}&#xA;        &amp;lt;span class=&quot;gallery-block__caption&quot;&amp;gt;{{ row.caption }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note the lack of quotes on the extraHTML BTW)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="27" LastEditDate="2015-09-02T03:52:24.803" LastActivityDate="2015-09-02T03:52:24.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11283" PostTypeId="2" ParentId="11275" CreationDate="2015-09-01T23:49:51.380" Score="2" Body="&lt;p&gt;I'd recommend Venti for the calendars&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/venti&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/venti&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-09-01T23:49:51.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11284" PostTypeId="2" ParentId="11275" CreationDate="2015-09-02T03:41:19.357" Score="2" Body="&lt;p&gt;I generally use an MVP approach in cases like this: if you reduce your product to the bare minimum needed to meet users needs and business objectives, is it a content-based website with some application features (CMS) or is it an application displaying some content (Custom app)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other important factor to consider is how the choice you will make will impact your ability to make the product evolve over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am in the camp that this type of projects would better be served by using frameworks like Laravel or Rails. As Ben said, using a simple plugin built on Guzzle, it's relatively easy to make Craft talk to API and display data for you.&lt;/p&gt;&#xA;" OwnerUserId="99" LastActivityDate="2015-09-02T03:41:19.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11285" PostTypeId="2" ParentId="11197" CreationDate="2015-09-02T05:04:03.150" Score="2" Body="&lt;p&gt;The Sprout Email Example Notification templates are designed to illustrate an example of the the Events that take place when a user is saved. They illustrate how to set custom variables for the User Events in both the Control Panel and in the template itself.  While in most cases, you won't need to customize things in both places, the example is meant to be illustrative of what is possible so you can decide what the best option is for your situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue here arises when the Notification in the Control Panel is updated to be triggered on a Entry-related event, instead of a User-related Event, and the same notification template is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Entry-related Event is fired, the User-specific template tries to access user-specific variables and a Twig processing error causes the template to err out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key thing to understand here is that, when Sprout Email fires an Event, it only has two types of variables available to the template you are using:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Information about the Notification Email itself, like the Subject Line. This info is available via the &lt;code&gt;entry&lt;/code&gt; object (i.e. &lt;code&gt;{{ entry.subjectLine }}&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Information about the Event the trigger is associated with.  This information may change depending on the Event you are using.  This info is always available via the &lt;code&gt;object&lt;/code&gt; variable (i.e. &lt;code&gt;{{ object.value }}&lt;/code&gt;), but the available values will differ based on the event.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To fix this issue, you need create templates for your Notification Email that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are built in a generic way so that they make no assumptions about what variables will be passed to the template.  If dynamic variables are needed, they can be handled directly in the fields within the Control Panel.&lt;/li&gt;&#xA;&lt;li&gt;Are designed to expect the right variables for the Event that they are being used for.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you run into trouble, try simplifying the templates you're using to hard-coded text.  Confirm that the Event is working as expected and that the Notification email is being fired as expected.  Once you confirm that, then try to add in variables in one by one and testing to confirm you're adding the variables correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Email creates a log file at &lt;code&gt;craft/storage/runtime/logs/sproutemail.log&lt;/code&gt;. You should see any template errors that may be happening there to help troubleshoot and diagnose what is happening.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-09-02T05:04:03.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11286" PostTypeId="1" CreationDate="2015-09-02T11:42:12.617" Score="0" ViewCount="117" Body="&lt;p&gt;I'm having issues accessing the Control Panel using an iPad on iOS 7.0.4. When loading the Dashboard and any subsequent pages, 6 popup alerts will appear with the message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Safari cannot open this page because the address is invalid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After dismissing this alert 6 times, it'll disappear until you visit another CP page. I can confirm that there are no issues using iOS 8.1.2. I've tested on numerous sites without any plugins installed, along with a brand new &lt;a href=&quot;https://demo.buildwithcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Demo site&lt;/a&gt;, and the issue persists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Acg2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Acg2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what could be causing this?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-09-04T00:13:02.270" Title="Issues accessing Control Panel with iPad on iOS 7" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2015-09-04T18:30:06.177" ContentLicense="CC BY-SA 3.0" />
  <row Id="11287" PostTypeId="1" AcceptedAnswerId="11289" CreationDate="2015-09-02T13:47:34.513" Score="3" ViewCount="282" Body="&lt;p&gt;I have a list of images that are loaded directly from the content of a specific asset folder.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.find({ folderId: 18, limit: 240, order: filename }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to achieve is that one (or more) images from that assets folder are listed first (second etc.) before the actual ordering by filename starts place. &#xA;Much in the same way as sticky entries (EE).&lt;/p&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2015-09-02T14:36:25.993" Title="Is there a way to create a &quot;sticky&quot; asset" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11289" PostTypeId="2" ParentId="11287" CreationDate="2015-09-02T14:19:44.937" Score="5" Body="&lt;p&gt;Add a lightswitch field to your assets and query for assets with the lightswitch enabled first. Use the &lt;code&gt;ids()&lt;/code&gt; method to get just the assets' IDs and merge them with the rest of your assets' IDs to have them all in your desired sort order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now query for the assets models by passing that IDs array to&#xA;the &lt;code&gt;id&lt;/code&gt; parameter and adding &lt;code&gt;fixedOrder(true)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stickyImagesIds = craft.assets({&#xA;    folderId: 18,&#xA;    order: filename&#xA;    sticky: true&#xA;}).ids() %}&#xA;&#xA;{% set regularImagesIds = craft.assets({&#xA;    folderId: 18,&#xA;    order: filename&#xA;}).ids() %}&#xA;&#xA;{% set allImagesIds = stickyImagesIds|merge(&#xA;    regularImagesIds|without(stickyImagesIds)&#xA;) %}&#xA;&#xA;{% set allImages = craft.assets.id(allImagesIds).fixedOrder(true).limit(240) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-02T14:19:44.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11290" PostTypeId="2" ParentId="11287" CreationDate="2015-09-02T14:36:25.993" Score="8" Body="&lt;p&gt;Based on adding a lightswicht (&quot;sticky&quot;) as suggested by &lt;a href=&quot;https://craftcms.stackexchange.com/users/125/carlcs&quot;&gt;@carlcs&lt;/a&gt; I think you should be able to solve this by just using two order fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets.folderId(18).order('sticky desc, filename asc').limit(240); %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should be able to save some twig code, maybe even requests. Haven't tested this though. &lt;/p&gt;&#xA;" OwnerUserId="149" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-02T14:36:25.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11291" PostTypeId="1" AcceptedAnswerId="11300" CreationDate="2015-09-02T14:45:14.333" Score="2" ViewCount="1635" Body="&lt;p&gt;I have a page on my website were I display alot of entries. Now I want those entries to be sorted by Date, Title etc. I know how to change that hard coded but I want to make it dynamic with a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt;. I guess I need to use Ajax for this but after a long search I still cant figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Select&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;select&amp;gt;&#xA;            &amp;lt;option value=&quot;{% set order = &quot;postDate asc&quot; %}&quot;&amp;gt;New - Old&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;{% set order = &quot;postDate desc&quot; %}&quot;&amp;gt;Old - New&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;{% set order = &quot;title asc&quot; %}&quot;&amp;gt;A-Z&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;{% set order = &quot;title desc&quot; %}&quot;&amp;gt;Z-A&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The loop&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set counter = 0 %}&#xA;        {% for entry in craft.entries.section('tips').order('{{ order }}') %}&#xA;            {% set counter = counter + 1 %}&#xA;            {% include 'includes/tip-blocks' %}&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To make the question short.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sort entries dynamicly through a select form. Prefer not to reload the page but, it's oke if it does.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2015-09-02T15:02:14.497" LastActivityDate="2015-09-03T07:39:33.563" Title="Sort / Order Entries on select or button click" Tags="&lt;entries&gt;&lt;forloop&gt;&lt;ajax&gt;&lt;ordering&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11292" PostTypeId="1" AcceptedAnswerId="11298" CreationDate="2015-09-02T15:34:57.693" Score="1" ViewCount="450" Body="&lt;p&gt;I'm trying to update a drop down field type on an entry using a front end form. However, the input is a hidden field (not a &lt;code&gt;select&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the form code I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;questions/{{ selectedSession }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ question.sectionId }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ question.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[questionStatus][]&quot; value=&quot;answered&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;questionStatus&lt;/code&gt; is my dropdown field handle.&#xA;Any insight would be appreciated&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have ensured that the account's user type has the necessary permissions to perform this operation&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-09-02T16:29:45.013" LastActivityDate="2015-09-02T22:12:02.723" Title="Front end entry form drop down field" Tags="&lt;form&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11293" PostTypeId="1" AcceptedAnswerId="11299" CreationDate="2015-09-02T19:05:05.130" Score="2" ViewCount="1705" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/418/how-do-i-reference-the-settings-of-my-plugin&quot;&gt;This question and answer&lt;/a&gt; explains how to access a plugin's settings from elsewhere in the plugin's PHP code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I access these settings from within a template? Or this impossible and I'd have to pass the values into the template when rendering it? ie, in a Controller action:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings();&#xA;$templateVars = array(&#xA;    'foo' =&amp;gt; $settings-&amp;gt;foo,&#xA;);&#xA;$this-&amp;gt;renderTemplate('myPlugin/templateName', $templateVars);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-12-11T19:29:37.687" Title="How do I reference the settings of my plugin from a template?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;settings&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11294" PostTypeId="1" AcceptedAnswerId="11295" CreationDate="2015-09-02T20:45:31.847" Score="0" ViewCount="570" Body="&lt;p&gt;I've read that you can set a variable inside of a loop, and set that same variable outside of the loop with &quot;&quot; to be able to use it outside of the loop. Although when attempting this, it is not working for me. Here is the code I am using (simplified for the purpose of troubleshooting):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %}&#xA;&#xA;{% if currentUser == user.username %}&#xA;&#xA;{# -- Set Excludes Expenses here as well, to use out of the loop -- #}&#xA;{% set excludedExpenses = &quot;&quot; %}&#xA;&#xA;    Excluded Expenses (Outside Loop): {{ excludedExpenses }}&amp;lt;br /&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;{{ dump(excludedExpenses) }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {# -- Get All Expense Entries -- #}&#xA;    {% set userExpenses = craft.entries.section('expenses').authorId(currentUser.id).limit(null) %}&#xA;&#xA;        {# --- Excluded Expenses Loop -- #}&#xA;        {% for expense in userExpenses if expense.excludeExpense.contains('Temporarily Exclude') %}&#xA;            {% set excludedExpenses = expense.expenseName %}&#xA;&#xA;            Excluded Expenses (Inside Loop): {{ excludedExpenses }}&#xA;&#xA;            &amp;lt;p&amp;gt;{{ dump(excludedExpenses) }}&amp;lt;/p&amp;gt; &#xA;&#xA;        {% endfor %}&#xA;        {# -- End Excluded Expenses Loop -- #}  &#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the result - &lt;a href=&quot;http://cl.ly/image/1Z2Q2r2Q102s&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/image/1Z2Q2r2Q102s&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variable is only being recognized and displayed inside of the loop. The actual variable I will use (beyond this simple test) is an integer. I tested with an integer variable and that failed also, so I am not sure if that would change anything for this example. Thanks in advance for any help you can give! :)&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2015-09-02T21:00:18.703" Title="Variable Not Available Outside of Loop" Tags="&lt;variable&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11295" PostTypeId="2" ParentId="11294" CreationDate="2015-09-02T20:56:44.377" Score="3" Body="&lt;p&gt;Your dump from outside the loop is being dumped BEFORE the variable is set within the loop. Move it to after the loop and try it again.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-09-02T20:56:44.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11296" PostTypeId="2" ParentId="11294" CreationDate="2015-09-02T21:00:18.703" Score="1" Body="&lt;p&gt;The output looks like what I'd expect it to be based on the code sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're saying that if you put:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Excluded Expenses (After Loop): {{ excludedExpenses }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...AFTER the end of the loop, it doesn't display 'Pets'?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-02T21:00:18.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11297" PostTypeId="2" ParentId="11293" CreationDate="2015-09-02T22:04:57.580" Score="1" Body="&lt;p&gt;From what I understand the only way to get plugin info back (in a template) is by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plugin = craft.plugins.getPlugin('PluginHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns an instance of &lt;code&gt;PluginVariable&lt;/code&gt; for your plugin, so you have access to any method detailed in &lt;code&gt;craft/app/variables/PluginVariable.php&lt;/code&gt; (&lt;a href=&quot;http://buildwithcraft.com/classreference/variables/PluginVariable&quot; rel=&quot;nofollow&quot;&gt;the craft class reference&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the &lt;code&gt;getSettings()&lt;/code&gt; function isn't exposed in this, so I don't think its possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could be wrong and there could be a way, but I couldn't figure it out from a quick look over the code :/&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-02T22:04:57.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11298" PostTypeId="2" ParentId="11292" CreationDate="2015-09-02T22:12:02.723" Score="3" Body="&lt;p&gt;I think you just need to get rid of the &lt;code&gt;[]&lt;/code&gt; on the field name, so your field becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[questionStatus]&quot; value=&quot;answered&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as the value is the same as the value in the dropdown, it should change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the issue you are getting is because you are telling the field that its value is an array, where you just need to pass the actual value as a string and Craft will figure out the rest :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-02T22:12:02.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11299" PostTypeId="2" ParentId="11293" CreationDate="2015-09-02T22:14:36.233" Score="4" Body="&lt;p&gt;Not sure if there's a build in way, but you can set up a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variable&lt;/a&gt; that returns the settings model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;    public function settings()&#xA;    {&#xA;        return craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then access it in your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set settings = craft.myPlugin.settings %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-02T22:14:36.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11300" PostTypeId="2" ParentId="11291" CreationDate="2015-09-02T22:41:18.350" Score="4" Body="&lt;p&gt;Okay so you can either do this through ajax or through a page reload, a page reload is going to be much easier, but you can get it to work without reloading the page...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reloading the page&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can basically make it so that when a user selects an option, use jQuery to redirect to the current page and append the &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; value to append as a query string, so your template could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;sortQuery&quot;&amp;gt;&#xA; &amp;lt;option value=&quot;postDate asc&quot;&amp;gt;New - Old&amp;lt;/option&amp;gt;&#xA; &amp;lt;option value=&quot;postDate desc&quot;&amp;gt;Old - New&amp;lt;/option&amp;gt;&#xA; &amp;lt;option value=&quot;title asc&quot;&amp;gt;A-Z&amp;lt;/option&amp;gt;&#xA; &amp;lt;option value=&quot;title desc&quot;&amp;gt;Z-A&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can do this in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderJs %}&#xA;  $(function(){&#xA;&#xA;    $('#sortQuery').on(&quot;change&quot;, function(e){&#xA;&#xA;     // Get the value from the select&#xA;     var filter = $(this).val();&#xA;&#xA;     // We can use twig because we are setting this in template, if you extracted this to its own file, you would need a different means to output the page url&#xA;     document.location.href = '{{ craft.request.getUrl() }}?order=' + filter;&#xA;&#xA;   });&#xA;&#xA;  });&#xA;{% endset %}&#xA;&#xA;{# let craft include the script to the end of our template #}&#xA;{% includeJs orderJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in your template file your code could be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set counter = 0 %}&#xA;&#xA;{# Either get the order from the query or use a default #}&#xA;{% set order = craft.request.getParam('order', 'title asc')  %}&#xA;&#xA;{% for entry in craft.entries.section('tips').order(order) %}&#xA;  {% set counter = counter + 1 %}&#xA;  {% include 'includes/tip-blocks' %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should then reload the request with the query string, craft will see it and update the response accordingly. I must stress this is untested, but it should work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Without reloading the page&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gets a little more complex and would involve more jQuery/Javascript than craft so I won't go into too much detail about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps are pretty much the same as above, except within the script tags (where you listen for a select change) you would make an &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow&quot;&gt;ajax request&lt;/a&gt; to either a html template (which contains the sorted results) or even using the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;ElementApi&lt;/a&gt; plugin to return json (from a template) which you can then iterate over in jQuery and then update your DOM accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps get you on track!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-09-03T07:39:33.563" LastActivityDate="2015-09-03T07:39:33.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11301" PostTypeId="2" ParentId="11286" CreationDate="2015-09-03T00:12:55.337" Score="1" Body="&lt;p&gt;As @RitterKnight points out, it does seem to be an issue with Garnish. I've managed to narrow it down to garnish-0.1.js:1020, which is to do with resize detection as adapted from &lt;a href=&quot;http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/&quot; rel=&quot;nofollow&quot;&gt;http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As one of the &lt;a href=&quot;http://fyre.it/tRMZHE.4&quot; rel=&quot;nofollow&quot;&gt;comments&lt;/a&gt; points out, changing the following line fixes the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var obj = elem.__resizeTrigger__ = document.createElement('object');&#xA;to&#xA;var obj = elem.__resizeTrigger__ = document.createElement('iframe');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this has any adverse effects on anything else, so would be keen to see if this is something already tested by the P&amp;amp;T team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; This has now been fixed in &lt;a href=&quot;http://buildwithcraft.com/updates#build2691&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4.2691&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2015-09-04T00:13:02.270" LastActivityDate="2015-09-04T00:13:02.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11303" PostTypeId="1" CreationDate="2015-09-03T06:01:31.173" Score="0" ViewCount="134" Body="&lt;p&gt;I know about &lt;code&gt;getPhotoUrl(size&lt;/code&gt;) but this always gives me a square. Is there any way of scaling/cropping the user photo? Let's say I want the photo 100x50, would that be possible? By looking at the code I think it's not, so the only option I can think of is every time the &lt;code&gt;onBeforeSaveUser&lt;/code&gt; is triggered, I mirror the user photo to an asset field. Any better ideas? &lt;/p&gt;&#xA;" OwnerUserId="1119" LastActivityDate="2015-09-03T06:01:31.173" Title="Resize User Photo" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;user-profile&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11304" PostTypeId="1" AcceptedAnswerId="11308" CreationDate="2015-09-03T09:28:17.263" Score="3" ViewCount="397" Body="&lt;p&gt;I have a Structure section &lt;code&gt;fruit&lt;/code&gt; with a single entry type &lt;code&gt;fruit&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a Category &lt;code&gt;fruitType&lt;/code&gt; with 2 levels: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Citrus&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Orange&lt;/li&gt;&#xA;&lt;li&gt;Lemon&lt;/li&gt;&#xA;&lt;li&gt;Lime&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Melons&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Watermelon&lt;/li&gt;&#xA;&lt;li&gt;Honeydew&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The entry type &lt;code&gt;fruit&lt;/code&gt; has a Category field for &lt;code&gt;fruitType&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I select a level 2 category for the &lt;code&gt;fruitType&lt;/code&gt; field, say &lt;code&gt;Orange&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fjMbi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fjMbi.png&quot; alt=&quot;Category Selection&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS dismisses the category selection pop-up and the parent category is shown instead, in this case &lt;code&gt;Citrus&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GiyDD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GiyDD.png&quot; alt=&quot;Resulting Category&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the browser's network inspector, I noticed that a POST request to &lt;code&gt;/admin/actions/elements/getCategoriesInputHtml&lt;/code&gt; with the following form data: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;categoryIds[]:893&#xA;locale:en_us&#xA;id:fields-fruitCategory&#xA;name:fields[fruitCategory]&#xA;limit:1&#xA;selectionLabel:Category&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the response from the server is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;html&quot;:&quot;&amp;lt;input type=\&quot;hidden\&quot; name=\&quot;fields[fruitCategory]\&quot; value=\&quot;\&quot;&amp;gt;\n\n&amp;lt;div id=\&quot;fields-fruitCategory\&quot; class=\&quot;categoriesfield\&quot;&amp;gt;\n\t&amp;lt;ul class=\&quot;elements structure\&quot;&amp;gt;\n\t\t\t\t\t&amp;lt;li id=\&quot;fields-fruitCategory-category-887\&quot;&amp;gt;\n\t\t\t\t\t\t\t\t&amp;lt;div class=\&quot;row\&quot; style=\&quot;margin-left: -0px; padding-left: 0px;\&quot;&amp;gt;&amp;lt;div class=\&quot;element removable\&quot; data-id=\&quot;887\&quot; data-locale=\&quot;en_us\&quot; data-status=\&quot;enabled\&quot; data-label=\&quot;Faculty\&quot; data-url=\&quot;http:\/\/craft.local\/fruit\/citrus\&quot; data-level=\&quot;1\&quot; data-editable&amp;gt;&amp;lt;input type=\&quot;hidden\&quot; name=\&quot;fields[fruitCategory][]\&quot; value=\&quot;887\&quot;&amp;gt;&amp;lt;a class=\&quot;delete icon\&quot; title=\&quot;Remove\&quot;&amp;gt;&amp;lt;\/a&amp;gt; &amp;lt;div class=\&quot;label\&quot;&amp;gt;&amp;lt;span class=\&quot;status enabled\&quot;&amp;gt;&amp;lt;\/span&amp;gt;&amp;lt;span class=\&quot;title\&quot;&amp;gt;Citrus&amp;lt;\/span&amp;gt;&amp;lt;\/div&amp;gt;&amp;lt;\/div&amp;gt;&amp;lt;\/div&amp;gt;\n\n\t\t\t\t\t\t\t&amp;lt;\/li&amp;gt;\n\t\t\t&amp;lt;\/ul&amp;gt;\n\n\t&amp;lt;div class=\&quot;btn add icon dashed\&quot;&amp;gt;Category&amp;lt;\/div&amp;gt;\n&amp;lt;\/div&amp;gt;\n\n&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on the response and what's rendered in the interface, Citrus is shown and not Orange, despite Orange being selected.&lt;/p&gt;&#xA;" OwnerUserId="4042" LastActivityDate="2016-12-21T13:51:38.210" Title="Cannot select subcategory field in entity" Tags="&lt;categories&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11305" PostTypeId="2" ParentId="11054" CreationDate="2015-09-03T10:35:17.030" Score="1" Body="&lt;p&gt;In my case it was caused by &lt;code&gt;session.handler = &quot;memcache&quot;&lt;/code&gt;. I changed it to &lt;code&gt;session.handler = &quot;files&quot;&lt;/code&gt; and made sure that &lt;code&gt;session.save_path&lt;/code&gt; was writable and the issue was gone. This obviously didn't fix the cause, but was good enough as a solution for me at that time.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-09-03T10:35:17.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11307" PostTypeId="1" CreationDate="2015-09-03T11:54:53.210" Score="2" ViewCount="244" Body="&lt;p&gt;Having a front-end user form where users can maintain there profile. I managed to get the single text and date field in the Matrix to be edited from the front-end but having issues with the select dropdown fields in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The select dropdown is build up correctly but selected values won't save, in fact the existing value is cleared after submitting the form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;mijnduikteam/gegevens/{{ currentUser.username }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userDivingCertification]&quot; value=&quot;&quot;&#xA;&#xA;        &amp;lt;div class=&quot;table-responsive&quot;&amp;gt;&#xA;            &amp;lt;table class=&quot;table table-striped&quot;&amp;gt;&#xA;                &amp;lt;thead&amp;gt;&#xA;                    &amp;lt;tr&amp;gt;&#xA;                        &amp;lt;th style=&quot;width: 20%;&quot;&amp;gt;Type&amp;lt;/th&amp;gt;&#xA;                        &amp;lt;th style=&quot;width: 15%;&quot;&amp;gt;Certificaat #&amp;lt;/th&amp;gt;&#xA;                        &amp;lt;th style=&quot;width: 20%;&quot;&amp;gt;Datum&amp;lt;/th&#xA;                    &amp;lt;/tr&amp;gt;&#xA;                &amp;lt;/thead&amp;gt;&#xA;                &amp;lt;tbody&amp;gt;&#xA;                    {% for block in currentUser.userDivingCertification.order('certificateDate desc') %}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][type]&quot; value=&quot;certifications&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;tr&amp;gt;&#xA;                            &amp;lt;td&amp;gt;&#xA;                                &amp;lt;select class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][fields][certificateType][]&quot;&amp;gt;&#xA;                                {% for option in block.certificateType.options %}&#xA;                                &amp;lt;option {% if option.selected %}selected=&quot;selected&quot;{% endif %} value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;                                {% endfor %}&#xA;                                &amp;lt;/select&amp;gt;&#xA;                            &amp;lt;/td&amp;gt;&#xA;                            &amp;lt;td&amp;gt;&#xA;                                &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;                                    &amp;lt;input class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][fields][certificateNumber]&quot; value=&quot;{{ block.certificateNumber }}&quot; &amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/td&amp;gt;&#xA;                            &amp;lt;td&amp;gt;&#xA;                                &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;                                    &amp;lt;input class=&quot;form-control&quot; type=&quot;text&quot; id=&quot;datetimepickerCertificate&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][fields][certificateDate][date]&quot; value=&quot;{{ block.certificateDate| date('d-m-Y') }}&quot; aria-describedby=&quot;basic-addon4&quot; &amp;gt;&#xA;                                &amp;lt;span class=&quot;input-group-addon&quot; id=&quot;basic-addon4&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-calendar&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/td&amp;gt;&#xA;                         &amp;lt;/tr&amp;gt;&#xA;                     {% endfor %}&#xA;                 &amp;lt;/tbody&amp;gt;&#xA;             &amp;lt;/table&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot; style=&quot;margin-top: 80px;&quot;&amp;gt;&#xA;                &amp;lt;input role=&quot;button&quot; class=&quot;btn btn-primary&quot; type=&quot;submit&quot; value=&quot;Wijziging bewaren&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="57" LastEditDate="2017-04-26T18:39:11.770" LastActivityDate="2017-04-26T18:39:11.770" Title="Edit select dropdown field in a Matrix on the front-end" Tags="&lt;matrix&gt;&lt;users&gt;&lt;form&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11308" PostTypeId="2" ParentId="11304" CreationDate="2015-09-03T12:10:59.183" Score="4" Body="&lt;p&gt;Unlike structured entries, when you relate a category to another element, its ancestors are also included in the relation. Due to &lt;a href=&quot;http://buildwithcraft.com/classreference/services/CategoriesService#fillGapsInCategoryIds-detail&quot; rel=&quot;nofollow&quot;&gt;the way Craft looks up these ancestors when relating the selected categories, to enforce this behaviour&lt;/a&gt;, the ancestors are added to the relation &lt;em&gt;before&lt;/em&gt; the one you selected, and it looks like you're limiting that Categories field to &lt;strong&gt;1&lt;/strong&gt;, so &lt;em&gt;only&lt;/em&gt; the parent is being added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting the limit on that Categories field to &lt;strong&gt;2&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-09-03T12:10:59.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11309" PostTypeId="1" CreationDate="2015-09-03T14:41:29.990" Score="0" ViewCount="114" Body="&lt;p&gt;Our web developers have setup and installed Craft on a VPS for a new website. When we fill out the contact us or Job application email recipient details; the emails never reach our email addresses, they also don't reach our messagelabs mail filter.&#xA;If I add another email address or a gmail account the emails are received just fine. I'm drawing a blank as to what the fault can be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On MX Lookup blacklist check our domain and public IP are all clear. I've configured an A record to the IP of the VPS on our hosted DNS service. The VPS support have tested emailing us from the VPS (not the CMS) and emails come through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there logs for Craft, is there a way I can see what's going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D&lt;/p&gt;&#xA;" OwnerUserId="4043" LastActivityDate="2015-09-22T11:12:51.243" Title="Not receiving emails from contact us and job application plugin to all email addresses on our domain" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11310" PostTypeId="2" ParentId="11309" CreationDate="2015-09-03T14:57:19.030" Score="1" Body="&lt;p&gt;As replied to the support ticket: Is the web server setup to handle emails locally for the domain (local delivery)? Your mail servers seem to live elsewhere so that could explain why you don't receive them yet gmail works fine.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-09-03T14:57:19.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11311" PostTypeId="1" AcceptedAnswerId="11313" CreationDate="2015-09-03T16:03:36.877" Score="2" ViewCount="2695" Body="&lt;p&gt;I am a little afraid to post this, but I'm running into an issue and haven't found a solution yet. I've been able to successfully remove the &quot;index.php&quot; from all my URLs, however I'm still finding that if I manually add &quot;index.php&quot; to any URL, I can still view the page and am not redirected to a URL without &quot;index.php&quot;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://domain.com/events/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works just fine, but if I visit &lt;code&gt;http://domain.com/index.php/events/&lt;/code&gt; I can still view the page. Any idea on how to force it to redirect me to just &lt;code&gt;http://domain.com/events/&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my .htaccess file for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ----------------------------------------------------------------------&#xA;# Remove index.php from URLs&#xA;# ----------------------------------------------------------------------&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;  RewriteEngine On&#xA;&#xA;  # Force trailing slash&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteRule ^(.*[^/])$ /$1/ [L,R=301]&#xA;&#xA;  # Force www&#xA;  RewriteCond %{HTTP_HOST} =domain.com [NC]&#xA;  RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]&#xA;&#xA;  # Send would-be 404 requests to Craft&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;  RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this even possible with Craft? Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="3551" LastActivityDate="2015-09-04T12:42:04.517" Title="Removing index.php from URL even after .htaccess updates?" Tags="&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11312" PostTypeId="1" AcceptedAnswerId="11364" CreationDate="2015-09-03T16:27:47.840" Score="0" ViewCount="1833" Body="&lt;p&gt;I've created a 'controllers' folder within the 'plugins' folder and a php file within that following the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also created the following form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;form method=&quot;POST&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;pluginName/controllerName/actionName&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Start poll&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I keep getting the 'Unable to resolve the request' error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea why this could be happening? Am I missing a step that's not in the documentation, like needing to register the url?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, the action only contains &lt;code&gt;$this-&amp;gt;redirect('');&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-09-08T10:19:59.707" Title="Error - Unable to resolve the request" Tags="&lt;controller&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11313" PostTypeId="2" ParentId="11311" CreationDate="2015-09-03T17:39:36.523" Score="2" Body="&lt;p&gt;There's nothing unique or special for doing this with Craft CMS - you should be able to use this method for just about any web app running in a LAMP stack. &lt;a href=&quot;https://stackoverflow.com/questions/9608366/remove-index-php-from-url-with-htaccess&quot;&gt;See this post on removing index.php from the URL with Apache/mod_rewrite/.htaccess&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TLDR: add this bit to the end of your .htaccess file before the closing  tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Craft's index.php is at the domain root, such as example.com/index.php, this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect to same url without index.php&#xA;RewriteCond %{THE_REQUEST} ^GET./index\.php(/.*)?$ [NC]&#xA;RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC]&#xA;RewriteRule ^index\.php(/(.*))?$ /$2 [R=302,NE,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it lives in a subfolder, do this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect to same url without index.php&#xA;RewriteCond %{THE_REQUEST} ^GET./subfolder/index\.php(/.*)?$ [NC]&#xA;RewriteCond %{REQUEST_URI} !^/subfolder/index\.php/admin\b [NC]&#xA;RewriteRule ^subfolder/index\.php(/(.*))?$ /$2 [R=302,NE,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(In both examples, replace &lt;code&gt;admin&lt;/code&gt; on the 2nd line with whatever your site’s &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP trigger&lt;/a&gt; is set to, if you’ve changed it.)&lt;/p&gt;&#xA;" OwnerUserId="776" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-09-03T20:21:38.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11314" PostTypeId="1" AcceptedAnswerId="11315" CreationDate="2015-09-03T17:39:44.287" Score="0" ViewCount="77" Body="&lt;p&gt;Can someone please help or advise me (I'm just starting to learn about Craft and setting up local servers. Sorry if this is a silly question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set up Craft Pro locally using MAMP. It worked yesterday just fine, but this morning I'm not able to access the admin side unless I go to &quot;localhost:80&quot;, (localhost:8888 worked yesterday, but doesn't today. Is says it can't connect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And even then, it's asking me to upgrade my license: &quot;You’re running Craft Pro with a Craft Personal license, downgrade/upgrade.&quot; I thought that as long as you were running things locally it's ok to continue with the pro test version? Does the test environment have an expiry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="4046" LastActivityDate="2015-09-03T19:54:55.027" Title="Craft pro test environment expires? Can no longer access test environment" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11315" PostTypeId="2" ParentId="11314" CreationDate="2015-09-03T19:54:55.027" Score="0" Body="&lt;p&gt;Are you using MAMP or MAMP Pro? If it was running on a different port yesterday (8888), then it sounds like you might have multiple installations. Try going over the additional resources posts &lt;a href=&quot;http://buildwithcraft.com/docs/installing#additional-resources&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; to verify your installation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;You’re running Craft Pro with a Craft Personal license, downgrade/upgrade.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Try clearing your &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-03T19:54:55.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11316" PostTypeId="1" AcceptedAnswerId="11346" CreationDate="2015-09-03T19:56:01.877" Score="1" ViewCount="1808" Body="&lt;p&gt;I have events that are presented by month.  Right now they are being separated by Month but the heading for each chunk shows January as the month for each one.  Not sure why, or how to fix it, am interested in understanding both.  I am somewhat new to craft.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;{% if entry.heading is defined %}&amp;lt;h1&amp;gt;{{ entry.heading }}&amp;lt;/h1&amp;gt;{% endif %}&#xA;&#xA;{% set allEntries = craft.entries.section('tours').find() %}&#xA;{% set allEntriesByMonth = allEntries|group('entryDate.month') %}&#xA;&#xA;{% for month, entriesInMonth in allEntriesByMonth %}&#xA;    &amp;lt;h2&amp;gt;{{entry.entryDate|date('M')}}&amp;lt;/h2&amp;gt;&#xA;        {% for entry in entriesInMonth %}&#xA;            &amp;lt;div class=&quot;row&quot; style=&quot;padding-bottom: 25px;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;div style=&quot;border-bottom: 1px solid #d4d4d4;width:100%;&quot;&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{entry.entryDate.month}}.{{entry.entryDate.day}}.{{entry.entryDate.year}}&amp;amp;nbsp;&amp;amp;nbsp;-&amp;amp;nbsp;&amp;amp;nbsp;{{entry.locationCity}}, {{entry.locationState}}&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;a href=&quot;/tours/{{entry.slug}}&quot; class=&quot;btn btn-primary btn-md&quot; style=&quot;float:right;&quot;&amp;gt;register&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}        &#xA;{% endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to adjust the &lt;code&gt;h2&lt;/code&gt; with &lt;code&gt;|date('M')&lt;/code&gt; in order to display the date as text.  If I do not do that it displays the correct month number, but when I try to format it it breaks and displays the same month for all entries even though it is still ordering them.  So how can I format this to show month as text without breaking it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any attempt to format the date breaks it. The dates below should be september and october.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pR9iU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pR9iU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="3817" LastEditDate="2015-09-04T20:35:11.040" LastActivityDate="2016-02-22T20:54:37.993" Title="How to properly format this date" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11317" PostTypeId="1" AcceptedAnswerId="11318" CreationDate="2015-09-03T21:16:18.763" Score="1" ViewCount="147" Body="&lt;p&gt;In my entry template I have the following...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry95 = entry.story1995 %}&#xA;{{ entry95.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this displays nothing. Debug mode is on and no errors are showing. The handle for the field is set properly. Other fields for the main entry are showing up, but nothing from this custom Entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out what I could be doing wrong here. &lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2015-09-03T21:23:07.703" Title="Why will my custom &quot;Entries&quot; field not display anything?" Tags="&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11318" PostTypeId="2" ParentId="11317" CreationDate="2015-09-03T21:23:07.703" Score="1" Body="&lt;p&gt;You need to put the entry in a for loop. Because even if there's only one entry linked to, it could still potentially be multiple entries!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry95 in entry.story1995 %}&#xA;    {{ entry95.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="333" LastActivityDate="2015-09-03T21:23:07.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11319" PostTypeId="1" CreationDate="2015-09-03T22:01:29.693" Score="0" ViewCount="858" Body="&lt;p&gt;I've developed my site locally and now need to migrate to staging. The Home page is displaying correctly so I would assume that a database connection is not the issue. But requesting &lt;code&gt;{staging_url}/{any_segment}&lt;/code&gt; results in a 500 Internal Server error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I'm setting the environment in &lt;code&gt;index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (substr($_SERVER['SERVER_NAME'], -strlen('.dev')) === '.dev') {&#xA;    define('CRAFT_ENVIRONMENT', 'development');&#xA;} else if ($_SERVER['SERVER_NAME'] == 'staging.blah.com') {&#xA;    define('CRAFT_ENVIRONMENT', 'staging');&#xA;} else {&#xA;    define('CRAFT_ENVIRONMENT', 'production');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'extraAllowedFileExtensions' =&amp;gt; 'vcf',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;    'development' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'siteUrl' =&amp;gt; 'http://blah.dev',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl' =&amp;gt; 'http://blah.dev',&#xA;        ),&#xA;    ),&#xA;    'staging' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://staging.blah.com',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl' =&amp;gt; 'http://staging.blah.com',&#xA;        ),&#xA;    ),&#xA;    'production' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://blah.com',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl' =&amp;gt; 'http://blah.com',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3954" LastEditorUserId="3954" LastEditDate="2015-09-04T02:23:10.363" LastActivityDate="2015-09-04T02:35:02.653" Title="After migration to staging, requesting any page other than Home results in 500 error" Tags="&lt;error-message&gt;&lt;install&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11320" PostTypeId="1" CreationDate="2015-09-03T22:08:35.970" Score="3" ViewCount="441" Body="&lt;p&gt;I've set up a new locale fr_ca according to the localization guide. &#xA;I've defined my site url's accordingly and set the files like so that english is on the top level and an fr_ca folder contains the index.php file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the craft folder accordingly, and defined CRAFT_LOCALE. &#xA;I've also enabled the locale in all my sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when i access a singles entry, and I click Canadian French on the right to switch locales, I get a Page Not Found error, the requested URL was not found on this server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also set my templates so that inside my templates folder, i have a folder fr_ca containing a new index.html file to be served. When I try to access the site from the front end, using www.example.com/fr_ca, I get an entry is not defined error (which makes sense). &lt;/p&gt;&#xA;" OwnerUserId="4047" LastActivityDate="2015-12-03T06:18:09.130" Title="Localization - Getting page not found from CP when trying to edit new locale" Tags="&lt;localization&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11321" PostTypeId="1" CreationDate="2015-09-03T22:17:32.523" Score="2" ViewCount="639" Body="&lt;p&gt;I got users that has 3 Entries fields in their profile: breadForMonday, breadForWednesday and breadForFriday.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to differentiate between users with 1, 2 or 3 selected entries. How would I use relatedTo together with and/or and :empty/:notempty?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bread = craft.entries({ section: 'bread' }).limit(null) %}&#xA;{# Find users that have selected entries for two out of three fields #}&#xA;{% set users = craft.users({&#xA;    group: 'customers',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: bread, field: 'breadForMonday' },&#xA;        { targetElement: bread, field: 'breadForWednesday' }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-10-04T08:48:30.220" Title="Using relatedTo, and/or and :empty/:notempty in queries" Tags="&lt;users&gt;&lt;relations&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11322" PostTypeId="2" ParentId="11319" CreationDate="2015-09-04T02:35:02.653" Score="2" Body="&lt;p&gt;This is solved by &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2545/urls-other-than-index-cause-500-internal-server-error&quot;&gt;this thread&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The common thread here is Rackspace Cloud Sites, which apparently needs a &lt;code&gt;RewriteBase /&lt;/code&gt; instruction in &lt;code&gt;.htaccess&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks @maxx and @christopher-healey&lt;/p&gt;&#xA;" OwnerUserId="3954" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-04T02:35:02.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11323" PostTypeId="1" AcceptedAnswerId="11325" CreationDate="2015-09-04T03:59:20.403" Score="1" ViewCount="396" Body="&lt;p&gt;OK so I got entries &lt;code&gt;articles&lt;/code&gt; with an asset field &lt;code&gt;documents&lt;/code&gt;.&lt;br&gt;&#xA;This asset field has an attribute called &lt;code&gt;docType&lt;/code&gt; which is a dropdown with 5 values (A, B, C, D, E).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I d like to select all &lt;code&gt;articles&lt;/code&gt; entries that have &lt;code&gt;documents&lt;/code&gt; with &lt;code&gt;docType=A&lt;/code&gt; criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I dot that?&lt;br&gt;&#xA;Should I make a &lt;code&gt;relatedTo&lt;/code&gt; selection?&#xA;I tried multiple things but nothing works.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-09-04T06:17:30.043" Title="Select all entries with asset field attribute criteria" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11324" PostTypeId="2" ParentId="11320" CreationDate="2015-09-04T04:05:11.103" Score="2" Body="&lt;p&gt;When a new locale is added to an existing site, Craft re-saves the entries in the background. If you're unable to edit the entry in the new locale, it would indicate that the task has not completed. Check the craft_tasks table in your database to see if this is the case. &lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;More info on stuck tasks here.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2015-09-04T04:05:11.103" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11325" PostTypeId="2" ParentId="11323" CreationDate="2015-09-04T06:17:30.043" Score="1" Body="&lt;p&gt;You can do it like &lt;a href=&quot;https://craftcms.stackexchange.com/q/129/125&quot;&gt;explained in this answer&lt;/a&gt;, only that you also add your dropdown field parameter to your &lt;code&gt;craft.assets&lt;/code&gt; criteria model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.docType('A').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('articles').relatedTo({&#xA;    targetElement: assets,&#xA;    field: 'documents'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-09-04T06:17:30.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11326" PostTypeId="2" ParentId="11321" CreationDate="2015-09-04T07:45:12.030" Score="3" Body="&lt;p&gt;Please don't laugh, but I thought to myself, let's give this a go in Twig and see where it takes me.&#xA;It very soon began to become clear, that this will end up in lots of criteria models, db queries and a huge pile of Twig code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my better answer should be, don't do it in Twig. This is something you should better do in PHP with&#xA;custom database queries (→ &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;Yii query builder&lt;/a&gt;). But now that I've done it, here's &lt;a href=&quot;https://gist.github.com/carlcs/adbb84b5521f7d010c8e&quot; rel=&quot;nofollow&quot;&gt;a gist&lt;/a&gt; of that Twig code.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-04T07:45:12.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11327" PostTypeId="2" ParentId="11316" CreationDate="2015-09-04T08:08:31.400" Score="2" Body="&lt;p&gt;Sounds to me like you need to use the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/format.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;format&lt;/a&gt; filter, I have helped another user out with it &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5111/how-do-i-format-the-date-and-time-i-got-from-an-entry/5112#5112&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to output the month as a name (January, February etc), you can use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;{{ entry.entryDate|format('F') }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-04T08:08:31.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11328" PostTypeId="2" ParentId="1654" CreationDate="2015-09-04T08:37:05.050" Score="7" Body="&lt;p&gt;I always write &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;migrations&lt;/a&gt; to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/boboldehampsink/50961639ee909b4ae89c&quot; rel=&quot;nofollow&quot;&gt;Here's&lt;/a&gt; and example for changing the label of a field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could, of course, do whatever you want - modify fieldlayouts, add/modify/remove fields, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nowadays I use the &lt;a href=&quot;https://github.com/itmundi/schematic&quot; rel=&quot;nofollow&quot;&gt;Schematic Plugin&lt;/a&gt; to transfer all kinds of settings (fields, fieldlayouts, settings etc.) over different setups.&lt;/p&gt;&#xA;" OwnerUserId="165" LastEditorUserId="165" LastEditDate="2015-11-07T14:11:53.847" LastActivityDate="2015-11-07T14:11:53.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11329" PostTypeId="1" AcceptedAnswerId="11330" CreationDate="2015-09-04T09:37:42.113" Score="0" ViewCount="137" Body="&lt;p&gt;None of the craft core console commands to work.&#xA;For example: &lt;code&gt;./yiic querygen all My_MyRecord&lt;/code&gt; produces an error which includes mention of &lt;code&gt;session&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get craft console commands working again?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-09-04T09:39:22.767" Title="Running a console command produces an error mentioning sessions. How do I resolve?" Tags="&lt;console&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11330" PostTypeId="2" ParentId="11329" CreationDate="2015-09-04T09:39:22.767" Score="1" Body="&lt;p&gt;You probably have a plugin which is listening to the &lt;code&gt;userSession.onLogin&lt;/code&gt; event and trying to access the current user from the session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is for the plugin developer to wrap the event listener to ignore console sessions like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if(!craft()-&amp;gt;isConsole())&#xA;    {&#xA;        craft()-&amp;gt;on('userSession.onLogin',&#xA;            [&#xA;                craft()-&amp;gt;market_customer,&#xA;                'loginHandler'&#xA;            ]&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-09-04T09:39:22.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11331" PostTypeId="1" AcceptedAnswerId="11343" CreationDate="2015-09-04T09:44:22.130" Score="0" ViewCount="382" Body="&lt;p&gt;I would like to extend the lifetime of the CraftSessionId cookie. Is this possible and if so, where can I change the value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="4049" LastActivityDate="2015-09-05T15:20:35.140" Title="Is it possible to extend the lifetime of the CraftSessionId cookie?" Tags="&lt;session&gt;&lt;cookies&gt;&lt;expiration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11332" PostTypeId="1" CreationDate="2015-09-04T10:53:04.063" Score="3" ViewCount="49" Body="&lt;p&gt;So my client has thrown a curve ball!  I've set-up a list of categories for the types of work they cover.  However, they DON'T want all of the categories to actually link to an entry.  In other words, they don't have content for some of the category pages, they would still like to SHOW the category on the front end but not have it clickable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, some category links are clickable, others not :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-09-04T12:31:26.637" Title="Have some categories NOT linked to a category entry" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11333" PostTypeId="2" ParentId="11332" CreationDate="2015-09-04T11:15:55.367" Score="2" Body="&lt;p&gt;I think I might have found a solution, although it might not be very elegant :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, i'm basically looking to see if a category field has content and then taking out the anchor in the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category.practiceIntroText|length %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;{% endif %}&#xA;{{ category.title }}&#xA;{% if category.practiceIntroText|length %}&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same code but making use of the ternary operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catWithContent = category.practiceIntroText|length %}&#xA;&#xA;{{ catWithContent ? '&amp;lt;a href=&quot;' ~ category.url ~ '&quot;&amp;gt;' }}&#xA;{{ category.title }}&#xA;{{ catWithContent ? '&amp;lt;/a&amp;gt;' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="189" LastEditorUserId="125" LastEditDate="2015-09-04T12:31:26.637" LastActivityDate="2015-09-04T12:31:26.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11334" PostTypeId="2" ParentId="11311" CreationDate="2015-09-04T12:42:04.517" Score="2" Body="&lt;p&gt;After playing around, I found a solution. I hope this helps anyone in the future:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ------------------------------------------------------------&#xA;# Remove index.php&#xA;# ------------------------------------------------------------&#xA;RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]&#xA;RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]&#xA;&#xA;# ----------------------------------------------------------------------&#xA;# Send would-be 404 requests to Craft&#xA;# ----------------------------------------------------------------------&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) /index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks, Nick for taking the time to help! It got me going in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="3551" LastActivityDate="2015-09-04T12:42:04.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11336" PostTypeId="1" AcceptedAnswerId="11337" CreationDate="2015-09-04T16:56:26.273" Score="2" ViewCount="125" Body="&lt;p&gt;Am considering Craft for multi lingual project that will use 6 languages including Arabic. Just how cumbersome does the admin of content become when localisation and translatable  are required for content types?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping to find some screen shots and get a basic idea of what it would look like from an administrators point of view.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-09-04T17:31:04.290" Title="How cumbersome is the content admin with 6 different languages" Tags="&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11337" PostTypeId="2" ParentId="11336" CreationDate="2015-09-04T17:31:04.290" Score="3" Body="&lt;p&gt;Have a look at &lt;a href=&quot;https://buildwithcraft.com/features/localization&quot; rel=&quot;nofollow&quot;&gt;the video&lt;/a&gt; about the localization feature on the Craft Feature page, this should give you a really good impression on how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's one thing though, that I'd really like to see improved: a way to see which content is still the same across all locales and a way to keep content of a field in sync after the first entry save. See this feature request: &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7187381-better-options-to-sync-content-across-locales&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7187381-better-options-to-sync-content-across-locales&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Altogether I really, really like how localization is done in Craft, it's actually the feature that made me aware of it (I had lots of trouble with Wordpress mulitsite etc.). And I'm also rather sure that we will see some nice improvement to it over time (Craft is still a new CMS).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-04T17:31:04.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11338" PostTypeId="1" CreationDate="2015-09-04T17:39:38.763" Score="0" ViewCount="2482" Body="&lt;p&gt;We just deployed Craft to Elastic Beanstalk running on a docker container. &#xA;When we revisit the site hours later at random it gives us a warning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP warning&lt;/p&gt;&#xA;&#xA;&lt;p&gt;include(/var/www/craft/app/vendor/guzzle/guzzle/src/Guzzle/Http/Client.php): failed to open stream: No such file or directory&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refreshing helps and load the application properly.&#xA;Has anybody stumbled with this and so yes would be great if you have some tips!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3940" LastActivityDate="2015-09-08T19:09:53.103" Title="PHP warning on Guzzle failed to open stream: No such file or directory" Tags="&lt;php&gt;&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11339" PostTypeId="2" ParentId="11316" CreationDate="2015-09-04T20:22:36.300" Score="2" Body="&lt;p&gt;You are using &lt;code&gt;entry&lt;/code&gt; for two different things. &lt;code&gt;&amp;lt;h2&amp;gt;{{entry.entryDate|date('M')}}&amp;lt;/h2&amp;gt;&lt;/code&gt; is the entry for the page, and will always be the same. &lt;code&gt;&amp;lt;p&amp;gt;{{entry.entryDate.month}}...&lt;/code&gt; is the current entry in &lt;code&gt;entriesInMonth&lt;/code&gt;, and will be different each time through the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is your current code with some of the html removed for simplicity, and some of the variable names changed for clarity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTours = craft.entries.section('tours').find() %}&#xA;{% set allToursByMonth = allTours|group('entryDate.month') %}&#xA;&#xA;{% for month, toursInMonth in allToursByMonth %}&#xA;    {# this entry will be the same every time around the loop #}&#xA;    &amp;lt;h2&amp;gt;{{entry.entryDate|date('M')}}&amp;lt;/h2&amp;gt;&#xA;    {% for tour in toursInMonth %}&#xA;        &amp;lt;p&amp;gt;{{tour.entryDate.month}}.{{tour.entryDate.day}}.{{tour.entryDate.year}}&amp;amp;nbsp;&amp;amp;nbsp;-&amp;amp;nbsp;&amp;amp;nbsp;{{tour.locationCity}}, {{tour.locationState}}&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;a href=&quot;/tours/{{tour.slug}}&quot; class=&quot;btn btn-primary btn-md&quot; style=&quot;float:right;&quot;&amp;gt;register&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    {% endfor %}        &#xA;{% endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Probably what you want to display in that &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; is the current &lt;code&gt;month&lt;/code&gt; from the outer &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;{{month|date('M')}}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-09-04T20:22:36.300" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11341" PostTypeId="1" AcceptedAnswerId="11342" CreationDate="2015-09-05T12:09:21.733" Score="2" ViewCount="723" Body="&lt;p&gt;I'm creating a site with Craft that needs to communicate with an existing database, which is separate from the database Craft will be installed on. My client is already using an existing online database to manage a bunch of their internal work, but I need to fetch some of that data for public display on the site. I don't need any relational queries between the two databases, so it's fine that they're separate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plan is to create a plugin that will create a new Record. Because BaseRecord extends Yii's CActiveRecord class, I should be able to override the getDbConnection() method to return a new CDbConnection object, which will connect to the external database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my first question is: Will that work, in theory? Or will Craft try to use my site's table prefix in this external database (which wouldn't work)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second concern is that Craft will associate the table returned by getTableName() in my new record as a table specific to this plugin, and will delete that table if the plugin ever gets uninstalled. Obviously since I'm dealing with an external database, I don't want that to happen. Is there any way around that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just came across this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8973/query-table-in-a-different-database&quot;&gt;Query table in a different database&lt;/a&gt;, and the solution there seems like it's a simpler option for me. I am still interested in learning the answers to my above questions though.&lt;/p&gt;&#xA;" OwnerUserId="228" LastEditorUserId="228" LastEditDate="2015-09-05T12:31:31.787" LastActivityDate="2015-09-05T15:05:34.820" Title="Dealing with existing data in a separate database" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11342" PostTypeId="2" ParentId="11341" CreationDate="2015-09-05T15:05:34.820" Score="2" Body="&lt;p&gt;I haven't tested, but I'm about 90% confident that Yii's CActiveRecord is directly coupled to the underlying &lt;code&gt;craft()-&amp;gt;db&lt;/code&gt; connection and there isn't a way to change that at runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're going to be better off going with the method in the answer you linked to and use QueryBuilder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-05T15:05:34.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11343" PostTypeId="2" ParentId="11331" CreationDate="2015-09-05T15:20:35.140" Score="1" Body="&lt;p&gt;Craft's &lt;code&gt;CraftSessionId&lt;/code&gt; cookie is simply the &lt;a href=&quot;https://secure.php.net/manual/en/function.session-name.php&quot; rel=&quot;nofollow&quot;&gt;PHP Session cookie&lt;/a&gt; renamed and by default it's terminated when the browser is closed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently doesn't expose any way to alter that behavior, but you can always make a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-05T15:20:35.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11344" PostTypeId="1" CreationDate="2015-09-05T17:03:51.660" Score="2" ViewCount="599" Body="&lt;p&gt;I'm trying to query up some entries based on a value inside an editable table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's two pictures on how it's set up:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.imgur.com/lJFcO1C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://i.imgur.com/lJFcO1C.png&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://i.imgur.com/Eqxg7Uh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://i.imgur.com/Eqxg7Uh.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current template (stripped) looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set courses = craft.entries({&#xA;    section: 'course',&#xA;    search: 'participants:31'&#xA;}) %}&#xA;&#xA;&#xA;&amp;lt;section class=&quot;user-dashboard&quot;&amp;gt;&#xA;&#xA;    &amp;lt;h1 class=&quot;user-dashboard__upcoming-title&quot;&amp;gt;&#xA;        Upcomming courses&#xA;    &amp;lt;/h1&amp;gt;&#xA;&#xA;    {% for course in courses %}&#xA;        {{course.title}} &amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried a couple of other parameters to the query, such as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;participants['col4']: '31'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;participants: '[&quot;col4&quot;]:31'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but almost no dice. I get a result, but it matches with all the other values as well. I only want it to match with &quot;userID&quot; column, aka col4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I get the same results if I try '1' instead of '31'.&lt;/p&gt;&#xA;" OwnerUserId="3717" LastActivityDate="2015-09-05T18:28:31.303" Title="How do I query for entries, based on a value inside a table?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11345" PostTypeId="2" ParentId="11344" CreationDate="2015-09-05T18:28:31.303" Score="3" Body="&lt;p&gt;Craft saves all the table's data serialized to a single cell in the database, so there's not really a good way to set query conditions to match something in a table field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do is to use Andre Elvan's brand new plugin &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse Field&lt;/a&gt;. With that you would add a new field to you entry type that does some predefined Twig logic on every entry save. So you could get that table cell's data you are interested in and write it to its own field that you could then use as a field parameter in your criteria model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way, and this is the approach I would actually recommend, is to refactor the whole setup and use a separate channel to hold each table row as its own entry (without URL) and than have an Entries field to relate those to your week / event entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third solution is a variant of the second one, but to use a Matrix field (or a SuperTable) instead of a separate channel. You would need to set up the query with Yi query builder from a custom little plugin. Let me know if you're interested in this solution and I can assist you in setting this up.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-05T18:28:31.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11346" PostTypeId="2" ParentId="11316" CreationDate="2015-09-06T19:58:01.843" Score="4" Body="&lt;p&gt;I would suggest to already format entryDate within the &lt;code&gt;group&lt;/code&gt; filter in the way you actually want to output it later.&#xA;To do that use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter (→ see all possible &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow&quot;&gt;formatting options&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('tours').find() %}&#xA;{% set allEntriesByMonth = allEntries|group('entryDate|date(&quot;F&quot;)') %}&#xA;&#xA;{% for month, entriesInMonth in allEntriesByMonth %}&#xA;    &amp;lt;h2&amp;gt;{{ month }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for entry in entriesInMonth %}&#xA;        &amp;lt;div&amp;gt;{{ entry.entryDate|date('m.d.Y') }}&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-09-06T19:58:01.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11347" PostTypeId="1" AcceptedAnswerId="11349" CreationDate="2015-09-07T12:21:10.147" Score="1" ViewCount="158" Body="&lt;p&gt;I'm building a site with loads of complex itineraries. Entries are in a channel for various reasons, but I want to split the data across subpages, with a URL structure like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/itinerary/name-of-itinerary&#xA;/itinerary/name-of-itinerary/dates-prices&#xA;/itinerary/name-of-itinerary/gallery&#xA;/itinerary/name-of-itinerary/etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to route everything through my &lt;code&gt;_views/itinerary/index&lt;/code&gt; template, and then just have a bunch of includes (dates-prices, gallery, etc...) in my index, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ( '_views/itinerary/' ~ craft.request.lastSegment ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my routes.php I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'itinerary\/(?P&amp;lt;slug&amp;gt;[^\/]+)\/([^\/]+)'                 =&amp;gt; '_views/itinerary',&#xA;'itinerary\/(?P&amp;lt;slug&amp;gt;[^\/]+)'                           =&amp;gt; '_views/itinerary',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So everything is routing fine to &lt;code&gt;_views/itinerary/index&lt;/code&gt;. Trouble is, I get a 404 for anything other than &lt;em&gt;/itinerary/name-of-itinerary&lt;/em&gt; because Craft uses the last segment to resolve the entry, which is exactly what you'd want normally. But if the last segment is 'dates-prices' or 'gallery' I'm screwed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I set this up right? Is there a more efficient and complete way? Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2015-09-07T14:02:35.233" Title="Routes to fake a Structure" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11348" PostTypeId="1" CreationDate="2015-09-07T13:36:02.043" Score="3" ViewCount="307" Body="&lt;p&gt;I have a structure section that is driving the majority of a site, which works great with multiple entry types letting us handle different needs across different areas of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client now wants a new user group that can only access pages in one particular area of the site. as user group access is tied to sections without granular control of entry types within each section, that means we need a wholesale refactor of the way the site is built and managed, which is going to be a real headache at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have any approaches for this?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-09-08T00:23:56.113" Title="Can Section access be restricted at Entry Type level?" Tags="&lt;users&gt;&lt;sections&gt;&lt;entry-type&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11349" PostTypeId="2" ParentId="11347" CreationDate="2015-09-07T14:02:35.233" Score="3" Body="&lt;p&gt;The route/template for '/itinerary/name-of-itinerary' will be defined in the section's settings, so it's the others you need to deal with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd add this route to your routes.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'itinerary/(?P&amp;lt;entrySlug&amp;gt;[-\w]+)/(?P&amp;lt;subpageSlug&amp;gt;(dates-prices|gallery|etc))' =&amp;gt; '_views/itinerary/index',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in '_views/itinerary/index' I'd include these conditionals:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.section('itineraries').slug(entrySlug).first() %}&#xA;{% endif %}&#xA;&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On your subpages, the entry model object won't be available by default so you need to check whether it's defined, and if not define it.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-09-07T14:02:35.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11350" PostTypeId="1" AcceptedAnswerId="11353" CreationDate="2015-09-07T14:08:44.990" Score="2" ViewCount="981" Body="&lt;p&gt;I need to create a hierarchy that looks something to the effect of&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;parent 1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;parent 1 child 1&lt;/li&gt;&#xA;&lt;li&gt;parent 1 child 2&lt;/li&gt;&#xA;&lt;li&gt;parent 1 child 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;parent 2&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;parent 2 child 1&lt;/li&gt;&#xA;&lt;li&gt;parent 2 child 2&lt;/li&gt;&#xA;&lt;li&gt;parent 2 child 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and so on. My initial thinking was to use the matrix field type....a lot but, unfortunately, a matrix field can't have child fields of matrix field, and each child will need a matrix due to not knowing how many items each one could have as well as keeping them all together and allow for easy reordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other requirement is that a &quot;child&quot; can't exist without a &quot;parent&quot;, so I essentially only want to allow a user to create a &quot;parent&quot; at the root level and &quot;child&quot; types under each parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible in Craft? If it is, could you point me in the direction of where it's documented as I can't seem to find anything that resembles what I'm trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2017-05-03T19:40:23.330" Title="Structure Entry Item's Parent" Tags="&lt;structure&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11351" PostTypeId="2" ParentId="10617" CreationDate="2015-09-07T14:58:37.543" Score="2" Body="&lt;p&gt;we ran into the same problem. If you remove &quot;admin&quot; on line 12 of /plugins/formbuilder/resources/js/formbuilder-form.js it works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;url = '/actions/' + $(this).children('[name=action]').attr('value');&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We couldn't figure out why the path leads to something which is only accessible with admin-rights.&lt;/p&gt;&#xA;" OwnerUserId="4020" LastActivityDate="2015-09-07T14:58:37.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11352" PostTypeId="2" ParentId="11350" CreationDate="2015-09-07T15:12:40.187" Score="1" Body="&lt;p&gt;It's possible I'm misunderstanding, but aren't you just looking for a &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow&quot;&gt;Structure Section&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's like a Channel except that it allows for both order and hierarchy.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-07T15:12:40.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11353" PostTypeId="2" ParentId="11350" CreationDate="2015-09-07T16:24:53.130" Score="2" Body="&lt;p&gt;I came up with a less than ideal workout, but it's still somewhat of a solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first created a channel to contain all of the &quot;child&quot; entry types. This allowed each one to have a matrix property to account for the dynamic creation of the &quot;child&quot; fields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then created another channel with an entry type that also contains an Entry select field which allows for unlimited selection of Entries of the &quot;child&quot; types&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-09-11T10:55:40.790" LastActivityDate="2015-09-11T10:55:40.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11354" PostTypeId="1" AcceptedAnswerId="11357" CreationDate="2015-09-07T17:01:31.393" Score="4" ViewCount="2556" Body="&lt;p&gt;How should I go about passing multiple parameters to the Element API? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scenario is that I would like to display all my categories for a given section in a form, and allow the user to select categories, and send them to the API. I would like to receive back a json object of all the entries that have the categories assigned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware that I can dynamically catch url segments, but I'm not understanding how I would pass something like a GET parameter as a segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="3678" LastActivityDate="2016-06-06T13:41:42.903" Title="Passing multiple parameters to the Element API" Tags="&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11355" PostTypeId="1" AcceptedAnswerId="11356" CreationDate="2015-09-07T17:59:24.147" Score="2" ViewCount="252" Body="&lt;p&gt;This is the setup: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix field called Breads. There is 1 block called Bread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within, I have two fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An Entries field called Selected bread (limited to 1 entry)&lt;/li&gt;&#xA;&lt;li&gt;A Number field called Quantity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Lets say I have 3 rows. Row 1 and 3 have the same entry selected, but different quantities. Is there a way to group by the Bread entry id, but get the different quantities?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is to consider all entries with same id as &quot;one&quot;, and to make it easy to sum them together.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2015-09-07T18:06:46.663" LastActivityDate="2015-09-07T18:11:29.997" Title="Outputting Matrix blocks with grouped values based on Entries field id" Tags="&lt;matrix&gt;&lt;entries-field&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11356" PostTypeId="2" ParentId="11355" CreationDate="2015-09-07T18:11:29.997" Score="4" Body="&lt;p&gt;Try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set breadGroups = entry.breads | group('bread.first.id') %}&#xA;&#xA;{% for breadId, blocks in breadGroups %}&#xA;&#xA;    {% set sum = 0 %}&#xA;&#xA;    {% for block in blocks %}&#xA;&#xA;        {% set sum = sum + block.quantity %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    Total qty for Bread ID {{ breadId }}: {{ sum }}&#xA;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;group&lt;/code&gt; filter consumes a list &amp;mdash; in this base, an array of Matrix blocks &amp;mdash; and produces an array of arrays where the &lt;em&gt;key&lt;/em&gt; is the grouping parameter, and the &lt;em&gt;value&lt;/em&gt; is an array of items from the original list for which the group criteria matches the key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;c.f.&lt;/em&gt; Craft docs: &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#group&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/templating/filters#group&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-09-07T18:11:29.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11357" PostTypeId="2" ParentId="11354" CreationDate="2015-09-07T18:34:31.633" Score="7" Body="&lt;p&gt;You can fetch GET parameters using &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getQuery-detail&quot;&gt;HttpRequestService::getQuery()&lt;/a&gt; or &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getRequiredQuery-detail&quot;&gt;getRequiredQuery()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'entries-by-category' =&amp;gt; function() {&#xA;    $categoryIds = craft()-&amp;gt;request-&amp;gt;getRequiredQuery('categoryIds');&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $categoryIds],&#xA;        ],&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-09-07T18:34:31.633" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11358" PostTypeId="2" ParentId="11222" CreationDate="2015-09-07T21:39:40.017" Score="2" Body="&lt;p&gt;You can tell Craft to generate new image transforms right when &lt;a href=&quot;http://buildwithcraft.com/classreference/models/AssetFileModel#getUrl-detail&quot; rel=&quot;nofollow&quot;&gt;getUrl()&lt;/a&gt; is called by setting the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;nofollow&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; config setting to &lt;code&gt;true&lt;/code&gt;. Assuming you still want the default behavior on your main website, you can set the setting programatically from your endpoint config with &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ConfigService#set-detail&quot; rel=&quot;nofollow&quot;&gt;ConfigService::set()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'endpoint/path' =&amp;gt; function() {&#xA;    craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;&#xA;    return [&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-09-08T12:16:22.607" LastActivityDate="2015-09-08T12:16:22.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11359" PostTypeId="2" ParentId="11350" CreationDate="2015-09-07T23:31:34.370" Score="2" Body="&lt;p&gt;Sounds like a feature request for maximum number of levels in a structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But had a thought about this. Since structures have a &lt;code&gt;level&lt;/code&gt; parameter, you could make a simple plugin to more or less restrict the number of levels you can have a structure.  If it's more than 1, then set the page's parent to the top most parent, effectively limiting it to have that parent/child relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, that'll only work on a &quot;regular&quot; entry save. If you move structures up and down in the admin—when not editing an entry— it looks like Craft doesn't call the &lt;code&gt;onSave&lt;/code&gt; or &lt;code&gt;onBeforeSave&lt;/code&gt; events. Bug perhaps?&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-09-07T23:31:34.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11360" PostTypeId="2" ParentId="11348" CreationDate="2015-09-08T00:23:56.113" Score="2" Body="&lt;p&gt;When you mention new user group, is that a new group of admins/back end users or just people browsing on the front end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's on the front end, just checking the logged in user's group in twig against a new restricted entry type could give you want you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == &quot;restrictedEntryType&quot; and currentUser and currentUser.isInGroup('newUserGroup') %}&#xA;&#xA;   {# let them through #}&#xA;   {% include &quot;whatever/restricted_content.html&quot; %}&#xA;&#xA;{% else %}&#xA;   &amp;lt;p&amp;gt;Thou shall not pass! You need to log in to see this content.&amp;lt;/p&amp;gt;&#xA;{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it's the back end, like you said, you'd have to do a serious refactor to manage it properly. Put all the restricted content in one structure and only give access to admins/users you want to have edit the content.  You may end up doing that anyway just to keep everything sane, depending on how siphoned off your content is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To move a structure from one section to another, check out &lt;a href=&quot;https://craftcms.stackexchange.com/a/4467/1016&quot;&gt;Brandon Kelly's canonical answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-08T00:23:56.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11361" PostTypeId="1" CreationDate="2015-09-08T02:38:31.520" Score="1" ViewCount="1285" Body="&lt;p&gt;I'm learning how to use Craft. I've set it up locally using MAMP (regular) on OS X Yosemite (10.10.5). Everything is working fine until I start getting into Twig templates. When I try viewing files that contain twig code in any browser, the browser shows the twig code as content (for example, I see&lt;code&gt;{% block main %}&lt;/code&gt; and &lt;code&gt;{# comments #}&lt;/code&gt; within the window). I'm thinking this is a MAMP issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I understand it, Craft itself uses Twig. If that's the case, then it wouldn't be a MAMP issue, since then both the Craft admin site and my files wouldn't work. Any hints as to where the problem lies would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Trying to access it through MAMP Pro to see if that makes a difference. Now I'm being blocked right after the root. Here's a pic of the error (result with localhost in the URL not the file path):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fEwyc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fEwyc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know anything about Apache -- is it safe to display my entire httpd.conf code online to see if anyone knows it's a setting in that files that's causing the issue? I'm sorry -- this question/thread is all over the place.&lt;/p&gt;&#xA;" OwnerUserId="4046" LastEditorUserId="4046" LastEditDate="2015-09-11T19:28:00.397" LastActivityDate="2015-10-07T07:17:38.873" Title="Twig code showing in browser" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11362" PostTypeId="1" AcceptedAnswerId="11378" CreationDate="2015-09-08T07:00:25.043" Score="1" ViewCount="119" Body="&lt;p&gt;I have a Craft website that has become quite big with several dozen sections and many templates - my first bigish Craft site - being a local government one with more than a thousand pages, forms and assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Task Icon (I think is its name) had indicated there were uncompleted tasks and this has been stuck there for a couple of months while the site was being built and there have been many content and structure updates during this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually I got around to attending to the issue after several half hearted attempts at finding out &quot;what that stupid circle meant&quot; (embarrassed much). A few minutes ago I followed the instructions at &lt;a href=&quot;http://buildwithcraft.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/stuck-tasks&lt;/a&gt; and the task list was released like opening a flood gate - &quot;hundreds&quot;(?) of them suddenly ran, mostly &quot;Resaving Meetings entries&quot;, Meetings being one of my sections, &quot;Importing csv files&quot; (which had consistently failed before, I now know why) plus &quot;Updating element slugs and URIs&quot;. Also &quot;Deleting stale template caches&quot; which might explain another headache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now wondering if this will likely have any undesired impact on the site content given that I am now worried about old data replacing the new  via Imports, Resaving, and Updating that has carried on. I'm not a content editor on the site so I am not too familiar with what should be the right data set and business only opens again in about 12 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone advise on what these tasks might do if run as a &lt;em&gt;very&lt;/em&gt; delayed process?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-09-08T20:47:15.273" Title="Implication of old task backlog suddenly being released" Tags="&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11363" PostTypeId="2" ParentId="11361" CreationDate="2015-09-08T09:05:13.830" Score="4" Body="&lt;p&gt;Are you opening those templates directly in the browser? When you do this, you are bypassing Craft and the browser does not know what to do with the Craft tags or how to access the database and will show the tags instead of the contents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have got the CP working, all should be good though. If you go to the CP and click on your bold site name at the top left in the nav,  the default homepage (or yours) should get loaded. What you actually see there is the &lt;code&gt;index.html&lt;/code&gt; loaded into the &lt;code&gt;_layout.html&lt;/code&gt; and you should not get any twig template tags. If you go ahead now and add some made-up segment to the address in the address field of the browser &lt;code&gt;/xyz&lt;/code&gt; e.g., you will see the &lt;code&gt;404.html&lt;/code&gt; loaded into &lt;code&gt;_layout.html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see your templates like your visitors will see them, Craft needs to kick in. This will only happen, if you enter a pages complete url in the browser, not a template location on your disk. (If you opended the templates directly, your address will look somethin like &lt;code&gt;file:///Applications/MAMP/htdocs…&lt;/code&gt; which will not work. Visible or not, your address should always begin with &lt;code&gt;http:// …&lt;/code&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you still got the default news section in the install? You could add 2 or 3 dummy news in the CP, and then navigate to those news entries as described above. The template that gets used to display a single news is &lt;code&gt;news/_entry.html&lt;/code&gt; but &lt;code&gt;_entry.html&lt;/code&gt; will never be part of the url. It is used by Craft to fill in the contents and your urls will be somtheing like &lt;code&gt;news/dummy-news1&lt;/code&gt;, &lt;code&gt;news/dummy-news2&lt;/code&gt;. Hope that makes it a bit clearer?&lt;/p&gt;&#xA;" OwnerUserId="549" LastEditorUserId="643" LastEditDate="2015-09-08T10:48:44.623" LastActivityDate="2015-09-08T10:48:44.623" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11364" PostTypeId="2" ParentId="11312" CreationDate="2015-09-08T10:19:59.707" Score="3" Body="&lt;p&gt;As I thought, I was just being silly. I initially didn't realise that custom controllers need to be encapsulated within a custom plugin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess my mistake was going directly to the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controllers&lt;/a&gt; documentation and missing the line that says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To create a controller, first create a new controllers/ subfolder within your plugin’s folder&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hopefully anyone who runs into this (doubtful as I can imagine most, unlike me, will probably read the documentation properly) will find it somewhat useful&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-09-08T10:19:59.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11365" PostTypeId="1" CreationDate="2015-09-08T11:56:16.903" Score="3" ViewCount="527" Body="&lt;p&gt;We have a site where we use lots of &lt;code&gt;{% cache %}&lt;/code&gt; tags. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we almost constantly have a &quot;cleaning template cache&quot; task running, and they often get stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manual DB intervention and resetting the stuck task to status &lt;code&gt;pending&lt;/code&gt;, will sometimes make it move again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the various solution here, but nothing helps: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8237/deletestaletemplatecaches-job-getting-stuck&quot;&gt;DeleteStaleTemplateCaches job getting stuck&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also - there are no error entries in craft.log or phperrors.log when it gets stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the &lt;code&gt;craft_templatecaches&lt;/code&gt; table I find lots of duplicate looking entries: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;select id,locale, cacheKey, expiryDate, path from craft_templatecaches;&#xA;&#xA;...&#xA;| 685607 | nb     | zDzBdD8bc1y4pf9Sx2HFyL3i24YypSp2sAq5 | 2015-09-08 08:23:21 | site:kompetansetilbud/ny-i-hr-rollen-i-trondheim-10013                                   |&#xA;| 685610 | nb     | TMz4eh7FPiINSUixwkpXb0SlkHnZ3b5TSgXm | 2015-09-08 08:23:22 | site:kompetansetilbud/ny-i-hr-rollen-i-trondheim-10013                                   |&#xA;| 685611 | nb     | HgLIHHgf56nM1ggOdTmaLlaylu5JeOeM1dNm | 2015-09-08 08:23:23 | site:kompetansetilbud/ny-i-hr-rollen-i-trondheim-10013                                   |&#xA;| 685612 | nb     | SLHUKfUz2fF5Jmpy0kWPpvMxFBHH8PvlVJEt | 2015-09-08 08:23:25 | site:kompetansetilbud/ny-i-hr-rollen-i-trondheim-10013                                   |&#xA;| 685614 | nb     | oEU6fe1tGc7MdI8WSQIXsf2wZZd9qmXG8P9H | 2015-09-08 08:23:26 | site:kompetansetilbud/ny-i-hr-rollen-i-trondheim-10013                                   |&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this normal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything else I can do to debug why the task gets stuck? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using keyed and global caching reduced the size of the &lt;code&gt;craft_templatecaches&lt;/code&gt; table from ~20k rows to ~300. However, this did not stop the task getting stuck. &lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-11T09:23:18.270" Title="Massive template cache cleaning tasks always get stuck" Tags="&lt;cache&gt;&lt;caching&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11366" PostTypeId="1" AcceptedAnswerId="11375" CreationDate="2015-09-08T12:26:28.943" Score="3" ViewCount="3355" Body="&lt;p&gt;I need to export all content from a Website to be translated by a translation company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some sort of content export plugin who exports the content into a readable form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is to give the translators access to the control panel. But I'm a bit hesitant about this. Translators shouldn't fight with matrix fields and such, I guess.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-09-08T17:40:00.227" Title="Export Craft Data" Tags="&lt;plugins&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11367" PostTypeId="1" CreationDate="2015-09-08T12:56:03.933" Score="0" ViewCount="150" Body="&lt;p&gt;I'm trying to find the best way to let expired entries display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client has jobs that are filled / expire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical job url looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://flourish-uk.com/jobs/sous-chef-maidstone-20881&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://flourish-uk.com/jobs/sous-chef-maidstone-20881&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the section settings I've got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry URL format set to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;jobs/{jobTitle|kebab}-{jobCity|kebab}-{jobId|kebab}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the entry template set to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;jobs/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works great. When a job expires/entry expires it no longer appears, but of course the google index remains and so I'd like the page to still 'exist' rather than redirect to a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done a bit of work with the 404 so that the /jobs/ part is recognised in the URL and I change the content, as well as fetch expired job data, such as the jobTitle and integrate it into the content. The problem is, Google still sees a 404 page, and the content of the page is different which will invariably create some negative page rank issues given the number of expired jobs that are accruing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So rather than a 404, I'd like the expired:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/jobs/sous-chef-maidstone-20881&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry to go to the _entry template and show the original unexpired layout (albeit with some tweaks to explain the job has expired).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But despite following the details found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8226/is-it-possible-to-view-expired-entrys-on-the-front-end/8228#8228&quot;&gt;Is it possible to view &amp;#39;Expired&amp;#39; entrys on the front end?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The _entry still redirects to the 404 page when an entry is expired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to stop this so I can perform some .status('expired') voodoo on it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-09-08T12:56:03.933" Title="How can I stop expired entries appearing as 404" Tags="&lt;404&gt;&lt;seo&gt;&lt;expired&gt;" AnswerCount="0" CommentCount="17" ClosedDate="2015-09-09T14:23:12.250" ContentLicense="CC BY-SA 3.0" />
  <row Id="11368" PostTypeId="1" AcceptedAnswerId="11429" CreationDate="2015-09-08T13:06:32.333" Score="0" ViewCount="518" Body="&lt;p&gt;I've got a custom plugin where I'm trying to update a global variable. The variable field type is of type &lt;code&gt;Entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting the set using &lt;code&gt;getSetByHandle&lt;/code&gt; then using &lt;code&gt;getContent&lt;/code&gt; on the set. However, when I do a &lt;code&gt;count&lt;/code&gt; on the retrieved content, the value is 1. I have about 10 global variables so would've expected a &lt;code&gt;count&lt;/code&gt; of 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm clearly doing something wrong, so a nudge in the right direction would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm currently using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$global_set = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('globalVariables');&#xA;$selected_poll = craft()-&amp;gt;entries-&amp;gt;getEntryById($poll_id);&#xA;$content = $global_set-&amp;gt;getContent();&#xA;craft()-&amp;gt;globals-&amp;gt;saveSet($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried the following, with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$globalSet = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('tempSet');&#xA;$content = $globalSet-&amp;gt;getContent();&#xA;$content-&amp;gt;currentItem = craft()-&amp;gt;entries-&amp;gt;getEntryById($itemID);&#xA;$globalSet-&amp;gt;setContent($content);&#xA;craft()-&amp;gt;globals-&amp;gt;saveContent($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-09-21T14:09:17.843" LastActivityDate="2015-09-24T09:34:30.620" Title="Update Global Variables" Tags="&lt;plugin-development&gt;&lt;globals&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11369" PostTypeId="1" AcceptedAnswerId="11376" CreationDate="2015-09-08T13:50:15.767" Score="2" ViewCount="452" Body="&lt;p&gt;We're trying to setup a category field type to allow the selection of 1 category but from multiple category sources. Is there a simple way to achieve this without writing a custom plugin / fieldtype?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently we've set up 4 Category fields to allow a selection from the 4 sources with instructions to only use one of these fields at a time but it feels messy.  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2015-09-08T18:52:11.260" Title="Multiple sources on category field type - possible?" Tags="&lt;categories&gt;&lt;fieldtypes&gt;&lt;category&gt;&lt;sources&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11370" PostTypeId="1" AcceptedAnswerId="11384" CreationDate="2015-09-08T15:01:41.270" Score="1" ViewCount="164" Body="&lt;p&gt;Does anybody know if it's possible to CC people on Sprout Forms notifications? I know I can add multiple email addresses to the notify field, but ideally, I would like to CC someone.&lt;/p&gt;&#xA;" OwnerUserId="4061" LastActivityDate="2018-12-13T01:22:31.180" Title="Sprout Forms CC" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11371" PostTypeId="1" AcceptedAnswerId="11392" CreationDate="2015-09-08T15:16:14.053" Score="1" ViewCount="1039" Body="&lt;p&gt;I've got a custom controller in my plugin that checks whether or not the request is ajax or not, using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;isAjaxRequest()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the event that it is, I just want it to return a partial. First though, I'm trying to just get it to return a string but seem to be having issues getting something as simple as that to work (I'm pretty new to PHP). The code I have on the condition of it being an ajax request is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$path = craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath();&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($path);&#xA;$temp = craft()-&amp;gt;templates-&amp;gt;render('notifications/_test');&#xA;echo $temp;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm logging the response in javascript but keep getting a 404. If I try to open the link (custom controller url) in a new tab (so not and ajax request) it correctly executes the non ajax condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GET request looks like this: &lt;code&gt;$.get($(this).attr('href'), function(data)...&lt;/code&gt;&#xA;where the href is the controller action url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anything look amiss? Am I perhaps missing a step to allow for this to work? I've tried &lt;code&gt;$allowAnonymous&lt;/code&gt; on the controller to no avail.&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-09-09T15:18:49.303" Title="Plugin Controller Ajax Request" Tags="&lt;plugins&gt;&lt;controller&gt;&lt;ajax&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11372" PostTypeId="2" ParentId="11369" CreationDate="2015-09-08T15:34:38.613" Score="1" Body="&lt;p&gt;You cannot allow selection from multiple category sources in a category field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would keep the 4 category fields but set each field to limit to one (1) category selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when you add the field to the field layout, make the field required to ensure they select a category for each field.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-09-08T15:34:38.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11373" PostTypeId="2" ParentId="11369" CreationDate="2015-09-08T16:02:36.940" Score="1" Body="&lt;p&gt;What are your 4 sources used for?  Depending on your content you might be able to work around it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no exact science to this but in my experience doing IA, here's a few thoughts on category sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I like to set mine up so they kind of match the sections I'm posting in.  If you have to reach across multiple category &lt;em&gt;sources&lt;/em&gt; for a field—say you only have one section throughout the site—it's possible your top level sections aren't specific enough. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You might be using categories that really shouldn't be categories.  Like on a news site, Breaking News could very well span across everything. In that case, you'd be better off setting up a new field, say a checkbox, and allowing your authors to tick it as appropriate. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you're coming from something like WordPress where you &lt;em&gt;only&lt;/em&gt; had&#xA;categories and tags to use out of the box, you can fall in that trap.&#xA;Along the same lines,  if you wanted to put something on the home page, you might have used a &quot;featured&quot; category that only shows up on the home page; a better, Craftier way is to use its relational magic and setup a field on the home page entry itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Category sources are hierarchical so you could merge the ones you need into some kind of catch-all category as needed. Categories should be relatively shallow. If you have like 50 categories for a smaller site, you're doing it wrong. It sounds like you have categories that are of varying topics.  That can be a nightmare anyway you slice it. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As Luke mentioned, you can set it up so only 1 category can be selected. I would also look at how your 4 category fields are labeled. If you have labels like &quot;Main Category&quot; and then &quot;Sub Category&quot;, it's probably OK that someone leaves the second and 3rd fields blank, for example. So the first could be required as a general &quot;gist&quot; of what the topic is, more less drilling down specificity.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-09-08T16:02:36.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11375" PostTypeId="2" ParentId="11366" CreationDate="2015-09-08T16:52:14.710" Score="6" Body="&lt;p&gt;One way to handle this is by using the &lt;strong&gt;&lt;a href=&quot;https://github.com/boboldehampsink/export&quot;&gt;Export&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href=&quot;https://github.com/boboldehampsink/import&quot;&gt;Import&lt;/a&gt;&lt;/strong&gt; tools by Bob Olde Hampsink. This will allow you to output the data to a CSV file, which you can hand off to the translator. Be wary though, if you have any complex fields (like custom field types), they may or may not export/import easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also strongly consider giving your translator temporary access to the CP. You could give them a temporary account with limited access, and point them straight to the pages which need translating. While your concerns over things like Matrix fields are valid, I'm not sure they outweigh the extra overhead of the exporting/importing process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When used with Live Preview, giving access to the control panel also lets your translators see the strings they are translating used in the context of the site itself, which is useful when there might be multiple translations for a string.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2015-09-08T17:40:00.227" LastActivityDate="2015-09-08T17:40:00.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11376" PostTypeId="2" ParentId="11369" CreationDate="2015-09-08T18:52:11.260" Score="1" Body="&lt;p&gt;You could use entries instead of categories. Create four structures and use them instead of your category groups. Your category field will actually be an entry field, and it can pull from the four structures, with a limit of one.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-09-08T18:52:11.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11377" PostTypeId="2" ParentId="11338" CreationDate="2015-09-08T19:09:53.103" Score="2" Body="&lt;p&gt;Files were not added to the deployment branch!&lt;/p&gt;&#xA;" OwnerUserId="3940" LastActivityDate="2015-09-08T19:09:53.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11378" PostTypeId="2" ParentId="11362" CreationDate="2015-09-08T20:47:15.273" Score="1" Body="&lt;p&gt;The only time I can think of where this might be an issue is if you had a &quot;Find and Replace&quot; task that was part of the task backlog.  Those are triggered from the &quot;Find and Replace&quot; tool under &lt;code&gt;Settings-&amp;gt;Tools&lt;/code&gt; in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you should be safe just letting the backed-up tasks finish catching up.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-08T20:47:15.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11380" PostTypeId="1" CreationDate="2015-09-09T04:02:10.227" Score="2" ViewCount="2014" Body="&lt;p&gt;I have installed Craft successfully on a local Mac environment using Mamp. I can access the admin area and the default homepage when I go to this address &lt;code&gt;localhost:8888/craft/public/&lt;/code&gt; but I cannot access the site when I go to this address &lt;code&gt;localhost:8888/craft/&lt;/code&gt; Also, when I click on the news link on the default homepage it is a broken link unless I include the public in the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;localhost:8888/craft/news/2015/we-just-installed-craft&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;localhost:8888/craft/public/news/2015/we-just-installed-craft&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get around the public folder dilemma? &#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4064" LastEditorUserId="4466" LastEditDate="2016-07-10T00:31:18.077" LastActivityDate="2016-07-11T01:54:29.763" Title="Public folder confusion" Tags="&lt;install&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11381" PostTypeId="2" ParentId="11380" CreationDate="2015-09-09T04:49:22.150" Score="2" Body="&lt;p&gt;The web root needs to be set to the &lt;code&gt;public/&lt;/code&gt; folder. All of the other folders can reside outside of the webroot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, you could add a &lt;code&gt;.htaccess&lt;/code&gt; file to the &lt;code&gt;craft/&lt;/code&gt; folder with this in it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$&#xA;RewriteRule ^(.*)$ - [E=BASE:%1]&#xA;RewriteCond %{REQUEST_URI}      !^/%{ENV:BASE}public/&#xA;RewriteCond %{REQUEST_URI}      !^%{ENV:BASE}public/&#xA;RewriteRule ^(.*)$              %{ENV:BASE}public/$1 [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a &lt;code&gt;.htaccess&lt;/code&gt; file to the public folder with...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$&#xA;RewriteRule ^(.*)$ - [E=BASE:%1]&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^ %{ENV:BASE}index.php [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that &lt;em&gt;should&lt;/em&gt; let you access the website via just &lt;a href=&quot;http://localhost:8888/craft/&quot; rel=&quot;nofollow&quot;&gt;http://localhost:8888/craft/&lt;/a&gt;. I do this with my local dev sites but I rename the craft folder to match the domain.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-09-09T04:49:22.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11382" PostTypeId="1" CreationDate="2015-09-09T05:09:05.347" Score="1" ViewCount="1317" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;Pixel &amp;amp; Tonic Contact Form&lt;/a&gt; plugin.&#xA;I have created a template and I'm using the example code from the README file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No email is being sent. Upon submit it redirects to the form page.  I have successfully sent myself an email test using Php Mail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need a template at:&#xA;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/thank-you-for-contacting-us&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromName&quot; style=&quot;display:block&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot; style=&quot;display:block&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;fromEmail&quot; type=&quot;text&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot; style=&quot;display:block&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{% if message is defined %}{{ message.subject }}{% endif %}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot; style=&quot;display:block&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;        &amp;lt;input id=&quot;kneesbees&quot; class=&quot;kneesbees&quot; name=&quot;kneesbees&quot; type=&quot;text&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3812" LastEditorUserId="3812" LastEditDate="2015-09-09T05:23:21.070" LastActivityDate="2015-09-11T19:04:43.033" Title="Contact Form not sending" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11383" PostTypeId="1" AcceptedAnswerId="11395" CreationDate="2015-09-09T05:47:56.223" Score="3" ViewCount="162" Body="&lt;p&gt;Is there a simple way to display the CP entries structure tree folded (not expanded) by default ?&lt;br&gt;&#xA;Because we have a very complex entries tree whith lots of entries and levels and my users needs to fold everything each time they access it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qlP39.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qlP39.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-11-08T20:00:10.693" Title="CP entries structure tree view folded (not expanded) by default?" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11384" PostTypeId="2" ParentId="11370" CreationDate="2015-09-09T06:16:06.460" Score="2" Body="&lt;p&gt;Sprout Forms (for Craft 3) supports CC and BCC options as well as the option to send to recipients as individual emails (where each recipient just sees that they received an email) or as a single email (where each recipient can see the other users who the email was sent to or CC'd.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Legacy Answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the time of this posting, there is no way to CC a person using Sprout Forms. It's on our list to consider adding at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Sprout Email, you can set up multiple notifications so that one email is sent to one user and another is sent to another user.  This doesn't solve your goal of CCing a user either, but it would let you get the secondary email address you want to CC out of the primary email to: field.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-12-13T01:22:31.180" LastActivityDate="2018-12-13T01:22:31.180" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11385" PostTypeId="1" AcceptedAnswerId="11386" CreationDate="2015-09-09T07:42:26.053" Score="1" ViewCount="334" Body="&lt;p&gt;I'm getting a big performance hit on front end requests (+15 seconds) when using a model to store / use data from one of my custom fieldtypes, cp requests for the same data appear unaffected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prepValue function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValue($value)&#xA;{&#xA;    if( is_array($value) )&#xA;    {&#xA;        return FruitGrid_BlockModel::populateModels($value);&#xA;    }&#xA;&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the model which is getting populated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class FruitGrid_BlockModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'row' =&amp;gt; array(AttributeType::Number),&#xA;            'col' =&amp;gt; array(AttributeType::Number),&#xA;            'sizex' =&amp;gt; array(AttributeType::Number),&#xA;            'sizey' =&amp;gt; array(AttributeType::Number),&#xA;            'entryid' =&amp;gt; array(AttributeType::Number),&#xA;            'rules' =&amp;gt; array(AttributeType::Mixed),&#xA;        );&#xA;    }&#xA;&#xA;    public function getRuleClasses()&#xA;    {&#xA;        $string = '';&#xA;        if(is_array($this-&amp;gt;rules))&#xA;        {&#xA;            foreach ($this-&amp;gt;rules as $rule =&amp;gt; $value)&#xA;            {&#xA;                switch ($rule)&#xA;                {&#xA;                    case 'fixedHeight':&#xA;                        $string .= ' height-'.$value;&#xA;                        break;&#xA;                    case 'desktopRuleOne':&#xA;                        $string .= ' desktop-'.$value;&#xA;                        break;&#xA;                    case 'tabletRuleOne':&#xA;                        $string .= ' tablet-'.$value;&#xA;                        break;&#xA;                    case 'mobileRuleOne':&#xA;                        $string .= ' mobile-'.$value;&#xA;                        break;&#xA;                }&#xA;            }&#xA;        }&#xA;        return trim($string);&#xA;    }&#xA;&#xA;    public function getEntry()&#xA;    {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;id = $this-&amp;gt;entryid;&#xA;        return $criteria-&amp;gt;first();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And pretty standard usage on the front end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.customFieldHandle|length %}&#xA;&#xA;    {% for block in entry.customFieldHandle %}&#xA;&#xA;        &amp;lt;h1&amp;gt;{{ block.entry.title }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ block.entry.text }}&amp;lt;/p&amp;gt;&#xA;&#xA;        ...&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-09-09T10:24:50.947" Title="Craft model and populateModels() performance issue?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11386" PostTypeId="2" ParentId="11385" CreationDate="2015-09-09T09:15:20.273" Score="2" Body="&lt;p&gt;Avoid calling &lt;code&gt;block.entry&lt;/code&gt; multiple time per block since you only need to do that database query once. Alternatively you can use function memoization to cache the entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class FruitGrid_BlockModel extends BaseModel&#xA;{&#xA;    private $_entry;&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'row' =&amp;gt; array(AttributeType::Number),&#xA;            'col' =&amp;gt; array(AttributeType::Number),&#xA;            'sizex' =&amp;gt; array(AttributeType::Number),&#xA;            'sizey' =&amp;gt; array(AttributeType::Number),&#xA;            'entryid' =&amp;gt; array(AttributeType::Number),&#xA;            'rules' =&amp;gt; array(AttributeType::Mixed),&#xA;        );&#xA;    }&#xA;&#xA;    public function getRuleClasses()&#xA;    {&#xA;        //...&#xA;    }&#xA;&#xA;    public function getEntry()&#xA;    {&#xA;        if(!$this-&amp;gt;_entry){&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;            $criteria-&amp;gt;id = $this-&amp;gt;entryid;&#xA;            $this-&amp;gt;_entry = $criteria-&amp;gt;first();&#xA;        }&#xA;&#xA;        return $this-&amp;gt;_entry;&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will only get the entry from the database once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also recommend renaming the &lt;code&gt;rules&lt;/code&gt; attribute on the model to something like &lt;code&gt;blockRules&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you loop over the rules to create the ruleClasses string you may be looping over every rule created by the AttributeType declarations in your &lt;code&gt;defineAttributes&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2015-09-09T10:24:50.947" LastActivityDate="2015-09-09T10:24:50.947" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11387" PostTypeId="2" ParentId="11365" CreationDate="2015-09-09T12:29:48.363" Score="1" Body="&lt;p&gt;As suggested by Fred, using the &lt;code&gt;{% cache globally using key craft.request.path %}&lt;/code&gt; trick from &lt;a href=&quot;https://craftcms.stackexchange.com/a/8335/342&quot;&gt;https://craftcms.stackexchange.com/a/8335/342&lt;/a&gt; gets rid of almost all duplicates!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the last few I notice that the duplicates all expire within seconds of each other, maybe this is an instance of &lt;a href=&quot;https://en.wikipedia.org/wiki/Cache_stampede&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Cache_stampede&lt;/a&gt; ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. several clients request the pages &quot;simultaneously&quot; and the page is rendered several times, and each version is cached? &lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-09-09T12:29:48.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11388" PostTypeId="1" AcceptedAnswerId="11391" CreationDate="2015-09-09T14:33:57.290" Score="0" ViewCount="1041" Body="&lt;p&gt;Here's the error I get: &quot;You have an insecure version of crypt installed. Please update PHP to 5.3.7 or later&quot;. I have PHP Version 5.3.2 installed on my Ubuntu server and cannot switch to a new version no matter what I do. I also tried to php5enmod mcrypt and it gives me command not found. I did the classic &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sudo apt-get update;&#xA;sudo apt-get install php5;&#xA;sudo apt-get install php5-mcrypt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you guys help? My phpinfo() doesnt show mcrypt as being installed even though it is installed actually. I am out of ideas&lt;/p&gt;&#xA;" OwnerUserId="803" LastActivityDate="2015-09-09T15:09:46.640" Title="Your server doesn’t meet the following requirements to run Craft" Tags="&lt;php&gt;&lt;requirements&gt;&lt;mcrypt&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11389" PostTypeId="1" CreationDate="2015-09-09T14:37:19.327" Score="0" ViewCount="273" Body="&lt;p&gt;Does anyone know why Craft CMS generates continual 404 errors for things like the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;?p=1504&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;tag/tag.js&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;newsdetail.asp?&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;module/mod_novasfh?&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Even after clearing or 301 redirecting 404 errors, a few days later, they explode again and create hundreds of errors in Search Console/Webmaster Tools&lt;/p&gt;&#xA;" OwnerUserId="4013" LastEditorUserId="45" LastEditDate="2015-09-09T16:20:29.293" LastActivityDate="2015-09-09T16:54:30.870" Title="Lots of 404 Page Errors" Tags="&lt;404&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11390" PostTypeId="2" ParentId="11389" CreationDate="2015-09-09T15:07:45.687" Score="3" Body="&lt;p&gt;Where are the links coming from? A Template? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;?p=1504&quot; should not 404, if it's attached to the end of an existing &quot;200&quot; url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do a crawl with an app called &quot;Screaming Frog&quot; to determine where your 404s are actually coming from then you can fix in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like your just sweeping the actual problem under the carpet and not fixing the source of the problem!&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2015-09-09T15:07:45.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11391" PostTypeId="2" ParentId="11388" CreationDate="2015-09-09T15:09:46.640" Score="2" Body="&lt;p&gt;I would install PHP via a third-party repository. I use Ondřej Surý's and I'm pretty happy with it. It installs PHP 5.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://launchpad.net/~ondrej/+archive/ubuntu/php5&quot; rel=&quot;nofollow&quot;&gt;https://launchpad.net/~ondrej/+archive/ubuntu/php5&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-09-09T15:09:46.640" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11392" PostTypeId="2" ParentId="11371" CreationDate="2015-09-09T15:18:49.303" Score="0" Body="&lt;p&gt;You can't echo out of the controller function. Though, you can send back the rendered template via a convenient controller function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('notifications/_test');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To add variables for your template to access (because it's not automatic for security reasons). You can do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('notifications/_test', array(&#xA;    'message' =&amp;gt; $message&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-09-09T15:18:49.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11393" PostTypeId="2" ParentId="11389" CreationDate="2015-09-09T16:54:30.870" Score="1" Body="&lt;p&gt;Just doing a quick google tells me &lt;code&gt;mod_novasfh&lt;/code&gt; is a Joomla module and &lt;code&gt;newsdetail.asp&lt;/code&gt; is a piece of code from an Entrallweb product. Neither are likely related to your website and both are old pieces of code with security vulnerabilities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why&lt;/em&gt; google is crawling is crawling the links is the real question. It could be referral spam where hackers are putting up random links to your website. Usually these could come from a couple domains, so just tell google to disavow the links. You can also try &lt;a href=&quot;https://github.com/Stevie-Ray/apache-nginx-referral-spam-blacklist&quot; rel=&quot;nofollow&quot;&gt;blocking the referrers&lt;/a&gt; on the server level with some .htaccess or nginx trickery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibly: Is your website/server hacked? Monitor your own server's logs and see what's going on. If you recently moved on from something like WordPress or Joomla, make sure those products are not still hiding somewhere on your server where hackers are injecting the links. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have old installs of software and those websites still accessible on the internet, hackers tend to find them and exploit ancient versions.  (Websites that link to you could also fall victim to this though that's less likely.) phpmyadmin is another common one that people tend to use and then forget about; the older version then gets exploited.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-09-09T16:54:30.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11394" PostTypeId="2" ParentId="11382" CreationDate="2015-09-09T18:26:09.947" Score="0" Body="&lt;p&gt;&lt;code&gt;phpmail&lt;/code&gt; is notoriously unreliable at delivering emails.  It might work fine for you locally when sending a test email to yourself, but getting an email reliably delivered on the &quot;real&quot; internet is much more difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely you were just running into that unreliability and swapping to a transactional email provider like Mandrill solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-09T18:26:09.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11395" PostTypeId="2" ParentId="11383" CreationDate="2015-09-09T19:02:50.497" Score="2" Body="&lt;p&gt;The structure of the tree is stored into local storage on the user's browser, so as long as that is not cleared, then the position of each of the nodes should be remembered between requests.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-09T19:02:50.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11396" PostTypeId="2" ParentId="10524" CreationDate="2015-09-09T20:57:52.777" Score="1" Body="&lt;p&gt;Aviary is pretty heavy handed. I agree with you, it'd be great to have some tools in Craft to handle cropping. There's been some rumblings in the past of Craft 3 shipping with some new toys but that's a ways away. I don't know of any alternative but you could certainly build your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use something like &lt;a href=&quot;http://deepliquid.com/content/Jcrop_Implementation_Theory.html&quot; rel=&quot;nofollow&quot;&gt;Jcrop&lt;/a&gt; then use some tools server side to crop the actual image. That's relatively straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementing it in Craft is the other tricky piece. Wonder if anyone else in the Craft community has tried doing something like this?&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-09-09T20:57:52.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11398" PostTypeId="1" CreationDate="2015-09-10T06:47:12.020" Score="2" ViewCount="280" Body="&lt;p&gt;I have a super strange problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created three locales: &lt;code&gt;de&lt;/code&gt; &lt;code&gt;fr&lt;/code&gt; &lt;code&gt;en&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set up all the necessary steps for a multi language config and everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Except in the &lt;code&gt;en&lt;/code&gt; locale I get a &lt;code&gt;Variable &quot;xyz&quot; does not exist&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;de&lt;/code&gt; and &lt;code&gt;fr&lt;/code&gt; work just fine but english does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variable is a &lt;code&gt;global field&lt;/code&gt;. If I strip my templates from all &lt;code&gt;globals&lt;/code&gt; it's working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise each and every global field throws the &lt;code&gt;Variable does not exist&lt;/code&gt; error in the &lt;code&gt;en&lt;/code&gt; locale. How is that even possible when the other locales work just fine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I' cant access the &lt;code&gt;en&lt;/code&gt; &lt;code&gt;globals&lt;/code&gt; in the control panel. Error: url not found. I guess this is a routing problem.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2015-09-10T07:36:46.063" LastActivityDate="2015-09-10T07:57:21.500" Title="Variable doesn't exist in one locale" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11399" PostTypeId="2" ParentId="11398" CreationDate="2015-09-10T07:57:21.500" Score="2" Body="&lt;p&gt;If found the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't specify &lt;code&gt;define('CRAFT_LOCALE', 'de');&lt;/code&gt; in the root &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesnt suffice to create &lt;code&gt;en&lt;/code&gt; &lt;code&gt;fr&lt;/code&gt; folders and specify &lt;code&gt;define('CRAFT_LOCALE', 'xx');&lt;/code&gt; there.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-09-10T07:57:21.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11400" PostTypeId="1" AcceptedAnswerId="11401" CreationDate="2015-09-10T08:10:02.517" Score="3" ViewCount="191" Body="&lt;p&gt;I setup &lt;code&gt;HappyLager.dev&lt;/code&gt;as per &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;these instructions on GitHub&lt;/a&gt;, after setting up phpmyAdmin on a local dev box which was no small feat. I want to know why my Images/Assets are missing from the finished install.  Look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uYnJw.png&quot; alt=&quot;HappyLager - No Images&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked my database import, which did succeed, in fact, I checked the entries/articles etc, and verified that the images do exist, and I copied the assets folder into apache:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kspQZ.png&quot; alt=&quot;HappyLager Article - Skis&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Article Entry does contain the image, ie skis, and every article/etc I glanced at is like this.  What did I  miss??&lt;/p&gt;&#xA;" OwnerUserId="4056" LastEditorUserId="4056" LastEditDate="2015-09-10T08:16:52.720" LastActivityDate="2015-09-10T09:50:23.117" Title="Having trouble with HappyLager" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11401" PostTypeId="2" ParentId="11400" CreationDate="2015-09-10T09:50:23.117" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Use the web inspector to look at the console log and see if it can find the images&lt;/li&gt;&#xA;&lt;li&gt;Visit that image's location in the browser. If the location is correct, but it's not rendering, you probably need to check the image's file permissions. If it's set to anything lower than 644, you won't be able to see it. Set the image's permissions to 644&lt;/li&gt;&#xA;&lt;li&gt;Make sure your assets folder and any subfolders are set to 777 so it can generate the image transforms&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-09-10T09:50:23.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11402" PostTypeId="2" ParentId="5094" CreationDate="2015-09-10T10:44:17.223" Score="1" Body="&lt;p&gt;I ran into a problem trying to use the above solution, as &lt;code&gt;getParent()&lt;/code&gt; wasn't returning anything (i think this may be because the entry url's i was trying to output where not children of another entry within the section?). Instead i did the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% set sectionHandle = entry.getSection().handle %}&#xA;  {% set pages = craft.entries.section(sectionHandle).level(1) %}&#xA;    {% for page in pages %}&#xA;      &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was following this tutorial: &lt;a href=&quot;http://buildwithcraft.com/help/structure-nav&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/structure-nav&lt;/a&gt; but it was requiring me to specify a handle name for which section to use. I was trying to create a generic template for multiple sections, so wanted to get the section of the current entry dynamically. &lt;/p&gt;&#xA;" OwnerUserId="3941" LastActivityDate="2015-09-10T10:44:17.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11404" PostTypeId="2" ParentId="2153" CreationDate="2015-09-10T14:05:19.377" Score="1" Body="&lt;p&gt;The answer is detailed here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10053/reference-tags-inside-matrix-textfield&quot;&gt;Reference tags inside Matrix textfield&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to use the global set's element ID as the reference part (second segment) of the reference tag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{globalset:51:siteUrl}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the global set's ID, go to CP -&gt; Settings -&gt; Globals. The URL to the global set will have the ID as the last segment (e.g. &lt;a href=&quot;http://yoursite.craft.dev/admin/settings/globals/51&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://yoursite.craft.dev/admin/settings/globals/51&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="406" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-09-10T14:05:19.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11405" PostTypeId="1" CreationDate="2015-09-10T15:14:44.887" Score="1" ViewCount="383" Body="&lt;p&gt;What would be the best way to add some custom validation rules on forms submitted on the front-end without using specific field types for it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin that allows anonymous posts to the targeted section.  I'm new to Yii and Craft CMS and I cannot seem to find a way to extend the validation rules for the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt; (at least I suspect it needs to get done there). &lt;/p&gt;&#xA;" OwnerUserId="397" LastEditorUserId="57" LastEditDate="2015-09-10T17:11:00.507" LastActivityDate="2015-11-09T19:26:31.633" Title="Custom validation rules on frontend form" Tags="&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11406" PostTypeId="1" CreationDate="2015-09-10T16:14:49.280" Score="3" ViewCount="63" Body="&lt;p&gt;Is it possible to add custom fields to a contact from that is using the &#xA;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/mandrillform&quot; rel=&quot;nofollow&quot;&gt;MandrillForm Plugin&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to add a field for phone&lt;/p&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2015-12-09T18:42:42.563" Title="Custom fields with Mandrill Form Plugin" Tags="&lt;plugins&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11407" PostTypeId="2" ParentId="11405" CreationDate="2015-09-10T17:23:14.203" Score="1" Body="&lt;p&gt;If your validation rules are truly custom and aren't covered by the default Craft validation rules, the only way I can think of getting them into the Guest Entries &lt;code&gt;EntryModel&lt;/code&gt; is to fork the plugin and add your own &lt;code&gt;MyPluginEntryModel&lt;/code&gt; that extends &lt;code&gt;EntryModel&lt;/code&gt; adding a &lt;code&gt;rules&lt;/code&gt; method with your custom validation logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read &lt;a href=&quot;http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more details on that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-10T17:23:14.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11408" PostTypeId="2" ParentId="11406" CreationDate="2015-09-10T17:27:42.520" Score="1" Body="&lt;p&gt;Looking at the code for the plugin, it doesn't look like it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd either need to make a &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/issues&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; or fork the plugin, add the functionality yourself and make a pull request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-10T17:27:42.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11409" PostTypeId="2" ParentId="20" CreationDate="2015-09-10T18:01:08.970" Score="1" Body="&lt;p&gt;I found another plugin that returns JSON format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference Link: &lt;a href=&quot;https://github.com/wesrice/rest-easy&quot; rel=&quot;nofollow&quot;&gt;https://github.com/wesrice/rest-easy&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested it out. It allows you to configure the parameters you need in the URL. &lt;/p&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2015-09-10T18:01:08.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11410" PostTypeId="1" CreationDate="2015-09-10T19:36:54.583" Score="2" ViewCount="1702" Body="&lt;p&gt;We are implementing fast CGI cache (not not the proxy version) but it seems that our upstream cache hit is always MISS. If we hijack &lt;code&gt;public/index.php&lt;/code&gt; by not running &lt;code&gt;require_once($craftPath.&quot;/vendor/autoload.php&quot;);&lt;/code&gt; and simply echo time the cache gets created and hit. We noticed that Craft adds cache control, pragma and expires headers by default. We tell FastCGI to ignore the headers with no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft do anything to not allow FastCGI caching?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~ \.php$ {&#xA;    fastcgi_ignore_headers X-Accel-Expires Expires Cache-Control;&#xA;    fastcgi_cache cacher;&#xA;    fastcgi_cache_valid 200 60m;&#xA;    fastcgi_cache_methods GET HEAD;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass 127.0.0.1:9000;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi_params;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3940" LastEditorUserId="57" LastEditDate="2016-01-04T18:56:25.927" LastActivityDate="2016-01-04T18:56:25.927" Title="Nginx FastCGI caching NO PROXY" Tags="&lt;cache&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11411" PostTypeId="1" CreationDate="2015-09-10T21:20:46.453" Score="0" ViewCount="84" Body="&lt;p&gt;I'm attempting to return a pop-up warning for users who click an external link on my site. The issue is, the functionality must still be there if JS is disabled. I think this would leave PHP as my only option, so would this be accomplished with a custom plugin? I've seen sites accomplish something similar with a separate redirect php include with the link destination in a query string. My experience developing Craft plugins is virtually nil so forgive my ignorance- but would that look like a plugin that finds and rewrites all the external links' hrefs on the existing page, returns the html for the modal (appends a fullscreen div to the dom), and populates a &quot;continue to external link&quot; anchor based on the original link in the query string? Am I on the right track here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4073" LastActivityDate="2015-09-10T21:51:36.560" Title="Creating a modal warning for an external link?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11412" PostTypeId="1" CreationDate="2015-09-10T21:41:43.437" Score="0" ViewCount="2049" Body="&lt;p&gt;For some reason the admin keeps popping up the session timeout box, it seems after about a minute, even thought I can clearly see in my sessions that they have ages until expiry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See -&gt; &lt;a href=&quot;https://www.dropbox.com/s/egfg019cruv3uzn/Screenshot%202015-09-11%2009.39.21.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/egfg019cruv3uzn/Screenshot%202015-09-11%2009.39.21.png?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also strangely when I refresh the page I'm still logged in. What would be causing this. The site is running on nginx if that would make any difference.&lt;/p&gt;&#xA;" OwnerUserId="802" LastActivityDate="2015-09-10T21:41:43.437" Title="Craft keeps displaying session timeout prompt" Tags="&lt;session&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11413" PostTypeId="2" ParentId="11411" CreationDate="2015-09-10T21:51:36.560" Score="4" Body="&lt;p&gt;&lt;strong&gt;A modal cannot exist without JS... no matter how it is triggered.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At best, you'd have the user navigate to an intermediate page, with &quot;Forward&quot; and &quot;Back&quot; buttons. That being said, the UX sounds pretty terrible in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're actually dealing with conflicting requirements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Must warn people before leaving site.&lt;/li&gt;&#xA;&lt;li&gt;Must be non-JS compatible.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Those two requirements will never really be in harmony.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-10T21:51:36.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11414" PostTypeId="1" CreationDate="2015-09-11T03:32:00.517" Score="24" ViewCount="10962" Body="&lt;p&gt;This is a super high level question but it would be good to get a couple of summary answers.  What are the main pros and cons of Craft versus WordPress?  &lt;/p&gt;&#xA;" OwnerUserId="4074" LastEditorUserId="22" LastEditDate="2017-05-09T23:26:27.957" LastActivityDate="2020-04-15T18:42:41.837" Title="Differences between Craft and WordPress" Tags="&lt;craft-features&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="24" ContentLicense="CC BY-SA 3.0" />
  <row Id="11415" PostTypeId="2" ParentId="11414" CreationDate="2015-09-11T03:48:39.687" Score="13" Body="&lt;p&gt;I don't have much practical experience with WordPress, so I'll let others get into the details and I'll take the easy way out and link to several articles comparing and contrasting Craft against WordPress as well as other popular CMSs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://viget.com/extend/craft-vs.-wordpress-the-good-the-bad-and-the-ugly-data&quot; rel=&quot;noreferrer&quot;&gt;https://viget.com/extend/craft-vs.-wordpress-the-good-the-bad-and-the-ugly-data&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.designernews.co/stories/21137-ask-dn-wordpress-vs-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;https://www.designernews.co/stories/21137-ask-dn-wordpress-vs-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/What-are-the-pros-and-cons-of-WordPress-vs-Craft&quot; rel=&quot;noreferrer&quot;&gt;https://www.quora.com/What-are-the-pros-and-cons-of-WordPress-vs-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.newmediacampaigns.com/blog/review-of-craft-cms-tips-to-get-started&quot; rel=&quot;noreferrer&quot;&gt;http://www.newmediacampaigns.com/blog/review-of-craft-cms-tips-to-get-started&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cognition.happycog.com/article/about-that-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;http://cognition.happycog.com/article/about-that-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2015-10-06T22:29:56.950" LastActivityDate="2015-10-06T22:29:56.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11417" PostTypeId="2" ParentId="11414" CreationDate="2015-09-11T08:20:28.100" Score="47" Body="&lt;p&gt;I have a lot of experience with WordPress (8+ years), and I like it. I have less experience with Craft (obviously), though I like it more. Here's my 2 (obviously opinionated) cents regarding WordPress vs. Craft:&lt;/p&gt;&#xA;&lt;h3&gt;Benefits of WordPress (vs. Craft)&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Free&lt;/strong&gt; (although a Craft Pro license is super cheap, and you typically need at least 2 or 3 paid plugins to make WordPress usable as a CMS)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Open source&lt;/strong&gt; (although Craft is built on &lt;a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;noreferrer&quot;&gt;Yii&lt;/a&gt;, which is open source as well, and the full Craft codebase is on &lt;a href=&quot;https://github.com/craftcms/cms&quot; rel=&quot;noreferrer&quot;&gt;GitHub&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Huge community &amp;amp; amount of resources available&lt;/strong&gt; – although actually sifting through it all and finding quality content can be a chore/difficult – a lot of it is outdated or just bad practice&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;High quality 3rd party services&lt;/strong&gt; available for hosting (WPEngine etc), backups/security (VaultPress) and core management (ManageWP) – although if stuff like that is your thing you can use similar services w/ Craft installs; they're just not tailor-made to Craft&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Plugin management&lt;/strong&gt;. Being able to search for, install and update plugins from the Dashboard is great – although Craft will soon have its own built-in &amp;quot;plugin store&amp;quot; and it will be &lt;em&gt;curated&lt;/em&gt;, which is a huge plus. &lt;strong&gt;Update: Since writing the original answer, Craft 3 has launched and has a built-in Plugin Store inside the Control Panel, which can be used to browse, install, manage and purchase plugins (all commercial plugins have trial versions, and there are loads of free ones too). &lt;em&gt;If clicking buttons in a virtual Store is not your thing, Craft also has first-party support for &lt;a href=&quot;https://getcomposer.org/&quot; rel=&quot;noreferrer&quot;&gt;Composer&lt;/a&gt;)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;WooCommerce is good (and free)&lt;/strong&gt; (although &lt;a href=&quot;https://craftcommerce.com/&quot; rel=&quot;noreferrer&quot;&gt;Craft Commerce&lt;/a&gt; is out and is looking very nice) &lt;strong&gt;Update: Craft Commerce 2 beta is now available, and is looking even nicer&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Dashboard is easy to use&lt;/strong&gt; (though I think Craft's CP is on par and IMO makes a better job with keeping things clean and simple)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The built-in media library/uploader/image editing is pretty good&lt;/strong&gt; (although it still doesn't have &lt;em&gt;folders&lt;/em&gt;. Why on earth doesn't it have folders) ** Update: Craft 3 has a simple image editor for cropping, rotating and focus points**&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There's a plugin for &lt;em&gt;everything&lt;/em&gt;&lt;/strong&gt; (...and you'll need them. In my experience, Craft installs typically needs fewer – and more to the point; less CMS-critical – plugins.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There's a hook or filter for &lt;em&gt;everything&lt;/em&gt;&lt;/strong&gt; (although with their inconsistent naming conventions and priority hell you'll quickly build yourself a maze if you're not careful. Craft primarily uses well-documented &lt;em&gt;events&lt;/em&gt; to enable plugin authors to &amp;quot;hook&amp;quot; into and affect the app lifecycle, with fairly self-explanatory names)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;WordPress has multi-site&lt;/strong&gt; (although it's pretty half cooked and loaded with gotchas) **Update: Craft 3 also has multi-site, although it's less geared to the use case of running completely separate sites under the same CMS install, and more to the use case of maintaining separate &lt;em&gt;content&lt;/em&gt; for different target groups/languages/etc)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;WordPress is stable as hell&lt;/strong&gt;. Not that there aren't bugs, but breaking changes are very rare (there are &amp;quot;deprecated&amp;quot; APIs still in the codebase that are years old). The WP core team is super focused on backwards compatibility, which means important stuff aren't likely to change in a big way anytime soon – however, it also means that much of the codebase is outdated and/or inconsistent. In comparison, Craft is still fairly young and feels much more in flux. This doesn't mean that Craft breaks all the time – it doesn't, bugs are relatively rare and P&amp;amp;T have generally been super quick w/ bug fixing. Compared to WP, there have been bigger changes between major versions, though (mainly for plugin developers, not so much in terms of frontend code/templating or content modelling). Basically P&amp;amp;T/Craft is dedicated to staying &lt;em&gt;modern and lean&lt;/em&gt; whilst WordPress is dedicated to not pissing off a gazillion users. These are very different approaches to building and maintaining a CMS, and one may resonate more for you than the other.&#xA;– WordPress has a RESTful API built-in. I haven't tried it, so I couldn't say if it's any good. Craft doesn't have a REST API in core, but for the quick'n'easy stuff there's the first party &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;noreferrer&quot;&gt;Element API plugin&lt;/a&gt;. Beyond that, since Craft 3 came out it's actually quite easy to &lt;a href=&quot;https://docs.craftcms.com/v3/dev/headless.html#app&quot; rel=&quot;noreferrer&quot;&gt;go totally headless&lt;/a&gt; with Craft.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Weaknesses of WordPress (vs. Craft)&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;No templating engine (some might deem this a good thing. I'm not among them; personally I recommend &lt;a href=&quot;http://upstatement.com/timber/&quot; rel=&quot;noreferrer&quot;&gt;Timber&lt;/a&gt; for using Twig in WordPress themes)&lt;/li&gt;&#xA;&lt;li&gt;No advanced custom fields – although &lt;a href=&quot;http://www.advancedcustomfields.com/&quot; rel=&quot;noreferrer&quot;&gt;ACF&lt;/a&gt; exist and is a must-have for any WP install. Full disclosure; I actually prefer parts of ACF to Craft's built-in custom fields – for instance its export/import and conditional functionality is stellar. &lt;strong&gt;Update: In place of the WYSIWYG of yore, WordPress has this new-fangled thing called &amp;quot;Gutenberg&amp;quot; now, which is kind of like a core modular content system. I haven't tried it, but personally I think it looks like a total trainwreck. Also, both conditionals and import/export is supposedly coming to Craft core in a 3.x update&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;WordPress is not really a CMS, but a blogging platform – no matter what they tell you. Unless you're building a traditional &lt;em&gt;blog&lt;/em&gt;, you'll constantly be fighting the core (yes WordPress has custom post types and taxonomies, but they feel tacked on and are cumbersome to work with, compared to Craft or ExpressionEngine)&lt;/li&gt;&#xA;&lt;li&gt;The architecture. Most of WP's core and its theme/plugin APIs aren't even OOP, forget MVC. Again I recommend &lt;a href=&quot;http://upstatement.com/timber/&quot; rel=&quot;noreferrer&quot;&gt;Timber&lt;/a&gt;, which in addition to adding Twig support enables you to build themes using an optional, pseudo-MVC pattern.&lt;/li&gt;&#xA;&lt;li&gt;There's a lot of redundancy. Even as a fairly basic blog platform, there's a ton of built-in functionality in WP that you'll never need for the average site, and that you will want to remove or deactivate. It's like starting with a Pollock painting and applying paint remover until you have something you can draw on, instead of just starting with a blank sheet of paper in the first place&lt;/li&gt;&#xA;&lt;li&gt;Obtuse APIs (naming conventions are practically nonexistent and the APIs are super inconsistent, which means you need to look up &lt;em&gt;everything&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Security issues (though its actually very easy to secure a vanilla WP install, its still an issue and always will be, as long as WP is the most popular CMS on the planet)&lt;/li&gt;&#xA;&lt;li&gt;No built-in multilingual support (WPML is decent, but fairly pricy and also big and slow, in my experience)&lt;/li&gt;&#xA;&lt;li&gt;WordPress is really strict and opinionated about &lt;em&gt;routing&lt;/em&gt;, and creating custom routes is needlessly complex (although Timber will help out here, as well)&lt;/li&gt;&#xA;&lt;li&gt;Hierarchical content and custom ordering is hell (there are plugins but ew)&lt;/li&gt;&#xA;&lt;li&gt;Confusing relationship between presentation and content. In WordPress, any custom post types or taxonomies is creating w/ PHP code, usually residing in your &lt;em&gt;theme&lt;/em&gt;. This creates a confusing relationship between presentation and content modelling which is totally absent in Craft. The big paradox here is that while Craft isn't really designed to be &amp;quot;theme-able&amp;quot;, it still has a much clearer separation between content and presentation than WordPress. (Related WP pro tip: Consider building a custom &lt;em&gt;plugin&lt;/em&gt; to add your CPTs and taxonomies, keeping it out of your theme)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Closing notes:&lt;/h3&gt;&#xA;&lt;p&gt;The above is obviously quite opinionated, and I'm clearly partial to Craft.&lt;/p&gt;&#xA;&lt;p&gt;Obviously, just like with Craft you can basically build anything with WordPress and I find that for the most part, the two systems are fairly interchangeable. There are a few use cases where Craft is obviously the better choice though – e.g. multilingual sites, or sites w/ a lot of hierarchical content. Apart from &lt;em&gt;blogging&lt;/em&gt;, I'm having more difficulty coming up with use cases where WordPress is a more obvious choice, which says a lot.&lt;/p&gt;&#xA;&lt;p&gt;In my opinion, if you're new to both WordPress and Craft, I personally think the experience you'll gain using Craft will be more portable and valuable in the long run, and that you'll experience far fewer gotchas, headaches and WTFs in the process.&lt;/p&gt;&#xA;&lt;p&gt;Personally, the #1 pro for me w/ Craft vs. WordPress is has been that almost from the get-go (there's a learning cure, sure), I was able to work more effectively w/ Craft than I ever did in WordPress, and I felt more confident about the quality of my work – even with the mentioned 8+ years experience with WordPress. The super consistent codebase/APIs, stellar documentation and Twig templating are important factors here. I also prefer the smaller, super dedicated &lt;a href=&quot;https://craftcms.com/community&quot; rel=&quot;noreferrer&quot;&gt;community&lt;/a&gt; around Craft, this SE and the official Slack team being good examples.&lt;/p&gt;&#xA;&lt;p&gt;PS: I should also note the &lt;em&gt;excellent&lt;/em&gt; official support Craft comes with, courtesy of Pixel and Tonic.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-07-19T20:52:51.960" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11419" PostTypeId="1" AcceptedAnswerId="11675" CreationDate="2015-09-11T09:29:59.987" Score="2" ViewCount="58" Body="&lt;p&gt;We have a customer using a cheap managed hosting provider, and their MySQL server very aggressively times out and drops the connection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if this could be causing us troubles as outlined here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11365/massive-template-cache-cleaning-tasks-always-get-stuck&quot;&gt;Massive template cache cleaning tasks always get stuck&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft attempt to reconnect to MySQL if the connection drops halway through a request? &lt;/p&gt;&#xA;" OwnerUserId="342" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-09-29T21:44:45.397" Title="Will craft attempt to reconnect to MySQL if the connection drops?" Tags="&lt;database&gt;&lt;hosting&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11420" PostTypeId="1" CreationDate="2015-09-11T09:41:21.120" Score="2" ViewCount="176" Body="&lt;p&gt;I explored the events plugin (from &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/Events&lt;/a&gt;) and I understand the most of that. Now I will try to make the events localized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Event itself has no localized field, just the fieldLayout fields. Do I have to save a second record in the event db or did I just have to save the element with the corresponding locale id?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you give me a hint what steps are needed that I can edit them in two languages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I load an existing event &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getElementById($eventId, 'Events_Event', $locale);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with the new locale parameter and create the edit form, putting the locale as hidden field to the form ('de' instead 'en'). The fieldLayout fields are showing the 'de'-icon above the input fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to save it, I pass through the locale in the $event variable to&#xA;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement($event)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not pass it to the &lt;code&gt;$eventRecord&lt;/code&gt; because the $eventRecord itself didn't have a locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The event will be saved, just not in 'de' but in 'en'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to tell the elementtype or the model that it can be localized to make it work?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorDisplayName="user1080" LastEditDate="2017-06-02T06:41:13.333" LastActivityDate="2017-06-02T06:41:13.333" Title="Localize custom element types" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11421" PostTypeId="1" AcceptedAnswerId="11712" CreationDate="2015-09-11T11:25:06.160" Score="2" ViewCount="437" Body="&lt;p&gt;I'm trying to update the context from within a macro. Is this possible at all? I'm pretty close with the below code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The var_dump within the below function shows the updated context. But when doing a &lt;code&gt;{{ dump(_context|keys) }}&lt;/code&gt; after the macro call the context is unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas, much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TwiggedTwigExtension extends \Twig_Extension&#xA;{&#xA;  public function getName()&#xA;  {&#xA;    return 'Twigged';&#xA;  }&#xA;&#xA;  public function getFunctions()&#xA;  {&#xA;    return array(&#xA;      'addVar' =&amp;gt; new \Twig_SimpleFunction('addVar', array($this, 'addVar'), array('needs_context' =&amp;gt; true)),&#xA;    );&#xA;  }&#xA;&#xA;  public function addVar($context, $str, $val)&#xA;  {&#xA;    $context['context'][$str] = $val;&#xA;    var_dump(array_keys($context['context']));&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2021-03-15T02:35:54.763" Title="Add / Update context from macro" Tags="&lt;templating&gt;&lt;macro&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11422" PostTypeId="2" ParentId="11420" CreationDate="2015-09-11T12:34:35.910" Score="1" Body="&lt;p&gt;I got it. I added this function to the Event_ElementType    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function isLocalized()&#xA;{&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds a language selector to your event index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I enhanced the locale to the URL in &lt;code&gt;getCpEditUrl()&lt;/code&gt; of the EventModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$locale = (craft()-&amp;gt;isLocalized() &amp;amp;&amp;amp; $this-&amp;gt;locale != craft()-&amp;gt;language) ? '/' . $this-&amp;gt;locale : '';&#xA;return UrlHelper::getCpUrl('events/'.$calendar-&amp;gt;handle.'/'.$this-&amp;gt;id . $locale );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The additional route for the locale edit form is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;events/(?P&amp;lt;calendarHandle&amp;gt;{handle})/(?P&amp;lt;eventId&amp;gt;\d+)/(?P&amp;lt;locale&amp;gt;[-\w\.*]+)' =&amp;gt; array('action' =&amp;gt; 'events/editEvent')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastEditorDisplayName="user1080" LastEditDate="2017-06-02T03:49:33.573" LastActivityDate="2017-06-02T03:49:33.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11423" PostTypeId="1" CreationDate="2015-09-11T13:04:37.530" Score="1" ViewCount="76" Body="&lt;p&gt;I started a project in Craft, but I think I need a plugin. The idea is to generate 2,000 registration codes for a subscription in the site and the only way to access the site is to register using any of the 2,000 codes that are printed on cards. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4080" LastEditorUserId="57" LastEditDate="2015-09-11T15:50:14.263" LastActivityDate="2015-09-11T15:54:29.813" Title="Subscribe plugin" Tags="&lt;users&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11424" PostTypeId="2" ParentId="11421" CreationDate="2015-09-11T13:18:31.383" Score="1" Body="&lt;p&gt;From a quick glance, I don't think this is possible. In that function, the context is being passed in by value, not reference... So any changes are only to the local scope.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2015-09-11T13:18:31.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11425" PostTypeId="1" CreationDate="2015-09-11T13:46:26.630" Score="2" ViewCount="1462" Body="&lt;p&gt;Sorry if this question has already been asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building a website for a client. In their footer they have several list of links, and I want them to be able to change them (so not hardcoded into the code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a &quot;Entries&quot; type for those linklist. It is intuitive but there are two main caveats:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;They have links like &quot;Blog&quot; that must link to an index of a channel. Unfortuantely, because this is not an entry, it does not appear. I've found an ugly workaround that consists of creating a single &quot;Blog&quot;, but this is a bit annoying because there is an additional single appearing for them, and this means that I need to rename the channel to something else (because Blog become already taken by the single).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They have some links that point to an external URL (they host their FAQ on ZenDesk, so the FAQ is an external URL). It therefore does not work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For the last point, I've found a nice plugin called LinkIt (&lt;a href=&quot;https://github.com/fruitstudios/LinkIt&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/LinkIt&lt;/a&gt;) that nearly tackles the problem, but with one major drawback: contrary to the Entries type, it only allows to add one link (using a matrix feels a bit overkill here and is less intuitive than the Entries stuff).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I miss something? I think it would be really good if Craft could have a new field type &quot;URL&quot;, that would allow to enter a free URL with a label. It would give much more flexibility to the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4081" LastActivityDate="2015-09-13T12:46:23.173" Title="Create a link list with URLs, categories, entries" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11426" PostTypeId="1" AcceptedAnswerId="11449" CreationDate="2015-09-11T14:03:01.990" Score="1" ViewCount="202" Body="&lt;p&gt;Having spoken to our 'ops guy' I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something craft can do? Also will it will be ok using assets from a cloud front CDN setup too?&lt;/p&gt;&#xA;" OwnerUserId="4082" LastActivityDate="2015-09-13T19:10:39.110" Title="Can Craft or any of its plugins render down flat html files for speed" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11427" PostTypeId="1" AcceptedAnswerId="11476" CreationDate="2015-09-11T14:29:53.030" Score="0" ViewCount="398" Body="&lt;p&gt;On one Craft CMS site I have, all control panel URLs I call over HTTP are rewritten to HTTPS. E.g. the login page, as well as all its assets, are being served via &lt;code&gt;https://www.mywebsite.com/admin/…&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the site is available via &lt;code&gt;https://www.mywebsite.com/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried to enforce HTTP via mod.rewrite in .htaccess, as well as explicitly setting &lt;code&gt;baseCpUrl&lt;/code&gt; and an new &lt;code&gt;cpTrigger&lt;/code&gt; in &lt;code&gt;config/general&lt;/code&gt; – with no success at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a feature that I can deactivate? A bug in Craft CMS 2.4.2670?&lt;br&gt;&#xA;Or is this a server-side issue?&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2015-09-15T16:07:50.587" Title="Control panel switches to HTTPS protocol on its own" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;https&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11428" PostTypeId="2" ParentId="11426" CreationDate="2015-09-11T14:33:37.640" Score="2" Body="&lt;p&gt;Craft can render html yes... it's a pretty core element of it lol. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By flat do you mean completely non-dynamic?&#xA;Normally &quot;flat html&quot; means to just use &quot;html&quot; files and not rely on any sort of dynamic system like a CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do you mean to flatten the code? As in to minify it? In which case craft can do that yes. &lt;code&gt;{% spaceless %}&amp;lt;html&amp;gt;     &amp;lt;/html&amp;gt;{% endspaceless %}&lt;/code&gt; will become &lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On top of that it does have its own &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %} tags&lt;/a&gt; too (which definitely speeds things up), again you will need to wrap the appropriate cache tags around the bits of your site you want to cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also be wary of cloudfront, it doesn't always speed things up, sometimes can make websites run slower. Though it does offer DDOS protection.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="57" LastEditDate="2015-09-11T15:59:21.303" LastActivityDate="2015-09-11T15:59:21.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11429" PostTypeId="2" ParentId="11368" CreationDate="2015-09-11T14:39:36.703" Score="0" Body="&lt;p&gt;Ok figured it out. I was going about it completely the wrong way. As the field in question is an &lt;code&gt;Entry&lt;/code&gt; type, I needed to use the &lt;code&gt;Relations Service&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$globalSet = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('[globalSetHAndle]');&#xA;$selectedField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('[fieldHandle]');&#xA;craft()-&amp;gt;relations-&amp;gt;saveRelations($selectedField, $globalSet, array($entryId));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Passing &lt;code&gt;null&lt;/code&gt; instead of &lt;code&gt;array($entryId)&lt;/code&gt; will clear the relation values&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-09-24T09:34:30.620" LastActivityDate="2015-09-24T09:34:30.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11430" PostTypeId="2" ParentId="1853" CreationDate="2015-09-11T14:42:53.907" Score="1" Body="&lt;p&gt;To add some quick links to the dashboard, check out the &lt;strong&gt;&lt;a href=&quot;https://github.com/gilleard/RichTextWidget&quot; rel=&quot;nofollow&quot;&gt;RichTextWidget&lt;/a&gt;&lt;/strong&gt; plugin: It lets you easily add any kind of text – including a list of hyperlinks – to the control panel's main page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(One caveat: The richtext panel can only be set on a per-user basis – not to a whole admin group.)&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2015-09-11T14:42:53.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11431" PostTypeId="2" ParentId="11423" CreationDate="2015-09-11T15:54:29.813" Score="1" Body="&lt;p&gt;If I'm following you correctly then it sounds completely doable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to create a Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that generated the 2,000 codes to use and save them somewhere (probably the database).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'd write a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;registration form&lt;/a&gt; for the front-end of your site that posted to your plugin's &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; and passing along any registration code they've entered.  Your plugin would then validate that code against the database and call Craft's &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersService-&gt;saveUser()&lt;/a&gt; if it is valid, otherwise return an appropriate error.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-11T15:54:29.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11432" PostTypeId="1" AcceptedAnswerId="11433" CreationDate="2015-09-11T15:55:24.637" Score="3" ViewCount="325" Body="&lt;p&gt;Is it possible to use an Asset field as a Global Set? For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ companyInfo.logo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4083" LastActivityDate="2015-09-11T16:04:53.683" Title="Use Asset field as a Global Set Variable?" Tags="&lt;assets&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11433" PostTypeId="2" ParentId="11432" CreationDate="2015-09-11T16:04:53.683" Score="4" Body="&lt;p&gt;If &lt;code&gt;companyInfo&lt;/code&gt; if your global and &lt;code&gt;logo&lt;/code&gt; if your Asset field, then you'd use it just like you would &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#templating&quot; rel=&quot;nofollow&quot;&gt;anywhere else&lt;/a&gt; keeping in mind that all relation fields (Assets, Users, Entries, Tags, Categories, etc.) always return a &lt;em&gt;collection&lt;/em&gt; of results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;code&gt;companyInfo.logo.first()&lt;/code&gt; will return the first asset and if you want to loop through them all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in companyInfo.logo %}&#xA;    {{ image.getUrl() }}&amp;lt;br /&amp;gt;        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-11T16:04:53.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11434" PostTypeId="2" ParentId="11382" CreationDate="2015-09-11T19:04:43.033" Score="3" Body="&lt;p&gt;I figured out what was happening. There was a conflict with a previously installed plugin, Sprout Invisible Captcha.&lt;/p&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2015-09-11T19:04:43.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11435" PostTypeId="2" ParentId="5094" CreationDate="2015-09-11T19:28:21.333" Score="2" Body="&lt;p&gt;There are two possibilities. If the entry has a parent, then the entry+siblings will be all the children of that parent. If the entry does not have a parent (because it is a top level entry), then entry+siblings will be all the top level entries of the section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# define siblingsPlusMe so it is in scope outside of the if #}&#xA;{% set siblingsPlusMe = [] %}&#xA;&#xA;{% if entry.level == 1 %} {# no parent #}&#xA;  {% set siblingsPlusMe = craft.entries.section(entry.section).level(1) %}&#xA;&#xA;{% else %} {# parent #}&#xA;  {% set siblingsPlusMe = entry.parent.children %}&#xA;&#xA;{% endif %}&#xA;&#xA;{# now that it is set, we can use it #}&#xA;{% for sibling in siblingsPlusMe %}&#xA;  ...&#xA;{% end for %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-09-11T19:28:21.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11437" PostTypeId="1" CreationDate="2015-09-12T08:04:27.913" Score="0" ViewCount="60" Body="&lt;p&gt;I know questions similar to this have been asked in the past. But I still don't feel like I am getting a full picture so feel there is benefit in asking it again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add extra data to a post after that post is saved. In Wordpress world this is called meta data. And can be achieved by simply calling &lt;code&gt;update_post_meta($post_id, $meta_key, $meta_value);&lt;/code&gt;  (&lt;em&gt;I'm not saying Wordpress is better I'm just giving context of where I am coming from.&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to hook into the 'entries.saveEntry' event in my plugin but I am unclear where to save this extra data or how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The extra data is not to be seen by the user and will likely be removed and updated each time the post is updated.&lt;/p&gt;&#xA;" OwnerUserId="508" LastActivityDate="2015-09-12T08:04:27.913" Title="Adding extra data to an element" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;custom-field&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11439" PostTypeId="2" ParentId="11425" CreationDate="2015-09-12T11:49:08.287" Score="3" Body="&lt;p&gt;Michael,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very common development pattern that we run into. Our primary method of resolving is to create a global set with matrix of links. Using a matrix allows you to extend the matrix item with whatever fields you would need based on the ui, such as an icon class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Links (link)&#xA;│&#xA;└─ Link Text (text)&#xA;└─ Link Entry (entries, limit 1)&#xA;└─ Link URL (text)&#xA;└─ Link Target (dropdown, [_self, _blank])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think that a matrix is a good choice, even considering user experience, because they can be collapsed after setup and it is likely that your user is familiar with them from other areas of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to use vanilla Craft you could use the Linkit plugin to add a more robust link field-type. It even lets you set the title, click behavior and works with various types of entries, assets, and custom URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Linkit plugin for Craft&lt;/strong&gt; &lt;a href=&quot;https://github.com/fruitstudios/LinkIt&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/LinkIt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="2216" LastActivityDate="2015-09-12T11:49:08.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11441" PostTypeId="2" ParentId="9347" CreationDate="2015-09-12T21:14:35.773" Score="2" Body="&lt;p&gt;I have had this same experience many times, but only with certain hosting providers, so I suspect it has something to do with server configuration.  One thing that I noticed was that saving an entry, for example, would hang, but the entry had indeed been saved pretty much immediately.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is not my local setup, because my co worked, who works from a different location, had the same issues at the same time.  Next time it happens I will try accessing via IP.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2015-09-12T21:14:35.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11442" PostTypeId="1" CreationDate="2015-09-13T00:11:41.757" Score="1" ViewCount="296" Body="&lt;p&gt;So Im working on a site migration that had a lot of images stored in Amazon s3.  I was able to get all those images into craft pretty easily by just pointing at the old S3 server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem seems to come when im trying to use any import plugins they seem to all fail to find the assets because they are all in sub folders. Id make sources for each of the folders but there are more than 350 so id rather not do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've been in excel all day doing some lookups and i finally have a list of elementIds and the assetIds that go with them and i was going to import them into the database myself but now i cant figure out where they go.  I assumed it was using the craft_relations table but no dice?  Anyone have any insight into how asset-&gt;matrixblock field relationships are stored in the database or a better way to get all the images imported?&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2015-09-13T00:11:41.757" Title="Manually Import Assets into Database" Tags="&lt;assets&gt;&lt;migration&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11443" PostTypeId="1" AcceptedAnswerId="11451" CreationDate="2015-09-13T12:05:58.147" Score="1" ViewCount="1653" Body="&lt;p&gt;I have checked the official documentation and also these pages:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/590/how-do-you-only-show-children-of-active-parent-in-a-structure-sections-nav&quot;&gt;How do you only show children of &amp;quot;active&amp;quot; parent in a Structure section&amp;#39;s nav?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2060/how-to-output-a-structure-sub-navigation-of-current-page&quot;&gt;How to output a structure sub-navigation of current page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still can't get this to work though. I have tried various code and currently have this (from official docs):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;sub-menu&quot;&amp;gt;&#xA;&#xA;{% set pages = craft.entries.section('pages').level('&amp;gt;1') %}&#xA;{% nav entry in pages %}&#xA;&amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;               {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;         {% endifchildren %}&#xA;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs all the children whenever I'm on any top level page. My structure is a little different though, like so (shortened for brevity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home&#xA;About (structure: 'pages', entry type: 'aboutPage')&#xA;  - Aims (structure: 'pages', entry type: 'aboutPage')&#xA;  - Governance (structure: 'pages', entry type: 'aboutPage')&#xA;Services (structure: 'pages', entry type: 'servicesPage')&#xA;  - Residential (structure: 'pages', entry type: 'servicesPage')&#xA;  - Homecare (structure: 'pages', entry type: 'servicesPage')&#xA;Resources (structure: 'pages', entry type: 'resourcePage')&#xA;  - Health (structure: 'pages', entry type: 'resourcePage')&#xA;  - External (structure: 'pages', entry type: 'resourcePage')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see I have a tree which uses a single 'pages' structure to keep everything obvious in the admin section. I then just create an entry, choose the parent and choose the entry type to add content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use a structure 'mainMenu' to add links manually to the main menu using a related entry field. So I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home - About - Services - Resources&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As top level pages. When I'm on a top level page, I want to show children of this current page and to hide the unordered list element when there are no children of the current page, and I'm stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4088" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-12T17:28:45.423" Title="Show only children of current page in submenu" Tags="&lt;navigation&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11444" PostTypeId="2" ParentId="11425" CreationDate="2015-09-13T12:46:23.173" Score="0" Body="&lt;p&gt;Thanks a lot for the answer Michael. I've just tried your idea but unfortunately it's not really simple for my use case. In my footer, each linklist has not only links, but also a title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cFq0V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cFq0V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm currently doing is a matrix called &quot;Linklists&quot;, with only one possible block that accept a list of link AND a title. It makes things super easy for the end user:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sccWu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sccWu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need a new linklist ? Just add one, specify title and links. Boom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your idea it would nicely work only if Craft supported matrix of matrix (where the block would be &quot;Linklist&quot;, and each linklist would be themselves a matrix with your fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, LinkIt nearly solves completely the issue, the only limitation is that it only allows up to one item, and does not allow to create multiple links as the entries field allow.&lt;/p&gt;&#xA;" OwnerUserId="4081" LastActivityDate="2015-09-13T12:46:23.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11445" PostTypeId="1" AcceptedAnswerId="11446" CreationDate="2015-09-13T14:32:28.167" Score="3" ViewCount="443" Body="&lt;p&gt;I'm setting up a route in control panel. I'd like to use a token that is similar to asterisk but involves forward slashes. Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to route everything from site.com/blog/* to a single template.&#xA;If I route &lt;strong&gt;site.com/blog/some-uri-identifier&lt;/strong&gt; , it works fine and I'm able to get &lt;strong&gt;&quot;some-uri-identifier&quot;&lt;/strong&gt; in my template (using slug option).&#xA;I need to route &lt;strong&gt;site.com/blog/some/uri/identifier-long-name&lt;/strong&gt; and still go to the same template + get &lt;strong&gt;&quot;/some/uri/identifier-long-name&quot;&lt;/strong&gt; in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2015-09-13T14:39:00.180" Title="Route token that includes forward slashes" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11446" PostTypeId="2" ParentId="11445" CreationDate="2015-09-13T14:39:00.180" Score="4" Body="&lt;p&gt;The CP route settings don’t have a token for matching multiple URI segments. However you can pull it off from &lt;strong&gt;craft/config/routes.php&lt;/strong&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'blog/(.+)' =&amp;gt; 'path/to/template',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You’ll be able to access whatever was captured by &lt;code&gt;(.*)&lt;/code&gt; from your templates via &lt;code&gt;matches[1]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-09-13T14:39:00.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11447" PostTypeId="2" ParentId="7187" CreationDate="2015-09-13T16:29:23.337" Score="1" Body="&lt;p&gt;I was having the same issue... but given that there are 15 domains, having the client access the admin cp from each domain isn't really an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key appears to be making sure that you have the following in both the admin cp domain and in the domain being previewed's .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header set Access-Control-Allow-Origin &quot;*&quot;&#xA;Header set Access-Control-Allow-Headers &quot;origin, x-requested-with, content-type&quot;&#xA;Header set Access-Control-Allow-Methods &quot;PUT, GET, POST, DELETE, OPTIONS&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...because you're setting there the origin is allowed.  Caveat regarding overriding CORS apply.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2015-09-13T16:48:58.190" LastActivityDate="2015-09-13T16:48:58.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11448" PostTypeId="1" AcceptedAnswerId="11452" CreationDate="2015-09-13T16:39:06.967" Score="1" ViewCount="189" Body="&lt;p&gt;I've written a plugin that sends and email to a user group on new entry save in a particular section. Most entries will be made from the front end, and the plugin is working great in that regard. However, if a user attempts to create a new entry from the CP, the plugin cannot find my designated template path and throws an error. Any help is greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($isNewEntry and $entrySection == 'Questions')&#xA;{&#xA;    //Get all users from UserGroup&#xA;    $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $user_criteria-&amp;gt;groupId = '9';&#xA;    $users = $user_criteria-&amp;gt;find();&#xA;    $template = '/email/question-email.html';&#xA;&#xA;    //Send to each User&#xA;    foreach ($users as $user)&#xA;    {&#xA;        //Send Mail&#xA;        $email = new EmailModel();&#xA;        $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;        $email-&amp;gt;subject = 'New Question';&#xA;        $email-&amp;gt;htmlBody = &quot;{% extends '{$template}' %}&quot;.&#xA;            &quot;{% set body %}&quot;.&#xA;            '&#xA;            &amp;lt;p&amp;gt;A new question has been posted by '.$entry-&amp;gt;author-&amp;gt;name.':&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;h2&amp;gt;Question: '.$entry-&amp;gt;title.'&amp;lt;/h2&amp;gt;&#xA;&#xA;            &amp;lt;p&amp;gt;Description: '.$entry-&amp;gt;questionDetails.'&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;p&amp;gt;Attachments: '.$entry-&amp;gt;questionAttachments-&amp;gt;total().'&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;p&amp;gt;&amp;lt;a style=&quot;color: #09c;&quot; href=&quot;'.$entry-&amp;gt;url.'&quot; title=&quot;'.$entry-&amp;gt;title.'&quot;&amp;gt;&amp;lt;b&amp;gt;Answer Question&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                        '&#xA;            .&quot;{% endset %}&quot;;&#xA;&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3894" LastEditorUserId="57" LastEditDate="2015-09-14T04:26:56.167" LastActivityDate="2015-09-14T04:26:56.167" Title="Template path from plugin not working from CP" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11449" PostTypeId="2" ParentId="11426" CreationDate="2015-09-13T19:10:39.110" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe you're looking for the the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag, which will – on the first page request – capture the compiled HTML output inbetween the opening and closing of the tag, and write it to the database. On subsequent requests, Craft will pull and output the compiled (flat) HTML using a single SQL query (until the cache expires, is cleared manually or any entries, categories etc. involved is changed). This means that for most pageloads, complex database queries or taxing PHP operations (Twig templates are compiled to PHP) can be eliminated, which is usually a performance boost.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;will it will be ok using assets from a cloud front CDN setup too?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yep, Craft is easily set up with external asset sources, and S3/CloudFront is supported. You will need a Craft Pro license, though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-13T19:10:39.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11450" PostTypeId="2" ParentId="10586" CreationDate="2015-09-13T21:42:58.137" Score="2" Body="&lt;p&gt;Couldn't you have multiple forms on the page, and submit them via AJAX in sequence when the user clicks on the Submit button?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-13T21:42:58.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11451" PostTypeId="2" ParentId="11443" CreationDate="2015-09-14T00:20:07.217" Score="5" Body="&lt;p&gt;Ran into the same issues you had. Pulled this from a working site I recently built.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you have to get the topmost page. I found &lt;code&gt;entry.getAncestors().level(1).first()&lt;/code&gt; works for that no matter what level you're in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you just get everything that's underneath it. But first check to see if there's actually any children using &lt;code&gt;{% if topLevel.hasDescendants %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       &amp;lt;! -- local navigation --&amp;gt;&#xA;&#xA;        {% set topLevel = (entry.level == 1) ? entry : entry.getAncestors().level(1).first()  %}&#xA;&#xA;        {# don't show the tree if nothing's under it #}&#xA;&#xA;        {% if topLevel.hasDescendants %}&#xA;&#xA;            &amp;lt;h2&amp;gt;{{topLevel}}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;            {% set subnav =  topLevel.getDescendants()  %}&#xA;&#xA;            {% nav page in subnav  %}&#xA;            {% if page.id != entry.id %}&amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;{%else%}&amp;lt;li class=&quot;current-page&quot;&amp;gt;{{page}}&amp;lt;/li&amp;gt;{%endif%}&#xA;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul class=&quot;sub-nav&quot;&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;&#xA;            {% endnav %}&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;       {% endif %}&#xA;&#xA;     &amp;lt;!-- // local navigation --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="162" LastEditDate="2015-10-12T17:28:45.423" LastActivityDate="2015-10-12T17:28:45.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11452" PostTypeId="2" ParentId="11448" CreationDate="2015-09-14T04:17:57.373" Score="1" Body="&lt;p&gt;You probably just need to call &lt;a href=&quot;http://buildwithcraft.com/classreference/services/PathService#setTemplatesPath-detail&quot; rel=&quot;nofollow&quot;&gt;PathService::setTemplatesPath()&lt;/a&gt; and pass in the path to your plugin's template folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Save the current template path.&#xA;$originalPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;&#xA;// Set your plugin's template path.&#xA;$path = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'/mypluginfolder/templates/';&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($path);&#xA;&#xA;//Send to each User&#xA;foreach ($users as $user)&#xA;{&#xA;    //Send Mail&#xA;    $email = new EmailModel();&#xA;    $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;    $email-&amp;gt;subject = 'New Question';&#xA;    $email-&amp;gt;htmlBody = &quot;{% extends '{$template}' %}&quot;.&#xA;        &quot;{% set body %}&quot;.&#xA;        '&#xA;        &amp;lt;p&amp;gt;A new question has been posted by '.$entry-&amp;gt;author-&amp;gt;name.':&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;h2&amp;gt;Question: '.$entry-&amp;gt;title.'&amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;Description: '.$entry-&amp;gt;questionDetails.'&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;Attachments: '.$entry-&amp;gt;questionAttachments-&amp;gt;total().'&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a style=&quot;color: #09c;&quot; href=&quot;'.$entry-&amp;gt;url.'&quot; title=&quot;'.$entry-&amp;gt;title.'&quot;&amp;gt;&amp;lt;b&amp;gt;Answer Question&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                    '&#xA;        .&quot;{% endset %}&quot;;&#xA;&#xA;    craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;}&#xA;&#xA;// Reset the original path.&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($originalPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-14T04:17:57.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11453" PostTypeId="1" AcceptedAnswerId="11458" CreationDate="2015-09-14T05:13:21.307" Score="1" ViewCount="256" Body="&lt;p&gt;I have to integrate a jobs feed into our website and I've been digging in the documentation, reading the core's code for a while now, and I am in a dilemma trying to figure out if in out use case I should write a plugin or just try to build everything on top Craft's core types?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to know that each job will belong to a company, and will have a lot of custom settings that apply to each job. I've started developing a plugin for it, based on the Brandon's events plugin, which until now is working fine, however I's still not convinces if I'm doing things rights, since the Elements API is a little under-documented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The questions that I have now are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Should I base the Company on the Sections type, if I want the jobs to be translatable?&lt;/li&gt;&#xA;&lt;li&gt;Should I base the Job on the Entry type, and write custom field types for every custom setting a job has to be translatable? (eg. Benefits and Requirements blocks, Many-to-Many relationships between job's industry, employment type, etc.)&lt;/li&gt;&#xA;&lt;li&gt;Should I handle the saving of Many-to-Many relationships on my own, or Craft handles these if I choose the right core type?&lt;/li&gt;&#xA;&lt;li&gt;Should I save all these custom fields a job has in the content table or in a custom table?&lt;/li&gt;&#xA;&lt;li&gt;I will also import jobs from out ATS system, would it be enough to write a plugin just for this, and integrate all the aforementioned requirements into Craft's code types, without developing a plugin?&lt;/li&gt;&#xA;&lt;li&gt;I would like to tag every job with the technologies a job requires, and assign custom logos of these technology tags. How would I handle this using a custom plugin, extending the core tags?&lt;/li&gt;&#xA;&lt;li&gt;The jobs will have an advanced search and filtering based on the Many-to-Many relationships with industries, experience level, employment type; what would be the best approach to achieve this? using custom queries in a plugin with a custom element type or building on top of core types?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I just started using Craft, so I still don't understand 100% the core, that's why I cannot decide which would be the best approach. &lt;/p&gt;&#xA;" OwnerUserId="4054" LastEditorUserId="22" LastEditDate="2017-05-09T23:26:10.620" LastActivityDate="2017-05-09T23:26:10.620" Title="Use-case: custom plugin or extended use of entries/categories/tags" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;fieldtypes&gt;&lt;elementtype&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11454" PostTypeId="1" CreationDate="2015-09-14T09:09:54.453" Score="2" ViewCount="89" Body="&lt;p&gt;Is it possible to use the translate filter in order to get nested vocabulary entries? For example having a vocabulary file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'login'             =&amp;gt; 'Einloggen',&#xA;    'registration'      =&amp;gt; 'Anmeldung',&#xA;    'forms'             =&amp;gt; [&#xA;      'email'                =&amp;gt; 'Email',&#xA;      'password'             =&amp;gt; 'Passwort',&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to get the vocabulary properties in the template in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ 'forms.email' | t }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2231" LastActivityDate="2017-02-25T05:16:22.470" Title="Translate filter and nested vocabulary properties" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11456" PostTypeId="1" CreationDate="2015-09-14T14:41:31.170" Score="0" ViewCount="41" Body="&lt;p&gt;I'm trying to get all elements whose custom field satisfies a specific value. I've got the ElementCriteriaModel but I'm unsure how to set the field and value I'm looking for, from the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? If I'm not using the correct service, then which is the recommended one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field in question is a datetime field by the name &lt;code&gt;startTime&lt;/code&gt;. I'm searching for all entries whose date-part matches a given date&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-09-15T12:15:08.230" LastActivityDate="2015-09-15T12:15:08.230" Title="ElementService get entries by field" Tags="&lt;elementcriteriamodel&gt;&lt;controller&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2015-09-29T18:03:20.613" ContentLicense="CC BY-SA 3.0" />
  <row Id="11457" PostTypeId="2" ParentId="11414" CreationDate="2015-09-14T16:22:41.233" Score="24" Body="&lt;p&gt;In additional to &lt;a href=&quot;https://craftcms.stackexchange.com/a/11417/1016&quot;&gt;Mats Mikkel's excellent answer&lt;/a&gt; and the links that Brad posted,  I find Craft is a much better fit for the types of clients I work with and the types of sites I build and my opinion is based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind there's no best software; it all depends on requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're doing small, brochure based websites with a dozen or so pages, with minimal content requirements—say, where the you or the client is going to touch the content maybe once a week—either CMS is probably going to work. But I find Craft excels at larger sites with multiple sections (post types) and content that needs to relate to each other in some way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;WordPress is great for DIY outfits.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find designers who don't know much HTML and CSS tend to gravitate towards its already prebuilt themes and plugins. As a professional who makes money doing design, it's a hard pill to swallow recommending WordPress, just on that basis alone.  I say that, not to be anti- competive but a big part of the design process is not just the way something looks, it's the way it functions and how it's built. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ben Parizek made a great comment on the &lt;a href=&quot;http://ctrlclickcast.com/episodes/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;control click podcast&lt;/a&gt;; we're not just building a client a website, we're building them 2 websites, meaning the back end is just as important. A lot of developers don't put that much stock in the user experience. WordPress is pretty friendly. With Craft, it's even more focused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WordPress can sometimes open up too many options. I've cleaned up my share of WordPress messes because the client ultimately didn't know what they were getting themselves into by installing some free theme that ended up not being supported anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft, the bar is set a lot higher.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You build exactly what you want and Craft excels at letting you control exactly what the browser spits out. There's no themes or clients monkeying with plugins. The site is going to work exactly the way you specified and built it, for better or worse. I find you build up with Craft; WordPress is kind of like the lego set that comes with most of the pieces already glued together. You can build on top of the set but if there's functionality you simply don't need—for example, like comments, as Mats mentioned, you start to &quot;fight&quot; the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WordPress' asset management is poor at best; no folders, you can't even categorize  by default, and it saves all assets by year and month. If you want to replace an image, you have to delete it first, causing all sorts of hassle. Again, you can work around those things with custom code or a plugin or 2, but why when Craft is available?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Assets are first-rate citizens in Craft&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add fields to content and to make it manage whatever &quot;metadata&quot; you need.  If you deal with any corporate clients, where document management is necessary (hello freakin' PDFs!), Craft is going to save your soul. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;Craft has limited image editing capabilities—I'd really love to see some kind of cropping ability—but again,&lt;/s&gt; based on the types of clients I work with, they either own a copy of an image editor, have someone on staff to help out, or we can help out with that. Remember, a CMS is not an editor and I think that's where WordPress and Craft start to diverge in philosophies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Since I wrote this, Craft 3 has built-in support for cropping, flipping, rotating, and adding focal points to images. Amen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugins to the rescue?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the common answer to virtually every WP question is: there's a plugin for that.  Yes, you can throw some plugins behind WordPress,  but at the end of the day, now you're relying on more 3rd party code that you didn't write and are probably on the hook to support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that P&amp;amp;T already provides excellent support. &quot;But what happens when they go belly up?&quot; is the usual retort. There's more of a chance that an individual  plugin vendor is going to quit the game than someone supporting an entire content  management system. With WordPress, now multiple your vendors by 3 or 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Security can be a problem with WordPress&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I host a few WordPress and Craft sites; WordPress is the one that cause me the most problems. I kind of liken WordPress' security to building a home on the shady side of town where you're constantly getting drive-bys, people jiggling your locks trying to break in, etc. Craft is tucked away in the suburbs where you're going to get a lot less of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft also has built-in tools to limit login attempts and change the admin entry point, something WordPress core has been &lt;a href=&quot;https://core.trac.wordpress.org/ticket/13118&quot; rel=&quot;nofollow noreferrer&quot;&gt;vehemently&lt;/a&gt; against. By changing the defaults, I've found you eliminate 99% of the script kiddies that try to brute force the site and suck up server resources. Craft already has both built-in, without any additional plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The obvious downside going with Craft is familiarity.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;People point to WordPress as ubiquitous, there's probably someone who can take over and manage the site after any stakeholder leaves. I find at that point, the CMS really doesn't matter that much;  it's just like a house, there's going to be people wanting to change everything because they didn't originally do it. Designers tend to be very opinionated. Even if you use WordPress, I've seen clients throw out the baby with the bathwater so to speak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Biggest of all, Craft promotes separate of styling and content.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The web is increasingly content centered. If you've ever read Karen McGrane, she jokes about WordPress putting everything in one field and how that's set the web publishing back 10 years. If you're a designer who puts markup in the body of a WordPress field, you're doing it wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately that approach simply doesn't scale. Again, plugins to rescue for WordPress but you can start to see that WP really wasn't designed for this purpose. Keep in mind, you can do a botch job with either system but Craft gives you built-in tools to help combat that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Further Reading:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ritterknight.com/insights/your-website-doesnt-have-to-be-wordpress&quot; rel=&quot;nofollow noreferrer&quot;&gt;Your website doesn't have to be WordPress&lt;/a&gt; by David Ritter (Ritter Knight)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.viget.com/articles/craft-vs.-wordpress-the-good-the-bad-and-the-ugly-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft vs. WordPress&lt;/a&gt; by Megan Zlock (Viget)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2020-04-15T18:42:41.837" LastActivityDate="2020-04-15T18:42:41.837" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11458" PostTypeId="2" ParentId="11453" CreationDate="2015-09-14T16:47:45.060" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I just started using Craft, so I still don't understand 100% the core, that's why I cannot decide which would be the best approach.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Welcome to the community! You're asking a lot here! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone more knowledgeable about plugin-development will want to chime in here but in my experience, Craft is quite flexible and can handle a lot of things out of the box, even without writing a plugin. It's awesome when you have to relate content to and from each other, like you're wanting to do here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite know all the requirements but if I were spec'ing this job, it sounds like you could do a lot of this by using most of Craft's entry types.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Jobs&lt;/strong&gt; (section)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Companies&lt;/strong&gt; (section)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Skills&lt;/strong&gt; (Category / Source )&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Industry&lt;/strong&gt; (Category / Source)&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would deal with ATS import as a separate plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd create entries in the Jobs section. Create fields that relate the job back to an entry in the company section as well as categorize it using those categories. Like entries, categories can have custom fields so you can put assets field on a skills category and upload logos so every job that has, say, jQuery in it, could have that logo appear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your requirements, your Jobs section could have multiple entry types. So if you have specific fields that need to appear on certain jobs categories and what not, you can do that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see Matrix being an MVP here, too. When a regular set of fields doesn't cover what you need (you mentioned &quot;custom settings that apply to each job&quot;), you can mix and match a ton of different combinations with Matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line: I would play more with Craft before you get into plugin development. If you're new to Craft, how many sites have you built with it before you started plugin development? Is there something that led you to know you actually need to use a plugin or is it just a programmer scratching an itch? (We've all been there!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to programming and web design in general, to paraphrase &lt;em&gt;The Matrix&lt;/em&gt;, &quot;there is a difference between knowing when to reinvent the wheel and not.&quot; That only comes with experience.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-09-14T16:53:32.867" LastActivityDate="2015-09-14T16:53:32.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11459" PostTypeId="1" AcceptedAnswerId="11465" CreationDate="2015-09-14T18:36:18.907" Score="0" ViewCount="107" Body="&lt;p&gt;Currently, I have the need to get an email notification, only when a particular field(s) have changed value. In my use case, a few light switches. Is there currently any way to get notified of this?&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-09-15T00:37:32.197" Title="Email notification on field value change?" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11460" PostTypeId="2" ParentId="11459" CreationDate="2015-09-14T18:49:29.803" Score="0" Body="&lt;p&gt;You'd need to write a plugin to do that.  Thankfully, it's not too difficult: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;https://buildwithcraft.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-14T18:49:29.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11461" PostTypeId="1" AcceptedAnswerId="11464" CreationDate="2015-09-14T20:23:32.657" Score="1" ViewCount="171" Body="&lt;p&gt;I am working on a site for a client who posts many jobs for chefs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of the jobs are essentially similar, so writing the job postings is something I am trying to simplify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can write a series of statements that will serve up similar job descriptions, with pre-written statements that then use |replace to integrate other field data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So an example statement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We cook %jobFoodType% to %jobRatingStars%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would render as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'We cook Pub food to a 3 star rating.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can write many of these type of statements which can either be selected from a drop down, but I'd like to go a step further and have the drop down when entering a new entry, to be randomly selected from the list of options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'm asking for, is there a way Craft can randomly pre-populate a field, with a set of predefined statements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look at Randomm plugin, which while useful, doesn't let me pre-populate from a predefined set of statements like sentences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative is to use Randomm to create a random number I use to pick a statement that is in the template, but for obvious reasons, I'd prefer the statements to be driven from Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help / thoughts much appreciated. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="3417" LastActivityDate="2015-09-14T22:14:26.783" Title="Random Field Entries" Tags="&lt;random&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11463" PostTypeId="2" ParentId="11454" CreationDate="2015-09-14T21:59:27.683" Score="1" Body="&lt;p&gt;Not currently.  Might be worth a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;, though?&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-02-25T05:16:22.470" LastActivityDate="2017-02-25T05:16:22.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11464" PostTypeId="2" ParentId="11461" CreationDate="2015-09-14T22:14:26.783" Score="1" Body="&lt;p&gt;I think I'm following and it sounds like the job for a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; with a custom &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;field type&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, since you want to use a &lt;a href=&quot;http://buildwithcraft.com/docs/dropdown-fields&quot; rel=&quot;nofollow&quot;&gt;Dropdown&lt;/a&gt; field, then your plugin's field type could extend Craft's default Dropdown field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When populating the field type's default values (from your pre-defined statements), you could then randomly select which ones are selected on new entries).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-14T22:14:26.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11465" PostTypeId="2" ParentId="11459" CreationDate="2015-09-15T00:37:32.197" Score="2" Body="&lt;p&gt;Sprout Email allows you to create &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events&quot; rel=&quot;nofollow&quot;&gt;Custom Events&lt;/a&gt; where you could add a new rule that allows a user to set the options needed to meet your use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the entire EntryModel will be handed off to the Notification when your Custom Event fires, so you could have logic in your notification template that sends customized messages depending on the different conditions that were met, just like in any other Twig template.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-09-15T00:37:32.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11466" PostTypeId="1" CreationDate="2015-09-15T01:54:12.923" Score="4" ViewCount="1336" Body="&lt;p&gt;How do install a Twig extension in Craft? Not write my own extension, but install an extension that exists. I want to install the extensions extension. There are a number of posts that describe how to write your own extension, but I can't see how to just install one. The Twig docs says add this: &lt;code&gt;$twig-&amp;gt;addExtension(new Twig_Extensions_Extension_Array());&lt;/code&gt; but obviously I don't want to edit core Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8223/how-do-you-add-a-core-twig-extension-in-plugins-using-addtwigextension&quot;&gt;How do you add a core twig extension in plugins using addTwigExtension()?&lt;/a&gt;, but the responses just convince the poster that he doesn't need to use that extension. What if he wanted to use it? How do you install it?&lt;/p&gt;&#xA;" OwnerUserId="3673" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-12-13T09:01:16.350" Title="How to install a Twig extension" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11467" PostTypeId="2" ParentId="11466" CreationDate="2015-09-15T03:34:15.187" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow&quot;&gt;BreakAndContinue&lt;/a&gt; plugin is an example of a plugin that adds a simple twig extension. I would start with that, and modify it to add the extensions extension (I assume that is this: &lt;a href=&quot;https://github.com/twigphp/Twig-extensions&quot; rel=&quot;nofollow&quot;&gt;https://github.com/twigphp/Twig-extensions&lt;/a&gt; ?) You might need to tweak the Twig PHP to get files to load etc., but not core Craft, since this will be a plugin.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="57" LastEditDate="2015-09-15T04:16:08.680" LastActivityDate="2015-09-15T04:16:08.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11468" PostTypeId="1" AcceptedAnswerId="11471" CreationDate="2015-09-15T03:57:04.963" Score="0" ViewCount="105" Body="&lt;p&gt;I have a registration form that has a dropdown that allows the user to choose a color. This form input will be the same across all pages that allow a user to register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I thought using a Global to populate that dropdown would make sense as the client could manage the color choices. In essence, this is what I'm trying to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if colorOptions.color | length %}&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;colorOption&quot;&amp;gt;Color Option&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select id=&quot;colorOption&quot; class=&quot;form-control&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt; Select&amp;lt;/option&amp;gt;&#xA;            {% for option in colorOptions.color %}&#xA;                &amp;lt;option value=&quot;{{ option }}&quot;&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm struggling with what kind of field type &lt;code&gt;color&lt;/code&gt; needs/should/could be within the &lt;code&gt;colorOptions&lt;/code&gt; group.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-09-15T09:08:32.487" Title="How can I populate a dropdown via Globals?" Tags="&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11469" PostTypeId="1" AcceptedAnswerId="12136" CreationDate="2015-09-15T07:56:25.723" Score="2" ViewCount="312" Body="&lt;p&gt;Is it possible to use craft multilanguage capabilities without &lt;code&gt;locale&lt;/code&gt; url segments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;German: &lt;code&gt;domain.com/wetter&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;English: &lt;code&gt;domain.com/weather&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is pretty dangerous. If one forgets to translate the url everything will fall apart. But I wonder if it would be possible theoretically :)&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-05-10T17:11:54.557" Title="Multilanguage without url segments" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11470" PostTypeId="2" ParentId="8961" CreationDate="2015-09-15T09:01:23.500" Score="0" Body="&lt;p&gt;Any non-public domain will do the job. Just hit Upgrade in your CP then you'll get a option to use it for free as long as you work on a non-public domain so localhost works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you transfer it to a public domain and you used Craft Pro only options you have to get a license to keep it up like you did on the dev version.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2015-09-15T09:01:23.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11471" PostTypeId="2" ParentId="11468" CreationDate="2015-09-15T09:08:32.487" Score="2" Body="&lt;p&gt;You could always just use a &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Table field&lt;/a&gt;, you could then just add a colour to each row, this allows you to give a descriptive name to each colour but also keep the value as the hex or whatever format your colours are in...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pm7qe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pm7qe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then its easy to loop like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in colorOptions.color %}&#xA;   &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.name }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you dont have to have two columns, you could just have the one and loop over the HEX values or whatever, it's totally up to you and how you want to do it. But personally I think the table field is a solid way to go!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-15T09:08:32.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11472" PostTypeId="2" ParentId="11182" CreationDate="2015-09-15T10:45:00.850" Score="10" Body="&lt;p&gt;I ran into this today. I thought &lt;code&gt;craft.request.path&lt;/code&gt; used to include the pagination page number but it doesn't appear to anymore. Maybe it was always like this though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, this is how I'm now handling it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum %}&#xA;...&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-09-15T10:45:00.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11473" PostTypeId="1" AcceptedAnswerId="11618" CreationDate="2015-09-15T10:54:42.260" Score="3" ViewCount="833" Body="&lt;p&gt;I have a string from a multi-line plain text field and I'd like to trim any trailing spaces before new lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With plain regex I would use this expression: &lt;code&gt;/\s*$/gm&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ string|replace('/\\s*$/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will trim out the last trailing space of the string (same as the &lt;code&gt;trim&lt;/code&gt; filter would), but not before every new line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ string|replace('/\\s*$/gm', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ string|replace('/\\s*$/m', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that doesn't have any effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I apply the &lt;code&gt;m modifier&lt;/code&gt; to the replace filter?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2015-12-05T15:15:49.863" Title="Trim trailing spaces before each new line in a multi-line string" Tags="&lt;filter&gt;&lt;replace&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11474" PostTypeId="1" AcceptedAnswerId="11930" CreationDate="2015-09-15T12:43:37.483" Score="9" ViewCount="1155" Body="&lt;p&gt;I'm replacing some templates with the ElementAPI plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my templates, I would use the &lt;code&gt;cache&lt;/code&gt; tag, and rely on Craft to handle invalidation when the elements changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I achieve a similar thing now that I'm using the ElementAPI plugin?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="57" LastEditDate="2015-09-15T17:06:51.617" LastActivityDate="2017-05-24T22:39:30.997" Title="How do I cache with the ElementAPI plugin?" Tags="&lt;cache&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11475" PostTypeId="1" CreationDate="2015-09-15T14:44:58.613" Score="0" ViewCount="75" Body="&lt;p&gt;I was just wondering when it's recommended to set the attributes on a custom model? Would it be ok to set them within the model's constructor or not? I guess it depends on when &lt;code&gt;defineAttributes()&lt;/code&gt; is called, right?&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-09-17T16:24:58.553" Title="When to set Model properties" Tags="&lt;plugin-development&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11476" PostTypeId="2" ParentId="11427" CreationDate="2015-09-15T16:07:50.587" Score="1" Body="&lt;p&gt;It turned out &lt;strong&gt;not to be Craft's fault&lt;/strong&gt;, indeed: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the server, the &lt;code&gt;HTTP_X_FORWARDED_PROTO&lt;/code&gt; environment variable was erroneously set to &lt;code&gt;https&lt;/code&gt; in the reverse proxy – an issue that my hosting provider had to resolve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As a quick fix, the following line in &lt;code&gt;index.php&lt;/code&gt; did the trick, too:)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; apache_setenv('HTTP_X_FORWARDED_PROTO', 'http');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to @brad-bell and @ritterknight for pointing in the right direction!&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2015-09-15T16:07:50.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11477" PostTypeId="1" AcceptedAnswerId="11495" CreationDate="2015-09-15T16:42:22.547" Score="1" ViewCount="58" Body="&lt;p&gt;Normally I add images to a post through a field for it, but now I thought I'd just use the uploader in the text/newspost field. However, this gives me the following problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When on index.htm for the blog channel the image is shown.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://inquisimunda.evinwijninga.com/uploads/Facebook-Banner.gif&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I go to the the posts page itself however, the post isn't shown as it can't be found. It also isn't shown in the text editor when I edit the post. (Broken image link).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://inquisimunda.evinwijninga.com/article/2015/uploads/Facebook-Banner.gif&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have never tried to fix routing issues before as I had never had any issues like this before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a quick fix for this?&lt;/p&gt;&#xA;" OwnerUserId="1072" LastActivityDate="2015-09-16T15:21:35.783" Title="Asset routing issue in combination with slug and date" Tags="&lt;assets&gt;&lt;image&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11478" PostTypeId="1" CreationDate="2015-09-15T17:02:58.040" Score="1" ViewCount="92" Body="&lt;p&gt;It seems like most Craft queries contain GROUP BY &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt; but this seems to clash with a HAVING clause when using the Smart Map plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does this come from and is it possible to override/remove this?&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2021-01-01T06:24:02.863" Title="Smart Map plugin, HAVING SQL and GROUP BY elements.id" Tags="&lt;custom-fieldtype&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11479" PostTypeId="2" ParentId="11478" CreationDate="2015-09-15T17:36:55.043" Score="1" Body="&lt;p&gt;The HAVING clause comes from this piece of code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// Modify query&#xA;$query&#xA;    -&amp;gt;addSelect($haversine.' AS distance')&#xA;    -&amp;gt;having('distance &amp;lt;= '.$filter-&amp;gt;range)&#xA;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The variables going into this query modification are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;$haversine&lt;/code&gt; - A complex formula which determines the relative distance of each address from the center point.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;$filter-&amp;gt;range&lt;/code&gt; - The maximum search distance. (defaults to 25)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This code exists so that your proximity search results can be &lt;strong&gt;sorted by closest locations&lt;/strong&gt;. It will be triggered any time you chain this into your Twig query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;.myFieldHandle(params)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see the full details of how this all ties together in the documentation here:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There should be no conflict with any existing GROUP BY clause... Smart Map does not set or modify that aspect of the query. And there is no inherent conflict between HAVING and GROUP BY, as demonstrated by &lt;a href=&quot;http://www.w3schools.com/sql/sql_having.asp&quot; rel=&quot;nofollow noreferrer&quot;&gt;this w3schools example&lt;/a&gt;, which utilizes both in combination.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:24:02.863" LastActivityDate="2021-01-01T06:24:02.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11480" PostTypeId="1" AcceptedAnswerId="11483" CreationDate="2015-09-15T19:06:26.533" Score="1" ViewCount="12730" Body="&lt;p&gt;I have a very large entry type in craft with quite a few fields.  I've been updating a single record on a regular basis but upon adding a few more paragraphs of rich text in a field, I received this error when trying to save:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (&gt; 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there some other solution beyond what the error is suggesting? Not sure what I'm missing. Any thoughts would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 10/1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to get the existing table in my Craft instance updated to the barracuda file format with row_format=DYNAMIC. Updated the global MySQL params as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+--------------------------+-----------+&#xA;| Variable_name            | Value     |&#xA;+--------------------------+-----------+&#xA;| innodb_file_format       | Barracuda |&#xA;| innodb_file_format_check | ON        |&#xA;| innodb_file_format_max   | Barracuda |&#xA;| innodb_file_per_table    | ON        |&#xA;+--------------------------+-----------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem now is with new matrix fields: the newly created tables are not being set to the row_format=DYNAMIC. Is there somewhere in Craft where I need to update this? Or is there somewhere else I need to update this?&lt;/p&gt;&#xA;" OwnerUserId="1096" LastEditorUserId="1096" LastEditDate="2015-10-01T23:42:50.837" LastActivityDate="2020-03-09T19:47:04.697" Title="Internal Server Error: SQLSTATE[42000] 1118 Row size too large" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11481" PostTypeId="1" AcceptedAnswerId="11496" CreationDate="2015-09-15T19:59:17.667" Score="3" ViewCount="734" Body="&lt;p&gt;I am attempting to create a relationship between products.&#xA;I have a section named &quot;product&quot; which is a Structure. Each &quot;product&quot; entry has a category field called &quot;species&quot; and a category field called &quot;category&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &quot;species&quot; category is a nested category. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dogs&#xA;  |-- Dachshund&#xA;  |-- Chiwawa&#xA;Cats&#xA;  |-- Long Hair&#xA;  |-- Short Hair&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &quot;category&quot; category is a single list. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Yellow&#xA;Green&#xA;Blue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a form that I am trying to filter back my entries based on which &quot;species&quot; and/or &quot;category&quot; is chosen from the drop-down menu(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the ajax part down - no problem. I am sending a request to a twig &lt;code&gt;.json&lt;/code&gt; template, and I am always getting into my &quot;No Results&quot; condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the twig syntax I'm using. I have to be close (hopefully)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set species = craft.request.getParam('species') %} // returns &quot;Dachshund&quot;&#xA;{% set category = craft.request.getParam('category')  // returns &quot;Yellow&quot;&#xA;&#xA;{% set products = craft.entries.section('product').relatedTo('or',&#xA;{ sourceElement: category, field: 'category' },&#xA;{ targetElement: species, field: 'species' }&#xA;) %}&#xA;&#xA;{&#xA;    &quot;results&quot;: [{&#xA;        {% if products|length %}&#xA;            &quot;status&quot;: &quot;OK&quot;,&#xA;            &quot;products&quot;: [&#xA;                {% for product in products %}&#xA;                    {&#xA;                        &quot;name&quot;: &quot;{{ product.title }}&quot;&#xA;                    } {% if not loop.last %},{% endif %}&#xA;                {% endfor %}&#xA;            ]&#xA;        {% else %}&#xA;            &quot;status&quot;: &quot;NO_RESULTS&quot;&#xA;        {% endif %}&#xA;    }]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also been trying to follow &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4414/search-contact-person-plugin-via-ajax/4415#4415&quot;&gt;this thread&lt;/a&gt; in SO to search for entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I need a conditional (this or that) since a user could choose a &quot;species&quot; but not a &quot;category&quot; so &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; from the docs is where I need to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have gotten results back, but then run into an error that a class can't be converted to a string. I assume that's because I don't have the syntax correct to dig down into the category group correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my &quot;product&quot; entry, the &quot;species&quot; category field looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dogs&#xA;  |--Dachshund&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am also 100% confident the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementAPI&lt;/a&gt; would be extremely helpful, I just haven't figured out how to incorporate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my updated &lt;code&gt;products.json&lt;/code&gt; file that I am submitting the form to. I still fall into the &lt;code&gt;NO_RESULTS&lt;/code&gt; condition.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;{% set species = craft.request.getParam('species').first() %}&#xA;{% set category = craft.request.getParam('category').first() %}&#xA;&#xA;{% set foo = craft.entries.section('product').species(species) %}&#xA;{% set bar = craft.entries.section('product').category(category) %}&#xA;&#xA;{% set products = craft.entries.section('product').relatedTo('or',&#xA;    { sourceElement: foo, field: 'species' },&#xA;    { targetElement: bar, field: 'category' }&#xA;) %}&#xA;&#xA;{&#xA;    &quot;results&quot;: [{&#xA;        {% if products|length %}&#xA;            &quot;status&quot;: &quot;OK&quot;,&#xA;            &quot;products&quot;: [&#xA;                {% for product in products %}&#xA;                  {&#xA;                    &quot;name&quot;: &quot;{{ product.title }}&quot;&#xA;                  } {% if not loop.last %},{% endif %}&#xA;                {% endfor %}&#xA;            ]&#xA;        {% else %}&#xA;            &quot;status&quot;: &quot;NO_RESULTS&quot;&#xA;        {% endif %}&#xA;    }]&#xA;}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-09-16T18:26:14.697" Title="Search for related entries via AJAX given multiple parameters" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11482" PostTypeId="1" AcceptedAnswerId="11485" CreationDate="2015-09-15T20:14:53.740" Score="2" ViewCount="685" Body="&lt;p&gt;I searched the Craft and Twig documentation, although I did not find any information about a logarithm function (&lt;a href=&quot;http://php.net/manual/en/function.log.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/function.log.php&lt;/a&gt; ). I am trying to calculate the loan amortization formula below in Craft / Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set payoffTime  = -(ln(1 - ((128000 * '.05') / 1260)) / ln(1 + '.05')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The numbers will be replaced with field handles once I can get the 'ln' function working. I'm not even sure if the formula is 'exactly' the way it should be yet - just trying to find a way to get logarithms working in Craft, and then go from there with testing, etc. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give some background on the goal of this: it will calculate the amount of time it will take to pay off an amoritized loan, (mortgage, etc) based on the amounts the user has already submitted (loan amount, interest rate, extra payments, etc.) Also, this can't be done in Javascript - it needs to be in Craft since it's calculated from user data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for any info you can give about the logarithm function in Craft / Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2015-09-16T19:37:30.003" Title="Is there a logarithm function in Craft or Twig?" Tags="&lt;function&gt;&lt;math&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11483" PostTypeId="2" ParentId="11480" CreationDate="2015-09-15T20:21:23.763" Score="3" Body="&lt;p&gt;You're running into a MySQL/InnoDB server limitation that commonly occurs with a significant number of columns in a single table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, there are several documented workarounds for it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/15585602/change-limit-for-mysql-row-size-too-large&quot;&gt;https://stackoverflow.com/questions/15585602/change-limit-for-mysql-row-size-too-large&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.percona.com/blog/2011/04/07/innodb-row-size-limitation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.percona.com/blog/2011/04/07/innodb-row-size-limitation/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dba.stackexchange.com/questions/6598/innodb-create-table-error-row-size-too-large&quot;&gt;https://dba.stackexchange.com/questions/6598/innodb-create-table-error-row-size-too-large&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Craft side, another workaround would be to re-think your information architecture. Currently, most fields in Craft have their content stored in the &lt;code&gt;craft_content&lt;/code&gt; table in the database, so when you have a lot of textual fields on the site, you'll see the error you're getting.  The exception to this rule is Matrix fields, which get their own table where their content is stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can move any of those fields into Matrix fields where they make sense, you'll take them out of the &lt;code&gt;craft_content&lt;/code&gt; table helping mitigate the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2020-03-09T19:47:04.697" LastActivityDate="2020-03-09T19:47:04.697" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11484" PostTypeId="1" AcceptedAnswerId="11524" CreationDate="2015-09-15T21:04:08.010" Score="0" ViewCount="82" Body="&lt;p&gt;I'm trying to do &lt;code&gt;craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementId&lt;/code&gt; on &lt;code&gt;entries.onDeleteEntry&lt;/code&gt;, unsuccessfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The event listener is working, but the caches don't get invalidated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.onSaveEntry', function($event) {&#xA;        $this-&amp;gt;clearEntryCache($event);&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('entries.onDeleteEntry', function($event) {&#xA;        $this-&amp;gt;clearEntryCache($event);&#xA;    });&#xA;&#xA;}&#xA;&#xA;public function clearEntryCache(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementId($entry-&amp;gt;id, true);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;entries.onSaveEntry&lt;/code&gt; works perfectly.&lt;/li&gt;&#xA;&lt;li&gt;Instead of run &lt;code&gt;deleteCachesByElementId&lt;/code&gt;, if I &lt;code&gt;deleteAllCaches&lt;/code&gt;, it works (but I don't want to do this)&lt;/li&gt;&#xA;&lt;li&gt;I've also tried &lt;code&gt;entries.onBeforeDeleteEntry&lt;/code&gt; with no luck.&lt;/li&gt;&#xA;&lt;li&gt;I've tried deleting from the entry, and from the entry listing (bulk delete) screen.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the surface it seems maybe it isn't working because by the time &lt;code&gt;deleteCachesByElementId&lt;/code&gt;, the element is already deleted...though it still seems there should be a way to delete that cache with the elementId reference.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-09-18T14:45:19.567" Title="Cannot invalidate template cache (by element) on entries.onDeleteEntry" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11485" PostTypeId="2" ParentId="11482" CreationDate="2015-09-15T21:16:52.267" Score="5" Body="&lt;p&gt;The short answer is &lt;strong&gt;no&lt;/strong&gt;... because Twig is a templating language, and Craft doesn't otherwise have a general need for a &lt;code&gt;log&lt;/code&gt; type of function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The longer answer is &lt;strong&gt;you can very easily build this yourself!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Grab the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic Template&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Delete the &lt;code&gt;services&lt;/code&gt; and &lt;code&gt;controllers&lt;/code&gt; folders... you won't need them.&lt;/li&gt;&#xA;&lt;li&gt;In the &lt;code&gt;BusinessLogicVariable.php&lt;/code&gt; file, change &lt;code&gt;exampleVariable&lt;/code&gt; to &lt;code&gt;payoffTime&lt;/code&gt;. Whatever parameters you assign to this function will correspond to the parameters you'll use when calling this variable from Twig.&lt;/li&gt;&#xA;&lt;li&gt;Set whatever logic you want within the function, and return the resulting value.&lt;/li&gt;&#xA;&lt;li&gt;Enable the plugin from your Control Panel.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Call that variable from your Twig template!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set payoffTime = craft.businessLogic.payoffTime(foo, bar) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example based on the use case you outlined in the comments below...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Twig:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set payoffTime = craft.businessLogic.payoffTime(entry.loanAmount, entry.loanPayment) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function payoffTime($loanAmount, $loanPayment)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you wanted to, you could even pass the whole &lt;code&gt;entry&lt;/code&gt; object in as a single parameter, and just use its field values once you're on the PHP side of things...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Twig:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set payoffTime = craft.businessLogic.payoffTime(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function payoffTime($entry)&#xA;{&#xA;    // $entry-&amp;gt;loanAmount&#xA;    // $entry-&amp;gt;loanPayment&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-09-16T19:37:30.003" LastActivityDate="2015-09-16T19:37:30.003" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11486" PostTypeId="2" ParentId="5290" CreationDate="2015-09-16T02:04:43.963" Score="1" Body="&lt;p&gt;Turns out this plugin wasn't working due to a custom submit button being used in the CP. It has been fixed in the current version. &lt;a href=&quot;https://github.com/victor-in/Craft-Mailer&quot; rel=&quot;nofollow&quot;&gt;https://github.com/victor-in/Craft-Mailer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-09-16T02:04:43.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11487" PostTypeId="1" CreationDate="2015-09-16T05:43:54.013" Score="5" ViewCount="577" Body="&lt;p&gt;I'm sure there must be an easy way to do this, but I can't work it out...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to add date filters to the formerly submission export, but I can't work out how to filter out the submissions between 2 dates. I got it working with a bit of a hack:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Formerly_Submission');&#xA;$fromDate   = craft()-&amp;gt;request-&amp;gt;getPost('fromDate');&#xA;$fromDate = DateTime::createFromString($fromDate,   craft()-&amp;gt;timezone) ;&#xA;$toDate   = craft()-&amp;gt;request-&amp;gt;getPost('toDate');&#xA;$toDate = DateTime::createFromString($toDate,   craft()-&amp;gt;timezone) ;&#xA;&#xA;//A bit of a hack, in my case these date fields are always the same anyway&#xA;$criteria-&amp;gt;dateCreated = '&amp;gt;= ' . $fromDate-&amp;gt;format(DateTime::MYSQL_DATETIME);&#xA;$criteria-&amp;gt;dateUpdated = '&amp;lt;= ' . $toDate-&amp;gt;format(DateTime::MYSQL_DATETIME);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried all sorts of ways to do it properly, things like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;dateCreated ='and, &amp;gt; ' . $fromDate-&amp;gt;format(DateTime::MYSQL_DATETIME) . ', &amp;gt; ' . $toDate-&amp;gt;format(DateTime::MYSQL_DATETIME)'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;anyone know how to do it properly?&lt;/p&gt;&#xA;" OwnerUserId="3673" LastActivityDate="2017-05-11T06:11:44.787" Title="filtering elements between 2 dates" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11488" PostTypeId="1" AcceptedAnswerId="11489" CreationDate="2015-09-16T07:01:06.830" Score="1" ViewCount="42" Body="&lt;p&gt;I'm new to craft development, and I'm on the verge of success in the creation of my plugin, but I have a strange problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's supposed to save a record based on user input data. The problem is that it works on my computer, but not on my mobile phone (-&gt; result in 404).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;ui form&quot; method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Activité&amp;lt;/label&amp;gt;&#xA;             &amp;lt;select name=&quot;activity&quot; class=&quot;ui fluid dropdown&quot;&amp;gt;&#xA;                 &amp;lt;option value=&quot;3&quot;&amp;gt;Third&amp;lt;/option&amp;gt;&#xA;                 &amp;lt;option value=&quot;2&quot;&amp;gt;Second&amp;lt;/option&amp;gt;&#xA;                 &amp;lt;option value=&quot;1&quot;&amp;gt;First&amp;lt;/option&amp;gt;&#xA;             &amp;lt;/select&amp;gt;&#xA;         &amp;lt;/div&amp;gt;&#xA;         &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;             &amp;lt;label&amp;gt;Nom et prénom&amp;lt;/label&amp;gt;&#xA;             &amp;lt;input name=&quot;nom&quot; type=&quot;text&quot;&amp;gt;&#xA;         &amp;lt;/div&amp;gt;&#xA;&#xA;         &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;eventEquipe/event/addParticipant&quot;&amp;gt;&#xA;         &amp;lt;button class=&quot;positive ui fluid button&quot; type=&quot;submit&quot;&amp;gt;Je viens !&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my controller's code&#xA;public function actionAddParticipant() {&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requirePostRequest();&#xA;&#xA;    $participant        = new EventEquipe_ParticipantRecord();&#xA;    $request            = craft()-&amp;gt;request;&#xA;&#xA;    $participant-&amp;gt;nom       = $request-&amp;gt;getPost('nom');&#xA;    $participant-&amp;gt;activity  = $request-&amp;gt;getPost('activity');&#xA;&#xA;    craft()-&amp;gt;eventEquipe_event-&amp;gt;saveParticipant($participant);&#xA;    $this-&amp;gt;redirect('/agenda');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that sometimes, this redirects me to /login (I dont know why, I have no /login route) and thus result in a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2015-09-16T07:35:22.557" Title="Form validation plugin result in 404" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11489" PostTypeId="2" ParentId="11488" CreationDate="2015-09-16T07:35:22.557" Score="1" Body="&lt;p&gt;Sounds like you need to &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;allow anonymous access to your controller action&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it works on your computer because you are logged in and thus have a valid session, but then when you try on mobile, you haven't got a valid session, your controller isn't set up to allow logged out users to post to it and therefore you get redirected to &lt;code&gt;/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To allow non logged in users access to this action, its simple. Add either one of these just at the top within your controller class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Will allow anonymous access to all actions within this controller&#xA;protected $allowAnonymous = true;&#xA;&#xA;// Only allow access to specific actions&#xA;protected $allowAnonymous = array('action addParticipant');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-16T07:35:22.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11490" PostTypeId="1" AcceptedAnswerId="12072" CreationDate="2015-09-16T09:57:27.093" Score="6" ViewCount="943" Body="&lt;p&gt;Has anyone had experience integrating craft with algolia: &lt;a href=&quot;https://www.algolia.com&quot; rel=&quot;noreferrer&quot;&gt;https://www.algolia.com&lt;/a&gt; for realtime search of craft entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like there are a few potential approaches with their Php and Js libraries. Does anyone recommend a particular approach or best practice for integrating a service like this with Craft. &lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2018-06-14T01:02:38.013" Title="How would you recommend integrating craft with Algolia" Tags="&lt;search&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11491" PostTypeId="1" AcceptedAnswerId="11494" CreationDate="2015-09-16T10:59:27.923" Score="1" ViewCount="909" Body="&lt;p&gt;I'm trying to create a conditional logic so that the class 'white-nav-bg' is added to the  element on the 'blog' section entries only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code I'm currently using to try and achieve this with a logic tag but it is adding the 'white-nav-bg' class to all pages on the site rather than just the blog section entry pages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;navbar navbar-default navbar-fixed-top&#xA;  {% for entry in craft.entries.section('blog').limit(1) %}&#xA;    {% if entry.type.handle == 'post' %}white-nav-bg{% endif %}&#xA;  {% endfor %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is in the '_layout.html' file, hence needing to figure out how to do conditional logic tags rather than adding the code differently in the blog template files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After much time looking through Craft documentation I can't seem to find an example of how to do this. Any help would be gratefully received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following helpful answers I have come to the following code, which works and allows me to define multiple sections to have the 'white-nav-bg' class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment1 = craft.request.segment(1) %}&#xA;&amp;lt;nav class=&quot;navbar navbar-default navbar-fixed-top&#xA;  {% if segment1 == 'blog' %}&#xA;    white-nav-bg&#xA;  {% elseif segment1 == 'our-work' %}&#xA;    white-nav-bg&#xA;  {% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4095" LastEditorUserId="130" LastEditDate="2015-10-03T21:12:50.550" LastActivityDate="2015-10-03T21:12:50.550" Title="Conditional logic to add class for specific section entries" Tags="&lt;entry&gt;&lt;sections&gt;&lt;conditional&gt;&lt;logic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11492" PostTypeId="2" ParentId="11491" CreationDate="2015-09-16T11:42:05.640" Score="1" Body="&lt;p&gt;There are many possibilities for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of them is to listen to the section handle if you want it to be triggered only on the blog template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section.handle == 'blog' %}your-class{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-09-16T11:42:05.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11493" PostTypeId="2" ParentId="6708" CreationDate="2015-09-16T13:45:47.953" Score="2" Body="&lt;p&gt;I ran into this issue a few times, turns out I had to change htaccess to .htaccess in the public_html/ folder&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2015-09-16T13:45:47.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11494" PostTypeId="2" ParentId="11491" CreationDate="2015-09-16T14:06:39.613" Score="1" Body="&lt;p&gt;You could also do it based on segments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment1 = craft.request.segment(1) %}&#xA;&#xA;{% if segment1 == 'blah' %}&#xA;    do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="101" LastEditorUserId="57" LastEditDate="2015-09-16T21:05:25.957" LastActivityDate="2015-09-16T21:05:25.957" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11495" PostTypeId="2" ParentId="11477" CreationDate="2015-09-16T15:21:35.783" Score="1" Body="&lt;p&gt;The mistake I made was entering &quot;uploads/&quot; in the url in file management. This should be &quot;/uploads&quot;.&lt;a href=&quot;https://i.stack.imgur.com/jyZhQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jyZhQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1072" LastActivityDate="2015-09-16T15:21:35.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11496" PostTypeId="2" ParentId="11481" CreationDate="2015-09-16T18:26:14.697" Score="2" Body="&lt;p&gt;I finally figured everything out, It took a long time to figure out what I actually needed to search for to find the answers I needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put a comment at the bottom of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1878/advanced-search&quot;&gt;this thread&lt;/a&gt; that was also of tremendous help. Passing multiple arguments to find related entries via categories.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-09-16T18:26:14.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11499" PostTypeId="2" ParentId="11487" CreationDate="2015-09-16T20:54:15.190" Score="4" Body="&lt;p&gt;You call it a bit of a hack, but I think the way you're doing it is the proper way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;dateCreated = '&amp;gt;= ' . $fromDate-&amp;gt;format(DateTime::MYSQL_DATETIME);&#xA;$criteria-&amp;gt;dateUpdated = '&amp;lt;= ' . $toDate-&amp;gt;format(DateTime::MYSQL_DATETIME);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your last example would work (with a syntax change) if you were you looking for a date range within a single field (either dateCreated or dateUpdated) like so, but not across two fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;dateUpdated = array('and', '&amp;gt;='.$fromDate-&amp;gt;format(DateTime::MYSQL_DATETIME), '&amp;lt;='.$toDate-&amp;gt;format(DateTime::MYSQL_DATETIME));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="340" LastEditDate="2017-05-11T06:11:44.787" LastActivityDate="2017-05-11T06:11:44.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11500" PostTypeId="1" AcceptedAnswerId="11515" CreationDate="2015-09-17T01:41:35.900" Score="0" ViewCount="1235" Body="&lt;p&gt;I'm having a problem calling a service method from another plugin when hooking into the &lt;code&gt;beforeSend&lt;/code&gt; event in the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;ContactForm&lt;/a&gt; plugin. I have the code below in a super simple plugin called &lt;code&gt;ContactFormExtra&lt;/code&gt; to catch if someone wants to also subscribe to our newsletter when they fill in the contact form. I have another subscribe plugin setup with it's service class having the methods to do the subscribing - which also handles a simpler subscribe form without the contact form fields. Any ideas on how this could work - or do I need to put all the subscribe stuff again into the &lt;code&gt;ContactFormExtra&lt;/code&gt; plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This follows the example on GitHub for &lt;code&gt;pixelandtonic/ContactForm&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to subscribe on the contact form, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\ContactFormExtraPlugin and its behaviors do not have a method or closure named &quot;_getSettings&quot;. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks like it's trying to call the Subscribe plugin's functions from the ContactFormExtra plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I don't choose to subscribe and submit the form, then the &lt;code&gt;Subscribe&lt;/code&gt; plugin service call is skipped, moving on to the calls on the &lt;code&gt;ContactFormExtra&lt;/code&gt; plugin's service. Then I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Property &quot;Craft\WebApp.contactformextra&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simple &lt;code&gt;ContactFormExtra&lt;/code&gt; plugin code: &#xA;(&lt;code&gt;plugins/contactformextra/ContactFormExtraPlugin.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ContactFormExtraPlugin extends BasePlugin&#xA;{&#xA;  public function init()&#xA;  {&#xA;    craft()-&amp;gt;on('contactForm.beforeSend', function(ContactFormEvent $event) {&#xA;      $message = $event-&amp;gt;params['message'];&#xA;      $subscribe = craft()-&amp;gt;request-&amp;gt;getPost('subscribe');&#xA;      $attribs = $message-&amp;gt;getAttributes();&#xA;      if ($subscribe == 1) {&#xA;        $result = SubscribeService::subscribe($attribs['fromEmail']);&#xA;      }&#xA;      // save the record&#xA;      $attribs = $message-&amp;gt;getAttributes();&#xA;      $attribs['subscribe'] = $subscribe;&#xA;      $enquiryModel = craft()-&amp;gt;contactformextra-&amp;gt;newEnquiry($attribs);&#xA;      craft()-&amp;gt;contactformextra-&amp;gt;saveEnquiry($enquiryModel);&#xA;    });&#xA;  }&#xA;  ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ContactFormExtra&lt;/code&gt; plugin service code: &#xA;(&lt;code&gt;plugins/contactformextra/services/ContactFormExtraService.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ContactFormExtraService extends BaseApplicationComponent&#xA;{&#xA;&#xA;    public function newEnquiry($attributes) {&#xA;      // do stuff here&#xA;    }&#xA;&#xA;    public function saveEnquiry(ContactFormExtra_EnquiryModel &amp;amp;$model) {&#xA;      // do stuff here&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Subscriber&lt;/code&gt; plugin:&#xA;(&lt;code&gt;plugins/subscribe/services/SubscribeService.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SubscribeService extends BaseApplicationComponent&#xA;{&#xA;  protected $settings;&#xA;&#xA;  private function _getSettings()&#xA;  {&#xA;    $plugin_settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('subscribe')-&amp;gt;getSettings();&#xA;    $this-&amp;gt;settings = $plugin_settings;&#xA;  }&#xA;&#xA;  public function subscribe($email)&#xA;  {&#xA;    $this-&amp;gt;_getSettings();&#xA;    // do the subscribing here...&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3637" LastEditorUserId="3637" LastEditDate="2015-09-17T12:58:10.807" LastActivityDate="2015-09-17T17:28:12.667" Title="Calling a method from a service in another plugin from an event" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11501" PostTypeId="2" ParentId="373" CreationDate="2015-09-17T03:00:27.230" Score="6" Body="&lt;p&gt;For those that are looking for a plugin that simply notifies users (&lt;em&gt;without&lt;/em&gt; all the overhead), take a look at &lt;a href=&quot;https://github.com/taylordaughtry/brief&quot; rel=&quot;noreferrer&quot;&gt;Brief&lt;/a&gt;. It's a &lt;strong&gt;super-light&lt;/strong&gt; plugin that simply notifies users whenever a new entry is added to a Section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anybody has a specific need for it, I'd be glad to add features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information: &lt;a href=&quot;https://github.com/taylordaughtry/brief&quot; rel=&quot;noreferrer&quot;&gt;Brief&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-17T03:00:27.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11502" PostTypeId="2" ParentId="11500" CreationDate="2015-09-17T05:29:09.690" Score="0" Body="&lt;p&gt;I don't quite understand why you're getting the error message you are, but I see a couple of issues with your code that should be addressed first.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You're calling &lt;code&gt;SubscribeService::subscribe&lt;/code&gt; statically and the method is not declared as a static method in SubscribeService (&lt;code&gt;public function subscribe($email)&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generally you don't want expose static methods in the service layer of your plugin.  If that's the only service your plugin has, then you should be able to do a &lt;code&gt;craft()-&amp;gt;subscribe-&amp;gt;subscribe($attribs['fromEmail'])&lt;/code&gt; from your &lt;code&gt;ContactFormExtra&lt;/code&gt; plugin.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-17T05:29:09.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11503" PostTypeId="1" AcceptedAnswerId="11513" CreationDate="2015-09-17T06:00:33.097" Score="0" ViewCount="179" Body="&lt;p&gt;I have a LJ Dynamic field set up with the following code that pulls in a list of stores to an event section. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for store in craft.entries.section('stores').order('title') %}&#xA;  { &quot;value&quot;:&quot;{{ store.storeId }}&quot; , &quot;label&quot;:&quot;{{ store.title | raw}}&quot;}&#xA;  {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is that I can't seem to get the label from the field to display on the front end as I keep getting the error message &#xA;&quot;Impossible to access an attribute (&quot;label&quot;) on a string variable (&quot;412&quot;)&quot; 412 is the value of the particular store I have selected for my event.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;location&quot;&amp;gt;&amp;lt;strong&amp;gt;Where:&amp;lt;/strong&amp;gt; {{ entry.stores.label }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I add just &lt;code&gt;{ entry.stores }&lt;/code&gt; it will output the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably something very obvious but got me a bit stuck. &lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2015-09-17T18:24:52.320" Title="How do I grab the label of a LJ Dynamic dropdown fields" Tags="&lt;label&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11504" PostTypeId="1" CreationDate="2015-09-17T06:41:42.643" Score="2" ViewCount="571" Body="&lt;p&gt;I'm moving all of my assets from a local folder to Amazon S3. I've got my S3 source all set up, and I've been migrating folders over to it by dragging &amp;amp; dropping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, I have &lt;strong&gt;thousands&lt;/strong&gt; of asset folders. I did the math, and it'll take me 4+ hours to drag &amp;amp; drop each of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there some way to bulk move asset folders?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not possible in the CP, I'm open to plugin suggestions as well.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-17T20:53:24.267" Title="Bulk moving asset folders, from one source to another" Tags="&lt;assets&gt;&lt;migration&gt;&lt;sources&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11505" PostTypeId="2" ParentId="11504" CreationDate="2015-09-17T06:50:00.983" Score="1" Body="&lt;p&gt;I did this with &lt;a href=&quot;http://gruntjs.com/&quot; rel=&quot;nofollow&quot;&gt;grunt&lt;/a&gt;, using the &lt;a href=&quot;https://github.com/MathieuLoutre/grunt-aws-s3&quot; rel=&quot;nofollow&quot;&gt;grunt-aws-s3&lt;/a&gt; task. It worked beautifully. If you are a &lt;a href=&quot;http://gulpjs.com/&quot; rel=&quot;nofollow&quot;&gt;gulp&lt;/a&gt; person, I'm sure there is something similar for gulp.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-09-17T06:50:00.983" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11507" PostTypeId="1" CreationDate="2015-09-17T09:22:12.430" Score="1" ViewCount="321" Body="&lt;p&gt;I'm trying to route the homepage / to a specific template. In my routes.php file, i've tried these two without result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '/' =&amp;gt; 'specific/_entry',&#xA;    '' =&amp;gt; 'specific/_entry',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="57" LastEditDate="2015-09-17T19:36:41.833" LastActivityDate="2015-09-17T19:36:41.833" Title="Route / to specific template" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11508" PostTypeId="1" AcceptedAnswerId="11742" CreationDate="2015-09-17T09:37:41.190" Score="7" ViewCount="1170" Body="&lt;p&gt;With a bit of looking around i've got the following code on my News landing page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set allEntries = craft.entries.section('chambersNews').limit(null) %}&#xA;  &amp;lt;ul id=&quot;archive&quot;&amp;gt;&#xA;  {% for year, entriesInYear in allEntries | group(&quot;postDate.year&quot;) %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;{{ year }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;        {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/code&gt;  I get the desired result (visually), see attached image.  If I use &lt;code&gt;&amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&lt;/code&gt; I get the result shown on the right of the attached image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both instances I only get a link to the first segment (also shown in the attached image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is have the Months link to a page that lists just the articles from that month (I don't need the year to link).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I need to add a dynamic link into the href but how and what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hpIi5.jpg&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hpIi5.jpg&quot; alt=&quot;Need the left hand side linking through to a page showing articles from a chosen month&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-10-05T17:17:05.403" Title="Linking and showing archive by month" Tags="&lt;archives&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11510" PostTypeId="1" CreationDate="2015-09-17T10:13:40.970" Score="0" ViewCount="713" Body="&lt;p&gt;I'm looking answer because I need access for all user in database access to disable entries&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This mean somebody will publish something and administrator will be change status for entires from live to disable and CMS will be send notification to user about that. When you user will be login to account will be see entires live and disable and access to this entries. Right now I can show every entries live and disable but when click link live entire go to template and work fine but when I click link disable entries to to 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for help,&#xA;SS    &lt;/p&gt;&#xA;" OwnerUserId="4100" LastEditorUserId="57" LastEditDate="2015-09-17T19:37:27.527" LastActivityDate="2015-09-17T19:37:27.527" Title="How can I access disabled entries?" Tags="&lt;craft-pro&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11511" PostTypeId="2" ParentId="11507" CreationDate="2015-09-17T12:02:13.703" Score="1" Body="&lt;p&gt;A site's home page is routed via a special route &lt;code&gt;__home__&lt;/code&gt;. I don't believe you can set that in &lt;code&gt;routes.php&lt;/code&gt;, but it's worth a shot. Generally, you specify a Single as the homepage, and can set the template there. It defaults to &lt;code&gt;index&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-09-17T12:02:13.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11512" PostTypeId="2" ParentId="11510" CreationDate="2015-09-17T12:08:51.897" Score="3" Body="&lt;p&gt;You would need to create a custom route in the Control Panel that matches the same basic routing as your entries. Then in the entry template, you need to add some extra code that pulls disabled entries. Something like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.section('whatevs').uri(craft.request.url).status(null).first() %}&#xA;    {% if entry is null %}{% redirect '404' %}{% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-09-17T12:08:51.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11513" PostTypeId="2" ParentId="11503" CreationDate="2015-09-17T13:21:26.840" Score="2" Body="&lt;p&gt;The LJ Dynamic fieldtype only stores the value as a string, or as an array of values for the multiselect fieldtypes. The label in the settings is there just for displaying in the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either you could use the store.title instead of store.storeId as the value, if you only need the store name in your template. Or you could use the store id to get the data from the store in your template. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set store = craft.entries.section('stores').storeId(entry.stores).first() %}&#xA;{{ store.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2015-09-17T18:24:52.320" LastActivityDate="2015-09-17T18:24:52.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11514" PostTypeId="2" ParentId="11475" CreationDate="2015-09-17T16:24:58.553" Score="1" Body="&lt;p&gt;Depending on how your plugin is setup, you should likely be setting model attributes in your Services. Create a new Model object, set its attributes, then pass that Model to the proper Record and save it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this all varies based on what you're doing with it. If you provide more information, I'll see if I can lend a hand.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-17T16:24:58.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11515" PostTypeId="2" ParentId="11500" CreationDate="2015-09-17T17:28:12.667" Score="1" Body="&lt;p&gt;Capitalization matters when you're calling services. Try updating this line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$enquiryModel = craft()-&amp;gt;contactformextra-&amp;gt;newEnquiry($attribs);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$enquiryModel = craft()-&amp;gt;contactFormExtra-&amp;gt;newEnquiry($attribs);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and make sure you update that across &lt;strong&gt;all&lt;/strong&gt; the places where you're calling that service. Try that, and post the results. I'll take another look if you're still seeing the issue, which may still be there; just grabbing at low-hanging fruit right now. :)&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-17T17:28:12.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11516" PostTypeId="1" AcceptedAnswerId="11525" CreationDate="2015-09-17T19:25:05.407" Score="1" ViewCount="203" Body="&lt;p&gt;I have a RichText field using a standard config. &quot;Clean up HTML&quot; and &quot;Purify HTML&quot; are OFF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page with a paragraph of text, then an unordered list. After that list, I try to insert another paragraph and add a line with a mailto link in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter what, the link gets removed/stripped out. If I move the paragraph up before the UL, it works. But being after the UL list, it's getting stripped out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially the text in the editor looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;text&amp;lt;/p&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;title&amp;lt;/strong&amp;gt; line of text&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;title&amp;lt;/strong&amp;gt; line of text&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;p&amp;gt;&amp;lt;a href=&quot;mailto:myaddress@email.com&quot;&amp;gt;Send us a message&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did try checking both purify and clean HTML options ON, but that didn't work either. I've tried inserting the text via html view as well as visual view. Still can't get it to stick. I've tried adding multiple paragraphs after the UL list, but HTML is getting stripped out of everything after the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My standard config json is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;plugins: ['fullscreen'],&#xA;toolbarFixedBox: true }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft Client 2.4.2692&lt;/p&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2015-09-18T16:51:33.640" Title="Richtext field removing inserted links" Tags="&lt;richtext&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11517" PostTypeId="2" ParentId="11490" CreationDate="2015-09-17T19:34:14.250" Score="1" Body="&lt;p&gt;Seems like a pretty straight forward integration with a Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;, then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They've already got a PHP client up on &lt;a href=&quot;https://packagist.org/packages/algolia/algoliasearch-client-php&quot; rel=&quot;nofollow&quot;&gt;packagist&lt;/a&gt; and what looks to be pretty &lt;a href=&quot;https://www.algolia.com/doc/php#setup&quot; rel=&quot;nofollow&quot;&gt;extensive documentation&lt;/a&gt; how to use it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-17T19:34:14.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11518" PostTypeId="2" ParentId="11504" CreationDate="2015-09-17T20:53:24.267" Score="1" Body="&lt;p&gt;I ended up doing this the old-fashioned way... &lt;strong&gt;hire cheap labor to do a tedious repetitious task!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every other suggestion I got (here and in Slack) involved command line scripting and/or careful database manipulation. I wasn't really comfortable with either of those, especially since I had already started the drag &amp;amp; drop process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the end, I just hired one of my buddies (for dirt cheap) to manually drag &amp;amp; drop each folder to the new source. Problem solved! :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-17T20:53:24.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11519" PostTypeId="2" ParentId="11059" CreationDate="2015-09-17T21:34:43.680" Score="1" Body="&lt;p&gt;Turns out this was caused by me setting a &quot;Cache-Control: max-age&quot; header which I was testing with Google Page Speed and I forgot to move it. This meant the browser was caching everything including the session cookie. &lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-09-17T21:34:43.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11520" PostTypeId="1" CreationDate="2015-09-18T06:13:53.183" Score="4" ViewCount="663" Body="&lt;p&gt;I am using Sprout Forms for my contact forms and I want to integrate the MailChimp subscribe plugin but it looks like the MC Subscribe plugin needs to have &lt;code&gt;name=&quot;mcvars[FIRSTNAME]&quot;&lt;/code&gt; on the input fields and Sprout Forms needs &lt;code&gt;name=&quot;fields[LASTNAME]&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, they have different hidden fields for the action:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MailChimp Subscribe&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;mailchimpSubscribe/list/Subscribe&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sprout Forms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone managed to integrate the two so people can choose to subscribe to a list while also using the power of Sprout Forms?&lt;/p&gt;&#xA;" OwnerUserId="2196" LastActivityDate="2015-09-18T07:26:47.470" Title="MailChimp &amp; Sprout Forms" Tags="&lt;plugins&gt;&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11521" PostTypeId="2" ParentId="11520" CreationDate="2015-09-18T07:26:47.470" Score="1" Body="&lt;p&gt;Currently, this may be a bit challenging to pull of with Sprout Forms v1.1.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do have several features and improvements in the works that will help you achieve this in the future though, including:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Full control over customizing the template HTML&lt;/li&gt;&#xA;&lt;li&gt;The ability to customize the value of the name=&quot;&quot; inputs&lt;/li&gt;&#xA;&lt;li&gt;The option to submit form data to third-party URLs&lt;/li&gt;&#xA;&lt;li&gt;Control over hidden fields&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;While I don't have a release date for you — the features above are currently under development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll plan to revisit and update this post once we release those features.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-09-18T07:26:47.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11522" PostTypeId="1" AcceptedAnswerId="11526" CreationDate="2015-09-18T12:59:06.813" Score="4" ViewCount="105" Body="&lt;p&gt;I want to archive users from a plugin, but can't seem to find the appropriate method to do so (not even in the control panel). I can suspend, delete, but not archive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-09-18T17:53:44.387" Title="How do I archive a user from a plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11523" PostTypeId="1" CreationDate="2015-09-18T14:07:25.770" Score="1" ViewCount="61" Body="&lt;p&gt;Has anyone used this plugin recently: &lt;a href=&quot;https://github.com/ObiruLabs/craft-flickr-photopicker&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ObiruLabs/craft-flickr-photopicker&lt;/a&gt; ?&#xA;I have just tried to start using it but it does not display any photos - it seems to be looking for photo sets but I don't see an option within Flickr for photosets.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-09-18T14:07:25.770" Title="Plugin - Flickr Photo Picker" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11524" PostTypeId="2" ParentId="11484" CreationDate="2015-09-18T14:45:19.567" Score="1" Body="&lt;p&gt;Ok so here's what did it:&#xA;In my plugin, I had to manually call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        craft()-&amp;gt;templateCache-&amp;gt;includeElementInTemplateCaches($entry-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that, I didn't need had any of my event listeners in place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interesting that things seem to be inserted into craft_templatecachecriteria automatically, but not into craft_templatecacheelements...Perhaps that is bug?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-09-18T14:45:19.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11525" PostTypeId="2" ParentId="11516" CreationDate="2015-09-18T16:51:33.640" Score="4" Body="&lt;p&gt;The answer here is to disable the mod_security2 rule on the admin folder as I was tripping the SQL Injection prevention rule (#300015) upon saving the Entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a server setup that uses cPanel and Apache 2.2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/usr/local/apache/conf/modsec2/whitelist.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add the following rule:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;LocationMatch &quot;/admin/&quot;&amp;gt;&#xA;  SecRuleRemoveById 300015&#xA;&amp;lt;/LocationMatch&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2015-09-18T16:51:33.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11526" PostTypeId="2" ParentId="11522" CreationDate="2015-09-18T17:53:44.387" Score="2" Body="&lt;p&gt;I assume you're referring to the &lt;code&gt;archived&lt;/code&gt; column in the &lt;code&gt;craft_users&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Originally we were going to use that as a way to &quot;soft delete&quot; different elements in Craft (Users, Entries, etc.), but never got around to implementing it for various reasons, so there is no UI for it and no backing code to support it currently.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-18T17:53:44.387" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11528" PostTypeId="1" AcceptedAnswerId="11559" CreationDate="2015-09-19T09:46:44.677" Score="0" ViewCount="97" Body="&lt;p&gt;I have two languages (German and French).&lt;br&gt;&#xA;In my sections I have German enabled as default language. French is off by default. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Problem is: &#xA;I always want to show content, even if the other language is disabled and, when an entry is not translated yet, show a note like &quot;Entry not translated yet.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about localeEnabled and status and I can query the following way: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('referenzen').localeEnabled(false).status(null).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That outputs all of the entries.&lt;br&gt;&#xA;But I am running into problems with the &quot;_entry&quot; template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I don't really know how to differentiate between entries that have their status turned off vs. entries that only have a language turned off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have a solution to this problem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;br&gt;&#xA;Stefan&lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2015-09-22T11:11:04.413" Title="How do I proceed when I want to show another language when the actual language is deactivated?" Tags="&lt;language&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11529" PostTypeId="1" CreationDate="2015-09-19T12:12:06.363" Score="1" ViewCount="120" Body="&lt;p&gt;I made a member area with multiple pages in a &lt;code&gt;member-area&lt;/code&gt; template folder.&lt;br&gt;&#xA;I d like to protecte all pages in this folder.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the &lt;code&gt;isLoggedIn&lt;/code&gt; function to protect a page in a twig template.&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.session&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/craft.session&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.isLoggedIn %}&#xA;    &amp;lt;a href=&quot;{{ logoutUrl }}&quot;&amp;gt;Logout&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what would be the best way to protect multiple pages ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put the control on &lt;code&gt;_layouts/base&lt;/code&gt; or &lt;code&gt;_layouts/site&lt;/code&gt; templates?&lt;br&gt;&#xA;Note: And above that problem I got an ajax login form (I can make a dedicated login page if it is more simple and no choice)&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-09-19T13:32:42.730" LastActivityDate="2015-09-19T19:58:33.090" Title="Protect mutliple pages in a template folder" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11530" PostTypeId="1" AcceptedAnswerId="11538" CreationDate="2015-09-19T19:33:53.263" Score="5" ViewCount="1591" Body="&lt;p&gt;I have a structure section with 3 levels.&lt;br&gt;&#xA;I d like to list all entries below 1st level.&lt;br&gt;&#xA;I see &lt;code&gt;ancestorDist&lt;/code&gt; or &lt;code&gt;descendantDist&lt;/code&gt; but I m not sure it is what I need...&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see I can select multiple levels:&lt;br&gt;&#xA;&lt;code&gt;{% set entries = craft.entries.section('library').limit(10).level(2,3) %}&lt;/code&gt;&lt;br&gt;&#xA;but I d like something like:&lt;br&gt;&#xA;&lt;code&gt;{% set entries = craft.entries.section('library').limit(10).level(&amp;gt;1) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:42.990" LastActivityDate="2017-10-24T15:25:42.990" Title="List all entries below top level 1 in a structure section (level 2 or 3 or 4 ...)" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11531" PostTypeId="2" ParentId="11529" CreationDate="2015-09-19T19:58:33.090" Score="1" Body="&lt;p&gt;You pretty much nailed it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have multiple pages that require an authenticated session, then have all of those pages extend a template that uses something like &lt;a href=&quot;http://buildwithcraft.com/docs/templating/requirelogin&quot; rel=&quot;nofollow&quot;&gt;{% requireLogin %}&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-19T19:58:33.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11532" PostTypeId="1" CreationDate="2015-09-19T22:28:10.890" Score="4" ViewCount="498" Body="&lt;p&gt;I got an entry template from a structured section.&lt;br&gt;&#xA;With prev / next nav links at entry bottom.&lt;br&gt;&#xA;But the next sibling is deactivated.&lt;br&gt;&#xA;So the page return is 404 not found !  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = entry.prevSibling %}  &#xA;{% set next = entry.nextSibling %}&#xA;&#xA;{% if prev %}&#xA;    &amp;lt;a class=&quot;nav-prev nav-left&quot; href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;lt;&amp;amp;nbsp;{{ prev.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;{% if next %}&#xA;    &amp;lt;a class=&quot;nav-next nav-right&quot; href=&quot;{{ next.url }}&quot;&amp;gt;{{ next.title }}&amp;amp;nbsp;&amp;gt;&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should it be &lt;code&gt;status=live&lt;/code&gt; by default no?  &lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-09-19T22:33:39.853" LastActivityDate="2018-09-14T12:04:05.260" Title="Entry next sibling return a deactivated entry" Tags="&lt;entry&gt;&lt;status&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11533" PostTypeId="1" CreationDate="2015-09-20T04:50:22.640" Score="2" ViewCount="319" Body="&lt;p&gt;I am working on a field type that is similar to the table field type. Is it possible to tap into Garnish for the sorting. I’ve tried a few things and have had no luck. Can anyone help me out?&lt;/p&gt;&#xA;" OwnerUserId="4103" LastActivityDate="2018-06-12T23:42:53.823" Title="How can I use Garnish to sort?" Tags="&lt;sorting&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11534" PostTypeId="2" ParentId="11533" CreationDate="2015-09-20T06:05:00.767" Score="5" Body="&lt;p&gt;Sure, I've had experience with two different types of sorting with &lt;a href=&quot;https://github.com/engram-design/SuperTable/blob/master/supertable/resources/js/SuperTableInput.js#L32&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt; (check the link for associated JS).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're modelling the fieldtype after a table, you might like to use the &lt;code&gt;Craft.DataTableSorter&lt;/code&gt; method. Its pretty restrictive to a table layout, and you'll need to give each &lt;code&gt;tr&lt;/code&gt; element a &lt;code&gt;data-id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.FieldType = Garnish.Base.extend({&#xA;    sorter: null,&#xA;&#xA;    init: function() {&#xA;        var $table = $container.children('.table');&#xA;&#xA;        this.sorter = new Craft.DataTableSorter($table, {&#xA;            helperClass: 'editabletablesorthelper',&#xA;            copyDraggeeInputValuesToHelper: true&#xA;        });&#xA;    },&#xA;&#xA;    addRow: function() {&#xA;        var $tr = $('&amp;lt;tr/&amp;gt;');&#xA;        this.sorter.addItems($tr);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, for more abstract sorting, you can have more control using &lt;code&gt;Garnish.DragSort&lt;/code&gt; - essentially a general drag and sort function. This is what Matrix uses.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.FieldType = Garnish.Base.extend({&#xA;    sorter: null,&#xA;&#xA;    init: function() {&#xA;        var $rows = $container.children('.table-rows');&#xA;&#xA;        this.sorter = new Garnish.DragSort($rows, {&#xA;            handle: 'tfoot .move',&#xA;            axis: 'y',&#xA;            collapseDraggees: true,&#xA;            magnetStrength: 4,&#xA;            helperLagBase: 1.5,&#xA;            helperOpacity: 0.9,&#xA;        });&#xA;    },&#xA;&#xA;    addRow: function() {&#xA;        var $tr = $('&amp;lt;tr/&amp;gt;');&#xA;        this.sorter.addItems($tr);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="8424" LastEditDate="2018-06-12T23:42:53.823" LastActivityDate="2018-06-12T23:42:53.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11535" PostTypeId="1" CreationDate="2015-09-20T14:57:36.807" Score="1" ViewCount="151" Body="&lt;p&gt;Has anybody got a controller (or whatever plugin aparatus is needed) to process Paypal IPN?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Years later, I have accomplished this, and have some information which could be helpful if someone else wants PayPal IPN to function within a controller. There is a trick regarding CSRF, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;#1 CSRF&lt;/strong&gt;&#xA;PayPal is not going to send a Craft CSRF token, so unless you want to disable CSRF (not recommended), then your &lt;code&gt;config/general.php&lt;/code&gt; needs a line similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'enableCsrfProtection' =&amp;gt; (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] != '/actions/livestream/main/paypalipn'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the plugin is called &lt;code&gt;livestream&lt;/code&gt;, the controller is &lt;code&gt;Main&lt;/code&gt;, and the controller function is &lt;code&gt;actionPaypalipn&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;#2 Not logged in&lt;/strong&gt; PayPal will also not be logged in to Craft, so the controller requires this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or I suppose this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = ['paypalipn'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, the quotes 'paypalipn' are because the controller function is &lt;code&gt;actionPaypalipn&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Full Code&lt;/strong&gt; (cleaned up a bit)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So those are the main bits. For those who want to look at someone else's code, it's here. Over at PayPal, the IPN Notification URL is set to &lt;code&gt;https://mywebsite.org/actions/livestream/main/paypalipn&lt;/code&gt;. The plugin happens to be called Livestream.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MainController extends Controller&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionPaypalipn() {&#xA;        $request = Craft::$app-&amp;gt;request-&amp;gt;getBodyParams();&#xA;&#xA;        // Go handshake with PayPalIPN to verify the transaction. &#xA;        $success = Livestream::$plugin-&amp;gt;paypal-&amp;gt;verifyIPN($request);&#xA;        if ($success) {&#xA;            //It worked! Now do our business-side processing(emails,etc).&#xA;            Livestream::$plugin-&amp;gt;otherservice-&amp;gt;processSuccessfulPayment($request);&#xA;            return &quot;IPN Verified&quot;;&#xA;        } else {&#xA;            return &quot;IPN Failed&quot;;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Paypal extends Component&#xA;{&#xA;&#xA;    /***********************************************************&#xA;    *                                                          *&#xA;    * Helper functions for the PayPal IPN verification process *&#xA;    *                                                          *&#xA;    ***********************************************************/&#xA;&#xA;    /** @var bool Indicates if the sandbox endpoint is used. */&#xA;    private $use_sandbox = false;&#xA;    /** @var bool Indicates if the local certificates are used. */&#xA;    private $use_local_certs = true;&#xA;&#xA;    /** Production Postback URL */&#xA;    const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr';&#xA;    /** Sandbox Postback URL */&#xA;    const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';&#xA;&#xA;    /** Response from PayPal indicating validation was successful */&#xA;    const VALID = 'VERIFIED';&#xA;    /** Response from PayPal indicating validation failed */&#xA;    const INVALID = 'INVALID';&#xA;&#xA;    /**&#xA;     * Sets the IPN verification to sandbox mode (for use when testing,&#xA;     * should not be enabled in production).&#xA;     * @return void&#xA;     */&#xA;    public function useSandbox()&#xA;    {&#xA;        $this-&amp;gt;use_sandbox = false;&#xA;    }&#xA;&#xA;    /**&#xA;     * Sets curl to use php curl's built in certs (may be required in some&#xA;     * environments).&#xA;     * @return void&#xA;     */&#xA;    public function usePHPCerts()&#xA;    {&#xA;        $this-&amp;gt;use_local_certs = false;&#xA;    }&#xA;&#xA;    /**&#xA;     * Determine endpoint to post the verification data to.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getPaypalUri()&#xA;    {&#xA;        if ($this-&amp;gt;use_sandbox) {&#xA;            return self::SANDBOX_VERIFY_URI;&#xA;        } else {&#xA;            return self::VERIFY_URI;&#xA;        }&#xA;    }&#xA;&#xA;    /***********************************************************&#xA;    * Main function for the PayPal IPN verification process    *&#xA;    * Sends the incoming post data back to PayPal using the    *&#xA;    * cURL library.                                            *&#xA;    *                                                          *&#xA;    * @return bool                                             *&#xA;    ***********************************************************/&#xA;&#xA;    public function verifyIPN($raw_post_array) {&#xA;&#xA;&#xA;        /**************************************************&#xA;        * Verify the validity of the request with PayPal. *&#xA;        **************************************************/&#xA;&#xA;        // BUILD THE QUERY TO POST BACK TO PAYPAL&#xA;        $req = 'cmd=_notify-validate&amp;amp;' . http_build_query($raw_post_array, '', '&amp;amp;');&#xA;&#xA;        //Log it as we go.&#xA;        file_put_contents(SOME_PATH . &quot;log.txt&quot;, &quot;\n&quot;. date(DATE_RSS).&quot;\n$req\n&quot;, FILE_APPEND);&#xA;&#xA;        // Post the data back to PayPal, using curl. Throw exceptions if errors occur.&#xA;        $ch = curl_init($this-&amp;gt;getPaypalUri());&#xA;        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);&#xA;        curl_setopt($ch, CURLOPT_POST, 1);&#xA;        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);&#xA;        curl_setopt($ch, CURLOPT_POSTFIELDS, $req);&#xA;        curl_setopt($ch, CURLOPT_SSLVERSION, 6);&#xA;        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);&#xA;        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);&#xA;&#xA;        // This is often required if the server is missing a global cert bundle, or is using an outdated one.&#xA;        if ($this-&amp;gt;use_local_certs) {&#xA;            curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . &quot;/cert/cacert.pem&quot;);&#xA;        }&#xA;        curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);&#xA;        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);&#xA;        curl_setopt($ch, CURLOPT_HTTPHEADER, array(&#xA;            'User-Agent: PHP-IPN-Verification-Script',&#xA;            'Connection: Close',&#xA;        ));&#xA;        $res = curl_exec($ch);&#xA;        if ( ! ($res)) {&#xA;            $errno = curl_errno($ch);&#xA;            $errstr = curl_error($ch);&#xA;            curl_close($ch);&#xA;            error_log(&quot;cURL error: [$errno] $errstr&quot;, 3 , $errorLog );&#xA;        }&#xA;&#xA;        $info = curl_getinfo($ch);&#xA;        $http_code = $info['http_code'];&#xA;        if ($http_code != 200) {&#xA;            error_log(&quot;PayPal responded with http code $http_code&quot;, 3 , $errorLog );&#xA;        }&#xA;&#xA;        curl_close($ch);&#xA;&#xA;        /************************************&#xA;        * Report what we found from PayPal. *&#xA;        ************************************/&#xA;&#xA;        // Check if PayPal verified the IPN data, and if so, return true.&#xA;        if ($res == self::VALID) {&#xA;            return true;&#xA;        } else {&#xA;            return false;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2020-05-20T15:08:02.080" LastActivityDate="2020-05-20T15:08:02.080" Title="Paypal IPN controller logic?" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2016-11-05T23:50:19.180" ContentLicense="CC BY-SA 4.0" />
  <row Id="11536" PostTypeId="1" AcceptedAnswerId="11558" CreationDate="2015-09-20T20:31:55.777" Score="2" ViewCount="87" Body="&lt;p&gt;Is it possible to output tags for an entry page in the order they were added to related entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example on a News page I would like to output any/all tags added to the News article on the specific article page in the order the tags were added to that article, I currently output the tags using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for tag in craft.tags.relatedTo(entry) %}&#xA;            &amp;lt;li&amp;gt;{{ tag }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great as it only outputs the tags that have been added to that entry, but it shows the tags in the default title ascending order rather than reflecting the order on the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can switch the order by setting it to desc on the title &lt;code&gt;.order('title desc')&lt;/code&gt; and I've also read through the docs on &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.tags#order&quot; rel=&quot;nofollow&quot;&gt;ordering&lt;/a&gt; but I'm still not sure how to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="4083" LastActivityDate="2015-09-22T11:02:13.577" Title="Output tags in the order they were added to an entry" Tags="&lt;entry&gt;&lt;tags&gt;&lt;ordering&gt;&lt;order&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11537" PostTypeId="2" ParentId="11535" CreationDate="2015-09-21T05:12:11.003" Score="1" Body="&lt;p&gt;Here's a full list of all publicly known plugins...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-21T05:12:11.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11538" PostTypeId="2" ParentId="11530" CreationDate="2015-09-21T05:28:23.200" Score="9" Body="&lt;p&gt;Alright. you can just exclude the top level entries with &lt;code&gt;not&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('library').level('not 1') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-09-21T05:28:23.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11539" PostTypeId="1" AcceptedAnswerId="11551" CreationDate="2015-09-21T07:02:15.700" Score="1" ViewCount="162" Body="&lt;p&gt;I was wondering if anyone had any experience in installing Moodle to a server that already had a CraftCMS website installed onto it? I've followed the instructions on the &lt;a href=&quot;https://docs.moodle.org/29/en/Installation_Quickstart&quot; rel=&quot;nofollow&quot;&gt;Moodle Installation Guide&lt;/a&gt; (I put the Moodle files in the CraftCMS template folder) but when I get to the part where I go to &lt;a href=&quot;http://domain/moodle&quot; rel=&quot;nofollow&quot;&gt;http://domain/moodle&lt;/a&gt; to install it I get a 404 error. If I go to &lt;a href=&quot;http://domain/moodle/install.php&quot; rel=&quot;nofollow&quot;&gt;http://domain/moodle/install.php&lt;/a&gt; I get the install file but it doesn't work, I just get a string of text like the PHP isn't executing. I can't find any similar issue's on Moodle's forums so I think that this will have something to do with craft not allowing the PHP?&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="22" LastEditDate="2017-05-09T23:23:51.727" LastActivityDate="2017-05-09T23:23:51.727" Title="Installing Moodle to a Craft CMS server" Tags="&lt;routing&gt;&lt;server&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11540" PostTypeId="2" ParentId="11247" CreationDate="2015-09-21T07:04:14.480" Score="0" Body="&lt;p&gt;I've found that Moodle is going to be my best bet as it has all the features that I need. Although now I am having issue's installing it within craft. I posted that question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11539/installing-moodle-to-a-craftcms-server&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3737" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-09-21T07:04:14.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11541" PostTypeId="2" ParentId="11532" CreationDate="2015-09-21T08:36:07.933" Score="7" Body="&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNextSibling&quot; rel=&quot;noreferrer&quot;&gt;getNextSibling&lt;/a&gt; documentation says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;getNextSibling() will return the next sibling whether or not it’s enabled. If you want to get the closest enabled sibling, you can do this instead:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set next = craft.entries.positionedAfter(entry).order('lft asc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Similarly for &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling&quot; rel=&quot;noreferrer&quot;&gt;getPrevSibling&lt;/a&gt; to get the previous enabled sibling you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = craft.entries.positionedBefore(entry).order('lft desc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-09-21T08:36:07.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11542" PostTypeId="1" AcceptedAnswerId="11736" CreationDate="2015-09-21T10:22:14.367" Score="1" ViewCount="368" Body="&lt;p&gt;I'd like to sync the database of a live site to my local site for development, but don't want to download all the images and files. Is there an .htaccess that could look for the files locally, and on 404 look to the live site? What are the implications for image transforms etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seem to be some solutions available for WordPress and Drupal, but has anyone had any experience with this with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3438" LastActivityDate="2015-10-02T18:19:21.010" Title="How can I use images from my live Craft Site when developing locally" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11543" PostTypeId="2" ParentId="11542" CreationDate="2015-09-21T10:29:15.557" Score="3" Body="&lt;p&gt;You could set up your assets through Amazon S3 or another remote service then that wouldn't be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you will need to download all the assets locally if you have relative paths &lt;code&gt;/uploads/images/banners/banner1.jpg&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though maybe another option is to set the path to include the domain then you can probably get the files from the server (so in your markup you would see the image would be linking to &lt;code&gt;http://www.yousite.com/uploads/images/banners/banner1.jpg&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2015-09-21T10:29:15.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11545" PostTypeId="1" CreationDate="2015-09-21T16:42:13.363" Score="6" ViewCount="1027" Body="&lt;p&gt;I'm developing and running a Craft site locally through Laravel Homestead and am having issues with pages &lt;code&gt;404&lt;/code&gt;'ing in a multi-locale setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've followed this guide closely: &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt; and still running into problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to have a Spanish locale set up, with English as the default top level. So my &lt;code&gt;example.com/xyz-article&lt;/code&gt; will be the English version, and &lt;code&gt;example.com/es/xyz-article&lt;/code&gt; will be the Spanish version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how my folder structure is set up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public/&#xA;   .htaccess&#xA;   index.php&#xA;   es/&#xA;      index.php&#xA;      .htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;craft/config/general.php&lt;/code&gt; is set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;&#xA;    '.dev' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'userSessionDuration'           =&amp;gt; 'P101Y',&#xA;        'rememberedUserSessionDuration' =&amp;gt; 'P101Y',&#xA;        'rememberUsernameDuration'      =&amp;gt; 'P101Y',&#xA;        'invalidLoginWindowDuration'    =&amp;gt; 'P101Y',&#xA;        'cooldownDuration'              =&amp;gt; 'PT1S',&#xA;        'maxInvalidLogins'              =&amp;gt; 101,&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en_us' =&amp;gt; 'http://example.dev/',&#xA;            'es' =&amp;gt; 'http://example.dev/es/',&#xA;        )&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;index.php&lt;/code&gt; file under the &lt;code&gt;public/es&lt;/code&gt; directory looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the Spanish content&#xA;define('CRAFT_LOCALE', 'es');&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt; &amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, both of my &lt;code&gt;.htaccess&lt;/code&gt; files inside the &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;es&lt;/code&gt; directories are identical and look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Going to &lt;code&gt;example.dev&lt;/code&gt; brings up the English homepage just fine, and &lt;code&gt;example.dev/es&lt;/code&gt; brings up the Spanish homepage just fine. Everything looks good so far...but when I try to navigate into subdirectories, the &lt;code&gt;es/&lt;/code&gt; pages always 404's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I set up a Single called &quot;Testing&quot;, enabled it for both locales, and pointed it to a template inside my &lt;code&gt;craft/templates&lt;/code&gt; folder called &lt;code&gt;testing/index.html&lt;/code&gt;. &lt;code&gt;example.dev/testing&lt;/code&gt; brings up the English version, but &lt;code&gt;example.dev/es/testing&lt;/code&gt; gives me a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The odd thing is, is that the ugly version of the URL at &lt;code&gt;http://example.dev/index.php/es?p=testing&lt;/code&gt; brings up the Spanish version, and Live Preview also works and displays/updates when I'm working on the Spanish version of the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm at a bit of a loss as to where I'm going wrong here -- it seems like some paths are just screwy but I can't find where I may have entered something in incorrectly. Any help would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Here are the log errors I'm getting when I load the &lt;code&gt;es/testing&lt;/code&gt; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h1qPz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h1qPz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4110" LastEditorUserId="57" LastEditDate="2017-12-19T23:15:53.367" LastActivityDate="2018-04-17T09:53:44.810" Title="Multi-locale pages 404 on subdirectories" Tags="&lt;localization&gt;&lt;config&gt;&lt;404&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11546" PostTypeId="2" ParentId="11545" CreationDate="2015-09-21T17:19:38.270" Score="1" Body="&lt;p&gt;Turn devMode on, trigger the 404, and look at the craft.log -- it should give you the URL that's causing the 404 error, which should help in debugging it.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-21T17:19:38.270" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11547" PostTypeId="2" ParentId="11508" CreationDate="2015-09-21T17:51:05.483" Score="1" Body="&lt;p&gt;The code on the left is what you want to use... Here are the general steps to follow to put everything together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're creating an archive page, you have to explicitly tell Craft what to do. First step then is to set the URL to something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;href=&quot;/chamber-news/archive/{{ month }}/{{ year }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then set up a template (my example uses one named &quot;chamber-archive&quot;) which looks to the URL for the month &amp;amp; year to determine which entries to load. (&lt;a href=&quot;https://craftcms.stackexchange.com/a/2875/103&quot;&gt;altered code borrowed from this answer&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.segment(3) %}&#xA;{% set year = craft.request.segment(4) %}&#xA;&#xA;{% set firstDay = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDay = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;{% set archive  = craft.entries.section('sectionNameHere').postDate('and', '&amp;gt;= ' ~ firstDay, '&amp;lt;= ' ~ lastDay) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you need to set up routing to tell Craft to use this template for this URL pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OsoWY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OsoWY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-09-21T18:06:05.387" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="11548" PostTypeId="1" AcceptedAnswerId="11557" CreationDate="2015-09-21T18:41:51.233" Score="1" ViewCount="656" Body="&lt;p&gt;I'm trying to build a filter and for that I want my client to be able to select a few options, which I use as classes for in my filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I chose for a checkbox field and set it up in the backend. Now I'm trying to retrieve the data on the HTML side, but I can only retrieve ALL values, instead of only the selected ones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how my HTML/twig markup looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.offerMinimumPrice.options %} &#xA;  {% if option.selected %}&#xA;    {{ option }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this code none of the values gets displayed in the front end. When I remove the conditional statement, all values get displayed (instead of only the selected ones).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me what I'm doing wrong? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2019-10-25T19:44:17.423" Title="Can't get checkboxfield values to show" Tags="&lt;field&gt;&lt;conditional&gt;&lt;forloop&gt;&lt;checkboxes&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11549" PostTypeId="2" ParentId="11548" CreationDate="2015-09-21T19:06:15.043" Score="0" Body="&lt;p&gt;Try this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.offerMinimumPrice %} &#xA;    {{ option }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-21T19:06:15.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11550" PostTypeId="1" CreationDate="2015-09-21T22:44:12.333" Score="0" ViewCount="253" Body="&lt;p&gt;I just pushed a site live, and now when I log in to the control panel and get the message to upgrade my license, when I click &quot;upgrade your license&quot;, I get a blank modal and a message that &quot;An Unknown Error Occurred&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything has been running fine up to this point on the same server, using its ip address, rather than the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting the following errors in my log file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;015/09/21 22:30:32 [error] [exception.Craft\HttpException.403] exception 'Craft\HttpException' in .../craft/app/services/UserSessionService.php:442&#xA;Stack trace:&#xA;#0 .../craft/app/controllers/AppController.php(118): Craft\UserSessionService-&amp;gt;requireAdmin()&#xA;#1 .../craft/app/framework/web/actions/CInlineAction.php(49): Craft\AppController-&amp;gt;actionGetUpgradeModal()&#xA;#2 .../craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#3 .../craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#4 .../craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#5 .../craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('getUpgradeModal')&#xA;#6 .../craft/app/etc/web/WebApp.php(784): CWebApplication-&amp;gt;runController('app/getUpgradeM...')&#xA;#7 .../craft/app/etc/web/WebApp.php(276): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#8 .../craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#9 .../craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#10 .../index.php(19): require_once('/storage/av0308...')&#xA;#11 {main}&#xA;REQUEST_URI=/index.php/admin/actions/app/getUpgradeModal&#xA;HTTP_REFERER=http://gtcarts.com/admin/dashboard&#xA;---&#xA;2015/09/21 22:30:32 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in .../craft/app/etc/web/WebApp.php (584)&#xA;2015/09/21 22:30:32 [error] [application] in .../craft/app/etc/errors/ErrorHandler.php (95)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to troubleshoot this?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2015-09-21T22:44:12.333" Title="Unknown error when trying to upgrade license" Tags="&lt;error-message&gt;&lt;license&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11551" PostTypeId="2" ParentId="11539" CreationDate="2015-09-22T02:47:44.713" Score="0" Body="&lt;p&gt;What &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11539/installing-moodle-to-a-craftcms-server#comment15983_11539&quot;&gt;Damon&lt;/a&gt; said is correct.  You'll need to modify Craft's public &lt;code&gt;.htaccess&lt;/code&gt; file so that all requests to Moodle URIs go to it's public &lt;code&gt;index.php&lt;/code&gt; file and requests to Craft URIs go to Craft's public &lt;code&gt;index.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could keep them as two separate installations, which simplifies things.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-22T02:47:44.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11552" PostTypeId="1" CreationDate="2015-09-22T04:22:18.473" Score="0" ViewCount="414" Body="&lt;p&gt;I am troubleshooting a client website and I have installed new relic on VPS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summary:&#xA;RESP. TIME = 12,300ms&lt;br&gt;&#xA;USER CPU BURN = 7,000ms (56.9%)&lt;br&gt;&#xA;SYSTEM CPU BURN = 115ms (0.935%)&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;Slowest components  Count   Duration    %&#xA;YiiBase::autoload   116     2,570 ms    21%&#xA;Craft\ElementsService::buildElementsQuery   175 1,960 ms    16%&#xA;Craft\ElementsService::findElements 175 1,690 ms    14%&#xA;Craft\BaseElementModel::setContent  153 1,300 ms    11%&#xA;__TwigTemplate_8a189a6b8bb1cda953a4a38f8aa3c4ccaccd30c1b5a2b790673a05284bb0de6b::block_menu 1   519 ms  4%&#xA;Composer\Autoload\includeFile   19  432 ms  4%&#xA;Remainder   1   3,840 ms    31%&#xA;Total       12,300 ms   100%&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1YHDA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1YHDA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I have attached a trace.&lt;a href=&quot;https://i.stack.imgur.com/vQBZM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vQBZM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like a lot of time is spent on autoload. Any ideas what will cause this? Or what should I be looking at to fix this issue?&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-09-22T04:41:10.407" LastActivityDate="2015-10-22T04:49:09.510" Title="Troubleshooting Slow Craft Website - New Relic" Tags="&lt;performance&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11553" PostTypeId="1" AcceptedAnswerId="11556" CreationDate="2015-09-22T04:31:22.393" Score="2" ViewCount="166" Body="&lt;p&gt;I am attempting to use the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;ElementAPI&lt;/a&gt; to check if a user is logged in or not. I've used the ElementAPI before to check/get entries for a given section, but never for user-based entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &lt;code&gt;elementapi.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'user/current.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; [&#xA;                'foo' =&amp;gt; 'bar', // Not sure what to do here.&#xA;            ],&#xA;            'transformer' =&amp;gt; function (EntryModel $user) {&#xA;                // Not sure about this either...&#xA;                if ($user-&amp;gt;isCurrent) {&#xA;                    return [&#xA;                        'status' =&amp;gt; true&#xA;                    ];&#xA;                } else {&#xA;                    return [&#xA;                        'status' =&amp;gt; false&#xA;                    ];&#xA;                }&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting to the plugin, but It really is not happy with what I'm giving it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Argument 1 passed to Craft\ConfigService::Craft\{closure}() must be an instance of Craft\EntryModel, instance of Craft\UserModel given&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pretty sure it has something to do with the criteria?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-09-22T11:45:51.790" Title="How can I interact with Users via the ElementAPI?" Tags="&lt;users&gt;&lt;current-user&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11554" PostTypeId="2" ParentId="11552" CreationDate="2015-09-22T04:35:30.647" Score="1" Body="&lt;p&gt;I don't know where the first set of data you posted is coming from, but in the attached stack trace autoloading is only &lt;code&gt;.54%&lt;/code&gt; of the total request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever template(s) you're rendering account for &lt;code&gt;65%&lt;/code&gt; of the request (for a total of 8 seconds), so I'd start inspecting there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loading all of the plugins you have installed is about &lt;code&gt;10%&lt;/code&gt; (which accounts for about 1.3 seconds of the request), so I'd investigate those as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-22T04:35:30.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11555" PostTypeId="2" ParentId="11528" CreationDate="2015-09-22T04:42:23.400" Score="0" Body="&lt;p&gt;From your template you can check if the entry is enabled via &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#enabled&quot; rel=&quot;nofollow&quot;&gt;entry.enabled&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an entry's locale is set to disabled (either via being disabled by default in the section's settings or manually on an entry), then the overall entry's &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#status&quot; rel=&quot;nofollow&quot;&gt;status&lt;/a&gt; will be &lt;code&gt;disabled&lt;/code&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for whatever reason, you need to see all of the locales for an entry and their &lt;code&gt;enabledByDefault&lt;/code&gt; status, you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for key, value in entry.getLocales() %}&#xA;        &amp;lt;li&amp;gt;locale = {{ key }}, enabledByDefault = {{ value['enabledByDefault'] }}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-22T04:42:23.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11556" PostTypeId="2" ParentId="11553" CreationDate="2015-09-22T05:15:55.040" Score="4" Body="&lt;p&gt;Change&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;function (EntryModel $user)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;function (UserModel $user)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You were passing in a user to a function that’s expecting an EntryModel. That’s the reason for the error you are getting.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="9" LastEditDate="2015-09-22T11:45:51.790" LastActivityDate="2015-09-22T11:45:51.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11557" PostTypeId="2" ParentId="11548" CreationDate="2015-09-22T10:43:30.980" Score="2" Body="&lt;p&gt;The problem was that I used this code within an entry, so I had to use the tag of that entry (offer) instead of entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code that works now is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in offer.offerMinimumPrice.options %}&#xA;  {% if option.selected %}&#xA;    {{ option }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2015-09-22T10:43:30.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11558" PostTypeId="2" ParentId="11536" CreationDate="2015-09-22T11:02:13.577" Score="1" Body="&lt;p&gt;I managed to solve this by defining the tags as a ElementCriteriaModel. Instead of using the code above I used the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.tagsFieldHandle %}&#xA;&#xA;{% if tags | length %}&#xA;   {% for tag in tags %}&#xA;      &amp;lt;li&amp;gt;{{ tag }}&amp;lt;/li&amp;gt;&#xA;   {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explained further in the &lt;a href=&quot;http://buildwithcraft.com/docs/tags-fields#templating&quot; rel=&quot;nofollow&quot;&gt;Tag section in the docs&lt;/a&gt;. &lt;code&gt;{% set tags = entry.tagsFieldHandle %}&lt;/code&gt; is a shortcut for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags({&#xA;   relatedTo: { sourceElement: entry, field: &quot;tagsFieldHandle&quot; },&#xA;   order:     &quot;sortOrder&quot;,&#xA;   limit:     null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This meant I didn't need to define the entry relation as the model does that be default and it also sorted the tags as they were defined in the entry with the &quot;sortOrder&quot; (which is also default).&lt;/p&gt;&#xA;" OwnerUserId="4083" LastActivityDate="2015-09-22T11:02:13.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11559" PostTypeId="2" ParentId="11528" CreationDate="2015-09-22T11:11:04.413" Score="1" Body="&lt;p&gt;So thanks to Brad I found this solution: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all entries regardless if the locale is enabled or not #}&#xA;{% set allEntries = craft.entries.section('yourSection').status(null).localeEnabled(false).find() %}&#xA;&#xA;{# Set the other locale (could be done differently, but since I have only two, I chose the easy way) #}&#xA;{% if craft.locale == 'de' %}{% set otherLocale = 'fr' %}{% else %}{% set otherLocale = 'de' %}{% endif %}&#xA;&#xA;{# Get all entries that are not disabled regardless if the locale is enabled or not #}&#xA;{% for entry in allEntries if entry.enabled == 1 %}&#xA;&#xA;    {# if the locale is turned off, search for the entry in the other language #}&#xA;    {% if entry.status == 'disabled' and entry.localeEnabled == 0 %}&#xA;&#xA;        {# Get the same entry in the other locale #}&#xA;        {% set otherEntry = craft.entries.id(entry.id).locale(otherLocale).first() %}&#xA;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ otherEntry.url }}&quot;&amp;gt;{{ otherEntry.title }} ({{ otherLocale|upper }})&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% else %}&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{# else (for the loop) all the entries are disabled #}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No results&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works great for my case. &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2015-09-22T11:11:04.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11560" PostTypeId="2" ParentId="11309" CreationDate="2015-09-22T11:12:51.243" Score="0" Body="&lt;p&gt;Thanks for your help with this. I reached a solution and as you suggested the fault was not with Craft. The VPS provider had blocked our whole domain by name after a few failed SSH login attempts. The SSH access was opened up again but our domain name was still blocked. After more work with the VPS support the VPS host added our domain to the remote recipients list and then emails from all craft plugins were being received. &#xA;Thanks all for your help and suggestions.&lt;/p&gt;&#xA;" OwnerUserId="4043" LastActivityDate="2015-09-22T11:12:51.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11561" PostTypeId="1" CreationDate="2015-09-22T13:34:30.163" Score="1" ViewCount="942" Body="&lt;p&gt;I'm requesting entries through a search field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;  section:      'tours',&#xA;  startloc:     craft.request.getParam('zoekplaats')&#xA;} %}&#xA;&#xA;&#xA;{% for entry in craft.entries(params) %}&#xA;...etc..&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which works fine. However, as soon as the 'startloc' field type becomes an 'entry' (thus a relation) I can't simply state 'startloc:' anymore, as it has become an entire object. However, I'm quite limited to the syntax I can use within that params field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried many things but can't really figure it out. Anyone that knows what the correct way to do it would be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!!&lt;/p&gt;&#xA;" OwnerUserId="4113" LastActivityDate="2015-10-22T20:17:16.357" Title="using craft.request.getParam to filter by relations" Tags="&lt;relations&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11562" PostTypeId="1" AcceptedAnswerId="11565" CreationDate="2015-09-22T14:01:04.067" Score="2" ViewCount="72" Body="&lt;p&gt;I know of the &lt;a href=&quot;https://straightupcraft.com/professionals&quot; rel=&quot;nofollow&quot;&gt;Craft Professionals&lt;/a&gt; page on Straight Up Craft, but I'm curious if there is a more targeted way to find Craft pros who are willing and able to take on maintenance of pre-existing Craft sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Q/A site seems obviously wrong for that. Are there other places to post requests or find a list of potential partners?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this question is considered on-topic. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2285" LastEditorUserId="22" LastEditDate="2017-05-09T23:22:03.460" LastActivityDate="2017-05-09T23:22:03.460" Title="How to find pros to take on maintenance/improvement of pre-existing sites built with Craft?" Tags="&lt;resources&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11563" PostTypeId="1" CreationDate="2015-09-22T14:02:10.297" Score="1" ViewCount="102" Body="&lt;p&gt;I’m using Craft as a backend for an iOS app and theres thousands of asset requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having to go through php instead of straight through Apache is causing too much of a bottleneck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use Craft's transforms, but I want the resulting URL to be statically accessible (directly through apache), and not have to go through Craft at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2015-09-22T19:19:24.813" Title="How can I server Craft transform assets statically (not through Craft/PHP)" Tags="&lt;server&gt;&lt;performance&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11564" PostTypeId="2" ParentId="11563" CreationDate="2015-09-22T14:30:44.743" Score="1" Body="&lt;p&gt;This happens automatically if you use &lt;code&gt;asset.getUrl(transform)&lt;/code&gt;...&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="57" LastEditDate="2015-09-22T19:19:24.813" LastActivityDate="2015-09-22T19:19:24.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11565" PostTypeId="2" ParentId="11562" CreationDate="2015-09-22T14:33:41.690" Score="1" Body="&lt;p&gt;As of this posting, there isn't another &lt;em&gt;reliable&lt;/em&gt; source for Craft professionals. The CMS is so new compared to other systems that a 'base' of well-known, reliable companies/developers hasn't had the chance to form yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could google and find a few, but they're spread out among developers that most likely wouldn't give you good results. I'd stick with the Straight Up Craft list, since you're at least sure they've seen/read about best practices on the Straight Up Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also post jobs to places like &lt;a href=&quot;https://authenticjobs.com/&quot; rel=&quot;nofollow&quot;&gt;Authentic Jobs&lt;/a&gt;, and specifically ask for Craft experience, or Straight Up Craft's &lt;a href=&quot;https://straightupcraft.com/jobs&quot; rel=&quot;nofollow&quot;&gt;Job Board&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-22T14:33:41.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11566" PostTypeId="2" ParentId="11508" CreationDate="2015-09-22T14:45:59.980" Score="0" Body="&lt;p&gt;Why not use &lt;a href=&quot;https://buildwithcraft.com/docs/templating/entrymodel#getUrl&quot; rel=&quot;nofollow&quot;&gt;getUrl&lt;/a&gt; instead of getLink? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl() }}&quot;&amp;gt;{{ month }} ({{ entries | length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4114" LastActivityDate="2015-09-22T14:45:59.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11567" PostTypeId="1" AcceptedAnswerId="11591" CreationDate="2015-09-22T15:53:38.483" Score="4" ViewCount="139" Body="&lt;p&gt;I have the following - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set press = craft.entries.section('press').first() %}&#xA;&#xA;{{ press.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change the section title in the Sections area of the back end from something like &quot;Press&quot; to &quot;Testimonials&quot; - I still see Press when I call press.title. The section is set to a single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried clearing cache in the back end which doesn't seem to do the trick. Any advice?&lt;/p&gt;&#xA;" OwnerUserId="976" LastEditorUserId="976" LastEditDate="2015-09-24T18:42:35.187" LastActivityDate="2015-11-06T17:48:07.140" Title="Section Single Title Caching" Tags="&lt;cache&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11568" PostTypeId="1" AcceptedAnswerId="11575" CreationDate="2015-09-22T16:34:43.237" Score="1" ViewCount="322" Body="&lt;p&gt;is there any built-in way to encode malicious file name characters when getting an asset URL through &lt;code&gt;assetHandle.getUrl('transformationName')&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My system contains files with names such as &lt;code&gt;/assets/images/foo/_transformationName/105 Flippy Dolphin 31 (F60).jpg&lt;/code&gt; and escaping the whole string escapes also slashes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can assemble a valid URL from &lt;code&gt;asset.directory&lt;/code&gt; and &lt;code&gt;asset.filename&lt;/code&gt;, but that cuts off access to image transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do realize I could create a twig extension or explode the string using regular expressions, do my thing and join it back, but I have a feeling this might use some approach more aimed at fixing the cause, not the consequence. The &lt;code&gt;.getUrl()&lt;/code&gt; method might be able to return a web-safe value somehow maybe?&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-09-24T05:25:45.023" Title="URL Encode only file name" Tags="&lt;url&gt;&lt;image&gt;&lt;escape&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11569" PostTypeId="2" ParentId="11562" CreationDate="2015-09-22T17:32:32.943" Score="1" Body="&lt;p&gt;You could take a look at the community page on the &lt;a href=&quot;http://buildwithcraft.com/community&quot; rel=&quot;nofollow&quot;&gt;craft website&lt;/a&gt; and get in touch with people in the meet ups, if they are local.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or alternatively and more specifically, you could always join Craft on slack (get access from the community page) and from there you can easily engage with Craft enthusiasts and there is also a specific jobs channel you can post any jobs or work placements etc you might have to find partnerships and just generally meet new crafters :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-22T17:32:32.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11570" PostTypeId="1" AcceptedAnswerId="11572" CreationDate="2015-09-22T17:35:36.107" Score="2" ViewCount="856" Body="&lt;p&gt;All of our control panel URLs are being rewritten to show index.php?p=admin/***&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this isn't a problem in itself we can't determine why it's happening when the frontend of the website itself is writing the URLs cleanly and correctly without the index.php?p= &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have in our .htaccess file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;  RewriteEngine On&#xA;&#xA;  # Send would-be 404 requests to Craft&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;  RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are no other Rewrites happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possibly related issue we're seeing is that there are no entries, assets or categories listing in the control panel. Looking through the logs I can see the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/09/22 16:55:23 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'Param “elementType” doesn’t exist.' in /var/www/vhosts/mysite.org/httpdocs/craft/app/services/HttpRequestService.php:586&#xA;Stack trace:&#xA;#0 /var/www/vhosts/mysite.org/httpdocs/craft/app/controllers/BaseElementsController.php(50): Craft\HttpRequestService-&amp;gt;getRequiredParam('elementType')&#xA;#1 /var/www/vhosts/mysite.org/httpdocs/craft/app/controllers/ElementIndexController.php(68): Craft\BaseElementsController-&amp;gt;getElementType()&#xA;#2 /var/www/vhosts/mysite.org/httpdocs/craft/app/framework/web/CWebApplication.php(281): Craft\ElementIndexController-&amp;gt;init()&#xA;#3 /var/www/vhosts/mysite.org/httpdocs/craft/app/etc/web/WebApp.php(784): CWebApplication-&amp;gt;runController('elementIndex/ge...')&#xA;#4 /var/www/vhosts/mysite.org/httpdocs/craft/app/etc/web/WebApp.php(276): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#5 /var/www/vhosts/mysite.org/httpdocs/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#6 /var/www/vhosts/mysite.org/httpdocs/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#7 /var/www/vhosts/mysite.org/httpdocs/index.php(40): require_once('/var/www/vhosts...')&#xA;#8 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/elementIndex/getElements&#xA;HTTP_REFERER=http://mysite.org/index.php?p=admin/entries/pages&#xA;---&#xA;2015/09/22 16:55:23 [error] [application] Param “elementType” doesn’t exist.&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We do have PATH_INFO installed and enabled on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro 2.4.2692&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated.&#xA;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="3861" LastEditorUserId="3861" LastEditDate="2015-09-22T18:51:24.057" LastActivityDate="2015-09-23T12:33:13.157" Title="Control Panel URLs being rewritten to use index.php?p=admin/" Tags="&lt;control-panel&gt;&lt;url&gt;&lt;error&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11571" PostTypeId="2" ParentId="11561" CreationDate="2015-09-22T17:51:41.087" Score="1" Body="&lt;p&gt;Wow, ok so I spent all day on this, I seem to have gotten it to work, but to be honest, I'm not 100% sure why/how this works. Anyways, I altered the code in the answer given here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6937/searching-a-specific-section-by-four-different-types-of-parameters&quot;&gt;Searching a specific section by four different types of parameters?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And ended with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set zoekschip = craft.request.getParam('zoekschip') %}&#xA;&#xA; {% set params = {&#xA;section:        'tours',&#xA;limit:      null&#xA;} %}&#xA;                   {% set relatedParams = ['and'] %}&#xA;&#xA;&#xA;{# plaats #}&#xA;{% if craft.request.getParam('zoekplaats') %}&#xA;{% set plaats = craft.request.getParam('zoekplaats') %}&#xA;{% set params = params|merge({'startloc':plaats}) %}&#xA;{% endif %}&#xA;&#xA;&#xA;{# Schip #}&#xA;{% if craft.request.getParam('zoekschip') %}&#xA;{% set zoekschip = craft.entries.section('ships').shipName(craft.request.getParam('shipName')).first %}&#xA;{% set relatedParams = relatedParams|merge([{ targetElement:zoekschip }]) %}&#xA;{% endif %}&#xA;&#xA;                        {# add relatedParams to params #}&#xA;{% if relatedParams|length &amp;gt; 1 %}&#xA;{% set params = params|merge({'relatedTo':relatedParams}) %}&#xA;{% endif %}&#xA;&#xA;{# perform search #}&#xA;{% set searchParams = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries(params).search(searchParams|trim) %}&#xA;&#xA;&#xA;&#xA;&#xA;                            {% for entry in entries %}&#xA;..output..&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, this works, it's pretty awesome, and after examining I understand it, and have a better understanding of how the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  relatedTo: {targetElement:  } &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;works :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My next challenge, is to add another search param, regarding the dates.&#xA;The tours section currently has a matrix field which has one block, called 'vertrekdatum'. (departuredate) How I add the date to the param, and check whether any tour has that date in their blocks, and output if so..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks heaps in advanced!&lt;/p&gt;&#xA;" OwnerUserId="4113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-09-22T18:39:03.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11572" PostTypeId="2" ParentId="11570" CreationDate="2015-09-22T17:55:47.093" Score="0" Body="&lt;p&gt;Have you tried adding &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&lt;/code&gt; to your &lt;code&gt;general.php&lt;/code&gt; settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#omitScriptNameInUrls&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="525" LastActivityDate="2015-09-22T17:55:47.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11573" PostTypeId="1" CreationDate="2015-09-22T18:05:38.820" Score="0" ViewCount="99" Body="&lt;p&gt;I have a site where I need to paginate and filter a list of businesses by different criteria. In the business entry, I’m using the Reasons plugin tied to about 8 different lightswitches which, when activated, reveal different inputs that can be modified. For example, if it’s a restaurant, turning that lightswitch on reveals a toggle for if it’s local, and a channel of different types of restaurants to choose from. That business might also be a venue to host events, so activate Venue and you get a table input to add information about the rooms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To view and sort all restaurants, In my template, I was pulling all businesses, looping through and if it’s a restaurant, create the list item. Filtering and pagination were then being handled by list.js. This allowed me to have two dropdowns — one for neighborhood and one for restaurant type. Simply select “Thai” and &quot;Downtown&quot; and the list updated instantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all worked great when there were just a few items in the list. Now there are close to 500 businesses total and about 250 that are classified as restaurants. When I pull then entries, if there are north of 150 results that need to be listed, the page just becomes unresponsive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the way I was pulling the entries from pulling businesses and then filtering, to sending search criteria in the request, but that didn’t seem to help. The bottleneck seems to be in processing the list data and creating the list items to be paginated and searched. If I just list out the entry.title, it takes a bit but it works. If I  add the filtering data attributes, phone, address, etc to the list items, it chokes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there is a way to have live sorting on a page with a large dataset? I’d like to avoid page refreshes if possible. Perhaps pull json data, sort, and then just display the items that need to be rendered on the screen? I’m having trouble finding examples for alternate filtering methods for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="495" LastActivityDate="2015-09-22T18:05:38.820" Title="Performance problems filtering lists" Tags="&lt;filter&gt;&lt;performance&gt;&lt;sorting&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11574" PostTypeId="1" CreationDate="2015-09-22T18:23:09.840" Score="2" ViewCount="1067" Body="&lt;p&gt;I've updated everything to the latest version and the result of uploading an animated GIF is just the first frame of the animated GIF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on why animated GIFs aren't working? Is there a way to disable image transforms for animated GIFs or GIFs in general?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PHP 5.4.45-0+deb7u1&lt;/li&gt;&#xA;&lt;li&gt;ImageMagick 6.7.7-10&lt;/li&gt;&#xA;&lt;li&gt;Craft Pro 2.4.2692&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4116" LastActivityDate="2015-09-22T19:38:56.540" Title="Uploading animated GIF outputs only first frame" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11575" PostTypeId="2" ParentId="11568" CreationDate="2015-09-22T19:30:05.937" Score="0" Body="&lt;p&gt;If you're worried about malicious characters in an uploaded file name, Craft already &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/AssetsHelper.php#L86&quot; rel=&quot;nofollow&quot;&gt;sanitizes&lt;/a&gt; &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/IOHelper.php#L1499&quot; rel=&quot;nofollow&quot;&gt;them&lt;/a&gt; when uploading from the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't do this during Asset indexing because generally it's assumed that the files you're uploading are trusted files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like that might not be true in your case, though. I can think of two options.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Write a Craft plugin that loops through all files in your upload folders and calls the same AssetsHelper and IOHelper sanitizing methods that Craft does.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find some desktop application that does it before you upload the files. A quick Google search turned up &lt;a href=&quot;http://manytricks.com/namemangler/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; for OSX, and &lt;a href=&quot;http://www.bulkrenameutility.co.uk/Main_Intro.php&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; for Windows.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-09-24T05:25:45.023" LastActivityDate="2015-09-24T05:25:45.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11576" PostTypeId="2" ParentId="11561" CreationDate="2015-09-22T19:32:41.480" Score="0" Body="&lt;p&gt;This is what I've come up with so far, with no results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# datum #}&#xA;{% if craft.request.getParam('zoekdatum') %}&#xA; {% set zoekdatum = craft.request.getParam('zoekdatum') %}&#xA;{% set data = data.type('vertrekdatum')| date('dd/mm/yyyy') %}&#xA;                      {% set params = params|merge({'data':zoekdatum})     %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4113" LastActivityDate="2015-09-22T19:32:41.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11577" PostTypeId="2" ParentId="11574" CreationDate="2015-09-22T19:38:56.540" Score="2" Body="&lt;p&gt;Your &lt;a href=&quot;http://www.imagemagick.org/script/changelog.php&quot; rel=&quot;nofollow&quot;&gt;ImageMagick library&lt;/a&gt; version is 3.5 years old.  I'd start by updating that to something newer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You didn't list the PHP Imagick extension version, but I'd bet it's out of date as well.  &lt;a href=&quot;https://pecl.php.net/package/imagick&quot; rel=&quot;nofollow&quot;&gt;3.1.2&lt;/a&gt; is the latest stable release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Craft will automatically try and detect if Imagick is installed and available via PHP, but it won't hurt to explicitly set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#imageDriver&quot; rel=&quot;nofollow&quot;&gt;imageDriver&lt;/a&gt; config setting to &lt;code&gt;imagick&lt;/code&gt; to be sure.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to disable image transforms for animated GIFs or GIFs in general?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not currently, sorry.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-22T19:38:56.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11579" PostTypeId="1" AcceptedAnswerId="11583" CreationDate="2015-09-22T22:07:31.507" Score="3" ViewCount="1360" Body="&lt;p&gt;We’ve recently had some issues with a staging site being down and it turned out the reason for this was: In the words of Brad at Pixel and Tonic, the redirect is &lt;strong&gt;&quot;intercepting the update request for the plugin causing Craft to no longer think it's a POST request”.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;caused by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# make sure index.php is always removed from url (google analytics   tracks duplicate)&#xA;RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php(/[^\s\?]+)? [NC]&#xA;RewriteRule ^ %1 [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we also have in all our craft sites the normal CRAFT removal of index.php from the urls:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_FILENAME} !-l&#xA;RewriteRule ^ index.php%{REQUEST_URI} [L,NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, a lot of our sites are existing sites that we redesigned and developed, so the &lt;code&gt;.htaccess&lt;/code&gt; files contain a lot of redirects for analytics. We noticed that google analytics started tracking duplicate URLs (duplicate being some contained index.php). After some investigation, I found out that the URLs containing index.php were from redirects (although none of the redirect rules contained index.php).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in order to make sure no urls ever contain index.php, I added the above mentioned rule.&#xA;However, we learnt the hard way that that doesn’t work with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What recommendations do you have in order to never have index.php in URLs? I realize that the standard rewrite rule that the Craft CMS comes with is good enough to hide/remove the index.php from the url and you will normally only see the index.php in the url if you type it in manually - but for some reason, it does show up sometimes when people land on a redirect url which messes with the analytics data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way we got around it in the end was asking the folks that take care of the analytics to merge the URLs, which ended up being easy enough to do. I was just wondering if there was any other way?&lt;/p&gt;&#xA;" OwnerUserId="3533" LastEditorUserId="22" LastEditDate="2017-05-09T23:21:26.603" LastActivityDate="2018-11-15T23:25:53.567" Title="redirect index.php in urls on Craft site to NEVER show index.php" Tags="&lt;url&gt;&lt;craft-pro&gt;&lt;htaccess&gt;&lt;analytics&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11580" PostTypeId="2" ParentId="10669" CreationDate="2015-09-22T22:13:00.013" Score="2" Body="&lt;p&gt;This is a feature of &quot;redactor&quot; which is used with Craft to clean and format input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To change the settings, you need to change the config in Craft/config/redactor/. See &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/rich-text-fields&lt;/a&gt; and &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-allowedTags&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/clean/#setting-allowedTags&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not, however, working for me with iframes, which is a whole other issue.&lt;/p&gt;&#xA;" OwnerUserId="3681" LastActivityDate="2015-09-22T22:13:00.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11581" PostTypeId="1" AcceptedAnswerId="11604" CreationDate="2015-09-22T22:22:21.593" Score="2" ViewCount="2356" Body="&lt;p&gt;I've updated my &lt;code&gt;craft/config/redactor/UserContent.json&lt;/code&gt; settings with &lt;code&gt;allowedTags&lt;/code&gt; containing &lt;code&gt;iframe&lt;/code&gt; but &lt;code&gt;iframe&lt;/code&gt; tags are stripped on save. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other added allowedTags seem fine and iframe works on paste and initial editing, just not after saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running Craft Pro 2.4.2679&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there were issues with this for older versions of Redactor but they seem to be resolved. Any ideas about how to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my UserContent.json:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    toolbarFixed: true,&#xA;    buttons: ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'horizontalrule',&#xA;              'unorderedlist', 'orderedlist', 'alignment', 'indent', 'outdent',&#xA;              'link', 'image', 'video', 'table'],&#xA;    removeEmpty: ['p','strong','em','span','a'],&#xA;    cleanStyleOnEnter: true,&#xA;    plugins: ['video', 'table'],&#xA;    allowedTags: ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'blockquote', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'nav', 'ol', 'optgroup', 'option', 'p', 'picture', 'pre', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'],&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3681" LastEditorUserId="3681" LastEditDate="2015-09-23T22:41:40.797" LastActivityDate="2015-09-24T03:50:14.353" Title="Rich Text - Redactor doesn't allow iframe even when in allowedTags config setting" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11582" PostTypeId="1" AcceptedAnswerId="11602" CreationDate="2015-09-23T02:52:19.667" Score="1" ViewCount="1534" Body="&lt;p&gt;I have a custom field that will be saving data to its own table. So if my field is in a Matrix field, I need to save the Matrix Field ID and Matrix Block ID to my table so I know what the data belongs to. I’m having a hard time figuring out how to get that data in my fieldtype. I’m using the &lt;code&gt;onAfterElementSave&lt;/code&gt; method. I’ve been looking for attributes and types and whatnot on &lt;code&gt;$this&lt;/code&gt;, &lt;code&gt;$this-&amp;gt;element-&amp;gt;getType()&lt;/code&gt;, &lt;code&gt;$this-&amp;gt;element-&amp;gt;getType()-&amp;gt;getAttributes()&lt;/code&gt; and so far I’m just not having any luck finding this information. Can anyone point me in the right direction here?&lt;/p&gt;&#xA;" OwnerUserId="4103" LastEditorUserId="4103" LastEditDate="2015-09-23T21:00:52.967" LastActivityDate="2015-10-30T09:59:31.320" Title="Getting Matrix field ID and Block ID for my Custom Field" Tags="&lt;matrix&gt;&lt;custom-fieldtype&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11583" PostTypeId="2" ParentId="11579" CreationDate="2015-09-23T05:02:55.590" Score="4" Body="&lt;p&gt;This came up in the Craft Slack not so long ago. You'd want something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ------------------------------------------------------------&#xA;# Remove index.php&#xA;# ------------------------------------------------------------&#xA;&#xA;RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]&#xA;RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC] # Don't mess with admin requests&#xA;RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]&#xA;&#xA;# ---------------------------------------------------------------------   -&#xA;# Send would-be 404 requests to Craft (standard Craft rewrite method)&#xA;# ----------------------------------------------------------------------&#xA;&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) /index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2015-09-23T05:02:55.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11584" PostTypeId="2" ParentId="11570" CreationDate="2015-09-23T12:33:13.157" Score="1" Body="&lt;p&gt;With regard to the 2nd part of the original question, whereby no entry, asset, category or user lists were display, this turned out to be a post_max_size issue in the php.ini config. It had been incorrectly set to 64&lt;strong&gt;MB&lt;/strong&gt; rather than 64&lt;strong&gt;M&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3861" LastActivityDate="2015-09-23T12:33:13.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11586" PostTypeId="2" ParentId="11579" CreationDate="2015-09-23T13:33:38.993" Score="5" Body="&lt;p&gt;As another option that I usually do in addition to &lt;code&gt;.htaccess&lt;/code&gt;, is to also add this to the array in &lt;code&gt;craft/config/general.php&lt;/code&gt; file, and it'll stop Craft from ever adding the &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing it this way prevents Craft from ever adding in the &lt;code&gt;index.php&lt;/code&gt; to redirects, I believe.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-23T13:33:38.993" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11587" PostTypeId="1" AcceptedAnswerId="11593" CreationDate="2015-09-23T13:55:03.003" Score="2" ViewCount="290" Body="&lt;p&gt;I want to build an international directory of fishing port centres in Craft. Each port will have the same custom fields and be geocoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; just doesn't make clear the ramifications of choosing channels versus structures. I get the ordering of structures which makes me think structures is the right approach. But do we lose out in search/RSS/templating down the line or are all entries equal in terms of there later usage?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-09-23T15:15:54.083" Title="What are the consequences of choosing structures over channels?" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11588" PostTypeId="2" ParentId="1378" CreationDate="2015-09-23T14:00:18.947" Score="1" Body="&lt;p&gt;I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon HTML&lt;/a&gt; which can wrap HTML content in a safe manner using &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; rel=&quot;nofollow&quot;&gt;DOMDocument&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you could wrap all iframes in a container with the classname &lt;code&gt;inline-media&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.body | retconWrap('iframe', '.inline-media') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Wrap&quot; rel=&quot;nofollow&quot;&gt;Click here to read the wiki on the &lt;code&gt;wrap&lt;/code&gt; method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-23T14:00:18.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11589" PostTypeId="1" CreationDate="2015-09-23T14:46:11.813" Score="3" ViewCount="583" Body="&lt;p&gt;Is there any way to access an event, and trigger some function, when an element is added / removed with the Craft Element Selector logic available in Garnish?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a custom field type and to keep everything tidy I only want to show a set of options when an asset is selected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HWEN1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HWEN1.png&quot; alt=&quot;Example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-09-28T20:55:57.067" Title="Access add and remove events with the Craft Element Selector?" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11590" PostTypeId="1" CreationDate="2015-09-23T14:59:25.537" Score="0" ViewCount="156" Body="&lt;p&gt;How can you ensure that the base fieldtype validation (required etc) and error messages are still applied when validating $value via the validate($value) function??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Validate method in fieldtype class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validate($value)&#xA;{&#xA;    if(is_array($value) &amp;amp;&amp;amp; $value['type'] != '')&#xA;    {&#xA;        $linkModel = $this-&amp;gt;_valuetToModel($value);&#xA;        $validated = $linkModel-&amp;gt;validate();&#xA;        return $validated ? true : $linkModel-&amp;gt;getAllErrors();&#xA;    }&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Validate method of custom model that the fieldtype populates and returns to the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validate($attributes = null, $clearErrors = true)&#xA;{&#xA;    switch($this-&amp;gt;type)&#xA;    {&#xA;        case('email'):&#xA;            if( !filter_var($this-&amp;gt;value, FILTER_VALIDATE_EMAIL) )&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please enter a valid email address.'));&#xA;            }&#xA;            break;&#xA;&#xA;        case('tel'):&#xA;            $regexp = '/^[0-9+\(\)#\.\s\/ext-]+$/';&#xA;            if(!filter_var($this-&amp;gt;value, FILTER_VALIDATE_REGEXP, array('options' =&amp;gt; array('regexp' =&amp;gt; $regexp))))&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please enter a valid telephone.'));&#xA;            }&#xA;            break;&#xA;&#xA;        case('custom'):&#xA;            if(!filter_var($this-&amp;gt;value, FILTER_VALIDATE_URL))&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please enter a valid url.'));&#xA;            }&#xA;            break;&#xA;&#xA;        case('entry'):&#xA;            if($this-&amp;gt;value == '')&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please select an entry.'));&#xA;            }&#xA;            break;&#xA;&#xA;        case('asset'):&#xA;            if($this-&amp;gt;value == '')&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please select an asset.'));&#xA;            }&#xA;            break;&#xA;&#xA;        case('category'):&#xA;            if($this-&amp;gt;value == '')&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please select a category.'));&#xA;            }&#xA;            break;&#xA;        // default:&#xA;        //     Craft::dd(parent::validate($attributes, null));&#xA;        //     $this-&amp;gt;addError('value', Craft::t('Please select a sdfasdfsd.'));&#xA;        //     break;&#xA;    }&#xA;&#xA;    return !$this-&amp;gt;hasErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-10-23T21:41:46.050" Title="Base fieldtype validation working with model validation?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11591" PostTypeId="2" ParentId="11567" CreationDate="2015-09-23T15:03:05.950" Score="7" Body="&lt;p&gt;For anyone stuck on this -- when changing a Section's name you have to goto the entry under Entries and hit save. This will update the mysql row / title.&lt;/p&gt;&#xA;" OwnerUserId="976" LastEditorUserId="976" LastEditDate="2015-11-06T17:48:07.140" LastActivityDate="2015-11-06T17:48:07.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11592" PostTypeId="1" CreationDate="2015-09-23T15:05:36.543" Score="2" ViewCount="158" Body="&lt;p&gt;Is there a recommended way for storing countries and cities in craft?&#xA;I can see fields and categories as obvious options but its difficult to see the disadvantages/advantages of either at the beginning of a project.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-09-23T15:48:31.280" Title="Best practice way to store countries and cities" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11593" PostTypeId="2" ParentId="11587" CreationDate="2015-09-23T15:15:54.083" Score="2" Body="&lt;p&gt;All entries are equal. The only differences between Structures and Channels are that Structures are manually sortable and can be nested under other entries. Channels sort by Post Date by default. Unless you are doing a stream of entries (like blog posts or events), structures are a good way to go.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2015-09-23T15:15:54.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11594" PostTypeId="2" ParentId="11592" CreationDate="2015-09-23T15:48:31.280" Score="2" Body="&lt;p&gt;This will depend on what you're actually trying to do, but if you're building this as part of a plugin, I'd store them as relational tables in the database, and display them as dropdown fields. If you provide more specific information about what you're building, I'll see if I can lend a hand.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-09-23T15:48:31.280" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11595" PostTypeId="1" AcceptedAnswerId="12550" CreationDate="2015-09-23T15:52:08.460" Score="1" ViewCount="280" Body="&lt;p&gt;I have a contact form (public facing only) on my site that has a checkbox group. The user can pick their favorite color(s). Upon successful submission I am capturing that data within the CP via a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a checkbox field within the CP called &quot;colors&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I am outputting the values in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;name&quot;class=&quot;form-control&quot; value=&quot;{% if contact is defined %}{{ contact.name }}{% endif %}&quot; placeholder=&quot;Full Name&quot;/&amp;gt;&#xA;{{ contact is defined and contact ? errorList(contact.getErrors('name')) }}&#xA;&#xA;....&#xA;&#xA;{% for option in craft.fields.getFieldByHandle('colors').getFieldType.options %}&#xA;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[colors][]&quot; value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&#xA;    &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far so good. Name is required, so if a user submits the form without entering a name, but has chosen a few colors, I would like the colors to be checked when the page reloads. I am able to do that on the &lt;code&gt;name&lt;/code&gt; field easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next part of the question, how do I handle the array of options via my plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have in my controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ContactFormController&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;$contact-&amp;gt;profession = craft()-&amp;gt;request-&amp;gt;getPost('profession[]');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I log what the model is getting here is what I am seeing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[name] =&amp;gt; My Name&#xA;[colors] =&amp;gt;&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume that I will also need to set up a FK relationship in my record file so once the form is submitted I can have a 1:many relationship. I'll look at the docs on how to set that up - and post what I've done back for future reference.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-11-26T00:04:00.787" Title="How do I handle and/or repopulate checkbox group(s)?" Tags="&lt;plugin-development&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11596" PostTypeId="1" CreationDate="2015-09-23T16:56:05.207" Score="1" ViewCount="654" Body="&lt;p&gt;EDIT after resolving: offtopic since the issue was that the php extension for ImageMagick was not installed on the server - therefore not Craft-related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because .gif's were not being transformed properly (only the first frame) I figured ImageMagick was not doing the image transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I updated the general config file with the line to set the imageDriver to ImageMagick ('imageDriver' =&gt; 'imagick'). However, as from that point whenever I tried to upload an asset in the control panel, the black loading bar appeared, instantly full, and the loading icon in the top right kept spinning. The loading bar did not disappear, nor did the file get uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I removed this line from the general config, the uploading worked as normal again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested my server and ImageMagick is installed (v6.8.3-6). I am running PHP 5.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not running any plugins. The only other setting I have in the general config file is 'generateTransformsBeforePageLoad' =&gt; true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know what could cause this issue? I would like to use ImageMagick for all the transfers, but of course especially for the .gif's.&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="-1" LastEditDate="2015-09-28T10:05:35.907" LastActivityDate="2015-09-28T10:05:35.907" Title="Cannot upload assets when Imagick is set as image driver" Tags="&lt;imagick&gt;" AnswerCount="0" CommentCount="6" ClosedDate="2015-09-27T04:32:56.763" ContentLicense="CC BY-SA 3.0" />
  <row Id="11597" PostTypeId="2" ParentId="11590" CreationDate="2015-09-23T19:47:33.887" Score="1" Body="&lt;p&gt;Completely untested and this whole pattern feels hacky to me, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your field type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validate($value)&#xA;{&#xA;    if(is_array($value) &amp;amp;&amp;amp; $value['type'] != '')&#xA;    {&#xA;        // Validate the field type.&#xA;        $errors = parent::validate($value);&#xA;&#xA;        if (!is_array($errors))&#xA;        {&#xA;            $errors = array();&#xA;        }&#xA;&#xA;        $linkModel = $this-&amp;gt;_valuetToModel($value);&#xA;&#xA;        // Validate the model.&#xA;        $validated = $linkModel-&amp;gt;validate();&#xA;&#xA;        return $validated &amp;amp;&amp;amp; empty($errors) ? true : array_merge($linkModel-&amp;gt;getAllErrors(), $errors);&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From your model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validate($attributes = null, $clearErrors = true)&#xA;{&#xA;    switch($this-&amp;gt;type)&#xA;    {&#xA;        case('email'):&#xA;            if( !filter_var($this-&amp;gt;value, FILTER_VALIDATE_EMAIL) )&#xA;            {&#xA;                $this-&amp;gt;addError('value', Craft::t('Please enter a valid email address.'));&#xA;            }&#xA;            break;&#xA;&#xA;        ....&#xA;&#xA;    }&#xA;&#xA;    return !$this-&amp;gt;hasErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-09-23T21:13:52.183" LastActivityDate="2015-09-23T21:13:52.183" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11598" PostTypeId="1" AcceptedAnswerId="11600" CreationDate="2015-09-23T21:32:14.873" Score="3" ViewCount="619" Body="&lt;p&gt;I know I am able to send to multiple recipients for any given form submission.&#xA;I am curious if there is a way to send to different addresses given user input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a drop-down on my site that chooses the department. If I choose &quot;support&quot;, I would like to send the notification to &quot;support@mysite.com&quot;. But, if the users chooses &quot;other&quot;, I'd like to send the email to &quot;other@mysite.com&quot;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-03T08:17:56.407" Title="How can I send email notification to different addresses using Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11599" PostTypeId="1" AcceptedAnswerId="12010" CreationDate="2015-09-23T22:29:08.797" Score="2" ViewCount="636" Body="&lt;p&gt;I have a contact form where I can choose the current state (U.S states).&#xA;I have the field created in Sprout forms as &quot;state&quot; and is populated with all 50 states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use &quot;custom&quot; html and loop through the values of that field. I just can't figure out how to get to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can output the whole field/element using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutForms.displayField('contact.state') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that outputs a whole html element. I only want the options so I can loop over them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....&#xA;&amp;lt;select&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;    {% set states = form.getField('contact.state') %}&#xA;        {% for option in states %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;....&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-10-20T23:28:26.477" Title="How can I populate a drop-down on the front-end using Sprout Forms?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11600" PostTypeId="2" ParentId="11598" CreationDate="2015-09-23T22:30:14.087" Score="3" Body="&lt;p&gt;This can be done with Sprout Forms and the Sprout Fields &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/email-select-field&quot; rel=&quot;nofollow&quot;&gt;Email Select Field&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Email Select field allows you to create a dropdown list of email addresses, hides those email addresses on the front-end so they can't be seen or harvested for spam (the user will only see the Name of each department or discipline you wish to have associated with each email address), and makes the selected email address available after the user submits the form so that you can use that value to trigger an email address using Sprout Forms default notifications or Sprout Email Notifications.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Legacy Answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Sprout Forms v1.1.0 and the current public plugins available (none that I know of for this use case), you can do this with a Dropdown Field.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a dropdown field with the handle &lt;code&gt;departmentEmailDropdown&lt;/code&gt;. In the settings, you can create a list of People/Departments and the emails you'd like them to be sent to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Label    Value&#xA;Support  support@mysite.com&#xA;Other    other@mysite.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When a user submits your form, all the values in the form are available for you to reference in your notification settings using shorthand syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;strong&gt;Email Recipients&lt;/strong&gt; field of your Notifications tab, you can reference your dropdown field using the syntax &lt;code&gt;{departmentEmailDropdown}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downsides to this approach are that the email addresses in your dropdown will be visible to in your page template, so robots can swoop in and gobble them up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got this on our radar and in the next couple weeks should have an update for you that will allow you to handle this as well as obfuscate the email addresses on the front-end. I'll update this answer when we have that ready.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-12-03T08:17:56.407" LastActivityDate="2015-12-03T08:17:56.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11601" PostTypeId="2" ParentId="11599" CreationDate="2015-09-23T22:55:19.590" Score="1" Body="&lt;p&gt;We're working on a better way to handle this in future versions of Sprout Forms. (Currently Sprout Forms v1.1.0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, your options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write a custom plugin to make this easier for yourself&lt;/li&gt;&#xA;&lt;li&gt;Access the info your looking for in a fairly verbose way using the &lt;code&gt;craft.sproutForms.form&lt;/code&gt; tag&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's a rough example of how you can get access to the FieldModel of a dropdown field.  It involves retrieving the whole SproutForms_FormModel, looping through the tabs and testing for the field you wish to access:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdownField = null %}&#xA;{% set form = craft.sproutForms.form('contact') %}&#xA;&#xA;{% for tab in form.getFieldLayout().getTabs() %}&#xA;&#xA;    {% set fields = tab.getFields() %}&#xA;&#xA;    {% for field in fields %} &#xA;&#xA;        {% set required = field.required %}&#xA;        {% set tabId = field.tabId %}&#xA;&#xA;        {% set field = field.getField() %}&#xA;&#xA;        {% if field.handle == 'dropdownFieldHandle' %}&#xA;            {% setdropdownField = field %}&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% if dropdownField is defined %}&#xA;    &amp;lt;select name=&quot;fields[{{ dropdownField.handle }}]&quot;&amp;gt;&#xA;        {% for option in dropdownField.settings.options %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've made a note to update this post when we get something easier to use in place.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-09-23T22:55:19.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11602" PostTypeId="2" ParentId="11582" CreationDate="2015-09-23T23:10:34.700" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://buildwithcraft.com/classreference/fieldtypes/BaseFieldType&quot; rel=&quot;nofollow&quot;&gt;BaseFieldType&lt;/a&gt; class (which all FieldTypes extend) has a &lt;a href=&quot;https://buildwithcraft.com/classreference/fieldtypes/BaseFieldType#contentPostLocation-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;contentPostLocation&lt;/code&gt;&lt;/a&gt; property, which will give you the &quot;path&quot; to the field inside the entry model. The value is returned as a string, e.g. &lt;code&gt;fields.myCustomFieldTypeHandle&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your field is inside a Matrix block, the contentPostLocation path will include the Matrix field's handle – as well as the block ID – e.g. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fields.matrixFieldHandle.12.fields.myCustomFieldTypeHandle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this, by exploding the &lt;code&gt;contentPostLocation&lt;/code&gt; string and testing its length, you can figure out if the field is &quot;standalone&quot; or embedded in a Matrix block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$contentPath = explode('.', $this-&amp;gt;contentPostLocation);&#xA;if (count($contentPath) &amp;gt; 2) {&#xA;    // Not standalone (i.e. probably inside a Matrix block)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Matrix' field's handle will be the second segment in the path. You can use the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/FieldsService#getFieldByHandle-detail&quot; rel=&quot;nofollow&quot;&gt;FieldsService&lt;/a&gt; to pull the actual field, in order to get its ID. &lt;em&gt;It's probably also a good idea to confirm that it is indeed a Matrix field, which is easily done by checking its fieldtype's &lt;code&gt;classHandle&lt;/code&gt; property&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixFieldHandle = $path[1];&#xA;$matrixField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($matrixFieldHandle);&#xA;if ($matrixField &amp;amp;&amp;amp; $matrixField-&amp;gt;fieldType-&amp;gt;classHandle === 'Matrix')&#xA;{&#xA;    // Yup, it's a Matrix field!&#xA;    $matrixFieldId = $matrixField-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, the block ID would be the next segment in the &lt;code&gt;contentPostLocation&lt;/code&gt; path, i.e. &lt;code&gt;$matrixBlockId = (int) $contentPath[2];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting it all together, something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    $contentPath = explode('.', $this-&amp;gt;contentPostLocation);&#xA;    if (count($contentPath) &amp;gt; 2)&#xA;    {&#xA;        $matrixFieldHandle = $contentPath[1];&#xA;        $matrixField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($matrixFieldHandle);&#xA;        if ($matrixField &amp;amp;&amp;amp; $matrixField-&amp;gt;fieldType-&amp;gt;classHandle === 'Matrix')&#xA;        {&#xA;            $matrixFieldId = $matrixField-&amp;gt;id;&#xA;            $matrixBlockId = (int) $contentPath[2];&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-23T23:10:34.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11603" PostTypeId="2" ParentId="11582" CreationDate="2015-09-24T02:28:09.523" Score="2" Body="&lt;p&gt;mmikkel got me very close and pointed in the right direction. Here is what I ultimately did to get the info I needed. This seems like jumping through hoops but it does work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$contentType = $this-&amp;gt;element-&amp;gt;elementType;&#xA;$matrixBlockId = null;&#xA;$matrixFieldId = null;&#xA;&#xA;if ($contentType === 'MatrixBlock') {&#xA;    $contentPath = explode('.', $this-&amp;gt;contentPostLocation);&#xA;&#xA;    $matrixField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($contentPath[1]);&#xA;&#xA;    $matrixBlockId = $contentPath[2];&#xA;&#xA;    $matrixFieldHandle = $contentPath[4];&#xA;&#xA;    $matrixService = new MatrixService();&#xA;&#xA;    $matrixBlock = $matrixService-&amp;gt;getBlockById($matrixBlockId);&#xA;&#xA;    foreach ($matrixBlock-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $thisField) {&#xA;        $thisFieldId = $thisField-&amp;gt;getAttribute('fieldId');&#xA;&#xA;        $field = craft()-&amp;gt;fields-&amp;gt;getFieldById($thisFieldId);&#xA;&#xA;        if ($field-&amp;gt;getAttribute('handle') === $matrixFieldHandle) {&#xA;            $matrixFieldId = $thisFieldId;&#xA;&#xA;            break;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4103" LastActivityDate="2015-09-24T02:28:09.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11604" PostTypeId="2" ParentId="11581" CreationDate="2015-09-24T03:50:14.353" Score="2" Body="&lt;p&gt;If you can, update to the latest Craft build. There was a Redactor update in &lt;a href=&quot;http://buildwithcraft.com/updates#build2682&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4.2682&lt;/a&gt; back in July that updated Redactor and fixed issues with iFrames. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-09-24T03:50:14.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11605" PostTypeId="1" AcceptedAnswerId="11606" CreationDate="2015-09-24T06:35:12.297" Score="3" ViewCount="168" Body="&lt;p&gt;I started using Craft a while ago and it perfectly fits my needs. Now my website is growing pretty well, and i'm happy. But I also have an old photo gallery that I want to update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that it's possible to do it with Craft. My question is will it support my gallery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have over 50'000 pictures of size between 500Ko and 1.5Mo with one thumbnail for each picture, organised between albums that are structured in a hierarchical tree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Will Craft be able to handle it ?&lt;/strong&gt; I currently use &lt;a href=&quot;http://galleryproject.org/&quot; rel=&quot;nofollow&quot;&gt;gallery&lt;/a&gt;, but it's getting slow, and got a problem with it and now half my gallery is broken. So I really want to move it inside my craft website, to easily manage website with it using the centralized system user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a more generic way of asking the question, &lt;strong&gt;what's the maximum amount of assets Craft is able to handle ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="57" LastEditDate="2015-09-24T17:57:29.537" LastActivityDate="2015-09-24T17:57:29.537" Title="Craft as a gallery" Tags="&lt;assets&gt;&lt;gallery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11606" PostTypeId="2" ParentId="11605" CreationDate="2015-09-24T07:07:13.740" Score="2" Body="&lt;p&gt;There's no real higher limit on Craft itself on the amount of Assets, Entries, Tags, Categories (Elements) etc. that you can store. When reaching a higher limit of actual database entries it'll come down to your hardware and database setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking to your specific problem 50,000 entries (Assets) are nothing. I'm guessing you might want to organize these in either a Structure or Channel (your &quot;albums&quot;) and then relate Assets to these to get the same type of album gallery setup you currently are using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's been some discussions about &quot;How much Craft can handle&quot; and if you search a little deeper you can probably find those topics as well.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-09-24T07:07:13.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11607" PostTypeId="2" ParentId="11589" CreationDate="2015-09-24T08:38:41.560" Score="2" Body="&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &#xA;For Craft installs 2.4.2688 or later, see Sam Hibberd's answer!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;@AaronBerkowitz is correct – unfortunately there's no way, currently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/mmikkel/e24e379faad6fd3fbde5&quot; rel=&quot;nofollow&quot;&gt;Here's a workaround&lt;/a&gt;, which uses &lt;code&gt;setInterval&lt;/code&gt; to poll the elementselects in the DOM for changes. If any of the elementselects have changed, the container will trigger a custom &lt;code&gt;elementselectchange&lt;/code&gt; event, which you can listen for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.elementselect').on('elementselectchange', onElementSelectChange);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is hardly an elegant or best practice solution, but in this case it's the best I can think of. Instead of polling it might be better to bind a click listener to the elementselect's add/delete buttons, however as elementselects can exist in so many different contexts, writing a reliable event listener is really tricky. In any case, should P&amp;amp;T add a &quot;elementChange&quot; event or the like down the line, you'd likely be able to rip out the poller and keep your event handler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in the Gist can be copy pasted as-is to a JS file and added to the Craft CP like this (in your plugin's main class):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;request-&amp;gt;isAjaxRequest() &amp;amp;&amp;amp; craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;{&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJsResource('myplugin/js/elementSelectChange.js');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The test for AJAX requests is important, if you leave it out the script will execute every time an Assets modal opens etc, which will make your event handlers fire multiple times.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-09-28T20:55:57.067" LastActivityDate="2015-09-28T20:55:57.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11608" PostTypeId="1" AcceptedAnswerId="11613" CreationDate="2015-09-24T09:38:41.253" Score="1" ViewCount="325" Body="&lt;p&gt;I've got a product section on a website where individual product entries are categorised. On the section landing page all the products are listed organised by category. On the individual category pages only the product entries relevant to that category are shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I’m having is that for the category landing page I want to pull in the Section landing page content. However when I try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section(‘productsAndMarketsLandingPage’).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{entry}&lt;/code&gt; returns empty. Any thoughts why this isn’t being pulled into this particular page/template? I can access it just fine from within the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section, template and URL structure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Section landing page&#xA;url: /products-and-markets&#xA;template: /products-and-markets/index&#xA;section: productsAndMarketsLandingPage&#xA;&#xA;Category landing page&#xA;url: /products-and-markets/{slug}&#xA;template: /products-and-markets/_category&#xA;section: productsAndMarkets&#xA;&#xA;Product entry page&#xA;url: /products-and-markets/{slug}&#xA;template: /products-and-markets/_entry&#xA;section: productsAndMarkets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-09-24T10:55:20.100" Title="Issue accessing single entry from within category template" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;url&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11609" PostTypeId="1" AcceptedAnswerId="11635" CreationDate="2015-09-24T09:43:15.200" Score="2" ViewCount="1026" Body="&lt;p&gt;I'm looking for the correct way to import an image from a url and save it to an entry and in the correct subfolder (&lt;code&gt;uploads/images/{id}&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a resource pointing to &lt;code&gt;uploads/images&lt;/code&gt;&#xA;and the entry field will upload to &lt;code&gt;resource/{id}&lt;/code&gt; by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand the file also needs to be indexed in the database for it to be visible in the file browser so I can't just save it straight to the file system.&lt;/p&gt;&#xA;" OwnerUserId="4111" LastEditorUserId="57" LastEditDate="2015-09-25T22:29:38.403" LastActivityDate="2015-09-25T22:29:38.403" Title="Importing images from external url and saving to entry using plugin" Tags="&lt;plugin-development&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11610" PostTypeId="2" ParentId="11608" CreationDate="2015-09-24T10:07:46.820" Score="0" Body="&lt;p&gt;How about&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entry = craft.entries.sectionId(productsAndMarketsLandingPage.id).first() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-09-24T10:07:46.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11611" PostTypeId="1" CreationDate="2015-09-24T10:15:43.147" Score="4" ViewCount="1905" Body="&lt;p&gt;Within the config folder there is a general.php file with various vars which are site specific. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do i get at these from within a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="2185" LastActivityDate="2018-04-29T22:34:33.830" Title="How do i get variables from general.php" Tags="&lt;config&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11612" PostTypeId="2" ParentId="11611" CreationDate="2015-09-24T10:26:17.673" Score="6" Body="&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('JsPath');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2185" LastEditorUserId="344" LastEditDate="2015-09-24T14:00:31.033" LastActivityDate="2015-09-24T14:00:31.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11613" PostTypeId="2" ParentId="11608" CreationDate="2015-09-24T10:55:20.100" Score="1" Body="&lt;p&gt;Okay, solved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was an idiot and wasn't using the right tag to output the results of the query. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry and thanks!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-09-24T10:55:20.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11614" PostTypeId="1" AcceptedAnswerId="11617" CreationDate="2015-09-24T11:40:46.840" Score="3" ViewCount="2160" Body="&lt;p&gt;I want to display the current title of the parent structure inside the child template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent (Title: Bla)&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Child (Here I want to display &lt;code&gt;Bla&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Parent (Title: Blablu)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Child (Here I want to display &lt;code&gt;Blablu&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tried something like (in the child template):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentTitle = craft.entries.section('structure').level(1).title %}&#xA;&amp;lt;h1&amp;gt;{{ parentTitle }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't even result in an error&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-09-24T13:09:36.410" Title="Title of the current parent structure" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11616" PostTypeId="2" ParentId="11473" CreationDate="2015-09-24T12:14:17.167" Score="0" Body="&lt;p&gt;Would the &lt;code&gt;spaceless&lt;/code&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/spaceless.html&quot; rel=&quot;nofollow&quot;&gt;filter&lt;/a&gt; work wrapped in div?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-09-24T12:14:17.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11617" PostTypeId="2" ParentId="11614" CreationDate="2015-09-24T13:09:36.410" Score="7" Body="&lt;p&gt;If you are trying to get the top most parent entry of a child entry in a structure, you can use &lt;a href=&quot;https://buildwithcraft.com/docs/templating/craft.entries#ancestorOf&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;ancestorOf&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.ancestorOf(entry).level(1).first() %}&#xA;&amp;lt;h1&amp;gt;{{parent.title}}&amp;lt;/h1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-09-24T13:09:36.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11618" PostTypeId="2" ParentId="11473" CreationDate="2015-09-24T14:38:21.437" Score="4" Body="&lt;p&gt;Currently it’s not possible to pass regex modifiers to the &lt;code&gt;|replace&lt;/code&gt; filter. You’d have to just do this manually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set str = &quot;foo     \nbar    &quot; %}&#xA;{% set trimmed = &quot;&quot; %}&#xA;&#xA;{% for line in str|split(&quot;\n&quot;) %}&#xA;    {% set trimmed = trimmed ~ (trimmed ? &quot;\n&quot;) ~ line|replace('/\\s*$/', '') %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 2.5, the &lt;code&gt;|replace&lt;/code&gt; filter supports regex modifiers.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-12-05T15:15:49.863" LastActivityDate="2015-12-05T15:15:49.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11619" PostTypeId="1" AcceptedAnswerId="11634" CreationDate="2015-09-24T14:47:12.853" Score="1" ViewCount="93" Body="&lt;p&gt;I have an issue regarding two (that I’ve come across) routes just simply loading the index template when they shouldn’t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template structure looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- search&#xA; - index.twig&#xA;- index.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I visited &lt;code&gt;/search&lt;/code&gt; the root &lt;code&gt;/index.twig&lt;/code&gt; template (front page) loads up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I create &lt;code&gt;search.twig&lt;/code&gt; next to &lt;code&gt;/index.twig&lt;/code&gt; and again go to &lt;code&gt;/search&lt;/code&gt; I still get the home template rendered. Removing all &lt;code&gt;search&lt;/code&gt; templates and going to &lt;code&gt;/search&lt;/code&gt; again, still renders the &lt;code&gt;index.twig&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is nothing in &lt;code&gt;config/routes.php&lt;/code&gt; and there are also no routes present in &lt;code&gt;craft_routes&lt;/code&gt; within the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may have had these routes set up at some point in the past (the project is a bit old), so I created a new database and installed Craft again (kept all other template files, replaced &lt;code&gt;craft/app&lt;/code&gt; folder) and the problem went away. Switched database in config (kept new &lt;code&gt;craft/app&lt;/code&gt; folder) and now the problem is back again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything in the database somewhere that would cause old routes to persist or be funky when the templates and any &lt;code&gt;config/routes.php&lt;/code&gt; have been deleted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did try and look through the tables but couldn’t really spot anything that stood out, any help would be awesome!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-25T20:17:05.333" Title="Phantom routes load index template, no 404 and no errors" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11620" PostTypeId="1" AcceptedAnswerId="11622" CreationDate="2015-09-24T19:33:18.520" Score="2" ViewCount="897" Body="&lt;p&gt;Ok once again I'm having an issue with a plugin controller. It was working once upon a time but stopped sometime in the past year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have stripped the plugin down to bare, so there is no reason it shouldn't be working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File Structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/plugins/&#xA;--webmentionreceiver/&#xA;----controllers/&#xA;------WebMentionReceiver_EndpointController.php&#xA;----WebMentionReceiverPlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;craft/plugins/webmentionreceiver/controllers/WebMentionReceiver_EndpointController.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    namespace Craft;&#xA;&#xA;    class WebMentionReceiver_EndpointController extends BaseController  {&#xA;                protected $allowAnonymous = array(&quot;actionReceive&quot;);&#xA;&#xA;                public function actionReceive()  {&#xA;                        $this-&amp;gt;redirect('/');&#xA;                }&#xA;        }&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the plugin name is &lt;code&gt;WebMentionReceiver&lt;/code&gt;, the controller is &lt;code&gt;Endpoint&lt;/code&gt; and the action is &lt;code&gt;Receive&lt;/code&gt;. So &lt;code&gt;index.php?p=actions/webmentionreceiver/endpoint/receive&lt;/code&gt; should be the URL. But it 404s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? It is driving me mad!&lt;/p&gt;&#xA;" OwnerUserId="633" LastActivityDate="2015-09-24T21:08:25.470" Title="Controller Action 404" Tags="&lt;controller&gt;&lt;routing&gt;&lt;404&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11621" PostTypeId="2" ParentId="4948" CreationDate="2015-09-24T21:03:31.440" Score="2" Body="&lt;p&gt;If you want to get a user model based on UID you can do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For current user..&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get current user &lt;code&gt;$currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Get user record &lt;code&gt;$currentUserRecord = $this-&amp;gt;_getUserRecordById($currentUser-&amp;gt;id);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add this private function (copied from UserService.php). This will pull the user record by calling &lt;code&gt;_getUserRecordById&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _getUserRecordById($userId)&#xA;{&#xA;  $userRecord = UserRecord::model()-&amp;gt;findById($userId);&#xA;  if (!$userRecord) {&#xA;    throw new Exception(Craft::t('No user exists with the ID “{id}”.', array('id' =&amp;gt; $userId)));&#xA;}&#xA;&#xA;return $userRecord;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;Now get user UID &lt;code&gt;$currentUser-&amp;gt;uid&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So it'll be similar for any other user. Assuming you have a user id (I'll use &lt;code&gt;32&lt;/code&gt; for example)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get user record &lt;code&gt;$userRecord = $this-&amp;gt;_getUserRecordById('32');&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Now get user UID &lt;code&gt;$userRecord-&amp;gt;uid&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;my two cents.&lt;/p&gt;&#xA;" OwnerUserId="971" LastEditorUserId="971" LastEditDate="2015-09-24T22:34:10.043" LastActivityDate="2015-09-24T22:34:10.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11622" PostTypeId="2" ParentId="11620" CreationDate="2015-09-24T21:08:25.470" Score="4" Body="&lt;p&gt;When your plugin has a camel cased name you need to make sure you camel case your references to it, such as when you try and visit an action url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume this is due to when craft tries to resolve the url it sees &lt;code&gt;pluginname&lt;/code&gt; and &lt;code&gt;pluginName&lt;/code&gt; as two different things, much like php variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also assume this is due to the way Craft autoloads classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So using &lt;code&gt;webMentionReciever&lt;/code&gt; would resolve since it would be a &quot;exact&quot; match to your plugin name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't limited to just plugin names, the same goes for any service, controller etc references too.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-24T21:08:25.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11623" PostTypeId="1" AcceptedAnswerId="11624" CreationDate="2015-09-24T22:10:59.550" Score="3" ViewCount="1093" Body="&lt;p&gt;I'm trying to construct a fairly simple LIKE query using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/database#query-builder&quot; rel=&quot;nofollow&quot;&gt;Query Builder&lt;/a&gt;, and I'm struggling. Here's the SQL that I want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT `id` FROM `craft_somecustomtable` WHERE ((`somecolumn` LIKE '%foo%') OR (`somecolumn` LIKE '%bar%'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've ran the above query in Sequel, with results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Query Builder, here's what I've got so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;$query-&amp;gt;select('id');&#xA;$query-&amp;gt;from('somecustomtable');&#xA;$query-&amp;gt;orWhere(array(&#xA;    'somecolumn' =&amp;gt; 'LIKE %foo%',&#xA;));&#xA;$query-&amp;gt;orWhere(array(&#xA;    'somecolumn' =&amp;gt; 'LIKE %bar%',&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces the following query, which obviously doesn't work as intended:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT `id` FROM `craft_somecustomtable` WHERE ((`somecolumn`='LIKE %foo%') OR (`somecolumn`='LIKE %bar%'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried adding the &lt;code&gt;LIKE&lt;/code&gt; directive like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query-&amp;gt;orWhere(array(&#xA;    'somecolumn LIKE' =&amp;gt; '%bar%',&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces an error, however.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-24T22:13:47.773" Title="How do I build a LIKE query with DbCommand/Query Builder?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11624" PostTypeId="2" ParentId="11623" CreationDate="2015-09-24T22:13:47.773" Score="6" Body="&lt;p&gt;Just before posting the question, I had the good mind to read the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand&quot;&gt;Yii CDbCommand&lt;/a&gt; docs again, and I figured this out myself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query-&amp;gt;orWhere(array(&#xA;    'like',&#xA;    'somecolumn',&#xA;    '%foo%'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-24T22:13:47.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11625" PostTypeId="1" CreationDate="2015-09-25T08:53:08.370" Score="2" ViewCount="124" Body="&lt;p&gt;We launched a website last week based on Craft CMS.&#xA;One page contains mainly a list with links to sponsors (entered in a rich text field). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I make a fulltext search (via &lt;code&gt;$critera-&amp;gt;search&lt;/code&gt;) through the whole website, that works very fine, but it just didn't find the link texts inside a rich text field. (e.g. &quot;Ascot&quot;, &lt;a href=&quot;http://www.unidram.de/en/festival/partner-sponsors&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.unidram.de/en/festival/partner-sponsors&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I put the same text outside of the link, the search will find it. But that's not the solution, because the text should be the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a workaround and added Tags for every link to the page (except above given example). That did the job, but is additional work we won't normally do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I clicked on &quot;rebuild the search index&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search on the website didn't find the page.&#xA;This is the template part of the search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getPost('q') %}&#xA;{% set entries =  &#xA; craft.entries.search(query).section('seitenstruktur').order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I searched for 'Ascot' in &lt;code&gt;craft_searchindex&lt;/code&gt; in the DB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the content of the related field is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;performance netzuniversitaetsgesellschaft potsdam sponsorenhochdreiascot bristolmedienpartnerpotsdamer neueste nachrichten&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While the content looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YAOAb.jpg&quot; alt=&quot;content&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in fact the word 'Ascot' is saved as part of 'sponsorenhochdreiascot'. &#xA;As soon as I change it to 'sponsorenhochdrei ascot', the entry will be found by the search on the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The HTML Code of the part is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;Sponsoren&amp;lt;/h3&amp;gt;&#xA;&amp;lt;p&amp;gt;&amp;lt;a target=&quot;_blank&quot; href=&quot;http://www.domainx.com/&quot;&amp;gt;HochDrei&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&amp;lt;a target=&quot;_blank&quot; href=&quot;http://www.domainy.de/&quot;&amp;gt;Ascot &#xA;Bristol&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The search index seems to miss some space characters.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorDisplayName="user1080" LastEditDate="2017-06-02T03:49:08.907" LastActivityDate="2017-06-02T03:49:08.907" Title="Search through Linklist in Richtext field not working?" Tags="&lt;search&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11626" PostTypeId="1" CreationDate="2015-09-25T09:00:50.210" Score="0" ViewCount="60" Body="&lt;p&gt;I want to use like owl carousel JS UI in front.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's carousel &lt;a href=&quot;http://owlgraphic.com/owlcarousel/&quot; rel=&quot;nofollow&quot;&gt;a link&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has some option can setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a own fields type in admin, can setting this option and show this UI in front view. &lt;/p&gt;&#xA;" OwnerUserId="4125" LastEditorUserId="57" LastEditDate="2015-09-25T22:24:37.240" LastActivityDate="2015-09-25T22:24:37.240" Title="How can I let JS UI building to field type plugin?" Tags="&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11627" PostTypeId="1" CreationDate="2015-09-25T09:33:32.127" Score="1" ViewCount="62" Body="&lt;p&gt;I need to use getLocalCopy from LocalAssetSourceType&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get asset source&#xA;$source = $asset-&amp;gt;getSource();&#xA;// Get asset source type&#xA;$sourceType = $source-&amp;gt;getSourceType();&#xA;// Get asset file&#xA;$file = $sourceType-&amp;gt;getLocalCopy($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that function returns the error &lt;code&gt;Tried to copy 2015/ami-l.jpg to /twenrytn/unidram/craft/storage/runtime/temp/assets56050ef792f4e1.75513363.jpg, but the source file does not exist.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source file definitely exists, so i checked the function itself&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getLocalCopy(AssetFileModel $file)&#xA;{&#xA;    $location = AssetsHelper::getTempFilePath($file-&amp;gt;getExtension());&#xA;      MyPlugin::log($this-&amp;gt;_getFileSystemPath($file) . ' &amp;gt; ' . $location);&#xA;    IOHelper::copyFile($this-&amp;gt;_getFileSystemPath($file), $location);&#xA;    clearstatcache();&#xA;    return $location;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the log returned &lt;code&gt;2015/ariel-doron-xl.jpg &amp;gt; /twenrytn/unidram/craft/storage/runtime/temp/assets5605112c1aef83.12097209.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think &lt;code&gt;$this-&amp;gt;_getFileSystemPath($file)&lt;/code&gt; should return an absolute path. Why didnt it?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-09-25T09:33:32.127" Title="asset sourcetype getLocalCopy() not working?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;plugins&gt;&lt;sources&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11628" PostTypeId="1" CreationDate="2015-09-25T14:10:35.273" Score="2" ViewCount="2694" Body="&lt;p&gt;Struggling to debug this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full log is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Next exception 'Twig_Error_Runtime' with message 'An exception has been thrown during the rendering of a template (&quot;&quot;) in &quot;book/poll-availability&quot; at line 4.' in /var/www/craft/app/vendor/twig/twig/lib/Twig/Template.php:355&#xA;Stack trace:&#xA;#0 /var/www/craft/app/vendor/twig/twig/lib/Twig/Template.php(314): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#1 /var/www/craft/app/vendor/twig/twig/lib/Twig/Template.php(325): Twig_Template-&amp;gt;display(Array)&#xA;#2 /var/www/craft/app/vendor/twig/twig/lib/Twig/Environment.php(293): Twig_Template-&amp;gt;render(Array)&#xA;#3 /var/www/craft/app/services/TemplatesService.php(223): Twig_Environment-&amp;gt;render('book/poll-avail...', Array)&#xA;#4 /var/www/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('book/poll-avail...', Array)&#xA;#5 /var/www/craft/app/controllers/TemplatesController.php(55): Craft\BaseController-&amp;gt;renderTemplate('book/poll-avail...', Array)&#xA;#6 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('book/poll-avail...', Array)&#xA;#7 /var/www/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#8 /var/www/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#9 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#10 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#11 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#12 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#13 /var/www/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#14 /var/www/craft/app/etc/web/WebApp.php(279): CWebApplication-&amp;gt;processRequest()&#xA;#15 /var/www/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#16 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#17 /var/www/public-imperialhotels/en/index.php(22): require_once('/var/www/craft/...')&#xA;#18 {main}&#xA;REQUEST_URI=/en/book/poll-availability?token=9923444c-13b4-41bb-b7ab-9e339277bacc&amp;amp;iframe=true&amp;amp;room-urns=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the template in question looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set token = craft.request.getParam('search') %}&#xA;&#xA;{% if (not craft.request.isAjax and not token ) %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% hook 'microsGetAvailabilityResults' %}&#xA;&#xA;{% header 'Content-Type: application/json' %}&#xA;&#xA;{% set data = {&#xA;    'complete': results.complete,&#xA;    'urn': results.urn,&#xA;    'pollUrl': craft.request.url ~ '?' ~ craft.request.queryStringWithoutPath&#xA;} %}&#xA;&#xA;{{ data | json_encode | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So line 4 specifically is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% exit 404 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should only be called if &lt;code&gt;token&lt;/code&gt; is blank and as you can see from the &lt;code&gt;REQUEST_URI&lt;/code&gt;, it should be set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;REQUEST_URI=/en/book/poll-availability?token=9923444c-13b4-41bb-b7ab-9e339277bacc&amp;amp;iframe=true&amp;amp;room-urns=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's most frustrating is that this has been picked up in server log monitoring on a live box and we can't replicate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template exits correctly if we hit the URL with a non-Ajax request and if no token is defined, so what gives?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2019-11-19T09:08:40.373" Title="An exception has been thrown during the rendering of a template (&quot;&quot;)" Tags="&lt;templating&gt;&lt;error-handling&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11629" PostTypeId="2" ParentId="11626" CreationDate="2015-09-25T15:54:24.480" Score="3" Body="&lt;p&gt;You can quite easily set up asset and text fields to be fed into a owl-carousel template. Or you could create a matrix in which one of the blocks would automatically produce owl-carousel html and again pass asset and text fields in the matrix block to produce the images and captions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want further assistances try to be a little more specific in your question. &lt;/p&gt;&#xA;" OwnerUserId="4033" LastActivityDate="2015-09-25T15:54:24.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11630" PostTypeId="1" CreationDate="2015-09-25T16:04:21.417" Score="1" ViewCount="113" Body="&lt;p&gt;I need to develop a plugin where the user can modify his pictures (assets) on the fly. I've already done that in another PHP project and am willing to port it on craft, but I cant find any way on how to access assets, and what's the best way of doing it.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, I want my plugin to act on &lt;strong&gt;asset sources&lt;/strong&gt;, like you enable it or not.&lt;/li&gt;&#xA;&lt;li&gt;Then, I want to add a button in the small window that opens up when you double click an asset (in an entry for example), how can one achieve this ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&#xA;Usecase : I have an image gallery, where albums are a structure, and you can add images in any of them. New albums can be added by other users. When they double click a picture in the entry editor, I'd like to display a button that says something like &quot;edit&quot; (under the default options). I tried using a new field type but it's not the good and legit solution I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the button is clicked, they are brought to a new page (still in CP) where they can edit their picture (I did the editor in javascript), then save it.&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="3696" LastEditDate="2015-09-26T06:30:16.853" LastActivityDate="2015-09-26T06:30:16.853" Title="Plugin access assets directly in CP" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11631" PostTypeId="1" CreationDate="2015-09-25T17:07:41.500" Score="2" ViewCount="289" Body="&lt;p&gt;I am new to this so, excuse the lack of proper terminology. But I am using the Sprout Forms plugin (v1.1.0) on a site we designed for a real estate client. What I am hoping is that a visitor could fill out a form, and then the notification email would include the page title {{entry.title}} of the page which the form was filled out on. Otherwise would I need to create a unique form for every page in a craft &quot;channel?&quot; The site url is &lt;a href=&quot;http://sivelluxury.com&quot; rel=&quot;nofollow&quot;&gt;http://sivelluxury.com&lt;/a&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've currently got this in the subject line of the notification pane for that contact form - {fullName} Submitted a contact form on {{entry}} was filled on {{ siteName }} {dateCreated|date('Y-m-d')}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone who can help me?&lt;/p&gt;&#xA;" OwnerUserId="4126" LastActivityDate="2015-10-20T20:00:41.480" Title="Output entry title in subject line of notification when sprout form is submitted" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11632" PostTypeId="1" AcceptedAnswerId="11633" CreationDate="2015-09-25T18:37:29.490" Score="1" ViewCount="171" Body="&lt;p&gt;I have the same embed in 2 sections of a site (homepage and blog). There is a slight html/css change but the data is the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do a shared partial template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I be using a block? Should I look into using setting a global var? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar to what I was thinking:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if page == &quot;homepage&quot; %}&#xA;    {% for promo in craft.entries.section('promos').status('live').limit(5) %}&#xA;        &amp;lt;div id=&quot;promos&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;promo_item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;promo_item_img&quot;&amp;gt;&#xA;                        {% for image in promo.promoImage %}&#xA;                            &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;222&quot; height=&quot;101&quot;&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;                &amp;lt;a href=&quot;{promolink}&quot;&amp;gt;&amp;lt;h2 class=&quot;generic_title&quot;&amp;gt;| {{ promo.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ promo.promoTagline }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;&#xA;            {% if page == &quot;blog&quot; %}&#xA;                {% for promo in craft.entries.section('promos').status('live').limit(5) %}&#xA;                    &amp;lt;div class=&quot;blog_item_inner blog_item_preorder&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;blog_item_preorder_img&quot;&amp;gt;&#xA;                                {% for image in promo.promoImage %}&#xA;                                    &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;222&quot; height=&quot;101&quot;&amp;gt;&#xA;                                {% endfor %}&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                        &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;h2 class=&quot;generic_title&quot;&amp;gt;| {{ promo.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ promo.promoTagline }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just want to get the best solution in place early.&lt;/p&gt;&#xA;" OwnerUserId="353" LastActivityDate="2015-09-25T19:57:38.267" Title="Shared Template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11633" PostTypeId="2" ParentId="11632" CreationDate="2015-09-25T19:57:38.267" Score="4" Body="&lt;p&gt;First, create a sub folder in &lt;code&gt;/templates&lt;/code&gt; called &lt;code&gt;_partials&lt;/code&gt;. The underscore essentially &quot;hides&quot; the templates inside that folder from Craft, i.e. they won't get routed to URLs like a regular template; perfect for any template that isn't going to work on its own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside &lt;code&gt;_partials&lt;/code&gt;, create a template called &lt;code&gt;_promos.html&lt;/code&gt; or the like. Your Twig code above would work as-is, though I'm making some opinionated improvements below (like setting the &lt;code&gt;promos&lt;/code&gt; in one place, checking if we actually have some promos to print, and using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/switch&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;switch&lt;/code&gt;&lt;/a&gt; tag instead of &lt;code&gt;if&lt;/code&gt; for readability:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set promos = craft.entries.section('promos').status('live').limit(5) %}&#xA;{% if page is defined and promos|length %}&#xA;    {% for promo in promos %}&#xA;    {% switch page %}&#xA;&#xA;        {% case &quot;homepage&quot; %}&#xA;         &amp;lt;div class=&quot;promo_item&quot;&amp;gt;&#xA;             &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;promo_item_img&quot;&amp;gt;&#xA;                {% for image in promo.promoImage %}&#xA;                    &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;222&quot; height=&quot;101&quot;&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;{promolink}&quot;&amp;gt;&amp;lt;h2 class=&quot;generic_title&quot;&amp;gt;| {{ promo.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ promo.promoTagline }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% case &quot;blog&quot; %}&#xA;        &amp;lt;div class=&quot;blog_item_inner blog_item_preorder&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;blog_item_preorder_img&quot;&amp;gt;&#xA;                {% for image in promo.promoImage %}&#xA;                    &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;222&quot; height=&quot;101&quot;&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;h2 class=&quot;generic_title&quot;&amp;gt;| {{ promo.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ promo.promoTagline }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endswitch %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; tag to include the partial in another template. Use the &lt;code&gt;with&lt;/code&gt; parameter to set the &lt;code&gt;page&lt;/code&gt; variable, and the &lt;code&gt;only&lt;/code&gt; directive to make sure the partial can't access any of the data in the parent template (like the &lt;code&gt;entry&lt;/code&gt; variable etc). This helps prevent data pollution and variable name collisions (if you need access to the &lt;code&gt;entry&lt;/code&gt; variable, you can include it in the &lt;code&gt;with&lt;/code&gt; object).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;promos&quot;&amp;gt;&#xA;    {% include '_partials/promos' with { page : &quot;homepage&quot; } only %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the blog, replace the &lt;code&gt;page&lt;/code&gt; property with &quot;blog&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, as far as I can tell, the only difference between the two blocks of Twig are different classes for the containers (&lt;code&gt;blog_item&lt;/code&gt; vs. &lt;code&gt;promo_item&lt;/code&gt; etc). If possible, I'd consider refactoring your code to use the same classnames both &quot;blog&quot; and &quot;homepage&quot; – this would make your code more lean and &lt;a href=&quot;https://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot; rel=&quot;nofollow&quot;&gt;DRY&lt;/a&gt;, and probably easier to maintain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't change the classnames, you could also make them dynamic and expose them to the &lt;code&gt;include&lt;/code&gt; statement like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/promos' with { page : &quot;blog&quot;, classNames : {&#xA;    'item' : 'blog_item_inner blog_item_preorder',&#xA;    'image' : 'blog_item_preorder_img'&#xA;} } only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and then print those classnames inside the partial (which now won't require the &lt;code&gt;switch&lt;/code&gt; tag or duplicated markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set promos = craft.entries.section('promos').status('live').limit(5) %}&#xA;{% if classNames is defined and promos|length %}&#xA;    {% for promo in promos %}&#xA;         &amp;lt;div class=&quot;{{ classNames.item }}&quot;&amp;gt;&#xA;             &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;{{ classNames.image }}&quot;&amp;gt;&#xA;                {% for image in promo.promoImage %}&#xA;                    &amp;lt;img src=&quot;{{ image.url }}&quot; width=&quot;222&quot; height=&quot;101&quot;&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;{promolink}&quot;&amp;gt;&amp;lt;h2 class=&quot;generic_title&quot;&amp;gt;| {{ promo.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ promo.promoTagline }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-25T19:57:38.267" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11634" PostTypeId="2" ParentId="11619" CreationDate="2015-09-25T20:17:05.333" Score="1" Body="&lt;p&gt;Thanks to P&amp;amp;T via a support ticket, this issue has been resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I just had a structure which, some point, I had used as my navigation and was causing a conflict. Something which I just completely overlooked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From P&amp;amp;T via a support ticket:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The issue seems to be in your Navigation structure. You have &quot;Entries in this section have their own URLs&quot; turned on, but you do not set a template for the section. So, when a user requests 'search', which is an entry in your Navigation structure, Craft defaults to show the index.twig template.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-09-25T20:17:05.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11635" PostTypeId="2" ParentId="11609" CreationDate="2015-09-25T22:20:23.027" Score="5" Body="&lt;p&gt;Here's how I did it in a recent project:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $fileIds = array();&#xA;&#xA;    // get remote image and store in temp path&#xA;    $imageInfo = pathinfo($data['image_url']);&#xA;    $tempPath = CRAFT_STORAGE_PATH . 'runtime/temp/' . $imageInfo['basename'];&#xA;    file_put_contents($tempPath, fopen($data['image_url'], 'r'));&#xA;&#xA;    // insert the file into assets&#xA;    $response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;      $tempPath,&#xA;      $imageInfo['basename'],&#xA;      $myAssetFolderId, // notice, this is the id of the folder you want to upload to&#xA;      AssetConflictResolution::KeepBoth&#xA;    );&#xA;&#xA;    // if the response is a success, get the file id&#xA;    if ($response &amp;amp;&amp;amp; $response-&amp;gt;isSuccess()) {&#xA;        $fileIds[] = $response-&amp;gt;getDataItem('fileId');&#xA;    }&#xA;&#xA;    // create a new entry&#xA;    $entry = new EntryModel();&#xA;    $entry-&amp;gt;sectionId = $mySectionId;&#xA;    $entry-&amp;gt;typeId = $myEntryTypeId;&#xA;    $entry-&amp;gt;authorId = 1;&#xA;&#xA;    // set your content, including image field by id&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = $data['title'];&#xA;    $entry-&amp;gt;getContent()-&amp;gt;mainImage = $fileIds;&#xA;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I included the entry saving part of it to show how the response is used to get the file id(s) and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether this is the &quot;correct&quot; way to do it or not, I don't know. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-09-25T22:20:23.027" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11636" PostTypeId="2" ParentId="11628" CreationDate="2015-09-25T22:23:10.127" Score="2" Body="&lt;p&gt;You're searching in the URI for a param with a key called &lt;code&gt;search&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set token = craft.request.getParam('search') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the in the URI it's called &lt;code&gt;token&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;REQUEST_URI=/en/book/poll-availability?token=9923444c-13b4-41bb-b7ab-9e339277bacc&amp;amp;iframe=true&amp;amp;room-urns=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore when it's not an AJAX request this passes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (not craft.request.isAjax and not token ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a 404 is thrown:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% exit 404 %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-25T22:23:10.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11637" PostTypeId="2" ParentId="10524" CreationDate="2015-09-26T03:29:11.180" Score="1" Body="&lt;p&gt;While its pretty basic right now, we've just added this to &lt;a href=&quot;https://github.com/engram-design/ImageResizer&quot; rel=&quot;nofollow&quot;&gt;Image Resizer&lt;/a&gt;, which can get you off to a great start - even if you need to extend it to your specific needs!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-09-26T03:29:11.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11638" PostTypeId="1" CreationDate="2015-09-26T09:00:54.037" Score="2" ViewCount="90" Body="&lt;p&gt;If I create an entry with international characters in urls? e.g. for Polish language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I create an entry with the word &quot;ułatwienia&quot; in the url, it doesn't work (I get Craft serving up the 404 page), I take out the special ł character and it's fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although interestingly, the Live Preview url works fine with the special character included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I missed something?&lt;/p&gt;&#xA;" OwnerUserId="4128" LastEditorUserId="57" LastEditDate="2015-09-26T17:34:29.777" LastActivityDate="2015-10-26T17:58:43.967" Title="Does Craft support international urls?" Tags="&lt;localization&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11639" PostTypeId="1" CreationDate="2015-09-26T15:29:03.740" Score="0" ViewCount="1762" Body="&lt;p&gt;My site just suddenly broke down on a certain page with the following error code, (see screenshot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/loQvg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/loQvg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is occuring for every image on this page and really confusing me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any quick suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3959" LastEditorUserId="115" LastEditDate="2015-09-26T18:10:40.313" LastActivityDate="2015-09-26T19:51:06.260" Title="Getting image url error code: Impossible to access an attribute (&quot;url&quot;) on a null variable" Tags="&lt;error&gt;&lt;error-templates&gt;&lt;error-handling&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11640" PostTypeId="2" ParentId="11639" CreationDate="2015-09-26T15:54:26.090" Score="2" Body="&lt;p&gt;It's a bit hard to tell from this snippet, but if &lt;code&gt;image&lt;/code&gt; is an asset field it's important to remember that these are returned as arrays so you have to access the url more like &lt;code&gt;block.image.first().url&lt;/code&gt;. However, if the image variable is set elsewhere this probably won't help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#templating&quot; rel=&quot;nofollow&quot;&gt;Relevant docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2307" LastActivityDate="2015-09-26T15:54:26.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11641" PostTypeId="2" ParentId="11631" CreationDate="2015-09-26T16:29:00.053" Score="1" Body="&lt;p&gt;This is now possible with Sprout Forms 2.0 and Sprout Fields 1.0 Hidden or Invisible Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to make your entry available to the Hidden of Invisible field using the &lt;code&gt;addFieldVariables&lt;/code&gt; tag, and then in your field settings you can reference the Entry ID using single curly braces: &lt;code&gt;{entry.id}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Make the Entry available to your Hidden or Invisible field settings #}&#xA;{% do craft.sproutForms.addFieldVariables({ entry: entry }) %}&#xA;&#xA;{# Output your form as normal #}&#xA;{{ craft.sproutForms.displayForm('contact') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field#setting-a-dynamic-value-outside-the-global-scope&quot; rel=&quot;nofollow&quot;&gt;Setting a dynamic value (outside the global scope)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Legacy Answer (pre Sprout Forms 2.0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a form is submitted, the form notification has access to the variables in the &lt;code&gt;SproutForms_EntryModel&lt;/code&gt; which include all the custom fields submitted with the form and anything in the global scope such as &lt;code&gt;{{ currentUser.email }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the Subject Line of the page that the form was submitted from available to your notification, you will need to make it a field on your form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may be a little tricky to do with dynamic forms right now, but we are working on a way to make this easier in the future using a Hidden Field field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple approaches to consider right now:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Write a Hidden Field custom field type that behaves like you need it to&lt;/li&gt;&#xA;&lt;li&gt;Build your form with custom HTML and populate a hidden field on your form with the &lt;code&gt;{{ entry.title }}&lt;/code&gt; value.&lt;/li&gt;&#xA;&lt;li&gt;Create a &quot;Page Title&quot; Plain Text field on your form, style it to &lt;code&gt;display:none&lt;/code&gt; so the user never sees the field there, and populate the field with the entry title using javascript.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2015-10-20T20:00:41.480" LastActivityDate="2015-10-20T20:00:41.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11642" PostTypeId="2" ParentId="11638" CreationDate="2015-09-26T17:34:16.933" Score="1" Body="&lt;p&gt;That should work fine and I just tested locally with a fresh Craft installation on the latest build and &lt;code&gt;ułatwienia&lt;/code&gt; works in the slug for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you've got the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#limitAutoSlugsToAscii&quot; rel=&quot;nofollow&quot;&gt;limitAutoSlugsToAscii&lt;/a&gt; config setting set to true and &lt;code&gt;ł&lt;/code&gt; gets changed to &lt;code&gt;l&lt;/code&gt; in the slug, but you're still entering &lt;code&gt;ł&lt;/code&gt; in the URL?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-26T17:34:16.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11643" PostTypeId="2" ParentId="11639" CreationDate="2015-09-26T19:51:06.260" Score="3" Body="&lt;p&gt;For whatever reason, your site isn't able to find the image. And since your Twig code isn't being &lt;em&gt;defensive&lt;/em&gt;, it's failing ungracefully.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.media.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This first part is fine... I'm assuming that &lt;code&gt;media&lt;/code&gt; is an Assets relationship field. You're attempting to fetch the &lt;code&gt;first&lt;/code&gt; asset, and set that to &lt;code&gt;image&lt;/code&gt;. Here's the kicker... &lt;strong&gt;when no assets are found, &lt;code&gt;image&lt;/code&gt; will be set to NULL&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This next part is where your problem is...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ image.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That'll work great assuming an asset was found. But when no assets were found, this will trigger an error. Because &lt;code&gt;image&lt;/code&gt; would be set to NULL, and NULL doesn't have an attribute of &lt;code&gt;url&lt;/code&gt;. (This is exactly what the error message is telling you.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you should write that line more defensively...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ image ? image.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This technique uses the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary operator&lt;/a&gt; to first check &quot;if &lt;code&gt;image&lt;/code&gt; is truthy&quot; before attempting to output &lt;code&gt;image.url&lt;/code&gt;. In other words, if &lt;code&gt;image&lt;/code&gt; contains a valid asset, output the image URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, if no asset is found, you won't get a big nasty error message.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;On a separate note... You seem to be expressing some urgency that your site has gone down. But the screenshot you showed is clearly a byproduct of being in &lt;a href=&quot;http://buildwithcraft.com/help/dev-mode&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt;. For the record, you never want to have &lt;code&gt;devMode&lt;/code&gt; enabled in a live production environment.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-26T19:51:06.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11644" PostTypeId="1" AcceptedAnswerId="12068" CreationDate="2015-09-26T22:09:30.847" Score="2" ViewCount="870" Body="&lt;p&gt;I'm trying to create a plugin that adds a tab full of fields to entry types but I can't seem to get it working. I tried &lt;a href=&quot;https://buildwithcraft.com/classreference/services/FieldsService#assembleLayout-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;assembleLayout&lt;/code&gt;&lt;/a&gt; but that replaced all the fields with my new fields rather than adding a new tab to them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying different combinations of &lt;code&gt;FieldLayoutTabModel-&amp;gt;setFields()&lt;/code&gt; but that throws an error about a &lt;code&gt;fieldId&lt;/code&gt; property which leads me to believe I don't quite have the data types right. Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2307" LastActivityDate="2015-10-22T18:12:44.997" Title="How can I programmatically add a tab to entry type?" Tags="&lt;field&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11645" PostTypeId="1" AcceptedAnswerId="11652" CreationDate="2015-09-27T03:14:49.590" Score="2" ViewCount="632" Body="&lt;p&gt;I have a model that contains a bunch of storage arrays where I collect results from various services I have written.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Shipper_ResultsModel extends BaseModel&#xA;{&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;shipping categories for debugging&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'service'               =&amp;gt; array('type'=&amp;gt;AttributeType::Enum, 'values'=&amp;gt;['post','courier','free','cantShip','needsQuote']),&#xA;            'options'               =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'boxes'                 =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'postShippingItems'     =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'courierShippingItems'  =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'freeShippingItems'     =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'cantShippingItems'     =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;            'quoteShippingItems'    =&amp;gt; array('type'=&amp;gt;AttributeType::Mixed,'default'=&amp;gt;[]),&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each of this &lt;code&gt;ShippingItems&lt;/code&gt; arrays is intended to hold an array of Shipper_ShippingItem models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is in building these arrays, I create new items and add them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            $shippingItem = Shipper_ShippingItemModel::populateModel($data);&#xA;&#xA;            //build our arrays of items&#xA;            if($shippingClass==&quot;Courier Only&quot;){&#xA;                $results-&amp;gt;courierShippingItems[] = $shippingItem;&#xA;            }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this results in the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Notice: Indirect modification of overloaded property Craft\Shipper_ResultsModel::$courierShippingItems has no effect&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is because I am not using array objects as such but I have to say I've  got a little confused here and various syntax experiments have resulted in ignoble failures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some guidance as to the right way would be much appreciated (and am I right in using &lt;code&gt;AttributeType::Mixed&lt;/code&gt; for these?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is all for a mega shipping calculator for Craft Commerce, should that matter)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2015-09-27T20:51:49.797" LastActivityDate="2015-09-27T21:21:31.103" Title="How to add to arrays in models?" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;models&gt;&lt;array&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11646" PostTypeId="1" AcceptedAnswerId="11672" CreationDate="2015-09-27T15:04:27.240" Score="0" ViewCount="249" Body="&lt;p&gt;As a test, I checked the &quot;Require a password reset on next login&quot; box for my account and then logged out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried logging in, expecting some sort of password reset screen, but nothing happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried to reset my password at the login screen -- something I was able to do before -- and nothing happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases, I get a &quot;500 (Internal Server Error)&quot; in the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas for fixing this? At the very least, can I just reset my password directly in the DB via phpMyAdmin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, I also ran into this problem using a Craft demo site.&lt;/p&gt;&#xA;" OwnerUserId="737" LastEditorUserId="737" LastEditDate="2015-09-27T16:02:25.840" LastActivityDate="2015-09-29T18:33:15.070" Title="Checked &quot;Require a password reset on next login&quot; on my account, can't log in anymore" Tags="&lt;password&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11647" PostTypeId="1" AcceptedAnswerId="11659" CreationDate="2015-09-27T15:39:12.793" Score="3" ViewCount="772" Body="&lt;p&gt;I know how to find user by username and email. The problem comes when I need to query users based on a custom field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my scenario. I have about 2,000 users (part of a user group 'Affiliates') that I have created in our system. They have many custom fields including &lt;em&gt;affiliateId&lt;/em&gt; and &lt;em&gt;studentCount&lt;/em&gt;. I need to be able to execute two separate queries. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find a single user by his/her affiliateId (&lt;em&gt;int&lt;/em&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Query all users within the Affiliate group, order by studentCount &lt;em&gt;asc&lt;/em&gt; and return the top record. (I need a user that has the fewest number of students).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have searched docs and tried numerous combinations to query users. Any help at this point greatly appreciated. Is search the best way? If so, how do you order the search result?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-09-28T19:54:28.730" Title="Searching for users from a plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11648" PostTypeId="1" AcceptedAnswerId="11740" CreationDate="2015-09-27T16:17:04.423" Score="2" ViewCount="1212" Body="&lt;p&gt;I created an Ajax-based login form based on this gist: &lt;a href=&quot;https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the user has logged in, how can I get some info about them over Ajax?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="9" LastEditDate="2015-10-06T21:47:36.440" LastActivityDate="2015-10-06T21:51:36.847" Title="How do I get the current user’s info over Ajax?" Tags="&lt;users&gt;&lt;ajax&gt;&lt;current-user&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11649" PostTypeId="1" CreationDate="2015-09-27T19:12:51.653" Score="3" ViewCount="198" Body="&lt;p&gt;We have quite a large Craft based site that requires load balancing so there are often multiple instances of the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem we are having is with the translation files. Because these are stored as files when you update them through the admin they are only updated on the site instance you are currently on. Obviously this isn't scalable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best solution to make these static translations scalable in this sort of environment? Move the translation files to an S3 bucket? (this would be ideal but have don't think this is possible) or move all translation fields to the database somehow? (what would be the best field type to store them as and where?) or is there some other solution?&lt;/p&gt;&#xA;" OwnerUserId="802" LastActivityDate="2015-12-27T09:22:13.427" Title="Translation files on load balanced multiple instance site" Tags="&lt;localization&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11650" PostTypeId="2" ParentId="11625" CreationDate="2015-09-27T19:25:14.070" Score="2" Body="&lt;p&gt;The reason that searching for &lt;code&gt;Ascot&lt;/code&gt; doesn't match &lt;code&gt;sponsorenhochdreiascot&lt;/code&gt; is because Craft doesn't do wildcard or fuzzy searching by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you search for &lt;code&gt;*ascot&lt;/code&gt; it would match.  You can all of the supported search syntaxes here: &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;As of &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5&lt;/a&gt;, you can enable &lt;a href=&quot;https://craftcms.com/help/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;fuzzy&lt;/a&gt; searching by default.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-04T23:32:06.633" LastActivityDate="2015-12-04T23:32:06.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11651" PostTypeId="2" ParentId="11649" CreationDate="2015-09-27T19:43:16.387" Score="0" Body="&lt;p&gt;One option would be to set the &lt;a href=&quot;http://buildwithcraft.com/docs/php-constants#craft-translations-path&quot; rel=&quot;nofollow&quot;&gt;CRAFT_TRANSLATIONS_PATH&lt;/a&gt; PHP constant in your public &lt;code&gt;index.php&lt;/code&gt; file and have that point to a network storage path that all web servers can point to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-27T19:43:16.387" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11652" PostTypeId="2" ParentId="11645" CreationDate="2015-09-27T21:21:31.103" Score="2" Body="&lt;p&gt;I'm pretty sure &lt;code&gt;'default'=&amp;gt;[]&lt;/code&gt; isn't doing anything so it's probably not necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to force a single attribute to be of a specific model, you could use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'courierShippingItems'  =&amp;gt; array('type' =&amp;gt; AttributeType::Mixed, 'model' =&amp;gt; 'Shipper_ShippingItemModel');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regardless, you'll want to use BaseModel's &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/BaseModel.php#L355&quot; rel=&quot;nofollow&quot;&gt;setAttribute&lt;/a&gt; to do what you're trying to do and build your entire array up first before assigning it to the attribute.  Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$shippingItems[] = Shipper_ShippingItemModel::populateModel($data);&#xA;&#xA;$results-&amp;gt;setAttribute('courierShippingItems', $shippingItems);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-27T21:21:31.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11653" PostTypeId="2" ParentId="11649" CreationDate="2015-09-27T23:00:23.860" Score="1" Body="&lt;p&gt;Why not just check your site into a git or subversion repository, and when the translation files are updated, push them to the repo, and have the other servers pull the changes down?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even automate it with the various git hooks.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-09-27T23:00:23.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11654" PostTypeId="2" ParentId="11649" CreationDate="2015-09-28T07:45:51.493" Score="0" Body="&lt;p&gt;Another solution would be to setup a cronjob on your master server to run a rsync on the translation files to the other edge servers every minute / 10 minute.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-09-28T07:45:51.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11655" PostTypeId="2" ParentId="8455" CreationDate="2015-09-28T12:39:55.100" Score="0" Body="&lt;p&gt;I've had this a couple of times, and have yet to figure out what causes it, but on my server deleting the &lt;code&gt;compiled_templates&lt;/code&gt; folder (&lt;code&gt;app/craft/storage/runtime/compiled_templates&lt;/code&gt;) fixes it.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-09-28T12:39:55.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11656" PostTypeId="2" ParentId="11589" CreationDate="2015-09-28T13:29:54.653" Score="7" Body="&lt;p&gt;As of Craft 2.4.2688:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is now possible to access &lt;code&gt;Craft.BaseElementSelectInput&lt;/code&gt; objects&#xA;  from their container elements, via &lt;code&gt;.data('elementSelect')&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On select element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#theElementSelectField').data('elementSelect').on('selectElements', function(e) {&#xA;    console.log(e); // Take a look&#xA;    // Do stuff here when elements are selected...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On remove element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#theElementSelectField').data('elementSelect').on('removeElements', function(e) {&#xA;    console.log(e);&#xA;    // Do stuff here when elements are removed...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NB. If you are using the Craft macros to build the select element inputs, make sure your javascript is run after craft has done its magic with the input field.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thanks to Brandon Kelly &amp;amp; Lindsey D&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-09-28T13:29:54.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11658" PostTypeId="2" ParentId="11646" CreationDate="2015-09-28T16:17:34.240" Score="1" Body="&lt;p&gt;I was able to fix this by logging into the DB, going to the &quot;craft_users&quot; table, and changing the value of the &quot;passwordResetRequired&quot; column from &quot;1&quot; to &quot;0&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I did that, I could log in without any problems.&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2015-09-28T16:17:34.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11659" PostTypeId="2" ParentId="11647" CreationDate="2015-09-28T17:10:14.780" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Find a single user by his/her affiliateId (int).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;affiliateId = 1;&#xA;$users = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Query all users within the Affiliate group, order by studentCount asc and return the top record. (I need a user that has the fewest number of students).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;affiliateGroup = 'myGroup';&#xA;$criteria-&amp;gt;order = 'studentCount ASC';&#xA;$criteria-&amp;gt;limit = 1;&#xA;$users = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-09-28T19:54:28.730" LastActivityDate="2015-09-28T19:54:28.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11660" PostTypeId="1" CreationDate="2015-09-28T18:23:27.243" Score="1" ViewCount="404" Body="&lt;p&gt;Launching the task &lt;code&gt;Update Asset Indexes&lt;/code&gt; in &lt;code&gt;CP Settings / Tools&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of this task Craft propose a dialog box for you to check some missing files that has been removed from the asset source/folder.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for some reason my Craft is constantly asking me to remove some files that still exist in folder. And if I click OK then it ask me on each indexing task to remove a randomly chosen file.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LBcES.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LBcES.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One interesting clue is that this bug does not happen locally on my Mac Yosemite / MAMP local dev.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Charset and Collation look right to me:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ce47T.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ce47T.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to fix that? (server/mysql config?)&lt;br&gt;&#xA;Very annoying for me because I got metadata attached to assets so I cannot permit random deletion. It also remove the asset files inserted into entries.&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-09-30T17:03:19.200" LastActivityDate="2015-10-02T16:48:55.940" Title="Craft assets indexing wants to remove files that still exist" Tags="&lt;assets&gt;&lt;index&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11661" PostTypeId="1" CreationDate="2015-09-28T20:34:49.940" Score="6" ViewCount="3345" Body="&lt;p&gt;I'm trying to update an entry's field value from a Craft plugin. First I was trying to just update the attributes of the entry like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;  'metaStatus' =&amp;gt; 'Declined'&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that wouldn't work because &lt;code&gt;getContent&lt;/code&gt; doesn't return the data needed in order for the &lt;code&gt;EntryModel&lt;/code&gt; to pass validation. The next solution was to loop through each of the fields and grab their field value like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fields = array();&#xA;&#xA;foreach($entry-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $layout) {&#xA;  $handle = $layout-&amp;gt;getField()-&amp;gt;handle;&#xA;&#xA;  $fields[$handle] = $entry-&amp;gt;getFieldValue($handle);&#xA;}&#xA;&#xA;$fields['metaStatus'] = 'Declined';&#xA;&#xA;$entry-&amp;gt;setContent($fields);&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry); // FAIL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Now&lt;/em&gt; I'm having issues with matrix/asset fields validating since they come back as empty. Am I going to have to look for matrix/asset fields in my loop above and correctly format the data? There must be an easier way to do this.&lt;/p&gt;&#xA;" OwnerUserId="2295" LastActivityDate="2020-10-30T17:02:14.450" Title="Programmatically update entry field" Tags="&lt;entry&gt;&lt;entries-field&gt;&lt;validation&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11662" PostTypeId="2" ParentId="1894" CreationDate="2015-09-29T02:56:06.353" Score="3" Body="&lt;p&gt;I came upon this issue when wrapping copy with a span tag in order to style it differently. The span tag was removed when I saved the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By design, Redactor removes span tags that don't have attributes. The fix is to edit the Redactor config file and add the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/clean/#setting-removeWithoutAttr&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;removeWithoutAttr&lt;/strong&gt;&lt;/a&gt; config as an empty array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;removeWithoutAttr: []&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This prevents tags without attributes from being removed by Redactor.&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2015-09-29T03:05:02.693" LastActivityDate="2015-09-29T03:05:02.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11663" PostTypeId="2" ParentId="11661" CreationDate="2015-09-29T07:59:50.860" Score="4" Body="&lt;p&gt;You're very close. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('metaStatus', 'Declined');&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-09-29T07:59:50.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11664" PostTypeId="1" AcceptedAnswerId="11665" CreationDate="2015-09-29T08:44:05.087" Score="1" ViewCount="120" Body="&lt;p&gt;As the title suggests, I would like my plugin to generate a new image transform automatically (with a few settings) when the plugin is installed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose is to avoid my plugin from crashing if a transform hasn't already been generated yet (or doesn't have the same handle names).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-09-29T16:24:29.507" Title="Is there a way to create a new image transform 'onAfterInstall()' of a plugin?" Tags="&lt;plugin-development&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11665" PostTypeId="2" ParentId="11664" CreationDate="2015-09-29T09:17:26.990" Score="3" Body="&lt;p&gt;Have a look at the method &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/AssetTransformsController.php#L77&quot; rel=&quot;nofollow&quot;&gt;actionSaveTransform&lt;/a&gt; in the &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/AssetTransformsController&quot; rel=&quot;nofollow&quot;&gt;AssetTransformsController&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code you actually need for your &lt;code&gt;onAfterInstall&lt;/code&gt; would be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Only create if it doesn't exist (by handle)&#xA;if (is_null(craft()-&amp;gt;assetTransforms-&amp;gt;getTransformByHandle($handle))) {&#xA;    $transform = new AssetTransformModel();&#xA;    $transform-&amp;gt;id = $transformId;&#xA;    $transform-&amp;gt;name = $name;&#xA;    $transform-&amp;gt;handle = $handle;&#xA;    $transform-&amp;gt;width = $width;&#xA;    $transform-&amp;gt;height = $height;&#xA;    $transform-&amp;gt;mode = $mode;&#xA;    $transform-&amp;gt;position = $position;&#xA;    $transform-&amp;gt;quality = $quality;&#xA;    $transform-&amp;gt;format = $format;&#xA;&#xA;    if(craft()-&amp;gt;assetTransforms-&amp;gt;saveTransform($transform)) {&#xA;        // Success&#xA;    }&#xA;    else {&#xA;        // Error&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1021" LastEditorUserId="57" LastEditDate="2015-09-29T16:24:29.507" LastActivityDate="2015-09-29T16:24:29.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11666" PostTypeId="1" AcceptedAnswerId="11676" CreationDate="2015-09-29T11:43:22.503" Score="2" ViewCount="507" Body="&lt;p&gt;Is there an elegant way to check if an image transform exists?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.imageTransformExists('thumb') %}&#xA;  &amp;lt;img src=&quot;{{asset.getUrl(thumb)}}&quot; alt=&quot;Image&quot;&amp;gt;&#xA;{% else %}&#xA;  This image transform doesn't exists, please create it&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-09-29T23:22:23.183" Title="How to check if an Image Transform exists?" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11667" PostTypeId="1" AcceptedAnswerId="11671" CreationDate="2015-09-29T13:11:20.463" Score="0" ViewCount="204" Body="&lt;p&gt;The question really says it all. Here's the autosave docs page: &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/autosave/&quot; rel=&quot;nofollow&quot;&gt;http://imperavi.com/redactor/docs/settings/autosave/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2015-09-29T17:52:15.070" Title="Can Craft's Rich Text fields be configured to use Redactor's autosave?" Tags="&lt;richtext&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11668" PostTypeId="1" AcceptedAnswerId="11669" CreationDate="2015-09-29T13:57:25.463" Score="3" ViewCount="52" Body="&lt;p&gt;I want to build a directory of fishing ports&#xA;It will have approx 500 entries, each geocoded for map display.&#xA;I will have 4 views;&#xA;1) Directory with map of entries&#xA;2) Country and entries&#xA;3) Cities (Ports) and entries&#xA;4) Port entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issues I have at this stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) how to structure countries,cities and fishing ports?&#xA;admin will struggle to find stuff to edit if they have to page thru 500 entries  when entries have similar names &quot;Stella maris centre&quot; exists in Netherlands and Australia, denmark etc.  How can an admin distinguish the correct entry to edit?&#xA;This assumes I am using categories for country and city storage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) I want the url structure to be &quot;directory/country/city/fishing-port-name&quot;&#xA;Assuming I can use custom routes with categories to create my urls, i run into the issue above in a)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So should i create entry types for countries and cities and use them in heirarchy so admin can enjoy ease of finding stuff?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Planning around this is becoming a head spinner :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-09-29T15:43:14.537" Title="How to plan IA for a directory of content thats good for admins and users" Tags="&lt;categories&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11669" PostTypeId="2" ParentId="11668" CreationDate="2015-09-29T15:43:14.537" Score="1" Body="&lt;p&gt;a) There are a definitely a few ways to handle this, but I would recommend the following. Put your Countries and Cities in a category group, nesting cities inside countries. Your Fishing Port section should be a Structure, since the entries are not time dependent like entries in a Channel. All you would need is a single category field that relates the fishing port to a city.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) This can be done with custom routes, as long as each Fishing Port entry is related to one city category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for organizing the entries in the admin, you can make use of the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot; rel=&quot;nofollow&quot;&gt;modify entry sortable attributes&lt;/a&gt; and the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow&quot;&gt;modify entry table attributes&lt;/a&gt; hooks, which allow you to add an attribute in the sort dropdown and add different columns to the entry view. With this, you can add a City and Country column to the structure listing.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-09-29T15:43:14.537" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11670" PostTypeId="2" ParentId="11666" CreationDate="2015-09-29T17:43:51.407" Score="3" Body="&lt;p&gt;Nothing native, but it could probably be pulled off with a custom &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But just to be clear, if a transform currently doesn't exist then Craft will automatically create it on that request, so the code you shared is pretty much already happening behind the scene.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-29T17:43:51.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11671" PostTypeId="2" ParentId="11667" CreationDate="2015-09-29T17:52:15.070" Score="1" Body="&lt;p&gt;I'm just thinking about what would need to happen in order for this to work.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft would have to expose Redactor's autosave configuration somehow - either via UI or a Redactor config file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You'd have to write a plugin and point the &lt;a href=&quot;http://imperavi.com/redactor/docs/settings/autosave/#setting-autosave&quot; rel=&quot;nofollow&quot;&gt;autosave configuration&lt;/a&gt; to an action on a controller in your plugin.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;That action would be responsible for persisting the RTE content as well as the entry and field it came from (since you can have multiple RTEs on a page) - likely the database.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All-in-all, not a very robust solution. It'd be much more likely that we implemented our own autosave solution that worked for all fields at the entry level, instead of just the RTE.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-29T17:52:15.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11672" PostTypeId="2" ParentId="11646" CreationDate="2015-09-29T18:33:15.070" Score="2" Body="&lt;p&gt;On your local installation if your check the &quot;Password Reset Required&quot; button for a user and you get a 500 Internal Server Error the next time that users logs in, there is about a 99% chance that email isn't configured/installed correctly on your server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can verify this by checking the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files for the underlying error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's email settings are managed under Settings-&gt;Email in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you tested on &lt;a href=&quot;http://demo.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://demo.buildwithcraft.com&lt;/a&gt; and saw the same behavior, that's because we specifically disabled all email functionality on the demo sites in order to prevent them from turning into SPAM relays.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-29T18:33:15.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11673" PostTypeId="1" AcceptedAnswerId="11674" CreationDate="2015-09-29T20:36:50.753" Score="3" ViewCount="154" Body="&lt;p&gt;If I set a Lightswitch field as required, does that require it to be On? Is that valid at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Context: I'm using a Lightswitch in User fields to capture &quot;I agree to the Terms &amp;amp; Conditions...&quot;, and building a front-end user registration form.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2015-09-29T21:44:04.433" Title="How does Craft regard a Lightswitch field when it's set to Required in the Fields layout?" Tags="&lt;user-profile&gt;&lt;lightswitch&gt;&lt;required&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11674" PostTypeId="2" ParentId="11673" CreationDate="2015-09-29T21:01:21.730" Score="6" Body="&lt;p&gt;Currently it has no affect on the Lightswitch field at all, which I think is the right call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you do have a valid use-case for either making a setting on the field that forced it to be &quot;on&quot; if required is set or maybe even a separate &quot;Require On&quot; field type all-together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, probably worth putting up on &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2015-09-29T21:44:04.433" LastActivityDate="2015-09-29T21:44:04.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11675" PostTypeId="2" ParentId="11419" CreationDate="2015-09-29T21:44:45.397" Score="2" Body="&lt;p&gt;If a MySQL connection drops in the middle of a request, then that will either cause a PHP fatal error (that will end the request entirely) or cause an exception to be thrown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the exception isn't handled, then the request will end as well.  If it is caught, it can be gracefully handled and the request can continue. The remaining part of the request might attempt a new database connection, but it will not attempt to re-execute the SQL on the previously dropped MySQL connection. It has moved on.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-09-29T21:44:45.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11676" PostTypeId="2" ParentId="11666" CreationDate="2015-09-29T23:22:23.183" Score="4" Body="&lt;p&gt;Like Brad says, you'd need to write a custom plugin – specifically, one that provides a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt; class exposing the AssetTransformsService's &lt;a href=&quot;https://buildwithcraft.com/classreference/services/AssetTransformsService#getTransformByHandle-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getTransformByHandle&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variable class could look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;&#xA;    public function imageTransformExists($handle)&#xA;    {&#xA;        // Returns null if transform doesn't exist&#xA;        return craft()-&amp;gt;assetTransforms-&amp;gt;getTransformByHandle($handle);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you'd be able to test for named image transforms in your templates like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.myPlugin.imageTransformExists('thumb') %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're not familiar with plugin development, it might be useful to use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic plugin&lt;/a&gt; as a starting point – it even has a Variable class which you could just drop the above &lt;code&gt;imageTransformExists&lt;/code&gt; method into.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-29T23:22:23.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11677" PostTypeId="2" ParentId="670" CreationDate="2015-09-30T05:28:47.677" Score="32" Body="&lt;p&gt;As of &lt;strong&gt;Craft 2.4&lt;/strong&gt;, it is now possible to use the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#enableTemplateCaching&quot;&gt;&lt;code&gt;enableTemplateCaching&lt;/code&gt;&lt;/a&gt; config value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'enableTemplateCaching' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simply add that to your local environment in &lt;code&gt;config/general.php&lt;/code&gt;, and it'll disable the &lt;code&gt;cache&lt;/code&gt; tags entirely.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-09-30T05:28:47.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11678" PostTypeId="1" CreationDate="2015-09-30T06:02:11.367" Score="0" ViewCount="84" Body="&lt;p&gt;We want the public uploads to remain in raw state. Is it possible to disable image cleansing for entries created through public facing form? (Image cleansing to continue working for uploads through Control Panel.)&lt;/p&gt;&#xA;" OwnerUserId="4138" LastEditorUserId="9" LastEditDate="2015-09-30T10:40:56.417" LastActivityDate="2015-09-30T10:40:56.417" Title="Disable image cleansing for public facing form uploads" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11679" PostTypeId="2" ParentId="11678" CreationDate="2015-09-30T06:10:17.183" Score="0" Body="&lt;p&gt;I can think of a few ways to go about this and probably the easiest one is to do something like this completely untested code from your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'imageDriver' =&amp;gt; strpos($_SERVER['REQUEST_URI'], 'admin') !== false ? 'imagick' : 'gd',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you'd change 'admin' to whatever your &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;cpTrigger&lt;/a&gt; config setting is set to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also be extremely curious to know what the reasoning for this was, too. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you wanted to do this from a Craft plugin, then you could add an &lt;code&gt;init()&lt;/code&gt; method to your base plugin file and do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;    {&#xA;        craft()-&amp;gt;config-&amp;gt;set('imageDriver', 'imagick');&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;config-&amp;gt;set('imageDriver', 'gd');&#xA;    }&#xA;&#xA;    parent::init();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-09-30T06:33:27.817" LastActivityDate="2015-09-30T06:33:27.817" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11681" PostTypeId="2" ParentId="11678" CreationDate="2015-09-30T10:38:31.473" Score="1" Body="&lt;p&gt;The imageDriver setting just determines &lt;em&gt;which&lt;/em&gt; driver Craft should use when working with images (GD or ImageMagick) for things like image cleansing and image transforms. So changing its value will not affect whether images are cleansed on upload; just which driver would be used for that process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to &lt;em&gt;disable&lt;/em&gt; image cleansing on the front end, you will need to write a plugin that handles the upload. You can find out how to do that from this answer: &lt;a href=&quot;https://craftcms.stackexchange.com/a/9675/9&quot;&gt;https://craftcms.stackexchange.com/a/9675/9&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-09-30T10:38:31.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11682" PostTypeId="1" CreationDate="2015-09-30T11:07:37.470" Score="3" ViewCount="737" Body="&lt;p&gt;I'm trying to exclude a list of ids from a query using an ElementCriteriaModel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far, but it's resulting in nothing coming back when I'm expecting at least 1 result. Is something wrong with my syntax or is my method way off?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;id = 'and';&#xA;for ($i = 0; $i &amp;lt; count($idList); ++$i)&#xA;    $criteria-&amp;gt;id .= ', not' . $idList[$i];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, I've tried removing the &lt;code&gt;$criteria-&amp;gt;id = 'and';&lt;/code&gt; to no avail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A nudge in the right direction would be much appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-10-15T08:15:05.603" Title="ElementCriteriaModel exclude list of ids" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11683" PostTypeId="1" AcceptedAnswerId="11692" CreationDate="2015-09-30T12:26:47.623" Score="0" ViewCount="230" Body="&lt;p&gt;We're having a bit of a problem with the unique URL system in Craft. An entry was deleted, and a new one has been created to replace it. However the new entry should have the same URL as the old removed one, but Craft is insisting on appending -2, -3, etc to the entry URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug? There is currently no way to recover a deleted page in the CMS, and I can't find a way to purge previously deleted entry URLs without editing the database directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone got any idea? Is this a bug, or is there a solution? Obviously when handed over to a client I can't ask them to just pop into MySQL and remove old entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Ian&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-09-30T21:08:03.697" Title="Deleted page URLs" Tags="&lt;entries&gt;&lt;url&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11684" PostTypeId="2" ParentId="11473" CreationDate="2015-09-30T13:35:05.920" Score="1" Body="&lt;p&gt;Just needed something similar today, and patched in a new replace filter to the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;RetconHTML plugin&lt;/a&gt;. The filter – called &lt;code&gt;retconReplace&lt;/code&gt; – uses &lt;code&gt;preg_replace&lt;/code&gt; and might be able to help you out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ string|retconReplace('/\s*$/m') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll find the wiki on &lt;code&gt;retconReplace&lt;/code&gt; &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Replace&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-09-30T13:35:05.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11685" PostTypeId="1" CreationDate="2015-09-30T14:49:55.673" Score="3" ViewCount="1271" Body="&lt;p&gt;We have a table field that has the default value of 1 row when a new entry is published.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, we have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.tableField | length %} display markup and field content... {% endif %}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this will always be true of each entry because of the Craft default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, we can remove the default row in the future but wondered if there was a way to extend that condition to say, for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if (entry.tableField | length) and (entry.tableField.row | length) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="9" LastEditDate="2015-10-01T22:14:53.453" LastActivityDate="2020-06-09T20:41:52.063" Title="Check if a table field’s row has a value" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;table-field&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11686" PostTypeId="1" CreationDate="2015-09-30T15:25:10.027" Score="1" ViewCount="1702" Body="&lt;p&gt;I was wondering if it's possible to modify the status of an Entry within a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting the &lt;code&gt;status&lt;/code&gt; property but I get a readonly error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;status = $status&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2016-10-12T21:17:37.313" Title="Set status in a plugin" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;status&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11687" PostTypeId="1" AcceptedAnswerId="11708" CreationDate="2015-09-30T16:49:46.350" Score="5" ViewCount="2540" Body="&lt;p&gt;I'm outputting prices in a channel with a little formatting like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;pound;{{ entry.priceFrom|number_format(2,'.',',') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gives me £1,000.00 or £99.99 etc... However client isn't a fan of the double zeros (e.g. £100.00) and would prefer such prices to show up as £100 – only showing decimal numbers if they're not &quot;00&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was working on some kind of preprocessing/condition here but it seems long-winded, and wondered if anyone has a neat solution?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-04-02T12:50:39.000" Title="Price Formatting" Tags="&lt;format&gt;&lt;number&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11688" PostTypeId="2" ParentId="11687" CreationDate="2015-09-30T17:11:14.247" Score="1" Body="&lt;p&gt;Well I've got this working with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set decimal = entry.priceFrom|reverse|slice(1,2) %}&#xA;&#xA;{% if decimal == &quot;0&quot; %}{{ entry.priceFrom|number_format(0,'.',',') }}{% else %}{{ entry.priceFrom|number_format(2,'.',',') }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically I'm reversing the string so I can check for a zero at the end (or not). It's fairly clean, but if anyone can improve on it I'd love to hear.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2015-09-30T17:11:14.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11689" PostTypeId="1" AcceptedAnswerId="11690" CreationDate="2015-09-30T17:53:47.047" Score="2" ViewCount="81" Body="&lt;p&gt;I am trying to return an array of selected entries in the list view, but so far I can only get &lt;code&gt;first()&lt;/code&gt; and &lt;code&gt;last()&lt;/code&gt; to export the names, since it's only grabbing one entry. I would like to get a comma separated list of entries tied the that specific entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using &lt;code&gt;find()&lt;/code&gt; and &lt;code&gt;find()-&amp;gt;title&lt;/code&gt; but it gives me an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have right now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function getEntryTableAttributeHtml(EntryModel $entry, $attribute){&#xA;     if ($attribute == 'sponsorEntries'){&#xA;      return '&amp;lt;span&amp;gt;'.$entry-&amp;gt;sponsorEntries-&amp;gt;first().'&amp;lt;/span&amp;gt;';&#xA;     }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then I call it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        // Artists&#xA;     public function modifyEntryTableAttributes(&amp;amp;$attributes, $source){&#xA;      if ($source == 'section:9'){&#xA;        $attributes['sponsorEntries'] = Craft::t('Sponsor');&#xA;      }&#xA;     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I would like to get return all the entries, not just the first() one like the screenshot below illustrates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iUGqp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iUGqp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3652" LastEditorUserId="3652" LastEditDate="2015-09-30T18:26:38.747" LastActivityDate="2015-09-30T21:29:48.043" Title="Export Array of entries in modifyEntryTableAttributes" Tags="&lt;entries&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11690" PostTypeId="2" ParentId="11689" CreationDate="2015-09-30T19:21:47.020" Score="3" Body="&lt;p&gt;You'll need to use the &lt;code&gt;find&lt;/code&gt; method rather than &lt;code&gt;first&lt;/code&gt; and &lt;code&gt;last&lt;/code&gt;, in order to pull all the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you'll have to &lt;em&gt;loop through the entries&lt;/em&gt;, appending their titles to a variable which will be used for the attribute's HTML value in the list view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, I'm pushing the entry titles to an array called &lt;code&gt;$tempArray&lt;/code&gt;. After looping, the array is joined and returned as a comma separated list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'sponsorEntries')&#xA;    {&#xA;        if ($sponsorEntries = @$entry-&amp;gt;$attribute-&amp;gt;find())&#xA;        {&#xA;            $tempArray = [];&#xA;            foreach ($sponsorEntries as $sponsorEntry)&#xA;            {&#xA;                $tempArray[] = $sponsorEntry-&amp;gt;title;&#xA;            }&#xA;            // Will return &quot;Awesome Entry, Another Awesome Entry&quot;&#xA;            return implode(', ', $tempArray);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to, you can also make the entry titles in the list view clickable – i.e., to make it easy for your content editor to edit those entries – by wrapping the titles in anchor tags and pulling the entries' &lt;code&gt;cpEditUrl&lt;/code&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($sponsorEntries = @$entry-&amp;gt;$attribute-&amp;gt;find())&#xA;{&#xA;    $tempArray = [];&#xA;    foreach ($sponsorEntries as $sponsorEntry)&#xA;    {&#xA;        $tempArray[] = '&amp;lt;a href=&quot;' . $sponsorEntry-&amp;gt;cpEditUrl . '&quot;&amp;gt;' . $sponsorEntry-&amp;gt;title . '&amp;lt;/a&amp;gt;';&#xA;    }&#xA;    return implode(', ', $tempArray);&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or if you prefer, you can make the links point to the entries on the frontend, by using &lt;code&gt;$sponsorEntry-&amp;gt;url&lt;/code&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tempArray[] = '&amp;lt;a href=&quot;' . $sponsorEntry-&amp;gt;url . '&quot; target=&quot;_blank&quot;&amp;gt;' . $sponsorEntry-&amp;gt;title . '&amp;lt;/a&amp;gt;';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-09-30T21:29:48.043" LastActivityDate="2015-09-30T21:29:48.043" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="11691" PostTypeId="2" ParentId="11687" CreationDate="2015-09-30T20:07:09.123" Score="3" Body="&lt;p&gt;How about something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;pound;{{ 1000.00 | number_format(2,'.',',') | replace({&quot;.00&quot; : &quot;&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;£1,000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Got a similar idea from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/566/how-would-i-omit-zero-value-decimals-in-a-number-format&quot;&gt;How would I omit zero value decimals in a number format?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="508" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-09-30T20:07:09.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11692" PostTypeId="2" ParentId="11683" CreationDate="2015-09-30T20:44:43.230" Score="2" Body="&lt;p&gt;As it turned out, database tables on this Craft project were missing foreign key constraints, and since Craft relies on the CASCADING DELETE/UPDATE functionality of these foreign keys, it was not deleting all associated rows across tables for a deleted entry. This can happen when migrating a database backup to a server that only supports MyISAM and not InnoDB because MyISAM will silently drop the foreign key constraints. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this happens, you can use the &lt;a href=&quot;https://github.com/pixelandtonic/craft-fixfks&quot; rel=&quot;nofollow&quot;&gt;Craft Foreign Key Restoration Tool&lt;/a&gt; to try and restore the missing foreign keys.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="57" LastEditDate="2015-09-30T21:08:03.697" LastActivityDate="2015-09-30T21:08:03.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11693" PostTypeId="2" ParentId="11686" CreationDate="2015-09-30T21:47:39.697" Score="5" Body="&lt;p&gt;Not directly, but you can indirectly change it. An entry's status is defined by several attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An entry is considered &quot;live&quot; if it is enabled (both on a per-locale and global basis), it has a post date in the past and an expiration date that doesn't exist or hasn't been met yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the entry is enabled and the post date is greater than the current date, then the entry's status is &quot;pending&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is enabled and the current date is past the expiration date, then it has a status of &quot;expired&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an entry is not enabled at all, it has a status of &quot;disabled&quot;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-10-12T21:17:37.313" LastActivityDate="2016-10-12T21:17:37.313" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11694" PostTypeId="2" ParentId="120" CreationDate="2015-10-01T03:48:50.180" Score="12" Body="&lt;p&gt;Here is how I did it on a recent project:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Create a temporary WP site to work in:&lt;/strong&gt; I installed WP locally, imported the database, and downloaded the &lt;code&gt;wp-content/uploads&lt;/code&gt; folder. You don't need the theme or any plugins (unless they affect the content output). In the Reading section of the WordPress settings, change &quot;blog pages show at most&quot; to a number higher than the number of posts in the system. You could also do this in a hidden template on the live site if you like to live on the edge. I was actually importing from a WordPress.com site, so I first had to export from that and then import into a self-hosted site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Migrate comments to Disqus:&lt;/strong&gt; Create a new site in Disqus and install the Disqus plugin in your local WP installation. Let it run its import process to move all your existing comments into their system. Now the comments are their responsibility, and you only have to worry about the posts.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Export the posts to a CSV:&lt;/strong&gt; Paste the code below into the index.php file of WP's default twentyfifteen theme. Now when you visit the homepage of the temporary site, it will output a CSV file instead of HTML. Press cmd/alt-s to save it to a file. You may need to tweak the code a bit depending on your needs, but this should get you close. The interesting part is lines 20-23, where we apply the &lt;code&gt;the_content&lt;/code&gt; filter (which replaces WP's short-tags), fix some character encoding issues, and replace image URLs with their corresponding URLs on the new site. I also set a &quot;fullWidth&quot; transformation on all the images, which I created in my Craft site to limit the images to the width of the page. See below for more on that. Save that resulting CSV file somewhere.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;ob_start();&#xA;$df = fopen(&quot;php://output&quot;, 'w');&#xA;fputcsv($df, array(&#xA;    'Title',&#xA;    'Slug',&#xA;    'Date',&#xA;    'Author',&#xA;    'Category',&#xA;    'Tags',&#xA;    'Body'&#xA;));&#xA;&#xA;global $more;&#xA;if ( have_posts() ) :&#xA;    while ( have_posts() ) : the_post();&#xA;&#xA;        $more = 1;&#xA;        $content = apply_filters( 'the_content', get_the_content() );&#xA;        $content = str_replace( ']]&amp;gt;', ']]&amp;amp;gt;', $content );&#xA;        $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');&#xA;        $content = preg_replace('#http://cmnh-blog.dev/wp-content/uploads/\d{4}/\d{2}/(.+?)\.(jpg|jpeg|png|gif)#', 'http://childrens-museum.s3-us-west-2.amazonaws.com/blog/_fullWidth/$1.$2', $content);&#xA;        $content = preg_replace('#https://childrensmuseumnh.files.wordpress.com/wp-content/uploads/\d{4}/\d{2}/(.+?)\.(jpg|jpeg|png|gif)#', 'http://childrens-museum.s3-us-west-2.amazonaws.com/blog/_fullWidth/$1.$2', $content);&#xA;        $cats = implode(', ', wp_get_post_categories( $post-&amp;gt;ID, array( 'fields' =&amp;gt; 'names' ) ));&#xA;        $tags = implode(', ', wp_get_post_tags( $post-&amp;gt;ID, array( 'fields' =&amp;gt; 'names' ) ));&#xA;&#xA;        $row = array(&#xA;            html_entity_decode(get_the_title(), ENT_QUOTES | ENT_HTML5, 'UTF-8'),&#xA;            $post-&amp;gt;post_name,&#xA;            get_the_date('c'),&#xA;            get_the_author_meta('user_login'),&#xA;            $cats,&#xA;            $tags,&#xA;            $content,&#xA;        );&#xA;        fputcsv($df, $row);&#xA;&#xA;    endwhile;&#xA;endif;&#xA;&#xA;fclose($df);&#xA;echo ob_get_clean();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Create user accounts:&lt;/strong&gt; If you set up user accounts before importing the posts, the authorship will be maintained. Just make sure to use the same email address for each person as in the old site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Import the content:&lt;/strong&gt; I used &lt;a href=&quot;https://github.com/boboldehampsink/import&quot;&gt;Import&lt;/a&gt; for this, although &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot;&gt;FeedMe&lt;/a&gt; might actually work better, as it will create Categories for you on the fly. &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reconnect the comments:&lt;/strong&gt; If you are keeping the same URL structure, you can just use Disqus's &lt;a href=&quot;https://help.disqus.com/customer/en/portal/articles/912627-domain-migration-wizard&quot;&gt;Domain Migration Tool&lt;/a&gt; to update their records from the temporary WordPress site to your live domain. If you are changing the URL structure as well, you'll need to use &lt;a href=&quot;https://help.disqus.com/customer/portal/articles/912757-url-mapper&quot;&gt;URL Mapper&lt;/a&gt; and somehow generate a CSV of corresponding old and new URLs for each post. Now you can add the Disqus embed code to your post template and the comments &lt;em&gt;should&lt;/em&gt; appear.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Generate image transforms:&lt;/strong&gt; Remember how we set a transform on the images in the posts? Craft won't automatically generate those. So create the asset source and copy all the images in from your WP site. Now reindex the asset source in Craft and make sure you can see all the files in the Assets tab. Finally, create a new template with the following code. Open it in the browser and wait for all the images to appear. If you have more than 200 images, you will need to set the offset to &lt;code&gt;200&lt;/code&gt; and run it again, and so on until all the transforms have been generated.&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets.source('blogImages').limit(500).offset(0) %}&#xA;{% for image in images %}&#xA;    &amp;lt;img src=&quot;{{ image.url('fullWidth') }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Check for broken styling:&lt;/strong&gt; You will need to include &lt;a href=&quot;https://codex.wordpress.org/CSS#WordPress_Generated_Classes&quot;&gt;WordPress's default classes&lt;/a&gt; in your new stylesheet, or you will lose image alignment and such. If there were any other markup patterns in the WP site that were generated by plugins, you will also need to accommodate those. If necessary, you can also add additional &lt;code&gt;preg_replace&lt;/code&gt; lines to the export script to manipulate the markup as needed.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="62" LastEditorUserId="62" LastEditDate="2015-10-01T22:16:38.703" LastActivityDate="2015-10-01T22:16:38.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11695" PostTypeId="1" AcceptedAnswerId="11699" CreationDate="2015-10-01T07:31:55.743" Score="0" ViewCount="542" Body="&lt;p&gt;I have image transforms set up and working well for my site, however I have an issue that seems to be a possible feature request because it is not documented or on this Stack Exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user uploads an image that is smaller than the image transform setting, it scales the image up for them to the specified size. However this results in a pixellated image because of the upscale. What I would like to be able to do is only scale down images to the respective transform values, but if smaller, then keep their size, thus avoiding the pixellation and extra unnecessary file size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips?&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-10-01T14:22:35.243" Title="Image Transforms - disable scaling up" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2015-10-01T14:23:18.837" ContentLicense="CC BY-SA 3.0" />
  <row Id="11696" PostTypeId="1" AcceptedAnswerId="11714" CreationDate="2015-10-01T10:49:36.960" Score="1" ViewCount="1231" Body="&lt;p&gt;I'm in the process of developing a custom login for a website. Users will not be &lt;em&gt;website&lt;/em&gt; &lt;em&gt;users&lt;/em&gt; with logins, but rather will be authenticated via an email and a custom token. The process should be as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User arrives at protected page and must enter an email address ending&#xA;with @acme.com&lt;/li&gt;&#xA;&lt;li&gt;If user's email address ends with @acme.com, then generate&#xA;a token and send them and email with link including the token.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am trying to figure out the best way to do this in craft. My initial plan was to create a separate php script which handled the email send and token generation via AJAX, but I figured it's not best practice because it is outwith the CMS, so I should maybe develop this as a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wondered if any of you could make some suggestions or perhaps if you'd experience such a process before might shed some light on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4149" LastActivityDate="2015-10-02T00:47:51.670" Title="Custom Authentication" Tags="&lt;plugin-development&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11697" PostTypeId="1" AcceptedAnswerId="11698" CreationDate="2015-10-01T11:08:27.437" Score="3" ViewCount="332" Body="&lt;p&gt;Super simple problem. I'm on a news item page (not a paginated overview page) and want to show a link to the next news item in the Channel; So I can't understand why this is outputting nothing at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.section('news').nextSiblingOf(entry).title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get either of the SiblingOf properties to do anything. What simple mistake am I making?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I have also tried the following to no avail...)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.section('news').nextSiblingOf(entry).first().title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-10-01T11:50:56.450" Title="Using prevSiblingOf and nextSiblingOf" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11698" PostTypeId="2" ParentId="11697" CreationDate="2015-10-01T11:44:41.863" Score="4" Body="&lt;p&gt;Those parameters are only meant to be used on entries within Structure sections. (Just updated the docs to make that more clear.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get the next/previous entries within a Channel section, you can use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow&quot;&gt;EntryModel::getNext()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow&quot;&gt;getPrev()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s a bit of a trick with those functions though, because “next” and “previous” are ambiguous. (Only consider the entries in a specific channel? Or just the ones with a specific custom field value? etc.) So you need to pass element criteria params into those functions to establish what the full order of entries is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, sounds like you want the next/previous entries within your &lt;code&gt;news&lt;/code&gt; section. I’ll assume you want those entries to be listed by Post Date in descending order (so the latest stories are shown first), and the “Next” entry in this case would be whatever story came before the current one; and the “Previous” story would be whatever came later. (If my assumption is wrong, just change &lt;code&gt;desc&lt;/code&gt; to &lt;code&gt;asc&lt;/code&gt; in the &lt;code&gt;order&lt;/code&gt; param.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsCriteria = craft.entries.section('news').order('postDate desc') %}&#xA;{% set prevEntry = entry.getPrev(newsCriteria) %}&#xA;{% set nextEntry = entry.getNext(newsCriteria) %}&#xA;&#xA;{% if prevEntry %}&#xA;  &amp;lt;a href=&quot;{{ prevEntry.url }}&quot; class=&quot;prev&quot;&amp;gt;{{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextEntry %}&#xA;  &amp;lt;a href=&quot;{{ nextEntry.url }}&quot; class=&quot;next&quot;&amp;gt;{{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-01T11:50:56.450" LastActivityDate="2015-10-01T11:50:56.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11699" PostTypeId="2" ParentId="11695" CreationDate="2015-10-01T14:22:35.243" Score="2" Body="&lt;p&gt;Seems like the only option at the moment is to follow this post's technique:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1436/prevent-asset-transforms-from-scaling-image-past-100&quot;&gt;Prevent Asset Transforms from scaling Image past 100%&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully it will be implemented in the CP in the future... according to this feature request:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plus.google.com/110881688132908256910/posts/FAzrGAJ99W7&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plus.google.com/110881688132908256910/posts/FAzrGAJ99W7&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-10-01T14:22:35.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11700" PostTypeId="1" AcceptedAnswerId="11702" CreationDate="2015-10-01T17:17:37.410" Score="2" ViewCount="84" Body="&lt;p&gt;How do I create an entries loop that will pull content even if the entry in the loop is not set to Live?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g., I have a Matrix so a user can select entries to feature in a slider. They want the slider to feature entries even if the entry itself is currently hidden/unpublished.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for caseStudy in entry.featuredCaseStudies %}&#xA;    &amp;lt;div class=&quot;slide&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;            {% if caseStudy.status == 'live' %}&amp;lt;a href=&quot;{{ caseStudy.url }}&quot;&amp;gt;{% endif %}&#xA;                &amp;lt;img src=&quot;{{ caseStudy.caseStudy.first().clientLogo.first().getUrl('caseStudyTumbnail') }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;            {% if caseStudy.status == 'live' %}&amp;lt;/a&amp;gt;{% endif %}&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- .text --&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- .slide --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works only in as much as the anchor is only output if the linked entry is live. But I can't get it to spit out the image; presumably because the entry isn't live.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="9" LastEditDate="2015-10-01T18:58:28.547" LastActivityDate="2015-10-01T18:58:28.547" Title="Entries loop that doesn’t take the status into account?" Tags="&lt;matrix&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11701" PostTypeId="1" AcceptedAnswerId="11709" CreationDate="2015-10-01T18:24:11.073" Score="2" ViewCount="273" Body="&lt;p&gt;In a custom plugin, I would like to use Craft's ability to register email message keys in order to keep emails consistent, and I would like to be able to send these emails to users as well as non-users. My understanding is that I would need to use the sendEmailByKey method of the EmailService to send emails using registered keys, which is defined like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sendEmailByKey(UserModel $user, $key, $variables = array())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method only accepts a UserModel for the recipient, so it doesn't look like there's a way to send an email by key to an arbitrary email address. Is there a different way to send these registered emails to non-users?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="9" LastEditDate="2015-10-02T15:03:20.050" LastActivityDate="2015-10-02T15:03:20.050" Title="Sending email by key to non-user" Tags="&lt;emails&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11702" PostTypeId="2" ParentId="11700" CreationDate="2015-10-01T18:57:41.703" Score="2" Body="&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for caseStudy in entry.featuredCaseStudies %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for caseStudy in entry.featuredCaseStudies.status(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If “featuredCaseStudies” is an Entries field, then typing &lt;code&gt;entry.featuredCaseStudies&lt;/code&gt; will give you an &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; object, configured to return all of the entries related to &lt;code&gt;entry&lt;/code&gt; via that “featuredCaseStudies” field (using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#relatedTo&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; param). Just like the ElementCriteriaModel object you get when typing &lt;code&gt;craft.entries&lt;/code&gt;, you’re free to chain in additional parameters after &lt;code&gt;entry.featuredCaseStudies&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, entry-targetting ElementCriteriaModel objects will only return “live” entries – entries that are enabled, and whose Post Date is in the past, and whose Expiry Date is either not set or set in the future. You can alter that behavior using entries’ &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#status&quot; rel=&quot;nofollow&quot;&gt;status&lt;/a&gt; criteria param. Setting it to &lt;code&gt;null&lt;/code&gt; tells Craft to not factor entries’ statuses into the query whatsoever, which is what you’re looking for here.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T18:57:41.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11703" PostTypeId="1" AcceptedAnswerId="11710" CreationDate="2015-10-01T19:12:25.110" Score="6" ViewCount="3552" Body="&lt;p&gt;I'm having an exceedingly difficult time trying to retrieve the Site URL and Name in a custom plugin I am developing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My research has led me to believe this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$envVar = craft()-&amp;gt;config-&amp;gt;get('environmentVariables');&#xA;$siteUrl = $envVar['siteUrl'];&#xA;$siteName = $envVar['siteName'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in practice this hasn't worked. Does anyone know the correct way?&lt;/p&gt;&#xA;" OwnerUserId="4143" LastActivityDate="2020-12-07T06:13:03.867" Title="How to retrieve Site Url and Site Name in Plugin" Tags="&lt;plugin-development&gt;&lt;globals&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11704" PostTypeId="2" ParentId="11703" CreationDate="2015-10-01T19:46:51.830" Score="1" Body="&lt;p&gt;What you've done should work fine for actual &lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow&quot;&gt;environment variables&lt;/a&gt;, but both &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteName&quot; rel=&quot;nofollow&quot;&gt;siteName&lt;/a&gt; are proper &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;config settings&lt;/a&gt; that you can access via &lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('siteUrl')&lt;/code&gt; and &lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('siteName')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-02T00:38:24.243" LastActivityDate="2015-10-02T00:38:24.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11705" PostTypeId="1" CreationDate="2015-10-01T21:34:46.083" Score="3" ViewCount="527" Body="&lt;p&gt;I have a category Australia and have been experimenting with boboldehampsink import plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After deleting categories and starting over the category Australia now has a slug called 'australia-6'. I just want 'australia' but i cant get rid of the  hypen and 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice the content table has lots of entries for australia but no slugs so I'm wondering about the db schema for craftcms and how come i have got a stuck slug so quickly?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="9" LastEditDate="2015-10-01T22:06:46.437" LastActivityDate="2015-10-01T22:06:46.437" Title="Category slug is getting numbers appended to it" Tags="&lt;categories&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11706" PostTypeId="2" ParentId="11705" CreationDate="2015-10-01T22:06:10.550" Score="2" Body="&lt;p&gt;When you save an entry/category that is supposed to have its own URL, Craft will assign it a unique URI, based on the section/category group’s URL Format setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let’s say you have a section called News, and its “Entries in this section have their own URLs” checkbox is checked, and it has this URL Format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you save a News entry, Craft will assign it a unique URI based on that URL Format. If the entry’s slug is “foo”, then the first URI Craft will try to assign it will be “news/foo”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if that URI is already taken by another entry/category (or some third party element type), Craft will increment the slug and try again:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;news/foo-1&lt;/li&gt;&#xA;&lt;li&gt;news/foo-2&lt;/li&gt;&#xA;&lt;li&gt;news/foo-3&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(If incrementing the slug has no effect on the URI – because the URL Format doesn’t actually contain a &lt;code&gt;{slug}&lt;/code&gt; token – then Craft will simply give up and add a validation error to the element.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once it has found a URI that is actually unique, it will update the element’s Slug with the incremented version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, when you save a category with the slug “australia” and it becomes “australia-6“, that means that you have 6 other elements that had been saved with the slug “australia” before it, with the same URL Format that your current category has, and so “australia-6” was just the first slug Craft could find that resulted in your category having a unique URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find out which elements your category’s URI is conflicting with, you can go to Entries &gt; All Entries, and search for &lt;code&gt;slug:australia&lt;/code&gt;, and click through each of your category groups in the Categories tab, searching for &lt;code&gt;slug:australia&lt;/code&gt; in each of them.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T22:06:10.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11707" PostTypeId="2" ParentId="11685" CreationDate="2015-10-01T22:14:20.013" Score="2" Body="&lt;p&gt;You can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.tableField|length and (&#xA;      entry.tableField[0].columnHandleOne or&#xA;      entry.tableField[0].columnHandleTwo or&#xA;      entry.tableField[0].columnHandleThree&#xA;   ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there’s only one column that you really care about being filled, you can simplify that to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.tableField|length and entry.tableField[0].columnHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T22:14:20.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11708" PostTypeId="2" ParentId="11687" CreationDate="2015-10-01T22:21:38.453" Score="12" Body="&lt;p&gt;Craft comes with a &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#currency&quot;&gt;currency&lt;/a&gt; filter that makes this pretty easy – you don’t even need the &lt;code&gt;&amp;amp;pound;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.priceFrom|currency('GBP', true) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;'GBP'&lt;/code&gt; establishes the currency (so the price is prefixed with &lt;code&gt;£&lt;/code&gt;), and passing &lt;code&gt;true&lt;/code&gt; to the second argument tells Craft to strip out the cents from the formatted string if there aren’t any (so &lt;code&gt;£100&lt;/code&gt; instead of &lt;code&gt;£100.00&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T22:21:38.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11709" PostTypeId="2" ParentId="11701" CreationDate="2015-10-01T22:38:45.483" Score="4" Body="&lt;p&gt;Just because &lt;a href=&quot;http://buildwithcraft.com/classreference/services/EmailService#sendEmailByKey-detail&quot; rel=&quot;nofollow&quot;&gt;EmailService::sendEmailByKey()&lt;/a&gt; requires you to pass in a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt;, doesn’t mean that the model has to represent an actual saved user. You can create one on the spot for them:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;email = 'sergster@abc.xyz';&#xA;$user-&amp;gt;firstName = 'John'; // optional&#xA;$user-&amp;gt;lastName = 'Doe'; // optional&#xA;&#xA;craft()-&amp;gt;email-&amp;gt;sendEmailByKey($user, 'my_key', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T22:38:45.483" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11710" PostTypeId="2" ParentId="11703" CreationDate="2015-10-01T22:40:42.180" Score="6" Body="&lt;p&gt;You can get them via &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/behaviors/AppBehavior#getSiteUrl-detail&quot; rel=&quot;noreferrer&quot;&gt;craft()-&gt;getSiteUrl()&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/behaviors/AppBehavior#getSiteName-detail&quot; rel=&quot;noreferrer&quot;&gt;craft()-&gt;getSiteName()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-01T22:40:42.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11711" PostTypeId="1" CreationDate="2015-10-01T22:42:58.933" Score="1" ViewCount="443" Body="&lt;p&gt;Alright, I know the question is kind of a doozy but I'm running out of options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've uploaded my Craft install to the subdirectory &lt;code&gt;website.com/travel&lt;/code&gt; and left in the base &lt;code&gt;web.config&lt;/code&gt; that comes with Craft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&#xA;&amp;lt;configuration&amp;gt;&#xA;    &amp;lt;system.webServer&amp;gt;&#xA;         &amp;lt;rewrite&amp;gt;&#xA;             &amp;lt;rules&amp;gt;&#xA;                &amp;lt;rule name=&quot;Rewrite&quot; stopProcessing=&quot;true&quot;&amp;gt;&#xA;                    &amp;lt;match url=&quot;(.+)&quot; ignoreCase=&quot;false&quot; /&amp;gt;&#xA;                    &amp;lt;conditions logicalGrouping=&quot;MatchAll&quot;&amp;gt;&#xA;                        &amp;lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; ignoreCase=&quot;false&quot; negate=&quot;true&quot; /&amp;gt;&#xA;                        &amp;lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsDirectory&quot; ignoreCase=&quot;false&quot; negate=&quot;true&quot; /&amp;gt;&#xA;                        &amp;lt;add input=&quot;{URL}&quot; pattern=&quot;^/(favicon\.ico|apple-touch-icon.*\.png)$&quot; negate=&quot;true&quot; /&amp;gt;&#xA;                    &amp;lt;/conditions&amp;gt;&#xA;                    &amp;lt;action type=&quot;Rewrite&quot; url=&quot;index.php?p={R:1}&quot; appendQueryString=&quot;true&quot; /&amp;gt;&#xA;                &amp;lt;/rule&amp;gt;&#xA;             &amp;lt;/rules&amp;gt;&#xA;         &amp;lt;/rewrite&amp;gt;&#xA;        &amp;lt;urlCompression doStaticCompression=&quot;true&quot; doDynamicCompression=&quot;true&quot; /&amp;gt;&#xA;        &amp;lt;defaultDocument&amp;gt;&#xA;            &amp;lt;files&amp;gt;&#xA;                &amp;lt;clear /&amp;gt;&#xA;                &amp;lt;add value=&quot;index.php&quot; /&amp;gt;&#xA;                &amp;lt;add value=&quot;index.htm&quot; /&amp;gt;&#xA;                &amp;lt;add value=&quot;index.html&quot; /&amp;gt;&#xA;            &amp;lt;/files&amp;gt;&#xA;        &amp;lt;/defaultDocument&amp;gt;&#xA;    &amp;lt;/system.webServer&amp;gt;&#xA;&amp;lt;/configuration&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also moved the &lt;code&gt;Craft/&lt;/code&gt; directory right next to &lt;code&gt;travel/&lt;/code&gt;'s &lt;code&gt;index.php&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visiting &lt;code&gt;website.com/travel/about&lt;/code&gt; takes me to Wordpress' &lt;code&gt;404&lt;/code&gt;, however &lt;code&gt;website.com/travel/index.php/about&lt;/code&gt; takes me to the correct page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, visiting the cp at &lt;code&gt;website.com/travel/index.php/admin&lt;/code&gt; removes &lt;code&gt;index.php&lt;/code&gt; from the url (but still gives me a Wordpress &lt;code&gt;404&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried &lt;code&gt;/index.php/&lt;/code&gt; and &lt;code&gt;/index.php?p=&lt;/code&gt; but both results are the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very well-versed in IIS or web.config settings, so I've just been trying things randomly to no avail. Is there something I am missing?&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2015-10-01T22:42:58.933" Title="Hosting a Craft install in a subfolder of a Wordpress site on Windows IIS" Tags="&lt;windows&gt;&lt;subfolder&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11712" PostTypeId="2" ParentId="11421" CreationDate="2015-10-01T23:51:02.043" Score="2" Body="&lt;p&gt;So I took another approach to my problem and ended up creating a plugin variable allowing me to set data inside a macro and have it accessible in the template. It's not complicated and does the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;  /**&#xA;   * Store data for use within both&#xA;   * templates and macros. Easy way around&#xA;   * macros having their own context&#xA;   * @var [Array]&#xA;   */&#xA;  private static $store = [];&#xA;&#xA;  /**&#xA;   * Set data in storage array&#xA;   * @param [String] $key&#xA;   * @param $value&#xA;   */&#xA;  public function set($key, $value) {&#xA;    self::$store[$key] = $value;&#xA;  }&#xA;&#xA;  /**&#xA;   * Retrieve data from storage array&#xA;   * @param  [String] $key&#xA;   */&#xA;  public function get($key) {&#xA;    return self::$store[$key];&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To set data you simply call &lt;code&gt;{% do craft.MyPlugin.set('myVar', true) %}&lt;/code&gt; and to retrieve it &lt;code&gt;{% set myVar = craft.MyPlugin.get('myVar') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2015-10-23T03:27:19.173" LastActivityDate="2015-10-23T03:27:19.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11714" PostTypeId="2" ParentId="11696" CreationDate="2015-10-02T00:47:51.670" Score="2" Body="&lt;p&gt;Seems totally doable with a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The protected page where they enter their email address would post to a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;action&lt;/a&gt; in your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your controller checks the domain of the submitted email, verifies it's from &lt;code&gt;acme.com&lt;/code&gt; then generates a token (maybe using &lt;a href=&quot;http://buildwithcraft.com/classreference/helpers/StringHelper#UUID-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper::UUID()&lt;/a&gt; or &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CSecurityManager#generateRandomString-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;security-&gt;generateRandomString()&lt;/a&gt; if it should be cryptographically secure).  I'm assuming you'll save that token into the database for later verification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://buildwithcraft.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;email-&gt;sendEmail()&lt;/a&gt; to send an email with the link they need to click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they click the link, you'd also have it point to another controller action that gets the token from the URL, verifies it's valid, then logs the user in similar to how Craft does it in &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/UsersController#actionLogin-detail&quot; rel=&quot;nofollow&quot;&gt;UsersController-&gt;actionLogin()&lt;/a&gt;, but minus all of the username/password logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, if you invalidate the token after one use (which you probably should), then the user will have to go through this whole process every time they want to log in.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-02T00:47:51.670" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11715" PostTypeId="2" ParentId="11685" CreationDate="2015-10-02T01:52:56.053" Score="5" Body="&lt;p&gt;Something like this should do what you're looking for and will work for any number of rows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reallyEmpty = true %}&#xA;&#xA;{% if entry.tableField | length %}&#xA;    {# Since you've got a default row set, we're guaranteed that [0] will be set #}&#xA;    {% for column in entry.tableField[0] %}&#xA;        {% if column|length %}&#xA;            {% set reallyEmpty = false %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if reallyEmpty %}&#xA;    It's really empty.&#xA;{% else %}&#xA;    It's not empty.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-02T01:52:56.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11716" PostTypeId="2" ParentId="9400" CreationDate="2015-10-02T02:01:26.707" Score="2" Body="&lt;p&gt;Linode.com is great... and they offer managed hosting too, if you want it.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-10-02T02:01:26.707" CommentCount="0" CommunityOwnedDate="2015-10-02T02:01:26.707" ContentLicense="CC BY-SA 3.0" />
  <row Id="11717" PostTypeId="1" CreationDate="2015-10-02T06:59:11.280" Score="0" ViewCount="531" Body="&lt;p&gt;We are building out web applications for one client and have been using Craft to do so. However, I think we may have just hit a limit in the number of fields that Craft will support. More specifically this looks to be more of a MySQL limit. I had &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11480/internal-server-error-sqlstate42000-1118-row-size-too-large&quot;&gt;recently encountered a similar issue&lt;/a&gt; with a single entry that exceeded the row size with too much rich text. This was resolved with an update to the innodb file format, setting it to barracuda.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this is not helping me in this instance as the limitation is now the total byte count for the number of columns, not the actual content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried changing any columns in the table to 'text' and looked at any other tweaks based on &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/column-count-limit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the described limitations&lt;/a&gt;, but to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm at a loss for what to do at this point as I am unable to even add one more field without an error being thrown and the DB becoming corrupt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I save that one more variable, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;CDbCommand failed to execute the SQL statement:&#xA;SQLSTATE[42000]: Syntax error or access violation:&#xA;1118 Row size too large (&amp;gt; 8126). Changing some columns to TEXT or BLOB may help.&#xA;In current row format, BLOB prefix of 0 bytes is stored inline.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when I try to access the admin or any template on the site, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]:&#xA;Column not found: 1054 Unknown column 'content.field_heroCtaTitle' in 'field list'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bummer with this error is I can only recover with a database restore. Didn't want to try and hack out the bad field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the short term, I may try to replace some standard fields with matrix fields which should reduce the number of columns in the craft_content table, but this is not really an ideal approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other thoughts, ideas, hacks would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1096" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-02T15:33:28.187" Title="Bumping into max row size of 65k craft_content table in MySQL 5.5" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11718" PostTypeId="1" AcceptedAnswerId="11721" CreationDate="2015-10-02T09:41:19.903" Score="2" ViewCount="1521" Body="&lt;p&gt;Hi Not sure on the best way to do this. I have some javascript that requires a json formatted file to populate a calendar. I can do this in php by adding the following to the file that is being requested:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;header('Access-Control-Allow-Origin: *');&#xA;    $array = array(&#xA;    array('date' =&amp;gt; &quot;27/9/2015&quot;, 'title' =&amp;gt; 'BBC Event', 'link' =&amp;gt; 'http://www.bbc.co.uk')&#xA;    );&#xA;echo json_encode($array);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to be able to do the same with craft. I have tried just formatting the entries in twig which returns the json as it should be but because the header is missing the javascript call does not run it. I have also created a small plugin to pull out all the entries which may be a better option. I just need to know how to return those entries in json to a template as per the above php would create with a header included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-10-02T12:40:20.730" Title="Return json formatted entries and include a header for Access-Control-Allow-Origin" Tags="&lt;plugin-development&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11719" PostTypeId="1" AcceptedAnswerId="11731" CreationDate="2015-10-02T11:03:30.950" Score="3" ViewCount="752" Body="&lt;p&gt;Should it be set to the timezone of the server Craft is installed on, or the timezone of the current user, or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can find no documentation about these settings anywhere.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2015-10-02T17:02:38.950" Title="What does the Timezone in Settings -&gt; General represent?" Tags="&lt;server&gt;&lt;settings&gt;&lt;current-user&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11720" PostTypeId="1" CreationDate="2015-10-02T11:26:28.213" Score="3" ViewCount="394" Body="&lt;p&gt;Does  the &lt;strong&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt;&lt;/strong&gt; plugin tap into the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;internationalization feature&lt;/a&gt; of Craft Pro, i.e. does it support &lt;strong&gt;adding localized versions of existing forms&lt;/strong&gt;, similar to translated section entries?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm looking for is creating forms where &lt;em&gt;all field names and values&lt;/em&gt; are identical between language variants, but &lt;em&gt;labels and notifications&lt;/em&gt; may differ per locale. (This is opposed to setting up multiple forms that are not tied together and write to separate tables in the back-end.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;, all I can find is a reference to &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/translating-error-messages&quot; rel=&quot;nofollow&quot;&gt;translated &lt;em&gt;error messages&lt;/em&gt;&lt;/a&gt;, which are the smallest of my concerns. — That same approach might work for the main conent of the form as well, but it could not be managed via the plugin's control panel.&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="37" LastEditDate="2015-10-02T11:34:44.857" LastActivityDate="2016-06-08T15:03:11.577" Title="Sprout Forms: Localized version of form with translated labels?" Tags="&lt;localization&gt;&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11721" PostTypeId="2" ParentId="11718" CreationDate="2015-10-02T12:40:20.730" Score="4" Body="&lt;p&gt;You can set the header in Twig with the &lt;code&gt;{% header %}&lt;/code&gt; function. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json; charset=utf-8&quot; %}&#xA;{% header &quot;Access-Control-Allow-Origin: *&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As to generating the actual json, my favourite is using the &lt;a href=&quot;https://github.com/mattstauffer/craftcms-prune&quot; rel=&quot;nofollow&quot;&gt;prune plugin&lt;/a&gt; and do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntries = craft.entries.section('mySection').find() %}&#xA;&#xA;{&#xA;    {%- spaceless -%}&#xA;    &quot;myEntries&quot;: {{ myEntries | prune(['onefield', 'anotherfield']) | json_encode() | raw }},&#xA;    {%- endspaceless -%}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also just loop over all the entries and create the json yourself, but I always get into all sorts of issues with encoding when doing that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're going to do a lot of json requests, you could also look into the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API plugin&lt;/a&gt; from Pixel &amp;amp; Tonic. You'd probably have to set the headers on the webserver level (.htaccess or nginx.conf) though.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-10-02T12:40:20.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11722" PostTypeId="1" AcceptedAnswerId="11732" CreationDate="2015-10-02T13:38:09.047" Score="2" ViewCount="4803" Body="&lt;p&gt;Our client has (sadly) presented a new site URL as www.foo.bar.com instead of foo.bar.com. I need to use .htaccess to remove the www. The site works correctly if &lt;code&gt;www&lt;/code&gt; is not prepended to the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6509/htaccess-www-to-non-www-redirect-and-config-php&quot;&gt;This question&lt;/a&gt; comes close but implementing with a subdomain doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my .htaccess:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /&#xA;&#xA;    # Redirect to non-www domain&#xA;    RewriteCond %{HTTP_HOST} !foo\.bar\.com$ [NC]&#xA;    RewriteRule ^(.*)$ http://foo.bar.com/$1 [R=301,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To clarify, I would like to remove both &lt;code&gt;www&lt;/code&gt; and &lt;code&gt;index.php&lt;/code&gt; from all URLs. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://www.foo.bar.com/yay&lt;/code&gt; -&gt; &lt;code&gt;http://foo.bar.com/yay&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, this is hosted on Rackspace, which requires the &lt;code&gt;Rewrite Base /&lt;/code&gt; directive.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2021-03-14T06:55:01.150" Title="htaccess www to non-www with subdomain" Tags="&lt;htaccess&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11723" PostTypeId="2" ParentId="11720" CreationDate="2015-10-02T14:02:22.517" Score="1" Body="&lt;p&gt;What about &lt;a href=&quot;http://buildwithcraft.com/help/static-translations&quot; rel=&quot;nofollow&quot;&gt;translation files&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2015-10-02T14:02:22.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11724" PostTypeId="1" AcceptedAnswerId="11735" CreationDate="2015-10-02T14:35:23.450" Score="2" ViewCount="42" Body="&lt;p&gt;I was setting up localisation and was a bit confused finding certain langugae locales.&#xA;Urdu is spoken in Pakistan also known as Bihari but in Craft or Yii i18n data there is only en_pk. Is this a holder for incoming translations?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-10-02T17:41:14.987" Title="Localisation for certain languages" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11725" PostTypeId="2" ParentId="11660" CreationDate="2015-10-02T14:45:15.633" Score="1" Body="&lt;p&gt;Maybe the folder on the server has a different name to your local version. The folder &quot;songcover&quot; has a space and is capitalised in the warning dialog&lt;/p&gt;&#xA;" OwnerUserId="3464" LastActivityDate="2015-10-02T14:45:15.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11726" PostTypeId="2" ParentId="11720" CreationDate="2015-10-02T15:29:47.747" Score="4" Body="&lt;p&gt;Currently, Sprout Forms (v1.1.0) is translatable, but we have not yet added support for Craft's localization feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a &lt;a href=&quot;https://github.com/BarrelStrength/Sprout-Plugin-Translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;template of a translation file&lt;/a&gt; on our Github Account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to support localization in the long run. The main reason we have not yet is mostly just one of priority. In comparison to other advanced features, we have had very few requests for it (feel free to send us a note and advocate for how this needs to work for you) and development for it isn't documented anywhere (feel free to send Pixel and Tonic a request for documenting it better too!). At the time of this posting, I posted a question here about the topic 7 months ago [February 2015] and the question has received one upvote and 41 views:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/7124/how-do-you-add-support-to-manage-content-in-multiple-languages-in-a-plugin-with&quot;&gt;How do you add support to manage content in multiple languages in a plugin with a custom Element Type?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-08T15:03:11.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11727" PostTypeId="2" ParentId="11717" CreationDate="2015-10-02T15:33:28.187" Score="1" Body="&lt;p&gt;I came into a similar problem with rich text areas and front end form submissions maxing out memory very easily. It may not solve your issue at the root but as you asked for any thoughts ideas or hacks and for the issue you state. In the rich text field options at the bottom you can change &quot;column type&quot; to &quot;medium editor&quot; which bumps storage from 64K to 4GB. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/YGMXV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YGMXV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps in any slight way, sorry if it's off point. &lt;/p&gt;&#xA;" OwnerUserId="4033" LastActivityDate="2015-10-02T15:33:28.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11728" PostTypeId="1" AcceptedAnswerId="11733" CreationDate="2015-10-02T15:34:53.073" Score="2" ViewCount="136" Body="&lt;p&gt;When an email key is registered for use with craft()-&gt;email-&gt;sendEmailByKey, it shows up in the control panel at Email Settings-&gt;Messages. This seems like a great way to allow easy editing of the messages by clients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have something hardcoded in my plugin's translations folder (e.g. /translations/en_us.php) corresponding to the email message key, will the subject and body always come from that file, or will it come from the data in the control panel? Specifically, if an update is made to the template in the control panel, does that completely override the template defined in the translations file? If so, is there a way to revert back to the version in the translation file?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2015-10-02T17:16:26.743" Title="Do email messages use control panel or translation file template when sending by key?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11729" PostTypeId="2" ParentId="9400" CreationDate="2015-10-02T16:26:06.367" Score="2" Body="&lt;p&gt;Since 4 years we moved all our EE sites over to &lt;a href=&quot;http://unixy.net&quot; rel=&quot;nofollow&quot;&gt;UNIXy&lt;/a&gt;. These guys are amazing, fully managed, support request often answered in minutes, they think for you in finding the best possible set-up and are well known for there Varnish implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Servers are located in the US and Europe. The later being important to us and pricing is sharp. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last year we started out with a new server dedicated to our Craft customers. Currently we have 5 servers running and I've never experienced a security issue, downtime, or slow support over the years. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Love these guys &lt;/p&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2015-10-02T16:26:06.367" CommentCount="0" CommunityOwnedDate="2015-10-02T16:26:06.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="11730" PostTypeId="2" ParentId="11660" CreationDate="2015-10-02T16:48:55.940" Score="3" Body="&lt;p&gt;This has happened to me in a couple scenarios:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When I am working across multiple environments and forgot to sync assets properly. (i.e. I pulled down the database snapshot from production, but not the newer assets that would be referenced in its Assets index).&lt;/li&gt;&#xA;&lt;li&gt;When one environment uses a case-sensitive file system (e.g. a unix host), and one uses a case-insensitive file system (e.g. OSX). In this case, syncs and Git pulls may fail to differentiate between files with similar names, and both Git and Assets may bugger up.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Those are the first two things I'd double-check.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-10-02T16:48:55.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11731" PostTypeId="2" ParentId="11719" CreationDate="2015-10-02T17:02:38.950" Score="4" Body="&lt;p&gt;You set it to whatever timezone the content authors will be in, so for example, when they say an entry’s post date is at 10 AM, Craft knows which timezone that should refer to.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-02T17:02:38.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11732" PostTypeId="2" ParentId="11722" CreationDate="2015-10-02T17:14:36.097" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6509/htaccess-www-to-non-www-redirect-and-config-php&quot;&gt;This question&lt;/a&gt; comes close but implementing with a subdomain doesn't work.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It should work as long as you modify the rewrite rule to account for the subdomain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} !^foo\.bar\.com$ [NC]&#xA;RewriteRule ^(.*)$ http://foo.bar.com/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code you posted was missing the &lt;code&gt;^&lt;/code&gt; before &lt;code&gt;foo\.bar\.com&lt;/code&gt; on the &lt;code&gt;RewriteCond&lt;/code&gt; line. The purpose of that conditional is supposed to be to catch incoming requests where the domain isn’t &lt;em&gt;exactly&lt;/em&gt; “foo.bar.com” (so that it can redirect them to the correct domain on the following line). However without that &lt;code&gt;^&lt;/code&gt;, the conditional would only catch requests where the domain doesn’t &lt;em&gt;end with&lt;/em&gt; “foo.bar.com”.  But “www.foo.bar.com” does in fact &lt;em&gt;end with&lt;/em&gt; “foo.bar.com” so it’s not going to get caught.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a hostname-agnostic version that’s a little easier on the eyes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-05T18:39:43.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11733" PostTypeId="2" ParentId="11728" CreationDate="2015-10-02T17:16:26.743" Score="2" Body="&lt;p&gt;The answer is &lt;em&gt;both&lt;/em&gt;. It will use whatever’s in the translation file by default, until an admin goes to Settings &gt; Email &gt; Messages and customizes it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-02T17:16:26.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11735" PostTypeId="2" ParentId="11724" CreationDate="2015-10-02T17:41:14.987" Score="2" Body="&lt;p&gt;Craft only ships with a subset of Yii’s supported locales, to cut down on the filesize. It’s easy to add additional ones though. Instructions are here: &lt;a href=&quot;http://buildwithcraft.com/help/adding-additional-locales&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/adding-additional-locales&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-02T17:41:14.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11736" PostTypeId="2" ParentId="11542" CreationDate="2015-10-02T18:19:21.010" Score="1" Body="&lt;p&gt;I spent quite a while scouring the web looking for a working solution having had little success myself. I recently stumbled on this working re-write rule to load assets from a remote server if they are not found locally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've placed the following code inside of my vhost in MAMP locally, so as not to pollute my production code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;&#xA; ... usual serve config ...&#xA;&#xA;  # Look for non-existent assets on live server&#xA;  &amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteCond %{REQUEST_FILENAME} !-f [NC]&#xA;    RewriteRule ^(.*\.(png|jpe?g|gif|ico)) http://production.com/$1 [NC,P,L]&#xA;  &amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This snippet was found in &lt;a href=&quot;http://rzen.net/serve-missing-media-production-apache-nginx/&quot; rel=&quot;nofollow&quot;&gt;this blogpost&lt;/a&gt; by  Brian Richards. Thanks Brian!&lt;/p&gt;&#xA;" OwnerUserId="3438" LastActivityDate="2015-10-02T18:19:21.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11737" PostTypeId="1" AcceptedAnswerId="11738" CreationDate="2015-10-03T16:38:00.080" Score="0" ViewCount="1062" Body="&lt;p&gt;Ok I want to list event entries based on the start date of those events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a route set up which provides the date in the same format as held in the start date field. But trying to compare this with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').startDate(date) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to pull out only entries for the specified date fails as the date variable only holds the date portion of the startDate field i.e. 2015-10-02 and not the time segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there some way I can format this call so that the comparison is like with like without the time segment. I have tried a few things with filters but nothing is working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="45" LastEditDate="2015-10-03T20:38:15.737" LastActivityDate="2015-10-04T03:21:40.883" Title="How to compare just the date part of a dateTime field?" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11738" PostTypeId="2" ParentId="11737" CreationDate="2015-10-03T18:00:47.023" Score="5" Body="&lt;p&gt;I'm not 100% sure I'm reading your question correctly, but here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming you're getting the date as a string as a route param (maybe you shouldn't call it &lt;code&gt;date&lt;/code&gt; though, as that is a function in Twig), I'll call that &lt;code&gt;dateTime&lt;/code&gt; here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{% set dayAfter = date(datetime) | date_modify('+1 day') | date('Y-m-d') %}&#xA;{% set entries = craft.entries.section('events').startDate(['and', '&amp;gt;= '~datetime, '&amp;lt; '~dayAfter]) %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's happening is you get a date, then you add one day to that date, then find all entries that have &lt;code&gt;startDate&lt;/code&gt; greater than or equal to the date you're looking for, &lt;em&gt;and&lt;/em&gt; less than the day after, thus getting all entries for that particular date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be over engineered though, and there might be a way simpler way to do this...&lt;/p&gt;&#xA;" OwnerUserId="981" LastEditorUserId="57" LastEditDate="2015-10-04T03:21:40.883" LastActivityDate="2015-10-04T03:21:40.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11739" PostTypeId="2" ParentId="11648" CreationDate="2015-10-04T09:35:02.870" Score="3" Body="&lt;p&gt;For the redirect I agree, I could not get it too from ajax response, so I just saved it before the ajax call.&lt;br&gt;&#xA;&lt;code&gt;var returnUrl = $(&quot;input[name='redirect']&quot;).val();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I can make the redirection :  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.success(function(data) {&#xA;    if (data.success) {&#xA;        window.location.href = returnUrl;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the user's data could you precise what you want to do?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-10-04T09:35:02.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11740" PostTypeId="2" ParentId="11648" CreationDate="2015-10-04T20:18:52.280" Score="2" Body="&lt;p&gt;I found a solution using the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; plugin, with the following endpoints config:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'user/info.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; [&#xA;                'id' =&amp;gt; craft()-&amp;gt;userSession-&amp;gt;getId()&#xA;            ],&#xA;            'first' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function (UserModel $user) {&#xA;                return [&#xA;                    'email' =&amp;gt; $user-&amp;gt;email,&#xA;                    'image' =&amp;gt; $user-&amp;gt;getPhotoUrl('28')&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now after saving a user I can just create an Ajax request to &lt;code&gt;/user/info.json&lt;/code&gt; and get their info in response.&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="9" LastEditDate="2015-10-06T21:51:36.847" LastActivityDate="2015-10-06T21:51:36.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11741" PostTypeId="1" CreationDate="2015-10-05T07:07:50.417" Score="2" ViewCount="247" Body="&lt;p&gt;I have a localization problem where the routes are not showing up.&#xA;I have a tried a routes file with the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'menu' =&amp;gt; '_menu'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And its working on the main language but when i put &#xA;&lt;code&gt;website.com/ar/menu&lt;/code&gt; its giving me &lt;code&gt;404&lt;/code&gt; as if the route doesnt exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a subfolder with the proper &lt;code&gt;index.php&lt;/code&gt; and &lt;code&gt;.htaccess&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i fix this issue in the right way?&lt;/p&gt;&#xA;" OwnerUserId="4156" LastActivityDate="2015-10-05T07:07:50.417" Title="Multi-locale is not working with routes" Tags="&lt;localization&gt;&lt;routes&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11742" PostTypeId="2" ParentId="11508" CreationDate="2015-10-05T11:19:50.733" Score="9" Body="&lt;p&gt;So P&amp;amp;T chipped in to help and of course solved my plight immediately :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone else who might encounter a similar scenario I'm posting the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the page containing the archive list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('sectionName').limit(null) %}&#xA;&#xA;&amp;lt;ul id=&quot;archive&quot;&amp;gt;&#xA;    {% for year, entriesInYear in allEntries | group(&quot;postDate.year&quot;) %}&#xA;&#xA;        {% set counter = ( counter | default(0) ) + 1 %}&#xA;&#xA;        &amp;lt;li class=&quot;year{{ counter }}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#year{{ counter }}&quot;&amp;gt;{{ year }}&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}path/to-page/{{ month }}-{{ year }}&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the actual archive page (I added this at the top of the page):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.segment(3) %}&#xA;{% set year = craft.request.segment(4) %}&#xA;&#xA;{% set firstDay = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDay = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then where you want the info to appear:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set archive  = craft.entries.section('sectionName').postDate('and', '&amp;gt;= ' ~ firstDay, '&amp;lt;= ' ~ lastDay) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in archive %}         &#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            {{ entry.body }}&#xA;&#xA;            &amp;lt;p class=&quot;more&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;read more&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;div&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ entry.postDate | date(&quot;d&quot;) }} &amp;lt;span&amp;gt;{{ entry.postDate | date(&quot;M&quot;) }}&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now here's the bit that caused the grief...  Instead of having &lt;code&gt;'month'-'year'&lt;/code&gt; as part of the route, P&amp;amp;T suggested using just &lt;code&gt;'*'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7w20g.jpg&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7w20g.jpg&quot; alt=&quot;Route using asterisk&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or.. as P&amp;amp;T put it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Your dynamic route is set with the Month and Year token. If you look at the list of available tokens, you will see that Month and Year follow a specific format, which the URLs you set up in your menu do not follow. Therefore, those URLs do not follow the pattern you set in the Route and you get a 404 page.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2015-10-05T17:17:05.403" LastActivityDate="2015-10-05T17:17:05.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11743" PostTypeId="1" AcceptedAnswerId="11750" CreationDate="2015-10-05T12:28:02.560" Score="0" ViewCount="173" Body="&lt;p&gt;For an upcoming project one of the requests is that the client needs to be able to run a few custom queries on a specific section (queries are fixed, we know what these will be in advance) and then save the output to an xml file on the server. Bonus points if we can do this with a cron job, say daily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been looking at several plugins (Sprout reports, Zenbu) but none really do what I need out of the box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about handling this? Sorry if this question is too general, just looking for pointers on where to start. Any input appreciated!&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-10-05T17:27:25.220" Title="Running custom query save result to xml file" Tags="&lt;plugin-development&gt;&lt;cron&gt;&lt;xml&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11744" PostTypeId="1" AcceptedAnswerId="11746" CreationDate="2015-10-05T12:38:07.087" Score="2" ViewCount="986" Body="&lt;p&gt;I would like to check periodically (every 5 seconds for example) whether there are new entries in a channel. If yes, I would like to present a refresh button on the website (with the number of the new entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I probably need a javascript which executes every 5 seconds a database query for the id of the latest entry and compares that to the last entry shown on the current page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I guess that javascript is not able to execute a database query, so I probably need a plugin for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are my assumptions more or less correct? Where could I find a paid developper for such a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your support.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2015-10-05T15:05:28.753" Title="How to check for new entries periodically from the front-end?" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11745" PostTypeId="1" AcceptedAnswerId="11752" CreationDate="2015-10-05T13:40:56.480" Score="2" ViewCount="378" Body="&lt;p&gt;Is there a way to intercept a request before a controller action is run, so that you could preform additional authorisation checks?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have an authorised user, but their access to actions is dependant on a 3rd party API. So I need a way to check, this 3rd party API or a stored session version, before each action is performed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the &lt;code&gt;beforeAction()&lt;/code&gt; method, which is fine for new Controllers I have added, but I need site wide solution that will catch request that go through Craft and doesn't touch any plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the &lt;code&gt;onBeginRequest&lt;/code&gt; Event, but aware this fires before Craft has had chance to setup. So I feel this might not be the best solution for me, as I would like to use services inside custom plugins. If there is no other way, I assume this is best place to look. If so what is the best way to add an Event listener for this?&lt;/p&gt;&#xA;" OwnerUserId="4146" LastEditorUserId="4146" LastEditDate="2015-10-07T08:08:38.113" LastActivityDate="2015-10-07T08:08:38.113" Title="Intercept all requests before a Controller Action is executed" Tags="&lt;authentication&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11746" PostTypeId="2" ParentId="11744" CreationDate="2015-10-05T15:05:28.753" Score="4" Body="&lt;p&gt;This is actually a pretty simple task.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a template that your JS will reach out to returning the total number of entries. First create a template folder called &quot;ajax&quot; with an index.html file inside. Within that file put (replacing blogs with the name of your channel):&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.entries.section(&quot;blogs&quot;) | length }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Inside your javascript, add this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    var numberOfEntries = false;&#xA;&#xA;    setInterval(function(){&#xA;&#xA;    $.ajax({&#xA;      url: '/ajax',&#xA;      type: 'GET',&#xA;    })&#xA;    .success(function(data) {&#xA;&#xA;      updatedNumberOfEntries = Number(data);&#xA;&#xA;      if(updatedNumberOfEntries != numberOfEntries){&#xA;&#xA;        // something was updated -- do whatever you want&#xA;        numberOfEntries = updatedNumberOfEntries;&#xA;&#xA;      }&#xA;    });&#xA;&#xA;    }, 5000);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You'll obviously need to make some revision to suit whatever you're trying to do but essentially just dump out the number of articles in a template, and use jquery's ajax method to get that value and see if it has changed.&lt;/p&gt;&#xA;" OwnerUserId="3958" LastActivityDate="2015-10-05T15:05:28.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11747" PostTypeId="1" AcceptedAnswerId="11753" CreationDate="2015-10-05T16:02:44.120" Score="2" ViewCount="42" Body="&lt;p&gt;Am wondering if there is a way to fire some code prior to user validation being actioned? I have code running in a plugin that fire &lt;code&gt;onBeforeSave&lt;/code&gt; but validation is actioned before this. So was wondering if there is a function that can be run &lt;code&gt;onBeforeValidation&lt;/code&gt; specifically for users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2015-10-05T18:06:07.493" LastActivityDate="2015-10-05T18:06:07.493" Title="Is there a way to to fire some code before user validation?" Tags="&lt;users&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11748" PostTypeId="2" ParentId="8679" CreationDate="2015-10-05T16:13:37.333" Score="3" Body="&lt;p&gt;I'm pretty sure you can do this much simpler and without javascript. I've setup a front-end form using the doc's example and added checkboxes to choose entries that will be stored in a relational field simply by using &lt;code&gt;name=&quot;fields[fieldName][]&quot;&lt;/code&gt; in the &lt;code&gt;input type=&quot;checkbox&quot;&lt;/code&gt;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;&quot; class=&quot;&quot; type=&quot;checkbox&quot; name=&quot;fields[kitIcons][]&quot; value=&quot;{{ entry.id }}&quot; checked&amp;gt;{{ entry.title }}&amp;lt;br/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example, &quot;kitIcons&quot; is the name of my relationship field, and I have this going through a loop to populate the entry.id and entry.title. Seems to be working without any glitches in my system.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="57" LastEditDate="2015-10-05T18:04:50.647" LastActivityDate="2015-10-05T18:04:50.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11749" PostTypeId="1" AcceptedAnswerId="11783" CreationDate="2015-10-05T17:22:01.353" Score="4" ViewCount="259" Body="&lt;p&gt;I've read as many forum posts and documentation but am a little stumped over a specific use-case. Currently the search page grabs the url segment, loops through a verified user group, and uses the &lt;code&gt;.shuffle()&lt;/code&gt; function to randomise order. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to limit search results using &lt;a href=&quot;http://buildwithcraft.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; with a &lt;code&gt;customTagsField&lt;/code&gt; on a user's profile. It also needs to limit results using only the first 5 tags that the user has entered in &lt;code&gt;customTagField&lt;/code&gt;, in the order they are arranged in control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OdEw4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdEw4.png&quot; alt=&quot;Only the first 5 tags are searched, in the order they&amp;#39;re displayed&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid-item 1/1&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% set query   = craft.request.getParam('q') %}&#xA;    {% set results = craft.users.group('verified').search(query) %}&#xA;    {% set users   = shuffle(results) %}&#xA;&#xA;    {% if users|length %}&#xA;        &amp;lt;p&amp;gt;{{ users|length }} results:&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;grid&quot;&amp;gt;&#xA;        {% for user in users %}&#xA;            &amp;lt;div class=&quot;grid-item 1/1 mb&quot;&amp;gt;&#xA;                &amp;lt;div {# class=&quot;grid-item xs-1/4 sm-1/6 lg-1/8&quot; #}&amp;gt;&#xA;                        &amp;lt;img class=&quot;img-circle&quot; src=&quot;{{ user.photoUrl }}&quot; alt=&quot;&quot;&amp;gt;&#xA;                      &amp;lt;/div&amp;gt;&#xA;                &amp;lt;h2 {# class=&quot;grid-item 1/1&quot; #}&amp;gt;{{ user.fullName }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;div {# class=&quot;grid-item 1/1&quot; #}&amp;gt;{{ user.intro }}&amp;lt;/div&amp;gt;&#xA;                        &amp;lt;div {# class=&quot;grid-item 1/1&quot; #}&amp;gt;&#xA;                            &amp;lt;a class=&quot;btn&quot; href=&quot;/profile/{{ user.username }}&quot;&amp;gt;View counsellor&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm still a bit confused about &lt;code&gt;relatedTo&lt;/code&gt; as well as &lt;strong&gt;source&lt;/strong&gt; and &lt;strong&gt;target&lt;/strong&gt; terminology, even though I've read quite a bit about it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it as simple as changing &lt;code&gt;results&lt;/code&gt; to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.users.group('verified').relatedTo(customTagsFieldHandle).search(query) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem possible to limit the tags searched using &lt;code&gt;relatedTo&lt;/code&gt; (as you can with &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8727/is-there-a-way-to-limit-output-of-tags-related-to-an-entry/8729#8729&quot;&gt;&lt;code&gt;craft.tags&lt;/code&gt;&lt;/a&gt;, so I expect I'll have to edit the &lt;code&gt;for loop&lt;/code&gt; somehow. I know about &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig's slice function&lt;/a&gt; but I'm not sure how to go about limiting by a user's tag entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have suggestions for the optimal way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-10-09T21:29:04.380" Title="Limit search results for users by tag (and limit to 5 tags)" Tags="&lt;users&gt;&lt;relations&gt;&lt;search&gt;&lt;tags&gt;&lt;set&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11750" PostTypeId="2" ParentId="11743" CreationDate="2015-10-05T17:27:25.220" Score="1" Body="&lt;p&gt;Sounds like a pretty simple custom Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd add a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; to your plugin and an action method and allow &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;anonymous access&lt;/a&gt; to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your method would run any queries you need and save the results to an XML file on the server somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then setup cron to execution the action at whatever interval you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 3 * * * curl -s -o /dev/null &quot;http://mydomain.com/actions/myplugin/myaction&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-05T17:27:25.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11751" PostTypeId="1" AcceptedAnswerId="11754" CreationDate="2015-10-05T17:41:57.053" Score="1" ViewCount="172" Body="&lt;p&gt;I'm having trouble setting things up to redirect some old news articles a certain way, while still serving existing articles:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a page exists at &lt;code&gt;/news/my-article&lt;/code&gt; then it should be served as normal.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If that URL &lt;em&gt;doesn't&lt;/em&gt; exist (ie, all non-functioning &lt;code&gt;/news/*&lt;/code&gt; URLs), I want the user to be redirected to &lt;code&gt;/news&lt;/code&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;All 404s that aren't within &lt;code&gt;/news&lt;/code&gt; should be handled as normal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My first thought was to use a &lt;code&gt;redirect&lt;/code&gt; tag in the 404 template, only if the request URL matches &lt;code&gt;/news/*&lt;/code&gt;... but I'm not sure if that's too late in the process. By that time, has a 404 header already been sent, so the user would get 404 -&gt; 301 -&gt; 404 ?&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-10-05T18:25:11.180" Title="Redirecting certain 404s to a page, handling all others as normal" Tags="&lt;redirect&gt;&lt;404&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11752" PostTypeId="2" ParentId="11745" CreationDate="2015-10-05T17:57:16.500" Score="4" Body="&lt;p&gt;You're correct about both &lt;code&gt;beforeAction()&lt;/code&gt; and &lt;code&gt;onBeginRequest()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you could put an &lt;code&gt;init()&lt;/code&gt; method in your main &lt;a href=&quot;http://buildwithcraft.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; class file and this will execute on every request as long as the plugin is installed and enabled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    // Whatever code you were going to put in onBeginRequest can go here.&#xA;    parent::init();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-05T17:57:16.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11753" PostTypeId="2" ParentId="11747" CreationDate="2015-10-05T18:03:56.813" Score="0" Body="&lt;p&gt;Currently Craft doesn't have any events related to validation.  You can see the full list of events available &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can always add it as a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, though. Be sure and add examples of your specific use-case.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-05T18:03:56.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11754" PostTypeId="2" ParentId="11751" CreationDate="2015-10-05T18:25:11.180" Score="2" Body="&lt;p&gt;You could also set up a route for &lt;code&gt;news/{slug}&lt;/code&gt; to point to your news template, and have it do the check to see if the entry in &lt;code&gt;segment_2&lt;/code&gt; is valid, and do something based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did something like this for my &quot;members&quot; pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set thisProfile = craft.users.id(craft.request.segment(2))[0] %}&#xA;&#xA; {% if not thisProfile %}&#xA;    {% redirect siteUrl %}&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-10-05T18:25:11.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11755" PostTypeId="1" AcceptedAnswerId="11758" CreationDate="2015-10-05T20:32:27.270" Score="1" ViewCount="217" Body="&lt;p&gt;I'm a newbie, so please excuse this if its a super simple question. I have a structure set up like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;• Parent Section 1&#xA;  - Child 1A (category: pro-users)&#xA;  - Child 1B (category: pro-users)&#xA;  - Child 1c&#xA;&#xA;• Parent Section 2&#xA;  - Child 2A &#xA;  - Child 2B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am wanting to output a navigation/landing page with the children viewable or not based on what category they are set to. So for example, on a specific page, I just want items with category &quot;pro-users&quot; (two entries specified above) to show up, with their parent title, and not any of the others. I also don't want the parent titles of sections that don't contain matching elements (Parent Section 2) to show. So, in this example where I just want the children with category &quot;power-users&quot; to show up, it would only show me: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PARENT SECTION 1&#xA;   Child 1A&#xA;   Child 1B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And nothing else. Please ask for more specifics if this doesn't make sense. I just can't figure out how to a) only show the children that are matching the categories I specify (in this case &quot;pro-users&quot;) and to also not show the subsequent parent title if there are no matching children (as is the case for Parent Section 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help, I really really appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="3587" LastActivityDate="2015-10-06T06:56:39.127" Title="Showing/Hiding children of a Structure based on categories" Tags="&lt;structure&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11756" PostTypeId="1" CreationDate="2015-10-05T20:37:29.943" Score="1" ViewCount="513" Body="&lt;p&gt;Occasionally, after deploying Craft, without warning I am unable to access the admin dashboard and get the following PHP error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Parse error:  syntax error, unexpected '.', expecting '&amp;amp;' or variable (T_VARIABLE) in /var/www/html/releases/1444051402/craft/storage/runtime/compiled_templates/9/f/9fb1fb61cba0ba044bdd7fb03e82130398321f3315b85408215cc636d2ff3f4c.php on line 177&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am really struggling to replicate the issue. It doesn't occur on my local development environment: it only happens after a seemingly random amount of time sitting on my live server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Deleting the &lt;code&gt;compiled_templates&lt;/code&gt; folder in &lt;code&gt;/craft/storage/runtime&lt;/code&gt; fixes the issue&lt;/strong&gt; but I do not do what is causing it to occur in the first place.&lt;/p&gt;&#xA;" OwnerUserId="4161" LastActivityDate="2015-10-05T20:37:29.943" Title="Error with compiled Twig templates" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11757" PostTypeId="1" AcceptedAnswerId="11759" CreationDate="2015-10-05T20:40:07.147" Score="2" ViewCount="450" Body="&lt;p&gt;I have a plugin where I'm creating custom entries based on user submitted data. Saving these entries works well. As does modifying their titles after saving to add the entry's ID to the title (using &lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) { ... }&lt;/code&gt;). The problem I'm having now is that I'd like to also update the slug at this point, so that each entry's slug is just its ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'slug' =&amp;gt; $entryId,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;slug = $entryId;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but neither do anything — even though the title change is getting saved successfully. Either I'm missing something, or the slug is handled differently than both entry fields and entry base content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; How do I update the entry slug from a plugin to be just the entry's ID?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's the code I currently have in my plugin's base class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $entryId = $entry-&amp;gt;id;&#xA;&#xA;        $newTitle = str_replace('Name: ', $entryId . ' - ', $entry-&amp;gt;title);&#xA;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = $newTitle;&#xA;&#xA;        $entry-&amp;gt;setContentFromPost(array(&#xA;            'slug' =&amp;gt; $entryId,&#xA;        ));&#xA;&#xA;        // Here I use elements-&amp;gt;saveElement() because using entries-&amp;gt;saveEntry &#xA;        // cased an infinite loop.&#xA;        // It would be great to have this sanity checked as well, please :)&#xA;        craft()-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="248" LastEditorUserId="248" LastEditDate="2015-10-05T21:30:33.640" LastActivityDate="2015-10-05T21:30:33.640" Title="Setting an entry slug from a pluign" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;slug&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11758" PostTypeId="2" ParentId="11755" CreationDate="2015-10-05T21:11:24.997" Score="2" Body="&lt;p&gt;Something like this should do the trick! You want to get all the section parent entries, then search for child entries that are related to the category you want. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parents = craft.entries.section('your_structure_handle').level(1) %}&#xA;&#xA;{% for parent in parents %}&#xA;    {% set children = craft.entries.decendantOf(parent).relatedTo(category) %}&#xA;    {% if children|length %}&#xA;        &amp;lt;h1&amp;gt;{{parent.title}}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;        {% for child in children %}&#xA;            &amp;lt;li&amp;gt;{{child.title}}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="125" LastEditDate="2015-10-06T06:56:39.127" LastActivityDate="2015-10-06T06:56:39.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11759" PostTypeId="2" ParentId="11757" CreationDate="2015-10-05T21:22:32.417" Score="2" Body="&lt;p&gt;If you set the slug directly on the entry element, it should work!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $entryId = $entry-&amp;gt;id;&#xA;&#xA;        $newTitle = str_replace('Name: ', $entryId . ' - ', $entry-&amp;gt;title);&#xA;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = $newTitle;&#xA;&#xA;        $entry-&amp;gt;slug = $entryId;&#xA;&#xA;        craft()-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-05T21:22:32.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11760" PostTypeId="1" AcceptedAnswerId="11763" CreationDate="2015-10-05T21:24:45.773" Score="2" ViewCount="369" Body="&lt;p&gt;I have multiple entries in 'blog' that have the 'featurePost' checkbox field checked. I want to display ONLY the latest, but this code is displaying multiple fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}&#xA;&#xA;{% for entry in entriesOnPage %}&#xA;    {% if craft.entries.section('blog').featurePost.limit(1) | length %}&#xA;        &amp;lt;article class=&quot;flex-container-small {{ entry.featurePost | length ? 'pinned' }}&quot;&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;article class=&quot;flex-container-small&quot;&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% include &quot;partials/blog/_blog-pagination&quot; %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastEditorUserId="125" LastEditDate="2015-10-06T06:50:56.783" LastActivityDate="2015-10-07T07:11:55.633" Title="Display only one entry with checkbox checked in my pagination loop?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;pagination&gt;&lt;checkboxes&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11761" PostTypeId="1" AcceptedAnswerId="11765" CreationDate="2015-10-06T00:22:05.487" Score="1" ViewCount="91" Body="&lt;p&gt;Before I go into detail and share my error logs and plugin details, I'll ask the simple question first:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When testing my 404 page, no plugin functionality works. Is this intentional?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just for testing purposes, I tried to include the index template file in my 404 template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'index' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This pulls in the homepage fine, but still causes an error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;pluginName&quot; does not exist in &quot;404&quot;...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The following returns 'yes' when legitmately on the homepage, and 'no' when on a 404 page, which uses the &lt;em&gt;include&lt;/em&gt; I just mentioned. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ pluginName is defined ? 'yes' : 'no'}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any insight would be great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-10-06T16:26:43.340" Title="Plugin does not exist on 404 page?" Tags="&lt;plugin-development&gt;&lt;404&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11762" PostTypeId="2" ParentId="11760" CreationDate="2015-10-06T01:51:50.700" Score="1" Body="&lt;p&gt;This should show all entries, paginated, with featured posts at the start, but not pinned to the top of each page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}&#xA;&#xA;    {% for entry in entriesOnPage %}&#xA;        &amp;lt;article class=&quot;flex-container-small{% if entry.featurePost %} pinned{% endif %}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% include &quot;partials/blog/_blog-pagination&quot; %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ordering by featurePost is good, but you can perform the check a lot more simply.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-10-06T01:51:50.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11763" PostTypeId="2" ParentId="11760" CreationDate="2015-10-06T06:37:28.597" Score="1" Body="&lt;p&gt;Edit: First update your checkboxes field to a lightswitch field. The checkboxes field type stores its data to the DB as a serialized array, so you can't use the field for the order parameter or a custom field parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To pass the same amount of entries to each of your paginated pages I would suggest the following approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Build an array of entry IDs in your desired sort order. You have to query twice using the &lt;code&gt;ids()&lt;/code&gt; method and merge the returned IDs.&#xA;First query is for the featured entries, where you add your &lt;code&gt;featurePost&lt;/code&gt; field parameter, second one for all your section's entries.&#xA;Before merging take care to not include the featured entries IDs twice by using Twigs &lt;code&gt;without&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now query for the entry models by passing that IDs array to the &lt;code&gt;id&lt;/code&gt; parameter and adding &lt;code&gt;fixedOrder(true)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featureEntryIds = craft.entries({&#xA;    section: 'blog',&#xA;    featurePost: 1,&#xA;    limit: 1&#xA;}).ids() %}&#xA;&#xA;{% set allEntryIds = craft.entries({&#xA;    section: 'blog'&#xA;}).ids() %}&#xA;&#xA;{% set sortedEntryIds = featureEntryIds|merge(&#xA;    allEntryIds|without(featureEntryIds)&#xA;) %}&#xA;&#xA;{% paginate craft.entries({&#xA;    id: sortedEntryIds,&#xA;    fixedOrder: true,&#xA;    limit: 5&#xA;}) as entriesOnPage %}&#xA;&#xA;    {% for entry in entriesOnPage %}&#xA;        {% set articleClass = entry.id in featureEntryIds ? 'pinned' %}&#xA;        &amp;lt;article class=&quot;{{ articleClass }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-07T07:11:55.633" LastActivityDate="2015-10-07T07:11:55.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11765" PostTypeId="2" ParentId="11761" CreationDate="2015-10-06T08:35:10.033" Score="2" Body="&lt;p&gt;Ok, this is what I get for trying to be clever (lazy)... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've always begrudged typing in '&lt;strong&gt;craft&lt;/strong&gt;.myPlugin...' every time I wanted refer to my plugin, so I set a Route Variable in my plugin like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(&#xA;    array(&#xA;      'myPlugin' =&amp;gt; craft()-&amp;gt;myPlugin, &#xA;    )&#xA;  );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would appear none of my route variables work in the 404 template. That in itself is a bit odd, so to accomodate my laziness I've added this to the top of my 404 code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myPlugin = craft.myPlugin %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be interesting to know if this choice has any detrimental effects? &lt;em&gt;(besides being looked down upon by my peers)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-10-06T08:35:10.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11766" PostTypeId="1" AcceptedAnswerId="11767" CreationDate="2015-10-06T10:04:33.657" Score="1" ViewCount="757" Body="&lt;p&gt;Ok I know how to list radio buttons and use it to display a particular value:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsType = craft.fields.getFieldbyHandle('newsType') %}&#xA;{% for option in newsType.settings.options %}&#xA;    {% if option.value == 'newsValue' %}&#xA;        &amp;lt;h3 class=&quot;news-type&quot;&amp;gt;{{  option.label }}&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I am not in an existing entry context.)&#xA;So I would like to know if there is a shortcut to directly get this label from the value? Like that syntax :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsTypeLabel = craft.fields.getFieldbyHandle('newsType').option('newsValue').label) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-10-08T06:16:20.500" LastActivityDate="2015-10-08T06:16:20.500" Title="Get label from value in radio buttons list fieldtype" Tags="&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11767" PostTypeId="2" ParentId="11766" CreationDate="2015-10-06T10:32:06.360" Score="4" Body="&lt;p&gt;You could make a macro and use that as a &quot;shortcut&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro optionLabel(fieldHandle, optionValue) %}&#xA;&#xA;    {%- set field = craft.fields.getFieldbyHandle(fieldHandle) %}&#xA;    {%- for option in field.settings.options %}&#xA;        {%- if option.value == optionValue %}&#xA;            {{- option.label }}&#xA;        {%- endif %}&#xA;    {%- endfor %}&#xA;&#xA;{%- endmacro %}&#xA;{% import _self as macros %}&#xA;&#xA;&amp;lt;h3&amp;gt;{{ macros.optionLabel('newsType', 'newsValue') }}&amp;lt;/h3&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-06T10:32:06.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11768" PostTypeId="1" AcceptedAnswerId="11772" CreationDate="2015-10-06T11:26:51.210" Score="1" ViewCount="228" Body="&lt;p&gt;Using this help page &lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/static-translations&lt;/a&gt; I've created a &lt;code&gt;fr.php&lt;/code&gt; file in a translations folder - and it's working OK. Except when I have &lt;code&gt;&quot;Telephone&quot; =&amp;gt; &quot;Téléphone&quot;&lt;/code&gt; in the array - the two é get output as black diamonds with a question mark in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I be adding Téléphone in the array so that it outputs correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&#xA;Lee&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="3951" LastEditDate="2017-10-24T15:25:16.730" LastActivityDate="2017-10-24T15:25:16.730" Title="How can I translate static text in my templates that have accents?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11769" PostTypeId="1" AcceptedAnswerId="11779" CreationDate="2015-10-06T11:41:05.413" Score="3" ViewCount="189" Body="&lt;p&gt;Hi I've created a plugin that has an action in the controller that looks at a user registration form when submitted and if the username is empty creates a unique username for the user. This works fine and saves the user with the random name or with their chosen name if a username is entered. My problem is I am not getting any errors returned to the form or a success message when the user is registered. Validation appears to be happening as the user is not being registered if errors are found. Although the only error I see printed is invalid email if entered incorrectly, if the password is missing there is no error returned but the user is not registered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code to add the model is as follows. Can anyone point me in the right direction so that the errors are returned. The template is the standard registration form from the craft documentation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newUser = new UserModel();&#xA;$newUser-&amp;gt;username = $username;&#xA;$newUser-&amp;gt;email = $email;&#xA;$newUser-&amp;gt;newPassword = $password;&#xA;&#xA;if ($newUser-&amp;gt;validate())&#xA;{&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;}&#xA;else&#xA;{&#xA;    return $newUser-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-10-07T12:06:14.123" Title="Extending user validation" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11770" PostTypeId="1" AcceptedAnswerId="11771" CreationDate="2015-10-06T12:54:11.640" Score="3" ViewCount="576" Body="&lt;p&gt;Is it possible to use custom environmental settings with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have separate web services that I use in production and development environments. I would like to programmatically point to the appropriate service based on my environment. If I am in development, I should always point to the dev service...production...to the production service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#environmentVariables&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; leads me to believe that I can only use the settings that Craft provides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use custom environmental settings within Craft?&lt;/p&gt;&#xA;" OwnerUserId="4163" LastActivityDate="2015-10-06T15:23:01.560" Title="Custom Environmental Settings" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11771" PostTypeId="2" ParentId="11770" CreationDate="2015-10-06T15:23:01.560" Score="3" Body="&lt;p&gt;Yes it's absolutely possible, and available out of the box with craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;public/index.php&lt;/code&gt; file you specify the different environments based on your server name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the environment set, inside your &lt;code&gt;craft/config/db.php&lt;/code&gt; and &lt;code&gt;craft/config/general.php&lt;/code&gt; files, you can create different configurations for each environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article in the craft documentation goes over how to configure it. Let me know if you have any trouble, it's really just modifying those three files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3958" LastActivityDate="2015-10-06T15:23:01.560" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11772" PostTypeId="2" ParentId="11768" CreationDate="2015-10-06T15:54:22.970" Score="3" Body="&lt;p&gt;We are in the process of translating one of our client sites into 16 (yes that's 16!) languages and we haven't had any issues with accented characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can suggest off the top of my head is to ensure you are using UTF-8 character encoding. Pop this in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2015-10-06T15:54:22.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11773" PostTypeId="2" ParentId="10422" CreationDate="2015-10-06T16:15:11.477" Score="1" Body="&lt;p&gt;While the approach above works this is how you'd construct a string to use with &lt;code&gt;craft.entries.search()&lt;/code&gt; when you have multiple checkbox fields. The benefit is being able to order entries by relevancy/score.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = '' %}&#xA;&#xA;{% if craft.request.getParam('outcomes') | length %}&#xA;    {% for outcome in craft.request.getParam('outcomes') %}&#xA;        {% set string = string ~ ' outcomes:' ~ outcome %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.getParam('age') | length %}&#xA;    {% for age in craft.request.getParam('age') %}&#xA;        {% set string = string ~ ' age:' ~ age %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if string != '' %}&#xA;    {% set entries = craft.entries.section('interventions').search(string).order('score') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1097" LastEditorUserId="57" LastEditDate="2015-10-06T17:45:31.737" LastActivityDate="2015-10-06T17:45:31.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11774" PostTypeId="2" ParentId="11761" CreationDate="2015-10-06T16:26:43.340" Score="2" Body="&lt;p&gt;If you want to make a new variable available globally, you should do it by registering a new Twig extension, using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addTwigExtension&quot; rel=&quot;nofollow&quot;&gt;addTwigExtension&lt;/a&gt; hook. You can use the Twig extension’s &lt;a href=&quot;http://twig.sensiolabs.org/api/master/Twig_Extension.html#method_getGlobals&quot; rel=&quot;nofollow&quot;&gt;getGlobals()&lt;/a&gt; method to create whatever new global variables you want.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-06T16:26:43.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11775" PostTypeId="2" ParentId="11766" CreationDate="2015-10-06T17:10:20.870" Score="1" Body="&lt;p&gt;If you just want to get the selected radio button’s label, in the context of an existing entry, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.newsType|length %}&#xA;    &amp;lt;h3 class=&quot;news-type&quot;&amp;gt;{{ entry.newsType.label }}&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Documented here: &lt;a href=&quot;http://buildwithcraft.com/docs/radio-buttons-fields#templating&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/radio-buttons-fields#templating&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-06T17:10:20.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11776" PostTypeId="1" AcceptedAnswerId="11777" CreationDate="2015-10-06T17:55:02.497" Score="2" ViewCount="2316" Body="&lt;p&gt;I created an image transform called &lt;code&gt;teamImage&lt;/code&gt;. My template code is below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want this transform to be created when I upload an image within a &lt;code&gt;Team&lt;/code&gt; entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;code&gt;Team&lt;/code&gt; has it's own asset folder.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions is how does craft know when to create this transform and where in the directory does it create it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.teamImage %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;         &amp;lt;img src=&quot;{{ asset.getUrl('teamImage') }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2015-10-06T17:59:36.057" Title="How does Craft know when to generate an Image Transform" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11777" PostTypeId="2" ParentId="11776" CreationDate="2015-10-06T17:59:36.057" Score="4" Body="&lt;p&gt;Craft will make the image transform the first time the template is loaded in the browser and the &lt;code&gt;getUrl()&lt;/code&gt; is called. The image will at first be saved in a temporary directory, then moved into a sub-directory in your assets folder. The subdirectory will be descriptively named according to the type of transform. For example, if my template calls for a 500 x 500 center-center crop at 75% quality, it will be saved in &lt;code&gt;/uploads/_500x500_crop_center-center_75/img.jpg&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works similarly when using a CDN like S3 or Google Cloud. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-06T17:59:36.057" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11779" PostTypeId="2" ParentId="11769" CreationDate="2015-10-06T19:32:02.930" Score="3" Body="&lt;p&gt;Most user validation happens in &lt;a href=&quot;http://buildwithcraft.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersService::saveUser()&lt;/a&gt;, so restructure your code to this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$success = craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;&#xA;if (!$success)&#xA;{&#xA;    return $newUser-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this is happening in a controller action, you’ll want to make the UserModel available to the original template, so it can access and display those errors.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$success = craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;&#xA;if ($success)&#xA;{&#xA;    // Redirect to whatever URL the 'redirect' param specified&#xA;    $this-&amp;gt;redirectToPostedUrl($newUser);&#xA;}&#xA;else&#xA;{&#xA;    // Make the UserModel available to the original template&#xA;    // so it can access the submitted values and validation errors&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'account' =&amp;gt; $newUser&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-07T12:06:14.123" LastActivityDate="2015-10-07T12:06:14.123" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11780" PostTypeId="1" AcceptedAnswerId="11833" CreationDate="2015-10-06T19:53:53.547" Score="1" ViewCount="1058" Body="&lt;p&gt;Hey I am trying to get 4 entries, but only want 4 that have a body length &gt; 100. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('artists').order('RAND()').limit(4) %}&#xA;  // only display 4 entries with entry.body|length &amp;gt; 100&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3652" LastActivityDate="2015-10-09T07:20:21.627" Title="Only display entries based on a field conditional" Tags="&lt;entry&gt;&lt;sections&gt;&lt;conditional&gt;&lt;forloop&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11781" PostTypeId="2" ParentId="8517" CreationDate="2015-10-06T20:08:58.773" Score="4" Body="&lt;p&gt;For Matrix fields, you would basically need to duplicate all of this logic (or move it to a separate function), to recreate each Matrix block.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$newBlocks = array();&#xA;&#xA;foreach ($gbr-&amp;gt;$fieldHandle-&amp;gt;find() as $gbrBlock)&#xA;{&#xA;    $newBlock = new MatrixBlockModel();&#xA;    $newBlock-&amp;gt;fieldId = $field-&amp;gt;id;&#xA;    $newBlock-&amp;gt;typeId  = $gbrBlock-&amp;gt;getType()-&amp;gt;id;&#xA;    $newBlock-&amp;gt;ownerId = $element-&amp;gt;id;&#xA;    $newBlock-&amp;gt;locale  = $newLocale;&#xA;&#xA;    $newBlockContent = $newBlock-&amp;gt;getContent();&#xA;&#xA;    foreach ($gbrBlock-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $gbrBlockFieldLayoutField)&#xA;    {&#xA;        // same field value duplication logic...&#xA;    }&#xA;&#xA;    $newBlocks[] = $newBlock;&#xA;}&#xA;&#xA;$content-&amp;gt;$fieldHandle = $newBlocks;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately there’s just no easy way to duplicate element content at the moment. Field types each store things differently, and the way they expect their values to be formatted when saving an element may be different from how they are formatted when fetching an existing element from the DB. (This is something we’ve made much easier in Craft 3 though.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-06T20:08:58.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11782" PostTypeId="2" ParentId="11780" CreationDate="2015-10-06T21:21:49.533" Score="3" Body="&lt;p&gt;You could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all entries with a body &amp;gt; 100 %}&#xA;{% for entry in craft.entries.section('artists').order('RAND()').find() if entry.body|length &amp;gt; 100 %}&#xA;&#xA;{# Limit output to the first 4 #}&#xA;{% if loop.index1 &amp;lt;= 4 %}&#xA;        {{ entry.id }}'s body field has a length greater than 100!&amp;lt;br /&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that if &lt;code&gt;entry.body&lt;/code&gt; is a &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;Rich Text field&lt;/a&gt; than any HTML markup (&lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;, etc.) will be included in that length count as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig doesn't have a &lt;code&gt;break&lt;/code&gt; or &lt;code&gt;continue&lt;/code&gt; tag natively, but if you install the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/mn-break-and-continue&quot; rel=&quot;nofollow&quot;&gt;MN Break and Continue plugin&lt;/a&gt;, you can make it a bit more efficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all entries with a body &amp;gt; 100 %}&#xA;{% for entry in craft.entries.section('artists').order('RAND()').find() if entry.body|length &amp;gt; 100 %}&#xA;    {% if loop.index1 &amp;gt; 4 %}&#xA;        {% break %}&#xA;    {% endif %}&#xA;&#xA;    {{ entry.id }}'s body field has a length greater than 100!&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-06T21:45:15.123" LastActivityDate="2015-10-06T21:45:15.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11783" PostTypeId="2" ParentId="11749" CreationDate="2015-10-06T21:41:35.357" Score="3" Body="&lt;p&gt;There’s no way to tell the &lt;code&gt;relatedTo&lt;/code&gt; param to only factor in the first &lt;em&gt;X&lt;/em&gt; relations per source element (the first 5 tags per user, in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of two ways you could accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1: Use two Specialism fields&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace your “Specialism” Tags field with two &lt;a href=&quot;http://buildwithcraft.com/docs/categories-fields&quot; rel=&quot;nofollow&quot;&gt;Categories fields&lt;/a&gt; – “Primary Specialism” and “Secondary Specialism”. Limit “Primary” to 5 categories, so no one can ever enter more than 5 specialties in there, and they can list any additional specialties  in the “Secondary” field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your template, you can limit the search query to only factor in the “Primary” field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.users({&#xA;    group: 'verified',&#xA;    relatedTo: {&#xA;        targetElement: craft.categories({&#xA;            group: 'specialisms',&#xA;            search: query&#xA;        }),&#xA;        field: 'primarySpecialism'&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method will get more complicated if you do start allowing premium members to be found from both fields down the road; you would need to split it up into two separate user queries – first for the premium members, and then again for the normal members.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2: Automatically store the searchable specialisms in a separate, hidden field&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install the excellent &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse&lt;/a&gt; plugin, and create a new Preparse field called “Searchable Specialisms” with the following Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;    {% for tag in user.specialismTags.limit(5) %}&#xA;        {{ tag.title }}&#xA;    {% endfor %}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Disable the “Show Field” setting so this field doesn’t show up on user profile pages. &lt;code&gt;{% spaceless %}&lt;/code&gt; is required to &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft/issues/2&quot; rel=&quot;nofollow&quot;&gt;remove initial whitespace character&lt;/a&gt; from the newly parsed “Searchable Specialisms” field)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the field is created, add it to your User field layout (Settings &gt; Users &gt; Fields) - doesn’t matter where.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, update your &lt;code&gt;set results&lt;/code&gt; template code to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.users({&#xA;    group: 'verified',&#xA;    search: 'searchableSpecialisms:&quot;' ~ query ~ '&quot;'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This approach will make it much easier to handle the premium member feature down the road, because you’ll just need to factor in whether they are a premium member or not in the Preparse field settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set limit = user.isInGroup('premium') ? null : 5 %}&#xA;{% for tag in user.specialismTags.limit(limit) %}&#xA;    {{ tag.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="3888" LastEditDate="2015-10-09T21:29:04.380" LastActivityDate="2015-10-09T21:29:04.380" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11785" PostTypeId="1" CreationDate="2015-10-07T01:48:03.083" Score="1" ViewCount="919" Body="&lt;p&gt;My client's site is on name.com and in order to change the upload limit, I think i need to place a php.ini file in the web root. But Craft crashes when I add it. The site is fine when I remove it. Anyone know why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're uploading video and Craft is giving me the 8MB upload limit problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the limit in the Craft config file isn't solving it.&lt;/p&gt;&#xA;" OwnerUserId="3767" LastEditorUserId="3767" LastEditDate="2015-11-30T14:45:08.160" LastActivityDate="2015-11-30T14:45:08.160" Title="Adding php.ini file to root crashes site" Tags="&lt;php&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11786" PostTypeId="2" ParentId="11785" CreationDate="2015-10-07T02:38:57.053" Score="1" Body="&lt;p&gt;Checkout a few different log files to see if they can help out.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/storage/logs/phperrors.log&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;If you're running apache, the apache log files&lt;/li&gt;&#xA;&lt;li&gt;If you're running php on ngix or apache, the php log files&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3958" LastActivityDate="2015-10-07T02:38:57.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11788" PostTypeId="1" AcceptedAnswerId="11789" CreationDate="2015-10-07T11:32:10.613" Score="3" ViewCount="611" Body="&lt;p&gt;I have a list of people (entries) who are related to Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to create select menu which will change (filter) the people (entries) shown on the page depending on which category (option) is selected from the select menu.  I would like the default option to show everyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't mind if this is done on page reload or via ajax but I really don't know where to start with this one :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-10-07T17:03:14.253" Title="Loading related entries by category using a select menu" Tags="&lt;categories&gt;&lt;filter&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11789" PostTypeId="2" ParentId="11788" CreationDate="2015-10-07T14:11:00.963" Score="3" Body="&lt;p&gt;You can do this using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#relatedTo&quot; rel=&quot;nofollow&quot;&gt;relatedTo param&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{# Get the selected category ID from a 'catId' query string param #}&#xA;{% set catId = craft.request.getQuery('catId') %}&#xA;&#xA;{# Define the 'relatedTo' param value, depending on if there is a category #}&#xA;{% if catId %}&#xA;    {% set relatedToParam = {&#xA;        targetElement: catId,&#xA;        field: 'categoriesFieldHandle'&#xA;    } %}&#xA;{% else %}&#xA;    {% set relatedToParam = null %}&#xA;{% endif %}&#xA;&#xA;{# Define the ElementCriteriaModel for people #}&#xA;{% set people = craft.entries({&#xA;    section: 'people',&#xA;    relatedTo: relatedToParam,&#xA;    limit: null,&#xA;    order: 'title asc'&#xA;}) %}&#xA;&#xA;{# Output the people #}&#xA;{% for person in people %}&#xA;    &amp;lt;li&amp;gt;{{ person.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this code in place, you just need to update your view so that when a category is selected, this template is re-loaded with a &lt;code&gt;?catId=X&lt;/code&gt; query string, where &lt;em&gt;X&lt;/em&gt; is the selected category ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest example of that would be with a list of category links:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for cat in craft.categories.group('myGroupHandle') %}&#xA;    {% set url = url(craft.request.path, { catId: cat.id }) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-07T17:03:14.253" LastActivityDate="2015-10-07T17:03:14.253" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11790" PostTypeId="2" ParentId="11788" CreationDate="2015-10-07T14:16:46.470" Score="2" Body="&lt;p&gt;Like you mention there are really two ways of going about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both ways, you'll want to populate a select dropdown with the value of an individual option being the category name you want to filter by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first way you could do it is loading all of the people entries onto the page. Using craft tags spit out all of your people onto the page, and make sure you're giving each &quot;person&quot; an attribute (or class) that lets you show/hide them based on their category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;person&quot; data-category=&quot;{{ entry.categoryName }}&quot;&amp;gt;&#xA;&amp;lt;h3&amp;gt;Persons Name&amp;lt;/h3&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within your javascript code, write an event handler that will fire when you change the select dropdown, and then show/hide the people based on the value selected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;.people-category-dropdown&quot;).change(function(){&#xA;&#xA;  var categoryName = $(this).val();&#xA;&#xA;  $(&quot;.person&quot;).hide(); &#xA;  $(&quot;.person&quot;).is(&quot;[data-category='&quot;+ categoryName +&quot;']&quot;).show();&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second way of doing it is to initially only load one category of people onto the page, and when someone updates the dropdown, fire off an ajax request that fetches all of the people from that category. When that response is sent back, swap out all the old people with the new ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those code examples above are by no means all the code you'll need to get things implemented, but hopefully that at least points you in the right direction!&lt;/p&gt;&#xA;" OwnerUserId="3958" LastActivityDate="2015-10-07T14:16:46.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11791" PostTypeId="1" AcceptedAnswerId="11793" CreationDate="2015-10-07T15:50:56.580" Score="5" ViewCount="1161" Body="&lt;p&gt;We have a channel called Articles with multiple entry types. Is it possible to filter the entries within Craft (on the Entries page) by entry type?&lt;/p&gt;&#xA;" OwnerUserId="3611" LastEditorUserId="125" LastEditDate="2016-02-03T09:48:53.947" LastActivityDate="2016-02-03T11:11:36.737" Title="Filter entries by entry type in the CP?" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11792" PostTypeId="2" ParentId="11785" CreationDate="2015-10-07T15:55:10.137" Score="1" Body="&lt;p&gt;I am no system admin expert, but depending on how PHP is compiled and running on the server (either as a module or CGI) will determine if you can use a php.ini file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the server is displaying an error message with the php.ini file, try adding &lt;code&gt;php_value upload_max_filesize 20M&lt;/code&gt; to your .htaccess file.&lt;/p&gt;&#xA;" OwnerUserId="3611" LastActivityDate="2015-10-07T15:55:10.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11793" PostTypeId="2" ParentId="11791" CreationDate="2015-10-07T16:54:33.107" Score="4" Body="&lt;p&gt;What you can do is to create additional entry sources using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;modifyEntrySources&lt;/code&gt;&lt;/a&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very simple example, that will add a heading and two sources to the end of the&#xA;sources list (below your default Singles, Channels and Structure sources).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    $newSources = array(&#xA;        array('heading' =&amp;gt; 'Post Formats'),&#xA;        array(&#xA;            'label' =&amp;gt; 'Articles',&#xA;            'criteria' =&amp;gt; array('section' =&amp;gt; 'blog', 'type' =&amp;gt; 'article')&#xA;        ),&#xA;        array(&#xA;            'label' =&amp;gt; 'Links',&#xA;            'criteria' =&amp;gt; array('section' =&amp;gt; 'blog', 'type' =&amp;gt; 'link')&#xA;        )&#xA;    );&#xA;&#xA;    $sources = array_merge($sources, $newSources);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also get all entry types of a section with &lt;code&gt;getEntryTypes()&lt;/code&gt; and add them programatically if you want.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-07T16:54:33.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11794" PostTypeId="1" AcceptedAnswerId="11795" CreationDate="2015-10-07T17:08:31.600" Score="2" ViewCount="87" Body="&lt;p&gt;Trying to do something quite basic but can't seem to get it right..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm searching through a form, and want to select entries where the value 'pax' is equal or more than the searched value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;section:    'ships',&#xA;limit:      null&#xA;} %}&#xA;&#xA;{# pax #}&#xA;{% if craft.request.getParam('pax') %}&#xA;  {% set pers = craft.request.getParam('pax') %}&#xA;  {% set params = params|merge({'pax' : '&amp;gt;= pers'}) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, this doesn't seem to work. However, if I'd change the last line to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set params = params|merge({'pax' : '&amp;gt;= 30'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me excellent results. So, what am I doing wrong here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much appreciated!!&lt;/p&gt;&#xA;" OwnerUserId="4113" LastActivityDate="2015-10-10T18:15:00.640" Title="Selecting entries with min value through search param" Tags="&lt;search&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11795" PostTypeId="2" ParentId="11794" CreationDate="2015-10-07T17:26:53.547" Score="2" Body="&lt;p&gt;You are currently passing a string &lt;code&gt;'&amp;gt;= pers'&lt;/code&gt; to the array. Change this to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'&amp;gt;= ' ~ pers&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This &quot;concatenates&quot; the string &lt;code&gt;'&amp;gt;= '&lt;/code&gt; and the value of your pers variable (converted to a string).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="130" LastEditDate="2015-10-10T18:15:00.640" LastActivityDate="2015-10-10T18:15:00.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11796" PostTypeId="1" AcceptedAnswerId="11800" CreationDate="2015-10-07T20:19:19.117" Score="1" ViewCount="389" Body="&lt;p&gt;I'm building a plugin that will check all existing entries in a section when a single entry is flagged as featured and turn off any existing featured entries. I'm using a lightswitch field to turn on and off entries. Is there a way to use the &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&lt;/code&gt; to return just the entries with the lightswitch field turned on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-10-07T20:29:57.110" LastActivityDate="2015-10-07T22:10:04.600" Title="Can I use getCriteria to only return entries with a specified lightswitch field set to on?" Tags="&lt;plugins&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11797" PostTypeId="1" AcceptedAnswerId="11802" CreationDate="2015-10-07T20:19:25.537" Score="3" ViewCount="2111" Body="&lt;p&gt;I'm currently redirecting all requests to https. I've updated the &lt;code&gt;siteUrl&lt;/code&gt; variable and all of my entry links have been correctly updated but the image links are still http.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to the admin panel all of the CSS/JS files wont load because the site is trying to load them over HTTP instead of HTTPS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://photos-6.dropbox.com/t/2/AABE7B8Z05VsQeEq-Ln6qRJZZ0rFIcb4JaigHdsokjB7AQ/12/374678821/png/32x32/1/_/1/2/Screenshot%202015-10-07%2013.17.58.png/EKWZvPsCGDMgBygH/Ck_T7LRtOzM9XAWqpavcVG-U_KOehUMKGbL0-31Bro4?size=2048x1536&amp;amp;size_mode=2&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;&#xA;  listen   443;&#xA;&#xA;  root /var/www/&amp;lt;url&amp;gt;/htdocs;&#xA;  index index.php index.html index.htm;&#xA;&#xA;  ssl on;&#xA;  ssl_certificate /etc/ssl/cert.crt;&#xA;  ssl_certificate_key /etc/ssl/rsa.key;&#xA;  server_name &amp;lt;url&amp;gt;;&#xA;  proxy_set_header X-Forwarded-For $remote_addr;&#xA;  proxy_set_header X-Forwarded-Proto https;&#xA;  client_max_body_size 10M;&#xA;&#xA;&#xA;  location ~ \.php$ {&#xA;    try_files $uri =404;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/opt/remi/php55/root/var/run/php-fpm/php-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;    include fastcgi_params;&#xA;  }&#xA;&#xA;  location / {&#xA;  try_files $uri $uri/ @rewrites;&#xA;  }&#xA;&#xA;  location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;  }&#xA;&#xA;  # Errors&#xA;&#xA;  error_page 404 /index.php;&#xA;  error_page 500 502 503 504 /50x.html;&#xA;&#xA;  location = /50x.html {&#xA;    root /var/www/&amp;lt;url&amp;gt;/htdocs;&#xA;  }&#xA;&#xA;  # Enable gzip compression&#xA;  gzip on;&#xA;  gzip_comp_level 2;&#xA;  gzip_http_version 1.0;&#xA;  gzip_proxied any;&#xA;  gzip_min_length 1100;&#xA;  gzip_buffers 16 8k;&#xA;  gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;&#xA;&#xA;  # Disable for IE &amp;lt; 6 because there are some known problems&#xA;  gzip_disable &quot;MSIE [1-6].(?!.*SV1)&quot;;&#xA;&#xA;  # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6&#xA;  gzip_vary on;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2295" LastEditorUserId="2295" LastEditDate="2015-10-07T22:03:42.907" LastActivityDate="2019-01-30T23:04:15.780" Title="Asset URLs not HTTPS" Tags="&lt;assets&gt;&lt;admin&gt;&lt;nginx&gt;&lt;ssl&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11798" PostTypeId="1" AcceptedAnswerId="11799" CreationDate="2015-10-07T20:49:46.953" Score="2" ViewCount="923" Body="&lt;p&gt;I'm attempting to finish my first &lt;code&gt;fieldtype&lt;/code&gt; plugin (how exciting!) but having an issue with displaying options in a &lt;code&gt;select&lt;/code&gt; dropdown in an &lt;code&gt;entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;ColumnWidth_WidthsFieldType&lt;/code&gt; has this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Widths Fieldtype&#xA; *&#xA; * Allows entries to select associated widths&#xA; */&#xA;class ColumnWidth_WidthsFieldType extends BaseFieldType&#xA;{&#xA;    /**&#xA;     * Get the name of this fieldtype&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Column Widths');&#xA;    }&#xA;&#xA;    /**&#xA;     * Get this fieldtype's column type.&#xA;     *&#xA;     * @return mixed&#xA;     */&#xA;    public function defineContentAttribute()&#xA;    {&#xA;        // &quot;Mixed&quot; represents a &quot;text&quot; column type, which can be used to store arrays etc.&#xA;        return AttributeType::Mixed;&#xA;    }&#xA;&#xA;    /**&#xA;     * Get this fieldtype's form HTML&#xA;     *&#xA;     * @param  string $name&#xA;     * @param  mixed  $value&#xA;     * @return string&#xA;     */&#xA;    public function getInputHtml($name, $value)&#xA;    {&#xA;        // call our service layer to get a current list of widths&#xA;        $widths = craft()-&amp;gt;columnWidth_widths-&amp;gt;getAllWidths();&#xA;&#xA;        // create an array for the widths &#xA;        $widthsOptions = array();&#xA;&#xA;        // populate the $widthsOptions array with $widths&#xA;        foreach ($widthsOptions as $widths )&#xA;        {&#xA;            $widthsOptions[$widths-&amp;gt;id] =  $widths-&amp;gt;name;&#xA;        }&#xA;&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('columnwidth/_fieldtypes/widths', array(&#xA;            'name'      =&amp;gt; $name,&#xA;            'values'    =&amp;gt; $value,&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;columnwidth/_fieldtypes/widths&lt;/code&gt; has this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms/&quot; as forms %}&#xA;​&#xA;{% set widths = craft.columnwidth.getAllWidths %}&#xA;&#xA;{{ forms.selectField({&#xA;    instructions: &quot;Select the width of your column&quot;|t,&#xA;    id: 'columnWidth',&#xA;    name: 'columnWidth',&#xA;    options: widths&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft\ColumnWidth_WidthsModel and its behaviors do not have a method or closure named &quot;optgroup&quot;.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only post I found was here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4491/displaying-a-list-of-fields-in-a-form-select&quot;&gt;Displaying a list of fields in a form select&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I'm missing something and any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-08T14:08:54.840" Title="Model and its behaviors do not have a method or closure named &quot;optgroup&quot;" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11799" PostTypeId="2" ParentId="11798" CreationDate="2015-10-07T21:48:24.980" Score="2" Body="&lt;p&gt;Few things - you need to add the options to the render function so they are passed into the template. Also, check what I did below for the &lt;code&gt;$widthsOptions&lt;/code&gt;. Each option needs a label and value key/value pair.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    // call our service layer to get a current list of widths&#xA;    $widths = craft()-&amp;gt;columnWidth_widths-&amp;gt;getAllWidths();&#xA;&#xA;    // create an array for the widths &#xA;    $widthsOptions = array();&#xA;&#xA;    // populate the $widthsOptions array with $widths&#xA;    foreach ($widths as $width )&#xA;    {&#xA;        $widthsOptions[] = array(&#xA;            'label' =&amp;gt; $width-&amp;gt;name, //this should be whatever you want to display in dropdown&#xA;            'value' =&amp;gt; $width-&amp;gt;name //this should be the value you want passed to the database&#xA;        );&#xA;    }&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('columnwidth/_fieldtypes/widths', array(&#xA;        'name'      =&amp;gt; $name,&#xA;        'values'    =&amp;gt; $value,&#xA;        'options'   =&amp;gt; $widthsOptions&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your field type template should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms/&quot; as forms %}&#xA;​&#xA;{{ forms.selectField({&#xA;    instructions: &quot;Select the width of your column&quot;|t,&#xA;    id: 'columnWidth',&#xA;    name: 'columnWidth',&#xA;    options: options,&#xA;    value: values&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-10-08T14:08:54.840" LastActivityDate="2015-10-08T14:08:54.840" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11800" PostTypeId="2" ParentId="11796" CreationDate="2015-10-07T22:10:04.600" Score="3" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'mySection';&#xA;$criteria-&amp;gt;myLightswitchField = 1;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-07T22:10:04.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11801" PostTypeId="2" ParentId="10090" CreationDate="2015-10-07T22:15:58.213" Score="4" Body="&lt;p&gt;I wanted to see if the same thing could be accomplished using Craft's shuffle function.  At first, I was looping through the image array and using an if statement to grab the first one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in shuffle(entry.banner) %}&#xA;    {% if loop.first %}&#xA;        {{ image.url }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I realized there was a less verbose option:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = shuffle(entry.banner)[0] %}&#xA;{{ image.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4170" LastActivityDate="2015-10-07T22:15:58.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11802" PostTypeId="2" ParentId="11797" CreationDate="2015-10-07T23:05:57.050" Score="7" Body="&lt;p&gt;Yii will check for the following server environment variables &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.16/framework/web/CHttpRequest.php#L573&quot; rel=&quot;nofollow&quot;&gt;when determining if it’s an SSL request&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;HTTPS&lt;/strong&gt; – should be set to “on”, “ON”, or “1”; or&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;HTTP_X_FORWARDED_PROTO&lt;/strong&gt; – should be set to “https” or “HTTPS”&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Apparently this is a common issue when running PHP on Nginx, since that HTTPS env variable is only an Apache convention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.chrismeller.com/getting-php-https-detection-working-in-nginx&quot; rel=&quot;nofollow&quot;&gt;Here’s an article that demonstrates how to fix it&lt;/a&gt;. According to that, you just need to add the following to your server config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fastcgi_param HTTPS on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can probably add it right before/after your other &lt;code&gt;fastcgi_param&lt;/code&gt; line.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-08T13:38:58.213" LastActivityDate="2015-10-08T13:38:58.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11803" PostTypeId="1" AcceptedAnswerId="11817" CreationDate="2015-10-08T09:57:57.600" Score="0" ViewCount="663" Body="&lt;p&gt;The following returns entries correctly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('sectionName').customField(':notempty:').limit(10) as products %}&#xA;    {% for product in products %}&#xA;        {% include 'incs/_productSnippet' %}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the following returns empty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section: 'sectionName', customField: ':notempty', limit: 10} %}&#xA;{% paginate craft.entries(params) as products %}&#xA;    {% for product in products %}&#xA;        {% include 'incs/_productSnippet' %}&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's the latter I'm after because the customField I want to check varies. Removing the &lt;code&gt;customField: ':notempty',&lt;/code&gt; from &lt;code&gt;params&lt;/code&gt; in the second example returns entries, so I'm guessing it's the way I'm using customField within &lt;code&gt;params&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-10-08T18:22:05.800" Title="How to check custom field not empty within params?" Tags="&lt;entries&gt;&lt;custom-field&gt;&lt;params&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11804" PostTypeId="1" CreationDate="2015-10-08T10:29:13.063" Score="0" ViewCount="56" Body="&lt;p&gt;In a site we are currently developing I have setup a basic cache mechanism on each template that can benefit from it by reducing the number of db queries. &#xA;The {% cache %} tag is basically in the block on the different templates. It works great (helps to speed up load-times), but the cache is not purged when adding a new category to a category-group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impacted template grasps all sort of information from different channels based on the selected main category and displays it ordered by subcategory. On adding a subcategory it gets not displayed unless the cache is being manually refreshed.  The odd thing is that when adding another subcategory (immediately after the cache refresh) the problem does not occur, but it only seems to happen after the cache has a certain age... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/master&quot; %}&#xA;{% set title = category.title ~  &quot; - Onderneming&quot; %}&#xA;{% set selected_menu_item = &quot;business&quot; %}&#xA;{% set selected_submenu_item = category.id %}&#xA;{% block body %}&#xA;{% cache %}&#xA;    &amp;lt;h2 class=&quot;extra-bottom-20&quot;&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;!-- Start Tabbladen --&amp;gt;&#xA;    &amp;lt;div role=&quot;tabpanel&quot;&amp;gt;&#xA;        &amp;lt;!-- Nav tabs --&amp;gt;&#xA;        &amp;lt;ul class=&quot;nav nav-tabs&quot; role=&quot;tablist&quot; id=&quot;myTab&quot;&amp;gt;&#xA;            {% nav category in craft.categories.descendantOf(category) %}&#xA;                &amp;lt;li role=&quot;presentation&quot; {% if loop.first %} class=&quot;active&quot; {% endif %}&amp;gt;&amp;lt;a href=&quot;#cat-{{category.id}}&quot; aria-controls=&quot;cat-{{category.id}}&quot; data-toggle=&quot;tab&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;   &#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;div class=&quot;tab-content&quot;&amp;gt;&#xA;        {% nav category in craft.categories.descendantOf(category) %}&#xA;        &amp;lt;div class=&quot;tab-pane {% if loop.first %} active {% endif %}&quot; id=&quot;cat-{{category.id}}&quot;&amp;gt;&#xA;            &amp;lt;!-- Start Producten --&amp;gt;&#xA;            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;col-lg-6&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;extra-bottom-20&quot;&amp;gt;{{ category.title }} - Producten&amp;lt;/h3&amp;gt;&#xA;                    {% if category.teaser %}&#xA;                    &amp;lt;h4 class=&quot;alert alert-info&quot;&amp;gt;{{ category.teaser }}&amp;lt;/h4&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    &amp;lt;ul class=&quot;sterlijst&quot;&amp;gt;&#xA;                        {% set entries = craft.entries.section('products').relatedTo(category) %}&#xA;                        {% for entry in entries %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                            &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;#title-{{category.id}}-{{ entry.id }}&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#title-{{category.id}}-{{ entry.id }}&quot; data-parent=&quot;#{{category.id}}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;&#xA;                            &amp;lt;div id=&quot;title-{{category.id}}-{{ entry.id }}&quot; class=&quot;collapse&quot;&amp;gt;&#xA;                                {{ entry.body }}&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&amp;lt;!-- close col-lg-6 --&amp;gt;&#xA;&#xA;                &amp;lt;!-- start veelgestelde vragen --&amp;gt;&#xA;                &amp;lt;div class=&quot;col-lg-6&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;&quot;&amp;gt;Veel gestelde vragen&amp;lt;/h3&amp;gt;&#xA;&#xA;                    &amp;lt;!-- start openklappen accordion --&amp;gt;&#xA;                    &amp;lt;div class=&quot;panel-group&quot; id=&quot;accordion&quot;&amp;gt;&#xA;                    {% set entries = craft.entries.section('faq').relatedTo(category) %}&#xA;                    {% for entry in entries %}&#xA;                    &amp;lt;!-- FAQs --&amp;gt;&#xA;                        &amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;panel-heading&quot;&amp;gt;&#xA;                                &amp;lt;h4 class=&quot;panel-title&quot;&amp;gt;&#xA;                                    &amp;lt;a data-toggle=&quot;collapse&quot; data-parent=&quot;#accordion&quot; href=&quot;#collapse-{{category.id}}-{{ entry.id }}&quot;&amp;gt;&#xA;                                    {{ entry.title }}&#xA;                                    &amp;lt;/a&amp;gt;&#xA;                                &amp;lt;/h4&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;&#xA;                            &amp;lt;div id=&quot;collapse-{{category.id}}-{{ entry.id }}&quot; class=&quot;panel-collapse collapse&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;panel-body&quot;&amp;gt;&#xA;                                    {{ entry.answer }}  &#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&amp;lt;!-- close panelgroup--&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&amp;lt;!-- close col-lg-6--&amp;gt;&#xA;            &amp;lt;/div&amp;gt;  &amp;lt;!-- close row--&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- /tabpanel 1 --&amp;gt;  &#xA;    {% endnav %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&amp;lt;hr width=&quot;50%&quot; /&amp;gt;&#xA;&amp;lt;p class=&quot;text-center&quot;&amp;gt;&amp;lt;a href=&quot;{{siteUrl}}contact&quot; class=&quot;btn btn-large btn-primary&quot;&amp;gt;Graag vraag ik een offerte aan&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe I should add that it only gives a problem with new categories, when adding new entries and assigning them to a subcategory they are displayed fine (cache is renewed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any known issues with this or am I missing something? &lt;/p&gt;&#xA;" OwnerUserId="397" LastEditorUserId="397" LastEditDate="2015-10-08T13:05:52.347" LastActivityDate="2015-10-08T13:05:52.347" Title="Caching of categories is not purged on adding new category" Tags="&lt;cache&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11805" PostTypeId="1" CreationDate="2015-10-08T10:42:13.773" Score="1" ViewCount="127" Body="&lt;p&gt;I have setup 10 languages for a project which are all working fine when accessed directly, eg 'craft.dev/fr/page','craft.dev/zh/page','craft.dev/es/page'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when in admin there are two ways of previewing the translated content.&#xA;Side by side preview shows the translation fine and uses an admin URI with the locale on the end of the admin url.&#xA;But if you external preview the local is not in the URL so throws a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a missing feature or a config issue? I was expecting the locale to appear in the external url&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My config looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://craftyCMS.dev/en/',&#xA;    'ar' =&amp;gt; 'http://craftyCMS.dev/ar/',&#xA;    'zh' =&amp;gt; 'http://craftyCMS.dev/zh',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Share link never has the locale in it.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="125" LastEditDate="2015-10-09T06:25:12.663" LastActivityDate="2015-10-09T06:25:12.663" Title="Previewing different languages" Tags="&lt;localization&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11807" PostTypeId="1" AcceptedAnswerId="11808" CreationDate="2015-10-08T12:19:01.143" Score="3" ViewCount="1326" Body="&lt;p&gt;Is it possible to insert items into specific positions in an array (rather than at the beginning or at the end), a bit like javascript splice? Say, if I wanted to add a value between items 2 and 3? Please note I want to add keys to the array rather than replace anything.&lt;/p&gt;&#xA;" OwnerUserId="4173" LastActivityDate="2015-10-09T06:16:22.230" Title="Adding items to an array" Tags="&lt;templating&gt;&lt;array&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11808" PostTypeId="2" ParentId="11807" CreationDate="2015-10-08T12:35:05.400" Score="4" Body="&lt;p&gt;You can accomplish this with &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt;, although it's not very pretty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myArray = ['a', 'b', 'd' ] %}&#xA;{% set myArray = myArray|slice(0,2)|merge(['c'])|merge(myArray|slice(2,myArray|length)) %}&#xA;&#xA;{{ myArray|join(', ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To explain what's happening above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myArray = ['a', 'b', 'd' ] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just sets an array we can work with. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|slice(0,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first slice filter &quot;chops off&quot; and returns the first two items in the original array (namely &quot;a&quot; and &quot;b&quot;). We do this because we want to add a value after the &quot;b&quot; (i.e. the second index).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|merge(['c'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first &lt;code&gt;merge&lt;/code&gt; filter appends the value we want to add – the letter &quot;c&quot; – to the first two items. As &lt;code&gt;merge&lt;/code&gt; is only able to merge arrays, we need to wrap the c in another array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|merge(myArray|slice(2,myArray|length))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The inner part of this statement – the &lt;code&gt;slice&lt;/code&gt; – pulls all the remaining values from the original array &lt;em&gt;after&lt;/em&gt; the first two that we chopped off at the beginning, until the end of the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These values are then appended to the a, b and c with another &lt;code&gt;merge&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myArray|join(', ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just a test, and will print &lt;code&gt;a, b, c, d&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-10-08T21:24:40.200" LastActivityDate="2015-10-08T21:24:40.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11809" PostTypeId="1" AcceptedAnswerId="11813" CreationDate="2015-10-08T13:20:06.280" Score="2" ViewCount="177" Body="&lt;p&gt;For the life of me I can't seem to find an answer for this question, so here goes!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a field called jobCounty in a section called jobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The jobCounty is selected in the CP from a drop down list I've created of english county names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are about 30 entries each with most with different county names, but some repeat the same county name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a form select, with options that are populated by the jobCounty names that have been selected, but avoid repeats. Ideally in alphabetical order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question seems to feel like it might be answering the same question but for for a different purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4436/related-entries-from-a-dynamic-dropdown&quot;&gt;Related entries from a dynamic dropdown&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stephen&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-12T11:34:55.423" Title="How can I merge entry values to create a select dropdown" Tags="&lt;templating&gt;&lt;entries-field&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11811" PostTypeId="1" AcceptedAnswerId="11815" CreationDate="2015-10-08T13:44:35.677" Score="1" ViewCount="154" Body="&lt;p&gt;I'm having trouble getting what should be a simple relationship between 2 channels to work as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how things are set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel: Apprenticeships - essentially categories, types of apprenticeship (health, construction, catering etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel: Vacancies - individual apprenticeship courses  - each one related to an Apprenticehips entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I can show a list of all Vacancy entries with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vacancies = craft.entries.section(&quot;vacancies&quot;).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through them and output field data. This works fine and shows all the vacancy entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I want to be able to filter the entries returned to those that are related to a specific Apprenticeships entry. This filtering is to be based on the third url segment, which is the slug of the Apprenticeship entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cat in craft.entries.title(craft.entries.slug(craft.request.segment(3)).limit(1).find()) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine and I can output field data from that Apprenticeship entry. Proving, in my mind, that Craft knows which entry I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get only the Vacancy entries that are related to the Apprenticeship entry represented by cat I thought I could simply use 'cat' in another craft.entries tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vacancies = craft.entries.section(&quot;vacancies&quot;).relatedTo(cat) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through vacancies outputting the vacancy field data. But it doesn't return any Vacancy entries even though there definitely some to return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong here?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2015-10-08T15:45:46.397" Title="Problem getting relationship between entries to work" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11812" PostTypeId="1" AcceptedAnswerId="11814" CreationDate="2015-10-08T13:46:04.690" Score="4" ViewCount="1351" Body="&lt;p&gt;I’m passing the ID of a category to a template via a &lt;code&gt;catId&lt;/code&gt; query string (i.e. &lt;a href=&quot;http://example.com/some/path?catId=10&quot; rel=&quot;nofollow&quot;&gt;http://example.com/some/path?catId=10&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I display the title of that category?&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="9" LastEditDate="2015-10-08T13:52:31.273" LastActivityDate="2015-10-08T14:03:49.677" Title="How to display the title of a category based on its ID?" Tags="&lt;categories&gt;&lt;filter&gt;&lt;category&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11813" PostTypeId="2" ParentId="11809" CreationDate="2015-10-08T14:00:08.563" Score="3" Body="&lt;p&gt;You are using a dropdown field, so you can't query for the counties in use directly from the database. (This would be possible if you had chosen to use categories or tags for them.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you can do is to loop all your jobs entries to collect their respective counties.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('jobs').limit(null) %}&#xA;&#xA;{% set counties = [] %}&#xA;{% for entry in entries %}&#xA;    {% set counties = counties|merge({&#xA;        (entry.county.value): entry.county.value&#xA;    }) %}&#xA;{% endfor %}&#xA;&#xA;{% set counties = counties|sort %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Saving the county name also to the key of each array element makes sure you won't end up getting duplicates. When done use the &lt;code&gt;sort&lt;/code&gt; filter to sort the list alphabetically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: there seems to be a problem with getting the dropdown value with &lt;code&gt;entry.county&lt;/code&gt; (the shortcut to get the value / calls the field models &lt;code&gt;__toString&lt;/code&gt; method) when setting an array key, changing it to &lt;code&gt;entry.county.value&lt;/code&gt; works.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-12T11:34:55.423" LastActivityDate="2015-10-12T11:34:55.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11814" PostTypeId="2" ParentId="11812" CreationDate="2015-10-08T14:03:49.677" Score="5" Body="&lt;p&gt;First you’ll need to grab the category ID from the query string, using &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getQuery&quot; rel=&quot;noreferrer&quot;&gt;craft.request.getQuery()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catId = craft.request.getQuery('catId') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can fetch the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/categorymodel&quot; rel=&quot;noreferrer&quot;&gt;CategoryModel&lt;/a&gt; via &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories&quot; rel=&quot;noreferrer&quot;&gt;craft.categories&lt;/a&gt; and its &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.categories#id&quot; rel=&quot;noreferrer&quot;&gt;id param&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.id(catId).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can’t be sure that the ID was actually valid, so make sure that &lt;code&gt;category&lt;/code&gt; is actually set to something, otherwise return a 404 error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not category %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, to output the category’s title, just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are a couple ways you can put this all together, depending on whether the page &lt;strong&gt;requires&lt;/strong&gt; a category ID passed to it, or if it’s optional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it’s required, we should verify that the &lt;code&gt;catId&lt;/code&gt; query parameter was actually set to something right off the bat:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catId = craft.request.getQuery('catId') %}&#xA;&#xA;{# The catId param is required #}&#xA;{% if not catId %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% set category = craft.categories.id(catId).first() %}&#xA;&#xA;{% if not category %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it’s optional, then we should grab the ID from the query string, and then wrap all of the remaining logic in a conditional, so it only runs if there was an ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catId = craft.request.getQuery('catId') %}&#xA;&#xA;{# The catId param is optional #}&#xA;{% if catId %}&#xA;    {% set category = craft.categories.id(catId).first() %}&#xA;&#xA;    {% if not category %}&#xA;        {% exit 404 %}&#xA;    {% endif %}&#xA;&#xA;    {{ category.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-08T14:03:49.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11815" PostTypeId="2" ParentId="11811" CreationDate="2015-10-08T14:25:48.767" Score="2" Body="&lt;p&gt;I recommend doing it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vacancies = craft.entries.section('vacancies').limit(null) %}&#xA;&#xA;{% set catSlug = craft.request.segment(3) %}&#xA;&#xA;{% if catSlug %}&#xA;    {% set cat = craft.entries.section('apprenticeships').slug(catSlug).first() %}&#xA;&#xA;    {% if cat %}&#xA;        {% set vacancies = vacancies.relatedTo(cat) %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This sets up an ElementCriteriaModel for all your Vacancies entries (don't use the &lt;code&gt;find()&lt;/code&gt; method yet!).&#xA;Then checks for the first entry from the Apprenticeships section with a slug of your URL segment.&#xA;If there's really such an entry, it further extends the ElementCriteriaModel with a &lt;code&gt;relatedTo&lt;/code&gt; parameter.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-08T15:45:46.397" LastActivityDate="2015-10-08T15:45:46.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11816" PostTypeId="1" AcceptedAnswerId="11869" CreationDate="2015-10-08T17:40:49.587" Score="3" ViewCount="1746" Body="&lt;p&gt;I have an Asset Source, called &lt;code&gt;files&lt;/code&gt;, with two subfolders:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;group1&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;group2&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I also have two User Groups, with the same names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want everyone in “group1” to save images into files/group1; and I want everyone in “group2” to save images into files/group2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix field which contains an Assets field. It is configured to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Restrict uploads to a single folder =&gt; &lt;strong&gt;files/{owner.author.groups[0].name}/images&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Restrict file types to Image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;When a user from group1 logs in and adds an entry, the image asset folder doesn't display all the data from their images folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I upload images in the Assets folder directly to their images folder and go back to create a new entry, the new image doesn't show up in the image list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what is going on?&lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="9" LastEditDate="2015-10-08T20:56:48.427" LastActivityDate="2015-10-15T20:05:54.303" Title="Assets Folder: Images don't show up" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11817" PostTypeId="2" ParentId="11803" CreationDate="2015-10-08T18:22:05.800" Score="3" Body="&lt;p&gt;You’re just missing the &lt;code&gt;:&lt;/code&gt; at the end of &lt;code&gt;:notempty:&lt;/code&gt; in your second example. This will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section: 'sectionName', customField: ':notempty:', limit: 10} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-08T18:22:05.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11818" PostTypeId="2" ParentId="11805" CreationDate="2015-10-08T18:28:55.387" Score="2" Body="&lt;p&gt;If you define your base site URLs using the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl config setting&lt;/a&gt; (using the array syntax), then clicking the “Share” button should bring you to the appropriate locale’s URL.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-08T18:28:55.387" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11819" PostTypeId="1" CreationDate="2015-10-08T18:39:28.213" Score="0" ViewCount="86" Body="&lt;p&gt;I was wondering if anybody can help me with the implementation of the remarketing tag into my site. I have the codes and I just don't know where to enter them.&lt;/p&gt;&#xA;" OwnerUserId="4175" LastEditorUserId="6007" LastEditDate="2018-07-25T02:15:02.347" LastActivityDate="2018-07-25T02:15:02.347" Title="I would like to implement the remarketing tag into my website" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11820" PostTypeId="2" ParentId="11819" CreationDate="2015-10-08T20:17:36.940" Score="3" Body="&lt;p&gt;I assume you're asking about &lt;a href=&quot;https://support.google.com/adwords/answer/3103357?hl=en&quot; rel=&quot;nofollow&quot;&gt;AdWords&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forgive me if I need to ask this but who developed your website? It sounds like you need to have your developer add that bit to the website's code. (If you're actually a developer and I'm talking under your knowledge, go ahead and modify your question!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, if have access to ftp or some other form of modifying files on your server, you can add it yourself. (Before you modify any file, make a duplicate copy in case you have to go back.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact place is going to depend on your templates, located in the &lt;code&gt;craft/templates/&lt;/code&gt; and likely in the &lt;code&gt;_layout.html&lt;/code&gt; (or some other file like &lt;code&gt;header.html&lt;/code&gt; or &lt;code&gt;footer.html&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running Google Analytics (which is a safe bet, since you're using AdWords), the easiest way to do it would be to &lt;a href=&quot;https://support.google.com/analytics/answer/2444872#trackingcode&quot; rel=&quot;nofollow&quot;&gt;add a line to your GA tracking code&lt;/a&gt; which probably is already installed.  Just look for &lt;code&gt;ga('send', 'pageview');&lt;/code&gt; and add &lt;code&gt;ga('require', 'displayfeatures');&lt;/code&gt; right above that, as in the example given on the page (assuming you're using their newer Universal code).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-10-08T23:28:15.750" LastActivityDate="2015-10-08T23:28:15.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11822" PostTypeId="1" AcceptedAnswerId="11831" CreationDate="2015-10-08T20:31:25.177" Score="2" ViewCount="291" Body="&lt;p&gt;How can I avoid local specific templates? I'd like just to use one template for all languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current template structure is extending layouts/_base, and layout/_site [similar to happylager demo] and I have a template called 'help' but i dont want to set 'fr/help', 'es/help'&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2015-10-09T06:02:13.483" Title="Single template for multiple locales" Tags="&lt;localization&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11823" PostTypeId="2" ParentId="11816" CreationDate="2015-10-08T20:59:21.227" Score="2" Body="&lt;p&gt;This is happening because currently it’s not possible for Assets fields to resolve those dynamic subfolder paths until the element the field is associated with has been saved (in this case, your Matrix block).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create a new block, click the “Save and continue editing” button (or Command/Ctrl + S), then you should be able to see all of the existing images within the dynamic subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;http://buildwithcraft.com/updates#build2697&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4.2697&lt;/a&gt;, Craft now does attempt to resolve dynamic subfolder paths. If there’s nothing that &lt;em&gt;requires&lt;/em&gt; that the element already be saved (e.g. &lt;code&gt;{id}&lt;/code&gt;), it will go ahead and use the resolved path rather than the temp folder.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-15T20:05:54.303" LastActivityDate="2015-10-15T20:05:54.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11825" PostTypeId="1" AcceptedAnswerId="11826" CreationDate="2015-10-08T23:35:45.073" Score="2" ViewCount="778" Body="&lt;p&gt;I would like to get the last string of a entry title and order entries based on that. Basically the &lt;code&gt;people&lt;/code&gt; title are their full names and I am trying to find their last name and filter based on that, instead of their first name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('people').order('title').limit(0) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;similar to this &lt;code&gt;entry.title|split(' ')|last&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3652" LastEditorUserId="3652" LastEditDate="2015-10-09T00:00:25.613" LastActivityDate="2015-10-09T00:21:21.443" Title="Order entries based on last string of title" Tags="&lt;entries&gt;&lt;entry&gt;&lt;order&gt;&lt;set&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11826" PostTypeId="2" ParentId="11825" CreationDate="2015-10-09T00:02:49.370" Score="3" Body="&lt;p&gt;It’s not possible to do that unless you’ve already got the last word saved somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s what I would recommend:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create two new Plain Text fields - “First Name” and “Last Name”&lt;/li&gt;&#xA;&lt;li&gt;Go to your People section’s entry type settings&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Uncheck the “Show the Title field?” setting and set the “Title Format” setting to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{firstName} {lastName}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add the “First Name” and “Last Name” fields to the entry type’s field layout&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Save the entry type&lt;/li&gt;&#xA;&lt;li&gt;Update your existing People entries&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With those changes made, you will now be able to order directly by your Last Name field’s values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('people').order('lastName asc').limit(0) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-09T00:02:49.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11827" PostTypeId="2" ParentId="11825" CreationDate="2015-10-09T00:21:21.443" Score="4" Body="&lt;p&gt;Another option is to use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse&lt;/a&gt; plugin to automatically parse out and store last names in a hidden field.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Install the Preparse plugin&lt;/li&gt;&#xA;&lt;li&gt;Create a new “Last Name” field using the Preparse field type&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the field’s Twig template setting to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title|split(' ')|last }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edit the People section’s entry type settings, and add the Last Name field to its field layout.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Edit the People section’s main settings - just re-save them, so that all of your existing entries get updated.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now when your People entries are saved, the last word in their Title will be copied over to a hidden “Last Name” field, and you can sort by that in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('people').order('lastName asc').limit(0) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-09T00:21:21.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11828" PostTypeId="1" AcceptedAnswerId="11829" CreationDate="2015-10-09T00:58:02.947" Score="4" ViewCount="717" Body="&lt;p&gt;I'm trying to include a PHP file (&lt;a href=&quot;https://github.com/Wolfcast/BrowserDetection&quot; rel=&quot;nofollow&quot;&gt;BrowserDetection&lt;/a&gt;) within my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::import('plugins.myPlugin.resources.php.BrowserDetection');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which doesn't return any errors, but also doesn't work. I've also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require_once 'resources/php/BrowserDetection.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which does pull in the file, but each time I tried to refer to it like: &quot;$browser = new BrowserDetection();&quot; I get something like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Class 'Craft\BrowserDetection' not found in /Volumes/Mark&#xA;  Notton/Clients/The STC/Website/craft/plugins/myPlugin/MyPlugin.php on line&#xA;  33&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Apologies for the very noob question. I just don't understand how to pull in additional PHP resources. Perhaps I'm overlooking some bespoke craft syntax?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-10-09T02:26:40.687" Title="Include a PHP resource within a Plugin" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11829" PostTypeId="2" ParentId="11828" CreationDate="2015-10-09T02:17:02.270" Score="4" Body="&lt;p&gt;The first one example should work as long as the last &lt;code&gt;BrowserDetection&lt;/code&gt; segment maps to the actual &lt;code&gt;BrowserDetection.php&lt;/code&gt; file on the file system.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Class 'Craft\BrowserDetection' not found in /Volumes/Mark Notton/Clients/The STC/Website/craft/plugins/myPlugin/MyPlugin.php on line 33&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'd still even get that error on the first one because the &lt;code&gt;BrowserDetection&lt;/code&gt; class is in PHP's global namespace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$browser = new \BrowserDetection();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-09T02:26:40.687" LastActivityDate="2015-10-09T02:26:40.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11831" PostTypeId="2" ParentId="11822" CreationDate="2015-10-09T06:02:13.483" Score="2" Body="&lt;p&gt;The best solution is to use sections / entries for ALL of your templates. This not only allows to automatically route each local's page URL to a single template, it also makes it possible to set local specific slugs for each entry. You might not care for translated URLs, but Google does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I recommend is to restructure your setup a bit, add a bunch of singles or even better, a structure named &quot;pages&quot;, and set the path to your templates in the section settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-09T06:02:13.483" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11832" PostTypeId="2" ParentId="11807" CreationDate="2015-10-09T06:16:22.230" Score="1" Body="&lt;p&gt;Do you render the content of your array right after you inserted the elements? Yes? Then what about using a conditional checking the &lt;code&gt;loop.index&lt;/code&gt; in your output loop to render your special inserted content at defined loop positions?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index == 2 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index in [2, 5, 13] %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-09T06:16:22.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11833" PostTypeId="2" ParentId="11780" CreationDate="2015-10-09T07:20:21.627" Score="3" Body="&lt;p&gt;I highly recommend to use the fantastic &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse&lt;/a&gt; plugin to save to length of your body text in a hidden field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create and add a new &quot;bodyLength&quot; Preparse field to your &quot;Artists&quot; entry type. Use this Twig code in the field settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To update all existing entries, re-save them by going into Settings → Sections → Artists and click Save.&#xA;You can now simply set up a criteria model to query for entries with a body length greater than 100 like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('artists').bodyLength('&amp;gt; 100') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-09T07:20:21.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11834" PostTypeId="1" CreationDate="2015-10-09T14:04:16.297" Score="0" ViewCount="30" Body="&lt;p&gt;I'm looking for a way to execute some code before the whole system loads, more precisely right before plugins are loaded/executed.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use case&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to instanciate a custom object, that I need to interact with in my plugin, but I cannot declare it INSIDE my plugin. This object should actually be available in all plugins if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where should I put such code so it is reusable ?&#xA;Thanks a lot !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2015-10-09T23:37:10.133" Title="Execute code before plugins are executed" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11835" PostTypeId="1" AcceptedAnswerId="11841" CreationDate="2015-10-09T17:10:14.157" Score="0" ViewCount="504" Body="&lt;p&gt;In the CP I have a table field called &lt;code&gt;colors&lt;/code&gt;. I have two columns, &quot;Label&quot; and &quot;Value&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have populated the table with two default values &quot;Red&quot; and &quot;Blue&quot; (attached).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uZnIX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uZnIX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This table will ultimately populate a dropdown on the front end. Label being the label, and value being the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I edit the entry that I have assigned the &lt;code&gt;colors&lt;/code&gt; field to, the default values do not show. I can only choose &quot;Add a row&quot;. I &lt;em&gt;do&lt;/em&gt; want to be able to add/remove rows like this, but I'd like to have &quot;Red&quot; and &quot;Blue&quot; be there by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F19RG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F19RG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the template level I create the dropdown like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.colors|length %}&#xA;&amp;lt;select id=&quot;colors&quot; name=&quot;colors&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;    {% for color in entry.colors %}&#xA;        &amp;lt;option value=&quot;{{ color.value }}&quot;&amp;gt;{{ color.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The drop down does not show until I enter a value in the entry. I'm not sure what I'm doing wrong so that the drop down will pull in the default values by...default.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-10-09T23:11:00.610" Title="How can I populate a dropdown via table field type using the default values?" Tags="&lt;table-field&gt;&lt;drop-down&gt;&lt;default&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11836" PostTypeId="1" CreationDate="2015-10-09T18:41:10.123" Score="2" ViewCount="344" Body="&lt;p&gt;First, I just took over administration of our Craft site from a previous employee, and the original site was set up by a contractor, so I'm still trying to figure things out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yesterday it was reported that people can't log into the control panel anymore.  The login page loads, you enter your creds, and it just brings you right back to the login page, no errors.  We've tried entering an invalid password, and then we do get an error message, so it's checking something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be greatly appreciated.  I feel like I have inherited a mess where the Craft site is running in Azure as a web instance along with the MySQL, but some assets are coming from AWS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4182" LastEditorUserId="4215" LastEditDate="2016-06-01T06:12:02.903" LastActivityDate="2016-06-01T06:12:02.903" Title="control panel login redirects back to login" Tags="&lt;control-panel&gt;&lt;redirect&gt;&lt;login&gt;&lt;htaccess&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11837" PostTypeId="1" AcceptedAnswerId="11839" CreationDate="2015-10-09T19:50:06.430" Score="1" ViewCount="552" Body="&lt;p&gt;I've been trying to clean up my &lt;code&gt;elementapi.php&lt;/code&gt; file, and one very important step in making it more DRY is to have reusable transformer classes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot seem to get it to work, the following gives me a blank page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far in my &lt;code&gt;elementapi.php&lt;/code&gt; file I have the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/articles' =&amp;gt; function() {&#xA;// I have also tried to place this line at the very top of the file.            &#xA;require_once craft()-&amp;gt;path-&amp;gt;getConfigPath().'transformers/EntryInfoTransformer.php';&#xA;&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'blog',&#xA;                'order' =&amp;gt; 'postDate desc',&#xA;            ],&#xA;&#xA;            'elementsPerPage' =&amp;gt; 5,&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'transformer' =&amp;gt; new EntryInfoTransformer(),&#xA;        },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my EntryInfoTransformer.php file has &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;require craft()-&amp;gt;path-&amp;gt;getPluginsPath().'elementapi/vendor/autoload.php';&#xA;&#xA;use League\Fractal\TransformerAbstract;&#xA;class EntryInfoTransformer extends TransformerAbstract{&#xA;    public function transform(EntryModel $entry) {&#xA;        return [&#xA;            'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        ]&#xA;    },&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't get any errors, nothing in either the php or craft logs, just a blank while page. This has been tested on php 5.5 &amp;amp; 5.6. Site runs normally otherwise.&lt;/p&gt;&#xA;" OwnerUserId="284" LastEditorUserId="9" LastEditDate="2015-10-20T21:30:28.127" LastActivityDate="2015-10-20T21:30:28.127" Title="How do I create an external transformer class when using the ElementApi plugin?" Tags="&lt;php&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11838" PostTypeId="1" CreationDate="2015-10-09T19:50:37.687" Score="3" ViewCount="539" Body="&lt;p&gt;Whether I use an HTML email template or not, there are a few problems with the activation email link that appears as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://localhost.dev/actions/users/verifyemail?code=lzxmSVbLE~scHE5KPuL7Rk2oZqJbafyD&amp;amp;id=c3b6d053-2d69-43a8-9b1a-3210df88993c&quot; rel=&quot;nofollow&quot;&gt;http://localhost.dev/actions/users/verifyemail?code=lzxmSVbLE~scHE5KPuL7Rk2oZqJbafyD&amp;amp;id=c3b6d053-2d69-43a8-9b1a-3210df88993c&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Links output as URLs in emails unfortunately tend to trigger spam filters. It's best practice to ensure that you're always wrapping links around real text, not the same URL, linked.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More importantly, that link consistently breaks on the &lt;code&gt;/verifyemail...&lt;/code&gt; portion (I'm viewing it in the Fastmail web client) and is not clickable. This occurs with the basic notification formatting, and within my HTML email template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I tried wrapping the link in HTML markup under Email Settings -&gt; Messages, and included &lt;code&gt;autoescape false&lt;/code&gt; in my HTML email template (around &lt;code&gt;{{body}}&lt;/code&gt;), but I get escaped HTML in the email. (I'm assuming that's because you're using the same message text for multipart HTML &amp;amp; text emails.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Is there any way available presently to apply the activation link to linked text rather than outputting it directly in the email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is a subscription site allowing users to self-register, so a non-clickable link in an email is one more hurdle I'd like to avoid.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2017-11-30T10:36:47.773" Title="Applying the activation link to linked text in the notification email" Tags="&lt;templating&gt;&lt;emails&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11839" PostTypeId="2" ParentId="11837" CreationDate="2015-10-09T20:16:44.027" Score="2" Body="&lt;p&gt;You're getting a whitescreen because you've got some PHP syntax errors in both files. Craft isn't reporting them because those config files get loaded before Craft has had a chance to bootstrap.  The underlying errors should be recorded in your web server's error logs depending on your default server configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elementapi.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;require_once craft()-&amp;gt;path-&amp;gt;getConfigPath().'transformers/EntryInfoTransformer.php';&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/articles' =&amp;gt; function() {&#xA;            return [&#xA;                'criteria'        =&amp;gt; [&#xA;                    'section' =&amp;gt; 'blog',&#xA;                    'order'   =&amp;gt; 'postDate desc',&#xA;                ],&#xA;                'elementsPerPage' =&amp;gt; 5,&#xA;                'elementType'     =&amp;gt; 'Entry',&#xA;                'transformer'     =&amp;gt; new EntryInfoTransformer(),&#xA;            ];&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EntryInfoTransformer.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;require craft()-&amp;gt;path-&amp;gt;getPluginsPath().'elementapi/vendor/autoload.php';&#xA;&#xA;use League\Fractal\TransformerAbstract;&#xA;&#xA;class EntryInfoTransformer extends TransformerAbstract&#xA;{&#xA;    public function transform(EntryModel $entry){&#xA;        return [&#xA;            'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-09T21:04:12.757" LastActivityDate="2015-10-09T21:04:12.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11840" PostTypeId="1" AcceptedAnswerId="11843" CreationDate="2015-10-09T23:05:31.033" Score="1" ViewCount="151" Body="&lt;p&gt;Google Analytics provides a &lt;a href=&quot;https://developers.google.com/analytics/devguides/collection/protocol/v1/&quot; rel=&quot;nofollow&quot;&gt;server-side API&lt;/a&gt; for sending data to their servers; this is the generally approved way of tracking views of a page that can't include Javascript, such as an RSS feed. You just send a specially formatted http request to Google's servers when the page is requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone got a plugin or other solution for sending either (a) GA requests specifically or (b) just HTTP requests in general from a Craft template? If so, then I can set that template not to cache, and get at least some rough idea of how many views I've got on the feed. (And if not, I'll break down and write my own plugin, but I'm hoping not to have to.)&lt;/p&gt;&#xA;" OwnerUserId="118" LastActivityDate="2015-10-10T00:28:08.867" Title="Adding Google Analytics to an RSS feed via server-side tracking?" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11841" PostTypeId="2" ParentId="11835" CreationDate="2015-10-09T23:11:00.610" Score="2" Body="&lt;p&gt;You will only get the defaults for new entries.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-09T23:11:00.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11842" PostTypeId="2" ParentId="11834" CreationDate="2015-10-09T23:37:10.133" Score="1" Body="&lt;p&gt;You could put that code in index.php, before the &lt;code&gt;require_once&lt;/code&gt; line. That’s about as early in the request as you can get ;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-09T23:37:10.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11843" PostTypeId="2" ParentId="11840" CreationDate="2015-10-10T00:28:08.867" Score="4" Body="&lt;p&gt;I don't know of any off-the-shelf plugins that do it, but it seems like it'd be simple enough to set up, based on existing code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft includes Guzzle which will make calling GA (or any web service) pretty easy. Trevor Davis' &lt;a href=&quot;https://github.com/davist11/craft-guzzle&quot; rel=&quot;nofollow&quot;&gt;craft-guzzle&lt;/a&gt; has some code you could use as a starting point.  Just perusing the GA docs, you'll need to do use &lt;code&gt;POST&lt;/code&gt; instead of &lt;code&gt;GET&lt;/code&gt; but some of plumbing is already done.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-10-10T00:28:08.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11844" PostTypeId="1" AcceptedAnswerId="11845" CreationDate="2015-10-10T10:06:52.220" Score="3" ViewCount="899" Body="&lt;p&gt;I have installed and built a website using Craft CMS (with latest updates). I'm running this Craft installation on a Homestead virtual machine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I enabled localization and translated entries in a structure section, the url opens a 404 page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my setup I have two locales &lt;code&gt;nb_no&lt;/code&gt; and &lt;code&gt;en&lt;/code&gt;. Both locales are enabled for the section &lt;code&gt;artists&lt;/code&gt;. Both locales are using the same url structure for entries: &lt;code&gt;artists\{slug}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My configuration for &lt;code&gt;siteUrl&lt;/code&gt; is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://page.craft.dev/en/',&#xA;    'nb_no' =&amp;gt; 'http://page.craft.dev',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Debbuging the problem I see that there is an error in &lt;code&gt;TemplatesController.php&lt;/code&gt;. In the function &lt;code&gt;actionRender($template, array $variables = array())&lt;/code&gt; the value of &lt;code&gt;$template&lt;/code&gt; is &lt;code&gt;en/artists/andre-bratten&lt;/code&gt; instead of &lt;code&gt;artists/_entry&lt;/code&gt; as is the case for the main language entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further exploration of logs shows me that Craft executes the following query which returns no result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[09:30:32.080][trace][system.db.CDbCommand]&#xA;Querying SQL: SELECT `elements`.`id`, `elements`.`type`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;WHERE (elements_i18n.uri = :uri) AND (elements_i18n.locale = :locale) AND (elements_i18n.enabled = 1) AND (elements.enabled = 1) AND (elements.archived = 0). Bound with :uri='en/artists/andre-bratten', :locale='nb_no'&#xA;in /home/vagrant/web/ekko/craft/app/services/ElementsService.php (151)&#xA;in /home/vagrant/web/ekko/craft/app/etc/web/UrlManager.php (281)&#xA;in /home/vagrant/web/ekko/craft/app/etc/web/UrlManager.php (140)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my database &lt;code&gt;elements_i18n&lt;/code&gt; table the entries both have &lt;code&gt;uri = &quot;artists/andre-bratten&quot;&lt;/code&gt; and different locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well there is a problem with wrong locale in the sql query (&lt;code&gt;nb_no&lt;/code&gt; instead of &lt;code&gt;en&lt;/code&gt;). I set &lt;code&gt;CRAFT_LOCALE&lt;/code&gt; to &lt;code&gt;en&lt;/code&gt; in the &lt;code&gt;public\en\index.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I'm rereading this I think that there could be a problem with resolving the correct path (i.e. removing &lt;code&gt;en/&lt;/code&gt; from the front) when the locale is set incorrectly. Does anyone have any ideas why this is happening?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I found out that when I access &lt;code&gt;http:\\page.craft.dev\en\&lt;/code&gt; I am loading &lt;code&gt;public\en\index.php&lt;/code&gt;. However when I access &lt;code&gt;http:\\page.craft.dev\en\artists\{slug}&lt;/code&gt; it loads &lt;code&gt;public\index.php&lt;/code&gt;. So I assume there is a problem with Homestead and nginx?&lt;/p&gt;&#xA;" OwnerUserId="4183" LastEditorUserId="4183" LastEditDate="2015-10-10T10:51:01.563" LastActivityDate="2015-10-10T11:52:39.860" Title="Translated entry page can not be found (404)" Tags="&lt;localization&gt;&lt;database&gt;&lt;request&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11845" PostTypeId="2" ParentId="11844" CreationDate="2015-10-10T11:52:39.860" Score="3" Body="&lt;p&gt;The issue appeared to be the nginx config. I updated it according to an example from here (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx&quot;&gt;Locales sub directories on Nginx&lt;/a&gt;) and it started working.&lt;/p&gt;&#xA;" OwnerUserId="4183" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-10-10T11:52:39.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11846" PostTypeId="1" AcceptedAnswerId="11847" CreationDate="2015-10-10T15:55:40.607" Score="2" ViewCount="84" Body="&lt;p&gt;I´m making a Slideshow section, where you create slides ( image, text.. ) and there is one field to specify where the slide links to. This link could be any section of the website. I use entries field to list all websites section, but I need to be able to point to structure or channel directly ( for example, I have a events channel and should be able to point directly to the events list instead of select one specific event).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3985" LastEditorUserId="22" LastEditDate="2017-05-09T23:19:59.547" LastActivityDate="2017-05-09T23:19:59.547" Title="Point directly to a structure or channel with Entries field" Tags="&lt;field&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11847" PostTypeId="2" ParentId="11846" CreationDate="2015-10-10T17:05:23.087" Score="1" Body="&lt;p&gt;An entries field will not let you select sections. You are better off using a plugin like &lt;a href=&quot;https://github.com/davist11/craft-listing-section&quot; rel=&quot;nofollow&quot;&gt;this one by Trevor Davis&lt;/a&gt; to allow users to select a section.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-10T17:05:23.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11848" PostTypeId="2" ParentId="11846" CreationDate="2015-10-10T19:01:15.363" Score="2" Body="&lt;p&gt;In addition to Aaron's answer, is there a specific page that is going to list the events on the front end? I'm assuming you're probably outputting the events list (for example) via that channel's index page now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's nice about Craft is there's lots of way to skin the cat here. It also does some things that aren't necessarily intuitive, like in this case: there's not really a great way to handle the content of the &quot;index&quot; directly or link to it without a couple workarounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Linking to a specific section&lt;/strong&gt; is a little too far removed for my taste but on certain sites with a ton of different sections, I can see where it might be a necessary evil to keep things sane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Depending on the complexity of the site, I've found creating a master &lt;code&gt;Pages&lt;/code&gt; structure&lt;/strong&gt; that can also double as the navigation to be an option. Authors can see a bird's eye view of their content in Craft's nice tree view. If the top level section happens to be another Channel or Structure, for example, then you can bring it in via your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing it that way also gives the benefit of being able to put in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1302/how-to-create-a-cms-editable-channel-section-index-page&quot;&gt;introductory text&lt;/a&gt; for that section. For example, a Careers page might want to have details about the company before you bring in the jobs; or your Events page might want to mention something about requiring registration, etc.  That makes your Twig logic a bit more complex or tie up an Entry Type depending on what you're doing but it can be manageable. &lt;a href=&quot;https://craftcms.stackexchange.com/a/4710/1016&quot;&gt;This question&lt;/a&gt; goes into more detail about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some people have also used &lt;code&gt;Singles&lt;/code&gt;&lt;/strong&gt; in this way. I find Singles not that useful but again YYMV. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It would be great to be able to have a Single's functionality—a one-off field layout—in a Structure without having to resort to having to create another entry type that a user can change—but that would be a &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7195394-restrict-entry-types-to-certain-levels-in-structure&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature suggestion&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-10T19:12:15.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11849" PostTypeId="2" ParentId="10788" CreationDate="2015-10-10T21:12:01.487" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update: This bug is fixed as of Craft 2.4.2697&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Images uploaded from iOS now get renamed to&#xA;  “image_YYYYMMDD_HHMMSS.ext” (from “image.ext”), fixing a bug where iOS&#xA;  uploads would fail after the 51st image due to Craft’s limit on&#xA;  allowed same-name uploads.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;iOS uploads images from the camera roll with the name image.jpg, and if this happens multiple times then an incremental number is appended to the filename, similar to what happens with slugs. I have found that after 50 such instances though, the error message you reported starts to appear and images cannot be uploaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a bug in Craft and P&amp;amp;T will hopefully release a fix soon, but a temporary solution is to rename some uploaded files so that the 50 limit is not reached. Alternatively, you could make the entry slug part of the upload path to avoid reaching the limit. &lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2015-10-16T08:45:51.743" LastActivityDate="2015-10-16T08:45:51.743" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11850" PostTypeId="1" CreationDate="2015-10-11T01:39:30.980" Score="9" ViewCount="4300" Body="&lt;p&gt;I made my first Craft site with MAMP locally. I am trying to get my site running on AWS but I'm having a hard time with understanding the process.&#xA;Are there any good tutorials or suggestions about how to deploy it? &lt;/p&gt;&#xA;" OwnerUserId="4186" LastEditorUserId="9" LastEditDate="2015-10-15T20:55:17.227" LastActivityDate="2020-05-29T15:19:52.823" Title="Deploying Craft on AWS" Tags="&lt;deployment&gt;&lt;hosting&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11852" PostTypeId="1" CreationDate="2015-10-11T07:21:25.057" Score="2" ViewCount="514" Body="&lt;p&gt;I made a plugin which count the number of users per groups defined by the field &lt;code&gt;accent&lt;/code&gt; which is a text field and can be &lt;strong&gt;empty&lt;/strong&gt; or contain &lt;strong&gt;numbers&lt;/strong&gt; from 0 to 12.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCountUsers() {&#xA;&#xA;    // Delete all the entry caches&#xA;    craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementType('User');&#xA;&#xA;    // Now find the entry IDs&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('User', array('group' =&amp;gt; 'unepMembers', 'limit' =&amp;gt; null, 'status' =&amp;gt; null, 'localeEnabled' =&amp;gt; null));&#xA;    $criteria-&amp;gt;group = 'unepMembers';&#xA;    $criteria-&amp;gt;limit = null;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;localeEnabled = null;&#xA;&#xA;    //&#xA;    $totalEntries = $criteria-&amp;gt;total();&#xA;    UnepPlugin::log($totalEntries.' USERS (no criteria)', LogLevel::Warning);&#xA;&#xA;    //&#xA;    $criteria-&amp;gt;accent = '';&#xA;    $totalEntries = $criteria-&amp;gt;total();&#xA;    UnepPlugin::log($totalEntries.' USERS with empty accent', LogLevel::Warning);&#xA;&#xA;    //&#xA;    $totalUsers = 0;&#xA;    for ($i = 0; $i &amp;lt;= 15; $i++) {&#xA;        $criteria-&amp;gt;accent = $i;&#xA;        $totalEntries = $criteria-&amp;gt;total();&#xA;        MigPlugin::log($totalEntries.' USERS with accent :'.$criteria-&amp;gt;accent, LogLevel::Warning);&#xA;&#xA;        $totalUsers = $totalUsers + $totalEntries;&#xA;    }&#xA;    MigPlugin::log($totalUsers.' USERS with accents', LogLevel::Warning);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see the result here below there is a problem with a criteria values &lt;strong&gt;empty&lt;/strong&gt; or &lt;strong&gt;0&lt;/strong&gt; on the &lt;code&gt;accent&lt;/code&gt; field: they just do not work and count the total number of users.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;***********************&#xA;2015/10/11 07:09:48 [warning] [plugin] 3109 USERS (no criteria)  &#xA;2015/10/11 07:09:48 [warning] [plugin] 3109 USERS with empty accent  &#xA;2015/10/11 07:14:01 [warning] [plugin] 3109 USERS with accent :0  &#xA;2015/10/11 07:09:48 [warning] [plugin] 1849 USERS with accent :1  &#xA;2015/10/11 07:09:48 [warning] [plugin] 501 USERS with accent :2  &#xA;2015/10/11 07:09:48 [warning] [plugin] 0 USERS with accent :3  &#xA;2015/10/11 07:09:48 [warning] [plugin] 72 USERS with accent :4  &#xA;2015/10/11 07:09:49 [warning] [plugin] 8 USERS with accent :5  &#xA;2015/10/11 07:09:49 [warning] [plugin] 1 USERS with accent :6  &#xA;2015/10/11 07:09:49 [warning] [plugin] 0 USERS with accent :7  &#xA;2015/10/11 07:09:49 [warning] [plugin] 4 USERS with accent :8  &#xA;2015/10/11 07:09:49 [warning] [plugin] 81 USERS with accent :9  &#xA;2015/10/11 07:09:49 [warning] [plugin] 232 USERS with accent :10  &#xA;2015/10/11 07:09:49 [warning] [plugin] 246 USERS with accent :11  &#xA;2015/10/11 07:09:49 [warning] [plugin] 115 USERS with accent :12  &#xA;2015/10/11 07:09:49 [warning] [plugin] 0 USERS with accent :13  &#xA;2015/10/11 07:09:49 [warning] [plugin] 0 USERS with accent :14  &#xA;2015/10/11 07:09:49 [warning] [plugin] 0 USERS with accent :15  &#xA;2015/10/11 07:09:49 [warning] [plugin] 3109 USERS with accents  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft bug or did I miss something in my code?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-10-11T10:38:53.523" Title="Plugins with element criteria selection does not work for empty or zero values" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11853" PostTypeId="2" ParentId="11852" CreationDate="2015-10-11T10:38:53.523" Score="3" Body="&lt;p&gt;When you do this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria-&amp;gt;accent = '';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft is going to look for users where the &lt;code&gt;accent&lt;/code&gt; field’s DB cell is an empty string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those values are probably &lt;code&gt;null&lt;/code&gt; though, if they aren’t getting returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting your &lt;code&gt;accent&lt;/code&gt; param to &lt;code&gt;:empty:&lt;/code&gt; instead of &lt;code&gt;''&lt;/code&gt;. When you do that, Craft will search for both empty strings &lt;em&gt;and&lt;/em&gt; &lt;code&gt;null&lt;/code&gt; values, so you should get the results you’re expecting.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-11T10:38:53.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11854" PostTypeId="1" CreationDate="2015-10-11T12:02:38.997" Score="0" ViewCount="163" Body="&lt;p&gt;I made a plugin to update my 3000 users. It is kind of a toolbox to manage and update some users fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calling the controller directly through its url action.&lt;br&gt;&#xA;It is working basically but it stops after 20 seconds when updating too many users, and display a white page in browser, no results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see in my plugin log it updated some few lines before stopping.&lt;br&gt;&#xA;I checked php and craft logs and cannot see any error information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;public function actionUsersFix() {&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Delete all the entry caches&#xA;    craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementType('User');&#xA;&#xA;    // Now find the entry IDs&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('User', array('group' =&amp;gt; 'migMembers', 'limit' =&amp;gt; null, 'status' =&amp;gt; null, 'localeEnabled' =&amp;gt; null));&#xA;    $criteria-&amp;gt;group = 'migMembers';&#xA;    $criteria-&amp;gt;limit = null;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;localeEnabled = null;&#xA;    $criteria-&amp;gt;accent = '2';&#xA;&#xA;    $userIds = $criteria-&amp;gt;ids();&#xA;    //$totalEntries = count($userIds);&#xA;&#xA;    //&#xA;    foreach ($userIds as $userId)&#xA;    {&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;        $oldAccent = $user-&amp;gt;accent;&#xA;        $newAccent = '3';&#xA;&#xA;        $user-&amp;gt;getContent()-&amp;gt;accent = $newAccent;&#xA;        $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;        MigPlugin::log('User '.$user-&amp;gt;email.' - accent = '. $oldAccent .' - modified = '.$newAccent, LogLevel::Warning);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-10-11T12:14:06.393" Title="Craft plugin controller for batch update users break with empty page" Tags="&lt;plugin-development&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11855" PostTypeId="2" ParentId="11854" CreationDate="2015-10-11T12:08:42.027" Score="1" Body="&lt;p&gt;It was a php.ini config problem, I put some parameters values up and the update succeeded in less than 2 minutes and completed my users batch update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you just need to update the values below and &lt;code&gt;reload&lt;/code&gt; your web server (ie: Apache).  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_execution_time 120 (instead of initial value 30)  &#xA;memory_limit 512M (instead of initial value 128M)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2015-10-11T12:14:06.393" LastActivityDate="2015-10-11T12:14:06.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11856" PostTypeId="1" AcceptedAnswerId="11861" CreationDate="2015-10-12T09:53:32.837" Score="1" ViewCount="105" Body="&lt;p&gt;Assuming that you're using Craft Pro, is it possible to change the URL from the long randomly generated character string to something more user friendly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently: &lt;a href=&quot;http://83af0ee9e3c8cba9844f-a33048c0ede2332addff32deec6d7158.r40.cf3.rackcdn.com/subFolder/randomImage.png&quot; rel=&quot;nofollow&quot;&gt;http://83af0ee9e3c8cba9844f-a33048c0ede2332addff32deec6d7158.r40.cf3.rackcdn.com/subFolder/randomImage.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4119" LastEditorUserId="57" LastEditDate="2015-10-12T15:25:30.567" LastActivityDate="2015-10-12T15:25:30.567" Title="Can you change the URL for Assets uploaded to a Rackspace CDN?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11857" PostTypeId="1" AcceptedAnswerId="11859" CreationDate="2015-10-12T10:00:48.447" Score="1" ViewCount="897" Body="&lt;p&gt;Is it possible to output a &lt;code&gt;getSegments()&lt;/code&gt; array in a template to then run conditions on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can output one segment fine using &lt;code&gt;getSegment()&lt;/code&gt;, but if I try to select one or more segments using &lt;code&gt;getSegments()&lt;/code&gt; it outputs 'Array'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="4083" LastActivityDate="2015-10-12T10:39:47.000" Title="Output getSegments() array in template" Tags="&lt;templating&gt;&lt;array&gt;&lt;getsegment&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11858" PostTypeId="1" AcceptedAnswerId="11860" CreationDate="2015-10-12T10:27:08.710" Score="1" ViewCount="2003" Body="&lt;p&gt;How can I create a variable that is a combination of two variables with text?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I know the following is wrong but is something like this possible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = 'foo' %}&#xA;{% set bar = 'bar' %}&#xA;{% set foobar = 'Hello' foo,bar %}&#xA;{{ foobar }} #Outputs Hello foobar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4083" LastActivityDate="2015-10-12T10:47:24.520" Title="Combine variables with text to make variable" Tags="&lt;variable&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11859" PostTypeId="2" ParentId="11857" CreationDate="2015-10-12T10:39:47.000" Score="1" Body="&lt;p&gt;That's because &lt;code&gt;getSegments()&lt;/code&gt; returns an array. You can either get one of those segments by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.request.getSegments() %}&#xA;{{ segments[0] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or loop through all returned segments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for segment in craft.request.getSegments() %}&#xA;    {{ segment }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-10-12T10:39:47.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11860" PostTypeId="2" ParentId="11858" CreationDate="2015-10-12T10:42:13.907" Score="2" Body="&lt;p&gt;You can concatenate variables like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = 'foo' %}&#xA;{% set bar = 'bar' %}&#xA;{% set foobar = 'Hello' ~ foo ~ bar %}&#xA;{{ foobar }} #Outputs Hello foobar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's explained by Brandon &lt;a href=&quot;https://github.com/brandonkelly/TwigForDesigners/blob/master/values-expressions-and-variables.md#expressions&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2015-10-12T10:47:24.520" LastActivityDate="2015-10-12T10:47:24.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11861" PostTypeId="2" ParentId="11856" CreationDate="2015-10-12T10:45:37.173" Score="1" Body="&lt;p&gt;Not really Craft related, but: for this to work in Craft, you should first make sure Rackspace recognizes the url you want to use. They explain how to do this &lt;a href=&quot;http://www.rackspace.com/knowledge_center/article/using-cnames-with-cloud-files-containers&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: create a CNAME record for your domain, pointing to your Rackspace domain. After doing that, change the display url for your asset source.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-10-12T10:45:37.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11862" PostTypeId="1" AcceptedAnswerId="11863" CreationDate="2015-10-12T11:04:54.423" Score="2" ViewCount="712" Body="&lt;p&gt;I'm trying to fetch a set of entries based on search parameters. The search is an &quot;and&quot; search, meaning that if criteria exist then they should all match for there to be a result returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have managed to get this working with all the criteria except for one which needs to match a relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code below shows what I have so far. The relationship field is named &quot;category&quot; (although this actually relates to an entry in another channel).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.request.getParam('category') ? craft.request.getParam('category') : '' %}&#xA;{% set start_date = craft.request.getParam('start_date') ? craft.request.getParam('start_date') : 0 %}&#xA;{% set wage_from = craft.request.getParam('wage_from') ? craft.request.getParam('wage_from') : 0 %}&#xA;{% set wage_to = craft.request.getParam('wage_to') ? craft.request.getParam('wage_to') : 9999 %}&#xA;{% set location = craft.request.getParam('location') ? craft.request.getParam('location') : '' %}&#xA;&#xA;&#xA;{% set results = craft.entries({&#xA;    section: 'vacancies',&#xA;    order: 'score',&#xA;    relatedTo: [&#xA;          'and',&#xA;          { targetElement: cat },&#xA;          { field: 'category' }&#xA;      ],&#xA;    location: [&#xA;          'and',&#xA;          '= ' ~ location&#xA;      ],&#xA;    wage: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ wage_from,&#xA;          '&amp;lt;= ' ~ wage_to,&#xA;      ],&#xA;      startDate: [&#xA;        'and',&#xA;        '&amp;gt;= ' ~ start_date&#xA;      ]&#xA;  }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It all seems to work until I add in the relationship. I know I'm not formatting this part of the query correctly but cannot work out how it should be formatted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I am searching the channel &quot;vacancies&quot;. The &quot;category&quot; field is a relationship with an entry in a channel named &quot;apprenticeshipsCategories&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2015-10-12T12:29:19.880" Title="Searching for entries across multiple fields including a relationship" Tags="&lt;relations&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11863" PostTypeId="2" ParentId="11862" CreationDate="2015-10-12T12:29:19.880" Score="2" Body="&lt;p&gt;I think I just had my Craft &quot;Lightbulb moment&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got this working now. Once I realised that I needed to retrieve the category as an object in order to match against it using relatedTo it made more sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also realised that I needed to used a wildcard rather than an empty string if a parameter was missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.request.getParam('category') ? craft.request.getParam('category') : '' %}&#xA;{% set start_date = craft.request.getParam('start_date') ? craft.request.getParam('start_date') : 0 %}&#xA;{% set wage_from = craft.request.getParam('wage_from') ? craft.request.getParam('wage_from') : 0 %}&#xA;{% set wage_to = craft.request.getParam('wage_to') ? craft.request.getParam('wage_to') : 9999 %}&#xA;{% set location = craft.request.getParam('location') ? craft.request.getParam('location') : '*' %}&#xA;&#xA;{%&#xA;  set category = craft.entries({&#xA;        section: 'apprenticeshipsCats',&#xA;        title: cat&#xA;  })&#xA;%}&#xA;&#xA;{%&#xA;  set results = craft.entries({&#xA;      section: 'vacancies',&#xA;      relatedTo: category,&#xA;      location: [&#xA;            'and',&#xA;            '= ' ~ location&#xA;        ],&#xA;        wage: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ wage_from,&#xA;          '&amp;lt;= ' ~ wage_to,&#xA;        ],&#xA;        startDate: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ start_date&#xA;        ]&#xA;    })&#xA;&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I still fetch the parameters and set default values for them, note the wildcard if &quot;Location&quot; is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then I get the category to be searched as a craft entries object.&#xA;Once I have that I can use its reference in my results query and bingo!&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2015-10-12T12:29:19.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11864" PostTypeId="1" AcceptedAnswerId="11865" CreationDate="2015-10-12T13:49:46.783" Score="2" ViewCount="242" Body="&lt;p&gt;Following on from my earlier search question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/11862/searching-for-entries-across-multiple-fields-including-a-relationship/11863&quot;&gt;Searching for entries across multiple fields including a relationship&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm finding that the min/max wage search behaves oddly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a range of wage values from 95 to 175. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I search for a min of 95 with no max then I only get results from 95 up to 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise if I search for a max value of 150 then I only get results greater than 100 and less then or equal to 150.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use both min and max criteria then I get no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing this is something to do with variable type but can't see how I can force the variables to be integers/numbers rather than strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplified code I'm using to do the matching is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set wage_from = craft.request.getParam('wage_from') ? craft.request.getParam('wage_from') : 0 %}&#xA;{% set wage_to = craft.request.getParam('wage_to') ? craft.request.getParam('wage_to') : 9999 %}&#xA;&#xA;{%&#xA;  set results = craft.entries({&#xA;      section: 'vacancies',&#xA;        wage: [&#xA;          'and',&#xA;          '&amp;gt;= ' ~ wage_from,&#xA;          '&amp;lt;= ' ~ wage_to,&#xA;        ]&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-12T13:56:49.120" Title="Min/Max numeric search returning odd results" Tags="&lt;search&gt;&lt;variable-type&gt;&lt;integer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11865" PostTypeId="2" ParentId="11864" CreationDate="2015-10-12T13:56:49.120" Score="2" Body="&lt;p&gt;Aha! Another lightbulb moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wage field was set to be plain text. I changed it to number and things work as expected.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2015-10-12T13:56:49.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11866" PostTypeId="1" CreationDate="2015-10-12T14:29:11.650" Score="5" ViewCount="368" Body="&lt;p&gt;We are building a restaurant site that has a banner image and some introductory text on each page.  For pages that include content from a Channel, e.g. the wine list, we are using a Global to define the header image and the intro text, and then a &quot;for loop&quot; for the wine entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any performance benefits to using a global versus a single?  Any other pros and cons related to those choices?&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="1098" LastEditDate="2015-10-12T18:38:07.550" LastActivityDate="2015-10-12T18:38:07.550" Title="Globals versus Singles" Tags="&lt;performance&gt;&lt;globals&gt;&lt;singles&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11867" PostTypeId="1" AcceptedAnswerId="11876" CreationDate="2015-10-12T14:37:17.167" Score="4" ViewCount="3559" Body="&lt;p&gt;I want to send an automatic back office email when user click on a button (to request support) on frontend. Then I just display a confirmation message (we ll get back to you shortly).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I made a plugin controller sending email.&lt;br&gt;&#xA;And my idea was to attach an ajax call with a &lt;code&gt;jquery on click&lt;/code&gt; stuff to that button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I did this.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// SUPPORT ADHERENT button click&#xA;$(&quot;.call-support a&quot;).on(&quot;click&quot;, function(e, visible) {&#xA;&#xA;    e.preventDefault();&#xA;&#xA;    var data = {&#xA;        // ...&#xA;    };&#xA;&#xA;    $.ajax({&#xA;        method: 'POST',&#xA;        url: '/actions/unep/toolBox/requestBrandingHelp',&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;    })&#xA;        .success(function(data) {&#xA;            console.log('success', data);&#xA;        })&#xA;        .error(function(data) {&#xA;            console.log('error', data);&#xA;        });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My controller is called and send an email but I got a 404 error from the ajax call in console:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/60Fbo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/60Fbo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked that ajax call with &lt;code&gt;Craft.postActionRequest&lt;/code&gt; here below but it is for back-end scope only.&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/3071/how-reference-craft-js-object-in-jquery-scope/3072#3072&quot;&gt;How reference &amp;quot;Craft&amp;quot; js object in jquery scope&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a bit lost how to do that correctly...&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-12T17:03:27.900" Title="Call plugin controller from frontend with ajax" Tags="&lt;plugin-development&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11868" PostTypeId="1" AcceptedAnswerId="11872" CreationDate="2015-10-12T14:50:06.897" Score="3" ViewCount="823" Body="&lt;p&gt;Is it me, or can we not search using partial words in Craft CMS? This seems to be the case in the backend when search entry titles or assets, but a client has recently pointed it out on the front-end as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we've got an entry title containing the word 'Peruvian' but searching for 'Peru' returns no results, while searching for 'Peruvian' does return a result.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-12-04T23:31:30.920" Title="How to search using partial words?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11869" PostTypeId="2" ParentId="11816" CreationDate="2015-10-12T15:04:31.243" Score="4" Body="&lt;p&gt;Okay. So, my problem was that I had multiple Asset Sources since I was trying to give my groups permissions to specific sub-directories. This was causing indexing issues which is why I wasn't seeing the images show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CraftCMS has an excellent customer support. They were able to create a plugin that allowed me give my groups permissions to their subdirectories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Link to plugin&lt;/strong&gt;: &lt;a href=&quot;https://github.com/pixelandtonic/AssetSubfolderAccess&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/AssetSubfolderAccess&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do is create your user groups. Then create an asset source configuration that points to your root folder that will contain the subdirectories. Give your user groups permission to the Asset Source (Root folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the plugin page after you have installed the plugin. Click on the plugin to go to its settings. This is where you can configure each of your user groups to only have access to their sub-folder. =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Huge thank you to CraftCMS, Pixel And Tonic, and Brandon for all the help. You guys are amazing!!! =)&lt;/p&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2015-10-12T15:04:31.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11870" PostTypeId="1" AcceptedAnswerId="11873" CreationDate="2015-10-12T15:11:20.210" Score="3" ViewCount="318" Body="&lt;p&gt;I've got an advanced search form which culminates in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('whatsOn').relatedTo(&#xA;    'and',&#xA;    { element: artCategories },&#xA;    { element: locationCategories },&#xA;    { element: bbfcCategories }&#xA;).search(searchTerm).order('score').limit(8)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but only if the item being searched for has populated &lt;code&gt;artCategories&lt;/code&gt;, &lt;code&gt;locationCategories&lt;/code&gt;, and &lt;code&gt;bbfcCategories&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any of those are optional; i.e., the &lt;code&gt;bbfcCategories&lt;/code&gt; line may not be needed at all... and likewise the searchTerm - is there a way to do this dynamically?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2015-10-12T15:33:46.797" LastActivityDate="2015-10-12T16:00:49.303" Title="Dynamic relatedTo queries" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11871" PostTypeId="1" AcceptedAnswerId="11874" CreationDate="2015-10-12T15:18:19.897" Score="4" ViewCount="1698" Body="&lt;p&gt;I thought this would be simple but I am having no luck with it. I have a channel called &quot;Posts&quot; and for each Post there an &quot;entry&quot; custom field which lists all &quot;Projects&quot; (a structure). The user can select up to 3 of these within a Post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to relate a current news Post with an existing project. In my Project entry template I basically want to check to see if the current project has been selected in the &quot;relatedProjects&quot; entry field. If it has, I need it to show a &quot;Related Posts&quot; title and then below that list each Post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing I can't fathom out is how to have a section title that doesn't appear in the loop for each Post.&lt;/p&gt;&#xA;" OwnerUserId="4173" LastEditorUserId="125" LastEditDate="2015-10-12T15:44:16.313" LastActivityDate="2015-10-12T16:15:47.153" Title="Checking if current entry exists in an entry custom field in a different entry" Tags="&lt;templating&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11872" PostTypeId="2" ParentId="11868" CreationDate="2015-10-12T15:32:21.050" Score="4" Body="&lt;p&gt;That's because Craft doesn't do fuzzy searching by default.  You'd need to use the wildcard &lt;code&gt;'Peru*'&lt;/code&gt; to match &lt;code&gt;'Peruvian'&lt;/code&gt;.  You can see the full list of supported search syntaxes here: &lt;a href=&quot;http://buildwithcraft.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related, you might want to vote for this feature request: &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8459443-add-option-to-enable-fuzzy-search-as-default&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8459443-add-option-to-enable-fuzzy-search-as-default&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;As of &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5&lt;/a&gt;, you can enable &lt;a href=&quot;https://craftcms.com/help/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;fuzzy&lt;/a&gt; searching by default.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-04T23:31:30.920" LastActivityDate="2015-12-04T23:31:30.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11873" PostTypeId="2" ParentId="11870" CreationDate="2015-10-12T16:00:49.303" Score="5" Body="&lt;p&gt;You can build the array for your criteria model's relatedTo parameter step for step before adding it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Initial criteria model #}&#xA;{% set exhibitions = craft.entries.section('exhibitions').limit(null) %}&#xA;&#xA;{# Compose relatedTo parameter #}&#xA;{% set relatedToParam = ['and'] %}&#xA;&#xA;{% if query.art is defined %}&#xA;    {% set catIds = craft.categories.group('artCategories').id(query.art).ids() %}&#xA;    {% set relatedToParam = relatedToParam|merge([{ targetElement: catIds }]) %}&#xA;{% endif %}&#xA;&#xA;{% if query.location is defined %}&#xA;    {% set catIds = craft.categories.group('locationCategories').id(query.location).ids() %}&#xA;    {% set relatedToParam = relatedToParam|merge([{ targetElement: catIds }]) %}&#xA;{% endif %}&#xA;&#xA;{# Add additional criteria. Avoid passing an array with 'and' only #}&#xA;{% if relatedToParam|length &amp;gt; 1 %}&#xA;    {% set exhibitions = exhibitions.relatedTo(relatedToParam) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-12T16:00:49.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11874" PostTypeId="2" ParentId="11871" CreationDate="2015-10-12T16:15:47.153" Score="3" Body="&lt;p&gt;You can get the posts related to your &quot;entry&quot; (the currently shown project) with a&#xA;&lt;code&gt;craft.entries&lt;/code&gt; element criteria model where you set the &lt;code&gt;relatedTo&lt;/code&gt; parameter like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedPosts = craft.entries.relatedTo({&#xA;    targetElement: entry&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then check if this does find anything using Twig's &lt;code&gt;length&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if relatedPosts|length %}&#xA;    &amp;lt;aside&amp;gt;&#xA;        {% for relatedPost in relatedPosts %}&#xA;            {{ relatedPost.title }}&#xA;        {% endfor %}&#xA;    &amp;lt;/aside&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-12T16:15:47.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11875" PostTypeId="1" AcceptedAnswerId="11893" CreationDate="2015-10-12T16:37:18.183" Score="3" ViewCount="822" Body="&lt;p&gt;Is a custom field type and making use of &lt;code&gt;modifyElementsQuery&lt;/code&gt; the only way to add my own &lt;code&gt;craft.entries&lt;/code&gt; element criteria model attribute to modify the elements query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I do not want to add a new field to each entry type I want to use my  attribute with? The field would be a hidden pseudo field anyways, as I'm &lt;strong&gt;only working with other fields' data&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current solution is passing the element criteria model with all other params set to &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;buildElementsQuery()&lt;/code&gt; using a template variable. It works, yes, but I would really like to avoid this (pagination not possible and some other disadvantages).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-05T15:03:26.123" Title="Add custom element criteria attribute without a field type?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11876" PostTypeId="2" ParentId="11867" CreationDate="2015-10-12T17:03:27.900" Score="4" Body="&lt;p&gt;I found the solution by making an application of &lt;a href=&quot;https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01&quot; rel=&quot;nofollow&quot;&gt;Front end login form with ajax&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;Posting to controller actions&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what is &lt;em&gt;really&lt;/em&gt; important to understand with Craft controller call:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Most of the time, you’ll want to access controller actions via HTML forms over POST. To do this, we recommend that you leave your form’s ‘action’ attribute blank, and specify your action via a hidden input named “action” instead:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;cocktailRecipes/ingredients/saveIngredient&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When you leave your form’s ‘action’ attribute blank, browsers will default to the current request’s URL. Which is great in the event that your controller needs to reload the previous page without a redirect. A common example of this is when the user’s input didn’t validate, and you want to pass the errors back to your template (ideally tucked away within a model).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So my solution here with the correct HTML with the form to submit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;call-support-form&quot; action=&quot;&quot; class=&quot;form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;/unep/toolBox/requestBrandingHelp&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;button&quot; type=&quot;submit&quot; value=&quot;Support adhérents&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the ajax form submit to call the controller:&lt;br&gt;&#xA;(and do whatever you want after)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// member support button click&#xA;$(&quot;#call-support-form&quot;).submit( function(e) {&#xA;&#xA;    e.preventDefault();&#xA;&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.ajax({&#xA;        method: 'POST',&#xA;        url: '/',&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;    })&#xA;        .success(function(data) {&#xA;            console.log('success', data);&#xA;        })&#xA;        .error(function(data) {&#xA;            console.log('error', data);&#xA;        });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-10-12T17:03:27.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11877" PostTypeId="1" AcceptedAnswerId="11882" CreationDate="2015-10-12T17:25:03.333" Score="2" ViewCount="1496" Body="&lt;p&gt;I'm attempting to run Craft (2.4.2696) on a server with PHP 7 RC, and I'm seeing &lt;a href=&quot;http://cly.mmikkel.no/image/310E1X203U0Y&quot; rel=&quot;nofollow&quot;&gt;the following PHP warning&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Declaration of Craft\DbCommand::addForeignKey($table, $columns, $refTable, $refColumns, $delete = NULL, $update = NULL) should be compatible with CDbCommand::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = NULL, $update = NULL)&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's only a warning, and with &lt;code&gt;devMode&lt;/code&gt; off, the site seems to function well. I'm not going to put anything that throws warnings into production, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question(s): What is the cause for this warning, and is it something I can fix myself? Does Craft officially support PHP 7?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-10-15T21:06:22.373" Title="Does Craft work with PHP 7?" Tags="&lt;php&gt;&lt;server&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11878" PostTypeId="1" AcceptedAnswerId="11919" CreationDate="2015-10-12T17:25:27.023" Score="1" ViewCount="1232" Body="&lt;p&gt;This one is new to me. I've got the timezone set in my admin panel to Denver but I get this this error when I try using a global in my template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DateTime::__construct(): Failed to parse time string (End Date) at position 0 (E): The timezone could not be found in the database&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my code in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ endDate | date(&quot;U&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My global is called End Date (endDate) and is using a date field type&lt;/p&gt;&#xA;" OwnerUserId="377" LastActivityDate="2015-10-14T23:10:16.003" Title="The timezone could not be found in the database" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11879" PostTypeId="2" ParentId="11866" CreationDate="2015-10-12T18:37:46.433" Score="7" Body="&lt;p&gt;The performance aspect is difficult to answer. On every pageload, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/templating/twigextensions/CraftTwigExtension.php#L466&quot;&gt;Craft pulls &lt;em&gt;all&lt;/em&gt; your global sets&lt;/a&gt;, which can be a performance hit, especially if you have many huge, complex global sets with a lot of fields. Any Single used in place of a global could be pulled on a need-to-use basis, i.e. not on every page, although the extra call to the EntriesService would also come at a price. In any case, I wouldn't really worry too much about it one way or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for other pros and cons – in my opinion, the pros would mainly be related to usability for your content editors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people may find it easier to work with Singles because they live inside the Entries section of the CP, i.e. together with the bulk of the site's content. This is especially relevant if the global content in question is only displayed on certain pages, e.g. a tagline which is used in the homepage's header – in which case most content editors would look at the homepage single before anywhere else, I reckon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/ExpandedSingles&quot;&gt;The Expanded Singles plugin&lt;/a&gt; even lets you list your singles in the left sidebar, making it even easier for your editors to find them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most obvious con to using singles over globals would the fact that you would have to write Twig to pull the appropriate Single anytime you needed its data, whereas any global set will always be available everywhere – i.e. writing &lt;code&gt;{{ settings.tagline }}&lt;/code&gt; is way simpler than &lt;code&gt;{{ craft.entries.section('mySettingsSingle')|length ? craft.entries.section('mySettingsSingle').first.tagline }}&lt;/code&gt; or the like – unless, of course, you add the Single(s) to the global Twig context or implement a template variable, but that would require writing a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there's no way to turn off URLs for singles – so any single you create in place of a global, you're going to have a &quot;stray&quot; URL in your system. Not a huge issue, but still.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I believe that opting for a Global Set is generally the Right Thing To Do if the content doesn't really have a place in any existing Single – rather than creating what is essentially &quot;bucket&quot; or container Singles to accommodate it. If your content editors find Globals hard to use/find, consider using the &lt;a href=&quot;https://github.com/engram-design/CPNav&quot;&gt;CP Nav plugin&lt;/a&gt; to rename the &quot;Globals&quot; tab in the CP to something a little less technical – e.g. &quot;Settings&quot; or &quot;Misc. content&quot;. Using CP Nav, you can even add tabs for specific Global Sets, with your own titles – in your case I'd consider creating a set called &quot;Listing settings&quot;, adding the fields for the header image and introductory text to that set, and finally creating a tab in CP Nav called &quot;Listings&quot; or the like (or even &quot;Wine Listing&quot; if you want to get really specific), pointing to that particular Global Set. Personally, I think Globals – if done right – is actually better for usability than Singles pretending to be something they're not.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-10-12T18:37:46.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11880" PostTypeId="1" AcceptedAnswerId="11883" CreationDate="2015-10-12T19:17:46.557" Score="2" ViewCount="345" Body="&lt;p&gt;My users have an accountBalance field and there's a createInvoice service in my plugin. I'd like to autogenerate an invoice whenever the accountBalance changes (including from the admin cp), while optionally passing in extra invoice info. Is there a way to access the raw post data from the event to check for extra info like invoice skus and descriptions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin I have the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event)&#xA;{&#xA;    $userId = $event-&amp;gt;params['user']-&amp;gt;id;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    //raw post data is private so these lines are pseudo code&#xA;    if ($extraPostData != null)&#xA;    {&#xA;        $desc = $event-&amp;gt;params['_rawPostData']['invoiceDescription'];&#xA;        $sku = $event-&amp;gt;params['_rawPostData']['invoiceSku'];&#xA;    }&#xA;&#xA;    $oldBalance = $user-&amp;gt;accountBalance;&#xA;    $newBalance = $event-&amp;gt;params['user']-&amp;gt;accountBalance;&#xA;    if ($newBalance != $oldBalance)&#xA;    {&#xA;        $balanceDelta = $newBalance - $oldBalance;&#xA;&#xA;        //plugin service has defaults if $desc/$sku are empty or null&#xA;        craft()-&amp;gt;myPlugin-&amp;gt;createInvoice($balanceDelta, $userId, $desc, $sku);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, is there a way to disable adjusting the accountBalance user field from the admin cp?&lt;/p&gt;&#xA;" OwnerUserId="3512" LastActivityDate="2015-10-12T20:56:10.160" Title="Accessing the raw post data from an $event" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;events&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11882" PostTypeId="2" ParentId="11877" CreationDate="2015-10-12T19:54:57.163" Score="4" Body="&lt;p&gt;As @mmikkel pointed out, as of &lt;a href=&quot;http://buildwithcraft.com/updates#build2697&quot; rel=&quot;nofollow&quot;&gt;Craft 2.4.2697&lt;/a&gt;, Craft is PHP 7 compatible.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-15T21:06:22.373" LastActivityDate="2015-10-15T21:06:22.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11883" PostTypeId="2" ParentId="11880" CreationDate="2015-10-12T20:56:10.160" Score="2" Body="&lt;p&gt;You can just grab whatever you need either from &lt;code&gt;$_POST&lt;/code&gt; or, more preferably, &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#getPost-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;request-&gt;getPost()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-12T20:56:10.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11884" PostTypeId="1" AcceptedAnswerId="11885" CreationDate="2015-10-12T21:17:17.487" Score="3" ViewCount="402" Body="&lt;p&gt;I have a dynamic route for individual user &lt;code&gt;/profiles&lt;/code&gt;. I expected it would be possible to override this route for &lt;code&gt;/profiles/all&lt;/code&gt; but apparently not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be achieved in the template I expect, with a conditional statement on the url &lt;code&gt;.segment(2)&lt;/code&gt;, but it would save a little time if it was possible to override a wildcard route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fU73G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fU73G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2015-10-12T22:13:08.190" Title="Override a wildcard dynamic route template" Tags="&lt;templating&gt;&lt;url&gt;&lt;routes&gt;&lt;routing&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11885" PostTypeId="2" ParentId="11884" CreationDate="2015-10-12T22:13:08.190" Score="3" Body="&lt;p&gt;Sort order matters, move the more specific route up and you should be good. Alternativly set it up in routes.php using some regular expressions.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-12T22:13:08.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11886" PostTypeId="1" CreationDate="2015-10-12T22:56:28.807" Score="3" ViewCount="1161" Body="&lt;p&gt;So i've got this little plugin named AnnuaireAdherents with a variable that i try to access from within a template : &#xA;&lt;code&gt;&#xA;annuaireadherents/&#xA;├── AnnuaireAdherentsPlugin.php&#xA;├── services&#xA;│   ├── AnnuaireAdherents_Service.php&#xA;│   └── Proxy.php&#xA;├── twigextensions&#xA;│   └── AnnuaireAdherentsTwigExtension.php&#xA;└── variables&#xA;    └── AnnuaireAdherentsVariable.php&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variable should return a dynamic array, but let's try a static one first :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;/**&#xA; * Variables provides access to list of adherents inside templates&#xA; */&#xA;class AnnuaireAdherentsVariable {&#xA;&#xA;    /**&#xA;     * Liste d'adhérents&#xA;     *&#xA;     * @return array&#xA;     */&#xA;    public function adherents() {&#xA;        return array(&#xA;            array(&#xA;                &quot;raison_sociale&quot; =&amp;gt; &quot;JOHN DOE &amp;amp; Co&quot;,&#xA;                &quot;contact&quot; =&amp;gt; &quot;JOHN DOE&quot;,&#xA;                &quot;cp&quot; =&amp;gt; &quot;99999&quot;,&#xA;                &quot;address1&quot; =&amp;gt; &quot;DESTINY STREET&quot;,&#xA;                &quot;locality&quot; =&amp;gt; &quot;NOWHERE&quot;,&#xA;                &quot;mail&quot; = &quot;john.doe@nowhere.net&quot;&#xA;            )&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried every namespace variants i could think of to access it inside a template : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for adh in craft.annuaireAdherents.adherents %}&#xA;    {{ adh.raison_sociale }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i keep receiving the error :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Method &quot;annuaireAdherents&quot; for object &quot;Craft\CraftVariable&quot; does not exist &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is it the correct namespace ?&#xA;Do i have to relaunch Apache and Craft between each code modification to retest my variable ?&#xA;Could there be another error that is masking me the true cause of this message ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for any clue /  direction to investigate.&lt;/p&gt;&#xA;" OwnerUserId="3884" LastActivityDate="2015-10-13T07:49:56.673" Title="Can't access plugin variable in a twig template?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11887" PostTypeId="1" CreationDate="2015-10-12T23:56:36.707" Score="3" ViewCount="200" Body="&lt;p&gt;Is it possible to restrict access to a page based on a visitor's country? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, only users in the US can view the FAQ page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3798" LastEditorUserId="57" LastEditDate="2015-10-13T21:05:32.123" LastActivityDate="2017-03-11T15:10:25.833" Title="Is it possible to restrict access to a page based on a visitor's country?" Tags="&lt;security&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11888" PostTypeId="2" ParentId="11886" CreationDate="2015-10-13T07:49:56.673" Score="3" Body="&lt;p&gt;&lt;strong&gt;Reinstalling the plugin after a database update&lt;/strong&gt; just solved the problem : the database i sync'ed with didn't have the plugin installed (as it is still in development) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for that one... :)&lt;/p&gt;&#xA;" OwnerUserId="3884" LastActivityDate="2015-10-13T07:49:56.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11889" PostTypeId="2" ParentId="11887" CreationDate="2015-10-13T08:22:39.230" Score="4" Body="&lt;p&gt;Luke Holder has created a plugin that would help you in this situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;nofollow&quot;&gt;Geo Plugin for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="260" LastActivityDate="2015-10-13T08:22:39.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11890" PostTypeId="1" CreationDate="2015-10-13T10:49:28.983" Score="3" ViewCount="74" Body="&lt;p&gt;I started working on Craft today. I want to display a background CSS image by adding a rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I manually copy the file in &lt;code&gt;assets&lt;/code&gt; folder or there's some way to upload and refer it on page.&lt;/p&gt;&#xA;" OwnerUserId="4190" LastActivityDate="2015-10-13T11:16:18.740" Title="How to display picture" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11891" PostTypeId="1" AcceptedAnswerId="11898" CreationDate="2015-10-13T11:05:10.367" Score="3" ViewCount="271" Body="&lt;p&gt;I've built a plugin that does some work before saving the user from the standard Registration Form. My only issue is it does not fire the activation email which I added in. But it lets the user login without verification, so I'd like to know what I'm missing as I thought if I &lt;code&gt;use craft()-&amp;gt;users-&amp;gt;saveUser()&lt;/code&gt; it automatically deals with this for new users. My code is as follows I think I may be missing something from the model?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newUser = new UserModel();&#xA;$newUser-&amp;gt;username = $username;&#xA;$newUser-&amp;gt;email = $email;&#xA;$newUser-&amp;gt;newPassword = $password;&#xA;&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;&#xA;if ($success)&#xA;    {&#xA;        // Code added to send email&#xA;        craft()-&amp;gt;users-&amp;gt;sendActivationEmail($newUser);&#xA;&#xA;        $this-&amp;gt;redirectToPostedUrl($newUser);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-10-13T13:41:13.077" LastActivityDate="2015-10-13T20:59:34.470" Title="New user validates without confirming email" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11892" PostTypeId="2" ParentId="11890" CreationDate="2015-10-13T11:16:18.740" Score="3" Body="&lt;p&gt;If you need the background image to be dynamic and controlled by the client then I would recommend using inline CSS in the template to set the image path. The rest of the required CSS can be in the CSS file itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div style=&quot;background-image: url('{{ entry.image.first().getUrl('transformName') }}')&quot; class=&quot;thing&quot; ... &amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your CSS file could even have a fallback background-url&#xA;and in your CSS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.thing { background-size: cover; ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-10-13T11:16:18.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11893" PostTypeId="2" ParentId="11875" CreationDate="2015-10-13T11:30:37.477" Score="5" Body="&lt;p&gt;Currently, yes, the only way to modify an element query (when it’s not your own element type) is to do it with a custom field type, from its &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/IFieldType#modifyElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;modifyElementsQuery()&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 2.5, plugins can listen for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&quot; rel=&quot;nofollow&quot;&gt;elements.onBeforeBuildElementsQuery&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery&quot; rel=&quot;nofollow&quot;&gt;elements.onBuildElementsQuery&lt;/a&gt; events to make changes to the query (or prevent it from getting executed).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('elements.buildElementsQuery', function(Event $event) {&#xA;    /** @var ElementCriteriaModel $criteria */&#xA;    $criteria = $event-&amp;gt;params['criteria'];&#xA;&#xA;    /** @var DbCommand $query */&#xA;    $query = $event-&amp;gt;params['query'];&#xA;&#xA;    if ($criteria-&amp;gt;myCustomParamName) {&#xA;        $query-&amp;gt;andWhere( //...&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-12-05T15:03:26.123" LastActivityDate="2015-12-05T15:03:26.123" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11894" PostTypeId="1" AcceptedAnswerId="11895" CreationDate="2015-10-13T13:11:34.740" Score="2" ViewCount="724" Body="&lt;p&gt;I can't, for the life of me, find an answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a global called &lt;strong&gt;work&lt;/strong&gt;.  It has three Asset fields.  One is called &lt;strong&gt;mediakit&lt;/strong&gt;, which is an upload of a PDF.  I am trying to get the file name of that asset and add it into the template but cannot find anything giving me the proper way to do this in the template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the documentation I thought:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {{ work.mediakit }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would output something at least but nothing shows and so whittling away from there to get it to call the correct path has eluded me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me the correct way to call that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The path is:   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;/assets/medikit/{{ the filename of the pdf uploaded}}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="45" LastEditDate="2016-09-01T17:28:29.207" LastActivityDate="2016-09-01T17:28:29.207" Title="Calling an Asset field from a Global" Tags="&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11895" PostTypeId="2" ParentId="11894" CreationDate="2015-10-13T13:25:14.173" Score="2" Body="&lt;p&gt;Assets fields always return &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel’s&lt;/a&gt; in templates. To get the actual related asset, do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = work.mediakit.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can’t be &lt;em&gt;sure&lt;/em&gt; that there’s actually a related asset, so it’s worth making sure &lt;code&gt;work.mediakit.first()&lt;/code&gt; actually returned something before accessing its properties:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if asset %}&#xA;    {{ asset.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="9" LastEditDate="2015-10-16T06:55:47.433" LastActivityDate="2015-10-16T06:55:47.433" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11896" PostTypeId="1" CreationDate="2015-10-13T14:24:06.080" Score="2" ViewCount="270" Body="&lt;p&gt;I have a frontend form to save an entry which includes a file upload input field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;fields[newsFile]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The upload works fine, but is it also possible to set the title of the asset similar to the backend? Unfortunately, this doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[newsFile][title]&quot; value=&quot;Asset Name&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3855" LastActivityDate="2015-10-16T07:02:52.637" Title="Saving asset title in frontend form" Tags="&lt;assets&gt;&lt;form&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11897" PostTypeId="1" AcceptedAnswerId="11956" CreationDate="2015-10-13T15:52:54.420" Score="1" ViewCount="256" Body="&lt;p&gt;I have a task that is used to collate relationship data for a specific entry and save it as JSON to a text field in that entry. Everything is working fine, except for the saving of the entry which fails because the required Matrix / Assets fields in the entry are being read as blank. I've checked to make sure that the entries have all required fields completed, but the errors still persist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry saving code in the task:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('latLngs', json_encode($latLngs));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The errors being returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[_errors:CModel:private] =&amp;gt; Array&#xA;(&#xA;    [gallery] =&amp;gt; Array&#xA;    (&#xA;        [0] =&amp;gt; Gallery cannot be blank.&#xA;    )&#xA;    [standardContent] =&amp;gt; Array&#xA;    (&#xA;        [0] =&amp;gt; Standard Content cannot be blank.&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;gallery&lt;/code&gt; is an Assets field, and &lt;code&gt;standardContent&lt;/code&gt; is a Matrix field. All other required fields seem to be working fine with no errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this to do with the way I'm saving the entries, or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2015-10-16T13:41:51.220" Title="Entry saving in task fails due to required assets/matrix fields being read as blank, even through they are not" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;entry&gt;&lt;entrymodel&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11898" PostTypeId="2" ParentId="11891" CreationDate="2015-10-13T20:59:34.470" Score="1" Body="&lt;p&gt;Since you're bypassing Craft's own &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersController-&gt;actionSaveUser()&lt;/a&gt;, you'll need to replicate a bit more of its functionality in order for it to work like you're wanting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you'll want to make sure that &quot;Require Email Verification&quot; is checked under &lt;code&gt;Settings-&amp;gt;Users-&amp;gt;Settings&lt;/code&gt; in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your &lt;code&gt;UserModel&lt;/code&gt; will also need to set a few more things:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;unverifiedEmail = $email;&#xA;$user-&amp;gt;pending = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but that should do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I highly recommend looking over Craft's default actionSaveUser implementation as there are many permissions/security guards in place for public registration that you should probably consider as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-13T20:59:34.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11899" PostTypeId="1" CreationDate="2015-10-13T23:58:09.900" Score="3" ViewCount="297" Body="&lt;p&gt;So I have a plugin with a Twig Extension that does it's thing. If I were to disable my plugin I will get the expected error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &quot;extensionName&quot; extension is not enabled.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Whenever I'm referring to anything to do with my plugin, I rely on the usual &quot;&lt;em&gt;is defined&lt;/em&gt;&quot;, &quot;&lt;em&gt;is not empty&lt;/em&gt;&quot;, &quot;&lt;em&gt;|default()&lt;/em&gt;&quot;, etc... options as appropriate fallbacks/checks incase my plugin fails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, short of doing a full &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10632/how-can-i-check-if-a-plugin-is-installed-and-enabled&quot;&gt;check on wether my plugin is installed&lt;/a&gt; everytime, there doesn't seem to be an elegant solution for checking extensions are enabled until it's too late (and the page fails to load). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on a workaround?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-14T00:16:38.930" Title="Is there a fallback when a Twig extension is not enabled?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11900" PostTypeId="2" ParentId="11899" CreationDate="2015-10-14T00:16:38.930" Score="2" Body="&lt;p&gt;I can't think of a native way to do this, but Twig does have a &lt;a href=&quot;https://github.com/twigphp/Twig/blob/1.x/lib/Twig/Environment.php#L736&quot; rel=&quot;nofollow noreferrer&quot;&gt;hasExtension&lt;/a&gt; method, which you could make use of in a Craft plugin.  But if you wrote a plugin to utilize it (similar to &lt;a href=&quot;https://stackoverflow.com/a/28772193/684&quot;&gt;this&lt;/a&gt;) obviously that wouldn't help if the plugin was disabled or uninstalled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can add this as a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; to add to Craft natively. If you go that route, be sure and go into details on your specific use-case as I'm not sure I'm following it 100% here.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-10-14T00:16:38.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11901" PostTypeId="1" AcceptedAnswerId="11918" CreationDate="2015-10-14T01:14:56.533" Score="1" ViewCount="600" Body="&lt;p&gt;I've got &lt;code&gt;devMode&lt;/code&gt; enabled and can see the log happening in &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt; for browser requests... but was wondering if there is a way to enable this level of logging (detailing every sql etc.) for console commands in plugins?&lt;/p&gt;&#xA;" OwnerUserId="3637" LastEditorUserId="57" LastEditDate="2015-10-14T21:28:13.450" LastActivityDate="2015-10-14T22:56:02.063" Title="Enable craft.log for console commands" Tags="&lt;logging&gt;&lt;console&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-10-15T00:00:01.340" ContentLicense="CC BY-SA 3.0" />
  <row Id="11903" PostTypeId="1" AcceptedAnswerId="11916" CreationDate="2015-10-14T05:31:36.560" Score="1" ViewCount="1234" Body="&lt;p&gt;I get an error when trying to load a page occasionally. It appears to have a problem getting the &quot;type&quot; property from a matrix block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]:&#xA;General error: 2006 MySQL server has gone away. The SQL statement &#xA;executed was: SELECT `id`, `groupId`, `name`, `handle`, `context`, &#xA;`instructions`, `translatable`, `type`, `settings`&#xA;FROM `craft_fields`&#xA;WHERE (handle = :handle) AND (context = :context)&#xA;ORDER BY `name`. Bound with :handle='type',&#xA;:context='matrixBlockType:6'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4194" LastActivityDate="2015-10-14T17:57:51.833" Title="CDbCommand failed to execute the SQL statement" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11904" PostTypeId="1" CreationDate="2015-10-14T07:12:55.290" Score="2" ViewCount="866" Body="&lt;p&gt;I am trying to reset the default path to the dashboard from admin to something else. I have this in &lt;code&gt;config/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'cpTrigger' =&amp;gt; 'new-url',&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'devMode' =&amp;gt; true,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I go to &lt;code&gt;devsite.myurl.co.uk/new-url&lt;/code&gt;, I get a 404 error. I got this working locally but not since I installed the site on a staging server, and imported the database and changed the general and db files. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I take out the &lt;code&gt;cpTrigger&lt;/code&gt; line, and just use &lt;code&gt;devsite.myurl.co.uk/admin&lt;/code&gt;, everything is fine.&lt;/p&gt;&#xA;" OwnerUserId="4173" LastEditorUserId="57" LastEditDate="2015-10-14T17:58:55.393" LastActivityDate="2015-10-14T18:01:12.753" Title="Changing the default admin path" Tags="&lt;admin&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11905" PostTypeId="2" ParentId="11904" CreationDate="2015-10-14T07:44:32.907" Score="4" Body="&lt;p&gt;Have you got your &lt;code&gt;htaccess&lt;/code&gt; file working ok? By default the &lt;code&gt;htaccess&lt;/code&gt; file is named incorrectly, it should be &lt;code&gt;.htaccess not&lt;/code&gt;htaccess`. You can read about renaming that file in the &lt;a href=&quot;http://buildwithcraft.com/docs/installing#step-1-upload-the-files&quot; rel=&quot;nofollow&quot;&gt;installation docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a quick test you could try:&#xA;&quot;/index.php/new-url&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that works it's your &lt;code&gt;htaccess&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="57" LastEditDate="2015-10-14T18:01:12.753" LastActivityDate="2015-10-14T18:01:12.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11906" PostTypeId="1" AcceptedAnswerId="11907" CreationDate="2015-10-14T08:33:00.677" Score="3" ViewCount="293" Body="&lt;p&gt;I've got a site with several locales and want to reuse a set of categories across locales but want to target a locale specific template from within each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set a locale-specific path within the category group settings, eg &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.locale }}/_video&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-10-14T08:58:28.997" Title="Dynamic Category template paths" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11907" PostTypeId="2" ParentId="11906" CreationDate="2015-10-14T08:55:34.527" Score="2" Body="&lt;p&gt;It looks like this isn't possible. But what you can do instead is either:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Route them to a shared template using the category settings and use &lt;code&gt;include&lt;/code&gt; programatically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'myCatTemplate--' ~ craft.locale %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Disable &quot;Categories in this group have their own URLs&quot; in the category settings and add your own &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routes&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-14T08:58:28.997" LastActivityDate="2015-10-14T08:58:28.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11908" PostTypeId="1" AcceptedAnswerId="11910" CreationDate="2015-10-14T12:14:53.400" Score="3" ViewCount="954" Body="&lt;p&gt;For example, how might we ensure that &lt;code&gt;firstName&lt;/code&gt; is set.&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2015-11-02T18:25:22.080" Title="How can I add custom validation rules to a new User registration?" Tags="&lt;users&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11909" PostTypeId="2" ParentId="11908" CreationDate="2015-10-14T14:07:29.303" Score="3" Body="&lt;p&gt;In a plugin, you can use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveUser&lt;/a&gt; event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugin's main file, use the following init function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    //Tap into the onBeforeSaveUser event&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;        //Get the user object from the raised event&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        //If the first name is blank, do not allow the save to continue&#xA;        if($user-&amp;gt;firstName == '')&#xA;        {&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-14T14:07:29.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11910" PostTypeId="2" ParentId="11908" CreationDate="2015-10-14T15:05:15.440" Score="4" Body="&lt;p&gt;At the time of writing the &lt;code&gt;users.onBeforeSave&lt;/code&gt; event runs after validation, which means that we can’t add errors to the user easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution I’ve currently come up with is a plugin that adds custom validation rules to a user model, as well as a controller to handle the form submission.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Model&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Firstly, I’ve extended the &lt;code&gt;UserModel&lt;/code&gt; and added custom validation rules as needed.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_UserModel extends UserModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        // Get the rules defined in UserModel&#xA;        $rules = parent::defineAttributes();&#xA;&#xA;        // Add custom rules&#xA;        $rules['firstName'] = array(AttributeType::String, 'required' =&amp;gt; true);&#xA;        $rules['lastName'] = array(AttributeType::String, 'required' =&amp;gt; true);&#xA;&#xA;        // If it’s a new user, require the password&#xA;        $isNewUser = !isset($this-&amp;gt;id);&#xA;        if ($isNewUser) {&#xA;            $rules['password'] = array(AttributeType::String, 'required' =&amp;gt; true);&#xA;        }&#xA;&#xA;        return $rules;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Controller&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Secondly, I’ve created a controller action that will handle form submissions. This populates our custom user model with the input and runs the standard &lt;code&gt;validate()&lt;/code&gt; flow.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_UsersController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = array('actionSaveUser');&#xA;&#xA;    public function actionSaveUser()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // Get input&#xA;        $post = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;&#xA;        // Create an instance of our model&#xA;        $user = new MyPlugin_UserModel($post);&#xA;&#xA;        if (!$user-&amp;gt;validate()) {&#xA;            // Add any errors from the validation to the user&#xA;            $user-&amp;gt;addErrors($user-&amp;gt;getContent()-&amp;gt;getErrors());&#xA;&#xA;            // Respond with errors&#xA;            if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;                $this-&amp;gt;returnJson(array(&#xA;                    'errors' =&amp;gt; $user-&amp;gt;getErrors(),&#xA;                ));&#xA;            } else {&#xA;                craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Couldn’t save user.'));&#xA;&#xA;                // Send the account back to the template&#xA;                craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                    'account' =&amp;gt; $user&#xA;                ));&#xA;            }&#xA;        } else {&#xA;            // If all is well, run the default UsersController method&#xA;            craft()-&amp;gt;runController('users/saveUser');&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Template&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;For reference, here’s the action input in the template. Essentially, it’s just prepending the plugin handle before the default action.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myPlugin/users/saveUser&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="596" LastActivityDate="2015-10-14T15:05:15.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11911" PostTypeId="1" AcceptedAnswerId="11912" CreationDate="2015-10-14T16:15:50.680" Score="11" ViewCount="5502" Body="&lt;p&gt;This is super simple, and I don't get why it's not working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.section('events').lightSwitchField('1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns all entries in Events where the light switch field is green.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.section('events').lightSwitchField('0') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns all entries in Events. Period. Not all entries that the lightswitch is set to off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get all entries where the lightswitch field is off. Later I'm going to chain some other fields to the query too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I not understood about how this works?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-10-16T13:59:07.377" Title="craft.entries and lightswitch" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11912" PostTypeId="2" ParentId="11911" CreationDate="2015-10-14T16:23:05.530" Score="24" Body="&lt;p&gt;This is a known behavioral issue. PHP considers &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;&quot;0&quot;&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt;, and similar values to be &lt;a href=&quot;http://php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues&quot;&gt;“empty”&lt;/a&gt;, and Craft only factors most criteria param values into the query if they are not empty. So setting a Lightswitch field’s criteria param to &lt;code&gt;'0'&lt;/code&gt; is the same as not setting it at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workaround is to use &lt;code&gt;not 1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.section('events').lightSwitchField('not 1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="9" LastEditDate="2015-10-16T13:59:07.377" LastActivityDate="2015-10-16T13:59:07.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11913" PostTypeId="1" AcceptedAnswerId="11915" CreationDate="2015-10-14T16:54:03.513" Score="3" ViewCount="1544" Body="&lt;p&gt;I have a route set up in routes.php that calls a controller action using something similar to what is described here: &lt;a href=&quot;https://straightupcraft.com/articles/how-do-i-setup-a-route-to-point-to-a-controller-action-instead-of-a-template&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/articles/how-do-i-setup-a-route-to-point-to-a-controller-action-instead-of-a-template&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works much better for my purposes than POSTing a form to the controller. However, I'm not sure how best to handle redirects. Ideally I would like to redirect back to the page where the user clicked on the link, but calling&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;redirectToPostedUrl()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't work when using a route like this. The URL just remains the URL as defined in the route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a different method I can use to make sure users are returned to the page where they were when they clicked the link?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2019-01-15T15:53:52.553" Title="Controller action redirection when called via route" Tags="&lt;routes&gt;&lt;controller&gt;&lt;routing&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11914" PostTypeId="1" CreationDate="2015-10-14T17:03:26.570" Score="2" ViewCount="193" Body="&lt;p&gt;I'm looking for a way to merge blog article entries with social media entries (non craft table). The idea is to output both entry types together from the same array, this will allow me to order all entries by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The social media plugin that I have put together queries the non-craft social media table but I need a solution to UNION the two tables together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing this within Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My table structure for &lt;code&gt;craft_archived_social_items&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;id&lt;/code&gt; int  &lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;unique_id&lt;/code&gt; varchar(255) NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;account&lt;/code&gt; varchar(255) NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;category&lt;/code&gt; varchar(255) NOT NULL,  &lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;title&lt;/code&gt; text NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;content&lt;/code&gt; text NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;image&lt;/code&gt; varchar(255) NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;link&lt;/code&gt; text NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;date&lt;/code&gt; datetime NOT NULL,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;status&lt;/code&gt; varchar(255) NOT NULL DEFAULT 'inactive',&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;date_cached&lt;/code&gt; datetime NOT NULL,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PRIMARY KEY (&lt;code&gt;id&lt;/code&gt;)&#xA;) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My service file is currently using the &lt;code&gt;db-&amp;gt;createCommand&lt;/code&gt; to query the table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $social_items = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('title, content, date, category, id, account, unique_id, image, link')&#xA;        -&amp;gt;from('archived_social_items') &#xA;        -&amp;gt;offset($offset)&#xA;        -&amp;gt;limit($counter)&#xA;        -&amp;gt;order('date desc')&#xA;        -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4147" LastEditorUserId="4147" LastEditDate="2015-10-16T13:10:25.257" LastActivityDate="2015-11-04T10:51:24.137" Title="How to UNION Craft blog articles array with Social Media plugin (non craft table)" Tags="&lt;database&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11915" PostTypeId="2" ParentId="11913" CreationDate="2015-10-14T17:27:26.593" Score="3" Body="&lt;p&gt;You're mistaken about how &lt;code&gt;redirectToPostedUrl&lt;/code&gt; works... That's designed to redirect from a form submission, when the &lt;code&gt;redirect&lt;/code&gt; field was supplied:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;page/to/redirect/to&quot;&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What you really want is this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;redirect(craft()-&amp;gt;request-&amp;gt;getUrlReferrer());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;request-&amp;gt;getUrlReferrer&lt;/code&gt; method will actually retrieve the originating page URL.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-10-14T17:27:26.593" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11916" PostTypeId="2" ParentId="11903" CreationDate="2015-10-14T17:57:51.833" Score="1" Body="&lt;p&gt;A &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.0/en/gone-away.html&quot; rel=&quot;nofollow&quot;&gt;2006: MySQL server has gone away error&lt;/a&gt; generally means that (for any number of reasons) the connection between Craft/PHP and the MySQL server has been dropped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common causes are from connection timeouts and misconfigured MySQL settings like max_packet_size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lots of debugging tips in the above link from MySQL's official documentation that would be a good place to start.  Additionally you might want to involve your host and let them know what you're seeing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-14T17:57:51.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11917" PostTypeId="1" AcceptedAnswerId="11932" CreationDate="2015-10-14T21:16:00.277" Score="2" ViewCount="388" Body="&lt;p&gt;I've been looking at the Push Notification Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link: &lt;a href=&quot;https://github.com/boboldehampsink/pushnotifications&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/pushnotifications&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having some issues determining how an iOS or Android application can automatically add a new device token to an application. Meaning, I wouldn't want to add the device token via the CP. Most users don't know what their device token is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at the HTTP Requests that is produced when I click to create a new device in the plugin settings; however, when I test trying to create a new device only by URL it fails. Any ideas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else used this plugin? &lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="45" LastEditDate="2015-10-14T21:23:59.410" LastActivityDate="2015-10-15T17:19:31.367" Title="CraftCMS Push Notifications: New Device Token" Tags="&lt;plugins&gt;&lt;plugin-pushnotifications&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11918" PostTypeId="2" ParentId="11901" CreationDate="2015-10-14T22:56:02.063" Score="1" Body="&lt;p&gt;This was a bug in Craft that's been fixed for the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2696&quot; rel=&quot;nofollow&quot;&gt;post 2.4.2696&lt;/a&gt;) release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once that release is out, &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; output will be written to the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files just like a normal web request would with devMode enabled.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-14T22:56:02.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11919" PostTypeId="2" ParentId="11878" CreationDate="2015-10-14T23:10:16.003" Score="2" Body="&lt;p&gt;Is this a custom template global from a plugin or is it a field on a Craft global set, because those you usually access with &lt;code&gt;{{ myGlobalSet.endDate }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-14T23:10:16.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11920" PostTypeId="1" AcceptedAnswerId="11922" CreationDate="2015-10-15T00:02:07.133" Score="1" ViewCount="118" Body="&lt;p&gt;Apologies if this ends up being a silly syntax oversight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My services file looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginService extends BaseApplicationComponent {&#xA;  public $myArray = array('test1', 'test2');&#xA;&#xA;  public function someFunction() {&#xA;    $someText = &quot;This should end up in myArray&quot;;&#xA;    array_push($this-&amp;gt;myArray, $someText);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming the &quot;someFunction&quot; has been called, I later try to dump the array. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(craft.myPlugin.myArray) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Expected output:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;array(2) { [0]=&gt; string(5) &quot;test1&quot; &lt;a href=&quot;https://stackoverflow.com/questions/16136000/correct-array-push-usage-in-a-class&quot;&gt;1&lt;/a&gt;=&gt; string(5) &quot;test2&quot; [2]=&gt;&#xA;  string(29) &quot;This should end up in myArray&quot; }&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Actual output:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;array(2) { [0]=&gt; string(5) &quot;test1&quot; &lt;a href=&quot;https://stackoverflow.com/questions/16136000/correct-array-push-usage-in-a-class&quot;&gt;1&lt;/a&gt;=&gt; string(5) &quot;test2&quot; }&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/16136000/correct-array-push-usage-in-a-class&quot;&gt;The solution&lt;/a&gt; seems to be pretty unanimous across many PHP related forums. However, this just isn't working in my Craft project. &lt;strong&gt;Have I overlooked something obvious, or is Craft protecting the public array in some way?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2015-10-15T00:49:38.060" Title="Pushing to an array within a class doesn't work" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11921" PostTypeId="2" ParentId="8734" CreationDate="2015-10-15T00:30:18.813" Score="7" Body="&lt;p&gt;I should note that the &lt;code&gt;relatedTo&lt;/code&gt; method accepts a &lt;code&gt;CategoryModel&lt;/code&gt;, &lt;em&gt;not&lt;/em&gt; the title of a category. What you ended up doing works, but here's the way to do with the &lt;code&gt;relatedTo&lt;/code&gt; method, which is what I'd suggest for anyone finding this in the future:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.relatedTo(craft.categories.slug('your-cat-slug')) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You now have all entries that are associated with the given category, and can loop through them with the usual &lt;code&gt;{% for entry in entries %}&lt;/code&gt; technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: You can't pass the category name. You &lt;em&gt;have&lt;/em&gt; to give &lt;code&gt;relatedTo&lt;/code&gt; an actual &lt;code&gt;CategoryModel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-10-15T00:30:18.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11922" PostTypeId="2" ParentId="11920" CreationDate="2015-10-15T00:49:38.060" Score="2" Body="&lt;p&gt;I feel like we're missing some code in your examples, but in a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; there is no direct link between a template and its services.  You go through a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Variable&lt;/a&gt; class, which is responsible for exposing your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;service's&lt;/a&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your example, in your plugin's variables folder, you'd have a &lt;code&gt;MyPluginVariable&lt;/code&gt; class that has it's own &lt;code&gt;someFunction&lt;/code&gt; method like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;    public function getMyArray()&#xA;    {&#xA;        return craft()-&amp;gt;myPlugin-&amp;gt;myArray;&#xA;    }&#xA;&#xA;    public function someFunction()&#xA;    {&#xA;        return craft()-&amp;gt;myPlugin-&amp;gt;someFunction();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from your template, assuming you call &lt;code&gt;someFunction()&lt;/code&gt; first, you should get the correct output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.someFunction() }}&#xA;{{ dump(craft.myPlugin.myArray }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd also recommend refactoring your service to &lt;a href=&quot;https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)&quot; rel=&quot;nofollow&quot;&gt;encapsulate&lt;/a&gt; the public array in a method and use the PHP &lt;code&gt;[]&lt;/code&gt; syntax to avoid the function overhead of &lt;code&gt;array_push()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginService extends BaseApplicationComponent&#xA;{&#xA;    private $_myArray = array('test1', 'test2');&#xA;&#xA;    public function someFunction()&#xA;    {&#xA;        $someText = &quot;This should end up in myArray&quot;;&#xA;        $this-&amp;gt;_myArray[] = $someText;&#xA;    }&#xA;&#xA;    public function getMyArray()&#xA;    {&#xA;        return $this-&amp;gt;_myArray;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your Variable's &lt;code&gt;getMyArray()&lt;/code&gt; method would change to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMyArray()&#xA;{&#xA;    return craft()-&amp;gt;myPlugin-&amp;gt;getMyArray();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-15T00:49:38.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11923" PostTypeId="1" AcceptedAnswerId="11959" CreationDate="2015-10-15T04:09:45.077" Score="14" ViewCount="2032" Body="&lt;p&gt;What's your process for A/B testing a Craft entry? I'm curious about how you'd structure alternative content for a page within Craft and what tools you'd use to measure the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any comments appreciated - I know there are lots of different ways you could approach this!&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="1098" LastEditDate="2015-10-15T06:34:00.227" LastActivityDate="2019-04-25T16:54:03.930" Title="A/B testing - how to in Craft?" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="11924" PostTypeId="2" ParentId="11682" CreationDate="2015-10-15T08:15:05.603" Score="6" Body="&lt;p&gt;This should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$idList = [1, 2, 3, 4];&#xA;$criteria-&amp;gt;id = 'and, not ' . implode(', not ', $idList);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In plain text, the &lt;code&gt;id&lt;/code&gt; property would then look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'and, not 1, not 2, not 3, not 4'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The syntax may look a little odd, but it essentially makes Craft compile an SQL query with an &lt;code&gt;AND (elements.id!=$elementId)&lt;/code&gt; statement for each ID you want to exclude.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-10-15T08:15:05.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11925" PostTypeId="1" CreationDate="2015-10-15T09:15:10.920" Score="2" ViewCount="462" Body="&lt;p&gt;Craft hasn't done this prior (or maybe I just noticed), but I'm currently battling double slashes in URLs returned from &lt;code&gt;{{ asset.getUrl() }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue appears when I create an Assets field and set the following settings to that field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Restrict uploads to a single folder (true)&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Upload location: [source:Images] &lt;code&gt;somefolder/somesubfolder&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling &lt;code&gt;{{ asset.getUrl() }}&lt;/code&gt; on an asset from this field returns the following URL:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;/uploads/images/somefolder//somesubfolder/image.jpg&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the double slash appears inside the path specified in the field's settings – &lt;code&gt;/uploads/images/&lt;/code&gt; is the source path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens both for Asset fields that are inside Matrix fields, and standalone fields. It also happens regardless if I use named transforms, inline transforms or no transforms (&lt;code&gt;getUrl(false)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If the source configuration should prove relevant somehow, here's the setup:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got an asset source (local folder) called &lt;code&gt;Images&lt;/code&gt; configured like this:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;File System Path:&lt;/em&gt; &lt;code&gt;{imagePath}/&lt;/code&gt;&lt;br&gt;&#xA;&lt;em&gt;URL:&lt;/em&gt; &lt;code&gt;{imageUri}/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{imagePath}&lt;/code&gt; and &lt;code&gt;{imageUri}&lt;/code&gt; are environment variables, set to &lt;code&gt;$_SERVER['DOCUMENT_ROOT'] . &quot;/uploads/images&quot;&lt;/code&gt; and &lt;code&gt;&quot;/uploads/images&quot;&lt;/code&gt;, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is a bug or something I do wrong somehow (or maybe it has to do with server configurations?). I can remove the double slashes with Twig, but it's annoying. Why does this happen, and is there anything I can do about it?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-10-15T09:15:10.920" Title="asset.getUrl() outputs double slashes" Tags="&lt;templating&gt;&lt;assets&gt;&lt;content&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11926" PostTypeId="1" CreationDate="2015-10-15T10:01:35.213" Score="7" ViewCount="1701" Body="&lt;p&gt;How Craft reacts to missing images is one of the very few places where I find Craft less than ideal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL:DR; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Is there a way to make missing images &lt;em&gt;not&lt;/em&gt; become a fatal error?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;How do you find elements that are referencing the missing image?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Long version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of ways images can be missing, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Our workflow involves developing locally, then putting up to staging for clients to add content. Sometimes we need to then do more local development, local and stage both share the same database... but not images.&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An image is simply corrupt, due to transfer or disk failure (it happens)&lt;/li&gt;&#xA;&lt;li&gt;A filesystem is reverted to a previous state but the database is not&lt;/li&gt;&#xA;&lt;li&gt;A live server dies and a project is restored to a new machine from SVN/GIT, but the assets are not in version control and therefore not available&lt;/li&gt;&#xA;&lt;li&gt;Getting hold of the images on local isn't possible temporarily because you're working on a restricted internet connection; like on a plane.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any of these result in instances of 'blahblah.jpg could not be found' in Dev mode or Internal Server Error in production. Sometimes those images actually get lost; they just don't exist any more; but they're in the database. So...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you find what element is referencing these lost files? Besides manually trawling through entries, related entries, etc? Crafts error gives no useful information about that, and rebuilding asset indexes doesn't seem to make Craft aware that the image isn't available anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an option to just ignore these types of error - it's not helpful in production to have a whole page 'internal server error' just because a single image referenced on the page is missing from the file system for whatever reason. A missing image is not a throw-the-baby-out-with-the-bathwater problem.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2020-09-11T10:14:56.270" Title="Dealing with missing images" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11927" PostTypeId="2" ParentId="11926" CreationDate="2015-10-15T10:15:15.960" Score="6" Body="&lt;p&gt;I do all images through a macro, that substitutes in our logo if an image happens to be missing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro imageTransform(image, transform, caption, extraHTML) %}&#xA;  {# Fallback to our logo if the image is null... #}&#xA;  {% if not image|length %}&#xA;    {% set image = craft.assets.id('84').first() %}&#xA;  {% endif %}&#xA;  &amp;lt;img src=&quot;{{ image.getUrl( transform ) }}&quot; width=&quot;{{ image.getWidth( transform ) }}&quot; height=&quot;{{ image.getHeight( transform ) }}&quot; title=&quot;{{ caption|default('') }}&quot; alt=&quot;{{ caption|default('') }}&quot;{% if extraHTML %} {{ extraHTML }}{% endif %}&amp;gt;    &#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We have a more complicated version for responsive images but that's the basic idea...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, to find things using assets, although I have never used it, I hear this is good:&#xA;&lt;a href=&quot;https://github.com/iainurquhart/craft_introvert&quot;&gt;https://github.com/iainurquhart/craft_introvert&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2015-10-15T10:15:15.960" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11928" PostTypeId="1" AcceptedAnswerId="11960" CreationDate="2015-10-15T13:38:02.677" Score="5" ViewCount="1221" Body="&lt;p&gt;Can anyone help identify why one on my entries is not being picked up in my search query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search terms are &lt;strong&gt;'hampshire 10k'&lt;/strong&gt; and the &lt;code&gt;craft_searchindex&lt;/code&gt; table for this entry looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FAQPa.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FAQPa.png&quot; alt=&quot;Search Index&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search string param is added as follows (along with a handful of other params) for any search&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ search: '*hampshire* *10k*' }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unsure if it's down to bug or a templating issue? The keyword search forms part of quite complex entry search.&lt;/p&gt;&#xA;" OwnerUserId="158" LastActivityDate="2015-10-16T15:22:55.127" Title="Entry not showing up in search results?" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11929" PostTypeId="1" AcceptedAnswerId="11935" CreationDate="2015-10-15T15:40:02.040" Score="3" ViewCount="96" Body="&lt;p&gt;Is it possible to search through multiple ElementTypes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;limit(10)-&amp;gt;search('Test');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, ElementType::Asset, ElementType::Category)-&amp;gt;limit(10)-&amp;gt;search('Test');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3855" LastActivityDate="2015-10-15T18:27:20.930" Title="Search through multiple ElementTypes" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11930" PostTypeId="2" ParentId="11474" CreationDate="2015-10-15T15:50:10.240" Score="8" Body="&lt;p&gt;The ElementAPI plugin itself doesn't seem to offer a caching solution, but there is a fork from a guy which has implemented a caching option &lt;code&gt;cache&lt;/code&gt; and &lt;code&gt;cacheTime&lt;/code&gt;:&#xA;&lt;a href=&quot;https://github.com/theolampert/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/theolampert/ElementAPI&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: They have introduced a new &lt;a href=&quot;https://github.com/craftcms/element-api/tree/v1#cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cache&lt;/code&gt;&lt;/a&gt; option in the official &lt;a href=&quot;https://github.com/craftcms/element-api/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementAPI&lt;/a&gt; plugin (version 1.5).&lt;/p&gt;&#xA;" OwnerUserId="4200" LastEditorUserId="4200" LastEditDate="2017-05-24T22:39:30.997" LastActivityDate="2017-05-24T22:39:30.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11931" PostTypeId="2" ParentId="11928" CreationDate="2015-10-15T16:23:50.843" Score="3" Body="&lt;p&gt;It's not finding anything because there isn't a single row that has both &lt;code&gt;*hampshire*&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;*10k*&lt;/code&gt; in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to search across rows, then you'll want to use &lt;code&gt;{ search: '*hampshire* OR *10k*' }&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-15T16:23:50.843" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11932" PostTypeId="2" ParentId="11917" CreationDate="2015-10-15T17:17:16.107" Score="3" Body="&lt;p&gt;I have finally figured this out with the help of the developer, boboldehampsink. Thank you so much for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The post parameters are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    'app': 'app_handle',&#xA;    'platform': 'ios/android',&#xA;    'registrationId': 'token'&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You must use the front-end url to register a device without needing login credentials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Post to the URL:&#xA;&lt;a href=&quot;http://localhost/CraftCMS/public/actions/pushNotifications/devices/registerDevice&quot; rel=&quot;nofollow&quot;&gt;http://localhost/CraftCMS/public/actions/pushNotifications/devices/registerDevice&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More information found here:&lt;/strong&gt; &lt;a href=&quot;https://github.com/boboldehampsink/pushnotifications/issues/1&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/pushnotifications/issues/1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="57" LastEditDate="2015-10-15T17:19:31.367" LastActivityDate="2015-10-15T17:19:31.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11933" PostTypeId="1" CreationDate="2015-10-15T17:38:40.030" Score="3" ViewCount="177" Body="&lt;p&gt;I'm trying to order my users with &lt;code&gt;craft.users.order('lastName')&lt;/code&gt;, which should be no problem, since I'm pulling that straight from the documentation; however, it's not working for some reason. Is this a current a bug in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have users with these last names: &lt;code&gt;Apple, Campbell, Jackson&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;order('lastName')&lt;/code&gt;, it's printing out: &lt;code&gt;Campbell, Jackson, Apple&lt;/code&gt;. So no alphabetical order is being applied &lt;code&gt;asc&lt;/code&gt; or &lt;code&gt;desc&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4201" LastEditorUserId="57" LastEditDate="2015-10-15T18:16:24.620" LastActivityDate="2015-10-15T18:16:24.620" Title="Users Order not Working" Tags="&lt;users&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11934" PostTypeId="2" ParentId="11933" CreationDate="2015-10-15T17:45:41.547" Score="5" Body="&lt;p&gt;Values in the documentation list possibilities, like: 'firstName' and 'lastName', which needs to be updated, since Craft only accepts lowercase values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing 'firstName' to 'firstname' solves the issue.&lt;/p&gt;&#xA;" OwnerDisplayName="user4202" LastActivityDate="2015-10-15T17:45:41.547" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11935" PostTypeId="2" ParentId="11929" CreationDate="2015-10-15T18:27:20.930" Score="0" Body="&lt;p&gt;You'd have to do the in multiple queries at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider voting for this &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9505794-all-search-to-work-across-element-types-particul&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, which is asking for what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-15T18:27:20.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11936" PostTypeId="2" ParentId="11928" CreationDate="2015-10-15T19:38:25.127" Score="1" Body="&lt;p&gt;Assuming you have a field for distance, since you have a ton of entries, Craft allows dynamic titles (and slugs) so you could &lt;a href=&quot;http://buildwithcraft.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow&quot;&gt;generate your titles&lt;/a&gt; based on fields already present on your entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like: &lt;code&gt;{raceLocation} {raceDistance} {whateverOtherField}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution would be to do a little &quot;sanitizing&quot; on the user's search terms to grab the distance before you send the search to Craft. Seems like searching on distance is a pretty common query, so a little AI might be in order.  Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get the query #}&#xA;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{# add the distance field to the search #}&#xA;{{ query|replace('10k','raceDistance:10k') }}&#xA;&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;{# rest of the search logic here #}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should match the terms the user put in. It'll also match the race distance separately.  You're probably going to want to use a regex on the distance &lt;code&gt;(\\d+\\s+km?)&lt;/code&gt; to make it more flexible...&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-10-16T15:22:55.127" LastActivityDate="2015-10-16T15:22:55.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11937" PostTypeId="5" CreationDate="2015-10-15T20:23:38.807" Score="0" Body="&lt;p&gt;If you're new to Craft, or wondering how you might approach a new, specific problem using Craft, this is the tag for you! Please be sure to describe your requirements as specifically as possible so that answers can be constructive and helpful.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="22" LastEditDate="2017-05-09T22:49:29.833" LastActivityDate="2017-05-09T22:49:29.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11938" PostTypeId="4" CreationDate="2015-10-15T20:23:38.807" Score="0" Body="Questions about Craft's capabilities, or how it might be used broadly to address the needs of a project." OwnerUserId="-1" LastEditorUserId="22" LastEditDate="2017-05-09T21:48:45.847" LastActivityDate="2017-05-09T21:48:45.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11939" PostTypeId="1" AcceptedAnswerId="11943" CreationDate="2015-10-15T20:34:44.260" Score="3" ViewCount="599" Body="&lt;p&gt;It's a pretty basic question, but for some reason all of the possible solutions do not work for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this: &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations#the-relatedTo-param&lt;/a&gt;&#xA;And also this (which I really expected to solve my problem): &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure I may have overlooked something, but I can't see what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastSeg = craft.request.lastSegment %}&#xA;{% set meubels = craft.entries.section('meubels').relatedTo(lastSeg) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And use this as a test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for meub in meubels %}&#xA;test&amp;lt;br&amp;gt;&#xA;{{ meub.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to every answer to related questions this should work, but unfortunately it returns nothing. But &lt;code&gt;lastSegment&lt;/code&gt; does return the required string from the URL. (At least, I'm assuming this must be a string)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a list of categories which all seem to route just fine, no problems there.&lt;/p&gt;&#xA;" OwnerUserId="3697" LastEditorUserId="3951" LastEditDate="2017-10-26T09:27:05.573" LastActivityDate="2017-10-26T09:27:05.573" Title="How can I use categories to filter entries?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11940" PostTypeId="5" CreationDate="2015-10-15T20:44:03.767" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-10-15T20:44:03.767" LastActivityDate="2015-10-15T20:44:03.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11941" PostTypeId="4" CreationDate="2015-10-15T20:44:03.767" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-10-15T20:44:03.767" LastActivityDate="2015-10-15T20:44:03.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11942" PostTypeId="2" ParentId="11850" CreationDate="2015-10-15T21:39:27.580" Score="26" Body="&lt;p&gt;The trouble is, there's no one way to utilize AWS. You can set up a simple VPS, or get endlessly complicated with load-balancing multiple servers, adding CDN, utilizing cool caching options, and plenty more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been fortunate enough to learn a lot from a siteops team that established all the infrastructure. It's a bit much for getting started, but the result was a combination of Route 53 for DNS, Elastic Beanstalk+Docker+EC2 for server instances, S3 for Asset sources, CloudFront for easy CDN, RDS for MySQL, and Elasticache for Redis session storage. Craft happily worked with all these things out of the box, after some trial and error. The goal wasn't to have a single server running, but discrete components that could be scaled for stability and demand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that's a horrendous place to get started. While I need to write a blog post about what I've learned AWS-wise, you can get started more simply by following &lt;a href=&quot;http://coenraets.org/blog/2012/01/setting-up-wordpress-on-amazon-ec2-in-5-minutes/&quot; rel=&quot;nofollow noreferrer&quot;&gt;a tutorial for another LAMP app like WordPress&lt;/a&gt; since most of the setup's going to be the same. If you're comfortable with Linux, or comfortable Googling your way through various tweaks, this should be a breeze. &lt;strong&gt;Just pretend the AWS control panel isn't hilariously daunting and you'll be fine.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking to be a Craft-AWS pro, you could experiment in steps:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Level 1: Get Craft running on a single EC2 instance&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;All the stuff on one box, conceptually identical to Digital Ocean or Linode or whatever. I like Ubuntu 14.04 because I'm most familiar with it, but you can pick a Linux distribution, make sure the requirements are in place, give Craft a poke, and triumphantly point a domain name to your EC2 IP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solspace have created &lt;a href=&quot;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&quot; rel=&quot;nofollow noreferrer&quot;&gt;a detailed guide&lt;/a&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Level 2: Sprinkle in AWS components&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This will prove that adding AWS services needn't be hard. You can easily...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9800/how-to-set-up-cloudfront-for-a-craft-site&quot;&gt;Add CDN with CloudFront&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Move MySQL off of your VPS and use RDS instead&lt;/li&gt;&#xA;&lt;li&gt;Use Elasticache for Redis, and store PHP's sessions there by installing an extension and adding two lines to php.ini (&lt;code&gt;session.save_handler = redis&lt;/code&gt; and &lt;code&gt;session.save_path = tcp://your-aws-cache-url:6379&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Use Route 53 for DNS, because why not&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Level 3: Automate deployments and use multiple server instances&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is where I start to gloss over: set up Docker images and Elastic Beanstalk for automated deployments, and add multiple EC2 server instances with load balancers (and &lt;a href=&quot;http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-sticky-sessions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;sticky sessions&lt;/a&gt;!) that spread out traffic. You've theoretically got many of your pieces in place after level 2, so if you can master level 3 you'll basically have your undergraduate degree in AWS.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit May 29, 2020&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it isn’t AWS-specific, there’s a Knowledge Base article with tips for configuring Craft for multi-server environments: &lt;a href=&quot;https://craftcms.com/knowledge-base/configuring-load-balanced-environments&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/knowledge-base/configuring-load-balanced-environments&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2020-05-29T15:19:52.823" LastActivityDate="2020-05-29T15:19:52.823" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11943" PostTypeId="2" ParentId="11939" CreationDate="2015-10-15T21:56:07.143" Score="2" Body="&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; parameter requires one of the following as an argument:&#xA;- AssetFileModel&#xA;- CategoryModel&#xA;- EntryModel&#xA;- UserModel&#xA;- TagModel&#xA;- An element’s ID&#xA;- An array of element objects and/or IDs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Passing in a string from the URL will not work. If you are not on a template that is the result of a category route, you need to fetch the category first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisCategory = craft.categories.handle(lastSeg).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use &lt;code&gt;thisCategory&lt;/code&gt; as your argument in the &lt;code&gt;relatedTo&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set meubels = craft.entries.section(‘meubels’).relatedTo(thisCategory) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-15T21:56:07.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11944" PostTypeId="1" CreationDate="2015-10-16T03:16:20.593" Score="2" ViewCount="165" Body="&lt;p&gt;I have 2 channels:survivors, survivorContent and a Category:themes. Relationships are as follows:&#xA;survivorContent has -&gt; related themes (max 3) AND survivorContent has -&gt; related survivors (max 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Themes are always only one level deep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a template that receives survivor.slug as a variable (based on a route). Given the survivor slug, I need to show a list of distinct themes that are &lt;em&gt;indirectly&lt;/em&gt; related to this survivor (via the survivorContent-&gt;survivor relationship and the survivorContent-&gt;themes relationship). Then I need to show the survivorContent entries under each of those filtered themes that are related to both that theme and the given survivor to get output like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Survivor.title&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related Theme 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related survivorContent1 (related to both the Survivor &amp;amp; Theme 1)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related survivorContent2 (related to both the Survivor &amp;amp; Theme 1)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related Theme 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related survivorContent3 (related to both the Survivor &amp;amp; Theme 2)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Related survivorContent1 (related to both the Survivor &amp;amp; Theme 2 as well as Theme 1, above)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to find a way to do this that is remotely efficient. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4205" LastEditorUserId="4205" LastEditDate="2015-10-16T13:49:52.983" LastActivityDate="2015-10-16T13:49:52.983" Title="How do I display entries, grouped by distinct categories where the entries share a relationship to both the category and an entry in another channel" Tags="&lt;relations&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11945" PostTypeId="2" ParentId="11944" CreationDate="2015-10-16T06:59:24.617" Score="2" Body="&lt;p&gt;Set up a criteria model with both of your &lt;code&gt;relatedTo&lt;/code&gt; conditions and add the hierarchy to the list of returned entries using Craft's &lt;code&gt;group&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries({&#xA;    section: 'survivorContent',&#xA;    relatedTo: [&#xA;        'and',&#xA;        {targetElement: entry.themesField},&#xA;        {targetElement: entry.survivorsField}&#xA;    ]&#xA;}) %}&#xA;&#xA;{% set relatedEntriesGrouped = relatedEntries|group('themesField.first().title') %}&#xA;&#xA;{% for title, entries in relatedEntriesGrouped %}&#xA;    {{ title }}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case you don't have a &quot;max. 1 element&quot; limit set on your relationship fields, you might also want to look into something like the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for theme in entry.themesField %}&#xA;&#xA;    {% set relatedEntries = craft.entries({&#xA;        section: 'survivorContent',&#xA;        relatedTo: [&#xA;            'and',&#xA;            {targetElement: theme},&#xA;            {targetElement: entry.survivorsField}&#xA;        ]&#xA;    }) %}&#xA;&#xA;    {% if relatedEntries|length %}&#xA;        {{ theme.title }}&#xA;        {% for entries in relatedEntries %}&#xA;            {{ entry.title }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-16T07:13:02.130" LastActivityDate="2015-10-16T07:13:02.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11946" PostTypeId="2" ParentId="11896" CreationDate="2015-10-16T07:02:52.637" Score="1" Body="&lt;p&gt;Sorry, but the answer is no; assets will initially just get titles based on their filenames until someone goes into the Control Panel and customizes them.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-16T07:02:52.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11947" PostTypeId="1" CreationDate="2015-10-16T08:04:00.620" Score="2" ViewCount="221" Body="&lt;p&gt;I'm trying to search through a set of results inside a Matrix field. Craft is giving me this error message: &lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;avdelinger&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I searched the information without the Matrix field it worked but now it's not. I'm using the smart map plugin to find the nearest office added in my Matrix field. Here's my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;sted&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% for block in entry.avdelinger %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ block.navn }}&amp;lt;/h3&amp;gt;&#xA;        {{ block.sted.street1 }}&amp;lt;br /&amp;gt;&#xA;        {{ block.sted.city }}, {{ block.sted.zip }}&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        Latitude: {{ block.sted.lat }}&amp;lt;br /&amp;gt;&#xA;        Longitude: {{ block.sted.lng }}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;!-- results --&amp;gt;&#xA;{% set target = craft.request.getParam('sted') %}&#xA;{% set params = {&#xA;    target: target,&#xA;    range: 1000,&#xA;    units: &quot;kilometers&quot;&#xA;} %}&#xA;&#xA;{% set blocks = entry.avdelinger(params).order('distance').find() %}&#xA;&#xA;&amp;lt;h2&amp;gt;Showing results for &quot;{{ target }}&quot;&amp;lt;/h2&amp;gt;&#xA;{% for block in blocks %}&#xA;    &amp;lt;div&amp;gt;&#xA;        {{ block.sted.street1 }}&amp;lt;br /&amp;gt;&#xA;        {{ block.sted.city }}, {{ block.sted.zip }}&amp;lt;br&amp;gt;&#xA;        &amp;lt;strong&amp;gt;{{ block.sted.distance | number_format(2) }} kilometers away&amp;lt;/strong&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h2&amp;gt;No results found&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4207" LastEditorUserId="57" LastEditDate="2015-10-16T15:38:41.970" LastActivityDate="2015-10-16T15:38:41.970" Title="Search Matrix and Smartmap" Tags="&lt;matrix&gt;&lt;elementcriteriamodel&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11948" PostTypeId="1" AcceptedAnswerId="11949" CreationDate="2015-10-16T08:31:58.907" Score="0" ViewCount="48" Body="&lt;p&gt;On my template I am showing detail of an entry.&#xA;Beneath this I am showing a list of other entries that share the same kind of category relationship as the entry being viewed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This list currently includes the entry being viewed and I wish to omit that from the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm retrieving the entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.entries.section('apprenticeshipsCats').relatedTo(entry).id('not ' ~ entry.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and had expected the 'not' parameter to do what I wanted but it doesn't seem to be working. entry.id is outputting the correct ID and even if I hardcode the entry id then it still appears in the list.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="125" LastEditDate="2015-10-16T13:03:38.213" LastActivityDate="2015-10-16T13:03:38.213" Title="Omitting current entry from list of entries generated from a relationship" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11949" PostTypeId="2" ParentId="11948" CreationDate="2015-10-16T09:04:35.613" Score="1" Body="&lt;p&gt;You probably kind of confuse your &quot;apprenticeships categories&quot; with your &quot;apprenticeships&quot; section. Try something like this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries({&#xA;    section: apprenticeships,&#xA;    id: 'not ' ~ entry.id,&#xA;    relatedTo: {&#xA;        targetElement: entry.apprenticeshipsCatsField&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You now want to order them by your categories? Have a look at my answer I just posted here: &lt;a href=&quot;https://craftcms.stackexchange.com/q/11944/125&quot;&gt;&quot;How do I display entries, grouped by distinct categories...&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-16T09:04:35.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11950" PostTypeId="2" ParentId="11947" CreationDate="2015-10-16T09:35:34.163" Score="2" Body="&lt;p&gt;The syntax to set a custom field parameter on a Matrix Block element criteria model is like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.myMatrixField.mySmartMapField(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-16T09:35:34.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11951" PostTypeId="1" CreationDate="2015-10-16T10:21:03.010" Score="0" ViewCount="30" Body="&lt;p&gt;I have a site consisting of 15 templates, all of which extend &lt;code&gt;_layout.html&lt;/code&gt;.  There is just one page (homepage) which needs to omit a chunk of the &lt;code&gt;_layout.html&lt;/code&gt;.  Is there something I can add to &lt;code&gt;_layout&lt;/code&gt; which says &quot;if I'm on the homepage leave this chunk of code out&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2015-10-16T15:39:32.583" LastActivityDate="2015-10-16T15:39:58.310" Title="Filter out part of _layout on a specific template" Tags="&lt;templating&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11952" PostTypeId="2" ParentId="11951" CreationDate="2015-10-16T10:31:55.703" Score="1" Body="&lt;p&gt;Sorry... while searching for an answer to something else I discovered the solution to this :/&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) != index.uri %}&#xA;&#xA;    .... leave this chunk of code out&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2015-10-16T15:39:58.310" LastActivityDate="2015-10-16T15:39:58.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11953" PostTypeId="1" AcceptedAnswerId="11962" CreationDate="2015-10-16T11:56:04.410" Score="2" ViewCount="47" Body="&lt;p&gt;Is it possible to login automatic the user right after he validate his email address&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-10-16T15:41:05.897" Title="Logged in after email validation" Tags="&lt;validation&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11954" PostTypeId="1" AcceptedAnswerId="11955" CreationDate="2015-10-16T12:00:02.583" Score="1" ViewCount="299" Body="&lt;p&gt;My entries have a field containing a third-party product id and a price, separated by a hyphen, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p666a-12.99&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the template, a plugin is returning me some product ids, and I want to return all entries containing those product ids. I know I can fetch all entries, reduce the custom field down to the product id and compare it to the product ids returned from the plugin, but that seems a bit tardy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I filter my entries using the custom field directly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# pluginIds = 'p666a, p678a' #}&#xA;{% set entries = craft.entries.section('sectionName').customField(pluginIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-10-16T13:30:39.507" Title="Return entries where custom field partially contains" Tags="&lt;entries&gt;&lt;custom-field&gt;&lt;contains&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11955" PostTypeId="2" ParentId="11954" CreationDate="2015-10-16T13:30:39.507" Score="4" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse&lt;/a&gt; plugin to save the product ID part of your field in a new hidden field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a new &quot;productId&quot; Preparse field to your entry type with this code in the field's settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.customField|split('-')|first }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To update all existing entries, re-save them by going into Settings → Sections → Section Name and click Save.&#xA;You can now set up a criteria model exactly like you mentioned in your question, except that you now use the&#xA;Preparse field as your custom field parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionName').productId(pluginIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-16T13:30:39.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11956" PostTypeId="2" ParentId="11897" CreationDate="2015-10-16T13:41:51.220" Score="1" Body="&lt;p&gt;This is due to the way Craft manages custom fields at the moment (but has been “fixed” for Craft 3). Whenever you save an element, you need to make sure all of the field values are in the same format they would be if they had come from an Edit Entry form submission. Here’s another post that describes what that looks like: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1101/how-to-save-a-matrix-content-of-a-new-entry-in-my-plugin/1218#1218&quot;&gt;How to save a matrix content of a new entry in my plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-16T13:41:51.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11958" PostTypeId="1" AcceptedAnswerId="11961" CreationDate="2015-10-16T14:25:29.760" Score="3" ViewCount="261" Body="&lt;p&gt;I have a site with a lot of asset fields, the assets are translatable. The client has added lots into the English fields but many of the Welsh ones haven't been populated. I want to have things fall back to the English assets in cases where there aren't any in the Welsh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of example, lets say we're on an entry page where an image has been uploaded in the English locale but one has not been uploaded in the Welsh locale...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.assetField | length %}&#xA;    {# output whichever the current locale is, if it's populated #}&#xA;    &amp;lt;img src=&quot;{{ entry.assetField.first().getUrl }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;{% elseif entry.assetField.locale('en_gb') | length %}&#xA;    {# fallback to the UK English asset if it exists #}&#xA;    &amp;lt;img src=&quot;{{ entry.assetField.locale('en_gb').first().getUrl }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't. It will pull English assets if I'm viewing the English version of the page, but it does not fall back when we're on the Welsh version of the page. Furthermore, if I am on the Welsh page and change the code to only reference English, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.assetField.locale('en_gb').first().getUrl }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it doesn't output an image at all. It's like Craft is ignoring the .locale parameter I'm setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm certain the local values are correct because those are what are in the Locale setting in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2015-10-16T14:34:53.027" LastActivityDate="2015-10-16T15:40:33.503" Title="Fallbacks for assets not avilable in a locale" Tags="&lt;assets&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11959" PostTypeId="2" ParentId="11923" CreationDate="2015-10-16T14:46:59.037" Score="13" Body="&lt;p&gt;You can set a cookie from your template, which assigns visitors to specific groups:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt; &lt;em&gt;(Use the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Cookies&lt;/a&gt; plugin)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set testGroup = craft.lj_cookies.get('group') %}&#xA;&#xA;{% if not testGroup %}&#xA;    {# New user - assign them to a group at random #}&#xA;    {% set testGroup = random(['a', 'b']) %}&#xA;    {% set expires = now|date_modify('+30 days').timestamp %}&#xA;    {% do craft.lj_cookies.set('group', testGroup, expires) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set testGroup = craft.app.request.cookies.get('group') %}&#xA;&#xA;{% if not testGroup %}&#xA;    {# New user - assign them to a group at random #}&#xA;    {% set testGroup = random(['a', 'b']) %}&#xA;    {% set expires = now|date_modify('+30 days').timestamp %}&#xA;    {% do craft.app.response.cookies.add(create({&#xA;        class: 'yii\\web\\Cookie',&#xA;        name: 'group',&#xA;        value: testGroup,&#xA;        httpOnly: true&#xA;    }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And then reference that &lt;code&gt;testGroup&lt;/code&gt; variable whenever you need to know which group they’re in:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% switch testGroup %}&#xA;    {% case 'a' %}&#xA;        ....&#xA;    {% case 'b' %}&#xA;        ....&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nice thing about this approach is that you can actually have multiple sets of test groups at the same time, using different cookie/variable names. You’re also not limited to two groups per set.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-04-25T16:54:03.930" LastActivityDate="2019-04-25T16:54:03.930" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11960" PostTypeId="2" ParentId="11928" CreationDate="2015-10-16T15:14:24.177" Score="5" Body="&lt;p&gt;As Brad mentioned, you’re not getting any results because your search query requires both keywords to be present, but you don’t have any fields that have both keywords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can solve this with a hidden &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;noreferrer&quot;&gt;Preparse&lt;/a&gt; field that stores the content of all fields you want to be cross-searchable. Call it something like “Keywords”, and set its Twig template to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myCustomFieldHandle }}&#xA;{{ entry.myOtherCustomFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to include any Matrix or relational fields in the keywords, remember the same templating rules apply here as on your front end templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixFieldHandle %}&#xA;    {{ block.myBlockFieldHandle }}&#xA;{% endfor %}&#xA;&#xA;{% for relatedEntry in entry.myEntriesFieldHandel %}&#xA;    {{ relatedEntry.title }}&#xA;    {{ relatedEntry.myRelatedEntryFieldHandle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you’ve got that field set up and added to your section(s), you’ll need to re-save all of your existing entries before it takes effect. An easy way to do that is to go into the sections’ settings and just click the Save button, which will trigger a “Resaving Elements” background task for all entries in the section.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-16T15:14:24.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11961" PostTypeId="2" ParentId="11958" CreationDate="2015-10-16T15:40:33.503" Score="3" Body="&lt;p&gt;I think you have to apply &lt;code&gt;locale('en_gb')&lt;/code&gt; to the entry and not to the field. So &lt;code&gt;entry.locale('en_gb').assetField.first().url&lt;/code&gt; should give you the correct value for the other locale.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-10-16T15:40:33.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11962" PostTypeId="2" ParentId="11953" CreationDate="2015-10-16T15:41:05.897" Score="3" Body="&lt;p&gt;I believe you're looking for the aptly named &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#autoLoginAfterAccountActivation&quot; rel=&quot;nofollow&quot;&gt;autoLoginAfterAccountActivation&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-16T15:41:05.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11963" PostTypeId="1" AcceptedAnswerId="11967" CreationDate="2015-10-16T15:45:15.830" Score="3" ViewCount="104" Body="&lt;p&gt;I have an ElementCriteriaModel in which I need to find elements that contain a particular value for &quot;state&quot;, which is a property of a &quot;Smart Map&quot; field (&lt;code&gt;$element-&amp;gt;smartMapField-&amp;gt;state&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering after a &lt;code&gt;find&lt;/code&gt; would be easy, but I need to do this in the ElementCriteriaModel, as I am passing it to the 'criteria' option for ElementAPI (&lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ElementAPI&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2021-01-01T06:24:59.813" Title="Filtering/Searching fields with enumerated data (e.g. Smart Map) in an ElementCriteria model" Tags="&lt;elementcriteriamodel&gt;&lt;filter&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11964" PostTypeId="1" AcceptedAnswerId="11965" CreationDate="2015-10-16T15:52:31.680" Score="1" ViewCount="543" Body="&lt;p&gt;I'm running a very simple query on a text field...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery('email') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Locally, with one entry on my machine, I'm getting a response time of 332ms. We were assuming around 3,000 total entries, but 3 days in, I'm at 15,000 and climbing by hundreds per hour. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good starting point for CPU/RAM on a VPS if I assume that we could hit 50,000? &lt;/p&gt;&#xA;" OwnerUserId="377" LastActivityDate="2015-10-16T16:10:04.950" Title="Recommended CPU/RAM VPS settings to query 50,000 entries" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11965" PostTypeId="2" ParentId="11964" CreationDate="2015-10-16T16:10:04.950" Score="1" Body="&lt;p&gt;The CPU won't be the issue more the RAM if you expect to pull in all those results. But it's not much anyways.... A 1 CPU/1GB RAM on Digitalocean will be enough. &lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-10-16T16:10:04.950" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11966" PostTypeId="1" CreationDate="2015-10-16T16:47:40.747" Score="1" ViewCount="2396" Body="&lt;p&gt;Ok this has been puzzling me for too long now! I have some code that makes an ajax request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;reqAjax: {&#xA;    type: 'get',&#xA;    url: '/mytemplatefolder/myfile.html',&#xA;    data: {town: 'bournemouth'}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a json object to populate dates in a calendar. The dates have links to the town the event is in but to do this dynamically I need to be able to make use of the town param in twig. What I have at the moment at the top of myfile.html is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json; charset=utf-8&quot; %}&#xA;{% header &quot;Access-Control-Allow-Origin: *&quot; %}&#xA;&#xA;{% set town = craft.request.getParam('town') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But town is not being set. So I guess I am missing something on how to get the data from the ajax call and set it in the template. Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-10-16T16:47:40.747" Title="How to get a param from an ajax request in twig?" Tags="&lt;templating&gt;&lt;ajax&gt;&lt;params&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11967" PostTypeId="2" ParentId="11963" CreationDate="2015-10-16T17:42:13.087" Score="2" Body="&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As of Smart Map 2.3.0, this is now possible!&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;s&gt;Currently, this isn't possible. However, it's a popular feature request which is rising quickly on the priority list.&lt;/p&gt;&#xA;&lt;p&gt;The current workaround (as you noted) is to simply filter the results afterward.&lt;/s&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:24:59.813" LastActivityDate="2021-01-01T06:24:59.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11968" PostTypeId="1" CreationDate="2015-10-16T20:58:41.260" Score="4" ViewCount="562" Body="&lt;p&gt;I'm importing an existing ExpressionEngine site's content into Craft, using content exported in XML on the EE site, and stepping through each entry.&lt;/p&gt;&#xA;&lt;p&gt;This includes hooking up Assets files, where the Assets field/upload location is pointing to the same S3 bucket that Channel Files was on the EE site.&lt;/p&gt;&#xA;&lt;p&gt;In my first load of these entries, I was able to successfully map the Assets fields using the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$assets = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$assets-&amp;gt;filename = $referenceFile-&amp;gt;filename;&#xA;$assets-&amp;gt;limit = 1;&#xA;&#xA;foreach ($assets as $assetMatched)&#xA;    $assetId = $assetMatched-&amp;gt;id;&#xA;&#xA;$assetsToSave[] = $assetId;&#xA;&#xA;if ($saveAssets)&#xA;    $entryToSave-&amp;gt;getContent()-&amp;gt;referenceItemFiles = $assetsToSave;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On a re-run of the import, where I check for a match on the imported entry at each pass, I began receiving an FK error on the Assets field, but I want to set that aside for now. I reverted my database and ran the 1st time import again. I'm now seeing the following error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;S3Exception&lt;/p&gt;&#xA;&lt;p&gt;S3::copyObject(reference-materials, 1610-10-01-001-0000015-supertrust_final_prospectus_may_29_1992--pp_33-end.pdf, reference-materials, 1610-10-01-001-0000015-supertrust_final_prospectus_may_29_1992-pp_33-end_1.pdf): [NoSuchKey] The specified key does not exist.&lt;/p&gt;&#xA;&lt;p&gt;/Users/markreeves/Projects/Clients/40Act.com/craft_site/craft/app/lib/S3.php(816)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Based on a) the &lt;code&gt;copyObject&lt;/code&gt; text and b) the &lt;code&gt;_1&lt;/code&gt; in the second filename, I'm now concerned. My question:&lt;/p&gt;&#xA;&lt;p&gt;What's being done here when I save a new or existing entry in plugin code that includes an Assets field?&lt;/p&gt;&#xA;&lt;p&gt;Is Craft trying to copy files? I'm now seeing a bunch of files in my S3 bucket with today's date as timestamp, and I'm not seeing corresponding activity on the live site using the same bucket, so it seems that Craft is not just creating relations for those files, but is actually touching the files, too. This is not what I would expect.&lt;/p&gt;&#xA;&lt;p&gt;What should I expect to happen when I map asset IDs to an Assets field based on files that already exist? I had Craft index the S3 bucket via the admin prior to running this code, so that the database has records of those files.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; It looks like Craft has renamed files in the existing bucket, causing them to break on the other site. Specifically, it looks like Craft has replaced &lt;code&gt;--&lt;/code&gt; in the filenames with &lt;code&gt;-&lt;/code&gt;, removed &lt;code&gt;,&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-10-16T21:06:49.683" Title="Saving entries in plugin: How are Assets relations handled?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;s3&gt;&lt;saving&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-10-19T16:18:31.713" ContentLicense="CC BY-SA 3.0" />
  <row Id="11969" PostTypeId="1" CreationDate="2015-10-16T21:15:14.387" Score="0" ViewCount="729" Body="&lt;p&gt;How can I create a plugin that will let me copy entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1651/how-to-duplicate-entries&quot;&gt;question&lt;/a&gt; but don't have a good answer.&lt;/p&gt;&#xA;" OwnerUserId="4125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-17T16:04:07.790" Title="How can I copy an entry?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11970" PostTypeId="2" ParentId="11247" CreationDate="2015-10-16T22:07:04.630" Score="1" Body="&lt;p&gt;For anybody finding this in the future, it can be done with Craft and the GuestEntries plugin, although it'll take some intermediate Craft knowledge. (Entry Management, a custom Method for the file upload, associating Assets with certain entries, et cetera.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic setup that you'd have is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Students can create  their account from the front end. This requires Craft Pro, which you're better off using for something of this caliber: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Student Login Page&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This would be handled by Craft's usual User functionality. Students login and are redirected to the 'Class Listing' page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Class Listing Page&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is where you'll need a custom plugin to associate Users with Classes, and vice-versa. There &lt;em&gt;might&lt;/em&gt; be a plugin out there that can do this; you'll have to do the legwork to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever you do, the plugin will generate a list of associated classes for the logged-in user, organized by Semester. &lt;em&gt;(Again, a custom plugin with the proper relational tables.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little javascript will take care of the accordion collapse functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user will click on a class, and Craft will redirect them to the...&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Class Page&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This would actually be a pretty standard entry page. Display all the associated fields for a Class. (Create Asset fields for Resources/Pictures, Body field for Content, et cetera.) Locking functionality could be taken care of with Entry Status. (Disabled = 'locked')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only intermediate functionality is the File Upload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guest Entries can do this; it's a form input with the name of your Field Handle, like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;yourPluginFieldHandle&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone builds this, make sure you know how Craft works, lest you open yourself up to some serious Asset Management issues.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-10-16T22:07:04.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11971" PostTypeId="1" AcceptedAnswerId="11979" CreationDate="2015-10-17T11:42:13.277" Score="1" ViewCount="816" Body="&lt;p&gt;I need to output a row every three items in a matrix. Here is what I have so far. The problem is that this outputs a row every three items but it duplicates each matrix item three times and puts them in a row rather than taking the items as they come. Any help here would be very much appreciated Thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aboutInfo = entry.imageLinkBoxes %}&#xA;{% set infoGrouped = aboutInfo|batch(3) %}&#xA;&#xA;{% for group in infoGrouped %}&#xA;    {% for block in entry.imageLinkBoxes %}&#xA;&#xA;        {% if block.type == &quot;imageLinkBox&quot; %}&#xA;&#xA;            {% set row = 'row--' ~ loop.index %}&#xA;&#xA;            &amp;lt;div class=&quot;row {{ row }}&quot;&amp;gt;&#xA;                {% for entry in group %}&#xA;&#xA;                    &amp;lt;div class=&quot;span4&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;icon-box-2&quot;&amp;gt;    &#xA;                            &amp;lt;i class=&quot;ifc-tv_show&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                            &amp;lt;div class=&quot;icon-box-content&quot;&amp;gt;&#xA;                                &amp;lt;h3 class=&quot;text-uppercase text-center&quot;&amp;gt;&#xA;                                    &amp;lt;a href=&quot;#&quot;&amp;gt;{{ block.entry.first().title }}&amp;lt;/a&amp;gt;&#xA;                                &amp;lt;/h3&amp;gt;&#xA;                                &amp;lt;p&amp;gt;{{ block.text }}&amp;lt;/p&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;               &#xA;                    &amp;lt;/div&amp;gt;&#xA;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3398" LastEditorUserId="57" LastEditDate="2015-10-17T17:19:57.503" LastActivityDate="2015-10-19T16:02:22.223" Title="Create a new row every 3 items in a matrix" Tags="&lt;matrix&gt;&lt;forloop&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11972" PostTypeId="2" ParentId="11969" CreationDate="2015-10-17T11:45:03.903" Score="3" Body="&lt;p&gt;You’d start by creating a new &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; and copying over the normal properties:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$oldEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById(100);&#xA;&#xA;$newEntry = new EntryModel();&#xA;&#xA;// core element attributes&#xA;$newEntry-&amp;gt;enabled = $oldEntry-&amp;gt;enabled;&#xA;$newEntry-&amp;gt;locale = $oldEntry-&amp;gt;locale;&#xA;$newEntry-&amp;gt;localeEnabled = $oldEntry-&amp;gt;localeEnabled;&#xA;$newEntry-&amp;gt;slug = $oldEntry-&amp;gt;slug;&#xA;$newEntry-&amp;gt;uri = $oldEntry-&amp;gt;uri;&#xA;$newEntry-&amp;gt;getContent()-&amp;gt;title = $oldEntry-&amp;gt;getContent()-&amp;gt;title;&#xA;&#xA;// entry attributes&#xA;$newEntry-&amp;gt;sectionId = $oldEntry-&amp;gt;sectionId;&#xA;$newEntry-&amp;gt;typeId = $oldEntry-&amp;gt;typeId;&#xA;$newEntry-&amp;gt;authorId = $oldEntry-&amp;gt;authorId;&#xA;$newEntry-&amp;gt;postDate = $oldEntry-&amp;gt;postDate;&#xA;$newEntry-&amp;gt;expiryDate = $oldEntry-&amp;gt;expiryDate;&#xA;&#xA;// do this if it's in a Structure section&#xA;if (($parent = $oldEntry-&amp;gt;getParent()) !== null)&#xA;{&#xA;    $newEntry-&amp;gt;parentId = $parent-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where things get tricky is copying all of the content. That's tough because many field types expect their values to be in one format when saving, but they return their values in another format when you call &lt;code&gt;$entry-&amp;gt;myFieldHandle&lt;/code&gt;. For example relationship fields (Entries, Assets, Users, Categories, and Tags) each expect you to set their values as an array of related elements’ IDs when saving an entry, but when you call &lt;code&gt;$entry-&amp;gt;myRelationalField&lt;/code&gt; (or &lt;code&gt;entry.myRelationalField&lt;/code&gt; from a template) you’re getting an &lt;a href=&quot;http://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; back. So for those, you’d have to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$newEntry-&amp;gt;setContentFromPost(array(&#xA;    'myAssetsField' =&amp;gt; $oldEntry-&amp;gt;myAssetsField-&amp;gt;ids()&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are some other posts that touch on how to format the various field types’ values (i.e. &lt;a href=&quot;https://craftcms.stackexchange.com/q/8517/9&quot;&gt;Duplicating Matrix fields with content from another locale&lt;/a&gt;), but nothing comprehensive.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-17T16:04:07.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11973" PostTypeId="1" AcceptedAnswerId="11986" CreationDate="2015-10-18T13:47:31.217" Score="1" ViewCount="1232" Body="&lt;p&gt;Been trying to get this working for a few hours but no joy, hope someone can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking like an post archive of all entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub Category 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry / Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Sub Category 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry / Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub Category 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry / Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried with grouping and even tried with a plugin - &lt;a href=&quot;https://github.com/timkelty/groupby-craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/timkelty/groupby-craft&lt;/a&gt; But no luck so far, help greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3489" LastEditorUserId="9" LastEditDate="2015-10-19T12:50:27.210" LastActivityDate="2015-11-05T15:46:42.323" Title="Entries grouped by Category and then Sub Category" Tags="&lt;categories&gt;&lt;group&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11974" PostTypeId="1" CreationDate="2015-10-18T20:56:43.060" Score="1" ViewCount="120" Body="&lt;p&gt;I am not even sure, I can explain it. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have a several sections, but I'll go with &quot;Products&quot; section. Than I have category group called &quot;Filter&quot;. I'd like to use only this category group for all sections. ( if there is a better approach/start in this step, include it in your answer ).&lt;/li&gt;&#xA;&lt;li&gt;When page &quot;Products&quot; is loaded, there should be a category list of top level categories only + entries related to &quot;Products&quot;.&lt;/li&gt;&#xA;&lt;li&gt;When a top level category link &quot;Cat1&quot; is clicked at &quot;site.com/products&quot;, a page &quot;site.com/products/cat1&quot; should load. On &quot;site.com/products/cat1&quot; page should be a category list of top level categories + sub level categories + entries related to sub level category.&lt;/li&gt;&#xA;&lt;li&gt;Then, when a sub level category link &quot;cat1.1&quot; is clicked, a page &quot;site.com/products/cat1/cat1.1&quot; should load with the same scenario as in previous step.&lt;/li&gt;&#xA;&lt;li&gt;We will carry on up to, when we have url formed like this: &quot;site.com/products/cat1/cat1.1/cat1.1.1/entry-title&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope, you have some image about, What I'm trying to draw here.&#xA;I only see this achievable through sections and categories.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-10-18T20:56:43.060" Title="Display sub-category depended on selected category with related entries" Tags="&lt;categories&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11975" PostTypeId="1" CreationDate="2015-10-18T21:14:23.963" Score="3" ViewCount="378" Body="&lt;p&gt;I found searching through other questions here that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Currently the images are being cleansed on upload, which means that&#xA;  they are being re-saved to make sure that no malicious code is&#xA;  injected in them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that &lt;strong&gt;optimized 8-bit PNGs with alpha transparency&lt;/strong&gt; (like the ones TinyPng creates) are &lt;strong&gt;transformed on upload to indexed, non-alpha transparency PNGs&lt;/strong&gt; - and as a result they look very bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not even using any transforms, so this is just from the &quot;cleansing&quot; that Craft does automatically on upload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially was using the GD library but then I installed ImageMagick and even forced Craft to use ImageMagick through the config setting - nothing helped&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image uploads work just fine with ImageMagick, except the PNG issue described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I need to configure in the ImageMagick library or it's PHP plugin? Or can I disable the &quot;cleansing&quot; that Craft does? (I don't want to do that since I love the added security, but I really need to use transparent, compressed PNGs in my website designs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here's a PNG image, before and after upload (just posted the links, since theimage is big and I didn't want to mess up the thread):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tJvpY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Before the upload&lt;/a&gt; - shows as RGB mode in Photoshop - has alpha transparency. Was saved as PNG 24 from PS then compressed with TinyPNG&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W0I9b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;After the upload&lt;/a&gt; - shows as Indexed mode in Photoshop - no alpha transparency - was re-saved by Craft on upload from the CP.&lt;/p&gt;&#xA;" OwnerUserId="4213" LastEditorUserId="4213" LastEditDate="2015-10-19T06:44:24.123" LastActivityDate="2015-10-19T06:44:24.123" Title="Uploaded 8-bit PNGs losing alpha transparency (using ImageMagick)" Tags="&lt;upload&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-10-20T17:16:13.827" ContentLicense="CC BY-SA 3.0" />
  <row Id="11976" PostTypeId="1" CreationDate="2015-10-19T01:57:54.287" Score="1" ViewCount="297" Body="&lt;p&gt;I have an Asset field for front end users to upload asset files. I prefer to use the 'Restrict allowed file types?' option. However I do not see a choice for Rich Text Format (RTF). I have 'Word' checked, amongst others, but RTF is still rejected. Is there a way to amend this so users can submit RTF files? I am using the Sprout Forms plugin if it matters.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-10-19T02:30:39.673" Title="How can I get a restricted Asset Allowed File Type upload to accept RTF files" Tags="&lt;assets&gt;&lt;richtext&gt;&lt;upload&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11977" PostTypeId="2" ParentId="11976" CreationDate="2015-10-19T02:30:39.673" Score="3" Body="&lt;p&gt;Does this help you? It'll let you add additional file extensions that are allowed to be uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#allowedFileExtensions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2015-10-19T02:30:39.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11979" PostTypeId="2" ParentId="11971" CreationDate="2015-10-19T07:17:58.883" Score="4" Body="&lt;p&gt;To my understanding this should work for a matrix field (called imageLinkBoxes) that contains only one type of block (&lt;code&gt;imageLinkBox&lt;/code&gt;) that has 3 fields (&lt;code&gt;imageLinkBox.linkText&lt;/code&gt;, &lt;code&gt;imageLinkBox.linkUrl&lt;/code&gt; and &lt;code&gt;imageLinkBox.text&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aboutInfo = entry.imageLinkBoxes %} {# get all the blocks in the matrix #}&#xA;&#xA;{% if aboutInfo|length %} {# check we have at least one block in the matrix #}&#xA;&#xA;    {% set infoGrouped = aboutInfo|batch(3) %} {# group them in groups of 3 blocks #}&#xA;&#xA;    {% for group in infoGrouped %}  {# loop through all the groups #}&#xA;&#xA;        {% set row = 'row--' ~ loop.index %} {# set the class #}&#xA;&#xA;        &amp;lt;div class=&quot;row {{ row }}&quot;&amp;gt; {# open the row #}&#xA;&#xA;        {% for block in group %} {# loop through all the blocks in current group #}&#xA;&#xA;            &amp;lt;div class=&quot;span4&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;icon-box-2&quot;&amp;gt;    &#xA;                    &amp;lt;i class=&quot;ifc-tv_show&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                    &amp;lt;div class=&quot;icon-box-content&quot;&amp;gt;&#xA;                        &amp;lt;h3 class=&quot;text-uppercase text-center&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{ block.linkUrl }}&quot;&amp;gt;{{ block.linkText }}&amp;lt;/a&amp;gt; &#xA;                        &amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ block.text }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;  &#xA;                &amp;lt;/div&amp;gt;&#xA;               &amp;lt;!-- /.icon-box-2 --&amp;gt;               &#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;!-- /.span4--&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;/div&amp;gt; {# close the row #}&#xA;        &amp;lt;!-- /.row--&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If for some reason you have more than one type of block in the matrix, then you would need to do a change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aboutInfo = entry.imageLinkBoxes %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aboutInfo = entry.imageLinkBoxes.type('imageLinkBox') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would filter the blocks to only those of the type &lt;code&gt;imageLinkBox&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4213" LastEditorUserId="57" LastEditDate="2015-10-19T16:02:22.223" LastActivityDate="2015-10-19T16:02:22.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11981" PostTypeId="1" AcceptedAnswerId="12088" CreationDate="2015-10-19T11:36:41.650" Score="2" ViewCount="1391" Body="&lt;p&gt;I try to explain you semantically what I want to achieve here. I couldn't make it shorter. Sorry.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Navigation will be constructed from &lt;code&gt;.level(1)&lt;/code&gt; categories.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At &quot;site.com/firstLevelCat&quot; I want to display list of populated &lt;code&gt;.level(2)&lt;/code&gt; categories like this&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat&lt;/li&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat2&lt;/li&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At &quot;site.com/firstLevelCat/secondLevelCat&quot; I'd like to display list of &lt;code&gt;.level(2)&lt;/code&gt; categories along with a list of &lt;code&gt;.level(3)&lt;/code&gt; categories like this&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat/thirdLevelCat&lt;/li&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat2/thirdLevelCat&lt;/li&gt;&#xA;&lt;li&gt;site.com/firstLevelCat/secondLevelCat3/thirdLevelCat&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I intend to build it up to 4th level.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-10-25T08:38:32.463" LastActivityDate="2015-10-25T08:49:38.220" Title="How do I only display list of categories at certain level of parent category that have entries" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11982" PostTypeId="1" CreationDate="2015-10-19T13:23:53.763" Score="2" ViewCount="1045" Body="&lt;p&gt;I have a front end form that allows users check checkboxes to find entries that have matching field values. I've pieced together a query reading other posts here and my limited knowledge of Craft and Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My entries have multiple dropdown fields that are getting matched (1 match per field) and one checkbox field (1 or more matches per field). My query works when I only have dropdown fields but I'm struggling getting it to work to match the checkbox fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my paired down query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set params = {&#xA;    section: 'entriesSection',&#xA;    limit: null&#xA;    } %}&#xA;&#xA;    {% set relatedParams = ['and'] %}&#xA;&#xA; {# dropdown field match #}&#xA;    {% set brand = craft.request.getParam('brand') %}&#xA;       {% if getBrand %}&#xA;           {% set params = params|merge({'brand':getBrand}) %}&#xA;       {% endif %}&#xA;&#xA; {# checkbox field match #}&#xA;    {% set getLocation = craft.request.getParam('location') %}&#xA;    {% if getLocation %}&#xA;          {% for eachLocation in getLocation %}&#xA;              {% set params = params|merge({'eachLocation'}):getLocation}) %}&#xA;          {% endfor %}&#xA;    {% endif %}&#xA;&#xA; {# merge related params and params #}&#xA;    {% if relatedParams|length &amp;gt; 1 %}&#xA;         {% set params = params|merge({'relatedTo':relatedParams}) %}&#xA;    {% endif %}&#xA;&#xA; {# search #}&#xA;    {% set entries = craft.entries(params).search(searchParams|trim) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my paired down front-end form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;form&amp;gt;&#xA;&#xA;&amp;lt;!-- brand matches dropdown fields--&amp;gt;&#xA;&#xA;    &amp;lt;label&amp;gt;&#xA;       &amp;lt;input type=&quot;checkbox&quot; name=&quot;brand[]&quot; value =&quot;brandX&quot; /&amp;gt;&#xA;    Brand X&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;label&amp;gt;&#xA;       &amp;lt;input type=&quot;checkbox&quot; name=&quot;brand[]&quot; value =&quot;brandY&quot; /&amp;gt;&#xA;    Brand Y&#xA;    &amp;lt;/label&amp;gt;&#xA;&#xA; &amp;lt;!-- location matches checkbox fields --&amp;gt;&#xA;&#xA;    &amp;lt;label&amp;gt;&#xA;       &amp;lt;input type=&quot;checkbox&quot; name=&quot;location[]&quot; value =&quot;locationA&quot; /&amp;gt;&#xA;    Location A&#xA;    &amp;lt;/label&amp;gt;&#xA;&#xA;    &amp;lt;label&amp;gt;&#xA;       &amp;lt;input type=&quot;checkbox&quot; name=&quot;location[]&quot; value =&quot;locationB&quot; /&amp;gt;&#xA;    Location B&#xA;    &amp;lt;/label&amp;gt;&#xA; &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2016-10-27T17:54:39.327" Title="Craft Request Filter Query Matching Drop Down Fields and Checkbox Fields" Tags="&lt;search&gt;&lt;filter&gt;&lt;drop-down&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11983" PostTypeId="1" AcceptedAnswerId="11987" CreationDate="2015-10-19T13:39:27.287" Score="3" ViewCount="898" Body="&lt;p&gt;I am new in Craft, and will be happy if I can get help with this task. I have a tab that contains only multiselect fields. What I want to do, is to get all selected values for all multiselects field in this tab. I find this &lt;a href=&quot;https://craftcms.stackexchange.com/a/5253/4109&quot;&gt;answer&lt;/a&gt; to get all field from a tab, but I can't get the selected values for the entry. Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tab in entry.getFieldLayout().getTabs() %}&#xA;  {% if tab.name == 'Spec' %}&#xA;    &amp;lt;ul&amp;gt;&#xA;      &amp;lt;li&amp;gt;{{ tab.name }}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% for field in tab.getFields() %}&#xA;            &amp;lt;li&amp;gt;{{ field.getField().name }}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4109" LastEditorUserId="22" LastEditDate="2017-05-09T23:17:48.013" LastActivityDate="2017-05-09T23:17:48.013" Title="Get selected values from all of an entry’s Multi-select fields" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11984" PostTypeId="1" AcceptedAnswerId="11988" CreationDate="2015-10-19T15:57:40.263" Score="5" ViewCount="218" Body="&lt;p&gt;I am writing a custom field type that makes use of Craft's asset selector, and saw that there is an elementSelector macro (in &lt;code&gt;includes/_forms&lt;/code&gt;). I want to be able to do some things onSelect, but I cannot tell if that is possible with the elementSelector macro. I know the element select modals can be extended using &lt;code&gt;Craft.createElementSelectorModal()&lt;/code&gt;. Is this the only way to access element select modal callbacks?&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="57" LastEditDate="2015-10-19T16:04:50.230" LastActivityDate="2015-10-19T22:33:41.667" Title="Are there callbacks for elementSelect macro?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;custom-fieldtype&gt;&lt;javascript&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11985" PostTypeId="1" CreationDate="2015-10-19T18:16:41.850" Score="0" ViewCount="90" Body="&lt;p&gt;I'm working on a custom plugin / fieldtype, and it requires first an external JS library, and then it needs to be initialized in-page. I.e:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;//remote.path.to/my_script.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;    my_script.init({selector: '#my_field'});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the fieldtype set up as a second Entry Type in a test channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to post a new entry, I (obviously) have to change Entry Types to the one with the field I'm developing. The first time I do this, everything works fine and initializes, but if I change the Entry Type back to the original type and then back again to the one with the test field, the Javascript initialization no longer appears to work or get triggered. In the browser's inspector, I see that the initialization line is getting inserted at the bottom of the HTML each time I switch to that Entry Type, so there's definitely duplicate code being appended; not sure if that's the issue or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the basic and abstracted fieldtype code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_MyFieldType extends BaseFieldType&#xA;{&#xA;    function init()&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsFile('//remote.path.to/my_script.js');&#xA;    }&#xA;&#xA;    public function getInputHtml($name, $value)&#xA;    {&#xA;        $id = craft()-&amp;gt;templates-&amp;gt;formatInputId($name);&#xA;        $namespacedId = craft()-&amp;gt;templates-&amp;gt;namespaceInputId($id);&#xA;&#xA;        // Prepare init string&#xA;        $script_init = &quot;my_script.init({selector: '#&quot; . $namespacedId . &quot;'});&quot;;&#xA;&#xA;        // Include JS&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs($script_init);&#xA;&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('MyPlugin/field', array(&#xA;            'name'          =&amp;gt; $name,&#xA;            'id'            =&amp;gt; $id,&#xA;            'value'         =&amp;gt; $value&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm including the call to the remote script in the &lt;code&gt;init()&lt;/code&gt; function so it doesn't get duplicated along with everything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's going on - why does the initialization not survive toggling between Entry Types?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Also, not sure if related, but the field doesn't seem to survive the Live Preview mode, either. The JS-modifications that the script makes to the HTML form element are there visually, but I can't focus the caret in there. Also, once I exit the Live Preview mode, the content that was in the field before Live Preview is gone. I suspect at least part of this stuff is the external script I'm working with, but I figured I'd best report it anyway.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="3904" LastEditDate="2015-10-19T18:23:26.783" LastActivityDate="2015-10-19T18:23:26.783" Title="Issue with external JS when toggling between entry types" Tags="&lt;plugin-development&gt;&lt;entry-type&gt;&lt;custom-fieldtype&gt;&lt;devmode&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11986" PostTypeId="2" ParentId="11973" CreationDate="2015-10-19T21:39:56.453" Score="4" Body="&lt;p&gt;You can get the categories to display hierarchically pretty efficiently using the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;{% nav %} tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set categories = craft.categories.group('myGroup').find() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% nav category in categories %}&#xA;    &amp;lt;li class=&quot;category&quot;&amp;gt;&#xA;      {{ category.title }}&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can add in the related entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;li class=&quot;category&quot;&amp;gt;&#xA;  ...&#xA;  {% endifchildren %}&#xA;&#xA;  {# Are we on the second level of categories? #}&#xA;  {% if category.level == 2 %}&#xA;    {# Look for any entries that are related to this category #}&#xA;    {% set entries = craft.entries.relatedTo({&#xA;      targetElement: category,&#xA;      field: 'myCategoriesField'&#xA;    }) %}&#xA;    {# If there are any, then output them in a nested UL #}&#xA;    {% if entries|length %}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;          &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;  {% endif %}&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That code suffers from the “&lt;em&gt;N&lt;/em&gt;+1” problem though - each 2nd level category is going to need to initiate a new SQL query to fetch the related entries. So rendering this list will require &lt;em&gt;N&lt;/em&gt;+1 SQL queries – one query to geth the initial set of categories, plus &lt;em&gt;N&lt;/em&gt;, the total number of second-level categories. If you have 100 categories, that’s 101 SQL queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve this, you’d need to “eager-load” the related entries. Craft doesn’t support that of the box, but Mike Pepper has a nice little plugin called &lt;a href=&quot;https://github.com/mdcpepper/fetch&quot; rel=&quot;nofollow&quot;&gt;Fetch&lt;/a&gt; which makes it possible.  Download and install that, and then you can do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set categories = craft.categories.group('myGroup').find() %}&#xA;{% do craft.fetch.entries(categories, 'reverse:myCategoriesField') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% nav category in categories %}&#xA;    &amp;lt;li class=&quot;category&quot;&amp;gt;&#xA;      {{ category.title }}&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;&#xA;      {# Are we on the second level of categories, and are there any related entries? #}&#xA;      {% if category.level == 2 and&#xA;            category.fetched('reverse:myCategoriesField')|length %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% for entry in category.fetched('reverse:myCategoriesField') %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-11-05T15:46:42.323" LastActivityDate="2015-11-05T15:46:42.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11987" PostTypeId="2" ParentId="11983" CreationDate="2015-10-19T22:25:27.950" Score="2" Body="&lt;p&gt;You can loop through all of the selected values of a multi-select field like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for value in entry.myFieldHandle %}&#xA;  &amp;lt;li&amp;gt;{{ value }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(See the &lt;a href=&quot;http://buildwithcraft.com/docs/multi-select-fields#templating&quot; rel=&quot;nofollow&quot;&gt;Multi-select field docs&lt;/a&gt; for other examples.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to loop through &lt;em&gt;all&lt;/em&gt; of your multi-select fields’ values would be to manually merge all of their values into a new array:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set values = entry.fieldHandleOne&#xA;    |merge([entry.fieldHandleTwo])&#xA;    |merge([entry.fieldHandleThree]) %}&#xA;&#xA;{% for value in values %}&#xA;    {{ value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really don’t want to hardcode the field handles in your template, then you can go the getFieldLayout() route. That &lt;code&gt;field.getField()&lt;/code&gt; function will give you the actual &lt;a href=&quot;http://buildwithcraft.com/classreference/models/FieldModel&quot; rel=&quot;nofollow&quot;&gt;FieldModel&lt;/a&gt; that represents the field. You can use its &lt;code&gt;handle&lt;/code&gt; property to access the field’s selected values on your &lt;code&gt;entry&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set values = [] %}&#xA;&#xA;{% for tab in entry.getFieldLayout().getTabs() %}&#xA;  {% if tab.name == 'Spec' %}&#xA;    {% for field in tab.getFields() %}&#xA;      {% set handle = field.getField().handle %}&#xA;      {% set fieldValues = entry.getFieldValue(handle) %}&#xA;      {% set values = values|merge([fieldValues]) %}&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for value in values %}&#xA;  {% for selected in value %}&#xA;    &amp;lt;li&amp;gt;{{ selected}}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="4109" LastEditDate="2015-10-21T13:32:15.303" LastActivityDate="2015-10-21T13:32:15.303" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11988" PostTypeId="2" ParentId="11984" CreationDate="2015-10-19T22:33:41.667" Score="6" Body="&lt;p&gt;You can get the Element Select’s JS instance like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function() {&#xA;  var elementSelect = $('#your-container-id').data('elementSelect');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Replace &lt;code&gt;your-container-id&lt;/code&gt; with whatever ID you passed into the &lt;code&gt;id&lt;/code&gt; param when calling &lt;code&gt;forms.elementSelect&lt;/code&gt; or &lt;code&gt;forms.elementSelectField&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can attach a selection callback to that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;elementSelect.on('selectElements', function(elements) {&#xA;  // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There’s also a &lt;code&gt;'removeElements'&lt;/code&gt; callback function you can add.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-19T22:33:41.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11990" PostTypeId="1" CreationDate="2015-10-20T07:44:07.417" Score="1" ViewCount="1035" Body="&lt;p&gt;So I am working on it first time. I created a Controller &lt;code&gt;DB_DuhController&lt;/code&gt; having a method &lt;code&gt;actionFoo()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am then calling it as &lt;code&gt;http://domain.craft.dev/admin/DB/duh/Foo&lt;/code&gt; but it's giving &lt;code&gt;404&lt;/code&gt; all the time. What is wrong being done by me?&lt;/p&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:17:00.477" LastActivityDate="2017-05-09T23:17:00.477" Title="Craft Controller gives 404 error" Tags="&lt;plugin-development&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11991" PostTypeId="1" CreationDate="2015-10-20T09:40:35.827" Score="2" ViewCount="460" Body="&lt;p&gt;Ok I'm building a plugin that needs to check for an id in an array and return only users that have the id in the checkbox array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$user_criteria-&amp;gt;interests = $interestId;&#xA;$users = $user_criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;interests is a dynamically created checkbox array which sits under the users profile. $interestId is the id I wish to look for in that array and return all users that have it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="125" LastEditDate="2015-10-22T10:39:05.630" LastActivityDate="2015-10-22T10:39:05.630" Title="How to return entries based on Checkboxes field criteria?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11992" PostTypeId="1" AcceptedAnswerId="12003" CreationDate="2015-10-20T11:46:02.297" Score="3" ViewCount="850" Body="&lt;p&gt;I need to search both entries and assets and paginate the combined result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query|trim).order('score').status('pending, live').find() %}&#xA;{% set assets = craft.assets.source('documentLibrary').search(query).find() %}&#xA;{% set searchResults = entries | merge(assets) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I can't get paginate to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate searchResults as results %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... brings up the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I don't use a &lt;code&gt;.find()&lt;/code&gt;, I can't merge the two objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how this can be achieved?&lt;/p&gt;&#xA;" OwnerUserId="4218" LastEditorUserId="45" LastEditDate="2016-09-26T16:37:45.250" LastActivityDate="2016-09-26T16:37:45.250" Title="Search across Entries and Assets and paginate combined results" Tags="&lt;entries&gt;&lt;assets&gt;&lt;search&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11993" PostTypeId="1" AcceptedAnswerId="12018" CreationDate="2015-10-20T12:59:47.050" Score="2" ViewCount="156" Body="&lt;p&gt;I have a matrix block attached to my user, the block handler is children and has one field dob date filed something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[children][420][fields][childrenDateOfBirth][date]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that I would like to update the date right before the user is saved. So I have an envent listener in my plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;    $matrixData = array();&#xA;    $matrix     = $event-&amp;gt;params['user']-&amp;gt;getContent()-&amp;gt;children;&#xA;&#xA;      foreach ($matrix as $block){&#xA;&#xA;        $blockData = array(&#xA;                            'type' =&amp;gt; $block-&amp;gt;getType()-&amp;gt;handle,&#xA;                            'enabled' =&amp;gt; $block-&amp;gt;enabled&#xA;                           );   &#xA;&#xA;         $blockData['fields'] = array(&#xA;                           'childrenDateOfBirth' =&amp;gt; array('date'=&amp;gt;'2000-10-10')&#xA;                        );&#xA;&#xA;          $matrixData[$block-&amp;gt;id] = $blockData;                                     &#xA;&#xA;  }&#xA;&#xA; $event-&amp;gt;params['user']-&amp;gt;getContent()-&amp;gt;children = $matrixData;&#xA;&#xA;}&#xA;  ...............&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get this error : &lt;code&gt;Fatal error&amp;lt;/b&amp;gt;:  Call to a member function getType() on array&lt;/code&gt; Is there a way to do this?&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-10-21T10:58:09.057" Title="Update matrix onBeforeSaveUser" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;craft-pro&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11994" PostTypeId="2" ParentId="11981" CreationDate="2015-10-20T13:11:56.770" Score="1" Body="&lt;p&gt;If I understand your issue correctly, try changing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topLevelCats = craft.categories.relatedTo({ sourceElement: entryIds }).group('filter').level(1) %}&#xA;{% set secondLevelCats = topLevelCats.slug(secondSeg) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topLevelCats = craft.categories.relatedTo({ sourceElement: entryIds }).group('filter').level(1) %}&#xA;{% set secondLevelCats = craft.categories.slug(secondSeg).level(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-20T13:11:56.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11995" PostTypeId="1" AcceptedAnswerId="12004" CreationDate="2015-10-20T13:52:15.123" Score="2" ViewCount="143" Body="&lt;p&gt;Specifically looking at these attributes &lt;a href=&quot;http://d.pr/i/1ilbr&quot; rel=&quot;nofollow&quot;&gt;http://d.pr/i/1ilbr&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access Alt text by &lt;code&gt;{{ entry.assetHandle.first().altText }}&lt;/code&gt; and similarly can do &lt;code&gt;{{ entry.assetHandle.first().sourceUrl }}&lt;/code&gt; but Source Name continues to be elusive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused as to whether this is an attribute or part of the AssetSourceModel? Although would assume attribute given it's editable.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-10-20T19:25:40.950" Title="Accessing the attributes of an Asset field" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11996" PostTypeId="1" AcceptedAnswerId="12013" CreationDate="2015-10-20T14:20:01.040" Score="2" ViewCount="823" Body="&lt;p&gt;I'm trying to use the native support for rss and atom as described in the documentation, but it misses some info.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/atom-feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/atom-feed&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/rss-feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/rss-feed&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Did anyone got this to work? I'm not even sure how to name my template or what the url is going to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the following template names:&#xA;&lt;code&gt;template.twig.atom&lt;/code&gt;&#xA;&lt;code&gt;template.atom.twig&lt;/code&gt;&#xA;&lt;code&gt;template.atom&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried requests with atom in the header and &lt;code&gt;.atom&lt;/code&gt; postfix. Both without any success.&lt;/p&gt;&#xA;" OwnerUserId="4222" LastEditorUserId="3951" LastEditDate="2017-10-24T13:03:17.353" LastActivityDate="2017-10-24T13:03:17.353" Title="Experience with Craft's native rss/atom support?" Tags="&lt;rss&gt;&lt;feed&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11997" PostTypeId="2" ParentId="11996" CreationDate="2015-10-20T14:34:00.047" Score="0" Body="&lt;p&gt;Though this is not a proper answer to the question. If you're unfamiliar with how to use the feeds you may be better off taking a look at the feedMe found plugin here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And building out your templates using that. Could save some time and headaches. Sorry I can't give you further information on using the feeds as seen in the docs. &lt;/p&gt;&#xA;" OwnerUserId="4033" LastActivityDate="2015-10-20T14:34:00.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11998" PostTypeId="2" ParentId="11996" CreationDate="2015-10-20T15:05:24.427" Score="3" Body="&lt;p&gt;Yeah, so I have a &lt;code&gt;rss.twig&lt;/code&gt; file in the root of my template directory.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/rss+xml&quot; %}&#xA;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&#xA;&amp;lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&amp;gt;&#xA;&#xA;{% set rss = craft.entries.section('article').limit(10).type('article') %}&#xA;&#xA;&amp;lt;channel&amp;gt;&#xA;  &amp;lt;title&amp;gt;My Site Name&amp;lt;/title&amp;gt;&#xA;  &amp;lt;link&amp;gt;{{ siteUrl }}&amp;lt;/link&amp;gt;&#xA;  &amp;lt;description&amp;gt;My site description&amp;lt;/description&amp;gt;&#xA;  &amp;lt;language&amp;gt;en-au&amp;lt;/language&amp;gt;&#xA;  &amp;lt;atom:link href=&quot;{{ url() }}&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&amp;gt;&#xA;&#xA;  {% for item in rss %}&#xA;  &amp;lt;item&amp;gt;&#xA;    &amp;lt;title&amp;gt;&amp;lt;![CDATA[{{ item.title|raw }}]]&amp;gt;&amp;lt;/title&amp;gt;&#xA;    &amp;lt;link&amp;gt;{{ item.url() }}&amp;lt;/link&amp;gt;&#xA;    &amp;lt;description&amp;gt;&amp;lt;![CDATA[&#xA;    {% for block in item.body %}&#xA;&#xA;  {% if block.type == &quot;text&quot; %}&#xA;&#xA;    {{ block.text }}&#xA;&#xA;  {% elseif block.type == &quot;footnote&quot; %}&#xA;&#xA;    {% include 'blocks/_footnote' %}&#xA;&#xA;  {% elseif block.type == &quot;pullQuote&quot; %}&#xA;&#xA;    {% include 'blocks/_pullquote' %}&#xA;&#xA;  {% elseif block.type == &quot;heading&quot; %}&#xA;&#xA;    {% include 'blocks/_heading' %}&#xA;&#xA;  {% elseif block.type == &quot;image&quot; %}&#xA;&#xA;    {% include 'blocks/_image' %}&#xA;&#xA;  {% elseif block.type == &quot;audio&quot; %}&#xA;&#xA;    {% include 'blocks/_audio' %}&#xA;&#xA;  {% elseif block.type == &quot;video&quot; %}&#xA;&#xA;    {% include 'blocks/_video' %}&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}]]&amp;gt;&amp;lt;/description&amp;gt;&#xA;    &amp;lt;pubDate&amp;gt;{{ item.postDate.rfc2822() }}&amp;lt;/pubDate&amp;gt;&#xA;    &amp;lt;guid&amp;gt;{{ item.url() }}&amp;lt;/guid&amp;gt;&#xA;  &amp;lt;/item&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/channel&amp;gt;&#xA;&#xA;&amp;lt;/rss&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I access, &lt;a href=&quot;http://myurl.com/rss&quot; rel=&quot;nofollow&quot;&gt;http://myurl.com/rss&lt;/a&gt; - I get my lovely feed.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2015-10-20T15:05:24.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11999" PostTypeId="1" CreationDate="2015-10-20T15:36:04.487" Score="1" ViewCount="428" Body="&lt;p&gt;I apologize in advance if I am just overthinking this and missing something obvious (feels like I am). I have a situation on a category page where I am wanting to override a block in the document this one is extending, but only if the category is equal to a specific value ('Smith' in this case). If I put the conditional outside the block definition, I keep getting an internal server error. But if I put it inside the block definition, then it will override the block on every category page, not just this one. I'm trying to avoid having multiple templates and instead just hide one nav section on one category page. Please let me know if you need any more information. Thanks in advance for any advice!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the two versions of the code that I have tried. First gives the Internal Server error, second overrides the block for all pages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category.title == 'Smith' %}&#xA;  {% block nav %} {% endblock %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% block nav %}&#xA;  {% if category.title == 'Smith' %} {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3587" LastEditorUserId="1098" LastEditDate="2015-10-20T18:15:53.333" LastActivityDate="2015-10-20T18:23:58.973" Title="Conditional to override a block" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12000" PostTypeId="2" ParentId="11990" CreationDate="2015-10-20T17:00:04.977" Score="2" Body="&lt;p&gt;You need to use &lt;code&gt;/actions&lt;/code&gt; (or whatever your Trigger word is) to access Controller actions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation: &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#actionTrigger&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#actionTrigger&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I realize I wasn't clear enough; this variable defaults to &lt;code&gt;/actions&lt;/code&gt;. Unless you've set it to something else in your Config, add the &lt;code&gt;/actions&lt;/code&gt; to your URL to access the Controller action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your URL would be this: &lt;code&gt;http://domain.craft.dev/actions/PluginHandle/Duh/foo&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;strong&gt;capitalization matters.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also important to make sure that if you plan on making calls to this URL from outside Craft, you'll need to make sure that you're allowing anonymous access by setting that variable at the top of your controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;protected $allowAnonymous = true;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4086" LastEditorUserId="4086" LastEditDate="2015-10-21T20:53:56.267" LastActivityDate="2015-10-21T20:53:56.267" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12001" PostTypeId="1" CreationDate="2015-10-20T17:48:50.230" Score="1" ViewCount="44" Body="&lt;p&gt;Is there a way to delete specific tags from the db? I have one tag that does not seem to work. I have used the following code to see all tags used from a specific section, knowing I have entries using a tag called Logos&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set test = craft.entries.section('projects').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for tag in craft.tags.relatedTo(test) %}&#xA;        &amp;lt;li&amp;gt;{{ tag.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs a list of all tags used in the section called projects, Logos is not listed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sidebar that outputs each tag a single entry was assigned. Logos is output when viewing an entry that was tagged with Logos. Clicking on the Logos link loads a page that should list all entries that use Logos etc but for this specific tag it doesn't find any entries. I have a feeling this tag is corrupt somehow in the db as this was working fine a while back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed someone had duplicated this tag... if I start typing Logos in the Add a tag when editing an entry I see four results Logo, Logo, logos, Logos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither logos, or Logos returns entries. And only one of the Logo returns entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then decided to add all of those Logo, Logo, logos, Logos. And renamed the three that didn't work to blank. This then causes the tag to display as &quot;Tag 686&quot; etc. Clicking the tag then loads all of the entries using that tag. So for some reason it just doesn't seem to like the tag being named Logos...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas on what could be going on here?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-10-21T00:47:52.083" Title="Issue with tags possibly corrupt" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;entries&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12002" PostTypeId="2" ParentId="11999" CreationDate="2015-10-20T18:15:18.347" Score="1" Body="&lt;p&gt;No super easy way around this one, I don't think. You might consider if using blocks is the most appropriate method in this case, or if a simple conditional in the extended template would do the trick:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&#xA;    {% if category is not defined or category.title != 'Smith'%}&#xA;       {# Your navigation code here #}&#xA;        ...&#xA;    {% endif %}&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want/need to use a block, I think your best option is to put the contents of the extended template's &lt;code&gt;nav&lt;/code&gt; block (i.e. the default content for the nav block) in a partial template (e.g. &lt;code&gt;_partials/nav.html&lt;/code&gt;), and include it like this in the layout and category templates, respectively:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block nav %}&#xA;    {% include '_partials/nav' %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;category.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block nav %}&#xA;    {% if category.title != 'Smith' %}&#xA;        {% include '_partial/nav' %}&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, its one more template, but it's the most DRY solution I can think of.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-10-20T18:23:58.973" LastActivityDate="2015-10-20T18:23:58.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12003" PostTypeId="2" ParentId="11992" CreationDate="2015-10-20T18:58:49.423" Score="1" Body="&lt;p&gt;You're getting that error because as soon as you call &lt;code&gt;find()&lt;/code&gt;, you're converting the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; into an array of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements&quot;&gt;actual fetched elements&lt;/a&gt; and the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate#parameters&quot; rel=&quot;nofollow&quot;&gt;{% paginate %}&lt;/a&gt; tag requires an ElementCriteriaModel object to be passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to pull off what you're looking for, you'd need to ability to search across multiple element types in one query, which is currently not something Craft supports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider voting for this &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9505794-all-search-to-work-across-element-types-particul&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, which would enable what you're trying to do.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-20T18:58:49.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12004" PostTypeId="2" ParentId="11995" CreationDate="2015-10-20T19:25:40.950" Score="1" Body="&lt;p&gt;I'm assuming that &lt;code&gt;Alt Text&lt;/code&gt; (handle &lt;code&gt;altText&lt;/code&gt;), &lt;code&gt;Source Name&lt;/code&gt; (handle &lt;code&gt;sourceName&lt;/code&gt;) and &lt;code&gt;Source URL&lt;/code&gt; (handle &lt;code&gt;sourceUrl&lt;/code&gt; are all plain text custom fields you've created on your Assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you'd be able to access &lt;code&gt;sourceUrl&lt;/code&gt; the same as the others:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.assetHandle.first().sourceUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They definitely aren't attributes on Craft's &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/models/AssetSourceModel.php#L80&quot; rel=&quot;nofollow&quot;&gt;AssetSourceModel&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-20T19:25:40.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12005" PostTypeId="1" CreationDate="2015-10-20T20:21:13.727" Score="1" ViewCount="32" Body="&lt;p&gt;On the default install, taking out all css. There is an extra margin space at the top of Chrome, and IE Edge but firefox is fine. I also checked out the error 404 page, and it too is fine like the standard layout page at home. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I click news or create a new extends sub folder, they will have an extra 26 pixels at the top. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed this trying to have a top bar flushed to the very top. I rolled back everything to stock and used the default template, took out all CSS from it, and still notice this issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is an image comparison of the two pages, no css using Chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yBybB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yBybB.jpg&quot; alt=&quot;Comparison of two pages showing the difference&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logan.&lt;/p&gt;&#xA;" OwnerUserId="4224" LastActivityDate="2015-10-26T12:37:17.833" Title="Extra margin in Default System on subpages like news" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12006" PostTypeId="1" AcceptedAnswerId="12007" CreationDate="2015-10-20T21:09:38.953" Score="5" ViewCount="854" Body="&lt;p&gt;I have a question regarding the ElementAPI:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sucessfully using the ElementAPI to fetch assets related to an entry. Now I have a matrix field where a user can add multiple galleries (multiple block of selected assets) and i want to retrieve the images. But I can't figure out how to use it for nested matrix blocks...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I fetch the data with ElementAPI from non-matrix assets fields (&lt;code&gt;elementapi.php&lt;/code&gt; config)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/v1/installation-views/&amp;lt;sourceEntryId:\d+&amp;gt;/&amp;lt;fieldHandle:[A-Za-z]+&amp;gt;' =&amp;gt; function($sourceEntryId, $fieldHandle) {&#xA;        return [&#xA;            'elementType' =&amp;gt; 'Asset',&#xA;            'criteria' =&amp;gt; [&#xA;                'relatedTo' =&amp;gt; [&#xA;                    'sourceElement' =&amp;gt; $sourceEntryId,&#xA;                    'field' =&amp;gt; $fieldHandle&#xA;                ],&#xA;                'kind' =&amp;gt; 'image'&#xA;            ],&#xA;            'transformer' =&amp;gt; function(AssetFileModel $asset) {&#xA;                return [&#xA;                    'id' =&amp;gt; $asset-&amp;gt;id,&#xA;                    'title' =&amp;gt; $asset-&amp;gt;title,&#xA;                    ...&#xA;                ];&#xA;            },&#xA;        ];&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I do that for asset fields nested inside a matrix block? I guess I can't use the nested field handle as handle?&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="9" LastEditDate="2015-10-20T21:30:01.560" LastActivityDate="2015-10-20T21:32:58.617" Title="How to fetch matrix block items with the ElementAPI" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12007" PostTypeId="2" ParentId="12006" CreationDate="2015-10-20T21:20:34.753" Score="3" Body="&lt;p&gt;Matrix blocks are elements just like entries and assets, so this is just a matter of setting the &lt;code&gt;elementType&lt;/code&gt; to &lt;code&gt;'MatrixBlock'&lt;/code&gt;, and adjusting your &lt;code&gt;criteria&lt;/code&gt; to fetch the block you’re after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest approach would be to pass the Matrix block ID in the URL, and apply it to the &lt;code&gt;id&lt;/code&gt; criteria parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'matrix-blocks/&amp;lt;blockId:\d+&amp;gt;' =&amp;gt; function($blockId) {&#xA;        return [&#xA;            'elementType' =&amp;gt; 'MatrixBlock',&#xA;            'criteria' =&amp;gt; [&#xA;                'id' =&amp;gt; $blockId&#xA;            ],&#xA;            'first' =&amp;gt; true, // Just return one Matrix block&#xA;            'transformer' =&amp;gt; function(MatrixBlock $block) {&#xA;                $assetsInfo = [];&#xA;&#xA;                foreach ($block-&amp;gt;myAssetsfield as $asset) {&#xA;                    $assetsInfo[] = [&#xA;                        'url' =&amp;gt; $asset-&amp;gt;url,&#xA;                        'title' =&amp;gt; $asset-&amp;gt;title,&#xA;                        // ...&#xA;                    ];&#xA;                }&#xA;&#xA;                return [&#xA;                    'id' =&amp;gt; $block-&amp;gt;id,&#xA;                    'assets' =&amp;gt; $AssetsInfo,&#xA;                    // ...&#xA;                ];&#xA;            },&#xA;        ];&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use the following criteria parameters to narrow down the search:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;fieldId&lt;/code&gt; (the Matrix field ID)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ownerId&lt;/code&gt; (the owner element ID, e.g. your entry’s ID)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ownerLocale&lt;/code&gt; (the locale of the owner element that the block should have been saved to)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;type&lt;/code&gt; (the block type handle)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-10-20T21:32:58.617" LastActivityDate="2015-10-20T21:32:58.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12008" PostTypeId="1" AcceptedAnswerId="12009" CreationDate="2015-10-20T21:39:33.820" Score="1" ViewCount="140" Body="&lt;p&gt;I'm wanting to return HTML content via the ElementAPI. I seem to be able to do this with the following &lt;code&gt;elements.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/trials.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'trials'],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'summary' =&amp;gt; ($entry-&amp;gt;summary ? $entry-&amp;gt;summary-&amp;gt;getRawContent() : false),&#xA;                ...&#xA;            ];&#xA;        },&#xA;    ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's just that the &lt;code&gt;getRawContent()&lt;/code&gt; returns the following in the JSON:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;summary&quot;: &quot;&amp;lt;p&amp;gt;&amp;lt;img src=\&quot;{asset:46:url}\&quot;…&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I'm expecting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;summary&quot;: &quot;&amp;lt;p&amp;gt;&amp;lt;img src=\&quot;/images/myimage.png&quot;…&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should I be using a different method to get to the content, or do I need to run the content through some kind of transformation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;James&lt;/p&gt;&#xA;" OwnerUserId="4002" LastEditorUserId="9" LastEditDate="2015-10-20T22:58:47.710" LastActivityDate="2015-10-20T23:00:32.967" Title="How to get rendered image paths from the ElementAPI?" Tags="&lt;entrymodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12009" PostTypeId="2" ParentId="12008" CreationDate="2015-10-20T23:00:32.967" Score="2" Body="&lt;p&gt;Rather than calling &lt;code&gt;getRawContent()&lt;/code&gt;, just explicitly cast your Rich Text field data into a string:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'summary' =&amp;gt; ($entry-&amp;gt;summary ? (string) $entry-&amp;gt;summary : false),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-20T23:00:32.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12010" PostTypeId="2" ParentId="11599" CreationDate="2015-10-20T23:28:26.477" Score="2" Body="&lt;p&gt;As of Sprout Forms 2.0, this has become a lot easier.  Hopefully I can win that last answer away from myself!&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;A few options&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;First, Sprout Forms 2.0 adds multiple new override options so you may be able to address this problem in a different way now to that will get away from needing to handle this in Custom HTML.  Things to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow&quot;&gt;Template Overrides&lt;/a&gt; - If you were using custom HTML because the default templates we're not the right HTML format for your needs, you can now easily override those default templates on a per-form basis.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/rendering-options&quot; rel=&quot;nofollow&quot;&gt;Rendering Options&lt;/a&gt; - If specific attributes of the field such as the ID or Class did not meet your needs, you could potentially dynamically override them while still using a tag like &lt;code&gt;displayForm()&lt;/code&gt; or &lt;code&gt;displayField()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow&quot;&gt;Front-end Field API&lt;/a&gt; - You could create a custom plugin that adds front-end field support for a custom State Dropdown field. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Custom HTML&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you still feel custom HTML is the best fit for you, there is now a &lt;code&gt;SproutForms_FormModel::getField()&lt;/code&gt; method and &lt;code&gt;craft.sproutForms.getEntry&lt;/code&gt; tag to help manage retained values and error states.  Here is a generic example.  A more complete examples of all Standard front-end field types can be found in the docs &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html#example-code-to-manually-manage-all-default-fields-in-your-templates&quot; rel=&quot;nofollow&quot;&gt;Custom HTML Forms and Example Fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get our Form data #}&#xA;{% set form = craft.sproutForms.form('formHandle') %}&#xA;&#xA;{# Get our Form Entry data to manage error states and re-populating field values #}&#xA;{% set submittedEntry = craft.sproutForms.getEntry(form) %}&#xA;&#xA;{# Get our Field Model #}&#xA;{% set dropdownField = form.getField('dropdown') %}&#xA;&#xA;{# We use the Twig attribute tag to dynamically access our &#xA;     field value on the submitted Form Entry #}&#xA;{% set submittedDropdownValue = attribute(submittedEntry, dropdownField.handle) %}&#xA;&#xA;{% if dropdownField is defined %}&#xA;&#xA;  {{ dropdownField.name }}&#xA;&#xA;  &amp;lt;select name=&quot;fields[{{ dropdownField.handle }}]&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select...&amp;lt;/option&amp;gt;&#xA;    {% for option in dropdownField.settings.options %}&#xA;&#xA;      {% set defaultValue = option.default ? option.value : null %}&#xA;      {% set selectedDropdownValue = submittedDropdownValue != '' ? submittedDropdownValue : defaultValue %}&#xA;&#xA;      &amp;lt;option value=&quot;{{ option.value }}&quot; {% if selectedDropdownValue == option.value %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;  {% if submittedEntry is defined %}&#xA;&#xA;    {# Assumes you have an errorList macro #}&#xA;    {{ errorList(submittedEntry.getErrors(dropdownField.handle)) }}&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-10-20T23:28:26.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12011" PostTypeId="2" ParentId="12005" CreationDate="2015-10-20T23:50:31.120" Score="3" Body="&lt;p&gt;Unlike some other CMS systems, Craft doesn't specify what your front-end templates should look like in any way (you could output your content as .txt files if you wanted to). It also doesn't add anything to your rendered page output that you didn't specify (with the exception of error info if 'devMode' is set to true). The default templates are really just there as placeholders so that you can confirm the system is working properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't say specifically what is causing your rendering/margin issue, but I would just ignore it and start with your own clean templates. All of the browsers that you mention also have some form of web inspector/development tools. If you really want to know you can 'inspect element' with the browser tools and see what css if any is causing the problem.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-10-20T23:50:31.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12012" PostTypeId="2" ParentId="12001" CreationDate="2015-10-21T00:47:52.083" Score="2" Body="&lt;p&gt;So this seems like a bug to me. I found the issue, and it was caused by another tag group having the same tag name. Here is an example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have three tag groups.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Default &lt;/li&gt;&#xA;&lt;li&gt;Industry Tags&lt;/li&gt;&#xA;&lt;li&gt;Services Tags&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Logos was a tag in Default, and also Services Tag group. Once I removed or renamed the tag named Logos from the Default Tag Group. I was then able to find entries using the tag named Logos from a section where entries used the Services Tag Group. This section has a tag field called Services which the source is Services Tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just found another tag called Brand that does not work in the Services Tag Group because Industry Tag Group has the same Brand tag. If I rename the tag named Brand from Industry, then the entries are found in the section that uses the Services Tag Group for the tag named Brand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal behavior as it doesn't seem like it to me. Easy solution would be to just not use tag groups but that would be a lot of refactoring tags for all entries.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-10-21T00:47:52.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12013" PostTypeId="2" ParentId="11996" CreationDate="2015-10-21T06:33:15.177" Score="0" Body="&lt;p&gt;It turns out that you can call the template file directly and it answers by default with the right response headers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, putting templates named &lt;code&gt;feed.atom&lt;/code&gt; and &lt;code&gt;feed.rss&lt;/code&gt; in the root of your template folder enables you to call them via &lt;code&gt;/feed.atom&lt;/code&gt; and &lt;code&gt;/feed.rss&lt;/code&gt;.&#xA;No need for setting content-type by hand.&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2015-10-21T06:33:15.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12014" PostTypeId="1" CreationDate="2015-10-21T06:49:48.643" Score="1" ViewCount="108" Body="&lt;p&gt;In my template I defined field as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.editableTableField({&#xA;  id: 'songs',&#xA;  name: 'songs',&#xA;  cols: [&#xA;    {&#xA;      heading: 'Time',&#xA;      type: 'select',&#xA;      options: [&#xA;        {'label':'00:00','value':'00:00'},&#xA;        {'label':'00:30','value':'00:30'},&#xA;        {'label':'01:00','value':'01:00'},&#xA;        {'label':'01:30','value':'01:30'},&#xA;        {'label':'02:00','value':'02:00'},&#xA;        {'label':'02:30','value':'02:30'},&#xA;        {'label':'03:00','value':'03:00'},&#xA;        {'label':'03:30','value':'03:30'},&#xA;        {'label':'04:00','value':'04:30'},&#xA;        {'label':'05:00','value':'05:30'},&#xA;        {'label':'06:00','value':'06:30'},&#xA;        {'label':'07:00','value':'07:30'}&#xA;      ]&#xA;    },&#xA;    {&#xA;      heading: 'SoundCloud URL',&#xA;      type: 'singleline'&#xA;    }&#xA;  ]&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I add validation rules in model? This does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'songs[][]' =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Sound Cloud Track URL','required'  =&amp;gt; true),&#xA;    'scheduledTime' =&amp;gt; AttributeType::DateTime&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In controller I am doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$songs = new PlugInName_ControllerModel();&#xA;&#xA;if($songs-&amp;gt;validate()) {&#xA;    echo 'Hurray';&#xA;} else {&#xA;    echo 'Epic Fail';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:25:13.200" LastActivityDate="2017-05-09T23:25:13.200" Title="Plugin: How to Validate Array field in editableTableField?" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12015" PostTypeId="1" AcceptedAnswerId="12016" CreationDate="2015-10-21T10:12:36.990" Score="1" ViewCount="93" Body="&lt;p&gt;I'm fairly new to Craft. I have a question about how to manage and setup the editing of shared content in Craft which is used on multiple pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example I have a Mailing List signup element which will be used across multiple pages. In my templates I'm using an include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;includes/_mailing-signup&quot; %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I come from Perch where you could make a Region of content shared which would take it out of the page and into a 'Shared' area in the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to approach this in Craft where content can be edited in one central location to update on all page? &lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-10-21T10:46:59.460" Title="Managing shared content in Craft" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12016" PostTypeId="2" ParentId="12015" CreationDate="2015-10-21T10:44:58.900" Score="2" Body="&lt;p&gt;I think you should look into &quot;Globals&quot; for content you want to edit, and re-use throughout your entire site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/globals&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2015-10-21T10:44:58.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12017" PostTypeId="2" ParentId="12015" CreationDate="2015-10-21T10:46:59.460" Score="2" Body="&lt;p&gt;I've figured it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To anyone who has a similar question. They are called Globals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set them up from the settings area with fields then you can reference them from your template like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ mailingList.textArea }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;mailingList&lt;/em&gt; is the handle of my Global Set and &lt;em&gt;textArea&lt;/em&gt; is the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Info:&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/globals&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-10-21T10:46:59.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12018" PostTypeId="2" ParentId="11993" CreationDate="2015-10-21T10:58:09.057" Score="1" Body="&lt;p&gt;I did the trick so here is the code if it can help someone else&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;   $matrixData = array();&#xA;   $matrix     = $event-&amp;gt;params['user']-&amp;gt;getContent()-&amp;gt;children;&#xA;&#xA;   foreach ($matrix as $block){&#xA;&#xA;      $block-&amp;gt;getContent()-&amp;gt;childrenDateOfBirth = '2000-10-10';&#xA;      $matrixData[$block-&amp;gt;id] = $block;                                     &#xA;&#xA;   }&#xA;&#xA;   $event-&amp;gt;params['user']-&amp;gt;getContent()-&amp;gt;children = $matrixData;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2015-10-21T10:58:09.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12019" PostTypeId="1" AcceptedAnswerId="12023" CreationDate="2015-10-21T11:04:05.057" Score="1" ViewCount="214" Body="&lt;p&gt;I'm relatively new to Twig and PHP in general, so please don't shoot me just yet for asking stupid questions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I've got several feeds from RSS to Facebook and Twitter. And I need to merge all of these into a custom array so I can make sure all fields match. I'm gonna output all these later, after sorting them by their published date. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do I get started with this thing? Create an empty array first, and then loop through the feeds and push each post into the array? How do I name the fields? This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set feeds_array = [] %}&#xA;&#xA;{% set feed = craft.feedme.feed(my_rssfeed) %}&#xA;&#xA;{% for node in feed %}&#xA;    {% set feeds_array = {'title': node.title} %}&#xA;{% endfor %}&#xA;&#xA;{% for post in feeds_array %}&#xA;    {{post}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the way to go about this?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="57" LastEditDate="2015-10-21T16:00:19.683" LastActivityDate="2015-10-21T16:00:19.683" Title="Add several feeds into an array" Tags="&lt;array&gt;&lt;feed&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12020" PostTypeId="1" CreationDate="2015-10-21T11:04:16.677" Score="2" ViewCount="730" Body="&lt;p&gt;In a template, can I check whether a Global field exists, before I try to output its value? I want to ensure the page doesn't break entirely in the unlikely event of the field being removed from the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myGlobalSet.myField is defined %}&#xA;    Defined.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then it works as expected; &quot;Defined&quot; isn't displayed if &lt;code&gt;myField&lt;/code&gt; doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myGlobalSet.myField is defined %}&#xA;    Defined. {{ myGlobalSet.myField }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\GlobalSetModel and its behaviours do not have a method or closure named &quot;myField&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;if that field doesn't exist. It's like it's trying to process the field even though it's not defined.&lt;/p&gt;&#xA;" OwnerUserId="3686" LastActivityDate="2015-10-21T16:34:17.537" Title="How do I check if a Global field exists in a template?" Tags="&lt;templating&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12021" PostTypeId="1" CreationDate="2015-10-21T11:40:00.497" Score="0" ViewCount="76" Body="&lt;p&gt;I am looking to create a plugin which will update a field in a section when I save an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be getting the length of an MP3 file (using FFMPEG) I upload via assets and output the time to another input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can listen out for the &lt;code&gt;onSaveEntry&lt;/code&gt; event, but I am unfamiliar with getting and putting data in a craft plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2015-10-21T11:40:00.497" Title="How to create a plugin which will update a field in a section when an entry is saved" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;sections&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12022" PostTypeId="1" CreationDate="2015-10-21T11:41:15.517" Score="0" ViewCount="147" Body="&lt;p&gt;Using the standard P&amp;amp;T contact form, I'm getting the following error when form is submitted (running locally):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Runtime&#xA;&#xA;Impossible to access an attribute (&quot;fromEmail&quot;) on a string variable (&quot;&quot;) in &quot;_layout&quot; at line 149 (C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php:460)&#xA;&#xA;#0 C:\xampp\htdocs\mysite\craft\app\etc\templating\BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute('', 'fromEmail', Array, 'any', false, false)&#xA;#1 C:\xampp\htdocs\mysite\craft\storage\runtime\compiled_templates\3\5\352f325e7c58d6329a0dbf553a172b2811c881b391a544d0f295665ec793e2af.php(251): Craft\BaseTemplate-&amp;gt;getAttribute('', 'fromEmail', Array)&#xA;#2 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(340): __TwigTemplate_352f325e7c58d6329a0dbf553a172b2811c881b391a544d0f295665ec793e2af-&amp;gt;doDisplay(Array, Array)&#xA;#3 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(314): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#4 C:\xampp\htdocs\mysite\craft\storage\runtime\compiled_templates\2\a\2a1532ab9a7fc5ec6775a274eca668a2af4e295ac7764368b23c762497284924.php(27): Twig_Template-&amp;gt;display(Array, Array)&#xA;#5 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(340): __TwigTemplate_2a1532ab9a7fc5ec6775a274eca668a2af4e295ac7764368b23c762497284924-&amp;gt;doDisplay(Array, Array)&#xA;#6 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(314): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#7 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(325): Twig_Template-&amp;gt;display(Array)&#xA;#8 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Environment.php(293): Twig_Template-&amp;gt;render(Array)&#xA;#9 C:\xampp\htdocs\mysite\craft\app\services\TemplatesService.php(223): Twig_Environment-&amp;gt;render('404', Array)&#xA;#10 C:\xampp\htdocs\mysite\craft\app\controllers\BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&#xA;#11 C:\xampp\htdocs\mysite\craft\app\controllers\TemplatesController.php(201): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&#xA;#12 C:\xampp\htdocs\mysite\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#13 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#14 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#15 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#16 C:\xampp\htdocs\mysite\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#17 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(368): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#18 C:\xampp\htdocs\mysite\craft\app\etc\errors\ErrorHandler.php(264): CErrorHandler-&amp;gt;renderError()&#xA;#19 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(351): Craft\ErrorHandler-&amp;gt;renderError()&#xA;#20 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(218): CErrorHandler-&amp;gt;renderException()&#xA;#21 C:\xampp\htdocs\mysite\craft\app\etc\errors\ErrorHandler.php(128): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#22 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#23 C:\xampp\htdocs\mysite\craft\app\framework\base\CApplication.php(740): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#24 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#25 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Running latest Craft Pro 2.4.2700 and latest contact form plugin. What could be causing the error?&lt;/p&gt;&#xA;" OwnerUserId="4034" LastActivityDate="2015-10-21T17:49:22.053" Title="Contact form: Twig_Error_Runtime error upon submission" Tags="&lt;form&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12023" PostTypeId="2" ParentId="12019" CreationDate="2015-10-21T12:36:08.820" Score="2" Body="&lt;p&gt;It looks a bit awkward, but to append items to an array you have to use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;merge&lt;/code&gt;&lt;/a&gt; filter, merging the &lt;code&gt;feeds_array&lt;/code&gt; with itself for each new item. Here's how I'd do it if you need different logic for each feed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set feeds_array = [] %}&#xA;&#xA;{% for node in craft.feedme.feed(my_rssfeed) %}&#xA;    {% set feeds_array = feeds_array|merge([{ title: node.title }]) %}&#xA;{% endfor %}&#xA;&#xA;{% for node in craft.feedme.feed(my_otherfeed) %}&#xA;    {% set feeds_array = feeds_array|merge([{ title: node.whateverField }]) %}&#xA;{% endfor %}&#xA;&#xA;{% for post in feeds_array %}&#xA;    {{ post }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2015-10-21T12:36:08.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12024" PostTypeId="1" CreationDate="2015-10-21T13:16:59.907" Score="2" ViewCount="1155" Body="&lt;p&gt;If validation fails in plugin, how can I redirect it bank to previous URL with errors?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'errors'    =&amp;gt; $errors&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives 404&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;My Controller:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class DB_LogsController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;    public function actionStoreDances()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        $f = craft()-&amp;gt;request-&amp;gt;getPost('logs');&#xA;        $dances = new DB_LogsModel();&#xA;&#xA;        $errors = $dances-&amp;gt;getAllErrors();&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'errors'    =&amp;gt; $errors&#xA;        ));&#xA;        $redirectUrl = '';&#xA;        //$this-&amp;gt;redirect('http://db.craft.dev/admin/db/',true);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:15:22.537" LastActivityDate="2017-05-09T23:15:22.537" Title="How to redirect with error messages?" Tags="&lt;plugin-development&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12025" PostTypeId="1" AcceptedAnswerId="12027" CreationDate="2015-10-21T13:21:07.103" Score="3" ViewCount="426" Body="&lt;p&gt;So I'm using FeedMe to get RSS atom feeds and this is working O.K. But there's this field that has an attribute I want to extract. And I cannot get this to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the FeedMe documentation it says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;For example, the XML &amp;lt;field my_attribute=&quot;Some Value&quot;&amp;gt;Another Value&amp;lt;/field&amp;gt;, &#xA;you can use {{ xml.field.attributes.my_attribute }}.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My field is called &lt;code&gt;'enclosure'&lt;/code&gt; and has an attribute called &lt;code&gt;'url'&lt;/code&gt; that I want to extract. According to the documentation, one would assume that this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set feed = craft.feedme.feed(myfeed_rss) %}&#xA;&#xA;{% for node in feed %}&#xA;&#xA;    {&#xA;        'title': {{ node.title | raw }},&#xA;        'description': {{ node.description | raw }},&#xA;        'url': {{ node.link | raw }},&#xA;        'date': {{ node.pubdate | raw }},&#xA;        'image': {{ node.enclosure.attributes.url | raw }}&#xA;    }&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Namely &lt;code&gt;{{ node.enclosure.attributes.url }}&lt;/code&gt; should work? All the other fields are collected correctly. So it's just this one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Btw, the feed I'm using is this one. &#xA;&lt;a href=&quot;http://www.adressa.no/?widgetName=polarisFeeds&amp;amp;widgetId=3185248&amp;amp;getXmlFeed=true&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.adressa.no/?widgetName=polarisFeeds&amp;amp;widgetId=3185248&amp;amp;getXmlFeed=true&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2: Managed to get it to work, with help from &lt;a href=&quot;https://craftcms.stackexchange.com/users/632/crawf&quot;&gt;crafw&lt;/a&gt;. Some of the nodes weren't empty, fixed it by changing the line to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ node.enclosure.attributes.url|default('empty') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/users/632/crawf&quot;&gt;https://craftcms.stackexchange.com/users/632/crawf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jBU9v.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jBU9v.jpg&quot; alt=&quot;RSS feed&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-21T16:17:30.783" Title="FeedMe - Extracting attribute from an RSS feed field" Tags="&lt;templating&gt;&lt;rss&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12026" PostTypeId="2" ParentId="12020" CreationDate="2015-10-21T13:26:41.763" Score="0" Body="&lt;p&gt;Try using &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldValue-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;BaseModel::getAttribute()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myGlobalSet.getAttribute('myField') %}&#xA;    Defined.&#xA;{% else %}&#xA;    Not defined.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was going to suggest &lt;a href=&quot;http://buildwithcraft.com/classreference/models/BaseElementModel#getFieldValue-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;BaseElementModel::getFieldValue()&lt;/code&gt;&lt;/a&gt; as the &quot;proper&quot; way, but that throws an exception if the field isn't found &lt;em&gt;at all&lt;/em&gt;, so I think &lt;code&gt;getAttribute()&lt;/code&gt; is your best bet.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2015-10-21T16:05:32.833" LastActivityDate="2015-10-21T16:05:32.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12027" PostTypeId="2" ParentId="12025" CreationDate="2015-10-21T14:04:05.400" Score="3" Body="&lt;p&gt;I'm unable to view the feed via the link you've provided - seems like it may not allow public access. In any case, see a working example below using an example public RSS feed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    url: 'http://www.feedforall.com/sample.xml',&#xA;    type: 'xml',&#xA;    element: 'item',&#xA;} %}&#xA;&#xA;{% set feed = craft.feedme.feed(params) %}&#xA;&#xA;{% for node in feed %}&#xA;  {{ node.category.attributes.domain }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-21T14:04:05.400" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12028" PostTypeId="1" CreationDate="2015-10-21T14:35:29.413" Score="4" ViewCount="251" Body="&lt;p&gt;When I try to initiate tasks on uninstall the tasks fail because the plugin completes uninstalling before the tasks. The task is referencing an uninstalled plugin at that point. Once the plugin is uninstalled I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Encountered an error running task 23 (xxxx): Could not find the task component type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which makes sense. However, uninstall takes a long time because there are many things needing clean up so is there any way I can have tasks continue to work after the plugin is uninstalled?&lt;/p&gt;&#xA;" OwnerUserId="4230" LastActivityDate="2015-10-21T16:16:47.160" Title="Tasks on Uninstall Plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12029" PostTypeId="1" CreationDate="2015-10-21T15:25:26.330" Score="1" ViewCount="118" Body="&lt;p&gt;I’m looking for a way to make a database query faster. The table &lt;code&gt;parts&lt;/code&gt; has over 6 million rows. Each part row is associated with the &lt;code&gt;manufacturers&lt;/code&gt; table (a couple hundred rows) by ID. When searching for results matching a query in a specific column (i.e.: partNumber or materialDescription) I have efficient queries that return results quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I’m having is when I’m doing an ALL search where the result can be in the &lt;code&gt;parts&lt;/code&gt; table’s &lt;code&gt;partNumber&lt;/code&gt; column or &lt;code&gt;materialDescription&lt;/code&gt; column or the manufacturer’s title (which can only be determined by the &lt;code&gt;manufacturerID&lt;/code&gt; from the part’s row which gets the &lt;code&gt;manufacturerCode&lt;/code&gt; from the &lt;code&gt;manufacturers&lt;/code&gt; table which can then get the manufacturer’s actual name by finding the entry in Craft’s content table &lt;code&gt;field_manufacturerCode&lt;/code&gt; column. The results time is well past 20 seconds. Is there any way to make this database query more efficient assuming we can’t add the actual manufacturer’s name to the &lt;code&gt;manufacturers&lt;/code&gt; table because the API we are getting the data from doesn’t include the manufacturer’s name?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT p.id, p.manufacturerId, m.code as manufacturerCode, p.materialNumber, p.partNumber, p.materialDescription, c.title as manufacturerTitle&#xA;FROM `craft__parts` AS p&#xA;JOIN `craft__manufacturers` AS m ON p.manufacturerId = m.id&#xA;JOIN `craft_content` AS c ON m.code = c.field_manufacturerCode&#xA;WHERE p.partNumber like '%polymer%'&#xA;OR p.materialDescription like '%polymer%'&#xA;OR c.title like '%polymer%'&#xA;ORDER BY manufacturerTitle asc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="788" LastEditorUserId="57" LastEditDate="2015-10-21T16:31:41.067" LastActivityDate="2015-10-21T16:31:41.067" Title="Faster MySQL query when joining data from a non-Craft table to a Craft table" Tags="&lt;plugin-development&gt;&lt;performance&gt;&lt;mysql&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-10-23T22:23:04.607" ContentLicense="CC BY-SA 3.0" />
  <row Id="12030" PostTypeId="1" CreationDate="2015-10-21T15:25:46.353" Score="0" ViewCount="128" Body="&lt;p&gt;Trying to set up craft on local environment and getting the following error once running mysql. Any clue what usually causes twig_error_runtime?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Runtime&#xA;&#xA;Method &quot;bust&quot; for object &quot;Craft\CraftVariable&quot; does not exist in &quot;_layout&quot; at line 66 (/Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php:485)&#xA;&#xA;#0 /Users/username/Sites/site.com/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&amp;gt;getAttribute(Object(Craft\CraftVariable), 'bust', Array, 'any', false, false)&#xA;#1 /Users/username/Sites/site.com/craft/storage/runtime/compiled_templates/f7/b1/be6fe94a8e6c7ce48ecb00086d0a2ebde7cc24cc43eec4a6ba82fa4a24c9.php(128): Craft\BaseTemplate-&amp;gt;getAttribute(Object(Craft\CraftVariable), 'bust', Array)&#xA;#2 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php(313): __TwigTemplate_f7b1be6fe94a8e6c7ce48ecb00086d0a2ebde7cc24cc43eec4a6ba82fa4a24c9-&amp;gt;doDisplay(Array, Array)&#xA;#3 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php(287): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#4 /Users/username/Sites/site.com/craft/storage/runtime/compiled_templates/44/d5/7fc586931d2e13dfcd02f8209765153f695b63c7cf7dd78afa05d76029c4.php(27): Twig_Template-&amp;gt;display(Array, Array)&#xA;#5 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php(313): __TwigTemplate_44d57fc586931d2e13dfcd02f8209765153f695b63c7cf7dd78afa05d76029c4-&amp;gt;doDisplay(Array, Array)&#xA;#6 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php(287): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#7 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Template.php(298): Twig_Template-&amp;gt;display(Array)&#xA;#8 /Users/username/Sites/site.com/craft/app/vendor/twig/twig/lib/Twig/Environment.php(293): Twig_Template-&amp;gt;render(Array)&#xA;#9 /Users/username/Sites/site.com/craft/app/services/TemplatesService.php(223): Twig_Environment-&amp;gt;render('404', Array)&#xA;#10 /Users/username/Sites/site.com/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&#xA;#11 /Users/username/Sites/site.com/craft/app/controllers/TemplatesController.php(201): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&#xA;#12 /Users/username/Sites/site.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#13 /Users/username/Sites/site.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#14 /Users/username/Sites/site.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#15 /Users/username/Sites/site.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#16 /Users/username/Sites/site.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#17 /Users/username/Sites/site.com/craft/app/framework/base/CErrorHandler.php(368): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#18 /Users/username/Sites/site.com/craft/app/framework/base/CErrorHandler.php(351): CErrorHandler-&amp;gt;renderError()&#xA;#19 /Users/username/Sites/site.com/craft/app/framework/base/CErrorHandler.php(218): CErrorHandler-&amp;gt;renderException()&#xA;#20 /Users/username/Sites/site.com/craft/app/etc/errors/ErrorHandler.php(128): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#21 /Users/username/Sites/site.com/craft/app/framework/base/CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#22 /Users/username/Sites/site.com/craft/app/framework/base/CApplication.php(740): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#23 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#24 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4231" LastActivityDate="2016-01-19T20:13:04.297" Title="Twig_Error_Runtime on Local Dev Environment" Tags="&lt;installation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12031" PostTypeId="2" ParentId="10571" CreationDate="2015-10-21T15:28:01.307" Score="3" Body="&lt;p&gt;Not sure if you're still looking for an answer, but relation support has just been added to &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;Super Table 0.3.7&lt;/a&gt;. Previously, relations wouldn't work with Super Table, as its a little bit of a special field, having sub-queries to perform for relations (each row).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now query fields just like Matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reverseRelatedElements = craft.supertable.getRelatedElements({&#xA; relatedTo : {&#xA;   targetElement: entry,&#xA;   field: 'superTableFieldHandle.columnHandle'&#xA; },&#xA; elementType : 'Entry',&#xA; criteria: {&#xA;   section: 'someSection'&#xA; }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-21T15:28:01.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12032" PostTypeId="2" ParentId="12030" CreationDate="2015-10-21T15:36:25.470" Score="0" Body="&lt;p&gt;Can you post your &lt;code&gt;_layout&lt;/code&gt; template code? It looks like you may be trying to use a variable like &lt;code&gt;{{ craft.bust }}&lt;/code&gt; which doesn’t exist in your local environment.&lt;/p&gt;&#xA;" OwnerUserId="93" LastActivityDate="2015-10-21T15:36:25.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12033" PostTypeId="2" ParentId="12024" CreationDate="2015-10-21T16:09:11.513" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How to redirect with error messages?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, then answer is &quot;you don't&quot;.  You redirect on success, but if there is an error (validation or otherwise), you add those to your model, call &lt;code&gt;setRouteVariables&lt;/code&gt; and let the request continue as usual.  That will reload the current page and you can pull the errors out of the model from Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the general workflow for this in a controller action in all of Craft's controllers at &lt;code&gt;craft/app/controllers&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SomeController extends BaseController&#xA;{&#xA;    public function actionDoSomething()&#xA;    {&#xA;        $myModel = new MyModel();&#xA;        $myModel-&amp;gt;myProperty = 1;&#xA;&#xA;        // Validate the model&#xA;        if ($myModel-&amp;gt;validate())&#xA;        {&#xA;            // Pass it to the service.&#xA;            if (craft()-&amp;gt;myService-&amp;gt;doSomething($myModel))&#xA;            {&#xA;                // Success!&#xA;                $this-&amp;gt;redirectToPostedUrl();&#xA;            }&#xA;        }&#xA;&#xA;        // Return the model back to the template so the errors can be displayed.&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'model' =&amp;gt; $myModel&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-21T16:09:11.513" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12034" PostTypeId="2" ParentId="12028" CreationDate="2015-10-21T16:16:47.160" Score="4" Body="&lt;p&gt;I can't think of an existing way to do this (other than something ugly like have a separate plugin whose sole job is to clean up the data from the first).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this would make the case for things like &lt;code&gt;onBeforePluginUninstall&lt;/code&gt;, &lt;code&gt;onPluginUninstall&lt;/code&gt;, &lt;code&gt;onBeforePluginInstall&lt;/code&gt;, &lt;code&gt;onPluginInstall&lt;/code&gt;, &lt;code&gt;onBeforePluginDeactivate&lt;/code&gt;, etc. events to be added so that you could listen for these events and have time to do all of the cleanup necessary before uninstallation continues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding as a &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; and linking to this thread!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-21T16:16:47.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12035" PostTypeId="2" ParentId="12020" CreationDate="2015-10-21T16:34:17.537" Score="1" Body="&lt;p&gt;That's a known issue with Twig's &lt;code&gt;is defined&lt;/code&gt; test.  See &lt;a href=&quot;https://craftcms.stackexchange.com/a/2117/57&quot;&gt;here&lt;/a&gt; for an explanation and workarounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is no longer an issue in the upcoming Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-21T16:34:17.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12036" PostTypeId="1" AcceptedAnswerId="12037" CreationDate="2015-10-21T16:37:43.333" Score="0" ViewCount="91" Body="&lt;p&gt;We are using a plugin that has created its own record for storing private messages. When deleting a message, it's calling the &lt;code&gt;delete()&lt;/code&gt; method on an instance of the record, which appears to be using the &lt;code&gt;CActiveRecord&lt;/code&gt;'s implementation of delete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;CActiveRecord::delete()&lt;/code&gt;, it has a &lt;code&gt;$this-&amp;gt;afterDelete()&lt;/code&gt; method, which looks like it should be raising an &lt;code&gt;onAfterDelete&lt;/code&gt; event, but I haven't had any luck hooking into it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;craft()-&amp;gt;on('pluginhandle_messageRecord.onAfterDelete', ...)&lt;/code&gt; and &lt;code&gt;craft()-&amp;gt;on('cActiveRecord.onAfterDelete', ...)&lt;/code&gt;, but neither gets triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know the correct syntax for hooking into this event for this specific custom record?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="57" LastEditDate="2015-10-21T16:42:50.343" LastActivityDate="2015-10-21T16:51:33.563" Title="Hooking into event when record deleted from custom plugin" Tags="&lt;events&gt;&lt;records&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12037" PostTypeId="2" ParentId="12036" CreationDate="2015-10-21T16:51:33.563" Score="1" Body="&lt;p&gt;Because that's a Yii event, it doesn't follow the same &lt;code&gt;component.eventName&lt;/code&gt; syntax that the other Craft events use and you can't use &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp#on-detail&quot; rel=&quot;nofollow&quot;&gt;craft-&gt;on()&lt;/a&gt; to register to listen to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but you should be able to use the traditional &lt;a href=&quot;http://www.yiiframework.com/wiki/327/events-explained&quot; rel=&quot;nofollow&quot;&gt;Yii method&lt;/a&gt;, though. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myRecord-&amp;gt;onAfterDelete = function (Event $event) {&#xA;    // Do your thing.&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-21T16:51:33.563" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12038" PostTypeId="1" AcceptedAnswerId="12041" CreationDate="2015-10-21T17:35:28.997" Score="3" ViewCount="152" Body="&lt;p&gt;Running into a strange issue with the XML sitemap on our site that I'm hoping for help with. Here is example code for the blog section of our site in our sitemap: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogPosts = craft.entries.find({ section: 'blogPosts'}) %}&#xA;&#xA;{% for entry in blogPosts %}&#xA;    &amp;lt;url&amp;gt;&#xA;        &amp;lt;loc&amp;gt;{{ filteredUrl(entry.url) }}&amp;lt;/loc&amp;gt;&#xA;        &amp;lt;lastmod&amp;gt;{{ entry.dateUpdated.w3c() }}&amp;lt;/lastmod&amp;gt;&#xA;        &amp;lt;changefreq&amp;gt;{{ changeFreq }}&amp;lt;/changefreq&amp;gt;&#xA;        &amp;lt;priority&amp;gt;1&amp;lt;/priority&amp;gt;&#xA;    &amp;lt;/url&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For context, I believe that the sitemap template was built in roughly early December of last year as part of our site redesign. At the time we had yet to import a variety of older posts from our old website blog, but did so after the sitemap had been coded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like our sitemap to show those old posts created before the early December timeframe but, unless I change the &quot;post date&quot; to be after Dec 2014, the post will not appear. This is true even if I make a modification to the page, thus changing the dateUpdated field (which populates &lt;code&gt;&amp;lt;lastmod&amp;gt;&lt;/code&gt;). If I change the post date of an old post to 2015, it will appear on the sitemap (with &lt;code&gt;&amp;lt;lastmod&amp;gt;&lt;/code&gt; showing the current date), but if I change it back to 2014, it disappears. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no code that I can see in the template that sets a required post date timeframe for appearing on the sitemap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to fix this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="57" LastEditDate="2015-10-21T17:51:00.577" LastActivityDate="2015-10-21T18:16:02.450" Title="Old Posts Not Appearing in XML Sitemap" Tags="&lt;templating&gt;&lt;seo&gt;&lt;xml&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12039" PostTypeId="2" ParentId="12022" CreationDate="2015-10-21T17:49:22.053" Score="1" Body="&lt;p&gt;The problem was that the redirect page was not setup. Once I threw up a test page there, the error no longer triggers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's odd is that the error page gave little clue (at least to me) as to what was happening. &lt;/p&gt;&#xA;" OwnerUserId="4034" LastActivityDate="2015-10-21T17:49:22.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12040" PostTypeId="1" AcceptedAnswerId="12044" CreationDate="2015-10-21T18:04:37.300" Score="1" ViewCount="144" Body="&lt;p&gt;Is is possible to loop through both a category group and tag group in a for loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories: blue, red, orange&#xA;Tags: basketball&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loop displays: basketball, blue, orange, red.&lt;/p&gt;&#xA;" OwnerUserId="977" LastActivityDate="2015-10-21T18:47:49.223" Title="Loop through both category group and tag group in single loop" Tags="&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12041" PostTypeId="2" ParentId="12038" CreationDate="2015-10-21T18:16:02.450" Score="4" Body="&lt;p&gt;Default limit is 100, try adding &lt;code&gt;.limit(null)&lt;/code&gt; to the query &lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-10-21T18:16:02.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12042" PostTypeId="1" AcceptedAnswerId="12045" CreationDate="2015-10-21T18:19:59.057" Score="2" ViewCount="536" Body="&lt;p&gt;I've just changed a rich text field to a number field and am now unable to bring up either the front-end or the dashboard because of multiple CDbException errors. When trying to access &lt;code&gt;/admin&lt;/code&gt;, here's the first line of the error message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_sqFt' in 'field list'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed a rich text field named &lt;code&gt;projectDescription&lt;/code&gt; to a number field named &lt;code&gt;sqFt&lt;/code&gt;. I understand that the new column can't be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When updating a field type, I know that there's a chance for data loss. Data loss would be ok for the entries that this change would affect. But I've made other changes since my last backup that I'd like to retain if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running the latest Craft Pro.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2015-10-21T21:23:09.717" Title="CDbException after updating field type" Tags="&lt;database&gt;&lt;field&gt;&lt;error&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12043" PostTypeId="2" ParentId="12030" CreationDate="2015-10-21T18:35:26.697" Score="2" Body="&lt;p&gt;Was simply root password in DB changing since last loading up environment. Threw some more errors to finally see database connection issues and just had to update db.php to fix. Leaving this here in case anyone else has issues.&lt;/p&gt;&#xA;" OwnerUserId="4231" LastActivityDate="2015-10-21T18:35:26.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12044" PostTypeId="2" ParentId="12040" CreationDate="2015-10-21T18:47:49.223" Score="2" Body="&lt;p&gt;Something like this may work for you (untested).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('myCategoryGroup').find %}&#xA;{% set tags = craft.tags.group('myTagGroup').find %}&#xA;{% set elements = categories|merge(tags) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for element in elements %}&#xA;        &amp;lt;li&amp;gt;{{ element.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sorting them alphabetically is a little more difficult. For that you may want to try twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/sort.html&quot; rel=&quot;nofollow&quot;&gt;sort filter&lt;/a&gt; or, failing that, the &lt;a href=&quot;http://michaelrog.com/craft/supersort&quot; rel=&quot;nofollow&quot;&gt;supersort&lt;/a&gt; or &lt;a href=&quot;https://github.com/victor-in/Craft-TwigBetterSort&quot; rel=&quot;nofollow&quot;&gt;craft-twig-better-sort&lt;/a&gt; plugins.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-10-21T18:47:49.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12045" PostTypeId="2" ParentId="12042" CreationDate="2015-10-21T21:17:58.457" Score="0" Body="&lt;p&gt;Two issues here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first error was already a known issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;General error: 1366 Incorrect integer value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When MySQL's &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict&quot; rel=&quot;nofollow&quot;&gt;strict mode&lt;/a&gt; is enabled, you can get errors like this when swapping an existing field from one type to another where the underlying MySQL datatypes aren't compatible. Swapping from &lt;a href=&quot;http://buildwithcraft.com/docs/checkboxes-fields&quot; rel=&quot;nofollow&quot;&gt;Checkbox&lt;/a&gt; to &lt;a href=&quot;http://buildwithcraft.com/docs/lightswitch-fields&quot; rel=&quot;nofollow&quot;&gt;Lightswitch&lt;/a&gt; is another time when this could occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That one is on our bug tracker, but it's going to be quite an involved fix, so we haven't gotten around to it yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second issue is the one you found. Making the swap from one field type to another &lt;strong&gt;and&lt;/strong&gt; changing the field handle at the same time would not only cause the known error to occur, it would render the rest of the control panel unusable.  That bug has been fixed for the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2700&quot; rel=&quot;nofollow&quot;&gt;post 2.4.2700&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-10-21T21:23:09.717" LastActivityDate="2015-10-21T21:23:09.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12047" PostTypeId="1" CreationDate="2015-10-21T22:16:08.417" Score="1" ViewCount="318" Body="&lt;p&gt;I'm trying to create a field group in a plugin that fires onAfterInstall. I'm getting the error below but after install the field group does exist and seems to have been created successfully. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/10/21 21:57:17 [warning] [application] [Forced] Failed installing XXXXXX: An exception was thrown: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`craft`.`craft_fieldlayoutfields`, CONSTRAINT `craft_fieldlayoutfields_fieldId_fk` FOREIGN KEY (`fieldId`) REFERENCES `craft_fields` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_fieldlayoutfields` (`required`, `uid`, `layoutId`, `tabId`, `sortOrder`, `dateUpdated`, `dateCreated`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6). Bound with :yp0=0, :yp1='b68bdc0b-647d-45fd-afa1-dbadffb973b8', :yp2=427, :yp3=263, :yp4=2, :yp5='2015-10-21 21:57:17', :yp6='2015-10-21 21:57:17'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what the code look like which is creating the field group:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// XXXXX field group&#xA;Craft::log('Creating the XXXXX field group.',&#xA; LogLevel::Info, true, 'application', 'XXXXX');&#xA;&#xA;$group = new FieldGroupModel();&#xA;$group-&amp;gt;id   = '';&#xA;$group-&amp;gt;name = 'XXXXXXX';&#xA;&#xA;if (craft()-&amp;gt;fields-&amp;gt;saveGroup($group))&#xA;{&#xA;  Craft::log('XXXXXX field group created successfully.',&#xA;   LogLevel::Info, true, 'application', 'XXXXXX');&#xA;}&#xA;else&#xA;{&#xA;  Craft::log('Could not save the XXXXXX field group.',&#xA;   LogLevel::Warning, true, 'application', 'XXXXXX');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4230" LastActivityDate="2015-10-22T04:08:15.140" Title="Create a field group in a plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12048" PostTypeId="1" CreationDate="2015-10-21T23:38:09.167" Score="1" ViewCount="120" Body="&lt;p&gt;I'm trying to list some entries from specific channel and get the access to matrix fields. The problem is that some of the entries are listed twice or even often. How do I remove the duplicates?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}&#xA;        {% for content in coupon.contentBuilder %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="720" LastEditorUserId="57" LastEditDate="2015-10-22T01:17:51.950" LastActivityDate="2015-10-24T08:55:58.843" Title="List Entries and Matrix" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12049" PostTypeId="2" ParentId="12048" CreationDate="2015-10-22T01:05:42.743" Score="1" Body="&lt;p&gt;You'll have to build a list of the data and then display it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set arr = [] %}&#xA;&#xA;{% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}&#xA;    {% for content in coupon.contentBuilder %}&#xA;        {% set arr = arr|merge([content.myUniqueFieldName: content]) %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{% for item in arr %}&#xA;    {{ item.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3557" LastEditorUserId="3557" LastEditDate="2015-10-24T08:55:58.843" LastActivityDate="2015-10-24T08:55:58.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12050" PostTypeId="2" ParentId="12047" CreationDate="2015-10-22T04:08:15.140" Score="1" Body="&lt;p&gt;Just a hunch and not tested, but don't do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$group-&amp;gt;id   = '';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My guess is by explicitly setting that to an empty string, Craft thinks it's dealing with an existing record and not a new one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-22T04:08:15.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12051" PostTypeId="1" CreationDate="2015-10-22T06:48:15.187" Score="2" ViewCount="65" Body="&lt;p&gt;Long story short: I've been trying to find out how Craft processes the request and eventually create the output. The search is going deeper and deeper into the core, but it feels like I'm missing out on something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible for a plugin to 'fetch' the (full) output of a page generated by Craft?&lt;/p&gt;&#xA;" OwnerUserId="4114" LastEditorUserId="45" LastEditDate="2015-10-22T19:49:48.247" LastActivityDate="2015-10-22T19:49:48.247" Title="How is a typical frontend request output generated?" Tags="&lt;plugin-development&gt;&lt;output&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12052" PostTypeId="2" ParentId="11991" CreationDate="2015-10-22T10:37:42.313" Score="1" Body="&lt;p&gt;The default Checkboxes field type stores its value to the database as a serialized PHP array. So for an entry with checkboxes &quot;7&quot;, &quot;12&quot; and &quot;32&quot; checked, the value in the &lt;code&gt;field_interests&lt;/code&gt; column is &lt;code&gt;[&quot;7&quot;,&quot;12&quot;,&quot;32&quot;]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is &lt;strong&gt;not query friendly&lt;/strong&gt; at all, so the best solution would be to use a different field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you really want to use the checkboxes field, here's how you can query for your elements. Convert your criteria model to a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; object and add a new &lt;code&gt;WHERE&lt;/code&gt; clause with a &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;LIKE&lt;/code&gt;&lt;/a&gt; condition to perform pattern matching. Include the quotes enclosing each ID in the pattern, this should make the query robust.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($user_criteria);&#xA;$params = array(&#xA;    ':interestId' =&amp;gt; '%&quot;'.$interestId.'&quot;%',&#xA;);&#xA;$query-&amp;gt;andWhere('field_interests LIKE :interestId', $params);&#xA;$results = $query-&amp;gt;queryAll();&#xA;&#xA;$users = EntryModel::populateModels($results);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-22T10:37:42.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12053" PostTypeId="2" ParentId="12051" CreationDate="2015-10-22T10:44:56.350" Score="3" Body="&lt;p&gt;Craft is an MVC application, so most requests initially will get routed to a controller action. Steps 3-6 in our &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing&lt;/a&gt; docs page show the various ways that the target controller action is decided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Controller actions can really do whatever they want with the request at that point, but typically they will perform some level of authorization, and then either perform an action and/or define + send the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you request a template path directly, the request will get routed to the &lt;a href=&quot;http://buildwithcraft.com/classreference/controllers/TemplatesController#actionRender-detail&quot; rel=&quot;nofollow&quot;&gt;templates/render&lt;/a&gt; action, which will verify that the template actually exists, and then render and return it, otherwise throw a 404 exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template rendering is ultimately performed by &lt;a href=&quot;http://buildwithcraft.com/classreference/services/TemplatesService#render-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService::render()&lt;/a&gt;, which is where Twig gets invoked.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-22T10:44:56.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12055" PostTypeId="1" AcceptedAnswerId="12059" CreationDate="2015-10-22T11:55:16.167" Score="4" ViewCount="2664" Body="&lt;p&gt;I wasn't to allow a user to enter html into the Rich Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The html in question is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;issuuembed&quot; style=&quot;width: 525px; height: 525px;&quot; data-configid=&quot;7563847/30149275&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;script src=&quot;//e.issuu.com/embed.js&quot; async=&quot;true&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can save the entry and on the front end the content displays ok - but when I go back in to edit the entry it is no longer there - the div and script tags have been removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding this &lt;/p&gt;&#xA;&#xA;&lt;p&gt;replaceDivs: false,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to the config but it doesn't make any difference&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="125" LastEditDate="2015-10-22T14:29:07.020" LastActivityDate="2019-04-09T05:46:56.840" Title="Redactor stripping script/html tags" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12056" PostTypeId="1" AcceptedAnswerId="36261" CreationDate="2015-10-22T11:56:15.903" Score="3" ViewCount="1151" Body="&lt;p&gt;I want the ability to parse environment variables such as {siteName} and globals from channel fields, for example a rich text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been using &lt;code&gt;{{ include(template_from_string(entry.fieldName)|raw) }}&lt;/code&gt;, but this is not suitable because it gives authors the full power of twig.&#xA;Brandon Kelly pointed out that using the replace filter can work &lt;code&gt;{{ entry.fieldName|replace('{siteName}', siteName)|raw }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a macro I can make this manageable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the ability to use globals too, what is the best way to have all globals being options to replace or using another method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would having 20 possible variable options to replace cause any issues, I would be calling this 3-4 times in a template.&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2020-09-16T23:35:54.930" Title="How to parse environment variables and globals from a field" Tags="&lt;globals&gt;&lt;environmentvariables&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12057" PostTypeId="2" ParentId="12056" CreationDate="2015-10-22T14:13:14.107" Score="2" Body="&lt;p&gt;You could enable your client to use &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;Reference Tags&lt;/a&gt; by adding the &lt;a href=&quot;http://buildwithcraft.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;parseRefs&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set str = '&amp;lt;p&amp;gt;Since {globalset:42:yearEstablished}&amp;lt;/p&amp;gt;' %}&#xA;{{ str|parseRefs|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this would enable them to access field values of (almost) any element (entries, assets, tags, ..), not just from global sets.&#xA;And they would also have to remember the global set's ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your current &lt;a href=&quot;http://buildwithcraft.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;replace&lt;/code&gt;&lt;/a&gt; filter solution is a good approach in my opinion. You can pass multiple replacements pairs like so&#xA;(and no, you won't notice if there's 1 or 100 of them):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set str = '&amp;lt;p&amp;gt;Since {yearEstablished}&amp;lt;/p&amp;gt;' %}&#xA;{% set replacements = {&#xA;    '{yearEstablished}': companyInfo.yearEstablished,&#xA;    '{siteName}': siteName,&#xA;} %}&#xA;{{ str|replace(replacements)|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also consider building that replacements array programatically.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-22T14:13:14.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12058" PostTypeId="2" ParentId="12055" CreationDate="2015-10-22T14:15:33.750" Score="2" Body="&lt;p&gt;As you probably already know, Redactor removes any inline styling. &lt;code&gt;replaceDivs&lt;/code&gt; doesn't appear to be in later versions of Redactor (at the least, it's not documented.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Redactor will always remove Script tags, per the documentation. (I ran into this issue a few days ago.) Redactor supposedly has an option for this, but it doesn't appear to work in Craft, and has shaky documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the official Redactor documentation for it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Using this setting with false argument, you can restrict use of script tag in your HTML. Redactor will automatically and always strip this tag form the code.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the actual setting for Redactor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;script: false&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to get Redactor to allow script tags by removing that functionality from Redactor's core, but this should be considered a &lt;em&gt;very&lt;/em&gt; temporary workaround until we can get someone from P&amp;amp;T to add it, or clarification on the tag's proper use:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to &lt;code&gt;craft/app/resources/lib/redactor/redactor.js&lt;/code&gt; on line 193, and remove the 'script' tag from the array.&lt;/li&gt;&#xA;&lt;li&gt;Comment out line 1980&lt;/li&gt;&#xA;&lt;li&gt;Comment out line 2049&lt;/li&gt;&#xA;&lt;li&gt;Comment out line 8006&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Again, &lt;strong&gt;this is &lt;em&gt;very&lt;/em&gt; temporary until someone from P&amp;amp;T can confirm proper tag functionality.&lt;/strong&gt; You're modifying core, which is almost never a good thing.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastEditorUserId="4086" LastEditDate="2015-10-22T20:56:17.247" LastActivityDate="2015-10-22T20:56:17.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12059" PostTypeId="2" ParentId="12055" CreationDate="2015-10-22T14:22:46.780" Score="6" Body="&lt;p&gt;Please do yourself a favor and &lt;strong&gt;don't do this  in Redactor&lt;/strong&gt;. Find a solution with Matrix (and/or &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;noreferrer&quot;&gt;Super Table&lt;/a&gt;) to add things like this in-between your text blocks.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-22T14:22:46.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12060" PostTypeId="1" CreationDate="2015-10-22T14:57:13.330" Score="1" ViewCount="1184" Body="&lt;p&gt;I'm currently doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = &quot;foo, bar&quot; %}&#xA;&#xA;{% set entries1 = craft.entries.section('sectionName').customField1(vars).limit(NULL) %}&#xA;{% for entry in entries1 %}&#xA;    {% if entry not in allEntries %}&#xA;        {% set allEntries = allEntries | merge([entry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set entries2 = craft.entries.section('sectionName').customField2(vars).limit(NULL) %}&#xA;{% for entry in entries2 %}&#xA;    {% if entry not in allEntries %}&#xA;        {% set allEntries = allEntries | merge([entry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But for each custom field I want to check, it's a trip to the database, and I've currently got to check three custom fields. Is there a way to merge these into one trip? I need to know whether the contents of &lt;code&gt;vars&lt;/code&gt; are in either custom field. They might be in one, none of both, for example.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-10-22T16:03:38.153" Title="How to fetch entries based on contents of several custom fields?" Tags="&lt;entries&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12061" PostTypeId="1" AcceptedAnswerId="12063" CreationDate="2015-10-22T15:53:58.177" Score="3" ViewCount="622" Body="&lt;p&gt;I have set up a custom field for a category group. How do I get the value of this field in a loop that goes through entries? Each category in the group could have this field's value set as true or false (light switch). I.e. I need to see what category is related to the current entry and then look up the value of this field - there is some html I want to show only if the value is true.&lt;/p&gt;&#xA;" OwnerUserId="4173" LastActivityDate="2015-10-22T16:02:40.723" Title="Fields associated with a category group" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12062" PostTypeId="2" ParentId="12060" CreationDate="2015-10-22T15:54:45.977" Score="2" Body="&lt;p&gt;No, but this is possible with a few lines of plugin code. You just need to create a &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; object from your criteria model and add your &lt;code&gt;WHERE&lt;/code&gt; conditions with a &lt;code&gt;OR&lt;/code&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this function to your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template variable&lt;/a&gt; class and you can get the entries from your templates with a single query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntriesWithVars($vars)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'sectionName';&#xA;    $criteria-&amp;gt;limit = null;&#xA;&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    $conditions = array(&#xA;        'or',&#xA;        array('in', 'field_customField1', $vars),&#xA;        array('in', 'field_customField2', $vars)&#xA;    );&#xA;&#xA;    $query-&amp;gt;andWhere($conditions);&#xA;&#xA;    $results = $query-&amp;gt;queryAll();&#xA;&#xA;    return EntryModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = ['foo', 'bar'] %}&#xA;{% set entries = craft.myPlugin.getEntriesWithVars(vars) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-22T16:03:38.153" LastActivityDate="2015-10-22T16:03:38.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12063" PostTypeId="2" ParentId="12061" CreationDate="2015-10-22T16:02:40.723" Score="2" Body="&lt;p&gt;You can access a category's fields exactly like you&#xA;access an entry's fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.myLightswitch }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this should do it for your categories loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% for category in entry.myCategoriesField %}&#xA;&#xA;        {{ category }}&#xA;&#xA;        {% if category.myLightswitch %}&#xA;            EXTRA&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-22T16:02:40.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12064" PostTypeId="1" CreationDate="2015-10-22T16:42:33.817" Score="3" ViewCount="660" Body="&lt;p&gt;Is there a way with SuperSort to sort an array by multiple variables? For example, let's I have the following data and I want to sort by count and then alphabetically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pineapples (2)&#xA;grapefruits (4)&#xA;apples (2)&#xA;bananas (3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ideally, I would want that to be sorted as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;grapefruits (4)&#xA;bananas (3)&#xA;apples (2)&#xA;pineapples (2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4061" LastEditorUserId="125" LastEditDate="2015-10-22T17:15:40.467" LastActivityDate="2015-10-22T18:01:39.207" Title="SuperSort - Sort by multiple variables" Tags="&lt;plugin-supersort&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12065" PostTypeId="2" ParentId="12064" CreationDate="2015-10-22T16:42:33.817" Score="4" Body="&lt;p&gt;I was able to accomplish this by just adding both variables to my SuperSort tag. In essence, what I did was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fruits = fruits | supersort('natsortas', '{count} {title}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems to be working in my situation, but if there's a better way to do it, I'm open to suggestions.&lt;/p&gt;&#xA;" OwnerUserId="4061" LastEditorUserId="125" LastEditDate="2015-10-22T17:21:06.050" LastActivityDate="2015-10-22T17:21:06.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12066" PostTypeId="2" ParentId="12064" CreationDate="2015-10-22T18:01:39.207" Score="1" Body="&lt;p&gt;I just gave it a play and found a simple solution to get them ordered by count in descending order&#xA;and them by title in ascending order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fruits = fruits|supersort('natsortas', '{{ (9999-object.count) ~ object.title }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-22T18:01:39.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12067" PostTypeId="2" ParentId="12056" CreationDate="2015-10-22T18:02:09.173" Score="2" Body="&lt;p&gt;You can use my &lt;a href=&quot;https://github.com/lindseydiloreto/craft-filterenvvar&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Filter Environment Variables&lt;/strong&gt;&lt;/a&gt; plugin, which will get you about half-way there. It will automatically parse out any environment variables which show up in your dynamic fields...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myField | envvar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Once you've got that installed, it's fairly easy to adjust the logic to accommodate for globals as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to &lt;code&gt;/filterenvvar/twigextensions/FilterEnvVarTwigExtension.php&lt;/code&gt;, and change this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function envvar($string)&#xA;{&#xA;    return craft()-&amp;gt;config-&amp;gt;parseEnvironmentString($string);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... to this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public $globals = array();&#xA;&#xA;public function __construct()&#xA;{&#xA;    foreach (craft()-&amp;gt;globals-&amp;gt;allSets as $globalSet)&#xA;    {&#xA;        foreach ($globalSet-&amp;gt;content-&amp;gt;attributes as $field =&amp;gt; $value)&#xA;        {&#xA;            $this-&amp;gt;globals[$globalSet-&amp;gt;handle.'.'.$field] = $value;&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;public function envvar($string)&#xA;{&#xA;    $string = craft()-&amp;gt;config-&amp;gt;parseEnvironmentString($string);&#xA;    $string = $this-&amp;gt;parseGlobals($string);&#xA;    return $string;&#xA;}&#xA;&#xA;public function parseGlobals($string)&#xA;{&#xA;    foreach ($this-&amp;gt;globals as $key =&amp;gt; $value)&#xA;    {&#xA;        $string = str_replace('{'.$key.'}', $value, $string);&#xA;    }&#xA;&#xA;    return $string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives you the ability to parse global variables, in addition to your environment variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your global variables, you'll need to include the global set &lt;strong&gt;handle&lt;/strong&gt; in the token name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my global field value is {globalSetHandle.fieldHandle}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This allows multiple global sets to use the same field.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-10-22T18:02:09.173" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12068" PostTypeId="2" ParentId="11644" CreationDate="2015-10-22T18:12:44.997" Score="7" Body="&lt;p&gt;I eventually figured this out. Here's the code that's working for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newFields = array(&#xA;  0 =&amp;gt; '12', // $field-&amp;gt;fieldId&#xA;  1 =&amp;gt; '15'  // $field-&amp;gt;fieldId&#xA;);&#xA;&#xA;// First we get all sections and loop through them&#xA;$allSections = craft()-&amp;gt;sections-&amp;gt;getAllSections();&#xA;foreach ($allSections as $section)&#xA;{&#xA;  // Then we get all EntryTypes of each section and loop through those&#xA;  $sectionEntryTypes = $section-&amp;gt;getEntryTypes();&#xA;  foreach ($sectionEntryTypes as $entryType) &#xA;  {&#xA;    // Grab the current layout and tabs&#xA;    $currentLayout = $entryType-&amp;gt;getFieldLayout();&#xA;    $currentTabs = $currentLayout-&amp;gt;getTabs();&#xA;&#xA;    // This will the array passed to assembleLayout&#xA;    $postedFieldLayout = array();&#xA;&#xA;    // Loop through each tab and build our array&#xA;    foreach ($currentTabs as $tab) {&#xA;      $fields = $tab-&amp;gt;getFields();&#xA;      foreach ($fields as $field) {&#xA;        $postedFieldLayout[$tab-&amp;gt;name][] = $field-&amp;gt;fieldId;&#xA;      }&#xA;    }&#xA;&#xA;    // Append the new fields we want to show to that array&#xA;    $postedFieldLayout['newFields'] = $this-&amp;gt;newFields;&#xA;    $requiredFields = array();&#xA;&#xA;    // Assemble the layout&#xA;    $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout($postedFieldLayout, $requiredFields);&#xA;    $fieldLayout-&amp;gt;type = ElementType::Entry;&#xA;    $entryType-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;    // Save it&#xA;    if (craft()-&amp;gt;sections-&amp;gt;saveEntryType($entryType))&#xA;    {&#xA;      Craft::log('Successfully appended fields.');&#xA;    }&#xA;    else &#xA;    {&#xA;      Craft::log('Could not append the fields.', LogLevel::Warning);&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2307" LastActivityDate="2015-10-22T18:12:44.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12069" PostTypeId="2" ParentId="11914" CreationDate="2015-10-22T18:33:17.483" Score="2" Body="&lt;p&gt;More of general guidance than an answer, but I'd look into creating a custom &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;ElementType&lt;/a&gt; and overriding the &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/BaseElementType#modifyElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;modifyElementsQuery&lt;/a&gt; in your ElementType to latch onto the main query Craft uses to grab elements.  From there you'd be able to join in whatever other data you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-22T18:33:17.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12070" PostTypeId="1" CreationDate="2015-10-23T08:08:54.057" Score="1" ViewCount="619" Body="&lt;p&gt;Has anyone had any success with Printmaker PDF plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m not sure where to put the tags?  The only way I can get the template to actually load is to add the Printmaker tags at the end of the document.  In which case, the &quot;Download CV&quot; link further up the page doesn’t work.  It seems {{ pdf.url }} HAS to appear AFTER the Printmaker tags.  If I move the Printmaker tags further up I get the error &quot;Internal Server Error - Requested HTML document contains no data.”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, i’ve linked to a print stylesheet and when I do get a document to be created the print.css is ignored?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="189" LastEditDate="2015-10-23T15:30:55.490" LastActivityDate="2015-10-23T21:22:13.510" Title="Help with Printmaker Plugin" Tags="&lt;pdf&gt;&lt;plugin-printmaker&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12071" PostTypeId="1" CreationDate="2015-10-23T09:44:03.773" Score="2" ViewCount="592" Body="&lt;p&gt;I disabled translation for Spanish and it returned 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set all my fields to translatable and By default craft translations are empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y4j9q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y4j9q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I return English by default? Using Spanish locale&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mJjBT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mJjBT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! :)&lt;/p&gt;&#xA;" OwnerUserId="4236" LastActivityDate="2015-10-26T05:45:17.477" Title="Craft Translation Fallback" Tags="&lt;localization&gt;&lt;elementcriteriamodel&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12072" PostTypeId="2" ParentId="11490" CreationDate="2015-10-23T10:22:36.490" Score="7" Body="&lt;p&gt;Disclaimer : I'm the dev of the SearchPlus plugin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus&quot;&gt;SearchPlus&lt;/a&gt; plugin by &lt;a href=&quot;http://squarebit.co.uk&quot;&gt;SquareBit&lt;/a&gt; (currently in private beta) integrates directly with Algolia and handles all the index population and updates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a few helpers for integrating on the front-end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All told - you should be able to just drop the plugin onto the site, configure your indexes and start a population action, drop a bit of js on the front-end and you're done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://squarebit.co.uk/contact&quot;&gt;Drop me a line&lt;/a&gt; and I'll get you on the beta.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-23T10:22:36.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12073" PostTypeId="1" CreationDate="2015-10-23T11:34:04.600" Score="1" ViewCount="291" Body="&lt;p&gt;How can I call a template with variable from a controller method? I tried following but it redirects to dashboard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionsetDate() {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('index');&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:14:56.983" LastActivityDate="2017-05-09T23:14:56.983" Title="Calling template from controller redirects to dashboard" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12074" PostTypeId="2" ParentId="12073" CreationDate="2015-10-23T11:40:14.327" Score="2" Body="&lt;p&gt;You will need to include your plugin handle, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('myPluginHandle/index', array());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-23T11:40:14.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12075" PostTypeId="2" ParentId="12070" CreationDate="2015-10-23T12:23:49.277" Score="3" Body="&lt;p&gt;We've used it successfully to generate PDF tickets for orders. It may/may not help in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On our order page, we simply have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a target=&quot;_blank&quot; href=&quot;/orders/tickets?orderId={{ order.number }}&quot;&amp;gt;Download PDF Tickets&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, our &lt;code&gt;order/tickets&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set html %}&#xA;    {% set orderId = craft.request.param('orderId') %}&#xA;&#xA;    // HTML/CSS to generate ticket&#xA;    &amp;lt;html&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&#xA;    &amp;lt;style&amp;gt;&#xA;&#xA;    body {&#xA;        font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;&#xA;        font-size: 13px;&#xA;        line-height: 1.4em;&#xA;        font-weight: bold;&#xA;    }&#xA;&#xA;    &amp;lt;/style&amp;gt;&#xA;    &amp;lt;/head&amp;gt;&#xA;&#xA;    &amp;lt;body&amp;gt;&#xA;&#xA;        // Ticket HTML&#xA;&#xA;    &amp;lt;/body&amp;gt;&#xA;&#xA;    &amp;lt;/html&amp;gt;&#xA;&#xA;{% endset %}&#xA;&#xA;{% set settings = {&#xA;    compress: true,&#xA;    orientation: 'portrait',&#xA;    size: 'letter',&#xA;    cacheDirectory: 'cache/tickets',&#xA;    filename: 'TICKET-' ~ craft.request.param('orderId') ~ '.pdf'&#xA;} %}&#xA;&#xA;{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}&#xA;&#xA;{{ pdf.output }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-23T12:23:49.277" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="12076" PostTypeId="2" ParentId="12071" CreationDate="2015-10-23T12:36:24.720" Score="2" Body="&lt;p&gt;By disabling a locale for an entry you are removing the automatically created route for this entry and locale (→ &lt;a href=&quot;http://buildwithcraft.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;docs for routing&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you can do, is to diable the automatic routing (uncheck &quot;Entries in this section have their own URLs&quot; in the section settings) and add the same routes as custom &lt;a href=&quot;http://buildwithcraft.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic routes&lt;/a&gt; manually. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;news/{slug}&lt;/code&gt; →  &lt;code&gt;news/_entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those manual routes won't 404 for disabled entries and you can have some logic in your _entry.html template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').slug(slug).first() %}&#xA;&#xA;{% if not entry %}&#xA;    {% set entry = craft.entries.section('news').slug(slug).locale('en').first() %}&#xA;    {% set duplicateContent = true %}&#xA;{% endif %}&#xA;&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would also recommend to set your meta tags accordingly and make search engines aware of the duplicated content. I updated the code with a new variable definition, test if it is defined in your _layout main template.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-26T05:45:17.477" LastActivityDate="2015-10-26T05:45:17.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12077" PostTypeId="1" AcceptedAnswerId="12078" CreationDate="2015-10-23T13:00:12.793" Score="2" ViewCount="116" Body="&lt;p&gt;I have an entires field which is using a structure as a source. &#xA;The structure has 3 levels and I would like to be able to limit it so the user can only select entries at the second level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look through the docs and at the field settings but it doesn't seem to be doable. If anyone knows a work around or a plugin which can do this that would be great. I wonder if it is possible to create a plugin to extend this field to do this if not?&lt;/p&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-10-23T13:34:11.957" Title="Is it possible to limit the level at which entries can be selected from within an entries field?" Tags="&lt;relations&gt;&lt;structure&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12078" PostTypeId="2" ParentId="12077" CreationDate="2015-10-23T13:34:11.957" Score="5" Body="&lt;p&gt;There's already a popular feature request for this:&lt;br&gt;&#xA;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7179163--entry-type-setting-for-entries-fields&quot;&gt;&quot;Entry Type&quot; setting for Entries fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes, it's currently also possible to do this by extending the default entries field type&#xA;and adding your custom criteria with &lt;code&gt;getInputSelectionCriteria()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class BusinessLogic_CustomEntriesFieldType extends EntriesFieldType&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Entries (custom)');&#xA;    }&#xA;&#xA;    protected function getInputSelectionCriteria()&#xA;    {&#xA;        return array(&#xA;            'level' =&amp;gt; 2&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-23T13:34:11.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12079" PostTypeId="2" ParentId="11218" CreationDate="2015-10-23T13:37:11.987" Score="2" Body="&lt;p&gt;I've tested this works on my install:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('search/tweets', {q:'#craftcms'}) %}&#xA;&#xA;{% for tweet in tweets.statuses %}&#xA;    {{ tweet.text }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have you tried running a &lt;code&gt;{{ dump(tweets) }}&lt;/code&gt; to see what you get?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-23T13:37:11.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12080" PostTypeId="2" ParentId="2340" CreationDate="2015-10-23T19:07:43.473" Score="3" Body="&lt;p&gt;I know an answer has been accepted for this question, but I wanted to provide another example for folks like me who seem to have a thick skull sometimes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &quot;team&quot; section which is a structure (the entries within this structure do not have their own urls). Within that structure, I have two different entry types. &quot;Team Category&quot; and &quot;Team Member&quot;. This allows me to nest different team members under different categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Accounting&#xA;    - Bob Smith&#xA;Marketing&#xA;    - John Doe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how I did that in my entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teamMembers = craft.entries.section('team').type(['teamCategory', 'teamMember']) %}&#xA;    {% for member in teamMembers %}&#xA;        &amp;lt;div class=&quot;team-member&quot;&amp;gt;&#xA;        {% if member.type == 'teamCategory' %}&#xA;            &amp;lt;h3&amp;gt;{{ member.title }}&amp;lt;/h3&amp;gt; {# Accounting #}&#xA;        {% else %}&#xA;            &amp;lt;p&amp;gt;{{ member.title }}&amp;lt;/p&amp;gt;  {# Bob Smith #}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-10-23T19:07:43.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12081" PostTypeId="1" CreationDate="2015-10-23T20:32:54.153" Score="1" ViewCount="162" Body="&lt;p&gt;I currently have three global Super Table fields, &lt;code&gt;global.berkeleyDeliveryMatrix&lt;/code&gt;, &lt;code&gt;global.oaklandDeliveryMatrix&lt;/code&gt; and &lt;code&gt;global.sanFranciscoDeliveryMatrix&lt;/code&gt;, all of which have a plaintext column in them titled &lt;code&gt;zipCode&lt;/code&gt;. &lt;a href=&quot;https://i.stack.imgur.com/57OCI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/57OCI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user has a profile address saved, which I'm looking to check against on the &lt;code&gt;userZip&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I search against all three of the global fields and return either a true or false statement if the set zip code was matched against any of the rows in the globals?&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2015-10-23T21:36:51.443" LastActivityDate="2015-10-23T21:36:51.443" Title="Searching multiple Super Table columns against an established value" Tags="&lt;search&gt;&lt;plugin-supertable&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12082" PostTypeId="2" ParentId="12070" CreationDate="2015-10-23T21:22:13.510" Score="1" Body="&lt;p&gt;Martin,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here's the template code you shared with me earlier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set html %}&#xA;&#xA;{% set entryId = craft.request.param('entryId') %}&#xA;&#xA;    &amp;lt;html&amp;gt;&#xA;    ...    &#xA;    &amp;lt;body&amp;gt;&#xA;    {{ entry.title }} &#xA;    &amp;lt;/body&amp;gt;&#xA;    &amp;lt;/html&amp;gt;&#xA;&#xA;{% endset %}&#xA;&#xA;{% set settings = {&#xA;    ...&#xA;} %}&#xA;&#xA;{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}&#xA;&#xA;{{ pdf.output }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're using an &lt;code&gt;entry&lt;/code&gt; variable to reference your entry content, but you haven't created such a variable in your template yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, while &lt;code&gt;{% set entryId = craft.request.param('entryId') %}&lt;/code&gt; is valid as a statement by itself, I think it might be conflicting with the opening of your &lt;code&gt;{% set html %}&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryId = craft.request.getParam('entryId') %}&#xA;&#xA;{% set entry = craft.entries.id(entryId).first %}&#xA;&#xA;{% set html %}&#xA;    ...&#xA;{% endset %}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;http://michaelrog.com/craft/printmaker&quot; rel=&quot;nofollow&quot;&gt;Printmaker docs&lt;/a&gt; for more code examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-10-23T21:22:13.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12083" PostTypeId="2" ParentId="12048" CreationDate="2015-10-23T22:01:54.123" Score="1" Body="&lt;p&gt;I wasn't able to understand how to apply your suggestions and went with this route:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for coupon in craft.entries.section('coupons').limit('30').status('live').order('postDate asc') %}&#xA;    {% set image = coupon.contentBuilder.type('image').first() %}&#xA;       {# multiple times for each of the required fields #}&#xA;       {# here comes some other code related to field's value manipulations #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-10-23T22:01:54.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12084" PostTypeId="1" CreationDate="2015-10-24T15:31:01.140" Score="69" ViewCount="144348" Body="&lt;p&gt;I am getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error CDbCommand failed to execute the SQL statement:&#xA;  SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #18&#xA;  of SELECT list is not in GROUP BY clause and contains nonaggregated&#xA;  column 'creighton_mma_craft.structureelements.root' which is not&#xA;  functionally dependent on columns in GROUP BY clause; this is&#xA;  incompatible with sql_mode=only_full_group_by&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have mysql 5.7.9 installed. Logging into the Control Panel is working fine, but the front end displays this message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the installation, the screen was stuck at the very end with &quot;Ooops…&quot; message. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to terminal commands and mysql configurations so the more specific the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="936" LastEditorUserId="130" LastEditDate="2015-11-19T20:07:47.400" LastActivityDate="2018-12-17T14:00:15.643" Title="Getting this SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by" Tags="&lt;installation&gt;&lt;mysql&gt;" AnswerCount="12" CommentCount="6" FavoriteCount="47" ContentLicense="CC BY-SA 3.0" />
  <row Id="12085" PostTypeId="1" AcceptedAnswerId="12087" CreationDate="2015-10-24T16:30:19.937" Score="2" ViewCount="770" Body="&lt;p&gt;I'm using Matrix fields for blog posts. These are made up of text and image block types. I want to pull in only the first image block and a snippet of text from the first text block into the blogs index page for listing the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding limit(1) to each block type didn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(3).find() %}&#xA;&amp;lt;div class=&quot;col-8  {% if loop.last %}last{% endif %}&quot;&amp;gt;&#xA;&#xA;    {% for block in entry.blogBody %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;      {% case &quot;text&quot; %}&#xA;      {{ block.text|hacksaw(chars='100', append='...') }}&#xA;&#xA;      {% case &quot;blogimage&quot; %}&#xA;       {% for asset in block.image %}&#xA;          &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; alt=&quot;&quot;/&amp;gt;&#xA;      {% endfor %}&#xA;&#xA; {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-10-25T16:22:36.987" Title="Matrix - using Limit on block types" Tags="&lt;matrix&gt;&lt;block-types&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12086" PostTypeId="2" ParentId="2116" CreationDate="2015-10-24T16:38:32.337" Score="15" Body="&lt;p&gt;I believe I have a workaround and can (roughly) explain what's going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the workaround:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use array syntax to test the existence of your custom fields instead of object syntax.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This works #}&#xA;{% if entry['someField'] is defined %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using array syntax for your conditional will result as true if your field does exist and false if it does not. Using object syntax results in false positives where the conditional always returns true even if a field doesn't exist:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# FALSE POSITIVES: These return true if a field doesn't exist #}&#xA;&#xA;{% if entry.someField is defined %} ... {% endif %}&#xA;{% if attribute(entry, 'someField') is defined %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe the false positive occurs using object syntax when the object has or is extending another object that uses a &lt;code&gt;__call()&lt;/code&gt; method. Twig will test to see if it can find an &lt;code&gt;attribute&lt;/code&gt; or a &lt;code&gt;method&lt;/code&gt;.  In the case it can't find an attribute on an object, it will look for a method.  And if it can't find a method on the object, it will check for the existence of a &lt;code&gt;__call()&lt;/code&gt; method and if the &lt;code&gt;_call()&lt;/code&gt; method exists it returns true, creating the undesired result of also returning true for any variable that doesn't exist on an object that uses a &lt;code&gt;__call()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't dug into the code, but it seems that using the array syntax doesn't trigger a search for a potential method associated with the &lt;code&gt;__call()&lt;/code&gt; behavior.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A couple related articles can be found on Straight Up Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/articles/how-to-check-if-a-variable-or-value-exists-using-twig&quot; rel=&quot;noreferrer&quot;&gt;How to check if a variable or value exists using Twig&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/articles/testing-if-something-exists-is-defined-length-is-not-null-is-not-empty&quot; rel=&quot;noreferrer&quot;&gt;Testing if something exists: is defined, length, is not null, is not empty&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-03-15T02:12:23.760" LastActivityDate="2017-03-15T02:12:23.760" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12087" PostTypeId="2" ParentId="12085" CreationDate="2015-10-24T17:21:29.407" Score="4" Body="&lt;p&gt;You can limit which blocks you want by type and only show the first of each, if they exist. Something like this might do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(3).find() %}&#xA;    &amp;lt;div class=&quot;col-8  {% if loop.last %}last{% endif %}&quot;&amp;gt;&#xA;&#xA;        {% set textBlock = entry.blogBody.type('text').first() %}&#xA;        {% set imgBlock = entry.blogBody.type('blogimage').first() %}&#xA;&#xA;        {% if textBlock %}&#xA;            {{ textBlock.text|hacksaw(chars='100', append='...') }}&#xA;        {% endif %}&#xA;&#xA;        {% if imgBlock %}&#xA;              &amp;lt;img src=&quot;{{ imgBlock.image[0].getUrl() }}&quot; alt=&quot;&quot;/&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2015-10-25T16:22:36.987" LastActivityDate="2015-10-25T16:22:36.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12088" PostTypeId="2" ParentId="11981" CreationDate="2015-10-25T08:49:38.220" Score="1" Body="&lt;pre&gt;&lt;code&gt;{# Here, we grab segment of a URI's to use in conditional statements for displaying category levels. Conditionals aren't here. Will have to do it by yourself. #}&#xA;{% set firstSeg = craft.request.getSegment(1) %}&#xA;{% set secondSeg = craft.request.getSegment(2) %}&#xA;{% set thirdSeg = craft.request.getSegment(3) %}&#xA;{% set fourthSeg = craft.request.getSegment(4) %}&#xA;&#xA;{# Grab all of the entry ids from the section, which we want to display categories for. #}&#xA;{% set entryIds = craft.entries.section('products').ids() %}&#xA;&#xA;&#xA;{# Here we grab the category group and a certain level, which we want to display categories for, and relate them to 'entryIds' #}&#xA;{% set firstLvls = craft.categories.relatedTo({ sourceElement: entryIds }).group('categories').level(1) %}&#xA;{% set secondLvls = craft.categories.relatedTo({ sourceElement: entryIds }).group('categories').level(2) %}&#xA;{% set thirdLvls = craft.categories.relatedTo({ sourceElement: entryIds }).group('categories').level(3) %}&#xA;{% set fourthLvls = craft.categories.relatedTo({ sourceElement: entryIds }).group('categories').level(4) %}&#xA;&#xA;{# We loop through first level of categories. Constructively, it's the navigation menu located at 'site.com/' #}&#xA;{% for firstLvl in firstLvls %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ firstLvl.getUrl }}&quot;&amp;gt;{{ firstLvl.title|replace({'-':' '}) }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&#xA;{# We loop through second level of categories. Constructively, it's the first category's selection menu&#xA;located at 'site.com/catLevel1' #}&#xA;{% for secondLvl in secondLvls %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ secondLvl.getUrl }}&quot;&amp;gt;{{ secondLvl.title|replace({'-':' '}) }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&#xA;{# We loop through third level of categories. Constructively, it's the second category's selection menu&#xA;located at 'site.com/catLevel1/catLevel2' #}&#xA;{% for thirdLvl in thirdLvls %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ thirdLvl.getUrl }}&quot;&amp;gt;{{ thirdLvl.title|replace({'-':' '}) }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&#xA;{# We loop through fourth level of categories. Constructively, it's the third category's selection menu&#xA;located at 'site.com/catLevel1/catLevel2/catLevel3' #}&#xA;{% for fourthLvl in fourthLvls %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ fourthLvl.getUrl }}&quot;&amp;gt;{{ fourthLvl.title|replace({'-':' '}) }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}﻿&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-10-25T08:49:38.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12089" PostTypeId="1" CreationDate="2015-10-25T13:19:46.093" Score="1" ViewCount="581" Body="&lt;p&gt;I have a few entries which are set to disabled. It seems that the live preview is not working then. It only works when the entry status is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems more like a bug than a feature, right?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked everything again and all conditions stated by Brandon below are met, but now I see that I actually don't use the &quot;entries own url&quot; setting. It's enabled, so I get the live preview button, but I use dynamic routing to create my own url's (because I need to add a category as a segment in the URL).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's probably where it goes wrong. I check the last segment of the URI as the slug of the specific entry and set my entry manually by it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I make live preview work than?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2015-11-13T21:58:44.397" LastActivityDate="2015-11-14T01:31:26.510" Title="No live preview available when entry status is set to disabled?" Tags="&lt;live-preview&gt;&lt;status&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12090" PostTypeId="1" AcceptedAnswerId="12095" CreationDate="2015-10-25T16:01:12.977" Score="1" ViewCount="329" Body="&lt;p&gt;Is it possible to specify the file formats for an upload field with the Contact Form? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it controlled by the extraAllowedFileExtensions setting?&lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-10-25T20:32:38.137" Title="File input attachment format for Contact Form plugin" Tags="&lt;plugin-contactform&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12091" PostTypeId="2" ParentId="12089" CreationDate="2015-10-25T16:26:37.850" Score="7" Body="&lt;p&gt;Live Preview will be available when the following are true:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The section’s “Entries in this section have their own URLs” setting is checked&lt;/li&gt;&#xA;&lt;li&gt;The section’s “Entry Template” setting points to a valid template path&lt;/li&gt;&#xA;&lt;li&gt;The entry has been saved&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It doesn’t matter if the entry is enabled or not.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-10-25T16:26:37.850" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12092" PostTypeId="1" AcceptedAnswerId="12097" CreationDate="2015-10-25T17:03:28.667" Score="2" ViewCount="497" Body="&lt;p&gt;I'm following &lt;a href=&quot;https://medium.com/@mattcollins_6/setting-up-a-local-dev-environment-for-craft-cms-using-laravel-homestead-2724be3954a5#.bsm07bevu&quot; rel=&quot;nofollow&quot;&gt;these instructions&lt;/a&gt; to Setting up a local dev environment for Craft CMS with Laravel Homestead.&#xA;When I go to &lt;code&gt;http://my-craft-site.dev/admin&lt;/code&gt;, I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft can’t connect to the database with the credentials in&#xA;  craft/config/db.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not having much luck with Google/Stack searches on the error message. I can connect to the Homestead DB via Sequel Pro using the credentials in db.php so I’m a bit confused by the error message.&#xA;DB Credentials: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u: homestead&#xA;p: secret&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4244" LastActivityDate="2015-10-26T01:10:31.753" Title="Laravel Homestead &amp; Craft: Craft can’t connect to the database with the credentials in craft/config/db.php" Tags="&lt;database&gt;&lt;config&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12094" PostTypeId="1" CreationDate="2015-10-25T20:24:49.310" Score="3" ViewCount="67" Body="&lt;p&gt;I'd like to set up a notification if an entry is saved in a the section 'memberNewsFeed'. The data that I would like to access is the entry title and url, and the user who made the change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody advise of the syntax to input into rich text field that comes as standard with sprout email please?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-10-27T15:25:08.420" Title="Sprout Email - accessing custom fields" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12095" PostTypeId="2" ParentId="12090" CreationDate="2015-10-25T20:32:38.137" Score="2" Body="&lt;p&gt;No, currently it will allow all file types and does not take the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#extraAllowedFileExtensions&quot; rel=&quot;nofollow&quot;&gt;extraAllowedFileExtensions&lt;/a&gt; config setting into account.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-25T20:32:38.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12096" PostTypeId="2" ParentId="416" CreationDate="2015-10-25T22:45:32.367" Score="1" Body="&lt;p&gt;It throws the error, since it fires the event in the transaction try-catch, and Twig was throwing the exception. In the catch block then it tried to execute the rollback.&lt;/p&gt;&#xA;" OwnerUserId="4054" LastActivityDate="2015-10-25T22:45:32.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12097" PostTypeId="2" ParentId="12092" CreationDate="2015-10-26T01:10:31.753" Score="2" Body="&lt;p&gt;When in doubt, reinstall, or in this case do it over again from the top. That fixed it.&lt;/p&gt;&#xA;" OwnerUserId="4244" LastActivityDate="2015-10-26T01:10:31.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12098" PostTypeId="1" AcceptedAnswerId="12103" CreationDate="2015-10-26T10:48:41.427" Score="1" ViewCount="102" Body="&lt;p&gt;I want to include &lt;code&gt;Parse&lt;/code&gt; SDK in my plugin. I created a folder &lt;code&gt;lib&lt;/code&gt; and put the SDK in it. and called like that in controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;use Parse\ParseClient;&#xA;use Parse\ParseQuery;&#xA;&#xA;&#xA;&#xA;    $APPID = 'xx';&#xA;    $MASTERKEY = 'xx';&#xA;    $RESTKEY = 'xxx';&#xA;    $PARSEURL = 'https://api.parse.com/1/';&#xA;&#xA;    $list = new parseQuery('Dance');&#xA;    $results = $list-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it says: &lt;code&gt;Fatal error: Class 'Parse\ParseQuery' not found in /vagrant/craft/plugins/xx&lt;/code&gt; not found.&lt;/p&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:14:36.467" LastActivityDate="2017-05-09T23:14:36.467" Title="How to call external lib in my plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12099" PostTypeId="2" ParentId="12005" CreationDate="2015-10-26T12:37:17.833" Score="1" Body="&lt;p&gt;Resolved by nuke and reinstall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the answers. It was in my own templates that I noticed the issue to start with. I removed all CSS to make sure it was not the cause in some odd way. I wanted to use the default template to be sure I had stock html from the system to also cut out any possible html code issues I might have mistakenly added or modified. None of my solutions worked, so I opened a ticket with Support. Brad did verify that he was able to install from scratch, remove the css, and verified it in Chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saved my templates that I personally created, as well the foundation.zurb components that I introduced. I deleted craft and the db, and started it over from scratch.  Once I had it back on fresh, I removed the CSS again from the stock template and the space issue was gone. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I re-implementable my template and foundation.zurb components again, and everything was fine this time. All of my own additions were okay as well. Something somewhere crept in on my first install somehow I guess.  Glad that it's resolved now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was odd though because I did refer back to a stock template saved from the default unzip as well as removing all CSS. I did have some posts that I added to the news feed back though so I am wondering if perhaps it crept in that way. Maybe something I did on one of the posts, because it was only ever on the news feed page that this issue appeared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logan&lt;/p&gt;&#xA;" OwnerUserId="4224" LastActivityDate="2015-10-26T12:37:17.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12101" PostTypeId="1" CreationDate="2015-10-26T14:48:08.427" Score="0" ViewCount="128" Body="&lt;p&gt;I need to use a Typekit font in Redactor, but I'm not quite sure if I've done something wrong, or if Redactor's made a breaking change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm enabling the &lt;code&gt;iframe = true&lt;/code&gt; parameter in a &lt;code&gt;custom.json&lt;/code&gt; redactor config, and then loading Typekit with the &lt;code&gt;initCallback&lt;/code&gt; parameter. However, Redactor isn't placing the iframe (as of Craft Pro 2.4.2691) that Typekit uses for selection purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? has Redactor recently made a breaking change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; What's the best-practice for using Typekit fonts in Redactor fields as of Craft Pro 2.4.2691?&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2015-10-26T18:22:36.797" Title="Using Typekit fonts in Redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12102" PostTypeId="1" AcceptedAnswerId="12121" CreationDate="2015-10-26T15:10:10.307" Score="1" ViewCount="672" Body="&lt;p&gt;I'm getting the following error whenever I try to post a new entry to one of my channels in Craft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/10/26 14:42:36 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'targetId' cannot be null. The SQL statement executed was: INSERT INTO `craft_relations` (`fieldId`, `sourceId`, `sourceLocale`, `targetId`, `sortOrder`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, NULL, NULL, :row0_col4, :row0_col5, :row0_col6, :row0_col7).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From what I can tell, the error is being triggered by the asset field in the section. I'm posting a JS created File to the asset field, not a file from a file input (which works fine during testing). The image file being posted is built from a Data URI which is converted to a Blob, and is then converted to a file. This is rather hacky*, but the best way I could find to successfully (as far as I can tell) post an image to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible that some important metadata is being left out when the image file is created, that is causing this error? Or is it a case of the image not being saved before the entry in time for this relation to be created, or vice versa?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;*My reason for doing this is because the images are from a mobile phone camera, everything is being posted from a Cordova app.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt;&#xA;From the app I'm posting directly to Craft with Ajax using the &lt;code&gt;entries/saveEntry&lt;/code&gt; action. But this is being routed via &lt;a href=&quot;https://github.com/ethercreative/TokenAuth&quot; rel=&quot;nofollow&quot;&gt;a plugin I wrote&lt;/a&gt; to allow me to use JWT based authentication. I've had no issues with this during testing, only when I switched from using a field input to generating the files via JavaScript has this error started occurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1.5:&lt;/strong&gt;&#xA;I've managed to fix the issue. See below.&lt;/p&gt;&#xA;" OwnerUserId="3899" LastEditorUserId="3899" LastEditDate="2015-10-27T10:56:10.017" LastActivityDate="2016-08-08T16:16:31.957" Title="SQLSTATE[23000]: Column 'targetId' cannot be null" Tags="&lt;assets&gt;&lt;image&gt;&lt;post&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12103" PostTypeId="2" ParentId="12098" CreationDate="2015-10-26T15:52:08.173" Score="2" Body="&lt;p&gt;Here is the method we are including libraries in our plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft&#xA;require_once(CRAFT_PLUGINS_PATH.'parse/parsequery/xx.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-26T15:52:08.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12104" PostTypeId="1" AcceptedAnswerId="12107" CreationDate="2015-10-26T16:25:30.200" Score="0" ViewCount="107" Body="&lt;p&gt;Looking to loop through tags from entries but limit to only show tags that are being used on entries. Right now this just loops through any and all created tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried limit to null but have had no luck getting that to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('storiesCategories').find %}&#xA;{% set tags = craft.tags.group('storiesTagGroup').find %}&#xA;{% set elements = categories|merge(tags) %}&#xA;&#xA;&amp;lt;ul class=&quot;pills&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;javascript:void(0);&quot; class=&quot;btn btn-secondary filter&quot; data-filter=&quot;all&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;    {% for element in elements | supersort('natcasesort') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;javscript:void(0)&quot; class=&quot;btn btn-secondary filter&quot; data-filter=&quot;.category-{{ element.title|kebab }}&quot;&amp;gt;{{ element.title|capitalize }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="977" LastEditorUserId="57" LastEditDate="2015-10-26T17:09:30.363" LastActivityDate="2015-10-26T18:02:00.603" Title="Show tags in tag group only being used on live entries" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12105" PostTypeId="1" CreationDate="2015-10-26T16:47:11.277" Score="2" ViewCount="141" Body="&lt;p&gt;how can I override default root URL behavior via routes? I did following but not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'pluginname/' =&amp;gt; array('action' =&amp;gt; 'pluginName/Controller/actionName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my template file name is &lt;code&gt;index&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="125" LastEditDate="2015-10-26T18:35:03.807" LastActivityDate="2015-10-26T18:35:03.807" Title="How to override default root URL of plugin?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12106" PostTypeId="2" ParentId="12084" CreationDate="2015-10-26T17:19:45.677" Score="96" Body="&lt;p&gt;MySQL 5.7.5+ changed the way &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html&quot;&gt;GROUP BY&lt;/a&gt; behaved in order to be SQL99 &lt;a href=&quot;https://en.wikipedia.org/wiki/SQL:1999&quot;&gt;compliant&lt;/a&gt; (where in previous versions it was not).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a good overview of the changes &lt;a href=&quot;http://rpbouman.blogspot.com/2014/09/mysql-575-group-by-respects-functional.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this affects some core queries that Craft uses when fetching elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news is that this has been fixed already in Craft 3 since we refactored the way that elements query grabs data and it no longer uses a GROUP BY.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bad news is that it's going to be pretty impractical to backport that fix into Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workaround for Craft 2, if you're running MySQL 5.7.5+ is to edit your &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.1/en/option-files.html&quot;&gt;my.cnf&lt;/a&gt; file and remove the &lt;code&gt;ONLY_FULL_GROUP_BY&lt;/code&gt; option from &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html&quot;&gt;sql_mode&lt;/a&gt;. That will change &lt;code&gt;GROUP BY&lt;/code&gt; behavior back to its pre-MySQL 5.7.5 behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for whatever reason (primarily you're on shared hosting), you aren't able to change the &lt;code&gt;sql_mode&lt;/code&gt; of your box at the environment level, as of the next Craft release (&lt;a href=&quot;https://craftcms.com/changelog#build2945&quot;&gt;post 2.6.2945&lt;/a&gt;), there is a new &lt;code&gt;initSQLs&lt;/code&gt; database config settings you can set in your &lt;code&gt;craft/config/db.php&lt;/code&gt;.  It will accept an array of SQL statements to be executed immediately after the database connection has been established.  If you're running into this MySQL 5.7 error, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just keep in mind this method will add at least one extra SQL query to every request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-09-29T22:39:53.823" LastActivityDate="2016-09-29T22:39:53.823" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="12107" PostTypeId="2" ParentId="12104" CreationDate="2015-10-26T17:58:06.010" Score="2" Body="&lt;p&gt;Your mention tags, but it seems like you're merging Categories and Tags together and trying to loop through the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you leave Categories out of the equation it's as simple as &lt;a href=&quot;http://buildwithcraft.com/help/active-tags&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want Categories and Tags, you'd repeat that process twice and merge the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that using &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;|merge&lt;/a&gt; on full-fledged arrays of objects is sketchy, though, since it's difficult for PHP to know how to compare the objects for equality.  You'll be much better off merging on something primitive, like an array of element IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryIds = craft.categories.group('storiesCategories').ids() %}&#xA;{% set tagIds = craft.tags.group('storiesTagGroup').ids() %}&#xA;{% set elementIds = categoryIds|merge(tagIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2015-10-26T18:02:00.603" LastActivityDate="2015-10-26T18:02:00.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12108" PostTypeId="2" ParentId="12101" CreationDate="2015-10-26T18:22:36.797" Score="1" Body="&lt;p&gt;I would try to add the fonts with the Craft plugins&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;Control Panel CSS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-26T18:22:36.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12109" PostTypeId="2" ParentId="12105" CreationDate="2015-10-26T18:26:22.473" Score="1" Body="&lt;p&gt;This works for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'settings/plugins/pluginname/index' =&amp;gt; 'pluginname/index'&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-26T18:26:22.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12110" PostTypeId="1" AcceptedAnswerId="12111" CreationDate="2015-10-26T19:23:29.200" Score="1" ViewCount="268" Body="&lt;p&gt;This might be impossible, but can you lookup a value in a key-value array with the value in a craft entry field? And perform math with it in twig? I'm trying to simplify my template code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a key value array like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;set aspectRatioSetting = {&#xA;    'four_three' : '0.75',&#xA;    'three_two' : '0.666666666667',&#xA;    'sixteen_nine' : '0.5625',&#xA;    'one_one' : '1'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'd like to be able to use those values in a math operation, the specific value looked up by a value in a custom entry field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformParams = { width: 1250, height: 1250 * aspectRatioSetting.four_three } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the value of the &quot;four_three&quot; key in the array is used in the math operation. Only the specific key would be set by the value in an entry field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformParams = { width: 1250, height: 1250 * aspectRatioSetting.(entry.aspectRatio) } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's not a good way for me to type it up because this clearly doesn't work. I'm just wondering if it's somehow possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe I'm just overcomplicating things in an attempt to simplify things : /&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2015-10-26T19:54:17.820" Title="Can you lookup the value in a key-value array with the value in an entry field?" Tags="&lt;entry&gt;&lt;field&gt;&lt;array&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12111" PostTypeId="2" ParentId="12110" CreationDate="2015-10-26T19:38:51.813" Score="3" Body="&lt;p&gt;Two options here ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformParams = { width: 1250, height: 1250 * aspectRatioSetting[entry.aspectRatio] } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or just give the select field a value that represents the number, not the word. So set a value of 0.75 instead of four_three, and let the label be Four/Three (or whatever seems fit).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-10-26T19:38:51.813" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12112" PostTypeId="2" ParentId="12110" CreationDate="2015-10-26T19:54:17.820" Score="1" Body="&lt;p&gt;Try: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set transformParams = { width: 1250, height: 1250 * (aspectRatioSetting.four_three|trim) } %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-10-26T19:54:17.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12113" PostTypeId="1" CreationDate="2015-10-26T23:45:38.853" Score="1" ViewCount="340" Body="&lt;p&gt;i´m implementing a image gallery and want to show the thumbnails ( no problem here ) with a transform applied, and i want to implement a image transform on the large image that opens on a lightbox. Why? because it´s a responsive website, and the load speed is crucial, and don´t want to slow things down loading the full image uploaded directly from the client camera ( 6mp or more ), i want to load a large image with a max width of 1000px and jpg quality of 70. I applied the transform and works fine, but the images below 1000px are streted to fit 1000px. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is: &lt;strong&gt;how to set max width of an image to 1000px BUT not forcing it if it´s smaller than the required size?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Crop Fit and Scales don´t do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is welcome! Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3985" LastEditorUserId="22" LastEditDate="2017-05-09T23:13:55.590" LastActivityDate="2017-05-09T23:13:55.590" Title="Image Transforms not stretching image" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12114" PostTypeId="2" ParentId="12113" CreationDate="2015-10-27T01:16:48.013" Score="2" Body="&lt;p&gt;Before you run your transform, you can check the width of the asset file and adjust your transform as needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = {&#xA;    mode: 'scale',&#xA;    width: 1000,&#xA;    quality: 70,&#xA;} %}&#xA;&#xA;{% if asset.width &amp;lt; 1000 %}&#xA;&#xA;    {% set thumb = {&#xA;        mode: 'scale',&#xA;        width: asset.width,&#xA;        quality: 70,&#xA;    } %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-27T01:16:48.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12115" PostTypeId="2" ParentId="11215" CreationDate="2015-10-27T03:33:39.663" Score="3" Body="&lt;p&gt;Passing the category as a comma delineated string and using &lt;code&gt;craft.request.getParam('category')&lt;/code&gt; the second time will not grab the second variable &lt;code&gt;4rooms&lt;/code&gt;.  First you need to parse that string into an array. This will create an array &lt;code&gt;['forsale','4rooms']&lt;/code&gt;. Use the parts of that array to assign to your other variables.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.request.getParam('category')|split(',') %}&#xA;{% set offerCategory = craft.categories.slug(params[0]) %}&#xA;{% set offerRooms = craft.categories.slug(params[1]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-10-27T03:40:58.947" LastActivityDate="2015-10-27T03:40:58.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12116" PostTypeId="1" CreationDate="2015-10-27T07:44:57.880" Score="5" ViewCount="327" Body="&lt;p&gt;what is the correct way to load third-party components into Craft 3 plugin I'm developing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;setComponents([&#xA;    'authClientCollection' =&amp;gt; [&#xA;        'class' =&amp;gt; '\yii\authclient\Collection',&#xA;        'clients' =&amp;gt; [&#xA;            'twitter' =&amp;gt; [&#xA;                'class' =&amp;gt; '\yii\authclient\clients\Twitter'&#xA;            ],&#xA;            // etc.&#xA;        ],&#xA;    ]&#xA;]);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to plugin's &lt;code&gt;init()&lt;/code&gt; function, as well as &lt;code&gt;parent::setComponents&lt;/code&gt;, but both produced same error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unknown component ID: authClientCollection&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here? &lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="57" LastEditDate="2015-10-27T15:26:34.170" LastActivityDate="2016-09-12T17:22:35.880" Title="How to load components into Craft 3 plugin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12117" PostTypeId="1" AcceptedAnswerId="12133" CreationDate="2015-10-27T09:10:00.627" Score="3" ViewCount="76" Body="&lt;p&gt;When performing a search on the front-end, is it possible to have two different behaviors, depending on the number of results?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With more than one result, show the normal &quot;results&quot; page.&lt;/li&gt;&#xA;&lt;li&gt;With only a single result, &lt;strong&gt;automatically redirect to that entry page.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4207" LastEditorUserId="45" LastEditDate="2015-10-27T19:06:35.470" LastActivityDate="2015-10-27T19:18:21.600" Title="Front-end searching: Automatically redirect when only 1 result" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12119" PostTypeId="1" CreationDate="2015-10-27T10:51:40.130" Score="3" ViewCount="31" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11443/show-only-children-of-current-page-in-submenu&quot;&gt;this solution&lt;/a&gt; to output the children within a current structure entry.  Unfortunately I need to take out the anchor on some entries that don't yet have content, but still include the (unlinked) title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in subnav  %}&#xA;  {% if page.id != entry.id %}&#xA;  &amp;lt;li&amp;gt;{% if page.pageIntroText|length %}&amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{%endif%}{{ page.title }}{% if page.pageIntroText|length %}&amp;lt;/a&amp;gt;{%endif%}&amp;lt;/li&amp;gt;&#xA;  {%else%}&#xA;  &amp;lt;li class=&quot;current-page&quot;&amp;gt;{{ page.title }}&amp;lt;/li&amp;gt;{%endif%}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.. but it removes the anchor regardless of whether there is any content in pageIntroText field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-27T15:31:21.873" Title="Remove the anchor in nav loop based on another field conditional" Tags="&lt;conditional&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12120" PostTypeId="1" CreationDate="2015-10-27T10:55:34.877" Score="2" ViewCount="75" Body="&lt;p&gt;At the moment use of Tags seems to be case insensitive.&#xA;So, for example, it is possible to tag an article as both 'IT Support' and 'it support'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it at all possible to make the Tags case sensitive?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-10-27T15:27:40.977" Title="Tag case sensitivity" Tags="&lt;tags&gt;&lt;case&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12121" PostTypeId="2" ParentId="12102" CreationDate="2015-10-27T11:03:46.067" Score="2" Body="&lt;p&gt;I've managed to fix the issue. Originally I was converting the Blob to a File, but this was causing the upload to silently fail. So, when Craft tried to create the relation between the asset field and the image, it threw the error above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, instead of converting to a file, I'm leaving the Blob as is but adding additional metadata (Last modified data &amp;amp; name), and passing a file name to the &lt;code&gt;FormData.append()&lt;/code&gt; when creating the FormData object.&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2015-10-27T11:03:46.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12122" PostTypeId="1" AcceptedAnswerId="12123" CreationDate="2015-10-27T12:00:28.440" Score="2" ViewCount="1001" Body="&lt;p&gt;I'm trying to pull through content based on items within a SuperTable entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After searching around I currently have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set individuals = craft.entries({section: 'barristers', relatedTo: { targetElement: entry, field: 'specialisms.linkToPage'}}) %}&#xA;{% for entry in individuals %}&#xA;  {{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's not pulling anything through?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-10-27T12:34:05.840" Title="SuperTable and related entries" Tags="&lt;relations&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12123" PostTypeId="2" ParentId="12122" CreationDate="2015-10-27T12:34:05.840" Score="5" Body="&lt;p&gt;Unfortunately, you can't use Craft's built in relations service for reverse relations lookup with Super Table. This is because there's actually a special case for nested relations, such as a Matrix field. Craft's own relations service has special handling for Matrix fields, which we also need to make use of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, Josh Angell (the star that he is) has submitted a fix for this, without having to hack the core. You'll just need to alter your code to use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reverseRelatedElements = craft.supertable.getRelatedElements({&#xA;  relatedTo: {&#xA;    targetElement: entry,&#xA;    field: 'specialisms.linkToPage'&#xA;  },&#xA;  section: 'barristers'&#xA;}) %}&#xA;&#xA;{% for relatedEntry in reverseRelatedElements %}&#xA;  {{ relatedEntry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-10-27T12:34:05.840" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12124" PostTypeId="1" CreationDate="2015-10-27T12:42:09.100" Score="1" ViewCount="122" Body="&lt;p&gt;I have a plugin that does a bunch of stuff with external APIs &lt;code&gt;onSaveEntry&lt;/code&gt; and then saves some of the gathered information back into the entry. I currently use &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&lt;/code&gt; but I obviously create a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw this answer (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10271/updating-an-entry-after-an-event-action-within-onsaveentry&quot;&gt;Updating an entry after an event action within onSaveEntry&lt;/a&gt;) but since there is a nice &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CComponent#detachEventHandler-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;detachEventHandler method&lt;/a&gt; I was wondering how to use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried hammering it with various combinations but I can't figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, my plugin does this on &lt;code&gt;init&lt;/code&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        craft()-&amp;gt;rmsLink-&amp;gt;rmsLinker($event);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then &lt;code&gt;rmsLinker&lt;/code&gt;, which is in my &lt;code&gt;RmsLinkerService&lt;/code&gt;, checks if the entry comes from the right canal and if so calls another function who is also in the &lt;code&gt;RmsLinkerService&lt;/code&gt; like so :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;sendShowToRmsV1($settings, $entryAttributes, $entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's then in &lt;code&gt;sendShowToRmsV1&lt;/code&gt; that I need to do &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)&lt;/code&gt; and prevent it from running the plugin all over again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4174" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-27T15:30:52.663" Title="Detaching onSaveEntry events from craft()-&gt;entries-&gt;saveEntry($entry)?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;yii&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12125" PostTypeId="1" CreationDate="2015-10-27T14:00:57.477" Score="1" ViewCount="96" Body="&lt;p&gt;As title says, I have a URL which I need to call when someone clicks on &lt;code&gt;delete&lt;/code&gt; button. I already have a primary key which I need to set and append in delete URL. How'd I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AXs5y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AXs5y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rows are being generated as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if posts is defined %}&#xA;    {% for post in posts %}&#xA;        {% set rows = rows|merge([&#xA;        [&#xA;            post['scheduledTime'],&#xA;            post['URL']&#xA;        ]&#xA;        ])&#xA;    %}&#xA;        {% set index = index+1 %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="22" LastEditDate="2017-05-09T23:12:29.540" LastActivityDate="2017-05-09T23:12:29.540" Title="How to set url of delete button of editableTableField?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12126" PostTypeId="2" ParentId="12125" CreationDate="2015-10-27T14:36:34.917" Score="2" Body="&lt;p&gt;Because the table saves the inputs as JSON they are not individually deleted from the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way the table works is, when you click a delete button javascript removes those inputs for each cell from the form. When the user saves the form it saves the updated cells as JSON, if there are any.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if you are saving each row individually then I would listen for the click of the delete button. When clicked, grab your id, then call your plugin action method for delete by using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest('pluginname/controller/deleteMethod', {params:value}, function(data){ &#xA;   &quot;do stuff if needed…&quot;; &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-27T14:36:34.917" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12127" PostTypeId="2" ParentId="12119" CreationDate="2015-10-27T15:15:17.497" Score="1" Body="&lt;p&gt;Instead of using &lt;code&gt;{% if page.pageIntroText|length %}&lt;/code&gt; have you tried &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if page.pageIntroText is not empty %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="831" LastEditDate="2015-10-27T15:31:21.873" LastActivityDate="2015-10-27T15:31:21.873" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12128" PostTypeId="2" ParentId="12094" CreationDate="2015-10-27T15:25:08.420" Score="1" Body="&lt;p&gt;You can access the dynamic variables in your custom fields using single curly brace syntax:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Title: &lt;code&gt;{title}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;URL: &lt;code&gt;{url}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Author Name: &lt;code&gt;{author.fullName}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Author Email: &lt;code&gt;{author.email}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is a longer discussion on &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/dynamic-values#using-dynamic-values-in-your-notification-entry-fields&quot; rel=&quot;nofollow&quot;&gt;Dynamic Values&lt;/a&gt; in the docs.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-10-27T15:25:08.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12129" PostTypeId="2" ParentId="12120" CreationDate="2015-10-27T15:27:40.977" Score="2" Body="&lt;p&gt;One option is to use the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#tags-onBeforeSaveTag&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveTag&lt;/a&gt; event to capture the tag before it is saved. You can then use PHP's &lt;code&gt;strtolower&lt;/code&gt; to normalize all of your tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a plugin's main file, your &lt;code&gt;init()&lt;/code&gt; function should have something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('tags.onBeforeSaveTag', function(Event $event) {&#xA;        $event-&amp;gt;params['tag']-&amp;gt;title = strtolower($event-&amp;gt;params['tag']-&amp;gt;title);&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2015-10-27T15:27:40.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12130" PostTypeId="1" AcceptedAnswerId="12168" CreationDate="2015-10-27T16:13:37.753" Score="2" ViewCount="1611" Body="&lt;p&gt;Trying to set-up a Craft site on a local environment. The site is currently live and functions well on prod. On the local environment, the site seems to work fine, except that every time I try to access an admin page, I get the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Runtime&#xA;&#xA;Variable &quot;entry&quot; does not exist in &quot;layouts/main/_layout&quot; at line 29 (C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php:332)&#xA;&#xA;#0 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\b3\54\0e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b.php(47): Twig_Template-&amp;gt;getContext(Array, 'entry')&#xA;#1 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_b3540e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b-&amp;gt;doDisplay(Array, Array)&#xA;#2 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#3 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\95\c9\45c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe.php(26): Twig_Template-&amp;gt;display(Array, Array)&#xA;#4 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_95c945c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe-&amp;gt;doDisplay(Array, Array)&#xA;#5 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#6 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(264): Twig_Template-&amp;gt;display(Array)&#xA;#7 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Environment.php(292): Twig_Template-&amp;gt;render(Array)&#xA;#8 C:\wamp\www\stage\craft\app\services\TemplatesService.php(220): Twig_Environment-&amp;gt;render('404', Array)&#xA;#9 C:\wamp\www\stage\craft\app\controllers\BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&#xA;#10 C:\wamp\www\stage\craft\app\controllers\TemplatesController.php(203): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&#xA;#11 C:\wamp\www\stage\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#12 C:\wamp\www\stage\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#13 C:\wamp\www\stage\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#14 C:\wamp\www\stage\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#15 C:\wamp\www\stage\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#16 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(331): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#17 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(204): CErrorHandler-&amp;gt;render('error', Array)&#xA;#18 C:\wamp\www\stage\craft\app\etc\errors\ErrorHandler.php(128): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#19 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(129): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#20 C:\wamp\www\stage\craft\app\framework\base\CApplication.php(732): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#21 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#22 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the layouts/main/_layouts code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Layout template&#xA; # ---------------&#xA; #&#xA; # This template defines your site�s global layout. It can be&#xA; # �extended� by other templates to fill in the gaps.&#xA; #&#xA; # See Twig�s Template Inheritance documentation for more details:&#xA; # http://twig.sensiolabs.org/doc/templates.html#template-inheritance&#xA; #}&#xA;&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en-US&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  &amp;lt;meta charset=&quot;utf-8&quot; /&amp;gt;&#xA;  &amp;lt;!--[if IE]&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot; /&amp;gt;&#xA;  &amp;lt;![endif]--&amp;gt;&#xA;&#xA;  &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&amp;gt;&#xA;  &amp;lt;meta property=&quot;og:locale&quot; content=&quot;en_US&quot; /&amp;gt;&#xA;  &amp;lt;meta property=&quot;og:type&quot; content=&quot;website&quot; /&amp;gt;&#xA;&#xA;  {% block meta %}{% endblock %}&#xA;&#xA;  &amp;lt;head profile=&quot;http://www.w3.org/2005/10/profile&quot;&amp;gt;&#xA;  &amp;lt;link rel=&quot;icon&quot; type=&quot;image/png&quot; href=&quot;{{ seo.favicon[0].getUrl() }}&quot;&amp;gt;&#xA;&#xA;  {% if entry.canonicalUrl %}&#xA;    &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ entry.canonicalUrl }}&quot; /&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  &amp;lt;title&amp;gt;{% if entry.pageTitle %}{{ entry.pageTitle | raw }}{% else %}{{ entry.title | raw }}{% endif %}&amp;lt;/title&amp;gt;&#xA;  &amp;lt;meta name=&quot;description&quot; content=&quot;{% if entry.seoDescription is defined %}{{ entry.seoDescription }}{% else %}{{ seo.seoDescription }}{% endif %}&quot; /&amp;gt;&#xA;  &amp;lt;meta name=&quot;keywords&quot; content=&quot;{% if entry.seoKeywords is defined %}{{ entry.seoKeywords }}{% else %}{{ seo.seoKeywords }}{% endif %}&quot; /&amp;gt;&#xA;&#xA;  &amp;lt;link rel=&quot;home&quot; href=&quot;{{ siteUrl }}&quot; /&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{ craft.bust.er('/lib/css/dev/base.css') }}&quot;&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;    &amp;lt;link href=&quot;{{ craft.bust.er('/lib/css/parallax.css') }}&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; data-skrollr-stylesheet /&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;  &amp;lt;!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --&amp;gt;&#xA;  &amp;lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&amp;gt;&#xA;  &amp;lt;!--[if lt IE 9]&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ craft.bust.er('/lib/js/ie8.min.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;  &amp;lt;![endif]--&amp;gt;&#xA;&#xA;  &amp;lt;!-- SHARING --&amp;gt;&#xA;  {% if entry is defined %}&#xA;&#xA;    {% if entry.sharingText %}&#xA;      {% set description = entry.sharingText %}&#xA;    {% elseif entry.seoDescription %}&#xA;      {% set description = entry.seoDescription %}&#xA;    {% else %}&#xA;      {% if entry.section == 'blogPosts' %}&#xA;        {% set description = entry.entryContent | trimit(600) %}&#xA;      {% elseif socialMedia.sharingText %}&#xA;        {% set description = socialMedia.sharingText %}&#xA;      {% elseif seo.seoDescription %}&#xA;        {% set description = seo.seoDescription %}&#xA;      {% else %}&#xA;        {% set description = '' %}&#xA;      {% endif %}&#xA;    {% endif %}&#xA;&#xA;    {%if entry.pageTitle %}&#xA;      {% set title = entry.pageTitle %}&#xA;    {% else %}&#xA;      {% set title = entry.title %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;meta property=&quot;og:title&quot; content=&quot;{{ title }}&quot; /&amp;gt;&#xA;    &amp;lt;meta property=&quot;og:description&quot; content=&quot;{{ description }}&quot; /&amp;gt;&#xA;    {# SHARING IMAGE // defaults to global.  Otherwise set the block in your template #}&#xA;    {% include &quot;layouts/main/partials/_sharingImage&quot; %}&#xA;  {% endif %}&#xA;    &amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ entry.Url }}&quot; /&amp;gt;&#xA;&#xA;&amp;lt;!-- Start Visual Website Optimizer Asynchronous Code --&amp;gt;&#xA;&amp;lt;script type='text/javascript'&amp;gt;&#xA;var _vwo_code=(function(){&#xA;var account_id=126816,&#xA;settings_tolerance=2000,&#xA;library_tolerance=2500,&#xA;use_existing_jquery=false,&#xA;// DO NOT EDIT BELOW THIS LINE&#xA;f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&amp;amp;u='+encodeURIComponent(d.URL)+'&amp;amp;r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();&#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;!-- End Visual Website Optimizer Asynchronous Code --&amp;gt;&#xA;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body class=&quot;craft page-{{ craft.request.lastSegment() }} section-{{ craft.request.firstSegment() }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- Google Tag Manager --&amp;gt;&#xA;&amp;lt;noscript&amp;gt;&amp;lt;iframe src=&quot;//www.googletagmanager.com/ns.html?id=GTM-5N2WB8&quot;&#xA;height=&quot;0&quot; width=&quot;0&quot; style=&quot;display:none;visibility:hidden&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/noscript&amp;gt;&#xA;&amp;lt;script&amp;gt;(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':&#xA;new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],&#xA;j=d.createElement(s),dl=l!='dataLayer'?'&amp;amp;l='+l:'';j.async=true;j.src=&#xA;'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);&#xA;})(window,document,'script','dataLayer','GTM-5N2WB8');&amp;lt;/script&amp;gt;&#xA;&amp;lt;!-- End Google Tag Manager --&amp;gt;&#xA;&#xA;&amp;lt;div&amp;gt;&#xA;&#xA;  {# COOKIE NOTIFICATION FOR EU USERS - Hidden by default.  Ajax call to /api/showCookieNotification.html may cause this to appear if user is visiting site for first time in EU (uses session cookie) #}&#xA;  &amp;lt;div id=&quot;cookieNotice&quot; class=&quot;alert alert-success alert-dismissible&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot;&amp;gt;&amp;lt;span aria-hidden=&quot;true&quot;&amp;gt;&amp;amp;times;&amp;lt;/span&amp;gt;&amp;lt;span class=&quot;sr-only&quot;&amp;gt;Close&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;          {{ default.cookieNotice }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  {% include &quot;layouts/main/partials/_mainNav.html&quot; %}&#xA;&#xA;  &amp;lt;div id=&quot;skrollr-body&quot;&amp;gt;&#xA;&#xA;      {% set _layout = block('layout') %}&#xA;      {% if _layout is not empty %}&#xA;          {{ _layout|raw }}&#xA;       {% else %}&#xA;&#xA;          {% block content %}&#xA;            &amp;lt;p&amp;gt;If you see me, you haven�t set your &amp;lt;code&amp;gt;{% verbatim %}{% block content %}�{% endblock %}{% endverbatim %}&amp;lt;/code&amp;gt; yet.&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;See Twig�s &amp;lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#template-inheritance&quot;&amp;gt;Template Inheritance&amp;lt;/a&amp;gt; documentation for an explanation.&amp;lt;/p&amp;gt;&#xA;          {% endblock %}&#xA;&#xA;&#xA;      {% endif %}&#xA;&#xA;      {% include &quot;layouts/main/partials/_mobileNav.html&quot; %}&#xA;&#xA;      {% include &quot;layouts/main/partials/_footerNav.html&quot; %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&amp;lt;!-- END #skrollr-body --&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;{{ craft.bust.er('/lib/js/dev/vendor.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;  &amp;lt;script type=&quot;text/javascript&quot; defer=&quot;defer&quot; src=&quot;//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53a9b2ec75518a77&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&#xA;  &amp;lt;!-- TYPEKIT --&amp;gt;&#xA;  &amp;lt;script src=&quot;//use.typekit.net/nfj8gcg.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;  &amp;lt;script&amp;gt;try{Typekit.load();}catch(e){}&amp;lt;/script&amp;gt;&#xA;&#xA;  {{ getFootHtml() }}&#xA;&#xA;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;{{ craft.bust.er('/lib/js/dev/main.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what's going on here and possible fixes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2015-10-27T18:32:58.010" LastActivityDate="2015-10-29T16:13:56.543" Title="Twig Error Runtime Local Dev Environment" Tags="&lt;installation&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12131" PostTypeId="2" ParentId="12130" CreationDate="2015-10-27T18:00:31.763" Score="1" Body="&lt;p&gt;This seems like one of two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A bug in Craft&lt;/li&gt;&#xA;&lt;li&gt;A corrupt installation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Given that you're not doing anything terribly complex here, it's highly unlikely that you've uncovered an obscure bug in Craft. It's far more likely that certain files weren't downloaded properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'd recommend replacing your entire &lt;code&gt;craft/app&lt;/code&gt; folder.&lt;/strong&gt; The heart of Craft lies within that folder, simply replace it to ensure there are no corrupt file issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you may want to completely delete the contents of your &lt;code&gt;craft/storage/runtime&lt;/code&gt; folder... It's possible that you downloaded some temp files in there which are confusing your local installation.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-10-27T18:00:31.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12132" PostTypeId="2" ParentId="12130" CreationDate="2015-10-27T18:51:00.910" Score="3" Body="&lt;p&gt;The problem is that you're using an &lt;code&gt;entry&lt;/code&gt; variable in the layout template without it having actually been defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can be defensive about it everywhere you're using it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.canonicalUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can be proactive with it and set the entry to something known ahead of time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries....first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it kind of depends on the behavior you're looking for on your site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-27T18:51:00.910" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12133" PostTypeId="2" ParentId="12117" CreationDate="2015-10-27T19:18:21.600" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;Redirecting&lt;/a&gt; to the first result is simple...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if results|length == 1 %}&#xA;    {% redirect results[0].url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-10-27T19:18:21.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12134" PostTypeId="1" AcceptedAnswerId="12187" CreationDate="2015-10-27T19:53:30.380" Score="2" ViewCount="59" Body="&lt;p&gt;I've got a form creating an entry in a Bookings channel which contains two fields, an Entries field (&lt;code&gt;eventBooking&lt;/code&gt;) and a Users field (userBooking).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to get Sprout Email to send an email to the user selected in &lt;code&gt;userBooking&lt;/code&gt;. Can anyone help me with the correct syntax please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following which don't seem to work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ userBooking.first().email }}&lt;/code&gt;&#xA;&lt;code&gt;{{ object.userBooking.first().email }}&lt;/code&gt;&#xA;&lt;code&gt;{{ entry.userBooking.first().email }}&lt;/code&gt;&#xA;&lt;code&gt;{ object.userBooking.first().email }&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-10-30T09:07:19.810" Title="What's the correct syntax for recipients in Sprout Email?" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12135" PostTypeId="1" CreationDate="2015-10-27T21:44:27.740" Score="9" ViewCount="812" Body="&lt;p&gt;I'm working on a plugin that creates auto crops of a selected image, but I am unsure of the proper steps to create and upload an image programatically. I am hoping that Local asset sources and Remote asset sources can be treated the same way. If not, then I would like to create that abstraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of this at the moment is that I need to both insert the file and save an asset file record. So I am first getting a local copy of the original asset that I will create crops from via &lt;code&gt;&amp;lt;assetSource&amp;gt;-&amp;gt;getLocalCopy()&lt;/code&gt;, and using that local path with  &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works well if I use a Local asset source to store my cropped images. However, when storing my crops on Rackspace, I run into an issue where a naming conflict is not resolved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calling &lt;code&gt;insertFileByLocalPath()&lt;/code&gt; with &lt;code&gt;AssetConflictResolution::Replace&lt;/code&gt;. I've noticed that &lt;code&gt;fileId&lt;/code&gt; is not set in &lt;code&gt;BaseAssetSourceType-&amp;gt;insertFileByPath()&lt;/code&gt; until the response is successful, which won't happen while there is a naming conflict. Instead the response returns back to &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath()&lt;/code&gt;, which then tries to access &lt;code&gt;fileId&lt;/code&gt; via &lt;code&gt;$response-&amp;gt;getDataItem('fileId')&lt;/code&gt; which has not been set. I then get an error stating:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fatal error: Call to a member function getFolder() on null in AssetsService on line 1334&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The failure occurs in AssetService &lt;code&gt;_mergeUploadedFiles()&lt;/code&gt; after trying to &lt;code&gt;getFileById()&lt;/code&gt; where the id is null, and then calling &lt;code&gt;getFolder()&lt;/code&gt; on null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if this is the best place to put this, if this a bug within Craft, or if I am going about creating and uploading Assets in the wrong way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are my steps to upload images correct thus far? Can all asset sources be treated in the same way? Any guidance or critique would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-23T14:55:51.823" Title="How do I upload images programmatically?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;sources&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12136" PostTypeId="2" ParentId="11469" CreationDate="2015-10-27T23:38:51.607" Score="1" Body="&lt;p&gt;You can pull data from entries by specifying a locale.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.entries.section('yourSection').locale('en_us') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Determine the locale you need by the custom segment. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = {  'wetter': 'de', 'weather' : 'en_us' } %}&#xA;{% set segment = craft.request.firstSegment() %}&#xA;{% set entries = craft.entries.section('yourSection').locale(locales[segment]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The big issue you will have is translating strings for each language.  If you are not at &lt;strong&gt;domain.com/de&lt;/strong&gt;, I believe, you won't receive the benefits of the translation files in &lt;em&gt;Craft/Translations&lt;/em&gt;. You will need to build in your own mechanism to translate strings depending on the segment.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-27T23:38:51.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12137" PostTypeId="1" AcceptedAnswerId="12139" CreationDate="2015-10-28T01:08:36.253" Score="1" ViewCount="87" Body="&lt;p&gt;I am building a site for a martial arts school. I want to add a repeating schedule to the site from Monday through Saturday so the user can edit classes and times when needed. What would be the best way to do this? Should I use a global, structure or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="936" LastActivityDate="2015-10-28T07:55:56.600" Title="Building a Class Schedule" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12139" PostTypeId="2" ParentId="12137" CreationDate="2015-10-28T07:50:42.017" Score="1" Body="&lt;p&gt;For the field type you could use a &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt; field, with columns for the times, the class and the teacher. For the class and teacher column you could consider using an Entries or Categories field, this makes sure the classes are named consistently and you could have links to the classes' description or the teacher's about page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would probably create one of these Super Table fields for each weekday and just list them one below the other in your entry type or global set. Is there mulitple rooms or any other reasons to create multiple schedules, than have them in a channel section (ordered by title) or a structure. This could also be handy in case you want to store schedules for each year or season. The user could create the upcoming schedule and it automatically becomes active with the start or the new season (set an expiry date and always pick the latest entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example for school classes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Uct6b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uct6b.png&quot; alt=&quot;Schedule with Super Table field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-28T07:55:56.600" LastActivityDate="2015-10-28T07:55:56.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12140" PostTypeId="1" CreationDate="2015-10-28T09:12:10.690" Score="4" ViewCount="211" Body="&lt;p&gt;This is blowing my mind!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have a Section with handle &lt;em&gt;practiceAreas&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I have a Section with handle &lt;em&gt;barristers&lt;/em&gt; with approximately 100&#xA;entries.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;barristers&lt;/em&gt; has an Entries fieldType called &lt;em&gt;specialisms&lt;/em&gt; which is linked to the &lt;em&gt;practiceAreas&lt;/em&gt; Section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the Barristers page I initially list ALL of the &lt;em&gt;barristers&lt;/em&gt; entries, but I need to add a filter which lists the &lt;em&gt;practiceAreas&lt;/em&gt; so when I user selects a specific Practice entry the page refreshes to show only the Barristers related to that particular practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing this is done by adding an entry ID parameter to the URL when the user selects a Practice and then only pulling back the Barristers related to that ID when the page refreshes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know where to even start with this :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2015-10-28T10:29:47.627" Title="Filter entries on a page based on related entry" Tags="&lt;relations&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12141" PostTypeId="2" ParentId="12140" CreationDate="2015-10-28T10:23:04.817" Score="2" Body="&lt;p&gt;You can conditionally add parameters to your criteria model. Check if there's a &quot;area&quot; parameter in your query string, e.g. &lt;a href=&quot;http://example.com/barristers?area=7&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/barristers?area=7&lt;/a&gt; before adding the filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set barristers = craft.entries.section('barristers').limit(null) %}&#xA;&#xA;{% set query = craft.request.getQuery() %}&#xA;&#xA;{% if query.area is defined %}&#xA;    {% set areaIds = craft.entries.section('practiceAreas').id(query.area).ids() %}&#xA;    {% set barristers = barristers.relatedTo({ targetElement: areaIds }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case you need to add more than one &lt;code&gt;relatedTo&lt;/code&gt; condition, have a look at this discussion:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/q/11870/125&quot;&gt;Dynamic relatedTo queries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-10-28T10:29:47.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12142" PostTypeId="2" ParentId="10344" CreationDate="2015-10-28T11:11:53.097" Score="1" Body="&lt;p&gt;It's &lt;s&gt;not documented&lt;/s&gt;, but it looks like there's both, a &lt;code&gt;slug&lt;/code&gt; property for tags and also a &lt;code&gt;slug&lt;/code&gt; parameter for the &lt;code&gt;craft.tags&lt;/code&gt; criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagSlugs = 'one,two,three'|split(',') %}&#xA;&#xA;{% set tags = craft.tags.slug(tagSlugs) %}&#xA;&#xA;{% for tag in tags %}&#xA;    {{ tag.slug }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br&gt;&#xA;Both the &lt;code&gt;slug&lt;/code&gt; property and the param are now mentioned in the Craft docs.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-05-05T19:57:43.143" LastActivityDate="2017-05-05T19:57:43.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12143" PostTypeId="1" CreationDate="2015-10-28T12:22:59.770" Score="2" ViewCount="512" Body="&lt;p&gt;I'm experiencing weird cookie/redirect issues after logging in the admin/cp. Keeps redirecting to / (even on /) untill I've deleted my cookies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clean download/install, no errors occured. I have no idea what to check:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;clean download of latest version 2.4.2700, no changes&lt;/li&gt;&#xA;&lt;li&gt;different domain/hosting tested, still redirect occurs&lt;/li&gt;&#xA;&lt;li&gt;different browsers tested, same results&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Pulling my hair out here, any suggestions/ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- edit&#xA;It has to be a cookie/session related issue, but all paths are 'normal'. Using CentOS with cPanel, all up to date&lt;/p&gt;&#xA;" OwnerUserId="4114" LastEditorUserId="4114" LastEditDate="2015-10-28T15:49:41.023" LastActivityDate="2016-08-16T21:33:58.097" Title="Craft redirect loop after logging in" Tags="&lt;control-panel&gt;&lt;redirect&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12144" PostTypeId="1" CreationDate="2015-10-28T14:16:40.407" Score="1" ViewCount="165" Body="&lt;p&gt;How would you make portions of Craft available to only people that are &quot;on the domain&quot; and then let the rest of it be public facing? Would you need two instances of craft on 2 servers? One which is accessible only from &quot;inside&quot; and another that the public can access?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this entail running Craft on one webserver and the front-end on another? This way the webserver with craft on it is only accessed internally but the front-end can be accessed outside?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: I only want CP to be accessed by people who are logged in and on the work network. For security reasons a simple login is not enough.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="22" LastEditDate="2017-05-09T23:11:56.197" LastActivityDate="2017-05-09T23:11:56.197" Title="Craft pieces accessed by people on domain only" Tags="&lt;config&gt;&lt;security&gt;&lt;aws&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12145" PostTypeId="2" ParentId="12144" CreationDate="2015-10-28T14:26:00.930" Score="2" Body="&lt;p&gt;The back end of craft (admin log in section or Control Panel) can only be accessed by admins and users that an admin has added. The front end will always be visible to everyone while the backend will be password protected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want separate front end displays for people who have usernames and passwords and those who dont, you could add a front end log in form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And display one set of templates for those who are logged in and another for those who arent logged in via conditional statements e.g. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% if currentUser %} &#xA;  Protected info &#xA;{% else %} &#xA;  public Info &#xA;{% endif %} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this isn't quite the answer you're looking for could you be slightly more specific with what you mean by &quot;on the domain&quot;. Describe exactly what you're looking to achieve. &lt;/p&gt;&#xA;" OwnerUserId="4033" LastActivityDate="2015-10-28T14:26:00.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12146" PostTypeId="2" ParentId="12144" CreationDate="2015-10-28T15:36:14.367" Score="0" Body="&lt;p&gt;Assuming your network is behind a router that's setup for DHCP that's handing out a block of IP addresses (typically &lt;code&gt;192.168.xxx.xxx&lt;/code&gt;), you could protect pages using &lt;code&gt;craft.request.getIpAddress()&lt;/code&gt; and checking that it's within your allowed IP range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that's not the most secure method in the world given that it's fairly trivial to spoof the IP address headers on a request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if your network has a central login authority (like an Active Directory server), then you're looking at creating a Craft plugin that authenticates with something like LDAP to provide proper authentication/authorization for areas of your site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-28T15:36:14.367" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12147" PostTypeId="1" AcceptedAnswerId="12150" CreationDate="2015-10-28T17:25:08.660" Score="1" ViewCount="144" Body="&lt;p&gt;I have a category input. The category group has two levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kUdoy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUdoy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When accessing the category input via Twig I am trying to only grab sub categories the user selected.  However when I use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstCat = entry.categoryInput.first %}&#xA;{% set cats = firstCat.getDescendants() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;code&gt;children&lt;/code&gt; it grabs all the descendants from &lt;em&gt;Categories &gt; Group&lt;/em&gt; not just from the structure that was selected from the input.  &lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="125" LastEditDate="2015-10-28T18:52:18.917" LastActivityDate="2015-10-28T19:17:28.587" Title="Use only the sub categories from a category input" Tags="&lt;templating&gt;&lt;categories&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12148" PostTypeId="1" CreationDate="2015-10-28T17:49:20.727" Score="1" ViewCount="946" Body="&lt;p&gt;I'm trying to setup a page where the html will be copied into Mailchimp for a newsletter. The images need to have a full path url. How would I construct the code to provide this? So instead of &quot;/images/something.jpg&quot; it would be &quot;&lt;a href=&quot;http://domain.com/images/something.jpg&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/images/something.jpg&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageTransform = { width: 520, height: 240 } %}&#xA;{% for image in entry.headerPhoto %} &#xA; &amp;lt;img src=&quot;{{ image.getUrl(imageTransform) }}&quot;  alt=&quot;{{ entry.title }}&quot; style=&quot;display:block;&quot; &amp;gt;   &#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there is text inside rich text fields is there any way to output the full url to those images too? &lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-10-28T19:32:10.850" Title="Full url to image transform" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12149" PostTypeId="2" ParentId="12147" CreationDate="2015-10-28T18:49:38.080" Score="2" Body="&lt;p&gt;You could set the &lt;code&gt;level&lt;/code&gt; parameter according to your requirements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = craft.categories({&#xA;    relatedTo: {&#xA;        sourceElement: entry,&#xA;        field: 'categoryInput'&#xA;    },&#xA;    level: 2,&#xA;    limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-28T18:49:38.080" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12150" PostTypeId="2" ParentId="12147" CreationDate="2015-10-28T19:17:28.587" Score="0" Body="&lt;p&gt;@carlcs helped me stumble upon a solution. Using the &lt;code&gt;.level(2)&lt;/code&gt; method gave the desired result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set cats =  entry.categoryInput.level(2) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-28T19:17:28.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12151" PostTypeId="2" ParentId="12148" CreationDate="2015-10-28T19:32:10.850" Score="2" Body="&lt;p&gt;Changing the Settings &gt; Assets &gt; Sources url fixed the problem globally. Thanks for the help, aran. &lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2015-10-28T19:32:10.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12152" PostTypeId="1" AcceptedAnswerId="12155" CreationDate="2015-10-28T20:38:34.023" Score="1" ViewCount="226" Body="&lt;p&gt;I am sure this must be answered somewhere and I cannot find it.  I need to grab all images from a section (&lt;strong&gt;channel&lt;/strong&gt;) and display them in a slide show on the index page (index page is a &lt;strong&gt;single&lt;/strong&gt;,so index page of the entries from that section). I just cannot seem to get this correct.  Here is what I am trying &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set storyItem = craft.entries.section('stories').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so stories is the section where the entries are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for previewImage in storyItem.slideshowImage.offset(1) %} &#xA; ...&#xA;{% for previewImage in storyItem.slideshowImage.limit(1) %} &#xA;...&#xA;{% for previewImage in storyItem.slideshowImage.offset(1) %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The limit and offset are just to make the slider I have work and that does work on another page so that does not seem to be what is stopping me here.  I am somewhat new to craft and my gut is telling me this is a simple answer but I have been stuck on it for a while now and coming back to it off and on to no avail.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="22" LastEditDate="2017-05-09T23:10:47.440" LastActivityDate="2017-05-09T23:10:47.440" Title="How to grab all images from and section" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12153" PostTypeId="1" CreationDate="2015-10-28T20:50:49.887" Score="2" ViewCount="903" Body="&lt;p&gt;I am using (and have used) &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6837/building-a-simple-search-by-multiple-categories&quot;&gt;this S.O&lt;/a&gt; post to create a product filter/search using multiple categories. Everything is working perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am attempting to use the same type of logic to grab ultimately a single entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I am trying to get a single entry via 2 url segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I am close, but what I am generating for a query isn't quite spot on as I'm always getting into my &quot;No Products&quot; clause.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/products/toys/my-awesome-toy&#xA;&#xA;{% set category = craft.request.getSegment(2) %}  {# toys #}&#xA;{% set product = craft.request.getSegment(3) %}   {# my-awesome-toy #}&#xA;&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{% if category|length %}&#xA;    {% set cat = craft.categories.group('toys').slug(category).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: cat }]) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; is outputting &lt;code&gt;Toys&lt;/code&gt; and my page renders all entries that belong to the &lt;code&gt;Toys&lt;/code&gt; category group. &lt;strong&gt;Perfect&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product|length %}&#xA;    {% set prod = craft.entries.slug(craft.request.getSegment(3)).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: prod }]) %}&#xA;{% endif %}&#xA;&#xA;{% set entry = craft.entries.relatedTo(relationParam).first() %}&#xA;&#xA;{% if entry %}&#xA;    {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No products found.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;prod&lt;/code&gt; is outputting &lt;code&gt;My Awesome Toy&lt;/code&gt; and now I am getting my &quot;No products found&quot; message. I think it's because &lt;code&gt;prod&lt;/code&gt; is outputting &lt;code&gt;My Awesome Toy&lt;/code&gt; vs. &lt;code&gt;my-awesome-toy&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize I can get any entry via it's slug alone. I am using a dynamic route to create this page that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;products/tag/slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to get the entry strictly based on the url segments that way I can make sure my urls are valid. Meaning, I can only find &quot;My Awesome Toy&quot; from the &quot;toys&quot; category. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/products/toys/my-awesome-toy   {# valid #}&#xA;www.mysite.com/products/food/my-awesome-toy   {# invalid #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-10-30T08:55:23.617" Title="How can I get an entry based on category and slug (via url segments)?" Tags="&lt;relations&gt;&lt;url&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12154" PostTypeId="1" CreationDate="2015-10-28T21:17:46.057" Score="1" ViewCount="153" Body="&lt;p&gt;I can get a list of option labels available in a dropdown field using the code below.  Is there a way to get a list of option labels that have been assigned to entries in a specific section? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cocktailTypes in craft.fields.getFieldByHandle('cocktails').getFieldType.options %}&#xA;    &amp;lt;p&amp;gt;{{ cocktailTypes.label }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-11-29T09:38:14.793" Title="Find Dropdown Option Labels That Are Assigned in a Section" Tags="&lt;fieldtypes&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12155" PostTypeId="2" ParentId="12152" CreationDate="2015-10-28T22:28:50.913" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I need to grab all images from a section and display them in a slide show on the index page.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'll need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Loop through all of your story entries.&lt;/li&gt;&#xA;&lt;li&gt;Grab the image from each story.&lt;/li&gt;&#xA;&lt;li&gt;Compile those into a Twig array.&lt;/li&gt;&#xA;&lt;li&gt;Create your slideshow as needed.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's how that all ties together...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set storyItems = craft.entries.section('stories').find() %}&#xA;&#xA;{% set previewImages = [] %}&#xA;&#xA;{% for item in storyItems %}&#xA;    {% set currentImage = item.slideshowImage.first() %}&#xA;    {% set previewImages = previewImages | merge(currentImage) %}&#xA;{% endfor %}&#xA;&#xA;{# RENDER YOUR SLIDESHOW FROM previewImages #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll need to initialize the &lt;code&gt;previewImages&lt;/code&gt; array before beginning the &lt;code&gt;for&lt;/code&gt; loop... Loops in Twig have their own scope.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The limit and offset are just to make the slider I have work...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure exactly what you're trying to do with the &lt;code&gt;offset&lt;/code&gt;, but I'd recommend manipulating your images array in Twig (as opposed to fancy queries to target specific images).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-10-28T22:28:50.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12156" PostTypeId="1" CreationDate="2015-10-28T22:29:00.883" Score="1" ViewCount="46" Body="&lt;p&gt;Does craft save a temporary ID for an asset transform? If so, how do you access it. The ID would be used in a plugin on form submit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in imageLibrary %}&#xA;    &amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;        {%- set image = entry.asset.first() -%}&#xA;        &amp;lt;input name=&quot;file&quot; value=&quot;{{ image.getUrl(param).id }}&quot; &amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="788" LastEditorUserId="57" LastEditDate="2015-10-28T22:38:06.217" LastActivityDate="2015-10-28T22:38:06.217" Title="ID for transformed asset" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12157" PostTypeId="1" CreationDate="2015-10-29T02:10:13.970" Score="2" ViewCount="236" Body="&lt;p&gt;I was using this code in the past and it worked well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set assets = craft.assets.limit(null) %}&#xA;        {% set entries = craft.entries.section('menu').limit(3).order('RAND()').relatedTo({&#xA;            targetElement: assets,&#xA;            field: 'assets'&#xA;        }) %}&#xA;&#xA;        {% for item in entries %}&#xA;                {% set i = item.assets.first() %}&#xA;&#xA;                &amp;lt;img width=&quot;{{ i.getWidth('medium') }}&quot; height=&quot;{{ i.getHeight('medium') }}&quot; src=&quot;{{ i.getUrl('medium') }}&quot; alt=&quot;{{ recipe.title }}&quot; /&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in the new version the standalone &quot;assets&quot; field became a part of the matrix field so this piece of code doesn't work anymore. Please advise :)&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2015-10-29T03:39:10.980" Title="Sort by Matrix Field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12158" PostTypeId="1" AcceptedAnswerId="12159" CreationDate="2015-10-29T02:48:56.830" Score="2" ViewCount="414" Body="&lt;p&gt;We have a matrix field for weekly winners names in a company promotion. We've entered 199 so far, the 200th is not saving, it blanks out the fields and logs a validation error - cannot save because name is blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we delete item 199 then we can add a new item, it then fails on item 200 again&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a known limit in craft matrix fields??&lt;/p&gt;&#xA;" OwnerUserId="3673" LastActivityDate="2015-10-29T03:09:30.447" Title="Matrix field not saving 200th entry" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12159" PostTypeId="2" ParentId="12158" CreationDate="2015-10-29T03:09:30.447" Score="2" Body="&lt;p&gt;Take a look here, it sounds like you are hitting the max_input_vars limit. Strange things happen when you do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2765/matrix-field-input-error-from-within-the-control-panel&quot;&gt;Matrix field input error from within the control panel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-10-29T03:09:30.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12160" PostTypeId="2" ParentId="12157" CreationDate="2015-10-29T03:39:10.980" Score="1" Body="&lt;p&gt;You can access the assets field by referencing the matrix field first. &lt;code&gt;myMatrixFieldHandle.assets&lt;/code&gt;.  So your entries code would be something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('menu').limit(3).order('RAND()').relatedTo({&#xA;       targetElement: assets,&#xA;       field: 'myMatrixFieldHandle.assets'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-29T03:39:10.980" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12161" PostTypeId="2" ParentId="12144" CreationDate="2015-10-29T04:09:44.933" Score="0" Body="&lt;p&gt;I'm assuming the web server is &quot;local&quot; and sits behind the firewall with the rest of the NAT'd work group? Depending on what pages you need to limit access, you could lock it down at the NAT/server level.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were me, I'd do something like &lt;code&gt;companyintranet.whatever.com&lt;/code&gt; and use Craft's routing to set up the company only pages (on say a separate structure section). That way, they don't get accidentally mingled in with the rest of the public facing pages. As long as all pages point back to a single CP instance, that's &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement&quot; rel=&quot;nofollow&quot;&gt;covered&lt;/a&gt; on Craft's license.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-10-29T04:09:44.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12162" PostTypeId="2" ParentId="2519" CreationDate="2015-10-29T07:26:26.330" Score="3" Body="&lt;p&gt;You can track the number of times a file has been downloaded using the &lt;a href=&quot;https://github.com/verbb/asset-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Count&lt;/a&gt; plugin by Verbb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the readme shows, rather than linking directly to your files, you’d point the link to the plugin’s controller action:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl('asset-count/count', { id: file.id }) }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="632" LastEditDate="2020-01-12T06:06:13.450" LastActivityDate="2020-01-12T06:06:13.450" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12163" PostTypeId="1" CreationDate="2015-10-29T10:18:30.617" Score="1" ViewCount="368" Body="&lt;p&gt;How to retrieve the postDate of an entry in a different language than the CP.&#xA;In the general config settings i have the following,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'defaultCpLanguage' =&amp;gt; 'en'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i would like to display the dates in the frontend in a different language. As in translated month names. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the following with no result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {{ entry.postDate | date(&quot;d/F/y&quot;, &quot;Europe/Paris&quot;) }}&#xA;    {{entry.postDate.format(&quot;d F y&quot;)}} #}&#xA;    &amp;lt;span class=&quot;date&quot;&amp;gt;{{entry.postDate | date('d F Y')}}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The format works, but there is no translation.&lt;/p&gt;&#xA;" OwnerUserId="4258" LastEditorUserId="4258" LastEditDate="2015-10-29T10:45:30.753" LastActivityDate="2015-10-29T22:31:14.913" Title="Output postDate in a different language than CP" Tags="&lt;localization&gt;&lt;control-panel&gt;&lt;language&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12164" PostTypeId="1" CreationDate="2015-10-29T11:37:35.507" Score="1" ViewCount="100" Body="&lt;p&gt;So this is proving a lot harder than I thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 'tours' section containing tours, which all have several departure dates. Those dates are in a matrix field, entry.data. So there's only one type for that matrix field, and one date picker, so that several dates can be added per entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to list entries sorted by the day they depart, so it should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;07-oct-2015&#xA;tour x&#xA;tour y&#xA;&#xA;11-oct-2015&#xA;tour x&#xA;tour z&#xA;&#xA;13-oct-2015&#xA;tour x&#xA;tour y&#xA;tour z&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since there isn't a tour departing every day, or on a set schedule, I can't just pull out entries that match a given day.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be awesome! I saw a similar post that was resolved with the low blocks plugin, but I'm hoping this can be solved natively with grouping and sorting.. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx!&lt;/p&gt;&#xA;" OwnerUserId="4113" LastActivityDate="2015-10-29T11:37:35.507" Title="Grouping entries by days in matrix field" Tags="&lt;matrix&gt;&lt;sorting&gt;&lt;group&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12165" PostTypeId="1" AcceptedAnswerId="12166" CreationDate="2015-10-29T14:32:11.597" Score="9" ViewCount="1203" Body="&lt;p&gt;Craft’s only password requirements are that it is between 6 and 160 characters long. I want to require my users to enter passwords that are at least 7 characters long, with at least one number and one capital letter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to enforce these stricter requirements, or do we have to wait for &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/10459731-better-stricter-rules-for-password-input-upon-regi&quot;&gt;this feature request&lt;/a&gt; to be accepted?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-05-07T19:20:22.443" Title="How do I enforce stronger password requirements on my Craft site?" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12166" PostTypeId="2" ParentId="12165" CreationDate="2015-10-29T14:32:11.597" Score="10" Body="&lt;p&gt;&lt;strong&gt;In Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins have the power to enforce stricter password requirements using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSetPassword&quot; rel=&quot;nofollow noreferrer&quot;&gt;users.onBeforeSetPassword&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this code to your plugin’s &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;primary class&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.beforeSetPassword', array($this, 'onBeforeSetPassword'));&#xA;}&#xA;&#xA;public function onBeforeSetPassword(Event $e)&#xA;{&#xA;    $user = $e-&amp;gt;params['user'];&#xA;    $password = $e-&amp;gt;params['password'];&#xA;&#xA;    // Perform our custom validation logic here&#xA;    $validates = true;&#xA;&#xA;    if (mb_strlen($password) &amp;lt; 7)&#xA;    {&#xA;        $validates = false;&#xA;    }&#xA;    else if (!preg_match('/(\d.*[A-Z]|[A-Z].*\d)/', $password))&#xA;    {&#xA;        $validates = false;&#xA;    }&#xA;&#xA;    if (!$validates)&#xA;    {&#xA;        // Set $performAction = false so the password doesn't get saved&#xA;        $e-&amp;gt;performAction = false;&#xA;&#xA;        // Add a custom validation error on the user&#xA;        $user-&amp;gt;addError('newPassword', 'Sorry but your password must contain an uppercase letter, a number, a haiku, a gang sign, hieroglyph, and the blood of a virgin.');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 doesn't have a &lt;code&gt;beforeSetPassword&lt;/code&gt; event, but you can pull the same thing off from your plugin's init() method using the User element's &lt;code&gt;User::EVENT_BEFORE_VALIDATE&lt;/code&gt; event like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    Event::on(&#xA;        User::class,&#xA;        User::EVENT_BEFORE_VALIDATE,&#xA;        function (ModelEvent $event) {&#xA;            // Check if a new password was set on the user&#xA;            if ($event-&amp;gt;sender-&amp;gt;newPassword) {&#xA;                $password = $event-&amp;gt;sender-&amp;gt;newPassword;&#xA;                $errors = [];&#xA;&#xA;                // Perform our custom validation logic here&#xA;                $validates = true;&#xA;&#xA;                if (mb_strlen($password) &amp;lt; 7) {&#xA;                    $validates = false;&#xA;                    $errors[] = 'Too Short!';&#xA;                }&#xA;                else if (!preg_match('/(\d.*[A-Z]|[A-Z].*\d)/', $password)) {&#xA;                    $validates = false;&#xA;                    $errors[] = 'Too Simple!';&#xA;                }&#xA;&#xA;                $event-&amp;gt;isValid = $validates;&#xA;&#xA;                if (!$validates) {&#xA;                    /** @var User $user */&#xA;                    $user = $event-&amp;gt;sender;&#xA;                    foreach ($errors as $error) {&#xA;                        $user-&amp;gt;addError('newPassword', $error);&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2018-05-07T19:20:22.443" LastActivityDate="2018-05-07T19:20:22.443" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12167" PostTypeId="1" AcceptedAnswerId="12184" CreationDate="2015-10-29T15:35:35.737" Score="1" ViewCount="158" Body="&lt;p&gt;I have a Matrix block with 2 types: quotes and text. The first block contains a quote and a text. The second and following ones only contain quotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the type text to be limited to 1 and the type quotes limited to one at a time displayed randomly.&#xA;Can't figure out how?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.intro %}&#xA;&#xA;    {% if block.type == &quot;quote&quot; %}&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;blockquote&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.quote|raw }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;footer&amp;gt;{{ block.caption }} &amp;lt;/footer&amp;gt;&#xA;            &amp;lt;/blockquote&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% elseif block.type ==&quot;text&quot; %}&#xA;        &amp;lt;div class=&quot;col-md-4 col-sm-6 mb-sm-50 mb-xs-30&quot;&amp;gt;{{ block.column1 }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4 col-sm-6 mb-sm-50 mb-xs-30&quot;&amp;gt;{{ block.column2 }}&amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="57" LastEditDate="2015-10-29T16:41:20.733" LastActivityDate="2015-10-30T08:44:42.137" Title="Random quotes in matrix block type" Tags="&lt;matrix&gt;&lt;loop&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12168" PostTypeId="2" ParentId="12130" CreationDate="2015-10-29T15:41:21.817" Score="0" Body="&lt;p&gt;The Twig runtime error was essentially answered by Brad. We used an entry variable without it having been defined for that particular element in our layout template and by adding &lt;code&gt;{% if entry is defined and entry.canonicalUrl %}&lt;/code&gt;, it fixed the issue and the Twig error went away. The reason that the message appeared on local and not on the live site is because the local site was in developer mode. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the 404 page that appeared on admin pages after fixing the issue, that seems to be a separate issue and I'll create a separate thread. Here's the thread: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12169/craft-cms-shows-404-error-on-admin-pages&quot;&gt;Craft CMS Shows 404 Error on Admin Pages&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-29T16:13:56.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12169" PostTypeId="1" AcceptedAnswerId="12209" CreationDate="2015-10-29T15:51:41.933" Score="5" ViewCount="4945" Body="&lt;p&gt;I'm trying to take a live / currently well functioning production site and create a local version. I downloaded all the files and the database and the site itself now works on my local device but whenever I try to access any of the admin pages to edit the site, I get a 404 page from Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I replaced my entire craft/app folder to help ensure no corrupt file issues and that didn't fix the problem. I also completely deleted the contents of my craft/storage/runtime folder to account for the potential download of temp files that could be confusing the local site and that didn't fix it either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The local site is running in dev mode and there is no error that shows on any of the admin pages, just a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what's going on here and possible fixes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2021-02-17T23:23:45.697" Title="Craft CMS Shows 404 Error on Admin Pages" Tags="&lt;installation&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12171" PostTypeId="1" CreationDate="2015-10-29T16:25:37.640" Score="1" ViewCount="121" Body="&lt;p&gt;I have a Rich Text Field within a Matrix block. I need to add a div around a section of content but can't do this in the template because it's within multiple Matrix blocks.  Solution would be to add it directly into the Rich Text field in code view but it strips out the div and replaces with p tags on save?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10500/div-being-replaced-by-p-tags-in-redactor-rich-text-editor&quot;&gt;this suggestion&lt;/a&gt; but it didn't work.&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-30T08:30:00.803" Title="Div being removed from Rich Text Field" Tags="&lt;matrix&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12172" PostTypeId="1" CreationDate="2015-10-29T16:39:13.100" Score="3" ViewCount="486" Body="&lt;p&gt;I can successfully get entries related the &quot;normal&quot; way, but my list of possible results are getting quite large. Currently I am returning html mixed in with the data. It's obvious I need to get just the data and parse through it on the client side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mytemplate.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paramOne = craft.request.getParam('paramOne') %}&#xA;{% set paramTwo = craft.request.getParam('paramTwo') %}&#xA;&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{% if paramOne %}&#xA;    {% set type = craft.categories.group('groupOne').slug(paramOne).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: type }]) %}&#xA;{% endif %}&#xA;&#xA;{% if paramTwo %}&#xA;    {% set type = craft.categories.group('groupTwo').slug(paramTwo).first() %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: type }]) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(relationParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not quite sure how to translate that into elementapi code (for lack of better words).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elementapi.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'myfile.json' =&amp;gt; function (??) {&#xA;            $paramOne = craft()-&amp;gt;request-&amp;gt;getPost('paramOne');&#xA;            $paramTwo = craft()-&amp;gt;request-&amp;gt;getPost('paramTwo');&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; [&#xA;                    'section' =&amp;gt; 'mysection',&#xA;                    'relatedTo' =&amp;gt; [&#xA;                        'and' // and needs to go somewhere...&#xA;                        'targetElement' =&amp;gt; ??, // This is the entry&#xA;                        'field' =&amp;gt; ?? // This is the category?&#xA;                    ],&#xA;                ],&#xA;                'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title&#xA;                    ];&#xA;                },&#xA;            ]&#xA;        }&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-10-29T17:25:22.610" LastActivityDate="2015-10-29T17:25:22.610" Title="How can I use the ElementAPI to get related entries based on two parameters?" Tags="&lt;relations&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12173" PostTypeId="2" ParentId="12163" CreationDate="2015-10-29T19:52:43.847" Score="1" Body="&lt;p&gt;If your looking to just replace month or day names you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set translations = {&#xA;    'January': 'janvier', &#xA;    'February': 'février', &#xA;    'March':'mars', &#xA;    'April':'avril'} &#xA; %}    &#xA;&#xA;{{ entry.postDate|date('d F Y')|replace(translations) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could add any amount of translations in that object.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-29T19:52:43.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12174" PostTypeId="1" AcceptedAnswerId="12175" CreationDate="2015-10-29T20:49:49.210" Score="1" ViewCount="278" Body="&lt;p&gt;Is there an event or hook we can leverage after a user verifies their email address? It looks like this is handled in &lt;code&gt;UsersController::actionVerifyEmail()&lt;/code&gt; which calls &lt;code&gt;$this-&amp;gt;_onAfterActivateUser&lt;/code&gt; which calls &lt;code&gt;$this-&amp;gt;_redirectUserAfterAccountActivation&lt;/code&gt;. The specific users being created will not have CP access, so they will be redirected to &lt;code&gt;craft()-&amp;gt;config-&amp;gt;getLocalized('activateAccountSuccessPath')&lt;/code&gt; in that method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to set a flash message to confirm the email verification and informing them they need to log in to access all of the site, but I don't see any events or hooks to tie into. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="125" LastEditDate="2015-10-29T22:51:27.180" LastActivityDate="2015-10-29T22:51:27.180" Title="Event or hook when user account email validated" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;emails&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12175" PostTypeId="2" ParentId="12174" CreationDate="2015-10-29T21:55:48.227" Score="1" Body="&lt;p&gt;There currently aren't any verification events, but if the user is in a &lt;code&gt;pending&lt;/code&gt; state (i.e. they haven't been activated yet), verification will trigger &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UsersService.php#L837&quot; rel=&quot;nofollow&quot;&gt;activation&lt;/a&gt;, which triggers the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeActivateUser&quot; rel=&quot;nofollow&quot;&gt;onBeforeActivateUser&lt;/a&gt; and &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow&quot;&gt;onActivateUser&lt;/a&gt; events. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-10-29T21:55:48.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12176" PostTypeId="2" ParentId="12163" CreationDate="2015-10-29T22:31:14.913" Score="2" Body="&lt;p&gt;It looks like you need Craft Pro and even then it's not possible&#xA;to have the CP in a language that is not installed as a front-end locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (new) &lt;code&gt;defaultCpLanguage&lt;/code&gt; setting doesn't change this. See Brad's&#xA;answers here:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/5001/125&quot;&gt;Change system language&lt;/a&gt; +&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/10576/125&quot;&gt;German locale &amp;amp; English CP language resulting in disappeared entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to help you with your date problem. It is possible to access most data from&#xA;&lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/tree/master/app/framework/i18n/data&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft/app/framework/i18n/data/&lt;/a&gt; via &lt;code&gt;craft.i18n&lt;/code&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro dateFormat(date, locale) %}&#xA;    {% set localeData = craft.i18n.getLocaleData(locale|default('de')) %}&#xA;    {{&#xA;        localeData.getWeekdayName(date|date('w')) ~ ', ' ~&#xA;        date|date('j ') ~&#xA;        localeData.getMonthName(date|date('m')) ~&#xA;        date|date(' Y')&#xA;    }}&#xA;{% endmacro %}&#xA;{% import _self as macros %}&#xA;&#xA;{% for locale in ['en', 'es', 'fr', 'de', 'ru', 'nl', 'no'] %}&#xA;    &amp;lt;li&amp;gt;{{ macros.dateFormat(now, locale) }}&amp;lt;/li&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-29T22:31:14.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12177" PostTypeId="1" CreationDate="2015-10-29T22:39:59.300" Score="2" ViewCount="219" Body="&lt;p&gt;I'm trying to get a better understanding of how to define new models in plugins, but the documentation at &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/plugins/models&lt;/a&gt; doesn't get me very far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, there is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'name' =&amp;gt; AttributeType::String,&#xA;        'type' =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; &quot;alcohol,mixer,other&quot;),&#xA;    );&#xA;}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've seen other plugins define attributes with an array element of &lt;code&gt;'required' =&amp;gt; true&lt;/code&gt;, but the only example I see here is &lt;code&gt;'values'&lt;/code&gt;. Is there somewhere I can see a list of the available options when defining attributes? Or is it a better practice to define the attributes simply and then define validation rules in the &lt;code&gt;rules()&lt;/code&gt; method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the docs say to check out the CModel documentation, but it doesn't even have defineAttributes. Does Craft itself have more in depth documentation on this topic?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="125" LastEditDate="2015-10-29T22:51:45.423" LastActivityDate="2021-01-14T13:40:55.273" Title="More extensive documentation for defining models for plugins" Tags="&lt;plugin-development&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12178" PostTypeId="2" ParentId="12177" CreationDate="2015-10-29T22:47:34.013" Score="1" Body="&lt;p&gt;Have a look at Stephen Lewis' &lt;a href=&quot;https://github.com/manifestuk/2016-10-blog-archive/blob/master/posts/2014-07-29--the-definitive-guide-to-validation-in-craft-part-1-foundations.yml&quot; rel=&quot;nofollow noreferrer&quot;&gt;archived blog article&lt;/a&gt; about validation. Even better, &lt;a href=&quot;https://leanpub.com/craft-validation&quot; rel=&quot;nofollow noreferrer&quot;&gt;buy the book&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="505" LastEditDate="2021-01-14T13:40:55.273" LastActivityDate="2021-01-14T13:40:55.273" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12179" PostTypeId="1" CreationDate="2015-10-30T03:58:20.223" Score="3" ViewCount="75" Body="&lt;p&gt;Looking for some input on how to setup a Craft site. I have 2 sections of the site containing content grouped by the same set of topics (or categories). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, within Services there 6 sub-pages. Resources has 6 sub-pages using the same categories as Services. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words there is a page under Services and Resources named Topic 1. In Services the Topic 1 page will contain a description of Topic 1. Under Resources the Topic 1 page will contain PDFs and FAQs related to Topic 1. The PDFs and FAQs would ideally be sorted by a custom order. There are similar pages under Services and Resources for Topic 2, Topic 3, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RbtNR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RbtNR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recommendations on how to set this up in Craft?&lt;/p&gt;&#xA;" OwnerUserId="476" LastActivityDate="2015-12-29T17:04:46.387" Title="Section/category setup input" Tags="&lt;sections&gt;&lt;category&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12180" PostTypeId="1" AcceptedAnswerId="12182" CreationDate="2015-10-30T04:54:44.997" Score="4" ViewCount="843" Body="&lt;p&gt;I'm not sure what is the cause for this page rendering so slow.&#xA;I thought it was the image transforms but I've removed them and still it's really slow to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page in question: &lt;a href=&quot;http://dharmaavenue.net/e-drops&quot; rel=&quot;nofollow&quot;&gt;http://dharmaavenue.net/e-drops&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the profiling report: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time:   64.61081s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Memory: 461,289Kb&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Total Queries: 52&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see it's just a simple nav menu.&#xA;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;    {% set eDrops = craft.entries.section('eDrops') %}&#xA;&#xA;    &amp;lt;nav id=&quot;linksBrowser&quot; class= &quot;ladder tree&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% nav entry in eDrops %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    {% if entry.slides|length %}&#xA;{#&#xA;                        {% set image = entry.slides.first() %}&#xA;#}&#xA;                        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt; {{ entry.title }} &amp;gt;&#xA;&#xA;{#&#xA;                        &amp;lt;img src=&quot;{{ image.getUrl('fitThumb') }}&quot;&#xA;                                width= &quot;{{ image.getWidth('fitThumb') }}&quot;&#xA;                                height= &quot;{{ image.getHeight('fitThumb') }}&quot;/&amp;gt;&#xA;#}&#xA;                        &amp;lt;/a&amp;gt;&#xA;&#xA;                    {% else %}&#xA;                        &amp;lt;span class=&quot;linkAnchor&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&#xA;                    {% endif %}&#xA;&#xA;                    {% ifchildren %}&#xA;                        &amp;lt;ul&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endifchildren %}&#xA;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/nav&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The entries are basically individual gallerys with many images in the slides field. I'm guessing that all the details of these are being fetched unecessarily, and that stopping this from happenign will solve my problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can help me with this it would be most greatful :)&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2015-10-30T08:13:26.617" Title="Optimizing pagespeed" Tags="&lt;speed&gt;&lt;optimization&gt;&lt;query&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12182" PostTypeId="2" ParentId="12180" CreationDate="2015-10-30T08:13:26.617" Score="3" Body="&lt;p&gt;Not sure how you implemented the &lt;code&gt;cache&lt;/code&gt; tags, but I would recommend to cache each &quot;eDrops&quot; entry individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also took out &lt;code&gt;{% if entry.slides|length %}&lt;/code&gt;. Testing if &lt;code&gt;entry.slides.first()&lt;/code&gt; returns anything is all you need. In order to make the length filter work, Craft internally applys &lt;code&gt;find()&lt;/code&gt; to the criteria model behind &lt;code&gt;entry.slides&lt;/code&gt;. This means you (unintentionally) added an additional database query (besides &lt;code&gt;first()&lt;/code&gt;, which you need anyways).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind, that assets are elements in Craft and relationship queries take their time (→ also explained in the Matrix field example here: &lt;a href=&quot;https://craftcms.stackexchange.com/q/59/125&quot;&gt;What are the most common template performance gotchas to avoid?&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in eDrops %}&#xA;&#xA;    {% cache globally using key 'eDrops-' ~ entry.id %}&#xA;        {% set image = entry.slides.first() %}&#xA;&#xA;        {% if image %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('fitThumb') }}&quot;&amp;gt;&#xA;        {% else %}&#xA;            {{ entry.title }}&#xA;        {% endif %}&#xA;    {% endcache %}&#xA;&#xA;    {% ifchildren %}&#xA;        {% children %}&#xA;    {% endifchildren %}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-10-30T08:13:26.617" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="12183" PostTypeId="2" ParentId="12171" CreationDate="2015-10-30T08:30:00.803" Score="1" Body="&lt;p&gt;As with most questions and problems with Redactor, the answer to this should probably be: don't do it in Redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could just add a new block type to your Matrix field that does just one thing: add the &lt;code&gt;div&lt;/code&gt; tag (or close it, if there's an open one). Another possibility is to do this all programatically, check if it is the first or the last block of a specific type and conditionally add the markup to wrap them in your div.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the discussion here, to read more about these solutions:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/q/6732/125&quot;&gt;Solution for Matrix-within-Matrix (or More Robust Table Fields)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if that's still not flexible enough, you could also have a &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt; within you Matrix (within a Super Table, within...).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-30T08:30:00.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12184" PostTypeId="2" ParentId="12167" CreationDate="2015-10-30T08:44:42.137" Score="1" Body="&lt;p&gt;You could query for your two blocks individually.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quoteBlock = entry.intro.type('quote').first() %}&#xA;{% set textBlock = entry.intro.type('text').order('RAND()').first() %}&#xA;&#xA;&amp;lt;blockquote&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ quoteBlock.quote|raw }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;footer&amp;gt;{{ quoteBlock.caption }} &amp;lt;/footer&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&#xA;&amp;lt;div&amp;gt;{{ textBlock.column1 }}&amp;lt;/div&amp;gt;&#xA;&amp;lt;div&amp;gt;{{ textBlock.column2 }}&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-30T08:44:42.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12185" PostTypeId="2" ParentId="12153" CreationDate="2015-10-30T08:55:23.617" Score="1" Body="&lt;p&gt;An entry is not related to itself, but that's what you added as a filter.&#xA;Use the &lt;code&gt;slug&lt;/code&gt; parameter instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getSegment(2) %}&#xA;{% set productSlug = craft.request.getSegment(3) %}&#xA;&#xA;{% set entries = craft.entries.section('products') %}&#xA;&#xA;{% if categorySlug|length %}&#xA;    {% set category = craft.categories.group('toys').slug(category).first() %}&#xA;    {% if category %}&#xA;        {% set entries = entries.relatedTo({ targetElement: category }) %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if productSlug|length %}&#xA;    {% set entries = entries.slug(productSlug) %}&#xA;{% endif %}&#xA;&#xA;{% set product = entries.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-30T08:55:23.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12186" PostTypeId="2" ParentId="12154" CreationDate="2015-10-30T09:04:52.310" Score="1" Body="&lt;p&gt;I think you need to loop all entries of that sections to &quot;collect&quot; them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cocktailTypes = [] %}&#xA;{% for entry in craft.entries.section('mySection') %}&#xA;    {% set cocktailTypes = cocktailTypes|merge([entry.cocktails]) %}&#xA;{% endfor %}&#xA;&#xA;{% for cocktailType in cocktailTypes|sort %}&#xA;    &amp;lt;p&amp;gt;{{ cocktailType }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-30T09:04:52.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12187" PostTypeId="2" ParentId="12134" CreationDate="2015-10-30T09:07:19.810" Score="1" Body="&lt;p&gt;This should work:&lt;br&gt;&#xA;&lt;code&gt;{{ object.userBooking.first().email }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would check if the problem is with something else.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-30T09:07:19.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12188" PostTypeId="2" ParentId="11582" CreationDate="2015-10-30T09:59:31.320" Score="2" Body="&lt;p&gt;I have done something similar to this where I needed a custom FieldType that saves its data to its own table and works inside (and outside) a Matrix Field.&#xA;The other answers with contentPostLocation might work but seem complicated to get the ids and/or data you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your FieldType is used inside a Matrix Field a different ElementType will be returned. You can check this in &lt;code&gt;$this-&amp;gt;element-&amp;gt;elementType&lt;/code&gt; and your check for MatrixBlock works nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when inside the matrix .. ;)&#xA;&lt;code&gt;$this-&amp;gt;element-&amp;gt;id&lt;/code&gt; will be the id of the MatrixBlockElement, so your BlockId.&#xA;&lt;code&gt;$this-&amp;gt;element-&amp;gt;fieldId&lt;/code&gt; will be your fieldId (the matrix's field id)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you need the actual element where this block belongs to (as I did) you can use &lt;code&gt;$this-&amp;gt;element-&amp;gt;ownerId&lt;/code&gt; to get the owner element (parent element?).&#xA;You can look at MatrixBlockElementType for more clues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saving your data in onAfterElementSave() will be the same, e.g. the following will get you the data for your Block and also when its not used as a Block (note this works because its getting the data for the Element so it doesn't care about any differences)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$fieldHandle = $this-&amp;gt;model-&amp;gt;handle;&#xA;$content = $this-&amp;gt;element-&amp;gt;getContent();&#xA;$data = $content-&amp;gt;getAttribute($fieldHandle);&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2015-10-30T09:59:31.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12189" PostTypeId="1" AcceptedAnswerId="12190" CreationDate="2015-10-30T10:49:34.500" Score="4" ViewCount="666" Body="&lt;p&gt;First some context. I'm using &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; for Craft to display some location based events in a listing. My structure is as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Events channel&lt;/li&gt;&#xA;&lt;li&gt;Locations channel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Each event can occur multiple times, so I created a matrix field for this, where they can add blocks with a time and select a location.&lt;/p&gt;&#xA;&lt;p&gt;The problem occurs when I want to filter the list of results based on the city of the location. Smartmaps &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10875/filter-locations-by-country-in-smart-map&quot;&gt;doesn't support filtering by cities&lt;/a&gt; and I do want to use pagination, so I went with the &lt;a href=&quot;https://craftcms.stackexchange.com/a/10878/3937&quot;&gt;custom plugin solution mentioned&lt;/a&gt; in that question. Unfortunately I can't comment yet on that answer, so therefore I created my new question.&lt;/p&gt;&#xA;&lt;p&gt;The problem is that Craft &lt;code&gt;{% paginate %}&lt;/code&gt; doesn't work with the &lt;code&gt;Array&lt;/code&gt; result of &lt;code&gt;EntryModel::populateModels&lt;/code&gt;. I'm getting the following error in my search results page:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So my question is, how can I modify the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to join content from different tables (in this case Smartmaps') and still return an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to be used by the Craft pagination?&lt;/p&gt;&#xA;&lt;p&gt;I also have read some more &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2763/whats-the-difference-between-elementcriteriamodel-and-dbcommand&quot;&gt;explanation about &lt;code&gt;ElementCriteriaModel&lt;/code&gt;&lt;/a&gt; and some similar issues like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11992/search-across-entries-and-assets-and-paginate&quot;&gt;this one&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2786/how-can-i-do-more-complicated-queries-with-an-elementcriteriamodel&quot;&gt;this one&lt;/a&gt;, but without any luck. Maybe there is a much simpler solution, but I'm out of options for now.&lt;/p&gt;&#xA;" OwnerUserId="3937" LastEditorUserId="45" LastEditDate="2021-01-01T06:38:21.930" LastActivityDate="2021-01-01T06:38:21.930" Title="Modify ElementCriteria and use it for paginate" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;pagination&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12190" PostTypeId="2" ParentId="12189" CreationDate="2015-10-30T11:36:55.477" Score="5" Body="&lt;p&gt;You can only modify a &lt;code&gt;craft.entries&lt;/code&gt; criteria model with a field (→ &lt;a href=&quot;https://craftcms.stackexchange.com/q/11875/125&quot;&gt;Add custom element criteria attribute without a field type?&lt;/a&gt;). So what you have to do is to create a new custom field type with your plugin, and add such a field to the entry types you want to filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').country('germany') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that criteria model you would pass the value &quot;germany&quot; to your custom field type field &quot;country&quot;. The field type would then use this parameter to modify criteria model's query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some code that should help you putting this together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;    return;&#xA;}&#xA;&#xA;public function modifyElementsQuery(DbCommand $query, $params)&#xA;{&#xA;    if ($params !== null)&#xA;    {&#xA;        craft()-&amp;gt;businessLogic-&amp;gt;addCountryCriteria($query, $params);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't want the field to show up as an input field in the edit entry view, so we let &lt;code&gt;getInputHtml()&lt;/code&gt; return null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our &lt;code&gt;modifyElementsQuery&lt;/code&gt; method we just check if there's a parameter submitted (the country), before passing the criteria model's query to the service.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCountryCriteria(DbCommand $query, $country)&#xA;{&#xA;    // Add conditons to the query &#xA;    $query-&amp;gt;andWhere($conditions, $params);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;addCountryCriteria&lt;/code&gt; service can basically stay untouched, except that you can remove &lt;code&gt;buildElementsQuery()&lt;/code&gt;, &lt;code&gt;queryAll()&lt;/code&gt; and &lt;code&gt;populateModels()&lt;/code&gt;. As you only want to modify the query.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-10-30T11:36:55.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12191" PostTypeId="1" AcceptedAnswerId="12193" CreationDate="2015-10-30T11:45:42.347" Score="2" ViewCount="845" Body="&lt;p&gt;I need a &quot;date of birth&quot; field. Out of the box, the date picker only allows moving left/right by month, which doesn't work for selecting years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to configure the date picker that Craft uses? Or is there a better way to make a date of birth chooser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2015-10-30T13:55:18.780" Title="Date picker field type - quickly select year?" Tags="&lt;field&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12192" PostTypeId="1" CreationDate="2015-10-30T11:46:34.200" Score="1" ViewCount="503" Body="&lt;p&gt;Is there a way to specify locale-specific asset paths so that uploaded images are only viewable on a per-locale basis, or would I have to set distinct assets (and ergo distinct fields) for each locale I wanted to provide uploads for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if am using locales to set a site A and a site B, can I have the same asset field declared but reference a different set of assets if they are logged in to site A rather than site B?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done some digging and testing and it looks like I can specify a locale in the general config, eg if following are declared in config (with &lt;code&gt;LOCALE&lt;/code&gt; being defined in index.php based on locale :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'asset_path' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/resources/' . LOCALE . '/',&#xA;'asset_url' =&amp;gt; 'http://' . $_SERVER['SERVER_NAME'] . '/resources/' . LOCALE . '/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, despite this uploading files correctly (depending on context) these are still visible in the admin/control panel from other locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this at all possible? Working on a site with 6 locales that needs to keep assets separate and would rather not have to set multiple asset paths/file destinations and ergo multiple field types to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ta,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-10-30T12:07:06.300" Title="Locales and assets" Tags="&lt;assets&gt;&lt;localization&gt;&lt;multi-domain&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12193" PostTypeId="2" ParentId="12191" CreationDate="2015-10-30T11:58:47.453" Score="2" Body="&lt;p&gt;I've done this by populating a dropdown field using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;Dynamic Fields&lt;/a&gt; plugin. Here's the code I used to generate the dropdown options:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set maxYear = now|date_modify('+3 years')|date('Y') %}&#xA;{% for year in maxYear..1945 %}&#xA;    { &quot;value&quot;: &quot;{{ year }}&quot;, &quot;label&quot;: &quot;{{ year }}&quot; }&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;br&gt;&#xA;Re-reading your question I just noticed that you might not only need a year picker. Well you could add two more dropdown fields for months and days (1-31) or you just teach your client to input the date into the normal Date/Time field with the keyboard.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-10-30T12:15:29.910" LastActivityDate="2015-10-30T12:15:29.910" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12194" PostTypeId="2" ParentId="12192" CreationDate="2015-10-30T12:07:06.300" Score="1" Body="&lt;p&gt;I am not convienced that using Craft localization feature is a (good) solution to do multi-sites. But regarding you problem, did you try to add &lt;code&gt;craft.local&lt;/code&gt; as part of a &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow&quot;&gt;Dynamic Subfolder Paths&lt;/a&gt; configuration. That could work for you.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-10-30T12:07:06.300" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12195" PostTypeId="1" CreationDate="2015-10-30T12:18:31.993" Score="1" ViewCount="647" Body="&lt;p&gt;Needing to reconfigure how assets are set up on a Craft build.&#xA;Is there any way to bulk remove assets without breaking entries that are already referencing these assets?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-10-30T18:32:34.070" Title="Clear out assets" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12196" PostTypeId="2" ParentId="12191" CreationDate="2015-10-30T13:31:51.207" Score="3" Body="&lt;p&gt;Using carlcs's idea, I put three LJ Dynamic Dropdowns in a SuperTable, here's the code for each dropdown (day, month, year):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for day in 1..31 %}&#xA;    { &quot;value&quot;: &quot;{{ day }}&quot;, &quot;label&quot;: &quot;{{ day }}&quot; }&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for month in 1..12 %}&#xA;    { &quot;value&quot;: &quot;{{ month }}&quot;, &quot;label&quot;: &quot;{{ month }}&quot; }&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set maxYear = now|date_modify('-15 years')|date('Y') %}&#xA;{% for year in maxYear..1925 %}&#xA;    { &quot;value&quot;: &quot;{{ year }}&quot;, &quot;label&quot;: &quot;{{ year }}&quot; }&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I added a Preparse field that joins these three dropdowns into a date string on each save (I have this under a User, so adapt to Entry/Asset/etc. if you need to).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;{% if user.userDateOfBirth | length %}&#xA;&#xA;    {% set dateString = user.userDateOfBirth[0].year ~ '-' ~ user.userDateOfBirth[0].month ~ '-' ~ user.userDateOfBirth[0].day %}&#xA;    {{ dateString }}&#xA;&#xA;{% endif  %}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To calculate age in my template, I use this little snippet (date(&quot;2015-07-06&quot;) will return a DateTime object so we can use the diff function on it).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ageString = date(dateString).diff(now).format('%y') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1091" LastEditorUserId="1091" LastEditDate="2015-10-30T13:55:18.780" LastActivityDate="2015-10-30T13:55:18.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12197" PostTypeId="1" AcceptedAnswerId="12201" CreationDate="2015-10-30T14:06:45.080" Score="2" ViewCount="447" Body="&lt;p&gt;I currently have a form that is being displayed to the user via a custom route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form submits to a controller. The first thing the controller does is populate a custom model and validates it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the model fails validation, I want to skip the rest of the controller and pass the model back to the form. What is the best way to do this? I tried using &lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables&lt;/code&gt; and a &lt;code&gt;$this-&amp;gt;redirect&lt;/code&gt;, but the route variable didn't seem to come through, which I imagine is because &lt;code&gt;setRouteVariables&lt;/code&gt; isn't supposed to be used like that.&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="57" LastEditDate="2015-10-30T16:40:53.780" LastActivityDate="2015-10-30T16:45:14.727" Title="Passing data back to form on invalid submission" Tags="&lt;routes&gt;&lt;controller&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12198" PostTypeId="2" ParentId="12197" CreationDate="2015-10-30T15:02:37.490" Score="1" Body="&lt;p&gt;Ok, so I realized even though the template is being called via route, it's still a template, duh. So I can use &lt;code&gt;$this-&amp;gt;renderTemplate&lt;/code&gt; in the controller and specify the data there. Is there a more elegant way than this though?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2015-10-30T15:02:37.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12199" PostTypeId="2" ParentId="12179" CreationDate="2015-10-30T15:55:24.910" Score="1" Body="&lt;p&gt;You need to create several inputs and apply them to your topics category group. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Description field &lt;/li&gt;&#xA;&lt;li&gt;Assets field for PDF's  &lt;/li&gt;&#xA;&lt;li&gt;Matrix field that allows the user to add multiple FAQ's&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In your Services detail page get the category from your category input and output the description: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topic =  entry.categoryInputHandle.first() %}&#xA;{{ topic.descriptionFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next in your Resources detail page grab the category and output the PDF and FAQ's. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topic =  entry.categoryInputHandle.first() %}&#xA;&amp;lt;a href=&quot;{{ topic.assetFieldHandle[0].url }}&amp;gt;PDF&amp;lt;/a&amp;gt;&#xA;{% for faq in topic.faqMatrixFieldHandle %}&#xA;    {# output the different fields you setup in the matrix… #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-30T15:55:24.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12200" PostTypeId="1" AcceptedAnswerId="12229" CreationDate="2015-10-30T15:57:54.903" Score="1" ViewCount="563" Body="&lt;p&gt;I'm using the following modified version of the user &lt;a href=&quot;http://buildwithcraft.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;registration form&lt;/a&gt; for the purpose of a user updating their details.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; class=&quot;form form--full&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;profile&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;        &amp;lt;legend class=&quot;visually-hidden&quot;&amp;gt;Personal details&amp;lt;/legend&amp;gt;&#xA;        {{ account is defined ? _self.errorList(account.getAllErrors()) : 'not' }}&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;firstName&quot;&amp;gt;First name&amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot; placeholder=&quot;First name&quot; required=&quot;required&quot; aria-required=&quot;true&quot; autofocus=&quot;autofocus&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;lastName&quot;&amp;gt;Last name&amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;lastName&quot; type=&quot;text&quot; name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot; placeholder=&quot;Surname&quot; required=&quot;required&quot; aria-required=&quot;true&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;email&quot;&amp;gt;Email&amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;email&quot; type=&quot;email&quot; name=&quot;email&quot; value=&quot;{{ currentUser.email }}&quot; placeholder=&quot;Email address&quot; required=&quot;required&quot; aria-required=&quot;true&quot; disabled=&quot;disabled&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;mobileNumber&quot;&amp;gt;Phone / Mobile number&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;mobileNumber&quot; type=&quot;tel&quot; name=&quot;fields[mobileNumber]&quot; placeholder=&quot;Phone number&quot; value=&quot;{{ currentUser.mobileNumber }}&quot; aria-required=&quot;false&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;company&quot;&amp;gt;Company / Organisation&amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;company&quot; type=&quot;text&quot; name=&quot;fields[company]&quot; value=&quot;{{ currentUser.company }}&quot; limit=&quot;150&quot; placeholder=&quot;Company&quot; required=&quot;required&quot; aria-required=&quot;true&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;position&quot;&amp;gt;Position&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;position&quot; type=&quot;text&quot; name=&quot;fields[position]&quot; value=&quot;{{ currentUser.position }}&quot; placeholder=&quot;Position&quot; aria-required=&quot;false&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form__group&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form__pullLabel&quot; for=&quot;profilePhoto&quot;&amp;gt;Profile photo&amp;lt;/label&amp;gt;&#xA;            &amp;lt;div class=&quot;form__input imageSelect&quot;&amp;gt;&#xA;                {% if currentUser.photoUrl %}&#xA;                    &amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot; id=&quot;userPhoto&quot; /&amp;gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;{% else %}&amp;lt;img src=&quot;{{ url(siteSettings.defaultUserImage.first.getUrl()) }}&quot; width=&quot;100&quot; alt=&quot;no profile image&quot; /&amp;gt;{% endif %}&amp;lt;input id=&quot;profilePhoto&quot; type=&quot;file&quot; accept=&quot;image/*&quot; capture=&quot;camera&quot; name=&quot;userPhoto&quot; value=&quot;{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}&quot;&amp;gt;&#xA;                {% if currentUser.photoUrl %}&#xA;                    &amp;lt;a id=&quot;deleteUserPhotoAction&quot; class=&quot;button button--reverse ut-marginTop&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;button class=&quot;spinnerHolder button button--full&quot; type=&quot;submit&quot;&amp;gt;Save details&amp;lt;/button&amp;gt;&#xA;   &amp;lt;/fieldset&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This updates, however I can't seem to get any errors for empty fields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anything look off? If not, can you perhaps give a push in the right direction as to why it may not be working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-11-03T10:00:47.603" Title="Front end registration form, no errors" Tags="&lt;user-profile&gt;&lt;frontend&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12201" PostTypeId="2" ParentId="12197" CreationDate="2015-10-30T16:45:14.727" Score="2" Body="&lt;p&gt;You can call &lt;code&gt;setRouteVariables&lt;/code&gt; and not return anything from your controller so the request continues as normal.  Craft does this all the time with it's own controllers.  See &lt;a href=&quot;https://craftcms.stackexchange.com/a/12033/57&quot;&gt;this answer&lt;/a&gt; for the general controller workflow.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-10-30T16:45:14.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12202" PostTypeId="2" ParentId="12195" CreationDate="2015-10-30T18:32:34.070" Score="1" Body="&lt;p&gt;Not sure if this helps at all, but you can easily bulk remove assets by physically emptying the associated asset folders then going to &lt;code&gt;settings: update asset indexes&lt;/code&gt;. This of course may break your entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid this you might try setting up a parallel assets group with the correct settings, copy the assets in question over to the new folders manually, update asset indexes for the new asset groups, and then change the corresponding entries to reference the new assets (either manually or en masse via plugin). Once the entries are updated, then you can delete the old asset groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just need to move/rename the folder and not adjust the relative hierarchies, then you should be able to just change the settings on your existing asset groups, rename/move the folders in question, and update asset indexes. This shouldn't break any of the asset links (provided you don't save any entries in the interim).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back up your database!&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2015-10-30T18:32:34.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12203" PostTypeId="1" AcceptedAnswerId="12204" CreationDate="2015-10-30T18:59:22.327" Score="3" ViewCount="554" Body="&lt;p&gt;I've run into an unexpected situation, where ElementCriteriaModel could not be converted to string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').limit(3) %}&#xA;{% for news in news %}&#xA;    {% set cover = news.promotionNewsImage %}&#xA;    {% if cover|length %}&#xA;        {{ cover.getUrl('gtLg') }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on that please?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="115" LastEditDate="2015-10-30T19:39:18.323" LastActivityDate="2015-10-30T19:39:18.323" Title="How do I output image in the loop for an entry?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12204" PostTypeId="2" ParentId="12203" CreationDate="2015-10-30T19:34:23.563" Score="5" Body="&lt;p&gt;Your image input returns and array so you need to reference the first item, even if you only allowed one to be selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').limit(3) %}&#xA;{% for news in news %}&#xA;   {% set cover = news.promotionNewsImage %}&#xA;   {% if cover|length %}&#xA;       {{ cover[0].getUrl('gtLg') }}&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-10-30T19:34:23.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12205" PostTypeId="1" AcceptedAnswerId="12208" CreationDate="2015-10-30T21:27:07.163" Score="1" ViewCount="137" Body="&lt;p&gt;It outputs the same image, which shouldn't and I am suspicious, that it causing it curly brackets followed after &lt;code&gt;media queries&lt;/code&gt; and after &lt;code&gt;twig code&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').limit(3) %}&#xA;{% for news in news %}&#xA;    &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;        @media (min-width: 1200px){&#xA;            .hero{&#xA;                background-image:url(&#xA;                   {% set cover = news.promotionImage %}&#xA;                   {% if cover|length %}&#xA;                       {{ cover[0].getUrl('gtLg') }}&#xA;                   {% endif %});&#xA;                 }&#xA;        }                       &#xA;    &amp;lt;/style&amp;gt;&#xA;    &amp;lt;a ng-href=&quot;{{ news.url }}&quot; flex layout-padding class=&quot;promo news {% if news.whiteText %}whiteText{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;span flex=&quot;grow&quot; class=&quot;promoText md-headline&quot;&amp;gt;&#xA;            {{ news.promotionNewsText|ucfirst }}&#xA;        &amp;lt;/span&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-10-30T23:21:00.837" LastActivityDate="2015-10-30T23:21:00.837" Title="I'm getting unexpected output within media queries" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12206" PostTypeId="2" ParentId="1169" CreationDate="2015-10-30T21:31:10.107" Score="2" Body="&lt;p&gt;I just ran across this with a dev enviroment and live enviroment. I ended up setting the asset url as an absolute path pointing to live. So that when entries are created on live, and images are uploaded, dev will then use the urls from live for the images, since I have dev and live both pointing to the same db.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-10-30T21:31:10.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12207" PostTypeId="2" ParentId="12205" CreationDate="2015-10-30T21:38:23.553" Score="1" Body="&lt;p&gt;Try it this way. Why are your outputting multiple images for the same background image for the same class.  The last item will override the previous. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').limit(3) %}&#xA;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;  {% for item in news %}&#xA;    @media (min-width: 1200px){&#xA;        .hero{&#xA;            background-image:url(&#xA;               {% set cover = item.promotionImage %}&#xA;               {% if cover|length %}&#xA;                   {{ cover[0].getUrl('gtLg') }}&#xA;               {% endif %}&#xA;             );&#xA;         }&#xA;    } &#xA;  {% endfor %}                      &#xA;&amp;lt;/style&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-10-30T21:48:20.860" LastActivityDate="2015-10-30T21:48:20.860" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12208" PostTypeId="2" ParentId="12205" CreationDate="2015-10-30T23:16:58.240" Score="1" Body="&lt;p&gt;That works good. Some improvements would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').limit(3) %}&#xA;{% set id = news.uniqueStyleId %}&#xA;{% for news in news %}&#xA;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;    @media (min-width: 1200px){&#xA;        {% if id|length %}#{{ id }}{% endif %}{&#xA;            background-image:url(&#xA;               {% set cover = news.promotionImage %}&#xA;               {% if cover|length %}&#xA;                   {{ cover[0].getUrl('gtLg') }}&#xA;               {% endif %});&#xA;             }&#xA;    }                       &#xA;&amp;lt;/style&amp;gt;&#xA;&amp;lt;a id=&quot;{% if id|length %}{{ id }}{% endif %}&quot; ng-href=&quot;{{ news.url }}&quot; flex layout-padding class=&quot;promo news {% if news.whiteText %}whiteText{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;span flex=&quot;grow&quot; class=&quot;promoText md-headline&quot;&amp;gt;&#xA;        {{ news.promotionNewsText|ucfirst }}&#xA;    &amp;lt;/span&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason Why I was getting the same image appeared in my styled block, is because &lt;code&gt;image&lt;/code&gt; was printed in browser under same class. All I had to do is to set a unique dynamic ID or class.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-10-30T23:16:58.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12209" PostTypeId="2" ParentId="12169" CreationDate="2015-10-30T23:43:15.363" Score="4" Body="&lt;p&gt;Goodness, I figured out what was going on here. The cpTrigger had been changed from admin to a different name in the craft/config/general file. [Facepalm]&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2015-10-30T23:43:15.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12213" PostTypeId="1" AcceptedAnswerId="12218" CreationDate="2015-11-01T12:02:25.273" Score="1" ViewCount="147" Body="&lt;p&gt;Can anyone shed any light on why the following doesn't work for &lt;code&gt;getSegment(2)&lt;/code&gt; but the previous does for &lt;code&gt;getSegment(1)&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL structure for these two examples are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;root.com/blog&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;root.com/blog/trends&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;a class=&quot;button button--outline-blue {% if craft.request.getSegment(1) == 'blog' %}current{% endif %}&quot; href=&quot;/blog&quot;&amp;gt;All&amp;lt;/a&amp;gt;&#xA;&#xA;{% nav category in craft.categories.group('blogCategories') %}&#xA;&#xA;    &amp;lt;a class=&quot;button button--outline-blue {% if craft.request.getSegment(2) == 'trends' %}current{% endif %}&quot; href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2015-11-02T09:02:56.040" LastActivityDate="2015-11-02T09:03:22.970" Title="Using getSegment" Tags="&lt;navigation&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12216" PostTypeId="1" AcceptedAnswerId="12217" CreationDate="2015-11-02T07:07:09.320" Score="3" ViewCount="703" Body="&lt;p&gt;I have an entry type called &lt;code&gt;industry&lt;/code&gt; and am trying to use this search syntax in the CP to filter my entries by that type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;type:&quot;industry&quot;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting no results whatsoever. How do I filter entries in CP by Entry Type?&lt;/p&gt;&#xA;" OwnerUserId="597" LastEditorUserId="331" LastEditDate="2015-11-02T07:41:24.803" LastActivityDate="2015-11-02T07:41:24.803" Title="How do I filter entries in CP by Entry Type?" Tags="&lt;control-panel&gt;&lt;search&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12217" PostTypeId="2" ParentId="12216" CreationDate="2015-11-02T07:33:15.600" Score="3" Body="&lt;p&gt;There is a great plugin that allows you to add columns Craft doesn't initially provide.  This plugin also allows you to filter by those, like Entry Type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/DashCols-Craft/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-11-02T07:33:15.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12218" PostTypeId="2" ParentId="12213" CreationDate="2015-11-02T09:03:22.970" Score="2" Body="&lt;p&gt;Code above is fine. I was stupidly updating the wrong template&lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-11-02T09:03:22.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12219" PostTypeId="1" AcceptedAnswerId="12220" CreationDate="2015-11-02T09:13:50.817" Score="2" ViewCount="92" Body="&lt;p&gt;I'm trying to match the 2nd part of the slug with the category title to then place a 'current' class on the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('blogCategories') %}&#xA;&#xA;    &amp;lt;a class=&quot;button button--outline-blue {% if craft.request.getSegment(2) == '{{ category.title }}' %}current{% endif %}&quot; href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-11-02T12:24:14.863" Title="getSegment matching category title" Tags="&lt;categories&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12220" PostTypeId="2" ParentId="12219" CreationDate="2015-11-02T09:20:13.370" Score="4" Body="&lt;p&gt;You might do something like this, concerned that you want to set current on active category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.request.getLastSegment() %} &#xA;&#xA;{% nav category in craft.categories.group('blogCategories') %}&#xA;    {% set current = (category.slug == categorySlug) %}&#xA;    &amp;lt;a class=&quot;button button--outline-blue &#xA;       {% if current %} current{% endif %}&#xA;       href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;       {{ category.title }}&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-11-02T12:24:14.863" LastActivityDate="2015-11-02T12:24:14.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12221" PostTypeId="1" CreationDate="2015-11-02T15:48:37.707" Score="1" ViewCount="67" Body="&lt;p&gt;I have a craft installation and recently my server had issues and on the page rendering mysql and other errors were shown. &#xA;Of course this creates security implications. Is there a way to restrict these errors? My guess it that i just need to change the &lt;code&gt;devMode&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; in &lt;code&gt;general.php&lt;/code&gt;. Is there anything else i need to do? I am asking because I cannot really reproduce the error anymore.&lt;/p&gt;&#xA;" OwnerUserId="4164" LastEditorUserId="57" LastEditDate="2015-11-02T19:30:39.573" LastActivityDate="2015-11-02T19:30:39.573" Title="Craft internal error exposing sensitive data" Tags="&lt;config&gt;&lt;error-message&gt;&lt;error&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12222" PostTypeId="1" AcceptedAnswerId="12226" CreationDate="2015-11-02T16:56:41.997" Score="2" ViewCount="185" Body="&lt;p&gt;I have a &lt;code&gt;headline&lt;/code&gt; global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to see if &lt;code&gt;headline&lt;/code&gt; is editable by using this code block, but it is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use &lt;code&gt;isEditable()&lt;/code&gt; with my &lt;code&gt;headline&lt;/code&gt; global?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if headline.isEditable() %}&#xA;    &amp;lt;div class=&quot;admin-edit-button-wrapper&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ headline.cpEditUrl }}&quot; class=&quot;admin-edit-button&quot;&amp;gt;Edit Headline&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastEditorUserId="45" LastEditDate="2015-11-02T18:47:58.343" LastActivityDate="2015-11-02T20:33:09.263" Title="Can I use isEditable() on a global?" Tags="&lt;globals&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12223" PostTypeId="2" ParentId="11908" CreationDate="2015-11-02T18:25:22.080" Score="2" Body="&lt;p&gt;I just ran into this issue myself. I have custom fields assigned to the user model in the dashboard that weren't being validated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marking those fields are required in the dashboard for the user model was all I had to do to ensure that they are required using the standard Craft saveUser controller. Depending on what your validation needs are this might work for you too.&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2015-11-02T18:25:22.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12224" PostTypeId="2" ParentId="12221" CreationDate="2015-11-02T19:30:14.040" Score="4" Body="&lt;p&gt;Your guess is correct... as the docs say, you should never have &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; enabled in production environments specifically for reasons like this (as well as many others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you find errors that are leaking sensitive server info with &lt;code&gt;devMode&lt;/code&gt; disabled, then that is a bug and should be reported to support@buildwithcraft.com.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-02T19:30:14.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12225" PostTypeId="2" ParentId="12222" CreationDate="2015-11-02T20:09:36.750" Score="4" Body="&lt;p&gt;No, the &lt;code&gt;isEditable&lt;/code&gt; property isn't supported for Global Sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusing thing is that the &lt;a href=&quot;https://buildwithcraft.com/classreference/models/GlobalSetModel&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;GlobalSetModel&lt;/code&gt;&lt;/a&gt; class does actually have an &lt;a href=&quot;https://buildwithcraft.com/classreference/models/BaseElementModel#isEditable-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;isEditable&lt;/code&gt;&lt;/a&gt; property, however it will always return &lt;code&gt;false&lt;/code&gt;. The reason is that this property is inherited from the &lt;code&gt;BaseElementModel&lt;/code&gt; class, where it will return &lt;code&gt;false&lt;/code&gt; &lt;em&gt;unless the element type overrides it to (potentially) return something else&lt;/em&gt;. An example of the latter is the &lt;code&gt;EntryModel&lt;/code&gt; class, which also inherits &lt;code&gt;BaseElementModel&lt;/code&gt; but overrides  &lt;code&gt;isEditable&lt;/code&gt; &lt;a href=&quot;https://buildwithcraft.com/classreference/models/EntryModel#isEditable-detail&quot; rel=&quot;nofollow&quot;&gt;to test if the current user is allowed to edit the entry&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be interesting to hear P&amp;amp;T's reasoning for not &quot;enabling&quot; &lt;code&gt;isEditable&lt;/code&gt; for Global Sets, although to be honest – needing to give users the ability to edit global variables from the frontend sounds like an edge case at best, and probably not a very good idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;On that note, my best advice for a workaround would be to simply use a Single instead of a Global Set.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you need/want to use a Global Set, you can easily work around the issue by creating a custom plugin exposing a &lt;code&gt;isGlobalSetEditable&lt;/code&gt; template variable method. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function isGlobalSetEditable(GlobalSetModel $globalSet)&#xA;{&#xA;    return craft()-&amp;gt;userSession-&amp;gt;checkPermission('editGlobalSet:'.$globalSet-&amp;gt;id);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you could then do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.myPlugin.isGlobalSetEditable(headline) %}&#xA;    &amp;lt;a href=&quot;{{ headline.cpEditUrl }}&quot;&amp;gt;Edit me&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're not familiar with plugin development, I'd advice you to check out the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;official docs on the subject&lt;/a&gt;, and to download the excellent &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic Plugin&lt;/a&gt; as a starting point – it even has a Variable class where the above &lt;code&gt;isGlobalSetEditable&lt;/code&gt; method could be dropped right in.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-11-02T20:09:36.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12226" PostTypeId="2" ParentId="12222" CreationDate="2015-11-02T20:20:48.670" Score="4" Body="&lt;p&gt;&lt;code&gt;isEditable()&lt;/code&gt; would be a method of the content model, not of a field. Unfortunately, this is currently only useful for &lt;em&gt;&lt;a href=&quot;https://buildwithcraft.com/classreference/models/EntryModel#isEditable-detail&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;&lt;/em&gt; objects; It is not presently implemented for &lt;em&gt;GlobalSetModel&lt;/em&gt; objects, so using &lt;code&gt;.isEditable&lt;/code&gt; on a global set will always &lt;a href=&quot;https://buildwithcraft.com/classreference/models/BaseElementModel#isEditable-detail&quot; rel=&quot;nofollow&quot;&gt;return &lt;code&gt;false&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you could use the &lt;a href=&quot;https://buildwithcraft.com/classreference/models/UserModel#can-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;.can()&lt;/code&gt;&lt;/a&gt; method on a user, and check for the permission &lt;code&gt;'editglobalset:X'&lt;/code&gt; (where &lt;em&gt;X&lt;/em&gt; is the ID of your Global Set element).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example — assuming &lt;code&gt;header&lt;/code&gt; is a &lt;em&gt;GlobalSetObject&lt;/em&gt; you have fetched elsewhere in your template):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.can('editglobalset:' ~ header.id) %}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="1098" LastEditDate="2015-11-02T20:33:09.263" LastActivityDate="2015-11-02T20:33:09.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12228" PostTypeId="1" CreationDate="2015-11-03T07:42:45.230" Score="1" ViewCount="45" Body="&lt;p&gt;I have following setup for my site urls (after other testing domains): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;&#xA;    '*' =&amp;gt; [&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'usePathInfo' =&amp;gt; true,&#xA;        'generateTransformsBeforePageLoad' =&amp;gt; false,&#xA;        'convertFilenamesToAscii' =&amp;gt; true,&#xA;    ],&#xA;&#xA;    'mp.mydevserver.pizza' =&amp;gt; [&#xA;        'devMode' =&amp;gt; true,&#xA;&#xA;        'siteUrl' =&amp;gt; [&#xA;            'en' =&amp;gt; 'http://mp.mydevserver.pizza',&#xA;            'de' =&amp;gt; 'http://mp.mydevserver.pizza/de',&#xA;        ],&#xA;    ],&#xA;&#xA;    'mypage.com.mydevserver.pizza' =&amp;gt; [&#xA;        'siteUrl' =&amp;gt; [&#xA;            'en' =&amp;gt; 'http://mypage.com.mydevserver.pizza',&#xA;            'de' =&amp;gt; 'http://mypage.com.mydevserver.pizza/de',&#xA;        ],&#xA;    ],&#xA;&#xA;    'mypage.com' =&amp;gt; [&#xA;        'siteUrl' =&amp;gt; [&#xA;            'en' =&amp;gt; 'http://mypage.com',&#xA;            'de' =&amp;gt; 'http://mypage.com/de',&#xA;        ],&#xA;    ],&#xA;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The staging domain is &lt;code&gt;mp.mydevserver.pizza&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The acceptance domain is &lt;code&gt;mypage.com.mydevserver.pizza&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The production domain is  &lt;code&gt;mypage.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Staging works fine. But on Acceptance, Craft always uses &lt;code&gt;mypage.com&lt;/code&gt; as Site Url. I can reach the site, but ofc, every link is wrong. I've read that in this case the order matters and the &lt;code&gt;mypage.com.mydevserver.pizza&lt;/code&gt; would have to appear first. But it actually IS before the &lt;code&gt;mypage.com&lt;/code&gt; entry in the array? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it picking the wrong settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Robert&lt;/p&gt;&#xA;" OwnerUserId="4226" LastActivityDate="2015-11-03T07:42:45.230" Title="Wrong siteUrl chosen in multi-environment config" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;siteurl&gt;&lt;multi-domain&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2015-11-03T20:55:43.673" ContentLicense="CC BY-SA 3.0" />
  <row Id="12229" PostTypeId="2" ParentId="12200" CreationDate="2015-11-03T10:00:47.603" Score="2" Body="&lt;p&gt;Ok, so the problem wasn't what I initially expected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a bit of searching, I found out that the default first name and last name fields are not required by default and there's no way to make them required. As a result, validation wasn't failing; hence no &lt;code&gt;account&lt;/code&gt; object to get errors from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution was to just create two extra custom fields &lt;code&gt;User First Name&lt;/code&gt; and &lt;code&gt;User Last Name&lt;/code&gt;. Not ideal, but solves the problem&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-11-03T10:00:47.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12230" PostTypeId="1" CreationDate="2015-11-03T10:53:01.477" Score="1" ViewCount="606" Body="&lt;p&gt;If i include javascript in a template using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myJS %}&#xA;//some JS in here&#xA;{% endset %}&#xA;&#xA;{% includeJS myJS %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to minify the javascript that gets output on the page? I had a look at the documentation but couldn't find anything. The only way i have found to do it otherwise is to put the javascript in an external file, minify that, and include it with {% includeJsFile %}. Any ideas on how i could do this? Or is there a better way to achieve the same result?&lt;/p&gt;&#xA;" OwnerUserId="3941" LastActivityDate="2015-11-04T03:57:22.487" Title="minify javascript with includeJS" Tags="&lt;templating&gt;&lt;javascript&gt;&lt;includejs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12231" PostTypeId="1" AcceptedAnswerId="12280" CreationDate="2015-11-03T11:06:15.417" Score="2" ViewCount="105" Body="&lt;p&gt;I would like to let a client log in to the site when the system is off, but without CP access. I have created a user group named «testing-group» with one checkbox checked: «Access the site when the system is off», and I have assigned a user to this group. I have created a 503.html template in the templates folder, and the login form provided in the docs,  &lt;a href=&quot;http://buildwithcraft.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/templating/login-form&lt;/a&gt;, is in this template. The form is displayed, but nothing happens when I try to log in (happens both with admin account and the user assigned to the group «testing-group» ). &lt;/p&gt;&#xA;" OwnerUserId="4288" LastActivityDate="2015-11-05T23:13:48.997" Title="Let a client log in to the site when the system is off" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-11-06T00:29:27.940" ContentLicense="CC BY-SA 3.0" />
  <row Id="12232" PostTypeId="1" AcceptedAnswerId="17926" CreationDate="2015-11-03T11:33:18.923" Score="4" ViewCount="851" Body="&lt;p&gt;I have a plugin that uploads and associates files/assets to users and entries. I would like it to store these files under a user ID subfolder of the asset folder. I know how to do this within the controlpanel, working with assets there. But how would I create and register subfolders within my plugin? If I just create the folder with my php script, it doesnt show up in the assets folder until i do a &quot;Update Asset Indexes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way my plugin works now, It creates an asset with the craft()-&gt;assets-&gt;insertFileByLocalPath, and then associates the fileId with my entry after its created/uploaded. Maybe this is not the right way to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2016-11-28T14:55:45.187" Title="How to create a new subfolder to an asset with plugin" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;subfolder&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12233" PostTypeId="1" CreationDate="2015-11-03T11:43:14.970" Score="1" ViewCount="60" Body="&lt;p&gt;I've been doing some quite involved work on a site where we want to restrict user access to certain asset paths. Following the post at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11816/assets-folder-images-dont-show-up/11869#11869&quot;&gt;Assets Folder: Images don&amp;#39;t show up&lt;/a&gt; I was directed to the excellent add-on, &lt;a href=&quot;https://github.com/pixelandtonic/AssetSubfolderAccess&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetSubfolderAccess&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After hitting a few bugs think have resolved but this only works in the Assets tab/are of the Control Panel. It does not seem to work within the Assets modal (eg when prompted on entry creation/edit). Is there a separate hook available for asset modals or can anybody suggest an alternative way of targetting specific asset paths at specific users?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-11-03T11:43:14.970" Title="User Group specific asset paths" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;hook&gt;&lt;assetfilemodel&gt;&lt;modal&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12235" PostTypeId="1" AcceptedAnswerId="12236" CreationDate="2015-11-03T16:54:41.937" Score="3" ViewCount="1125" Body="&lt;p&gt;From my searches it looks like &lt;a href=&quot;https://github.com/alecritson/Placid&quot; rel=&quot;nofollow&quot;&gt;Placid&lt;/a&gt; is the way to go for showing Facebook contenton the front-end of my website. What I'm completely confused about is how to get started. Does anyone have a simple step-by-step answer on how I connect Placid to my Facebook page? &lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2016-12-13T14:22:38.937" Title="Show Facebook Page Feed on Website" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12236" PostTypeId="2" ParentId="12235" CreationDate="2015-11-03T18:35:02.323" Score="5" Body="&lt;p&gt;First, you would need to create an app for your Facebook page. You are also going to need a Facebook developer account: &lt;a href=&quot;https://developers.facebook.com&quot;&gt;developers.facebook.com&lt;/a&gt;. Once your app is created and you have a Facebook developer account, I would recommend starting with the Facebook open graph explorer: &lt;a href=&quot;https://developers.facebook.com/tools/explorer&quot;&gt;developers.facebook.com/tools/explorer&lt;/a&gt;. With the explorer, you can build/debug your URL to add to Placid. The documentation for the Graph API is here: &lt;a href=&quot;https://developers.facebook.com/docs/graph-api&quot;&gt;developers.facebook.com/docs/graph-api&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4291" LastActivityDate="2015-11-03T18:35:02.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12237" PostTypeId="1" CreationDate="2015-11-03T18:54:53.887" Score="4" ViewCount="1276" Body="&lt;p&gt;Is there somewhere that we can find a the schematics of crafts database structure/schema. We  are looking into developing a database migration workflow between development and production environments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3334" LastActivityDate="2015-11-04T00:15:17.037" Title="Craft CMS Database Structure and Schema Schematics" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12238" PostTypeId="2" ParentId="12237" CreationDate="2015-11-03T19:03:52.970" Score="3" Body="&lt;p&gt;Tools like Navicat and MySQL Workbench both have ways of &lt;a href=&quot;http://wiki.navicat.com/wiki/index.php/Does_Navicat_support_forward/reverse_engineering%3F&quot; rel=&quot;nofollow&quot;&gt;analyzing&lt;/a&gt; a &lt;a href=&quot;https://dev.mysql.com/doc/workbench/en/wb-data-modeling.html&quot; rel=&quot;nofollow&quot;&gt;database&lt;/a&gt; and generate a schema map from it, so you can visualize the tables, foreign keys, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="115" LastEditDate="2015-11-04T00:15:17.037" LastActivityDate="2015-11-04T00:15:17.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12239" PostTypeId="1" CreationDate="2015-11-03T19:12:25.000" Score="2" ViewCount="305" Body="&lt;p&gt;We are experiencing incredibly slow site performance. Any tips on where to find out how much memory the site is using, or if increasing this will increase internal site loading and navigating speed? Thanks for your help!!!&lt;/p&gt;&#xA;" OwnerUserId="4292" LastActivityDate="2015-11-04T17:27:48.910" Title="Slow Site Speed and Increasing Memory" Tags="&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12240" PostTypeId="1" CreationDate="2015-11-03T19:12:32.143" Score="6" ViewCount="1813" Body="&lt;p&gt;Is there a way to schedule a &lt;strong&gt;draft&lt;/strong&gt; of a entry to go live?&lt;/p&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2017-06-05T21:26:16.477" Title="Schedule a draft to auto publish?" Tags="&lt;entry&gt;&lt;draft&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12241" PostTypeId="2" ParentId="12230" CreationDate="2015-11-03T22:33:38.673" Score="4" Body="&lt;p&gt;I don't believe there is a way to minify javascript when it is output to the page.  If there is it would make for increased load time. My suggestion is to use a preprocessor like &lt;strong&gt;&lt;a href=&quot;http://gulpjs.com&quot; rel=&quot;nofollow&quot;&gt;Gulpjs&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href=&quot;http://gruntjs.com/&quot; rel=&quot;nofollow&quot;&gt;Gruntjs&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic workflow is when you update your JS file/s the preprocessor can detect the change and concatenate and minify your files into a production file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to &lt;strong&gt;&lt;a href=&quot;http://blog.teamtreehouse.com/install-node-js-npm-mac&quot; rel=&quot;nofollow&quot;&gt;install Node&lt;/a&gt;&lt;/strong&gt;.  An easy way to do that is to use &lt;strong&gt;&lt;a href=&quot;http://brew.sh/&quot; rel=&quot;nofollow&quot;&gt;Homebrew&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;brew install node&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am including links to a couple files to help you start. One is the &lt;strong&gt;&lt;a href=&quot;https://gist.github.com/a-am/507138c779a133a404f7&quot; rel=&quot;nofollow&quot;&gt;package.json&lt;/a&gt;&lt;/strong&gt; file that NPM uses to install the node components.  The other &lt;strong&gt;&lt;a href=&quot;https://gist.github.com/a-am/c7dc178bbfb11df26c60&quot; rel=&quot;nofollow&quot;&gt;gulpfile.js&lt;/a&gt;&lt;/strong&gt; is a starter file for using Gulpjs, to give you an idea of how to setup the tasks. &lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2015-11-04T03:57:22.487" LastActivityDate="2015-11-04T03:57:22.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12242" PostTypeId="2" ParentId="12240" CreationDate="2015-11-03T23:19:00.183" Score="9" Body="&lt;p&gt;If the entry is not already published, just set the &lt;code&gt;Post Date&lt;/code&gt; to a date in the future. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aNOdn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aNOdn.png&quot; alt=&quot;Future Post&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will set the entry to what Craft calls &lt;code&gt;Pending&lt;/code&gt;. On the entry's index, the status indicator will be orange (instead of green).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XvJlj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XvJlj.png&quot; alt=&quot;Future Entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the entry is already currently published, no. That'd be a &lt;a href=&quot;https://github.com/craftcms/cms/issues/864&quot; rel=&quot;noreferrer&quot;&gt;feature request&lt;/a&gt;. I agree, it would be great to be able to &quot;publish over&quot; the current edition (say for a contest or what not). If you set a draft's entry to a future date, Craft will un-publish the entry and set the status to pending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could work around this in Twig though. Say you want to have the entry change on 11/10. Set up a new Draft, name it &lt;code&gt;Will Go Live on 11/10&lt;/code&gt; (or whatever). Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if now|date('U') &amp;gt; &quot;2015-11-10&quot;|date('U') %}&#xA;&#xA;{% set theDrafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;&#xA;{# keep the &quot;old&quot; entry around just in case #}&#xA;{% set oldEntry = entry %}&#xA;&#xA;        {%for i in theDrafts %}&#xA;&#xA;            {# look for the specific draft and set if it exists #}&#xA;&#xA;            {% if i.name == &quot;Will Go Live on 11/10&quot; %}&#xA;                {% set entry = i %}&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;{% endif %}&#xA;&#xA;{# template as normal #}&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-06-05T21:26:16.477" LastActivityDate="2017-06-05T21:26:16.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12244" PostTypeId="1" AcceptedAnswerId="12279" CreationDate="2015-11-04T08:03:55.623" Score="3" ViewCount="240" Body="&lt;p&gt;I'm fetching entries from several different locales and merging them together into a single object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then want to sort these to be most recent entry shown first.&#xA;Using Supersort and the custom &lt;code&gt;sortAs&lt;/code&gt; method I can get this to work showing entries in ascending date order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = 'news' %} &#xA;{% set locales = craft.i18n.getSiteLocales %}   &#xA;{% set pages = [] %}&#xA;{% for locale in locales %}&#xA;    {% set entries = craft.entries.section(sections).status(null).locale(locale.id).localeEnabled(false).find() %}  &#xA;    {% set pages = pages|merge(entries) %}&#xA;{% endfor %}        &#xA;{% set pagesSorted = pages | supersort('sortAs', '{ postDate.date }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I try to use the above with the custom &lt;code&gt;rsortAs&lt;/code&gt; method then it does not work, just returning the entries in the order they occur within the pages object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on what might be doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-11-05T21:18:46.460" Title="Using Supersort with date field" Tags="&lt;entries&gt;&lt;sorting&gt;&lt;plugin-supersort&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12246" PostTypeId="2" ParentId="11914" CreationDate="2015-11-04T10:51:24.137" Score="1" Body="&lt;p&gt;&lt;strong&gt;Simple solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was my first Craft/Yii build so it was rather straightforward once I knew the basics.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllItems($offset, $counter)&#xA;{&#xA;    $social_items = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('title, content, date, category, id, account, unique_id, image, link')&#xA;        -&amp;gt;from('social_tablename') &#xA;        -&amp;gt;offset($offset)&#xA;        -&amp;gt;limit($counter)&#xA;        -&amp;gt;order('date desc')&#xA;        -&amp;gt;queryAll();&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'blog';&#xA;$criteria-&amp;gt;order   = 'postDate desc';&#xA;//$criteria-&amp;gt;limit   = 5; // Limit if required&#xA;&#xA;$blog_items = array();&#xA;$i = 0;&#xA;foreach ($criteria as $entry)&#xA;{&#xA;  $blog_items[$i]['title'] = $entry-&amp;gt;title;&#xA;  $blog_items[$i]['content'] = $entry-&amp;gt;shortDescription;&#xA;  $blog_items[$i]['postImage'] = $entry-&amp;gt;postImage;&#xA;  $blog_items[$i]['category'] = 'blog'; /* Channel name - news/posts */&#xA;  $blog_items[$i]['link'] = $entry-&amp;gt;url;&#xA;  $blog_items[$i]['url'] = $entry-&amp;gt;url;&#xA;  $blog_items[$i]['date'] = $entry-&amp;gt;postDate;&#xA;  $i++;&#xA;}&#xA;&#xA;$social_items = array_merge($social_items, $blog_items);&#xA;&#xA;/* Sorts multidimentional array by 'column' */&#xA;$this-&amp;gt;aasort($social_items,&quot;date&quot;);&#xA;&#xA;return $social_items;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2015-11-04T10:51:24.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12247" PostTypeId="1" AcceptedAnswerId="12335" CreationDate="2015-11-04T15:45:40.757" Score="1" ViewCount="193" Body="&lt;p&gt;I'm trying to extend the Craft &lt;code&gt;UserController&lt;/code&gt; class, in order to add some extra validation to the &lt;code&gt;actionSaveUser&lt;/code&gt; action, before the rest of the code in that function executes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got no problem hitting my controller and even calling the &lt;code&gt;parent::actionSaveUser&lt;/code&gt; which seems to be working, except for getting the validation error messages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function actionSaveUser()&#xA;{&#xA;    parent::actionSaveUser();&#xA;    $this-&amp;gt;renderTemplate('profile/index.html');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For brevity, I've not included any of the validation just yet. The template being rendered does display errors if routed to the Craft controller action, but not through mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main reason for doing this is because uploading of a non-image for the profile image (e.g. uploading a php file) causes a php error, not a value in the returned errors array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why the errors are disappearing when routing through my controller first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through the UserController::actionSaveUser action, I can see&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'account' =&amp;gt; $user&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking through the urlManager documentation; I can see that &lt;code&gt;_routeVariables&lt;/code&gt; is being updated but can't see a way of accessing this array to get the &lt;code&gt;account&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I looking in the wrong place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update The Second&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, even sending the form directly to &lt;code&gt;users/saveUser&lt;/code&gt; isn't yielding any errors (&lt;code&gt;account&lt;/code&gt; object isn't defined). But, if all fields are filled in, it correctly saves&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerDisplayName="user4041" LastEditorDisplayName="user4041" LastEditDate="2015-11-09T11:21:01.920" LastActivityDate="2015-11-10T14:55:13.760" Title="Extending UserController" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;user-profile&gt;&lt;custom&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12248" PostTypeId="1" AcceptedAnswerId="12249" CreationDate="2015-11-04T15:57:14.590" Score="3" ViewCount="872" Body="&lt;p&gt;Just tried updating craft from version 2.4.2669 to the latest version 2.4.2702 unfortunately it threw a fatal error with the following error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Status: OK&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Response: &lt;br /&gt; &lt;b&gt;Fatal error&lt;/b&gt;: Out of memory (allocated&#xA;  33030144) (tried to allocate 41 bytes) in&#xA;  &lt;b&gt;/homepages/3/d272256762/htdocs/crafttest/craft/app/framework/db/CDbCommand.php&lt;/b&gt;&#xA;  on line &lt;b&gt;518&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I then tried to manually install it by uploading the app folder. Clicked through on the update databases it started working, but again threw the same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is on a shared server so I can not do much regarding memory limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I have no CMS and no frontend what can I do to rectify this problem to either rollback to the previous version or update to the newer one?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-11-04T16:10:35.287" Title="Updating Craft Produced Fatal Error.What now?" Tags="&lt;updating&gt;&lt;auto-updates&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12249" PostTypeId="2" ParentId="12248" CreationDate="2015-11-04T16:10:35.287" Score="2" Body="&lt;p&gt;How big is your database? It could be that Craft is failing to backup your database as part of the update process because it is running out of memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;backupDbOnUpdate&lt;/code&gt;&lt;/a&gt; config setting to &lt;code&gt;false&lt;/code&gt; and running the update again.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-11-04T16:10:35.287" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12250" PostTypeId="1" CreationDate="2015-11-04T16:53:19.153" Score="1" ViewCount="128" Body="&lt;p&gt;i have endpoint: &#xA;&lt;code&gt;'news/&amp;lt;slug:{slug}&amp;gt;.json'&lt;/code&gt;&#xA;i print out EntryModel-Class in transformer function and it doesn´t seem to contain any photos like how it is described in &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element Api&lt;/a&gt; example loop at the bottom of docs.&#xA;i need to return all images and their locations as json for specific entry.&#xA;any ideas?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;&#xA;        return [&#xA;&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'news',&#xA;                'slug' =&amp;gt; $slug&#xA;&#xA;            ],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;&#xA;                print_r($entry);&#xA;&#xA;                //doesnt work ---&amp;gt;&#xA;                // $photos = [];&#xA;                // foreach ($entry-&amp;gt;photos as $photo) {&#xA;                //     $photos[] = $photo-&amp;gt;url;&#xA;                // }&#xA;                //&amp;lt;----- doesnt work&#xA;&#xA;                return [&#xA;                    'locale' =&amp;gt; $entry-&amp;gt;locale,&#xA;                    'slug' =&amp;gt; $entry-&amp;gt;slug,&#xA;                    'status' =&amp;gt; $entry-&amp;gt;status,&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'uri' =&amp;gt; $entry-&amp;gt;uri,&#xA;&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'heading' =&amp;gt; $entry-&amp;gt;heading,&#xA;                    'subheading' =&amp;gt; $entry-&amp;gt;subheading,&#xA;&#xA;                    'linkUrl' =&amp;gt; $entry-&amp;gt;linkUrl,&#xA;                    'postDate' =&amp;gt; $entry-&amp;gt;postDate,&#xA;&#xA;                    'children' =&amp;gt; $entry-&amp;gt;children,&#xA;                    'author' =&amp;gt; $entry-&amp;gt;author,&#xA;                    'link' =&amp;gt; $entry-&amp;gt;link,&#xA;                    'next' =&amp;gt; $entry-&amp;gt;next,&#xA;                    'parent' =&amp;gt; $entry-&amp;gt;parent,&#xA;                    'section' =&amp;gt; $entry-&amp;gt;section,&#xA;                    'type' =&amp;gt; $entry-&amp;gt;type,&#xA;                    'ancestors' =&amp;gt; $entry-&amp;gt;ancestors,&#xA;                    'body' =&amp;gt; $entry-&amp;gt;body,&#xA;                    'articleBody' =&amp;gt; $entry-&amp;gt;articleBody,&#xA;                    'featuredImage' =&amp;gt; $entry-&amp;gt;featuredImage,&#xA;                    'backgroundColor' =&amp;gt; $entry-&amp;gt;backgroundColor,&#xA;                    'serviceBody' =&amp;gt; $entry-&amp;gt;serviceBody,&#xA;                    'featuredThumb'=&amp;gt;$entry-&amp;gt;featuredThumb,&#xA;                    'heroImage'=&amp;gt;$entry-&amp;gt;heroImage,&#xA;                    'indexHeading'=&amp;gt;$entry-&amp;gt;indexHeading,&#xA;                    'shortDescription'=&amp;gt;$entry-&amp;gt;shortDescription,&#xA;                    'root'=&amp;gt;$entry-&amp;gt;root&#xA;                    // 'photos' =&amp;gt; $photos    &amp;lt;- i need image locations related to an entry&#xA;                    //'fields' =&amp;gt; $entry-&amp;gt;fields&#xA;                    // 'caption' =&amp;gt; $entry-&amp;gt;caption&#xA;                    // 'shortDescription'=&amp;gt; $entry-&amp;gt;shortDescription,&#xA;                    // 'elementId' =&amp;gt; $entry-&amp;gt;elementId,&#xA;&#xA;&#xA;                ];&#xA;            },&#xA;&#xA;&#xA;        ];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;nothing under postDate seems to return anything.... &lt;/p&gt;&#xA;" OwnerUserId="4297" LastEditorUserId="4297" LastEditDate="2015-11-05T08:52:39.097" LastActivityDate="2015-11-05T08:52:39.097" Title="How can i request image locations through elements api for an entry in section?" Tags="&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12251" PostTypeId="1" CreationDate="2015-11-04T17:15:39.887" Score="2" ViewCount="1263" Body="&lt;p&gt;I've been stumped on this one for awhile and tried everything. When I click Clear Caches in settings, it appears as if everything works fine but when I check the logs I see... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2015/11/04 17:10:16 [error] [application] Tried to read the folder contents of path/cms/craft/storage/runtime/cache/, but could not.&#xA;2015/11/04 17:10:16 [error] [application] Tried to read the folder contents of path/cms/craft/storage/runtime/assets/, but could not.&#xA;2015/11/04 17:10:16 [error] [application] Tried to read the folder contents of path/cms/craft/storage/runtime/temp/, but could not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ommited the actual path because it contained a clients name but I checked it's accuracy. I also noticed that it appears to be writing files to the cache folder. I also verified permissions on the folders and parent folder, all are set at 777 (for testing) was set at 744. I'm not sure what else to try or do. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-04T18:05:48.137" Title="Can't clear caches locally" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12252" PostTypeId="2" ParentId="12239" CreationDate="2015-11-04T17:21:49.930" Score="6" Body="&lt;p&gt;You're asking a loaded question. When you mention memory, how exactly are you measuring that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site performance can depend on a few factors, including the hosting provider, the hardware, what Craft fields you're using, etc. Craft tends to hit the database a lot so if your connection to MySQL isn't good—say on a mediocre shared hosting provider—that's going to slow you down.  Using a lot of &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot;&gt;Matrix fields&lt;/a&gt; can really slow you do or if you're trying to fetch a lot of entries at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best answer I can give without specifics—and the biggest win—is to do some caching with Craft's  &lt;a href=&quot;http://buildwithcraft.com/docs/templating/cache&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tags.  Using the cache will cause Craft to look in its already generated output instead of multiple trips to the db.   Anything that has a  &lt;code&gt;{% for %}&lt;/code&gt; loop block is likely going to generate a lot of db queries and is a good candidate for caching (like a navigation menu).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're already using caching, make sure you're doing it efficiently. Craft stores the &lt;strong&gt;output&lt;/strong&gt; of the cache tag so you need to put the tags around things that actually output something—you can't cache variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %} &#xA;    {% set whateverEntries = craft.entries.section('whatever') %}&#xA;{% endcache %}&#xA;&#xA;{% for theEntry in whateverEntries %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... won't cache anything.  But this would:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %} &#xA;    {% set whateverEntries = craft.entries.section('whatever') %}&#xA;    {% for theEntry in whateverEntries %}&#xA;        &amp;lt;h1&amp;gt;{{theEntry}}&amp;lt;/h1&amp;gt;&#xA;           {{theEntry.postExcerpt}}&#xA;         ...&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-11-04T17:27:48.910" LastActivityDate="2015-11-04T17:27:48.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12253" PostTypeId="1" AcceptedAnswerId="12255" CreationDate="2015-11-04T17:39:31.063" Score="2" ViewCount="1210" Body="&lt;p&gt;Having a bear of a time doing something which seems like it should be quite simple. I'm trying to display the category group name in my templates, using the handle and can't quite get it. I've explored the docs but haven't found much help there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ caseStudiesCategories }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error: Variable &quot;caseStudiesCategories&quot; does not exist&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%  set catName = craft.categories.group('caseStudiesCategories') %}&#xA;{{ catName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error: Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1019" LastActivityDate="2015-11-04T19:15:08.837" Title="Display Category Group Name in Template" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12254" PostTypeId="2" ParentId="12251" CreationDate="2015-11-04T17:52:32.553" Score="2" Body="&lt;p&gt;How are you setting permissions? Command prompt? (S)FTP? What user does php run under? Make sure there are no &lt;code&gt;open_basedir&lt;/code&gt; restrictions as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find out the user that php runs under as well as a bunch of other details right inside Craft: &lt;code&gt;http://server/admin/utils/phpinfo&lt;/code&gt; and look for &lt;code&gt;user/group&lt;/code&gt; and &lt;code&gt;open_basedir&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you're giving the &lt;code&gt;storage&lt;/code&gt; directory recursive permission as well. I would delete everything under &lt;code&gt;/storage&lt;/code&gt; manually...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /path/cms/craft/storage/ &amp;amp;&amp;amp; rm -r * &amp;amp;&amp;amp; chmod -R 777 . &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and then let Craft/php recreate the folders underneath.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-11-04T18:05:48.137" LastActivityDate="2015-11-04T18:05:48.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12255" PostTypeId="2" ParentId="12253" CreationDate="2015-11-04T19:09:01.727" Score="3" Body="&lt;p&gt;You're close! It's slightly counterintuitive but &lt;code&gt;group&lt;/code&gt; is a property of a category. So you need to grab the group from an actual category. This would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catName  = craft.categories.group('caseStudiesCategories').first.group %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically you're getting the first category in the group and grabbing the group name (you could also use &lt;code&gt;[0]&lt;/code&gt; instead of &lt;code&gt;.first&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your entry has a category field, you can access the group name in a similar fashion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catName = entry.yourCategoryField.first().group %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-11-04T19:15:08.837" LastActivityDate="2015-11-04T19:15:08.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12256" PostTypeId="1" AcceptedAnswerId="12257" CreationDate="2015-11-04T20:17:37.780" Score="3" ViewCount="433" Body="&lt;p&gt;I've got a channel named &quot;locations&quot; that has an entry fieldtype which allows me to select the corresponding store/brand (limited to 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I define the slug of the related entry in Entry URL Format of a locations channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final result should look like this: &lt;code&gt;{related-entry-slug}-{slug}&lt;/code&gt; of the location entry itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="57" LastEditDate="2015-11-04T21:01:52.837" LastActivityDate="2015-11-04T21:01:52.837" Title="Include related entry slug in URl" Tags="&lt;url&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12257" PostTypeId="2" ParentId="12256" CreationDate="2015-11-04T20:31:29.583" Score="2" Body="&lt;p&gt;Assuming your store/brand field handle in your new channel is &lt;code&gt;relatedEntryField&lt;/code&gt;, set your URL format when you're defining the channel section to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{relatedEntryField.first().slug}-{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That'll pull the slug from the first related entry, add the slug from your current entry, and populate your URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, relational fields are always &quot;arrays&quot; even if there's only one so you need &lt;code&gt;.first()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-11-04T20:31:29.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12258" PostTypeId="1" CreationDate="2015-11-04T21:09:33.013" Score="1" ViewCount="195" Body="&lt;p&gt;When adding products to cart, was not getting same error in past but don't recalling changing anything. Using mostly default templates.&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-11-04T21:09:33.013" Title="&quot;Error on creating empty cart&quot; Craft Commerce (Market Commerce)" Tags="&lt;plugins&gt;&lt;ecommerce&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2015-11-05T06:50:21.093" ContentLicense="CC BY-SA 3.0" />
  <row Id="12259" PostTypeId="1" CreationDate="2015-11-04T22:53:36.697" Score="2" ViewCount="122" Body="&lt;p&gt;We have a front-end form that allows users to update their profile photo. If a user attempts to upload a non-image file, instead of the actionSaveUser controller failing and throwing an error, it gets to $this-&gt;_processUserPhoto and then throws an Exception&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             {&#xA;200                 // Invalid SVG. Maybe it's missing its DTD?&#xA;201                 $svg = '&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&amp;gt;'.$svg;&#xA;202                 $this-&amp;gt;_image = $this-&amp;gt;_instance-&amp;gt;load($svg);&#xA;203             }&#xA;204         }&#xA;205         else&#xA;206         {&#xA;207             $imageInfo = @getimagesize($path);&#xA;208 &#xA;209             if (!is_array($imageInfo))&#xA;210             {&#xA;211                 throw new Exception(Craft::t('The file “{path}” does not appear to be an image.', array('path' =&amp;gt; $path)));&#xA;212             }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a more graceful way to handle this so I can return an error to the user instead?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="3454" LastEditDate="2015-11-04T23:04:37.343" LastActivityDate="2015-11-09T23:33:11.280" Title="Handling non-image uploads when updating user photo from front-end form" Tags="&lt;form&gt;&lt;user-profile&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12260" PostTypeId="2" ParentId="12259" CreationDate="2015-11-04T23:44:14.717" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2702&quot; rel=&quot;nofollow&quot;&gt;post 2.4.2702&lt;/a&gt;) Craft release, Craft will now return a validation error on the UserModel if a non-image is uploaded for the user's profile photo.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I consider this a bug in Craft and we've already got a ticket open to address it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until then, I can think of two options work work around it, either of them particularly pretty. 1. Hack core Craft files to do the detection. 2. Have some JavaScript on your upload form that detects the extension of the file they're trying to upload.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-09T23:33:11.280" LastActivityDate="2015-11-09T23:33:11.280" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12263" PostTypeId="1" CreationDate="2015-11-05T09:16:48.403" Score="3" ViewCount="357" Body="&lt;p&gt;Is there a plugin or something equivalent to Tablepress (WordPress) for Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some large Excel table containing product pricings amongst other things, that I would like to import into Craft and manage there.&lt;/p&gt;&#xA;" OwnerUserId="4303" LastActivityDate="2015-11-05T22:03:08.447" Title="Importing tables and Tablepress like plugin functionality" Tags="&lt;plugins&gt;&lt;import&gt;&lt;table&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12264" PostTypeId="2" ParentId="2932" CreationDate="2015-11-05T09:50:07.493" Score="3" Body="&lt;p&gt;Joining in at this point. We have some sites powered by Craft which need to get some updates. Its absolutely acceptable if the dev version is outdated regarding the content. Making content changes should not be our job, and we mostly work with placeholder and testing content anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole next procedure is optional, so enabling this behavior with a config param (or auto-enable when using dev-mode) might be the best idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best would be to write structural changes along with non-content-related settings like asset transforms, plugin settings etc into a file called &quot;_migrations.sql&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before pushing an update from &quot;dev&quot; to &quot;production&quot;, you simply need to press a &quot;increment database structure version&quot; button which then renames the file to &quot;migrations-($v+1).sql&quot;. Also the version number in the database gets incremented so the saved version number is directly up-to-date with latest migration file version number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an update then goes live, the production database will be behind latest migration file version and executes them like the craft migrations do, incrementing the structure version in database too. Database will be fully up-to-date at this point without overwriting or changing any entry or asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In combination with git we could put these migration files under version control so they get part of the commit without committing all the other trash that changed in the database while working on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as this is not possible from Craft itself, a dump must be made before and after changes are made and manually processed to create migration by hand, which also must be manually executed on production environment. Depending on the amount of changes this can be very frustrating and time consuming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making the web developers spend less time and struggling on daily problems would cause more time for more projects to be made with craft. A win-win situation on both sides.&lt;/p&gt;&#xA;" OwnerUserId="742" LastEditorUserId="57" LastEditDate="2015-11-05T16:33:20.000" LastActivityDate="2015-11-05T16:33:20.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12265" PostTypeId="1" AcceptedAnswerId="12273" CreationDate="2015-11-05T12:32:09.497" Score="1" ViewCount="100" Body="&lt;p&gt;So I'm in the middle of creating a plugin that allows users to make payments with GoCardless. Once payment has been made on the GoCardless website the user needs to be redirected to a PHP script that will confirm the payment was all hunkie-dorie... but....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do I put this script? At the moment I've put it inside a folder that is inside the htdocs folder but I'm having problems calling &lt;code&gt;craft()-&amp;gt;plugin_name-&amp;gt;confirmPayment()&lt;/code&gt; from this location as &lt;code&gt;craft()&lt;/code&gt; is undefined here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help greatly appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="57" LastEditDate="2015-11-05T18:11:17.210" LastActivityDate="2015-11-05T19:14:24.950" Title="Best practice for collecting a response from a third party" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12266" PostTypeId="1" AcceptedAnswerId="12275" CreationDate="2015-11-05T12:47:06.767" Score="2" ViewCount="494" Body="&lt;p&gt;I updated to the latest Craft version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This error shows under the field in entries (backend):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This field’s target subfolder path is invalid: {slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I checked the field and there is no &lt;code&gt;{slug}&lt;/code&gt; tag at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fronted shows images fine, but with that error I cannot update my entries.&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="57" LastEditDate="2015-11-05T18:29:03.820" LastActivityDate="2015-11-05T18:38:00.833" Title="Invalid path after Craft update" Tags="&lt;error-message&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12267" PostTypeId="2" ParentId="12263" CreationDate="2015-11-05T13:05:29.203" Score="2" Body="&lt;p&gt;How about &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;? It's a table field type.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2015-11-05T13:05:29.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12268" PostTypeId="2" ParentId="7187" CreationDate="2015-11-05T13:06:00.907" Score="3" Body="&lt;p&gt;Only setting headers in .htaccess doesn't fix the problem.&#xA;As &lt;a href=&quot;https://craftcms.stackexchange.com/users/130/marion-newlevant&quot;&gt;Marion Newlevant&lt;/a&gt; points out in her &lt;a href=&quot;https://craftcms.stackexchange.com/q/7187/4304&quot;&gt;answer&lt;/a&gt; the cross domain works with the headers set. But you still get a white page as a preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking further into the problem, I've found that the page tries to do a post request to the other domain.&#xA;It calls upon the action function &lt;strong&gt;actionPreviewEntry()&lt;/strong&gt; in the &lt;strong&gt;EntriesController.php&lt;/strong&gt; file (Location: &lt;strong&gt;/craft/app/controllers/&lt;/strong&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But because the user isn't logged in on the other domain and anonymous access isn't allowed for this action. You get redirected to /login to login on that domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with a quick solution for the problem. It's a bit dirty for now, but the authors of Craft aren't coming with a solution either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Delete (If you have set them) the headers for Access-Control-Allow in your .htaccess file. We don't need them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open the file EntriesController.php in the folder /craft/app/controllers/&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Replace the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;protected $allowAnonymous = array('actionViewSharedEntry');&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = array('actionViewSharedEntry','actionPreviewEntry');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Add the following code in the public function actionPreviewEntry():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set a boolean for logout admin user if cross-domain access&#xA;$crossDomainAccess = FALSE;&#xA;&#xA;// Check if the user isn't logged in. Likely meaning that the action is called from another domain.&#xA;if ( !craft()-&amp;gt;userSession-&amp;gt;isLoggedIn() ) {&#xA;&#xA;  // Get allowed origins&#xA;  $locales = array('en','nl');&#xA;  $allowedOrigins = array();&#xA;  foreach ( $locales as $locale ) {&#xA;    $allowedOrigins[] = craft()-&amp;gt;config-&amp;gt;getLocalized('siteUrl', $locale);&#xA;  }&#xA;&#xA;  // Check origin and give access if allowed&#xA;  $httpOrigin = $_SERVER['HTTP_ORIGIN'];&#xA;  if ( in_array($httpOrigin, $allowedOrigins) ) {&#xA;    header('Access-Control-Allow-Origin: ' . $httpOrigin);&#xA;    header('Access-Control-Allow-Credentials: true');&#xA;    craft()-&amp;gt;userSession-&amp;gt;loginByUserId(1);&#xA;    $crossDomainAccess = TRUE;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Explanation of the code:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see I set the locales to &lt;strong&gt;en&lt;/strong&gt; and &lt;strong&gt;nl&lt;/strong&gt;. Because that's the only locales for my website.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$locales = array('en','nl');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The domains that are allowed to communicate with each other are set in the general config file under siteUrl. See step 4 of the &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;localization guide&lt;/a&gt; for more information.&#xA;We will fetch them here and put them in an array for checking.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allowedOrigins = array();&#xA;foreach ( $locales as $locale ) {&#xA;    $allowedOrigins[] = craft()-&amp;gt;config-&amp;gt;getLocalized('siteUrl', $locale);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We check the origin of the request and if it's allowed to communicate with this domain. If so, then set the header to allow cross-domain access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And automatically login as the admin user to get full access for the preview page to load as if you are logged in on the other domain.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$httpOrigin = $_SERVER['HTTP_ORIGIN'];&#xA;if ( in_array($httpOrigin, $allowedOrigins) ) {&#xA;    header('Access-Control-Allow-Origin: ' . $httpOrigin);&#xA;    header('Access-Control-Allow-Credentials: true');&#xA;    craft()-&amp;gt;userSession-&amp;gt;loginByUserId(1);&#xA;    $crossDomainAccess = TRUE;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Next we need to logout the admin user on the other domain. Add the following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if ( $crossDomainAccess == TRUE ) {&#xA;  craft()-&gt;userSession-&gt;logout();&#xA;}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Before the line (In the same function, public function actionPreviewEntry()):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;_showEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that's it. A quickfix for anyone that has come across this problem and wants to fix it quick but dirty for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: If you update your craft cms, then this code will get deleted, so you have to add it again after you updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you're using baseCpUrl&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slight modification if you're using the baseCpUrl setting and/or have paths in your settings file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( !craft()-&amp;gt;userSession-&amp;gt;isLoggedIn() ) {&#xA;&#xA;  // Get allowed origins&#xA;  $allowedOrigins = array(&#xA;          parse_url(craft()-&amp;gt;config-&amp;gt;get('baseCpUrl'), PHP_URL_HOST),&#xA;          parse_url(craft()-&amp;gt;config-&amp;gt;getLocalized('siteUrl', 'en_us'), PHP_URL_HOST)&#xA;  );&#xA;&#xA;  // Check origin and give access if allowed&#xA;  $httpOrigin = parse_url($_SERVER['HTTP_ORIGIN'], PHP_URL_HOST);&#xA;  if ( in_array($httpOrigin, $allowedOrigins) ) {&#xA;          header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);&#xA;          header('Access-Control-Allow-Credentials: true');&#xA;          craft()-&amp;gt;userSession-&amp;gt;loginByUserId(1);&#xA;          $crossDomainAccess = TRUE;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I've hard-coded the language in, but it can be combined with the answer above instead.&lt;/p&gt;&#xA;" OwnerUserId="4304" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-02-08T02:12:26.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12270" PostTypeId="1" AcceptedAnswerId="12271" CreationDate="2015-11-05T15:47:48.140" Score="2" ViewCount="62" Body="&lt;p&gt;I have a Structure section with an ordered number of entries under a parent. On each entry I would like to add a status message of the user's current progress... i.e. &lt;code&gt;You are on page 1 of 5 pages.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total was easy... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set total = entry.getParent(entry).getDescendants().count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get the current page (child) number within the total number of children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4306" LastEditorUserId="57" LastEditDate="2015-11-05T18:39:04.223" LastActivityDate="2015-11-05T18:39:04.223" Title="How can I create a status message of X of TOTAL pages under a parent?" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12271" PostTypeId="2" ParentId="12270" CreationDate="2015-11-05T17:42:09.393" Score="1" Body="&lt;p&gt;I assuming the pages are one level down from the parent?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parent&#xA;  | Child (1)&#xA;  | Child (2)&#xA;  | ... etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topLevel =  entry.parent %}&#xA;{% set totalPages = topLevel.getDescendants().count() %}      &#xA;{% set entryIds = topLevel.getDescendants()|group('id')  %}&#xA;{% set currentPageNumber = (entryIds|keys)|indexOf(entry.id) + 1 %} &#xA;&#xA;{{currentPageNumber }} of {{totalPages}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically we're making an array (list) out of just the entry IDs by grabbing the descendants from the parent. Then we use Craft's group function to give us an array, grouped by key (in this case the ID). Since we know the current page's ID, we can find it in the array and return its position. Since arrays are indexed starting with 0, we just add 1 to it.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-11-05T17:42:09.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12272" PostTypeId="2" ParentId="12270" CreationDate="2015-11-05T17:59:16.267" Score="1" Body="&lt;p&gt;You can get the position number within your branch with a &lt;code&gt;craft.entries&lt;/code&gt; element criteria model and the following parameters set:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#id&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;id&lt;/code&gt;&lt;/a&gt; – to search only in the current branch, pass the current entry's siblings IDs&lt;br&gt;&#xA;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.entries#positionedBefore&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;positionedBefore&lt;/code&gt;&lt;/a&gt; – set this param to get entries positioned before the current entry&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = entry.getParent() %}&#xA;{% set siblingsIds = parent.getChildren().ids() %}&#xA;{% set total = siblingsIds|length %}&#xA;&#xA;{% set positionedBefore = craft.entries.id(siblingsIds).positionedBefore(entry).order('lft desc') %}&#xA;{% set position = positionedBefore.total() + 1 %}&#xA;&#xA;{{ position }} / {{ total }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-05T17:59:16.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12273" PostTypeId="2" ParentId="12265" CreationDate="2015-11-05T18:26:29.160" Score="1" Body="&lt;p&gt;After the payment has been made, you can have the response callback go to an &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow&quot;&gt;anonymous&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers#linking-directly-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;action method&lt;/a&gt; on your &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin's&lt;/a&gt; &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL for that would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mydomain.com/index.php/actions/myPluginHanlde/myPluginController/myPluginAction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you can perform any additional business logic (validation, record saving, etc.), and &lt;code&gt;$this-&amp;gt;redirect('');&lt;/code&gt; to a success template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-05T19:14:24.950" LastActivityDate="2015-11-05T19:14:24.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12274" PostTypeId="2" ParentId="12263" CreationDate="2015-11-05T18:35:18.040" Score="4" Body="&lt;p&gt;How do you plan to manage it in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want each row as a separate entry, create a section to hold the data, setup the fields you want to use to match each column, then use &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bob Olde Hampsink's import plugin&lt;/a&gt; to bring in the data. The plugin allows you to map the data to the fields in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft supports &lt;a href=&quot;http://buildwithcraft.com/docs/table-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;tables&lt;/a&gt; natively but you need a way to import them. You can use Bob's import plugin but you'll need to use the plugin's hooks to get the data where you want it. Tables in Craft are &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6889/inserting-data-into-a-table-fieldtype-via-plugin&quot;&gt;stored as JSON&lt;/a&gt; so you have to do some data wresting. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-05T22:03:08.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12275" PostTypeId="2" ParentId="12266" CreationDate="2015-11-05T18:38:00.833" Score="2" Body="&lt;p&gt;In whatever Section you're getting that error in, you've got an &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields&quot; rel=&quot;nofollow&quot;&gt;Assets field&lt;/a&gt; inside of &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;Matrix&lt;/a&gt; (or possibly &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;SuperTable&lt;/a&gt;) and that Assets field has “&lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#restricting-uploads-to-a-single-folder&quot; rel=&quot;nofollow&quot;&gt;Restrict uploads to a single folder&lt;/a&gt;” set and you've got a &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow&quot;&gt;dynamic subfolder path&lt;/a&gt; setup for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that dynamic path, you're using &lt;code&gt;{slug}&lt;/code&gt; when you should be using &lt;code&gt;{owner.slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that if you are creating the Assets field within a Matrix field, the source element is going to be the actual Matrix block, not the element that the Matrix field is being created on. So if your Matrix field is attached to an entry, and you want to output the entry ID in your dynamic subfolder path, you would type {owner.id} not just {id}.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-05T18:38:00.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12276" PostTypeId="1" AcceptedAnswerId="12278" CreationDate="2015-11-05T19:13:41.927" Score="1" ViewCount="768" Body="&lt;p&gt;We're having a problem logging in the Craft admin tool @ &lt;a href=&quot;https://www.clearlabs.com/admin&quot; rel=&quot;nofollow&quot;&gt;https://www.clearlabs.com/admin&lt;/a&gt; when we have more than one server in the cluster.&#xA;After submitting credentials, Craft seems to keep 302-bouncing infinitely between &lt;a href=&quot;https://www.clearlabs.com/admin/login&quot; rel=&quot;nofollow&quot;&gt;https://www.clearlabs.com/admin/login&lt;/a&gt; and &lt;a href=&quot;https://www.clearlabs.com/admin/dashboard&quot; rel=&quot;nofollow&quot;&gt;https://www.clearlabs.com/admin/dashboard&lt;/a&gt;.&#xA;The few times we are able to log in, we seem to get kicked out of our session back into an infinite redirect loop.&#xA;Note this does not affect our website, but only the admin web app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon review of the literature, we tried to set &lt;code&gt;overridePhpSessionLocation=false&lt;/code&gt;, but it doesn't seem to help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please confirm the configuration requirements for Craft clustering and/or give us some thoughts on what might be going on?&#xA;Thank you,&#xA;Cyril&lt;/p&gt;&#xA;" OwnerUserId="4307" LastEditorUserId="57" LastEditDate="2015-11-05T19:35:12.813" LastActivityDate="2015-11-05T22:41:51.330" Title="Craft admin login infinite redirect in cluster" Tags="&lt;redirect&gt;&lt;login&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12277" PostTypeId="2" ParentId="9800" CreationDate="2015-11-05T19:15:29.600" Score="0" Body="&lt;p&gt;We are using the twig filter like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;| replace({'http://s3-us-west-2.amazonaws.com/cranberrynm':'http://d15jwbqszojdqk.cloudfront.net'}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-11-05T19:15:29.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12278" PostTypeId="2" ParentId="12276" CreationDate="2015-11-05T19:37:10.907" Score="2" Body="&lt;p&gt;&lt;strong&gt;TL/DR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you need to enable sticky sessions at your load-balancer/router level, so that the users will be sent back to the same server in the cluster that their session originated on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The long version&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.x, every new user gets new &lt;a href=&quot;https://secure.php.net/manual/en/book.session.php&quot; rel=&quot;nofollow&quot;&gt;PHP session&lt;/a&gt; represented by a file on your web server and a cookie in your browser.  By default PHP names that cookie &lt;code&gt;PHPSESSID&lt;/code&gt;, but Craft will default set it to &lt;code&gt;CraftSessionId&lt;/code&gt;, although you can configure its name with the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#phpSessionName&quot; rel=&quot;nofollow&quot;&gt;phpSessionName&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP has a way to use &lt;a href=&quot;https://secure.php.net/manual/en/session.configuration.php#ini.session.use-cookies&quot; rel=&quot;nofollow&quot;&gt;sessions without cookies&lt;/a&gt; providing a way to append a unique session ID to the querystring of a URL, but (for many reasons), Craft doesn't support that method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to the PHP session cookie, Craft will create an identity cookie upon a successful login that has a randomly generated name similar to &lt;code&gt;4190d8c6874f8615f88325f5b285fc40&lt;/code&gt;. That cookie is how Craft keeps track that you're successfully authenticated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with load-balanced setups that don't use sticky sessions is that with all of these default settings, when a session is started on server A and then a user is bounced to server B, server B has no knowledge of the session because it was created on server A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are ways around it, of course, the easiest being to enable stick sessions at the load balancer level, ensuring that users will get sent back to the server their session was started on for the lifetime of that session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if sticky sessions aren't your thing, you can configured a shared network storage location and tell each web server to use it for its &lt;a href=&quot;https://secure.php.net/manual/en/session.configuration.php#ini.session.save-path&quot; rel=&quot;nofollow&quot;&gt;session.save_path&lt;/a&gt;, ensuring they all have access to all server-side session files.  If you go this route, you'll also want to set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;appId&lt;/a&gt; config setting to be identical across all web servers, since it is used in decrypting cookie data (including sessions).  By default it it is randomly generated per Craft installation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-05T22:41:51.330" LastActivityDate="2015-11-05T22:41:51.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12279" PostTypeId="2" ParentId="12244" CreationDate="2015-11-05T21:18:46.460" Score="3" Body="&lt;p&gt;Thanks for asking about this, Cole!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was a bug that was causing &lt;code&gt;rsortAs&lt;/code&gt; to return erroneous results. The issue is fixed in the &lt;strong&gt;1.0&lt;/strong&gt; release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://michaelrog.com/craft/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;Grab yourself a fresh copy&lt;/a&gt; and you should be squared away.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-11-05T21:18:46.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12280" PostTypeId="2" ParentId="12231" CreationDate="2015-11-05T23:13:48.997" Score="0" Body="&lt;p&gt;Turns out there was a bug in Craft that prevented a scenario like the one you're trying to achieve from happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been fixed for the next (post &lt;a href=&quot;http://buildwithcraft.com/updates#build2702&quot; rel=&quot;nofollow&quot;&gt;2.4.2702&lt;/a&gt;) release, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-05T23:13:48.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12283" PostTypeId="1" AcceptedAnswerId="12298" CreationDate="2015-11-06T12:09:11.397" Score="2" ViewCount="340" Body="&lt;p&gt;I have a custom field for a user which is an asset, it has the users larger profile photo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an entry template I can get their profile photo using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.getPhotoUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to get the custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.authorImage }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am sure I am missing something very simple?&lt;/p&gt;&#xA;" OwnerUserId="3661" LastActivityDate="2015-11-07T23:04:03.933" Title="How can I get an entries author custom field?" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12284" PostTypeId="1" AcceptedAnswerId="12285" CreationDate="2015-11-06T13:40:05.637" Score="6" ViewCount="414" Body="&lt;p&gt;Is there a way to make the dump() function available in my plugin templates when devMode is disabled?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-11-06T13:45:12.247" Title="Make dump() available when devMode is disabled" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12285" PostTypeId="2" ParentId="12284" CreationDate="2015-11-06T13:45:12.247" Score="4" Body="&lt;p&gt;Add this to your plugin/controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;config-&amp;gt;get('devMode'))&#xA;{&#xA;    craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;addExtension(new \Twig_Extension_Debug());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Thanks to the all-knowing Brandon Kelly, who posted the solution on Slack.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2015-11-06T13:45:12.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12286" PostTypeId="2" ParentId="12283" CreationDate="2015-11-06T14:18:35.463" Score="1" Body="&lt;p&gt;Ah it would of been handy if I had of entered the assets loop!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for asset in entry.author.authorImage %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; alt=&quot;{{ entry.author.getFullName }}&quot;&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3661" LastActivityDate="2015-11-06T14:18:35.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12287" PostTypeId="1" AcceptedAnswerId="12288" CreationDate="2015-11-06T14:53:02.697" Score="1" ViewCount="1267" Body="&lt;p&gt;I'm trying to figure out how to exclude a Channel, Structure or Singles from my search results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have the default example from Craft&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-11-06T15:09:36.943" Title="How do I exclude a Channel, Structure or Singles from search?" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ClosedDate="2015-11-06T20:11:43.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="12288" PostTypeId="2" ParentId="12287" CreationDate="2015-11-06T15:09:36.943" Score="8" Body="&lt;p&gt;This should work for a single section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('not news').search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to exclude more sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section([&#xA;    'and', 'not news', 'not blog'&#xA;]).search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-06T15:09:36.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12289" PostTypeId="1" AcceptedAnswerId="12290" CreationDate="2015-11-06T18:34:42.773" Score="1" ViewCount="37" Body="&lt;p&gt;I'm currently building a plugin that uses a table that contains rows with an 'active' field set to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an admin deletes a user from the system, I want to change this value to 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found an 'onUserDelete' event documented but can't work out where or how to use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT UPDATED:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now have this code in the init() function of my plugin controller but deleting a user does not seem to fire the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.onDeleteUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        $userId = $user-&amp;gt;id; // ???????&#xA;&#xA;        $craft-&amp;gt;memberships_membership-&amp;gt;cancelMembershipById($userId);&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="4242" LastEditDate="2015-11-06T19:37:16.693" LastActivityDate="2015-11-06T19:37:16.693" Title="How can I tap into onUserDelete?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12290" PostTypeId="2" ParentId="12289" CreationDate="2015-11-06T18:43:54.360" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; on events, they follow this pattern:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('component.eventName', function(Event $event) {&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in your example, it'd be something like this and you'd want to add it to your plugin's &lt;code&gt;init()&lt;/code&gt; method in the main plugin class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.onDeleteUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        $userToTransferContentTo = $event-&amp;gt;params['transferContentTo']&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The full list of available events and the parameters they have can be found &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-06T19:26:00.333" LastActivityDate="2015-11-06T19:26:00.333" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12291" PostTypeId="1" AcceptedAnswerId="12294" CreationDate="2015-11-06T18:49:59.047" Score="2" ViewCount="246" Body="&lt;p&gt;I'm looping through the rows of a table field and hoping to target a specific field entry based on the &lt;code&gt;loop.index&lt;/code&gt;. Here's a simplified example of what that might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.table %}   &#xA;   {% set foo = entry.field ~ loop.index %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The doesn't work, but I’m curious if I just have the syntax wrong or if I’m thinking about this the wrong way.&lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2015-11-07T10:42:50.830" Title="Is it possible to use a loop variable to target a specific field entry?" Tags="&lt;variable&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12292" PostTypeId="2" ParentId="12291" CreationDate="2015-11-06T18:58:47.853" Score="1" Body="&lt;p&gt;Turns out Twig has a nifty little &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;attribute function&lt;/a&gt; that does the trick. Here's how it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.table %}   &#xA;   {% set foo = attribute(entry, 'fieldHandle' ~ loop.index) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Big hat tip to &lt;a href=&quot;https://craftcms.stackexchange.com/users/57/brad-bell&quot;&gt;Mr. Brad Bell&lt;/a&gt; for posting the original answer in Stack Exchange. &lt;/p&gt;&#xA;" OwnerUserId="588" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-06T18:58:47.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12294" PostTypeId="2" ParentId="12291" CreationDate="2015-11-07T10:31:04.183" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#variables&quot; rel=&quot;nofollow&quot;&gt;subscript syntax&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry['field' ~ loop.index] }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or the &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ attribute(entry, 'field' ~ loop.index) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attribute function is more Twig-like in my opinion. But in this case it's only a matter of preference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other examples are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ myArray[0] }}&lt;/code&gt; vs. &lt;code&gt;{{ myArray|first }}&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;{{ myString[0:1] }}&lt;/code&gt; vs. &lt;code&gt;{{ myString|slice(0, 1) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-11-07T10:42:50.830" LastActivityDate="2015-11-07T10:42:50.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12295" PostTypeId="1" CreationDate="2015-11-07T11:49:45.433" Score="1" ViewCount="50" Body="&lt;p&gt;Is there an easy way of disabling the 'transfer content to' option when deleting a user from the admin portal? In my use case, I want users content to always be completely deleted when they are removed from the site.&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="130" LastEditDate="2015-11-08T00:04:33.570" LastActivityDate="2016-01-07T21:38:17.603" Title="Option for removing 'transfer content to' when deleting a user?" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12296" PostTypeId="1" AcceptedAnswerId="12297" CreationDate="2015-11-07T13:09:22.367" Score="7" ViewCount="1213" Body="&lt;p&gt;Say I'm building a plugin that adds user memberships to the website. I want to check on my front end templates that user's membership is active and I have built the functionality inside the plugin to do this.&lt;/p&gt;&#xA;&lt;p&gt;How do I use a tag like &lt;code&gt;{% requireMembership %}&lt;/code&gt; in place of the normal &lt;code&gt;{% requireLogin %}&lt;/code&gt; to call the function that I've built? I thought it would be simple but can't find documentation on this anywhere.&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="4242" LastEditDate="2020-06-26T08:02:05.867" LastActivityDate="2020-07-07T01:01:39.243" Title="How do you create a custom Twig tag?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12297" PostTypeId="2" ParentId="12296" CreationDate="2015-11-07T15:18:57.670" Score="12" Body="&lt;p&gt;There are two classes behind each Twig tag: a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#defining-a-token-parser&quot;&gt;Token Parser&lt;/a&gt; and a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#defining-a-node&quot;&gt;Node&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Token Parser is responsible for actually parsing the template, once Twig has tokenized it, and returning your Node class to represent it. The Node class is responsible for compiling itself into actual PHP code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% requireLogin %}&lt;/code&gt; is about as simple as it gets, because it doesn’t have to worry about parsing parameters, expressions, sub-content, etc. You can use its Token Parser and Node classes as a starting point - they’re located in craft/app/etc/templating/twigextensions/.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you’ve created those classes, you will need to create a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension&quot;&gt;Twig Extension&lt;/a&gt;, which will be used to connect your TokenParser to Craft’s instance of Twig. Give it a getTokenParsers() method which returns an instance of your Token Parser class (&lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#id4&quot;&gt;example&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that if you use the &lt;code&gt;Craft&lt;/code&gt; namespace in these clasess, you will need to prefix all of Twig’s class names with &lt;code&gt;\&lt;/code&gt;, e.g. &lt;code&gt;\Twig_TokenParser&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally you need to register your Twig Extension from your plugin’s primary class using the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference#addTwigExtension&quot;&gt;addTwigExtension&lt;/a&gt; hook:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function addTwigExtension()&#xA;{&#xA;    // Import the Twig Extension, Token Parser, and Node classes&#xA;    Craft::import('plugins.mypluginfolder.MyTwigExtension');&#xA;    Craft::import('plugins.mypluginfolder.MyTokenParser');&#xA;    Craft::import('plugins.mypluginfolder.MyNode');&#xA;&#xA;    // Return a new instance of it&#xA;    return new MyTwigExtension();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-11-07T17:48:31.953" LastActivityDate="2015-11-07T17:48:31.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12298" PostTypeId="2" ParentId="12283" CreationDate="2015-11-07T17:54:55.863" Score="1" Body="&lt;p&gt;Your answer with a &lt;code&gt;for&lt;/code&gt; loop works but if you know there's only one image associated with that field, you can simplify your code using &lt;code&gt;.first()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;img src=&quot;{{ entry.author.authorImage|length ? entry.author.authorImage.first().getUrl() : '/images/userprofiledefault.jpg' }}&quot; alt=&quot;{{ entry.author.getFullName }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Think of assets (and relationships in general) as a &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields#templating&quot; rel=&quot;nofollow&quot;&gt;container&lt;/a&gt; that can hold more than one asset (or relationship). That's why you need to tell Craft &lt;em&gt;which&lt;/em&gt; one you want—even if there's only one. Your &lt;code&gt;for&lt;/code&gt; loop works because it's looping through that object (technically an ElementCriteriaModel object).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-11-07T23:04:03.933" LastActivityDate="2015-11-07T23:04:03.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12299" PostTypeId="1" AcceptedAnswerId="12583" CreationDate="2015-11-07T21:58:24.340" Score="1" ViewCount="169" Body="&lt;p&gt;The site has 5 locales targeting &lt;code&gt;'en_gb', 'fr_fr', 'de_de', 'it_it', 'es_es'&lt;/code&gt;. &#xA;When I'm at &lt;code&gt;site.com&lt;/code&gt; it gets current locale correctly &lt;code&gt;en_gb&lt;/code&gt;. When I visit &lt;code&gt;site.com/fr/&lt;/code&gt; locale, It loads blank page with current locale &lt;code&gt;en_gb&lt;/code&gt;. The same scenario repeats for all locales, except the top level local &lt;code&gt;en_gb&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went through my settings multiple times, but I still wasn't able to find a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;general.php&lt;/code&gt; settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(   &#xA;&#xA;// Local environment&#xA;'site.craft.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'sitePath' =&amp;gt; '/OS/Applications/MAMP/sites/site.craft.dev/public/',&#xA;        'siteUrl' =&amp;gt; 'http://site.craft.dev/'&#xA;        ),&#xA;    'siteUrl' =&amp;gt;  array(&#xA;        'en_gb' =&amp;gt; 'http://site.craft.dev/',&#xA;        'fr_fr' =&amp;gt; 'http://site.craft.dev/fr/',&#xA;        'de_de' =&amp;gt; 'http://site.craft.dev/de/',&#xA;        'it_it' =&amp;gt; 'http://site.craft.dev/it/',&#xA;        'es_es' =&amp;gt; 'http://site.craft.dev/es/',&#xA;        ),&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Public folders are structured  and set according to &lt;a href=&quot;http://buildwithcraft.com/docs/localization-guide#step-5-set-up-the-files&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;, named after locale's handles like that: &lt;code&gt;fr_fr&lt;/code&gt;, &lt;code&gt;de_de&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with &lt;code&gt;$craftPath&lt;/code&gt; variable set to necessary &lt;code&gt;handle&lt;/code&gt; like &lt;code&gt;fr_fr&lt;/code&gt;, &lt;code&gt;de_de&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I visit site.craft.dev/fr/ and ask for current locale by &lt;code&gt;{{ craft.i18n.getCurrentLocale() }}&lt;/code&gt;, it gives me default locale &lt;code&gt;en_gb&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-11-17T11:29:32.990" LastActivityDate="2015-11-29T18:18:49.640" Title="Visiting any locale gives the same locale output" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12300" PostTypeId="1" AcceptedAnswerId="12319" CreationDate="2015-11-08T01:01:46.547" Score="1" ViewCount="94" Body="&lt;p&gt;I've created an &lt;a href=&quot;http://buildwithcraft.com/docs/assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Source&lt;/a&gt; and assigned my own field via the field layout. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I created an &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets Field&lt;/a&gt; to display a single image on a page. Using my plugins twig extension I can query the image object like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.featuredImage.first()|myTwigExt }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, in the Twig extension I want to target the first instance of my field using its Type, not the Handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cx87s.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cx87s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is because the handle can be defined by the user, but the type name is always the same. I want to &lt;strong&gt;avoid&lt;/strong&gt; the need to parse in the field handle along with the Twig Extension like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.featuredImage.first()|myTwigExt('notThis') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this is even possible, my ideal situation would have my Twig Extension looking something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function getFilters() {&#xA;    return array(&#xA;      'myTwigExt' =&amp;gt; new Twig_Filter_Method($this, 'myTwigExtension'),&#xA;    );&#xA;  }&#xA;&#xA;  public function myTwigExtension($image, $param) {&#xA;   if ( $image-&amp;gt;type('myCustomField') ) {&#xA;     // YAY!&#xA;     return $image-&amp;gt;type('myCustomField')-&amp;gt;someDataFromMyField;&#xA;   }&#xA;&#xA;   if ( $image-&amp;gt;$param ) {&#xA;     // &quot;Boo!&quot;;&#xA;     return $image-&amp;gt;$param-&amp;gt;someDataFromMyField;&#xA;   }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the cleanest way I can ask this question. Without going into too much detail about my plugin (which would just confuse the situation more). &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2015-11-09T18:42:16.330" Title="Is it possible to target a fieldtype by it's Type name, rather than the handle name?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12301" PostTypeId="1" AcceptedAnswerId="12303" CreationDate="2015-11-08T09:33:09.263" Score="1" ViewCount="963" Body="&lt;p&gt;I've looked everywhere for this functionality and am very surprised that I can't find it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a plugin that allows auto posting of entry content to Facebook/Twitter/Other social media channel when the user hits Save?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there isn't, then I'll build one.&lt;/p&gt;&#xA;" OwnerUserId="4242" LastActivityDate="2015-11-08T16:20:47.037" Title="Auto Post to Facebook/Twitter" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12302" PostTypeId="1" CreationDate="2015-11-08T15:30:52.007" Score="1" ViewCount="96" Body="&lt;p&gt;I've created a Channel with templates &lt;code&gt;blog/index&lt;/code&gt; and &lt;code&gt;blog/_entry&lt;/code&gt;. Template &lt;code&gt;blog/index&lt;/code&gt; will list the blog articles and &lt;code&gt;blog/_entry&lt;/code&gt; will display individual blog articles. I want to have meta title/description and some intro text on the &lt;code&gt;blog/index&lt;/code&gt; page that is managed by Craft. How can this be done?&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="57" LastEditDate="2015-11-08T21:24:25.207" LastActivityDate="2015-11-08T21:24:25.207" Title="How do I add meta title/description and intro text to a Channel index page?" Tags="&lt;channels&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12303" PostTypeId="2" ParentId="12301" CreationDate="2015-11-08T16:20:47.037" Score="2" Body="&lt;p&gt;I wrote a plugin that posts to Buffer.com (which is free for up to very reasonable levels of activity).  Buffer in turn allows you to post to Facebook, Twitter, LinkedIn, Google+, etc.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/khalwat/buffer&quot; rel=&quot;nofollow&quot;&gt;https://github.com/khalwat/buffer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use it on several sites to do exactly what you describe.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-08T16:20:47.037" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12304" PostTypeId="2" ParentId="12302" CreationDate="2015-11-08T17:00:50.470" Score="1" Body="&lt;p&gt;From the docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singles are used for one-off pages that have unique content requirements, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;home page&lt;/li&gt;&#xA;&lt;li&gt;an About Us page &lt;/li&gt;&#xA;&lt;li&gt;a Contact Us page&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unlike the other section types, Singles only have one entry associated with them, and they don’t have an editable Author, Slug, Post Date, or Expiration Date.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So create the fields you need, create a new single for your index page, add the fields to the single, set the single to load your index template, then code your new fields into the template &lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-11-08T17:00:50.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12305" PostTypeId="2" ParentId="12295" CreationDate="2015-11-08T21:22:46.323" Score="1" Body="&lt;p&gt;I can't think of a clean way without hacking core Craft files (which is generally not advisable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like a reasonable &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-08T21:22:46.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12309" PostTypeId="1" CreationDate="2015-11-09T10:06:04.800" Score="4" ViewCount="213" Body="&lt;p&gt;Inside the CP, is it possible to pull the ID for the current field layout being rendered (both in the Field Layout Designer and in element editing forms)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A bit of context:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm writing a plugin which adds functionality to the built-in Field Layout Designer. The extra functionality basically allow admins to add metadata when they are editing field layouts. This metadata is stored in a custom table, using the field layout's ID as FK. The idea is that whenever a field layout is rendered (either inside the FLD, or when an element is edited/created) the plugin should pull the metadata for the current field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modifying the FLD UI is easy – when the plugin loads, I basically check the DOM (with jQuery) for a FLD container. If a container is found, the plugin loads up a script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saving the metadata is also easy; the plugin hooks into &lt;code&gt;fields.saveFieldLayout&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('fields.saveFieldLayout', function (Event $e) {&#xA;    $myPluginModel = new MyPlugin_MyPluginModel();&#xA;    $myPluginModel-&amp;gt;fieldLayoutId = $e-&amp;gt;params['fieldLayout']-&amp;gt;id;&#xA;    $myPluginModel-&amp;gt;metadata = craft()-&amp;gt;request-&amp;gt;getPost('myPlugin.metadata');&#xA;    craft()-&amp;gt;myPlugin-&amp;gt;saveStuff($myPluginModel);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The hard part is querying for the relevant metadata whenever a field layout is rendered, because &lt;em&gt;I can't find a way to pull the currently rendered field layout's ID&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's ideas I've explored/solutions that doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Neither the FLD nor the element editing forms expose their field layout's ID to the the DOM.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I've looked at the HttpRequestService to see if the field layout ID (or any other data I could use to query for the field layout ID) could be pulled from the request.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I've tried accessing the current controller class via &lt;code&gt;craft()-&amp;gt;controller&lt;/code&gt; – thinking if I could get to the current element type I might be able to pull the field layout from its model, but &lt;code&gt;craft()-&amp;gt;controller&lt;/code&gt; is always &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I've attempted to pull the global Twig context (via &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;twig&lt;/code&gt;) to look for the &lt;code&gt;fieldLayout&lt;/code&gt; variable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ideally, I wouldn't want to pull the relevant metadata client side (i.e. with AJAX), but I did also look at the global Craft JS object to look for clues, but found nothing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Parsing the request path and storing the ID of the entry type, asset source, category group etc. along with the field layout ID would work. I'd like to avoid this, because it makes it impossible to support custom element types without hard coding stuff.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If it isn't possible – by any means – to pull the current field layout ID, the alternative approach is to somehow figure out which element type is being edited, then pull that element type's model and finally get the field layout model/ID from there. Ideally, I'd like to do this without having to hard code attribute names (i.e. &lt;code&gt;entryTypeId&lt;/code&gt;, &lt;code&gt;categoryGroupId&lt;/code&gt; etc), because I want this to work for any custom element type, too. Any suggestions in this regard is very welcome, as well.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-11-11T16:15:20.280" LastActivityDate="2015-11-11T22:48:24.693" Title="Pulling the currently rendered field layout inside the CP" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12310" PostTypeId="1" CreationDate="2015-11-09T10:08:20.923" Score="3" ViewCount="1110" Body="&lt;pre&gt;&lt;code&gt;'api/looks/list' =&amp;gt; [&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'looks'],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;                //print_r($entry-&amp;gt;getAncestors());&#xA;                // $model = $entry-&amp;gt;content-&amp;gt;attributeConfigs[&quot;featuredImage&quot;][&quot;model&quot;];&#xA;                // echo 'class type: ' . get_class($model);&#xA;                // print_r($model);&#xA;&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;looks/{$entry-&amp;gt;id}.json&quot;),&#xA;                'kachelgroesse' =&amp;gt; $entry-&amp;gt;kachelgroesse,&#xA;                'category' =&amp;gt; $entry-&amp;gt;category,&#xA;                'image' =&amp;gt; $entry-&amp;gt;image&#xA;            ];&#xA;        },&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my &lt;code&gt;elementapi.php&lt;/code&gt; file and it returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;data&quot;: [&#xA;    {&#xA;      &quot;title&quot;: &quot;SHINY AND RED LIPS&quot;,&#xA;      &quot;id&quot;: &quot;281&quot;,&#xA;      &quot;url&quot;: &quot;http://craft.dev:8888/looks/shiny-and-red-lips&quot;,&#xA;      &quot;jsonUrl&quot;: &quot;http://craft.dev:8888/looks/281.json&quot;,&#xA;      &quot;kachelgroesse&quot;: {&#xA;        &quot;0&quot;: {&#xA;          &quot;label&quot;: &quot;mittel&quot;,&#xA;          &quot;value&quot;: &quot;mittel&quot;,&#xA;          &quot;selected&quot;: true&#xA;        }&#xA;      },&#xA;      &quot;category&quot;: {&#xA;        &quot;0&quot;: {&#xA;          &quot;label&quot;: &quot;Make-Up&quot;,&#xA;          &quot;value&quot;: &quot;Make-Up&quot;,&#xA;          &quot;selected&quot;: true&#xA;        }&#xA;      },&#xA;      &quot;image&quot;: {}&#xA;    }&#xA;  ],&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no image returning.  I am requesting the list of all entries and their image/asset location from the API.&lt;/p&gt;&#xA;" OwnerUserId="4297" LastEditorUserId="57" LastEditDate="2015-11-09T17:49:10.250" LastActivityDate="2021-03-01T17:38:47.100" Title="How can I get image locations in a list of entries using the Element API plugin?" Tags="&lt;assets&gt;&lt;plugin-elementapi&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12311" PostTypeId="1" CreationDate="2015-11-09T11:24:45.743" Score="1" ViewCount="60" Body="&lt;p&gt;Anyone experienced this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a dev site set up which we updated to 2.4.2702. After updating one of my section channels has disappeared from the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries for the channel are still showing and I can see the channel set up in &lt;code&gt;craft_sections&lt;/code&gt; on the database so any ideas what has happened to it and why it is no longer in the CMS?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="45" LastEditDate="2015-11-09T19:55:08.963" LastActivityDate="2015-11-09T19:56:19.207" Title="Updating Craft removed a channel from the CMS?" Tags="&lt;database&gt;&lt;channels&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12312" PostTypeId="2" ParentId="12311" CreationDate="2015-11-09T12:23:04.280" Score="1" Body="&lt;p&gt;This was resolved with the above comments from @mmikkel&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Craft Personal is limited to a single channel. Your license.key file must've been overwritten/deleted somehow when you updated – which is weird unless this was a manual update? In any case, if you have purchased a license and don't have a copy of the license.key file you'll need to contact support@buildwithcraft.com to restore it. If this is a dev build and you haven't purchased a license, just click the upgrade link in the CP footer and then the &quot;Test&quot; button under Craft Pro in the modal that appears.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="45" LastEditDate="2015-11-09T19:56:19.207" LastActivityDate="2015-11-09T19:56:19.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12313" PostTypeId="1" CreationDate="2015-11-09T12:29:28.620" Score="8" ViewCount="14151" Body="&lt;p&gt;I use a pre-processor to generate my CSS. I would like to include the resulting file inline, rather than as a link. Is there a way of doing this  via the twig tags in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could move the CSS file to the templates folder, so that I could use the include function, but is that the only and/or preferred method of achieving what I want to do? Or am I just best moving the inlining into my pre-processing? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="160" LastActivityDate="2016-08-14T18:38:10.930" Title="Include CSS file inline rather than as a link" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12314" PostTypeId="2" ParentId="12313" CreationDate="2015-11-09T12:51:00.123" Score="11" Body="&lt;p&gt;To simple insert raw CSS into a template from a file, you'll want to use Twig's &lt;code&gt;source&lt;/code&gt; function. So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;style&amp;gt;{{ source('file.css') }}&amp;lt;/style&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For that file to be located somewhere outside of the templates folder, you'll have two options.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a symlink to the file or its folder in the templates folder. Twig will be none the wiser.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a Path to the existing template loader in Craft. This will require a custom plugin, and some digging to see how the loader is referenced in Craft. But in the end, your command will look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$loader-&gt;addPath('path/to/other/files');&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The really cool part is that paths can have namespaces in Twig. You can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$loader-&amp;gt;addPath('path/to/public', 'public');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that let's you do this in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ source('@public/css/site.css') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditDate="2015-11-10T13:12:04.107" LastActivityDate="2015-11-10T13:12:04.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12315" PostTypeId="1" AcceptedAnswerId="12316" CreationDate="2015-11-09T13:22:02.620" Score="1" ViewCount="253" Body="&lt;p&gt;I have a search form on a website to search through all the entries of the website and return the entries that match the search query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the search query is also used on asset fields within an entry. Which for the companies channel results in many entries found when you search on the word: logo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to know if there is a way to search through all the fields of an entry, but without looking through the asset field type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the companies example, I only want to find entries that match the word: logo. When that word is in the content text, and not in an asset name/title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code now is this, but it returns the asset fieldtype result as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({ section: 'not comments' }).search( query ).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4304" LastActivityDate="2015-11-09T17:22:56.763" Title="Entries search without using asset fields" Tags="&lt;entries&gt;&lt;assets&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12316" PostTypeId="2" ParentId="12315" CreationDate="2015-11-09T17:22:56.763" Score="1" Body="&lt;p&gt;As suggested in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2198/excluding-fields-in-a-search&quot;&gt;this stack post&lt;/a&gt;, you could specify each field individually. I haven't done this with fields, but often do so with sections and entry types in global site searches. It is kind of annoying, but I'm not sure there is a way to do this using Craft's API.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-09T17:22:56.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12317" PostTypeId="1" CreationDate="2015-11-09T17:30:23.560" Score="1" ViewCount="66" Body="&lt;p&gt;Is there scope for updating the Entries fieldtype so that only sections editable by the user are shown in the pop-up modal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously don't want to go changing the core files, but some digging suggests that a simple change to the &lt;code&gt;getSources&lt;/code&gt; method in &lt;code&gt;/craft/app/elementtypes/EntryElementType.php&lt;/code&gt; should do the trick, eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($sectionsByType[$type] as $section) {&#xA;    $key = 'section:'.$section-&amp;gt;id;&#xA;    $valid = craft()-&amp;gt;userSession-&amp;gt;checkPermission('publishEntries:'.$section-&amp;gt;id);&#xA;    if ($valid == 1) {&#xA;        $sources[$key] = array(&#xA;            'label'    =&amp;gt; Craft::t($section-&amp;gt;name),&#xA;            'data'     =&amp;gt; array('type' =&amp;gt; $type, 'handle' =&amp;gt; $section-&amp;gt;handle),&#xA;            'criteria' =&amp;gt; array('sectionId' =&amp;gt; $section-&amp;gt;id, 'editable' =&amp;gt; $editable)&#xA;        );                      &#xA;        …&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-11-09T17:30:23.560" Title="Entries fieldtype" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;elementtype&gt;&lt;entries-field&gt;&lt;modal&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12318" PostTypeId="2" ParentId="4220" CreationDate="2015-11-09T17:50:25.797" Score="0" Body="&lt;p&gt;You could use Craft's relations API and try something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.relatedTo(entry.relatedEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, one thing I have noticed with this approach is that it does &lt;strong&gt;not&lt;/strong&gt; return duplicate images. For example, lets say you have two related entries in your single's entries field, and each of those entries have the same image, it will only return the image once. This could be either positive or negative depending on what you want to do with the data.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-09T17:50:25.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12319" PostTypeId="2" ParentId="12300" CreationDate="2015-11-09T18:42:16.330" Score="2" Body="&lt;p&gt;I am not sure if I am understanding your question correctly, so here is my understanding before I give my solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to be able to access a field on an asset by it's field type rather than it's handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this understanding, here is my solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not been able to accomplish this using Craft relations. However, you can loop through the fields attached to the asset, and check their type. It is a little bit confusing as Craft stores the data for fields and field layouts across several tables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An element has a field layout (&lt;a href=&quot;https://buildwithcraft.com/classreference/models/FieldLayoutModel&quot; rel=&quot;nofollow&quot;&gt;FieldLayoutModel&lt;/a&gt;), and the layout then has fields (&lt;a href=&quot;https://buildwithcraft.com/classreference/models/FieldLayoutFieldModel&quot; rel=&quot;nofollow&quot;&gt;FieldLayoutFieldModels&lt;/a&gt;). Then each of those FieldLayoutFieldModels has fields (&lt;a href=&quot;https://buildwithcraft.com/classreference/models/FieldModel&quot; rel=&quot;nofollow&quot;&gt;FieldModel&lt;/a&gt;) which are the actual fields we are looking for. Putting this together, we can loop through and check the field type like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // get the fieldLayoutModel&#xA;    $fieldLayoutModel = $image-&amp;gt;fieldLayout;&#xA;&#xA;    // get array of FieldLayoutFieldModel&#xA;    $fieldLayoutFields = $fieldLayoutModel-&amp;gt;fields;&#xA;&#xA;    foreach($fieldLayoutFields as $fieldLayoutField){&#xA;&#xA;        // get the field associated with the layout&#xA;        $field = $fieldLayoutField-&amp;gt;field;&#xA;        if($field-&amp;gt;type == 'myFieldType'){&#xA;            // do whatever&#xA;            break;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this is what you were looking for!&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-09T18:42:16.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12320" PostTypeId="1" AcceptedAnswerId="12321" CreationDate="2015-11-09T19:01:59.600" Score="2" ViewCount="101" Body="&lt;p&gt;When a user visits on an old or expired email activation link, how do we control which page is loaded? In my case it's rendering a template named error.twig, but I'm not sure how that's set or where to change it. &lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2015-11-09T20:22:46.577" Title="Controlling where user is sent if clicking old or expired email activation link" Tags="&lt;emails&gt;&lt;redirect&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12321" PostTypeId="2" ParentId="12320" CreationDate="2015-11-09T20:22:46.577" Score="4" Body="&lt;p&gt;It looks like the config setting &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#users&quot; rel=&quot;nofollow&quot;&gt;activateAccountFailurePath&lt;/a&gt; is what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-09T20:22:46.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12322" PostTypeId="1" AcceptedAnswerId="12323" CreationDate="2015-11-09T20:59:42.183" Score="0" ViewCount="895" Body="&lt;p&gt;Is it possible to change how the password reset box appears when a user requests a password reset? Ideally we would like to include the same functionality but within a page that we have control over so that it looks like the same website users are used to.&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2015-11-09T22:59:39.633" Title="Possible to change style of password reset page" Tags="&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12323" PostTypeId="2" ParentId="12322" CreationDate="2015-11-09T21:05:07.107" Score="1" Body="&lt;p&gt;Set the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#setPasswordPath&quot; rel=&quot;nofollow&quot;&gt;setPasswordPath&lt;/a&gt; config setting to a template in your &lt;code&gt;craft/templates&lt;/code&gt; folder and you style the page however you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form itself would need to be similar to the &quot;&lt;a href=&quot;http://buildwithcraft.com/docs/templating/set-password-form&quot; rel=&quot;nofollow&quot;&gt;Set Password Form&lt;/a&gt;&quot; template example in the docs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-09T22:59:39.633" LastActivityDate="2015-11-09T22:59:39.633" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12324" PostTypeId="2" ParentId="12247" CreationDate="2015-11-09T23:23:46.643" Score="0" Body="&lt;p&gt;While not a direct answer to your question, as of the next (&lt;a href=&quot;http://buildwithcraft.com/updates#build2702&quot; rel=&quot;nofollow&quot;&gt;post 2.4.2702&lt;/a&gt;) Craft release, Craft will now return a validation error on the UserModel if a non-image is uploaded for the user's profile photo.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-09T23:23:46.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12325" PostTypeId="2" ParentId="12309" CreationDate="2015-11-09T23:52:34.877" Score="3" Body="&lt;p&gt;It looks like EntryTypeModels have a fieldLayoutId attribute. By inspecting the route params, we can get the entry type ID, and then create a model from that. Other than this, I haven't been able to find anything passed to the FLD.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $params = craft()-&amp;gt;urlManager-&amp;gt;getRouteParams();&#xA;    $variables = $params['variables'];&#xA;    $matches = $variables['matches'];&#xA;    $entryTypeId = $matches['entryTypeId'];&#xA;    $entryType = EntryTypeRecord::model()-&amp;gt;findById($entryTypeId);&#xA;    $fieldLayoutId = $entryType-&amp;gt;fieldLayoutId;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also found that a fieldLayoutModel is passed to the &lt;code&gt;fieldlayoutdesigner.html&lt;/code&gt; template when it is included. See the include in &lt;code&gt;templates/settings/section/_entrytypes/edit.html&lt;/code&gt; as an example. Content from the &lt;code&gt;FieldLayoutModel&lt;/code&gt; is then loaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you said you would rather not load with ajax, but it is definitely better than nothing. I don't see any hook or event that gives you access to this information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var fieldLayoutId = '{{ fieldLayout.id|e('js') }}';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from within your included js file and then go pull your metadata via ajax.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="4216" LastEditDate="2015-11-11T22:48:24.693" LastActivityDate="2015-11-11T22:48:24.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12326" PostTypeId="1" CreationDate="2015-11-10T01:00:34.527" Score="1" ViewCount="270" Body="&lt;p&gt;I am pulling assets from the work section like this-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;header_image&quot;&amp;gt;&#xA;  {% for entry in craft.entries.section('work').limit(5) %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;  &#xA;            &amp;lt;div class=&quot;mainImage&quot; style=&quot;background-image:url({{ asset.url }})&quot;&amp;gt; &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt; &#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Asset isn't appearing on the page but if I hover over where the image should, the link is working properly and I can to get that entry. The asset.url isn't working and I'm not sure what else it should be. Any ideas? &lt;/p&gt;&#xA;" OwnerUserId="4322" LastEditorUserId="1016" LastEditDate="2015-11-10T19:45:46.923" LastActivityDate="2015-11-10T19:45:46.923" Title="Asset not appearing" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12327" PostTypeId="2" ParentId="12326" CreationDate="2015-11-10T01:21:31.353" Score="2" Body="&lt;p&gt;Make sure you know the asset exists first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.asset.first() %}&#xA;  &amp;lt;div class=&quot;mainImage&quot; style=&quot;background-image:url({{ entry.asset.first().url }})&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another nifty trick is to enable &quot;dev mode&quot;. This will give you detailed stack traces about what's going wrong in your instance! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/config-settings#devMode&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2015-11-10T01:21:31.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12328" PostTypeId="2" ParentId="12326" CreationDate="2015-11-10T02:57:00.033" Score="1" Body="&lt;p&gt;Your issue is that you are calling &lt;code&gt;asset.url&lt;/code&gt; rather than &lt;code&gt;entry.asset.first.url&lt;/code&gt;. The variable 'asset' does not exist. The asset is a field of the entry, and must be referenced as such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I assumed your field name was called 'asset'. You should be calling entry.assetFieldHandle.first.url.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="4216" LastEditDate="2015-11-10T15:39:05.797" LastActivityDate="2015-11-10T15:39:05.797" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12330" PostTypeId="1" AcceptedAnswerId="12339" CreationDate="2015-11-10T09:20:34.110" Score="4" ViewCount="359" Body="&lt;p&gt;I'd like to use prefetching (All) or prerendering (Chrome only) to speed up my website performance. It pre-loads websites to instantly load them when navigating to them. Google does it for its #1 Searchresults.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;link rel=&quot;prerender&quot; href=&quot;{{ url('mysubpage') }}&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;prefetch&quot; href=&quot;{{ url('mysubpage') }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://css-tricks.com/prefetching-preloading-prebrowsing/&quot; rel=&quot;nofollow&quot;&gt;css-tricks.com/prefetching-preloading-prebrowsing/&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The browser is initializing a prefetch as I can see in my DevTools, but when visiting the page, there is still another normal page load happening instead of using the cached version. I wonder if this is because Craft CMS is returning the HTTP Header &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on every response? Does this prevent the prefetching? Does it make sense to disable this headers? I didn't found any mention on cache headers being a problem when using &lt;code&gt;&amp;lt;link rel=&quot;prefetch&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for some insights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Robert&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="4226" LastEditDate="2015-11-10T14:30:35.273" LastActivityDate="2015-11-12T09:45:23.040" Title="Using prefetch or prerender" Tags="&lt;templating&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12331" PostTypeId="1" CreationDate="2015-11-10T09:52:55.983" Score="1" ViewCount="248" Body="&lt;p&gt;So my client want to have superscript and subscript buttons in the redactor toolbar like this :&lt;br&gt;&#xA;&lt;a href=&quot;https://imperavi.com/redactor/examples/buttons-sup-and-sub/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/examples/buttons-sup-and-sub/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ryOLU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ryOLU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2691/how-can-i-use-small-sub-sub-within-a-redactor-rich-text-field&quot;&gt;Stack Exchange post here&lt;/a&gt; but it is just talking about the shortcuts and the way of making a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding the plugin directly in Craft Redactor config file &lt;code&gt;plugins: ['fullscreen','video','table','scriptbuttons'],&lt;/code&gt; but of course did not work so easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Got Craft 2.4.2699. Is it possible ?&lt;br&gt;&#xA;Is it on the Craft roadmap ?&lt;br&gt;&#xA;Or should I make a feature request ?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-11-11T12:07:55.260" Title="Display rich text redactor menubar with superscript/subscript buttons" Tags="&lt;redactor&gt;&lt;plugin-redactorclips&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12333" PostTypeId="1" CreationDate="2015-11-10T12:50:59.017" Score="1" ViewCount="468" Body="&lt;p&gt;The following is within the index template on a site in production:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set domain = craft.request.getServerName() %}&#xA;{% if domain starts with 'subdomain' %}&#xA;    {% include 'subdomain/index' %}&#xA;{% else %}&#xA;    {% include 'homepage' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works without any problem on that server. I've just copied the site over to a another server for development, but that same code seems to be responsible for a 500 error. The following works, so I think it's to do with Twig's &lt;code&gt;start with&lt;/code&gt; conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set domain = craft.request.getServerName() %}&#xA;{% if domain == 'subdomain.domain.com' %}&#xA;    {% include 'subdomain/index' %}&#xA;{% else %}&#xA;    {% include 'homepage' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming it's a PHP setting - does anyone know which?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-02-09T12:10:05.580" Title="Twig's 'start with' conditional returns 500 error" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;php&gt;&lt;server&gt;&lt;request&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12334" PostTypeId="1" AcceptedAnswerId="12336" CreationDate="2015-11-10T13:50:22.793" Score="0" ViewCount="234" Body="&lt;p&gt;Could number for example &lt;code&gt;7.5&lt;/code&gt; be created in number field?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-11-10T15:34:28.910" Title="Can I create a number with decimal point in number field?" Tags="&lt;number&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12335" PostTypeId="2" ParentId="12247" CreationDate="2015-11-10T14:55:13.760" Score="0" Body="&lt;p&gt;After a lot of head-desking, and some input from a colleague, we realised the issue wasn't in the controller but in the form action declaration. I originally had&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;pluginname/controller/action&quot;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Changing it to this, seems to have resolved it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;pluginname/controller/action&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user4041" LastActivityDate="2015-11-10T14:55:13.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12336" PostTypeId="2" ParentId="12334" CreationDate="2015-11-10T15:34:28.910" Score="3" Body="&lt;p&gt;As per the &lt;a href=&quot;http://buildwithcraft.com/docs/number-fields&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;, there is a setting where you can specify how many decimal places are allowed. So yes, 7.5 can be represented in a number field.&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-10T15:34:28.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12337" PostTypeId="1" AcceptedAnswerId="12340" CreationDate="2015-11-10T15:54:03.340" Score="1" ViewCount="379" Body="&lt;p&gt;I'm trying to find a way to extend the meta fields inside a custom field definition. To illustrate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a &lt;code&gt;min_vis&lt;/code&gt; &lt;code&gt;def_vis&lt;/code&gt; and &lt;code&gt;max_vis&lt;/code&gt; column for each field (or anytime a new one is added). Preferably these would be right under the &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;handle&lt;/code&gt;, &lt;code&gt;instructions&lt;/code&gt; text fields. So in this illustration below, there would be a select box added for each of these 3 new meta (or columns) after the instructions meta field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wNcOu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wNcOu.png&quot; alt=&quot;where extra fields should appear&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it probably isn't a good idea to modify the core stuff, including the fields table, so should I use a plugin to define some a new model and record? Should I extend the form for fields registration to add these additional attributes as select boxes? Should I give the new attributes their own table (via record class) and set &lt;code&gt;BELONGS_TO&lt;/code&gt; where they are related to each field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4yrLX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4yrLX.png&quot; alt=&quot;column list&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a better way to approach this, or if I'm pushing to hard for something custom no worries just give me a heads up that I shouldn't be extending the core fields attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10191/how-can-i-add-attributes-to-craft-field&quot;&gt;I did look at this issue but wasn't sure if it actually pertained to my question?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="269" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-10T18:04:01.887" Title="Add or extend attributes (table column) to fields table" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12338" PostTypeId="1" CreationDate="2015-11-10T16:13:50.620" Score="1" ViewCount="64" Body="&lt;p&gt;I have saved an asset to the Assets tab in Craft and successfully uploaded it into an article I'm creating. I deleted the picture it was replacing, and then uploaded it. It saves in draft, but doesn't show up when I look in the preview. All other stuff (like copy I wrote) DOES show up, so I know it's an asset issue. Please advise, thank you!&lt;/p&gt;&#xA;" OwnerUserId="4327" LastActivityDate="2015-11-11T21:22:20.217" Title="Asset saves in Draft but not showing up in Preview - help!" Tags="&lt;entries&gt;&lt;assets&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12339" PostTypeId="2" ParentId="12330" CreationDate="2015-11-10T17:38:21.770" Score="3" Body="&lt;p&gt;Per &lt;a href=&quot;https://craftcms.stackexchange.com/a/2600/1016&quot;&gt;Brad's answer&lt;/a&gt;, PHP is setting the cache control headers on the start of a new user session. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to override this, Craft provides the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/header&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% header %}&lt;/a&gt; tag where you can set your own headers. Whether or not that affects Chrome, I couldn't say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other thing to note is cookies. &lt;a href=&quot;https://support.google.com/chrome/answer/1385029?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;This page&lt;/a&gt; mentions &quot;prerendered or prefetched [pages] may set and read their own cookies as if you had visited them before -- even if you don’t visit the prerendered or prefetched pages after all&quot; which seems to imply it'll use the current page's headers for prefetch requests. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do any cookie-based server-side tracking or analytics with Craft, that could wreck a little havoc. (Say your funnel is &quot;load XXX page and then load the contact page.&quot; You'd be wondering why people visited the contact page but never filled it out.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use prerender, it looks like Chrome will actually &lt;a href=&quot;https://www.chromium.org/developers/design-documents/prerender&quot; rel=&quot;nofollow noreferrer&quot;&gt;execute&lt;/a&gt; any javascript on the page as well, which would also defeat any JS based analytics packages.) Scary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For what it's worth, I haven't tested any of these techniques at all but it would be interesting to see what kind of mainstream traction they receive. I can see for a web app it might be more useful.)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-11-10T18:16:01.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12340" PostTypeId="2" ParentId="12337" CreationDate="2015-11-10T18:04:01.887" Score="0" Body="&lt;p&gt;I'd probably re-think my approach.  Creating/extending a field type will give plugins access to the settings area below the horizontal rule in your screenshot, but that's on a per-field type basis and Craft doesn't provide a way to hook into where you're looking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are &lt;code&gt;min_vis&lt;/code&gt;, &lt;code&gt;def_vis&lt;/code&gt;, and &lt;code&gt;max_vis&lt;/code&gt; actually being used for?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-10T18:04:01.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12343" PostTypeId="2" ParentId="12333" CreationDate="2015-11-11T11:20:58.377" Score="1" Body="&lt;p&gt;I was able to reproduce this without the &lt;code&gt;starts with&lt;/code&gt;, and editing the usual PHP settings which cause problems with uploading assets sorted this out.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-11-11T11:20:58.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12344" PostTypeId="2" ParentId="11141" CreationDate="2015-11-11T12:02:00.260" Score="1" Body="&lt;p&gt;The definitive and most simple answer for all Redactor Inline Styles requests is this great plugin from carlcs:&#xA;&lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/carlcs/craft-redactorinlinestyles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/koRZi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/koRZi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-11-11T12:02:00.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12345" PostTypeId="2" ParentId="12331" CreationDate="2015-11-11T12:07:55.260" Score="1" Body="&lt;p&gt;The definitive and most simple answer for all &lt;strong&gt;Redactor Inline Styles&lt;/strong&gt; requests is this great plugin by &lt;strong&gt;carlcs&lt;/strong&gt;:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/carlcs/craft-redactorinlinestyles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just perfect!&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rxCAQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rxCAQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(found it thanks to this post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9812/how-to-add-a-non-breaking-space-to-a-rich-text-field&quot;&gt;How to add a non-breaking space to a rich text field?&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-11-11T12:07:55.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12347" PostTypeId="1" CreationDate="2015-11-11T17:34:39.923" Score="0" ViewCount="165" Body="&lt;p&gt;I'm moving my site from one host to another, and I'm having some trouble moving my craft site over. I have all of the files moved, and in the config file I'm pointing to the new database which I've imported over already. But when I go to the site or the admin url I'm getting a 500 error. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="4333" LastActivityDate="2015-12-11T22:57:44.473" Title="Migrating a Craft site to a different host." Tags="&lt;database&gt;&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12348" PostTypeId="1" CreationDate="2015-11-11T20:15:12.100" Score="0" ViewCount="347" Body="&lt;p&gt;I like the setting &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt;. Is there something similar to log in users after a password reset?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can approximate this by using the &lt;code&gt;users.onSetPassword event&lt;/code&gt;, confirming the user isn't already logged in (i.e. using a normal set password form), and confirming that the user model doesn't have an unverifiedEmail value (i.e. is a brand new user), and then using &lt;code&gt;craft-&amp;gt;userSession-&amp;gt;loginByUserId()&lt;/code&gt; but this seems like a very roundabout and potentially stupid way to do this.&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2016-04-09T16:31:39.077" Title="Auto login after password reset?" Tags="&lt;login&gt;&lt;password&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12349" PostTypeId="2" ParentId="12347" CreationDate="2015-11-11T21:11:46.797" Score="1" Body="&lt;p&gt;Per the OP's comment, there was a database connection error in the Craft log files. Once that was corrected it solved the 500 Internal Server Error.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-11T21:11:46.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12350" PostTypeId="2" ParentId="12348" CreationDate="2015-11-11T21:14:05.563" Score="1" Body="&lt;p&gt;Currently nothing native like that. The full list of Craft config settings can be found &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to consider adding this as a &lt;a href=&quot;https://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-11T21:14:05.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12352" PostTypeId="1" AcceptedAnswerId="12449" CreationDate="2015-11-11T22:57:35.967" Score="1" ViewCount="337" Body="&lt;p&gt;I'm trying to to display entries related to &quot;all&quot; the given categories instead of &quot;any&quot; using the updated relatedTo method provided in Craft 2.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2747/perform-inclusive-relatedto-query-with-multiple-categories/2795#comment17006_2795&quot;&gt;related question&lt;/a&gt;, @BrandonKelly explains how to do this in the &quot;Updated&quot; portion of his answer. However, I still seem to be getting &quot;any&quot; behavior instead of entries matching &quot;all&quot; categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example URL if only one category in the Social Services group is selected&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://website.com/technologies/someSocialService&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an example URL if additional technology categories are also added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://website.com/technologies/someSocialService?type[]=88&amp;amp;type[]=117&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, ideally, I want to first filter the entries by the social service category, determined by segment 2 in the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I want to filter even further if there are types of technology in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.getSegment(2) %}&#xA;{% set socialServiceCategory = craft.categories.group('socialServices').slug(slug).first() %}&#xA;{% set socialServiceCategoryId = socialServiceCategory.id %}&#xA;&#xA;{% set technologyCategoryIds = [] %}&#xA;{% if craft.request.getParam('type') %}&#xA;{% set technologyCategoryIds = technologyCategoryIds|merge(craft.request.getParam('type')) %}&#xA;{% endif %}&#xA;&#xA;{% set categoryIds = [socialServiceCategoryId]|merge(technologyCategoryIds) %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'solutions',&#xA;    relatedTo: { &#xA;        targetElement: ['and']|merge(categoryIds)&#xA;    }&#xA;}).order('listingType desc', 'title asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the page loads with only the segment slug, and no query string, I get entries filtered by that category. However, once I add one or more technology IDs to the categoryIds array, I get all entries matching &quot;any&quot; categories in the categoryIds array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a URL such as the 2nd example I displayed above, here is a dump of my categoryIds output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(3) { [0]=&amp;gt; string(2) &quot;15&quot; [1]=&amp;gt; string(2) &quot;88&quot; [2]=&amp;gt; string(3) &quot;117&quot; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which contains &lt;em&gt;exactly&lt;/em&gt; the right categories I'd like to inclusively relate my entries to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the time being, I was able to get this working the way I need with pre-Craft 2.5 beta syntax for relatedTo using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entries.relatedTo(socialServiceCategoryId).order('listingType desc', 'title asc') %}&#xA;&#xA;{% if technologyCategoryIds|length %}&#xA;{% set entries = entries.relatedTo(&#xA;    'and',&#xA;    { targetElement: socialServiceCategoryId },&#xA;    { targetElement: technologyCategoryIds|join(',') }&#xA;).order('listingType desc', 'title asc') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="335" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-11-18T17:50:56.587" Title="Perform inclusive relatedTo query with multiple categories in Craft 2.5+" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="3" CommentCount="0" ClosedDate="2015-11-23T17:22:14.947" ContentLicense="CC BY-SA 3.0" />
  <row Id="12353" PostTypeId="1" CreationDate="2015-11-12T05:48:54.970" Score="2" ViewCount="173" Body="&lt;p&gt;I've created a custom fieldtype... which is basically a button that triggers an AJAX action. When I add this field to my section, I can click the button while I'm editing an entry to perform an action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the thing... &lt;strong&gt;How can I tell if the entry needs to be saved?&lt;/strong&gt; Clearly Craft is aware of whether an entry is unsaved or not, because it'll warn you before navigating away from the page. Is it possible for my button to tap into that same behavior?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MORE INFO:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This button does not take people away from the page, so I'm not sure if &lt;code&gt;data-confirm-unload&lt;/code&gt; really comes into play here. If the entry is unsaved, the button will be replaced with a message saying, &quot;you must first save the entry&quot;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-11-12T07:52:39.493" LastActivityDate="2016-01-08T18:55:49.810" Title="JS - Determine that an entry is unsaved?" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12354" PostTypeId="2" ParentId="12330" CreationDate="2015-11-12T09:45:23.040" Score="1" Body="&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the fetching only works if the returned page is cachable, so I override the headers with the &lt;code&gt;{% header %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expiry = now|date_modify('+2 minute') %}&#xA;{% header &quot;Cache-Control: max-age=&quot; ~ (expiry.timestamp - now.timestamp) %}&#xA;{% header &quot;Pragma: cache&quot; %}&#xA;{% header &quot;Expires: &quot; ~ expiry|date('D, d M Y H:i:s', 'GMT') ~ &quot; GMT&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I now set this on every craft template (respectively on the main layout template) and cache it for two minutes. This gives a lot of performance boost and and allows any kind of prefetching. And with two minutes, outdated content won't be too much of a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To deal with the statistic problem: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firefox sets a HTTP Header &lt;code&gt;X-moz: prefetch&lt;/code&gt; on all prefetch requests, which can be used to distinguish prefetch requests from real site views.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chrome sets a HTTP Header &lt;code&gt;Purpose:prefetch&lt;/code&gt;. I didn't check how IE is dealing with prefetch requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As prefetching is actually &lt;a href=&quot;http://caniuse.com/#feat=link-rel-prefetch&quot; rel=&quot;nofollow&quot;&gt;supported&lt;/a&gt; by FF, Chrome and IE &gt;=11, I think it is a very useful, performance boosting optimization. It should be used sparely and wisely though.&lt;/p&gt;&#xA;" OwnerUserId="4226" LastActivityDate="2015-11-12T09:45:23.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12355" PostTypeId="1" AcceptedAnswerId="12452" CreationDate="2015-11-12T09:45:55.117" Score="2" ViewCount="218" Body="&lt;p&gt;Okay, I want to create a Matrix based layout like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;| x | x | x |&#xA;| x |   y   |&#xA;|   y   | x |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X&lt;/code&gt; is a 1/3 column and &lt;code&gt;Y&lt;/code&gt; is a 2/3 column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to activate the size &lt;code&gt;Y&lt;/code&gt; with a lightswitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is: If I have &lt;code&gt;| x | x |   y   |&lt;/code&gt; the layout will blow up because there are too many columns so when the column amount is 3/3 I want to create a new row so all is nice and tidy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea was to add a number to each column and when the maximum number is reached, there will be a new row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That code doesn't work. I just want to show the idea.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set x = 33.33 %}&#xA;{% set y = 66.66 %}&#xA;&#xA;{% for block in entry.this %}&#xA;  {% if x + y = 100 %}&amp;lt;div class=&quot;row&quot;&amp;gt;{% endif %}&#xA;    {# content #}&#xA;  {% if x + y = 100 %}&amp;lt;/div&amp;gt;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I can get all variables and add them up it should be possible. But how do I get the variables from each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody know what I'm talking about? Other solutions?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2015-11-12T16:38:35.723" LastActivityDate="2015-11-19T12:51:53.627" Title="Determine a layout based on column number" Tags="&lt;templating&gt;&lt;layout&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12356" PostTypeId="1" AcceptedAnswerId="12361" CreationDate="2015-11-12T10:01:10.810" Score="1" ViewCount="815" Body="&lt;p&gt;How do I filter entries by URL parameters. The url is &lt;code&gt;/booking?month=november&amp;amp;year=2015&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('availability').order('availabilityStartDate').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;availabilityStartDate&lt;/code&gt; is a date field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I return entries that match November and 2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any ideas or code!&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="1098" LastEditDate="2015-11-19T09:47:37.493" LastActivityDate="2015-11-19T09:47:37.493" Title="How do I use URL parameters to filter a channel by a date field?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12357" PostTypeId="1" AcceptedAnswerId="12360" CreationDate="2015-11-12T10:28:59.317" Score="1" ViewCount="256" Body="&lt;p&gt;I've run into situation, where I have to loop only once, if condition has met the requirements. The condition is controlled by matrix block field &lt;code&gt;ligthswitch&lt;/code&gt; which is the field in &lt;code&gt;finish&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix structure:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vC6JD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vC6JD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I've ended up doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.productSettings.type('finish') %}&#xA;   {% if block.inStock %}&#xA;      {{ block.amazonUri }}&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which outputs cluster of characters: &lt;code&gt;123456&lt;/code&gt;.&#xA;Bear in mind, that total count of characters is count of loops. Desire output is &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2015-11-14T15:35:14.780" LastActivityDate="2015-11-14T15:41:34.447" Title="Output first matching matrix block model if condition is true" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12359" PostTypeId="2" ParentId="12352" CreationDate="2015-11-12T14:27:15.030" Score="0" Body="&lt;p&gt;I can't test right now but just looking at this, could it be because your array has indexes whereas Brandon's demo is only the list of ids..?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-12T14:27:15.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12360" PostTypeId="2" ParentId="12357" CreationDate="2015-11-12T14:46:48.173" Score="3" Body="&lt;p&gt;Can't something like this help you?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.type('fruits').ligthswitchField(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-12T14:46:48.173" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12361" PostTypeId="2" ParentId="12356" CreationDate="2015-11-12T14:47:12.063" Score="5" Body="&lt;p&gt;You can pull query string variables using the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/HttpRequestService&quot; rel=&quot;nofollow&quot;&gt;HttpRequestService&lt;/a&gt;, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.query('month') %}&#xA;{% set year = craft.request.query('year') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you'll need to construct a DateTime object from those query parameters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryDate = date([month, year]|join(' ')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and finally, include that date object in the criteria for &lt;code&gt;craft.entries&lt;/code&gt; (notice the &lt;code&gt;&amp;gt;=&lt;/code&gt; operator, which means we should get entries with a &lt;code&gt;availabilityStartDate&lt;/code&gt; value equal or higher to the &lt;code&gt;queryDate&lt;/code&gt; date object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('availability').order('availabilityStartDate').availabilityStartDate('&amp;gt;= ' ~ queryDate.date).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering out entries with date field values matching the queried month and year &lt;em&gt;exactly&lt;/em&gt; is a bit more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are probably several ways to approach this, but a thing that works is to use both a start date (i.e. the first day of the queried month) as well as an end date (i.e. the last day of the queried month) for the criteria. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being that the &lt;code&gt;queryDate&lt;/code&gt; variable actually already refers to the first day of the queried month, we'll just need to add 1 month for the end date:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryStartDate = date([month, year]|join(' ')) %}&#xA;{% set queryEndDate = queryStartDate.date|date_modify('+1 month') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's the element criteria with both date object statements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('availability ').order('availabilityStartDate').availabilityStartDate('and', '&amp;gt;= ' ~ queryStartDate.date, '&amp;lt; ' ~ queryEndDate.date).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's everything together, for cohesion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get month and year query parameters #}&#xA;{% set month = craft.request.query('month') %}&#xA;{% set year = craft.request.query('year') %}&#xA;&#xA;{# Create DateTime objects for the start date and end date (+1 month) #}&#xA;{% set queryStartDate = date([month, year]|join(' ')) %}&#xA;{% set queryEndDate = queryStartDate.date|date_modify('+1 month') %}&#xA;&#xA;{# Get the entries #}&#xA;{% set allEntries = craft.entries.section('availability ').order('availabilityStartDate').availabilityStartDate('and', '&amp;gt;= ' ~ queryStartDate.date, '&amp;lt; ' ~ queryEndDate.date).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PS: When you have multiple parameters to &lt;code&gt;craft.entries&lt;/code&gt; like this, you might want to consider the object syntax for readability:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries({&#xA;    section : 'availability',&#xA;    order : 'availabilityStartDate',&#xA;    availabilityStartDate : 'and, &amp;gt;= ' ~ queryStartDate.date ~ ', &amp;lt; ' ~ queryEndDate.date,&#xA;    limit : null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-11-13T18:40:39.707" LastActivityDate="2015-11-13T18:40:39.707" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12362" PostTypeId="2" ParentId="12310" CreationDate="2015-11-12T15:05:50.470" Score="3" Body="&lt;p&gt;This should work for the images and you can easily adapt to do your categories &amp;amp; kachelgroesse if needed (not tested)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/looks/list' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['section' =&amp;gt; 'looks'],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        $images = [];&#xA;        foreach ($entry-&amp;gt;featuredImage as $image) {&#xA;        $images[] = $image-&amp;gt;url;&#xA;        }&#xA;        return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;looks/{$entry-&amp;gt;id}.json&quot;),&#xA;        'kachelgroesse' =&amp;gt; $entry-&amp;gt;kachelgroesse,&#xA;        'category' =&amp;gt; $entry-&amp;gt;category,&#xA;        'image' =&amp;gt; $images&#xA;        ];&#xA;    },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="6628" LastEditDate="2017-06-16T17:43:18.587" LastActivityDate="2017-06-16T17:43:18.587" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12363" PostTypeId="1" AcceptedAnswerId="12372" CreationDate="2015-11-12T15:48:55.330" Score="0" ViewCount="77" Body="&lt;p&gt;I'm trying to work out the best way to administer this. The point of the system I'm building is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A front-end system which contains &lt;code&gt;Events&lt;/code&gt;, &lt;code&gt;Partners&lt;/code&gt; and &lt;code&gt;Users&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Each &lt;code&gt;User&lt;/code&gt; is associated with one &lt;code&gt;Partner&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Each &lt;code&gt;Event&lt;/code&gt; allows each &lt;code&gt;Partner&lt;/code&gt; a certain number of places (&lt;code&gt;guestAllocation&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Each &lt;code&gt;User&lt;/code&gt; must be able to log in via the front end and update the names of the people who are going to the event (limited by &lt;code&gt;guestAllocation&lt;/code&gt;) associated with their &lt;code&gt;Partner&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Currently, SuperTable lists the &lt;code&gt;Partners&lt;/code&gt; invited to that event and their allowed &lt;code&gt;guestAllocation&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At the end of all this I need to export a Guest List which should be generated by the names of people who are attending the Event (if there are missing names and spare guestAllocation, there will be default value).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What's the best way to structure this in the database? Should I have one Event that gets updated by multiple users somewhow, or an Entry for each Partner related to an &lt;code&gt;Event&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to update a single Entry by multiple Users who can only add the correct number of names to the guest list for their Partner?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="642" LastActivityDate="2015-11-13T04:57:26.897" Title="How to update different parts of the same Entry by different Users" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12365" PostTypeId="1" AcceptedAnswerId="12371" CreationDate="2015-11-12T17:58:30.287" Score="1" ViewCount="95" Body="&lt;p&gt;&lt;code&gt;supportContent&lt;/code&gt; is a Matrix field&lt;br&gt;&#xA;&lt;code&gt;contentBlock&lt;/code&gt; is a Matrix block&lt;br&gt;&#xA;&lt;code&gt;heading&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt; are fields within &lt;code&gt;contentBlock&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to display &lt;code&gt;block.heading&lt;/code&gt; only if my &lt;code&gt;query&lt;/code&gt; is in the &lt;code&gt;block.body&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.supportContent.type('contentBlock') if query in block.body  %}&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is not working. Any help?&lt;/p&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2015-11-12T22:51:13.047" Title="Display Matrix block field base on location of query" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12366" PostTypeId="1" AcceptedAnswerId="12367" CreationDate="2015-11-12T18:32:27.117" Score="2" ViewCount="68" Body="&lt;p&gt;I would like to selectively show a subset of my sections in the main navigation. Is it possible to do something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getSectionById(1,2,3) %}&#xA;&#xA;{% for section in sections}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4338" LastEditorUserId="57" LastEditDate="2015-11-12T19:01:32.677" LastActivityDate="2015-11-12T19:04:16.183" Title="Show a partial list of sections" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12367" PostTypeId="2" ParentId="12366" CreationDate="2015-11-12T19:04:16.183" Score="1" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = [] %}&#xA;&#xA;{% set sections = sections|merge([craft.sections.getSectionById(1)])&#xA;{% set sections = sections|merge([craft.sections.getSectionById(2)])&#xA;{% set sections = sections|merge([craft.sections.getSectionById(3)])&#xA;&#xA;{% for section in sections %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-12T19:04:16.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12368" PostTypeId="1" CreationDate="2015-11-12T20:47:49.257" Score="2" ViewCount="512" Body="&lt;p&gt;I've got the beginnings of a simple plugin to track views of an article page, just an entry with custom fields including 'dataViews' used below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.demoPlugin.incrementView(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Variable above set with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class DemoPluginVariable&#xA;{&#xA;    /**&#xA;     * Increment count&#xA;     *&#xA;     * @param EntryModel $entry&#xA;     */&#xA;    public function incrementView(EntryModel $entry)&#xA;    {&#xA;        craft()-&amp;gt;demoPlugin-&amp;gt;incrementView($entry);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the service code which picks up the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;&#xA;class DemoPluginService extends BaseApplicationComponent&#xA;{&#xA;    /**&#xA;     * Increment view count&#xA;     *&#xA;     * @param EntryModel $entry&#xA;     */&#xA;    public function incrementView(EntryModel $entry)&#xA;    {&#xA;        $entry-&amp;gt;setContentFromPost([&#xA;            'dataViews' =&amp;gt; 1234,&#xA;        ]);&#xA;&#xA;&#xA;        $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;        Craft::dd($success);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above fails when passed an entry, with $success reporting false. Logging the error this is due to other fields on the entry being required and not passed through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point me in the direction for updating just one field within a record?&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2015-11-12T20:47:49.257" Title="Updating a single custom field within an Entry" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;entrymodel&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12369" PostTypeId="1" AcceptedAnswerId="12370" CreationDate="2015-11-12T21:49:47.107" Score="0" ViewCount="79" Body="&lt;p&gt;I could do with flipping the rows in a table, within a template. Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2015-11-12T22:33:41.643" Title="How to reverse the rows in a table?" Tags="&lt;table-field&gt;&lt;table&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12370" PostTypeId="2" ParentId="12369" CreationDate="2015-11-12T22:33:41.643" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/reverse.html&quot; rel=&quot;nofollow&quot;&gt;Reverse&lt;/a&gt; it!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for row in entry.myTableFieldHandle|reverse %}&#xA;        &amp;lt;li&amp;gt;{{ row.columnHandle }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-12T22:33:41.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12371" PostTypeId="2" ParentId="12365" CreationDate="2015-11-12T22:51:13.047" Score="1" Body="&lt;p&gt;Your code would work as-is if &lt;code&gt;block.body&lt;/code&gt; was a &lt;a href=&quot;http://buildwithcraft.com/docs/plain-text-fields&quot; rel=&quot;nofollow&quot;&gt;Plain Text field&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since it's a &lt;a href=&quot;http://buildwithcraft.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;Rich Text field&lt;/a&gt;, it technically returns a &lt;a href=&quot;http://buildwithcraft.com/classreference/fieldtypes/RichTextData&quot; rel=&quot;nofollow&quot;&gt;RichTextData&lt;/a&gt; object and Twig's &lt;code&gt;in&lt;/code&gt; operator doesn't know what to do with objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will grab the string data from the Rich Text field so &lt;code&gt;in&lt;/code&gt; operates as you'd expect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.supportContent.type('contentBlock') if query in block.body.getRawContent()  %}&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-12T22:51:13.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12372" PostTypeId="2" ParentId="12363" CreationDate="2015-11-13T04:57:26.897" Score="2" Body="&lt;p&gt;Definitely multiple ways to do this but I think you're close. I wouldn't want to have multiple users hitting the same entry. Use Craft's power of relations to help here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing you're trying to great some kind of &quot;rotary&quot; or networking registration system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need 2 more sections: &lt;code&gt;Guest Names&lt;/code&gt; and &lt;code&gt;Guest List&lt;/code&gt; (name these whatever you want).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;Guest Names&lt;/code&gt; is straightforward, it basically is going to be a list of every guest name available. You just need 1 field: the name. Craft's user ownership will take care relating this back to the User who created it and the Partner it contains.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;Guest List&lt;/code&gt; is going to hold the master list. You need a couple more relational fields, one to relate back to tell which which event it's for (in your &lt;code&gt;Events&lt;/code&gt; section) and another to &quot;hold&quot; the names of the guests attending.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now it's just a matter of wiring it all up. You're going to want users to post to the &lt;code&gt;Guest List&lt;/code&gt; and &lt;code&gt;Guest Names&lt;/code&gt; sections. It's up to you how you want to handle the validation on the front end as to whether a guest already exists that's &quot;owned&quot; by the User.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beauty here is also if you do multiple events and the same people attend the events, when someone registers, you can simply pull up their prior Guests and offer those up as guest choices too. Again, I'm just speculating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it's time to pull out a guest list, just query your Guest List section based on the Event you want, loop through the event, and grab the names for each attendee.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-11-13T04:57:26.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12373" PostTypeId="1" AcceptedAnswerId="12377" CreationDate="2015-11-13T10:11:31.957" Score="1" ViewCount="1177" Body="&lt;p&gt;I've got the pagination function working nicely for a simple for loop of news entries. However I want to split the template up into the first 2 entries as featured items then the next 6 as smaller items. As I paginate through the entries I'd like to keep that layout, however it seems that I cannot use paginatedEntries.limit(2) or paginatedEntries.limit(6).offset(2). Is there another way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('news').limit(8) as paginatedEntries %}&#xA;&amp;lt;section class=&quot;two-col&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;firaslant&quot;&amp;gt;&amp;lt;h1&amp;gt;News&amp;lt;/h1&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        {% for entry in paginatedEntries.limit(2) %}&#xA;            {# Show first 2 entries #}&#xA;        {% endfor %}    &#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;    &amp;lt;aside class=&quot;two-col-o&quot;&amp;gt;&#xA;        {% set tagentries = craft.entries.section('news').limit(null) %}&#xA;        {% if craft.tags.relatedTo(tagentries)|length %}&#xA;            {% import &quot;_macros/_news.twig&quot; as news %}&#xA;            {{ news.tags(tagentries, 'News', 'news') }}&#xA;        {% endif %}&#xA;        &amp;lt;div class=&quot;searchbox&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;Search in News&amp;lt;/h3&amp;gt;&#xA;            {% import &quot;_macros/_search.twig&quot; as searchForm %}&#xA;            {{ searchForm.simple('news') }}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% import &quot;_macros/_util.twig&quot; as util %}&#xA;        {% if currentUser %}&#xA;            {{ util.link('/member-news', 'Browse Member News Articles') }}&#xA;        {% endif %}&#xA;&#xA;    &amp;lt;/aside&amp;gt;&#xA;&#xA;    {# 6 entries as grid #}&#xA;    &amp;lt;div class=&quot;clear&quot;&amp;gt;&#xA;        {% for entry in paginatedEntries.offset(2) %}&#xA;                {# Show next 6 articles #}&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;        {% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;paginate-nav&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;        {% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;paginate-nav&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As soon as I remove .offset(2) or .limit(2) the code functions correctly without errors.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-11-13T17:56:42.127" Title="Paginate entries with offset / limit when templating" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12375" PostTypeId="2" ParentId="12352" CreationDate="2015-11-13T11:50:42.237" Score="0" Body="&lt;p&gt;Just done some testing here and I think it's a bug (I might be wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to explain this very well and I'm not sure if it's posted in the right place but here goes...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the ElementRelationParamParser Class, parseRelationParam function (line 69), this test&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($relatedTo[0] == 'and' || $relatedTo[0] == 'or')&#xA;{&#xA;    $glue = array_shift($relatedTo);&#xA;&#xA;}&#xA;else&#xA;{&#xA;    $glue = 'or';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 'and' or 'or' is actually here in your case&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$relatedTo[0]['targetElement'][0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically, &lt;strong&gt;craft is always defaulting to 'or' at the moment&lt;/strong&gt; from what I can see when using the new syntax (Old syntax works for me too btw).&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-13T11:50:42.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12376" PostTypeId="1" CreationDate="2015-11-13T17:13:29.350" Score="1" ViewCount="663" Body="&lt;p&gt;Is it possible to create static JSON file using the Element API plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I then want to do was cache that file probably using Varnish or push it to an S3 bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I was to cache it I would need to look at purging the URL when an entry is added or edited.&#xA;If I pushed it to S3, then I would either need to overwrite the file or manage it another way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to handle this, and could you easily create a static JSON file with caching and purging abilities?&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2016-06-09T11:22:00.720" Title="How to create a static JSON files with Element API and cache it with Varnish" Tags="&lt;cache&gt;&lt;plugin-elementapi&gt;&lt;varnish&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12377" PostTypeId="2" ParentId="12373" CreationDate="2015-11-13T17:56:42.127" Score="5" Body="&lt;p&gt;You could use Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;noreferrer&quot;&gt;Slice&lt;/a&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstTwo = paginatedEntries|slice(0,2) %}&#xA;{% set lastFour = paginatedEntries|slice(2,4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop over &lt;code&gt;firstTwo&lt;/code&gt; for your first items. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in firtTwo %}&#xA;   {# Show first 2 entries #}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop over &lt;code&gt;lastFour&lt;/code&gt; for your final items.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in lastFour %}&#xA;   {# Show next 6 articles #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-11-13T17:56:42.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12378" PostTypeId="1" CreationDate="2015-11-13T19:13:08.280" Score="0" ViewCount="78" Body="&lt;p&gt;Learning Craft currently. Wondering if there's any plugin that simplifies the curation of the home page by allowing pinning a post, highlighting a post, reordering a post etc (non chronologically)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a reference of a equivalent Wordpress plugin:&#xA;&lt;a href=&quot;https://github.com/10up/curator&quot; rel=&quot;nofollow&quot;&gt;https://github.com/10up/curator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;THanks&lt;/p&gt;&#xA;" OwnerUserId="4343" LastActivityDate="2015-11-13T19:22:25.390" Title="Curating the homepage" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12379" PostTypeId="2" ParentId="12378" CreationDate="2015-11-13T19:22:25.390" Score="3" Body="&lt;p&gt;You could create a matrix content field for the homepage with a child entry selection field. You can add as many matrix blocks as you'd like, and select the entries you would like within them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about Matrix fields &lt;a href=&quot;http://buildwithcraft.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise you can checkout entry field types &lt;a href=&quot;http://buildwithcraft.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your code for &lt;code&gt;index.twig&lt;/code&gt; might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.calloutBlocks %}&#xA;  &amp;lt;article&amp;gt;&#xA;    {{block.title}}&#xA;    {{block.body}}&#xA;    &amp;lt;a href=&quot;{{block.url}}&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="218" LastActivityDate="2015-11-13T19:22:25.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12380" PostTypeId="1" CreationDate="2015-11-13T21:06:09.353" Score="1" ViewCount="51" Body="&lt;p&gt;What makes a site's domain appear within the output of &lt;code&gt;paginate.nextUrl&lt;/code&gt;? I am experiencing a situation where it is not there in my local dev environment, but IS there on production server. I'm sure it's related to some more global configuration, but the answer is so far not obvious. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="677" LastActivityDate="2015-11-13T21:06:09.353" Title="How to remove domain from paginate.nextUrl?" Tags="&lt;server&gt;&lt;pagination&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12381" PostTypeId="1" AcceptedAnswerId="12382" CreationDate="2015-11-13T22:21:18.080" Score="3" ViewCount="210" Body="&lt;p&gt;I have a client that can't remember that save equals publish... is there a way to change the text from save to publish? &lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2015-11-13T23:19:00.643" Title="Change Save entry to Publish possible?" Tags="&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12382" PostTypeId="2" ParentId="12381" CreationDate="2015-11-13T22:33:21.717" Score="4" Body="&lt;p&gt;Use JavaScript to find the button and change the text. Fortunately, the Craft CP contains jQuery, so it should be fairly easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin should help speed up the process... Your JavaScript will get loaded on every page of the control panel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-cpjs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2015-11-13T23:19:00.643" LastActivityDate="2015-11-13T23:19:00.643" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12383" PostTypeId="1" CreationDate="2015-11-13T22:41:16.103" Score="0" ViewCount="50" Body="&lt;p&gt;After migrating from one server to another, I'm unable to delete entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to add new entries and change their status. But delete doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The servers are identical (using digital ocean LAMP stack). I've checked my craft/server logs, I can't find any errors related to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions as to where to look?&lt;/p&gt;&#xA;" OwnerUserId="2273" LastActivityDate="2015-11-13T22:41:16.103" Title="unable to delete entries after migration to new server" Tags="&lt;migration&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12385" PostTypeId="1" CreationDate="2015-11-13T23:47:45.933" Score="0" ViewCount="248" Body="&lt;p&gt;Installing Craft-2.4.2723 on Centos 6.5 MySql 5.6.27 PHP 5.4.45 gets hung in 'Oops' monkey screen. Minimum requirements are met. Permissions are wide open. Database exists but no tables are created. Collation is set to &lt;code&gt;utf8_unicode_ci&lt;/code&gt;. Following is craft.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/11/13 21:51:08 [warning] [application] Skipping record /var/www/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;&#xA;2015/11/13 21:51:08 [error] [exception.ReflectionException] exception 'ReflectionException' with message 'Class Craft\EntryLocaleRecord does not exist' in /var/www/craft/app/services/InstallService.php:125&#xA;&#xA;Stack trace: 0 /var/www/craft/app/services/InstallService.php(125): ReflectionClass-&amp;gt;__construct('Craft\\EntryLoca...')&#xA;1 /var/www/craft/app/services/InstallService.php(47): Craft\InstallService-&amp;gt;findInstallableRecords()&#xA;2 /var/www/craft/app/controllers/InstallController.php(159): Craft\InstallService-&amp;gt;run(Array)&#xA;3 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\InstallController-&amp;gt;actionInstall()&#xA;4 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;5 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;6 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;7 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('install')&#xA;8 /var/www/craft/app/etc/web/WebApp.php(805): CWebApplication-&amp;gt;runController('install/install')#9 /var/www/craft/app/etc/web/WebApp.php(772): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;10 /var/www/craft/app/etc/web/WebApp.php(193): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;11 /var/www/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;12 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;13 /var/www/html/index.php(19): require_once('/var/www/craft/...')&#xA;14 {main}&#xA;&#xA;REQUEST_URI=/index.php/admin/actions/install/install&#xA;HTTP_REFERER=http://myserver.com/index.php/admin/install&#xA;&#xA;2015/11/13 21:51:08 [error] [application] Class Craft\EntryLocaleRecord does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that it's not being passed the 'Locale' record. Any ideas on this?&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="57" LastEditDate="2015-11-14T00:03:56.127" LastActivityDate="2015-11-14T00:05:11.087" Title="Craft Install Hangs on Locale Record" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12386" PostTypeId="2" ParentId="12385" CreationDate="2015-11-14T00:05:11.087" Score="1" Body="&lt;p&gt;Does &lt;code&gt;EntryLocaleRecord.php&lt;/code&gt; exist in &lt;code&gt;craft/app/records&lt;/code&gt;?  My guess is that it didn't copy/FTP up to your server properly or its corrupted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd try re-uploading the entire &lt;code&gt;craft/app&lt;/code&gt; folder to make sure there aren't others missing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-14T00:05:11.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12387" PostTypeId="2" ParentId="12089" CreationDate="2015-11-14T01:31:26.510" Score="1" Body="&lt;p&gt;I assume your entry has a category field in it? In your section's settings, use something like this for the format URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{myCategoryField.first().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No need to roll you own routing, Craft will add the category's slug to your URL and do all of that properly for you.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-11-14T01:31:26.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12389" PostTypeId="2" ParentId="12357" CreationDate="2015-11-14T15:41:34.447" Score="0" Body="&lt;p&gt;I think, I've cracked it. I haven't tough of concatenating matrix block within the loop and set parameters right in the source.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.productSettings.type('finish').inStock('1').limit(1) %}&#xA;    {{ block.amazonUri }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives first true element in the loop.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-11-14T15:41:34.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12390" PostTypeId="1" CreationDate="2015-11-14T17:13:52.820" Score="1" ViewCount="162" Body="&lt;p&gt;I’m trying to build a query to get the geographically closest entries, based on an Smart Map field value within a related entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FBEq6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FBEq6.png&quot; alt=&quot;Diagram of relationships and template&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following template tags were my first guess, but returned an empty result set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nearest = allUnitsCriteria.relatedPropertyField.smartMapField(params).order('distance') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What’s the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="596" LastEditorUserId="1098" LastEditDate="2015-11-15T13:01:01.360" LastActivityDate="2015-11-15T13:01:01.360" Title="Nearest entry using related entry Smart Map field" Tags="&lt;relations&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12391" PostTypeId="1" CreationDate="2015-11-14T17:35:10.023" Score="2" ViewCount="297" Body="&lt;p&gt;I have a channel section (&lt;code&gt;tickets&lt;/code&gt;) where each entry has a &lt;code&gt;members&lt;/code&gt; field. The &lt;code&gt;members&lt;/code&gt; field can either be empty (making the entry 'public') or specific members can be added (making it 'private', to only the selected users).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get a list of all the entries within the section where the &lt;code&gt;members&lt;/code&gt; field is &lt;em&gt;either&lt;/em&gt; empty or the &lt;code&gt;currentMember&lt;/code&gt; has been added to the list, e.g. a member should see both public entries &lt;strong&gt;and&lt;/strong&gt; private entries they have been added to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following to get all private entries for the currentMember, but I can't figure out how to make it include the public ones as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tickets = craft.entries.section('tickets').relatedTo({&#xA;    targetElement: currentMember,&#xA;    field: 'members'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4347" LastActivityDate="2020-12-14T19:41:03.630" Title="Get entries where relation matches or is empty" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12392" PostTypeId="2" ParentId="12390" CreationDate="2015-11-15T10:57:41.627" Score="3" Body="&lt;p&gt;Being that the &lt;code&gt;smartMapField&lt;/code&gt; attribute belongs to entries in the &lt;code&gt;Property&lt;/code&gt; section, and not the entries in the &lt;code&gt;Unit&lt;/code&gt; section, your current element criteria is a bit off (it basically assumes that the &lt;code&gt;smartMapField&lt;/code&gt; property is found on the &lt;code&gt;Unit&lt;/code&gt; entry models).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you'll need &lt;em&gt;two&lt;/em&gt; element criterias to accomplish what you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first criteria will pull &lt;code&gt;Property&lt;/code&gt; entries based on their &lt;code&gt;smartMapField&lt;/code&gt; value and the &lt;code&gt;params&lt;/code&gt; object. The second one will pull &lt;code&gt;Unit&lt;/code&gt; properties, by relation to the &lt;code&gt;Property&lt;/code&gt; entries in the first criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we'll need to use the &lt;code&gt;group&lt;/code&gt; filter to output the unit entries in the correct order (i.e. those related to the nearest property entry first).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important: It isn't 100% clear from your question, but I'm assuming that the relation between &lt;code&gt;Units&lt;/code&gt; and &lt;code&gt;Properties&lt;/code&gt; originates from a &lt;code&gt;relatedPropertyField&lt;/code&gt; in the &lt;code&gt;Units&lt;/code&gt; entries, rather than the other way around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't been able to test this, but I believe something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nearest = craft.entries.section('units').relatedTo({&#xA;    targetElement : craft.entries.section('properties').smartMapField(params).order('distance').limit(null),&#xA;    field : 'relatedPropertyField'&#xA;}).limit(null).order('targets1.sortOrder')|group('relatedPropertyField.first().id') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the &lt;code&gt;group&lt;/code&gt; filter applied to the &lt;code&gt;nearest&lt;/code&gt; variable. This is needed to group the returned entries by their common &lt;code&gt;Property&lt;/code&gt; relation. The &lt;code&gt;group&lt;/code&gt; filter turns &lt;code&gt;nearest&lt;/code&gt; into an array of grouped elements, which means that when you output the entries, you'll need a nested &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for units in nearest %}&#xA;    {% for unit in units %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-11-15T12:53:42.047" LastActivityDate="2015-11-15T12:53:42.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12393" PostTypeId="1" CreationDate="2015-11-15T11:49:08.937" Score="2" ViewCount="238" Body="&lt;p&gt;When you create an account in cpanel you can use a URL to access it like &lt;a href=&quot;http://ip/%7Eusername/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ip/%7Eusername/&lt;/a&gt;, which is basically &lt;a href=&quot;http://ip/~username/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ip/~username/&lt;/a&gt;. Since the client is not ready to take down their old site and we are moving hosts, can Craft run on a URL with the ~username or %7E in the URL? They do not have a dedicated IP unfortunately. Thanks in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the license will be needed, but can we change the URL to the real one when ready to go LIVE?&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="22" LastEditDate="2017-05-09T23:09:54.920" LastActivityDate="2017-05-09T23:09:54.920" Title="Is it possible to install Craft on a cPanel temp user URL?" Tags="&lt;config&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="12394" PostTypeId="2" ParentId="12393" CreationDate="2015-11-15T12:26:20.500" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'example.com' =&amp;gt; array(...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'should' work with an address like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'123.45.67.89/%7eusername' =&amp;gt; array(...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might also try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'123.45.67.89/~username' =&amp;gt; array(...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although using a proper domain name as in my comment above would be better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck. :)&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-11-15T12:26:20.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12395" PostTypeId="1" AcceptedAnswerId="12396" CreationDate="2015-11-16T00:13:33.907" Score="2" ViewCount="284" Body="&lt;p&gt;In a custom plugin is it possible to have a element type with a belongs to relationship to a user, as you can only define half of the relationship (without somehow modifying the userRecord). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best practices to get something like this working?&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-11-16T03:01:42.130" Title="How to handle Belongs To User relationship" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12396" PostTypeId="2" ParentId="12395" CreationDate="2015-11-16T03:01:42.130" Score="0" Body="&lt;p&gt;Assuming your plugin is going to be the only thing referencing this Active Record relationship, your plugin could have its own &lt;code&gt;MyUserRecord&lt;/code&gt; that extends Craft's &lt;code&gt;UserRecord&lt;/code&gt; and does something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    $relations = parent::defineRelations();&#xA;&#xA;    $relations['myUser'] = array(static::BELONGS_TO, 'MyUserRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE);&#xA;&#xA;    return $relations;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you would just utilize &lt;code&gt;MyUserRecord&lt;/code&gt; instead of Craft's &lt;code&gt;UserRecord&lt;/code&gt; in your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-16T03:01:42.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12397" PostTypeId="1" CreationDate="2015-11-16T11:19:13.947" Score="1" ViewCount="336" Body="&lt;p&gt;I'm outputting fields from a Matrix block, how do I then wrap all outputted fields from 'artworkFile' that are available with some HTML. Not individually wrapped, but all outputted fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;artworkFile&quot; %}&#xA;{% for asset in block.downloadUrl %}&#xA; &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;file {{ block.platform }} gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Desired Output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;  &amp;lt;a href=&quot;asseturl1.png&amp;gt;&#xA;   &amp;lt;div class=&quot;file exampleplatform1 gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;  &amp;lt;a href=&quot;asseturl2.png&amp;gt;&#xA;   &amp;lt;div class=&quot;file exampleplatform2 gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Matrix Setup&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jAPs1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jAPs1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2015-11-20T16:27:18.283" LastActivityDate="2015-11-21T19:20:08.783" Title="Wrapping a matrix block" Tags="&lt;matrix&gt;&lt;loop&gt;&lt;batch&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12398" PostTypeId="1" AcceptedAnswerId="12399" CreationDate="2015-11-16T11:36:30.897" Score="3" ViewCount="334" Body="&lt;p&gt;I am trying to bring image file sizes down as much as possible, but the images on the server turn out to be quite a bit larger than the same images I have saved locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have one local image that is 70KB. When I upload it into Assets it‘s 180KB. On the page itself it is being transformed like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imgSize = {&#xA;    mode: 'crop',&#xA;    width: 960,&#xA;    height: 450,&#xA;    quality: 75,&#xA;    position: 'center-center'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That transformed image on the page is then 208KB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So rather than optimising file sizes as I thought it did, my set up is making the files 3 times larger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the server with phpinfo, and I can't see Imagick installed, but GD v2.1.0 is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to prevent the images from becoming larger?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2015-11-17T12:04:54.350" Title="Images much larger on server and page than the local version" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12399" PostTypeId="2" ParentId="12398" CreationDate="2015-11-16T11:49:57.423" Score="3" Body="&lt;p&gt;This is likely to be a combination of factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly; GD isn't all that great, so if you can get ImageMagik installed it's possible you'll get better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly; This can depend on the image format too. PNGs for example are far more complicated to save optimised and it's unlikely that a PNG generated by a server is going to match the level of optimisations you can get locally through tools like TinyPNG and ImageOptim. PNGs have many more options for quality control than JPG's simple slider. Try to avoid transforms on anything other than JPGs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thirdly; check you're uploading an image that's larger than the crop you're creating. Craft has a horrible behaviour of blowing up images to match the crop. It's not really cropping, it's just taking any image and making it the size requested. That can mean 'cropped' images larger in filesize and dimension than the source.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-11-16T11:49:57.423" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12401" PostTypeId="1" AcceptedAnswerId="12407" CreationDate="2015-11-16T13:17:41.800" Score="1" ViewCount="498" Body="&lt;p&gt;I want to gather data from the page a form is on and submit this information to the form entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use case:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On an 'Events' &lt;strong&gt;entry&lt;/strong&gt; page &lt;em&gt;(the form is in the sidebar)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;When the user fills in the basic form and submits, I want to get the &lt;strong&gt;entry's&lt;/strong&gt; title and some custom fields in addition to what the user has filled out&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In short what I want the form entry to submit is: Name, Email, Tel No, Message IN ADDITION to Event Entry Title, Date, Excerpt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is possible with &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/hidden-and-invisible-fields&quot; rel=&quot;nofollow&quot;&gt;hidden and invisible fields&lt;/a&gt;, but I may misunderstand their purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this form has been submitted I would like Sprout Email to get a hold of this data - so I need to know how to output this data when setting up the template in the back end text area for the email as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone offer any assistance on this please? I would greatly appreciate it. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-11-16T18:14:26.523" Title="Sprout Forms: gather data from the page a form is on" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12402" PostTypeId="1" CreationDate="2015-11-16T14:38:56.473" Score="2" ViewCount="387" Body="&lt;p&gt;I'm building a site and getting some odd search results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, searching against the term 'Gibraltar' returns an entry with four mentions of the term in it's content first, whilst an entry with 'Gibraltar' in the title and 10 instances in the body is returned second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am returning the results paginated, ie:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.search( '*' ~ query ~ '*' ).limit(10).order('score') as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts why this might be happening? I came across this issue reported last year at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2376/search-order-score-criteria&quot;&gt;Search order &amp;quot;Score&amp;quot; criteria&lt;/a&gt; - seems to be the same issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-02-21T17:19:40.113" Title="Score order in search results" Tags="&lt;search&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12403" PostTypeId="1" AcceptedAnswerId="12404" CreationDate="2015-11-16T15:37:03.053" Score="0" ViewCount="114" Body="&lt;p&gt;I am looking to implement a website where access to pages &lt;em&gt;and&lt;/em&gt; their related pages is restricted to certain users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I thought it might work is that a user (or users) would be assigned to the entry. This user should then have front end access to this entry &lt;em&gt;and its related entries&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the template would check the currentUser value against the user in the entry, and also against the relatedTo entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better, more efficient way? I feel this may suffer from performance problems as the number of related entries grows. Any advice or guidance would be greatly appreciated! &lt;/p&gt;&#xA;" OwnerUserId="4289" LastActivityDate="2015-11-16T15:50:15.470" Title="Front end authentication on an entry and its related entries" Tags="&lt;frontend&gt;&lt;templating&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12404" PostTypeId="2" ParentId="12403" CreationDate="2015-11-16T15:50:15.470" Score="2" Body="&lt;p&gt;From experience, in terms of ui/ux AND ease in front end stages, If you can do things the other way round, do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So attached entries to users basically. When you have a new user, you add entries in one place vs adding the user on every single entries which, if you have loads of could turn into a bit of a mission.. You'll find this way round easier to maintain, in the front end, you can just access related entries through the currentUser very easily instead of going through entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my personal preference based on recent experience but I don't know how much flexibility you have in terms of development so it may not be possible for you.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-16T15:50:15.470" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12405" PostTypeId="1" CreationDate="2015-11-16T17:35:33.877" Score="5" ViewCount="740" Body="&lt;p&gt;I'm implementing a site with just one very big matrix field called 'blocks', and all my frontend is designed with BEM CSS with a lot of components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But i'm facing problems with this big field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) If two block types have a field called 'cssClasses' of type 'Multi-select', it's not validating correctly and is saving just one of this fields. I've found a workaround, changing the name of second field, but frequently i lost a lot of field values with this problem. (i really don't know exactly why this problem is happening sometimes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If i have too many fields on my block items, there are some implicit field limit that i don't know where is, that all block item fields after this limit are deleted when save... its a very big problem, because all my entries loose all the data for these fields. It's really a big problem for me... (maybe can be max_input_vars value and/or post_max_size)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) It's very slow to page render this big field when testing on Amazon(rds large + 1000 IOPS SSD) or Heroku (clearbit database high io), compared to my localhost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: &#xA;I'm using LinkIt plugin and SuperTable plugin for some fields...&lt;/p&gt;&#xA;" OwnerUserId="1076" LastActivityDate="2016-02-19T23:31:25.190" Title="Saving big matrix fields problems" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12406" PostTypeId="1" CreationDate="2015-11-16T18:07:48.970" Score="3" ViewCount="272" Body="&lt;p&gt;I want to list all the related entries to the entry I am displaying using the Element API plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel called series and another called episodes, the episodes have a relationship with 1 series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pulling in the series ok:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/series.json' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['section' =&amp;gt; 'series'],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;api/series/{$entry-&amp;gt;id}.json&quot;)&#xA;        ];&#xA;    },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I am pulling in a series:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/series/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function( $entryId) {&#xA;        return [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'id' =&amp;gt; $entryId&#xA;            ],&#xA;            'first' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'image' =&amp;gt; $entry-&amp;gt;seriesHero,&#xA;                    'description' =&amp;gt; $entry-&amp;gt;seriesDescription&#xA;                ];&#xA;            },&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the endpoint above I want to be able to output an array of the episodes related to this series.&#xA;The relationship field in the episode channel is called &lt;code&gt;series&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2015-11-16T18:07:48.970" Title="Getting related entries along with entry using the Element API plugin" Tags="&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12407" PostTypeId="2" ParentId="12401" CreationDate="2015-11-16T18:14:26.523" Score="3" Body="&lt;p&gt;You're understanding the purpose of the Hidden and Invisible fields correctly and your desired workflow is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's step through each part:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Hidden and Invisible Fields&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;These fields allow you to capture values on the page that the user doesn't see.  This includes any variable available to the page your form is being submit on. The key thing to note is that by default, all variables may not be available and for some variables, you will have to take an extra step to make them available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, the only dynamic variables available to the Hidden and Invisible fields are variables that are global in scope like &lt;code&gt;{{ craft.request.path }}&lt;/code&gt; or something like that.  To make an &lt;code&gt;entry&lt;/code&gt; variable available, you will need to use the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field#setting-a-dynamic-value-outside-the-global-scope&quot; rel=&quot;nofollow&quot;&gt;addFieldVariables tag&lt;/a&gt; on your page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# This line makes the entry variable available to your &#xA;   Hidden and Invisible Field settings. #}&#xA;{% do craft.sproutForms.addFieldVariables({ entry: entry }) %}&#xA;&#xA;{# After you use addFieldVariables, you can display your Form as normal #}&#xA;{{ craft.sproutForms.displayForm('contact') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the code above in place, you can now use any values that you want from the &lt;code&gt;entry&lt;/code&gt; in your Hidden or Invisible Field Settings like &lt;code&gt;{{ entry.title }}&lt;/code&gt;, &lt;code&gt;{{ entry.postDate|date('Y-m-d) }}&lt;/code&gt;, &lt;code&gt;{{ entry.excerpt }}&lt;/code&gt; or even loop through an array of data like Entries or Users, just like you would in your Twig template (as long as your final value can be stored in a PlainText field.  &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Dynamically access form data with Sprout Email&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;To send this information in a notification email, you'll first need to setup a new Notification in Sprout Email and select the rule &quot;When a Sprout Forms entry is saved&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your form is submitted, your Sprout Email template will have your entire &lt;code&gt;SproutForms_Entry&lt;/code&gt; object and all of the submitted fields available to it via the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/dynamic-values#using-dynamic-values-in-your-notification-entry-fields&quot; rel=&quot;nofollow&quot;&gt;object variable&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, while your entry values were available to your form as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&#xA;{{ entry.postDate|date('Y-m-d) }}&#xA;{{ entry.excerpt }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They will be available dynamically to your email template as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.title }}&#xA;{{ object.postDate|date('Y-m-d) }}&#xA;{{ object.excerpt }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-11-16T18:14:26.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12409" PostTypeId="1" CreationDate="2015-11-16T18:55:35.493" Score="2" ViewCount="44" Body="&lt;p&gt;How can I setup sub domains on a single domain to allow development of multiple Craft client sites. I tried dev1.domain.com and dev2.domain.com and it tells me I need to upgrade license since I need the pro features. Sites are still on development. What is best naming convention?&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="22" LastEditDate="2017-05-09T23:09:21.440" LastActivityDate="2017-05-09T23:09:21.440" Title="Sub domain install options" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12410" PostTypeId="2" ParentId="12409" CreationDate="2015-11-16T19:40:40.430" Score="2" Body="&lt;p&gt;Have &lt;code&gt;staging&lt;/code&gt; or &lt;code&gt;dev&lt;/code&gt; in the name, as in &lt;code&gt;blah.dev.domain.com&lt;/code&gt; or &lt;code&gt;blah.staging.domain.com&lt;/code&gt;  It needs to be a full sub-domain, not a partial like you had in your example.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-16T19:40:40.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12411" PostTypeId="1" AcceptedAnswerId="12413" CreationDate="2015-11-16T20:58:48.217" Score="0" ViewCount="80" Body="&lt;p&gt;I have a long entry list of authors and I am using global cache to help with the page load, but this global cache prevents the &lt;code&gt;if&lt;/code&gt; statement from adding &lt;code&gt;selected&lt;/code&gt; to the appropriate option. When I remove the global cache everything performs as intended.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;filter-by-author&quot; onchange=&quot;window.location.href=this.value;&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;/blog&quot;&amp;gt;All Authors&amp;lt;/option&amp;gt;&#xA;        {% cache globally %}&#xA;            {% nav author in craft.users({ group: 'blogAuthors', order: 'firstName', limit: null }) %}&#xA;                &amp;lt;option value=&quot;{{ url('blog/author/'~author.username) }}&quot;&#xA;                {% if craft.request.getLastSegment() == author.username %}selected{% endif %}&amp;gt;&#xA;                {{ author.name | title }}&#xA;                &amp;lt;/option&amp;gt;&#xA;            {% endnav %}&#xA;        {% endcache %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastEditorUserId="45" LastEditDate="2015-11-16T21:59:42.933" LastActivityDate="2015-11-16T22:07:00.393" Title="Global Cache Working too well?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12412" PostTypeId="1" AcceptedAnswerId="12414" CreationDate="2015-11-16T22:02:18.997" Score="2" ViewCount="280" Body="&lt;pre&gt;&lt;code&gt;$groupIds = [1, 2];&#xA;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user, $groupIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When executed I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity     constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`letshacklondon2016`.`craft_usergroups_users`, CONSTRAINT `craft_usergroups_users_userId_fk` FOREIGN KEY (`userId`) REFERENCES `craft_users` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_usergroups_users` (`groupId`, `userId`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, :row0_col2, :row0_col3, :row0_col4), (:row1_col0, :row1_col1, :row1_col2, :row1_col3, :row1_col4). Bound with :row0_col0=1, :row0_col1=Craft\UserModel::__set_state(array('elementType' =&amp;gt; 'User', ... (etc.)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="96" LastActivityDate="2015-11-17T01:19:14.000" Title="Setting User's Groups - Integrity Constraint Error" Tags="&lt;plugin-development&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12413" PostTypeId="2" ParentId="12411" CreationDate="2015-11-16T22:07:00.393" Score="2" Body="&lt;p&gt;This is exactly what caching is supposed to do... flatten the Twig code down to basic HTML, and serve that up instead of dynamically rendering it. Using &lt;code&gt;globally&lt;/code&gt; means that the HTML would be identical on every page, which is not really what you want here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get rid of &lt;code&gt;globally&lt;/code&gt;, so it can cache separately for each page. Since the URL is supposed to affect how that snippet is rendered, you don't want to cache &lt;code&gt;globally&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-11-16T22:07:00.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12414" PostTypeId="2" ParentId="12412" CreationDate="2015-11-17T01:19:14.000" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://buildwithcraft.com/classreference/services/UserGroupsService#assignUserToGroups-detail&quot; rel=&quot;nofollow&quot;&gt;UserGroupsService-&gt;assignUserToGroups&lt;/a&gt; takes a user's ID as the first parameter and you're passing in the entire &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change it to this and it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupIds); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-17T01:19:14.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12416" PostTypeId="1" AcceptedAnswerId="12417" CreationDate="2015-11-17T06:38:30.213" Score="4" ViewCount="238" Body="&lt;p&gt;So I have created a combined search for products and entries using the new Craft 2.5 search score.  It's working well, but...I was hoping to be able to do this &lt;strong&gt;without a plugin&lt;/strong&gt; if possible ... but it doesn't seem immediately possible to do unless I am missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows a way, it would be much appreciated.  In the meantime I'll post the solution I have come up with as an answer below.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2015-11-18T10:15:40.577" Title="Method (plugin free?) to combine search results across multiple searches (and element types)" Tags="&lt;search&gt;&lt;sort&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12417" PostTypeId="2" ParentId="12416" CreationDate="2015-11-17T06:38:30.213" Score="4" Body="&lt;p&gt;To get this working I submitted a patch to 'SortByField' - &lt;a href=&quot;https://github.com/dannynimmo/craftcms-sortbyfield&quot; rel=&quot;nofollow&quot;&gt;https://github.com/dannynimmo/craftcms-sortbyfield&lt;/a&gt; - to get this plugin to work with Commerce products - and I now do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set product_results = craft.commerce.products.search(query).order('score') %}  &#xA;    {% set article_results = craft.entries.search(query).order('score') %}&#xA;    {% set all_results = [] %}&#xA;&#xA;    {% if product_results|length %}&#xA;        {% set all_results = all_results|merge(product_results) %}&#xA;    {% endif %}&#xA;    {% if article_results|length %}&#xA;        {% set all_results = all_results|merge(article_results) %}&#xA;    {% endif %}&#xA;&#xA;    {% if all_results|length %}&#xA;        {% set all_results = all_results|sortByField('searchScore', 'desc') %}&#xA;    etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is working well and the combined results make sense to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just wondering if their is a better/recommended and ideally plugin free way of doing this - i.e. sorting the combined result set by score?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2015-11-17T06:38:30.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12418" PostTypeId="1" CreationDate="2015-11-17T10:12:07.200" Score="1" ViewCount="636" Body="&lt;p&gt;I got a rich text field.&lt;br&gt;&#xA;I made an excerpt with &lt;code&gt;striptags&lt;/code&gt; &lt;code&gt;slice&lt;/code&gt; and &lt;code&gt;raw&lt;/code&gt; twig functions.&lt;br&gt;&#xA;It works fine most of the time (&lt;code&gt;raw&lt;/code&gt; close tags when &lt;code&gt;slice&lt;/code&gt; cuts inside a &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;).  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;{{ textBlock.text | striptags(&quot;&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;div&amp;gt;&amp;lt;li&amp;gt;&amp;lt;em&amp;gt;&quot;) | slice(0, 275) | raw }}...&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But sometimes it completely breaks and put plenty of empty tags anywhere :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bbdRZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bbdRZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed that it happened when the original text is cut in the middle of double tags like :&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;Some text cut by slice function here&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real bug no ?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2015-11-17T11:18:35.883" Title="Craft rich text field excerpt with slice and raw breaks when cut inside double tags" Tags="&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12419" PostTypeId="1" AcceptedAnswerId="12422" CreationDate="2015-11-17T10:44:43.180" Score="1" ViewCount="89" Body="&lt;p&gt;Is it possible to limit access to the Control Panel to a specific HTTP port, which is shielded from public access? We want external visitors to only be able to access the front end site.&lt;/p&gt;&#xA;" OwnerUserId="4360" LastEditorUserId="9" LastEditDate="2015-11-17T11:44:18.883" LastActivityDate="2015-11-17T11:59:32.873" Title="How can I restrict access to the Control Panel to a single port?" Tags="&lt;security&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12420" PostTypeId="2" ParentId="12418" CreationDate="2015-11-17T11:18:35.883" Score="2" Body="&lt;p&gt;Raw doesn't close tags tags for you, it just allows them to be processed rather than printed only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only reason you are seeing closing tags I'm guessing is because your inspector (chrome/safari) is adding them in. Do &quot;view source&quot; to see the real output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem here is just rogue open tags&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-17T11:18:35.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12421" PostTypeId="1" CreationDate="2015-11-17T11:43:57.253" Score="1" ViewCount="750" Body="&lt;p&gt;I am filtering users in my CP by adding a new user source.&lt;br&gt;&#xA;I know how to get users for specific criterias.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in this case I want to make a &lt;code&gt;OR&lt;/code&gt; condition on those two users fields :&lt;br&gt;&#xA;&lt;code&gt;$user_criteria-&amp;gt;emailLogo = true;&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;$user_criteria-&amp;gt;webLogo = true;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyUserSources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;&#xA;        // LISTING USERS&#xA;        $sources[] = array('heading' =&amp;gt; 'Stats Users');&#xA;&#xA;        $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;        $user_criteria-&amp;gt;group = 'myMembers';&#xA;&#xA;        // THIS WILL MAKE A -AND- CONDITION (I WANT A -OR-)&#xA;        $user_criteria-&amp;gt;emailLogo = true;&#xA;        $user_criteria-&amp;gt;webLogo = true;&#xA;&#xA;        $sources['users:memberBranding'] = array(&#xA;            'label'    =&amp;gt; Craft::t('Logo'),&#xA;            'criteria' =&amp;gt; $user_criteria,&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2016-03-17T17:13:03.820" Title="Use getCriteria with OR condition on multiple fields" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12422" PostTypeId="2" ParentId="12419" CreationDate="2015-11-17T11:59:32.873" Score="2" Body="&lt;p&gt;First set your web server up so the full website gets loaded from both the external ports (e.g. 80 and 443) as well as your internal port (let's say 9001).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then open your index.php file, and add this to the top of it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Restrict CP access to port 9001&#xA;if (&#xA;    $_SERVER['SERVER_PORT'] != 9001 &amp;amp;&amp;amp; &#xA;    isset($_GET['p']) &amp;amp;&amp;amp;&#xA;    preg_match('^\/*admin(\/.*)?$/', $_GET['p'])&#xA;) {&#xA;    http_response_code(403);&#xA;    echo 'You are not authorized to access this area.';&#xA;    exit();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-11-17T11:59:32.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12423" PostTypeId="2" ParentId="12398" CreationDate="2015-11-17T12:04:54.350" Score="2" Body="&lt;p&gt;Image optimization has been &lt;em&gt;greatly&lt;/em&gt; improved in Craft 2.5, for servers running ImageMagick. If you are OK with running beta software, install that and future uploads should be much smaller. &lt;a href=&quot;http://buildwithcraft.com/beta&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/beta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-11-17T12:04:54.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12424" PostTypeId="1" CreationDate="2015-11-17T12:32:16.693" Score="1" ViewCount="977" Body="&lt;p&gt;We have a quite elaborate set up for Active Directory, and would like to use this to provision &amp;amp; deprovision access to the Control Panel. Would this be possible in Craft core or in a plugin? Are there hooks to use alternative access methods?&lt;/p&gt;&#xA;" OwnerUserId="4360" LastActivityDate="2015-11-17T14:32:33.293" Title="Can we use Active Directory for Access Control?" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12425" PostTypeId="1" CreationDate="2015-11-17T12:37:45.017" Score="1" ViewCount="129" Body="&lt;p&gt;If we implement CraftCMS, we would need logging of both access and publishing (both successful and failed attempts). The ability to change/remove those logs should not be available to those using the CMS. Is this available in core?&lt;/p&gt;&#xA;" OwnerUserId="4360" LastActivityDate="2015-11-17T18:18:33.293" Title="Can we log both access &amp; content changes?" Tags="&lt;security&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12426" PostTypeId="2" ParentId="12424" CreationDate="2015-11-17T14:32:33.293" Score="1" Body="&lt;p&gt;No, this is not available in the core. There is a &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; which deals with OAuth which may help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can view a list of hooks which Craft provides out of the box &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/hooks-reference&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine you will need to develop your own plugin for this. There is some guidance in the Craft documentation on creating hooks/events in a custom plugin if that's the route you'd prefer go down.&lt;/p&gt;&#xA;" OwnerUserId="4289" LastActivityDate="2015-11-17T14:32:33.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12427" PostTypeId="2" ParentId="12397" CreationDate="2015-11-17T14:39:28.927" Score="1" Body="&lt;p&gt;If you just want to affect the &lt;code&gt;artworkFile&lt;/code&gt; blocks, you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;artworkFile&quot; %}&#xA;{% for asset in block.downloadUrl %}&#xA;    {% if loop.first %}&amp;lt;div class=&quot;wrapper&quot;&amp;gt;{% endif %}&#xA;    &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;file {{ block.platform }} gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% if loop.last %}&amp;lt;/div&amp;gt;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-11-17T14:39:28.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12428" PostTypeId="1" AcceptedAnswerId="12431" CreationDate="2015-11-17T15:31:18.697" Score="1" ViewCount="127" Body="&lt;p&gt;I'm trying to display three different sets of data in search results. The first two, News and Services I can easily concatenate by the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchSections =  craft.entries.section(['service', 'newsOpinion']) %}&#xA;{% for entry in searchSections.search(query).order('score').limit(52).find()  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way the results display both sections limited and ordered via score no matter what section they are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I want to add a third array to searchSections of users.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allStaff = craft.users.group('staff') %}&#xA;{% for user in allStaff.search(query).order('score').limit(52).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However users aren't a section and merging the three arrays doesn't work. Any ideas how i can do this?&lt;/p&gt;&#xA;" OwnerUserId="4361" LastActivityDate="2015-11-17T18:24:14.450" Title="How to add users to the search results?" Tags="&lt;users&gt;&lt;search&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12429" PostTypeId="1" CreationDate="2015-11-17T17:37:01.300" Score="1" ViewCount="831" Body="&lt;p&gt;I've been learning craft and want to setup a production &amp;amp; development environment. I've primary HTML CSS experience with limited backend or server related experience &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I thought about doing this was setting up 2 separate droplets on Digital Ocean (w/ServerPilot) and copying digital ocean snapshots from the dev droplet to the production droplet.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this a feasible approach? &lt;/li&gt;&#xA;&lt;li&gt;Does the license allow this if I don't map a domain to it and operate it as an IP address OR use an obscure term (staging etc.) in a odd &lt;strong&gt;domain&lt;/strong&gt; (vs. sub-domain as mentioned in docs)?&lt;/li&gt;&#xA;&lt;li&gt;Is there a better (noob-friendly, learnable) way to do this?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4343" LastActivityDate="2015-11-17T20:12:59.427" Title="Digital Ocean: Dev + Production Droplets" Tags="&lt;install&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12430" PostTypeId="2" ParentId="12425" CreationDate="2015-11-17T18:18:33.293" Score="3" Body="&lt;p&gt;Craft does some basic logging in the form of when an entry was updated/created and the last time a user logged in and from what IP address, etc.  If you want anything more detailed than that, you'd need a plugin.  There is one called &lt;a href=&quot;https://github.com/boboldehampsink/auditlog&quot; rel=&quot;nofollow&quot;&gt;Audit Log&lt;/a&gt; that might do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-17T18:18:33.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12431" PostTypeId="2" ParentId="12428" CreationDate="2015-11-17T18:24:14.450" Score="1" Body="&lt;p&gt;Difficult, if not impossible, to do accurately in Craft 2.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the upcoming &lt;a href=&quot;http://buildwithcraft.com/beta&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5&lt;/a&gt;, the actual search score is being returned in the results, so you'd be able to take the two arrays, merge and sort them via their score into one result-set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-17T18:24:14.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12432" PostTypeId="2" ParentId="12429" CreationDate="2015-11-17T19:43:24.730" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does the license allow this if I don't map a domain to it and operate it as an IP address OR use an obscure term (staging etc.) in a odd domain (vs. sub-domain as mentioned in docs)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. As far as I'm aware, Pixel &amp;amp; Tonic consider a &lt;a href=&quot;http://buildwithcraft.com/help/try-craft-client-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;development site&lt;/a&gt; to be any &lt;a href=&quot;http://buildwithcraft.com/help/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;non public domain&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this a feasible approach?&#xA;  Is there a better (noob-friendly, learnable) way to do this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Lumping these 2 together since they're directly related.  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10476/host-a-craft-app/10496#10496&quot;&gt;This question and subsequent answers&lt;/a&gt;  might help you out as well as &lt;a href=&quot;http://buildwithcraft.com/docs/installing#additional-resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's own list of resources&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It really depends on what you want to learn. When you spin up a droplet or other virtual machine, there's a lot of moving parts there. You'll be dealing with a lot of server management and not necessarily Craft development. It's easy to go really deep down the rabbit role and come out with a lot of (depending on what you seek out) useless knowledge. If you're just tinkering around, you probably want it as hands-off as possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of paying for 2 droplet instances, you could spin up a virtual machine locally, like Virtualbox or something prebuilt like Laravel's Homestead. A droplet is also on the internet, thus a &quot;public&quot; server, so unless you want people hacking your instance, you'll want to secure it down. That just adds another layer of complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Virtual machines are great solutions but they're also overkill usually. I find the easiest approach is to develop locally and use something like MAMP and then push it to staging and/or production servers. You don't need to worry much about the nitty gritty of permissions, firewalls, etc.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-17T20:12:59.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12433" PostTypeId="1" AcceptedAnswerId="12447" CreationDate="2015-11-17T20:59:41.283" Score="2" ViewCount="893" Body="&lt;p&gt;I'm uploading a PNG image into my assets folder and linking to it from my css file - standard stuff, nothing special. However the PNG image is returning with a 500 error in the console and not displaying. When I visit the image directly in the browser I get a lot of numbers and:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template Error&#xA;&#xA;Unexpected character &quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J6iaa.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J6iaa.jpg&quot; alt=&quot;Screengrab of error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working locally with MAMP Pro and I've only recently restored my computer from scratch. I'm wondering whether this is a Craft issue or potentially a MAMP issue. It works fine if I use a Jpg instead or an externally hosted PNG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is also happening when I link to it with an img tag&lt;/p&gt;&#xA;" OwnerUserId="4363" LastEditorUserId="4363" LastEditDate="2015-11-17T21:17:48.630" LastActivityDate="2015-11-20T00:36:08.293" Title="500 error on PNG images" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;server&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12434" PostTypeId="2" ParentId="12433" CreationDate="2015-11-17T21:31:35.780" Score="1" Body="&lt;p&gt;Try checking file permissions. This happens to me frequently when copying assets from different people on our team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ifmeister.com/mamp-file-permissions-for-a-local-development-environment/&quot; rel=&quot;nofollow&quot;&gt;http://ifmeister.com/mamp-file-permissions-for-a-local-development-environment/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use devtools or something else to pull up the image in your browser. If you can't open it, there's a file permission problem.&lt;/p&gt;&#xA;" OwnerUserId="525" LastActivityDate="2015-11-17T21:31:35.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12437" PostTypeId="2" ParentId="12421" CreationDate="2015-11-18T09:24:00.973" Score="0" Body="&lt;p&gt;If you take a look here, this should get you on the right track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9838/how-can-i-set-up-sources-based-on-my-custom-field-data/9839#9839&quot;&gt;How can I set up sources based on my custom field data?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-11-18T09:24:00.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12438" PostTypeId="1" CreationDate="2015-11-18T09:36:53.457" Score="0" ViewCount="36" Body="&lt;p&gt;Accessing the &lt;code&gt;../admin&lt;/code&gt; page, it shows me the login page directly instead of create your account page. I don't have any account for Craft so I'll definitely need to create an account of mine in Craft but not able to find the Create Your Account page.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="57" LastEditDate="2015-11-18T18:26:25.920" LastActivityDate="2015-11-18T18:26:25.920" Title="Not able to see the page Create your Account" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12439" PostTypeId="2" ParentId="12416" CreationDate="2015-11-18T10:15:40.577" Score="1" Body="&lt;p&gt;You could do all of this in PHP. Build your criteria models, merge the results and sort them with &lt;code&gt;usort&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-18T10:15:40.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12440" PostTypeId="1" AcceptedAnswerId="13581" CreationDate="2015-11-18T12:47:49.663" Score="1" ViewCount="379" Body="&lt;p&gt;I'm looking to redirect the user to the same page that they were on, with an additional query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Adam&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-02-05T02:37:49.870" Title="Sprout Forms - Redirect to same page with query string" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12441" PostTypeId="1" AcceptedAnswerId="12448" CreationDate="2015-11-18T13:10:44.377" Score="2" ViewCount="227" Body="&lt;p&gt;I'm looking to use multiple category group as a navigation. The categories have 3 levels and will be listed depending on set variable. I can list all categories in the group with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('categories') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% nav category in categories %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}     &#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I would like to list only the third level categories after the top level and secondary level have been set. I've tried playing around with descendantOf but to no avail. Any help to point me in the right direction much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---Final code----&#xA;After @damon input below this is what I ended up with more or less the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# ---- Set Default Segment ---- #}&#xA;{% set segment = 'default' %}&#xA;{# ---- If url segment is set, set segment to it ---- #}&#xA;{% if craft.request.getSegment(2) %}&#xA;    {% set segment = craft.request.getSegment(2) %}&#xA;{% endif %}&#xA;{% set cat = craft.categories.group('categories').slug(segment).first() %}&#xA;{% for categories in craft.categories.group('categories').descendantOf(cat).level(2) %}&#xA;    {% if categories.getDescendants().total() != 0 %}&#xA;        {% for category in craft.categories.group('categories').descendantOf(categories.id).level(3) %}&#xA;            ...&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-11-23T12:39:15.007" LastActivityDate="2015-11-23T12:39:15.007" Title="Dealing with listing multiple categories" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12443" PostTypeId="2" ParentId="12438" CreationDate="2015-11-18T13:29:42.933" Score="1" Body="&lt;p&gt;You or the person who setup your system created an user account. See step 5 in the installation documentation (&lt;a href=&quot;http://buildwithcraft.com/docs/installing&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/docs/installing&lt;/a&gt;). Therefore there should be an account and you could try to reset the password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to the DB directly you could get or set the email/username associated to that account. Another option would be to start with a fresh installation.&lt;/p&gt;&#xA;" OwnerUserId="149" LastActivityDate="2015-11-18T13:29:42.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12444" PostTypeId="2" ParentId="12421" CreationDate="2015-11-18T13:45:05.693" Score="1" Body="&lt;p&gt;sorry I didn't try to do this and after trying, couldn't get it to work myself... So...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have flexibility and can replace your ligthswitches with a group of checkbox, this becomes a lot easier and potentially more flexible as you could add new 'types of logo' without reviewing your plugin whereas at the moment, you would need to manually add new 'types'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you can, change your ligthswitches for a group of checkbox called 'logos' for example and add 2 checkbox 'Web' &amp;amp; 'Email', then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyUserSources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;    $sources[] = array('heading' =&amp;gt; 'Stats Users');&#xA;&#xA;    $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $user_criteria-&amp;gt;group = 'editors';&#xA;    $user_criteria-&amp;gt;logos = ':notempty:';&#xA;&#xA;        $sources['users:memberBranding'] = array(&#xA;          'label'    =&amp;gt; Craft::t('Logo'),&#xA;          'criteria' =&amp;gt; $user_criteria,&#xA;      );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as a user 'has' a logo AND is an editor, they will show in your source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't change the lightswitch setup, I'm afraid I don't know how to do it and I would love to find out if you manage to get it working!&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-18T13:45:05.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12445" PostTypeId="1" AcceptedAnswerId="12446" CreationDate="2015-11-18T13:49:36.720" Score="5" ViewCount="966" Body="&lt;p&gt;I think I am not fully understanding how caching works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/a/4347/176&quot;&gt;this answer&lt;/a&gt; I thought I could cache my query and then shuffle the resulting array items. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I ended up with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% set categoryProducts = craft.entries.section('products').relatedTo(category) %}&#xA;{% endcache %}&#xA;&#xA;{% set categoryProducts = shuffle(categoryProducts) %}&#xA;{% for entry in categoryProducts %}&#xA;  ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that does give me a &lt;code&gt;&quot;categoryProducts&quot; does not exist&lt;/code&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone shed some light as to why caching the query doesn't work? I thought caching tags help to reduce the amount of queries being made and I've been studying the documentation, but I don't seem to fully grasp the concept.&lt;/p&gt;&#xA;" OwnerUserId="176" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-18T18:20:51.087" Title="Caching queries not working as expected" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12446" PostTypeId="2" ParentId="12445" CreationDate="2015-11-18T14:37:34.350" Score="8" Body="&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag only caches the HTML output.  That's it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example above, nothing is cached, and &lt;code&gt;categoryProducts&lt;/code&gt; will be an empty set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing you could do is to cache each entry individually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryProducts = craft.entries.section('products').relatedTo(category) %}&#xA;{% set categoryProducts = shuffle(categoryProducts) %}&#xA;&#xA;{% for entry in categoryProducts %}&#xA;    {% cache globally using key 'product-' ~ entry.id %}&#xA;        ...&#xA;    {% endcache %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastEditorUserId="125" LastEditDate="2015-11-18T18:20:51.087" LastActivityDate="2015-11-18T18:20:51.087" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12447" PostTypeId="2" ParentId="12433" CreationDate="2015-11-18T15:23:20.783" Score="2" Body="&lt;p&gt;Host your image assets outside of the templates directory. A more appropriate place for UI assets is in the &lt;code&gt;/public&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is attempting to parse the image like it is a template, which is causing the &lt;code&gt;Unexpected Character&lt;/code&gt; error.&lt;/p&gt;&#xA;" OwnerUserId="525" LastEditorUserId="525" LastEditDate="2015-11-20T00:36:08.293" LastActivityDate="2015-11-20T00:36:08.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12448" PostTypeId="2" ParentId="12441" CreationDate="2015-11-18T15:24:04.453" Score="2" Body="&lt;p&gt;I don't think I quite follow you, so forgive me if I'm way off. I have created (what I think) is something similar to what you are looking for. This is how I did it - maybe it will help...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have the following url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.mystore.com/toys/my-awesome-toy&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.categories.slug(craft.request.getSegment(2)).first() %} {# Toys #}&#xA;&#xA;{% for toys in craft.categories.group('toys').descendantOf(cat).level(2) %}&#xA;    {% if toys.getDescendants().total() != 0 %}&#xA;        {% for subToys in craft.categories.group('toys').descendantOf(toys.id).level(3) %}&#xA;            ...&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-11-18T15:24:04.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12449" PostTypeId="2" ParentId="12352" CreationDate="2015-11-18T17:50:56.587" Score="1" Body="&lt;p&gt;Some of the unexpected behavior here ended up being due to a bug in the new 2.5 relatedTo syntax. It was fixed in &lt;a href=&quot;http://buildwithcraft.com/beta#build2724&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5.2724 Beta&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-11-18T17:50:56.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12450" PostTypeId="1" CreationDate="2015-11-18T22:46:33.567" Score="1" ViewCount="320" Body="&lt;p&gt;We are trying to get Office 365 working with a Craft website.  How do we know what the host name and port number is.  Plus, under SMTP authentication setting is asking for a username &amp;amp; password, where do I find this? &lt;/p&gt;&#xA;" OwnerUserId="4372" LastActivityDate="2015-11-19T00:35:46.100" Title="Where do we get the SMTP Authentication information?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12451" PostTypeId="2" ParentId="12450" CreationDate="2015-11-18T23:44:02.977" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://support.office.com/en-us/article/Outlook-settings-for-POP-and-IMAP-access-for-Office-365-for-business-or-Microsoft-Exchange-accounts-7fc677eb-2491-4cbc-8153-8e7113525f6c&quot; rel=&quot;nofollow&quot;&gt;Microsoft&lt;/a&gt;, the Office 365 SMTP server is &lt;code&gt;smtp.office365.com&lt;/code&gt; using port 587 and TLS encryption. Your username and password you'd get from your hosting provider as it's not Craft-specific information.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2015-11-19T00:35:46.100" LastActivityDate="2015-11-19T00:35:46.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12452" PostTypeId="2" ParentId="12355" CreationDate="2015-11-18T23:52:05.117" Score="4" Body="&lt;p&gt;How about we have a matrix, with block types &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;. Then you can test for block type in your loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.this %}&#xA;  {% switch block.type %}&#xA;  {% case 'x' %}&#xA;    ...&#xA;  {% case 'y' %}&#xA;    ...&#xA;  {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another issue is that &lt;code&gt;33.33&lt;/code&gt; + &lt;code&gt;66.66&lt;/code&gt; = &lt;code&gt;99.99&lt;/code&gt;, which is never going to be equal to &lt;code&gt;100&lt;/code&gt;. (Also, the test for equality is &lt;code&gt;==&lt;/code&gt;: &lt;code&gt;{% if x + y == 100 %}&lt;/code&gt;). So let's use x = 1, and y = 2, for a maximum column width of 3. Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisRowLength = 0 %}&#xA;{% set thisBlockLength = 0 %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;  {% for block in entry.this %}&#xA;&#xA;    {# how long is this block? #}&#xA;    {% switch block.type %}&#xA;    {% case 'x' %}&#xA;      {% set thisBlockLength = 1 %}&#xA;    {% case 'y' %}&#xA;      {% set thisBlockLength = 2 %}&#xA;    {% endswitch %}&#xA;&#xA;    {# start a new row if necessary #}&#xA;    {% if thisRowLength + thisBlockLength &amp;gt; 3 %}&#xA;      &amp;lt;/div&amp;gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      {% thisRowLength = 0 %}&#xA;    {% endif %}&#xA;&#xA;    {# now we know it fits, output this block #}&#xA;    {{ block.content }}&#xA;    {% set thisRowLength = thisRowLength + thisBlockLength %}&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will end up with an empty &lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt; if there are no matrix blocks. If that will be a problem, test for it.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-11-18T23:52:05.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12453" PostTypeId="1" CreationDate="2015-11-19T01:35:16.110" Score="3" ViewCount="742" Body="&lt;p&gt;I want to be able to access a plugin page without having to login (for a cron job).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added this to the plugin's controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this url still requires login:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/admin/[plugin]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(If I login to admin, the above url works.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try the url without &lt;code&gt;/admin&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/[plugin]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The page doesn't work at all (logged in or not):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Page Not Found&lt;br&gt;&#xA;  The requested URL was not found on this server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I make it so I can access my plugin page without login?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, I also have this in the &lt;code&gt;[plugin]Plugin.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;  return array(&#xA;    '[plugin]' =&amp;gt; array('action' =&amp;gt; '[Plugin]/[Action]'),&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4374" LastEditorUserId="57" LastEditDate="2015-11-19T02:22:59.160" LastActivityDate="2017-08-09T08:47:46.987" Title="$allowAnonymous = true - not working" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;login&gt;&lt;authentication&gt;&lt;cron&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12454" PostTypeId="2" ParentId="12453" CreationDate="2015-11-19T02:31:12.980" Score="2" Body="&lt;p&gt;It sounds like you just want a cron job to trigger an action on your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't need to register any Control Panel routes for that, so you can remove your &lt;code&gt;registerCpRoutes&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your plugin only has one controller, the URL your cron job would want to target would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yoursite.com/actions/pluginHandle/pluginAction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more about it in the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;plugin controller&lt;/a&gt; docs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-19T02:31:12.980" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12455" PostTypeId="1" AcceptedAnswerId="12456" CreationDate="2015-11-19T08:36:08.733" Score="2" ViewCount="746" Body="&lt;p&gt;I have to...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;merge results from multiple different criteria models&lt;/li&gt;&#xA;&lt;li&gt;use Supersort to order my entries in the desired sort order&lt;/li&gt;&#xA;&lt;li&gt;[...]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...and need to paginate them for my index page. As the &lt;a href=&quot;http://buildwithcraft.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;paginate&lt;/code&gt;&lt;/a&gt; tag doesn't work with arrays of element models, is there any other solution to get this working?&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-11-19T08:50:58.457" LastActivityDate="2015-11-19T08:50:58.457" Title="Paginate entries when I do not have a criteria model?" Tags="&lt;pagination&gt;&lt;entrymodel&gt;&lt;plugin-supersort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12456" PostTypeId="2" ParentId="12455" CreationDate="2015-11-19T08:36:08.733" Score="4" Body="&lt;p&gt;This is in no means an elegant solution, and can almost certainly be improved. But it did its job just fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set veterinarians = craft.entries({&#xA;    section: 'veterinarians',&#xA;    order: 'premiumVet desc, postDate desc',&#xA;}) %}&#xA;&#xA;{# more filter/search params #}&#xA;&#xA;{% set entriesPerPage = 20 %}&#xA;{% set page = craft.request.getParam('page') %}&#xA;{% set page = page ?: 1 %}&#xA;{% set offsetParam = (page - 1) * entriesPerPage %}&#xA;&#xA;{% set veterinarians = veterinarians.offset(offsetParam).limit(entriesPerPage) %}&#xA;&#xA;{% set isNextPage = veterinarians.offset(page * entriesPerPage).limit(1)|length %}&#xA;{% set queryString = craft.request.getQueryStringWithoutPath()|replace('/page=\\d+&amp;amp;?/') %}&#xA;{% set queryString = queryString ? '&amp;amp;' ~ queryString %}&#xA;{% set nextUrl = isNextPage ? craft.request.url ~ '?page=' ~ (page + 1) ~ queryString %}&#xA;&#xA;{% for entry in veterinarians %}&#xA;    {# loop entries #}&#xA;{% endfor %}&#xA;&#xA;{% if nextUrl %}&#xA;    &amp;lt;div class=&quot;js-pagination-trigger&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ nextUrl }}&quot;&amp;gt;Weitere anzeigen&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-19T08:36:08.733" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12457" PostTypeId="1" AcceptedAnswerId="12463" CreationDate="2015-11-19T10:43:27.807" Score="2" ViewCount="55" Body="&lt;p&gt;I've created an action that calls a service. The action will be called by a cron task. I want to set this up so that ONLY the cron task can call the action. It's important that it can not be run by any other means (via HTTP, CURL request etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATED (I think this will work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMethod() &#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $key = craft()-&amp;gt;request-&amp;gt;getParam('key');&#xA;&#xA;    if($key == 'random-string' &amp;amp;&amp;amp; $_SERVER['REMOTE_ADDR'] == 'my-servers-ip-address') {&#xA;        craft()-&amp;gt;plugin_name-&amp;gt;actionMethod();&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note, this is twinned with a cron tab that looks like:&#xA;&lt;code&gt;curl -H &quot;X-Requested-With: XMLHttpRequest&quot; http://sitename.co.uk/actions/plugin_name/Method?key=random-string&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="1016" LastEditDate="2015-11-19T19:12:38.727" LastActivityDate="2015-11-19T19:12:38.727" Title="How do I make a service only runable by the server?" Tags="&lt;services&gt;&lt;cron&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12458" PostTypeId="1" AcceptedAnswerId="12461" CreationDate="2015-11-19T11:23:50.693" Score="5" ViewCount="499" Body="&lt;p&gt;How could I go about fetching all assets that are not currently beeing used anywhere?&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-19T13:03:32.770" Title="Fetch all unused assets?" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12459" PostTypeId="2" ParentId="12458" CreationDate="2015-11-19T11:23:50.693" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: This solution doesn't work, but no-one can explain why (maybe a Craft bug?). I'm leaving the code for reference though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could get them with a &lt;code&gt;craft.assets&lt;/code&gt; element criteria model and a &lt;code&gt;relatedTo&lt;/code&gt; param. Just pass a &lt;code&gt;'and, not 8, not 13, not 26'&lt;/code&gt; type of string to &lt;code&gt;sourceElement&lt;/code&gt;, with all element IDs listed that you want to exclude from an otherwise &lt;code&gt;limit: null&lt;/code&gt; assets query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntryIds = craft.entries.limit(null).ids() %}&#xA;{% set allCategoryIds = craft.categories.limit(null).ids() %}&#xA;&#xA;{% set omitIds = allEntryIds|merge([allCategoryIds]) %}&#xA;{% set idsParam = 'and, not ' ~ omitIds|join(', not ') %}&#xA;&#xA;{% set unusedAssets = craft.assets({&#xA;    relatedTo: {&#xA;        sourceElement: idsParam,&#xA;    },&#xA;    limit: 0,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-11-19T12:19:08.170" LastActivityDate="2015-11-19T12:19:08.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12460" PostTypeId="2" ParentId="12355" CreationDate="2015-11-19T12:51:53.627" Score="2" Body="&lt;p&gt;Instead of building rows, how about building your layout with inline-block elements or flexbox elements with the flex-wrap property set, to make your elements wrap automatically.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-19T12:51:53.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12461" PostTypeId="2" ParentId="12458" CreationDate="2015-11-19T13:03:32.770" Score="7" Body="&lt;p&gt;With good help from @carlcs here and on Slack, we found a solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntryIds = craft.entries.limit(null).ids() %}&#xA;&#xA;{% set usedAssets = craft.assets({&#xA;    relatedTo: allEntryIds,&#xA;    limit: null,&#xA;}).ids() %}&#xA;{% set unusedAssets = craft.assets({&#xA;    id: 'and, not ' ~ usedAssets|join(', not '),&#xA;    limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-11-19T13:03:32.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12463" PostTypeId="2" ParentId="12457" CreationDate="2015-11-19T16:26:10.327" Score="0" Body="&lt;p&gt;Have your cron job pass in a super-duper top-secret key via the querystring.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yoursite.com/actions/pluginHandle/pluginAction?key=youwillneverguessme&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use a site like &lt;a href=&quot;http://www.guidgen.com/&quot; rel=&quot;nofollow&quot;&gt;www.guidgen.com&lt;/a&gt; to generate the key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then just have your action check for that key, make sure it matches and bail if it doesn't.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-19T16:26:10.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12464" PostTypeId="2" ParentId="12457" CreationDate="2015-11-19T16:35:12.010" Score="1" Body="&lt;p&gt;Along with Brad's answer, one additional easy check in your code would be to see if the &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt; is the server's IP and then bail if it's not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means you'd have to spoof the server's IP address AND guess the key. No better than a username/password combination but should be secure enough IMO.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-11-19T16:35:12.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12465" PostTypeId="1" AcceptedAnswerId="12466" CreationDate="2015-11-19T19:25:30.320" Score="2" ViewCount="2508" Body="&lt;p&gt;I have some pages that require login from the user. What I'd like is for the user to get redirected to the page that they wanted after they've logged in rather than sent to the page that they were on before they attempted to view a 'login required' page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present I have this in my login form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.getUrlReferrer }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a craft request method I can use instead of getUrlReferrer to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="4242" LastActivityDate="2019-04-05T20:13:23.203" Title="Redirect user to the page they wanted after login" Tags="&lt;login&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12466" PostTypeId="2" ParentId="12465" CreationDate="2015-11-19T21:18:50.993" Score="6" Body="&lt;p&gt;If you are using &lt;code&gt;{% requireLogin %}&lt;/code&gt; tags, then the Craft UserSession service has a &lt;code&gt;getReturnUrl()&lt;/code&gt; method which should give you what you want. It is accessible in your templates via &lt;code&gt;craft.session.returnUrl&lt;/code&gt;. &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.session#getReturnUrl&quot;&gt;Here is a link to the docs&lt;/a&gt;. Hope this helps! &lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-11-19T21:18:50.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12467" PostTypeId="1" CreationDate="2015-11-19T23:15:50.733" Score="4" ViewCount="951" Body="&lt;p&gt;Is it possible to have a task (defined in a plugin) be scheduled in Craft to run on a recurring basis without having to use cron?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, where do I put those settings (eg, to run a task hourly)?&lt;/p&gt;&#xA;" OwnerUserId="4374" LastActivityDate="2015-11-19T23:26:58.127" Title="Recurring Scheduled Tasks in Craft" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;tasks&gt;&lt;cron&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12468" PostTypeId="2" ParentId="12467" CreationDate="2015-11-19T23:26:58.127" Score="2" Body="&lt;p&gt;Currently not... after all, the task has to be triggered by &lt;em&gt;something&lt;/em&gt; (either a cron job or a PHP request to kick it off).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've discussed the possibility of adding quasi-cron support natively in the future.  It wouldn't be 100% accurate, though, since it would still require a PHP request to trigger it. At most you'd be able to say something like &quot;Start this task at 8PM tomorrow&quot;, but it wouldn't actually start until the first PHP request that occurs after 8PM tomorrow.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-19T23:26:58.127" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12469" PostTypeId="1" AcceptedAnswerId="12471" CreationDate="2015-11-20T02:59:39.810" Score="2" ViewCount="950" Body="&lt;p&gt;I'm a new craft user (previous EE user). trying to follow Zack Spear's directions (&lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;nofollow&quot;&gt;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&lt;/a&gt;) for how to setup Ajax page transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final javascript example (the last code block) the new &quot;loadPage&quot; functions doesn't appears to have any line that actually loads the new content into $main. So when I implement the scripts as per those instructions, the fade in and out work, but the content that fades in is the same content from the previous page rather than the new content that should have replaced it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if I'm being thick here, as I don't have a lot of Ajax experience. &lt;strong&gt;What do I need to add to the loadPage function to get this to work?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4377" LastEditorUserId="22" LastEditDate="2017-05-09T23:08:12.440" LastActivityDate="2017-05-09T23:08:12.440" Title="AJAX page transitions with history.pushState" Tags="&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12471" PostTypeId="2" ParentId="12469" CreationDate="2015-11-20T04:33:57.423" Score="6" Body="&lt;p&gt;So I just went through my article step-by-step and I indeed missed adding the new content into &lt;code&gt;$main&lt;/code&gt;. I think there may have been a versioning mistake in the article's code as I definitely tested it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, here's an updated &lt;code&gt;loadPage&lt;/code&gt; function for you. Which I will be adding to the article tomorrow. I've added a few extra things to ensure that there's no content (like the footer if you include it in &lt;code&gt;layout.twig&lt;/code&gt;) jumping when the content switches out, so feel free to modify that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;loadPage = function(href) {&#xA;&#xA;  $main.wrapInner('&amp;lt;div class=&quot;new-results-div&quot; /&amp;gt;');&#xA;&#xA;  /* ----- Get height of new container inside results container and to ensure the footer doesn't jump up -----  */&#xA;  var newResultsHeight = $('.new-results-div').outerHeight();&#xA;  $main.height(newResultsHeight);&#xA;&#xA;  $('.js-ajax-wrapper').velocity('transition.fadeOut', {&#xA;    /* ----- Upon completion of animating out content put user at top of page. ----- */&#xA;    complete: function(){&#xA;      $('html').velocity(&quot;scroll&quot;, {&#xA;        duration: 0,&#xA;        easing: &quot;ease&quot;,&#xA;        mobileHA: false&#xA;      });&#xA;    }&#xA;  });&#xA;&#xA;  $.ajax({&#xA;    type: 'POST',&#xA;    url: href,&#xA;    data: {},&#xA;    success: function(result){&#xA;      /* ----- HERE'S WERE THE CONTENT GET'S ADDED ----- */&#xA;      $main.html(result);&#xA;&#xA;      /* ----- Wrap content in div so we can get it's height ----- */&#xA;      $main.wrapInner('&amp;lt;div class=&quot;new-results-div&quot; /&amp;gt;');&#xA;&#xA;      /* ----- Get height of new container inside results container and set $main to it so there's no content jumpage -----  */&#xA;      var newResultsHeight = $('.new-results-div').outerHeight();&#xA;      $main.height(newResultsHeight);&#xA;&#xA;      /* ----- Bring In New Content ----- */&#xA;      $('.js-main .js-ajax-wrapper').velocity('transition.fadeIn', {&#xA;        visibility: 'visible',&#xA;        complete: function() {&#xA;          /* ----- Removes the temp height from $main ----- */&#xA;          $main.css('height', '');&#xA;          ajaxLoad();&#xA;        }&#xA;      });&#xA;    },&#xA;    error: function(){&#xA;      console.log(&quot;error.&quot;);&#xA;      location.reload();&#xA;    }&#xA;  });&#xA;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apologize for any trouble due to the missing code. Feel free to let me know if you have any other questions.&lt;/p&gt;&#xA;" OwnerUserId="44" LastActivityDate="2015-11-20T04:33:57.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12472" PostTypeId="1" CreationDate="2015-11-20T13:07:40.370" Score="1" ViewCount="993" Body="&lt;p&gt;Wondering if anyone else has had issues with memory and a large amount of image transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;seems&lt;/em&gt; like perhaps memory is not being freed up between transforms. When GeneratePendingTransforms is running, that process skyrockets my CPU and memory, and just keeps climbing until it is done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly related: &lt;a href=&quot;https://stackoverflow.com/questions/9993085/php-imagick-memory-leak/12835966#12835966&quot;&gt;https://stackoverflow.com/questions/9993085/php-imagick-memory-leak/12835966#12835966&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-02-11T21:33:59.113" Title="Possible memory leak - GeneratePendingTransforms/ImageMagick" Tags="&lt;image-transforms&gt;&lt;tasks&gt;&lt;memory&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12473" PostTypeId="2" ParentId="12084" CreationDate="2015-11-20T13:17:45.983" Score="19" Body="&lt;p&gt;To fix this I have created a &lt;code&gt;.my.cnf&lt;/code&gt; in my home-directory with the following content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="133" LastActivityDate="2015-11-20T13:17:45.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12474" PostTypeId="1" AcceptedAnswerId="12475" CreationDate="2015-11-20T18:33:23.083" Score="3" ViewCount="3842" Body="&lt;p&gt;I have built a plugin that simply makes requests to a 3rd party API. I am calling my plugin action via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have a form on this page currently. Here is what I am using, but I am getting the error &lt;code&gt;The CSRF token could not be verified.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could just put a hidden input field somewhere on my template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ craft.config.csrfTokenName }}&quot; value=&quot;{{ craft.request.csrfToken }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what my ajax call looks like...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;    'thing': value,&#xA;    'thing': value&#xA;};&#xA;&#xA;data[window.csrfTokenName] = window.csrfTokenValue;&#xA;&#xA;$.ajax({&#xA;    'type': 'post',&#xA;    'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    'cache': false,&#xA;    'data': data,&#xA;    'url': 'myplugin/doAction',&#xA;    'dataType': 'json',&#xA;    'timeout': 50000&#xA;}).done(function (response) {&#xA;    callback(response);&#xA;}).fail(function (error) {&#xA;    // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Later on in my site I will have a form that accepts user input, so I would like to keep CSRF enabled for the entire site. Perhaps I need to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4553/whats-the-best-way-to-skip-csrf-for-plugin-controllers&quot;&gt;&quot;skip&quot; the CSRF token for these requests?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2018-06-28T19:12:31.753" Title="What is the best way to append CSRF token without using a form?" Tags="&lt;form&gt;&lt;ajax&gt;&lt;csrf&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12475" PostTypeId="2" ParentId="12474" CreationDate="2015-11-20T18:47:44.933" Score="5" Body="&lt;p&gt;You need to pass the token and name into javascript. Easiest is to just have a script tag somewhere.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.config.csrfTokenName }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.request.csrfTokenValue }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now they will be available to your ajax call.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2015-11-20T18:47:44.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12476" PostTypeId="1" CreationDate="2015-11-20T20:47:46.347" Score="0" ViewCount="354" Body="&lt;p&gt;It seems that suddenly my image transforms are breaking gif animations. Weirdly, things were working fine for a couple of weeks and only recently I've been unable to upload new animated gifs. Here's an example of what I'm talking about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/8k2mx3lysjczi1g/Screenshot%202015-11-20%2014.38.11.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/8k2mx3lysjczi1g/Screenshot%202015-11-20%2014.38.11.png?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that when the gif is transformed, the frames are overlapping and resized differently from frame to frame. I'm not sure what caused this (perhaps a craft update?), but after hours of research I'm wondering if imagick needs a +repage when it reconstructs the animation after the transform... this problem seems related to canvas size... maybe? But I can't find where Craft is sending the command to ImageMagick, so can't experiment w/ the animation settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another weird quirk of this bug is if I have &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&lt;/code&gt; set in my general config file, the page fails to load beyond the gif asset that's causing problems w/ the transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what's going on here? I'm at a total loss...&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2015-11-20T20:47:46.347" Title="ImageMagick gif transform breaking" Tags="&lt;imagick&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12477" PostTypeId="1" AcceptedAnswerId="12785" CreationDate="2015-11-20T20:58:31.540" Score="6" ViewCount="1030" Body="&lt;p&gt;I am using the ElementAPI to generate a json response of data based on the value (locations) that was chosen from a drop-down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have all of the pieces I need, i'm struggling with how to put them all together I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.categories.group('locations') %}&#xA;...&#xA;{% for location in locations %}&#xA;    &amp;lt;option value=&quot;{{ location.slug }}&quot;&amp;gt;{{ location.title }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elementapi.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$slug = craft()-&amp;gt;request-&amp;gt;getRequiredPost('location');  // chicago&#xA;$category = craft()-&amp;gt;categories-&amp;gt;getGroupByHandle('Locations'); // category group&#xA;$location = ??&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'myfile.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'mysection',&#xA;                'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $location],&#xA;            ],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-09T05:05:15.050" LastActivityDate="2016-01-08T05:51:37.993" Title="How can I get to a category via the category slug using the ElementAPI" Tags="&lt;categories&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12478" PostTypeId="2" ParentId="5021" CreationDate="2015-11-20T21:33:49.317" Score="-1" Body="&lt;p&gt;It's an array, so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $event-&amp;gt;params['entry'];&#xA;$text = $entry['text'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4380" LastEditorUserId="57" LastEditDate="2015-11-20T23:28:32.213" LastActivityDate="2015-11-20T23:28:32.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12479" PostTypeId="2" ParentId="12440" CreationDate="2015-11-20T23:56:02.847" Score="2" Body="&lt;p&gt;Sure, in the control panel for sprout forms you can set the redirect page. Say the url for your contact page is /contact you can do something like redirect to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;contact?message=thank-you&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in your contact template do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Check if we should display a thank you message #}&#xA;{% if craft.request.getParam('message') == 'thank-you' %}&#xA; //do stuff here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sprout installs a bunch of sample forms, there's plenty to gleam and learn from these.&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="166" LastEditDate="2015-11-21T00:37:22.800" LastActivityDate="2015-11-21T00:37:22.800" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12480" PostTypeId="2" ParentId="2263" CreationDate="2015-11-21T10:01:44.907" Score="8" Body="&lt;p&gt;Here's a plugin I made that does just that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/khalwat/minify&quot;&gt;https://github.com/khalwat/minify&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-21T10:01:44.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12481" PostTypeId="2" ParentId="7097" CreationDate="2015-11-21T13:56:27.703" Score="1" Body="&lt;p&gt;As the children inherit the settings between the {% nav %}...{% endnav %} so to show an active state on a navigation use...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% nav entry in craft.entries.section('entry') %}                               &#xA;        &amp;lt;li class=&quot;&#xA;            {% if craft.request.getSegment(1) == entry.slug or &#xA;                  craft.request.getSegment(2) == entry.slug %}&#xA;                selected&#xA;            {% endif %}&#xA;            {% if craft.entries.section('entry').descendantOf(entry).find() | length &amp;gt; 0 %}&#xA;                has-children&#xA;            {% endif %}&#xA;        &quot;&amp;gt;&#xA;            {{ entry.getLink() }}&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or use entry.level to target the different levels if you need to.&lt;/p&gt;&#xA;" OwnerUserId="3478" LastEditorUserId="153" LastEditDate="2015-11-23T06:45:56.420" LastActivityDate="2015-11-23T06:45:56.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12482" PostTypeId="1" AcceptedAnswerId="12489" CreationDate="2015-11-21T18:27:10.533" Score="2" ViewCount="553" Body="&lt;p&gt;I am allowing users to register on my site. I want to have the field &quot;full name&quot; on the registration page which, from there I will eventually split that value to populate the first name &amp;amp; last name fields for each user within the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the actual in put in place:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fullName&quot;&amp;gt;Full Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;fullName&quot; type=&quot;text&quot; id=&quot;fullName&quot; name=&quot;fields[fullName]&quot;&#xA;{%- if account is defined %} value=&quot;{{ account.fullName }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('fullName')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have created a plugin to grab the value of the &lt;code&gt;fullName&lt;/code&gt; input. I am using the &lt;code&gt;init()&lt;/code&gt; method to listen for the &lt;code&gt;saveUser&lt;/code&gt; event which is working perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.saveUser', function (Event $event) {&#xA;        error_log('-- saveUser event called --');&#xA;        error_log(print_r($event, true));&#xA;&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;            error_log('-- creating a new user --');&#xA;&#xA;            error_log($event-&amp;gt;params['fullName']);&#xA;&#xA;&#xA;            // split the fullname into firstname &amp;amp; lastname&#xA;&#xA;            // populate first name&#xA;&#xA;            // populate last name&#xA;&#xA;            // save the new user&#xA;        } else {&#xA;            error_log('-- updating an existing user --');&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the data come through in the logs, but I'm not sure how to get to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;error_log&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;[_attributes:Craft\BaseModel:private] =&amp;gt; Array&#xA;                            (&#xA;                                [locale] =&amp;gt; en_us&#xA;                                [elementId] =&amp;gt; 123&#xA;                                [fullName] =&amp;gt; aaa bbb&#xA;                                [id] =&amp;gt; 123&#xA;                            )&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;fullName&quot; parameter is getting populated, but when I log the out put:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error_log($event-&amp;gt;params['fullName']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting the error &lt;code&gt;Undefined index: fullName&lt;/code&gt;. The user &lt;em&gt;is&lt;/em&gt; getting created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;can&lt;/em&gt; get to the data using this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields.fullName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I'm not sure how to get &lt;em&gt;that&lt;/em&gt; back into the user model so it gets saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sigh, well if it isn't obvious I don't give up too easily. I am able to capture the data like this. Is this the correct way? I will have a large number of registrations, so I'm trying to do things the &lt;em&gt;correct&lt;/em&gt; way as much as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['fullName'] = craft()-&amp;gt;request-&amp;gt;getPost('fields.fullName');&#xA;error_log($event-&amp;gt;params['fullName']);  // aaa bbb&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is is in the CP:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/oK4Dr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oK4Dr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick I'm seeing now is how to inject (for lack of better words) the values from &lt;code&gt;fullName&lt;/code&gt; into &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I am using to try to do that (without much success)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$name = explode(' ', craft()-&amp;gt;request-&amp;gt;getPost('fields.fullName'));&#xA;$lastName = array_pop($name);&#xA;$firstName = implode(' ', $name);&#xA;&#xA;$event-&amp;gt;params['fullName'] = craft()-&amp;gt;request-&amp;gt;getPost('fields.fullName');&#xA;$event-&amp;gt;params['firstName'] = $firstName;&#xA;$event-&amp;gt;params['lastName'] = $lastName;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;Full Name&quot; (as you can see in the attachment) is getting populated, but &quot;First Name&quot; and &quot;Last Name&quot; are not. In the logs I can see it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; [isNewUser] =&amp;gt; 1&#xA; [fullName] =&amp;gt; aaa bbb&#xA; [firstName] =&amp;gt; aaa&#xA; [lastName] =&amp;gt; bbb&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the First Name &amp;amp; Last Name fields in the user account tab are not getting populated.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-11-21T20:10:20.920" LastActivityDate="2015-11-22T00:30:13.907" Title="How can I get custom user registration field parameters" Tags="&lt;plugin-development&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12483" PostTypeId="1" AcceptedAnswerId="12486" CreationDate="2015-11-21T19:16:10.817" Score="9" ViewCount="5244" Body="&lt;p&gt;Sorry, this is kind of a newbie question, but I can't figure out how to loop trough all images in one image asset field supporting multiple images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I have been able to output anything without an error, is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.wireframeImages.first() %}&#xA;&#xA;{% if asset %}&#xA;    {{ asset.url }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as you can see, only the first image is printed out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I loop trough all images from this field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading trough &lt;a href=&quot;http://buildwithcraft.com/docs/assets-fields&quot; rel=&quot;noreferrer&quot;&gt;this page&lt;/a&gt;, but can't figure out how to do this simple task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4378" LastEditorUserId="57" LastEditDate="2015-11-22T00:06:04.183" LastActivityDate="2015-11-22T00:06:04.183" Title="Looping through images in a Asset field type" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12484" PostTypeId="2" ParentId="12397" CreationDate="2015-11-21T19:20:08.783" Score="3" Body="&lt;p&gt;Without understanding your use case or having the context of your full template and/or Matrix loop, it's very difficult to provide a good answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to &quot;wrap all outputted blocks&quot; in a container, it's as easy as putting the Matrix loop in a container, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    {% for block in entry.myMatrixFieldHandle %}&#xA;        {% switch block.type %}&#xA;            {% case 'artworkText' %}&#xA;                ...&#xA;            {% case 'artworkImageSingle' %}&#xA;                ...&#xA;            {% case 'artworkImageDouble' %}&#xA;                ...&#xA;            {% case 'artworkFile' %}&#xA;            {% for asset in block.downloadUrl %}&#xA;                &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;file {{ block.platform }} gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on your comments, however, I suspect that what you really want is to only wrap the markup for all your &lt;code&gt;artworkFile&lt;/code&gt; blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is the case, you have to consider the fact that if you want to wrap all of the &lt;code&gt;artworkFile&lt;/code&gt; blocks in a single container and not the other block types, then these &lt;code&gt;artworkFile&lt;/code&gt; blocks will necessarily be removed from the general flow/chronology of your overall Matrix field. This may be exactly what you want, or a side effect you haven't considered - just wanted to mention it. (It also means that you could actually just move the &lt;code&gt;artworkFile&lt;/code&gt; blocks to a separate Matrix field altogether, if that'd make any of this easier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, there's at least a couple of ways to achieve the above with your current setup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you can opt to remove the &lt;code&gt;artworkFile&lt;/code&gt; switch case from your current Matrix loop, and create a secondary loop which only loops on &lt;code&gt;artworkFile&lt;/code&gt; blocks somewhere else in your template. This secondary loop is then wrapped in a &lt;code&gt;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&lt;/code&gt; container, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    {% for block in entry.myMatrixFieldHandle.type('artworkFile') %}&#xA;        {% for asset in block.downloadUrl %}&#xA;        &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;file {{ block.platform }} gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option is to leave the &lt;code&gt;artworkFile&lt;/code&gt; switch in your current Matrix loop, but instead of outputting the markup directly, you can cache it in an array – this is done by first putting the markup in a variable by wrapping the block markup in a &lt;code&gt;{% set %}&lt;/code&gt; tag pair, adding that variable to an array declared outside the loop, and finally print the collected markup by joining the contents of that array inside a container, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Create an empty array outside the loop #}&#xA;{% set artworkFileBlocks = [] %}&#xA;{% for block in entry.myMatrixFieldHandle %}&#xA;    {% switch block.type %}&#xA;        {% case 'artworkText' %}&#xA;            ...&#xA;        {% case 'artworkImageSingle' %}&#xA;            ...&#xA;        {% case 'artworkImageDouble' %}&#xA;            ...&#xA;        {% case 'artworkFile' %}&#xA;        {# Cache the markup for the artworkFile block to a variable #}&#xA;        {% set artworkFileBlock %}&#xA;            {% for asset in block.downloadUrl %}&#xA;                &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;file {{ block.platform }} gutter-bottom--half&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;        {% endset %}&#xA;        {# Add the single artworkFile block markup to the array #}&#xA;        {% set artworkFileBlocks = artworkFileBlocks|merge([artworkFileBlock]) %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&#xA;{# Echo all artworkFile markup in a common container, whereever you need it #}&#xA;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    {{ artworkFileBlocks|join('')|raw }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-11-21T19:20:08.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12485" PostTypeId="2" ParentId="12483" CreationDate="2015-11-21T19:56:44.347" Score="3" Body="&lt;p&gt;Got a working solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = entry.wireframeImages %}&#xA;{% if images | length %}&#xA;  &amp;lt;div class=&quot;row mbb&quot;&amp;gt;&#xA;    {% for image in images %}&#xA;      &amp;lt;div class=&quot;col l3 m4 s6&quot;&amp;gt;&#xA;        &amp;lt;img class=&quot;responsive-img mt bordered&quot; src=&quot;{{ image.getURL() }}&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4378" LastActivityDate="2015-11-21T19:56:44.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12486" PostTypeId="2" ParentId="12483" CreationDate="2015-11-21T19:56:54.890" Score="11" Body="&lt;p&gt;An Asset field – like all relational fields, including Entries, Categories etc – always return an array-like object which is an instance of a class called &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;. To output the actual file data, this means you have to loop on the field, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.wireframeImages %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above is true even if there's 1 Asset selected in the field, or 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cool thing about the &lt;code&gt;for&lt;/code&gt; loop in Twig is that it won't throw an error if you attempt to loop on an empty array or object. This means that you don't have to wrap the loop in an &lt;code&gt;{% if %}&lt;/code&gt; statement to take care of cases where the Asset field may be empty. Moreover, you can add an &lt;code&gt;{% else %}&lt;/code&gt; statement to the &lt;code&gt;for&lt;/code&gt; loop, which will be executed if the field is in fact empty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.wireframeImages %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; /&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Nope, no images here :(&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In situations where your Asset field is limited to 1 file, a loop may seem like overkill – then you can use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.wireframeImages.first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get the first (and only) file. Keep in mind though, that if the Asset field is empty, calling &lt;code&gt;first&lt;/code&gt; on it will in fact produce an error. To get around this, you can use the &lt;code&gt;default&lt;/code&gt; filter to add a default value to the variable and suppress the error. In these cases you have to have a conditional testing the value as well, though – so the amount of code is about the same as just using a &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.wireframeImages.first|default(false) %}&#xA;{% if asset %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;first&lt;/code&gt; isn't the only method available to ElementCriteriaModel instances, &lt;a href=&quot;http://buildwithcraft.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;check out the official docs&lt;/a&gt; to read more about it.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-11-21T20:02:42.007" LastActivityDate="2015-11-21T20:02:42.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12487" PostTypeId="1" AcceptedAnswerId="12490" CreationDate="2015-11-21T20:26:22.467" Score="1" ViewCount="238" Body="&lt;p&gt;A testimonial matrix field has existed in our system for a couple of months. I've just deleted a block that's no longer needed, and am now receiving a SQL warning related to another one of the blocks. The warning occurs when I set the Max Length to anything lower than 145. Here's the warning text:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'field_testimonial_quotation' at row 1. The SQL statement executed was: ALTER TABLE `craft_matrixcontent_testimonialmatrix` CHANGE `field_testimonial_quotation` `field_testimonial_quotation` VARCHAR(110) NULL&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked all of the Entries that use this matrix block, and none of them are close to the Max Length limit.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2015-11-22T00:33:20.900" Title="CDbException warning 1265 after updating matrix field" Tags="&lt;matrix&gt;&lt;database&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12488" PostTypeId="1" AcceptedAnswerId="12494" CreationDate="2015-11-21T22:52:32.610" Score="2" ViewCount="888" Body="&lt;p&gt;I would like to fetch all entries in a section according to a Lightswitch value inside of a matrix field. Initially I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('buildings').spaces.space.isAvailable('1').find&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this doesn't pull any results. Is this even possible in a single query? Or do I need to get all entries from the section first, and then loop over them in order to determine if the Lightswitch has the desired value?&lt;/p&gt;&#xA;" OwnerUserId="3954" LastEditorUserId="57" LastEditDate="2015-11-22T00:34:18.303" LastActivityDate="2015-11-23T07:59:18.067" Title="Get all Entries by Matrix Lightswitch" Tags="&lt;matrix&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12489" PostTypeId="2" ParentId="12482" CreationDate="2015-11-22T00:30:13.907" Score="0" Body="&lt;p&gt;From the &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow&quot;&gt;onSaveUser&lt;/a&gt; event docs, there are two parameters that are passed to everyone listening.  One is &lt;code&gt;isNewUser&lt;/code&gt;, which you're accessing correctly: &lt;code&gt;$event-&amp;gt;params['isNewUser']&lt;/code&gt;.  But the other is &lt;code&gt;user&lt;/code&gt;, which is a full-blown &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; object that you can access the properties of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;code&gt;onSaveUser&lt;/code&gt; isn't the event you want, since you want to make changes to the user &lt;em&gt;before&lt;/em&gt; they've been saved.  You want &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveUser&lt;/a&gt;, which has the exact same parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, names are tricky things around the globe.  I highly recommend reading &lt;a href=&quot;http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; on falsehoods that programmers believe about names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some code that should work for the most basic use cases.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.saveUser', function (Event $event) {&#xA;&#xA;    // Only do this for new users.&#xA;    if ($event-&amp;gt;params['isNewUser'])&#xA;    {&#xA;        $fullName = craft()-&amp;gt;request-&amp;gt;getPost('fields.fullName');&#xA;&#xA;        // Make sure this isn't a user being saved from the control panel.&#xA;        if ($fullName)&#xA;        {&#xA;            $name = explode(' ', $fullName);&#xA;&#xA;            // No spaces, it could be Madonna or Cher.&#xA;            if (count($name) == 1)&#xA;            {&#xA;                $firstName = $name[0];&#xA;                $lastName = '';&#xA;            }&#xA;            // It's a &quot;normal&quot; first and last name.&#xA;            else if ($count($name) == 2)&#xA;            {&#xA;                $firstName = $name[0];&#xA;                $lastName = $name[1];&#xA;            }&#xA;            else&#xA;            {&#xA;                // The first element is the first name. Combine the rest into a last name separated by spaces.&#xA;                $firstName = array_pop($name);&#xA;                $lastName = implode(' ', $name);&#xA;            }&#xA;&#xA;            // Grab the user.&#xA;            $user = $event-&amp;gt;params['user'];&#xA;&#xA;            $user-&amp;gt;firstName = $firstName;&#xA;            $user-&amp;gt;lastName = $lastName;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that UserModel already has a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserModel#getFullName-detail&quot; rel=&quot;nofollow&quot;&gt;getFullName&lt;/a&gt; method that does some basic logic combining the &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt; properties.    &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-22T00:30:13.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12490" PostTypeId="2" ParentId="12487" CreationDate="2015-11-22T00:33:20.900" Score="1" Body="&lt;p&gt;The column &lt;code&gt;field_testimonial_quotation&lt;/code&gt; in your &lt;code&gt;craft_matrixcontent_testimonialmatrix&lt;/code&gt; table has data in it that is longer than 145 characters long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it looks like your MySQL box is running in strict mode, MySQL is warning you that data has been/will be truncated by changing the max length to something below that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-22T00:33:20.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12491" PostTypeId="1" AcceptedAnswerId="12499" CreationDate="2015-11-22T02:48:49.027" Score="2" ViewCount="186" Body="&lt;p&gt;I was wondering if someone could help me find a solution to this. I didn't see it in the docs. Perhaps I missed it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an entry type with the field type &lt;code&gt;Meta: Basic&lt;/code&gt;. I would like to use this to override the meta defaults at the entry level. It doesn't appear to do it on it's own and accessing the content via &lt;code&gt;entry.metaBasic.description&lt;/code&gt; doesn't work either. What am I doing wrong? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4338" LastActivityDate="2015-11-22T17:23:44.613" Title="Using field types to override meta defaults" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12492" PostTypeId="1" AcceptedAnswerId="12493" CreationDate="2015-11-22T04:21:09.460" Score="1" ViewCount="228" Body="&lt;p&gt;I have a basic model defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'id'        =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true),&#xA;        'url'       =&amp;gt; AttributeType::Url,&#xA;        'info'      =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true, 'maxLength' =&amp;gt; 4000),&#xA;        'title'     =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true, 'maxLength' =&amp;gt; 65, 'minLength' =&amp;gt; 15),&#xA;        'message'   =&amp;gt; AttributeType::String,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when checking if the model is valid:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$my_model-&amp;gt;validate())&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Almost any string for 'url' is passing the validation, even without a '.com' &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if someone inputs &lt;strong&gt;sdfsdfsfsdfsdf&lt;/strong&gt; in the input field, it'll pass as a valid URL and return as &lt;strong&gt;&lt;a href=&quot;http://sdfsdfsfsdfsdf&quot; rel=&quot;nofollow&quot;&gt;http://sdfsdfsfsdfsdf&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried using &lt;strong&gt;AttributeType::UrlFormat&lt;/strong&gt; but I run into the same problem. Am I not understanding what this attributetype does, or should it be validating that it's an actual URL string?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-11-22T05:03:34.553" Title="Using $model-&gt;validate() with AttributeType::Url" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12493" PostTypeId="2" ParentId="12492" CreationDate="2015-11-22T05:03:34.553" Score="1" Body="&lt;p&gt;Craft extends Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CUrlValidator&quot; rel=&quot;nofollow&quot;&gt;CUrlValidator&lt;/a&gt; to &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-2-attributetypes&quot; rel=&quot;nofollow&quot;&gt;add support&lt;/a&gt; for protocol-less URLs as well as URLs without a TLD (such as your example of &lt;code&gt;http://sdfsdfsfsdfsdf&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need other behaviors for your URL validation, you can always write a &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators&quot; rel=&quot;nofollow&quot;&gt;custom URL validator&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-22T05:03:34.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12494" PostTypeId="2" ParentId="12488" CreationDate="2015-11-22T15:03:15.147" Score="2" Body="&lt;p&gt;Fetching entries by a Matrix block field value is actually quite complicated, and not possible to do in a single query – at least not using built in services like &lt;code&gt;craft.entries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your idea of pulling all entries and looping through would work – but this kind of &quot;brute force&quot; solution might not scale that well, performance wise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better idea might be to first pull all the &lt;code&gt;space&lt;/code&gt; Matrix blocks that have a &lt;code&gt;true&lt;/code&gt; value for the &lt;code&gt;isAvailable&lt;/code&gt; field, and then pull any entry belonging to the &lt;code&gt;buildings&lt;/code&gt; section that has a relation at least one of those blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, unlike the EntriesService (i.e. &lt;code&gt;craft.entries&lt;/code&gt;), Craft doesn't expose the &lt;a href=&quot;https://buildwithcraft.com/classreference/services/MatrixService&quot; rel=&quot;nofollow&quot;&gt;MatrixService&lt;/a&gt; to Twig, making the above hard to accomplish in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a clean &amp;amp; effective solution to this problem, I'd look to the excellent &lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow&quot;&gt;Low Blocks plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Low Blocks, you'll be able to pull all &lt;code&gt;space&lt;/code&gt; blocks with a &lt;code&gt;true&lt;/code&gt; value for &lt;code&gt;isAvailable&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set spacesMatrixField = craft.fields.getFieldByHandle('spaces') %}&#xA;{% set spaceMatrixBlocks = craft.lowblocks.blocks.fieldId(spacesMatrixField.id).type('space').isAvailable('1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that, we can loop on the &lt;code&gt;matrixBlocks&lt;/code&gt; variable in order to create an array containing the IDs of the entries &quot;owning&quot; these Matrix blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set buildingEntryIds = [] %}&#xA;{% for block in spaceMatrixBlocks %}&#xA;    {% set buildingEntryIds = buildingEntryIds|merge([block.owner.id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally, we pull the entries using the &lt;code&gt;buildingEntryIds&lt;/code&gt; array variable as the parameter to the &lt;code&gt;id&lt;/code&gt; argument:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('buildings').id(buildingEntryIds).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's everything together, for cohesion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get Matrix blocks #}&#xA;{% set spacesMatrixField = craft.fields.getFieldByHandle('spaces') %}&#xA;{% set spaceMatrixBlocks = craft.lowblocks.blocks.fieldId(spacesMatrixField.id).type('space').isAvailable('1') %}&#xA;&#xA;{# Get entry IDs #}&#xA;{% set buildingEntryIds = [] %}&#xA;{% for block in spaceMatrixBlocks %}&#xA;    {% set buildingEntryIds = buildingEntryIds|merge([block.owner.id]) %}&#xA;{% endfor %}&#xA;&#xA;{# Get entries #}&#xA;{% set entries = craft.entries.section('buildings').id(buildingEntryIds).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should hopefully do the trick. If you're interested though, here's some more info on why your first attempt wouldn't work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I'd like to point out that its important to realize that each chained &quot;segment&quot; (such as &lt;code&gt;section&lt;/code&gt; or &lt;code&gt;isAvailable&lt;/code&gt;) in a call to &lt;code&gt;craft.entries&lt;/code&gt; in a template actually ends up as an attribute of an ElementCriteriaModel (an object Craft constructs to query the database). This means that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('buildings').spaces.space.isAvailable('1').find&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is actually the same as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;    section : 'buildings',&#xA;    spaces : null,&#xA;    space : null,&#xA;    isAvailable : '1'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should be fairly obvious why this query won't do what you want; Craft has no idea that &lt;code&gt;spaces.space.isAvailable&lt;/code&gt; is actually the &quot;path&quot; to a certain Matrix block type's field, and will consider each of those segments (&lt;code&gt;spaces&lt;/code&gt;, &lt;code&gt;space&lt;/code&gt; and &lt;code&gt;isAvailable&lt;/code&gt;) as a separate attribute/argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from the syntax issue, the real reason why you'll never be able to use something like &lt;code&gt;spaces.space.isAvailable&lt;/code&gt; in a &lt;code&gt;craft.entries&lt;/code&gt; query is that Matrix blocks aren't just regular, nested fields, but elements unto themselves (just like entries, categories or assets). Also, for any single entry there can be an indefinite number of instances of each block type. If you have multiple &lt;code&gt;space&lt;/code&gt; blocks for a single entry, some with a &lt;code&gt;false&lt;/code&gt; &lt;code&gt;isAvailable&lt;/code&gt; value and some with &lt;code&gt;true&lt;/code&gt;, how would Craft know if the entry should be returned or not?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-11-22T15:03:15.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12495" PostTypeId="1" AcceptedAnswerId="12496" CreationDate="2015-11-22T15:25:24.287" Score="2" ViewCount="363" Body="&lt;p&gt;I'm setting up an FAQ page using a matrix. Each Matrix block contains a question and an answer field. Each Q+A needs to be outputted within a section on the same page such as General, Payments...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've figured the best way to do this is using categories to assign the Q+As section, limiting each Q+A to one category. I'd then need to output all Q+As for each section with it's category as a header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Desired Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;General&amp;lt;/h2&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt;Question field output&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Answer field output&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt;Question field output&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Answer field output&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;h2&amp;gt;Payments&amp;lt;/h2&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt;Question field output&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Answer field output&amp;lt;/p&amp;gt;&#xA;&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to craft so perhaps I'm overcomplicating it by assigning it to a category, it seems like it's the easiest way to add new Q+As and for them to appear within the right section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about outputting this? I've set up a Category Group called 'faqCategories'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my matrix setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EbpxX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EbpxX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2015-11-22T15:48:29.363" Title="Output Matrix in relation to category" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12496" PostTypeId="2" ParentId="12495" CreationDate="2015-11-22T15:48:29.363" Score="3" Body="&lt;p&gt;It's tempting to use the Matrix block for things that might actually be better as a a channel or a structure.  I thing this might be the case here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way you've set it up is fine, relating each FAQ to a category is a good approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, the plugin &lt;code&gt;groupBy&lt;/code&gt; should help you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/timkelty/groupby-craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/timkelty/groupby-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can look at this example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftcookbook.net/recipes/279&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/279&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-22T15:48:29.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12497" PostTypeId="1" AcceptedAnswerId="12498" CreationDate="2015-11-22T16:24:13.357" Score="5" ViewCount="1809" Body="&lt;p&gt;I have a matrix with around 75 fields in it. They are spread over multiple &quot;Block Types&quot;. When I create a new field and save the matrix, the new fields aren't being saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even worse, when I create a new block type with new fields and then drag it up in the order, when I save, Craft is deleting (trimming) the last fields in the matrix - even though they are old (already created) fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft have a limit on the number of fields in a single matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="4388" LastEditorUserId="22" LastEditDate="2017-05-09T23:07:12.660" LastActivityDate="2017-08-07T01:09:32.627" Title="Is there a maximum number of fields in a single matrix?" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12498" PostTypeId="2" ParentId="12497" CreationDate="2015-11-22T16:53:10.960" Score="12" Body="&lt;p&gt;This is because of a combination of settings in your &lt;code&gt;php.ini&lt;/code&gt; file:  &lt;code&gt;max_input_vars&lt;/code&gt; &amp;amp; &lt;code&gt;post_max_size&lt;/code&gt;, not any limitation in Craft CMS. c.f.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2765/matrix-field-input-error-from-within-the-control-panel&quot;&gt;Matrix field input error from within the control panel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-22T16:53:10.960" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12499" PostTypeId="2" ParentId="12491" CreationDate="2015-11-22T17:23:44.613" Score="1" Body="&lt;p&gt;To override the Default meta data with your field type the only addition you need in your code is to pass the &lt;code&gt;entry.id&lt;/code&gt; to your &lt;code&gt;craft.sproutSeo.meta&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({ &#xA;    id: entry.id,    &#xA;    default: 'default',&#xA;    title: entry.title,&#xA;    description: entry.body|striptags|slice(0, 160)&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you identify the &lt;code&gt;entry.id&lt;/code&gt; Sprout SEO will handle the rest, prioritizing any values you have in your field types above any values in your Defaults or Code Overrides.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-11-22T17:23:44.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12500" PostTypeId="1" AcceptedAnswerId="12501" CreationDate="2015-11-23T06:45:11.050" Score="0" ViewCount="491" Body="&lt;p&gt;I want to setup a new custom subdomain (va.domain.com) within the project of my existing domain (craft.domain.com) using &lt;code&gt;homestead&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I referred to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4717/is-it-possible-to-route-a-subdomain-to-specific-template-group&quot;&gt;this answer on craftexchange&lt;/a&gt; and followed all the steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now have a separate folder at the root level called &lt;code&gt;public_va&lt;/code&gt;. Inside that I have my &lt;code&gt;index.php&lt;/code&gt;with this define statement that is supposed to change the path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . &quot;/../templates_va&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside of the &lt;code&gt;craft&lt;/code&gt;folder I have created a folder called &lt;code&gt;templates_va&lt;/code&gt; that is a sibling of the existing &lt;code&gt;templates&lt;/code&gt; folder. And I put in a simple index.html file in just for testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I point my browser to &lt;code&gt;va.domain.com&lt;/code&gt;, it just shows me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Page Not Found&#xA;&#xA;The requested URL was not found on this server.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried creating a new (single) section called &lt;code&gt;va_homepage&lt;/code&gt; in the CP backend but I get the same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? How do I fix this? My error logs inside my vagrant box show nothing. The domain itself has been setup correctly via homestead. I verified by routing request to a static file.&lt;/p&gt;&#xA;" OwnerUserId="597" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-11-23T07:48:55.013" Title="Getting Page Not Found error for my custom subdomain setup" Tags="&lt;routing&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12501" PostTypeId="2" ParentId="12500" CreationDate="2015-11-23T07:48:55.013" Score="1" Body="&lt;p&gt;This is now fixed. The dynamic path to the new templates folder was wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . &quot;/../templates_va&quot;).'/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="597" LastActivityDate="2015-11-23T07:48:55.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12502" PostTypeId="2" ParentId="12488" CreationDate="2015-11-23T07:59:18.067" Score="2" Body="&lt;p&gt;This is a perfect use case for the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse plugin&lt;/a&gt;. Install the plugin and add a Prepase field to your Entry Type and name it &lt;code&gt;spaceAvailable&lt;/code&gt; for example. Configure the field to fetch the first &lt;code&gt;space&lt;/code&gt; Matrix block it can find in your &lt;code&gt;spaces&lt;/code&gt; Matrix and make it return the value of its &lt;code&gt;isAvailable&lt;/code&gt; lightswitch.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstSpaceBlock = entry.spaces.type('space').first() %}&#xA;{{- firstSpaceBlock ? firstSpaceBlock.isAvailable : 0 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This basically copies that value to the root level of your entry model (it does so on every entry save!), and you can now query for the entries you're interested in with a single criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.spaceAvailable(1).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-23T07:59:18.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12503" PostTypeId="1" AcceptedAnswerId="12521" CreationDate="2015-11-23T09:23:07.847" Score="2" ViewCount="4489" Body="&lt;p&gt;We have a seasonal website which gets very popular around this time of year. This year we ported it from ExpressionEngine to Craft, for all the obvious reasons. We were very surprised to discover that the Craft version of the site is using considerably more resources than the old EE one. I'm looking for any advice on how to get this load down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For info; both sites used the same dedicated Virtual Server, a quad core Xeon (minimum 800Mhz, burst to 2Ghz) with 8Gb RAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This weekend the Craft site was dealing with around 500 simultaneous visitors but pushing the CPU load to 7. By judicious use of the {% cache %} tags I dropped the queries per page from 200 to 20, and the load dropped to around 4-5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the site is seeing 700 simultaneous visitors the CPU load is going into double digits and rapidly starts to spiral.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We had to switch out to a static scrape of the site. At the peak last year we were dealing with 1000 simultanious visitors and did not need to switch out to a static site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should point out that both sites are loading all their assets off Amazon S3, so none of those files are having an impact. This is purely about Craft being able to deal with the number of requests it's getting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why might Craft be performing so poorly in comparison, and how can I fix this?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2015-11-23T09:29:32.527" LastActivityDate="2017-10-30T23:30:46.927" Title="How to improve unexpectedly poor Craft performance?" Tags="&lt;performance&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12504" PostTypeId="2" ParentId="12503" CreationDate="2015-11-23T09:59:54.743" Score="6" Body="&lt;p&gt;&lt;a href=&quot;https://supercool.github.io/2015/06/08/making-craft-sing-with-varnish-and-nginx.html&quot; rel=&quot;noreferrer&quot;&gt;This is a great resource&lt;/a&gt; on improving performance as it's a multi-pronged attack:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Native craft caching &lt;code&gt;{% cache %}&lt;/code&gt; which you mentioned you have done&lt;/li&gt;&#xA;&lt;li&gt;CDN and Browser caching&lt;/li&gt;&#xA;&lt;li&gt;Varnish and other tools, including plugins like &lt;a href=&quot;https://github.com/sjelfull/Craft-CacheWarmer&quot; rel=&quot;noreferrer&quot;&gt;Cache Warmer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I concentrated on cache as this is usually where the bottleneck seems to happen in Craft. Apologies if you've addressed all these already!&lt;/p&gt;&#xA;" OwnerUserId="4390" LastActivityDate="2015-11-23T09:59:54.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12505" PostTypeId="2" ParentId="12503" CreationDate="2015-11-23T10:50:01.963" Score="1" Body="&lt;p&gt;The bottleneck for Craft 2.4 is the TTFB: it uses an older Yii framework release which was pretty slow, compared to other frameworks. The Caching implemented in Craft is summier; it does not allow full-page-caching and relies on an external server-side solution (such as Varnish) to handle that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, there's probably no other solution then using a static HTML-cache, with i.e. Varnish.  &lt;/p&gt;&#xA;" OwnerUserId="4114" LastActivityDate="2015-11-23T10:50:01.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12506" PostTypeId="1" CreationDate="2015-11-23T13:30:38.387" Score="1" ViewCount="139" Body="&lt;p&gt;I have a category set up with nested categories so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level1&#xA;   -level2&#xA;       -level3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my entries channel each entry can have multiple nested categories so we may have an entry with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cat1&#xA;  -subcat1&#xA;      -level3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cat2&#xA;  -subcat1&#xA;      -level3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second and third levels will have some categories with the same slug names. So how can I pull out entries with &lt;code&gt;relatedTo&lt;/code&gt; that will look at the parents of each level and only pull out categories from the correct nest?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;------ UPDATE -----&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok I have come up with a solution that works but if anyone can suggest something better please feel free.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sector = 'cat1' %}&#xA;{% set topic = 'subcat1' %} &#xA;{# set entries variable outside of for loop #}&#xA;{% set entries = '' %}&#xA;{% if topic is defined %}&#xA;{% set categories = craft.categories.group('theCategoryHandle').slug(sector).level(1).first() %}&#xA;{% set catChildren = categories.level(3).children %}&#xA;{% for childCat in catChildren %}&#xA;    {% if childCat.slug == topic %}&#xA;        {% set entries = craft.entries.section('mySection').relatedTo(childCat).find() %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-11-24T16:22:10.193" LastActivityDate="2015-11-24T16:22:10.193" Title="How to pull out entries related to multiple nested categories?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12507" PostTypeId="2" ParentId="8869" CreationDate="2015-11-23T14:41:41.707" Score="2" Body="&lt;p&gt;After reading &quot;Built for personal sites built by and for the developer&quot; on the pricing/overview page I too was wary but after asking Brandon directly via the Craft Slack he confirmed...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;yes totally fine, just please don't give your clients an Admin account&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="644" LastActivityDate="2015-11-23T14:41:41.707" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12508" PostTypeId="1" CreationDate="2015-11-23T14:46:35.250" Score="4" ViewCount="137" Body="&lt;p&gt;I'm using the Smart Map plugin but want to render my own maps. All I need is the lat/lng of a visitor yet I can't find it in the documentation. I don't want Smart Maps to render the map for me, I just want the lat/lng.&lt;/p&gt;&#xA;&lt;p&gt;I'm currently using the Geo plugin to do this but it seems a bit silly having both installed.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="45" LastEditDate="2021-01-01T06:28:08.147" LastActivityDate="2021-01-01T06:28:53.890" Title="Smart Map plugin - Get visitor's lat/lng" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12509" PostTypeId="2" ParentId="5019" CreationDate="2015-11-23T14:47:15.000" Score="4" Body="&lt;p&gt;Apparently someone made a plugin that's doing exactly that &lt;a href=&quot;https://straightupcraft.com/craft-plugins/contact-form-receipts&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/contact-form-receipts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" LastActivityDate="2015-11-23T14:47:15.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12511" PostTypeId="1" AcceptedAnswerId="12514" CreationDate="2015-11-23T15:47:28.677" Score="2" ViewCount="247" Body="&lt;p&gt;I'm writing a Javascript based plugin which creates an instance of &lt;code&gt;Craft.BaseElementSelectorModal&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the modal is created, I'd like to have some of the entries in the modal's element index auto-selected (i.e. their containers should have the &lt;code&gt;sel&lt;/code&gt; class added, just like when the user actually selects an entry). I have an array of entry IDs to work with, but I'm struggling to find a way to actually set the element index' selected entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, there aren't any parameters I can set to the &lt;code&gt;BaseElementSelectorModal&lt;/code&gt; (aside from &lt;code&gt;disabledElementIds&lt;/code&gt;, which I can't use as I don't actually want the entries to be &lt;em&gt;disabled&lt;/em&gt;, only &lt;em&gt;selected&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get to the modal's BaseElementIndex instance – is there a way to programmatically select an array of entries?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-11-23T16:35:25.760" LastActivityDate="2015-11-23T19:25:37.727" Title="Setting selected elements in a BaseElementSelectorModal (or BaseElementIndex)" Tags="&lt;plugin-development&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12512" PostTypeId="2" ParentId="12508" CreationDate="2015-11-23T17:12:18.213" Score="3" Body="&lt;p&gt;Smart Map can indeed do this! &lt;s&gt;It's currently an undocumented feature&lt;/s&gt;, because I wasn't sure if/how it was going to evolve over time. However, that feature has changed very little over the past two years, so perhaps it's time to finally document it. :)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; As of Smart Map 2.3, this is now a &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/visitor-geolocation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;publicly documented feature&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:28:53.890" LastActivityDate="2021-01-01T06:28:53.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12513" PostTypeId="1" AcceptedAnswerId="13495" CreationDate="2015-11-23T18:38:21.183" Score="9" ViewCount="711" Body="&lt;p&gt;I have a site with ~ 25000 entries, and around 130 custom fields.  I tried to rebuild the search index and it didn't complete after 8hours of running none stop.  Whilst I'm sure this can be blamed on the Server to some degree, I can see that my search index table has just short of 700000 rows, which I'm guessing takes a reasonable amount of time to create.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was sure that I'd seen somewhere a way to hide/exclude fields from the search index, but looking now I can't find anyway to omit specific fields from the search index, which I would expect to reduce the load on the search indexer, there are only very few fields that I actually want the system to actually search by so I'm hoping there's a solution to this, I can reduce the load on the server and speed up the reindexing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2018-10-16T17:10:20.107" Title="Ignore fields in search index" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12514" PostTypeId="2" ParentId="12511" CreationDate="2015-11-23T19:25:37.727" Score="1" Body="&lt;p&gt;After much exploring in craft.js, I've concluded that this can't be done in a clean way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I found a workaround which seems to do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, here's (a simplified version of) the code that creates the modal (which is stored in the variable &lt;code&gt;modal&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var modal = new Craft.BaseElementSelectorModal('Entry', {&#xA;    criteria: criteria,&#xA;    onSelect: onElementSelect&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After creating the modal, I use &lt;code&gt;setInterval&lt;/code&gt; to look up the &lt;code&gt;modal.elementIndex&lt;/code&gt; property. The reason I use a poller is that this property is actually &lt;code&gt;null&lt;/code&gt; until the internal AJAX call to &lt;code&gt;actions/elementIndex/getElements&lt;/code&gt; is completed. Anyway, I poll the &lt;code&gt;elementIndex&lt;/code&gt; property every 10ms, until the property is found (or after 5 seconds have passed, when its safe to assume something has gone awry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the element index' method &lt;code&gt;selectElementAfterUpdate&lt;/code&gt; is used to select the entries. The method only takes a single entry ID, so I have to call it once for every entry ID in the &lt;code&gt;entryIds&lt;/code&gt; array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var pollCount = 0;&#xA;var pollInterval = 10;&#xA;&#xA;var poller = setInterval(function () {&#xA;    pollCount++;&#xA;    if (pollInterval * pollCount &amp;gt;= 5000) clearInterval(poller);&#xA;    if (modal.elementIndex)&#xA;    {&#xA;        clearInterval(poller);&#xA;        $.map(entryIds, function (entryId) {&#xA;            modal.elementIndex.selectElementAfterUpdate(entryId);&#xA;        });&#xA;    }&#xA;}, pollInterval);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not very smooth! But it works.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-11-23T19:25:37.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12515" PostTypeId="1" AcceptedAnswerId="12577" CreationDate="2015-11-23T20:07:42.887" Score="3" ViewCount="634" Body="&lt;p&gt;I'm not sure what I'm missing, but I'm getting an empty object back from the Element API for the summary and/or body for any given entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elementapi.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'summary' =&amp;gt; $entry-&amp;gt;summary&#xA;    ];&#xA;},&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the json I am getting back:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;data&quot;:[{&quot;title&quot;:&quot;My Title&quot;,&quot;url&quot;:&quot;http:\/\/local.mysite.dev\/section\/my-entry&quot;,&quot;summary&quot;:{}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT/SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you again @Oliver!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to update my post in the event someone else came across it. I am using &lt;a href=&quot;https://github.com/janl/mustache.js&quot; rel=&quot;nofollow&quot;&gt;mustache.js&lt;/a&gt; to render my html from the json that is getting output via the ElementAPI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By casting the summary as a string, you will need to tell mustache to parse the html by using three curly-brackets instead of the usual two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mustache&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Title: {{title}}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;URL: {{url}}&amp;lt;/p&amp;gt;&#xA;{{{ summary }}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise you will end up with something that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Title: My Title&#xA;URL: www.mysite.com&#xA;&amp;lt;p&amp;gt;This is my summary&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-21T18:34:13.143" LastActivityDate="2016-01-21T18:34:13.143" Title="Why is the summary and body returning an empty object using the Element API?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12516" PostTypeId="2" ParentId="10004" CreationDate="2015-11-23T20:33:18.460" Score="4" Body="&lt;p&gt;This question is old, but the solution is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// look up parent with a ElementCriteriaModel&#xA;&#xA;$parentCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;$parentCriteria-&amp;gt;search  = 'slug:'.$parentSlug; // whatever you have&#xA;&#xA;$parent = $parentCriteria-&amp;gt;find()[0];&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = $section;&#xA;&#xA;$entry-&amp;gt;parentId = $parent-&amp;gt;id; &#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="342" LastActivityDate="2015-11-23T20:33:18.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12517" PostTypeId="1" CreationDate="2015-11-23T22:48:36.383" Score="0" ViewCount="456" Body="&lt;p&gt;I have a site with some poorly written code which creates the desired left hand menu from a structure with several hundred entries. Page generation on the server for uncached requests takes 3-5 seconds. Longer term I know I need to fix the code, but short term I have cached the section of code using &lt;code&gt;{% cache %}&lt;/code&gt; and this works really well - until the cache is cleared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have tried Cache Warmer and on running the script I get the presumable success message &quot;All urls are all warmed up&quot;. However all caches are clearly not warmed up when I test the pages - the first load is still slow (and it isn't local caching that helps). There are some numbers in the Cache Warmer plugin configuration screen that suggest there may be a maximum. Furthermore I have certain pages that are not based on their own entries e.g. A site map which runs straight off its own template. This page is particularly slow until it has been run once. So I am not entirely sure how Cache Warmer works and what I need to do to ensure that it warms the entire cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not using anything else. Varnish seems like a solution but for me its implementation might be a bit too complex (I don't have full server access and I am not very skilled on the server end).&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-11-23T23:12:50.043" Title="How to best warm the cache" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12518" PostTypeId="2" ParentId="12517" CreationDate="2015-11-23T23:12:50.043" Score="2" Body="&lt;p&gt;Varnish is sometimes used to paint over poorly written code.  It's not horrible to get it up and running, but it seems to me that in this case, it might just be easier to fix the poorly written code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that what cache warmer does is it pings all of the URLs to get the caches to regenerate... but that just triggers the cache rebuilding process, which isn't instantaneous with Craft CMS.  Did you try waiting a little bit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the data in the large structure change that often?  Something else you could consider too is putting the left menu in a its own template that you cache and load via AJAX so that the rest of the page isn't waiting for it.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-23T23:12:50.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12519" PostTypeId="2" ParentId="12084" CreationDate="2015-11-24T02:50:31.423" Score="8" Body="&lt;p&gt;We have the same problem. MySQL version &lt;em&gt;(Ver 14.14 Distrib 5.7.9, for osx10.11 (x86_64) using  EditLine wrapper)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Had problems &lt;code&gt;SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression&lt;/code&gt; and by adding the code at my.cnf file resolved it for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4392" LastEditorUserId="4371" LastEditDate="2015-11-26T22:22:01.317" LastActivityDate="2015-11-26T22:22:01.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12521" PostTypeId="2" ParentId="12503" CreationDate="2015-11-24T11:10:14.463" Score="2" Body="&lt;p&gt;Thanks all. In summary: Craft 1/2 (based on Yii 1) just isn't very efficient, and beyond using the {% cache %} tags there's very little to be done which can make Craft itself faster. Time to first byte is especially poor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting current versions of Craft to handle high traffic sites essentially requires better horsepower or side-stepping the issue by using something like Varnish or nGinx in front of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, using the not-yet final PHP7 may help, but as that's not final or in any OS repo I think that's outside the bounds of reasonable expectation for a lot of cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 ought to solve a lot of this problem. But that's a way off it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: as a rough guide...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.4, under Apache 2, with MySQL 5.5, PHP 5.4, running on a 2Ghz quad core Xeon with 8Gb RAM will hit a CPU load of 4 (maximum sustainable) with traffic around the 450 simultaneous users level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those that would like an indicator.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2015-11-24T11:55:32.403" LastActivityDate="2015-11-24T11:55:32.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12522" PostTypeId="1" AcceptedAnswerId="12523" CreationDate="2015-11-24T11:31:38.717" Score="3" ViewCount="1070" Body="&lt;p&gt;I want to create a featured story slider on my website and gather the &lt;em&gt;latest&lt;/em&gt; entries from multiple channels to populate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what is working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# fetch the entries&#xA;{% set featuredBlog = craft.entries.section('blogs').limit(1).find() %}&#xA;{% set featuredArticle = craft.entries.section('articles').limit(1).find() %}&#xA;{% set featuredSpecialReport = craft.entries.section('specialReports').limit(1).find() %}&#xA;{% set featuredInfographic = craft.entries.section('infographics').limit(1).find() %}&#xA;&#xA;# create a collection out of the above entries&#xA;{% set allEntries =&#xA;featuredBlog|merge(featuredArticle)|merge(featuredSpecialReport)|merge(featuredInfographic) %}&#xA;&#xA;# loop over the collection and output them&#xA;{% for featuredEntry in allEntries %}&#xA;  {{ featuredEntry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to sort the collection of entries by &lt;code&gt;postDate&lt;/code&gt; so that the latest entry in the collection shows up first, no matter what section it is from. How do I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for featuredEntry in allEntries|group('postDate.day') %}&#xA;  {{ featuredEntry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't work and crashes the template saying &lt;code&gt;Key &quot;title&quot; for array with keys &quot;0, 1, 2&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I sort a collection of entries from multiple sections and show them by latest date descending?&lt;/p&gt;&#xA;" OwnerUserId="597" LastActivityDate="2015-11-24T12:16:47.237" Title="How do I sort a collection of entries from multiple sections by date?" Tags="&lt;sections&gt;&lt;sorting&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12523" PostTypeId="2" ParentId="12522" CreationDate="2015-11-24T12:16:47.237" Score="3" Body="&lt;p&gt;Rather than fetching the entries at first, just grab their IDs using &lt;code&gt;ids()&lt;/code&gt; instead of &lt;code&gt;find()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredBlogId = craft.entries.section('blogs').limit(1).ids() %}&#xA;{% set featuredArticleId = craft.entries.section('articles').limit(1).ids() %}&#xA;{% set featuredSpecialReportId = craft.entries.section('specialReports').limit(1).ids() %}&#xA;{% set featuredInfographicId = craft.entries.section('infographics').limit(1).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then merge all of those arrays together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredIds = featuredBlogId&#xA;    |merge(featuredArticleId)&#xA;    |merge(featuredSpecialReportId)&#xA;    |merge(featuredInfographicId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you’ve got that array of all the latest featured entries’ IDs, you can fetch their full entry models all at once:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntries = craft.entries.id(featuredIds) %}&#xA;&#xA;{% for entry in featuredEntries %}&#xA;    {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-11-24T12:16:47.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12524" PostTypeId="1" CreationDate="2015-11-24T16:10:07.127" Score="1" ViewCount="667" Body="&lt;p&gt;I have a entry field populated by categories. The number of categories an entry can have is unlimited and the categories are set up as nested categories i.e. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first level&lt;/li&gt;&#xA;&lt;li&gt;---second level&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;------third level&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;first level 2&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;---second level 2&lt;/li&gt;&#xA;&lt;li&gt;------third level 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to be able to list out any categories selected at the third level that the entry may have selected if a certain parent category is identified. So far I have the following code. This works but lists all child categories for the identified parent instead of just the selected ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = entry.categories %}&#xA;{% for cat in cats %}&#xA;    {% if cat.slug == 'secondlevel1' or cat.slug == 'secondlevel2' %}&#xA;        {% set catChildren = cats.descendantOf(cat.id).descendantDist('1') %}&#xA;        {% if catChildren | length %}&#xA;            {% for childCat in catChildren %}&#xA;                {% set image = childCat.buildingBlockIcon.first() %}&#xA;                    {% if image %}&#xA;                        &amp;lt;img alt=&quot;{{ childCat.title }}&quot; src=&quot;{{ image.url }}&quot; /&amp;gt;&#xA;                    {% endif %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;----- EDIT Solution -----&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I worked this out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by changing one line of code line 4 above from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catChildren = cat.level(2).children %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catChildren = cats.descendantOf(cat.id).descendantDist('1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now works a treat. Any better solutions feel free to post.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2015-11-25T11:31:55.613" LastActivityDate="2015-11-25T16:47:19.723" Title="How to list an entries selected nested categories?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;children&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12525" PostTypeId="1" AcceptedAnswerId="12538" CreationDate="2015-11-24T17:07:47.303" Score="2" ViewCount="635" Body="&lt;p&gt;I have a page where by default it lists all of the entries inside the section 'work'. I'd like to have a secondary menu where I can filter these entries by the field 'projectCategories'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for entry in craft.entries.section('work').find() %}&#xA;&#xA;            &amp;lt;li class=&quot;wp-project&quot;&amp;gt;&#xA;&#xA;                {% for asset in entry.mainProjectImage %}&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;project-link&quot;&amp;gt;&#xA;                         &amp;lt;img src=&quot;{{ asset.getUrl('workPageImage')}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;&#xA;                &amp;lt;p class=&quot;project-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;&#xA;                &amp;lt;p class=&quot;project-categories&quot;&amp;gt;&#xA;                    {% for option in entry.projectCategories %}&#xA;&#xA;                        {% if loop.last %}&#xA;                            {{ option }}&#xA;&#xA;                        {% else %}&#xA;                            {{ option }} +&#xA;&#xA;                        {% endif %}&#xA;&#xA;                    {% endfor %}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My current solution is a secondary menu above the entries that links to a url where it filters the entry for just for that project category with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('work').search('projectCategories:Packaging') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but isn't DRY and unfortunately because of AJAX the secondary menu fades out and back in again when you change the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to filter entries by a field without changing the url? Or alternatively is there a way of making the secondary menu not reload with AJAX when on a url that begins with 'work'?&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2015-11-27T01:57:09.857" Title="How to create a secondary menu to filter entries?" Tags="&lt;entries&gt;&lt;field&gt;&lt;filter&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12526" PostTypeId="1" CreationDate="2015-11-24T19:02:12.980" Score="0" ViewCount="189" Body="&lt;p&gt;I'm trying to use &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.request#getQueryStringWithoutPath&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getQueryStringWithoutPath()&lt;/code&gt;&lt;/a&gt; to handle query strings on pagination, but for some reason it always seems to return an empty string. If I try &lt;code&gt;craft.request.getQueryString()&lt;/code&gt; I get the query string as expected (eg. &lt;code&gt;foo=bar&lt;/code&gt;), but with the exact same URL &lt;code&gt;getQueryStringWithoutPath()&lt;/code&gt; gives me an empty string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong? Could this be a server configuration issue (I'm using Apache 2.4 with a fairly default configuration)? Or could this be a Craft bug...? I'd be grateful for any help!&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2015-11-24T19:30:28.830" Title="Why does craft.request.getQueryStringWithoutPath return an empty string?" Tags="&lt;pagination&gt;&lt;request&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2015-11-24T19:51:41.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="12527" PostTypeId="2" ParentId="12526" CreationDate="2015-11-24T19:30:28.830" Score="1" Body="&lt;p&gt;Turns out this was a bug that only occurred if the existing URL didn't have an URI associated with it.  i.e. &lt;code&gt;http://craft.dev?foo=bar&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been fixed and will be included in the next 2.5 beta release (or the first 2.5 public release if you don't want to swap to the beta track).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-24T19:30:28.830" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12528" PostTypeId="1" AcceptedAnswerId="12532" CreationDate="2015-11-24T20:54:29.603" Score="1" ViewCount="414" Body="&lt;p&gt;I want to sort entries by Entry Type in the order they appear when you create/edit entry types in the CP (which can be reordered). I can't seem to find an argument for order() that works. Can this be done?&lt;/p&gt;&#xA;" OwnerUserId="4395" LastActivityDate="2015-11-24T23:45:50.707" Title="Ordering entries by Entry Type" Tags="&lt;entries&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12530" PostTypeId="1" CreationDate="2015-11-24T22:23:06.117" Score="1" ViewCount="362" Body="&lt;p&gt;My site is built on a single structure section called &quot;pages&quot;. It includes 4 entryTypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the entryTypes is called &quot;contact&quot; and includes a MatrixBlock that displays fine on the contact page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to make use of those entries (from the Matrix Block) in the site's footer (on all pages). Here is where I started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixFieldHandle.type('MatrixBlockHandle') %}&#xA;{{ block.title }} etc...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This only works on the contact page itself. How can I display a Matrix Field elsewhere than on its own page?&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2015-11-24T22:33:47.760" Title="Use Matrix Block as footer" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12531" PostTypeId="2" ParentId="12530" CreationDate="2015-11-24T22:33:47.760" Score="3" Body="&lt;p&gt;First you need to get the correct entry. Based on what you write, you can get it in any template by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contactPageEntry = craft.entries.section('pages').type('contact').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you should be able to loop over your matrix field like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in contactPageEntry.MatrixFieldHandle.type('MatrixBlockHandle') %}&#xA;    {{ block.title }} etc...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-11-24T22:33:47.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12532" PostTypeId="2" ParentId="12528" CreationDate="2015-11-24T22:42:46.000" Score="3" Body="&lt;p&gt;I don't think you can order by the types order, or get the types in your template (I might be wrong there though), but maybe you don't need to let this be completely dynamic? I guess the user won't be able to add new types or change the order of them after the site is made? If so, couldn't you just make an array of the types and do somthing like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set typesInOrder = ['handle1', 'handle2', 'handle3'] %}&#xA;&#xA;{% for type in typesInOrder %}&#xA;    {% for entry in craft.entries.type(type) %}&#xA;         {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is of course some limitations, especially if you need to paginate the results. And it's bad for performance to do the craft.entries queries several times, especially if you have many entrytypes. Just thought I'd share this in case it's helpful for your usecase.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-11-24T22:42:46.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12533" PostTypeId="1" AcceptedAnswerId="12534" CreationDate="2015-11-24T22:52:20.363" Score="1" ViewCount="737" Body="&lt;p&gt;I'm getting a Template Loader Exception when I hit a 404 on my site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\TemplateLoaderException&#xA;&#xA;Unable to find the template “error”. (/craft/app/etc/templating/twigextensions/TemplateLoader.php:123)&#xA;&#xA;#0 /craft/app/etc/templating/twigextensions/TemplateLoader.php(71): Craft\TemplateLoader-&amp;gt;_findTemplate('error')&#xA;#1 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(312): Craft\TemplateLoader-&amp;gt;getCacheKey('error')&#xA;#2 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(378): Twig_Environment-&amp;gt;getTemplateClass('error', NULL)&#xA;#3 /craft/app/etc/templating/TwigEnvironment.php(23): Twig_Environment-&amp;gt;loadTemplate('error', NULL)&#xA;#4 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(347): Craft\TwigEnvironment-&amp;gt;loadTemplate('error')&#xA;#5 /craft/app/services/TemplatesService.php(225): Twig_Environment-&amp;gt;render('error', Array)&#xA;#6 /craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('error', Array)&#xA;#7 /craft/app/controllers/TemplatesController.php(201): Craft\BaseController-&amp;gt;renderTemplate('error', Array)&#xA;#8 /craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#9 /craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#10 /craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#11 /craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#12 /craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#13 /craft/app/framework/base/CErrorHandler.php(368): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#14 /craft/app/etc/errors/ErrorHandler.php(281): CErrorHandler-&amp;gt;renderError()&#xA;#15 /craft/app/framework/base/CErrorHandler.php(351): Craft\ErrorHandler-&amp;gt;renderError()&#xA;#16 /craft/app/framework/base/CErrorHandler.php(218): CErrorHandler-&amp;gt;renderException()&#xA;#17 /craft/app/etc/errors/ErrorHandler.php(145): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#18 /craft/app/framework/base/CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#19 /craft/app/framework/base/CApplication.php(740): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#20 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#21 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't added a custom 404 error page, or changed the error template paths in my config, so I would expect Craft to serve up its default error page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What gives?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-11-24T22:52:20.363" Title="Why would Craft produce a template loader error (TemplateLoaderException) when rendering its default error pages?" Tags="&lt;config&gt;&lt;error-message&gt;&lt;error&gt;&lt;error-templates&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12534" PostTypeId="2" ParentId="12533" CreationDate="2015-11-24T22:52:20.363" Score="3" Body="&lt;p&gt;As it turns out, I &lt;em&gt;had&lt;/em&gt; made a configuration change that broke Craft's default behavior:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'defaultTemplateExtensions' =&amp;gt; array('twig', 'xml')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of Craft's internal templates use &lt;code&gt;.html&lt;/code&gt;, and HTML templates are included in the default value of that config item. By overriding it, I had rendered Craft unable to find its stock error template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Moral of the story&lt;/strong&gt; &amp;mdash; When you override &lt;code&gt;defaultTemplateExtensions&lt;/code&gt;, make sure to include the default file extensions (&lt;code&gt;'html','twig'&lt;/code&gt;) in the new list that you set.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-11-24T22:52:20.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12535" PostTypeId="2" ParentId="12528" CreationDate="2015-11-24T23:32:43.627" Score="1" Body="&lt;p&gt;You could try it with a MySQL &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html#operator_case&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CASE&lt;/code&gt;&lt;/a&gt; expression in the &lt;code&gt;order&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderParam = &quot;CASE&#xA;    WHEN type = 'handle1' THEN 1&#xA;    WHEN type = 'handle2' THEN 2&#xA;    WHEN type = 'handle3' THEN 3&#xA;    ELSE 99&#xA;END&quot; %}&#xA;&#xA;{% set entries = craft.entries.section('blog').order(orderParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another &lt;em&gt;untested&lt;/em&gt; suggestion is to try and make this dynamic (order similar to CP):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionById(2) %}&#xA;&#xA;{% set orderParam = &quot;CASE&quot; %}&#xA;&#xA;{% for entryType in section.getEntryTypes() %}&#xA;    {% set orderParam = orderParam ~ &quot; WHEN type = '&quot; ~ entryType ~ &quot;' THEN &quot; ~ loop.index %}&#xA;{% endfor %}&#xA;&#xA;{% set orderParam = orderParam ~ &quot; ELSE 99 END&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-11-24T23:45:50.707" LastActivityDate="2015-11-24T23:45:50.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12536" PostTypeId="1" AcceptedAnswerId="12537" CreationDate="2015-11-25T00:12:01.257" Score="2" ViewCount="619" Body="&lt;p&gt;I couldn't find this anywhere else, I'm looking up if the &lt;code&gt;currentUser.isInGroup('verified')&lt;/code&gt; and if not, display another link. Works fine when logged in but throws a Template and Runtime error when using the &lt;code&gt;{{logoutUrl}}&lt;/code&gt; or viewing any page when not logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expected this would work the same as &lt;code&gt;currentUser&lt;/code&gt; by itself, which throws no errors. But obviously there's something I'm missing. Should I be using something like &lt;a href=&quot;http://buildwithcraft.com/docs/templating/craft.session&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.session&lt;/code&gt;&lt;/a&gt; in combination with the &lt;code&gt;isInGroup&lt;/code&gt;? Or some other method of detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GMPyi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GMPyi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6r8U4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6r8U4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('verified') is defined %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seems to get rid of the errors. So a couple of questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this expected behaviour?&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm yet to wrap my head around the &lt;code&gt;|length&lt;/code&gt; &lt;code&gt;is defined&lt;/code&gt; etc methods of checking, and when to use them. I'll have to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/824/test-for-empty-field/836#836&quot;&gt;go over this post a few more times&lt;/a&gt;!&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-11-25T00:23:27.357" Title="currentUser: Impossible to invoke a method (&quot;isInGroup&quot;) on a null variable" Tags="&lt;templating&gt;&lt;users&gt;&lt;user-groups&gt;&lt;group&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12537" PostTypeId="2" ParentId="12536" CreationDate="2015-11-25T00:23:27.357" Score="1" Body="&lt;p&gt;Yes, that's expected behavior.  &lt;code&gt;currentUser&lt;/code&gt; will not exist if there is not a currently logged in user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('verified') is defined %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's one workaround for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%if currentUser is defined and currentUser.isInGroup('verified') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which to me reads a little better even though it's more verbose.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-25T00:23:27.357" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12538" PostTypeId="2" ParentId="12525" CreationDate="2015-11-25T02:08:36.153" Score="1" Body="&lt;p&gt;Ok so if you are showing all of the entries by default, lets say you have 10 entires in your &quot;work&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming that you have a category group(s) that each entry belongs to.&#xA;From there I would assign the category in a &lt;code&gt;data&lt;/code&gt; attribute. This would give you a hook that you could talk to for filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all entries within the work section #}&#xA;{% set entries = craft.entries.section('work').find() %}&#xA;&#xA;{% if entries|length %}&#xA;&amp;lt;ul id=&quot;myNav&quot;&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li data-category=&quot;{{ entry.category }}&amp;gt;&amp;lt;a href={{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# data-category=&quot;{{ entry.category }}&quot; could be data-category=&quot;my-category&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I would have a drop-down, or a set of links that represented each of my categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all categories within the work category group #}&#xA;{% set category = craft.categories.group('work') %}&#xA;&#xA;&amp;lt;select id=&quot;workFilter&quot; name=&quot;workFilter&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select Location&amp;lt;/option&amp;gt;&#xA;    {% for cat in category %}&#xA;        &amp;lt;option value=&quot;{{ cat.slug }}&quot;&amp;gt;{{ cat.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the javascript side, you could either listen for a click - and hide whatever nav items did &lt;em&gt;not&lt;/em&gt; have the same data-category value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;javascript:void(0);&quot; data-target=&quot;my-category&quot; class=&quot;nav-filter&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use a click event to check the data value, and hide whatever nav elements did not have &quot;my-category&quot; as the data-category attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, a drop-down like above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#workFilter').change(function (event) {&#xA;    // get the value of the drop-down. Hide all list items that do not have the same data-category value.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You shouldn't need any ajax or anything like that since all of your entries are already on the page. You just need a hook to show/hide them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure - give &lt;a href=&quot;http://api.jquery.com/fadeout/&quot; rel=&quot;nofollow&quot;&gt;fadeOut&lt;/a&gt; a look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using a button/link you can listen for the &lt;code&gt;click&lt;/code&gt; event. Then &lt;code&gt;fadeOut&lt;/code&gt; the element. That will fade it out, then set the &lt;code&gt;display&lt;/code&gt; to &lt;code&gt;none&lt;/code&gt; which should remove the empty gaps for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('nav-element').click(function(event){&#xA;    $('all-things-not-matching).fadeOut('fast', function() {&#xA;        // Animation complete.&#xA;    });&#xA;&#xA;    event.preventDefault();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each element that is now hidden has the css values of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;opacity: 0;&#xA;display: none;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-11-27T01:57:09.857" LastActivityDate="2015-11-27T01:57:09.857" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12540" PostTypeId="1" CreationDate="2015-11-25T09:21:07.097" Score="1" ViewCount="78" Body="&lt;p&gt;After adding a new locale to the site, the &lt;code&gt;ResaveAllElements&lt;/code&gt; task started going off, and after a while stopped progressing. When i checked the logs it said:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Maximum execution time of 30 seconds exceeded in .../craft/app/framework/db/ar/CActiveRecord.php on line 694&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought the point of tasks and subtasks was to prevent this thing from happening, but i might have misunderstood how it actually works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately i have little to no control over the server configs (apache and php). &#xA;&lt;strong&gt;How can i work around this problem&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro 2.3.2644&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OS: Debian GNU/Linux 7.8 (wheezy)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP 5.4.36&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2015-11-25T16:13:08.980" Title="ResaveAllElements task generates fatal error after adding locale" Tags="&lt;localization&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12541" PostTypeId="1" CreationDate="2015-11-25T13:24:48.430" Score="0" ViewCount="405" Body="&lt;p&gt;After updating my dev install to 2.5 beta, I seem to be missing the action buttons for each tool category in the settings page, see attached image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else experienced this?&lt;a href=&quot;https://i.stack.imgur.com/f7gMj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f7gMj.png&quot; alt=&quot;There should be a red-ish GO button below these checkboxes&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This applies to all 5 categories (&quot;update asset indexes&quot;, &quot;clear caches&quot; etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to re-install the app folder (by completely replacing, not merging) but with no luck, so I'm beginning to think that this all comes down to some database issue...&lt;/p&gt;&#xA;" OwnerUserId="4402" LastActivityDate="2016-02-24T07:50:46.253" Title="Missing buttons in settings after update to 2.5 beta" Tags="&lt;database&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12542" PostTypeId="2" ParentId="12540" CreationDate="2015-11-25T16:13:08.980" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I thought the point of tasks and subtasks was to prevent this thing from happening,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, a task is just another PHP request subject to the same environmental limitations as any other PHP request.  It just so happens that it runs asynchronously in the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you don't have access to a php.ini file to increase values?  You can also try via &lt;a href=&quot;https://stackoverflow.com/questions/7739870/increase-max-execution-time-for-php&quot;&gt;.htaccess&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-25T16:13:08.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12543" PostTypeId="2" ParentId="12503" CreationDate="2015-11-25T16:36:02.350" Score="3" Body="&lt;p&gt;Something about your math or the way you're measuring &lt;em&gt;simultaneous&lt;/em&gt; users is way off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming they're not actually simultaneous &lt;em&gt;requests&lt;/em&gt; since 8 gigs of ram with 450 users is only about 17 MB/user. That's about &lt;a href=&quot;https://buildwithcraft.com/docs/requirements&quot; rel=&quot;nofollow&quot;&gt;half&lt;/a&gt; of what Craft's system requirements are which doesn't add up. And that doesn't even factor in the rest of your stack (since I'm assuming your db and everything else is on the same box).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you're seeing is Craft is using more ram than EE and Apache is swapping like hell, especially if you're using the prefork MPM with mod_php built-in. It sounds like you've maxed out Apache though hard to say. (If you haven't already turned off &lt;code&gt;AllowOverride&lt;/code&gt; for &lt;code&gt;.htaccess&lt;/code&gt; files that's a huge &lt;a href=&quot;http://www.eschrade.com/page/why-is-fastcgi-w-nginx-so-much-faster-than-apache-w-mod_php/&quot; rel=&quot;nofollow&quot;&gt;performance killer&lt;/a&gt;.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option is to move your db to another box or resize your VPS for more ram; you could also setup another box and load balance between the 2 instances but that's expensive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would highly recommend swapping out apache for nginx or throwing nginx in front of apache as a proxy. You mention a static scrape—this is exactly what nginx's &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps&quot; rel=&quot;nofollow&quot;&gt;fastcgi_cache&lt;/a&gt; does. In these cases, &lt;code&gt;fastcgi_cache&lt;/code&gt; is a godsend. Even if you keep the cache low, like expiring every 5 min, you've just quintupled your capacity by hardly doing any extra work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of creating static pages manually, nginx is going to do that for you on the fly; watch your ttfb fall dramatically. It doesn't have to be all or nothing either, you might choose to cache the home page and a few other key pages but keep everything else dynamic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Varnish is an option but it's tougher to setup IMO, it'll eat more ram, and it's another piece to worry about in the stack. If you're running your own VPS, keeping your stack as simple as possible is no-brainer. nginx is a webmaster's swiss army knife that does most things well.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-11-25T17:03:55.030" LastActivityDate="2015-11-25T17:03:55.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12544" PostTypeId="1" AcceptedAnswerId="12547" CreationDate="2015-11-25T16:42:13.827" Score="3" ViewCount="4347" Body="&lt;p&gt;How can I get the current date / time for specific timezones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My local time is easy: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ now|date(&quot;H:i&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So how can I get this for New York? or Singapore?&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-11-25T23:34:05.267" Title="Get current date / time in specific timezone?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;timezone&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12545" PostTypeId="2" ParentId="12524" CreationDate="2015-11-25T16:47:19.723" Score="1" Body="&lt;p&gt;The final solution I got to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cats = entry.categories %}&#xA;{% for cat in cats %}&#xA;    {% if cat.slug == 'secondlevel1' or cat.slug == 'secondlevel2' %}&#xA;        {% set catChildren = cats.descendantOf(cat.id).descendantDist('1') %}&#xA;        {% if catChildren | length %}&#xA;            {% for childCat in catChildren %}&#xA;                {% set image = childCat.buildingBlockIcon.first() %}&#xA;                    {% if image %}&#xA;                        &amp;lt;img alt=&quot;{{ childCat.title }}&quot; src=&quot;{{ image.url }}&quot; /&amp;gt;&#xA;                    {% endif %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-11-25T16:47:19.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12546" PostTypeId="2" ParentId="12544" CreationDate="2015-11-25T16:52:52.170" Score="5" Body="&lt;p&gt;&lt;code&gt;{{ now|date(&quot;H:i&quot;, &quot;Europe/Paris&quot;) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per: &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;noreferrer&quot;&gt;http://twig.sensiolabs.org/doc/filters/date.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-25T16:52:52.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12547" PostTypeId="2" ParentId="12544" CreationDate="2015-11-25T16:56:18.297" Score="5" Body="&lt;p&gt;First define an array of all the timezones you want to output the time with, plus what their “Standard Time”/“Daylight Savings time” abbreviations are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = [&#xA;    { timezone: 'Australia/Sydney',    stAbbr: 'AEST', dstAbbr: 'AEDT' },&#xA;    { timezone: 'America/Los_Angeles', stAbbr: 'PST',  dstAbbr: 'PDT' },&#xA;    { timezone: 'America/New_York',    stAbbr: 'EST',  dstAbbr: 'EDT' },&#xA;    { timezone: 'Europe/London',       stAbbr: 'GMT',  dstAbbr: 'BST' },&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through them, outputting your date in those timezones, plus showing the correct “Standard Time”/“Daylight Savings Time” abbreviation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in locales %}&#xA;    {# Output the date/time in this timezone #}&#xA;    {{ date()|date('F j ga', locale.timezone) }}&#xA;&#xA;    {# Is that timezone currently observing Standard Time? #}&#xA;    {% if date()|date('I', locale.timezone) == '0' %}&#xA;        {{ locale.stAbbr }}&#xA;    {% else %}&#xA;        {{ locale.dstAbbr }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2015-11-25T23:34:05.267" LastActivityDate="2015-11-25T23:34:05.267" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12548" PostTypeId="1" CreationDate="2015-11-25T17:03:02.707" Score="2" ViewCount="96" Body="&lt;p&gt;I am using Craft 2.5 (Beta) along with the fantastic SmartMap plugin. I have a user registration page that I am using the SmartMap field with like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&amp;lt;div class=&quot;form-group has-feedback&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;address&quot; class=&quot;sr-only&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;sr-only&quot;&amp;gt;This field is required.&amp;lt;/span&amp;gt;&#xA;        &amp;lt;i class=&quot;fa fa-asterisk&quot;&amp;gt;&amp;lt;/i&amp;gt; Street Address&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;address&quot; name=&quot;fields[address][street1]&quot;&#xA;    class=&quot;form-control&quot;&#xA;    placeholder=&quot;Street Address&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.address.street1 }}&quot;{% endif -%}&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('address.street1')) }}&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have designated the field be required in the CP, yet I'm not seeing the &quot;Address cannot be blank&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;do&lt;/em&gt; get the error message for a default field type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-group has-feedback&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;homePhone&quot; class=&quot;sr-only&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;sr-only&quot;&amp;gt;This field is required.&amp;lt;/span&amp;gt;&#xA;        &amp;lt;i class=&quot;fa fa-asterisk&quot;&amp;gt;&amp;lt;/i&amp;gt; Home Phone&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;tel&quot; id=&quot;homePhone&quot; name=&quot;fields[homePhone]&quot;&#xA;    class=&quot;form-control&quot;&#xA;    placeholder=&quot;Home Phone&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.homePhone }}&quot;{% endif -%}&amp;gt;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('homePhone')) }}&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The address fields are getting re-populated if there is an error somewhere else on the form, so I know I'm at least talking to it - I just haven't been able to find the right combination&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if account is defined %}&#xA;    {{ errorList(account.getErrors('athleteAddress.street1')) }}&#xA;    {{ errorList(account.getErrors('athleteAddress[street1]')) }}&#xA;    {{ errorList(account.getErrors('account.athleteAddress.street1')) }}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I may have stumbled onto something that could be related?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a SmartMap field in the CP with the handle of &lt;code&gt;address&lt;/code&gt; (as shown above).&#xA;On the profile tab of the user account, I have assigned the &lt;code&gt;address&lt;/code&gt; field, and have set it to be &lt;strong&gt;not&lt;/strong&gt; required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my front-end registration form, I am attempting to populate the SmartMap fields. I have all of the field names matching the field names within the CP. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[address][street1]&#xA;fields[address][street2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I submit the form - which (should) be valid I am getting redirected to the form (page refreshes), the form is fully populated as if there were a validation error, and the user is not saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at the log file, I am seeing all of the data, and it looks good so I'm not sure what the error is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft.log&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'fields' =&amp;gt; &#xA;    array (&#xA;        'address' =&amp;gt; &#xA;            array (&#xA;                'street1' =&amp;gt; '1234 My Street',&#xA;                'street2' =&amp;gt; '123',&#xA;                'city' =&amp;gt; 'My City',&#xA;                'state' =&amp;gt; 'AZ',&#xA;                'zip' =&amp;gt; '12345',&#xA;            ),&#xA;         ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cstqy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cstqy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-11-25T19:27:15.350" LastActivityDate="2015-11-25T19:27:15.350" Title="How can I make a SmartMap field required on a user profile page?" Tags="&lt;custom-fieldtype&gt;&lt;registration&gt;&lt;plugin-smartmap&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12549" PostTypeId="1" CreationDate="2015-11-25T17:32:41.440" Score="2" ViewCount="60" Body="&lt;p&gt;I am currently working on a Craft CMS plugin, which adds functionality on top of assets, that should be callable in templates. I have come up with a Twig Extension that allows templates to call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ image | myCustomMethod }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I would like to provide the method directly on the image itself instead (because it is more readable/intuitive and makes sure &lt;code&gt;image&lt;/code&gt; is included in the craft element cache):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ image.myCustomMethod() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible for a plugin to extend the AssetFileModel class to do that? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="4403" LastEditorUserId="4403" LastEditDate="2015-11-25T17:37:47.373" LastActivityDate="2015-11-25T17:37:47.373" Title="Can plugins add functions to AssetFileModel?" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12550" PostTypeId="2" ParentId="11595" CreationDate="2015-11-25T18:37:11.183" Score="0" Body="&lt;p&gt;I wanted to follow up with this thread in case someone else came across this. If there is a better solution, let me know and I will update the answer accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the example above, the user filling out the form can choose their favorite color(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention that the &lt;code&gt;colors&lt;/code&gt; checkbox field was created in the CP, and all values for the checkbox are managed there. That way I can easily loop through the values within my template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig/html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-group has-feedback&quot;&amp;gt;&#xA;    {% for option in craft.fields.getFieldByHandle('colors').getFieldType.options %}&#xA;        &amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ option.value }}&quot; name=&quot;fields[colors][]&quot; {% if account is defined and option.value in account.colors %}checked{% endif %}&amp;gt;{{ option.label }}&#xA;           &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;   {% if account is defined %}&#xA;       {{ errorList(account.getErrors('colors')) }}&#xA;   {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-11-26T00:04:00.787" LastActivityDate="2015-11-26T00:04:00.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12551" PostTypeId="2" ParentId="2372" CreationDate="2015-11-25T18:40:14.930" Score="1" Body="&lt;p&gt;I realize this thread has an accepted answer, but I wanted to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11595/how-do-i-handle-and-or-repopulate-checkbox-groups/12550#12550&quot;&gt;provide another solution&lt;/a&gt; I was able to come up with because of the answer Brad provided. In my example, I am working with a plugin, but the twig/html is the same plugin or not.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-11-25T18:40:14.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12552" PostTypeId="1" CreationDate="2015-11-25T22:51:40.057" Score="2" ViewCount="424" Body="&lt;p&gt;I currently have entries from a section output simply using a variable like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set beer = craft.entries.section('beverages') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of the beer entries have brands assigned to them using the category field.  How can I display the beer entries by brand? I use that beer variable throughout my templates for entry counts, filters, etc. I'd like to try and keep that in tact if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use this but it seems to do more than what I need: &lt;a href=&quot;http://craftcookbook.net/recipes/330&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/330&lt;/a&gt;.  I also tried the groupBy plugin but had no success in getting that to output anything.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2016-01-31T05:46:09.357" Title="Order Entries in a Section by Category Titles" Tags="&lt;ordering&gt;&lt;order&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12553" PostTypeId="1" CreationDate="2015-11-25T22:54:59.160" Score="2" ViewCount="305" Body="&lt;p&gt;I'm using many &quot;entry type&quot; templates as described here: &lt;a href=&quot;http://buildwithcraft.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;http://buildwithcraft.com/help/entry-type-templates&lt;/a&gt;. I'm using ElementAPI to render full entries as HTML embedded into JSON. I'm using this transformer method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render('path/to/template/template-name', [&#xA;    'entry' =&amp;gt; $template&#xA;])`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine. But I need to assign the corresponding template to each entry-type. I have not found a solution. I can't seem to access the name or path of the assigned template. I don't really need the path, but need the name. The following seems right, but doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'path/to/template/' . $template-&amp;gt;getTemplateName()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4408" LastEditorUserId="4408" LastEditDate="2016-01-05T00:16:10.910" LastActivityDate="2016-02-29T19:37:12.403" Title="ElementAPI -&gt; Find entry template name" Tags="&lt;plugin-elementapi&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12554" PostTypeId="1" CreationDate="2015-11-25T23:56:28.027" Score="3" ViewCount="363" Body="&lt;p&gt;We're looking to hire a talented developer to help us complete and/or maintain a project in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'd like to hire them for a limited contract, or possibly full-time employment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where can I find a person or agency to work on my Craft project?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4407" LastEditorUserId="22" LastEditDate="2017-05-09T22:57:12.587" LastActivityDate="2019-07-31T22:46:24.810" Title="Where can I find someone to help build my Craft website?" Tags="&lt;resources&gt;" AnswerCount="1" CommentCount="0" CommunityOwnedDate="2015-11-26T00:50:34.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="12555" PostTypeId="2" ParentId="12554" CreationDate="2015-11-26T00:38:54.993" Score="4" Body="&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of July 2016, there is now a new jobs board dedicated exclusively to Craft CMS!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.workwithcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Work With Craft&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* Disclaimer: I run the WWC site.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few great resources out there for finding Craft developers... Any of these methods should help you track down someone to help you with your website:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Post on the &lt;strong&gt;Jobs&lt;/strong&gt; board at &lt;a href=&quot;https://straightupcraft.com/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mention it on &lt;a href=&quot;https://craftcms.com/discord&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Discord&lt;/a&gt;, specifically the &lt;strong&gt;#jobs&lt;/strong&gt; channel&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Tweet&lt;/strong&gt; about it on Twitter, using the &lt;a href=&quot;https://twitter.com/search?q=%23craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;#craftcms&lt;/a&gt; hash tag&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To be clear, you won't find anyone here on Stack Exchange. This is typically a resource for developers trying to resolve their programming and architecture issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck! :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2019-07-31T22:46:24.810" LastActivityDate="2019-07-31T22:46:24.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12557" PostTypeId="1" AcceptedAnswerId="12559" CreationDate="2015-11-26T08:06:38.940" Score="4" ViewCount="850" Body="&lt;p&gt;i know this might be a bit out of bounds for this stackexchange site, but i am going a bit batty and any help would be amazing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i am trying to get a console plugin up and running. i started with just the shell of one. got all the basics in place. then when i run &lt;code&gt;craft/app/etc/console/yiic.php&lt;/code&gt; (with no params) to get a list of available commands, i get db connection errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;things to note:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;i can run &lt;code&gt;yiic.php&lt;/code&gt; on my staging server (a centos LAMP cloud server instance at Rackspace) and it's fine, it just has problems locally&lt;/li&gt;&#xA;&lt;li&gt;i am using MAMP Pro locally&lt;/li&gt;&#xA;&lt;li&gt;i can load the site fine through my browser, so credentials in &lt;code&gt;config\db.php&lt;/code&gt; are AOK&lt;/li&gt;&#xA;&lt;li&gt;i can fire up mysql from the cmdline using the same db credentials, and it's fine&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;any help would be so appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the dumped errors i get are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (829)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (842)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (829)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (842)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (829)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (842)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php (203)&#xA;in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;exception 'CException' with message 'Craft\ConsoleApp and its behaviors do not have a method or closure named &quot;getTranslatedBrowserLanguage&quot;.' in /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/base/CComponent.php:266&#xA;Stack trace:&#xA;#0 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(910): CComponent-&amp;gt;__call('getTranslatedBr...', Array)&#xA;#1 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(910): Craft\ConsoleApp-&amp;gt;getTranslatedBrowserLanguage()&#xA;#2 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(800): Craft\AppBehavior-&amp;gt;_getFallbackLanguage()&#xA;#3 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(570): Craft\AppBehavior-&amp;gt;getTargetLanguage(false)&#xA;#4 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php(103): Craft\AppBehavior-&amp;gt;getLanguage()&#xA;#5 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/i18n/CMessageSource.php(83): Craft\ConsoleApp-&amp;gt;getLanguage()&#xA;#6 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/YiiBase.php(590): CMessageSource-&amp;gt;translate('craft', 'Craft can\xE2\x80\x99t c...', NULL)&#xA;#7 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/Craft.php(382): YiiBase::t('craft', 'Craft can\xE2\x80\x99t c...', Array, NULL, NULL)&#xA;#8 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(843): Craft\Craft::t('Craft can\xE2\x80\x99t c...')&#xA;#9 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php(203): Craft\AppBehavior-&amp;gt;createDbConnection()&#xA;#10 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(80): Craft\ConsoleApp-&amp;gt;getComponent('db')&#xA;#11 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(487): Craft\AppBehavior-&amp;gt;isInstalled()&#xA;#12 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/behaviors/AppBehavior.php(187): Craft\AppBehavior-&amp;gt;getInfo('edition')&#xA;#13 [internal function]: Craft\AppBehavior-&amp;gt;getEdition()&#xA;#14 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/base/CComponent.php(261): call_user_func_array(Array, Array)&#xA;#15 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php(307): CComponent-&amp;gt;__call('getEdition', Array)&#xA;#16 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php(307): Craft\ConsoleApp-&amp;gt;getEdition()&#xA;#17 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/ConsoleApp.php(74): Craft\ConsoleApp-&amp;gt;_setEditionComponents()&#xA;#18 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/base/CApplication.php(169): Craft\ConsoleApp-&amp;gt;init()&#xA;#19 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/framework/YiiBase.php(121): CApplication-&amp;gt;__construct('/Users/bhu/drop...')&#xA;#20 /Users/bhu/dropbox-bhu/Dropbox/devel/binarybhu/websites/blackstarcoffee/blackstarcoffee.dev/craft/app/etc/console/yiic.php(78): YiiBase::createApplication('Craft\\ConsoleAp...', '/Users/bhu/drop...')&#xA;#21 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3789" LastEditorUserId="3789" LastEditDate="2015-11-26T20:42:51.143" LastActivityDate="2015-11-28T01:10:34.283" Title="Error Connecting To (MAMP Pro) Database in Console Command" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12558" PostTypeId="2" ParentId="9110" CreationDate="2015-11-26T13:32:18.103" Score="3" Body="&lt;p&gt;You can try using my plugin, which will overwrite the character map in craft.js by applying the customAsciiCharMappings setting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/farmstudio/slugcharmap&quot; rel=&quot;nofollow&quot;&gt;https://github.com/farmstudio/slugcharmap&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tell me if it's working for you.&lt;/p&gt;&#xA;" OwnerUserId="3427" LastActivityDate="2015-11-26T13:32:18.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12559" PostTypeId="2" ParentId="12557" CreationDate="2015-11-26T14:15:40.557" Score="4" Body="&lt;p&gt;finally worked it out! when connecting through &lt;code&gt;localhost&lt;/code&gt; PDO does a socket-based connection to mysql, not tcp. under MAMP the socket file is &quot;non-standard&quot;, and so i have to set it explicitly. when running a console command via yiic.php, &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; is set to &lt;code&gt;console&lt;/code&gt;, and so i add the following to the end of &lt;code&gt;craft/config/db.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'console' =&amp;gt; [&#xA;    'unixSocket' =&amp;gt; '/Applications/MAMP/tmp/mysql/mysql.sock',&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and all is well.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;UPDATE: Better Solution&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;the above is not optimal as obviously one can run a plugin from the console on a live or staging server, as well as a dev machine! so i came up with a better approach: add support for a &lt;code&gt;--mamp&lt;/code&gt; cmdline parameter. so my db.php became:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$db_config = [&#xA;&#xA;    '*' =&amp;gt; [&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; '...',&#xA;        'password' =&amp;gt; '...',&#xA;        'database' =&amp;gt; '...',&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ],&#xA;&#xA;];&#xA;&#xA;// watch for MAMP (need to specify socket file explicitly)&#xA;if (php_sapi_name() == &quot;cli&quot;) {&#xA;    $idx = 0;&#xA;    foreach($_SERVER['argv'] as $key =&amp;gt; $arg) {&#xA;        if (strcasecmp($arg, '--mamp') === 0) {&#xA;            $db_config['*']['unixSocket'] = '/Applications/MAMP/tmp/mysql/mysql.sock';&#xA;            array_splice($_SERVER['argv'], $idx, 1);&#xA;            break;&#xA;        }&#xA;        $idx++;&#xA;    }&#xA;}&#xA;&#xA;&#xA;return $db_config;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3789" LastEditorUserId="3789" LastEditDate="2015-11-28T01:10:34.283" LastActivityDate="2015-11-28T01:10:34.283" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12561" PostTypeId="1" AcceptedAnswerId="12934" CreationDate="2015-11-27T09:02:46.893" Score="2" ViewCount="228" Body="&lt;p&gt;I am having issues with the Smart Map infoBubble pointer position...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YdwCF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YdwCF.png&quot; alt=&quot;Smart Map InfoBubble position bug&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see the shadow is positioned correctly, but the white overlay triangle is too low down. Or the other way of thinking about it would be that the white overlay triangle is correct and the rest is too high. However, I think the problem can best be described as the former, that the white triangle is too low, knowing that the marker it is attached to is hidden away just showing behind the white triangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After inspecting this in Chrome, I cannot see the element / pseudo-element that generates this pointer visual... so cannot debug. Can anybody offer any assistance on how to fix this anomaly? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adam.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-18T14:37:12.613" Title="Smart Map InfoBubble 'pointer' position" Tags="&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12562" PostTypeId="1" CreationDate="2015-11-27T09:20:42.337" Score="1" ViewCount="79" Body="&lt;p&gt;I have two entries, let's say A and B. In the B entry I can select multiple A entries in a entries field. I want to get B entries that have specific A entries selected. So i have the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesAArray = [1,2,3] %}&#xA;{% set entriesB = craft.entries.section('B').relatedTo(A) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entriesAArray&lt;/code&gt; - I have the ids of the A entries that I want the B entries to have selected in the entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="4415" LastEditorUserId="57" LastEditDate="2015-11-27T15:59:14.487" LastActivityDate="2015-11-27T15:59:14.487" Title="Entries relation" Tags="&lt;entries&gt;&lt;relations&gt;&lt;field&gt;&lt;entries-field&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12563" PostTypeId="1" CreationDate="2015-11-27T10:21:56.843" Score="2" ViewCount="37" Body="&lt;p&gt;I don't think this is currently possible. But maybe someone has done this already as a plugin or would I need to build one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Situation is I need to set up First level Users who would be able to set up and manage other level 2 users. But only users they have set up themselves in a specified user group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level1 User1 sets up Level2 User1 &amp;amp; User2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level1 User2 sets up Level2 User3 &amp;amp; User4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level2 users are auto assigned to a Group called Guests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when Level1 User1 logs in he can only see, add and manage Level2 users in the Guests group that he has set up. i.e. Level2 User1 &amp;amp; User2.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2015-11-27T10:21:56.843" Title="Setting up Users to be able to only add/edit users they have set up." Tags="&lt;users&gt;&lt;user-groups&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12564" PostTypeId="1" AcceptedAnswerId="12572" CreationDate="2015-11-27T10:44:52.977" Score="2" ViewCount="312" Body="&lt;p&gt;I have a supertable which lists stockists. Each stockist has a lat/lng for map location. On a page of the site i am implementing a map locator which will need to make an ajax request for the 10 closest stockists to a user supplied address. Basically I will need to query the supertable of stockists (in a plugin) to find these 10 closest. I have written a MySQL stored function to calculate distance between two pairs of lat/lngs. If I was doing raw sql on the database, the query would, for example, look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM `craft_supertablecontent_stockistlist`&#xA;order by (GeocodeCalcDistance(field_lat, field_lng, -27, 153, &quot;km&quot;)) ASC&#xA;limit 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;GeocodeCalcDistance()&lt;/code&gt; is my stored function. I have tested this sql and it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to tranlate that into craft code! My stockists are stored in a supertable, which is defined wholly in the CP (i.e., I don't have custom Model/Record classes in a plugin for the data). How do I express this query in Craft logic? Usually you could do something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = '....';&#xA;$params = array('param1' =&amp;gt; value1);&#xA;$stockists = RecordClass::model()-&amp;gt;findAll($criteria, $params);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;but&lt;/strong&gt; I don't have a &quot;record&quot; class for the table data. I am pretty stumped. any clues greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2015-11-28T15:38:20.440" Title="Query a Supertable using MySQL Stored Function" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12565" PostTypeId="1" AcceptedAnswerId="12568" CreationDate="2015-11-27T11:58:31.657" Score="2" ViewCount="143" Body="&lt;p&gt;How can I get a specific single (careers) with status live in twig?&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2015-11-27T19:10:40.590" Title="How to get specific single with status live" Tags="&lt;templating&gt;&lt;entries&gt;&lt;singles&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12566" PostTypeId="1" AcceptedAnswerId="12569" CreationDate="2015-11-27T16:11:32.277" Score="1" ViewCount="206" Body="&lt;p&gt;I am taking my first &lt;em&gt;real&lt;/em&gt; stab at working with the commerce beta. This plugin is pretty fantastic btw - awesome job guys. I can't comprehend all of the tiny details that went into this considering all of the rabbit holes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running into a snag though, on the last page of checking out it seems everything is going through (using the dummy account) as I can see the pending order in the CP. Perhaps it is something as a mis-configuration on my end (quite possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am seeing this error when I click &quot;Pay&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Commerce_AddressModel and its behaviors do not have a method or closure named &quot;customer&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/commerce/customer/order?number=70829108ec467679afb90e2a857e6701&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;a href=&quot;https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; to snag a valid visa CC number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Steps to recreate:&lt;/strong&gt;&#xA;I have enabled guest registration on my page. I used that option to create a new user. I received the confirmation email, clicked and was able to log into my site as the newly created user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I clicked on the product, entered shipping info (free shipping), entered a valid CC number and clicked &quot;pay&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's when I see the error. But, the order &lt;em&gt;is&lt;/em&gt; showing in the CP.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="9" LastEditDate="2015-12-02T06:36:20.340" LastActivityDate="2015-12-02T06:36:20.340" Title="Craft Commerce - No closure name &quot;Customer&quot;" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12567" PostTypeId="1" CreationDate="2015-11-27T17:24:22.380" Score="1" ViewCount="308" Body="&lt;p&gt;I have xDebug and IntelliJ setup to debug Craft and can run a debug profile where it stops on a breakpoint in &lt;code&gt;index.php&lt;/code&gt; and interprets all the variables, etc. in IntelliJ console. However, it never gets to the plugin action when running &lt;code&gt;host/plugin/someaction&lt;/code&gt; which has in that action a breakpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3334" LastEditorUserId="57" LastEditDate="2015-11-27T17:31:32.577" LastActivityDate="2015-11-28T04:24:34.433" Title="Craft CMS plugin action debugging with IntelliJ" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12568" PostTypeId="2" ParentId="12565" CreationDate="2015-11-27T19:10:40.590" Score="1" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set careers = craft.entries.section('careers') %}&#xA;&#xA;{% if not careers|length %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-27T19:10:40.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12569" PostTypeId="2" ParentId="12566" CreationDate="2015-11-27T20:09:06.830" Score="2" Body="&lt;p&gt;In the latest beta update a change was made to how addresses are managed. You can no longer access the customer from the address model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the following does not work:&#xA;&lt;code&gt;{{address.customer}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was only one location we did this in the example templates and that was in the file: &lt;code&gt;craft/templates/commerce/_includes/address.html&lt;/code&gt;. We removed it from the example templates, so I expect that possibly you have not updated your example templates from the latest release. You will need to manually download the latest release from &lt;a href=&quot;http://craftcommerce.com/download&quot; rel=&quot;nofollow&quot;&gt;http://craftcommerce.com/download&lt;/a&gt; to get the latest example templates, as the 'one click update' magic does not update the example templates automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to access the customer for the order, it is always best to do it from the order and not the order's addresses – like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{order.customer}}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-11-27T20:09:06.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12570" PostTypeId="1" AcceptedAnswerId="12571" CreationDate="2015-11-27T21:08:34.117" Score="2" ViewCount="229" Body="&lt;p&gt;I need to store Javascript/HTML code in some of our entries. I have tried to put the code in plaintext but cannot get the code to render through twig. I cannot store this stuff on the filesystem. It really needs to be attached to an entry if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-11-27T21:30:19.780" Title="How do I store code in Craft" Tags="&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12571" PostTypeId="2" ParentId="12570" CreationDate="2015-11-27T21:30:19.780" Score="4" Body="&lt;p&gt;Store it in a plaintext field, then when you output it, do: &lt;code&gt;{{ entry.myfield | raw }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-11-27T21:30:19.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12572" PostTypeId="2" ParentId="12564" CreationDate="2015-11-28T00:11:03.203" Score="2" Body="&lt;p&gt;ok i found the solution. something about craft that i am (slowly) learning is that when i access elements via something like, e.g., &lt;code&gt;craft()-&amp;gt;globals-&amp;gt;getSetByHandle('stockists')&lt;/code&gt; i'm not getting raw data as such, i am getting an ElementCriteriaModel object! thus my solution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$target_lat = ...;&#xA;$target_lng = ...;&#xA;$limit = ...;&#xA;&#xA;$stockists = craft()&#xA;    -&amp;gt;globals&#xA;    -&amp;gt;getSetByHandle('stockists')&#xA;    -&amp;gt;stockistList&#xA;    -&amp;gt;order(sprintf('(GeocodeCalcDistance(lat, lng, %f, %f, &quot;km&quot;)) asc', $target_lat, $target_lng))&#xA;    -&amp;gt;limit($limit)&#xA;    -&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;GeocodeCalcDistance&lt;/code&gt; is my stored function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;et voila!&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;ANOTHER SOLUTION&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;ok so what i did above was fine. but then i wanted to limit my results by the distance from the target location. this meant i needed the distance calc to move into the select clause, then i could reference it in a &lt;code&gt;having&lt;/code&gt; clause. sounds a bit daunting to try and include in an element-based query. but then i came across a great answer to another question &lt;a href=&quot;https://craftcms.stackexchange.com/a/10878/3789&quot;&gt;here&lt;/a&gt;, which gave me some inspiration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, i need to inject a new column into the select clause (the new column being a call to a stored function). then i need to reference that column in a &lt;code&gt;having&lt;/code&gt; clause. this is done by constructing an &quot;initial&quot; element query (based on a typical &lt;code&gt;ElementCriteriaModel&lt;/code&gt; query), then turning it into a &lt;code&gt;DbCommand&lt;/code&gt; object by using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;buildElementsQuery()&lt;/code&gt;. then i can tweak that query, execute it, then populate models with the raw data returned.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$target_lat = ...;&#xA;$target_lng = ...;&#xA;$limit = ...;&#xA;$range = ...;  // results have to be within this distance from the target&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery(&#xA;    craft()-&amp;gt;globals&#xA;        -&amp;gt;getSetByHandle('stockists')&#xA;        -&amp;gt;stockistList&#xA;        -&amp;gt;order(sprintf('dist asc', $geocode-&amp;gt;lat, $geocode-&amp;gt;lng))&#xA;        -&amp;gt;limit($limit)&#xA;    );&#xA;&#xA;$query-&amp;gt;select(sprintf('(GeocodeCalcDistance(field_lat, field_lng, %f, %f, &quot;km&quot;)) as dist, ', $geocode-&amp;gt;lat, $geocode-&amp;gt;lng) . $query-&amp;gt;select);&#xA;$query-&amp;gt;having(sprintf('dist &amp;lt;= %d', $range));&#xA;if ($results = $query-&amp;gt;queryAll()) {&#xA;    $stockists = SuperTable_BlockModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3789" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-28T15:38:20.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12573" PostTypeId="2" ParentId="12567" CreationDate="2015-11-28T04:24:34.433" Score="1" Body="&lt;p&gt;Right! setting the mapping to the specific file, in this case the controller of plugin made it all work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again for taking the time!&lt;/p&gt;&#xA;" OwnerUserId="3334" LastActivityDate="2015-11-28T04:24:34.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12575" PostTypeId="1" CreationDate="2015-11-28T13:28:00.980" Score="3" ViewCount="365" Body="&lt;p&gt;I'd like to have an elementSelectField in my plugin. The goal is to select a Company which is defined by my plugin Model. So when clicked, it'll display a list of companies in the Dialog box and you select or search for them, then close it (Same way as selecting Assets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an example I can see out there or perhaps some guidance? Do I need my own FieldType?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Ryan&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2015-12-04T16:42:38.477" Title="Plugin: Linking elementSelectField to own plugin models" Tags="&lt;form&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12577" PostTypeId="2" ParentId="12515" CreationDate="2015-11-28T14:34:51.220" Score="6" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'summary' =&amp;gt; (string) $entry-&amp;gt;summary&#xA;    ];&#xA;},&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2015-11-28T14:34:51.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12578" PostTypeId="1" AcceptedAnswerId="12579" CreationDate="2015-11-29T04:53:11.750" Score="1" ViewCount="253" Body="&lt;p&gt;How would I access the available &lt;code&gt;RedisCache&lt;/code&gt; class and it's properties/methods in PHP/plugins? (&lt;a href=&quot;https://buildwithcraft.com/classreference/etc/cache/RedisCache&quot; rel=&quot;nofollow&quot;&gt;https://buildwithcraft.com/classreference/etc/cache/RedisCache&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just starting to learn Redis and can't seem to find more information about how to start using the available class. I have set &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; to &lt;code&gt;redis&lt;/code&gt;, and created a &lt;code&gt;rediscache.php&lt;/code&gt; file in &lt;code&gt;craft/config/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to explore connecting to db, inserting my own keys/values and retrieving data for my other plugins, but can't seem to find the right path path. I tried things like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo craft()-&amp;gt;redisCache-&amp;gt;hostname; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that returns &lt;code&gt;CExeption&lt;/code&gt; errors. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="57" LastEditDate="2015-11-29T05:57:14.210" LastActivityDate="2015-11-29T07:12:58.937" Title="Using RedisCache Class &amp; Methods" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12579" PostTypeId="2" ParentId="12578" CreationDate="2015-11-29T06:03:45.890" Score="1" Body="&lt;p&gt;You put your Redis connection information in your &lt;code&gt;craft/config/rediscache.php&lt;/code&gt; config file.  You can see the default &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/rediscache.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, and your file will override any matching set keys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you can use &lt;code&gt;craft()-&amp;gt;cache-&amp;gt;set()&lt;/code&gt;, &lt;code&gt;craft()-&amp;gt;cache-&amp;gt;get()&lt;/code&gt; and any other cache methods on Yii's &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/caching/CCache.php&quot; rel=&quot;nofollow&quot;&gt;CCache&lt;/a&gt; class.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-11-29T07:12:58.937" LastActivityDate="2015-11-29T07:12:58.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12580" PostTypeId="1" AcceptedAnswerId="12587" CreationDate="2015-11-29T13:30:40.940" Score="3" ViewCount="243" Body="&lt;p&gt;Hopefully my titles makes some sense but I will try to elaborate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Channel entry called Movies that I am using the Element API to turn into JSON. There is a field inside that called Movie Genre which is an Entry type field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I create this transformer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $movie) {&#xA;&#xA;                return [&#xA;                    'name' =&amp;gt; $movie-&amp;gt;title,&#xA;                    'genres' =&amp;gt; $movie-&amp;gt;movieGenre[0]-&amp;gt;title&#xA;                ];&#xA;            },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the JSON I get now, which looks to me like it is gathering all entries, not just the ones inside the channel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{&quot;data&quot;:[{&quot;name&quot;:&quot;Harry Potter and The Order of the&#xA;  Phoenix&quot;,&quot;genres&quot;:&quot;Fantasy&quot;},{&quot;name&quot;:&quot;Jurassic&#xA;  World&quot;,&quot;genres&quot;:&quot;Science&#xA;  Fiction&quot;},{&quot;name&quot;:&quot;Romance&quot;,&quot;genres&quot;:null},{&quot;name&quot;:&quot;Science&#xA;  Fiction&quot;,&quot;genres&quot;:null},{&quot;name&quot;:&quot;Comedy&quot;,&quot;genres&quot;:null},&#xA;  {&quot;name&quot;:&quot;Fantasy&quot;,&quot;genres&quot;:null},{&quot;name&quot;:&quot;Guardians&#xA;  of the Galaxy&quot;,&quot;genres&quot;:&quot;Action&quot;},{&quot;name&quot;:&quot;Horror&quot;,&quot;genres&quot;:null},&#xA;  {&quot;name&quot;:&quot;Action&quot;,&quot;genres&quot;:null},{&quot;name&quot;:&quot;Home&quot;,&quot;genres&quot;:null},&#xA;  {&quot;name&quot;:&quot;Thirteen Ghosts&quot;,&quot;genres&quot;:&quot;Horror&quot;},&#xA;  {&quot;name&quot;:&quot;Movies&quot;,&quot;genres&quot;:null},{&quot;name&quot;:&quot;Genres&quot;,&quot;genres&quot;:null}],&quot;meta&quot;:&#xA;  {&quot;pagination&quot;:&#xA;  {&quot;total&quot;:13,&quot;count&quot;:13,&quot;per_page&quot;:100,&quot;current_page&quot;:1,&quot;total_pages&quot;:1,&quot;links&quot;:[]}}}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I need to happen is only the Movies get returned as an item in the JSON and the movieGenre entry type not as its own item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the desired JSON outcome.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{&quot;data&quot;:[{&quot;name&quot;:&quot;Harry Potter and The Order of the&#xA;  Phoenix&quot;,&quot;genres&quot;:&quot;Fantasy&quot;},{&quot;name&quot;:&quot;Jurassic&#xA;  World&quot;,&quot;genres&quot;:&quot;Science Fiction&quot;},{&quot;name&quot;:&quot;Guardians of the&#xA;  Galaxy&quot;,&quot;genres&quot;:&quot;Action&quot;},{&quot;name&quot;:&quot;Thirteen&#xA;  Ghosts&quot;,&quot;genres&quot;:&quot;Horror&quot;}],&quot;meta&quot;:{&quot;pagination&quot;:{&quot;total&quot;:13,&quot;count&quot;:13,&quot;per_page&quot;:100,&quot;current_page&quot;:1,&quot;total_pages&quot;:1,&quot;links&quot;:[]}}}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3836" LastEditorUserId="3836" LastEditDate="2015-11-30T06:56:47.527" LastActivityDate="2015-11-30T07:12:03.137" Title="Element API: Entry field inside a Channel entry being passed into JSON file" Tags="&lt;entry-type&gt;&lt;channels&gt;&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12581" PostTypeId="1" AcceptedAnswerId="12584" CreationDate="2015-11-29T13:49:01.293" Score="4" ViewCount="89" Body="&lt;p&gt;I've got an event listener hooked up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.populateElement', array($this, 'onPopulateElements'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to detach/deregister the listener? E.g. something like this (this doesn't work, but to illustrate):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;off('elements.populateElement', array($this, 'onPopulateElements'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-02-25T04:51:21.643" Title="Is it possible to detach event listeners?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12582" PostTypeId="2" ParentId="12581" CreationDate="2015-11-29T17:00:52.603" Score="0" Body="&lt;p&gt;Completely untested, and not sure if this will work with events registered with &lt;a href=&quot;http://buildwithcraft.com/classreference/etc/web/WebApp#on-detail&quot; rel=&quot;nofollow&quot;&gt;on&lt;/a&gt;, instead of the traditional Yii method, but try either:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;detachEventHandler('elements.onPopulateElements', array($this, 'elements.onPopulateElements'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;detachEventHandler('onPopulateElements', array($this, 'onPopulateElements'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If neither of those work, then we'd need to add a custom &lt;code&gt;off&lt;/code&gt; that takes into account the &lt;code&gt;componentName.event&lt;/code&gt; event syntax that &lt;code&gt;on&lt;/code&gt; users.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-29T17:00:52.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12583" PostTypeId="2" ParentId="12299" CreationDate="2015-11-29T18:18:49.640" Score="2" Body="&lt;p&gt;The craft path should be 1 level deeper like that '../../craft' instead of '../craft'. This is what was causing it, but I had to reconfigure the locales from &lt;code&gt;fr_fr&lt;/code&gt; to &lt;code&gt;fr&lt;/code&gt;. It didn't work in original way.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-11-29T18:18:49.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12584" PostTypeId="2" ParentId="12581" CreationDate="2015-11-29T23:45:21.520" Score="2" Body="&lt;p&gt;Not possible currently, but there's &lt;a href=&quot;https://github.com/craftcms/cms/issues/1118&quot; rel=&quot;nofollow noreferrer&quot;&gt;a feature request&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="57" LastEditDate="2017-02-25T04:51:21.643" LastActivityDate="2017-02-25T04:51:21.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12585" PostTypeId="1" CreationDate="2015-11-30T03:57:35.030" Score="2" ViewCount="197" Body="&lt;p&gt;I want to display the first character in a paragraph with a drop cap. It works fine with normal text or setting it with js, but when I use an entry field it doesn't pull out the first character. The code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// css&#xA;p.dropcap { &#xA;float: left; &#xA;font-size: 4em;&#xA;… &#xA;}&#xA;&#xA;// html&#xA;&amp;lt;p class='dropcap'&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first letter isn't dropped, but if I change the html to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class='drop cap'&amp;gt;This is {{ entry.body }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The T is dropped as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to fix this?&lt;/p&gt;&#xA;" OwnerUserId="4395" LastActivityDate="2015-11-30T17:28:35.207" Title="craft.entries and :first-letter" Tags="&lt;entries&gt;&lt;css&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12586" PostTypeId="1" CreationDate="2015-11-30T05:14:18.037" Score="1" ViewCount="221" Body="&lt;p&gt;I am trying to make dependency's work using Craft Cache (set to Redis.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;cache-&amp;gt;set('cache_key', 'cache_value', 0, new CFileCacheDependency('dependent_cache_key'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This stores the cache. However, when I then update the value for cache with the key name &lt;code&gt;dependent_cache_key&lt;/code&gt;, &lt;code&gt;cache_key&lt;/code&gt; does not invalidate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;CFileCacheDependency&lt;/code&gt; not the right way to attach dependency to a cache key? All the YII description says is &quot;File Name.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is it possible to declare directories for Craft Cache? I see YII also has a dependency method for directories &lt;code&gt;CDirectoryCacheDependency&lt;/code&gt;, which would be optimal in my case, but I have no idea how to assign a directory for cache using &lt;code&gt;craft()-&amp;gt;cache-&amp;gt;set()&lt;/code&gt; and &lt;code&gt;craft-&amp;gt;cache-&amp;gt;get()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be incredibly appreciated. Been stumped crawling through yii docs to figure this out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/caching.data#cache-dependency&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/doc/guide/1.1/en/caching.data#cache-dependency&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-11-30T05:14:18.037" Title="Craft Cache Dependency with Redis" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;yii&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12587" PostTypeId="2" ParentId="12580" CreationDate="2015-11-30T07:12:03.137" Score="1" Body="&lt;p&gt;I figured it out. Turned out I had entered the criteria incorrectly, as channel instead of section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['section' =&amp;gt; 'movies'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;not&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['channel' =&amp;gt; 'movies'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3836" LastActivityDate="2015-11-30T07:12:03.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12588" PostTypeId="1" CreationDate="2015-11-30T12:12:00.700" Score="1" ViewCount="725" Body="&lt;p&gt;I've set up some dynamic routes to work with categories, so for example the route is set up to load a specific template if the work category appears in the URI, thus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news-events/image-gallery/category/[slug]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I test with the following URL I get a 404 error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/news-events/image-gallery/category/drama&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other dynamic routes are working fine. Thoughts on how to debug/resolve appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-11-30T12:44:39.523" Title="Dynamic route returning 404 error" Tags="&lt;routes&gt;&lt;category&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12589" PostTypeId="2" ParentId="12588" CreationDate="2015-11-30T12:44:39.523" Score="1" Body="&lt;p&gt;I ran into a similar problem with categories and routing a while ago and Marion's answer in this thread worked for me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1291/how-would-i-include-the-first-category-slug-in-the-sections-entry-url-format&quot;&gt;How would I include the first category slug in the section&amp;#39;s entry URL format?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Darrell&lt;/p&gt;&#xA;" OwnerUserId="201" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-11-30T12:44:39.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12590" PostTypeId="1" CreationDate="2015-11-30T14:09:52.987" Score="1" ViewCount="476" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/objectivehtml/Google-Maps-for-Craft&quot; rel=&quot;nofollow&quot;&gt;Google Maps plugin for Craft&lt;/a&gt; and I'm trying to generate the map via a front-end entry form using address fields but I can't seem to get this to work. If I go into the admin and save the entry I can get it to generate using a Google Map field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2015-11-30T14:09:52.987" Title="Google Maps plugin - Create map from front-end form" Tags="&lt;plugins&gt;&lt;google-maps&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12591" PostTypeId="2" ParentId="10667" CreationDate="2015-11-30T14:44:06.800" Score="0" Body="&lt;p&gt;Just to add to this, you can easily remove previous versions of files (except the current/most recent) with the following SQL query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DELETE FROM craft_entryversions WHERE id NOT IN (SELECT id FROM (SELECT max(id), entryId FROM craft_entryversions GROUP BY entryId) X);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously backup the old database/table first!&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="992" LastEditDate="2015-11-30T14:57:55.177" LastActivityDate="2015-11-30T14:57:55.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12592" PostTypeId="1" CreationDate="2015-11-30T16:17:56.153" Score="2" ViewCount="202" Body="&lt;p&gt;I have some front-end forms including login and sign up which are modal windows. Currently I have no feedback for the user if they are successful or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best method to return something in the modal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an ideal world I'd like to update the buttons somehow, like these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://demo.tutorialzine.com/2013/10/buttons-built-in-progress-meters/&quot; rel=&quot;nofollow&quot;&gt;http://demo.tutorialzine.com/2013/10/buttons-built-in-progress-meters/&lt;/a&gt;&#xA;or&#xA;&lt;a href=&quot;http://lab.hakim.se/ladda/&quot; rel=&quot;nofollow&quot;&gt;http://lab.hakim.se/ladda/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas or help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2015-12-01T11:38:06.633" Title="Front-end form submission feedback on buttons" Tags="&lt;form&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12593" PostTypeId="2" ParentId="12585" CreationDate="2015-11-30T17:12:10.887" Score="0" Body="&lt;p&gt;Thanks to Lindsey D, using a Rich Text field results in issues with :first-letter. Use a plaintext field instead. &lt;/p&gt;&#xA;" OwnerUserId="4395" LastActivityDate="2015-11-30T17:12:10.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12594" PostTypeId="2" ParentId="12585" CreationDate="2015-11-30T17:28:35.207" Score="1" Body="&lt;p&gt;Rich Text fields always return the paragraphs wrapped in &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags. So you would have to use an additional &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element and apply the dropcap styles to the first &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag within that &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; using the &lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/CSS/%3Afirst-of-type&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;first-of-type&lt;/code&gt;&lt;/a&gt; pseudo-class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class='dropcap'&amp;gt;&#xA;    {{ entry.body }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.dropcap p:first-of-type:first-letter {&#xA;  float: left;&#xA;  font-size: 4em;&#xA;  line-height: 3em;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-11-30T17:28:35.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12595" PostTypeId="1" AcceptedAnswerId="12597" CreationDate="2015-11-30T19:25:42.483" Score="4" ViewCount="1442" Body="&lt;p&gt;Is it possible to serve a file in a Twig template? I need to get a file (asset) from a global setting, and serve it at a particular URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code is close, but it seems that &lt;code&gt;source()&lt;/code&gt; is the wrong method to get the file contents with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-type: application/pdf&quot; %}&#xA;{% header &quot;Content-Disposition: inline&quot; %}&#xA;&#xA;{% set filePath = [craft.config.environmentVariables.assetPath, filesImages.deliveryCalendar[0].filename]|join('') %}&#xA;&#xA;{{ source( filePath ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable &lt;code&gt;filePath&lt;/code&gt; contains the correct system path to the file (/var/www/site.com/html/assets/file.pdf), but &lt;code&gt;source()&lt;/code&gt; is clearly for templates and not files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the contents of a file be streamed out to the browser?&lt;/p&gt;&#xA;" OwnerUserId="4418" LastActivityDate="2016-07-17T06:07:17.370" Title="Serve PDF file at url with variable" Tags="&lt;templating&gt;&lt;assets&gt;&lt;filesystem&gt;&lt;pdf&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12596" PostTypeId="1" AcceptedAnswerId="12621" CreationDate="2015-11-30T19:55:22.463" Score="1" ViewCount="536" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;preparse field plugin&lt;/a&gt; to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11749/limit-search-results-for-users-by-tag-and-limit-to-5-tags&quot;&gt;limit the amount of tags&lt;/a&gt; a user can add to his account. I've modified the code slightly so the tags are processed as a &lt;code&gt;comma, separated, list&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plan is to integrate &lt;a href=&quot;https://brianreavis.github.io/selectize.js/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Selectize&lt;/a&gt; with the search form, so that users can choose from all available tags. As I can't use &lt;code&gt;relatedTo&lt;/code&gt;, it'll have to involve some manipulation. I understand it isn't considered best practice to do this with Twig, but I'm not versed in PHP to build a plugin (I'm learning Python so Twig will have to do!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below sets a variable to allow access to a merged array, I know &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5217/using-twig-to-merge-an-array-and-remove-duplicates&quot;&gt;there's a similar post&lt;/a&gt; (I'd also like to avoid duplicates, but Selectize will ignore them anyway) but I'm struggling to follow that example and use it for my requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.group('verified') %}&#xA;{% set merged = [] %}&#xA;&#xA;{% for user in users %}&#xA;  {% set tags = user.tagsSpecialismSearchable %}&#xA;  {% set specialisms = tags|split(', ') %}&#xA;&#xA;  {% for specialism in specialisms %}&#xA;    {# Merge the tag arrays #}&#xA;    {% set merged = specialisms|merge(specialisms) %}&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {# Test the output #}&#xA;    {% for specialism in specialisms %}&#xA;      &amp;lt;li&amp;gt;{{specialism}}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Output the merged array #}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for mergedSpecialism in merged %}&#xA;  &amp;lt;li&amp;gt;{{ mergedSpecialism }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I'm setting &lt;code&gt;merged&lt;/code&gt; in the wrong place, as all it outputs is a duplicate of the last &lt;code&gt;specialisms&lt;/code&gt; array. So how would I loop through all users and output the available tags?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm probably missing some conditionals to check if the user has actually set tags, so any advice in layman's terms appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt; Working code (Thanks @kcolls)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.group('verified') %}&#xA;{% set merged = [] %}&#xA;&#xA;{% for user in users %}&#xA;  {% set tags = user.tagsSpecialismSearchable %}&#xA;  {% set specialisms = tags|split(', ') %}&#xA;&#xA;  {% for specialism in specialisms %}&#xA;    {# Check if specialism already merged #}&#xA;    {% if specialism not in merged %}&#xA;      {# Merge each specialism #}&#xA;      {% set merged = merged|merge([specialism]) %}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {# Test the output #}&#xA;    {% for specialism in specialisms %}&#xA;      &amp;lt;li&amp;gt;{{specialism}}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Output the merged array #}&#xA;&#xA;&amp;lt;ul style=&quot;background: blue; color: white;&quot;&amp;gt;&#xA;{% for mergedSpecialism in merged %}&#xA;  &amp;lt;li&amp;gt;{{ mergedSpecialism }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v75pv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v75pv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an added bonus, sort the array alphabetically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for mergedSpecialism in merged|sort %}&#xA;    &amp;lt;li&amp;gt;{{ mergedSpecialism }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-12-03T00:02:34.393" Title="Correct way to merge craft.user field arrays and use outside the loop?" Tags="&lt;field&gt;&lt;tags&gt;&lt;forloop&gt;&lt;array&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12597" PostTypeId="2" ParentId="12595" CreationDate="2015-11-30T20:03:37.993" Score="3" Body="&lt;p&gt;You'd need to make a simple Craft &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that added a Twig &lt;a href=&quot;http://twig.sensiolabs.org/documentation&quot; rel=&quot;nofollow&quot;&gt;filter/function&lt;/a&gt; that wrapped PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.file-get-contents.php&quot; rel=&quot;nofollow&quot;&gt;file_get_contents&lt;/a&gt; to grab the file contents, but at that point, you might as well just make it a wrapper for &lt;a href=&quot;http://buildwithcraft.com/classreference/services/HttpRequestService#sendFile-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;request-&gt;sendFile()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-11-30T20:03:37.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12598" PostTypeId="1" AcceptedAnswerId="12599" CreationDate="2015-11-30T20:59:00.953" Score="4" ViewCount="555" Body="&lt;p&gt;I have a site with channels &lt;em&gt;‘articles’&lt;/em&gt; and &lt;em&gt;‘tutorials.’&lt;/em&gt; An article entry has a matrix field which contains an entry field to link to a tutorial. Every tutorial is linked from within at least one article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like each tutorial page to link back to the articles it appears in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm on a tutorial page and have the following code in my template…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articles = craft.entries.section('articles').relatedTo(entry) %}&#xA;{{ articles|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;articles|length is always zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a test with just a simple entry field to link to a tutorial and that works fine. Is there something special that needs to be done to get it to work with a matrix field? Could it be a configuration issue?&lt;/p&gt;&#xA;" OwnerUserId="4331" LastActivityDate="2015-11-30T21:10:06.023" Title="Reverse Related entries with Matrix Field" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12599" PostTypeId="2" ParentId="12598" CreationDate="2015-11-30T21:10:06.023" Score="6" Body="&lt;p&gt;Have a look at the 'Going Through Matrix' section at &lt;a href=&quot;http://buildwithcraft.com/docs/relations#the-relatedTo-param&quot; rel=&quot;noreferrer&quot;&gt;http://buildwithcraft.com/docs/relations#the-relatedTo-param&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articles = craft.entries.section('articles').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'myMatrixField.fieldHandle'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-11-30T21:10:06.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12601" PostTypeId="2" ParentId="10550" CreationDate="2015-12-01T02:52:00.557" Score="0" Body="&lt;p&gt;They &lt;a href=&quot;http://pixelandtonic.com/blog/craft-2.5-beta?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+blogandtonic+%28Blog+and+Tonic%29&quot; rel=&quot;nofollow&quot;&gt;will add&lt;/a&gt; this functionality in Craft CMS 2.5. Problem solved.&lt;/p&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2015-12-01T02:52:00.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12602" PostTypeId="1" CreationDate="2015-12-01T05:55:15.303" Score="3" ViewCount="1033" Body="&lt;p&gt;What is the best course of action to allow the creation/deletion of matrix fields in front-end. For context this in a Commerce Order Field. JS is mess right now, any underlying Craft JS libraries I can tap into?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the whole mess below, having issues with users getting stuck here if they accidentally leave of the matrix fields empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # 2016 Apply-3&#xA; # ---------------&#xA; #}&#xA;&#xA;{% extends '_layouts/_event-checkout' %}&#xA;&#xA;{% block content_inside %}&#xA;&amp;lt;section&amp;gt;&#xA;    &amp;lt;div class=&quot;col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;feature boxed bg-secondary&quot;&amp;gt;&#xA;        &amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;apply/review&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;paymentMethodId&quot; value=&quot;2&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[applicationProgress]&quot; value=&quot;2&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[applicationSchemaVersion]&quot; value=&quot;{{ switchboard.applicationSchemaVersion }}&quot;&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;text-center&quot;&amp;gt;&#xA;            &amp;lt;h4 class=&quot;uppercase mt48 mt-xs-0&quot;&amp;gt;Great, Now we know you {{ application.shippingAddress.firstName }}!&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;p class=&quot;lead mb64 mb-xs-24&quot;&amp;gt;&#xA;                Now let's see what you know!&#xA;            &amp;lt;/p&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      {{ getCsrfInput() }}&#xA;&#xA;            &amp;lt;hr class=&quot;mt16&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;row mt64&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;col-sm-12 input-with-label&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;Tell me something that's true, that almost nobody agrees with you on.&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;textarea name=&quot;fields[thielQuestion]&quot;&#xA;                        placeholder=&quot;Some may recognize this famous question, we want some original answers though, really think about this one.&quot;&amp;gt;{{ application.thielQuestion }}&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;col-sm-12 mt48 input-with-label&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;What are YOU passionate about?&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;textarea name=&quot;fields[whatAreYouPassionateAbout]&quot;&#xA;                        placeholder=&quot;What are YOU passionate about?&quot;&amp;gt;{{ application.whatAreYouPassionateAbout }}&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;col-sm-12 mt48 input-with-label&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;What songs are included on the soundtrack to your life?&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;textarea name=&quot;fields[lifeSoundtrack]&quot;&#xA;                        placeholder=&quot;One of the most important question on this application.&quot;&amp;gt;{{ application.lifeSoundtrack }}&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;hr class=&quot;mt16&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row mt16&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;skills col-sm-12 col-md-7 col-lg-9&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;skills__list twelve columns&quot;&amp;gt;&#xA;            &amp;lt;h3 class=&quot;skills__list-title&quot;&amp;gt;Add some skills by clicking the options on the right!&amp;lt;/h3&amp;gt;&#xA;                        {% for bloc in application.skills %}&#xA;            &amp;lt;div class=&quot;skills input-with-label text-left&quot;&amp;gt;&#xA;              {% if bloc.type == &quot;programmingLanguage&quot; %}&#xA;                &amp;lt;p&amp;gt;+ Programming Language&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[skills][new{{ loop.index }}][type]&quot; value=&quot;{{ bloc.type }}&quot;&amp;gt;&#xA;                                &amp;lt;span&amp;gt;Language Name:&amp;lt;/span&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;fields[skills][new{{ loop.index }}][fields][languageName]&quot; value=&quot;{{ bloc.languageName }}&quot; placeholder=&quot;Language Name&quot;&amp;gt;&#xA;                                &amp;lt;span&amp;gt;Years Of Proficiency:&amp;lt;/span&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;fields[skills][new{{ loop.index }}][fields][yearsOfProficiency]&quot; value=&quot;{{ bloc.yearsOfProficiency }}&quot; placeholder=&quot;Years Of Proficiency&quot;&amp;gt;&#xA;              {% elseif bloc.type == &quot;programmingFramework&quot;%}&#xA;                &amp;lt;p&amp;gt;+ Programming Framework&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;input type='hidden' name='fields[skills][new{{ loop.index }}][type]' value=&quot;{{ bloc.type }}&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Framework Name:&amp;lt;/span&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;fields[skills][new{{ loop.index }}][fields][frameworkName]&quot; value=&quot;{{ bloc.frameworkName }}&quot; placeholder=&quot;Framework Name&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Coolest Thing You Have Built:&amp;lt;/span&amp;gt;&#xA;                &amp;lt;textarea name=&quot;fields[skills][new{{ loop.index }}][fields][coolestThing]&quot; placeholder=&quot;What is the coolest thing you have built with it?&quot;&amp;gt;{{ bloc.coolestThing }}&amp;lt;/textarea&amp;gt;&#xA;                            {% elseif bloc.type == &quot;knowledge&quot;%}&#xA;                &amp;lt;p&amp;gt;+ Knowledge&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;input type='hidden' name='fields[skills][new{{ loop.index }}][type]' value=&quot;{{ bloc.type }}&quot;&amp;gt;&#xA;                                &amp;lt;span&amp;gt;Programmers alone can&amp;amp;apos;t solve these great challenges we need people like you with that special know-how, maybe it&amp;amp;apos;s in environmental sciences, maybe it&amp;amp;apos;s in Politics? Whatever you know something extra about:&amp;lt;/span&amp;gt;&#xA;                &amp;lt;textarea name=&quot;fields[skills][new{{ loop.index }}][fields][knowledge]&quot; placeholder=&quot;Programmers alone can&amp;amp;apos;t solve these great challenges we need people like you with that special know-how, maybe it&amp;amp;apos;s in environmental sciences, maybe it&amp;amp;apos;s in Politics? Whatever you know something extra about!&quot;&amp;gt;{{ bloc.knowledge }}&amp;lt;/textarea&amp;gt;&#xA;                            {% elseif bloc.type == &quot;expirience&quot;%}&#xA;                &amp;lt;p&amp;gt;+ Expirience&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;input type='hidden' name='fields[skills][new{{ loop.index }}][type]' value=&quot;{{ bloc.type }}&quot;&amp;gt;&#xA;                                &amp;lt;span&amp;gt;Worked at one of those cool tech companies, or maybe been involved in hackathons in past?&amp;lt;/span&amp;gt;&#xA;                &amp;lt;textarea name=&quot;fields[skills][new{{ loop.index }}][fields][expirience]&quot; placeholder=&quot;Worked at one of those cool tech companies, or maybe been involved in hackathons in past?&quot;&amp;gt;{{ bloc.knowledge }}&amp;lt;/textarea&amp;gt;&#xA;&#xA;                            {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;hr&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-sm-12 col-md-5 col-lg-3&quot;&amp;gt;&#xA;&#xA;          &amp;lt;div class=&quot;skills-buttons&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;btn btn-sm skills__button&quot; data-type=&quot;programmingLanguage&quot;&amp;gt;+ Programming Language&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;btn btn-sm skills__button&quot; data-type=&quot;programmingFramework&quot;&amp;gt;+ Programming Framework&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;btn btn-sm skills__button&quot; data-type=&quot;knowledge&quot;&amp;gt;+ Knowledge&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;btn btn-sm skills__button&quot; data-type=&quot;experience&quot;&amp;gt;+ Experience&amp;lt;/a&amp;gt;&#xA;            &amp;lt;!-- &amp;lt;a href=&quot;#&quot; class=&quot;btn skills__button&quot; data-type=&quot;proveYourAwesomness&quot;&amp;gt;+ Prove Your Awesomness&amp;lt;/a&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; class=&quot;btn skills__button&quot; data-type=&quot;showYourThinkingProwess&quot;&amp;gt;+ Show Your Thinking Prowess&amp;lt;/a&amp;gt; --&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;submit&quot; class=&quot;button button-primary&quot; value=&quot;Continue&quot;&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% includejs %}&#xA;var $skills = $('.skills__button');&#xA;&#xA;{% if cart.skills %}&#xA;    var $iter = {{ cart.skills|length }};&#xA;{% else %}&#xA;    var $iter = 0;&#xA;{% endif %}&#xA;&#xA;$skills.on('click', function() {&#xA;  var $type = $(this).attr(&quot;data-type&quot;);&#xA;  var $humanType = $(this).text();&#xA;  $iter++;&#xA;&#xA;  console.log('Adding Block');&#xA;  if($type == &quot;programmingLanguage&quot;) {&#xA;    $('.skills__list').append(&quot;\&#xA;    &amp;lt;div class='skills'&amp;gt; \&#xA;      &amp;lt;p&amp;gt;&quot;+$humanType+&quot;&amp;lt;/p&amp;gt; \&#xA;      &amp;lt;input type='hidden' name='fields[skills][new&quot;+$iter+&quot;][type]' value='&quot;+$type+&quot;'&amp;gt; \&#xA;      &amp;lt;input type='text' name='fields[skills][new&quot;+$iter+&quot;][fields][languageName]' placeholder='Language Name'&amp;gt; \&#xA;      &amp;lt;input type='text' name='fields[skills][new&quot;+$iter+&quot;][fields][yearsOfProficiency]' placeholder='Years Of Proficiency'&amp;gt; \&#xA;    &amp;lt;/div&amp;gt;&quot;);&#xA;  }else if($type == &quot;programmingFramework&quot;) {&#xA;    $('.skills__list').append(&quot;\&#xA;    &amp;lt;div class='skills'&amp;gt; \&#xA;      &amp;lt;p&amp;gt;&quot;+$humanType+&quot;&amp;lt;/p&amp;gt; \&#xA;      &amp;lt;input type='hidden' name='fields[skills][new&quot;+$iter+&quot;][type]' value='&quot;+$type+&quot;'&amp;gt; \&#xA;      &amp;lt;input type='text' name='fields[skills][new&quot;+$iter+&quot;][fields][frameworkName]' placeholder='Framework Name'&amp;gt; \&#xA;      &amp;lt;textarea name='fields[skills][new&quot;+$iter+&quot;][fields][coolestThing]' placeholder='What is the coolest thing you have built with it?'&amp;gt;&amp;lt;/textarea&amp;gt; \&#xA;    &amp;lt;/div&amp;gt;&quot;);&#xA;  }else if($type == &quot;knowledge&quot;) {&#xA;    $('.skills__list').append(&quot;\&#xA;    &amp;lt;div class='skills'&amp;gt; \&#xA;      &amp;lt;p&amp;gt;&quot;+$humanType+&quot;&amp;lt;/p&amp;gt; \&#xA;      &amp;lt;input type='hidden' name='fields[skills][new&quot;+$iter+&quot;][type]' value='&quot;+$type+&quot;'&amp;gt; \&#xA;      &amp;lt;textarea name='fields[skills][new&quot;+$iter+&quot;][fields][knowledge]' placeholder='Programmers alone can&amp;amp;apos;t solve these great challenges we need people like you with that special know-how, maybe it&amp;amp;apos;s in environmental sciences, maybe it&amp;amp;apos;s in Politics? Whatever you know something extra about!'&amp;gt;&amp;lt;/textarea&amp;gt; \&#xA;    &amp;lt;/div&amp;gt;&quot;);&#xA;  }else if($type == &quot;expirience&quot;) {&#xA;    $('.skills__list').append(&quot;\&#xA;    &amp;lt;div class='skills'&amp;gt; \&#xA;      &amp;lt;p&amp;gt;&quot;+$humanType+&quot;&amp;lt;/p&amp;gt; \&#xA;      &amp;lt;input type='hidden' name='fields[skills][new&quot;+$iter+&quot;][type]' value='&quot;+$type+&quot;'&amp;gt; \&#xA;      &amp;lt;textarea name='fields[skills][new&quot;+$iter+&quot;][fields][expirience]' placeholder='Worked at one of those cool tech companies, or maybe been involved in hackathons in past?'&amp;gt;&amp;lt;/textarea&amp;gt; \&#xA;    &amp;lt;/div&amp;gt;&quot;);&#xA;  }&#xA;});&#xA;&#xA;{% endincludejs %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="96" LastActivityDate="2017-01-25T23:21:10.407" Title="Managing Frontend JS for Matrix Fields" Tags="&lt;matrix&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12604" PostTypeId="1" AcceptedAnswerId="12619" CreationDate="2015-12-01T09:35:06.213" Score="0" ViewCount="183" Body="&lt;p&gt;I am using the &quot;Select Entry&quot; field (&lt;code&gt;_includes/forms/elementSelect.html&lt;/code&gt;) field in a custom plugin to select one of my custom element types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my ElementType, I defined &lt;code&gt;defineTableAttributes()&lt;/code&gt; and &lt;code&gt;getTableAttributeHtml()&lt;/code&gt; to customize the table cells on a index view of the Element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I am using this Element in a modal view, it displays the same cells as on the index view, but I would like to hide certain fields (like buttons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to customize the returned fields, without building the whole modal myself, like mentioned &lt;a href=&quot;https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin&quot;&gt;here&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw, that a attribute &lt;code&gt;context&lt;/code&gt; gets passed, which is either &lt;code&gt;modal&lt;/code&gt; or &lt;code&gt;index&lt;/code&gt;, but I don't know how I could access it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-12-01T23:51:30.100" Title="Customize elementSelect Field's Modal Table Layout" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12605" PostTypeId="2" ParentId="12592" CreationDate="2015-12-01T11:38:06.633" Score="3" Body="&lt;p&gt;I'd say your best bet would be to use something like jQuery to make an AJAX call and then manipulate the DOM depending on what response you get. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#loginForm').submit( function (e) {&#xA;&#xA;  // Stop the form actually doing anything or refreshing the page&#xA;  e.preventDefault();&#xA;&#xA;  // Get the inputs from the form&#xA;  var data = $(this).serialize(),&#xA;      button = $(this).find('button');&#xA;&#xA;  // Find our button and change its text or something...&#xA;  button.text('Logging you in');&#xA;&#xA;  $.ajax({&#xA;    method: 'POST',&#xA;    url: '/',&#xA;    data: data,&#xA;    headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;  })&#xA;  .success(function(data) {&#xA;&#xA;    // They are now logged in, reflect that in your button&#xA;    button.text('Logged in!');&#xA;&#xA;    // Maybe redirect them aswell?&#xA;    window.location.href = &quot;/some/members/area&quot;;&#xA;&#xA;  })&#xA;  .error(function(data) {&#xA;&#xA;    // Something went wrong, we can now show that&#xA;    button.text('Something went wrong');&#xA;&#xA;&#xA;  });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thats a adapted version of code I found from this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3081/front-end-login-form-with-ajax&quot;&gt;Front end login form with ajax&lt;/a&gt; so I haven't actually tested it, but it sounds like it should work and then changing the button is just straight forward jquery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you get errors with CSRF protection, then you should find a solution here: &lt;a href=&quot;http://buildwithcraft.com/help/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://buildwithcraft.com/help/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps get you started!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-12-01T11:38:06.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12606" PostTypeId="1" AcceptedAnswerId="12607" CreationDate="2015-12-01T12:17:01.613" Score="2" ViewCount="765" Body="&lt;p&gt;I'm looking to create an image transformation where either the height is (e.g.) 180px, or the width is 180px depending on whether the image is portrait or landscape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the image is landscape the dimensions should be (WxH): 180 x AUTO&#xA;If the Image is portrait, the dimensions should be (WxH): AUTO x 180&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm missing something obvious. Or maybe this could be a CSS issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3438" LastActivityDate="2015-12-01T13:39:51.777" Title="Image transform with either width or height" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12607" PostTypeId="2" ParentId="12606" CreationDate="2015-12-01T13:39:51.777" Score="5" Body="&lt;p&gt;A similar question has already been asked here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1648/is-there-a-way-to-find-out-if-images-assets-are-landscape-or-portrait&quot;&gt;Is there a way to find out if images (assets) are landscape or portrait?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to create the two asset transforms you mentioned in your question, and then in your template code use an &lt;code&gt;if/else&lt;/code&gt; statement to determine which transform to use, depending on if the asset is portrait or landscape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to Josh for the code, this is taken from his answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myImage = entry.imagesField.first %}&#xA;&#xA;{% if myImage.getWidth() &amp;lt; myImage.getHeight() %}&#xA;  {# portrait #}&#xA;{% elseif myImage.getWidth() &amp;gt; myImage.getHeight() %}&#xA;  {# landscape #}&#xA;{% else %}&#xA;  {# square #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-12-01T13:39:51.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12608" PostTypeId="1" AcceptedAnswerId="12617" CreationDate="2015-12-01T13:47:12.193" Score="0" ViewCount="121" Body="&lt;p&gt;I need to have B2B and B2C split.&#xA;I was thinking to use the same templates and work with conditionals in the templates. it's only for 20% of the content that is different, but still all urls should have a b2c/b2b segment to keep him within the right section&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so i need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;weburl.com/nl/b2b/product/slug&lt;/li&gt;&#xA;&lt;li&gt;weburl.com/nl/b2c/product/slug &lt;/li&gt;&#xA;&lt;li&gt;weburl.com/nl/b2b/news/slug&lt;/li&gt;&#xA;&lt;li&gt;weburl.com/nl/b2c/news/slug&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any idea how i can do that? I'm open for alternatives as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't figure it out immediately with routes:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/i7HLr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i7HLr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2015-12-01T19:46:19.883" LastActivityDate="2015-12-01T23:33:26.890" Title="B2B and B2C split" Tags="&lt;routing&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12609" PostTypeId="2" ParentId="12608" CreationDate="2015-12-01T14:00:31.030" Score="2" Body="&lt;p&gt;My thoughts would be to use a Category and have that in the URL pattern of the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{business_category|first.slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then each entry would have the &lt;code&gt;business_category&lt;/code&gt; field set to either B2C or B2B.&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2015-12-01T14:00:31.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12610" PostTypeId="1" CreationDate="2015-12-01T14:51:44.103" Score="2" ViewCount="160" Body="&lt;p&gt;If I define searchable fields via &lt;code&gt;IElementType::defineSearchableAttributes()&lt;/code&gt;, the provided fields have to be model attributes. Can they also be getter-methods on the model class, which may return values from other related elements? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. on &lt;strong&gt;Plugin_XYElementType.php&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSearchableAttributes()&#xA;{&#xA;    return ['relatedTitle','otherField'],&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in &lt;strong&gt;Plugin_XYModel.php&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getRelatedTitle()&#xA;{&#xA;    return craft()-&amp;gt;plugin_service-&amp;gt;getTitleFromRelatedThing($this-&amp;gt;relatedThingId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will this fields be correctly indexed and searchable in a ElementIndexView, where I use this related fields in a table column? Or does this only work for Attributes, that were defined via &lt;code&gt;defineAttributes()&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4226" LastActivityDate="2016-05-04T09:14:57.150" Title="Does defineSearchableAttributes() work with getter methods on the model?" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementtype&gt;&lt;baseelementmodel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12611" PostTypeId="2" ParentId="12602" CreationDate="2015-12-01T14:57:10.553" Score="6" Body="&lt;p&gt;I'll be flat-out honest; I didn't read through your code. Secondly, I think to set expectations when you say a matrix field on the front-end you'll need to understand it isn't going to look like what you think it looks like within the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, on a site I am working on, I have a page where a user can update their profile on the front-end. There is a section they can add multiple contact info - which links to a matrix filed in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contactInfo]&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;contactInfo&quot;&amp;gt;Contact Info&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;{% for block in currentUser.contactInfo.type('contact') %}&#xA;    &amp;lt;div class=&quot;matrixblock&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contactInfo][{{ block.id }}][type]&quot; value=&quot;contact&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contactInfo][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[contactInfo][{{ block.id }}][fields][firstName]&quot; value=&quot;{{ block.firstName }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[contactInfo][{{ block.id }}][fields][lastName]&quot; value=&quot;{{ block.lastName }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;tel&quot; name=&quot;fields[contactInfo][{{ block.id }}][fields][phoneNumber]&quot; value=&quot;{{ block.phoneNumber }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;email&quot; name=&quot;fields[contactInfo][{{ block.id }}][fields][email]&quot; value=&quot;{{ block.email }}&quot;&amp;gt;&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;javascript:void(0);&quot; class=&quot;remove-contact&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;button type=&quot;button&quot; id=&quot;addPerson&quot;&amp;gt;Add Person&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above is what defines what I'll call a row in your matrix field. It will pull in and render any existing matrix blocks that have been created. You'll need to update the &lt;code&gt;type&lt;/code&gt; to whatever you have called it in your project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add a new &quot;row&quot; I used &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6551/how-to-update-matrix-field-on-frontend-for-user-profile&quot;&gt;this thread&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1318/how-to-get-matrix-editor-into-frontend&quot;&gt;this thread&lt;/a&gt; to get me in the right direction. I highly recommend reading them. I think I read them both 20+ times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I know my code falls short is in the javascript. I am currently hard-coding the html. Ideally I'd like to have it clone the existing markup so I don't have to update it multiple places in the event it changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Event listener to add additional primary guardian(s).&#xA; *&#xA; * @param {object} event | The click event.&#xA; *&#xA; */&#xA;var blocknum = 1;&#xA;&#xA;$('#addPerson').click(function (event) {&#xA;    var markup = '&amp;lt;div class=&quot;matrixblock&quot;&amp;gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contactInfo][new' + blocknum + '][type]&quot; value=&quot;contact&quot;&amp;gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contactInfo][new' + blocknum + '][enabled]&quot; value=&quot;1&quot;&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contactInfo][new' + blocknum + '][fields][firstName]&quot; value=&quot;&quot;&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[contactInfo][new' + blocknum + '][fields][lastName]&quot; value=&quot;&quot;&amp;gt;&amp;lt;input type=&quot;tel&quot; name=&quot;fields[contactInfo][new' + blocknum + '][fields][phoneNumber]&quot; value=&quot;&quot;&amp;gt;&amp;lt;input type=&quot;email&quot; name=&quot;fields[contactInfo][new' + blocknum + '][fields][email]&quot; value=&quot;&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;a href=&quot;javascript:void(0);&quot; class=&quot;remove-contact&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;';&#xA;    $('div.matrixblock:last').after(markup);&#xA;    blocknum++;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you will notice, you will also need a way to delete the given row. This is my example, you will need to update the logic to match your current html structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Event listener to removing additional primary guardian(s).&#xA; *&#xA; * @param {object} event | The click event.&#xA; *&#xA; */&#xA;$('body').on('click', '.remove-contact', function (event) {&#xA;    $(this).parent().parent().fadeOut('fast').remove();&#xA;    event.preventDefault();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Because we are dynamically creating rows, we need to register/bind the click event in this manor so that all &lt;em&gt;future&lt;/em&gt; clicks will be attached to this event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not styled my form at all, but in the end, this is what the above markup renders:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SqsgB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SqsgB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(first name, last name, email, phone)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-01-25T23:21:10.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12612" PostTypeId="1" CreationDate="2015-12-01T15:11:10.907" Score="5" ViewCount="1069" Body="&lt;p&gt;I'm currently building a site for a client who's products vary in price depending on the width / height selected. Essentially what this means is each product has around 70 possible variations, each with it's own price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial idea was to inject some JS that would allow the client to manage the variants in a table that would automatically generate / update the variants based on the contents of the table. Unfortunately, as far as I can tell, there is no way to access the JS that manages the variants as it's all done in a self contained, anonymous class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried creating a custom &lt;code&gt;Purchasable&lt;/code&gt; entry type that would let me dynamically set the price of the of the line item based off the selected width &amp;amp; height. The keyword there being &lt;em&gt;tried&lt;/em&gt;. I'm still trying to get to grips with custom Entry Types, and trying to get it to work with Commerce on top of trying to get it to work at all has made me, well, somewhat less than successful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone had any success with managing large numbers of variants, or does anyone know of a simpler way to achieve what I'm after?&lt;/p&gt;&#xA;" OwnerUserId="3899" LastEditorUserId="9" LastEditDate="2015-12-02T06:36:56.243" LastActivityDate="2016-11-23T23:12:54.130" Title="Managing a large number of Variants in Craft Commerce" Tags="&lt;entry-type&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12613" PostTypeId="1" CreationDate="2015-12-01T16:45:03.163" Score="3" ViewCount="196" Body="&lt;p&gt;I have successfully got Smart Map up &amp;amp; running and now want to tailor it for my own purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will have hundreds of markers for businesses, which I am categorising via fields in Craft. What I would love to do is pass custom options to the markers on an individual basis. E.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marker 1 - Business-type: Retail; Market-sector: Domestic, Educational; Products: Chair, Table, Upholstery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marker 2 - Business-type: Manufacturer; Market-sector: Office, Children; Products: Soft seating, Divider panels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see there are 3 keys with multiple values in each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can pass custom options into the map &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions&quot; rel=&quot;nofollow&quot;&gt;using the API&lt;/a&gt;, but can it be done manually in conjunction with the plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to pass information per-marker for the info Bubble, but I don't see anything in the documentation about custom option data.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-22T17:53:48.183" Title="Smart Map - pass options into markers individually" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12614" PostTypeId="1" CreationDate="2015-12-01T16:56:59.767" Score="1" ViewCount="101" Body="&lt;p&gt;Having some odd issues in 2.5 with image transforms (apparently). They are defined in the template, and saved to a Rackspace Cloud Files container. Often, we are getting a 500 Internal Server Error when loading the page or doing a live preview, and nothing about the error is logged anywhere. Trying to figure out how to troubleshoot this. Happens on our production (apache) server, not seeing it on my dev/MAMP machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do have this set in general config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The server is running Ubuntu 14.04 and has ImageMagick 6.7.7-10 2014-03-06 Q16 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dev machine (which will transform the images just fine) is running MAMP and does NOT have ImageMagick installed (it does use GD though).&lt;/p&gt;&#xA;" OwnerUserId="2243" LastEditorUserId="2243" LastEditDate="2015-12-03T15:08:21.387" LastActivityDate="2015-12-03T15:08:21.387" Title="How to troubleshoot Inline Image Transform when there is no error logged?" Tags="&lt;image-transforms&gt;&lt;logs&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="12615" PostTypeId="1" AcceptedAnswerId="12642" CreationDate="2015-12-01T20:07:20.810" Score="0" ViewCount="328" Body="&lt;p&gt;Why do i get an error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;throw new Exception(Craft::t('Image “{file}” cannot be found.', array('file' =&gt; $file-&gt;filename)));&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myImage = entry.pr_foto.first %}&#xA;{% set params = { width: 300, height: 200 } %}&#xA;&amp;lt;img  src=&quot;{{ myImage.getUrl(params) }}&quot; height=&quot;{{ myImage.getHeight(params) }}&quot; width=&quot;{{ myImage.getWidth(params) }}&quot; alt=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myImage = entry.pr_foto.first %}&#xA;&amp;lt;img src=&quot;{{ myImage.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;shows the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filesystem path for photos is uploads/photos/. The upload works fine in the admin. It's only the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full trace error:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bIDzR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bIDzR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2015-12-02T10:30:17.177" LastActivityDate="2016-01-01T20:52:21.447" Title="Transform: Image {file} cannot be found with" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12616" PostTypeId="1" CreationDate="2015-12-01T21:33:12.923" Score="1" ViewCount="201" Body="&lt;p&gt;We are looking to import a third-party calendar feed into a Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any plugins or techniques for showing an ICS/iCAL calendar feed within a Craft template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've come across this plugin for converting into JSON but not sure how best to bring this into a plugin &lt;a href=&quot;https://github.com/controlz/CalFileParser&quot; rel=&quot;nofollow&quot;&gt;https://github.com/controlz/CalFileParser&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a good excuse to teach myself plugin development …&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-01T23:28:28.333" Title="Showing ICS feeds" Tags="&lt;plugins&gt;&lt;import&gt;&lt;feed&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12617" PostTypeId="2" ParentId="12608" CreationDate="2015-12-01T22:14:23.107" Score="1" Body="&lt;p&gt;Answering this requires clearing up a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, all a route does is to tell Craft to load a certain template whenever the current URL matches a certain pattern. On its own, that template will be pretty dumb, and won't know anything about the content that you want to display – unless Craft can match the URL to an entry, in which case the &lt;code&gt;entry&lt;/code&gt; variable will be made available to Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, this means that whenever an URL matching the &lt;code&gt;b2b/products/{slug}&lt;/code&gt; pattern is requested, Craft will fire up the &lt;code&gt;products/_entry&lt;/code&gt; template. However, since there aren't actually any entries matching that URL pattern (the actual entry URLs will look like &lt;code&gt;products/{slug}&lt;/code&gt;, without the &lt;code&gt;b2b&lt;/code&gt; segment) there won't be an &lt;code&gt;entry&lt;/code&gt; variable available in your template. Hence the error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For more information about routing and how Craft parses URL requests and makes data available to templates, I recommend reading the &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;official docs on the subject&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To attempt an answer: From your question, its not clear to me if you want &lt;code&gt;/b2b/products/{slug}&lt;/code&gt; and &lt;code&gt;/b2c/products/{slug}&lt;/code&gt; be the &lt;em&gt;canonical&lt;/em&gt; URL formats for your entries, or if you just need the option to browse entries using those routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to keep &lt;code&gt;products/{slug}&lt;/code&gt; as the canonical URL format, but just need to browse to an entry via the &lt;code&gt;b2b/products/{slug}&lt;/code&gt; route, you basically just need to define the &lt;code&gt;entry&lt;/code&gt; variable &quot;manually&quot; inside the &lt;code&gt;products/_entry&lt;/code&gt; template – i.e. tell Craft which entry you want to display. Put this at the top of your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry is not defined ? craft.entries.section('products').slug(craft.request.lastSegment).first : entry %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code will pull an entry from the Products section, with a slug matching the last segment of the current URL/request, &lt;em&gt;if&lt;/em&gt; an &lt;code&gt;entry&lt;/code&gt; variable isn't already defined. This means that the template will work for both routed and canonical URLs, and without an extra database hit for the latter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably a good idea to also add a conditional testing if the &lt;code&gt;entry&lt;/code&gt; variable is actually a valid entry, and redirect to the 404 page if not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry|length %}&#xA;  {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that with this setup, all entries – no matter if they belong to either B2B or B2C – from the Product section will be available for both the &lt;code&gt;b2b/products/{slug}&lt;/code&gt; route &lt;strong&gt;and&lt;/strong&gt; the &lt;code&gt;b2c/products/{slug}&lt;/code&gt;. If that's an issue, you can – of course – add some sort of conditional to the template to verify if the current entry corresponds to the URL segment (this would follow the above example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set businessCategorySegment = craft.request.getSegment(1) %}&#xA;{% switch businessCategorySegment %}&#xA;   {% case 'b2b' %}&#xA;       {# Test if entry belongs to B2B, if not - exit 404 #}&#xA;   {% case 'b2c' %}&#xA;       {# Test if entry belongs to B2C, if not - exit 404 #}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need &lt;code&gt;b2b/products/{slug}&lt;/code&gt; to be the actual, canonical URL for an entry, I'd recommend to &lt;strong&gt;not use routes&lt;/strong&gt; – build the &lt;code&gt;b2b&lt;/code&gt;/&lt;code&gt;b2c&lt;/code&gt; segment into the Products section's URL format instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To accomplish this, you'll need to make use of Crafts ability to render entry variables (i.e. custom fields or meta data) as part of the URL format. This means that you'll have to have a custom field designating an entry as either B2B or B2C when it is saved. As per Mike Pierce's earlier answer, a Category Field will work well: First you create a category group called Business Group, then add two categories – B2B and B2C (with handles &lt;code&gt;b2b&lt;/code&gt; and &lt;code&gt;b2c&lt;/code&gt;, respectively), and finally a Category Field with the handle &lt;code&gt;businessCategory&lt;/code&gt;. Limit the field to 1 category, and mark it as required when you add it to the Products section's field layout. Finally, you put the following as your section's URL format: &lt;code&gt;{businessCategory|first.slug}/products/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2015-12-01T23:33:26.890" LastActivityDate="2015-12-01T23:33:26.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12618" PostTypeId="2" ParentId="12616" CreationDate="2015-12-01T23:28:28.333" Score="1" Body="&lt;p&gt;If you can get the original calendar data into a JSON or RSS format, then check out the wonderful &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;Feed Me&lt;/a&gt; plugin. It seamlessly handles JSON, RSS, XML, and ATOM formats.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-01T23:28:28.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12619" PostTypeId="2" ParentId="12604" CreationDate="2015-12-01T23:51:30.100" Score="1" Body="&lt;p&gt;You should be able to accomplish what you want with a combination of the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;getTableAttributeHtml()&lt;/a&gt; hook and the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#modifyEntryTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;modifyEntryTableAttributes()&lt;/a&gt; hook. You may be able to use the parameter &lt;code&gt;$source&lt;/code&gt; from &lt;code&gt;modifyEntryTableAttributes()&lt;/code&gt; to filter out index vs modal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9816/adding-additional-attributes-to-modifyentrytableattributes&quot;&gt;Check out this post&lt;/a&gt; for a more detailed description. &lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-12-01T23:51:30.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12620" PostTypeId="2" ParentId="1773" CreationDate="2015-12-02T00:05:01.273" Score="7" Body="&lt;p&gt;You can set a custom &quot;environment label&quot; variable inside config/general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ALL ENVIRONMENTS&#xA;    '*' =&amp;gt; array(&#xA;    ),&#xA;    // LOCAL&#xA;    'mysite.local' =&amp;gt; array(&#xA;        'env' =&amp;gt; 'local'&#xA;    ),&#xA;    // DEV&#xA;    'dev.mysite.com' =&amp;gt; array(&#xA;        'env' =&amp;gt; 'dev'&#xA;    ),&#xA;    // PROD&#xA;    'www.mysite.com' =&amp;gt; array(&#xA;        'env' =&amp;gt; 'prod'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use the &lt;code&gt;craft.config&lt;/code&gt; variable to output the &lt;code&gt;env&lt;/code&gt; variable for the current environment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.env == 'dev' %}&#xA;    hello dev&#xA;{% else %}&#xA;    hello world&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastActivityDate="2015-12-02T00:05:01.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12621" PostTypeId="2" ParentId="12596" CreationDate="2015-12-02T00:12:39.307" Score="3" Body="&lt;p&gt;It looks like you have a typo in your merge, and the structure of the merge is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set merged = specialisms|merge(specialisms) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is saying set merged to the array specialisms merged with itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am guessing you want to do is merge each specialism into the merged array, which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set merged = merged|merge(specialism) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that we are merging &lt;code&gt;specialism&lt;/code&gt; and not &lt;code&gt;specialisms&lt;/code&gt; (no s at the end). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what data type specialism is, but if it isn't an array, you may need to wrap it in square brackets. This would become:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set merged = merged|merge([specialism]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="4216" LastActivityDate="2015-12-02T00:12:39.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12622" PostTypeId="1" AcceptedAnswerId="12623" CreationDate="2015-12-02T01:32:56.420" Score="0" ViewCount="246" Body="&lt;p&gt;Is it possible to &lt;strong&gt;auto-update to a specific version&lt;/strong&gt; of Craft CMS – in particular, to 2.4.2726, the last version prior to 2.5?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to update some sites that haven't got the latest builds, but I'd prefer to wait for the confirmations of plugin developers regarding compatibility with the changes in 2.5. Can I easily move up to the latest 2.4.x release?&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2015-12-02T02:32:11.787" Title="Can I auto-update to a specific version of Craft?" Tags="&lt;updating&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12623" PostTypeId="2" ParentId="12622" CreationDate="2015-12-02T02:32:11.787" Score="0" Body="&lt;p&gt;It's not possible to &lt;em&gt;auto&lt;/em&gt;-update to a specific version of Craft, but it is possible to &lt;em&gt;manually&lt;/em&gt; update to one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd just need to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/223/where-can-i-download-previous-versions-of-craft&quot;&gt;download&lt;/a&gt; the version you want to update to, then perform a &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow&quot;&gt;manual&lt;/a&gt; update.  &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-02T02:32:11.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12625" PostTypeId="2" ParentId="12552" CreationDate="2015-12-02T04:12:44.230" Score="1" Body="&lt;p&gt;After some further research this &lt;a href=&quot;http://craftcookbook.net/recipes/279&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/279&lt;/a&gt; was a better fit for my needs.  The code I ended up using based on the link is below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set beer = [] %}&#xA;{% set beerBrands = craft.categories.group('brandCategory').level(1).find() %}&#xA;    {% for category in beerBrands %}&#xA;         {% set beerRelatedCategories = craft.entries.section('beers').relatedTo(category).find() %}&#xA;         {% set beer = beer|merge(beerRelatedCategories) %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-12-02T04:12:44.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12626" PostTypeId="1" AcceptedAnswerId="12630" CreationDate="2015-12-02T04:16:08.113" Score="1" ViewCount="257" Body="&lt;p&gt;I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I would like to sort the entries by a number field ascending (size).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can perform both sorts individually with the syntax below, but I’m having difficulty combining them for a multisort-like function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; entries|supersort('sortAs', '{ brand.first.title }')&#xA; entries|supersort('sortAs', '{ size }', SORT_NUMERIC)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2015-12-02T16:54:59.553" Title="Multisort with supersort plugin" Tags="&lt;sorting&gt;&lt;plugin-supersort&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12627" PostTypeId="1" AcceptedAnswerId="12628" CreationDate="2015-12-02T04:31:53.473" Score="1" ViewCount="1234" Body="&lt;p&gt;I would like to output a field from a variable like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = &quot;entry.title&quot; %}&#xA;{{ foo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example it outputs &quot;entry.title&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other Example like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prefixVar = &quot;en_&quot; %}&#xA;{% set foo = &quot;entry.&quot;~ prefixVar ~&quot;title&quot; %}&#xA;{{ foo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example it outputs &quot;entry.en_title&quot;. Is it possible in Twig to get the content of the entry field instead of the string?&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="3535" LastEditDate="2015-12-02T05:13:59.180" LastActivityDate="2015-12-02T05:19:43.663" Title="Parse a String dynamic in Twig" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12628" PostTypeId="2" ParentId="12627" CreationDate="2015-12-02T04:43:23.647" Score="2" Body="&lt;p&gt;Surrounding text in quotes declares it as a string, whereas no quotes will assume variables. If you remove the quotes, you should get what you need.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = entry.title %}&#xA;{{ foo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I realy want to render a string and get the fieldvalue. A other example would be like this: I have a Variable with a Prefix and now i would like to output a field with this prefix: {% set foo = &quot;entry.&quot;~ prefixVar ~ &quot;_fieldName&quot; %} {{ foo }}. Is that possible?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am not sure if that's possible when accessing keys through the dot formatting (ie. &lt;code&gt;array.keyname&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you could tweak the approach a little bit, to access dynamic keys in &lt;code&gt;entry&lt;/code&gt; using the &lt;code&gt;attribute()&lt;/code&gt; twig function, such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = attribute(entry, prefixVar~&quot;_fieldName&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-12-02T05:19:43.663" LastActivityDate="2015-12-02T05:19:43.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12629" PostTypeId="1" AcceptedAnswerId="12631" CreationDate="2015-12-02T04:54:03.030" Score="2" ViewCount="1672" Body="&lt;p&gt;I've noticed the &lt;code&gt;HTML&lt;/code&gt; option above Rich Text Fields for entries is now gone in Craft 2.5, regardless of being configured as &lt;code&gt;Default&lt;/code&gt;, &lt;code&gt;Simple&lt;/code&gt;, or &lt;code&gt;Standard&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a feature that has been removed from Craft in v2.5+? I currently have a ton of content that relies on custom HTML outside of what's available in the format bar, so this would be pretty devastating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I overlooking where this option is now?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-12-02T05:22:07.203" LastActivityDate="2015-12-02T17:26:56.650" Title="Custom HTML in Rich Text Fields" Tags="&lt;entry&gt;&lt;field&gt;&lt;richtext&gt;&lt;dashboard&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12630" PostTypeId="2" ParentId="12626" CreationDate="2015-12-02T05:17:23.773" Score="2" Body="&lt;p&gt;Try to group the entries sorted by size using the &lt;code&gt;group&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %}&#xA;{% set entriesByBrand = entriesSorted|group('brand.first.title') %}&#xA;{% set entriesByBrand = entriesByBrand|supersort('ksort') %}&#xA;&#xA;{% for brand, entriesInBrand in entriesByBrand %}&#xA;    {% for entry in entriesInBrand %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-12-02T16:54:59.553" LastActivityDate="2015-12-02T16:54:59.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12631" PostTypeId="2" ParentId="12629" CreationDate="2015-12-02T05:18:56.267" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If your Redactor config included an &quot;html&quot; value in the &quot;buttons&quot; array, you can remove that, and add a &quot;source&quot; value to the &quot;plugins&quot; array instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/help/redactor-ii-configs&quot;&gt;https://craftcms.com/help/redactor-ii-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-02T05:18:56.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12633" PostTypeId="1" CreationDate="2015-12-02T10:02:02.067" Score="2" ViewCount="161" Body="&lt;p&gt;Weird issue when upgrading Craft to 2.5 that the settings link in the revised dashboard redirects to the settings page for the Dukt twitter add-on. If I disable the add-on then works just fine. Anybody else experiencing this problem?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-09T20:08:58.067" Title="Dukt twitter issue Craft 2.5" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12634" PostTypeId="1" AcceptedAnswerId="12640" CreationDate="2015-12-02T10:15:10.217" Score="4" ViewCount="453" Body="&lt;p&gt;after upgrade to 2.5, it seems it's not possible to click on the inserted image and resize it in the Rich Text Field. If you click it now, you directly get a popup to give in the Title, link or select the alignment.&#xA;It used to show an 'Edit' overlay &amp;amp; the option to resize it with the mouse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any others experiencing this?&lt;/p&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2015-12-07T17:09:14.523" Title="Can't resize image in Rich Text field since 2.5 update" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;richtext&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12636" PostTypeId="2" ParentId="9784" CreationDate="2015-12-02T13:33:01.157" Score="4" Body="&lt;p&gt;This solutions works for any locale, even if you don't have it installed as a front-end locale.&#xA;It also works for Personal or Client Craft installs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a translations file into craft/translations/xx.php named after the currently selected user locale or system locale for&#xA;Craft Personal installs and use this code to include any locale's translations you want. You can also customize it&#xA;further by overwriting select translations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;{&#xA;    $en = (include '../craft/app/translations/en.php');&#xA;    $custom = array(&#xA;        'Globals' =&amp;gt; 'I freak out!',&#xA;    );&#xA;&#xA;    return array_merge($en, $custom);&#xA;}&#xA;&#xA;return [];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-17T20:09:24.863" LastActivityDate="2017-07-17T20:09:24.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12637" PostTypeId="2" ParentId="4999" CreationDate="2015-12-02T13:33:12.413" Score="3" Body="&lt;p&gt;This solutions works for any locale, even if you don't have it installed as a front-end locale.&#xA;It also works for Personal or Client Craft installs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a translations file into craft/translations/xx.php named after the currently selected user locale or system locale for&#xA;Craft Personal installs and use this code to include any locale's translations you want. You can also customize it&#xA;further by overwriting select translations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;{&#xA;    $en = (include '../craft/app/translations/en_us.php');&#xA;    $custom = array(&#xA;        'Globals' =&amp;gt; 'I freak out!',&#xA;    );&#xA;&#xA;    return array_merge($en, $custom);&#xA;}&#xA;&#xA;return array();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-03-16T14:31:33.597" LastActivityDate="2017-03-16T14:31:33.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12638" PostTypeId="2" ParentId="12633" CreationDate="2015-12-02T13:48:39.383" Score="2" Body="&lt;p&gt;While we wait for an official update, you can patch this pretty easily. Just open up craft/plugins/twitter/TwitterPlugin.php and find this function:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Delete the function entirely, and replace it with this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getSettingsUrl()&#xA;{&#xA;    return 'twitter/settings';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-02T13:48:39.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12639" PostTypeId="1" CreationDate="2015-12-02T14:15:02.577" Score="0" ViewCount="270" Body="&lt;p&gt;Not a major thing but I just noticed the Craft News Feed on the dashboard is not showing.  It is still looking for &lt;a href=&quot;https://craftcms.com/news.rss&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/news.rss&lt;/a&gt;.  Any ideas what is up with that?&lt;/p&gt;&#xA;" OwnerUserId="186" LastActivityDate="2015-12-03T21:41:05.623" Title="Craft News Feed not working after 2.5 Update" Tags="&lt;control-panel&gt;&lt;dashboard-widgets&gt;" AnswerCount="2" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="12640" PostTypeId="2" ParentId="12634" CreationDate="2015-12-02T15:14:48.390" Score="0" Body="&lt;p&gt;I'd suggest downgrading to Redactor I, which always worked fine for me. Pixel &amp;amp; Tonic made a plugin, so it's fairly easy to do and so far I can't find any issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/RedactorI&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/RedactorI&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4379" LastEditorUserId="4379" LastEditDate="2015-12-07T17:09:14.523" LastActivityDate="2015-12-07T17:09:14.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12641" PostTypeId="2" ParentId="12634" CreationDate="2015-12-02T15:21:34.190" Score="1" Body="&lt;p&gt;It's not Craft that's broken it, but the new version of Redactor that's &quot;superior in every way&quot; acording to them:&#xA;&lt;a href=&quot;https://imperavi.com/blog/redactor-superior-in-every-way/&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/blog/redactor-superior-in-every-way/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2015-12-02T15:21:34.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12642" PostTypeId="2" ParentId="12615" CreationDate="2015-12-02T15:33:29.870" Score="1" Body="&lt;p&gt;As i was working on a localised website I had to use the full path,&#xA;in my case on MAMP PRO that was:&#xA;/Users/davedriesmans/Documents/Sites/website.dev/public/uploads/photos/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;guess i'll have to change then when going into production&lt;/p&gt;&#xA;&#xA;&lt;p&gt;use environmentVariables like Mats Mikkel Rummelhoff suggests&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2016-01-01T20:52:21.447" LastActivityDate="2016-01-01T20:52:21.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12643" PostTypeId="1" AcceptedAnswerId="12652" CreationDate="2015-12-02T15:41:50.987" Score="1" ViewCount="192" Body="&lt;p&gt;I'm using code I've been using to update existing entries for a while now and it's failing to fire following the 2.5 upgrade. Trying to figure out what might have changed, or if there's something I'm overlooking. I'm consistently getting the &quot;not saved&quot; response and seeing no update in the entry. &lt;code&gt;showInInvestmentAdvisersReference&lt;/code&gt; is the new field I'm setting. I've got &lt;code&gt;limit=1&lt;/code&gt; set for testing purposes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$entries-&amp;gt;section = 'referenceMaterials';&#xA;$entries-&amp;gt;limit = 1;&#xA;&#xA;$existingEntries = $entries-&amp;gt;find();&#xA;&#xA;foreach ($existingEntries as $existingEntry) {&#xA;    echo 'id: ' . $existingEntry-&amp;gt;id . '&amp;lt;br /&amp;gt;';&#xA;&#xA;    $entryToSave = new EntryModel();&#xA;&#xA;    $entryToSave = $existingEntry;&#xA;&#xA;    // Setting these in case they're required to be set for saveEntry()&#xA;    $entryToSave-&amp;gt;sectionId = 9;&#xA;    $entryToSave-&amp;gt;typeId = 9;&#xA;    $entryToSave-&amp;gt;authorId = 1;&#xA;    $entryToSave-&amp;gt;enabled = true;&#xA;    $entryToSave-&amp;gt;getContent()-&amp;gt;title = $existingEntry-&amp;gt;title;&#xA;&#xA;    $entryToSave-&amp;gt;getContent()-&amp;gt;showInInvestmentAdvisersReference = 1;&#xA;&#xA;    if ( craft()-&amp;gt;entries-&amp;gt;saveEntry($entryToSave) )&#xA;    {&#xA;        echo 'saved&amp;lt;br /&amp;gt;';&#xA;    }&#xA;    else {&#xA;        echo 'not saved&amp;lt;br /&amp;gt;';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it me? Did something change? Happy to file a bug report but thought I'd start here first where code formatting is supported.&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="187" LastEditDate="2015-12-02T22:12:08.007" LastActivityDate="2015-12-02T22:12:08.007" Title="saveEntry() not firing" Tags="&lt;plugin-elementapi&gt;&lt;services&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12644" PostTypeId="2" ParentId="12629" CreationDate="2015-12-02T15:54:30.397" Score="0" Body="&lt;p&gt;It may not be that simple. Redactor have changed the way text is formatted in text fields. Read this blog post on their website to see how they have become evangelical about cleaning up HTML on text areas &lt;a href=&quot;https://imperavi.com/blog/redactor-superior-in-every-way/&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/blog/redactor-superior-in-every-way/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like it may retrospectively remove custom HTML. &lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2015-12-02T15:54:30.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12645" PostTypeId="2" ParentId="12629" CreationDate="2015-12-02T16:15:35.413" Score="0" Body="&lt;p&gt;redactor still strips any html I added if I go back and make changes through the WYSIWYG side, which means all editing has to be done through HTML. Definitely not a solution, but it's the only way I've been able to edit image size/alignment (which is another feature they apparently removed in redactor 2).&lt;/p&gt;&#xA;" OwnerUserId="4379" LastEditorUserId="4379" LastEditDate="2015-12-02T17:26:56.650" LastActivityDate="2015-12-02T17:26:56.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12646" PostTypeId="2" ParentId="12634" CreationDate="2015-12-02T16:46:15.860" Score="1" Body="&lt;p&gt;The imageResizable and imageEditable settings were apparently deprecated in Redactor 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/upgrading-to-redactor-ii/&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/docs/upgrading-to-redactor-ii/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2015-12-02T16:46:15.860" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12647" PostTypeId="1" AcceptedAnswerId="12760" CreationDate="2015-12-02T17:57:53.080" Score="6" ViewCount="499" Body="&lt;p&gt;In addition to the inability to resize images in the rich text fields (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12634/cant-resize-image-in-rich-text-field-since-2-5-update&quot;&gt;mentioned elsewhere&lt;/a&gt;), I'm having issues with rich text fields, particularly in Matrix blocks, inserting extra spaces between paragraphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While an entry may be rendering normal on the frontend, opening up the entry will show the paragraphs with large spaces between them. Looking into the HTML, these appear as a series of tags like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;br&amp;gt;&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Strangely, when switching back and forth between the normal and HTML view, more and more of these spaces are inserted between the paragraphs. Do I have the option to rollback to the earlier version of Redactor? Any help or suggestions are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3687" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-12-07T21:59:15.203" Title="Extra spaces appearing in Rich Text fields after 2.5 update" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12648" PostTypeId="2" ParentId="12639" CreationDate="2015-12-02T18:09:42.553" Score="1" Body="&lt;p&gt;Just checked 2 upgraded sites of me and to me it's working..&lt;/p&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2015-12-02T18:09:42.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12649" PostTypeId="1" CreationDate="2015-12-02T19:22:40.123" Score="1" ViewCount="2883" Body="&lt;p&gt;I have been unable to access both my website and my login page. What's going on?&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2015-12-03T09:08:29.297" Title="My website isn't working: &quot;Craft does not support backtracking to this version. Please upload Craft 2750 or later.&quot;" Tags="&lt;error&gt;&lt;login&gt;&lt;dashboard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12650" PostTypeId="2" ParentId="12649" CreationDate="2015-12-02T19:31:38.493" Score="1" Body="&lt;p&gt;Looking through the code this is what you are running into:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Returns whether the uploaded DB schema is equal to or greater than the installed schema&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To me that says your database is out of sync. Were you updating to a different version? Perhaps you made the changes locally, then pushed them up but haven't updated your (production) database to reflect the change?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-02T19:31:38.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12651" PostTypeId="1" CreationDate="2015-12-02T19:38:02.367" Score="0" ViewCount="237" Body="&lt;p&gt;I have Craft set up and am using it for the first time. It seems to be ok. I am using git to back up my project to Github and push/pull it between computers as I partly work on my desktop (Windows) but also work on my laptop (Mac).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that when I pull to another PC often Craft database stuff is not the same. I lose changes made e.g. images that I’ve uploaded (even though they are in the actual Craft Image folder in my folders) or Matrix changes.&#xA;I didn’t realise this was happening and at first assumed my images weren’t updated because I’d forgotten to push to git before making changes on my laptop but when I went to pull my laptop changes to my Desktop last night and then tried accessing my Craft website through MAMP I got this error :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;myBlockSummary&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;myBlockSummary&quot; is a matrix thing I added last night on my laptop. My sass and html and image files are moving correctly with git which is why Craft is confused(?), looking for something on the database (myBlockSummary) which I suppose isn’t there. The website works on the laptop that I pulled it from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I easily continue using git and going between computers but have the database be included also?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This information on using Craft with git has not helped me really:&#xA;&lt;a href=&quot;https://craftcms.com/help/craft-storage-gitignore&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/help/craft-storage-gitignore&lt;/a&gt;&#xA;“So unless you have a way to keep the databases in sync between servers, there’s not a whole lot of point to sharing these files.”&#xA;Are they saying this is not possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help.&lt;/p&gt;&#xA;" OwnerUserId="4414" LastActivityDate="2015-12-02T19:57:57.743" Title="Craft database and Github - using multiple computers. Issue" Tags="&lt;database&gt;&lt;git&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12652" PostTypeId="2" ParentId="12643" CreationDate="2015-12-02T19:56:12.813" Score="3" Body="&lt;p&gt;Something on the &lt;code&gt;$entryToSave&lt;/code&gt; EntryModel is failing validation.  If you &#xA;echo out &lt;code&gt;implode(', ', $entryToSave()-&amp;gt;getAllErrors());&lt;/code&gt;, then you'll see what those errors are and you can correct them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-02T19:56:12.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12653" PostTypeId="2" ParentId="12651" CreationDate="2015-12-02T19:57:57.743" Score="2" Body="&lt;p&gt;It's a good practice to designate one instance on one computer (or server) as the &quot;canonical&quot; instance. You can make all database changes there, adding fields, etc. It's easy to download that database via the Backup Database tool in the admin panel. You can then import that dump file into databases on other machines as needed with a tool like SequelPro (Mac).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some prefer to include an updated database dump file in the git repo every time a change is made but that can get pretty tricky.&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2015-12-02T19:57:57.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12654" PostTypeId="1" CreationDate="2015-12-02T19:59:24.013" Score="1" ViewCount="336" Body="&lt;p&gt;Bit of an odd one here I can't quite work out. It's late and my brain is melting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am creating an Artist listing page. It is a Single where the client can pick which category of Artist they want to be listed. They do this via a category field on the Single.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel of Artists, and each artist has a Category field where they can be listed as playing in a given category. All simple enough so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The categories look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xQCjE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xQCjE.png&quot; alt=&quot;categories&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem: how do I loop through the artists and group them by their sub-categories? For example - the client has decided that on the listing page they want to list Ymuno Summer 2011. I need to then spit out all related artists, grouped by Friday and Saturday. An artist may be performing on more than one day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've stripped things back as far as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.featuredLineup | length %}&#xA;    {% set artistsInLineup = craft.entries.section('artists').relatedTo(entry.featuredLineup) %}&#xA;&#xA;    {% for artist in artistsInLineup %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But even that isn't spitting anything out at all, other than getting into the outer conditional. I feel like I'm making a rookie mistake, but everything I've seen in the docs is hard-coded relations rather than pulling from an entry field. I'm not even sure I'm thinking straight about the problem anymore.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-02T19:59:24.013" Title="Relating to multiple categories?" Tags="&lt;relations&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12655" PostTypeId="1" AcceptedAnswerId="12656" CreationDate="2015-12-02T21:16:32.120" Score="1" ViewCount="277" Body="&lt;p&gt;I was wondering if Craft is suitable for publishing online magazines. I was thinking about using a new structure for every issue/release. And entries for the actual content of an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the way to go? And does it affect Craft's performance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thnx&lt;/p&gt;&#xA;" OwnerUserId="4435" LastActivityDate="2015-12-02T21:31:24.273" Title="Using Craft for publishing an online magazine" Tags="&lt;entry&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12656" PostTypeId="2" ParentId="12655" CreationDate="2015-12-02T21:31:24.273" Score="5" Body="&lt;p&gt;I wouldn’t recommend creating a ton of Structure sections, because the administration workflows and UI are just not suited for having lots of identical sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a basic model of how you could organize this in Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create two &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;noreferrer&quot;&gt;Sections&lt;/a&gt; called &lt;strong&gt;Issues&lt;/strong&gt; and &lt;strong&gt;Articles&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;noreferrer&quot;&gt;Entries field&lt;/a&gt; called &lt;strong&gt;Issue Articles&lt;/strong&gt;, with the &lt;strong&gt;Articles&lt;/strong&gt; section selected.&lt;/li&gt;&#xA;&lt;li&gt;Edit your &lt;strong&gt;Issues&lt;/strong&gt; section’s Entry Type, and add the &lt;strong&gt;Issue Articles&lt;/strong&gt; field to its Field Layout.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, each issue will be represented by an entry within your &lt;strong&gt;Issues&lt;/strong&gt; section, and each article will be represented by an entry within your &lt;strong&gt;Articles&lt;/strong&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to the new Inline Element Creation feature in &lt;a href=&quot;https://craftcms.com/news/craft-2.5&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.5&lt;/a&gt;, you will easily be able to define new articles right from the Edit Entry page when creating/editing a new issue, via your &lt;strong&gt;Issue Articles&lt;/strong&gt; field.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-02T21:31:24.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12657" PostTypeId="2" ParentId="1117" CreationDate="2015-12-03T01:09:05.507" Score="12" Body="&lt;p&gt;Craft has a filter for &quot;&lt;a href=&quot;https://craftcms.com/docs/templating/filters#kebab&quot;&gt;Kebab Case&lt;/a&gt;&quot;, which I think is what you need. It strips out punctuation and replaces spaces with dashes. Useful if you need to format a field as a HTML attribute.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ tag.name|kebab }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastActivityDate="2015-12-03T01:09:05.507" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12658" PostTypeId="1" AcceptedAnswerId="12697" CreationDate="2015-12-03T03:53:48.807" Score="0" ViewCount="157" Body="&lt;p&gt;It is 100% possible I am going about this the wrong way, so please feel free to correct me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a registration form that creates a user. I have a plugin that is listening to the &lt;code&gt;onSaveUser&lt;/code&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onSaveUser', function (Event $event) {&#xA;    if ($event-&amp;gt;params['isNewUser']) {&#xA;        $entry = new EntryModel();&#xA;        $entry-&amp;gt;sectionId = 16;&#xA;        $entry-&amp;gt;typeId = 1;&#xA;        $entry-&amp;gt;enabled = false;&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = craft()-&amp;gt;request-&amp;gt;getPost('firstName') . ' ' . craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;&#xA;        ...&#xA;&#xA;        if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;            // success&#xA;        } else {&#xA;            // trouble!&#xA;        }&#xA;    }  &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works great. The entries I am creating are basically an extension of the user's account (height, weight etc). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are events for deleting a user, but what is the best way to relate the newly created entry so it gets deleted along with the user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about having an entries field on the actual user account that &lt;em&gt;somehow&lt;/em&gt; I populate with the newly created entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, should I have a &lt;code&gt;user&lt;/code&gt; field on the newly created entry? In that case, I'm not sure how I populate the newly created entry with the newly created userID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$user = $event-&amp;gt;params['user'];&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 16;&#xA;$entry-&amp;gt;typeId = 1;&#xA;$entry-&amp;gt;enabled = false;&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = craft()-&amp;gt;request-&amp;gt;getPost('firstName') . ' ' . craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;&#xA;// account is the handle of my users field&#xA;$entry-&amp;gt;getContent()-&amp;gt;account = $user-&amp;gt;id;  // im not setting this correctly&#xA;&#xA;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;    // success&#xA;} else {&#xA;    // trouble!&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-03T04:53:15.897" LastActivityDate="2015-12-04T06:56:39.177" Title="How can I delete all entries that belong to a user?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12660" PostTypeId="2" ParentId="12649" CreationDate="2015-12-03T09:08:29.297" Score="3" Body="&lt;p&gt;Sounds like your database was updated but your filesystem was not - that could happen perhaps if the development version and the live version share the same database, and only the development version ran the update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix it try renaming the craft/app folder to craft/app-old, then copy the craft/app folder from the latest Craft download into your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Backup your stuff first.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-03T09:08:29.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12661" PostTypeId="2" ParentId="827" CreationDate="2015-12-03T09:33:59.513" Score="1" Body="&lt;p&gt;I also had this problem and changing the setting worked for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did have a problem where the transforms then showed a 404 page rather than the actual image. Clearing the 'Cache' via settings in Craft CMS fixed this.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2015-12-03T09:33:59.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12662" PostTypeId="1" CreationDate="2015-12-03T09:34:28.267" Score="1" ViewCount="112" Body="&lt;p&gt;We've got a large formerly custom form which we're having problem saving.&#xA;Saves fine with eleven fields but any more than that and it is not saving, returning the error message: &lt;code&gt;Couldn't save form&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why this might be a problem?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-05T07:14:49.233" Title="Formerly saving issue" Tags="&lt;form&gt;&lt;plugins-formerly&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12663" PostTypeId="1" CreationDate="2015-12-03T10:55:35.123" Score="5" ViewCount="1867" Body="&lt;p&gt;The &quot;HTML&quot; button no longer seems to show in the WYSIWYG. The button is set in the Redactor config file like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;html&quot;,&quot;formatting&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;unorderedlist&quot;,&quot;orderedlist&quot;,&quot;link&quot;,&quot;image&quot;,&quot;video&quot;],&quot;plugins&quot;:[&quot;fullscreen&quot;,&quot;video&quot;],&#xA;    &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2277" LastEditorUserId="6134" LastEditDate="2017-02-07T00:18:00.780" LastActivityDate="2018-12-12T06:35:10.983" Title="HTML/View Source button not working/showing in WYSIWYG Craft 2.5 / Redactor II 1.1.0" Tags="&lt;redactor&gt;&lt;json&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12664" PostTypeId="2" ParentId="12663" CreationDate="2015-12-03T10:55:35.123" Score="8" Body="&lt;p&gt;It turns out that the latest redactor seems to now have a plugin for viewing the source. You can enable this in your redactor JSON config file under plugins. Just add the &quot;source&quot; plugin like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;lists&quot;, &quot;image&quot;],&#xA;    &quot;plugins&quot;:[&quot;fullscreen&quot;, &quot;source&quot;],&#xA;    &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2015-12-03T10:55:35.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12665" PostTypeId="1" CreationDate="2015-12-03T13:33:14.437" Score="1" ViewCount="532" Body="&lt;p&gt;Hi I've just updated to Craft 2.5 but ran into a problem. All my assets are now broken (also showen broken assets icons). I've cleared my cache, went to my craft_tasks table and adjusted the running task there but still it won't show me my assets again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions someone?&lt;/p&gt;&#xA;" OwnerUserId="4437" LastActivityDate="2016-01-05T20:31:52.113" Title="Assets problem (/cpresources/transforms/) after update to Craft Client 2.5.2750" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12666" PostTypeId="1" AcceptedAnswerId="12667" CreationDate="2015-12-03T13:37:28.350" Score="2" ViewCount="404" Body="&lt;p&gt;I was just checking out the &lt;a href=&quot;https://craftcms.com/news/ap-vector-case-study&quot; rel=&quot;nofollow noreferrer&quot;&gt;AP insights case study&lt;/a&gt;:&#xA;I came across the LiveView Editor screenshot. I see an inline Image Transform Crop field. What is the method to add this crop field ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Txw3x.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Txw3x.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4343" LastActivityDate="2016-02-20T08:01:47.570" Title="Image Transform as a Field" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12667" PostTypeId="2" ParentId="12666" CreationDate="2015-12-03T13:51:07.960" Score="3" Body="&lt;p&gt;It's probably just a drop down that sets the crop position setting in the image transform parameter string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this: &lt;a href=&quot;https://craftcms.com/docs/image-transforms#defining-transforms-in-your-templates&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/image-transforms#defining-transforms-in-your-templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2015-12-03T13:51:07.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12668" PostTypeId="1" AcceptedAnswerId="12681" CreationDate="2015-12-03T14:07:47.017" Score="0" ViewCount="83" Body="&lt;p&gt;Should be easy i thought. How can i display all entries from a section from a certain category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code now, but nothing shows up (screenshot bottomleft):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('b2c').first() %}&#xA;{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    {% for cat in entry.businessSegment %}&#xA;        {{ cat }} &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code shows all entries (screenshot topleft), and you can see there are entries with b2c:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('b2c').first() %}&#xA;{% set entries = craft.entries.section('homeBlocks').find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;    {% for cat in entry.businessSegment %}&#xA;        {{ cat }} &#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/03wN4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/03wN4.png&quot; alt=&quot;screen shot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Category Group is called Business Category (with handle &quot;&lt;em&gt;businessCategory&lt;/em&gt;&quot;). It contains two categories:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;b2c (slug &quot;&lt;em&gt;b2c&lt;/em&gt;&quot;)&lt;/li&gt;&#xA;&lt;li&gt;b2b (slug &quot;&lt;em&gt;b2b&lt;/em&gt;&quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The field handle used in the section &quot;&lt;em&gt;homeBlocks&lt;/em&gt;&quot; is &quot;&lt;em&gt;businessSegment&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where's the error? :)&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2015-12-03T19:24:35.400" LastActivityDate="2015-12-04T12:34:03.407" Title="Entries from hardcoded category" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12669" PostTypeId="1" AcceptedAnswerId="12677" CreationDate="2015-12-03T14:35:25.210" Score="0" ViewCount="158" Body="&lt;p&gt;I know Craft 2.5 uses Redactor II so I assume this problem relates to this, but it would be good to get this confirmed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting aside the fact you need to update the configs, I have noticed the ability to embed an image (in a Rich Text field) with a transform is no longer an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.4 there was another button adjacent to the Select button to upload an image with a pre-defined transform. This is missing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also noticed that the image select modal does not close once an image is selected either by double-clicking it or pressing the select button. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone else experiencing the same issues?&lt;/p&gt;&#xA;" OwnerUserId="3611" LastActivityDate="2015-12-03T16:57:46.383" Title="Craft 2.5 option to embed image with transform missing" Tags="&lt;image&gt;&lt;image-transforms&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2015-12-03T20:17:42.337" ContentLicense="CC BY-SA 3.0" />
  <row Id="12670" PostTypeId="2" ParentId="11791" CreationDate="2015-12-03T14:41:42.200" Score="2" Body="&lt;p&gt;In case it is useful to anyone upgrading to Craft 2.5, I had to modify the modifyEntrySources to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context) &#xA;{&#xA;  if ($context == 'index')&#xA;  {&#xA;    $sources[] = array('heading' =&amp;gt; 'Filter articles');&#xA;&#xA;    $sources['link:1'] = array(&#xA;        'label' =&amp;gt; 'Articles',&#xA;        'criteria' =&amp;gt; array('section' =&amp;gt; 'blog', 'type' =&amp;gt; 'article')&#xA;    );&#xA;    $sources['link:2'] = array(&#xA;        'label' =&amp;gt; 'Links',&#xA;        'criteria' =&amp;gt; array('section' =&amp;gt; 'blog', 'type' =&amp;gt; 'link')&#xA;    );&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the need for unique indexes &lt;strong&gt;$sources['link:1']&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3611" LastActivityDate="2015-12-03T14:41:42.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12674" PostTypeId="1" CreationDate="2015-12-03T15:31:35.167" Score="0" ViewCount="149" Body="&lt;p&gt;I've followed this &lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; by Zack Spear. It leaves your website with a header and footer that stay constant while the body of the page is loaded in through AJAX when you change pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have different _layout templates used for different pages with this approach or can it only be one? Could I hide the header on certain URLs? Could I show a secondary menu on specific urls?&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2015-12-03T17:00:31.297" Title="Is it possible to load different &quot;_layouts&quot; with ajax for certain pages?" Tags="&lt;templating&gt;&lt;ajax&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12675" PostTypeId="2" ParentId="12084" CreationDate="2015-12-03T16:39:43.517" Score="4" Body="&lt;p&gt;MySQL 5.7.5+ changed the way GROUP BY behaved in order to be SQL99 compliant (where in previous versions it was not). Either modify the existing mysql queries to be compatible to the new mysql version or make mysql behave as in previous versions , by executing the below queries on the mysql .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SET sql_mode = '';   // current client &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SET GLOBAL sql_mode = '';   // for other clients like hibernate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www.proactiveclass.com/tutorials/java/hibernate/sql-error-group-by-incompatible-with-sql-mode-only-full-group-by&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://www.proactiveclass.com/tutorials/java/hibernate/sql-error-group-by-incompatible-with-sql-mode-only-full-group-by&quot; rel=&quot;nofollow&quot;&gt;http://www.proactiveclass.com/tutorials/java/hibernate/sql-error-group-by-incompatible-with-sql-mode-only-full-group-by&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4441" LastActivityDate="2015-12-03T16:39:43.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12676" PostTypeId="1" CreationDate="2015-12-03T16:45:46.800" Score="0" ViewCount="92" Body="&lt;p&gt;I've just updated to 2.5 and am now not able to see or find the text styling option in a text box. We use the formatting option across our site for different headers, quotes, etc. Am I missing something or is the feature gone?&lt;/p&gt;&#xA;" OwnerUserId="4442" LastActivityDate="2015-12-03T17:01:30.020" Title="Formatting Headers, Quotes, Titles" Tags="&lt;richtext&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12677" PostTypeId="2" ParentId="12669" CreationDate="2015-12-03T16:57:46.383" Score="0" Body="&lt;p&gt;This is a bug that has been fixed in the next (post &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;2.5.2750&lt;/a&gt;) release. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-03T16:57:46.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12678" PostTypeId="2" ParentId="12674" CreationDate="2015-12-03T17:00:31.297" Score="1" Body="&lt;p&gt;Although you couldn't necessarily change the _layout template with the method given in that tutorial. What you could do is include the header &#xA;the templates rather than in the _layout.html for each template and change it out with another header in the other specific URLs. Or hide it, or whatever you like. &lt;/p&gt;&#xA;" OwnerUserId="4033" LastActivityDate="2015-12-03T17:00:31.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12679" PostTypeId="2" ParentId="12676" CreationDate="2015-12-03T17:01:30.020" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If your Redactor config included a &quot;formatting&quot; value in the &quot;buttons&quot; array, you need to rename that to &quot;format&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/help/redactor-ii-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/help/redactor-ii-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-03T17:01:30.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12680" PostTypeId="1" AcceptedAnswerId="12683" CreationDate="2015-12-03T18:02:10.733" Score="0" ViewCount="561" Body="&lt;p&gt;I have two category groups: &lt;code&gt;Cars&lt;/code&gt; and &lt;code&gt;Colors&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;Cars&lt;/code&gt; category looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cars&#xA;    Sports Cars&#xA;        Corvette&#xA;        Lamborghini&#xA;        Porche&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;Colors&lt;/code&gt; category looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Colors&#xA;    Red&#xA;    Black&#xA;    White&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have two drop-down menus; one to choose the car, the other to choose the color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can choose the car, or the color just fine. My url's look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/cars/corvette/&#xA;- or - &#xA;mysite.com/cars/red/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's when I need to relate &lt;em&gt;both&lt;/em&gt; categories. Since my two category groups have different levels, I'm not sure how to get the parent group of &lt;code&gt;Colors&lt;/code&gt; from &lt;code&gt;red&lt;/code&gt;. Which is what I think I need in order for the &lt;code&gt;relatedTo&lt;/code&gt; to work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a url might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/cars/corvette/  {# no problem #}  &#xA;- or - &#xA;mysite.com/cars/red/       {# no problem #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm able to get to the categories on my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &#xA; # Get the primary category GROUP via url segment. &#xA; # Example: Cars&#xA; #&#xA; #}&#xA;{% set primaryCategoryGroup = craft.categories.slug(craft.request.getSegment(2)).first() %}&#xA;&#xA;{#&#xA; # Get the primary CATEGORY via url segment.&#xA; # Ex: Corvette or Red&#xA; #}&#xA;{% set primaryCategory = craft.categories.slug(craft.request.getSegment(3)).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I check if I need to compare both relationships:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(4)|length %}&#xA;      {% set secondaryCategorySlug = craft.categories.slug(craft.request.getSegment(4)) %}&#xA;      {% set secondaryCategory = craft.categories.slug(craft.request.getSegment(4)).first() %}&#xA;&#xA;      {{ secondaryCategory.title }}  {# Red or Corvette #}&#xA;      {{ primaryCategory }}  {# Red or Corvette #}&#xA;&#xA;      {# Begin the fail #}&#xA;      {% set entries = craft.entries.section('mySection').relatedTo('and',&#xA;          { sourceElement: secondaryCategory, field:'title' },&#xA;          { targetElement: primaryCategory }&#xA;      ) %}&#xA;{% else %}&#xA;    {# Only get single relationship. #}&#xA;    {% set entries = craft.entries.relatedTo(primaryCategory) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-03T19:38:51.373" Title="How can I get the parent category group via the category to create multiple relation criteria?" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12681" PostTypeId="2" ParentId="12668" CreationDate="2015-12-03T18:55:24.140" Score="1" Body="&lt;p&gt;Give this a try. I'm not 100% sure I've got my site set up the same, but I think it's close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category group called &lt;code&gt;Categories&lt;/code&gt;. It looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Categories&#xA;    b2a    &#xA;    b2b&#xA;    b2c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a section called &lt;code&gt;homeBlocks&lt;/code&gt; which is a channel (shouldn't matter).&#xA;Then on my entry, I have a Categories field with a handle of &lt;code&gt;categoryOne&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('b2c') %}&#xA;{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}&#xA;&#xA;{% if entries | length %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;    {% else %}&#xA;        {# No entries found. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have created 3 entries within my &lt;code&gt;homeBlocks&lt;/code&gt; channel, and I've assigned the 1st entry and the 3rd entry to b2c. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am seeing this when I view the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Entry Three&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Entry One&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the bad info - I think I understand what you are looking for now. I've updated my answer so give it another try.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-04T12:34:03.407" LastActivityDate="2015-12-04T12:34:03.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12682" PostTypeId="1" AcceptedAnswerId="12703" CreationDate="2015-12-03T19:28:14.637" Score="0" ViewCount="252" Body="&lt;p&gt;I notice that you can add icons for your sub navigation. However looking at the template for the subnav loop there isn't any markup to render that icon. Anyone know if this is coming in the future or missing code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example pulled from Craft Commerce plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$context['subnav']['settings'] = array('icon' =&amp;gt; 'settings', 'label' =&amp;gt; Craft::t('Settings'), 'url' =&amp;gt; 'commerce/settings');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="971" LastEditorUserId="57" LastEditDate="2015-12-03T22:20:45.547" LastActivityDate="2015-12-04T11:55:27.413" Title="Craft 2.5 plugin sub navigation icons" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12683" PostTypeId="2" ParentId="12680" CreationDate="2015-12-03T19:38:51.373" Score="0" Body="&lt;p&gt;Not 100% sure if this is correct, but this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example urls:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mysite.com/cars/corvette/red&#xA;www.mysite.com/cars/red/corvette&#xA;...&#xA;www.mysite.com/cars/red/&#xA;www.mysite.com/cars/corvette&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Check if there are multiple url segments to compare against.&#xA; # This means we need to check against multiple relationships.&#xA; # Ex: All Corvettes that are also Red&#xA; #&#xA; #}&#xA;{% if craft.request.getSegment(4)|length %}&#xA;    {% set secondaryCategory = craft.categories.slug(craft.request.getSegment(4)).first() %}&#xA;    {% set entries = craft.entries.section('mySection').relatedTo(['and', { targetElement: primaryCategory }, { targetElement: secondaryCategory }]) %}&#xA;{% else %}&#xA;    {#&#xA;     # Get all products related to the current category.&#xA;     # Ex: All Sports Cars that are related to Corvettes.&#xA;     #&#xA;     #}&#xA;    {% set entries = craft.entries.relatedTo(primaryCategory) %}&#xA;{% endif %}&#xA;&#xA;...&#xA;&#xA;{% if entries|length %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What i'm not sure about is both are using &lt;code&gt;targetElement&lt;/code&gt; instead of one being &lt;code&gt;sourceElement&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-03T19:38:51.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12684" PostTypeId="1" CreationDate="2015-12-03T19:54:45.373" Score="1" ViewCount="1285" Body="&lt;p&gt;We have uploaded a logo in the CP, but the CP Login page still has the craftcms logo under the login box. Perhaps a config setting to remove this that I don't know about?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2015-12-03T20:14:26.187" Title="Craft CMS logo still showing on CP Login page" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12685" PostTypeId="2" ParentId="12684" CreationDate="2015-12-03T20:14:13.117" Score="1" Body="&lt;p&gt;The logo is stored in &lt;code&gt;craft/storage/logo/&lt;/code&gt; which is a in a path that's often in your &lt;code&gt;.gitignore&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-03T20:14:13.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12686" PostTypeId="2" ParentId="12684" CreationDate="2015-12-03T20:14:26.187" Score="3" Body="&lt;p&gt;As of Craft 2.5, by default you will see your Site Name in plain text above the login form, and a light Craft CMS logo below it. If you have Craft Client/Pro and upload a custom Login Page Logo from Settings → General, the plain text Site Name will get replaced with that logo, but the Craft CMS logo will remain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Login Page Logo was never meant to be used to white-label the CMS - even pre-2.5 if you uploaded a custom logo, there would still be Craft and P&amp;amp;T references in the CP footer (which hasn’t changed).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-03T20:14:26.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12687" PostTypeId="2" ParentId="12639" CreationDate="2015-12-03T21:41:05.623" Score="0" Body="&lt;p&gt;I will work with support on this directly as it appears to be an issue with our environment.&lt;/p&gt;&#xA;" OwnerUserId="186" LastActivityDate="2015-12-03T21:41:05.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12688" PostTypeId="2" ParentId="12665" CreationDate="2015-12-03T21:46:21.070" Score="0" Body="&lt;p&gt;At any point did you have to add the line &lt;code&gt;extension=imagick.so&lt;/code&gt; in your php.ini file? Even though it was recommended by my webhost (Fused Network) at the time , it was causing ImageMagick to misbehave and filling my public_html directory with core dumps. They were able to figure out the problem and deleting that line solved it.&lt;/p&gt;&#xA;" OwnerUserId="4438" LastActivityDate="2015-12-03T21:46:21.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12689" PostTypeId="1" CreationDate="2015-12-04T00:59:36.297" Score="0" ViewCount="337" Body="&lt;p&gt;After recently upgrading to Craft 2.5.x the HTML code view button is now missing from the &quot;standard&quot; Rich Text view, which means I can no longer edit all the custom HTML code I've added to those fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to create a custom Redactor config file to get HTML code view back, or should it still be included in the Standard config?&lt;/p&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2015-12-04T01:27:11.817" Title="HTML code button missing from Rich Text &quot;standard&quot; view after 2.5 upgrade" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2015-12-04T06:52:25.913" ContentLicense="CC BY-SA 3.0" />
  <row Id="12690" PostTypeId="2" ParentId="12665" CreationDate="2015-12-04T01:25:26.403" Score="1" Body="&lt;p&gt;I had similar issue but I was tinkering with Elements API. The JSON payload gave me that &lt;code&gt;cpresources/transforms/&lt;/code&gt; but once I clicked on the link it shows the proper image with the transforms applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon returning to the JSON printout, the URL for the assets looks correct. In my case it is pointing to the S3 bucket I had setup previously.&lt;/p&gt;&#xA;" OwnerUserId="3567" LastActivityDate="2015-12-04T01:25:26.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12691" PostTypeId="2" ParentId="12689" CreationDate="2015-12-04T01:27:11.817" Score="2" Body="&lt;p&gt;Thanks to carlcs for pointing this out. If I edit the Standard.json file in craft/config/redactor/ as per these instructions (&lt;a href=&quot;https://craftcms.com/help/redactor-ii-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/help/redactor-ii-configs&lt;/a&gt;) it's fixed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find it odd that Craft 2.5 didn't come with this Redactor config fix included, rather than letting it break and leaving it up to developers to fix it. I can understand if you had custom configs, but the default Simple and Standard configs should come fixed with the install or upgrade, no?&lt;/p&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2015-12-04T01:27:11.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12692" PostTypeId="1" AcceptedAnswerId="12718" CreationDate="2015-12-04T01:36:40.020" Score="1" ViewCount="1782" Body="&lt;p&gt;I am currently using Element API to serve Craft contents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wondering is, is it possible to create an endpoint that handle POST requests? Like form submission and such?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the examples that I've seen so far is to serve Craft entries as JSON.&lt;/p&gt;&#xA;" OwnerUserId="3567" LastActivityDate="2015-12-04T20:23:34.343" Title="Creating a POST request endpoint using Element API" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12693" PostTypeId="1" AcceptedAnswerId="12701" CreationDate="2015-12-04T02:22:54.217" Score="1" ViewCount="559" Body="&lt;p&gt;I have a plugin that listens for the &lt;code&gt;users.onSaveUser&lt;/code&gt;. So when users register, an account is created, and I am creating an entry that will contain extended profile information. I am attempting to create a user field on that newly created entry to relate the entry back to the user account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 16;&#xA;$entry-&amp;gt;typeId = 1;&#xA;$entry-&amp;gt;enabled = false;&#xA;$entry-&amp;gt;authorId = $user-&amp;gt;id;&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = craft()-&amp;gt;request-&amp;gt;getPost('firstName') . ' ' . craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;&#xA;// userAccount is the handle of the user field.&#xA;$entry-&amp;gt;setContent(['fields' =&amp;gt; ['userAccount' =&amp;gt; $user-&amp;gt;id]]);  // nope.&#xA;$entry-&amp;gt;setContentFromPost(['userAccount' =&amp;gt; $user-&amp;gt;id]);        // nope.&#xA;&#xA;...&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is coming across except the user field. I'm not sure what the field needs/is looking for to set it's value.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-04T02:37:17.990" LastActivityDate="2015-12-04T10:45:22.973" Title="How can I populate a user field via a plugin?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12694" PostTypeId="1" AcceptedAnswerId="12695" CreationDate="2015-12-04T05:11:22.467" Score="2" ViewCount="636" Body="&lt;p&gt;I am migrating a 15,000+ users from a site's old CMS (WP), and have them set to &lt;code&gt;Pending.&lt;/code&gt; All of their user information will be created and on Craft CMS, except their passwords will not be set, as migrating that is too complicated (for what I can tell.) So, the process I have in mind for previous users to login is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User enters &lt;em&gt;Username/Email &amp;amp; PW&lt;/em&gt;, submits login form.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Form sends data to custom &lt;code&gt;Custom Plugin Controller&lt;/code&gt;, and follows logic:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;code&gt;user status==active&lt;/code&gt;, simply send form data to Craft's &lt;code&gt;users/login&lt;/code&gt; and proceed as usual.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;code&gt;user status==pending&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Check if username/email exists in previous users list. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If it does not, simply send form data to Craft's &lt;code&gt;users/login&lt;/code&gt; and proceed as usual.&lt;/li&gt;&#xA;&lt;li&gt;If it does exist, it sends the Activation Email and redirects to special URL stating &quot;You've been sent an email to re-activate your account on this new website.&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do? It would be fairly straight forward to write, except I am unsure if there is a way to communicate with Craft's &lt;code&gt;users/login&lt;/code&gt; via a plugin. Is it something like &lt;code&gt;craft()-&amp;gt;users-&amp;gt;login( $userNameOrEmail, $userPassword )&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware I could also just send out batch email activation links to the migrated users, but I'd much prefer this method, in case they miss those e-mails and try logging in at a future date. Alternatively I could have a &quot;Are you a user of the old site? Click here to re-activate your account.&quot; Link on the login page, but again users may not notice it and think they cant login anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be hugely appreciated! Thanks.&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-12-04T05:29:14.823" LastActivityDate="2017-11-08T04:43:48.297" Title="Call to Craft Users Login Function from Plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;form&gt;&lt;frontend&gt;&lt;login&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12695" PostTypeId="2" ParentId="12694" CreationDate="2015-12-04T05:56:40.053" Score="3" Body="&lt;p&gt;What you're attempting to do is very doable.  This should be of help to you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/classreference/services/UsersService&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the Yii &lt;code&gt;forward&lt;/code&gt; function to pass along a request to another action handler:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $this-&amp;gt;forward('users/sendNewEmailVerifyEmail', false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-04T05:56:40.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12696" PostTypeId="1" CreationDate="2015-12-04T06:08:06.190" Score="0" ViewCount="1213" Body="&lt;p&gt;Checking the best way to achieve this or if it can be done without a plugin.&#xA;I need to allow people to register and create user accounts on my site with various profile information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I will have a form on the site available to users to submit which saves it in the backend and alerts by email. (A&amp;amp;M forms looks like it has this functionality). When a user logs in this form should be prepopulated with data from their user profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the form is submitted - can it update their user profile also?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is basically a form for users to order repeat prescriptions - so I'm thinking user profile to save the standard date then use that to prepopulate the a&amp;amp;m form. Is what I'm suggesting the best way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2016-02-02T12:52:52.583" Title="Using Form to update User Profile and submit form" Tags="&lt;users&gt;&lt;form&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12697" PostTypeId="2" ParentId="12658" CreationDate="2015-12-04T06:56:39.177" Score="2" Body="&lt;p&gt;You'll want to set the &lt;code&gt;authorId&lt;/code&gt; of your entry to be the &lt;em&gt;new user's id&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you delete that user through the control panel, it'll ask &quot;What do you want to do with this person's content?&quot;... At that point, you can just select &quot;Delete it&quot;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-04T06:56:39.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12698" PostTypeId="1" CreationDate="2015-12-04T09:09:39.050" Score="0" ViewCount="109" Body="&lt;p&gt;Is there a way to show the images in the control panel entries (both in the detail of the entry and in the overview list using the new customisable columns in 2.5).  The standard preview of the images is so small it hardly is visible to control panel users.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;On the feedback site this feature request seems to have made it in one way or another to the 2.5 build.  Does anyone know how to use it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7192735-better-image-preview-and-edit-window-for-asset-fie&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7192735-better-image-preview-and-edit-window-for-asset-fie&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="397" LastEditorUserId="397" LastEditDate="2015-12-07T12:33:57.200" LastActivityDate="2015-12-07T12:33:57.200" Title="Show larger images in control panel entries" Tags="&lt;control-panel&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12700" PostTypeId="2" ParentId="12698" CreationDate="2015-12-04T10:31:42.860" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/boboldehampsink/assetpreview&quot; rel=&quot;nofollow&quot;&gt;Asset Preview&lt;/a&gt; plugin is what you need. This allows you to toggle previews of assets by clicking on them and tapping the space bar. You can also use the arrow keys to navigate through all of the assets on a page.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-04T10:31:42.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12701" PostTypeId="2" ParentId="12693" CreationDate="2015-12-04T10:45:22.973" Score="1" Body="&lt;p&gt;Relational fields are always stored as arrays, even if you are limiting them to only one entry so this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(['userAccount' =&amp;gt; array($user-&amp;gt;id)]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-04T10:45:22.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12702" PostTypeId="1" AcceptedAnswerId="12798" CreationDate="2015-12-04T11:20:12.523" Score="3" ViewCount="175" Body="&lt;p&gt;I have a list of events which should list each event until midnight of said day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So If a gig happens at 17:00 it should still be visible until midnight of the same day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came relatively close (I guess) but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nocturne = now|date_modify('today 00:00') %}&#xA;{% set midnight = nocturne|date('Y-m-d H:i') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should set &lt;code&gt;{{ midnight }}&lt;/code&gt; to midnight of the current day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I translate the custom date field of each gig into the same format as &lt;code&gt;{{ mdinight }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set getFirstGig = craft.entries.section('gigEntry').first() %}&#xA;{% set gigDate = getFirstGig.konzertDatum|date('Y-m-d H:i') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I want to call the whole thing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set upcoming = craft.entries.section('gigEntry').gigDate('&amp;gt;= ' ~midnight) %}&#xA; {% for entry in upcoming %}&#xA;   &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code actualy works but my test entry with the time 17:00 is not displayed here. What am I missing? And is there a neater way of writing things?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-12-10T00:17:01.530" Title="Show events until Midnight" Tags="&lt;datetime&gt;&lt;events&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12703" PostTypeId="2" ParentId="12682" CreationDate="2015-12-04T11:55:27.413" Score="1" Body="&lt;p&gt;Not actually possible. That &lt;code&gt;icon&lt;/code&gt; key is not being used anywhere – just a remnant from a past feature idea that didn’t make it into Craft 2.5. (I just removed it for the next release.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-04T11:55:27.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12705" PostTypeId="1" AcceptedAnswerId="12713" CreationDate="2015-12-04T12:20:41.793" Score="1" ViewCount="365" Body="&lt;p&gt;I can't seem to find a way to duplicate a product in Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've duplicated articles before, with the &quot;save as new&quot; feature... But can't find anything similar for products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does such a thing exist? &lt;/p&gt;&#xA;" OwnerUserId="3717" LastEditorUserId="3717" LastEditDate="2015-12-04T13:01:25.183" LastActivityDate="2018-05-31T08:44:07.820" Title="Can't duplicate a product in Craft Commerce?" Tags="&lt;plugins&gt;&lt;ecommerce&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12706" PostTypeId="2" ParentId="12696" CreationDate="2015-12-04T12:42:29.860" Score="3" Body="&lt;p&gt;Yep, that's totally do-able. Check out &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; to see how to create a registration form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then check out &lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; to see how to create the update profile form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing to note is that any custom fields like &lt;code&gt;address&lt;/code&gt; or &lt;code&gt;city&lt;/code&gt; need to be pre-pended with &lt;code&gt;fields&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say you want the user to enter their city. On your front-end form the markup looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;city&quot;&amp;gt;City&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;city&quot; type=&quot;text&quot; name=&quot;fields[city]&quot;&#xA;{%- if currentUser is defined %} value=&quot;{{ currentUser.city }}&quot;{% endif %}&amp;gt;&#xA;    {% if currentUser is defined %}&#xA;        {{ errorList(currentUser.getErrors('city')) }}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that your field handle(s) in the CP align with what you call them on your front-end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/351/how-can-i-determine-if-a-user-is-logged-in-and-who-that-user-is&quot;&gt;Here&lt;/a&gt; is how you can check for the current user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4332/how-to-add-custom-user-fields-to-the-front-end-registration-page&quot;&gt;Here&lt;/a&gt; is another great example of how to populate custom fields in your profile/registration form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-12-04T12:42:29.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12708" PostTypeId="1" AcceptedAnswerId="12716" CreationDate="2015-12-04T13:47:41.657" Score="1" ViewCount="1006" Body="&lt;p&gt;Excuse my new-ness, but I'm having an issue with product variants. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a product with multiple variants (up to 30 in fact). Based on the URL, I want to choose a specific variant so that I can display fields from that variant on my product detail page. I also want a 'default variant' if there is no variant specified in the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my example, the variant should be selected by a custom field in that variant &lt;code&gt;colour&lt;/code&gt; whose value match the 4th URL segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab colour segment #}&#xA;{% set colourSlug = craft.request.getSegment(4) %}&#xA;&#xA;{# If there is no colour, we grab the first variant colour #}&#xA;    {% if not colourSlug %}&#xA;        {# Grab first product variant #}&#xA;        {% set dressColour = product.defaultVariant %}&#xA;    {% else %}&#xA;        {# Set dress colour #}&#xA;        ??{% set dressColour = product.variants.find(colour.colourSlug) %}??&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="175" LastEditorUserId="175" LastEditDate="2015-12-04T13:54:34.767" LastActivityDate="2015-12-04T18:09:59.597" Title="How do I select a specific product variant by element/field/entry?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12709" PostTypeId="1" AcceptedAnswerId="12711" CreationDate="2015-12-04T14:48:08.367" Score="0" ViewCount="399" Body="&lt;p&gt;Inside a JSON template I find an entry using &lt;code&gt;id&lt;/code&gt;, the result title can't be seen using &lt;code&gt;entry.title&lt;/code&gt; but I can see it with &lt;code&gt;entry[0].title&lt;/code&gt;. There is another step or encoding I have to use? &lt;/p&gt;&#xA;" OwnerUserId="3851" LastEditorUserId="57" LastEditDate="2015-12-04T17:05:33.930" LastActivityDate="2015-12-04T17:05:33.930" Title="Fail in JSON using Twig" Tags="&lt;templating&gt;&lt;entry&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12710" PostTypeId="1" CreationDate="2015-12-04T14:53:23.100" Score="3" ViewCount="268" Body="&lt;p&gt;Is it possible to add products and discounts to an order from backend?&#xA;From what I see it's only possible to edit the orders custom fields.&lt;/p&gt;&#xA;" OwnerUserId="195" LastActivityDate="2015-12-14T19:47:04.377" Title="Edit order from backend" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12711" PostTypeId="2" ParentId="12709" CreationDate="2015-12-04T15:35:42.247" Score="1" Body="&lt;p&gt;If you are using something like this to get your entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('blog').limit(1).id('21') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then Craft is actually returning an ElementCriteriaModel object, even if it is only one entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To ensure that the &lt;code&gt;entry&lt;/code&gt; variable only contains a single entry, you need to call the &lt;code&gt;first()&lt;/code&gt; method like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('blog').limit(1).id('21').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details in the docs here: &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-04T15:35:42.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12712" PostTypeId="2" ParentId="12575" CreationDate="2015-12-04T16:42:38.477" Score="2" Body="&lt;p&gt;Perhaps I am misunderstanding what you are trying to accomplish, but it seems like you should be able to accomplish what you are looking for with Craft's native &lt;code&gt;EntriesfieldType&lt;/code&gt;.&#xA;Regardless, I'll write up a few options for creation your own Entry select modal as well as a custom FieldType.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check out Craft's &lt;code&gt;BaseElementFieldType&lt;/code&gt; which all of Craft's Element Field Types extend, you'll see that it has an attribute called &lt;code&gt;$inputTemplate&lt;/code&gt; with the value &lt;code&gt;'_includes/forms/elementSelect'&lt;/code&gt;. This is the template that is rendered for element fields on the entry edit pages, and is accessible from the forms macro!&#xA;To create an element select modal from within a template, you can call &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelect({options}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget to import the forms via &lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check out the elementSelect template, you can see all of the fields that are required to create an element select modal. This is really handy and it becomes really easy to create an element select modal. Inspecting an element field type's &lt;code&gt;getInputTemplateVariables()&lt;/code&gt; will show you what variables are passed. Use of a debugger here and setting breakpoints to walk through the flow of execution helps a lot as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check out the EntriesFieldType, you'll see that it relies almost entirely on the logic in the BaseElementFieldType, and just updates the &lt;code&gt;$elementType&lt;/code&gt; property, and overrides the &lt;code&gt;getAddButtonLabel()&lt;/code&gt; method. So the input template variables defined in the base class are the ones that are used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you are defining a custom field type, you have this handy tool to create a modal. You can create an input template and make this call, and then implement &lt;code&gt;getInputHtml()&lt;/code&gt; to pass the necessary variables and render the template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: If you have never done this before, check out &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's documentation&lt;/a&gt; on how to create your own custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you want to create a custom field type that is similar to the Entries field type but you want it to have some additional functionality outside of what you get with the EntriesFieldType. No problem! Craft has made it really easy to do this. What you can do is create a field type like you would a normally, (follow the same naming conventions - PluginName_NameFieldType.php within a fieldtypes directory in your plugin), but instead of extending &lt;code&gt;BaseFieldType&lt;/code&gt;, you can extend &lt;code&gt;EntriesFieldType&lt;/code&gt; and get all of the functionality of the &lt;code&gt;EntriesFieldType&lt;/code&gt; for free! Then you can override methods as you see fit in order to create your custom functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, lets say you want your entries select field to only be able to select fields from your Companies channel, you could override the &lt;code&gt;inputSelectionCritieria()&lt;/code&gt; method and return&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria['id'] = $ids&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $ids is an array of element ids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Criteria returned by this method and passed to elementSelect is &lt;strong&gt;not&lt;/strong&gt; a CriteriaModel, but is an array with some pretty specific keys. For some more detailed documentation, &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/EntryElementType#getSources-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;check this out&lt;/a&gt;, and also check out the &lt;code&gt;BaseElementFieldType&lt;/code&gt; implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending the EntriesFieldType is really handy because you can rely on Craft for most of the logic. For instance, if you want your Entry select modal to be exactly the same as the default one, then you don't have to define your own input template. You can modify the input variables as you see fit by overriding methods and adding your own custom functionality, and then let the &lt;code&gt;BaseElementFieldType&lt;/code&gt; render the modal itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This post has been focused on backend stuff for modals and field types, but it is also possible to extend the modal js for a more custom experience. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin&quot;&gt;Check out this stack post&lt;/a&gt; and Peter Tell's &lt;a href=&quot;https://github.com/page-8/craft-manytomany&quot; rel=&quot;nofollow noreferrer&quot;&gt;Many to Many plugin&lt;/a&gt; for a complete example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best tool to figuring out what is going on is inspecting the Craft core as well as other plugins. There isn't great documentation on how to do a lot of this stuff, so if you have more specific questions, please feel free to leave them here! I'd love to expand this answer to have more detailed explanations. Hopefully this can help get you started!&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-12-04T16:42:38.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12713" PostTypeId="2" ParentId="12705" CreationDate="2015-12-04T17:03:10.280" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added in &lt;a href=&quot;https://craftcommerce.com/changelog#build1196&quot; rel=&quot;nofollow&quot;&gt;Craft Commerce 1.1.1196&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There currently isn't a native way, but it sounds like a great &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/295386-commerce&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-04T02:33:53.073" LastActivityDate="2016-04-04T02:33:53.073" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12714" PostTypeId="1" AcceptedAnswerId="12733" CreationDate="2015-12-04T17:26:00.277" Score="1" ViewCount="241" Body="&lt;p&gt;Could anyone help me with this one? I have a custom plugin which needs to update a user's custom field with a particular value if they've filled out something on the registration form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the code below would work but it's running 44 times which is causing a nesting level error with xdebug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone tell me why it would be running 44 times on a simple /users/saveUser post request with the below hook?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;talentJobFamily and talentStage are both custom fields.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onSaveUser', function (Event $event)&#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;&#xA;        if ($user-&amp;gt;talentJobFamily-&amp;gt;value != '') {&#xA;            $user-&amp;gt;getContent()-&amp;gt;setAttributes([&#xA;                'talentStage' =&amp;gt; 'engage',&#xA;            ]);&#xA;&#xA;&#xA;            craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3984" LastEditorUserId="3984" LastEditDate="2015-12-04T17:31:15.123" LastActivityDate="2015-12-05T21:53:10.720" Title="users.onSaveUser firing multiple times" Tags="&lt;users&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12716" PostTypeId="2" ParentId="12708" CreationDate="2015-12-04T17:54:19.803" Score="2" Body="&lt;p&gt;You would currently need to loop over all variants and just grab the ones that match the 'if' condition shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set colourSlug = craft.request.getSegment(4) %}&#xA;&#xA;{% if not colourSlug %}&#xA;    {# Grab first product variant #}&#xA;    {% set dressColour = product.defaultVariant %}&#xA;{% else %}&#xA;    {# Set dress colour #}&#xA;    {% for variant in product.variants %}&#xA;    {% if variant.colour == colorSlug %}&#xA;       {{variant.sku}}&#xA;    {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We will look to enable variants to be an element criteria query. If each variant has their own page, would it make sense they are seperate products?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-12-04T17:54:19.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12717" PostTypeId="2" ParentId="12708" CreationDate="2015-12-04T18:09:59.597" Score="1" Body="&lt;p&gt;Just before I saw luke's answer I wrote this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab colour segment #}&#xA;{% set colourSlug = craft.request.getSegment(4) %}&#xA;&#xA;{# If there is no colour, we grab the first variant colour #}&#xA;    {% if not colourSlug %}&#xA;        {# Grab first product variant #}&#xA;        {% set dressVariantActive = product.defaultVariant %}&#xA;    {% else %}&#xA;        {# Set outside the loop #}&#xA;        {% set dressVariantActive = '' %}&#xA;&#xA;        {% for dressVariantSelected in product.variants %}&#xA;            {% if dressVariantSelected.colour.value == colourSlug %}&#xA;                {% set dressVariantActive = dressVariantSelected %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;        {% if not dressVariantActive %}{% exit 404 %}{% endif %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wanted to include this as I found out a useful thing: Defining a variable inside a &lt;code&gt;for&lt;/code&gt; loop is &lt;strong&gt;only&lt;/strong&gt; possible if you set the variable before the loop.&lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2015-12-04T18:09:59.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12718" PostTypeId="2" ParentId="12692" CreationDate="2015-12-04T18:11:16.820" Score="1" Body="&lt;p&gt;The ElementAPI plugin currently only supports consuming data from a Craft installation, not creating/POSTing to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our long-term list to have a full on REST API for Craft where this would be possible, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-04T18:11:16.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12720" PostTypeId="1" AcceptedAnswerId="12774" CreationDate="2015-12-04T18:50:14.167" Score="0" ViewCount="360" Body="&lt;p&gt;In addition to the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12634/cant-resize-image-in-rich-text-field-since-2-5-update&quot;&gt;lack of image resizing&lt;/a&gt; and the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12647/extra-spaces-appearing-in-rich-text-fields-after-2-5-update&quot;&gt;odd extra spacing&lt;/a&gt;, the latest Redactor implementation also lacks support for aligning images left or right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also discovered any text that was previously italicized by the previous text editor disappears when rendered in the new one. If the entry is saved with the new text editor in place, all previously italicized copy disappears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until this implementation is remedied, I've plugged the earlier version of Redactor into this instance to stem client complaints. Doing so completely disables image placement and Live Preview, but it beats the alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the correct route of action in order to restore this functionality, or is there a better way? Please advise.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-12-08T14:57:19.590" Title="Image and italics issues in Rich Text editor since 2.5 update" Tags="&lt;redactor&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12721" PostTypeId="1" CreationDate="2015-12-04T20:00:53.250" Score="3" ViewCount="156" Body="&lt;p&gt;How do you paste a table created in Microsoft Word into a Rich Text field in Craft?&lt;/p&gt;&#xA;" OwnerUserId="4445" LastEditorUserId="9" LastEditDate="2015-12-04T21:27:49.227" LastActivityDate="2015-12-07T14:40:55.517" Title="Pasting tables from Microsoft Word into Rich Text fields" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;wysiwyg&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12722" PostTypeId="2" ParentId="12692" CreationDate="2015-12-04T20:23:34.343" Score="3" Body="&lt;p&gt;You might want to check out this plug-in:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/airtype/restfulapi&quot; rel=&quot;nofollow noreferrer&quot;&gt;Restful Api&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Restful Api is a plugin for Craft CMS that exposes elements as resources via a restful api. While similar to Craft's own Element Api plugin, Restful Api offers a few more features such as support for more HTTP verbs, authentication and element type based permissions.&lt;/p&gt;&#xA;&lt;p&gt;Restful Api utilizes Fractal to transform and serialize responses. Restful Api is also PSR-7 complaint. Its request and response objects can even be utilized by third party plugins if desired, although this has not been extensively tested yet.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="28" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-12-04T20:23:34.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12724" PostTypeId="1" AcceptedAnswerId="12731" CreationDate="2015-12-04T22:54:53.450" Score="1" ViewCount="992" Body="&lt;p&gt;I am working on a plugin that has a date picker only (no time). I am attempting to set the &lt;code&gt;postDate&lt;/code&gt; to the value of whatever date was chosen on the front-end. I realize I need to save in this format: &lt;code&gt;Y-m-d H:i:s&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$start = craft()-&amp;gt;request-&amp;gt;getPost('startDate'); // 09/27/2015&#xA;&#xA;// I'm not doing this right as it returns nothing.&#xA;$post = DateTime::createFromString($start); &#xA;&#xA;// Returns a datetime object, but doesn't save.&#xA;$post = new \DateTime($start); &#xA;&#xA;DateTime Object (&#xA;    [date] =&amp;gt; 2015-09-27 00:00:00.000000  // trim the last decimal?&#xA;    [timezone_type] =&amp;gt; 3&#xA;    [timezone] =&amp;gt; UTC&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't really care what the time is. It could always be midnight, or get the current time from the server. What is the best way to &quot;assemble&quot; the datetime?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-05T21:18:41.317" LastActivityDate="2015-12-05T21:18:41.317" Title="How can I set the postDate and expiryDate from a front-end date picker via plugin?" Tags="&lt;plugin-development&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12725" PostTypeId="1" CreationDate="2015-12-05T02:40:49.273" Score="1" ViewCount="761" Body="&lt;p&gt;I have a blog, and in the sidebar I have listed all tags in use. I would like to link each tag - when you click it I want to link to a page that lists all the blog entries which have that tag applied to them. Cant find this in the docs.. would someone mind helping? Here is my code so far: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;tagblock&quot;&amp;gt;&#xA;    {% set entries = craft.entries.section('blog').limit(null) %}&#xA;         {% for tag in craft.tags %}&#xA;           &amp;lt;div class=&quot;tag&quot;&amp;gt;&amp;lt;a href=&quot;{{ url('blog-page/'~tag.id) }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MY RESULTS: This code is linking to for example mysite.com/blog-page/88 - and giving me a page not found. I have a template blog-page and the path is correct as the page loads if you remove the tag-id off the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4448" LastActivityDate="2015-12-05T10:13:06.473" Title="Listing All tags - and linking them to list of entries with that tag" Tags="&lt;entries&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12727" PostTypeId="2" ParentId="12725" CreationDate="2015-12-05T10:13:06.473" Score="4" Body="&lt;p&gt;You don't have a setting in Craft to make Tags have their own pages automatically. So what you have to do instead, is to set up a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; in Settings → Routes. Create a new route which routes these URIs: blog/tags/[slug] (drag the slug token into the URI field) to a template blog/_tags.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your blog/_tags.html template you will now have a slug variable available, but you still need to query for the tag model / entry models.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.slug(slug).first() %}&#xA;{% if not tag %}{% exit 404 %}{% endif %}&#xA;&#xA;{% set entries = craft.entries.section('blog').relatedTo(tag).limit(null) %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{ tag.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;{% for entry in entries %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd also modify the tag listing to only show tags that are actually related to an entry, and use the tags' (undocumented) slug property for SEO purposes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').limit(null) %}&#xA;{% set tags = craft.tags.relatedTo(entries).limit(null) %}&#xA;&#xA;{% for tag in tags %}&#xA;    &amp;lt;a href=&quot;{{ url('blog/tags/'~tag.slug) }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-05T10:13:06.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12728" PostTypeId="2" ParentId="12721" CreationDate="2015-12-05T10:40:31.287" Score="1" Body="&lt;p&gt;This is not possible at the moment. Craft 2.5 uses the updated Redactor II WYSIWYG editor, which dropped this from it's features. All pasted text is stripped to plain text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps someone can suggest an alternative method that we can set up to make this easy for content editors.&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="57" LastEditDate="2015-12-05T22:08:38.457" LastActivityDate="2015-12-05T22:08:38.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12729" PostTypeId="1" CreationDate="2015-12-05T15:36:31.660" Score="0" ViewCount="64" Body="&lt;p&gt;I have a problem with a pair of cache tags refusing to bust the cache when a new entry is added.  The cache works well otherwise.&#xA;This is the template code I'm using... it's fairly complex as we're using it to filter products in an ecommerce site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% set products = craft.entries.section('products').relatedTo(entry).find({limit: 1000}) %}&#xA;  {% include 'shop/partials/_product_list' with { products : products } %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the include. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for product in products %}&#xA;    {% set cat_classes = '' %}&#xA;&#xA;    {% for cat in product.category %}&#xA;        {% set cat_classes = cat_classes ~ ' ' ~ cat.slug %}&#xA;    {% endfor %}&#xA;&#xA;    {% for cat in product.collection %}&#xA;        {% set cat_classes = cat_classes ~ ' ' ~ cat.slug %}&#xA;    {% endfor %}&#xA;&#xA;    {% for range in craft.entries.find({limit: 1000, section: 'priceRange'}) %}&#xA;        {% if product.price &amp;gt;= range.priceFrom and product.price &amp;lt;= range.priceTo %}&#xA;            {% set cat_classes = cat_classes ~ ' ' ~ range.slug %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for days in craft.entries.find({limit: 1000, section: 'leadInTimes'}) %}&#xA;        {% if product.leadInTime &amp;gt;= days.leadInFromDays and product.leadInTime &amp;lt;= days.leadInToDays %}&#xA;            {% set cat_classes = cat_classes ~ ' ' ~ days.slug %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if product.canBePurchasedOnline %}&#xA;        {% set cat_classes = cat_classes ~ ' buy-online' %}&#xA;    {% else %}&#xA;        {% set cat_classes = cat_classes ~ ' special-order' %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;prod {{ cat_classes }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;        &amp;lt;picture&amp;gt;&#xA;            ...&#xA;        &amp;lt;/picture&amp;gt;&#xA;        &amp;lt;div class=&quot;pdesc&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ product.title }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;span class=&quot;price-from&quot;&amp;gt;£{{ product.price }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;!-- /prod --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If anyone has any ideas I'd be grateful!&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2015-12-05T16:29:08.013" Title="Cache won't bust on new entry" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12730" PostTypeId="2" ParentId="12729" CreationDate="2015-12-05T16:29:08.013" Score="3" Body="&lt;p&gt;I fixed it - there was a stuck task preventing the stale template cache from being deleted.&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2015-12-05T16:29:08.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12731" PostTypeId="2" ParentId="12724" CreationDate="2015-12-05T20:27:04.267" Score="5" Body="&lt;p&gt;I believe I have figured it out, please correct me so I can update the answer if I am too far off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a &lt;em&gt;date&lt;/em&gt; picker (no time) on a front-end form. The user chooses a date and it comes across as &lt;code&gt;09/27/2015&lt;/code&gt;. Here is how I converted that string to a dateTime object that I could set as post &amp;amp; expiry date for a newly created entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: I have not included any validation at this point which should be carefully considered. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the current time zone from the system.&#xA;date_default_timezone_set(craft()-&amp;gt;timezone);&#xA;&#xA;// Get the current time&#xA;$time = date('H:i:s');&#xA;&#xA;// Create the post dateTime&#xA;$postDate = date('Y-m-d', strtotime(craft()-&amp;gt;request-&amp;gt;getPost('postDate')));&#xA;$postDateTime = $postDate . ' ' . $time;&#xA;&#xA;// Create the expiry dateTime.&#xA;$expireDate = date('Y-m-d', strtotime(craft()-&amp;gt;request-&amp;gt;getPost('expiryDate')));&#xA;$expireDateTime = $expireDate . ' ' . $time;&#xA;&#xA;// Create the DateTime object to send to Craft.&#xA;$postDate = new \DateTime($postDateTime);&#xA;$expiryDate = new \DateTime($expireDateTime);&#xA;&#xA;// Put it all together.&#xA;$entry = new EntryModel();&#xA;&#xA;$entry-&amp;gt;sectionId = 3;&#xA;$entry-&amp;gt;typeId = 1;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;postDate = $postDate;&#xA;$entry-&amp;gt;expiryDate = $expiryDate;&#xA;&#xA;...&#xA;&#xA;if(craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;    // Success&#xA;} else {&#xA;    // Fail&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-05T20:27:04.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12733" PostTypeId="2" ParentId="12714" CreationDate="2015-12-05T21:33:13.033" Score="2" Body="&lt;p&gt;This burned me awhile back. As I understand it, your code is not just running 44 times, it's actually running an endless loop... until it blows up (and likely runs out of memory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically when you attach onto &lt;code&gt;onSaveUser&lt;/code&gt; and then save again using &lt;code&gt;SaveUser&lt;/code&gt;, Craft is going to give other plugins—that &lt;em&gt;also&lt;/em&gt; latch onto the &lt;code&gt;onSaveUser&lt;/code&gt;event—a shot at manipulating the data you just saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the wrinkle there is Craft is going to call your code again, resulting in the endless loop. Basically you need a way to break the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10482/handling-endless-recursion-in-saveentry&quot;&gt;Brad mentions&lt;/a&gt;  one way around that is to simply update the db directly instead of calling &lt;code&gt;saveUser&lt;/code&gt;. Since you're using a custom field, that's a bit harder to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another would be to define a &lt;a href=&quot;http://php.net/manual/en/language.variables.scope.php#language.variables.scope.static&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;static&lt;/code&gt;&lt;/a&gt; variable and only allow your code to call &lt;code&gt;saveUser&lt;/code&gt; once.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onSaveUser', function (Event $event)&#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;&#xA;        if ($user-&amp;gt;talentJobFamily-&amp;gt;value != '') {&#xA;            $user-&amp;gt;getContent()-&amp;gt;setAttributes([&#xA;                'talentStage' =&amp;gt; 'engage',&#xA;            ]);&#xA;&#xA;            static $recursionLevel = 0; // is set only once&#xA;&#xA;            if ($recursionLevel == 0) &#xA;            {&#xA;                $recursionLevel++; // saveUser only gets called once&#xA;                craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's also documented in my &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10482/handling-endless-recursion-in-saveentry&quot;&gt;original question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2015-12-05T21:53:10.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12734" PostTypeId="1" AcceptedAnswerId="12735" CreationDate="2015-12-05T22:35:47.643" Score="0" ViewCount="133" Body="&lt;p&gt;Currently I’m looping through some results on an athlete’s bio page to get their individual win/loss record… Something like &lt;code&gt;{% if matchWon is defined %}{% set wins = wins + 1 %}{% endif %}&lt;/code&gt; is looping in a table of their records. This works great, and will accumulate their record just fine, but what if I want to show the athlete’s record ​&lt;em&gt;​*before*​&lt;/em&gt;​ the table where all that logic is run? Any way to display those final win/loss values out earlier in the dom?&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-12-06T10:29:32.327" Title="Minor math in template, display result before logic in DOM" Tags="&lt;variable&gt;&lt;math&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12735" PostTypeId="2" ParentId="12734" CreationDate="2015-12-05T23:13:00.713" Score="3" Body="&lt;p&gt;Just do a &lt;code&gt;{% set myEntries = craft.entries.whatever.find() %}&lt;/code&gt; to load the entries into an array. Then do two loops, the first to get whatever totals you want, the second to display the players stats. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you're doing two loops. But you're only hitting the database once to load into the array, which is where the performance bottleneck will be unless there are a ton of entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, wrap it all in a cache tag. &lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-05T23:13:00.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12736" PostTypeId="1" AcceptedAnswerId="12737" CreationDate="2015-12-06T00:51:14.230" Score="2" ViewCount="3003" Body="&lt;p&gt;I would like to call an action method from within my plugin via ajax but I am always getting a 404 response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a controller method that matches the ajax url:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    'type': 'post',&#xA;    'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    'cache': false,&#xA;    'data': data,&#xA;    'url': 'pluginHandle/checkStatus',&#xA;    'dataType': 'json',&#xA;    'timeout': 50000&#xA;}).done(function (response) {&#xA;    // Success&#xA;}).fail(function (error) {&#xA;   // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;/**&#xA; * Checks what the current status is RIGHT. NOW.&#xA; *&#xA; * @throws HttpException&#xA; *&#xA; */&#xA;public function actionCheckStatus()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $response = [&#xA;        'status' =&amp;gt; 'open'&#xA;    ];&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2015-12-06T00:56:45.017" LastActivityDate="2018-06-01T20:02:01.957" Title="How can I call a controller method from the front-end using ajax" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12737" PostTypeId="2" ParentId="12736" CreationDate="2015-12-06T00:55:38.640" Score="4" Body="&lt;p&gt;Make sure to check out &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;the documentation&lt;/a&gt; on routing. Pay special attention to the part about action request(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, I want to call a controller method via ajax on page load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;/**&#xA; * Checks what the current status is RIGHT. NOW.&#xA; *&#xA; * @throws HttpException&#xA; *&#xA; */&#xA;public function actionCheckStatus()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $response = [&#xA;        'status' =&amp;gt; 'open'&#xA;    ];&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    'type': 'post',&#xA;    'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    'cache': false,&#xA;    'data': data,&#xA;    'url': '/actions/pluginHandle/checkStatus',&#xA;    'dataType': 'json',&#xA;    'timeout': 50000&#xA;}).done(function (response) {&#xA;    // Success&#xA;}).fail(function (error) {&#xA;   // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key part to note is the url attribute in the ajax request. It is prepended with 'actions'. As you will note in the docs you can change 'actions' to whatever you want.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-17T17:18:33.287" LastActivityDate="2016-01-17T17:18:33.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12739" PostTypeId="1" CreationDate="2015-12-06T14:48:11.857" Score="1" ViewCount="177" Body="&lt;p&gt;I'm a new user so I really don't know how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a template that displays the results of a &quot;news&quot; type entry in alternating rows - image on left/text on right - image on right/text on left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone help in explaining where to put the code and what the code should be?&lt;/p&gt;&#xA;" OwnerUserId="4453" LastEditorUserId="57" LastEditDate="2015-12-07T03:07:45.873" LastActivityDate="2015-12-07T03:07:45.873" Title="How do you create an alternating layout in a template? i.e. an image on right then an image on left" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12740" PostTypeId="2" ParentId="12739" CreationDate="2015-12-06T18:10:56.633" Score="3" Body="&lt;p&gt;Personally I'd do this in pure CSS. e.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;    &amp;lt;img ... /&amp;gt;&#xA;    &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;        ...&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;    &amp;lt;img ... /&amp;gt;&#xA;    &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;        ...&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.item {&#xA;    overflow: hidden; // expand around floated children&#xA;}&#xA;img {&#xA;    float: left; width: 50%;&#xA;}&#xA;.text {&#xA;    float: right; width: 50%;&#xA;}&#xA;&#xA;.item:nth-of-type(2n) img {&#xA;    float: right;&#xA;}&#xA;.item:nth-of-type(2n) .text {&#xA;    float: left;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-06T18:10:56.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12741" PostTypeId="1" CreationDate="2015-12-06T18:43:49.187" Score="2" ViewCount="603" Body="&lt;p&gt;How is one to achieve the layout visualised by Craft's drop-left and drop-right icons? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://craftcms.com/assets/images/docs/field-types/position-select/_383xAUTO_crop_center-center/position-select-settings.2x.png&quot; alt=&quot;Craft's Position Select icons&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel dumb asking but I don't know of any way to have a &lt;strong&gt;floated image&lt;/strong&gt; stick to the &lt;strong&gt;bottom&lt;/strong&gt; of its sibling text node with text running around it &lt;strong&gt;above and to the side&lt;/strong&gt;, which is what is implied by the icons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I been missing all these years?!&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="45" LastEditDate="2015-12-06T23:44:26.773" LastActivityDate="2015-12-06T23:44:26.773" Title="How does one achieve drop-left or drop-right image position?" Tags="&lt;css&gt;&lt;position&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12742" PostTypeId="1" CreationDate="2015-12-06T19:54:50.030" Score="0" ViewCount="538" Body="&lt;p&gt;I have been using the &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;FormBuilder2&lt;/a&gt; plugin and it's fantastic. I am trying to understand if there is anyway that I can send an automatic email to the form submitter using this plugin. There is a possibility to insert a fixed email address in the plugin setting but this, of course, doesn't answer my need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated a lot!&lt;/p&gt;&#xA;" OwnerUserId="3777" LastEditorUserId="57" LastEditDate="2015-12-07T03:11:52.070" LastActivityDate="2016-01-06T16:11:10.613" Title="FormBuilder 2 - Notification email to the form submitter" Tags="&lt;plugins&gt;&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12743" PostTypeId="2" ParentId="12741" CreationDate="2015-12-06T20:54:54.013" Score="2" Body="&lt;p&gt;Generally, I'll have a div that picks up on the position's value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;image-{{ entry.myPositionHandle }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;my-image.jpg&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That renders something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;image-left&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;my-image.jpg&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I'll have a css rule like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.image-left img {&#xA;    float:left;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's also important to note where you place this element in relation to your text. You many need to put the image call before or after your text.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-06T20:54:54.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12745" PostTypeId="1" AcceptedAnswerId="12746" CreationDate="2015-12-07T04:22:36.493" Score="4" ViewCount="781" Body="&lt;p&gt;Unfortunately I tried to (auto)upgrade to v2.5.latest on a live site (after testing on another development (but different site)) and it failed resulting in the site being down. What is the best way to restore the site to pre-upgrade and working state? I plan to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remove the existing database and replace with the one created by the&#xA;backup process - that part seemed to go OK. &lt;/li&gt;&#xA;&lt;li&gt;Replace the /craft/app directory from the version that matches the database backup.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there other files/things I need to do to recover the situation?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2016-07-28T08:16:39.120" Title="Upgrade failed - what needs to be restored?" Tags="&lt;auto-updates&gt;&lt;updating&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12746" PostTypeId="2" ParentId="12745" CreationDate="2015-12-07T04:53:05.103" Score="3" Body="&lt;p&gt;That should do it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Auto-updating to 2.5 is causing a few people headaches, mainly because people are &lt;strong&gt;bumping up against their &lt;code&gt;php.ini&lt;/code&gt; setting limitations&lt;/strong&gt;. It's a pretty significant update, requiring pretty significant server resources to handle the transition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've successfully rolled back, I'd recommend performing a &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow&quot;&gt;manual update&lt;/a&gt;. This takes a lot of pressure off of your server, and only leans on your server resources to run the database migrations (which definitely shouldn't cause any overloads).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-07T04:53:05.103" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12749" PostTypeId="2" ParentId="12742" CreationDate="2015-12-07T11:37:08.047" Score="1" Body="&lt;p&gt;You could use the also wonderful &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow&quot;&gt;amforms&lt;/a&gt;, which has this standard built in. The only thing is that it will send an exact copy of the admin mail. If you need a custom submitter mail, my guess is that sproutforms + sprout email is the best solution (you'll need them both).&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2015-12-07T11:37:08.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12750" PostTypeId="1" CreationDate="2015-12-07T11:41:53.827" Score="0" ViewCount="441" Body="&lt;p&gt;We have a Sprout Forms form being used for gated content access. The form appears to work correctly but none of the entries are appearing in the database/CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example URL with the form: &lt;a href=&quot;http://thisisbeyond.co.uk/blog/feel-good-brands-report-2015/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://thisisbeyond.co.uk/blog/feel-good-brands-report-2015/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a CMS screenshot of the form settings.&lt;a href=&quot;https://i.stack.imgur.com/HwBnk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HwBnk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the template code we are using to generate the form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('message') == 'success' %}&#xA;&#xA;&amp;lt;div class=&quot;alert alert-success&quot; role=&quot;alert&quot;&amp;gt;Thank you for your message, we'll get back to you as soon as possible.&amp;lt;/div&amp;gt;&#xA;&#xA;{% else %}&#xA;&#xA;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;{% for error in errors %}&#xA;&amp;lt;span class=&quot;label label-alert&quot;&amp;gt;{{ error }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;{% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;gatedForm&quot;&amp;gt;&#xA;{% set gated = entry.gatedDocument.first() %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ gated.url }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;fields-fullName&quot;&amp;gt;Full Name *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[fullName]&quot; id=&quot;fields-fullName&quot; class=&quot;form-control&quot; value=&quot;{% if gatedForm.fullName is defined %}{{ gatedForm.fullName }}{% endif %}&quot; required/&amp;gt;&#xA;    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('fullName')) }}{% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;fields-companyName&quot;&amp;gt;Company Name *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[companyName]&quot; id=&quot;fields-companyName&quot; class=&quot;form-control&quot; value=&quot;{% if gatedForm.companyName is defined %}{{ gatedForm.companyName }}{% endif %}&quot; required/&amp;gt;&#xA;    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('companyName')) }}{% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;fields-email&quot;&amp;gt;Email *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[email]&quot; id=&quot;fields-email&quot; class=&quot;form-control&quot; value=&quot;{% if gatedForm.email is defined %}{{ gatedForm.email }}{% endif %}&quot; required/&amp;gt;&#xA;    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('email')) }}{% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: re-installing the Sprout Invisible Captcha plugin and including the following line before the closing  tag got it working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutInvisibleCaptcha.protect() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4095" LastEditorUserId="4095" LastEditDate="2015-12-07T17:13:27.983" LastActivityDate="2015-12-08T09:23:02.977" Title="Sprout Form Not Saving Entries" Tags="&lt;entries&gt;&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12753" PostTypeId="1" AcceptedAnswerId="12755" CreationDate="2015-12-07T15:21:14.097" Score="1" ViewCount="186" Body="&lt;p&gt;My index.html endpoint in the templates folder looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% header &quot;Content-Type: application/json&quot; %}&#xA;    {% set basics = craft.entries.section('basics').find('') %}&#xA;    {{ basics | json_expand | raw  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did enable the fields and put some localized strings inside,&#xA;still json returns this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA; {&#xA;&quot;id&quot;: &quot;261&quot;,&#xA;&quot;enabled&quot;: &quot;1&quot;,&#xA;&quot;archived&quot;: &quot;0&quot;,&#xA;&quot;locale&quot;: &quot;de&quot;,&#xA;&quot;localeEnabled&quot;: &quot;1&quot;,&#xA;&quot;slug&quot;: &quot;wimpern-richtig-tuschen&quot;,&#xA;&quot;uri&quot;: null,&#xA;&quot;dateCreated&quot;: {&#xA;  &quot;date&quot;: &quot;2015-11-26 12:08:01&quot;,&#xA;  &quot;timezone_type&quot;: 3,&#xA;  &quot;timezone&quot;: &quot;UTC&quot;&#xA;},&#xA;&quot;dateUpdated&quot;: {&#xA;  &quot;date&quot;: &quot;2015-12-07 15:03:51&quot;,&#xA;  &quot;timezone_type&quot;: 3,&#xA;  &quot;timezone&quot;: &quot;UTC&quot;&#xA;},&#xA;&quot;root&quot;: null,&#xA;&quot;lft&quot;: null,&#xA;&quot;rgt&quot;: null,&#xA;&quot;level&quot;: null,&#xA;&quot;sectionId&quot;: &quot;7&quot;,&#xA;&quot;typeId&quot;: &quot;9&quot;,&#xA;&quot;authorId&quot;: &quot;153&quot;,&#xA;&quot;postDate&quot;: {&#xA;  &quot;date&quot;: &quot;2015-11-26 12:08:00&quot;,&#xA;  &quot;timezone_type&quot;: 3,&#xA;  &quot;timezone&quot;: &quot;UTC&quot;&#xA;},&#xA;&quot;expiryDate&quot;: null,&#xA;&quot;parentId&quot;: null,&#xA;&quot;revisionNotes&quot;: null,&#xA;&quot;title&quot;: &quot;Wimpern richtig tuschen&quot;,&#xA;&quot;basics_text&quot;: &quot;Wimpern richtig tuschen&quot;, (etc...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is there a way to make an endpoint just for the english version, like basics_en ? Is there even any way to get the localized data using this method? The CMS is for a mobile-app, so i just need the raw data from the endpoint.&lt;/p&gt;&#xA;" OwnerUserId="4297" LastEditorUserId="125" LastEditDate="2016-01-09T17:15:37.930" LastActivityDate="2016-01-09T17:15:37.930" Title="How can i get API-Response that includes localized data using json_expand?" Tags="&lt;localization&gt;&lt;json&gt;&lt;plugin-jsonexpand&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12754" PostTypeId="2" ParentId="12742" CreationDate="2015-12-07T15:36:57.627" Score="1" Body="&lt;p&gt;Sprout Email is designed to be extensible by other plugins. One reason we have kept it separate from Sprout Forms is so that users could have the option to manage all of their email in one place, regardless of which plugins they need to manage email for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin developers can extend their plugins to support Sprout Email, additionally, you can write your own custom plugin to add support for another plugin too.  For example, Sprout Email extends itself in this way to add support for several Craft Events. (You can see these examples in the &lt;code&gt;sproutforms/integrations&lt;/code&gt; folder.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like FormBuilder2 has an &lt;code&gt;onBeforeSave&lt;/code&gt; Event that you could write a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events&quot; rel=&quot;nofollow&quot;&gt;Sprout Email Custom Event&lt;/a&gt; to support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your coding skills or preferences, that might not be ideal, so it may be worth petitioning FormBuilder2 to add support for Sprout Email itself or add an &lt;code&gt;onSave&lt;/code&gt; event that would ensure your Form Entry was saved before triggering any email. This could at least give you complete control over your email in the short run until FormBuilder2 added additional support for what you need down the road, or it could give you a way to manage your email notification needs all in one place.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-12-07T15:36:57.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12755" PostTypeId="2" ParentId="12753" CreationDate="2015-12-07T15:39:06.647" Score="1" Body="&lt;p&gt;It was pretty easy :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;{% set basics = craft.entries.section('basics').locale('en').find('') %}&#xA;{{ basics | json_expand | raw  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;all it needed was: &lt;code&gt;.locale('en')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4297" LastEditorUserId="57" LastEditDate="2015-12-07T18:52:32.473" LastActivityDate="2015-12-07T18:52:32.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12756" PostTypeId="1" CreationDate="2015-12-07T16:17:15.720" Score="6" ViewCount="407" Body="&lt;p&gt;Since imageResizable was deprecated for some apparent reason which I have no idea why they would do that. Does anyone know of a workaround or a plugin/config setting to enable this again?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="57" LastEditDate="2015-12-07T18:54:24.010" LastActivityDate="2015-12-07T18:54:24.010" Title="Any workarounds for image resizing in Craft 2.5 Redactor II?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;assets&gt;&lt;redactor&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12757" PostTypeId="1" AcceptedAnswerId="12857" CreationDate="2015-12-07T16:32:38.680" Score="1" ViewCount="593" Body="&lt;p&gt;My problem is that I don't know/understand how to sort complex arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a multi dimensional array of users from an external API. So it's not an array that I fetch from the Craft database. Let's call this array the &quot;Main Array&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Main Array contains multiple users, every user has multiple fields such as firstname, lastname, department, and so on. So every user in the Main Array is actually another array that we shall call a User Array. So the Main Array consists of multiple User arrays which consists of multiple fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I group the Main array by the department field of a user (using the Twig group filter). So far so good, that way I can list all my users in department blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But within those blocks, I want them to be alphabetically sorted by their lastname. So I need a way to let Craft know to sort my User Arrays by the lastname field of a user within the Main Array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems logical and simple, but I can't figure out how. I tried SuperSort, but the standard asort function won't work. I than tried superSort('SortAs', '{lastnameField}') but that didn't work either.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-12-14T11:08:13.257" Title="Sorting multi-dimensional grouped arrays" Tags="&lt;sorting&gt;&lt;array&gt;&lt;plugin-supersort&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12758" PostTypeId="2" ParentId="12756" CreationDate="2015-12-07T17:07:37.060" Score="2" Body="&lt;p&gt;The only really workable solution I've found is to downgrade Redactor. Fortunately Pixel &amp;amp; Tonic have made this fairly painless with a plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/RedactorI&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/RedactorI&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2015-12-07T17:07:37.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12759" PostTypeId="2" ParentId="12757" CreationDate="2015-12-07T21:43:51.310" Score="1" Body="&lt;p&gt;It's a bit hard to help as you didn't provide any code. But I suggest to apply the &lt;code&gt;supersort&lt;/code&gt; filter before grouping by the department property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set usersSorted = users|supersort('sortAs', '{{ object.lastname }}') %}&#xA;{% set usersGrouped = usersSorted|group('department') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-07T21:43:51.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12760" PostTypeId="2" ParentId="12647" CreationDate="2015-12-07T21:59:15.203" Score="4" Body="&lt;p&gt;The fix is in!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/news/running-redactor-i-in-craft-2-5&quot; rel=&quot;nofollow&quot;&gt;Running Redactor “I” in Craft 2.5&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just used this on one of my problem upgrades and it worked seamlessly - now they get to be in on the 2.5 party too :)&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2015-12-07T21:59:15.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12761" PostTypeId="2" ParentId="11686" CreationDate="2015-12-07T22:47:48.783" Score="5" Body="&lt;p&gt;This isn't exactly an answer, but more of an extension of Brad's answer. &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#status&quot; rel=&quot;noreferrer&quot;&gt;The docs&lt;/a&gt; define what an entries status can be. So as Brad was saying the status itself cannot be set, but: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the entry is enabled + has valid post date + has not expired = status is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found your post because I was also setting &lt;code&gt;enabled-&amp;gt;true&lt;/code&gt; but my entry was not getting set to &lt;code&gt;enabled&lt;/code&gt;. Then I realize...make sure you save the entry after you have updated it's status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I wanted to get all entries related to an authorId. So here's what it looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'my-section-handle';&#xA;$criteria-&amp;gt;authorId = $user-&amp;gt;id;&#xA;$criteria-&amp;gt;status = null;  // status is null to find all entries regardless of status&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;if ($entries) {&#xA;    foreach ($entries as $entry) {&#xA;        $entry-&amp;gt;enabled = true;&#xA;&#xA;        if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;            // Entry updated &amp;amp; saved.&#xA;        } else {&#xA;            // Could not save entry.&#xA;        }&#xA;    }&#xA;} else {&#xA;    // No entry found for that user.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-07T22:47:48.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12762" PostTypeId="1" AcceptedAnswerId="12770" CreationDate="2015-12-08T00:06:59.867" Score="1" ViewCount="994" Body="&lt;p&gt;Wondering if I can get user &lt;code&gt;groups&lt;/code&gt; directly after retrieving the user via &lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserById($id)&lt;/code&gt;, or if i need to use &lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;getGroupsByUserId($id)&lt;/code&gt; also?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of right now, I'm looping through many users and want to check if they are in a specific group. A rough idea of what I'm looking at now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get user (necessary for rest of plugin)&#xA;$user = craft()-&amp;gt;users-&amp;gt;getUserById( $uid );&#xA;&#xA;// get user groups&#xA;$user_groups = craft()-&amp;gt;userGroups-&amp;gt;getGroupsByUserId( $uid );&#xA;&#xA;// check if user is in group&#xA;if( in_array(&quot;Group_Name&quot;, $user_groups) )&#xA;{&#xA;   // do something&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but when looping through a ton of users, I imagine it would be silly not to first check that I can already get this information from the &lt;code&gt;$user&lt;/code&gt; variable I created. I can't seem to find the answer via documentation. Hoping to get a confirmation from someone!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-12-08T09:35:46.280" Title="Get Groups from User in plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;php&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12763" PostTypeId="1" AcceptedAnswerId="12777" CreationDate="2015-12-08T06:38:11.023" Score="3" ViewCount="116" Body="&lt;p&gt;When uninstalling my plugin, only one table is removed. Two others are left behind.  Any suggestions what I'm doing wrong?  Could it be naming with and without the underscore?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Calendar37Record extends BaseRecord&#xA;{&#xA;    public function getTableName() {&#xA;        return 'calendar37';&#xA;    }&#xA;    protected function defineAttributes() { &#xA;        return array(&#xA;            'event_id'   =&amp;gt; AttributeType::Number,&#xA;            'dateYmd'    =&amp;gt; AttributeType::String,&#xA;            'timestr'    =&amp;gt; AttributeType::String,&#xA;            'alt_text'   =&amp;gt; AttributeType::String,&#xA;            'css_class'  =&amp;gt; AttributeType::String,&#xA;            'userJson'   =&amp;gt; AttributeType::String,&#xA;        );&#xA;    }&#xA;    public function defineIndexes() {&#xA;        return array(&#xA;            array('columns' =&amp;gt; array('event_id', 'dateYmd'), 'key' =&amp;gt; true),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the bad:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Calendar37_SubsetsRecord extends BaseRecord&#xA;{&#xA;    public function getTableName() {&#xA;        return 'calendar37_Subsets';&#xA;    }&#xA;    protected function defineAttributes() { &#xA;        return array(&#xA;            'handle'              =&amp;gt; AttributeType::String,&#xA;            'title'               =&amp;gt; AttributeType::String,&#xA;            'categoriesToInclude' =&amp;gt; AttributeType::String,&#xA;            'categoriesToExclude' =&amp;gt; AttributeType::String,&#xA;            );&#xA;    }&#xA;    public function defineIndexes() {&#xA;        return array(&#xA;            array('columns' =&amp;gt; array('handle'), 'unique' =&amp;gt; true),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Bad #2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Calendar37_ViewsRecord extends BaseRecord&#xA;{&#xA;    public function getTableName() {&#xA;        return 'calendar37_Views';&#xA;    }&#xA;    protected function defineAttributes() { &#xA;        return array(&#xA;            'subsetId'     =&amp;gt; AttributeType::String,&#xA;            'startDateYmd' =&amp;gt; AttributeType::String,&#xA;            'endDateYmd'   =&amp;gt; AttributeType::String,&#xA;            'htmlBefore'   =&amp;gt; array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text, 'required' =&amp;gt; false),&#xA;            'htmlAfter'    =&amp;gt; array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text, 'required' =&amp;gt; false),&#xA;        );&#xA;    }&#xA;    public function defineIndexes() {&#xA;        return array(&#xA;            array('columns' =&amp;gt; array('subsetId', 'startDateYmd' ), 'key' =&amp;gt; true),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-12-08T18:37:54.843" Title="Plugin uninstall only removes one table" Tags="&lt;plugin-development&gt;&lt;records&gt;&lt;uninstall&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12764" PostTypeId="2" ParentId="12763" CreationDate="2015-12-08T07:40:33.723" Score="1" Body="&lt;p&gt;This is a little bit speculative, so let me know if it turns out to be incorrect...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you use a &lt;strong&gt;non-underscored&lt;/strong&gt; Record name, you're telling Craft that this is the one-and-only, definitive Record. When you use an &lt;strong&gt;underscored&lt;/strong&gt; Record name, you're telling Craft that this Record is one-of-many. I have a vague recollection of similar behavior with Variables or Controllers too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hard to say if that would be considered a &quot;bug&quot; or a &quot;feature&quot;. Pixel &amp;amp; Tonic may have a sound reason why that restriction exists.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-08T07:40:33.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12765" PostTypeId="1" AcceptedAnswerId="12766" CreationDate="2015-12-08T07:51:33.893" Score="2" ViewCount="912" Body="&lt;p&gt;I am trying to replace the text-based buttons in Redactor 2 with graphical ones as per this article on the imperavi website:&#xA;&lt;a href=&quot;https://imperavi.com/redactor/examples/buttons-default-icons/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/examples/buttons-default-icons/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a simple plugin loading a JS file (a copy and paste of the JS on the page above) and a CSS file (fontawesome.min.css). These two files and the fonts are in the &lt;code&gt;resources/&lt;/code&gt; folder of the plugin. Example of plugin file in this post: &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a-plugin-add-js-or-css-to-the-control-panel&quot;&gt;Can a plugin add JS or CSS to the control panel?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything seems to work fine: CSS file loaded in the head and JS file loaded right before the &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the JS loaded by my plugin comes &lt;em&gt;before&lt;/em&gt; the main JS redactor file. Console barfs an error at me for trying to work with &lt;code&gt;$.Redactor.prototype&lt;/code&gt;, which obviously does not exists yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way for my plugin to load the JS file at the end of the JS queue or at least after the main redactor JS file ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Carl's advises below, I managed to get it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the approach is to create a &lt;code&gt;RedactorPlugins&lt;/code&gt; object and populate it with what you need so it is available for redactor when it runs afterwards. The plugin you create that way can be used in your redactor config files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!RedactorPlugins) var RedactorPlugins = {};&#xA;&#xA;RedactorPlugins.iconbuttons = function()&#xA;{&#xA;  return {&#xA;      init: function ()&#xA;      {&#xA;          var icons = {&#xA;              'format': '&amp;lt;i class=&quot;fa fa-paragraph&quot;&amp;gt;&amp;lt;/i&amp;gt;',&#xA;              'lists': '&amp;lt;i class=&quot;fa fa-list&quot;&amp;gt;&amp;lt;/i&amp;gt;',&#xA;              'horizontalrule': '&amp;lt;i class=&quot;fa fa-minus&quot;&amp;gt;&amp;lt;/i&amp;gt;',&#xA;              'image': '&amp;lt;i class=&quot;fa fa-picture-o&quot;&amp;gt;&amp;lt;/i&amp;gt;',&#xA;              'link': '&amp;lt;i class=&quot;fa fa-link&quot;&amp;gt;&amp;lt;/i&amp;gt;'&#xA;          };&#xA;&#xA;          $.each(this.button.all(), $.proxy(function(i,s)&#xA;          {&#xA;              var key = $(s).attr('rel');&#xA;&#xA;              if (typeof icons[key] !== 'undefined')&#xA;              {&#xA;                  var icon = icons[key];&#xA;                  var button = this.button.get(key);&#xA;                  alert(key + &quot; - &quot; + button + &quot; - &quot; + icon);&#xA;                  this.button.setIcon(button, icon);&#xA;              }&#xA;&#xA;          }, this));&#xA;      }&#xA;  };&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have created a plugin loading this JS file and the CSS you need, you can tell Redactor to use that plugin in your redactor config files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;plugins&quot;: [ &quot;iconbuttons&quot;, &quot;source&quot; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will probably abandon this altogether and roll with the default text-based version of redactor 2. It looks like this approach does not work with some buttons where Craft has to do some work. It seems that when the &lt;code&gt;replaceRedactorButton&lt;/code&gt; function in &lt;code&gt;craft/app/resources/js/RichTextInput.js&lt;/code&gt; is run, it removes buttons customisation.&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-07-10T11:13:48.457" Title="Switch to graphical buttons in Redactor 2" Tags="&lt;plugins&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12766" PostTypeId="2" ParentId="12765" CreationDate="2015-12-08T08:30:57.103" Score="4" Body="&lt;p&gt;You could use my plugin &lt;a href=&quot;https://github.com/carlcs/craft-redactoriconbuttons&quot; rel=&quot;nofollow&quot;&gt;Redactor Icon Buttons&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It includes the icons from the (old) Redactor 10 editor and you can map icons to buttons via a &lt;code&gt;iconMapping&lt;/code&gt; config setting. It also allows to use a custom icon set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still want to write your own plugin, have a look at the source code of P&amp;amp;T’s &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips/blob/master/redactorclips/resources/clips.js&quot; rel=&quot;nofollow&quot;&gt;Redactor Clips&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-07-10T11:13:48.457" LastActivityDate="2016-07-10T11:13:48.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12767" PostTypeId="1" CreationDate="2015-12-08T08:50:23.367" Score="1" ViewCount="923" Body="&lt;p&gt;I am using a Matrix field for content blocks like heading, text, images, ... similar to the HappyLager demo site. Now I would like to combine this with common CSS grid systems (e.g. from Bootstrap, Foundation, ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically they need to wrap rows in a &lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/code&gt; and columns in e.g. a &lt;code&gt;&amp;lt;div class=&quot;column-4&quot;&amp;gt;&lt;/code&gt;. The easiest way would be to provide dummy matrix blocks for opening rows and columns (with a radio-button field to specify column with) and blocks for their corresponding closing tags. But of course the user should not forget to close the blocks otherwise the layout breaks. Is there a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="133" LastEditorUserId="57" LastEditDate="2015-12-08T18:24:52.183" LastActivityDate="2016-03-21T22:11:49.457" Title="What are best practices for using Matrix fields to establish a grid layout" Tags="&lt;matrix&gt;&lt;css&gt;&lt;layout&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12768" PostTypeId="2" ParentId="12767" CreationDate="2015-12-08T09:22:02.423" Score="1" Body="&lt;p&gt;You could use the approach you already suggested, but combine it with a grid that doesn't require to close rows, but automatically wrap into the next row if there's not enough space left. There's two common ways to achieve such a grid cell behavior, inline-blocks and flexbox with flex-wrap set to wrap.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-12-08T11:01:01.467" LastActivityDate="2015-12-08T11:01:01.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12769" PostTypeId="2" ParentId="12750" CreationDate="2015-12-08T09:23:02.977" Score="4" Body="&lt;p&gt;Re-installing the Sprout Invisible Captcha plugin and including the following line before the closing tag got it working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutInvisibleCaptcha.protect() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4095" LastActivityDate="2015-12-08T09:23:02.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12770" PostTypeId="2" ParentId="12762" CreationDate="2015-12-08T09:35:46.280" Score="4" Body="&lt;p&gt;Your code to get a user returns a &lt;code&gt;UserModel&lt;/code&gt; (as can be seen from the &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#getUserById-detail&quot; rel=&quot;nofollow&quot;&gt;Full Class Reference docs&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById($id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then get the user groups the &lt;code&gt;$user&lt;/code&gt; is a member of using&lt;code&gt;getGroups()&lt;/code&gt;(&lt;a href=&quot;https://craftcms.com/classreference/models/UserModel#getGroups-detail&quot; rel=&quot;nofollow&quot;&gt;from the &lt;code&gt;UserModel&lt;/code&gt; class)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user_groups = $user-&amp;gt;getGroups();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-08T09:35:46.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12771" PostTypeId="1" AcceptedAnswerId="12773" CreationDate="2015-12-08T11:34:47.823" Score="0" ViewCount="45" Body="&lt;p&gt;Is there a way to have auto selected a category when an editor creates a new section entry in the admin?&#xA;Kinda like a pre-filled field?&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2015-12-08T11:46:54.103" LastActivityDate="2015-12-08T14:55:40.450" Title="Have auto selected categories with new section entry" Tags="&lt;category&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12772" PostTypeId="1" AcceptedAnswerId="12775" CreationDate="2015-12-08T13:46:23.130" Score="0" ViewCount="472" Body="&lt;p&gt;Afternoon all - odd issue where created some new asset folders and adding new files is timing out. If I view the folder in question (on the server) I can see the file has been successfully uploaded but this isn’t reflected in the back-end. Craft 2.4. Console Log is returning a POST &lt;code&gt;/admin/actions/assets/uploadFile 500 (Internal Server Error)&lt;/code&gt; response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checking the craft logs it is throwing a &lt;code&gt;Duplicate entry '3996' for key 'PRIMARY'&lt;/code&gt; error in the &lt;code&gt;craft_assetfiles&lt;/code&gt; table. It looks like somewhere between builds/deployments the &lt;code&gt;craft_assetfiles&lt;/code&gt; table has got out of sync. I've tried updating the Asset and Search indexes but with no success. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on debugging or resolving?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-08T16:28:18.883" Title="500 error: uploading files (duplicate primary key)" Tags="&lt;assets&gt;&lt;upload&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12773" PostTypeId="2" ParentId="12771" CreationDate="2015-12-08T14:55:40.450" Score="2" Body="&lt;p&gt;That functionality doesn't currently exist out-of-the-box (as of 2.5.2752), but it would be possible as a custom development: You'd essentially need to create a clone of the Categories fieldtype, add your own config/setting to select the default categories, and then use the &lt;code&gt;prepValue()&lt;/code&gt; method of the fieldtype to pre-select those default categories for new entries.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2015-12-08T14:55:40.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12774" PostTypeId="2" ParentId="12720" CreationDate="2015-12-08T14:57:19.590" Score="1" Body="&lt;p&gt;There is a better way! Pixel &amp;amp; Tonic has addressed this with the Redactor I plugin, available here: &lt;a href=&quot;https://craftcms.com/news/running-redactor-i-in-craft-2-5&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/news/running-redactor-i-in-craft-2-5&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This completely restores the previous content rendering and functionality (including image sizing/alignment and Live Preview).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand where Imperavi is coming from, championing for cleaner data, but it just wasn't part of this project's workflow. When I start my next project fresh, I'll be using Redactor II.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2015-12-08T14:57:19.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12775" PostTypeId="2" ParentId="12772" CreationDate="2015-12-08T16:28:18.883" Score="1" Body="&lt;p&gt;Okay - have managed to resolve this. Needed to reset the auto increment value in the &lt;code&gt;craft_elements&lt;/code&gt; to greater than the max(id) for the &lt;code&gt;craft_assetfiles&lt;/code&gt; - not sure how those got out of synch but that seems to have resolved it. Hallelujah!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-08T16:28:18.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12776" PostTypeId="1" AcceptedAnswerId="12779" CreationDate="2015-12-08T17:05:59.413" Score="0" ViewCount="1239" Body="&lt;p&gt;As I want to use two different Redactor plugins, &lt;code&gt;table.js&lt;/code&gt; and &lt;code&gt;properties.js&lt;/code&gt;, I decided to write a simple Craft Plugin to load the JS using &lt;code&gt;includeJsResouce&lt;/code&gt; in the &lt;code&gt;init()&lt;/code&gt; function, as so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init() {&#xA;&#xA;    if ( craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; craft()-&amp;gt;userSession-&amp;gt;isLoggedIn() )&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('myextensions/js/properties.js');&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('myextensions/js/table.js');&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I have found that these JS files are being loaded in the HTML &lt;em&gt;before&lt;/em&gt; the Redactor.js file, so I get a JS error in the console, as Redactor is undefined. [&lt;code&gt;Uncaught TypeError: Cannot read property 'prototype' of undefined&lt;/code&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to ensure that my plugin JS is loaded &lt;em&gt;after&lt;/em&gt; Redactor that does not entail hacking the core of Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The version of Craft I am using is the current, Craft Pro 2.5.2753.&lt;/p&gt;&#xA;" OwnerUserId="4354" LastActivityDate="2015-12-08T19:48:09.440" Title="Redactor extension plugin loading JS before Redactor.js" Tags="&lt;plugin-development&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12777" PostTypeId="2" ParentId="12763" CreationDate="2015-12-08T18:37:54.843" Score="2" Body="&lt;p&gt;Thanks for that tip, Lindsey, but here's what happened: I changed &lt;code&gt;calendar37&lt;/code&gt; to &lt;code&gt;calendar37_Occurrences&lt;/code&gt; and then all three tables wouldn't uninstall.  It turns out that the issue is having a capital letter after the underscore.  So it seems like an &quot;undocumented feature&quot; that you can make plugin tables persist after uninstall by including a capital letter after the underscore.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return 'calendar37_Subsets';&#xA;return 'calendar37_Views';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;needed to become:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return 'calendar37_subsets';&#xA;return 'calendar37_views';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2015-12-08T18:37:54.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12778" PostTypeId="1" AcceptedAnswerId="12784" CreationDate="2015-12-08T19:02:27.293" Score="2" ViewCount="226" Body="&lt;p&gt;I have set up the plugin's multi-environment configuration as outlined in &lt;a href=&quot;https://craftcms.stackexchange.com/a/2000/3584&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;config.php&lt;/code&gt; file for the plugin is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    // All&#xA;    '*' =&amp;gt; array(&#xA;    ),&#xA;&#xA;    // Development&#xA;    '.domain.dev' =&amp;gt; array(&#xA;        'apiKey' =&amp;gt; 'APIKEYDEVVALUE'&#xA;    ),&#xA;&#xA;    // Staging&#xA;    'dev.domain.com' =&amp;gt; array(&#xA;        'apiKey' =&amp;gt; 'APIKEYSTAGINGVALUE'&#xA;    ),&#xA;&#xA;    // Production&#xA;    'dev.domain.com' =&amp;gt; array(&#xA;        'apiKey' =&amp;gt; 'APIKEYPRODVALUE'&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But calling &lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('apiKey', 'pluginhandle')&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I &lt;code&gt;var_dump(craft()-&amp;gt;config)&lt;/code&gt; I can see that the config file for the plugin is loaded by craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?  Please let me know if I can provide any more useful info.&lt;/p&gt;&#xA;" OwnerUserId="3584" LastActivityDate="2015-12-09T01:26:33.517" Title="Plugin Multi-Environment config not working" Tags="&lt;plugin-development&gt;&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12779" PostTypeId="2" ParentId="12776" CreationDate="2015-12-08T19:48:09.440" Score="1" Body="&lt;p&gt;You need to alter your &lt;code&gt;properties.js&lt;/code&gt; and &lt;code&gt;table.js&lt;/code&gt; files. Instead of assigning the plugin function to &lt;code&gt;$.Redactor.prototype&lt;/code&gt; you should assign it to the &lt;code&gt;RedactorPlugins&lt;/code&gt; object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard Redactor Plugin setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.Redactor.prototype.myplugin = function() {&#xA;    return {&#xA;    // Plugin code here...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft CMS Redactor Plugin setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Initialize the RedactorPlugins object if it doesn't exist&#xA;if ( !RedactorPlugins ) { var RedactorPlugins = {}; }&#xA;&#xA;// Assign the redactor plugin function&#xA;RedactorPlugins.myplugin = function() {&#xA;    return {&#xA;    // Plugin code here...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where the documentation on this is, but you can see it in Pixel &amp;amp; Tonic's own RedactorClips plugin here:  &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips/blob/master/redactorclips/RedactorClipsPlugin.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/RedactorClips/blob/master/redactorclips/RedactorClipsPlugin.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4459" LastActivityDate="2015-12-08T19:48:09.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12780" PostTypeId="1" AcceptedAnswerId="12781" CreationDate="2015-12-08T22:36:45.497" Score="9" ViewCount="2211" Body="&lt;p&gt;I have a structure &lt;code&gt;people&lt;/code&gt; that I need to grab entries from. However, I need to exclude certain entries as some are already displayed on the page in a different manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that you can exclude a single entry by doing something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for councilMember in craft.entries.section('people').id('not ' ~ entry.id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do you exclude multiple entries by their IDs?&lt;/p&gt;&#xA;" OwnerUserId="44" LastActivityDate="2020-10-13T17:44:31.077" Title="Exclude multiple entries by their IDs" Tags="&lt;entries&gt;&lt;entry&gt;&lt;templating&gt;&lt;id&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12781" PostTypeId="2" ParentId="12780" CreationDate="2015-12-08T22:36:45.497" Score="10" Body="&lt;p&gt;In my case I have a set number of chosen entries to exclude so I'll show how to do that first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Build array of chosen council leaders to exclude from council member list since they're already being displayed by using the &quot;merge&quot; Twig filter #}&#xA;{% set idsToExclude = ['and'] %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beginning the array with &lt;code&gt;'and'&lt;/code&gt; is the trick here. Without it this won't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set idsToExclude = idsToExclude|merge([entry.metropolisCouncilPresident.first.id]) %}&#xA;{% set idsToExclude = idsToExclude|merge([entry.metropolisCouncilVicePresident.first.id]) %}&#xA;{% set idsToExclude = idsToExclude|merge([entry.metropolisCouncilSecretary.first.id]) %}&#xA;{% set idsToExclude = idsToExclude|merge([entry.metropolisCouncilTreasurer.first.id]) %}&#xA;&#xA;{# Convert the idsToExclude array into a comma separated list #}&#xA;{% set idsToExcludeString = idsToExclude|join(', not ') %}&#xA;&#xA;{# Echo out the council members without displaying the featured ones #}&#xA;{% for councilMember in peopleEntries.id(idsToExcludeString) %}&#xA;  {{ councilMember.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say you want to exclude entries that you've choosen in a entry field. So there's multiple related entries and you've already looped over them to display them on the page but you want to ensure that they aren't displayed later on the page when you list all the entries out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;It's fairly similar to the above code but just for the sake of clarity.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Base array of chosen council members to exclude from council member list since they're already being displayed #}&#xA;{% set idsToExclude = ['and'] %} &#xA;&#xA;{% for item in entry.featuredCouncilMembers %}&#xA;  {{ entry.title }}&#xA;&#xA;  {# Build array of chosen council leaders to exclude from council member list since they're already being displayed by using the &quot;merge&quot; Twig filter #}&#xA;  {% set idsToExclude = idsToExclude|merge([item.id]) %}&#xA;{% endfor %}&#xA;&#xA;{# Convert the idsToExclude array into a comma separated list #}&#xA;{% set idsToExcludeString = idsToExclude|join(', not ') %}&#xA;&#xA;{# Echo out the council members without displaying the featured ones #}&#xA;{% for councilMember in peopleEntries.id(idsToExcludeString) %}&#xA;  {{ councilMember.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="44" LastActivityDate="2015-12-08T22:36:45.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12782" PostTypeId="2" ParentId="12767" CreationDate="2015-12-08T23:45:03.307" Score="2" Body="&lt;p&gt;Easiest way I can think of is just to use some math. If your grid columns need to add to 12, keep a current column count while iterating over the matrix blocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd imagine you'd want your content blocks have some sort of built-in &quot;column&quot; width to begin with... a text content block might be 8 columns and an image would be 4. Or 6 and 6. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the current block + the previous block adds to over 12, close the current row and start a new row.  Practically speaking, the actual column count doesn't really matter to a user, it's creating a specific layout... whether that's 8 + 4 or 6 + 6, etc. The grid is kind of a formality, really, to keep everything sane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd probably have to look ahead and see what the next block or 2 look like to get an idea of your column count or to adjust it to make sure the user isn't putting in 2 images or 2 half blocks, for example. If they are, then the image could automatically start its own row or something. If you're feeling ambitious, the last one in the row could take up more or less space, depending on how you want the layout to look.  IIRC I think that's how the Happy Lager site does it, if you put two images next to each other, they adjust a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've experimented a bit with this as well. If you're trying to save the user from himself, it's pretty rare you want to have an arbitrary sized text block... like 2 columns or whatever. I can see where you might want to have a pull quote or something that might take up that size, so define that instead.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-12-08T23:50:43.303" LastActivityDate="2015-12-08T23:50:43.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12783" PostTypeId="2" ParentId="10888" CreationDate="2015-12-09T00:20:53.803" Score="0" Body="&lt;p&gt;I had this error. Changing the allow_max_packet did not work. Turns out it was my general.db file. I have it set up for a multi-environment config. This is what fixed it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    '*' =&amp;gt; array(&#xA;         'defaultImageQuality' =&amp;gt; 80,&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'defaultImageQuality' =&amp;gt; 80,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2015-12-09T00:20:53.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12784" PostTypeId="2" ParentId="12778" CreationDate="2015-12-09T01:26:33.517" Score="4" Body="&lt;p&gt;The issue is that you're putting the multi-environment config code in your &lt;code&gt;plugins/pluginHandle/config.php&lt;/code&gt; file, which is just meant to supply default plugin config values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users can set custom values in &lt;code&gt;craft/config/pluginHandle.php&lt;/code&gt; which is where the multi-environment logic would also go.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-09T01:26:33.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12785" PostTypeId="2" ParentId="12477" CreationDate="2015-12-09T05:05:34.023" Score="4" Body="&lt;p&gt;I think (well, I know) I am confused by where &quot;regular&quot; php is and where the ElementAPI takes over. This is returning me data, but I'm not sure if it's just dumb luck or I've actually got something working...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$slug = craft()-&amp;gt;request-&amp;gt;getRequiredPost('location');  // chicago&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'Locations';&#xA;$criteria-&amp;gt;slug = $slug;&#xA;&#xA;$locations = $category = $criteria-&amp;gt;find();&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'myfile.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'mysection',&#xA;                'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $locations],&#xA;            ],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-09T05:05:34.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12786" PostTypeId="2" ParentId="11174" CreationDate="2015-12-09T05:13:49.413" Score="3" Body="&lt;p&gt;I'm not sure if this helps, but here is how I (attempt) to manage deployments/installs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first create a user so I'm not using the root account. I tie that user to the apache user group. We'll call him 'user1'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use beanstalk to deploy, and the deployment credentials are for 'user1'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once all of the files have deployed for the first time, I'll log into the server via terminal, and &lt;code&gt;chown&lt;/code&gt; the project directory: &lt;code&gt;chown -R user1:apache&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I'll make sure everything has the correct permissions: &lt;code&gt;chmod -R 754 mysite.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I know that Craft needs to be able to write to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/craft/app&lt;/li&gt;&#xA;&lt;li&gt;/craft/config&lt;/li&gt;&#xA;&lt;li&gt;/craft/storage&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I will chmod those directories to 774. &lt;code&gt;chmod -R 774&lt;/code&gt;. Since 'user1' belongs to apache, it can read/write to the appropriate directories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-09T05:13:49.413" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12787" PostTypeId="2" ParentId="2629" CreationDate="2015-12-09T11:43:41.600" Score="3" Body="&lt;p&gt;In &lt;code&gt;Craft 2.5&lt;/code&gt; with &lt;code&gt;Contact Form 1.4&lt;/code&gt; I'm receiving the same error when using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if message is defined %}{{ message.contactTel }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've gotten around this by using the Craft Request method &lt;code&gt;getPost&lt;/code&gt; which can return a post value from an array. In the case of the original question, the following should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;fromCompany&quot;&amp;gt;Company:&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;fromCompany&quot; type=&quot;text&quot; name=&quot;message[fromCompany]&quot; value=&quot;{% if message is defined %}{{ craft.request.getPost('message.fromCompany') }}{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4118" LastEditorUserId="4118" LastEditDate="2015-12-09T21:42:22.300" LastActivityDate="2015-12-09T21:42:22.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12788" PostTypeId="1" AcceptedAnswerId="14786" CreationDate="2015-12-09T14:20:01.897" Score="7" ViewCount="446" Body="&lt;p&gt;Redactor 2 introduced a single &quot;lists&quot; option for ordered and unordered lists but unfortunately this adds the outdent and indent options in as well.&#xA;Any way of removing outdent/indent again?&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2016-04-25T12:07:49.260" Title="Remove outdent &amp; indent from Redactor2 &quot;lists&quot; button" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12789" PostTypeId="2" ParentId="12702" CreationDate="2015-12-09T15:41:03.117" Score="3" Body="&lt;p&gt;Have you tried?:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set upcoming = craft.entries.section('gigEntry').status('pending', 'live').gigDate('&amp;gt;= ' ~midnight) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-12-09T15:41:03.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12790" PostTypeId="1" AcceptedAnswerId="12792" CreationDate="2015-12-09T16:03:15.717" Score="1" ViewCount="466" Body="&lt;p&gt;I uploaded a working install of &lt;code&gt;Craft Pro 2.5.2754&lt;/code&gt; to a brand new Laravel Forge server and I'm having issues with the control panel. More precisely, it returns an error 500 when I try to access it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PHP version is &lt;code&gt;PHP 7.0.0-4+deb.sury.org~trusty+1&lt;/code&gt; and it's the default config of Forge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a config array in craft/config/general.php that looks like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$data['dev.domain.com']  =   [&#xA;    'appId'                 =&amp;gt; 'choiStage',&#xA;    //'cacheMethod'           =&amp;gt; 'memcache',&#xA;    'devMode'               =&amp;gt; true,&#xA;    'phpMaxMemoryLimit'     =&amp;gt; '512M',&#xA;    'cpTrigger'             =&amp;gt; 'craft',&#xA;&#xA;    'backupDbOnUpdate'      =&amp;gt; true,&#xA;    'usePathInfo'           =&amp;gt; true,&#xA;    'omitScriptNameInUrls'  =&amp;gt; true,&#xA;    'enableCsrfProtection'  =&amp;gt; false,&#xA;];&#xA;return $data;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I access the control panel located at /craft I get an error 500.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I have a look at craft/storage/runtime/log/craft.log there is this message :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    ******************************************************************************************************&#xA;2015/12/09 15:42:38 [error] [exception.Error] Error: Class 'Twig_Cache_Filesystem' not found in /home/forge/staging.domain.com/releases/20151209154140/craft/app/vendor/twig/twig/lib/Twig/Environment.php:263&#xA;Stack trace:&#xA;#0 /home/forge/staging.domain.com/releases/20151209154140/craft/app/vendor/twig/twig/lib/Twig/Environment.php(115): Twig_Environment-&amp;gt;setCache('/home/forge/cho...')&#xA;#1 /home/forge/staging.domain.com/releases/20151209154140/craft/app/services/TemplatesService.php(147): Twig_Environment-&amp;gt;__construct(Object(Craft\TemplateLoader), Array)&#xA;#2 /home/forge/staging.domain.com/releases/20151209154140/craft/app/services/TemplatesService.php(221): Craft\TemplatesService-&amp;gt;getTwig()&#xA;#3 /home/forge/staging.domain.com/releases/20151209154140/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('login', Array)&#xA;#4 /home/forge/staging.domain.com/releases/20151209154140/craft/app/controllers/TemplatesController.php(55): Craft\BaseController-&amp;gt;renderTemplate('login', Array)&#xA;#5 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('login', Array)&#xA;#6 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#7 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#8 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#9 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#10 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#11 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#12 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#13 /home/forge/staging.domain.com/releases/20151209154140/craft/app/etc/web/WebApp.php(284): CWebApplication-&amp;gt;processRequest()&#xA;#14 /home/forge/staging.domain.com/releases/20151209154140/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#15 /home/forge/staging.domain.com/releases/20151209154140/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#16 /home/forge/staging.domain.com/releases/20151209154140/public/index.php(19): require_once('/home/forge/cho...')&#xA;#17 {main}&#xA;REQUEST_URI=/craft/login&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried various cacheMethod without any luck and now I'm kinda stuck.&lt;/p&gt;&#xA;" OwnerUserId="4174" LastEditorUserId="4174" LastEditDate="2015-12-09T17:09:58.943" LastActivityDate="2015-12-09T17:56:49.100" Title="CP not loading on Forge Server with PHP 7" Tags="&lt;control-panel&gt;&lt;config&gt;&lt;php&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12792" PostTypeId="2" ParentId="12790" CreationDate="2015-12-09T17:06:26.440" Score="1" Body="&lt;pre&gt;&lt;code&gt;2015/12/09 15:42:38 [error] [exception.Error] Error: Class 'Twig_Cache_Filesystem' not found in /home/forge/staging.domain.com/releases/20151209154140/craft/app/vendor/twig/twig/lib/Twig/Environment.php:263&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That indicates that Craft is missing some of its files.  Try re-uploading your &lt;code&gt;craft/app&lt;/code&gt; folder with a fresh copy downloaded from &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4174" LastEditDate="2015-12-09T17:56:49.100" LastActivityDate="2015-12-09T17:56:49.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12793" PostTypeId="2" ParentId="12633" CreationDate="2015-12-09T20:08:58.067" Score="1" Body="&lt;p&gt;I actually had to make this same change to the OAuth part of this plugin at craft/plugins/oauth/OauthPlugin.php&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2015-12-09T20:08:58.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12795" PostTypeId="1" AcceptedAnswerId="12797" CreationDate="2015-12-09T22:16:59.003" Score="0" ViewCount="517" Body="&lt;p&gt;My site has a set of different layout types with their own templates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Brochure&lt;/li&gt;&#xA;&lt;li&gt;Listing&lt;/li&gt;&#xA;&lt;li&gt;Plain Text&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And the site has a group of hierarchical pages that each use a different layout:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;About (Brochure Layout)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Employees (Listing Layout)&lt;/li&gt;&#xA;&lt;li&gt;History (Plain Text Layout)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I've got these 3 pages each with different content and layout requirements that all need to be grouped together under the &quot;About&quot; page. But I can only use one Section type per Structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to use Entry Types, because I need to use the layouts in multiple places on the site. For example there's a Brochure-type page in the site's 'Careers' area. If something about the layout changes I don't want to have to go through multiple Entry Types to make the changes over and over.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2015-12-09T22:54:40.923" Title="Multiple Sections Within a Structure Group?" Tags="&lt;structure&gt;&lt;navigation&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12796" PostTypeId="2" ParentId="12795" CreationDate="2015-12-09T22:50:11.220" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If something about the layout changes I don't want to have to go through multiple Entry Types to make the changes over and over.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Suspend judgement about whatever you think you know about Entry Types for a minute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other CMS like WordPress where a page template typically defines a layout, &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow&quot;&gt;Entry Types&lt;/a&gt; in Craft are a lot more flexible (because you can also use a different set of custom fields for each type). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly, in your case, there's no relationship between the &lt;code&gt;template&lt;/code&gt; you might use for that particular entry type, unless you &lt;a href=&quot;https://craftcms.com/help/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;want there to be&lt;/a&gt;.  Twig is awesome in helping to ensure your code is DRY.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can absolutely reuse Entry Types in different sections. There's nothing stopping you setting up an Entry Type in one section and using the same name in another. It's up to your on what template you want to load; in that case, just borrow the same Twig code.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2015-12-09T22:50:11.220" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12797" PostTypeId="2" ParentId="12795" CreationDate="2015-12-09T22:54:40.923" Score="3" Body="&lt;p&gt;First, try to separate the concepts of &lt;em&gt;content modeling&lt;/em&gt; (how things are set up in the CP) and &lt;em&gt;information architecture&lt;/em&gt; (how things are going to be presented to the user on the front-end site) in your mind. Are these “Employees” and “History” pages inherently sub-content of “About”, or is that just how you’re choosing to display it on the front-end? My hunch is it’s the latter, in which case a Structure section is not the right choice to begin with - and perhaps 3 separate Single sections makes more sense.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't want to use Entry Types, because I need to use the layouts in multiple places on the site. For example there's a Brochure-type page in the site's 'Careers' area. If something about the layout changes I don't want to have to go through multiple Entry Types to make the changes over and over.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I feel you on the annoyance for having to maintain multiple (near-)identical field layouts, and this is something we hope to make better someday, but I would argue that it’s not going to be as bad in practice to keep these field groups in sync as you’re fearing – or at least not bad enough that the currently-possible workarounds will be worth the effort.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-09T22:54:40.923" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12798" PostTypeId="2" ParentId="12702" CreationDate="2015-12-10T00:17:01.530" Score="2" Body="&lt;p&gt;You would need to pass in &quot;now&quot; unmodified and &quot;date_modify&quot; the value in the database to midnight to do the comparison you're after. Unfortunately that's not possible with an element criteria model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As already mentioned in the comments, set an expiry date. I have written a plugin to set it automatically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;https://github.com/carlcs/craft-autoexpire&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-10T00:17:01.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12800" PostTypeId="1" CreationDate="2015-12-10T09:16:02.747" Score="0" ViewCount="85" Body="&lt;p&gt;I've just used yiic for the first time for a plugin record installation and found that the &lt;code&gt;db.php&lt;/code&gt; config file didn't seem to be picked up and I got database connection failures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a &lt;code&gt;console&lt;/code&gt; array to the file to try that but still no joy. So I edited the &lt;code&gt;craft/app/etc/config/defaults/db.php&lt;/code&gt; with the username, password, table prefix and database name of my local install and it all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've not tried this on a vanilla Craft install but I'm guessing that this may be because my config directory has been renamed to &lt;code&gt;config-mydomainname&lt;/code&gt; as we are running 2 craft sites off of one craft instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That works by way of the following in the &lt;code&gt;./public_html/index.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_CONFIG_PATH', '../craft/config-mydomainname/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this change of path causing the issue with the console?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2015-12-10T09:39:13.680" Title="Unable to connect to db via console with a custom config directory path" Tags="&lt;plugins&gt;&lt;records&gt;&lt;migration&gt;&lt;console&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12802" PostTypeId="2" ParentId="12800" CreationDate="2015-12-10T09:39:13.680" Score="1" Body="&lt;p&gt;I ran into something very similar to this today. I have a custom path for plugins, as a result I could no longer run the plugin console commands because &lt;code&gt;yiic.php&lt;/code&gt; is looking in the default path as specified by its defines. You need to let &lt;code&gt;yiic.php&lt;/code&gt; know about your custom paths and unfortunately I don't think this is possible at the moment without hacking it.&lt;/p&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2015-12-10T09:39:13.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12804" PostTypeId="1" AcceptedAnswerId="12892" CreationDate="2015-12-10T09:55:05.693" Score="0" ViewCount="1003" Body="&lt;p&gt;Despite having tried the tips from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/827/image-transforms-returning-cpresources-url&quot;&gt;Image transforms returning cpresources url&lt;/a&gt;, I am still having issues with image-transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running Craft Pro 2.5.2754&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;asset-source details as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Handle: paragraphPictures&#xA;Type: Local folder&#xA;Path: ./uploads/images/paragraphPictures/&#xA;URL: /uploads/images/paragraphPictures/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;image-transform details as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Handle: frontpageNewsPicture&#xA;Mode: Crop&#xA;Crop Position: Center Center&#xA;Width: 492&#xA;Height: 348&#xA;Quality: Auto&#xA;Format: png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true&lt;/code&gt; is set in craft/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;folder-permissions as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;public/images including all sub-folders and files are owned by apache:apache (the user that runs the apache service) with 777 rights&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template-example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries|length %}&#xA;    &amp;lt;ul class=&quot;entry-list clear&quot;&amp;gt;&#xA;        {% for entry in entries %}&#xA;            {% set entryUrl = entry.url %}&#xA;            {% set picture = entry.pictures.first() %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;div class=&quot;entry-container&quot;&amp;gt;&#xA;                        {% if picture %}&#xA;                        {% set picData = craft.norsok.getPicData(picture) %}&#xA;                        {% set maxWidth = picture.getWidth('frontpageNewsPicture') %}&#xA;                        &amp;lt;a class=&quot;entry-image&quot; href=&quot;{{ entryUrl }}&quot;&amp;gt;&#xA;                            &amp;lt;img class=&quot;entry-picture&quot;&#xA;                                     src=&quot;{{ picture.getUrl('frontpageNewsPicture') }}&quot;&#xA;                                     style=&quot;max-width: {{ maxWidth }}px;&quot;&#xA;                                     title=&quot;{{ picData['title'] }}&quot;&#xA;                                     alt=&quot;{{ picData['altText'] }}&quot; /&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;h3 class=&quot;entry-name&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ entryUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;h4 class=&quot;entry-ingress&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ entryUrl }}&quot;&amp;gt;{{ entry.ingress }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/h4&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;this is what the page-source looks like&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img class=&quot;entry-picture&quot; src=&quot;http://norsok.tibe.no/cpresources/transforms/1?x=bptVEjjgx&quot; style=&quot;max-width: 492px;&quot; title=&quot;Stengelnematode G  Taksdal&quot; alt=&quot;En Stengelnematode (Foto: G. Taksdal)&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;and this is what my console tells me&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;GET http://norsok.tibe.no/cpresources/transforms/2?x=bptVEjjgx 500 (Internal Server Error)&#xA;GET http://norsok.tibe.no/cpresources/transforms/1?x=bptVEjjgx 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;the actual images are located here:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://norsok.tibe.no/uploads/images/paragraphPictures/img-9889-kraftfor-1-foto-anita-land.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://norsok.tibe.no/uploads/images/paragraphPictures/img-9889-kraftfor-1-foto-anita-land.jpg&lt;/a&gt;&#xA;&lt;a href=&quot;http://norsok.tibe.no/uploads/images/paragraphPictures/StengelnematodeG.Taksdal.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://norsok.tibe.no/uploads/images/paragraphPictures/StengelnematodeG.Taksdal.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I am completely baffled and pray to the Stack Exchange-gods for assistance :)&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-12-15T17:41:01.033" Title="Image transforms return cpresources URL in Craft Pro 2.5.2754" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;craft-pro&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12805" PostTypeId="1" AcceptedAnswerId="12811" CreationDate="2015-12-10T13:14:49.277" Score="2" ViewCount="619" Body="&lt;p&gt;I have a front end form that saves an entry with a relation field based on an ID. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ index }}][finish]&quot; value=&quot;{{ finish.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the entry is saved this ID saves the field with the correct category relation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then have a plugin which triggers on entry save that sends an email and attaches the &lt;code&gt;$entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'entries.saveEntry', function( Event $event ){&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    if( !$event-&amp;gt;params['isNewEntry'] || $entry-&amp;gt;section-&amp;gt;handle != 'sampleOrders' )&#xA;    {&#xA;        return;&#xA;    }&#xA;    //die(Craft::dump($entry-&amp;gt;samplesOrder[0]-&amp;gt;finish-&amp;gt;find()));&#xA;    $email = new EmailModel();&#xA;    $email-&amp;gt;toEmail = 'luke@ten4design.co.uk';&#xA;    $email-&amp;gt;subject = 'Order Received';&#xA;    $email-&amp;gt;body = '';&#xA;    $email-&amp;gt;htmlBody = craft()-&amp;gt;templates-&amp;gt;render( 'pentagonemailservice/_emails/order', array(&#xA;        'entry' =&amp;gt; $entry&#xA;    ) );&#xA;    try{&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail( $email );&#xA;    }&#xA;    catch( Exception $e ){&#xA;        Craft::log( 'Could not send email.', LogLevel::Error );&#xA;    }&#xA;} );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason in my email template I cannot access the finish field with the following code. The other fields print correctly. The finish field is a category relation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.samplesOrder %}&#xA;    {% set appr = craft.entries.section( 'appearances' ).apprId( item.appearance ).first() %}&#xA;&#xA;    &amp;lt;h3 class=&quot;appearance__name h beta&quot;&amp;gt;&amp;lt;a class=&quot;a&quot; href=&quot;{{ appr.url }}&quot;&amp;gt;{{ appr.apprId }} - {{ appr.displayName }} - {{ appr.pentagonRange[0].title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;    &amp;lt;h3 class=&quot;h h6 caps--spaced m-b--05&quot;&amp;gt;Material&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p class=&quot;appearance__material h delta basket-bits&quot;&amp;gt;{{ appr.material }}&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;h3 class=&quot;h h6 caps--spaced m-b--05&quot;&amp;gt;Finish&amp;lt;/h3&amp;gt;&#xA;    {#&amp;lt;p class=&quot;basket-bits&quot;&amp;gt;{{ finish.title }}&amp;lt;/p&amp;gt;#}&#xA;&#xA;    &amp;lt;h3 class=&quot;h h6 caps--spaced m-b--05&quot;&amp;gt;Quantity&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p class=&quot;basket-bits&quot;&amp;gt;{{ item.quantity }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I access the finish field in my email template?&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2015-12-10T13:19:49.463" LastActivityDate="2015-12-10T16:00:30.863" Title="Accessing relation data in an on save entry event" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12806" PostTypeId="2" ParentId="12805" CreationDate="2015-12-10T13:25:41.610" Score="1" Body="&lt;p&gt;I don't think it has something to do with your event listener, and you just access the related elements not quite right. Try to get them like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set finish = item.finish.first() %}&#xA;{% if finish %}&#xA;    &amp;lt;h3 class=&quot;h h6 caps--spaced m-b--05&quot;&amp;gt;Finish&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p class=&quot;basket-bits&quot;&amp;gt;{{ finish.title }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or use a &lt;code&gt;relatedTo&lt;/code&gt; query to get the finishes form the field.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2015-12-10T15:00:40.053" LastActivityDate="2015-12-10T15:00:40.053" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12807" PostTypeId="1" CreationDate="2015-12-10T13:29:11.963" Score="1" ViewCount="218" Body="&lt;p&gt;I'm looking for advise and a strategy for integrating Dynamics Nav 2015 with Craft Commerce.  I realise this is a broad question and a hard one, certainly since Craft Commerce has only been recently released. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most important parts is that the integration from user perspective should be a fluent as possible:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(Live) Get prices and stock level&lt;/li&gt;&#xA;&lt;li&gt;(Live) Get custom prices based on customer group and volume discounts&lt;/li&gt;&#xA;&lt;li&gt;(Batch) Get Product catalogue (both products and categories)&lt;/li&gt;&#xA;&lt;li&gt;(Batch) Get Product variants&lt;/li&gt;&#xA;&lt;li&gt;(Batch) Get all product details (like measurements, custom properties)&lt;/li&gt;&#xA;&lt;li&gt;(Live) Post basket to calculate total pricing (based on eg applicable taxes)&lt;/li&gt;&#xA;&lt;li&gt;(Live) Post new customers and contacts&lt;/li&gt;&#xA;&lt;li&gt;(Live) Get customers and contacts&lt;/li&gt;&#xA;&lt;li&gt;(Live) Post new orders&lt;/li&gt;&#xA;&lt;li&gt;(Live) Get orders and its details&lt;/li&gt;&#xA;&lt;li&gt;(Batch ? Live) Get invoices and its details&lt;/li&gt;&#xA;&lt;li&gt;(Live) Get address information (shipping / invoice)&lt;/li&gt;&#xA;&lt;li&gt;(Live) Post Address information (shipping / invoice) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Other important parts are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to deal with user accounts: The navision contact on the same level as the user in craft.  But how would you deal with the creation of it, given that a user can created starting from both sides (from the web as a new contact in navision, from navision and later from the web as an existing contact).  All contacts / users need to be linked to a company object in Nav (again already existing in Nav or completely new)&lt;/li&gt;&#xA;&lt;li&gt;Would it be possible to use queueing from Craft, to eg store orders that are taken when the Navision is not available.  Same goes for pricing info ,etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would be very interested to see&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;your general thoughts about the above&lt;/li&gt;&#xA;&lt;li&gt;is it doable to have craft commerce that tightly integrated (what are other pitfalls I didn't think about)&lt;/li&gt;&#xA;&lt;li&gt;if there is anybody who already started a similar challenge&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="397" LastActivityDate="2016-01-03T17:20:06.800" Title="Dynamics Nav 2015 (Navision) integration" Tags="&lt;ecommerce&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12808" PostTypeId="1" CreationDate="2015-12-10T15:20:01.670" Score="1" ViewCount="29" Body="&lt;p&gt;I have created 12 sponsorship ads for my website using a “sponsor” category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my home page I have four sponsorship sections, each holding three sponsorship ads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I randomly distribute those 12 sponsorship ads among the four sponsorship areas with each homepage load?&lt;/p&gt;&#xA;" OwnerUserId="4326" LastActivityDate="2015-12-10T15:35:12.463" Title="Randomly listing entries in more then one section" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12809" PostTypeId="2" ParentId="12808" CreationDate="2015-12-10T15:35:12.463" Score="1" Body="&lt;p&gt;I would just &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/slice.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; the randomized array of categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ads = craft.categories({&#xA;    group: 'ads',&#xA;    order: 'RAND()'&#xA;}) %}&#xA;&#xA;{% for ad in ads|slice(0, 2) %}&#xA;    {{ ad.externalUrl }}&#xA;{% endfor %}&#xA;&#xA;{% for ad in ads|slice(2, 4) %}&#xA;    {{ ad.externalUrl }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2015-12-10T15:35:12.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12810" PostTypeId="1" CreationDate="2015-12-10T15:54:02.297" Score="0" ViewCount="332" Body="&lt;p&gt;Can I change the current locale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set up a standard site, using CRAFT client version (one language). Apparently Craft installs the en_us as the primary language. Content is added (in Dutch) and now some months later the client decides to upgrade to Craft PRO and move to a multilingual site adding an additional locale. As en_us was the primary one nl_nl is added as the next locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However all Dutch content was added in the (old) en_us locale. Is there a way to swap this? Change the en_us to nl_nl while keeping the Dutch content in place?&lt;/p&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2015-12-10T15:54:02.297" Title="Change the current locale" Tags="&lt;localization&gt;&lt;control-panel&gt;&lt;language&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12811" PostTypeId="2" ParentId="12805" CreationDate="2015-12-10T16:00:30.863" Score="2" Body="&lt;p&gt;Related elements, such as categories, are stored by Craft as arrays, even if there is only a single element to be stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your entry form, you don't appear to be storing an array, but only the id of the selected category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ index }}][finish]&quot; value=&quot;{{ finish.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to be borne out by what you see when you dump the &lt;code&gt;item&lt;/code&gt; variable in your email template. &lt;code&gt;item[finish]&lt;/code&gt; should be an array, even if only a single category is assigned to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using the following in your entry form to see if that helps, which should store the category id as an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ index }}][finish][]&quot; value=&quot;{{ finish.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should then be able to access the correct value for the category title using the code in &lt;a href=&quot;https://craftcms.stackexchange.com/a/12806/153&quot;&gt;@carlcs answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2015-12-10T16:00:30.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12812" PostTypeId="1" CreationDate="2015-12-10T16:49:39.573" Score="1" ViewCount="1071" Body="&lt;p&gt;Wondering if there is any way to force Craft to update the search index for an entry when it is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason I ask is that on our site we have a Location entry type with lat/lon inputs that we use to maintain store locations and plot them on a map. However, when we update the lat/lon coordinates, it does not update the search index and continues to plot the old location on the map even though it is displaying the new address in the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can force it to update by rebuilding the search indexes, the only downside is that it takes a few minutes and renders the site search functions useless until it is done. If there's some way for the entry to automatically update the index when lat/lon coordinates are changed, that would be awesome. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4468" LastActivityDate="2020-02-18T11:35:12.950" Title="Update Search Index on Entry Save" Tags="&lt;search&gt;&lt;index&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12813" PostTypeId="1" CreationDate="2015-12-10T18:08:37.970" Score="4" ViewCount="185" Body="&lt;p&gt;I'm creating a plugin with its own ElementType, i've been using the &lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Events&lt;/a&gt; plugin by P&amp;amp;T for reference, so I thought everything was going fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I go to my elements index, I seem to just get a listing for all elements, regardless of anything. What could cause this? I have my element type in my template like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elementType = 'Custom_ElementType' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if I change this to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elementType = 'Entry' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a list of all entries with the correct sections and whatnot, which is what I expect, but when I change it to the former I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/55NlU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/55NlU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've obviously overlooked something but I can't figure it out, if anyone else has overcome something similar i'd be grateful for any pointers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code i'm using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Plugin_FooElementType.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Plugin_FooElementType extends BaseElementType&#xA;{&#xA;  public function getName()&#xA;  {&#xA;    return Craft::t('Foo Element');&#xA;  }&#xA;  public function getSources($context = null)&#xA;  {&#xA;    $sources = array(&#xA;      '*' =&amp;gt; array(&#xA;       'label' =&amp;gt; Craft::t('All sources')&#xA;      )&#xA;    );&#xA;    return $sources;&#xA;  }&#xA;&#xA;  public function populateElementModel($row)&#xA;  {&#xA;    return Plugin_FooModel::populateModel($row);&#xA;  }&#xA;&#xA;  public function defineTableAttributes($source = null)&#xA;  {&#xA;    return array(&#xA;     'id' =&amp;gt; Craft::t('ID'),&#xA;     'handle' =&amp;gt; Craft::t('Handle'),&#xA;     'path' =&amp;gt; Craft::t('Path'),&#xA;    );&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;_index.html&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;Endpoints&quot;|t %}&#xA;&#xA;{% set elementType = 'Plugin_Foo' %}&#xA;&#xA;{% set tabs = {&#xA;  events:    { label: &quot;Events&quot;|t, url: url('events') },&#xA;  requets: { label: &quot;Requests&quot;|t, url: url('plugin/foos') }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Plugin_FooModel.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Plugin_FooModel extends BaseElementModel&#xA;{&#xA; protected $elementType = 'Plugin_Foo';&#xA;&#xA;&#xA; protected function defineAttributes()&#xA; {&#xA;    return array_merge(parent::defineAttributes(), array(&#xA;        'requestId' =&amp;gt; AttributeType::Number,&#xA;        'handle' =&amp;gt; AttributeType::Handle,&#xA;        'path' =&amp;gt; AttributeType::String,&#xA;    ));&#xA; }&#xA;&#xA; public function getCpEditUrl()&#xA; {&#xA;    $relation = $this-&amp;gt;getRelation();&#xA;    if ($relation)&#xA;    {&#xA;        return UrlHelper::getCpUrl('plugin/'.$relation-&amp;gt;handle.'/'.$this-&amp;gt;id);&#xA;    }&#xA; }&#xA;&#xA;&#xA; public function getRelation()&#xA; {&#xA;    if ($this-&amp;gt;relatedId)&#xA;    {&#xA;        return craft()-&amp;gt;plugin-&amp;gt;getRelationById($this-&amp;gt;relatedId);&#xA;    }&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2015-12-14T12:29:25.400" LastActivityDate="2016-05-05T14:21:44.997" Title="What would cause an custom element listing to just return everything?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12816" PostTypeId="1" CreationDate="2015-12-10T22:09:04.687" Score="2" ViewCount="738" Body="&lt;p&gt;I'm a Craft first-timer building a simple blog site. I want to include breadcrumbs at the top of each page like so:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;siteurl.com: [Blog]&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;siteurl.com/category/example-category: [Blog &gt; Example Category]&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;siteurl.com/post/2015/entry-title: [Blog &gt; Entry Title]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've found this snippet which correctly outputs the breadcrumb for the entry permalink page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;breadcrumbs&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% if craft.request.segments %}&#xA;        {% for crumb in entry.getAncestors() %}&#xA;           &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title() }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I also need something that will include a crumb for when the visitor is on a category page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, my templates are structured like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/&#xA; | index.html&#xA; | _layout.html&#xA; | posts/&#xA;    | index.html&#xA;    | category.html&#xA;    | _entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the breadcrumb snippet is included in '_layout.html'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In EE, I would just check my segments and use Low Seg2Cat to grab the category title. Is there an equivalent to this process in Craft? Or is it handled completely differently?&lt;/p&gt;&#xA;" OwnerUserId="4471" LastActivityDate="2016-09-02T23:02:30.403" Title="Breadcrumbs for category pages" Tags="&lt;templating&gt;&lt;categories&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12817" PostTypeId="1" AcceptedAnswerId="12863" CreationDate="2015-12-10T23:04:24.617" Score="1" ViewCount="648" Body="&lt;p&gt;I have a plugin that is listening to the &lt;code&gt;onOrderComplete&lt;/code&gt; event within commerce. I am able to get the email address like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete', function (Event $event) {&#xA;    $event-&amp;gt;params['order']-&amp;gt;email;  // name@email.com&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the Id in the log, but since I'm in the order class, I'm not sure how to get to it. I can see &lt;code&gt;customerId&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['order']-&amp;gt;customerId; // 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I've noticed the &lt;code&gt;customerId&lt;/code&gt; and the &lt;code&gt;userId&lt;/code&gt; are different. I need to be able to get the logged in &lt;code&gt;userId&lt;/code&gt; vs. the &lt;code&gt;customerId&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try getting just the id, I get the product id back (Which is what I would expect).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['order']-&amp;gt;id;  // 123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To relate to the twig side it would be something like this (obviously won't work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['order']['currentUser']-&amp;gt;id;  // 12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a part of the log: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;[_attributes:Craft\BaseModel:private] =&amp;gt; Array&#xA;(&#xA;    [enabled] =&amp;gt; 1&#xA;    [archived] =&amp;gt; 0&#xA;    [locale] =&amp;gt; en_us&#xA;    [localeEnabled] =&amp;gt; 1&#xA;    [itemTotal] =&amp;gt; 375&#xA;    [baseDiscount] =&amp;gt; 0&#xA;    [baseShippingCost] =&amp;gt; 0&#xA;    [totalPrice] =&amp;gt; 375&#xA;    [totalPaid] =&amp;gt; 375.00&#xA;    [billingAddressId] =&amp;gt; 122&#xA;    [shippingAddressId] =&amp;gt; 123&#xA;    [paymentMethodId] =&amp;gt; 1&#xA;    [customerId] =&amp;gt; 3&#xA;    [id] =&amp;gt; 12   //  &amp;lt;-- This guy right here&#xA;    [orderStatusId] =&amp;gt; 1&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-01-13T15:56:05.550" Title="How can I get the current user who purchased a product from the onOrderComplete event?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12818" PostTypeId="1" AcceptedAnswerId="12821" CreationDate="2015-12-10T23:13:09.743" Score="1" ViewCount="448" Body="&lt;p&gt;I need to list out the image options from a specific assets folder for users to select from. Previously, I accomplished that like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set folder_id = 5 %}&#xA;&#xA;{% for image in craft.assets.kind('image').folderId(folder_id).order('filename') %}&#xA;&#xA;    {# do stuff, like print image.filename #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to get the folder ID pre-2.5, I could inspect the folders menu when viewing assets in CP. Now, that appears to be gone in Craft 2.5+ and struggling to find the ID. I'm assuming there must be a way to view the folderId as Craft has a &lt;code&gt;folderId()&lt;/code&gt; filter for &lt;code&gt;craft.assets&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-12-11T00:53:58.393" LastActivityDate="2015-12-11T00:53:58.393" Title="Getting Asset FolderId" Tags="&lt;templating&gt;&lt;assets&gt;&lt;filter&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12819" PostTypeId="1" AcceptedAnswerId="12820" CreationDate="2015-12-10T23:28:42.973" Score="0" ViewCount="184" Body="&lt;p&gt;Running Craft version 2.3, build 2644, schema version 2.3.4... we clicked &quot;update&quot; and got an error screen that looks like the install screen that simply says &quot;oops&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I restore my site from the files that are in the (automatically generated) folder &quot;app.bak&quot;?&lt;/p&gt;&#xA;" OwnerUserId="4019" LastEditorUserId="57" LastEditDate="2015-12-10T23:36:54.297" LastActivityDate="2015-12-10T23:36:54.297" Title="Update failed, restoring from app.bak?" Tags="&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12820" PostTypeId="2" ParentId="12819" CreationDate="2015-12-10T23:36:24.020" Score="0" Body="&lt;p&gt;You can restore your database from your pre-update attempt database backup that you (hopefully) made.  Assuming you've got the the &lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow&quot;&gt;backupDbOnUpdate&lt;/a&gt; config setting set to &lt;code&gt;true&lt;/code&gt;, Craft made one for you in &lt;code&gt;craft/storage/runtime/backups&lt;/code&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also download any previous version of Craft's files via: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/223/where-can-i-download-previous-versions-of-craft&quot;&gt;Where can I download previous versions of Craft?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just replace the existing &lt;code&gt;craft/app&lt;/code&gt; folder with the fresh one you downloaded and delete &lt;code&gt;app.bak&lt;/code&gt;.  I wouldn't recommend restoring directly from &lt;code&gt;app.bak&lt;/code&gt; because depending on where your update failed, it could be in an inconsistent state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend doing a &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow&quot;&gt;manual update&lt;/a&gt; when you're ready to update again as you probably ran into your server's max execution time or memory limit (which tends to happen on these larger updates).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-10T23:36:24.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12821" PostTypeId="2" ParentId="12818" CreationDate="2015-12-11T00:45:22.660" Score="3" Body="&lt;p&gt;You can always check the &lt;code&gt;craft_assetfolders&lt;/code&gt; table in the database, find the folder name you're looking for and grab its &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it's probably just a typo in your original code, you're setting the folder ID to a variable named &lt;code&gt;folder_id&lt;/code&gt;, but you're passing &lt;code&gt;id&lt;/code&gt; into &lt;code&gt;.folderId(id)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-11T00:45:22.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12822" PostTypeId="2" ParentId="12804" CreationDate="2015-12-11T00:50:02.250" Score="0" Body="&lt;p&gt;If I load &lt;code&gt;http://norsok.tibe.no/cpresources/transforms/1?x=bptVEjjgx&lt;/code&gt;, then I got a 404 instead of a 500, but maybe you've changed something with the transforms so that URL is no longer valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 500 ISE is either coming from Craft (in which case the underlying error message will be in your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files or it's coming from your web server (in which case it will be in your web server's error logs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you find that message, that should help you debug why the transform is failing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-11T19:04:12.743" LastActivityDate="2015-12-11T19:04:12.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12823" PostTypeId="1" AcceptedAnswerId="13255" CreationDate="2015-12-11T00:51:20.947" Score="0" ViewCount="41" Body="&lt;p&gt;Craft 2.5.2754, Sprout Email 2.01, fresh plugin install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In attempting to use the Recipients feature, I created a new group (Contact Form Recipients) and hit the Add Recipient button. I filled out the email address, first, and last names, but it keeps saying &quot;Unable to save recipient.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error log says: &lt;code&gt;Craft\SproutEmail_DefaultMailerRecipientModel-&amp;gt;recipientLists failed validation: Recipient Lists cannot be blank.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a few more lists to be safe; no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible I'm missing something, or is there a recommended fix or workaround for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="3687" LastEditorUserId="57" LastEditDate="2016-01-16T06:04:48.847" LastActivityDate="2016-01-16T06:04:48.847" Title="Sprout Email: &quot;Unable to save recipient.&quot;" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12824" PostTypeId="1" AcceptedAnswerId="12829" CreationDate="2015-12-11T11:16:17.573" Score="2" ViewCount="1000" Body="&lt;p&gt;I'm trying to add some variables to email's template to be rendered before email is sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to modify emailModel like customHeaders and subject but I couldn't pass custom variables to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass variables to email's template using onBeforeSendEmail event?&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2015-12-14T23:21:26.353" Title="How can I pass variables to email's template onBeforeSendEmail" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;emails&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12825" PostTypeId="2" ParentId="11474" CreationDate="2015-12-11T12:53:19.077" Score="4" Body="&lt;p&gt;I was also very interested in this, so i forked the repo from theoplampert and added some extra features. You can find it here, &lt;a href=&quot;https://github.com/jacobnijgh/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;https://github.com/jacobnijgh/ElementAPI&lt;/a&gt;. This fork allows you to not only cache the results but also the paginated results just what we needed in our case for loading some results with AJAX.&lt;/p&gt;&#xA;" OwnerUserId="4077" LastActivityDate="2015-12-11T12:53:19.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12826" PostTypeId="1" CreationDate="2015-12-11T12:54:40.633" Score="1" ViewCount="165" Body="&lt;p&gt;Craft's codebase has nicely consistent coding conventions. Pixel &amp;amp; Tonic even publishes some information about their &lt;a href=&quot;https://github.com/pixelandtonic/CodingStandards&quot; rel=&quot;nofollow&quot;&gt;Coding Standards&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PhpStorm allows you to enforce a &lt;a href=&quot;https://www.jetbrains.com/phpstorm/help/code-style-php.html&quot; rel=&quot;nofollow&quot;&gt;PHP Code Style&lt;/a&gt; in the editor and allows you to &lt;a href=&quot;https://www.jetbrains.com/phpstorm/help/exporting-and-importing-settings.html&quot; rel=&quot;nofollow&quot;&gt;Import and Export Settings&lt;/a&gt; which include &lt;em&gt;Code Style&lt;/em&gt; in the list of options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody shared PhpStorm Code Style settings that enforce the Craft Standards?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-12-11T12:54:40.633" Title="Has anybody created a reusable PhpStorm Code Style settings export for Craft CMS?" Tags="&lt;editor&gt;&lt;workflow&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12827" PostTypeId="2" ParentId="12824" CreationDate="2015-12-11T14:46:16.420" Score="2" Body="&lt;p&gt;I don't know if this is the same kind of thing you are looking for, but I think it's close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a plugin that handles a contact form submission. When the user fills out the form, an email is sent to me &amp;amp; the person who filled out the form. I'm not listening to &lt;code&gt;onBeforeSendEmail&lt;/code&gt;, but rather listening for a &lt;code&gt;save&lt;/code&gt; event that I call via controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I told Craft that I needed a settings area in my plugin, then I created a textarea where I could manage the email that was sent to the user(s). This is what that looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Hi {{firstName}} &amp;amp;mdash; thank you for reaching out to us!&amp;lt;br&amp;gt;We wanted to drop you a quick note that we've received your information and we'll be in touch very soon!&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Regards,&amp;lt;br&amp;gt;The friendly folks at this website&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get &lt;code&gt;{{firstName}}&lt;/code&gt; to use the value that were entered in the form, I used this in my plugin's service file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way it would read &quot;Hi Steve - thank you for...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$email = new EmailModel();&#xA;$email-&amp;gt;fromEmail = $emailSettings['emailAddress']; // set in CP&#xA;$email-&amp;gt;replyTo = $emailSettings['emailAddress'];   // set in CP&#xA;$email-&amp;gt;sender = $emailSettings['emailAddress'];    // set in CP&#xA;$email-&amp;gt;fromName = $emailSettings['senderName'];    // set in CP&#xA;$email-&amp;gt;toEmail = $contact-&amp;gt;email;&#xA;$email-&amp;gt;subject = $settings-&amp;gt;guestSubject;&#xA;$email-&amp;gt;body = craft()-&amp;gt;templates-&amp;gt;renderString($settings-&amp;gt;welcomeEmailMessage, array('firstName' =&amp;gt; $contact-&amp;gt;firstName));&#xA;&#xA;if (craft()-&amp;gt;email-&amp;gt;sendEmail($email)) {&#xA;    return true;&#xA;}&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's the &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;renderString()&lt;/code&gt; part that lets me hook into my plugin to set the variable values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-11T14:46:16.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12828" PostTypeId="1" CreationDate="2015-12-11T15:55:35.863" Score="0" ViewCount="140" Body="&lt;p&gt;I have to set a the same site on two different subdomains. I have the two subdomains included in the config.php. But that doesn't seem to work. Is there any other configurations I need to set?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// internal&#xA;'sub1.website.com' =&amp;gt; array(&#xA;    'overridePhpSessionLocation' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'https://sub1.website.com/',&#xA;        'fileSystemPath' =&amp;gt; '/var/www/html/'&#xA;    )&#xA;),&#xA;// external&#xA;'sub2.website.com' =&amp;gt; array(&#xA;    'overridePhpSessionLocation' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'https://sub2.website.com/',&#xA;        'fileSystemPath' =&amp;gt; '/var/www/html/'&#xA;    )&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2015-12-11T23:06:03.740" Title="How do I set up same site to use two different subdomains?" Tags="&lt;config&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12829" PostTypeId="2" ParentId="12824" CreationDate="2015-12-11T19:22:25.147" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#email-onBeforeSendEmail&quot; rel=&quot;nofollow&quot;&gt;onBeforeSendEmail&lt;/a&gt; event passes in 3 parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['user']&lt;/code&gt; which is a &lt;a href=&quot;http://buildwithcraft.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; object representing the user that is receiving the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['emailModel']&lt;/code&gt; which is the &lt;a href=&quot;http://buildwithcraft.com/classreference/models/EmailModel&quot; rel=&quot;nofollow&quot;&gt;EmailModel&lt;/a&gt; defining the email to be sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['variables']&lt;/code&gt; which is an associative array of key =&gt; value pairs of that is sent to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can modify the 3rd one to pass in any additional variables that you need like so from your plugin's main class file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('email.onBeforeSendEmail', function ($event)&#xA;    {&#xA;        $event-&amp;gt;params['variables']['newKey'] = 'newValue';&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a bug in the latest build of &lt;a href=&quot;https://craftcms.com/changelog#build2754&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5.2754&lt;/a&gt; that prevents this from working properly, but it's been fixed for the next release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-14T23:21:26.353" LastActivityDate="2015-12-14T23:21:26.353" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12830" PostTypeId="1" AcceptedAnswerId="12832" CreationDate="2015-12-11T19:59:39.977" Score="0" ViewCount="451" Body="&lt;p&gt;I'm trying to build a website for a client that has actually two websites for different locations and we need to merge both of them in a new one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing is that he wants to keep the domains separate, which means that when you visit website1.com you will see templates for that website and the url address will display website1.com/.../ etc. And when you visit website2.com while you browse the site you will retain this url. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Craft? Because we will have one database and install but 2 domains with one parked over the other. Can this be done with the Multi-environment technique described here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4337" LastActivityDate="2015-12-11T21:27:44.003" Title="Two domains with two different templates" Tags="&lt;multi-domain&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12831" PostTypeId="2" ParentId="12830" CreationDate="2015-12-11T21:09:21.010" Score="1" Body="&lt;p&gt;Multi-environment-configs: don't think so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a solution is to use json template files on website1.com that you read (without craft) on website2.com?&lt;/p&gt;&#xA;" OwnerUserId="4427" LastActivityDate="2015-12-11T21:09:21.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12832" PostTypeId="2" ParentId="12830" CreationDate="2015-12-11T21:27:44.003" Score="1" Body="&lt;p&gt;Yes it is possible. I have it done on a site which has some sub sites with different domain name. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You set your multi-environment configs for each site/subsite. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then based on the domain the site is accessed by include different header/footer files. Then the main content/templates are mostly the same. &#xA;Can share news between the sites so works well. &#xA;I have a different structure controlling the main nav for each site. &lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2015-12-11T21:27:44.003" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12833" PostTypeId="1" AcceptedAnswerId="12843" CreationDate="2015-12-11T22:49:20.417" Score="0" ViewCount="67" Body="&lt;p&gt;I'm using the Feed Me plugin in a template to extract data from an RSS feed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the RSS contains the following snippet&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;category&amp;gt;Physiology&amp;lt;/category&amp;gt;&#xA;&amp;lt;pubDate&amp;gt;Mon, 02 Nov 2015 00:00:00 +1100&amp;lt;/pubDate&amp;gt;&#xA;&amp;lt;dc:creator&amp;gt;Joe Bloggs&amp;lt;/dc:creator&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can extract the data for the first two nodes using &lt;code&gt;{{ node.category }}&lt;/code&gt; or &lt;code&gt;{{ node.pubDate }}&lt;/code&gt;. But for the third &lt;code&gt;{{ node.creator }}&lt;/code&gt; doesn't work and &lt;code&gt;{{ node.dc:creator }}&lt;/code&gt; results in an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct way to extract node data that has a namespace defined?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-12-13T03:25:47.647" Title="Template extraction of namespace node values from RSS using Feedme plugin" Tags="&lt;rss&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12834" PostTypeId="1" AcceptedAnswerId="12837" CreationDate="2015-12-11T22:51:55.867" Score="2" ViewCount="284" Body="&lt;p&gt;I want to conditionally add some CSS to a subnav element if that page in the subnav is currently active. However, I can't add the CSS based on any slug / URL / getSegment logic, as that will likely be changed down the road. I also can't use the ID of the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pages in this subnav are part of the same structure and it seems to me the best way to set the rule would be based on the order of the page in the structure. Something like if page 2 in craft.entries.section('') is active then apply CSS to target element. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible in Craft? If so, how would I do that? If not, other ideas for how to approach it?&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2015-12-11T23:42:45.297" Title="Conditionally Applying CSS to Element on Active Page Without Using URL or ID Logic" Tags="&lt;entries&gt;&lt;conditional&gt;&lt;order&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12835" PostTypeId="2" ParentId="12828" CreationDate="2015-12-11T23:06:03.740" Score="1" Body="&lt;p&gt;Are these two sites exactly the same, and this is just an alias?  If so, you don't need any configuration, just point the DNS to the right place, and it'll work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, can you provide more details on what you're trying to achieve?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-11T23:06:03.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12836" PostTypeId="2" ParentId="12834" CreationDate="2015-12-11T23:10:25.453" Score="1" Body="&lt;p&gt;You're going to need some kind of context as to what is &quot;current&quot;; the context you have is in &lt;code&gt;craft.request&lt;/code&gt; -- I'm not sure what else you'd use, other than slug / URL / getSegment logic.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-11T23:10:25.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12837" PostTypeId="2" ParentId="12834" CreationDate="2015-12-11T23:42:45.297" Score="2" Body="&lt;p&gt;The &lt;code&gt;craft_structureelements&lt;/code&gt; table contains the data you need to determine the exact position &amp;amp; level of each entry in your structure. But you'd need some fancy plugin logic to attack that data and use it to your advantage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all honesty, I really feel like you're going the wrong way on this, and you're better served trying to find a way to make the &lt;code&gt;slug&lt;/code&gt; or &lt;code&gt;id&lt;/code&gt; work for you. The sole purpose of a slug is to identify a specific page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you dynamically generate your nav, add a CSS class with slug of that nav item. Then, you can verify that against the slug of the page which is being loaded. Even if the slug changes, it'll change in both places simultaneously.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-11T23:42:45.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12838" PostTypeId="1" AcceptedAnswerId="12839" CreationDate="2015-12-12T00:41:33.780" Score="1" ViewCount="635" Body="&lt;p&gt;I'm getting this error when trying to call my plugin on a template:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Call to undefined method Craft\SiteUtilitiesService::init() in /path/to/my/site/craft/app/framework/base/CModule.php on line 394&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The template tag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.siteUtilities.videoEmbed( block.video, '219181' ) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Content of &lt;code&gt;variables/SiteUtilitiesVariable.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SiteUtilitiesVariable&#xA;{&#xA;    public function videoEmbed($url, $color)&#xA;    {&#xA;        return craft()-&amp;gt;siteUtilities-&amp;gt;videoEmbed($url, $color);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Content of &lt;code&gt;services/SiteUtilitiesService.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SiteUtilitiesService&#xA;{&#xA;    public function videoEmbed($url, $color)&#xA;    {&#xA;        // some code to get the video ID from the $url variable&#xA;&#xA;        return &quot;&amp;lt;some html embed code with the $color variable&amp;gt;&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the &lt;code&gt;init&lt;/code&gt; method the error is referencing?&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2015-12-12T01:16:40.657" Title="Call to Undefined Method ::init Error" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12839" PostTypeId="2" ParentId="12838" CreationDate="2015-12-12T01:16:40.657" Score="3" Body="&lt;p&gt;I needed to extend &lt;code&gt;BaseApplicationComponent&lt;/code&gt; in my Services file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SiteUtilitiesService extends BaseApplicationComponent&#xA;{&#xA;    public function videoEmbed($url, $color)&#xA;    {&#xA;        // some code to get the video ID from the $url variable&#xA;&#xA;        return &quot;&amp;lt;some html embed code with the $color variable&amp;gt;&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastActivityDate="2015-12-12T01:16:40.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12840" PostTypeId="1" AcceptedAnswerId="12886" CreationDate="2015-12-12T15:13:38.180" Score="1" ViewCount="878" Body="&lt;p&gt;Building a small AngularJS app and using the ElementAPI plugin for the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can set &lt;code&gt;'postDate' =&amp;gt; $entry-&amp;gt;postDate&lt;/code&gt; which gives me&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;postDate : {&#xA;   date: &quot;2015-12-10 07:04:02.000000&quot;,&#xA;   timezone_type: 3,&#xA;   timezone: &quot;UTC&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can access this date in Angular by doing &lt;code&gt;{{note.postDate.date}}&lt;/code&gt; but obviously it's just a string so I can't use any native Angular filters for formatting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can access the postDate with a date format? What options do I have? &lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="57" LastEditDate="2015-12-13T03:07:49.860" LastActivityDate="2015-12-17T18:40:43.213" Title="Formatting postDate using the ElementAPI plugin" Tags="&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12841" PostTypeId="2" ParentId="12840" CreationDate="2015-12-12T17:48:21.397" Score="2" Body="&lt;p&gt;Anything you spit out of Craft is going to be a string until you convert it into javascript so it's &quot;native&quot; to Angular/Javascript. JSON is just a transport format. There's no &lt;a href=&quot;http://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates&quot; rel=&quot;nofollow&quot;&gt;standard format&lt;/a&gt; for dates in JSON (which is a little counter intuitive!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$jsDate =  $entry-&amp;gt;postDate-&amp;gt;iso8601();&#xA;... // output as usual&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;8601 is a good format to get your date into that JS can convert. Then make that into a JS &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date&quot; rel=&quot;nofollow&quot;&gt;Date&lt;/a&gt;, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var angularDate = new Date(whatever);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2015-12-15T16:15:04.080" LastActivityDate="2015-12-15T16:15:04.080" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12842" PostTypeId="1" CreationDate="2015-12-13T01:22:13.660" Score="4" ViewCount="850" Body="&lt;p&gt;I realize Craft 2.5 ships with Redactor II which has many changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Redactor I a combination of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;paragraphize: false,&#xA;replaceDivs: false,&#xA;linebreaks: true,&#xA;enterKey: false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;kept text from being wrapped in &lt;code&gt;p&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to give someone the ability to add simple formatting such as bold and italic, but not wrap it in any HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone found how to continue doing this with Redactor II?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="236" LastActivityDate="2016-02-19T19:26:00.027" Title="Redactor II Craft 2.5 Prevent Paragraphs" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12843" PostTypeId="2" ParentId="12833" CreationDate="2015-12-13T03:25:47.647" Score="2" Body="&lt;p&gt;As the &lt;a href=&quot;https://github.com/engram-design/FeedMe#template-example&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; actually shows, you'd reference these sort of nodes using the array notation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ node['dc:creator'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-12-13T03:25:47.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12845" PostTypeId="2" ParentId="12084" CreationDate="2015-12-13T15:26:23.700" Score="3" Body="&lt;p&gt;I faced this problem when I upgraded MySQL to version &gt;= 5.7.5 and I'v fixed it by following these steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;SSH into your server.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add &lt;code&gt;sql-mode=&quot;&quot;&lt;/code&gt; to your MySQL config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo -e '[mysqld]\nsql-mode=&quot;&quot;' | tee --append /etc/mysql/conf.d/craft.cnf &amp;gt; /dev/null&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Restart MySQL service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;service mysql restart&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note: you might need to add &lt;code&gt;sudo&lt;/code&gt; to those commands.&lt;/p&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2016-01-13T05:19:22.827" LastActivityDate="2016-01-13T05:19:22.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12846" PostTypeId="1" CreationDate="2015-12-13T16:44:21.460" Score="0" ViewCount="80" Body="&lt;p&gt;I can't edit any entry after updating to Craft CMS 2.5.2754 - what I see is attached. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP does not report any errors and other parts of the control panel and frontend seem to be working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before I dive deep - is there anybody who has had the same behaviour and was able to fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The update has been done twice already, once automatically, once manually. Same results in both cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ix0Ou.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ix0Ou.png&quot; alt=&quot;Entry editation screen&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-12-14T10:49:14.773" Title="Unable to edit any entry after update to 2.5" Tags="&lt;error&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2015-12-21T03:10:32.860" ContentLicense="CC BY-SA 3.0" />
  <row Id="12847" PostTypeId="1" CreationDate="2015-12-13T19:19:53.907" Score="1" ViewCount="1126" Body="&lt;p&gt;I have a Matrix block with a text field and an Assets field. The text field has a Markdown filter applied to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the content owner to be able to enter a placeholder reference to one of the images uploaded to the sibling Assets field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when the template processes…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is a **paragraph**.&#xA;&#xA;%%img2%%&#xA;&#xA;This is some more text.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…then &lt;code&gt;%%img2%%&lt;/code&gt; (or some such syntax that won't conflict with Markdown) gets replaced with the HTML generated for the second image by the relevant Assets query running in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done things like this before with MXjumper and ExpressionEngine but am pretty new to Craft and not sure how to go about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figure I need to: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set a &lt;em&gt;dynamically named&lt;/em&gt; variable (because I don't know in advance how many images are in the image field)&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;em&gt;replace&lt;/em&gt; on the text field, but the replace statement should incorporate dynamically named search strings and the replacements would be the variables named at step 1 not strings.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Really not sure how to execute either of these 2 steps in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would something like the following work for step1?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for img in sectionImages %}&#xA;    {% set n %}{{ loop.index }}{% endset %}&#xA;    {% set img ~ n %}&#xA;    &amp;lt;figure&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ img.url }}&quot; alt=&quot;{{ img }}&quot;&amp;gt;&#xA;        {% if img.caption|length %}&#xA;        &amp;lt;figcaption&amp;gt;&#xA;            &amp;lt;span{{ img.caption }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/figcaption&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/figure&amp;gt;&#xA;    {% endset %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And what then for step 2…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.sectionText|markdown|replace('%%img' ~ n ~ '%%': img ~ n) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My step 1 code feels like it's close but I suspect it's not right. And in any case I feel sure my step 2 code is further off from what's needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think maybe I need to be storing &lt;code&gt;img&lt;/code&gt; as key|value pairs in an array and working with that somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2015-12-13T21:17:08.693" LastActivityDate="2015-12-14T19:24:04.750" Title="Replace placeholder string in text field with HTML generated by Asset query" Tags="&lt;assets&gt;&lt;variable&gt;&lt;replace&gt;&lt;set&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12848" PostTypeId="1" AcceptedAnswerId="12852" CreationDate="2015-12-13T19:37:17.773" Score="1" ViewCount="71" Body="&lt;p&gt;Hopefully simple variable / concatenation question: What is the best way to retrieve the url of a specific asset the name of which should be concatenated from an asset field variable and a text string?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to end accessing the url of an asset like so – {{asset.&lt;strong&gt;portrait&lt;/strong&gt;ThumbSmall.url}}, but I am in a loop where “&lt;strong&gt;portrait&lt;/strong&gt;” could also be “&lt;strong&gt;landscape&lt;/strong&gt;” ...or “&lt;strong&gt;square&lt;/strong&gt;”, and is derived from an asset field variable on an asset called “thumbnailCrop”. With me so far?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {{asset.thumbnailCrop ~ &quot;ThumbSmall&quot; ~ .url}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…only, unlike this, it should actually work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did read this -&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/200/how-can-i-incorporate-a-variable-into-a-string&quot;&gt;How can I incorporate a variable into a string?&lt;/a&gt; …but I’m trying to incorporate a string into a variable. Not sure it applies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone in the Slack channel suggested...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set thumbnail = attribute(asset, thumbnailCrop ~ &quot;ThumbSmall&quot;) %}&#xA;    {{ thumbnail.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't work, and I was also wondering if it wasn't possible to make something more compact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2015-12-13T21:09:05.963" Title="Accessing and Manipulating a Variable" Tags="&lt;templating&gt;&lt;attribute&gt;&lt;concatenation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12849" PostTypeId="2" ParentId="12847" CreationDate="2015-12-13T20:26:54.940" Score="2" Body="&lt;p&gt;This is partially side stepping your question but, it could be a solid option just the same: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might consider checking out Selvin's &lt;a href=&quot;https://github.com/selvinortiz/craft.doxter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Doxter Markdown plugin&lt;/a&gt;. It has support for Entries, Assets, Users, Tags, Globals and Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://monosnap.com/file/FJBdyRxEgtep0L8hGkSI2ZczVfKnCh.png&quot; alt=&quot;Craft Doxter markdown icons&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all via reference codes which can be copied and pasted into the Markdown as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://monosnap.com/file/WQK6Rv4pwHZKJCSKa21ugH0Af0hpae.png&quot; alt=&quot;reference code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DHBOp.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DHBOp.gif&quot; alt=&quot;Doxter walkthrough&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12" LastEditorUserId="12" LastEditDate="2015-12-14T19:24:04.750" LastActivityDate="2015-12-14T19:24:04.750" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12850" PostTypeId="1" AcceptedAnswerId="12880" CreationDate="2015-12-13T20:37:55.070" Score="1" ViewCount="491" Body="&lt;p&gt;I have Craft installed on Heroku using Memcached for sessions. Craft is kicking me out of the admin area every minute or two. It's deriving me crazy. I've also set the user session duration in general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'userSessionDuration' =&amp;gt; 'P2W'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still kicking me out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set it to dev mode, I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined variable: _SESSION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that the session does work, because I can login. I can also check the currentUser variable and see people signed in. The thing is, it isn't lasting long and makes the admin area nearly unusable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My composer file is really simple. Nothing complicated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;ext-mbstring&quot;: &quot;*&quot;,&#xA;    &quot;ext-imagick&quot;: &quot;*&quot;&#xA;  },&#xA;  &quot;require-production&quot;: {&#xA;    &quot;ext-memcached&quot;: &quot;*&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, here are my Memcached settings in the /public/.user.ini file (as recommended by Heroku):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;session.save_handler=memcached&#xA;memcached.sess_binary=1&#xA;session.save_path=&quot;PERSISTENT=myapp_session ${MEMCACHIER_SERVERS}&quot;&#xA;memcached.sess_sasl_username=${MEMCACHIER_USERNAME}&#xA;memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SOLUTION:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone interested, the Memcached extension in my composer.json file wasn't being picked up by Heroku on deploy. So I updated my composer.json file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;ext-mbstring&quot;: &quot;*&quot;,&#xA;    &quot;ext-imagick&quot;: &quot;*&quot;,&#xA;    &quot;ext-memcached&quot;: &quot;*&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then ran &lt;code&gt;composer update&lt;/code&gt; to update the composer.lock file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When deploying to Heroku, the composer.lock file is very similar to the Gemfile.lock in Rails - telling Heroku exactly what to install with the deployment. Now the Memcached extension is being installed by Heroku and my session problem has been solved.&lt;/p&gt;&#xA;" OwnerUserId="4388" LastEditorUserId="4388" LastEditDate="2015-12-14T05:54:22.280" LastActivityDate="2015-12-15T06:35:42.573" Title="Logging in Every Minute - Craft Admin Sessions (on Heroku)" Tags="&lt;admin&gt;&lt;session&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12851" PostTypeId="2" ParentId="12813" CreationDate="2015-12-13T20:38:27.140" Score="2" Body="&lt;p&gt;It is likely just a typo in your template. Can you ensure that if your element type class name is of the format &lt;code&gt;Custom_PluginElementType&lt;/code&gt; that your template code is then in the following format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elementType = 'Custom_Plugin' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if your element type class name is of the format &lt;code&gt;CustomElementType&lt;/code&gt; that your template code is then in the following format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elementType = 'Custom' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-12-13T20:38:27.140" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12852" PostTypeId="2" ParentId="12848" CreationDate="2015-12-13T21:09:05.963" Score="3" Body="&lt;p&gt;Give this a shot...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = (asset.thumbnailCrop.value ?: &quot;portrait&quot;) ~ &quot;ThumbSmall&quot; %}&#xA;{{ asset.url(transform) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;asset.thumbnailCrop&lt;/code&gt; is a dropdown field (or similar), you'll need to specifically extract the &lt;strong&gt;value&lt;/strong&gt; from it. If no value is found, it'll fall back to using the &quot;portrait&quot; string.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-13T21:09:05.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12853" PostTypeId="2" ParentId="12850" CreationDate="2015-12-13T22:21:21.423" Score="0" Body="&lt;p&gt;It sounds like PHP/Apache can't write to where it is &lt;a href=&quot;https://secure.php.net/manual/en/function.session-save-path.php&quot; rel=&quot;nofollow&quot;&gt;configured&lt;/a&gt; to save PHP session files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd first double check that path exists and is writable by PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not real sure what &lt;code&gt;composer.json&lt;/code&gt; has to do with this, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-13T22:21:21.423" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12854" PostTypeId="2" ParentId="12847" CreationDate="2015-12-14T09:53:00.180" Score="2" Body="&lt;p&gt;Well this feels like an awful kludge but at least I have it working with a finite number of image variables in the code below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There has to be a more elegant and flexible way to do this. And Natetronn, if your proposal does just that, perhaps you could help me see how. Otherwise, other cleverer folks, do let me know.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for subsection in entry.subsections %}&#xA;&#xA;    {# Set variables for up to 4 images per subsection #}&#xA;    {% set n  = 0 %}&#xA;    {% set imageN = '' %}&#xA;    {% set image1 = '' %}&#xA;    {% set image2 = '' %}&#xA;    {% set image3 = '' %}&#xA;    {% set image4 = '' %}&#xA;&#xA;    {% set sectionImgs = subsection.sectionImages %}&#xA;&#xA;    {% for img in sectionImgs %}&#xA;        {% set n = loop.index %}&#xA;&#xA;        {% set imageN %}&#xA;        &amp;lt;figure&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ img.url }}&quot; alt=&quot;{{ img }} {{ n }}&quot;&amp;gt;&#xA;            {% if img.caption|length %}&#xA;            &amp;lt;figcaption&amp;gt;&#xA;                &amp;lt;span{{ img.caption }}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/figcaption&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/figure&amp;gt;&#xA;        {% endset %}&#xA;&#xA;        {# assign imageN to a specific variable #}&#xA;        {% switch n %}&#xA;            {% case 1 %} {% set image1 = imageN %}&#xA;            {% case 2 %} {% set image2 = imageN %}&#xA;            {% case 3 %} {% set image3 = imageN %}&#xA;            {% case 4 %} {% set image4 = imageN %}&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;&#xA;    {{ subsection.sectionText|markdown|replace({&#xA;        '%%image1%%': image1, &#xA;        '%%image2%%': image2, &#xA;        '%%image3%%': image3, &#xA;        '%%image4%%': image4&#xA;    })|raw }}&#xA;&#xA;{% endfor %}{# /subsection #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3507" LastActivityDate="2015-12-14T09:53:00.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12857" PostTypeId="2" ParentId="12757" CreationDate="2015-12-14T11:08:13.257" Score="2" Body="&lt;p&gt;Not really an answer that fixes the question per sé if anyone else has the same issue, but none the less the answer that worked for me was simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Split up your sorting where possible and simplify things!&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted my main array to be sorted by condition A, grouped by condition B and than sort the sub arrays alphabeticaly. All done to the same array in a few lines of code so I could use this one array in my template to get all information from it. Bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I did was sort everything by condition A in PhP in my plugin, in my template I than group everything by condition B and only when I needed to iterate over my array to reveal my sub arrays, only then I sort the values alphabetically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So short answer: &lt;strong&gt;keep it simple damnit!&lt;/strong&gt; :)&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2015-12-14T11:08:13.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12859" PostTypeId="1" AcceptedAnswerId="12861" CreationDate="2015-12-14T14:23:18.770" Score="0" ViewCount="371" Body="&lt;p&gt;I'm trying to test if a product has multiple variants AND/OR test for specific product variants. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.variants|length &amp;gt; 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That does not seem to work, even if it is a non-variant product. I understand that even for products without variants there is a 'default' variant, but shouldn't this return false if its a product type without variants given it should have only 1?&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="9" LastEditDate="2015-12-14T14:39:19.673" LastActivityDate="2015-12-14T14:39:19.673" Title="Test for specific or multiple product variants" Tags="&lt;conditional&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12860" PostTypeId="1" CreationDate="2015-12-14T14:26:17.123" Score="1" ViewCount="106" Body="&lt;p&gt;I have a multilingual Craft CMS site working perfectly on my local instance, OS X 10.10.5 running Apache 2.4.16, and so I moved the site to AWS, Amazon Linux 4.1.13-18.26.amzn1.x86_64 also running Apache 2.4.16, however, all of my locales are now case sensitive!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my local I have &#xA;&lt;code&gt;http://&amp;lt;site&amp;gt;/en_us/page&lt;/code&gt; &#xA;on AWS this gives me an error, &lt;code&gt;The requested URL /en_us/page was not found on this server.&lt;/code&gt;, a &lt;strong&gt;hard&lt;/strong&gt; 404. [i.e. not the templated 404 page I have configured in craft for missing content]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I use &lt;code&gt;http://&amp;lt;site&amp;gt;/en_US/page&lt;/code&gt;, i.e. using the ISO standard capitalisation for the country code, I get all of the content perfectly fine. All of my links, and configuration, is of course based upon the lowercase way that Craft normally uses locales, and so the links are all broken on AWS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also noticed that the CP URL is using a querystring on AWS instead of rewriting; i.e. &lt;code&gt;/en_US/index.php?p=admin/settings/locales&lt;/code&gt; instead of &lt;code&gt;en_us/admin/settings/locales&lt;/code&gt; [which may be a related issue]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the rewriting for the CMS works, /en_US/page actually gets the right template and content, I am puzzled as to what I may have missed in configuring my AWS instance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone seen anything like this, or have some pointers?&lt;/p&gt;&#xA;" OwnerUserId="4354" LastActivityDate="2015-12-14T15:32:15.137" Title="Locale case sensititvity on AWS instance" Tags="&lt;localization&gt;&lt;config&gt;&lt;apache&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12861" PostTypeId="2" ParentId="12859" CreationDate="2015-12-14T14:38:52.190" Score="1" Body="&lt;p&gt;&lt;code&gt;product.variants|length&lt;/code&gt; will in fact give you the exact number of variants the product has. If it is giving you an unexpected response, you’re probably just not looking at the right product in the first place. Try outputting the following to create a URL to the product’s edit page in the Control Panel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ product.getCpEditUrl() }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then click on that link from your browser to see the actual product you’re dealing with.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-14T14:38:52.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12862" PostTypeId="1" CreationDate="2015-12-14T14:41:37.850" Score="0" ViewCount="261" Body="&lt;p&gt;I’m trying to merge two query sources (some entries and some categories) but have them ordered by a shared field that is a date field. Here’s what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set classesLocations = craft.entries.section('classes')|merge(craft.categories.group('locations'))`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can group by the field of course, but not sure that helps me with ordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to use &lt;code&gt;.order('startTime')&lt;/code&gt; on the merged object I of course get an error, as they have already been automatically converted to an array to perform the merge rather than remaining as objects. And of course doing the order on both set of objects first doesn’t help, because the merge just tacks the merge on to the end.&lt;/p&gt;&#xA;" OwnerUserId="359" LastEditorUserId="57" LastEditDate="2016-01-05T20:41:23.563" LastActivityDate="2016-01-05T20:41:47.877" Title="Order merged query by shared field" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;ordering&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12863" PostTypeId="2" ParentId="12817" CreationDate="2015-12-14T14:59:04.367" Score="4" Body="&lt;p&gt;Since this is happening from the &lt;code&gt;onOrderComplete&lt;/code&gt; event, the easiest way to get the currently logged in user is with &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#getUser-detail&quot; rel=&quot;nofollow&quot;&gt;UserSessionService::getUser()&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you want to go through the actual Commerce_OrderModel that was passed as a parameter on the event, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = $event-&amp;gt;params['order']-&amp;gt;getCustomer()-&amp;gt;getUser();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Either way, it’s a good idea to verify that &lt;code&gt;$user&lt;/code&gt; gets set to something, just in case:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if ($user) {&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-14T14:59:04.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12864" PostTypeId="1" CreationDate="2015-12-14T15:05:29.897" Score="0" ViewCount="184" Body="&lt;p&gt;I've got the ol’ &lt;code&gt;DeleteStaleTemplateCaches&lt;/code&gt; issue breaking the Craft task manager/process. I've tried switching the offending task over to &lt;code&gt;error&lt;/code&gt; from &lt;code&gt;running&lt;/code&gt; but is still stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on debugging/resolving? Can I just clear out the tasks table?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-01-13T17:57:46.410" Title="DeleteStaleTemplateCaches/tasks error" Tags="&lt;control-panel&gt;&lt;cache&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12865" PostTypeId="1" CreationDate="2015-12-14T15:28:16.937" Score="3" ViewCount="1296" Body="&lt;p&gt;Looking for hints and tips on speeding up and streamlining performance of a Craft site as we prepare for launch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database is approaching 100MB and whilst it is a fairly large and complex build (multiple locales with fairly extensive use of Matrix) this seems fairly excesive and page load times can be slow. Have looked at the Patrick Pohler post but any general, system level wins would be great as site is crawling a fair bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am getting some performance increase through use of {% cache %} tags but then hitting DeleteStaleTemplateCaches issue qiute regularly which is stopping tasks running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-02-04T15:22:22.940" Title="General speed/performance on large Craft build" Tags="&lt;database&gt;&lt;cache&gt;&lt;performance&gt;&lt;speed&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12866" PostTypeId="2" ParentId="12860" CreationDate="2015-12-14T15:32:15.137" Score="2" Body="&lt;p&gt;Oh, I am blind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than delete this embarrassment, I will post this &lt;em&gt;mea culpa&lt;/em&gt; for anyone else that may experience a similar brain fart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had subconsciously typed the directories in &lt;code&gt;html/&lt;/code&gt; using the common POSIX/ISO standard without realising it, so &lt;code&gt;html\en_US\&lt;/code&gt;. Of course, this works on OS X because the OS is case insensitive by default, and does not on Linux, because it is case sensitive. Renaming to all lowercase solved it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the CP rewrites, it was simply that Craft was not picking up that rewrite was correctly enabled. Simply adding &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; fixed that immediately.&lt;/p&gt;&#xA;" OwnerUserId="4354" LastActivityDate="2015-12-14T15:32:15.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12867" PostTypeId="2" ParentId="12847" CreationDate="2015-12-14T15:40:29.650" Score="2" Body="&lt;p&gt;I'd suggest a better approach as detailed here: &lt;a href=&quot;https://experiencehq.net/blog/craft-with-markdown-and-matrix&quot; rel=&quot;nofollow&quot;&gt;https://experiencehq.net/blog/craft-with-markdown-and-matrix&lt;/a&gt;&#xA;Once you go down the &quot;structured content&quot; route you'll never look back, I promise you :)&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-12-14T15:40:29.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12868" PostTypeId="2" ParentId="12865" CreationDate="2015-12-14T15:45:17.070" Score="4" Body="&lt;p&gt;We are constantly seeing the deleting stale template cache timeout problem on our servers - try increasing the time PHP can execute for to something very long. It seems like clearing the caches counts as one PHP request and not a bunch of tasks, so they can time out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good use of cache tags helps, and caching globally can also help - but other than that all I've found to make complex Craft builds faster is using something like Varnish or nginx. Neither of which are simple and both of which I've avoided so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP7 will help a lot, but I'm not aware of any distro that has PHP7 available yet.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-14T15:45:17.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12869" PostTypeId="1" AcceptedAnswerId="12914" CreationDate="2015-12-14T15:49:46.343" Score="0" ViewCount="183" Body="&lt;p&gt;I'm looking into a project another developer has done, and after submission of a front-end form the system is ignoring the redirect set in the template. The form is being submitted and saved correctly though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any ideas why this would be?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;download-subscribe&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/downloads/available-downloads/&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;11&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;field name&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;fields[firstName]&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    ...&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Possible complications, which i expect aren't a problem but might be worth knowing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The form is in an include rather than in the template directly&lt;/li&gt;&#xA;&lt;li&gt;The form is being spat out mid-way through a matrix loop (i.e., if the loop is count 2 then first spit out the form).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-17T11:02:39.110" Title="Guest Entries ignores redirect field?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12870" PostTypeId="1" AcceptedAnswerId="12876" CreationDate="2015-12-14T16:11:55.260" Score="9" ViewCount="2940" Body="&lt;p&gt;Does anyone have any thoughts on automating the implementation Google's new AMP article markup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.ampproject.org/docs/get_started/create/basic_markup.html&quot;&gt;https://www.ampproject.org/docs/get_started/create/basic_markup.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see:&#xA;&lt;a href=&quot;http://venturebeat.com/2015/12/09/google-will-start-sending-search-traffic-to-fast-loading-amp-news-articles-in-february-2016/&quot;&gt;Google will start sending search traffic to fast-loading AMP news articles in February 2016&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4343" LastEditorUserId="1016" LastEditDate="2016-03-11T16:24:48.037" LastActivityDate="2017-06-14T16:49:02.293" Title="Approaching Google AMP" Tags="&lt;templating&gt;&lt;seo&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12871" PostTypeId="1" CreationDate="2015-12-14T16:39:53.757" Score="0" ViewCount="397" Body="&lt;p&gt;I am currently using FeedMe to import json data every night but I need to delete all entries before doing so to make sure that any orphaned entries are removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to remove all entries within a section?&lt;/p&gt;&#xA;" OwnerUserId="4479" LastEditorUserId="125" LastEditDate="2015-12-14T23:23:25.133" LastActivityDate="2015-12-14T23:23:25.133" Title="Is there a way to delete all entries within a section?" Tags="&lt;entries&gt;&lt;deletion&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12873" PostTypeId="1" AcceptedAnswerId="12875" CreationDate="2015-12-14T16:51:14.547" Score="0" ViewCount="81" Body="&lt;p&gt;I recently had a craft update fail when moving from 2.4x to 2.5x. This was probably caused because the linux user craft was using did not have the proper permissions. This is all good and fine. Craft created a DB backup before updating and this is where I am having a very strange issue. This DB backup has tons of duplicates, seemingly on every table. Importing the database always ends in Duplicate entry '1' for key 'PRIMARY'. The dump is also trying to add the same tables multiple times. The database I am importing also into has nothing in it. Has anyone run into this issue? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a partial database dump:&#xA;&lt;a href=&quot;http://pastebin.com/FRgp1FPy&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/FRgp1FPy&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you for example look at line 100 and 135, you can see that the dump has duplicate primary keys in the table craft_assetfiles. This dump also shows that the craft_assetfiles table is being added twice and with different data each time.&lt;/p&gt;&#xA;" OwnerUserId="4480" LastEditorUserId="4480" LastEditDate="2015-12-14T17:35:57.643" LastActivityDate="2015-12-14T18:22:41.683" Title="Database Backup Contains Perplexing Number Of Duplicates" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12874" PostTypeId="2" ParentId="12864" CreationDate="2015-12-14T17:08:15.990" Score="1" Body="&lt;p&gt;You can use this to help debug why tasks sometimes get &quot;stuck&quot;: &lt;a href=&quot;https://craftcms.com/help/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/help/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-14T17:08:15.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12875" PostTypeId="2" ParentId="12873" CreationDate="2015-12-14T18:22:41.683" Score="1" Body="&lt;p&gt;It's because (at least for the one table you posted) your table is missing its foreign keys, which is responsible for maintaining uniqueness on their referenced columns.  For example, the &lt;code&gt;asset_files&lt;/code&gt; table should have this as part of its DDL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CONSTRAINT `craft_assetfiles_folderId_fk` FOREIGN KEY (`folderId`) REFERENCES `craft_assetfolders` (`id`) ON DELETE CASCADE,&#xA;CONSTRAINT `craft_assetfiles_id_fk` FOREIGN KEY (`id`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE,&#xA;CONSTRAINT `craft_assetfiles_sourceId_fk` FOREIGN KEY (`sourceId`) REFERENCES `craft_assetsources` (`id`) ON DELETE CASCADE&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can happen if the database was imported to a MySQL box that only had MyISAM (which doesn't support foreign keys) and the keys will silently get dropped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or we've seen it happen from a failed import/export whether from a script or a MySQL client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, you can use this script to try and help restore the missing foreign keys: &lt;a href=&quot;https://github.com/pixelandtonic/craft-fixfks&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/craft-fixfks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware you still might have to do some manual data cleanup from duplicated/inconsistent data.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-14T18:22:41.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12876" PostTypeId="2" ParentId="12870" CreationDate="2015-12-14T19:10:11.990" Score="15" Body="&lt;p&gt;You're asking kind of a loaded question but as far as Craft is concerned, you're in a good position to spit out exactly what you need as far as markup and styles go. AMP is more or less just a small subset of HTML.&lt;/p&gt;&#xA;&lt;p&gt;When compared to something like WordPress, Craft is going to give you all the tools necessary to spit out an AMP page just by virtue of it doesn't dictate layout and styling nor include any extra fluff. And it provides easy routing features to make it easy to make different &amp;quot;versions&amp;quot;.&lt;/p&gt;&#xA;&lt;h1&gt;Different Versions / Different Routes&lt;/h1&gt;&#xA;&lt;p&gt;Depending on how your site is setup, you'll want &lt;a href=&quot;http://www.sitepoint.com/an-introduction-to-googles-accelerated-mobile-pages-amp/&quot; rel=&quot;noreferrer&quot;&gt;different versions&lt;/a&gt; of your content—one regular and one for AMP... not unlike the old &lt;code&gt;m&lt;/code&gt; dot sites. (Taking it back to the old school WAP era I guess...)&lt;/p&gt;&#xA;&lt;p&gt;Let's say you have a section called &lt;code&gt;News&lt;/code&gt;.  If your entries URL Format looks like: &lt;code&gt;http://site/news/slug/&lt;/code&gt;, you might want to have the AMP version look like &lt;code&gt;http://site/news/slug/amp&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One way to do that in Craft is to setup a route. You can do that in Settings -&amp;gt; Routes -&amp;gt; New Route.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KRdUt.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KRdUt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;That will load the &lt;code&gt;_amp.html&lt;/code&gt; template inside a &lt;code&gt;news&lt;/code&gt; folder. You'll have to do a little extra work to tell Craft where to pull the entry from since routes only load templates by default. Since we used the &lt;code&gt;slug&lt;/code&gt; variable in our routes, we can use that to grab the entry from the news section and also set the &lt;code&gt;entry&lt;/code&gt; variable.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &amp;quot;_layoutamp&amp;quot; %}&#xA;&#xA;{% set entry = craft.entries.section('news').slug(slug)[0] %}&#xA;&#xA;{% block content %}&#xA;  ... rest of your content&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The AMP docs start with a &lt;a href=&quot;https://www.ampproject.org/docs/get_started/create/basic_markup.html&quot; rel=&quot;noreferrer&quot;&gt;simple skeleton&lt;/a&gt;. I used &lt;code&gt;{% extends &amp;quot;_layoutamp&amp;quot; %}&lt;/code&gt; in our &lt;code&gt;_amp&lt;/code&gt; template so we need to make a  ``_layoutamp.html&amp;quot; file to match inside Craft's templates folder.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;   {# _layoutamp.html #}&#xA;    &amp;lt;!doctype html&amp;gt;&#xA;    &amp;lt;html amp lang=&amp;quot;en&amp;quot;&amp;gt;&#xA;      &amp;lt;head&amp;gt;&#xA;        &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&#xA;        &amp;lt;title&amp;gt;{{entry.title}}&amp;lt;/title&amp;gt;&#xA;        &amp;lt;link rel=&amp;quot;canonical&amp;quot; href=&amp;quot;{{entry.url}}&amp;quot; /&amp;gt;&#xA;        &amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width,minimum-scale=1,initial-scale=1&amp;quot;&amp;gt;&#xA;        &amp;lt;script type=&amp;quot;application/ld+json&amp;quot;&amp;gt;&#xA;          {&#xA;            &amp;quot;@context&amp;quot;: &amp;quot;http://schema.org&amp;quot;,&#xA;            &amp;quot;@type&amp;quot;: &amp;quot;NewsArticle&amp;quot;,&#xA;            &amp;quot;headline&amp;quot;: &amp;quot;{{entry.title}}&amp;quot;,&#xA;            &amp;quot;datePublished&amp;quot;: &amp;quot;{{entry.dateCreated.iso8601()}}&amp;quot;,&#xA;            &amp;quot;image&amp;quot;: [&#xA;              &amp;quot;logo.jpg&amp;quot;&#xA;            ]&#xA;          }&#xA;        &amp;lt;/script&amp;gt;&#xA;&amp;lt;style amp-boilerplate&amp;gt;body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}&amp;lt;/style&amp;gt;&amp;lt;noscript&amp;gt;&amp;lt;style amp-boilerplate&amp;gt;body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}&amp;lt;/style&amp;gt;&amp;lt;/noscript&amp;gt;&#xA;        &amp;lt;script async src=&amp;quot;https://cdn.ampproject.org/v0.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;      &amp;lt;/head&amp;gt;&#xA;      &amp;lt;body&amp;gt;&#xA;        {% block content %}&#xA;           {# brings in the content from the _amp.html content block #}&#xA;        {% endblock %}&#xA;      &amp;lt;/body&amp;gt;&#xA;    &amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;AMP &lt;a href=&quot;https://www.ampproject.org/docs/get_started/create/basic_markup.html&quot; rel=&quot;noreferrer&quot;&gt;recommends&lt;/a&gt; some metadata near the top, in the form of JSON. Easy enough to spit out the required fields in Twig.&lt;/p&gt;&#xA;&lt;h1&gt;&amp;quot;Linking&amp;quot; to an AMP page&lt;/h1&gt;&#xA;&lt;p&gt;You'll notice a &lt;code&gt;&amp;lt;link rel=&amp;quot;canonical&amp;quot; href=&amp;quot;{{entry.url}}&amp;quot;&amp;gt;&lt;/code&gt; in that file as well to tell Google your main version is here.&lt;/p&gt;&#xA;&lt;p&gt;On your &amp;quot;normal&amp;quot; page, you'll want to add a reference to the AMP page too. (I also like to set the &lt;a href=&quot;https://yoast.com/rel-canonical/&quot; rel=&quot;noreferrer&quot;&gt;canonical&lt;/a&gt; version as well for good measure.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&amp;quot;canonical&amp;quot; href=&amp;quot;{{entry.url}}&amp;quot;&amp;gt;&#xA;&amp;lt;link rel=&amp;quot;amphtml&amp;quot; href=&amp;quot;{{entry.url}}/amp&amp;quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That will tell Google the AMP version is at the URL.&lt;/p&gt;&#xA;&lt;h1&gt;Anything else?&lt;/h1&gt;&#xA;&lt;p&gt;Pretty much the rest is up to you. AMP is pretty easy to setup but you still need to use their &lt;a href=&quot;https://www.smashingmagazine.com/2016/02/everything-about-google-accelerated-mobile-pages/#amp-html-tags&quot; rel=&quot;noreferrer&quot;&gt;custom tags&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Most notably, things like images and videos need to use custom tags like &lt;code&gt;amp-img&lt;/code&gt; and &lt;code&gt;amp-video&lt;/code&gt;, so the AMP runtime can intercept the loading of those assets and handle them.&lt;/p&gt;&#xA;&lt;p&gt;Will be interesting to see how this affects page rank moving forward. Google confirmed it's &lt;a href=&quot;http://searchengineland.com/google-amp-not-yet-a-search-ranking-signal-243498&quot; rel=&quot;noreferrer&quot;&gt;not a ranking signal&lt;/a&gt; (yet) but that doesn't mean it won't be in the future.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-03-11T16:18:22.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12877" PostTypeId="2" ParentId="12710" CreationDate="2015-12-14T19:47:04.377" Score="3" Body="&lt;p&gt;Currently no, however the ability to edit completed order details is on the list for 1.1.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-14T19:47:04.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12878" PostTypeId="2" ParentId="12871" CreationDate="2015-12-14T21:52:59.380" Score="1" Body="&lt;p&gt;I think you're looking for the &lt;code&gt;Delete&lt;/code&gt; Duplication Handling option. From the &lt;a href=&quot;https://github.com/engram-design/FeedMe#duplication-handling&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Delete all existing entries in this section, adding only entries from&#xA;  this feed. Be careful. Use case: Events, or when only data from the&#xA;  current feed is required.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&quot;I want only the entries from this feed in this section.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="632" LastActivityDate="2015-12-14T21:52:59.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12879" PostTypeId="2" ParentId="12561" CreationDate="2015-12-15T01:05:35.353" Score="1" Body="&lt;p&gt;I'm going to guess that there is some sort of CSS or JS conflict which is causing this peculiar behavior. Smart Map must be bumping up against some other styling on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check through your existing CSS/JS to see if you can find the source of the conflict.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-15T01:05:35.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12880" PostTypeId="2" ParentId="12850" CreationDate="2015-12-15T06:35:42.573" Score="1" Body="&lt;p&gt;My own answer... for anyone interested, the Memcached extension in my composer.json file wasn't being picked up by Heroku on deploy. So I updated my composer.json file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;ext-mbstring&quot;: &quot;*&quot;,&#xA;    &quot;ext-imagick&quot;: &quot;*&quot;,&#xA;    &quot;ext-memcached&quot;: &quot;*&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then ran composer update to update the composer.lock file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When deploying to Heroku, the composer.lock file is very similar to the Gemfile.lock in Rails - telling Heroku exactly what to install with the deployment. Now the Memcached extension is being installed by Heroku and my session problem has been solved.&lt;/p&gt;&#xA;" OwnerUserId="4388" LastActivityDate="2015-12-15T06:35:42.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12882" PostTypeId="2" ParentId="7135" CreationDate="2015-12-15T11:28:36.493" Score="6" Body="&lt;p&gt;OK, finally answering my own question here as it seems to not be an issue with the latest Craft 2.5 builds when &lt;code&gt;devMode&lt;/code&gt; is turned off, but is still an issue when &lt;code&gt;devMode&lt;/code&gt; is on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell its something to do with the Craft logging tool spiralling out of control, but thats as far as I got.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2015-12-15T11:28:36.493" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12883" PostTypeId="1" CreationDate="2015-12-15T12:45:57.610" Score="0" ViewCount="1187" Body="&lt;p&gt;Does anyone know of a way to send simple php mail from a twig template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something we can use like... {% mail 'Message', entry.userEmail %} or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be good to not have to pre-define the content in a plugin.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2015-12-15T14:10:12.703" Title="Sending email from twig template" Tags="&lt;templating&gt;&lt;emails&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12884" PostTypeId="1" AcceptedAnswerId="12906" CreationDate="2015-12-15T13:44:14.427" Score="1" ViewCount="873" Body="&lt;p&gt;I am trying to install Craft CMS 2.5 on a Windows 10 machine using WAMP 2.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just downloaded both Craft and WAMP this morning — so both are fresh installs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have done everything properly, but when I navigate to &lt;code&gt;localhost/sitename/public&lt;/code&gt; I get the following message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Service Unavailable&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Our site is temporarily unavailable. Please try again later.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I try navigating to &lt;code&gt;localhost/sitename/public/admin&lt;/code&gt; OR &lt;code&gt;localhost/sitename/admin&lt;/code&gt; I get the following message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Not Found&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The requested URL /sitename/admin was not found on this server.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;These are the steps I took when setting up:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Created a folder in &lt;code&gt;wamp/www&lt;/code&gt; called &lt;code&gt;sitename&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copied the &lt;code&gt;craft&lt;/code&gt; and &lt;code&gt;public&lt;/code&gt; folders into the &lt;code&gt;sitename&lt;/code&gt; folder&lt;/li&gt;&#xA;&lt;li&gt;Changed &lt;code&gt;htaccess&lt;/code&gt; to &lt;code&gt;.htaccess&lt;/code&gt; (using windows command line)&lt;/li&gt;&#xA;&lt;li&gt;Created database in phpmyadmin&lt;/li&gt;&#xA;&lt;li&gt;Updated &lt;code&gt;db.php&lt;/code&gt; in &lt;code&gt;craft/config&lt;/code&gt; folder&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(the only change I had to make was to add the database name — I left server as localhost, user as root and password blank.  I did change the tablePrefix to five different letters — i.e., no numbers or special characters)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did NOT change the permissions on any of the app, config or storage folders for the simple reason that I do not know how to do that on Windows.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless the permissions are the problem, then I do not know why I am having this problem.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2309" LastEditorUserId="3951" LastEditDate="2018-02-21T21:30:13.263" LastActivityDate="2018-02-21T21:30:13.263" Title="Trouble Installing Craft 2.5 on Windows 10 Using Wamp 2.5" Tags="&lt;install&gt;&lt;installation&gt;&lt;windows&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12885" PostTypeId="2" ParentId="12883" CreationDate="2015-12-15T14:10:12.703" Score="1" Body="&lt;p&gt;You could create a simple plugin with just a Template Variable that sends the mail: &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if I'd put this kind of logic in templates though.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2015-12-15T14:10:12.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12886" PostTypeId="2" ParentId="12840" CreationDate="2015-12-15T16:06:39.930" Score="7" Body="&lt;p&gt;&lt;code&gt;$entry-&amp;gt;postDate&lt;/code&gt; will give you the &lt;code&gt;postDate&lt;/code&gt; property of the &lt;code&gt;EntryModel&lt;/code&gt;, which itself is a &lt;code&gt;DateTime&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The JSON transformer will do its best to convert that object to JSON by returning its visible properties, which produces the JSON object in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Angular has built-in date filters, but it requires the input data to be in a recognized format. So, what you really want in your JSON - rather than a representation of the whole &lt;code&gt;DateTime&lt;/code&gt; object - is a more primitive value that Angular knows how to interpret as a date: You need a &lt;em&gt;timestamp&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, you can easily access the timestamp of the PHP &lt;code&gt;DateTime&lt;/code&gt; object in your transformer, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'postDate' =&amp;gt; $entry-&amp;gt;postDate-&amp;gt;getTimestamp() * 1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(We're multiplying the timestamp by 1000 because Angular wants the timestamp to represent milliseconds; PHP gives us the timestamp in seconds.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in Angular you can use the date filter to change the format as desired, which in your front-end code would look something like: &lt;code&gt;{{ note.postDate | date:'medium' }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="130" LastEditDate="2015-12-17T18:40:43.213" LastActivityDate="2015-12-17T18:40:43.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12887" PostTypeId="1" CreationDate="2015-12-15T16:11:06.750" Score="0" ViewCount="268" Body="&lt;p&gt;Pulling hair out here so looking for divine inspiration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to list a set of events/entries grouped by day. This is fine when all the dates are organised by an event date but when we introduce a date span (event start date and event end date) am struggling to work out how to get days that are not specifically occurring on a set day to appear, eg if starts Tuesday and ends Thursday to show on Wednesday. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get this working with an arbitrary range, eg to show all the events across a certain month but this gets considerably more complicated introducing pagination when no date range is specified. Ideally need to paginate by dates but pagination requires the ElementCriteriaModel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how might go about this as banging head against a brick wall …&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-15T17:15:35.863" Title="Showing pagination for a date range of entries" Tags="&lt;elementcriteriamodel&gt;&lt;datetime&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12888" PostTypeId="2" ParentId="12887" CreationDate="2015-12-15T16:37:35.373" Score="3" Body="&lt;p&gt;It's difficult to give specific code help without seeing some input/output examples, but here's a go-by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can say that an event &lt;em&gt;occurs&lt;/em&gt; during a date range if:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The event begins before the date range ends&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;and&lt;/strong&gt;, the event ends after the date range begins&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, the pseudocode looks something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prepare a DateTime representation of the range rangeStartTime (e.g. today at 00:00)&lt;/li&gt;&#xA;&lt;li&gt;Prepare a DateTime representation of the range rangeEndTime (e.g. tomorrow at 00:00)&lt;/li&gt;&#xA;&lt;li&gt;For each event, check if the criteria are satisfied: &lt;code&gt;eventStartTime &amp;lt; dayEndTime&lt;/code&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;code&gt;eventEndTime &amp;gt; dayStartTime&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;If the criteria is satisfied, include the event.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, let's say each of my Event entries has &lt;code&gt;eventStartDate&lt;/code&gt; and &lt;code&gt;eventEndDate&lt;/code&gt; fields, and I want to list out all the events that &lt;em&gt;occur&lt;/em&gt; today &lt;em&gt;(i.e. including, for example, events that started yesterday and end tomorrow)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could do something like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateRangeStart = today|date('Y-m-d') %}&#xA;&#xA;{% set dateRangeEnd = tomorrow|date('Y-m-d') %}&#xA;&#xA;{% set eventsInRange = craft.entries&#xA;    .section('events')&#xA;    .eventStartDate('&amp;lt;'~dateRangeEnd)&#xA;    .eventEndDate('&amp;gt;'~dateRangeStart)&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;eventsInRange&lt;/code&gt; is an &lt;em&gt;ElementCriteriaModel&lt;/em&gt; that finds all Event entries in our date range. And since it's an &lt;em&gt;ElementCriteriaModel&lt;/em&gt;, you can plug it into the &lt;code&gt;{% paginate %}&lt;/code&gt; tag to get paginated results according to whatever other parameters you desire.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2015-12-15T16:48:16.540" LastActivityDate="2015-12-15T16:48:16.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12889" PostTypeId="1" CreationDate="2015-12-15T16:53:49.023" Score="1" ViewCount="1006" Body="&lt;p&gt;Single page website. Navigation based on a Structure section (anchor links). Entries depend on entryTypes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set each section ID with for anchor navigation #}&#xA;{% for page in craft.entries.section('pages') %}&#xA;&amp;lt;section id =&quot;{{ page.slug }}&quot;&amp;gt;&#xA;&#xA;    {# check the slug to get the Matrix entries related to the (html) section ID #}&#xA;    {% if page.slug == 'home' %}&#xA;        {# get the entries for the entry.type #}&#xA;        {% set entries = craft.entries.type('pagesHome') %}&#xA;            {# loop through the block types and entries #}&#xA;            {% for block in page.matrixFieldHandle.type('matrixBlockHandle') %}&#xA;                {{ block.title }}&#xA;            {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    {# and so on.... #}&#xA;    {% if page.slug == 'about' %}&#xA;        ......&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Questions: am I setting up this single page website in a too complicated way with too many DB queries? &#xA;Thanks for suggestions!&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="785" LastEditDate="2015-12-15T17:44:22.717" LastActivityDate="2017-02-05T15:42:56.450" Title="Loop through structure entry types and matrix blocks" Tags="&lt;matrix&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12890" PostTypeId="2" ParentId="12889" CreationDate="2015-12-15T17:03:48.513" Score="1" Body="&lt;p&gt;If I was building a single page website I might create a matrix field with different blocks for each &quot;page&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Navigation #}&#xA;{% for block in entry.contentBlock %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ block.slug }}&quot;&amp;gt;{{ block.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Content #}&#xA;{% for block in entry.contentBlock %}&#xA;   &amp;lt;section id=&quot;{{ block.slug }}&quot;&amp;gt;&#xA;     {{ block.body }}&#xA;   &amp;lt;/section&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will allow someone to re-order &quot;pages&quot; easily under one entry. You can also create several different block types with different fields in if these &quot;pages&quot; needed to be different.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2015-12-15T17:03:48.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12891" PostTypeId="2" ParentId="12887" CreationDate="2015-12-15T17:15:35.863" Score="0" Body="&lt;p&gt;Thanks @Michael - the difficulty is always going to be introducing some kind of pagination across dates rather than entries. Ended up hacking something together that imitates pagination. Happy to hear any suggestions on improvement, especially in terms of performance/efficiency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/cole007/8fbe1247791985aea3e9&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/cole007/8fbe1247791985aea3e9&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-15T17:15:35.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12892" PostTypeId="2" ParentId="12804" CreationDate="2015-12-15T17:41:01.033" Score="1" Body="&lt;p&gt;Turns out this had to do with imagemagick (or one of its subpackages) not being compiled in a way that Craft 2.5 thinks fondly of, which we discovered after editing the bootstrap to turn off all custom error-logging.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2015-12-15T17:41:01.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12893" PostTypeId="1" AcceptedAnswerId="12894" CreationDate="2015-12-15T18:00:53.430" Score="3" ViewCount="81" Body="&lt;p&gt;Does &lt;code&gt;craft()-&amp;gt;cache-&amp;gt;&lt;/code&gt; have a way of returning all the cache records? &#xA;I need to delete some caches, but only if the key begins with a certain prefix, “&lt;code&gt;ranking__getAthletePoints_&lt;/code&gt;”. I won’t know the numbers following in the key names. If I could grab all of them, I assume I could check against the key names with something like &lt;code&gt;startsWith()&lt;/code&gt; and delete the correct caches that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very much out of my element with php &amp;amp; plugin development! Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2015-12-15T18:29:48.713" Title="Return all cache records, delete caches with prefixed keys" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12894" PostTypeId="2" ParentId="12893" CreationDate="2015-12-15T18:19:16.023" Score="1" Body="&lt;p&gt;Not without some brute-force cracking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The keys you pass into &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CFileCache&quot; rel=&quot;nofollow&quot;&gt;CFileCache's&lt;/a&gt; &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CCache#set-detail&quot; rel=&quot;nofollow&quot;&gt;set&lt;/a&gt; and &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CCache#get-detail&quot; rel=&quot;nofollow&quot;&gt;get&lt;/a&gt; methods are an md5 hash of your key prepended with your Craft installation's &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;appId&lt;/a&gt; (which by default is a randomly generated string).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with a key of &lt;code&gt;testKey&lt;/code&gt;, that could end up as a value of &lt;code&gt;3f8b3c45a9c6f395d02b930f18910a92&lt;/code&gt;.  For CFileCache, that value ends up being the file name of the cache file and gets put in &lt;code&gt;craft/storage/runtime/cache/3f8b3c45a9c6f395d02b930f18910a92.bin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later, when you call get and pass in the key of &lt;code&gt;testKey&lt;/code&gt;, it goes through the same process and checks to see if a file named &lt;code&gt;3f8b3c45a9c6f395d02b930f18910a92.bin&lt;/code&gt; exists.  If it does, it knows there is a match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there's no way to find that match without knowing the key ahead of time (unless you brute-force cracked md5, which is doable, but probably not practical for your use-case).&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-15T18:29:48.713" LastActivityDate="2015-12-15T18:29:48.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12895" PostTypeId="2" ParentId="10134" CreationDate="2015-12-15T19:13:37.527" Score="3" Body="&lt;p&gt;You wanna escape the product name before replacing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ product.name|escape|replace({'®': '&amp;lt;sup&amp;gt;®&amp;lt;/sup&amp;gt;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4483" LastActivityDate="2015-12-15T19:13:37.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12896" PostTypeId="1" CreationDate="2015-12-15T19:39:49.457" Score="0" ViewCount="96" Body="&lt;p&gt;I'm trying to follow &lt;a href=&quot;https://snipcart.com/blog/integrating-snipcart-with-craft-cms-a-child-s-play&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;, but I'm stuck. I create the &lt;code&gt;layout.html&lt;/code&gt; file and the &lt;code&gt;index.html&lt;/code&gt; and it's still not working. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gqxwd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gqxwd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bct8S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bct8S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kvwyz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kvwyz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4484" LastEditorUserId="4484" LastEditDate="2015-12-15T23:31:35.727" LastActivityDate="2015-12-15T23:31:35.727" Title="Help with integrating Snipcart" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12898" PostTypeId="1" AcceptedAnswerId="12899" CreationDate="2015-12-15T21:21:03.280" Score="2" ViewCount="393" Body="&lt;p&gt;I need to be able to assign and output my own custom labels for the fields that are in the shipping/billing addresses during checkout in Craft Commerce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already done so on the form like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countries = craft.commerce.countriesList %}&#xA;{% set states = craft.commerce.statesArray %}&#xA;{% set addressFields = {&#xA;    firstName: {&#xA;        label: 'First Name',&#xA;        required: 1,&#xA;    },&#xA;    lastName: {&#xA;        label: 'Last Name',&#xA;        required: 1,&#xA;    },&#xA;    address1: {&#xA;        label: 'Address',&#xA;        required: 1,&#xA;    },&#xA;    address2: {&#xA;        label: 'Address 2',&#xA;        required: 1,&#xA;    },&#xA;    city: {&#xA;        label: 'City',&#xA;        required: 1,&#xA;    },&#xA;    zipCode: {&#xA;        label: 'Zip Code',&#xA;        required: 1,&#xA;    },&#xA;    phone: {&#xA;        label: 'Phone',&#xA;        required: 1,&#xA;    },&#xA;    alternativePhone: {&#xA;        label: 'Alternative Phone',&#xA;        required: 1,&#xA;    },&#xA;} %}&#xA;&#xA;&#xA;{% set modelName = modelName is defined ? modelName : 'address' %}&#xA;{% set model = address is defined ? address : null %}&#xA;&#xA;&amp;lt;div class=&quot;addressBox {{ modelName }}&quot;&amp;gt;&#xA;    {% for key,options in addressFields %}&#xA;        &amp;lt;div class=&quot;form-group col-md-6 {% if model and model.getErrors(key) %}has-error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;{{ modelName }}-{{ key }}&quot;&amp;gt;{{ options.label|t }}{{ options.required ? '*' : '' }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-{{ key }}&quot; class=&quot;u-full-width&quot; name=&quot;{{ modelName }}[{{ key }}]&quot;&#xA;                   value=&quot;{{ model ? model[key] : '' }}&quot;&amp;gt;&#xA;            {% if model and model.getErrors(key) %}&#xA;                &amp;lt;span class=&quot;flash alert-warning&quot;&amp;gt;{{ model.getErrors(key)|join }}&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works like a charm. I need to however also be able to output it with my custom labels as well. Here is my currently template area, i'm not sure how i can get my custom labels in here. Please advise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for address in addresses %}&#xA;     {% for key,value in address.attributes() %}&#xA;&#xA;          {% switch key %}&#xA;&#xA;               {% case &quot;id&quot; %} {# ingore #}&#xA;               {% case &quot;customerId&quot; %} {# ingore #}&#xA;&#xA;               {% default %}&#xA;&#xA;               {% if value %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                         &amp;lt;h3 class=&quot;cart-product-details&quot;&amp;gt;{{ key|title }}:&#xA;                              &amp;lt;span class=&quot;address-option&quot; data-key=&quot;{{ key }}&quot; data-value=&quot;{{ value }}&quot;&amp;gt;&#xA;                                   {{ key == 'countryId' ? address.countryText : (key == 'stateId' ? address.stateText : value) }}&#xA;                              &amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;               {% endif %}&#xA;&#xA;          {% endswitch %}&#xA;&#xA;     {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastActivityDate="2015-12-15T21:27:32.897" Title="Custom Labels for Address Fields Craft Commerce" Tags="&lt;form&gt;&lt;ecommerce&gt;&lt;plugin-craftcommerce&gt;&lt;label&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12899" PostTypeId="2" ParentId="12898" CreationDate="2015-12-15T21:27:32.897" Score="2" Body="&lt;p&gt;I think you're looking for the attribute function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = attribute(addressFields, key) %}&#xA;{{ field.label }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2015-12-15T21:27:32.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12900" PostTypeId="2" ParentId="12896" CreationDate="2015-12-15T21:35:23.557" Score="1" Body="&lt;p&gt;I'll be the first to admit, I know nothing about snipcart so my answer could be way off.&lt;/p&gt;&#xA;&lt;p&gt;Since your site works without snipcart, that means you are here:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Once the installation is completed, simply login into the Craft admin and go to Settings. You will have to create the fields that will be required to define a Snipcart product. In the settings, click on Fields and create 2 new fields:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Once you have those fields created, you will need to create a new section - which is a &lt;strong&gt;Channel&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Name: Store&lt;/p&gt;&#xA;&lt;p&gt;Handle: store&lt;/p&gt;&#xA;&lt;p&gt;Section Type: Channel&lt;/p&gt;&#xA;&lt;p&gt;Uncheck Entries in this section have their own URLs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Once you have that done, and the entry fields created/updated as they suggest, I think where you went wrong is with the actual &lt;code&gt;layout.html&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You need to include Snipcart’s JavaScript file and jQuery if it is not already included. Use the default CSS theme that you need to include as well.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What that is telling me is to open &lt;code&gt;layout.html&lt;/code&gt; that I downloaded with snipcart and copy/paste all of the appropriate javascript into this file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/path-to-your-project/craft/templates/_layout.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That's the default layout template that Craft uses. So by pasting all of the necessary javascript &amp;amp; css into that file, each entry will have access to it.&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-12-15T21:35:23.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12901" PostTypeId="2" ParentId="6708" CreationDate="2015-12-16T05:57:26.963" Score="1" Body="&lt;p&gt;Might also be worth checking if your Craft is having issues connecting to your DB. I got the same message when I launched a new instance on another domain, but forgot to setup the config.&lt;/p&gt;&#xA;" OwnerUserId="1141" LastActivityDate="2015-12-16T05:57:26.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12902" PostTypeId="1" CreationDate="2015-12-16T09:41:12.187" Score="0" ViewCount="309" Body="&lt;p&gt;I want to use a front-end form for certain users to post entries. However, the entry layout contains a Matrix field. How can make a field where people can enter content in a matrix row? Suppose I have a matrix field called &lt;code&gt;bodyNews&lt;/code&gt; containing a text field called &lt;code&gt;text&lt;/code&gt;. I thought I could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea id=&quot;body&quot; name=&quot;fields[bodyNews][text]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't seem to work. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2015-12-16T09:41:12.187" Title="How can I enter data in a matrix field with a front-end form?" Tags="&lt;frontend&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2015-12-16T17:21:44.040" ContentLicense="CC BY-SA 3.0" />
  <row Id="12903" PostTypeId="1" AcceptedAnswerId="12905" CreationDate="2015-12-16T13:42:20.293" Score="0" ViewCount="57" Body="&lt;p&gt;The new position of the Control Panel navigation on the left side in Craft CMS 2.5 needs so much space and looks kind of wrong to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to position it on the top like in pre 2.5 versions?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2015-12-16T14:18:41.153" Title="Navigation position in Control Panel Craft CMS 2.5" Tags="&lt;control-panel&gt;&lt;navigation&gt;&lt;position&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12904" PostTypeId="1" CreationDate="2015-12-16T13:58:35.450" Score="1" ViewCount="2386" Body="&lt;p&gt;When creating, editing or deleting anything in CP the notification with &quot;An unknown error occurred&quot; is appended at the top. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I check the console and I get a 500 on these: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/index.php/admin/actions/tasks/runPendingTasks&#xA;/index.php/admin/actions/tasks/getRunningTaskInfo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nothing is in the logs that I can see.&lt;/p&gt;&#xA;" OwnerUserId="4487" LastEditorUserId="57" LastEditDate="2015-12-16T18:25:51.513" LastActivityDate="2018-11-08T20:10:37.843" Title="An unknown error occurred all the time" Tags="&lt;error-message&gt;&lt;error&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12905" PostTypeId="2" ParentId="12903" CreationDate="2015-12-16T14:18:41.153" Score="2" Body="&lt;p&gt;I wouldn't have thought so, it's to facilitate the new Commerce plugin (or at least that was the main driver) and ultimately is far more expandable over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new interface is fluid too, rather than the previous fixed version. It took a little while to get used to but is now much better suited to the content input.&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2015-12-16T14:18:41.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12906" PostTypeId="2" ParentId="12884" CreationDate="2015-12-16T15:41:33.637" Score="1" Body="&lt;p&gt;Alec Ritson's comment solved the problem.  His advice was to try &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;localhost/sitename/public/index.php/admin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words, I had to add index.php to the URL (after public but before admin) and then everything worked fine.&lt;/p&gt;&#xA;" OwnerUserId="2309" LastActivityDate="2015-12-16T15:41:33.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12907" PostTypeId="1" CreationDate="2015-12-16T16:45:39.947" Score="6" ViewCount="511" Body="&lt;p&gt;Right now, we have a matrix field called post body which has all our content, we have text, image, video etc... In our image block we have 2 fields, An asset field called &lt;code&gt;image&lt;/code&gt; &amp;amp; a plain text field called &lt;code&gt;caption&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I first set this site up, admittedly I didn't plan it properly at all and now we allow several images to be uploaded in the single field but we want to be able to set individual captions for each of the images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is the right way to phrase the question, how would I go about moving the contents of postbody.block.caption to postbody.block.image.caption for every image in that field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is going to be a once off migration of content so I'm not sure if it warrants a plugin, would I be able to do this with a quick &amp;amp; dirty sql/yii query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have so far &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$craft = require '../craft/app/bootstrap.php';&#xA;&#xA;$criteria = $craft-&amp;gt;elements-&amp;gt;getCriteria(Craft\ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;fieldId = $craft-&amp;gt;fields-&amp;gt;getFieldByHandle('postBody')-&amp;gt;id;&#xA;$criteria-&amp;gt;type = &quot;image&quot;;&#xA;$criteria-&amp;gt;limit = null;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&#xA;foreach ($blocks as $block) {&#xA;    if ($block-&amp;gt;caption) {&#xA;        foreach($block-&amp;gt;image as $image) {&#xA;            $block-&amp;gt;image-&amp;gt;imageCaption = $block-&amp;gt;caption;&#xA;        }&#xA;        $block-&amp;gt;caption = NULL;&#xA;        $craft-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that gives &lt;code&gt;Property &quot;Craft\MatrixBlockModel.caption&quot; is not defined.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit&lt;/em&gt;  I’m now at the stage where the contents of the caption field has been saved to each of the images in that block, but i cant seem to set the &lt;code&gt;caption&lt;/code&gt; field on the block to null. Here is what I have at this stage&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $craft = require '../craft/app/bootstrap.php';&#xA;&#xA;$criteria = $craft-&amp;gt;elements-&amp;gt;getCriteria(Craft\ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;fieldId = $craft-&amp;gt;fields-&amp;gt;getFieldByHandle('postBody')-&amp;gt;id;&#xA;$criteria-&amp;gt;type = &quot;image&quot;;&#xA;$criteria-&amp;gt;limit = null;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&#xA;foreach ($blocks as $block) {&#xA;    if ($block-&amp;gt;caption) {&#xA;&#xA;        $caption = &quot;&amp;lt;p&amp;gt;&quot;.$block-&amp;gt;getContent()-&amp;gt;caption.&quot;&amp;lt;/p&amp;gt;&quot;;&#xA;        foreach($block-&amp;gt;image as $image) {&#xA;            $asset = $craft-&amp;gt;elements-&amp;gt;getElementById($image-&amp;gt;id);&#xA;            if(empty($asset-&amp;gt;getContent()-&amp;gt;imageCaption)) {&#xA;                $asset-&amp;gt;getContent()-&amp;gt;imageCaption = $caption;&#xA;                $success = $craft-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;            }&#xA;        }&#xA;&#xA;        $block-&amp;gt;setContent(array(&#xA;            'caption' =&amp;gt; '',&#xA;        ));&#xA;&#xA;        $success = $craft-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&#xA;        dd($success);&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastEditorUserId="284" LastEditDate="2015-12-18T21:15:12.363" LastActivityDate="2016-06-08T22:08:45.870" Title="Migrate contents between fields?" Tags="&lt;field&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12908" PostTypeId="2" ParentId="12904" CreationDate="2015-12-16T18:25:29.033" Score="3" Body="&lt;p&gt;&lt;em&gt;Something&lt;/em&gt; should be in the logs.  If it's happening on every page in the control panel, then most likely it's cURL related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clear your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files, reproduce the issue, then search the log file for &lt;code&gt;[error]&lt;/code&gt; and that should have the underlying error message in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If nothing is there, then the 500 error is being generated by your web server and it should be in your web server's error logs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-16T18:25:29.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12909" PostTypeId="1" AcceptedAnswerId="13174" CreationDate="2015-12-16T18:30:10.487" Score="1" ViewCount="544" Body="&lt;p&gt;I'm using the following code but the redirect is not working. After the user registers it takes them back to the home page and not to &lt;code&gt;volunteer/identity&lt;/code&gt;. I put a message on the homepage to display if the user is logged in and it appears that they are logged it at that point. This used to work before 2.5 on a different site that I haven't upgraded to 2.5. But now on this new install of 2.5 I can't get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else experienced the same issues?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;volunteer/identity&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; {% if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if entry is defined %}&#xA;        {{ errorList(account.getErrors('firstName')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;lastName&quot; type=&quot;text&quot; name=&quot;lastName&quot; required {% if account is defined %} value=&quot;{{ account.lastName }}{% endif %}&quot;&amp;gt;&#xA;&#xA;    {% if entry is defined %}&#xA;        {{ errorList(account.getErrors('lastName')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;        {% if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;button&quot;&amp;gt;Save and continue&amp;lt;/button&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My config file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'useEmailAsUsername' =&amp;gt; true,&#xA;    'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'setPasswordPath' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'account/setpassword'&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3951" LastEditorUserId="3951" LastEditDate="2015-12-16T18:44:20.587" LastActivityDate="2016-01-11T23:57:23.377" Title="User Registration Form Redirect not working Craft 2.5" Tags="&lt;redirect&gt;&lt;registration&gt;&lt;devmode&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12910" PostTypeId="1" AcceptedAnswerId="12913" CreationDate="2015-12-16T18:49:45.177" Score="0" ViewCount="310" Body="&lt;p&gt;I've got a few Sprout forms on a site that are functioning nicely. Data is being save and notifications are firing to 2 of the 3 addresses. The third address is an Office 365 mailbox on the same domain but hosted elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'v tried updating Craft's Email setting to the SMTP info provided by the IT company in charge of the mail but it's erroring out with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;SMTP Error: data not accepted.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody else had issues with this? A little Googling has led me to believe that this is a common issue. Wondering if anybody in the Craft community has dealt with it successfully.&lt;/p&gt;&#xA;" OwnerUserId="1019" LastActivityDate="2015-12-17T16:26:47.070" Title="Sprout Forms Notifications to Office 365 address failing" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12912" PostTypeId="2" ParentId="12909" CreationDate="2015-12-16T20:28:37.220" Score="0" Body="&lt;p&gt;This probably isn't the answer you're looking for (it should be honoring your redirect) but if that's the only form being used for registrations, you could set &lt;code&gt;'activateAccountSuccessPath' =&amp;gt; 'volunteer/identity'&lt;/code&gt; in your config file.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2015-12-16T20:37:40.973" LastActivityDate="2015-12-16T20:37:40.973" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12913" PostTypeId="2" ParentId="12910" CreationDate="2015-12-17T00:37:17.557" Score="1" Body="&lt;p&gt;This error could be caused by the relationship between the user used in your SMTP Email settings in Craft and the From Address set in your Form notification. Some Mail Servers don't allow the sender (From Address) to be different from the SMTP user. Can you confirm if your From Address is the same email address in your SMTP settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you may want to update your SMTP settings to use Mandrill or Mailgun. Those services make it pretty easy to look at your sent mail and see if it's being delivered and can provide more insight into what is happening if it is not being delivered.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-12-17T00:37:17.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12914" PostTypeId="2" ParentId="12869" CreationDate="2015-12-17T11:02:39.110" Score="0" Body="&lt;p&gt;Answer: As Brad guessed; the problem was a plugin, specifically Sprout Invisible Captcha. Disabling that allowed the form redirect to work properly again.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2015-12-17T11:02:39.110" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12915" PostTypeId="1" AcceptedAnswerId="12932" CreationDate="2015-12-17T12:43:25.413" Score="1" ViewCount="101" Body="&lt;p&gt;I have 2 structures that are used for Menus on the site. Each entry is a link to either an entry / asset or external URL. The hierarchy is used to generate a menu .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To save on page load time, the two menus are both wrapped up in &lt;code&gt;{% cache globally %}&lt;/code&gt; tags which has worked really well to speed up things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that when altering the position / hierarchy of the structure entries from Craft, the front-end doesn't update accordingly which I can only put down to the cache blocking the update, as the structure isn't re-triggering the cache update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips for long term maintenance on this site feature? Some of the content editors will want to alter this stuff, but without disabling the cache myself? The only user that can manually flush the template cache is myself, the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance y'all!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Merry Christmas! :-)&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-18T12:44:22.507" Title="Altering Structure order doesn't update cache" Tags="&lt;structure&gt;&lt;cache&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12916" PostTypeId="1" AcceptedAnswerId="12924" CreationDate="2015-12-17T14:54:07.727" Score="3" ViewCount="355" Body="&lt;p&gt;I currently have a plugin that's successfully sending email using &lt;code&gt;EmailModel()&lt;/code&gt;. The problem is: it's sending a multi-part email with HTML and plain text components. For this particular email, it would be best if I could just send the plain text portion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to disable the HTML segment when sending via &lt;code&gt;EmailModel()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2015-12-17T18:39:50.730" Title="Send plain text email using EmailModel?" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12917" PostTypeId="1" AcceptedAnswerId="12922" CreationDate="2015-12-17T14:58:21.580" Score="0" ViewCount="40" Body="&lt;p&gt;Is it possible to hide the &lt;strong&gt;week start day&lt;/strong&gt; on the 'Account' tab? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm about to import 400+ members and don't want to confuse them with this unnecessary setting (from their perspective).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adam&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-17T19:15:14.430" Title="Hide the Week Start Day" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12918" PostTypeId="2" ParentId="12910" CreationDate="2015-12-17T15:01:58.230" Score="1" Body="&lt;p&gt;A little history on this problem before I share my experience. It may be of value to somebody.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form notifications were firing inconsistently. I'd fill out the form and get notified. The agency that hired me wouldn't. Occasionally a customer &quot;in the wild&quot; would fill out the form and notifications would fire. Occasionally they wouldn't. There was no rhyme or reason. I couldn't find a pattern.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;PROBLEM #1: INCONSISTENCY&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I had the Sender Email address dynamically set to the submitter's email. This worked fine in all my setup and testing, except - as it turns out - in cases where the submitter was using a @gmail, @hotmail or @yahoo address. These would fail silently. This is probably due to the SMTP issues discussed here, but email isn't in my skill set so that's just a guess. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inconsistency was due to human nature - I would default to my non-gmail/yahoo/hotmail address when filling out the form and it would work. Same deal with others. My client used a gmail address (and it failed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I changed the FROM and REPLY-TO all notifications were firing to all parties. Except the client.... Even when I changed the FROM/REPLY-TO to something innocuous like my email, the client's Office365 was still ignoring the notificaitons.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;PROBLEM #2: SMTP&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I know very little about email (more, now) so this took a while to sort out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some Googling and found this was sort of a common thing, getting Office365 to play nice with notification emails from forms. SMTP always seemed to be the answer so I looped in the Office365 admin and got that info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entered it and hit the &quot;Test Email&quot; button. No dice. Errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I Googled around looking for explanations and we added the web server's IP to a whitelist in Office 365. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back in SMPT-land I was thrown by the labeling of the field &lt;strong&gt;System Email Address&lt;/strong&gt; in the Craft settings and the instructions &lt;em&gt;&quot;The email address Craft will use when sending email.&quot;&lt;/em&gt;  I took that to mean the address the System would send reports to which was set to my email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a whim I tried the SMTP login email there as well and the test email worked (as @Ben Parizek wisely suggests).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then changed the FROM/REPLY-TO to the Office365 address (which is also the TO address, by the way) and all is functioning smoothly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll take the blame on that one, though I believe a clearer instruction line could help. Maybe something including &quot;From&quot;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All is functioning now and everybody is happy. The client was wonderfully patient during this whole process so I count myself lucky in that regard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A special shoutout to the Sprout support team who were looking into Problem #1 when it got sorted out. They were very helpful and responsive.&lt;/p&gt;&#xA;" OwnerUserId="1019" LastEditorUserId="115" LastEditDate="2015-12-17T16:26:47.070" LastActivityDate="2015-12-17T16:26:47.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12920" PostTypeId="1" AcceptedAnswerId="12921" CreationDate="2015-12-17T15:26:14.770" Score="2" ViewCount="508" Body="&lt;p&gt;I guess I could always loop through the structure but is there a simple way to directly get the n-th entry in a structure? (at a given level)&#xA;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set $fifth_listing = craft.entries.section('listing').level('1').pos('5') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="166" LastActivityDate="2015-12-17T15:37:29.460" Title="Getting the n-th entry in a structure" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12921" PostTypeId="2" ParentId="12920" CreationDate="2015-12-17T15:37:29.460" Score="6" Body="&lt;p&gt;You're close! This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set $fifth_listing = craft.entries.section('listing').level('1').nth(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-17T15:37:29.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12922" PostTypeId="2" ParentId="12917" CreationDate="2015-12-17T15:45:05.183" Score="4" Body="&lt;p&gt;You could do this using the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS plugin&lt;/a&gt; from Lindsey DiLoreto.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install the plugin then add the following custom css:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#weekStartDay-field { display: none; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this will hide the field for all users, including you.&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="45" LastEditDate="2015-12-17T19:15:14.430" LastActivityDate="2015-12-17T19:15:14.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12924" PostTypeId="2" ParentId="12916" CreationDate="2015-12-17T18:39:50.730" Score="2" Body="&lt;p&gt;Currently not.  If Craft sees that there isn't anything specified for the &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel#htmlBody-detail&quot; rel=&quot;nofollow&quot;&gt;htmlBody&lt;/a&gt; property of &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel&quot; rel=&quot;nofollow&quot;&gt;EmailModel&lt;/a&gt; will run the &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel#body-detail&quot; rel=&quot;nofollow&quot;&gt;body&lt;/a&gt; property though Markdown and set that to htmlBody.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-17T18:39:50.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12925" PostTypeId="1" CreationDate="2015-12-17T20:19:06.683" Score="1" ViewCount="273" Body="&lt;p&gt;Is there any way to apply an image transform (either CP-defined or template-defined) to a variable which represents the URL of a remote image? Naturally it would need to be cached locally, but since transforms are already cached I figure it's not &lt;em&gt;too&lt;/em&gt; much of a stretch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My use case is applying a transform to the thumbnail image of a video which is being fetched by an oEmbed plugin.&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2016-03-15T19:48:47.857" Title="Applying image transforms to remote images?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12926" PostTypeId="1" AcceptedAnswerId="12927" CreationDate="2015-12-17T20:19:16.510" Score="0" ViewCount="60" Body="&lt;p&gt;I'm following this tutorial (&lt;a href=&quot;https://snipcart.com/blog/managing-your-craft-inventory-using-snipcart-webhooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Managing Your Craft Inventory Using Snipcart Webhooks&lt;/a&gt;) and have downloaded the repository from GitHub and cloned. The folder was created without inconvenient but is still not recognized in the admin dashboard&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qpAVD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qpAVD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QeMwE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QeMwE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4484" LastEditorUserId="57" LastEditDate="2015-12-17T20:28:52.197" LastActivityDate="2015-12-18T19:06:23.447" Title="Craft doesn't recognize Snipcart plugin" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12927" PostTypeId="2" ParentId="12926" CreationDate="2015-12-17T20:28:27.260" Score="1" Body="&lt;p&gt;You need to rename that &lt;code&gt;snipcart-craft-webhooks-plugins&lt;/code&gt; folder to &lt;code&gt;snipcartwebhooks&lt;/code&gt; in order for Craft to recognize it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-17T20:28:27.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12928" PostTypeId="1" CreationDate="2015-12-18T01:35:16.257" Score="2" ViewCount="346" Body="&lt;p&gt;I'm new to Craft CMS. I have the following single level navigation code:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;/products&quot; class=&quot;app-nav__primary&quot;&amp;gt;Products&amp;lt;/a&amp;gt;&#xA;    &amp;lt;ul class=&quot;app-nav__secondary&quot;&amp;gt;&#xA;      {% for entry in craft.entries.section('products') %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;How would i adjust this to show a second level navigation in within the parent li? I'm looking for something like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;/products&quot; class=&quot;app-nav__primary&quot;&amp;gt;Products&amp;lt;/a&amp;gt;&#xA;    &amp;lt;ul class=&quot;app-nav__secondary&quot;&amp;gt;&#xA;      {% for entry in craft.entries.section('products') %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        if (child) { '&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;child.link&quot;&amp;gt;child.title&amp;lt;/a&amp;gt;&#xA;        }&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;" OwnerUserId="4498" LastEditorUserId="3380" LastEditDate="2015-12-19T13:43:34.050" LastActivityDate="2015-12-19T13:43:34.050" Title="Simple nested navigation" Tags="&lt;entries&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12929" PostTypeId="2" ParentId="12928" CreationDate="2015-12-18T02:37:01.943" Score="3" Body="&lt;p&gt;You could use the &lt;code&gt;children&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('products') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;/products&quot; class=&quot;app-nav__primary&quot;&amp;gt;Products&amp;lt;/a&amp;gt;&#xA;        &amp;lt;ul class=&quot;app-nav__secondary&quot;&amp;gt;&#xA;            {% nav entry in entries %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                    {% ifchildren %}&#xA;                        &amp;lt;ul&amp;gt;&#xA;                            {% children %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endifchildren %}&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastActivityDate="2015-12-18T02:37:01.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12930" PostTypeId="1" AcceptedAnswerId="17672" CreationDate="2015-12-18T12:12:31.290" Score="2" ViewCount="373" Body="&lt;p&gt;I currently have a plugin which needs to do things on save and delete entry events. My save entry code is all working perfectly but the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onDeleteEntry&quot; rel=&quot;nofollow&quot;&gt;onDeleteEntry&lt;/a&gt; code doesn't ever fire when I delete an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using the event both ways mentioned in the documentation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;entries-&amp;gt;onDeleteEntry = function(Event $event) {&#xA;$entry = $event-&amp;gt;params['entry'];&#xA;//etc etc&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.deleteEntry', function(Event $event) {&#xA;$entry = $event-&amp;gt;params['entry'];&#xA;//etc etc&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;both of these are inside the init function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if there is a particular way this event needs to be used that differs from the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry&lt;/a&gt; event, which works fine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a link to the events reference &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/hooks-and-events#events&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2016-11-10T14:26:41.463" Title="How to use onDeleteEntry?" Tags="&lt;events&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12931" PostTypeId="1" AcceptedAnswerId="12933" CreationDate="2015-12-18T12:23:04.163" Score="1" ViewCount="1457" Body="&lt;p&gt;Below is my paginate code.&#xA;How can I check if there is more than one page? At the moment when there is only one I'm getting a '1' appear at the bottom (the page number) which looks odd. Ideally I only want it to show the pagination if the number of entries exceeds the limit, so only if it needs to display a link to the next page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('insights').limit(1) as entriesOnPage %}&#xA;    {% for entry in entriesOnPage %}&#xA;    &amp;lt;article&amp;gt;&#xA;        {% for image in entry.blogImage %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl()}}&quot; alt=&quot;{{ image.title }}&quot; class=&quot;gutter-bottom--half&quot;/&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;h3&amp;gt;&amp;lt;a class=&quot;descrete-link&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        {{ entry.body|hacksaw(chars='300', append='...') }}&#xA;        &amp;lt;br&amp;gt;&#xA;        &amp;lt;br&amp;gt;            &#xA;        &amp;lt;p&amp;gt;&amp;lt;a class=&quot;button button--blue gutter-bottom--half&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;div class=&quot;col-12-nf gutter-bottom&quot;&amp;gt;&#xA;            &amp;lt;hr&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;    &amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if paginate.prevUrl %}&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;{% for page, url in paginate.getPrevUrls(5) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;&#xA;{% for page, url in paginate.getNextUrls(5) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if paginate.nextUrl %}&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2015-12-18T12:29:54.313" LastActivityDate="2016-02-23T06:37:49.147" Title="Check if paginate" Tags="&lt;pagination&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12932" PostTypeId="2" ParentId="12915" CreationDate="2015-12-18T12:44:22.507" Score="0" Body="&lt;p&gt;After Greg Stewart's help I found that the reason that the Cache wasn't updating when altering the hierarchy of the Structure is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;There were Stuck background tasks.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;Here is the official documentation on the matter.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-18T12:44:22.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12933" PostTypeId="2" ParentId="12931" CreationDate="2015-12-18T13:01:19.483" Score="9" Body="&lt;p&gt;The &lt;code&gt;paginate.totalPages&lt;/code&gt; variable will give you the total number of pages that are generated by the &lt;code&gt;paginate&lt;/code&gt; tag. So you can wrap your display of pages around a conditional that checks to see if this is greater than 1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate.totalPages &amp;gt; 1 %}&#xA;&#xA;    {# output current pages and pagination navigation here #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details, including a full list of variables available, can be found in the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot;&gt;pagination docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-18T13:01:19.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12934" PostTypeId="2" ParentId="12561" CreationDate="2015-12-18T14:37:12.613" Score="1" Body="&lt;p&gt;OK I found it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the &lt;a href=&quot;http://matthewblode.com/marx/&quot; rel=&quot;nofollow&quot;&gt;Marx CSS reset Sass library.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its _sanitize.scss file it has the rule:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;* { border-style: solid; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So by altering my own css to include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.smartmap-mapcanvas * { border-style: none; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That removed the anomaly.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-18T14:37:12.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12935" PostTypeId="2" ParentId="9400" CreationDate="2015-12-18T15:05:23.487" Score="12" Body="&lt;p&gt;Shameless plug here: We, &lt;strong&gt;&lt;a href=&quot;https://www.fortrabbit.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;fortrabbit&lt;/a&gt;&lt;/strong&gt;, really ♥ Craft. And we are one of the &lt;em&gt;official Craft Hosting &lt;a href=&quot;https://craftcms.com/news/craft-hosting-partners&quot; rel=&quot;nofollow noreferrer&quot;&gt;Partners&lt;/a&gt;&lt;/em&gt; — for good reasons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need some more convincing? Have a look at our &lt;a href=&quot;https://www.fortrabbit.com/craft-hosting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft marketing page&lt;/a&gt; or ask us int the support chat if you have questions. Our install guides help you getting started quickly with Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get started: &lt;a href=&quot;https://help.fortrabbit.com/craft-3-about&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://help.fortrabbit.com/craft-3-about&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Advanced topics: &lt;a href=&quot;https://help.fortrabbit.com/craft-3-tune&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://help.fortrabbit.com/craft-3-tune&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Our little command line tool &lt;a href=&quot;https://github.com/fortrabbit/craft-copy&quot; rel=&quot;nofollow noreferrer&quot;&gt;fortrabbit/craft-copy&lt;/a&gt; helps you deploying Craft more easily.&lt;/p&gt;&#xA;" OwnerUserId="4504" LastEditorUserId="4538" LastEditDate="2019-01-14T10:45:53.897" LastActivityDate="2019-01-14T10:45:53.897" CommentCount="2" CommunityOwnedDate="2015-12-18T15:05:23.487" ContentLicense="CC BY-SA 4.0" />
  <row Id="12936" PostTypeId="1" AcceptedAnswerId="12945" CreationDate="2015-12-18T16:16:52.000" Score="3" ViewCount="210" Body="&lt;p&gt;I will work in a website that have presence in 3 countries: Nicaragua, Panama, Costa Rica. They will upload products and want that each country have they own product or product information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i think about locales to organize the website, to give 3 different contexts to load information, and the ability to change a existing product for each country.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: this 3 countries speaks Spanish, and i want to clearly show the client which country he is editing- &lt;strong&gt;Can i duplicate the Spanish locale and put the country name on each one&lt;/strong&gt; ( to show PANAMA-COSTARICA-NICARAGUA ) ? I see the list of locales but i don´t know if this 3 countries are available...&#xA;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sebastian.&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="22" LastEditDate="2017-05-09T22:53:14.367" LastActivityDate="2017-05-09T22:53:14.367" Title="Multi Country website - Using locales is the best approach?" Tags="&lt;localization&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12937" PostTypeId="1" AcceptedAnswerId="12952" CreationDate="2015-12-18T18:25:02.707" Score="1" ViewCount="506" Body="&lt;p&gt;I'm looking for a way to handle links to entries in a Redactor (Rich text) field such that a different class gets added to the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag depending on the type of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a link to an &quot;event&quot; entry type would be modified to look like: &lt;code&gt;&amp;lt;a class=&quot;event-link&quot; href=&quot;events/event-one&quot;&amp;gt;Event name&amp;lt;/a&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that some kind of plugin would be needed for this, but I have been able to find anything similar I could learn from. So any pointers to this end would be really helpful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="467" LastEditorUserId="57" LastEditDate="2015-12-20T01:47:33.187" LastActivityDate="2015-12-21T00:36:40.877" Title="Treat links in redactor/rich text field differently depending on entry type" Tags="&lt;plugin-development&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12939" PostTypeId="1" CreationDate="2015-12-18T19:52:37.980" Score="1" ViewCount="5532" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I installed CraftCMS. All files are uploaded, chmod done, and everything else. I visit the page &lt;a href=&quot;http://example.com/admin&quot; rel=&quot;nofollow&quot;&gt;http://example.com/admin&lt;/a&gt; to go through setup and I get the message &quot;Service Unavailable. Our site is temporarily unavailable. Please try again later.&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I checked .htaccess and the config file. All is well.&lt;/li&gt;&#xA;&lt;li&gt;I changed isSystemOn from &quot;null&quot; to &quot;true&quot;. Same message.&lt;/li&gt;&#xA;&lt;li&gt;I contacted my host to see if Craft will run on the server. All&#xA;requirements are met.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since this is a Craft message it seems pretty clear that the database is being connected to but nothing is happening. Any assistance would be great.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-04-27T01:53:42.763" Title="Clean install - Service Unavailable message at setup" Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12941" PostTypeId="1" CreationDate="2015-12-19T06:52:07.193" Score="2" ViewCount="130" Body="&lt;p&gt;Each field has no option to move them on a phone. Using Firefox and Chrome on a Samsung Galaxy 5.&lt;/p&gt;&#xA;" OwnerUserId="792" LastEditorUserId="57" LastEditDate="2015-12-20T01:51:27.103" LastActivityDate="2017-04-28T01:42:14.550" Title="Why can't I drag and drop fields in settings on a mobile phone?" Tags="&lt;field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12942" PostTypeId="1" AcceptedAnswerId="12947" CreationDate="2015-12-19T12:08:41.667" Score="0" ViewCount="887" Body="&lt;p&gt;The category count is only ever 1 and I need to output the name of the category the entry belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would there need to be a cross-over between the EntryModel and CategoryModel?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;jobs/{$entry-&amp;gt;id}.json&quot;),&#xA;                    'postDate' =&amp;gt; $entry-&amp;gt;postDate-&amp;gt;getTimestamp() * 1000,&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'jobOverview' =&amp;gt; (string) $entry-&amp;gt;jobOverview,&#xA;                    'category' =&amp;gt; $entry-&amp;gt;jobCategory[0],&#xA;                ];&#xA;            },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2015-12-20T16:14:08.863" LastActivityDate="2015-12-20T21:53:34.910" Title="How do I access the category of an entry with Element API?" Tags="&lt;json&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12944" PostTypeId="1" AcceptedAnswerId="12949" CreationDate="2015-12-19T16:07:46.480" Score="0" ViewCount="74" Body="&lt;p&gt;I've cloned the GitHub repository but the plugin won't recognize the webhook URL and the order is not placed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BVdOs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BVdOs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6cLwg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6cLwg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4484" LastEditorUserId="57" LastEditDate="2015-12-20T01:48:48.257" LastActivityDate="2015-12-20T10:55:27.627" Title="Snipcart plugin don't recognize the webhook URL" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12945" PostTypeId="2" ParentId="12936" CreationDate="2015-12-19T18:49:09.310" Score="6" Body="&lt;p&gt;Yes you can do this by going to the &lt;strong&gt;&lt;code&gt;craft/app/framework/i18n/data&lt;/code&gt;&lt;/strong&gt; folder and copying the language file for each occurrence.  You must give each a unique name &lt;strong&gt;&lt;code&gt;es_pn, es_co, es_nc&lt;/code&gt;&lt;/strong&gt;.  Inside each of those files you must add each of those names along with the long form name. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;languages =&amp;gt; array(&#xA;'es_pn' =&amp;gt; 'Panama',&#xA;'es_co' =&amp;gt; 'Costarica',&#xA;'en_nc' =&amp;gt; 'Nicaragua',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From here you would select each of those locales from the CP and setup the rest of your site as you would for multiple locales, using your custom ones. Updates have currently never broken this.  We have been using this method for several clients, it works well.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2015-12-19T18:49:09.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12946" PostTypeId="2" ParentId="12941" CreationDate="2015-12-19T23:00:59.523" Score="4" Body="&lt;p&gt;Touch screen devices don't &quot;drag &amp;amp; drop&quot; in a traditional sense, because dragging your finger around the screen is generally reserved for &lt;strong&gt;scrolling&lt;/strong&gt;. This issue isn't specific to your browser or device, it's the same behavior across all touch screen devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how you want to look at this, I'd consider this either a &quot;bug&quot; or a &quot;feature request&quot;. Assuming we're going with &quot;feature request&quot;, your best course of action is to formally submit your request here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://feedback.buildwithcraft.com/&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-19T23:00:59.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12947" PostTypeId="2" ParentId="12942" CreationDate="2015-12-20T02:48:35.460" Score="3" Body="&lt;p&gt;Same as you would access it from a Twig &lt;a href=&quot;https://craftcms.com/docs/categories-fields#templating&quot; rel=&quot;nofollow&quot;&gt;template&lt;/a&gt;.  If you're positive there will always be one category selected, then this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    return [&#xA;        'category' =&amp;gt; (string)$entry-&amp;gt;categoryHandle[0],&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2015-12-20T21:53:34.910" LastActivityDate="2015-12-20T21:53:34.910" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12949" PostTypeId="2" ParentId="12944" CreationDate="2015-12-20T10:55:27.627" Score="1" Body="&lt;p&gt;I think it's because your passing &quot;localhost&quot; as your URL, so when the snipcart server tries to get the URL you supplied it's actually tying to fetch it on its own host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my experience with these kinda things you need to supply a publicity accessible URL, so if you can find your public ip then maybe try that instead of localhost or upload to a staging server and then test it with a real domain.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2015-12-20T10:55:27.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12950" PostTypeId="1" AcceptedAnswerId="12951" CreationDate="2015-12-20T19:56:13.983" Score="1" ViewCount="163" Body="&lt;p&gt;I am brand new to craft and have loved it so far.  Only area that I'm having a hard time understanding is why I cannot use my template variables in my templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am routing &lt;code&gt;news/&lt;/code&gt; to an action which then uses the &lt;code&gt;renderTemplate()&lt;/code&gt; method to do just that...render the template.  The result is sent to the browser but it is accompanied by the following php error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Cannot declare class Craft\WassermanNewsVaraible, because the name &#xA;is already in use in /usr/share/nginx/craft/plugins/myPlugin/variables/MyPluginVariable.php on line 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that tells me that the class is obviously already declared somewhere.  If so how can I access it?  I am currently trying to access it as the documentation describes and is shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.myPlugin.myMethod() %}&#xA;  &amp;lt;div&amp;gt;&#xA;   Test&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my template variable class which is in myPlugin/variables/&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyPluginVaraible&#xA;{&#xA;    public function myMethod(){&#xA;        craft()-&amp;gt;myPlugin-&amp;gt;myMethod(); //which is in the service&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a difference between how templates are rendered via controllers as opposed to the regular behavior?  I saw that the method had a second parameter however I still could not insatiate my template variables to pass that way as it was still already declared somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been banging away at this one for a while.  Any help or insight would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4320" LastActivityDate="2015-12-20T20:10:55.867" Title="Template Variable Already in Use?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12951" PostTypeId="2" ParentId="12950" CreationDate="2015-12-20T20:10:55.867" Score="3" Body="&lt;p&gt;MyPlugin&lt;code&gt;Varaible&lt;/code&gt; Note the spelling of the highlighted word...&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-20T20:10:55.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12952" PostTypeId="2" ParentId="12937" CreationDate="2015-12-21T00:16:46.523" Score="11" Body="&lt;p&gt;This is a high-level question, with multiple problems to solve. First, you'll need to parse the HTML from the Rich Text field for &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags. Then, you'll need to find a way to match the &lt;code&gt;href&lt;/code&gt; attributes for those &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags to entries, and finally, you'll need to set classnames to the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags (depending on the matched entry's Entry Type) and spit the rewritten HTML back out (saving it back to the entry if you want the classnames to persist).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that the code in this answer isn't really tested, and there are multiple ways to skin your particular cat (or cats, as it were). Hopefully you'll take something away from it, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, in order to parse the HTML for &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags, I'd recommend using &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DOMDocument&lt;/a&gt;, which is a built-in HTML parser (PHP5+). DOMDocument makes it super easy to find all the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags in your HTML, and is much safer than using regular expressions. Here's how that could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dom = new \DOMDocument();&#xA;$dom-&amp;gt;loadHTML($html);&#xA;$links = $dom-&amp;gt;getElementsByTagName('a');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next step is looping through all the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags; attempting to pull Entries from their &lt;code&gt;href&lt;/code&gt; attributes. Note that those &lt;code&gt;href&lt;/code&gt; attributes might be &lt;em&gt;reference tags&lt;/em&gt; (e.g. &lt;code&gt;{entry:11:url}&lt;/code&gt;) or either a &lt;em&gt;relative or absolute URL&lt;/em&gt;, and ideally, your code should account for all of those variations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($links as $link) {&#xA;&#xA;    $href = $link-&amp;gt;getAttribute('href');&#xA;&#xA;    if (strpos($href, '{entry') !== false &amp;amp;&amp;amp; strpos($href, 'url}') !== false) {&#xA;        // Reference tag – get entry by ID&#xA;        $reference = explode(':', $href);&#xA;        $entryId = (int) $reference[1];&#xA;        $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;    } else {&#xA;        // URL. Make sure the site url is stripped and get entry by URI&#xA;        $uri = ltrim(str_replace(craft()-&amp;gt;config-&amp;gt;get('siteUrl');, '', $link-&amp;gt;getAttribute('href')), '/');&#xA;        $entry = craft()-&amp;gt;elements-&amp;gt;getElementByUri($uri);  &#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, DOMDocument makes it super easy to add a classname back to the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags, depending on the Entry Type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Add classnames based on the Entry Type handle&#xA;switch ($entry-&amp;gt;type) {&#xA;    case 'work' :&#xA;        $link-&amp;gt;setAttribute('class', 'work-link');&#xA;        break;&#xA;    case 'news' :&#xA;        $link-&amp;gt;setAttribute('class', 'news-link');&#xA;        break;                    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One minor gotcha to note, is that DOMDocument will add HTML structural tags ('html', 'head', and 'body') to your HTML. A bit of regex takes care of that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = preg_replace('~&amp;lt;(?:!DOCTYPE|/?(?:html|head|body))[^&amp;gt;]*&amp;gt;\s*~i', '', $dom-&amp;gt;saveHTML());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the complete code, for context:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create a new DOMDocument instance and find all &amp;lt;a&amp;gt; tags. I like to use mb_convert_encoding to ensure that the HTML content is UTF-8 encoded, but your mileage may vary&#xA;$dom = new \DOMDocument();&#xA;$dom-&amp;gt;loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));&#xA;$links = $dom-&amp;gt;getElementsByTagName('a'); &#xA;&#xA;// Loop through the &amp;lt;a&amp;gt; tags&#xA;if ($links &amp;amp;&amp;amp; $links-&amp;gt;length &amp;gt; 0) {&#xA;&#xA;    foreach ($links as $link) {&#xA;&#xA;        // Try to get entry from href attribute&#xA;        $href = $link-&amp;gt;getAttribute('href');&#xA;&#xA;        if (strpos($href, '{entry') !== false &amp;amp;&amp;amp; strpos($href, 'url}') !== false) {&#xA;            // Reference tag – get entry ID&#xA;            $reference = explode(':', $href);&#xA;            $entryId = (int) $reference[1];&#xA;            $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;        } else {&#xA;            // URL. Make sure the site url is stripped&#xA;            $uri = ltrim(str_replace(craft()-&amp;gt;config-&amp;gt;get('siteUrl'), '', $link-&amp;gt;getAttribute('href')), '/');&#xA;            $entry = craft()-&amp;gt;elements-&amp;gt;getElementByUri($uri);  &#xA;        }&#xA;&#xA;        if ($entry &amp;amp;&amp;amp; $entry-&amp;gt;elementType == ElementType::Entry) {&#xA;&#xA;            // Add classnames based on the Entry Type handle&#xA;            switch ($entry-&amp;gt;type) {&#xA;                case 'work' :&#xA;                    $link-&amp;gt;setAttribute('class', 'work-link');&#xA;                    break;&#xA;                case 'news' :&#xA;                    $link-&amp;gt;setAttribute('class', 'news-link');&#xA;                    break;                    &#xA;            }&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Phew. That takes care of the HTML, but depending on your need, you'll have to decide on an approach for when and where you want to rewrite your Rich Text content – i.e., where and when you'll place and call the above code (or something like it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have two options (it isn't clear from your question which of these you want):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Add the classnames when the entry is saved (permanent)&lt;br&gt;&#xA;b) Add the classnames when the content is output in a template (not permanent)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to add the classnames to links in the Rich Text content &lt;em&gt;permanently&lt;/em&gt;, I'd recommend creating an event listener for the &lt;code&gt;entries.saveEntry&lt;/code&gt; event, rewriting the HTML before re-saving the entry. The below would go in your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('entries.saveEntry', array($this, 'onSaveEntry');&#xA;}&#xA;&#xA;public function onSaveEntry(Event $e) {&#xA;    $entry = $e-&amp;gt;params['entry'];&#xA;    $html = isset($entry-&amp;gt;richTextField) ? $entry-&amp;gt;richTextField-&amp;gt;getRawContent() : false;&#xA;    if ($html) {&#xA;        ...&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttribute('richTextField', $html);&#xA;        if ($entry-&amp;gt;validate()) {&#xA;            craft()-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For option b), I'd suggest writing a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Variable&lt;/a&gt; method or a custom &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9211/how-do-i-create-a-custom-twig-extension-which-includes-third-party-code&quot;&gt;Twig Filter&lt;/a&gt;. A Template Variable would be a little bit easier, and would enable you to do the following in your template to print the HTML with the classes added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.addEntryTypeClasses(entry.richTextField) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A custom Twig filter offers a marginally more elegant template syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.richTextField|addEntryTypeClasses }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;code&gt;addEntryTypeClasses&lt;/code&gt; is a custom function (a template variable method or a Twig filter, respectively) that you'd have to create, where you could add the above code. To avoid the need to use the &lt;code&gt;|raw&lt;/code&gt; filter in your template, add the following when you return the &lt;code&gt;$html&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addEntryTypeClasses($html) {&#xA;    ...&#xA;    return TemplateHelper::getRaw($html);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In all of the above examples, &lt;code&gt;...&lt;/code&gt; is where you'd put the DOMDocument code. &lt;em&gt;Ideally&lt;/em&gt;, all of that code would go in a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;Service&lt;/a&gt; method, making it easy to perform the DOMDocument operation on any HTML content from basically anywhere (Twig Filters, Variable methods, hooks and/or event listeners), as well as keeping your plugin code tidy and nice, but it isn't a must.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind though that with option b), it would be a very good idea to &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;cache&lt;/a&gt; the output, as the operation can be costly if you have a lot of links in your Rich Text field (Craft will have to hit the database for each link, every pageload).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you don't fancy the DOMDocument approach, you could look at different approaches entirely – for instance, you could write a custom Redactor plugin, which could do basically the same thing as the above DOMDocument solution, only with JavaScript (jQuery) instead of PHP. Here's an example of a Craft Redactor plugin you could take a look at to get started: &lt;a href=&quot;https://github.com/jpdevries/styles&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/jpdevries/styles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in more examples regarding custom Twig filters and DOMDocument specifically, I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon HTML&lt;/a&gt; which streamlines a lot of common HTML rewriting operations. It won't help with your specific issue, but the &lt;code&gt;attr&lt;/code&gt; filter comes pretty close :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2015-12-21T00:36:40.877" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12954" PostTypeId="1" AcceptedAnswerId="13071" CreationDate="2015-12-21T10:01:34.323" Score="0" ViewCount="145" Body="&lt;p&gt;I have the strangest bug. I have a site with two languages, Norwegian and English. In my code i check for &lt;code&gt;craft.request.getQuery('prodid')&lt;/code&gt;. Locally in Apache this works fine with both language URLs, but in production on Nginx, it only works on the Norwegian version (the main language).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URLS looks like this&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://onepark.no/leie-parkering/paleet?prodid=1&quot; rel=&quot;nofollow&quot;&gt;http://onepark.no/leie-parkering/paleet?prodid=1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://onepark.no/en/rent-parking/paleet?prodid=1&quot; rel=&quot;nofollow&quot;&gt;http://onepark.no/en/rent-parking/paleet?prodid=1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For the english URL (the second) &lt;code&gt;craft.request.getQuery('prodid')&lt;/code&gt; returns an empty string. For the Norwegian URL it returns &quot;1&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nginx rewrite code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;  }&#xA;&#xA;location /en/ {&#xA;   try_files $uri $uri/ @enrewrites;&#xA;  }&#xA;&#xA;location @enrewrites {&#xA;    rewrite ^/en/(.*)$ /en/index.php?p=$1? last;&#xA;  }&#xA;&#xA;location @rewrites {&#xA;rewrite ^(.*) /index.php?p=$1 last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3563" LastEditorUserId="3563" LastEditDate="2016-01-04T09:00:17.910" LastActivityDate="2016-01-04T09:02:20.657" Title="craft.request.getQuery returns empty on multi lingual site" Tags="&lt;queries&gt;&lt;language&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12956" PostTypeId="2" ParentId="12232" CreationDate="2015-12-21T12:58:04.237" Score="1" Body="&lt;p&gt;To answer my own question, I found the answer in the source code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newFolder = new AssetFolderModel(&#xA;                array(&#xA;                    'parentId' =&amp;gt; $currentFolderid,&#xA;                    'name' =&amp;gt; $folderName,&#xA;                    'sourceId' =&amp;gt; $currentFolderid,&#xA;                    'path' =&amp;gt; trim($folderName, '/').'/'&#xA;                )&#xA;            );&#xA;            $folderId = craft()-&amp;gt;assets-&amp;gt;storeFolder($newFolder);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically you can specify a &lt;code&gt;parentId&lt;/code&gt;, witch is the ID of the parent folder.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2015-12-21T12:58:04.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12957" PostTypeId="1" AcceptedAnswerId="12965" CreationDate="2015-12-21T13:58:01.423" Score="1" ViewCount="241" Body="&lt;p&gt;I have a site for a company that is established in US markets and expanding into markets overseas.  The site has products and those products are grouped into categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the costs of translating content, the client has opted to translate some of their product content but not all of it.  Out of 8 categories of products, only 2 of those categories have been translated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category 1 =&amp;gt; translated&#xA;Category 2&#xA;Category 3&#xA;Category 4&#xA;Category 5 =&amp;gt; translated&#xA;Category 6&#xA;Category 7&#xA;Category 8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, there is no way to output only a list of categories that have been translated in a specific locale. Unlike entries, Categories don't appear to have a way to be enabled or disabled - they are all active for all locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing anything?  Or has anybody come up with a way to display only translated categories?  Ideally, in the secondary locale, I would be able to display a list of only the two categories that have been translated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category 1 =&amp;gt; translated&#xA;Category 5 =&amp;gt; translated&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-12-21T23:50:00.930" Title="How to only list translated categories?" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12958" PostTypeId="1" AcceptedAnswerId="12964" CreationDate="2015-12-21T16:13:16.960" Score="0" ViewCount="300" Body="&lt;p&gt;I have created a plugin.  It works fine for admins.  The plugin is in the CP nav and the admins urls work as expected, but when I login as a user who is not admin, the plugin will not display in the CP nav and the user cannot view the urls.  You get the error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; You don’t have the proper credentials to access this page.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What can I do to fix this?&lt;/p&gt;&#xA;" OwnerUserId="2185" LastEditorUserId="57" LastEditDate="2015-12-21T18:08:47.350" LastActivityDate="2015-12-22T13:54:47.813" Title="Plugin access and control panel navigation" Tags="&lt;plugin-development&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12959" PostTypeId="1" CreationDate="2015-12-21T19:35:33.913" Score="3" ViewCount="56" Body="&lt;p&gt;I created a single called recList and the corresponding Entry Template is /rec/list.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an entry and I can view the webpage as you would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: If I disable the entry or even delete the recList entry it seems to have no effect on the corresponding entry template, meaning that everything still works fine.  So, can someone explain the necessity of defining the single template pages in the admin site and what we are missing when we delete single sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chip&lt;/p&gt;&#xA;" OwnerUserId="1006" LastActivityDate="2015-12-21T19:51:47.603" Title="Need clarification on the need for a Single section being created" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12960" PostTypeId="1" AcceptedAnswerId="12962" CreationDate="2015-12-21T19:46:17.453" Score="0" ViewCount="404" Body="&lt;p&gt;&lt;code&gt;/admin/utils/serverinfo&lt;/code&gt; and &lt;code&gt;/admin/utils/phpinfo&lt;/code&gt; are both showing empty pages. There aren't any errors appearing in any logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it's related, the same site won't allow .jpg images to be uploaded. The progress bar reaches 100% but then it remains stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running Craft Pro 2.5.2755.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running devMode true revealed the following error:&#xA;&lt;code&gt;Parse error: syntax error, unexpected '[' in /nfs/c10/h03/mnt/175833/domains/example.com/craft/app/controllers/UtilsController.php on line 292&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="217" LastEditDate="2015-12-21T19:55:16.127" LastActivityDate="2015-12-21T20:10:54.323" Title="Blank / white screen for admin/utils/" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2015-12-21T21:28:59.913" ContentLicense="CC BY-SA 3.0" />
  <row Id="12961" PostTypeId="2" ParentId="12959" CreationDate="2015-12-21T19:51:47.603" Score="3" Body="&lt;p&gt;There are probably other points that can be added to this, but here are a few...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you deleted the Single, and there was no change when the template is viewed, then you probably &lt;em&gt;didn't need the Single&lt;/em&gt;. Were there any fields assigned to the Single, and were those fields referenced in the template? If the answer is &quot;no&quot;, then the Single was definitely extraneous.&lt;/li&gt;&#xA;&lt;li&gt;You can make a template hidden by prefixing the template name with an underscore: &lt;code&gt;/rec/_list.html&lt;/code&gt;. This makes the template invisible on the front-end, unless it's being called up through a Single/Channel/Structure. Without the underscore, any template can be viewed directly. (Worth noting that the underscore can also be applied to the folder name, hiding all templates inside that folder.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In summary, the value of a Single is to be able to &lt;strong&gt;manage your content via the Control Panel&lt;/strong&gt;. Whatever dynamic data is stored in your Single will be pulled into your template. If you have no dynamic data, then the Single is unnecessary.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-21T19:51:47.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12962" PostTypeId="2" ParentId="12960" CreationDate="2015-12-21T20:10:54.323" Score="1" Body="&lt;p&gt;That error is a bug in Craft that's been fixed for the next release.  That line is PHP 5.4 array syntax and your server is still using PHP 5.3 (Craft still supports back to PHP 5.3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you can go to the line it's complaining about and change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$serverArray = [];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$serverArray = array();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-21T20:10:54.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12964" PostTypeId="2" ParentId="12958" CreationDate="2015-12-21T23:40:55.823" Score="3" Body="&lt;p&gt;You must give your users the “Access [Plugin Name]” permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either grant that permission directly to each individual user from Users → [User Name] → Permissions, or if each of the users belongs to the same user group, you can go to Settings → Users → [User Group Name] and grant the permission from there instead.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-21T23:40:55.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12965" PostTypeId="2" ParentId="12957" CreationDate="2015-12-21T23:50:00.930" Score="3" Body="&lt;p&gt;Correct, categories don’t have the same localization features that entries do, as it is expected that all categories will always live in all locales. And Craft doesn’t actually keep a record of which content has been directly translated, vs. which content was just copied over to a locale when one of the other locales was edited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to only show the categories that have been translated, you’d have to add a custom “Translated” Lightswitch field to your category group’s field layout (which would be translatable so each locale gets its own value), and then factor it into any category queries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.group('groupHandle').translated(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-21T23:50:00.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12969" PostTypeId="1" AcceptedAnswerId="12970" CreationDate="2015-12-22T10:16:33.233" Score="3" ViewCount="146" Body="&lt;p&gt;Basically I want to add certain parameters to my 'craft.entries' based on whether a variable is set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get a start date value from the URL (my use case) #}&#xA;{% set start_date = craft.request.getSegment(3) %} {# e.g. '2015-12-10' #}&#xA;&#xA;{% if start_date != &quot;&quot; %}&#xA;&#xA;  {# Create .after() param #}&#xA;    {% set startDateQuery = &quot;.after(&quot; ~ start_date ~ &quot;)&quot; %}&#xA;&#xA;{% else %}&#xA;&#xA;    {# If there is no start date then set the param as &quot;&quot; so nothing happens #}&#xA;    {% set startDateQuery = &quot;&quot; %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries.section('events') ~ startDateQuery %}&#xA;&#xA;{% paginate entries as pageInfo, pageEntries %}&#xA;  ... Do stuff&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried this other ways as well, but this one seemed the most appropriate. Either way, it's not working and I was wondering if anyone might know why - or have a suggestion of a better method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="451" LastActivityDate="2015-12-22T13:08:27.493" Title="Dynamically create craft.entries" Tags="&lt;templating&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12970" PostTypeId="2" ParentId="12969" CreationDate="2015-12-22T13:08:27.493" Score="4" Body="&lt;p&gt;Instead of using the chained syntax, you should build a parameter object and pass that in to &lt;code&gt;craft.entries&lt;/code&gt;, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get a start date value from the URL (my use case) #}&#xA;{% set start_date = craft.request.getSegment(3) %} {# e.g. '2015-12-10' #}&#xA;&#xA;{# Create a parameter object, with default values #}&#xA;{% set params = { section: 'events' } %}&#xA;&#xA;{# If start_date exists, add the after parameter to the object #}&#xA;{% if start_date != &quot;&quot; %}&#xA;    {% set params = params | merge({ after: start_date }) %}&#xA;{% endif %}&#xA;&#xA;{# Get the entries by passing the parameters to craft.entries() #}&#xA;{% set entries = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2015-12-22T13:08:27.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12971" PostTypeId="1" AcceptedAnswerId="12974" CreationDate="2015-12-22T13:46:44.903" Score="1" ViewCount="1815" Body="&lt;p&gt;How do I output one random line of an array?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = [&#xA;  { bildli: 'http://i.giphy.com/I0xDz0htjsiME.gif' },&#xA;  { bildli: 'https://i.giphy.com/fA3JALhIi5YVa.gif' }&#xA; ] %}&#xA; {% for item in img %}&#xA;   &amp;lt;img src=&quot;{{ item.bildli }}&quot; alt=&quot;&quot;&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;{% for item in img.limit(1).order('RAND()') %}&lt;/code&gt; like you would on a normal &lt;code&gt;entries.section&lt;/code&gt; but that doesn't work on array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried: &lt;code&gt;{% for item in random(img) %}&lt;/code&gt; as statet in the twig doc but that doesn't work eyther. What's the catch here?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2015-12-22T15:20:31.603" Title="Apply 'random' to an array" Tags="&lt;array&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12973" PostTypeId="1" AcceptedAnswerId="12979" CreationDate="2015-12-22T14:04:20.703" Score="0" ViewCount="1289" Body="&lt;p&gt;I am trying to get my head around the TaskService that Craft comes with. I want to create a task that periodically (say every 15 minutes) uses the Twitter API. I am currently creating a task modeled on Pixel &amp;amp; Tonic's &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap&quot; rel=&quot;nofollow&quot;&gt;PowerNap&lt;/a&gt; which was very helpful, but I still don't understand how the tasks are triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the createTask method I didn't see any duration or anything like that and if the tasks are created within a controller that would have to be posted to, would this require a tandom cron job to trigger it from the server?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clarifications, insights, or references that might be helpful in better understanding the TaskService would be greatly appreciated as the Class Reference's docs aren't really that helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4320" LastEditorUserId="57" LastEditDate="2015-12-22T18:17:53.193" LastActivityDate="2015-12-22T18:23:14.270" Title="Craft TaskService Overview/Cron Job" Tags="&lt;cron&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12974" PostTypeId="2" ParentId="12971" CreationDate="2015-12-22T15:20:31.603" Score="4" Body="&lt;p&gt;Take a look at the &lt;code&gt;shuffle&lt;/code&gt; function provided by Craft: &lt;a href=&quot;https://craftcms.com/docs/templating/functions#shuffle&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/functions#shuffle&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will shuffle the complete array and output them all in the new order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = [&#xA;    { bildli: 'http://i.giphy.com/I0xDz0htjsiME.gif' },&#xA;    { bildli: 'https://i.giphy.com/fA3JALhIi5YVa.gif' }&#xA;] %}&#xA;&#xA;{% set shuffledImages = shuffle(img) %}&#xA;&#xA;{% for item in shuffledImages %}&#xA;    &amp;lt;img src=&quot;{{ item.bildli }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to just output one random image, then this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = [&#xA;    { bildli: 'http://i.giphy.com/I0xDz0htjsiME.gif' },&#xA;    { bildli: 'https://i.giphy.com/fA3JALhIi5YVa.gif' }&#xA;] %}&#xA;&#xA;{% set randomImage = shuffle(img) | first %}&#xA;&#xA;&amp;lt;img src=&quot;{{ randomImage.bildli }}&quot; alt=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2015-12-22T15:20:31.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12975" PostTypeId="1" CreationDate="2015-12-22T15:59:49.357" Score="0" ViewCount="95" Body="&lt;p&gt;I'm using locales to drive several sites/domains from one build.&#xA;I have set up a bunch of 301 redirects in the &lt;code&gt;.htaccess&lt;/code&gt; to capture and redirect previous URLs. I've used &lt;code&gt;RewriteCond&lt;/code&gt; to target the rules for the individual sites but these aren't working as I'd expect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^site1\.com [NC]&#xA;RewriteRule ^news.asp /news/news-listings? [R=301,L] &#xA;&#xA;RewriteCond %{HTTP_HOST} ^site2\.com [NC]&#xA;RewriteRule ^news.asp /news-galleries/news-listings? [R=301,L] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I enter &lt;code&gt;site2.com/news.asp&lt;/code&gt; I am redirected to the Rule stated for &lt;code&gt;site1&lt;/code&gt; so the user is redirected to &lt;code&gt;site2.com/news/news-listings&lt;/code&gt; which (obviously) returns a 404 error message. Any thoughts on how should be doing the above properly?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2015-12-22T17:38:44.160" Title="htaccess query (not Craft per se)" Tags="&lt;htaccess&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="12976" PostTypeId="2" ParentId="12975" CreationDate="2015-12-22T17:38:44.160" Score="1" Body="&lt;p&gt;As per your comments, I've gleaned that the problem is really because of an incorrect assumption about how RewriteConds apply to RewriteRules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm guessing your .htaccess looks more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^site1\.com [NC]&#xA;RewriteRule ^someurl.asp /folder/page? [R=301,L]&#xA;RewriteRule ^news.asp /news/news-listings? [R=301,L] &#xA;&#xA;RewriteCond %{HTTP_HOST} ^site2\.com [NC]&#xA;RewriteRule ^someurl.asp /folder/page? [R=301,L]&#xA;RewriteRule ^news.asp /news-galleries/news-listings? [R=301,L] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So there are multiple RewriteRules to some of the RewriteCond statements. You're expecting &lt;code&gt;site2.com/news.asp&lt;/code&gt; to go to &lt;code&gt;site2.com/news-galleries/news-listings?&lt;/code&gt;, but instead it's going to &lt;code&gt;site2.com/news/news-listings?&lt;/code&gt; because it's strictly obeying the mod_rewrite rules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is because RewriteCond statements only apply to the RewriteRule that immediately follows them&lt;/strong&gt;. So your &lt;code&gt;site2.com/news.asp&lt;/code&gt; request is actually matching the second RewriteRule in the above example.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;RewriteMap to the rescue&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you have a lot of URLs you're needing to manually rewrite under multiple condition scenarios, this can get complicated because you would have to define the same RewriteCond statements for each RewriteRule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a better way - use &lt;a href=&quot;https://httpd.apache.org/docs/trunk/rewrite/rewritemap.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;RewriteMap&lt;/code&gt;&lt;/a&gt; (not yet tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteMap &quot;site1.com&quot; &quot;txt:/path/to/file/site1.com.txt&quot;&#xA;RewriteMap &quot;site2.com&quot; &quot;txt:/path/to/file/site2.com.txt&quot;&#xA;&#xA;RewriteCond %{HTTP_HOST} ^site1\.com [NC]&#xA;RewriteRule ^(.*)$ &quot;${site1.com:$1}&quot; [R=301,L]&#xA;&#xA;RewriteCond %{HTTP_HOST} ^site2\.com [NC]&#xA;RewriteRule ^(.*)$ &quot;${site2.com:$1}&quot; [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would be it. One &lt;code&gt;RewriteMap&lt;/code&gt;, &lt;code&gt;RewriteCond&lt;/code&gt; and &lt;code&gt;RewriteRule&lt;/code&gt; per domain. Then your site2.com domain rewrite-map file would look like this, for example (simple space-seaparted, key-value pairs):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news.asp /news-galleries/news-listings?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps provide a more flexible, manageable solution :)&lt;/p&gt;&#xA;" OwnerUserId="4523" LastActivityDate="2015-12-22T17:38:44.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12977" PostTypeId="1" AcceptedAnswerId="13318" CreationDate="2015-12-22T17:39:41.893" Score="2" ViewCount="577" Body="&lt;p&gt;After recently discovering the logs for Sprout forms (located in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;) I have been studying them and debugging new forms that I am creating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After integrating a form hook in my templates, I am getting an error: &lt;code&gt;A form submission failed because the user did not have Javascript enabled.&lt;/code&gt; - but I do have Javascript enabled... it is prevalent on other parts of the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips... ?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2015-12-22T18:25:07.000" LastActivityDate="2020-01-20T10:54:26.520" Title="Sprout Forms issue: form not submitting" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12978" PostTypeId="2" ParentId="12613" CreationDate="2015-12-22T17:53:48.183" Score="3" Body="&lt;p&gt;OK So without being too verbose about this, here is how I managed to attach information to each marker.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is important to remember that each marker has an ID which corresponds to the entry / user that it is derived from. Using javascript, I created a small function that when given a numeric ID, it creates the smartmap ID by prepending adn appending characters to the ID. So 43 would return smartmap-mapcanvas-1.43.memberAddress in my case.&lt;/li&gt;&#xA;&lt;li&gt;Using that function as a building block, I was able to create a craft loop on my template that queries the user, gets their id, gets the relevant information, and then using javascript to apply it to the matching id marker. &lt;/li&gt;&#xA;&lt;li&gt;Google markers are just javascript objects. So you can add anything to them.... Strings, Arrays, Objects, whatever... Then use javascript to query that extra &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If anyone needs help, hit me up and I'll happily share my code.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2015-12-22T17:53:48.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12979" PostTypeId="2" ParentId="12973" CreationDate="2015-12-22T18:23:14.270" Score="3" Body="&lt;p&gt;Craft's tasks are meant for long-running PHP requests and don't have to execute immediately.  By default when you create a new task, it is queued in the database in the &lt;code&gt;craft_tasks&lt;/code&gt; table and it takes a control panel request to trigger it to run, so with that method, there's no guaranteed way to have it run every 15 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow&quot;&gt;runTasksAutomatically&lt;/a&gt; config setting to false, then you can setup an cron job that runs at any interval you wish.  You'd point it to a controller action on your plugin and manually trigger the task that way.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-22T18:23:14.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12980" PostTypeId="1" CreationDate="2015-12-22T18:58:02.107" Score="2" ViewCount="755" Body="&lt;p&gt;User Registration Form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to setup a public registration form in Craft CMS.  Currently this form support only fields username, email, password, but I want to add at least 10 other fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I want to create three types of user groups. How do I update the group in the public registration form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;User registration in Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="57" LastEditDate="2015-12-22T21:04:44.163" LastActivityDate="2015-12-22T21:04:44.163" Title="How to add addition attribute and fields in public registration form in Craft CMS" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;user-groups&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12981" PostTypeId="1" CreationDate="2015-12-22T20:07:32.820" Score="0" ViewCount="101" Body="&lt;p&gt;After creating a default meta entry in Sprout SEO. Any subsequent updates aren't saved and I get an error message &quot;Couldn't save the default&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 2.4.2725&lt;/li&gt;&#xA;&lt;li&gt;Sprout SEO 1.1.1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Has anyone else come across this?&lt;/p&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2016-01-11T20:38:08.423" Title="Sprout SEO: Getting error on save, preventing updating &quot;default&quot; meta data" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12982" PostTypeId="2" ParentId="12812" CreationDate="2015-12-22T20:14:16.140" Score="1" Body="&lt;p&gt;You can do a task resave after elements are entered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function resaveElements()&#xA;{&#xA;    // Queue up a new ResaveElements task&#xA;    craft()-&amp;gt;tasks-&amp;gt;createTask('ResaveElements', null, array(&#xA;        'elementType' =&amp;gt; ElementType::Entry,&#xA;        'criteria'    =&amp;gt; array('section' =&amp;gt; 'search', 'limit' =&amp;gt; null, 'status' =&amp;gt; null,'localeEnabled' =&amp;gt; null)&#xA;    ));&#xA;&#xA;    // Start running tasks&#xA;    craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4479" LastEditorUserId="57" LastEditDate="2015-12-22T20:22:51.583" LastActivityDate="2015-12-22T20:22:51.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12983" PostTypeId="2" ParentId="12980" CreationDate="2015-12-22T20:56:27.543" Score="5" Body="&lt;p&gt;Before you can allow any type of user groups you will need at a minimum of the Client version of Craft. To allow public registration, you will need the Professional version. Only the Professional version will allow you to have public registration on our site. &lt;a href=&quot;https://craftcms.com/docs/users&quot; rel=&quot;noreferrer&quot;&gt;Here is more information about users and user groups.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add additional fields to your registration form, I would &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;noreferrer&quot;&gt;start here.&lt;/a&gt; That will get you started with a basic form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to create a new field within the CP. For example - let's say I want to capture your pets name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will create a text input, called &lt;code&gt;petName&lt;/code&gt;. Then in the layout builder, I will assign that field to the user profile tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I need to update my registration form with my new input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: any new field you want to add to the user's profile &lt;em&gt;must&lt;/em&gt; be prefixed with &lt;code&gt;fields[]&lt;/code&gt;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;petName&quot;&amp;gt;Pet Name&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;petName&quot; name=&quot;fields[petName]&quot; {%- if account is defined %} value=&quot;{{ account.petName }}&quot;{% endif %}&quot; placeholder=&quot;&quot;&amp;gt;&#xA;{{ account is defined and account ? errorList(account.getErrors('petName')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-22T20:56:27.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12984" PostTypeId="1" CreationDate="2015-12-22T21:02:37.700" Score="4" ViewCount="718" Body="&lt;p&gt;Tags are used to categorize blog post topics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I delete or manage unused tags? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, one user created a &quot;Success Factors&quot; tag and another created a &quot;SAP SuccessFactors&quot; tag. The goal is to remove one of these to keep the categories tight.&lt;/p&gt;&#xA;" OwnerUserId="4525" LastActivityDate="2015-12-22T21:48:33.843" Title="Deleting unused tags" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12985" PostTypeId="2" ParentId="12984" CreationDate="2015-12-22T21:48:33.843" Score="6" Body="&lt;p&gt;There currently isn't any Tag management in Craft, but if you think there should be, consider voting for &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7179221-tag-management&quot; rel=&quot;noreferrer&quot;&gt;this feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, there is a 3rd party plugin called &lt;a href=&quot;https://straightupcraft.com/craft-plugins/tag-manager&quot; rel=&quot;noreferrer&quot;&gt;Tag Manager&lt;/a&gt; that will let you delete tags, although it won't show you which ones aren't in use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;https://craftcms.com/support/active-tags&quot; rel=&quot;noreferrer&quot;&gt;help article&lt;/a&gt; that shows how to select all of the tags that are in use.  From there you could diff it with the full tag list to see the ones that aren't in use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-22T21:48:33.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12986" PostTypeId="1" CreationDate="2015-12-22T22:17:10.373" Score="0" ViewCount="298" Body="&lt;p&gt;I'm having issues trying to &lt;code&gt;merge&lt;/code&gt; a nested hash to get unique values. I'm getting this error which points to the last line of for the loop:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;A hash key must be followed by a colon (:). Unexpected token &quot;punctuation&quot; of value &quot;}&quot; (&quot;punctuation&quot; expected with value &quot;:&quot;).&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contentTypes = {} %}&#xA;&#xA;{% for row in survey.questions %}&#xA;    {% set settings = row.settings.first %}&#xA;    {% set factor %}{{ settings.factor }}{{ settings.subFactor ? '_' ~ settings.subFactor }}{% endset %}&#xA;    {% set factorLbl = factor|title|replace('_', ' / ') %}&#xA;    {% set option %}{{ factor }}: { factorVal: '{{ factor }}', factorLbl: '{{ factorLbl }}'}{% endset %}&#xA;    {% set contentTypes = contentTypes|merge({option}) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;factor&lt;/code&gt; is currently being set as a string, which is causing the &lt;code&gt;merge&lt;/code&gt; to only set the last key in the for loop. How do I concatenate the two strings into a variable if &lt;code&gt;settings.subFactor&lt;/code&gt; exists?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set factor = settings.factor ~ settings.subFactor ? '_' ~ settings.subFactor %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2015-12-23T15:24:01.893" LastActivityDate="2015-12-23T15:32:36.807" Title="Merging Hash Error" Tags="&lt;merge&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12987" PostTypeId="2" ParentId="12986" CreationDate="2015-12-22T22:33:11.357" Score="3" Body="&lt;p&gt;You are setting &lt;code&gt;option&lt;/code&gt; to a string here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set option %}...{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;merge&lt;/a&gt; takes an array or a hash as a parameter. It looks to me like you want &lt;code&gt;option&lt;/code&gt; to be a hash:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set option = {factor: {'factorVal': factor, 'factorLbl': factorLbl}} %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-12-22T22:33:11.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12990" PostTypeId="1" AcceptedAnswerId="12993" CreationDate="2015-12-23T07:06:17.400" Score="1" ViewCount="779" Body="&lt;p&gt;New to remote assets, and can't seem to find any information on accessing remote assets via filepath in areas twig can't be used, such as CSS. I'd like to be able to use those same assets in CSS files but can't seem to find them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I named my remote Amazon S3 Asset Source handle to 'amazon', and it has sub folders &lt;code&gt;asset/images/template&lt;/code&gt; for an example, would there be a way to reach the files in a file path such as &lt;code&gt;amazon/assets/images/template/filename.jpg&lt;/code&gt; for use in CSS and whatnot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any information would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2015-12-23T10:16:12.970" Title="Do Remote Assets (ie. S3) have file paths?" Tags="&lt;assets&gt;&lt;css&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12992" PostTypeId="1" AcceptedAnswerId="13001" CreationDate="2015-12-23T09:35:16.473" Score="1" ViewCount="301" Body="&lt;p&gt;I wanted to listen to the &lt;code&gt;onSetStatus&lt;/code&gt; event of the &lt;code&gt;SetStatusElementAction&lt;/code&gt; and used the same code like in the &lt;code&gt;EntryElementType&lt;/code&gt; class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$setStatusAction = craft()-&amp;gt;elements-&amp;gt;getAction('SetStatus');&#xA;$setStatusAction-&amp;gt;onSetStatus = function(Event $event) {&#xA;  MyPlugin::log('maybe');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it didn't work and I had to hack into the core making following code changes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the &lt;code&gt;ElementsService&lt;/code&gt; class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Fires an 'onSetStatus' event.&#xA; *&#xA; * @param Event $event&#xA; *&#xA; * @return null&#xA; */&#xA;public function onSetStatus(Event $event)&#xA;{&#xA;    $this-&amp;gt;raiseEvent('onSetStatus', $event);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the &lt;code&gt;EntryElementType::getAvailableActions&lt;/code&gt; method where the &lt;code&gt;onSetStatus&lt;/code&gt; is called:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;onSetStatus($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way I'm able to listen to the event in my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.setStatus', function() { ... });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that with the next update I have to do the code changes again. Is there a better way to listen to the event or is this worth a push request?&lt;/p&gt;&#xA;" OwnerUserId="4200" LastActivityDate="2015-12-23T18:40:33.987" Title="Listen to onSetStatus event" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;services&gt;&lt;status&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12993" PostTypeId="2" ParentId="12990" CreationDate="2015-12-23T10:16:12.970" Score="5" Body="&lt;p&gt;This question is really more about S3 than about Craft. What you need for the assets is not the file path, but the url. And yes, S3 assets do have a url. &lt;a href=&quot;http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html&quot;&gt;This page&lt;/a&gt; describes the format for the host:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;bucket-name&amp;gt;.s3-website-&amp;lt;AWS-region&amp;gt;.amazonaws.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They give these examples:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This URL requests the photo.jpg object, which is stored at the root level in the bucket.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://examplebucket.s3-website-us-east-1.amazonaws.com/photo.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This URL requests the docs/doc1.html object in your bucket.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://examplebucket.s3-website-us-east-1.amazonaws.com/docs/doc1.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2015-12-23T10:16:12.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12994" PostTypeId="1" CreationDate="2015-12-23T10:36:08.787" Score="3" ViewCount="197" Body="&lt;p&gt;My question is re: localization of ElementTypes in a plugin.  I have the records all working fine in multiple locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part that I'm not &quot;getting&quot; is I think there should be one Element in &lt;code&gt;craft_elements&lt;/code&gt; and then for each localization, there should be one record in &lt;code&gt;craft_elements_i18n&lt;/code&gt; yes?  And then for each localization, there should be a separate record in my &lt;code&gt;craft_seomatic_meta&lt;/code&gt; table for each localized version yes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where in my controller it saves the ElementType: &lt;a href=&quot;https://github.com/khalwat/seomatic/blob/master/controllers/SeomaticController.php#L173&quot; rel=&quot;nofollow&quot;&gt;https://github.com/khalwat/seomatic/blob/master/controllers/SeomaticController.php#L173&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the function is calls in my service to save the element &amp;amp; record: &lt;a href=&quot;https://github.com/khalwat/seomatic/blob/master/services/SeomaticService.php#L683&quot; rel=&quot;nofollow&quot;&gt;https://github.com/khalwat/seomatic/blob/master/services/SeomaticService.php#L683&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I call &lt;code&gt;$result = craft()-&amp;gt;elements-&amp;gt;getElementById($metaId, 'Seomatic_Meta', $locale);&lt;/code&gt; how does it &quot;know&quot; which record to look up to load the returned &lt;code&gt;Seomatic_MetaElementType&lt;/code&gt; with data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm clearly missing something basic regarding how this should all work&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-23T18:37:31.983" Title="Localized ElementTypes in a plugin" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12995" PostTypeId="1" AcceptedAnswerId="13002" CreationDate="2015-12-23T12:11:48.547" Score="1" ViewCount="549" Body="&lt;p&gt;Since I updated to Craft 2.5, I have a weird bug in my entry edition window. Some entries work just fine, and other gives me this :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0f96c.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0f96c.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Like if there was nothing (actually there is something, this single in particular has two tabs and many fields in each..)&lt;/p&gt;&#xA;&lt;p&gt;Any fix ? Thanks !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-12-23T18:50:14.067" Title="Fields not displaying for some entries in control panel" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12996" PostTypeId="1" AcceptedAnswerId="12998" CreationDate="2015-12-23T14:07:28.097" Score="1" ViewCount="435" Body="&lt;p&gt;I have been testing out my user registration form and get to the following point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. User is created&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the profile is created, except the firstName and lastName (these are the handles that I am using in the form) are not created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. User is not added to default group&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my form markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ url('/?status=registrationEmailSent') }}&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;h3&amp;gt;Required fields:&amp;lt;/h3&amp;gt;&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;firstName&quot; name=&quot;fields[firstName]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('firstName')) }}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;lastName&quot;&amp;gt;Surname&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;lastName&quot; name=&quot;fields[lastName]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.lastName }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('lastName')) }}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;Optional fields:&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p class=&quot;instructions&quot;&amp;gt;We would appreciate it if you could please provide just a little bit more info about your company.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;membersCompanyName&quot;&amp;gt;Company Name&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;membersCompanyName&quot; name=&quot;fields[membersCompanyName]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.membersCompanyName }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('membersCompanyName')) }}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;membersPosition&quot;&amp;gt;Job Title&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;membersPosition&quot; name=&quot;fields[membersPosition]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.membersPosition }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('membersPosition')) }}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;membersPhoneNumber&quot;&amp;gt;Telephone no.&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;membersPhoneNumber&quot; name=&quot;fields[membersPhoneNumber]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.membersPhoneNumber }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('membersPhoneNumber')) }}&#xA;&#xA;    &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;membersWebsite&quot;&amp;gt;Website&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;membersWebsite&quot; name=&quot;fields[membersWebsite]&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.membersWebsite }}&quot;{% endif %}&amp;gt;&#xA;    {{ account is defined and account ? errorList(account.getErrors('membersWebsite')) }}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('members/login') }}&quot;&amp;gt;No, I just want to log in.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2015-12-23T18:57:42.903" LastActivityDate="2019-09-01T01:28:38.240" Title="User registration - no confirmation email sent, not added to group" Tags="&lt;registration&gt;&lt;user-groups&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12997" PostTypeId="2" ParentId="12986" CreationDate="2015-12-23T15:32:36.807" Score="0" Body="&lt;p&gt;Marion got me pointed in the right direction. I was setting &lt;code&gt;factor&lt;/code&gt; as a string in my original post, which only allowed one key in the hash as it was 'seen' as the same every time through the &lt;code&gt;merge&lt;/code&gt; function in the for loop. Converting &lt;code&gt;factor&lt;/code&gt; to a variable fixed this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contentTypes = {} %}&#xA;&#xA;{% for row in survey.questions %}&#xA;    {% set settings = row.settings.first %}&#xA;    {% set factor = settings.factor ~ (settings.subFactor ? '_' ~ settings.subFactor) %}&#xA;    {% set factorLbl = factor|title|replace('_', ' / ') %}&#xA;    {% set contentTypes = contentTypes|merge({ (factor) : {'value': factor, 'label': factorLbl} }) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastActivityDate="2015-12-23T15:32:36.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12998" PostTypeId="2" ParentId="12996" CreationDate="2015-12-23T15:56:28.540" Score="1" Body="&lt;p&gt;Somewhere, I came across a thread that Brad had provided a bit of insight about the First &amp;amp; Last name fields. They are kind of &quot;special&quot; is all I can remember.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, the First &amp;amp; Last name fields do not need the &lt;code&gt;fields&lt;/code&gt; prepended to them. They can get passed along like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;firstName&quot; name=&quot;firstName&quot; class=&quot;form-control&quot; &#xA;{%- if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif %}&quot;&amp;gt;&#xA;{{ account is defined and account ? errorList(account.getErrors('firstName')) }}&#xA;&#xA;...&#xA;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;lastName&quot; name=&quot;lastName&quot; class=&quot;form-control&quot; &#xA;{%- if account is defined %} value=&quot;{{ account.lastName }}&quot;{% endif %}&quot;&amp;gt;&#xA;{{ account is defined and account ? errorList(account.getErrors('lastName')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for not getting added to your group, have you created a user group for newly registered users? For example, let's say I created a user group called &quot;Public&quot;. Then (assuming you are using Craft Pro) Craft will give me the option to choose which user group I want the default user group to be. Are you able to set that?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2015-12-23T15:56:28.540" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="12999" PostTypeId="1" CreationDate="2015-12-23T18:14:29.527" Score="2" ViewCount="1151" Body="&lt;p&gt;I am trying to debug a failed task in craft.  However I'm not really sure what I'm looking for.  I've dug though the log files and found traces of the task but no real errors to speak of.  I have set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'runTasksAutomatically' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in my general.php file so that when I create my task:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;tasks-&amp;gt;createTask('WassermanNews_SocialTask');&#xA;craft()-&amp;gt;end();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it will become a pending task rather than run automatically. That part seems to work as I end up with a pending task in my control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y2a8w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y2a8w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think I've got the process up to this point.  From here I'd simply like to kick off that pending process which I am attempting to do by though cURL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;curl -H &quot;X-Requested-With: XMLHttpRequest&quot; myurl.dev:32769/actions/tasks/runPendingTasks&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that this is firing because the tasks moves from a pending state to a failed state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jXQwM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jXQwM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However as I previously mentioned I have no idea why the task is failing and the logs do not seem to be my friend today.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I could be doing wrong/where I could look for errors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my task which should be firing (it fires 1 subTask):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class WassermanNews_SocialTask extends BaseTask&#xA;{&#xA;  $TWITTER = 1;&#xA;  $INSTAGRAM = 2;&#xA;  $VINE = 3;&#xA;&#xA;  public function getDescription()&#xA;  {&#xA;    return 'Social Grab';&#xA;  }&#xA;&#xA;  public function getTotalSteps()&#xA;  {&#xA;    return 3;&#xA;  }&#xA;&#xA;  public function runStep($step)&#xA;  { &#xA;    WassermanNewsPlugin::log(&quot;Social Grab stepz izz happening&quot;,LogLevel::Info);&#xA;&#xA;    switch($step){&#xA;        case TWITTER:&#xA;            return $this-&amp;gt;runSubTask('WassermanNews_TwitterTask');&#xA;        case INSTAGRAM;&#xA;            return $this-&amp;gt;runSubTask('WassermanNews_InstagramTask');&#xA;        case VINE:&#xA;            return $this-&amp;gt;runSubTask('WassermanNews_VineTask');&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All the sub tasks look more or less identical to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class WassermanNews_TwitterTask extends BaseTask&#xA;{&#xA;  public function getDescription()&#xA;  {&#xA;    return 'Twitter Task';&#xA;  }&#xA;&#xA;  public function getTotalSteps()&#xA;  {&#xA;    return 1;&#xA;  }&#xA;&#xA;  public function runStep($step)&#xA;  {&#xA;    return &quot;twitter step&quot;;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help figuring this out would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I just attempted to run the an example and it failed as well.  Do certain settings affect how tasks are run?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Installed PixelAndTonic's &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap&quot; rel=&quot;nofollow noreferrer&quot;&gt;Power Nap&lt;/a&gt; and it failed as well!  I did however find a log for this example saying: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Encountered an error running task 95 (PowerNap): Could not find the task component type.&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This makes me wonder what the type of the task has to be!  I took a look in TasksService.php and saw that the error is derived from not having a type so what type do tasks need to have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NJPoQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NJPoQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4320" LastEditorUserId="5437" LastEditDate="2017-11-08T07:07:59.047" LastActivityDate="2018-02-03T23:51:58.447" Title="Debugging a Failed Custom Task in Craft CMS" Tags="&lt;tasks&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13000" PostTypeId="2" ParentId="12994" CreationDate="2015-12-23T18:37:31.983" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The part that I'm not &quot;getting&quot; is I think there should be one Element in craft_elements and then for each localization, there should be one record in craft_elements_i18n yes? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And then for each localization, there should be a separate record in my craft_seomatic_meta table for each localized version yes?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Only if the values in that table need to be stored on a per-locale basis, which to my knowledge has never been the case until now with SEOmatic.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When I call $result = craft()-&gt;elements-&gt;getElementById($metaId, 'Seomatic_Meta', $locale); how does it &quot;know&quot; which record to look up to load the returned Seomatic_MetaElementType with data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any time you run an element query (which &lt;code&gt;getElementById()&lt;/code&gt; does), the element type’s &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/IElementType#modifyElementsQuery-detail&quot;&gt;&lt;code&gt;modifyElementsQuery()&lt;/code&gt;&lt;/a&gt; method will be called, which gives the element type a chance to make changes to the query. In &lt;a href=&quot;https://github.com/khalwat/seomatic/blob/master/elementtypes/Seomatic_MetaElementType.php#L156&quot;&gt;yours&lt;/a&gt;, you have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query&#xA;    -&amp;gt;addSelect('seomatic_meta.*')&#xA;    -&amp;gt;join('seomatic_meta seomatic_meta', 'seomatic_meta.elementid = elements.id')&#xA;    -&amp;gt;andWhere(DbHelper::parseParam('seomatic_meta.locale', $criteria-&amp;gt;locale, $query-&amp;gt;params));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That condition you’re adding to the query on the &lt;code&gt;seomatic_meta.locale&lt;/code&gt; column is what is ensuring that the correct localized row in your &lt;code&gt;seomatic_meta&lt;/code&gt; table will be included in the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That’s just for &lt;em&gt;selecting&lt;/em&gt; elements though. I might be missing something, but looking at your &lt;a href=&quot;https://github.com/khalwat/seomatic/blob/master/services/SeomaticService.php#L683&quot;&gt;SeomaticService::saveMeta()&lt;/a&gt; method, it doesn’t look like you’re ever ensuring that all of the localized rows are actually getting saved. If you take a look through &lt;a href=&quot;https://craftcms.com/classreference/services/ElementsService#saveElement-detail&quot;&gt;ElementsService::saveElement()&lt;/a&gt;, you will see that one of the things it does is loop through the locales returned by &lt;code&gt;$element-&amp;gt;getLocales()&lt;/code&gt; and make sure that there’s an ElementLocaleRecord (elements_i18n row) for the element in each of those locales. If you want to store rows for each locale in your own craft_seomatic_meta table, it’s the plugin’s responsibility to do that, not Craft’s.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2015-12-23T18:37:31.983" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13001" PostTypeId="2" ParentId="12992" CreationDate="2015-12-23T18:40:33.987" Score="2" Body="&lt;p&gt;As you've discovered, you should be using the more generic &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction&quot; rel=&quot;nofollow&quot;&gt;elements.onBeforePerformAction&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction&quot; rel=&quot;nofollow&quot;&gt;elements.onPerformAction&lt;/a&gt; events.  They get fired when &lt;em&gt;any&lt;/em&gt; action takes place and you can check their &lt;code&gt;action&lt;/code&gt; parameter to determine if it was a &lt;code&gt;SetStatus&lt;/code&gt; action.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-23T18:40:33.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13002" PostTypeId="2" ParentId="12995" CreationDate="2015-12-23T18:48:15.280" Score="2" Body="&lt;p&gt;If you have &lt;a href=&quot;http://xdebug.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;xDebug&lt;/a&gt; installed on your server, you're probably running into &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1559/why-are-some-entry-detail-views-empty-in-the-control-panel/1560#1560&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't, you're probably running into &lt;a href=&quot;https://craftcms.stackexchange.com/a/2777/57&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2015-12-23T18:48:15.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13003" PostTypeId="2" ParentId="5415" CreationDate="2015-12-23T20:40:33.737" Score="13" Body="&lt;p&gt;I had this same issue and resolved it (at the suggestion of Craft CMS support) by enabling ImageMagick in the php.ini and restarting MAMP PRO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per the MAMP PRO 3.0 user guide:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The ImageMagick PHP module is included by default, but you must enable it inside the php.ini template file. Remove the ‘;’ from the following line.&#xA;;extension=imagick.so&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2015-12-23T20:40:33.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13006" PostTypeId="1" CreationDate="2015-12-24T09:20:56.157" Score="0" ViewCount="163" Body="&lt;p&gt;I have a problem - I can not properly conclude the list of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Total output last 3 records. Each entry must be a separate template. How can this be implemented?&lt;/p&gt;&#xA;" OwnerUserId="4530" LastActivityDate="2015-12-24T23:48:37.763" Title="Entry List template" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13007" PostTypeId="2" ParentId="13006" CreationDate="2015-12-24T23:48:37.763" Score="2" Body="&lt;p&gt;If I'm following you correctly, I think what you're looking for is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').limit(3).find() %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;{{entry.postDate }} - {{ entry.title }}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default, Craft will order results by the date created in descending order, so that query will get you the last 3 entries in the news section and display them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-24T23:48:37.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13009" PostTypeId="1" CreationDate="2015-12-27T02:22:55.393" Score="3" ViewCount="145" Body="&lt;p&gt;When exactly are migrations run?  I wrote a migration that runs and does its job properly if I run it via the command line: &lt;code&gt;yiic migrate up Seomatic&lt;/code&gt; but despite the version number and schema number being bumped, Craft doesn’t run the migration automatically`&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, my code dies because of a column that doesn’t exist in the db.  Shouldn't the migration be found and run before my plugin's code is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the version numbers returned by my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getVersion()&#xA;{&#xA;    return '1.0.5';&#xA;}&#xA;&#xA;public function getSchemaVersion()&#xA;{&#xA;    return '1.0.1';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The previous installed version was '1.0.4' and '1.0.0', respectively.  Shouldn't this be enough for Craft to find and run the migration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The migration is named:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m151225_000000_seomatic_addHumansField.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...with a class of the same name, and again, it's found and runs properly if manually run it via &lt;code&gt;yiic&lt;/code&gt; -- what am I missing?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-27T02:33:34.460" Title="Plugin migration quandary" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13010" PostTypeId="2" ParentId="13009" CreationDate="2015-12-27T02:33:34.460" Score="4" Body="&lt;p&gt;Actually, everything was working fine with the migration.  The issue was that I had code inside of a Twig extension and inside of a rendering hook that was being executed before the migration tried to take place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrapped it in &lt;code&gt;if (!craft()-&amp;gt;request-&amp;gt;isCpRequest())&lt;/code&gt; to only do its thing when it's a non-CP request (which is how it probably should have been anyway), and all is well.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2015-12-27T02:33:34.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13011" PostTypeId="1" AcceptedAnswerId="13012" CreationDate="2015-12-27T04:06:16.390" Score="4" ViewCount="347" Body="&lt;p&gt;I am saving users from an external source and able to create them in the Craft db as users. However, each user's password is set to null despite setting it on the user model prior to saving it. Is there a way to handle setting passwords during user creation? I am not requiring email verification.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($docs as $doc) {&#xA;&#xA;    $user = new UserModel;&#xA;&#xA;    $user-&amp;gt;firstName    = $doc-&amp;gt;FName;&#xA;    $user-&amp;gt;lastName     = $doc-&amp;gt;LName;&#xA;    $user-&amp;gt;password     = '123456';&#xA;    $user-&amp;gt;email        = $doc-&amp;gt;Email;&#xA;    $user-&amp;gt;username     = $doc-&amp;gt;Email;&#xA;&#xA;    $wasSaved = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    if ($wasSaved) {&#xA;        $was_assigned = craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, array(1));&#xA;    } else {&#xA;        printf(&quot;couldn't save: %s&quot;, $user-&amp;gt;email);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4293" LastEditorUserId="45" LastEditDate="2015-12-28T17:34:17.657" LastActivityDate="2015-12-28T17:34:17.657" Title="How do I set the user password when using saveUser service method?" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;password&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13012" PostTypeId="2" ParentId="13011" CreationDate="2015-12-27T09:57:14.647" Score="4" Body="&lt;p&gt;Use &lt;code&gt;newPassword&lt;/code&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;newPassword = '123456';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2015-12-27T09:57:14.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13013" PostTypeId="1" CreationDate="2015-12-28T00:46:27.100" Score="2" ViewCount="76" Body="&lt;p&gt;I am setting up a system that migrates users from an external source and have determined the most time expensive part is when the UsersService _setPasswordOnUserRecord method hashes the password&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$hash = craft()-&amp;gt;security-&amp;gt;hashPassword($user-&amp;gt;newPassword);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is taking about 2 secs where the rest of the operation for saving a user is about .2 sec. There are close to 10k users to it's really adding up! Is there any way to use a faster type of hash or bypass the hashing, or am I out of luck?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $user = new UserModel;&#xA;&#xA;    $user-&amp;gt;firstName    = &quot;First&quot;;&#xA;    $user-&amp;gt;lastName     = 'last';&#xA;    $user-&amp;gt;newPassword  = '123456';&#xA;    $user-&amp;gt;email        = 'email@email.com';&#xA;    $user-&amp;gt;username     = 'username';&#xA;&#xA;&#xA;&#xA;&#xA;    $wasSaved = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4293" LastEditorUserId="45" LastEditDate="2015-12-28T17:32:40.330" LastActivityDate="2015-12-28T17:32:40.330" Title="Is there a way to speed up password hashing?" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13014" PostTypeId="2" ParentId="13013" CreationDate="2015-12-28T00:55:50.207" Score="2" Body="&lt;p&gt;There is a general config setting for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#blowfishHashCost&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#blowfishHashCost&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting this to the minimum value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'blowfishHashCost' =&amp;gt; 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;made the hashing time negligible.&lt;/p&gt;&#xA;" OwnerUserId="4293" LastActivityDate="2015-12-28T00:55:50.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13016" PostTypeId="1" AcceptedAnswerId="13017" CreationDate="2015-12-28T18:31:36.850" Score="0" ViewCount="98" Body="&lt;p&gt;I'm having a few irregular errors after upgrading via the automatic update. When trying to visit the dashboard I get:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Passed variable is not an array or object, using empty array instead&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My &lt;code&gt;max_execution_time&lt;/code&gt; and &lt;code&gt;memory_limit&lt;/code&gt; are set pretty high, and I believe the upgrade completed successfully. But I cannot view the dashboard or settings pages. Everything else seems to be fine.&lt;/p&gt;&#xA;&lt;p&gt;Do I have to fully revert and re-try the upgrade via the manual method?&lt;/p&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2015-12-29T15:19:48.477" Title="Errors after upgrade to Craft 2.5" Tags="&lt;php&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13017" PostTypeId="2" ParentId="13016" CreationDate="2015-12-28T20:04:30.747" Score="3" Body="&lt;p&gt;To answer my own question: There may be some plugin incompatibilities when upgrading to Craft 2.5. This is to be expected, given all the variables. In my case the &lt;strong&gt;Placid&lt;/strong&gt; plugin was not yet compatible, as seen when I put Craft into &lt;code&gt;devMode&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Wait on the upgrade until your plugins are current, or &lt;/li&gt;&#xA;&lt;li&gt;Disable lagging plugins as necessary if you need the bleeding edge.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="3729" LastEditDate="2015-12-29T15:19:48.477" LastActivityDate="2015-12-29T15:19:48.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13018" PostTypeId="1" AcceptedAnswerId="13020" CreationDate="2015-12-28T22:24:17.583" Score="2" ViewCount="89" Body="&lt;p&gt;I'm doing a big import of users from an EE install using the Import plugin. I can pull in all the details I need except the join date, so I looked at the craft db to see where it needs to be changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I successfully managed to change it by updating the &lt;code&gt;craft_elements&lt;/code&gt; table, &lt;code&gt;dateCreated&lt;/code&gt; column. This changed the join date in the control panel, however it does update the &lt;code&gt;dateCreated&lt;/code&gt; column in the &lt;code&gt;craft_users&lt;/code&gt; table so I updated there also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering if thats correct?&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2015-12-28T22:51:02.520" Title="Updating a Users Join Date?" Tags="&lt;users&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13019" PostTypeId="1" AcceptedAnswerId="13117" CreationDate="2015-12-28T22:43:29.240" Score="4" ViewCount="822" Body="&lt;p&gt;I have a profile form where a user can update their email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon doing so I would like to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Show the user a message saying they must check their email to verify the new email address.&lt;/li&gt;&#xA;&lt;li&gt;After they click the &quot;Verify Email&quot; address in their inbox, redirect them to a url preferably with a Flash Message letting them know they'e successfully updated their email.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Possible?&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2016-01-06T20:25:51.067" Title="How would I show a message and define where the user is redirected after changing their email through a front end form?" Tags="&lt;user-profile&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13020" PostTypeId="2" ParentId="13018" CreationDate="2015-12-28T22:51:02.520" Score="3" Body="&lt;p&gt;Yup, that's correct. The &lt;code&gt;craft_elements.dateCreated&lt;/code&gt; column is the one that is referenced by the user's Join Date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of being thorough, I prefer to copy that same value into &lt;code&gt;craft_users.dateCreated&lt;/code&gt;, just as you have done.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-28T22:51:02.520" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13021" PostTypeId="1" CreationDate="2015-12-28T23:51:27.773" Score="1" ViewCount="88" Body="&lt;p&gt;I've Googled &amp;amp; searched on here, but have not been able to find the answer I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I come from using Advanced Custom Fields in the WP environment, and one feature that was great about ACF was being able to define the templates a field grouping would/can show on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take Craft for example. I have a grouping of fields that when combined form the banner &quot;field layout&quot; for a section. However, that &quot;field layout&quot; can be used on multiple other sections and even single pages. Without me having to re-create it on every single or section, is there a way that's much more efficient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also using the Reasons plugin &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/Reasons-Craft&lt;/a&gt; which enables me conditional fields. And I believe this is where the efficiency concerns are coming from. Because I am having to set the conditionals on each field layout. And if I decide to change something, I will need to change it across all other field layouts.&lt;/p&gt;&#xA;" OwnerUserId="4540" LastActivityDate="2015-12-29T06:44:27.837" Title="Re-usable Field Layouts" Tags="&lt;field&gt;&lt;admin&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13022" PostTypeId="1" CreationDate="2015-12-29T02:06:48.063" Score="0" ViewCount="78" Body="&lt;p&gt;I've been able to get this to work with my gmail address but not my work's Exchange email account. How can I make this receivable by exchange mail servers?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $email = new EmailModel();&#xA;    $email-&amp;gt;toEmail = 'EMAILADDRESS';&#xA;    $email-&amp;gt;subject = 'test';&#xA;    $email-&amp;gt;body    = 'test';&#xA;&#xA;    $sent = craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4293" LastActivityDate="2015-12-29T06:19:39.513" Title="sendEmail messages not being received by Exchange server" Tags="&lt;php&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13023" PostTypeId="2" ParentId="13022" CreationDate="2015-12-29T06:19:39.513" Score="1" Body="&lt;p&gt;I agree with Damon.  I use Exchange and haven't noticed any issues with receiving emails (either from Craft system or withing my own plugins).  I am using Mandrill to send them.  You might have greater success if you fill out more of the model (fromEmail etc) but more than likely it's using php mail that is the core issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Email deliverability is these days a complex thing, much better to leave it to the experts, although for best results even then you still need to pay attention to your Mandrill &amp;amp; domain setups (SPF/DKIM etc).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2015-12-29T06:19:39.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13024" PostTypeId="2" ParentId="13021" CreationDate="2015-12-29T06:44:27.837" Score="2" Body="&lt;p&gt;No, unfortunately there's no way to re-use a Field Layout in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to consider adding a feature request at &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;http://feedback.buildwithcraft.com&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-12-29T06:44:27.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13025" PostTypeId="1" AcceptedAnswerId="13026" CreationDate="2015-12-29T10:32:21.123" Score="1" ViewCount="43" Body="&lt;p&gt;Can someone point me to where in the DB you set a field as required? I am actually wanting to do this on a Sprout Forms field I am not sure if that makes a difference or not. I can't find which table you would do that in.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2015-12-29T12:38:51.407" Title="Where can you set a form field to required in the DB" Tags="&lt;field&gt;&lt;plugin-sproutforms&gt;&lt;required&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13026" PostTypeId="2" ParentId="13025" CreationDate="2015-12-29T12:38:51.407" Score="3" Body="&lt;p&gt;In Craft, fields can be shared across field layouts and there's no way to set a field as required across the board. A field can only be declared as &quot;required&quot; in the &lt;em&gt;context of a field layout&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually this is easily done by clicking the cogwheel next to a field inside a tab in the field layout designer, and selecting &quot;Make required&quot;. Sprout Forms uses the standard field layout designer, so you'll have this option here as well – though I'm guessing you have a specific reason for wanting to do it in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to set a field (in a field layout) as required, first you'll need to know the &lt;em&gt;field's ID&lt;/em&gt;. This is easily found by looking at the &lt;code&gt;craft_fields&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you'll need to know the ID for the &lt;em&gt;field layout&lt;/em&gt; you want to modify. In this case, you want the layout used by a specific Sprout Form, so the easiest way is to look at the &lt;code&gt;fieldLayoutId&lt;/code&gt; column in the &lt;code&gt;craft_sproutforms_forms&lt;/code&gt; table. &lt;em&gt;For entries, you have to look at the &lt;code&gt;craft_entrytypes&lt;/code&gt; table, for categories, you'll have to look at the &lt;code&gt;craft_categorygroups&lt;/code&gt; table, etc)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you'll need to identify the field in the &lt;code&gt;craft_fieldlayoutfields&lt;/code&gt; table, by looking at the &lt;code&gt;layoutId&lt;/code&gt; and the &lt;code&gt;fieldId&lt;/code&gt; columns. Set the &lt;code&gt;required&lt;/code&gt; column for the appropriate row to &lt;code&gt;1&lt;/code&gt;, and you're done.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-12-29T12:38:51.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13027" PostTypeId="1" AcceptedAnswerId="13028" CreationDate="2015-12-29T19:03:35.933" Score="2" ViewCount="2046" Body="&lt;p&gt;I have that simple variable in my javascript &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;var toLoad = '{% &quot;include _views/reviews.twig&quot; %}';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and on a page load I get template error that is defined in the title of question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That variable is defined in template, that includes another template and in that included template is called some 'class' to load &lt;code&gt;reviews.twig&lt;/code&gt; from our variable defined in parent template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2015-12-29T19:46:36.837" Title="A block must start with a tag name" Tags="&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13028" PostTypeId="2" ParentId="13027" CreationDate="2015-12-29T19:46:36.837" Score="4" Body="&lt;p&gt;You've got a quote in the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% &quot;include _views/reviews.twig&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_views/reviews.twig&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2015-12-29T19:46:36.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13029" PostTypeId="1" CreationDate="2015-12-29T23:15:40.277" Score="1" ViewCount="346" Body="&lt;p&gt;I'm not entirely sure if this is possible, or the right way to go about this, however here goes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a front end entry form that members use to create entries. These entries contain location data. I'm looking at using a maps plugin but nothing out there supports front end directly. I'm currently testing Squarebit Maps. (Smartmap is next!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, from checking out the db, Squarebit Maps stores it's field data in the &lt;code&gt;craft_content&lt;/code&gt; table in a format like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;mapLat&quot;:&quot;50.89150121867578&quot;,&quot;mapLng&quot;:&quot;-1.4487441291137202&quot;,&quot;mapZoom&quot;:&quot;15&quot;,&quot;pinLat&quot;:&quot;50.89150121867578&quot;,&quot;pinLng&quot;:&quot;-1.4487441291137202&quot;,&quot;__model__&quot;:&quot;Craft\\SquareBitMaps_MapModel&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was wondering, if I included a map for users to choose a location within the front end form using something like &lt;a href=&quot;http://ubilabs.github.io/geocomplete/&quot; rel=&quot;nofollow&quot;&gt;Geocomplete&lt;/a&gt; could I pass through the lat &amp;amp; long in a hidden field to the squarebit field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense?&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2016-03-22T04:29:38.620" Title="Front End entry form, mapping a hidden field to a plugin?" Tags="&lt;plugins&gt;&lt;form&gt;&lt;google-maps&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13031" PostTypeId="1" AcceptedAnswerId="13033" CreationDate="2015-12-30T16:18:47.177" Score="2" ViewCount="332" Body="&lt;p&gt;I use Craft to return some JSON data. The content however is available in different languages and I would like to get all those translations in a single API call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'products.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'products', 'order' =&amp;gt; ['default' =&amp;gt; 'lft asc']],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            $translate = [];&#xA;            foreach(array_keys($entry-&amp;gt;getLocales()) as $locale) {&#xA;                //$entry-&amp;gt;setLanguage($locale); Doesn't work with EntryModel&#xA;                $translate[$locale] = [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'slug' =&amp;gt; $entry-&amp;gt;slug&#xA;                    // ...&#xA;                ];&#xA;            }&#xA;            return $translate;&#xA;        },&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there doesn't seem to be a method call &lt;code&gt;setLanguage()&lt;/code&gt; like with fields. &#xA;I'm out of ideas. &lt;/p&gt;&#xA;" OwnerUserId="4546" LastEditorUserId="57" LastEditDate="2015-12-30T19:22:08.500" LastActivityDate="2015-12-30T19:46:05.647" Title="Receive all locales with ElementAPI plugin" Tags="&lt;localization&gt;&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13032" PostTypeId="1" AcceptedAnswerId="13041" CreationDate="2015-12-30T19:26:10.070" Score="1" ViewCount="724" Body="&lt;p&gt;I have a &lt;code&gt;channel&lt;/code&gt; called &quot;Groups&quot;, with a &lt;code&gt;users&lt;/code&gt; field type called &lt;code&gt;members&lt;/code&gt; for the entries. I need to be able to add/remove users to the &lt;code&gt;members&lt;/code&gt; entry field via plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've tried is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// criteria&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;// filter&#xA;$criteria-&amp;gt;slug     = 'groupNameHere';&#xA;&#xA;// section&#xA;$criteria-&amp;gt;section('groups');&#xA;&#xA;// get entry&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;foreach($enries as $entry)&#xA;{&#xA;    // get current members of group &#xA;    $members = $entry['members'];&#xA;&#xA;    // add new user model to $members&#xA;    $members[] = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail(&quot;newUserEmailHere&quot;);&#xA;&#xA;    // update field with new $members array&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttribute('members', $members);&#xA;&#xA;    // save&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This simply clears the previous &lt;code&gt;members&lt;/code&gt; value for the group, without even adding the new user. I can't find anything online about updating this type of field-type via plugin so I'm just guessing how to do this. Does anyone know the right way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any information would hugely help! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2015-12-31T08:12:38.157" LastActivityDate="2015-12-31T08:19:47.170" Title="Update User &quot;Field Type&quot; for Entry in Plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;fieldtypes&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13033" PostTypeId="2" ParentId="13031" CreationDate="2015-12-30T19:46:05.647" Score="2" Body="&lt;p&gt;Here are some other &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9005/how-to-create-a-query-to-group-alternate-language-pages&quot;&gt;similar&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8244/retrieving-an-entry-by-id-in-all-locales&quot;&gt;questions&lt;/a&gt; and answers to this, but the short of it is that you could probably do it with something like using QueryBuilder to query the database directly (and bypassing Craft's APIs) or grabbing all site locales and looping through and re-querying for the entries on a per locale basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of them are pretty ugly and probably not that efficient in the context of the ElementAPI plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-30T19:46:05.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13034" PostTypeId="1" AcceptedAnswerId="13035" CreationDate="2015-12-30T20:01:25.793" Score="2" ViewCount="593" Body="&lt;p&gt;Despite my best intentions to build sites with minimal use of plugins (in any CMS) I have resorted to a dozen or so on one Craft site with about 25 sections and 1000 entries, to help with both CP and front-end things. Since the v2.5 upgrade (I think) I noticed that the Settings page had become impossibly slow to load (about 30 seconds, and this often within the Settings area too) which stretches my tolerance when I am working. I disabled all loaded plugins and suddenly everything was good again. I then added plugins one by one and tested the Settings page loading time. It eventually came down to two (Cache Warmer and Sitemap) that slowed loading time, and the effect seemed to be cumulative (i.e. one plugin was only half as slow). Is it a reasonable assumption that some plugins may affect Settings page loading time, and has anyone else noticed this? What can I do about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess someone will mention the L-word (logs) but I always have a hard time understanding which log files to look at and what to look for.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2015-12-30T20:24:02.300" Title="Can Control Panel Settings page become very slow with some plugins?" Tags="&lt;plugins&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13035" PostTypeId="2" ParentId="13034" CreationDate="2015-12-30T20:24:02.300" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it a reasonable assumption that some plugins may affect Settings page loading time&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's very reasonable.  A plugin can do all sorts of things that might slow down CP rendering and it's reasonable to assume that all plugins don't test with databases that have 25 sections and thousands of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log files you want to look at are in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;. &lt;code&gt;craft.log&lt;/code&gt; is the most recent and &lt;code&gt;craft.log.1&lt;/code&gt;, &lt;code&gt;.2&lt;/code&gt;, etc. being older. Do it with &lt;a href=&quot;http://craftcms.com/docs/config-settings#devMode&quot;&gt;devMode&lt;/a&gt; enabled and you want to be looking at the timestamps for each entry to see where all of the time is being eaten up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively (or in addition to), you can create a &lt;a href=&quot;https://github.com/sjelfull/Craft-CacheWarmer/issues&quot;&gt;Github&lt;/a&gt; issue for CacheWarmer and let them know what you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sitemap is commercial, so you can go through the &lt;a href=&quot;https://www.putyourlightson.net/about&quot;&gt;developer's&lt;/a&gt; usual support channels.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-30T20:24:02.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13036" PostTypeId="1" AcceptedAnswerId="13039" CreationDate="2015-12-31T06:39:58.723" Score="2" ViewCount="530" Body="&lt;p&gt;As someone relatively new to Craft I'm constantly switching between a content type and &lt;code&gt;/admin/settings/fields&lt;/code&gt; so that I can see the handles for that content type. It just occurred to me that it would be relatively simple to show the handle right next to the field's name on the edit content screen. Might there be a setting for this somewhere, or would I have to (or be able to) create a plugin to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it's unclear, I'm looking to turn this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lRs9K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lRs9K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;into this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zP7rl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zP7rl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4509" LastActivityDate="2015-12-31T08:15:33.680" Title="Show field handles on control panel" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13038" PostTypeId="2" ParentId="13036" CreationDate="2015-12-31T07:33:34.737" Score="1" Body="&lt;p&gt;There currently isn't a setting to do this natively in Craft, but you might want to consider voting for some/all of &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9888675-see-the-field-handle-in-the-entry-type-edit-view&quot; rel=&quot;nofollow&quot;&gt;these&lt;/a&gt; &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9260673-hover-over-cp-field-name-label-to-reveal-the-handl&quot; rel=&quot;nofollow&quot;&gt;feature&lt;/a&gt; &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9233805-field-layout-designer-let-you-see-the-field-handle&quot; rel=&quot;nofollow&quot;&gt;requests&lt;/a&gt;, which seem to be all along the same vein of what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-31T07:33:34.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13039" PostTypeId="2" ParentId="13036" CreationDate="2015-12-31T07:42:25.887" Score="3" Body="&lt;p&gt;There's a plugin called &lt;a href=&quot;https://github.com/mmikkel/CpFieldLinks-Craft&quot; rel=&quot;nofollow&quot;&gt;CP Field Links&lt;/a&gt; which will display field handles and provide easy access to field (and entry type) settings. Please note that the plugin requires &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt; to be enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm the plugin author, so just get in touch if you have any questions or spot any issues.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-12-31T07:42:25.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13040" PostTypeId="2" ParentId="13036" CreationDate="2015-12-31T08:15:33.680" Score="1" Body="&lt;p&gt;If you are comfortable with your browsers developer tools, one way to get the field handle from an entry page that doesn't require any third-party plugins is to inspect the &lt;code&gt;label&lt;/code&gt; or &lt;code&gt;input&lt;/code&gt; element:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GyX98.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GyX98.png&quot; alt=&quot;Inspect Element&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field handle appears:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;As the middle segment of the &lt;code&gt;id&lt;/code&gt; attribute on the field's wrapper div&lt;/li&gt;&#xA;&lt;li&gt;As the final segment of the &lt;code&gt;for&lt;/code&gt; attribute on the field's label&lt;/li&gt;&#xA;&lt;li&gt;As the final segment of the &lt;code&gt;id&lt;/code&gt; attribute on the &lt;code&gt;input&lt;/code&gt; element&lt;/li&gt;&#xA;&lt;li&gt;Within the &lt;code&gt;fields[]&lt;/code&gt; array on the input element's &lt;code&gt;name&lt;/code&gt; attribute&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vb7nQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vb7nQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2015-12-31T08:15:33.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13041" PostTypeId="2" ParentId="13032" CreationDate="2015-12-31T08:19:47.170" Score="3" Body="&lt;p&gt;When a User field is saved, it takes an array of user IDs only – not complete UserModel objects. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get IDs for current members of group &#xA;$members = $entry-&amp;gt;members-&amp;gt;ids();&#xA;&#xA;// add new user ID to members&#xA;$members[] = $addUser-&amp;gt;id;&#xA;&#xA;// update field with new $members array&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('members', $members);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rest of your code looks fine, except for a minor typo – &lt;code&gt;$enries&lt;/code&gt; should be &lt;code&gt;$entries&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2015-12-31T08:19:47.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13042" PostTypeId="1" AcceptedAnswerId="13047" CreationDate="2015-12-31T11:02:19.970" Score="1" ViewCount="186" Body="&lt;p&gt;Caching is hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to delete the cache when a news entry hits it's expiryDate. So I wrote&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsExpiration = craft.entries.section('news').first()%}&#xA;&#xA;{% cache until newsExpiration.expiryDate  %}&#xA;   Bla&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the news entry has expired and no news is present so there is an error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;expiryDate&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I then wanted to write a conditional to see if &lt;code&gt;newsExpiration&lt;/code&gt; is defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if newsExpiration is defined %}&#xA;   {% cache until newsExpiration.expiryDate  %}&#xA;{% else %}&#xA;   {% cache %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that also throws an error because Twig is expecting a closing tag to the cache.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected &quot;else&quot; tag (expecting closing tag for the &quot;cache&quot; tag&#xA;  defined near line xy).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I there a proper way to define the cache tag including both present and absent entries without query conditionals?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2015-12-31T17:49:08.430" LastActivityDate="2015-12-31T17:49:08.430" Title="Cache until expiryDate" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13043" PostTypeId="1" AcceptedAnswerId="13044" CreationDate="2015-12-31T11:37:58.307" Score="1" ViewCount="61" Body="&lt;p&gt;I'm trying to display the postDate of Sprout Forms entries. The docs state that you can use standard Craft CMS tags. I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('contact').order(asc) %}&#xA;   {{ formEntry.postDate|date('d F Y') }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And all kind of variations but the system states no method or closure with the name &quot;postDate&quot;. All other fields output fine.&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="57" LastEditDate="2015-12-31T17:50:53.710" LastActivityDate="2015-12-31T17:50:53.710" Title="Display postdate Spout Forms entries" Tags="&lt;plugin-sproutforms&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13044" PostTypeId="2" ParentId="13043" CreationDate="2015-12-31T13:32:09.120" Score="2" Body="&lt;p&gt;Found the answer in the database. Apparently Sprout Forms uses the date field named &quot;dateCreated&quot;. Also getting it in order by date (newest first) needs 'dateCreated desc'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('contact').order('dateCreated desc') %}&#xA;   {{ formEntry.dateCreated|date('d F Y') }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastActivityDate="2015-12-31T13:32:09.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13045" PostTypeId="1" AcceptedAnswerId="13050" CreationDate="2015-12-31T14:02:37.260" Score="0" ViewCount="746" Body="&lt;p&gt;The relevant sections for this question are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event: One relevant field. &lt;code&gt;guestAllocation&lt;/code&gt; (SuperTable). Guest allocation is a table which selects a Partner (&lt;code&gt;Entries&lt;/code&gt;) and how many people that partner is allowed to invite to an event&lt;/li&gt;&#xA;&lt;li&gt;GuestList - Two fields. &lt;code&gt;relatedEvent&lt;/code&gt; (Entries) and &lt;code&gt;guestNames&lt;/code&gt; (table)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each Partner creates an Entry in the &lt;code&gt;guestList&lt;/code&gt; channel. When they want to update the names of who they're inviting, they edit their post instead of creating a new one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to write a conditional which will let me check if there's already an entry in the &lt;code&gt;guestList&lt;/code&gt; channel which is both related to that partner AND the event we're currently looking at. I need to check this as I have to update that Entry instead of creating a new one if it exists. The form is displayed on the Event page, so the &lt;code&gt;entry&lt;/code&gt; variable is the current event we're dealing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't get my head round the &lt;code&gt;relations&lt;/code&gt; documentation. How do I write this? The following is returning no results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set partnerGuestList = craft.entries.section('guestList').relatedTo(&#xA;    { sourceElement: entry }, {# this event #}&#xA;    { targetElement: currentUser.partner.first() } {# current partner #}&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="1098" LastEditDate="2016-01-01T15:56:56.607" LastActivityDate="2016-01-01T15:56:56.607" Title="How to query for multiple relations with SuperTable" Tags="&lt;relations&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13046" PostTypeId="1" AcceptedAnswerId="13048" CreationDate="2015-12-31T16:11:13.243" Score="2" ViewCount="239" Body="&lt;p&gt;Not quite sure how to use functions defined in Helper classes in my templates. For example, trying to use &quot;timeAgoInWords&quot; on an entry's dateCreated attribute. I get an internal server error and a &quot;Unknown &quot;timeAgoInWords&quot; function&quot; message when I try to visit the page. It occurs to me that perhaps I have to include or import the DateTimeHelper class? I'm not sure how to go about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a link to the Craft docs on the package that I'm trying to include:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/helpers/DateTimeHelper&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/classreference/helpers/DateTimeHelper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to include the timeAgoInWords function in my index.html template within the templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a bunch!&lt;/p&gt;&#xA;" OwnerUserId="4549" LastEditorUserId="57" LastEditDate="2015-12-31T17:57:11.623" LastActivityDate="2015-12-31T18:06:09.110" Title="Issue trying to use function from DateTimeHelper class: &quot;timeAgoInWords() is not defined&quot;" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13047" PostTypeId="2" ParentId="13042" CreationDate="2015-12-31T17:48:17.210" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Caching is hard.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twitter.com/codinghorror/status/506010907021828096&quot; rel=&quot;nofollow&quot;&gt;https://twitter.com/codinghorror/status/506010907021828096&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if newsExpiration is defined %}&#xA;    {% cache until newsExpiration.expiryDate  %}&#xA;        ...&#xA;    {% endcache %}&#xA;{% else %}&#xA;    {% cache %}&#xA;        ...&#xA;    {% endcache %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd probably want to use an &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;include&lt;/a&gt; for the body of the two cache tags to keep things &lt;a href=&quot;https://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot; rel=&quot;nofollow&quot;&gt;DRY&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-31T17:48:17.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13048" PostTypeId="2" ParentId="13046" CreationDate="2015-12-31T18:06:09.110" Score="3" Body="&lt;p&gt;Generally speaking, only &lt;a href=&quot;https://craftcms.com/classreference#craft.app.variables&quot; rel=&quot;nofollow&quot;&gt;Variable&lt;/a&gt; classes are exposed to templates in Craft and there isn't a Variable wrapper for &lt;a href=&quot;https://craftcms.com/classreference/helpers/DateTimeHelper&quot; rel=&quot;nofollow&quot;&gt;DateTimeHelper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that would be a super-simple &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; to write that exposes &lt;code&gt;timeAgoInWords&lt;/code&gt; as a Twig &lt;a href=&quot;http://twig.sensiolabs.org/documentation&quot; rel=&quot;nofollow&quot;&gt;filter&lt;/a&gt; so you could do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.postDate|timeAgoInWords&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2015-12-31T18:06:09.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13050" PostTypeId="2" ParentId="13045" CreationDate="2016-01-01T14:18:53.470" Score="5" Body="&lt;p&gt;It's a little hard to follow your example/description, but I'll take a stab at it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I interpret your question, you need to pull a single &lt;code&gt;guestList&lt;/code&gt; entry that is a) related to the current &lt;code&gt;event&lt;/code&gt;, and b) shares a relationship with the &lt;code&gt;partner&lt;/code&gt; entry set to the current user's &lt;code&gt;partner&lt;/code&gt; field, via a &lt;code&gt;guestAllocation&lt;/code&gt; SuperTable field owned by the &lt;code&gt;event&lt;/code&gt; EntryModel (I'm assuming there's a &lt;code&gt;guestAllocation.partner&lt;/code&gt; column, and that the event section has the &lt;code&gt;event&lt;/code&gt; handle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part is easy, although you seem to be confused about the &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;sourceElement&lt;/code&gt; parameters for the &lt;code&gt;relatedTo&lt;/code&gt; method, so I'll try to clear that up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, in a &lt;code&gt;relatedTo&lt;/code&gt; query you either specify the &lt;em&gt;target&lt;/em&gt; element or the &lt;em&gt;source&lt;/em&gt; element (never both) for the relationship – &lt;em&gt;depending on which element owns the field where relation is created&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the &lt;code&gt;event&lt;/code&gt; entry would be the &lt;strong&gt;target&lt;/strong&gt; element, not the &lt;strong&gt;source&lt;/strong&gt;, as the &lt;code&gt;relatedEvent&lt;/code&gt; field (where the relation is created) belongs to the &lt;code&gt;guestList&lt;/code&gt; entry model, not the &lt;code&gt;event&lt;/code&gt;. In other words, the elements you &lt;em&gt;want&lt;/em&gt; (the guest lists) should have the entry you &lt;em&gt;have&lt;/em&gt; (the &lt;code&gt;event&lt;/code&gt; entry) selected in a field (i.e. the &lt;code&gt;guestLists&lt;/code&gt; entries &quot;target&quot; the &lt;code&gt;event&lt;/code&gt; entry), not the other way around. If possible, you should also provide the field handle for the field where the relation is created, i.e. &lt;code&gt;relatedEvent&lt;/code&gt; in your case. So, to pull &lt;em&gt;all&lt;/em&gt; guestlists related to the current &lt;code&gt;event&lt;/code&gt; entry, the correct &lt;code&gt;relatedTo&lt;/code&gt; query would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set guestListsForEvent = craft.entries.section('guestList').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'relatedEvent'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, you only want &lt;em&gt;one&lt;/em&gt; guestlist – the one that is related to the current user's &lt;code&gt;partner&lt;/code&gt; entry (phew!). Trouble is, that relationship doesn't really exist – it's actually more of a &lt;em&gt;condition&lt;/em&gt;, where a) the &lt;code&gt;guestList&lt;/code&gt; entry needs to be authored by a user with the correct &lt;code&gt;partner&lt;/code&gt; relation, and b) the current &lt;code&gt;event&lt;/code&gt; needs to have the correct &lt;code&gt;partner&lt;/code&gt; entry (i.e. the current user's related &lt;code&gt;partner&lt;/code&gt; entry) in its &lt;code&gt;guestAllocations&lt;/code&gt; SuperTable field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part is easy – you can set a &lt;code&gt;canCurrentUserCreateGuestList&lt;/code&gt; flag inside a loop on the current &lt;code&gt;event&lt;/code&gt; entry's &lt;code&gt;guestAllocations&lt;/code&gt; field; if the correct &lt;code&gt;partner&lt;/code&gt; event is found in the latter, the current user can create a new &lt;code&gt;guestList&lt;/code&gt; entry and you should also query for an existing &lt;code&gt;guestList&lt;/code&gt; entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentPartner = currentUser.partner.first %}&#xA;{% set currentUserCanCreateGuestList = false %}&#xA;{% for row in entry.guestAllocation %}&#xA;    {% if row.partner|length and row.partner.first.id == currentPartner.id %}&#xA;        {% set currentUserCanCreateGuestList = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have that flag, you can use it in a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUserCanCreateGuestList %}&#xA;   {# Query for existing guest list, create new list etc #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the latter – the actual query to pull the &lt;code&gt;guestList&lt;/code&gt; entry – a single &lt;code&gt;relatedTo&lt;/code&gt; call obviously won't do the job here, but fortunately the workaround is quite simple – keeping in mind that you need to make sure that a) only 1 &lt;code&gt;guestList&lt;/code&gt; entry is returned, and b) that entry is authored by a user with the same &lt;code&gt;partner&lt;/code&gt; entry as the current user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the first part is easy – simply use &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;first&lt;/code&gt; to pull a single entry (I like to add a &lt;code&gt;|default(false)&lt;/code&gt; filter to suppress errors if no entries are returned).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part, you'll first need a list of user IDs for all the users that are related to the current user's &lt;code&gt;partner&lt;/code&gt; entry, and then feed that array to the &lt;code&gt;authorId&lt;/code&gt; parameter for the &lt;code&gt;craft.entries&lt;/code&gt; call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the IDs for all users related to the correct partner #}&#xA;{% set partnerUserIds = craft.users.relatedTo({&#xA;    targetElement: currentUser.partner.first,&#xA;    field: 'partner'&#xA;}).ids() %}&#xA;&#xA;{# Get existing partner guest list related to the current event #}&#xA;{% set partnerGuestList = partnerUserIds|length ? craft.entries.section('guestList').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'relatedEvent'&#xA;}).authorId(partnerUserIds).limit(1).first|default(false) : false %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code will return either a single &lt;code&gt;guestList&lt;/code&gt; &lt;code&gt;EntryModel&lt;/code&gt;, or &lt;code&gt;false&lt;/code&gt;, if no related guestlist entries authored by a user with the correct &lt;code&gt;partner&lt;/code&gt; entry exists. Whether or not the &lt;code&gt;event&lt;/code&gt; entry has the current user's &lt;code&gt;partner&lt;/code&gt; entry in one of its SuperTable &lt;code&gt;guestAllocation.partner&lt;/code&gt; columns is irrelevant to the query itself, once you've established that the current &lt;code&gt;event&lt;/code&gt; does indeed include the correct &lt;code&gt;partner&lt;/code&gt; entry in its &lt;code&gt;guestAllocations&lt;/code&gt; field (the conditional above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how the whole thing could look in context:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Can the current user create a guest list for this event? #}&#xA;{% set currentPartner = currentUser.partner.first %}&#xA;{% set currentUserCanCreateGuestList = false %}&#xA;{% for row in entry.guestAllocation %}&#xA;    {% if row.partner|length and row.partner.first.id == currentPartner.id %}&#xA;        {% set currentUserCanCreateGuestList = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# Get existing guest list #}&#xA;{% set partnerGuestList = false %}&#xA;{% if currentUserCanCreateGuestList %}&#xA;    {# Get the IDs for all users related to the correct partner #}&#xA;    {% set partnerUserIds = craft.users.relatedTo({&#xA;        targetElement: currentUser.partner.first,&#xA;        field: 'partner'&#xA;    }).ids() %}&#xA;&#xA;    {# Get existing partner guest list related to the current event #}&#xA;    {% set partnerGuestList = partnerUserIds|length ? craft.entries.section('guestList').relatedTo({&#xA;        targetElement: entry,&#xA;        field: 'relatedEvent'&#xA;    }).authorId(partnerUserIds).limit(1).first|default(false) : false %}&#xA;{% endif %}&#xA;&#xA;{# Create, edit, etc #}&#xA;{% if partnerGuestList %}&#xA;    {# Edit existing guest list #}&#xA;{% elseif currentUserCanCreateGuestList %}&#xA;    {# Create new guest list #}&#xA;{% else %}&#xA;    {# Do nothing? #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the above isn't tested and there's a good chance I misinterpreted your question – but hopefully you'll take something away from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, as your question also touches on the correct usage of &lt;code&gt;relatedTo&lt;/code&gt; queries with multiple relation criteria: Your original syntax for the &lt;code&gt;relatedTo&lt;/code&gt; call is close, but when you have multiple relation criteria, you'll need to include either &lt;code&gt;and&lt;/code&gt; or &lt;code&gt;or&lt;/code&gt; as the first parameter, specifying if &lt;em&gt;all&lt;/em&gt; or &lt;em&gt;any&lt;/em&gt; of the criteria should be met, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, this means the &lt;em&gt;syntactically&lt;/em&gt; correct multiple relation query for the partner guestlist should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set partnerGuestList = craft.entries.section('guestList').relatedTo('and', &#xA;    { target: entry, field: 'relatedEvent' },&#xA;    { targetElement: currentUser.partner.first(), field: 'guestAllocation.partner' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, for reasons already explained the above query will return nothing. There's also the fact that SuperTable fields (in your case, the &lt;code&gt;guestAllocation.partner&lt;/code&gt; field) doesn't actually work with the built-in relations functionality in Craft – meaning that &lt;em&gt;you can never use &lt;code&gt;craft.entries.relatedTo&lt;/code&gt; when the relation is created in a SuperTable field&lt;/em&gt;. Instead, SuperTable provides its own method for relation queries, which is explained in &lt;a href=&quot;https://craftcms.stackexchange.com/a/12123/1098&quot;&gt;this answer&lt;/a&gt;. Again, I don't believe a single &lt;code&gt;relatedTo&lt;/code&gt; call is the correct approach for your particular use case, but just wanted to mention it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just for funsies – here's how you could use SuperTable's &lt;code&gt;getRelatedElements&lt;/code&gt; method to pull &lt;code&gt;event&lt;/code&gt; entries based on &lt;code&gt;guestAllocation.partner&lt;/code&gt; relations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set partnerEvents = craft.supertable.getRelatedElements({&#xA;    relatedTo: {&#xA;        targetElement: currentUser.partner.first,&#xA;        field: 'guestAllocation.partner'&#xA;    },&#xA;    criteria: {&#xA;        section: 'event'&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-01T15:52:16.840" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13051" PostTypeId="1" CreationDate="2016-01-01T19:17:52.840" Score="0" ViewCount="160" Body="&lt;p&gt;I have a front-end form to upload image files, which works 100% perfectly most of the time. However, I've noticed with larger sized images, I'll get a PHP error saying:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP warning&#xA;include(pathToCraft/craft/app/vendor/lsolesen/pel/src/PelInvalidDataException.php): failed to open stream: No such file or directory &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is an issue on my end or Craft. Should I be expirementing which file size starts causing this and restricting uploads from surpassing that limit in the plugin before saving entry?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-01-01T19:17:52.840" Title="PHP Warning on Asset Upload: PelInvalidDataException" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;php&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13052" PostTypeId="1" AcceptedAnswerId="13054" CreationDate="2016-01-01T20:47:46.510" Score="1" ViewCount="64" Body="&lt;p&gt;I have a product variant that a user can choose from. It looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;purchasableId&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    {% for purchasable in product.variants %}&#xA;        &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&#xA;            {% if currentUser is defined and purchasable.myCustomField in currentUser.userField %}selected{% endif %}&amp;gt;{{ purchasable.myCustomField.label }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&amp;lt;/option&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I'm stuck is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;purchasable.myCustomField&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should (and does) equal this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.userField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know it's a syntax problem... just not sure where I'm off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test, this is what the data looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;purchasable.myCustomField  // this is a drop down value is &quot;blue&quot;&#xA;currentUser.userField      // this is a checkbox that has the value &quot;blue&quot; in it&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-01T21:12:56.773" LastActivityDate="2016-01-01T22:30:14.927" Title="How can I pre-select a product variant based on user profile?" Tags="&lt;user-profile&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13053" PostTypeId="1" CreationDate="2016-01-01T21:55:13.800" Score="1" ViewCount="175" Body="&lt;p&gt;I've tried &lt;a href=&quot;https://twitter.com/monooso&quot; rel=&quot;nofollow&quot;&gt;@monooso&lt;/a&gt;’s &lt;a href=&quot;https://github.com/monooso/smartdown.craft-plugin&quot; rel=&quot;nofollow&quot;&gt;Smartdown&lt;/a&gt; plugin but can’t get it to run on my local install of Craft 2.5 under PHP 5.6.10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have content that parses fine as regular Markdown but just fails totally with the &lt;strong&gt;smartdown&lt;/strong&gt; filter applied. I've read somewhere that Smartdown is a work in progress. (I'll ask Stephen about it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I note with interest a recent release from Pixel &amp;amp; Tonic for a Parsedown plugin: &lt;a href=&quot;https://github.com/pixelandtonic/Parsedown&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/Parsedown&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But not yet found a plugin that executes either Markdown Extra or &lt;a href=&quot;http://parsedown.org/extra/&quot; rel=&quot;nofollow&quot;&gt;Parsedown Extra&lt;/a&gt; on regular Plaintext fields.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastActivityDate="2016-01-01T21:55:13.800" Title="Any robust plugins with Markdown Extra support?" Tags="&lt;plugins&gt;&lt;filter&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13054" PostTypeId="2" ParentId="13052" CreationDate="2016-01-01T22:30:14.927" Score="1" Body="&lt;p&gt;Checkboxes fields (and other multi-select fieldtypes) return a &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/MultiOptionsFieldData&quot; rel=&quot;nofollow&quot;&gt;MultiOptionsFieldData&lt;/a&gt; instance, not an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.userField.contains(purchaseable.myCustomField) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-01T22:30:14.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13055" PostTypeId="1" AcceptedAnswerId="13079" CreationDate="2016-01-02T03:34:24.060" Score="0" ViewCount="672" Body="&lt;p&gt;Using Craft Commerce, I would like to offer more than one product on my &lt;code&gt;_entry&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's say I am selling a wagon. I have a drop down of variants for color:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Choose Color&amp;lt;/label&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;purchasableId&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    {% for purchasable in product.variants %}&#xA;        &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;        {{ purchasable.wagon.label }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I would also like to offer a warranty. There could be different prices for different plans (variants) as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Choose Warranty&amp;lt;/label&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;purchasableId&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    {% for purchasable in product.variants %}&#xA;        &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;        {{ purchasable.warranty.label }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each &quot;Warranty&quot; is it's own section and has it's own product type within Commerce. &#xA;You could purchase a warranty by visiting &lt;code&gt;mysite.com/warranties/my-warranty&lt;/code&gt; or &lt;code&gt;mysite.com/wagons&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example might look like &lt;code&gt;mysite.com/warranties/basic&lt;/code&gt;. That page would have information about the &quot;basic&quot; warranty along with the option to add to cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, you could purchase a warranty &lt;em&gt;without&lt;/em&gt; purchasing a wagon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to (somehow) allow the user to purchase a warranty when they purchase a wagon. That's not to say I &lt;em&gt;must&lt;/em&gt; do it this way, I am open to ideas. Currently both products are available together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what my current form looks like on my product page. Is there a naming convention I should follow to pass multiple  options to the &lt;code&gt;updateCart&lt;/code&gt; method? If I make both fields have the name of &lt;code&gt;purchasableId&lt;/code&gt;, as expected, the system just grabs the last element. In my case it's the warranty product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I would like to make the warranty a required field, maybe I need to restructure how I am selling wagons? I don't want to add to the variant list of my wagon product, that would get out of hand quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, perhaps it's just a &quot;Related Products&quot; title and a link to the warranties page?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;label for=&quot;purchasableId&quot;&amp;gt;Choose Color&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;purchasableId&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        {% for purchasable in product.variants %}&#xA;            &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;            {{ purchasable.title }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    {% set warranties = product.warrantyOptions %}  {# This is the products field #}&#xA;    &amp;lt;label for=&quot;warranty&quot;&amp;gt;Choose Warranty&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;warrantyId&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        {% for warranty in warranties %}&#xA;            {% for purchasable in warranty.variants %}&#xA;                &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %}&#xA;                value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;               {{ purchasable.title }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;               &amp;lt;/option&amp;gt;&#xA;           {% endfor %}&#xA;       {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-04T00:46:22.523" LastActivityDate="2016-01-04T18:09:42.307" Title="How can I have more than one product on the same page?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13057" PostTypeId="1" AcceptedAnswerId="13058" CreationDate="2016-01-02T15:02:06.703" Score="0" ViewCount="46" Body="&lt;p&gt;I have a number of entries, each with a quote (table field with one phrase and author row). I would like to show one quote on my login page, but some of these entries do not have quotes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i filter the entries so that it can only choose from the entries that have quotes and exclude the ones who don't have?&lt;/p&gt;&#xA;" OwnerUserId="1086" LastActivityDate="2016-01-02T15:37:22.793" Title="Show a quote on my login page" Tags="&lt;filter&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13058" PostTypeId="2" ParentId="13057" CreationDate="2016-01-02T15:37:22.793" Score="3" Body="&lt;p&gt;Basically you want to retrieve all entries where a certain field is not empty?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/452/return-entries-where-field-is-not-empty&quot;&gt;Return entries where field is &amp;quot;not empty&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-01-02T15:37:22.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13059" PostTypeId="1" AcceptedAnswerId="13060" CreationDate="2016-01-02T23:31:34.470" Score="1" ViewCount="84" Body="&lt;p&gt;I'm trying to sort entries on a page by a custom field, by date and time. I have sample data over several entries with different dates and times, and where I want it to show the date of the event, it shows &quot;January 1, 2016&quot; (with the correct time) for all events, instead of the date and time of the &lt;code&gt;eventStartDT&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('events').order('eventStartDT').limit(4) %}&#xA;&#xA;    &amp;lt;div class=&quot;uk-width-large-1-3 uk-width-medium-1-2 uk-width-small-1-1 uk-container-center&quot; style=&quot;margin-bottom:25px;&quot;&amp;gt;&#xA;        &amp;lt;a class=&quot;fpcLink&quot; href=&quot;#&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;frontPageContent&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;fpcInner&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;text-content&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;i class=&quot;uk-icon-calendar uk-icon-large&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;h3&amp;gt;EXPLORE&amp;lt;/h3&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;fpcLower&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&amp;lt;p&amp;gt;{{ entry.eventStartDT | date('F n, Y - g:i A') }}&amp;lt;/p&amp;gt;&amp;lt;p class=&quot;uk-text-small&quot;&amp;gt;{{ entry.shortEventDescription }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="22" LastEditDate="2017-05-09T22:52:35.213" LastActivityDate="2017-05-09T22:52:35.213" Title="Date returns wrong" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13060" PostTypeId="2" ParentId="13059" CreationDate="2016-01-03T00:20:17.120" Score="3" Body="&lt;p&gt;Okay, I feel supremely stupid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;date('F n, Y - g:i A')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;date('F j, Y - g:i A')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Total brain fart. ಠ_ಠ&lt;/p&gt;&#xA;" OwnerUserId="4554" LastActivityDate="2016-01-03T00:20:17.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13061" PostTypeId="1" AcceptedAnswerId="13073" CreationDate="2016-01-03T13:11:52.290" Score="0" ViewCount="283" Body="&lt;p&gt;I am building a community website that currently have two user groups but it might increase so I am trying to automate everything. The current groups are: 'teachers' &amp;amp; 'candidates'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel section named 'Community' and for this channel I have setup a category group called 'Community' that has two categories named as the user groups: 'teachers' &amp;amp; 'candidates'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to display a list of all the registered users in a specific group as you are loading the category template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the template that is being loaded:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;community/index&quot; %}&#xA;&#xA;{% set title = category.title %}&#xA;&#xA;{% block main %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% set group = craft.users.group('{{ category.slug }}') %}&#xA;&#xA;    {% for user in group %}&#xA;        &amp;lt;li&amp;gt;{{ user.name }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endblock %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was thinking that since the &lt;code&gt;{{ category.slug }}&lt;/code&gt; has the same name as the user group, it can work but apparently not...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me to understand how to relate the two?&lt;/p&gt;&#xA;" OwnerUserId="3777" LastEditorUserId="57" LastEditDate="2016-01-03T19:28:17.143" LastActivityDate="2016-01-04T13:22:17.900" Title="User groups in relation to categories" Tags="&lt;categories&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13064" PostTypeId="1" AcceptedAnswerId="13068" CreationDate="2016-01-03T20:31:31.380" Score="0" ViewCount="1014" Body="&lt;p&gt;I'm attempting to create something within my template using global values and checkboxes. What I need this to do is &quot;if it's one of the days of the week marked as open, as selected by a checkbox, and the time is between X and Y, then display that we are open, otherwise, say we are closed&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have Monday through Sunday listed as checkboxes, and their values are set with Monday as 1, Tuesday as 2, etc, and I'm trying to compare it to 'now'|date('N'), which lists the day of the week as a number.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for dayOfWeek in theCenter.openWeekDay %}&#xA;&#xA;    {% if 'now'|date('N') == dayOfWeek and 'now'|date('Hi', 'America/Denver') &amp;gt; theCenter.openTime|date('Hi') and 'now'|date('Hi', 'America/Denver') &amp;lt; theCenter.closeTime|date('Hi') %}&#xA;        &amp;lt;h3&amp;gt;We are OPEN&amp;lt;/h3&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h3&amp;gt;We are CLOSED&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've selected Tuesday through Sunday as open by selecting their checkboxes in the globals form. The code above returns 5 'We are Closed' and 1 'We are Open' results. I just need it to check if today is one of the open days, and if it's between open and closing time, and display one result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'now'|date('N') in dayOfWeek and 'now'|date('Hi', 'America/Denver') &amp;gt; theCenter.openTime|date('Hi') and 'now'|date('Hi', 'America/Denver') &amp;lt; theCenter.closeTime|date('Hi') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it returns 6 'We are Closed'. I've been trying to figure this out for several hours, but the documentation doesn't seem to be made for what I want to do, and I'm probably looking in the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how I could get this to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the entire script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'now'|date('z', 'America/Denver') &amp;gt; theCenter.startWinterSeason|date('z') or 'now'|date('z', 'America/Denver') &amp;lt; theCenter.endWinterSeason|date('z') %}&#xA;    {% for dayOfWeek in theCenter.openDaysWinter %}&#xA;        {% if dayOfWeek.selected and 'now'|date('N') == dayOfWeek and 'now'|date('Hi', 'America/Denver') &amp;gt; theCenter.openTimeWinter|date('Hi') and 'now'|date('Hi', 'America/Denver') &amp;lt; theCenter.closeTimeWinter|date('Hi') %}&#xA;            &amp;lt;h3&amp;gt;The center is OPEN&amp;lt;/h3&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;h3&amp;gt;The center is CLOSED&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    &amp;lt;div class=&quot;infoPane&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;i class=&quot;uk-icon-clock-o&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;amp;nbsp;{{ theCenter.hoursTitleWinter }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;Tuesday &amp;amp;mdash; Saturday&amp;lt;br&amp;gt;{{ theCenter.openTimeWinter|date('g:i A') }} to {{ theCenter.closeTimeWinter|date('g:i A') }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p class=&quot;uk-text-small&quot;&amp;gt;{{ theCenter.timeNotes|raw }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% elseif 'now'|date('z', 'America/Denver') &amp;gt; theCenter.startSummerSeason|date('z') and 'now'|date('z', 'America/Denver') &amp;lt; theCenter.endSummerSeason|date('z') %}&#xA;    {% for dayOfWeek in theCenter.openDaysSummer %}&#xA;        {% if dayOfWeek.selected and 'now'|date('N') == dayOfWeek and 'now'|date('Hi', 'America/Denver') &amp;gt; theCenter.openTimeSummer|date('Hi') and 'now'|date('Hi', 'America/Denver') &amp;lt; theCenter.closeTimeSummer|date('Hi') %}&#xA;            &amp;lt;h3&amp;gt;The center is OPEN&amp;lt;/h3&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;h3&amp;gt;The center is CLOSED&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    &amp;lt;div class=&quot;infoPane&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;i class=&quot;uk-icon-clock-o&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;amp;nbsp;{{ theCenter.hoursTitleSummer }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;Tuesday &amp;amp;mdash; Saturday&amp;lt;br&amp;gt;{{ theCenter.openTimeSummer|date('g:i A') }} to {{ theCenter.closeTimeSummer|date('g:i A') }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p class=&quot;uk-text-small&quot;&amp;gt;{{ theCenter.timeNotes|raw }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h3&amp;gt;EPIC FAIL&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which outputs this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WmcCe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WmcCe.jpg&quot; alt=&quot;Output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need it to only show the center is closed once.&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="4554" LastEditDate="2016-01-04T01:59:13.183" LastActivityDate="2016-01-04T02:03:42.487" Title="Checkbox array for days of the week" Tags="&lt;checkboxes&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13065" PostTypeId="2" ParentId="12999" CreationDate="2016-01-03T23:00:22.773" Score="4" Body="&lt;p&gt;I came across this &lt;code&gt;Could not find the task component type.&lt;/code&gt; error upon trying to add a secondary task to my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the naming scheme that P&amp;amp;T have in the PowerNap plugin, try making sure you have one task named after the plugin itself &lt;code&gt;WassermanNewsTask&lt;/code&gt;, and then follow the subtasks, or any other additional tasks, with the underscore naming, eg. &lt;code&gt;WassermanNews_TwitterTask&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's not really any thorough documentation on Tasks, so I can't verify this is the problem, but this is what worked for me.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-01-03T23:00:22.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13066" PostTypeId="1" CreationDate="2016-01-04T01:09:46.863" Score="3" ViewCount="699" Body="&lt;p&gt;I've got a category group called &lt;code&gt;allcategories&lt;/code&gt;, inside of this is two categories called &lt;code&gt;design&lt;/code&gt; and &lt;code&gt;photo&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to filter all entries in the section &lt;code&gt;projects&lt;/code&gt; by the category `photo' but none of my permutations are working :(&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;index&quot;&amp;gt;&#xA;&#xA;    {% set category = craft.categories.group('allcategories').find('photos') %}&#xA;    {% set projects = craft.entries.section('projects').relatedTo(category).find() %}&#xA;&#xA;    {% for entry in projects %}&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3710" LastActivityDate="2016-01-04T01:31:49.787" Title="How to display all entries within a given category" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13067" PostTypeId="2" ParentId="13066" CreationDate="2016-01-04T01:31:49.787" Score="5" Body="&lt;p&gt;Your mistake is in getting the category. Instead of what you have try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('allcategories').slug('photos').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting elements in Craft use ElementCriteriaModel and &lt;code&gt;find()&lt;/code&gt;, &lt;code&gt;first()&lt;/code&gt;, &lt;code&gt;last()&lt;/code&gt;, &amp;amp;c. do not accept any parameters (though &lt;code&gt;nth()&lt;/code&gt; is an exception to this). So you need to search by other fields in the element as per the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#setting-the-parameters&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to make sure that the slug of the category group is not camel case (&lt;code&gt;allCategories&lt;/code&gt; as opposed to &lt;code&gt;allcategories&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-01-04T01:31:49.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13068" PostTypeId="2" ParentId="13064" CreationDate="2016-01-04T02:03:42.487" Score="2" Body="&lt;p&gt;This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set closed = true %}&#xA;&#xA;{% for dayOfWeek in theCenter.openWeekDay %}&#xA;&#xA;    {% if 'now'|date('N') == dayOfWeek and 'now'|date('Hi', 'America/Denver') &amp;gt; theCenter.openTime|date('Hi') and 'now'|date('Hi', 'America/Denver') &amp;lt; theCenter.closeTime|date('Hi') %}&#xA;        {% set closed = false %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% if closed %}&#xA;    &amp;lt;h3&amp;gt;The center is CLOSED&amp;lt;/h3&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h3&amp;gt;The center is OPEN&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-04T02:03:42.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13069" PostTypeId="1" CreationDate="2016-01-04T04:58:13.680" Score="1" ViewCount="338" Body="&lt;p&gt;My original question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10486/how-to-make-next-prev-links-for-entries-circular-endless&quot;&gt;here&lt;/a&gt; helped me figure out how to build my URL structure but now the site has introduced two categories: &lt;code&gt;design&lt;/code&gt; and &lt;code&gt;photo&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the &quot;Prev&quot; and &quot;Next&quot; buttons to navigate back and forth within the category of the current entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to get the category of the current entry here: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.category %}&#xA;   {{ category.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but I don't know how to put &lt;code&gt;category.title&lt;/code&gt; into a variable to build my &lt;code&gt;params&lt;/code&gt;. This is my best shot at the solution but it's broken and I've given up spinning on it myself :) Any help would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = &quot;craft.categories.relatedTo(entry)&quot; %}&#xA;&#xA;{% set params = craft.entries.section('projects').order('title asc').relatedTo(category) %}&#xA;&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{% if nextEntry %}&#xA;    {% set nextEntryUrl = nextEntry.url %}&#xA;{% else %}&#xA;    {% set firstEntry = craft.entries.section('projects').first() %}&#xA;    {% set nextEntryUrl = firstEntry.url %}&#xA;{% endif %}&#xA;&#xA;{% if prevEntry %}&#xA;    {% set prevEntryUrl = prevEntry.url %}&#xA;{% else %}&#xA;    {% set lastEntry = craft.entries.section('projects').last() %}&#xA;    {% set prevEntryUrl = lastEntry.url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3710" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-04T16:09:38.120" Title="How to fetch Category of current Entry and build &quot;Next / Prev&quot; urls" Tags="&lt;categories&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13071" PostTypeId="2" ParentId="12954" CreationDate="2016-01-04T09:02:20.657" Score="1" Body="&lt;p&gt;Turns out the problem was with the Nginx config as Brad suggested. There was a question mark behind the &lt;code&gt;p=$1&lt;/code&gt;. When we removed the &lt;code&gt;?&lt;/code&gt; and restarted PHP it worked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;  }&#xA;&#xA;location /en/ {&#xA;   try_files $uri $uri/ @enrewrites;&#xA;  }&#xA;&#xA;location @enrewrites {&#xA;    rewrite ^/en/(.*)$ /en/index.php?p=$1 last;&#xA;  }&#xA;&#xA;location @rewrites {&#xA;rewrite ^(.*) /index.php?p=$1 last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2016-01-04T09:02:20.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13072" PostTypeId="2" ParentId="13069" CreationDate="2016-01-04T13:16:46.287" Score="2" Body="&lt;p&gt;A category is an element. So is an entry, and an asset, and a tag, and user. When you relate one element with another you get returned an ElementCriteriaModel in the template. So you need to use its methods to actually get the element data. In this case &lt;code&gt;first()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you know for sure that you only have (and care about) one category in an entry, then you can try this for your params.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('projects').order('title asc').relatedTo(entry.category.first()) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also set category way up at the top of the template if you know you'll &#xA;use it multiple times in the template. That way you are only making one database query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# At the top of the template #}&#xA;{% set category = entry.category.first() %}&#xA;&#xA;{# Somewhat lower to display the category #}&#xA;{{ category.title }}&#xA;&#xA;{# even lower to pull the other entries. #}&#xA;{% set params = craft.entries.section('projects').order('title asc').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-01-04T13:16:46.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13073" PostTypeId="2" ParentId="13061" CreationDate="2016-01-04T13:22:17.900" Score="2" Body="&lt;p&gt;I believe your problem lies in the parameter for user group. In Twig, you don't need the brackets if you're already in brackets. You just reference the variable and fields directly. So instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set group = craft.users.group('{{ category.slug }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set group = craft.users.group(category.slug) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You see, the ElementCriteriaModel that's parsing the parameter for group doesn't run all its function arguments through Twig. So you're confusing it by throwing braces in there. Just give it the variable and field without quotes or braces and it should work smashingly, provided that &lt;code&gt;category.slug&lt;/code&gt; is the same as a group &lt;code&gt;slug&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-01-04T13:22:17.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13074" PostTypeId="1" CreationDate="2016-01-04T13:22:44.177" Score="1" ViewCount="1849" Body="&lt;p&gt;I just upgraded Craft to the latest version, and this error now shows up.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The file “myfile.jpg” could not be uploaded, because it exceeds the maximum upload size of 0 B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any fix ? Everything worked fine before the update.&#xA;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="57" LastEditDate="2016-01-04T18:49:19.420" LastActivityDate="2016-08-26T04:56:35.353" Title="File upload - maximum upload size of 0 B" Tags="&lt;upload&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13075" PostTypeId="1" AcceptedAnswerId="13081" CreationDate="2016-01-04T15:57:08.000" Score="0" ViewCount="542" Body="&lt;p&gt;Using,&#xA;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently migrated the server to a new server and now i get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/12/03 19:21:27 [error] [exception.phpmailerException] exception 'phpmailerException' with message 'SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting' in C:\inetpub\wwwroot\craft\app\vendor\phpmailer\phpmailer\class.phpmailer.php:1256 Stack trace:&#xA;#0 C:\inetpub\wwwroot\craft\app\vendor\phpmailer\phpmailer\class.phpmailer.php(1100): PHPMailer-&amp;gt;smtpSend('Date: Thu, 3 De...', 'This is a multi...')&#xA;#1 C:\inetpub\wwwroot\craft\app\vendor\phpmailer\phpmailer\class.phpmailer.php(1004): PHPMailer-&amp;gt;postSend()&#xA;#2 C:\inetpub\wwwroot\craft\app\services\EmailService.php(435): PHPMailer-&amp;gt;send()&#xA;#3 C:\inetpub\wwwroot\craft\app\services\EmailService.php(77): Craft\EmailService-&amp;gt;_sendEmail(Object(Craft\UserModel), Object(Craft\EmailModel), Array)&#xA;#4 C:\inetpub\wwwroot\craft\plugins\contactform\services\ContactFormService.php(54): Craft\EmailService-&amp;gt;sendEmail(Object(Craft\EmailModel))&#xA;#5 C:\inetpub\wwwroot\craft\plugins\contactform\controllers\ContactFormController.php(100): Craft\ContactFormService-&amp;gt;sendMessage(Object(Craft\ContactFormModel))&#xA;#6 C:\inetpub\wwwroot\craft\app\framework\web\actions\CInlineAction.php(49): Craft\ContactFormController-&amp;gt;actionSendMessage()&#xA;#7 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('sendMessage')&#xA;#11 C:\inetpub\wwwroot\craft\app\etc\web\WebApp.php(805): CWebApplication-&amp;gt;runController('contactForm/sen...')&#xA;#12 C:\inetpub\wwwroot\craft\app\etc\web\WebApp.php(275): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 C:\inetpub\wwwroot\craft\app\framework\base\CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 C:\inetpub\wwwroot\craft\app\index.php(62): CApplication-&amp;gt;run()&#xA;#15 C:\inetpub\wwwroot\public\index.php(14): require_once('C:\inetpub\wwwr...')&#xA;#16 {main} REQUEST_URI=/contact HTTP_REFERER=https://soho.infor.com/contact&#xA;--- 2015/12/03 19:21:27 [error] [application] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is, Some application not installed? Or something not configured? Or could it be a matter that this site requires authentication now to hit it in the browser (https redirects)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally where is the SMTP server configured?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Tim&lt;/p&gt;&#xA;" OwnerUserId="774" LastEditorUserId="774" LastEditDate="2016-01-04T17:16:29.100" LastActivityDate="2016-01-04T19:11:42.710" Title="Error With ContactForm Plugin - Internal Server Error" Tags="&lt;plugins&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13077" PostTypeId="2" ParentId="11410" CreationDate="2016-01-04T17:06:47.393" Score="2" Body="&lt;p&gt;Found this while searching for a solution. I fixed it by moving this line to the top of the vhost file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    fastcgi_ignore_headers X-Accel-Expires Expires Cache-Control;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After this all my requests are properly cached and my site loads really fast! My entire vhost file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fastcgi_cache_path /etc/nginx-cache levels=1:2 keys_zone=phpcache:100m inactive=60m;&#xA;fastcgi_cache_key &quot;$scheme$request_method$host$request_uri&quot;;&#xA;fastcgi_ignore_headers X-Accel-Expires Expires Cache-Control;&#xA;&#xA;server {&#xA;        listen   80;&#xA;        charset utf8;&#xA;        root /home/user/htdocs/public;&#xA;        index index.php;&#xA;        server_name domain.com;&#xA;&#xA;        set $no_cache 0;&#xA;&#xA;        # Don't cache the CMS admin area&#xA;        location /admin {&#xA;                set $no_cache 1;&#xA;        }&#xA;&#xA;        gzip            on;&#xA;        gzip_min_length 10;&#xA;        gzip_proxied    expired no-cache no-store private auth;&#xA;        gzip_types      text/plain application/xml application/x-javascript text/css image/svg+xml;&#xA;        gzip_vary on;&#xA;&#xA;        location ~ \.php$ {&#xA;                include fastcgi_params;&#xA;                fastcgi_pass unix:/var/run/domain-fpm.sock;&#xA;                fastcgi_index index.php;&#xA;                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;&#xA;                fastcgi_cache phpcache; # The name of the cache key-zone to use&#xA;                fastcgi_cache_valid 200 30m; # What to cache: 'code 200' responses, for half an hour&#xA;                fastcgi_cache_methods GET HEAD; # What to cache: only GET and HEAD requests (ot POST)&#xA;                add_header X-Fastcgi-Cache $upstream_cache_status; # Allow us to see if the cache was HIT, MISS, or BYPASSED inside a browser's Inspector panel&#xA;                fastcgi_cache_bypass $no_cache; # Dont pull from the cache if true&#xA;                fastcgi_no_cache $no_cache; # Dont save to the cache if true&#xA;        }&#xA;&#xA;         location ~ ^(.*)$ {&#xA;                 try_files $uri $uri/ /index.php?p=$uri&amp;amp;$args;&#xA;        }&#xA;&#xA;        location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff|ttf|svg)(\?ver=[0-9.]+)?$ { expires 1w; }&#xA;&#xA;        location ~ /\.ht {&#xA;                deny all;&#xA;                return 404;&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-01-04T17:06:47.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13078" PostTypeId="1" CreationDate="2016-01-04T17:13:45.407" Score="1" ViewCount="488" Body="&lt;p&gt;I'm new to Craft and am trying to have our entry pagination (next/prev) links go to the next entry within that same category, ordering by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the order part is working as I want it to, it's just remaining in the current category I need help with. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title %}&#xA;{% set description = entry.body | striptags %}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;{% set entryCategories = entry.newsCategories %}&#xA;&#xA;{% set thisCategory = '' %}&#xA;&#xA;{% for category in entryCategories %}&#xA;&#xA;{% set thisCategory = category.url %}&#xA;&#xA;{% endfor %}&#xA;&#xA;  &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ newsHeader.header }}&amp;lt;/h1&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;filter-bar news&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;largenav&quot;&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/news&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% nav category in     craft.categories.group('newsCategories') %}{% if category.url == thisCategory %}&amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% else %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}{% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;div class=&quot;select tinynav&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; id=&quot;select-toggle&quot;&amp;gt;All&amp;lt;/a&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a data-value=&quot;{{ siteUrl }}news&quot; href=&quot;#&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% nav category in craft.categories.group('newsCategories') %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; data-value=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endnav %}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;  &amp;lt;ul class=&quot;wrapper newspage&quot;&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;          &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;          &amp;lt;h5 class=&quot;meta&quot;&amp;gt;{{ entry.postDate|date(&quot;F j, Y&quot;) }} &amp;amp;nbsp;|&amp;amp;nbsp;&#xA;&#xA;              {% if entryCategories | length %}&#xA;&#xA;              {% for category in entryCategories %}&#xA;&#xA;                &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;              {% endfor %}&#xA;              {% endif %}&#xA;&#xA;            &amp;lt;/h5&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;&#xA;                {# Set parameters for prev/next elements list #}&#xA;                {% set params = {section: 'news', category: category.title, order: 'postDate'} %}&#xA;&#xA;                {# Get the prev/next elements #}&#xA;                {% set prevEntry = entry.getPrev(params) %}&#xA;                {% set nextEntry = entry.getNext(params) %}&#xA;&#xA;                {# And make sure to only output the links if the element exists #}&#xA;                {% if prevEntry %}&amp;lt;a class=&quot;button left&quot; href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;                {% if nextEntry %}&amp;lt;a class=&quot;button right&quot; href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;                &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4562" LastEditorUserId="45" LastEditDate="2016-08-13T02:58:46.340" LastActivityDate="2016-08-13T02:58:46.340" Title="Entry Pagination - Group by Current Category and Order by Post Date" Tags="&lt;pagination&gt;&lt;query&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13079" PostTypeId="2" ParentId="13055" CreationDate="2016-01-04T18:09:42.307" Score="2" Body="&lt;p&gt;Currently only one &lt;code&gt;purchasableId&lt;/code&gt; can be added to the cart in a single form action. To get around this limitation you would need to use ajax to send multiple http requests (to add both items) OR use a plugin like MultiAdd: &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/MultiAdd&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-01-04T18:09:42.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13081" PostTypeId="2" ParentId="13075" CreationDate="2016-01-04T19:11:42.710" Score="2" Body="&lt;p&gt;Craft's email SMTP settings are configured under Settings-&gt;Email in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error message you're getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2015/12/03 19:21:27 [error] [exception.phpmailerException] exception 'phpmailerException' with message 'SMTP connect() failed.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simply means that PHP/Craft can't connect (for whatever reason) to the server you specified with whatever SMTP settings you've entered in Settings-&gt;Email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chances are the credentials are invalid or the settings are incorrect, but it can also happen is something (firewall, router, etc.) is blocking output SMTP access as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-04T19:11:42.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13082" PostTypeId="1" AcceptedAnswerId="13084" CreationDate="2016-01-04T20:31:25.810" Score="2" ViewCount="508" Body="&lt;p&gt;I'm having some trouble setting different markers using the smart map plugin and was hoping someone might be able to point me in a direction I might not see.&lt;/p&gt;&#xA;&lt;p&gt;The different locations are are set through a matrix field with two different block types; one that should return a blue marker and one that should return a green. I've been following the docs at: &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/different-icons-for-different-marker-types/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.doublesecretagency.com/smart-map/different-icons-for-different-marker-types/&lt;/a&gt; but have still been getting a javascript error preventing it to be rendered.&lt;/p&gt;&#xA;&lt;p&gt;The javascript error is &amp;quot;uncaught TypeError: Cannot read property 'setOptions' of undefined. I'm sure this is because the markerId variable isn't getting the address from the matrix field.&lt;/p&gt;&#xA;&lt;p&gt;Any help or insight would be greatly appreciated, thanks!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; {% set locations = entry.filmMap %}&#xA;{% set mapOptions = {&#xA;    height: 580,&#xA;    zoom: 10,&#xA;    draggable: true,&#xA;    markerInfo: '_includes/mapInfoBubble',&#xA;    markerOptions: {&#xA;    icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;  }&#xA;} %}&#xA;&#xA;{{ craft.smartMap.map(locations, mapOptions) }}&#xA;&#xA;{# Loop through location entries #}&#xA;{% for item in locations %}&#xA;&#xA;  {% switch item.type %}&#xA;    {% case 'filmSites' %}&#xA;      {% set icon = '/assets/src/images/blue-marker.png' %}&#xA;    {% case 'castingCalls' %}&#xA;      {% set icon = '/assets/src/images/green-marker.png' %}&#xA;    {% default %}&#xA;      {% set icon = 'http://maps.google.com/mapfiles/ms/icons/green-dot.png' %}&#xA;  {% endswitch %}&#xA;&#xA;  {% set address = item.address %}&#xA;&#xA;  {# JS: Change marker icon #}&#xA;  {% includejs %}&#xA;&#xA;    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.address';&#xA;    smartMap.marker[markerId].setOptions({'icon': '{{ icon }}'});&#xA;&#xA;  {% endincludejs %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4563" LastEditorUserId="45" LastEditDate="2021-01-01T06:32:28.380" LastActivityDate="2021-01-01T06:32:28.380" Title="Smart Map with multiple different markers based on a matrix field" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13083" PostTypeId="2" ParentId="13078" CreationDate="2016-01-04T21:02:00.187" Score="2" Body="&lt;p&gt;Using the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;pagination helper&lt;/a&gt; might be a cleaner way to achieve your desired results. It would go something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('news').order('postDate').relatedTo({targetElement:categoryId}).limit(5) as entries %}&#xA;    {% for item in entries %}&#xA;        {# your item code goes here #}&#xA;    {% endfor %}&#xA;    {% if paginate.prevUrl %}&#xA;        &amp;lt;a class=&quot;button left&quot; href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;    {% if paginate.nextUrl %}&#xA;        &amp;lt;a class=&quot;button right&quot; href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By using the &lt;code&gt;relatedTo({targetElement:categoryId})&lt;/code&gt; param you will stay in the same category as you paginate entries. This pagination helper handles the urls.  So we are just accessing the &lt;code&gt;paginate.prevUrl &amp;amp; paginate.nextUrl&lt;/code&gt; variables provided by the helper.  All you need to do is make sure the categoryId is set to the category you need and set the limit to the number of items to paginate by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your particular setup I would use two templates.  One for the News landing page and one for the category landing. The news landing page will paginate all News entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once a category is clicked and now uses the template specified in the category setup page, you will limit paginated entries to the current category.  The variable &lt;code&gt;category&lt;/code&gt; is reserved for those templates so you can access anything variable associated with the current category you are on. You will only notice slight difference between the two. The Category Template adds the &lt;code&gt;relatedTo({targetElement:category.id})&lt;/code&gt; criteria in addition to setting the active category class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are both templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;News Landing Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title %}&#xA;{% set description = entry.body | striptags %}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;  &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ newsHeader.header }}&amp;lt;/h1&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;filter-bar news&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;largenav&quot;&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/news&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% for topic in craft.categories.group('newsCategories') %}&#xA;              &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;div class=&quot;select tinynav&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; id=&quot;select-toggle&quot;&amp;gt;All&amp;lt;/a&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a data-value=&quot;{{ siteUrl }}news&quot; href=&quot;#&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% for topic in craft.categories.group('newsCategories') %}&#xA;                  &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; data-value=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;                  &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;    {% paginate craft.entries.section('news').order('postDate').limit(5) as entries %}&#xA;      &amp;lt;ul class=&quot;wrapper newspage&quot;&amp;gt;&#xA;        {% for item in entries %}&#xA;          &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;              &amp;lt;h5 class=&quot;meta&quot;&amp;gt;{{ entry.postDate|date(&quot;F j, Y&quot;) }} &amp;amp;nbsp;|&amp;amp;nbsp;&#xA;&#xA;                  {% if entryCategories | length %}&#xA;                    {% for topic in entryCategories %}&#xA;                      &amp;lt;a href=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;                    {% endfor %}&#xA;                  {% endif %}&#xA;              &amp;lt;/h5&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;          &amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;        {% if paginate.prevUrl %}&#xA;            &amp;lt;a class=&quot;button left&quot; href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        {% if paginate.nextUrl %}&#xA;            &amp;lt;a class=&quot;button right&quot; href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endpaginate %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title %}&#xA;{% set description = entry.body | striptags %}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;  &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ newsHeader.header }}&amp;lt;/h1&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;filter-bar news&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;largenav&quot;&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/news&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% for topic in craft.categories.group('newsCategories') %}&#xA;              &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ topic.url }}&quot; {% if category.url == topic.url %}class=&quot;active&quot;{% endif %}&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;div class=&quot;select tinynav&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;#&quot; id=&quot;select-toggle&quot;&amp;gt;All&amp;lt;/a&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a data-value=&quot;{{ siteUrl }}news&quot; href=&quot;#&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% for topic in craft.categories.group('newsCategories') %}&#xA;                  &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; data-value=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;                  &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;    {% paginate craft.entries.section('news').order('postDate').relatedTo({targetElement:category.id}).limit(5) as entries %}&#xA;      &amp;lt;ul class=&quot;wrapper newspage&quot;&amp;gt;&#xA;        {% for item in entries %}&#xA;          &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;              &amp;lt;h5 class=&quot;meta&quot;&amp;gt;{{ entry.postDate|date(&quot;F j, Y&quot;) }} &amp;amp;nbsp;|&amp;amp;nbsp;&#xA;&#xA;                  {% if entryCategories | length %}&#xA;                    {% for topic in entryCategories %}&#xA;                      &amp;lt;a href=&quot;{{ topic.url }}&quot;&amp;gt;{{ topic.title }}&amp;lt;/a&amp;gt;&#xA;                    {% endfor %}&#xA;                  {% endif %}&#xA;              &amp;lt;/h5&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;          &amp;lt;/li&amp;gt;  &#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;li class=&quot;news-item&quot;&amp;gt;&#xA;        {% if paginate.prevUrl %}&#xA;            &amp;lt;a class=&quot;button left&quot; href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        {% if paginate.nextUrl %}&#xA;            &amp;lt;a class=&quot;button right&quot; href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endpaginate %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2016-01-07T16:00:43.567" LastActivityDate="2016-01-07T16:00:43.567" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13084" PostTypeId="2" ParentId="13082" CreationDate="2016-01-04T21:10:38.887" Score="2" Body="&lt;p&gt;I believe the problem is in this line of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.address';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because you're generating markers from &lt;strong&gt;matrix blocks&lt;/strong&gt;, you'll need to use the &lt;em&gt;block&lt;/em&gt; ID instead of the entry ID. In your case, that may looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var markerId = 'smartmap-mapcanvas-1.{{ item.id }}.address';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-01-04T21:10:38.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13086" PostTypeId="2" ParentId="12862" CreationDate="2016-01-05T08:56:19.440" Score="1" Body="&lt;p&gt;Duplicate? &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9032/how-do-i-combine-search-for-categories-and-entries-into-one-set-of-search-result&quot;&gt;How do I combine search for categories and entries into one set of search results?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have to use something like supersort to sort your array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set classesLocations = craft.entries.section('classes')|merge(craft.categories.group('locations'))|supersort('sortAs', '{ startTime }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="195" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-01-05T20:41:47.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13087" PostTypeId="1" AcceptedAnswerId="13088" CreationDate="2016-01-05T11:14:11.090" Score="1" ViewCount="105" Body="&lt;p&gt;What can the issue be here? I have no clue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Config settings are like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheMethod'           =&amp;gt; &quot;db&quot;,&#xA;'cacheDuration'         =&amp;gt; 'P2M', /*2 months*/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Undefined property: Craft\WebApp::$db&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/www_cmgg_cmgg_be/craft/app/services/CacheService.php(46)&#xA;&#xA;34         switch (craft()-&amp;gt;config-&amp;gt;get('cacheMethod'))&#xA;35         {&#xA;36             case CacheMethod::APC:&#xA;37             {&#xA;38                 $this-&amp;gt;_cacheComponent = new ApcCache();&#xA;39                 break;&#xA;40             }&#xA;41 &#xA;42             case CacheMethod::Db:&#xA;43             {&#xA;44                 $this-&amp;gt;_cacheComponent = new DbCache();&#xA;45                 $this-&amp;gt;_cacheComponent-&amp;gt;gCProbability = craft()-&amp;gt;config-&amp;gt;get('gcProbability', ConfigFile::DbCache);&#xA;46                 $this-&amp;gt;_cacheComponent-&amp;gt;cacheTableName = craft()-&amp;gt;db-&amp;gt;getNormalizedTablePrefix().craft()-&amp;gt;config-&amp;gt;get('cacheTableName', ConfigFile::DbCache);&#xA;47                 $this-&amp;gt;_cacheComponent-&amp;gt;autoCreateCacheTable = true;&#xA;48                 break;&#xA;49             }&#xA;50 &#xA;51             case CacheMethod::EAccelerator:&#xA;52             {&#xA;53                 $this-&amp;gt;_cacheComponent = new EAcceleratorCache();&#xA;54                 break;&#xA;55             }&#xA;56 &#xA;57             case CacheMethod::File:&#xA;58             {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2016-01-05T12:27:11.323" Title="Undefined property when using cacheMethod = db" Tags="&lt;cache&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13088" PostTypeId="2" ParentId="13087" CreationDate="2016-01-05T12:27:11.323" Score="1" Body="&lt;p&gt;Solved. The client was using something called Samba Share on their server and that didn't work well with permissions. They changed servers and it was solved.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2016-01-05T12:27:11.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13089" PostTypeId="1" AcceptedAnswerId="13580" CreationDate="2016-01-05T14:28:27.277" Score="1" ViewCount="149" Body="&lt;p&gt;I'm trying to display form entries from Sprout Forms that match a specific criterium:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('formHandle').fieldname('fieldvalue') %}&#xA;    {{formEntry.fieldname}}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not filter the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('formHandle') %}&#xA;    {% if fieldname == 'fieldvalue'%}&#xA;        {{formEntry.fieldname}}&#xA;    {% endif %} &#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can this not be done with parameters, or am I using the wrong Entry model?&lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="57" LastEditDate="2016-01-05T20:46:09.010" LastActivityDate="2016-02-05T02:29:11.200" Title="Filter Sprout Forms entries based on field value, using parameters" Tags="&lt;entries&gt;&lt;filter&gt;&lt;entrymodel&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13090" PostTypeId="1" AcceptedAnswerId="13096" CreationDate="2016-01-05T15:30:31.383" Score="2" ViewCount="886" Body="&lt;p&gt;Is it possible to integrate assets with Clouflare CDN service ? In docs only Amazon, Google and Rackspace are referred.&lt;/p&gt;&#xA;" OwnerUserId="4383" LastActivityDate="2016-01-05T18:40:03.550" Title="Cloudflare CDN integration" Tags="&lt;assets&gt;&lt;cloudflare&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13091" PostTypeId="1" CreationDate="2016-01-05T16:57:01.373" Score="1" ViewCount="76" Body="&lt;p&gt;My map isn't showing all of the markers that it should. I am querying a user group to return the locations as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.users.group('fullMembership') %} {{ craft.smartMap.map(locations, options) }}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FYI There are around 400 users in this group and only a small amount of them have logged in and set their Map Pin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each user in this group has a profile page; Those user who have located their address  all show their map pin on their profile. However the members Directory index map is incomplete, some pins are missing.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-05T17:18:39.667" Title="Smart Map Lat+Lng is present but no pin on map" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13093" PostTypeId="2" ParentId="13091" CreationDate="2016-01-05T17:18:39.667" Score="2" Body="&lt;p&gt;As Craft defaults to only returning 100 elements, setting the &lt;code&gt;limit(null)&lt;/code&gt; parameter to the query fixed this issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.users.group('fullMembership').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-05T17:18:39.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13094" PostTypeId="1" AcceptedAnswerId="13095" CreationDate="2016-01-05T17:42:29.883" Score="2" ViewCount="464" Body="&lt;p&gt;I found a way to do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set allBlocks =  craft.entries.matrixes %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which seems to return all the matrix blocks.. or at least I think it is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if try to filter down like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set allBlocks =  craft.entries.matrixes.type('document') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to get all the Matrix blocks by type or better still all the Matrix blocks in a particular field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would i need to setup a plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2016-01-05T20:44:36.777" LastActivityDate="2016-01-05T20:44:36.777" Title="Is it possible to get all elements in a Matrix field by type or field name" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13095" PostTypeId="2" ParentId="13094" CreationDate="2016-01-05T18:04:38.367" Score="5" Body="&lt;p&gt;There is no &lt;code&gt;craft.entries.matrixes&lt;/code&gt; variable available natively in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;code&gt;craft.entries&lt;/code&gt; returns an &lt;em&gt;ElementCriteriaModel&lt;/em&gt;, which does not have a &lt;code&gt;matrixes&lt;/code&gt; property explicitly set.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;code&gt;craft.entries.matrixes&lt;/code&gt; is actually looking for &lt;code&gt;ElementCriteriaModel-&amp;gt;matrixes()&lt;/code&gt;, which could &lt;em&gt;implicitly&lt;/em&gt; exist if:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You have a field called &lt;em&gt;matrixes&lt;/em&gt;, &lt;em&gt;or&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;There's a plugin in the mix that is changing functionality&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll need a plugin to run these custom queries. Luckily Craft's &lt;em&gt;MatrixService&lt;/em&gt; has plenty of methods that would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Low created a plugin (&lt;a href=&quot;https://github.com/low/lowblocks&quot;&gt;LowBlocks&lt;/a&gt;) to do this sort of thing, which might fit your need, or at least offer a helpful starting point.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-01-05T18:04:38.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13096" PostTypeId="2" ParentId="13090" CreationDate="2016-01-05T18:40:03.550" Score="4" Body="&lt;p&gt;Cloudflare's CDN isn't a true CDN like Amazon, Rackspace, or Google.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Cloudflare you host your assets on the server and Cloudflare then automatically keeps a cached copy of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, you don't upload to CloudFlare, CloudFlare downloads from you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on Craft, simply use the &quot;Local folder&quot; source type.&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2016-01-05T18:40:03.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13097" PostTypeId="2" ParentId="13089" CreationDate="2016-01-05T18:54:12.837" Score="1" Body="&lt;p&gt;I believe this should work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('formHandle').search('fieldname:fieldvalue') %}&#xA;    {{formEntry.fieldname}}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2016-01-05T18:54:12.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13098" PostTypeId="2" ParentId="12665" CreationDate="2016-01-05T20:31:52.113" Score="1" Body="&lt;p&gt;Do you have any transforms configured?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would double check your asset source &lt;strong&gt;File System Path&lt;/strong&gt; is correct. Before 2.5 I had mine set incorrectly but &lt;code&gt;image.url('&amp;lt;transform_handle&amp;gt;')&lt;/code&gt; still worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, try to upload an image through an asset field and see if you get any errors.&lt;/p&gt;&#xA;" OwnerUserId="3905" LastActivityDate="2016-01-05T20:31:52.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13099" PostTypeId="1" CreationDate="2016-01-05T21:37:51.087" Score="1" ViewCount="425" Body="&lt;p&gt;Having scoured the forums for similar questions of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4571/building-results-from-advanced-search-form?rq=1&quot;&gt;which&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9499/filter-entries-by-multiple-categories&quot;&gt;there&lt;/a&gt; are &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9081/how-to-filter-entries-by-clicking-multiple-categories-on-front-end/9083#9083&quot;&gt;a few&lt;/a&gt;, I'm still struggling to figure out my specific usecase. I have 4 filters and a search box (which searches a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11749/limit-search-results-for-users-by-tag-and-limit-to-5-tags&quot;&gt;custom tag field&lt;/a&gt;) to filter &lt;code&gt;craft.users&lt;/code&gt; in a group. 3 of the filters are matrix fields, 2 of the filters are posted as an array.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gender seems to be working fine:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first option’s gender value is empty “”, which seems to work and return both genders if selected. Is this fine, or should I be checking if a value has been posted? And if so, would I need to use &lt;a href=&quot;https://craftcms.stackexchange.com/a/4573/3888&quot;&gt;a ternary operator to &lt;code&gt;set&lt;/code&gt; a default array&lt;/a&gt; for both male and female values?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;How do I add a Matrix field into the &lt;code&gt;craft.users&lt;/code&gt; object syntax?&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this even possible? I can imagine setting something like &lt;code&gt;maxPrice: &quot;&amp;lt;= #{maxPrice}&quot;&lt;/code&gt; for a standard number field, but have no idea how I'd do so for a number field within a Matrix block:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;i.e. &lt;code&gt;craft.users.profilePricing.type('details').session&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm using matrix fields as they separate related chunks of data better, the specific ones I need to search are limited to &lt;a href=&quot;https://craftcms.com/docs/number-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;number fields&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/dropdown-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;dropdown&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/checkboxes-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;checkboxes&lt;/a&gt;. All of which only allow 1 block. For now at least, the filters should match all criteria with &lt;code&gt;and&lt;/code&gt; logic.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Filters&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Here is an example of the filter options:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;gender&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot;&amp;gt;Male and female&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;male&quot;&amp;gt;Male&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;female&quot;&amp;gt;Female&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;input id=&quot;maxPrice&quot; type=&quot;number&quot; name=&quot;maxPrice&quot; min=&quot;0&quot; max=&quot;100&quot; step=&quot;5&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;maxPrice&quot;&amp;gt;&amp;lt;small&amp;gt;Maximum session price&amp;lt;/small&amp;gt;&amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;skype&quot; name=&quot;sessions[]&quot; checked&amp;gt; Skype&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;chat&quot; name=&quot;sessions[]&quot; checked&amp;gt; Live web chat&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;phone&quot; name=&quot;sessions[]&quot; checked&amp;gt; Telephone&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;email&quot; name=&quot;sessions[]&quot; checked&amp;gt; Email&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;office&quot; name=&quot;hours[]&quot; checked&amp;gt; Office hours&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;overtime&quot; name=&quot;hours[]&quot; checked&amp;gt; Out of hours&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;weekends&quot; name=&quot;hours[]&quot; checked&amp;gt; Weekends&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Results&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;And the unfinished code for the search results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set tags = craft.request.getParam('tags') %}&#xA;{% set gender = craft.request.getParam('gender') %}&#xA;{% set maxPrice = craft.request.getParam('maxPrice') %}&#xA;{% set sessions = craft.request.getParam('sessions') %}&#xA;{% set hours = craft.request.getParam('hours') %}&#xA;&#xA;{% set results = craft.users({&#xA;  group: 'verified',&#xA;  search: &quot;tagsSpecialismSearchable:#{tags}&quot;,&#xA;  gender: gender,&#xA;}) %}&#xA;&#xA;{% set users = shuffle(results) %}&#xA;&#xA;{% if users|length %}&#xA;  &amp;lt;p&amp;gt;{{ users|length }} results:&amp;lt;/p&amp;gt;&#xA;&#xA;  {% include '_includes/counsellors/profile.html' %}&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;Your search for “{{ tags }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZybNl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZybNl.png&quot; alt=&quot;Search filters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-05T21:37:51.087" Title="Advanced filtered search: Matrix fields and arrays" Tags="&lt;matrix&gt;&lt;users&gt;&lt;search&gt;&lt;filter&gt;&lt;array&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13100" PostTypeId="1" CreationDate="2016-01-05T23:03:05.693" Score="0" ViewCount="109" Body="&lt;p&gt;Is there some difference between admin users and other users? In my plugin, I have code that grabs the email address off of a selected user and then sends an email to that user. It works fine is the user is not an admin, but breaks if the user is an admin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// grab the user object so we can get the email address from it&#xA;foreach ($users as $user) {&#xA;    if ($user-&amp;gt;id == $settings-&amp;gt;users) {&#xA;        $emailRecipient = $user;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Later, I pull the email address and send the email.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email          = new EmailModel();&#xA;$email-&amp;gt;toEmail = $emailRecipient-&amp;gt;email;&#xA;$email-&amp;gt;subject = 'New Entry in ' . $sectionTitle . '.';&#xA;$email-&amp;gt;body    = $body;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For non admins, it works but for admins, I get the error &lt;code&gt;PHP notice: Trying to get property of non-object&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="495" LastEditorUserId="57" LastEditDate="2016-01-06T03:06:14.053" LastActivityDate="2016-01-06T03:06:14.053" Title="Problem pulling email address from admin user in plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;php&gt;&lt;admin&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13101" PostTypeId="1" AcceptedAnswerId="13102" CreationDate="2016-01-06T03:09:16.537" Score="0" ViewCount="210" Body="&lt;p&gt;I have a drop-down of variants of a product. For example t-shirts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for purchasable in product.variants %}&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;        {{ purchasable.title }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;    &amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I have &quot;Select&quot; as the default option, and it has no value. I can validate the form client side no problem, but I am curious if there is a way to designate that fields as required from the server-side? I can mark the field as required in the layout builder, but that is for the CP only I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do not choose an option, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\Exception &#xA;Not a purchasable ID&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which makes perfect sense since I am not passing it a valid purchasable element.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-01-06T03:21:20.947" Title="How can I make a product field required?" Tags="&lt;validation&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13102" PostTypeId="2" ParentId="13101" CreationDate="2016-01-06T03:21:20.947" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I can mark the field as required in the layout builder, but that is for the CP only I think.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope... marking the field as required makes it required globally (regardless of if it's coming from the control panel or the front-end).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-06T03:21:20.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13104" PostTypeId="1" AcceptedAnswerId="13105" CreationDate="2016-01-06T08:03:52.487" Score="6" ViewCount="2317" Body="&lt;p&gt;I am struggling with using additional custom order fields. (Added in the Craft Commerce settings at &quot;order fields&quot;, in the field layout manager)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to update them like this in the checkout process:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;myCustomField&quot; value=&quot;Test123&quot;&amp;gt;&#xA;    ...&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Update Custom Field&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in the Order in the CP, the field stays empty. Do I have to use another &lt;code&gt;name&lt;/code&gt; for the field, like &lt;code&gt;fields[myCustomField]&lt;/code&gt; or whatever?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can update them in the CP, but not from the front-end...&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="57" LastEditDate="2016-01-06T18:36:34.257" LastActivityDate="2016-09-18T00:50:30.427" Title="How can I update custom order fields in the frontend" Tags="&lt;custom-field&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13105" PostTypeId="2" ParentId="13104" CreationDate="2016-01-06T08:16:06.907" Score="12" Body="&lt;p&gt;Correct, you need to use &lt;code&gt;fields[customFieldName]&lt;/code&gt; as the input name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following form should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[myCustomField]&quot; value=&quot;Test123&quot;&amp;gt;&#xA;    ...&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Update Custom Field&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-09-18T00:50:30.427" LastActivityDate="2016-09-18T00:50:30.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13106" PostTypeId="1" AcceptedAnswerId="13579" CreationDate="2016-01-06T09:56:30.140" Score="1" ViewCount="211" Body="&lt;p&gt;For some reason Sprout Forms entries will not accept the usual order by field handle setup. When I want to order the contact entries by address for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('contact').order('address') %}&#xA;    {{formEntry.address}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Column not found: 1054 Unknown column 'address' in 'order clause'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This field does exist. If I remove 'order', it parses the field&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-02-06T16:37:31.453" Title="Order Sprout Forms by field handle returns an error" Tags="&lt;entries&gt;&lt;plugin-sproutforms&gt;&lt;order&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13107" PostTypeId="1" AcceptedAnswerId="13110" CreationDate="2016-01-06T10:36:24.533" Score="2" ViewCount="223" Body="&lt;p&gt;Sorry the question title is so random - feel free to correct it to something more succinct if you can think of one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13045/how-to-query-for-multiple-relations-with-supertable&quot;&gt;How to query for multiple relations with SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a front end Entry form which I'm using to create/edit an Entry which contains one field, a table called &lt;code&gt;guestNames&lt;/code&gt;. The number of rows allowed in that table is set in another section's Entry (&lt;code&gt;event&lt;/code&gt;). The SuperTable field in the &lt;code&gt;event&lt;/code&gt; that defines how many rows are allowed is called &lt;code&gt;guestAllocation&lt;/code&gt;. There two rows in that SuperTable, &lt;code&gt;partner&lt;/code&gt; (Entries) and &lt;code&gt;places&lt;/code&gt; (Number).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my front end Entry form I want to create the correct number of input fields that are allowed. I have no problem doing that with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in 1..entry.guestAllocation.relatedTo(partner).first.places %}&#xA;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;fields[guestNames][{{ loop.index0 }}][col1]&quot;&amp;gt;Name {{ loop.index }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;fields[guestNames][{{ loop.index0 }}][col1]&quot; type=&quot;text&quot; name=&quot;fields[guestNames][{{ loop.index0 }}][col1]&quot; class=&quot;form-control&quot;&amp;gt;&#xA;    {% if entry is defined %}{{ errorList(entry.getErrors('fields[guestNames]')) }}{% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the purposes of this example, that could be a static number like &lt;code&gt;5&lt;/code&gt;. However, I also need to provide editing functionality rather than just creating a new entry each time, so with the following line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if partnerGuestList|length %}&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;{% endif %} {# If there's a guest list for this partner, update it #}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can check if the entry exists already. Now I need to provide the correct number of input fields from &lt;code&gt;entry.guestAllocation.relatedTo(partner).first.places&lt;/code&gt;, but in those input boxes, I need to provide the data from the rows in the table &lt;code&gt;partnerGuestList&lt;/code&gt; &lt;code&gt;guestNames&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the names I need, I can query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in partnerGuestList.guestNames %}&#xA;    {{ row.guestName }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please comment if I can clarify any more!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short version:&lt;/strong&gt; How can I show data from an entry in a loop that isn't related to that entry?&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-06T17:11:31.330" Title="Get data from another loop from outside the current loop" Tags="&lt;entries&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13108" PostTypeId="2" ParentId="2937" CreationDate="2016-01-06T10:43:12.233" Score="1" Body="&lt;p&gt;I have created the &lt;a href=&quot;https://gum.co/AssetsBroswer&quot; rel=&quot;nofollow&quot;&gt;Assets Browser Plugin&lt;/a&gt; which allows to browse an asset source or a specific folder on the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although it is not a treeview it serves me well for outputting a download area on the website. It works even with the &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow&quot;&gt;Internal Assets Plugin&lt;/a&gt; for a member-only area.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-01-06T10:43:12.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13110" PostTypeId="2" ParentId="13107" CreationDate="2016-01-06T11:58:57.173" Score="3" Body="&lt;p&gt;Interesting. I'm not able to test this right now, but I think this should work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could first loop through the results, adding them to an array as you go...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set guestNameValues = [] %}&#xA;&#xA;{% for row in partnerGuestList.guestNames %}&#xA;    {% set guestNameValues = guestNameValues|merge([row.guestName]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then within your loop that displays the fields set the value as...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ guestNameValues[loop.index0] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should get the corresponding name from the array you previously set.&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2016-01-06T11:58:57.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13111" PostTypeId="1" AcceptedAnswerId="13114" CreationDate="2016-01-06T14:49:56.193" Score="2" ViewCount="543" Body="&lt;p&gt;I have a local site that was running perfectly, but last year when I ran the auto-update it seems that it did not finish the process. At that time didn't have time to have a look to what happened (please bear in mind I'm a designer, and this is not a client site :D), and yesterday I saw that the admin dashboard was not working, and some pages were not loading too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I downloaded the files again from the website, replaced the craft/app folder following the manual update instructions, and all seem to be fine (site works and dashboard works), except that when I go to entries I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or &gt; view not found: 1146 Table 'craft.craft_elementindexsettings' doesn't exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Other pages of the admin side works fine, I've cleared the cache and that made no difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I uploaded the new craft/new and went to /admin, I did not get any message about updating the database as the instructions say. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also can't recall why the auto-update didn't work properly. I kind of remember that the page got stuck, or I got an error, but as the internet in this office is quite bad, I thought the problem was at my end, not craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to solve it? &#xA;Is it possible to re-run the auto-update of the database?&lt;/p&gt;&#xA;" OwnerUserId="4573" LastEditorUserId="45" LastEditDate="2016-01-06T17:23:36.297" LastActivityDate="2016-01-06T17:23:36.297" Title="Table 'craft.craft_elementindexsettings' doesn't exist" Tags="&lt;database&gt;&lt;auto-updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13112" PostTypeId="2" ParentId="12941" CreationDate="2016-01-06T15:05:11.730" Score="1" Body="&lt;p&gt;I have proposed a solution to this issue here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1035&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1035&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution is a little clunky but I think it's better than the current situation and hopefully not to hard to add.  If you think that might be helpful please go there and vote it up.&lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="3951" LastEditDate="2017-04-28T01:42:14.550" LastActivityDate="2017-04-28T01:42:14.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13113" PostTypeId="1" AcceptedAnswerId="13115" CreationDate="2016-01-06T17:05:24.393" Score="2" ViewCount="452" Body="&lt;p&gt;I'm trying to use a macro to output a list of entries (and the title of a section), this is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro sections(sectionName)%}&#xA;&#xA;    {% set index = craft.entries.section('{{ sectionName }}Index').first %}&#xA;    &amp;lt;h3&amp;gt;{{ index.getLink() }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for entry in craft.entries.section('{{ sectionName }}').order('title') %}&#xA;&#xA;        {{ loop.first ? '&amp;lt;ul&amp;gt;'}}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; {{ sectionName }}&amp;lt;/li&amp;gt;&#xA;        {{ loop.last ? '&amp;lt;/ul&amp;gt;'}}&#xA;&#xA;    {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{{ _self.sections('about') }}&#xA;{{ _self.sections('information') }}&#xA;{{ _self.sections('galleries') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this displays ALL entries. However, if I hardcode the section names (for each loop) it works, though not DRY.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first attempt at using a macro, seemed like a good place to use one?&lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="57" LastEditDate="2016-01-06T19:15:11.250" LastActivityDate="2016-01-06T19:15:11.250" Title="Using a macro for entries loop" Tags="&lt;entries&gt;&lt;sections&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13114" PostTypeId="2" ParentId="13111" CreationDate="2016-01-06T17:21:36.683" Score="2" Body="&lt;p&gt;This issue has actually come up before in the Slack channel...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;That’s a brand new Craft 2.5 table, so you’ve probably tried to do the update before, it failed and you didn’t clear out all tables from the database when you retried.&quot; - Brad Bell&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As you mentioned, your auto-update did not complete successfully. So the logical next step (as you tried) is to perform a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/329/how-can-i-manually-update-craft&quot;&gt;manual update&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's the catch... Before you made your 2nd (manual) attempt, &lt;strong&gt;you didn't roll back your database&lt;/strong&gt;. Between attempts, you would need to &lt;em&gt;drop all tables&lt;/em&gt; and re-import your original database SQL file.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-06T17:21:36.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13115" PostTypeId="2" ParentId="13113" CreationDate="2016-01-06T17:31:04.533" Score="3" Body="&lt;p&gt;You don't want braces within braces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want something like this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set index = craft.entries.section(sectionName ~ 'Index').first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same needs changing in the for loop.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-01-06T17:31:04.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13116" PostTypeId="2" ParentId="13019" CreationDate="2016-01-06T19:50:22.617" Score="4" Body="&lt;p&gt;In Craft when changing an email address (even if it's the currently logged in user), they must supply their existing password as well.  You can use the hidden &lt;code&gt;redirect&lt;/code&gt; input to send to whatever template you want (assuming saving the user was successful).  In your case, then template can tell them to check their email and click the link it contains.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users/checkyouremail&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;{{ currentUser.email }}&quot;&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once the click the link and verify they own the email address, they'll get redirected to the site root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need different behavior than that, you can always write a plugin that has it's own controller actions that changes the workflow into something you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-06T19:50:22.617" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13117" PostTypeId="2" ParentId="13019" CreationDate="2016-01-06T20:25:51.067" Score="5" Body="&lt;p&gt;Based on Brad's response I created the following controller in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Myplugin_SaveUserController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;    /**&#xA;     * Handle the save user form request.&#xA;     */&#xA;    public function actionSaveUser()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        $email  = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;        $userId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;        $user   = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;        if ($email !== $user-&amp;gt;email)&#xA;        {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setFlash('changedEmail', 'changed email');&#xA;        }&#xA;        $this-&amp;gt;forward('users/saveUser', false);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then check for it in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('changedEmail') == 'changed email' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone who may be using this in the future, it's worth noting that I also had to change the &quot;action&quot; hidden input in my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myplugin/saveUser/saveUser&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastActivityDate="2016-01-06T20:25:51.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13118" PostTypeId="1" AcceptedAnswerId="13119" CreationDate="2016-01-06T21:01:00.313" Score="5" ViewCount="3775" Body="&lt;p&gt;I am having a hard time trying to figure out how to pull matrix blocks within an entry into the single entry's endpoint with the Element API plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? Or do I need to output the blockId's and then create another API endpoint to query by the matrix block id?&lt;/p&gt;&#xA;" OwnerUserId="213" LastEditorUserId="57" LastEditDate="2016-01-06T21:13:38.580" LastActivityDate="2021-02-26T16:46:19.377" Title="How do you use the Element API plugin to output Matrix blocks for an entry?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13119" PostTypeId="2" ParentId="13118" CreationDate="2016-01-06T21:05:34.933" Score="13" Body="&lt;p&gt;Totally possible. Just loop through the blocks and add whatever data you want from them to the response array:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    // Create an array of all the &quot;Body&quot; Matrix field's blocks&#xA;    $bodyBlocks = [];&#xA;    foreach ($entry-&amp;gt;body as $block) {&#xA;        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;            case 'text':&#xA;                $bodyBlocks[] = [&#xA;                    'text' =&amp;gt; $block-&amp;gt;myRichTextField-&amp;gt;getParsedContent(),&#xA;                ];&#xA;                break;&#xA;            case 'image':&#xA;                $image = $block-&amp;gt;myAssetsField-&amp;gt;first();&#xA;                $bodyBlocks[] = [&#xA;                    'image' =&amp;gt; $image ? $image-&amp;gt;getUrl(['width' =&amp;gt; 500]),&#xA;                    'caption' =&amp;gt; $block-&amp;gt;myPlainTextField,&#xA;                ];&#xA;                break;&#xA;        }&#xA;    }&#xA;&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'description' =&amp;gt; (string) $entry-&amp;gt;description,&#xA;        'body' =&amp;gt; $bodyBlocks&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each of the elements in that sub-array will be &lt;a href=&quot;https://craftcms.com/classreference/models/MatrixBlockModel&quot;&gt;MatrixBlockModel&lt;/a&gt; objects.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-01-07T11:39:35.293" LastActivityDate="2016-01-07T11:39:35.293" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13120" PostTypeId="2" ParentId="9859" CreationDate="2016-01-06T21:24:23.627" Score="1" Body="&lt;p&gt;There seems to be an inherited problem with redactor using the p tag as a default. I struggled to find a solution where I do need p tags and where inserted links were still getting wrapped in p tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting linebreaks to true and deniedTags results automatically setting &quot;paragraphize&quot; to false and also results in not getting any &quot;br&quot; tags (a bit of a hackish solution considering that there is a &quot;paragraphize&quot; property one can set to &quot;false&quot;, doesn't always work (dark magic)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this results in my copy that needs to be wrapped in &quot;p&quot; tag not to be wrapped. Of course the editors have no clue what a &quot;p&quot; tag is so the magic of having a WSYWG editor became a horror. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i opted to enforce a rule that the editors should use &quot;formatting&gt;normal text&quot; from the toolbar. This resulted in a type error on line 902 &lt;code&gt;redactor.js &amp;gt; Uncaught TypeError: Cannot read property 'toLowerCase' of undefined&lt;/code&gt;. I scratched my head since this works for Headings and Quotes (Selected text would be wrapped by the heading type selected eg, h1 h2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After debugging I found that on line 843 in Redactor &lt;code&gt;if (this.opts.linebreaks || tag != 'p')&lt;/code&gt; seems to be the culprit. Now not being the architect of the code changing this to &lt;code&gt;if (this.opts.linebreaks || tag == 'p')&lt;/code&gt; resulted in everything to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can add custom p format with custom class and the selected text would be wrapped accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magic = &lt;code&gt;this.block.formatWrap(tag);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now up to trying to make my inserted links not to be wrapped in a 'p' tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is a nasty hack and not full proof for future use since upgrading would override the change. I would like to challenge anybody to come up with a better solution.&lt;/p&gt;&#xA;" OwnerUserId="3334" LastEditorUserId="3334" LastEditDate="2016-01-06T21:49:07.233" LastActivityDate="2016-01-06T21:49:07.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13121" PostTypeId="1" CreationDate="2016-01-06T21:24:27.673" Score="3" ViewCount="645" Body="&lt;p&gt;We've just had a security review of a client's site and one main issue raised is that a brute force attack would reveal the password if the username was guessable (ie &quot;admin&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could a limit on the number of login attempts be a possible feature in the future? Failing that does are there any suggestions for how we could best protect against this sort of intrusion with the current version of Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerDisplayName="user3585" LastActivityDate="2016-01-06T21:47:26.990" Title="Login attempts limit" Tags="&lt;login&gt;&lt;password&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13122" PostTypeId="2" ParentId="13121" CreationDate="2016-01-06T21:47:26.990" Score="5" Body="&lt;p&gt;There are several config settings which should help...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#maxInvalidLogins&quot; rel=&quot;nofollow noreferrer&quot;&gt;maxInvalidLogins&lt;/a&gt; - The number of invalid login attempts Craft will allow within the specified duration before the account gets locked.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#invalidLoginWindowDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;invalidLoginWindowDuration&lt;/a&gt; - The amount of time to track invalid login attempts for a user, for determining if Craft should lock an account.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#cooldownDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;cooldownDuration&lt;/a&gt; - The amount of time a user must wait before re-attempting to log in after their account is locked due to too many failed login attempts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In addition, you may also want to change your &lt;a href=&quot;https://craftcms.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;cpTrigger&lt;/a&gt; from the default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, there is a feature request to &lt;a href=&quot;http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/10459731-better-stricter-rules-for-password-input-upon-regi&quot; rel=&quot;nofollow noreferrer&quot;&gt;strengthen password requirements&lt;/a&gt;, where Brandon Kelly posted a link on how to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12165/how-do-i-enforce-stronger-password-requirements-on-my-craft-site/12166#12166&quot;&gt;enforce your own stricter password requirements&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-06T21:47:26.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13124" PostTypeId="1" AcceptedAnswerId="13130" CreationDate="2016-01-07T08:21:29.600" Score="0" ViewCount="170" Body="&lt;p&gt;In my custom Twig tag I am trying to reference a class in the Twig_Node compile method, however I receive an error every time stating it can't find it.  What would the path be to a custom plugin class for the Twig_Node?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Class 'PluginCustomClass' not found in /Volumes/Grid/Devbox/www/event.craft.dev/craft/app/vendor/twig/twig/lib/Twig/Environment.php(403) : eval()'d code on line 431&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function compile(\Twig_Compiler $compiler)&#xA;    {&#xA;        $compiler&#xA;            -&amp;gt;addDebugInfo($this)&#xA;            -&amp;gt;subcompile($this-&amp;gt;getNode('pluginTarget'))&#xA;            -&amp;gt;raw(', ')&#xA;            -&amp;gt;subcompile($this-&amp;gt;getNode('elementsTarget'))&#xA;            -&amp;gt;raw(') = new \PluginCustomClass(')&#xA;            -&amp;gt;subcompile($this-&amp;gt;getNode('criteria'))&#xA;            -&amp;gt;raw(&quot;);\n&quot;);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-01-07T18:49:47.267" Title="Path to plugin class from a Twig_Node" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13125" PostTypeId="1" CreationDate="2016-01-07T13:22:48.263" Score="2" ViewCount="481" Body="&lt;p&gt;I would like to add tags via a front-end entry form - not like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5327/how-do-you-add-tags-to-tag-field-when-saving-an-entry&quot;&gt;here&lt;/a&gt;, but as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Text field in a front-end entry form where user add tags (separated by commas).&lt;/li&gt;&#xA;&lt;li&gt;After pressing the save button, the plugin should:&lt;/li&gt;&#xA;&lt;li&gt;check for every tag, whether it exists already (and create the tag if not)&lt;/li&gt;&#xA;&lt;li&gt;save the tags together with the rest of the entry form [see also &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5327/how-do-you-add-tags-to-tag-field-when-saving-an-entry&quot;&gt;here]&lt;/a&gt;(including the text field with the user defined tags)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, I am looking for a developer (I am willing to pay for it).&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-01-07T15:21:24.717" Title="Plugin: Tags field for front-end Entry Form" Tags="&lt;plugin-development&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13126" PostTypeId="2" ParentId="13125" CreationDate="2016-01-07T15:21:24.717" Score="4" Body="&lt;p&gt;While the full answer to this probably requires some planning, and a plugin that handles various aspects of the tag management, here are a few components to consider:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can submit tags from the front-end and, on the server side, they will behave like Craft handles them in the Control Panel. The syntax for your front-end form field is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select multiple name=&quot;fields[fieldHandle][]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;13&quot;&amp;gt;Tag Name One&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;42&quot;&amp;gt;Tag Name Two&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;144&quot;&amp;gt;Tag Name Three&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a more friendly UI, there are a handful of javascript libraries that could help on the front-end. I believe the one that Craft uses in the Control Panel is &lt;a href=&quot;http://selectize.github.io/selectize.js/&quot; rel=&quot;nofollow&quot;&gt;selectize.js&lt;/a&gt; and it could be setup to be used on the front-end as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To handle the pre-processing of tag behavior before an Entry is saved, your plugin may need to use the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onBeforeSaveEntry Event&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-01-07T15:21:24.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13127" PostTypeId="2" ParentId="10523" CreationDate="2016-01-07T16:20:17.667" Score="3" Body="&lt;p&gt;As of version &lt;code&gt;2.5.2750&lt;/code&gt; it appears Craft now comes with sample files to check against &lt;code&gt;isImageManipulatable()&lt;/code&gt; in &lt;code&gt;/craft/app/helpers/ImageHelper.php&lt;/code&gt; which includes the following files located at &lt;code&gt;/craft/app/resources/images/samples/&lt;/code&gt; by default:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sample.bmp&lt;/li&gt;&#xA;&lt;li&gt;sample.gif&lt;/li&gt;&#xA;&lt;li&gt;sample.jpeg&lt;/li&gt;&#xA;&lt;li&gt;sample.jpg&lt;/li&gt;&#xA;&lt;li&gt;sample.png&lt;/li&gt;&#xA;&lt;li&gt;sample.svg&lt;/li&gt;&#xA;&lt;li&gt;sample.tif&lt;/li&gt;&#xA;&lt;li&gt;sample.tiff&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the installed &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagick&lt;/a&gt; includes support for &lt;code&gt;tif&lt;/code&gt; files it will be able to transform these without any extra configuration or hacking of the &lt;code&gt;isImageManipulatable()&lt;/code&gt; function which was the only previous method of enabling transforms for &lt;code&gt;tif&lt;/code&gt;. &lt;a href=&quot;https://craftcms.stackexchange.com/a/10534/4118&quot;&gt;Previous answer by @TomBauer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: It looks like you should be able to add support for extra files in Craft (if supported by installed Imagick) by providing a sample file in the above directory for Craft to check against. At least until Craft updates.&lt;/p&gt;&#xA;" OwnerUserId="4118" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-23T15:50:38.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13130" PostTypeId="2" ParentId="13124" CreationDate="2016-01-07T18:49:47.267" Score="2" Body="&lt;p&gt;Assuming &lt;code&gt;PluginCustomClass&lt;/code&gt; is a class inside of a Craft plugin, then the issue is probably that you need to reference it in the &lt;code&gt;Craft&lt;/code&gt; namespace.  Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;raw(') = new \Craft\PluginCustomClass(')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on what type of class that is (Service, Variable, Helper, standalone, etc.), Craft might not have auto-loaded it, so you might need to manually require it as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-07T18:49:47.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13132" PostTypeId="1" AcceptedAnswerId="13135" CreationDate="2016-01-08T03:48:47.800" Score="1" ViewCount="562" Body="&lt;p&gt;I'm creating a plugin and I've been following the Mijingo Craft plugin development videos. I reached the point where a column was added to the entry index page. I was looking to do something similar but on the Entry type index page &lt;code&gt;/admin/settings/sections/{ID}/entrytypes&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was unable to find anything in the documentation (maybe I missed something). But is there a method I can use to do this? or is it not possible?&lt;/p&gt;&#xA;" OwnerUserId="4179" LastEditorUserId="4179" LastEditDate="2016-01-08T04:21:05.770" LastActivityDate="2016-07-15T02:32:29.560" Title="Add custom column to Entry Type index page" Tags="&lt;plugin-development&gt;&lt;entry-type&gt;&lt;hook&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13133" PostTypeId="1" CreationDate="2016-01-08T04:13:27.413" Score="1" ViewCount="257" Body="&lt;p&gt;I am (attempting) to and for the most part succeeding in sending an email from a plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin has a textarea in the settings that allows the user to customize the message. The message looks like this by default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textareaField({&#xA;    label:        &quot;Guest Email Message&quot;|t,&#xA;    id:           'guestEmailMessage',&#xA;    name:         'guestEmailMessage',&#xA;    instructions: &quot;The email message.&quot;|t,&#xA;    value:        (settings.emailMessage ? settings.emailMessage : &quot;&amp;lt;p&amp;gt;Use the link below to complete your request.&amp;lt;p&amp;gt;&amp;lt;a href=&quot;{siteUrl}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Regards,&amp;lt;br&amp;gt;{siteName}&amp;lt;/p&amp;gt;&quot;|t({ siteName: craft.app.siteName })),&#xA;    errors:       settings.getErrors('emailMessage')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to create something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;&amp;lt;p&amp;gt;Use the link below to complete your request.&amp;lt;p&amp;gt;&amp;lt;a href=&quot;http://www.mysite.com/slug/ASDFQWER123&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My first problem is, I haven't figured out how to properly escape the anchor parameter. I've tried single quote and a backslash &lt;code&gt;\&lt;/code&gt; (that one). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second problem is how to generate a random token. I'd like to generate a random string or something. I thought something like &lt;a href=&quot;https://craftcms.com/classreference/helpers/UrlHelper#getUrlWithToken-detail&quot; rel=&quot;nofollow&quot;&gt;getUrlWithToken()&lt;/a&gt;, but I'm at the twig level and I'm not sure how that translates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be &lt;em&gt;cool&lt;/em&gt; if when I visit the link I am sending I have a way to validate that in my template. Maybe it's a case of if the CSRF token matches? I'm not sure where to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-08T04:25:01.927" LastActivityDate="2016-01-08T18:17:53.727" Title="How can I create and validate against a url token?" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13134" PostTypeId="2" ParentId="2986" CreationDate="2016-01-08T07:18:59.213" Score="14" Body="&lt;p&gt;Completely biased answer, but check out my &lt;a href=&quot;https://github.com/khalwat/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt;.  It's pretty comprehensive, and it's free.  If you're running Craft CMS 3, the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin is available&lt;/a&gt; for Craft CMS 3 as well (but is not free).&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-28T14:07:11.820" LastActivityDate="2018-03-28T14:07:11.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13135" PostTypeId="2" ParentId="13132" CreationDate="2016-01-08T08:29:07.120" Score="3" Body="&lt;p&gt;Unfortunately, that's not possible currently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you feel that &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference&quot; rel=&quot;nofollow&quot;&gt;a hook&lt;/a&gt; for customizing the Entry Type listing/index should exist, you can &lt;a href=&quot;http://feedback.buildwithcraft.com&quot; rel=&quot;nofollow&quot;&gt;add a feature request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-08T08:29:07.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13136" PostTypeId="1" CreationDate="2016-01-08T16:52:53.123" Score="1" ViewCount="194" Body="&lt;p&gt;Right now, I have a staff profile page. Each person on the page has a category association (professional, leadership, student). When the students graduate, I want to add an 'alumni' category to their entry, and have them stop showing up on the active page. Right now I have student and alumni associated with the particular entry, and I want to hide all entries with the alumni category. Any idea how to go about this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set leaderGroup = craft.categories.group('staffHierarchy').slug('leadership') %}&#xA;{% set leader = craft.entries.section('people').relatedTo(leaderGroup) %}&#xA;{% set staffGroup = craft.categories.group('staffHierarchy').slug('student') %}&#xA;{% set staff = craft.entries.section('people').relatedTo(staffGroup) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4495" LastActivityDate="2016-01-13T11:37:03.270" Title="How can I hide entries depending on which category they are associated with?" Tags="&lt;categories&gt;&lt;entry&gt;&lt;conditional&gt;&lt;category&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13137" PostTypeId="1" CreationDate="2016-01-08T17:09:42.993" Score="0" ViewCount="144" Body="&lt;p&gt;In the Sprout SEO docs you can pass for entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({&#xA;    id: entry.id&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it is smart enough to grab the data. How would could I do similar for meta fields assigned to a global set?&lt;/p&gt;&#xA;" OwnerUserId="3746" LastEditorUserId="3746" LastEditDate="2016-01-08T18:41:19.513" LastActivityDate="2016-01-08T20:31:55.347" Title="Sprout SEO: How to access meta fields assigned to globals?" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13138" PostTypeId="1" AcceptedAnswerId="13139" CreationDate="2016-01-08T17:29:48.703" Score="1" ViewCount="1348" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to create the cache directory&#xA;  (/path/craft/storage/runtime/compiled_templates//36).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I receive this on one live installation of Craft CMS.&#xA;This is 99% a server issue with permissions. I can't even login to the CP anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question tough: I don't cache anything on the site.&#xA;Does Craft still cache things even with &lt;code&gt;'cache' =&amp;gt; false,&lt;/code&gt; or are these two different cache levels?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2016-01-08T18:27:56.957" LastActivityDate="2016-01-08T18:27:56.957" Title="Unable to create the cache directory" Tags="&lt;cache&gt;&lt;server&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13139" PostTypeId="2" ParentId="13138" CreationDate="2016-01-08T17:50:32.640" Score="4" Body="&lt;p&gt;Yes, Craft still has its runtime caches for compiling Twig templates (as seen in your example) and such. Craft's template and partial cache is separate from Twig's own template compilation, if I'm not mistaken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If storing in local folders won't work, you can change the &lt;a href=&quot;https://craftcms.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; setting to use a store other than a local directory ('memcache', 'apc', etc.).&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2016-01-08T17:50:32.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13140" PostTypeId="2" ParentId="13133" CreationDate="2016-01-08T18:17:53.727" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My first problem is, I haven't figured out how to properly escape the anchor parameter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm guessing you mean the link is being escaped (since Twig will do that by default) and you don't want it to?  If so, you can use the &lt;code&gt;|raw&lt;/code&gt; filter (&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/filters/raw.html&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My second problem is how to generate a random token. I'd like to generate a random string or something.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you don't care if it's a cryptographically secure string, you can just use &lt;a href=&quot;https://craftcms.com/classreference/helpers/StringHelper#randomString-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper::randomString()&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/classreference/helpers/StringHelper#UUID-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper::UUID()&lt;/a&gt;.  If you want a cryptographically secure random string, then you can use &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CSecurityManager#generateRandomString-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;security-&gt;generateRandomString()&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-08T18:17:53.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13141" PostTypeId="2" ParentId="12353" CreationDate="2016-01-08T18:55:49.810" Score="3" Body="&lt;p&gt;Craft checks if a form has changed using javascript in the cp.js file, see &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/cp.js#L196&quot; rel=&quot;nofollow&quot;&gt;line 196&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could replicate this quite easily yourself though, here is a stripped down example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var initialFormValues = $('form[data-confirm-unload]').serialize();&#xA;&#xA;function checkFormChanged() {&#xA;    if ($('form[data-confirm-unload]').serialize() != initialFormValues) {&#xA;        return true;&#xA;    }&#xA;&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2016-01-08T18:55:49.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13142" PostTypeId="1" CreationDate="2016-01-08T19:28:23.110" Score="1" ViewCount="116" Body="&lt;p&gt;After updating to Craft 2.5, some rich text fields have disappeared from the CMS.&lt;a href=&quot;https://i.stack.imgur.com/4GaFa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4GaFa.png&quot; alt=&quot;Field Missing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this similar to the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12689/html-code-button-missing-from-rich-text-standard-view-after-2-5-upgrade&quot;&gt;issue described here&lt;/a&gt;, the answer did not fully resolve my issue.&lt;/p&gt;&#xA;" OwnerUserId="1096" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-01-08T19:28:23.110" Title="After updating to Craft 2.5, standard and custom rich text (Redactor) fields disappear" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13143" PostTypeId="2" ParentId="13142" CreationDate="2016-01-08T19:28:23.110" Score="2" Body="&lt;p&gt;It looked like my custom Redactor configuration files needed to be updated to be compatible with the latest version of Redactor that was included with Craft 2.5.  The &lt;a href=&quot;https://craftcms.com/support/redactor-ii-configs&quot; rel=&quot;nofollow&quot;&gt;This Craft support page&lt;/a&gt; described some of the changes, but these did not fully fix my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured out that the structure of &quot;formattingAdd&quot; configuration had been updated. Once I followed the format &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;described on the Imperavi site&lt;/a&gt;, the fields started displaying again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Version 1 formattingAdd syntax:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: [&#xA;    {&#xA;        tag: 'p',&#xA;        title: 'Disclaimer',&#xA;        class: 'disclaimer'&#xA;    },&#xA;    {&#xA;        tag: 'a',&#xA;        title: 'Secondary CTA',&#xA;        class: 'btn btn-default'&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Version II formattingAdd syntax:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: {&#xA;    'disclaimer-add': {&#xA;        title: 'Disclaimer',&#xA;        args: ['p', 'class', 'disclaimer', 'add']&#xA;    },&#xA;    'secondary-add': {&#xA;        title: 'Secondary CTA',&#xA;        args: ['a', 'class', 'btn btn-default', 'add']&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2016-01-08T19:28:23.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13144" PostTypeId="2" ParentId="13137" CreationDate="2016-01-08T20:31:55.347" Score="1" Body="&lt;p&gt;To manage global meta data settings, we recommend using the Meta Defaults. They have all the supported fields and can be accessed by admins in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Sprout SEO Meta fields only work with Entries right now, so unfortunately, the data they store will not be usable if they are added to a Global Set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I understand these following items aren't exactly what you are looking to do, here are a few steps that could help customize the user experience:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sprout SEO allows you to rename how the plugin is named in the interface. So you could update the plugin name to just use 'SEO' to help a client associate the SEO tab more specifically with the role of updating SEO meta data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you'd have various things setup in Globals and feel that you'd like to somehow tie in the Meta Defaults to that area of your Control Panel, the Sprout Fields plugin has a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/notes-field&quot; rel=&quot;nofollow&quot;&gt;Notes Field&lt;/a&gt; that allows you to add a field that allows you to add more detailed documentation or links to a Global Set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-01-08T20:31:55.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13146" PostTypeId="2" ParentId="13136" CreationDate="2016-01-09T16:24:29.613" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#search&quot; rel=&quot;nofollow&quot;&gt;search parameter&lt;/a&gt; will help you do this really elegantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the code below I've called the category field &lt;code&gt;categoryField&lt;/code&gt;, but you'll have to swap that to suit your site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get current students (students who aren't also in the alumni category) #}&#xA;{% set currentStudents = craft.entries.section('people').search('categoryField:student -categoryField:alumni') %}&#xA;&#xA;{% for student in currentStudents %}&#xA;    {# Output your students here #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is basically asking Craft to respond with the entries that have the categoryField including student but not (indicated by the &lt;code&gt;-&lt;/code&gt; before) including alumni.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably also streamline the other bits of your code using this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tested this as working on Craft 2.5.2757&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="2284" LastEditorUserId="3951" LastEditDate="2016-01-13T08:39:55.637" LastActivityDate="2016-01-13T08:39:55.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13148" PostTypeId="1" AcceptedAnswerId="13149" CreationDate="2016-01-10T04:35:27.183" Score="2" ViewCount="95" Body="&lt;p&gt;I have Smart Map working perfectly &lt;em&gt;within&lt;/em&gt; Commerce. Meaning, I am able to show a map, etc. when I'm looking at products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am trying to build a &quot;product locator&quot; to find products in my area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to successfully pass the arguments to my results page - I can print out the zip code and distance that was chosen, but I am always getting into my &quot;no results found&quot; case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set target = craft.request.getParam('near') %}&#xA;{% set radius = (craft.request.getParam('radius')) craft.request.getParam('radius') : 200 %}&#xA;    {% set params = {&#xA;    'target': target,&#xA;    'range': radius&#xA;} %}&#xA;&#xA;{% set entries = craft.entries.address(params).order('distance').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;radius&lt;/code&gt; is a drop-down of (miles) to choose from. &#xA;&lt;code&gt;near&lt;/code&gt; is the name of the text input the user enters the zip.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-01-10T05:39:01.313" LastActivityDate="2016-01-10T05:39:01.313" Title="How can I tell Smart Map to look at Commerce for entries?" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13149" PostTypeId="2" ParentId="13148" CreationDate="2016-01-10T04:55:59.047" Score="2" Body="&lt;p&gt;You need to tell Craft to look within the Commerce section like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.commerce.products.address(params).order('distance').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-01-10T05:38:35.013" LastActivityDate="2016-01-10T05:38:35.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13150" PostTypeId="1" CreationDate="2016-01-10T17:42:29.703" Score="2" ViewCount="283" Body="&lt;p&gt;I set up an &lt;strong&gt;matrix field&lt;/strong&gt; and put it into section type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am trying to create new entry a kind of broken &lt;strong&gt;'Create a new entry'&lt;/strong&gt; CP is shown up. Only title 'Create a new entry' and an broken 'save' button. Also rest of header seems not to rendered nice. Horizontal scrollbars appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change same field to other type, all works as expected.&#xA;It really only happens if I am using matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All happens on fresh setup:&#xA;No plugins installed. (Just this one task tried and failed).&#xA;Mac, Mamp Pro.&#xA;Craft (version 2.5.2757)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Console in Browser says nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I tried:&#xA; + Fresh installation with user permissions for all craft folders read&amp;amp;write.&#xA; + PHP memory config on 128mb. (Mamp Pro).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: &lt;strong&gt;SOLVED&lt;/strong&gt; It had something to do with php error settings in Mamp Pro. Once disabled, all is working, also with Matrix.&lt;/p&gt;&#xA;" OwnerUserId="4556" LastEditorUserId="4556" LastEditDate="2016-01-30T20:15:24.567" LastActivityDate="2016-01-30T20:15:24.567" Title="'Create a new entry' CP is blank if matrix field exists" Tags="&lt;matrix&gt;&lt;control-panel&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13151" PostTypeId="1" CreationDate="2016-01-10T19:10:44.963" Score="6" ViewCount="426" Body="&lt;p&gt;I'm pulling in some RSS feeds using Feed Me (&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot;&gt;https://github.com/engram-design/FeedMe&lt;/a&gt;) and turning those in entries automatically using a cron job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can imagine that producing a lot of entries over time ;) Is there a known limit for entries in the Craft database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And is there perhaps a way to automatically delete entries after x amount of time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Bob&lt;/p&gt;&#xA;" OwnerUserId="3829" LastActivityDate="2016-01-10T20:20:31.577" Title="How many entries could the Craft database hold before it slows down?" Tags="&lt;entries&gt;&lt;database&gt;&lt;entry&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13152" PostTypeId="2" ParentId="13151" CreationDate="2016-01-10T20:20:31.577" Score="6" Body="&lt;p&gt;It's a bit of a loaded question, but generally it's going to depend more on environmental limitations than anything with Craft itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on a shared host along with 200 other accounts using the same MySQL server, then you'll likely notice slowdowns sooner than later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on a decent host with plenty of memory/disk/CPU available, then we've seen sites with 500k users/entries/assets/etc. running along just fine.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And is there perhaps a way to automatically delete entries after x amount of time?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As Andrew pointed out in the comments, you could write a simple plugin that exposes a controller action that gets all entries over a certain age and deletes them.  Then you'd setup a CRON job to call that controller endpoint on whatever schedule you want.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-10T20:20:31.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13153" PostTypeId="2" ParentId="13150" CreationDate="2016-01-10T22:16:50.767" Score="1" Body="&lt;p&gt;Solution: Do it as in craft instructions asked '&lt;a href=&quot;https://craftcms.com/docs/requirements&quot; rel=&quot;nofollow&quot;&gt;PHP 5.3.0 or later with safe mode disabled&lt;/a&gt;' and all works perfect like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem came from settings in Mamp Pro. The debugger was active. And all other 'what to log' too. After uncheck - no problem any more.&lt;/p&gt;&#xA;" OwnerUserId="4556" LastActivityDate="2016-01-10T22:16:50.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13154" PostTypeId="1" AcceptedAnswerId="13159" CreationDate="2016-01-10T22:42:11.240" Score="1" ViewCount="762" Body="&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('assets.onBeforeSaveAsset', function(Event $event) {&#xA;        $asset = $event-&amp;gt;params['asset'];&#xA;        $asset-&amp;gt;setAttribute('filename', 'new name');&#xA;        craft()-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;    }&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the code I use in the primary plugin class. This is just a test as i'm learning. I know it should better be in service.&#xA;This is supposed to change the filename upon uploading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway this does nothing, when I upload an asset in the cp, the dialog with progress bars pops up but get stuck.&#xA;How should I modify this for it to work ?&lt;/p&gt;&#xA;" OwnerUserId="4583" LastEditorUserId="1098" LastEditDate="2016-01-11T08:32:34.870" LastActivityDate="2016-01-11T13:25:07.417" Title="Change asset name on upload" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13155" PostTypeId="1" AcceptedAnswerId="13158" CreationDate="2016-01-10T23:20:12.133" Score="2" ViewCount="257" Body="&lt;p&gt;On my _entry page, I'm trying to get the SmartMap plugin to generate a dynamic map, but it gets stuck on 'Loading Map'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this as the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.smartMap.map(entry.theEventAddress) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the console tells me:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Uncaught SyntaxError: Unexpected token ,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The documentation is a bit vague on this, and it doesn't really tell you how to fix JavaScript errors. Also, I have API keys in the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the output as requested. Using the latest version of the plugin. (2.3.1)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;/*&amp;lt;![CDATA[*/&#xA;if (logSmartMap) {console.log(&quot;[smartmap-mapcanvas-1] Drawing map...&quot;);}&#xA;smartMap.createMap(&quot;smartmap-mapcanvas-1&quot;, {&quot;center&quot;:smartMap.coords(-48.876667,-123.393333),&quot;scrollwheel&quot;:false});&#xA;if (logSmartMap) {console.log(&quot;[smartmap-mapcanvas-1.2497.theEventAddress] Drawing marker...&quot;);}&#xA;smartMap.createMarker(&quot;smartmap-mapcanvas-1.2497.theEventAddress&quot;, {&quot;mapId&quot;:&quot;smartmap-mapcanvas-1&quot;,&quot;map&quot;:smartMap.map[&quot;smartmap-mapcanvas-1&quot;],&quot;position&quot;:smartMap.coords(,)});&#xA;if (logSmartMap) {console.log(&quot;[smartmap-mapcanvas-1] Fitting bounds...&quot;);}&#xA;smartMap.fitBounds(&quot;smartmap-mapcanvas-1&quot;);&#xA;/*]]&amp;gt;*/&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the problem line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;smartMap.createMarker(&quot;smartmap-mapcanvas-1.2497.theEventAddress&quot;, {&quot;mapId&quot;:&quot;smartmap-mapcanvas-1&quot;,&quot;map&quot;:smartMap.map[&quot;smartmap-mapcanvas-1&quot;],&quot;position&quot;:smartMap.coords(,)});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="4554" LastEditDate="2016-01-11T01:26:12.653" LastActivityDate="2016-01-11T06:29:15.650" Title="SmartMap throwing back javascript error" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13156" PostTypeId="1" CreationDate="2016-01-11T02:50:07.657" Score="1" ViewCount="913" Body="&lt;p&gt;I'm having that dreaded GROUP_BY issue on a website. I suspect the server auto-updated itself or something as the site was fine before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now it's running on mySQL 5.7.10. The site wont load. I get the usual:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #18 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'creighton_mma_craft.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I followed the instructions I have used before (adding the settings into my.cnf to return the group by settings to previous behavior).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works for a few mins, then the whole of mySQL dies. I can no longer access it at all. I can only bring it back up by removing the line and restarting mySQL. I have tried several times and get the same result each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WHAT ON EARTH IS HAPPENING??&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2016-01-11T15:09:03.650" Title="Dreaded GROUP_BY issue on mySQL 5.7+" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13158" PostTypeId="2" ParentId="13155" CreationDate="2016-01-11T04:46:45.877" Score="2" Body="&lt;p&gt;There are actually two problems happening here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) For a location to appear on a map, it's critical for the latitude &amp;amp; longitude to be filled in. Within the UX of the Address field, this can happen a few different ways... as you mentioned, clicking &quot;Select Address&quot; is one of the main ways of doing so. Additionally, the address selection modal will be automatically triggered when you tab between fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;(2) There is apparently a small bug in Smart Map, which I'll go ahead and patch. If a location is lacking coordinates, the JS shouldn't attempt to render that marker. It should just be omitted from the map instead.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. I'll release a patch shortly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just pushed out Smart Map v2.3.2, which fixes the bug. Instead of triggering a JS error, the marker will simply be skipped. In that case, the JS console will output the following message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to draw marker, invalid coordinates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hope that helps! For anyone who may need further support on this issue, feel free to email support@doublesecretagency.com.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2016-01-11T06:29:15.650" LastActivityDate="2016-01-11T06:29:15.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13159" PostTypeId="2" ParentId="13154" CreationDate="2016-01-11T08:17:52.900" Score="6" Body="&lt;p&gt;First, when you &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;noreferrer&quot;&gt;attach event listeners&lt;/a&gt; using &lt;code&gt;craft.on&lt;/code&gt;, the naming convention for the event name is &lt;code&gt;assets.beforeSaveEntry&lt;/code&gt;, not &lt;code&gt;assets.onBeforeSaveEntry&lt;/code&gt; (i.e., skip the &lt;code&gt;on&lt;/code&gt; part). Both names appear to work, but the former is the one used in the docs and I'd recommend using that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the reason why your upload &quot;gets stuck&quot; is your call to &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;storeFile&lt;/code&gt; inside the event listener. Basically, that call results in a loop, because &lt;code&gt;craft-&amp;gt;assets-&amp;gt;storeFile()&lt;/code&gt; will fire another &lt;code&gt;beforeSaveAsset&lt;/code&gt; event – making your script execute continually before timing out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for actually changing the filename on upload; unfortunately, if there's a reliable way to change the asset filename &lt;em&gt;before the asset is saved&lt;/em&gt;, I haven't been able to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you can work with the &lt;code&gt;assets.saveAsset&lt;/code&gt; event (which is fired after the asset is uploaded and saved on the server), I found a way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, set up an event listener for &lt;code&gt;assets.saveAsset&lt;/code&gt;. Inside the event listener, you need to check the &lt;code&gt;$event&lt;/code&gt; object's &lt;code&gt;isNewAsset&lt;/code&gt; property; making sure the filename is only changed the first time the asset is saved and preventing the loop mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the actual filename, there's a couple of issues to consider. For one, the filename needs to be unique (to that particular folder, as least). If you attempt to store an asset with an existing filename, Craft will use the original filename for your upload (I'd expect Craft to either ask if you wanted to replace the existing file, or suffix the filename with a number, but that doesn't appear to be the case). Secondly, the filename needs to include the file's extension (i.e. &lt;code&gt;jpg&lt;/code&gt; or &lt;code&gt;pdf&lt;/code&gt;). And finally; because this code runs &lt;em&gt;after&lt;/em&gt; the asset has been saved and the file is already stored on the server, it isn't enough to set the filename attribute to the AssetFileModel object (i.e. &lt;code&gt;$asset&lt;/code&gt;), you'll also need to rename the actual file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping these issues in mind, here's a working example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.saveAsset', function (Event $event) {&#xA;&#xA;    if ($event-&amp;gt;params['isNewAsset']) {&#xA;&#xA;        $asset = $event-&amp;gt;params['asset'];&#xA;&#xA;        // Set the filename to a variable, appending the file extension&#xA;        $filename = 'filename-'.md5(time()).'.'.$asset-&amp;gt;getExtension();&#xA;&#xA;        // Rename the file on the server&#xA;        craft()-&amp;gt;assets-&amp;gt;renameFile($asset, $filename);&#xA;&#xA;        // Set filename attribute and re-save asset&#xA;        $asset-&amp;gt;setAttribute('filename', $filename);&#xA;        craft()-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in the above example, I'm hashing the current timestamp and adding it to the filename as an easy fix to ensure that it's unique. I don't know how you want your filenames to look or if duplicate filenames would even be an issue in your case, but you could of course implement a solution that tests for duplicate filenames and/or generates unique filenames in a different manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be honest, although the above should work I do feel this solution is a bit convoluted and I wouldn't be surprised if there's a better way – if there is, hopefully you'll have another answer.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-11T13:25:07.417" LastActivityDate="2016-01-11T13:25:07.417" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13162" PostTypeId="2" ParentId="13156" CreationDate="2016-01-11T15:09:03.650" Score="1" Body="&lt;p&gt;Looking at other issues, there are a few options to handle the GROUP BY issue on MySQL 5.6 &gt; 5.7&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Alter the query by using GROUP_CONCAT&lt;/li&gt;&#xA;&lt;li&gt;Alter the SQL modes&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Changing the SQL modes gives you a timeout, but these modes were given in a configuration file. Have you tried it by using an &quot;extra&quot; query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.E. session/global:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This resets the SQL_MODE to ignore ONLY_FULL_GROUP_BY for every session, in a different way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if this changes anything :)&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-01-11T15:09:03.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13164" PostTypeId="1" AcceptedAnswerId="13173" CreationDate="2016-01-11T15:50:53.770" Score="2" ViewCount="339" Body="&lt;p&gt;I am trying to split entry into multiple pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In accordance with the &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;, I am using this code on single-entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body.getPage(1) }}&#xA;&#xA;{% if entry.body.getTotalPages() &amp;gt; 1 %}&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading…&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However &lt;code&gt;{{ entry.url }}&lt;/code&gt; is always pointing to the same page that I'm on (base entry URL) without any pagination number, so I never get to second page.&#xA;I have checked that &lt;code&gt;{{entry.body.getTotalPages()}}&lt;/code&gt; returns 2, so the pagebreak plugin is working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the working code that I got with Brad Bell's help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentPage = 1 %}&#xA;{% if craft.request.getParam('page') is not empty %}&#xA;    {% set currentPage = craft.request.getParam('page') %}&#xA;{% endif %}&#xA;&#xA;{{ entry.body.getPage(currentPage) }}&#xA;&#xA;{% if entry.body.getTotalPages() &amp;gt; 1 %}&#xA;    {% set totalPages = entry.body.getTotalPages() %}&#xA;&#xA;    {% for i in 1..totalPages %}&#xA;    &amp;lt;a href=&quot;{{ url(entry.url, {page: i}) }}&quot;&amp;gt;go to page: {{ i }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="1104" LastEditDate="2016-01-12T08:28:26.600" LastActivityDate="2016-01-12T08:28:26.600" Title="Redactor pagebreak plugin and linking to pages" Tags="&lt;redactor&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13165" PostTypeId="1" AcceptedAnswerId="13167" CreationDate="2016-01-11T15:53:26.720" Score="2" ViewCount="1074" Body="&lt;p&gt;In reference to this post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/627/can-i-apply-an-image-transformation-to-an-arbitrary-image-non-assets-field&quot;&gt;Can I apply an image transformation to an arbitrary image (non-Assets field)?&lt;/a&gt; does anyone have an example of the markup used to create the plugin to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to create a transformed thumbnail from a Vimeo/YouTube URL, but I am having difficulty creating the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created the following function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function videothumb($imageSource)&#xA;{&#xA;&#xA;  $image = craft()-&amp;gt;images-&amp;gt;loadImage($imageSource);&#xA;  $image-&amp;gt;setQuality($quality);&#xA;  $image-&amp;gt;resize($transform-&amp;gt;width, $transform-&amp;gt;height);&#xA;  $image-&amp;gt;saveAs($targetFile);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I am calling it with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 100,&#xA;    height: 100,&#xA;    quality: 75,&#xA;    position: 'top-center'&#xA;} %}&#xA;{{ craft.thoughtful.videothumb('http://thoughtfulweb.com/images/_halfPageStandard/Thoughtful-Indiana-Jones.jpg', thumb) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I keep getting an error saying:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;No file exists at the path “&lt;a href=&quot;http://thoughtfulweb.com/images/_halfPageStandard/Thoughtful-Indiana-Jones.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://thoughtfulweb.com/images/_halfPageStandard/Thoughtful-Indiana-Jones.jpg&lt;/a&gt;”&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly I am missing something. Any pointers would be greatly received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. I know the file path does not point to a video thumbnail. It’s just for reference.&lt;/p&gt;&#xA;" OwnerUserId="3611" LastEditorUserId="975" LastEditDate="2019-07-07T05:58:54.797" LastActivityDate="2019-07-07T05:58:54.797" Title="Plugin to create an image transformation for an external image (non-Assets field)" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13166" PostTypeId="1" CreationDate="2016-01-11T16:08:06.300" Score="1" ViewCount="284" Body="&lt;p&gt;Has anyone found a replacement for: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;deniedTags: ['p'],&#xA;paragraphize: false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find a way to strip the pesky &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag anymore, on Redactor II.&lt;/p&gt;&#xA;" OwnerUserId="1084" LastEditorUserId="57" LastEditDate="2016-01-11T18:15:43.453" LastActivityDate="2016-02-11T13:53:58.603" Title="Redactor denied tags replacement?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13167" PostTypeId="2" ParentId="13165" CreationDate="2016-01-11T17:38:17.770" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/classreference/services/ImagesService&quot; rel=&quot;nofollow&quot;&gt;ImagesService&lt;/a&gt;'s &lt;code&gt;loadImage()&lt;/code&gt; method is designed to read image files off of the local file system only, not URLs – hence the appropriate error message; Craft treats your URL as a local filepath and that file obviously doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To apply transforms to an image on a remote host, you'll have to jump through a few hoops. First, you'll need to download the image from the remote URL to your local server – the easiest way to do this is using PHP´s &lt;a href=&quot;http://php.net/manual/en/function.file-get-contents.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;file_get_contents&lt;/code&gt;&lt;/a&gt; method – before creating and storing the image file (the best way to do that is by using the &lt;a href=&quot;https://craftcms.com/classreference/helpers/IOHelper&quot; rel=&quot;nofollow&quot;&gt;IOHelper&lt;/a&gt; class' &lt;code&gt;createFile&lt;/code&gt; and &lt;code&gt;storeFile&lt;/code&gt; methods). At that point you'll have an image file on the local filesystem and a valid filepath to use for the &lt;code&gt;ImageService&lt;/code&gt; in order to apply your transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along the way, you'll need to take care to retain the remote image file's extension (i.e. jpg, gif, png or the like), construct valid filepaths for the downloaded image and the transformed image(s), handle caching for the external file (avoiding a situation where you'll have the server downloading the remote image on every pageload), testing for existing transforms (to avoid needlessly re-transforming the image on every pageload) etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advice: Unless you absolutely need to (or want to) write your own plugin, you should use the excellent &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow&quot;&gt;Imager plugin&lt;/a&gt; – which is able to transform images from external hosts (i.e. URLs) out of the box. Here's how you could use Imager in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 100,&#xA;    height: 100,&#xA;    quality: 75,&#xA;    position: 'top-center'&#xA;} %}&#xA;{% set image = craft.imager.transformImage('http://thoughtfulweb.com/images/_halfPageStandard/Thoughtful-Indiana-Jones.jpg', thumb) %}&#xA;{% if image %}&#xA;&amp;lt;img src=&quot;{{ image.url }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-11T18:45:10.550" LastActivityDate="2016-01-11T18:45:10.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13168" PostTypeId="1" CreationDate="2016-01-11T17:44:10.590" Score="1" ViewCount="81" Body="&lt;p&gt;The search ranking built into Craft orders site content searches by score...but that compromises the &quot;exact match&quot; searches that users might make for significant page titles that don't get searched for as often, but contain key words that are often searched. Is there a way around this? to allow the user to set the search by &quot;exact match&quot;? or to set the site to pick one or the other as its standard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks,&#xA;Karin&lt;/p&gt;&#xA;" OwnerUserId="4589" LastActivityDate="2016-01-11T18:20:35.437" Title="Search ranking challenge" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13169" PostTypeId="2" ParentId="13168" CreationDate="2016-01-11T18:20:35.437" Score="1" Body="&lt;p&gt;I'm not sure I'm following the question 100%, but if you want to search for an &quot;exact match&quot; you can use put your search term in quotes.  i.e. &lt;code&gt;&quot;search for this exact phrase&quot;&lt;/code&gt;.  And if you want to find an exact match in a particular field, you can use &lt;code&gt;fieldHandle:&quot;exact match&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the full search syntax list here: &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-11T18:20:35.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13170" PostTypeId="2" ParentId="12981" CreationDate="2016-01-11T20:38:08.423" Score="2" Body="&lt;p&gt;This issue came as a result of the MySQL DB &lt;code&gt;sql_mode&lt;/code&gt; including the &lt;code&gt;NO_AUTO_VALUE_ON_ZERO&lt;/code&gt; mode which affects how &lt;code&gt;auto_increment&lt;/code&gt; columns work. When trying to create a new row entry it will only &lt;code&gt;auto_increment&lt;/code&gt; if &lt;code&gt;null&lt;/code&gt; is passed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full explanation here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero&quot; rel=&quot;nofollow&quot;&gt;http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This setting matched with the way the controller's &lt;code&gt;actionSaveDefault&lt;/code&gt; function was setting the id to a blank value rather than a &lt;code&gt;null&lt;/code&gt; value caused it to trigger this DB behavior of writing a 0 rather than &lt;code&gt;auto_increment&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the cause of the issue is not Craft or SproutSEO specific, this answer might help anyone else with the issue.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check your MySQL DB &lt;code&gt;sql_mode&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;If, &lt;code&gt;NO_AUTO_VALUE_ON_ZERO&lt;/code&gt; is set make sure you're passing &lt;code&gt;null&lt;/code&gt; if you want it to &lt;code&gt;auto_increment&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2016-01-11T20:38:08.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13171" PostTypeId="1" CreationDate="2016-01-11T20:42:01.997" Score="1" ViewCount="243" Body="&lt;p&gt;I have 2 separate sections living in the same place on my site. Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;About (Single-type Section)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Team (Structure-type Section)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So in the URL I need to nest Team underneath About, i.e. /about/team. Since they're not in the same section I can't do it the built-in way, so how would I accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2016-01-11T21:40:15.090" Title="Nest Entries from Different Sections" Tags="&lt;url&gt;&lt;navigation&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13172" PostTypeId="2" ParentId="13171" CreationDate="2016-01-11T21:40:15.090" Score="4" Body="&lt;p&gt;The Team section’s landing page could just be a template living at &lt;code&gt;about/team/index.html&lt;/code&gt;. From there if you want to output info about the team members, just fetch it manually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for teamMember in craft.entries.section('team') %}&#xA;    &amp;lt;h3&amp;gt;{{ teamMember.title }}&amp;lt;/h3&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to give each Team entry its own page on the site, go into the Team section’s settings and check the “Entries in this section have their own URLs” checkbox. Set the URL Format to &lt;code&gt;about/team/{slug}&lt;/code&gt;, and the Template to &lt;code&gt;about/team/_entry&lt;/code&gt;. Then create an &lt;code&gt;about/team/_entry.html&lt;/code&gt; template with whatever info you want. (The current Team entry will be available to the template as an &lt;code&gt;entry&lt;/code&gt; variable.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the index, within that for-loop, you can link to the team member’s pages like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ teamMember.url }}&quot;&amp;gt;{{ teamMember.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-01-11T21:40:15.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13173" PostTypeId="2" ParentId="13164" CreationDate="2016-01-11T23:25:45.500" Score="2" Body="&lt;p&gt;The example is the docs you're referring to will simple output the first &quot;page&quot; of the Rich Text field and if there are more pages show a &quot;Continue Reading&quot; link that loads the full entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the functionality you're looking for you'd have to do something like this (completely untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalPages = entry.body.getTotalPages() %}&#xA;&#xA;{% for i in 1..totalPages %}&#xA;    &amp;lt;a href=&quot;{{ url(entry.url, {page: i}) }}&quot;&amp;gt;{{ i }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your template would grab the &lt;code&gt;page&lt;/code&gt; from the querystring and display it  using &lt;code&gt;entry.body.getPage(page)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-11T23:25:45.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13174" PostTypeId="2" ParentId="12909" CreationDate="2016-01-11T23:57:23.377" Score="2" Body="&lt;p&gt;For Craft 2.6, if a hidden &lt;code&gt;redirect&lt;/code&gt; input is set, Craft will now follow it first and fallback to the &lt;a href=&quot;https://craftcms.com/docs/config-settings#activateAccountSuccessPath&quot; rel=&quot;nofollow&quot;&gt;activateAccountSuccessPath&lt;/a&gt; if it's not available.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-11T23:57:23.377" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13175" PostTypeId="1" CreationDate="2016-01-12T00:30:50.563" Score="0" ViewCount="75" Body="&lt;p&gt;Same issue as found here - but no resolution: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12541/missing-buttons-in-settings-after-update-to-2-5-beta&quot;&gt;Missing buttons in settings after update to 2.5 beta&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the orange buttons in the CP are missing but the code is there for the css and if I select a checkmark and unselect it then press return the functions still run. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can think that may have triggered this is there was a license discrepancy while I ran the upgrade, but I can't recreate it on a new install. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's missing on every single browser across multiple computers.&lt;/p&gt;&#xA;" OwnerUserId="532" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-01-12T20:01:10.783" Title="Missing buttons after upgrading site to 2.5" Tags="&lt;admin&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13176" PostTypeId="2" ParentId="1110" CreationDate="2016-01-12T02:32:10.247" Score="5" Body="&lt;p&gt;&lt;strong&gt;I'm happy to report that &lt;em&gt;&lt;a href=&quot;https://topshelfcraft.com/calendars&quot;&gt;Craft Calendars&lt;/a&gt;&lt;/em&gt; is officially released.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;Calendars&lt;/em&gt; plugin enables you to set up multiple calendars, repeating/recurring events, multi-language content, monthly calendar views, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iCal/Google import/export is on the roadmap, coming in version &lt;em&gt;1.1&lt;/em&gt;/&lt;em&gt;1.2&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info: &lt;strong&gt;&lt;a href=&quot;https://topshelfcraft.com/calendars&quot;&gt;https://topshelfcraft.com/calendars&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of right now, &lt;em&gt;Craft Calendars&lt;/em&gt; is the only production-ready/supported plugin for event management that I'm aware of, but others are in the works, at varying stages of development, including:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/venti&quot;&gt;Venti&lt;/a&gt;, by Tipping Media&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nxnw/craft-recurring-dates&quot;&gt;craft-recurring-events&lt;/a&gt;, by Dan Fockler&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/Events&quot;&gt;Events&lt;/a&gt;, an example plugin by Pixel &amp;amp; Tonic&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-01-12T02:32:10.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13177" PostTypeId="1" AcceptedAnswerId="13226" CreationDate="2016-01-12T06:23:49.397" Score="7" ViewCount="1682" Body="&lt;p&gt;Per this code example, it's clear that the API is expecting to return results based on an &lt;strong&gt;existing element&lt;/strong&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when the criteria finds a matching entry, everything works great!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when there is &lt;strong&gt;no matching criteria results&lt;/strong&gt;, the API seems to simply return a generic 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I make the API return a message (in JSON format) instead of a 404?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/13194/45&quot;&gt;The solution provided by @megatrond&lt;/a&gt; is helpful, but doesn't really nail the problem here. I'm actually using that workaround for a different problem I encountered... I needed to guarantee that the user is authorized to ping my endpoint. In implementing that solution, I created a unique access key, included it in the URL, and checked against it before potentially returning a JSON-formatted error message. Under those circumstances, I was able to &lt;strong&gt;run a useless query&lt;/strong&gt; for the sake of allowing me to return JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the issue in &lt;em&gt;this thread&lt;/em&gt;... The criteria will either return some results, or no results, and it's not possible to tell before allowing the query to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider this scenario...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone uses my endpoint to target the entry with id 42. Assuming entry #42 exists, the endpoint will successfully return data for it. But, if entry #42 has been &lt;strong&gt;deleted or disabled&lt;/strong&gt;, the endpoint doesn't give me the opportunity to return an error message. Instead, it just kicks out a &quot;404 Not Found&quot; error. :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'm looking for &lt;strong&gt;a fallback for when the criteria returns zero results.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-14T19:12:20.657" Title="Element API plugin - Return message when no results are found" Tags="&lt;404&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13179" PostTypeId="1" AcceptedAnswerId="13180" CreationDate="2016-01-12T10:03:14.400" Score="2" ViewCount="836" Body="&lt;p&gt;I want to check if it's winter. What is the best way to write a &quot;between dates&quot; conditional?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set saison = now|date('m-d') %}&#xA;{% if saison (saison &amp;gt;= '11-22' and saison &amp;lt;= '03-21') %}&#xA;  Jep it's winter&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This absolutely does not work.&#xA;I also tried somthing like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set saison = now|date('m-d') %}&#xA;{% if saison &amp;gt; '03-21' %}&#xA;  Now it's Spring&#xA;{% elseif saison &amp;gt; '06-21' %}&#xA;  Now it's Summer&#xA;{% elseif saison &amp;gt; '09-23' %}&#xA;  Now it's Fall&#xA;{% elseif saison &amp;gt; '12-22' %}&#xA;  Now it's Winter&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That doesn't work. I guess because twig doesn't recognize the strings as dates?&#xA;How do I have to write this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-05-24T12:26:38.957" Title="If date is between conditional" Tags="&lt;datetime&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13180" PostTypeId="2" ParentId="13179" CreationDate="2016-01-12T11:18:11.533" Score="4" Body="&lt;p&gt;This conditional should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Saison Trigger #}&#xA;{% set saison = now|date('m-d') %}&#xA;&#xA;{# Check for each Season #}&#xA;{% if saison &amp;gt; '11-22' or saison &amp;lt;= '03-21' %}&#xA;    {% set currentSaison = 'winter' %}&#xA;{% elseif saison &amp;gt; '03-21' and saison &amp;lt;= '06-21' %}&#xA;    {% set currentSaison = 'fruehling' %}&#xA;{% elseif saison &amp;gt; '06-21' and saison &amp;lt;= '09-22' %}&#xA;    {% set currentSaison = 'sommer' %}&#xA;{% elseif saison &amp;gt; '09-22' and saison &amp;lt;= '11-22' %}&#xA;    {% set currentSaison = 'herbst' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're right, Twig does just compare the strings. But this is totally fine in this case. A string representing a date and formatted like so &quot;01-13&quot; (don't forget the leading zero) works nicely with the comparison operators.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="162" LastEditDate="2016-05-24T12:26:38.957" LastActivityDate="2016-05-24T12:26:38.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13181" PostTypeId="2" ParentId="3076" CreationDate="2016-01-12T11:23:14.347" Score="3" Body="&lt;p&gt;I had a similar problem with disappearing fields in the admin interface, and found it seemed to be something to do with the xdebug PHP extension. Disabling that fixed the problem and the fields reappeared:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo php5dismod xdebug&#xA;sudo service apache2 restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem in this case is actually to do with reaching a nesting limit, so if you do want to use xdebug, an alternate fix is to bump up the max nesting limit in xdebug's ini file (or php.ini), eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level=200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-01-12T11:23:14.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13182" PostTypeId="1" AcceptedAnswerId="13204" CreationDate="2016-01-12T11:29:28.630" Score="2" ViewCount="100" Body="&lt;p&gt;I ask this in the context of a sharing content site, let's say a forum.&#xA;This doesn't seem to be a recommended practice, and I wish to know if there is a particular reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plan to let non staff, but registered site visitors to access the CP, to post content in specific allowed categories of my site. Access to the cp is a HUGE time saver: user can post entries, with all the CSS/JS work done, which means that they can benefit from autocomplete tags and all the goodies from the CP. They can see a list of all their entries, edit them etc etc....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why should I bother doing custom forms if all can be done with CP access ? Any reason ? &#xA;I don't believe there is a security concern since the CMS allows very precise control of permissions and what user in a group can do in the CP.&lt;/p&gt;&#xA;" OwnerUserId="4583" LastActivityDate="2016-01-13T17:46:31.770" Title="Allowing non staff users to access CP to post and edit posts?" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13183" PostTypeId="2" ParentId="12842" CreationDate="2016-01-12T12:40:13.450" Score="4" Body="&lt;p&gt;I just found the following in the updated docs for the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/keypress/#setting-enterKey&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;enterKey&lt;/code&gt; setting&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;enterKey — This setting allows to prevent use of Return key.&#xA;  With this set to 'false' and pastePlainText is set to true, line breaks will be replaced by spaces.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So make sure you are on Craft 2.5.2757, as it includes &lt;a href=&quot;https://imperavi.com/redactor/log&quot; rel=&quot;nofollow&quot;&gt;Redactor II 1.2&lt;/a&gt; which has got the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/paste/&quot; rel=&quot;nofollow&quot;&gt;new paste settings&lt;/a&gt; and try this Redactor config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;enterKey&quot;: false,&#xA;&quot;pastePlainText&quot;: true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Redactor II deprecated the &lt;code&gt;paragraphize&lt;/code&gt; setting, but as noted in the comments, it's easy to remove HTML tags with the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;striptags&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ asset.caption|striptags('&amp;lt;em&amp;gt;&amp;lt;strong&amp;gt;')|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Every tag listed in the param string is whitelisted and won't get removed.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-19T19:26:00.027" LastActivityDate="2016-02-19T19:26:00.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13184" PostTypeId="2" ParentId="13166" CreationDate="2016-01-12T13:04:53.373" Score="2" Body="&lt;p&gt;I guess with Redactor II you &quot;manually&quot; have to make sure you cannot create those tags with buttons/shortcuts or by pasting in rich text.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Button configuration works with the &lt;code&gt;formatting&lt;/code&gt; and &lt;code&gt;formattingAdd&lt;/code&gt; settings.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/paste/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Paste config settings&lt;/a&gt; were added with Redactor II 1.2 (Craft 2.bla), the ones you're probably interested in are &lt;code&gt;pasteBlockTags&lt;/code&gt; and &lt;code&gt;pasteInlineTags&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Redactor II deprecated the &lt;code&gt;paragraphize&lt;/code&gt; setting and automatically wraps each paragraph in &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags. If you also want to prevent &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags, removing them on a template level using a Twig filter like &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;striptags&lt;/code&gt;&lt;/a&gt; is probably your best bet at the moment (→ see &lt;a href=&quot;https://craftcms.stackexchange.com/a/13183/125&quot;&gt;Redactor II Craft 2.5 Prevent Paragraphs&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-12T13:04:53.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13185" PostTypeId="1" AcceptedAnswerId="13199" CreationDate="2016-01-12T16:08:58.250" Score="1" ViewCount="434" Body="&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event)&#xA;{&#xA;    // entry slug, will be used as image name&#xA;    $EntryTitle = $event-&amp;gt;params['entry']['slug'];&#xA;&#xA;    // Get attached image&#xA;    $entry = $event-&amp;gt;params['entry']['imgdir'][0];&#xA;&#xA;    craft()-&amp;gt;assets-&amp;gt;renameFile($entry, $EntryTitle);&#xA;    $entry-&amp;gt;setAttribute('filename', $EntryTitle);&#xA;    craft()-&amp;gt;assets-&amp;gt;storeFile($entry);&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This &lt;code&gt;init()&lt;/code&gt; code gets the current entry title right after it was saved, and is supposed to use it to rename an attached file.&#xA;I used a method given by another developer in the context of a saveAsset, but it doesn't seem to work in this new context (→ see &lt;a href=&quot;https://craftcms.stackexchange.com/q/13154/125&quot;&gt;Change asset name on upload&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure i've set the &lt;code&gt;$entry&lt;/code&gt; variable to correct data. Fact is I'm able trough the path you see above, to get access to the asset. &#xA;Please tell me where this code is wrong.&lt;/p&gt;&#xA;" OwnerUserId="4583" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2018-09-06T18:40:39.527" Title="Rename a file using onSaveEntry event" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13186" PostTypeId="1" AcceptedAnswerId="13191" CreationDate="2016-01-12T16:19:05.417" Score="1" ViewCount="159" Body="&lt;p&gt;In the Sprout Forms plugin, is there a way to modify the EntryModel through sproutForms.onBeforeSaveEntry? I have a plugin that sends a cURL request onBeforeSaveEntry, and I'd like to grab the response from that and deliver it to the user on the thank you page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting new properties on the $event object but I'm getting errors, so maybe my approach is wrong? Been searching, but unable to find how to get it done. &lt;/p&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2016-01-12T21:34:19.973" Title="Sprout Forms: Modify Entry" Tags="&lt;plugins&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13187" PostTypeId="1" AcceptedAnswerId="13188" CreationDate="2016-01-12T16:32:24.280" Score="2" ViewCount="887" Body="&lt;p&gt;I have a separate Craft install that I am using to communicate to a few different sites. I have a front-end form on another one of these sites (a React.js app) that is looking to post back to this initial Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My form looks pretty standard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; onSubmit={this.handleSubmit}&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;/&amp;gt;&#xA;&#xA;    &amp;lt;input id=&quot;name&quot; type=&quot;text&quot; name=&quot;fields[name]&quot; required /&amp;gt;&#xA;    &amp;lt;input id=&quot;userEmail&quot; type=&quot;email&quot; name=&quot;fields[userEmail]&quot; required/&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;handleSubmit()&lt;/code&gt; also looks exactly the same as the docs for &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#ajax-form-submissions&quot; rel=&quot;nofollow&quot;&gt;ContactFormEntries&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;handleSubmit(event){&#xA;    event.preventDefault();&#xA;&#xA;    var data = $('form').serialize();&#xA;&#xA;    $.post(config.default.apiUrl, data, function(response){&#xA;        if(response.success){&#xA;            $('body').addClass('success');&#xA;        }&#xA;        else{&#xA;            alert('Sorry, there was an error with your submission. Please validate your submission or try again later.');&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;where &lt;code&gt;config.default.apiUrl&lt;/code&gt; = the root url for my Craft app.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My data goes through as a POST request (&lt;code&gt;302 Found&lt;/code&gt;) followed by an immediate GET request of &lt;code&gt;'/'&lt;/code&gt; (&lt;code&gt;200 OK&lt;/code&gt;) where &lt;code&gt;response&lt;/code&gt; is the markup from the root of the Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The kicker is that the data is saved in the database correctly, but the &lt;code&gt;response&lt;/code&gt; (and the subsequent GET request) isn't really what I'm looking for. I'd love for it return with a proper &lt;code&gt;json&lt;/code&gt; response. I've attempted to include a redirect parameter, but the result is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I am missing in my ajax request that would throw this off? &lt;/p&gt;&#xA;" OwnerUserId="218" LastEditorUserId="218" LastEditDate="2016-01-13T15:08:00.070" LastActivityDate="2016-01-13T15:08:00.070" Title="Ajax Post to guestEntries/saveEntries from another domain" Tags="&lt;ajax&gt;&lt;guest-entries&gt;&lt;apache&gt;&lt;post&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13188" PostTypeId="2" ParentId="13187" CreationDate="2016-01-12T18:38:48.050" Score="4" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: Turns out this was an issue with my apache config on the Craft instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;: I did a little digging around the GuestEntriesController.php file and noticed that Craft was not picking up that my POST was coming from an ajax request. After looking into that more I manually added the ajax header to my post request: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    url: config.default.apiUrl,&#xA;    type: 'POST',&#xA;    data: data,&#xA;    headers: {'X-Requested-With': 'XMLHttpRequest'}&#xA;}).done(function(){ ... });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This got me a little closer, but now on request I was getting hit with this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers in preflight response.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That led me to a simple Google search that had the answer in &lt;a href=&quot;https://stackoverflow.com/questions/12630231/how-do-cors-and-access-control-allow-headers-work&quot;&gt;another Stack Overflow question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my Craft App's &lt;code&gt;.htaccess&lt;/code&gt; file I added in the following 2 headers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header set Access-Control-Allow-Origin &quot;*&quot;&#xA;Header set Access-Control-Allow-Headers &quot;X-Requested-With, Content-Type&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now my POST request from another server fires fine, and Craft returns with a successful &lt;code&gt;json&lt;/code&gt; response.&lt;/p&gt;&#xA;" OwnerUserId="218" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-01-12T18:38:48.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13189" PostTypeId="2" ParentId="13175" CreationDate="2016-01-12T19:51:26.013" Score="1" Body="&lt;p&gt;I had this same issue and resolved by fixing my Redactor configs. If you have a misconfigured file or a formatting error it causes problems related to rendering later in the page, likely related to Redactor throwing a javascript error.&lt;/p&gt;&#xA;" OwnerUserId="454" LastEditorUserId="454" LastEditDate="2016-01-12T20:01:10.783" LastActivityDate="2016-01-12T20:01:10.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13190" PostTypeId="1" AcceptedAnswerId="13198" CreationDate="2016-01-12T20:27:20.077" Score="2" ViewCount="1715" Body="&lt;p&gt;I have a relatively simple structure for products that I am building an advanced search for. I access the products using &lt;code&gt;craft.entries.section('products')&lt;/code&gt;, but these products have fields with options for those fields within them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, how do I access these? This is my attempt so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set parameters=&#xA;            {&#xA;                section: 'products',&#xA;                limit: '1'&#xA;            }&#xA;        %}&#xA;&#xA;        {% set query = craft.request.getParam('entry') %}&#xA;&#xA;        {% if query %}&#xA;            {% set entries = craft.entries(parameters).relatedTo(query).order('score') %}&#xA;        {% else %}&#xA;            {% set entries = craft.entries(parameters) %}&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know this is incorrect, because I need to look at an object within an object within products and check a field belonging it. For instance, if the product was a phone, it would have something like &quot;mobilityOptions&quot; and under that would be &quot;Cordless&quot;, &quot;Desk&quot;, and &quot;Wall&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My search form has got those mobility options through a for option in products loop of the section, followed by a for block in &lt;code&gt;option.mobilityOptions.options&lt;/code&gt; that then makes checkboxes for each option, but to use it with the &quot;.relatedTo&quot; functionality I don't think it would work.&lt;/p&gt;&#xA;" OwnerUserId="4592" LastEditorUserId="125" LastEditDate="2016-01-13T12:13:41.013" LastActivityDate="2016-01-16T18:14:52.833" Title="Search against a checkboxes field's options" Tags="&lt;entries&gt;&lt;search&gt;&lt;checkboxes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13191" PostTypeId="2" ParentId="13186" CreationDate="2016-01-12T21:34:19.973" Score="2" Body="&lt;p&gt;So it turns out you can modify an existing property like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;existingProperty = 'new value';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I ended up doing was using a hidden field and then updating the value of that from the sproutForms.onBeforeSaveEntry event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('sproutForms.onBeforeSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $entry-&amp;gt;getContent()-&amp;gt;subscribeStatus = 'success';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since that property can be set depending on what the response is from the cURL post, it's possible to deliver success/error messages to users on the thank you page and prevent the subscribe from silently failing in the background.&lt;/p&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2016-01-12T21:34:19.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13192" PostTypeId="1" AcceptedAnswerId="13193" CreationDate="2016-01-12T23:25:03.140" Score="8" ViewCount="405" Body="&lt;p&gt;I'm trying to figure out how to do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Person registers as new user&lt;/li&gt;&#xA;&lt;li&gt;User creates a new entry with a front-end entry form&lt;/li&gt;&#xA;&lt;li&gt;Entry is saved as disabled so it's not publicly visible&lt;/li&gt;&#xA;&lt;li&gt;User has the option to make entry public by making a payment with Craft Commerce.&lt;/li&gt;&#xA;&lt;li&gt;When the Craft order is complete it updates the entry in step 3 to enabled so that is will be publicly visible.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think I should be able to use this event &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;noreferrer&quot;&gt;commerce_orders.onOrderComplete&lt;/a&gt; but I'm not sure how to pass the entry ID into this event and also how to check if the order that has just been completed is the order that applies to this event checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="3951" LastEditorUserId="57" LastEditDate="2016-01-13T03:33:20.637" LastActivityDate="2016-01-13T03:33:20.637" Title="Using Commerce to pay for posting entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;frontend&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13193" PostTypeId="2" ParentId="13192" CreationDate="2016-01-13T00:45:50.223" Score="11" Body="&lt;p&gt;You will need to write a plugin with three responsibilities:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Keep track of which entries have been purchased&lt;/li&gt;&#xA;&lt;li&gt;Set an entry to enabled when it has been purchased&lt;/li&gt;&#xA;&lt;li&gt;Ensure that entries always have the correct status (enabled/disabled) whenever they are saved&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the first one, you will need to create a new DB table that can store records of which entries have been purchased.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugin, create a &lt;code&gt;records/&lt;/code&gt; table with a &lt;code&gt;MyPlugin_EntryPurchaseRecord.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_EntryPurchaseRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'myplugin_entrypurchases';&#xA;    }&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'entry' =&amp;gt; array(static::BELONGS_TO, 'EntryRecord'),&#xA;            'order' =&amp;gt; array(static::BELONGS_TO, 'Commerce_OrderRecord'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place, the table will automatically get created when you install your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, give your primary plugin class an &lt;code&gt;init()&lt;/code&gt; method where you can set up some event listeners:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPluginPlugin extends BasePlugin&#xA;{&#xA;    // ...&#xA;&#xA;    public function init()&#xA;    {&#xA;        craft()-&amp;gt;on('commerce_orders.orderComplete', array($this, 'onOrderComplete'));&#xA;        craft()-&amp;gt;on('entries.beforeSaveEntry', array($this, 'onBeforeSaveEntry'));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;onOrderComplete&lt;/code&gt; function will be responsible for recording the purchase in your entrypurchases table, and updating the entry’s status to enabled:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function onOrderComplete(Event $event)&#xA;{&#xA;    /* @var Commerce_OrderModel $order */&#xA;    $order = $event-&amp;gt;params['order'];&#xA;&#xA;    // Look for a line item with an entryId option&#xA;    foreach ($order-&amp;gt;lineItems as $lineItem)&#xA;    {&#xA;        if (!empty($lineItem-&amp;gt;options['entryId']))&#xA;        {&#xA;            // Validate the entry ID&#xA;            $entryId = $lineItem-&amp;gt;options['entryId'];&#xA;            $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;            if (!$entry) continue;&#xA;&#xA;            // Record the purchase&#xA;            $purchaseRecord = new MyPlugin_EntryPurchaseRecord();&#xA;            $purchaseRecord-&amp;gt;entryId = $entryId;&#xA;            $purchaseRecord-&amp;gt;orderId = $order-&amp;gt;id;&#xA;            $purchaseRecord-&amp;gt;save();&#xA;&#xA;            // Enable the entry&#xA;            $entry-&amp;gt;enabled = true;&#xA;            craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; function will be responsible for making sure entries’ statuses are set correctly depending on whether they’ve been purchased:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function onBeforeSaveEntry(Event $event)&#xA;{&#xA;    // Ignore for new entries&#xA;    if (!empty($event-&amp;gt;params['isNewEntry']))&#xA;    {&#xA;        return;&#xA;    }&#xA;&#xA;    /* @var EntryModel $entry */&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    // Ignore entries in other sections&#xA;    if ($entry-&amp;gt;section-&amp;gt;handle != 'mySection')&#xA;    {&#xA;        return;&#xA;    }&#xA;&#xA;    // Has the entry been purchased?&#xA;    $purchaseCount = MyPlugin_EntryPurchaseRecord::model()-&amp;gt;countByAttributes(array(&#xA;        'entryId' =&amp;gt; $entry-&amp;gt;id&#xA;    ));&#xA;&#xA;    $entry-&amp;gt;enabled = ($purchaseCount != 0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Last but not least, you will need to update your entry purchase form to record the entry ID being purchased. We’ll do that as an &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#purchasable-options-and-notes&quot;&gt;option&lt;/a&gt; on the line item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you look at the &lt;code&gt;onOrderComplete&lt;/code&gt; function, we’re actually combing through the purchased order’s line items to look for these &lt;code&gt;entryId&lt;/code&gt; options. This is where it gets set.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ variant.purchasableId }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- Associate the line item with this entry ID --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;options[entryId]&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Buy Now&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Baring any typos, that should do it!&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-01-13T00:45:50.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13194" PostTypeId="2" ParentId="13177" CreationDate="2016-01-13T08:26:37.393" Score="1" Body="&lt;p&gt;This is definately a sub-optimal workaround, but it might work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have your criteria in the api config fetch something you know is there, and there is only one of - your homepage or a global set (maybe a global set that's called &lt;code&gt;errorMessages&lt;/code&gt;?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then do the normal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'sectionHandle';&#xA;// maybe some more criteria in here&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And return your desired message if &lt;code&gt;$entries&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2016-01-13T08:26:37.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13195" PostTypeId="1" AcceptedAnswerId="13205" CreationDate="2016-01-13T09:46:21.470" Score="0" ViewCount="88" Body="&lt;p&gt;I've built a comment system using Guest Entries. If I set fields to be required and don't fill them in in the front-end, I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Class 'Craft\GuestEntriesEvent' not found in ****/craft/plugins/guestentries/controllers/GuestEntriesController.php on line 136&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New entries are set to disabled by default, I have tried with all fields set to required, and with only certain fields set to required.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-01-13T20:25:04.683" Title="Guest Entries required fields fatal error" Tags="&lt;guest-entries&gt;&lt;comments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13197" PostTypeId="2" ParentId="13136" CreationDate="2016-01-13T11:12:18.577" Score="2" Body="&lt;p&gt;I wouldn't want to rely on up-to-date search indexes for this and would rather make use of the &lt;code&gt;relatedTo&lt;/code&gt; parameter instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunatelly it isn't very straightforward to exclude a category (e.g. &lt;code&gt;relatedTo('not 24')&lt;/code&gt; doesn't work), but there's a common workaround&#xA;many Craft devs use in cases like this: collect IDs and query against them (→ see related questions: &lt;a href=&quot;https://craftcms.stackexchange.com/a/10479/125&quot;&gt;Get entries NOT related to categories&lt;/a&gt; or&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4930/125&quot;&gt;How can I select users that are not members of any user groups?&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set leadCategory = craft.categories.group('staffHierarchy').slug('leadership').first() %}&#xA;{% set studCategory = craft.categories.group('staffHierarchy').slug('student').first() %}&#xA;&#xA;{% set alumniCategory = craft.categories.group('staffHierarchy').slug('alumni').first() %}&#xA;&#xA;{% set alumniGroupIds = craft.entries({&#xA;    section: 'people',&#xA;    relatedTo: alumniCategory,&#xA;    limit: null&#xA;}).ids() %}&#xA;&#xA;{% set idParam = 'and, not ' ~ alumniGroupIds|join(', not ') %}&#xA;&#xA;{% set leadGroup = craft.entries({&#xA;    section: 'people',&#xA;    id: idParam,&#xA;    relatedTo: leadCategory,&#xA;    limit: null&#xA;}) %}&#xA;&#xA;{% set studGroup = craft.entries({&#xA;    section: 'people',&#xA;    id: idParam,&#xA;    relatedTo: studCategory,&#xA;    limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-01-13T11:37:03.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13198" PostTypeId="2" ParentId="13190" CreationDate="2016-01-13T11:36:15.770" Score="4" Body="&lt;p&gt;Checkboxes / multiselect fields store to the database in a very query unfriendly way.&#xA;That's why I would really recommend to use categories, tags, lightswitches instead, if you intend to&#xA;query against these fields' values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what you'd have to do to search for entries with selected checkboxes field types' options. You basically have to get all relevant entries first,&#xA;go through them to check each checkbox option and store the element ID in case the entry is valid. Using this approach you end&#xA;up with an array of IDs which you can now query against.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;&#xA;{% set query = craft.request.getQuery() %}&#xA;&#xA;{% if query.mobilityOptions is defined %}&#xA;    {% set ids = [] %}&#xA;&#xA;    {% for entry in entries %}&#xA;        {% set valid = true %}&#xA;&#xA;        {% for option in query.mobilityOptions %}&#xA;            {% if not entry.mobilityOptions.contains(option) %}&#xA;                {% set valid = false %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        {% if valid %}&#xA;            {% set ids = ids|merge([entry.id]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% set entries = craft.entries.id(ids) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-13T11:36:15.770" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13199" PostTypeId="2" ParentId="13185" CreationDate="2016-01-13T12:01:44.500" Score="3" Body="&lt;p&gt;You probably just confused the entry model and the asset model, see if the code below works for you.&#xA;I guess the &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt; event is a better match in this case, and I also added some conditionals to&#xA;only do something for a specific entry section and type, and if there's exactly one asset selected. I hope this helps (code is untested)!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.beforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if (($entry-&amp;gt;section['handle'] == 'friends') &amp;amp;&amp;amp; ($entry-&amp;gt;type['handle'] == 'friends'))&#xA;    {&#xA;        $title = $entry-&amp;gt;slug;&#xA;        $assets = $entry-&amp;gt;imgdir;&#xA;&#xA;        if (count($assets) != 1)&#xA;        {&#xA;            $event-&amp;gt;params['entry']-&amp;gt;addError('imgdir', Craft::t('Exactly 1 asset has to be selected.'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;        else&#xA;        {&#xA;            $filename = $title.'.'.$assets[0]-&amp;gt;getExtension();&#xA;&#xA;            craft()-&amp;gt;assets-&amp;gt;renameFile($assets[0], $filename);&#xA;            craft()-&amp;gt;assets-&amp;gt;storeFile($assets[0]);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-13T14:47:07.067" LastActivityDate="2016-01-13T14:47:07.067" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13200" PostTypeId="1" AcceptedAnswerId="13273" CreationDate="2016-01-13T14:07:56.323" Score="1" ViewCount="181" Body="&lt;p&gt;I have recently migrated an intranet to its production environment, and the requireLogin is misbehaving:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'd go to intranet.example.com/&lt;/li&gt;&#xA;&lt;li&gt;Log in with my details&lt;/li&gt;&#xA;&lt;li&gt;Craft will redirect me to &lt;strong&gt;intranet.example.com/404.shtml&lt;/strong&gt;, showing 'Layout file - This content should not be seen.'&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;this page doesn't exist, and I can't find any reference to 404.shtml on any page. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;If I reload intranet.example.com/, it will show me the homepage, logged in. It works fine after that&lt;/li&gt;&#xA;&lt;li&gt;I can log out and in again, it will work fine. I need to log out, close the browser and log in again to replicate the error&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have no redirects or have changed anything on the Craft config. Basically is a default 2.5 installation with new templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works fine both locally (MAMP) and on my dev environment, but not on the server I just migrated it to. &lt;/p&gt;&#xA;" OwnerUserId="4573" LastActivityDate="2016-01-18T11:22:47.940" Title="Successful login with 'requireLogin' redirects to 404.shtml" Tags="&lt;login&gt;&lt;404&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13201" PostTypeId="1" CreationDate="2016-01-13T16:34:07.460" Score="0" ViewCount="395" Body="&lt;p&gt;My Craft admin panel is running fine locally but when I login remotely my entries aren't there. Do I need to change something in the config file?&lt;/p&gt;&#xA;" OwnerUserId="4186" LastEditorUserId="22" LastEditDate="2016-01-13T19:52:30.493" LastActivityDate="2016-01-13T19:52:30.493" Title="Missing entries in admin panel" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13202" PostTypeId="2" ParentId="13201" CreationDate="2016-01-13T16:42:48.523" Score="3" Body="&lt;p&gt;Are you accessing the same databases? You need to make sure that the local database has been uploaded to the remote server. Then all your entries should show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can back up your local database by going to &lt;code&gt;/admin/settings&lt;/code&gt; on your local machine. Then you'll need to upload that database to the remote server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also learn more about setting up a &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment config&lt;/a&gt; in the Craft documentation.&lt;/p&gt;&#xA;" OwnerUserId="3951" LastActivityDate="2016-01-13T16:42:48.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13203" PostTypeId="1" CreationDate="2016-01-13T17:09:26.093" Score="0" ViewCount="124" Body="&lt;p&gt;Ok all - this is bound to be ridiculously simple, as it's one of the most basic things you can do (&lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt;) - but I am ill and I can not figure out what I've done wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category group 'Things To Do'. That group is set to allow categories in it to have their own URLs. The URL format is: things-to-do/{slug} and it uses the template 'things-to-do/category'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a channel Things To Do, the URL format being 'things-to-do/{slug}' and using a different template 'things-to-do'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to the url for a category that exists, it loads the correct template and I can output the correct fields attached to the category itself; e.g., {{ category.title }} or {{ category.myCustomField }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, trying to output entries related to the category I'm viewing is instead just listing all entries regardless of their lack of association with the category...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thingsToDo = craft.entries.relatedTo(category) %}&#xA;{% for thingToDo in thingsToDo %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should only be listing one entry for a given category, but it's listing all entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have a screwed up?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-01-13T17:19:26.237" LastActivityDate="2016-01-14T09:28:42.613" Title="Category archive page isn't filtering by current category" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13204" PostTypeId="2" ParentId="13182" CreationDate="2016-01-13T17:46:31.770" Score="1" Body="&lt;p&gt;You're right: there's no technical reason why you couldn't do what you're asking. When users start to add content for a site, they're now content contributors. And it can certainly make sense—depending on the site. When I think of &quot;content sharing site&quot;, Craft could be used like a Wiki, for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The short answer?&lt;/strong&gt; If you find yourself reinventing what Craft can already do, just give someone access to the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A longer answer&lt;/strong&gt; and reasons not to do it? Control. User experience. And trust/security all come to mind. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just created a site for a client where individual teachers are able to post their class schedules and such and people are able to buy those classes (via Stripe). The client loved the CP. All the teachers were impressed about how easy it was to add their schedules. The CP was definitely a plus in this area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the client properly scrutinizes everyone who wants to use the site (and their credentials) and there's a training period where we show people how to use the site, where to login, etc.  Your use case might be a little more streamlined if you have computer savvy users, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Craft is straightforward, if not downright intuitive, the CP might be &lt;em&gt;overkill&lt;/em&gt; for someone just casually posting content once in awhile.   There still is a lot going on. And it really depends on what content you're managing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a traditional web context, the CP is a still little &quot;disconnected&quot; from the actual website. You still have to find the page you want to edit, or create a new one, preview it, and publish.  (That's why, IMO, things like &quot;in-place&quot; editors on are still popular with other CMS.... though I hate those things!) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having the CP be disconnected is partially due to security. If you trust and properly vett your authors, or there's not much on the line,  I see no reason why you couldn't open up the backend. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, take good backups in case you have to roll back to something. That's true of any server, though. No software is perfect; if there's a vulnerability found for, say privilege escalation where a user could somehow become an administrator, the more users that have access to the CP, the more chances someone has to breach the site. Craft is relatively niche so you won't have the brute-force drive-bys that something like WordPress has. But as a site administrator, you can never be too vigilant.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-01-13T17:46:31.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13205" PostTypeId="2" ParentId="13195" CreationDate="2016-01-13T20:25:04.683" Score="2" Body="&lt;p&gt;This has been fixed in Guest Entries &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/releases/tag/1.5.1&quot; rel=&quot;nofollow&quot;&gt;1.5.1&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-13T20:25:04.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13207" PostTypeId="1" AcceptedAnswerId="13208" CreationDate="2016-01-13T22:39:42.737" Score="1" ViewCount="400" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;See below updates and accepted answer for a full solution&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I finally discovered &lt;code&gt;postCpLoginRedirect&lt;/code&gt; which solves my needs, even though I only need users to access their profile (which includes lots of custom fields, hopefully we'll have a few more permissions options in future for the cp).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the issue I'm having is I want to redirect to a front-end dashboard which is at &lt;code&gt;{{siteUrl}}counsellors/dashboard&lt;/code&gt;. This page has a &lt;code&gt;{% requireLogin %}&lt;/code&gt; tag which redirects to the &lt;code&gt;cpTrigger&lt;/code&gt;. And, as cp is enabled for default user groups, I understand &lt;code&gt;activateAccountSuccessPath&lt;/code&gt;, &lt;code&gt;postLoginRedirect&lt;/code&gt; are defunct settings.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When logging in from the Craft &lt;code&gt;cpTrigger&lt;/code&gt; the relative link string &lt;code&gt;/counsellors/dashboard&lt;/code&gt; works fine.&lt;/li&gt;&#xA;&lt;li&gt;But when used in combination with the &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; it directs to the wrong path (relative to the admin trigger &lt;code&gt;login/counsellors/dashboard&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ideally I'd like to keep it separate as eventually the CP will be swapped out for a front-end solution, so any clues as to why this is happening? Or what combination of settings are required to fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cpTrigger' =&amp;gt; 'login',&#xA;'postCpLoginRedirect' =&amp;gt; '/counsellors/dashboard',&#xA;'activateAccountSuccessPath' =&amp;gt; '/counsellors/dashboard',&#xA;'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;'loginPath' =&amp;gt; 'login' # Redirect to cp trigger&#xA;// 'postLoginRedirect' =&amp;gt; 'counsellors/dashboard',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Updates 28/01/2016:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you're giving users access to Control Panel &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4106/activateaccountsuccesspath-doesnt-work-as-expected&quot;&gt;&lt;code&gt;activateAccountSuccessPath&lt;/code&gt; won't work, regardless of the path&lt;/a&gt; — &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13416/how-can-i-set-the-activateaccountsuccesspath-for-users-with-control-panel-acce&quot;&gt;a plugin is required to make this happen&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems for now at least, everything has to be built front-end as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13207/postcploginredirect-wrong-redirect-when-used-with-autologinafteraccountactivatio/13208#13208&quot;&gt;@RitterKnight suggests&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A big caveat is, no matter what, if a new registered user has access to the CP, &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; is ignored. You'll &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13416/how-can-i-set-the-activateaccountsuccesspath-for-users-with-control-panel-acce&quot;&gt;need a plugin&lt;/a&gt; to have newly activated accounts forwarded to your success page.&lt;/li&gt;&#xA;&lt;li&gt;Another nice addition is to use the brilliant &lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel Nav plugin&lt;/a&gt; (which really I think should be built into Craft)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you're having users login directly from CP login, you can couple this with &lt;a href=&quot;https://github.com/engram-design/CPNav/issues/17&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;postCpLoginRedirect&lt;/code&gt;&lt;/a&gt; if you want to hide the dashboard from users.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So to recap, full settings are now:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Front end registration, front-end success page, front-end login form, front-end dashboard;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13416/how-can-i-set-the-activateaccountsuccesspath-for-users-with-control-panel-acce&quot;&gt;A plugin to enforce&lt;/a&gt; &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; settings&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel Nav plugin&lt;/a&gt; with a link to the custom dashboard;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The following config settings:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;'loginPath' =&amp;gt; 'counsellors/login',&#xA;'activateAccountSuccessPath' =&amp;gt; 'counsellors/success',&#xA;// 'autoLoginAfterAccountActivation' =&amp;gt; true, # Doesn't work&#xA;// 'postCpLoginRedirect' =&amp;gt; 'myaccount#profile', # Optional&#xA;'postLoginRedirect' =&amp;gt; 'counsellors/dashboard',&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-01-28T20:24:15.830" Title="postCpLoginRedirect wrong redirect when used with autoLoginAfterAccountActivation" Tags="&lt;control-panel&gt;&lt;form&gt;&lt;login&gt;&lt;settings&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13208" PostTypeId="2" ParentId="13207" CreationDate="2016-01-14T00:14:44.400" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Ideally I'd like to keep it separate as eventually the CP will be swapped out for a front-end solution, so any clues as to why this is happening? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think you're close.  Just so we're on the same plane, you're using the CP for users to edit their profiles but everything else is on the front end? Do you have a front end login form already setup? If not, get one setup at &lt;code&gt;counsellors/login&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't set your &lt;a href=&quot;https://craftcms.com/docs/config-settings#cpTrigger&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cpTrigger&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#loginPath&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;loginPath&lt;/code&gt;&lt;/a&gt; to the same values if you intend to keep the front and back end logins separate to begin with. That's issue number 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front end, you probably want to set &lt;code&gt;loginPath&lt;/code&gt; to something like &lt;code&gt;counsellors/login&lt;/code&gt; and you'll want to obviously uncomment your &lt;code&gt;postLoginRedirect&lt;/code&gt; to &lt;code&gt;counsellors/dashboard&lt;/code&gt; so after they login, they'll get shuttled off to that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set  &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; to something like something like &lt;code&gt;members/activation-success&lt;/code&gt; and then in that template,  you can do whatever you want there, either link back to the CP with a hyperlink so users can &quot;finish&quot; their profiles or use Craft's &lt;code&gt;{% redirect %}&lt;/code&gt; code to send them to the CP.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-01-14T00:14:44.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13209" PostTypeId="2" ParentId="11661" CreationDate="2016-01-14T01:29:34.887" Score="3" Body="&lt;p&gt;I'm not completely sure of the technical reasons (I guess something to do with relation fields not have a column in the &lt;code&gt;craft_content&lt;/code&gt; table), but you also need to re-save the existing ids for any relation fields (Assets, Entries, Categories, Matrix, etc) before the element can be saved:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'metaStatus'  =&amp;gt; 'Declined',&#xA;    'assetsField' =&amp;gt; $entry-&amp;gt;assetsField-&amp;gt;ids(),&#xA;    'matrixField' =&amp;gt; $entry-&amp;gt;matrixField-&amp;gt;ids(),&#xA;);&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-01-14T01:29:34.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13210" PostTypeId="2" ParentId="11661" CreationDate="2016-01-14T03:29:19.220" Score="6" Body="&lt;p&gt;I got around this issue by looping through all fields that were of BaseElementFieldType re-setting them to their current value.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$fields = $entry-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&#xA;$referentialFields = array();&#xA;foreach ($fields as $layoutField) {&#xA;  $field = $layoutField-&amp;gt;getField();&#xA;  if ($field-&amp;gt;getFieldType() instanceof BaseElementFieldType) {&#xA;    $referentialFields[$field-&amp;gt;handle] = $entry-&amp;gt;{$field-&amp;gt;handle}-&amp;gt;ids();&#xA;  }&#xA;}&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array_merge($referentialFields, array(&#xA;  'yourField' =&amp;gt; 'yourValue'&#xA;)));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4597" LastActivityDate="2016-01-14T03:29:19.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13211" PostTypeId="1" CreationDate="2016-01-14T04:24:28.113" Score="0" ViewCount="562" Body="&lt;p&gt;I'm trying to sort the entries. Is there a way to do this without using the filters given? Can this be done manually?&lt;/p&gt;&#xA;" OwnerUserId="4186" LastActivityDate="2016-01-14T10:10:38.150" Title="Organize Entries in Admin Panel" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13212" PostTypeId="2" ParentId="13203" CreationDate="2016-01-14T09:28:42.613" Score="2" Body="&lt;p&gt;Mystery solved; the relation code was too general; some of the entries were related to the category &lt;em&gt;on the homepage&lt;/em&gt;, and the example code doesn't care about how or where the entries are related to the category as long as they are somewhere somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I needed to be more specific:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thingsToDo = craft.entries.relatedTo({&#xA;    targetElement: category,&#xA;    field: 'typeOfThing'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-01-14T09:28:42.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13213" PostTypeId="2" ParentId="13211" CreationDate="2016-01-14T10:10:38.150" Score="2" Body="&lt;p&gt;Are you wanting to drag entries up and down to sort them? As far as I'm aware the only way to order manually would be to use a Structure and not a Channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively if you just want to manually order them for use in a for loop (such as showing news items), you could add an entries field somewhere (in a global, a news page, a homepage, or somewhere else convenient). Then you can reference that list for your entries output. That would let you manually order them.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-01-14T10:10:38.150" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="13214" PostTypeId="1" AcceptedAnswerId="13216" CreationDate="2016-01-14T10:21:59.033" Score="4" ViewCount="941" Body="&lt;p&gt;Is there a way in Craft to get the order property of the current entry when it's in a structure? For example say you have the following structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent Page&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Child One&lt;/li&gt;&#xA;&lt;li&gt;Child Two&lt;/li&gt;&#xA;&lt;li&gt;Child Three&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get what order property Child Two is in relation to its siblings so in this case it would be 1 (zero based)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my templates I am wanting to be able to grab the order property for the current entry by doing something like &lt;code&gt;{{ entry.getOrder() }}&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2016-01-14T10:47:35.347" LastActivityDate="2016-01-14T11:03:30.447" Title="How to get the order number of the current entry in a structure" Tags="&lt;entrymodel&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13215" PostTypeId="1" AcceptedAnswerId="13256" CreationDate="2016-01-14T10:27:18.280" Score="0" ViewCount="250" Body="&lt;p&gt;I've tried to set some things in my general.php config file but they're being ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following but all are being ignored. For example, when the user receives the activation email, upon clicking the link the account is activated but they're not taken to my template 'user/activation-success' but instead the homepage and also not automatically logged in, like I'm setting. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'setPasswordPath' =&amp;gt; 'user/set-password',&#xA;    'activateAccountSuccessPath' =&amp;gt; 'user/activation-success',&#xA;    'autoLoginAfterAccountActivation' =&amp;gt; true&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm running 2.5.2757.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated to show my full config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'setPasswordPath' =&amp;gt; 'user/set-password',&#xA;    'activateAccountSuccessPath' =&amp;gt; 'user/activation-success',&#xA;    'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;&#xA;    '.local' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'userSessionDuration' =&amp;gt; false&#xA;    ),&#xA;&#xA;    '.co.uk' =&amp;gt; array(&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3830" LastEditorUserId="57" LastEditDate="2016-01-16T05:57:44.837" LastActivityDate="2016-01-17T05:09:34.460" Title="Some paths and settings being ignored in config" Tags="&lt;templating&gt;&lt;users&gt;&lt;config&gt;&lt;activation&gt;&lt;member&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13216" PostTypeId="2" ParentId="13214" CreationDate="2016-01-14T10:47:26.980" Score="7" Body="&lt;p&gt;There's a &lt;code&gt;positionedBefore&lt;/code&gt; parameter for &lt;code&gt;craft.entries&lt;/code&gt;. Use this with a criteria model filtered to&#xA;show the entries you are interested in only.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = entry.getParent() %}&#xA;{% set siblingsIds = parent.getChildren().ids() %}&#xA;&#xA;{% set positionedBefore = craft.entries({&#xA;    id: siblingsIds,&#xA;    order: 'lft desc',&#xA;    positionedBefore: entry,&#xA;}).total() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the first two lines I'm getting the IDs of all of the entry's siblings. I then prepare a &lt;code&gt;craft.entries&lt;/code&gt; criteria model using the siblings' IDs with the &lt;code&gt;id&lt;/code&gt; parameter to query just for those entries, order them by &lt;code&gt;lft&lt;/code&gt; in descending order (that's the db column Craft stores position info) and further filter with &lt;code&gt;positionedBefore&lt;/code&gt; to get just the entries before &lt;code&gt;entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling the &lt;code&gt;total&lt;/code&gt; method returns the number of entries found.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-14T11:03:30.447" LastActivityDate="2016-01-14T11:03:30.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13217" PostTypeId="1" CreationDate="2016-01-14T11:41:48.403" Score="2" ViewCount="331" Body="&lt;p&gt;I'm a Craft newbie, just searching for something and spotted this related post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2376/search-order-score-criteria/13160?noredirect=1#comment17925_13160&quot;&gt;Search order &amp;quot;Score&amp;quot; criteria&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to know, is there a way to add a Modifier value to a field, like LOW Search does for EE?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example; lets imagine we want trees listed first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would add a 'keyword' field, and a modifier value too help ensure a far higher score than any other fields, possibly including the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So an entry with the words 'Top Trees' in our 'keyword' field would trump all other entries containing the words 'Top Trees'.&lt;/p&gt;&#xA;" OwnerUserId="4085" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-02-13T18:31:30.753" Title="Modifying the search order “Score” criteria" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13218" PostTypeId="1" AcceptedAnswerId="13230" CreationDate="2016-01-14T12:25:23.573" Score="1" ViewCount="1736" Body="&lt;p&gt;I'm using Feedme to add entries via an external JSON feed.&#xA;There was an issue with matching duplicates and now need to remove &gt;4000 entries from the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid further issues would ideally like to build this into the feedme script we are running but the built-in delete method times out due to memory issues. I've looked at other ways we can achieve this, eg by deleting via the entries model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entriesRecord = EntryRecord::model()-&amp;gt;findAllByAttributes(array('sectionId' =&amp;gt; $sectionId));&#xA;$entriesRecord-&amp;gt;delete();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is also timing out. Mike Pepper pointed me in the direction of the &lt;code&gt;a&amp;amp;m command&lt;/code&gt; add-on at &lt;a href=&quot;https://github.com/am-impact/amcommand&quot; rel=&quot;nofollow&quot;&gt;https://github.com/am-impact/amcommand&lt;/a&gt; but this is also struggling. Is the only way to deal with such large quantities of entries to do this directly via SQL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help!&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="9" LastEditDate="2016-02-03T18:07:04.870" LastActivityDate="2020-01-29T15:23:19.843" Title="Deleting all entries from a Section" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13219" PostTypeId="1" AcceptedAnswerId="13220" CreationDate="2016-01-14T12:41:55.247" Score="2" ViewCount="167" Body="&lt;p&gt;Is it possible to set the postDate for a new (disabled) entry created using the GuestEntries plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise when posting a GuestEntry the postDate is not set until the entry is enabled or re-saved from Craft.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Posting this with an answer as it may be useful to other people. If there are better ways to do this please add them.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-01-14T12:41:55.247" Title="Adding a postDate with Guest Entries" Tags="&lt;guest-entries&gt;&lt;postdate&gt;&lt;comments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13220" PostTypeId="2" ParentId="13219" CreationDate="2016-01-14T12:41:55.247" Score="3" Body="&lt;p&gt;You can add a hidden field for your postDate to your GuestEntry form, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;postDate&quot; value=&quot;{{ now|date(&quot;Y-m-j H:i:s&quot;) }}&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This adds the postDate using Craft's &lt;code&gt;YYYY-MM-DD HH:MM:SS&lt;/code&gt; format.&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-01-14T12:41:55.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13221" PostTypeId="1" CreationDate="2016-01-14T15:20:07.540" Score="0" ViewCount="341" Body="&lt;p&gt;I'm just wondering here if something like this is possible. On a website I'm working on for a photographer, he's in need of carefully selecting focal points on his images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of the focal point plugin, but that is connected to the assets file itself. And not the entry. So basically what I'm asking is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upload the full source image to assets &lt;/li&gt;&#xA;&lt;li&gt;On an entry, select this&#xA;image&lt;/li&gt;&#xA;&lt;li&gt;Have a separate field with a GUI control of the cropping of&#xA;selected image from point 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Save the entry. And Craft takes those parameters and generates the new image and puts it in the destination folder. So the new cropped image is not in Assets at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this need is because the photographer wants full control of the focal points of each image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TLDR:&#xA;Is it possible to a use something similar to &lt;a href=&quot;https://github.com/engram-design/ImageResizer#cropping&quot; rel=&quot;nofollow&quot;&gt;this gui control&lt;/a&gt; on a field where an image has been selected, instead of having it directly on the assets file?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastActivityDate="2016-03-17T15:01:45.530" Title="GUI Crop image field - Plugin request" Tags="&lt;plugins&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13222" PostTypeId="1" CreationDate="2016-01-14T15:42:33.633" Score="2" ViewCount="398" Body="&lt;p&gt;I have an entry form to take user generated content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section it passes the info to has a customised title format &lt;code&gt;Submission ID: {id}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the entry gets submitted, the title in the CP (and indeed in the templates) just show as &lt;code&gt;Submission ID:&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not until the entry is re-saved at the control panel level (although I haven't tried a front end edit form) that the appropriate id shows e.g. &lt;code&gt;Submission ID: 12465&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-02-13T22:31:33.973" Title="Assign entry id to title with entry form" Tags="&lt;entries&gt;&lt;form&gt;&lt;entry&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13223" PostTypeId="1" AcceptedAnswerId="13228" CreationDate="2016-01-14T16:21:38.523" Score="0" ViewCount="1393" Body="&lt;p&gt;On attempting to login into either a front-end account or admin account I'm hit by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;400 Bad Request&lt;br&gt;&#xA;Request Header Or Cookie Too Large&lt;br&gt;&#xA;nginx/1.8.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's only happened recently but running the latest Craft CMS v2.5.2757 and from looking at the cookies created during login I think it's possibly related to CSRF protection as deleting the top cookie in the list below fixes the issue until you log in again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DPjKR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DPjKR.png&quot; alt=&quot;Google Console Log&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running a few other Craft sites on the same staging nGinx server without the same issue, and even the same codebase is running another site without issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts please?!&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2016-01-14T18:29:45.477" Title="400 Bad Request on account or admin login" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13224" PostTypeId="1" CreationDate="2016-01-14T16:24:11.737" Score="2" ViewCount="239" Body="&lt;p&gt;I'm trying to override a Sprout Forms email notification template. The example template loops over tabs and fields and outputs them all, that works. I'd like to manually reference specific fields in specific places (like first_name). How can I reach the field values?&lt;/p&gt;&#xA;" OwnerUserId="3427" LastActivityDate="2016-01-15T09:29:03.043" Title="How can I output a specific field in Sprout Forms email notifications?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13225" PostTypeId="1" AcceptedAnswerId="13285" CreationDate="2016-01-14T17:04:50.440" Score="0" ViewCount="404" Body="&lt;p&gt;I'm having issues saving an Asset field in my &lt;em&gt;FEEF&lt;/em&gt; using a Plugin. I have a channel with some fields added to it, one of these fields being an Asset field. When using the standard &lt;strong&gt;entries/saveEntry&lt;/strong&gt; build in function in Craft the Asset gets saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to run the same form (same channel, same field) through my Plugin everything saves except the Asset field asset. The code I'm using (below) is a slightly changed version of Pixel&amp;amp;Tonics own &quot;&lt;em&gt;Guest Entries&lt;/em&gt;&quot; Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to figure out whats going on?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Populates an EntryModel with post data.&#xA; *&#xA; * @access private&#xA; * @throws HttpException&#xA; * @return EntryModel&#xA; */&#xA;private function _populateEntryModel()&#xA;{&#xA;    $entry = new EntryModel();&#xA;&#xA;    // Set section&#xA;    $entry-&amp;gt;sectionId   = craft()-&amp;gt;request-&amp;gt;getRequiredPost('sectionId');&#xA;    $this-&amp;gt;_section     = craft()-&amp;gt;sections-&amp;gt;getSectionById($entry-&amp;gt;sectionId);&#xA;    $this-&amp;gt;_entryTypeId = craft()-&amp;gt;request-&amp;gt;getPost('entryTypeId');&#xA;&#xA;    // Default&#xA;    $entry-&amp;gt;authorId    = 1;&#xA;    $entry-&amp;gt;enabled     = true;&#xA;&#xA;    // Set title&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = craft()-&amp;gt;request-&amp;gt;getPost('title');&#xA;&#xA;    // Set Entry type&#xA;    if($this-&amp;gt;_entryTypeId)&#xA;    {&#xA;        $entry-&amp;gt;typeId = $this-&amp;gt;_entryTypeId;&#xA;    }&#xA;&#xA;    // Add dynamic fields&#xA;    $entry-&amp;gt;setContentFromPost(craft()-&amp;gt;request-&amp;gt;getParam('fields'));&#xA;&#xA;    // Return model&#xA;    return $entry;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how my form looks (I've removed some styling and keept the essentials)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- Hidden --&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;forms/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.url }}?sent=1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;13&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryTypeId&quot; value=&quot;18&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; class=&quot;title&quot; value=&quot;&quot;/&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[formName]&quot; value=&quot;{% if formEntry.formName is defined %}{{ formEntry.formName }}{% endif %}&quot; class=&quot;default-field name&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[formConfirmationNumber]&quot; value=&quot;{% if formEntry.formConfirmationNumber is defined %}{{ formEntry.formConfirmationNumber }}{% endif %}&quot; class=&quot;default-field&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[formRoom]&quot; value=&quot;{% if formEntry.formRoom is defined %}{{ formEntry.formRoom }}{% endif %}&quot; class=&quot;default-field&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;file&quot; name=&quot;fields[formFile]&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The name=&quot;title&quot; field gets set dynamic...&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="297" LastEditDate="2016-01-16T06:58:52.263" LastActivityDate="2016-01-18T22:16:54.180" Title="Saving Asset field in FEEF (&quot;Front-end entry form&quot;) using Plugin" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13226" PostTypeId="2" ParentId="13177" CreationDate="2016-01-14T17:39:34.117" Score="6" Body="&lt;p&gt;Currently, Element API is hard coded to throw a 404 exception for single element endpoints, if the element criteria returns no results. There's no way to prevent this exception, add &quot;fallback&quot; criteria or to display an error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the 404 exception will only be thrown if the &lt;code&gt;first&lt;/code&gt; parameter is set to &lt;code&gt;true&lt;/code&gt;, though. If it isn't, Element API will just return an empty dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, omitting the &lt;code&gt;first&lt;/code&gt; parameter is not a real solution to your issue. You still have no way to set a custom error message, and it would also mean that all single element endpoints would return arrays, as well as paging metadata etc, instead of a &quot;flat&quot; JSON object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On that note, my opinion is that the canonical answer to this question should probably be to &lt;strong&gt;fork the Element API plugin&lt;/strong&gt; and/or add a &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you don't want to go down that road, here's a possible workaround. It's not pretty :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what you'll need to do is to catch the &lt;code&gt;HttpException&lt;/code&gt;, in order to return a custom payload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, you'll need to write a custom plugin. Important: &lt;strong&gt;make sure that the string returned by your plugin's &lt;code&gt;getName()&lt;/code&gt; method comes before &quot;Element API&quot;, alphabetically&lt;/strong&gt;. The reason for this is that you need to make sure that Craft loads your plugin before the Element API plugin (Craft loads plugins alphabetically, by name). I'll pretend you opt for the name &quot;Awesome Plugin&quot;, which would work nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin will need a controller, so create one called &quot;AwesomeController&quot; or the like. This controller should have a method called &lt;code&gt;actionGetElements&lt;/code&gt;, taking the same arguments as the ElementApiController's &lt;code&gt;actionGetElements&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only purpose of your controller is to &quot;wrap&quot; the ElementApiController, in order to catch the 404 HttpException fired by Element API, and echo a custom error message. Here's how that could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AwesomeController extends BaseController&#xA;{&#xA;&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionGetElements($configFactory = null, array $config = null)&#xA;    {&#xA;        try {&#xA;&#xA;            // Fire up the Element API controller&#xA;            craft()-&amp;gt;runController('elementApi/getElements');&#xA;&#xA;        } catch (HttpException $e) {&#xA;&#xA;            switch ($e-&amp;gt;statusCode) {&#xA;&#xA;                case 404 :&#xA;&#xA;                    // It's a 404. Output a custom error message&#xA;                    JsonHelper::sendJsonHeaders();&#xA;                    echo JsonHelper::encode(array(&#xA;                        'error' =&amp;gt; 'No element found',&#xA;                    ));&#xA;                    // End the request&#xA;                    craft()-&amp;gt;end();&#xA;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, the controller will do nothing by itself – the final thing you need to do is to &quot;hijack&quot; the Element API routes; making them point to your controller instead of the ElementApiController. To achieve this, you'll need to create a method called &lt;code&gt;registerSiteRoutes()&lt;/code&gt; in your plugin's primary class. Inside this method, you'll basically want to pull all the routes from the Element API plugin, changing their &lt;code&gt;action&lt;/code&gt; value to &lt;code&gt;awesomePlugin/getElements&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why it's important to make sure that your plugin is loaded by Craft before the Element API plugin: when an existing route is added to Craft, it'll be ignored. This means that for every endpoint in &lt;code&gt;/config/elementapi.php&lt;/code&gt;, you can trick Craft into loading your custom controller instead of ElementApiController!:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how that &lt;code&gt;registerSiteRoutes()&lt;/code&gt; method could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;&#xA;    $routes = [];&#xA;&#xA;    // Get the Element API plugin&#xA;    $elementApiPlugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin('elementApi');&#xA;&#xA;    if (!$elementApiPlugin) {&#xA;        return $routes;&#xA;    }&#xA;&#xA;    // Get the Element API routes&#xA;    $elementApiRoutes = $elementApiPlugin-&amp;gt;registerSiteRoutes();&#xA;&#xA;    // Set action property&#xA;    foreach ($elementApiRoutes as $endpoint =&amp;gt; $config) {&#xA;        $config['action'] = 'awesomePlugin/getElements';&#xA;        $routes[$endpoint] = $config;&#xA;    }&#xA;&#xA;    return $routes;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All in all – not exactly an elegant solution; but if the 404's are a dealbreaker to you, its at least a working workaround that doesn't require you to tamper with the Element API source, and the performance footprint should be minimal, too (no redundant database queries). &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-14T19:12:20.657" LastActivityDate="2016-01-14T19:12:20.657" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13227" PostTypeId="1" AcceptedAnswerId="13241" CreationDate="2016-01-14T17:45:33.120" Score="3" ViewCount="6372" Body="&lt;p&gt;I have the following issue which I can't seem to wrap my head around. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All images assets uploaded to Craft return a 404 not found on the front-end. Everything works fine in the admin CP though (uploading, renaming, thumbnails, etc.). Any template with &lt;code&gt;getUrl()&lt;/code&gt; outputs the correct URL but the resource returns a 404 status code. When I navigate directly to the asset's URL, Craft returns a 404 template instead of the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the things I have checked so far :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Files permissions seem OK (775 on folder and 664 on files) on the &quot;craft&quot; user;&lt;/li&gt;&#xA;&lt;li&gt;The assets paths is &lt;code&gt;{basePath}uploads/images/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The assets URL is &lt;code&gt;{siteUrl}images/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Both &lt;code&gt;{basePath}&lt;/code&gt; and &lt;code&gt;{siteUrl}&lt;/code&gt; are correctly set as environment variables in &lt;code&gt;general.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;I'm running Nginx with a config similar to &lt;a href=&quot;https://craftcms.stackexchange.com/a/8971&quot;&gt;this answer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any thoughts ? This is really bugging me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are my two nginx configuration files :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# nginx.conf&#xA;&#xA;user craft craft;&#xA;worker_processes auto;&#xA;worker_rlimit_nofile 8192;&#xA;events {&#xA;    worker_connections 8000;&#xA;}&#xA;&#xA;error_log /var/log/nginx/error.log debug; # not for production&#xA;pid /var/run/nginx.pid;&#xA;&#xA;&#xA;http {&#xA;&#xA;    disable_symlinks off;&#xA;    proxy_buffering on;&#xA;    proxy_buffer_size 8k;&#xA;    proxy_buffers 2048 8k;&#xA;    proxy_connect_timeout  600s;&#xA;    proxy_send_timeout  600s;&#xA;    proxy_read_timeout  600s;&#xA;    fastcgi_send_timeout 600s;&#xA;    fastcgi_read_timeout 600s;&#xA;&#xA;    rewrite_log on;&#xA;    access_log /var/log/nginx/access.log;&#xA;&#xA;    server_tokens off;&#xA;    include /etc/nginx/mime.types;&#xA;    default_type application/octet-stream;&#xA;    keepalive_timeout   65;&#xA;    sendfile            on;&#xA;    tcp_nopush          on;&#xA;    gzip                on;&#xA;    gzip_comp_level     5;&#xA;    gzip_min_length     256;&#xA;    gzip_proxied        any;&#xA;    gzip_vary           on;&#xA;    gzip_disable        &quot;msie6&quot;;&#xA;&#xA;    include /etc/nginx/sites-enabled/*;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# site.conf&#xA;&#xA;# -------------------------------------------------&#xA;# General server configuration&#xA;&#xA;server {&#xA;&#xA;  listen 80 default_server;&#xA;  server_name example.com;&#xA;  root /srv/craft/public;&#xA;  index index.php index.html index.htm;&#xA;  charset utf-8;&#xA;  error_page 404 /index.php;&#xA;  error_log /var/log/nginx/example.com.error.log debug;&#xA;  access_log /var/log/nginx/example.com.access.log;&#xA;&#xA;  # -------------------------------------------------&#xA;  # Some locations to help during dev, remove for production&#xA;&#xA;  location = /phpinfo {&#xA;    try_files $uri $uri/ /phpinfo.php$is_args$args;&#xA;  }&#xA;&#xA;  location = /status {&#xA;     access_log off;&#xA;     allow all;&#xA;     include fastcgi_params;&#xA;     fastcgi_param SCRIPT_FILENAME /status;&#xA;     fastcgi_pass unix:/var/run/php-fpm.sock;&#xA;  }&#xA;&#xA;  location = /ping {&#xA;     access_log off;&#xA;     allow all;&#xA;     include fastcgi_params;&#xA;     fastcgi_param SCRIPT_FILENAME /ping;&#xA;     fastcgi_pass unix:/var/run/php-fpm.sock;&#xA;  }&#xA;&#xA;  # -------------------------------------------------&#xA;  # Static assets (css, js, fonts, etc.) location&#xA;&#xA;  location /src {&#xA;      root /srv/craft/public/src;&#xA;      expires 1y;&#xA;      access_log off;&#xA;      add_header Pragma public;&#xA;      add_header Cache-Control &quot;public&quot;;&#xA;  }&#xA;&#xA;  # -------------------------------------------------&#xA;  # Craft application locations&#xA;&#xA;  location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;  }&#xA;&#xA;  location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;  }&#xA;&#xA;  location ~ \.php$ {&#xA;    try_files $uri =404;&#xA;    include fastcgi_params;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/var/run/php-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;  }&#xA;&#xA;  # cache.appcache, your document html and data&#xA;  location ~* \.(?:manifest|appcache|html?|xml|json)$ {&#xA;      try_files $uri /index.php?$query_string;&#xA;      expires -1;&#xA;  }&#xA;&#xA;  # Feed&#xA;  location ~* \.(?:rss|atom)$ {&#xA;      try_files $uri /index.php?$query_string;&#xA;      expires 1h;&#xA;      add_header Cache-Control &quot;public&quot;;&#xA;  }&#xA;&#xA;  # Media: images, icons, video, audio, HTC&#xA;  location ~* \.(?:jpg|jpeg|gif|png|pdf|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {&#xA;      try_files $uri /index.php?$query_string;&#xA;      expires 1M;&#xA;      add_header Pragma public;&#xA;      add_header Cache-Control &quot;public&quot;;&#xA;  }&#xA;&#xA;  # CSS and Javascript&#xA;  location ~* \.(?:css|js)$ {&#xA;      try_files $uri /index.php?$query_string;&#xA;      expires 1y;&#xA;      add_header Pragma public;&#xA;      add_header Cache-Control &quot;public&quot;;&#xA;  }&#xA;&#xA;  # -------------------------------------------------&#xA;  # Other static ressources&#xA;&#xA;  # Favicons&#xA;  location = /favicon.ico {&#xA;      access_log off;&#xA;      log_not_found off;&#xA;  }&#xA;&#xA;  # Robots.txt&#xA;  location = /robots.txt {&#xA;      access_log off;&#xA;      log_not_found off;&#xA;  }&#xA;&#xA;  # Humans.txt&#xA;  location = /humans.txt {&#xA;      access_log off;&#xA;      log_not_found off;&#xA;  }&#xA;&#xA;  # Prevent clients from accessing hidden files (starting with a dot)&#xA;  # This is particularly important if you store .htpasswd files in the site hierarchy&#xA;  location ~* (?:^|/)\. {&#xA;      deny all;&#xA;  }&#xA;  # Prevent clients from accessing to backup/config/source files&#xA;  location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {&#xA;      deny all;&#xA;  }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4600" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2021-03-26T12:47:54.350" Title="Assets (images) return a 404 on the front-end" Tags="&lt;assets&gt;&lt;image&gt;&lt;404&gt;&lt;debugging&gt;" AnswerCount="4" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13228" PostTypeId="2" ParentId="13223" CreationDate="2016-01-14T18:20:36.697" Score="3" Body="&lt;p&gt;Add this to your nginx &lt;code&gt;server&lt;/code&gt; block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;  ...&#xA;  large_client_header_buffers 4 16k;&#xA;  ...&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and restart nginx. The default is 8k. If you have a lot of headers, beefing that value up should resolve it otherwise you may want to play with &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;client_header_buffer_size&lt;/code&gt;&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-01-14T18:29:45.477" LastActivityDate="2016-01-14T18:29:45.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13229" PostTypeId="2" ParentId="13217" CreationDate="2016-01-14T18:21:34.517" Score="1" Body="&lt;p&gt;There currently isn't a native way to do this, and I'm not sure it'd be that easy for a plugin to easily pull off either, since there currently aren't any &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;search related events&lt;/a&gt; exposed in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding a &lt;a href=&quot;http://feedback.craftcms.com/search?filter=ideas&amp;amp;query=search&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; for, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-14T18:21:34.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13230" PostTypeId="2" ParentId="13218" CreationDate="2016-01-14T18:33:40.827" Score="7" Body="&lt;p&gt;Records are definitely not the way to go with dealing with large amounts of data sets in the database.  There is just too much overheard associated with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually running SQL (as you've discovered) is an option, but if you wanted to do this from PHP, you could still use QueryBuilder.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$elementIds = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;            -&amp;gt;select('id')&#xA;            -&amp;gt;from('entries')&#xA;            -&amp;gt;where('sectionId = :sectionId', array(':sectionId' =&amp;gt; 18))&#xA;            -&amp;gt;queryColumn();&#xA;&#xA;$rowsAffected = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;            -&amp;gt;delete(&#xA;                'elements',&#xA;                array('in', 'id', $elementIds)&#xA;             );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The MySQL cascading deletes setup on the foreign keys should take care of cleaning up the necessary rows in the remaining tables automatically.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2016-02-03T17:33:53.280" LastActivityDate="2016-02-03T17:33:53.280" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13231" PostTypeId="1" AcceptedAnswerId="13253" CreationDate="2016-01-14T20:09:46.733" Score="0" ViewCount="462" Body="&lt;p&gt;I'm trying to call for a Twig template &lt;code&gt;_template&lt;/code&gt; from a Twig template, particularly from within AngularJS &lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/scirpt&amp;gt;&lt;/code&gt; tags. A console log says, that the file was not found on the server with status of 404. Using &lt;code&gt;{% include '' %}&lt;/code&gt; or &lt;code&gt;{% embed '' %}&lt;/code&gt;interferes with AngularJS somehow. Does any way around exists to access that Twig template, without breaching the security?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Troubleshooting part of js:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mdDialog.show({&#xA;  templateUrl: '_template',&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-01-16T12:12:52.813" LastActivityDate="2016-01-16T12:12:52.813" Title="Direct access call for a twig template from a twig template gives 404" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13232" PostTypeId="1" CreationDate="2016-01-14T20:45:30.250" Score="2" ViewCount="341" Body="&lt;p&gt;I'm using the Element API plugin to return data from an entry that also contains an image asset. Is there a way to combine the two so I can get the asset URL alongside the entry fields? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached below is an approximation of my line of thinking.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'wax'],&#xA;&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'excerpt' =&amp;gt; $entry-&amp;gt;excerpt,&#xA;                'heroImage' =&amp;gt; $asset-&amp;gt;heroImage.url // Something like this?&#xA;            ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4601" LastEditorUserId="57" LastEditDate="2016-01-14T21:22:30.787" LastActivityDate="2016-05-13T23:08:05.693" Title="Is there a way to return asset data along with entry data?" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13233" PostTypeId="1" AcceptedAnswerId="13235" CreationDate="2016-01-14T21:07:47.807" Score="3" ViewCount="852" Body="&lt;p&gt;When specifying the URL and template used to render a section, it's possible to set variable URLs using something like &lt;code&gt;/{postDate.year}/{slug}&lt;/code&gt;. Is there any way to accomplish something similar for the entry template, or do all the differences have to be handled within one template that checks for entry type?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastEditorUserId="57" LastEditDate="2016-01-14T21:21:31.467" LastActivityDate="2016-01-14T21:35:50.990" Title="Different templates for different entry types within a section" Tags="&lt;templating&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13234" PostTypeId="2" ParentId="13222" CreationDate="2016-01-14T21:18:02.500" Score="2" Body="&lt;p&gt;That would be the same behavior for using &lt;code&gt;{id}&lt;/code&gt; in the title format for new entries created in the control panel as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with &lt;code&gt;{id}&lt;/code&gt; is that's not known until the entry is already saved to the database since it's a database generated number.  That's why it's empty for new entries but re-saving the entry will cause it to appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest thing to do would be to generate a &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/random.html&quot; rel=&quot;nofollow&quot;&gt;unique ID&lt;/a&gt; from the template and save it to a custom field on the entry.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-14T21:18:02.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13235" PostTypeId="2" ParentId="13233" CreationDate="2016-01-14T21:21:41.790" Score="5" Body="&lt;p&gt;Sounds like you're looking for something like this: &lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/support/entry-type-templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-14T21:21:41.790" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13236" PostTypeId="2" ParentId="13232" CreationDate="2016-01-14T21:26:58.743" Score="4" Body="&lt;p&gt;Yes - you can access it exactly the same way you do in the templates; you just need to use PHP syntax (e.g. &lt;code&gt;-&amp;gt;&lt;/code&gt; for accessing sub-properties rather than &lt;code&gt;.&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    // Begin defining the response data for this entry&#xA;    $data = [&#xA;        'excerpt' =&amp;gt; $entry-&amp;gt;excerpt,&#xA;    ];&#xA;&#xA;    // Get the first asset in a &quot;heroImage&quot; Assets field (if there is one)&#xA;    $heroImage = $entry-&amp;gt;heroImage-&amp;gt;first();&#xA;&#xA;    if ($heroImage) {&#xA;        $data['heroImage'] = $heroImage-&amp;gt;url;&#xA;    }&#xA;&#xA;    return $data;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-01-14T21:26:58.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13237" PostTypeId="2" ParentId="13233" CreationDate="2016-01-14T21:35:50.990" Score="5" Body="&lt;p&gt;It is not possible to have dynamic tags within Entry Template settings, no. All fields that do allow dynamic tags will say so in their instruction text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason it’s allowed in some settings but not others is because there is a performance hit each time those dynamic settings are rendered. (We actually spin up Twig to do the parsing, but since the settings are not stored as actual files, Twig must re-recompile the settings every single time.) So we only do it in areas where the performance hit doesn’t matter much. Entry URL Format settings, for example, only have to get parsed when an entry is saved, not each time that the entry is actually requested on the front end.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-01-14T21:35:50.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13238" PostTypeId="1" CreationDate="2016-01-14T21:40:38.330" Score="0" ViewCount="22" Body="&lt;p&gt;When I am configuring the fields for a given entry type, is there a way to see those fields' handles on the same page? I often reference the entry type page to know which fields are associated with a given entry type, but then I have to cross reference the fields page to make sure I'm using the correct handle. Is there a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2016-01-15T02:23:57.193" Title="Possible to view field handles on entry type field definition page?" Tags="&lt;field&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13240" PostTypeId="2" ParentId="5368" CreationDate="2016-01-14T23:30:29.227" Score="0" Body="&lt;p&gt;You could also use the cache tag in combination with a dynamic key, like the specific ordering as a key. It will however create stale cache entries, so be sure to use this only if it won't be a problem, i.e. rarely updates and/or cache cleared regularly. For custom elements reordering the given on-move approach seems better, but this method could perhaps be of use for the standard entries.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2016-01-14T23:30:29.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13241" PostTypeId="2" ParentId="13227" CreationDate="2016-01-14T23:42:59.710" Score="1" Body="&lt;p&gt;It appears nginx is setup correctly. In Craft, your Assets URL can be different than your assets path, which I think is where some confusion is coming in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Craft's file upload path is outside nginx &lt;code&gt;root&lt;/code&gt; (otherwise known as the &lt;code&gt;DocumentRoot&lt;/code&gt; directive in Apache), you could either move your asset storage so it's &lt;em&gt;under&lt;/em&gt; the document root—and thus &quot;public&quot; or &quot;virtually move&quot; the &lt;code&gt;root&lt;/code&gt; folder so nginx will serve from that directory instead of the actual &quot;images&quot; folder.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location /images/ {&#xA;  /root /srv/craft/uploads&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As with great power comes great responsibility. If you use the virtual rewriting option, be careful to always specify a default document root, and only override the root inside a location unless you have to &lt;a href=&quot;https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#root-inside-location-block&quot; rel=&quot;nofollow&quot;&gt;as noted in nginx docs&lt;/a&gt;, or nothing will match and you'll pull your hair out as to why nothing matches.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-01-14T23:42:59.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13242" PostTypeId="1" AcceptedAnswerId="13244" CreationDate="2016-01-14T23:58:32.087" Score="3" ViewCount="671" Body="&lt;p&gt;Is there a 2-factor authentication plugin for Craft? Or is there a way to secure the login for Craft CMS beyond the common installation instructions? I want to build a system that someone on a dynamic IP could access, so static IP's are a bit harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was also thinking if there was a way to add another field to the login page, which was a decryption key, then use one the twig decryption method. If you don't have it, you'd see the data, but it would be all garbled up.&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="125" LastEditDate="2016-01-16T09:37:24.443" LastActivityDate="2016-01-16T09:37:24.443" Title="Is there a 2-factor auth plugin?" Tags="&lt;plugins&gt;&lt;login&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13243" PostTypeId="2" ParentId="13238" CreationDate="2016-01-15T02:23:57.193" Score="2" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/mmikkel/CpFieldLinks-Craft&quot; rel=&quot;nofollow&quot;&gt;CP Field Links&lt;/a&gt; plugin to view the handles on the edit entry pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it sounds like &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7194444-search-for-fields-and-show-field-handles-in-the-la&quot; rel=&quot;nofollow&quot;&gt;this feature request&lt;/a&gt; is very close to what you're asking for.  You might want to throw a vote its way.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-15T02:23:57.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13244" PostTypeId="2" ParentId="13242" CreationDate="2016-01-15T05:08:47.057" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a 2-factor authentication plugin for Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've heard of one in private testing, but I'm not aware if they plan to release it publicly or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until the official Craft plugin store becomes a thing, the most comprehensive list of Craft plugins available I know of is over on the awesome &lt;a href=&quot;https://straightupcraft.com/craft-plugins/&quot; rel=&quot;nofollow&quot;&gt;Straight Up Craft&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to build a system that someone on a dynamic IP could access, so static IP's are a bit harder.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;O.K. What's the reasoning there, if you don't mind me asking?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I was also thinking if there was a way to add another field to the login page, which was a decryption key, then use one the twig decryption method. If you don't have it, you'd see the data, but it would be all garbled up.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not currently, but we've discussed giving plugins the ability to control the HTML of the login page.  Probably worth making an &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;official feature&lt;/a&gt; request for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth mentioning that there is an &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;nofollow&quot;&gt;onBeforeLogin&lt;/a&gt; event a plugin can already listen to and apply their own custom password business logic (i.e. must be 200 characters long, have 40 emojis, 20 Egyptian hieroglyphs, be purple and only work on Tuesday).&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-01-15T07:34:20.760" LastActivityDate="2016-01-15T07:34:20.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13245" PostTypeId="2" ParentId="13224" CreationDate="2016-01-15T09:29:03.043" Score="3" Body="&lt;p&gt;Turns out, there's an &lt;code&gt;element&lt;/code&gt; twig variable that I can use (it contains the Sprout Form entry), so I can output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ element.first_name }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for instance.&lt;/p&gt;&#xA;" OwnerUserId="3427" LastActivityDate="2016-01-15T09:29:03.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13246" PostTypeId="1" AcceptedAnswerId="13248" CreationDate="2016-01-15T12:25:57.227" Score="0" ViewCount="300" Body="&lt;p&gt;In my backend I have a radio button field with 2 options for the client:&#xA;&lt;strong&gt;Normal&lt;/strong&gt; and &lt;strong&gt;cover&lt;/strong&gt;. When selecting normal, the uploaded image is put into an  tag in the HTML and an image transform is applied. This works well as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When selecting cover however, the uploaded image is added to a background-image inline CSS style. But the applied image transform is not generated for this. When I change the uploaded image to &quot;normal&quot;, let it generate a transform and then put it back to &quot;cover&quot; only than it is shown as a background image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So image transform doesn't seem to trigger in this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div style=&quot;background-image: url('{{ block.mediaImageFile.first().getUrl('storyMediaTransform') }}'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why this is not working?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2016-01-15T12:31:01.243" LastActivityDate="2016-01-15T13:27:30.583" Title="Image transform in inline background css not being generated" Tags="&lt;image-transforms&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13247" PostTypeId="1" AcceptedAnswerId="13249" CreationDate="2016-01-15T12:27:12.060" Score="2" ViewCount="1017" Body="&lt;p&gt;Im trying to figure out how to get Entries by date range, say I would like to get all Entries from one week back, or I would like to get all Entries from a specific month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find some Twig examples, but haven't successfully been able to translate them to php for use in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2016-01-15T13:31:19.717" Title="Get entries by date range from plugin" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13248" PostTypeId="2" ParentId="13246" CreationDate="2016-01-15T13:27:30.583" Score="1" Body="&lt;p&gt;Try taking the apostrophes off your transform, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getUrl(storyMediaTransform)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2016-01-15T13:27:30.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13249" PostTypeId="2" ParentId="13247" CreationDate="2016-01-15T13:31:19.717" Score="4" Body="&lt;p&gt;Ok, found an answer that made it a bit clearer:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8739/how-do-i-get-elements-using-getcriteria-from-a-specific-date/8747#8747&quot;&gt;How do I get elements using getCriteria from a specific date?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;postDate = '&amp;gt;'. date('Y-m-d', strtotime(&quot;-4 weeks&quot;));&#xA;$result = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get Entries form a month back.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-15T13:31:19.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13250" PostTypeId="1" CreationDate="2016-01-15T16:47:05.090" Score="3" ViewCount="316" Body="&lt;p&gt;Does Craft have somewhere where I can setup log rotation for the craft.log file, or do admins have to manage that manually?&lt;/p&gt;&#xA;" OwnerUserId="4605" LastActivityDate="2016-01-15T20:07:37.410" Title="Craft CMS Log Rotation" Tags="&lt;admin&gt;&lt;logs&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13251" PostTypeId="2" ParentId="13250" CreationDate="2016-01-15T17:31:47.900" Score="4" Body="&lt;p&gt;Craft will automatically 'rotate' logs into new files as each current file reaches the maximum size (~1MB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why, if you look in &lt;code&gt;/craft/storage/runtime/logs&lt;/code&gt;, you may see &lt;code&gt;craft.log&lt;/code&gt;, &lt;code&gt;craft.1.log&lt;/code&gt;, &lt;code&gt;craft.2.log&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I &lt;em&gt;think&lt;/em&gt; Craft keeps a max of 5 files around before rotating them off into the ether.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present, the max size, naming convention, and max log file count, are all &lt;em&gt;not&lt;/em&gt; configurable. (To my great chagrin.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to rename/archive logs for your own purposes, you'll have to create your own workflow for that, either by scripting it and running it as a cron job, or by using a third-party aggregation/archival service such as &lt;a href=&quot;https://papertrailapp.com/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Papertrail&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-01-15T17:31:47.900" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13252" PostTypeId="2" ParentId="13250" CreationDate="2016-01-15T20:07:37.410" Score="1" Body="&lt;p&gt;Depending on what you want to do with the logs, if you're on a *nix server, &lt;a href=&quot;http://www.linuxcommand.org/man_pages/logrotate8.html&quot; rel=&quot;nofollow&quot;&gt;logrotate&lt;/a&gt; is built into most systems.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/*user*/craft/storage/runtime/logs/*.log {&#xA;&#xA;  weekly&#xA;  dateext&#xA;  compress&#xA;  delaycompress&#xA;  notifempty&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... which would rotate and gzip the logs after a week and append the date. There's a billion options in there including e-mailing you copies or moving them to different directories (like an archive). On Ubuntu/Debian, check out &lt;code&gt;/etc/logrotate.d/&lt;/code&gt; for examples.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-01-15T20:07:37.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13253" PostTypeId="2" ParentId="13231" CreationDate="2016-01-15T20:45:41.933" Score="5" Body="&lt;p&gt;Not sure exactly what you trying to do here?  Call a Twig template from Angular?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig is a server side technology, Angular is getting parsed on the client side. The only way Craft is going to parse a Twig template is when it encounters a URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of calling the Twig template directly, you call the URL, which &lt;a href=&quot;https://craftcms.com/docs/routing&quot;&gt;could match a template&lt;/a&gt;. Inside &lt;code&gt;templates&lt;/code&gt;, make a folder like &lt;code&gt;angular-views&lt;/code&gt; and then inside that put a file called &lt;code&gt;md-dialog.twig&lt;/code&gt;.  From the front end, now you can call it from Angular like &lt;code&gt;http://example.com/angular-views/md-dialog&lt;/code&gt; (the .twig is optional).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to use Angular inside of a Twig template, you may want to use something like &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/verbatim.html&quot;&gt;&lt;code&gt;{% verbatim %}&lt;/code&gt;&lt;/a&gt; and then put your JS/Angular templating between those tags to make sure Twig doesn't touch any of it. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-01-15T20:45:41.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13254" PostTypeId="1" CreationDate="2016-01-15T22:22:51.960" Score="0" ViewCount="86" Body="&lt;p&gt;So it seems that &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13099/advanced-filtered-search-matrix-fields-and-arrays&quot;&gt;Matrix fields don't work with the object syntax&lt;/a&gt; so I've changed my field structure to use standard dropdowns, checkboxes and a number field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the dropdown (&lt;code&gt;gender&lt;/code&gt;) and number field (&lt;code&gt;maxPrice&lt;/code&gt;) working fine, but I can't seem to figure out what to enter for the checkboxes. I assumed it'd be in a similar format to what I've seen elsewhere, as you can see below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set tags = craft.request.getParam('tags') %}&#xA;&#xA;{# Gender is a dropdown, so it's a single value or no value&#xA; # - If an empty value is selected, it returns both genders #}&#xA;{% set gender = craft.request.getParam('gender') %}&#xA;&#xA;{% set maxPrice = craft.request.getParam('maxPrice') %}&#xA;{% set maxPrice = maxPrice is not empty ? maxPrice : '99' %}&#xA;&#xA;{% set sessions = craft.request.getParam('sessions') %}&#xA;{% set sessions = sessions is not empty ? sessions : ['skype', 'chat', 'phone', 'email'] %}&#xA;{% set sessions = ['and']|merge(sessions) %}&#xA;&#xA;{% set hours = craft.request.getParam('hours') %}&#xA;{% set hours = hours is not empty ? hours : ['office', 'overtime', 'weekends'] %}&#xA;{% set hours = ['and']|merge(hours) %}&#xA;&#xA;{% set results = craft.users({&#xA;  group: 'verified',&#xA;  search: &quot;tagsSpecialismSearchable:#{tags}&quot;,&#xA;  gender: gender,&#xA;  profilePricingSession: [&#xA;    'and',&#xA;    '&amp;gt; 0',&#xA;    &quot;&amp;lt;= #{maxPrice}&quot;&#xA;  ],&#xA;  profileSessions: sessions,&#xA;  profileHours: hours,&#xA;}) %}&#xA;&#xA;{% set users = shuffle(results) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works except &lt;code&gt;profileSessions&lt;/code&gt; and &lt;code&gt;profileHours&lt;/code&gt;, which are both checkboxes. I assumed it might be that they need to be passed a &lt;code&gt;key: value&lt;/code&gt; pair, i.e: &lt;code&gt;skype: true&lt;/code&gt; or some other method, but nothing I've tried so far is working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I happened on a post saying &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13190/search-against-a-checkboxes-fields-options&quot;&gt;checkboxes store in a query unfriendly way&lt;/a&gt;, so perhaps I'm better off changing the field again for something more friendly. They'd need to be multi-select of course, so categories would be the best bet if what I'm doing isn't possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-15T22:22:51.960" Title="Advanced search form with checkboxes" Tags="&lt;categories&gt;&lt;search&gt;&lt;queries&gt;&lt;checkboxes&gt;" AnswerCount="0" CommentCount="11" FavoriteCount="1" ClosedDate="2016-01-18T16:08:30.400" ContentLicense="CC BY-SA 3.0" />
  <row Id="13255" PostTypeId="2" ParentId="12823" CreationDate="2016-01-16T00:37:15.733" Score="2" Body="&lt;p&gt;This was a bug and has been fixed in &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/updates#release-v2.0.2&quot; rel=&quot;nofollow&quot;&gt;Sprout Email v2.0.2&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-01-16T00:37:15.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13256" PostTypeId="2" ParentId="13215" CreationDate="2016-01-16T06:03:02.290" Score="4" Body="&lt;p&gt;You're close!  Those config settings are off in no-mans-land right now.  If you want them to apply across all of your multi-environment configs, you need to move them into the &lt;code&gt;'*'&lt;/code&gt; array like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'setPasswordPath' =&amp;gt; 'user/set-password',&#xA;        'activateAccountSuccessPath' =&amp;gt; 'user/activation-success',&#xA;        'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;    ),&#xA;&#xA;    '.local' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'userSessionDuration' =&amp;gt; false&#xA;    ),&#xA;&#xA;    '.co.uk' =&amp;gt; array(&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;    ),&#xA;&#xA;    '.com' =&amp;gt; array(&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="1016" LastEditDate="2016-01-17T05:09:34.460" LastActivityDate="2016-01-17T05:09:34.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13257" PostTypeId="1" CreationDate="2016-01-16T13:13:48.357" Score="0" ViewCount="118" Body="&lt;p&gt;As the title suggests, i'm trying to output the contents of a default instructions field within a Matrix block.  I'm sure it's doable but not sure where to start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2016-01-16T16:56:51.380" Title="Output the contents of an instructions field within a Matrix block" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13258" PostTypeId="1" AcceptedAnswerId="13262" CreationDate="2016-01-16T16:16:56.447" Score="2" ViewCount="904" Body="&lt;p&gt;I'm trying to find a method of escaping characters in Craft's &lt;code&gt;DateTime&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the output I'm trying to achieve: &lt;code&gt;16th January 2016&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've tried: &lt;code&gt;{{ article.postDate.format('j\&amp;lt;\s\u\p\&amp;gt;S\&amp;lt;\/\s\u\p\&amp;gt; F Y') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the output: &lt;code&gt;16&amp;amp;lt;00000000p&amp;amp;gt;th&amp;lt;!--00000000p--&amp;gt; January 2016&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can achieve the output by appending output together but there &lt;strong&gt;has&lt;/strong&gt; to be a better way of achieving this than the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ article.postDate.format('j') }}&amp;lt;sup&amp;gt;{{ article.postDate.format('S') }}&amp;lt;/sup&amp;gt; {{ article.postDate.format(' F Y') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers to documentation would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4118" LastEditorUserId="4118" LastEditDate="2017-11-11T12:14:25.183" LastActivityDate="2017-11-11T15:08:51.170" Title="Escape characters in format" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;escaping&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13259" PostTypeId="2" ParentId="13258" CreationDate="2016-01-16T16:32:32.740" Score="3" Body="&lt;p&gt;Try the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;date&lt;/code&gt;&lt;/a&gt; filter instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ article.postDate|date('jS F Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to wrap the ordinal in &lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ article.postDate|date('j') }}&amp;lt;sup&amp;gt;{{ article.postDate|date('S') }}&amp;lt;/sup&amp;gt;&#xA;{{ article.postDate|date('F Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you think it's to ugly for use in your templates, consider &quot;hiding&quot; it in &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;a macro&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-16T16:39:14.663" LastActivityDate="2016-01-16T16:39:14.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13260" PostTypeId="2" ParentId="13257" CreationDate="2016-01-16T16:56:51.380" Score="2" Body="&lt;p&gt;I just searched this Stack Exchange and found an answer on how to get the field model from the templates: &lt;a href=&quot;https://craftcms.stackexchange.com/a/493/125&quot;&gt;How can I output the Field Name in my template?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can get any field with craft.fields, which returns a FieldModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set field = craft.fields.getFieldbyHandle('field_handle') %}&#xA; {{ field.name }}&#xA; {{ field.instructions }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Unfortunatelly, however, this won't work with fields within a Martix field. The &lt;code&gt;getFieldbyHandle&lt;/code&gt; method is written for use in specific parts of the CP, where Craft knows the context the field is used in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a &lt;code&gt;getFieldbyId&lt;/code&gt; method though, which could work for your use case. The field's ID is independent from the context (inside Matrix or not).&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-16T16:56:51.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13261" PostTypeId="2" ParentId="13190" CreationDate="2016-01-16T18:14:52.833" Score="2" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;https://github.com/carlcs/craft-checkboxfield&quot; rel=&quot;nofollow&quot;&gt;Checkbox field&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It provides a field type that looks like the default &lt;a href=&quot;https://craftcms.com/docs/checkboxes-fields&quot; rel=&quot;nofollow&quot;&gt;Checkboxes field&lt;/a&gt;, but stores a boolean value to the database (similar to the Lightswitch field), so you can use a custom field parameter in your criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.myCheckbox(1).myOtherCheckbox(0) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-16T18:14:52.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13262" PostTypeId="2" ParentId="13258" CreationDate="2016-01-17T01:09:11.493" Score="5" Body="&lt;p&gt;After trial and error I figured out you can escape characters using double backslash. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ article.postDate.format('j\\&amp;lt;\\s\\u\\p\\&amp;gt;S\\&amp;lt;\\/\\s\\u\\p\\&amp;gt; F Y') | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputs: &lt;code&gt;14&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; January 2016&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In search of documentation I found a mention of &lt;a href=&quot;https://craftcms.stackexchange.com/a/4271/4118&quot;&gt;double-escaping regular expressions&lt;/a&gt; due to Twig auto-escaping &lt;code&gt;\&lt;/code&gt;. At this point I'm guessing this works for most Craft-Twig functions.&lt;/p&gt;&#xA;" OwnerUserId="4118" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-04T23:00:02.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13263" PostTypeId="1" AcceptedAnswerId="13264" CreationDate="2016-01-17T01:27:57.993" Score="1" ViewCount="55" Body="&lt;p&gt;For some reason whenever I add a custom column to a section's entry list I'm getting errors and no values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add Entry Type to the column list, for example, it's saying:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unknown class: Craft\EntryTypeModel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And links are saying:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unknown class: Twig_Markup&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rc6gL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rc6gL.png&quot; alt=&quot;screenshot of errors&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little dumbfounded?  I tried removing and re-adding them and still no luck.  Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2016-01-17T03:30:41.370" LastActivityDate="2016-01-17T04:27:56.247" Title="Columns on the Entry index page giving errors" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13264" PostTypeId="2" ParentId="13263" CreationDate="2016-01-17T04:27:56.247" Score="2" Body="&lt;p&gt;So turns out it was an issue with an older plugin, DashCols. As soon as I disabled it things worked fine.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unsurprising in hindsight!&lt;/p&gt;&#xA;" OwnerUserId="183" LastActivityDate="2016-01-17T04:27:56.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13266" PostTypeId="2" ParentId="9400" CreationDate="2016-01-17T10:13:19.190" Score="5" Body="&lt;p&gt;As a heads up, I would avoid &lt;a href=&quot;http://www.cloudways.com/&quot; rel=&quot;noreferrer&quot;&gt;Cloudways&lt;/a&gt;. It looked ideal in theory but I've had a few problems and found their support to be fast but lacking and quite resistant to the idea of Craft.&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2016-01-17T10:13:19.190" CommentCount="0" CommunityOwnedDate="2016-01-17T10:13:19.190" ContentLicense="CC BY-SA 3.0" />
  <row Id="13267" PostTypeId="2" ParentId="13221" CreationDate="2016-01-17T13:48:56.373" Score="1" Body="&lt;p&gt;Have you seen this solution: &lt;a href=&quot;http://craftcookbook.net/recipes/120&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/120&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vote here for better image cropping in Craft: &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7302748-intelligent-cropping-for-flexible-images&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7302748-intelligent-cropping-for-flexible-images&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-01-17T13:48:56.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13268" PostTypeId="2" ParentId="13106" CreationDate="2016-01-17T14:21:56.830" Score="2" Body="&lt;p&gt;It seams, that the columns for the form values are not part of the sql, that's why it never will work like this. Maybe it works in upcomming versions of the Sprout Forms plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround you can use the SuperSort Plugin. With this plugin it's possible to sort your form entries like you need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1 -&gt; Download and Install SuperSort Plugin -&gt; &lt;a href=&quot;https://topshelfcraft.com/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;https://topshelfcraft.com/lagniappe/supersort&lt;/a&gt;&#xA;Step 2 -&gt; Filter your form entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set formEntries = craft.sproutForms.entries.formHandle('contact')%}    &#xA;{% set formEntriesSort = formEntries | supersort('sortAs', '{address | lower}') %}&#xA;&#xA;{% for formEntry in formEntriesSort %}&#xA;   {{ formEntry.address }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like this it should work!&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-01-17T14:21:56.830" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13269" PostTypeId="1" CreationDate="2016-01-17T16:10:37.810" Score="1" ViewCount="72" Body="&lt;p&gt;I have a couple of Channels with news entries imported from different RSS feeds. A lot of these entries have a similar topic, so it would be very nice if these entries could be deleted from the 'All entries' listing in the control panel. That way, entries from different sections can be compared by title, and easily deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is possible when using the listing of a single Channel, but not the 'All entries' listing. Is this still possible somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining the entries in a single Channel is not an option unfortunately due to different fields and needs per RSS feed.&lt;/p&gt;&#xA;" OwnerUserId="3829" LastEditorUserId="57" LastEditDate="2016-01-17T19:42:10.293" LastActivityDate="2016-01-17T21:31:05.357" Title="Is it possible to delete entries directly from the 'All entries' listing in the control panel?" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;entry&gt;&lt;deletion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13270" PostTypeId="2" ParentId="13269" CreationDate="2016-01-17T19:44:28.157" Score="1" Body="&lt;p&gt;This is currently not possible natively in Craft, but you might want to consider voting for &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9787533-select-and-delete-multiple-entries&quot; rel=&quot;nofollow&quot;&gt;this feature request&lt;/a&gt;, which is very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you could write a &lt;a href=&quot;http://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt; that provided its own entry index view and allowed you to delete entries any way you wished.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="784" LastEditDate="2016-01-17T21:31:05.357" LastActivityDate="2016-01-17T21:31:05.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13271" PostTypeId="1" CreationDate="2016-01-18T01:00:31.243" Score="1" ViewCount="182" Body="&lt;p&gt;I have a plugin that renders HTML via a hook.  If someone wraps that hook with &lt;code&gt;{% cache %}&lt;/code&gt; in their templates, how can my plugin tell Craft to invalidate the cache when something within it changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Let's say, for example, that I'm getting JSON data from an external source via my plugin.  I could be rendering this via a hook, or using a Variable, it doesn't matter that much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no Element that the content that changes can be linked to, in order to invalidate the cache.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2016-01-19T11:17:59.557" LastActivityDate="2016-01-19T11:17:59.557" Title="Invalidating the cache tag from a plugin?" Tags="&lt;plugin-development&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13272" PostTypeId="1" CreationDate="2016-01-18T10:53:09.470" Score="1" ViewCount="276" Body="&lt;p&gt;I have a plugin that has some settings, some of which are dates. I want to make these fields required, and ensure they are valid dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8348/how-do-i-save-a-plugins-date-settings-field&quot;&gt;this bug&lt;/a&gt; the date attributes are set as &lt;code&gt;AttributeType::Mixed&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a structure like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10746/custom-validation-for-plugin-settings&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10162/how-can-i-add-custom-validation-rules-to-my-plugin-settings&quot;&gt;this&lt;/a&gt; to set up the attributes on my settings, but I can't get the date fields to be required, never mind use a custom date-validation method.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class My_SettingsModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'myText' =&amp;gt; array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text),&#xA;            // There are multiple date fields, but for the example:&#xA;            'myDate' =&amp;gt; array(AttributeType::Mixed),&#xA;        );&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;&#xA;        $rules[] = array('myText', 'required');&#xA;        $rules[] = array('myDate', 'required');&#xA;        $rules[] = array('myDate', 'validDateString');&#xA;&#xA;        return $rules;&#xA;    }&#xA;&#xA;&#xA;     public function validDateString($attribute, $params)&#xA;     {&#xA;         if ( /*  $this-&amp;gt;$attribute is not a valid date  */ )&#xA;         {&#xA;             $this-&amp;gt;addError($attribute, 'Please enter a valid date');&#xA;         }&#xA;     }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;myText&lt;/code&gt; is required OK - the form re-displays with an error message if you try to leave it empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;myDate&lt;/code&gt; is not required - if I leave the date field empty, the form is always successfully submitted, and when I go back to it the field has the date that was previously there.&lt;/li&gt;&#xA;&lt;li&gt;Ignoring that, although &lt;code&gt;validDateString()&lt;/code&gt; gets called, and doing &lt;code&gt;var_dump($this-&amp;gt;$attribute)&lt;/code&gt; looks something like &lt;code&gt;array(1) { [&quot;date&quot;]=&amp;gt; string(0) &quot;18/01/2016&quot; }&lt;/code&gt;, I get &quot;Illegal string offset 'date'&quot; if I try to access &lt;code&gt;$this-&amp;gt;$attribute['date']&lt;/code&gt;. I'm baffled.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-18T12:57:59.623" Title="Validating date fields in a plugin's settings" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13273" PostTypeId="2" ParentId="13200" CreationDate="2016-01-18T11:22:47.940" Score="2" Body="&lt;p&gt;I checked the http headers, and apparently my server was redirecting to a 404 page because the favicon.ico was missing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I uploaded one it all worked fine again. &lt;/p&gt;&#xA;" OwnerUserId="4573" LastActivityDate="2016-01-18T11:22:47.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13274" PostTypeId="1" CreationDate="2016-01-18T11:50:50.497" Score="0" ViewCount="56" Body="&lt;p&gt;Hi not sure if anyone has come across this issue before? I upgraded craft to the latest version on my test site. I have a few custom plugins that I have created on this site. The front-end seems to be working Ok. However I have a strange thing happening in the admin. The settings menu item is re-directing to one of my plugins?? So I can't access the settings at all. The menu link is showing as admin/settings and there are no routes set in either the routes.php config file or anything in the .htaccess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-01-18T12:24:22.483" Title="Bizarre admin menu problem after upgrading craft to latest version" Tags="&lt;routes&gt;&lt;admin&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2016-01-18T15:16:45.750" ContentLicense="CC BY-SA 3.0" />
  <row Id="13275" PostTypeId="2" ParentId="13274" CreationDate="2016-01-18T12:24:22.483" Score="0" Body="&lt;p&gt;I've had this with the Dukt Analytics plugin, hitting Settings took me straight to the Analytics settings and nothing else.&lt;br&gt;&#xA;Not particularly helpful in this instance but an upgrade to the plugin sorted the problem.&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2016-01-18T12:24:22.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13276" PostTypeId="2" ParentId="13272" CreationDate="2016-01-18T12:47:46.117" Score="2" Body="&lt;p&gt;It turns out that because I'm now using my own settings model, I don't need to use &lt;code&gt;AttributeType::Mixed&lt;/code&gt; for my date fields any more. (Thanks to carlcs for suggesting this.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've removed the stuff &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8348/how-do-i-save-a-plugins-date-settings-field/8358#8358&quot;&gt;I had in my Plugin's &lt;code&gt;getSettingsHtml()&lt;/code&gt;&lt;/a&gt;, which massaged the fields before sending them to the template. And now, in theory, I only need to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class My_SettingsModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'myText' =&amp;gt; array(AttributeType::String,&#xA;                            'column' =&amp;gt; ColumnType::Text, 'required' =&amp;gt; true),&#xA;            'myDate' =&amp;gt; array(AttributeType::DateTime,&#xA;                            'column' =&amp;gt; ColumnType::DateTime),&#xA;        );&#xA;    }&#xA;&#xA;    public function rules()&#xA;    {&#xA;        $rules = parent::rules();&#xA;&#xA;        $rules[] = array('myDate', 'date',&#xA;                        'format' =&amp;gt; array('dd/MM/yyyy'),&#xA;                        'allowEmpty' =&amp;gt; false,&#xA;                        'message' =&amp;gt; 'Please enter a valid date');&#xA;&#xA;        return $rules;&#xA;    }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, although the form requires me to enter dates - it doesn't accept empty fields - it won't accept the dates I'm typing in. e.g., if I enter &lt;code&gt;31/12/2016&lt;/code&gt; it fails the date validation. Looking at Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDateTimeParser&quot; rel=&quot;nofollow noreferrer&quot;&gt;date validation docs&lt;/a&gt; I think this should work...&lt;/p&gt;&#xA;" OwnerUserId="3686" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-18T12:57:12.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13277" PostTypeId="1" AcceptedAnswerId="13281" CreationDate="2016-01-18T13:40:47.560" Score="6" ViewCount="979" Body="&lt;p&gt;I'm new to Craft and I'm wondering if Craft is able to display the differences within an entry in different versions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing 2 versions of the entry and highlighting the changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something similar like most of the mergetools do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware that the user can comment the last changes.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2016-01-18T18:01:20.347" LastActivityDate="2017-05-01T05:44:19.077" Title="Comparing 2 versions of an entry and highlighting the changes" Tags="&lt;entry&gt;&lt;entry-versions&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13278" PostTypeId="2" ParentId="13271" CreationDate="2016-01-18T16:28:34.197" Score="2" Body="&lt;p&gt;&lt;strong&gt;The &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;TemplateCacheService&lt;/em&gt;&lt;/a&gt; provides a ton of helpful methods to take care of this for you.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you &lt;em&gt;can&lt;/em&gt; explicitly tell Craft to invalidate certain caches (by element ID, etc.) if you need to, I prefer to use &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService#includeCriteriaInTemplateCaches-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeCriteriaInTemplateCaches()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService#includeElementInTemplateCaches-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;includeElementInTemplateCaches()&lt;/code&gt;&lt;/a&gt; to &lt;em&gt;register&lt;/em&gt; the appropriate element(s)/criteria with the template cache, so that Craft takes care of cache invalidation according to its own internal logic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myCrtieria = ... ; // (some ElementCriteriaModel)&#xA;&#xA;$cacheService = craft()-&amp;gt;getComponent('templateCache', false);&#xA;&#xA;if ($cacheService)&#xA;{&#xA;    $cacheService-&amp;gt;includeCriteriaInTemplateCaches($myCriteria);&#xA;}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;p.s. Unless you really &lt;em&gt;need&lt;/em&gt; to render HTML via a Twig hook, I strongly suggest refactoring to use a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variable&lt;/a&gt; instead.&lt;/strong&gt; Doing so is more consistent with Craft's own internal practice. Twig hooks are typically used to change context variables and perform other logic that is specific to changing how Twig renders templates. For doing content-related business logic (e.g. fetching data from the database and rendering it into templates), using Craft's provided structures will save you trouble down the road.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2016-01-18T16:37:11.350" LastActivityDate="2016-01-18T16:37:11.350" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13279" PostTypeId="1" AcceptedAnswerId="18329" CreationDate="2016-01-18T17:10:01.480" Score="2" ViewCount="872" Body="&lt;p&gt;I used to be able to resize and select align attributes for images in Rich Text and now that feature is completely gone since my last update. Do I need to change settings or has that feature actually been removed?&lt;/p&gt;&#xA;" OwnerUserId="4614" LastActivityDate="2016-12-30T21:18:33.160" Title="Editing images in Rich Text Field" Tags="&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13280" PostTypeId="1" CreationDate="2016-01-18T17:56:05.127" Score="0" ViewCount="122" Body="&lt;p&gt;I'm referencing the Pixel &amp;amp; Tonic sample craft template Happy Lager where in the article body template there's a macro to get the position of a block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to setup a conditional to check if the previous position of a block has been set to 'left'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if prevPosition == 'left' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't seem to work at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/HappyLager/blob/master/craft/templates/_includes/article_body.html&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/HappyLager/blob/master/craft/templates/_includes/article_body.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="116" LastActivityDate="2016-01-20T17:56:34.180" Title="Conditional to check position of previous matrix block" Tags="&lt;conditional&gt;&lt;macro&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13281" PostTypeId="2" ParentId="13277" CreationDate="2016-01-18T18:04:06.523" Score="3" Body="&lt;p&gt;That's currently not a native feature in Craft, but you might want to consider voting for this similar &lt;a href=&quot;https://github.com/craftcms/cms/issues/898&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could pull it off with a custom plugin in the meantime, too.  Since entry revisions are stored between saves, you'd need to pull that revision data from the database using the &lt;a href=&quot;https://craftcms.com/classreference/services/EntryRevisionsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryRevisionsService&lt;/a&gt;, add the business logic for calculating the diffs and come up with a UI for displaying it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="1016" LastEditDate="2017-04-22T14:45:39.517" LastActivityDate="2017-04-22T14:45:39.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13282" PostTypeId="1" CreationDate="2016-01-18T21:36:01.483" Score="1" ViewCount="1038" Body="&lt;p&gt;I'm having some trouble getting started with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to upload some image assets for the first time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set up an asset source. I've tried using both a relative and an absolute path to the file. I am certain that the absolute path name is correct  because I simply copied from the &lt;code&gt;pwd&lt;/code&gt; command on my server. Also, when I look in the directory, I see the uploaded images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also supplied a url for the source. (I've actually tried a few different ones.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time I've made a change, I've gone into settings and run &lt;code&gt;Update Asset Indexes&lt;/code&gt; just to be sure everything was up to date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I try to view the images, I get a 404. I've tried typing the URL into the address bar, as well as clicking on &quot;View asset&quot; on the assets page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13227/assets-images-return-a-404-on-the-front-end&quot;&gt;this similar question&lt;/a&gt;, but I'm not running an nginx server. I'm running Apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love any insight on what I could be doing wrong. If you need any additional information, I'll be more than happy to edit it in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; For clarity, I'm trying to set up my file directory and my url to have different structures, which I believe is possible. For example, I want my images to be in &lt;code&gt;public_html/media/images&lt;/code&gt;, but I want the url for images to be &lt;a href=&quot;http://mysite.com/images&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com/images&lt;/a&gt;. Doing that seems to be what causes the problem. &lt;/p&gt;&#xA;" OwnerUserId="3709" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-19T09:47:24.700" Title="404 when viewing assets" Tags="&lt;assets&gt;&lt;404&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13283" PostTypeId="2" ParentId="13279" CreationDate="2016-01-18T21:55:09.117" Score="5" Body="&lt;p&gt;Alot of features were removed from Redactor II which Craft 2.5 upgraded to. Good thing is, you can revert back to using Redactor I, by installing &lt;a href=&quot;https://github.com/pixelandtonic/RedactorI&quot;&gt;this plugin&lt;/a&gt; from Pixel &amp;amp; Tonic.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-01-18T21:55:09.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13284" PostTypeId="2" ParentId="13282" CreationDate="2016-01-18T22:05:52.127" Score="2" Body="&lt;p&gt;I'll use myself as an example, so if something isn't right we'll know who to blame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing I do is set up an environment variable in my &lt;code&gt;craft/config/general.php&lt;/code&gt; file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://mysite.dev/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;        'baseUrl' =&amp;gt; 'http://mysite.dev/',&#xA;    )&#xA;)&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, when I am creating assets sources, I'll create a general &quot;Images&quot; source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Name: Images&#xA;Handle: images&#xA;File System Path: {basePath}media/images/&#xA;URL: /media/images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I am using my environment variable in the file system path.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can call that whatever you want, it just has to match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you were to view the source of my site, an image that was uploaded would have the path of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.mysite.com/media/images/my-image.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-01-18T22:05:52.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13285" PostTypeId="2" ParentId="13225" CreationDate="2016-01-18T22:16:54.180" Score="1" Body="&lt;p&gt;Here's the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Add dynamic fields&#xA;$entry-&amp;gt;setContentFromPost(craft()-&amp;gt;request-&amp;gt;getParam('fields'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel&quot; rel=&quot;nofollow&quot;&gt;setContentFromPost&lt;/a&gt; requires that if you pass any uploaded files in, you need to pass the field name as a string, instead of the actual posted values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing it to this and it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-18T22:16:54.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13286" PostTypeId="1" AcceptedAnswerId="13291" CreationDate="2016-01-18T22:21:10.300" Score="0" ViewCount="71" Body="&lt;p&gt;Is there a way to allow a user to edit sections without making them site Admins? For example, I have a couple of users that I want to allow them to create new entry types within a Channel, but I don’t want them to be able to access the rest of the Settings section of the CP or do everything an Admin can do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing this is something that will require a custom plugin, but is it possible to sidestep the admin permissions to create new entry types?&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2016-01-19T03:27:40.967" Title="Can a non-admin add Entry types into a section?" Tags="&lt;plugin-development&gt;&lt;admin&gt;&lt;permissions&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13287" PostTypeId="1" AcceptedAnswerId="13292" CreationDate="2016-01-19T00:10:51.177" Score="2" ViewCount="79" Body="&lt;p&gt;I've got a plugin migration that returns &lt;code&gt;false&lt;/code&gt; from its &lt;code&gt;safeUp()&lt;/code&gt; method when certain conditions aren't met.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon returning &lt;code&gt;false&lt;/code&gt; from the migration, the update stalls, rolls back changes and gives an error screen with a generic error message – i.e. &quot;There was a problem updating your database&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For many users (i.e. those who aren't tech savvy enough to check logs etc.) this message isn't very helpful at all. Is it possible to add a custom message when a migration is aborted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried throwing an exception inside &lt;code&gt;safeUp()&lt;/code&gt;, which gets &lt;em&gt;logged&lt;/em&gt; but does not display on the error screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use a &lt;code&gt;die()&lt;/code&gt; statement for the error message, Craft &lt;em&gt;does&lt;/em&gt; display it on the error screen, but that makes the whole update process halt, which seems like an unsafe thing to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also attempted to use &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setError()&lt;/code&gt;, but that doesn't appear to be working, either.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-19T03:30:15.907" Title="Is it possible to add a custom error message when a migration is aborted?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13288" PostTypeId="1" AcceptedAnswerId="13289" CreationDate="2016-01-19T00:53:35.410" Score="1" ViewCount="311" Body="&lt;p&gt;We are working on a plugin that needs to update the contents of a Matrix field within Globals. I've found little snippets of code but none that do exactly this. Can anyone provide some code or point me to some code that does such? I can't seem to figure it out. Code sample of what I have so far is below. This does not result in any sort of area, but also does not seem to do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, I'm trying to force all &lt;code&gt;couponCodes&lt;/code&gt; to be 'BBB' whilst copying all other values. Maybe there is a much better way? It would be nice to just update the code value without recreating the full set of data if possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$couponCodeMatrix = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('couponCodes');&#xA;$newMatrixData = array();&#xA;&#xA;foreach($couponCodeMatrix-&amp;gt;couponCodes as $block) {&#xA;    $blockData = array(&#xA;        'type' =&amp;gt; $block-&amp;gt;getType()-&amp;gt;handle,&#xA;        'enabled' =&amp;gt; true,&#xA;        'fields' =&amp;gt; array(&#xA;            'couponCode' =&amp;gt; 'BBB',&#xA;            'couponType' =&amp;gt; $block-&amp;gt;couponType,&#xA;            'couponValue' =&amp;gt; $block-&amp;gt;couponValue,&#xA;            'expiryDate' =&amp;gt; $block-&amp;gt;expiryDate,&#xA;            'singleUse' =&amp;gt; $block-&amp;gt;singleUse,&#xA;        )&#xA;    );&#xA;&#xA;    $newMatrixData[$block-&amp;gt;id] = $blockData;&#xA;}&#xA;&#xA;$couponCodeMatrix-&amp;gt;setContentFromPost($newMatrixData);&#xA;&#xA;craft()-&amp;gt;globals-&amp;gt;saveContent($couponCodeMatrix);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4616" LastEditorUserId="57" LastEditDate="2016-01-19T03:41:18.030" LastActivityDate="2018-11-28T03:32:33.530" Title="Update globals Matrix via a plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13289" PostTypeId="2" ParentId="13288" CreationDate="2016-01-19T01:38:57.853" Score="1" Body="&lt;p&gt;I do believe you're missing the handle to the top-level Matrix field when you're passing into &lt;code&gt;setContentFromPost&lt;/code&gt;. You should be doing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$couponCodeMatrix-&amp;gt;setContentFromPost(array('couponCodes', $newMatrixData));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you're just passing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'45623':&#xA;    'type': 'blockTypeHandle'&#xA;    'enabled': true,&#xA;    'fields': []&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the global set, instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'couponCodes':&#xA;    '45623':&#xA;        'type': 'blockTypeHandle'&#xA;        'enabled': true,&#xA;        'fields': []&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To deal with fetching even disabled blocks, you'll need to actually query the Matrix field's block directly, rather than looking just at the Global Sets content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;fieldId = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('couponCodes')-&amp;gt;id;&#xA;$criteria-&amp;gt;ownerId = $couponCodeMatrix-&amp;gt;id; // This is your Global Set id&#xA;$criteria-&amp;gt;status = null;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&#xA;foreach($blocks as $block) { }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More complete code for anyone interested. We loop through the matrix and recreate it only if we updated the disabled status on the matching item. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $couponCodeMatrix = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('couponCodes');&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;    $criteria-&amp;gt;fieldId = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('couponCodes')-&amp;gt;id;&#xA;    $criteria-&amp;gt;ownerId = $couponCodeMatrix-&amp;gt;id; // This is your Global Set id&#xA;    $criteria-&amp;gt;status = null;&#xA;    $matrixBlocks = $criteria-&amp;gt;find();&#xA;&#xA;    $b_updateMatrix = false;&#xA;    $o_foundCoupon = false;&#xA;    $newMatrixData = array('couponCodes'=&amp;gt;array());&#xA;    foreach($matrixBlocks as $block){&#xA;&#xA;        $b_enabled = $block-&amp;gt;enabled;&#xA;        if ($this-&amp;gt;couponCheckMatch($s_code, $block)) {&#xA;            $o_foundCoupon = $block;&#xA;            if($block-&amp;gt;singleUse==1){&#xA;                $b_updateMatrix=true;&#xA;                $b_enabled = false;&#xA;            }&#xA;        }&#xA;&#xA;        $blockData = array(&#xA;            'type' =&amp;gt; $block-&amp;gt;getType()-&amp;gt;handle,&#xA;            'enabled' =&amp;gt; $b_enabled,&#xA;            'fields' =&amp;gt; array(&#xA;                'couponCode' =&amp;gt; $block-&amp;gt;couponCode,&#xA;                'couponType' =&amp;gt; $block-&amp;gt;couponType,&#xA;                'couponValue' =&amp;gt; $block-&amp;gt;couponValue,&#xA;                'expiryDate' =&amp;gt; $block-&amp;gt;expiryDate,&#xA;                'singleUse' =&amp;gt; $block-&amp;gt;singleUse,&#xA;            )&#xA;        );&#xA;        $newMatrixData['couponCodes'][$block-&amp;gt;id] = $blockData;&#xA;    }&#xA;    if($b_updateMatrix) {&#xA;        $couponCodeMatrix-&amp;gt;setContentFromPost($newMatrixData);&#xA;        craft()-&amp;gt;globals-&amp;gt;saveContent($couponCodeMatrix);&#xA;    }  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="4616" LastEditDate="2016-01-19T22:59:23.753" LastActivityDate="2016-01-19T22:59:23.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13290" PostTypeId="1" AcceptedAnswerId="13293" CreationDate="2016-01-19T02:22:55.177" Score="3" ViewCount="1305" Body="&lt;p&gt;Hi guys so I am having an issue with the &quot;generating pending image transforms&quot; being stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen the solution listed here &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt; telling me to go to the craft_tasks table and fix the error. But I cannot for the life of me figure out how to get to this table. Where is it? No one seems to explain this.&lt;/p&gt;&#xA;" OwnerUserId="3737" LastActivityDate="2020-07-04T02:30:15.443" Title="Resolving “Stuck” Background Tasks" Tags="&lt;cache&gt;&lt;tasks&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13291" PostTypeId="2" ParentId="13286" CreationDate="2016-01-19T03:27:40.967" Score="2" Body="&lt;p&gt;You would have to write a custom plugin that provided its own UI (outside of the Settings portion of the control panel) and that plugin's controller could mimic Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/SectionsController&quot; rel=&quot;nofollow&quot;&gt;SectionsController&lt;/a&gt; (with the exception of not requiring an admin) while calling SectionsService's &lt;a href=&quot;https://craftcms.com/classreference/services/SectionsService#saveEntryType-detail&quot; rel=&quot;nofollow&quot;&gt;saveEntryType&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For security your plugin should also register a custom &quot;canSaveEntryType&quot; &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerUserPermissions&quot; rel=&quot;nofollow&quot;&gt;permission&lt;/a&gt; so you can have fine-grained control over who can call that method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-19T03:27:40.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13292" PostTypeId="2" ParentId="13287" CreationDate="2016-01-19T03:30:15.907" Score="2" Body="&lt;p&gt;Currently not, but as Lindsey points out, that's not a bad idea for a &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-19T03:30:15.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13293" PostTypeId="2" ParentId="13290" CreationDate="2016-01-19T03:35:18.707" Score="6" Body="&lt;p&gt;The easiest way is to use a GUI MySQL client to connect to the Craft database and edit the table directly.  Popular ones include &lt;a href=&quot;http://www.navicat.com/&quot; rel=&quot;noreferrer&quot;&gt;Navicat&lt;/a&gt; and &lt;a href=&quot;http://www.sequelpro.com/&quot; rel=&quot;noreferrer&quot;&gt;Sequel Pro&lt;/a&gt;, but there is a good list &lt;a href=&quot;https://www.quora.com/What-is-the-best-MySQL-client-for-Mac-OS-X-or-Windows&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; of options for both OSX and Windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you connect to the database, you can edit the data in the &lt;code&gt;craft_tasks&lt;/code&gt; table and change the value of &lt;code&gt;status&lt;/code&gt; from &lt;code&gt;running&lt;/code&gt; to &lt;code&gt;pending&lt;/code&gt; to re-trigger it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-19T03:35:18.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13294" PostTypeId="2" ParentId="13290" CreationDate="2016-01-19T09:28:30.727" Score="6" Body="&lt;p&gt;If you want an even more user friendly way of doing it, install the &lt;a href=&quot;https://github.com/boboldehampsink/taskmanager&quot;&gt;Task Manager plugin by Bob Olde Hampsink&lt;/a&gt;, and you can do it from the Craft control panel. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-01-19T09:28:30.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13295" PostTypeId="1" AcceptedAnswerId="13297" CreationDate="2016-01-19T09:40:06.020" Score="4" ViewCount="518" Body="&lt;p&gt;As you can see from the image below, the icons are missing from redactor I. Has anybody else had this issue? Running dev tools in chrome shows no errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bold, for example has the following css selector:    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;.re-bold:before {&#xA;  content: &quot;\e618&quot;;&#xA;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that the @font-face src is base64 encoded right into the CSS file, so the issue can't be because of a missing font file for the icons can it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BIMAk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BIMAk.png&quot; alt=&quot;Missing icons in Redactor I&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the bold link inspected in dev tools:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wfXZY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wfXZY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see there is no mention of .re-icon in the markup, but the only declaration of the font-family: 'RedactorFont' is for the .re-icon selector class. So adding .re-button::before to the selector that declares the font results in this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8xkFm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8xkFm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...Close but not quite right. I shouldn't be editing these files, but am just doing so to help diagnose this. Presumably this redactor.css file shouldn't be referenced... it should be redactori.css?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-01-19T09:51:35.817" LastActivityDate="2016-01-19T10:46:48.590" Title="Redactor I icons missing" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13296" PostTypeId="2" ParentId="13282" CreationDate="2016-01-19T09:47:24.700" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, &lt;strong&gt;I want my images to be&lt;/strong&gt; in public_html/media/images, but I want the url for images to be &lt;a href=&quot;http://mysite.com/images&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/images&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When you configure an asset source you tell Craft where to find the images, not where you want them to be.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-19T09:47:24.700" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13297" PostTypeId="2" ParentId="13295" CreationDate="2016-01-19T10:46:48.590" Score="3" Body="&lt;p&gt;It seemed that for some reason my fields said they were Redactor I but were in fact Redactor II.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reinstalling Redactor I did the trick.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-19T10:46:48.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13298" PostTypeId="1" AcceptedAnswerId="13307" CreationDate="2016-01-19T11:11:42.453" Score="0" ViewCount="141" Body="&lt;p&gt;As you can see from the craft.log, venti is causing an issue with template refresh:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/01/19 10:59:27 [info] [application] [Forced] Starting step 242 of 828 total steps.&#xA;&#xA;2016/01/19 10:59:27 [info] [application] [Forced] Starting step 243 of 828 total steps.&#xA;&#xA;2016/01/19 10:59:27 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'venti.startDate' in 'order clause'. The SQL statement executed was: SELECT `elements`.`id`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`&#xA;&#xA;FROM `craft_elements` `elements`&#xA;&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;&#xA;WHERE (((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements_i18n.enabled = 1)&#xA;&#xA;GROUP BY `elements`.`id`&#xA;&#xA;ORDER BY `venti`.`startDate` ASC LIMIT 5.&#xA;&#xA;2016/01/19 10:59:27 [error] [application] Encountered an error running task 5 (DeleteStaleTemplateCaches), step 243 of 828: An exception was thrown: CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'venti.startDate' in 'order clause'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anybody else had this issue? Frustrating as it means my cache isn't working properly, causing 'Failed Task' to show up in the Admin for the client and I'm not sure but may be affecting other areas of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-19T21:17:15.357" Title="Venti Events causing failed DeleteStaleTemplateCaches task" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13299" PostTypeId="1" AcceptedAnswerId="13300" CreationDate="2016-01-19T12:00:43.753" Score="3" ViewCount="1226" Body="&lt;p&gt;I am using this code to include a js file, but it adds to the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile '/path/script.min.js' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to add it to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; instead, how can I do?&lt;/p&gt;&#xA;" OwnerUserId="3606" LastActivityDate="2016-01-19T12:46:45.313" Title="how to includeJsFile in head instead of body" Tags="&lt;files&gt;&lt;includejs&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13300" PostTypeId="2" ParentId="13299" CreationDate="2016-01-19T12:17:35.987" Score="4" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://craftcms.com/docs/templating/functions#getFootHtml&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;getFootHtml&lt;/code&gt;&lt;/a&gt; function to tell Craft where to output HTML queued up with &lt;code&gt;includeJsFile&lt;/code&gt; and &lt;code&gt;includeJs&lt;/code&gt;. You'd normally have that tag somewhere at the end of your &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;. But all it does is to get all queued up HTML and output it, so if your JS are already &quot;included&quot;, you can use it in &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing you could do is to not use the &lt;code&gt;includeJsFile&lt;/code&gt; function to add the HTML to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;, but use a different approach. Here's an example using a var and an example using a dedicated Twig block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;index.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'base.html' %}&#xA;&#xA;{% set headHtml = '&amp;lt;script src=&quot;{{ url('assets/javascripts/myscript.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;' %}&#xA;&#xA;{% block head %}&#xA;    {{ parent() }}&#xA;&#xA;    &amp;lt;!-- Scripts --&amp;gt;&#xA;    &amp;lt;script src=&quot;{{ url('assets/javascripts/myscript.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;base.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    {% block head %}&#xA;        &amp;lt;!-- Document head --&amp;gt;&#xA;        &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;&#xA;        {% if headHtml is defined %}&#xA;            &amp;lt;!-- Scripts --&amp;gt;&#xA;            {{ headHtml }}&#xA;        {% endif %}&#xA;    {% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-19T12:46:45.313" LastActivityDate="2016-01-19T12:46:45.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13301" PostTypeId="2" ParentId="13299" CreationDate="2016-01-19T12:44:02.543" Score="2" Body="&lt;p&gt;You can queue files with &lt;code&gt;includeJsFile&lt;/code&gt;, &lt;code&gt;includeJs&lt;/code&gt; and output &lt;code&gt;getFootHtml()&lt;/code&gt; anywhere on your page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've called &lt;code&gt;getFootHtml()&lt;/code&gt; the queue will be cleared allowing you to use &lt;code&gt;includeJsFile&lt;/code&gt; again later in your template i.e. both in the &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This doesn't appear in the documentation.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4118" LastActivityDate="2016-01-19T12:44:02.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13302" PostTypeId="1" AcceptedAnswerId="13304" CreationDate="2016-01-19T15:44:54.340" Score="2" ViewCount="50" Body="&lt;p&gt;I need to output a JSON object containing all of the key/value pairs in either &lt;code&gt;/translations/{myLocale}.php&lt;/code&gt; or &lt;code&gt;/craft/plugins/myplugin/translations/{myLocale}.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see any way of doing that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that I can call &lt;code&gt;craft()-&amp;gt;getComponent('messages')&lt;/code&gt; but that will retrieve all of Craft's internal translations - I only want the messages I have defined in one of the files above.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2016-01-19T16:31:11.607" Title="How can I output ALL strings from a lang file?" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13303" PostTypeId="1" AcceptedAnswerId="13305" CreationDate="2016-01-19T16:12:52.077" Score="0" ViewCount="2681" Body="&lt;p&gt;Is there a way to use Twig's &lt;code&gt;{% spaceless %}&lt;/code&gt; tag only under certain conditions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you wanted the HTML to be spaceless in the live environment but wanted it uncompressed in the dev environment. I tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if isDev %}&#xA;    {% spaceless %}&#xA;{% endif %}&#xA;{# Some code... #}&#xA;{% if isDev %}&#xA;    {% endspaceless %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this just throws a Twig error.&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2016-01-19T18:29:10.707" Title="Use twig's {% spaceless %} tag only under certain conditions" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13304" PostTypeId="2" ParentId="13302" CreationDate="2016-01-19T16:21:11.797" Score="3" Body="&lt;p&gt;You could &lt;a href=&quot;http://php.net/manual/en/function.include.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; the translations file into your controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$translationsFile = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'myplugin/translations/de.php';&#xA;$translationsArray = include $translationsFile;&#xA;&#xA;$this-&amp;gt;returnJson(array_keys($translationsArray));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-19T16:31:11.607" LastActivityDate="2016-01-19T16:31:11.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13305" PostTypeId="2" ParentId="13303" CreationDate="2016-01-19T17:43:57.170" Score="6" Body="&lt;p&gt;Yes, Twig (sometimes) complains if you're splitting tags which belong together into different conditionals, I ran into that issue in a similar situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as already noted in the comments, I'm also curious why you want to split the &lt;code&gt;spaceless&lt;/code&gt; tag. If it's about minifying HTML, the tag isn't very efficient anyways and I'd recommend to use something like Andrew Welch's &lt;a href=&quot;https://github.com/nystudio107/minify&quot;&gt;Minify plugin&lt;/a&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-19T17:43:57.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13306" PostTypeId="2" ParentId="13303" CreationDate="2016-01-19T18:29:10.707" Score="7" Body="&lt;p&gt;You could do it by buffering your output, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set output %}&#xA;{# Your code here #}&#xA;{% endset %}&#xA;&#xA;{% if isDev %}&#xA;     {{ output }}&#xA;{% else %}&#xA;    {% spaceless %}&#xA;        {{ output }}&#xA;    {% endspaceless %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-19T18:29:10.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13307" PostTypeId="2" ParentId="13298" CreationDate="2016-01-19T21:17:15.357" Score="1" Body="&lt;p&gt;0.9.14 is still the beta version.  Go into the Venti_EventManageService file and delete the two lines with this string &lt;code&gt;craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElement($element);&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-01-19T21:17:15.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13308" PostTypeId="1" CreationDate="2016-01-19T21:45:43.400" Score="5" ViewCount="3244" Body="&lt;p&gt;Left, Center, Right -- Can the text alignment button be added to Redactor 2, and if so, how?&lt;/p&gt;&#xA;" OwnerUserId="3780" LastActivityDate="2016-02-16T14:48:28.347" Title="Redactor 2 - Can a text alignment button be added?" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13309" PostTypeId="1" CreationDate="2016-01-19T23:17:55.187" Score="1" ViewCount="202" Body="&lt;p&gt;I'm having an issue where the admin is kicking a user out after an indefinite period of time. The corresponding error message is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Tried to restore session from a cookie, but the given hashed database token value does not appear to belong to the given login name. Hashed db value: 5740fb357a555db6a1ee9e9ea2160179daeed342czozMjoiWjdzUk94ZHVSZGJlMEVOT2JyUFJxcmxkY01FeGhoeU0iOw== and loginName: omitted for stack exchange.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few minutes later I see another error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2016/01/19 21:53:16 [error] [application] Tried to read the folder contents of /home/domain.com/craft/storage/runtime/cache/, but could not.&#xA;2016/01/19 21:53:16 [error] [application] Tried to read the folder contents of /home/domain.com/craft/storage/runtime/assets/, but could not.&#xA;2016/01/19 21:53:16 [error] [application] Tried to read the folder contents of /home/domain.com/craft/storage/runtime/temp/, but could not.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My craft directory is installed above my public_html directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some things I've tried:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Verified permissions [755] for the app, config and storage directories.&lt;/li&gt;&#xA;&lt;li&gt;Set overridePhpSession = true&lt;/li&gt;&#xA;&lt;li&gt;Set userSessionDuration = false&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have not been able to duplicate the error, so at this point I would have to say the error is only effecting 1 user. I had him try a different browser (chrome was previously using IE) and clear his cookies as well. The error still happened in chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions you have are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="3723" LastEditDate="2016-01-20T12:29:13.977" LastActivityDate="2016-01-20T12:29:13.977" Title="Admin Forcing Logout" Tags="&lt;admin&gt;&lt;error&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13310" PostTypeId="2" ParentId="13308" CreationDate="2016-01-19T23:30:52.490" Score="9" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot;&gt;&lt;code&gt;formattingAdd&lt;/code&gt;&lt;/a&gt; config setting to add custom formatting to the &quot;Format&quot; dropdown.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;formattingAdd: {&#xA;  &quot;align-left&quot;: {&#xA;    &quot;title&quot;: &quot;Align left&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;,&quot;class&quot;,&quot;align-left&quot;],&#xA;  },&#xA;  &quot;align-right&quot;: {&#xA;    &quot;title&quot;: &quot;Align right&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;,&quot;class&quot;,&quot;align-right&quot;],&#xA;  },&#xA;  &quot;align-center&quot;: {&#xA;    &quot;title&quot;: &quot;Align center&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;,&quot;class&quot;,&quot;align-center&quot;],&#xA;  },&#xA;  &quot;align-justify&quot;: {&#xA;    &quot;title&quot;: &quot;Justify&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;,&quot;class&quot;,&quot;align-justify&quot;],&#xA;  },&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to have a separate dropdown or individual buttons in the toolbar for this functionality, have a look at my plugin &lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot;&gt;Redactor Inline Styles&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-19T23:30:52.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13312" PostTypeId="1" CreationDate="2016-01-20T05:37:00.940" Score="1" ViewCount="277" Body="&lt;p&gt;I have searched the forum and cannot find the answer to my question.&#xA;I know how to populate a dropdown with the categories that are already in the system, but what happens if the category that needs to be assigned to the entry doesn't exist in the list of categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is this. Is there a way to display the dropdown of categories, as well as having the ability to add more categories via a form on the front-end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4623" LastActivityDate="2016-01-25T13:01:33.687" Title="Categories on a Front-end form" Tags="&lt;entries&gt;&lt;categories&gt;&lt;form&gt;&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13313" PostTypeId="1" AcceptedAnswerId="13314" CreationDate="2016-01-20T07:27:08.433" Score="2" ViewCount="400" Body="&lt;p&gt;Is it possible to redirect a certain user type to the entry front-end page once they click on Save from the CP?&lt;/p&gt;&#xA;" OwnerUserId="4623" LastActivityDate="2016-01-20T09:41:11.243" Title="On Entry Creation Redirect" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;redirect&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13314" PostTypeId="2" ParentId="13313" CreationDate="2016-01-20T09:24:08.333" Score="4" Body="&lt;p&gt;You'd have to write a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt;, that adds an &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;event listener&lt;/a&gt; for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries.saveEntry&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The event listener should go into your plugin's primary class' &lt;code&gt;init&lt;/code&gt; method. You'll need to make sure the event listener only fires for Control Panel requests, and that the currently logged in user is assigned to the user group you want to apply this to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also make sure the entry being saved has a URL (not all entry types do) before attempting to redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a working example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    parent::init();&#xA;&#xA;    // Get the currently logged in user&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;    // Only add the event listener for Control Panel requests, and if the user is in a certain group&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; $user &amp;amp;&amp;amp; $user-&amp;gt;isInGroup('userGroupHandle')) {&#xA;&#xA;        craft()-&amp;gt;on('entries.saveEntry', function (Event $event) {&#xA;&#xA;            // Redirect to the entry&#xA;            $entry = $event-&amp;gt;params['entry'];&#xA;            if ($entry-&amp;gt;url) {&#xA;                craft()-&amp;gt;request-&amp;gt;redirect($entry-&amp;gt;url);&#xA;            }&#xA;&#xA;        });&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, you'll need to change the &lt;code&gt;userGroupHandle&lt;/code&gt; string to the handle for your particular user group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're unfamiliar with plugin development for Craft, I'd recommend taking a look at the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic&lt;/a&gt; template plugin or the &lt;a href=&quot;http://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;pluginfactory.io&lt;/a&gt; generator app – as well as the &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;official docs&lt;/a&gt; on the subject, of course.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-20T09:41:11.243" LastActivityDate="2016-01-20T09:41:11.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13315" PostTypeId="1" AcceptedAnswerId="13317" CreationDate="2016-01-20T10:46:44.477" Score="1" ViewCount="91" Body="&lt;p&gt;I have a dropdown Matrix block and need to check whether a selected value is either one or another.  If either value is selected I want to display some text on the front end.  At the moment I have &lt;code&gt;{% if block.wellFormattedContent =='toBeActioned' OR block.wellFormattedContent =='partiallyActioned' %}&lt;/code&gt; but it errors.  Hopefully you can see what i'm trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2016-01-20T12:39:27.933" Title="Correct syntax for an OR conditional within a Matrix block" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13316" PostTypeId="2" ParentId="9277" CreationDate="2016-01-20T10:50:08.647" Score="2" Body="&lt;p&gt;You can add a new filter to twig that returns an empty string if the date is null or '0000-00-00', or if not reverts to Twig's built in date filter.&#xA;Here I've called it 'dateInclEmpty' &lt;em&gt;(trying to think of a better name)&lt;/em&gt;, you can otherwise use it in the same way as the existing date filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$filter = function(Twig_Environment $env){&#xA;    return new Twig_SimpleFilter('dateInclEmpty', function ($date,$format,$timezone) use($env){&#xA;        if (is_null($date) || $date == '0000-00-00'){&#xA;            return &quot;&quot;;&#xA;        }&#xA;        else {&#xA;            return twig_date_format_filter($env,$date,$format,$timezone);&#xA;        }&#xA;    });&#xA;};&#xA;$twig-&amp;gt;addFilter($filter($twig));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Thanks for the advice Lindsey, let's see if this is any better :-P)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4626" LastEditorUserId="4626" LastEditDate="2016-01-22T10:48:15.427" LastActivityDate="2016-01-22T10:48:15.427" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13317" PostTypeId="2" ParentId="13315" CreationDate="2016-01-20T11:17:47.310" Score="2" Body="&lt;p&gt;As already noted by @Benjammin' in the comments, the &lt;code&gt;or&lt;/code&gt; operator has to be lowercase. See &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#logic&quot; rel=&quot;nofollow&quot;&gt;Logic Expressions&lt;/a&gt; in the Twig docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Operators are case sensitive.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You also have to get the dropdown value explicitly by accessing its &lt;code&gt;value&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.wellFormattedContent.value == 'toBeActioned' or block.wellFormattedContent.value == 'partiallyActioned' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The short syntax &lt;code&gt;{{ block.wellFormattedContent }}&lt;/code&gt; (which internally uses the field's &lt;code&gt;toString()&lt;/code&gt; magic method) causes problems within Twig conditionals. You can probably also get around this issue by wrapping it in curly braces.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (block.wellFormattedContent) == 'toBeActioned' or (block.wellFormattedContent) == 'partiallyActioned' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-20T12:39:27.933" LastActivityDate="2016-01-20T12:39:27.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13318" PostTypeId="2" ParentId="12977" CreationDate="2016-01-20T12:54:59.343" Score="2" Body="&lt;p&gt;Disabling Sprout invisible captcha fixed this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if there is an update to this fieldtype plugin to fix this. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-20T12:54:59.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13320" PostTypeId="1" AcceptedAnswerId="13321" CreationDate="2016-01-20T15:47:28.897" Score="3" ViewCount="490" Body="&lt;p&gt;I have a live entry with an 'eventTime' text field having the content &lt;strong&gt;'2pm'&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have an unpublished draft saved for that same entry with the 'eventTime' field having the content &lt;strong&gt;'3pm'&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the following code in my front end template to retrieve the draft for the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('events').type('ofs').status(null).limit(1).first() %}&#xA;{% if entry and entry.enabled %}&#xA;    {% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;    {% if drafts %}&#xA;        {% set entry = drafts[0] %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yet the following tag in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.eventTime }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Always displays &lt;strong&gt;'2pm'&lt;/strong&gt; - even though I know the draft is being loaded, as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.draftId }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputs the correct draft ID value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get it to display &lt;strong&gt;'3pm'&lt;/strong&gt; - i.e. the correct content for the draft being loaded? I've noticed that draft data is stored differently in the database (shoved into a field called 'data' in the 'craft_entryDrafts' table). How do I get at it?&lt;/p&gt;&#xA;" OwnerUserId="804" LastActivityDate="2016-01-20T16:07:26.887" Title="Get draft content in front end form" Tags="&lt;entry&gt;&lt;frontend&gt;&lt;draft&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13321" PostTypeId="2" ParentId="13320" CreationDate="2016-01-20T16:07:26.887" Score="8" Body="&lt;p&gt;Figured this out myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'getDraftsByEntryId' function is only intended for displaying the list of drafts, so there is no need to populate the model (a potentially expensive task). Indeed, there is a line that unsets the 'fields' part of the data in the EntryRevisionsService.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Don't initialize the content&#xA;unset($result['data']['fields']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Handily, there is another function called 'getDraftById' that I was able to use, which &lt;em&gt;does&lt;/em&gt; populate the model. Therefore, my amended (and working) code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('events').type('ofs').status(null).limit(1).first() %}&#xA;{% if entry and entry.enabled %}&#xA;    {% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;    {% if drafts %}&#xA;        {% set entry = craft.entryRevisions.getDraftById(drafts[0].draftId) %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Boom!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="804" LastActivityDate="2016-01-20T16:07:26.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13322" PostTypeId="2" ParentId="709" CreationDate="2016-01-20T16:18:57.090" Score="2" Body="&lt;p&gt;I just had the same issue of the Live Preview button not displaying. &#xA;I followed the instructions from Brandon and Brad and still did not see the live preview button.&#xA;&lt;strong&gt;It was not till that I created the template in the template directory that the live preview button appeared&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Craft Pro 2.5.2759, installed on my local machine with MAMP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps others coming to this page with the same issue.&lt;/p&gt;&#xA;" OwnerUserId="3571" LastActivityDate="2016-01-20T16:18:57.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13323" PostTypeId="2" ParentId="13308" CreationDate="2016-01-20T17:16:20.280" Score="1" Body="&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also discovered this plugin which allows the addition of styles to the redactor editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RedactorStyleIt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/RedactorStyleIt-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/RedactorStyleIt-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OnKN2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OnKN2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3780" LastActivityDate="2016-01-20T17:16:20.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13324" PostTypeId="1" CreationDate="2016-01-20T18:51:08.283" Score="0" ViewCount="509" Body="&lt;p&gt;I wanted to create a php which allow admin to upload their pictures in any resolution and image file type, but it has to display into a bootstrap carousel with fixed size. &#xA;Does anyone has the similar script I can have a look?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might needed to do the following;&#xA;Upload image into a specific location, convert image type into jpg, specific resolution, and be able to read by bootstrap carousel. My head is about to broke thinking of this script :(&lt;/p&gt;&#xA;" OwnerUserId="4629" LastActivityDate="2016-01-20T19:04:15.893" Title="Upload any size image into carousel" Tags="&lt;plugins&gt;&lt;image&gt;&lt;php&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13325" PostTypeId="2" ParentId="13324" CreationDate="2016-01-20T19:04:15.893" Score="5" Body="&lt;p&gt;You shouldn't need to create a custom plugin to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily create a &lt;a href=&quot;https://craftcms.com/features/matrix&quot;&gt;Matrix&lt;/a&gt; content field for your carousel. Create a new block called &lt;code&gt;slide&lt;/code&gt;. From there you can create an &lt;code&gt;asset&lt;/code&gt; field to upload the slide image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can render this into whatever markup you'd like (even bootstrap).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for cropping an image and converting it into a jpg, check out &lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor&quot;&gt;Aviary Image Editor&lt;/a&gt;. It's a wysiwyg editor in the admin panel for doing exactly what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2016-01-20T19:04:15.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13326" PostTypeId="1" CreationDate="2016-01-21T00:59:14.473" Score="1" ViewCount="1439" Body="&lt;p&gt;I am trying to paste Vimeo's embed code to the body of an entry like this-&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;and instead of showing the video, I get a link to the video. Can I embed it this way by putting the code in the body field? Or do I need to &#xA;use a plugin such as Embedder?&lt;/p&gt;&#xA;" OwnerUserId="4186" LastActivityDate="2016-02-03T06:04:59.783" Title="Vimeo Embedding" Tags="&lt;plugin-embedder&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13327" PostTypeId="1" AcceptedAnswerId="13341" CreationDate="2016-01-21T02:11:48.470" Score="1" ViewCount="1367" Body="&lt;p&gt;I am utilizing a CSS class within headlines for responsive line breaks. This class shows the line break for large displays and hides the break for small displays.&lt;/p&gt;&#xA;&lt;p&gt;Using the HTML/Source button within Redactor works fine until the entry is saved.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Line breaks were the first thought.&amp;lt;br class=&amp;quot;hide-for-small show-for-large&amp;quot;&amp;gt; Not an afterthought.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code above produces this for large displays:&lt;/p&gt;&#xA;&lt;h1&gt;Line breaks were the first thought.&lt;/h1&gt;&#xA;&lt;h1&gt;Not an afterthought.&lt;/h1&gt;&#xA;&lt;p&gt;And should produce this for small displays:&lt;/p&gt;&#xA;&lt;h1&gt;Line breaks were the first thought. Not an afterthought.&lt;/h1&gt;&#xA;&lt;p&gt;However the white space after the line break is removed upon save, which produces this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Line breaks were the first thought.&amp;lt;br class=&amp;quot;hide-for-small show-for-large&amp;quot;&amp;gt;Not an afterthought.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which displays like this on small displays:&lt;/p&gt;&#xA;&lt;h1&gt;Line breaks were the first thought.Not an afterthought.&lt;/h1&gt;&#xA;&lt;p&gt;This is not the desired result.&lt;/p&gt;&#xA;&lt;p&gt;While I am able to correct this with the Twig replace filter, I would prefer not having to manage those filters within the templates.&lt;/p&gt;&#xA;&lt;p&gt;Any clue how to prevent the original white space from being removed after line breaks within a Rich Text Field?&lt;/p&gt;&#xA;&lt;p&gt;(Note the white space is not removed within Plain Text Fields.)&lt;/p&gt;&#xA;" OwnerUserId="3735" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-11-23T03:52:37.680" Title="How do you prevent white space from being removed after line breaks within a Rich Text Field?" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;whitespace&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13328" PostTypeId="2" ParentId="13326" CreationDate="2016-01-21T04:00:16.910" Score="3" Body="&lt;p&gt;I am assuming you're using a rich text field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, Redactor (the library that powers rich text editing in Craft) has a video embed plugin: &lt;a href=&quot;https://imperavi.com/redactor/plugins/video/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/plugins/video/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To install Redactor plugins in Craft, see this post to get you started: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9881/install-redactor-plugin&quot;&gt;Install Redactor plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However this kind of content complexity was really what the Matrix field type was made for. Mixing text and media elements in a single field can get quite cumbersome. This video should help you understand how you can implement mixing text and embedded video the &quot;Craft&quot; way: &lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/features/matrix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-21T04:00:16.910" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13329" PostTypeId="1" AcceptedAnswerId="13340" CreationDate="2016-01-21T04:35:36.560" Score="2" ViewCount="247" Body="&lt;p&gt;I have a plugin that is listening for a form submit.&#xA;Within that form are two fields &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;agreeToTerms&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the form is submitted, I am updating an existing entry with the values that were posted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get all fields to update except my checkbox. I'm not sure what I need to send to craft if the user has checked the checkbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyController&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$postDateTime = ...&#xA;&#xA;...&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'agreeToTerms' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('fields.agreeToTerms'),&#xA;    'firstName' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('fields.electronicSignature'),&#xA;    'signatureDate' =&amp;gt; $postDateTime&#xA;));&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns &quot;1&quot; which is the value of the checkbox.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields.agreeToTerms') // returns 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that isn't what I need to send to Craft. If I were using jquery, I am looking for something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.prop('checked', true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help clarify in case someone else comes across this thread, as @carlcs stated I was in fact talking about a checkbox field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin I am using allows users to create entries in a section. When an entry is created, one of the fields is a checkbox. I was attempting to set the checkbox field as checked if the user had checked the corresponding checkbox when the entry was created.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-22T14:27:59.743" LastActivityDate="2016-01-22T14:29:03.777" Title="How can I update a checkbox from a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13330" PostTypeId="1" CreationDate="2016-01-21T12:02:46.193" Score="5" ViewCount="507" Body="&lt;p&gt;I am working on a news section. There is a single featured news story so the lightswitch marked with ('1') displays the latest entry as the featured story. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below this the rest of the entries are displayed so here I then display all other latest entries with the lightswitch marked with ('0') or in this case ('not 1').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that if two or three entries are all marked as the featured story (or a user creates an entry and marks it as featured then repeats a few days later and doesn't uncheck the previous one) then they will not display in the below section. Is there anyway to only allow one lightswitch to be checked as ('1') at any one time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Featured entry:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% for entry in craft.entries.section('news').featured('1').limit(1) %}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All other news entries:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% for entry in craft.entries.section('news').limit(4).featured('not 1') %}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3917" LastActivityDate="2016-01-21T15:27:57.787" Title="Only allow one Lightswitch to be active at a time" Tags="&lt;lightswitch&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13331" PostTypeId="2" ParentId="13330" CreationDate="2016-01-21T12:51:21.503" Score="6" Body="&lt;p&gt;You'd have to write a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot;&gt;custom plugin&lt;/a&gt; that added an &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot;&gt;event listener&lt;/a&gt; for the  &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot;&gt;&lt;code&gt;entries.saveEntry&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the event listener, you could check if the entry being saved has a &lt;code&gt;true&lt;/code&gt; value for the &lt;code&gt;featured&lt;/code&gt; Lightswitch field, and if so – pull all other entries with a &lt;code&gt;true&lt;/code&gt; value for that same field (in the same section), setting their &lt;code&gt;featured&lt;/code&gt; attribute to &lt;code&gt;false&lt;/code&gt; before re-saving them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like the below would go into your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function (Event $event) {&#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entry-&amp;gt;section-&amp;gt;handle !== 'news' || !$entry-&amp;gt;featured) {&#xA;            return false;&#xA;        }&#xA;&#xA;        // Get all entries from the same section with a `true` value for the Lightswitch field&#xA;        $entries = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, array(&#xA;            'section' =&amp;gt; 'news',&#xA;            'featured' =&amp;gt; true,&#xA;            'id' =&amp;gt; 'not ' . $entry-&amp;gt;id,&#xA;            'limit' =&amp;gt; null,&#xA;        ))-&amp;gt;findAll();&#xA;&#xA;        // Update all other entries' Lightswitch field value to `false`&#xA;        foreach ($entries as $entry) {&#xA;            $entry-&amp;gt;getContent()-&amp;gt;setAttribute('featured', false);&#xA;            craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;        }&#xA;&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're new to plugin development in Craft, I'd suggest looking at the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;Business Logic plugin template&lt;/a&gt; or the &lt;a href=&quot;http://pluginfactory.io/&quot;&gt;pluginfactory.io app&lt;/a&gt; – also it'd be a good idea to read &lt;a href=&quot;https://craftcms.com/docs/plugins&quot;&gt;the official docs&lt;/a&gt; on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to write a plugin, you could also solve this by foregoing the &lt;code&gt;featured&lt;/code&gt; field for the entries. If you added a &lt;code&gt;featuredNewsStory&lt;/code&gt; Entries field to a &lt;a href=&quot;https://craftcms.com/docs/globals&quot;&gt;Global Set&lt;/a&gt; instead (and limited the Entries field to 1 entry), you'd make sure that there was only ever one featured news story in the system. &lt;em&gt;The editiorial workflow would suffer, though&lt;/em&gt; – publishing a new, featured news story in this manner would mean that the editor would first have to create the story, then pop into the Global Set after saving the entry to actually mark it as &quot;featured&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, here's how you could pull the featured news story from a global, as well as the other news stories that &lt;em&gt;aren't&lt;/em&gt; featured:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredNewsStory = yourGlobalSetHandle.featuredNewsStory.first() %}&#xA;{% set otherNewsStories = craft.entries.section('news').id(featuredNewsStory ? 'not ' ~ featuredNewsStory.id : null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, there is another possible &quot;workaround&quot; here: continue with your current solution, but add another clause; making sure that the featured news story pulled is the &lt;em&gt;newest one&lt;/em&gt; only:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredNewsStory = craft.entries.section('news').featured(1).order('postDate desc').limit(1).first() %}&#xA;{% set otherNewsStories = craft.entries.section('news').id(featuredNewsStory ? 'not ' ~ featuredNewsStory.id : null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above in place, you could just communicate to your client that &quot;if you set more than one entry to be featured, only the newest one will actually &lt;em&gt;display&lt;/em&gt; as featured&quot; or the like.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-21T15:27:57.787" LastActivityDate="2016-01-21T15:27:57.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13332" PostTypeId="2" ParentId="13330" CreationDate="2016-01-21T12:54:33.207" Score="4" Body="&lt;p&gt;There's no way of linking the value of lightswitch fields between entries in Craft (or even within the same entry, but then a radio button field type would be more suitable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a &lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;Global&lt;/code&gt;&lt;/a&gt; to hold the featured story. This would have an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries&lt;/code&gt; field&lt;/a&gt;, limited to one entry (or however many featured stories you wanted to have). You can limit the entries field to only being able to link to entries from one section if you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives you a central place to set the featured entries, independent of the individual entries. This setting the featured entry can be done easily without needing to edit multiple entries and to try and remember which entry is currently set to be the featured one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;code&gt;Global&lt;/code&gt; was called &lt;code&gt;featuredStories&lt;/code&gt;, and the &lt;code&gt;entries&lt;/code&gt; filed called &lt;code&gt;selectedEntries&lt;/code&gt;, you would get the list of &lt;code&gt;entryIds&lt;/code&gt; for the featured entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntryIds = featuredStories.selectedEntries.ids() | join(',') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which you can use to find the featured entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').id(featuredEntryIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the other news entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').id('not ' ~ featuredEntryIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-01-21T12:54:33.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13333" PostTypeId="1" AcceptedAnswerId="13345" CreationDate="2016-01-21T13:56:37.007" Score="0" ViewCount="91" Body="&lt;p&gt;I am unable to insert a link into a Rich Text field.  The modal opens, I enter the data but nothing happens when I click ‘save’, no errors seem to be thrown.  I am able to insert a link to anther entry in the same modal. Field(s) are set to default and no plugins are being used.  The entries are both in a structure with no urls of their own, and in Craft Commerce product types.&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="57" LastEditDate="2016-01-22T01:36:28.877" LastActivityDate="2016-01-22T01:54:02.687" Title="Rich Text field won't accept link" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13335" PostTypeId="1" AcceptedAnswerId="13338" CreationDate="2016-01-21T15:40:03.470" Score="3" ViewCount="798" Body="&lt;p&gt;I would like to cache a variable and compare the cached variable with a parameter from the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to somehow cache a variable ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key &quot;cacheId&quot; %}&#xA;  {% set id = 1 %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2016-01-21T19:19:55.970" LastActivityDate="2016-04-13T23:46:53.850" Title="Is it possible to cache variables using the {% cache %} tag?" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13336" PostTypeId="1" AcceptedAnswerId="13339" CreationDate="2016-01-21T17:05:48.233" Score="3" ViewCount="8880" Body="&lt;p&gt;I'd like to create a variable from another variable. What I got right now is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set language = fr %} &#xA;{% if language == &quot;en&quot;  %}&#xA;   {% set fooAddress = en_foobar.globalAddress %} &#xA;{% if language == &quot;fr&quot;  %}&#xA;   {% set fooAddress = fr_foobar.globalAddress %}&#xA;{% if language == &quot;de&quot;  %}&#xA;   {% set fooAddress = de_foobar.globalAddress %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fooAddress = language  ~ &quot;_foobar.globalAddress&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No problem with plain PHP (&lt;a href=&quot;http://php.net/manual/en/language.variables.variable.php&quot; rel=&quot;nofollow&quot;&gt;http://php.net/manual/en/language.variables.variable.php&lt;/a&gt;) but is this possible to do with Twig?&lt;/p&gt;&#xA;" OwnerUserId="4633" LastEditorUserId="57" LastEditDate="2016-01-21T19:24:04.200" LastActivityDate="2016-01-26T22:03:47.177" Title="Variable variables in Twig" Tags="&lt;templating&gt;&lt;php&gt;&lt;variable&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13338" PostTypeId="2" ParentId="13335" CreationDate="2016-01-21T19:19:32.833" Score="3" Body="&lt;p&gt;The Twig &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; will only cache HTML output, not variables.  You could, however, store the value you want to check against in &lt;a href=&quot;https://straightupcraft.com/craft-plugins/lj-cookies&quot; rel=&quot;nofollow&quot;&gt;a&lt;/a&gt; &lt;a href=&quot;https://straightupcraft.com/craft-plugins/cookies&quot; rel=&quot;nofollow&quot;&gt;cookie&lt;/a&gt; or into the browser's local storage.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-21T19:19:32.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13339" PostTypeId="2" ParentId="13336" CreationDate="2016-01-21T19:23:28.783" Score="3" Body="&lt;p&gt;In order to pull this off, you'll need to take advantage of the not very well  &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;documented&lt;/a&gt; &lt;code&gt;_context&lt;/code&gt; variable in Twig.  This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set language = 'fr' %}&#xA;&#xA;{% set foobar = _context[language ~ &quot;_foobar&quot;] is defined ? _context[language ~ &quot;_foobar&quot;] : null %}&#xA;&#xA;{% if foobar %}&#xA;    {{ foobar.globalAddress }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-01-26T22:03:47.177" LastActivityDate="2016-01-26T22:03:47.177" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13340" PostTypeId="2" ParentId="13329" CreationDate="2016-01-21T22:28:21.947" Score="0" Body="&lt;p&gt;If I understand correctly you're talking about a Checkboxes field type. Because you can have multiple checkboxes within such a field, Craft stores an array to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try if this works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;    'agreeToTerms' =&amp;gt; array(&#xA;        craft()-&amp;gt;request-&amp;gt;getPost('fields.agreeToTerms'),&#xA;    )&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="2275" LastEditDate="2016-01-22T14:28:48.940" LastActivityDate="2016-01-22T14:28:48.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13341" PostTypeId="2" ParentId="13327" CreationDate="2016-01-21T23:24:21.097" Score="3" Body="&lt;p&gt;Unfortunately you can't really configure how Redactor formats it's input. Given this I think your current solution is the most effective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, you could try this alternative style for your &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tags when hiding:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;br.hide-for-small {&#xA;    content: '';&#xA;    display: inline-block;&#xA;    width: 1ch;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will collapse the line break with an added space. It'll only work on Safari and Chrome though. That might be good enough since most mobile users are using Webkit-based browsers.&lt;/p&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="3811" LastEditDate="2016-01-21T23:33:14.553" LastActivityDate="2016-01-21T23:33:14.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13342" PostTypeId="2" ParentId="10137" CreationDate="2016-01-21T23:38:39.933" Score="2" Body="&lt;p&gt;Instead of adding &lt;code&gt;*.html&lt;/code&gt; as a registered Twig patter, I use &lt;code&gt;*?html&lt;/code&gt;.  Seems to work just fine and I don't have to switch back and forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the flip side, Twig support in PhpStorm seems to contain all the HTML support as well, so other than feeling wrong (which it does), there may be no downside to just switching it over to Twig.&lt;/p&gt;&#xA;" OwnerUserId="4634" LastEditorUserId="-1" LastEditDate="2018-11-14T18:27:01.367" LastActivityDate="2018-11-14T18:27:01.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13343" PostTypeId="2" ParentId="8998" CreationDate="2016-01-22T01:16:41.767" Score="4" Body="&lt;p&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#build2759&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5.2759&lt;/a&gt; this is now possible.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is now possible to include custom URL fragments in links to entries within Rich Text fields, alongside the entry's reference fragment (e.g. &lt;code&gt;href=&quot;my-entry#custom-fragment#entry:123&lt;/code&gt;&quot;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-22T01:16:41.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13344" PostTypeId="1" CreationDate="2016-01-22T01:34:17.710" Score="1" ViewCount="735" Body="&lt;p&gt;I've created all my Assets fields with 'Same as Source' selected in 'Target Locale'. When I create an entry in language A, all field content is copied over apart from the assets selections into language B/C/D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change this and select a set Locale in 'Target Locale' what actually happens? (e.g. If I select language A, will it copy that asset into lang B/C/D's entry and can it be changed/updated by an admin who only has access to B?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. In this situation, all assets are remote on S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2016-01-26T00:59:20.053" Title="Assets, Multi Locale and 'Target Locale'" Tags="&lt;assets&gt;&lt;localization&gt;&lt;multi-domain&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13345" PostTypeId="2" ParentId="13333" CreationDate="2016-01-22T01:54:02.687" Score="1" Body="&lt;p&gt;Twas my own fault - I have addTrailingSlashesToUrls set to true and falsely thought it added one after .com/ but was wrong.  As soon as I added / to the link back in order. &lt;/p&gt;&#xA;" OwnerUserId="83" LastActivityDate="2016-01-22T01:54:02.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13346" PostTypeId="1" AcceptedAnswerId="13347" CreationDate="2016-01-22T06:41:31.010" Score="1" ViewCount="114" Body="&lt;p&gt;Is there a way to configure Craft further beyond just settings like &lt;code&gt;'cacheMethod' =&amp;gt; 'redis',&lt;/code&gt;? I'm exploring the possibility of using Redis outside of the server Craft CMS is running on, and am curious if there is a way I can set this up while still using the built-in &lt;code&gt;craft()-&amp;gt;cache&lt;/code&gt; service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to be able to utilize a remote cache option and configure it in the same way that cache has a &lt;code&gt;db.php&lt;/code&gt;config file where you can set your database as local or remote.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any information about doing this out there and/or plans to support this eventually? Just curious.. thank you!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-01-22T07:34:40.277" Title="Craft Cache Config - Remote Support?" Tags="&lt;plugin-development&gt;&lt;config&gt;&lt;cache&gt;&lt;php&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13347" PostTypeId="2" ParentId="13346" CreationDate="2016-01-22T07:34:40.277" Score="2" Body="&lt;p&gt;You can configure the Redis cache driver to use an external host, see the &lt;a href=&quot;https://craftcms.com/classreference/etc/cache/RedisCache&quot; rel=&quot;nofollow noreferrer&quot;&gt;config page&lt;/a&gt; for the documentation and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5269/redis-enviornment-specific-dbs&quot;&gt;here&lt;/a&gt; for details on copying the default Redis config file and configuring it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short... Copy &lt;code&gt;craft/app/etc/config/defaults/rediscache.php&lt;/code&gt; to your &lt;code&gt;craft/config/&lt;/code&gt; folder and configure the settings as you wish.&lt;/p&gt;&#xA;" OwnerUserId="3557" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-22T07:34:40.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13348" PostTypeId="1" CreationDate="2016-01-22T10:23:23.780" Score="0" ViewCount="568" Body="&lt;p&gt;I want users to be able select their own name prefix/title (Mr, Mrs, Dr. etc) as part of front end form that allows them to update their user details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a custom dropdown field and populated this with the titles that users can select. However, I'm having trouble displaying the dropdown on the front end form that allows users to select one option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance on how I would go about achieving this would be helpful!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I had initially. However, this just prints each option as a separate select? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdownField = craft.fields.getFieldbyHandle('honorific') %}&#xA;&#xA;{% for option in dropdownField.settings.options %}&#xA;    &amp;lt;select id=&quot;honorific&quot; name=&quot;honorific&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4627" LastEditorUserId="45" LastEditDate="2016-01-22T20:36:37.237" LastActivityDate="2016-01-29T15:11:26.440" Title="Allow a dropdown custom field to be edit from a front end form" Tags="&lt;form&gt;&lt;frontend&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13349" PostTypeId="1" CreationDate="2016-01-22T11:27:16.363" Score="0" ViewCount="247" Body="&lt;p&gt;I am currently working through the demo site Happy Lager and installed another separate instance of Craft from github as provided from the Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am creating ‘modules’ and adding fields etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to add an entry all I get is the title field. Even on the dashboard there is no option of including fields for population. Could you advise what seems to be the problem, the demo works fine and i’m especially interested in using the matrix functionality of the field functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all I get is the title field when I try to add an entry and have experimented with matrix and stand alone fields&lt;/p&gt;&#xA;" OwnerUserId="4636" LastActivityDate="2016-01-22T12:49:51.937" Title="Title field only available" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13350" PostTypeId="2" ParentId="13349" CreationDate="2016-01-22T11:54:02.123" Score="2" Body="&lt;p&gt;From reading your question it seems like the fields haven't been added to your entry type for the section you are trying to add entries to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing I'd recommend doing is to go to &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Sections&lt;/strong&gt; then find the section in the list you are trying to add entries to. &#xA;You should see an &lt;strong&gt;Entry Types&lt;/strong&gt; column at the right; click on the &lt;strong&gt;Edit entry type&lt;/strong&gt; option for the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This part of Craft allows you to add the fields you would like available in your entry. You can create your own tabs to categorise your fields as you see fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you will need to do is drag the fields from the bottom of the screen into your field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go back to the entry and hopefully the fields you added will be showing!&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-01-22T11:54:02.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13352" PostTypeId="2" ParentId="13348" CreationDate="2016-01-22T14:38:55.313" Score="3" Body="&lt;p&gt;Just to make sure I am on the same page, you have a select field within the control panel that is populated with the prefix/title(s)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, within your registration form, you could do something like this. Not tested, but should be close...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = craft.fields.getFieldByHandle('yourFieldHandle').getFieldType.options %}&#xA;&#xA;{% if options|length %}&#xA;    &amp;lt;label for=&quot;prefix&quot;&amp;gt;Prefix&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select id=&quot;prefix&quot; name=&quot;fields[prefix]&quot;&amp;gt;&#xA;        {% for option in options %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good catch by @Benjammin'. You will need the &lt;code&gt;options&lt;/code&gt; part to actually access the values. I've updated my answer, give it another try.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-01-29T15:11:26.440" LastActivityDate="2016-01-29T15:11:26.440" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13356" PostTypeId="1" AcceptedAnswerId="13357" CreationDate="2016-01-22T18:46:22.413" Score="0" ViewCount="268" Body="&lt;p&gt;Is it possible to find the seconds left / TTL when retrieving cache (when set to Redis) via plugins? I'm using short-lived cache (~600 seconds) to put users on &quot;cooldown&quot; to limit how often they can create new forum topics, by creating a user-specific cache whenever they create a topic. Then I can check and see if this cache exists when they create a new topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When getting the cache like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cache = craft()-&amp;gt;cache-&amp;gt;get( $cacheKey );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it returns true (exists,) I'd like to be able to tell the user how long they need to wait until they can post again (like Reddit.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried methods like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cache-&amp;gt;ttl; // doesn't work; not an object&#xA;$cache['ttl']; // doesn't work, no 'ttl' key&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe I am missing something in the &lt;a href=&quot;https://craftcms.com/classreference/services/CacheService&quot; rel=&quot;nofollow&quot;&gt;Cache Service Doc&lt;/a&gt;? Or is this meta information simply not available?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any information would be awesome. Cheers! &lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2016-01-22T18:58:01.920" LastActivityDate="2016-01-22T21:55:35.787" Title="Craft Redis Cache - Get Time Left?" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13357" PostTypeId="2" ParentId="13356" CreationDate="2016-01-22T21:55:35.787" Score="1" Body="&lt;p&gt;Craft is piggybacking off of Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/caching.overview&quot; rel=&quot;nofollow&quot;&gt;caching functionality&lt;/a&gt; for 99% of this and their cache classes don't expose any type of TTL functionality.  My guess is that because of all the different caching providers they support (memcache, xCache, WinCache, ApcCache, etc.), it looks like Redis is the only one that has this sort of functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isn't a clean way for us to add this to Craft itself, so I think a proper fix would be to add it to Yii, but considering Yii 1 is in bug fix more and not getting any more enhancements and Yii 2 has &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-caching-data.html&quot; rel=&quot;nofollow&quot;&gt;dropped support&lt;/a&gt; for Redis, that seems unlikely.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-22T21:55:35.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13358" PostTypeId="1" CreationDate="2016-01-22T23:58:15.843" Score="0" ViewCount="204" Body="&lt;p&gt;I have combed through similar questions, although my pagination links are not performing properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to add pagination links to entries within a channel. And I would like for the pagination order to be pulled from an Entries field within a Matrix located within a Single entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set source = craft.entries.sectionId(10).first().gallery.type('gallery').first().entries.relatedTo(entry) %}&#xA;&#xA;{% set prevEntry = entry.getPrev(source) %}&#xA;{% set nextEntry = entry.getNext(source) %}&#xA;&#xA;&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next: {{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous: {{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where SectionId(10.first() is pulling the Single entry and gallery.type('gallery').first().entries is pulling the Entries field within the Matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this is producing blank Next and Previous links.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;&quot;&amp;gt;Next: &amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;&quot;&amp;gt;Previous: &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have referred to other questions regarding params and relations, although through experimenting with different solutions I am not queuing up the correct Next and Previous entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither is Craft providing any error reports regarding the blank state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2016-01-23T16:22:17.807" Title="How do you create pagination links related to entries within a Matrix Field in a single entry?" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;pagination&gt;&lt;channels&gt;&lt;previous-next&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13359" PostTypeId="2" ParentId="13358" CreationDate="2016-01-23T10:36:16.803" Score="0" Body="&lt;p&gt;Are you sure your &lt;code&gt;entry&lt;/code&gt; variable is an entry model within your &lt;code&gt;source&lt;/code&gt; ElementCriteriaModel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also recommend to not chain all the methods in a single expression. Getting the models one after the other and storing them into separate vars allows to add some error handling and makes debugging easier.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-23T10:36:16.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13360" PostTypeId="2" ParentId="13358" CreationDate="2016-01-23T16:22:17.807" Score="1" Body="&lt;p&gt;In this particular case, &lt;code&gt;.relatedTo(entry)&lt;/code&gt; is not necessary. So long the entry the following code is located within is within the &lt;code&gt;entry&lt;/code&gt; within the &lt;code&gt;source&lt;/code&gt; the pagination will populate. Otherwise these will remain empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set source = craft.entries.sectionId(10).first().gallery.type('gallery').first().entries %}&#xA;&#xA;{% set prevEntry = entry.getPrev(source) %}&#xA;{% set nextEntry = entry.getNext(source) %}&#xA;&#xA;&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next: {{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous: {{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2016-01-23T16:22:17.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13361" PostTypeId="1" AcceptedAnswerId="13362" CreationDate="2016-01-23T17:40:43.877" Score="4" ViewCount="1111" Body="&lt;p&gt;I noticed that anyone interested in finding out what software is used for my website could find that out very easily just by looking at the headers and cookies received by craft.&#xA;You can find two headers that will expose craft:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&quot;Set-Cookie&quot;: &quot;CraftSessionId=&quot;.&lt;/li&gt;&#xA;&lt;li&gt;&quot;X-Powered-By&quot;: &quot;Craft CMS&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thats concerns me because if any security vulnerability will be found on craft, than immediately my site could be more exposed to threats. also, it will be easier for attackers to plan an effective attack against my website, because using craft means that i use SQL, php, twig and more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that it helps spreading the word on the cms. But i thinks that in some cases it may be better to remove it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Will it be against the terms and agreements of craft to remove those headers?&lt;/li&gt;&#xA;&lt;li&gt;Will writing a plugin for it be the best way, or maybe there is a better way?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks ahead!&lt;/p&gt;&#xA;" OwnerUserId="3908" LastActivityDate="2016-01-23T18:23:43.930" Title="Removing x-powered-by and changing cookies names for security?" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13362" PostTypeId="2" ParentId="13361" CreationDate="2016-01-23T18:23:43.930" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Will it be against the terms and agreements of craft to remove those headers?&lt;/p&gt;&#xA;&lt;p&gt;Will writing a plugin for it be the best way&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;No to both questions – just add the following &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;config values&lt;/a&gt; to your &lt;code&gt;/config/general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'sendPoweredByHeader' =&amp;gt; false,&#xA;'phpSessionName' =&amp;gt; 'WhateverYouWant',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also, check out &lt;a href=&quot;https://craftcms.stackexchange.com/a/4449/1098&quot;&gt;this excellent post by Brad Bell&lt;/a&gt; on the topic of Craft and security.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-01-23T18:23:43.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13363" PostTypeId="1" AcceptedAnswerId="13365" CreationDate="2016-01-23T20:03:59.930" Score="2" ViewCount="346" Body="&lt;p&gt;I am trying to order a list of Users by the date of their last entry. order('postDate desc') works for entries of course, but I can't find a way to order the Users of those posts based on their latest post date. This is the code I am using now which orders the User by the date their account was created.    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set allDesigns = craft.entries.section('designs').limit(null).find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set allDesignsByAuthorId = allDesigns|group('authorId') %}&#xA;&#xA;{# Grab all of the users with the userIds in allDesignsByAuthorId #}&#xA;{% set designers = craft.users.group('designers').id(allDesignsByAuthorId|keys).order('dateCreated desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for any help you can give! &lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2016-01-23T22:27:30.000" Title="Order Users List by Last Entry Date" Tags="&lt;entries&gt;&lt;users&gt;&lt;order&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13364" PostTypeId="2" ParentId="13363" CreationDate="2016-01-23T21:49:16.850" Score="1" Body="&lt;p&gt;You could do something like this: get all your designer users, loop them and for each user you try to get the latest design entry, if there exists one, merge it to a custom array which uses the post date of the entry as the key and the designer's user model as the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now sort that array using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/sort.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;sort&lt;/code&gt;&lt;/a&gt; filter, which sorts the array by its key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should note that this approach creates a criteria model and calls the &lt;code&gt;first&lt;/code&gt; method for each user, so it probably causes quite a number of database queries. That's why I recommend to add caching to the template or even think about getting the users with a custom plugin and SQL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set designers = {} %}&#xA;&#xA;{% set users = craft.users.group('designers').limit(null) %}&#xA;{% for user in users %}&#xA;&#xA;    {% set latestDesign = craft.entries.section('designs').author(user).first() %}&#xA;    {% if latestDesign %}&#xA;        {% set designers = designers|merge({&#xA;            (latestDesign.postDate): user&#xA;        }) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% for key, designer in designers|sort %}&#xA;    &amp;lt;li&amp;gt;{{ designer }} (Latest design posted: {{ key }})&amp;lt;/li&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-23T21:49:16.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13365" PostTypeId="2" ParentId="13363" CreationDate="2016-01-23T22:27:30.000" Score="2" Body="&lt;p&gt;I just noticed that you've posted an answer to your question already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your approach using the &lt;code&gt;group&lt;/code&gt; filter is probably all you need, as the &lt;code&gt;allDesigns&lt;/code&gt; array is sorted by &lt;code&gt;postDate desc&lt;/code&gt; and by using the &lt;code&gt;group&lt;/code&gt; filter you'll keep that sort order, your author IDs and the nested entries will both be sorted by the design post date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To query the user models in the order of the IDs passed to the &lt;code&gt;id&lt;/code&gt; param, you just need to add the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.users#fixedOrder&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fixedOrder&lt;/code&gt;&lt;/a&gt; param to your &lt;code&gt;craft.users&lt;/code&gt; criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab all the Design Entries #}&#xA;{% set allDesigns = craft.entries.section('designs').limit(null).find() %}&#xA;&#xA;{# Group by the authorId #}&#xA;{% set allDesignsByAuthorId = allDesigns|group('author.id') %}&#xA;&#xA;{# Grab all of the users with the userIds in allDesignsByAuthorId #}&#xA;{% set designers = craft.users.group('designers').id(allDesignsByAuthorId|keys).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-23T22:27:30.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13366" PostTypeId="1" AcceptedAnswerId="13369" CreationDate="2016-01-23T23:11:11.900" Score="0" ViewCount="937" Body="&lt;p&gt;I am a bit mystified by how to utilize templates for Guest entries plugin working fine for normal post saving custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use ajax to submit I get an XHR 200 response but an HTML response - no JSON. Ideally I don't want to redirect to another page but just manipulate the DOM and pass some variables into the page form JSON returned on success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read and reread every ajax post but still can't get a pure JSON response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it necessary to utilize some kind of detection within the template for Craft ajax?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just when I thought i had ajax understood...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function () {&#xA;//validation rules&#xA;$(&quot;form#brick&quot;).validate({&#xA;    ignore: &quot;:hidden&quot;,&#xA;    rules: {&#xA;        &quot;fields[firstName]&quot;: {&#xA;            required: true,&#xA;        },&#xA;        &quot;fields[lastName]&quot;: {&#xA;            required: true&#xA;        },&#xA;        &quot;fields[email]&quot;: {&#xA;            required: true,&#xA;            email: true&#xA;        }&#xA;    },&#xA;    messages: {&#xA;        &quot;fields[email]&quot;: &quot;Email is required&quot;&#xA;    },&#xA;&#xA;    submitHandler: function (form) {&#xA;        // Prevent default posting of form&#xA;        event.preventDefault();&#xA;&#xA;        var data = $(this).serialize();&#xA;&#xA;        $.ajax('/', data, function(response) {&#xA;            if (response.success) {&#xA;&#xA;                console.log(response);&#xA;                $('#thanks').fadeIn();&#xA;                $('#brick').fadeOut();&#xA;                console.log(response);&#xA;            } else {&#xA;                // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;                // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;                alert('An error occurred. Please try again.');&#xA;            }&#xA;        });&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;});&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-01-25T18:53:09.120" LastActivityDate="2016-01-25T18:53:09.120" Title="Template for submit via ajax to Guest Entries plugin" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13367" PostTypeId="2" ParentId="1334" CreationDate="2016-01-24T02:53:51.503" Score="1" Body="&lt;p&gt;Taylor, I think your best bet would be to email support at Arcustech directly about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're very able to help; just put clear questions to them and think you'll be pleased. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I am aware, the arrangement I used would be the same as you would get on a higher end plan -- it's Arcustech's node point that enables the Railgun part in either case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have to confess, it's been a while since I've worked with this, and as you can see, it's an effective arrangement, if needing to be pretty well understood to get the best from it. You should draw out the pattern, or whatever will get it into your head. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A key point of understanding is that your web app will still need to run for each access, so it needs to be fast for fast overall results. Caching is your friend, and that is its own subject, as intricate as it needs to be for a given site's needs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big advantage Railgun can give is to run compressed versions of content deltas out to the edge point your client accesses in the world, on a single held-open connection so this is as fast as it could be. This will help a lot with individual propagation latency, but you still have roundtrip latency plus the server time for your CMS to answer. Make things fast on your side, and the overall delay should be below important noticing. Just not instantaneous actually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Content that doesn't change, and reports not no-cache will sit on CloudFlare's edge servers once it first gets there, so that, which should include the bulk of your large resources like  images, will be as if local -- for a country or region, anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tests I did were very promising for a travel bureau site which wanted to show well in Europe and Eastern Europe/Russia. For Russia, there weren't edge servers, but it would look as good as Eastern and Central European sites in use from Russia ordinarily. You can read about the issues over that border, and look at the map of CloudFlare to see they've done their best to ring for best results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best fortune on this, and you might put a note here once you get it up to report your experience. Always good we can all learn interesting things from those.&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2016-01-24T02:53:51.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13369" PostTypeId="2" ParentId="13366" CreationDate="2016-01-24T14:49:30.760" Score="3" Body="&lt;p&gt;There are some problems with your JavaScript that I expect is the cause of your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your code I'm assuming you're using &lt;a href=&quot;http://jqueryvalidation.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;jQuery Validate&lt;/a&gt; to validate the form before submission. Your first issue is the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;event.preventDefault();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within the &lt;code&gt;submitHandler()&lt;/code&gt; method – jQuery Validate will actually prevent the default form submission for you, so this line is redundant. Also, there is no variable called &lt;code&gt;event&lt;/code&gt;, so that's going to cause trouble.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second issue is that you're using the wrong syntax for the &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;$.ajax()&lt;/code&gt;&lt;/a&gt; method. Considering your current code, I believe you want to use the &lt;a href=&quot;http://api.jquery.com/jquery.post/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;$.post()&lt;/code&gt;&lt;/a&gt; method instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you're serializing the wrong object – &lt;code&gt;$(this).serialize()&lt;/code&gt; should actually read &lt;code&gt;$(form).serialize()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the above issues fixed, your code should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function () {&#xA;&#xA;    $('form#brick').validate({&#xA;&#xA;        ignore: &quot;:hidden&quot;,&#xA;&#xA;        rules: {&#xA;            &quot;fields[firstName]&quot;: {&#xA;                required: true,&#xA;            },&#xA;            &quot;fields[lastName]&quot;: {&#xA;                required: true&#xA;            },&#xA;            &quot;fields[email]&quot;: {&#xA;                required: true,&#xA;                email: true&#xA;            }&#xA;        },&#xA;&#xA;        messages: {&#xA;            &quot;fields[email]&quot;: &quot;Email is required&quot;&#xA;        },&#xA;&#xA;        submitHandler: function (form) {&#xA;&#xA;            var data = $(form).serialize();&#xA;&#xA;            $.post('/', data, function (response) {&#xA;                if (response &amp;amp;&amp;amp; response.success) {&#xA;                    $('#thanks').fadeIn();&#xA;                    $('#brick').fadeOut();&#xA;                } else {&#xA;                    alert('An error occurred. Please try again.');&#xA;                }&#xA;            });&#xA;&#xA;        }&#xA;&#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, for some pointers on how you could handle errors within the &lt;code&gt;response&lt;/code&gt; payload, see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8722/how-do-you-correctly-handle-errors-using-pt-contact-form-when-submitting-via-aja?rq=1&quot;&gt;this thread&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-01-24T14:57:07.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13370" PostTypeId="1" AcceptedAnswerId="13381" CreationDate="2016-01-24T19:07:57.993" Score="2" ViewCount="104" Body="&lt;p&gt;Is it possible to use different types of cache in Craft? &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-caching-data.html&quot; rel=&quot;nofollow&quot;&gt;Yii&lt;/a&gt; made a point how different caches are better for different reasons: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Tip: You may use different cache storage in the same application. A&#xA;  common strategy is to use memory-based cache storage to store data&#xA;  that is small but constantly used (e.g. statistical data), and use&#xA;  file-based or database-based cache storage to store data that is big&#xA;  and less frequently used (e.g. page content).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are some pages that need a decent sized portion of content cached, but other areas in plugins that cache small bits of data. It would be nice if I could declare template cache to be &quot;X&quot; cache type, but use other cache types such as Redis in other areas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible at all to do this through Craft?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-01-26T06:25:21.890" Title="Changing cache type" Tags="&lt;templating&gt;&lt;cache&gt;&lt;yii&gt;&lt;filecache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13371" PostTypeId="1" CreationDate="2016-01-24T21:20:53.973" Score="2" ViewCount="87" Body="&lt;p&gt;In the Entries tab in the Control Panel, I see a list of Sources on the left hand side:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All Entries&lt;/li&gt;&#xA;&lt;li&gt;Singles&lt;/li&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I click on each of these sources the page filters the appropriate results in the body and the URL gets updated appropriately:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All Entries =&gt; &lt;code&gt;/admin/entries&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Singles =&gt; &lt;code&gt;/admin/entries/singles&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;News =&gt; &lt;code&gt;/admin/entries/news&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is nice as I can now send links to other people to a specific sub-section in the sources, with the contents already filtered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've compared my code in the source &lt;code&gt;nav&lt;/code&gt; to the code on the Entries Element Index page, and they are comparable, including passing the &lt;code&gt;data-handle&lt;/code&gt; value to each source. But it's still not working in my Custom Element type. I must be missing something but I haven't yet figured out what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we get this behavior working for custom Element Types?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="689" LastEditDate="2016-02-14T20:37:45.537" LastActivityDate="2016-02-14T20:37:45.537" Title="How do I setup my Element Types Sources for deep linking?" Tags="&lt;routes&gt;&lt;elementtype&gt;&lt;routing&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13372" PostTypeId="1" AcceptedAnswerId="13509" CreationDate="2016-01-25T08:58:58.820" Score="1" ViewCount="407" Body="&lt;p&gt;I have a Craft installation with two domains pointing at it. The first domain is all working and has a number of sections including a blog located at /blog. What I want to be able to do is have a different blog section for the second domain that is also at the path /blog so naming conventions are all consistent i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;domain.com/blog&lt;br&gt;&#xA;domain-two.com/blog&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course in the CP when you add another section it will not let you use the same path which makes sense. As there is a lot of shared information but also a couple of sections/pages that will be different I thought perhaps using the .htaccess to rewrite the URL to include an additional path segment for the second site which could then be used in the CP to distinguish unique paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried modifying the .htaccess RewriteRule but could not get this to reflect in the information passed through to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^domain-two.com$&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;RewriteRule (.+) domain-two/index.php?p=$1 [QSA,L]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^domain-two.com$&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;RewriteRule (.+) index.php?p=domain-two/$1 [QSA,L]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make the rewrite work, I'm probably doing something wrong, or is there a better way to trigger a unique path from the same URL path? I really need to keep the URLs consistent.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2016-02-02T09:54:40.857" Title="Re-using path segments for an additional domain?" Tags="&lt;htaccess&gt;&lt;multi-domain&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13373" PostTypeId="1" AcceptedAnswerId="13374" CreationDate="2016-01-25T10:03:11.710" Score="0" ViewCount="65" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import&lt;/a&gt; plugin. This question doesn't have to do with the Import plugin which seems to be working swell, but instead with my &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; logic which seems to have botched the import process.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;    {&#xA;&#xA;        if($params['isNewEntry']) {&#xA;&#xA;            $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;            $criteria-&amp;gt;groupId = 1;&#xA;            $criteria-&amp;gt;AffiliateId = $entry['AffiliateId']; &#xA;            $criteria-&amp;gt;limit = 1;&#xA;            $users = $criteria-&amp;gt;find();&#xA;&#xA;            if (!empty($users)) {           &#xA;                $assignedCoach = $users[0]-&amp;gt;id;&#xA;                $entry-&amp;gt;authorId = $assignedCoach;&#xA;                $entry-&amp;gt;getContent()-&amp;gt;coachId = $assignedCoach;&#xA;            }&#xA;        }        &#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here? Also, any idea how I kill the import processes which seem to be hung at the moment?&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="57" LastEditDate="2016-01-25T18:54:41.827" LastActivityDate="2016-01-25T18:54:41.827" Title="onBeforeSaveEntry is hanging on import" Tags="&lt;entries&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13374" PostTypeId="2" ParentId="13373" CreationDate="2016-01-25T10:14:18.187" Score="3" Body="&lt;p&gt;Your script probably chokes because you're interacting with an undeclared variable &lt;code&gt;$params&lt;/code&gt; – i.e. change&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($params['isNewEntry']) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($event-&amp;gt;params['isNewEntry']) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-25T10:14:18.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13375" PostTypeId="2" ParentId="13372" CreationDate="2016-01-25T11:40:50.127" Score="2" Body="&lt;p&gt;In Craft, there is no such thing as a &quot;section path&quot; – there's only the &quot;Entry Template&quot; path (which tells Craft which template to load when the URL for an Entry in that particular section is requested) and the &quot;URL format&quot;, which tells Craft how it should construct the URLs for the entries within that section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's actually totally possible to have multiple sections use the same URL format – e.g. &lt;code&gt;blog/{slug}&lt;/code&gt; – so that part is easy; &lt;em&gt;just use the same format for both of your blog sections&lt;/em&gt;, and all your URLs will be consistent out of the box (the only drawback to be aware of is that if you create entries with identical names within both sections, Craft will suffix the auto-generated slug for the newer entry with a number, i.e. &lt;code&gt;my-generic-blog-post-title-2&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming your blogs should use different templates for both their index and entry pages, so with the above URL format in place, it's simply a matter of routing the requests to the correct template(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry template is easy. You can set different paths for the two blog section's Entry Template path settings, e.g. &lt;code&gt;blog/blogA/_entry&lt;/code&gt; and &lt;code&gt;blog/blogB/_entry&lt;/code&gt;, or you can use the same path, e.g. &lt;code&gt;blog/_entry&lt;/code&gt; for both. If you use the same template, you can conditionally &lt;code&gt;{% include %}&lt;/code&gt; a blog specific template by testing the &lt;code&gt;entry.section.handle&lt;/code&gt; value, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.section.handle %}&#xA;    {% case 'blogA' %}&#xA;        {% include 'blog/blogA/_entry' %}&#xA;    {% case 'blogB' %}&#xA;        {% include 'blog/blogB/_entry' %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the blog indexes – i.e. &lt;code&gt;domain.com/blog&lt;/code&gt; and &lt;code&gt;domain-two.com/blog&lt;/code&gt; – it's important to realize that in Craft, &lt;em&gt;there is no inherent relationship between templates and sections&lt;/em&gt;. For instance, even if you have a section with the handle &lt;code&gt;blog&lt;/code&gt; and a template &lt;code&gt;templates/blog/index&lt;/code&gt;, Craft won't automatically &quot;connect&quot; the template and the section, in terms of, for instance, populating the template with entries or other data related to the &lt;code&gt;blog&lt;/code&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What Craft &lt;em&gt;will&lt;/em&gt; do, is to route all templates (that aren't hidden using an underscore prefix, i.e. &lt;code&gt;_secret.html&lt;/code&gt;) to URLs. This means that if you &lt;em&gt;do&lt;/em&gt; have a template under &lt;code&gt;templates/blog/index.html&lt;/code&gt; or &lt;code&gt;templates/blog.html&lt;/code&gt;, Craft will load that template whenever the URL &lt;code&gt;domain.com/blog&lt;/code&gt; (and &lt;code&gt;domain-two.com/blog&lt;/code&gt;) is requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you can exploit this behaviour by creating a template called &lt;code&gt;templates/blog/index.html&lt;/code&gt;. Inside that template, you can add a &lt;code&gt;{% switch %}&lt;/code&gt; statement similar to the one in the entry template, but this time looking at the &lt;code&gt;craft.request.serverName&lt;/code&gt; variable (I'm assuming you've created index templates for each of your blog sections under &lt;code&gt;templates/blog/(sectionHandle)/index.html&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch craft.request.servername %}&#xA;   {% case 'domain.com' %}&#xA;       {% include 'blog/blogA/index' %}&#xA;   {% case 'domain-two.com' %}&#xA;       {% include 'blog/blogB/index' %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're looking for a more robust solution, you should look at &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Craft's multi-environment features&lt;/a&gt;, or possibly make use of the &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;appId&lt;/code&gt;&lt;/a&gt; config setting; i.e. use different &lt;code&gt;appId&lt;/code&gt; values for the two domains, and load templates conditionally based on &lt;code&gt;craft.config.appId&lt;/code&gt; instead of hard coding the hostnames in your templates. To have Craft set a different &lt;code&gt;appId&lt;/code&gt; based on the different domain names, you could add something like this to your &lt;code&gt;craft/config/general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'domain.com' =&amp;gt; array(&#xA;        'appId' =&amp;gt; 'siteA', &#xA;    ),&#xA;    'domain-two.com' =&amp;gt; array(&#xA;        'appId' =&amp;gt; 'siteB',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-25T11:40:50.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13376" PostTypeId="2" ParentId="13312" CreationDate="2016-01-25T13:01:33.687" Score="1" Body="&lt;p&gt;This isn't possible with the build in FEEF functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can however achieve this via a Plugin. What you need to do is to listen to the &lt;code&gt;onBeforeSave&lt;/code&gt; event and make an if-statement to check if the entry is being added to your section. Then you can run a loop that checks all the submitted categories against your database and adds new entries for the categories that doesn't exist and re-populates your &lt;code&gt;EntryModel&lt;/code&gt; with the new category ID's before insertion.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-01-25T13:01:33.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13377" PostTypeId="1" AcceptedAnswerId="13378" CreationDate="2016-01-25T16:58:08.160" Score="2" ViewCount="118" Body="&lt;p&gt;From what I've gleaned from other q&amp;amp;a, it's possible to set up multiple localized sites under one installation of Craft, but can you assign separate administrators to each? I'd like to set up multiple sites under one domain for a company with several global offices, but each office needs to have control over only their site's content— and ideally some admins could have access to more than one. Possible?&lt;/p&gt;&#xA;" OwnerUserId="4650" LastActivityDate="2016-01-26T08:11:09.827" Title="Specifying administrators for localized sites?" Tags="&lt;admin&gt;&lt;permissions&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13378" PostTypeId="2" ParentId="13377" CreationDate="2016-01-25T17:22:23.550" Score="6" Body="&lt;p&gt;Yes. you can:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lURlo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lURlo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I created a User group which has only access to the english part of the content.&#xA;As you can see these are checkboxes. So you can grant access to multiple languages at once.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2016-01-26T08:11:09.827" LastActivityDate="2016-01-26T08:11:09.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13380" PostTypeId="2" ParentId="13344" CreationDate="2016-01-25T23:15:03.833" Score="3" Body="&lt;p&gt;The &quot;Target Locale&quot; setting under the Asset field's settings is referring to &lt;em&gt;which locale do you want to select assets in&lt;/em&gt;.  When it's set to &quot;Same as source&quot;, then, for example, if you're viewing an entry in German, the Asset selector modal will only display Assets assigned to the German locale.  And if you were viewing the entry in Dutch, it would only show Assets assigned to the Dutch locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change the &quot;Target Locale&quot; from &quot;Same as Source&quot; to a specific local (i.e. German), then no matter what local you're viewing an entry in, only Assets assigned to the German locale would show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When saving a new entry in locale 1, Craft &quot;copies&quot; content data (anything stored in the &lt;code&gt;craft_content&lt;/code&gt; table in the database) over to the other locales for fields marked as translatable as a starting point for the other locales.  All relational fields (Assets, Entries, Users, etc.) aren't &quot;content&quot; and they are stored in the &lt;code&gt;craft_relations&lt;/code&gt; table and Craft currently doesn't copy that information over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ironically, if you uncheck the &quot;This field is translatable?&quot; checkbox in the Asset field settings, it &lt;em&gt;would&lt;/em&gt; show up on the other locales, because in that context the Assets aren't stored on a per-locale basis.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-01-26T00:59:20.053" LastActivityDate="2016-01-26T00:59:20.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13381" PostTypeId="2" ParentId="13370" CreationDate="2016-01-26T05:52:48.083" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible at all to do this through Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably, but it kind of depends on what level of caching we're talking about and your specific use-case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an overview of the different caching options available in Craft and what they mean &lt;a href=&quot;https://craftcms.stackexchange.com/a/13383/57&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-26T06:25:21.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13382" PostTypeId="1" AcceptedAnswerId="13383" CreationDate="2016-01-26T06:22:37.520" Score="14" ViewCount="7092" Body="&lt;p&gt;Reading the Craft docs and other related questions on Stack Exchange there seems to be a lot questions about caching, what it does under different scenarios and how to best utilize it.  Is there an overview of all of the different caching options available in a Craft installation?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2020-09-07T16:19:36.137" Title="What are the cache options available to a Craft installation?" Tags="&lt;cache&gt;&lt;caching&gt;&lt;filecache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="13383" PostTypeId="2" ParentId="13382" CreationDate="2016-01-26T06:22:37.520" Score="37" Body="&lt;p&gt;There are many different caching levels on a web server, some of them are Craft-specific, and some have nothing to do with Craft, but they often get confused.  In addition to that, some of them you have control over, and some of them you get for free.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_PHP_accelerators&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP Accelerators&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These are web server extensions installed to provide byte-level PHP caching so that PHP doesn't have to &amp;quot;re-compile&amp;quot; an entire PHP script the next time it is requested.  If you are on PHP 5.5+, most *nix distributions have &lt;a href=&quot;https://secure.php.net/manual/en/book.opcache.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpCache&lt;/a&gt; enabled by default.  The settings to control how these extensions behave (TTL, cache busting, etc.) are extension specific.&lt;/p&gt;&#xA;&lt;p&gt;These extensions are a frequent cause of &amp;quot;I've changed my PHP file, but it appears to be using old code&amp;quot; headaches.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Memoization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Craft (and probably many Craft plugins) employ a technique called &lt;a href=&quot;https://en.wikipedia.org/wiki/Memoization&quot; rel=&quot;nofollow noreferrer&quot;&gt;memoization&lt;/a&gt; where the results of an expensive method call get cached so that, &lt;em&gt;on that same request&lt;/em&gt;, future calls to that method can read from the cache instead of executing the same expensive code over again.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Native &lt;a href=&quot;http://twig.sensiolabs.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt; caching&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Twig, the templating language Craft uses, will take a given Twig template and &amp;quot;compile&amp;quot; it down to PHP code so that subsequent requests to that template will execute the (much faster) PHP directly instead of parsing the Twig template.  Craft stores the compiled templates in the Craft &lt;code&gt;storage/runtime/compiled_templates&lt;/code&gt; folder by default.  If &lt;a href=&quot;https://craftcms.com/docs/3.x/config/config-settings.html#devmode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; is off, a compiled template will be busted when its source Twig template file's date modified date has changed.  If devMode is enabled, the Twig will compile the template on every request.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft template &lt;a href=&quot;https://craftcms.com/docs/3.x/dev/tags.html#cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% cache %}&lt;/a&gt; tags&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Craft provides its own (not native to Twig) &lt;code&gt;{% cache %}&lt;/code&gt; tags for templates.  The template cache tags store its data to wherever Craft is configured to store its general-purpose data caches. By default, that is the file system, but that can be overwritten to other data stores like &lt;a href=&quot;https://craftcms.com/docs/3.x/config/#cache-component&quot; rel=&quot;nofollow noreferrer&quot;&gt;the database, redis&lt;/a&gt;, etc.&lt;/p&gt;&#xA;&lt;p&gt;Since using this tag involves database queries, you want to be &lt;a href=&quot;https://craftcms.stackexchange.com/questions/105/what-are-the-best-practices-for-using-the-cache-tag&quot;&gt;smart&lt;/a&gt; about using it.  It can be detrimental to cache template code that doesn't generate any database queries.  The &lt;code&gt;{% cache %}&lt;/code&gt; tag will &lt;em&gt;only&lt;/em&gt; cache HTML output, so it also makes no sense to cache Twig variables.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag will keep track of any Craft elements (entries, assets, users, tags, etc.) inside of it so that if any of them change, it knows to bust their caches automatically.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;General purpose data caching&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Craft takes advantage of Yii's &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/caching-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;supplied caching techniques&lt;/a&gt; and exposes them via the Cache service class at &lt;code&gt;Craft::$app-&amp;gt;getCache()&lt;/code&gt; so that Craft and any plugins can have a place to store arbitrary cached data.  By default, &lt;code&gt;Craft::$app-&amp;gt;getCache()&lt;/code&gt; uses [file based caching][14], which gets saved to Craft's &lt;code&gt;storage/runtime/cache&lt;/code&gt; folder, but &lt;code&gt;Craft::$app-&amp;gt;getCache()&lt;/code&gt; can be &lt;a href=&quot;https://craftcms.com/docs/3.x/config/#cache-component&quot; rel=&quot;nofollow noreferrer&quot;&gt;configured&lt;/a&gt; to save to many &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/caching-data#supported-cache-storage&quot; rel=&quot;nofollow noreferrer&quot;&gt;external sources&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;These cache durations are controlled by the &lt;a href=&quot;https://craftcms.com/docs/3.x/config/config-settings.html#cacheduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;cacheDuration&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;External HTML caching services&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can configure applications like &lt;a href=&quot;https://www.varnish-cache.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Varnish&lt;/a&gt; (and similar cloud-based services like &lt;a href=&quot;https://www.cloudflare.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CloudFlare&lt;/a&gt;) to provide static/partial page HTML caching to specific URLs with their cache-busting logic.&lt;/p&gt;&#xA;&lt;p&gt;No doubt missing some other caching methods, but probably worth noting that it's a good general rule of thumb to not double up on caching strategies.  For example, the complexity of debugging caching grows exponentially when using Varnish with byte-level caching and the &lt;code&gt;{% cache %}&lt;/code&gt; tag and you quickly get diminishing returns performance-wise.&lt;/p&gt;&#xA;&lt;p&gt;There are &lt;a href=&quot;https://plugins.craftcms.com/search?q=cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;many plugins&lt;/a&gt; in the Plugin Store that interact with Craft across the different caching levels in Craft to modifying existing or add new caching functionality.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2020-09-07T16:19:36.137" LastActivityDate="2020-09-07T16:19:36.137" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13384" PostTypeId="1" CreationDate="2016-01-26T09:18:26.887" Score="0" ViewCount="1059" Body="&lt;p&gt;I'm getting white blank page when trying to access my website and Craft login page. I haven't updated the website for few months. So I assume no files has been changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked with the hosting provider, and they say everything is okay on their part. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I turned on the Dev Mode. And it came back with this error :&#xA;&lt;code&gt;Fatal error: Class 'Craft\HttpRequestService' not found in /home/alpw7814/craft/app/framework/YiiBase.php on line 213&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could possibly cause this? Is there anything I need to check?&#xA;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4654" LastEditorUserId="57" LastEditDate="2016-01-26T18:43:58.637" LastActivityDate="2016-01-26T22:00:33.700" Title="White blank page when accessing website and Craft login page" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13385" PostTypeId="1" AcceptedAnswerId="13386" CreationDate="2016-01-26T11:59:15.320" Score="3" ViewCount="360" Body="&lt;p&gt;What would be the best way of finding a &lt;code&gt;sectionId&lt;/code&gt; by its slug within my plugin?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2016-01-26T12:18:33.950" Title="Best way to find sectionId by slug" Tags="&lt;plugin-development&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13386" PostTypeId="2" ParentId="13385" CreationDate="2016-01-26T12:18:33.950" Score="6" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$section = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('sectionHandle');&#xA;$sectionId = section-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-26T12:18:33.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13387" PostTypeId="1" AcceptedAnswerId="13388" CreationDate="2016-01-26T15:33:18.130" Score="2" ViewCount="348" Body="&lt;p&gt;I am trying to pull entries that match a date criteria. Any ideas why this is not working?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;section: 'leads',&#xA;lastAssigned: '(&quot;now&quot;|date_modify(&quot;-3 days&quot;))'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to a member function getTimestamp() on a non-object in .../craft/app/helpers/DbHelper.php on line 597&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-01-26T17:12:05.337" Title="Using Date to Filter Entries" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2016-01-28T00:12:33.147" ContentLicense="CC BY-SA 3.0" />
  <row Id="13388" PostTypeId="2" ParentId="13387" CreationDate="2016-01-26T16:01:26.723" Score="1" Body="&lt;p&gt;I believe it's the quotes that is throwing it off. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;section: 'leads',&#xA;lastAssigned: now | date_modify(&quot;-3 days&quot;)&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2016-01-26T16:01:26.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13389" PostTypeId="1" AcceptedAnswerId="13392" CreationDate="2016-01-26T17:02:05.640" Score="0" ViewCount="48" Body="&lt;p&gt;I'm trying to work out how to query some channel posts (events) that take place at a certain venue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'events',&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a 'eventVenue' field in my events section which is an entries field powered by a channel called venues. I want to query by venue ID?&lt;/p&gt;&#xA;" OwnerUserId="4396" LastEditorUserId="125" LastEditDate="2016-01-28T11:44:47.767" LastActivityDate="2016-01-28T11:44:47.767" Title="Display events that appear at certain venue" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13390" PostTypeId="2" ParentId="13387" CreationDate="2016-01-26T17:12:05.337" Score="1" Body="&lt;p&gt;Jameal put me on the right track here. What I actually needed was to select entries where lastAssigned date was more than 3 days old. I accomplished this by.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'leads',&#xA;    lastAssigned:' &amp;lt;' ~ now |date_modify(&quot;-3 days&quot;)&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Posting my solution here because I think this will be helpful to someone in the future.       &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-01-26T17:12:05.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13391" PostTypeId="1" AcceptedAnswerId="13393" CreationDate="2016-01-26T17:23:15.537" Score="2" ViewCount="562" Body="&lt;p&gt;TL;DR: Looking for something like &lt;a href=&quot;https://docs.expressionengine.com/v2/templates/pagination.html#paginate-base&quot; rel=&quot;nofollow&quot;&gt;paginate_base&lt;/a&gt; parameter in EE, but for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My site's homepage has content in tabs for different sections (news, products, etc.) and in each tab I would like to have pagination links that would go to 2nd, 3rd, etc page in each section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in News tab I display news entries and would like to link to /news/p2, /news/p3 etc, on Products tab I would have links to /products/p2, /products/p3 etc. All that on same page, with URL different from /news or /products&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve that in Craft?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2019-05-21T21:38:39.647" Title="Pagination base URL - any way to have pagination links go to URLs other than current one?" Tags="&lt;entries&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13392" PostTypeId="2" ParentId="13389" CreationDate="2016-01-26T17:29:36.050" Score="1" Body="&lt;p&gt;When using an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries field&lt;/a&gt;, you're &quot;relating&quot; the entry to other entries.&#xA;The &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; parameter to filter by related entries is the &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    section: 'events',&#xA;    order: 'eventShowtime desc',&#xA;    relatedTo: venueId&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-26T17:29:36.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13393" PostTypeId="2" ParentId="13391" CreationDate="2016-01-26T19:08:43.463" Score="3" Body="&lt;p&gt;Not tested, but I would assume that you could simply get the total entries, divide by the pagination limit and then generate your dynamic nav using a range loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalEntries = craft.entries.section('news').limit(null).total() %}&#xA;{% set pageLimit = 10 %}&#xA;{% set totalPages = (totalEntries / pageLimit)|round(0, 'ceil') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for i in range(1, totalPages) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/news/p{{ i }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-01-28T09:12:01.693" LastActivityDate="2016-01-28T09:12:01.693" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13394" PostTypeId="1" CreationDate="2016-01-26T19:44:19.507" Score="4" ViewCount="589" Body="&lt;p&gt;As a solution to keep things segregated and clean in git, we started developing websites for craft with templates in the template folder, and js, css, etc in a plugin.  So each website had our base plugin (standard stuff like font-awesome, foundation, jquery, etc) and their website plugin (any additional libraries and their custom css/js).  As an added bonus, our clients could look at the plugin page in the admin panel and see &quot;oh, cool... my website is built by [studio name]!&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To load javascript and css, I used things like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource &quot;pluginname/vendor/foundation/bower_components/modernizr/modernizr.js&quot; first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We started to notice some significant speed issues.&lt;br&gt;&#xA;So I switched to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/assets/vendor/foundation/bower_components/modernizr/modernizr.js&quot; first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the page loaded SIGNIFICANTLY faster.  Like, 3-7 seconds faster.  Which is a lifetime on the web.  The &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; doesn't appear to make any mention of this.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is includeJsFile so much faster?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to use includeJsFile AND keep my resources in the plugin directory?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4019" LastEditorUserId="4019" LastEditDate="2016-01-26T19:51:28.057" LastActivityDate="2016-01-27T00:02:14.103" Title="includeJsFile vs includeJsResource" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;craft-features&gt;&lt;speed&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13395" PostTypeId="1" AcceptedAnswerId="13412" CreationDate="2016-01-26T21:47:49.650" Score="1" ViewCount="132" Body="&lt;p&gt;I have a matrix field with an entries field which ties into another matrix field. Is this possible? Here's what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentMatrix %}&#xA;&#xA;  {# Tabs Block Type #}&#xA;  {% if block.type == &quot;tabs&quot; %}&#xA;    {% set entries = craft.entries.relatedTo(block.tabEntry) %}&#xA;&#xA;    {% for entry in entries %}&#xA;      {# Matrix Content #}&#xA;      {% for block in entry.tabsMatrix.type('videoChannel, videoPlayer, copy') %}&#xA;        {{ block.title }}&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not produce an error, just nothing.&lt;/p&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-01-27T17:20:55.173" Title="Is Matrix &gt; Entries &gt; Matrix possible?" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13396" PostTypeId="2" ParentId="13384" CreationDate="2016-01-26T22:00:33.700" Score="1" Body="&lt;p&gt;That error indicates that Craft is missing some files (or they are corrupted) in its &lt;code&gt;craft/app&lt;/code&gt; folder.  You can download a fresh copy of Craft from &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com&lt;/a&gt; and replace your existing &lt;code&gt;craft/app&lt;/code&gt; folder with the new one and that should resolve it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-26T22:00:33.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13397" PostTypeId="2" ParentId="13395" CreationDate="2016-01-26T23:26:03.113" Score="1" Body="&lt;p&gt;Do you need to &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#filtering-by-block-type&quot; rel=&quot;nofollow&quot;&gt;filter by block type&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentMatrix %}&#xA;&#xA;    {# Tabs Block Type #}&#xA;    {% if block.type == &quot;tabs&quot; %}&#xA;&#xA;        {% set entries = craft.entries.relatedTo(block.tabEntry) %}&#xA;&#xA;        {% for entry in entries %}&#xA;            {# Matrix Content #}&#xA;            {% for content in entry.tabsMatrix.type('videoChannel, videoPlayer, copy') %}&#xA;&#xA;                {% if content.type == &quot;videoChannel&quot; %}&#xA;                    {{ content.title }}&#xA;                {% elseif content.type == &quot;videoPlayer&quot; %}&#xA;                    {{ content.url }}&#xA;                {% else %}&#xA;                    {{ content.text }}&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: Matrix Content vars (*.title, *url, *text) are just examples.&lt;/p&gt;&#xA;" OwnerUserId="12" LastActivityDate="2016-01-26T23:26:03.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13398" PostTypeId="2" ParentId="13394" CreationDate="2016-01-27T00:02:14.103" Score="2" Body="&lt;p&gt;&lt;code&gt;includeJsFile&lt;/code&gt; links directly to the file. It doesn't try anything fancy, it just finds the file (exactly as you've referred to it) and creates a normal &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;includeJsResource&lt;/code&gt; looks for that file in a few different places. It could be a plugin resource, it could be a native Craft resource, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever possible, stick to &lt;code&gt;includeJsFile&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-01-27T00:02:14.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13399" PostTypeId="1" AcceptedAnswerId="13420" CreationDate="2016-01-27T00:23:07.793" Score="0" ViewCount="278" Body="&lt;p&gt;I posed this question in the Craft Help Slack channel earlier but still don't have resolve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background on my field setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry&#xA;- Matrix&#xA;-- Image Block (matrix.imageBlock) (assets)&#xA;--- Mobile Image field (mobileField) (assets)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image block field in the Matrix is using a restricted upload folder &lt;code&gt;{owner.slug}&lt;/code&gt;; which is the entry slug (so its saved to &lt;code&gt;/uplaods/entrySlug/&lt;/code&gt;). I also have a child asset field added to the image block to add a mobile specific image. Prior to Craft 2.5, using &lt;code&gt;{folder.path}&lt;/code&gt; would put those images into the same &lt;code&gt;/uploads/entrySlug/&lt;/code&gt;. Now when I &quot;double click&quot; the asset field to add the mobile image, &lt;code&gt;{folder.path}&lt;/code&gt; returns &lt;code&gt;This field’s target subfolder path is invalid: {folder.path}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was given a few ideas to pursue as it was thought that maybe the dynamic path had not resolved yet, but they didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking that it does indeed revolve around dynamic paths, however, I can't seem to figure it out. All I'm looking to do is save the child asset field files to the same directory that all the other images go to (one image bank, so to speak, for the entire entry).&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2016-01-27T22:37:15.567" Title="How do I set all Assets fields in entry to same directory?" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13400" PostTypeId="2" ParentId="13399" CreationDate="2016-01-27T01:12:03.840" Score="1" Body="&lt;p&gt;I guess it is a bug. Calling &lt;code&gt;getFolder&lt;/code&gt; on an asset model returns an asset folder model, but it somehow looks like its &lt;code&gt;path&lt;/code&gt; property always returns an empty string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested this with local and S3 assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.id(217).first() %}&#xA;{% set folder = asset.getFolder() %}&#xA;&#xA;{{ folder.path }}&#xA;{{ dump(folder) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-27T01:12:03.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13401" PostTypeId="1" AcceptedAnswerId="13404" CreationDate="2016-01-27T10:12:56.173" Score="4" ViewCount="3635" Body="&lt;p&gt;I call a asset like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set headImage = entry.geschaeftsbereichHeadImage.first() %}&#xA;&amp;lt;img src=&quot;{{ headImage.url(headBanner) }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I don't ad any image to this field there is a twig error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;url&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I don't ad any Image to this field in the CP shouldn't there be just no image? Why the error? If I ad a image it works just fine.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-01-27T13:59:03.577" Title="Impossible to invoke a method on a null variable" Tags="&lt;templating&gt;&lt;assets&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13402" PostTypeId="1" CreationDate="2016-01-27T10:12:58.867" Score="2" ViewCount="576" Body="&lt;p&gt;I'm running the latest version of Craft &#xA;Craft Pro 2.5.2760&#xA;I've tried this on a vanilla install and on a current site where the issue was highlighted initially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I copy and paste &quot;this is &lt;strong&gt;some&lt;/strong&gt; &lt;em&gt;text&lt;/em&gt;&quot; into a richtext field, regardless of &quot;Clean up HTML&quot; and &quot;Purify HTML&quot; options being checked or not, when I press save or switch into and out of HTML mode I'm left with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &quot;this is&quot; where the text within the &amp;lt;i&amp;gt; and &amp;lt;b&amp;gt; tags have been stripped out.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the markup looks like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;this is &amp;lt;em&amp;gt;some&amp;lt;/em&amp;gt; &amp;lt;strong&amp;gt;text&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;everything is fine, nothing gets stripped out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is clearly an issue with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;i&amp;gt; and &amp;lt;b&amp;gt; and possibly other tags.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A work around I've found is using in a custom .json in the redactor folder in config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pasteInlineTags: ['b', 'i']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which instantly removes the b and i tags on paste, however this removes the formatting that the user is trying to copy and paste in which kind of defeats the point of being able to copy and paste.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I need a solution that will allow the copy and paste of content from word, or pages or another system where the b and i tags are not stripped out immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to cover myself I have also tried removing all plugins to see if any of them were causing an issue but again this had no impact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help you lovely people.&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2016-02-18T20:55:43.523" Title="Redactor deleting &lt;b&gt; &lt;i&gt; and other inline markup" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13404" PostTypeId="2" ParentId="13401" CreationDate="2016-01-27T12:23:08.903" Score="6" Body="&lt;p&gt;Well, the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#first&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;first&lt;/code&gt;&lt;/a&gt; method &lt;em&gt;only tries&lt;/em&gt; to get an asset model. But if there's no asset added to the field it simply returns &lt;code&gt;null&lt;/code&gt;. So calling a method like &lt;code&gt;getUrl&lt;/code&gt;, or accessing a property like &lt;code&gt;url&lt;/code&gt; or &lt;code&gt;title&lt;/code&gt; can't work, as they do not exist for &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.geschaeftsbereichHeadImage.first() %}&#xA;&#xA;{% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.url(headBanner) }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you'd like to display a fallback image consider somthing like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.geschaeftsbereichHeadImage.first() %}&#xA;{% set imageUrl = image ? image.url(headBanner) : 'path/to/fallback.jpg' %}&#xA;&#xA;&amp;lt;img src=&quot;{{ imageUrl }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-27T13:59:03.577" LastActivityDate="2016-01-27T13:59:03.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13405" PostTypeId="1" CreationDate="2016-01-27T12:27:17.793" Score="0" ViewCount="2179" Body="&lt;p&gt;I have installed WampServer in Windows machine.&#xA;WampServer services (PHP, Apache and MySQL) started successfully.&#xA;When I am trying to access public folder (&lt;a href=&quot;http://localhost:8080/CraftCMS/public/&quot; rel=&quot;nofollow&quot;&gt;http://localhost:8080/CraftCMS/public/&lt;/a&gt;) from CMS project through web it is showing an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our site is temporarily unavailable. Please try again later.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4658" LastEditorUserId="45" LastEditDate="2016-01-27T18:24:52.000" LastActivityDate="2016-01-27T18:24:52.000" Title="&quot;Service Unavailable&quot;" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13406" PostTypeId="2" ParentId="13405" CreationDate="2016-01-27T13:16:26.240" Score="1" Body="&lt;p&gt;The contents of the &quot;public&quot; folder are supposed to be in your web root. So you're probably better off with a separate virtual host instead of accessing your Craft site in a sub folder for that reason. You can also move the contents of the public folder to the web root for localhost. Just change the path to the craft folder in index.php in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an &lt;a href=&quot;https://gist.github.com/jkenters/b6a6bdd647bcd997eac0&quot; rel=&quot;nofollow&quot;&gt;instruction&lt;/a&gt; on how to install Craft's demo site on Wampserver some time ago. Although that's not exactly the same as installing Craft, you should be good to go after following &quot;WampServer setup&quot; and &quot;Virtual host setup&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're still having trouble after that, then it's probably worth taking a look in either the server logs or the logs at craft/storage/runtime/logs to see what's wrong.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-01-27T13:16:26.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13408" PostTypeId="1" AcceptedAnswerId="13409" CreationDate="2016-01-27T15:16:02.590" Score="2" ViewCount="428" Body="&lt;p&gt;This maybe an obvious one but I thought I should document it here. After purchasing Craft Commerce and enabling your payment gateway of choice after disabling the dummy gateway, payments are still being processed using the dummy gateway only.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2016-01-27T15:16:02.590" Title="Why would Craft Commerce only be using the dummy gateway?" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13409" PostTypeId="2" ParentId="13408" CreationDate="2016-01-27T15:16:02.590" Score="3" Body="&lt;p&gt;If you are in development mode then Craft Commerce will still use the dummy gateway. You need to disable dev mode to allow your payment gateway to be used.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2016-01-27T15:16:02.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13410" PostTypeId="1" AcceptedAnswerId="13414" CreationDate="2016-01-27T16:07:01.353" Score="6" ViewCount="3007" Body="&lt;p&gt;I have some content on my entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis rutrum dolor.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I can link to an Entry or Category, but I would like to link to an Asset. For example, a PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to highlight &lt;code&gt;Lorem ipsum&lt;/code&gt; and link that text to a PDF. I can change over to HTML view and manually enter the link, but that seems risky to ask a client who may not know any HTML. Is there a preferred way to select some text and link it to an asset?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-01-27T18:48:47.287" LastActivityDate="2016-01-27T18:48:47.287" Title="How can I link to an Asset from the Rich Text editor?" Tags="&lt;assets&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13411" PostTypeId="1" AcceptedAnswerId="14519" CreationDate="2016-01-27T16:07:45.197" Score="2" ViewCount="137" Body="&lt;p&gt;I'm working on custom element type and I'd like to disable the editor modal at element index view that appears when you double-click on status icons/thumbnails in the title column. Any help?&lt;/p&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2016-01-28T20:52:35.593" LastActivityDate="2016-04-05T11:42:29.417" Title="How to disable element editor on custom element type?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13412" PostTypeId="2" ParentId="13395" CreationDate="2016-01-27T16:09:04.003" Score="1" Body="&lt;p&gt;According to the documentation, I just have to pass the matrix fields handle &lt;code&gt;block&lt;/code&gt; instead of &lt;code&gt;block.tabEntry&lt;/code&gt;. Craft will automatically look for a relationship field (how smart). If you have multiple relation fields, you have to  use the dot notation with the field name. (→ see &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;Relations – Going Through Matrix&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still don't understand why using the dot notation would break it, but it apparently does. I checked my field name several times. Anywho, thanks for the help all! &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentMatrix %}&#xA;&#xA;  {# Tabs Block Type #}&#xA;  {% if block.type == &quot;tabs&quot; %}&#xA;  {% set entries = craft.entries.relatedTo(block) %}&#xA;&#xA;    {% for entry in entries %}&#xA;      {# Matrix Content #}&#xA;      {% for block in entry.tabsMatrix.type('videoChannel, videoPlayer, copy') %}&#xA;        {{ block.title }}&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2209" LastEditorUserId="125" LastEditDate="2016-01-27T17:20:55.173" LastActivityDate="2016-01-27T17:20:55.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13413" PostTypeId="1" AcceptedAnswerId="13415" CreationDate="2016-01-27T17:53:13.517" Score="1" ViewCount="1526" Body="&lt;p&gt;First time working with Craft. I've got a Matrix field for team member profiles, title, name, image, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got all the info pulled into the page but can't get the image. Here is my code, any help is appreciated!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.teamMember %} &#xA;    &amp;lt;figure class=&quot;team-item&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ memberPhoto.url }}&quot; alt=&quot;{{ block.memberName }}&quot; /&amp;gt;&#xA;&#xA;        &amp;lt;figcaption class=&quot;team-item--info&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ block.memberName }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;h4&amp;gt;{{ block.memberTitle }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;h5&amp;gt;hometown: {{ block.memberLocation }}&amp;lt;/h5&amp;gt;&#xA;        &amp;lt;/figcaption&amp;gt;&#xA;    &amp;lt;/figure&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4660" LastEditorUserId="22" LastEditDate="2017-05-09T22:44:55.590" LastActivityDate="2017-05-09T22:44:55.590" Title="Images in Matrix field" Tags="&lt;templating&gt;&lt;assets&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13414" PostTypeId="2" ParentId="13410" CreationDate="2016-01-27T18:10:11.860" Score="15" Body="&lt;p&gt;This isn't really related to Craft specifically, but to allow a user to link to an asset, you will need to enable the feature in the redactor configuration file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, within this file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/config/redactor/Standard.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will see something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&#xA;    &quot;html&quot;,&#xA;    &quot;formatting&quot;,&#xA;    &quot;bold&quot;,&#xA;    &quot;italic&quot;,&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will need to add &lt;code&gt;file&lt;/code&gt; to that list so that it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {&#xA;    &quot;buttons&quot;: [&#xA;    &quot;html&quot;,&#xA;    &quot;formatting&quot;,&#xA;    &quot;bold&quot;,&#xA;    &quot;italic&quot;,&#xA;    &quot;file&quot;&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure to clear out your cache to make sure that Craft can see your updated file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when you highlight some text, you can choose &quot;file&quot; and then select an asset from one of your asset sources.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-01-27T18:10:11.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13415" PostTypeId="2" ParentId="13413" CreationDate="2016-01-27T18:44:14.607" Score="2" Body="&lt;p&gt;You need to loop through the assets as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in block.memberPhoto %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ block.memberName }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/assets-fields&lt;/a&gt; for more info.&lt;/p&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-01-27T18:44:14.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13416" PostTypeId="1" AcceptedAnswerId="13417" CreationDate="2016-01-27T21:27:18.387" Score="3" ViewCount="220" Body="&lt;p&gt;I have a site that allows public registration, and I want to be able to control where users are redirected to after activating their account. However the default user group has access to the Control Panel, so as explained in “&lt;a href=&quot;https://craftcms.stackexchange.com/q/4106/9&quot;&gt;activateAccountSuccessPath doesn&amp;#39;t work as expected&lt;/a&gt;”, users are taken to the Control Panel login page after activation, rather than the path defined by the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to change that behavior, so even users with access to the Control Panel will get redirected to the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; after account activation?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-01-27T21:33:07.467" Title="How can I set the &quot;activateAccountSuccessPath&quot; for users with Control Panel access?" Tags="&lt;users&gt;&lt;config&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13417" PostTypeId="2" ParentId="13416" CreationDate="2016-01-27T21:27:18.387" Score="2" Body="&lt;p&gt;You can write a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that listens to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow&quot;&gt;users.onActivateUser event&lt;/a&gt;, and manually redirects the browser to your desired page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add this code to your plugin’s primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.activateUser', array($this, 'onActivateUser'));&#xA;}&#xA;&#xA;public function onActivateUser(Event $event)&#xA;{&#xA;    /* @var UserModel $user */&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    // Are they in the default group?&#xA;    // (Indicates this was probably public registration)&#xA;    if ($user-&amp;gt;isInGroup('myDefaultGroup'))&#xA;    {&#xA;        // Redirect them to the activateAccountSuccessPath&#xA;        $activateAccountSuccessPath = craft()-&amp;gt;config-&amp;gt;getLocalized('activateAccountSuccessPath');&#xA;        $url = UrlHelper::getSiteUrl($activateAccountSuccessPath);&#xA;        craft()-&amp;gt;request-&amp;gt;redirect($url);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-01-27T21:33:07.467" LastActivityDate="2016-01-27T21:33:07.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13418" PostTypeId="2" ParentId="4106" CreationDate="2016-01-27T21:30:20.357" Score="1" Body="&lt;p&gt;Brad’s answer does a good job explaining the behavior so I’m leaving the original Q&amp;amp;A in-tact, but it’s possible to work around the behavior with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I posted a new Q&amp;amp;A that explains how to do that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/13416/9&quot;&gt;How can I set the &amp;quot;activateAccountSuccessPath&amp;quot; for users with Control Panel access?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-27T21:30:20.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13419" PostTypeId="1" AcceptedAnswerId="13503" CreationDate="2016-01-27T21:34:39.017" Score="2" ViewCount="134" Body="&lt;p&gt;This is a fairly generalized question, maybe I completely missed where to learn about this, but I've always been curious about it as it'd help me be a little more aware of what would and would not be good practice in plugin development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I often read the &lt;strong&gt;first user request is slowest&lt;/strong&gt; to Craft Sites point mentioned in articles/posts, what exactly is that referring to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With each page request are all plugins and their files opened and loaded up? Or are these loaded and stored &lt;em&gt;somewhere&lt;/em&gt; for X period of time, decreasing loading time per request?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples of plugin scenarios/questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a fairly decent-sized loop in two plugins via &lt;code&gt;public function registerSiteRoutes() {}&lt;/code&gt; that generate 200-1000+ custom routes, as those URL's will not have any content from Craft's entries (and thus don't have URL's,) or are completely dynamic (for forum topics with unpredictable topic urls.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this loop that creates these URL's running every single time a page is requested? Is this bad practice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can have some &lt;strong&gt;plugin services&lt;/strong&gt; load large files of data in &lt;code&gt;__construct()&lt;/code&gt;, or as &lt;code&gt;var $data;&lt;/code&gt; for use in specific scenarios. Under the assumption that these service files are only loaded when a plugin calls to it, it wouldn't be slowing requests down that don't use the data because only the pages calling for them would load the data, such as through &lt;code&gt;craft()-&amp;gt;myPluginName_serviceName-&amp;gt;getVarWithLotsOfData;&lt;/code&gt; requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do these files get loaded up regardless of being called, and therefore should be re-written into functions so that they don't load the data unless asked?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin count -- does having many small, niche plugins affect load speed versus less but larger plugins that cover more functionality? Is plugin count something that needs to be carefully considered, a common caution when working with a plugin-based CMS like Wordpress?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I guess the question is, I would love to be able to read a detailed explanation of the scheme/process in how plugins and their respective &lt;strong&gt;plugin file, config, services, controllers, templates, variables etc&lt;/strong&gt; are loaded, and if there is a guideline on what is and isn't good practice when designing the flow of plugins for optimization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is documentation that I missed that greatly covers and explains all of this, feel free to link it and put me in a corner for shame. D:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="22" LastEditDate="2017-05-09T22:44:01.490" LastActivityDate="2017-05-09T22:44:01.490" Title="Plugin loading scheme" Tags="&lt;plugin-development&gt;&lt;performance&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13420" PostTypeId="2" ParentId="13399" CreationDate="2016-01-27T22:37:15.567" Score="4" Body="&lt;p&gt;For long and complicated reasons, in order for this to work after Craft 2.5, your inner Asset field (the one that was restricting uploads to &lt;code&gt;{folder.path}&lt;/code&gt;, will need to &lt;code&gt;{folder.path|trim('/')}&lt;/code&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-27T22:37:15.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13421" PostTypeId="1" AcceptedAnswerId="13436" CreationDate="2016-01-28T02:22:55.697" Score="2" ViewCount="877" Body="&lt;p&gt;I would like my &lt;code&gt;robots.txt&lt;/code&gt; file to be generated by Craft. Things that I have tried that don't work:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a &lt;code&gt;craft/templates/robots.txt&lt;/code&gt; template&lt;/li&gt;&#xA;&lt;li&gt;a &lt;code&gt;craft/templates/robots.txt.twig&lt;/code&gt; template&lt;/li&gt;&#xA;&lt;li&gt;a route for &lt;code&gt;robots.txt&lt;/code&gt; that points to a &lt;code&gt;robots.twig&lt;/code&gt; template&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both of these work fine for a &lt;code&gt;foo.txt&lt;/code&gt; file. The error I get is &lt;code&gt;404&lt;/code&gt;,  not the Craft 404, but the system one - nginx.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2016-01-28T18:29:49.050" LastActivityDate="2016-02-01T01:13:41.427" Title="Unable to manage robots.txt in Craft" Tags="&lt;404&gt;&lt;nginx&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13422" PostTypeId="2" ParentId="5224" CreationDate="2016-01-28T03:56:32.233" Score="2" Body="&lt;p&gt;I've used JS to copy the form input content into hidden fields that gets added to the message in this way...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;fullName&quot; name=&quot;message[Full Name]&quot; class=&quot;fullName&quot;&amp;gt;&#xA;&#xA;&amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;emailAddress&quot; name=&quot;message[Email Address]&quot; class=&quot;emailAddress&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;currentDate&quot; name=&quot;message[Date Submitted]&quot; class=&quot;currentDate&quot; value=&quot;{{ now|date(&quot;F j, Y - g:i a&quot;) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I add something like this on submit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#fromName').bind('keypress keyup blur', function() {&#xA;  $('#fullName').val($(this).val());&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the info copied to the corresponding fields. This helps me get a nice emailed message with all the data I want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Full Name: jane Doe&lt;br&gt;&#xA;Email Address: jane@gmail.com&lt;br&gt;&#xA;Phone: 5551234567&lt;br&gt;&#xA;Message: TESTING ONLY&lt;br&gt;&#xA;Date Submitted: December 17, 2015 - 12:02 pm&lt;/em&gt;                       &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution gets the info needed into the notification, but doesn't help with headers.&lt;/p&gt;&#xA;" OwnerUserId="442" LastActivityDate="2016-01-28T03:56:32.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13423" PostTypeId="2" ParentId="13421" CreationDate="2016-01-28T09:33:19.393" Score="5" Body="&lt;p&gt;You can simply create a 'robots.txt' file in your templates folder and populate it using twig (templates do not need to end in &lt;code&gt;.twig&lt;/code&gt;). Not sure what you're trying to control exactly, but something like this should technically work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;User-agent: *&#xA;{% set entries = craft.entries.limit(null) %} &#xA;{% for entry in entries %}&#xA;    Disallow: {{ entry.uri }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Terrible example but you get the idea. Then just delete the robots.txt file that is in your public folder.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-01-28T09:33:19.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13424" PostTypeId="1" AcceptedAnswerId="13427" CreationDate="2016-01-28T10:49:49.733" Score="1" ViewCount="482" Body="&lt;p&gt;I've tried to follow a ton of other articles posted on Stackoverflow for showing posts between 2 dates. I just can't seem to get it working and I keep getting an error of: Call to a member function getTimestamp() on boolean&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = now | date_modify('first day of ' ~ qFilter) %}&#xA;{% set endDate = startDate | date_modify('+ 1 month') %}&#xA;{% set entries = craft.entries.section('events').postDate('&amp;lt;= startDate').expiryDate('&amp;gt;= endDate') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(qFilter is a url param: eg &quot;May&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to show posts that were live during a certain month.&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2016-01-28T11:38:10.143" Title="Showing posts live during a date range" Tags="&lt;entries&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13425" PostTypeId="1" CreationDate="2016-01-28T11:02:39.253" Score="0" ViewCount="186" Body="&lt;p&gt;In my controller I fetched the &lt;code&gt;Entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Entry');&#xA;$criteria-&amp;gt;section = 'offlineEvents';&#xA;$event = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Entry has a matrix field with handler called &lt;code&gt;eventDetails&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I access this matrix field values? I want to do it like I'd do it in template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for items in entry.eventDetails %}&#xA;    {% if items.getType() == 'heading' %}  &#xA;     ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I cant do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($event-&amp;gt;eventDetails as $details) { ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it's giving me empty array.&lt;/p&gt;&#xA;" OwnerUserId="4157" LastActivityDate="2016-01-28T11:54:57.700" Title="Fetch matrix field attributes in controller" Tags="&lt;matrix&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13426" PostTypeId="1" AcceptedAnswerId="13429" CreationDate="2016-01-28T11:17:21.123" Score="4" ViewCount="346" Body="&lt;p&gt;For a while I've been having difficulty handling large navigation in craft. I built this site a while ago, and if I am honest I would probably change the structure if I was doing it again, but that's for another time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nav is stored in a structure and each navigation entry is either linked to an entry or a custom url is entered. There are approximately 300 pages in the entire nav.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I use to generate the nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro navigation(pages, id='') %}&#xA;    &amp;lt;nav role=&quot;navigation&quot;&amp;gt;&#xA;        &amp;lt;ul role=&quot;menu&quot; {% if id|length %} id=&quot;{{ id }}&quot; {% endif %}&amp;gt;&#xA;        {% nav node in pages %}&#xA;            {% set url          = node.url|length ? node.url : node.linkedEntry|length ? node.linkedEntry.first().url : node.customUrl %}&#xA;            {% set active       = node.slug == craft.request.getSegment(node.level) %}&#xA;            {% set class        = node.children|length ? &quot;has-children&quot; %}&#xA;            {% set class        = active ? class ~ &quot; active&quot; : url == craft.request.url ? class ~ &quot; active&quot; : class %}&#xA;            {% set separator    = node.separator  ? 'separator' %}&#xA;&#xA;            &amp;lt;li class=&quot;{{ class is not empty ? class  : &quot;&quot; }}{{ separator }} level-{{ node.level }}&quot; &amp;gt;&#xA;               &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;&#xA;                   &amp;lt;span&amp;gt;{{ node.title }}&amp;lt;/span&amp;gt;&#xA;               &amp;lt;/a&amp;gt;&#xA;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul class=&quot;children&quot;&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;               {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/nav&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that this is incredibly slow, in some cases I see load times of over 10s, which is unacceptable! I know that this is caused by the nav and not the rest of the page content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use caching to speed rendering up, and this works fine, but that only really masks the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I reckon that the bulk of the time is taken up checking whether it is active, what class it has etc. Is it possible to store it as a blob and run some kind of regex match on it as a whole?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer it if the user could change the nav through the CMS, but if I am honest, this is not a necessity. I've even thought about hardcoding it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any one have any pointers or experience in the past? &lt;/p&gt;&#xA;" OwnerUserId="4289" LastEditorUserId="4289" LastEditDate="2016-01-28T11:51:01.983" LastActivityDate="2016-01-28T14:35:51.863" Title="Large, Complex Navigation" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13427" PostTypeId="2" ParentId="13424" CreationDate="2016-01-28T11:31:21.620" Score="3" Body="&lt;p&gt;You are passing a string &lt;code&gt;&amp;lt;= startDate&lt;/code&gt; to the field parameter, but you actually want it to be a string &lt;code&gt;&amp;lt;= 2016-01-01&lt;/code&gt;, which you can get by concatenationg the &lt;code&gt;&amp;lt;=&lt;/code&gt; string with the datetime variable. So change your parameters like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;postDate('&amp;lt;= ' ~ startDate)&lt;/code&gt; instead of&lt;br&gt;&#xA;&lt;code&gt;postDate('&amp;lt;= startDate')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-28T11:38:10.143" LastActivityDate="2016-01-28T11:38:10.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13428" PostTypeId="2" ParentId="13425" CreationDate="2016-01-28T11:54:57.700" Score="1" Body="&lt;p&gt;Your code looks right. I'd double check for spelling mistakes and check if there's a entry model returned from your &lt;code&gt;$event = $criteria-&amp;gt;first();&lt;/code&gt; by outputting its ID with &lt;code&gt;return $event-&amp;gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-28T11:54:57.700" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13429" PostTypeId="2" ParentId="13426" CreationDate="2016-01-28T12:24:54.410" Score="4" Body="&lt;p&gt;It's those two lines that trigger database queries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set url = node.url|length ? node.url : node.linkedEntry|length ? node.linkedEntry.first().url : node.customUrl %}&#xA;{% set class = node.children|length ? &quot;has-children&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first one can be optimized by using the &lt;code&gt;first&lt;/code&gt; method in the ternary condition. You just need to know &lt;em&gt;if&lt;/em&gt; there is a linked entry, not how many. &lt;code&gt;node.linkedEntry|length&lt;/code&gt; queries for all matching entry models and is slower than&#xA;just calling &lt;code&gt;node.linkedEntry.first()&lt;/code&gt;. So change it to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set url = node.url|length ? node.url : node.linkedEntry.first() ? node.linkedEntry.first().url : node.customUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same applies to the &lt;code&gt;node.children&lt;/code&gt; criteria model in the second line. Change it accordingly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set class = node.children.first() ? &quot;has-children&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's about all you can do to optimize the code, now you should definitly add caching to it. It's not as straightforward to implement in this situation, as there's the dynamic &quot;active&quot; class you want to add to the output. So you have to either cache the whole navigation for each page it's used individually (each with the active class at the right place) or you use the string replacement technique &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4782/adding-active-class-to-globally-cached-navigation&quot;&gt;described in this SE&lt;/a&gt; to cache the navigation globally for all pages.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-01-28T14:29:12.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13430" PostTypeId="1" AcceptedAnswerId="13500" CreationDate="2016-01-28T14:22:27.750" Score="5" ViewCount="898" Body="&lt;p&gt;I'm trying to get a good appreciation for Craft's current capabilities and maturity. I've seen the demo and the docs but there is definitely a learning curve and what appears to be a need for much more coding - some of which I'll certainly need to hire a developer to assist regardless of platform. I see sparse videos, don't see many third party addons either, and docs suggest creating object oriented code just to set up field attributes. Thank you for any guidance in advance.  I'll share a little about my goals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Project: I'm creating a document management system that is the same as you've probably seen in many school libraries (doc title, a long abstract that summarizes the full doc, excerpt and several taxonomies that classify docs into doc type (research paper, proposed law, etc.), country of origin, organization creating the doc, etc. It also has some doc fields, e.g. document language, date published, etc. Some primary objectives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;strong&gt;Create relationships between docs.&lt;/strong&gt; For example, if a document has been translated into 3 other languages I'd like to be able to recognize all those related documents in the doc and display the translated documents in a list on the front end for easy access so a user can view the doc in their preferred language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) &lt;strong&gt;Ajax based filtering system.&lt;/strong&gt; This has me leaning toward ExpressionEngine / Wordpress because of the availability of a very well thought out ajax-based filtering system, e.g. Low Search. Wordpress has numerous plugins, including WP-Types (although overall EE seems a better document management solution). Quickly done, no need to program and reinvent the wheel. A filtering menu can appear in a sidebar and a user can gradually filter through the results, e.g. perform a search for &quot;widget&quot;, see results, then refine by documents published between a certain date, then refine by country, language, etc. And you can add/remove these fields very easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) &lt;strong&gt;Document import/export.&lt;/strong&gt; For example, export the document to Word, PDF, etc. What makes Craft intriguing is that fields are entered in discrete, identifiable elements. For example, what if I wanted to export just document headers for a long document, it seems Craft can theoretically accomplish this easily because every header is a discrete field. It takes more work on the back end for data entry (but there is no perfect system.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) &lt;strong&gt;Document Version System.&lt;/strong&gt; Another issue would be to track revisions of the document as it moves along, e.g. first proposal. First revision. Second revision. Submission for approval. Document approved. -- Each of these documents are different versions of the same document. I've seen some extra data types which leads me to believe that the ability to generate a list of these documents as being related might be better suited with Craft - although I'm not familiar enough to be sure. Don't see EE/WP having a better solution, just manual fields that would require each document to be updated or a macro which inserts data each time a new revision is added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you all for any comments or thoughts. &lt;/p&gt;&#xA;" OwnerUserId="4664" LastEditorUserId="45" LastEditDate="2016-08-13T02:59:57.423" LastActivityDate="2016-08-13T02:59:57.423" Title="Is Craft suitable for these specific document management goals?" Tags="&lt;plugins&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13431" PostTypeId="2" ParentId="13426" CreationDate="2016-01-28T14:35:51.863" Score="2" Body="&lt;p&gt;Carl's answer is very good and offers some quick performance wins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to add a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First – I think its wrong to think of caching as &quot;just masking the problem&quot;. In a situation where you're still running into performance issues and long load times after optimizing your code as much as possible (and there isn't another way to design or model the content), caching is actually the only viable solution – apart from significantly upgrading your server hardware – in terms of getting better performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second – even if you can shave those 10 seconds off of the pageload by caching your navigation, you need to remember that every time an entry is updated, deleted or added to the navigation Structure, Craft will clear the cache (as it should). This means that the first person visiting the site after the navigation is updated will experience the extremely long pageload. You can combat this by implementing &lt;a href=&quot;https://github.com/sjelfull/Craft-CacheWarmer&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;cache warming&lt;/em&gt;&lt;/a&gt;, which basically means that you rebuild the cache immediately after clearing it.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-28T14:35:51.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13433" PostTypeId="2" ParentId="13430" CreationDate="2016-01-28T15:24:11.853" Score="4" Body="&lt;p&gt;I think Craft would be a very suitable CMS for your project, based on you've laid out here. In fact, we're using Craft for two projects that are very similar. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relating entries&lt;/strong&gt; - Craft has a built-in field for entry relationships that works really well, however, for what you've described, you wouldn't really need it. Instead, Craft has multi-language support built in, so you could take advantage of that to use only one entry for multiple translations of a document.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ajax based filtering&lt;/strong&gt; - While EE does have Low Search, Low Search isn't Ajax by nature. You still have to write some JS to hit a template that pulls Low Search results via Ajax. Craft can do the same thing, but it's built in rather than using a 3rd party plugin. The advantage of Low Search is that you can give weight to individual fields. Craft does not have that built-in to their search functionality, but in my experience, their search does a very good job.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document import/export&lt;/strong&gt; - There is a 3rd party plugin that can convert a template to PDF. I'm not sure about Word. I've used the PDF plugin on two projects and it works really well. As far as importing, there is also an import plugin available. Content would need to be in a CSV format to be able to map to individual fields.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Versioning&lt;/strong&gt; - This is built in to Craft right out of the box. Craft makes it very easy to save multiple versions of an entry.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Overall, as someone who has used Craft, EE and WordPress, I would recommend Craft for this project. Craft is a faster platform than EE, and much more secure than WP. As far as a learning curve goes, EE would be a higher curve because they have built their own templating engine, using syntax that is specific only to EE. Craft, on the other hand, uses Twig - an open source templating engine. You're more likely to find a developer that knows Twig well than someone who knows EE. Wordpress doesn't use a templating engine per se, but rather relies on raw PHP in the templates (from a security standpoint, that's not really a smart idea.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need help with this project, I'd be happy to talk to you more about it. I'm the Engineering Director for Paramore Digital (&lt;a href=&quot;http://paramoredigital.com&quot; rel=&quot;nofollow&quot;&gt;http://paramoredigital.com&lt;/a&gt;), and as I mentioned, we're currently building two projects very similar to the one you're describing.&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-01-28T15:24:11.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13434" PostTypeId="1" CreationDate="2016-01-28T15:30:46.283" Score="1" ViewCount="215" Body="&lt;p&gt;Using Sprout Forms and have added the Form Name &gt; Select a Form to the Entry's field layout.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DUrUz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DUrUz.png&quot; alt=&quot;entry field layout&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I select a form on this Entry, what do I hook into to get this to display on my template?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yNTBB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yNTBB.png&quot; alt=&quot;selected form in entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know from the documentation that you can specifically pass in the form's Handle &lt;code&gt;{{ craft.sproutForms.displayForm('myForm') }}&lt;/code&gt;, but what do I need to do to get the drop-down form to display if there is one selected?&lt;/p&gt;&#xA;" OwnerUserId="4665" LastEditorUserId="57" LastEditDate="2016-01-28T18:50:09.620" LastActivityDate="2016-01-31T23:31:40.733" Title="Using an Entry's Added Form in a template in Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13436" PostTypeId="2" ParentId="13421" CreationDate="2016-01-28T18:35:29.790" Score="3" Body="&lt;p&gt;It turns out this is an nginx problem. &lt;a href=&quot;https://trepmal.com/2014/03/28/nginx-robots-txt-and-copy-pasta/&quot; rel=&quot;nofollow&quot;&gt;This post&lt;/a&gt; describes it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The troubling part of the nginx configuration looks like this&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;location = /robots.txt {&#xA;     access_log off;&#xA;     log_not_found off;&#xA;  }&lt;/code&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;What’s inside isn’t the problem. It’s pretty basic, whether found (access_log) or not (log_not_found) don’t log it ( off;).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The problem is with this: location = /robots.txt&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;That equals sign means that when the request matches, perform only these rules and nothing else. When you have a robots file, then no problem – it just gets served up, plain and simple. But if you don’t, there’s nothing in that block that lets WordPress handle the request, so you get a 404.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So if I comment out that part of the config file, everything works as it should.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-01-28T18:35:29.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13437" PostTypeId="1" AcceptedAnswerId="13438" CreationDate="2016-01-28T19:32:54.053" Score="5" ViewCount="204" Body="&lt;p&gt;Every time I create a database backup, I find myself instinctively clearing the cache first. My gut tells me that any cached data would be unnecessarily included in the export.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this helpful, or am I just being OCD?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YajOj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YajOj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-02-21T23:44:52.067" Title="Good practice to &quot;Clear Caches&quot; before you &quot;Backup Database&quot;?" Tags="&lt;database&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13438" PostTypeId="2" ParentId="13437" CreationDate="2016-01-28T19:38:56.483" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this helpful, or am I just being OCD?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Completely OCD. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database backup class already excludes unnecessary tables like asset indexing data, sessions, template caches, etc. during a backup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/etc/db/DbBackup.php#L46&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/etc/db/DbBackup.php#L46&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-02-21T23:44:52.067" LastActivityDate="2018-02-21T23:44:52.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13439" PostTypeId="1" AcceptedAnswerId="13440" CreationDate="2016-01-29T00:05:44.923" Score="0" ViewCount="21" Body="&lt;p&gt;I've noticed in a recent (not sure which exactly) version of Craft that the &lt;code&gt;@property-read&lt;/code&gt; declarations for each of the inbuilt services have been dropped from &lt;code&gt;/craft/app/Craft.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means in PHP Storm, I no longer receive valuable code hints following a &lt;code&gt;craft()-&amp;gt;&lt;/code&gt; statement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5cs6X.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5cs6X.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a new way to access these hints in the recent version? Maybe I've missed something and accessing services via &lt;code&gt;craft()&lt;/code&gt; is no longer the preferred method?&lt;/p&gt;&#xA;" OwnerUserId="938" LastActivityDate="2016-01-29T00:10:55.153" Title="Where did the @property delcarations for the inbuilt services go?" Tags="&lt;plugin-development&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13440" PostTypeId="2" ParentId="13439" CreationDate="2016-01-29T00:10:55.153" Score="3" Body="&lt;p&gt;The bad news is it's been a bug in PHPStorm since 9.0.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news is it's been fixed in the PHPStorm 11 &lt;a href=&quot;https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program&quot; rel=&quot;nofollow&quot;&gt;EAP&lt;/a&gt; and will be in the 11 final release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://youtrack.jetbrains.com/issue/WI-28394&quot; rel=&quot;nofollow&quot;&gt;https://youtrack.jetbrains.com/issue/WI-28394&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-29T00:10:55.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13441" PostTypeId="2" ParentId="11061" CreationDate="2016-01-29T00:16:59.163" Score="3" Body="&lt;p&gt;Try something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#fields-myCateogryField&quot;).data(&quot;elementSelect&quot;)&#xA;    .on(&quot;selectElements&quot;, function(e){console.log(e);})&#xA;    .on(&quot;removeElements&quot;, function(e){console.log(e);});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3557" LastActivityDate="2016-01-29T00:16:59.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13443" PostTypeId="2" ParentId="10671" CreationDate="2016-01-29T01:37:11.420" Score="4" Body="&lt;p&gt;Had the same issue running OS X running native Apache.  It could be PHP config issue.  Increase the max_nesting_level to something like 200.  Add/edit the following line in your php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level = 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-01-29T01:37:11.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13444" PostTypeId="2" ParentId="2713" CreationDate="2016-01-29T01:39:45.290" Score="0" Body="&lt;p&gt;I had the same issue and this is how I solved it.  Increase the max_nesting_level to something like 200.  Add/edit the following line in your php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level = 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-01-29T01:39:45.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13445" PostTypeId="2" ParentId="13150" CreationDate="2016-01-29T01:41:51.797" Score="1" Body="&lt;p&gt;Same issue here -- could be a PHP one.  I solved it by increasing the max_nesting_level to something like 200.  Add/edit the following line in your php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level = 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-01-29T01:41:51.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13446" PostTypeId="1" AcceptedAnswerId="13448" CreationDate="2016-01-29T09:11:27.287" Score="0" ViewCount="262" Body="&lt;p&gt;Using the Element API, I want to return the values from checkboxes (the $block-&gt;product field). These checkboxes are within a matrix that I am already gathering data from. Currently am doing this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'endpoints' =&amp;gt; [&#xA;    'fullmembers.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'User',&#xA;        'criteria' =&amp;gt; ['group' =&amp;gt; 'fullMembership'],&#xA;        'transformer' =&amp;gt; function(UserModel $member) {&#xA;            $businessCategories = [];&#xA;            foreach ($member-&amp;gt;businessTypeMarketSectorsProducts as $block) {&#xA;                switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                    case 'businessCategory':&#xA;&#xA;                        $businessCategories[] = [&#xA;                            'businessType' =&amp;gt; $block-&amp;gt;businessType-&amp;gt;value,&#xA;                            'marketSector' =&amp;gt; $block-&amp;gt;marketSector-&amp;gt;value,&#xA;                            'product' =&amp;gt; $block-&amp;gt;product //Here you can see I'm calling the product field... &#xA;                        ];&#xA;                        break;&#xA;                }&#xA;            }&#xA;&#xA;            return [&#xA;                'id' =&amp;gt; $member-&amp;gt;id,&#xA;                'companyName' =&amp;gt; $member-&amp;gt;membersCompanyName,&#xA;                'addressLine3' =&amp;gt; $member-&amp;gt;membersAddressLine3,&#xA;                'lat' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lat,&#xA;                'lng' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lng,&#xA;                'email' =&amp;gt; $member-&amp;gt;email,&#xA;                // 'profile' =&amp;gt; '/directory/company/' . $member-&amp;gt;id . '/' . $member-&amp;gt;username,&#xA;                'profile' =&amp;gt; UrlHelper::getUrl(&quot;directory/company/{$member-&amp;gt;id}&quot;),&#xA;                'businessCategories' =&amp;gt; $businessCategories&#xA;            ];&#xA;        },&#xA;    ]&#xA;]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a sample response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {&#xA;  &quot;id&quot;: &quot;1506&quot;,&#xA;  &quot;companyName&quot;: &quot;Airsprung Group Plc&quot;,&#xA;  &quot;addressLine3&quot;: &quot;&quot;,&#xA;  &quot;lat&quot;: &quot;51.33188454&quot;,&#xA;  &quot;lng&quot;: &quot;-2.20657303&quot;,&#xA;  &quot;email&quot;: &quot;email@email.co.uk&quot;,&#xA;  &quot;profile&quot;: &quot;http:\/\/craft.fira\/directory\/company\/1506&quot;,&#xA;  &quot;businessCategories&quot;: [{&#xA;    &quot;businessType&quot;: &quot;Manufacture&quot;,&#xA;    &quot;marketSector&quot;: &quot;Domestic&quot;,&#xA;    &quot;product&quot;: {&#xA;      &quot;0&quot;: {&#xA;        &quot;label&quot;: &quot;Beds&quot;,&#xA;        &quot;value&quot;: &quot;Beds&quot;,&#xA;        &quot;selected&quot;: true&#xA;      },&#xA;      &quot;1&quot;: {&#xA;        &quot;label&quot;: &quot;Mattresses&quot;,&#xA;        &quot;value&quot;: &quot;Mattresses&quot;,&#xA;        &quot;selected&quot;: true&#xA;      },&#xA;      &quot;2&quot;: {&#xA;        &quot;label&quot;: &quot;Seating \/ upholstery&quot;,&#xA;        &quot;value&quot;: &quot;Seating \/ upholstery&quot;,&#xA;        &quot;selected&quot;: true&#xA;      }&#xA;    }&#xA;  }, {&#xA;    &quot;businessType&quot;: &quot;Manufacture&quot;,&#xA;    &quot;marketSector&quot;: &quot;Contract&quot;,&#xA;    &quot;product&quot;: {&#xA;      &quot;0&quot;: {&#xA;        &quot;label&quot;: &quot;Beds&quot;,&#xA;        &quot;value&quot;: &quot;Beds&quot;,&#xA;        &quot;selected&quot;: true&#xA;      },&#xA;      &quot;1&quot;: {&#xA;        &quot;label&quot;: &quot;Mattresses&quot;,&#xA;        &quot;value&quot;: &quot;Mattresses&quot;,&#xA;        &quot;selected&quot;: true&#xA;      },&#xA;      &quot;2&quot;: {&#xA;        &quot;label&quot;: &quot;Seating \/ upholstery&quot;,&#xA;        &quot;value&quot;: &quot;Seating \/ upholstery&quot;,&#xA;        &quot;selected&quot;: true&#xA;      }&#xA;    }&#xA;  }]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like the response to just show the values of the product checkboxes. Can you suggest a way to do this so that I am not returning the label and selected states? Ideally something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;product&quot;: {&quot;Beds&quot;, &quot;Mattresses&quot;, &quot;Seating \/ upholstery&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-29T09:40:08.180" Title="Element API + checkboxes" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13447" PostTypeId="1" CreationDate="2016-01-29T09:37:36.743" Score="1" ViewCount="370" Body="&lt;p&gt;How can I give another localization its own &quot;Single&quot; as homepage. My main language has its own very unique homepage but for the other languages I need all the fields and HTML/CSS of my about us page. I want to do this without adding all the fields to some other tab in my homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any possible way to make this happen. I tried already to set the homepage for the main language open. Created a new Single for the other language but I dont have the option to set it as homepage for the current language.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-02-28T10:43:24.590" Title="Different Single as homepage for other languages" Tags="&lt;localization&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13448" PostTypeId="2" ParentId="13446" CreationDate="2016-01-29T09:40:08.180" Score="1" Body="&lt;p&gt;You should be able to foreach the $block-&gt;product to include the selected values (or labels)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'fullmembers.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; ['group' =&amp;gt; 'fullMembership'],&#xA;            'transformer' =&amp;gt; function(UserModel $member) {&#xA;                $businessCategories = [];&#xA;                foreach ($member-&amp;gt;businessTypeMarketSectorsProducts as $block) {&#xA;                    switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                        case 'businessCategory':&#xA;                            $productValues = [];&#xA;                            foreach ($block-&amp;gt;product as $product) {&#xA;                                if ($product-&amp;gt;selected) {&#xA;                                    $productValues[] = $product-&amp;gt;value;&#xA;                                }&#xA;                            }&#xA;                            $businessCategories[] = [&#xA;                                'businessType' =&amp;gt; $block-&amp;gt;businessType-&amp;gt;value,&#xA;                                'marketSector' =&amp;gt; $block-&amp;gt;marketSector-&amp;gt;value,&#xA;                                'product' =&amp;gt; $productValues&#xA;                            ];&#xA;                            break;&#xA;                    }&#xA;                }&#xA;&#xA;                return [&#xA;                    'id' =&amp;gt; $member-&amp;gt;id,&#xA;                    'companyName' =&amp;gt; $member-&amp;gt;membersCompanyName,&#xA;                    'addressLine3' =&amp;gt; $member-&amp;gt;membersAddressLine3,&#xA;                    'lat' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lat,&#xA;                    'lng' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lng,&#xA;                    'email' =&amp;gt; $member-&amp;gt;email,&#xA;                    // 'profile' =&amp;gt; '/directory/company/' . $member-&amp;gt;id . '/' . $member-&amp;gt;username,&#xA;                    'profile' =&amp;gt; UrlHelper::getUrl(&quot;directory/company/{$member-&amp;gt;id}&quot;),&#xA;                    'businessCategories' =&amp;gt; $businessCategories&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-01-29T09:40:08.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13449" PostTypeId="2" ParentId="10292" CreationDate="2016-01-29T09:48:09.743" Score="1" Body="&lt;p&gt;This is not much of an answer but basically Brad was right - I just needed to replicate the logic that the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tasks/DeleteStaleTemplateCachesTask.php&quot; rel=&quot;nofollow&quot;&gt;DeleteStaleTemplateCachesTask&lt;/a&gt; does in its &lt;code&gt;getTotalSteps()&lt;/code&gt; and &lt;code&gt;runStep()&lt;/code&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to work out exactly what caches will be just about to be deleted. I'm not going to post the code here as it is literally a copy/paste from the DeleteStaleTemplateCachesTask.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2016-01-29T09:48:09.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13450" PostTypeId="1" AcceptedAnswerId="13454" CreationDate="2016-01-29T10:20:23.643" Score="1" ViewCount="2052" Body="&lt;p&gt;I want to convert a String into kebab-case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'Hello there' -&amp;gt; 'hello-there'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm working in the Element API, so haven't got the pleasure of using the simple Twig filter. I guess there is a way of doing it in PHP. Any suggestions? Thank you&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-29T13:00:03.723" Title="Element API - 'String' to 'kebab-case'" Tags="&lt;filter&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13451" PostTypeId="2" ParentId="13447" CreationDate="2016-01-29T10:30:48.250" Score="1" Body="&lt;p&gt;You don't need to use the &quot;This is for the homepage&quot; checkbox at all. All it does is to (1) set up&#xA;a route to the entry template specified in the section settings and (2) make the entry model available to this template&#xA;from an &lt;code&gt;entry&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just deselect this option and configure the above manually. The simplest way to set up a route for the homepage is&#xA;to create a template index.html in craft/templates/ and Craft picks it up automatically for hompage requests (→ see pt. 6 in the &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;routing docs&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now query for the entry model (your &quot;single&quot;) depending on the requested locale to solve (2) and then include a template partial&#xA;into the index.html to solve (1).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.locale == 'fr' %}&#xA;    {% set entry = craft.entries.section('home_fr').first() %}&#xA;    {% include '_pages/home_fr' %}&#xA;{% elseif craft.locale == 'de' %}&#xA;    {% set entry = craft.entries.section('home_de').first() %}&#xA;    {% include '_pages/home_de' %}&#xA;{% else %}&#xA;    {% set entry = craft.entries.section('home').first() %}&#xA;    {% include '_pages/home' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-29T10:30:48.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13452" PostTypeId="1" AcceptedAnswerId="13464" CreationDate="2016-01-29T10:30:51.157" Score="3" ViewCount="1572" Body="&lt;p&gt;I'm building a small Craft site to function as a content backend, exposing all of the content via the ElementAPI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One field I'm retrieving and displaying in the API is the URL on Amazon S3 for an image asset that's contained in a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd ideally like to do is, when the user uploads this image and it's added to the S3 bucket, to be able to access S3 URLs for the small, medium and large &lt;strong&gt;cropped Image Transforms&lt;/strong&gt; that I've defined. Then, I can make all of these available as an Element API endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of Image Transforms and S3 is that Craft usually handles this on-the-fly when an image is referenced in a frontend template. But is there a way to do this when there will be no frontend templates, and the only way that information will be accessed is via the Element API?&lt;/p&gt;&#xA;" OwnerUserId="4672" LastEditorUserId="9" LastEditDate="2016-01-29T15:21:53.060" LastActivityDate="2018-10-22T10:28:32.680" Title="Access Image Transforms for S3 images via Element API" Tags="&lt;image-transforms&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13453" PostTypeId="2" ParentId="13450" CreationDate="2016-01-29T10:33:22.880" Score="1" Body="&lt;p&gt;I guess you could make use of some php functions to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$string = 'Hello there';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First &lt;a href=&quot;http://php.net/manual/en/function.explode.php&quot; rel=&quot;nofollow&quot;&gt;explode&lt;/a&gt; the string using a space as the seperator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$result = explode(&quot; &quot;, $string);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will give you an array like &lt;code&gt;array(0 =&amp;gt; 'Hello' 1 =&amp;gt; 'there')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can &lt;a href=&quot;http://php.net/manual/en/function.implode.php&quot; rel=&quot;nofollow&quot;&gt;implode&lt;/a&gt; the array, using an &lt;code&gt;-&lt;/code&gt; as the &quot;glue&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$result = implode('-', $result);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which will then give you &lt;code&gt;Hello-there&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use &lt;a href=&quot;http://php.net/manual/en/function.strtolower.php&quot; rel=&quot;nofollow&quot;&gt;strtolower&lt;/a&gt; to make it lowercase&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$result = strtolower($result);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simplify this, you can just do it all at once&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$result = strtolower(implode('-',explode(&quot; &quot;, 'Hello there')));&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-01-29T10:33:22.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13454" PostTypeId="2" ParentId="13450" CreationDate="2016-01-29T10:38:19.327" Score="7" Body="&lt;p&gt;You can actually use the &lt;a href=&quot;https://craftcms.com/classreference/helpers/StringHelper#toKebabCase-detail&quot; rel=&quot;nofollow&quot;&gt;StringHelper::toKebabCase&lt;/a&gt;  function for this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$string = 'Hello there';&#xA;$result = StringHelper::toKebabCase($string);&#xA;// =&amp;gt; 'hello-there'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4588" LastEditorUserId="9" LastEditDate="2016-01-29T13:00:03.723" LastActivityDate="2016-01-29T13:00:03.723" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13455" PostTypeId="2" ParentId="12376" CreationDate="2016-01-29T11:29:55.707" Score="3" Body="&lt;p&gt;Not sure how you can do this, but you could manually print the response to a file yourself on a regular basis (as a cron job) using wget:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wget -S http://craft.fira/fullmembers.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…saves the JSON into a file named fullmembers.json into the directory it was run from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the solution that I have used in a cron job that runs every minute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wget -O - http://www.fira.co.uk/fullmembers.json &amp;gt; /home/forge/www.fira.co.uk/public/jsoncache/fullmembers-temp.json&#xA;rm /home/forge/www.fira.co.uk/public/jsoncache/fullmembers.json&#xA;mv /home/forge/www.fira.co.uk/public/jsoncache/fullmembers-temp.json /home/forge/www.fira.co.uk/public/jsoncache/fullmembers.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-06-09T11:22:00.720" LastActivityDate="2016-06-09T11:22:00.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13456" PostTypeId="1" AcceptedAnswerId="13457" CreationDate="2016-01-29T11:38:34.127" Score="1" ViewCount="920" Body="&lt;p&gt;Using Element API I would like to remove the limit to how many entries are in the JSON output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default is 100 entries, with pagination. I would like 1 response with all entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'endpoints' =&amp;gt; [&#xA;    'fullmembers.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'User',&#xA;        'criteria' =&amp;gt; ['group' =&amp;gt; 'fullMembership'],&#xA;        'transformer' =&amp;gt; function(UserModel $member) {&#xA;//....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance guys!&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-01-29T11:52:20.470" Title="Element API - remove response limit" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13457" PostTypeId="2" ParentId="13456" CreationDate="2016-01-29T11:46:29.380" Score="5" Body="&lt;p&gt;You have to set the criteria model's &lt;code&gt;limit&lt;/code&gt; parameter to null and &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI#paginate&quot; rel=&quot;noreferrer&quot;&gt;disable pagination&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'group' =&amp;gt; 'fullMembership',&#xA;    'limit' =&amp;gt; null,&#xA;],&#xA;'paginate' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-01-29T11:52:20.470" LastActivityDate="2016-01-29T11:52:20.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13458" PostTypeId="1" AcceptedAnswerId="13459" CreationDate="2016-01-29T12:04:15.120" Score="1" ViewCount="153" Body="&lt;p&gt;I am generating a url within Element API:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'profile' =&amp;gt; UrlHelper::getUrl(&quot;directory/company/{$member-&amp;gt;id}/{$urlslug}&quot;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http:\/\/craft.fira\/directory\/company\/1501\/abet-limited&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I need to do to turn this into a real url without the backwards slashes &quot;\&quot;? As far as I understand this is a regular expression (regex) version of the url?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be using javascript to put this on the page, so it could either be fixed at source in the Element api php code, or alternatively when scraping through the JSON with Javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance guys! :-)&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-01-29T12:45:15.193" LastActivityDate="2016-01-29T12:52:22.570" Title="Element API - UrlHelper generates backwards slashes (regex)" Tags="&lt;plugin-elementapi&gt;&lt;javascript&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13459" PostTypeId="2" ParentId="13458" CreationDate="2016-01-29T12:35:43.613" Score="2" Body="&lt;p&gt;The plugin probably uses PHP's &lt;a href=&quot;http://php.net/manual/en/function.json-encode.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;json_encode&lt;/code&gt;&lt;/a&gt; to serialize the data and it automatically escapes quotation marks and backslashes to conform to the &lt;a href=&quot;http://json.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSON format&lt;/a&gt;. Escaping the &lt;em&gt;forward slashes&lt;/em&gt; of your URL wouldn't actually be necessary, but I just found this on StackOverflow which might give an idea why the function escapes them anyways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escaped&quot;&gt;https://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escaped&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you shouldn't really care about this behavior at all, because however you gonna consume that JSON string, the parser (e.g., &lt;code&gt;jQuery.parseJSON()&lt;/code&gt;) should handle the unescaping for you.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-01-29T12:52:22.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13460" PostTypeId="1" AcceptedAnswerId="13470" CreationDate="2016-01-29T13:24:14.107" Score="0" ViewCount="191" Body="&lt;p&gt;I've set up a site to send emails via Mandrill over SMTP.&#xA;However, this does not seem to be sending emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I test the email config it says a message has been sent but the email is not received and there is no record of the email in the Mandrill Outbound messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sending over SSL (which has worked on other Craft sites on same host) on port 465.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions appreciated as client not receiving messages through the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-01-29T18:54:43.043" Title="Issue sending email via Mandrill" Tags="&lt;emails&gt;&lt;mandrill&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13461" PostTypeId="1" CreationDate="2016-01-29T14:55:50.987" Score="0" ViewCount="329" Body="&lt;p&gt;Experiencing a headache on a client site where the siteUrl declared in general.php is not being reflected in the Control Panel (which is always showing the local siteUrl) and therefore also the template on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An abridged/edited config file here: &lt;a href=&quot;https://gist.github.com/cole007/68382039e9ebedceabf7&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/cole007/68382039e9ebedceabf7&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts appreciated&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-02-28T15:43:36.250" Title="siteUrl not updating" Tags="&lt;config&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13462" PostTypeId="2" ParentId="13461" CreationDate="2016-01-29T15:21:14.450" Score="2" Body="&lt;p&gt;When setting &lt;code&gt;siteUrl&lt;/code&gt; in config.php, it &lt;em&gt;overrides&lt;/em&gt; the &quot;Site URL&quot; setting in CP → Settings → General. It doesn't show the settings in that field.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This is being overridden by the siteUrl config setting.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-29T15:21:14.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13463" PostTypeId="2" ParentId="13402" CreationDate="2016-01-29T15:31:26.560" Score="1" Body="&lt;p&gt;Thanks for the help, I've reached out to Brad @ Craft and the developers are Redactor, they've confirmed it's a known issue with Redactor and they're working on a fix.&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2016-01-29T15:31:26.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13464" PostTypeId="2" ParentId="13452" CreationDate="2016-01-29T15:43:31.403" Score="2" Body="&lt;p&gt;Yep, you can access transforms the same way you would in a template - via the asset’s &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel#getUrl-detail&quot; rel=&quot;nofollow&quot;&gt;getUrl()&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That &lt;code&gt;$transform&lt;/code&gt; argument can either be a string, set to the handle of one of your transforms in Settings → Assets → Transforms, or in can be an array that defines the transform settings at runtime. (Or it can be &lt;code&gt;null&lt;/code&gt; if you just want the source image URL.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that if the transform hasn’t been created yet, the default behavior of getUrl() will be to return a temporary URL that actually triggers the transform generation process, and responds with a redirect pointing to the new image once it has actually been created. But in this case you’d probably prefer for the transform to be created in the actual Element API request, so the actual URL can be returned right off the bat. You can do that by enabling the &lt;a href=&quot;https://craftcms.com/docs/config-settings#generateTransformsBeforePageLoad&quot; rel=&quot;nofollow&quot;&gt;generateTransformsBeforePageLoad&lt;/a&gt; config setting at runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your transformer function would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    // Generate new image transforms right away&#xA;    craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;&#xA;    $blockData = [];&#xA;&#xA;    foreach ($entry-&amp;gt;myMatrixField as $block) {&#xA;        $image = $block-&amp;gt;myAssetsField-&amp;gt;first();&#xA;&#xA;        if ($image) {&#xA;            $imageUrl = $image-&amp;gt;getUrl('myTransform');&#xA;        } else {&#xA;            $imageUrl = null;&#xA;        }&#xA;&#xA;        $blockData[] = [&#xA;            'image' =&amp;gt; $imageUrl,&#xA;            // ...&#xA;        ];&#xA;    }&#xA;&#xA;    return [&#xA;        'blocks' =&amp;gt; $blockData,&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-01-29T15:43:31.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13465" PostTypeId="1" AcceptedAnswerId="13466" CreationDate="2016-01-29T15:50:33.287" Score="2" ViewCount="289" Body="&lt;p&gt;For a section without additional entry types, what would be the handle value of the default entry type output by &lt;code&gt;{{ entry.type }}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4674" LastEditorUserId="9" LastEditDate="2016-01-29T19:19:22.640" LastActivityDate="2016-01-29T19:19:22.640" Title="What is the handle of a section’s default entry type?" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13466" PostTypeId="2" ParentId="13465" CreationDate="2016-01-29T16:27:50.603" Score="3" Body="&lt;p&gt;The default entry type created for a Section (all types) gets the same name and handle as the Section itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can change the default entry type's name and/or handle by visiting Settings -&gt; Sections, clicking on &quot;Edit Entry Types&quot; next to the appropriate Section, and finally by clicking the relevant entry type's name.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-01-29T16:27:50.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13467" PostTypeId="1" AcceptedAnswerId="13468" CreationDate="2016-01-29T16:46:03.623" Score="2" ViewCount="3796" Body="&lt;p&gt;This one seems deceptively simple, but I am struggling.  My home page is a single, and in that template I want to retrieve the children of a specific entry in a structure, then loop through them.  Here is a code example that does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.id(4).children %}&#xA;{% for entry in entries %}&#xA;    do something&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns the page with id 4 instead of its children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages').descendantsOf('targetpage') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe I need to retrieve the entire section and do a conditional loop for entries where the parent entry ID is 4, but the proper syntax for that eludes me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please point me in the right direction?  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4170" LastActivityDate="2016-01-29T17:13:39.047" Title="Get children of specific parent" Tags="&lt;entries&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13468" PostTypeId="2" ParentId="13467" CreationDate="2016-01-29T17:13:39.047" Score="3" Body="&lt;p&gt;You need to get the parent entry model before requesting its children with the &lt;code&gt;getChildren&lt;/code&gt; method. &lt;code&gt;craft.entries.id(4)&lt;/code&gt; only creates a &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;criteria model&lt;/a&gt; prepared to query for entries matching your criteria. You now have to use the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#first&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;first&lt;/code&gt;&lt;/a&gt; method to query for an entry model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.id(4).first() %}&#xA;&#xA;{# Check if it indead returned an entry model, could also return nothing #}&#xA;{% if parent %}&#xA;    {% set children = parent.children %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-29T17:13:39.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13469" PostTypeId="1" AcceptedAnswerId="13471" CreationDate="2016-01-29T17:16:01.080" Score="1" ViewCount="854" Body="&lt;p&gt;I am trying to use the one-click update feature and continually am getting a 500 error when attempting retrieve available updates on staging server. All my permissions work correctly as my craft install works all over except when updating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the URL that gives this error is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://staging.link.com/index.php?p=admin/actions/update/getAvailableUpdates&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stacktrace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;PHP Error [500]&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;chmod(): Operation not permitted (/var/www/staging/craft/app/helpers/IOHelper.php:1023)&amp;lt;/p&amp;gt;&#xA;&amp;lt;pre&amp;gt;#0 /var/www/staging/craft/app/etc/errors/ErrorHandler.php(184): Craft\ErrorHandler-&amp;gt;handleError()&#xA;#1 /var/www/staging/craft/app/framework/base/CErrorHandler.php(133): Craft\ErrorHandler-&amp;gt;handleError()&#xA;#2 /var/www/staging/craft/app/framework/base/CApplication.php(824): Craft\ErrorHandler-&amp;gt;handle()&#xA;#3 /var/www/staging/craft/app/etc/web/WebApp.php(681): Craft\WebApp-&amp;gt;handleError()&#xA;#4 unknown(0): Craft\WebApp-&amp;gt;handleError()&#xA;#5 /var/www/staging/craft/app/helpers/IOHelper.php(1023): chmod()&#xA;#6 /var/www/staging/craft/app/etc/cache/FileCache.php(138): changePermissions()&#xA;#7 /var/www/staging/craft/app/framework/caching/CCache.php(185): Craft\FileCache-&amp;gt;setValue()&#xA;#8 /var/www/staging/craft/app/etc/cache/FileCache.php(64): Craft\FileCache-&amp;gt;set()&#xA;#9 /var/www/staging/craft/app/services/CacheService.php(130): Craft\FileCache-&amp;gt;set()&#xA;#10 /var/www/staging/craft/app/etc/et/Et.php(247): Craft\CacheService-&amp;gt;set()&#xA;#11 /var/www/staging/craft/app/services/EtService.php(54): Craft\Et-&amp;gt;phoneHome()&#xA;#12 /var/www/staging/craft/app/services/UpdatesService.php(277): Craft\EtService-&amp;gt;checkForUpdates()&#xA;#13 /var/www/staging/craft/app/services/UpdatesService.php(170): Craft\UpdatesService-&amp;gt;check()&#xA;#14 /var/www/staging/craft/app/controllers/UpdateController.php(57): Craft\UpdatesService-&amp;gt;getUpdates()&#xA;#15 /var/www/staging/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController-&amp;gt;actionGetAvailableUpdates()&#xA;#16 /var/www/staging/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#17 /var/www/staging/craft/app/framework/web/CController.php(286): Craft\UpdateController-&amp;gt;runAction()&#xA;#18 /var/www/staging/craft/app/framework/web/CController.php(265): Craft\UpdateController-&amp;gt;runActionWithFilters()&#xA;#19 /var/www/staging/craft/app/framework/web/CWebApplication.php(282): Craft\UpdateController-&amp;gt;run()&#xA;#20 /var/www/staging/craft/app/etc/web/WebApp.php(811): Craft\WebApp-&amp;gt;runController()&#xA;#21 /var/www/staging/craft/app/etc/web/WebApp.php(281): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#22 /var/www/staging/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#23 /var/www/staging/craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#24 /var/www/staging/html/index.php(19): require_once()&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-01-31T07:23:11.737" Title="PHP 500 Error On One-click Update" Tags="&lt;php&gt;&lt;permissions&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13470" PostTypeId="2" ParentId="13460" CreationDate="2016-01-29T18:54:43.043" Score="1" Body="&lt;p&gt;I'm on the same boat ... Check out &lt;a href=&quot;http://status.mandrillapp.com&quot; rel=&quot;nofollow&quot;&gt;http://status.mandrillapp.com&lt;/a&gt; . Your issues are, more than likely, due to Mandrill currently being down and having issues (for the past couple days now).&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-01-29T18:54:43.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13471" PostTypeId="2" ParentId="13469" CreationDate="2016-01-29T19:21:48.057" Score="0" Body="&lt;p&gt;That PHP error is happening as Craft is trying to adjust permissions in some folder, either in craft/app or craft/storage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’ll need to ensure that both of those folders (and all subfolders) are writable by PHP.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="57" LastEditDate="2016-01-31T07:23:11.737" LastActivityDate="2016-01-31T07:23:11.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13472" PostTypeId="1" AcceptedAnswerId="13473" CreationDate="2016-01-29T22:34:31.643" Score="7" ViewCount="1290" Body="&lt;p&gt;I recently updated a very large site to Craft 2.5. One of the great new features is the ability to &lt;strong&gt;view custom fields as columns&lt;/strong&gt; on the entry index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Previously, I used the &lt;a href=&quot;https://github.com/mmikkel/DashCols-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;DashCols&lt;/a&gt; plugin to view those columns, but DashCols was rendered obsolete by the Craft 2.5 release. However, there was one other feature that DashCols has, which Craft 2.5 &lt;em&gt;doesn't&lt;/em&gt; have...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can you sort by custom fields on the entry index page?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nwSb0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nwSb0.png&quot; alt=&quot;Entry Index Page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-01-31T14:27:26.663" Title="In Craft 2.5, how can you sort the entry index page by a custom field?" Tags="&lt;entries&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13473" PostTypeId="2" ParentId="13472" CreationDate="2016-01-30T00:47:30.727" Score="12" Body="&lt;p&gt;Currently, the only way to add custom fields to the sortable attributes is to &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot;&gt;write a custom plugin&lt;/a&gt; which makes use of the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#modifyEntrySortableAttributes&quot;&gt;&lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt;&lt;/a&gt; hook, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySortableAttributes(&amp;amp;$attributes)&#xA;{&#xA;    $attributes['yourCustomFieldHandle'] = Craft::t('Label');&#xA;    $attributes['anotherCustomField'] = Craft::t('Another label');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt; method would go into your plugin's primary class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from custom fields, it's also possible to add other attributes in this manner, such as &lt;code&gt;authorId&lt;/code&gt; (to sort on author) or &lt;code&gt;typeId&lt;/code&gt; (to sort on entry type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also possible to &lt;em&gt;remove&lt;/em&gt; a sortable attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;unset($attributes['postDate']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are corresponding hooks for adding sortable attributes to category, asset and user index tables, see &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#element-hooks&quot;&gt;the official docs&lt;/a&gt; for details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One gotcha to note is that since the sortable attributes are &lt;em&gt;source agnostic&lt;/em&gt; (i.e. they're the same across all sections), any custom field you add to the sortable attributes should ideally exist for &lt;em&gt;all your entry types&lt;/em&gt;, as attempting to sort on a custom field that doesn't exist for the entries in the current index table will throw an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving into opinionated waters here, but to close: While the Customizable Element Indexes (CEI) is a great thing to have in core (and with a brilliant UI), I personally feel there's room for improvement; especially pertaining to sortable attributes. On that note, there are a few relevant feature requests:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7274973-add-a-source-parameter-to-modifyentrysortableattr&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7274973-add-a-source-parameter-to-modifyentrysortableattr&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10943841-sortable-custom-columns&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10943841-sortable-custom-columns&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/11533941-sort-filter-entries-by-entry-type&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/11533941-sort-filter-entries-by-entry-type&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10579029-add-custom-fields-in-customizable-element-indexes&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10579029-add-custom-fields-in-customizable-element-indexes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just published a new plugin which will add any (sortable) custom field or meta value in any given element index to the index' sortable attributes:   &lt;a href=&quot;https://github.com/mmikkel/CpSortableCustomColumns-Craft&quot;&gt;https://github.com/mmikkel/CpSortableCustomColumns-Craft&lt;/a&gt;&lt;br&gt;&#xA;The plugin is source aware, so it should avoid the issue with sorting on non-existing fields (as described above) in most cases. Like most Control Panel-specific plugins, it's basically one big hack – but it works until we can have better sorting abilities in core. Hopefully it's useful to someone!&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-01-31T14:27:26.663" LastActivityDate="2016-01-31T14:27:26.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13475" PostTypeId="1" CreationDate="2016-01-30T14:26:59.427" Score="4" ViewCount="705" Body="&lt;p&gt;I have a huge set of entries which have a lot of fields. Say, the entry type is a 'book' and fields are 'keywords', 'year', 'authors', etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm building a filter form which would allow user to output entries by field values. On frontend side this form contains generally inputs with datalist tags which should contain all of a specific field's values. For example, the datalist for the 'Year' search input should contain all years ever set for all the books on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this efficiently, how do we list all existing values for a field? &lt;a href=&quot;https://craftcms.stackexchange.com/a/5102/3838&quot;&gt;This answer&lt;/a&gt; proposes to loop through each entry every time and collect the field values used in entries in an array - but when I tried to do it I hit the memory exhausted problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example code of the approach which leads to memory being exhausted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set years = [] %}&#xA;{% for book in craft.entries.section('books').year.order('year desc').limit(0) %}&#xA;    {% if book.year not in years %}&#xA;        {% set years = years|merge([book.year]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for year in years %}&#xA;    &amp;lt;li&amp;gt;{{ year }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3838" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-01-31T12:08:34.233" Title="How to list all existing values for a field across site" Tags="&lt;entry&gt;&lt;field&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13476" PostTypeId="1" CreationDate="2016-01-31T06:52:34.637" Score="2" ViewCount="954" Body="&lt;p&gt;I'm familiar with Heroku, but new to Craft CMS. &#xA;In order to get a site running, I followed this tutorial: &lt;a href=&quot;https://medium.com/@aj1215/craft-cms-on-heroku-79b991665b0b#.8b561b1b4&quot; rel=&quot;nofollow&quot;&gt;https://medium.com/@aj1215/craft-cms-on-heroku-79b991665b0b#.8b561b1b4&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the site isn't functioning. My Heroku app just results in: &lt;code&gt;Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My development server runs fine. But I have no idea what I need to do to get the heroku app to function. I'm pulling my hair out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried everything I can think of, but can't get it to work. I'm not sure what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are messages toward the end of my Heroku logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016–01–31T03:09:21.480751+00:00 app[web.1]: nginx: [emerg] “server” directive is not allowed here in /app/nginx_app.conf:1&#xA;2016–01–31T03:09:21.475721+00:00 app[web.1]: Starting nginx…&#xA;2016–01–31T03:09:21.481090+00:00 app[web.1]: Process exited unexpectedly: nginx&#xA;2016–01–31T03:09:21.481236+00:00 app[web.1]: Going down, terminating child processes…&#xA;2016–01–31T03:09:22.183035+00:00 heroku[web.1]: Process exited with status 1&#xA;2016–01–31T03:09:22.182791+00:00 heroku[web.1]: State changed from starting to crashed&#xA;2016–01–31T03:09:27.185620+00:00 heroku[router]: at=error code=H10 desc=”App crashed” method=GET path=”/” host=paradata.herokuapp.com request_id=1e502143–94ac-4aea-b34b-3087addd1d20 fwd=”172.11.56.78&quot; dyno= connect= service= status=503 bytes=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;enginx_app.conf file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        location / {&#xA;            # try to serve file directly, fallback to rewrite&#xA;            try_files $uri @rewriteapp;&#xA;        }&#xA;        location @rewriteapp {&#xA;            # rewrite all to index.php&#xA;            rewrite ^(.*)$ /index.php?p=$1 last;&#xA;        }&#xA;        location ~ ^/(index)\.php(/|$) {&#xA;            client_max_body_size 20M;&#xA;            fastcgi_pass heroku-fcgi;&#xA;            fastcgi_split_path_info ^(.+\.php)(/.*)$;&#xA;            include fastcgi_params;&#xA;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            fastcgi_param HTTPS on;&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is my &lt;code&gt;craft/config/db.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$url = parse_url(getenv(&quot;CLEARDB_DATABASE_URL&quot;));&#xA;&#xA;return array(&#xA;&#xA;    'server' =&amp;gt; $url[&quot;host&quot;],&#xA;&#xA;    'user' =&amp;gt; $url[&quot;user&quot;],&#xA;&#xA;    'password' =&amp;gt; $url[&quot;pass&quot;],&#xA;&#xA;    'database' =&amp;gt; substr($url[&quot;path&quot;],1),&#xA;&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4679" LastEditorUserId="57" LastEditDate="2016-01-31T19:52:43.907" LastActivityDate="2016-02-01T05:05:16.103" Title="Can't get Craft running on Heroku" Tags="&lt;server&gt;&lt;apache&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13477" PostTypeId="2" ParentId="13475" CreationDate="2016-01-31T12:08:34.233" Score="2" Body="&lt;p&gt;To get better performance you need to switch to using PHP. All you need is a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;MyPluginVariable class&lt;/a&gt;&#xA;to do some logic in PHP and make the result available to your Twig templates. It's really not very complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your variable class you'd use &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;Yii Query Builder&lt;/a&gt; to create your SQL statements. There's now two ways to approach this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start from fresh using &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt;&lt;/a&gt; and add all the necessary parameters manually (section, locale, limit,...).&lt;/li&gt;&#xA;&lt;li&gt;Pass a Craft &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;criteria model&lt;/a&gt; with all parameters already set to the &lt;a href=&quot;http://buildwithcraft.com/classreference/services/ElementsService#buildElementsQuery-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;buildElementsQuery&lt;/code&gt;&lt;/a&gt; method to convert it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'll show you exampe code for the second approach. From your template prepare a criteria model as usual, set the section and other parameters. Then call the new template function we are going to create soon, which will take two parameters, a criteria model and a field handle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = craft.entries.section('books').order('myYearsField desc').limit(null) %}&#xA;{% set years = craft.businessLogic.getDistinctValues(criteria, 'myYearsField') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now we need to create this &lt;code&gt;getDistinctValues&lt;/code&gt; method in our variable class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getDistinctValues($criteria, $column)&#xA;{&#xA;    $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    // Modify query to select just our `$column` column, only distinct values&#xA;    $query-&amp;gt;selectDistinct(&quot;field_{$column}&quot;);&#xA;&#xA;    // Query for one column only and return the result&#xA;    return $query-&amp;gt;queryColumn();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#selectDistinct-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;selectDistinct&lt;/code&gt;&lt;/a&gt; parameter overrides the &lt;code&gt;select&lt;/code&gt; set by Craft in the initial criteria model. Performance should be way better, you're querying for a single column only, only for distinct values and you don't populate entry models which you do not need anyways.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-01-31T12:08:34.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13478" PostTypeId="1" AcceptedAnswerId="13479" CreationDate="2016-01-31T15:05:01.690" Score="0" ViewCount="1330" Body="&lt;p&gt;Within my application, I would like to only show a link to the the user's cart only if there are products in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was going to use javascript to check the cookie I can see getting set. &lt;code&gt;commerce_cookie&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is how to read that cookie. I realize its encrypted &amp;amp; I'm not accessing the cookie correctly. That's why I'm unable to get and check for any orders. Is there a better way to check the cart dynamically in this way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to read it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var cart = getCookie('commerce_cookie');&#xA;&#xA;console.log(cart);  // false&#xA;&#xA;// check if there are any products in the cart&#xA;if (cart) {&#xA;   // show the cart icon&#xA;} else {&#xA;    // hide the cart icon&#xA;}&#xA;&#xA;function getCookie(cookie) {&#xA;    if ($.cookie(name)) {&#xA;        returnJSON.parse($.cookie(name));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have read through &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow&quot;&gt;this thread&lt;/a&gt; about LJ Cookies, but I'm still not confident I'm looking for the cookie correctly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.lj_cookies.get( 'commerce_cookie' ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I was tying to do was hide the cart icon and only show it (along with item quantity) &lt;em&gt;only&lt;/em&gt; if there were items in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, you'll need a plugin to listen for the &lt;code&gt;onBeforeAddToCart&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Listen for items getting added to the cart.&#xA;craft()-&amp;gt;on('commerce_cart.onBeforeAddToCart', function (Event $event) {&#xA;    $cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;    // set expire &amp;amp; other params as needed&#xA;    $cookie = new HttpCookie('totalQty', $cart-&amp;gt;totalQty);&#xA;    craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add($cookie-&amp;gt;name, $cookie);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I've got an ajax request that will check if that cookie exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;    'CSRF': $('input[name=&quot;CSRF&quot;]').val()&#xA;};&#xA;&#xA;$.ajax({&#xA;    'type': 'post',&#xA;    'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    'cache': false,&#xA;    'data': data,&#xA;    'url': '/actions/myplugin/checkCookie',&#xA;    'dataType': 'json',&#xA;    'timeout': 50000&#xA;}).done(function (response) {&#xA;    // handle response&#xA;}).fail(function (error) {&#xA;   // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That routes to a controller method within my plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;    return $this-&amp;gt;returnJson(craft()-&amp;gt;request-&amp;gt;getCookie('totalQty'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how I am then handling/updating the UI with the results of that ajax request. I am summarizing my code here, there is more logic than I am listing - just trying to keep the size of this thread below the level of &quot;book&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using velocity for my transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jquery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; ...&#xA; var qty = (result.value + 1);  // value is zero-based array so +1&#xA;&#xA;  $('#icon').velocity('fadeIn', {&#xA;      'duration': 300,&#xA;      'display': 'inline-block',&#xA;      'complete': function () {&#xA;          $('&amp;lt;div/&amp;gt;', {&#xA;              'id': 'cartQty',&#xA;              'text': qty&#xA;          }).appendTo($('#icon'))&#xA;              .velocity('transition.bounceIn', {&#xA;                  'duration': 300,&#xA;                  'easing': 'easeInOutSine'&#xA;              });&#xA;          }&#xA;      });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wasn't able to find an event that listened for the Empty Cart event, so I had to get creative here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I listen for the &quot;Empty Cart&quot; form submit via jQuery. From there I make another ajax request to my plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;jQuery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#emptyCartForm').submit(function (event) {&#xA;     deleteCookie(); // calls an ajax method (below)&#xA;});&#xA;&#xA;&#xA;$.ajax({&#xA;    'type': 'post',&#xA;    'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    'cache': false,&#xA;    'data': data,&#xA;    'url': '/actions/myplugin/deleteCookie',&#xA;    'dataType': 'json',&#xA;    'timeout': 50000&#xA;}).done(function (response) {&#xA;    // handle response&#xA;}).fail(function (error) {&#xA;   // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That request makes a call to a controller method within my plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;     craft()-&amp;gt;request-&amp;gt;deleteCookie('totalQty');&#xA;     return $this-&amp;gt;returnJson(['status' =&amp;gt; 'success']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm happy to edit or please feel free to edit if there is any way I can improve this technique.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-02-04T20:47:05.830" LastActivityDate="2016-02-04T20:47:05.830" Title="How can I get/check the contents of a cart via javascript (cookie)?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13479" PostTypeId="2" ParentId="13478" CreationDate="2016-01-31T18:27:37.023" Score="2" Body="&lt;p&gt;The cookie that Craft Commerce uses for cart/session management is set using Craft's &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie&lt;/code&gt;, which hard-codes cookie's &lt;code&gt;httpOnly&lt;/code&gt; flag, meaning it can't be accessed by JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to pull of what you're trying to do, you'll need to use something like the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies/&quot; rel=&quot;nofollow&quot;&gt;LJ Cookies&lt;/a&gt; or &lt;a href=&quot;https://straightupcraft.com/craft-plugins/cookies&quot; rel=&quot;nofollow&quot;&gt;Cookies&lt;/a&gt; plugin to add and ready your own cookie according to your business logic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-01-31T18:27:37.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13480" PostTypeId="2" ParentId="9713" CreationDate="2016-01-31T19:08:25.500" Score="3" Body="&lt;p&gt;You can also do it like this. This way is especially useful when creating a new entry with a required relationship field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function createWorldConfig(UserModel $user, EntryModel $world)&#xA;    {&#xA;        $section    = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('yourSectionName');&#xA;        $entryTypes = craft()-&amp;gt;sections-&amp;gt;getEntryTypesByHandle('yourEntryTypeName');&#xA;        $entryType  = reset($entryTypes);&#xA;&#xA;        $entry            = new EntryModel();&#xA;        $entry-&amp;gt;sectionId = $section-&amp;gt;id;&#xA;        $entry-&amp;gt;typeId    = $entryType-&amp;gt;id;&#xA;        $entry-&amp;gt;authorId  = $user-&amp;gt;id;&#xA;        $entry-&amp;gt;postDate  = date('Y-m-d');&#xA;&#xA;        // Build the relationship using and ID array.&#xA;        $entry-&amp;gt;content-&amp;gt;relatedEntryField = array($anotherEntry-&amp;gt;id);&#xA;&#xA;        $wasSaved = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        if (!$wasSaved) {&#xA;            return null;&#xA;        }&#xA;&#xA;        return $entry;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3834" LastActivityDate="2016-01-31T19:08:25.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13481" PostTypeId="2" ParentId="13476" CreationDate="2016-01-31T20:02:58.473" Score="2" Body="&lt;p&gt;I solved it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I needed to remove calls to 'server' and 'http' in my enginx_app.conf file. Now the file only makes calls to 'location'.&lt;/p&gt;&#xA;" OwnerUserId="4679" LastEditorUserId="4679" LastEditDate="2016-02-01T05:05:16.103" LastActivityDate="2016-02-01T05:05:16.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13482" PostTypeId="1" CreationDate="2016-01-31T21:35:36.240" Score="10" ViewCount="566" Body="&lt;p&gt;Plugins are able to extend Craft and embrace the existing UI nicely. While I'm comfortable extending it in many ways, I don't feel like I could clearly explain to somebody else how the grid system works on the back end and have recently seen a few CP UIs rendered on larger screens (2400px+) that suggest that I may not fully understand how it behaves between devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you extend the CP layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can build a grid using &lt;code&gt;grid&lt;/code&gt;, &lt;code&gt;item&lt;/code&gt;, and &lt;code&gt;pane&lt;/code&gt; classes and various attributes. Here is an example with likely too many attributes just to put several of them out there into the discussion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid first&quot; data-max-cols=&quot;3&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;item&quot; data-position=&quot;left&quot; data-min-colspan=&quot;2&quot; data-max-colspan=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;fields&quot; class=&quot;pane&quot;&amp;gt;&#xA;      ...&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;item&quot; data-position=&quot;right&quot; data-colspan=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;pane meta&quot;&amp;gt;&#xA;      ...&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are a few of the questions I wonder about while working with the grid:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How many columns does the grid support?&lt;/li&gt;&#xA;&lt;li&gt;Are there any considerations to keep in mind as our plugin's UI adjusts to mobile layouts or big screens with high resolutions?&lt;/li&gt;&#xA;&lt;li&gt;How do &lt;code&gt;data-position=&quot;left&quot;&lt;/code&gt; and &lt;code&gt;data-position=&quot;right&quot;&lt;/code&gt; work? When do we need to use them?&lt;/li&gt;&#xA;&lt;li&gt;How do the &lt;code&gt;data-colspan&lt;/code&gt; attributes work? Are there defaults in place for &lt;code&gt;data-colspan&lt;/code&gt;, &lt;code&gt;data-min-colspan&lt;/code&gt;, &lt;code&gt;data-max-colspan&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;li&gt;Are there any other features of the grid I'm overlooking or leaving out?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-02-01T06:53:40.220" LastActivityDate="2016-02-02T15:54:25.430" Title="How does the Craft Grid System work?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;user-interface&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13483" PostTypeId="2" ParentId="13434" CreationDate="2016-01-31T23:31:40.733" Score="1" Body="&lt;p&gt;To dynamically display a Form that you've related to an Entry using a Sprout Forms Form relations field you can pass the handle of the form to the &lt;code&gt;displayForm()&lt;/code&gt; tag in your template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set formHandle = entry.formFieldHandle.first().handle %}&#xA;&#xA;{{ craft.sproutForms.displayForm( formHandle ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is a doc page that describes this here: &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/relations-field-on-entry-page&quot; rel=&quot;nofollow&quot;&gt;Relations Field on Entry Page&lt;/a&gt; and depending on where you want to redirect the user after they submit the form, Sprout Forms also supports &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/redirects&quot; rel=&quot;nofollow&quot;&gt;relative redirects&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-01-31T23:31:40.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13484" PostTypeId="2" ParentId="13421" CreationDate="2016-02-01T01:13:41.427" Score="1" Body="&lt;p&gt;Some good answers here.  This is not necessarily Craft related but wanted to quickly point out what's going on since it can involve Craft's routing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When nginx—or any other web server for that matter—gets fed a request, it needs to figure out &lt;em&gt;what&lt;/em&gt; to do with it. Is it a static file, a fastcgi/wsgi or proxy request, etc? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the more specific you are with your config, the easier time nginx has to figure out what you want it to do. And requests like this (the &lt;code&gt;=&lt;/code&gt; sign in this case) nginx will process first. After these location specific requests, nginx moves onto less and less specific requests. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this factor into the request getting to Craft? It's important to note that when you request an entry from Craft, the entry doesn't actually &lt;em&gt;exist&lt;/em&gt; on the file system so, by default, nginx will throw up a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft and other CMS that use a single-file controller pattern (index.php) are basically rewriting &quot;would be&quot; 404 errors back to index.php (&lt;code&gt;rewrite&lt;/code&gt; or &lt;code&gt;RewriteRule&lt;/code&gt; in Apache) to process them instead. nginx calls these content handlers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to refer back to &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; on how nginx processes a request.  It's good reading, much better than the official documentation.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-01T01:13:41.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13485" PostTypeId="1" AcceptedAnswerId="13698" CreationDate="2016-02-01T01:17:58.687" Score="3" ViewCount="172" Body="&lt;p&gt;I am trying to update a custom field on an EntryModel.  I'm having half success, and I don't understand why. I've looked at other posts &lt;a href=&quot;https://craftcms.stackexchange.com/a/4487/115&quot;&gt;such as this one by Brandon&lt;/a&gt; which discuss how to assign these values and I'm still not having any luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EntryModel I'm trying to update is available in my field type in the &lt;code&gt;onAfterElementSave&lt;/code&gt; method via &lt;code&gt;$this-&amp;gt;element&lt;/code&gt;.  The handle for the field I want to be updating the value of is available via &lt;code&gt;$this-&amp;gt;model-&amp;gt;handle&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using &lt;code&gt;setContentFromPost()&lt;/code&gt;, &lt;code&gt;setContent()&lt;/code&gt;, &lt;code&gt;getContent()-&amp;gt;setAttributes()&lt;/code&gt; and they all seem to return the same results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldHandle = $this-&amp;gt;model-&amp;gt;handle;&#xA;&#xA;$this-&amp;gt;element-&amp;gt;setContentFromPost(array(&#xA;    $fieldHandle =&amp;gt; 'changedValue'&#xA;));&#xA;&#xA;// Accessing the value via getContent returns the update value 'changedValue'&#xA;$changedValue = $this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;fieldHandle;&#xA;&#xA;// Accessing the value directly returns the 'originalValue'&#xA;$originalValue = $this-&amp;gt;element-&amp;gt;fieldHandle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why am I able to successfully update the value for the &lt;code&gt;getContent()&lt;/code&gt; method but not when I access it directly on the model?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-02-14T19:41:05.717" Title="Why does field value get updated on $element-&gt;getContent()-&gt;fieldHandle but not when accessed directly $element-&gt;fieldHandle?" Tags="&lt;custom-fieldtype&gt;&lt;entrymodel&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13487" PostTypeId="1" AcceptedAnswerId="13488" CreationDate="2016-02-01T07:55:50.053" Score="6" ViewCount="1287" Body="&lt;p&gt;I need to pass the current page's URI into either the HTTP headers or as a URL query string so that after being taken to the login page and successfully logging in, the user will be sent back to where they came from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that by attaching a query to any login button around the site I can then tell the login page where to go. The Login button is part of many of my templates / partials show when conditionally displaying content depending on if user is logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using &lt;code&gt;&amp;lt;a href=&quot;members/login?p={% craft.request.path %}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I thought that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getQuery('p') and craft.request.getQuery('p')|length %}&#xA;    {% set p = craft.request('p') %}&#xA;{% else %}&#xA;    {% set p = '/' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would set me up to redirect if the url contains &lt;code&gt;http://craft.fira/members/login?p=/members/directory/json&lt;/code&gt;. However that results in a 404. Is there a safe way to pass a path into a url query? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, I then need to know how to deal with this after logging in successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All help greatly appreciated, thank you!&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2016-02-01T13:33:25.930" LastActivityDate="2016-02-01T13:33:25.930" Title="Store a redirect URI for use after login" Tags="&lt;redirect&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13488" PostTypeId="2" ParentId="13487" CreationDate="2016-02-01T08:25:55.607" Score="11" Body="&lt;p&gt;First – your Twig syntax is a little off. Here's how you could add the current URL/request path to a link, as a query parameter &lt;code&gt;p&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;members/login?p={{ craft.request.path }}&quot;&amp;gt;Log in&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that the syntax/tag for printing a value/variable is &lt;code&gt;{{ value }}&lt;/code&gt;, not &lt;code&gt;{% value %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, since the redirect in this case should happen when the login form is successfully submitted, it makes sense to add the redirect URL to the form as a &lt;code&gt;redirect&lt;/code&gt; input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.getQuery('p')|default('/') }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that &lt;code&gt;craft.request&lt;/code&gt; should be all lowercase; in Craft almost all variables or service names follow the &lt;code&gt;camelCase&lt;/code&gt; naming convention (the &lt;code&gt;craft.request&lt;/code&gt; variable refers to the &lt;a href=&quot;https://craftcms.com/classreference/variables/HttpRequestVariable&quot;&gt;&lt;code&gt;HttpRequestVariable&lt;/code&gt;&lt;/a&gt; class, which wraps the &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService&quot;&gt;&lt;code&gt;HttpRequestService&lt;/code&gt;&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the above example demonstrates use of the &lt;code&gt;default&lt;/code&gt; filter, which will print the declared value (in this case, &lt;code&gt;/&lt;/code&gt;) if the value preceding the &lt;code&gt;default&lt;/code&gt; statement is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;. In this case, using &lt;code&gt;default&lt;/code&gt; will save you an &lt;code&gt;if&lt;/code&gt; statements and several lines of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you want to do a (conditional) redirect outside of a form submission, you can make use of Twig's &lt;code&gt;redirect&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set redirectUrl = craft.request.getQuery('p') %}&#xA;{% if redirectUrl %}&#xA;    {% redirect redirectUrl %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-01T08:25:55.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13491" PostTypeId="1" AcceptedAnswerId="13493" CreationDate="2016-02-01T12:27:36.600" Score="4" ViewCount="2016" Body="&lt;p&gt;I need a nice way to determine whether I'm on a &lt;code&gt;200&lt;/code&gt; page. Basically anything other than a status page (404, 500, 403) in twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could do something like &lt;code&gt;craft.request.getStatus&lt;/code&gt; or &lt;code&gt;craft.request.status&lt;/code&gt; but this didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From looking in the &lt;code&gt;HttpRequestService.php&lt;/code&gt; file there doesn't seem to be anything to retrieve this info so I wondered if anyone has achieved something similar.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2020-01-13T10:17:17.480" Title="Can you get the HTTP status code in twig templates?" Tags="&lt;templating&gt;&lt;request&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13493" PostTypeId="2" ParentId="13491" CreationDate="2016-02-01T13:08:20.820" Score="3" Body="&lt;p&gt;No, the &lt;code&gt;craft.request&lt;/code&gt; (&lt;a href=&quot;https://craftcms.com/classreference/variables/HttpRequestVariable&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;HttpRequestVariable&lt;/code&gt;&lt;/a&gt;) class doesn't expose the HTTP status code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be super easy to add it to Twig as &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;a variable method in a custom plugin&lt;/a&gt;, though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyPluginVariable {&#xA;&#xA;    public function getHttpStatus()&#xA;    {&#xA;        return http_response_code(); &#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.getHttpStatus() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-01T13:08:20.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13494" PostTypeId="1" AcceptedAnswerId="13496" CreationDate="2016-02-01T14:10:02.270" Score="3" ViewCount="434" Body="&lt;p&gt;This is my search results query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set miniCards = craft.entries.search(query).order('score').limit(12) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a lightswitch field called &lt;code&gt;showInSearch&lt;/code&gt;. When it is set to &lt;code&gt;1&lt;/code&gt; the entry should not appear in search results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;&#xA;When I do this I always get zero results on my searches:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set miniCards = craft.entries.search(query ~' -showInSearch:1').order('score').limit(12) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas when I do the opposite I get all results with the search term &lt;em&gt;and&lt;/em&gt; the lightswitch field set to &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set miniCards = craft.entries.search(query ~' showInSearch:1').order('score').limit(12) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried &lt;code&gt;-showInSearch::1&lt;/code&gt;,&lt;code&gt;-showInSearch::&quot;1&quot;&lt;/code&gt;, &lt;code&gt;-showInSearch:&quot;1&quot;&lt;/code&gt; and &lt;code&gt;showInSearch:0&lt;/code&gt; to no avail. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem persists even after rebuilding search indexes.&lt;/p&gt;&#xA;" OwnerUserId="327" LastEditorUserId="327" LastEditDate="2016-02-01T14:23:43.787" LastActivityDate="2016-02-01T14:58:43.780" Title="Hide search results depending on field value" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13495" PostTypeId="2" ParentId="12513" CreationDate="2016-02-01T14:15:10.290" Score="5" Body="&lt;p&gt;As of Craft 3, there is a &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Element.php#L332-L336&quot; rel=&quot;nofollow noreferrer&quot;&gt;RegisterElementSearchableAttributesEvent&lt;/a&gt; event that a plugin can listen to to change modify what gets saved to the search index table when an element is saved.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-10-16T17:10:20.107" LastActivityDate="2018-10-16T17:10:20.107" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13496" PostTypeId="2" ParentId="13494" CreationDate="2016-02-01T14:58:43.780" Score="4" Body="&lt;p&gt;Instead of adding the filtering criteria to the search parameter, I would use a custom field parameter for the &lt;code&gt;showInSearch&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set miniCards = craft.entries.search(query).showInSearch('not 1').limit(12) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-01T14:58:43.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13497" PostTypeId="1" CreationDate="2016-02-01T16:09:24.900" Score="0" ViewCount="314" Body="&lt;p&gt;I keep getting the following error when trying to update my craft installation. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mod_fcgid: read data timeout in 31 seconds, referer: https://mysite.com/admin/manualupdate/craft&#xA;End of script output before headers: index.php, referer: https://mysite.com/admin/manualupdate/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried updating my &lt;code&gt;/etc/apache2/mods-available/fcgid.conf&lt;/code&gt; file with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FcgidConnectTimeout 600&#xA;FcgidIOTimeout 600&#xA;IdleTimeout 600&#xA;ProcessLifeTime 600&#xA;IPCConnectTimeout 600&#xA;BusyTimeout 600&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this has given no results. I still get the error. The database wasn't able to go rollback and the site is currently not available. Unfortunately this is happening in production...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2016-02-01T16:25:43.540" Title="Update fails: mod_fcgid: read data timeout" Tags="&lt;updates&gt;&lt;timeout&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13498" PostTypeId="2" ParentId="13497" CreationDate="2016-02-01T16:25:43.540" Score="1" Body="&lt;p&gt;If running Webmin, check the &lt;strong&gt;Website Options&lt;/strong&gt; under &lt;strong&gt;Server Configuration&lt;/strong&gt; and set &lt;code&gt;Maximum PHP script run time&lt;/code&gt; to unlimited or a largar value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what finally did the trick but updating &lt;code&gt;/etc/apache2/mods-available/fcgid.conf&lt;/code&gt; with the following values may have also played a role.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FcgidConnectTimeout 600&#xA;FcgidIOTimeout 600&#xA;IPCCommTimeout 600&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After these changes and restarting apache, the script was finally able to finish and update the installation successfully.&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2016-02-01T16:25:43.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13499" PostTypeId="1" AcceptedAnswerId="13501" CreationDate="2016-02-01T16:32:01.040" Score="1" ViewCount="524" Body="&lt;p&gt;Is it possible to create a hidden page within a Structure similar to how the Structure addon in EE does? It is still available at the url, but is excluded from the navigation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are several ways I could handle this, 3rd level nav, possible custom field (lightswitch), additional structure for hidden items, etc. These just don't sound like perfect solutions. Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-02-01T17:21:19.087" Title="Create a &quot;hidden&quot; page within Structure" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13500" PostTypeId="2" ParentId="13430" CreationDate="2016-02-01T16:45:21.973" Score="6" Body="&lt;p&gt;If Craft is good enough for the &lt;a href=&quot;https://craftcms.com/news/ap-vector-case-study&quot; rel=&quot;noreferrer&quot;&gt;AP&lt;/a&gt;, it'll be good enough for everyone. ;)&lt;/p&gt;&#xA;&lt;p&gt;I have little experience with EE, other than migrating away from it, but I have built enough in WordPress so here's my experience with that, as compared to Craft.&lt;/p&gt;&#xA;&lt;p&gt;Don't be afraid of the &amp;quot;coding&amp;quot; part. Twig is pretty easy to learn and you'll learn to love it. Throwing together a plugin is harder but with Craft's decent MVC structure, it'll be much more easier to maintain—more so than trying to get WordPress to bend to your will. Creating plugins that look and feel native are much much easier, since you're just extending Craft's already built-in stuff.&lt;/p&gt;&#xA;&lt;h1&gt;(1) Create relationships between docs&lt;/h1&gt;&#xA;&lt;p&gt;I'd go so far as to say this is Craft's most &lt;em&gt;killer&lt;/em&gt; feature. Try to do this in WordPress, for example, and you end up throwing plugins at the problem or convoluted sql queries to get it to do what you want. ACF is great but Craft's engine is fast, built-in, and it works within all elements.  After you've used Craft's relations, it's hard to use something else.&lt;/p&gt;&#xA;&lt;p&gt;Especially if you store actual documents, like PDFs or Word docs, assets are WordPress' achilles heel. By default, WP stores files in year/month directory structure—which makes sense for blogging but not for any kind of database.  Assets in Craft are first-class citizens, right down to the fact you can even add custom fields to them.&lt;/p&gt;&#xA;&lt;p&gt;So, let's say you want to store the document you've copied from a Word doc. Why not store the original document as well? You can do that easily and if you ever have to refer back to the &amp;quot;archived original&amp;quot; it's just a relationship away. You could store that relationship either on the asset itself (refer back to the document) or on the entry that refers to the asset. Either way, Craft knows about it and you can use the relationship.&lt;/p&gt;&#xA;&lt;h1&gt;(2) Ajax based filtering system&lt;/h1&gt;&#xA;&lt;p&gt;My experience with WP plugins is hit and miss. They either will work as advertised or they won't. But that's it. Stray from that beaten path and you might as well be writing it yourself. This &lt;a href=&quot;https://www.reddit.com/comments/2z143x&quot; rel=&quot;noreferrer&quot;&gt;reddit thread&lt;/a&gt; (contains NSFW language, obviously it's reddit) has some good reasons why rolling your own can more productive in cases like this. Craft is so easy to query and add parameters to; AJAX is really just another layer. You need a solid base and WP is not going to cut it here. Craft's UI is so intuitive, it's an easy choice, especially when you have end users to support.&lt;/p&gt;&#xA;&lt;h1&gt;(3) Document import/export&lt;/h1&gt;&#xA;&lt;p&gt;Hard to say what you want to do as far as import—there's a whole cottage industry built on trying to parse Word and PDFs to html etc.—but when it comes to exporting out the data, like you mentioned, since Craft stores in discrete fields, you can get at just the data you need. You'd want to use something like &lt;a href=&quot;http://www.advancedcustomfields.com&quot; rel=&quot;noreferrer&quot;&gt;ACF&lt;/a&gt; in WordPress but it's not as nice to query, especially when it comes to relationships. Having that built-in to Craft is a huge advantage.&lt;/p&gt;&#xA;&lt;h1&gt;(4) Document Version System&lt;/h1&gt;&#xA;&lt;p&gt;Craft has entry revisions built-in and it's one of the best implementations I've used. You can publish over current versions, have multiple drafts of the same document, name them, etc. To do this inside WordPress takes a fair amount of effort. The only thing WP has that Craft does not is a built-in diff viewer so you can see what changed. That's harder to do on a field-by-field basis. You'd also need to roll your own &amp;quot;publish status&amp;quot; in Craft though. WordPress has a slight leg up here but really, emphasis on &lt;em&gt;slight&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;h1&gt;What else?&lt;/h1&gt;&#xA;&lt;p&gt;Multiple languages built-in. Again, WP users love to throw plugins at this problem but it really needs to be built into a CMS' DNA. Craft Pro has this ready to go. Even if you don't buy the Pro version, Craft stores it in a future-friendly way, so when you are ready to go, you're not jumping through hoops. &lt;a href=&quot;http://www.thenerdary.net/post/48123188844/interview-with-brandon-kelly-creator-of-craft&quot; rel=&quot;noreferrer&quot;&gt;Brandon Kelly mentions this&lt;/a&gt; and he's absolutely right.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-02-01T16:51:51.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13501" PostTypeId="2" ParentId="13499" CreationDate="2016-02-01T17:21:19.087" Score="3" Body="&lt;p&gt;Well, a custom field actually &lt;em&gt;does sound like the perfect solution&lt;/em&gt;. It's easy and consistent to check on all outputs and areas (sitemap/menu's/other navigations).&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-01T17:21:19.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13502" PostTypeId="2" ParentId="12865" CreationDate="2016-02-01T23:14:11.733" Score="2" Body="&lt;p&gt;You probably already know and have done everything I'm about to say.  Our site is not that large, on shared hosting, and has been, not consistently, but frequently, VERY SLOW (60 seconds!) to load pages and especially to make any kind of edits on the control panel.  So I just did the following in our cPanel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Changed from PHP 5.5 to 7.0&#xA;Increased max_execution_time from 60 to 90&#xA;Increased mem_limit from 128M to 256M&#xA;Increased upload_max_filesize from 2M to 8M&#xA;Increased post_max_size from 8M to 16M.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know little about this, but it is &lt;em&gt;zippy&lt;/em&gt; now!  Pages are loading before Firefox can even make a full circle in either direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: OK, some not-too-scientific stats:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP 7.0, mem_limit 256M&#xA;HomePage initial GETs(on F5 refresh): 870ms 1.03s 1.11s 938ms&#xA;CP SaveAndContinueEditing inital POSTs: 10.47s 3.92s 3.18s 2.37s 3.57s 4.54s&#xA;&#xA;PHP 5.5, mem_limit 256M&#xA;HomePage initial GETs(on F5 refresh): 1.23s 1.08s 1.28s 1.42s&#xA;CP SaveAndContinueEditing initial POSTs: 8.52s 4.06s 4.1s 5.15s 5.08s 3.63s&#xA;&#xA;PHP 5.5, mem_limit 128M&#xA;HomePage initial GETs(on F5 refresh): 1.04s 1.44s 1.14s 1.25s&#xA;CP SaveAndContinueEditing initial POSTs: 4.15s 5.21s 4.33s 6.41s 4.31s 3.9s&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not able to duplicate the incredibly slow responses I had previously, in which I frequently could walk away from the computer and come back and it hadn't loaded yet. When I said zippy, I meant a second or two instead of 30 seconds.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2016-02-04T15:22:22.940" LastActivityDate="2016-02-04T15:22:22.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13503" PostTypeId="2" ParentId="13419" CreationDate="2016-02-02T00:47:07.937" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I often read the first user request is slowest to Craft Sites point mentioned in articles/posts, what exactly is that referring to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably missing some context surrounding where you originally read that, but if it was talking about caching, then maybe it was referring to the first user that triggers the request to generate the necessary cached content.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Is this loop that creates these URL's running every single time a page is requested? Is this bad practice?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft will process &lt;code&gt;registerSiteRoutes&lt;/code&gt; on every request, so if you have a lot of business logic going on in your plugins around that method, it might be worth caching the results for a time to speed things up.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Or do these files get loaded up regardless of being called, and therefore should be re-written into functions so that they don't load the data unless asked?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You assume correctly, but generally I'd recommend against haven't expensive operations in class constructors/init() methods.  My personal preference would be to explicitly load the data.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;Plugin count -- does having many small, niche plugins affect load speed versus less but larger plugins that cover more functionality? Is plugin count something that needs to be carefully considered, a common caution when working with a plugin-based CMS like Wordpress?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The more plugins, the more file system access Craft has to do to find and load them. That part is usually negligible performance wise, but there's nothing stopping a plugin from doing something crazy slow in its constructor/init() methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been alleviated in Craft 3 to a large extent, because Craft doesn't have to instantiate a plugin just to figure out information about it (version number, author, etc.).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Basically, I guess the question is, I would love to be able to read a detailed explanation of the scheme/process in how plugins and their respective plugin file, config, services, controllers, templates, variables etc are loaded, and if there is a guideline on what is and isn't good practice when designing the flow of plugins for optimization?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, Craft will lazy-load a plugin's &lt;code&gt;Controller&lt;/code&gt;, &lt;code&gt;Enum&lt;/code&gt;, &lt;code&gt;Helper&lt;/code&gt;, &lt;code&gt;Model&lt;/code&gt;, &lt;code&gt;Record&lt;/code&gt;, &lt;code&gt;Service&lt;/code&gt;, &lt;code&gt;Variable&lt;/code&gt;, and &lt;code&gt;Validator&lt;/code&gt; classes as they are requested, just like Craft's own files are lazy loaded.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-02T00:47:07.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13504" PostTypeId="1" AcceptedAnswerId="13505" CreationDate="2016-02-02T04:27:52.133" Score="2" ViewCount="511" Body="&lt;p&gt;I have an existing Craft Pro installation (v2.5.2757) that I'm using to drive an application.  The current install does not have a homepage or any entry associated with a URL. All requests are being handled by Dynamic Sites Routes (routes.php).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site has been running without issue for months with edits being made to entries and content being updated in the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I went to create a homepage for the site, I would receive the following error when the site loaded:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2a4aF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2a4aF.png&quot; alt=&quot;Template Error - Variable &amp;quot;entry&amp;quot; does not exist&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I confirmed that the 'This is for the homepage' was checked and that the correct 'Entry Template' was entered. I suspected that something in routes.php was causing the issue, but cleared that out and still received the error.  I tried clearing the caches as well but no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After multiple hours of troubleshooting I'm at a loss.&lt;/p&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2016-02-02T04:27:52.133" Title="Error: Variable 'entry' does not exist - When adding homepage or other entry with URL" Tags="&lt;entry&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13505" PostTypeId="2" ParentId="13504" CreationDate="2016-02-02T04:27:52.133" Score="2" Body="&lt;p&gt;After trying many different things I noticed that the background tasks que was backed up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dhu9m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dhu9m.png&quot; alt=&quot;Background Tasks - Resaving Entries&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The queue was not moving. After a little research I came across the &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;support ticket on craft on how to Resolve &quot;Stuck&quot; Background Tasks&lt;/a&gt;. After completing the couple steps of updating the stuck task status and restarting the queue, they all cleared out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this, my homepage was pulling in the entry properly and parsing the 'entry' variable without issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that if you create an entry while the background tasks queue is stuck you will run into this issue.&lt;/p&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2016-02-02T04:27:52.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13506" PostTypeId="1" CreationDate="2016-02-02T04:55:58.730" Score="5" ViewCount="497" Body="&lt;p&gt;I have a pretty simple form. I just realized that it doesn't work unless I'm logged in as admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to bypass that, or to simply turn off authentication altogether for Craft CMS? For this project, I think that would be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I'd prefer to not use a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the form: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for entry in craft.entries.section('ScoreRequest').limit(1).find() %}&#xA;            &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ entry.sectionId }}&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;request-form&quot;&amp;gt;&#xA;                &amp;lt;div&amp;gt;&#xA;                  &amp;lt;input class=&quot;form-field&quot; placeholder=&quot;Your Name&quot; id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div&amp;gt;&#xA;                  &amp;lt;textarea class=&quot;form-field-2&quot; placeholder=&quot;Your Email Address&quot; id=&quot;body&quot; name=&quot;fields[email]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;div&amp;gt;&#xA;                            &amp;lt;textarea class=&quot;form-field-2&quot; placeholder=&quot;Your Phone Number&quot; id=&quot;body&quot; name=&quot;fields[phone]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div&amp;gt;&#xA;                  &amp;lt;textarea class=&quot;form-field-2&quot; placeholder=&quot;Your Company&quot; id=&quot;body&quot; name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;            &amp;lt;input class=&quot;form-button&quot; type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4679" LastActivityDate="2016-02-02T05:25:53.717" Title="How to allow guest to make entry without login" Tags="&lt;authentication&gt;&lt;guest&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13507" PostTypeId="2" ParentId="13506" CreationDate="2016-02-02T05:06:39.647" Score="6" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot;&gt;Guest Entries&lt;/a&gt; plugin is made for this scenario!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-02T05:06:39.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13509" PostTypeId="2" ParentId="13372" CreationDate="2016-02-02T09:54:40.857" Score="0" Body="&lt;p&gt;So I was making this more complicated than necessary, there was no need to go near the .htaccess. In the end I used something similar to Mats' answer and used a dynamic include. Each site has templates in a sub-folder and the prefix for this is set in the general.php config settings based on the URL. It's then used in the following include statement in the relevant template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_' ~ craft.config.sitePrefix ~ '/path/to/template' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With regard to my poor explanation, by 'path segments'I actually meant the 'Entry URL Format' which must be unique for singles which was where I was confused. For the blog channels for each site I could set it to &lt;code&gt;blog/{slug}&lt;/code&gt; and let Craft sort it out displaying the correct template set in the settings. Any duplication in singles' URLs was overcome with a generic include template that switched based on the config setting.&lt;/p&gt;&#xA;" OwnerUserId="897" LastActivityDate="2016-02-02T09:54:40.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13510" PostTypeId="1" AcceptedAnswerId="13514" CreationDate="2016-02-02T10:05:14.600" Score="0" ViewCount="64" Body="&lt;p&gt;I have a problem with upgrading to Craft 2.5 on a shared hosting platform. I have run the upgrade both automatically and also tried manually. It runs but when I try to update the database I get a fatal error message telling me to contact my server providers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the problem is the size of the database as there are 20000+ users and related user data. So it's 43mb which I think the shared hosting is having issues with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I am limited to what PHP limits I can change with shared hosting I am looking for a workaround.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought is to empty the user tables from the database (which would reduce the size considerably), run the update and then add them back in. However I wanted to check if there were any database changes to the user tables in the upgarde. I'm looking at using version 2.5.2761&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked through the change log but can't see anything obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else come across this issue or are there any other better solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2016-02-02T18:02:54.277" LastActivityDate="2016-02-02T18:02:54.277" Title="Database issue on upgrade to 2.5 on shared hosting" Tags="&lt;database&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13511" PostTypeId="1" AcceptedAnswerId="13513" CreationDate="2016-02-02T10:17:07.830" Score="2" ViewCount="264" Body="&lt;p&gt;I'm trying to get my head around the following issue. I have a site which uses a base layout template &lt;code&gt;base.twig&lt;/code&gt;, on which 3 layout templates are build (using &lt;code&gt;extends&lt;/code&gt;). One of them is &lt;code&gt;main.twig&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the paginate information variable &lt;code&gt;pageInfo&lt;/code&gt; (&lt;a href=&quot;https://craftcms.com/docs/templating/paginate#the-pageInfo-variable&quot; rel=&quot;nofollow&quot;&gt;see docs&lt;/a&gt;) in a block that's defined in the base template, to show the total number of entries found in the &lt;code&gt;{% block pageTitle %}{% endblock %}&lt;/code&gt;. I tried a number of things, including defining a &lt;code&gt;pageTitle&lt;/code&gt; variable in the &lt;code&gt;base.twig&lt;/code&gt; template, to override in the content block, but all without any luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are stripped down versions of my files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layouts/base.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;        &amp;lt;title&amp;gt;{{ title }}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;        {% block header %}{% endblock %}&#xA;        &amp;lt;main&amp;gt;&#xA;            {% block pageTitle %}{% endblock %}&#xA;            {% block main %}{% endblock %}&#xA;        &amp;lt;/main&amp;gt;&#xA;        {% block footer %}{% endblock %}&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layouts/main.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/base&quot; %}&#xA;&#xA;{% block main %}&#xA;    &amp;lt;div class=&quot;main&quot;&amp;gt;&#xA;        {% block content %}{% endblock %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;posts/index.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/main&quot; %}&#xA;{% set title = 'My posts listing' %}&#xA;&#xA;{% set entries = craft.entries... %}&#xA;&#xA;{% block content %}&#xA;    {% paginate entries as pageInfo, pageEntries %}&#xA;        &amp;lt;section&amp;gt;&#xA;            {% for entry in pageEntries %}&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ entry.title }}&#xA;                &amp;lt;/article&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/section&amp;gt;&#xA;&#xA;        {% block pageTitle %}&#xA;            &amp;lt;h1&amp;gt;{{ pageInfo.total }} entries found&amp;lt;/h1&amp;gt;&#xA;        {% endblock %}&#xA;&#xA;    {% endpaginate %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know this has to do with variable scopes, but how can I use the paginate information outside my &lt;code&gt;content&lt;/code&gt; block? One solution I tried does indeed works, but do I really need to copy the &lt;code&gt;{% paginate %}&lt;/code&gt; statement inside my &lt;code&gt;pageTitle&lt;/code&gt; block to get this working? That seems to be very inefficient to me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;posts/index.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/main&quot; %}&#xA;{% set title = 'My posts listing' %}&#xA;&#xA;{% set entries = craft.entries... %}&#xA;&#xA;{% block content %}&#xA;    {% paginate entries as pageInfo, pageEntries %}&#xA;        &amp;lt;section&amp;gt;&#xA;            {% for entry in pageEntries %}&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/section&amp;gt;&#xA;    {% endpaginate %}&#xA;{% endblock %}&#xA;&#xA;{% block pageTitle %}&#xA;    {% paginate entries as pageInfo, pageEntries %}&#xA;        &amp;lt;h1&amp;gt;{{ pageInfo.total }} entries found&amp;lt;/h1&amp;gt;&#xA;    {% endpaginate %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope you can help me out or point me in the right direction. Any tips regarding a better structure for the blocks are also welcome. Twig seems so popular, so you'd think it can't be that hard for such simple tasks? Maybe I'm using the whole block concept totally wrong in the first place.&lt;/p&gt;&#xA;" OwnerUserId="3937" LastActivityDate="2016-02-02T10:40:26.710" Title="Use paginate info in another block" Tags="&lt;templating&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13513" PostTypeId="2" ParentId="13511" CreationDate="2016-02-02T10:40:26.710" Score="3" Body="&lt;p&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5.2750&lt;/a&gt;, you can leave off the &lt;code&gt;{% endpaginate %}&lt;/code&gt; tag, then move your &lt;code&gt;{% paginate %}&lt;/code&gt; tag up outside of the blocks in the &lt;code&gt;posts/index.twig&lt;/code&gt; template, and your &lt;code&gt;pageInfo&lt;/code&gt; variable should be available to the whole template, including the parent template that you're extending.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-02-02T10:40:26.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13514" PostTypeId="2" ParentId="13510" CreationDate="2016-02-02T10:56:17.227" Score="1" Body="&lt;p&gt;Have you checked craft/storage/runtime/logs to see if there's an error in there related to the update?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it is the database: you can disable the database backup during the update by changing &lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#backupDbOnUpdate&lt;/a&gt; to false in general.php &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Remember to make a database backup every time you run an update when you change that setting!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-02-02T10:56:17.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13516" PostTypeId="2" ParentId="13482" CreationDate="2016-02-02T15:54:25.430" Score="3" Body="&lt;p&gt;This is somewhat of a guess, but is based on what I could find. It might not answer everything but it might be a start :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can work out the grid work is worked out around the values you provide yourself, if you look at &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L10244&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;app/resources/js/craft.js&lt;/code&gt;&lt;/a&gt; on line 10244 this seems to be where the grid starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On line &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L10339&quot; rel=&quot;nofollow&quot;&gt;10339&lt;/a&gt; is the &lt;code&gt;refreshCols&lt;/code&gt; function which seems to be responsible of figuring out how wide items are are where they should be placed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like Craft will take the values you supply &lt;code&gt;data-max-cols=&quot;3&quot;&lt;/code&gt; &lt;code&gt;data-min-colspan=&quot;2&quot;&lt;/code&gt; etc and try to work out the best possible layout (This is where &lt;code&gt;data-position&lt;/code&gt; gets dealt with aswell) ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;line 10466&#xA;// Figure out all of the possible colspans for each item,&#xA;// as well as all the possible positions for each item at each of its colspans&#xA;...&#xA;&#xA;line 10532&#xA;// Now find the layout that looks the best.&#xA;// First find the layouts with the highest number of used columns&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc etc, so it looks like there aren't really any set defaults, you just gotta play around with the numbers and see what works best for the layout you are trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, on line &lt;code&gt;10775&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;defaults: {&#xA;    itemSelector: '.item',&#xA;    cols: null,&#xA;    maxCols: null,&#xA;    minColWidth: 320,&#xA;    mode: 'pct',&#xA;    fillMode: 'top',&#xA;    colClass: 'col',&#xA;    snapToGrid: null,&#xA;    onRefreshCols: $.noop&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I realise I could be looking in the wrong direction and apologies if this doesn't completely answer your question, but hopefully it will provide an insight.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-02-02T15:54:25.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13517" PostTypeId="1" AcceptedAnswerId="13522" CreationDate="2016-02-02T18:34:20.300" Score="2" ViewCount="829" Body="&lt;p&gt;If an model/element gets changed then I can know about it by listening to an event like onBeforeSaveEntry. This will provide me with the latest version of the model/event, but doesn't give me the changes. Something like this would be great.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onSaveElement', function (Event $event) {&#xA;    $element = $event-&amp;gt;params['element'];&#xA;&#xA;    // $changes = ['uri' =&amp;gt; ['old' =&amp;gt; 'index', 'new' =&amp;gt; 'index2']]&#xA;    $changes = $element-&amp;gt;getUnsavedChanges(); &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I generate a routes.js that the client uses to generate menu and other stuff. I would like to listen to uri/slug changes so I can clear my (varnish) cache to update internal links. I'd like to prevent clearing my whole site if just one tiny thing gets changed. Any idea's how I can get the model changes or work around this issue?&lt;/p&gt;&#xA;" OwnerUserId="4690" LastEditorUserId="4690" LastEditDate="2016-02-02T21:36:48.653" LastActivityDate="2016-02-02T22:44:49.427" Title="Get model changes on save event" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13518" PostTypeId="1" CreationDate="2016-02-02T18:49:52.937" Score="4" ViewCount="1915" Body="&lt;p&gt;Kind of feel silly having to ask this but I cannot for the life of me get a success message to display after the redirect when the Contact Form submits.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just am not sure how to call it in the template view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried various things like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set success = craft.config.get('successFlashMessage', 'contactform') %}&#xA;&#xA;{% if success %}&#xA;  &amp;lt;div class=&quot;resp&quot;&amp;gt;&amp;lt;h3&amp;gt;{{ success }}&amp;lt;/h3&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But just cannot seem to grab it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did look at the documentation on Github and was not able to find it.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-02-03T00:23:19.457" LastActivityDate="2016-08-11T10:06:34.427" Title="How to display success message using the Contact Form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13519" PostTypeId="1" AcceptedAnswerId="13523" CreationDate="2016-02-02T19:17:54.967" Score="2" ViewCount="1003" Body="&lt;p&gt;I love the session handling on the backend CP. The prompts that come up on session expiration after setting &lt;code&gt;'userSessionDuration' =&amp;gt; 'PT5M',&lt;/code&gt; in &lt;code&gt;config/general.php&lt;/code&gt; are exactly what I want to use on the frontend website, (shown below). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KXY0C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KXY0C.png&quot; alt=&quot;CP Password Prompt&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use this logic on the frontend to force session-ends after x minutes. Doing some digging I can see the logic lies in &lt;code&gt;UserController&lt;/code&gt; under &lt;code&gt;actionGetAuthTimeout()&lt;/code&gt;, and this is polled while I'm on the CP every minute. &#xA;My question is whether I would have to manually run the controller constantly in the background and make the modal pop up? is there a more elegant method I've missed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4390" LastActivityDate="2019-04-04T19:09:06.733" Title="Using the CP login session expiration for the frontend" Tags="&lt;users&gt;&lt;frontend&gt;&lt;session&gt;&lt;current-user&gt;&lt;timeout&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13520" PostTypeId="5" CreationDate="2016-02-02T22:04:52.170" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-02-02T22:04:52.170" LastActivityDate="2016-02-02T22:04:52.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13521" PostTypeId="4" CreationDate="2016-02-02T22:04:52.170" Score="0" Body="Craft's native, non-destructive image manipulations." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-02-02T22:04:52.170" LastActivityDate="2016-02-02T22:04:52.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13522" PostTypeId="2" ParentId="13517" CreationDate="2016-02-02T22:23:14.087" Score="3" Body="&lt;p&gt;You have to listen to the &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; event, then query the database for the existing entry (if one exists).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $e)&#xA;{&#xA;    if(!$e-&amp;gt;params['isNewEntry'])&#xA;    {&#xA;        $updatedEntry = $e-&amp;gt;params['entry'];&#xA;        $currentEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($updatedEntry-&amp;gt;id);&#xA;&#xA;        if($updatedEntry-&amp;gt;getUrl() != $currentEntry-&amp;gt;getUrl())&#xA;        {&#xA;            // Do your thing&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It might also be worth checking if the updated entry even has a URL, so you could skip that DB query if you don't need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to be careful with this event though - there's always the possibility the transaction could fail and the updated entry won't get saved to the DB. In that case, you might want to also listen to the &lt;code&gt;onSaveEntry&lt;/code&gt; event (if you're doing anything other than writing to the DB - this would get rolled back automatically if something fails) as a way of checking if everything went okay.&lt;/p&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="3811" LastEditDate="2016-02-02T22:44:49.427" LastActivityDate="2016-02-02T22:44:49.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13523" PostTypeId="2" ParentId="13519" CreationDate="2016-02-02T22:41:01.513" Score="3" Body="&lt;p&gt;What you want is this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Returns how many seconds are left in the current user session.&#xA;// (int) The seconds left in the session, or -1 if their session&#xA;// will expire when their HTTP session ends.&#xA;craft()-&amp;gt;userSession-&amp;gt;getAuthTimeout()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then combine this with a Javascript &lt;code&gt;setTimeout&lt;/code&gt; when the page loads so you can trigger whatever messages you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; You can use this in your template files:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set authTimeout = craft.session.getAuthTimeout() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="4390" LastEditDate="2016-02-03T11:40:03.503" LastActivityDate="2016-02-03T11:40:03.503" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13524" PostTypeId="1" CreationDate="2016-02-03T01:44:32.710" Score="2" ViewCount="40" Body="&lt;p&gt;&lt;a href=&quot;http://medium.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Medium&lt;/a&gt; has a feature (that's likely the groundwork for their paragraph commenting, among other things) that adds an id to every tag inside of an article. Like so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vir64.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vir64.jpg&quot; alt=&quot;medium having an id on every paragraph&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in replicating the behavior with Craft, in such a way that I can then write queries like &lt;code&gt;element = craft.entries.find(2).element.find(120)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4509" LastEditorUserId="4509" LastEditDate="2016-02-03T06:05:33.420" LastActivityDate="2016-02-03T14:11:25.053" Title="IDing every descendent of a matrixfield" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13526" PostTypeId="1" AcceptedAnswerId="13530" CreationDate="2016-02-03T03:47:21.337" Score="2" ViewCount="2757" Body="&lt;p&gt;This evaluates to false&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.imageWidth starts with block.imageWidth %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this evaluates to true&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if '{{ block.imageWidth }}' starts with '{{ block.imageWidth }}' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some sort of issue with Craft's Twig integration?&lt;/p&gt;&#xA;" OwnerUserId="4509" LastActivityDate="2016-02-03T05:34:35.343" Title="Twig 'starts with' not evaluating variables properly" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13527" PostTypeId="2" ParentId="13326" CreationDate="2016-02-03T04:56:54.540" Score="4" Body="&lt;p&gt;I had this exact same issue on a recent project and found adding the &quot;raw&quot; filter to my field code was necessary to make some embeds work. So instead of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.videoFieldName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.videoFieldName | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That prevents Twig from trying to escape any of the characters in your embed code, which will break Vimeo embeds. This is assuming you're just wanting to paste the plain text embed code into a plain text field or Matrix block.&lt;/p&gt;&#xA;" OwnerUserId="4693" LastEditorUserId="57" LastEditDate="2016-02-03T06:04:59.783" LastActivityDate="2016-02-03T06:04:59.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13528" PostTypeId="2" ParentId="1110" CreationDate="2016-02-03T05:06:58.627" Score="5" Body="&lt;p&gt;We recently launched Venti 2 – a powerful event calendar management plugin built exclusively for Craft CMS! Check it out at &lt;a href=&quot;https://venticalendar.io&quot; rel=&quot;nofollow&quot;&gt;https://venticalendar.io&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3461" LastEditorUserId="3461" LastEditDate="2016-09-24T00:11:49.713" LastActivityDate="2016-09-24T00:11:49.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13529" PostTypeId="1" AcceptedAnswerId="13554" CreationDate="2016-02-03T05:29:22.823" Score="1" ViewCount="54" Body="&lt;p&gt;My plugin's FieldType was initially setup with &lt;code&gt;defineContentAttribte&lt;/code&gt; set to false.  I and switching it to &lt;code&gt;AttributeType::Mixed&lt;/code&gt;. Does a migration need to be written to account for this change? If so how would this be written since it is the specific input name that is added to the content table?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-02-03T20:06:43.293" Title="Is a migration needed if defineContentAttribute is changed from false to an AttributeType" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13530" PostTypeId="2" ParentId="13526" CreationDate="2016-02-03T05:34:35.343" Score="3" Body="&lt;p&gt;I'm going to assume that your &lt;code&gt;imageWidth&lt;/code&gt; field is a dropdown menu... correct me if I'm wrong. When you output a dropdown fieldtype in your templates, &lt;strong&gt;it's an object, not a string&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Scenario 1: Comparing objects&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.imageWidth starts with block.imageWidth %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;starts with&lt;/code&gt; comparison operator is designed for strings, but here it's handling two objects. Makes sense that it would just give up and evaluate to &lt;strong&gt;false&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Scenario 2: Comparing strings&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if '{{ block.imageWidth }}' starts with '{{ block.imageWidth }}' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In Twig, you can't nest tags. Those strings are being read literally, and not parsed out into their respective values. So what you've got here is a comparison of two identical strings... Makes sense that this would evaluate to &lt;strong&gt;true&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Scenario 3: Comparing values&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.imageWidth.value starts with block.imageWidth.value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Working under the assumption that &lt;code&gt;imageWidth&lt;/code&gt; is a dropdown menu, then you are actually getting an object from &lt;code&gt;block.imageWidth&lt;/code&gt;. Twig isn't confident that you actually want a string here, so you'll need to append &lt;code&gt;.value&lt;/code&gt; to specifically get the value of your field.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I've seen this trip up a few people, but it makes perfect sense once you wrap your head around it. Many objects in Craft will try to automatically &amp;quot;stringify&amp;quot; themselves when output directly using curly braces. But when it's not a direct output tag, you'll generally need to tell Twig that you specifically want the string value, and not the object itself.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-02-03T05:34:35.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13531" PostTypeId="1" AcceptedAnswerId="13533" CreationDate="2016-02-03T06:37:45.743" Score="5" ViewCount="558" Body="&lt;p&gt;I'm running the ElementAPI but would like to take advantage of some functionality provided by another plugin, to return these results in the API. Is this possible? Should all functions available in the main templates be available to the ElementAPI?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be specific about what I'm trying to achieve--I'm trying to access the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow&quot;&gt;Imager&lt;/a&gt; plugin to handle optimised transformations of an uploaded image. Here's how the code looks in a regular Twig template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformedImage = craft.imager.transformImage(image, { width: 200 }) %}&#xA;&amp;lt;img src=&quot;{{ transformedImage.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my attempt to do this inside &lt;code&gt;elementapi.php&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sizerOptions = array( 'width' =&amp;gt; '202' )&#xA;transformedImage = craft()-&amp;gt;imager-&amp;gt;transformImage( $asset-&amp;gt;url, $sizerOptions );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My PHP is not brilliant so I may just be doing something silly here, but wondering if it's my fault, or if I'm attempting to do something impossible!&lt;/p&gt;&#xA;" OwnerUserId="4672" LastEditorUserId="125" LastEditDate="2016-02-03T09:29:19.873" LastActivityDate="2018-04-19T04:50:02.177" Title="How can I use another plugin in PHP?" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13532" PostTypeId="1" AcceptedAnswerId="13535" CreationDate="2016-02-03T07:51:30.173" Score="0" ViewCount="127" Body="&lt;p&gt;Example: I have content which could be separated into &lt;code&gt;Big News&lt;/code&gt; and &lt;code&gt;Small News&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Big News has much text (which would need a link to its own entry). The Small News has only one text block (so it wouldn't need a separate page for each news).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats the best way of handling this? Two separate channels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One channel with two entry types and a template with a conditional:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.type == 'SmallNews' %}{% exit 404 %}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you handle this? I guess it is not possible to add &lt;code&gt;These entries have their own URLs&lt;/code&gt; based on entry types, right?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="1098" LastEditDate="2016-02-03T07:58:28.253" LastActivityDate="2016-02-03T09:49:46.943" Title="Channel with URLs based on entry type" Tags="&lt;url&gt;&lt;entry-type&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13533" PostTypeId="2" ParentId="13531" CreationDate="2016-02-03T07:54:41.970" Score="6" Body="&lt;p&gt;Your approach is technically correct – the problem is that &lt;code&gt;craft()-&amp;gt;imager-&amp;gt;transformImage()&lt;/code&gt; requires two additional parameters; &lt;code&gt;$transformDefaults&lt;/code&gt; and &lt;code&gt;$configOverrides&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about these parameters and the &lt;code&gt;transformImage&lt;/code&gt; method in &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#template-variables&quot; rel=&quot;noreferrer&quot;&gt;the plugin's official docs&lt;/a&gt;, but it's not super important. The two parameters can actually be &lt;code&gt;null&lt;/code&gt;, which means the following should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sizerOptions = array('width' =&amp;gt; 202);&#xA;$transformedImage = craft()-&amp;gt;imager-&amp;gt;transformImage($asset, $sizerOptions, null, null);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that while Imager does work with URLs, if you do have an AssetFileModel (i.e. &lt;code&gt;$asset&lt;/code&gt;) it's actually better to feed that to &lt;code&gt;transformImage()&lt;/code&gt; because then Imager will handle automatic cache breaking etc. for you (e.g. if you &lt;em&gt;replace&lt;/em&gt; the image in Craft later on) – so my advice is to use &lt;code&gt;transformImage($asset)&lt;/code&gt;, not &lt;code&gt;transformImage($asset-&amp;gt;url)&lt;/code&gt;, whenever possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, in case you're wondering why the below works for templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformedImage = craft.imager.transformImage(image, transform) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...when you need the additional two parameters when you do the same thing in PHP, here's a quick explanation of what's going on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins in Craft are made up of several different components – among them, &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;noreferrer&quot;&gt;Services&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;Variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You can think of Services and Variables as two different APIs for a plugin – one is only made available to PHP (Services) and the other is only made available to Twig/templates (Variables).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft makes plugin Services available in PHP by instantiating them and adding them to the global &lt;code&gt;craft()&lt;/code&gt; object in the format &lt;code&gt;craft()-&amp;gt;serviceName&lt;/code&gt;. For many plugins, there'll only be a single service, usually named after the plugin itself (e.g. &lt;code&gt;ImagerService&lt;/code&gt;, which is mapped to &lt;code&gt;craft()-&amp;gt;imager&lt;/code&gt;). There can be several though, e.g. &lt;code&gt;Imager_AnotherService&lt;/code&gt;, which would be mapped to &lt;code&gt;craft()-&amp;gt;imager_another&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike Services, plugins can only have a single Variables class, which is always named after the plugin (e.g. &lt;code&gt;PluginNameVariable&lt;/code&gt;) and mapped to &lt;code&gt;craft.pluginName&lt;/code&gt;. In Imager's case, this means that the &lt;code&gt;ImagerVariable&lt;/code&gt; is mapped to &lt;code&gt;craft.imager&lt;/code&gt; in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever you call &lt;code&gt;craft.imager.transformImage()&lt;/code&gt; in a template, you're actually interacting with a Variable class – in this case, &lt;code&gt;ImagerVariable&lt;/code&gt;. When you call &lt;code&gt;craft()-&amp;gt;imager-&amp;gt;transformImage()&lt;/code&gt; in PHP, you're interacting with the &lt;code&gt;ImagerService&lt;/code&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that the ImagerVariable and ImagerService both have a method called &lt;code&gt;transformImage&lt;/code&gt; is a common design pattern in Craft, where variable classes are used to &quot;wrap&quot; Services, in order to expose the latter for use in templates. Often (and this is true for Imager, as well), the Variable methods do little more than to call their namesake Service methods. Using the same names for Variable and Service methods isn't a requirement, though – just a &quot;best practice&quot; to ensure consistent plugin APIs for templates and PHP. Imager's author &lt;em&gt;could've&lt;/em&gt; opted to call the Variable method &lt;code&gt;transform&lt;/code&gt;, &lt;code&gt;doTransform&lt;/code&gt;, &lt;code&gt;transformy&lt;/code&gt; or basically anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally – as I mentioned, Imager's Variable method &lt;code&gt;transformImage&lt;/code&gt; basically just wraps the &lt;code&gt;ImagerService-&amp;gt;transformImage&lt;/code&gt; method – but with one important difference: The Variable method makes the two additional parameters (&lt;code&gt;$transformDefaults&lt;/code&gt; and &lt;code&gt;$configOverrides&lt;/code&gt;) &lt;em&gt;optional&lt;/em&gt;. This is why you don't have to declare them when you use Imager in a template, but you do have to define them when you use it in PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fun trick is that while Craft doesn't expose Template Variable classes to PHP out of the box, there's nothing preventing you from using them &quot;manually&quot;. For example, say you prefer the Imager's Template Variable API over its Service API; here's how you can use the Variable methods wherever you want in your PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::import('plugins.imager.variables.ImagerVariable');&#xA;$imager = new ImagerVariable();&#xA;&#xA;$transformedImage = $imager-&amp;gt;transformImage($asset, $sizerOptions);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-03T07:54:41.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13534" PostTypeId="2" ParentId="13531" CreationDate="2016-02-03T08:30:52.457" Score="2" Body="&lt;p&gt;You cannot say for sure how the PHP API of a Craft plugin has to be by just looking at the Twig code. You have to reverse engineer it. If the Twig function you're calling from the template starts with &lt;code&gt;craft.pluginHandle&lt;/code&gt;, like in this case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = craft.imager.transformImage() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you're dealing with a plugin's &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variable&lt;/a&gt;. If the function isn't namespaced like this or if you apply it to a Twig value with the pipe character, it is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html&quot; rel=&quot;nofollow&quot;&gt;Twig extension&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = myTwigFunction() %} or&#xA;{% set var = value|myTwigFilter %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ok, so I now looked up that &lt;code&gt;transformImage&lt;/code&gt; function in imager/variables/imagerVariable.php. I already expected this, because you're lucky and Andre is an excellent developer, but you can see it is basically passing all the parameters to a &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;plugin service&lt;/a&gt; &lt;code&gt;craft()-&amp;gt;imager-&amp;gt;transformImage()&lt;/code&gt;. Have a look at that specific service class imager/services/ImagerService.php. All its public methods are accessible from anywhere in your PHP code, it's the plugin's API. So what you have posted is actually very close to what you need, you just have some smaller syntax errors and if you take a closer look at the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/blob/master/imager/services/ImagerService.php#L195&quot; rel=&quot;nofollow&quot;&gt;method's declaration&lt;/a&gt;, you'll see that it expects 4 parameters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function transformImage($image, $transform, $transformDefaults, $configOverrides) { }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the template variable you only need to set the first two of them and sets a default for the latter. But as the service method doesn't do this for you (in this case), you have to set them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't tested this, and might be missing something, but this should be at least a good starting point to get it working from another plugin like the Element API:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sizerOptions = array('width' =&amp;gt; 202);&#xA;$transformedImage = craft()-&amp;gt;imager-&amp;gt;transformImage($asset-&amp;gt;url, $sizerOptions, null, null);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-03T08:30:52.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13535" PostTypeId="2" ParentId="13532" CreationDate="2016-02-03T09:49:46.943" Score="2" Body="&lt;p&gt;I would make this decision based on what makes the most sense for the client. You can realize both solutions on a technical level, so it's really just a question about the preferable CP user experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me this sounds like &quot;Big News&quot; and &quot;Small News&quot; are quite similar, so I'd probably like to have them combined in a single channel. And your template conditional is a good way to handle the manually (accidential?) typed in URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even add a dedicated source for the entry index views by making use of the &lt;code&gt;modifyEntrySources&lt;/code&gt; hook and some lines of custom plugin code. See this Stack Exchange Q&amp;amp;A for how to do this: &lt;a href=&quot;https://craftcms.stackexchange.com/q/11791/125&quot;&gt;Filter entries by entry type in the CP?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-03T09:49:46.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13537" PostTypeId="2" ParentId="11791" CreationDate="2016-02-03T11:11:36.737" Score="2" Body="&lt;p&gt;To enable sorting on Entry Types in the Section's index table, you can add this to a custom plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySortableAttributes(&amp;amp;$attributes)&#xA;{&#xA;    $attributes['typeId'] = Craft::t('Entry Type');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that AFAIK there's no way to sort on Entry Type &lt;em&gt;name&lt;/em&gt;, only the Entry Type &lt;em&gt;ID&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to write a custom plugin, I already wrote one called &lt;a href=&quot;https://github.com/mmikkel/CpSortableCustomColumns-Craft&quot; rel=&quot;nofollow&quot;&gt;CP Sortable Custom Columns&lt;/a&gt; which will add Entry Type to the index table's sortable attributes automatically, provided the Entry Type has been added to and is visible in the Section's index table (for instance, via the Customizable Element Index feature).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-03T11:11:36.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13538" PostTypeId="1" CreationDate="2016-02-03T11:17:53.247" Score="1" ViewCount="259" Body="&lt;p&gt;I'm trying to register a site route in my plugin based on the Entry URL format for a section chosen in the plugin settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if it's the default news section in the Craft install the URL format stored in the database would be: &lt;code&gt;news/{postDate.year}/{slug}&lt;/code&gt; or for an About single section it would be: &lt;code&gt;about&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add /login to the end of the url:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;code&gt;news/2016/amazing-title/login&lt;/code&gt; or &lt;code&gt;about/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use a login template (e.g. &lt;code&gt;news/_login&lt;/code&gt;) in the section for this registered route. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to manually do this with &lt;code&gt;registerSiteRoutes()&lt;/code&gt; and the setting stored in a plugin service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    $section = craft()-&amp;gt;pluginName-&amp;gt;getSettingsSection();&#xA;&#xA;    return array(&#xA;        $section . 'REGEX\/login' =&amp;gt; $section . '/_login'&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the best way to convert the Entry URL format for the section into something that can be used in the return array of &lt;code&gt;registerSiteRoutes()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4695" LastEditorUserId="57" LastEditDate="2016-02-03T19:14:56.643" LastActivityDate="2016-02-03T19:14:56.643" Title="How do I use the section Entry URL format for registerSiteRoutes() in a plugin?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;sections&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13539" PostTypeId="1" CreationDate="2016-02-03T11:39:50.987" Score="1" ViewCount="426" Body="&lt;p&gt;I am getting an error with oauth (1.0.79) when using Facebook:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Required option not passed: access_token Array (&#xA;  [{&quot;error&quot;:{&quot;message&quot;:&quot;Error_validating_verification_code__Please_make_sure_your_redirect_uri_is_identical_to_the_one_you_used_in_the_OAuth_dialog_request&quot;,&quot;type&quot;:&quot;OAuthException&quot;,&quot;code&quot;:100,&quot;fbtrace_id&quot;:&quot;A2ThFvRVsAZ&quot;}}]&#xA;  =&gt; )&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Facebook is changing the url entered and replacing the /'s in the p=actions/oauth/connect part of the redirect URI with ASCII characters %2F p=actions%2Foauth%2Fconnect which I assume is then not matching the 2 uri's causing the above error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the issue? Is there a workaround? Or is this a tweak that needs to be made to oauth?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-05-13T13:55:23.483" Title="Oauth Facebook Issue with redirect URI" Tags="&lt;plugin-duktoauth&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13540" PostTypeId="1" AcceptedAnswerId="13545" CreationDate="2016-02-03T12:05:00.003" Score="3" ViewCount="1189" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster&lt;/a&gt; plugin to handle my e-mails using a custom service for SendGrid. In my templates I use Twig's &lt;code&gt;url()&lt;/code&gt; function to create my URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they are sent by Postmaster, &lt;code&gt;craft-&amp;gt;template-&amp;gt;render()&lt;/code&gt; method creates a Control Panel url instead of a normal front-end URL. Which results in URL's not found when clicked in the e-mail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal behaviour when the &lt;code&gt;render()&lt;/code&gt; method is called from the control panel? Or can I override this in Twig templating maybe? The &lt;a href=&quot;https://craftcms.com/docs/templating/functions#url&quot; rel=&quot;nofollow&quot;&gt;Craft docs&lt;/a&gt; don't mention it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime I can create my URL's using {{ siteUrl }}, but I'm wondering if I'm missing something here.&lt;/p&gt;&#xA;" OwnerUserId="3937" LastActivityDate="2016-02-03T14:37:47.513" Title="Twig url() function returns CP path when called from plugin" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13541" PostTypeId="1" CreationDate="2016-02-03T12:34:25.050" Score="2" ViewCount="1328" Body="&lt;p&gt;Am using the Pikaday datepicker to add a Date field to the front-end of a Craft site: &lt;a href=&quot;https://github.com/dbushell/Pikaday&quot; rel=&quot;nofollow&quot;&gt;https://github.com/dbushell/Pikaday&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for integration with the Formerly add-on and the date is set to required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to submit the form I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2016/02/03 12:23:54 [warning] [application] Craft\ContentModel-&amp;gt;dateTest_testDate failed validation: Test Date cannot be blank.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are date inputs submitted via the front-end required in a particular format?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;also experiencing same problem with Sprout Forms&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="992" LastEditorUserId="115" LastEditDate="2016-02-06T22:37:48.007" LastActivityDate="2016-02-06T22:37:48.007" Title="Error when submitting Date Field from the front-end: cannot be blank" Tags="&lt;field&gt;&lt;datetime&gt;&lt;frontend&gt;&lt;plugin-sproutforms&gt;&lt;plugins-formerly&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13542" PostTypeId="1" CreationDate="2016-02-03T13:02:49.387" Score="3" ViewCount="322" Body="&lt;p&gt;I´m working in a multi country website ( resolved with locales ) with products, and each product will show information for each country and the &lt;strong&gt;product image could change from one country to another&lt;/strong&gt;, &lt;strong&gt;but the picture will usually be the same&lt;/strong&gt;. Because the image can change for each locale, i check it like a &lt;strong&gt;Translatable field&lt;/strong&gt;, but i realize that the client will have to fill the image field with the same image for each of the 4 languages, resulting in extra work to enter each product... so my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to assign the image in the default locale, and the others locales &lt;strong&gt;taking this image as default&lt;/strong&gt;, except that you specify an image for that language specifically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;Sebastian&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="22" LastEditDate="2017-05-09T22:43:15.583" LastActivityDate="2017-05-09T22:43:15.583" Title="Craft Locales and translatable image field" Tags="&lt;assets&gt;&lt;localization&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13543" PostTypeId="2" ParentId="13524" CreationDate="2016-02-03T14:11:25.053" Score="2" Body="&lt;p&gt;Each block within your Matrix field already has an ID, which you can access via &lt;code&gt;block.id&lt;/code&gt; within a for-loop on your Matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    ID: {{ block.id }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to be able to query directly for a specific Matrix block, you can use the &lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow&quot;&gt;Low Blocks&lt;/a&gt; plugin, which provides a &lt;code&gt;craft.lowBlocks.id()&lt;/code&gt; function for accessing a block by its ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block = craft.lowBlocks.id(123) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-02-03T14:11:25.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13544" PostTypeId="1" AcceptedAnswerId="13555" CreationDate="2016-02-03T14:15:35.057" Score="1" ViewCount="380" Body="&lt;p&gt;Is it possible to show specific content or an entry for an individual user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'm trying to achieve: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A logged in user make a request to receive information on a particular service. An administrator then reviews the request and creates an entry specific for that user - whatever is contained within that entry is then displayed on the users dashboard for them to view.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about achieving this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-02-03T20:12:17.440" Title="User specific content" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13545" PostTypeId="2" ParentId="13540" CreationDate="2016-02-03T14:37:47.513" Score="7" Body="&lt;p&gt;Right, &lt;code&gt;url()&lt;/code&gt; (and &lt;a href=&quot;https://craftcms.com/classreference/helpers/UrlHelper#getUrl-detail&quot;&gt;UrlHelper::getUrl()&lt;/a&gt;, which &lt;code&gt;url()&lt;/code&gt; maps to) will create a URL to either a front-end page or a CP page, depending on where it is being called from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get a front-end URL from a CP request, you can use &lt;code&gt;siteUrl()&lt;/code&gt; instead. (You can also get a CP URL from a front-end request via &lt;code&gt;cpUrl()&lt;/code&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-02-03T14:37:47.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13546" PostTypeId="2" ParentId="13542" CreationDate="2016-02-03T14:39:12.260" Score="2" Body="&lt;p&gt;One way would be to create two Asset fields. One is the default field and one is the field which is translatable into each locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then steer the two fields via conditional logic: If no image is present in the default field, switch to the localised field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could add a light switch field which disables the localized field for further safety &amp;amp; usability.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-02-03T14:39:12.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13547" PostTypeId="1" AcceptedAnswerId="13583" CreationDate="2016-02-03T14:45:25.010" Score="2" ViewCount="102" Body="&lt;p&gt;I have a 'person' channel that does away with the title field and instead uses custom fields like so &lt;code&gt;{lastName}, {firstName}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've noticed that when I'm looking at the entries listing in the control panel and I search for 'Hamilton' as an example (I have 3 entries where the surname is Hamilton) - only 1 of the entries returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even tried adding myself as an entry to the channel but searching for &lt;code&gt;Grant&lt;/code&gt; or even &lt;code&gt;Steven&lt;/code&gt; - I get no returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't figure out why this would be?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="57" LastEditDate="2016-02-03T19:40:40.470" LastActivityDate="2016-02-05T11:24:32.387" Title="Entries not being searched in the control panel" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13548" PostTypeId="1" AcceptedAnswerId="13553" CreationDate="2016-02-03T16:18:23.050" Score="3" ViewCount="378" Body="&lt;p&gt;It's a good 7 months after the last time this question was asked. I've been developing sites for a long time, expert with Wordpress, some Drupal, Joomla when forced. I can understand a good part of Craft but there really isn't the basic tutorial you'd generally see with other software that gives you an idea how to construct a site. The Happy Lager demo is more of a very quick showcase of how neat CraftCMS can be but it doesn't really go into just the very basics, like setting up fields properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen the sparse resources. The paid video, which includes how to install the software, is not an option. Is there still nothing that does a reasonable job of just running through the process and approach to setting up a basic site using the system? In addition, are there any resource repositories, e.g. plugins, etc. so you don't need to reinvent everything? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4664" LastEditorUserId="22" LastEditDate="2017-05-09T22:42:25.457" LastActivityDate="2017-05-09T22:42:25.457" Title="Resource for setting up Craft CMS Fields" Tags="&lt;fieldtypes&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13550" PostTypeId="1" CreationDate="2016-02-03T17:31:28.980" Score="2" ViewCount="77" Body="&lt;p&gt;In a plugin I am trying to get Users related to other Users:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;group = 'partners';&#xA;$criteria-&amp;gt;relatedTo = [&#xA;  'sourceElement' =&amp;gt; $someUserId&#xA;];&#xA;&#xA;$result = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see data in the relations table where &lt;code&gt;sourceId&lt;/code&gt; is set to the value of &lt;code&gt;$someUserId&lt;/code&gt; but I get nil results from &lt;code&gt;$criteria-&amp;gt;find()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried passing in a &lt;code&gt;UserModel&lt;/code&gt;, the user ID (as shown above) and changing &lt;code&gt;sourceElement&lt;/code&gt; to &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;element&lt;/code&gt; all with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I missed here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;======EDIT======&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems I can get what I need by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById(someUserId);&#xA;$relatedUsers = $user-&amp;gt;partners;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but I'd like to understand what's wrong with the original code above. &lt;code&gt;partners&lt;/code&gt; is the name of the relationship field on the source element as well as the name of the user group that that field targets.&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2016-02-04T11:22:49.820" LastActivityDate="2016-02-04T11:22:49.820" Title="Unable to get relatedTo working on an ElementCriteriaModel" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;baseelementmodel&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13553" PostTypeId="2" ParentId="13548" CreationDate="2016-02-03T19:39:52.653" Score="12" Body="&lt;p&gt;This is a brain dump of learning resources I can think of.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;There's the &lt;a href=&quot;https://craftcms.com/docs/introduction&quot; rel=&quot;noreferrer&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/&quot; rel=&quot;noreferrer&quot;&gt;Straight Up Craft&lt;/a&gt; has some great learning articles and tutorials.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They also happen to have the most &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;noreferrer&quot;&gt;comprehensive list&lt;/a&gt; of Craft plugins until the official plugin store becomes a thing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Craft site also has &lt;a href=&quot;https://craftcms.com/support&quot; rel=&quot;noreferrer&quot;&gt;help articles and tutorials&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The online &lt;a href=&quot;https://demo.craftcms.com/&quot; rel=&quot;noreferrer&quot;&gt;Craft demo site&lt;/a&gt; running Happy Lager.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;noreferrer&quot;&gt;Happy Lager repo&lt;/a&gt; if you'd prefer to setup locally.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This Craft Stack Exchange site for Q&amp;amp;A.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;noreferrer&quot;&gt;Craft Slack group&lt;/a&gt; with people on from around the world practically 24x7.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot; rel=&quot;noreferrer&quot;&gt;Craft feedback site&lt;/a&gt; to see if a feature you'd like to ask for has already been asked.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sites like &lt;a href=&quot;http://craftcookbook.net/&quot; rel=&quot;noreferrer&quot;&gt;Craft Cookbook&lt;/a&gt; for help with Twig and templating recipes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt; for more Twig help.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Mijingo has &lt;a href=&quot;https://mijingo.com/lessons/craft-2.5-quick-look/&quot; rel=&quot;noreferrer&quot;&gt;many&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/lessons/contact-form-in-craft-cms/&quot; rel=&quot;noreferrer&quot;&gt;Craft-specific&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/lessons/remote-asset-sources-in-craft/&quot; rel=&quot;noreferrer&quot;&gt;video&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/lessons/plugins-in-craft-3/&quot; rel=&quot;noreferrer&quot;&gt;tutorials&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/products/screencasts/craft-plugin-development/&quot; rel=&quot;noreferrer&quot;&gt;both&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/products/bundles/craft-starter-pack/&quot; rel=&quot;noreferrer&quot;&gt;free&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/products/screencasts/twig-templates-in-craft/&quot; rel=&quot;noreferrer&quot;&gt;and&lt;/a&gt; &lt;a href=&quot;https://mijingo.com/products/screencasts/craft-cms-tutorial/&quot; rel=&quot;noreferrer&quot;&gt;commercial&lt;/a&gt;. Also, there are &lt;a href=&quot;https://mijingo.com/craft&quot; rel=&quot;noreferrer&quot;&gt;articles and more&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are many user generated &lt;a href=&quot;https://www.youtube.com/results?search_query=%22craft%20cms%22&quot; rel=&quot;noreferrer&quot;&gt;Craft video tutorials&lt;/a&gt; up on YouTube.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://craftlinklist.com/&quot; rel=&quot;noreferrer&quot;&gt;craftlinklist.com&lt;/a&gt; is a periodic newsletter where you can sign up for a curated list of Craft resources from around the web.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-05-27T21:20:03.127" LastActivityDate="2016-05-27T21:20:03.127" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13554" PostTypeId="2" ParentId="13529" CreationDate="2016-02-03T20:06:43.293" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does a migration need to be written to account for this change?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how would this be written since it is the specific input name that is added to the content table?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Just thinking out loud:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Select all fields from the database that have your field type.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine if they are in a Matrix context (&lt;code&gt;craft_matrixHandleContent&lt;/code&gt;) a global context (&lt;code&gt;craft_content&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each grab their handles and build the column name.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alter table to add the column to the appropriate table.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-03T20:06:43.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13555" PostTypeId="2" ParentId="13544" CreationDate="2016-02-03T20:12:17.440" Score="1" Body="&lt;p&gt;Using the example in your comments, a simple solution would be to create a &quot;Potential Jobs&quot; Entry field and assign it to the Users field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whoever is doing the manually checking to find a match between tradesmen and clients would assign entries to that field that match the requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front-end user's dashboard would check that field to see if it has any entries in it and display them to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably get more elaborate with a Category field (that had Entry fields in it) if you want to group by more fine-grained details.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-03T20:12:17.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13556" PostTypeId="1" CreationDate="2016-02-04T01:56:42.223" Score="0" ViewCount="78" Body="&lt;p&gt;A client upgraded their site to 2.5, and I believe the update didn't finish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first there was a 500 error. I tried rolling the app back (code only) and it  gave an error that the database version didn't support rolling back. Replacing the &lt;code&gt;craft/app&lt;/code&gt; directory with a fresh version of 2.5 fixed the 500 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site and some of the admin area work, but in the control panel I cannot access Assets or Entries, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite.craft_elementindexsettings' doesn't exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems like something with the migration failed. Except must have not been fully failed, because of the error I got about the database version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The catch is that the client didn't do a database backup before initiating the update, so there isn't a good rollback point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I manually add this table? Any other potentially fixes for this? Is there a way to tell Craft to re-run the migration to 2.5?&lt;/p&gt;&#xA;" OwnerUserId="501" LastEditorUserId="57" LastEditDate="2016-02-04T06:13:51.697" LastActivityDate="2016-02-04T06:13:51.697" Title="After upgrading to 2.5: Table 'alpineductless-craft.craft_elementindexsettings' doesn't exist" Tags="&lt;auto-updates&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13557" PostTypeId="2" ParentId="13556" CreationDate="2016-02-04T03:31:02.417" Score="3" Body="&lt;p&gt;As Lindsey D pointed out in the comment, the answer was to restore the database backup from the automatic backup located in &lt;code&gt;/craft/storage/backups&lt;/code&gt; that is generated when the update was initiated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this backup is put into place it will re-run the database migration when you visit the Admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my full solution was 2 steps: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Replace /craft/app with a fresh copy&lt;/li&gt;&#xA;&lt;li&gt;Restore the automatically backed up database in &lt;code&gt;/craft/storage/backups&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="501" LastActivityDate="2016-02-04T03:31:02.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13558" PostTypeId="1" AcceptedAnswerId="13559" CreationDate="2016-02-04T03:49:25.350" Score="1" ViewCount="358" Body="&lt;p&gt;I am able to set a plain old cookie like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cookie = new HttpCookie('myCookie', 'myValue');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to delete it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cookie = new HttpCookie('myCookie', '');&#xA;craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add($cookie-&amp;gt;name, $cookie);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I make a call to check the cookie, I get this returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;name&quot;:&quot;myCookie&quot;,&quot;value&quot;:&quot;&quot;,&quot;domain&quot;:&quot;&quot;,&quot;expire&quot;:0,&quot;path&quot;:&quot;\/&quot;,&quot;secure&quot;:false,&quot;httpOnly&quot;:true}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see that the value is getting cleared, but is there any way to just totally wipe out the cooke?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2020-02-18T15:36:45.377" Title="How can I delete a cookie from a plugin?" Tags="&lt;plugin-development&gt;&lt;cookies&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13559" PostTypeId="2" ParentId="13558" CreationDate="2016-02-04T03:56:14.070" Score="1" Body="&lt;p&gt;Try &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/HttpRequestService.php#L893&quot; rel=&quot;nofollow&quot;&gt;deleteCookie()&lt;/a&gt; in HttpRequestService?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-02-04T03:56:14.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13560" PostTypeId="1" AcceptedAnswerId="13561" CreationDate="2016-02-04T08:50:58.690" Score="1" ViewCount="1386" Body="&lt;p&gt;I've got a controller action which will work as the callback URL for OAUTH authentication with an external, third-party API. After authenticating, the external API will issue a GET request to my callback URL, which means I need to allow anonymous access for the action method. However, I'd like to use CSRF protection for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set &lt;code&gt;enableCsrfProtection&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; in my config/general.php file, and the &lt;code&gt;tokenParam&lt;/code&gt; setting is &lt;code&gt;token&lt;/code&gt;. I've also added &lt;code&gt;protected $allowAnonymous = array('actionAuthCallback');&lt;/code&gt; to my Controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I create the callback URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$callbackUrl = UrlHelper::getUrlWithToken(UrlHelper::getSiteUrl('actions/myplugin/mycontroller/authCallback'), craft()-&amp;gt;request-&amp;gt;getCsrfToken());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting URL looks like this:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://mysite.com/actions/myplugin/mycontroller/authCallback?token=2423552353djfsjfdsfjsdfsdfrandomrandomawesome&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've validated that the correct action method fires, so all good so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the important bits for the action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionAuthCallback()&#xA;{&#xA;    $this-&amp;gt;requireToken();&#xA;    ...&#xA;    $this-&amp;gt;returnJson(array(&#xA;        'success' =&amp;gt; true,&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I call the action URL &lt;em&gt;without&lt;/em&gt; the &lt;code&gt;token&lt;/code&gt; query parameter, stuff works as expected – Craft throws a 400, as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I do include the &lt;code&gt;token&lt;/code&gt; parameter in the URL, Craft throws a &lt;strong&gt;404&lt;/strong&gt;. What's even more confusing, this happens even if I leave out the &lt;code&gt;$this-&amp;gt;requireToken();&lt;/code&gt; call in the &lt;code&gt;actionAuthCallBack()&lt;/code&gt; method – as soon as Craft sees the &lt;code&gt;token&lt;/code&gt; query parameter in the URL, the 404 exception is thrown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What am I doing wrong? Does CSRF protection require POST requests?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-04T09:30:03.480" LastActivityDate="2016-02-04T15:30:07.493" Title="Does CSRF protection for controller actions require POST?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;csrf&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13561" PostTypeId="2" ParentId="13560" CreationDate="2016-02-04T09:19:59.893" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/csrf-protection&lt;/a&gt; CSRF does require POST requests&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;With CSRF protection enabled, all of your site’s visitors will get a “CRAFT_CSRF_TOKEN” cookie set on their browser, and all POST requests must be accompanied by a POST parameter with a matching name and value (the CSRF Token).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On top of that, you'll need to (manually) enable it in your config:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You will need to enable it to take advantage of it. You can do that by setting the &lt;a href=&quot;https://craftcms.com/docs/config-settings#enableCsrfProtection&quot; rel=&quot;nofollow&quot;&gt;enableCsrfProtection&lt;/a&gt; config setting in your craft/config/general.php file.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-04T09:19:59.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13562" PostTypeId="1" AcceptedAnswerId="13573" CreationDate="2016-02-04T11:23:51.953" Score="2" ViewCount="422" Body="&lt;p&gt;I'm trying to pull entries from multiple sections for a list on a page, which works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if section is not defined %}&#xA;    {% set section = 'events,checklists,opinionPieces,whitepapers' %}&#xA;{% endif %}&#xA;&#xA;{% set params = {&#xA;    section: section&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is that the 'checklists' section is a structure with child entries allowed, and I only want the top level entries. I hoped I could get away with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if section is not defined %}&#xA;    {% set section = 'events,checklists,opinionPieces,whitepapers' %}&#xA;{% endif %}&#xA;&#xA;{% set params = {&#xA;    section: section,&#xA;    level: 1&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that then only returns checklists and whitepapers, presumably because they are structures and the other two are channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way of getting this to work, or would I have to pull all entries separately into an array?&lt;/p&gt;&#xA;" OwnerUserId="292" LastEditorUserId="57" LastEditDate="2016-02-04T19:07:48.910" LastActivityDate="2016-02-05T07:40:41.303" Title="Multiple sections, limiting the structure by depth" Tags="&lt;entries&gt;&lt;structure&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13563" PostTypeId="1" AcceptedAnswerId="13594" CreationDate="2016-02-04T13:02:21.000" Score="2" ViewCount="425" Body="&lt;p&gt;I have just one page on my site with only one language:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qzWXB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qzWXB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every other page has two languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to disable certain things on that page (like language switchers). How do I determine this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just returns all avalable languages no matter what languages are activated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherLocales = craft.i18n.getSiteLocaleIds() %}&#xA;  {% for locale in otherLocales %}&#xA;    {{ locale }}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to do it with status:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherLocales = craft.i18n.getSiteLocaleIds().status('live') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that returns an error as well. I tried &lt;code&gt;status&lt;/code&gt; because it's labeled that way in the cp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This returns the opposite language although the other locale doesn't exist on this page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}&#xA;{% for locale in otherLocales %}&#xA;  {{ locale }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2016-02-05T16:10:25.090" LastActivityDate="2016-02-05T16:25:15.030" Title="Check if other locale exists" Tags="&lt;localization&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13564" PostTypeId="1" CreationDate="2016-02-04T13:30:26.353" Score="1" ViewCount="90" Body="&lt;p&gt;I'm trying to output users groups for every entries in a for loop, but it returns an empty array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%for entry in craft.entries.section('news') %}&#xA;    ...&#xA;    {{ dump(entry.getAuthor().getGroups()) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's working correctly in the entry page itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can return the groups in a for loop?&lt;/p&gt;&#xA;" OwnerUserId="151" LastEditorUserId="151" LastEditDate="2016-02-04T15:11:23.837" LastActivityDate="2016-02-04T15:11:23.837" Title="entry.getAuthor().getGroups() always return empty array" Tags="&lt;user-groups&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13565" PostTypeId="1" CreationDate="2016-02-04T13:57:14.453" Score="1" ViewCount="52" Body="&lt;p&gt;Trying to use the Redactor &quot;structure&quot; setting: &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/special/#setting-structure&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/docs/settings/special/#setting-structure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft overrides the padding on .redactor-editor, which makes the display a bit broken when using this setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://goo.gl/photos/Qi9HbLmsvyGNGxsw9&quot; rel=&quot;nofollow&quot;&gt;https://goo.gl/photos/Qi9HbLmsvyGNGxsw9&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-02-04T14:46:25.733" Title="Padding on .redactor-editor hides &quot;structure&quot; setting display" Tags="&lt;structure&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-02-04T20:53:28.473" ContentLicense="CC BY-SA 3.0" />
  <row Id="13566" PostTypeId="2" ParentId="13564" CreationDate="2016-02-04T14:29:55.837" Score="1" Body="&lt;p&gt;I spot a couple of Twig errors in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, in your &lt;code&gt;for&lt;/code&gt; loop you're casting the entries returned by &lt;code&gt;craft.entries&lt;/code&gt; to a variable &lt;code&gt;news&lt;/code&gt;, but you're calling &lt;code&gt;entry.getAuthor()&lt;/code&gt; inside the loop. Either change &lt;code&gt;news&lt;/code&gt; to &lt;code&gt;entry&lt;/code&gt; or &lt;code&gt;entry&lt;/code&gt; to &lt;code&gt;news&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I'm not sure if &lt;code&gt;craft.entries('news')&lt;/code&gt; actually returns anything (or at least not what you actually want) – it should probably be &lt;code&gt;craft.entries.section('news')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting it together, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news') %}&#xA;    ...&#xA;    {{ dump(entry.getAuthor().getGroups()) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, since you're not reporting any error messages output by Craft, I'm guessing you haven't enabled &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt; in your development environment. It's a really good idea to have &lt;code&gt;devMode&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt; while you're working on your code, because then Craft will report any syntax errors (like your undeclared &lt;code&gt;entry&lt;/code&gt; variable) which will make it way easier for you to debug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just remember to never have &lt;code&gt;devMode&lt;/code&gt; enabled for production environments – it's both a performance and security issue if you do.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-04T14:29:55.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13567" PostTypeId="2" ParentId="13565" CreationDate="2016-02-04T14:46:25.733" Score="0" Body="&lt;p&gt;Redactor puts a &quot;redactor-structure&quot; class in the markup, so to override, I'm putting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;body .redactor-box:not(.redactor-box-fullscreen) .redactor-editor.redactor-structure {&#xA;   padding-left: 32px;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Might be nice to have that in the core.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-02-04T14:46:25.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13568" PostTypeId="1" AcceptedAnswerId="13571" CreationDate="2016-02-04T15:27:32.733" Score="2" ViewCount="453" Body="&lt;p&gt;I'm trying to setup a bilingual site and I'm having some issues with setting up the URI.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://localhost/mysite',&#xA;    'fr' =&amp;gt; 'http://localhost/mysite/fr',&#xA;),&#xA;'environmentVariables' =&amp;gt; array(&#xA;    'baseUrl'  =&amp;gt; 'http://localhost/mysite/',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my single settings:&#xA;URI for french: {baseUrl}fr/nouvelles&#xA;URI for english: {baseUrl}news&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to set this up to have it setup the way I want it.  Removing the baseURL part just doesn't print the mysite subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  Here's the real problematic after investigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URI should not include anything more than the name so:&#xA;In my single settings:&#xA;URI for french: nouvelles (&lt;a href=&quot;http://localhost/mysite/fr/nouvelles&quot; rel=&quot;nofollow&quot;&gt;http://localhost/mysite/fr/nouvelles&lt;/a&gt;)&#xA;URI for english: news (&lt;a href=&quot;http://localhost/mysite/news&quot; rel=&quot;nofollow&quot;&gt;http://localhost/mysite/news&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, those 2 pages work like expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if I assign those pages to a Entries field, to create my menu, when I pull the url, it never inclues the /fr portion.  Even the default template doesn't render the correct link, dropping the /fr part in the url too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(5).find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3524" LastEditorUserId="3524" LastEditDate="2016-02-04T16:33:49.647" LastActivityDate="2016-02-04T16:39:51.473" Title="Bilingual site page URL issues" Tags="&lt;localization&gt;&lt;url&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13569" PostTypeId="2" ParentId="13560" CreationDate="2016-02-04T15:30:07.493" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/users/4588/chris&quot;&gt;Chris&lt;/a&gt; is quite &lt;a href=&quot;https://craftcms.stackexchange.com/a/13561/1098&quot;&gt;correct&lt;/a&gt; – CSRF does not work with GET requests (see &lt;a href=&quot;https://craftcms.stackexchange.com/a/4554/1098&quot;&gt;this answer by Brad Bell&lt;/a&gt; for an explanation). I'm posting my workaround as an additional answer in case anyone else ever needs to have CSRF validation for GET requests working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get around the issue, I set up a custom config key in &lt;code&gt;/config/general.php&lt;/code&gt; called &lt;code&gt;tokenGetParam&lt;/code&gt;. This is because you can't use the native &lt;code&gt;tokenParam&lt;/code&gt; config setting for GET requests – Craft's CSRF validation will hijack the request and throw a 404 exception as soon as it sees the token in the URL, if it's a GET request. Obviously, the &lt;code&gt;tokenGetParam&lt;/code&gt; setting needs to have a different value than &lt;code&gt;tokenParam&lt;/code&gt;, as well – I went with &lt;code&gt;&quot;t&quot;&lt;/code&gt;. A custom config value isn't really necessary – you can just hard code along the way – but it's helpful to have if you ever need to change it in a pinch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Of course, not being able to use the native &lt;code&gt;tokenParam&lt;/code&gt; config value also means that you can't use the various built-in methods for dealing with CSRF tokens, e.g. &lt;code&gt;$this-&amp;gt;requireToken()&lt;/code&gt; for the Controller or &lt;code&gt;UrlHelper::getUrlWithToken()&lt;/code&gt;, etc.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, my needs were very simple. I simply needed to include a valid CSRF token in a GET variable &lt;code&gt;tokenGetParam&lt;/code&gt; (i.e. &lt;code&gt;&quot;t&quot;&lt;/code&gt;) in the callback URL to the external API, so that whenever the external API calls that URL after authenticating stuff on their end, I'd be able to accept or reject the request based on the contents of the &lt;code&gt;&quot;t&quot;&lt;/code&gt; query parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I generate the callback URL before calling the external webservice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$callbackUrl = UrlHelper::getSiteUrl('actions/myplugin/mycontroller/authCallback').'?'.craft()-&amp;gt;config-&amp;gt;get('tokenGetParam').'='.craft()-&amp;gt;request-&amp;gt;getCsrfToken();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the &lt;code&gt;actionAuthCallback&lt;/code&gt; is called, I validate the token like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$requestToken = craft()-&amp;gt;request-&amp;gt;getQuery(craft()-&amp;gt;config-&amp;gt;get('tokenGetParam'));&#xA;if ($requestToken !== craft()-&amp;gt;request-&amp;gt;getCsrfToken()) {&#xA;    // Token is not valid&#xA;    throw new HttpException(400);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-02-04T15:30:07.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13571" PostTypeId="2" ParentId="13568" CreationDate="2016-02-04T16:39:51.473" Score="3" Body="&lt;p&gt;Well... the answer was quite simple.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en_ca' =&amp;gt; 'http://localhost/mysite',&#xA;    'fr_ca' =&amp;gt; 'http://localhost/mysite/fr',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The _ca part was what was missing.  Now my site works amazingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the run around and I hope this can help someone.&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2016-02-04T16:39:51.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13573" PostTypeId="2" ParentId="13562" CreationDate="2016-02-04T19:07:11.637" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;or would I have to pull all entries separately into an array?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;100% untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = [] %}&#xA;&#xA;{% set ids = ids|merge(craft.entries.section('events,opinionPieces,whitepapers').ids()) %}&#xA;&#xA;{% set ids = ids|merge(craft.entries.section('checklists').level(1).ids()) %}&#xA;&#xA;{% set entries = craft.entries.id(ids).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2016-02-05T07:40:41.303" LastActivityDate="2016-02-05T07:40:41.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13574" PostTypeId="1" AcceptedAnswerId="13575" CreationDate="2016-02-04T20:51:58.803" Score="3" ViewCount="301" Body="&lt;p&gt;In the control panel, on the entries index page, Craft uses ​infinite scrolling. However, when you scroll to the bottom, there's a slight delay while you wait for more entries to load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I'm in a situation where I have to scroll through &lt;em&gt;thousands&lt;/em&gt; of entries. I'm cleaning up some imported data, and yesterday I managed to clean up entries from A - M. Today I need to pick up where I left off, and clean up entries from N - Z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there anything I can do to speed up the scrolling process?&lt;/strong&gt; (besides having a faster server)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-05T14:20:49.277" Title="Possible to speed up infinite scrolling?" Tags="&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13575" PostTypeId="2" ParentId="13574" CreationDate="2016-02-04T20:58:06.547" Score="8" Body="&lt;p&gt;You could open up the console and paste this then scroll to the bottom once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, this will keep scrolling to the &lt;code&gt;#footer&lt;/code&gt; every time a response from the &lt;code&gt;getMoreElements&lt;/code&gt; request comes in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ajaxComplete(function (event, xhr, options) {&#xA;  if (options.url.slice(-15) === &quot;getMoreElements&quot;) {&#xA;    setTimeout(function () {&#xA;      $('#footer')[0].scrollIntoView(true)&#xA;    }, 10)&#xA;  }&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2016-02-05T14:20:49.277" LastActivityDate="2016-02-05T14:20:49.277" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13576" PostTypeId="1" CreationDate="2016-02-04T22:18:48.507" Score="1" ViewCount="75" Body="&lt;p&gt;I am populating a drop-down with product variants like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;mySelect&quot; class=&quot;form-control&quot;&amp;gt;&#xA;&amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;{% for purchasable in product.variants %}&#xA;    &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %}&#xA;        value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;            {{ purchasable.myProduct.label }} &amp;amp;ndash; {{ purchasable.price|currency(cart.currency) }}&#xA;    &amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not going to be a required field, so its possible a user could submit without making a choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I currently get is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Not a purchasable ID&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which makes complete sense since I am not passing anything to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it best to have a product called &quot;Select&quot; and just have it be zero dollars? Or is there a way - maybe custom plugin - that will skip the input if it has no value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I force the user to make a choice of &quot;No thanks&quot; (or whatever is applicable) then that option has a price of zero dollars...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user does not make a choice, then Craft gets really angry because I have not passed in a valid purchasable ID (a &lt;code&gt;null&lt;/code&gt; value).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the screenshot, the profile is optional. The user doesn't &lt;em&gt;have&lt;/em&gt; to pick one. If they do, all is well since they have chosen a valid purchasable. The selected default value is &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K69jV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K69jV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I guess for now I take everything back. I've tried several times to break it but I can't today. I haven't changed anything that I can think of, but this seems to be working. If I don't choose anything, I am taken to the &lt;code&gt;/cart&lt;/code&gt; page as expected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;&quot;&amp;gt;Select Profile&amp;lt;/option&amp;gt;&#xA;    {% for profile in profiles %}&#xA;        &amp;lt;option value=&quot;{{ profile.defaultVariant.purchasableId }}&quot; data-price=&quot;{{ profile.defaultVariant.price|currency(cart.currency) }}&quot;&amp;gt;&#xA;            {{ profile.title }} &amp;amp;ndash; {% if profile.defaultVariant.price == 0 %} Included with registration {% else %} {{ profile.defaultVariant.price|currency(cart.currency) }}{% endif %}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-12-13T14:26:32.773" LastActivityDate="2016-12-13T14:26:32.773" Title="How can I pass a null value to commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="8" ClosedDate="2016-12-13T19:50:48.210" ContentLicense="CC BY-SA 3.0" />
  <row Id="13577" PostTypeId="2" ParentId="5462" CreationDate="2016-02-05T01:14:40.793" Score="0" Body="&lt;p&gt;I'd like to add that I got bitten by the same bug only I add to also retrieve the cache folder inside /craft/app/vendor/twig/twig/lib/Twig/Cache from my local install in order for things to start working.&#xA;Pretty weird this :)&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2016-02-05T01:14:40.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13579" PostTypeId="2" ParentId="13106" CreationDate="2016-02-05T02:26:50.257" Score="2" Body="&lt;p&gt;This will now work as of &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/updates#release-v2.2.0&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms v2.2.0&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Ordering #}&#xA;{% for formEntry in craft.sproutForms.entries.formHandle('contact').order('address desc') %}&#xA;  ...&#xA;{% endfor %}&#xA;&#xA;{# Filtering #}&#xA;{% for formEntry in craft.sproutForms.entries.formHandle('contact').firstName('Zoe') %}&#xA;  ...&#xA;{% endfor %#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-02-06T16:37:31.453" LastActivityDate="2016-02-06T16:37:31.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13580" PostTypeId="2" ParentId="13089" CreationDate="2016-02-05T02:29:11.200" Score="4" Body="&lt;p&gt;Filtering entries is now possible as of &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/updates#release-v2.2.0&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms v2.2.0&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('contact').firstName('Zoe') %}&#xA;  ...&#xA;{% endfor %#}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-02-05T02:29:11.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13581" PostTypeId="2" ParentId="12440" CreationDate="2016-02-05T02:37:49.870" Score="2" Body="&lt;p&gt;Sprout Forms now supports relative redirects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example redirect values:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/thank-you&lt;/li&gt;&#xA;&lt;li&gt;thank-you&lt;/li&gt;&#xA;&lt;li&gt;?message=success&lt;/li&gt;&#xA;&lt;li&gt;thank-you?message=success&lt;/li&gt;&#xA;&lt;li&gt;{siteUrl}&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://website.com/thank-you&quot; rel=&quot;nofollow&quot;&gt;http://website.com/thank-you&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We've also added this info &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/redirects&quot; rel=&quot;nofollow&quot;&gt;in the documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-02-05T02:37:49.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13582" PostTypeId="2" ParentId="11070" CreationDate="2016-02-05T10:49:51.737" Score="1" Body="&lt;p&gt;I'm having the same problem for assets and globals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When craft thinks there are no globals, the entire tab isn't showed.&#xA;For the globals i created a new temporary global, so i could access the existing (hidden) ones (they were still connected to one locale).&#xA;After that i could open and save them.&#xA;After saving they worked for other locales again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I later found out that setting the admin account to the locale that is working also allows access. Opening and saving each entry works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still did not find a solution when content is disconnected from all locales.&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2016-02-05T10:49:51.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13583" PostTypeId="2" ParentId="13547" CreationDate="2016-02-05T11:24:32.387" Score="2" Body="&lt;p&gt;Updating the search indexes was the solution here. In addition, I also enabled &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;Fuzzy Searching&lt;/a&gt; for partial matches&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-02-05T11:24:32.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13584" PostTypeId="1" AcceptedAnswerId="13587" CreationDate="2016-02-05T11:34:28.763" Score="2" ViewCount="350" Body="&lt;p&gt;I'm using dotphpenv for environment specific config. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works perfectly for my db config. I added another 2 environment vars for &lt;code&gt;devMode&lt;/code&gt; and &lt;code&gt;allowAutoUpdates&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DEV_MODE=false&#xA;AUTO_UPDATE=false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and updated &lt;code&gt;general.php&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;&#xA;  // Default&#xA;&#xA;  '*' =&amp;gt; array(&#xA;    ...&#xA;    'devMode' =&amp;gt; getenv('DEV_MODE'),&#xA;    'allowAutoUpdates' =&amp;gt; getenv('AUTO_UPDATE'),&#xA;    ...&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But with that set, dev mode and auto-update are still available to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set both to &lt;code&gt;false&lt;/code&gt; we have no problem. This is obviously a phpdotenv thing because Craft is doing what it's supposed to but if anyone can shed light I'd appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2019-01-10T20:21:27.440" Title="devMode, phpdotenv variable ignored" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;environments&gt;&lt;configuration&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13585" PostTypeId="1" AcceptedAnswerId="13605" CreationDate="2016-02-05T11:39:12.917" Score="0" ViewCount="141" Body="&lt;p&gt;I am going to build a boat catalog.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Boat products x 40&lt;/li&gt;&#xA;&lt;li&gt;Types of product x 3&lt;/li&gt;&#xA;&lt;li&gt;Suppliers of products&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I was wondering what the best storage setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For boat and suppliers these could be entries and categories, eg:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Boats = entries x 40&lt;/li&gt;&#xA;&lt;li&gt;Suppliers = Categories x 9&lt;/li&gt;&#xA;&lt;li&gt;Type = Categories x 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But does it make more sense to use suppliers as entries fields and relate them to products as 'parents'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there specific template benefits later on that can help steer the decision?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="22" LastEditDate="2017-05-09T22:37:36.953" LastActivityDate="2017-05-09T22:37:36.953" Title="Storage advise for product catalog" Tags="&lt;entries&gt;&lt;categories&gt;&lt;structure&gt;&lt;sections&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13586" PostTypeId="1" AcceptedAnswerId="13596" CreationDate="2016-02-05T12:50:18.863" Score="1" ViewCount="148" Body="&lt;p&gt;When using the &lt;code&gt;{% cache %}&lt;/code&gt; tag on an entry type, it caches the first entry on the page (multiple pages as well), and uses the cached entry for every other instance of that entry type on the page. What am I doing wrong? Here's an example. This one isn't complex so not sure it's worth caching, but I have some entries that have multiple relational fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentMatrix %}&#xA;  {% if block.type == &quot;copyOneCol&quot; %}&#xA;    {% cache %}&#xA;        .... output entry type data&#xA;    {% endcache %}&#xA;&#xA;  ...next if, etc.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-02-05T18:16:38.457" Title="{% cache %} tag creates duplicate entries" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13587" PostTypeId="2" ParentId="13584" CreationDate="2016-02-05T14:00:35.403" Score="5" Body="&lt;p&gt;It looks like &lt;code&gt;getenv&lt;/code&gt; returns a string (or &lt;code&gt;false&lt;/code&gt; if the variable is not set, but it is in this case). So you need to cast the string to a boolean value to make it work. However, &lt;code&gt;(bool)'false'&lt;/code&gt; gives &lt;code&gt;true&lt;/code&gt;, not &lt;code&gt;false&lt;/code&gt;. There are two possible solutions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the variable to &lt;code&gt;0&lt;/code&gt; instead of &lt;code&gt;false&lt;/code&gt; in your &lt;code&gt;.env&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DEV_MODE=0&#xA;AUTO_UPDATE=0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'devMode' =&amp;gt; (bool)getenv('DEV_MODE')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works because &lt;code&gt;(bool)'0'&lt;/code&gt; gives &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use &lt;a href=&quot;https://stackoverflow.com/questions/4775294/parsing-a-string-into-a-boolean-value-in-php/10645030#10645030&quot;&gt;this solution&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'devMode' =&amp;gt; filter_var(getenv('DEV_MODE'), FILTER_VALIDATE_BOOLEAN);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works because the &lt;code&gt;FILTER_VALIDATE_BOOLEAN&lt;/code&gt; filter returns &lt;code&gt;TRUE&lt;/code&gt; for &lt;code&gt;&quot;1&quot;&lt;/code&gt;, &lt;code&gt;&quot;true&quot;&lt;/code&gt;, &lt;code&gt;&quot;on&quot;&lt;/code&gt; and &lt;code&gt;&quot;yes&quot;&lt;/code&gt;, and returns &lt;code&gt;FALSE&lt;/code&gt; for any other value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="125" LastEditorUserId="6909" LastEditDate="2019-01-10T20:21:27.440" LastActivityDate="2019-01-10T20:21:27.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13588" PostTypeId="1" AcceptedAnswerId="13624" CreationDate="2016-02-05T15:12:58.253" Score="-1" ViewCount="112" Body="&lt;p&gt;Any thoughts or tips on debugging a custom fieldtype plugin not showing up in &lt;code&gt;Settings &amp;gt; Plugins&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code base up at &lt;a href=&quot;http://cl.ly/2E0m3Y2Z2R00&quot; rel=&quot;nofollow&quot;&gt;http://cl.ly/2E0m3Y2Z2R00&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-02-08T15:54:25.500" Title="Custom fieldtype plugin" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13589" PostTypeId="1" AcceptedAnswerId="13792" CreationDate="2016-02-05T15:20:46.153" Score="0" ViewCount="88" Body="&lt;p&gt;I have my slug saving to the &lt;code&gt;element_i18n&lt;/code&gt; table but it's not unique. When saving a non-unique slug using the default Craft entries, the slug gets appended with &quot;-1&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I extend the default functionality for a slug?&lt;/p&gt;&#xA;" OwnerUserId="3905" LastEditorUserId="57" LastEditDate="2016-02-05T18:23:48.050" LastActivityDate="2016-02-19T18:31:49.527" Title="How to utilize unique slugs for plugin elements that extend the BaseElement class" Tags="&lt;plugins&gt;&lt;slug&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13591" PostTypeId="1" CreationDate="2016-02-05T15:30:59.993" Score="1" ViewCount="727" Body="&lt;p&gt;Being driven to distraction trying to setup multiple environments with Craft. I have Craft running (and working) locally without issue. I have created a staging server with Digital Ocean and setup the appropriate database. I'm using DeployBot to push changes from Github.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However upon trying to access the remote server, I get the following errors:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Service Unavailable&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Our site is temporarily unavailable. Please try again later.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft can’t connect to the database with the credentials in&#xA;  craft/config/db.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm sure there is an obvious solution to why this isn't working, but I'm yet to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my db.php and general.php files with sensitive data redacted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'database' =&amp;gt; '******',&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;  ),&#xA;&#xA;  'localhost' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root',&#xA;  ),&#xA;&#xA;  // Use IP of your droplet and MySQL credentials of a user you created&#xA;  '000.000.000.000' =&amp;gt; array(&#xA;    'server' =&amp;gt; '000.000.000.000',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; '***********',&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;config.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'devMode' =&amp;gt; true,&#xA;        'loginPath' =&amp;gt; 'users/login',&#xA;        'postLoginRedirect' =&amp;gt; 'commerce/customer',&#xA;        'setPasswordPath' =&amp;gt; 'users/setpassword',&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;    ),&#xA;&#xA;    '000.000.000.000' =&amp;gt; array(&#xA;      'siteUrl' =&amp;gt; 'http://000.000.000.000/',&#xA;      'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '/var/www/html/',&#xA;        'baseUrl' =&amp;gt; 'http://000.000.000.000/',&#xA;      )&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Also index.php file for good measure&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help needed and much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-12-04T17:23:56.680" Title="Multi-Environment Config Database Credentials" Tags="&lt;database&gt;&lt;server&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13592" PostTypeId="1" AcceptedAnswerId="13598" CreationDate="2016-02-05T15:49:54.860" Score="1" ViewCount="500" Body="&lt;p&gt;This is a simple question but I haven't been able to find the answer. Does the Image Transform Quality setting &quot;Auto&quot; mean that no compression will be applied to the transform?&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2016-02-05T19:05:53.360" Title="Image Transform Quality settings" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13593" PostTypeId="2" ParentId="13591" CreationDate="2016-02-05T16:04:42.997" Score="1" Body="&lt;p&gt;Here is what my configuration looks like. Ideally, I'd like to swap out the hard-coded &lt;code&gt;baseUrl&lt;/code&gt; with something like I have for &lt;code&gt;basePath&lt;/code&gt;. That way the other members on my team can call/put the site wherever they want and it won't break anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't make any changes to &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'*' =&amp;gt; array(&#xA;    'tablePrefix' =&amp;gt; ''&#xA;),&#xA;'.dev' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'username',&#xA;    'password' =&amp;gt; 'password',&#xA;    'database' =&amp;gt; 'dbname'&#xA;),&#xA;'mysite.stagingdomain.com' =&amp;gt; array(&#xA;    'server' =&amp;gt; '12.345.67.890',&#xA;    'user' =&amp;gt; 'username',&#xA;    'password' =&amp;gt; 'password',&#xA;    'database' =&amp;gt; 'dbname'&#xA;),&#xA;'mysite.com' =&amp;gt; array(&#xA;    'server' =&amp;gt; '12.345.67.890',&#xA;    'user' =&amp;gt; 'username',&#xA;    'password' =&amp;gt; 'password',&#xA;    'database' =&amp;gt; 'dbname'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;    'cpTrigger' =&amp;gt; 'admin',  // whatever you want&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'enableCsrfProtection' =&amp;gt; true&#xA;),&#xA;'.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://mysite.dev/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;        'baseUrl' =&amp;gt; 'http://mysite.dev/', &#xA;    )&#xA;),&#xA;'mysite.stagingdomain.com' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://mysite.stagingdomain.com/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;        'baseUrl' =&amp;gt; 'http://mysite.stagingdomain.com/'&#xA;    )&#xA;),&#xA;'mysite.com' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://www.mysite.com/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;        'baseUrl' =&amp;gt; 'http://www.mysite.com/'&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-02-05T17:00:45.563" LastActivityDate="2016-02-05T17:00:45.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13594" PostTypeId="2" ParentId="13563" CreationDate="2016-02-05T16:25:15.030" Score="3" Body="&lt;p&gt;You can query for the same entry in another locale by explicitly setting the locale parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set de = craft.entries.id(entry.id).locale('de').first() %}&#xA;{% set en = craft.entries.id(entry.id).locale('en').first() %}&#xA;&#xA;German:  {{ de ? 'OK' : 'nope' }}&#xA;English: {{ en ? 'OK' : 'nope' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-05T16:25:15.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13596" PostTypeId="2" ParentId="13586" CreationDate="2016-02-05T18:16:38.457" Score="1" Body="&lt;p&gt;Correct... by default the &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt; tag will use the current page's URI (including querystring) for the cache key.  If you want to change that behavior you'll need to specify the &lt;a href=&quot;https://craftcms.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;using key&lt;/a&gt; parameter and supply a unique key.  Although you might want to make something more unique than just &lt;code&gt;block.id&lt;/code&gt; as that will be an integer and could potentially easily be overwritten.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-05T18:16:38.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13597" PostTypeId="2" ParentId="13589" CreationDate="2016-02-05T18:23:04.337" Score="0" Body="&lt;p&gt;A bit hard to tell what you're trying to do from the description and without seeing some code examples, but internally Craft uses &lt;a href=&quot;https://craftcms.com/classreference/helpers/ElementHelper#setValidSlug-detail&quot; rel=&quot;nofollow&quot;&gt;ElementHelper::setValidSlug()&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/classreference/helpers/ElementHelper#setUniqueUri-detail&quot; rel=&quot;nofollow&quot;&gt;ElementHelper::setUniqueUri()&lt;/a&gt; to perform those tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether you need to use them directly or call a Craft method that uses them is hard to say without more context.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-05T18:23:04.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13598" PostTypeId="2" ParentId="13592" CreationDate="2016-02-05T19:05:53.360" Score="3" Body="&lt;p&gt;It should probably be more accurately renamed to &lt;code&gt;Default&lt;/code&gt; instead of &lt;code&gt;Auto&lt;/code&gt;, but if that is selected, then it will use the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultImageQuality&quot; rel=&quot;nofollow&quot;&gt;defaultImageQuality&lt;/a&gt; config setting value.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-05T19:05:53.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13599" PostTypeId="1" CreationDate="2016-02-06T00:03:00.237" Score="2" ViewCount="410" Body="&lt;p&gt;I have run into an issue where the following code will only return 100 blocks, despite the fact that there are more. Is there some limit I am not aware of? Running the latest version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for block in entry.supporters.type('individuals').order('firstName') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2016-02-06T00:05:48.610" LastActivityDate="2016-02-06T00:05:48.610" Title="Any limit on number of Matrix Blocks?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13600" PostTypeId="2" ParentId="13599" CreationDate="2016-02-06T00:05:17.713" Score="6" Body="&lt;p&gt;Every criteria model in Craft 2 has a limit set to 100 by default. You can override it by setting a &lt;code&gt;limit&lt;/code&gt; parameter on the model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.supporters.type('individuals').order('firstName').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-06T00:05:17.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13601" PostTypeId="2" ParentId="13541" CreationDate="2016-02-06T17:21:12.053" Score="5" Body="&lt;p&gt;The &lt;code&gt;input&lt;/code&gt; tag presented in the comments above does not appear to use the correct &lt;code&gt;input&lt;/code&gt; tag format for the date field. To submit a date field on the front-end, your input fields need to be setup with the following &lt;code&gt;name&lt;/code&gt; structure and &lt;code&gt;value&lt;/code&gt; format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[fieldHandle][date]&quot; value=&quot;10/15/2012&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[fieldHandle][time]&quot; value=&quot;6:12 PM&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using your example field handle of &lt;code&gt;child1DateOfBirth&lt;/code&gt; this would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[child1DateOfBirth][date]&quot; value=&quot;10/15/2012&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[child1DateOfBirth][time]&quot; value=&quot;6:12 PM&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To submit any field on the front-end of Craft requires that you use the right format for the &lt;code&gt;input&lt;/code&gt; field you are submitting.  Assuming the field submits just fine from within Craft, one way to track down the format you need on the front-end is to use your browser's developer tools and look at the &lt;code&gt;input&lt;/code&gt; tags for the respective field in the Craft control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot;&gt;Craft CMS Field Guide&lt;/a&gt; on Straight Up Craft is another resource that gives examples of all the different native Craft fields and examples of &lt;code&gt;input&lt;/code&gt; fields for the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If things currently aren't working, consider trying to hard code these values and confirm that this works at all.  You'll then need to figure out how to get the respective datepicker you are using to format the selected data into the proper &lt;code&gt;input&lt;/code&gt; format as described above.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I don't believe this is an issue with any specific form plugin being used.  In the case you wanted to use a dynamic date field with your form (instead of manually creating your form as you describe above), you could extend Sprout Forms and add support for a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot;&gt;custom front-end field&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-02-06T17:21:12.053" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13602" PostTypeId="1" AcceptedAnswerId="17040" CreationDate="2016-02-06T19:17:20.280" Score="1" ViewCount="318" Body="&lt;p&gt;I call a service function inside the performAction method of custom element-action and I'd like to show an error message to user if the service function returned false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to set success message by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;setMessage($this-&amp;gt;getParams()-&amp;gt;successMessage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't know how to set an error message i.e. with red background.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2016-09-29T17:12:42.463" Title="How to set error message in element action?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;control-panel&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13603" PostTypeId="1" AcceptedAnswerId="13609" CreationDate="2016-02-07T20:39:22.637" Score="1" ViewCount="505" Body="&lt;p&gt;I'm writing a migration for one of my plugins, and struggling to resolve something which should theoretically be simple:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;renameColumn('myplugin_mytable', 'oldId', 'newId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Except that doesn't work, because the column is a &lt;strong&gt;foreign key&lt;/strong&gt;. The migration fails, and it kicks out this error in the log file:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2016/02/07 20:09:29 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1025 Error on rename of './mysite/#sql-95d9_1e' to './mysite/craft_myplugin_mytable' (errno: 150). The SQL statement executed was: ALTER TABLE &lt;code&gt;craft_myplugin_mytable&lt;/code&gt; CHANGE &lt;code&gt;oldId&lt;/code&gt; &lt;code&gt;newId&lt;/code&gt; int(11) NOT NULL (/craft/app/framework/db/CDbCommand.php:358)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Googling around, it seems that this error happens when you attempt to alter a foreign key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this method as well:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;dropForeignKey&lt;/code&gt; for &quot;oldId&quot;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;renameColumn&lt;/code&gt; from &quot;oldId&quot; to &quot;newId&quot;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;addForeignKey&lt;/code&gt; for &quot;newId&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But unfortunately, that's not working smoothly either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the right way to rename a foreign key?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Sidenote: I'm tempted to post a feature request for P&amp;amp;T to add a &lt;code&gt;renameForeignKey&lt;/code&gt; method to the &lt;a href=&quot;https://craftcms.com/classreference/helpers/MigrationHelper&quot; rel=&quot;nofollow&quot;&gt;MigrationHelper&lt;/a&gt; class. If that seems like the right approach, I'm happy to submit that feature request and we can close this question.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2016-02-08T07:11:53.430" LastActivityDate="2016-02-08T07:11:53.430" Title="Migrations: What's the right way to rename a Foreign Key?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13604" PostTypeId="2" ParentId="13588" CreationDate="2016-02-07T22:00:07.940" Score="2" Body="&lt;p&gt;Not sure if you figured this out yet but just took a quick look. It's showing up for me in the dashboard but getting a fatal error on line 45 just after installing it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like you have &lt;code&gt;MudDate::log&lt;/code&gt;, probably should be &lt;code&gt;MudDatePlugin::log&lt;/code&gt; (need the full plugin name in this instance I think, because Craft hasn't fully initialized your plugin yet?).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-07T22:00:07.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13605" PostTypeId="2" ParentId="13585" CreationDate="2016-02-07T22:42:17.653" Score="1" Body="&lt;p&gt;Craft gives you a lot of options here. I think you're close. The way I'd set it up:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Boats&lt;/strong&gt; (section)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Suppliers&lt;/strong&gt; (section)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Boat Type&lt;/strong&gt; (category)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then in your boats section, set up a &lt;code&gt;Supplier&lt;/code&gt; relational field, and have it relate back to your &lt;code&gt;suppliers&lt;/code&gt; section and also a &lt;code&gt;Boat Type&lt;/code&gt; relational field, which relates back to that category group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, on the front end, you can easily filter by boat type or supplier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; on your supplier pages, you can easily get a list of all the boats made by that supplier, just by querying that section like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# assume we're on a supplier page #} &#xA;&#xA;{% set boatsBySupplier = craft.entries.section('boats').relatedTo(entry) %}&#xA;&#xA;{% for theBoat in boatsBySupplier %}&#xA;    &amp;lt;h2&amp;gt;{{theBoat}}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;p&amp;gt;Model: {{theBoat.modelNumber}}&amp;lt;/p&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In terms of templating, there won't be a huge difference if you choose a category over an entry, for example, for your suppliers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tend to think of brands (suppliers) as content, thus content belongs in an Entry, not in a taxonomy (category). (Down the road you might want to have more than one supplier type, for example.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if your data on suppliers is relatively thin, a category would work just as well. Even then, unlike other CMS, Craft allows you to use custom fields on Categories to add more data. So there's no wrong answer there.  In that case, Craft will populate the &lt;code&gt;category&lt;/code&gt; variable (and not &lt;code&gt;entry&lt;/code&gt;) so just change that and you should be all good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what you mean here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But does it make more sense to use suppliers as entries [fields] and relate them to products as 'parents'?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you're asking about setting up a structure, and having the top level parent be the supplier and the boat model be a child, I'd steer clear of that.  A lot of things can go wrong with that model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, I like to keep data structures as &quot;flat&quot; as possible and create depth with Craft's relationships. But if you're asking about using entries fields to relate your suppliers back to your boats, that's exactly what my example above does.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-02-07T23:02:19.257" LastActivityDate="2016-02-07T23:02:19.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13606" PostTypeId="1" CreationDate="2016-02-07T22:43:52.283" Score="0" ViewCount="17" Body="&lt;p&gt;I just started using craft and am still exploring the Happy Lager demo version. I can create new sections, fields and entries. However, when I try to render the entry on my browser by clicking on the globe icon, the URL takes me to &quot;Page not found&quot; error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I not allowed to create new entries on the demo? or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="4708" LastEditorUserId="22" LastEditDate="2017-05-09T22:36:04.480" LastActivityDate="2017-05-09T22:36:04.480" Title="I am unable to render new entries on the browser (demo version)" Tags="&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13607" PostTypeId="1" AcceptedAnswerId="13608" CreationDate="2016-02-08T02:25:30.930" Score="1" ViewCount="82" Body="&lt;p&gt;I am trying (and failing miserably) to send multipule products to my cart using &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow&quot;&gt;MultiAdd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the data getting sent - it looks ok? I get a 200 response back, so I know its working, but I'm always getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;error&quot;:[&quot;No items?&quot;]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what my form data looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action:multiAdd/multiAdd&#xA;redirect:commerce/cart&#xA;qty:1&#xA;CSRF:gQBSJxqkMIQChG3r6TJ4Dz81dgtZuh4yrv_ZUDTp|ecc547c00a45b29a506b9f4c7904e62add62d37a&#xA;myProductOne:174&#xA;myProductTwo:64&#xA;myProductThree:189&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My product template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;multiAdd/multiAdd&quot;&amp;gt;&#xA;...&#xA;&#xA;&amp;lt;select name=&quot;myProductOne&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;174&quot;&amp;gt;Value&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;...&#xA;&amp;lt;select name=&quot;myProductTwo&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;64&quot;&amp;gt;Value&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;...&#xA;&amp;lt;select name=&quot;myProductTwo&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;189&quot;&amp;gt;Value&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using jquery validator to validate my form; I'm handling the submit like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA; onFormSubmit(function (response) {&#xA;     console.log(response);&#xA; });&#xA;&#xA;&#xA;var onFormFormSubmit = function (callback) {&#xA;    var data = $('#campRegistrationForm').serialize();&#xA;    data['CSRF'] = $('input[name=&quot;CSRF&quot;]').val();&#xA;&#xA;    $.ajax({&#xA;        'type': 'post',&#xA;        'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;        'cache': false,&#xA;        'data': data,&#xA;        'url': '/actions/' + $('input[name=&quot;action&quot;]').val(),&#xA;        'dataType': 'json',&#xA;        'timeout': 50000&#xA;    }).done(function (response) {&#xA;        callback(response);&#xA;    }).fail(function (error) {&#xA;        // Total fail.&#xA;    });&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see on the plugin's page, I need to have markup like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;items[{{ loop.index }}][options][color]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe it all boils down to the fact I'm not doing this correctly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for product in craft.commerce.products.find() %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since I am selling 3-5 different products on any given page, I can't loop through &lt;em&gt;all&lt;/em&gt; of my products as I only need specific ones at any given time. I'm not sure how to set that up correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help others, here is what each of my select input(s) look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select id=&quot;myProductOne&quot; name=&quot;items[1][purchasableId]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[1][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;...&#xA;&amp;lt;select id=&quot;myProductTwo&quot; name=&quot;items[2][purchasableId]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[2][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-02-08T05:16:15.270" LastActivityDate="2016-02-08T05:16:15.270" Title="Why does MultiAdd think I am not sending any items?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13608" PostTypeId="2" ParentId="13607" CreationDate="2016-02-08T04:00:02.890" Score="2" Body="&lt;p&gt;Ok you're getting there, but your form syntax is a bit off.  MultiAdd needs you to post a form with an array named items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of precisely the sort of thing you need to post:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action    &#xA;multiAdd/multiAdd&#xA;&#xA;items[1][purchasableId]    &#xA;854&#xA;items[1][qty]    &#xA;0&#xA;&#xA;items[4][purchasableId]    &#xA;857&#xA;items[4][qty]    &#xA;1&#xA;&#xA;items[5][purchasableId]    &#xA;858&#xA;items[5][qty]    &#xA;0&#xA;&#xA;items[6][purchasableId]    &#xA;859&#xA;items[6][qty]    &#xA;1&#xA;&#xA;redirect    &#xA;/cart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you're posting items, each keyed by an index value to keep the attributes together.  This can be anything really.  You just have to send for each the purchasableId and a qty (if you send 0 the item will just be ignored).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;items[whatever][purchasableId]&#xA;items[whatever][qty]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just send as many of those pairs as you need, exactly like that (i.e. it must be called &lt;code&gt;items&lt;/code&gt;, and the word &lt;code&gt;whatever&lt;/code&gt; you can replace with an arbitrary key).  Each pair must have a value for purchasableId and qty (so for the first example the purchasableId is 854 and the qty is 0, so this one won't be added to the cart).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You don't need to use the options syntax to add products as such, that's only required if you're using options with those products.  Maybe get your form working without options first, so just adding products) and then we can add them if you need them!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-02-08T04:16:05.257" LastActivityDate="2016-02-08T04:16:05.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13609" PostTypeId="2" ParentId="13603" CreationDate="2016-02-08T04:22:54.877" Score="3" Body="&lt;p&gt;The 2nd method you tried is the correct order to do it in.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Call &lt;a href=&quot;https://craftcms.com/classreference/etc/db/BaseMigration#dropForeignKey-detail&quot; rel=&quot;nofollow&quot;&gt;BaseMigration-&gt;dropForeignKey()&lt;/a&gt; (&lt;code&gt;$this-&amp;gt;dropForeignKey&lt;/code&gt; from within the context of a migration).&lt;/li&gt;&#xA;&lt;li&gt;Call &lt;a href=&quot;https://craftcms.com/classreference/etc/db/BaseMigration#renameColumn-detail&quot; rel=&quot;nofollow&quot;&gt;BaseMigration-&gt;renameColumn()&lt;/a&gt; (&lt;code&gt;$this-&amp;gt;renameColumn&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;And add the column back with with &lt;a href=&quot;https://craftcms.com/classreference/etc/db/BaseMigration#addForeignKey-detail&quot; rel=&quot;nofollow&quot;&gt;BaseMigration-&gt;addForeignKey()&lt;/a&gt; (&lt;code&gt;$this-&amp;gt;addForeignKey&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you received an error during any of those steps, it's likely because MySQL is complaining about inconsistent data among the FK endpoints or the endpoints are of different data types.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT BY OP&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final version of the code looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$table = 'myplugin_mytable';&#xA;$this-&amp;gt;dropForeignKey($table, 'oldId');&#xA;$this-&amp;gt;renameColumn($table, 'oldId', 'newId');&#xA;$this-&amp;gt;addForeignKey($table, 'newId', 'myplugin_related', 'id', 'CASCADE', 'CASCADE');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2016-02-08T07:10:51.087" LastActivityDate="2016-02-08T07:10:51.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13610" PostTypeId="2" ParentId="13606" CreationDate="2016-02-08T04:25:34.197" Score="1" Body="&lt;p&gt;I figured it out. I went with the default template file which did not exist, hence the error. &lt;/p&gt;&#xA;" OwnerUserId="4709" LastActivityDate="2016-02-08T04:25:34.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13611" PostTypeId="1" AcceptedAnswerId="13619" CreationDate="2016-02-08T07:18:14.760" Score="0" ViewCount="660" Body="&lt;p&gt;I have 3 locales set up - &lt;code&gt;en_ca&lt;/code&gt;, &lt;code&gt;fr_ca&lt;/code&gt;, &lt;code&gt;en_us&lt;/code&gt;.  &lt;code&gt;en_us&lt;/code&gt; was selected when installing Craft.  I had to change the default locale to &lt;code&gt;en_ca&lt;/code&gt; and did so in &lt;code&gt;general.php&lt;/code&gt; after installation.  I'd like this change in the CP as well.  Currently, entering new entries and the CP site link all still point to &lt;code&gt;en_us&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I change the default locale?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="57" LastEditDate="2016-02-08T13:40:53.217" LastActivityDate="2016-02-08T13:41:31.717" Title="Change admin CP default locale" Tags="&lt;localization&gt;&lt;default&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13612" PostTypeId="1" CreationDate="2016-02-08T10:10:14.923" Score="0" ViewCount="167" Body="&lt;p&gt;I am looking for some support as the developer who built my site (www.lexiconthai.com) is no longer available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a few small changes doing right now (adding meta tag plug in, changing fonts), but will need small jobs doing on a regular basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea where I can find someone to support me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David&lt;/p&gt;&#xA;" OwnerUserId="4712" LastActivityDate="2016-02-08T11:45:21.067" Title="Freelance work available" Tags="&lt;queries&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-02-08T16:57:55.033" ContentLicense="CC BY-SA 3.0" />
  <row Id="13613" PostTypeId="1" CreationDate="2016-02-08T11:12:41.013" Score="3" ViewCount="151" Body="&lt;p&gt;I am looking into the idea of porting my first site into Craft CMS. It is the site of a friend/client who has a railway engineering consultancy, and it's currently running on another CMS (TidyCMS). Before I dive in and look through all your documentation, I would appreciate some help, just so that I don’t run into a design roadblock further down the road.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are really only two areas where I am concerned about porting to Craft CMS :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Actualités (News) page :&lt;/strong&gt;&#xA;&lt;a href=&quot;http://www.study-technologies.com/fr/actualites.html&quot; rel=&quot;nofollow&quot;&gt;http://www.study-technologies.com/fr/actualites.html&lt;/a&gt;&#xA;These are news listings on the page (image + date + title/text), which point to individual article pages when clicked. Can this be done in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Project pages :&lt;/strong&gt;&#xA;&lt;a href=&quot;http://www.study-technologies.com/fr/projets-ferro.html&quot; rel=&quot;nofollow&quot;&gt;http://www.study-technologies.com/fr/projets-ferro.html&lt;/a&gt;&#xA;These are project galleries which are dynamically populated as individual project pages are created. An image in the project page is chosen to appear in the gallery grid. Can this be done in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few other questions :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Can Craft CMS handle bilingual sites?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the Craft CMS admin available in French?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can my client set up different user permission levels?**&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I hope you can answer all of these, and if so, I’ll be diving in right away! I have other clients that I’d like to port over, but this client has the most complex design, so I’d like to use it as a test case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Ric&lt;/p&gt;&#xA;" OwnerUserId="4713" LastEditorUserId="22" LastEditDate="2017-05-09T22:31:19.817" LastActivityDate="2017-05-09T22:31:19.817" Title="Appraising Craft CMS - newbie questions" Tags="&lt;localization&gt;&lt;permissions&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13614" PostTypeId="2" ParentId="13612" CreationDate="2016-02-08T11:45:21.067" Score="2" Body="&lt;p&gt;This isn't the appropriate place for such a request. You can however register for the &lt;a href=&quot;http://craftcms.slack.com/&quot; rel=&quot;nofollow&quot;&gt;Craft CMS Slack&lt;/a&gt; where there is a #jobs channel.&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-08T11:45:21.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13615" PostTypeId="2" ParentId="13613" CreationDate="2016-02-08T11:46:46.780" Score="4" Body="&lt;p&gt;Craft is the perfect CMS to handle everything you just pointed out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can Craft CMS handle bilingual sites? &lt;strong&gt;YES.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is the Craft CMS admin available in French? &lt;strong&gt;YES.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/cp-languages&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/cp-languages&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Can my client set up different user permission levels?** &lt;strong&gt;&quot;YES&quot;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your use case this will be doable. Then its just a matter of &quot;how&quot; your client wants to be able to do this. Craft supports dynamic user permissions creation so whatever your use case is I'm sure Craft will handle it with ease.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-02-08T11:46:46.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13616" PostTypeId="1" AcceptedAnswerId="13617" CreationDate="2016-02-08T11:52:15.940" Score="1" ViewCount="376" Body="&lt;p&gt;Is there a way to change the email address stored in the &lt;code&gt;craft_systemsettings&lt;/code&gt; table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this was originally setup when installing Craft but now I need to change it. I've changed the email address in the user account but this is not modifying the &lt;code&gt;craft_systemsettings&lt;/code&gt; table. I could go into the phpMyAdmin and modify the MySQL but this feels like quite a clunky process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2016-02-08T11:59:14.013" Title="Change system settings email address" Tags="&lt;emails&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13617" PostTypeId="2" ParentId="13616" CreationDate="2016-02-08T11:59:14.013" Score="4" Body="&lt;p&gt;I think you are referring to the System Email Address under &quot;Settings&quot; -&gt; &quot;E-mail&quot; -&gt; &quot;System Email Address&quot;.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-02-08T11:59:14.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13619" PostTypeId="2" ParentId="13611" CreationDate="2016-02-08T13:41:31.717" Score="2" Body="&lt;p&gt;You need to update the locale to &lt;code&gt;en_ca&lt;/code&gt; in the control panel under Settings-&gt;Locales.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-08T13:41:31.717" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13620" PostTypeId="1" AcceptedAnswerId="13621" CreationDate="2016-02-08T14:11:30.483" Score="5" ViewCount="1189" Body="&lt;p&gt;Is it possible to populate a Matrix Field, Table and Lightbox using the GuestEntries plugin from an HTML form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to build an RSVP form, and am not having a lot of luck with different field types.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Using the syntax from Brad's answer is working to create rows in the table on new entries, but it's not populating them. The below code creates two rows in the table, but they're empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[guests][0][name]&quot; placeholder=&quot;Name&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[guests][1][name]&quot; placeholder=&quot;Name&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="475" LastEditorUserId="4118" LastEditDate="2016-02-12T23:22:07.030" LastActivityDate="2016-02-20T20:11:55.243" Title="Populating tables and matrix fields using GuestEntries" Tags="&lt;form&gt;&lt;custom-fieldtype&gt;&lt;guest-entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13621" PostTypeId="2" ParentId="13620" CreationDate="2016-02-08T14:28:13.303" Score="8" Body="&lt;p&gt;See here for example front-end HTML code for all of Craft's default field types:  &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;noreferrer&quot;&gt;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matrix:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# You need to include the 'type' input to identify the matrix block type you are submitting #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle][new1][type]&quot; value=&quot;contacts&quot;&amp;gt;&#xA;&#xA;{# All of your custom fields must be within a 'fields' array. #}&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[fieldHandle][new1][fields][field1Handle]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[fieldHandle][new1][fields][field2Handle]&quot; &amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[fieldHandle][new1][fields][field3Handle]&quot; &amp;gt;&#xA;&#xA;{# For New Entries, you'll want to use the naming convention &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'new1', 'new2', 'new3' for each of your blocks.  For existing entries you &#xA;can update those values to be the block IDs #}&#xA;    &#xA;    &#xA;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Table:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col1]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col2]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col3]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle][0][col4]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[fieldHandle][0][col4]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][1][col1]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][1][col2]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][1][col3]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle][1][col4]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[fieldHandle][1][col4]&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lightswitch:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="115" LastEditDate="2016-02-20T20:11:55.243" LastActivityDate="2016-02-20T20:11:55.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13622" PostTypeId="1" AcceptedAnswerId="13623" CreationDate="2016-02-08T14:35:21.223" Score="3" ViewCount="557" Body="&lt;p&gt;I have an idea to create urls for entries that can't be guessed, but are automated without any extra effort from the content creator/editors. The intention is for the URL not require any authentication, but not be &quot;guessable&quot; just because you have another similar URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought was to use the &lt;strong&gt;Entry URL Format&lt;/strong&gt; field to automate this. I tried the following but it didn't work as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;documents/{ (id * 1234567) | number_format(0, null, '-') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assumed I could use any twig syntax here due to the description/label for the input field:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What the entry URLs should look like. You can include tags that output entry properties, such as &lt;code&gt;{slug}&lt;/code&gt; or &lt;code&gt;{postDate|date(&quot;Y&quot;)}&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, is it possible to do what I'm trying? What's the correct twig syntax here?&lt;/p&gt;&#xA;" OwnerUserId="3474" LastActivityDate="2016-02-08T14:43:07.427" Title="How do I properly use Twig syntax in dynamic title/URL fields?" Tags="&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13623" PostTypeId="2" ParentId="13622" CreationDate="2016-02-08T14:36:12.463" Score="6" Body="&lt;p&gt;After chatting with The Honorable Brad Bell I learned that the sample tags in the field's label are showing some shorthand references to a few variables. (The &lt;code&gt;{slug}&lt;/code&gt; reference for example.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I needed to do was use the &lt;code&gt;object&lt;/code&gt; object to fully utilize twig tags/filters/etc. Here are a few ways to achieve what I was aiming for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set num = (object.id * 1234567) | number_format(0, null, '-') %}documents/{{ num }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or slightly more concise code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;documents/{{ (object.id * 1234567) | number_format(0, null, '-') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, thanks to carlsc for sharing the documentation on this feature. Reference: &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy Dynamic Titling and URLing.&lt;/p&gt;&#xA;" OwnerUserId="3474" LastEditorUserId="3474" LastEditDate="2016-02-08T14:43:07.427" LastActivityDate="2016-02-08T14:43:07.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13624" PostTypeId="2" ParentId="13588" CreationDate="2016-02-08T15:54:25.500" Score="0" Body="&lt;p&gt;Okay, seems like there was a permission error on the folder for this plugin. This was due to pasting in a boilerplate template from pluginfactory.io&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To resolve updated permission of folder and containing files and plugin was visible in back-end &lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-02-08T15:54:25.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13625" PostTypeId="1" CreationDate="2016-02-08T18:13:25.927" Score="3" ViewCount="1066" Body="&lt;p&gt;I'm used to this feature in ExpressionEngine either natively or via the Auto Linker plugin, where you just wrap it around all the text fields. I've seen the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/encode-email&quot; rel=&quot;nofollow&quot;&gt;Sprout Encode Email&lt;/a&gt; addon but that doesn't search through text and apply it.&#xA;I don't mind if it doesn't create a mailto link, I just want to obfuscate every email address that appears in any of the text fields in a template.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-04-28T17:59:33.757" Title="How to auto obfuscate email addresses in rich text field" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13626" PostTypeId="2" ParentId="13613" CreationDate="2016-02-09T00:40:30.220" Score="3" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/a/13615/1016&quot;&gt;naboovalley's great answer&lt;/a&gt;...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Actualités (News) page: These are news listings on the page (image + date + title/text), which point to individual article pages when clicked.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure can. Basically you'd setup a new &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;section&lt;/a&gt; in Craft to house these entries. Craft already has the title and date fields built-in so you just need to add an &lt;a href=&quot;https://craftcms.com/docs/assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset field&lt;/a&gt; so your client to add a featured image.  If you want to have a different image for the thumbnails and one of the main page, you can do that too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other CMS where there might be a one-to-one map of the image, Craft allows you to reference the image a client uploads, then put some transforms on it (scale, crop) to exactly fit your design (while keeping the original intact).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Project pages: project galleries which are dynamically populated as individual project pages are created. An image in the project page is chosen to appear in the gallery grid. Can this be done in Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Similar case as above. This is also great fit for Craft's relationships. Craft allows you supreme power to relate basically anything with anything else. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's lots of ways to pull this off. You'd create a projects section that houses the actual projects (the data). You might have a main projects &quot;index&quot; page that the client can choose which projects are featured (and which aren't). Doing that is as simple is putting in an Entries relational field that allows the client to choose just which projects should be featured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the actual project pages themselves, I noticed you have a block of text (on the left) and an image on the right. These types of layouts could easily be made with Craft's &lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... just so that I don’t run into a design roadblock further down the road.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a common concern. If you think of Craft as basically just a big interface to a database (in a sense) with a really nice user interface, you're just putting in the data in the right spots when you design your templates. Craft allows you easy access to any piece of data inside the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other CMS where they impose design limitations on your design (say by including jQuery automatically in the output or going through some kind of loop... seriously WordPress?), Craft keeps the front end up to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing that trips most new people up with Craft is Twig, the templating language that Craft uses. Once you get the hang of it, though, it's easy to use, yet powerful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out Craft's &lt;a href=&quot;https://demo.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager demo site&lt;/a&gt;. It features many of the same concepts... relations, images, etc.  &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-09T00:48:58.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13628" PostTypeId="1" AcceptedAnswerId="13661" CreationDate="2016-02-09T02:36:05.693" Score="1" ViewCount="1083" Body="&lt;p&gt;I'm trying to create parent/child Single sections without using Structures.  So in other words, create a Single section and assign it a parent Single section.  Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-02-10T23:10:40.123" Title="Parent/child Single sections" Tags="&lt;structure&gt;&lt;sections&gt;&lt;singles&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13629" PostTypeId="1" CreationDate="2016-02-09T02:59:13.723" Score="1" ViewCount="230" Body="&lt;p&gt;Is it possible to get Sprout Forms built in notifications to have dynamic reply to details? Or even from name etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wanting my client to be able to respond directly to the client when Sprout Forms notifies them that a new submission has been posted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting {{ formFieldName }} with the relevant field name in the &quot;Reply To Email Address&quot; field made the email not send (so obviously doesn't work).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-02-09T03:54:04.010" Title="Dynamic Reply-To In Sprout Forms Notification" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13630" PostTypeId="2" ParentId="13629" CreationDate="2016-02-09T03:54:04.010" Score="1" Body="&lt;p&gt;It looks like you might need to update your dynamic values. Sprout Forms supports two types of syntax for dynamic information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Shorthand syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{formFieldHandle}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Object syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.formFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Submitted values from your form entry should be available in all of your notification fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Email Recipients&lt;/li&gt;&#xA;&lt;li&gt;Subject&lt;/li&gt;&#xA;&lt;li&gt;Sender Name&lt;/li&gt;&#xA;&lt;li&gt;Sender Email Address (although you probably don't want to set this dynamically as it can affect deliverability)&lt;/li&gt;&#xA;&lt;li&gt;Reply To Email Address&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-02-09T03:54:04.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13631" PostTypeId="2" ParentId="13625" CreationDate="2016-02-09T08:23:31.183" Score="3" Body="&lt;p&gt;I wrote a really quick Plugin for you to use that uses the &lt;code&gt;_encodeStringRot13&lt;/code&gt; function from the Sprout guys to use on any variable you want in Craft. What the Plugin does is to give you a new Twig filter that you can apply like this &lt;code&gt;{{ entry.body|protectEmails }}&lt;/code&gt; and voila! - all &lt;code&gt;&amp;lt;a href=&quot;mailto:&quot;&amp;gt;&lt;/code&gt; will be encoded in ROT13 (reference: &lt;a href=&quot;http://snipplr.com/view/6037/&quot; rel=&quot;nofollow&quot;&gt;http://snipplr.com/view/6037/&lt;/a&gt;) on output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download it here: &lt;a href=&quot;http://www.naboovalley.com/craft/toolkit.rar&quot; rel=&quot;nofollow&quot;&gt;http://www.naboovalley.com/craft/toolkit.rar&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-02-09T08:23:31.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13633" PostTypeId="1" AcceptedAnswerId="13643" CreationDate="2016-02-09T10:22:15.777" Score="3" ViewCount="124" Body="&lt;p&gt;Is it somehow possible to import a dumped database from the admin control panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently dumping my database in the control panel and import the dumped file in the phpmyadmin interface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer dumping and importing in the control panel&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-02-09T12:08:27.180" Title="Database import in admin Control Panel" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13634" PostTypeId="1" AcceptedAnswerId="13637" CreationDate="2016-02-09T10:26:44.550" Score="3" ViewCount="569" Body="&lt;p&gt;I've set Craft offline (System status). Is it possible to &quot;open&quot; one specific URL route so it can be accessed even though the website is offline?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the route: &lt;code&gt;/blog/post&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-02-09T11:13:40.340" Title="Can I open one template/route when Craft is offline?" Tags="&lt;routes&gt;&lt;system-status&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13635" PostTypeId="2" ParentId="13634" CreationDate="2016-02-09T10:47:50.590" Score="3" Body="&lt;p&gt;You can add a template called &lt;code&gt;503.html&lt;/code&gt; to your &lt;code&gt;/templates&lt;/code&gt; folder. Craft will then use that template whenever the system is turned off, due to the HTTP status being set to &lt;code&gt;503&lt;/code&gt; (service unavailable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the &lt;code&gt;503.html&lt;/code&gt; template, you can of course include another template (e.g. &lt;code&gt;blog/post&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-09T10:47:50.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13636" PostTypeId="1" AcceptedAnswerId="13642" CreationDate="2016-02-09T10:50:12.663" Score="2" ViewCount="2248" Body="&lt;p&gt;I want to create a User Agent check. (Yes I know. It is evil.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I created an Array. The whole idea is to see if the user agent contains a specific word. This way I hope to circumvent regex trickery. But I have a hard time figuring how to return &lt;code&gt;true&lt;/code&gt; only once:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be the array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set browserValues = [ { agent: 'android'}, { agent: 'iemobile'} {# and so on #}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how I get the user agent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userAgent = craft.request.getUserAgent()|lower %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I came this far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for item in browserValues %}&#xA;   {% if item.agent in userAgent %}&#xA;     You're on mobile&#xA;   {% else %}&#xA;     You're not on mobile&#xA;   {% endif %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This actually works. But there are two problems: If the conditional is false (not on mobile), the conditional is applied for each key in the array. &lt;code&gt;You're not on mobile You're not on mobile You're not on mobile&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user agent string contains the word &lt;code&gt;android&lt;/code&gt; twice the conditional is applied twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prevent the conditional from looping over and over? (My brain starts to loop over and over too).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="125" LastEditDate="2016-02-09T11:33:21.753" LastActivityDate="2016-02-09T11:33:21.753" Title="Conditional to detect mobile devices with getUserAgent?" Tags="&lt;conditional&gt;&lt;array&gt;&lt;contains&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13637" PostTypeId="2" ParentId="13634" CreationDate="2016-02-09T10:54:55.507" Score="2" Body="&lt;p&gt;If you want to &quot;open&quot; more than one route, have a look at this question:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13639/can-i-open-templates-routes-other-than-503-when-craft-is-offline&quot;&gt;Can I open templates/routes other than 503 when Craft is offline?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-02-09T11:13:40.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13638" PostTypeId="1" CreationDate="2016-02-09T10:56:10.887" Score="0" ViewCount="229" Body="&lt;p&gt;Wondering if there is anything (plugin or otherwise) I can put into my Redactor json file that will generate a mailto option in the insert link dropdown? I can’t seem to find anything on the subject. &lt;/p&gt;&#xA;" OwnerUserId="478" LastActivityDate="2016-02-09T18:23:23.830" Title="Rich Text Field mailto Option" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13639" PostTypeId="1" AcceptedAnswerId="13640" CreationDate="2016-02-09T11:10:40.773" Score="2" ViewCount="419" Body="&lt;p&gt;I've set Craft offline (System status). Is it possible to &quot;open&quot; URL routes so it can be accessed even though the website is offline? Right now every request gets routed to my 503.html page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the routes: &lt;code&gt;/impressum&lt;/code&gt; and &lt;code&gt;/about&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-09T11:10:40.773" Title="Can I open templates/routes other than 503 when Craft is offline?" Tags="&lt;routes&gt;&lt;system-status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13640" PostTypeId="2" ParentId="13639" CreationDate="2016-02-09T11:10:40.773" Score="4" Body="&lt;p&gt;I don't think it's possible using the System Status switch in Settings → General.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a similar requirement and solved it with a custom variable &quot;maintenanceMode&quot; in my config.php and added some simple logic to the &lt;code&gt;init&lt;/code&gt; method in my business logic plugin, which redirects all request except some maintenance mode URLs to the 503 page.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$maintenanceUrls = array('/503', '/impressum', '/about');&#xA;&#xA;if (craft()-&amp;gt;request-&amp;gt;isSiteRequest() &amp;amp;&amp;amp; craft()-&amp;gt;config-&amp;gt;get('maintenanceMode')) {&#xA;    if (!in_array(craft()-&amp;gt;request-&amp;gt;getUrl(), $maintenanceUrls)) {&#xA;        craft()-&amp;gt;request-&amp;gt;redirect('503');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-09T11:10:40.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13642" PostTypeId="2" ParentId="13636" CreationDate="2016-02-09T11:25:55.920" Score="6" Body="&lt;p&gt;Unlike in PHP, it's not actually possible to break a &lt;code&gt;for&lt;/code&gt; loop in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around that fact, you can use the &lt;code&gt;for&lt;/code&gt; loop to set a flag, and then put the conditional outside the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isUserOnMobile = false %}&#xA;&#xA;{% for item in browserValues %}&#xA;    {% set isUserOnMobile = not isUserOnMobile ? item.agent in userAgent : isUserOnMobile %}&#xA;{% endfor %}&#xA;&#xA;{% if isUserOnMobile %}&#xA;    You're on mobile&#xA;{% else %}&#xA;    You're not on mobile&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option: I actually wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/Detect-Craft&quot;&gt;Detect&lt;/a&gt; for device detection (the plugin wraps the excellent &lt;a href=&quot;http://mobiledetect.net/&quot;&gt;Mobile_Detect&lt;/a&gt; library, which is sponsored by BrowserStack). Might be you'll be be able to use that, instead of hard coding lots of user agent strings. Here's how you can use Detect in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isUserMobile = craft.detect.isMobile %}&#xA;{% set isUserTablet = craft.detect.isTablet %}&#xA;{% set isUserPhone = craft.detect.isPhone %}&#xA;{% set isUserIphone = craft.detect.is('iphone') %}&#xA;{% set userAgent = craft.detect.getUserAgent %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-09T11:29:59.060" LastActivityDate="2016-02-09T11:29:59.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13643" PostTypeId="2" ParentId="13633" CreationDate="2016-02-09T12:08:27.180" Score="4" Body="&lt;p&gt;Not currently – if you want to, you can &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot;&gt;add a feature request.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, if you're on a Mac I recommend using &lt;a href=&quot;http://www.sequelpro.com/&quot;&gt;Sequel Pro&lt;/a&gt; for all your importing (and other database related) needs.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-09T12:08:27.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13646" PostTypeId="2" ParentId="13628" CreationDate="2016-02-09T18:07:45.567" Score="4" Body="&lt;p&gt;Ignoring the obvious &quot;use a Structure&quot; answer, I suppose you could fake a &quot;hierarchy&quot; by placing a &lt;code&gt;child&lt;/code&gt; and &lt;code&gt;parent&lt;/code&gt; entry field on each of your Single sections and manually assigning entries as relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your Twig template could would just be checking those fields and building the family tree based on the relationships.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-09T18:07:45.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13647" PostTypeId="2" ParentId="13638" CreationDate="2016-02-09T18:23:23.830" Score="1" Body="&lt;p&gt;I'm not aware of any way to do this in Redactor II other than going into Source view and manually entering the &lt;code&gt;mailto&lt;/code&gt; syntax.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-09T18:23:23.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13648" PostTypeId="1" CreationDate="2016-02-09T20:38:21.693" Score="1" ViewCount="919" Body="&lt;p&gt;&lt;em&gt;Craft Pro 2.5.2761 (no plugins)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a basic search form, and on my results template, the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{% set articles = craft.entries({&#xA;section: 'article',&#xA;order: 'score',&#xA;search: {&#xA;  attribute: 'keywords',&#xA;  query: query,&#xA;  subLeft: true,&#xA;  subRight: true&#xA;}&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works as expected (I get results when the query term matches the keyword of an entry). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want my search to encompass not just keywords, but also the  title and the body field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[edit - deleted part of my post because it was misleading as to the real problem]&lt;/p&gt;&#xA;" OwnerUserId="607" LastEditorUserId="607" LastEditDate="2016-02-10T05:03:17.330" LastActivityDate="2016-02-10T16:50:07.523" Title="Set Search to query multiple attributes (e.g. title, body)" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ClosedDate="2016-02-12T13:19:03.337" ContentLicense="CC BY-SA 3.0" />
  <row Id="13649" PostTypeId="1" AcceptedAnswerId="13729" CreationDate="2016-02-09T20:57:07.893" Score="1" ViewCount="998" Body="&lt;p&gt;I'm having trouble in the control panel. I'm get logged out all the time and I can't find the reason. The &quot;Your session has ended&quot; modal window appears all the time, I can just do a refresh and it stays in the control panel (logged in). Sometimes i'm also thrown out completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did i tried to solve it (together)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;'overridePhpSessionLocation' =&gt; true or false doesn't seem to make a difference&lt;/li&gt;&#xA;&lt;li&gt;removed my cookies&lt;/li&gt;&#xA;&lt;li&gt;craft/storage/runtime is on 777&lt;/li&gt;&#xA;&lt;li&gt;removed database content of craft_sessions&lt;/li&gt;&#xA;&lt;li&gt;removed craft/storage/runtime multiple times, it's created again. &lt;/li&gt;&#xA;&lt;li&gt;craft/storage/runtime/sessions stays empty and is on 777&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is the error in the log files:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2016/02/09 20:31:12 [warning] [application] Tried to restore session from a cookie, but the given hashed database token value does not appear to belong to the given login name. Hashed db value: cf349cc791478ab96e9229dad6367f1358f1404bczozMjoiMGQ0SUJxelZYYmdNUVh6WDhVdHhBODFUb0lWb2dGT0wiOw== and loginName: REDACTED&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(I edited the question to narrow down the problem. it's kinda driving me nuts)&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2016-02-11T21:10:10.193" LastActivityDate="2016-02-16T19:58:03.400" Title="Trouble with login admin" Tags="&lt;admin&gt;&lt;index&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13650" PostTypeId="2" ParentId="13648" CreationDate="2016-02-09T21:03:19.930" Score="0" Body="&lt;p&gt;Think it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;search: {&#xA;  attribute: {&#xA;    'keywords', &#xA;    'body', &#xA;    'title'&#xA;  }&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4427" LastActivityDate="2016-02-09T21:03:19.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13651" PostTypeId="2" ParentId="13648" CreationDate="2016-02-10T00:27:37.643" Score="2" Body="&lt;p&gt;It doesn't look like it's possible to pass an array of attributes to the &lt;code&gt;attribute&lt;/code&gt; parameter, the Craft docs explicitly state that it expects a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-10T16:50:07.523" LastActivityDate="2016-02-10T16:50:07.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13652" PostTypeId="2" ParentId="13649" CreationDate="2016-02-10T05:28:58.280" Score="0" Body="&lt;p&gt;Lots of stuff going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number 2 and 4 are symptoms of your session problems.  Numbers 1 and 3 and most likely not related and should be their own, separate questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your session issues, there are &lt;a href=&quot;https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area&quot;&gt;many things&lt;/a&gt; that could cause you to get logged out on the admin, but your specific error message indicates that something is interfering/tampering with the cookie that Craft uses to maintain session (the authentication hash in the cookie doesn't match the authentication hash that Craft saved in the database when the session was started).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start debugging that first I'd disable any browser add-ons and make sure that you don't have any other authenticated sessions open on other browsers/tabs for the same domain while you're testing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-10T05:28:58.280" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13653" PostTypeId="1" AcceptedAnswerId="13689" CreationDate="2016-02-10T09:17:56.587" Score="3" ViewCount="291" Body="&lt;p&gt;I want to sort entries with a Smart Map address field for closest location. I know how it should be done in a template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.myAddress(params).order('distance').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only, I would like to do so in my business logic and not in my template. I tried something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'houses';&#xA;$criteria-&amp;gt;myAddress-&amp;gt;target = '90210';&#xA;$criteria-&amp;gt;order = 'myAddress.distance';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this does not work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I tried related options but can't seem to get anything to work. Can I also do this with the Element API plugin to return the results as JSON?&lt;/p&gt;&#xA;" OwnerUserId="4720" LastEditorUserId="45" LastEditDate="2016-02-13T06:56:56.560" LastActivityDate="2021-01-01T06:34:27.707" Title="Smart Map - Sorting for closest location in PHP" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13654" PostTypeId="1" AcceptedAnswerId="13655" CreationDate="2016-02-10T10:04:07.913" Score="1" ViewCount="68" Body="&lt;p&gt;I'm not quite sure from the &lt;a href=&quot;https://craftcms.com/docs/config-settings#updates&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; what the difference is between 'minor' and 'build' updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would the &lt;code&gt;allowAutoUpdates&lt;/code&gt; general config setting have treated the update from &lt;code&gt;2.4.2726&lt;/code&gt; to &lt;code&gt;2.5.2750&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would happen when the 2.5.x update was released, depending on whether that setting was &lt;code&gt;true&lt;/code&gt;, &lt;code&gt;minor&lt;/code&gt; or &lt;code&gt;build&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-02-10T19:39:55.550" Title="How does the allowAutoUpdates setting differentiate?" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13655" PostTypeId="2" ParentId="13654" CreationDate="2016-02-10T10:25:01.753" Score="2" Body="&lt;p&gt;Craft's version numbers follow this pattern:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;major.minor.build&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your update was a &lt;code&gt;minor&lt;/code&gt; update and you could have blocked it with the settings &lt;code&gt;build-only&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="57" LastEditDate="2016-02-10T19:39:55.550" LastActivityDate="2016-02-10T19:39:55.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13656" PostTypeId="1" AcceptedAnswerId="14015" CreationDate="2016-02-10T13:41:50.380" Score="2" ViewCount="988" Body="&lt;p&gt;This question is very similar to the question posted &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9081/how-to-filter-entries-by-clicking-multiple-categories-on-front-end&quot;&gt;here&lt;/a&gt; I have asked in the comments but my requirements are slightly different. I am trying to filter search results by categories in more than one category group and use both an exclusive search (category AND category) and a non exclusive search (category OR category).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My use case is this: the parks category wants to filter using the OR filter so Park A OR Park B and so does the price filter so Price A OR Price B but when they are combined Park A AND Price B only show parks in the Price A category.&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-04T11:05:26.967" Title="How to filter entries in multiple category groups by selecting multiple categories" Tags="&lt;categories&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13657" PostTypeId="2" ParentId="2198" CreationDate="2016-02-10T17:07:34.703" Score="4" Body="&lt;p&gt;You can now use the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; parameter in your search options, to set the fields the search term should apply to (feature introduced with Craft 2.5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunatelly it's currently only possible to set a single attribute, but what you can do is to use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;noreferrer&quot;&gt;Preparse plugin&lt;/a&gt; to add a field to your elements&#xA;where you collect / concatenate search terms from all relevant fields, then search in this field only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The settings for your &lt;code&gt;searchTerms&lt;/code&gt; Preparse field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&#xA;{{ entry.body }}&#xA;{{ entry.keywords }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The search parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchParam = {&#xA;    query: query,&#xA;    attribute: 'searchTerms'&#xA;    subLeft: true,&#xA;    subRight: true,&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-10T17:07:34.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13658" PostTypeId="1" CreationDate="2016-02-10T17:19:50.300" Score="0" ViewCount="1080" Body="&lt;p&gt;Our users were getting a blank white screen on our homepage yesterday. Inspecting revealed it was just an empty page. All other pages on the site worked fine. I ended up clearing the cache and it resolved the issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why the cache would have been serving an empty page instead of the home page? &lt;/p&gt;&#xA;" OwnerUserId="3886" LastActivityDate="2016-02-10T19:41:55.277" Title="White Screen of Death" Tags="&lt;cache&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13659" PostTypeId="2" ParentId="13658" CreationDate="2016-02-10T17:30:35.743" Score="3" Body="&lt;p&gt;Honestly, that's pretty much impossible to say, it could be pretty much anything – though a white screen is often due to PHP errors, in which case you might find a clue in your log files (located at &lt;code&gt;/craft/storage/runtime/logs&lt;/code&gt; (search for &lt;code&gt;[error]&lt;/code&gt;). Your web server's error logs might hold some clues as well.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="57" LastEditDate="2016-02-10T19:41:55.277" LastActivityDate="2016-02-10T19:41:55.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13660" PostTypeId="1" CreationDate="2016-02-10T22:35:13.917" Score="1" ViewCount="164" Body="&lt;p&gt;Craft Pro 2.4.2702&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Experiencing an intermittent issue with a Craft site that randomly crops up. It always seems to occur randomly with the caching and the &quot;www&quot; prefix and URLs being cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a Redactor WYSIWYG field, this is the markup.&#xA;&lt;code&gt;&#xA;&amp;lt;a href=&quot;https://www.mysite.org/privacy-policy#entry:585:url&quot;&amp;gt;Privacy Policy&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Randomly at times the page, the page URL links will be cached like so. Notice the &lt;strong&gt;eww&lt;/strong&gt;.mysite.org. I've seen other instances where it's been &lt;strong&gt;ww&lt;/strong&gt;.mysite.org/page-url, &lt;strong&gt;eee&lt;/strong&gt;.mysite.org/page-url, &lt;strong&gt;htp&lt;/strong&gt;.mysite.org, &lt;strong&gt;wee&lt;/strong&gt;.mysite.org for all URLs that are being cached in the craft_templatecaches table. The urls are generated by &lt;code&gt;entry.getUrl()&lt;/code&gt;, but also are manually typed in using a WYSIWYG field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my previous example, this is how it's being cached in the database&#xA;&lt;code&gt;&amp;lt;a href=&quot;https://eww.mysite.org/privacy-policy&quot;&amp;gt;Privacy Policy&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Majority of the caching on the site is done like so.&#xA;&lt;code&gt;&#xA;{%- cache globally unless craft.config.devMode -%}&#xA;...&#xA;{%- endcache -%}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I thought this might have been the wildcard in the DNS (*.mysite.org) and the page was still resolving with any prefix value and the URLs were being cached like so. I since then have removed the wildcard from the DNS, the page no longer resolves with an incorrect prefix, and this issue seems to pop up randomly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&#xA;define('SITE_URL',    URI_SCHEME . 'www.' . $_SERVER['SERVER_NAME'] . '/');&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Htaccess file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# ----------------------------------------------------------------------&#xA;# Rewrite Craft URLs to remove index.php&#xA;# ----------------------------------------------------------------------&#xA;&#xA;    RewriteEngine On&#xA;&#xA;    # ----------------------------------------------------------------------&#xA;    # Force &quot;www.&quot; to beginning of URLs&#xA;    # http://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way&#xA;    # ----------------------------------------------------------------------&#xA;    &#xA;        RewriteCond %{HTTP_HOST} !^www\. [NC]&#xA;        RewriteCond %{HTTP_HOST} ^mysite.org [NC]&#xA;        RewriteCond %{HTTPS}s ^on(s)|&#xA;        RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;    &#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="3721" LastActivityDate="2016-02-11T19:53:10.733" Title="Strange cached url prefix with caching" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13661" PostTypeId="2" ParentId="13628" CreationDate="2016-02-10T23:10:40.123" Score="4" Body="&lt;p&gt;Take a look into &lt;strong&gt;Entry Types&lt;/strong&gt;, I'm pretty sure that's a much better way to handle what you're trying to achieve:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/features/entry-types&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/features/entry-types&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you'd have a Structure section (let's call it &quot;Pages&quot;), and within that Structure you have multiple Entry Types. You could have a distinct Entry Type for each page type (&quot;About&quot;, &quot;Contact&quot;, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've got that, it's easy to serve up different templates for each Entry Type:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/entry-type-templates&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-10T23:10:40.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13662" PostTypeId="2" ParentId="12084" CreationDate="2016-02-11T01:51:19.163" Score="40" Body="&lt;p&gt;&lt;strong&gt;Updated&lt;/strong&gt; &lt;em&gt;05/03/16&lt;/em&gt;: I had a struggle getting this to work with &lt;a href=&quot;https://laravel.com/docs/5.2/homestead&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;Homestead 5.2&lt;/code&gt;&lt;/a&gt;. The MySQL error everyone else is seeing, &lt;s&gt;as well as &lt;code&gt;mcrypt&lt;/code&gt; error, as &lt;a href=&quot;https://laracasts.com/discuss/channels/general-discussion/homestead-3-and-mcrypt/replies/134924&quot; rel=&quot;noreferrer&quot;&gt;mycrypt is not installed by default&lt;/a&gt; in &lt;a href=&quot;https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.4.1&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;Vagrant box laravel/homestead 0.4.1&lt;/code&gt;&lt;/a&gt;&lt;/s&gt; (Fixed in &lt;a href=&quot;https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.4.2&quot; rel=&quot;noreferrer&quot;&gt;vagrant box laravel/homestead 0.4.2&lt;/a&gt; — See &lt;a href=&quot;https://craftcms.stackexchange.com/posts/13662/revisions&quot;&gt;answer history&lt;/a&gt; for &lt;code&gt;0.4.1&lt;/code&gt; how-to).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, steps to success:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;vagrant ssh&lt;/code&gt; into your box&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sudo vim /etc/mysql/my.cnf&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Scroll to the bottom of file and &lt;kbd&gt;A&lt;/kbd&gt; to enter insert mode&lt;/li&gt;&#xA;&lt;li&gt;Copy and paste &lt;code&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&lt;/code&gt; to the bottom of the file&lt;/li&gt;&#xA;&lt;li&gt;&lt;kbd&gt;esc&lt;/kbd&gt; to exit input mode&lt;/li&gt;&#xA;&lt;li&gt;&lt;kbd&gt;:wq&lt;/kbd&gt; to save and close vim.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sudo service mysql restart&lt;/code&gt; to restart MySQL.&lt;/li&gt;&#xA;&lt;li&gt;Done!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://medium.com/@cobbers/tweak-homestead-v0-3-3-to-work-with-craft-2-bfa66beb2460#.vb0iul4jq&quot; rel=&quot;noreferrer&quot;&gt;Original how-to article&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-05T20:27:25.133" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13663" PostTypeId="1" AcceptedAnswerId="13665" CreationDate="2016-02-11T09:37:41.650" Score="2" ViewCount="378" Body="&lt;p&gt;I have this loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('sermons').limit('10') as pageInfo, entries %}&#xA;&#xA;        {% for sermon in entries %}&#xA;        ...&#xA;        {{ loop.revindex }}&#xA;        ...&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That outputs a count from 10 to 1 - however, there's more entries than just the 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I output the count of what would be absolute total results?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="125" LastEditDate="2016-02-11T12:51:05.630" LastActivityDate="2016-02-11T12:51:05.630" Title="Reverse count with paginated entries?" Tags="&lt;pagination&gt;&lt;forloop&gt;&lt;count&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13664" PostTypeId="2" ParentId="13663" CreationDate="2016-02-11T10:22:46.677" Score="-1" Body="&lt;pre&gt;&lt;code&gt;{% set sermons = craft.entries.section('sermons').limit(null) %}&#xA;&#xA;{{ sermons|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default, the &lt;code&gt;.find()&lt;/code&gt; method, which is what gets called when you call &lt;code&gt;craft.entries&lt;/code&gt; automatically gets limited to 100. Get round that by using &lt;code&gt;.limit(null)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-02-11T10:22:46.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13665" PostTypeId="2" ParentId="13663" CreationDate="2016-02-11T10:33:24.180" Score="4" Body="&lt;p&gt;You already pass the array keys into the loop as a variable &lt;code&gt;pageInfo&lt;/code&gt;. There's a couple of properties you can access from it, see the Craft docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/paginate#the-pageInfo-variable&quot; rel=&quot;nofollow&quot;&gt;Templating Reference → &lt;code&gt;{% paginate %}&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of interest for you is probably these:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;pageInfo.total&lt;/code&gt; – The total number of elements across all pages&lt;br&gt;&#xA;  &lt;code&gt;pageInfo.currentPage&lt;/code&gt; – The current page number.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It looks like there's no property for the &quot;current element number&quot; and you need to do some math to output it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.limit(10) as pageInfo, pageEntries %}    &#xA;    {% for entry in pageEntries %}&#xA;&#xA;        {% set index = (pageInfo.currentPage - 1) * 10 + loop.index0 %}&#xA;&#xA;        {{ pageInfo.total - index }} of&#xA;        {{ pageInfo.total }}&#xA;&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-11T12:48:05.480" LastActivityDate="2016-02-11T12:48:05.480" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13666" PostTypeId="1" AcceptedAnswerId="13668" CreationDate="2016-02-11T11:23:59.550" Score="0" ViewCount="748" Body="&lt;p&gt;I'm trying to get the following behavior, but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user goes to &lt;a href=&quot;http://example.com/addresses&quot; rel=&quot;nofollow&quot;&gt;http://example.com/addresses&lt;/a&gt; he should get redirected to the Craft login form. So the corresponding template has a &lt;code&gt;{% requireLogin %}&lt;/code&gt; tag. After a successful login the user should be redirected to the page he was trying to access (in the case &lt;a href=&quot;http://example.com/addresses&quot; rel=&quot;nofollow&quot;&gt;http://example.com/addresses&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any additions to the config array the redirect goes to &lt;a href=&quot;http://example.com/login&quot; rel=&quot;nofollow&quot;&gt;http://example.com/login&lt;/a&gt; which is a 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add the loginPath setting to the config file and set it to 'admin/login' it redirects to the correct Craft login form, but after login it's not going to /addresses but /admin/addresses &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What settings would lead to the desired behavior?&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2016-02-11T11:59:39.280" Title="requireLogin not redirecting to login page" Tags="&lt;redirect&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13668" PostTypeId="2" ParentId="13666" CreationDate="2016-02-11T11:59:39.280" Score="2" Body="&lt;p&gt;You should create your /login template with a &lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;custom login form&lt;/a&gt;. If you do that, the redirect should work as expected:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft.session.returnUrl is set to the original URL that included the {% requireLogin %} tag that initiated the redirect to this login form.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-11T11:59:39.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13670" PostTypeId="2" ParentId="4281" CreationDate="2016-02-11T14:09:45.180" Score="4" Body="&lt;p&gt;I had a similar problem so created a plugin to add some of these extras to Redactor.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Redactor Extras for Craft&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&#xA;Available plugin are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Superscript and Subscript&lt;/li&gt;&#xA;&lt;li&gt;Word count&lt;/li&gt;&#xA;&lt;li&gt;Alignment&lt;/li&gt;&#xA;&lt;li&gt;Custom plugin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-02-11T14:09:45.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13671" PostTypeId="2" ParentId="129" CreationDate="2016-02-11T16:35:37.260" Score="17" Body="&lt;p&gt;Craft 2.5 &lt;a href=&quot;https://craftcms.com/changelog#2-5-2750&quot; rel=&quot;noreferrer&quot;&gt;introduced a new feature&lt;/a&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It’s now possible to find elements where a relational field does/doesn’t have any related elements, by passing &lt;code&gt;':notempty:'&lt;/code&gt; or &lt;code&gt;':empty:'&lt;/code&gt; onto the field’s ElementCriteriaModel parameter (e.g. &lt;code&gt;craft.entries.myEntriesField(':notempty:')&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in this case you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.myAssetField(':notempty:') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3951" LastEditDate="2017-10-05T12:30:01.750" LastActivityDate="2017-10-05T12:30:01.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13672" PostTypeId="2" ParentId="13660" CreationDate="2016-02-11T19:53:10.733" Score="1" Body="&lt;p&gt;A user on their local machine/intranet has a wildcard value setup to resolve to the servers IP address. Even though the DNS is configured to disregard any wildcard value, it seems as though a wildcard value is setup the point to the servers IP on a local/intranet machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What was happening was users mistyping the URL. With a typing of the URL &quot;www&quot;, the page was still resolving and becoming cached in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my local machine, I edited my host file to test this theory and it turned out to be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found that my rewrite conditions in the htaccess were messed. I've updated my htaccess rules as well (Arcustech server). Forces &quot;WWW&quot; over SSL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;RewriteEngine On&#xA;&#xA;    # If SSL request WITHOUT WWW&#xA;    RewriteCond %{ENV:SECURE_REDIRECT} on&#xA;    RewriteCond %{HTTP_HOST} !^www\..+$ [NC]&#xA;    RewriteCond %{HTTP_HOST} !^(local\..+|staging\..+|.+dev)$ [NC]&#xA;    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&#xA;    # If NOT SSL request WITHOUT WWW&#xA;    RewriteCond %{ENV:SECURE_REDIRECT} !=on&#xA;    RewriteCond %{HTTP_HOST} !^www\..+$ [NC]&#xA;    RewriteCond %{HTTP_HOST} !^(local\..+|staging\..+|.+dev)$ [NC]&#xA;    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&#xA;    # If NOT SSL request WITH WWW&#xA;    RewriteCond %{ENV:SECURE_REDIRECT} !=on&#xA;    RewriteCond %{HTTP_HOST} ^www\..+$ [NC]&#xA;    RewriteCond %{HTTP_HOST} !^(local\..+|staging\..+|.+dev)$ [NC]&#xA;    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="3721" LastActivityDate="2016-02-11T19:53:10.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13673" PostTypeId="2" ParentId="812" CreationDate="2016-02-11T20:31:24.360" Score="4" Body="&lt;p&gt;I realize this question was geared towards getting the entry via twig. Here is how you could accomplish the same from a plugin. In my case, I wanted to find an entry via slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAction() {&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'mySectionHandle';&#xA;    $criteria-&amp;gt;slug = $this-&amp;gt;_getLastSegment(craft()-&amp;gt;request-&amp;gt;getUrlReferrer());&#xA;    ...&#xA;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    if ($entries) {&#xA;        foreach ($criteria as $entry) {&#xA;            error_log($entry-&amp;gt;title);&#xA;        }&#xA;    } else {&#xA;        // No entry found that matches criteria.&#xA;    }&#xA;}&#xA;&#xA;private function _getLastSegment($url)&#xA;{&#xA;    $path = parse_url($url, PHP_URL_PATH);&#xA;    $trimmed = trim($path, '/');&#xA;    $tokens = explode('/', $trimmed);&#xA;&#xA;    return end($tokens);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-03-13T19:00:22.127" LastActivityDate="2016-03-13T19:00:22.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13674" PostTypeId="1" AcceptedAnswerId="13676" CreationDate="2016-02-12T10:50:22.817" Score="2" ViewCount="420" Body="&lt;p&gt;I'm looking for a way to have email subscribers database within Craft without using third-party solutions such as MailChimp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to let users enter their emails to subscribe to site categories / channels and then send custom notifications with Postmaster plugin. Pre-defined subscriptions lists will not work for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't have membership system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wonder if there's any way to have subscribers database within Craft? Some plugin that people could use to submit their email and area of interest to subscribe and also to unsubscribe?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-02-12T12:19:30.217" Title="Email subscriptions system" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13675" PostTypeId="1" AcceptedAnswerId="13692" CreationDate="2016-02-12T11:26:41.720" Score="2" ViewCount="383" Body="&lt;p&gt;I've started working with a marketing team for a well established online ecommerce store. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their site is a custom ecommerce CMS build (handled by another third party), which works well technically, but the marketing team have regularly expressed how difficult it is for them to create visually interesting and engaging pages within the site, as it's geared so much towards ecommerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the only options the marketing team have when adding new pages from the ecommerce CMS is a textarea (single column, bold, italic, links) and a single image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating the ecommerce CMS to give the marketing team greater flexibility is currently not an option (due to history and internal politics). This then led to the conversation of running 2 CMS's on the same domain - 1 for handling the ecommerce and 1 for the blog and product specific promotional landing pages. I showed them Craft, and they loved it!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Question(s)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First off, is running 2 CMS's on the same domain possible / advisable? (I remember hearing Joel Bradbury mention running EE and WP on the same domain at EEUK)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any obvious pitfalls or gotchas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming it would be simple enough to have Craft handle any blogs if set up on a blog URL (eg: domain.com/blogs/blog-post-name).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about specific landing pages (eg: domain.com/discount or domain.com/freestuff)? In theory could I create a route from the ecommerce CMS to point to the Craft generated page? Or should all marketing pages live in the same directory (eg: domain.com/marketing/discount or domain.com/marketing/freestuff)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I'd also like to be able to dynamically insert product data (prices, images, descriptions, etc) into the blog and landing pages created in Craft from the ecommerce site. I'm assuming hooking a Craft plugin up to the ecommerce API (if there is one) would be the best option to pull in the data? (Or would scraping be an option?) We would also need to mirror the ecommerce navigation on any Craft generated pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end goal is to give the marking team the freedom and flexibility to add interesting and engaging promotion pages, and have them look native and integrated into the main site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies, I know there's a lot of questions here. And some non-Craft specific, but I'm hoping this is a good place to start my investigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="45" LastEditDate="2016-08-13T03:01:39.603" LastActivityDate="2016-08-13T03:01:39.603" Title="Running Craft alongside another CMS on the same domain" Tags="&lt;server&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13676" PostTypeId="2" ParentId="13674" CreationDate="2016-02-12T12:19:30.217" Score="4" Body="&lt;p&gt;Sounds quite do-able. I will first admit I don't know how postmaster works at all, so I could be way off in my suggestion. Regardless, you're looking at two plugins working together; a contact form &amp;amp; postmaster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would start with the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;contact form plugin&lt;/a&gt;, but modify it a bit so that it captures the users's information. Depending on your needs, I would either have a checkbox so the user could select which section they wanted notifications for, or have a hidden field that is pre-populated with the current section - then just pass that through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have a visual representation of these records, you'll either want to look at creating entries for them, or just capture them within the plugin. I have an example of both to help get you rolling. DM me on the slack channel and I can send you my examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where I'm not sure how to help. Once you have the information, somehow you'll need to tell postmaster where those records are, loop through and send an email. I'm guessing at this point creating entires that represent subscribers would be easier for postmaster to understand?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-12T12:19:30.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13677" PostTypeId="1" AcceptedAnswerId="13679" CreationDate="2016-02-12T12:52:49.587" Score="2" ViewCount="167" Body="&lt;p&gt;I am a beginner when it comes to Craft and I have a hard time finding good detailed tutorials when it comes to specific questions. I know that Craft has it's own documentation but for me it's a little hard to find exactly what I want. So what I would like to know is how you can embed the header and the footer in every page with a simple tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that in Expression Engine all you had to do is was the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    &amp;lt;title&amp;gt;News Site&amp;lt;/title&amp;gt;&#xA;  &amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt;&#xA;    {layout:contents}&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And on any other page you could add this tag and you were done.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{layout=&quot;site/.html-layout&quot;}&#xA;&#xA;{exp:channel:entries channel=&quot;news&quot;}&#xA;  &amp;lt;h2&amp;gt;{title}&amp;lt;/h2&amp;gt;&#xA;  {summary}&#xA;{/exp:channel:entries}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I achieve the same thing in Craft? Thank you for your time and help :)&lt;/p&gt;&#xA;" OwnerUserId="4732" LastEditorUserId="22" LastEditDate="2017-05-09T22:27:01.010" LastActivityDate="2017-05-09T22:27:01.010" Title="Make use of wrapping layouts in Craft" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13678" PostTypeId="1" AcceptedAnswerId="13680" CreationDate="2016-02-12T13:10:38.133" Score="0" ViewCount="107" Body="&lt;p&gt;I have a client that wants to select &quot;featured&quot; entries to appear on their home page, and in a specific order that they can set and change. My initial idea was to set up a featured check box and just search for that, but I need to limit the possible number of total entries selected to 5.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entires come from multiple sections so I cannot just limit one section, and I need to limit how many they can select on the backend, not just how many appear in the view (that I can do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;right now the set up is with the featured checkbox, but the problem is they can just keep checking boxes and if they do not uncheck another one it will not have the expected behavior.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastActivityDate="2016-02-12T13:23:21.570" Title="How to limit selected items that appear on special page" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13679" PostTypeId="2" ParentId="13677" CreationDate="2016-02-12T13:18:12.867" Score="4" Body="&lt;p&gt;Craft's uses the Twig templating language. The official Twig documentation &lt;a href=&quot;http://twig.sensiolabs.org&quot;&gt;http://twig.sensiolabs.org&lt;/a&gt; is really good, highly recommended to read most of it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your specific problem have a look at the section about the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot;&gt;&lt;code&gt;extends&lt;/code&gt;&lt;/a&gt; tag. It explains how to define blocks and extend other template files. Another important technique is including partials into a template with the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot;&gt;&lt;code&gt;include&lt;/code&gt;&lt;/a&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a good and rather simple example I would recommend to read the source code of Pixel and Tonic's &lt;a href=&quot;https://github.com/pixelandtonic/ontherocks/blob/master/craft/templates/index.html&quot;&gt;On The Rocks&lt;/a&gt; Craft demo page.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-12T13:18:12.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13680" PostTypeId="2" ParentId="13678" CreationDate="2016-02-12T13:23:21.570" Score="2" Body="&lt;p&gt;Just add an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow&quot;&gt;Entries field&lt;/a&gt; to the home page Single and limit it to 5? That also allows designated users to decide what appears on the home page.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-02-12T13:23:21.570" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13681" PostTypeId="2" ParentId="13675" CreationDate="2016-02-12T16:12:49.063" Score="4" Body="&lt;p&gt;I've never had a problem running more than one application, but have always done so from within a sub-directory. e.g. domain.com/marketing/ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the most obvious impact with the above is that you're going to slightly penalise every URL because of the additional segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(A sub domain like &lt;strong&gt;marketing.domain.com&lt;/strong&gt; would also work)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding dynamic e-commerce content:&lt;/strong&gt;&#xA;I would suggest an XML feed with some kind of categorisation or tags, which you could make use of within Craft. &#xA;FeedMe might be useful for this: &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mirroring navigation might require manual updates. Be interesting to see what others think around that one.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-02-12T16:12:49.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13682" PostTypeId="1" AcceptedAnswerId="13683" CreationDate="2016-02-12T16:22:34.083" Score="3" ViewCount="2954" Body="&lt;p&gt;I'd really like some help with Craft CMS, that's probably a very basic thing to achieve, but I've so far got no idea how to. In another post about SEO, I saw something like this written:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta name=&quot;title&quot; content=&quot;{% if title is defined %}{{ title }}{% endif %}&quot;&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{% if description is defined %}{{ description }}{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first part, regarding the title, is in the _layout.html by default. And, in the CMS, above each entry's body, I have managed to display a box for the user to enter a title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT, were I to add the second part, regarding the description, I have so far been unable to find out how in the CMS, I can add a box for the user to enter a description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help that anyone can provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="4736" LastEditorUserId="45" LastEditDate="2016-08-13T02:56:22.653" LastActivityDate="2016-08-13T02:56:22.653" Title="How do I define an entry's META description?" Tags="&lt;templating&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13683" PostTypeId="2" ParentId="13682" CreationDate="2016-02-12T17:05:30.887" Score="5" Body="&lt;p&gt;The Title field will be a part of every entry 90% of the time ('Singles' don't need a Title).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add a custom field in Craft:&#xA;&lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Fields&lt;/strong&gt; &gt; (create a field)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add the new field to a content type:&#xA;&lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Sections&lt;/strong&gt; &gt; (click the &quot;Edit content-type&quot; link to the right) &gt; (drag your new field into the blue box) &gt; hit Save.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I like to create a separate custom field for each e.g. &quot;&lt;strong&gt;Meta Title&lt;/strong&gt;&quot; and &quot;&lt;strong&gt;Meta Description&lt;/strong&gt;&quot; - I then add these to a separate tab within a given &lt;strong&gt;content-type&lt;/strong&gt;. (see attached)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://imgur.com/Z5Fyhnw.jpg&quot; alt=&quot;SEO fields&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, I leave the SEO fields optional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in _layout.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{% block entryMetaTitle %}{% endblock %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{% block entryMetaDescription %}{% endblock %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The block tags inherit content from an individual template e.g. &lt;strong&gt;domain.com/news/news-article-slug&lt;/strong&gt;, will make use of a single-entry template e.g. &lt;strong&gt;craft/templates/news/_entry.html&lt;/strong&gt; which will contain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_layout&quot; %}&#xA;&#xA;{% block entryMetaTitle %}{% if entry.metaTitle %}{{ entry.metaTitle}} | {% elseif entry.title %}{{ entry.title}} | {% endif %} News | {% endblock %}&#xA;{% block entryMetaDescription %}{% if entry.metaDescription %}{{ entry.metaDescription}}{% else %}{{entry.summaryText}}{% endif %}{% endblock %}&#xA;&#xA;{% block content %}&#xA;... &#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will display any content which the client decides to add to the custom fields, OR if nothing has been added the template will display the entry &lt;strong&gt;Title&lt;/strong&gt; + &lt;strong&gt;Summary Text&lt;/strong&gt; (in this case)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This post might also help you to define your own approach: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2986/how-do-you-handle-seo-on-your-site&quot;&gt;How do you handle SEO on your site?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-12T17:05:30.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13684" PostTypeId="2" ParentId="13620" CreationDate="2016-02-12T20:08:35.737" Score="3" Body="&lt;p&gt;I was going out of my mind trying to work this out. &lt;a href=&quot;https://craftcms.stackexchange.com/users/4118/william-isted&quot;&gt;William Isted&lt;/a&gt; spotted that Craft is using &lt;code&gt;col1&lt;/code&gt; as the fieldname in the table on the edit entry page. (You can see this in the inspector).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is from &lt;code&gt;/admin/entries/rsvps/92-test&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;fields[guests][0][col1]&quot; rows=&quot;1&quot; style=&quot;min-height: 46px;&quot;&amp;gt;Ian&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I switch my forms &lt;code&gt;column1Handle&lt;/code&gt; to &lt;code&gt;col1&lt;/code&gt; it saves the entry and shows the data in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see from the database it &lt;strong&gt;was&lt;/strong&gt; saving previous data under the &lt;code&gt;column1Handle&lt;/code&gt; (e.g. &lt;code&gt;name&lt;/code&gt;), however Craft wasn't using that handle to retrieve the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess the tables on the entry pages are either looking for the wrong fieldnames, or the example code is wrong, and should read:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col1]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col2]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[fieldHandle][0][col3]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps save someone else the same headache I've just gone through.&lt;/p&gt;&#xA;" OwnerUserId="475" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-02-12T20:08:35.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13686" PostTypeId="1" AcceptedAnswerId="13688" CreationDate="2016-02-12T23:42:56.677" Score="1" ViewCount="108" Body="&lt;p&gt;I'm struggling to get my head around relations. It seems overly complex for the simple thing I want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using an entry field on my post to set relations by city. These entries are limited to a structure that has a list of cities. I am outputting a global variable that is the current location (city).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the following code, I am able to get any posts from the current city.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(&quot;news&quot;).relatedTo(currentCityFilter).order(&quot;featured desc&quot;).limit(10) as pageInfo, pagePosts %}&#xA;&#xA;{% for post in pagePosts %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;{{ post.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;Posted on {{ post.postDate.format(&quot;F d, Y&quot;) }}&amp;lt;/p&amp;gt;&#xA;        {{ post.body.getPage(1) }}&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, I don't want to force the user to set every city when they wish to have a post display for every location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the proper way to show any posts that don't have a city set and still filter posts that do have a city by the current city?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar question with no answer here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12391/get-entries-where-relation-matches-or-is-empty&quot;&gt;Get entries where relation matches or is empty&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4739" LastEditorUserId="4739" LastEditDate="2016-02-12T23:48:48.507" LastActivityDate="2016-02-13T01:41:45.923" Title="Show posts related to entry AND all posts not related to any entry" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13687" PostTypeId="1" AcceptedAnswerId="13710" CreationDate="2016-02-13T01:06:05.043" Score="0" ViewCount="650" Body="&lt;p&gt;I am getting a foreign key constraint sql error when trying to add an entry through a front end form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;  &amp;lt;select name=&quot;fields[vendor][]&quot;&amp;gt;&#xA;    {% for v in craft.entries.section('vendors') %}&#xA;      &amp;lt;option value=&quot;v.id&quot;&amp;gt;{{v.title}}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vendor&lt;/code&gt; is an Entries fieldtype, for unlimited entries from the &lt;code&gt;vendors&lt;/code&gt; channel. Very similar code for adding a category works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error (complete with back-ticks):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (&lt;code&gt;metro&lt;/code&gt;.&lt;code&gt;craft_relations&lt;/code&gt;, CONSTRAINT &lt;code&gt;craft_relations_targetId_fk&lt;/code&gt; FOREIGN KEY (&lt;code&gt;targetId&lt;/code&gt;) REFERENCES &lt;code&gt;craft_elements&lt;/code&gt; (&lt;code&gt;id&lt;/code&gt;) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO &lt;code&gt;craft_relations&lt;/code&gt; (&lt;code&gt;fieldId&lt;/code&gt;, &lt;code&gt;sourceId&lt;/code&gt;, &lt;code&gt;sourceLocale&lt;/code&gt;, &lt;code&gt;targetId&lt;/code&gt;, &lt;code&gt;sortOrder&lt;/code&gt;, &lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;dateUpdated&lt;/code&gt;, &lt;code&gt;uid&lt;/code&gt;) VALUES (:row0_col0, :row0_col1, NULL, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7). Bound with :row0_col0='13', :row0_col1='39', :row0_col3='v.id', :row0_col4=1, :row0_col5='2016-02-13 08:28:03', :row0_col6='2016-02-13 08:28:03', :row0_col7='e455a06e-8f9d-4299-ad57-93577907f9a0' &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2016-02-13T08:30:12.953" LastActivityDate="2016-02-16T03:06:51.610" Title="Foreign key constraint sql error from entries/saveEntry when adding entry" Tags="&lt;form&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13688" PostTypeId="2" ParentId="13686" CreationDate="2016-02-13T01:41:45.923" Score="2" Body="&lt;p&gt;Building on &lt;a href=&quot;https://craftcms.stackexchange.com/a/646/130&quot;&gt;this answer&lt;/a&gt;, and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1948/complex-logic-on-a-elementcriteriamodel-parameter/4575#4575&quot;&gt;this question&lt;/a&gt;, here is what I would try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get the posts from the current city:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentCityPostIds = craft.entries.section('news').relatedTo(currentCityFilter).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get the posts with no &lt;code&gt;city&lt;/code&gt; (uses &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;search&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set noCityPostIds = craft.entries.section('news').search('-city:*').ids %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make one list of all the ids (twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge filter&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set postIds = currentCityPostIds|merge(noCityPostIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get all the posts with those ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set postsToPaginate = craft.entries.id(postIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can paginate them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate postsToPaginate.order(&quot;featured desc&quot;).limit(10) as pageInfo, pagePosts %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-13T01:41:45.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13689" PostTypeId="2" ParentId="13653" CreationDate="2016-02-13T06:54:15.567" Score="4" Body="&lt;p&gt;You're very close!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;myFieldHandle = array(&#xA;    'target' =&amp;gt; 90210,&#xA;    'range' =&amp;gt; 100&#xA;);&#xA;$criteria-&amp;gt;order = 'distance';&#xA;&#xA;$results = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've never actually tested it with the Element API plugin, but in theory it should work just fine.&lt;/p&gt;&#xA;&lt;p&gt;In response to this question, I've added &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/sorting-entries-by-closest-locations/#php-in-a-separate-plugin-or-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;instructions for PHP&lt;/a&gt; to the docs.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:34:27.707" LastActivityDate="2021-01-01T06:34:27.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13690" PostTypeId="1" AcceptedAnswerId="13691" CreationDate="2016-02-13T18:08:39.307" Score="2" ViewCount="92" Body="&lt;p&gt;I have a plugin with the structure something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;variables&#xA; - PluginVariable.php&#xA; - PluginAnotherVariable.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside &lt;code&gt;PluginVariable.php&lt;/code&gt; I have something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginVariable&#xA;{&#xA;   public function foo($parameter)&#xA;   {&#xA;       $result = craft()-&amp;gt;plugin_results-&amp;gt;get($parameter);&#xA;        return new PluginAnotherVariable($result);&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I do &lt;code&gt;{{ craft.plugin.foo('something') }}&lt;/code&gt; I just get &lt;code&gt;Fatal error: Class 'Craft\PluginAnotherVariable' not found&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked that the filenames and classnames are identical and the namespacing etc so the class most certainly exists but I can't get this to work, has anyone had a similar issue with this and what could be causing it? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="57" LastEditDate="2016-02-13T23:42:53.777" LastActivityDate="2016-02-13T23:42:53.777" Title="How do you return an instance of a variable class from within a different variable class?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13691" PostTypeId="2" ParentId="13690" CreationDate="2016-02-13T18:14:25.800" Score="3" Body="&lt;p&gt;Boom!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I just needed to put an underscore between the plugin handle and variable name so &lt;code&gt;PluginAnotherVariable.php&lt;/code&gt; becomes &lt;code&gt;Plugin_AnotherVariable.php&lt;/code&gt; and the classname &lt;code&gt;Plugin_AnotherVariable&lt;/code&gt; and things are now working :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-02-13T18:14:25.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13692" PostTypeId="2" ParentId="13675" CreationDate="2016-02-13T23:30:10.000" Score="5" Body="&lt;p&gt;You're asking a loaded question. I don't think there's a wrong answer here but if it were me, you have a couple options.&lt;/p&gt;&#xA;&lt;h1&gt;Addressing the Elephant in the Room&lt;/h1&gt;&#xA;&lt;p&gt;How good of a salesman are you? ;) You mention the e-commerce CMS isn't getting the job done but replacing it is off the table. I've gone down this road before.  Since you've got your team interested in Craft, why not consider &lt;a href=&quot;https://craftcommerce.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce&lt;/a&gt; too? I know what you're thinking. It's a tough sell. But then again, so is integrating 2 CMS and making sure things don't break between them. What happens if that 3rd party CMS vendor doesn't &amp;quot;approve&amp;quot; of what you're doing and cuts support?  Not saying it'll happen but like you mentioned... politics has a way of messing with people.&lt;/p&gt;&#xA;&lt;p&gt;I don't know how much business logic that the current e-commerce solution has that you'd have to replicate or how many products and variations you're dealing with but if anything is up for the challenge, it's Craft and Craft Commerce. Just demoing the seamless integration between the two might be enough for the sales/marketing team. Time is money for them.&lt;/p&gt;&#xA;&lt;p&gt;If you can't go with Craft Commerce, it really depends on what the other software does and how you integrate the two.&lt;/p&gt;&#xA;&lt;h1&gt;Integrating the Two&lt;/h1&gt;&#xA;&lt;p&gt;I'm assuming both CMS will live on the same physical server? Indeed, Craft could  play alongside the other CMS. That's the easiest option. If it were me, I'd probably setup all new marketing pages within Craft and then link to the actual ordering pages in 3rd party CMS.&lt;/p&gt;&#xA;&lt;p&gt;By default, most CMS including Craft are going to suck up any request that isn't a static file, query the database, and then return the &amp;quot;virtual&amp;quot; page from the database. The actual page doesn't really exist on the server, so Craft looks for &amp;quot;would-be&amp;quot; 404s. That's basically what the rewrite rules in a .htaccess file does—it tells Apache to send any 404 back to the application (usually index.php).&lt;/p&gt;&#xA;&lt;p&gt;Why is this important? If you have any flexibility with the 3rd party CMS, I'd &amp;quot;quarantine&amp;quot; it to a folder on the server, like &lt;code&gt;/store/&lt;/code&gt; so any request within that folder (like &lt;code&gt;/store/black-leather-jacket/&lt;/code&gt;) would go to the commerce CMS (assuming the CMS is sane and doesn't do something stupid like have absolute URLs).&lt;/p&gt;&#xA;&lt;p&gt;Craft would handle everything else. You could quarantine &amp;quot;Craft&amp;quot; to a folder, but like you mentioned, any page you create would have a URL like &lt;code&gt;/marketing/black-leather-jacket/demo/&lt;/code&gt; or whatever you decide. That's sub-optimal in my opinion. As far as SEO and flexibility go, you probably want people to hit your marketing/landing pages first. People won't buy if they don't have info.&lt;/p&gt;&#xA;&lt;p&gt;(And it's probably easier to do a 301 redirect to the already existing pages... you could setup Craft so that if it can't find a file, have it take a look if the page exists in the other CMS and redirect if it does.)&lt;/p&gt;&#xA;&lt;h1&gt;Tapping into the Data&lt;/h1&gt;&#xA;&lt;p&gt;Assuming the e-commerce database design/schema is easy to tap into, I'd write a Craft plugin to grab product data directly from the database, based on whatever parameters you need to feed a Twig template. That's beyond the scope of this question but the dev is relatively straightforward.&lt;/p&gt;&#xA;&lt;p&gt;Craft is built on &lt;a href=&quot;http://www.yiiframework.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt;, an excellent PHP framework so whatever Yii can do Craft can do as well. Craft also ships with Guzzle which would make it easy to &amp;quot;scrape&amp;quot; the actual page or as &lt;a href=&quot;https://craftcms.stackexchange.com/a/13681/1016&quot;&gt;Matt P mentions&lt;/a&gt; building or tapping into some sort of bridge between the 2 systems.&lt;/p&gt;&#xA;&lt;p&gt;Speaking of scraping, if the 3rd party e-commmerce solution is a hosted solution, then you might have to set that one up on another domain and let Craft handle the marketing pages. In this case, you might consider something like &lt;code&gt;store.domain.com&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Again, all comes down to what the other e-commerce solution does. Craft is relatively flexible any way you slice it.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-02-13T23:48:33.873" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13693" PostTypeId="1" AcceptedAnswerId="14362" CreationDate="2016-02-14T00:13:44.750" Score="2" ViewCount="71" Body="&lt;p&gt;Pretty straightforward problem...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;On the dashboard, I click &quot;New Widget&quot;.&lt;/li&gt;&#xA;&lt;li&gt;I select &quot;My Custom Widget&quot; type.&lt;/li&gt;&#xA;&lt;li&gt;A new instance of &quot;My Custom Widget&quot; appears on the dashboard, ready to be edited.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can my widget be self-aware that it has just been created?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the widget to perform some very minor JS when it initially loads. Is there an existing JS event which would be triggered in this scenario?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-29T00:51:36.627" Title="Is there a JS event triggered when a new widget is created?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;javascript&gt;&lt;dashboard-widgets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13694" PostTypeId="1" CreationDate="2016-02-14T00:56:51.387" Score="1" ViewCount="322" Body="&lt;p&gt;New to Craft. I'm outputting a list of all the categories in my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;cat-list&quot;&amp;gt;&#xA;    {% nav category in craft.categories %}&#xA;      &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I end up with (for example):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Legumes&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peas&lt;/li&gt;&#xA;&lt;li&gt;Beans&lt;/li&gt;&#xA;&lt;li&gt;Lentils&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Meat&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ground Beef&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Fruit&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peach&lt;/li&gt;&#xA;&lt;li&gt;Banana&lt;/li&gt;&#xA;&lt;li&gt;Strawberry&lt;/li&gt;&#xA;&lt;li&gt;Grapes&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd like those to be alphabetical, though, so Fruit, Legumes, and Meat, are listed in that order, with their children also listed in alphabetical order in the nested list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I do THIS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;cat-list&quot;&amp;gt;&#xA;    {% nav category in craft.categories.order('title') %}&#xA;      &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire list gets flattened, alphabetized, and then spit back out into a nonsensical hierarchy, like so:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Beans&lt;/li&gt;&#xA;&lt;li&gt;Banana&lt;/li&gt;&#xA;&lt;li&gt;Fruit&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Grapes&lt;/li&gt;&#xA;&lt;li&gt;Ground Beef&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Lentils&lt;/li&gt;&#xA;&lt;li&gt;Meat&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peas&lt;/li&gt;&#xA;&lt;li&gt;Peach&lt;/li&gt;&#xA;&lt;li&gt;Strawberry&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there any way to alphabetize by one level at a time, without completely reinventing the way Craft handles categories? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4742" LastEditorUserId="22" LastEditDate="2017-05-09T22:26:09.853" LastActivityDate="2017-05-09T22:26:09.853" Title="How do I sort categories by title while preserving hierarchy?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13695" PostTypeId="2" ParentId="13694" CreationDate="2016-02-14T06:41:32.473" Score="3" Body="&lt;p&gt;You should be able to do this with a recursive &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;macro&lt;/a&gt;.&#xA;Here is a macro &lt;code&gt;alphaList&lt;/code&gt; which is passed a list of categories (in alphabetic order). For each category, it outputs that category, and then if that category has any children, it calls itself on an alphabetic list of those children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the children of a category &lt;code&gt;c&lt;/code&gt;, you combine &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#descendantOf&quot; rel=&quot;nofollow&quot;&gt;descendantOf&lt;/a&gt; with &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#descendantDist&quot; rel=&quot;nofollow&quot;&gt;descendantDist&lt;/a&gt; of &lt;code&gt;1&lt;/code&gt;: &lt;code&gt;craft.categories.descendantOf(c).descendantDist(1)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the initial list of top level categories, you use the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#level&quot; rel=&quot;nofollow&quot;&gt;level&lt;/a&gt; parameter: &lt;code&gt;craft.categories.level(1)&lt;/code&gt;. That will mix together categories from all your category groups, so probably you want to specify the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#group&quot; rel=&quot;nofollow&quot;&gt;group&lt;/a&gt;: &lt;code&gt;craft.categories.group('myGroup').level(1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import _self as self %}&#xA;&#xA;{% macro alphaList(cats) %}&#xA;{% import _self as self %}&#xA;  {% for c in cats %}&#xA;    &amp;lt;li&amp;gt;&#xA;      {{c.link}}&#xA;      {% set children = craft.categories.descendantOf(c).descendantDist(1) %}&#xA;      {% if children|length %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {{ self.alphaList(children.order('title')) }}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{% set topCats - craft.categories.level(1) %}&#xA;&amp;lt;ul&amp;gt;&#xA;  {{ self.alphaList(topCats.order('title')) }}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-02-14T06:41:32.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13696" PostTypeId="1" CreationDate="2016-02-14T18:40:49.740" Score="2" ViewCount="2286" Body="&lt;p&gt;Can Craft be used with conjunction with other framework (Laravel) or its a standalone solution?&lt;/p&gt;&#xA;" OwnerUserId="4744" LastEditorUserId="22" LastEditDate="2017-05-09T22:25:40.837" LastActivityDate="2017-05-09T22:25:40.837" Title="Can Craft be used with conjunction with other framework (Laravel)?" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2016-02-22T21:44:12.873" ContentLicense="CC BY-SA 3.0" />
  <row Id="13697" PostTypeId="2" ParentId="13696" CreationDate="2016-02-14T19:02:03.783" Score="6" Body="&lt;p&gt;&lt;strong&gt;Craft is frequently used in conjunction with other applications/frameworks. &lt;em&gt;How&lt;/em&gt; one would use Craft in coordination with a Laravel application, and whether that would be a good idea, depends on the specific use case.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most frequently, Craft is used to serve a content &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot;&gt;API&lt;/a&gt; that other applications can consume. Additionally, it's common to se Laravel apps used &lt;a href=&quot;http://zaengle.com/blog/laravel-as-an-intermediary&quot;&gt;as an intermediary&lt;/a&gt; to broker integrations between the CMS and external services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, there's no specific technical limitation that would prevent Craft and Laravel from being used in conjunction with each other.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-02-14T19:02:03.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13698" PostTypeId="2" ParentId="13485" CreationDate="2016-02-14T19:41:05.717" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/models/ContentModel&quot;&gt;&lt;code&gt;setContentFromPost()&lt;/code&gt;&lt;/a&gt; performs an operation on the attached &lt;em&gt;&lt;a href=&quot;https://craftcms.com/classreference/models/ContentModel&quot;&gt;ContentModel&lt;/a&gt;&lt;/em&gt;, not on the element model itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you initialize a &lt;em&gt;BaseElementModel&lt;/em&gt;, its content attributes are set &lt;em&gt;from&lt;/em&gt; the associated &lt;em&gt;ContentModel&lt;/em&gt;. (&quot;Content attributes&quot; means attributes from custom field data, a.k.a. the stuff you'll typically find in the &lt;code&gt;craft_content&lt;/code&gt; DB table for a given element instance.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, later updating the properties of the content model does not immediately ripple into changing the attributes of the element model: You'll need to re-save the element after you do a &lt;code&gt;setContentFromPost()&lt;/code&gt;, and &lt;em&gt;then&lt;/em&gt; its magic attributes will reflect your newly set values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you &lt;code&gt;setContentFromPost()&lt;/code&gt;, you're changing the data that will ultimately gets passed into each FieldType's &lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel#getContentFromPost-detail&quot;&gt;&lt;code&gt;prepValueFromPost()&lt;/code&gt;&lt;/a&gt; method. If you need to do additional processing later (after each FieldType has done its thing) &amp;mdash; such as saving records in an third-party table during &lt;code&gt;onAfterElementSave&lt;/code&gt; &amp;mdash; your service can use &lt;code&gt;getContent()&lt;/code&gt; to or &lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel#getContentFromPost-detail&quot;&gt;&lt;code&gt;getContentFromPost()&lt;/code&gt;&lt;/a&gt; to grab the values it needs, depending on whether you want to access the raw POST data the user submitted, or the values that got returned from each FieldType's &lt;code&gt;prepValue()&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-02-14T19:41:05.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13699" PostTypeId="2" ParentId="13371" CreationDate="2016-02-14T20:37:27.553" Score="1" Body="&lt;p&gt;Your plugin has to create those routes &amp;mdash; via &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;registerCpRoutes()&lt;/code&gt;&lt;/a&gt; &amp;mdash; to match your desired URL structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes either trigger a site template or a controller, as described in the &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing&lt;/a&gt; docs. &lt;em&gt;(Craft's own internal convention is for CP routes to trigger a controller method, which sets up the request and renders your desired template.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at Craft's own CP routes for inspiration in setting up your own; they're defined in &lt;code&gt;/app/etc/config/common.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-02-14T20:37:27.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13700" PostTypeId="1" CreationDate="2016-02-14T22:16:57.253" Score="2" ViewCount="13975" Body="&lt;p&gt;** &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After continuing to play around with this I realized that I did not need to add nl2br, adding hacksaw was actually removing the formatting from the rich text field.  I opened a new question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13702/hacksaw-breaking-rich-text-field&quot;&gt;here&#xA;&lt;/a&gt; if anyone can help or has encountered this issue any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;p&amp;gt;{{ workItem.summary | hacksaw(words='75', append='...') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to add &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; nl2br&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to it.  I have tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;p&amp;gt;{{ workItem.summary | nl2br | hacksaw(words='75', append='...') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;p&amp;gt;{{ nl2br (workItem.summary hacksaw(words='75', append='...')) }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Neither worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed some light on the syntax I need to get this to work correctly?&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-02-15T14:22:29.717" Title="How to apply multiple Twig filters to text - SOLVED" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13701" PostTypeId="2" ParentId="13700" CreationDate="2016-02-15T08:01:17.827" Score="5" Body="&lt;p&gt;I believe filters are applied in the order they're written. So in your example you're probably applying the new line breaks with &lt;code&gt;nl2br&lt;/code&gt; and then removing them again with hacksaw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ workItem.summary | hacksaw(words='75', append='...') | nl2br }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could try setting hacksaw to allow line break tags. Something like this (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ workItem.summary | nl2br | hacksaw(words='75', append='...', allow='&amp;lt;br&amp;gt;') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd go with the first option though.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-02-15T08:01:17.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13702" PostTypeId="1" AcceptedAnswerId="13704" CreationDate="2016-02-15T14:22:06.640" Score="2" ViewCount="169" Body="&lt;p&gt;When I use the &lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw&quot; rel=&quot;nofollow&quot;&gt;hacksaw&lt;/a&gt; to truncate the formatting goes away.  If I remove hacksaw it comes back.  So, my question has changed, is there a way for me to truncate the text while keeping the formatting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The return on the line below is from a rich text field and it will not show formatting unless I remove hacksaw.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {{ workItem.summary | hacksaw(words='75', append='...') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-02-15T16:56:17.470" LastActivityDate="2016-02-15T16:56:17.470" Title="Hacksaw plugin breaking rich text field" Tags="&lt;plugins&gt;&lt;plugin-hacksaw&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13703" PostTypeId="2" ParentId="10520" CreationDate="2016-02-15T16:10:55.217" Score="4" Body="&lt;p&gt;Would you consider an alternative &lt;strong&gt;Matrix&lt;/strong&gt; based approach where one rich text field was used for &lt;strong&gt;article-copy&lt;/strong&gt; and another separate rich text field, used for the &lt;strong&gt;blockquote&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: Matrix field: &quot;Article blocks&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Block 1: &quot;Article&quot;&lt;/li&gt;&#xA;&lt;li&gt;Block 2: &quot;Quote&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;e.g. (screen shot from a current project...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://imgur.com/4Qn524e.jpg&quot; alt=&quot;matrix block buttons&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you could leverage Matrix functionality and allow more layout control as well - such as alignment etc - to the blockqoutes, and maintain your paragraphs as well.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-02-15T16:10:55.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13704" PostTypeId="2" ParentId="13702" CreationDate="2016-02-15T16:12:16.413" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw&quot;&gt;Hacksaw&lt;/a&gt; has an &lt;code&gt;allow&lt;/code&gt; parameter where you specify which HTML tags you want it to pass through. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ workItem.summary | hacksaw(words='75', append='...', allow='&amp;lt;strong&amp;gt;&amp;lt;em&amp;gt;&amp;lt;br&amp;gt;&amp;lt;p&amp;gt;') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That allows &lt;code&gt;p&lt;/code&gt;, &lt;code&gt;br&lt;/code&gt;, &lt;code&gt;strong&lt;/code&gt;, and &lt;code&gt;em&lt;/code&gt; tags to pass through untouched. If you need to allow others, just add 'em to the list.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-15T16:12:16.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13705" PostTypeId="1" AcceptedAnswerId="13706" CreationDate="2016-02-15T19:51:23.207" Score="1" ViewCount="703" Body="&lt;p&gt;I am missing something very obvious I think. I am trying to get all child categories based on url segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &quot;mysite.com/foo&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a category Group called &lt;code&gt;Sections&lt;/code&gt; Within &lt;code&gt;Sections&lt;/code&gt; I have a category called &lt;code&gt;Foo&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sections  &amp;lt;-- Category Group&#xA;    |- Foo&#xA;        |- One&#xA;        |- Two&#xA;        |- Three&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this url as an example: &lt;code&gt;www.mysite.com/foo&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryGroup = craft.categories.group('Sections').level(1).slug(craft.request.getSegment(1)).first() %}&#xA;{% set categories = craft.categories.ancestorOf(categoryGroup) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing this: &lt;code&gt;&amp;lt;p&amp;gt;Group: {{ categoryGroup }}&amp;lt;/p&amp;gt;&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Renders this: &lt;code&gt;Group: Foo&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if categories|length %}&#xA;    {% for cat in categories %}&#xA;        {{ cat.title }}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    NOTHING&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am always getting back my &lt;code&gt;NOTHING&lt;/code&gt; statement. When I navigate to &lt;code&gt;mysite.com/foo&lt;/code&gt;, I would like to show &lt;code&gt;One Two Three&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-15T20:18:08.060" Title="How can I get all child categories - of a child category based on url segment?" Tags="&lt;categories&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13706" PostTypeId="2" ParentId="13705" CreationDate="2016-02-15T20:18:08.060" Score="2" Body="&lt;p&gt;There are a couple of things I would do differently here. The first is to check the &lt;strong&gt;Categories in this group have their own URLs&lt;/strong&gt; box in the Category Group settings. Set the url to &lt;code&gt;{slug}&lt;/code&gt;, and you will have &lt;code&gt;category&lt;/code&gt; defined in the template without needing:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;{% set categoryGroup = craft.categories.group('Sections')&#xA;  .level(1)&#xA;  .slug(craft.request.getSegment(1))&#xA;  .first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The second problem is that once you have your &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;category&lt;/a&gt;, what you want are the &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel#getChildren&quot; rel=&quot;nofollow&quot;&gt;children&lt;/a&gt;, not the &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel#getAncestors&quot; rel=&quot;nofollow&quot;&gt;ancestors&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theChildren = category.children %}&#xA;&#xA;{% if theChildren|length %}&#xA;  {% for cat in theChildren %}&#xA;    {{ cat.title }}&#xA;  {% endfor %}&#xA;{% else %}&#xA;  NOTHING&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-02-15T20:18:08.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13707" PostTypeId="1" AcceptedAnswerId="13723" CreationDate="2016-02-16T00:39:38.810" Score="6" ViewCount="13855" Body="&lt;p&gt;Using Twig, is it possible to strip out or replace a non-breaking space (&lt;code&gt;&amp;amp;nbsp;&lt;/code&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a string variable &lt;code&gt;price&lt;/code&gt; (returned from the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#currency&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;currency&lt;/code&gt;&lt;/a&gt; filter) that prints like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Nkr&amp;amp;nbsp;100,00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'd like, is to strip the &lt;code&gt;Nkr&amp;amp;nbsp;&lt;/code&gt; part, so the string looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;100,00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, &lt;code&gt;{{ price|replace('Nkr&amp;amp;nbsp;', '') }}&lt;/code&gt; does nothing, as the &lt;code&gt;replace&lt;/code&gt; filter doesn't appear to actually match the non-breaking space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ price|replace({'Nkr' : ''}) }}&lt;/code&gt; strips out the &lt;code&gt;Nkr&lt;/code&gt; part, but leaves the &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt;; and I'm unable to remove it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I tried already (after stripping the &lt;code&gt;Nkr&lt;/code&gt; part):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ price|replace({'&amp;amp;nbsp;' : ''}) }}&#xA;{{ price|raw|replace({'&amp;amp;nbsp;' : ''}) }}&#xA;{{ price|striptags }}&#xA;{{ price|raw|striptags }}&#xA;{{ price|trim }}&#xA;{{ price|raw|trim }}&#xA;{{ price|replace({ '\u00a0' : '' }) }}&#xA;{{- price -}} &#xA;{% spaceless %}{{ price }}{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-16T14:17:19.357" LastActivityDate="2019-12-11T12:52:51.143" Title="How can I strip or replace a non-breaking space with Twig?" Tags="&lt;templating&gt;&lt;currency&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13708" PostTypeId="2" ParentId="13707" CreationDate="2016-02-16T00:52:30.493" Score="5" Body="&lt;p&gt;Here's a different spin... Try removing everything that's &lt;strong&gt;not numeric or comma&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ price|replace('/[^0-9,]/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-16T00:52:30.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13709" PostTypeId="1" AcceptedAnswerId="13711" CreationDate="2016-02-16T01:15:46.667" Score="5" ViewCount="561" Body="&lt;p&gt;So I have a checkbox field in the new entry editor page. Attached image is an example of said checkbox. Just a standard checkbox field.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VkyXn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VkyXn.png&quot; alt=&quot;Just a regular checkbox field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for these checkboxes to be translatable? I'm redisplaying these checkboxes again in the front-end as filters so users can click the any of the checkboxes and the entries display will be filtered based on their input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short of hardcoding all these checkbox values and applying the translate tag on them, I'm not sure what else I can do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3567" LastActivityDate="2017-04-16T10:14:08.633" Title="Is there a way to have checkbox field labels translatable?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13710" PostTypeId="2" ParentId="13687" CreationDate="2016-02-16T03:06:51.610" Score="1" Body="&lt;p&gt;I think the problem is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;v.id&quot;&amp;gt;{{v.title}}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try changing it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;{{ v.id }}&quot;&amp;gt;{{v.title}}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-16T03:06:51.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13711" PostTypeId="2" ParentId="13709" CreationDate="2016-02-16T10:11:38.020" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Short of hardcoding all these checkbox values and applying the translate tag on them&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's actually the only way to translate field names, checkbox labels/values and whatnot: taking advantage of Craft's &lt;a href=&quot;https://craftcms.com/support/static-translations&quot;&gt;static text translation&lt;/a&gt; feature by hard coding the strings you want to translate in a translations file (e.g. &lt;code&gt;/translations/en.php&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example: If one of your &lt;code&gt;whiskey&lt;/code&gt; field's option labels is &lt;strong&gt;&quot;Irish&quot;&lt;/strong&gt;, but you want it to be &lt;strong&gt;&quot;Welsh&quot;&lt;/strong&gt; for a certain locale, you can add the following to the returned array in that locale's translation file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'Irish' =&amp;gt; 'Welsh',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, it's also possible to translate the field name itself, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'Whiskey' =&amp;gt; 'Whisky',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's a big problem though – Craft's static text translation has no idea about context, meaning that it's not possible to tell Craft that the above translations belong to the &lt;code&gt;whiskey&lt;/code&gt; field only. In other words, both &lt;code&gt;Whiskey&lt;/code&gt; and &lt;code&gt;Irish&lt;/code&gt; will be translated &lt;em&gt;across the board&lt;/em&gt;. Sometimes that's what you'd want, but often it's not – a translated value may work in one place, but not in another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to solve this, is to use &lt;em&gt;namespacing&lt;/em&gt; for all the static strings you want to translate. The naming convention is entirely up to you, but here's how I do it for fields – the following two values are used for the field's name and instructions, respectively:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field.whiskey.name&#xA;field.whiskey.instructions&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this namespacing pattern, the first part is the type of content this string belongs to (a field), the second part is the field's handle (which is obviously &lt;em&gt;never&lt;/em&gt; translated) and the last part is what the string actually &lt;em&gt;is&lt;/em&gt; (the name and the instructions, respectively). This works for other types of content as well, consider &lt;code&gt;section.news.name&lt;/code&gt;, &lt;code&gt;entryType.link.name&lt;/code&gt;, &lt;code&gt;categoryGroup.editors.name&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;nested&quot; properties, such as a checkbox option's label, I usually write them out like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field.whiskey.option.irish.label&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Matrix blocks, the namespacing scheme admittedly is a little bit ridiculous:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field.someMatrixField.block.bio.name&#xA;field.someMatrixField.block.bio.text.name&#xA;field.someMatrixField.block.bio.text.instructions&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The big downside to namespacing field names, option labels, section names etc. is that you have to add a translation for &lt;em&gt;all&lt;/em&gt; locales (even your &quot;default&quot; locale), in order to not have the namespaced, &quot;raw&quot; value displayed to your users. In other words, it's definitely a bit more work than just translating plain ol' strings, but the big win is having granular control over all your translated fields, and being able to translate the same value differently for different use cases. It's the only way to go, in my opinion – at least when you have a fair number of strings to translate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, here's how your translations file (e.g. &lt;code&gt;/translations/en.php&lt;/code&gt;) could look with namespacing for the &lt;code&gt;whiskey&lt;/code&gt; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'field.whiskey.name' =&amp;gt; 'Whiskey',&#xA;    'field.whiskey.option.irish.label' =&amp;gt; 'Welsh',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the frontend, your static string translations will work there, too – just add the &lt;code&gt;|t&lt;/code&gt; filter to the labels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.whiskey.options %}&#xA;    &amp;lt;li&amp;gt;{{ option.label|t }}: {{ option }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-16T10:11:38.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13712" PostTypeId="1" CreationDate="2016-02-16T11:41:16.987" Score="0" ViewCount="581" Body="&lt;p&gt;I have just started working with Craft and I'm learning as I go, by porting over an existing site to it. It's mostly going well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I stumbled when I tried integrating an imageslider on the Homepage. It's a slider called Flexslider, and I've been unsuccessful in integrating it as a series of entries for each slide. When the browser tries to render the page it stops at the &quot;data-bg&quot; tag...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;slides&quot;&amp;gt;&#xA;        &amp;lt;!-- Slide 1 --&amp;gt;&#xA;&#xA;        &amp;lt;li class=&quot;custom-bg&quot; data-bg=&quot;{{ entry.imageCarousel1 }}&quot;&amp;gt;                                                             &#xA;            &amp;lt;div class=&quot;flex-content flex-middle&quot;&amp;gt;                                  &#xA;                &amp;lt;div class=&quot;container&quot;&amp;gt;                                         &#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;                                                   &#xA;                        &amp;lt;div class=&quot;col-sm-12 col-md-9&quot;&amp;gt;                                                            &#xA;                            &amp;lt;h2 class=&quot;flex-title animated&quot; data-anim=&quot;fadeInDown&quot;&amp;gt;{{ entry.slideTitle }}&amp;lt;/h2&amp;gt;                                    &#xA;                            &amp;lt;h3 class=&quot;flex-subtitle animated&quot; data-anim=&quot;fadeInUp&quot;&amp;gt;{{ entry.slideSubtitle }}&amp;lt;/h3&amp;gt;                                  &#xA;                        &amp;lt;/div&amp;gt;                                                  &#xA;                    &amp;lt;/div&amp;gt;                                              &#xA;                &amp;lt;/div&amp;gt;                                      &#xA;            &amp;lt;/div&amp;gt;                              &#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        &amp;lt;!-- END Slide 1 --&amp;gt;&#xA;        ...&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm open to replacing Flexslider with a more Craft-friendly slider, if anyone can point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&#xA;Ric&lt;/p&gt;&#xA;" OwnerUserId="4713" LastActivityDate="2016-02-16T12:43:03.383" Title="Craft newbie : can anyone recommend a simple image slider?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13714" PostTypeId="2" ParentId="13712" CreationDate="2016-02-16T12:19:33.777" Score="3" Body="&lt;p&gt;There's quite a lot missing from your code / question. I'll make some assumptions.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your &lt;strong&gt;slider is on a the Home page&lt;/strong&gt; of your site (not a single entry page/template)&lt;/li&gt;&#xA;&lt;li&gt;Your have a Section in Craft called &quot;&lt;strong&gt;News&lt;/strong&gt;&quot;&lt;/li&gt;&#xA;&lt;li&gt;Your slides consist of custom fields within News, called: '&lt;strong&gt;news cover image&lt;/strong&gt;', '&lt;strong&gt;title&lt;/strong&gt;' and '&lt;strong&gt;sub title&lt;/strong&gt;'&lt;/li&gt;&#xA;&lt;li&gt;You have an Image Transform configured in Craft called &quot;&lt;strong&gt;News Slide&lt;/strong&gt;&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Your code could then, look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;slides&quot;&amp;gt;&#xA;&#xA;    {# Find the most recent 3 entries in the News Section #}&#xA;    {% set newsEntries = craft.entries.section('news').limit(3) %}&#xA;&#xA;    {% for entry in newsEntries %}&#xA;&#xA;        {% set image = entry.newsCoverImage.first() %}&#xA;        {% if image %}&#xA;            &amp;lt;li class=&quot;custom-bg&quot; data-bg=&quot;{{ image.getUrl(newsSlide) }}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;flex-content flex-middle&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;col-sm-12 col-md-9&quot;&amp;gt;&#xA;                                &amp;lt;h2 class=&quot;flex-title animated&quot; data-anim=&quot;fadeInDown&quot;&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;                                &amp;lt;h3 class=&quot;flex-subtitle animated&quot; data-anim=&quot;fadeInUp&quot;&amp;gt;{{ entry.subTitle }}&amp;lt;/h3&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first &lt;strong&gt;Set&lt;/strong&gt; tag finds the most recent 3 News entries (&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;More info here...&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;For loop&lt;/strong&gt; contains the slides and will loop x3 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Set-image tag grabs the first asset (image) assigned to the &quot;news cover image&quot; custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how you get on...&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="125" LastEditDate="2016-02-16T12:43:03.383" LastActivityDate="2016-02-16T12:43:03.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13715" PostTypeId="1" CreationDate="2016-02-16T13:12:31.173" Score="0" ViewCount="308" Body="&lt;p&gt;We've a requirement to setup Craft Commerce store as part of our testing, in this process we've gone through the documentation and found that we need to use HTML, CSS or JS code to complete the store setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help us how to setup the store?&lt;/p&gt;&#xA;" OwnerUserId="4752" LastEditorUserId="22" LastEditDate="2017-05-09T22:24:08.840" LastActivityDate="2017-05-09T22:24:08.840" Title="How to setup the Craft Commerce store both front and back end" Tags="&lt;plugin-craftcommerce&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2016-02-17T18:17:22.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="13716" PostTypeId="2" ParentId="13715" CreationDate="2016-02-16T13:34:41.343" Score="2" Body="&lt;p&gt;You might need a web developer to install Craft and Craft Commerce 'locally' (on your computer), using a testing domain such at &lt;strong&gt;craftcommercedemo.dev&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the '.dev' &lt;a href=&quot;https://en.wikipedia.org/wiki/Top-level_domain&quot; rel=&quot;nofollow&quot;&gt;TLD&lt;/a&gt; will allow you to unlock Craft Pro and Craft Commerce so that you can see and test all of the CraftCMS + Commerce features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Craft and Craft Commerce come with a set of &lt;strong&gt;template files&lt;/strong&gt;, allowing you to &lt;strong&gt;interact with the site in the same way a regular visitor would&lt;/strong&gt; (from the front end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a starting point, check out &lt;a href=&quot;https://www.apachefriends.org/index.html&quot; rel=&quot;nofollow&quot;&gt;XAMPP&lt;/a&gt; (if you use a PC) or &lt;a href=&quot;https://www.mamp.info/en/&quot; rel=&quot;nofollow&quot;&gt;MAMP&lt;/a&gt; (if you use a Mac)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above facilitates local Apache web server, plus MySQL database which will allow you to run Craft on your computer in the same way as you would on a real web server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a developer, check out this list of &lt;a href=&quot;https://straightupcraft.com/professionals&quot; rel=&quot;nofollow&quot;&gt;Craft Professionals...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-02-16T13:40:22.970" LastActivityDate="2016-02-16T13:40:22.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13717" PostTypeId="1" AcceptedAnswerId="13726" CreationDate="2016-02-16T14:01:23.403" Score="1" ViewCount="715" Body="&lt;p&gt;I have Craft public files set up within subdirectories of a primary domain’s web root.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public_html/ # default web root&#xA;public_html/example.com/public_html/ # Craft public files here&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following .htaccess rules allow for the &lt;code&gt;public_html&lt;/code&gt; subdirectory to act as the new web root. This is the .htaccess within the first &lt;code&gt;public_html&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;&#xA;RewriteCond %{HTTP_HOST} ^example.com$&#xA;RewriteCond %{REQUEST_URI} !^/example.com/public_html/&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.*)$ /example.com/public_html/$1&#xA;&#xA;RewriteCond %{HTTP_HOST} ^example.com$&#xA;RewriteRule ^(/)?$ example.com/public_html/index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works until I go to example.com/admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can login and cp works, but the URL is &lt;code&gt;http://example.com/example.com/public_html/admin/dashboard&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to remove the subdirectories from the above admin URL for mere aesthetic reasons, but can’t seem to nail it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: When going directly to &lt;code&gt;http://example.com/admin/dashboard&lt;/code&gt;, for example, the URL remains as is, but all the internal links have the subdirectories.&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="217" LastEditDate="2016-02-16T14:26:58.770" LastActivityDate="2016-02-16T18:02:21.863" Title="Remove subdirectories from admin URL with .htaccess" Tags="&lt;control-panel&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13718" PostTypeId="2" ParentId="13308" CreationDate="2016-02-16T14:48:28.347" Score="7" Body="&lt;p&gt;Either existing answer could work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is a plugin I've recently built. Redactor Extras: &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uses the Plugin from Redactors site for align. Has other extras as well.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-02-16T14:48:28.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13719" PostTypeId="2" ParentId="9881" CreationDate="2016-02-16T14:57:47.340" Score="3" Body="&lt;p&gt;If this is still required I've built a plugin, Redactor Extras: &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add your own JS via the Plugin. I'm updating and adding plugins from Redactors site regularly. I'll add font-color next. But good use with your own code.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-02-16T14:57:47.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13720" PostTypeId="2" ParentId="2691" CreationDate="2016-02-16T15:01:31.463" Score="1" Body="&lt;p&gt;Another option is a plugin I've built. Redactor Extras: &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Includes the plugin from Redactors site for Superscript and Subscript. Has other extras as well.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-02-16T15:01:31.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13721" PostTypeId="1" CreationDate="2016-02-16T15:03:51.147" Score="2" ViewCount="531" Body="&lt;p&gt;I'm stumped on this one, for the longest time when I clicked the &quot;Clear Caches&quot; button in the CP, everything seemed to be ok. But I recently checked the craft.log after noticing things didn't seem to be clearing out after all. There was this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2016-02-16 09:25:11&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level   error&#xA;Category    application&#xA;Message Tried to read the folder contents of /home/[company-name]/craft/storage/runtime/temp/, but could not.&#xA;2016-02-16 09:25:11&#xA;&#xA;Level   error&#xA;Category    application&#xA;Message Tried to read the folder contents of /home/[company-name]/craft/storage/runtime/assets/, but could not.&#xA;2016-02-16 09:25:11&#xA;&#xA;Level   error&#xA;Category    application&#xA;Message Tried to read the folder contents of /home/[company-name]/craft/storage/runtime/cache/, but could not.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The permissions are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft 755&#xA;  /storage 777&#xA;     /runtime 777&#xA;        /temp 777&#xA;           empty&#xA;        /assets 777&#xA;           empty&#xA;        /cache 777&#xA;           09f795de983f214fb0e9188dd884ec27.bin 664&#xA;           +another 26 of the same - these don't clear when I click the clear cache button&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried changing the 664 to 777 but it reverted itself back to 664.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4754" LastActivityDate="2016-03-17T16:03:54.467" Title="Error: &quot;Tried to read the folder contents...but could not&quot;" Tags="&lt;cache&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13722" PostTypeId="2" ParentId="13721" CreationDate="2016-02-16T15:06:37.477" Score="1" Body="&lt;p&gt;Try changing the 664 through SSH instead of manually. These three folders need the right permissions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft/app/ &lt;/li&gt;&#xA;&lt;li&gt;craft/config/ &lt;/li&gt;&#xA;&lt;li&gt;craft/storage/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;source: &lt;a href=&quot;https://craftcms.com/docs/installing&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/installing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Have you tried removing the content of the Cache?&lt;/p&gt;&#xA;" OwnerUserId="4723" LastActivityDate="2016-02-16T15:06:37.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13723" PostTypeId="2" ParentId="13707" CreationDate="2016-02-16T15:25:02.697" Score="5" Body="&lt;p&gt;You just think it is &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt; that get's returned from the filter, because that's how your developer tools display it, but in fact it is a &lt;em&gt;UTF-8 encoded&lt;/em&gt; non-breaking space character. Have a look at the source code that is output and you won't see the &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter gets the formatting pattern from the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/i18n/data/no.php#L32&quot; rel=&quot;nofollow noreferrer&quot;&gt;app/framework/i18n/data/no.php&lt;/a&gt; file. Everything in this file is UTF-8 encoded and the non-breaking space is no exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can we remove it? Copy-and-pasting doesn't always work, because it depends on the apps used. On Mac OS X 10.11 I was able to simply copy the string from the source code view in the Safari dev tools to Atom editor and it worked. I can also generate the character with &lt;kbd&gt;Alt&lt;/kbd&gt;+&lt;kbd&gt;Space&lt;/kbd&gt;. Copying the snippet into this answer doesn't work though, it somehow converts it to a normal space:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ price|replace('Nkr ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Important sidenote:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mac OS X users who are like me and sometimes accidentially enter a non-breaking space character into their source code and then go mad trying to fix the error, have a look at this Apple Stack Exchange post: &lt;a href=&quot;https://apple.stackexchange.com/questions/34672/whats-altspacebar-character-and-how-to-disable-it&quot;&gt;What's alt+spacebar character and how to disable it?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Atom editor users can install the &lt;a href=&quot;https://atom.io/packages/highlight-nbsp&quot; rel=&quot;nofollow noreferrer&quot;&gt;highlight-nbsp&lt;/a&gt; package.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:45:32.027" LastActivityDate="2016-02-16T22:50:08.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13724" PostTypeId="1" AcceptedAnswerId="13725" CreationDate="2016-02-16T17:10:24.270" Score="0" ViewCount="57" Body="&lt;p&gt;I'm pretty new to Craft, just installed my first one. I've checked the docs, but I couldn't find any useful hints anymore and I think it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to rename the default news section to post. I changed everything admin side from news to page, but the path &lt;code&gt;http://site.local/post/2016/we-just-installed-craft&lt;/code&gt; leads to a 404 page. The &lt;code&gt;http://site.local/post&lt;/code&gt; page lists the entries correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also renamed the &lt;code&gt;news&lt;/code&gt; folder in the templates to &lt;code&gt;post&lt;/code&gt;. If I change it back to news, the 404 problem is resolved, but obviously I want to understand why it still wants to access that folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sections page looks like this&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iBXUB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iBXUB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any custom route set up.&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-02-16T17:30:31.847" Title="Renaming news section leads to 404" Tags="&lt;sections&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13725" PostTypeId="2" ParentId="13724" CreationDate="2016-02-16T17:30:31.847" Score="1" Body="&lt;p&gt;Problem solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Admin was a bit confusing on the UX side, I didn't realize that &lt;code&gt;edit entry types&lt;/code&gt; and clicking the &lt;code&gt;name&lt;/code&gt; of the section leads to different pages. &lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-02-16T17:30:31.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13726" PostTypeId="2" ParentId="13717" CreationDate="2016-02-16T17:52:09.700" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I have Craft public files set up within subdirectories of a primary domain’s web root.&lt;/p&gt;&#xA;&lt;p&gt;The following .htaccess rules allow for the public_html subdirectory to &lt;strong&gt;act as the new web root.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Is there a &lt;em&gt;reason&lt;/em&gt; you're doing it this way? The &lt;code&gt;.htaccess&lt;/code&gt; you have is only rewriting the content, it's not actually setting the web root. You're basically asking Apache to serve content out of the root for your other domain. There's only a couple circumstances I can think of where you'd need to &lt;em&gt;actually&lt;/em&gt; do that (&lt;em&gt;mirroring&lt;/em&gt; a domain for example but that's not something you probably want to do here).&lt;/p&gt;&#xA;&lt;p&gt;For that, you need to set Apache's &lt;a href=&quot;https://httpd.apache.org/docs/2.4/mod/core.html#documentroot&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;DocumentRoot&lt;/code&gt;&lt;/a&gt; properly for your second domain.&lt;/p&gt;&#xA;&lt;p&gt;It sounds like you have a  &lt;a href=&quot;http://support.hostgator.com/articles/cpanel/document-root-changes&quot; rel=&quot;nofollow noreferrer&quot;&gt;CPanel&lt;/a&gt; based setup, where it's common for it to put add-on domains inside of the web root of the primary domain by default.  I'm not sure how the document root got changed to the primary domain but you need to set the document root of the add-on domain to the proper place (in Cpanel it's usually the Modify Domain function).&lt;/p&gt;&#xA;&lt;p&gt;What you type in depends on your path but it's probably set to just &lt;code&gt;public_html&lt;/code&gt; now. You want &lt;code&gt;public_html/example.com/public_html/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That'll get you back to a properly functioning setup.  Then just use Craft's default &lt;code&gt;.htaccess&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-02-16T18:02:21.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13727" PostTypeId="1" CreationDate="2016-02-16T17:59:12.963" Score="4" ViewCount="601" Body="&lt;p&gt;I have a slide show that shows logos of different dimensions working well in HTML/CSS - the image output looks like below. I'd like to only upload one retina/hdpi image once for the entry where the asset is. I'd like to use image transforms to output the retina images but need to preserve the width and height of the original as they vary in look and dimensions. I can't find an example. I have read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1723/how-can-i-automatically-generate-responsive-images-from-a-single-hi-res-asset/10955#10955&quot;&gt;this post&lt;/a&gt;&#xA;10 times but not really seeing if this holds a solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTML code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;[image tag srcset01] srcset=&quot;&#xA;    /assets/images/logos-sponsors/company1_logo.png 1x,&#xA;    /assets/images/logos-sponsors/company1_logo@2x.png 2x,&#xA;    /assets/images/logos-sponsors/company1_logo@3x.png 3x&quot; alt=&quot;company1_logo&quot; width=&quot;130&quot; height=&quot;12&quot;&gt;&#xA;&#xA;&#xA;[image tag srcset01] &#xA; src=&quot;/assets/images/logos-sponsors/company2_logo.png&quot; srcset=&quot;&#xA;    /assets/images/logos-sponsors/company2_logo.png 1x,&#xA;    /assets/images/logos-sponsors/company2_logo@2x.png 2x,&#xA;    /assets/images/logos-sponsors/company2_logo@3x.png 3x&quot;  &#xA;alt=&quot;company2_logo&quot; width=&quot;52&quot; height=&quot;30&quot;&gt;&#xA;&lt;/li&gt;&#xA;&#xA;[image tag srcset01]  src=&quot;/assets/images/logos-sponsors/company3_logo.png&quot; srcset=&quot;&#xA;    /assets/images/logos-sponsors/company3_logo.png 1x,&#xA;    /assets/images/logos-sponsors/company3_logo@2x.png 2x,&#xA;    /assets/images/logos-sponsors/company3_logo@3x.png 3x&quot; &#xA;    alt=&quot;company3_logo&quot; width=&quot;130&quot; height=&quot;11&quot;&gt;&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The goal is to have the image uploaded once and then &lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-17T15:43:03.943" Title="How to output transforms for retina images from one upload?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13728" PostTypeId="2" ParentId="10893" CreationDate="2016-02-16T18:10:57.243" Score="1" Body="&lt;p&gt;The answer is now included in the question. Don't be a dingbat and make sure MAMP or Apache (or whatever webserver you're using) is configured properly.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-02-16T18:10:57.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13729" PostTypeId="2" ParentId="13649" CreationDate="2016-02-16T19:58:03.400" Score="1" Body="&lt;p&gt;in the end, for me making&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/opt/www/dave/web/tmp &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;writable for craft was the solution. &#xA;thanks for all the feedback!&lt;/p&gt;&#xA;" OwnerUserId="4427" LastActivityDate="2016-02-16T19:58:03.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13730" PostTypeId="1" AcceptedAnswerId="13731" CreationDate="2016-02-16T20:27:51.193" Score="3" ViewCount="72" Body="&lt;p&gt;There are easier ways to do this for sure, but... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow&quot;&gt;Mailchimp Subscribe&lt;/a&gt; plugin installed to build our email list etc... and it works perfectly!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we are now building a &quot;Coming Soon&quot; page with the site turned off to the public while we build out the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to accept a certain action while the system is offline so that the POST request is accepted and doesnt return a 503 error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, this is possible through using just a Mailchimp form itself but I'm interested to see if this sort of thing is possible if I ever needed this sort of control in the future.&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2016-02-17T19:35:56.500" Title="Is it possible to POST to an action if the system is offline?" Tags="&lt;plugin-development&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13731" PostTypeId="2" ParentId="13730" CreationDate="2016-02-16T21:21:28.657" Score="4" Body="&lt;p&gt;Completely untested, but something like this in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;   'isSystemOn' =&amp;gt; (isset($_REQUEST['action']) &amp;amp;&amp;amp; !$_REQUEST['action'] != 'mailchimpSubscribe/list/Subscribe'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="284" LastEditDate="2016-02-17T19:35:56.500" LastActivityDate="2016-02-17T19:35:56.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13732" PostTypeId="1" AcceptedAnswerId="13738" CreationDate="2016-02-16T22:27:09.180" Score="4" ViewCount="50" Body="&lt;p&gt;Is there anything that will prevent an entry from being worked on by 2 editors at the same time?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-02-17T06:13:18.147" Title="Show an entry is being worked on" Tags="&lt;editor&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13733" PostTypeId="1" AcceptedAnswerId="13735" CreationDate="2016-02-16T23:12:45.363" Score="1" ViewCount="368" Body="&lt;p&gt;I know I can set  &lt;code&gt;postLoginRedirect&lt;/code&gt; in config/general.php to send the user to a specific page after login. Is there a way to grab that value in the template? This came up because I noticed that the &lt;code&gt;{{siteUrl}}&lt;/code&gt; href in the default &lt;code&gt;_layout.html&lt;/code&gt; template was sending the user to the homepage (index.html), but I'd like to conditionally replace that link for a logged-in user.&lt;/p&gt;&#xA;" OwnerUserId="4757" LastActivityDate="2016-02-17T23:21:44.477" Title="Changing the &quot;homepage&quot; url for logged-in users" Tags="&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13734" PostTypeId="1" CreationDate="2016-02-16T23:54:54.987" Score="1" ViewCount="385" Body="&lt;p&gt;I have two assets sources, Slideshow and Products. I have six Image Transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the home page I'm using a structure channel to play a simple slideshow and I'm using 3 transforms and all is working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.productPhotos.first().geturl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this code throws an error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.productPhotos.first().geturl('productSlide') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rvAiZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rvAiZ.png&quot; alt=&quot;error message&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go on my assets source path, the file is uploaded but the transform folder doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried clearing cache, deleting records in &lt;code&gt;craft_assettransformindex&lt;/code&gt;, and most of the things suggested here, but with no luck. The weird thing is that the other Structure with the assets Slideshow works fine so it couldn't be something with the paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true&lt;/code&gt;, in my &lt;code&gt;config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see on my phpMyAdmin screenshot that the filename is NULL in the table &lt;code&gt;craft_assettransformindex&lt;/code&gt; but all the other transforms for the slideshow are there:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9te54.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9te54.png&quot; alt=&quot;db row&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4337" LastEditorUserId="45" LastEditDate="2016-02-17T00:28:23.673" LastActivityDate="2016-02-17T03:12:14.263" Title="Assets Transform returns &quot;Image cannot be found.&quot;" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;error&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13735" PostTypeId="2" ParentId="13733" CreationDate="2016-02-17T00:21:02.520" Score="3" Body="&lt;p&gt;Sure, something like this should work (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ currentUser ? url(craft.config.get('postLoginRedirect')) : siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above should create an absolute URL to whatever's in your &lt;code&gt;postLoginRedirect&lt;/code&gt; config setting, relative to your &lt;code&gt;siteUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you want an URL relative to your Control Panel (e.g. &quot;dashboard&quot;), you'll want to use &lt;code&gt;cpUrl()&lt;/code&gt; instead, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ currentUser ? cpUrl(craft.config.get('postLoginRedirect')) : siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-17T23:21:44.477" LastActivityDate="2016-02-17T23:21:44.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13737" PostTypeId="2" ParentId="13734" CreationDate="2016-02-17T03:12:14.263" Score="4" Body="&lt;p&gt;A long shot, but if it is indeed a path problem, this has seemed to help me keep my path(s) straight. I my &lt;code&gt;config.php&lt;/code&gt; file, I'll set a parameter for &lt;code&gt;environmentVariables&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;'.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://mysite.dev/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;        'baseUrl' =&amp;gt; 'http://mysite.dev/',&#xA;    )&#xA;)&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when you are defining your asset sources, you can use this for &quot;File System Path&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}assets/photos/products/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for URL try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/assets/photos/products&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-17T03:12:14.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13738" PostTypeId="2" ParentId="13732" CreationDate="2016-02-17T06:13:18.147" Score="2" Body="&lt;p&gt;Nope, not currently... though there is a feature request for it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9009169-add-an-alert-or-warning-when-multiple-authors-are&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9009169-add-an-alert-or-warning-when-multiple-authors-are&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess it's &lt;em&gt;possible&lt;/em&gt; for it to be done in a plugin, although I'm struggling to picture exactly &lt;em&gt;how&lt;/em&gt;. At this time, no such plugin exists.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-17T06:13:18.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13739" PostTypeId="1" CreationDate="2016-02-17T07:09:09.273" Score="3" ViewCount="1404" Body="&lt;p&gt;I am wondering what is the correct way to include jQuery and jQuery UI in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4411" LastEditorUserId="57" LastEditDate="2016-02-17T17:21:48.130" LastActivityDate="2016-02-17T17:21:48.130" Title="What is the correct way to include jQuery and jQuery UI in Craft?" Tags="&lt;jquery&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13740" PostTypeId="2" ParentId="13739" CreationDate="2016-02-17T10:53:06.160" Score="5" Body="&lt;p&gt;You would use &lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/HTML/Element/script&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;&lt;/a&gt; tags in your template, preferable in a _layout.html or _base.html template which you &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;extend&lt;/code&gt;&lt;/a&gt; from all your other templates. &lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-17T10:53:06.160" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13742" PostTypeId="2" ParentId="13739" CreationDate="2016-02-17T13:00:30.400" Score="5" Body="&lt;p&gt;This is one (of the many) great things about Craft. You can literally include any javascript library however you like. In general, if there is a library you want to use, you can simply follow the guide for that particular library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A traditional approach is to include jQuery in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of your document, then any other scripts after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally use &lt;a href=&quot;http://requirejs.org/&quot; rel=&quot;nofollow&quot;&gt;requirejs&lt;/a&gt; for my projects. To do that, I follow the guide on the requriejs website. Generally, I'll do this on a &lt;code&gt;_layout.html&lt;/code&gt; file that way it is included across all pages of my application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because Craft doesn't force you to follow any tempting rules, you are free to use whatever-however you like.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-02-17T14:25:31.407" LastActivityDate="2016-02-17T14:25:31.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13743" PostTypeId="1" CreationDate="2016-02-17T14:04:39.810" Score="3" ViewCount="1163" Body="&lt;p&gt;I have two small sites finished at front-end stage that are closely related. One is the product, one the brand. The two sites use the same css and js files and are mostly static pages in three languages. &#xA;The clients (and me) would like to do this under one craft set up&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do i have to do to keep (without a redirect)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.product.com     (with eg www.product.com/nl/product-news)&#xA;www.brand.com       (with eg www.brand.com/nl/brand-news)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with only one admin and one template and public directory?&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="4427" LastEditDate="2016-02-17T14:48:47.477" LastActivityDate="2017-08-11T16:17:02.000" Title="Multisite: how to?" Tags="&lt;setup&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13744" PostTypeId="1" AcceptedAnswerId="13745" CreationDate="2016-02-17T14:38:58.177" Score="3" ViewCount="218" Body="&lt;p&gt;I am quite new to this so, please be patient. I am wanting to output the following html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.jcarousel.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;js/jcarousel.responsive.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;div class=&quot;jcarousel-wrapper&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;jcarousel&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;img src=&quot;images/home-slider-1.jpg&quot; alt=&quot;home slider image&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;white-logo&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Helping you to establish your outdoor brand in the world of retail and e-commerce&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;img src=&quot;images/home-slider-2.jpg&quot; alt=&quot;home slider image&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;white-logo&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;One of our top brands&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;img src=&quot;images/home-slider-3.jpg&quot; alt=&quot;home slider image&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;white-logo&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;We also have a design service&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;img src=&quot;images/home-slider-4.jpg&quot; alt=&quot;home slider image&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;white-logo&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Visit us at our new site&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot;jcarousel-control-prev&quot;&amp;gt;&amp;lt;img src=&quot;images/nivo-nav-buttons.png&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot;jcarousel-control-next&quot;&amp;gt;&amp;lt;img src=&quot;images/nivo-nav-buttons.png&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix field set up as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field handle: &lt;strong&gt;homepageSlider&lt;/strong&gt;&lt;br&gt;&#xA;Block type handle: &lt;strong&gt;homeSlider&lt;/strong&gt;&lt;br&gt;&#xA;Field name handles: &lt;strong&gt;mainImage&lt;/strong&gt;, &lt;strong&gt;whiteLogo&lt;/strong&gt;, &lt;strong&gt;imageText&lt;/strong&gt; and &lt;strong&gt;mainImage&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mainImage&lt;/strong&gt; has a field type of 'Assets'&lt;br&gt;&#xA;&lt;strong&gt;whiteLogo&lt;/strong&gt; has a field type of 'Lightswitch'&lt;br&gt;&#xA;&lt;strong&gt;imageText&lt;/strong&gt; has a field type of 'Plain Text'&lt;br&gt;&#xA;&lt;strong&gt;mainImageLink&lt;/strong&gt; has a field type of 'Linkit' (from a plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have written:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;{% includeJsFile &quot;/js/jquery.jcarousel.min.js&quot; %}&#xA;{% includeJsFile &quot;/js/jcarousel.responsive.js&quot; %}&#xA;&amp;lt;div class=&quot;jcarousel-wrapper&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;jcarousel&quot;&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;{% for block in entry.homepageSlider %}&#xA;&amp;lt;li&amp;gt;&#xA;&#xA;{% if block.type == &quot;mainImage&quot; %}&#xA;{% set image = block.mainImage %}&#xA;&amp;lt;img src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if block.type == &quot;whiteLogo&quot; %}&#xA;&amp;lt;div class=&quot;white-logo&quot;&amp;gt;&#xA;{% set imagetwo = block.mainImage %}&#xA;&amp;lt;img src=&quot;{{ imagetwo.getUrl }}&quot; alt=&quot;{{ imagetwo.title }}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if block.type == &quot;imageText&quot; %}&#xA;&amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&amp;lt;p&amp;gt;{{ block.imageText }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if block.type == &quot;mainImageLink&quot; %}&#xA;{% set yourLink = entry.mainImageLink %}&#xA;{{ yourLink.link|raw }}&#xA;{% endif %}&#xA;&#xA;&amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;a href=&quot;#&quot; class=&quot;jcarousel-control-prev&quot;&amp;gt;&amp;lt;img src=&quot;images/nivo-nav-buttons.png&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;#&quot; class=&quot;jcarousel-control-next&quot;&amp;gt;&amp;lt;img src=&quot;images/nivo-nav-buttons.png&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs html as I want, BUT, is empty between &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/li&amp;gt;&lt;/code&gt;. I have tried following &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9207/output-matrix-field-data&quot;&gt;this post&lt;/a&gt;, but am so far getting nowhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help that anyone can offer would be most appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="4736" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-17T16:07:45.703" Title="Use Matrix field to output specific html" Tags="&lt;matrix&gt;&lt;field&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13745" PostTypeId="2" ParentId="13744" CreationDate="2016-02-17T15:28:49.090" Score="4" Body="&lt;p&gt;In your code &lt;code&gt;block.type&lt;/code&gt; is the matrix block type, ie &lt;code&gt;homeSlider&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's alot going on in your code that I'm not sure is intended or not, but let's say you had the fields mainImage and imageText as required fields in there, and have an optional whiteLogo (not sure where that link's suppose to go, it's not in your original html). Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/js/jquery.jcarousel.min.js&quot; %}&#xA;{% includeJsFile &quot;/js/jcarousel.responsive.js&quot; %}&#xA;&amp;lt;div class=&quot;jcarousel-wrapper&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;jcarousel&quot;&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for block in entry.homepageSlider %}&#xA;  &amp;lt;li&amp;gt;&#xA;    {% set image = block.mainImage.first() %}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;&#xA;    {% if block.whiteLogo %}&#xA;      &amp;lt;div class=&quot;white-logo&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;jcarousel-text&quot;&amp;gt;&amp;lt;p&amp;gt;{{ block.imageText }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, inside you're for loop, the fields you've created are accessible by &lt;code&gt;block.fieldHandle&lt;/code&gt;. If you want to make a conditional based on if a field has a value or not, that is done in different ways depending on the type of field. So you'd do &lt;code&gt;{% if block.lightswitchField %}&lt;/code&gt; if it's a lightswitch, &lt;code&gt;{% if block.assetField | length %}&lt;/code&gt; if it's an assets field, or &lt;code&gt;{% if block.textField != '' %}&lt;/code&gt; if it's a text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps you in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2016-02-17T16:07:45.703" LastActivityDate="2016-02-17T16:07:45.703" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13746" PostTypeId="2" ParentId="13727" CreationDate="2016-02-17T15:43:03.943" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'd like to use image transforms to output the retina images but need&#xA;  to preserve the width and height of the original as they vary in look&#xA;  and dimensions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This statement kind of contradicts itself. :) You want to create different sizes, but keep the width and height of the original? My interpretation is that you'll always be uploading an image that's a number of times bigger that the @1x size? Let's say you always upload these images @3x, try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myImage = entry.myImage() %}&#xA;{% set baseWidth = myImage.getWidth() / 3 %}&#xA;{% set baseHeight = myImage.getHeight() / 3 %}&#xA;&#xA;&amp;lt;img &#xA;  src=&quot;{{ myImage.getUrl({ width: baseWidth, height: baseHeight }) }}&quot; &#xA;  srcset=&quot;&#xA;    {{ myImage.getUrl({ width: baseWidth, height: baseHeight }) }} 1x,&#xA;    {{ myImage.getUrl({ width: baseWidth*2, height: baseHeight*2 }) }} 2x,&#xA;    {{ myImage.getUrl() }} 3x&quot;  &#xA;  alt=&quot;{{ myImage.title }}&quot; &#xA;  width=&quot;{{ baseWidth }}&quot; &#xA;  height=&quot;{{ baseheight }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-17T15:43:03.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13747" PostTypeId="1" AcceptedAnswerId="13749" CreationDate="2016-02-17T17:09:16.860" Score="2" ViewCount="413" Body="&lt;p&gt;I would like to update a specific entry upon the completion of a successful payment through the charge plugin. For this, &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; provides the callback 'charge.onCharge,' as detailed in the &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/hook-events#event-onCharge&quot; rel=&quot;nofollow&quot;&gt;'Hooks &amp;amp; Events Page'&lt;/a&gt; of the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that I have no idea where to put PHP code to utilize this callback, nor what this code would look like. Is there an example that would explain exactly how to use the callback, and exactly where the code would go?&lt;/p&gt;&#xA;" OwnerUserId="4764" LastEditorUserId="57" LastEditDate="2016-02-17T17:24:13.730" LastActivityDate="2016-02-17T17:30:55.487" Title="Where do I put code to use hooks and events from Squarebit's 'Charge' plugin?" Tags="&lt;php&gt;&lt;hook&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13748" PostTypeId="1" CreationDate="2016-02-17T17:10:46.870" Score="1" ViewCount="200" Body="&lt;p&gt;Is anybody using the &lt;a href=&quot;https://github.com/familiar-studio/craft-json-expand&quot; rel=&quot;nofollow&quot;&gt;json_expand plugin&lt;/a&gt; for API functionality?&#xA;For the entry type Rich Text Field its just returning an empty object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my json_expand endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;{% set utensils = craft.entries.section('utensils').find('') %}&#xA;{{ utensils | json_expand | raw  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's returning everything except that Rich Text field which just returns this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;utensil_textbox&quot;: {}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4297" LastEditorUserId="57" LastEditDate="2016-02-17T17:32:31.683" LastActivityDate="2017-09-21T15:41:36.727" Title="Rich Text Field is returning an empty object over api of plugin json_expand" Tags="&lt;plugin-jsonexpand&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13749" PostTypeId="2" ParentId="13747" CreationDate="2016-02-17T17:30:55.487" Score="3" Body="&lt;p&gt;You'd listen to Charge's &lt;code&gt;onCharge&lt;/code&gt; event just like you'd listen to any of Craft's own &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;events&lt;/a&gt;, using a &lt;a href=&quot;https://craftcms.com/docs/plugins/&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin's &lt;code&gt;init()&lt;/code&gt; method, for example could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onCharge', function(Event $event) {&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's a nifty Craft plugin scaffold generator to get you started &lt;a href=&quot;http://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-17T17:30:55.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13750" PostTypeId="1" AcceptedAnswerId="13753" CreationDate="2016-02-17T18:59:13.463" Score="4" ViewCount="707" Body="&lt;p&gt;How to use select dropdown with entries/saveEntry for an entry field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an entry with a field that is another entry, which I want to update with a form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;  &amp;lt;label&amp;gt;Vendor&#xA;    &amp;lt;select name=&quot;fields[vendor][]&quot;&amp;gt;&#xA;      &amp;lt;option&amp;gt;---&amp;lt;/option&amp;gt;&#xA;      {% for v in craft.entries.section('vendors') %}&#xA;        &amp;lt;option value=&quot;{{v.id}}&quot;&amp;gt;{{v.title}}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;  &amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine, except if nothing is selected in the dropdown (&lt;code&gt;&amp;lt;option&amp;gt;---&amp;lt;/option&amp;gt;&lt;/code&gt;). In that case, the POST value for &lt;code&gt;fields[vendor][]&lt;/code&gt; is &lt;code&gt;---&lt;/code&gt;, and I get a SQL foreign key constraint error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried &lt;code&gt;&amp;lt;option value=&quot;&quot;&amp;gt;---&amp;lt;/option&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;option value=&quot;NULL&quot;&amp;gt;---&amp;lt;/option&amp;gt;&lt;/code&gt; with no better outcome.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-02-17T19:51:24.903" Title="How to use select dropdown with entries/saveEntry for an entry field?" Tags="&lt;frontend&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13751" PostTypeId="1" CreationDate="2016-02-17T19:20:00.867" Score="2" ViewCount="704" Body="&lt;p&gt;I installed the Element API plugin and the &lt;code&gt;elementapi.php&lt;/code&gt; file within the craft/config/ folder is set up just like the example on Github. I'm also trying to use this with a section called &quot;news&quot; like the example. However, when I try to access &lt;code&gt;news.json&lt;/code&gt; I get a 404. Am I missing something? Do I need to call something in my templates to make that feed available?&lt;/p&gt;&#xA;" OwnerUserId="4757" LastActivityDate="2019-03-01T16:25:11.303" Title="Accessing the Element API JSON" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13752" PostTypeId="2" ParentId="13751" CreationDate="2016-02-17T19:32:46.863" Score="1" Body="&lt;p&gt;That plugin doesnt append any file extensions to the routes. Try either changing the route in &lt;code&gt;elementapi.php&lt;/code&gt; to &lt;code&gt;news.json&lt;/code&gt; or try to visit &lt;a href=&quot;http://yoursite.dev/news&quot; rel=&quot;nofollow&quot;&gt;http://yoursite.dev/news&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="284" LastActivityDate="2016-02-17T19:32:46.863" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13753" PostTypeId="2" ParentId="13750" CreationDate="2016-02-17T19:51:24.903" Score="3" Body="&lt;p&gt;I ran into this a while ago and it drove me nuts. Try adding &lt;code&gt;disabled&lt;/code&gt; and &lt;code&gt;selected&lt;/code&gt; attributes to your initial option in the select. So in your case &lt;code&gt;&amp;lt;option disabled selected&amp;gt;---&amp;lt;/option&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-02-17T19:51:24.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13754" PostTypeId="1" CreationDate="2016-02-18T04:08:53.970" Score="1" ViewCount="215" Body="&lt;p&gt;I'm using a custom plugin with a service and controller to save relational fields to entries. I'm able to do this just fine, but when it saves an entry, it sets the author as NULL in the database and it no longer shows in the author's list of authored entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to both not set the author at all and to manually set the author to the previous author. Craft gives me an Internal Service Error saying &quot;Property 'Craft\EntryModel.author' is read only.&quot; when trying to set the author in the code. Removing the retrieval and setting of the author saves the entry but marks the author as NULL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else faced this? Is it a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here's the heart of this service's code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $criteria3 = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria3-&amp;gt;id = $kitId;&#xA;    $currentKit = $criteria3-&amp;gt;first();&#xA;    $currentAuthor = $currentKit-&amp;gt;author;&#xA;&#xA;    $kit = new EntryModel();&#xA;    $kit-&amp;gt;sectionId = '6';&#xA;    $kit-&amp;gt;id = $kitId;&#xA;&#xA;    $kit-&amp;gt;author = $currentAuthor;&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($kit);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4158" LastActivityDate="2016-02-18T17:21:29.917" Title="Author saved as NULL when updating entries from a plugin" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;author&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13755" PostTypeId="2" ParentId="13743" CreationDate="2016-02-18T10:01:13.170" Score="3" Body="&lt;p&gt;&lt;strong&gt;Multisite is coming to Craft 3, so this only applies to v2 &lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;See here&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I don't think there is an integrated way to do this and it might be worth reading this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/408/are-there-any-intentions-to-release-multisite-support-for-craft&quot;&gt;Are there any intentions to release multisite support for Craft?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;..we're pretty against adding it to Craft... at least in the way EE did it, where everything is stored on a per-site basis.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That said, I guess you could do this with symbolic links if you wanted, this is untested but in theory it should/could work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have these folders on your website:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craftinstall&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft&lt;/li&gt;&#xA;&lt;li&gt;public&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;product&lt;/li&gt;&#xA;&lt;li&gt;brand&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You could do &lt;code&gt;ln -s /path/to/craftinstall/public /path/to/product/public&lt;/code&gt; and then repeat that for the brand, this will then mean both the &lt;code&gt;public&lt;/code&gt; folders for your websites will point to the &lt;code&gt;craftinstall/public&lt;/code&gt; folder and should then be able to pick up the &lt;code&gt;craft&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;general.php&lt;/code&gt; config file you could have these settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Fetch url scheme&#xA;define('URI_SCHEME', ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&#xA;// Fetch current environment url&#xA;define('SITE_URL', URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;&#xA;&#xA;define('BASEPATH', realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;&#xA;  // These are common (default) to all&#xA; '*' =&amp;gt; array(&#xA;   'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; BASEPATH,&#xA;      'siteUrl'  =&amp;gt; SITE_URL&#xA;   )&#xA; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would mean that whatever the url is, i.e: &lt;code&gt;www.brand.com&lt;/code&gt; will be set as the siteUrl so in your actual craft install, under general settings your site url will simply be &lt;code&gt;{siteUrl}&lt;/code&gt; and this will get replaced (same with &lt;code&gt;basePath&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which would then mean both sites should then point to the same craft install, now for templates and routes, this might not work, but it might but you &lt;em&gt;could&lt;/em&gt; do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your templates folder structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;templates&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;brand.com&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;brand-news&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;product.com&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;product-news&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And in &lt;code&gt;public/index.php&lt;/code&gt; file something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_TEMPLATES_PATH', &quot;craft/templates/&quot; . $_SERVER['SERVER_NAME']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I said, I haven't tried or tested this so it would be interesting if it did work, this is just my theory :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2017-08-11T16:17:02.000" LastActivityDate="2017-08-11T16:17:02.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13756" PostTypeId="1" AcceptedAnswerId="13785" CreationDate="2016-02-18T10:24:17.110" Score="4" ViewCount="892" Body="&lt;p&gt;I need a thumbnail image of a video which i upload as an asset. Instead of uploading an image manually I'd prefer craft to generate a thumbnail for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a plugin I didn't find or did someone find another workaround?&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="45" LastEditDate="2016-08-13T02:24:51.423" LastActivityDate="2018-11-02T15:32:09.490" Title="Is there a thumbnail generator plugin for video assets?" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13757" PostTypeId="1" AcceptedAnswerId="13769" CreationDate="2016-02-18T10:26:04.883" Score="1" ViewCount="173" Body="&lt;p&gt;For a complex website we have nested a relation field inside a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It makes little sense for us to show the list of already created entries so we would prefer to directly display the new entry modal when clicking on a relation field. Our goal is to facilitate the editors lives and thus avoid multiple modal nesting... (See below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your advice. Peace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TArlY.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TArlY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4767" LastActivityDate="2016-02-19T02:03:25.287" Title="Display a new entry modal when clicking on a relation field" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13759" PostTypeId="1" AcceptedAnswerId="13768" CreationDate="2016-02-18T14:21:31.720" Score="1" ViewCount="381" Body="&lt;p&gt;I'm having some trouble on a fresh install of Craft. I've uploaded all the files to my server and moved &lt;code&gt;index.php&lt;/code&gt; (etc) out of the &lt;code&gt;public&lt;/code&gt; folder and into the root directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also changed &lt;code&gt;index.php&lt;/code&gt;'s &lt;code&gt;$craftPath&lt;/code&gt; to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = './craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm still getting a 404 error on the homepage. I've set permissions on the folders, but still nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My file structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UQw5Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UQw5Y.png&quot; alt=&quot;FTP&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions..?&lt;/p&gt;&#xA;" OwnerUserId="4770" LastActivityDate="2016-02-19T02:25:07.353" Title="404 error on Craft homepage" Tags="&lt;error-message&gt;&lt;404&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13760" PostTypeId="2" ParentId="13759" CreationDate="2016-02-18T14:35:25.987" Score="2" Body="&lt;p&gt;Change this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = './craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = 'craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-02-18T14:35:25.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13761" PostTypeId="2" ParentId="13754" CreationDate="2016-02-18T15:35:24.080" Score="3" Body="&lt;p&gt;Josh Angell's suggestion did work, I was just testing it on an entry that already had been updated with a NULL author. (Thanks Josh!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the record, I used &lt;code&gt;$currentAuthor = $currentKit-&amp;gt;authorId;&lt;/code&gt; to get my previous author, and then set the author with &lt;code&gt;$kit-&amp;gt;authorId = $currentAuthor&lt;/code&gt;. This does seem to maintain the author entirely. &lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="144" LastEditDate="2016-02-18T17:21:29.917" LastActivityDate="2016-02-18T17:21:29.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13763" PostTypeId="2" ParentId="5380" CreationDate="2016-02-18T18:46:32.440" Score="3" Body="&lt;p&gt;Add &lt;code&gt;replaceDivs: false&lt;/code&gt; only once in your JSON config and do not forget &lt;strong&gt;&lt;em&gt;the comma&lt;/em&gt;&lt;/strong&gt; at the end of each settings row.&lt;/p&gt;&#xA;" OwnerUserId="4772" LastActivityDate="2016-02-18T18:46:32.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13764" PostTypeId="1" CreationDate="2016-02-18T18:54:52.227" Score="1" ViewCount="132" Body="&lt;p&gt;I have a rich text field with a handle of &lt;code&gt;myTextField&lt;/code&gt; that I have included in a global set called &lt;code&gt;firstGlobalSet&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What If I created another global set called &lt;code&gt;secondGlobalSet&lt;/code&gt; and included the same field &lt;code&gt;myTextField&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I get the correct field from the correct global set based on url segment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;code&gt;mysite.com/first&lt;/code&gt; or &lt;code&gt;mysite.com/second&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-02-18T19:06:24.053" LastActivityDate="2016-02-18T19:06:24.053" Title="How can I get a field's value from a global based on a url segment?" Tags="&lt;field&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13765" PostTypeId="2" ParentId="13764" CreationDate="2016-02-18T19:04:39.993" Score="2" Body="&lt;p&gt;You will need to access a few things. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The url segment you need (for example the last segment)&lt;/li&gt;&#xA;&lt;li&gt;The global set name&lt;/li&gt;&#xA;&lt;li&gt;The field handle name&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getLastSegment&quot; rel=&quot;nofollow&quot;&gt;getLastSegment&lt;/a&gt; to access the last url segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the global set names above let's say I have a url like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/first&#xA;&#xA;{% set segment = craft.request.getLastSegment() %}  // first&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I've got a global set called &lt;code&gt;firstGlobalSet&lt;/code&gt;, and now I've got &lt;code&gt;first&lt;/code&gt;. We just need to put them together. You can use Craft's &#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.globals#getSetByHandle&quot; rel=&quot;nofollow&quot;&gt;getSetByHandle&lt;/a&gt; method to access the global set via its handle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set global = craft.globals.getSetByHandle(segment ~ 'GlobalSet') %}&#xA;{{ global }} // firstGlobalSet&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now that we've got the correct global set, we can get to the field we need. In this case it's &lt;code&gt;myTextField&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ global.myTextField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-18T19:04:39.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13766" PostTypeId="2" ParentId="13402" CreationDate="2016-02-18T20:55:43.523" Score="2" Body="&lt;p&gt;Imperavi fixed this in Redactor II 1.2.2, and we included that update in &lt;a href=&quot;https://craftcms.com/changelog#build2763&quot; rel=&quot;nofollow&quot;&gt;Craft 2.5.2763&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-02-18T20:55:43.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13767" PostTypeId="1" AcceptedAnswerId="13777" CreationDate="2016-02-18T21:13:49.927" Score="2" ViewCount="890" Body="&lt;p&gt;&lt;code&gt;craft.request.getQuery()&lt;/code&gt; returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array (size=5)&#xA;  'tags' =&amp;gt; string 'anxiety' (length=7)&#xA;  'maxPrice' =&amp;gt; string '' (length=0)&#xA;  'sessions' =&amp;gt; &#xA;    array (size=4)&#xA;      0 =&amp;gt; string 'email' (length=5)&#xA;      1 =&amp;gt; string 'chat' (length=4)&#xA;      2 =&amp;gt; string 'skype' (length=5)&#xA;      3 =&amp;gt; string 'phone' (length=5)&#xA;  'hours' =&amp;gt; &#xA;    array (size=3)&#xA;      0 =&amp;gt; string 'office' (length=6)&#xA;      1 =&amp;gt; string 'evenings' (length=8)&#xA;      2 =&amp;gt; string 'weekends' (length=8)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas &lt;code&gt;craft.request.getParam()&lt;/code&gt; throws an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;PHP warning&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Missing argument 1 for Craft\HttpRequestVariable::getParam(), called in /home/vagrant/Sites/counselling-anywhere/craft/app/vendor/twig/twig/lib/Twig/Template.php on line 609 and defined&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This should have changed in &lt;a href=&quot;https://craftcms.com/changelog#build2465&quot; rel=&quot;nofollow&quot;&gt;Build #2465&lt;/a&gt; right? I'm assuming it'll still work the same, but it's confusing that they don't return the same results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this by design?&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2016-02-19T11:17:43.523" Title="Empty .getParam() does not return an array with dump()" Tags="&lt;array&gt;&lt;request&gt;&lt;params&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13768" PostTypeId="2" ParentId="13759" CreationDate="2016-02-18T23:03:08.283" Score="2" Body="&lt;p&gt;Contacted my host and for some reason PHP was not enabled as default on my account. This solved the problem.&lt;/p&gt;&#xA;" OwnerUserId="4770" LastEditorUserId="125" LastEditDate="2016-02-19T02:25:07.353" LastActivityDate="2016-02-19T02:25:07.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13769" PostTypeId="2" ParentId="13757" CreationDate="2016-02-19T02:03:25.287" Score="3" Body="&lt;p&gt;I'd rather look into nesting Super Table fields within your Matrix block types than relating Entries. The Entry element type and its relationship field come with a lot of inappropriate UI for the use case you're trying to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to write a plugin that provides its own element type and relationship field / modal UI.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-19T02:03:25.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13770" PostTypeId="1" AcceptedAnswerId="13771" CreationDate="2016-02-19T02:52:55.233" Score="6" ViewCount="248" Body="&lt;p&gt;Here's a basic example of using nested &lt;code&gt;extends&lt;/code&gt; in Twig. I figured this is a probably common use-case. You have a very general &lt;code&gt;_layout.html&lt;/code&gt; that contains your common CSS, JS, meta tags, etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# _layout.html #}&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  &amp;lt;meta charset=&quot;UTF-8&quot;&amp;gt;&#xA;  &amp;lt;title&amp;gt;{{title}}&amp;lt;/title&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;  {% block content %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you have a &lt;code&gt;_subpage.html&lt;/code&gt; template that shapes the way all your subpages should look (main content area, sidebar, etc).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# _subpage.html #}&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;  &amp;lt;main&amp;gt;&#xA;    {% block subpageContent %}{% endblock %}&#xA;  &amp;lt;/main&amp;gt;&#xA;&#xA;  &amp;lt;aside&amp;gt;&#xA;    {% block subpageSidebar %}{% endblock %}&#xA;  &amp;lt;/aside&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I extend that &lt;code&gt;_subpage.html&lt;/code&gt; in &lt;code&gt;about.html&lt;/code&gt; and grab the blocks that belong to the &lt;code&gt;_subpage.html&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# about.html #}&#xA;{% extends &quot;_subpage&quot; %}&#xA;{% set title = &quot;About&quot; %}&#xA;&#xA;{% block subpageContent %}&#xA;  &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestiae cupiditate suscipit, debitis accusantium tenetur impedit, veritatis id placeat, dolor hic temporibus architecto quas atque sunt officiis corrupti voluptatibus expedita. Assumenda!&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block subpageSidebar %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Subpage Link 1&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Subpage Link 2&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Subpage Link 3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I realize you &lt;em&gt;can&lt;/em&gt; use nested extends in Twig, but I'm entirely sure if I &lt;em&gt;should&lt;/em&gt;. Is this a maintenance nightmare? Does it take a performance hit to do this? What's the best practice for template relationships?&lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2016-02-19T03:09:49.333" Title="Is using nested extends a wise idea or will it be a performance/maintenance nightmare?" Tags="&lt;templating&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13771" PostTypeId="2" ParentId="13770" CreationDate="2016-02-19T03:09:49.333" Score="4" Body="&lt;p&gt;I like to have the document skeleton with the head, scripts etc. in a _base.html template and if there's more than one basic page layout (think sidebars etc.) I additionally extend it with _layout-a.html, _layout-b.html, templates. Everything else I use includes for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The templates are being transpiled down to PHP and cached, so there should not be any measurable performance influence really.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-19T03:09:49.333" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13772" PostTypeId="1" AcceptedAnswerId="13773" CreationDate="2016-02-19T04:47:11.607" Score="2" ViewCount="120" Body="&lt;p&gt;I am trying to call &lt;code&gt;$states = craft()-&amp;gt;commerce_states-&amp;gt;getAllStates();&lt;/code&gt; from within my own plugin, via an ajax request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;    return $this-&amp;gt;returnJson(['states' =&amp;gt; craft()-&amp;gt;commerce_states-&amp;gt;getAllStates()]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will return this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object {states: Array[72]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, as I'm walking myself through it, I can see that the original call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var states = {{ craft.commerce.statesArray|json_encode|raw }};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gives me these objects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object {13: Object, 38: Object, 233: Object}&#xA;Object {13: Object, 38: Object, 233: Object}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's pretty obvious i'm not calling the correct method. I am using &lt;a href=&quot;http://requirejs.org/&quot; rel=&quot;nofollow&quot;&gt;requirejs&lt;/a&gt; within my project and having the javascript right in the template is returning errors - it can't access jquery. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-02-19T17:10:58.520" LastActivityDate="2016-02-19T17:10:58.520" Title="With Craft Commerce, how can I call getAllStates from my own plugin via ajax?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13773" PostTypeId="2" ParentId="13772" CreationDate="2016-02-19T05:08:59.703" Score="2" Body="&lt;p&gt;Instead of calling &lt;code&gt;getAllStates()&lt;/code&gt; to get the same data back as the twig call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var states = {{ craft.commerce.statesArray|json_encode|raw }};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within your plugin you need to call &lt;code&gt;getStatesGroupedByCountries()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;    return $this-&amp;gt;returnJson(['states' =&amp;gt; craft()-&amp;gt;commerce_states-&amp;gt;getStatesGroupedByCountries()]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-19T05:08:59.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13776" PostTypeId="1" AcceptedAnswerId="13791" CreationDate="2016-02-19T11:15:59.417" Score="3" ViewCount="1407" Body="&lt;p&gt;I have 2 sections, events and activities, that share many fields. But activities doesn't have an eventLevel field as there isn't a level. eventLevel is a radio fieldtype. So I want to insert the eventLevel when it exists and if it doesn't just insert the text &quot;Activity&quot;. I've tried various tests on if eventLevel is defined, is null, and length. If there is an eventLevel it displays, but if it's an activity I end up with an empty cell.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.find({section:'events,activities', eventDate : &quot;&amp;gt;= &quot; ~ now.w3cDate() , order:'eventDate'}) %}&#xA;{% if events %}&#xA;    {% for entry in events %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td class=&quot;col-date&quot;&amp;gt;{{ entry.eventDate.format('D j M') }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;More info about {{ entry.eventName }}&quot;&amp;gt;{{ entry.eventName }}&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ entry.nearestTown }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{% if entry.eventLevel is defined %}{{ entry.eventLevel }}{% else %}Activity{% endif %}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried the twig default filter with the same result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.eventLevel|default('Activity') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-02-19T18:30:28.597" Title="Problem with IF conditional not working" Tags="&lt;conditional&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13777" PostTypeId="2" ParentId="13767" CreationDate="2016-02-19T11:17:43.523" Score="3" Body="&lt;p&gt;The behaviour you're seeing is by design – &lt;a href=&quot;https://craftcms.com/classreference/variables/HttpRequestVariable#getQuery-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getQuery()&lt;/code&gt;&lt;/a&gt; will return all &lt;code&gt;GET&lt;/code&gt; variables if it's called without arguments, whereas &lt;a href=&quot;https://craftcms.com/classreference/variables/HttpRequestVariable#getParam-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getParam()&lt;/code&gt;&lt;/a&gt; requires the &lt;code&gt;name&lt;/code&gt; argument – i.e. &lt;code&gt;craft.request.getParam('foo')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The changelog notes for &lt;a href=&quot;https://craftcms.com/changelog#build2465&quot; rel=&quot;nofollow&quot;&gt;build 1.3.2465&lt;/a&gt; does reference a couple of issues related to these methods, but nothing suggesting any changes in regards to the required &lt;code&gt;name&lt;/code&gt; argument for &lt;code&gt;getParam()&lt;/code&gt;. Unfortunately, the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release&quot; rel=&quot;nofollow&quot;&gt;GitHub repo for Craft builds&lt;/a&gt; doesn't go back as far as 1.3.2465, so I'm unable to verify this though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-02-19T11:17:43.523" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13778" PostTypeId="1" CreationDate="2016-02-19T11:23:16.193" Score="2" ViewCount="108" Body="&lt;p&gt;What’s the best way to validate a user registration form to make sure that at least one of two fields is not empty? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried a very simple controller but can’t get this to work past the point of trying to save the user. Any pointers with this method or for a different method entirely?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionIndex() {&#xA;&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $fields = craft()-&amp;gt;request-&amp;gt;getPost('fields');&#xA;&#xA;    $customField1 = $fields['customField1'];&#xA;    $customField2 = $fields['customField2'];&#xA;&#xA;    $user = new UserModel();&#xA;    $user-&amp;gt;email = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;    $user-&amp;gt;password = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;    $user-&amp;gt;setContentFromPost('fields');&#xA;&#xA;    if ($customField1 != '' || $customField2 != '') {&#xA;&#xA;        // RETURN CUSTOM ERROR&#xA;&#xA;    }&#xA;&#xA;    // OTHERWISE SUBMIT USER REGISTRATION REQUEST &#xA;    // AND RETURN ANY ERRORS&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-02-19T12:59:51.483" LastActivityDate="2016-02-19T14:35:24.573" Title="Conditional for user registration fields" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;registration&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13779" PostTypeId="2" ParentId="13776" CreationDate="2016-02-19T11:29:27.850" Score="3" Body="&lt;p&gt;How about a conditional to check the entry.type rather than the field? Perhaps more appropriate in this case rather than checking if the field is defined. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type.handle == 'events' %}&#xA;    {{ entry.eventLevel }}&#xA;{% else %}&#xA;    Activity&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, check the section rather than the entry type with &lt;code&gt;entry.section.handle&lt;/code&gt; instead of &lt;code&gt;entry.type.handle&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-02-19T13:27:43.553" LastActivityDate="2016-02-19T13:27:43.553" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13780" PostTypeId="2" ParentId="13776" CreationDate="2016-02-19T11:36:55.443" Score="4" Body="&lt;p&gt;To test if a field exists, you'll have to use brackets notation, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry['eventLevel'] is defined %}&#xA;   ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the field exists, but there isn't a selected option, the Radio FieldType returns an empty string, so you also need to test for &lt;code&gt;entry.eventLevel != ''&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting it together, I believe a ternary conditional would perhaps be the most succinct solution in your particular case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;td&amp;gt;{{ entry['eventLevel'] is defined and entry.eventLevel != '' ? entry.eventLevel : 'Activity' }}&amp;lt;/td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does is to first check if the &lt;code&gt;entry&lt;/code&gt; has a property &lt;code&gt;'eventLevel'&lt;/code&gt; – the brackets notation is needed here, to avoid Twig throwing an exception if the &lt;code&gt;entry&lt;/code&gt; variable &lt;em&gt;doesn't&lt;/em&gt; have the property – before checking if the attribute's value is not an empty string. If both of those statements evaluate to &lt;code&gt;true&lt;/code&gt;, then the attribute's value is printed; if not, the string &lt;code&gt;Activity&lt;/code&gt; outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a bit beside the point, but if you're wondering about the syntax here, the so called &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;ternary operator&lt;/a&gt; (e.g. &lt;code&gt;{{ variable ? 'yes' : 'no' }}&lt;/code&gt;) is just a kind of a short-hand way to write conditionals. Ternary operators are supported in many programming languages (including JavaScript and PHP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to, you could write out the full conditional and it would work exactly the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;td&amp;gt;&#xA;    {% if entry['eventLevel'] is defined and entry.eventLevel != '' %}&#xA;       {{ entry.eventLevel }}&#xA;    {% else %}&#xA;       Activity&#xA;    {% endif %}&#xA;&amp;lt;/td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd argue that a ternary operator is more readable, shorter and also makes it easier to deal with potential whitespace issues etc. when inlined in markup like this, though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-19T17:02:52.640" LastActivityDate="2016-02-19T17:02:52.640" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="13781" PostTypeId="1" AcceptedAnswerId="13783" CreationDate="2016-02-19T12:24:31.013" Score="29" ViewCount="13706" Body="&lt;p&gt;Is there a way to reset an admin account's password by modifying the MySQL directly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found the &lt;code&gt;craft_users&lt;/code&gt; table where the hashed password is stored but I don't know how to hash a string so that it will be read correctly by Craft.&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2020-07-28T05:41:02.990" Title="Reset password with MySQL" Tags="&lt;password&gt;&lt;mysql&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="28" ContentLicense="CC BY-SA 3.0" />
  <row Id="13782" PostTypeId="1" AcceptedAnswerId="13787" CreationDate="2016-02-19T12:32:28.047" Score="1" ViewCount="570" Body="&lt;p&gt;Firstly, thanks very much for the help I've already had from members here. It's been straightforward and easy, even for a newbie like me, to understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I'm working on editing one of the last pages on a client's site, the Contact Us page and am hoping to be able to use the Pixel &amp;amp; Tonic, Contact Form plugin. But, after some inspection of the Readme and the files that run the plugin, I have been unable to find the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; How do I create/edit the error messages that the form generates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Can I use the form to allow a user to enter their phone number? If so, what should the code look like in the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the final form to look like the screenshot below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8cMln.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8cMln.png&quot; alt=&quot;Contact Form Preview&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help that anyone can provide would be most appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6627/contact-form-plugin-from-pixel-tonic?rq=1&quot;&gt;this post&lt;/a&gt;, I've realised how easy it is to add a new field for the phone number (and assume I add the code wherever I want the new field to appear(??)), but am still clueless about the error messages.&lt;/p&gt;&#xA;" OwnerUserId="4736" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-19T15:30:50.220" Title="Editing error messages and allowing a phone number input in a P&amp;T Contact Form" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13783" PostTypeId="2" ParentId="13781" CreationDate="2016-02-19T12:49:20.007" Score="32" Body="&lt;p&gt;Craft uses Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CPasswordHelper&quot;&gt;&lt;code&gt;CPasswordHelper::hashPassword&lt;/code&gt;&lt;/a&gt; which is a Blowfish hash algorithm, using PHP's &lt;a href=&quot;http://php.net/crypt&quot;&gt;&lt;code&gt;crypt&lt;/code&gt;&lt;/a&gt; function with a &quot;blowFishHashCost&quot;, which is a setting that can be found through &lt;code&gt;craft()-&amp;gt;config-&amp;gt;get('blowfishHashCost')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the &lt;a href=&quot;https://craftcms.com/classreference/services/SecurityService#hashPassword-detail&quot;&gt;&lt;code&gt;SecurityService::hashPassword&lt;/code&gt;&lt;/a&gt; function to generate a new password, echo it, and update it in the DB manually: &lt;code&gt;craft()-&amp;gt;security-&amp;gt;hashPassword('NewPassword');&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-19T12:49:20.007" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13784" PostTypeId="2" ParentId="13778" CreationDate="2016-02-19T14:35:24.573" Score="2" Body="&lt;p&gt;Looks like I needed to set &lt;code&gt;$user-&amp;gt;username = craft()-&amp;gt;request-&amp;gt;getPost('email');&lt;/code&gt; for my attempt to work.&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2016-02-19T14:35:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13785" PostTypeId="2" ParentId="13756" CreationDate="2016-02-19T15:00:07.657" Score="3" Body="&lt;p&gt;Not that I know of or can find, Marco. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be interesting to see if anyone else knows of one. I guess one challenge would be to define which frame of the video should be used as a thumbnail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I typically use YouTube or Vimeo for client videos - as you know, the 'cover images' are available for use, from both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might help: &lt;a href=&quot;https://stackoverflow.com/questions/12788287/how-to-get-hq-youtube-thumbnails&quot;&gt;https://stackoverflow.com/questions/12788287/how-to-get-hq-youtube-thumbnails&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, often times, the client prefers to upload an image as they have more control and better quality images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-02-19T15:00:07.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13786" PostTypeId="1" AcceptedAnswerId="13788" CreationDate="2016-02-19T15:05:39.463" Score="2" ViewCount="400" Body="&lt;p&gt;I'm trying to make a query which has 2 conditions who has to be true both. In PHP I should use &amp;amp;&amp;amp; to get this. startdate &amp;lt;= now &amp;amp;&amp;amp; enddate &gt;= now. How do I write this in Craft twig?&#xA;Tnx in advance!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set current = craft.entries.find({&#xA;    section:'exhibitions', &#xA;    startdate : &quot;&amp;lt;= &quot; ~ now.w3c(),&#xA;    enddate : &quot;&amp;gt;= &quot; ~ now.w3c(), &#xA;    order:'startdate'}) &#xA;%}&#xA;&#xA;{% if current|length %}&#xA;    Current exhibitions&#xA;    {% for exhibition in current %}&#xA;        {{ exhibition.title }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4775" LastEditorUserId="4775" LastEditDate="2016-02-19T15:33:09.257" LastActivityDate="2016-02-19T15:43:09.173" Title="How to write query with startdate &lt;= now &amp;&amp; enddate &gt;= now?" Tags="&lt;entries&gt;&lt;queries&gt;&lt;set&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13787" PostTypeId="2" ParentId="13782" CreationDate="2016-02-19T15:30:50.220" Score="0" Body="&lt;p&gt;I found it! It took quite a bit of digging about, but eventually I found the files I needed to edit. In case anyone else is struggling with this same issue, here's what you need to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look in the folder 'craft/app/framework/validators/' for a file called 'CRequiredValidator.php'. Open the file in a text editor and look for the text: 'cannot be blank'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of this line reads: '{attribute} cannot be blank.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can change the text 'cannot be blank' to whatever you like and can move '{attribute}' to after the alternative text that you've put in without breaking anything. Save and upload your altered file to the correct location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, look in the folder 'contactform/models/' for a file called 'ContactFormModel.php' (probably the only one there).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, it has the following written into it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    return array(&#xA;        'fromName'          =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Your Name'),&#xA;        'fromEmail'         =&amp;gt; array(AttributeType::Email,  'required' =&amp;gt; true, 'label' =&amp;gt; 'Your Email'),&#xA;        'message'           =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true, 'label' =&amp;gt; 'Message'),&#xA;        'messageFields'     =&amp;gt; array(AttributeType::Mixed),&#xA;        'subject'           =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Subject'),&#xA;        'attachment'        =&amp;gt; AttributeType::Mixed,&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bits you need to alter to complete the customised error messages are found after &lt;code&gt;'label' =&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Save and upload your second altered file to the correct location, and check out the new error messages for your form!&lt;/p&gt;&#xA;" OwnerUserId="4736" LastActivityDate="2016-02-19T15:30:50.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13788" PostTypeId="2" ParentId="13786" CreationDate="2016-02-19T15:43:09.173" Score="3" Body="&lt;p&gt;ElementCriteriaModel parameters always add up to further filter down the results, which means an element has to be truthy for each one of them to be returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your params basically look right for what you're trying to achieve. The only thing that might mess with the results is the for me unusual use of the &lt;code&gt;w3c&lt;/code&gt; methods on the DateTime objects, which might output in a format not supportet by the criteria model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try one of the following variants instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;&amp;lt;= &quot; ~ now.iso8601()&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;&quot;&amp;lt;= &quot; ~ now|date('c')&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;&quot;&amp;lt;= &quot; ~ now|date('U')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not interested in ouputting the time, you could also just use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;&amp;lt;= &quot; ~ now&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which outputs the same as &lt;code&gt;&quot;&amp;lt;= &quot; ~ now|date('Y-m-d')&lt;/code&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-19T15:43:09.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13790" PostTypeId="2" ParentId="685" CreationDate="2016-02-19T17:04:26.377" Score="7" Body="&lt;p&gt;In case anyone is wondering how you get the rest of the text – here is an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Split paragraphs using a limit of 2 #}&#xA;{% set paragraphs = block.body|split('&amp;lt;/p&amp;gt;', 2) %}&#xA;&#xA;{# Get first paragraph and add the missing closing tag  #}&#xA;{% set firstParagraph = paragraphs|first ~ '&amp;lt;/p&amp;gt;' %}&#xA;&#xA;{{ firstParagraph|raw }}&#xA;&#xA;{# The rest of the text is here, due to the limit in the split filter #}&#xA;{{ paragraphs|last|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-02-19T17:04:26.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13791" PostTypeId="2" ParentId="13776" CreationDate="2016-02-19T18:25:22.330" Score="2" Body="&lt;p&gt;Is there a chance you once had this field &lt;em&gt;added to both sections&lt;/em&gt;? Because this all looks like there's data still left set and you're only expecting &quot;eventLevel&quot; fields to be empty / null for your &quot;activities&quot; section entries, but in fact they are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this SE for &lt;em&gt;why&lt;/em&gt; this can happen:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4869/entries-retain-field-data-that-has-been-removed-from-entry-type-layout&quot;&gt;Entries retain field data that has been removed from entry type layout&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve the problem you could now clear the data, by (a) recreating the radio field with the same settings but with a different handle / name, go through your entries to copy the values, then delete the old field and give the new one the handle and name of the old one. Or you could (b) directly edit the values in the database, the problem with this approach is, you can't sort the records by section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would also mean alot of work and I think it's actually not worth it at all, because there's a better way  to distinguish whether to show the field's value or not: just check for the entry's section!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I would do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isEvent = entry.section.handle == 'events' %}&#xA;{% set isActivity = entry.section.handle == 'activities' %}&#xA;&#xA;{{ isEvent ? entry.eventLevel : 'Activity' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You just evaluate &lt;code&gt;entry.section.handle == 'events'&lt;/code&gt; and store the result as a variable at the top of your template code. The variable is now available troughout the template and it is now very easy to use this info. You currently only need it once in your code, but this probably changes as you progress with the project.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-19T18:30:28.597" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13792" PostTypeId="2" ParentId="13589" CreationDate="2016-02-19T18:31:49.527" Score="1" Body="&lt;p&gt;Brad, I realize my initial question is a bit vague, oops! I did however find a solution to why my localized slugs for my plugin element weren't being saved as a unique string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I traced through &lt;code&gt;ElementHelper::setUniqueUri()&lt;/code&gt; and figured out I was missing the &lt;code&gt;getUrlFormat()&lt;/code&gt; function. Also to make sure I include &lt;code&gt;{slug}&lt;/code&gt; in my &lt;code&gt;urlFormat&lt;/code&gt; string in this particular case.&lt;/p&gt;&#xA;" OwnerUserId="3905" LastActivityDate="2016-02-19T18:31:49.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13793" PostTypeId="1" AcceptedAnswerId="13799" CreationDate="2016-02-19T18:43:03.547" Score="4" ViewCount="377" Body="&lt;p&gt;We're building a site with a recipes catalog and we'd like to allow logged in users to &quot;star&quot; an entry/recipe and then be able to view a list of their &quot;starred&quot; or &quot;favorited&quot; entries. Any suggestions on how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2016-02-19T19:44:07.910" Title="Allow user to mark entry as favorite, starred, or saved for later" Tags="&lt;entries&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13794" PostTypeId="2" ParentId="309" CreationDate="2016-02-19T18:54:49.197" Score="0" Body="&lt;p&gt;I just came across this feature request on &lt;a href=&quot;http://feedback.craftcms.com/&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/&lt;/a&gt; and I think this is pretty much the feature I had in mind when asking the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/11575767-add-lazy-cache-rebuilding-to-the-cache-tag&quot; rel=&quot;nofollow&quot;&gt;Add lazy cache rebuilding to the cache tag&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: please don't upvote this answer, but do so on the feature request. :D&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-02-19T18:54:49.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13795" PostTypeId="2" ParentId="13793" CreationDate="2016-02-19T19:03:09.320" Score="2" Body="&lt;p&gt;This definitely sounds like plugin territory. I'd recommend &lt;a href=&quot;https://github.com/lorigoldberg/curate&quot; rel=&quot;nofollow&quot;&gt;Curate&lt;/a&gt;, by Lori Goldberg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* Disclaimer: I haven't personally tried it.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-19T19:03:09.320" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13796" PostTypeId="1" CreationDate="2016-02-19T19:09:47.540" Score="3" ViewCount="1511" Body="&lt;p&gt;Trying to upload images and get the following error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upload failed for &quot;filename&quot;. The error message was &quot;Error uploading the file: The folder &quot;/var/www/html/imgs/logos/&quot; is not writable&quot;&lt;/p&gt;&#xA;" OwnerUserId="4776" LastActivityDate="2016-02-19T19:27:55.680" Title="Image upload failed- file not writable" Tags="&lt;image&gt;&lt;upload&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13798" PostTypeId="2" ParentId="13796" CreationDate="2016-02-19T19:27:55.680" Score="3" Body="&lt;p&gt;On the &lt;strong&gt;server&lt;/strong&gt;, check:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if the folder exists? &lt;/li&gt;&#xA;&lt;li&gt;Check the folder permissions are set to 777 (could probably reduce to 755)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Within &lt;strong&gt;Craft&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In: &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Assets&lt;/strong&gt; &gt; &lt;strong&gt;Asset Sources&lt;/strong&gt; - make sure &lt;strong&gt;File System Path&lt;/strong&gt; and &lt;strong&gt;URL&lt;/strong&gt; fields, have no leading forward slashes e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imgs/logos/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-02-19T19:27:55.680" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13799" PostTypeId="2" ParentId="13793" CreationDate="2016-02-19T19:44:07.910" Score="2" Body="&lt;p&gt;In addition to Lindsey's recommendation, &lt;a href=&quot;https://github.com/dukt/craft-like&quot; rel=&quot;nofollow&quot; title=&quot;Craft Like&quot;&gt;Craft Like&lt;/a&gt; by Dukt might also be useful for this. It was updated recently for 2.5 and is open source.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-02-19T19:44:07.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13800" PostTypeId="2" ParentId="13743" CreationDate="2016-02-19T19:59:19.350" Score="2" Body="&lt;p&gt;Completely untested, but you may consider setting up each site as environment using &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;Multi-Environment Config&lt;/a&gt; approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in each domain's site root directory you'll need to place &lt;code&gt;.htaccess&lt;/code&gt; and &lt;code&gt;index.php&lt;/code&gt; like this is done for &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-5-set-up-the-files&quot; rel=&quot;nofollow&quot;&gt;Localized Sites&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can configure URLs for each site pages in &lt;code&gt;routes.php&lt;/code&gt; config file (so you can use different templates for different sites). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is of course not as flexible as MSM in EE, but you'll have the 2 sites in one control panel and save on license cost.&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-02-19T19:59:19.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13802" PostTypeId="2" ParentId="12405" CreationDate="2016-02-19T23:31:25.190" Score="2" Body="&lt;p&gt;In a previous project when I was in dev mode, the website was very slow. But when I shut this down it was fast again. Could this be a solution?&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2016-02-19T23:31:25.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13803" PostTypeId="2" ParentId="8719" CreationDate="2016-02-20T07:49:29.370" Score="1" Body="&lt;p&gt;This plugin is without an API, but also very handy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/ImageResizer&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/ImageResizer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2016-02-20T07:49:29.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13804" PostTypeId="2" ParentId="12666" CreationDate="2016-02-20T08:01:47.570" Score="1" Body="&lt;p&gt;The content builder is very nice. I implemented this code in my project:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in content.image %}&#xA;    {% set imageTransform = { &#xA;        width: 1000, &#xA;        height: 700, &#xA;        mode: 'crop', &#xA;        position: content.focalpoint &#xA;    } %}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl(imageTransform) }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to: &lt;a href=&quot;http://craftcookbook.net/recipes/120&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/120&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2016-02-20T08:01:47.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13806" PostTypeId="1" AcceptedAnswerId="13809" CreationDate="2016-02-20T21:25:01.183" Score="0" ViewCount="76" Body="&lt;p&gt;I am getting a list of all products for a specific type within commerce. All is well &amp;amp; working great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know how I can dictate order. In my case, I always want the cheapest product first; the most expensive last. A perfect example would be if I were purchasing a level of membership in that &quot;level&quot; is a product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on my product index page:&#xA;&lt;code&gt;mysite.com/memberships&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to always have the cheapest membership listed first, all the way up to the most expensive.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-21T13:47:03.940" Title="How can I specify order when getting all products of a given type?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13807" PostTypeId="1" CreationDate="2016-02-21T03:03:06.913" Score="1" ViewCount="110" Body="&lt;p&gt;I am new to Craft CMS, now I run a demo site of &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow&quot;&gt;Happy Lager&lt;/a&gt;, wanna add a web crawler to fetch some data to my db. I should develop a plugin to complete this feature, but if I need to change the &lt;code&gt;craft/app&lt;/code&gt; folder? or how my services in plugin called by my site? call from the &lt;code&gt;craft/app&lt;/code&gt;? please help me,thank you!&lt;/p&gt;&#xA;" OwnerUserId="4781" LastEditorUserId="22" LastEditDate="2017-05-09T22:20:27.107" LastActivityDate="2017-05-09T22:20:27.107" Title="When I want to add some features to my Craft site, do I need to modify the files in the craft/app folder?" Tags="&lt;plugin-development&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13808" PostTypeId="2" ParentId="13807" CreationDate="2016-02-21T03:58:17.693" Score="6" Body="&lt;p&gt;Short answer... &lt;strong&gt;no!!!&lt;/strong&gt; You don't ever want to make changes to the &lt;code&gt;craft/app&lt;/code&gt; folder. Any changes you make in the &lt;code&gt;app&lt;/code&gt; folder will be overwritten when you update Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need any custom behavior, the correct way to do it is to &lt;strong&gt;write a custom plugin&lt;/strong&gt;. Your plugin will be safe outside of the Craft core, and will survive any Craft updates intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read up on the complete documentation for &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot;&gt;creating a Craft plugin&lt;/a&gt;. You can also download the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;Business Logic template&lt;/a&gt; to see what some basic components look like. Or even better, spin up a custom plugin using the fantastic &lt;a href=&quot;http://pluginfactory.io/&quot;&gt;Plugin Factory&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-21T03:58:17.693" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13809" PostTypeId="2" ParentId="13806" CreationDate="2016-02-21T13:47:03.940" Score="1" Body="&lt;p&gt;As an element, it has the same &lt;code&gt;order&lt;/code&gt; criteria as entries, assets, &amp;amp;c. So you should have no problem using &lt;code&gt;order('defaultPrice')&lt;/code&gt; in your criteria. That's for price low-to-high. For high-to-low, you add &lt;code&gt;desc&lt;/code&gt; to the criteria. So: &lt;code&gt;order('defaultPrice desc')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-02-21T13:47:03.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13810" PostTypeId="1" CreationDate="2016-02-21T16:09:08.913" Score="0" ViewCount="73" Body="&lt;p&gt;I've installed Craft Personal 2.5.2763, and have set up my own simple blog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each Entry in the Blog Channel, I've set up an Asset Field, which is used for the header image displayed on the blog entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like this Asset field to be optional, as I'll be displaying a default image if one isn't defined in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding an image to the field works great, but I'm seemingly unable to remove it once it has been assigned and saved when I go to edit the Entry and click the &quot;Remove&quot; icon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ocp1w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ocp1w.png&quot; alt=&quot;Screenshot of CP remove asset&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When clicking the Remove icon, The image disappears from the CP edit page as you'd expect, but when clicking &quot;Save&quot;, it seems the removal of that image is &lt;strong&gt;not&lt;/strong&gt; actually being saved, as it is still there when I go back in to edit the Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I've also found this issue on a normal Text field too. If you set the Text field to some data, save, then go back to edit, delete all text, save, then the data is not removed and the original data remains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong, or is this a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="4782" LastEditorUserId="4782" LastEditDate="2016-02-22T18:05:13.100" LastActivityDate="2016-02-23T13:55:53.247" Title="How to allow Asset removal in the Control Panel for an Entry" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13811" PostTypeId="1" AcceptedAnswerId="13812" CreationDate="2016-02-21T17:43:51.393" Score="1" ViewCount="421" Body="&lt;p&gt;Basically, for every entry that I add to my 'Portfolio' channel, it creates a sub-folder inside assets/portfolio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;assets/portfolio/entry-one&lt;/li&gt;&#xA;&lt;li&gt;assets/portfolio/entry-two&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On my portfolio page, for each entry I want to display the first image from its asset folder and also get the url of every image in the folder.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone think of a solution that would allow me to do this? Can't figure out how to target each individual folder.  I know you can target folders by ID, but unless this can be somehow done dynamically in a loop it will not suit this situation. &lt;/p&gt;&#xA;" OwnerUserId="4783" LastEditorUserId="57" LastEditDate="2016-02-22T17:20:53.677" LastActivityDate="2016-02-22T17:20:53.677" Title="How can I loop through a Channel entries asset folder?" Tags="&lt;assets&gt;&lt;forloop&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13812" PostTypeId="2" ParentId="13811" CreationDate="2016-02-21T19:00:32.633" Score="1" Body="&lt;p&gt;I'm not sure about displaying &quot;the first image from the asset folder&quot; but, you can display the first asset as it's situated in the entry itself. Would that work? Maybe something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assetFirst = entry.myAssetsField.first() %}&#xA;&#xA;{% if assetFirst %}&#xA;    {# or use getImg() (or either alias img/url): https://craftcms.com/docs/templating/assetfilemodel #}&#xA;    &amp;lt;img src=&quot;{{ assetFirst.getUrl({ height: 400 }) }}&quot; alt=&quot;image.title&quot;/&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% set assets = entry.assetsFieldHandle %}&#xA;&#xA;{% if assets | length %}&#xA;&#xA;    {% for asset in assets %}&#xA;        {# https://craftcms.com/docs/templating/assetfilemodel#simple-output #}&#xA;        &amp;lt;a href=&quot;{{ file.url }}&quot;&amp;gt;{{ file }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12" LastActivityDate="2016-02-21T19:00:32.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13813" PostTypeId="2" ParentId="13810" CreationDate="2016-02-21T22:24:20.767" Score="1" Body="&lt;p&gt;Does everything else seem to be working? Maybe try removing the field from your section and then re-add it?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also try clearing the caches: Settings -&gt; Clear Caches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft logs various things to &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt; If there's an error of some kind, maybe with your database, it'll show up there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't clear it up, shoot P&amp;amp;T a message and have them take a look at your install. You can do that right from the control panel.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-21T22:24:20.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13815" PostTypeId="1" AcceptedAnswerId="13870" CreationDate="2016-02-22T12:41:10.927" Score="10" ViewCount="2891" Body="&lt;p&gt;I'm trying to setup an Asset source on S3, but i'm having trouble getting the correct permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my current policy file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;    &quot;Version&quot;: &quot;2012-10-17&quot;,&#xA;    &quot;Statement&quot;: [&#xA;        {&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:ListAllMyBuckets&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: [&#xA;                &quot;arn:aws:s3:::&quot;&#xA;            ]&#xA;        },&#xA;        {&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:ListBucket&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: [&#xA;                &quot;arn:aws:s3:::bucketname&quot;&#xA;            ]&#xA;        },&#xA;        {&#xA;            &quot;Sid&quot;: &quot;Stmt1456139254000&quot;,&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:*&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: [&#xA;                &quot;arn:aws:s3:::bucketname/*&quot;&#xA;            ]&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me &quot;Permission denied&quot; when trying to list the buckets.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2019-07-17T06:42:07.273" Title="Correct IAM settings for Amazon S3 bucket" Tags="&lt;assets&gt;&lt;s3&gt;&lt;sources&gt;&lt;amazon&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13817" PostTypeId="1" CreationDate="2016-02-22T14:06:33.660" Score="3" ViewCount="187" Body="&lt;p&gt;I have a Joomla site with K2 installed, and a couple of thousands of articles (no custom fields) and corresponding images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a script to help migrate those into Craft? Or will I have to manually write something custom to move the content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="4788" LastActivityDate="2016-02-22T21:48:24.950" Title="Is there a tool to migrate Joomla/K2 entries into Craft?" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13818" PostTypeId="1" AcceptedAnswerId="13828" CreationDate="2016-02-22T14:15:38.410" Score="1" ViewCount="40" Body="&lt;p&gt;I have a large-ish site built with Joomla and K2, with articles stored in a hierarchy of categories..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the proposed way to recreate the Category hierarchy functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am interested in is that when a user opens a parent category, he sees all items stored in this category, plus all items stored in children categories.&#xA;If he opens a child category, he sees items stored only in this category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried a demo installation, and experimented a bit with section types and categories, but what I need is some kind of parent-child relation in Categories or Sections. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please help me clarify how these things are distinct and what would be best practice to achieve what I want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your time.&lt;/p&gt;&#xA;" OwnerUserId="4788" LastEditorUserId="142" LastEditDate="2016-02-22T20:34:55.087" LastActivityDate="2016-02-22T21:47:27.600" Title="Migrating Joomla K2 nested categories" Tags="&lt;categories&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13819" PostTypeId="2" ParentId="13817" CreationDate="2016-02-22T14:32:09.550" Score="6" Body="&lt;p&gt;I'm not sure there is anything specifically for importing from Joomla, but you could try the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot;&gt;Import&lt;/a&gt; plugin. Depending on the data format, you may also be able to use the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot;&gt;Feed Me&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Alternatively, a popular Craft CMS plugin maker (Barrel Strength Design) offers a commercial service to migrate/import data from Joomla -&gt; Craft CMS. It's called &lt;a href=&quot;http://thegreatmigration.net&quot;&gt;The Great Migration&lt;/a&gt;. (NOTE: I'm nothing to do with the service, I just had it bookmarked for future reference)&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="45" LastEditDate="2016-02-22T21:48:24.950" LastActivityDate="2016-02-22T21:48:24.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13820" PostTypeId="1" AcceptedAnswerId="13865" CreationDate="2016-02-22T16:34:59.633" Score="2" ViewCount="244" Body="&lt;p&gt;I have a dynamically generated sql. How can I know what the column names are, even if the database returns an empty result?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sql = &quot;select t.bar, count(o.foo) as amount&#xA;        from craft_table t join craft_otherTable o on t.id = o.id&quot;;&#xA;$resultset = craft()-&amp;gt;db-&amp;gt;createCommand($sql)-&amp;gt;queryAll(true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Java, i can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for(int i=0;i&amp;lt;resultset.getMetaData().getColumnCount();i++){&#xA;    columnNames.add(resultset.getMetaData().getColumnLabel(i))&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am looking for a similar solution in PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$command = craft()-&amp;gt;db-&amp;gt;createCommand($sql);&#xA;$command-&amp;gt;prepare();&#xA;var_dump($command-&amp;gt;getPdoStatement()-&amp;gt;getColumnMeta(0));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but the output is &lt;code&gt;bool(false)&lt;/code&gt;. I feel like I am missing something.&lt;/p&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2016-02-24T07:55:21.460" Title="Getting metadata/column names for empty resultset" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13821" PostTypeId="1" AcceptedAnswerId="13823" CreationDate="2016-02-22T18:37:32.357" Score="4" ViewCount="1569" Body="&lt;p&gt;Here's my current setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Blog (Channel)&lt;/strong&gt; - All of my blog posts will go here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Blog Landing (Single)&lt;/strong&gt; - This section only has one field - a &lt;em&gt;Featured Articles&lt;/em&gt; Entries field that lets me select 3 entries from the &quot;Blog&quot; channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what I want to do on the Blog Landing section is have a dedicated area for the 3 Featured articles (ones that I will choose from that &lt;em&gt;Featured Articles&lt;/em&gt; entries field), but then display the next 5 most recent articles that have &lt;strong&gt;not&lt;/strong&gt; been selected as a Featured article in a different area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've successfully outputted my Featured Articles with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featured = entry.featuredArticles %}&#xA;  {% for entry in featured %}&#xA;    {{ entry.title }}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can get my 5 most recent with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog') %}&#xA;  {% for entry in allEntries.limit(5) %}&#xA;   {{ entry.title }}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to exclude the entries from the &lt;em&gt;Featured Articles&lt;/em&gt; area from the output of the &lt;em&gt;Recent Articles&lt;/em&gt; area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So say I have 10 entries in my Blog channel, (Post 1 is most recent, Post 2 is second most recent, and so on), and I've selected Posts 2, 4, and 5 as my &quot;Featured&quot; articles, how do I get it so that the 5 &quot;Recent&quot; articles display Posts 1, 3, 6, 7, and 8 instead of Posts 1, 2, 3, 4, and 5?&lt;/p&gt;&#xA;" OwnerUserId="4789" LastActivityDate="2016-03-23T09:07:02.497" Title="Exclude &quot;featured&quot; entries from a &quot;recent&quot; entries {% for %} loop" Tags="&lt;entries-field&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13822" PostTypeId="1" AcceptedAnswerId="14789" CreationDate="2016-02-22T19:21:52.077" Score="3" ViewCount="168" Body="&lt;p&gt;For a JavaScript novice like myself, what steps would be involved in swapping out the hogan.js templating framework for something else? I have my eye on &lt;a href=&quot;http://paularmstrong.github.io/swig/&quot; rel=&quot;nofollow&quot;&gt;Swig&lt;/a&gt;, which comes with some 'twig-like' filters I need to utilize when outputting my search results.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="57" LastEditDate="2016-02-23T06:07:09.487" LastActivityDate="2016-04-25T16:37:53.887" Title="Swapping Hogan for other JavaScript template engine in the SearchPlus plugin" Tags="&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13823" PostTypeId="2" ParentId="13821" CreationDate="2016-02-22T19:37:19.577" Score="5" Body="&lt;p&gt;What you could do is get the ids of the featured element, and exclude those from the second craft.entries call. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the ids of the featured items you got above #}&#xA;{% set featuredIds = featured.ids() %}&#xA;&#xA;{# Get entries in section 'blog' which don't have an id in featuredIds #}&#xA;{% set allEntries = craft.entries.section('blog').id('and, not ' ~ featuredIds | join(', not ')) %}&#xA;&#xA;{# Loop and output #}&#xA;{% for entry in allEntries.limit(5) %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The use of the join filter may seem a bit cryptic. But, when excluding one id from a list of entries, you'd do &lt;code&gt;.id('not 3')&lt;/code&gt;. When excluding more than one, you need to specify the conditional first (the &lt;code&gt;and&lt;/code&gt; part) and then a comma separated list of &lt;code&gt;not (id)&lt;/code&gt;. So the join basically creates a string like &lt;code&gt;.id('and, not 3, not 4, not 5')&lt;/code&gt;, if the ids of the featured articles where 3, 4 and 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: added necessary space to &lt;code&gt;join(', not ')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="4727" LastEditDate="2016-03-23T09:07:02.497" LastActivityDate="2016-03-23T09:07:02.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13824" PostTypeId="1" AcceptedAnswerId="13825" CreationDate="2016-02-22T19:48:48.243" Score="1" ViewCount="292" Body="&lt;p&gt;Is there a way in a template to loop through the fields in a field layout without having to tie them to an entry? I'm currently grabbing that list with &lt;code&gt;entry.getFieldLayout(3).getFields()&lt;/code&gt;, but that only works when &lt;code&gt;entry&lt;/code&gt; is set.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-02-22T19:58:42.813" Title="Loop through fields in field layout when `entry` is not set" Tags="&lt;templating&gt;&lt;field&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13825" PostTypeId="2" ParentId="13824" CreationDate="2016-02-22T19:58:42.813" Score="2" Body="&lt;p&gt;This can be done by reaching through the section and entry type to the final field layout. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionByHandle('sectionName') %}&#xA;{% set entryType = '' %}&#xA;{% for type in section.getEntryTypes %}&#xA;    {% if type.handle == 'entryType' %}&#xA;        {% set entryType = type %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% set fieldLayout = craft.fields.getLayoutById(entryType.fieldLayoutId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should be abel to use &lt;code&gt;getFields&lt;/code&gt; as normal.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-02-22T19:58:42.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13826" PostTypeId="2" ParentId="13821" CreationDate="2016-02-22T20:23:50.017" Score="2" Body="&lt;pre&gt;&lt;code&gt;{# set featured entries by finding their IDs #}    &#xA;{% set featuredEntries = entry.featuredArticles.ids() %}&#xA;&#xA;{# set all entries by finding their IDs #}&#xA;{% set allEntries = craft.entries.section('blog').ids() %}&#xA;&#xA;{# filter out the feature entries from the regular entries #}&#xA;{% set filteredEntries = allEntries|without(featuredEntries)&#xA;&#xA;{# loop through blog entries, excluding featured entries #}&#xA;{% for entry in craft.entries.id(filteredEntries) %}&#xA;  {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key here is using Craft's built-in &lt;a href=&quot;https://craftcms.com/docs/templating/filters#without&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;|without&lt;/code&gt;&lt;/a&gt; filter to remove feature IDs from the regular IDs.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2016-02-22T20:23:50.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13827" PostTypeId="2" ParentId="11316" CreationDate="2016-02-22T20:54:37.993" Score="1" Body="&lt;p&gt;Unsure if you still need this, but I found a workaround for your issue.&#xA;I was also having the same issue when formatting it either broke the output using a filter on the formatted month or it just showed 'January'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code was initially similar to yours and I used the '|date('F')' filter on the initial entry postdate to show the month name. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try and change this part of your output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{entry.entryDate.month}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{entry.entryDate|date('F')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this works for you too.&lt;/p&gt;&#xA;" OwnerUserId="4791" LastActivityDate="2016-02-22T20:54:37.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13828" PostTypeId="2" ParentId="13818" CreationDate="2016-02-22T21:47:27.600" Score="3" Body="&lt;p&gt;Craft supports hierarchical, nested &lt;a href=&quot;https://craftcms.com/docs/categories&quot; rel=&quot;nofollow&quot;&gt;categories&lt;/a&gt; out of the box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also supports hierarchical entries, assuming you used the &lt;a href=&quot;https://craftcms.com/features/section-types&quot; rel=&quot;nofollow&quot;&gt;Structure&lt;/a&gt; section type (and not a channel or single).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where Craft and Joomla differ is the &lt;em&gt;output on the front end&lt;/em&gt; is completely up to you. There's no default &quot;widget&quot; or anything in Craft that is going to do exactly what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;{% nav %}&lt;/a&gt; tag would help you output categories and sub categories. &lt;a href=&quot;https://craftcms.com/support/structure-nav&quot; rel=&quot;nofollow&quot;&gt;This example&lt;/a&gt; uses a structure section but it's also applicable to nested categories as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a few recipes in the &lt;a href=&quot;http://craftcookbook.net&quot; rel=&quot;nofollow&quot;&gt;Craft Cookbook&lt;/a&gt; that you might find helpful in this instance as well.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-22T21:47:27.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13829" PostTypeId="2" ParentId="13815" CreationDate="2016-02-23T00:05:01.440" Score="2" Body="&lt;p&gt;I'm no AWS expert but does your iam user have the correct access/secret keys as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you're at it, you might as well grant PutObject, GetObject, and DeleteObject in that policy as well so Craft has access to the objects in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this &lt;a href=&quot;http://blogs.aws.amazon.com/security/post/Tx3VRSWZ6B3SHAV/Writing-IAM-Policies-How-to-grant-access-to-an-Amazon-S3-bucket&quot; rel=&quot;nofollow&quot;&gt;blog post&lt;/a&gt; by Amazon for a good starting point. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-23T00:05:01.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13830" PostTypeId="1" CreationDate="2016-02-23T01:15:14.603" Score="0" ViewCount="87" Body="&lt;p&gt;I'm trying to accept Stripe payments and am stuck in a loop where I have optimal behavior on the dev and staging versions, but then things broke in production and got the following error message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft\Commerce_OrderModel and its behaviors do not have a method or closure named 'firstName' &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give me some direction around this? Again, it only happens in production, and obviously, we need to be able to receive payment from customers. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4792" LastActivityDate="2016-02-23T14:31:57.917" Title="Stripe: Craft Commerce_OrderModel and its behaviors do not have a method or closure ...." Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13831" PostTypeId="2" ParentId="12931" CreationDate="2016-02-23T06:37:49.147" Score="2" Body="&lt;p&gt;The above doesn't display any paging even when there is paging. It needs to be pageInfo not paginate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.totalPages &amp;gt; 1 %}&#xA;&#xA;    {# output current pages and pagination navigation here #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4623" LastActivityDate="2016-02-23T06:37:49.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13832" PostTypeId="1" AcceptedAnswerId="13889" CreationDate="2016-02-23T09:57:17.617" Score="1" ViewCount="436" Body="&lt;p&gt;&lt;code&gt;UrlHelper::getUrl()&lt;/code&gt; doesn't appear to take the current locale ID into account when generating a URL. Absolute URLs are fine as it handles that but is there a best practice way to localize relative Urls such as &lt;code&gt;/foo/bar&lt;/code&gt; or &lt;code&gt;foo/bar&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2016-02-24T23:27:47.323" Title="How can I localize a URL in a plugin?" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;url&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13833" PostTypeId="1" AcceptedAnswerId="13837" CreationDate="2016-02-23T10:19:22.340" Score="4" ViewCount="380" Body="&lt;p&gt;I have a page with a lot of &lt;code&gt;entries&lt;/code&gt; fields. They are awesome but that leads also to a LOT of db requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from caching are there some best practices to lower db requests on &lt;code&gt;entries&lt;/code&gt; fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example my whole navigation is built with entries fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in globalsNavi.businessSorter %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would it make any difference if I grabbed only &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt; in this example since there are a lot more fields available. And if it would make a difference how would I have to write this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in globalsNavi.businessSorter( entry.title, entry.url ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2016-02-23T18:55:01.140" LastActivityDate="2016-03-11T10:29:09.690" Title="Many db requests with relationship fields" Tags="&lt;relations&gt;&lt;database&gt;&lt;entries-field&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13835" PostTypeId="1" AcceptedAnswerId="13853" CreationDate="2016-02-23T11:47:26.290" Score="0" ViewCount="100" Body="&lt;p&gt;I'm running the latest Craft and Sprout Forms as of today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a clean install of Sprout Forms whenever I create a new form (even with just one text input field), I cannot access that specific form's entries in the CP. The &quot;All Entries&quot; view works, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two &quot;unknown error&quot; notifications in the CP. Here are the relevant errors in the log.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/02/23 11:40:06 [error] [system.db.CDbCommand] CDbCommand::fetchAll()&#xA;failed: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'form' in 'on&#xA;clause'. The SQL statement executed was: SELECT `elements`.`id`,&#xA;`elements`.`type`, `elements`.`enabled`, `elements`.`archived`,&#xA;`elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`,&#xA;`elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`,&#xA;`entries`.`id`, `entries`.`ipAddress`, `entries`.`userAgent`,&#xA;`entries`.`dateCreated`, `entries`.`dateUpdated`, `entries`.`uid`,&#xA;`forms`.`id` AS `formId`, `forms`.`name` AS `formName`, `forms`.`groupId` AS&#xA;`formGroupId`, `form-request-an-audit`.`title`, `form-request&#xA;an-audit`.`field_test` AS `test`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;~&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/02/23 11:40:06 [error] [exception.CDbException] exception 'CDbException'&#xA;with message 'CDbCommand failed to execute the SQL statement:&#xA;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'form' in 'on clause'.&#xA;The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`,&#xA;`elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`,&#xA;`elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`,&#xA;`elements_i18n`.`enabled` AS `localeEnabled`, `entries`.`id`,&#xA;`entries`.`ipAddress`, `entries`.`userAgent`, `entries`.`dateCreated`,&#xA;`entries`.`dateUpdated`, `entries`.`uid`, `forms`.`id` AS `formId`,&#xA;`forms`.`name` AS `formName`, `forms`.`groupId` AS `formGroupId`, `form&#xA;request-an-audit`.`title`, `form-request-an-audit`.`field_test` AS `test`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've uninstalled, re-installed, and everything in-between with the same outcome.&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="217" LastEditDate="2016-02-23T13:00:26.980" LastActivityDate="2016-02-23T22:13:25.787" Title="View Sprout Form Entries in CP displaying error" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-02-24T17:07:35.420" ContentLicense="CC BY-SA 3.0" />
  <row Id="13836" PostTypeId="1" AcceptedAnswerId="13838" CreationDate="2016-02-23T12:04:17.267" Score="3" ViewCount="598" Body="&lt;p&gt;I have all of my entries as single pages, but of different types depending on the section. I need to create a field that allows users to link to another page entry, but I need to ensure they only select one of a certain type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to only allow users to choose entries of a certain type using the entries field? I can't see the option, so perhaps if not there's a plugin that could do this? Has someone come across a good solution.&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2018-04-19T11:50:16.483" Title="Target a certain entry type on the entries fieldtype" Tags="&lt;entries&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13837" PostTypeId="2" ParentId="13833" CreationDate="2016-02-23T12:21:13.550" Score="6" Body="&lt;p&gt;This is how relationships work in Craft at the moment. Each relation equals +1 query. If you don't access your relation on an entry the query isn't executed. So by only fetching title and/or id you don't run any extra relationship queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caching is your best option at the moment to make the query count go down. Make use of caching to cache large chunks of you code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brandon has hinted on Slack that Craft3 might incorporate Yii2 lazy loading of relations using the -&gt;with() command. This will solve a lot of the N+1 queries with relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The release of Craft 2.6 included the functions for Eager-Loading of elements. See this link for documentation on the subject: &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="297" LastEditDate="2016-03-11T10:29:09.690" LastActivityDate="2016-03-11T10:29:09.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13838" PostTypeId="2" ParentId="13836" CreationDate="2016-02-23T12:51:41.160" Score="2" Body="&lt;p&gt;This is not possible by default in Craft. Check out the &lt;a href=&quot;https://github.com/nfourtythree/craft-entriessubset&quot; rel=&quot;nofollow&quot;&gt;Entries Subset plugin&lt;/a&gt;, though, I think it can do what you want.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-23T12:51:41.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13839" PostTypeId="1" CreationDate="2016-02-23T13:20:54.987" Score="1" ViewCount="476" Body="&lt;p&gt;I'm trying to merge a field name prefix with entry.section to make a dynamic field handle. I'm guessing I'm setting the sectionMatrix variable incorrectly, causing the code to fail without error. Any tips would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channels:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;li&gt;Press&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each channel has is own matrix field, with different blocks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entryMatrixNews&lt;/li&gt;&#xA;&lt;li&gt;entryMatrixPress&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Template Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsSectionIds = craft.entries.section('news').ids() %}&#xA;{% set pressSectionIds = craft.entries.section('press').ids() %}&#xA;{% set entryIds = newsSectionIds|merge(pressSectionIds) %}&#xA;{% set entries = craft.entries.id(entryIds) %}&#xA;&#xA;{% for entry in entries %}&#xA;   {% set sectionMatrix = 'entry.entryMatrix' ~ entry.section %}&#xA;   {# sectionMatrix then equals either entry.entryMatrixNews or entry.entryMatrixPress #}&#xA;&#xA;   {% for block in sectionMatrix %}&#xA;      {# my matrix code #}&#xA;   {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="334" LastEditorUserId="334" LastEditDate="2016-02-24T13:38:12.407" LastActivityDate="2016-02-24T14:02:49.703" Title="Is it possible to merge entry parameters to create a dynamic field handle?" Tags="&lt;matrix&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13840" PostTypeId="2" ParentId="13810" CreationDate="2016-02-23T13:55:53.247" Score="0" Body="&lt;p&gt;After speaking with Brandon from the Craft team, we narrowed this issue down to a PHP module called &lt;strong&gt;Suhosin&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The module apparently strips POST variables that are zero length / empty, before they hit PHP. Craft needs to see those to know the field is to be set to empty, otherwise the field won't be changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Suhosin config setting &lt;code&gt;suhosin.post.disallow_nul&lt;/code&gt; may help others who wish to keep Suhosin running, however I opted to simply remove the module entirely after reading a few less than favourable notes about it elsewhere.&lt;/p&gt;&#xA;" OwnerUserId="4782" LastActivityDate="2016-02-23T13:55:53.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13841" PostTypeId="1" AcceptedAnswerId="13844" CreationDate="2016-02-23T14:31:53.190" Score="0" ViewCount="47" Body="&lt;p&gt;Just wondering: Is there a equivalent for this piece of code written in EE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{if logged_in}&#xA;    &amp;lt;div id=“admin”&amp;gt;&#xA;        Page render time: {elapsed_time} sec | &#xA;        Queries: {total_queries} | &#xA;        Gzip: {gzip_mode}  | &#xA;        EE version: {app_version} build {app_build}&#xA;    &amp;lt;/div&amp;gt;&#xA;{/if}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www.blue-dreamer.co.uk/blog/entry/expressionengine-measuring-performance-during-development&quot; rel=&quot;nofollow&quot;&gt;http://www.blue-dreamer.co.uk/blog/entry/expressionengine-measuring-performance-during-development&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4775" LastEditorUserId="4775" LastEditDate="2016-02-23T15:57:29.070" LastActivityDate="2016-02-23T17:41:01.813" Title="Equivalent of EE admin info code" Tags="&lt;admin&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13842" PostTypeId="2" ParentId="13830" CreationDate="2016-02-23T14:31:57.917" Score="1" Body="&lt;p&gt;Are you sure all environments are identical? (Same templates, versions, plugins, configs, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best way is to check your craft.log file and turn on devMode so you can get a proper dump as to what's causing your problem.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-23T14:31:57.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13843" PostTypeId="1" AcceptedAnswerId="13845" CreationDate="2016-02-23T16:36:09.430" Score="1" ViewCount="152" Body="&lt;p&gt;I'd like to wrap a series of block.type (images and description) in a div. So at the first iteration of this block type it needs to parse the start of the div. In the last iteration of this block type it needs to close the div. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried something like this, if there is a next block from the same type but no previous block, start the div and visa versa:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.detailMatrix %}&#xA;    {% if block.type==&quot;images&quot; %}&#xA;        {% if block.next().type == 'images' and not block.prev().type == 'images'%}&#xA;            &amp;lt;div class=&quot;section&quot; &amp;gt;&#xA;        {% endif %}&#xA;            {{block.image}}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% if block.prev().type == 'images' and not block.next().type == 'images'%}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2016-02-23T17:11:58.017" LastActivityDate="2016-02-24T09:04:18.460" Title="Parse html on first and last occurrence of a matrix block type in a series of that same block type" Tags="&lt;matrix&gt;&lt;loop&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13844" PostTypeId="2" ParentId="13841" CreationDate="2016-02-23T17:31:38.103" Score="3" Body="&lt;p&gt;Not exactly. But if you're looking for stats, &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt; does some query profiling right in the console:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zR3BY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zR3BY.png&quot; alt=&quot;Query Profiling&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if you're looking for a 1-1 correlation but you can obtain whether or not the server supports gzip with the Server variable &lt;code&gt;HTTP_ACCEPT_ENCODING&lt;/code&gt; (kind of useless IMO). Craft also will display its version number at the bottom of the CP when you're logged in, so I don't really see value there either but you can get it via your templates (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more than that, you could always make a simple plugin (I like to start with &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lindsey D's Business Logic&lt;/a&gt;  boilerplate variable class) and then just grab the data you need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To only display the data to admins when they're logged in, you can do so like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.admin %}&#xA;  Craft {{ craft.app.getEditionName()}} {{ craft.app.getVersion() }}.{{ craft.app.getBuild() }}&#xA;    ... do other stuff&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-02-23T17:41:01.813" LastActivityDate="2016-02-23T17:41:01.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13845" PostTypeId="2" ParentId="13843" CreationDate="2016-02-23T17:55:22.363" Score="3" Body="&lt;p&gt;You need to define the block previous/next variables outside of your for loop. Also you should check for the last element in the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a great working example on the happy lager demo website (&lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/HappyLager&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant code part is here: &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager/blob/master/craft/templates/_includes/article_body.html&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/HappyLager/blob/master/craft/templates/_includes/article_body.html&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-02-23T17:55:22.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13847" PostTypeId="2" ParentId="13843" CreationDate="2016-02-23T18:20:30.227" Score="1" Body="&lt;p&gt;In addition to Tom's excellent answer, you could also tackle this with a simple if-loop-index condition. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1863/return-matrix-field-block-number&quot;&gt;Have a look at this answer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-23T18:20:30.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13848" PostTypeId="2" ParentId="5175" CreationDate="2016-02-23T18:24:30.770" Score="1" Body="&lt;p&gt;I got this error because I worked locally, uploaded my templates to the server but did not import my local db to the remote db since I work with a team and needed to preserve the online, active db.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I needed to recreate fields, sections, entries, and plugin settings on the server CMS, but I forgot to change the sectionId hidden  in my template to reflect what the new channel's section ID was.  On my local it was 13, but when I created it on the server, it was 12 and I just needed to change it in the code in the from like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;12&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps someone out there.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-02-23T18:24:30.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13849" PostTypeId="1" AcceptedAnswerId="13859" CreationDate="2016-02-23T18:48:10.023" Score="1" ViewCount="154" Body="&lt;p&gt;I have a controller that handles some font-end form validation. From that controller I’d like to require the current (already logged in) user’s password to update any field. How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-02-23T20:36:45.727" LastActivityDate="2016-02-23T22:12:17.673" Title="Require password from current user on front-end form?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;password&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13850" PostTypeId="1" AcceptedAnswerId="13857" CreationDate="2016-02-23T19:45:54.530" Score="0" ViewCount="217" Body="&lt;p&gt;I have a drop-down field in the CP - It represents a range of numbers that are based either a percent or a fixed number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a choice could be &lt;code&gt;Fixed 5%&lt;/code&gt; or a choice could be &lt;code&gt;Variable 5%&lt;/code&gt;&#xA;In either case, the value of my field is &lt;code&gt;5.00&lt;/code&gt; for both options. The label is different, one says &quot;Fixed&quot; the other says &quot;Variable&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that this is a bad approach as I will usually get the first match based on value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have &lt;code&gt;Fixed 5%&lt;/code&gt; listed first in my drop down field, but I actually choose &lt;code&gt;Variable 5%&lt;/code&gt;. Currently, I am getting &lt;code&gt;Fixed 5%&lt;/code&gt; as the selected option instead of &lt;code&gt;Variable 5%&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how I can set up this field correctly so that Craft can see what I have chosen correctly. Perhaps there is a better way to setting up my drop down?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-02-23T21:08:49.307" Title="How can I get the correct label of a dropdown that has matching values?" Tags="&lt;fieldtypes&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13851" PostTypeId="1" AcceptedAnswerId="13856" CreationDate="2016-02-23T19:59:35.490" Score="1" ViewCount="482" Body="&lt;p&gt;Is there a way to output the Placeholder Text of a plaintext field if there's no specific value entered to the Entry? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Am I missing something — should it happen automatically if there's no specific value entered?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plain-text-fields&quot; rel=&quot;nofollow&quot;&gt;The docs&lt;/a&gt; say: &quot;The text that will be shown if the field does't have a value&quot; — does &lt;code&gt;shown&lt;/code&gt; just mean in the form on the Entry form in the admin, or also on the front-end as a value of block.FIELDNAME ?&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2016-02-23T20:55:41.210" Title="Can I output the Placeholder Text of a plain text matrix block?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13852" PostTypeId="1" AcceptedAnswerId="13855" CreationDate="2016-02-23T20:24:23.837" Score="5" ViewCount="3133" Body="&lt;p&gt;We have a Craft site in which we include a partial that includes in several different places. CSRF is enabled, and we're appending &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt; to the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the way we've set up the site, and are including this partial in so many places, nearly all of the forms we're rendering are using &lt;em&gt;cached&lt;/em&gt; CSRF tokens, which invalidates them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to prevent Craft's &lt;code&gt;{% cache %}&lt;/code&gt; tag from including the generated CSRF token without ending the cache and starting it up again each time? (eg, &lt;code&gt;{% endcache %}{{ getCsrfInpt() }}{% cache %}&lt;/code&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I worry doing so would be risky, because we may include this partial in a part of the site that is &lt;em&gt;not&lt;/em&gt; cached, so there'd be no cache tag to end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I failed to mention that our site works right now without Javascript, so I'd like to avoid it. Otherwise, Lindsey's answer is perfect.&lt;/p&gt;&#xA;" OwnerUserId="4799" LastEditorUserId="4799" LastEditDate="2016-02-23T22:46:48.547" LastActivityDate="2018-04-09T18:45:55.517" Title="How can I Prevent CSRF Tokens from being Cached?" Tags="&lt;templating&gt;&lt;cache&gt;&lt;csrf&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13853" PostTypeId="2" ParentId="13835" CreationDate="2016-02-23T20:30:56.697" Score="2" Body="&lt;p&gt;The form handle can't contain special characters like &lt;code&gt;-&lt;/code&gt; or &lt;code&gt;*&lt;/code&gt;, the validation of that field is not working, but we'll fix that in the next release. In the meantime please update the form handle.&lt;/p&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="57" LastEditDate="2016-02-23T22:13:25.787" LastActivityDate="2016-02-23T22:13:25.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13854" PostTypeId="2" ParentId="13852" CreationDate="2016-02-23T20:42:59.477" Score="9" Body="&lt;p&gt;The trick is to inject the CSRF field using JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Omit the standard &lt;code&gt;getCsrfInput&lt;/code&gt; Twig tag.&lt;/li&gt;&#xA;&lt;li&gt;Give your form(s) the class of &lt;code&gt;csrf&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Add this Twig code &lt;strong&gt;outside of the cached area:&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;{% includejs %}&#xA;    $(function() {&#xA;        $('form.csrf').prepend('&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ craft.config.get('csrfTokenName') }}&quot; value=&quot;{{ craft.request.getCsrfToken }}&quot; /&amp;gt;');&#xA;    });&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will dynamically inject the correct CSRF input field into every form with the &lt;code&gt;csrf&lt;/code&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* Disclaimer: This example assumes you're using jQuery. A similar solution can be enacted without jQuery, but some adjustments would need to be made.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-23T20:42:59.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13855" PostTypeId="2" ParentId="13852" CreationDate="2016-02-23T20:49:55.270" Score="10" Body="&lt;p&gt;You can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// First, set all your cached content to a variable:&#xA;{% set myContent %}&#xA;  {% cache %}&#xA;    {# YOUR CACHED CONTENT #}&#xA;    %%MY_CSRF%%&#xA;  {% endcache %}&#xA;{% endset %}&#xA;&#xA;// Then, run a replace on your cached content to insert the new CSRF&#xA;{{ myContent|replace({'%%MY_CSRF%%': getCsrfInput()}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2215" LastEditorUserId="-1" LastEditDate="2017-11-20T20:36:58.030" LastActivityDate="2017-11-20T20:36:58.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13856" PostTypeId="2" ParentId="13851" CreationDate="2016-02-23T20:55:41.210" Score="1" Body="&lt;p&gt;The &quot;docs&quot; means only on the admin form. For outputing a default text on empty fields in frontend you can use the following code in you template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{block.FIELDNAME | default(&quot;Placeholdertext&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-02-23T20:55:41.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13857" PostTypeId="2" ParentId="13850" CreationDate="2016-02-23T21:08:49.307" Score="2" Body="&lt;p&gt;Craft saves only the option value of a field, not the option description. After saving and editing again, it loops trough all the option values and compare it with the saved value. If it matchs it selects the first option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You always need to have unique values. For example you can use 5fix and 5var as option values. If you need different outputs in your frontend template, you can use a switch case like this (code is untested, but should work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.field %}&#xA;  {% case &quot;5fix&quot; %}&#xA;    Fixed 5%&#xA;  {% case &quot;5var&quot; %}&#xA;    Variable 5% &#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-02-23T21:08:49.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13858" PostTypeId="1" CreationDate="2016-02-23T21:19:33.090" Score="1" ViewCount="560" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having issue getting Twig to extend the template. The details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft installed fine.&lt;/li&gt;&#xA;&lt;li&gt;This is on a live server.&lt;/li&gt;&#xA;&lt;li&gt;The default Craft welcome page appears as normal so Twig must be&#xA;working.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When I try to pull up an entry with one of my own templates, Twig does&#xA;not pull the content from the main Twig template. You should see the&#xA;header info and have the css pulled and all the rest. If I strip&#xA;everything out the template and leave some plain text I still see&#xA;this in the browser:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{ % extends &quot;_layouttest&quot; % } { % block main % } This is the correct template alright! { % endblock % }&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have done the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Checked that I am not pulling the template directly. I am not. This&#xA;is a proper URL for an entry I created in Craft.&lt;/li&gt;&#xA;&lt;li&gt;Dumped the cache.&lt;/li&gt;&#xA;&lt;li&gt;Checked the template locations from within the CP. All seems to be&#xA;pointing in the correct direction. The fact that the right template&#xA;is being pulled confirms this.&lt;/li&gt;&#xA;&lt;li&gt;Read through &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11361/twig-code-showing-in-browser&quot;&gt;this thread&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5206/only-layout-template-being-rendered-in-local-environment&quot;&gt;this one&lt;/a&gt;. No joy.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-02-24T18:14:47.427" Title="Twig template not extending" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13859" PostTypeId="2" ParentId="13849" CreationDate="2016-02-23T22:12:17.673" Score="2" Body="&lt;p&gt;You'd create a Craft &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; with a &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; that has an &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;action&lt;/a&gt;, say &lt;code&gt;actionSaveForm()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your controller would look for a &lt;code&gt;password&lt;/code&gt; POST variable and if that existed, validate that against the currently logged in user's account to make sure it was a match.  If so, continue onto Craft's &lt;code&gt;saveUser&lt;/code&gt; or &lt;code&gt;saveEntry&lt;/code&gt;, etc. (whatever you're using the form for, otherwise, return a validation error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roughly like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveForm()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    craft()-&amp;gt;userSession-&amp;gt;requireLogin();&#xA;&#xA;    $password = craft()-&amp;gt;request-&amp;gt;getRequiredPost('password');&#xA;    {# grab anything else you need from POST #}&#xA;&#xA;    $currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;    if (craft()-&amp;gt;users-&amp;gt;validatePassword($currentUser-&amp;gt;password, $password))&#xA;    {&#xA;        {# saveEntry, saveUser, etc. then redirect #}&#xA;    }&#xA;&#xA;    // Invalid Password&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'error' =&amp;gt; &quot;Invalid Password&quot;&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-23T22:12:17.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13860" PostTypeId="2" ParentId="13820" CreationDate="2016-02-23T22:34:12.377" Score="1" Body="&lt;p&gt;Not very pretty, but the only way I can think of to achieve that behavior is to explicitly check for an empty result set and then run separate &lt;code&gt;SHOW CREATE TABLE&lt;/code&gt; commands on the tables to grab the column names and add them as keys to the results.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-23T22:34:12.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13861" PostTypeId="2" ParentId="13852" CreationDate="2016-02-23T22:45:22.423" Score="0" Body="&lt;p&gt;Thanks Lindsey and Ben!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping to avoid using Javascript to handle CSRF, because our site otherwise is not dependent on it. I took Ben's suggestion of creating a variable outside of the cache, and using it within the cache. I ran a quick test to verify that it indeed would use the uncached value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wound up making a Twig extension to get uncached CSRF input, which we can set in our &lt;code&gt;_layout.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# in craft/templates/_layout.html #}&#xA;{% set csrfToken = craft.request.getCsrfToken() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then we build the twig extension to access the &lt;code&gt;csrfToken&lt;/code&gt; from the Twig context, and render a hidden input element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// craft/plugins/ourplugin/twigextensions/OurPluginTwigExtension.php&#xA;&#xA;public function getFunctions() {&#xA;    return [&#xA;        'getUncachedCsrfInput' =&amp;gt; new \Twig_Function_Method($this, 'getUncachedCsrfInput', ['needs_context' =&amp;gt; true])&#xA;    ];&#xA;}&#xA;&#xA;public function getUncachedCsrfInput($context) {&#xA;    if (craft()-&amp;gt;config-&amp;gt;get('enableCsrfProtection') === true) {&#xA;        $charset = craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;getCharset();&#xA;        //access the csrfToken variable from the Twig context,&#xA;        //    or fall back on craft()-&amp;gt;request otherwise&#xA;        $csrf = array_key_exists('csrfToken', $context) ? $context['csrfToken'] : craft()-&amp;gt;request-&amp;gt;getCsrfToken();&#xA;&#xA;        return new \Twig_Markup('&amp;lt;input type=&quot;hidden&quot; name=&quot;'.craft()-&amp;gt;config-&amp;gt;get('csrfTokenName').'&quot; value=&quot;'. $csrf .'&quot;&amp;gt;', $charset);&#xA;    }&#xA;    return '';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, we can get an uncached &lt;code&gt;&amp;lt;input /&amp;gt;&lt;/code&gt; element in all of our forms using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# any form #}&#xA;&amp;lt;form action=&quot;&quot; method=&quot;POST&quot;&amp;gt;&#xA;    ...&#xA;    {{ getUncachedCsrfInput }}&#xA;    ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="4799" LastActivityDate="2016-02-23T22:45:22.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13862" PostTypeId="1" CreationDate="2016-02-23T23:23:21.033" Score="1" ViewCount="681" Body="&lt;p&gt;I'm trying to output an amform in a template that has been selected from a Form field. From the &lt;a href=&quot;https://github.com/am-impact/amforms#simple-field-tag&quot; rel=&quot;nofollow noreferrer&quot;&gt;amform docs&lt;/a&gt;, it says: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.amForms.displayForm('formHandle') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My matrix fieldname is called &lt;em&gt;myFormField&lt;/em&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qTtSj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qTtSj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.amForms.displayForm('{{block.myFormField}}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't look like craft is parsing &lt;em&gt;{{block.myFormField}}&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No form exists with the handle “{{block.myFormField}}”.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="57" LastEditDate="2016-02-24T04:06:43.797" LastActivityDate="2016-02-25T06:40:03.357" Title="amforms: display form field" Tags="&lt;templating&gt;&lt;fieldtypes&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13863" PostTypeId="1" CreationDate="2016-02-23T23:27:40.143" Score="1" ViewCount="173" Body="&lt;p&gt;Let's say I am selling products, with each vertical having their own domain, and one central portal that sells all the products. Is this possible with one installation of Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only one admin panel would be needed.&lt;/p&gt;&#xA;" OwnerUserId="473" LastActivityDate="2016-02-23T23:27:40.143" Title="One database .... spinning off multiple domains?" Tags="&lt;multi-domain&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13864" PostTypeId="2" ParentId="12541" CreationDate="2016-02-24T07:50:46.253" Score="2" Body="&lt;p&gt;Turns out that it was a badly written menu plugin, overriding styling of DOM elements outside of its own view scope. Sure it's related to Kyles suggestion above.&lt;/p&gt;&#xA;" OwnerUserId="4402" LastActivityDate="2016-02-24T07:50:46.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13865" PostTypeId="2" ParentId="13820" CreationDate="2016-02-24T07:55:21.460" Score="2" Body="&lt;p&gt;I was close - I think the problem was the &lt;code&gt;$command-&amp;gt;prepare()&lt;/code&gt; did not do anything useful, using &lt;code&gt;$command-&amp;gt;query()&lt;/code&gt; executes the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working for me&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $sql = &quot;select t.foo, count(o.bar) as amount from craft_table t join craft_otherTable o on t.id = o.id where 1=0 group by t.foo;&quot;&#xA;    $command = craft()-&amp;gt;db-&amp;gt;createCommand($sql);&#xA;    $reader = $command-&amp;gt;query($parameters);&#xA;    $statement = $command-&amp;gt;getPdoStatement();&#xA;    $result = [];&#xA;    $headers = [];&#xA;    for($j=0;$j&amp;lt;$statement-&amp;gt;columnCount();$j++){&#xA;      $headers[] = $statement-&amp;gt;getColumnMeta($j)['name'];&#xA;    }&#xA;    $result['headers'] = $headers;&#xA;    $result['rows'] = $reader-&amp;gt;readAll();&#xA;&#xA;    // $result['headers'] is now: ['foo', 'amount']&#xA;    // $result['rows'] is now: []&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2300" LastActivityDate="2016-02-24T07:55:21.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13866" PostTypeId="1" AcceptedAnswerId="13877" CreationDate="2016-02-24T07:59:07.217" Score="1" ViewCount="88" Body="&lt;p&gt;I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&amp;amp;drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save at all, reverting the order as soon as I refresh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've pumped the php.ini settings (&lt;code&gt;upload_max_filesize=128M&lt;/code&gt;, &lt;code&gt;post_max_size=256M&lt;/code&gt;&#xA;,&lt;code&gt;max_input_vars=4000&lt;/code&gt;) and set the block limit in CP to 200 so that shouldn't be the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also not getting a logged error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this ring a bell with anybody?&lt;/p&gt;&#xA;" OwnerUserId="4402" LastEditorUserId="57" LastEditDate="2016-02-24T18:12:44.257" LastActivityDate="2016-02-24T18:12:44.257" Title="Unable to sort large number of blocks in Matrix field in CP and template" Tags="&lt;matrix&gt;&lt;ordering&gt;&lt;limit&gt;&lt;blocks&gt;&lt;number&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13867" PostTypeId="2" ParentId="13843" CreationDate="2016-02-24T09:04:18.460" Score="1" Body="&lt;p&gt;Tom's answer got me in the right direction. I ended up using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.detailMatrix %}&#xA;   {# If there is a block type images, but no previous block images, start the div #}&#xA;   {% if block.type == 'images' and block.prev().type != 'images'%}&#xA;        &amp;lt;div class=&quot;section&quot; &amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if block.type==&quot;images&quot; %}&#xA;        {{block.image}}&#xA;    {% endif %}&#xA;&#xA;    {# If there is a block type images, but no next block images, close the div. Place in the bottom if there are more block types #}&#xA;    {% if block.type == 'images' and block.next().type != 'images'%}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of using &quot;not&quot; using != worked better&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-02-24T09:04:18.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13868" PostTypeId="1" AcceptedAnswerId="13888" CreationDate="2016-02-24T09:10:05.367" Score="2" ViewCount="1187" Body="&lt;p&gt;A coworker of mine asked me if I could make the links in Craft relative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is not a big deal for navigation links,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;relative url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relativeUrl = entry.url|replace((siteUrl), '/') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it gets trickier for links inside a Rich Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is set up to use absolute links, is there a reason behind that?&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2016-02-24T17:52:23.403" LastActivityDate="2016-02-24T22:28:34.070" Title="Does it make sense to use Craft with relative links?" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13869" PostTypeId="2" ParentId="13858" CreationDate="2016-02-24T10:15:10.623" Score="4" Body="&lt;p&gt;You have a space between the &lt;code&gt;{&lt;/code&gt; and &lt;code&gt;%&lt;/code&gt; in your twig tags. That needs to be removed. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-24T10:15:10.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13870" PostTypeId="2" ParentId="13815" CreationDate="2016-02-24T12:31:58.697" Score="13" Body="&lt;p&gt;You need to allow to list bucket location. Also, I'm not confident if you'd be able to upload and delete objects from the bucket with that policy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd go with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;Version&quot;: &quot;2012-10-17&quot;,&#xA;&quot;Statement&quot;: [&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:ListAllMyBuckets&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: &quot;*&quot;&#xA;    },&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:GetBucketLocation&quot;,&#xA;            &quot;s3:ListBucket&quot;,&#xA;            &quot;s3:PutObject&quot;,&#xA;            &quot;s3:GetObject&quot;,&#xA;            &quot;s3:DeleteObject&quot;,&#xA;            &quot;s3:GetObjectAcl&quot;,&#xA;            &quot;s3:PutObjectAcl&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: [&#xA;            &quot;arn:aws:s3:::bucketname/*&quot;&#xA;        ]&#xA;    },&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:GetBucketLocation&quot;,&#xA;            &quot;s3:ListBucket&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: [&#xA;            &quot;arn:aws:s3:::bucketname&quot;&#xA;        ]&#xA;    }&#xA;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2019-07-17T06:42:07.273" LastActivityDate="2019-07-17T06:42:07.273" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13871" PostTypeId="1" AcceptedAnswerId="13878" CreationDate="2016-02-24T12:40:07.117" Score="0" ViewCount="442" Body="&lt;p&gt;I would like to store some data in the user's session specifically for when they're logged in. When logged out, I would like the session to destruct. Trawling through the code, it seems that session destruction is forced to false on logout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yiilite framework:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function logout($destroySession=true)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft &lt;code&gt;UsersController&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function actionLogout()&#xA; {&#xA;            craft()-&amp;gt;userSession-&amp;gt;logout(false);&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using the following in Craft config to force logouts and expiration after a certain amount of time, but the session doesn't get destroyed until the browser is closed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'userSessionDuration'=&amp;gt;'PT20M',&#xA;'rememberedUserSessionDuration' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing here, or do I have to override the event and clear the session variables myself?&lt;/p&gt;&#xA;" OwnerUserId="4390" LastEditorUserId="57" LastEditDate="2016-02-24T18:16:39.483" LastActivityDate="2016-02-24T18:34:15.943" Title="Forcing destruction of httpSession variables on logout" Tags="&lt;login&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13872" PostTypeId="2" ParentId="13839" CreationDate="2016-02-24T14:02:49.703" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/attribute.html&quot; rel=&quot;nofollow&quot;&gt;Twig attribute function&lt;/a&gt; solved this for me. Thanks to @tom-bauer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Revised Template Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsSectionIds = craft.entries.section('news').ids() %}&#xA;{% set pressSectionIds = craft.entries.section('press').ids() %}&#xA;{% set entryIds = newsSectionIds|merge(pressSectionIds) %}&#xA;{% set entries = craft.entries.id(entryIds) %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    {% set sectionMatrix = attribute(entry, &quot;entryMatrix&quot;~entry.section) %}&#xA;&#xA;    {% for block in sectionMatrix %}&#xA;&#xA;        {# my matrix code #}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="334" LastActivityDate="2016-02-24T14:02:49.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13873" PostTypeId="1" AcceptedAnswerId="13884" CreationDate="2016-02-24T14:35:47.790" Score="2" ViewCount="258" Body="&lt;p&gt;I'm writing a customer portal plugin that will have 3 types of users.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Organizations&lt;/li&gt;&#xA;&lt;li&gt;Organization members&lt;/li&gt;&#xA;&lt;li&gt;Private&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to use Craft's built in UserRecord for front end login, backend management, ..?, and extend it to handle these three user types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I have it set up so far, is that I have a proxy user record, which handles the relations to the organization profile and user profile records. Below I have listed the relevant attributes/keys and relations for each of the records:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;&lt;strong&gt;MyPortal_ProxyUserRecord:&lt;/strong&gt;&lt;br&gt;&#xA;Acts as a middle man between the Craft UserRecord and the two records further below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id&#xA;craft_user_id&#xA;organization_id  (# | null if private user)&#xA;user_id  (# | null if organization)&#xA;&#xA;'craft_user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord', 'craft_user_id'),&#xA;'organization_profile' =&amp;gt; array(static::HAS_ONE, 'MyPortal_OrganizationProfileRecord', 'proxy_user_id'),&#xA;'user_profile' =&amp;gt; array(static::HAS_ONE, 'MyPortal_UserProfileRecord', 'proxy_user_id'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;&lt;strong&gt;MyPortal_OrganizationProfileRecord:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id&#xA;proxy_user_id&#xA;contact_user_id&#xA;&#xA;'proxy_user' =&amp;gt; array(static::BELONGS_TO, 'MyPortal_ProxyUserRecord', 'proxy_user_id'),&#xA;// Organization members:&#xA;'user_profiles' =&amp;gt; array(static::HAS_MANY, 'MyPortal_UserProfileRecord', 'organization_id'),&#xA;// Contact user:&#xA;'contact_user' =&amp;gt; array(static::HAS_ONE, 'MyPortal_UserProfileRecord', 'organization_id'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;&lt;strong&gt;MyPortal_UserProfileRecord:&lt;/strong&gt;&lt;br&gt;&#xA;Handles both private users and organization members.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id&#xA;proxy_user_id&#xA;organization_id  (# | null if private user)&#xA;&#xA;'proxy_user' =&amp;gt; array(static::BELONGS_TO, 'MyPortal_ProxyUserRecord', 'proxy_user_id'),&#xA;'organization' =&amp;gt; array(static::BELONGS_TO, 'MyPortal_OrganizationProfileRecord', 'organization_id'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Questions:&lt;/h1&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to extend the Craft UserRecord itself with the&#xA;necessary attributes and relations to handle the&#xA;OrganizationProfileRecord and the UserProfileRecord, and ditch the&#xA;proxy user record? If so, how do I do that?&lt;/li&gt;&#xA;&lt;li&gt;If not possible, should I structure my records and relations differently than I have done so far?&lt;/li&gt;&#xA;&lt;li&gt;Are there any pitfalls I should be vary of?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;Please let me know if I should provide any further information! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance for any help you can provide!  &lt;em&gt;bowing&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Monkey    &lt;/p&gt;&#xA;" OwnerUserId="4802" LastEditorUserId="57" LastEditDate="2016-02-24T19:59:07.423" LastActivityDate="2016-02-24T19:59:07.423" Title="How to extend UserRecord?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;extends&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13875" PostTypeId="1" CreationDate="2016-02-24T16:53:02.433" Score="2" ViewCount="237" Body="&lt;p&gt;We are using the Craft's currency filter to display localised prices &lt;code&gt;344552.32 | currency('GBP')&lt;/code&gt; which works great in most instances. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the currency symbol for UK Sterling in the French locale file is &lt;code&gt;£UK&lt;/code&gt; and the translation company we are working with are saying that we just need to output &lt;code&gt;£&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is defined in the &lt;code&gt;currencySymbols&lt;/code&gt; array of &lt;code&gt;craft/app/framework/i18n/data.fr.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way we can affect that at a configuration level or at runtime? If not I guess we would have to create our own filter function that wraps the core functionality and does a string replace on the output.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2016-02-24T20:27:16.070" Title="Is there a way to override locale data?" Tags="&lt;localization&gt;&lt;configuration&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13876" PostTypeId="2" ParentId="13868" CreationDate="2016-02-24T18:00:55.210" Score="1" Body="&lt;p&gt;Behind the scenes, the Rich Text field converts those links to &lt;a href=&quot;https://craftcms.com/docs/reference-tags&quot; rel=&quot;nofollow&quot;&gt;reference tags&lt;/a&gt; so that when the Craft install moves between environments (and the URLs change) or, for example, the entry's slug changes, it will still maintain a proper link to the entry instead of breaking.  Currently it requires linked URLs in absolute format to do that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T18:00:55.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13877" PostTypeId="2" ParentId="13866" CreationDate="2016-02-24T18:11:59.567" Score="3" Body="&lt;p&gt;This is because Craft stores the &lt;code&gt;sortOrder&lt;/code&gt; values in the database with a MySQL column type of &lt;code&gt;tinyint&lt;/code&gt; that happens to be signed, which means it can store a range of &lt;code&gt;-128&lt;/code&gt; to &lt;code&gt;127&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from the fact that negative sort orders don't make much sense, that means if you have 127 or more Matrix blocks to sort, things will stop working as expected.  Because &lt;a href=&quot;http://www.wired.com/1997/01/did-gates-really-say-640k-is-enough-for-anyone/&quot; rel=&quot;nofollow&quot;&gt;127 things to sort ought to be enough for anyone&lt;/a&gt;, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, in the next (&lt;a href=&quot;https://craftcms.com/changelog#build2765&quot; rel=&quot;nofollow&quot;&gt;post 2.5.2765&lt;/a&gt;) release, we've changed &lt;em&gt;all&lt;/em&gt; sort order column in the database to be unsigned &lt;code&gt;smallint&lt;/code&gt;s, which means they can store a range of &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;65535&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T18:11:59.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13878" PostTypeId="2" ParentId="13871" CreationDate="2016-02-24T18:34:15.943" Score="1" Body="&lt;p&gt;Currently when you manually click the logout button in Craft, it will destroy your authenticated session information (to be logged into the control panel), but keep your existing PHP session (represented by the &lt;code&gt;CraftSessionId&lt;/code&gt; cookie) so anything stored in PHP's session will remain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not the behavior you're looking for, you can make a &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; to expose this behavior via a config setting and/or write a simple &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that listens for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onLogout&quot; rel=&quot;nofollow&quot;&gt;userSession.onLogout&lt;/a&gt; event and manually destroy PHP session.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T18:34:15.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13879" PostTypeId="2" ParentId="13875" CreationDate="2016-02-24T18:50:40.510" Score="0" Body="&lt;p&gt;I don't think you can override that, but I'm not 100% sure. But, there's always the option to run the &lt;code&gt;replace&lt;/code&gt;filter on the output from &lt;code&gt;currency&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 344552.32 | currency('GBP') | replace('£UK', '£') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-24T18:50:40.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13880" PostTypeId="2" ParentId="13875" CreationDate="2016-02-24T19:05:01.197" Score="0" Body="&lt;p&gt;A plugin like you mention is an option, but you should be able to use &lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow&quot;&gt;static translations&lt;/a&gt; for this, too.  Only downside is that it would replace &lt;em&gt;all&lt;/em&gt; instances of &lt;code&gt;£UK&lt;/code&gt; with &lt;code&gt;£&lt;/code&gt;, which may or may not be a problem.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T19:05:01.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13881" PostTypeId="1" AcceptedAnswerId="13882" CreationDate="2016-02-24T19:05:12.853" Score="1" ViewCount="258" Body="&lt;p&gt;I'm trying to set a cookie using &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#saveCookie-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;saveCookie()&lt;/code&gt;&lt;/a&gt;, and I'm puzzled by the UserSessionService's behaviour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of creating a plain old cookie, Craft actually creates a so-called &lt;em&gt;state&lt;/em&gt; cookie, where the cookie name is prefixed with a hash key and the cookie value is also hashed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm running to set the cookie:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie('myAwesomeCookieName', $someAwesomeCookieData, 3600)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and here's what the cookie looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d9c79699028b2f1b123abbcd3e872e5dmyAwesomeCookieName : aa9de09d72cdbda2caac4551870e073d0f7307b3s&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reading over the source code, docs and &lt;a href=&quot;https://craftcms.stackexchange.com/a/656/1098&quot;&gt;other SE's on the subject&lt;/a&gt;, it's not apparent to me why Craft creates a state cookie instead of a regular (non-hashed) cookie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as far as I know, the only built-in method available to &lt;em&gt;templates&lt;/em&gt; for retrieving a cookie is &lt;code&gt;craft.request.getCookie&lt;/code&gt; – which is actually unable to read &lt;em&gt;state&lt;/em&gt; cookies, so it all seems a bit odd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've currently implemented template variables for retrieving and reading the state cookie in my template (by wrapping the UserSessionService's &lt;code&gt;getStateCookie&lt;/code&gt; and &lt;code&gt;getStateCookieValue&lt;/code&gt; methods, respectively) but I'd love to know why the hashing happens in the first place, and if I can prevent it without an additional plugin (I'm aware of the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Cookies&lt;/a&gt; and the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookie plugin&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-02-24T19:29:25.187" Title="Why does the UserSessionService create a *state* cookie?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13882" PostTypeId="2" ParentId="13881" CreationDate="2016-02-24T19:29:25.187" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#saveCookie-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;userSesssion-&amp;gt;saveCookie()&lt;/code&gt;&lt;/a&gt; is basically a fancy wrapper for &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getCookies-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add()&lt;/code&gt;&lt;/a&gt; that (as you've discovered) does some key and value based hashing to ensure that cookie data hasn't been tampered with between requests.  Which is especially useful if, for example, cookies are used to maintain user session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not the behavior you're looking for, you can use PHP's &lt;code&gt;setCookie&lt;/code&gt; method (like &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow&quot;&gt;LJ Cookies&lt;/a&gt; and the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow&quot;&gt;Cookie plugin&lt;/a&gt; do) or you can interact with &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add()&lt;/code&gt; directly outside the context of the UserSesssion service.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T19:29:25.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13883" PostTypeId="2" ParentId="9501" CreationDate="2016-02-24T19:30:18.427" Score="4" Body="&lt;p&gt;Craft has a config setting for this (for dynamic urls)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set it in your config file like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'addTrailingSlashesToUrls' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If someone links to the url via a non-trailing-slash pattern, it should redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use an apache rewrite, you can exclude the craft admin by checking the uri pattern&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !(admin)$&#xA;RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3527" LastActivityDate="2016-02-24T19:30:18.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13884" PostTypeId="2" ParentId="13873" CreationDate="2016-02-24T19:58:30.420" Score="1" Body="&lt;p&gt;When extending Craft's active record classes (like UserRecord), you'll only be able to setup the AR relationships one way (from your class to Craft's i.e. &lt;code&gt;MyPortal_ProxyUserRecord =&amp;gt; UserRecord&lt;/code&gt;) as you've done.  Setting up the relationship in the other direction (&lt;code&gt;UserRecord =&amp;gt; MyPortal_ProxyUserRecord&lt;/code&gt;) would require hacking core Craft files (not recommended).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For queries going in that direction, you'd need to go outside the scope of AR and use &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;QueryBuilder&lt;/a&gt; to manually build the SQL query you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your current structure, I'm not sure what the purpose of &lt;code&gt;MyPortal_ProxyUserRecord&lt;/code&gt; is.  Why not just have &lt;code&gt;MyPortal_UserProfileRecord&lt;/code&gt; and &lt;code&gt;MyPortal_OrganizationProfileRecord&lt;/code&gt; link to &lt;code&gt;UserRecord&lt;/code&gt; directly? Maybe you just want a single place for that interaction instead of two, I suppose.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-24T19:58:30.420" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13885" PostTypeId="1" AcceptedAnswerId="14790" CreationDate="2016-02-24T20:02:32.210" Score="1" ViewCount="1448" Body="&lt;p&gt;I am having an issue with uploading assets to S3 from Craft.  So far I have taken the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create permission policy and attached to group containing craft&#xA;user:&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Version&quot;: &quot;2012-10-17&quot;,&#xA;    &quot;Statement&quot;: [&#xA;        {&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:ListAllMyBuckets&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: &quot;arn:aws:s3:::&quot;&#xA;        },&#xA;        {&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:GetBucketLocation&quot;,&#xA;                &quot;s3:ListBucket&quot;,&#xA;                &quot;s3:PutObject&quot;,&#xA;                &quot;s3:GetObject&quot;,&#xA;                &quot;s3:DeleteObject&quot;,&#xA;                &quot;s3:GetObjectAcl&quot;,&#xA;                &quot;s3:PutObjectAcl&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: [&#xA;                &quot;arn:aws:s3:::&amp;lt;bucket_name&amp;gt;/*&quot;&#xA;            ]&#xA;        },&#xA;        {&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:GetBucketLocation&quot;,&#xA;                &quot;s3:ListBucket&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: [&#xA;                &quot;arn:aws:s3:::&amp;lt;bucket_name&amp;gt;&quot;&#xA;            ]&#xA;        }&#xA;    ] }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create new asset source with type of Amazon S3 and input access and&#xA;secret key for craft user.  This allows me to select the available&#xA;bucket.&lt;/li&gt;&#xA;&lt;li&gt;Save the asset source and go to the asset section to upload a file&#xA;to S3.  At this point the status bar fills up and the upload hangs&#xA;indefinitely.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Other notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;These are very small images (&amp;lt;100KB)&lt;/li&gt;&#xA;&lt;li&gt;I am able to bring images into Craft if I upload them directly to S3&#xA;and then update asset indexes in the setting.&lt;/li&gt;&#xA;&lt;li&gt;I also noticed that the error logs print out the message:   &#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;exception 'S3Exception' with message&#xA;  'S3::getObjectInfo([bucket_name], [file_name]): [52] Empty&#xA;  reply from server' in&#xA;  /Users/[user]/Sites/[project]/craft/app/lib/S3.php:777&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;I have also tried using the more broad 'AmazonS3FullAccess' policy&#xA;with the same results.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;In continuing to explorer this issue I have found that a call is being made from the S3AssetSourceType file in the insertFileInFolder function to the S3 class getObjectInfo function.  It seems like this error is occurring because the code is trying to fetch information from amazon on an object that does not yet exist because this call occurs prior to the put object call.  I have yet to understand why the getObjectInfo is called within the insertFileInFolder call before a put object request is made to S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&#xA;After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request.  We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.&lt;/p&gt;&#xA;" OwnerUserId="4806" LastEditorUserId="4806" LastEditDate="2016-03-07T15:25:43.927" LastActivityDate="2016-04-25T16:59:05.650" Title="S3 Asset uploading hangs" Tags="&lt;assets&gt;&lt;error&gt;&lt;upload&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13886" PostTypeId="1" AcceptedAnswerId="14044" CreationDate="2016-02-24T20:19:08.460" Score="1" ViewCount="319" Body="&lt;p&gt;I'm attempting to create email notifications with attachments when using Sprout Forms and S3 assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given &lt;code&gt;Sprout Forms 2.1.5&lt;/code&gt; &amp;amp; &lt;code&gt;Craft Pro 2.5.2760&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a form with an Asset field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And default upload location in an S3 bucket&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kUvOM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUvOM.png&quot; alt=&quot;Default upload location in an S3 bucket&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And enable notifications set to true&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zXeH2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zXeH2.png&quot; alt=&quot;Enable notifications set to true&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And enable file attachments set to true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a user submits a form, no email is sent and the following error is logged in &lt;code&gt;sproutforms.log&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft\S3AssetSourceType and its behaviors do not have a method or closure named &quot;getBasePath&quot;.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking into the docs, &lt;code&gt;S3AssetSourceType&lt;/code&gt; does NOT have a method named &lt;code&gt;getBasePath&lt;/code&gt;, but &lt;code&gt;localAssetSourceType&lt;/code&gt; does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, does sproutforms support notification emails with attachments when using S3?&lt;/p&gt;&#xA;" OwnerUserId="4807" LastEditorUserId="57" LastEditDate="2016-02-24T20:23:53.283" LastActivityDate="2016-05-26T23:44:01.643" Title="Email notifications with attachment when uploading files to s3" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13887" PostTypeId="2" ParentId="13875" CreationDate="2016-02-24T20:27:16.070" Score="1" Body="&lt;p&gt;A further requirement came up to change the Italian output (symbol moved to &lt;em&gt;after&lt;/em&gt; the price rather than &lt;em&gt;before&lt;/em&gt;) so I opted for a simple Twig extension:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Wrapper for Craft's NumberFormatter-&amp;gt;formatCurrency&#xA; * Changes formats for French and Italian display&#xA; *&#xA; * @param        $value&#xA; * @param string $currency&#xA; *&#xA; * @return string&#xA; */&#xA;public function currencyDisplay ($value, $currency = 'GBP')&#xA;{&#xA;    $value = craft()-&amp;gt;numberFormatter-&amp;gt;formatCurrency($value, $currency);&#xA;    $localeId = craft()-&amp;gt;locale-&amp;gt;id;&#xA;&#xA;    if ($localeId == 'fr')&#xA;    {&#xA;        $value = str_replace('£UK', '£', $value); // remove UK&#xA;    }&#xA;    else if ($localeId == 'it')&#xA;    {&#xA;        $value = str_replace('£ ', '', $value) . ' £'; // relocate sterling symbol&#xA;    }&#xA;&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="922" LastActivityDate="2016-02-24T20:27:16.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13888" PostTypeId="2" ParentId="13868" CreationDate="2016-02-24T22:18:31.150" Score="3" Body="&lt;p&gt;I would question the need to have relative URLs to begin with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/13876/1016&quot;&gt;Brad mentions&lt;/a&gt;, Craft neatly solves the multi-environment problem for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you come from an environment like WordPress where it makes absolute URLs for you and then you end up having to do a find-replace on the content when switching environments (since there's no &quot;built-in&quot; way to do it), I can see where your co-worker might think relative is the way to go. However, even WP has good reason to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back before content management systems, relative URLs were probably the way to go because they are easier to code by hand; if you used conventions like &quot;../&quot; your pages also worked locally. Now with systems like Craft and local testing servers, creating links within content is much more consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft even has a find/replace tool in the CP if you want to make sure those staging/production URLs absolutely get switched over in the database as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking of consistency, google wants you to be as efficient as possible. From an SEO perspective, this &lt;a href=&quot;https://moz.com/blog/relative-vs-absolute-urls-whiteboard-friday&quot; rel=&quot;nofollow noreferrer&quot;&gt;moz post&lt;/a&gt; goes over the pros and cons of relative vs absolute but a few points worth summarizing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scrapers&lt;/strong&gt; can be a big problem stealing your content. Absolute URLs make it a bit more difficult for the laziest of them. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By using things like &lt;code&gt;rel=&quot;canonical&quot;&lt;/code&gt; and letting Craft spit out your main base URL consistently, you can help avoid &lt;strong&gt;duplicate content&lt;/strong&gt; issues.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://yoast.com/dev-blog/relative-urls-issues/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yoast&lt;/a&gt; gives some thoughts on this as well but I'll leave you with one takeaway:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The few minutes a developer might save by using relative URLs are offset by countless hours an SEO might be spending to solve the issues caused.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-24T22:28:34.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13889" PostTypeId="2" ParentId="13832" CreationDate="2016-02-24T23:22:20.277" Score="5" Body="&lt;p&gt;You can use &lt;a href=&quot;https://craftcms.com/classreference/helpers/UrlHelper#getSiteUrl-detail&quot; rel=&quot;nofollow&quot;&gt;UrlHelper::getSiteUrl()&lt;/a&gt; instead, which does have a &lt;code&gt;$localeId&lt;/code&gt; argument, for generating a URL relative to a given locale’s base URL (per the &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt; config setting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if your &lt;code&gt;siteUrl&lt;/code&gt; config setting is set to:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://example.com/',&#xA;    'de' =&amp;gt; 'http://example.com/de/',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;UrlHelper::getSiteUrl('foo/bar', null, null, 'de');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it will return this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;http://example.com/de/foo/bar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Regardless of which site you call it from.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UrlHelper::getSiteUrl() is also available to Twig templates via a &lt;code&gt;siteUrl()&lt;/code&gt; global function:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;{{ siteUrl('foo/bar', null, null, 'de') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-02-24T23:27:47.323" LastActivityDate="2016-02-24T23:27:47.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13890" PostTypeId="2" ParentId="4522" CreationDate="2016-02-25T01:50:11.463" Score="3" Body="&lt;p&gt;We use redis to store cache and now sessions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just got this working with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'cacheMethod' =&amp;gt; 'redis',&#xA;'overridePhpSessionLocation' =&amp;gt; 'tcp://redis.dev:6379'&lt;/code&gt; in my general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;code&gt;ini_set('session.save_handler', 'redis');&lt;/code&gt; in my index.php&lt;/p&gt;&#xA;" OwnerUserId="672" LastActivityDate="2016-02-25T01:50:11.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13891" PostTypeId="1" AcceptedAnswerId="13952" CreationDate="2016-02-25T02:20:35.277" Score="2" ViewCount="415" Body="&lt;p&gt;Can you create an Entry with content only for a specific Locale? For instance, I have &lt;code&gt;U.S. English (en_us)&lt;/code&gt; and &lt;code&gt;German (de)&lt;/code&gt; locales setup for a section. I want to create entries, but only populate one locale. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'Testing Locale';&#xA;$entry-&amp;gt;sectionId = '14';&#xA;$entry-&amp;gt;typeId = '16';&#xA;$entry-&amp;gt;locale = 'de';&#xA;$entry-&amp;gt;localeEnabled = true;&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array('plainTextField' =&amp;gt; 'Test'));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting code above creates the entry fine, but content is present for both locales. Is this expected behaviour?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-02-29T23:35:49.407" Title="Creating locale-specific entries from plugin" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13892" PostTypeId="2" ParentId="13862" CreationDate="2016-02-25T06:40:03.357" Score="4" Body="&lt;p&gt;Solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.myFormField|length %}&#xA;    {{ block.myFormField.first().displayForm() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3560" LastActivityDate="2016-02-25T06:40:03.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13893" PostTypeId="1" AcceptedAnswerId="13899" CreationDate="2016-02-25T10:08:52.537" Score="3" ViewCount="462" Body="&lt;p&gt;For a plugin, I need to check if a certain field exists in a section. How can i manage that? I'm using the settings section from the plugin, looping through all sections by &lt;code&gt;craft()-&amp;gt;sections-&amp;gt;getAllSections()&lt;/code&gt; and in the template with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in sections %}&#xA;    {% if section['specificfield'] is not defined %}&#xA;        do something&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to be working. Any ideas on how to check correctly?&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-25T14:25:35.587" Title="How can you check if a field exists in a section, not by entry?" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13894" PostTypeId="1" CreationDate="2016-02-25T10:13:02.333" Score="1" ViewCount="3672" Body="&lt;p&gt;I have created a separate asset source to upload my css on Amazon S3 cloud service. Initially, it was not allowing me to upload the files to S3. After adding CSS in the &lt;code&gt;extraAllowedFileExtensions&lt;/code&gt; in the &lt;code&gt;config&amp;gt;general.php&lt;/code&gt; file, I was able to upload the CSS file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code in the template to load the css&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;&#xA;{% for cssfile in craft.assets.source('css') %}&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ cssfile.url }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the link tags for each CSS file in the HTML source code, the URL is functional. However, browser refuses to render those files. If I go into chrome &lt;code&gt;console&amp;gt;sources&lt;/code&gt;, I can see all the CSS files listed there but they are empty!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I create a new css asset source locally on the server, everything works (without changing anything inside the template)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am really confused. I have never ever encountered a problem where browser refuses to read the css file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other assets such as js, images etc are loading properly from amazon S3. The only issue seems to be with css&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="57" LastEditDate="2016-02-25T17:40:16.470" LastActivityDate="2017-04-05T21:16:45.250" Title="CSS uploaded to S3 is not rendering in the browser" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13895" PostTypeId="2" ParentId="13894" CreationDate="2016-02-25T10:23:11.210" Score="3" Body="&lt;p&gt;Have you added the css content-type on S3? You can check this in the console &gt; network tab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;s3cmd put -m &quot;text/css&quot; $YOUR_PATH s3://$BUCKET/$YOUR PATH&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-25T10:23:11.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13896" PostTypeId="2" ParentId="4220" CreationDate="2016-02-25T10:39:56.413" Score="3" Body="&lt;p&gt;Got a solution that is cleaner than nested for loops.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myRelatedImage = entry.relatedImages.first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src='{{ myRelatedImage.images.first.url }}'&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My use case was slightly different. I have a bunch of sermons entries that are related to a series entry. It's the series entry that has the image attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This worked very nicely.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-02-25T10:39:56.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13898" PostTypeId="1" AcceptedAnswerId="13903" CreationDate="2016-02-25T14:08:11.987" Score="4" ViewCount="297" Body="&lt;p&gt;I think there is a bug in the getHeadHtml function of craft. In the Documentation (&lt;a href=&quot;https://craftcms.com/docs/templating/includecss&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/includecss&lt;/a&gt;) it says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Your CSS snippet will be output by the getHeadHtml() function. If you aren’t calling that function anywhere, Craft will insert it right before the HTML’s &amp;lt; /head&gt; tag.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But in my templates it works only, if the tag getHeadHtml() is placed after the includeCss Tag.&#xA;So the following simple Example does not work as expected: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;title&amp;gt;Title&amp;lt;/title&amp;gt;&#xA;    &amp;lt;!-- Here should the CSS start --&amp;gt; &#xA;        {{ getHeadHtml() }}&#xA;    &amp;lt;!-- Here should the CSS end --&amp;gt; &#xA;  &amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt;&#xA;&#xA;      {% set myCss %}&#xA;        .content {&#xA;            color:  red;&#xA;        }&#xA;      {% endset %}&#xA;&#xA;&#xA;      {% includeCss myCss %}&#xA;&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It outputs the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;title&amp;gt;Title&amp;lt;/title&amp;gt;&#xA;    &amp;lt;!-- Here should the CSS start --&amp;gt; &#xA;&#xA;    &amp;lt;!-- Here should the CSS end --&amp;gt; &#xA;  &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;  .content {&#xA;            color:  red;&#xA;        }&#xA;  &amp;lt;/style&amp;gt;&amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt; &#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It outputs the CSS before the closing &amp;lt; /head&gt; Tag and not between the two comments. Is there any workaround/fix for this?&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="9" LastEditDate="2016-02-25T19:16:27.210" LastActivityDate="2016-02-25T19:16:27.210" Title="getHeadHtml() not outputting CSS included with {% includeCss %}" Tags="&lt;templating&gt;&lt;getheadhtml&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13899" PostTypeId="2" ParentId="13893" CreationDate="2016-02-25T14:25:35.587" Score="3" Body="&lt;p&gt;The solution is to &lt;code&gt;getEntryTypes()&lt;/code&gt; from your section and then access the &lt;code&gt;getFieldLayout()&lt;/code&gt; to get to the &lt;code&gt;getFields()&lt;/code&gt; (thanks again @Khalwat!). Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in sections %}&#xA;    {% if section.getEntryTypes()[0].getFieldLayout().getFields()[0].getField().handle == 'specificfield' %}&#xA;        do something&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice though that I specifically search for the first occurances, in (most) other cases you should &lt;code&gt;foreach&lt;/code&gt; the &lt;code&gt;getEntryTypes()&lt;/code&gt; and &lt;code&gt;getFields()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-25T14:25:35.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13900" PostTypeId="1" AcceptedAnswerId="13980" CreationDate="2016-02-25T17:14:00.663" Score="1" ViewCount="1297" Body="&lt;p&gt;I'm using the wonderful &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow&quot;&gt;A&amp;amp;M form plugin&lt;/a&gt; to create a form on my site, and I have 3 dropdowns for the user's birthday: month, day, and year.  Currently, I have it set up so that when the form submits, those values get put into a matrix field when logged in the form submissions entry in the CMS.  I would prefer to have it put into a date/time field though, but I'm unsure how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code in my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Birthday&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[birthday][new1][type]&quot; value=&quot;date&quot;&amp;gt;&#xA;&amp;lt;div id=&quot;birthday&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;fields[birthday][new1][fields][month]&quot;&amp;gt;&#xA;        &amp;lt;option selected=&quot;selected&quot; value=&quot;&quot;&amp;gt;M&amp;lt;/option&amp;gt;&#xA;        {% for i in 1..12 %}&#xA;            &amp;lt;option value=&quot;{{ i }}&quot;&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;select name=&quot;fields[birthday][new1][fields][day]&quot;&amp;gt;&#xA;    &amp;lt;option selected=&quot;selected&quot; value=&quot;&quot;&amp;gt;D&amp;lt;/option&amp;gt;&#xA;        {% for i in 1..31 %}&#xA;            &amp;lt;option value=&quot;{{ i }}&quot;&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;select name=&quot;fields[birthday][new1][fields][year]&quot;&amp;gt;&#xA;        &amp;lt;option selected=&quot;selected&quot; value=&quot;&quot;&amp;gt;Year&amp;lt;/option&amp;gt;&#xA;        {% set startYear = now.year - 15 %}&#xA;        {% set endYear = now.year - 110 %}&#xA;        {% for i in startYear..endYear %}&#xA;            &amp;lt;option value=&quot;{{ i }}&quot;&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, &quot;&lt;strong&gt;birthday&lt;/strong&gt;&quot; is my matrix field handle and &quot;&lt;strong&gt;date&lt;/strong&gt;&quot; is the block type handle.  &quot;&lt;strong&gt;month&lt;/strong&gt;&quot;, &quot;&lt;strong&gt;day&lt;/strong&gt;&quot;, &amp;amp; &quot;&lt;strong&gt;year&lt;/strong&gt;&quot; are obviously the field handles within the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing in the docs. I understand a date/time field doesn't produce an object like a matrix field, but I can't think of a solution of how to convert it.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-06-20T16:47:34.193" Title="Create date/time from string via form" Tags="&lt;form&gt;&lt;datetime&gt;&lt;plugin-amforms&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13901" PostTypeId="2" ParentId="13900" CreationDate="2016-02-25T17:58:53.437" Score="1" Body="&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/a/471/12&quot;&gt;this answer&lt;/a&gt; to a similar question, I think you can use a date field within your Matrix and set the value using the following date format: &lt;code&gt;Y-m-d&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'd combine the three parts of the birthday (year, month, day format) into the value to be submitted. Do this via JS or you can use the HTML5 Date type (&lt;a href=&quot;http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_date&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt;) or some form of datepicker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Date type doesn't work with all browser so you'll need something like Modernizer, webshim and or jQuery/UI type fixes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a few places to learn more about how to use this with IE:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/22983013/how-to-get-html-5-input-type-date-working-in-firefox-and-or-ie-10&quot;&gt;https://stackoverflow.com/questions/22983013/how-to-get-html-5-input-type-date-working-in-firefox-and-or-ie-10&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pietschsoft.com/post/2010/11/18/html5-day-5-new-date-input-type&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pietschsoft.com/post/2010/11/18/html5-day-5-new-date-input-type&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/chemerisuk/better-dateinput-polyfill&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/chemerisuk/better-dateinput-polyfill&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.wufoo.com/html5/types/4-date.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.wufoo.com/html5/types/4-date.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-02-25T17:58:53.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13902" PostTypeId="2" ParentId="13894" CreationDate="2016-02-25T18:21:10.813" Score="0" Body="&lt;p&gt;Wow! I am not sure what happened but I need 50 reputation points to even post a comment on my own thread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am going to put my comments as an answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is indeed content-type issue. However, the problem is still a Craft problem because the css file uploads are taking place via Craft's UI. I believe that the PUT object API calls via Craft's UI are not sending the correct Content-Type headers for the css files. When I use a third party provider to upload the css file to S3 bucket, the problem disappears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to fix this?&lt;/p&gt;&#xA;" OwnerUserId="4815" LastActivityDate="2016-02-25T18:21:10.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13903" PostTypeId="2" ParentId="13898" CreationDate="2016-02-25T19:12:11.490" Score="6" Body="&lt;p&gt;This is just an order of operations issue. The documentation is correct, but incomplete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;getHeadHtml()&lt;/code&gt; will only output head HTML that was queued up for it &lt;em&gt;before&lt;/em&gt; the function was actually called. Any head HTML that is queued up &lt;em&gt;after&lt;/em&gt; you've called &lt;code&gt;getHeadHtml()&lt;/code&gt; will end up getting inserted in the default location - right before the &lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you had this in your template instead:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% includecss %}&#xA;  .content {&#xA;      color:  red;&#xA;  }&#xA;{% endincludecss %}&#xA;&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;  &amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;title&amp;gt;Title&amp;lt;/title&amp;gt;&#xA;    &amp;lt;!-- Here should the CSS start --&amp;gt; &#xA;        {{ getHeadHtml() }}&#xA;    &amp;lt;!-- Here should the CSS end --&amp;gt; &#xA;  &amp;lt;/head&amp;gt;&#xA;  &amp;lt;body&amp;gt;&#xA;&#xA;  &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the CSS would get included between the HTML comments as you’d expect.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-02-25T19:12:11.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13904" PostTypeId="5" CreationDate="2016-02-25T19:39:06.023" Score="0" Body="&lt;p&gt;See Craft's &lt;a href=&quot;https://craftcms.com/docs/plugins/templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Templates Documentation&lt;/a&gt; for more.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:03:15.220" LastActivityDate="2017-05-10T02:03:15.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13905" PostTypeId="4" CreationDate="2016-02-25T19:39:06.023" Score="0" Body="Front-end Twig templates that can Craftily render markup, scripts, and styles. " OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-02-25T19:39:06.023" LastActivityDate="2016-02-25T19:39:06.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13906" PostTypeId="1" AcceptedAnswerId="13930" CreationDate="2016-02-25T19:58:08.553" Score="0" ViewCount="231" Body="&lt;p&gt;I have a form for people offering or requesting to share-a-lift to an event.&#xA;I'm using the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I need them to be able to edit and delete those entries, as once a pair are matched up they need removing from the list of offers/requests to avoid multiple offers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page with the list of the lifts on offer or requested and have a link from each of the entries to the form page but with the entryId as segment 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I code the Delete button?&lt;/strong&gt; (turns out you can't)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate that this is not the most secure way of doing things, but the client has been using a similar form/method on their old site and have not had any fraudulent or malicious issues in many years.&#xA;If anyone can suggest a more secure method without any logins or registration I'm open to ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The final solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can't delete or edit Guest Entries @carlcs came up with the idea of allowing a second entry (in another entry type) with a common field to the first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template listing all the offers and requests you look for entries from both entry types with a matching field, and if a match is found don't show either. See the code in his answer for the details.&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2016-02-28T18:03:36.800" LastActivityDate="2016-02-28T18:03:36.800" Title="Using the Guest Entries plugin, how can I allow people to edit/delete?" Tags="&lt;plugin-guestentries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13907" PostTypeId="1" AcceptedAnswerId="13909" CreationDate="2016-02-25T20:06:07.343" Score="3" ViewCount="124" Body="&lt;p&gt;I think I'm seeing a bug while using advanced search with &lt;code&gt;relatedTo()&lt;/code&gt;. If I use a simple search, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set param = {&#xA;   order: 'RAND()',&#xA;   limit: null,&#xA;   search: &quot;#{request.tags}&quot;&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It finds a tag like &lt;code&gt;low confidence&lt;/code&gt; without any issue. However, using the code I have below throws no errors, but returns no results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set request = craft.request.getQuery() %}&#xA;&#xA;{% set param = {&#xA;  order: 'RAND()',&#xA;  limit: null,&#xA;} %}&#xA;&#xA;{% set param = craft.config.devMode or craft.config.staging&#xA;             ? param|merge({ group: 'testing' })&#xA;             : param|merge({ group: 'verified' }) %}&#xA;&#xA;{% set relatedToParam = ['and'] %}&#xA;&#xA;{% if request.tags %}&#xA;  {% set tagId = craft.tags.group('specialism').slug(request.tags).ids() %}&#xA;  {% set relatedToParam = relatedToParam|merge([{&#xA;    targetElement: tagId,&#xA;    field: 'tagsSpecialism',&#xA;  }]) %}&#xA;{% endif %}&#xA;&#xA;{% if relatedToParam|length &amp;gt; 1 %}&#xA;    {% set param = param|merge({ relatedTo: relatedToParam }) %}&#xA;{% endif %}&#xA;&#xA;{% set users = craft.users(param) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I'm fairly confident it's not an issue with my code, as every other search combination is working.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is expected behaviour and requires proper hyphenated &lt;code&gt;slug-path&lt;/code&gt; to work properly with &lt;code&gt;.slug()&lt;/code&gt; in my code sample. See answer below!&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="3888" LastEditDate="2016-02-26T16:57:37.850" LastActivityDate="2016-02-26T16:57:37.850" Title=".relatedTo() not returning tags with spaces" Tags="&lt;relations&gt;&lt;search&gt;&lt;tags&gt;&lt;slug&gt;&lt;whitespace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13908" PostTypeId="2" ParentId="13900" CreationDate="2016-02-25T20:32:53.630" Score="1" Body="&lt;p&gt;I was using a &lt;a href=&quot;https://eonasdan.github.io/bootstrap-datetimepicker/&quot; rel=&quot;nofollow noreferrer&quot;&gt;date picker&lt;/a&gt; instead of a drop-down menu to capture submissions. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12724/how-can-i-set-the-postdate-and-expirydate-from-a-front-end-date-picker-via-plugi&quot;&gt;Here is how I captured &amp;amp; formatted&lt;/a&gt; the date/time from the front-end to store as a dateTime field in the CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While not &lt;em&gt;exactly&lt;/em&gt; the same, I think along with the answer @Natetronn provided and my example might help get the format correct.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-25T20:32:53.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13909" PostTypeId="2" ParentId="13907" CreationDate="2016-02-25T22:06:16.403" Score="5" Body="&lt;p&gt;In your working example, you’re mapping &lt;code&gt;request.tags&lt;/code&gt; to the &lt;code&gt;search&lt;/code&gt; param, but in the non-working example, you’re mapping it to the &lt;code&gt;slug&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those two params are handled in very different ways. &lt;code&gt;search&lt;/code&gt; will do some normalization routines on the value, and perform a very loose search for those keywords (see &lt;a href=&quot;https://craftcms.com/docs/searching&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt; for more details). But the &lt;code&gt;slug&lt;/code&gt; param will actually look for an exact match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if &lt;code&gt;request.tags&lt;/code&gt; is set to &lt;code&gt;&quot;low confidence&quot;&lt;/code&gt; and you pass that value into a &lt;code&gt;slug&lt;/code&gt; param, I have &lt;em&gt;complete&lt;/em&gt; confidence that it will return zero results, since &lt;code&gt;&quot;low confidence&quot;&lt;/code&gt; isn’t actually a valid slug (see what I did there?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would have slightly better luck passing &lt;code&gt;request.tags&lt;/code&gt; through the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#kebab&quot;&gt;kebab filter&lt;/a&gt;, which will make the value look a little more like a valid slug. But the &lt;code&gt;search&lt;/code&gt; param is probably a better bet unless you know for sure that &lt;code&gt;request.tags&lt;/code&gt; is actually going to be a slug.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-02-25T22:06:16.403" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13910" PostTypeId="2" ParentId="13906" CreationDate="2016-02-25T22:09:44.600" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Using the Guest Entries plugin, how can I allow people to edit/delete?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As it currently stands, you can't. The Guest Entries plugin was written to accept new entries only.  That's largely because, as you've touched on, they are &quot;anonymous&quot; submissions and there's no secure/easy way to authenticate that the user has permissions to edit/delete the entry they are trying to edit/delete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd need to fork the plugin and add your own custom logic to achieve what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-25T22:09:44.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13911" PostTypeId="1" CreationDate="2016-02-25T22:48:40.373" Score="0" ViewCount="970" Body="&lt;p&gt;Trying to run an import using the Import Plugin but I keep getting errors.&#xA;Checking the Logs the error is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cannot modify header information - headers already sent (C:\sitepath\craft\app\framework\web\CHttpRequest.php:1490) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The line 1490 is the first setcookie line in the code below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried downloading the latest version of Craft but has made no difference.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function removeCookie($cookie)&#xA;{&#xA;    if(version_compare(PHP_VERSION,'5.2.0','&amp;gt;='))&#xA;        setcookie($cookie-&amp;gt;name,'',0,$cookie-&amp;gt;path,$cookie-&amp;gt;domain,$cookie-&amp;gt;secure,$cookie-&amp;gt;httpOnly);&#xA;    else&#xA;        setcookie($cookie-&amp;gt;name,'',0,$cookie-&amp;gt;path,$cookie-&amp;gt;domain,$cookie-&amp;gt;secure);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this a Craft bug or what is the cause of this error?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2016-03-27T03:57:02.623" Title="PHP Error - Cannot modify header information - headers already sent" Tags="&lt;error-message&gt;&lt;error&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13912" PostTypeId="1" CreationDate="2016-02-26T01:22:30.800" Score="0" ViewCount="104" Body="&lt;p&gt;I wondered if we could embellish from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/449/how-can-i-make-a-template-output-its-own-filename#answer-450&quot;&gt;this answer&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm developing a plugin where at some point it needs to detect if the user is currently on one of the error pages (400, 403, 404, 500, or 503). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure of any built in methods within craft, so I figured an easier solution would be to just check the file name being used. Php's &lt;code&gt;__FILE__&lt;/code&gt; method refers to the .php file it was called from. I can't seem to grasp how to use &lt;code&gt;getTemplateName()&lt;/code&gt; within a plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to detect the error page, or a clean way of detecting the template file being used?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-02-26T01:22:30.800" Title="How to use getTemplateName() from within a plugin?" Tags="&lt;plugins&gt;&lt;error-templates&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13913" PostTypeId="2" ParentId="13911" CreationDate="2016-02-26T03:43:07.220" Score="1" Body="&lt;p&gt;That error means that &lt;em&gt;something&lt;/em&gt; is being output to the browser before it's supposed to be.  In this case, it's cookie information (or more specifically, the removal of a cookie by adding one with the same name, no value and an expired date).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, what's calling &lt;code&gt;removeCookie&lt;/code&gt;?  If you enable &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, then the error should present with a stack trace where you can follow the programs execution to see what's leading up to that call.  My guess is something in the Import plugin (or maybe another plugin) is the culprit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-26T03:43:07.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13915" PostTypeId="1" CreationDate="2016-02-26T10:47:17.533" Score="0" ViewCount="100" Body="&lt;p&gt;The builtin craft image resizer tool appears to be having issues with CMYK source images, we're using Craft 2.5 (latest version)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original source image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://2b45fe03c2dbd491035c-f318885d2d6632cd7d9eb38c0fa500f2.r62.cf1.rackcdn.com/new_site/film/images/EXM_D016_02432_42886.jpg&quot; rel=&quot;nofollow&quot;&gt;http://2b45fe03c2dbd491035c-f318885d2d6632cd7d9eb38c0fa500f2.r62.cf1.rackcdn.com/new_site/film/images/EXM_D016_02432_42886.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforms to this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://2b45fe03c2dbd491035c-f318885d2d6632cd7d9eb38c0fa500f2.r62.cf1.rackcdn.com/new_site/film/images/_assetImageGrid/EXM_D016_02432_42886.jpg&quot; rel=&quot;nofollow&quot;&gt;http://2b45fe03c2dbd491035c-f318885d2d6632cd7d9eb38c0fa500f2.r62.cf1.rackcdn.com/new_site/film/images/_assetImageGrid/EXM_D016_02432_42886.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution to this issue that we can implement, or is it simply a case that CMYK images cannot be resized by the system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2016-02-29T16:26:14.383" Title="image transforms issue with CMYK images" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="8" ClosedDate="2016-03-02T18:11:18.903" ContentLicense="CC BY-SA 3.0" />
  <row Id="13916" PostTypeId="1" AcceptedAnswerId="13925" CreationDate="2016-02-26T12:22:56.360" Score="6" ViewCount="265" Body="&lt;p&gt;So here's something I've never been able to figure out about Twig. Does it make a difference if you include the parenthesis for functions or not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, what is the difference – if any – between calling&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.first&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-02-26T12:28:53.080" LastActivityDate="2016-02-27T12:09:13.913" Title="What is the difference between calling .first and .first()?" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13917" PostTypeId="1" AcceptedAnswerId="13918" CreationDate="2016-02-26T12:32:27.907" Score="2" ViewCount="1275" Body="&lt;p&gt;I want to change the max_execution_time in the .htaccess file. I tried it in this way: &lt;code&gt;&amp;lt;IfModule mod_php5.c&amp;gt; php_value max_execution_time 300 &amp;lt;/IfModule&amp;gt;&lt;/code&gt; but then I got a &lt;em&gt;500 internal server error&lt;/em&gt;. &#xA;My .htaccess file also includes this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea why I got this error? Or how I can change the max_execution_time in an other way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I sadly do not have the possibility to change the php.ini)&lt;/p&gt;&#xA;" OwnerUserId="3513" LastActivityDate="2016-02-26T12:43:57.080" Title=".htaccess max_execution_time" Tags="&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13918" PostTypeId="2" ParentId="13917" CreationDate="2016-02-26T12:43:57.080" Score="4" Body="&lt;p&gt;You can alter the index.php file and add &lt;code&gt;[set_time_limit][1](300);&lt;/code&gt; anywhere below the &lt;code&gt;&amp;lt;?php&lt;/code&gt; tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try to set it by &lt;code&gt;ini_set('max_execution_time', 300);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For the reason why it returns a 500 Internal Server Error, the server does not support the &lt;code&gt;php_value&lt;/code&gt; and &lt;code&gt;php_flag&lt;/code&gt; parameters through the htaccess file or it doesnt use the php5 module. You can try setting the &lt;code&gt;php_value&lt;/code&gt; directly and check again for errors, or contact your hosting provider for support&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4588" LastActivityDate="2016-02-26T12:43:57.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13919" PostTypeId="1" CreationDate="2016-02-26T14:28:39.587" Score="4" ViewCount="287" Body="&lt;p&gt;I have a Task that is running through a collection of elements, moving some data from one field to another. The problem I am hitting (more and more with situations like this) is that in order to update just one field of an element, using the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;recommended&lt;/a&gt; &lt;code&gt;BaseElementModel::setContentFromPost()&lt;/code&gt; method, I have to also account for all kinds of other values to get it to validate and save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you need to specify the IDs (from questions like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12368/updating-a-single-custom-field-within-an-entry&quot;&gt;these&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11661/programmatically-update-entry-field&quot;&gt;two&lt;/a&gt;) for any relation fields that are required, which is not ideal, but not a huge issue in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on this project I also have the Venti plugin installed, with its &lt;code&gt;Venti_EventFieldType&lt;/code&gt; for dates and RRULEs, and I'm having to manually pass through a big array of any existing start/end date information into &lt;code&gt;setContentFromPost()&lt;/code&gt; just so the validation for that field will pass, even though I'm doing absolutely nothing with that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there not a single way to update a single field's value, without already knowing the way data needs to be formatted for &lt;em&gt;any&lt;/em&gt; other fields that might be on that &lt;code&gt;ContentModel&lt;/code&gt;? Otherwise I don't see how a general-release plugin could be made that can modify existing elements, without knowing about the &lt;code&gt;setContentFromPost()&lt;/code&gt;-specific data format of every possible Field Type in advance.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-03-23T05:07:51.833" Title="Updating just a single content field from a plugin" Tags="&lt;plugin-development&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13920" PostTypeId="1" AcceptedAnswerId="14180" CreationDate="2016-02-26T15:46:24.713" Score="0" ViewCount="142" Body="&lt;p&gt;This just started happening. When I am logged in as admin and system status was off I could still see the front end. Now I can't. I need to set the system status to on in order to see the front end. This isn't ideal for development. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="4660" LastEditorUserId="57" LastEditDate="2016-02-26T21:34:47.037" LastActivityDate="2016-03-17T12:37:01.187" Title="Logged in admin, can't see front end site when system is off" Tags="&lt;system-status&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13921" PostTypeId="1" AcceptedAnswerId="13922" CreationDate="2016-02-26T15:51:17.333" Score="3" ViewCount="574" Body="&lt;p&gt;I have created an Asset field type and have the &quot;restrict file types&quot; option not checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I attempt to upload a file with extension .PSD i get the message &lt;code&gt;Upload failed for 020516_Action-Buttons_Desktop.psd. The error message was: “Error uploading the file: This file type is not allowed”&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a setting someplace else thats preventing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried checking the restrict option and selecting &quot;Photoshop file&quot;. But this also did not work.&lt;/p&gt;&#xA;" OwnerUserId="774" LastEditorUserId="57" LastEditDate="2016-02-26T17:36:08.807" LastActivityDate="2016-02-26T17:36:08.807" Title="Uploading PSD files not possible" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13922" PostTypeId="2" ParentId="13921" CreationDate="2016-02-26T15:57:31.427" Score="9" Body="&lt;p&gt;You can add the &lt;code&gt;psd&lt;/code&gt; extension to &lt;code&gt;extraAllowedFileExtensions&lt;/code&gt; in your config file. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'extraAllowedFileExtensions' =&amp;gt; 'psd'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#extraAllowedFileExtensions&quot;&gt;https://craftcms.com/docs/config-settings#extraAllowedFileExtensions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-02-26T15:57:31.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13923" PostTypeId="2" ParentId="13916" CreationDate="2016-02-26T16:15:54.797" Score="3" Body="&lt;p&gt;There is absolutely no difference. Twig will recognize a method without parenthesis as simply being a method without parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only &quot;gotcha&quot; is if you &lt;em&gt;also&lt;/em&gt; happen to have a property by the same name in your class. It's probably a bad idea to do so anyway, but if you have a method &amp;amp; property sharing the same name, Twig will parse the parenthesis-less name as the property value instead.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-02-26T16:15:54.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13924" PostTypeId="1" AcceptedAnswerId="13926" CreationDate="2016-02-26T16:43:38.150" Score="4" ViewCount="2240" Body="&lt;p&gt;I've tried to integrate the video.js plugin for Redactor. It allows me to insert a YouTube embed (as expected) but the iframe code is stripped out on save. Using the latest Craft 2.5 build. Anyone experienced the same? Solutions?&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2016-02-26T17:40:36.310" Title="Redactor video plugin not working" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13925" PostTypeId="2" ParentId="13916" CreationDate="2016-02-26T17:37:07.617" Score="6" Body="&lt;p&gt;I think it was Ben Croker who mentioned this &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#variables&quot;&gt;nugget from the Twig docs&lt;/a&gt; in his Craft course on development:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For convenience's sake &lt;code&gt;foo.bar&lt;/code&gt; does the following things on the PHP layer:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;check if &lt;code&gt;foo&lt;/code&gt; is an array and &lt;code&gt;bar&lt;/code&gt; a valid &lt;strong&gt;element&lt;/strong&gt;;&lt;/li&gt;&#xA;  &lt;li&gt;if not, and if &lt;code&gt;foo&lt;/code&gt; is an object, check that &lt;code&gt;bar&lt;/code&gt; is a valid &lt;strong&gt;property&lt;/strong&gt;;&lt;/li&gt;&#xA;  &lt;li&gt;if not, and if &lt;code&gt;foo&lt;/code&gt; is an object, check that &lt;code&gt;bar&lt;/code&gt; is a valid &lt;strong&gt;method&lt;/strong&gt; (even if &lt;code&gt;bar&lt;/code&gt; is the constructor - use &lt;code&gt;__construct()&lt;/code&gt; instead);&lt;/li&gt;&#xA;  &lt;li&gt;if not, and if &lt;code&gt;foo&lt;/code&gt; is an object, check that &lt;code&gt;getBar&lt;/code&gt; is a valid &lt;strong&gt;method&lt;/strong&gt;;&lt;/li&gt;&#xA;  &lt;li&gt;if not, and if &lt;code&gt;foo&lt;/code&gt; is an object, check that &lt;code&gt;isBar&lt;/code&gt; is a valid &lt;strong&gt;method&lt;/strong&gt;;&lt;/li&gt;&#xA;  &lt;li&gt;if not, return a &lt;strong&gt;null value&lt;/strong&gt;.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;foo['bar']&lt;/code&gt; on the other hand only works with PHP arrays:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;check if &lt;code&gt;foo&lt;/code&gt; is an array and bar a valid element;&lt;/li&gt;&#xA;  &lt;li&gt;if not, return a null value.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The more you find out about Twig, the more you don't know!&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-02-26T17:37:07.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13926" PostTypeId="2" ParentId="13924" CreationDate="2016-02-26T17:40:36.310" Score="11" Body="&lt;p&gt;You've probably got &quot;Purify HTML&quot; checked under your Rich Text field's settings and that's stripping iframe code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should really only have that checked if you're accepting input from untrusted sources using the Rich Text field on the front-end of your site.  Presumably all users using the control panel are trusted enough not to input malicious code into the site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-26T17:40:36.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13927" PostTypeId="1" AcceptedAnswerId="13934" CreationDate="2016-02-26T18:42:21.350" Score="0" ViewCount="1022" Body="&lt;p&gt;I'm building a plugin, and it all worked just fine until I decided to change the front-end form submission to use AJAX instead of submitting directly. I have a form on the front-end with this action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;gtPoll__form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; action=&quot;&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;gtPoll/poll/incrementAnswer&quot;&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and a controller at &lt;code&gt;/craft/plugins/controllers/GtPoll_PollController.php&lt;/code&gt; with the method &lt;code&gt;actionIncrementAnswer()&lt;/code&gt;. I also have the line &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;protected $allowAnonymous = array('actionIncrementAnswer');&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this controller class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I submit that form via AJAX on the front-end (to the URL in the action value), I get a 404 and the rest of my JavaScript breaks, but the controller action DOES complete and the answer count is incremented properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add this code to my main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;    {&#xA;        return array(&#xA;            'gtPoll/poll/incrementAnswer' =&amp;gt; array( 'action' =&amp;gt; 'gtPoll/poll/incrementAnswer')&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I don't get the 404 and my JavaScript all works, but the controller action occurs twice each time the AJAX call is made, so my answer count is doubly incremented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure what's going on. I also tried using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ actionUrl('gtPoll/poll/incrementAnswer') }}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the hidden action field, but that doesn't work at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the correct way to access this controller action from the front-end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4819" LastActivityDate="2016-02-27T18:44:39.697" Title="How do I properly access plugin controllers from the front-end?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13928" PostTypeId="2" ParentId="13927" CreationDate="2016-02-26T19:44:23.493" Score="2" Body="&lt;p&gt;Rather than submitting the form, try hitting it with the &lt;code&gt;Craft&lt;/code&gt; JS object. Per the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;    // ...&#xA;};&#xA;&#xA;Craft.postActionRequest('cocktailRecipes/ingredients/saveIngredient', data, function(response) {&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-02-26T19:44:23.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13929" PostTypeId="1" AcceptedAnswerId="13932" CreationDate="2016-02-26T22:20:58.260" Score="2" ViewCount="201" Body="&lt;p&gt;I'm trying to pull all the entries in a category that have a multi-selection selected and then paginate it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just do the below, it works perfectly fine. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesRed = craft.entries.section('eventRentals').relatedTo(category) %}&#xA;{% for entry in entriesRed if entry.rentalColor.contains('red') %}&#xA;            {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But now I want to paginate it and I can't quite get the right syntax. To be clear, it's the top part I can't get a hold of, I'm modifying an already working existing pagination so I'm not including the bottom half.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('eventRentals').relatedTo(category).limit(12).order('title') as entries if entry.rentalColor.contains('red') %}&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;{# blah blah blah rest of the pagination ul li stuff #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't work, neither does&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('eventRentals').relatedTo(category).limit(12).order('title') as entries %}&#xA;{% for entry in entries if entry.rentalColor.contains('red') %}&#xA;     {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any tips?&lt;/p&gt;&#xA;" OwnerUserId="4754" LastEditorUserId="141" LastEditDate="2016-02-27T11:50:10.767" LastActivityDate="2016-02-27T11:50:10.767" Title="Combing an If Statement with Pagination" Tags="&lt;pagination&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13930" PostTypeId="2" ParentId="13906" CreationDate="2016-02-27T01:38:00.673" Score="4" Body="&lt;p&gt;What you could try is to use the Preparse plugin and add a field to your entry type that automatically generates a secret key for each submitted entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Show the user this key on the page they are redirected to upon form submission, tell them to write it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You now set up a new guest entry form to submit matches. So instead of deleting entries, the user enters his personal secret key into a field to submit a new entry (I'd suggest to post to the same channel but different entry type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end you can now list only those requests/offers entries that do not have a matching &quot;delete&quot; entry yet. Another advantage over your delete approach is that you have a nice record and overview in the CP of what was offered and when.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no template function to generate a random string, but you could apply Craft's &lt;code&gt;shuffle&lt;/code&gt; function on an array of characters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set chars = '012345678901234567890123456789'|split('') %}&#xA;{%- set key = shuffle(chars)|join %}&#xA;&#xA;{{- key|slice(0, 6) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's how you could generate the secret keys within the Preparse field. And to loop through your &quot;requests&quot; and only show them if there's no matching &quot;response&quot; entry yet, do something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set requests = craft.entries({&#xA;    section: 'lifts',&#xA;    type: 'requests',&#xA;    limit: null,&#xA;}) %}&#xA;&#xA;{# &#xA; # Loop through all &quot;requests&quot;. Check for each of them if there's a&#xA; # matching &quot;response&quot; before outputting.&#xA; #}&#xA;{% for request in requests %}&#xA;&#xA;    {#&#xA;     # Try to get an entry of entry type &quot;responses&quot; where the &quot;secretKey&quot;&#xA;     # field value matches the &quot;secretKey&quot; of the &quot;request&quot; in the current&#xA;     # itteration of this &quot;requests&quot; loop (returns an EntryModel or NULL).&#xA;     #}&#xA;    {% set hasResponse = craft.entries({&#xA;        section: 'lifts',&#xA;        type: 'responses',&#xA;        secretKey: request.secretKey,&#xA;    }).first() %}&#xA;&#xA;    {#&#xA;     # Only output if &quot;hasResponse&quot; is not NULL&#xA;     #}&#xA;    {% if not hasResponse %}&#xA;        {{ request.message }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-02-27T20:19:35.767" LastActivityDate="2016-02-27T20:19:35.767" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13931" PostTypeId="2" ParentId="1559" CreationDate="2016-02-27T10:50:33.807" Score="-1" Body="&lt;p&gt;Simplest solution is just to deactivate all debugger stuff in mamp's PHP settings -&gt; &lt;strong&gt;Uncheck: Debugger Activate Xdebug&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4556" LastActivityDate="2016-02-27T10:50:33.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13932" PostTypeId="2" ParentId="13929" CreationDate="2016-02-27T11:29:15.137" Score="3" Body="&lt;p&gt;To get the pagination to work as expected, you need to incorporate the if into your &lt;code&gt;craft.entries&lt;/code&gt; query. There may be a more elegant solution to do this, but looking at the database, the selected choices is saved as an array-like string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;blue&quot;,&quot;red&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means that you can search for the value in the field like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('eventRentals').rentalColor('*&quot;red&quot;*').relatedTo(category).limit(12).order('title')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-27T11:29:15.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13933" PostTypeId="2" ParentId="13916" CreationDate="2016-02-27T12:09:13.913" Score="11" Body="&lt;p&gt;On a more philosophical note; Put yourself in the shoes of &lt;code&gt;first()&lt;/code&gt;. It's a &lt;strong&gt;method&lt;/strong&gt;, doing an important job in the Craft eco-system. It prides itself on returning the most important and relevant data in an efficient and unencumbered way. Serving up entry after entry, asset after asset, 24 hours a day, all week, all year. Never complaining, never getting any praise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you want to treat it like a simple &lt;strong&gt;property&lt;/strong&gt;? As a dumb, brainless reference to some data that some other method created? How do you think that makes &lt;code&gt;first()&lt;/code&gt; feel? How would &lt;strong&gt;you&lt;/strong&gt; feel if someone treated &lt;strong&gt;you&lt;/strong&gt; as property? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you're a good person with a big heart, Mats. I'm sure you will do the right thing and treat &lt;code&gt;first()&lt;/code&gt; with the respect it deserves, even though it means that you'll have to write a few more characters a day.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-02-27T12:09:13.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13934" PostTypeId="2" ParentId="13927" CreationDate="2016-02-27T18:44:39.697" Score="2" Body="&lt;p&gt;Found the solution here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5401/controller-action-works-but-still-gives-404&quot;&gt;Controller action works but still gives 404&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't returning JSON in the controller, so Craft was trying to complete the request and getting a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up removing the registerSiteRoutes method from the main plugin class and changing the action field value to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ actionUrl('gtPoll/poll/incrementAnswer') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that now works correctly!&lt;/p&gt;&#xA;" OwnerUserId="4819" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-02-27T18:44:39.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13935" PostTypeId="1" AcceptedAnswerId="13941" CreationDate="2016-02-27T19:48:10.733" Score="1" ViewCount="341" Body="&lt;p&gt;I´m working on a website of veterinary products. Some of the product fields are &quot;category&quot; and &quot;brand&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a product list page that shows a list of products of certain category, and I have a JS list to filter by &quot;brand&quot;. So, what I need is to get a list of the brands from the products of this specific category ( without repeating ), so I can create the JS filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? :)&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="22" LastEditDate="2017-05-09T22:18:42.550" LastActivityDate="2017-05-09T22:18:42.550" Title="Get a brand list of products for Javascript filter" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13936" PostTypeId="1" CreationDate="2016-02-28T00:11:08.620" Score="5" ViewCount="542" Body="&lt;p&gt;Is there somewhere documented on what field handles are reserved? Would be great to have this as a resource here, especially for plugin development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; A good place to start would be &lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/records/FieldRecord.php#L24&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/records/FieldRecord.php#L24&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="57" LastEditDate="2018-02-21T23:43:23.827" LastActivityDate="2019-06-11T15:03:05.280" Title="List of reserved field handles" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13937" PostTypeId="1" CreationDate="2016-02-28T00:32:20.013" Score="2" ViewCount="201" Body="&lt;p&gt;I try to add a custom tab to user account editing page, but there is only one default tab called 'profile' to use and we are not allowed to add another tab there. I am just wondering if this is the case and if Craft CMS will allow us to add a custom tab there in future versions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&#xA;Spencer&lt;/p&gt;&#xA;" OwnerUserId="4411" LastEditorUserId="22" LastEditDate="2017-05-09T22:17:34.363" LastActivityDate="2017-05-09T22:17:34.363" Title="How to add a custom tab in the user editing page" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13938" PostTypeId="1" CreationDate="2016-02-28T00:41:52.563" Score="2" ViewCount="544" Body="&lt;p&gt;I have a channel with entries that may or may not have a custom date field populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the display a list of entries, looping through each category, showing one entry from each category. Then just start the loop again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, show the rest of the entries which &lt;strong&gt;don't&lt;/strong&gt; have the date field populated. I guess they would just have to be just ordered by postDate, but still only showing one per category each loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So (assuming there are 3 categories in total)...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Entry - 4th April - Category 1&lt;/li&gt;&#xA;&lt;li&gt;Entry - 6th April - Category 2&lt;/li&gt;&#xA;&lt;li&gt;Entry - 8th April - Category 3&lt;/li&gt;&#xA;&lt;li&gt;Entry - 5th April - Category 1 - &lt;em&gt;start the loop through categories again&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Entry - 7th April - Category 2&lt;/li&gt;&#xA;&lt;li&gt;Entry - 9th April - Category 3&lt;/li&gt;&#xA;&lt;li&gt;Entry - Category 1&lt;/li&gt;&#xA;&lt;li&gt;Entry - Category 2&lt;/li&gt;&#xA;&lt;li&gt;Entry - Category 3&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note that the dates appear jumbled&lt;/strong&gt;, as the categories are the thing dictating the order. Date order is a factor, but secondary to the looping of the categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I have so far, all it does is output the entries but with the ones without date fields populated appearing first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('heroes').order('date') %}&#xA;&#xA;    {% if entry.date|length %}&#xA;&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; - {{ entry.date|date(&quot;j&quot;) }}{{ entry.date|date(&quot;S&quot;) }} {{ entry.date|date(&quot;F&quot;) }} {{ entry.date|date(&quot;Y&quot;)}} - {% for category in entry.genre %}{{ category.title }}{% endfor %}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense! Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="4823" LastEditDate="2016-02-28T06:57:11.643" LastActivityDate="2016-02-28T06:57:11.643" Title="Loop through entries with custom ordering, showing one from each category then start loop again" Tags="&lt;entries&gt;&lt;categories&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13939" PostTypeId="2" ParentId="13936" CreationDate="2016-02-28T00:57:49.480" Score="3" Body="&lt;p&gt;I'm not sure you want to count it as &quot;documented&quot;, but the list is in the source code repo on GitHub:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/validators/HandleValidator.php#L32&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/validators/HandleValidator.php#L32&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="57" LastEditDate="2018-02-21T23:44:19.967" LastActivityDate="2018-02-21T23:44:19.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13940" PostTypeId="2" ParentId="13938" CreationDate="2016-02-28T04:52:51.203" Score="3" Body="&lt;p&gt;I'd suggest breaking your problem down into code which gathers the IDs of each of the types of entries first, then outputs them....roughly like this (very much untested!! - but should be enough to understand the approach):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Arrays to store the IDs of the entries as we find them #}&#xA;{% set noDateIDs = [] %}&#xA;{% set dateIDs = [] %}&#xA;&#xA;{% for entry in craft.entries.section('heroes').order('date') %}&#xA;&#xA;    {% if entry.date|length %}&#xA;        {% set dateIDs = dateIDs|merge([entry.id])} %}&#xA;        {# Or of course you could output the data you want here directly but I like to keep my building and output separate for clarity #}&#xA;    {% else %}&#xA;        {% set noDateIDs = noDateIDs|merge([entry.id])}  %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set noDateIDsString = noDateIDs|join(', ') %}&#xA;{% set dateIDsString = dateIDs|join(', ')  %}&#xA;&#xA;{# Now actually output the dated entries #}&#xA;{% for entry in craft.entries.section('heroes').id(noDateIDsString).find() %}&#xA;&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; - {{ entry.date|date(&quot;j&quot;) }}{{ entry.date|date(&quot;S&quot;) }} {{ entry.date|date(&quot;F&quot;) }} {{ entry.date|date(&quot;Y&quot;)}} - {% for category in entry.genre %}{{ category.title }}{% endfor %}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Output the undated ones ordered by postDate #}&#xA;{% for entry in craft.entries.section('heroes').id(dateIDsString).order('postDate') %}&#xA;&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This approach is very useful generally in Craft, and is documented really well &lt;a href=&quot;http://webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/?utm_campaign=Craft%2BLink%2BList&amp;amp;utm_medium=email&amp;amp;utm_source=Craft_Link_List_10&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; in 'Manipulating Craft's ElementCriteriaModel objects with Twig' by Jérôme Coupé of Webstoemp &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-02-28T05:00:24.923" LastActivityDate="2016-02-28T05:00:24.923" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13941" PostTypeId="2" ParentId="13935" CreationDate="2016-02-28T05:23:28.407" Score="2" Body="&lt;p&gt;Presumably you already have the code to retrieve the products you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So just loop through your products and merge your brands in to an array.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the brands are just strings, just make an array of the strings, otherwise if they are relations, grab the ids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something along these (untested) lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set brandStrings = [] %}&#xA;{% set brandIDs = [] %}&#xA;&#xA;{% for product in products %}&#xA;    {# Either of these... #}&#xA;    {% set brandStrings = brandStrings|merge([product.brand]) %}&#xA;    {% set brandIDs = brandIDs|merge([product.brand.first().id]) %}&#xA;{% endfor %}&#xA;&#xA;{# If strings, you've now got an array #}&#xA;{# If Ids, and you need to get the names, you can do something like... #}&#xA;&#xA;{% set brands = craft.entries.id(brandIDs).find() %}&#xA;&#xA;{% for brand in brands %}&#xA;    {% set brandStrings = brandStrings|merge([brand.title]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-02-28T05:23:28.407" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13942" PostTypeId="2" ParentId="13937" CreationDate="2016-02-28T06:12:58.170" Score="2" Body="&lt;p&gt;That's currently not natively possible in Craft, but this &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7850367-tabs-to-separate-user-profile-content&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; sounds like what you're looking for if you want to vote for it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-02-28T06:12:58.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13943" PostTypeId="1" AcceptedAnswerId="13945" CreationDate="2016-02-28T16:38:26.483" Score="0" ViewCount="346" Body="&lt;p&gt;I use &lt;a href=&quot;https://dukt.net/&quot; rel=&quot;nofollow&quot;&gt;Dukt plugins&lt;/a&gt; (-&lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow&quot;&gt;oauth&lt;/a&gt; and -&lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow&quot;&gt;social&lt;/a&gt;) for public front-end registration. I would like complete user profile after registration (e.g. license agreement checkbox). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it possible to accomplish this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like intercept social callback after authentication and show a custom page.... I suppose OnBeforeSave event is not useful for this scenario. Thanks&lt;/p&gt;&#xA;" OwnerUserId="4824" LastEditorUserId="57" LastEditDate="2016-02-29T04:43:21.697" LastActivityDate="2016-02-29T09:12:06.413" Title="Complete user profile after social public registration" Tags="&lt;registration&gt;&lt;authentication&gt;&lt;plugin-social-login&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13944" PostTypeId="2" ParentId="64" CreationDate="2016-02-29T01:10:30.850" Score="4" Body="&lt;p&gt;Another easy way to handle a dynamic menu in Craft is to add a Matrix field to a Global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a Global called &quot;Main Menu&quot;. That Global has a Matrix field called &quot;Menu Item&quot;. I then have a block called &quot;Item&quot; that has two plain text fields. One field is for the &quot;label&quot; and one field is for the &quot;URI&quot; that I want users to be directed to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in my template file I have the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in mainMenu.menu %}&#xA;    {% if block.type == &quot;item&quot; %}&#xA;      &amp;lt;li class=&quot;item&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ block.itemUri }}&quot;&amp;gt;{{ block.label }}&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/li&amp;gt; &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4825" LastActivityDate="2016-02-29T01:10:30.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13945" PostTypeId="2" ParentId="13943" CreationDate="2016-02-29T09:01:27.207" Score="0" Body="&lt;p&gt;Via &lt;a href=&quot;https://dukt.net/craft/social/docs/templating/craft.social#getLoginUrl&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/social/docs/templating/craft.social#getLoginUrl&lt;/a&gt; you may give up a page like &lt;code&gt;{ redirect: 'user/finish' }&lt;/code&gt; on which you could check if a user agreed to the license agreement and if they have redirect them to the regular page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example profile edit page that might be useful &lt;a href=&quot;https://github.com/dukt/social-demo/blob/master/craft/templates/social/profile.html&quot; rel=&quot;nofollow&quot;&gt;https://github.com/dukt/social-demo/blob/master/craft/templates/social/profile.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="993" LastEditDate="2016-02-29T09:12:06.413" LastActivityDate="2016-02-29T09:12:06.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13947" PostTypeId="1" CreationDate="2016-02-29T12:52:35.393" Score="3" ViewCount="134" Body="&lt;p&gt;Is it possible to obtain data on what searches have been performed through the front end of a Craft website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. If there is a search results page which runs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search(query) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is that the query data stored anywhere? It would be helpful in terms of understanding what kinds of search terms / keywords people are using to search for information.&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2016-02-29T22:30:48.763" Title="Is it possible to access users' search query data?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2016-02-29T17:45:35.403" ContentLicense="CC BY-SA 3.0" />
  <row Id="13948" PostTypeId="2" ParentId="13947" CreationDate="2016-02-29T15:49:58.023" Score="2" Body="&lt;p&gt;You could use tracking tools like Google Analytics for this? Otherwise create a plugin that creates entries that keep track of whatever query were used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/working-with-elements&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="993" LastEditDate="2016-02-29T22:30:48.763" LastActivityDate="2016-02-29T22:30:48.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13949" PostTypeId="2" ParentId="13915" CreationDate="2016-02-29T16:26:14.383" Score="1" Body="&lt;p&gt;Craft Developer has responded and confirmed that there was an issue and offered a fix, this issue will be resolved in the next release of Craft.  Version 2.5.2767 contains the issue, so any version higher than this will contain the fix.&lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2016-02-29T16:26:14.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13950" PostTypeId="1" CreationDate="2016-02-29T17:07:47.850" Score="0" ViewCount="62" Body="&lt;p&gt;I have 2 channels, &quot;events&quot; and &quot;venues&quot;. Using the entries fieldtype in the &quot;event&quot; entry a &quot;venue&quot; where it takes place is selected. However, if the venue entry is disabled, rather than the event not showing, a fatal error kills my page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of somehow querying events that doesn't return entries linked to disabled venues? I'm guessing doing something with relatedTo but not sure how to go about it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set qDisplay = craft.request.getParam('display') %}&#xA;{% set qFilter = craft.request.getParam('filter') %}&#xA;&#xA;{% if qDisplay == 'all' %}&#xA;&#xA;    {% paginate craft.entries.section('events').status('live,pending').order('postDate asc') as entries %}&#xA;&#xA;{% elseif qDisplay == 'month' and qFilter != null %}&#xA;&#xA;    {% set startDate = now | date_modify('first day of ' ~ qFilter) %}&#xA;    {% set endDate = startDate | date_modify('+ 1 month') %}&#xA;    {% set entries = craft.entries.section('events').postDate('&amp;gt;= ' ~ startDate).expiryDate('&amp;lt; ' ~ endDate).status('live,pending,expired').order('postDate asc') %}&#xA;&#xA;{% elseif qDisplay == 'venue' and qFilter != null %}&#xA;&#xA;    {% set entries = craft.entries.section('events').relatedTo(qFilter).status('live,pending').order('postDate asc') %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% paginate craft.entries.section('events').status('live,pending').order('postDate asc') as entries %}&#xA;    {# set entries = craft.entries.section('events').status('live,pending').limit(6).order('postDate asc') #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4396" LastEditorUserId="4396" LastEditDate="2016-03-01T09:11:22.707" LastActivityDate="2016-03-01T09:11:22.707" Title="Events pages that are linked to venues crash when the venue entry is disabled" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13951" PostTypeId="2" ParentId="12553" CreationDate="2016-02-29T19:37:12.403" Score="2" Body="&lt;p&gt;Perhaps instead of trying to get a template name, use the entry type as the template name, similar to the method that you linked to. In the link, it doesn't check which template is assigned to an entry, but instead, uses the entry type to load a template with the same name. In your example that might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render('path/to/template/' . $entry.type, [&#xA;  'entry' =&amp;gt; $entry&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where your template would be named the same as the handle for your entry type. Does that make sense?&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-02-29T19:37:12.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13952" PostTypeId="2" ParentId="13891" CreationDate="2016-02-29T22:37:42.987" Score="3" Body="&lt;p&gt;This is expected behaviour though, it's better (in my opinion) than leaving everything empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Andrew said in his comment, you could by default disable all locales on this section so your entry wouldn't be published in multiple locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this by going to the settings of your section:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/k3ywa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k3ywa.png&quot; alt=&quot;Screenshot of disabled locales&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="57" LastEditDate="2016-02-29T23:35:49.407" LastActivityDate="2016-02-29T23:35:49.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13953" PostTypeId="1" CreationDate="2016-03-01T05:39:47.697" Score="1" ViewCount="651" Body="&lt;p&gt;I'm trying to get rid mix content warnings for https connection. The SSL certificate is installed and working fine but my image transforms are being requested over http hence the warning messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking into the docs I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;url={{image.getUrl(thumb, null, 'https')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that didn't seem to make a difference. Has anyone encountered this issue before?&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2016-03-01T05:50:29.887" Title="Ensuring Image transforms use https" Tags="&lt;image-transforms&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13954" PostTypeId="2" ParentId="13953" CreationDate="2016-03-01T05:50:29.887" Score="2" Body="&lt;p&gt;ok - just figured it out after reading Brandon's answer here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11797/asset-urls-not-https&quot;&gt;Asset URLs not HTTPS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The missing piece was to set the url setting of the asset source to root relate e.g. &lt;code&gt;/uploads/images&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clear the cache and all sorted!&lt;/p&gt;&#xA;" OwnerUserId="590" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-01T05:50:29.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13955" PostTypeId="1" AcceptedAnswerId="13956" CreationDate="2016-03-01T07:39:17.633" Score="1" ViewCount="421" Body="&lt;p&gt;When querying multiple singles by section slugs, is it possible to maintain the order of the results as the query?  Currently the return result is sorted by the default &lt;code&gt;postDate desc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(['section1', 'section2', 'section3'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns an array with the order&#xA;section1, section2, section3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation doesn't seem to answer this question.&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.entries#order&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-03-01T08:37:42.470" Title="Sort single entries by section with same query order" Tags="&lt;entries&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13956" PostTypeId="2" ParentId="13955" CreationDate="2016-03-01T08:37:42.470" Score="2" Body="&lt;p&gt;This is only possible with the &lt;code&gt;id&lt;/code&gt; parameter in combination with &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#fixedOrder&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fixedOrder&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.id([307, 287, 488]).fixedOrder(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can look up your singles' IDs in the URL of the entries in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example.com/admin/entries/section1/&lt;strong&gt;307&lt;/strong&gt;-section1/&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-01T08:37:42.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13957" PostTypeId="1" AcceptedAnswerId="15024" CreationDate="2016-03-01T12:53:54.893" Score="2" ViewCount="305" Body="&lt;p&gt;I'm outputting all tags that are in use and then allowing the user to click these build up a query string to filter and display the results. It's all working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Except, I'm having difficulty understanding what can I use to set an 'active' class on all the selected tags that are being added to the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting 1 tag as active is simple enough, but when multiple are selected, I'm not so sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL looks like this: &lt;code&gt;domain.com/learning/resources?tags=Video+Maths&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting tags via getParam:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.request.getParam('tags') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Listing all tags in use like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resourceTags = craft.entries.section('resources').limit(null) %}&#xA;{% for tag in craft.tags.relatedTo(resourceTags) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputting results like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.entries.section('resources').limit(craft.config.paginateLimit).search(tags) as entries %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2018-05-16T17:53:20.190" Title="How to set multiple 'active' classes from query string" Tags="&lt;search&gt;&lt;tags&gt;&lt;css&gt;&lt;querystring&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13958" PostTypeId="1" CreationDate="2016-03-01T12:55:41.280" Score="1" ViewCount="300" Body="&lt;p&gt;I am trying to setup a navigation on a site. I am using a Structure Section called &quot;pages&quot;, however, when I changed the &quot;Top-Level Entries&quot; to just &lt;code&gt;{slug}&lt;/code&gt; and the nested levels to &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;, I am getting URLs like &lt;code&gt;about/profile-1&lt;/code&gt; and &lt;code&gt;about/biography-1&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing the reason why I am getting &lt;code&gt;-1&lt;/code&gt; is due to the fact that the entry already exists in my About channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to resolve this?&lt;/p&gt;&#xA;" OwnerUserId="4803" LastActivityDate="2016-03-01T14:39:58.977" Title="Navigation Slug Issue (Structure Section)" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13959" PostTypeId="1" AcceptedAnswerId="13964" CreationDate="2016-03-01T13:15:24.383" Score="3" ViewCount="134" Body="&lt;p&gt;I'm using hacksaw to display the first part of my article on a blog listing page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|hacksaw(chars='300',allow='&amp;lt;p&amp;gt;', append='...') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The issue I have is when an article starts with a heading in it's body it looks like the attached. I'd ideally like to remove any headings from the excerpts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/d3apI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/d3apI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/srSFz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/srSFz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the headings 'Reducing the size...' and 'Scaling' come through as plain text and the rest continues with my allowed &lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can think to do this is to allow their headings (h2 and h3) and then hide them in CSS, but I'm hoping there's a better way. &lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2016-03-01T19:46:47.290" Title="Removing headers from blog post &quot;excerpts&quot; (using Hacksaw)" Tags="&lt;plugin-hacksaw&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13960" PostTypeId="2" ParentId="13959" CreationDate="2016-03-01T14:30:45.253" Score="2" Body="&lt;p&gt;You could consider replacing all of your heading tags manually with the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;replace&lt;/a&gt; twig filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would replace all headings with a paragraph:&#xA;&lt;code&gt;{{ entry.body|replace({'h1': 'p', 'h2': 'p', 'h3': 'p', 'h4': 'p', 'h5': 'p', 'h6': 'p'})|hacksaw(chars='300', allow='&amp;lt;p&amp;gt;', append='...') }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="57" LastEditDate="2016-03-01T17:52:48.457" LastActivityDate="2016-03-01T17:52:48.457" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13961" PostTypeId="2" ParentId="13958" CreationDate="2016-03-01T14:39:58.977" Score="1" Body="&lt;p&gt;If the navigation section is strictly for structuring your navigation I would disable 'Entries in this section have their own URLs' and add a entries relation field to connect your content with the navigation items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A standalone plugin could also help you out: &lt;a href=&quot;https://github.com/am-impact/amnav&quot; rel=&quot;nofollow&quot;&gt;https://github.com/am-impact/amnav&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastActivityDate="2016-03-01T14:39:58.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13962" PostTypeId="1" AcceptedAnswerId="13963" CreationDate="2016-03-01T15:12:11.483" Score="3" ViewCount="295" Body="&lt;p&gt;I'm following the &lt;a href=&quot;https://craftcms.com/docs/plugins/element-actions&quot; rel=&quot;nofollow&quot;&gt;Element Actions example&lt;/a&gt; from the official Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've defined an Artist entry type, and have defined an entries field on my Assets to relate an Artist to each Asset. To avoid assigning Artists one-by-one, I'm attempting to create a Element Action so that I can select multiple Assets in the Asset Index and relate them to an Artist entry in bulk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm almost there. I can select an Artist (entry) from a dropdown I've created on the Asset Index page in the CP, but I'm struggling to save the relationship in the performAction function within my plugin. I assume I should be using the relations service &lt;a href=&quot;https://craftcms.com/classreference/services/RelationsService#saveRelations-detail&quot; rel=&quot;nofollow&quot;&gt;saveRelations()&lt;/a&gt; method to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft and not sure where I'm going wrong. I'm sure the fact that I'm doing this within an ElementAction is irrelevant, it's just that I'm doing something wrong while trying to save the relation. Here's the relevant part of the code as it currently stands:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function performAction(ElementCriteriaModel $criteria)&#xA;{&#xA;    // Get the selected artist&#xA;    $artistId = $this-&amp;gt;getParams()-&amp;gt;artist;&#xA;    $artist = craft()-&amp;gt;entries-&amp;gt;getEntryById($artistId);&#xA;&#xA;    // Make sure it's a valid one&#xA;    if (!$artist)&#xA;    {&#xA;        $this-&amp;gt;setMessage(Craft::t('The selected artist could not be found.'));&#xA;        return false;&#xA;    }&#xA;&#xA;    // Assign the artist to the selected elements&#xA;    $assets = $criteria-&amp;gt;find();&#xA;&#xA;    foreach ($assets as $asset)&#xA;    {&#xA;        $artistFieldModel = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('artist');&#xA;        craft()-&amp;gt;relations-&amp;gt;saveRelations($artistFieldModel, $asset, $artistId);&#xA;    }&#xA;&#xA;    // Success!&#xA;    $this-&amp;gt;setMessage(Craft::t('Artist successfully assigned.'));&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any pointers gratefully appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4567" LastEditorUserId="4567" LastEditDate="2016-03-01T16:37:40.840" LastActivityDate="2016-03-01T16:37:40.840" Title="Relating entries to assets within an ElementAction" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;entries-field&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13963" PostTypeId="2" ParentId="13962" CreationDate="2016-03-01T16:35:03.593" Score="2" Body="&lt;p&gt;So it seems what I was doing wrong was passing in a single $artistId rather than an array. With the change shown below it works as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;foreach ($assets as $asset)&#xA;{&#xA;    $artistFieldModel = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('artist');&#xA;    craft()-&amp;gt;relations-&amp;gt;saveRelations($artistFieldModel, $asset, [$artistId]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4567" LastActivityDate="2016-03-01T16:35:03.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13964" PostTypeId="2" ParentId="13959" CreationDate="2016-03-01T16:52:01.307" Score="4" Body="&lt;p&gt;You could use the Twig &lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;replace&lt;/a&gt; filter with a regular expression, this'll remove the tag and it's content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | replace('/&amp;lt;h([1-6])&amp;gt;.*?&amp;lt;\\/h([1-6])&amp;gt;/', '') | raw | hacksaw(chars='300',allow='&amp;lt;p&amp;gt;', append='...') }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only limitation is regular expressions aren't fantastic with nested html tags, so your mileage my vary!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might need to play around with the Regex a bit if you want to just limit it to a few headings, this will strip all h1, h2, h3, h4, h5, h6. You also might not need the &lt;code&gt;| raw&lt;/code&gt; filter, it seemed to escape everything after the replace when I quickly tested it.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-03-01T16:52:01.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13965" PostTypeId="1" AcceptedAnswerId="14119" CreationDate="2016-03-01T16:53:53.780" Score="3" ViewCount="448" Body="&lt;p&gt;From other threads and my own tests a date field needs to be input in the format of 10/15/2012 (mm/dd/yyyy). But that's not very &quot;British&quot;, is there any way to modify it?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-03-13T17:46:32.427" Title="Is it possible to modify the input format for dates in front end form?" Tags="&lt;datetime&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13966" PostTypeId="2" ParentId="13781" CreationDate="2016-03-01T17:09:20.307" Score="115" Body="&lt;p&gt;Future me, looks like you forgot your password again and locked yourself out of Craft. You also made your way back to this Stack Exchange question with @chris' perfect answer. Good! And to make your life &lt;em&gt;really&lt;/em&gt; easy this time around, I've already generated a password/hash combos for you that works:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;|--------------|---------------------------------------------------------------|&#xA;|  *Password*  |                        *Resulting Hash*                       |&#xA;|--------------|---------------------------------------------------------------|&#xA;|  password    | $2y$13$i1fEVeKiboWR/Hx07N9JtuSZj46KNueAg0IgpwL2TId0sXN.oyibC  |&#xA;|--------------|---------------------------------------------------------------|&#xA;|  NewPassword | $2y$13$YA.7RIgllODUDcmQPf/.FuXjOmKJYot5QxpFhhf4og9fdJWsIPWK6  |&#xA;|--------------|---------------------------------------------------------------|&#xA;|  admin       | $2y$13$Nlvh.kEu8FLIITusfjzQgOIIDryqLnJ3TsV/1UINRCFLfVnjJtILK  |&#xA;|--------------|---------------------------------------------------------------|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Update:&lt;/strong&gt; The hashing algorithm didn’t change in Craft 3, so the above combo still works.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2020-07-28T05:41:02.990" LastActivityDate="2020-07-28T05:41:02.990" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13967" PostTypeId="1" AcceptedAnswerId="14078" CreationDate="2016-03-01T17:17:19.433" Score="0" ViewCount="74" Body="&lt;p&gt;I have the following code in my form, but I'd like to also save the eventDate of the selected entry into a separate date field to enable sorting/selection later.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;eventName&quot;&amp;gt;Event&#xA;&amp;lt;select id=&quot;eventName&quot; name=&quot;fields[eventName]&quot;&amp;gt;  &#xA;  &amp;lt;option value=&quot;&quot;&amp;gt;select from list&amp;lt;/option&amp;gt;&#xA;    {% set events = craft.entries.find({section:'events,activities', eventDate : &quot;&amp;gt;= &quot; ~ now.w3cDate() , order:'eventDate'}) %}&#xA;    {% if events %}&#xA;        {% for entry in events %}                &#xA;            &amp;lt;option value=&quot;{{ entry.eventDate.format('D j M') }},{{ entry.eventName }}&quot;&amp;gt;{{ entry.eventDate.format('D j M') }},{{ entry.eventName }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&amp;lt;/select&amp;gt;            &#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-03-09T21:14:11.917" Title="Possible to set 2 data fields within 1 select option?" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13968" PostTypeId="1" CreationDate="2016-03-01T17:58:54.220" Score="2" ViewCount="85" Body="&lt;p&gt;My plugin takes as an argument the id of an asset. So I'm starting from here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $entry = craft()-&amp;gt;elements-&amp;gt;getElementById($entry_id); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming my asset has the url &lt;a href=&quot;http://mybucket.mycompany.com/uploads/pdfs/myfile.pdf&quot; rel=&quot;nofollow&quot;&gt;http://mybucket.mycompany.com/uploads/pdfs/myfile.pdf&lt;/a&gt;, how can I return just 'uploads/pdfs/myfile.pdf' from within my plugin?&lt;/p&gt;&#xA;" OwnerUserId="3326" LastActivityDate="2016-03-01T18:37:48.870" Title="How can I get an S3 asset's remote path minus the bucket name from within my plugin?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13969" PostTypeId="2" ParentId="13968" CreationDate="2016-03-01T18:37:48.870" Score="3" Body="&lt;p&gt;I'd just use the &lt;code&gt;replace&lt;/code&gt; filter to chop it off...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/filters#replace&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Even if you didn't know the bucket name exactly, &lt;code&gt;replace&lt;/code&gt; supports regex.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-01T18:37:48.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13970" PostTypeId="2" ParentId="13959" CreationDate="2016-03-01T19:40:43.867" Score="2" Body="&lt;p&gt;I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon&lt;/a&gt; which uses &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; rel=&quot;nofollow&quot;&gt;DOMDocument&lt;/a&gt; to re-write HTML content. There's a couple of ways you could achieve your goal easily using Retcon:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove all header tags (and their content), using the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Remove&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;retconRemove&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconRemove(['h1','h2','h3','h4','h5','h6']) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove everything except paragraphs, using the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Only&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;retconOnly&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconOnly('p') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove everything except paragraphs and images:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconOnly(['p', 'img']) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for truncating the content, I'd probably add the hacksaw filter after using Retcon, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconOnly('p')|hacksaw(chars='300',allow='&amp;lt;p&amp;gt;', append='...') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-03-01T19:46:47.290" LastActivityDate="2016-03-01T19:46:47.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13971" PostTypeId="1" CreationDate="2016-03-01T20:21:29.553" Score="1" ViewCount="676" Body="&lt;p&gt;In one of the Rich Text Fields I'm entering little snippets like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&#xA;&amp;lt;code class=&quot;language-css&quot;&amp;gt;&#xA;  -moz-osx-font-smoothing: grayscale;&#xA;  -webkit-font-smoothing: antialiased;&#xA;  text-rendering: optimizeLegibility !important;&#xA;  text-shadow: 1px 1px 1px rgba(0, 0, 0, .004);&#xA;&amp;lt;/code&amp;gt;&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, each time i edit again it removes the value although when i save it the first time its ok. I think its converting at edit time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to prevent redactor from doing this?&lt;/p&gt;&#xA;" OwnerUserId="774" LastEditorUserId="57" LastEditDate="2016-03-01T23:36:57.417" LastActivityDate="2016-03-01T23:36:57.417" Title="Prevent Rich Text editor from removing code tags?" Tags="&lt;entries&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13972" PostTypeId="2" ParentId="13971" CreationDate="2016-03-01T23:36:39.053" Score="3" Body="&lt;p&gt;You've probably got &quot;Purify HTML&quot; checked under your Rich Text field's settings and that's stripping code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should really only have that checked if you're accepting input from untrusted sources using the Rich Text field on the front-end of your site. Presumably all users using the control panel are trusted enough not to input malicious code into the site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-01T23:36:39.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13973" PostTypeId="1" AcceptedAnswerId="14412" CreationDate="2016-03-02T02:49:45.213" Score="2" ViewCount="111" Body="&lt;p&gt;Is it possible to share one craft install across 2 servers?  Say I have a US site (en only) hosted in the US and a Canadian site (en and fr) hosted in Canada.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;usa-site.com (english)&#xA;ca-site.ca (english)&#xA;ca-site.ca/fr (french)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-03-31T08:30:48.913" Title="Run a localized site using one Craft install on 2 servers" Tags="&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13974" PostTypeId="1" AcceptedAnswerId="13976" CreationDate="2016-03-02T08:28:40.807" Score="2" ViewCount="1303" Body="&lt;p&gt;I wondered if it is possible to use one specific template for just one structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M2fpY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M2fpY.png&quot; alt=&quot;My structure build up&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let me make this clear. I have a structure called &quot;Onze Diensten&quot; (Our Services) and inside are child structures that are the actual services that the website offers. These child structures use a template that I assigned to them through structure so that works perfectly. &#xA;But what I want now is that the actual &quot;Onze Diensten&quot; gets it's own individual template which would show all the services on one page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do that?&#xA;Thank you for taking the time reading my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I hoped would be the solution is using routes. By adding a route that when you visit onze-diensten/ it would load up the template onze-diensten/onze-diensten/ (Which is the path to the template I want to use).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it seems to completely ignore the route at all.&lt;/p&gt;&#xA;" OwnerUserId="4732" LastEditorUserId="22" LastEditDate="2017-05-09T22:16:42.417" LastActivityDate="2017-05-09T22:16:42.417" Title="Specific template for a structure" Tags="&lt;templating&gt;&lt;structure&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13975" PostTypeId="2" ParentId="13967" CreationDate="2016-03-02T08:34:54.713" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse plugin&lt;/a&gt; to create a field that is automatically updated with the &lt;code&gt;eventDate&lt;/code&gt; value whenever the entry is saved. It wouldn't be a datetime field, but if you stored the &lt;em&gt;timestamp&lt;/em&gt; (i.e. &lt;code&gt;{{ dateString|date('U') }}&lt;/code&gt;) it'd be easy to &lt;em&gt;use&lt;/em&gt; as such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to have an hidden input in your form for the &lt;code&gt;eventDate&lt;/code&gt; datetime field, and use JavaScript to set its value whenever the &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; input changes (i.e. listen for the &lt;code&gt;change&lt;/code&gt; event for the latter, in your JS).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third option would be to write a plugin which listens to the &lt;code&gt;entries.beforeSaveEntry&lt;/code&gt; event in order to set the &lt;code&gt;eventDate&lt;/code&gt; value from the dropdown field.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-02T08:34:54.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13976" PostTypeId="2" ParentId="13974" CreationDate="2016-03-02T08:41:25.820" Score="4" Body="&lt;p&gt;I can't answer it clearly, but I did a workaround for something similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've loaded the same template for my structure but gave my structure 2 entry-types(overviewPage, detailPage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both entry types loaded the same template but got handled differently. So my template for the structure looked something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'overviewPage' %}&#xA;  {% include 'snippets/content_overviewPage.html' %}&#xA;{% elseif entry.type == 'detailPage' %}&#xA;  {% include 'snippets/content_detailPage.html' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope to see on this thread how other people handle this.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-03-02T08:41:25.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13977" PostTypeId="2" ParentId="13974" CreationDate="2016-03-02T09:37:15.140" Score="2" Body="&lt;p&gt;I just noticed something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Onze Diensten&quot; is your structure. In this structure you made an entry &quot;Onze Diensten&quot; on the first structure level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this &quot;Onze Diensten&quot; entry only is an overview of all it's children entries and doesn't contain any extra content you could just remove the &quot;Onze Diensten&quot; entry and make all the children entries on the first structure level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the overview page you would load the index.html with some code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('onzeDiensten') %}&#xA;  &amp;lt;a href={{entry.url}}&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-03-02T09:37:15.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13978" PostTypeId="2" ParentId="13974" CreationDate="2016-03-02T10:32:15.960" Score="3" Body="&lt;p&gt;Building off of Marco's first answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, perhaps the easiest approach is to have a conditional in your Structure's entry template that checks the entry's &lt;code&gt;level&lt;/code&gt; property, and includes different templates based on that - i.e. if the entry's &lt;code&gt;level&lt;/code&gt; is 1, that means the entry is top level, and Craft should load an overview template. If not, the single service template should be served.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do the trick – I'm assuming you have a template folder called &quot;services&quot;, with three templates: index.html (which is the Structure's entry template), overview.html and service.html, and the following would go inside the entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == 1 %}&#xA;    {% include 'services/overview' %}&#xA;{% else %}&#xA;    {% include 'services/service' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that with this setup, you can just put &quot;services&quot; (without the quotes) for your Structure Section's Entry Template field; then Craft will load the &quot;services/index.html&quot; template whenever an entry from this Structure is requested, and the above conditional will make sure the correct template is served.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach entirely is to create a dropdown field (called &lt;code&gt;structureTemplate&lt;/code&gt; or the like) for your Structure, which is hard coded to the following values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;service : Service template&#xA;overview : Service overview template&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would enable you to select the template on an entry basis. Here's how you could handle this in your entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set template = entry.structureTemplate|default('service') %}&#xA;{% include 'services/'~template %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I really think the first approach is better for your use case, though – considering that top level entries should always load one template and child level entries should always load another.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-03-02T10:55:55.770" LastActivityDate="2016-03-02T10:55:55.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13980" PostTypeId="2" ParentId="13900" CreationDate="2016-03-02T12:23:33.907" Score="2" Body="&lt;p&gt;Ok, I figured it out. First, to solve the birthday input problem, I used javascript to gather the values of each individual date dropdown and assemble them into a hidden text input that would be what passes in the datetime value to Craft.  No problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the datetime formatting tripped me up because there are two posts here that had the formatting differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formatting needs to &lt;em&gt;exactly&lt;/em&gt; match the example shown here on &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow&quot;&gt;StraightUpCraft&lt;/a&gt; under the date row.  So a date value like &lt;code&gt;2014-06-24&lt;/code&gt; does not work; it needs to be &lt;code&gt;06/24/2014&lt;/code&gt;. Likewise, the time value of &lt;code&gt;23:30:00&lt;/code&gt; does not work either; it needs to be &lt;code&gt;11:30 PM&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My final code looks like this after the javascript fills in the date value. Since it's a birthday, the 6pm time is just hardcoded in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[birthday][date]&quot; value=&quot;02/24/1985&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[birthday][time]&quot; value=&quot;6:00 PM&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Extra note for those using localized sites: you need to submit the date and time &lt;em&gt;exactly&lt;/em&gt; how Craft formats them for each localization. For example, &quot;6/24/2016&quot; would be the acceptable date format for the U.S., but it will need to be &quot;24.6.2016&quot; when submitted on the German version of that page. You can output the formats dynamically in Craft using the translations filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[fieldHandle][date]&quot; value=&quot;{{ now|date('Date Input Format'|t) }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;fields[fieldHandle][time]&quot; value=&quot;{{ now|date('Time Input Format'|t) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your translations files put something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Date Input Format&quot; =&amp;gt; &quot;d.m.Y&quot;,&#xA;&quot;Time Input Format&quot; =&amp;gt; &quot;G:i&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2016-06-20T16:47:34.193" LastActivityDate="2016-06-20T16:47:34.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13981" PostTypeId="2" ParentId="13973" CreationDate="2016-03-02T15:36:28.910" Score="2" Body="&lt;p&gt;Craft has exceptional locale functionality, which would cater for your different languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here for &lt;a href=&quot;https://craftcms.stackexchange.com/questions/408/are-there-any-intentions-to-release-multisite-support-for-craft&quot;&gt;relevant answer...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides the above, I understand that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Multi-location/domain installation is not possible at the moment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the licence for Craft applies to a domain. So for your example, each domain would require a separate Craft licence.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-02T15:36:28.910" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13982" PostTypeId="1" AcceptedAnswerId="13994" CreationDate="2016-03-02T17:55:49.040" Score="3" ViewCount="5765" Body="&lt;p&gt;I'm a newbie in Craft CMS. I need to make changes in an existing craft website which is with one hosting platform. &#xA;The site was previously managed by another developer. I need to migrate to a new hosting platform and i would like to know what all credentials i would need to obtain to perform this task and how i can migrate it? &lt;/p&gt;&#xA;" OwnerUserId="4845" LastActivityDate="2018-07-01T15:26:14.180" Title="Migration of Craft CMS from one host to another" Tags="&lt;database&gt;&lt;migration&gt;&lt;hosting&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13983" PostTypeId="1" CreationDate="2016-03-02T19:42:57.927" Score="1" ViewCount="358" Body="&lt;p&gt;I have two problems when it comes to working with &lt;code&gt;getHeadHtml()&lt;/code&gt; and &lt;code&gt;getFootHtml()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But first things first. Here's my setup: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my stripped down &lt;code&gt;_main.twig&lt;/code&gt; layout file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;{{ craft.locale }}&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;!-- injected Css Files or Styles should go here --&amp;gt;&#xA;    {{ getHeadHtml() }}&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; media=&quot;all&quot; href=&quot;/assets/scss/styles.css&quot; /&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    {% block content %}{% endblock %}&#xA;&#xA;    &amp;lt;!-- injected Js Files or Code should go here --&amp;gt;&#xA;    {{ getFootHtml() }}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my stripped down &lt;code&gt;_entry.twig&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_main&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% for block in entry.cf_content_matrix %}&#xA;        {#&#xA;            Include all blocks&#xA;        #}&#xA;        {% include &quot;_blocks/_block_&quot; ~ block.type ignore missing %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the Matrix block that is causing the problems I have. &#xA;Basically it is a jQuery slider plugin. I only want the JS and CSS files injected when this block is actually used. So I thought that using &lt;code&gt;includeCssFile&lt;/code&gt;, &lt;code&gt;includeJsFile&lt;/code&gt; and &lt;code&gt;includeJs&lt;/code&gt; would be a perfect fit for this. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = block.images %}&#xA;&amp;lt;div id=&quot;screenshot-slider&quot;&amp;gt;&#xA;    {%- for image in images -%}&#xA;        &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl({ width: 680 }) }}&quot; /&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {%- endfor -%}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% includeCssFile &quot;/assets/javascripts/slick/slick.css&quot; %}&#xA;{% includeCssFile &quot;/assets/javascripts/slick/slick-theme.css&quot; %}&#xA;{% includeJsFile &quot;/assets/javascripts/slick/slick.min.js&quot; %}&#xA;{% set owlJs %}&#xA;    $(document).ready(function() {&#xA;      $(&quot;#screenshot-slider&quot;).slick();&#xA;    });&#xA;{% endset %}&#xA;{% includeJs owlJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OK. So far so good. It works rather well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{{ getHeadHtml() }}&lt;/code&gt; in the &lt;code&gt;_main.twig&lt;/code&gt; file is somehow ignored. Instead of injecting the CSS files BEFORE my &lt;code&gt;styles.css&lt;/code&gt; files, they are injected just before the &lt;code&gt;&amp;amp;lt;/head&amp;amp;gt;&lt;/code&gt; tag. As if it wasn't there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody experienced this behaviour? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This concerns caching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to cache the content matrix the following way: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/_main&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% cache %}&#xA;        {% for block in entry.cf_content_matrix %}&#xA;            {#&#xA;                Include all blocks&#xA;            #}&#xA;            {% include &quot;_blocks/_block_&quot; ~ block.type ignore missing %}&#xA;        {% endfor %}&#xA;    {% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTHING get's injected. Neither the CSS files, nor the JS files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know why this is the case, and if there is a solution to it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated! &lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="57" LastEditDate="2016-03-07T18:42:49.767" LastActivityDate="2016-03-07T18:44:04.363" Title="Problem with getHeadHtml(), getFootHtml() and caching" Tags="&lt;cache&gt;&lt;getheadhtml&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13984" PostTypeId="1" CreationDate="2016-03-02T20:18:17.440" Score="0" ViewCount="174" Body="&lt;p&gt;I have created a route to retrieve some categories via AJAX. When the AJAX call returns the HTML a runPendingTask script is also returned with the HTML. How do I prevent this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/*&amp;lt;![CDATA[*/&#xA;(function() {&#xA;    var XMLHttpFactories = [&#xA;        function() {&#xA;            return new XMLHttpRequest()&#xA;        },&#xA;        function() {&#xA;            return new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;)&#xA;        },&#xA;        function() {&#xA;            return new ActiveXObject(&quot;Msxml3.XMLHTTP&quot;)&#xA;        },&#xA;        function() {&#xA;            return new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;)&#xA;        }&#xA;    ];&#xA;    var req = false;&#xA;    for (var i = 0; i &amp;lt; XMLHttpFactories.length; i++) {&#xA;        try {&#xA;            req = XMLHttpFactories[i]();&#xA;        } catch (e) {&#xA;            continue;&#xA;        }&#xA;        break;&#xA;    }&#xA;    if (!req) return;&#xA;    req.open('GET',&#xA;        &quot;http:\/\/tfc.dev\/hollywood-road\/index.php\/actions\/tasks\/runPendingTasks&quot;,&#xA;        true);&#xA;    if (req.readyState == 4) return;&#xA;    req.send();&#xA;})(); /*]]&amp;gt;*/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-03-02T22:28:58.243" Title="How do I prevent a runPendingTask script being included in returned HTML via ajax?" Tags="&lt;categories&gt;&lt;routes&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-03-02T22:38:37.043" ContentLicense="CC BY-SA 3.0" />
  <row Id="13985" PostTypeId="1" CreationDate="2016-03-02T21:39:07.483" Score="2" ViewCount="838" Body="&lt;p&gt;I'm a total S3 noob but would like to get it set up so that I can store Assets there. So far, I've:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;created an AWS account (zing!)&lt;/li&gt;&#xA;&lt;li&gt;created a bucket named &lt;code&gt;mybucket&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;created a user in IAM &lt;code&gt;myuser&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;assigned the &lt;code&gt;AdministratorAccess&lt;/code&gt; policy to &lt;code&gt;myuser&lt;/code&gt;*&lt;/li&gt;&#xA;&lt;li&gt;created a new Asset source called &lt;code&gt;s3&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;entered the user Access Key ID and Secret Access Key, which correctly shows me the &lt;code&gt;mybucket&lt;/code&gt; destination&lt;/li&gt;&#xA;&lt;li&gt;URL Prefix is auto-filled with &lt;code&gt;http://s3.amazonaws.com/mybucket&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;OK! When I go to upload a file to the S3 source, I see the upload stripe go all the way across the page and the loading spinner happening at the top right of the page. But this process hangs and the file is never uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a tiny image, so I don't think it's a file size issue. No errors / warnings are produced. I don't see anything obvious in the logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated! Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*I know that I'll eventually want a more restrictive policy but for the time being, just trying to get a Hello World working.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2016-06-16T21:19:28.877" Title="Basic Amazon S3 Setup" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13986" PostTypeId="2" ParentId="13984" CreationDate="2016-03-02T22:28:58.243" Score="1" Body="&lt;p&gt;The next (post &lt;a href=&quot;https://craftcms.com/changelog#build2767&quot; rel=&quot;nofollow&quot;&gt;2.5.2767&lt;/a&gt; release) will no longer inject that code on AJAX requests.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-02T22:28:58.243" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13987" PostTypeId="1" AcceptedAnswerId="13990" CreationDate="2016-03-03T00:07:58.450" Score="0" ViewCount="172" Body="&lt;p&gt;On a local government website running Craft CMS a lot of in-body links are effected with the Link to an Entry function within the Redactor editor. I have encouraged the content editors to use this instead a directly coded URL on the basis that if the linked-to entry changes location the link will still work. So far so good until sometime in the last week around 140 of these internal links corrupted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what used to be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Please see &amp;lt;a href=&quot;/council/publications/files/schedule-of-fees-and-charges#entry:1378:url&quot;&amp;gt;Schedule of fees and charges&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;became &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Please see &amp;lt;a href=&quot;{entry:1378:url}#entry:1378:url&quot;&amp;gt;Schedule of fees and charges&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and of course no longer work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understandably there is a lot of upset, both around the fact that access to important documents is no longer available, and that fact that someone has to find and repair 140 links, and then check that they were repaired correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer any suggestion as to how this may have happened? All I can offer is that a Pending Task held up the task list for a while (I don't know how long). The task hadn't failed but after seeing no action on it for a day or so, I deleted it and this caused a backlog of tasks to run. While I don't know if there was any connection, but the timing of the start of the problem does match the running of the tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The links have also been changed in all the entry revisions. At first this made me suspicious that they were never right, but as we run a link checker looking for broken links around once a month, or whenever a bigger set of edits have been made, I can confirm that this change happened recently. This points me back to the tasks.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2016-03-03T01:23:27.387" Title="Corruption of Link to an Entry links within Rich Text field" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;link&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13988" PostTypeId="1" CreationDate="2016-03-03T00:15:55.220" Score="0" ViewCount="2171" Body="&lt;p&gt;I'm trying to get this code working&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if article_id is defined %}&#xA;    {% set entry = craft.entries.id(article_id).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code itself is unimportant, what's relevant is that I'm currently working outside of the context where I would rendering an article. This particular code happens to be broken, and I would like to fix it via inspecting &lt;code&gt;{{ article_id }}&lt;/code&gt;. Except I can't, because:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template Error&#xA;&#xA;A template that extends another one cannot have a body.&#xA;&#xA;---&#xA;&#xA;{% extends &quot;_base&quot; %}&#xA;&#xA;{% if article_id is defined %}&#xA;    {% set entry = craft.entries.id(article_id).first() %}&#xA;    {{ article_id }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now there's a variety of ways that I could solve this issue, but I'm wondering what's the best option. Ideally it would be something like &lt;code&gt;{{ craft.log(article_id) }}&lt;/code&gt; - ie. a function would still produce the Template Error, but at also let me see the value / other information about &lt;code&gt;article_id&lt;/code&gt; (either in the error window, or on the javascript console log).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I implement the logging behavior that I'm looking for?&lt;/p&gt;&#xA;" OwnerUserId="4509" LastActivityDate="2016-04-02T02:17:22.133" Title="Log to console / error window?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13989" PostTypeId="1" AcceptedAnswerId="13992" CreationDate="2016-03-03T01:10:41.737" Score="1" ViewCount="133" Body="&lt;p&gt;I'm getting a fatal error when wrapping a loop with &lt;code&gt;{% cache %}{% endcache %}&lt;/code&gt; tags. The full error is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Allowed memory size of 134217728 bytes exhausted (tried&#xA;  to allocate 32 bytes) in /craft/app/helpers/StringHelper.php on line&#xA;  473&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's a small code sample of what I'm doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{!--&#xA;  `craft.locationAPI.fetchAllLocations` grabs ~200 entries with related data via custom SQL queries.&#xA;  Doing this because craft.entries was throwing memory limit errors.&#xA;--}&#xA;&#xA;{% cache %}&#xA;  {% for entry in craft.locationAPI.fetchAllLocations() %}&#xA;    ...&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm guessing this is because the amount of data getting returned (~13300 lines in &quot;View Source&quot;) is too large for the &lt;code&gt;encodeMb4&lt;/code&gt; function in StringHelper.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything I can do to avoid this?&lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2016-03-03T02:25:30.630" Title="Fatal error in StringHelper.php when using cache block around loop" Tags="&lt;entries&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13990" PostTypeId="2" ParentId="13987" CreationDate="2016-03-03T01:23:27.387" Score="1" Body="&lt;p&gt;It's entirely possible it was the stuck tasks depending on how the task originally failed, how many (and which ones) were backed up behind it and how many (and what kind of) changes were made on the site while the tasks were stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hard to know with 100% confidence, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-03T01:23:27.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13991" PostTypeId="2" ParentId="13988" CreationDate="2016-03-03T01:28:50.847" Score="2" Body="&lt;p&gt;If you have &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; enabled, then you have access to Twig's &lt;code&gt;dump&lt;/code&gt; method that lets you inspect variables.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(article_id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you're feeling more adventurous, there is a debugging library called &lt;a href=&quot;https://raveren.github.io/kint/&quot; rel=&quot;nofollow&quot;&gt;Kint&lt;/a&gt; that there is a Craft &lt;a href=&quot;https://github.com/mildlygeeky/craft_kint&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; for to help debug templates.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-03T01:28:50.847" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13992" PostTypeId="2" ParentId="13989" CreationDate="2016-03-03T02:25:30.630" Score="1" Body="&lt;p&gt;Increase the amount of memory available to PHP through &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; is one option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to reduce the amount of data (and therefore memory) you're dealing with in one request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't share what &lt;code&gt;craft.locationAPI.fetchAllLocations()&lt;/code&gt; is actually doing, but if you're returning results as Craft models, there is a significant overhead (performance and memory-wise) doing that with large data sets in Craft 2.x.  You could look and return more primitive data structures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another alternative is to batch the results and retrieve them over multiple AJAX queries.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-03T02:25:30.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13993" PostTypeId="1" AcceptedAnswerId="13997" CreationDate="2016-03-03T06:16:00.560" Score="0" ViewCount="410" Body="&lt;p&gt;I am trying to get Craft running on the Digital Ocean/ Serverpilot combination I've seen recommended here. Serverpilot is installed on the droplet and running fine. I created an app, uploaded the most recent version of Craft and unzipped it on the server. I renamed htaccess to .htaccess and put the db credentials in db.php.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a white screen on example.com and example.com/admin.&lt;br&gt;&#xA;So I tried the alternate URLs recommended in Crafts installation guide, still white screen.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried playing around with the &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; setting. No luck.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried adding &lt;code&gt;RewriteBase /&lt;/code&gt; to my .htaccess file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get this in the Apache access log: &lt;code&gt;82.156.127.145 - - [03/Mar/2016:01:45:59 -0500] &quot;GET /admin HTTP/1.0&quot; 500 -&#xA;82.156.127.145 - - [03/Mar/2016:01:46:00 -0500] &quot;GET /admin HTTP/1.0&quot; 500 -&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in the Nginx access log: &lt;code&gt;82.156.127.145 - - [03/Mar/2016:01:46:00 -0500] &quot;GET /admin HTTP/1.1&quot; 500 0 &quot;-&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4&quot; &quot;-&quot; 1072 0.014 &quot;0&quot; &quot;0.014&quot; &quot;museumrotterdam.nl&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in the PHP access log: &lt;code&gt;82.156.127.145 - [03/Mar/2016:01:45:59 -0500] &quot;GET /index.php?p=admin&quot; 500 0 - 14106 17679 0.013 3407872 154.23% 0.00% &quot;/admin&quot;&#xA;82.156.127.145 - [03/Mar/2016:01:46:00 -0500] &quot;GET /index.php?p=admin&quot; 500 0 - 14106 17679 0.012 3407872 82.35% 0.00% &quot;/admin&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing in the server's error logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I add &lt;code&gt;'devMode' =&amp;gt; true,&lt;/code&gt; to the config Craft does not log any errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else could I try?&lt;/p&gt;&#xA;" OwnerUserId="327" LastEditorUserId="327" LastEditDate="2016-03-03T06:51:28.693" LastActivityDate="2016-03-03T12:17:32.037" Title="White screen during installation" Tags="&lt;error&gt;&lt;server&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13994" PostTypeId="2" ParentId="13982" CreationDate="2016-03-03T06:27:31.643" Score="5" Body="&lt;p&gt;You need a copy of the database which you can either export via Craft's Control Panel or via phpMyAdmin or a similar database management tool.&lt;br&gt;&#xA;You need these folders: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/templates&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/translations&lt;/code&gt; (if it's multi-language)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/config&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;public&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;They might be called differently, I am writing this as if the previous developer followed the &lt;a href=&quot;https://craftcms.com/docs/installing&quot; rel=&quot;nofollow&quot;&gt;installation instructions&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upload a fresh copy of Craft to the new server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Import the database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace the stock folders with the ones you got from the other install. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure db-credentials are correct in &lt;code&gt;craft/config/db.php&lt;/code&gt;. Make sure all paths are correct in &lt;code&gt;craft/config/general.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure the folders that need to be writeable are writeable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking your site should be running now. &lt;/p&gt;&#xA;" OwnerUserId="327" LastEditorUserId="327" LastEditDate="2016-03-03T08:12:36.410" LastActivityDate="2016-03-03T08:12:36.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13995" PostTypeId="1" CreationDate="2016-03-03T10:21:54.500" Score="3" ViewCount="127" Body="&lt;p&gt;I’ve got 2 categories each with lots of entries. The client wants to delete one category, and transfer it’s entries into the other one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I delete the category, it just disappears, but I somehow need to mass assign all those entires into another category without going through each entry manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas welcome.&lt;/p&gt;&#xA;" OwnerUserId="264" LastActivityDate="2016-03-03T17:16:22.933" Title="How to merge/combine/transfer-entries-between two categories in the CP?" Tags="&lt;categories&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13996" PostTypeId="1" CreationDate="2016-03-03T12:16:27.000" Score="1" ViewCount="72" Body="&lt;p&gt;I have created a field named inlineCss, which i'm using to set a pageCss variable. However, when no CSS is added to the entry, the &lt;code&gt;{% includeCss pageCss %}&lt;/code&gt; is still adding a style tag in the head, albeit empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageCss %}&#xA;    {{ entry.inlineCss }}&#xA;{% endset %}&#xA;&#xA;{% includeCss pageCss %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to only show the style tag if the pageCss variable is not empty?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried checking for is defined and not null but it just keeps outputting the empty style tag.&lt;/p&gt;&#xA;" OwnerUserId="679" LastActivityDate="2016-03-03T16:54:42.250" Title="Check if includeCss set" Tags="&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13997" PostTypeId="2" ParentId="13993" CreationDate="2016-03-03T12:17:32.037" Score="3" Body="&lt;p&gt;Whenever I've had a completely white screen from Craft I've traced it to a syntax error in one of the files in &lt;code&gt;craft/config&lt;/code&gt;, so I'd double-check your &lt;code&gt;db.php&lt;/code&gt; and &lt;code&gt;general.php&lt;/code&gt; if they've been edited.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-03-03T12:17:32.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13998" PostTypeId="1" AcceptedAnswerId="14001" CreationDate="2016-03-03T12:21:19.490" Score="2" ViewCount="327" Body="&lt;p&gt;I have articles with a multi-select named &lt;code&gt;theme&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('article').search('theme:themeFoobar') %}&#xA;&amp;lt;p&amp;gt;{{ entries | length }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm working on a plugin to create a custom source containing only those articles that have &lt;code&gt;themeFoobar&lt;/code&gt; selected in their multi-select, this is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;  $sources[] = array('heading' =&amp;gt; 'Themes');&#xA;&#xA;  $sources['theme:foobar'] = array(&#xA;    'label' =&amp;gt; 'Theme: Foobar',&#xA;    'criteria' =&amp;gt; array(&#xA;      'section' =&amp;gt; 'article',&#xA;      'search' =&amp;gt; 'theme:themeFoobar'&#xA;    )&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result of this is that the source contains all articles, it looks like the &lt;code&gt;search&lt;/code&gt; criteria is completely ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;search&lt;/code&gt; not the correct criteria to use here? Is there another criteria I can use to find only the articles with &lt;code&gt;themeFoobar&lt;/code&gt; selected in the multi-select?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Further information&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The multi-select used to be just a dropdown. When it was a dropdown, this plugin worked fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;  $sources[] = array('heading' =&amp;gt; 'Themes');&#xA;&#xA;  $sources['theme:foobar'] = array(&#xA;    'label' =&amp;gt; 'Theme: Foobar',&#xA;    'criteria' =&amp;gt; array(&#xA;      'section' =&amp;gt; 'article',&#xA;      'theme' =&amp;gt; 'themeFoobar'&#xA;    )&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4639" LastActivityDate="2016-03-03T14:57:27.793" Title="Using search criteria in modifyEntrySources plugin" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13999" PostTypeId="1" AcceptedAnswerId="14000" CreationDate="2016-03-03T13:40:37.393" Score="1" ViewCount="217" Body="&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm writing a customer portal plugin, utilizing Crafts user registration form: &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# User registration form: #}&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {# What do I add / change ? #}&#xA;&#xA;    {# ... #}&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt; &#xA;My plugin has two different types of account profile records, &lt;em&gt;.._OrganizationProfileRecord&lt;/em&gt; and &lt;em&gt;.._UserProfileRecord&lt;/em&gt;. What I want to do is send a variable to the onSaveUser event handler in my plugin main class, to tell it what type of user was just saved (&lt;em&gt;&quot;org&quot;&lt;/em&gt; or &lt;em&gt;&quot;user&quot;&lt;/em&gt;), and then take appropriate actions, i.e. create either an organization or user profile.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class myPortalPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    { &#xA;        craft()-&amp;gt;on('users.onSaveUser', function(Event $event)&#xA;        {&#xA;            $craftUser = $event-&amp;gt;params['user'];&#xA;            $isNewUser = $event-&amp;gt;params['isNewUser'];&#xA;&#xA;            if ($isNewUser)&#xA;            {&#xA;                // Check if user is an organization or a regular user, and&#xA;                // create the appropriate profile record.&#xA;&#xA;                // How do I check?&#xA;&#xA;                // ...&#xA;        }&#xA;    }&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Questions: &lt;br&gt;&lt;/h3&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How would I go about passing data/variable from the form to the onSaveUser event handler?&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;Is there a better / more convenient way to do this?&lt;br&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance for any help you can provide in this matter!  &lt;em&gt;bowing&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Monkey&lt;/p&gt;&#xA;" OwnerUserId="4802" LastEditorUserId="4802" LastEditDate="2016-03-03T14:43:20.817" LastActivityDate="2016-03-03T14:43:20.817" Title="How do I pass a hidden input value to plugin onSaveUser event handler?" Tags="&lt;plugin-development&gt;&lt;user-profile&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14000" PostTypeId="2" ParentId="13999" CreationDate="2016-03-03T14:40:24.397" Score="1" Body="&lt;p&gt;I found a solution. Though I am not sure if this is the best way to go about it, but here's what I did:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userType&quot; value=&quot;org&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;was added to the register form, and ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userType = craft()-&amp;gt;request-&amp;gt;getPost('userType');&#xA;&#xA;if ($userType == 'org')&#xA;{&#xA;    // ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;was added to the onSaveUser event handler function.&lt;/p&gt;&#xA;" OwnerUserId="4802" LastActivityDate="2016-03-03T14:40:24.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14001" PostTypeId="2" ParentId="13998" CreationDate="2016-03-03T14:57:27.793" Score="3" Body="&lt;p&gt;My solution, thanks to @carlcs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    $sources[] = array('heading' =&amp;gt; Craft::t('Themes'));&#xA;&#xA;    $themes = array(&#xA;        'THEME_FOO' =&amp;gt; 'themeFoo',&#xA;        'THEME_BAR' =&amp;gt; 'themeBar'&#xA;    );&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'article';&#xA;    $articles = $criteria-&amp;gt;find();&#xA;&#xA;    foreach ($themes as $theme =&amp;gt; $label)&#xA;    {&#xA;        // Loop through all articles and check if they contain the current theme.&#xA;        // If they do, add it to the ids array which we will later use to filter&#xA;        // just the articles with this theme.&#xA;        $ids = [];&#xA;        foreach ($articles as $article)&#xA;        {&#xA;            foreach ($article-&amp;gt;theme as $articleTheme)&#xA;            {&#xA;                if ($articleTheme == $themes[$theme])&#xA;                {&#xA;                    array_push($ids, $article-&amp;gt;id);&#xA;                    break;&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        $sources['theme:' . $label] = array(&#xA;            'label' =&amp;gt; Craft::t('Theme') . ': ' . Craft::t($theme),&#xA;            'criteria' =&amp;gt; array(&#xA;                'section' =&amp;gt; 'article',&#xA;                'id' =&amp;gt; $ids&#xA;            )&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The PHP itself could be cleaned up, but this works for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories would probably have been a simpler solution had I gone for that originally.&lt;/p&gt;&#xA;" OwnerUserId="4639" LastActivityDate="2016-03-03T14:57:27.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14002" PostTypeId="1" CreationDate="2016-03-03T15:09:33.940" Score="1" ViewCount="114" Body="&lt;p&gt;I'm trying to get entries from two sections and merge them together which is pretty straight forward using the merge filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, my sections are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;li&gt;Promoted News&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But, my main issue is I only want Entry 1 from &lt;strong&gt;Promoted News&lt;/strong&gt; to appear after 2 entries in &lt;strong&gt;News&lt;/strong&gt; and so on (In a 2 entry increment)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want it like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 1&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 1&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 2&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 2&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 3&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 3&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 4&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 4&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 5&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 5&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 1&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 2&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 1&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 3&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 4&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 2&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 5&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;News&lt;/strong&gt; - Entry 6&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Promoted News&lt;/strong&gt; - Entry 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I thought about doing it using a conditional and incrementing a variable, but I don't think this would work with pagination so I need to merge them in to one array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do this? My heads mashed thinking about doing this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2016-03-03T16:37:01.423" Title="Merge Entries but only after X amount of entries" Tags="&lt;entries&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14003" PostTypeId="1" AcceptedAnswerId="14006" CreationDate="2016-03-03T15:49:25.613" Score="2" ViewCount="422" Body="&lt;p&gt;How can you filter entries in the CP by Author? I assumed entering something like &lt;strong&gt;author:tdavis&lt;/strong&gt; (where tdavis is my username) would do it, but no results returned. I also tried substituting id for username.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2020-01-09T08:52:23.950" Title="Filter entries in CP by Author" Tags="&lt;control-panel&gt;&lt;search&gt;&lt;author&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14005" PostTypeId="2" ParentId="14002" CreationDate="2016-03-03T16:37:01.423" Score="1" Body="&lt;p&gt;Seems like a rather specific edge case, so I'd be surprised if there's something built in (nothing comes to mind). However, you could write a custom twig filter fairly easily to do this. &lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-03-03T16:37:01.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14006" PostTypeId="2" ParentId="14003" CreationDate="2016-03-03T16:39:20.243" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;https://craftcms.com/docs/searching#searching-for-specific-element-attributes&quot; rel=&quot;nofollow&quot;&gt;Search&lt;/a&gt; page in the docs, it looks like you can't search by author. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks, on the face of it, like entries can only be searched on Title, Slug and any of your Custom Fields.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-03-03T16:39:20.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14007" PostTypeId="2" ParentId="13996" CreationDate="2016-03-03T16:54:42.250" Score="3" Body="&lt;p&gt;It looks like you should be able to wrap it in an &lt;code&gt;if&lt;/code&gt; statement like this...  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageCss %}&#xA;    {{ entry.inlineCss }}&#xA;{% endset %}&#xA;&#xA;{% if pageCss != ''  %}&#xA;    {% includeCss pageCss %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-03-03T16:54:42.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14009" PostTypeId="2" ParentId="13995" CreationDate="2016-03-03T17:16:22.933" Score="2" Body="&lt;p&gt;This could easily be accomplished with a MySQL query on your DB. Of course, &lt;strong&gt;BACK UP YOUR DATABASE FIRST&lt;/strong&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example, assuming the old category ID is 1 and the new one is 2... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UPDATE `craft_relations` &#xA;SET `target_id` = 2 &#xA;WHERE `field_id` = [your field id] AND `target_id` = 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-03-03T17:16:22.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14010" PostTypeId="1" AcceptedAnswerId="14012" CreationDate="2016-03-03T19:17:10.453" Score="1" ViewCount="109" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using CraftCommerce. I have a main product and several accessories related to that product. Accessories have a title, description, price, and image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have no problem pulling the title and description for the related accessories using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for relatedProducts in product.relatedAccessories %}&#xA;       {{ relatedProducts.title }} - {{ relatedProducts.accessoryDescription }}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I've got a problem is pulling the related image. If I use &lt;code&gt;{{ asset.getUrl }}&lt;/code&gt; it pulls the first image from the main product entry rather than the image in the related entry. I have tried &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4220/get-image-from-related-entries-asset-field&quot;&gt;Get image from related entries asset field&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/630/how-do-i-pull-related-entries-and-assets/640#640&quot;&gt;How do I pull related entries and assets&lt;/a&gt;? without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be great.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-04T05:32:35.250" Title="Displaying image from related CraftCommerce entry" Tags="&lt;relations&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14011" PostTypeId="1" AcceptedAnswerId="14016" CreationDate="2016-03-03T19:25:59.467" Score="1" ViewCount="359" Body="&lt;p&gt;I have a Matrix field which contains a bunch of blocks. If only one matrix field is present in the entry I need it to show a message. If more then one matrix field show an other message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my current code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.modelIds.limit(1) %}&#xA;    {% if block.modelId|length == 1 %}&#xA;        I am link - {{block.modelId}} &amp;lt;br&amp;gt;&#xA;    {% else %}&#xA;        Not a Link - {{block.modelId}}&amp;lt;br&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. I have tried a few different approaches and am just stumped. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: adding image of fields.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aQfs5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aQfs5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3571" LastEditorUserId="3571" LastEditDate="2016-03-03T21:14:30.997" LastActivityDate="2016-03-04T15:22:58.683" Title="If only one Matrix block show this, for more then one block show that" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14012" PostTypeId="2" ParentId="14010" CreationDate="2016-03-04T05:32:35.250" Score="2" Body="&lt;p&gt;Ok first thing take the s off relatedProduct because each loop is over &lt;strong&gt;one&lt;/strong&gt; relatedProduct ;) - then you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedProduct in product.relatedAccessories %}&#xA;   {{ relatedProduct.title }} - {{ relatedProduct.accessoryDescription }}&#xA;   Url: {{ relatedProduct.yourAssetHandle.first().url }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should probably protect that by first checking &lt;code&gt;{% if relatedProduct.yourAssetHandle.first()|length %}&lt;/code&gt; unless you can be completely certain you will have an asset (required field for example).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-03-04T05:32:35.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14013" PostTypeId="1" AcceptedAnswerId="14020" CreationDate="2016-03-04T05:41:40.170" Score="1" ViewCount="398" Body="&lt;p&gt;When I look at the console log when devMode is enabled, I notice there's a lot going on, and I'm not sure if what I'm seeing is normal or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are dozens of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[trace][system.db.CDbCommand]\nQuerying SQL: SHOW FULL COLUMNS FROM&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[profile][system.db.CDbCommand.query] begin:system.db.CDbCommand.query(SELECT...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What worries me slightly is that there are mentions of ALL the fields in ALL the tables in my DB, even those not used in the current template/entry and with &lt;code&gt;{% cache %}&lt;/code&gt; enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I panic or is this normal?&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2016-03-04T18:11:41.773" Title="Queries in devMode" Tags="&lt;database&gt;&lt;queries&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14014" PostTypeId="1" CreationDate="2016-03-04T07:05:35.407" Score="1" ViewCount="360" Body="&lt;p&gt;I recently ran into an issue that I was able to fix with what feels like a workaround – updating the config setting &lt;a href=&quot;https://craftcms.com/docs/config-settings#requireMatchingUserAgentForSession&quot; rel=&quot;nofollow&quot;&gt;requireMatchingUserAgentForSession&lt;/a&gt; to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I expect something changed on the website where I needed to do this, I'm not sure what would have changed and am curious if anybody with deeper knowledge of how user agents and sessions work could help explain what factors are at play here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my situation, members of the site were getting logged out shortly after they logged in and, while I could login to the control panel and navigate to several pages, each time I tried to access the Users tab, no users would display and I'd get logged out.  Each time this happened the corresponding item in the logs referenced a discrepancy between the user agent in the cookie and the current user agent.  The specific error message was:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Tried to restore session from the the identity cookie, but the saved&#xA;  user agent (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3)&#xA;  AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109&#xA;  Safari/537.36) does not match the current userAgent (Mozilla/5.0&#xA;  (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like&#xA;  Gecko) Chrome/48.0.2564.116 Safari/537.36).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The error outlines a discrepancy between &lt;code&gt;Chrome/48.0.2564.109&lt;/code&gt; in the cookie vs the current &lt;code&gt;Chrome/48.0.2564.116&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What scenario creates a discrepancy between the User Agent in the cookie and the current User Agent? What variables can change that cause a previously working membership site, to require suppressing differences in these variables to work?  Does suppressing this required match and allowing for differences in the current User Agent and the session open up possibilities for other issues to arise?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-03-04T07:39:26.530" LastActivityDate="2016-03-04T18:22:31.863" Title="Does setting requireMatchingUserAgentForSession to false have any additional implications to be aware of?" Tags="&lt;users&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14015" PostTypeId="2" ParentId="13656" CreationDate="2016-03-04T08:16:47.873" Score="2" Body="&lt;p&gt;After a lot of back and forth and reading various posts on this I thought I would submit my answer. There maybe better ways of doing what I ended up doing but hopefully this will provide a start for someone wanting to do the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First here are a few posts and questions that helped:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8614/find-entries-with-multiple-categories-with-an-and-or-twist&quot;&gt;Find entries with multiple categories with an and/or twist&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or&quot;&gt;How can I create an ElementCriteriaModel with &amp;#39;and&amp;#39; and &amp;#39;or&amp;#39;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://webstoemp.com/blog/combined-searches-and-filters-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Combined searches and filters using Craft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I created a search form that had the checkboxes for the search, each checkbox name when posted would form the get variable for the filter. A check is done to see if there are categories, if there are then I loop through and add them. There is also a check done to see if you are on the filter results page, if you are then set the relevant checkboxes to checked on the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Search Form Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('homes-for-sale/filter') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;&#xA;  {# check if there are any park categories if there are then show them as checkboxes #}&#xA;&#xA;  {% if parkCategories|length %}&#xA;&#xA;    {% for category in parkCategories %}&#xA;      {% set loopIndex = 'park' ~ loop.index %}&#xA;      &amp;lt;label class=&quot;checkbox-inline&quot;&amp;gt;&#xA;&#xA;        {# if you are on the filter results page then set the results to checked #}&#xA;&#xA;        {% if template is defined and template == 'filter' %}&#xA;          &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ loopIndex }}&quot; value=&quot;{{ category.slug }}&quot;{% if category.slug == park1 or category.slug == park2 or category.slug == park3 or category.slug == park4 or category.slug == park5 %} checked{% endif %}&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ loopIndex }}&quot; value=&quot;{{ category.slug }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;        {{ category.navTitle }}&#xA;      &amp;lt;/label&amp;gt;&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&#xA;  {# check if there are any price categories if there are then show them as checkboxes #}&#xA;&#xA;  {% if priceCategories|length %}&#xA;    {% for category in priceCategories %}&#xA;      {% set loopIndex = 'price' ~ loop.index %}&#xA;      &amp;lt;label class=&quot;checkbox-inline&quot;&amp;gt;&#xA;&#xA;        {# if you are on the filter results page then set the results to checked #}&#xA;&#xA;        {% if template is defined and template == 'filter' %}&#xA;          &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ loopIndex }}&quot; value=&quot;{{ category.slug }}&quot;{% if category.slug == price1 or category.slug == price2 or category.slug == price3 or category.slug == price4 or category.slug == price5 or category.slug == price6 %} checked{% endif %}&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;input type=&quot;checkbox&quot; name=&quot;{{ loopIndex }}&quot; value=&quot;{{ category.slug }}&quot;&amp;gt;&#xA;        {% endif %}&#xA;        {{ category.title }}&#xA;      &amp;lt;/label&amp;gt;&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Filter Results Page&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the results page you need to check which filter variables have been set via the get request and then display the appropriate related entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set park search parameters #}&#xA;{% set park1 = craft.request.getParam('park1') %}&#xA;{% set park2 = craft.request.getParam('park2') %}&#xA;{% set park3 = craft.request.getParam('park3') %}&#xA;{% set park4 = craft.request.getParam('park4') %}&#xA;{% set park5 = craft.request.getParam('park5') %}&#xA;&#xA;{# set price search parameters #}&#xA;{% set price1 = craft.request.getParam('price1') %}&#xA;{% set price2 = craft.request.getParam('price2') %}&#xA;{% set price3 = craft.request.getParam('price3') %}&#xA;{% set price4 = craft.request.getParam('price4') %}&#xA;{% set price5 = craft.request.getParam('price5') %}&#xA;{% set price6 = craft.request.getParam('price6') %}&#xA;&#xA;{# set park category model if it is in the search query #}&#xA;{% set parkCategory1 = park1|length ? craft.categories.slug(park1).first().id %}&#xA;{% set parkCategory2 = park2|length ? craft.categories.slug(park2).first().id %}&#xA;{% set parkCategory3 = park3|length ? craft.categories.slug(park3).first().id %}&#xA;{% set parkCategory4 = park4|length ? craft.categories.slug(park4).first().id %}&#xA;{% set parkCategory5 = park5|length ? craft.categories.slug(park5).first().id %}&#xA;&#xA;{# create an array of park categories #}&#xA;{% set parks = [&#xA;  parkCategory1,&#xA;  parkCategory2,&#xA;  parkCategory3,&#xA;  parkCategory4,&#xA;  parkCategory5,&#xA;] %}&#xA;&#xA;{# create a park array and trim blank strings #}&#xA;{% set trimParks = [] %}&#xA;&#xA;{% for park in parks %}&#xA;  {% if park|length %}&#xA;    {% set trimParks = trimParks|merge({ (loop.index0): park}) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# set price category model if it is in the search query #}&#xA;{% set priceCategory1 = price1|length ? craft.categories.slug(price1).first().id %}&#xA;{% set priceCategory2 = price2|length ? craft.categories.slug(price2).first().id %}&#xA;{% set priceCategory3 = price3|length ? craft.categories.slug(price3).first().id %}&#xA;{% set priceCategory4 = price4|length ? craft.categories.slug(price4).first().id %}&#xA;{% set priceCategory5 = price5|length ? craft.categories.slug(price5).first().id %}&#xA;{% set priceCategory6 = price6|length ? craft.categories.slug(price6).first().id %}&#xA;&#xA;{# create an array of price categories #}&#xA;{% set prices = [&#xA;  priceCategory1,&#xA;  priceCategory2,&#xA;  priceCategory3,&#xA;  priceCategory4,&#xA;  priceCategory5,&#xA;  priceCategory6,&#xA;] %}&#xA;&#xA;{# create a price array and trim blank strings #}&#xA;{% set trimPrices = [] %}&#xA;&#xA;{% for price in prices %}&#xA;  {% if price|length %}&#xA;    {% set trimPrices = trimPrices|merge({ (loop.index0): price}) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if trimParks|length and trimPrices|length %}&#xA;  {% set entries = craft.entries.section('homesForSale').relatedTo('and',&#xA;    {targetElement:parks},&#xA;    {targetElement:prices}&#xA;  ) %}&#xA;{% endif %}&#xA;&#xA;{% if trimParks|length and not trimPrices|length %}&#xA;  {% set entries = craft.entries.section('homesForSale').relatedTo('or',&#xA;    {targetElement:parks}&#xA;  ) %}&#xA;{% endif %}&#xA;&#xA;{% if trimPrices|length and not trimParks|length %}&#xA;  {% set entries = craft.entries.section('homesForSale').relatedTo('or',&#xA;    {targetElement:prices}&#xA;  ) %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;h1&amp;gt;Filter Results&amp;lt;/h1&amp;gt;&#xA;&#xA;{% if entries|length %}&#xA;    &amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;          {% set park = entry.park.first() %}&#xA;          {% set price = entry.parkPriceCategory.first() %}&#xA;          &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }} :: &amp;lt;b&amp;gt;{{ park }}&amp;lt;/b&amp;gt; :: &amp;lt;b&amp;gt;{{ price }}&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Your search didn't return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-04T11:05:26.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14016" PostTypeId="2" ParentId="14011" CreationDate="2016-03-04T15:22:58.683" Score="4" Body="&lt;p&gt;Thanks to Brad for asking me a question above, it made me realize I was checking for matrix fields and not the matrix block. My code is now working that I am checking for the correct element on the page.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Revised code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.modelIds|length == 1 %}&#xA;     I am link - {{block.modelId}} &amp;lt;br&amp;gt;&#xA;{% else %}&#xA;     Not a Link - {{block.modelId}}&amp;lt;br&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks Brad for the help! &lt;/p&gt;&#xA;" OwnerUserId="3571" LastActivityDate="2016-03-04T15:22:58.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14019" PostTypeId="1" CreationDate="2016-03-04T17:40:58.277" Score="0" ViewCount="221" Body="&lt;p&gt;I am using structure type entries for navigation with three fields for navigation that uses either: &#xA;-customlink field (plain text) or &#xA;-category&#xA;entry&#xA;as the source for links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have product categories setup like in this post: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/353/how-do-i-add-a-subcategory-to-the-url-slug-for-a-channel-entry/372#372&quot;&gt;How do I add a subcategory to the URL slug for a channel entry?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me the display of products I want from each category. My nav output template for category navigation looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% if entry.menulink|length %}&#xA;&#xA;            &amp;lt;a  href=&quot;{{ entry.menulink.first.slug }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% elseif entry.customMenuUrl %}&#xA;&#xA;            &amp;lt;a  href=&quot;{{ entry.customMenuUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;&#xA;            {% elseif entry.productCategoryLink|length %}&#xA;&#xA;            &amp;lt;a  class=&quot;{{ activeclass }}&quot; href=&quot;{{ entry.productCategoryLink.first | lower }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My category links work to display my nice list of products.&#xA;My products section is set like: &lt;a href=&quot;https://www.dropbox.com/s/o4ia62jo7i8yo38/Screenshot%202016-03-04%2017.29.35.png?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/o4ia62jo7i8yo38/Screenshot%202016-03-04%2017.29.35.png?dl=0&lt;/a&gt;&#xA;with the section entry urls set to render an entry in the template 'flowers/_entry.html''&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SO thats the setup for navigation and templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two problems are occurring which I cannot resolve yet.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The entry links in my category template produce nothing. When clicking on an entry from the category  I get my base and site templates but the output at 'flowers/_entry.html' is never rendered. I cant work out where craft thinks the entry template for the category should be. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;2 . My navigation links are inheriting the current url &#xA;So if on the page 'mysite.com/category1' and i click on 'category1' in my navigation the url becomes ''mysite.com/category1/category1'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have been round the houses for 2 days on 1 above. I don't mind a learning curve but I am in circles and not ascending the curve :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-05T19:28:27.680" Title="Navigation structure and uri problems" Tags="&lt;categories&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14020" PostTypeId="2" ParentId="14013" CreationDate="2016-03-04T18:11:41.773" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I panic or is this normal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Normal. Each of those &lt;code&gt;[trace]&lt;/code&gt; and &lt;code&gt;[profile]&lt;/code&gt; log entries will have a stack backtrace listed under them showing you exactly what led up to that query, if you're curious.  Usually the &lt;code&gt;SHOW FULL COLUMNS FROM&lt;/code&gt; query is coming from an ActiveRecord when Yii queries to get metadata for the underlying table it represents.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-04T18:11:41.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14021" PostTypeId="2" ParentId="14014" CreationDate="2016-03-04T18:22:31.863" Score="1" Body="&lt;p&gt;The reason Craft stores the user agent string in the authentication cookie when logging in is to help prevent session/cookie hijacking.  If will validate that it is the same subsequent requests on the presumption if your cookie is hijacked, there's a significant chance that the browser that stole the cookie will have a different user agent string that the one the session was started with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Granted, this isn't fool proof (user agent strings are easily spoofed) and some browsers store their version number (like you discovered) in the user agent string as well.  This is all well-and-good until your browser decides to auto-update, forcing the string to change and then auto-logging you out of Craft, which looks like what you're seeing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-04T18:22:31.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14022" PostTypeId="1" AcceptedAnswerId="14025" CreationDate="2016-03-05T00:42:52.503" Score="3" ViewCount="4007" Body="&lt;p&gt;I lazily added the following to my parent site template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block body %}&#xA;    {% block content %}&#xA;    {% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this 'allowed' in Twig ?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-03-05T06:04:43.030" LastActivityDate="2016-03-05T19:16:26.667" Title="Nesting blocks - is the following problematic?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14023" PostTypeId="1" AcceptedAnswerId="14027" CreationDate="2016-03-05T03:10:31.500" Score="1" ViewCount="284" Body="&lt;p&gt;I am allowing guest registrations - everything is working fine. I am hung up on getting my drop down menu to repopulate/hold its value if there are any errors while submitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;states&lt;/code&gt; field in the CP which is a dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my twig template I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Get all of the states.&#xA; #&#xA; #}&#xA; {% set states = craft.fields.getFieldByHandle('states').getFieldType.options %}&#xA; {% if states|length %}&#xA;     &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;         &amp;lt;label for=&quot;state&quot;&amp;gt;State&amp;lt;/label&amp;gt;&#xA;         &amp;lt;select id=&quot;state&quot; name=&quot;fields[address][state]&quot; class=&quot;form-control&quot;&amp;gt;&#xA;             &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;             {% for option in states %}&#xA;                 &amp;lt;option val=&quot;{{ option.value }}&quot;&#xA;                     {%- if account is defined and option.value in account.address.state %} selected {% endif -%}&amp;gt;&#xA;                     {{ option.label }}&#xA;                 &amp;lt;/option&amp;gt;&#xA;             {% endfor %}&#xA;         &amp;lt;/select&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA; {% endif %}&#xA; {% if account is defined %}&#xA;     {{ errorList(account.getErrors('state')) }}&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using SmartMap to capture my address hence the name of &lt;code&gt;fields[address][state]&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- if account is defined %} selected {% endif -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gets the last option selected, so I know &lt;code&gt;account&lt;/code&gt; is getting defined, its something in my &lt;code&gt;and&lt;/code&gt; part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of my data is getting captured correctly, I just can't see past the obvious here I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to @carlcs I found that the value of my &lt;code&gt;state&lt;/code&gt; field was getting saved as the label. I'm not sure if thats a function of SmartMap, or something else I might have done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I ended up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;{% for option in states %}&#xA;    &amp;lt;option val=&quot;{{ option.value }}&quot;&#xA;        {%- if account is defined and option.label in account.address.state %} selected {% endif -%}&amp;gt;&#xA;        {{ option.label }}&#xA;    &amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, here is how I was able to repopulate a &quot;normal&quot; drop-down (not address/SmartMap):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;{% for option in myField %}&#xA;    &amp;lt;option val=&quot;{{ option.value }}&quot;&#xA;    {%- if account is defined and option.label in account.myField.label %} selected {% endif -%}&amp;gt;&#xA;       {{ option.label }}&#xA;    &amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think it's also worth noting that by setting &lt;code&gt;myField&lt;/code&gt; as a required field in the CP, I needed to hard-code the &lt;code&gt;&amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&lt;/code&gt; in the template rather than putting it as a field value. When I had it as a field value, I (think) Craft was accepting that as a selected value and I was not getting the error message. &lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-03-07T12:34:48.543" LastActivityDate="2016-03-07T12:34:48.543" Title="How can I repopulate my dropdown on a front-end form?" Tags="&lt;registration&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14024" PostTypeId="1" AcceptedAnswerId="14029" CreationDate="2016-03-05T05:40:17.610" Score="0" ViewCount="484" Body="&lt;p&gt;How do you load a custom element action using getAvailableActions inside my Element Type class?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAvailableActions($source = null)&#xA;{&#xA;    $customAction = craft()-&amp;gt;elements-&amp;gt;getAction('Custom');&#xA;&#xA;    $customAction-&amp;gt;setParams(array(&#xA;        'label' =&amp;gt; Craft::t('Custom'),&#xA;    ));&#xA;&#xA;    $actions[] = $customAction;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above renders a PHP error &lt;strong&gt;PHP Fatal error: Call to a member function setParams() on a non-object&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;PluginName_CustomElementAction&lt;/em&gt; is my file inside the &lt;em&gt;elementactions&lt;/em&gt; folder, inside my plugin. Which is copied directly from &lt;a href=&quot;https://craftcms.com/docs/plugins/element-actions&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/element-actions&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;class PluginName_CustomElementAction extends BaseElementAction&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Custom');&#xA;    }&#xA;&#xA;    public function isDestructive()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;    public function performAction(ElementCriteriaModel $criteria)&#xA;    {&#xA;        // Remove all the ingredients from the selected elements&#xA;        $elements = $criteria-&amp;gt;find();&#xA;&#xA;        foreach ($elements as $element)&#xA;        {&#xA;            craft()-&amp;gt;cocktailRecipes-&amp;gt;removeAllIngredientsFromElement($element);&#xA;        }&#xA;&#xA;        // Success!&#xA;        $this-&amp;gt;setMessage(Craft::t('Ingredients removed successfully.'));&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is wrong with my getAvailableActions object?&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="57" LastEditDate="2016-03-06T17:58:16.190" LastActivityDate="2016-03-06T17:58:16.190" Title="Trouble loading custom element action (menu option)" Tags="&lt;plugin-development&gt;&lt;elementaction&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14025" PostTypeId="2" ParentId="14022" CreationDate="2016-03-05T19:16:26.667" Score="3" Body="&lt;p&gt;Yes, see the block tags docs. &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html#block-nesting-and-scope&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/tags/extends.html#block-nesting-and-scope&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-05T19:16:26.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14026" PostTypeId="2" ParentId="14019" CreationDate="2016-03-05T19:28:27.680" Score="2" Body="&lt;p&gt;OP solved it with using the correct block names.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-05T19:28:27.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14027" PostTypeId="2" ParentId="14023" CreationDate="2016-03-05T19:51:08.380" Score="2" Body="&lt;p&gt;You could &lt;code&gt;dump&lt;/code&gt; the &lt;code&gt;account&lt;/code&gt; variable to see why the conditional doesn't work as you're expecting. I don't really see the reason to why you'd need the &lt;code&gt;in&lt;/code&gt; containment test, but I'd just use &lt;code&gt;dump&lt;/code&gt; for debugging.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-05T19:51:08.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14028" PostTypeId="2" ParentId="14024" CreationDate="2016-03-05T20:00:15.257" Score="1" Body="&lt;p&gt;I'd recommend to follow the guide in the docs. &lt;a href=&quot;https://craftcms.com/docs/plugins/element-actions&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/element-actions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; There's a dedicated section about &quot;Adding actions to index pages&quot;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If your Element Action is intended for your own custom Element Type, you can do that by implementing the &lt;a href=&quot;http://buildwithcraft.com/classreference/elementtypes/IElementType#getAvailableActions-detail&quot; rel=&quot;nofollow&quot;&gt;getAvailableActions()&lt;/a&gt; method on your Element Type class.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The link takes you to the method's documentation.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * Returns the available element actions for a given source (if one is provided).&#xA; *&#xA; * The actions can either be represented by their class handle (e.g. 'SetStatus'), or by an&#xA; * instance.&#xA; *&#xA; * @param string|null $source The selected source’s key, if any.&#xA; *&#xA; * @return array|null The available element actions.&#xA; */&#xA;public function getAvailableActions($source = null);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's also explained how to implement actions for Craft’s built-in Element Types.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[…] Craft’s built-in Element Types: &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#addEntryActions&quot; rel=&quot;nofollow&quot;&gt;addEntryActions&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#addCategoryActions&quot; rel=&quot;nofollow&quot;&gt;addCategoryActions&lt;/a&gt;, …&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's example code provided if you click those links.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function addEntryActions($source)&#xA;{&#xA;    return array(&#xA;        'Foo',&#xA;        new BarElementAction(),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-03-06T11:10:26.293" LastActivityDate="2016-03-06T11:10:26.293" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14029" PostTypeId="2" ParentId="14024" CreationDate="2016-03-06T12:15:03.810" Score="2" Body="&lt;p&gt;I think your issue may be that the ElementsService &lt;a href=&quot;https://craftcms.com/classreference/services/ElementsService#getAction-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getAction&lt;/code&gt;&lt;/a&gt; method expects &lt;em&gt;the full classname&lt;/em&gt; for your custom ElementAction (sans the &quot;ElementAction&quot; suffix), i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$customAction = craft()-&amp;gt;elements-&amp;gt;getAction('PluginName_Custom');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-06T12:15:03.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14030" PostTypeId="1" AcceptedAnswerId="14033" CreationDate="2016-03-07T07:23:19.007" Score="2" ViewCount="625" Body="&lt;p&gt;I'm pulling data from a Global Set using the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API plugin&lt;/a&gt; and am wondering if there's a cleaner way to write the transformer function? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;craft/config/elementapi.php&lt;/code&gt; file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/settings' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'GlobalSet',&#xA;            'criteria' =&amp;gt; ['handle' =&amp;gt; 'siteSettings'],&#xA;            'first' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function(GlobalSetModel $siteSettings) {&#xA;                return [&#xA;                    'defaultTitle' =&amp;gt; $siteSettings-&amp;gt;getContent()['defaultTitle'],&#xA;                    'defaultDescription' =&amp;gt; $siteSettings-&amp;gt;getContent()['defaultDescription']&#xA;                ];&#xA;            },&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="57" LastEditDate="2016-03-07T16:30:43.640" LastActivityDate="2016-03-07T16:30:43.640" Title="How to get field values from Global Set using Element API plugin?" Tags="&lt;globals&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14031" PostTypeId="1" CreationDate="2016-03-07T08:42:20.570" Score="0" ViewCount="58" Body="&lt;p&gt;I'm trying to set up SMTP in Craft backend Settings &gt; Email to get Mandrill working. But regardless of which protocol I choose, no settings fields are shown, and when I click save it just says &quot;Couldn’t save email settings&quot;. It's the same in both Firefox and Chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be the problem here, and how do I fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance and best regards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Monkey&lt;/p&gt;&#xA;" OwnerUserId="4802" LastActivityDate="2016-03-08T07:52:16.380" Title="Why are the email settings fields not showing, and how do I fix this?" Tags="&lt;emails&gt;&lt;settings&gt;&lt;mandrill&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14032" PostTypeId="1" AcceptedAnswerId="14034" CreationDate="2016-03-07T10:49:44.390" Score="6" ViewCount="700" Body="&lt;p&gt;So I've built a language switcher as per &lt;a href=&quot;https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the text for each link to be in the native language, for example I want the link to the English locale to say &quot;Read this page in English&quot; and the link to Spanish locale to say &quot;Leer esta página en Español&quot; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However using the |t filter uses the locale that you're currently on, so if I'm on Spanish it says &quot;Leer esta página en English&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to pass in a parameter or something to say, for example, |t(Spanish).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4123" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-03-07T13:17:24.203" Title="Can I choose a language for the translate filter?" Tags="&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14033" PostTypeId="2" ParentId="14030" CreationDate="2016-03-07T11:27:30.190" Score="3" Body="&lt;p&gt;There’s no need to go through &lt;code&gt;getContent()&lt;/code&gt; to access your field values; you can access them directly from the GlobalSetModel:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(GlobalSetModel $siteSettings) {&#xA;    return [&#xA;        'defaultTitle' =&amp;gt; $siteSettings-&amp;gt;defaultTitle,&#xA;        'defaultDescription' =&amp;gt; $siteSettings-&amp;gt;defaultDescription&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-03-07T11:27:30.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14034" PostTypeId="2" ParentId="14032" CreationDate="2016-03-07T13:17:24.203" Score="10" Body="&lt;p&gt;Yes. You can see all of the arguments the &lt;code&gt;|t&lt;/code&gt; filter supports by looking at the docs for &lt;a href=&quot;https://craftcms.com/classreference//Craft#t-detail&quot;&gt;Craft::t()&lt;/a&gt;, the function that &lt;code&gt;|t&lt;/code&gt; maps to. Its &lt;code&gt;$language&lt;/code&gt; argument defines the target language translation to use. So in your case you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;Leer esta página en Español&quot;|t(language=&quot;es&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-03-07T13:17:24.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14035" PostTypeId="1" CreationDate="2016-03-07T15:32:41.530" Score="2" ViewCount="183" Body="&lt;p&gt;I would like to send an Email to a dynamic list of recipients with &lt;strong&gt;SproutEmail&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a Plugin that adds custom element actions in the users indexview that raise a custom SproutEmailEvent to send a Notification. The event works fine already, but I want to send the notification to the dynamically selected list of users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I select 4 Users in my user indexview and click on my custom action &quot;Send Reminder email&quot;, then all of the four selected users should receive the notification email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also of course, I would need to address the selected users in the email template, like &quot;Dear {firstName} {lastName}&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how I could do that with a single user, but how about a dynamic list of selected users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Robert&lt;/p&gt;&#xA;" OwnerUserId="4226" LastActivityDate="2016-03-19T00:14:10.157" Title="Send Emails to dynamic list of recipients" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14036" PostTypeId="1" CreationDate="2016-03-07T17:27:10.673" Score="1" ViewCount="164" Body="&lt;p&gt;I’ve got a funny Printmaker issue here that I hope you can help me with!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using the following code to generate a link to a PDF:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = { title: supportGuides.title, body: supportGuides.body } %}&#xA;&#xA;{% set settings = { orientation : 'portrait', filename:supportGuides.slug~'.pdf' } %}&#xA;&#xA;{% set pdf = craft.printmaker.pdfFromTemplate('support-guides/download', vars, settings) %}&#xA;&#xA;&amp;lt;a href=“{{ pdf.url }}&quot; target=&quot;_blank&quot;&amp;gt;Download PDF Support Guide&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my HTML output, the beginning of the line is stripped out inexplicably:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://mysite.dev/Printmaker/support-guide.pdf&quot; target=&quot;_blank&quot;&amp;gt;Download PDF Support Guide&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I prevent the opening tag from being cut out like that?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-03-07T21:46:03.910" Title="Printmaker plugin cuts off HTML when rendering PDF link" Tags="&lt;pdf&gt;&lt;plugin-printmaker&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14037" PostTypeId="2" ParentId="14036" CreationDate="2016-03-07T17:27:10.673" Score="2" Body="&lt;p&gt;Depending on your server setup, DOMPDF might be resetting the output buffer when the PDF is generated. This is a fairly rare issue, but I have heard of it before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution: Try moving the Printmaker PDF-generation code to the top of the template before any output.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, at the top of the template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pdfUrl = craft.printmaker.pdfFromTemplate('support-guides/download', vars, settings).url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and then later, in your output content...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ pdfUrl }}&quot; target=&quot;_blank&quot;&amp;gt;Download PDF Support Guide&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2016-03-07T21:46:03.910" LastActivityDate="2016-03-07T21:46:03.910" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14039" PostTypeId="1" CreationDate="2016-03-07T18:29:41.667" Score="1" ViewCount="602" Body="&lt;p&gt;I am trying to move a Craft site to a new server but am having difficulties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have backed up the whole site and database an replicated it on a new server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 pages work fine, one page only loads the header, and the admin page lets me login but the dashboard is blank but there are no console errors in chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have changed my host files on my mac to point the domain to the new server so I'm not sure if this might cause issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there something else I am missing?&lt;/p&gt;&#xA;" OwnerUserId="4859" LastEditorUserId="57" LastEditDate="2016-03-07T22:28:37.740" LastActivityDate="2016-04-06T23:08:08.420" Title="Moving site to new server - admin area not working" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14040" PostTypeId="2" ParentId="13983" CreationDate="2016-03-07T18:32:11.960" Score="2" Body="&lt;p&gt;&lt;strong&gt;Regarding Problem 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Twig function &lt;code&gt;{{ getHeadHtml() }}&lt;/code&gt; does only work with JS/CSS that are included before this tag. I had the same problem... you can find the answer/explanation of Brandon Kelly here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13898/getheadhtml-not-outputting-css-included-with-includecss&quot;&gt;getHeadHtml() not outputting CSS included with {% includeCss %}&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding Problem 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; does only cache the output HTML, no variables (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13335/is-it-possible-to-cache-variables-using-the-cache-tag/13338#13338&quot;&gt;Is it possible to cache variables using the {% cache %} tag?&lt;/a&gt;). As a workaround you could cache the &lt;code&gt;{{ getFootHtml() }}&lt;/code&gt; as well: in the first request it process the complete Twig code and stores the &lt;code&gt;getFootHtml&lt;/code&gt; content correct. With this solution, you need to delete the cache manually (or with the &lt;code&gt;onAfterSave&lt;/code&gt; event) after (re)saving, and adding/deleting an entry that could affect the cache.&#xA;Note: This does not work with &lt;code&gt;{{ getHeadHtml() }}&lt;/code&gt; (see Problem 1).&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-07T18:44:04.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14041" PostTypeId="1" AcceptedAnswerId="14045" CreationDate="2016-03-07T18:55:16.060" Score="3" ViewCount="915" Body="&lt;p&gt;I have a section of book entries with a categories field called &quot;Genre&quot;. A book can fall into multiple genres. A stripped down version of the categories works something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fiction&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Crime, Thrillers &amp;amp; Mystery&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mystery&lt;/li&gt;&#xA;&lt;li&gt;Thrillers&lt;/li&gt;&#xA;&lt;li&gt;Action &amp;amp; Adventure&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Fantasy&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Non-Fiction&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the home page, there is to be a feature panel linking to a particular genre, let's say &lt;em&gt;Thrillers&lt;/em&gt; for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the feature panel field, I need to limit this to a single genre, but if I set the limit on the categories field to 1 and select &lt;em&gt;Thrillers&lt;/em&gt;, it just selects &lt;em&gt;Fiction&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I could just remove the limit and then use twig to get only entries from the deepest selected category, but I don't want to open up the possibility that they'll select multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way around this? I can't help but feel like the limit option on the categories fieldtype is a bit broken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* Update for clarity *&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories group called Genre is structured as above&lt;br&gt;&#xA;Books channel has a category field called Genre, allowed to select multiple genres&lt;br&gt;&#xA;Homepage has a category field called Related Genre&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intention is to choose a single category for Related Genre to output the books which have that category selected in Genre.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all entirely within the admin area, so code is effectively irrelevant at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps some images will make this clearer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the entry, I attempt to select Thrillers:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/G2Pa2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G2Pa2.png&quot; alt=&quot;Attempt to select Thrillers&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after clicking select, it has just selected Fiction:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dtJeP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dtJeP.png&quot; alt=&quot;Selected fiction instead&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3912" LastEditorUserId="3912" LastEditDate="2016-03-07T20:31:59.740" LastActivityDate="2016-03-08T07:01:43.210" Title="Limit category choice in entry to 1 and select child category" Tags="&lt;categories&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14042" PostTypeId="2" ParentId="14039" CreationDate="2016-03-07T22:30:26.560" Score="1" Body="&lt;p&gt;I'd start with debugging the control panel. If you enable devMode, and load the dashboard, you might see any error message that display on the screen that would give you a clue what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not there, then some error message is probably being logged in your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files that would help.  Open that files and do a search for &lt;code&gt;[error]&lt;/code&gt; and look for any suspicious messages.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-07T22:30:26.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14043" PostTypeId="1" CreationDate="2016-03-08T02:33:10.987" Score="1" ViewCount="423" Body="&lt;p&gt;In an entry, when selecting a child category, the parent is shown as the selected item. This prevents the use of any child categories. Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RRDkp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RRDkp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Selection Modal:&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/olwqH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/olwqH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Selection within the Entry&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/h0L7P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h0L7P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3332" LastActivityDate="2016-03-08T07:05:46.277" Title="Child categories appear as their parent when selected" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14044" PostTypeId="2" ParentId="13886" CreationDate="2016-03-08T03:24:15.947" Score="0" Body="&lt;p&gt;Currently Sprout Forms does not support email attachments when using S3 assets.&lt;/p&gt;&#xA;" OwnerUserId="4807" LastActivityDate="2016-03-08T03:24:15.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14045" PostTypeId="2" ParentId="14041" CreationDate="2016-03-08T07:01:43.210" Score="1" Body="&lt;p&gt;You could use a structure for Genre rather than categories. This would let you select &lt;em&gt;Thrillers&lt;/em&gt; as a single entry.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-03-08T07:01:43.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14046" PostTypeId="2" ParentId="14043" CreationDate="2016-03-08T07:05:46.277" Score="3" Body="&lt;p&gt;Do you have a limit of 1 set for the number of categories? Selecting a child category (Pacific Northwest) selects the parent as well, and if there is a limit of 1, then only the parent end up selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around this, you could model the regions with a structure rather than categories. Picking elements from a structure does not select the parent as well, so with a limit of 1 it would be possible to select Pacific Northwest.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-03-08T07:05:46.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14047" PostTypeId="2" ParentId="14031" CreationDate="2016-03-08T07:52:16.380" Score="1" Body="&lt;p&gt;Since I was short on time I ended up reinstalling Craft. Not exactly a minimum effort solution, but it fixed the backend &gt; settings &gt; email problem (and the updates page, that was not functioning properly as well). However, new install would not show my plugin in backend &gt; settings &gt; plugins. The solution to this, was to create a bare minimum test plugin (just copy pasted from &lt;a href=&quot;https://craftcms.com/docs/plugins/setting-things-up&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/setting-things-up&lt;/a&gt;), after which both the test plugin and my real plugin showed up in backend. All seem ok now.&lt;/p&gt;&#xA;" OwnerUserId="4802" LastActivityDate="2016-03-08T07:52:16.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14048" PostTypeId="1" CreationDate="2016-03-08T09:26:29.767" Score="1" ViewCount="423" Body="&lt;p&gt;Currently i am using this approach for linking to a entry(single page) of a structure, for example a cta button on the homepage which links to the contact page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% set single = craft.entries.id('14').first() %}&#xA;    {% if single %}&#xA;        &amp;lt;a class=&quot;button button--full t-spacing&quot; href=&quot;{{ single.url }}&quot;&amp;gt;{{ &quot;Neem contact op&quot; | translate }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or for example a &quot;read more&quot; button next to some results of some structure without a index. Because thats set in the structure &quot;pages&quot; as a entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But i feel like this is somewhat hacky..&#xA;Of course you can link to a page like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ url('contact') }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;href=&quot;{{ &quot;contact&quot;|translate }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But url() doesn't translate and what if the slug is changed by a user of the CP.&#xA;So what is the usual way to get around this, are there any best practises?&#xA;So far i can only think of linking all the individual buttons/links to entry fields in the CP, which the user has to fill in.&lt;/p&gt;&#xA;" OwnerUserId="4077" LastActivityDate="2016-03-08T13:25:36.760" Title="Linking a page in a multilanguage website" Tags="&lt;localization&gt;&lt;entry&gt;&lt;structure&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14049" PostTypeId="1" AcceptedAnswerId="14050" CreationDate="2016-03-08T12:41:10.360" Score="1" ViewCount="315" Body="&lt;p&gt;I'm using Sprout Forms to handle email forms on a website. Hardcoding a template with the code: &lt;code&gt;{{ craft.sproutForms.displayForm('contactForm') }}&lt;/code&gt; works fine like in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have a Matrix field to build the page content so I'd like to add a new field type to that I can select which form to display. There is a Matrix field type 'sprout forms' which lets me select the form fine in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how do I now display the form in the template. I can't see any documentation on how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried things like &lt;code&gt;{{ block.customForm.displayForm() }}&lt;/code&gt; but with no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone tried this before?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4865" LastEditorUserId="57" LastEditDate="2016-03-08T16:12:50.940" LastActivityDate="2016-03-08T16:12:50.940" Title="Outputting Sprout Form from a matrix field" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14050" PostTypeId="2" ParentId="14049" CreationDate="2016-03-08T13:01:40.070" Score="2" Body="&lt;p&gt;Sure, you'll likely want to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageBody %}&#xA;    {% if block.type == 'form' %}&#xA;        {{ craft.sproutForms.displayForm(block.form.first.handle) }}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-03-08T13:01:40.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14051" PostTypeId="2" ParentId="14048" CreationDate="2016-03-08T13:25:36.760" Score="4" Body="&lt;p&gt;You could write a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig macro&lt;/a&gt; to get the localized URL from an entry ID. Import it from _layout.html for example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro urlFromId(entryId) %}&#xA;    {%- set entry = craft.entries.id(entryId).first() %}&#xA;    {{- entry ? entry.url -}}&#xA;{% endmacro %}&#xA;&#xA;{% import _self as macros %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use this more concise code everywhere in your templates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;button&quot; href=&quot;{{ macros.urlFromId(14) }}&quot;&amp;gt;{{ &quot;Neem contact op&quot;|t }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-08T13:25:36.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14052" PostTypeId="2" ParentId="9024" CreationDate="2016-03-08T15:17:34.380" Score="1" Body="&lt;p&gt;Not sure if this is of use to you, and if you use it I would recommend ensuring that you use is with security in mind. But someone has forked the GuestEntries plugin to allow editing and deleting of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ChaseGiunta/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ChaseGiunta/GuestEntries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-03-08T15:17:34.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14053" PostTypeId="1" CreationDate="2016-03-08T17:36:55.010" Score="2" ViewCount="58" Body="&lt;p&gt;I'm working on an existing site that has an &quot;Entries&quot; field that allows authors to provide a selection of related articles. However, since some articles have titles whose meaning is not entirely clear in this different context, the client would like to be able to tweak the wording of the titles in this &quot;related articles&quot; context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way I can see to do this would be to make the &quot;Related articles&quot; field a Matrix, with each block containing both an entry and an alternative title. However, this is an existing site with lots of posts that already use this field, so I'd need to somehow convert the existing &quot;Entries&quot; field to a Matrix. Is this possible at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I realise that an alternative approach would be to add a &quot;Short title&quot; field to entries. However, UX-wise this feels awkward compared to the Matrix approach, since it would require the editor to also potentially edit each of the related articles, which is both more long-winded and less clear as a process)&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-03-08T17:55:13.090" Title="Is there any way of converting an existing field to a Matrix?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;conversion&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14054" PostTypeId="2" ParentId="14053" CreationDate="2016-03-08T17:55:13.090" Score="2" Body="&lt;p&gt;Unless each time an Entry is selected the name needs to be different (to other times that same Entry is chosen), then I would suggest using your latter approach of adding an secondary Title field as it would be more efficient in the long term because the secondary Title would only need to be added &lt;strong&gt;once&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's about an Entry, consider keeping it 'with' the Entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use a similar approach for Meta Titles to override the Entry title for SEO purposes. &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-08T17:55:13.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14055" PostTypeId="1" CreationDate="2016-03-08T18:50:47.137" Score="0" ViewCount="390" Body="&lt;p&gt;I'm having some issues with  when applying image transforms. Hopefully it's something obvious I'm over looking. The code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;picture&amp;gt;&#xA;    &amp;lt;source media=&quot;(min-width: 401px)&quot; srcset=&quot;{{ imageUrl.getUrl('homeBanner') }}&quot;&amp;gt;&#xA;    &amp;lt;source media=&quot;(max-width: 400px)&quot; srcset=&quot;{{ imageUrl.getUrl('iphone400x710') }}&quot;&amp;gt;&#xA;    &amp;lt;source srcset=&quot;{{ imageUrl.getUrl('iphone400x710') }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ imageUrl.getUrl('iphone400x710') }}&quot; alt=&quot;Image Desc&quot;&amp;gt;&#xA;&amp;lt;/picture&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Images uploaded are all 2000px x 1330px and the transform should crop from center to the specified size in the handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is it works on my local server but once uploaded to my (shared) dev server I am getting php out of memory errors on this script &lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 617&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something incorrectly that is causing the script to run for too long?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-03-08T21:55:34.857" Title="Issues with picture and image transforms" Tags="&lt;image-transforms&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14056" PostTypeId="2" ParentId="14055" CreationDate="2016-03-08T20:41:19.560" Score="1" Body="&lt;p&gt;You might try putting putting something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_php5.c&amp;gt;&#xA;  php_value max_execution_time &quot;30&quot; &#xA;  php_value memory_limit &quot;256M&quot;&#xA;&amp;lt;/IfModule&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;inside your &lt;code&gt;.htaccess.&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can tell what your PHP values are right inside Craft... unless you changed your admin trigger, just visit &lt;code&gt;http://server/admin/utils/phpinfo&lt;/code&gt; and search for &lt;code&gt;memory_limit&lt;/code&gt; and &lt;code&gt;max_execution_time&lt;/code&gt;. That'll give you some clues as to what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some hosts set these values really low but the &lt;a href=&quot;http://php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;nofollow&quot;&gt;default execution time&lt;/a&gt; is 30 and memory limit is 128M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you run PHP as a cgi, some hosts allow you to use &lt;code&gt;ini&lt;/code&gt; files in lieu of .htaccess. Typically these are at the root of your home folder but they could be stored elsewhere. Put &lt;code&gt;memory_limit = 256M&lt;/code&gt; in one and throw it up in your home folder. Running &lt;code&gt;php_info()&lt;/code&gt; would tell you the location of the current in use one.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-03-08T21:55:34.857" LastActivityDate="2016-03-08T21:55:34.857" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="14057" PostTypeId="1" AcceptedAnswerId="14071" CreationDate="2016-03-08T23:40:49.153" Score="5" ViewCount="1453" Body="&lt;p&gt;Not sure whether this is directly related to Craft but I’ve been using this method for years and it has always worked with other sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m replacing an old site and some pages have moved. I want to redirect any old pages to the new url since there are already indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using a simple redirect 301&#xA;Redirect 301 /work/project-name &lt;a href=&quot;http://www.mysite.com/case-studies&quot; rel=&quot;noreferrer&quot;&gt;http://www.mysite.com/case-studies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m getting &lt;a href=&quot;http://www.mysite.com/case-studies/project-name?p=work/project-name&quot; rel=&quot;noreferrer&quot;&gt;http://www.mysite.com/case-studies/project-name?p=work/project-name&lt;/a&gt; and of course a page not found since this is not where I intended the page to go.&lt;/p&gt;&#xA;" OwnerUserId="2224" LastActivityDate="2016-03-09T19:08:35.607" Title="Why am I getting ?p=oldpage in a 301 redirect?" Tags="&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14058" PostTypeId="2" ParentId="10456" CreationDate="2016-03-09T00:20:56.100" Score="2" Body="&lt;p&gt;Another approach -- that might work for you -- is to filter on the output, rather than the query. For instance, using this query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output using this loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries if entry.category is empty %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;YMMV&lt;/p&gt;&#xA;" OwnerUserId="92" LastActivityDate="2016-03-09T00:20:56.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14061" PostTypeId="1" CreationDate="2016-03-09T06:50:59.947" Score="2" ViewCount="294" Body="&lt;p&gt;I have started using &lt;a href=&quot;https://www.imgix.com/&quot; rel=&quot;nofollow&quot;&gt;imgix&lt;/a&gt; on some non-Craft sites, and it’s bloody awesome. It’s a bit similar to Craft in the way you apply transforms to a master image, and those transforms are done on-demand and then cached for future use. Only with imgix the transforms are done in the cloud and stored on their global CDN. Now I was thinking if it might be possible to write a Craft plugin to use imgix instead of the internal image handling code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips/pointers on how to go about this would be most appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3789" LastEditorUserId="57" LastEditDate="2016-03-10T03:31:34.137" LastActivityDate="2017-04-03T19:47:29.933" Title="Writing an Craft plugin for imgix?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14062" PostTypeId="1" CreationDate="2016-03-09T09:14:18.950" Score="6" ViewCount="369" Body="&lt;p&gt;In the plugin I'm creating I've got a form that has inputs which are set as disabled if they are overridden in a conifg file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that is occurring is that disabled class is added to the input but the disabled attribute is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}    &#xA;{% set configSettings = craft.config.get('settings', 'myPlugin') %}&#xA;{% for paramKey, paramValue in array %}&#xA;       {% set disabled = (configSettings[paramKey] is defined) %}&#xA;       {# other variable sets here #}&#xA;       {{ forms.textField({&#xA;            label: paramLabel,&#xA;            name: inputName,&#xA;            value : paramValue,&#xA;            disabled: disabled,&#xA;            required: required&#xA;            }) }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I navigate to the page, the input field is greyed out but I can still input data to the input field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the HTML that I see when I inspect the element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input class=&quot;text disabled fullwidth&quot; type=&quot;text&quot; name=&quot;settings[abcd]&quot; value=&quot;abc&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;disabled: true&lt;/code&gt; and &lt;code&gt;disabled: 1&lt;/code&gt; in the code above to test and the same html is returned.&lt;/p&gt;&#xA;" OwnerUserId="4179" LastEditorUserId="3951" LastEditDate="2016-05-08T23:03:17.337" LastActivityDate="2016-05-31T09:58:35.280" Title="Form input not being disabled" Tags="&lt;plugin-development&gt;&lt;form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14063" PostTypeId="1" CreationDate="2016-03-09T09:22:56.490" Score="0" ViewCount="245" Body="&lt;p&gt;I'm trying to log in to the admin area of an local install but all that happens is the page refreshes and nothing happens. Digging deeper I found this in the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/03/09 09:16:38 [error] [exception.CException] exception&#xA;'CException' with message 'Property &quot;Craft\SessionRecord.token&quot; is not defined.'&#xA;in /craft/app/framework/base/CComponent.php:173&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried re-downloading the app folder from Craft (which updated the install to the latest version fine) and I've also disabled all plugins but the issue persists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else come across this error and know how to solve it? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/03/09 17:29:36 [error] [exception.CException] exception    'CException' with message 'Property &quot;Craft\SessionRecord.token&quot; is not  defined.' in /path/to/craft/app/framework/base/CComponent.php:173&#xA;Stack trace:&#xA;#0 /path/to/craft/app/framework/db/ar/CActiveRecord.php(162): CComponent-&amp;gt;__set('token', 'ea2be7c4a632df0...')&#xA;#1 /path/to/craft/app/services/UserSessionService.php(728): CActiveRecord-&amp;gt;__set('token', 'ea2be7c4a632df0...')&#xA;#2 /path/to/craft/app/services/UserSessionService.php(626): Craft\UserSessionService-&amp;gt;storeSessionToken(Object(Craft\UserModel), 'ea2be7c4a632df0...')&#xA;#3 /path/to/craft/app/services/UserSessionService.php(549): Craft\UserSessionService-&amp;gt;loginByUserId('1', false, true)&#xA;#4 /path/to/craft/app/controllers/UsersController.php(66): Craft\UserSessionService-&amp;gt;login('impalondon', 'NewPassword', false)&#xA;#5 /path/to/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UsersController-&amp;gt;actionLogin()&#xA;#6 /path/to/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#7 /path/to/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#8 /path/to/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#9 /path/to/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('login')&#xA;#10 /path/to/craft/app/etc/web/WebApp.php(815): CWebApplication-&amp;gt;runController('users/login')&#xA;#11 /path/to/craft/app/etc/web/WebApp.php(285): Craft\WebApp-  &amp;gt;_processActionRequest()&#xA;#12 /path/to/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#13 /path/to/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#14 /path/to/index.php(14): require_once('/Users/alecrits...')&#xA;#15 {main}&#xA;REQUEST_URI=/index.php/admin/actions/users/login&#xA;HTTP_REFERER=http://impalondon.dev/admin/login&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/28kCL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/28kCL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="643" LastEditDate="2016-03-09T17:51:51.403" LastActivityDate="2016-03-09T17:51:51.403" Title="Property &quot;Craft\SessionRecord.token&quot; is not defined" Tags="&lt;admin&gt;&lt;error&gt;&lt;login&gt;&lt;session&gt;" AnswerCount="0" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="14065" PostTypeId="1" CreationDate="2016-03-09T11:33:17.773" Score="2" ViewCount="1056" Body="&lt;p&gt;I'm hoping this isn't too broad or long! I have two questions. I'm trying to streamline the organisation of my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly: Currently, for every section of my website (e.g. website.com/housing , website.com/skiing, website.com/guitar) i have created separate structures for each one, with an index page in it with content entries being children of that index. The index template loops through children and displays links to each page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Housing structure&#xA;  - index&#xA;    - entry&#xA;    - entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have seen some people saying they are putting all entries of the site in a single structure with hierarchy, e.g. one structure that has:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Single Structure&#xA;  - housing&#xA;    - entry&#xA;    - entry&#xA;    - entry&#xA;  - guitar&#xA;    - entry&#xA;    - entry&#xA;  - skiing&#xA;    - entry &#xA;    - entry etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this a good idea? Is there any drawkbacks to the way i've done it? or is it a case of 'whatever works best for you'. It does make my Entries area of the CMS full of lots of structures, but it is clear which to access to edit which pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question: template organisation. In light of my separate structure approach, my templates folder has a folder in it for each structure type with an _entry that routes to the correct template based on entry type e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates folder&#xA;  &amp;gt; housing&#xA;    - _entry.html&#xA;    - index.html&#xA;    - content-page.html&#xA;  &amp;gt; guitar&#xA;    - _entry.html&#xA;    - index.html&#xA;    - content-page.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_entry.html in each folder has something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;housing/&quot; ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The index page on nearly all my structures is exactly the same, and the content page is often pretty similar (although varies slightly), so it feels like i should really point each structure to a single folder to load templates (e.g._pages/), where i'd realistically have maybe 6 or 7 templates total, as opposed to 10+ folders in /templates/ (one for guitar, one for skiing etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've abstracted all of the repeated logic in each structure template folder to a macro file to make it easy to manage updates to templates but is a single folder a better approach? Would i be best off still keeping a separate folder for /news/ in the templates folder? Or is it again 'what works best for you'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to hear how others are doing things so i can improve my future craft builds.&lt;/p&gt;&#xA;" OwnerUserId="3941" LastActivityDate="2016-03-09T12:34:10.457" Title="Best way to organise sections and templates" Tags="&lt;best-practice&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14066" PostTypeId="2" ParentId="14065" CreationDate="2016-03-09T12:27:17.203" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;I would use &lt;strong&gt;separate&lt;/strong&gt; Structure for each content type, instead of having them all in a single structure.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Separate structures would allow cleaner 'relationships' between entries.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Your template structure looks good. (&lt;em&gt;could you explain how 'content-page.html' differs from '_entry.html'?&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In addition: I typically add a 'static' Section for each content type so that I can display some introduction text or imagery for a page which displays a collection of entries. e.g. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sections might be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Single = &quot;Housing Page&quot;&lt;/li&gt;&#xA;&lt;li&gt;Structure = &quot;Housing&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/housing/index.html&lt;/strong&gt; would display the content from the Single AND Titles+links to each Housing entry page at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/housing/_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-03-09T12:34:10.457" LastActivityDate="2016-03-09T12:34:10.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14068" PostTypeId="1" AcceptedAnswerId="14070" CreationDate="2016-03-09T13:09:39.750" Score="1" ViewCount="100" Body="&lt;p&gt;I'm trying to pull out user data in a template for specified user profiles whilst the current user is logged in. To do this I check on the userId being referenced and use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if userId != currentUser.id %}&#xA;    {% set userProfile = craft.users.id(userId).getContent() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a user object for that user. However when I try to reference any of the fields custom or otherwise for the userProfile it returns blank apart from on userProfile.id which returns the id of the required user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what am I missing? I was under the impression that getContent() would pull out all custom fields and these could simply be accessed by using the dot syntax? Or does this only work on currentUser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-03-09T16:27:09.037" Title="How to pull out all user data in a template?" Tags="&lt;templating&gt;&lt;users&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14069" PostTypeId="1" AcceptedAnswerId="14095" CreationDate="2016-03-09T14:19:55.020" Score="2" ViewCount="197" Body="&lt;p&gt;when a user with no permission to publish is submitting a blank entry, the entry is saved anyway without any errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the permissions set to the user group:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hHjeB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hHjeB.png&quot; alt=&quot;permissions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have few required field as showed below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wl3yq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wl3yq.png&quot; alt=&quot;new entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And very sadly, the entry is saved as draft, entitled &quot;New Entry&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BcD9H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BcD9H.png&quot; alt=&quot;entry is saved&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can't be a feature, is it?&lt;/p&gt;&#xA;" OwnerUserId="151" LastActivityDate="2016-03-10T17:45:29.293" Title="Entry validation not working when Publish live changes permission is not checked" Tags="&lt;validation&gt;&lt;user-groups&gt;&lt;permissions&gt;&lt;saveentry&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14070" PostTypeId="2" ParentId="14068" CreationDate="2016-03-09T16:27:09.037" Score="4" Body="&lt;p&gt;If i understand your question correct, you like to output the user data. I don't think that you need the getContent() function. But it's important, that you use the first() function. Here is your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userProfile = craft.users.id(userId).first() %}&#xA;{{ userProfile.yourFieldname }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope it works.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-03-09T16:27:09.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14071" PostTypeId="2" ParentId="14057" CreationDate="2016-03-09T17:25:50.373" Score="9" Body="&lt;p&gt;Craft works by taking requests that normally would 404—because they don't actually exist on the server but in the database. The piece that makes this happen is the rewrite rules. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's helpful to look at Craft's &lt;code&gt;.htaccess&lt;/code&gt; file line-by-line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The request must not already exist and the file is not already an existing directory on the server.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The URL must not be favicon.ico, apple-touch-icon.whatever.png. The &lt;code&gt;NC&lt;/code&gt; at the end means no-case (meaning case-insenstive).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the rule that actually fires. Take those would-be 404s, redirect to /index.php (the controller). &lt;code&gt;$1&lt;/code&gt; means the match found in &lt;code&gt;(.+)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;QSA&lt;/code&gt; flag means query string append. This is the part that's actually causing you issues. (You could remove it but get URLs with parameters called from controllers might not work in certain situations.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;L&lt;/code&gt; means last; if this rule is applied, it won't process anything else. Doesn't matter here unless you have other rules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is tell Apache to exclude this particular request from Craft's processing (put it after the favicon rule):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !^/(work/project-name)$ [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now what will happen is your Redirect 301 rule will fire by itself. Since &lt;code&gt;/case-studies&lt;/code&gt; doesn't actually exist on the server,  Apache is going to send that rule &lt;em&gt;back&lt;/em&gt; to Craft and fire like any normal &quot;page&quot; which is what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have other redirected 301s from the old &lt;code&gt;/work&lt;/code&gt; section, you might do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !^/(work/.+)$ [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will let Craft know not to touch any of your 301s in the old work section. You still need your old &lt;code&gt;Redirect 301&lt;/code&gt; rules.  (You could make a &lt;code&gt;RewriteRule&lt;/code&gt; for those if you wanted to simply things but this will get you going.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your completed file would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteCond %{REQUEST_URI} !^/(work/.+)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;Redirect 301 /work/project-name http://www.mysite.com/case-studies&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find some browsers will &quot;cache&quot;  an old page/redirect for awhile. To confirm it's actually working you might want to use &lt;code&gt;curl -I http://site/work/project-name&lt;/code&gt;. If you see &quot;moved permanently&quot; message, you're all set. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-03-09T19:08:35.607" LastActivityDate="2016-03-09T19:08:35.607" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14073" PostTypeId="1" AcceptedAnswerId="14087" CreationDate="2016-03-09T18:47:34.707" Score="0" ViewCount="1183" Body="&lt;p&gt;Have a JSON object that I'm trying to pass to my Javascript through a script tag in my markup like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/json&quot; id=&quot;json-data&quot;&amp;gt;&#xA;{&#xA;  &quot;terms&quot;: &quot;{{ entry.termsAgreement }}&quot;,&#xA;  &quot;sectionHeader&quot;: {{ entry.formSection }}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm getting an error that says: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;formSection is a Matrix field. How can I pass this along to have access to it in Javascript? I tried &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;JSON.stringify({{ entry.formSection }})&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2016-03-10T03:28:27.660" Title="How to pass an entry's Matrix fields as JSON?" Tags="&lt;matrix&gt;&lt;json&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14074" PostTypeId="1" CreationDate="2016-03-09T18:59:01.023" Score="3" ViewCount="363" Body="&lt;p&gt;For a Craft Commerce site, the store owners wish to be notified automatically when a stock is starting to get low. Can this be achieved with a plugin, and if so, how?&lt;/p&gt;&#xA;" OwnerUserId="2236" LastEditorUserId="9" LastEditDate="2016-03-09T19:01:42.000" LastActivityDate="2016-03-29T12:45:28.097" Title="How can I notify store owners when stock levels are getting low?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14075" PostTypeId="2" ParentId="14074" CreationDate="2016-03-09T19:35:12.040" Score="3" Body="&lt;p&gt;Just like Craft itself, Craft Commerce has lots of events you can have a plugin respond to. In this case, you'd want to write a plugin that waits for &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt; (&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow&quot;&gt;per documentation&lt;/a&gt;) that evaluates the stock levels and probably uses Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow&quot;&gt;Email Service&lt;/a&gt; to fire off notifications to the store owners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some quick pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class StockNotificationPlugin extends BasePlugin&#xA;{&#xA;    ...&#xA;&#xA;    function init()&#xA;    {&#xA;        craft()-&amp;gt;on('commerce_orders.onOrderComplete', function($event) &#xA;        {&#xA;            // loop through the items in the order ($order-&amp;gt;lineItems), &#xA;            // checking the remaining stock ($item-&amp;gt;purchasable-&amp;gt;stock)&#xA;            // against your desired threshold, firing off notifications&#xA;            // if applicable&#xA;        }&#xA;    }&#xA;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-03-09T19:49:19.343" LastActivityDate="2016-03-09T19:49:19.343" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14076" PostTypeId="1" CreationDate="2016-03-09T21:06:54.233" Score="1" ViewCount="132" Body="&lt;p&gt;Is there a way to set parameters from front-end user input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a page that displays a list of entries. On that page, I have a form select called &lt;code&gt;paidStatus&lt;/code&gt; with options &lt;code&gt;notReceived&lt;/code&gt;, &lt;code&gt;received&lt;/code&gt;, and &lt;code&gt;paid&lt;/code&gt;; and another form select called &lt;code&gt;order&lt;/code&gt; with options &lt;code&gt;asc&lt;/code&gt; and &lt;code&gt;desc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in my template code, I want to grab the list of entries:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionName').order('postDate post.order').find() if entry.paidStatus == post.paidStatus %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;code&gt;order&lt;/code&gt; and &lt;code&gt;entryStatus&lt;/code&gt; being populated from the submitted form selects. That way I can change the criteria used to generate the list of entries on the fly.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-03-10T01:28:26.800" Title="Set Parameters from User Input" Tags="&lt;entries&gt;&lt;form&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14077" PostTypeId="1" CreationDate="2016-03-09T21:07:54.100" Score="2" ViewCount="93" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter to group like entries together. I need to be able to control which group is output first. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="3326" LastEditorUserId="9" LastEditDate="2016-03-09T21:08:43.047" LastActivityDate="2016-03-10T00:27:26.930" Title="How can you choose which group to output first when using the group filter?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14078" PostTypeId="2" ParentId="13967" CreationDate="2016-03-09T21:14:11.917" Score="0" Body="&lt;p&gt;As there was no simple answer that didn't require another plugin or javascript I revised my entry form to collect the date manually. Which is a bit of a pain, as the input format for the date has to be mm/dd/yyyy, which isn't normal in the UK.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-03-09T21:14:11.917" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14079" PostTypeId="2" ParentId="14077" CreationDate="2016-03-09T21:21:40.560" Score="4" Body="&lt;p&gt;Rather than changing the order of the actual array returned by the &lt;code&gt;group&lt;/code&gt; filter, you can just assemble a new array that has the keys in the order you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the grouped entries #}&#xA;{% groups = entries|group('foo') %}&#xA;&#xA;{# Create an array of the group keys in the desired order #}&#xA;{% set keys = ['foo']|merge(groups|keys|without('foo')) %}&#xA;&#xA;{# Now loop through the keys, rather than the groups directly #}&#xA;{% for key in keys %}&#xA;&#xA;    {# Get the group with this key #}&#xA;    {% set group = groups[key] ?? [] %}&#xA;&#xA;    {# Loop through the entries #}&#xA;    {% for entry in group %}&#xA;        ...&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that the &lt;code&gt;??&lt;/code&gt; operator requires Craft 2.6.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="125" LastEditDate="2016-03-10T00:27:26.930" LastActivityDate="2016-03-10T00:27:26.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14080" PostTypeId="1" AcceptedAnswerId="14081" CreationDate="2016-03-09T21:29:03.263" Score="1" ViewCount="559" Body="&lt;p&gt;I have a date field (date) in my entry and I wish to get all entries of a specified year.  Can’t figure it out at all.  Here’s what I have now, to sort them by that field: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('evenements').order('date desc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &quot;year&quot; is passed to the page through routing and is named &quot;year&quot;.  I can get that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3524" LastEditorUserId="57" LastEditDate="2016-03-10T22:30:08.897" LastActivityDate="2016-03-10T22:30:08.897" Title="Displaying entires by year from a custom date field" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14081" PostTypeId="2" ParentId="14080" CreationDate="2016-03-09T21:50:22.337" Score="3" Body="&lt;p&gt;Looks like I finally found an answer to it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;year being my param&lt;/p&gt;&#xA;&#xA;&lt;p&gt;date being my custom date field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateParam = 'and, &amp;gt;= ' ~ year ~ '-01-01, &amp;lt; ' ~ (year + 1) ~ '-01-01' %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('evenements').order('date desc').date(dateParam) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2016-03-09T21:50:22.337" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14082" PostTypeId="1" CreationDate="2016-03-10T00:04:08.570" Score="7" ViewCount="922" Body="&lt;p&gt;Is it possible to load reverse related elements? I mean if the elements I’m querying are the target elements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m setting up a criteria model to get some categories and I also want to load the entries related to each category. I’m using a Categories field, so my categories are the target elements of those relations.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('news').all() %}&#xA;    {% set query = craft.entries.relatedTo({&#xA;        targetElement: category,&#xA;        field: 'myCategoriesField',&#xA;    }) %}&#xA;&#xA;    {# Oh no, a N+1 query problem... #}&#xA;    {% set entries = query.all() %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could probably do it the other way around, query for the entries and eager load the categories. Then use the &lt;code&gt;group&lt;/code&gt; filter to order everything by category. But that approach is awkward and has limitations, e.g. doesn’t play well with pagination.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-07-20T15:38:54.310" LastActivityDate="2018-07-21T12:23:51.603" Title="Eager loading of reverse related elements?" Tags="&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14083" PostTypeId="1" AcceptedAnswerId="14084" CreationDate="2016-03-10T00:36:48.183" Score="3" ViewCount="1898" Body="&lt;p&gt;I want to only show entries that match a specific tag. I'm trying to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blog').relatedTo('tagName').order('score') as entriesOnPage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to net any results though. Is &lt;code&gt;.relatedTo()&lt;/code&gt; not the way to go when limiting results to a specific tag?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2018-01-15T13:51:15.027" Title="Query Entries by Tag" Tags="&lt;templating&gt;&lt;entries&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14084" PostTypeId="2" ParentId="14083" CreationDate="2016-03-10T00:48:07.030" Score="5" Body="&lt;p&gt;You'd need to get the tag model first.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set tag = craft.tags.search('My Tag').first() %}&#xA;{% if tag %}&#xA;    {% set entries = craft.entries.relatedTo(tag) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replace &lt;code&gt;search&lt;/code&gt; with whatever other information you have from the tag, to get more precise results, e.g., &lt;code&gt;slug&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt; properties.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="5261" LastEditDate="2018-01-15T13:51:15.027" LastActivityDate="2018-01-15T13:51:15.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14085" PostTypeId="2" ParentId="14076" CreationDate="2016-03-10T01:08:28.667" Score="1" Body="&lt;p&gt;Yes, you can pass in a variable into the parameters and to get the query string values use &lt;code&gt;craft.request.getQuery()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can recommend this blog post by Jérôme Coupé for a great introduction to setting up the form and the criteria model filters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://webstoemp.com/blog/combined-searches-and-filters-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;Combined searches and filters using Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also have a look at other questions tagged with &quot;form&quot;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-03-10T01:28:26.800" LastActivityDate="2016-03-10T01:28:26.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14086" PostTypeId="2" ParentId="14069" CreationDate="2016-03-10T01:24:43.657" Score="3" Body="&lt;p&gt;That's the idea behind Drafts, to store entries not yet ready to publish, unfinished ones so to speak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it does make sense to not validate the fields. Good feature!&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-10T01:24:43.657" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14087" PostTypeId="2" ParentId="14073" CreationDate="2016-03-10T03:28:27.660" Score="1" Body="&lt;p&gt;I'd strongly recommend looking at the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; plugin for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're dead set against that, there are &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20/how-can-i-retrieve-channel-data-in-json-format&quot;&gt;other examples&lt;/a&gt; of how to pull out section data in Craft for rolling your own JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Matrix it'd be no different that if your were pulling Matrix data out to be output in HTML instead of JSON (looping through blocks, grabbing fields, etc). Lots of examples in the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow&quot;&gt;Matrix templating&lt;/a&gt; docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error you're getting is because when you simply output &lt;code&gt;entry.myMatrixHandle&lt;/code&gt;, you're technically given back an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; object and the Element API plugin tries to convert that to a string to display in the JSON data and it doesn't know how to convert that object to a string.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-10T03:28:27.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14088" PostTypeId="2" ParentId="14061" CreationDate="2016-03-10T03:51:50.633" Score="2" Body="&lt;p&gt;Certainly seems doable to me. And the complexity would depend on how comfortable you are with PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But roughly you'd follow the same format as the &lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor&quot; rel=&quot;nofollow&quot;&gt;Aviary Image Editor&lt;/a&gt; plugin for Craft where you have the user enter their imgix API key from their account and store that in the database. Then your plugin would be a wrapper for the &lt;a href=&quot;https://docs.imgix.com/apis/url&quot; rel=&quot;nofollow&quot;&gt;imgix API&lt;/a&gt; calling their web service methods whenever you need to interact with them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-10T03:51:50.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14089" PostTypeId="1" AcceptedAnswerId="14093" CreationDate="2016-03-10T09:04:03.530" Score="5" ViewCount="202" Body="&lt;p&gt;When I try to add another field, suddenly I get this error:&#xA;&quot;Variable &quot;assetSourceOptions&quot; does not exist&quot;&lt;a href=&quot;https://i.stack.imgur.com/OQQ8H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OQQ8H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This started after I updated to Craft 2.6&lt;/p&gt;&#xA;" OwnerUserId="874" LastEditorUserId="45" LastEditDate="2016-03-10T17:06:49.827" LastActivityDate="2016-03-10T17:10:24.810" Title="'Variable &quot;assetSourceOptions&quot; does not exist' after updating to Craft 2.6" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14091" PostTypeId="1" AcceptedAnswerId="14097" CreationDate="2016-03-10T10:01:59.543" Score="2" ViewCount="1612" Body="&lt;p&gt;I'm fiddling around with Twig and CraftCMS, trying to create a component-based structure... of sorts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All good so far, except this one thing I got stuck on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;Here's an excerpt from my main layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;    {% include 'components/header.twig' %}&#xA;&#xA;    {% block content %}&#xA;        woops...&#xA;    {% endblock %}&#xA;&#xA;    {% include 'components/footer.twig' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which currently works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I'd like to do something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;    {% include 'components/header.twig' %}&#xA;    {% include 'components/main-wrapper.twig' %}&#xA;    {% include 'components/footer.twig' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the main-wrapper.twig is like this, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;main class=&quot;main&quot;&amp;gt;&#xA;    {% block content %}&#xA;        woops... &#xA;    {% endblock %}&#xA;&amp;lt;/main&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it does not work. &quot;woops...&quot; from main-wrapper.twig is displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a different route without success as well: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;    {% include 'components/header.twig' %}&#xA;&#xA;    {% embed 'components/main-wrapper.twig' %}&#xA;        {% block children %}&#xA;            {# I want to have the block content here... #}&#xA;        {% endblock %}&#xA;    {% endembed %}&#xA;&#xA;    {% include 'components/footer.twig' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the main-wrapper.twig has a block named children instead... but no dice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does appear that what I'm trying to do is not possible, which is why I'm asking here as a last resort :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&#xA;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those interested, here's what I ended up with, stripped for clarity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# default.twig - default layout #}&#xA;&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;       ...&#xA;    &amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;        {% include 'components/header.twig' %}&#xA;        {% block wrappedContent %}{% endblock %}&#xA;        {% include 'components/footer.twig' %}&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# regular.twig - base page referred in the admin panel #}&#xA;&#xA;{% extends &quot;components/main.twig&quot; %}&#xA;&#xA;{% block content %}&#xA;    --- stuff for a page ---&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# main.twig - wrapper component! :D #}&#xA;&#xA;{% extends &quot;layouts/default.twig&quot; %}&#xA;&#xA;{% block wrappedContent %}&#xA;    &amp;lt;main class=&quot;main&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;main__wrapper&quot;&amp;gt;&#xA;            {% block content %}&#xA;                wooops...&#xA;            {% endblock %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/main&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3717" LastEditorUserId="3717" LastEditDate="2016-03-10T19:07:49.750" LastActivityDate="2016-03-10T19:07:49.750" Title="Send a block... into a block?" Tags="&lt;templating&gt;&lt;block-types&gt;&lt;blocks&gt;&lt;extends&gt;&lt;layout&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14092" PostTypeId="2" ParentId="14091" CreationDate="2016-03-10T10:44:03.340" Score="4" Body="&lt;p&gt;It seems to be what you need is Twigs &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;extend&lt;/a&gt; functionality. What you have here is a very common template structure so there is nothing out of the ordinary!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, going from your code I'd recommend your main layout template file looks something like this. The idea here being that these elements will not change for each page, but the content or information displayed inside them will. This template file is where you would also load in your CSS, Javascript etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;    {% include 'components/header' %}&#xA;&#xA;    &amp;lt;main class=&quot;main&quot;&amp;gt;&#xA;        {% block content %}{% endblock %}&#xA;    &amp;lt;/main&amp;gt;&#xA;&#xA;    {% include 'components/footer' %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Say you have a page that will sit on &lt;code&gt;www.yoursite.co.uk/about&lt;/code&gt;. You could create a template file in your templates folder called &lt;code&gt;about.twig&lt;/code&gt;, and to use your base template file it would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;path/to/main/layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;p&amp;gt;The content for your about page&amp;lt;/p&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that clears it up for you!&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-03-10T10:44:03.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14093" PostTypeId="2" ParentId="14089" CreationDate="2016-03-10T12:37:13.147" Score="4" Body="&lt;p&gt;It looks like the &lt;strong&gt;Redactor I&lt;/strong&gt; plugin was incompatible with Craft 2.6... Fortunately, Brandon fixed this last night!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/RedactorI&quot; rel=&quot;nofollow&quot;&gt;Update your version of Redactor I&lt;/a&gt;, and the problem should be fixed.&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="45" LastEditDate="2016-03-10T17:10:24.810" LastActivityDate="2016-03-10T17:10:24.810" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14094" PostTypeId="1" AcceptedAnswerId="14096" CreationDate="2016-03-10T13:05:37.217" Score="1" ViewCount="202" Body="&lt;p&gt;The host of a client is claiming the call to getAuthTimeout is triggering their firewall, and in turn blocks my client from accessing their site for a longer duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to disable or change the interval?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2020-05-29T01:24:28.560" Title="How can I disable/decrease the number of calls to getAuthTimeout?" Tags="&lt;users&gt;&lt;session&gt;&lt;timeout&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14095" PostTypeId="2" ParentId="14069" CreationDate="2016-03-10T15:09:54.153" Score="5" Body="&lt;p&gt;As carlcs said, this is already working as expected. Craft only enforces content validation rules for &lt;em&gt;enabled&lt;/em&gt; entries (not including drafts), and most people prefer that behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change that behavior, you can write a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot;&gt;plugin&lt;/a&gt; that provides its own entry validation logic, by latching onto the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot;&gt;entries.onBeforeSaveEntry&lt;/a&gt; event. Just put this in your plugin’s primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.beforeSaveEntry', function(Event, $event) {&#xA;        /** @var EntryModel $entry */&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // If the entry is disabled, the content won't be validated automatically&#xA;        if (!$entry-&amp;gt;enabled)&#xA;        {&#xA;            $validates = craft()-&amp;gt;content-&amp;gt;validateContent($entry);&#xA;&#xA;            if (!$validates)&#xA;            {&#xA;                // Add the content validation errors&#xA;                $entry-&amp;gt;addErrors($entry-&amp;gt;getContent()-&amp;gt;getErrors());&#xA;&#xA;                // Prevent the entry from getting saved&#xA;                $event-&amp;gt;performAction = false;&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-03-10T15:09:54.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14096" PostTypeId="2" ParentId="14094" CreationDate="2016-03-10T15:33:13.433" Score="4" Body="&lt;p&gt;Unfortunately, the AJAX call to &lt;code&gt;getAuthTimeout&lt;/code&gt; is &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L7057&quot; rel=&quot;nofollow&quot;&gt;hard coded&lt;/a&gt; to fire every 60 seconds. In other words, if you're looking for a &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;config value&lt;/a&gt;, there isn't one – might be worth a &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a quickfix/hack, you can create a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt; and add the following to its &lt;code&gt;init&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJs('(function () {&#xA;    Craft.AuthManager.checkInterval = 600; // Ten minutes&#xA;}());', true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can change the &lt;code&gt;600&lt;/code&gt; to any number of seconds, of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to kill the timeout check &lt;em&gt;completely&lt;/em&gt;, you can do this instead of the above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeJs('(function () {&#xA;    Craft.AuthManager.prototype.setCheckAuthTimeoutTimer = function () {};&#xA;}());', true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, both of these snippets are total hacks. Use with caution!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One important thing to note is that I don't think its possible to stop the &lt;em&gt;first&lt;/em&gt; AJAX call to &lt;code&gt;getAuthTimeout&lt;/code&gt; (which will fire after 60 seconds). The reason is that by the time the JavaScript hack inside the &lt;code&gt;includeJs&lt;/code&gt; handler has fired, the &lt;code&gt;Craft.AuthManager&lt;/code&gt; class has already been initialized and created the first timeout object. There's no reference to this timeout stored anywhere on the &lt;code&gt;Craft&lt;/code&gt; object (that I've been able to find, at least), which makes it impossible to clear it, unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-10T15:33:13.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14097" PostTypeId="2" ParentId="14091" CreationDate="2016-03-10T17:25:48.880" Score="3" Body="&lt;p&gt;Unfortunately, there's no way around having the &lt;code&gt;{% block %}&lt;/code&gt; tag &lt;em&gt;somewhere in the template that's being extended&lt;/em&gt;. In other words, your main layout template it's going to have &lt;code&gt;{% block %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you &lt;em&gt;can&lt;/em&gt; use the &lt;code&gt;{% embed %}&lt;/code&gt; tag to &quot;wrap&quot; a block in a third template (e.g. &quot;components/main-wrapper.html&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# base.html #}&#xA;&amp;lt;body&amp;gt;&#xA;    {% block main %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&#xA;{# components/main-wrapper.html #}&#xA;&amp;lt;main id=&quot;main-wrapper&quot; role=&quot;main&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        {% block content %}{% endblock %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/main&amp;gt;&#xA;&#xA;{# news/entry.html #}&#xA;{% extends 'base.html' %}&#xA;&#xA;{% block main %}&#xA;    {% embed 'components/main-wrapper' %}&#xA;        {% block content %}This is my awesome main content{% endblock %}&#xA;    {% endembed %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;    &amp;lt;main id=&quot;main-wrapper&quot; role=&quot;main&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;container&quot;&amp;gt;This is my awesome main content&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/main&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-10T17:25:48.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14098" PostTypeId="2" ParentId="14069" CreationDate="2016-03-10T17:45:29.293" Score="4" Body="&lt;p&gt;As other answers have touched on, the behaviour you're seeing is by design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written a plugin called &lt;a href=&quot;https://github.com/mmikkel/AlwaysValidate-Craft&quot; rel=&quot;nofollow&quot;&gt;Always Validate&lt;/a&gt; which will make Craft validate all disabled entries and categories – including entry drafts or entries saved by users not permitted to publish – which should solve your issue.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-10T17:45:29.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14100" PostTypeId="1" CreationDate="2016-03-11T00:04:38.350" Score="4" ViewCount="695" Body="&lt;p&gt;Is there a MSSQL support for Craft CMS?&#xA;Or any plugin that can help to connect to a MSSQL database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4878" LastActivityDate="2018-08-15T19:45:54.193" Title="MSSQL Support for Craft?" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14101" PostTypeId="2" ParentId="10538" CreationDate="2016-03-11T00:24:26.780" Score="2" Body="&lt;p&gt;This is a server-side configuration issue, not a Craft issue.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-03-11T00:24:26.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14102" PostTypeId="2" ParentId="14100" CreationDate="2016-03-11T00:28:07.813" Score="2" Body="&lt;p&gt;Craft 3 supports &lt;a href=&quot;https://docs.craftcms.com/v3/requirements.html#server-requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;MySQL 5.5+ and PostgreSQL 9.5+&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 only supports &lt;a href=&quot;https://docs.craftcms.com/v2/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MySQL 5.1+&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yii (the framework Craft runs on) uses &lt;a href=&quot;https://secure.php.net/manual/en/book.pdo.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PDO&lt;/a&gt; for its database abstraction layer, which supports &lt;a href=&quot;https://secure.php.net/manual/en/pdo.drivers.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;many databases&lt;/a&gt;, so technically it wouldn't be much work but it's more of a matter of the demand for it and &quot;are we ready to support other databases&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logically MSSQL would probably be next on the list, but there's not timeline/ETA for it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="819" LastEditDate="2018-08-15T19:45:54.193" LastActivityDate="2018-08-15T19:45:54.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14103" PostTypeId="2" ParentId="12870" CreationDate="2016-03-11T01:50:06.953" Score="3" Body="&lt;p&gt;I wrote the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt; -- AMP is really just a name for some best practices for web development that speed things up on mobile.  There isn't anything terribly special about it, I do most of what they list in their spec for websites already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;meta tags&quot; that they want you to add are just some JSON-LD, which you can easily add on your own, or via SEOmatic's &lt;code&gt;renderJSONLD&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for implementing AMP, you might find this helpful: &lt;a href=&quot;https://nystudio107.com/blog/google-amp-should-you-care&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google AMP: Should You Care?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2016-12-04T17:28:03.527" LastActivityDate="2016-12-04T17:28:03.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14104" PostTypeId="1" CreationDate="2016-03-11T08:59:36.403" Score="1" ViewCount="423" Body="&lt;p&gt;I need to display a sortable table of organization member records in frontend, preferably with pagination. Before I start coding this from scratch, I want to ask:&#xA;Does anyone have some ideas on how to do this, and what Craft/Yii/plugin functionality I could use to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to Craft, so at the moment I don't know where to start looking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some more details&lt;/strong&gt;&lt;br&gt;&#xA;I'm writing a frontend customer portal plugin, that uses the built in Craft functionality for handling user registration/login/etc. On top of that I've added a &lt;em&gt;MyPlugin_UserRecord&lt;/em&gt; and a &lt;em&gt;MyPlugin_OrganizationRecord&lt;/em&gt; record, with some service functionality to handle those.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;MyPlugin_UserRecord&lt;/em&gt; can be either a private user by it self, or belong to an organization as a member, and it's the latter that I want to display in the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you can see the relations I have defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UserRecord (Craft)&#xA;&#xA;MyPlugin_OrganizationRecord&#xA;    'craft_user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord', 'craft_user_id'),&#xA;    'members' =&amp;gt; array(static::HAS_MANY, 'MyPlugin_UserRecord', 'organization_id'),&#xA;&#xA;MyPlugin_UserRecord&#xA;    'craft_user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord', 'craft_user_id'),&#xA;    'organization' =&amp;gt; array(static::BELONGS_TO, 'MyPlugin_OrganizationRecord', 'organization_id'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4802" LastActivityDate="2016-03-11T22:47:34.490" Title="How to make a sortable table in frontend?" Tags="&lt;pagination&gt;&lt;frontend&gt;&lt;sorting&gt;&lt;table&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14105" PostTypeId="2" ParentId="4176" CreationDate="2016-03-11T10:27:23.650" Score="7" Body="&lt;p&gt;This feature has now made it into Craft core &lt;a href=&quot;https://craftcms.com/news/craft-cms-2-6-commerce-1-1&quot; rel=&quot;nofollow&quot;&gt;as of version 2.6&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this link for documentation on the subject:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastEditorUserId="5437" LastEditDate="2016-08-05T04:21:25.707" LastActivityDate="2016-08-05T04:21:25.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14106" PostTypeId="1" AcceptedAnswerId="14120" CreationDate="2016-03-11T14:45:55.493" Score="9" ViewCount="841" Body="&lt;p&gt;I'm looking for a way to offer &quot;3 for 2 / 2 for 1&quot; type options with Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been able to achieve this just by adding a default value to a coupon code input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works, kinda. If we need to stick with that then we'd be satisfied but where it fails is; say I have 6 items in the cart, I only get the offer on the first 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a small store with just a handful of items for sale so not a deal breaker but I can imagine other larger stores doing similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adjusters have been mentioned on Twitter but unsure how to follow that through.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-04-05T11:22:02.030" Title="3 for 2 etc with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;promotions&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14107" PostTypeId="1" AcceptedAnswerId="14337" CreationDate="2016-03-11T17:27:55.880" Score="3" ViewCount="364" Body="&lt;p&gt;I have a matrix field on my front-end form. Everything is working properly, data is saved correctly etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am testing &amp;amp; trying to break things and I noticed I wasn't repopulating those fields if validation failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I am attempting to repopulate the value(s) in my front-end form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myMatrixFieldHandle][new1][type]&quot; value=&quot;blockType&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myMatrixFieldHandle][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;...&#xA;value=&quot;{{ entry.myMatrixFieldHandle.blockType.fieldHandle }}&quot;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I dump the above, I am getting the whole object back. I'm not sure how to get to the actual field's value.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-03-27T23:47:48.550" LastActivityDate="2016-03-27T23:47:57.583" Title="How can I repopulate a matrix field on a front-end form?" Tags="&lt;matrix&gt;&lt;user-profile&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14108" PostTypeId="1" AcceptedAnswerId="14110" CreationDate="2016-03-11T21:09:45.367" Score="1" ViewCount="148" Body="&lt;p&gt;I have &lt;code&gt;getEntryTableAttributeHtml(EntryModel $entry, $attribute)&lt;/code&gt; setup in my plugin file.  I have attributes defined in &lt;code&gt;defineAdditionalEntryTableAttributes()&lt;/code&gt;.  However when the page loads &lt;code&gt;$attribute&lt;/code&gt; returns &lt;code&gt;field:85&lt;/code&gt; instead of one of the expected labels. Why might this occur?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-03-12T13:57:07.907" Title="Why would getEntryTableAttributeHtml(EntryModel $entry, $attribute) not return proper labels?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14109" PostTypeId="2" ParentId="14104" CreationDate="2016-03-11T22:47:34.490" Score="2" Body="&lt;p&gt;I can think of a couple ways to pull this off but Craft has many of the pieces already in place.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I'd create a new Channel, name it &lt;code&gt;Organizations&lt;/code&gt;. You can add whatever fields you want in there (like address, city, etc.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To leverage Craft's relations,  create a new field (&lt;code&gt;Organization&lt;/code&gt;) that relates back to the &lt;code&gt;Organization&lt;/code&gt; channel you just created and add it to the user's profile.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's the information architecture bit. It'd be up to you how you want to collect the information. Maybe when a user registers for their account for the first time, you'd ask for details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in a custom plugin, you'd probably want to validate to make sure the organization entry didn't already exist before creating a new entry in &lt;code&gt;Organizations&lt;/code&gt; channel. Then set the relationship of that newly created entry to the User.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The great thing about Craft is the UI is up to you. So you might use any number of &lt;a href=&quot;http://tympanus.net/codrops/2009/10/03/33-javascript-solutions-for-sorting-tables/&quot; rel=&quot;nofollow&quot;&gt;table sorting plugins&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft can even handle the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;Pagination&lt;/a&gt; for you. I think &lt;a href=&quot;https://www.datatables.net/examples/data_sources/server_side.html&quot; rel=&quot;nofollow&quot;&gt;DataTables&lt;/a&gt; does ajax pagination out of the box, so your Twig template could just need to feed it the data.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-03-11T22:47:34.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14110" PostTypeId="2" ParentId="14108" CreationDate="2016-03-12T13:37:01.313" Score="2" Body="&lt;p&gt;I did a little digging in the source, and here's what's going on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Craft builds an element index, it pulls all available element attributes from the &lt;a href=&quot;https://craftcms.com/classreference/services/ElementIndexesService&quot; rel=&quot;nofollow&quot;&gt;ElementIndexesService&lt;/a&gt;, where the method &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/ElementIndexesService.php#L250&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getAvailableTableAttributes&lt;/code&gt;&lt;/a&gt; adds all custom fields to the available attributes, with keys &lt;code&gt;'field:'.$field-&amp;gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ElementIndexesService class was &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/commits/master/app/services/ElementIndexesService.php&quot; rel=&quot;nofollow&quot;&gt;added in Craft 2.5.2750&lt;/a&gt;, when a lot of things changed related to element indexes (this is when the &lt;a href=&quot;https://pixelandtonic.com/blog/craft-2.5-beta&quot; rel=&quot;nofollow&quot;&gt;Customizable Element Indexes&lt;/a&gt; feature was added).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before 2.5, things worked differently – custom attributes weren't &quot;pre-fetched&quot; by Craft, but had to be added manually using the &lt;code&gt;modifyEntryTableAttributes&lt;/code&gt; hook, where the &lt;code&gt;$attribute&lt;/code&gt; variable passed to &lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt; would be a custom field handle, not the current &lt;code&gt;field:{fieldId}&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's unfortunate that &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow&quot;&gt;the official docs&lt;/a&gt; for &lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt; appear to not having been updated since Craft 2.4, as its current example code won't actually work (for custom fields) since 2.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, here's a workaround which should make things a little bit easier in customizing the HTML for custom field attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;&#xA;    // If custom field, get field handle&#xA;    if (strncmp($attribute, 'field:', 6) === 0)&#xA;    {&#xA;        $fieldId = substr($attribute, 6);&#xA;        $field = craft()-&amp;gt;fields-&amp;gt;getFieldById($fieldId);&#xA;        $attribute = $field-&amp;gt;handle;&#xA;    }&#xA;&#xA;    // Get html by attribute (field handle)&#xA;    switch ($attribute)&#xA;    {&#xA;        case 'customFieldHandle' :&#xA;            return '&amp;lt;span&amp;gt;'.$entry-&amp;gt;$attribute.'&amp;lt;/span&amp;gt;';&#xA;            break;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-03-12T13:57:07.907" LastActivityDate="2016-03-12T13:57:07.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14111" PostTypeId="2" ParentId="5058" CreationDate="2016-03-13T00:20:29.843" Score="4" Body="&lt;p&gt;Had the same problem. I my case, it was the following code in my nginx config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* (?:\.(?:bak|config|sql|fla|ini|log|sh|inc|swp|dist)|~)$ {&#xA;    deny all;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After removing &lt;strong&gt;log|&lt;/strong&gt; from the list, the problem was solved.&lt;/p&gt;&#xA;" OwnerUserId="982" LastActivityDate="2016-03-13T00:20:29.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14112" PostTypeId="1" CreationDate="2016-03-13T01:59:59.343" Score="2" ViewCount="992" Body="&lt;p&gt;I am trying to edit fields.  When I go to &lt;code&gt;Settings-&amp;gt;Fields&lt;/code&gt; and then click on a field, I get a message that reads:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Craft\Model and its behaviors do not have a method or closure named &quot;availableAssetSources&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I looked in the utility logs under server info, it reads:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level:  error&#xA;Category:   exception.Twig_Error_Runtime&#xA;Message:    exception 'CException' with message 'Craft\Model and its behaviors do not have a method or closure named &quot;availableAssetSources&quot;.' in /home/christen/6989-CLG-Web/craft/app/framework/base/CComponent.php:266&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am including the code written on line 266, in case it helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named &quot;{name}&quot;.',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What does all of this mean and how can I fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much!&lt;/p&gt;&#xA;" OwnerUserId="4884" LastEditorUserId="57" LastEditDate="2016-03-13T02:17:24.907" LastActivityDate="2016-03-13T02:21:12.743" Title="Internal Server Error" Tags="&lt;field&gt;&lt;error-message&gt;&lt;error&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14113" PostTypeId="2" ParentId="14112" CreationDate="2016-03-13T02:21:12.743" Score="2" Body="&lt;p&gt;You're running &lt;a href=&quot;https://craftcms.com/changelog#build2771&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6+&lt;/a&gt; and you've got an older version of the &lt;a href=&quot;https://github.com/pixelandtonic/RedactorI&quot; rel=&quot;nofollow&quot;&gt;Redactor I&lt;/a&gt; plugin installed that isn't Craft 2.6 compatible.  If you &lt;a href=&quot;https://github.com/pixelandtonic/RedactorI/archive/1.1.0.zip&quot; rel=&quot;nofollow&quot;&gt;download the latest&lt;/a&gt; version of the plugin and install it, the error will go away and Redactor I will work as usual.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-13T02:21:12.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14114" PostTypeId="1" AcceptedAnswerId="14116" CreationDate="2016-03-13T10:53:46.827" Score="3" ViewCount="667" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a list of accessories related to a main product. After adding the main product to the cart, the user can then add accessories related to that product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code seems to check out. The price and purchasableId for the related product are coming through just fine. However, when you click the &quot;Add to Cart&quot; button for the related product, the page refreshes but nothing is added to the cart. Relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.cart %}&#xA;{% for relatedProduct in product.relatedAccessories %}&#xA;&amp;lt;img src=&quot;{{ relatedProduct.accessoryImage.first().url(accessoryThumb) }}&quot; width=&quot;{{ asset.getWidth(accessoryThumb) }}&quot; height=&quot;{{ asset.getHeight(accessoryThumb) }}&quot; class=&quot;img-responsive&quot; /&amp;gt; &#xA;   &amp;lt;p&amp;gt;{{ relatedProduct.title }} - {{ relatedProduct.accessoryDescription }} - {% for variant in relatedProduct.variants %}{{ variant.salePrice|currency('CAD', true) }} - {{ variant.purchasableId }}{% endfor %}&amp;lt;/p&amp;gt; &#xA; &amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;    {% for variant in relatedProduct.variants %}&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ variant.purchasableId }}&quot;&amp;gt;{% endfor %}&#xA;    &amp;lt;input class=&quot;btn  btn-d  btn-lg&quot; type=&quot;submit&quot; value=&quot;Add to cart&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The source code for the rendered page looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;http://example.com/images_product/_125x100_crop_top-center_75/photo.jpg&quot; width=&quot;125&quot; height=&quot;100&quot; class=&quot;img-responsive&quot; /&amp;gt; &#xA;   &amp;lt;p&amp;gt;Accessory description - $50&amp;lt;/p&amp;gt; &#xA;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;65&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;btn  btn-d  btn-lg&quot; type=&quot;submit&quot; value=&quot;Add to cart&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I can see, this should be working. But again, nothing is added to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2016-03-14T12:15:52.670" Title="Adding items to cart from related entry not working" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14115" PostTypeId="1" AcceptedAnswerId="14130" CreationDate="2016-03-13T12:22:33.117" Score="2" ViewCount="805" Body="&lt;p&gt;I'm just getting started with Craft. My problem is that I'd like the user to be able to change the location of call to action buttons on the site. Instead of allowing them to enter any URL, it would be bit nicer to let them select the related entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use the &lt;code&gt;entries&lt;/code&gt; type, but it won't allow me to select channels. How should I proceed? Create a &lt;code&gt;single&lt;/code&gt; section that displays the channel entries so that I can link to it?&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-03-15T03:49:28.347" Title="Linking to channel page" Tags="&lt;sections&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14116" PostTypeId="2" ParentId="14114" CreationDate="2016-03-13T12:41:16.253" Score="2" Body="&lt;p&gt;Just quickly as I'm on my phone...The two main ways to debug this sort of thing in Commerce are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Check what you are actually POSTing matches what you think you are posting (to check this I just use the browser dev tools)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Check the flash data (notice and error) for messages when the page reloads (or check the JSON response if ajaxing). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Usually you'll get a sensible message back, e.g. out of stock or similar.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this code to dump the flash data (I think only error and notice are used these days, the &lt;code&gt;commerce&lt;/code&gt; flash dates back from before commerce was released but it can't hurt!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.devMode and (craft.session.hasFlash('commerce') or craft.session.hasFlash('notice') or craft.session.hasFlash('error')) %}&#xA;&#xA;        {% set isErrors = true %}&#xA;        {% set commerceFlash = craft.session.getFlash('commerce')|join('|') %}&#xA;        {% set noticeFlash = craft.session.getFlash('notice')|join('|') %}&#xA;        {% set errorFlash = craft.session.getFlash('error')|join('|') %}&#xA;&#xA;        Commerce: [{{  commerceFlash }}]&#xA;        Notice: [{{  noticeFlash }}]&#xA;        Error: [{{  errorFlash }}]&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-03-14T12:15:52.670" LastActivityDate="2016-03-14T12:15:52.670" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14117" PostTypeId="2" ParentId="14115" CreationDate="2016-03-13T15:41:56.480" Score="2" Body="&lt;p&gt;Any Section Type I.e. Single, Structure or Channel should be selectable via the Entries custom field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you had two Sevtions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Article&lt;/li&gt;&#xA;&lt;li&gt;Call to action&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you've already created the necessary Sections then create the Entries custom field. E.g &quot;Related CTA&quot; and use the Entries field-type. (As you described)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be presented with checkboxes allowing you to select all or only the necessary Sections. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've chosen the relevant Section and assigned the custom field to the &quot;Article&quot; Section / Content Type, you will see a list of CTA Entries when publishing an Article Entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The broad steps are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create the &lt;strong&gt;Sections&lt;/strong&gt; you need&lt;/li&gt;&#xA;&lt;li&gt;Create the &lt;strong&gt;custom Field&lt;/strong&gt;s you need&lt;/li&gt;&#xA;&lt;li&gt;Assign the &lt;strong&gt;Fields&lt;/strong&gt; to the relevant &lt;strong&gt;Content Types&lt;/strong&gt; within each &lt;strong&gt;Section&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-03-14T07:31:01.470" LastActivityDate="2016-03-14T07:31:01.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14118" PostTypeId="2" ParentId="14106" CreationDate="2016-03-13T15:46:44.043" Score="1" Body="&lt;p&gt;Best way to collate this sort of feedback or request is here, Steven: &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know where you add it, so we can back it too...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-13T15:46:44.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14119" PostTypeId="2" ParentId="13965" CreationDate="2016-03-13T17:46:32.427" Score="1" Body="&lt;p&gt;Paul, when I change the Locale setting to British English (en_gb) &lt;strong&gt;within the database&lt;/strong&gt;, the Post Date field's date-format changes to dd/mm/yyyy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DB: databaseName &gt; &lt;strong&gt;craft_locales&lt;/strong&gt; &gt; Change &quot;en&quot; to &quot;en_gb&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how you get on :)&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-13T17:46:32.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14120" PostTypeId="2" ParentId="14106" CreationDate="2016-03-14T01:41:36.573" Score="7" Body="&lt;p&gt;The documentation for adjusters is here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/adjusters&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/order-adjustment-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/order-adjustment-model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially your plugin creates a class that fulfils the interface at:&#xA;&lt;code&gt;plugins/commerce/Commerce/Adjusters/Commerce_AdjusterInterface.php&lt;/code&gt; - which is very simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;interface Commerce_AdjusterInterface&#xA;{&#xA;    /**&#xA;     * The adjust method modifies the order values (like baseShippingCost),&#xA;     * and records all adjustments by returning one or more orderAdjusterModels&#xA;     * to be saved on the order.&#xA;     *&#xA;     * @param Commerce_OrderModel $order&#xA;     * @param array $lineItems&#xA;     *&#xA;     * @return \Craft\Commerce_OrderAdjustmentModel[]&#xA;     */&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your plugin (in your main plugin .php file) then just registers your new adjuster to hook it up.  I'd suggest storing your actual adjuster classes in files in an &lt;code&gt;Adjusters&lt;/code&gt; folder, lime Commerce itself does.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//at the top, to include your class&#xA;require_once('Adjusters/BusinessLogic_TestAdjuster.php');&#xA;&#xA;...&#xA;&#xA;//this registers the adjuster with Commerce so it will be applied to carts&#xA;public function commerce_registerOrderAdjusters(){&#xA;  return [&#xA;    new \Commerce\Adjusters\BusinessLogic_TaxRemover&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The adjuster (as you can see) has access to the order and line items and you can basically use any code you like to implement your discount offer, e.g. checking if the qty of something is over 3, and then reducing the price.  It builds &amp;amp; returns &lt;code&gt;Commerce_OrderAdjustmentModel&lt;/code&gt;s which describe the adjustment(s) made by the adjuster.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a super simple example adjuster:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {&#xA;&#xA; public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;    $myAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;    $order-&amp;gt;baseDiscount = $order-&amp;gt;baseDiscount - 5;&#xA;&#xA;    $myAdjuster-&amp;gt;type = &quot;Test&quot;;&#xA;    $myAdjuster-&amp;gt;name = &quot;Test Adjuster&quot;;&#xA;    $myAdjuster-&amp;gt;description = &quot;Takes $5 off the order&quot;;&#xA;    $myAdjuster-&amp;gt;amount = -5.0;&#xA;    $myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;    //if your Adjuster affects lineItems rather than the total, you record the ids here&#xA;    $myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt;null];&#xA;    $myAdjuster-&amp;gt;included = false;&#xA;&#xA;    return [$myAdjuster];&#xA;&#xA;   }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My advice is to being it to generate plugin scaffolding using: &lt;a href=&quot;http://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pluginfactory.io/&lt;/a&gt; - to get you started - removes a lot of the pain points in getting started (such as the cursed capitilisation issues which I swear are the hardest part about getting started with plugins!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can take the scaffolding from &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-businesslogic&lt;/a&gt; - and put in there, which makes good sense as this pretty much the textbook definition of business logic.  Just clone that, add your adjuster class, and do the registration and away you go!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as you're comfortable with PHP implementing a discounter like you describe is really quite simple.  If you're not then it's a perfect way to get more comfortable and I'm sure folks will be happy to help along the way!&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-04-05T11:22:02.030" LastActivityDate="2017-04-05T11:22:02.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14121" PostTypeId="2" ParentId="10676" CreationDate="2016-03-14T05:49:51.233" Score="1" Body="&lt;p&gt;Instead of building a custom fieldtype, you could just connect two standard dropdown menus with some custom JavaScript. The easiest way to do that would probably be via the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, the control panel already uses jQuery, so you wouldn't need much JS to tie the two fields together.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-14T05:49:51.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14122" PostTypeId="1" AcceptedAnswerId="14535" CreationDate="2016-03-14T09:38:43.297" Score="0" ViewCount="115" Body="&lt;p&gt;I want to Number validation for my site, but not able to show custom validation message to user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       'CVV' =&amp;gt; [&#xA;            'label'    =&amp;gt;  'CVV Number',&#xA;            'type' =&amp;gt; 'numerical',              &#xA;            'numberPattern'=&amp;gt; '^[0-9]{3,3}$', &#xA;            'min'   =&amp;gt;  100, &#xA;            'minLength'   =&amp;gt;  3, &#xA;            'max'   =&amp;gt;  999,&#xA;            'maxLength'   =&amp;gt;  3,&#xA;            'required' =&amp;gt; true,&#xA;            'integerOnly'   =&amp;gt;  true,&#xA;            'tooSmall'  =&amp;gt;  'CVV Number is too small (minimum is 3 characters).',&#xA;            'message'  =&amp;gt;  'CVV Number is too small (minimum is 3 characters).',&#xA;            'tooShort'  =&amp;gt;  'CVV Number is too small (minimum is 3 characters).',&#xA;            'tooBig'  =&amp;gt;    'CVV Number is too long (maximum is 3 characters).',&#xA;            'tooLong'  =&amp;gt;    'CVV Number is too long (maximum is 3 characters).',                &#xA;        ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to set &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AttributeType::Number&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also. But it didn't work.&#xA;&lt;strong&gt;The issue:&lt;/strong&gt; &#xA;in the case of numbers like less than 3 characters, I am getting error message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CVV Number is too small (minimum is 100).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please Can anyone help me to get this expected message.&#xA;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="4494" LastActivityDate="2016-04-06T06:48:51.567" Title="Custom Validation Message for numeric" Tags="&lt;validation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14123" PostTypeId="1" AcceptedAnswerId="14125" CreationDate="2016-03-14T11:36:26.457" Score="2" ViewCount="798" Body="&lt;p&gt;I'd like to reopen &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5365/how-to-replicate-x-days-posted-ago&quot;&gt;this question&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer was a plugin called &lt;a href=&quot;https://github.com/pvledoux/blocks-nicetime&quot; rel=&quot;nofollow&quot;&gt;Nice Time&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But This plugin is depricated and the creator stats that this functionality is acheivable via the &lt;code&gt;date_modify&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes okay, but how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a event archive where I want to show &quot;This event happend &lt;code&gt;xy&lt;/code&gt; days ago&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/date.html&quot; rel=&quot;nofollow&quot;&gt;time_diff&lt;/a&gt; filter in twig. But it seems as if this is not activated in craft.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2016-03-14T12:03:43.300" LastActivityDate="2018-11-06T19:36:18.857" Title="date_modify relative time" Tags="&lt;datetime&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14124" PostTypeId="2" ParentId="14123" CreationDate="2016-03-14T12:45:56.083" Score="3" Body="&lt;p&gt;I have a plugin that adds the time_diff Twig filter to Craft:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mildlygeeky/craft-timediff&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mildlygeeky/craft-timediff&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is one possible issue (in either PHP or Craft) around DST, and I will add that to the README.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-03-14T12:45:56.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14125" PostTypeId="2" ParentId="14123" CreationDate="2016-03-14T13:16:58.510" Score="5" Body="&lt;p&gt;You could use the &lt;code&gt;diff&lt;/code&gt; method to get the number of days between two dates. So for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date(entry.dateCreated|date('c')).diff(now).days }} days ago&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my example between today (using &lt;code&gt;now&lt;/code&gt;) and the &lt;code&gt;entry.dateCreated&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a explanation as to why you need to wrap the first date in the &lt;code&gt;date&lt;/code&gt; filter &lt;a href=&quot;https://craftcms.stackexchange.com/a/9759/142&quot;&gt;here&lt;/a&gt;, which is where I got the answer from!&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-03-14T13:16:58.510" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14126" PostTypeId="1" AcceptedAnswerId="14246" CreationDate="2016-03-14T13:18:14.260" Score="0" ViewCount="85" Body="&lt;p&gt;I'm using a block matrix to display items of a to-do list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each item has a checkbox input. Number of items can vary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to use SproutForms to save the state of the checkbox. This would need to record the currentUser and the to-do list ID. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a form within the SproutForms plugin to include a checkbox and a  to-do list ID, but how can I associate the checkbox on the to-do list item with the checkbox on the SproutForm form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to use displayField to show the checkbox from the SproutForm, I'd have to make a checkbox for every to-do list item within the SproutForm plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense! Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="4883" LastActivityDate="2016-03-21T17:13:28.670" Title="How to store value of checkboxes without predefining them in the SproutForm plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14127" PostTypeId="1" AcceptedAnswerId="14129" CreationDate="2016-03-14T17:35:36.653" Score="1" ViewCount="155" Body="&lt;p&gt;The docs state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;format can be set to 'jpg', 'gif', 'png', or 'Auto'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;*Why is it 'Auto' not 'auto'?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/image-transforms#possible-values&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/image-transforms#possible-values&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a variable to define the transform settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set small = {&#xA;    mode:       'fit',&#xA;    width:      800,&#xA;    height:     600,&#xA;    quality:    80,&#xA;    position:   'center-center',&#xA;    format:     'Auto'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But Craft errors with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Imagine\Exception\InvalidArgumentException Saving image in &quot;auto&quot;&#xA;  format is not supported, please use one of the following extensions:&#xA;  &quot;gif&quot;, &quot;jpeg&quot;, &quot;png&quot;, &quot;wbmp&quot;, &quot;xbm&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or is my code incorrect?&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-03-14T21:25:30.097" Title="Image Transform in template 'Auto' errors" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14129" PostTypeId="2" ParentId="14127" CreationDate="2016-03-14T21:25:30.097" Score="3" Body="&lt;p&gt;This was an error in the docs. You get the automatic format assignment by default, no need to explicitly set &lt;code&gt;format: 'auto'&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-03-14T21:25:30.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14130" PostTypeId="2" ParentId="14115" CreationDate="2016-03-15T03:49:28.347" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Create a single section that displays the channel entries so that I can link to it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are you trying to select the actual Channel itself? (like the News / Blog).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Trevor Davis' handy &lt;a href=&quot;https://github.com/davist11/craft-listing-section&quot; rel=&quot;nofollow&quot;&gt;Listing Section fieldtype&lt;/a&gt; could work here. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want more control as to what is shown on that channle's &quot;index&quot; page (intro blurb, featured entries, etc), as you mentioned, just create a single that maps to the index page of the channel. Craft's routing is smart enough so when you go to &lt;code&gt;/blog/&lt;/code&gt; (for example) it'll route to the entry first.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-03-15T03:49:28.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14131" PostTypeId="1" CreationDate="2016-03-15T03:59:02.963" Score="1" ViewCount="143" Body="&lt;p&gt;When creating an editor interface within my plugin, I am using the following snippet to create a set of tabs inside a tab pane:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/tabs&quot; with {&#xA;   tabA: { label: 'Tab A'|t, url: '#tabA' },&#xA;   tabB: { label: 'Tab B'|t, url: '#tabB' },&#xA;} %}&#xA;&#xA;&amp;lt;div id=&quot;tabA&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div id=&quot;tabB&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, when I submit my editor form and there is an error in a form field that's part of tabB, I want to indicate this by highlighting the tab title in red. This is usually done by adding the class 'error' to the tab. So, using Twig, I could determine which tabs have errors right before defining the actual tabs and apply the class 'error' to the relevant tabs. I could also apply the 'error' class using JavaScript upon form initialization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering what the recommended way of doing this is or whether there is some built-in code to easily do this?&lt;/p&gt;&#xA;" OwnerUserId="4890" LastActivityDate="2016-03-16T07:58:26.860" Title="Setting tab 'error' class for tab with error" Tags="&lt;plugin-development&gt;&lt;error-templates&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14132" PostTypeId="2" ParentId="14131" CreationDate="2016-03-15T04:07:09.477" Score="1" Body="&lt;p&gt;I don't believe there is any 'built in code' you could use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have 2 options though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could either do this in twig by checking all fields in a tab and adding an error class to the tab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set actionClasses = &quot;&quot; %}&#xA;{% if (sale.getErrors('discountAmount') or sale.getErrors('discountType')) %}&#xA;    {% set actionClasses = &quot;error&quot; %}&#xA;{% endif %}&#xA;&#xA;{% set saleClasses = &quot;&quot; %}&#xA;{% if(sale.getErrors('name')) %}&#xA;    {% set saleClasses = &quot;error&quot; %}&#xA;{% endif %}&#xA;&#xA;{% set tabs = {&#xA;    0: {'label':'Sale'|t,'url':'#sale','class': saleClasses},&#xA;    1: {'label':'Conditions'|t,'url':'#conditions'},&#xA;    2: {'label':'Actions'|t,'url':'#actions','class': actionClasses}&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could pre build the 'tabs' variable in the controller and add the errors there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($variables['account']-&amp;gt;hasErrors())&#xA;{&#xA;    // Add the 'error' class to any tabs that have errors&#xA;    $errors = $variables['account']-&amp;gt;getErrors();&#xA;    $accountFields = array('username', 'firstName', 'lastName', 'email', 'password', 'newPassword', 'currentPassword', 'passwordResetRequired', 'preferredLocale');&#xA;&#xA;    foreach ($errors as $attribute =&amp;gt; $error)&#xA;    {&#xA;        if (isset($variables['tabs']['account']) &amp;amp;&amp;amp; in_array($attribute, $accountFields))&#xA;        {&#xA;            $variables['tabs']['account']['class'] = 'error';&#xA;        }&#xA;        else if (isset($variables['tabs']['profile']))&#xA;        {&#xA;            $variables['tabs']['profile']['class'] = 'error';&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-03-16T07:58:26.860" LastActivityDate="2016-03-16T07:58:26.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14133" PostTypeId="1" AcceptedAnswerId="14134" CreationDate="2016-03-15T08:22:51.577" Score="1" ViewCount="178" Body="&lt;p&gt;Is it possible be logged in with different users in frontend and backend, and if so, how do I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be very convenient being able to test logging in/out different users in frontend, without it affecting the logged in admin user in backend.&lt;/p&gt;&#xA;" OwnerUserId="4802" LastActivityDate="2016-04-19T09:08:28.600" Title="Log in as different users in backend front end at the same time?" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;frontend&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14134" PostTypeId="2" ParentId="14133" CreationDate="2016-03-15T08:36:06.080" Score="4" Body="&lt;p&gt;You can use &quot;incognito mode&quot; in your browser, or you use another browser or computer for this type of front end testing.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-04-19T09:08:28.600" LastActivityDate="2016-04-19T09:08:28.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14135" PostTypeId="1" AcceptedAnswerId="14153" CreationDate="2016-03-15T08:41:34.407" Score="3" ViewCount="627" Body="&lt;p&gt;Does Craft CMS support MySQL over SSL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4891" LastActivityDate="2016-09-30T22:53:57.627" Title="Does Craft CMS support MySQL over SSL?" Tags="&lt;mysql&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14136" PostTypeId="1" AcceptedAnswerId="14138" CreationDate="2016-03-15T10:07:24.427" Score="1" ViewCount="226" Body="&lt;p&gt;Revolution Slider is using Placeholders like this &lt;code&gt;{{param1}}&lt;/code&gt;.&#xA;This is conflicting with Twig's variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a workaround that Twig will ignore this for example?&lt;/p&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="57" LastEditDate="2016-03-15T17:01:19.080" LastActivityDate="2016-03-15T17:01:19.080" Title="Revolution Slider and Craft CMS conflict on placeholders" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14137" PostTypeId="2" ParentId="14136" CreationDate="2016-03-15T11:20:03.570" Score="0" Body="&lt;p&gt;Not that I know of. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your example and image, I would suggest just swapping them out as I agree they look like placeholders, anyway.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-15T11:20:03.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14138" PostTypeId="2" ParentId="14136" CreationDate="2016-03-15T11:23:32.173" Score="4" Body="&lt;p&gt;You can stop Craft from parsing curly brace tags in your template code by using the Twig Verbatim tag. Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% verbatim %}{{ this.wont.be.touched }}{% endverbatim %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use it to stop a single tag from being parsed, or encapulate an entire block of code on your page for multiple tags. Useful for languages like AngularJS that use the same double curly brace format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info at &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/verbatim.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/tags/verbatim.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4396" LastEditorUserId="45" LastEditDate="2016-03-15T16:16:43.257" LastActivityDate="2016-03-15T16:16:43.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14139" PostTypeId="1" AcceptedAnswerId="14154" CreationDate="2016-03-15T11:42:28.717" Score="3" ViewCount="579" Body="&lt;p&gt;I'm stuck on an issue where I have to paginate a list of entries that would be sorted by category title.&#xA;So basically, I need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;fetch entries in the 'project' section&lt;/li&gt;&#xA;&lt;li&gt;sort those entries by the 'projectYear' category title (2016-&gt;2002)&lt;/li&gt;&#xA;&lt;li&gt;paginate it (limit 5 for example)&lt;/li&gt;&#xA;&lt;li&gt;sort entries by title (a-&gt;z)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The output expected would look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Page 1&#xA;    2016&#xA;        Project A&#xA;        Project B&#xA;        Project C&#xA;    2015&#xA;        Project D&#xA;        Project E&#xA;Page 2&#xA;    2015&#xA;        Project F&#xA;        Project G&#xA;    2012&#xA;        Project H&#xA;    2010&#xA;        Project I&#xA;        Project J&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the moment, I have this &quot;working&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories({&#xA;    group: 'projectYear',&#xA;    title: 'not Unknown',&#xA;    order: 'title desc'&#xA;}) %}&#xA;&#xA;{% set allProjects = craft.entries({&#xA;    section: 'projects',&#xA;    relatedTo: categories,&#xA;    order: 'title asc'&#xA;}) %}&#xA;&#xA;{% for year, projectsInYear in allProjects | group('projectYear.first().title') %}&#xA;    {{ year }}&#xA;    {% for project in projectsInYear %}&#xA;        {{ project.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By &quot;working&quot; I mean that it outputs all project entries sorted by title &amp;amp; grouped by projectYear... but those projectYear groups are not sorted by title and it also lacks a pagination system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI: If I limit to 5 in craft.entries, it outputs the 5 first entries sorted by title and groups them by year after that. Instead, I want it entries to be first grouped by year and then get the 5 of those first entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anybody help me figure out how I can get the output I want or lead me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: we used postDate originally and it worked great, but we had to move from using postDate so it's not a possibility anymore.&lt;/p&gt;&#xA;" OwnerUserId="4689" LastActivityDate="2016-03-16T01:22:59.980" Title="Output entries sorted by category title and paginate" Tags="&lt;categories&gt;&lt;ordering&gt;&lt;group&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14140" PostTypeId="1" AcceptedAnswerId="14147" CreationDate="2016-03-15T12:36:08.323" Score="2" ViewCount="100" Body="&lt;p&gt;Some links in the menu should only be shown if the textfield is not empty. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('aboutus').textField|length == 0 %} style=&quot;display: none;&quot; {% endif %}.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But &lt;code&gt;craft.entries.section('aboutus').textField|length&lt;/code&gt; always returns &lt;code&gt;1&lt;/code&gt;. I also tried &lt;code&gt;is empty&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how I get the real length of this textfield? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have the same problem with a matrix. How can I check if the Matrix field has any blocks?&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T22:11:48.160" LastActivityDate="2017-05-09T22:11:48.160" Title="Check length of textfield in header file" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14141" PostTypeId="1" CreationDate="2016-03-15T12:55:25.993" Score="2" ViewCount="230" Body="&lt;p&gt;I am trying to eager load an asset field that contains 4 images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I originally set my entries the order was not affected as written below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.section('products') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then went and changed my &lt;code&gt;set&lt;/code&gt; to leverage eager loading and upon doing so the order of the images was pretty much randomized throughout the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries({&#xA;    section: 'products',&#xA;    with: [&#xA;        ['productImages', {&#xA;        withTransforms: ['small']&#xA;        }],&#xA;        'colorSelection']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then tried to add an order param next to &lt;code&gt;withTransforms&lt;/code&gt; which did not have any effect either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a known issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;li&#xA;        data-left=&quot;{{product.productImages[1].getUrl('small')}}&quot;&#xA;        data-center=&quot;{{product.productImages[0].getUrl('small')}}&quot;&#xA;        data-right=&quot;{{product.productImages[2].getUrl('small')}}&quot;&#xA;        class=&quot;product&quot;&#xA;    &amp;gt;&#xA;        &amp;lt;a href=&quot;{{product.url}}&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;product-image&quot; src=&quot;{{product.productImages[0].getUrl('small')}}&quot; alt=&quot;&quot;&amp;gt;&#xA;            &amp;lt;h4&amp;gt;{{gender}} - {{product.displayTitle}}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;span&amp;gt;{{product.price}}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is how we are templating out each entry. Both provide a different order of assets.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2016-03-16T13:45:36.390" LastActivityDate="2016-03-16T13:45:36.390" Title="Assets Order Effected by Eager Loading" Tags="&lt;entries&gt;&lt;assets&gt;&lt;order&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="0" ClosedDate="2016-04-05T18:40:11.023" ContentLicense="CC BY-SA 3.0" />
  <row Id="14142" PostTypeId="1" AcceptedAnswerId="14155" CreationDate="2016-03-15T15:41:02.897" Score="1" ViewCount="79" Body="&lt;p&gt;In backend Entries &gt; 'page-name' I could only see the left nav side bar, and the top &quot;header&quot; bar (breadcrumbs + page name + save button), when ever there was a Matrix field on the page.&lt;br&gt;&#xA;I noticed that the last line rendered (marked in blue) had a height of 0, so I started poking around in the CSS.&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SzSGO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SzSGO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After disabling a &lt;code&gt;display: none;&lt;/code&gt; (marked in green below) for the div immediately below the last div shown, I could see part of the page plus the error message shown in the screenshot below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7Homn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Homn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, it looks like some &quot;endless&quot; recursion error.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea on what might be going on here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any light you might shed on this!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/Monkey&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit: added the top screenshot to show what the page looked like before I changed the CSS.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4802" LastEditorUserId="4802" LastEditDate="2016-03-16T08:53:24.683" LastActivityDate="2016-03-16T08:53:24.683" Title="Matrix field breaks backend Entries &gt; 'page-name' page. &quot;Endless&quot; recursion error?" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2016-03-17T03:47:46.540" ContentLicense="CC BY-SA 3.0" />
  <row Id="14143" PostTypeId="1" AcceptedAnswerId="14144" CreationDate="2016-03-15T15:47:28.087" Score="2" ViewCount="145" Body="&lt;p&gt;Ok, so I'm looping through a lot of entries. It's a large request, and I had to up php memory limit to 512M. But I'm sure there is a less memory consuming way to do this. Also, I want to cache the whole thing, apparently 512M isn't enough for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? Should I just go ahead and use the ElementAPI?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var geojson = [&#xA;          {&#xA;            &quot;type&quot;: &quot;StationCollection&quot;,&#xA;            &quot;features&quot;: [&#xA;            {% for entry in craft.entries.section('map').limit(3000).find() %}&#xA;                {&#xA;                &quot;type&quot;: &quot;Feature&quot;,&#xA;                &quot;geometry&quot;: {&#xA;                  &quot;type&quot;: &quot;Point&quot;,&#xA;                  &quot;coordinates&quot;: [&#xA;                    {{entry.address.lng}},&#xA;                    {{entry.address.lat}}&#xA;                  ]&#xA;                },&#xA;                &quot;properties&quot;: {&#xA;                  &quot;title&quot;: &quot;{{entry.title}}&quot;,&#xA;                  &quot;slug&quot;: &quot;{{entry.slug}}&quot;,&#xA;                  &quot;alwaysOpen&quot;: &quot;{{entry.alwaysOpen}}&quot;,&#xA;                  &quot;phone&quot;: &quot;{{entry.phone}}&quot;,&#xA;                  &quot;saturdays&quot;: &quot;{{entry.saturdays}}&quot;,&#xA;                  &quot;stationType&quot;: &quot;{{entry.stationType}}&quot;,&#xA;                  &quot;sundays&quot;: &quot;{{entry.sundays}}&quot;,&#xA;                  &quot;workingDays&quot;: &quot;{{entry.workingDays}}&quot;,&#xA;&#xA;                }&#xA;              },&#xA;            {% endfor %}&#xA;        ]&#xA;      }&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="195" LastActivityDate="2016-03-15T16:10:09.960" Title="Looping out a lot of entries." Tags="&lt;cache&gt;&lt;forloop&gt;&lt;performance&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14144" PostTypeId="2" ParentId="14143" CreationDate="2016-03-15T16:10:09.960" Score="3" Body="&lt;p&gt;There isn't really a good way to extract large chunks of Craft entries using the core features in Twig. Every entry you fetch is a &lt;code&gt;EntryModel&lt;/code&gt; and those take up some memory due to relations and other stuff in Yii's ActiveRecord class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is to create your own custom Plugin that does the same thing but queries the database directly instead, by-passing Crafts &lt;code&gt;EntryModels&lt;/code&gt; and just giving you the dataset results directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some resources on getting started with Plugin development:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft official documentation: &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot;&gt;https://craftcms.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From StraightUpCraft: &lt;a href=&quot;https://straightupcraft.com/plugin-development&quot;&gt;https://straightupcraft.com/plugin-development&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A wrapper for creating a Plugin default setup: &lt;a href=&quot;http://pluginfactory.io/&quot;&gt;http://pluginfactory.io/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-03-15T16:10:09.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14145" PostTypeId="1" AcceptedAnswerId="14159" CreationDate="2016-03-15T16:35:31.843" Score="1" ViewCount="297" Body="&lt;p&gt;Hey guys I have created a plugin with an accompanying Stylesheet which I am adding to the page via &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SitemaphtmlPlugin extends BasePlugin&#xA;{&#xA;&#xA;function init(){&#xA;&#xA;     craft()-&amp;gt;templates-&amp;gt;includeCssResource('sitemaphtml/css/sitemaphtml.css');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however the link being generated is prefixing the path with cpresources/ making it 404.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/cpresources/sitemaphtml/css/sitemaphtml.css?x=xXhFyszUs &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how can i overcome this this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="4896" LastActivityDate="2016-03-16T17:53:57.907" Title="Plugin Stylesheet 404" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;css&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14146" PostTypeId="1" CreationDate="2016-03-15T16:52:18.703" Score="1" ViewCount="138" Body="&lt;p&gt;We recently added a large file (3gb) to our S3 location, and upon updating the assets index, the file is not being recognized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file is accessible and we have tested download directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, when we attempt to update the asset index, files that were previously indexed are now showing an error intermittently (Missing files: The following files could not be found. Should they be deleted from the index?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4895" LastActivityDate="2016-03-15T16:52:18.703" Title="Issue Updating Asset Index:S3 Product Downloads" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14147" PostTypeId="2" ParentId="14140" CreationDate="2016-03-15T16:55:45.660" Score="2" Body="&lt;p&gt;This should do it for a text field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('aboutus').textField(':empty:')|length&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To see if a Matrix field has any blocks, it's not as pretty.  There's probably a better way, but it's all I can think of at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;&#xA;{% set validEntries = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% if entry.matrixField|length %}&#xA;        {% set validEntries = valid|merge([entry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;validEntries&lt;/code&gt; is now an array of entries that have at least one block.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-03-16T00:27:49.750" LastActivityDate="2016-03-16T00:27:49.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14148" PostTypeId="2" ParentId="10" CreationDate="2016-03-15T17:31:50.963" Score="8" Body="&lt;p&gt;I found &lt;a href=&quot;https://dmlogic.com/blog/database-migrations-for-wordpress-expressionengine-and-craft&quot;&gt;a great blog post&lt;/a&gt; where the author uses &lt;a href=&quot;https://phinx.org/&quot;&gt;Phinx&lt;/a&gt; and MySQL Query Log to create database migrations. I summarized its content into 10 easy steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enable the MySQL Query Log on your dev environment by editing your mysql &lt;code&gt;my.cnf&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set the &lt;code&gt;general_log&lt;/code&gt; key to &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;general_log_file&lt;/code&gt; to &lt;code&gt;/var/log/mysql/mysql.log&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a snapshot of your current db: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysqldump -u dbuser -p dbname &amp;gt; dumpfile.sql&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Empty your query log file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;gt; /var/log/mysql/mysql.log&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extract only the relevant queries from the log: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cat mysql.log | grep -E '[[:space:]]+[[:digit:]]+[[:space:]]Query' | grep -ivE 'Query([[:space:]])+(/*.**/)?(start|select|set|show|commit|rollback|use)' &amp;gt; mymigration.sql&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The command translates as “Look in the log file, filter down to all lines starting with a query and then filter out any starting with an unwanted keyword. When you’ve got all that, save it to a file called mymigration.sql”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt; &lt;em&gt;only required once per project&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that you already have &lt;a href=&quot;https://getcomposer.org/&quot;&gt;Composer&lt;/a&gt; installed on your dev environment, run the following commands to install Phinx:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;composer require robmorgan/phinx&lt;/code&gt; then &lt;code&gt;composer install --no-dev&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a folder in your project directory called &lt;code&gt;migrations&lt;/code&gt; with adequate permissions (should be writable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a migration using phinx:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vendor/bin/phinx create FooBarFeatureMigration&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last argument is whatever you want to name the migration. A new class file should show up in your &lt;code&gt;migrations&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open the migration class file and change the &lt;code&gt;change()&lt;/code&gt; function to &lt;code&gt;up()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 8&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's time to manipulate the contents of &quot;mymigration.sql&quot; into useful PHP. Wrap every query with &lt;code&gt;$this-&amp;gt;query(&quot;&quot;);&lt;/code&gt; and put the whole lot inside the &lt;code&gt;up()&lt;/code&gt; function in the migration class file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 9&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rollback the database to how it was before the change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysql -u dbuser -p dbname &amp;lt; dumpfile.sql&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 10&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Run the migration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vendor/bin/phinx migrate&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go back to Craft CP, you should see your new field applied. You can now add and commit the migration to git as normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dmlogic.com/blog/database-migrations-for-wordpress-expressionengine-and-craft&quot;&gt;Check out the complete article here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this workflow with Git, Deploybot and a DigitalOcean droplet on a fairly large site (~10k entries). It works like a charm.&lt;/p&gt;&#xA;" OwnerUserId="903" LastEditorUserId="903" LastEditDate="2016-03-15T17:38:45.463" LastActivityDate="2016-03-15T17:38:45.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14149" PostTypeId="1" CreationDate="2016-03-15T18:51:41.160" Score="1" ViewCount="88" Body="&lt;p&gt;So basically what i have is a big set of categories (about 86 total, multi-level). Within my category fields i have a lightswitch with the handle 'private'. I would like to know how i would write a set/query to exclude any products/entries/users from appearing in a for loop if that item is in a category where the field 'private' is set to '1' meaning 'yes'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning if Product 'T-Shirt' is in category 'Awesome' and category 'Tubular' and category 'Ugly'. Assuming the category 'Ugly' has that field set to '1/yes'. When i run a for-loop for all products inside 'Awesome', how do i prevent 'T-Shirt' from appearing because it is ALSO inside of the category 'Ugly' which has the 'Private' set to yes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first instance of where i need this, my code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('productCategory').level(1) %}&#xA;            &amp;lt;li class='category{% if loop.index &amp;gt; 1 %} hidden{% endif %}' id='content-{{ loop.index }}'&amp;gt;&#xA;                &amp;lt;div class='description'&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ category.description }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;featured-products-container&quot;&amp;gt;&#xA;                    {% include '_components/featured_products' %}&#xA;                    &amp;lt;a href='{{ category.url }}' class='full-range'&amp;gt;See Full Range »&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then the _components/featured_products template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class='products'&amp;gt;&#xA;{% set products = craft.commerce.products.relatedTo(category).order('RAND()').limit(4) %}&#xA;{% for entry in products %}&#xA;    {% set image = entry.keyImage.first() %}&#xA;    {% set prodSize = { mode: 'crop', width: 200, height: 200, position: 'center-center' } %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ image.url(prodSize) }}&quot; alt=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;    &amp;lt;h3 class=&quot;product-title&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            {{ entry.title }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-03-15T18:51:41.160" Title="Exclude output of entries/users/products if category relation has particular field value" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14150" PostTypeId="2" ParentId="12925" CreationDate="2016-03-15T19:48:47.857" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot;&gt;Imager&lt;/a&gt; plugin is capable of resizing remote images&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-03-15T19:48:47.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14151" PostTypeId="1" AcceptedAnswerId="14152" CreationDate="2016-03-15T22:08:51.157" Score="1" ViewCount="332" Body="&lt;p&gt;I'm currently implementing a task-based application, which pulls some data from an external API before creating a number of entries based on the payload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After creating the entries, the app will need to download a fair amount of images, storing the files as Assets and adding them to an Assets fields on one of the entries (each entry has a set of ~30 related images on an external server, that needs to be pulled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm running 1 task per entry, with a sub task for downloading all of the images related to each entry (1 step per image, so ~30 steps per sub task). The images are quite large – around 5MB each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sub task takes an entry ID and an array of image URLs and metadata as its settings. Each step of the sub task looks like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The entry the image will be related to is pulled from the entry ID.&lt;/li&gt;&#xA;&lt;li&gt;The task attempts to pull any existing Asset for the image (criteria based on filename)&lt;/li&gt;&#xA;&lt;li&gt;If Asset not found, the remote image is downloaded using Guzzle to a temporary folder, before the Asset is created using &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Another criteria to pull the newly created Asset.&lt;/li&gt;&#xA;&lt;li&gt;Asset is updated with the metadata (which could've changed, regardless of whether the Asset was previously saved)&lt;/li&gt;&#xA;&lt;li&gt;The IDs for any Assets in the entries Asset field is pulled using &lt;code&gt;$entry-&amp;gt;assetField-&amp;gt;ids()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The new Asset's ID is added to the ID array, the asset field is updated with &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('assetField', $ids);&lt;/code&gt; and the entry is resaved through &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The temporary image file is deleted using the IOHelper class.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is running on a 2GB droplet, where PHP/Craft has access to the full 2GB RAM – which I assumed should be plenty, though the server is running out of memory, intermittently. At one point, MySQL even crashed and had to be restarted :/ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The memory issues never appear when Craft is running one of the regular, parent tasks – it always happens when one of the image sub tasks is running, which is why I'm debating my current setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Brad Bell's comment to &lt;a href=&quot;https://craftcms.stackexchange.com/a/10356/1098&quot;&gt;this answer&lt;/a&gt;, I know that 1 task = 1 request, even if that task has multiple steps and/or sub tasks. What I take from that is that having loads of sub tasks is potentially more dangerous in terms of memory usage and possible timeout issues, than having loads of smaller regular tasks. &lt;strong&gt;Is this a correct assumption?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In closing, &lt;em&gt;which of the following approaches would be the safest&lt;/em&gt;, in terms of memory usage (and/or other issues I might not have considered):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One regular task per image (~30 tasks)&lt;/li&gt;&#xA;&lt;li&gt;One regular task per image set (~30 steps)&lt;/li&gt;&#xA;&lt;li&gt;One sub task per image (~30 sub tasks)&lt;/li&gt;&#xA;&lt;li&gt;One sub task per image set (~30 steps, my current implementation)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I should mention that in this case, it doesn't really matter if the parent task completes before the image tasks run/complete, so I don't actually &lt;em&gt;need&lt;/em&gt; to use sub tasks for the downloads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7135/running-out-of-memory-in-my-task-based-plugin&quot;&gt;&lt;code&gt;devMode&lt;/code&gt; is currently &lt;code&gt;false&lt;/code&gt; on the server&lt;/a&gt; and I'm still having issues. &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-03-15T23:41:27.670" Title="Memory usage in sub tasks vs. regular tasks" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;performance&gt;&lt;tasks&gt;&lt;memory&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14152" PostTypeId="2" ParentId="14151" CreationDate="2016-03-15T23:41:27.670" Score="2" Body="&lt;p&gt;I think this is difficult to answer properly because it depends almost entirely on what the tasks and subtasks are actually doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the main task could do something that ate 400MB of memory and triggered 400 sub-tasks that did nothing but return null not using any memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, the main task could do nothing but trigger subtasks (using very little memory itself) but each subtask could use 400MB of memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously with subtasks you have to me more conscious of memory usage because usually there will be multiple subtasks and there is only ever one main task.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-15T23:41:27.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14153" PostTypeId="2" ParentId="14135" CreationDate="2016-03-16T00:48:08.897" Score="5" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of the next Craft 2.6 release (&lt;a href=&quot;https://craftcms.com/changelog#build2945&quot; rel=&quot;nofollow&quot;&gt;post 2.6.2945&lt;/a&gt;), Craft has exposed an &lt;code&gt;attributes&lt;/code&gt; database config setting that you can pass arbitrary &lt;a href=&quot;https://secure.php.net/manual/en/pdo.setattribute.php&quot; rel=&quot;nofollow&quot;&gt;PDO attribute&lt;/a&gt; &lt;code&gt;key =&amp;gt; value&lt;/code&gt; pairs into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assuming your MySQL box is setup &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.5/en/using-secure-connections.html&quot; rel=&quot;nofollow&quot;&gt;properly to use SSL&lt;/a&gt; and assuming the database user that Craft is using to connect to the box can connect over SSL, then you can do something like this to enable Craft to talk to MySQL over SSL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'attributes' =&amp;gt; array(&#xA;     PDO::MYSQL_ATTR_SSL_KEY    =&amp;gt; '/path/to/my/client-key.pem',&#xA;     PDO::MYSQL_ATTR_SSL_CERT   =&amp;gt; '/path/to/my/client-cert.pem',&#xA;     PDO::MYSQL_ATTR_SSL_CA     =&amp;gt; '/path/to/my/ca-cert.pem',&#xA; ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.x, this isn't currently possible.  Craft 3, however, will expose the necessary client side configs so that if your MySQL box has an SSL cert installed and supports SSL, then you can configure Craft to connect via SSL.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-09-30T22:53:57.627" LastActivityDate="2016-09-30T22:53:57.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14154" PostTypeId="2" ParentId="14139" CreationDate="2016-03-16T01:22:59.980" Score="4" Body="&lt;p&gt;Not exactly what you're looking for, but it gets you closer.  This should display the order you want, but it doesn't have any pagination (and honestly I'm not sure if that's possible using Craft's &lt;code&gt;{% paginate %}&lt;/code&gt; tag along with your other requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IMO, you're probably going to be better off doing this in PHP either using a &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;Template Hook&lt;/a&gt; or a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, here's the Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProjects = craft.entries({&#xA;    section: 'projects',&#xA;    order: 'title asc'&#xA;}) %}&#xA;&#xA;{% set categories = craft.categories({&#xA;    relatedTo: allProjects,&#xA;    title: 'not Unknown',&#xA;    order: 'title desc'&#xA;}) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for category in categories %}&#xA;        &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;&#xA;        {% set relatedEntries = craft.entries.relatedTo(category).order('title asc') %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in relatedEntries %}&#xA;                &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-16T01:22:59.980" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14155" PostTypeId="2" ParentId="14142" CreationDate="2016-03-16T07:32:26.823" Score="0" Body="&lt;p&gt;Brad was right, it was xDebug that was the culprit. So here's what I did:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the Linux terminal I ran:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo gedit /etc/php5/mods-available/xdebug.ini&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the xdebug.ini file I added the line below and saved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level=256&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the Linux terminal I ran:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo service apache2 restart&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;Note: if the this does not fix it, try changing the command in step 1 to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo gedit /etc/php5/conf.d/xdebug.ini&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or just edit your &lt;em&gt;php.ini&lt;/em&gt; file where ever it may be located.&lt;/p&gt;&#xA;" OwnerUserId="4802" LastEditorUserId="4802" LastEditDate="2016-03-16T08:24:54.667" LastActivityDate="2016-03-16T08:24:54.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14156" PostTypeId="1" AcceptedAnswerId="14191" CreationDate="2016-03-16T10:31:24.260" Score="0" ViewCount="295" Body="&lt;p&gt;A tricky one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a form which sits on a section entry template. When user submits form from one page of the template, it saves the entries into the table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT user going to another page of the template (where user can see same form), the table doesn't keep the previously stored instruction ID rows. See first column, only saving from most recent form submit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately I'm just trying to store the checkbox value (1 inside each matrix block). In table, if block.id exists (in 'instruction' column), then overwrite checkbox value, otherwise add new row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N4Xi6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N4Xi6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How the tutorial template is set up:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;template for tutorial &lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;form which wraps around the matrix blocks&lt;/p&gt;&#xA;    &#xA;    &lt;blockquote&gt;&#xA;      &lt;p&gt;matrix block contains form input checkbox &lt;/p&gt;&#xA;      &#xA;      &lt;blockquote&gt;&#xA;        &lt;p&gt;submit sends form data to entry of user in another Section (see below)&lt;/p&gt;&#xA;      &lt;/blockquote&gt;&#xA;    &lt;/blockquote&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The makeshift &quot;database&quot; Section to store values:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Section &lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;Entry per user&lt;/p&gt;&#xA;    &#xA;    &lt;blockquote&gt;&#xA;      &lt;p&gt;Inside Entry I have a table (multiple per tutorial parent)&lt;/p&gt;&#xA;      &#xA;      &lt;blockquote&gt;&#xA;        &lt;p&gt;&quot;instruction&quot; column holds the block.id and &quot;done&quot; holds value of checkbox.&lt;/p&gt;&#xA;      &lt;/blockquote&gt;&#xA;    &lt;/blockquote&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I1FD2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I1FD2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the crazy if/for logic around the checkbox input, I had to do this to get it to work, where if a table had rows, it wasn't showing checkboxes on other tutorials, etc, etc. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set progressBob = craft.entries.section('userProgress').authorId(currentUser.id).find() %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;6&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;      {% macro errorList(errors) %}&#xA;          {% if errors %}&#xA;              &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                  {% for error in errors %}&#xA;                      &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                  {% endfor %}&#xA;              &amp;lt;/ul&amp;gt;&#xA;          {% endif %}&#xA;      {% endmacro %}&#xA;&#xA;      {% from _self import errorList %}&#xA;&#xA;      {% for entry in progressBob %}&#xA;        {% set tableentry = entry %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ tableentry.id }}&quot;&amp;gt;&#xA;      {% endfor %}&#xA;&#xA;      {% for block in entry.tutorialMatrix %}&#xA;        {% if block.type == &quot;instruction&quot; %}&#xA;&#xA;            {% set tableProgress = product.slug|trim('kit') ~ 'Progress' %}&#xA;&#xA;            &amp;lt;input type=&quot;hidden&quot; id=&quot;instruction{{ block.id }}&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col1]&quot; value=&quot;{{ block.id }}&quot; /&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;instruction m-b-3 m-l-3&quot;&amp;gt;&#xA;              &amp;lt;label class=&quot;checkbox&quot;&amp;gt;&#xA;&#xA;              {% if progressBob %} &#xA;&#xA;                {% for entry in progressBob %}&#xA;                  {% set tableentry = entry %}&#xA;                  {% if tableentry[tableProgress] %}&#xA;&#xA;                      {% for row in tableentry[tableProgress] %} &#xA;&#xA;                          {% if row.instruction == block.id %}&#xA;                            &amp;lt;input type=&quot;hidden&quot; id=&quot;done{{ block.id }}&quot; value=&quot;&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;                            &amp;lt;input type=&quot;checkbox&quot; id=&quot;done{{ block.id }}&quot; value=&quot;1&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; {% if row.done %} checked=&quot;checked&quot;{% endif %} class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;                          {% endif %}&#xA;&#xA;                      {% endfor %}&#xA;&#xA;                  {% else %}&#xA;                    &amp;lt;input type=&quot;hidden&quot; id=&quot;done{{ block.id }}&quot; value=&quot;&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;                    &amp;lt;input type=&quot;checkbox&quot; id=&quot;done{{ block.id }}&quot; value=&quot;1&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; {% if row.done %} checked=&quot;checked&quot;{% endif %} class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;                  {% endif %}&#xA;                {% endfor %}&#xA;&#xA;              {% else %} &#xA;                &amp;lt;input type=&quot;hidden&quot; id=&quot;done{{ block.id }}&quot; value=&quot;&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; id=&quot;done{{ block.id }}&quot; value=&quot;1&quot; name=&quot;fields[{{ tableProgress }}][{{ block.id }}][col2]&quot; {% if row.done %} checked=&quot;checked&quot;{% endif %} class=&quot;option-input checkbox&quot; /&amp;gt;&#xA;              {% endif %}&#xA;&#xA;              &amp;lt;span class=&quot;instructionLabel&quot;&amp;gt;{{ block.text }}&amp;lt;/span&amp;gt;&#xA;              &amp;lt;pre class=&quot;prettyprint linenums&quot;&amp;gt;{{ block.code }}&amp;lt;/pre&amp;gt;&#xA;              {% set image = block.image.first() %}&#xA;              {% if image %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; class=&quot;content-image&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;              {% endif %}&#xA;              &amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;  &#xA;&#xA;        {% endif %}&#xA;      {% endfor %}&#xA;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot; class=&quot;btn btn-primary&quot;&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated&lt;/p&gt;&#xA;" OwnerUserId="4883" LastEditorUserId="4883" LastEditDate="2016-03-17T23:30:31.407" LastActivityDate="2016-03-17T23:51:29.240" Title="&lt;form&gt;&lt;matrixBlock&gt;&lt;checkbox&gt;&lt;/matrixBlock&gt;&lt;/form&gt; How do I store multiple form entries in 1 table field?" Tags="&lt;matrix&gt;&lt;form&gt;&lt;table-field&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14157" PostTypeId="1" CreationDate="2016-03-16T11:22:04.183" Score="2" ViewCount="167" Body="&lt;p&gt;Getting field values, properly prepped, is covered here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-03-16T11:22:04.183" Title="How to get all (prepped) field values from an entry, indexed by field handle" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;entries-field&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14158" PostTypeId="2" ParentId="14157" CreationDate="2016-03-16T11:22:04.183" Score="2" Body="&lt;p&gt;I kept thinking this was in the Craft core.&#xA;Wasn't, so I made my own: &lt;a href=&quot;https://gist.github.com/timkelty/933efd23264d79d91b7a&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/timkelty/933efd23264d79d91b7a&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has come in useful in plugin dev and some templating.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-03-16T11:22:04.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14159" PostTypeId="2" ParentId="14145" CreationDate="2016-03-16T11:39:36.837" Score="2" Body="&lt;p&gt;Is your css file located in the &lt;code&gt;/resources/&lt;/code&gt; folder of your plugin? So your path should be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;plugin folder&amp;gt;/resources/css/sitemaphtml.css&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried it myself and whilst you do get the &lt;code&gt;/cpresources/&lt;/code&gt; part of the Url in your markup, the CSS file is loaded on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: If you take a look in the &lt;a href=&quot;https://craftcms.com/docs/plugins/resources&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;, it says the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;By default, Craft will search for the resource file in its own&#xA;  craft/app/resources/ folder. If it can’t find the file there, it will&#xA;  check if the first segment of the resource path is set to a plugin&#xA;  handle. If it is, Craft will look for the resource file within that&#xA;  plugin’s resources/ folder.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-03-16T17:53:57.907" LastActivityDate="2016-03-16T17:53:57.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14160" PostTypeId="1" AcceptedAnswerId="14161" CreationDate="2016-03-16T12:40:45.790" Score="1" ViewCount="85" Body="&lt;p&gt;Is it possible to change the default settings of the Rich text field? I know that I can change the configuration in &lt;code&gt;Simple.json&lt;/code&gt; and &lt;code&gt;Standard.json&lt;/code&gt; but I can't find a &lt;code&gt;Default.json&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T22:09:27.587" LastActivityDate="2017-05-09T22:09:27.587" Title="Richt text change default configuration" Tags="&lt;control-panel&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14161" PostTypeId="2" ParentId="14160" CreationDate="2016-03-16T12:58:10.413" Score="2" Body="&lt;p&gt;No, &quot;Default&quot; is Craft's default configuration and is not user configurable.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-16T12:58:10.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14162" PostTypeId="1" AcceptedAnswerId="14169" CreationDate="2016-03-16T14:43:35.837" Score="1" ViewCount="345" Body="&lt;p&gt;I'm trying to adjust the order of the options in the formatting dropdown menu in the Redactor ii fieldtype but it's not picking up my changes. I have made other changes in this config that have been picked up and working, just not this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See below for my Standard.json config file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['format','bold','italic','lists','link','file','image','video'],&#xA;    plugins: ['fullscreen','video','table','source'],&#xA;    formatting: ['h3', 'p', 'blockquote', 'pre', 'h1', 'h2', 'h4', 'h5'],&#xA;    toolbarFixed: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-03-16T19:00:40.150" Title="Adjust the config to change the order of the formatting menu in Redactor II" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14163" PostTypeId="1" CreationDate="2016-03-16T15:44:43.807" Score="2" ViewCount="451" Body="&lt;p&gt;When I add a new user in the admin area, they get a link to activate their account. On the screen that link goes to, they are prompted to set a password. After the password is submitted, they are returned to &lt;code&gt;/dashboard&lt;/code&gt;. How do I alter that return? I have the following config variables set &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'useEmailAsUsername' =&amp;gt; true,&#xA;'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;'activateAccountSuccessPath' =&amp;gt; 'members/index',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3732" LastEditorUserId="57" LastEditDate="2016-03-16T17:34:07.007" LastActivityDate="2016-03-16T17:40:14.297" Title="Set return URL after password is set" Tags="&lt;users&gt;&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14164" PostTypeId="1" AcceptedAnswerId="14239" CreationDate="2016-03-16T17:17:21.090" Score="0" ViewCount="138" Body="&lt;p&gt;I have followed the instructions for removing index.php and it works on all pages with the exception of pages with channels. So I would see &lt;a href=&quot;http://www.example.com/index.php?p=news/2016/news-title&quot; rel=&quot;nofollow&quot;&gt;http://www.example.com/index.php?p=news/2016/news-title&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also added the &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&lt;/code&gt;, in the &lt;code&gt;general.php&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have in my &lt;code&gt;.htaccess&lt;/code&gt; file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA;    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript image/svg+xml&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_headers.c&amp;gt;&#xA;    &amp;lt;FilesMatch &quot;\.(eot|otf|tt[cf]|woff2?)$&quot;&amp;gt;&#xA;        Header set Access-Control-Allow-Origin &quot;*&quot;&#xA;    &amp;lt;/FilesMatch&amp;gt;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;Options +FollowSymLinks&#xA;RewriteEngine on&#xA;RewriteCond %{HTTP_HOST} ^example.com [NC]&#xA;RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4660" LastEditorUserId="22" LastEditDate="2017-05-09T22:08:37.500" LastActivityDate="2017-05-09T22:08:37.500" Title="index.php in url for just channel pages" Tags="&lt;url&gt;&lt;config&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14165" PostTypeId="1" AcceptedAnswerId="14168" CreationDate="2016-03-16T17:24:34.643" Score="6" ViewCount="120" Body="&lt;p&gt;I'm finding that occasionally (especially on larger sites), there are little bits of functionality that I need that Craft doesn't offer out of the box. The functionality is usually simple and relatively specific, so I find myself quickly writing little plugins that do the job. Currently I've been creating separate plugins for each bit of functionality I need which can result in some sites having upwards of 5 or 6 small plugins, along with any other plugins that I might be using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This led me to wonder, when it comes to keeping our Craft installs running as cleanly and efficiently as possible, which is better:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. Having one large plugin that does multiple different, likely unrelated, things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. Having multiple smaller plugins, each doing their own thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a development standpoint I find that having separate plugins makes life easier because everything is more organised, but is this having an impact on Crafts performance?&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2016-03-16T18:18:32.697" Title="One large plugin vs multiple smaller plugins" Tags="&lt;plugins&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14166" PostTypeId="2" ParentId="14163" CreationDate="2016-03-16T17:37:34.663" Score="0" Body="&lt;p&gt;The currently logic around that is &quot;if the account has Access the CP permissions, send them to the control panel login page, otherwise, send them to wherever the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; config setting is set to&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you've got &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; set, the CP login page redirects to the CP dashboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not the behavior you're looking for, you can create a plugin that mimics the necessary &lt;code&gt;craft/app/controllers/UsersControllers&lt;/code&gt; methods changing the logic for your requirements as necessary.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-16T17:37:34.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14167" PostTypeId="2" ParentId="14163" CreationDate="2016-03-16T17:40:14.297" Score="3" Body="&lt;p&gt;Solved this by&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;creating the &lt;a href=&quot;https://craftcms.com/docs/templating/set-password-form&quot; rel=&quot;nofollow&quot;&gt;Set Password form&lt;/a&gt; in a template with the correct&#xA;return&lt;/li&gt;&#xA;&lt;li&gt;setting it's path with &lt;a href=&quot;https://craftcms.com/docs/config-settings#setPasswordPath&quot; rel=&quot;nofollow&quot;&gt;setPasswordPath&lt;/a&gt;  &lt;/li&gt;&#xA;&lt;li&gt;setting a path for    &lt;a href=&quot;https://craftcms.com/docs/config-settings#setPasswordSuccessPath&quot; rel=&quot;nofollow&quot;&gt;setPasswordSuccessPath&lt;/a&gt; to catch &lt;em&gt;forgot password&lt;/em&gt;&#xA;resets&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3732" LastActivityDate="2016-03-16T17:40:14.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14168" PostTypeId="2" ParentId="14165" CreationDate="2016-03-16T18:18:32.697" Score="4" Body="&lt;p&gt;I don't believe there's any significant impact in having multiple small plugins vs. one big plugin. It's probably safe to say that there is a &lt;em&gt;small&lt;/em&gt; amount of overhead in loading each plugin separately, but that effect is probably negligible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I'd keep all of that functionality combined into a single plugin. You say they are for &quot;different, likely unrelated, things&quot;, but I'm guessing that they all serve a larger purpose of handling the &lt;strong&gt;business logic&lt;/strong&gt;. If you haven't already, you may want to check out the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;Business Logic template&lt;/a&gt;, which is designed as a starter plugin for exactly this type of scenario.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-16T18:18:32.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14169" PostTypeId="2" ParentId="14162" CreationDate="2016-03-16T18:21:21.837" Score="3" Body="&lt;p&gt;Looks like the Redactor &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formatting&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;formatting&lt;/code&gt;&lt;/a&gt; config setting only affects what shows up or not from Redactor's default's of &lt;code&gt;['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't say whether that's a bug or intended behavior, but you could probably set the defaults to empty &lt;code&gt;[]&lt;/code&gt;, then add them back in the order you want with &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;formattingAdd&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="125" LastEditDate="2016-03-16T19:00:40.150" LastActivityDate="2016-03-16T19:00:40.150" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14170" PostTypeId="2" ParentId="14162" CreationDate="2016-03-16T18:32:39.137" Score="0" Body="&lt;p&gt;Here's what I get with a redactor JSON config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DXFxk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DXFxk.png&quot; alt=&quot;Redactor config examples&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2016-03-16T18:32:39.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14172" PostTypeId="1" CreationDate="2016-03-16T18:42:41.267" Score="2" ViewCount="200" Body="&lt;p&gt;We have 2 computers with a new Craft Pro trial installation. The files are exactly the same on both computers. We both use the same DB with the same &lt;code&gt;db.php&lt;/code&gt; config settings.  We can both see the site and login to the &lt;code&gt;/admin&lt;/code&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only issue is that on 1 computer I can not create a Matrix field or install a plugin. Then I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE=' at line 8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The other computer has no problem creating a Matrix field or installing a plugin. Any suggestions? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4901" LastEditorUserId="57" LastEditDate="2016-03-16T19:47:05.103" LastActivityDate="2016-11-17T10:34:29.730" Title="Error when creating a Matrix or installing a Plugin" Tags="&lt;database&gt;&lt;craft-pro&gt;&lt;mysql&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14175" PostTypeId="1" AcceptedAnswerId="14178" CreationDate="2016-03-17T01:56:49.150" Score="2" ViewCount="962" Body="&lt;p&gt;Let me apologize right now that my inexperience with Craft is likely the issue here and that my question might be more general to Craft's routing features and not so specific to Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm playing with a clean Craft/Craft Commerce installation and using the included templates in /templates/commerce. I wanted to customize the path however to /store/. I changed the directory name, adjusted the &quot;commerce&quot; where it was hardcoded in the templates, and changed the Product URL Format and Product Template within the Product Types to use store/ instead. Everything seems to look okay until I try to add/remove/update a product into the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that happens I get a routing error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CHttpException&#xA;Unable to resolve the request &quot;store/cart/updateCart&quot;.&#xA;/path/to/craft/app/framework/web/CWebApplication.php(286)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Line 286 is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new CHttpException(404,Yii::t('yii','Unable to resolve the request &quot;{route}&quot;.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should I be leaving these paths alone and adjusting the URL in a different way? Any help and direction would be greatly appreciated. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="22" LastEditDate="2016-03-17T03:57:33.023" LastActivityDate="2016-05-20T16:34:24.407" Title="Customizing Craft Commerce Template Paths" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14176" PostTypeId="1" CreationDate="2016-03-17T09:49:02.793" Score="2" ViewCount="451" Body="&lt;p&gt;we have an ecommerce customer in the gifts market who currently have a custom built ecommerce website. Their USP is that you can order gifts for all your friends and family at once and they will be sent to different addresses on the right days throughout the year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are looking at moving them to Craft Commerce. Does anyone know if Craft supports multiple shipment addresses on the same order or any way this could work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4905" LastActivityDate="2016-03-21T04:47:54.533" Title="Does Craft commerce support multiple delivery addresses / shipments on same order?" Tags="&lt;ecommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14177" PostTypeId="2" ParentId="2481" CreationDate="2016-03-17T10:45:18.263" Score="11" Body="&lt;p&gt;If anyone is interested in confirming passwords still, I have wrote a plugin which does just this, it doesn't rely on it's own controller either so there is no bypassing of Crafts own workings :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/alecritson/Craft-Password-Confirm&quot;&gt;https://github.com/alecritson/Craft-Password-Confirm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is add a &lt;code&gt;passwordConfirm&lt;/code&gt; field to your existing form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;password&quot; name=&quot;passwordConfirm&quot;&amp;gt;&#xA;{% if account is defined %}&#xA;  {{ account.getErrors('passwordConfirm') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't confirm emails though..sorry&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-03-17T10:45:18.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14178" PostTypeId="2" ParentId="14175" CreationDate="2016-03-17T11:06:57.787" Score="5" Body="&lt;p&gt;You'll need to keep any action URLs as &lt;code&gt;commerce/&lt;/code&gt;, as these point to &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;noreferrer&quot;&gt;controller actions&lt;/a&gt; inside the Commerce plugin, not templates in your &lt;code&gt;store&lt;/code&gt; directory. So if you find:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;store/cart/updateCart&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will need to be restored to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-03-17T11:06:57.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14179" PostTypeId="1" AcceptedAnswerId="14286" CreationDate="2016-03-17T11:40:40.557" Score="1" ViewCount="387" Body="&lt;p&gt;We have a strange issue with a site we are developing. We have a user login on the front-end of the site which takes users to their profile pages. The issue we have is that on a Mac the user is being logged out randomly and irregularly on the local server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is odd because on PC this issue is not occurring. And what makes it even more strange is if the user is logged in as admin, whilst the user is logged out on the front-end they are still logged into the CMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across this issue before? I've tried some of the suggestions made in this post but nothing seems to be working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area&quot;&gt;Craft constantly logging out from admin area&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-23T12:23:13.527" Title="Strange issue with logging out user on frontend" Tags="&lt;login&gt;&lt;session&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14180" PostTypeId="2" ParentId="13920" CreationDate="2016-03-17T12:37:01.187" Score="1" Body="&lt;p&gt;I resolved this by adding a redirect to get rid of the www. The issue was my admin would be www but the front end wasn't.&lt;/p&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2016-03-17T12:37:01.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14181" PostTypeId="2" ParentId="4408" CreationDate="2016-03-17T14:44:54.747" Score="1" Body="&lt;p&gt;I know this is old but I've managed to remove the dashboard (from the navigation at least) with the following in a plugin's primary class. I guess there is nothing stopping you having a plugin that only does this!?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyCpNav(&amp;amp;$nav) {&#xA;    $newNav = array();&#xA;    foreach ($nav as $navKey =&amp;gt; $navItem) {&#xA;        if ($navItem['label'] !== 'Dashboard') {&#xA;            $newNav[$navKey] = $navItem;&#xA;        }&#xA;    }&#xA;    $nav = $newNav;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will need to set the postCpLoginRedirect config value to something otherwise it will still go to the dashboard page after login.&lt;/p&gt;&#xA;" OwnerUserId="4906" LastActivityDate="2016-03-17T14:44:54.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14182" PostTypeId="1" CreationDate="2016-03-17T15:08:24.830" Score="0" ViewCount="467" Body="&lt;p&gt;Is there a service method I can use to get (any kind of) session data by giving the cookies CraftSessionId as a parameter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if would look something like this. &#xA;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;getSessionBySessionId($craftSessionId)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4901" LastActivityDate="2016-05-17T01:19:03.210" Title="get session data by cookies CraftSessionId" Tags="&lt;plugin-development&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14183" PostTypeId="1" AcceptedAnswerId="16679" CreationDate="2016-03-17T16:39:10.490" Score="3" ViewCount="713" Body="&lt;p&gt;Is it possible to get the right locale based on url? For instance &#xA;&lt;code&gt;http://example.com/entries.json&lt;/code&gt; gives english content while &lt;code&gt;http://example.com/no/entries.json&lt;/code&gt; gives norwegian content? Or can I somehow specify different locales in &lt;code&gt;criteria&lt;/code&gt; or some other option, per endpoint in &lt;code&gt;elementapi.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="195" LastActivityDate="2016-09-03T14:22:49.753" Title="Element API locale" Tags="&lt;localization&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14184" PostTypeId="1" AcceptedAnswerId="14188" CreationDate="2016-03-17T17:18:02.257" Score="3" ViewCount="533" Body="&lt;p&gt;We're trying to use Craft as a CMS for a mobile app and to accomplish this we need to convert entries to JSON. We use the Element API plugin for this and it works like a charm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that we don't want certain content to be visible to everyone, so we want to require the users to log in. Is it possible for a user to log in via the mobile app, then get some kind of sessionToken which is stored in the database and then every time the user send a request to the API it sends the token along with it to make sure the user of the mobile app is authenticated (like the token in the &lt;code&gt;craft_sessions&lt;/code&gt; table)? If so how can this be accomplished?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should this require us to write our own plugin with a custom authentication system or is it possible to get this working with the user logic provided by Craft?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="57" LastEditDate="2016-03-17T22:12:03.730" LastActivityDate="2017-08-21T15:01:37.023" Title="Mobile app authentication" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;plugin-elementapi&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14185" PostTypeId="1" AcceptedAnswerId="14187" CreationDate="2016-03-17T17:57:45.800" Score="4" ViewCount="237" Body="&lt;p&gt;In the Dashboard, while editing the settings of a Matrix Block — the instructions for setting Upload Location for an Assets field says &lt;code&gt;Note that the subfolder path can contain variables like {owner.slug} or {owner.author.username}.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To what does &lt;code&gt;owner&lt;/code&gt; refer? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I want to store these assets in Site Assets/pages/{slug of the page this block is on}  — is &lt;code&gt;owner&lt;/code&gt; the page name or the username or what?&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2016-03-17T20:19:04.453" Title="Limiting the Upload Location for assets in a Matrix Block" Tags="&lt;templating&gt;&lt;assets&gt;&lt;matrix&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14186" PostTypeId="1" AcceptedAnswerId="14189" CreationDate="2016-03-17T17:57:50.147" Score="2" ViewCount="921" Body="&lt;p&gt;I followed the Craft &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;directions&lt;/a&gt; for setting up a localized site. In the &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-5-set-up-the-files&quot; rel=&quot;nofollow&quot;&gt;fifth step&lt;/a&gt; I followed the first example for setting up my folder structure. In my case the languages I'm working with are French and Arabic.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public_html/&#xA;   fr/                 --&amp;gt; example.com/fr/ (french)&#xA;      .htaccess&#xA;      index.php&#xA;   ar/                 --&amp;gt; example.com/ar/ (arabic)&#xA;      .htaccess&#xA;      index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The primary language for the site is French, what is the best way to redirect so that if a visitor comes to the root of the site &lt;code&gt;www.example.com&lt;/code&gt; they will be redirected to the French version at &lt;code&gt;www.example.com/fr/&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I use a .htaccess file in main public_html directory of the site, should I use the dynamic routes in Craft, or is there some other, better, way?&lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-03-18T10:23:13.940" Title="How to redirect site root to preferred language in multi-language site?" Tags="&lt;localization&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14187" PostTypeId="2" ParentId="14185" CreationDate="2016-03-17T20:19:04.453" Score="6" Body="&lt;p&gt;&lt;code&gt;owner&lt;/code&gt; is the element which contains your Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you attach a Matrix field to a Section, the &lt;code&gt;owner&lt;/code&gt; would be &lt;strong&gt;the specific Entry in that Section&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{owner.slug}&lt;/code&gt; - The slug of your entry.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{owner.author.username}&lt;/code&gt; - The username of the person who created the entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-17T20:19:04.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14188" PostTypeId="2" ParentId="14184" CreationDate="2016-03-17T22:25:29.700" Score="3" Body="&lt;p&gt;You're basically looking for authentication/authorization for the Element API plugin, which it currently doesn't support.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should this require us to write our own plugin with a custom authentication system or is it possible to get this working with the user logic provided by Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd probably approach this by forking the Element API plugin and adding authentication/authorization to it instead of adding it to a separate plugin and getting them to interact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need some way to authenticate the user and once they are authenticated you could authorize future requests either based on a custom token or using &lt;a href=&quot;https://www.httpwatch.com/httpgallery/authentication/&quot; rel=&quot;nofollow&quot;&gt;authorization&lt;/a&gt; headers and each could have their own expiration logic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-17T22:25:29.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14189" PostTypeId="2" ParentId="14186" CreationDate="2016-03-17T22:32:58.983" Score="3" Body="&lt;p&gt;I would put a &lt;code&gt;.htaccess&lt;/code&gt; file in the public HTML folder and let Apache deal with it, that way you don't have the overhead of PHP/Craft having to deal with that request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-17T22:32:58.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14190" PostTypeId="2" ParentId="14176" CreationDate="2016-03-17T22:47:19.827" Score="1" Body="&lt;p&gt;Commerce does not currently support this out of the box (March 2016) - but (just spitballing here, you'll have to try it all out for yourself of course) - you can add arbitrary custom fields to orders. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could rig something up by using e.g. a matrix of address field types like this one - &lt;a href=&quot;https://github.com/elivz/VzAddress-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/elivz/VzAddress-Craft&lt;/a&gt; - to store the delivery addresses.  But I am guessing you'd want the address data per line Item, so you could instead perhaps use the line items options system described at the bottom here:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/add-to-cart&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...to add data for the address to each lineitem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order itself would have the purchaser's main address associated with it, but you could definitely store addresses either as options with lineitems, or in custom fields on the order, so it would be possible with some effort I'd say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you'd need to write a custom shipping solution or adjuster plugin that was capable of using the address data stored to calculate the shipping for each of the 'sub orders' and return the total, I suppose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not going to be &lt;em&gt;super&lt;/em&gt; simple but Commerce is very flexible and easy to work with when it comes to plugins etc.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="1016" LastEditDate="2016-03-21T04:47:54.533" LastActivityDate="2016-03-21T04:47:54.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14191" PostTypeId="2" ParentId="14156" CreationDate="2016-03-17T23:51:29.240" Score="2" Body="&lt;p&gt;You can't just append rows to an existing table field from a form. The  controller expects the complete data set, so you'd need to query for the existing rows in your template and post them together with the new rows for that field.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-17T23:51:29.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14192" PostTypeId="2" ParentId="14182" CreationDate="2016-03-18T00:33:39.900" Score="1" Body="&lt;p&gt;I don't think I'd use PHP's session for this at all, but recently posted some thoughts on a similar question here &lt;a href=&quot;https://craftcms.stackexchange.com/a/14188/57&quot;&gt;https://craftcms.stackexchange.com/a/14188/57&lt;/a&gt; about using custom tokens or authorization headers to perform the authorization.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-03-18T00:33:39.900" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14193" PostTypeId="1" AcceptedAnswerId="14233" CreationDate="2016-03-18T08:12:41.513" Score="1" ViewCount="712" Body="&lt;p&gt;I'm building a book store which filters entries based on GET variables. For the most part, this is working well just merging in various filters to a params variable and then passing &lt;code&gt;craft.entries(params)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tricky bit is that each book can have an ebook price and a paperback price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the books are being filtered to a certain format, then I just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'ebook' in formats %}&#xA;    {% set params = params|merge({ 'ebookRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }) %}&#xA;{% endif %}&#xA;{% if 'pback' in formats %}&#xA;    {% set params = params|merge({ 'paperbackRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works well for an individual format, but if no format is selected it becomes too specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like I need to do something like the following, but this doesn't seem to have any effect on what is returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = params|merge(['or',&#xA;    { 'ebookRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to },&#xA;    { 'paperbackRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }&#xA;]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- Update with full code: ---&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Prep the entries params #}&#xA;{% set params = {&#xA;    section: 'books',&#xA;    with: [&#xA;        'bookAuthor',&#xA;        'booksImage',&#xA;    ]&#xA;} %}&#xA;&#xA;{# Prep the relatedTo params #}&#xA;{% set relatedToParams = ['and'] %}&#xA;&#xA;{# need to do a bunch of checks here and combine them into one relatedto query #}&#xA;&#xA;{% if craft.request.getParam('author') %}&#xA;    {% set relatedToParams = relatedToParams|merge([{&#xA;        targetElement: craft.request.getParam('author'),&#xA;        field: 'bookAuthor'&#xA;    }]) %}&#xA;{% endif %}&#xA;&#xA;{% if entry.section.handle == 'collections' %}&#xA;    {% set relatedToParams = relatedToParams|merge([{&#xA;        sourceElement: entry&#xA;    }]) %}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.getParam('genre') %}&#xA;    {% set relatedToParams = relatedToParams|merge([{&#xA;        targetElement: ['and']|merge(craft.request.getParam('genre')),&#xA;        field: 'genre'&#xA;    }]) %}&#xA;{% endif %}&#xA;&#xA;{# Merge in the relatedTo params if they exist #}&#xA;{% if relatedToParams|length &amp;gt; 1 %}&#xA;    {% set params = params|merge({ 'relatedTo' : relatedToParams }) %}&#xA;{% endif %}&#xA;&#xA;{% set maxPrice = 10000 %} {# temp high number before working out highest value #}&#xA;{% set price_from = craft.request.getParam('price_from') ?? 0 %}&#xA;{% set price_to = craft.request.getParam('price_to') ?? maxPrice %}&#xA;&#xA;{% set formats = craft.request.getParam('format') ?? null %}&#xA;{% if 'ebook' in formats %}&#xA;    {% set params = params|merge({ 'isEbook' : 1 }) %}&#xA;    {% set params = params|merge({ 'ebookRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }) %}&#xA;{% endif %}&#xA;{% if 'pback' in formats %}&#xA;    {% set params = params|merge({ 'isPaperback' : 1 }) %}&#xA;    {% set params = params|merge({ 'paperbackRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }) %}&#xA;{% endif %}&#xA;&#xA;{# &#xA;{% if formats is null %}&#xA;    somehow filter price for both formats as an or?&#xA;    This doesn't work:&#xA;    {% set params = params|merge(['or',&#xA;        { 'ebookRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to },&#xA;        { 'paperbackRrp' : 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to }&#xA;    ]) %}&#xA;{% endif %}&#xA;#}&#xA;&#xA;{# Finally get the relevant books #}&#xA;{% set books = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3912" LastEditorUserId="3912" LastEditDate="2016-03-19T08:33:31.097" LastActivityDate="2016-03-21T08:46:00.193" Title="Combining custom field filters on craft.entries" Tags="&lt;entries&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14194" PostTypeId="1" AcceptedAnswerId="14209" CreationDate="2016-03-18T09:56:10.503" Score="0" ViewCount="431" Body="&lt;p&gt;Can I directly get the data of the user that I just logged in with &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;login($username, $password)&lt;/code&gt; ? (not from a method that uses the SESSION like &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;getUser()&lt;/code&gt; though)&lt;/p&gt;&#xA;" OwnerUserId="4901" LastEditorUserId="57" LastEditDate="2016-03-18T23:10:56.537" LastActivityDate="2016-03-18T23:18:36.517" Title="Get data of user after login (but not with craft()-&gt;userSession-&gt;getUser())" Tags="&lt;php&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14195" PostTypeId="2" ParentId="14186" CreationDate="2016-03-18T10:23:13.940" Score="2" Body="&lt;p&gt;Here's the setup I used for the .htaccess file if anyone is interested:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;RewriteCond %{REQUEST_URI} ^/$&#xA;RewriteRule (.*) http://example.com/new_directory/ [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-03-18T10:23:13.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14197" PostTypeId="1" CreationDate="2016-03-18T12:37:57.357" Score="2" ViewCount="626" Body="&lt;p&gt;Does anyone know if you can work with &lt;code&gt;releatedTo&lt;/code&gt; between categories? I’d like to get all the categories in a &lt;code&gt;categories.group&lt;/code&gt;s that are related to a single category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some entries in a channel, lets call it &lt;code&gt;parts&lt;/code&gt;. The &lt;code&gt;parts&lt;/code&gt; have two categories from two separate groups.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Group 1 is &lt;code&gt;partType&lt;/code&gt; which has the categories &lt;code&gt;engine&lt;/code&gt; &lt;code&gt;interior&lt;/code&gt; and &lt;code&gt;transmission&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Group 2 is &lt;code&gt;manufacturer&lt;/code&gt; which has the categories &lt;code&gt;ford&lt;/code&gt; and &lt;code&gt;chrysler&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the category-page for &lt;code&gt;ford&lt;/code&gt;, i’d like to list all the &lt;code&gt;parts&lt;/code&gt; in the &lt;code&gt;ford&lt;/code&gt; category, grouped by &lt;code&gt;partType&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don’t wand to show the &lt;code&gt;partType&lt;/code&gt; categories that have no &lt;code&gt;parts&lt;/code&gt; by the current &lt;code&gt;manufacturer&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3932" LastActivityDate="2016-03-18T13:13:14.933" Title="Working with multiple categories" Tags="&lt;categories&gt;&lt;relations&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14198" PostTypeId="2" ParentId="14197" CreationDate="2016-03-18T13:13:14.933" Score="3" Body="&lt;p&gt;I figured it out! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone is stuck at the same place here’s my solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# category is 'ford' #}&#xA;{% set entries = craft.entries.section('support').relatedTo(category).find() %}&#xA;{% set partsCategories = craft.categories.group('partsGroup').relatedTo(entries) %}&#xA;&#xA;{# Partslist #}&#xA;{% for partsCategory in partsCategories %}&#xA;&#xA;    {{partsCategory.title}}&#xA;    {% for part in craft.entries.relatedTo([&#xA;      'and',&#xA;      { targetElement: partsCategory },&#xA;      { targetElement: category }&#xA;    ]) %}&#xA;&#xA;      {{part.title}}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3932" LastActivityDate="2016-03-18T13:13:14.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14199" PostTypeId="1" AcceptedAnswerId="14252" CreationDate="2016-03-18T13:20:57.337" Score="2" ViewCount="1099" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if this is a bug or something else. Essentially, test emails from the system work fine but emails that are supposed to be sent when the order moves to &quot;Processing&quot; do not. The log file from yesterday states: &lt;code&gt;2016/03/17 14:31:52 [info] [plugin] [Forced] Can't send email if no status or emails exist.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is a status (processing) and an email for that status (&lt;code&gt;{{ order.email }}&lt;/code&gt;). I have attempted several dummy transactions today as well but the emails don't come through and the logs don't update either. And no, there's nothing in the spam folder. Or error messages sent back to the host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even tried to have the order emails sent to a specific email address instead of &lt;code&gt;{{ order.email }}&lt;/code&gt;. No joy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I am using the default commerce templates so I'm pretty sure the issue isn't there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2016-03-18T14:05:42.603" LastActivityDate="2016-03-22T00:32:22.220" Title="Emails not being sent when transaction complete" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14201" PostTypeId="1" CreationDate="2016-03-18T15:20:29.717" Score="1" ViewCount="248" Body="&lt;p&gt;The &lt;code&gt;AttributeType::DateTime&lt;/code&gt; in model attributes saves as UTC which is great, but upon getting that attribute I receive a &lt;code&gt;Craft\DateTime&lt;/code&gt; object with my server timezone set for it, and thus the time gets modified accordingly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I could force the model to return a &lt;code&gt;Craft\DateTime&lt;/code&gt; object with the UTC timezone?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I created a getter method &lt;code&gt;public function getDate()&lt;/code&gt; it doesn't get called when using &lt;code&gt;object.date&lt;/code&gt; inside a Twig template. I have to specifically call &lt;code&gt;object.getDate()&lt;/code&gt; instead, which isn't really an option for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how my model defines attributes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'date'  =&amp;gt; AttributeType::DateTime,&#xA;    )&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe there are some additional rules I can set for it, that I am not aware of? I couldn't find anything in Yii's documentation.&lt;/p&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2016-04-18T00:37:54.227" Title="Getting UTC DateTime from Model attributes" Tags="&lt;plugins&gt;&lt;datetime&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14202" PostTypeId="1" AcceptedAnswerId="14206" CreationDate="2016-03-18T15:36:03.113" Score="1" ViewCount="202" Body="&lt;p&gt;I'm trying to create a GeoJSON feed using the Element API plugin but having difficulty creating the nested structure required for the JSON object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;type&quot;: &quot;Feature&quot;,&#xA;  &quot;geometry&quot;: {&#xA;    &quot;type&quot;: &quot;Point&quot;,&#xA;    &quot;coordinates&quot;: [125.6, 10.1]&#xA;  },&#xA;  &quot;properties&quot;: {&#xA;    &quot;name&quot;: &quot;Dinagat Islands&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get a flat json structure using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;return [&#xA;    &quot;type&quot; =&amp;gt; &quot;Feature&quot;,&#xA;    &quot;geometry&quot; =&amp;gt; &quot;&quot;,&#xA;    &quot;properties&quot; =&amp;gt; &quot;&quot;&#xA;];&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, how would I update the above code to create the nested json objects for &lt;code&gt;geometry&lt;/code&gt; and &lt;code&gt;properties&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. G.&lt;/p&gt;&#xA;" OwnerUserId="4774" LastEditorUserId="57" LastEditDate="2016-03-18T23:49:54.913" LastActivityDate="2016-03-18T23:49:54.913" Title="Nested objects for geoJSON using Element API" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14203" PostTypeId="1" CreationDate="2016-03-18T15:53:33.130" Score="1" ViewCount="391" Body="&lt;p&gt;I´m trying to automate the installation process of Craft as far as possible.&#xA;So my question is the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to automate the Craft installer (the one with the monkey), possibly through a config file or through the command line or whatever. Of course there are possible solutions using headless browsers, but I think that would be too much of an effort for that task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I´m really looking forward to your replies!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance and cheers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ferdi&lt;/p&gt;&#xA;" OwnerUserId="4908" LastEditorUserId="57" LastEditDate="2016-03-19T00:14:32.250" LastActivityDate="2016-03-19T00:24:34.650" Title="Is it possible to skip Craft Installer through command line or something similar?" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14204" PostTypeId="1" AcceptedAnswerId="14210" CreationDate="2016-03-18T16:09:20.450" Score="1" ViewCount="169" Body="&lt;p&gt;I want to store a session value and have that cleared after a set timeout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve got PHP's &lt;code&gt;session.gc_maxlifetime&lt;/code&gt; set at 60 seconds for development and am using Craft’s &lt;code&gt;HttpSessionService&lt;/code&gt; to set a session value &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;set('foo')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m then checking that after 60 seconds and would expect it to be cleared by PHP’s session garbage collector but it’s still there: &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;get('foo')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of how PHP's garbage collection works in that it's not run on every request (1/100 chance by default, defined by other PHP session settings).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to force garbage collection on each session? Is there anything under the hood that we can leverage or do we need to write something custom?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="57" LastEditDate="2016-03-18T23:36:54.833" LastActivityDate="2016-03-18T23:43:55.113" Title="Craft/Yii not garbage collecting session?" Tags="&lt;plugin-development&gt;&lt;config&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14205" PostTypeId="1" CreationDate="2016-03-18T16:15:07.747" Score="1" ViewCount="418" Body="&lt;p&gt;I've got a small site for a B&amp;amp;B, entirely based on a single Craft structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every page uses the same entry template, which extends a layout template. This layout template has header, sidebar, and footer includes. The site’s navigation is generated direct from the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry template makes extensive use of matrix blocks to create different page layouts, and one of these matrix blocks is a checkbox which adds an enquiry form to the page. The template for this is based on the Craft contact form. (I started this project a while ago as a learning exercise, and I’m still on contact form version 1.4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I can’t get the error messages on the email and message fields to work. If there’s an error in the form: on submit, the browser re-loads the page and doesn’t create an email, but there are no error messages. (If there are no errors: the email is created ok, and the 'thanks' page is loaded ok.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve re-tested by copying the form into a single stand-alone html page, and it works perfectly like this. This isn’t a good solution, however, as I want to be able to drop the form into pages, and to make use of structure’s navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers to where I’ve gone wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% macro errorList(errors) %}&#xA;      {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;          {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;thanks&quot;&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;radio-group&quot;&amp;gt;Subject&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Subject][]&quot; value=&quot;Booking&quot;&amp;gt;&#xA;          &amp;lt;label class=&quot;radio&quot;&amp;gt;Booking&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Subject][]&quot; value=&quot;Enquiry&quot;&amp;gt;&#xA;          &amp;lt;label class=&quot;radio&quot;&amp;gt;Enquiry&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Subject][]&quot; value=&quot;Anything else&quot;&amp;gt;&amp;lt;label class=&quot;radio&quot;&amp;gt;Anything else&#xA;          &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;fromName&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;fromName&quot; placeholder=&quot;Your name&quot; name=&quot;message[Name]&quot; value=&quot;&quot;&amp;gt; &#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;fromEmail&quot; placeholder=&quot;Your email address (required)&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;          {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;phone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;phone&quot; placeholder=&quot;Your phone number&quot; name=&quot;message[Phone]&quot; value=&quot;&quot;&amp;gt; &#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;radio-group&quot; for=&quot;studio&quot;&amp;gt;Studio&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Studio][]&quot; value=&quot;Studio 1 double&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;Studio 1 double&quot; class=&quot;radio&quot;&amp;gt;Studio 1 double&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Studio][]&quot; value=&quot;Studio 2 double&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;Studio 2 double&quot; class=&quot;radio&quot;&amp;gt;Studio 2 double&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[Studio][]&quot; value=&quot;Studio 2 twin&quot;&amp;gt;&amp;lt;label for=&quot;Studio 2 twin&quot; class=&quot;radio&quot;&amp;gt;Studio 2 twin&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt; &#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;radio-group&quot; for=&quot;studio&quot;&amp;gt;For&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[For][]&quot; value=&quot;Two people sharing&quot;&amp;gt;&amp;lt;label class=&quot;radio&quot;&amp;gt;Two people sharing&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;radio&quot; name=&quot;message[For][]&quot; value=&quot;Single occupancy&quot;&amp;gt;&amp;lt;label class=&quot;radio&quot;&amp;gt;Single occupancy&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt; &#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;arrival&quot;&amp;gt;Arrival&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-5 columns end&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;arrival&quot; placeholder=&quot;Date of arrival&quot; name=&quot;message[Arrival]&quot; value=&quot;&quot;&amp;gt; &#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;nights&quot;&amp;gt;Nights&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-5 columns end&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;nights&quot; placeholder=&quot;Number of nights&quot; name=&quot;message[Nights]&quot; value=&quot;&quot;&amp;gt; &#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-2 columns&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;compact-10 columns&quot;&amp;gt;&#xA;          &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message[body]&quot; placeholder=&quot;Your message here (required)&quot; name=&quot;message&quot; value=&quot;&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;          {{ message is defined and message ? errorList(message.getErrors('message')) }} &#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;input id=&quot;preferredKitten&quot; name=&quot;preferredKitten&quot; type=&quot;text&quot;&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;small-3 compact-offset-2 columns end&quot;&amp;gt;&#xA;            &amp;lt;button type=&quot;submit&quot; class=&quot;button button-primary&quot;&amp;gt;Send Message&amp;lt;/button&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3695" LastEditorUserId="57" LastEditDate="2016-03-18T23:47:20.723" LastActivityDate="2016-03-23T22:57:23.500" Title="Missing error messages using Craft contact form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14206" PostTypeId="2" ParentId="14202" CreationDate="2016-03-18T18:41:02.117" Score="3" Body="&lt;p&gt;I figured this out myself. I needed to use PHP array syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In answer to my own question, the updated code for a nested object would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;return [&#xA;    &quot;type&quot; =&amp;gt; &quot;Feature&quot;,&#xA;    &quot;geometry&quot; =&amp;gt; array(&quot;type&quot; =&amp;gt; &quot;Point&quot;, &quot;coordinates&quot; =&amp;gt; [125.6, 10.1]),&#xA;    &quot;properties&quot; =&amp;gt; array(&quot;name&quot; =&amp;gt; &quot;Dinagat Islands&quot;)&#xA;];&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else as it wasn't immediately apparent to me.&lt;/p&gt;&#xA;" OwnerUserId="4774" LastEditorUserId="57" LastEditDate="2016-03-18T23:49:42.567" LastActivityDate="2016-03-18T23:49:42.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14207" PostTypeId="1" AcceptedAnswerId="14224" CreationDate="2016-03-18T21:02:42.710" Score="1" ViewCount="180" Body="&lt;p&gt;When using &lt;code&gt;createElementSelectorModal()&lt;/code&gt; in a plugin, how do you make your source list show items from the current locale selected in the CP? It only seems to show the items from default locale no matter what locale you have selected.&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="1098" LastEditDate="2016-03-20T09:23:51.047" LastActivityDate="2016-03-21T17:05:36.500" Title="When using &quot;createElementSelectorModal()&quot; how do you respect selected locale?" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;modal&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14208" PostTypeId="2" ParentId="14199" CreationDate="2016-03-18T21:18:18.573" Score="2" Body="&lt;p&gt;The error is not telling you that the email &lt;em&gt;address&lt;/em&gt; is missing, I think, but rather that the &lt;em&gt;email itself&lt;/em&gt; to send is missing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you assigned an actual email to send for that particular status?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Commerce-&gt;Settings-&gt;Order Statuses&lt;/em&gt; - check the column 'Has Emails' has a value of 1 or more in it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(To actually assign one, create it first in the email section, and then in this section click on the order status and in the bottom field 'Status Emails' you'll then be able to choose your created email).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the error and the code generating it (in Commerce_OrderStatusesService.php) - I would say you've set up a status but not actually assigned the email you've made to it.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-03-18T21:18:18.573" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14209" PostTypeId="2" ParentId="14194" CreationDate="2016-03-18T23:18:36.517" Score="2" Body="&lt;p&gt;If you have the any identifying information about the user (user ID, email, username, UID), you can use one of the UsersService's methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#getUserById-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserById()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#getUserByUsernameOrEmail-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#getUserByUid-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserByUid()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#getUserByEmail-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserByEmail()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They will each return a &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; object to interact with.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-18T23:18:36.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14210" PostTypeId="2" ParentId="14204" CreationDate="2016-03-18T23:43:55.113" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I’m then checking that after 60 seconds and would expect it to be cleared by PHP’s session garbage collector but it’s still there:&lt;/p&gt;&#xA;&lt;p&gt;I'm aware of how PHP's garbage collection works in that it's not run on every request (1/100 chance by default, defined by other PHP session settings).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I think you answered your own question?  From: &lt;a href=&quot;https://secure.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://secure.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;session.gc_maxlifetime&lt;/code&gt; specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That means after 60 seconds the value in session has a 1/100 chance of being picked up by the garbage collector.  Of course, you can affect that percentage via other settings, but there are some valid reasons why you would not want garbage collection to run on every request.&lt;/p&gt;&#xA;&lt;p&gt;I'm not aware of any way to &lt;em&gt;force&lt;/em&gt; the PHP garbage collector to run and clean certain values.  I'd probably look at using cache based methods instead since you can set expiration times on cached items.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-03-18T23:43:55.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14211" PostTypeId="2" ParentId="14205" CreationDate="2016-03-18T23:47:06.033" Score="1" Body="&lt;p&gt;Pretty sure you just need to update to &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#170&quot; rel=&quot;nofollow&quot;&gt;Contact Form 1.7.0&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added the ability to access individual message fields values via message.messageFields when a validation error occurred. For example, the value of the input &lt;code&gt;message[Phone]&lt;/code&gt; can now be accessed via &lt;code&gt;message.messageFields['Phone']&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-18T23:47:06.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14212" PostTypeId="2" ParentId="14201" CreationDate="2016-03-19T00:08:41.407" Score="1" Body="&lt;p&gt;I can't think of a way to automatically tell Craft to do this, but you could write a simple helper method to do this for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function convertDateTimeToUTC($dateTime)&#xA;{&#xA;    return $dateTime-&amp;gt;setTimezone(new \DateTimeZone('UTC'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-19T00:08:41.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14213" PostTypeId="2" ParentId="14035" CreationDate="2016-03-19T00:14:10.157" Score="1" Body="&lt;p&gt;There are two things to consider here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to approach sending to a list&lt;/li&gt;&#xA;&lt;li&gt;How to approach populating a notification with dynamic information&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h3&gt;Sending email to a list of users&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Sprout Email notifications use the default Craft email service. Each notification is sent to a single individual. To send to a list, what you'll need to do behind the scenes is loop through all the people in that list and send them each an email one by one.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Sending notifications with dynamic information&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;While Sprout Email uses the default email sending behavior in Craft, to send notifications programmatically you'll want to use the &lt;code&gt;sendNotifcation&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;sproutEmail_defaultMailer-&amp;gt;sendNotification($campaign, $object);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;$campaign&lt;/code&gt; variable should be an instance of a &lt;code&gt;SproutEmail_CampaignModel&lt;/code&gt; and can be created by retrieving the Notification you want to send by it's ID like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;sproutEmail_notifications-&amp;gt;getNotificationById($id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;$object&lt;/code&gt; is the data that will be processed in your template and any fields that accept dynamic variables such as the Subject, From Name, From Email, Reply To, and Recipients fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your situation, it sounds like you are sending User-specific notifications and your template might be expecting a &lt;code&gt;UserModel&lt;/code&gt; for any dynamic variables.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A very rough starting point for how to approach the sending could be as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get all your users first&#xA;&#xA;foreach ($users as $user) &#xA;{&#xA;    // Get your Campaign (SproutEmail_CampaignModel)&#xA;    $campaign = craft()-&amp;gt;sproutEmail_notifications-&amp;gt;getNotificationById($campaignId);&#xA;&#xA;    // Get your User (UserModel)&#xA;    // This step is only needed if $user is not already a UserModel&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    // Send your Notification&#xA;    craft()-&amp;gt;sproutEmail_defaultMailer-&amp;gt;sendNotification($campaign, $user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-03-19T00:14:10.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14214" PostTypeId="2" ParentId="14203" CreationDate="2016-03-19T00:24:34.650" Score="2" Body="&lt;p&gt;There are several ways you could approach this.  There is a &lt;a href=&quot;https://github.com/mattstauffer/makeItCraft&quot; rel=&quot;nofollow&quot;&gt;bash script&lt;/a&gt; that automates downloading the latest version of Craft, but it doesn't do the actual installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would do is create a PHP script that used prompted to accept Craft's license agreement, then used cURL/wget to download and extract the files.  You could prompt for all the information you need for installation (username, password, database, database connection info, etc.), then the script would load Craft's &lt;code&gt;craft/app/bootstrap.php&lt;/code&gt; and call Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/InstallService#run-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;InstallService-&amp;gt;run()&lt;/code&gt;&lt;/a&gt; method passing in the necessary values similar to how Craft's &lt;code&gt;craft/app/controller/InstallController&lt;/code&gt; does.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-19T00:24:34.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14215" PostTypeId="1" AcceptedAnswerId="14216" CreationDate="2016-03-19T01:00:22.387" Score="2" ViewCount="31" Body="&lt;p&gt;I'd like to get an output of &lt;strong&gt;Spring 2015&lt;/strong&gt; from a post entry that was written in March. Here is a JavaScript solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://jsfiddle.net/RtC58/3/&quot; rel=&quot;nofollow&quot;&gt;http://jsfiddle.net/RtC58/3/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm hoping I can do something in the template instead. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2016-03-19T03:32:54.553" Title="Output season name from entry date" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14216" PostTypeId="2" ParentId="14215" CreationDate="2016-03-19T03:32:54.553" Score="5" Body="&lt;pre&gt;&lt;code&gt;{% switch entry.postDate|date('M') %}&#xA;&#xA;    {% case 'Dec' or 'Jan' or 'Feb' %}&#xA;        {% set season = 'Winter' %}&#xA;&#xA;    {% case 'Mar' or 'Apr' or 'May' %}&#xA;        {% set season = 'Spring' %}&#xA;&#xA;    {% case 'Jun' or 'Jul' or 'Aug' %}&#xA;        {% set season = 'Summer' %}&#xA;&#xA;    {% case 'Sep' or 'Oct' or 'Nov' %}&#xA;        {% set season = 'Fall' %}&#xA;&#xA;{% endswitch %}&#xA;&#xA;&amp;lt;p&amp;gt;{{ season }} {{ entry.postDate|date('Y') }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-19T03:32:54.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14217" PostTypeId="1" AcceptedAnswerId="14219" CreationDate="2016-03-19T19:05:47.977" Score="1" ViewCount="147" Body="&lt;p&gt;I'm using the following code in my template to truncate the body of an entry (coming from a Rich Text field):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.body | slice(0, 500) | markdown }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To this, I'd like to add &lt;code&gt;...&lt;/code&gt; as a string, so that it will output like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Words words words...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the field part I'm using outputs into its own &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag, adding the &lt;code&gt;...&lt;/code&gt; into the HTML itself has them sitting in two different tags. I've tried using &lt;code&gt;|join&lt;/code&gt; but I must be doing something wrong, its putting the first part into a separate &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag than the &lt;code&gt;...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2016-03-19T21:39:00.810" Title="Add '...' to template field" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14218" PostTypeId="2" ParentId="14217" CreationDate="2016-03-19T19:23:56.453" Score="3" Body="&lt;p&gt;You might find the Hacksaw plugin useful for this &lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw/&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ehousestudio/craft_hacksaw/&lt;/a&gt; this will truncate text for you and has a wealth of options available for doing so, specifically the &lt;code&gt;append&lt;/code&gt; parameter, which will do exactly what you want :)&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-03-19T19:23:56.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14219" PostTypeId="2" ParentId="14217" CreationDate="2016-03-19T19:24:55.293" Score="2" Body="&lt;p&gt;Try something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (entry.body | slice(0, 500) ~ '...') | markdown }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="284" LastEditorUserId="284" LastEditDate="2016-03-19T21:39:00.810" LastActivityDate="2016-03-19T21:39:00.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14221" PostTypeId="1" AcceptedAnswerId="14222" CreationDate="2016-03-19T21:52:17.263" Score="4" ViewCount="603" Body="&lt;p&gt;&lt;a href=&quot;https://caddyserver.com&quot; rel=&quot;noreferrer&quot;&gt;Caddy&lt;/a&gt; seems to be an easy to use alternative to established web servers. How does the &lt;code&gt;Caddyfile&lt;/code&gt; look like for a Craft site?&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-09-13T19:08:02.780" Title="How to serve Craft with Caddy server" Tags="&lt;server&gt;&lt;caddy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14222" PostTypeId="2" ParentId="14221" CreationDate="2016-03-19T21:55:30.923" Score="4" Body="&lt;p&gt;For local development the &lt;code&gt;Caddyfile&lt;/code&gt; looks like this (assuming that php-fpm runs on port 9000, you may have to adapt &lt;code&gt;root&lt;/code&gt; to point to your web root relative to the location of the &lt;code&gt;Caddyfile&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;localhost:2020 {&#xA;    root public_html&#xA;    fastcgi / 127.0.0.1:9000 php&#xA;    rewrite {&#xA;        r .*&#xA;        to {uri} {uri}/ /index.php?p={uri}&amp;amp;{query} /index.php?{query}&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; For Caddy &lt;code&gt;&amp;gt;= 0.9.x&lt;/code&gt; the &lt;code&gt;rewrite&lt;/code&gt; has to be changed to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rewrite {&#xA;  to {path} {path}/ /index.php?p={path}&amp;amp;{query} /index.php?{query}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="133" LastEditorUserId="133" LastEditDate="2016-09-13T19:08:02.780" LastActivityDate="2016-09-13T19:08:02.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14223" PostTypeId="1" AcceptedAnswerId="14231" CreationDate="2016-03-20T07:23:15.970" Score="5" ViewCount="597" Body="&lt;p&gt;I don't have commenting privileges yet, so couldn't comment on either of these posts (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4699/channel-index-page-linked-in-a-structure&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9093/linking-to-channel-via-structure-section&quot;&gt;here&lt;/a&gt;) regarding an entry in a Structure section that links to a Channel index. Between the two posts above I think I mostly understand what's going on, but have a question about an entry type for an entry in a Structure that essentially refers to a page that is a listing of Channel entries (basically an index page for the channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My situation: I have an About section with a few subpages that are dropdowns links under &quot;About&quot; in the main navigation bar: Vision, Leadership, and Qualifications. Vision and Qualifications are basically static pages, but the Leadership page lists a number of people (with corresponding images/titles/bios). So, I created a Channel section called &quot;Leadership&quot;, each entry containing an individual. In the About section (Structure type) I created two entry types: &quot;about&quot; and &quot;leadership&quot;. The &quot;about&quot; entry type has fields such as &quot;body&quot;, &quot;hero image&quot;, and &quot;subheader&quot; and is used for the static entries Vision and Qualifications. However, for the &quot;leadership&quot; entry type I'm uncertain what fields I should put in it. Since that one entry in the &quot;About&quot; section exists for the purposes of building the navigation, there isn't really any content in that entry. It's just there for the navigation link, and to get the user to a template (in my case templates/about/_types/leadership.html) that will output the individuals from the &quot;Leadership&quot; channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it make sense that I would just create a &quot;leadership&quot; entry type with no assigned fields (other than the default title), or is there a better way to approach this?&lt;/p&gt;&#xA;" OwnerUserId="1118" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-21T04:40:52.177" Title="A Structure section with an entry to a channel index" Tags="&lt;structure&gt;&lt;sections&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14224" PostTypeId="2" ParentId="14207" CreationDate="2016-03-20T09:20:54.657" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L4138&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;BaseElementSelectorModal&lt;/code&gt;&lt;/a&gt; class takes a second parameter &lt;code&gt;settings&lt;/code&gt;, which can include a &lt;code&gt;criteria&lt;/code&gt; object. This &lt;code&gt;criteria&lt;/code&gt; object is used to create an &lt;a href=&quot;https://buildwithcraft.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; on the server, which means it can have any property an ElementCriteriaModel can have – including &lt;code&gt;locale&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var currentLocale = Craft.getLocalStorage('BaseElementIndex.locale') || Craft.locale;&#xA;&#xA;var modal = Craft.createElementSelectorModal('Entry', {&#xA;    criteria : {&#xA;        locale : currentLocale&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-03-21T17:05:36.500" LastActivityDate="2016-03-21T17:05:36.500" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14225" PostTypeId="2" ParentId="14223" CreationDate="2016-03-20T09:34:17.973" Score="4" Body="&lt;p&gt;Yes that makes sense. There are many ways to approach this. I always try to consider how someone other than me will find the logic of the CMS design i.e. &lt;em&gt;How easy will they find Craft to actually use without me?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the most of what you already have, consider adding a &lt;strong&gt;Users&lt;/strong&gt; custom field to your Leadership entry type. This would allow you to select the people/biography-summaries that would appear on the Leadership page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if your people are Entries and not Users, then you could add an &lt;strong&gt;Entries&lt;/strong&gt; custom field to your Leadership entry type and leverage &lt;a href=&quot;https://craftcms.com/docs/relations&quot;&gt;Crafts relationships&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-20T09:34:17.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14226" PostTypeId="1" CreationDate="2016-03-20T18:43:41.337" Score="1" ViewCount="1023" Body="&lt;p&gt;I'm looking to get all entries from one section (say 'videos'), that are related to a specific category. The only reference to the category is the slug that is a parameter in the url:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....dev/videos/category-slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get the category id from the slug to be able to relate the videos to the category in the criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'section' =&amp;gt; 'videos',&#xA;  'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $categoryId],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find a way to get the properties of the category before applying the criteria. Is there something on the EntriesService object that I can use to get the category entry, similar to template usage? E.g:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categoryEntry = craft()-&amp;gt;entries-&amp;gt;section('categories')-&amp;gt;slug('category-slug');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then pass the $categoryEntry id through to the criteria to return all the related videos. E.g:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'section' =&amp;gt; 'videos',&#xA;  'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $categoryEntry-&amp;gt;id],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help with a way I could do this all in one endpoint would be great. The alternative is passing the slug into another category endpoint to get the entry, then use the response to pass the id to the above endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4582" LastEditorUserId="22" LastEditDate="2017-05-09T22:07:29.317" LastActivityDate="2017-05-09T22:07:29.317" Title="Get entry by slug with EntriesService in ElementAPI" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;plugin-elementapi&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14227" PostTypeId="1" AcceptedAnswerId="14228" CreationDate="2016-03-20T20:25:52.953" Score="0" ViewCount="619" Body="&lt;p&gt;I'm creating a page where I have a bunch of entries I want to populate with jquery drag and drop boxes. It's for the arrangement of songs, just as a tool. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I want to store the position of these in a JSON object. When I was using Expression Engine I managed to send an SQL command and store the data in the correct fields. Albeit it was kinda wonky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I'm using Craft so I figure there might way better ways of doing stuff like this. Do I use a form? Do I hide that form and send it using AJAX every time I make some changes to the jquery drag and drop boxes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PJGuo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PJGuo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="2162" LastEditDate="2016-03-20T21:02:37.623" LastActivityDate="2016-03-20T21:10:54.010" Title="The smoothest way to store JSON object to an entry?" Tags="&lt;form&gt;&lt;frontend&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14228" PostTypeId="2" ParentId="14227" CreationDate="2016-03-20T21:10:54.010" Score="3" Body="&lt;p&gt;It's a little tough to say, since you it seems like you haven't actually architected any of this in the Craft back-end yet. I encourage you to create a field (or fields) which would be a good container for this data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've established what kind of field you're using, you may find that there is a different answer... but based on your current intent to store a simple JSON object, it sounds like you'd be using a simple plain text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you're using a plain text field, this is actually quite simple to accomplish. &lt;strong&gt;Use your JavaScript to set the &lt;code&gt;value&lt;/code&gt; of a hidden field, before submitting the form:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[songsJson]&quot; value=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on saving entry data from a front-end form:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-20T21:10:54.010" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14229" PostTypeId="1" CreationDate="2016-03-21T01:36:46.270" Score="2" ViewCount="170" Body="&lt;p&gt;With the addition of the null-coalescing operator (&lt;code&gt;??&lt;/code&gt;) in Twig, it now appears that the following two examples both provide a way to retrieve the first entry and fallback to &lt;code&gt;null&lt;/code&gt; if no entry exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the first entry using the `first` method on the ElementCriteriaModel #}&#xA;{% set entry = craft.entries.section('news').first() %}&#xA;&#xA;{# Get the first entry by accessing it in the result array directly #}&#xA;{% set entry = craft.entries.section('news').limit(1)[0] ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems, with the addition of eager-loading and the alternative results syntax required for accessing eager-loaded elements in our templates, that the latter option may provide a consistent syntax to use throughout our templates vs. swapping between the former and the latter depending on which type of query you are performing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from the uglier syntax in the option that uses the null-coalescing operator, are there any other tradeoffs to consider in choosing the first method vs. the null-coalescing method when retrieving a single entry?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-03-21T08:06:26.413" Title="Are there any tradeoffs if you use the null-coalescing operator in place of first()?" Tags="&lt;elementcriteriamodel&gt;&lt;conditional&gt;&lt;logic&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14230" PostTypeId="2" ParentId="14229" CreationDate="2016-03-21T02:05:45.307" Score="1" Body="&lt;p&gt;My gut says the first option (&lt;code&gt;.first()&lt;/code&gt;) is going to be slightly faster, but in real world performance my guess is that it's negligible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I think I'd prefer the cleaner, more explicit, syntax of the first.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-21T02:05:45.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14231" PostTypeId="2" ParentId="14223" CreationDate="2016-03-21T04:40:52.177" Score="5" Body="&lt;p&gt;I like what Matt P wrote in his &lt;a href=&quot;https://craftcms.stackexchange.com/a/14225/1016&quot;&gt;answer&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;try to consider how someone [else] will find the logic of the CMS design&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The other factor you want to consider in information architecture is you only want store data once in the database. So how you intend to pull that data out also is going to influence your decision on &lt;em&gt;how&lt;/em&gt; you store it.&lt;/p&gt;&#xA;&lt;p&gt;The good news there is Craft really lets you pull data from virtually any place in the system very easily so it kind of comes down to an organizational choice. You have 2 options: Matrix or Entries.&lt;/p&gt;&#xA;&lt;h1&gt;Matrix Fields&lt;/h1&gt;&#xA;&lt;p&gt;You might consider a &lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;noreferrer&quot;&gt;matrix field&lt;/a&gt; because these attach right on the entry itself. That way, a user edits the Leadership entry directly, they'll find the data there, in an intuive away. The other bonus is you can move the entries up and down in a certain order or turn them off right in the context of previewing the page.&lt;/p&gt;&#xA;&lt;p&gt;Matrix is a good option if the data is more-or-less confined to that entry and you don't need to access the data anywhere else in the system.&lt;/p&gt;&#xA;&lt;h1&gt;Entries&lt;/h1&gt;&#xA;&lt;p&gt;If you need to relate content back to each other, or you find the leadership team data needs to exist in a context &lt;em&gt;outside&lt;/em&gt; that particular page, it's probably the best option to bring them in as a channel (or structure).&lt;/p&gt;&#xA;&lt;p&gt;Craft 2.5 made a huge change as to the way you can edit related entries right in the same entry. You might want to consider using an &amp;quot;entries&amp;quot; field that relates back to your Leadership channel and let the user pick exactly which team members you want to spit out on that page. The other benefit is in this way, you can open up  those &amp;quot;related&amp;quot; entries right from the Leadership entry, much like a Matrix block would—enhancing usability—but you still keep them as entries.&lt;/p&gt;&#xA;&lt;h1&gt;TL;DR&lt;/h1&gt;&#xA;&lt;p&gt;I don't know how many people are on the leadership team but if you have but more than a couple dozen, it might make sense to keep them as entries. Otherwise if you don't plan to use that data anywhere else in the system, a matrix field could be a nice option too.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-03-21T04:40:52.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14232" PostTypeId="2" ParentId="14229" CreationDate="2016-03-21T08:06:26.413" Score="0" Body="&lt;p&gt;I noticed that there's quite a big difference in query performance between using &lt;code&gt;first&lt;/code&gt; and &lt;code&gt;find&lt;/code&gt; if there are many element models matching your criteria. See the example in this answer for some measurements:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12180/optimizing-pagespeed/12182#12182&quot;&gt;Optimizing pagespeed&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that example, there are lots of images related to each entry queried. It would be interesting to see how it would perform with eager loading. Might be that &lt;code&gt;first&lt;/code&gt; is still faster, as you wouldn't get back all the models and you can't (yet?) query for the first element only with eager loading. Probably worth a feature request.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-21T08:06:26.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14233" PostTypeId="2" ParentId="14193" CreationDate="2016-03-21T08:46:00.193" Score="0" Body="&lt;p&gt;It's currently not possible to combine criteria params like this (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1948/complex-logic-on-a-elementcriteriamodel-parameter&quot;&gt;Complex logic on a ElementCriteriaModel parameter?&lt;/a&gt;).&#xA;As a workaround you'd prepare an &lt;code&gt;idParam&lt;/code&gt; object, similar to your &lt;code&gt;relatedToParam&lt;/code&gt; and collect all matching element IDs&#xA;making use of additional criteria models and the &lt;code&gt;ids&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Prep the id param #}&#xA;{% set idParam = [] %}&#xA;&#xA;{% if formats is null %}&#xA;    {% set ebookEntryIds = craft.entries({&#xA;        section: 'books',&#xA;        ebookRrp: 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to&#xA;    }).ids() %}&#xA;&#xA;    {% set pbackEntryIds = craft.entries({&#xA;        section: 'books',&#xA;        paperbackRrp: 'and, &amp;gt; '~price_from~', &amp;lt; '~price_to&#xA;    }).ids() %}&#xA;&#xA;    {% set idParam = ebookEntryIds|merge(pbackEntryIds) %}&#xA;{% endif %}&#xA;&#xA;{# Merge in the id param #}&#xA;{% if idParam|length %}&#xA;    {% set params = params|merge({ id: idParam }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-03-21T08:46:00.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14235" PostTypeId="1" AcceptedAnswerId="14236" CreationDate="2016-03-21T10:13:05.523" Score="2" ViewCount="399" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to redirect with a status code and have the correct template load with the correct status code?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have template code which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if slug is defined %}&#xA; {% set entry = craft.entries.section('foobar').slug(slug).first() %}&#xA; {% if not entry.editable %}&#xA;    {% redirect 403 %}&#xA; {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine and redirects to the &lt;code&gt;403&lt;/code&gt; template, but the problem is that is just redirects (changes the url) to &lt;code&gt;/403&lt;/code&gt; with a status code of &lt;code&gt;302&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8248/how-do-i-force-a-301-http-status-code-using-the-redirect-tag&quot;&gt;I followed from this question&lt;/a&gt; and used the second parameter to set the status code like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect 403 403 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which sets the status code fine but now my 403 template doesn't load. If I try it with &lt;code&gt;404&lt;/code&gt; the same problem applies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to a &lt;code&gt;404&lt;/code&gt; page which is handled by Craft (no redirect tag) then the status code is set correctly and my &lt;code&gt;404&lt;/code&gt; template loads just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to redirect with a status code and have the correct template load with the correct status code?&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-21T10:14:39.907" Title="Redirecting with http status code doesn't render template" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14236" PostTypeId="2" ParentId="14235" CreationDate="2016-03-21T10:14:39.907" Score="2" Body="&lt;p&gt;&lt;code&gt;{% exit 403 %}&lt;/code&gt; seems to be the answer! Seems so obvious now... &lt;em&gt;facepalm&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-03-21T10:14:39.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14237" PostTypeId="1" CreationDate="2016-03-21T11:03:58.890" Score="2" ViewCount="117" Body="&lt;p&gt;I'm getting the following error when trying to send a campaign with Campaign Monitor through the Sprout E-mail plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;400: HTML Content URL Required&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used the example templates provided by Sprout. The Api connects well (I get the list my subscription list from Campaign Monitor in Sprout). I make a new campaign and I can preview the mail in both html and text. The preview looks fine (just some hardcoded stuff). But when I try to send the mail I keep on bumping on that issue. I figured it had to do something with the template url, so I played around with the setting in the campaign:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entries of this type have their own URLs &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried pointing it to the template (&lt;code&gt;sproutemail/newsletter&lt;/code&gt;) or the name of the entry (&lt;code&gt;sproutemail/{slug}&lt;/code&gt;), both without any luck.&lt;/p&gt;&#xA;" OwnerUserId="4723" LastActivityDate="2016-03-21T12:03:50.903" Title="Sprout E-mail: 400: HTML Content URL Required - Campaign Monitor" Tags="&lt;emails&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14238" PostTypeId="2" ParentId="14237" CreationDate="2016-03-21T12:03:50.903" Score="2" Body="&lt;p&gt;Had a typo in my template directory.&lt;/p&gt;&#xA;" OwnerUserId="4723" LastActivityDate="2016-03-21T12:03:50.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14239" PostTypeId="2" ParentId="14164" CreationDate="2016-03-21T12:28:14.187" Score="0" Body="&lt;p&gt;So it turns out I needed to have the &quot;Options +FollowSymLinks&quot; block above the craft rewrite rule in my htaccess. See comments above.&lt;/p&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2016-03-21T12:28:14.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14240" PostTypeId="1" AcceptedAnswerId="14243" CreationDate="2016-03-21T12:47:29.180" Score="2" ViewCount="380" Body="&lt;p&gt;Simple question, are there performance gains or any other benefits to make it worth the effort of updating the server?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-03-21T13:20:05.873" Title="Are there any advantages of updating from PHP 5.4.40 to 5.6?" Tags="&lt;php&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14241" PostTypeId="1" AcceptedAnswerId="14242" CreationDate="2016-03-21T12:54:58.493" Score="3" ViewCount="48" Body="&lt;p&gt;I'm doing an import, and saving entries into a channel with &lt;code&gt;saveEntry()&lt;/code&gt;, but the entry's URL gets saved in the wrong format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL format for the channel is: &lt;code&gt;news/{postDate.year}/{slug}&lt;/code&gt; and I'm saving the entry with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$title = utf8_encode($article['article_language_name']);&#xA;$description = utf8_encode($article['article_description']);&#xA;$text = utf8_encode($article['article_text']);&#xA;$date = new \DateTime($article['article_start'], new \DateTimeZone('Europe/Oslo'));&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = $targetSectionId;&#xA;$entry-&amp;gt;typeId = $targetEntryType;&#xA;$entry-&amp;gt;authorId = $targetAuthorId;&#xA;$entry-&amp;gt;postDate = $date;&#xA;$entry-&amp;gt;enabled = true;&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = $title;&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'leadText' =&amp;gt; $description,&#xA;    'bodyText' =&amp;gt; $text&#xA;));&#xA;&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All the URIs lack the &lt;code&gt;year&lt;/code&gt; param in them, but that does get included if I save the entry via the CP afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? The &lt;code&gt;postDate&lt;/code&gt; seem to be in the correct format, but maybe I'm missing something?&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2016-03-21T13:09:22.277" Title="Entry URIs incorrect when using entriesService-&gt;saveEntry()" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14242" PostTypeId="2" ParentId="14241" CreationDate="2016-03-21T13:09:22.277" Score="3" Body="&lt;p&gt;Ok, so the answer was quite simple: I was using the PHP DateTime object instead of Crafts DateTime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removed the &lt;code&gt;\&lt;/code&gt; on this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$date = new \DateTime($article['article_start'], new \DateTimeZone('Europe/Oslo'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and everything worked perfectly.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2016-03-21T13:09:22.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14243" PostTypeId="2" ParentId="14240" CreationDate="2016-03-21T13:20:05.873" Score="5" Body="&lt;p&gt;Short yes! You can find a detailed Benchmark on &lt;a href=&quot;http://www.lornajane.net/posts/2014/php-5-6-benchmarks&quot;&gt;http://www.lornajane.net/posts/2014/php-5-6-benchmarks&lt;/a&gt;. If possible i would try to update from PHP 5.4.40 direct to PHP 7. The performance from PHP 5.4 to PHP 7 is massiv. A change to PHP7 made our Craft installation twice as fast. You can find some further information here -&gt; &lt;a href=&quot;https://pixelandtonic.com/blog/php-7&quot;&gt;https://pixelandtonic.com/blog/php-7&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-03-21T13:20:05.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14244" PostTypeId="2" ParentId="8824" CreationDate="2016-03-21T13:56:17.473" Score="-1" Body="&lt;p&gt;This worked for me. Add &lt;code&gt;data: data,&lt;/code&gt; before &lt;code&gt;dataType: &quot;json&quot;,&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the same error, and still get the same error if data source is not defined..&lt;/p&gt;&#xA;" OwnerUserId="4883" LastEditorUserId="4883" LastEditDate="2016-03-22T12:09:01.897" LastActivityDate="2016-03-22T12:09:01.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14245" PostTypeId="1" CreationDate="2016-03-21T15:42:36.017" Score="1" ViewCount="1398" Body="&lt;p&gt;I am using Craft Commerce for the first time and am trying to dynamically generate a dropdown menu that contains links to each product type. I thought the best way to accomplish this would be by using a parameter in the URL i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;myurl.com/commerce/products?cat=books&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be able to get the handle of the selected product type by using: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.commerce.products.type(productType).find()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two roadblocks that are preventing me from implementing this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I get an array of all the product types so I can build the dropdown?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I get the name of a product type once I have the handle so I can display a Header at the top of the page based on the selected product type?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also, is there a better way of implementing similar functionality that I am simply overlooking?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4916" LastEditorUserId="1016" LastEditDate="2016-03-21T16:11:50.413" LastActivityDate="2016-03-21T19:08:24.370" Title="Craft Commerce - Handling Product Types" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14246" PostTypeId="2" ParentId="14126" CreationDate="2016-03-21T17:13:28.670" Score="0" Body="&lt;p&gt;I don't feel I fully understand how you will be using the data on the back end, but here are some ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like the best way to solve this problem would be to build a custom field-type plugin that stored checkbox data in the way that you need it to be stored on the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simpler workaround may be to use a multi-line Plain Text field as your &quot;checkbox&quot; field.  You could display things however you want to the users on the front-end, and submit the checkbox data behind the scenes in a way that stores the data in that field in a readable way.  While the data may not behave like a checklist, you would get a snapshot of the checklist items for each submission and the length of items could vary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To capture the User ID and To-do List ID, you might be able to use the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field&quot; rel=&quot;nofollow&quot;&gt;Sprout Hidden Field&lt;/a&gt; or &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/invisible-field&quot; rel=&quot;nofollow&quot;&gt;Sprout Invisible Field&lt;/a&gt; which would just store those IDs in a plain text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to store the ID as relational data, you'll need to create the appropriate relational field (such as a Users Relations field) and submit the ID as an array:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[usersFieldHandle][]&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional examples of inputs to submit data from the front-end can be found in the &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow&quot;&gt;Craft Field Guide&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-03-21T17:13:28.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14247" PostTypeId="2" ParentId="14245" CreationDate="2016-03-21T18:02:39.927" Score="1" Body="&lt;p&gt;You can get all product types within your templates with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;  {{ productType.name }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no way to get a specific product type within templates at the moment, but I have added to the list. In the meantime you would need to look over all and find the one you want as above.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-03-21T18:02:39.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14248" PostTypeId="2" ParentId="14245" CreationDate="2016-03-21T19:08:24.370" Score="1" Body="&lt;p&gt;To expand on Luke's answer, you might try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;  &amp;lt;select name=&quot;availableProductTypes&quot;&amp;gt;&#xA;     {% for theType in craft.commerce.productTypes %}&#xA;        &amp;lt;option value=&quot;{{theType}}&quot;&amp;gt;{{theType.name}}&amp;lt;/option&amp;gt;&#xA;     {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Show&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can show what was selected in the dropdown:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('availableProductTypes') %}&#xA;&#xA; {% set theType = craft.request.getParam('availableProductTypes') %}&#xA;&#xA; &amp;lt;ul&amp;gt;&#xA;  {% for product in craft.commerce.products.type(theType).find() %}&#xA;   &amp;lt;li&amp;gt;{{product}}&amp;lt;/li&amp;gt;&#xA;  {% else %}&#xA;   &amp;lt;li&amp;gt;No products found.&amp;lt;/li&amp;gt;&#xA; {% endfor %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-03-21T19:08:24.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14249" PostTypeId="1" AcceptedAnswerId="14250" CreationDate="2016-03-21T20:32:02.703" Score="3" ViewCount="413" Body="&lt;p&gt;I'm a HUGE fan of Craft, but I'm wondering how specifically it's able to reuse fields in different sections. I'm very accustomed to an ExpressionEngine environment, where each field's shortname has to be unique. How did P&amp;amp;T build Craft so this is possible?&lt;/p&gt;&#xA;" OwnerUserId="4086" LastEditorUserId="45" LastEditDate="2016-08-13T02:33:35.340" LastActivityDate="2016-08-13T02:33:35.340" Title="How is Craft able to reuse fields in different Sections? (As opposed to EE.)" Tags="&lt;field&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14250" PostTypeId="2" ParentId="14249" CreationDate="2016-03-21T20:48:13.103" Score="6" Body="&lt;p&gt;In Craft, &lt;strong&gt;all&lt;/strong&gt; fields are stored in the &lt;code&gt;craft_content&lt;/code&gt; table. They are otherwise independent of any field groups, layouts, sections, or anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PRO:&lt;/strong&gt; This means that any element (Entry, Category, Asset, etc) can access any field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CON:&lt;/strong&gt; This means that every element carries the weight of every field. Though if those fields are all empty, the performance impact is almost non-existent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's historically been some minor debates over whether or not this tradeoff is worth it... But I think it's safe to say that the benefits vastly outweigh any negligible performance issues. The simple fact is, having all fields in the same table is rarely (never?) the true bottleneck.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-21T20:48:13.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14252" PostTypeId="2" ParentId="14199" CreationDate="2016-03-22T00:32:22.220" Score="0" Body="&lt;p&gt;This was related to the email template. The template includes &lt;code&gt;{% set number = craft.request.param('number') %}&lt;/code&gt;. .param('number') does not exist in the context of checkout. This means the order doesn't exist and the page redirects to commerce/customer which makes no sense when it comes to email. So no email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commenting out or removing &lt;code&gt;{% set number = craft.request.param('number') %}&lt;/code&gt; solves the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to P &amp;amp; T support for the answer. And to Jeremy Daalder for his help.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2016-03-22T00:32:22.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14253" PostTypeId="2" ParentId="13029" CreationDate="2016-03-22T04:29:38.620" Score="1" Body="&lt;p&gt;It's probably too late to help the OP (sorry @shorn), but here's how you would pull this off with Smart Map...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftpl.us/plugins/smart-map/docs/front-end-entry-form&quot; rel=&quot;nofollow&quot;&gt;Add the Address field on the front-end.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;label&amp;gt;Street Address&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][street1]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Apartment or Suite&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][street2]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;City&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][city]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;State&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][state]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Zip Code&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][zip]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][country]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Latitude&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][lat]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Longitude&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myAddressField][lng]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can inject the &lt;code&gt;lat&lt;/code&gt; and &lt;code&gt;lng&lt;/code&gt; values using JavaScript. Since you're doing that dynamically, you could even make those inputs &lt;code&gt;hidden&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-22T04:29:38.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14254" PostTypeId="1" CreationDate="2016-03-22T07:03:40.503" Score="1" ViewCount="1910" Body="&lt;p&gt;I am trying to install Craft on my server and I've hit a snug which I can't overcome, because I am just not that technically proficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I've followed all of the instructions on the Craft website to a t, however when I tried to get to the admin panel, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could not find your &lt;code&gt;craft/&lt;/code&gt; folder. Please ensure that &lt;code&gt;$craftPath&lt;/code&gt; is set correctly in &lt;code&gt;/home/toaeroplano/public_html/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some Googling on that and I found out that this might be an issue with &lt;code&gt;open_basedir&lt;/code&gt; permissions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I went to my php.ini file and I saw that this was edited out. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;; open_basedir, if set, limits all file operations to the defined directory&#xA;; and below.  This directive makes most sense if used in a per-directory&#xA;; or per-virtualhost web server configuration file. This directive is&#xA;; *NOT* affected by whether Safe Mode is turned On or Off.&#xA;;open_basedir =&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I changed it to: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open_basedir = ON (and took the ; off)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now I get a &quot;No input file specified.&quot; message. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do? Like I said, this is far from being my area of expertise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="4921" LastEditorUserId="57" LastEditDate="2016-03-22T17:11:22.337" LastActivityDate="2016-03-22T17:40:27.487" Title="Having problem with installing Craft" Tags="&lt;installation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14255" PostTypeId="1" CreationDate="2016-03-22T15:03:12.040" Score="2" ViewCount="2176" Body="&lt;p&gt;I'm trying to create an object of objects, can anyone suggest why &lt;code&gt;object&lt;/code&gt; would only contain the last iteration of &quot;itemObject&quot;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set object = {} %}&#xA;&#xA;{% for entry in craft.entries.section(&quot;mainSectionsStructure&quot;) %}&#xA;    {% set itemObject = {&#xA;            &quot;title&quot;: entry.title,&#xA;            &quot;link&quot;: entry.url&#xA;        } %}&#xA;&#xA;    {% set object = object|merge(itemObject) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{{ object|json_encode() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="125" LastEditDate="2016-03-22T16:02:21.757" LastActivityDate="2016-03-22T16:02:21.757" Title="Create an object of objects with merge" Tags="&lt;templating&gt;&lt;array&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14256" PostTypeId="2" ParentId="14255" CreationDate="2016-03-22T15:58:18.663" Score="3" Body="&lt;p&gt;You're overriding the &quot;title&quot; and &quot;link&quot; properties on every iteration. Wrap the &lt;code&gt;itemObject&lt;/code&gt; object in &lt;code&gt;[]&lt;/code&gt; to merge the whole object into your array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set object = object|merge([itemObject]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-22T15:58:18.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14257" PostTypeId="1" AcceptedAnswerId="14258" CreationDate="2016-03-22T15:58:56.053" Score="2" ViewCount="113" Body="&lt;p&gt;Bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shortly changing a site to run over https vs http - the issue is though that we need to maintain the Facebook open graph share data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Facebook makes distinction between https and http. The way to maintain this is just to add &lt;code&gt;&amp;lt;meta property=&quot;og:url&quot; content=&quot;//www.myurl.com/segment/segment&quot; /&amp;gt;&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a variable I can access that would output the current URL without the protocol?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-03-22T16:07:01.273" Title="Spitting out the URL of the entry" Tags="&lt;variable&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14258" PostTypeId="2" ParentId="14257" CreationDate="2016-03-22T16:07:01.273" Score="2" Body="&lt;p&gt;You could build it up using a couple of the request variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request.serverName ~'/'~ craft.request.getSegments | join('/') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-03-22T16:07:01.273" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14259" PostTypeId="2" ParentId="14254" CreationDate="2016-03-22T16:35:36.753" Score="1" Body="&lt;p&gt;It's likely your &lt;code&gt;/craft&lt;/code&gt; directory couldn't be found. Out of the box, Craft expects it's &lt;code&gt;/craft&lt;/code&gt; directory to be located just outside the root directory of the website. So by the looks of it from your path, your &lt;code&gt;index.php&lt;/code&gt; file is located here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/toaeroplano/public_html/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that would mean you &lt;code&gt;/craft&lt;/code&gt; directory should be located here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/toaeroplano/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I were you I'd put the php.ini settings back to what they were so you get the original error, then make sure you've copied the &lt;code&gt;/craft&lt;/code&gt; directory from the installation into the directory above. If you want your &lt;code&gt;/craft&lt;/code&gt; directory somewhere else you need to edit the &lt;code&gt;index.php&lt;/code&gt; and specify where the directory lives. So edit this line in &lt;code&gt;index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../craft'; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;..&lt;/code&gt; in the path just means the directory above, so if you wanted it to live in the &lt;code&gt;/home&lt;/code&gt; directory, you change it to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Also make sure the permissions on the &lt;code&gt;/craft/app/&lt;/code&gt;, &lt;code&gt;craft/config/&lt;/code&gt; and &lt;code&gt;craft/storage/&lt;/code&gt; are set as per the &lt;a href=&quot;https://craftcms.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow&quot;&gt;install docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-03-22T16:42:26.197" LastActivityDate="2016-03-22T16:42:26.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14260" PostTypeId="1" AcceptedAnswerId="14261" CreationDate="2016-03-22T16:50:58.330" Score="0" ViewCount="498" Body="&lt;p&gt;For a menu I have to check if a &lt;code&gt;lightswitch&lt;/code&gt; field is on or not. The menu is in an extra header file. I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('aboutus').lightswitch_field %}style=&quot;display: none;&quot;{% else %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this always jumps into the &lt;code&gt;else&lt;/code&gt; part.&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T22:06:41.820" LastActivityDate="2017-05-09T22:06:41.820" Title="Check in header file if lightswitch field is on" Tags="&lt;templating&gt;&lt;entries&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14261" PostTypeId="2" ParentId="14260" CreationDate="2016-03-22T17:17:48.370" Score="1" Body="&lt;p&gt;Try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if craft.entries.section('aboutus').lightswitch_field('1')|length&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to check if it is &quot;off&quot; use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if craft.entries.section('aboutus').lightswitch_field('not 1')|length&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-03-23T18:09:14.537" LastActivityDate="2016-03-23T18:09:14.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14262" PostTypeId="1" CreationDate="2016-03-22T17:30:04.040" Score="1" ViewCount="216" Body="&lt;p&gt;I'm pretty new to Craft, so I'd like to know if there's a best practice when linking to a section, assuming the section has an &lt;code&gt;index.html&lt;/code&gt; template for its &quot;homepage.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using the following to loop through all Sections and then give me their URL, but in sort of a hacky way. This is one of a couple ways I've found to do this, but my Homepage singlepage entry outputs as &lt;code&gt;http://example.com/__home__&lt;/code&gt; which is super weird.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getAllSections() %}  &#xA;&#xA;{% for section in sections %}&#xA;    &amp;lt;li class=&quot;nav__link&quot; id=&quot;nav__link--{{ section.handle }}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ siteUrl }}{{ section.template|split('/')[0] }}&quot;&amp;gt;{{ section }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;```&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the best practice is to do something completely different, then feel free to set me straight! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastEditorUserId="57" LastEditDate="2016-03-22T18:07:26.627" LastActivityDate="2016-03-22T18:07:26.627" Title="Linking to Sections: do it or do something different?" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14263" PostTypeId="2" ParentId="14254" CreationDate="2016-03-22T17:34:14.970" Score="0" Body="&lt;p&gt;&lt;code&gt;open_basedir&lt;/code&gt; is actually expecting a path (like &lt;code&gt;/home/toaeroplano&lt;/code&gt;) and   some hosts use it as a form of &quot;jailing&quot; their users to help make sure PHP can't access anything from &lt;em&gt;outside&lt;/em&gt; whatever value is set there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Steve mentioned in his answer, don't set it unless you know what you're doing. I don't know how you're hosting Craft, but some hosts will lock down the server in other ways—for example, &lt;code&gt;mod_security&lt;/code&gt; might be preventing you from hitting anything outside the web root as well—in your case &lt;code&gt;/public_html/&lt;/code&gt;—so you may have to set &lt;code&gt;$craftPath&lt;/code&gt; to &lt;code&gt;./craft&lt;/code&gt; so it's looking in the same &quot;folder&quot; and move your &lt;code&gt;craft&lt;/code&gt; folder to &lt;code&gt;public_html&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-03-22T17:40:27.487" LastActivityDate="2016-03-22T17:40:27.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14264" PostTypeId="2" ParentId="14262" CreationDate="2016-03-22T18:05:46.413" Score="1" Body="&lt;p&gt;I've found what is probably a better solution;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create a Single section for each Channel/Structure and use that as a directory for that channel/structure. I then loop through all sections and see if they're of the single type, then get the first (and only) entry of that section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all Section #}&#xA;{% set sections = craft.sections.getAllSections() %}&#xA;&#xA;{# Loop through all single sections #}&#xA;{% for singleSection in sections if singleSection.type == 'single' %}&#xA;&#xA;    {# Get the first (and only) entry of that section #}&#xA;    {% set singleEntry = craft.entries.sectionId(singleSection.id).first %}&#xA;&#xA;    {# Output #}&#xA;     &amp;lt;li class=&quot;nav__link&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ singleEntry.url }}&quot; class=&quot;section-link&quot;&amp;gt;{{ singleSection }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if you guys have a better way of doing this!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2016-03-22T18:05:46.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14265" PostTypeId="1" CreationDate="2016-03-22T18:24:39.480" Score="1" ViewCount="376" Body="&lt;p&gt;I am using a structure for navigation. The structure has two fields :&#xA;entry field: 'contentLink'&#xA;custom link: 'customLink'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are used to create a menu structure like:&#xA;About&#xA;- sub item 1&#xA;- sub item 2&#xA;- sub item 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section for this is set to have no url templates setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry links for sub item 1 to 3 point at entries in a page structure called 'pages' which is currently flat (ie no children)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template i am using a drop-down menu and code to get child items which works OK. &#xA;    {% set menuentries = craft.entries.section('topnav') %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in menuentries %}&#xA;&#xA;    {% if entry.contentLink.first|length %}&#xA;        {# attempt to set navlink var #}&#xA;        {% set navlink = entry.contentLink.first().slug %}&#xA;&#xA;    {% elseif entry.customLink|length %}&#xA;&#xA;        {% set navlink = entry.customLink %}&#xA;&#xA;    {% endif %}&#xA;&#xA;     {% if entry.level == 1 and entry.children|length %}&#xA;        &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;{{ entry.title }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;ul class=&quot;dropdown-menu&quot; role=&quot;menu&quot;&amp;gt;&#xA;                {% for child in entry.getDescendants() %}&#xA;                    &amp;lt;li class=&quot;&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ siteUrl }}{{ child.slug }}&quot;&amp;gt;{{ child.title }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;             &amp;lt;/ul&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;&#xA;    {% elseif entry.level == 1 and not entry.hasDescendants() %}&#xA;&#xA;         &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i cant figure out how to get:&#xA;a) a url for child.slug that reflects the heirarchy of the menu structure&#xA;b) parent and child active classes for highlighting / breadcrumb purposes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;question restated:&#xA;How can I output child urls that reflect the a structured menu hierarchy like: 'about/sub item1' when the structure has no URL format specified?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-03-22T19:38:03.787" Title="How can I output child urls that reflect a structured menu hierarchy when the structure has no URL format specified?" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14266" PostTypeId="2" ParentId="14265" CreationDate="2016-03-22T19:38:03.787" Score="1" Body="&lt;p&gt;Craft can't really produce the uri patterns/routes you need automatically without giving it something to work with. With that said there are a couple of ways to approach this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) One option is to simply make your pages section into a structure; creating the needed hierarchy elements, and use it directly to generate your navigation. You may also want to specify additional 'entryType(s)' for header items, etc (i.e. items that don't have a corresponding page and/or are used exclusively for creating the nested route structure or for navigation headers, buttons, etc). You can then test &lt;code&gt;entry.type&lt;/code&gt; in your template and deny or reroute the request accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Another option is to define a url format for your nav structure, which represents the uri pattern(s) that you would like to have (i.e. if the structure represents the site root then set the uri to &lt;code&gt;{slug}&lt;/code&gt; and children to &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this approach, you would want to set up a template for your navigation structure which essentially &lt;code&gt;includes&lt;/code&gt; the corresponding page template, as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this perhaps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% set relatedPage = entry.contentLink.first %}&#xA;    {% type = relatedPage.type %}&#xA;    {% include [&quot;pages/_types/&quot; ~ type, &quot;pages/_types/default&quot;] with { 'entry': relatedPage } %}&#xA;{% else %}&#xA;    {% redirect '404' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that when including the page template, we are redefining the &lt;code&gt;entry&lt;/code&gt; variable to be the related page, so that the 'page' template doesn't have to worry about it, and can be loaded directly or via the navigation template as needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: you may want to disable urls for your pages channel if you don't ever want users to access pages through those routes.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-03-22T19:38:03.787" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14267" PostTypeId="1" AcceptedAnswerId="19431" CreationDate="2016-03-22T21:03:44.010" Score="2" ViewCount="548" Body="&lt;p&gt;After looking at the &lt;a href=&quot;https://craftcommerce.com/features&quot; rel=&quot;nofollow&quot;&gt;Features page&lt;/a&gt; for Craft Commerce, I didn't see anything regarding multi-currency support. Is this something that's available for certain payment processors?&lt;/p&gt;&#xA;" OwnerUserId="496" LastActivityDate="2017-03-14T16:40:30.573" Title="Does Craft Commerce support multi-currency?" Tags="&lt;plugin-craftcommerce&gt;&lt;currency&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14268" PostTypeId="2" ParentId="14267" CreationDate="2016-03-22T21:08:06.973" Score="2" Body="&lt;p&gt;Not at this time (version 1.1), but Pixel &amp;amp; Tonic has indicated in Craft Slack that it is on the roadmap.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-03-22T21:08:06.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14269" PostTypeId="1" AcceptedAnswerId="14274" CreationDate="2016-03-22T23:43:42.123" Score="2" ViewCount="462" Body="&lt;p&gt;I am migrating a static HTML site to Craft, and trying to apply image transforms to specific images without running them through a Craft field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I have the image path hardcoded in the template, and would like to apply an existing transform to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to set my image path as a Twig variable and then call &lt;code&gt;getUrl('medium')&lt;/code&gt; on that - but i get the error because I am passing a &lt;code&gt;String&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to store the image path in an array variable, but it's not working either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to achieve this and pass a static path to &lt;code&gt;getUrl()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4130" LastEditorUserId="57" LastEditDate="2016-03-23T02:35:53.370" LastActivityDate="2016-03-23T04:26:06.457" Title="Pass hardcoded path to getUrl()" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14271" PostTypeId="1" CreationDate="2016-03-23T01:22:00.263" Score="1" ViewCount="148" Body="&lt;p&gt;I am trying to update Craft, but when I do, it says update complete, but still shows that there is an update available. It stays on version 2.5.2759 but never updates to the latest 2.6.2776 version. I am running PHP 5.5 and Craft is installed locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I can diagnose what is going on?&lt;/p&gt;&#xA;" OwnerUserId="936" LastEditorUserId="57" LastEditDate="2016-03-23T02:39:36.060" LastActivityDate="2016-03-23T02:39:36.060" Title="Craft update doesn't update" Tags="&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14272" PostTypeId="2" ParentId="14271" CreationDate="2016-03-23T02:39:11.670" Score="2" Body="&lt;p&gt;The update process gets extensively logged in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;, so that's the place to go to start diagnosing.  You can search for &lt;code&gt;[error]&lt;/code&gt; once you find where the update logs start and see if it reveals anything useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If nothing jumps out at you, you can contact support@craftcms.com and they can help diagnose the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-23T02:39:11.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14273" PostTypeId="2" ParentId="14226" CreationDate="2016-03-23T03:13:59.407" Score="1" Body="&lt;p&gt;Don't know if this is the most efficient way, but you can always get the category using the ElementsService.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'categoryGroup';&#xA;$criteria-&amp;gt;slug = 'categorySlug';&#xA;$categories = $criteria-&amp;gt;find();&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'section';&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $categories,&#xA;    'field'         =&amp;gt; 'relationField'&#xA;);&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-03-23T03:19:05.267" LastActivityDate="2016-03-23T03:19:05.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14274" PostTypeId="2" ParentId="14269" CreationDate="2016-03-23T04:15:33.717" Score="5" Body="&lt;p&gt;I don't think that Craft can do this natively, and would guess that it needs an AssetModel in order to determine where to create the image transforms, etc. Your best bet would be to add the images to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the images are stored locally, this is pretty easy:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;create an asset source that points to the folder where your images are stored&lt;/li&gt;&#xA;&lt;li&gt;go to settings and update asset indexes for the new asset source&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If your filenames are all unique then you can reference the image by filename in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.filename('filename.jpg').first() %}&#xA;{% if asset is defined %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl('medium') }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you will need to add &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets#folderId&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;folderId&lt;/code&gt;&lt;/a&gt; to the criteria, or add the asset to the current entry via an assetField and reference through the assetField.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Another option, although not recommended, would be to add the images to an asset source as above; update indexes; then create a template that just renders all images in the asset source (using &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets#source&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;source('assetSource')&lt;/code&gt;&lt;/a&gt; criteria), rendered with the given transform. You can then just hard code the path to the image using the image transform folder ('myimages/_medium' folder). But you could just as easily use photoshop for this.)&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="57" LastEditDate="2016-03-23T04:26:06.457" LastActivityDate="2016-03-23T04:26:06.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14276" PostTypeId="2" ParentId="238" CreationDate="2016-03-23T04:50:28.430" Score="9" Body="&lt;p&gt;It's worth noting that as of Craft 2.5, it's now using Redactor II, so the above code examples don't work if you have upgraded. Here's a working &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSON config&lt;/a&gt; example you can build on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;image&quot;],&#xA;    &quot;plugins&quot;:[&quot;source&quot;,&quot;fullscreen&quot;],&#xA;    &quot;toolbarFixed&quot;: true,&#xA;    &quot;formatting&quot;: [&quot;p&quot;, &quot;blockquote&quot;, &quot;h2&quot;, &quot;h3&quot;, &quot;h4&quot;, &quot;h5&quot;, &quot;h6&quot;],&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;para-intro&quot;: {&#xA;            title: &quot;Paragraph Intro&quot;,&#xA;            args: [&quot;p&quot;, &quot;class&quot;, &quot;intro&quot;, &quot;toggle&quot;]&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above includes new format for formattingAdd, but also note that some button names have changed, ie format. Source and full screen are now plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read up more on the various options for formattAdd at &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/docs/settings/formatting/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Craft install existed prior to 2.5 and you used non standard Redactor configs, it's also worth reading &lt;a href=&quot;https://craftcms.com/support/redactor-ii-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/redactor-ii-configs&lt;/a&gt; which covers updating your Craft Redactor configs to be compatable with Redactor II&lt;/p&gt;&#xA;" OwnerUserId="117" LastEditorUserId="-1" LastEditDate="2017-10-19T01:59:03.777" LastActivityDate="2017-10-19T01:59:03.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14277" PostTypeId="2" ParentId="13919" CreationDate="2016-03-23T05:07:51.833" Score="2" Body="&lt;p&gt;I don't have much experience using tasks, but I often write plugin methods to move data around. Typically, I just use the EntriesService &lt;a href=&quot;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;saveEntry&lt;/code&gt;&lt;/a&gt; or RelationService &lt;a href=&quot;https://craftcms.com/classreference/services/RelationsService#saveRelations-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;saveRelation&lt;/code&gt;&lt;/a&gt; as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample from a recent data move:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Assign category and save entries&#xA;    foreach($unassignedEntries as $entry) {&#xA;&#xA;        $success = craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $entry, array($categoryId));&#xA;&#xA;        if (!$success) {&#xA;            LogicPlugin::log('Couldn’t update entry &quot;'.$entry-&amp;gt;title.'&quot;', LogLevel::Error);&#xA;        }&#xA;        else {&#xA;            LogicPlugin::log('Successfully updated entry &quot;'.$entry-&amp;gt;title.'&quot;', LogLevel::Info);&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-03-23T05:07:51.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14278" PostTypeId="1" CreationDate="2016-03-23T05:40:51.633" Score="3" ViewCount="422" Body="&lt;p&gt;I need to take a file, and email it to a large group of people. Naturally, I'll be using a custom plugin Controller to trigger the email blast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm already aware of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1533/best-way-to-include-attachments-using-emailservice-craft-plugin&quot;&gt;this similar thread&lt;/a&gt;, but I don't believe it will solve my problem. If I remember correctly, Craft's native email model isn't capable of sending to more than one person at a time. More importantly, &lt;em&gt;I don't want our server to be labeled as a spammer!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it make sense to run this process through a Task? Each individual email could be sent out as a separate step in the task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the best way to bulk email an attachment?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-28T00:50:30.517" Title="Best way to bulk email an attachment?" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14279" PostTypeId="1" CreationDate="2016-03-23T06:16:53.607" Score="1" ViewCount="854" Body="&lt;p&gt;I have a single asset field that handles two kinds of images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Big Banner image&#xA;2) Small featured image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is I want to check for the presence of the second image before I output it on the page. I am doing it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% if entry.igBanner[1] | length %}&#xA;      {% set asset = entry.igBanner[1] %}&#xA;      &amp;lt;img src={{ asset.url }} class=&quot;img-responsive&quot; alt={{entry.title}}&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I try to check the length of an empty index (where the image is not ), my template crashes saying I am trying to pull a method on a null variable. How do I check the presence of an image asset at index&lt;code&gt;[1]&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="597" LastEditorUserId="597" LastEditDate="2016-03-23T06:48:33.530" LastActivityDate="2016-03-23T07:51:25.523" Title="How do I check for the presence of an asset before accessing an empty asset field?" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14280" PostTypeId="2" ParentId="14279" CreationDate="2016-03-23T07:51:25.523" Score="3" Body="&lt;p&gt;You could just check the length of the whole asset array first, to make sure there are two images. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.igBanner | length) &amp;gt; 1 %}&#xA;    {% set asset = entry.igBanner[1] %}&#xA;    &amp;lt;img src={{ asset.url }} class=&quot;img-responsive&quot; alt={{entry.title}}&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-03-23T07:51:25.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14281" PostTypeId="1" CreationDate="2016-03-23T08:58:55.020" Score="1" ViewCount="425" Body="&lt;p&gt;Has anybody had issues importing JSON into table fields with the Feedme plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got an issue where empty values in my feed are not being parsed into the correct table rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Me2pE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Me2pE.png&quot; alt=&quot;Source JSON&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result (after import):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cLkgF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cLkgF.png&quot; alt=&quot;result (after import)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how best to resolve?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-03-25T12:31:06.383" Title="Feedme plugin: importing tables" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2017-05-26T16:32:33.263" ContentLicense="CC BY-SA 3.0" />
  <row Id="14282" PostTypeId="1" AcceptedAnswerId="14324" CreationDate="2016-03-23T11:33:05.390" Score="3" ViewCount="1844" Body="&lt;p&gt;As you can see in the code below I'm currently searching for the keyword but how can I make it so it picks up on entries that have a matching keyword, location &amp;amp; salary or if they don't fill out one of the fields then just search using the remaining fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set keywordQuery = craft.request.getParam('keyword') %}&#xA;{% set locationQuery = craft.request.getParam('location') %}&#xA;{% set salaryQuery = craft.categories.getParam('salary') %}&#xA;&#xA;{% set entries = craft.entries.search(keywordQuery).order('score') %}&#xA;&#xA;&amp;lt;form action=&quot;{{ url('jobs/list') }}&quot; class=&quot;submit-this&quot;&amp;gt;&#xA;     &amp;lt;ul&amp;gt;&#xA;         &amp;lt;li&amp;gt;&#xA;             &amp;lt;input type=&quot;text&quot; name=&quot;keyword&quot; placeholder=&quot;Keyword&quot;&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;         &amp;lt;li&amp;gt;&#xA;             &amp;lt;input type=&quot;text&quot; name=&quot;location&quot; placeholder=&quot;Town, City, Postcode&quot;&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;         &amp;lt;li class=&quot;select&quot;&amp;gt;&#xA;              &amp;lt;select name=&quot;salary&quot;&amp;gt;&#xA;                   {% for category in craft.categories.group('salary') %}&#xA;                         &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;                   {% endfor %}&#xA;              &amp;lt;/select&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;         &amp;lt;li&amp;gt;&#xA;              &amp;lt;input type=&quot;submit&quot; name=&quot;search&quot; value=&quot;Search&quot; class=&quot;form-submit&quot;&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    &amp;lt;div class=&quot;entry-section{% if loop.index is even %} grey{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/h3&amp;gt;&#xA;            {{ entry.jobsExcerpt }}&#xA;            &amp;lt;div class=&quot;footer&quot;&amp;gt;&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% for block in entry.location %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                            &amp;lt;img src=&quot;{{ block.icon.first().url }}&quot;&amp;gt;&#xA;                            &amp;lt;span&amp;gt;&#xA;                                {% for category in block.category.limit(1) %}&#xA;                                    {{ category.title }}&#xA;                                {% endfor %}&#xA;                            &amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}    &#xA;                    {% for block in entry.salary %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                            &amp;lt;img src=&quot;{{ block.icon.first().url }}&quot;&amp;gt;&#xA;                            &amp;lt;span&amp;gt;&#xA;                                {% for category in block.category.limit(1) %}&#xA;                                    {{ category.title }}&#xA;                                {% endfor %}&#xA;                            &amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                    {% for block in entry.keyword %}    &#xA;                        &amp;lt;li&amp;gt;&#xA;                            &amp;lt;img src=&quot;{{ block.icon.first().url }}&quot;&amp;gt;&#xA;                            &amp;lt;span&amp;gt;&#xA;                                {% for category in block.category.limit(1) %}&#xA;                                    {{ category.title }}&#xA;                                {% endfor %}&#xA;                            &amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}    &#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;  &#xA;        &amp;lt;div class=&quot;side-bar&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;button&quot;&amp;gt;&#xA;                Apply&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just can't seem to figure it out, any help would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4923" LastEditorUserId="4923" LastEditDate="2016-03-23T15:55:44.800" LastActivityDate="2016-03-26T01:47:01.450" Title="Searching multiple queries using CraftCMS search function" Tags="&lt;search&gt;&lt;craft-features&gt;&lt;query&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14284" PostTypeId="2" ParentId="14281" CreationDate="2016-03-23T12:11:54.780" Score="2" Body="&lt;p&gt;I'm sure I can give you a hand (Feed Me developer here) - would you be able to submit a Help request using the instructions here - &lt;a href=&quot;https://github.com/engram-design/FeedMe#support&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe#support&lt;/a&gt;? Happy to post back findings here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Thanks for your patience - This was indeed a bug, which has been fixed in the &lt;a href=&quot;https://github.com/engram-design/FeedMe/archive/master.zip&quot; rel=&quot;nofollow&quot;&gt;latest master&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you continue to have issues!&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2016-03-25T12:31:06.383" LastActivityDate="2016-03-25T12:31:06.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14285" PostTypeId="1" CreationDate="2016-03-23T12:16:16.483" Score="0" ViewCount="2503" Body="&lt;p&gt;I'm trying to pull out selected categories in a front-end user profile. The cats have 2 levels and need to be pulled out into a nested list with only the selected options. I've tried different ways of doing this but nothing seems to work by using one for loop. So have nested the second level cats in a second for loop. This will work but the loop.first and loop.last variables are using the parent for loop and not the nested one? Or is there a better/easier way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for challenge in user.challenges.level(1).options %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ challenge.title }}&#xA;        {% for child in user.challenges.level(2).options %}&#xA;            {% if child and child.getParent().id == challenge.id %}&#xA;                {% if loop.first %}&amp;lt;ul&amp;gt;{% endif %}&#xA;                    &amp;lt;li&amp;gt;{{ child.title }}&amp;lt;/li&amp;gt;&#xA;                {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-03-23T14:11:40.117" Title="Issue with twig loop.first loop.last contained in nested for statement" Tags="&lt;templating&gt;&lt;categories&gt;&lt;forloop&gt;&lt;category&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14286" PostTypeId="2" ParentId="14179" CreationDate="2016-03-23T12:23:13.527" Score="1" Body="&lt;p&gt;Turned out to be a browser issue specific to one mac. And we also noticed that when using chromes device mode it seemed to kill the session!&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-03-23T12:23:13.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14288" PostTypeId="1" CreationDate="2016-03-23T12:54:15.337" Score="3" ViewCount="741" Body="&lt;p&gt;Two sections:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Products&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Authors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Products&quot; section pulls the author name from the &quot;Authors&quot; section through an entries type field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to order the products first by authors (alphabetically), then by title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does not accept the author field handle in the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.order('authors','title').&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the &quot;Products&quot; template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.commerce.products.type('Products').relatedTo(category) %}&#xA;{% for entry in entries.order('author','title').limit(0) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is missing?&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2016-03-25T13:25:48.883" Title="How to order by related entry type field" Tags="&lt;relations&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14289" PostTypeId="2" ParentId="14285" CreationDate="2016-03-23T14:04:26.767" Score="1" Body="&lt;p&gt;You should be able to access the outer &lt;code&gt;loop.index&lt;/code&gt; etc using the &lt;code&gt;loop.parent&lt;/code&gt; context. The Twig docs &lt;a href=&quot;http://twig.sensiolabs.org/doc/recipes.html#accessing-the-parent-context-in-nested-loops&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; should give you what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: You might be getting strange results because the inner loop contains an &lt;code&gt;if&lt;/code&gt; so depending on your conditions you might loop over the first item thus making your inner &lt;code&gt;loop.first&lt;/code&gt; not work as expected. You can combine &lt;code&gt;for&lt;/code&gt; with an &lt;code&gt;if&lt;/code&gt; which might get you a bit closer, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for thing in things if thing.isAvailable == true %}&#xA;{{-- Your inner stuff --}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-03-23T14:11:40.117" LastActivityDate="2016-03-23T14:11:40.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14290" PostTypeId="1" CreationDate="2016-03-23T14:24:01.513" Score="3" ViewCount="1099" Body="&lt;p&gt;Is there a way I can have the array from &lt;code&gt;craft.commerce.countriesList&lt;/code&gt; automatically default to the country my store is in?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-08-26T15:02:26.453" Title="Have the country in craft.commerce.countriesList default" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14292" PostTypeId="2" ParentId="14278" CreationDate="2016-03-23T17:15:40.377" Score="4" Body="&lt;p&gt;There's nothing that says you have to go through Craft's &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel&quot; rel=&quot;nofollow&quot;&gt;EmailModel&lt;/a&gt;/&lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow&quot;&gt;EmailService&lt;/a&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft ultimately uses the &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; rel=&quot;nofollow&quot;&gt;PHPMailer&lt;/a&gt; library, so you can instantiate it directly and use whatever settings you need (or use a completely &lt;a href=&quot;http://swiftmailer.org/&quot; rel=&quot;nofollow&quot;&gt;different library&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you don't want to cram everyone into to &quot;To Address&quot;, so is the plan to set the &quot;To Address&quot; to yourself and BCC the recipient list?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the number of emails you need to send, I'd probably just have your plugin read from the file and insert into a database table.  Then you could setup a cron job to hit your plugin's controller action to send out (one at a time) X emails over Y time period and delete those from the table until its empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as not getting flagged as a SMTP relay, in addition to throttling email rates, there are &lt;a href=&quot;https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&quot; rel=&quot;nofollow&quot;&gt;definitely&lt;/a&gt; &lt;a href=&quot;https://www.mail-tester.com/&quot; rel=&quot;nofollow&quot;&gt;other&lt;/a&gt; things you can do to reduce your chances.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-03-23T18:11:14.630" LastActivityDate="2016-03-23T18:11:14.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14293" PostTypeId="2" ParentId="14290" CreationDate="2016-03-23T18:34:48.783" Score="3" Body="&lt;p&gt;Not particularly proud of this code, but if you want to do it from Twig, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countryList = ['United Kingdom', 'United States'] %}&#xA;&#xA;{% for country in craft.commerce.countriesList() %}&#xA;    {% if country != 'United Kingdom' and country != 'United States' %}&#xA;        {% set countryList = countryList|merge([country]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for country in countryList %}&#xA;        &amp;lt;li&amp;gt;{{ country }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-23T18:34:48.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14294" PostTypeId="1" CreationDate="2016-03-23T18:44:33.237" Score="4" ViewCount="184" Body="&lt;p&gt;This is my first try at Craft, was planning on replicating a current site as practice, had a question about the sites architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Brands page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Brand/Company info&#xA;-Brand product line&#xA;--individual products within that line&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to implement this? &#xA;I'm thinking a structure? They are child's of each other? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4929" LastEditorUserId="57" LastEditDate="2016-03-23T22:13:09.903" LastActivityDate="2016-03-27T07:49:47.807" Title="Website structure with Craft" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14295" PostTypeId="2" ParentId="14294" CreationDate="2016-03-23T19:23:35.750" Score="4" Body="&lt;p&gt;I'd probably have products as a channel and then a product being tied to a category so and then category urls would be something like &lt;code&gt;/products/category&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-03-23T19:23:35.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14296" PostTypeId="1" AcceptedAnswerId="14299" CreationDate="2016-03-23T22:43:02.227" Score="4" ViewCount="12449" Body="&lt;p&gt;I am trying to check for the existence of a text field and an asset field and set an icon variable depending on the result.&#xA;I don't seem to be having much luck with defined, length and empty combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (story.videoStoryUrl is defined) and (not story.storyImage | length) %}&#xA;    {% set icon = &quot;video&quot; %}&#xA;{% elseif (story.videoStoryUrl is empty) and (not story.storyImage | length) %}&#xA;    {% set icon = &quot;text&quot; %}&#xA;{% else %}&#xA;    {% set icon = &quot;image&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-03-23T23:00:02.337" LastActivityDate="2016-03-24T03:40:41.280" Title="Twig combined conditionals to set variable" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14297" PostTypeId="2" ParentId="14205" CreationDate="2016-03-23T22:57:23.500" Score="2" Body="&lt;p&gt;Sorry guys: It was me -- I had cached the form, and the error message works fine when I removed this. Took me a day to find. I've got a lot to learn!&lt;/p&gt;&#xA;" OwnerUserId="605" LastActivityDate="2016-03-23T22:57:23.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14298" PostTypeId="1" CreationDate="2016-03-23T23:26:14.163" Score="1" ViewCount="84" Body="&lt;p&gt;I have a plugin that uses a datetime variable to record a class start time.  When I save the training record the time is changed from local MDT to GMT into the database, and when displayed again it is six hours off.  Changing the form as follows fixes the problem: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ forms.timeField({&#xA;    id: 'classTime',&#xA;    required: false,&#xA;    name: 'training[classTime]',&#xA;    value: training.classTime  ? training.classTime|date_modify(&quot;+6 hour&quot;) : null,&#xA;    errors: training.errors ? training.errors('classTime') : null,&#xA;    }) }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice my training dates are also impacted.  Listing date on index.html shows one day prior, but the database stores values correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where and when do I fix dates coming and going from the mysql store?&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="3597" LastEditDate="2016-03-24T13:43:06.450" LastActivityDate="2016-03-24T13:43:06.450" Title="forms.timeField not respecting time zone" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;timezone&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14299" PostTypeId="2" ParentId="14296" CreationDate="2016-03-24T03:40:41.280" Score="4" Body="&lt;p&gt;It's probably better if you set variables to reference, so your if statements make more sense.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = story.storyImage.first() %}&#xA;{% set videoUrl = story.videoStoryUrl %}&#xA;{% set icon = &quot;text&quot; %}&#xA;&#xA;{% if asset | length %}&#xA;    {% if videoUrl is empty %}&#xA;        {% set icon = &quot;video&quot; %}&#xA;     {% else %}&#xA;        {% set icon = &quot;image&quot; %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{{ icon }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4210" LastActivityDate="2016-03-24T03:40:41.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14300" PostTypeId="1" CreationDate="2016-03-24T04:55:07.517" Score="3" ViewCount="122" Body="&lt;p&gt;How to set a dynamic path for &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; that contains the username (or any other field from the user profile)? &lt;/p&gt;&#xA;" OwnerUserId="4138" LastActivityDate="2016-03-24T16:29:12.777" Title="Set a dynamic `activateAccountSuccessPath`" Tags="&lt;config&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14301" PostTypeId="1" CreationDate="2016-03-24T05:30:56.597" Score="3" ViewCount="870" Body="&lt;p&gt;I have a front-end form that posts through the ID of a particular element/entry to a back-end controller. Is there any way to encrypt/hash that ID on the front-end, so the plain ID number is not visible, and then decrypt that ID in the back-end controller?&lt;/p&gt;&#xA;" OwnerUserId="4890" LastActivityDate="2016-03-24T14:00:12.697" Title="Encrypt ID on front-end and decrypt on back-end" Tags="&lt;form&gt;&lt;security&gt;&lt;hash&gt;&lt;id&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14302" PostTypeId="2" ParentId="14301" CreationDate="2016-03-24T05:31:48.893" Score="3" Body="&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;foo&quot; value=&quot;{{ 'bar'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in your controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (($foo = craft()-&amp;gt;request-&amp;gt;getPost('foo')) !== null)&#xA;{&#xA;    $foo = craft()-&amp;gt;security-&amp;gt;validateData($foo);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;at which point $foo will either be &lt;code&gt;null&lt;/code&gt; (not present), &lt;code&gt;false&lt;/code&gt; (present but tampered with), or a string (present and valid)&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="125" LastEditDate="2016-03-24T07:30:32.707" LastActivityDate="2016-03-24T07:30:32.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14303" PostTypeId="1" AcceptedAnswerId="14304" CreationDate="2016-03-24T07:50:46.977" Score="2" ViewCount="1008" Body="&lt;p&gt;I'm setting up my first multilingual website with Craft. I'm struggling with multilingual slugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I'd like the slugs to look like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cEphh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cEphh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this tough, I need to adapt my folder structure. To get it working I needed to create folder structure like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/fr/nouvelles/&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;/en/news/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both containing the same templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to get this working without needing to copy the templates? I'd like to always load the same template(/news/), without the language specific folder structure.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2016-03-24T15:13:36.500" LastActivityDate="2016-03-24T15:13:36.500" Title="Multilingual slug setup" Tags="&lt;localization&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14304" PostTypeId="2" ParentId="14303" CreationDate="2016-03-24T08:48:53.533" Score="4" Body="&lt;p&gt;The problem you're &lt;em&gt;probably&lt;/em&gt; facing isn't that URLs like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://example.com/en/news/example&quot; rel=&quot;nofollow&quot;&gt;http://example.com/en/news/example&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://example.com/fr/nouvelles/exemple&quot; rel=&quot;nofollow&quot;&gt;http://example.com/fr/nouvelles/exemple&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;don't work, but that you're not getting the sections' index pages to load because they're just a index.html file in your templates/news/ folder (→ routing case 6 in &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a multi locale setup with translated slugs it's recommended to not rely on &quot;URI to template matching&quot; at all and create an entry or category for every page, so Craft sets up the routes for all the translated slugs automatically (→ routing case 4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you'd just create an entry for your News index page, e.g through a single section. In the single section's settings set up the URLs for your locales and route them to your template.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-24T08:48:53.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14305" PostTypeId="1" CreationDate="2016-03-24T11:25:46.303" Score="1" ViewCount="89" Body="&lt;p&gt;When saving an entry, Craft will sit endlessly waiting for the page to load. I've seen this behaviour intermittently in the past - but not for months. It's doing it again now though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems to me to be related to PHP or Apache in some way. I can restart Apache and Craft will then work fine on the first save, but edit and save again and it'll sit spinning forever. The 'hung' save does actually work, you can see changes reflected by checking the front-end in a different browser. However, while the save 'redirect' is hung, you can't browse any of the website, back-end or front, from the browser you were using to edit the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only happening on our staging server, not our local machines, though both run the same website and same database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Staging is Debian Jessie, on PHP 5.6.17-0+deb8u1 and Apache/2.4.10 (Debian). Our local machines are Macs running PHP 5.5.31 and Apache/2.4.16 (Unix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't found a cause or solution, and there doesn't seem to be anything of use in the craft.log either (though I'm not sure what to look for).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This post is a follow-on from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11245/craft-hangs-when-updating-entry&quot;&gt;Craft hangs when updating entry&lt;/a&gt;, which never seemed to be answered definitively).&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-22T17:36:01.670" Title="Craft hanging when updating an Entry" Tags="&lt;bug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14306" PostTypeId="2" ParentId="44" CreationDate="2016-03-24T13:42:28.360" Score="3" Body="&lt;p&gt;I tweaked the version in the answer above by Christian Steger (&lt;a href=&quot;https://craftcms.stackexchange.com/a/1794/3835&quot;&gt;https://craftcms.stackexchange.com/a/1794/3835&lt;/a&gt;). This version, hides the current language from the list of language links, and displays the language links in the target language. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also allows you to omit any desired languages from the list of language links. This is useful for enabling a locale for use in the control panel without having it appear in the list of language links throughout the site. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentLocale = craft.i18n.getCurrentLocale() %}&#xA;{# Decide which languages should be omitted from language links #}&#xA;{% set localeExceptions = [&quot;en&quot;, currentLocale] %}&#xA;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(localeExceptions) %}&#xA;&#xA;{% for locale in otherLocales %}&#xA;  {% if entry is defined %}&#xA;     {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;  {% endif %}&#xA;&#xA;  {% if localeEntry.locale is defined and localeEntry.locale == locale %}&#xA;      &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).nativeName }}&amp;lt;/a&amp;gt;&#xA;  {% else %}&#xA;      &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).nativeName }}&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3835" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-04-27T19:20:35.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14307" PostTypeId="2" ParentId="14301" CreationDate="2016-03-24T14:00:12.697" Score="1" Body="&lt;p&gt;I've used &lt;a href=&quot;http://hashids.org/&quot; rel=&quot;nofollow&quot;&gt;hashids&lt;/a&gt; successfully before, then create a small plugin helper with a twig filter that transforms the id into a hash that also decrypts it. you can include composer to craft plugins by just updating your composer file and adding hashids to it.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastActivityDate="2016-03-24T14:00:12.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14308" PostTypeId="1" CreationDate="2016-03-24T15:49:36.587" Score="0" ViewCount="91" Body="&lt;p&gt;I'm merging entries from two separate sections across locales.&#xA;All going well but when I try to paginate the results I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Recoverable error&#xA;&#xA;Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The offending code as follows (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = [] %}&#xA;{% set devNews = craft.entries.section('newsDevelopment').status(null).find() %}&#xA;{% set alumniNews = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).find() %}&#xA;{% set pages = pages|merge(alumniNews) %}&#xA;&#xA;{% paginate news as pages %}&#xA;    {% for article in news %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I say, works fine/as expected without the paginate but as soon as I try to paginate I get the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on above appreciated.&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2016-03-24T16:23:15.853" LastActivityDate="2016-03-24T16:23:15.853" Title="Combined entries from sections across locales" Tags="&lt;entries&gt;&lt;localization&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14309" PostTypeId="2" ParentId="14308" CreationDate="2016-03-24T15:56:28.813" Score="1" Body="&lt;p&gt;The &lt;code&gt;paginate&lt;/code&gt; tag requires a criteria model, which means you have to come up with your own pagination solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See an example here:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12455/paginate-entries-when-i-do-not-have-a-criteria-model&quot;&gt;Paginate entries when I do not have a criteria model?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-03-24T15:56:28.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14310" PostTypeId="2" ParentId="14300" CreationDate="2016-03-24T16:29:12.777" Score="2" Body="&lt;p&gt;Completely untested, but something like this should do it.  Create a simple &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; and add this to the main plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onBeforeActivateUser', function(Event $event)&#xA;    {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        craft()-&amp;gt;config-&amp;gt;set('activateAccountSuccessPath', 'members/'.$user-&amp;gt;username);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-24T16:29:12.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14311" PostTypeId="2" ParentId="14305" CreationDate="2016-03-24T16:39:09.653" Score="1" Body="&lt;p&gt;If you have gzip compression enabled (either at the PHP or Apache level), try disabling that and see if helps.  Obviously that's not a proper long-term solution, but if you leave it on and set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow&quot;&gt;runTasksAutomatically&lt;/a&gt; config setting to &lt;code&gt;false&lt;/code&gt; and setup a cron job as described in the docs, you can see if that helps as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-24T16:39:09.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14312" PostTypeId="1" CreationDate="2016-03-24T21:09:53.280" Score="1" ViewCount="176" Body="&lt;p&gt;In my plugin I have an &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init ()&#xA;{&#xA;    parent::init();&#xA;&#xA;    require CRAFT_PLUGINS_PATH.'/myplugin/vendor/autoload.php';&#xA;&#xA;    $this-&amp;gt;callTemplateHooks();&#xA;&#xA;    craft()-&amp;gt;onError = function(Event $event) {&#xA;        $this-&amp;gt;logError($event);&#xA;    };&#xA;&#xA;    craft()-&amp;gt;on('userSession.onLogout', function(Event $event) {&#xA;        // do something&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've got a breakpoint set on the &lt;code&gt;onLogout()&lt;/code&gt; method of the &lt;code&gt;UserService&lt;/code&gt; class so I can see that firing, however the breakpoint on my &lt;code&gt;// do something&lt;/code&gt; line never gets hit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something here?&lt;/p&gt;&#xA;" OwnerUserId="922" LastEditorUserId="922" LastEditDate="2016-03-24T21:17:51.950" LastActivityDate="2016-03-24T21:17:51.950" Title="Plugin event listener not firing" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;events&gt;&lt;session&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14313" PostTypeId="1" CreationDate="2016-03-25T10:04:10.487" Score="1" ViewCount="191" Body="&lt;p&gt;I would like to make an image upload field so new members are required to upload a picture. I'm new to Craft (I've been a Drupal Front End developer). Other custom fields are working perfectly, and I've added &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; to my form tag. This is how my input field looks like now, but I get a CException error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;userPhoto&quot;&amp;gt;Upload Foto&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;                &#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot;&#xA;    {%- if account is defined %} value=&quot;{{ account.userPhoto }}&quot;{% endif %}&amp;gt;&#xA;    {% if account is defined %}&#xA;    {{ errorList(account.getErrors('userPhoto')) }}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been searching for a while now but can't seem to find an answer on it.&#xA;So I hope someone can help me :-). Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2016-03-25T10:04:10.487" Title="Uploading a user picture on registration" Tags="&lt;frontend&gt;&lt;user-profile&gt;&lt;usermodel&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14314" PostTypeId="1" AcceptedAnswerId="14320" CreationDate="2016-03-25T10:05:15.703" Score="2" ViewCount="169" Body="&lt;p&gt;I've been unable to find a config option for giving all uploaded files and their transforms lowercase filenames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="475" LastEditorUserId="57" LastEditDate="2016-03-25T16:41:24.967" LastActivityDate="2016-03-25T16:41:24.967" Title="Lowercase filenames" Tags="&lt;assets&gt;&lt;config&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14315" PostTypeId="1" AcceptedAnswerId="14319" CreationDate="2016-03-25T11:27:27.507" Score="3" ViewCount="443" Body="&lt;p&gt;I'm trying to query against a specific field value in a Matrix field with multiple block types, and I've tried multiple approaches with no success. It either returns 0 results, or all blocks regardless of type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case is that Snipcart is doing a callback with the ordered items and their skus. I got the different product variants in a Matrix fields, and every variant has its own sku. The field have two block types. I want to find the correct product variant and reduce the available stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest approach is this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria      = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;sku = 'JW';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figured out that it won't join the content table if you don't specify a fieldId, and you also need a typeId.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria      = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;fieldId = $fieldId;&#xA;$criteria-&amp;gt;typeId = $typeId;&#xA;$criteria-&amp;gt;sku = 'JW';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What happens then is that it's seem to do the correct query, but with a AND query for the field on both block types (even though I have defined a typeId):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;system.db.CDbCommand.query(SELECT `elements`.`id`, `matrixblocks`.`fieldId`, `matrixblocks`.`ownerId`, `matrixblocks`.`ownerLocale`, `matrixblocks`.`typeId`, `matrixblocks`.`sortOrder`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_matrixcontent_colorsandtextures` `content` ON content.elementId = elements.id&#xA;JOIN `craft_matrixblocks` `matrixblocks` ON matrixblocks.id = elements.id&#xA;WHERE (((((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements.enabled = 1)) AND (elements_i18n.enabled = 1)) AND (content.field_texture_sku=:contentfield_texture_sku1)) AND (content.field_color_sku=:contentfield_color_sku1)) AND (matrixblocks.fieldId=:matrixblocksfieldId1)&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `matrixblocks`.`sortOrder` LIMIT 100. Bound with :locale='en_us', :contentfield_texture_sku1='JW', :contentfield_color_sku1='JW', :matrixblocksfieldId1='15')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key here is the fact that my typeId isn't being applied, and this part:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(content.field_texture_sku=:contentfield_texture_sku1)) AND (content.field_color_sku=:contentfield_color_sku1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to query for a match independent of what type it is, as the blocks can be either or. Is there a way I can turn that into a OR query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mXDm6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mXDm6.png&quot; alt=&quot;Columns&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="125" LastEditDate="2016-03-25T14:14:22.110" LastActivityDate="2016-03-25T14:14:22.110" Title="Querying for an exact match on a Matrix block field with multiple types" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14316" PostTypeId="1" AcceptedAnswerId="14327" CreationDate="2016-03-25T12:32:34.107" Score="1" ViewCount="983" Body="&lt;p&gt;trying to get my head wrapped around eager loading element relationships in my plugin. A little context, I’m working on a navigation module and I have a Node element type, which belongs to a Navigation and has one Entry element type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations(){&#xA;return array(&#xA;  'element'    =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;  'navigation' =&amp;gt; array(static::BELONGS_TO, 'Navee_NavigationRecord', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;  'entry'      =&amp;gt; array(static::HAS_ONE, 'EntryRecord', 'entryId', 'required' =&amp;gt; false),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I’m getting my nodes, I’d like to eager load the entry for each node. This is where I’m just sort of falling down on they syntax. If I currently have (without eager loading):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Navee_Node');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would I eager load the entries by doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Navee_Node')-&amp;gt;with(ElementType::Entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I should note that what I'm really trying to do is pull the uri for each related entry without having to run an additional query every time I iterate over the navigation. So maybe my thinking is wrong and I don't need to eager load the entire EntryElement type, but just a particular field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks so much in advance for any insight you can provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MW&lt;/p&gt;&#xA;" OwnerUserId="4935" LastEditorUserId="4935" LastEditDate="2016-03-26T11:07:06.880" LastActivityDate="2016-03-26T11:07:06.880" Title="Eager loading EntryElementType from custom ElementType in a plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14317" PostTypeId="2" ParentId="14288" CreationDate="2016-03-25T13:25:48.883" Score="3" Body="&lt;p&gt;Try something slightly different in concept... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your Products template - /products/index.html - start with your &lt;strong&gt;Authors&lt;/strong&gt; first and then look for the &lt;strong&gt;Products&lt;/strong&gt; which are related to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this will help you make sense of it...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# find all author entries #}&#xA;{% set authors = craft.entries.section('authors').order('title') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {# loop through all author entries #}&#xA;    {% for author in authors %}&#xA;        &amp;lt;li&amp;gt;{{ author.title }}&amp;lt;/li&amp;gt;&#xA;&#xA;        {# find any products which may be related to the author #}&#xA;        {% set products = craft.entries.section('products').relatedTo(author) %}&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {# Loop through related products by this author #}&#xA;            {% for relatedProduct in products %}&#xA;                &amp;lt;li&amp;gt;{{ relatedProduct.title }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, if your Authors will ever need to log in to Craft, then consider adding them as CMS Users instead of entries. I know this has licence fee implications, but it's just a thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's relatedTo parameter is the key concept to understand. More info here: &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-25T13:25:48.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14318" PostTypeId="2" ParentId="14282" CreationDate="2016-03-25T13:38:57.777" Score="2" Body="&lt;p&gt;I believe that Craft searches and indexes the contents from ALL custom fields. If that's true, then you only need a single search field. e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/search?q=field&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/search?q=field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Display's results from multiple Sections i.e. &lt;strong&gt;Plugin Dev&lt;/strong&gt;, &lt;strong&gt;Documentation&lt;/strong&gt; and &lt;strong&gt;Templating&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you consider separating your search results, based on whichever entries/sections are returned by the search query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-25T13:38:57.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14319" PostTypeId="2" ParentId="14315" CreationDate="2016-03-25T14:12:44.693" Score="5" Body="&lt;p&gt;When I understand Brandon correctly in this answer &lt;a href=&quot;https://craftcms.stackexchange.com/a/6867/125&quot;&gt;Query for blocks across Block Types using the new field parameter?&lt;/a&gt;, it's not possible to set up what you want with a criteria model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do though is to add additional custom query conditions to the &lt;code&gt;dbCommand&lt;/code&gt; after running the criteria model through the &lt;code&gt;buildElementsQuery&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getMatrixBlocks($matrixFieldId, $fieldValue)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;    $criteria-&amp;gt;fieldId = $matrixFieldId;&#xA;&#xA;    $dbCommand = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    $params = array(&#xA;        ':myFieldHandle' =&amp;gt; $fieldValue,&#xA;    );&#xA;&#xA;    $conditions = array('or',&#xA;        'content.field_myBlockTypeA_myFieldHandle=:myFieldHandle',&#xA;        'content.field_myBlockTypeB_myFieldHandle=:myFieldHandle',&#xA;    );&#xA;&#xA;    $dbCommand-&amp;gt;andWhere($conditions, $params);&#xA;&#xA;    return $dbCommand-&amp;gt;queryAll();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-25T14:12:44.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14320" PostTypeId="2" ParentId="14314" CreationDate="2016-03-25T16:40:41.060" Score="2" Body="&lt;p&gt;Not natively.  You can make a &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; and/or write a simple plugin that listens for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#assets-onBeforeUploadAsset&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;assets.onBeforeUploadAsset&lt;/code&gt;&lt;/a&gt; event, then calls &lt;a href=&quot;https://secure.php.net/manual/en/function.strtolower.php&quot; rel=&quot;nofollow&quot;&gt;strtolower&lt;/a&gt; on the filename.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-25T16:40:41.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14321" PostTypeId="1" AcceptedAnswerId="14322" CreationDate="2016-03-25T19:40:10.473" Score="5" ViewCount="256" Body="&lt;p&gt;Is there a plugin or something I'm missing in the CP to just see how many entries are under any given channel or structure?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-03-25T19:52:18.387" Title="Is there a way to see the total number of entries in a channel in the CP?" Tags="&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14322" PostTypeId="2" ParentId="14321" CreationDate="2016-03-25T19:52:18.387" Score="5" Body="&lt;p&gt;You're looking for the &lt;strong&gt;Content Stats&lt;/strong&gt; plugin by Will Browar:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/wbrowar/contentstats&quot;&gt;https://github.com/wbrowar/contentstats&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-25T19:52:18.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14323" PostTypeId="1" AcceptedAnswerId="14325" CreationDate="2016-03-25T23:31:24.730" Score="3" ViewCount="1602" Body="&lt;p&gt;I am using saveUser and i am trying to save a value to a user's custom field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $userModel = new UserModel();&#xA;        $userModel-&amp;gt;mycustomfield = 'test value';&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($userModel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what i have so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Property &quot;Craft\UserModel.mycustomfield&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do i save to a custom user field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $userModel = new UserModel();&#xA;        $userModel-&amp;gt;id = $user-&amp;gt;id;&#xA;        $userModel-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'mycustomfield' =&amp;gt; 'my field value'&#xA;        ));&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($userModel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error, doesnt save either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userModel-&amp;gt;getContent()-&amp;gt;mycustomfield = 'my value';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error, doesnt save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    $userModel = new UserModel();&#xA;    $userModel-&amp;gt;id = $user-&amp;gt;id;&#xA;    $userModel-&amp;gt;username = $user-&amp;gt;username;&#xA;    $userModel-&amp;gt;email = $user-&amp;gt;email;&#xA;    $userModel-&amp;gt;password = '';&#xA;    $userModel-&amp;gt;getContent()-&amp;gt;mycustomfield = 'my custom value';&#xA;    $success = craft()-&amp;gt;users-&amp;gt;saveUser($userModel);&#xA;    if (!craft()-&amp;gt;users-&amp;gt;saveUser($userModel))&#xA;    {&#xA;        $errors = $userModel-&amp;gt;getErrors();&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="4936" LastEditDate="2016-03-26T21:04:45.933" LastActivityDate="2017-09-13T10:14:24.453" Title="Saving to user's custom field" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14324" PostTypeId="2" ParentId="14282" CreationDate="2016-03-26T01:47:01.450" Score="3" Body="&lt;p&gt;You'd have to set up an ElementCriteriaModel with parameters adapted to your entry type and the values you're getting from the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend to read the official docs on that topic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that you shouldn't miss &lt;a href=&quot;http://webstoemp.com/blog/combined-searches-and-filters-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;Combined searches and filters using Craft&lt;/a&gt; on Webstoemp's blog, a great introduction to setting up search forms and &quot;filtering&quot; the results with the ElementCriteriaModel.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-26T01:47:01.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14325" PostTypeId="2" ParentId="14323" CreationDate="2016-03-26T02:04:42.617" Score="1" Body="&lt;p&gt;It's probably a validation error.  Use this to check if there are any.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userModel-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'mycustomfield' =&amp;gt; 'my field value'&#xA;));&#xA;&#xA;if (!craft()-&amp;gt;users-&amp;gt;saveUser($userModel))&#xA;{&#xA;    $errors = $userModel-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-26T02:04:42.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14326" PostTypeId="2" ParentId="12084" CreationDate="2016-03-26T04:43:52.677" Score="2" Body="&lt;p&gt;Following on from &lt;a href=&quot;https://craftcms.stackexchange.com/a/13662/4937&quot;&gt;Rob's answer&lt;/a&gt;, for anyone running into this issue on Laravel Homestead, we can use Bash to script the change. That way, the edit to the &lt;code&gt;my.cnf&lt;/code&gt; file is done automatically for any future VMs created using &lt;code&gt;vagrant up&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, simply add the following to your &lt;code&gt;~/.homestead/after.sh&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;STR=&quot;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&quot;&#xA;if ! grep -Fxq &quot;$STR&quot; /etc/mysql/my.cnf&#xA;then&#xA;    printf &quot;\n# Craft 2 compatibility\n[mysqld]\n$STR&quot; &amp;gt;&amp;gt; /etc/mysql/my.cnf&#xA;    service mysql restart&#xA;fi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code searches &lt;code&gt;/etc/mysql/my.cnf&lt;/code&gt; for the line &lt;code&gt;'sql_mode=...'&lt;/code&gt;, and if it cannot be found, it is automatically appended, together with the preceding &lt;code&gt;[mysqld]&lt;/code&gt; to the end of the file. The mysql service is then restarted to enable the change.&lt;/p&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-26T04:43:52.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14327" PostTypeId="2" ParentId="14316" CreationDate="2016-03-26T09:26:29.260" Score="2" Body="&lt;p&gt;The article on StraightUpCraft should be able to point you in the right direction. PHP stuff is towards the bottom of the article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&quot; rel=&quot;nofollow&quot;&gt;Examples of Eager Loading Elements in Twig and PHP&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also this Craft hangout is worth watching, it gives a lot of detail on Eager loading. It's over an hour long though, so set yourself some time aside to watch it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/events/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;Eager loading Elements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-03-26T09:36:44.393" LastActivityDate="2016-03-26T09:36:44.393" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14329" PostTypeId="1" AcceptedAnswerId="14338" CreationDate="2016-03-26T22:53:39.517" Score="2" ViewCount="1171" Body="&lt;p&gt;I'm trying to create a dashboard widget using the new Craft charting library.  I'm more or less copying the New Users widget however I'm running into an issue where my container does not seem to be behaving in the same way as the New User widget - it appears the container is getting a different width and no height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar to &lt;code&gt;NewUsersWidget.js&lt;/code&gt; I am using these three lines of code to set the container:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.$widget = $('#widget'+widgetId);&#xA;this.$body = this.$widget.find('.body:first');&#xA;this.$chartContainer = $('&amp;lt;div class=&quot;chart hidden&quot;&amp;gt;&amp;lt;/div&amp;gt;').appendTo(this.$body);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I inspect &lt;code&gt;this.$chartContainer&lt;/code&gt; in the &lt;code&gt;NewUsersWidget.js&lt;/code&gt; it has a width and height whereas when I inspect &lt;code&gt;this.$chartContainer&lt;/code&gt; in my own widget, the width is different and the height is not present. I don't see these values set explicitly in the New Users widget. It appears they may be set dynamically in &lt;code&gt;craft.js&lt;/code&gt;, but I'm not sure. Both javascript objects extend &lt;code&gt;Garnish.Base&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understandably, someone helping troubleshoot this may need more context. I'm really not sure what more I should be sharing, so let me know if I can provide additional details to help narrow down what may be happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more general question may be, how does width and height get set when creating a variable (&lt;code&gt;this.$chartContainer&lt;/code&gt;) in an object that extends &lt;code&gt;Garnish.Base&lt;/code&gt;? Why would two different widgets creating the same variable both end up with a different height and width?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-03-28T16:01:09.353" Title="Error: Invalid negative value for &lt;rect&gt; attribute" Tags="&lt;garnish&gt;&lt;dashboard-widgets&gt;&lt;charts&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14330" PostTypeId="5" CreationDate="2016-03-26T22:56:38.750" Score="0" Body="" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-03-26T22:56:38.750" LastActivityDate="2016-03-26T22:56:38.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14331" PostTypeId="4" CreationDate="2016-03-26T22:56:38.750" Score="0" Body="Questions relating to creating charts or the charting libraries within Craft CMS" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-03-26T22:56:38.750" LastActivityDate="2016-03-26T22:56:38.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14332" PostTypeId="2" ParentId="14294" CreationDate="2016-03-27T07:49:47.807" Score="4" Body="&lt;p&gt;Steven's answer is great and it allows you to do clever things with faceted search and filtering later on. Don't forget that Categories can also make use of custom fields which is helpful if you want to build a Category 'home page'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another route is to leverage Crafts Relationships capability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If both &lt;strong&gt;Products&lt;/strong&gt; and &lt;strong&gt;Brands&lt;/strong&gt; were &lt;strong&gt;Channels&lt;/strong&gt;, then you can add an Entries customer field within you Products Entry Type - so that when you publish a product, you get to define which Brand it is related to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would allow you to relate other Sections / content-types to a &lt;strong&gt;Brand&lt;/strong&gt; as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, there are a million ways to skin this cat, I suggest taking into account the requirements for the entire project and how they may evolve and deciding on a project by project basis. &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-27T07:49:47.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14333" PostTypeId="1" CreationDate="2016-03-27T20:46:58.843" Score="5" ViewCount="923" Body="&lt;p&gt;&lt;strong&gt;Is there a catch all error page template?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to use &lt;a href=&quot;http://http.cat&quot;&gt;http://http.cat&lt;/a&gt; for my statuses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(originally asked by Bryan Redeagle in &lt;a href=&quot;https://craftcms.slack.com/archives/general/p1458942743002729&quot;&gt;Craft Slack&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-03-27T20:46:58.843" Title="Generic catch-all error template" Tags="&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14334" PostTypeId="2" ParentId="14333" CreationDate="2016-03-27T20:46:58.843" Score="5" Body="&lt;p&gt;Yes — an &lt;code&gt;error.twig&lt;/code&gt; template in your error templates directory serves as a catch-all template when a more specific template (e.g. &lt;code&gt;404.twig&lt;/code&gt;) can't be found, or when the system throws a general error that doesn't have a status code attached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You can customize the path prefix for error templates by changing the &lt;code&gt;errorTemplatePrefix&lt;/code&gt; setting in the &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot;&gt;Craft General Config&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-03-27T20:46:58.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14335" PostTypeId="1" CreationDate="2016-03-27T20:49:09.913" Score="4" ViewCount="628" Body="&lt;p&gt;I want to have one template handle all of my error pages (instead of creating 404.html, 500.html, &amp;amp;c.).&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-03-27T20:49:09.913" Title="How do you create dynamic error pages?" Tags="&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14336" PostTypeId="2" ParentId="14335" CreationDate="2016-03-27T20:49:09.913" Score="4" Body="&lt;p&gt;A big thanks to Michael Rog (@rog) for the answer on Slack. You can create a catch-all error template with the name &lt;code&gt;error&lt;/code&gt; (using whatever file ext works for you). That template also has access to a variable called &lt;code&gt;code&lt;/code&gt; that tells you what kind of error it is. In my case, I'm using it to display &lt;a href=&quot;https://http.cat/&quot;&gt;HTTP Cats&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-03-27T20:49:09.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14337" PostTypeId="2" ParentId="14107" CreationDate="2016-03-27T22:36:30.707" Score="2" Body="&lt;p&gt;Using the example above, here is how you can re-populate the given matrix field(s). The below is assuming only one matrix field is visible by default &lt;code&gt;[0]&lt;/code&gt;. Depending on your use case, you may need to dynamically generate the index number.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{%- if entry is defined %} value=&quot;{{ entry.myMatrixFieldHandle[0].fieldHandle }}&quot;{% endif -%}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-03-27T23:47:57.583" LastActivityDate="2016-03-27T23:47:57.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14338" PostTypeId="2" ParentId="14329" CreationDate="2016-03-27T22:36:46.863" Score="3" Body="&lt;p&gt;Craft charts are taking the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; of the container's &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; as a basis for drawing the chart. So your JS is probably working but you need to define a &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; for the chart's div to make it work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A basic implementation of the Area chart would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = &quot;Area Chart&quot;|t %}&#xA;&#xA;{% includecss %}&#xA;    #chart {&#xA;        width: 400px;&#xA;        height: 300px;&#xA;    }&#xA;{% endincludecss %}&#xA;&#xA;{% includejs %}&#xA;&#xA;    var $chart = $('#area'),&#xA;        chart = new Craft.charts.Area($chart);&#xA;&#xA;    var dataTable = new Craft.charts.DataTable({&#xA;        columns: [&#xA;            { label: &quot;Date&quot;, type: 'date' },&#xA;            { label: &quot;New Users&quot;, type: 'number' },&#xA;        ],&#xA;        rows: [&#xA;            ['2016-01-23', 5],&#xA;            ['2016-01-24', 15],&#xA;            ['2016-01-25', 10],&#xA;            ['2016-01-26', 13],&#xA;        ]&#xA;    });&#xA;&#xA;    chart.draw(dataTable);&#xA;&#xA;{% endincludejs %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;div id=&quot;area&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="164" LastEditorUserId="164" LastEditDate="2016-03-28T16:01:09.353" LastActivityDate="2016-03-28T16:01:09.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14339" PostTypeId="2" ParentId="14278" CreationDate="2016-03-28T00:06:39.063" Score="4" Body="&lt;p&gt;As someone who's run a mail server professionally, thought I'd expand on a comment. Brad's answer goes over the technical details of sending with Craft, I suppose this answer is more &quot;philosophical&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back many years ago,  I'd send newsletters &quot;manually&quot; (using PHPList, pommo, my own home brewed set-up... &lt;em&gt;shudders&lt;/em&gt;, etc), these were only a few hundred to a thousand. I'd deal with the bounce backs, vacation notices, etc.  manually. Fun stuff. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These days, it's gotten a bit more complex. As an aside, if you were doing this on any old server directly to the recipient, then you have to worry about reverse DNS (ptr) and SPF DNS records, probably DKIM if you want to round your bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thankfully we have services that handle much of the BS of making sure your e-mail is actually delivered. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big questions are really how many emails do you have to send, what are you actually sending, and how big is the attachment? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stuff I'd worry about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Attachments are huge spam flags.&lt;/strong&gt; If you're sending the same one to every person, is there a way to put that on the server with a link to what you're sending? Or is the attachment also dynamically generated? If it were me, I'd probably set up the attachment on the server with a link to attachment but I can see where you might have to actually attach something.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rate limiting.&lt;/strong&gt; If you're using MailGun, I wouldn't worry too much about &lt;a href=&quot;https://documentation.mailgun.com/user_manual.html#batch-sending&quot; rel=&quot;nofollow&quot;&gt;rate limiting&lt;/a&gt; since they will be doing the &quot;reputation&quot; management on their end so you won't flood the destination mail servers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If these are B2B e-mail addresses, it's a bit easier since many run individual Exchange boxes so you won't be bumping up against ISP based e-mail accounts—Google Apps, Zoho, etc. probably being the exceptions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Are you sending more of a newsletter or &lt;a href=&quot;http://kb.mailchimp.com/mandrill/about-transactional-email&quot; rel=&quot;nofollow&quot;&gt;&quot;transactional&quot;&lt;/a&gt; style e-mail?&lt;/strong&gt; The latter is everyone gets something slightly different like an order confirmation, upsell, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using Craft like an e-mail newsletter creator (I can see Matrix being awesome for this), you may be better off interfacing with MailChimp, Aweber, Campaign Monitor, etc.  Use their APIs to feed the e-mail data into that software that way and then send it off.  They are better optimized in a one-to-many situation like and can track deliverability for an e-mail blast versus Amazon SES, Mandrill, etc. are more optimized for one-to-one transactional e-mails. It's a subtle difference but it can mean the world of difference for deliverability. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-03-28T00:50:30.517" LastActivityDate="2016-03-28T00:50:30.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14340" PostTypeId="1" CreationDate="2016-03-28T10:39:21.307" Score="1" ViewCount="134" Body="&lt;p&gt;It looks like Apache (or Craft?) isn't routing all of the requests to index.php. So &lt;a href=&quot;http://SITENAME/index.php?p=admin/install&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://SITENAME/index.php?p=admin/install&lt;/a&gt; works, but &lt;a href=&quot;http://SITENAME/admin/install&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://SITENAME/admin/install&lt;/a&gt; doesn't. The issue is this is happening with every URL, so the HTML for the install page loads, but none of the assets (CSS, JS) do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my issue in picture form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LzB0H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LzB0H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kOBdB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kOBdB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4509" LastActivityDate="2016-03-29T09:07:19.750" Title="(Apache) pages only load when adding index.php?p=" Tags="&lt;apache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14341" PostTypeId="2" ParentId="14340" CreationDate="2016-03-28T11:07:12.223" Score="1" Body="&lt;p&gt;Disabling the &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; config option makes it work. Not sure if this is a &quot;solution&quot; though&lt;/p&gt;&#xA;" OwnerUserId="4509" LastEditorUserId="4509" LastEditDate="2016-03-29T09:07:19.750" LastActivityDate="2016-03-29T09:07:19.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14342" PostTypeId="1" AcceptedAnswerId="14356" CreationDate="2016-03-28T11:27:54.393" Score="3" ViewCount="831" Body="&lt;p&gt;On certain pages of my site, I download and display resized (using the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/imager&quot; rel=&quot;nofollow&quot;&gt;Imager&lt;/a&gt; plugin) images from remote site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, sometimes that remote site returns error and in such case Imager is throwing exceptions, blocking the whole page from being viewed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, is there a way to suppress server errors when possible, e.g. write them to log file and don't stop page processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/imager&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; is set to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="1016" LastEditDate="2016-03-28T16:32:11.503" LastActivityDate="2016-03-28T19:53:25.860" Title="How to suppress server errors in Craft?" Tags="&lt;plugins&gt;&lt;error-handling&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14343" PostTypeId="1" AcceptedAnswerId="14350" CreationDate="2016-03-28T13:28:04.760" Score="3" ViewCount="298" Body="&lt;p&gt;Assuming I'm using a lightswitch to denote an entry as &quot;Featured,&quot; how can I then disable that lightswitch on every other entry, so that no matter how many times I flip these switches only one entry can be &quot;Featured?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit: There are some &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14352/programatically-change-a-lightswitch-value-on-an-entry-on-save&quot;&gt;plugin options&lt;/a&gt;, and that might be the only way to go but I'm hoping that someone can find a better way through Twig filters or something.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4676" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-03-29T15:11:07.447" Title="When I flip the &quot;Featured Entry&quot; switch, disable it on other entries" Tags="&lt;templating&gt;&lt;control-panel&gt;&lt;lightswitch&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2016-03-29T16:32:25.790" ContentLicense="CC BY-SA 3.0" />
  <row Id="14344" PostTypeId="1" AcceptedAnswerId="14346" CreationDate="2016-03-28T14:49:56.397" Score="2" ViewCount="206" Body="&lt;p&gt;Trying to work out if I’m doing something wrong with catching an event from another plugin in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m trying to use &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow&quot;&gt;amforms&lt;/a&gt; “onSaveSubmission” event, so, in my plugin’s &lt;code&gt;init()&lt;/code&gt; &#xA;function i have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('amForms.onSaveSubmission', function(Event $event) {&#xA;    var_dump($event);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, when I submit a form successfully, this event is triggering an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Property &quot;Craft\AmFormsService.onSaveSubmission&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;onSaveSubmission&lt;/code&gt; event is in &lt;code&gt;/plugins/amforms/services/AmForms_SubmissionsService.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="57" LastEditDate="2016-03-28T16:37:05.690" LastActivityDate="2016-03-28T17:08:13.390" Title="Calling an event from a third party plugin in my plugin" Tags="&lt;events&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14345" PostTypeId="2" ParentId="14343" CreationDate="2016-03-28T15:15:39.023" Score="3" Body="&lt;p&gt;It depends on your sort order. If your goal is to only display the most recent 'featured' entry, then you could add the &lt;strong&gt;.first&lt;/strong&gt; parameter to your template code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft would simply grab the first entry it finds&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR, you could limit your query by using the Limit parameter. See: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries#limit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit (addition):&#xA;Here's an example of how you could display the single, most recent entry which has been marked as &lt;strong&gt;Featured&lt;/strong&gt;, using a lightswitch field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredNews = craft.entries.section('news').featured('not 0').order('dateUpdated desc').limit(1) %}&#xA;{% for entry in featuredNews %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Some valuable insight here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11911/craft-entries-and-lightswitch&quot;&gt;craft.entries and lightswitch&lt;/a&gt; and here: &lt;a href=&quot;https://craftcms.com/docs/lightswitch-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/lightswitch-fields&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-29T15:11:07.447" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14346" PostTypeId="2" ParentId="14344" CreationDate="2016-03-28T15:18:12.140" Score="4" Body="&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('amForms_submissions.saveSubmission', function(Event $event) {&#xA;    BusinessLogicPlugin::log(print_r($event, true));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pay attention to the casing&lt;br&gt;&#xA;&lt;code&gt;Craft\AmForms_SubmissionsService&lt;/code&gt; → &lt;code&gt;amForms_submissions&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-03-28T17:08:13.390" LastActivityDate="2016-03-28T17:08:13.390" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14347" PostTypeId="1" CreationDate="2016-03-28T15:19:01.783" Score="0" ViewCount="278" Body="&lt;p&gt;I have a requirement that a menu is open on wider breakpoints and closed on mobile breakpoints. To make it open i have a class i would toggle on my menu.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do this with JS but i get a FOUC on the menu on mobile, since it opens at first and then closes. So what i would ideally do is do this server side and exclude the class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way with craft templates to set a variable containing the breakpoint or screen size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fx..&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{%set isMobileSize =  ??? %}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Ideally this would get the page size in the request and set this when rendering the page/template?&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2016-03-28T15:19:01.783" Title="Set a Template Variable Based on Breakpoint" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14348" PostTypeId="1" AcceptedAnswerId="14351" CreationDate="2016-03-28T15:28:46.913" Score="1" ViewCount="58" Body="&lt;p&gt;Essentially I want the plugin to trigger on &lt;code&gt;entries.onSaveEntry&lt;/code&gt; which I have working fine at the moment. I want to add a Lightswitch field that will be a condition however. i.e. The plugin will only trigger on save if the Lightswitch entry is turned on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm having trouble finding use of how to get the status of a field (specifically Lightswitch). Is that data available to be in &lt;code&gt;$event-&amp;gt;params['entry']&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="532" LastEditorUserId="57" LastEditDate="2016-03-28T16:31:09.283" LastActivityDate="2016-03-28T16:31:09.283" Title="Having a plugin trigger on entries.onSaveEntry if a Lightswitch is turned on" Tags="&lt;plugin-development&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14349" PostTypeId="2" ParentId="14340" CreationDate="2016-03-28T15:31:05.190" Score="1" Body="&lt;p&gt;It sounds like you need to enable the .htaccess file in the root directory of your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, the .htaccess file included with Craft is named htaccess (without the period). The period needs to be added to the beginning of the file.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2016-03-28T15:31:05.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14350" PostTypeId="2" ParentId="14343" CreationDate="2016-03-28T15:33:49.940" Score="3" Body="&lt;p&gt;To accomplish what you're after you'd have to write some lines of PHP. Listen to the onSaveEntry event from a custom plugin and re-save all the other entries with the lightswitch field disabled if the one you just edited got it enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also think about refactoring and using an Entries field somewhere to select the featured entry, i.e. in the homepage's Single section or a Global Set.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-28T15:33:49.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14351" PostTypeId="2" ParentId="14348" CreationDate="2016-03-28T15:41:41.007" Score="1" Body="&lt;p&gt;Yes, it's available in &lt;code&gt;$event-&amp;gt;params['entry']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $event-&amp;gt;params['entry'];&#xA;if ($entry-&amp;gt;myLightswitch) {&#xA;    // do things&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-28T15:41:41.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14352" PostTypeId="1" AcceptedAnswerId="14359" CreationDate="2016-03-28T16:09:42.683" Score="3" ViewCount="369" Body="&lt;p&gt;I have a simple plugin that fires some events entries.onSaveEntry based on if a lightswitch is turned on with that entry. What I would like to do as the last event in my plugin would be updating the value of the lightswitch with that entry to be turned off (or 0) so if you went back in to the entry it would be turned off again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would appreciate any guidance. &lt;/p&gt;&#xA;" OwnerUserId="532" LastActivityDate="2016-03-28T22:48:53.863" Title="Programatically change a lightswitch value on an entry on save" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14353" PostTypeId="1" AcceptedAnswerId="14358" CreationDate="2016-03-28T17:55:41.280" Score="1" ViewCount="307" Body="&lt;p&gt;Does anyone have any experience with integrating the forecast.io API for  location data for a Craft CMS site? I haven't been able to find any direct plugins for Forecast.io, but I was investigating the &lt;a href=&quot;https://dukt.net/craft/rest&quot; rel=&quot;nofollow&quot;&gt;REST plugin&lt;/a&gt; as a possible option and I've also heard about &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;FeedMe&lt;/a&gt; as well. Are there any preferred options as a best practice? My hope would be to be able to pull the data in and use it within a field of an existing entries page based on data on that entries page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a related note does wrapping Craft's caching tag around these plugin calls cache plugin output too? Probably a stupid question, just wanting to make sure I approach this solution correctly.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2016-03-28T22:17:45.367" Title="Integrating and Caching Weather Data from Forecast.io API" Tags="&lt;plugins&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14354" PostTypeId="1" CreationDate="2016-03-28T18:18:49.307" Score="1" ViewCount="53" Body="&lt;p&gt;I am very new to Craft CMS and just testing out the CMS. In our old system we had 2 levels of virtual folders and I need to keep that structure. I don't see anything that would correspond to that in Craft. Is there anything that would let me create 2 levels of folders?&lt;/p&gt;&#xA;" OwnerUserId="4940" LastEditorUserId="4940" LastEditDate="2016-03-29T15:02:51.470" LastActivityDate="2016-03-29T15:02:51.470" Title="How to create subfolders for entries?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14355" PostTypeId="2" ParentId="14354" CreationDate="2016-03-28T18:22:39.343" Score="2" Body="&lt;p&gt;If you use make your section a Structure, it will allow a hierarchy of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow&quot;&gt;docs on section types&lt;/a&gt; to learn more about the different types of sections in Craft.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2016-03-28T18:22:39.343" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14356" PostTypeId="2" ParentId="14342" CreationDate="2016-03-28T19:53:25.860" Score="2" Body="&lt;p&gt;It depends on the type of errors that are being thrown.  If they are Twig/template errors, then you can can set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#suppressTemplateErrors&quot; rel=&quot;nofollow&quot;&gt;suppressTemplateErrors&lt;/a&gt; config setting to &lt;code&gt;true&lt;/code&gt; and they will simply get logged and the page request will continue as usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are non-Twig exceptions, then you'd have to do something more fancy like make a plugin that's essentially a facade for the Imager plugin and wraps all of it's calls in a &lt;code&gt;try/catch&lt;/code&gt; block that just swallows any exceptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or make a pull request that added support for it to the plugin itself.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-28T19:53:25.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14357" PostTypeId="1" CreationDate="2016-03-28T21:54:21.333" Score="0" ViewCount="321" Body="&lt;p&gt;This is my first site in Craft CMS (coming from EE) and trying to get my head around a few things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a matrix field that defines various types of content - one of which is a 'Super Table' field. In this 'Super Table' field, I've got one particular field called 'linkText' which I'm trying to pull through. I did successfully BUT it came through 19 times. I've been trying to suss out where this number comes from. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a matrix field called 'pageContent'. The particular Block Type I'm looking at is called 'textBlock'. Within that block I then have a rich text field called 'Text' which pulls through perfect i.e. once as expected. I then have the troubled 'Super Table' field called 'callToAction' which has a linkType and linkText in there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageContent %}&#xA;&#xA;    {% if block.type == &quot;textBlock&quot; %}&#xA;&#xA;        {% for row in block.callToAction %}&#xA;&#xA;             &amp;lt;p&amp;gt;{{ row.linkText }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% elseif block.type == &quot;customTable&quot; %}&#xA;&#xA;        etc, etc, &#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure it's something stupid, it is late! ;) but been checking the docs for a while and can't solve it. Any help would be great.&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2016-03-30T20:29:49.393" Title="Getting total rows from current Super Table within Matrix Block (too many rows)" Tags="&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14358" PostTypeId="2" ParentId="14353" CreationDate="2016-03-28T22:17:45.367" Score="0" Body="&lt;p&gt;Looks like there are already several &lt;a href=&quot;https://packagist.org/search/?q=forecast&quot; rel=&quot;nofollow&quot;&gt;PHP libraries&lt;/a&gt; for the &lt;a href=&quot;https://developer.forecast.io/docs/v2&quot; rel=&quot;nofollow&quot;&gt;forecast.io API&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd probably spend a few minutes reviewing those and find one that's to your liking.  Then, it's a simple as writing a &lt;a href=&quot;http://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;Craft plugin&lt;/a&gt; that utilizes that library to make calls to their API and deal with the response as appropriate.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-28T22:17:45.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14359" PostTypeId="2" ParentId="14352" CreationDate="2016-03-28T22:48:53.863" Score="5" Body="&lt;p&gt;You can set the value and save like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    if ($entry-&amp;gt;section == 'mySection') {&#xA;        if ($entry-&amp;gt;getContent()-&amp;gt;myLightSwitchField == 1) {&#xA;            $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                'myLightSwitchField' =&amp;gt; 0&#xA;            ));&#xA;            craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, you might consider using &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; so that you don't have to save the entry twice (and/or run the risk of creating an endless loop).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    if ($entry-&amp;gt;section == 'mySection') {&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'myLightSwitchField' =&amp;gt; 0&#xA;        ));&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-03-28T22:48:53.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14362" PostTypeId="2" ParentId="13693" CreationDate="2016-03-29T00:51:36.627" Score="3" Body="&lt;p&gt;It appears when a new widget is created it has a variety of classes (such as &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;loading-new&lt;/code&gt;) that don't exist on established widgets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class=&quot;widget new loading-new myplugin_mywidget flipped last&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's also possible to add javascript to the widget settings file that gets rendered for your widgets settings. In the admittedly lame (but illustrative) example below, your new widget will get the text color of red, and after it is saved and the page reloads, no red color will be applied.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includejs %}&#xA;(function(){&#xA;    $('.widget.new.myplugin_mywidget').css('color', 'red');&#xA;})();&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-03-29T00:51:36.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14364" PostTypeId="1" CreationDate="2016-03-29T07:38:38.857" Score="1" ViewCount="58" Body="&lt;p&gt;Is there a way to restrict the entry field type to specific categories? For example when adding a new field with type &quot;Entries&quot; to select the categories from where entries will be available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lewisjenkins/craft-lj-dynamicfields&lt;/a&gt; which is cool, but offers dropdowns and checkboxes that only work with a single entry. &lt;a href=&quot;http://screencast.com/t/15nIkpHTQ1&quot; rel=&quot;nofollow&quot;&gt;http://screencast.com/t/15nIkpHTQ1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4941" LastActivityDate="2016-03-29T07:38:38.857" Title="How do I filter / restrict entries field in CP with a category" Tags="&lt;categories&gt;&lt;control-panel&gt;&lt;relations&gt;&lt;entries-field&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14365" PostTypeId="1" CreationDate="2016-03-29T11:59:35.163" Score="1" ViewCount="219" Body="&lt;p&gt;I am trying to improve the performance of our site search. I'm wondering if there is anything I can implement that may speed things up. Currently we have a search being sent to a results page. In the results page we have this call to the database.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;query is returned from the q parameter in the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are using a matrix field for all the main content blocks on the site. This field has 10 block types with a max of 7 fields in each. This is used on all entries across the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the profiler after running a query on a phrase that is very popular across the site it takes around 11s and queries the db 500+ times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions how we may reduce this time down? Or is this just a disadvantage of using matrix fields?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-03-29T12:12:37.853" Title="How to improve search performance on front-end?" Tags="&lt;matrix&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14366" PostTypeId="2" ParentId="14365" CreationDate="2016-03-29T12:12:37.853" Score="2" Body="&lt;p&gt;Have you looked into eager loading the Matrix field if you are on 2.6? This should vastly cut down on the number of queries needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thought could be to use the Preparse field plugin to push the matrix fields into simple text, and then direct the search query to only look at the title field and preparse fields.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-03-29T12:12:37.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14367" PostTypeId="1" AcceptedAnswerId="14381" CreationDate="2016-03-29T12:40:04.230" Score="2" ViewCount="352" Body="&lt;p&gt;I have a channel called 'Activities' and a channel called 'Members'. &#xA;In 'Activities' I have a field called 'Accepted'. I want to be able to add and remove 'Members' to the field 'Accepted'.&#xA;I want to do this in a plugin that I am building. Is there a method to add or delete a single 'Member' to the 'Accepted' field of an 'Activity'?&#xA;Basically is should remove the relationship between the Activity and the Member, but it should not remove the Member itself.&lt;/p&gt;&#xA;" OwnerUserId="4901" LastEditorUserId="142" LastEditDate="2016-03-29T16:30:56.773" LastActivityDate="2016-03-29T21:49:21.717" Title="How to remove relationships between entries" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14368" PostTypeId="2" ParentId="14074" CreationDate="2016-03-29T12:45:28.097" Score="3" Body="&lt;p&gt;We have created an working example plugin that can notify users by email when the stock of a variant drops below a defined threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/CommerceStockNotifier&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/CommerceStockNotifier&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-03-29T12:45:28.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14369" PostTypeId="2" ParentId="14367" CreationDate="2016-03-29T13:10:03.437" Score="1" Body="&lt;p&gt;Yes, your &lt;strong&gt;Accepted&lt;/strong&gt; field should be an &lt;strong&gt;Entries&lt;/strong&gt; custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can limit the field to only allow you to select entries from the &lt;strong&gt;Members Channel&lt;/strong&gt;. e.g. you would only tick the 'Members' source (see image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qCSj0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qCSj0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would allow you to select (or remove) one or more Member entries, when publishing or editing an &lt;strong&gt;Activity&lt;/strong&gt; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info in the docs, here: &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/entries-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-29T13:10:03.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14370" PostTypeId="1" AcceptedAnswerId="14372" CreationDate="2016-03-29T14:39:13.960" Score="1" ViewCount="174" Body="&lt;p&gt;I want to strip every headline tag from all Rich Text fields site-wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought about adding a replace filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since this will be site wide I wanted to write the replace rules in a variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set replaceHeadline = '&quot;&amp;lt;h1&amp;gt;&quot; : &quot;&amp;lt;p&amp;gt;&quot;, &quot;&amp;lt;/h1&amp;gt;&quot; : &quot;&amp;lt;/p&amp;gt;&quot;' %}&#xA;{{ entry.richText | replace({replaceHeadline}) | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A hash key must be followed by a colon (:). Unexpected token&#xA;  &quot;punctuation&quot; of value &quot;}&quot; (&quot;punctuation&quot; expected with value &quot;:&quot;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this not possible? Is concatenation with &lt;code&gt;~&lt;/code&gt; somehow the way to go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more sane approach to stripping all headline tags from Rich Text fields?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2016-04-03T21:34:55.700" LastActivityDate="2016-04-03T21:34:55.700" Title="Filter rules as a variables" Tags="&lt;richtext&gt;&lt;variable&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14371" PostTypeId="1" CreationDate="2016-03-29T14:42:25.390" Score="1" ViewCount="213" Body="&lt;p&gt;I would love to extend Craft with a custom AssetSourceType. However it looks like components of type 'assetSource' are not extensible (enableForPlugins = false).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this?&#xA;Or can I simply swap core services in the &lt;code&gt;common.php&lt;/code&gt; without hacking the core?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to provide a 'S3CompatAssetSourceType' - the main difference to the S3AssetSourceType is the API endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4538" LastEditorUserId="57" LastEditDate="2016-04-04T04:11:56.073" LastActivityDate="2016-06-03T04:50:31.787" Title="Custom Asset Source Types - not possible" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;s3&gt;&lt;extends&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14372" PostTypeId="2" ParentId="14370" CreationDate="2016-03-29T15:43:19.857" Score="2" Body="&lt;p&gt;You'd have to store the complete array into the variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set replaceHeadline = {'&amp;lt;h1&amp;gt;': '&amp;lt;p&amp;gt;', '&amp;lt;/h1&amp;gt;': '&amp;lt;/p&amp;gt;'} %}&#xA;{{ entry.richText|replace(replaceHeadline)|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But instead of storing that variable I'd probably just create a macro for that snippet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_includes/macros.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro formatRichText(string) %}&#xA;    {{- string|replace({&#xA;        '&amp;lt;h1&amp;gt;': '&amp;lt;p&amp;gt;',&#xA;        '&amp;lt;/h1&amp;gt;': '&amp;lt;/p&amp;gt;'&#xA;    })|raw }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_layout.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_includes/macros' as macros %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now use that helper macro everywhere in your templates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ macros.formatRichText(entry.richText) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another recommendation, have a look at the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Change&quot; rel=&quot;nofollow&quot;&gt;RetconHTML&lt;/a&gt; plugin, a nice little plugin to manipulate HTML with Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ string|retconChange('h1', 'p') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-29T15:43:19.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14373" PostTypeId="1" AcceptedAnswerId="14462" CreationDate="2016-03-29T16:23:52.420" Score="1" ViewCount="174" Body="&lt;p&gt;Does anyone know where to set the passphrase for the PEM file that is configured in the Push Notification Plugin for Craft CMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a new app and set the Certification Location to the PEM file location. I have tested on the server to confirm that the certificate and key files work. However, when I try to send a new alert -- I get the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stream_socket_client(): Unable to set private key file &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which I'm sure is due to the fact that I haven't told it what the passphrase is. However, I can't find any documentation that explains where to put this configuration setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin Github Reference: &lt;a href=&quot;https://github.com/boboldehampsink/pushnotifications&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/pushnotifications&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="57" LastEditDate="2016-04-03T21:53:15.970" LastActivityDate="2016-04-03T21:53:15.970" Title="Where do you set PEM file passphrase for Craft CMS Push Notification Plugin for an iOS app?" Tags="&lt;plugins&gt;&lt;plugin-pushnotifications&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14374" PostTypeId="1" CreationDate="2016-03-29T18:03:42.887" Score="1" ViewCount="692" Body="&lt;p&gt;I see from the Craft's default remove index.php htaccess code &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; that the following line takes into account favicon.ico files.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was wondering, with the many different file names of favicons these days would it be ok to make the rule look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{REQUEST_URI} !^/(.*\.ico|.*\.png)$ [NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="196" LastActivityDate="2016-03-29T18:03:42.887" Title="htaccess and favicons" Tags="&lt;htaccess&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14375" PostTypeId="1" AcceptedAnswerId="14376" CreationDate="2016-03-29T19:01:22.320" Score="7" ViewCount="635" Body="&lt;p&gt;After updating to &lt;a href=&quot;https://craftcms.com/changelog#build2778&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.6.2778&lt;/a&gt;, my plugin is causing these deprecation errors:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;PathService::getTemplatesPath() has been deprecated. Use TemplatesService::getTemplatesPath() or TemplatesService::getTemplateMode() instead.&lt;/p&gt;&#xA;&lt;p&gt;PathService::setTemplatesPath() has been deprecated. Use TemplatesService::setTemplatesPath() or TemplatesService::setTemplateMode() instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How do I fix these?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-03-29T22:28:17.740" Title="How do I fix getTemplatesPath() / setTemplatesPath() deprecation errors?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14376" PostTypeId="2" ParentId="14375" CreationDate="2016-03-29T19:01:22.320" Score="6" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/PathService#getTemplatesPath-detail&quot;&gt;PathsService::getTemplatesPath()&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/classreference/services/PathService#setTemplatesPath-detail&quot;&gt;setTemplatesPath()&lt;/a&gt; were deprecated in Craft 2.6.2778. They were commonly used by Craft and plugins to render front-end templates from the Control Panel (or vise-versa).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We realized that there were cases where simply changing the root templates path was insufficient to emulate front-end requests in the CP, though. For example, if &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultTemplateExtensions&quot;&gt;defaultTemplateExtensions&lt;/a&gt; was being overridden to:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'defaultTemplateExtensions' =&amp;gt; array('htm'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the CP was trying to find a “test” template which was supposed to resolve to &lt;em&gt;test.htm&lt;/em&gt;, a CP request would not actually be able to find the template, because CP requests are only looking for templates that end in &lt;em&gt;.twig&lt;/em&gt; and &lt;em&gt;.html&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in 2.6.2778 we’ve resolved this with “template modes”, which provide an explicit way to tell Craft to render a front-end template vs. a CP template, rather than simply telling it to use a different base template directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating your plugin code is pretty simple. Just change things like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath(craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath());&#xA;&#xA;// ...&#xA;&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$oldMode = craft()-&amp;gt;templates-&amp;gt;getTemplateMode();&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;&#xA;// ...&#xA;&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode($oldMode);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="141" LastEditDate="2016-03-29T21:07:36.970" LastActivityDate="2016-03-29T21:07:36.970" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14377" PostTypeId="1" AcceptedAnswerId="14379" CreationDate="2016-03-29T20:04:15.563" Score="2" ViewCount="622" Body="&lt;p&gt;Any help here would be appreciated… I feel like this is really close. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 4 entry types, all of which are shown in a blog index:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Article&lt;/li&gt;&#xA;&lt;li&gt;Video&lt;/li&gt;&#xA;&lt;li&gt;Image&lt;/li&gt;&#xA;&lt;li&gt;Blurb&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The most recent entry of the Article type should always be shown as a &quot;featured article&quot; at the top of the page and never repeated again; all the other entry types should appear below this single featured entry in chronological order. The featured article should only appear on the first page of the index, and never appear on subsequent &quot;pages&quot; because this page also uses infinite scroll. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the featured article shows up again on all pages past the first. When I remove pagination, but use the same &lt;code&gt;nonFeaturedIds&lt;/code&gt; parameter to get my entries, everything works perfectly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, it seems that the &quot;featured article,&quot; is not properly being excluded from Pagination by the entry paramaters I've set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Define a variable for all the post types #}&#xA;  {% set allIds = craft.entries.section('news').ids() %}&#xA;{# Define a variable for the featured article: the first occurance of the article entry type #}&#xA;  {% set featuredId = craft.entries.type('article').limit('1').ids() %}&#xA;{# Define all other entries and entry types as non featured #}&#xA;  {% set nonFeaturedIds = allIds|without(featuredId) %}&#xA;&#xA;{# Get the featured entry #}&#xA;  {% for entry in craft.entries.id(featuredId) %}&#xA;    {% include '/partials/_featuredArticleTemplate' %}&#xA;  {% endfor %}&#xA;&#xA;{# set paramaters on an elementCriteriaModel to get all non featured articles and paginate #}&#xA;  {% set entries = craft.entries.id(nonFeaturedIds) %}&#xA;  {% paginate entries.limit(10) as pageCount, nonfeatured %}&#xA;&#xA;{# Take us to 404 if the page doesn't exist. Otherwise, Infinite scroll keeps repeating the last page of content. #}&#xA;  {% if craft.request.getPageNum() &amp;gt; pageCount.totalPages %}&#xA;    {% exit 404 %}&#xA;  {% endif %}&#xA;&#xA;{# load up the templates for each entry type #}&#xA;  {% for entry in nonfeatured %}&#xA;    {# all the other articles #}&#xA;    {% switch entry.type %} &#xA;      {% case &quot;article&quot; %}&#xA;          {% include '/partials/_articleTemplate' %}&#xA;      {% case &quot;video&quot; %}&#xA;        {% include '/partials/_videoTemplate' %}&#xA;      {% case &quot;image&quot; %}&#xA;        {% include '/partials/_imageTemplate' %}&#xA;      {% case &quot;blurb&quot; %}&#xA;        {% include '/partials/_blurbTemplate' %}&#xA;      {% default %}&#xA;    {% endswitch %}&#xA;  {% endfor %}&#xA;&#xA;{# infinite scroll loading area #}&#xA;  {% if pageCount.nextUrl %}&#xA;    {# pagination styles #}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4643" LastEditorUserId="4643" LastEditDate="2016-03-29T20:58:21.063" LastActivityDate="2016-03-29T21:03:56.503" Title="Excluding a single Entry ID of an Entry Type from craft.entries" Tags="&lt;elementcriteriamodel&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14378" PostTypeId="2" ParentId="939" CreationDate="2016-03-29T20:39:19.957" Score="0" Body="&lt;p&gt;If you need to remove these from search results, you may find this helpful: &lt;a href=&quot;https://stackoverflow.com/questions/14071671/remove-query-string-from-end-of-url-url-using-htaccess&quot;&gt;Remove Query Strings from URLs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="413" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-03-29T20:39:19.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14379" PostTypeId="2" ParentId="14377" CreationDate="2016-03-29T21:03:56.503" Score="4" Body="&lt;p&gt;You'd have to add a conditional and render the featured entry on the first paginated page only. You can access that info from the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate#the-pageInfo-variable&quot; rel=&quot;nofollow&quot;&gt;pageInfo&lt;/a&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing I'd do is to remove the featured entry from the all entries criteria model by prepending the ID with 'not' in the &lt;code&gt;id&lt;/code&gt; param (i.e. &lt;code&gt;id('not 72')&lt;/code&gt;). You can probably reduce the amount of database queries with that change.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the featured entry #}&#xA;{% set featuredEntry = craft.entries.section('news').type('article').first() %}&#xA;&#xA;{# Get all other entries #}&#xA;{% set idParam = 'not ' ~ featuredEntry.id %}&#xA;{% set entries = craft.entries.section('news').id(idParam) %}&#xA;&#xA;{% paginate entries.limit(10) as pageInfo, pageEntries %}&#xA;&#xA;{# Render the featured entry for the first page only #}&#xA;{% if pageInfo.currentPage == 1 %}&#xA;    {% include '/partials/_featuredArticleTemplate' with {&#xA;        entry: featuredEntry&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{# Render all the other entries #}&#xA;{% for entry in pageEntries %}&#xA;    {# include partial #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-29T21:03:56.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14380" PostTypeId="2" ParentId="14375" CreationDate="2016-03-29T21:08:10.040" Score="4" Body="&lt;p&gt;You can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$oldPath = method_exists(craft()-&amp;gt;templates, 'getTemplatesPath') ? craft()-&amp;gt;templates-&amp;gt;getTemplatesPath() : craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;method_exists(craft()-&amp;gt;templates, 'setTemplatesPath') ? craft()-&amp;gt;templates-&amp;gt;setTemplatesPath($newPath) : craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and then to restore it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;method_exists(craft()-&amp;gt;templates, 'setTemplatesPath') ? craft()-&amp;gt;templates-&amp;gt;setTemplatesPath($oldPath) : craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;craft()-&amp;gt;path-&amp;gt;templatesPath&lt;/code&gt; ends up calling &lt;code&gt;craft()-&amp;gt;path-&amp;gt;getTemplatesPath()&lt;/code&gt; so you have to fix any instances of that as well.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you're dealing with this issue, your choices are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Do nothing and have it spew “alarming” deprecation errors to&#xA;&lt;code&gt;admin&lt;/code&gt; when running Craft 2.6.2778 or later.&lt;/li&gt;&#xA;&lt;li&gt;Update it to the new code, and say your plugin requires 2.6.2778&#xA;(and have it break on all previous versions of Craft).&lt;/li&gt;&#xA;&lt;li&gt;Use the code I posted above to check for the methods existing, and use&#xA;them if they are there.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;TBH, I think deprecation errors shouldn't be on the Dashboard. Admins log in and see a big scary message they've never seen before, and realistically, they can't do anything about it other than trying to update a plugin or contact the developer.  Plugin developers know where to look for deprecation notices, but even more handy perhaps would be runtime deprecation warnings/errors when &lt;code&gt;devMode&lt;/code&gt; is on.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2016-03-29T22:28:17.740" LastActivityDate="2016-03-29T22:28:17.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14381" PostTypeId="2" ParentId="14367" CreationDate="2016-03-29T21:49:21.717" Score="4" Body="&lt;p&gt;A relationship field expects an array of element IDs. So to remove a user, you'd just get all the current IDs and remove&#xA;the one you want to delete.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the current member IDs&#xA;$members = $entry-&amp;gt;accepted-&amp;gt;ids();&#xA;&#xA;// Remove a member ID&#xA;$key = array_search(52, $members); &#xA;if ($key !== false) {&#xA;    unset($members[$key]);&#xA;}&#xA;&#xA;// Add a new member ID&#xA;$members[] = 83;&#xA;&#xA;// Update the member IDs&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'accepted' =&amp;gt; $members&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-29T21:49:21.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14382" PostTypeId="1" AcceptedAnswerId="14383" CreationDate="2016-03-30T08:29:56.720" Score="2" ViewCount="73" Body="&lt;p&gt;I'm building a plugin which needs to add users to a users-type field when they edit the entry on the front-end. It works well when the post is created, adding the original author to the field, and again when the same user edits the post. However, when another user edits the post everything comes to a standstill for a minute and users are taken not to the landing page, but to a page containing nothing other than a &quot;1&quot;. Checking the back-end, it has added the second user to the field, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest to me from the code below why adding a second (haven't tested any more than that yet) user brings things the server to its knees?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    // ON SAVE ENTRY&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $notifyMe = craft()-&amp;gt;request-&amp;gt;getPost('notifyme');          &#xA;&#xA;        // CHECK THIS IS THE FORUM SECTION&#xA;        if ($entry-&amp;gt;sectionId == 16) {&#xA;            craft()-&amp;gt;notifier-&amp;gt;addAnotherUserToNotify($entry, $user, $notifyMe);&#xA;        }           &#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ADD ANOTHER USER TO A POST'S NOTIFICATION LIST&#xA;public function addAnotherUserToNotify($entry, $user, $notifyMe) &#xA;{&#xA;    if ($notifyMe == &quot;yes&quot;) {&#xA;&#xA;        // GET IDs OF USERS ALREADY LISTED TO BE NOTIFIED&#xA;        $usersToNotify = $entry-&amp;gt;usersToNotify-&amp;gt;ids();&#xA;        if ( ! in_array( $user-&amp;gt;id, $usersToNotify ) ) {&#xA;            // ADD THE CURRENT USER TO THE ARRAY OF USERS TO BE NOTIFIED&#xA;            $usersToNotify[] = $user-&amp;gt;id;&#xA;        }           &#xA;&#xA;        // UPDATE THE ENTRY'S FIELD WITH THIS UPDATED ARRAY&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttribute('usersToNotify', $usersToNotify);&#xA;&#xA;        // SAVE ENTRY&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code is inspired by &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13032/update-user-field-type-for-entry-in-plugin&quot;&gt;Update User &amp;quot;Field Type&amp;quot; for Entry in Plugin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-10-03T18:19:33.017" Title="Adding second user to user field in plugin brings server to its knees" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14383" PostTypeId="2" ParentId="14382" CreationDate="2016-03-30T08:56:55.673" Score="5" Body="&lt;p&gt;You've created an endless loop with calling &lt;code&gt;saveEntry&lt;/code&gt; within the &lt;code&gt;entries.saveEntry&lt;/code&gt; event listener. You can fix it with implementing a static variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    static $recursionLevel = 0;&#xA;&#xA;    if ($recursionLevel == 0) {&#xA;        $recursionLevel++;&#xA;&#xA;        // `saveEntry` in `addAnotherUserToNotify` triggers another&#xA;        // `entries.saveEntry` event&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-30T08:56:55.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14384" PostTypeId="1" CreationDate="2016-03-30T09:12:27.440" Score="1" ViewCount="53" Body="&lt;p&gt;we have a little problem with craft after updating to the new version.&#xA;the entry-overview (foo.com/craft-admin/entries/) seems to load much slower than before when I click an entry (up to 10 seconds)&#xA;problem part 2: we just created about 100 sections, which makes the system complete unusable, as we run into timeouts by clicking certain entries. &#xA;any idea how to deal with this?&lt;/p&gt;&#xA;" OwnerUserId="4633" LastEditorUserId="344" LastEditDate="2016-03-30T15:45:29.597" LastActivityDate="2016-03-30T15:45:29.597" Title="entry-overview superslow after update?" Tags="&lt;mysql&gt;&lt;timeout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14385" PostTypeId="2" ParentId="14384" CreationDate="2016-03-30T10:58:55.637" Score="3" Body="&lt;p&gt;okay, guess I got it.&#xA;as soon as I kick the Preparse Field-plugin, everything works smooth. but i guess it's not the plugin that causes the trouble, it's the way craft is writing its logs for deprecated code? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;another solution: RTFM..&#xA;in Preparse Field-plugin: activate &quot;Disable all Preparse field columns on all element indices&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4633" LastEditorUserId="4633" LastEditDate="2016-03-30T11:18:12.307" LastActivityDate="2016-03-30T11:18:12.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14386" PostTypeId="1" AcceptedAnswerId="14391" CreationDate="2016-03-30T11:10:28.770" Score="1" ViewCount="668" Body="&lt;p&gt;I'm trying to get CSRF in the craft login form. I've added the config setting ('enableCsrfProtection' =&gt; true,) and added 'name=&quot;{{ craft.config.csrfTokenName }}&quot; value=&quot;{{ craft.request.csrfToken }}&quot;' to the login form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var cookieTest = 'CraftCookieTest='+Math.floor(Math.random() * 1000000);&#xA;    document.cookie = cookieTest;&#xA;    var cookiesEnabled = document.cookie.search(cookieTest) != -1;&#xA;    if (cookiesEnabled)&#xA;    {&#xA;        document.cookie = cookieTest + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';&#xA;&#xA;        document.write(&#xA;            '{%- set hasLogo = (CraftEdition &amp;gt;= CraftClient and craft.rebrand.isLogoUploaded ? true : false) -%}'+&#xA;            '&amp;lt;form id=&quot;login-form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; name=&quot;{{ craft.config.csrfTokenName }}&quot; value=&quot;{{ craft.request.csrfToken }}&quot; {% if hasLogo -%}&#xA;                    {%- set logo = craft.rebrand.logo -%}&#xA;                    {%- set padding = logo.height + 30 -%}&#xA;                    class=&quot;has-logo&quot; style=&quot;background-image: url(\'{{ logo.url }}\'); background-size: {{ logo.width }}px {{ logo.height }}px; padding-top: {{ padding }}px; margin-top: -{{ round((353+padding)/2) }}px&quot;&#xA;                {%- endif %}&amp;gt;' +&#xA;                '{% if not hasLogo -%}&amp;lt;h1&amp;gt;{{ siteName }}&amp;lt;/h1&amp;gt;{%- endif %}'+&#xA;                '{% set placeHolderText = (craft.config.useEmailAsUsername ? &quot;Email&quot;|t : &quot;Username or Email&quot;|t) %}' +&#xA;                '{{ forms.textField({ id: &quot;loginName&quot;, name: &quot;username&quot;, placeholder: placeHolderText, value: username })|e(&quot;js&quot;) }}' +&#xA;&#xA;                '&amp;lt;div id=&quot;login-fields&quot; class=&quot;nested-fields&quot;&amp;gt;' +&#xA;                    '{{ forms.passwordField({ id: &quot;password&quot;, name: &quot;password&quot;, placeholder: &quot;Password&quot;|t })|e(&quot;js&quot;) }}' +&#xA;                    '&amp;lt;a id=&quot;forgot-password&quot;&amp;gt;{{ &quot;Forget your password?&quot;|t }}&amp;lt;/a&amp;gt;' +&#xA;                    {% if craft.config.rememberedUserSessionDuration %}&#xA;                        '{{ forms.checkboxField({ id: &quot;rememberMe&quot;, label: &quot;Keep me logged in&quot;|t })|e(&quot;js&quot;) }}' +&#xA;                    {% endif %}&#xA;                '&amp;lt;/div&amp;gt;' +&#xA;&#xA;                '&amp;lt;div class=&quot;buttons&quot;&amp;gt;' +&#xA;                    '{# &amp;lt;div id=&quot;ssl-icon&quot; class=&quot;disabled&quot;&amp;gt;&amp;lt;div class=&quot;{{ craft.request.isSecure ? &quot;secure&quot; : &quot;insecure&quot; }} icon&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;#}' +&#xA;                    '&amp;lt;input id=&quot;submit&quot; class=&quot;btn submit disabled&quot; type=&quot;submit&quot; value=&quot;{{ &quot;Login&quot;|t }}&quot;&amp;gt;' +&#xA;                    '&amp;lt;div id=&quot;spinner&quot; class=&quot;spinner hidden&quot;&amp;gt;&amp;lt;/div&amp;gt;' +&#xA;                '&amp;lt;/div&amp;gt;' +&#xA;                '&amp;lt;a id=&quot;poweredby&quot; href=&quot;http://craftcms.com/&quot; title=&quot;{{ &quot;Powered by Craft CMS&quot;|t }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ resourceUrl(&quot;images/craftcms.svg&quot;) }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;'+&#xA;            '&amp;lt;/form&amp;gt;'&#xA;        );&#xA;&#xA;        {% if not craft.request.isMobileBrowser(true) %}&#xA;            document.getElementById(&quot;{{ (username ? 'password' : 'loginName') }}&quot;).focus();&#xA;        {% endif %}&#xA;    }&#xA;    else&#xA;    {&#xA;        document.write(&#xA;            '&amp;lt;div class=&quot;no-access&quot;&amp;gt;' +&#xA;                '&amp;lt;div class=&quot;pane&quot;&amp;gt;' +&#xA;                    '&amp;lt;div class=&quot;pane-body&quot;&amp;gt;' +&#xA;                        '&amp;lt;div class=&quot;notice&quot;&amp;gt;' +&#xA;                            '&amp;lt;div class=&quot;icon&quot;&amp;gt;&amp;lt;/div&amp;gt;' +&#xA;                            '&amp;lt;p&amp;gt;{{ &quot;Cookies must be enabled to access the Craft CMS control panel.&quot;|t }}&amp;lt;br&amp;gt;' +&#xA;                                '&amp;lt;a class=&quot;go nowrap&quot; href=&quot;&quot;&amp;gt;{{ &quot;See how&quot;|t }}&amp;lt;/a&amp;gt;' +&#xA;                            '&amp;lt;/p&amp;gt;' +&#xA;                        '&amp;lt;/div&amp;gt;' +&#xA;                    '&amp;lt;/div&amp;gt;' +&#xA;                '&amp;lt;/div&amp;gt;' +&#xA;            '&amp;lt;/div&amp;gt;'&#xA;        );&#xA;    }&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe this is all correct, but not sure how this could be tested? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4950" LastActivityDate="2016-03-30T13:59:10.493" Title="CSRF admin Login" Tags="&lt;admin&gt;&lt;login&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14387" PostTypeId="1" AcceptedAnswerId="14388" CreationDate="2016-03-30T12:43:50.163" Score="3" ViewCount="222" Body="&lt;p&gt;I would like to have a front-end profile form on my website that contains a matrix field. The matrix field will allow the user to add an infinite number of awards they have earned. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-04-01T18:02:47.927" Title="How can I add a dynamic number of rows to a matrix via plugin?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14388" PostTypeId="2" ParentId="14387" CreationDate="2016-03-30T12:43:50.163" Score="3" Body="&lt;p&gt;There are a few threads on this that I found helpful. I think they are all worth looking at and reading through as my solution may vary based on your needs. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10371/save-matrix-block-to-new-entry-in-plugin&quot;&gt;Save matrix block to new entry in plugin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1101/how-to-save-a-matrix-content-of-a-new-entry-in-my-plugin&quot;&gt;How to save a matrix content of a new entry in my plugin?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/brandonkelly/8149062&quot; rel=&quot;nofollow noreferrer&quot;&gt;Saving new Matrix data&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is the complete solution that ended up working. If there are improvements, please let me know so I can update the thread accordingly!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;profile/saveProfile&quot;&amp;gt;&#xA;&#xA;    ...&#xA;&#xA;    {% if profile.awardsHonors|length %}&#xA;        &amp;lt;div id=&quot;awards&quot;&amp;gt;&#xA;            {% for block in profile.awardsHonors %}&#xA;                &amp;lt;div class=&quot;matrixblock award&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[awardsHonors][{{ block.id }}][type]&quot; value=&quot;award&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[awardsHonors][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;input type=&quot;text&quot; name=&quot;fields[awardsHonors][{{ block.id }}][fields][award]&quot; class=&quot;form-control&quot; value=&quot;{{ block.award }}&quot;&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                {% set blockId = block.id %}&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;div id=&quot;awards&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    ...&#xA;&#xA;    &amp;lt;button type=&quot;button&quot; id=&quot;addAward&quot;&amp;gt;Add Award&amp;lt;/button&amp;gt;&#xA;&#xA;    ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;javascript&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var awardBlockNum = 1;&#xA;&#xA;$('#addAward').click(function (event) {&#xA;    var markup = '&amp;lt;div class=&quot;matrixblock award&quot;&amp;gt;' +&#xA;        '&amp;lt;div class=&quot;form-group&quot;&amp;gt;' +&#xA;        '&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[awardsHonors][new' + awardBlockNum + '][type]&quot; value=&quot;award&quot;&amp;gt;' +&#xA;        '&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[awardsHonors][new' + awardBlockNum + '][enabled]&quot; value=&quot;1&quot;&amp;gt;' +&#xA;        '&amp;lt;input type=&quot;text&quot; name=&quot;fields[awardsHonors][new' + awardBlockNum + '][fields][award]&quot; class=&quot;form-control&quot;&amp;gt;' +&#xA;        '&amp;lt;/div&amp;gt;' +&#xA;        '&amp;lt;/div&amp;gt;';&#xA;&#xA;        $(markup).appendTo($('#awards'));&#xA;&#xA;        awardBlockNum++;&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginController&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveProfile()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'mySectionHandle';&#xA;    $criteria-&amp;gt;limit = 1;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;authorId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    if ($entries) {&#xA;        foreach ($criteria as $entry) {&#xA;            $awardMatrixData = array();&#xA;&#xA;            /**&#xA;             * New matrix fields are prefixed with 'new1'.&#xA;             * To compensate we need to create a new increment variable to correctly store the matrix number&#xA;             * while looping the correct amount of times.&#xA;             */&#xA;&#xA;            foreach (craft()-&amp;gt;request-&amp;gt;getPost('fields.awardsHonors') as $key =&amp;gt; $value) {&#xA;                $i = 1;&#xA;&#xA;                if ($key == 'new' . $i) { // Check for a new award.&#xA;                    $awardMatrixData['new' . $i] = array(&#xA;                        'type' =&amp;gt; 'award',&#xA;                        'enabled' =&amp;gt; true,&#xA;                        'fields' =&amp;gt; array(&#xA;                            'award' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('fields.awardsHonors.new' . $i . '.fields.award')&#xA;                        )&#xA;                    );&#xA;                } else { // Update existing awards.&#xA;                    $awardMatrixData[$key] = array(&#xA;                        'type' =&amp;gt; 'award',&#xA;                        'enabled' =&amp;gt; true,&#xA;                        'fields' =&amp;gt; array(&#xA;                            'award' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('fields.awardsHonors.' . $key . '.fields.award')&#xA;                        )&#xA;                    );&#xA;                }&#xA;&#xA;                $i++;&#xA;            }&#xA;&#xA;            $entry-&amp;gt;setContentFromPost(array(&#xA;                ...&#xA;                ...&#xA;                'awardsHonors' =&amp;gt; $matrixData&#xA;            ));&#xA;&#xA;            if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;                // Profile updated!;&#xA;            } else {&#xA;                // Could not save entry (profile).&#xA;            }&#xA;        }&#xA;    } else {&#xA;        // No entry found that matches criteria.&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-01T18:02:47.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14389" PostTypeId="1" CreationDate="2016-03-30T13:09:55.723" Score="1" ViewCount="511" Body="&lt;p&gt;Recently I cannot update Craft on a server. From versions 2.6.2778 and 2.6.2779. I only can download the zip to install it myself. What could be wrong here? &#xA;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP: 5.6.16-1byte1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alert on iconv (older version)&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2016-03-30T13:50:06.763" Title="Cannot update Craft, only download the zip" Tags="&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14390" PostTypeId="2" ParentId="14389" CreationDate="2016-03-30T13:50:06.763" Score="3" Body="&lt;p&gt;You can do manual installs easily, all you really need it's the app folder inside the craft folder. but don't just replace it.&lt;br&gt;&#xA;I would rename the new app folder to something like &quot;app-new&quot; move it next to the other app folder inside craft folder. once it is all done copying. I would rename the &quot;app&quot; folder into &quot;app-old&quot; and rename the &quot;app-new&quot; into &quot;app&quot; again. Then go to your admin URL and craft should do the automatic database changes that it needs. It has worked for me in the past and it's quick and easy and less error prone.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastActivityDate="2016-03-30T13:50:06.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14391" PostTypeId="2" ParentId="14386" CreationDate="2016-03-30T13:59:10.493" Score="2" Body="&lt;p&gt;the CSRF field its a hidden field not part of the form attributes.&lt;br&gt;&#xA;You don't have to manually type it, craft twig comes with &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt; that recreates a hidden field between the &lt;code&gt;&amp;lt;form&gt;&amp;lt;/form&gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;!-- ... --&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, that seems to be a Javascript call if you are doing Ajax you need to add those variables to the script so the action knows about them. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;window.csrfTokenName = &quot;{{ craft.config.csrfTokenName|e('js') }}&quot;;&#xA;window.csrfTokenValue = &quot;{{ craft.request.csrfToken|e('js') }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Usually works for me.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastActivityDate="2016-03-30T13:59:10.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14392" PostTypeId="2" ParentId="11176" CreationDate="2016-03-30T14:41:16.340" Score="1" Body="&lt;p&gt;I would consider using &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;Search&lt;/a&gt; because it already orders by relevance. You could define the search query using the tags. Make sense? &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-30T14:41:16.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14393" PostTypeId="1" AcceptedAnswerId="14403" CreationDate="2016-03-30T15:09:08.480" Score="4" ViewCount="891" Body="&lt;p&gt;I need help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get entries based on multiple field search. It works for basic field types like selectbox or plain text but I can't get it to work with Categories Fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field size is a selectbox field and works good.&#xA;The color is a Categories field and doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = &quot;houses&quot;;&#xA;$criteria-&amp;gt;size = &quot;big&quot;; &#xA;$criteria-&amp;gt;color = &quot;white&quot;; // &amp;lt;== HOW???&#xA;$entries = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria)-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get entries with a specific Categories Field value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="4953" LastActivityDate="2017-05-28T12:59:16.927" Title="Get entries by category value from within plugin" Tags="&lt;categories&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14394" PostTypeId="2" ParentId="11176" CreationDate="2016-03-30T15:17:08.150" Score="2" Body="&lt;p&gt;I've made a plugin called &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow&quot;&gt;Similar&lt;/a&gt; that does exactly this. Give it a go.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-03-30T15:17:08.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14395" PostTypeId="2" ParentId="1245" CreationDate="2016-03-30T15:25:38.087" Score="1" Body="&lt;p&gt;I don't think the accepted answer actually works, &lt;code&gt;order: 'score'&lt;/code&gt; only works if you are doing a search. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a plugin called &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow&quot;&gt;Similar&lt;/a&gt; that orders by the number of relations to other element types, like tags.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-03-30T15:25:38.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14397" PostTypeId="1" AcceptedAnswerId="14398" CreationDate="2016-03-30T15:34:49.297" Score="2" ViewCount="559" Body="&lt;p&gt;I am looking at a site at the moment which uses SASS to compile its CSS file. All styling references appear to be referencing the styling from the SCSS file, rather than the CSS file. Previously, all references pointed to main.css, but now points to the .scss file where the class is defined. Moving the .scss file on the server, or changing the filepath for the folder doesn't seem to stop it loading. My concern is that the site is now loading the multitude of .scss files rather than a single, minimized, .css file. Can anyone offer any insight on what is going on here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is &lt;a href=&quot;http://spiffingcovers.com/&quot; rel=&quot;nofollow&quot;&gt;http://spiffingcovers.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4954" LastActivityDate="2016-03-30T16:08:04.573" Title="Craft loading SCSS references rather than CSS" Tags="&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14398" PostTypeId="2" ParentId="14397" CreationDate="2016-03-30T16:08:04.573" Score="1" Body="&lt;p&gt;The references to .scss files are just to help you find and debug any changes you would like to make - the browsers developer tools are trying to help you by pointing you at the relevant file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I 'view source' of your home page I can see that only main.css is loading :)&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-30T16:08:04.573" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14399" PostTypeId="2" ParentId="14393" CreationDate="2016-03-30T17:01:17.743" Score="1" Body="&lt;p&gt;Okey. I found a solution. Probably not the fastest because of a search but it works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;search = &quot;color:white&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So color is the field alias. white is the category handle to look for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read more about search here =&gt; &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4953" LastActivityDate="2016-03-30T17:01:17.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14400" PostTypeId="1" AcceptedAnswerId="14407" CreationDate="2016-03-30T18:46:50.337" Score="1" ViewCount="135" Body="&lt;p&gt;So, I have a form created using formerly and their &lt;a href=&quot;https://github.com/xodigital/Formerly/blob/master/form.html&quot; rel=&quot;nofollow&quot;&gt;template&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form works fine, but I am trying to check for duplicate e-mails and just stop a submission when it notices there is one in the system. The following works and the console spits out true on data.alreadysubmitted but the line below does not stop the post. How should I handle this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I know the code needs cleanup. It will be done after functionality is met. I still need to check date of submission after finding an email duplicate to enable a 1 entry per day style form)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#form&quot;).on('submit', function (e) {&#xA;        console.log($(&quot;#formtest_email&quot;).val());&#xA;        $.post('?ok=1', {&#xA;            action: 'formerly/submissions/alreadySubmitted',&#xA;            formid: $(&quot;input[name=formId]&quot;).val(),&#xA;            email: $(&quot;#formtest_email&quot;).val()&#xA;        },&#xA;        function(data, status){&#xA;            console.log(&quot;already?:&quot; + data.alreadysubmitted + &quot;\nStatus: &quot; + data.ok);&#xA;            if (data.alreadysubmitted == true) &#xA;            {&#xA;                 e.preventDefault();&#xA;            }&#xA;        });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; After trying to store data.alreadysubmitted outside of the function, I realize that the function executes after anything below it (outside of the whole .post method). Would it be right to assume that the function is called after the submit is complete, and hence e.preventDefault will not work?&lt;/p&gt;&#xA;" OwnerUserId="4592" LastEditorUserId="4592" LastEditDate="2016-03-30T19:27:05.663" LastActivityDate="2016-03-30T21:25:17.523" Title="Formerly - Checking if e-mail already entered" Tags="&lt;ajax&gt;&lt;plugins-formerly&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14402" PostTypeId="1" AcceptedAnswerId="14406" CreationDate="2016-03-30T19:15:09.750" Score="2" ViewCount="696" Body="&lt;p&gt;I'm currently working on a relation-heavy website with a colleague of mine and, for that reason, eager-loading stuff looks very appealing to us.&#xA;We've succeeded in eager-loading pretty much everything that we needed but there is just one kind of template that we couldn't make it work with: paginated archives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The context:&lt;/strong&gt;&#xA;We have this archive page that loads every entry of a 'projects' section and, next to each entry, we have a list of all images that the entry contains which is between 8-20 images (remember, I said it was relation-heavy ;) ). We care a lot about performance so we decided to paginate this big entry listing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The issue:&lt;/strong&gt;&#xA;All this works very well except that when we tried to eager-load those images, we transformed our original query which was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProjects = craft.entries(queryParams).limit(itemsPerPage) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProjects = craft.entries(queryParams).limit(itemsPerPage).find({&#xA;    with: [&#xA;        'gridMatrixBlock1:rowItem1',&#xA;        ['gridMatrixBlock1:rowItem1.gridimageFile', {&#xA;            kind: 'image',&#xA;            withTransforms: projectThumb&#xA;        }],&#xA;        ...&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt;&#xA;Since .find() returns an array, we have no way to paginate this (pagination need an ElementCriteriaModel). Is there any workaround I don't know about?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastActivityDate="2017-07-12T08:21:22.850" Title="Eager-load and pagination" Tags="&lt;elementcriteriamodel&gt;&lt;pagination&gt;&lt;array&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14403" PostTypeId="2" ParentId="14393" CreationDate="2016-03-30T19:22:02.047" Score="3" Body="&lt;p&gt;Here's how you'd do it making use of the &lt;code&gt;relatedTo&lt;/code&gt; parameter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;slug = 'white';&#xA;$category = $criteria-&amp;gt;first();&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $category&#xA;);&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-05-28T12:59:16.927" LastActivityDate="2017-05-28T12:59:16.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14404" PostTypeId="2" ParentId="14393" CreationDate="2016-03-30T19:23:06.067" Score="4" Body="&lt;p&gt;Here's another solution which feels more correct. It uses relations and the relatedTo parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// First get the all CategoryModels&#xA;$colorCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$colorCriteria-&amp;gt;group = 'colors';&#xA;$colorCriteria-&amp;gt;slug = array(&quot;white&quot;);&#xA;$colorCategories = $colorCriteria-&amp;gt;find();&#xA;&#xA;// Then get the entries&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = &quot;houses&quot;;&#xA;$criteria-&amp;gt;size = &quot;big&quot;;&#xA;$criteria-&amp;gt;relatedTo = $colorCategories;//&amp;lt;= Here's the fancy part. &#xA;$entries = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria)-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps someone else. &lt;/p&gt;&#xA;" OwnerUserId="4953" LastActivityDate="2016-03-30T19:23:06.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14405" PostTypeId="2" ParentId="14357" CreationDate="2016-03-30T20:29:49.393" Score="1" Body="&lt;p&gt;In this case it was pulling through 19 rows only when 'Static Field' was selected. Everything was fine otherwise, possibly a way that the data was being pulled.&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2016-03-30T20:29:49.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14406" PostTypeId="2" ParentId="14402" CreationDate="2016-03-30T20:35:19.187" Score="3" Body="&lt;p&gt;&lt;code&gt;with&lt;/code&gt; is just another query param, like &lt;code&gt;limit&lt;/code&gt; or whatever parameters you’re defining in &lt;code&gt;entryParams&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% paginate %}&lt;/code&gt; tag requires that you pass in an ElementCriteriaModel, but as soon as you call &lt;code&gt;find()&lt;/code&gt; you’re actually dealing with an array of the matched entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the key to getting eager-loading working with pagination is to assign the &lt;code&gt;with&lt;/code&gt; param like any other param, rather than passing it into the find() function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;    // ...&#xA;    with: [&#xA;        'gridMatrixBlock1:rowItem1',&#xA;        ['gridMatrixBlock1:rowItem1.gridimageFile', {&#xA;            kind: 'image',&#xA;            withTransforms: projectThumb&#xA;        }],&#xA;        ...&#xA;    ]&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then you can create your ElementCriteriaModel just like you were doing before:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProjects = craft.entries(queryParams).limit(itemsPerPage) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-03-30T20:35:19.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14407" PostTypeId="2" ParentId="14400" CreationDate="2016-03-30T21:25:17.523" Score="2" Body="&lt;p&gt;(this is more of a jquery question than Craft, but...:))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason this doesn't work is because &lt;code&gt;$.post&lt;/code&gt; works asynchronously (that's the A in AJAX). It creates a request, with a success handler (the function), then the submit handler continues execution. The success handler isn't run until the request completes, which is probably a couple of hundreds of milliseconds later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various ways to solve this, but the basic idea would be to cancel the submit event straight away if the check hasn't been done, do the check, and then submit the form again if the email didn't exist, and not run the check the second time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's something a bit ugly that I think'll work, but it can be done much more elegantly, I'm sure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var emailWasChecked = false;&#xA;&#xA;$(&quot;#form&quot;).on('submit', function (e) {&#xA;    if (!emailWasChecked) {&#xA;        e.preventDefault();&#xA;&#xA;        $.post('?ok=1', {&#xA;                action: 'formerly/submissions/alreadySubmitted',&#xA;                formid: $(&quot;input[name=formId]&quot;).val(),&#xA;                email: $(&quot;#formtest_email&quot;).val()&#xA;            },&#xA;            function (data, status) {&#xA;                if (data.alreadysubmitted != true) {&#xA;                    emailWasChecked = true;&#xA;                    $(&quot;#form&quot;).trigger('submit');&#xA;                }&#xA;            });&#xA;    } else {&#xA;        emailWasChecked = false;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-03-30T21:25:17.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14408" PostTypeId="1" CreationDate="2016-03-30T22:55:24.170" Score="2" ViewCount="101" Body="&lt;p&gt;I noticed this morning a deprecation error popped up for SproutForms.  I have version 2.2.2 (which I believe is the latest).  Here's the deprecation error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Message&#xA;PathService::setTemplatesPath() has been deprecated. Use TemplatesService::setTemplatesPath() or TemplatesService::setTemplateMode() instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Origin&#xA;/home/xxx.com/craft/app/services/PathService.php (321)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also am showing this in my craft error log:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level   error&#xA;Category    application&#xA;Message There was a problem getting the update feed for “Web Forms”, so it was skipped: [curl] 35: [url] &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/releases.json&quot; rel=&quot;nofollow&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/releases.json&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="3723" LastEditDate="2016-03-31T16:45:57.840" LastActivityDate="2017-10-20T12:41:25.237" Title="SproutForms Problem Getting Update Feed" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14410" PostTypeId="1" AcceptedAnswerId="14414" CreationDate="2016-03-31T07:42:36.793" Score="2" ViewCount="370" Body="&lt;p&gt;I've added a field to an asset which in my case is a fallback image for a video asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When uploading a video the field for the fallback image isn't visible so the chances of forgetting to set one is bigger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To set the fallback image I need to edit my video asset and set the fallback image in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I'd rather set the fallback image in the entrytype so it won't get forgotten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When does it make sense to add the field directly to the asset instead of defining a field in a entrytype? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fieldlayout entrytype version:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Video (asset)&lt;/li&gt;&#xA;&lt;li&gt;Video Thumbnail (asset)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-03-31T10:28:48.770" Title="When to add a field to an asset?" Tags="&lt;assets&gt;&lt;field&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14411" PostTypeId="2" ParentId="5442" CreationDate="2016-03-31T07:47:40.070" Score="1" Body="&lt;p&gt;In my case it was failing because I had set the &lt;code&gt;X-Frame-Options&lt;/code&gt; meta in the base template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;X-Frame-Options&quot; content=&quot;deny&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The browser was rejecting the preview frame content as being protocol data rather than http.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i changed the base template to check for live preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isLivePreview %}&#xA;&amp;lt;meta http-equiv=&quot;X-Frame-Options&quot; content=&quot;deny&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4957" LastActivityDate="2016-03-31T07:47:40.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14412" PostTypeId="2" ParentId="13973" CreationDate="2016-03-31T08:30:48.913" Score="2" Body="&lt;p&gt;I ended up having the ca-site.ca host all of the locales (&lt;code&gt;en_us&lt;/code&gt;, &lt;code&gt;en_ca&lt;/code&gt; and &lt;code&gt;fr_ca&lt;/code&gt;).  The &lt;code&gt;en_us&lt;/code&gt; locale was then set up to be a proxy for the usa-site.com site.  That way, it's easier to maintain the code base, as well as managing the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's locale functionality is indeed amazing.  I do hope they come up with a solution that allows multi parent domain management.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Matt P BTW thanks for the answer, I wanted to comment to it but rep is too low :)&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-03-31T08:30:48.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14413" PostTypeId="1" CreationDate="2016-03-31T08:52:17.310" Score="2" ViewCount="1327" Body="&lt;p&gt;So... I've installed Craft online, and I wanted to start templating my CraftCMS, but I'd like to work with a repository so I can have some kind of versioning. The easiest way to do so seemed to me to install Craft on our hosting server, download those files locally and connect to the online database using MAMP pro.&#xA;I had some issues with our host (I had to whitelist my IP address), but now I can connect to the database using Sequel Pro, but when I try to access my craft CMS site through my local files I get the Craft message &quot;service unavailable&quot;.&#xA;My Mamp Pro is pointed to my public folder (2 folders in my site: public and craft, and it's pointed to this public folder with the index file in it) and I've used the same db settings as the ones I've used in Sequal Pro. Still: no succes.&#xA;The only thing I've changed after downloading the site are these db setting for the host - as I had to do in Sequal Pro.&#xA;Can anyone help a newbie in Craft CMS out here :-)? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2016-03-31T11:11:44.603" Title="Craft install locally with MAMP Pro/versioning" Tags="&lt;mamp&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14414" PostTypeId="2" ParentId="14410" CreationDate="2016-03-31T09:52:26.480" Score="2" Body="&lt;p&gt;It makes sense, when it's a task that should only be done &lt;strong&gt;once&lt;/strong&gt; and is directly related to the asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good example I have of an Asset custom field is a field allowing the content-administrator to define where an images focal point is positioned e.g. top left, bottom right, top right, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to make use of the field EVERY time I display the image asset, but only need to deal with the custom field, once.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Part deux (in answer to your comment): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, in my experience, although you can also double click an asset from the new/edit entry screen and see it's custom fields e.g. &quot;Focal point position&quot;. See image below...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zttim.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zttim.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-03-31T10:28:48.770" LastActivityDate="2016-03-31T10:28:48.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14415" PostTypeId="1" AcceptedAnswerId="14434" CreationDate="2016-03-31T10:39:52.210" Score="2" ViewCount="364" Body="&lt;p&gt;I want to sort (and paginate) entries from a structure section based on the number of descendants. This is the effective criteria I want to query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('myStructure').level(1).order('descendants desc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;getDescendants.count()&lt;/code&gt; is not a number stored against each entry in the database (AFAIK), how does one go about getting this result?&lt;/p&gt;&#xA;" OwnerUserId="3989" LastActivityDate="2016-03-31T17:48:55.847" Title="How to sort entries by their descendant count?" Tags="&lt;structure&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14416" PostTypeId="2" ParentId="14413" CreationDate="2016-03-31T11:11:44.603" Score="2" Body="&lt;p&gt;Here is how I have set things up in the past using a similar workflow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you get Craft out of the box (for lack of better words) as you said there is a &lt;code&gt;craft&lt;/code&gt; folder and a &lt;code&gt;public&lt;/code&gt; folder. Generally you want your &lt;code&gt;craft&lt;/code&gt; folder above/out of your web root. That would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;   |- app&#xA;   |- config&#xA; ...&#xA;&#xA;public/&#xA;   |- index.php&#xA;   |- robots.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When setting up your site, point your &lt;code&gt;doc_root&lt;/code&gt; to the &lt;code&gt;public/&lt;/code&gt; folder.&#xA;For example, if you are using a Mac, a default &lt;code&gt;doc_root&lt;/code&gt; might look like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;    ServerName sitename.dev&#xA;    DocumentRoot &quot;/Applications/MAMP/htdocs/sitename/public&quot;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If successful, you should see a screen saying that your site is unavailable. I can't remember the exact verbiage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there I will edit two files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/config/db.php&#xA;/craft/config/general.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(  // Global configuration&#xA;        'tablePrefix' =&amp;gt; ''&#xA;    ),&#xA;    '.dev' =&amp;gt; array( // local configuration&#xA;        'server' =&amp;gt; '127.0.0.1',&#xA;        'user' =&amp;gt; 'username',&#xA;        'password' =&amp;gt; 'password',&#xA;        'database' =&amp;gt; 'database'&#xA;    ),&#xA;    '.com' =&amp;gt; array( // production configuration&#xA;        'server' =&amp;gt; 'hostname',&#xA;        'user' =&amp;gt; 'username',&#xA;        'password' =&amp;gt; 'password',&#xA;        'database' =&amp;gt; 'database'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'cpTrigger' =&amp;gt; 'your-custom-admin-url',&#xA;        'omitScriptNameInUrls' =&amp;gt; true&#xA;    ),&#xA;        '.dev' =&amp;gt; array(  // local configuration&#xA;            'devMode' =&amp;gt; true,&#xA;            'siteUrl' =&amp;gt; 'http://mysite.dev/',&#xA;            'environmentVariables' =&amp;gt; array(&#xA;                'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;                'baseUrl' =&amp;gt; 'http://mysite.dev/',&#xA;        )&#xA;    ),&#xA;    '.com' =&amp;gt; array(  // production configuration&#xA;        'siteUrl' =&amp;gt; 'http://www.mysite.com/',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; $_SERVER['DOCUMENT_ROOT'] . '/',&#xA;            'baseUrl' =&amp;gt; 'http://www.mysite.com'&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By having the &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment settings&lt;/a&gt; like the above, you can commit your code and it will run regardless of environment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, I like to have a local database which is separate from my production db. My luck, I'll do something silly and delete something on accident. Depending on how big of changes you are making post-launch, I am sure there are good/better/best ways to migrate the updates to your production db vs. manually entering it. But, if they are simple things (added a new field) I usually just do that manually on my production server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like if you &lt;em&gt;can&lt;/em&gt; connect to your production db via a 3rd party tool, but not your application there might be some permission trouble (just a guess). Try working locally with everything first, then move it to your other server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-03-31T11:11:44.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14417" PostTypeId="1" AcceptedAnswerId="14418" CreationDate="2016-03-31T11:27:57.603" Score="1" ViewCount="881" Body="&lt;p&gt;I understood CraftCMS caching should exclude dynamic values, however I have a page built as an Entity within CraftCMS admin which &lt;code&gt;{% include %}&lt;/code&gt;'s a template with a form.  The templates dynamic form values are somehow being rendered with cached values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The included template form uses dynamic values from e.g. &lt;code&gt;{{ craft.session.getFlash(key, '') }}&lt;/code&gt; which are getting cached by CraftCMS causing the form to render with someone else's session values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither the Entity nor template had &lt;code&gt;{% cache %}&lt;/code&gt; flags, and I've tried various cache settings to try and prevent such as &lt;code&gt;{% cache unless craft.session.hasFlash('key') %}&lt;/code&gt; within the form template, and before the &lt;code&gt;{% include %}&lt;/code&gt; within the Entity page, however the template is still rendered with cached form values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is CraftCMS 2.4 with no custom caching plugins, using a Redis cache store and default Craft caching config values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prevent this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4959" LastActivityDate="2016-03-31T13:23:03.770" Title="Prevent craftcms caching CMS page with dynamic template" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14418" PostTypeId="2" ParentId="14417" CreationDate="2016-03-31T13:23:03.770" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag does &lt;em&gt;not&lt;/em&gt; exclude dynamic data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it does, is to basically make note of any &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;element criteria&lt;/a&gt; (i.e. any code relating to pulling entries, categories, assets, tags or users) contained in the Twig code inside the &lt;code&gt;{% cache %}{% endcache %}&lt;/code&gt; pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, whenever something triggers a change to the related element criteria (e.g. if an entry is edited, published or deleted), the cache will automatically be cleared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all related to elements, though – so any other dynamic data you may have in your template, such as session variables, will not trigger the same behaviour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your entry or form templates doesn't have any &lt;code&gt;{% cache %}&lt;/code&gt; tags, I'm guessing you do have some in a base template wrapping your entry and form templates? If so, you'll need to take a more granular approach to your caching, e.g. by caching components separately and avoid &lt;code&gt;{% cache %}&lt;/code&gt; tag nesting. To that end, your &lt;code&gt;unless&lt;/code&gt; statement should work nicely for escaping dynamic data caching, as long as the component you're caching isn't wrapped by a higher-level &lt;code&gt;{% cache %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-03-31T13:23:03.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14419" PostTypeId="1" CreationDate="2016-03-31T13:57:37.120" Score="1" ViewCount="76" Body="&lt;p&gt;We are using the Asset Subfolder Access Plugin to manage the upload/view permissions for several user groups. The Plugin works great with Asset sources and also in the Assets Fields. But since an update*, it does not work anymore with the sources in Redactor. In Redactor it shows now all sources and it's also possible for users to upload files to these sources, even it's not permitted through the Asset Subfolder Access Plugin. Does anyone know how to fix this issue? Thanks a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*In Craft Pro 2.5.2740 it worked without problems&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Asset Sources (Correct: Shows only Folders with Permissions)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z3spo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z3spo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Redactor (Wrong: Shows all Folders)&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/o7fUq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o7fUq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-03-31T13:57:37.120" Title="Plugin Asset Subfolder Access Issue after Update" Tags="&lt;plugins&gt;&lt;bug&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-04-04T19:32:21.357" ContentLicense="CC BY-SA 3.0" />
  <row Id="14420" PostTypeId="1" AcceptedAnswerId="14422" CreationDate="2016-03-31T14:28:12.220" Score="1" ViewCount="366" Body="&lt;p&gt;Is it possible to upload assets into the folders listed in the asset section on the server manually/directly? And then &quot;sync up&quot; the system so the ui sees these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Used to be able to do this in expression engine via a sync button and i don't see how to do that here, but perhaps im missing the trick?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2016-03-31T14:50:14.547" Title="Upload Assets Manually" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14421" PostTypeId="2" ParentId="14420" CreationDate="2016-03-31T14:37:15.133" Score="0" Body="&lt;p&gt;Why don't you just upload them through the filemanager?&lt;/p&gt;&#xA;" OwnerUserId="4723" LastActivityDate="2016-03-31T14:37:15.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14422" PostTypeId="2" ParentId="14420" CreationDate="2016-03-31T14:50:14.547" Score="2" Body="&lt;p&gt;Yes, after uploading via FTP, you will need to tell Craft to go and index the new assets: &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Tools&lt;/strong&gt; &gt; &lt;strong&gt;Update Asset Indexes&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-03-31T14:50:14.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14423" PostTypeId="1" AcceptedAnswerId="14433" CreationDate="2016-03-31T14:54:47.920" Score="2" ViewCount="1094" Body="&lt;p&gt;I think Douglas has kind of answered this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6841/craft-for-author-agency-website/&quot; title=&quot;here&quot;&gt;here&lt;/a&gt;, but just to ask as a separate question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given I have made use of Craft's User section to hold data about a company's team members, how do I now make an entry page for each member, which can link through from the list page? ('About us' single containing a loop over Users).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I originally had a channel for the team members, but switched to using Users because they will be authoring blog posts, and I figured the relation would be cleaner.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="3890" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-03-31T17:42:12.480" Title="Best way to create an entry (bio) view for a User" Tags="&lt;users&gt;&lt;entry&gt;&lt;author&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14425" PostTypeId="2" ParentId="14423" CreationDate="2016-03-31T15:39:47.467" Score="2" Body="&lt;p&gt;I would create a new section called &quot;Profiles&quot; or something along those lines. This is where all of your...extended profile information will go. You can then add a &lt;code&gt;users&lt;/code&gt; filed type on those entries that will link &lt;em&gt;back&lt;/em&gt; to the user account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how you are creating users (manually or through some other form) you will want to create a plugin that listens to the &lt;code&gt;users.onSaveUser&lt;/code&gt; event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your plugin that would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onSaveUser', function (Event $event)&#xA;    {&#xA;        // Get the userId       &#xA;        // Check if the user already has a profile&#xA;        // Create a new entry in the 'profiles' section&#xA;        // Set the author id to the userid&#xA;        // Set other params&#xA;        ...&#xA;&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        $entry = new EntryModel()&#xA;        $entry-&amp;gt;section = 'profiles' // or whatever the handle is&#xA;&#xA;        ...&#xA;&#xA;        // Set the page title so its easily found/searched&#xA;        $entry-&amp;gt;getContent()-&amp;gt;title = $user-&amp;gt;firstName.' '.$user-&amp;gt;lastName;&#xA;&#xA;        // userAccount is the field handle to the users field that will link back to the actual user account&#xA;        $entry-&amp;gt;setContentFromPost(['userAccount' =&amp;gt; array($user-&amp;gt;id]);&#xA;&#xA;        ...&#xA;&#xA;        // save the entry&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another thing to pay attention to I've found is to make sure you listen for the &lt;code&gt;suspend&lt;/code&gt;, &lt;code&gt;unsuspend&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt; methods as you'll need to update the corresponding profile entry accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-03-31T15:39:47.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14426" PostTypeId="1" AcceptedAnswerId="14448" CreationDate="2016-03-31T15:45:01.877" Score="2" ViewCount="2526" Body="&lt;p&gt;I'm new to Craft CMS dev and I'm trying to create a template using Twig and I'm getting this error: Craft\EntryModel and its behaviors do not have a method or closure named &quot;Case Studies&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a reference in the view file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.caseStudies %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming there's a config file or somewhere I can add this to the EntryModel but I'm not sure where this is in the default Craft installation. Any suggestions are welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4961" LastActivityDate="2016-04-04T15:49:37.620" Title="Error: Craft\EntryModel and its behaviors do not have a method or closure named &quot;Case Studies&quot;" Tags="&lt;templating&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14427" PostTypeId="1" AcceptedAnswerId="14440" CreationDate="2016-03-31T16:09:32.977" Score="1" ViewCount="75" Body="&lt;p&gt;Currently i have to validate my model before saving because of some custom validation rules setted on the model which won't run when using the EntriesService saveEntry method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This causes a two step validation when errors arise, first you get the custom validation errors and after that if there is still something wrong you get the &quot;base&quot; validation errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a normal behavior?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model-&amp;gt;validate();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that i am saving the model like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$result = craft()-&amp;gt;entries-&amp;gt;saveEntry($model);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Custom rules on model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;{&#xA;    $rules = parent::rules();&#xA;    $rules[] = ['state', 'validateState'];&#xA;    $rules[] = ['vacancyId', 'validateId'];&#xA;    //$rules[] = ['vacancyId', 'numerical', 'unique' =&amp;gt; false];&#xA;    $rules[] = ['office', 'validateOffice'];&#xA;    $rules[] = ['sector', 'validateSector'];&#xA;&#xA;    return $rules;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why are the custom validation rules not evaluated on the saveEntry method?&lt;/p&gt;&#xA;" OwnerUserId="4077" LastActivityDate="2016-03-31T22:00:47.337" Title="Model validation not run when using EntriesService saveEntry method" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;entrymodel&gt;&lt;validation&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14428" PostTypeId="1" AcceptedAnswerId="14441" CreationDate="2016-03-31T16:14:28.720" Score="3" ViewCount="8282" Body="&lt;p&gt;I wrote a PHP script to deploy data to live-cdn and included a &quot;deploy&quot; button on the dashboard. the script returns ?success=true, and i need to show div element with &quot;Congratulations&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i tried this with no success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if app.request.query.get('success') %}&#xA;  &amp;lt;div&amp;gt;&#xA;    Glückwunsch! Deployment läuft.&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4297" LastActivityDate="2019-05-21T02:09:46.120" Title="How can I get parameters in twig?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14429" PostTypeId="1" AcceptedAnswerId="14446" CreationDate="2016-03-31T16:18:55.627" Score="5" ViewCount="635" Body="&lt;p&gt;I'm experiencing a strange effect where an image transform is causing my images to turn very dark when compared to their originals. I have ImageMagick and gd installed. The images are all sRGB. Some have Adobe RGB profiles, some have no profiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image transform makes the jpeg 1200px wide, height auto, quality high. Not sure what could be causing the problem.&lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="2158" LastEditDate="2016-04-01T08:06:42.750" LastActivityDate="2016-04-26T02:06:44.430" Title="Image transform is turning my jpegs dark" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14430" PostTypeId="1" AcceptedAnswerId="14432" CreationDate="2016-03-31T17:07:14.347" Score="4" ViewCount="1148" Body="&lt;p&gt;I want to show a list of entries that excludes two or more specifically by id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('boardOfDirectors').id('not 12') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('boardOfDirectors').id('not 12,18') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&#xA;Anyone know the correct syntax?&lt;/p&gt;&#xA;" OwnerUserId="4962" LastEditorUserId="45" LastEditDate="2016-03-31T17:22:54.760" LastActivityDate="2016-03-31T17:38:37.860" Title="Syntax for using 'not'?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14432" PostTypeId="2" ParentId="14430" CreationDate="2016-03-31T17:24:42.260" Score="7" Body="&lt;p&gt;You need to start with &lt;code&gt;and&lt;/code&gt;, and put &lt;code&gt;not&lt;/code&gt; in front of each ID...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('boardOfDirectors').id('and, not 12, not 18') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2016-03-31T17:38:37.860" LastActivityDate="2016-03-31T17:38:37.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14433" PostTypeId="2" ParentId="14423" CreationDate="2016-03-31T17:35:25.907" Score="4" Body="&lt;p&gt;Not to diminish from Damon's excellent answer — I have certainly used this technique in the past when needed. However, just to provide another option, keep in mind that you don't need to create a separate section/channel for profile information (and thus a plugin to keep them in sync, etc). You can also simply link to a user profile template by creating a route, using &lt;code&gt;username&lt;/code&gt; or &lt;code&gt;id&lt;/code&gt; (or any other unique identifiable user field or field combination) to identify the user, and then pull data from the custom fields you added to 'users'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will first want to create a route in settings to your user profile template. Notice the use of the 'slug' token, which will be available to the template as simply &lt;code&gt;{{ slug }}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;If the URL looks like this:&#xA;about/profiles/&amp;lt;slug&amp;gt;   &amp;lt;-- where '&amp;lt;slug&amp;gt;' is the slug token&#xA;&#xA;Load this template:&#xA;about/user-profile.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your 'about' page template (i.e. the user's index page):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.group('myGroup').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for user in users %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}about/profiles/{{ user.username|lower }}&amp;gt;{{ user.firstName }} {{ user.lastName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in your 'about/user-profile' template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.username(slug).first %}&#xA;{% if user %}&#xA;    &amp;lt;h1&amp;gt;{{ user.firstName }} {{ user.LastName }}&amp;lt;h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ user.biography }}&amp;lt;p&amp;gt;&#xA;    etc...&#xA;{% else %}&#xA;    {% redirect '404' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-03-31T17:42:12.480" LastActivityDate="2016-03-31T17:42:12.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14434" PostTypeId="2" ParentId="14415" CreationDate="2016-03-31T17:48:55.847" Score="2" Body="&lt;p&gt;You could use a &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse field&lt;/a&gt; to calculate and store that value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only downside is, it'll only do that calculation when you save the &lt;strong&gt;parent&lt;/strong&gt; entry. So if you add another descendant, you'd have to go back and re-save the parent entry to re-calculate the value.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; You can go to &lt;code&gt;Settings &amp;gt; Sections&lt;/code&gt; and re-save the section you are working with. This will automatically trigger a re-save of every single entry in that section.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-03-31T17:48:55.847" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14435" PostTypeId="1" AcceptedAnswerId="14443" CreationDate="2016-03-31T18:18:59.420" Score="3" ViewCount="209" Body="&lt;p&gt;I have redirect to a web page upon successful form submission using guest plugin. The redirected page is in announcement tone so I'd like to prevent it from direct access with exception that comes from form submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something Craft can do?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-03-31T20:25:48.020" LastActivityDate="2016-03-31T22:56:35.050" Title="Prevent direct access to a web page except redirect" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14436" PostTypeId="1" AcceptedAnswerId="14437" CreationDate="2016-03-31T19:23:46.087" Score="2" ViewCount="2916" Body="&lt;p&gt;I have two sections, each with a single entry type:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sites&lt;/li&gt;&#xA;&lt;li&gt;Locations&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the Locations entry type I have a Entries field called Site that you can use to relate a Location to a Site entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions is: how do I show which locations were related to a Site entry when using the Element API? I'd like to display it as an array when using a sites/.json endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've tried, but it breaks the endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'v1/sites/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;  return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['id' =&amp;gt; $entryId],&#xA;    'first' =&amp;gt; true,&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;      $locations = $entry-&amp;gt;getChildren()-&amp;gt;type('locations')-&amp;gt;find();&#xA;      foreach ($locations as $location) {&#xA;        $locationsInfo[] = [&#xA;          'name' =&amp;gt; $location-&amp;gt;title&#xA;        ];&#xA;      }&#xA;&#xA;      return [&#xA;        'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        'name' =&amp;gt; $entry-&amp;gt;title,&#xA;        'tagline' =&amp;gt; $entry-&amp;gt;tagline,&#xA;        'about' =&amp;gt; $entry-&amp;gt;about-&amp;gt;getParsedContent(),&#xA;        'locations' =&amp;gt; $locationsInfo,&#xA;        'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;v1/sites/{$entry-&amp;gt;id}.json&quot;)&#xA;      ];&#xA;    },&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4963" LastActivityDate="2017-12-02T13:55:51.603" Title="Calling Related Entries using the Element API" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14437" PostTypeId="2" ParentId="14436" CreationDate="2016-03-31T19:32:31.667" Score="8" Body="&lt;p&gt;You’d do this with a brand new element query using the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#relatedTo&quot; rel=&quot;noreferrer&quot;&gt;relatedTo&lt;/a&gt; param.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// This is the PHP equivalent of typing `craft.entries()` in a template:&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;// Only fetch Location entries that are related to the Site entry:&#xA;$criteria-&amp;gt;section = 'locations';&#xA;$criteria-&amp;gt;relatedTo = ['targetElement' =&amp;gt; $entry];&#xA;&#xA;$locations = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// This is the PHP equivalent of typing `craft.entries()` in a template:&#xA;$query = \craft\elements\Entry::find();&#xA;&#xA;// Only fetch Location entries that are related to the Site entry:&#xA;$query-&amp;gt;section('locations');&#xA;$query-&amp;gt;relatedTo(['targetElement' =&amp;gt; $entry]);&#xA;&#xA;$locations = $query-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="5557" LastEditDate="2017-12-02T13:55:51.603" LastActivityDate="2017-12-02T13:55:51.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14438" PostTypeId="1" AcceptedAnswerId="14439" CreationDate="2016-03-31T20:38:49.563" Score="5" ViewCount="230" Body="&lt;p&gt;I'm trying to pull a set of 3 random entries from a Section. The entries need to have a certain Assets field not empty, and I also have to exclude entries already pulled (these entries are stored in the variable &lt;code&gt;entriesA&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that with my current query, the ID exclusion doesn't work – i.e. I'm getting back entries found in &lt;code&gt;entriesA&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how the query looks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesB = craft.entries({&#xA;    section : 'someSection',&#xA;    assetsField : ':notempty:',&#xA;    limit : 3,&#xA;    order : 'RAND()',&#xA;    id : 'and, not ' ~ entriesA.ids()|join(', not ')&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem appears to be the &lt;code&gt;assetsField : ':notempty:'&lt;/code&gt; statement – when I remove that, I get no duplicates. When it's included, Craft appears to ignore the &lt;code&gt;id&lt;/code&gt; parameter and I get back duplicates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what's up? Is it not possible to query using &lt;code&gt;:notempty:&lt;/code&gt; statements &lt;em&gt;and&lt;/em&gt; &lt;code&gt;id&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-03-31T21:21:27.997" LastActivityDate="2016-03-31T21:23:33.860" Title="Get random entries, excluding an array of entry IDs, where a relational field is not empty" Tags="&lt;templating&gt;&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14439" PostTypeId="2" ParentId="14438" CreationDate="2016-03-31T21:23:33.860" Score="4" Body="&lt;p&gt;That seems to be a bug / limitation of the &lt;code&gt;:notempty:&lt;/code&gt; statement, it's probably adding its own ID criteria in the background and the merge doesn't work as expected. I'd suggest you file a bug report.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime you could just add the &quot;not empty asset field&quot; criteria making use of the &lt;code&gt;relatedTo&lt;/code&gt; parameter as a workaround. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/129/how-can-i-get-only-those-entries-with-non-empty-assets-field&quot;&gt;How can I get only those entries with non-empty assets field&lt;/a&gt; for example code.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-03-31T21:23:33.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14440" PostTypeId="2" ParentId="14427" CreationDate="2016-03-31T22:00:47.337" Score="1" Body="&lt;p&gt;It's normal behavior... &lt;code&gt;EntriesService-&amp;gt;saveEntry()&lt;/code&gt; never calls &lt;code&gt;validate()&lt;/code&gt; on the model directly, but does call &lt;code&gt;validate()&lt;/code&gt; on the &lt;code&gt;EntryRecord&lt;/code&gt; and if there are errors, add it back to the model and return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to run custom validation rules before calling &lt;code&gt;saveEntry&lt;/code&gt; you'll need to do that yourself and respond accordingly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-31T22:00:47.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14441" PostTypeId="2" ParentId="14428" CreationDate="2016-03-31T22:09:47.680" Score="2" Body="&lt;p&gt;Use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getQueryString('success') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getQueryString&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.request#getQueryString&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-03-31T22:09:47.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14442" PostTypeId="1" CreationDate="2016-03-31T22:30:23.170" Score="1" ViewCount="91" Body="&lt;p&gt;I have a website with three locales (de, fr, it). On a Matrix Field i have Assets where are only uploaded in German language. Now i'm trying to show those assets also in French and Italian language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas to solve this? I have tried to put a &lt;code&gt;.locale('de')&lt;/code&gt; to get the german fields, but if i change the language, the assets are not displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in craft.entries.section('sitemap','staticContent').status('live').slug(lastSegment).limit(1) %}&#xA;&#xA;    {% for block in entry.multiContent %}&#xA;&#xA;        {% if block.type == &quot;documents&quot; and block.downloadbarAlsDigitalesDokument == &quot;1&quot; %}&#xA;&#xA;            &amp;lt;div class=&quot;section-content-downloads&quot;&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;                    {% set items = block.datei %}&#xA;&#xA;                    &amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;&#xA;                        {% for item in items %}&#xA;&#xA;                            &amp;lt;li&amp;gt;&#xA;                                &amp;lt;a href=&quot;{{ item.url() }}&quot; title=&quot;Download: {{ item.title }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-file-{{ item.extension }}-o&quot;&amp;gt;&amp;lt;/i&amp;gt; {{ item.title }}&amp;lt;/a&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;&#xA;                        {% endfor %}&#xA;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4964" LastActivityDate="2016-05-31T11:54:38.110" Title="Show Matrix Assets from German language in other locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14443" PostTypeId="2" ParentId="14435" CreationDate="2016-03-31T22:56:35.050" Score="3" Body="&lt;p&gt;Add a &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse field&lt;/a&gt; to the entry type you're posting to and make it generate a random string on entry save.&#xA;Then make the Guest Entries plugin redirect to a URL with that Preparse field's value in the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success?id={id}&amp;amp;key={preparseField}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should now be able to get that entry model in your template and test against that Preparse field's value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery() %}&#xA;{% set entry = craft.entries.id(query.id).preparseField(query.preparseField).first() %}&#xA;&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-03-31T22:56:35.050" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14445" PostTypeId="2" ParentId="8324" CreationDate="2016-04-01T04:29:39.343" Score="2" Body="&lt;p&gt;This might be similar to Brad Bell's recommendation, but if you are using Yii's built-in validation rules, you should just override the &lt;code&gt;rules()&lt;/code&gt; method in your model or record, specify the rule there, and then customise the error message text for it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns this record's validation rules.&#xA; *&#xA; * @return array&#xA; */&#xA;public function rules()&#xA;{&#xA;    return array_merge(parent::rules(), [&#xA;        ['firstName2', 'compare', 'operator' =&amp;gt; '!=', 'compareAttribute' =&amp;gt; 'firstName1', 'message' =&amp;gt; '{attribute} cannot be the same as {compareAttribute}']&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/wiki/56/&quot; rel=&quot;nofollow&quot;&gt;Yii's documentation on rules&lt;/a&gt; shows the different parameters that can be set for each built-in rule/validator type.&lt;/p&gt;&#xA;" OwnerUserId="4890" LastActivityDate="2016-04-01T04:29:39.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14446" PostTypeId="2" ParentId="14429" CreationDate="2016-04-01T08:03:52.047" Score="7" Body="&lt;p&gt;Setting 'preserveImageColorProfiles' =&gt; true, in craft/config/general.php solved the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#preserveImageColorProfiles&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#preserveImageColorProfiles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you need to be running at least &lt;a href=&quot;https://craftcms.com/changelog#build2778&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2778&lt;/a&gt; for this config setting to work.&lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="57" LastEditDate="2016-04-26T02:06:44.430" LastActivityDate="2016-04-26T02:06:44.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14448" PostTypeId="2" ParentId="14426" CreationDate="2016-04-01T09:04:35.950" Score="2" Body="&lt;p&gt;Welcome Ross! If you have 'Case Studies' as a &lt;strong&gt;Section&lt;/strong&gt; and not a field, try changing your syntax to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('caseStudies').find() %}&#xA;&#xA;    {{ entry.title }}&#xA;    ...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's an updated example, showing an additional custom field...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Find all Entries in the Case Study section #}&#xA;{% for entry in craft.entries.section('caseStudies').find() %}&#xA;&#xA;    {# Display the entry's Title #}&#xA;    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {# Display the contents of the Intro Summary (plain text field) #}&#xA;    &amp;lt;p&amp;gt;{{ entry.introSummary }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-04-04T15:49:37.620" LastActivityDate="2016-04-04T15:49:37.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14449" PostTypeId="2" ParentId="14429" CreationDate="2016-04-01T09:04:37.587" Score="2" Body="&lt;p&gt;The file probably has a color profile, which gets removed by Craft by default. You can tell Craft to preserve the color profile by setting the &lt;code&gt;preserveImageColorProfiles&lt;/code&gt; in your config file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'preserveImageColorProfiles' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-04-01T09:04:37.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14450" PostTypeId="1" CreationDate="2016-04-01T09:19:26.560" Score="0" ViewCount="58" Body="&lt;p&gt;Does anyone know how I can show a specific entry to a user (frontend)? My user field is called &quot;gebruiker&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get current member e.g URL /members/1/ #}&#xA;{% set currentMember = craft.users.id(craft.request.segment(2)).first() %}&#xA;&#xA;{# Get current members test entries #}&#xA;{% set currentMemberTest = craft.entries.section('test').relatedTo({&#xA;    targetElement: currentMember,&#xA;    field: 'gebruiker',&#xA;}) %}&#xA;&#xA;{% for entry in craft.entries.section('test').find() %}&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-6&quot;&amp;gt;&#xA;                &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4956" LastEditorUserId="57" LastEditDate="2016-04-01T15:41:23.543" LastActivityDate="2016-04-01T15:41:23.543" Title="User specific entries (relations)" Tags="&lt;users&gt;&lt;relations&gt;&lt;entry&gt;&lt;frontend&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14451" PostTypeId="2" ParentId="14450" CreationDate="2016-04-01T09:35:13.543" Score="2" Body="&lt;p&gt;Instead of looping through &lt;code&gt;currentMemberTest&lt;/code&gt;, you're currently setting up a fresh criteria model in your &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use your nicely set &lt;code&gt;currentMemberTest&lt;/code&gt; criteria!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in currentMemberTest %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-01T09:35:13.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14452" PostTypeId="1" AcceptedAnswerId="14483" CreationDate="2016-04-01T09:52:00.567" Score="3" ViewCount="234" Body="&lt;p&gt;After a standard search with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search( query ) %}&#xA;{% for result in results %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;{{ result.link }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to find out which field the query was found in?&lt;/p&gt;&#xA;" OwnerUserId="467" LastEditorUserId="467" LastEditDate="2016-04-01T10:03:36.833" LastActivityDate="2016-04-03T22:05:25.083" Title="Get field that contains search query" Tags="&lt;templating&gt;&lt;field&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14453" PostTypeId="1" AcceptedAnswerId="14455" CreationDate="2016-04-01T10:24:04.153" Score="4" ViewCount="2686" Body="&lt;p&gt;There seems to be a default limit to &lt;code&gt;for&lt;/code&gt; loops in craft of &lt;code&gt;100&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel with quite a few entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I disable this without writing nasty things like &lt;code&gt;.limit(100000000)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2016-04-01T15:54:10.283" LastActivityDate="2021-05-19T12:17:18.103" Title="Default Craft entry limit" Tags="&lt;entries&gt;&lt;limit&gt;&lt;default&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14454" PostTypeId="1" AcceptedAnswerId="14457" CreationDate="2016-04-01T10:42:36.497" Score="1" ViewCount="217" Body="&lt;p&gt;I've got a site with multiple locales and I want to merge together content from across these locales, eg News.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two sections share the same fields so should theoretically be able to be sorted by a shared criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the post at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12522/how-do-i-sort-a-collection-of-entries-from-multiple-sections-by-date&quot;&gt;How do I sort a collection of entries from multiple sections by date?&lt;/a&gt; I can merge these both into a single array but when I try to post the &lt;code&gt;ids&lt;/code&gt; from these into a new query (to sort the results) only one set of results are returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}&#xA;{% set mergeIds = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}&#xA;{% set ids = ids|merge(mergeIds) %}&#xA;&#xA;{% set news = craft.entries.id(ids).localeEnabled(false).status(null).order(['stickyNews desc','postDate desc']).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I dump the results of &lt;code&gt;ids&lt;/code&gt; I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640 | 295486&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;295486 being the entry from &lt;code&gt;mergeIds&lt;/code&gt; being returned.&#xA;However, if I dump the results of &lt;code&gt;news&lt;/code&gt; I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;295484 | 3747 | 1787 | 1783 | 1781 | 1778 | 638 | 636 | 640&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Leaving out the result from &lt;code&gt;mergeIds&lt;/code&gt;.&#xA;Any thoughts on why the entries from &lt;code&gt;mergeIds&lt;/code&gt; are not being included in the resulting &lt;code&gt;news&lt;/code&gt; object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ta&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-01T11:15:19.483" Title="If merging two sections from different locales how do I then sort them by a shared criteria?" Tags="&lt;localization&gt;&lt;sorting&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14455" PostTypeId="2" ParentId="14453" CreationDate="2016-04-01T10:43:52.613" Score="13" Body="&lt;p&gt;Set the limit to null &lt;code&gt;limit(null)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-01T10:43:52.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14456" PostTypeId="2" ParentId="14442" CreationDate="2016-04-01T10:44:03.693" Score="1" Body="&lt;p&gt;@carlcs helped me in Craft Slack. Many thx to him. The solution at the end was to pull out the asset field from the main matrix field and to put them in a separate without localisation enabled.&lt;/p&gt;&#xA;" OwnerUserId="4964" LastActivityDate="2016-04-01T10:44:03.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14457" PostTypeId="2" ParentId="14454" CreationDate="2016-04-01T11:15:19.483" Score="3" Body="&lt;p&gt;With that last &lt;code&gt;{% set news = craft.entries.id(ids) %}&lt;/code&gt; criteria model you're querying in one locale only&#xA;and there's no way to change that, Craft doesn't have a feature to set up a criteria model to query in multiple locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd have to merge the entry models themselves and use something like the &lt;a href=&quot;https://topshelfcraft.com/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;Super Sort plugin&lt;/a&gt; to bring them in order.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesA = craft.entries.section('news' ~ Section).relatedTo(active).ids() %}&#xA;{% set entriesB = craft.entries.section('newsAlumni').status(null).locale('prior_alum').search('shareNewsAlumni:1').localeEnabled(false).ids() %}&#xA;{% set entries = entriesA|merge(entriesB) %}&#xA;&#xA;{% set entries = entries|supersort('sortAs', '{postDate}')|reverse %}&#xA;{% set entries = entries|supersort('sortAs', '{stickyNews}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-01T11:15:19.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14458" PostTypeId="1" AcceptedAnswerId="14459" CreationDate="2016-04-01T11:53:53.357" Score="2" ViewCount="119" Body="&lt;p&gt;What I'm trying to do is add two checkbox in the entry edition page, just under the dates or special notes, somewhere here :&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yePxM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yePxM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if the checkbox is checked, I check it with an event and perform an action. But I dont know how to display my two checkboxes, I know it's all about the hook but I can't find the one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advices ?&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2016-04-01T12:11:32.057" Title="Plugin add options to entry edition" Tags="&lt;plugin-development&gt;&lt;entry&gt;&lt;events&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14459" PostTypeId="2" ParentId="14458" CreationDate="2016-04-01T12:11:32.057" Score="2" Body="&lt;p&gt;Well I found the way lurking into source code. You can see a &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Give plugins a chance to add other panes here #}&#xA;{% hook &quot;cp.entries.edit.right-pane&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even though this hook is not listed in official documentation, you can access using the &lt;code&gt;craft()-&amp;gt;on()&lt;/code&gt; syntax, so I did this inside my plugin class :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;hook('cp.entries.edit.right-pane', function(&amp;amp;$context) {&#xA;&#xA;        // do stuff here&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2016-04-01T12:11:32.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14460" PostTypeId="1" CreationDate="2016-04-01T12:14:52.423" Score="1" ViewCount="196" Body="&lt;p&gt;I have a structure section, which allows categories to be assigned to the final descendant. I'm trying to list the entries by category, whilst including the parent structure entries (so the hierarchy is maintained).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Structure entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 1 (category green)&lt;/li&gt;&#xA;&lt;li&gt;Item 2 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 3 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 4 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 5 (category red)&lt;/li&gt;&#xA;&lt;li&gt;Item 6 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 7 (category red)&lt;/li&gt;&#xA;&lt;li&gt;Item 8 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 9 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 10 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 11 (category red)&lt;/li&gt;&#xA;&lt;li&gt;Item 12 (category green)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;––––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m trying to create a nested list of this structure, viewed by category, which excludes parents with no descendants within the looped category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Desired category view&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Green&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 1 (category green)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 12 (category green)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Blue&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 2 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 4 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 6 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 8 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 9 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 10 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Red&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 3 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 5 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 7 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 11 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;––––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My attempt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This comes close, however parent structure elements appear, event if they have no descendants in the corresponding category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productCategories = craft.categories.group('products') %}&#xA;{% set structure = craft.entries.section('products').level(1) %}&#xA;&#xA;{% macro recursiveChildren(page, category) %}&#xA;    {% if page.hasDescendants %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for subpage in page.children %}&#xA;            {% if subpage.level == '2' %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    {{ subpage.link }}&#xA;                    {{ _self.recursiveChildren(subpage, category) }}                    &#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;            {% if subpage.level == '3' and category == subpage.productCategory|first %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    {{ subpage.link }}&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for category in productCategories %}&#xA;        &amp;lt;li&amp;gt;{{category.title}}&#xA;        {% set thisCat = category.title %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in structure %}&#xA;                    {% if entry.hasDescendants %}&#xA;                        &amp;lt;li&amp;gt;{{entry.title}}&#xA;                            {{ _self.recursiveChildren(entry, thisCat) }}&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endif%}&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;returns:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Green&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 1 (category green)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Type 2&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Type 3&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 12 (category green)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Blue&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 2 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 4 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 6 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 8 (category blue)&lt;/li&gt;&#xA;&lt;li&gt;Item 9 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 10 (category blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category Red&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Womens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 3 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 5 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mens&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 7 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type 4&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item 11 (category red)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;––––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would welcome and tips, or suggestions to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I omit the parents with no children?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I optimise the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT ––––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added a couple of additional for loops to check if there are descendants within matching categories to omit parents with no children. It works but my code feels very clunky and heavy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In time I plan to rewrite/refactor the following to improve the performance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursiveCats(page, category) %}&#xA;    {% if page.hasDescendants %}&#xA;    {% set entryGrandchildren = page.getDescendants(2) %}&#xA;        {% for entry in entryGrandchildren if entry.productCategory|first == category %}&#xA;            &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;&#xA;                {% for subpage in page.children %}&#xA;                    {% if subpage.level == '2' %}&#xA;                        {% if subpage.hasDescendants %}&#xA;                        {% set entryChildren = subpage.getDescendants(1) %}&#xA;&#xA;                            {% for entry in entryChildren if entry.productCategory|first == category %}&#xA;                                {% if loop.first %}&#xA;                                    &amp;lt;li&amp;gt;&#xA;                                        {{ subpage.link }}{#{{ subpage.productCategory|first }}{{category}}#}&#xA;                                        {{ _self.recursiveCats(subpage, category) }}                    &#xA;                                    &amp;lt;/li&amp;gt;&#xA;                                {% endif %}&#xA;                            {% endfor %}&#xA;&#xA;                        {% endif%}&#xA;                    {% endif %}&#xA;                    {% if subpage.level == '3' and category == subpage.productCategory|first %}                 &#xA;                            &amp;lt;li&amp;gt;&#xA;                                {{ subpage.link }}&#xA;                            &amp;lt;/li&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="334" LastEditorUserId="334" LastEditDate="2016-04-11T16:00:54.747" LastActivityDate="2016-04-11T16:00:54.747" Title="How to display a nested list from a structure section based on categories assigned to last descendant?" Tags="&lt;categories&gt;&lt;relations&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14461" PostTypeId="2" ParentId="11175" CreationDate="2016-04-01T13:32:59.460" Score="2" Body="&lt;p&gt;I would &lt;strong&gt;add custom fields to your category group&lt;/strong&gt;, for META Descriptions. This would allow you to display meta data when on a 'category home page'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on a single entry page, the entry-type custom fields for meta data would be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this example/answer: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13682/how-do-i-define-an-entrys-meta-description/13683#13683&quot;&gt;How do I define an entry&amp;#39;s META description?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-01T13:32:59.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14462" PostTypeId="2" ParentId="14373" CreationDate="2016-04-01T15:10:42.457" Score="2" Body="&lt;p&gt;From my research and testing, it looks like this plugin doesn't offer the option to set a passphrase for the PEM file. I had to create a new PEM file that doesn't require a passphrase in order to send a successful alert.&lt;/p&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2016-04-01T15:10:42.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14463" PostTypeId="1" CreationDate="2016-04-01T15:28:19.223" Score="1" ViewCount="233" Body="&lt;p&gt;Is it possible to update an entry’s Users field from the front-end? If so, how would you go about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The situation is this: training events are created and then posted for members to bid on for a limited number of spots. Logged in members review the available events and add their name (would use their ID) to each event of interest. Admins then manually chose a select few from all submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can do this by adding their IDs to a text field in the event section, and then using Split to create an array, but the Users field approach is much more elegant and offers more flexibility.&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="9" LastEditDate="2016-04-04T23:00:14.700" LastActivityDate="2016-04-04T23:00:14.700" Title="How to add a user to a Users field from front-end form?" Tags="&lt;users&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14465" PostTypeId="1" AcceptedAnswerId="14467" CreationDate="2016-04-01T21:17:35.570" Score="3" ViewCount="1302" Body="&lt;p&gt;I need to add the a custom header to the ElementAPI endpoints I setup but I want to avoid editing the source of the plugin. What is the best way to go about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ElementAPI plugin returns some default headers by using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;JsonHelper::sendJsonHeaders()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quickly achieve what I needed I added the following to the &lt;code&gt;ElementApiControllor.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;HeaderHelper::setHeader(['Surrogate-Control: max-age=300'])&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works for now but I'd love to learn how to extend existing plugins that don't have any documented hooks with my own if it is possible.&lt;/p&gt;&#xA;" OwnerUserId="213" LastActivityDate="2017-12-31T17:07:39.497" Title="How can I add custom headers to an ElementAPI response?" Tags="&lt;plugin-development&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14466" PostTypeId="2" ParentId="14408" CreationDate="2016-04-01T21:40:37.623" Score="1" Body="&lt;p&gt;These two items are unrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, there's no need to worry about the deprecation errors.  We actively maintain our plugins and will have them resolved before they should have any effect on general use of our plugins. We've made a feature request to Craft to consider to &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/13280283-deprecations-errors-shouldn-t-alarm-all-users-who&quot; rel=&quot;nofollow&quot;&gt;reduce the prominence of the deprecation message&lt;/a&gt;, as it generally just causes unneeded alarm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the releases message is probably due to us currently having an SNI SSL certificate installed and some older server configurations choke because they don't know how to deal with them. The error probably indicates that you may be running fairly old software on your server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're curious, I was told by Craft support:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Technically there are 3 things a server needs for it to be able to&#xA;  recognize SNI SSL certs.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) Using a version of cURL that supports it, at least 7.18.1 (8 years&#xA;  old: &lt;a href=&quot;https://curl.haxx.se/changes.html&quot; rel=&quot;nofollow&quot;&gt;https://curl.haxx.se/changes.html&lt;/a&gt;)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) Using a version of cURL compiled against a library that supports&#xA;  SNI, e.g. OpenSSL 0.9.8j (depending on the compilation options some&#xA;  older versions. 7 years old:&#xA;  &lt;a href=&quot;https://www.openssl.org/news/changelog.html&quot; rel=&quot;nofollow&quot;&gt;https://www.openssl.org/news/changelog.html&lt;/a&gt;)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3) Using TLS 1.0 at least (not SSLv3)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-04-01T23:24:12.703" LastActivityDate="2016-04-01T23:24:12.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14467" PostTypeId="2" ParentId="14465" CreationDate="2016-04-01T23:49:30.857" Score="4" Body="&lt;p&gt;You can do this by assigning your endpoint(s) to a function:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'my-endpoint' =&amp;gt; function() {&#xA;            HeaderHelper::setHeader(['Surrogate-Control: max-age=300']);&#xA;&#xA;            return [&#xA;                // ...&#xA;            ];&#xA;        }&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively as of v1.2, you can do it from a separate plugin using the &lt;code&gt;onBeforeSendData&lt;/code&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('elementApi.onBeforeSendData', function(Event $event) {&#xA;        HeaderHelper::setHeader(['Surrogate-Control: max-age=300']);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-04-02T13:53:41.510" LastActivityDate="2016-04-02T13:53:41.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14468" PostTypeId="2" ParentId="14453" CreationDate="2016-04-02T00:29:26.640" Score="1" Body="&lt;p&gt;There very definitely is a default limit of 100 and using .limit(null) will definitely override it. I know this because I recently had the same issue myself!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2016-04-02T00:29:26.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14469" PostTypeId="2" ParentId="7124" CreationDate="2016-04-02T13:26:25.873" Score="2" Body="&lt;p&gt;It all starts in Your &lt;code&gt;ElementType&lt;/code&gt; where you need to return &lt;code&gt;true&lt;/code&gt; on the &lt;code&gt;isLocalized&lt;/code&gt; function (Line 62 in &lt;code&gt;BaseElementType.php&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting this to true will tell Craft that data is stored per-locale, and it's local choices are based on your Element Model's &lt;code&gt;getLocales&lt;/code&gt; function. You can get a basic example from Line 231 of &lt;code&gt;BaseElementModel.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's Entry Element actually allows you to choose which locale's are used on a per section basis. You can see an Entry gather its locales on Line 54 in &lt;code&gt;EntryModel.php&lt;/code&gt; and Line 57 in &lt;code&gt;SectionModel.php&lt;/code&gt;. A section stores its locale options in a related table via &lt;code&gt;SectionLocaleRecord&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest should be handled by Craft so long as you set &lt;code&gt;localeEnabled&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;locale&lt;/code&gt; to a locale ID in your model before passing it along to &lt;code&gt;saveElement&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the work is templating, which you can reference how P&amp;amp;T do it in &lt;code&gt;templates/entries/_edit.html&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-04-02T13:26:25.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14470" PostTypeId="2" ParentId="14463" CreationDate="2016-04-02T14:20:27.747" Score="2" Body="&lt;p&gt;You would need to do this with a plugin that provides a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt;, which looks at the post data and modifies the entries’ Users fields accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller action would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$entryIds = craft()-&amp;gt;request-&amp;gt;getPost('entries');&#xA;&#xA;if ($entryIds &amp;amp;&amp;amp; is_array($entryIds))&#xA;{&#xA;    // Get the current user's ID&#xA;    $currentUserId = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;&#xA;    // Fetch the entries&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;id = $entryIds;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    foreach ($entries as $entry)&#xA;    {&#xA;        // Update the Users field value with the current user's ID&#xA;        $userIds = $entry-&amp;gt;myUsersField-&amp;gt;ids();&#xA;        $userIds[] = $currentUserId;&#xA;&#xA;        $entry-&amp;gt;setContentFromPost(array(&#xA;            'myUsersField' =&amp;gt; $userIds;&#xA;        ));&#xA;&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-04-04T22:59:35.587" LastActivityDate="2016-04-04T22:59:35.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14471" PostTypeId="1" AcceptedAnswerId="14477" CreationDate="2016-04-02T16:48:20.477" Score="1" ViewCount="487" Body="&lt;p&gt;I am importing data into Craft. I happen to know that the id for my desired category is 22. The category is not being saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry = new EntryModel(); &#xA;    $entry-&amp;gt;sectionId   = 3; // 3 is Episode Section&#xA;    $entry-&amp;gt;enabled     = true;&#xA;    $entry-&amp;gt;authorId    = 1;&#xA;    $entry-&amp;gt;slug = $slug;&#xA;    $entry-&amp;gt;postDate = $postDate;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;title = $title;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;body = $body;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;summary = $summary;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;metaDescription = $summary;&#xA;    $entry-&amp;gt;showName[] = 22;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where showName is the category handle of my category field.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-02T21:34:49.023" Title="Assign category through a plugin" Tags="&lt;categories&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14472" PostTypeId="1" AcceptedAnswerId="14473" CreationDate="2016-04-02T16:49:26.600" Score="2" ViewCount="312" Body="&lt;p&gt;How does one use position selects to float an element in Craft CMS template? Say I want to allow an author to center or float a quote block to the right or left using a position select. How would I do this in the template?&lt;/p&gt;&#xA;" OwnerUserId="4969" LastActivityDate="2016-04-02T17:03:58.747" Title="How to use Position Select in Matrix blocks?" Tags="&lt;position&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14473" PostTypeId="2" ParentId="14472" CreationDate="2016-04-02T17:03:58.747" Score="3" Body="&lt;p&gt;You would typically just pop out a CSS class based on their selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote class=&quot;align--{{ block.myAlignment }}&quot;&amp;gt;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just pop the value out into your markup, and then write the CSS to produce whatever effect you need&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-02T17:03:58.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14474" PostTypeId="1" AcceptedAnswerId="14577" CreationDate="2016-04-02T18:39:17.947" Score="0" ViewCount="490" Body="&lt;p&gt;I've got a default value defined in my model for a field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'limit' =&amp;gt; array(AttributeType::Number, 'default' =&amp;gt; 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I create a new record, if the limit field is empty, &lt;code&gt;NULL&lt;/code&gt; gets stored in the DB instead of 0. I thought &lt;code&gt;$model-&gt;setAttributes()&lt;/code&gt; would set the default values if the values coming in were &lt;code&gt;NULL&lt;/code&gt;. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2016-04-08T03:12:55.927" Title="Plugin Use Default Value When Empty" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14476" PostTypeId="1" AcceptedAnswerId="14484" CreationDate="2016-04-02T20:17:09.513" Score="1" ViewCount="465" Body="&lt;p&gt;I'm getting an error when I start the installation process, i.e., &lt;code&gt;&amp;lt;domain&amp;gt;/admin&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the error I'm getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES LIKE 'craft_%'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since I've enabled dev mode, you can see the full stack trace here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://onehanders.info/admin&quot; rel=&quot;nofollow&quot;&gt;http://onehanders.info/admin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done the following prior to starting the install:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;set up db and identified server, db name, user, &amp;amp; password that are needed&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;put proper settings in db.php in the config folder&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;put the craft folder one level above web root&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;updated all 3 of the relevant folder permissions (including enclosed)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;enabled dev mode in &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I even added a statement to &lt;code&gt;craft/etc/behaviors/AppBehaviors.php&lt;/code&gt;. After line 852, at which point the db connection appears to be valid, I echo'd a &quot;db connection is valid&quot; line and got there. That line is now commented out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to hear your thoughts on what I might try to fix this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contents of &lt;code&gt;config/db.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA;* Database Configuration&#xA;*&#xA;* All of your system's database configuration settings go in here.&#xA;* You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA;*/&#xA;&#xA;return array(&#xA;&#xA;// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;'server' =&amp;gt; 'internal-db.s&amp;lt;my acct #&amp;gt;.gridserver.com',&#xA;&#xA;// The name of the database to select.&#xA;'d&amp;lt;my acct #&amp;gt;_onehanders_db' =&amp;gt; '',&#xA;&#xA;// The database username to connect with.&#xA;'user' =&amp;gt; 'db&amp;lt;my acct #&amp;gt;',&#xA;&#xA;// The database password to connect with.&#xA;'password' =&amp;gt; '&amp;lt;my password&amp;gt;',&#xA;&#xA;// The prefix to use when naming tables. This can be no more than 5 characters.&#xA;'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4970" LastEditorUserId="57" LastEditDate="2016-04-03T22:24:54.723" LastActivityDate="2016-04-03T22:24:54.723" Title="Problem installing on MediaTemple" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14477" PostTypeId="2" ParentId="14471" CreationDate="2016-04-02T21:34:49.023" Score="2" Body="&lt;p&gt;Okay, I think I figured it out. 1st, I added the getContent()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry-&amp;gt;showName[] = 22;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry-&amp;gt;getContent()-&amp;gt;showName = 22;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think the problem is that the category we had set up only allowed for a single value and I was responding with an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone please correct me if am wrong.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-02T21:34:49.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14479" PostTypeId="1" AcceptedAnswerId="14480" CreationDate="2016-04-03T14:50:32.327" Score="1" ViewCount="100" Body="&lt;p&gt;I'm creating a monthly archive page (for a specified year) for a section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard code to output the months and entries as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1) %}&#xA;&#xA;{% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&#xA;    &amp;lt;div class=&quot;month&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ month }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- month --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's all working perfectly, what I can't figure out is how to reverse the order of the output, so I get January -&gt; December, instead of December -&gt; January.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure this is simpler than my head is making out, but that will teach me to be coding on a Sunday.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="57" LastEditDate="2016-04-03T21:27:43.667" LastActivityDate="2016-04-03T21:27:43.667" Title="Changing the order of an 'archive' page" Tags="&lt;entries&gt;&lt;sorting&gt;&lt;ordering&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14480" PostTypeId="2" ParentId="14479" CreationDate="2016-04-03T17:03:45.843" Score="1" Body="&lt;p&gt;If you change your query and sort by ascending postdate, it will start with the oldest and end with the newest:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1).order('postDate asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="981" LastActivityDate="2016-04-03T17:03:45.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14481" PostTypeId="1" AcceptedAnswerId="14534" CreationDate="2016-04-03T18:01:19.010" Score="0" ViewCount="144" Body="&lt;p&gt;I am trying to capture the data that is selected when a user selects categories within a categories field type (handle: groups) within the Control Panel profile tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking thru the Fields, Categories and Content services documentation in the craft docs section and I am still unsure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed when I did a var_dump of $user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = UserModel::populateModel(UserRecord::model()-&amp;gt;findById($id));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It displays the field 'groups' within the _attributeConfigs, but does not show up in private '_attributes' (Craft\BaseModel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other fields do show up, for example, occupation shows up within both the _attributeConfigs (its a string) and shows up in private '_attributes' (Craft\BaseModel) with a value of 'Teacher'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure how to get the data the user selected when selecting the categories while updating their profile within the control panel.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2016-04-06T17:29:33.490" Title="Trying to capture categories field type data in user profile save/update" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;field&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14483" PostTypeId="2" ParentId="14452" CreationDate="2016-04-03T22:05:25.083" Score="4" Body="&lt;p&gt;This currently isn't possible natively in Craft, but if you think it should be,  you can create a &lt;a href=&quot;http://feedback.craftcms.com/&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-03T22:05:25.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14484" PostTypeId="2" ParentId="14476" CreationDate="2016-04-03T22:24:03.690" Score="0" Body="&lt;p&gt;This:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// The name of the database to select.&#xA;'d&amp;lt;my acct #&amp;gt;_onehanders_db' =&amp;gt; '',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Needs to be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// The name of the database to select.&#xA;'database' =&amp;gt; 'd&amp;lt;my acct #&amp;gt;_onehanders_db',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-03T22:24:03.690" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14485" PostTypeId="1" AcceptedAnswerId="14487" CreationDate="2016-04-03T22:59:27.987" Score="1" ViewCount="88" Body="&lt;p&gt;I'm trying to build a form where users can search for events based on a date range, location and price range. I've got the form working, but having a bit of trouble when some fields/ selects are left blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The desired functionality should be that none of the fields should be required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: If I select a location, I would like to see all events at that location even if the dates and price ranges are left blank. Or if all fields are left blank, I should see all events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a stripped down version of my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`&amp;lt;form action=&quot;{{ url('results') }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;dateFrom&quot;&amp;gt; //this is a datepicker&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;dateUntil&quot;&amp;gt; //this is a datepicker&#xA;&#xA;&amp;lt;select name=&quot;country&quot;&amp;gt;&#xA;  &amp;lt;option&amp;gt;&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;france&quot;&amp;gt;france&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;belgium&quot;&amp;gt;belgium&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;priceMin&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;priceMax&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's what i've got on my results page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`{% set country = craft.request.getParam('country') %}&#xA;{% set dateFrom = craft.request.getParam('dateFrom')|date(&quot;Y-m-d&quot;) %}&#xA;{% set dateUntil = craft.request.getParam('dateUntil')|date_modify(&quot;+1 day&quot;)|date(&quot;Y-m-d&quot;) %}&#xA;{% set priceMin = craft.request.getParam('priceMin')  %}&#xA;{% set priceMax = craft.request.getParam('priceMax') %}&#xA;&#xA;{% set results = craft.entries({&#xA;  section: 'events',&#xA;  order: 'score',&#xA;  start: '&amp;gt;=' ~ dateFrom,&#xA;  end: '&amp;lt;=' ~ dateUntil,&#xA;  country: country,&#xA;  price: [&#xA;    'and',&#xA;    '&amp;gt;=' ~ priceMin,&#xA;    '&amp;lt;=' ~ priceMax,&#xA;    ]&#xA;}) %}&#xA;&#xA;&#xA;{% if results|length %}&#xA;&amp;lt;p&amp;gt;{{ results|length }} results:&amp;lt;/p&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for entry in results %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }} - {{ entry. price }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;&amp;lt;p&amp;gt;Your search didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have any suggestions?&#xA;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4974" LastActivityDate="2016-06-03T06:50:33.267" Title="How can I build a combined search without making all fields required?" Tags="&lt;form&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14486" PostTypeId="2" ParentId="14371" CreationDate="2016-04-04T04:10:56.180" Score="1" Body="&lt;p&gt;Custom Asset sources are not possible in Craft 2 without some core hacking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However totally doable in &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow&quot;&gt;Craft 3&lt;/a&gt; (even in the dev preview).  There is an example of how to pull it off &lt;a href=&quot;https://github.com/pixelandtonic/flysystem-google-cloud&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-04T04:10:56.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14487" PostTypeId="2" ParentId="14485" CreationDate="2016-04-04T06:11:59.777" Score="1" Body="&lt;p&gt;When you submit the form you have above, it's already going to have those parameters in the URL even if they have no form values selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/?dateFrom=&amp;amp;dateUntil=&amp;amp;country=&amp;amp;priceMin=&amp;amp;priceMax=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you may have the need to directly link to &lt;code&gt;http://example.com/?country=France&lt;/code&gt;, or empty parameters may cause errors in your template. If that's the case you probably need to define default values for missing and empty parameters. The easiest way to do this is with &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/default.html&quot; rel=&quot;nofollow&quot;&gt;the Twig default filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set country = craft.request.getParam('country') | default(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;null&lt;/code&gt; value should work as a default for some parameters. If there are other parameters you can't easily create a default for or you only want to use parameters if they're defined, you could create an array of your default &lt;code&gt;options&lt;/code&gt;, and then use the Twig merge filter to add more options based on conditions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;  section: 'events',&#xA;  order: 'score'&#xA;} %}&#xA;&#xA;{% if dateFrom %}&#xA;  {% set options = options | merge({ start: '&amp;gt;=' ~ dateFrom }) %}&#xA;{% endif %}&#xA;&#xA;{% set results = craft.entries(options) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Optionally, you can use the ternary operator shorthand syntax instead of &lt;code&gt;{% if dateFrom %}&lt;/code&gt;. Whichever is easier.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`{% set options = dateFrom ? options | merge({ start: '&amp;gt;=' ~ dateFrom }) : options %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2016-04-04T06:11:59.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14488" PostTypeId="1" AcceptedAnswerId="14489" CreationDate="2016-04-04T10:30:53.547" Score="2" ViewCount="293" Body="&lt;p&gt;I'm grabbing a list of categories and displaying their entry count.&#xA;How can I only display categories which have entires? So I'm not getting any with 0 in them, which is occurring as I have a few entries not yet published with new categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('insights') %}&#xA;{# Get the count of entries related to `category` #}&#xA;{% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }} ({{ entryCount }})&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2016-04-04T12:32:17.943" Title="Display categories which only contain entries" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14489" PostTypeId="2" ParentId="14488" CreationDate="2016-04-04T12:32:17.943" Score="3" Body="&lt;p&gt;A simple but effective solution would be to just wrap the output in a conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entryCount %}&#xA;    &amp;lt;li&amp;gt;...&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-04T12:32:17.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14490" PostTypeId="1" AcceptedAnswerId="14514" CreationDate="2016-04-04T14:43:48.090" Score="0" ViewCount="231" Body="&lt;p&gt;I'm trying to create a dynamic rerouter based on &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow&quot;&gt;reroute plugin&lt;/a&gt;, but with the improvement to automatically create a reroute when a new entry is saved. So I listen for the &lt;code&gt;entries.onSaveEntry&lt;/code&gt; event, but how can I find its route ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot !&lt;/p&gt;&#xA;" OwnerUserId="3696" LastActivityDate="2016-04-05T10:51:37.513" Title="Get entry route" Tags="&lt;plugin-development&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14491" PostTypeId="1" CreationDate="2016-04-04T15:38:41.553" Score="0" ViewCount="93" Body="&lt;p&gt;I'm trying to retrieve matrix content from a an Entry field &lt;code&gt;chooseTemplateExample&lt;/code&gt; which has a matrix block &lt;code&gt;component&lt;/code&gt; with a Entry field &lt;code&gt;component&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for template in entry.chooseTemplateExample %}&#xA;  &amp;lt;a href=&quot;{{ template.url }}&quot; class=&quot;btn btn-primary&quot;&amp;gt;View {{ template.title }} example&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  {% for block in template.component %}&#xA;&#xA;     //Trying to get the matrix content within this &quot;template&quot;&#xA;     {% for block in entry.chooseComponentForTemplate %}&#xA;      {% for component in block.component %}&#xA;        {{ title }}&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="36" LastEditDate="2016-04-04T18:50:49.263" LastActivityDate="2016-04-04T18:59:20.383" Title="Retrieve matrix content from Entries form field in an Entry" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14492" PostTypeId="1" AcceptedAnswerId="14495" CreationDate="2016-04-04T17:29:41.917" Score="4" ViewCount="2682" Body="&lt;p&gt;I'm using Craft 2.6.2776. According to the &lt;a href=&quot;https://craftcms.com/docs/templating/functions&quot; rel=&quot;nofollow&quot;&gt;templating docs&lt;/a&gt;, Craft extends the built-in &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/index.html&quot; rel=&quot;nofollow&quot;&gt;Twig templating functions&lt;/a&gt;, which it links to. Among those functions is &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;dump()&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant part of my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% dump(craft.request.getURL) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I refresh the page, I get the error &lt;code&gt;Unknown &quot;dump&quot; tag.&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like &lt;code&gt;dump&lt;/code&gt; should be supported, according to the docs. What's going on?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'm using VirtualHostX to run my PHP server, and the URL is xxx.dev. According to my &lt;code&gt;general.php&lt;/code&gt; file, I am in dev mode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  '.dev' =&amp;gt; array(&#xA;    'enableTemplateCaching' =&amp;gt; false,&#xA;    'siteUrl' =&amp;gt; 'http://xxx.dev',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'baseUrl' =&amp;gt; 'http://xxx.dev'&#xA;    ),&#xA;    'devMode' =&amp;gt; true&#xA;  ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4976" LastEditorUserId="4976" LastEditDate="2016-04-04T17:38:01.043" LastActivityDate="2016-04-04T18:14:23.960" Title="&quot;Unknown dump tag&quot;" Tags="&lt;templating&gt;&lt;debugging&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14493" PostTypeId="2" ParentId="14492" CreationDate="2016-04-04T17:36:13.683" Score="5" Body="&lt;p&gt;Twig's &lt;code&gt;dump&lt;/code&gt; tag is only available when Craft's &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;noreferrer&quot;&gt;devMode&lt;/a&gt; is enabled.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-04T17:36:13.683" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14494" PostTypeId="1" CreationDate="2016-04-04T17:37:43.853" Score="3" ViewCount="380" Body="&lt;p&gt;We have a setup where we have a Contact Us page that submits a form using the plugin from P&amp;amp;T.&#xA;We will have quite some load on the site, so want to keep all of the GET responses in a CDN cache, CloudFront.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an issue where the CSRF token is of course cached in the page and so when the form is submitted by AJAX the token is invalid.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we ensure CSRF protection for the form and still have CDN caching enabled for the page?&lt;/p&gt;&#xA;" OwnerUserId="4354" LastActivityDate="2016-04-04T18:29:20.723" Title="Using CRSF, AJAX form posts, with a CDN" Tags="&lt;cache&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14495" PostTypeId="2" ParentId="14492" CreationDate="2016-04-04T17:44:15.710" Score="6" Body="&lt;p&gt;The dump tag is not a logic operator (e.g., no percent sign) — it should use the simple field brackets. As well, the proper format is either .url or .getUrl()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(craft.request.url) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="109" LastEditorUserId="109" LastEditDate="2016-04-04T18:14:23.960" LastActivityDate="2016-04-04T18:14:23.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14496" PostTypeId="1" AcceptedAnswerId="14497" CreationDate="2016-04-04T18:05:54.460" Score="4" ViewCount="480" Body="&lt;p&gt;I've been asked to migrate a Craft site from one server to another.  The new server setup is the same as the server I'm migrating from.  I moved all the files in the webroot directory over to the new server and imported the database.  The homepage works just fine, just all links go to an Apache 404 and so does the admin panel.  Ideas?  Nothing is different from the other server.&lt;/p&gt;&#xA;" OwnerUserId="4977" LastEditorUserId="4977" LastEditDate="2016-04-04T18:11:17.147" LastActivityDate="2016-04-04T18:15:52.140" Title="Migrating Craft site to another server --- throws 404 for all pages but homepage" Tags="&lt;404&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14497" PostTypeId="2" ParentId="14496" CreationDate="2016-04-04T18:15:52.140" Score="5" Body="&lt;p&gt;99% chance that it is because the .htaccess file did not come over when you copied the files, as it is a hidden file. Copy that over to your new webroot and those interior pages should properly work.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-04T18:15:52.140" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14498" PostTypeId="2" ParentId="14491" CreationDate="2016-04-04T18:20:04.853" Score="1" Body="&lt;p&gt;When you loop through your matrix, you're missing the &lt;code&gt;s&lt;/code&gt; on &lt;code&gt;components&lt;/code&gt;. Should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in template.components %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each item in that loop will be one of the blocks in the matrix. So then you can call &lt;code&gt;{{ block.component }}&lt;/code&gt; directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, in your code, it looks like that &lt;code&gt;component&lt;/code&gt; field in the matrix block is loopable as well? If you're trying to loop through an entries field, and then loop through a matrix field per entry, and then loop through another field per matrix block, expect some serious performance issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full code reference: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for template in entry.chooseTemplateExample %}&#xA;  &amp;lt;a href=&quot;{{ template.url }}&quot; class=&quot;btn btn-primary&quot;&amp;gt;View {{ template.title }} example&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  {% for block in template.components %}&#xA;    {% for component in block.component %} {!-- Is this field really loopable? --}&#xA;      {{ title }}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-04-04T18:20:04.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14499" PostTypeId="2" ParentId="14494" CreationDate="2016-04-04T18:29:20.723" Score="4" Body="&lt;p&gt;I don't think you can cache that, since the tag is run server-side and rendered with template output, and will be unique on every page load. If you have content that's unique on every page load, you'd have to either ignore that page from CDN caching, or dynamically load in the unique content after page load via an AJAX call to a page that is ignored from CDN caching.&lt;/p&gt;&#xA;" OwnerUserId="2215" LastActivityDate="2016-04-04T18:29:20.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14500" PostTypeId="2" ParentId="14491" CreationDate="2016-04-04T18:59:20.383" Score="1" Body="&lt;p&gt;OK I finally figured it out. Thanks Ben.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for template in entry.chooseTemplateExample %}&#xA;&#xA;  &amp;lt;a href=&quot;{{ template.url }}&quot; class=&quot;btn btn-primary&quot;&amp;gt;View {{ template.title }} example&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  {% for block in template.chooseComponentForTemplate %}&#xA;&#xA;     {% for component in block.component %}&#xA;            {{ component.title }}&#xA;     {% endfor %}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastActivityDate="2016-04-04T18:59:20.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14502" PostTypeId="1" AcceptedAnswerId="14505" CreationDate="2016-04-05T00:35:08.007" Score="4" ViewCount="583" Body="&lt;p&gt;I've noticed code samples like the following that use the &lt;code&gt;find()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(5).find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've noticed that this code sample works just as well without the &lt;code&gt;find()&lt;/code&gt; method attached. Is there a particular reason we use &lt;code&gt;find()&lt;/code&gt;? Are there instances where it's required? Should I be using it even if the code works without it?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-02-21T22:50:57.347" Title="When is the find() method actually necessary?" Tags="&lt;entries&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14503" PostTypeId="1" AcceptedAnswerId="14510" CreationDate="2016-04-05T01:11:42.237" Score="0" ViewCount="117" Body="&lt;p&gt;I am able to add/delete matrix blocks from within my plugin without any problems. I would like to give the user the ability to drag &amp;amp; drop any field just as you can within the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use &lt;a href=&quot;https://jqueryui.com/sortable/&quot; rel=&quot;nofollow&quot;&gt;jQuery UI Sortable&lt;/a&gt; to create the functionality no problem. I am curious what/how to call within Craft that manages order so that it is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions! &lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-04-05T09:33:33.287" Title="How can I save matrix order via plugin?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14504" PostTypeId="2" ParentId="14503" CreationDate="2016-04-05T04:52:14.570" Score="0" Body="&lt;p&gt;You'd re-save the element with the field set to the re-ordered array of IDs representing the Matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't have to save the blocks themselves, just the element.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-05T04:52:14.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14505" PostTypeId="2" ParentId="14502" CreationDate="2016-04-05T07:21:07.763" Score="6" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteraModel description in the docs&lt;/a&gt; explains what the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#find&quot;&gt;&lt;code&gt;find()&lt;/code&gt;&lt;/a&gt; method does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, when you use &lt;code&gt;craft.entries&lt;/code&gt; you are building an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; object that represents the query that you want to make. That query doesn't actually happen until you call the &lt;code&gt;find()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the docs state, as soon as you treat &lt;code&gt;craft.entries&lt;/code&gt; (or a variable that you have assigned it to) as an array, by using it in a &lt;code&gt;{% for %}&lt;/code&gt; loop, or by calling the &lt;code&gt;| length&lt;/code&gt; filter on it, &lt;code&gt;find()&lt;/code&gt; is automatically called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the example in your question, you can safely leave out the &lt;code&gt;find()&lt;/code&gt; and it will be called automatically anyway when the &lt;code&gt;{% for %}&lt;/code&gt; loop is executed.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-04-05T07:21:07.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14506" PostTypeId="1" CreationDate="2016-04-05T07:22:58.440" Score="1" ViewCount="1305" Body="&lt;p&gt;I just want to create a modal and play with it, but can't find a way to do so. I already checked other questions on the subject, but I still can't figure why my modal isn't showing correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;my-modal&quot; class=&quot;modal-shade&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;modal&quot;&amp;gt;&#xA;            some text I'd like to be shown...&#xA;        &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var $modal = new Garnish.Modal($('#my-modal'));&#xA;&#xA;$('#show-modal-btn').click(function() {&#xA;    $modal.show();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I load the page, the big shader appears instantly, and my modal is nowhere to be found, and it moved in the dom tree. Clicking the button doesnt make it appear again.&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="115" LastEditDate="2016-04-05T09:19:52.500" LastActivityDate="2017-02-28T21:31:56.540" Title="How to create modals" Tags="&lt;garnish&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14507" PostTypeId="2" ParentId="14506" CreationDate="2016-04-05T08:44:16.600" Score="2" Body="&lt;p&gt;Foud the answer after digging a bit, in fact I missed a little detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The base javascript code was correct :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$modal = new Garnish.Modal($('#my-modal')); //create a new modal&#xA;$modal.show(); //shows the modal&#xA;$modal.hide(); //hides the modal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is in the HTML code, you need to declare something like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;my-modal&quot; class=&quot;modal&quot;&amp;gt; &amp;lt;!-- modal body --&amp;gt;&#xA;    &amp;lt;div id=&quot;modal&quot; class=&quot;body&quot;&amp;gt; &amp;lt;!-- modal-content --&amp;gt;&#xA;        &amp;lt;header class=&quot;header&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;Modal header&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;/header&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Go check the &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/master/src/Modal.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;modal sources&lt;/a&gt; for api methods.&lt;/p&gt;&#xA;" OwnerUserId="3696" LastEditorUserId="222" LastEditDate="2017-02-28T21:31:56.540" LastActivityDate="2017-02-28T21:31:56.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14508" PostTypeId="1" CreationDate="2016-04-05T08:55:36.523" Score="2" ViewCount="1110" Body="&lt;p&gt;I would like to know how I can create a page that contains all entries from a section e.g. 'news'. I want to divide the entries by their given category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;News (section)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category 1:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry in category 1&lt;/li&gt;&#xA;&lt;li&gt;second entry in category 1&lt;/li&gt;&#xA;&lt;li&gt;third entry in category 1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Category 2:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry in category 2&lt;/li&gt;&#xA;&lt;li&gt;second entry in category 2&lt;/li&gt;&#xA;&lt;li&gt;third entry in category 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know the code for this? The categories are all in the same category group. &lt;/p&gt;&#xA;" OwnerUserId="4956" LastActivityDate="2016-04-05T09:16:40.420" Title="Display entries by category (multiple categories)" Tags="&lt;entries&gt;&lt;categories&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14509" PostTypeId="2" ParentId="14508" CreationDate="2016-04-05T09:10:30.590" Score="6" Body="&lt;p&gt;You can use .relatedTo(category)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('categoryName') %}&#xA;  &amp;lt;h2&amp;gt;{{category.title}}&amp;lt;/h2&amp;gt;&#xA;  {% for entry in craft.entries.section('news').relatedTo(category) %}&#xA;    &amp;lt;a href=&quot;{{entry.url}}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can check for length if you don't want to show categories which aren't related to any entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param//&quot; rel=&quot;noreferrer&quot;&gt;See the relations documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="4603" LastEditDate="2016-04-05T09:16:40.420" LastActivityDate="2016-04-05T09:16:40.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14510" PostTypeId="2" ParentId="14503" CreationDate="2016-04-05T09:33:33.287" Score="1" Body="&lt;p&gt;Matrix blocks are saved in the order they appear in the POST data when saving the &quot;owner&quot; element (the entry, or whatever). So just adding jQuery Sortable to your front-end form will be enough.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-05T09:33:33.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14511" PostTypeId="1" AcceptedAnswerId="14515" CreationDate="2016-04-05T10:04:41.543" Score="4" ViewCount="1071" Body="&lt;p&gt;Brand new to Craft here. I'm trying to port across my gulp workflow to Craft and basically everything has gone super smooth. Just one last obstacle due to my lack of knowledge of the Twig templating engine and some of the internal workings of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, for production, I run gulp with a &lt;code&gt;--production&lt;/code&gt; flag. This appends a string of numbers and letters to the asset's file name (as well as removing source maps etc.), such as &lt;code&gt;main-5449f384.css&lt;/code&gt;, to help with caching. A list of the resulting asset filenames is stored in a JSON file at &lt;code&gt;public/dist/assets.json&lt;/code&gt;. The contents of the file is akin to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;main.css&quot;: &quot;main-5449f384.css&quot;,&#xA;  &quot;modernizr.js&quot;: &quot;modernizr-45f0e1f4.js&quot;,&#xA;  &quot;jquery.js&quot;: &quot;jquery-e735354d.js&quot;,&#xA;  &quot;main.js&quot;: &quot;main-b7e504b0.js&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Separately, in my &lt;code&gt;general.php&lt;/code&gt; config file, I've set up environment variables so I can use local asset paths in local and dev environments and a CDN based path in production:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'appId' =&amp;gt; 'example',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;&#xA;    'example.com' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; false,&#xA;        'assetUrl' =&amp;gt; 'https://cdn.example.com/',&#xA;    ),&#xA;&#xA;    'craft' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'local' =&amp;gt; true,&#xA;        'assetUrl' =&amp;gt; 'http://craft:8888/',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had figured that to finalise the whole workflow, my &lt;code&gt;head&lt;/code&gt; section within &lt;code&gt;craft/templates/_layout.html&lt;/code&gt; would look something like (using a if statement to get the current environment):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Local&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ craft.config.assetUrl }}dist/scripts/main.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Live (pseudocode)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ craft.config.assetUrl }}dist/scripts/{{ assets.json.main.js }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to either set an environment variable based on the contents of the JSON file or to access to JSON file contents directly from within the template file? Or perhaps there's a much better way of doing this altogether (I'd quite like to keep the currently gulp workflow as is if possible)!&lt;/p&gt;&#xA;" OwnerUserId="4980" LastEditorUserId="57" LastEditDate="2016-04-05T14:41:08.647" LastActivityDate="2018-11-05T17:49:57.500" Title="Creating environment variable from JSON file" Tags="&lt;assets&gt;&lt;javascript&gt;&lt;json&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14512" PostTypeId="1" AcceptedAnswerId="14513" CreationDate="2016-04-05T10:24:38.823" Score="4" ViewCount="1296" Body="&lt;p&gt;Attempting to include a template that doesn't exist throws HttpStatus 500 – &lt;code&gt;Craft\TemplateLoaderException – Unable to find the template “{template}”.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is usually fine and what you want, but is it possible to override this behaviour somehow, and make Craft throw a plain' old 404 instead?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-04-05T11:12:57.770" Title="Is it possible to make Craft/Twig throw 404 if a template can't be found?" Tags="&lt;templating&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14513" PostTypeId="2" ParentId="14512" CreationDate="2016-04-05T10:34:56.523" Score="6" Body="&lt;p&gt;Here's one way to do it – not super elegant, but it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set template %}&#xA;    {{- include('sometemplatethatdoesntexist', ignore_missing = true) -}}&#xA;{% endset %}&#xA;&#xA;{% if not template %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{{ template }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-04-05T11:12:57.770" LastActivityDate="2016-04-05T11:12:57.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14514" PostTypeId="2" ParentId="14490" CreationDate="2016-04-05T10:51:37.513" Score="2" Body="&lt;p&gt;You can get an entry’s URI via &lt;code&gt;$entry-&amp;gt;uri&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be able to tell if an entry’s URI is actually changing, you will also need to listen to the &lt;code&gt;onBeforeSafeEntry&lt;/code&gt; event, and store its original URI:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;private $_oldUris;&#xA;&#xA;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.beforeSaveEntry', function(Event $event) {&#xA;        /** @var EntryModel $entry */&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // Store the entry's old URI&#xA;        if ($entry-&amp;gt;id)&#xA;        {&#xA;            $this-&amp;gt;_oldUris[$entry-&amp;gt;id] = $entry-&amp;gt;uri;&#xA;        }&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        /** @var EntryModel $entry */&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // Did the URI just change?&#xA;        if (isset($this-&amp;gt;_oldUris[$entry-&amp;gt;id]) &amp;amp;&amp;amp; $this-&amp;gt;_oldUris[$entry-&amp;gt;id] != $entry-&amp;gt;uri)&#xA;        {&#xA;            // Yes it did. The new URI is available at $entry-&amp;gt;uri.&#xA;            // ...&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-05T10:51:37.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14515" PostTypeId="2" ParentId="14511" CreationDate="2016-04-05T11:09:05.263" Score="4" Body="&lt;p&gt;You could write some PHP at the top of your &lt;code&gt;general.php&lt;/code&gt; file that reads the JSON manifest in your public root directory, and add its keys/values to the config array. I wouldn't use environment variables here, personally – just add the manifest to the returned array in &lt;code&gt;general.php&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// In general.php:&#xA;&#xA;$assetsManifest = @json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'].'/assets/assets.json')) ?: [];&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        ...&#xA;        'assets' =&amp;gt; (array)$assetsManifest,&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ craft.config.assets['main.js'] ?? 'main.js' }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be advised that the null-coalescing operator (&lt;code&gt;??&lt;/code&gt;) was just added in Craft 2.6 – if you haven't updated yet, you can use the &lt;code&gt;default&lt;/code&gt; filter instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ craft.config.assets['main.js']|default('main.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach for getting revved asset filenames in templates, is to use a plugin which adds either a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;template variable method&lt;/a&gt; or Twig filter/function to Craft. For an example of the latter, see Viget Labs' &lt;a href=&quot;https://github.com/vigetlabs/gulp-starter/tree/master/extras/craft&quot; rel=&quot;nofollow&quot;&gt;Gulp Rev Craft plugin&lt;/a&gt;, which is bundled with their awesome Gulp Starter repo. Here's how revving works using this particular plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ 'main.js'|gulp_rev }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For me, individual asset filenames in the config feels a bit off and the custom filter option seems a lot cleaner, so I'm personally going with that approach.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-04-05T11:09:05.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14516" PostTypeId="1" AcceptedAnswerId="14526" CreationDate="2016-04-05T11:29:52.440" Score="7" ViewCount="2872" Body="&lt;p&gt;I would like to add a custom button in the right section of a channels entry form in the CMS. &#xA;The this button needs to go to a custom url of the plugin that I have created. The link should contain entry ID so that I can use this ID in my plugin.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ckv4N.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ckv4N.png&quot; alt=&quot;Can I add a custom button here? &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4901" LastActivityDate="2016-04-05T23:25:51.620" Title="How to add a custom button at the right section of an entry?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14517" PostTypeId="2" ParentId="9274" CreationDate="2016-04-05T11:33:28.810" Score="2" Body="&lt;p&gt;That error is occurring at &lt;code&gt;entries.limit(10)&lt;/code&gt;, because at that point &lt;code&gt;entries&lt;/code&gt; is already an array of fetched entries, rather than an ElementCriteriaModel. (The entries will get fetched as soon as the ElementCriteriaModel is passed to your &lt;code&gt;|group&lt;/code&gt; filter.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way to grab just 10 entries per section (per page) will be to loop through each of your sections, and create a new ElementCriteriaModel for each one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = {&#xA;    'news': 'News',&#xA;    'events': 'Events',&#xA;    // ...&#xA;} %}&#xA;&#xA;{% for section, sectionName in sections %}&#xA;&#xA;    {% set entries = craft.entries.section(section).limit(10) %}&#xA;    {% paginate entries as pageInfo, pageEntries %}&#xA;&#xA;    {% if pageEntries|length %}&#xA;        &amp;lt;h3&amp;gt;{{ sectionName }}&amp;lt;/h3&amp;gt;&#xA;&#xA;        {% for entry in pageEntries %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that Craft does not support multiple independently paginated lists of entries on a single webpage. So if you use the built-in &lt;code&gt;{% paginate %}&lt;/code&gt; tag like this, when it takes you to page 2, all of the sections’ &lt;code&gt;{% paginate %}&lt;/code&gt; tags will start showing page 2 content. And you’ll need to keep track of which section actually has the most pages, before building out your pagination nav.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ...&#xA;&#xA;{% set primaryPageInfo = null %}&#xA;&#xA;{% for section, sectionName in sections %}&#xA;&#xA;    {% set entries = craft.entries.section(section).limit(10) %}&#xA;    {% paginate entries as pageInfo, pageEntries %}&#xA;&#xA;    // ...&#xA;&#xA;    {# Does this section have the most entries (so far)? #}&#xA;    {% if not primaryPageInfo or pageInfo.totalPages &amp;gt; primaryPageInfo.totalPages %}&#xA;        {% set primaryPageInfo = pageInfo %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Build out the pagination nav using the biggest section's pageInfo #}&#xA;&amp;lt;a href=&quot;{{ primaryPageInfo.firstUrl }}&quot;&amp;gt;First Page&amp;lt;/a&amp;gt;&#xA;{% if primaryPageInfo.prevUrl %}&amp;lt;a href=&quot;{{ primaryPageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if primaryPageInfo.nextUrl %}&amp;lt;a href=&quot;{{ primaryPageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&amp;lt;a href=&quot;{{ primaryPageInfo.lastUrl }}&quot;&amp;gt;Last Page&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-05T11:33:28.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14518" PostTypeId="2" ParentId="10239" CreationDate="2016-04-05T11:39:03.743" Score="2" Body="&lt;p&gt;If the page is rendered from a template that extends &lt;code&gt;_layouts/elementindex&lt;/code&gt;, then the Element Index class instance is available at &lt;code&gt;Craft.elementIndex&lt;/code&gt;. So all you’d need to do is include this in the settings object when creating your Modal instance:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;onHide: function() {&#xA;    Craft.elementIndex.updateElements();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-05T11:39:03.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14519" PostTypeId="2" ParentId="13411" CreationDate="2016-04-05T11:42:29.417" Score="1" Body="&lt;p&gt;The Element Editor HUD will only be available if your element model’s &lt;code&gt;isEditable()&lt;/code&gt; method returns &lt;code&gt;true&lt;/code&gt;. (It returns &lt;code&gt;false&lt;/code&gt; by default.) Remove that method from your element model class and you should be good.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-05T11:42:29.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14520" PostTypeId="2" ParentId="14516" CreationDate="2016-04-05T11:56:34.877" Score="2" Body="&lt;p&gt;&lt;strike&gt;Not possible, unfortunately – you'll have to use JavaScript/jQuery to hack it in.&lt;/strike&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Brad's answer for a canonical solution. It's also possible to use JavaScript/jQuery to accomplish what you want – something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('input[name=&quot;revisionNotes&quot;]').before('&amp;lt;a href=&quot;'+Craft.getCpUrl('yourcustomroute')+'&quot; class=&quot;btn&quot;&amp;gt;Button label&amp;lt;/a&amp;gt;');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will inject a button, just above the revision notes input in the sidebar, pointing to &lt;code&gt;/admin/yourcustomroute&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for getting the ID, the easiest way to do that is to use jQuery to pull the hidden input named &lt;code&gt;entryId&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var entryId = $('input[type=&quot;hidden&quot;][name=&quot;entryId&quot;]').val();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, a new entry that hasn't been saved yet doesn't have an entry ID, so you might want to opt for not rendering the button if jQuery can't find the the hidden input, or if its value is empty. So putting it together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var entryId = $('input[type=&quot;hidden&quot;][name=&quot;entryId&quot;]').val();&#xA;&#xA;if (entryId) {&#xA;    $('input[name=&quot;revisionNotes&quot;]').before('&amp;lt;a href=&quot;'+Craft.getCpUrl('yourcustomroute/'+entryId)+'&quot; class=&quot;btn&quot;&amp;gt;Button label&amp;lt;/a&amp;gt;');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if the URL should point to an &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;action&lt;/a&gt; rather than a CP resource, you can use &lt;code&gt;Craft.getActionUrl()&lt;/code&gt; over &lt;code&gt;Craft.getCpUrl()&lt;/code&gt;, or if its a frontend resource, you can use &lt;code&gt;Craft.getSiteUrl()&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can run the above command in your browser's console to test it out. To run it with your plugin, you'll need to add it to a JavaScript file included in your plugin's &lt;code&gt;/resources&lt;/code&gt; folder, and add the file to Craft's Control Panel like this (in your plugin's main class file):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init ()&#xA;{&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('yourPluginHandle/script.js');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info on adding JavaScript to Craft's Control Panel, see &lt;a href=&quot;https://craftcms.stackexchange.com/a/270/1098&quot;&gt;this thread&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, be advised that using this method makes your code entirely dependent on the DOM structure of Craft's Control Panel, which can change at any time, possibly breaking your implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would appear this is possible without resorting to JS hacks after all, as per Brad's answer below. I'll leave this answer up anyway, as it could be a useful proof of concept for injecting HTML into other parts of the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-04-05T23:25:51.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14521" PostTypeId="1" CreationDate="2016-04-05T13:02:33.543" Score="1" ViewCount="288" Body="&lt;p&gt;We have a problem with using Live Preview on a site that uses CDN caching [CloudFront].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When opening Live Preview a POST is sent to the actual page URL containing the information and the response is rendered&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/mypage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However /mypage is in the CDN cache for GET requests and so when Craft sends the POST the headers and cookies are &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; forwarded to the origin. This causes a 400 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We tried using a subdomain just for the CP, but of course the site is still on the cached domain and this is the domain used by the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use live preview with CDN caching?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;One potential approach would be to have a cookie set that is &lt;em&gt;only&lt;/em&gt; set for logged in CP users, then we can set up a cache rule to bypass the CDN cache for all requests with that cookie.&lt;/del&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Unfortunately our hosting partner informs us that we cannot have different caching profiles based upon a cookie. So we really need the Live Preview POST to be to paths that are not the actual cached live site paths.&lt;/p&gt;&#xA;" OwnerUserId="4354" LastEditorUserId="4354" LastEditDate="2016-04-05T15:24:23.757" LastActivityDate="2016-04-05T19:16:51.537" Title="Live Preview and CDN caching" Tags="&lt;control-panel&gt;&lt;cache&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14522" PostTypeId="1" CreationDate="2016-04-05T13:03:30.643" Score="2" ViewCount="63" Body="&lt;p&gt;I am adding a column to the entry table with links to reverse related entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function defineAdditionalEntryTableAttributes()&#xA;    {&#xA;        return array(&#xA;            'blockParent' =&amp;gt; Craft::t('Parent'),&#xA;        );&#xA;    }&#xA;&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    switch ($attribute)&#xA;    {&#xA;        case 'blockParent':&#xA;        {&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;                'relatedTo' =&amp;gt; [&#xA;                    'targetElement' =&amp;gt; $entry,&#xA;                    'field' =&amp;gt; 'contentSections.blocks',&#xA;                ]&#xA;            ]);&#xA;&#xA;            $html = '';&#xA;&#xA;            foreach ($criteria as $entry) {&#xA;                $html .= craft()-&amp;gt;templates-&amp;gt;render('_elements/element', array(&#xA;                    'element' =&amp;gt; $entry,&#xA;                ));&#xA;            }&#xA;&#xA;            return $html;&#xA;        }&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works great. Only I want to make the column sortable (based on the title of the first entry of each).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to sort on these types of added columns? &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt; seems to only work on real attributes, not added ones.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-04-05T13:03:30.643" Title="Allow CP sorting on an added EntryTableAttribute" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14524" PostTypeId="1" AcceptedAnswerId="14527" CreationDate="2016-04-05T14:48:31.510" Score="2" ViewCount="156" Body="&lt;p&gt;One of our servers hosting a Craft site has recently had ImageMagick installed on it, as we noticed that transformed animated GIFs weren't animating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'Requirement Report' at &lt;code&gt;/admin/utils/serverinfo&lt;/code&gt; is still reporting a 'warning' against ImageMagick (as it was before it was installed), and Craft seems to still be using GD as the freshly transformed animated GIFs still aren't animating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to force Craft to 'recheck' the available modules on the server (and so in my case, for it to recognise that it can now use ImageMagick)?&lt;/p&gt;&#xA;" OwnerUserId="2314" LastEditorUserId="57" LastEditDate="2016-04-05T16:42:36.077" LastActivityDate="2016-04-05T16:47:57.453" Title="Is it possible to force Craft to recheck available sever modules?" Tags="&lt;image-transforms&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14525" PostTypeId="2" ParentId="10392" CreationDate="2016-04-05T15:33:56.083" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/TopShelfCraft/Legacy-Login&quot; rel=&quot;nofollow&quot;&gt;Legacy Login&lt;/a&gt; plugin handles authentication from legacy systems such as ExpressionEngine and BigCommerce. It works by intercepting the login, and if the given credentials fail to authenticate with a native user, it tries authenticating a legacy user using the legacy system's particular hashing method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could add another driver by copying the existing ones and tweaking the methods based on the setup of your particular system.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-04-05T15:33:56.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14526" PostTypeId="2" ParentId="14516" CreationDate="2016-04-05T16:31:43.683" Score="12" Body="&lt;p&gt;You can add custom HTML in exactly the spot you’re hoping to, using the (undocumented) &lt;code&gt;cp.entries.edit.right-pane&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#hook-detail&quot;&gt;template hook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use it, add this to your plugin’s primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;templates-&amp;gt;hook('cp.entries.edit.right-pane', function(&amp;amp;$context) {&#xA;        /** @var EntryModel $entry **/&#xA;        $entry = $context['entry'];&#xA;&#xA;        // Make sure this is the correct section&#xA;        if ($entry-&amp;gt;sectionId == 5) {&#xA;            // Return the button HTML&#xA;            $url = UrlHelper::getUrl('some/path/'.$entry-&amp;gt;id);&#xA;            return '&amp;lt;a href=&quot;'.$url.'&quot; class=&quot;btn&quot;&amp;gt;My Button!&amp;lt;/a&amp;gt;';&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2016-04-05T23:01:28.197" LastActivityDate="2016-04-05T23:01:28.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14527" PostTypeId="2" ParentId="14524" CreationDate="2016-04-05T16:47:57.453" Score="3" Body="&lt;p&gt;Craft will re-run the requirement checks simply by loading that &lt;code&gt;admin/utils/serverinfo&lt;/code&gt; page.  The results aren't cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like your box may have had the &lt;a href=&quot;https://www.imagemagick.org/script/index.php&quot; rel=&quot;nofollow&quot;&gt;ImageMagic&lt;/a&gt; library installed, but not the &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;PHP wrapper&lt;/a&gt; for it.  You can check by going to &lt;code&gt;admin/utils/phpinfo&lt;/code&gt; and searching for &lt;code&gt;imagick&lt;/code&gt; and if there are no results, it's not installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively maybe it is installed, but you're explicitly setting the &lt;a href=&quot;https://craftcms.com/docs/config-settings#imageDriver&quot; rel=&quot;nofollow&quot;&gt;imageDriver&lt;/a&gt; config setting to &lt;code&gt;'gd'&lt;/code&gt;.  Be default, it's set to &lt;code&gt;null&lt;/code&gt; which means Craft will automatically use Imagick if it sees its available.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-05T16:47:57.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14528" PostTypeId="1" CreationDate="2016-04-05T17:24:23.870" Score="3" ViewCount="312" Body="&lt;p&gt;Currently, a user has to click update on each line item to save changes to quantity or a note. The quantity might make sense to the user as it updates the price, but a user could assume that the note would just need to be filled out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wondering if there's a simple way to allow the user to fill out notes without clicking update and have them save.&lt;/p&gt;&#xA;" OwnerUserId="4739" LastEditorUserId="45" LastEditDate="2016-08-13T02:34:42.457" LastActivityDate="2016-08-13T02:34:42.457" Title="Can notes on line items be updated on checkout?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14529" PostTypeId="2" ParentId="14521" CreationDate="2016-04-05T19:16:51.537" Score="1" Body="&lt;p&gt;If it were me, I wouldn't use Cloudfront to offload the entire site. You can certainly use it for static assets but cache invalidation is really expensive. And as you've found it, troublesome. By offloading the static assets, you can keep the web server focused on just serving page requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14494/using-crsf-ajax-form-posts-with-a-cdn&quot;&gt;previous question&lt;/a&gt;, it sounds you get a fair amount of traffic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cache invalidation is a tricky subject. I don't know how often you update but a middle-of-the-road approach is using nginx or varnish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like nginx myself because of its flexible &lt;code&gt;fastcgi_cache&lt;/code&gt;. Even if you set the cache low, like 1 minute, you've just increased your capacity by an order of magnitude without much additional work on your part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nginx also allows you to cache by location so you could exclude caching any page with a form. POST requests by default bypass the cache.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-05T19:16:51.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14530" PostTypeId="1" AcceptedAnswerId="14532" CreationDate="2016-04-05T21:13:24.760" Score="6" ViewCount="1605" Body="&lt;p&gt;I need to implement a bunch of background processes that do things like send emails, query 3rd pary api etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the task in place, but i dont fully understand how steps work, docs are a little thin on this, can someone explain how this works?&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="45" LastEditDate="2016-08-13T02:28:06.923" LastActivityDate="2017-09-11T13:03:00.853" Title="Tasks and Steps" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14531" PostTypeId="2" ParentId="14530" CreationDate="2016-04-05T21:41:54.770" Score="2" Body="&lt;p&gt;Check out the example &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap&quot; rel=&quot;nofollow&quot;&gt;PowerNapTask&lt;/a&gt; provided by Pixel &amp;amp; Tonic — It implements a Task (and Subtask) with multiple steps. It should be fairly straightforward to modify that sample code to run your own custom logic.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-04-05T21:41:54.770" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14532" PostTypeId="2" ParentId="14530" CreationDate="2016-04-05T23:31:52.707" Score="10" Body="&lt;p&gt;You can implement your entire Task with a single step if you want. The only point of breaking it into multiple steps is so the task progress bar has an idea of how far along the task is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, since your task is broken up into multiple unrelated processes, you might want to implement it with subtasks. So the top-level task only has a couple of steps based on the different high-level aspects of the task, and create separate task classes for those individual steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say you have two main steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;call an external API&lt;/li&gt;&#xA;&lt;li&gt;send emails&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and (I’m guessing, just to illustrate how this could work), let’s say that the email recipients are being determined by that API call, so you need a little bit of cross-communication between those processes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s the gist of how you’d set those classes up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Primary task class&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class MyPlugin_PrimaryTask extends BaseTask&#xA;{&#xA;    private $_emails;&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Blasting emails';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 2;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        switch ($step)&#xA;        {&#xA;            case 0:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('MyPlugin_ApiTask', null, array(&#xA;                    'primaryTaskId' =&amp;gt; $this-&amp;gt;model-&amp;gt;id&#xA;                ));&#xA;            }&#xA;            case 1:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('MyPlugin_EmailTask', null, array(&#xA;                    'emails' =&amp;gt; $this-&amp;gt;_emails;&#xA;                ));&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    public function setEmails($emails)&#xA;    {&#xA;        $this-&amp;gt;_emails = $emails;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;API-calling task&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class MyPlugin_ApiTask extends BaseTask&#xA;{&#xA;    private $_parentTask;&#xA;    private $_emails;&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Calling the external API';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 1;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        // Call the API and get a list of emails&#xA;        // ...&#xA;        // $emails = ...&#xA;&#xA;        // Pass the emails along to the primary task&#xA;        $primaryTask = craft()-&amp;gt;tasks-&amp;gt;getTaskById($this-&amp;gt;getSettings()-&amp;gt;primaryTaskId);&#xA;        $primaryTask-&amp;gt;getTaskType()-&amp;gt;setEmails($emails);&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    protected function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'primaryTaskId' =&amp;gt; AttributeType::Number&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Email-sending task&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class MyPlugin_EmailTask extends BaseTask&#xA;{&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Sending the emails';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return count($this-&amp;gt;getSettings()-&amp;gt;emails);&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        $email = new EmailModel();&#xA;        $email-&amp;gt;toEmail = $this-&amp;gt;getSettings()-&amp;gt;emails[$step];&#xA;        $email-&amp;gt;subject = '...';&#xA;        $email-&amp;gt;body = '...';&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    protected function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'emails' =&amp;gt; AttributeType::Mixed&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-04-06T10:13:55.637" LastActivityDate="2016-04-06T10:13:55.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14533" PostTypeId="2" ParentId="14528" CreationDate="2016-04-06T03:50:46.877" Score="5" Body="&lt;p&gt;I use ajax autosave to achieve this, and ajax update the cart in the background (for notes, but also pretty much everything else).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I essentially use the recipe from:&#xA;from &lt;a href=&quot;https://github.com/geniuscarrier/autoSave/&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/geniuscarrier/autoSave/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the callback function that is called after the autosave event, I post the to the update cart controller.  The JSON object that comes back from an ajax request is quite complete and let's your update your cart page / totals etc from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I hate non dynamic carts with update buttons, so I have ajaxed all cart operations, including qty changes, removals, line item and order notes etc.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-04-06T03:50:46.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14534" PostTypeId="2" ParentId="14481" CreationDate="2016-04-06T03:51:37.893" Score="3" Body="&lt;p&gt;Usually, its very easy to pull data from a relational fieldtype (Categories, Entries, Assets etc). E.g. if your Categories field handle is &lt;code&gt;memberGroups&lt;/code&gt;, you can simply do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categories = $user-&amp;gt;memberGroups;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, your Categories field handle is &lt;code&gt;groups&lt;/code&gt;, which conflicts with the built-in UserModel attribute &lt;code&gt;groups&lt;/code&gt;, used to pull any user groups the user is a member of – this means that calling &lt;code&gt;$user-&amp;gt;groups&lt;/code&gt; will give you an array of UserGroupModel instances, ignoring your Categories field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the &lt;code&gt;$user-&amp;gt;getContent()-&amp;gt;getAttribute('groups');&lt;/code&gt; method doesn't appear to work for relational fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easy answer: I'd suggest you simply change the field handle for your Categories field to something else – for example &lt;code&gt;memberGroups&lt;/code&gt;. Don't worry, you won't lose any data if you do. Then you can just do &lt;code&gt;$categories = $user-&amp;gt;memberGroups;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you can't or wont change the field handle, here's a workaround:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'sourceElement' =&amp;gt; $user,&#xA;    'field' =&amp;gt; 'groups'&#xA;);&#xA;$categories = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-04-06T17:29:33.490" LastActivityDate="2016-04-06T17:29:33.490" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14535" PostTypeId="2" ParentId="14122" CreationDate="2016-04-06T06:48:51.567" Score="1" Body="&lt;p&gt;Removed above code and added the custom validation function for CVV Validation &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateCVV($attribute) {&#xA;    $value = $this-&amp;gt;$attribute;&#xA;    if(!preg_match('/^[0-9]{3}$/', $value)) {&#xA;        $message = Craft::t(&quot;Oops!  Try again with a valid CVV security code on the back of your card.&quot;);&#xA;        $this-&amp;gt;addError($attribute, $message);&#xA;    }        &#xA;}&#xA;&#xA;$rules[] = ['CVC', 'validateCVV'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="4494" LastActivityDate="2016-04-06T06:48:51.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14536" PostTypeId="1" AcceptedAnswerId="14538" CreationDate="2016-04-06T09:53:44.817" Score="1" ViewCount="314" Body="&lt;p&gt;I'm sure there must be a tidier and more efficient way of doing this so thought I'd throw it out there for some opinions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building a site that has the usual lists (in grid format) for Blog, Gallery, Meet the Team, etc... I'm calling these 'cards', and I'm including them with various attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_modules/card&quot;&#xA;    with {&#xA;        author: true,&#xA;        badge: true,&#xA;        date: true,&#xA;        magnify: true,&#xA;        meta: true,&#xA;        thumbnail: true,&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my card I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;&#xA;{% if badge is defined %}&#xA;    &amp;lt;div class=&quot;badge&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;/assets/images/icon-new.svg&quot; height=&quot;14px&quot; width=&quot;14px&quot; alt=&quot;New!&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if thumbnail is defined %}&#xA;    &amp;lt;a href=&quot;#&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;http://placehold.it/320x210&quot; &#xA;             srcset=&quot;http://placehold.it/640x420 750w, &#xA;                     http://placehold.it/320x210 280w&quot; &#xA;             sizes=&quot;100%&quot;&#xA;             alt=&quot;&quot;&#xA;             class=&quot;tn&quot;&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;article&amp;gt;&#xA;    &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Heading Goes in Here&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% if meta is defined %}&#xA;&#xA;        &amp;lt;footer class=&quot;meta&quot;&amp;gt;&#xA;            {% if date is defined %}&#xA;                {% include &quot;_modules/relative-date&quot; %} &#xA;            {% endif %}&#xA;            {% if author is defined %}&#xA;                by &amp;lt;a href=&quot;#&quot; rel=&quot;author&quot;&amp;gt;John Doe&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/footer&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/article&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works as expected but I can't help feel it could be neater. There are a lot of conditions at work here for example, and this will all be part of an entries loop too. Anyone have any suggestions for streamlining this a bit? Much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2016-04-06T10:52:53.167" Title="Streamlining a loop with a bunch of conditions" Tags="&lt;conditional&gt;&lt;forloop&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14537" PostTypeId="1" CreationDate="2016-04-06T09:56:26.633" Score="1" ViewCount="830" Body="&lt;p&gt;I want to get the title of the first element from a entries field in a for loop. I think its easier to understand with a code example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set programs = craft.entries.section('program_point').block.first().title('first-block') %}&#xA;{% for program in programs %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;block&lt;/code&gt; is an entries field. And the loop should only consider entries where the title of the first element in &lt;code&gt;block&lt;/code&gt;is &lt;em&gt;first-block&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I tried this, I always got an error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;title&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But when I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set programs = craft.entries.section('program_point') %}&#xA;{% for program in programs %}&#xA;        {% if program.block.first().title == 'first-block' %}&#xA;             ...&#xA;        {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;all worked fine. &#xA;So how can I check the title of the first element in the for loop?&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="22" LastEditDate="2017-05-09T22:06:18.863" LastActivityDate="2017-05-09T22:06:18.863" Title="for loop: get the title of the first element of an entries field" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14538" PostTypeId="2" ParentId="14536" CreationDate="2016-04-06T10:42:30.873" Score="3" Body="&lt;p&gt;I'm not sure if this is better or not but one thing I'd do here is to set some defaults in my include. This also means you don't need to worry about checking whether it's defined or not. You're just checking whether it's true.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    author: true,&#xA;    badge: true,&#xA;    date: true,&#xA;    magnify: true,&#xA;    meta: true,&#xA;    thumbnail: true,&#xA;} | merge(cardOptions | default({})) %}&#xA;&#xA;&amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;&#xA;    {% if options.badge %}&#xA;        &amp;lt;div class=&quot;badge&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;/assets/images/icon-new.svg&quot; height=&quot;14px&quot; width=&quot;14px&quot; alt=&quot;New!&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if options.thumbnail %}&#xA;        &amp;lt;a href=&quot;#&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;http://placehold.it/320x210&quot; &#xA;                srcset=&quot;http://placehold.it/640x420 750w, &#xA;                     http://placehold.it/320x210 280w&quot; &#xA;                sizes=&quot;100%&quot;&#xA;                alt=&quot;&quot;&#xA;                class=&quot;tn&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Heading Goes in Here&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% if options.meta %}&#xA;&#xA;            &amp;lt;footer class=&quot;meta&quot;&amp;gt;&#xA;                {% if options.date %}&#xA;                    {% include &quot;_modules/relative-date&quot; %} &#xA;                {% endif %}&#xA;                {% if options.author %}&#xA;                    by &amp;lt;a href=&quot;#&quot; rel=&quot;author&quot;&amp;gt;John Doe&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/footer&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    &amp;lt;/article&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when I use this include I can pass in an object of options that could overide those defaults. But I only need to pass in values that need to change the defaults. For example here I can set &lt;code&gt;meta&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; but can leave all the others to be handled by the default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cardOptions = {&#xA;    meta: false&#xA;} %}&#xA;&#xA;{% include &quot;_modules/card&quot; with cardOptions %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You said this would be included within an &lt;code&gt;entries&lt;/code&gt; loop. You could do this in that case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    entry: false,&#xA;    author: true,&#xA;    badge: true,&#xA;    date: true,&#xA;    magnify: true,&#xA;    meta: true,&#xA;    thumbnail: true,&#xA;} | merge(cardOptions | default({})) %}&#xA;&#xA;{# Wrap the whole card in a conditional #}&#xA;{% if options.entry %}&#xA;   // Card goes here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your &lt;code&gt;entries&lt;/code&gt; loop you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;&#xA;    {% set cardOptions = {&#xA;        entry: entry&#xA;    } %}&#xA;&#xA;    {% include &quot;_modules/card&quot; with cardOptions only %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd probably use the &lt;code&gt;only&lt;/code&gt; option on the &lt;code&gt;include&lt;/code&gt; tag to avoid stuff leaking in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also played with options such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cardOptions = {&#xA;    styleGuide: true&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my include this option will have a &lt;code&gt;false&lt;/code&gt; default I'll have a conditional that checks for it being &lt;code&gt;true&lt;/code&gt; and if so it'll ignore any dynamic content and instead I'll output an example of the module with fake content. It's good for testing and for keeping a library of modules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also consider a macro that wraps your &lt;code&gt;include&lt;/code&gt; tag. I gave a similar example in a blog post not long ago: &lt;a href=&quot;http://withchief.com/blog/using-macros-to-improve-consistency-in-your-craft-cms-templates&quot; rel=&quot;nofollow&quot;&gt;Using macros to improve consistency in your Craft CMS templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro module(type, options = {}) %}&#xA;    {% include '_modules/' ~ type with options only %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your template you'd do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cardOptions = {&#xA;    entry: entry,&#xA;    meta: false&#xA;} %}&#xA;&#xA;{{ module('card', cardOptions) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Dunno if any of that helps!&lt;/p&gt;&#xA;" OwnerUserId="379" LastEditorUserId="379" LastEditDate="2016-04-06T10:52:53.167" LastActivityDate="2016-04-06T10:52:53.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14539" PostTypeId="1" AcceptedAnswerId="14540" CreationDate="2016-04-06T12:51:22.397" Score="1" ViewCount="1410" Body="&lt;p&gt;Sorry if this is a really obvious question, I'm new to Twig and Craft. I'm getting the following error: &#xA;Unexpected tag name &quot;offset&quot; (expecting closing tag for the &quot;if&quot; tag defined near line 54)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me what is wrong with my code?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;box alt container&quot;&amp;gt;&#xA;{% set offset = true %}&#xA;{% if offset %}&#xA;&amp;lt;section class=&quot;feature left&quot;&amp;gt;&#xA;    {% set caseHero = entry.heroImage.first() %}&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot;image icon fa-signal&quot;&amp;gt;&amp;lt;img src='{{caseHero.url}}' alt=&quot;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{entry.title}}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{entry.description}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;    {% offset = false %}&#xA;{% else %}&#xA;&amp;lt;section class=&quot;feature left&quot;&amp;gt;&#xA;    {% set caseHero = entry.heroImage.first() %}&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot;image icon fa-signal&quot;&amp;gt;&amp;lt;img src='{{caseHero.url}}' alt=&quot;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{entry.title}}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{entry.description}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;    {% offset = true %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="4961" LastActivityDate="2016-04-06T14:13:15.513" Title="Twig Templating If statement (Unexpected tag name error)" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14540" PostTypeId="2" ParentId="14539" CreationDate="2016-04-06T13:04:27.460" Score="2" Body="&lt;p&gt;It seems like you want to set offset to false after your first section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this correctly you would need to use set like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set offset = false %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow&quot;&gt;Checkout the documentation to set a variable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-04-06T13:04:27.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14541" PostTypeId="2" ParentId="14539" CreationDate="2016-04-06T14:13:15.513" Score="1" Body="&lt;p&gt;The problem line is this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% offset = true %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It needs to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set offset = true %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think there are a couple of occurrences.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-04-06T14:13:15.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14542" PostTypeId="1" AcceptedAnswerId="14547" CreationDate="2016-04-06T14:57:33.287" Score="2" ViewCount="770" Body="&lt;p&gt;I have a section with two Categories fields, and I would like the entries’ URLs to include the slugs of the categories selected in each of those fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Category Groups are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;mySection&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Employees&lt;/li&gt;&#xA;&lt;li&gt;Employers&lt;/li&gt;&#xA;&lt;li&gt;Executives&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;myCategory&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Vitality&lt;/li&gt;&#xA;&lt;li&gt;Health&lt;/li&gt;&#xA;&lt;li&gt;Safety&lt;/li&gt;&#xA;&lt;li&gt;Career&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So an entry that has “Employees” selected in the first Categories field, ad “Health” selected in the second Categories field should end up with the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mywebsite.nl/employees/health/entrypage&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="4775" LastEditorUserId="9" LastEditDate="2016-04-06T19:21:04.977" LastActivityDate="2016-04-07T20:09:19.433" Title="Including two category slugs in entries’ URLs" Tags="&lt;entries&gt;&lt;categories&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14543" PostTypeId="2" ParentId="14537" CreationDate="2016-04-06T15:04:16.723" Score="1" Body="&lt;p&gt;I could be not following correctly, so I apologize if I'm way off here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to grab &lt;em&gt;all&lt;/em&gt; entries that are selected in your &lt;code&gt;block&lt;/code&gt; field, but only want to single out the first one, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Program Points&amp;lt;/h2&amp;gt;&#xA;{% for entry in craft.entries.section('program_point') %}&#xA;    {% if loop.first %}&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot; rel=&quot;nofollow&quot;&gt;twig for loop&lt;/a&gt; has some pretty cool stuff built in that you could leverage to check for the first entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-04-06T15:04:16.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14544" PostTypeId="1" AcceptedAnswerId="14545" CreationDate="2016-04-06T15:53:55.013" Score="1" ViewCount="58" Body="&lt;p&gt;I have and array of with &lt;code&gt;allEntries&lt;/code&gt; and an array with &lt;code&gt;alreadyUpdatedEntries&lt;/code&gt;. I would like to filter out all the &lt;code&gt;alreadyUpdatedToEntries&lt;/code&gt; to end up with an array of &lt;code&gt;notUpdatedEntries&lt;/code&gt;. Like how it is done in Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notUpdatedEntries = allEntries|without(alreadyUpdatedEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a similar Craft PHP method to do this in my plugin? Can I maybe include this in my elements criteria query?&lt;/p&gt;&#xA;" OwnerUserId="4901" LastEditorUserId="57" LastEditDate="2016-04-06T17:17:42.823" LastActivityDate="2016-04-06T18:28:19.927" Title="How to apply a &quot;without&quot; filter in a plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14545" PostTypeId="2" ParentId="14544" CreationDate="2016-04-06T17:16:57.353" Score="0" Body="&lt;p&gt;You can use similar logic that Craft uses for the &lt;a href=&quot;https://craftcms.com/classreference/etc/templating/twigextensions/CraftTwigExtension#withoutFilter-detail&quot; rel=&quot;nofollow&quot;&gt;withoutFilter&lt;/a&gt; in &lt;a href=&quot;https://craftcms.com/classreference/etc/templating/twigextensions/CraftTwigExtension&quot; rel=&quot;nofollow&quot;&gt;CraftTwigExtension&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function withoutFilter($arr, $exclude)&#xA;{&#xA;    $filteredArray = array();&#xA;&#xA;    if (!is_array($exclude))&#xA;    {&#xA;        $exclude = array($exclude);&#xA;    }&#xA;&#xA;    foreach ($arr as $key =&amp;gt; $value)&#xA;    {&#xA;        if (!in_array($value, $exclude))&#xA;        {&#xA;            $filteredArray[$key] = $value;&#xA;        }&#xA;    }&#xA;&#xA;    return $filteredArray;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="1016" LastEditDate="2016-04-06T18:28:19.927" LastActivityDate="2016-04-06T18:28:19.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14546" PostTypeId="1" AcceptedAnswerId="14608" CreationDate="2016-04-06T18:42:35.690" Score="3" ViewCount="790" Body="&lt;p&gt;I have a channel called &quot;offers&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Offers channel contains a field called &quot;Users&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Users field is the &quot;users&quot; field type. It allows me to select 1 or more users that the Offer is for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get JSON output for this data based on the &quot;Users&quot; name. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'users/&amp;lt;username:{handle}&amp;gt;/offers.json' =&amp;gt; function($username) {&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['section' =&amp;gt; 'specialOffers', 'relatedTo' =&amp;gt; $username],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'category' =&amp;gt; $entry-&amp;gt;category-&amp;gt;label,&#xA;&#xA;                ];&#xA;              },&#xA;            ];&#xA;        },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2016-04-11T14:06:35.777" Title="How do I query data using the Element API Plugin based on a custom field?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14547" PostTypeId="2" ParentId="14542" CreationDate="2016-04-06T19:17:02.003" Score="4" Body="&lt;p&gt;Set your section’s Entry URL Format to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{mySection.first.slug}/{myCategory.first.slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mySection.first&lt;/code&gt; and &lt;code&gt;myCategory.first&lt;/code&gt; will give you the first-selected category within those respective fields. Adding &lt;code&gt;.slug&lt;/code&gt; after that will give you the slug of those categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If either of those category groups can have nested categories, you may want to change &lt;code&gt;.first&lt;/code&gt; to &lt;code&gt;.last&lt;/code&gt;, so the last-selected category’s slug makes it into the URL rather than the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category URLs&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like to make category URLs like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mywebsite.nl/employees/health&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you will need to create a new Route in Settings → Routes, with the following URL pattern:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h2KrX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h2KrX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and point the route to whatever template you want to load when these URLs are matched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from your template, you can fetch the actual category models like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mySection = craft.categories({&#xA;    group: 'mySection',&#xA;    slug: matches[1]&#xA;}).first() %}&#xA;&#xA;{% set myCategory = craft.categories({&#xA;    group: 'myCategory',&#xA;    slug: matches[2]&#xA;}).first() %}&#xA;&#xA;{# Make sure the URL contained valid slugs #}&#xA;{% if not mySection or not myCategory) %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you can do whatever you want with them. For example, you can display every entry that is related to both of them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    relatedTo: ['and', {targetElement: mySection}, {targetElement: myCategory}]&#xA;}) %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can repeat all of those steps to do a similar thing for URLs that just have one category in them as well (just omit the second route token, and ignore all the &lt;code&gt;myCategory&lt;/code&gt; stuff in the example code).&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-04-07T20:09:19.433" LastActivityDate="2016-04-07T20:09:19.433" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14548" PostTypeId="2" ParentId="13886" CreationDate="2016-04-06T19:22:56.187" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; v2.3.0 added support for S3 Asset uploads and file attachments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OUTDATED: As of this post, Sprout Forms does not yet support email attachments using S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, it is possible to override the &lt;code&gt;email.html&lt;/code&gt; notification template using &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow&quot;&gt;Template Overrides&lt;/a&gt; and link to or display S3 assets in the way you would provide a link to any asset:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ asset.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-05-26T23:44:01.643" LastActivityDate="2016-05-26T23:44:01.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14549" PostTypeId="1" AcceptedAnswerId="14551" CreationDate="2016-04-06T21:27:50.160" Score="1" ViewCount="586" Body="&lt;p&gt;There is a set of entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each entry has a custom field &lt;code&gt;customUserField&lt;/code&gt;.  &lt;code&gt;customUserField&lt;/code&gt; this is a field Users. How do you fetch entries where &lt;code&gt;customUserField&lt;/code&gt; === &lt;code&gt;currentUser&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="125" LastEditDate="2016-04-07T06:18:10.893" LastActivityDate="2016-04-07T06:18:10.893" Title="Get entries by custom Users field value" Tags="&lt;users&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14550" PostTypeId="1" AcceptedAnswerId="14553" CreationDate="2016-04-06T21:30:49.020" Score="1" ViewCount="230" Body="&lt;p&gt;The &lt;code&gt;php.ini&lt;/code&gt; file has an option called &lt;code&gt;disable_functions&lt;/code&gt;. You can add unsafe functions to it so that they cannot be run. Does anyone have any guidelines for a good setup with Craft for this. I realize that this is somewhat sort of subjective, but I'm sure there are some features that could without a doubt be turned off that Craft will never use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OWASP suggests the below settings. Any thoughts on this?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;disable_functions = &quot;system, exec, shell_exec, passthru, phpinfo, show_source, popen, proc_open, fopen_with_path, dbmopen, dbase_open, putenv, move_uploaded_file, chdir, mkdir, rmdir, chmod, rename, filepro, filepro_rowcount, filepro_retrieve, posix_mkfifo&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4605" LastEditorUserId="45" LastEditDate="2016-08-13T02:35:49.790" LastActivityDate="2016-08-13T02:35:49.790" Title="Disabling unused PHP functions and Craft" Tags="&lt;php&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14551" PostTypeId="2" ParentId="14549" CreationDate="2016-04-07T00:17:56.827" Score="3" Body="&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').relatedTo({&#xA;    targetElement: currentUser,&#xA;    field: 'customUserField'&#xA;}).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on the relatedTo method here: &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-07T00:17:56.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14552" PostTypeId="2" ParentId="14550" CreationDate="2016-04-07T00:25:04.377" Score="3" Body="&lt;p&gt;I'm not aware of a definitive list, but Craft have problems running with some of the methods in your list disabled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phpinfo, move_uploaded_file, chdir, mkdir, rmdir, chmod, rename&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any plugins you have installed might have additional function requirements as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-07T03:49:36.460" LastActivityDate="2016-04-07T03:49:36.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14553" PostTypeId="2" ParentId="14550" CreationDate="2016-04-07T00:30:44.580" Score="3" Body="&lt;p&gt;I don't claim to be a security expert, but I have ran a server for a number of years.  Keep in mind that whatever you do, running a public a server on the Internet is always going to put you at some risk, known security issue or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're already making daily filesystem and mysql backups, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a cursory inspection of that list of functions, you're going to run into problems when Craft uses the filesystem, for example uploading assets, renaming files, etc. You should probably leave out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;move_uploaded_file, chdir, mkdir, rmdir, chmod, rename&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intention there a malicious attacker can't upload a file, move or rename it, and then execute it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft already does an adequate job of filtering out nasty files so they don't get uploaded. If you want to go further, I'd recommend disallowing PHP to actually &lt;a href=&quot;https://security.stackexchange.com/a/80342&quot;&gt;run code&lt;/a&gt; in any of your asset upload directories since those are probably going to be above the web root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just did a &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/search?utf8=%E2%9C%93&amp;amp;q=shell_exec&amp;amp;type=Code&quot; rel=&quot;nofollow noreferrer&quot;&gt;search&lt;/a&gt; of the rest of the functions; &lt;code&gt;phpinfo&lt;/code&gt; is used also used the control panel. I don't think that &lt;a href=&quot;https://stackoverflow.com/a/3196153/4965912&quot;&gt;poses as much of a threat&lt;/a&gt;. Even if an attacker knows some file system paths, if it he can't write to them, he's DOA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also a fan of &lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.open-basedir%60%60&quot; rel=&quot;nofollow noreferrer&quot;&gt;open_basedir&lt;/a&gt;. It's a cheap form of &quot;jailing&quot; the web application inside a specific root. I run PHP-FPM which you can setup per pool, per user to make things a little more secure as well. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-04-07T00:30:44.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14554" PostTypeId="1" CreationDate="2016-04-07T03:24:38.877" Score="0" ViewCount="802" Body="&lt;p&gt;I want to get only entries with a specific date. I created a date field &lt;code&gt;customDateField&lt;/code&gt;. It has the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('orders').customDateField('2016-04-14') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this not work. How it will look in php?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In element api plugin i was code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'orders.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'orders',&#xA;            'date' =&amp;gt; '&amp;gt;='.craft()-&amp;gt;request-&amp;gt;getPost('date')&#xA;        ],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'id' =&amp;gt; $entry-&amp;gt;id,&#xA;            ];&#xA;        },&#xA;    ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it only shows a larger date of entries, need to write &lt;code&gt;'date-&amp;gt;format(&quot;Y-m-d&quot;)'&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2016-04-07T15:58:27.570" LastActivityDate="2016-04-07T15:58:27.570" Title="Criteria entries by date field" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;datetime&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14555" PostTypeId="2" ParentId="14554" CreationDate="2016-04-07T06:33:28.147" Score="1" Body="&lt;p&gt;You don't need any extra php code to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search function probably does the job for you.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('orders').search('2016-04-14') %}&#xA;{% for entry in entries %}&#xA;  &amp;lt;h1&amp;gt;{{entry.title}} - {{entry.customDateField}}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="4603" LastEditDate="2016-04-07T08:49:11.117" LastActivityDate="2016-04-07T08:49:11.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14556" PostTypeId="1" CreationDate="2016-04-07T08:58:16.103" Score="5" ViewCount="29610" Body="&lt;p&gt;Done some searching on this but can't quite find what I'm looking for. Most threads are regarding keys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know if there is a way to test if a value exists in a twig array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be able to check whether the value is a variable, object or an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if value not in array %}&#xA;    .... do someting&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions welcome.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-04-07T09:42:11.383" Title="Is there a way to check if a value exists in an array in twig?" Tags="&lt;templating&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14557" PostTypeId="1" AcceptedAnswerId="14558" CreationDate="2016-04-07T09:10:55.843" Score="1" ViewCount="278" Body="&lt;p&gt;Let’s say i have a location channel, a studio and a team channel. A location contains one or several studios and a studio contains one or several teams.&#xA;I can display all the teams in a location by looping through all the studios related to the location and then through all the teams related to the studio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it somehow possible to do that in one loop?  To only loop through all the teams related to the location ( which aren’t related directly to each other)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;location/_entry.html :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set studios = craft.entries.section('studio').relatedTo(entry) %}&#xA;&#xA;{% block content %}&#xA;  &amp;lt;article&amp;gt;&#xA;    &amp;lt;h2&amp;gt;Studios in {{entry.title}}&amp;lt;/h2&amp;gt;&#xA;    {% for studio in studios %}&#xA;      &amp;lt;h3&amp;gt;{{studio.title}}&amp;lt;/h3&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;h2&amp;gt;All teams in {{entry.title}}&amp;lt;/h2&amp;gt;&#xA;      {% for studio in studios %}&#xA;      {% for team in craft.entries.section('team').relatedTo(studio) %}&#xA;        &amp;lt;h3&amp;gt;{{team.title}}&amp;lt;/h3&amp;gt;&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;  &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-04-07T09:26:30.357" Title="Prettiest way to loop through nested relations?" Tags="&lt;templating&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14558" PostTypeId="2" ParentId="14557" CreationDate="2016-04-07T09:26:30.357" Score="4" Body="&lt;p&gt;Would this work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teams = craft.entries.section('team').relatedTo(studios) %}&#xA;&#xA;&amp;lt;h2&amp;gt;All teams in {{entry.title}}&amp;lt;/h2&amp;gt;&#xA;{% for team in teams %}&#xA;    &amp;lt;h3&amp;gt;{{team.title}}&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-04-07T09:26:30.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14559" PostTypeId="2" ParentId="14556" CreationDate="2016-04-07T09:42:11.383" Score="8" Body="&lt;p&gt;Like you said, to test if a value exists in a Twig array you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myValue in ['apples', 'oranges'] %}&#xA;    {# do something... #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To check whether the value is an array or object you could use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tests/iterable.html&quot; rel=&quot;noreferrer&quot;&gt;iterable&lt;/a&gt; test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if myValue is iterable %}&#xA;    {# myValue is an array or object #}&#xA;{% else %}&#xA;    {# myValue is probably a string #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To be certain, you might be best coming out of Twig using a plugin &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;Template Variable&lt;/a&gt; and doing it directly in PHP.&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-04-07T09:42:11.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14560" PostTypeId="1" AcceptedAnswerId="14563" CreationDate="2016-04-07T10:05:47.317" Score="1" ViewCount="106" Body="&lt;p&gt;I have a channel which has a relate to user field, how do I setup the front-end form which is a user details update form so they can select a channel entry from a drop down and when saved, have it relate that user to the channel entry.&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="45" LastEditDate="2016-08-13T02:37:02.793" LastActivityDate="2016-08-13T02:37:02.793" Title="How do I relate a user to a channel entry from a form?" Tags="&lt;form&gt;&lt;user-profile&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14561" PostTypeId="1" AcceptedAnswerId="14564" CreationDate="2016-04-07T10:16:00.683" Score="5" ViewCount="784" Body="&lt;p&gt;My question is the opposite of this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1485/installing-craft-in-sub-directory&quot;&gt;Installing Craft in sub directory&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Craft website and I need to put a Laravel application in a sub directory, it almost works. I have made the directory and created a symbolic link to the public folder for the Laravel application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works with the default route in Laravel but as soon as I try any nested routes I just get a Craft 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is is possible to get Craft to completely ignore a folder or something, or do I need to figure out an alternative solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-07T18:21:46.673" Title="Installing other PHP app in sub directory" Tags="&lt;server&gt;&lt;routing&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14562" PostTypeId="2" ParentId="14554" CreationDate="2016-04-07T10:32:07.517" Score="1" Body="&lt;p&gt;I wonder if you're getting caught out by querying a specific time of day. I think if you don't include the time it would presume '00:00'. What you want is to find any entries with the &lt;code&gt;customDateField&lt;/code&gt; value between midnight and 23:59.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myDateString = '2016-04-01' %}&#xA;{% set myDateStart = myDateString | date_modify('00:00') | date('Y-m-d H:i') %}&#xA;{% set myDateEnd = myDateString | date_modify('23:59')  | date('Y-m-d H:i') %}&#xA;&#xA;{% set entries = craft.entries.section('orders').customDateField('and', '&amp;gt;= ' ~ myDateStart, '&amp;lt;= ' ~ myDateEnd) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-04-07T10:32:07.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14563" PostTypeId="2" ParentId="14560" CreationDate="2016-04-07T12:51:09.030" Score="4" Body="&lt;p&gt;When saving an entry field type as part of your plug-in it needs to be an array of IDs in order to work correctly. This can either be handled via a plug-in or in the form by passing the value as an array to that field handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plug-in:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user-&amp;gt;setContentFromPost(array(&#xA;    'entryField' =&amp;gt; array(10)&#xA;));&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Front-end form:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[relatedEntry][]&quot; value=&quot;{{entry.id}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="9" LastEditDate="2016-04-07T14:05:03.793" LastActivityDate="2016-04-07T14:05:03.793" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14564" PostTypeId="2" ParentId="14561" CreationDate="2016-04-07T14:01:58.327" Score="5" Body="&lt;p&gt;Yes, possible. You just need to override the URL routing within the subdirectory, so requests to /sub/* get routed to /sub/index.php rather than /index.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you’re using Apache, just place Laravel’s &lt;a href=&quot;https://laravel.com/docs/4.2#pretty-urls&quot; rel=&quot;noreferrer&quot;&gt;.htaccess file&lt;/a&gt; within your subdirectory.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-07T14:01:58.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14565" PostTypeId="1" AcceptedAnswerId="14567" CreationDate="2016-04-07T15:50:00.643" Score="0" ViewCount="70" Body="&lt;p&gt;I am trying to store an entry in a plugin. The entry has a field 'tags' that relates to another entry. I am trying to store it with the following code.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newsItem = new EntryModel();&#xA;$newsItem-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('news')-&amp;gt;id;&#xA;$newsItem-&amp;gt;getContent()-&amp;gt;tags = $tag-&amp;gt;id;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($newsItem);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I &lt;code&gt;var_dump(craft()-&amp;gt;entries-&amp;gt;saveEntry($newsItem))&lt;/code&gt; I get a &lt;code&gt;false&lt;/code&gt; response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in this situation we cannot use the method &lt;code&gt;setContentFromPost()&lt;/code&gt; so we need to do it from within the plugin and not from a front-end form.&lt;/p&gt;&#xA;" OwnerUserId="4901" LastEditorUserId="57" LastEditDate="2016-04-07T18:33:10.243" LastActivityDate="2016-04-07T18:35:13.383" Title="Issue with storing an Entry" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14566" PostTypeId="1" AcceptedAnswerId="14742" CreationDate="2016-04-07T16:01:42.290" Score="1" ViewCount="569" Body="&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'news',&#xA;    'date' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('date')&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to make that worked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'news',&#xA;    'date-&amp;gt;format(&quot;Y-m-d&quot;)' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('date')&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2016-04-07T18:23:55.660" LastActivityDate="2016-04-20T23:27:34.400" Title="Format keys in Element API plugin" Tags="&lt;datetime&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14567" PostTypeId="2" ParentId="14565" CreationDate="2016-04-07T17:23:21.440" Score="3" Body="&lt;p&gt;Not sure if there is more to your code or not but looks like you need to set the &lt;code&gt;title&lt;/code&gt; as well as other required fields. In addition the entries field is expecting an array of &lt;code&gt;entryId&lt;/code&gt;s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a link to the saveEntry method in the EntriesService, which shows the required fields:&#xA;&lt;a href=&quot;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer is somewhat similar in that they are relating an entry, but you can see that the &lt;code&gt;entryField&lt;/code&gt; is being set with an &lt;code&gt;array&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14560/how-do-i-relate-a-user-to-a-channel-entry-from-a-form/14563#14563&quot;&gt;How do I relate a user to a channel entry from a form?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-07T18:04:01.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14568" PostTypeId="1" AcceptedAnswerId="33069" CreationDate="2016-04-07T17:43:59.277" Score="1" ViewCount="221" Body="&lt;p&gt;We run all our images through a CDN to perform various manipulations. This works create for any image managed via assets, but I'm a bit stuck on any image that has a cpresources URL. In particular I'm running into this issue with profile photos which have a URL much like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, I just need to change the URL to something like &lt;a href=&quot;http://cdn.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cdn.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image will then get downloaded from the www.mydomain.com host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did run into this issue with assets too tonight, where there was an issue with an image that didn't get moved into it's final destination, and ended up living in the temp folder, with a cpresources URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to change this URL?&lt;/p&gt;&#xA;" OwnerUserId="117" LastEditorUserId="117" LastEditDate="2019-11-20T02:26:11.897" LastActivityDate="2019-11-20T02:26:11.897" Title="Change public URL for user photos" Tags="&lt;assets&gt;&lt;config&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14569" PostTypeId="2" ParentId="14566" CreationDate="2016-04-07T18:30:09.617" Score="2" Body="&lt;p&gt;Something like this should work just for selecting a &quot;day&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'news',&#xA;    'customDateFieldHandle' =&amp;gt; ['and', '&amp;gt;='.DateTime::createFromString(craft()-&amp;gt;request-&amp;gt;getPost('date'))-&amp;gt;format(&quot;Y-m-d&quot;).' 00:00:00', '&amp;lt;='.$DateTime::createFromString(craft()-&amp;gt;request-&amp;gt;getPost('date'))-&amp;gt;format(&quot;Y-m-d&quot;).' 23:59:59')];&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-08T18:01:52.063" LastActivityDate="2016-04-08T18:01:52.063" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14570" PostTypeId="2" ParentId="14565" CreationDate="2016-04-07T18:35:13.383" Score="1" Body="&lt;p&gt;Along the same train of thought as &lt;a href=&quot;https://craftcms.stackexchange.com/a/14567/57&quot;&gt;mcclaskiem's&lt;/a&gt; answer, you're likely getting a validation error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check &lt;code&gt;$newsItem-&amp;gt;getErrors()&lt;/code&gt; after you call &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry($newsItem);&lt;/code&gt;, you can see which attributes are failing validation and why.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-04-07T18:35:13.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14571" PostTypeId="1" AcceptedAnswerId="14572" CreationDate="2016-04-07T19:31:19.057" Score="4" ViewCount="972" Body="&lt;p&gt;I am trying to eager load users in a specific group to reduce queries. I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% set designers = craft.users({&#xA;                    group: 'designers',&#xA;                    with: [&#xA;                            'userAgencyName',&#xA;                            'userAgencyUrl',&#xA;                            'userFreelancerAgency',&#xA;                            'userDescriptionServices',&#xA;                            'userBudget',&#xA;                            'userCity',&#xA;                            'userStateProvince'&#xA;                            ]&#xA;                }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The loop is setup like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% paginate designers.limit(7) as designers %}&#xA;&#xA;    {# Loop through Designers #}&#xA;    {% for designer in designers %} &#xA;&#xA;    &amp;lt;div class=&quot;listing-box&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;/designers/{{ designer.username }}&quot;&amp;gt;{{ designer.userAgencyName }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;listing-links&quot;&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&#xA;                {% for category in designer.userFreelancerAgency %}&#xA;                &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt; {{ category }}&amp;lt;/a&amp;gt;&#xA;                {% endfor %}    &#xA;                &amp;lt;/li&amp;gt;&#xA;                {% for category in designer.userBudget %}&#xA;                {% if category %}&#xA;                &amp;lt;li&amp;gt;                    &#xA;                Budgets: &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category }}&amp;lt;/a&amp;gt;                    &#xA;                &amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;                {% endfor %}&#xA;                {% if designer.userCity | length %}     &#xA;                &amp;lt;li&amp;gt;{{ designer.userCity }}, {{ designer.userStateProvince }}&amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;  &#xA;        &amp;lt;p&amp;gt;{% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %} &#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!--End listing-box--&amp;gt;  &#xA;   {% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help you can give!    &lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2016-04-07T20:12:03.363" Title="Eager Loading Users Returning &quot;Array to String Conversion&quot; Error" Tags="&lt;users&gt;&lt;user-groups&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14572" PostTypeId="2" ParentId="14571" CreationDate="2016-04-07T19:54:13.637" Score="5" Body="&lt;p&gt;Just checked eager-loading a text field in a template and by eager-loading it you are actually converting the field to an array and therefore unable to template it as usual. Eager-loading is generally only useful on fields like categories, assets, and matrixes.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2016-04-07T20:12:03.363" LastActivityDate="2016-04-07T20:12:03.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14573" PostTypeId="1" CreationDate="2016-04-07T20:28:36.637" Score="2" ViewCount="826" Body="&lt;p&gt;I am trying to create a page I can hit to update a record in the db, something I am used to doing in Laravel, but now have to do in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller method would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function updateUserRecordsTest($userId) {&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;    // $data['status'] = 'asleep';&#xA;    // $user-&amp;gt;update($data);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I am trying to make a route in &lt;code&gt;craft/config/routes.php&lt;/code&gt; like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; route =&amp;gt; user/update/{id} , controller =&amp;gt; UsersController@updateUserRecordsTest;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to set this route up in Craft would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Update&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I will try to clear up what I am trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to update the users db when they pass classes.  This will most likely be a boolean, but may end up being an enum.  So what I would usually set up is a page with a controller method like below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // sudo code&#xA;&#xA; public function passedThisClass($id) {&#xA;    $user = User::find($id);&#xA;    $data['passed'] = 1&#xA;    User::update($data);&#xA; });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the route would look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // sudo code&#xA; route::get('updatethisclass/{id} =&amp;gt; UsersController@updateThisClass);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I hit that page it updates the value from 0 to 1 flagging that they passed the class.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="45" LastEditDate="2016-08-13T02:35:36.913" LastActivityDate="2017-10-29T14:06:18.383" Title="How do I create an advanced route with an ID that hits a controller method" Tags="&lt;routes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14574" PostTypeId="1" AcceptedAnswerId="14575" CreationDate="2016-04-07T20:32:12.127" Score="1" ViewCount="415" Body="&lt;p&gt;I have a channel with a related users field. I want to output all channel entries ordered by the number of related users, this is what i have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;    set entries = craft.entries.find({&#xA;        section:  'MyChannel',&#xA;        orderBy:  'relatedUsers'&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do i do to order by the number of related users?&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="45" LastEditDate="2016-08-13T02:41:49.007" LastActivityDate="2016-08-13T02:41:49.007" Title="Order by related entries count" Tags="&lt;entries&gt;&lt;relations&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14575" PostTypeId="2" ParentId="14574" CreationDate="2016-04-08T00:11:15.430" Score="1" Body="&lt;p&gt;Any native solution is likely to be slow - I would recommend using the Preparse field plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It lets you use Twig to dynamically generate a field at the time an entry is saved — you could have Preparse count up the number of related users on save, and then sort by that custom field.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-08T00:11:15.430" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14576" PostTypeId="2" ParentId="14573" CreationDate="2016-04-08T01:14:53.923" Score="1" Body="&lt;p&gt;In your plugin's main class file you'd set the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow&quot;&gt;registerCpRoutes&lt;/a&gt; method to something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'user/update/(?P&amp;lt;userId&amp;gt;\d+)' =&amp;gt; array('action' =&amp;gt; 'pluginHandleController/updateUserRecordsTest'&#xA;        ),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The the method in your plugin's &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;controller&lt;/a&gt; would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpdateUserRecordsTest(array $variables = array())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And &lt;code&gt;$variables&lt;/code&gt; will be a collection of all of the named regex patterns captured in your route definition.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-08T01:14:53.923" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14577" PostTypeId="2" ParentId="14474" CreationDate="2016-04-08T03:12:55.927" Score="0" Body="&lt;p&gt;If you want to add a default to an existing column in a table in a migration, you'd do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;alterColumn('tableName', 'columnName', array('column' =&amp;gt; ColumnType::Number, 'default' =&amp;gt; 0));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to add a default to a new column in a table in a migration, you'd do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;addColumn('tableName', 'columnName', array('column' =&amp;gt; ColumnType::Number, 'default' =&amp;gt; 0));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-08T03:12:55.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14578" PostTypeId="1" AcceptedAnswerId="14580" CreationDate="2016-04-08T05:55:06.663" Score="1" ViewCount="158" Body="&lt;p&gt;I have a rich text field, e.g. for defining an image caption. Now in my template I would like to prepend some text to the content of the rich text field, e.g. &lt;em&gt;Figure 1:&lt;/em&gt; [rich text]. Is this possible? The content of the paragraph-tag of the rich text field should include the prepended text.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-04-08T09:52:27.220" Title="How to append / prepend into a rich text field" Tags="&lt;templating&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14579" PostTypeId="1" CreationDate="2016-04-08T07:07:04.773" Score="2" ViewCount="170" Body="&lt;p&gt;I think that I need to set up a few routes to handle my category based RSS feeds. I have a current url structure as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://something.com/shows/wmr/marketing pr&#xA;&#xA;http://something.com/categoryGroup/parentCategory/childCategory&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need rss feeds from both the parent and child categories&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://something.com/categoryGroup/parentCategory/feed&#xA;http://something.com/categoryGroup/parentCategory/childCategory/feed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rss template i am using is stored in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;categories/_shows.rss&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have munged something together in the cp routes settings but I would prefer to have this in routes.php. Having access to the parentCategory and childCategory values without doing a segments thing would be nice.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-08T20:58:46.357" Title="Setting up Route for Category-based RSS Feeds" Tags="&lt;categories&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14580" PostTypeId="2" ParentId="14578" CreationDate="2016-04-08T09:52:27.220" Score="3" Body="&lt;p&gt;If you want to prepend another paragraph you could to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paragraphs = entry.body|split('&amp;lt;/p&amp;gt;') %}&#xA;{% for paragraph in paragraphs %}&#xA;  {% if loop.index == 1%}&#xA;    &amp;lt;p&amp;gt;Prepended Custom Text&amp;lt;/p&amp;gt;&#xA;  {% endif %}&#xA;    {{paragraph|raw}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to display a custom string in the first paragraph itself you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paragraphs = entry.body|split('&amp;lt;/p&amp;gt;') %}&#xA;{% for paragraph in paragraphs %}&#xA;  {% if loop.index == 1%}&#xA;    {% set paragraph = paragraph|replace({'&amp;lt;p&amp;gt;': '&amp;lt;p&amp;gt;My custom prepended Text '}) %}&#xA;  {% endif %}&#xA;    {{paragraph|raw}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This looks a little bit hacky tough there are probably prettier ways to do so.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2016-04-08T09:52:27.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14581" PostTypeId="1" CreationDate="2016-04-08T10:34:49.707" Score="1" ViewCount="331" Body="&lt;p&gt;I am trying to save a entry with the Guest Entries plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry has a custom field 'office' thats set to 'entry' a relation to section 'offices'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;fieldset class=&quot;form-fieldset row-spacing-2&quot;&amp;gt;&#xA;    &amp;lt;select class=&quot;form-input form-select&quot; name=&quot;fields[office][]&quot;&amp;gt;&#xA;        &amp;lt;option&amp;gt;Select office&amp;lt;/option&amp;gt;&#xA;        {% for office in craft.entries.section('offices') %}&#xA;            &amp;lt;option value=&quot;{{ office.id }}&quot;&amp;gt;{{ office.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}    &#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field is set to required in the CP. When I save it with the field set it works, but when empty it throws this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can this error be caught or am i doing something wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4077" LastEditorUserId="57" LastEditDate="2016-04-08T17:41:33.240" LastActivityDate="2016-10-12T11:56:24.343" Title="Empty relation field validation failed with Guest Entries plugin" Tags="&lt;relations&gt;&lt;form&gt;&lt;plugin-guestentries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14582" PostTypeId="2" ParentId="14581" CreationDate="2016-04-08T11:03:22.827" Score="2" Body="&lt;p&gt;It looks like it's doing what it should. When you set a field to 'required', you are basically telling the system to not let the entry be saved if you haven't filled out the field you've set 'required' on. That's what this error saying (albeit at a database level). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two quick solutions as I see it...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Always make sure you have a default value that can be used for this&#xA;field. So you aren't violating the 'required' setting.&lt;/li&gt;&#xA;&lt;li&gt;Remove the 'required' option from the field in the CP.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;EDIT: In the Plugin settings in the CP, have you turned on the &lt;code&gt;Validate Entry&lt;/code&gt; lightswitch for the section you are adding to on the front end? Only I've just had a quick play around with the plugin myself, and I get a validation error when I don't submit an entryId for the related section on the front end form. So it looks as though it's working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used this to get the errors...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%for error in guestEntry.getAllErrors %}&#xA;    {{ error }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also just used the default config file &lt;code&gt;guestEntries.php&lt;/code&gt; as suggested in the README...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'entryVariable' =&amp;gt; 'guestEntry',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-04-08T13:09:41.367" LastActivityDate="2016-04-08T13:09:41.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14584" PostTypeId="1" AcceptedAnswerId="14585" CreationDate="2016-04-08T15:56:17.223" Score="1" ViewCount="842" Body="&lt;p&gt;I have a layout in Craft with twig that gets the first 3 entries and applies them to the first three containers in the grid.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to loop through the remaining entries to add to the &lt;code&gt;grid-remaining&lt;/code&gt; div.  With the current code it will repeat entries 1-3 in the grid-remaining div.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEntry = craft.entries.section('shows').first() %}&#xA;{% set secondEntry = craft.entries.section('shows').nth(2) %}&#xA;{% set thirdEntry = craft.entries.section('shows').nth(3) %}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;card-grid card-grid__two-thirds&quot;&amp;gt;&#xA;            {% include &quot;_partials/card&quot; with { entry: firstEntry } %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;card-grid card-grid__one-third&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;AD&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;card-grid card-grid__one-half&quot;&amp;gt;&#xA;            {% include &quot;_partials/card&quot; with { entry: secondEntry } %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;card-grid card-grid__one-half&quot;&amp;gt;&#xA;            {% include &quot;_partials/card&quot; with { entry: thirdEntry } %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row grid-remaining&quot;&amp;gt;&#xA;        {% for entry in craft.entries.section('shows') %}&#xA;        &amp;lt;div class=&quot;card-grid card-grid__one-third&quot;&amp;gt;&#xA;            {% include &quot;_partials/card&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works, but I feel like there must be a cleaner way to achieve the same result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row grid-remaining&quot;&amp;gt;&#xA;    {% for entry in craft.entries.section('shows') %}&#xA;    {% if loop.index != 1 and loop.index != 2 and loop.index != 3 %}&#xA;    &amp;lt;div class=&quot;card-grid card-grid__one-third&quot;&amp;gt;&#xA;        {% include &quot;_partials/card&quot; %}&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="45" LastEditDate="2016-08-13T02:40:08.840" LastActivityDate="2016-08-13T02:40:08.840" Title="Loop through remaining craft.entries" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14585" PostTypeId="2" ParentId="14584" CreationDate="2016-04-08T16:14:31.617" Score="2" Body="&lt;p&gt;I think you can just add &lt;code&gt;.offset(3)&lt;/code&gt; to the &quot;remaining&quot; craft.entries query to get the result that you want. Or you could exclude the id's of the first three.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, this is quite ineffective (performance wise), since you're doing four separate queries to get the entries. An alternative would be to loop over all, and use the &lt;code&gt;loop&lt;/code&gt; object together with conditionals to build the output. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('shows') %}&#xA;    {% if loop.index==1 %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card-grid card-grid__two-thirds&quot;&amp;gt;&#xA;                {% include &quot;_partials/card&quot; %}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;card-grid card-grid__one-third&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;AD&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% elseif loop.index==2 %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card-grid card-grid__two-thirds&quot;&amp;gt;&#xA;                {% include &quot;_partials/card&quot; %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;    {% elseif loop.index==3 %}&#xA;            &amp;lt;div class=&quot;card-grid card-grid__one-half&quot;&amp;gt;&#xA;                {% include &quot;_partials/card&quot; %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% elseif loop.index&amp;gt;3 %}&#xA;        {% if loop.index==4 %}&#xA;             &amp;lt;div class=&quot;row grid-remaining&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;card-grid card-grid__one-third&quot;&amp;gt;&#xA;                {% include &quot;_partials/card&quot; %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% if loop.index==loop.last %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-04-08T16:14:31.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14586" PostTypeId="1" AcceptedAnswerId="14595" CreationDate="2016-04-08T16:22:50.373" Score="2" ViewCount="235" Body="&lt;p&gt;I need to build a plug-in. Actually I've built &lt;em&gt;half&lt;/em&gt; of the plug-in already but I am questioning my approach. I wanted to get another point of view to see if I'm headed down the wrong path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my Craft control panel I want to be able to add a ZIP file to an entry or just into Assets directly. In an entry I can currently do this through an Assets field type. But I need to extend the functionality because I need to do some file validation on the zip file and then unzip it and then validate the contents of the unzipped content as well. Finally I then need to have the ability to reference the folder that contains the unzipped files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more concrete words, I want to be able to upload a zip file that contains an animated advertising banner. As an example, the zip file would be named &quot;acme_banner_300x250.zip&quot;. Uploading that file would check that the banner dimensions are stated in the filename (300x250) and that the contents of the ZIP include an &quot;index.html&quot; plus it must contain an image file with the word &quot;backupImage&quot; in the file name. If all those things are true, it would unzip the file and then delete the original ZIP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, when this asset is included in an entry, I want to be able to pick it from the asset list (where it shows the backupImage file from the zip as the thumbnail) and have it be able to report the proper height and width properties along with a 'url' property that points to the folder containing the index.html file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Side note: These are all files I've built myself so I am not worried about malicious content being included in the upload, although if there is a way to scan them for malicious content, that would be good with me.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;My current half-finished plug-in does the following:&lt;/em&gt; It will intercept an uploaded asset using the &quot;assets.onBeforeUploadAsset&quot; event listener and then unzip the file (if the extension is &quot;zip&quot;) in a location I can designate. I'm left with the original zip file in the Assets listing and I'm struggling with how to use the unzipped directory in my entry because that unzipped location isn't associated with the zip file listed in my assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to select whether this whole process happens or not. Right now, any ZIP file gets unzipped and I would prefer to be able to upload a ZIP file and have it remain a plain old ZIP file sometimes (i.e. when a client needs to get a ZIP of files from me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I going down the wrong path trying to work within Assets to build this functionality? It feels like I'm creating a new type of Assets rather than just working within the existing Assets available file types. &lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2019-09-12T02:20:18.047" Title="Custom upload plugin to unzip files" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14587" PostTypeId="1" CreationDate="2016-04-08T18:07:45.967" Score="2" ViewCount="295" Body="&lt;p&gt;I'm using the Venti events plugin to add recurring events to my site. However, I just want to show the most upcoming event and not all of them. This is a listing page which lists all of my events. This is what I currently have which lists all events.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = &#xA;  craft.venti.allEvents()&#xA;  .startDate('and', '&amp;gt;= ' ~ now)&#xA;  .limit(70)&#xA;  .relatedTo(categories)&#xA;  .order('startDate asc')&#xA;  .find() %}&#xA;&#xA;{% for event in events %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found this in their documentation that supposed to show the next event, but this was on a detail page, not a listing page, so not sure exactly how to do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set next = craft.venti.nextEvent(event.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2209" LastEditorUserId="57" LastEditDate="2016-04-08T18:08:43.190" LastActivityDate="2017-09-18T10:32:40.197" Title="Help with Venti Events Plugin" Tags="&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14588" PostTypeId="1" AcceptedAnswerId="14590" CreationDate="2016-04-08T19:24:33.117" Score="3" ViewCount="2250" Body="&lt;p&gt;Is it possible to loop through the list of entries and filter out any that have the same ID as any of the other entries (duplicates)? I have a specific case where this is an issue. I want to keep the first entry, but filter out the rest of them. I'm thinking it might work something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for event in events %}&#xA;    {% IF FIRST INSTANCE OF ENTRY %}&#xA;      {{ event.title }}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-04-09T06:31:55.410" Title="Check and remove repeat entries from loop" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14589" PostTypeId="2" ParentId="14579" CreationDate="2016-04-08T20:58:46.357" Score="1" Body="&lt;p&gt;Okay, I think that I have figured it out. Posting here for posterity. Based on the requirement above, I put these in my routes.php file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'shows\/(?P&amp;lt;parentSlug&amp;gt;[a-zA-Z0-9\-\.]+)\/(?P&amp;lt;childSlug&amp;gt;[a-zA-Z0-9\-\.]+)\/feed' =&amp;gt; 'categories/_shows.rss',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'shows\/(?P&amp;lt;parentSlug&amp;gt;[a-zA-Z0-9\-\.]+)\/feed' =&amp;gt; 'categories/_shows.rss',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me two variables. parentSlug and childSlug &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-08T20:58:46.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14590" PostTypeId="2" ParentId="14588" CreationDate="2016-04-08T23:46:09.513" Score="5" Body="&lt;p&gt;I'd probably try to filter those out in your initial query, but if you've already got them, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set existingIds = [] %}&#xA;&#xA;{% for event in events %}&#xA;    {% if event.id not in existingIds %}&#xA;        {{ event.title }}&#xA;&#xA;        {% set existingIds = existingIds|merge([event.id]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-09T06:31:55.410" LastActivityDate="2016-04-09T06:31:55.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14591" PostTypeId="2" ParentId="12348" CreationDate="2016-04-09T16:31:39.077" Score="0" Body="&lt;p&gt;I think you can do this by using the following hidden field in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;path/after_reset&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See this page for more details: &lt;a href=&quot;https://craftcms.com/docs/templating/set-password-form&quot; rel=&quot;nofollow&quot;&gt;Craft Set Password Form Template&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3834" LastActivityDate="2016-04-09T16:31:39.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14592" PostTypeId="1" CreationDate="2016-04-09T18:21:23.250" Score="1" ViewCount="911" Body="&lt;p&gt;When using the User Registration Form (&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;), how do I make it so the user is added to a predefined User Group?&lt;/p&gt;&#xA;" OwnerUserId="122" LastActivityDate="2016-04-10T20:19:34.180" Title="User registration form add user to User Group?" Tags="&lt;registration&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14593" PostTypeId="2" ParentId="14592" CreationDate="2016-04-09T19:37:06.513" Score="8" Body="&lt;p&gt;See the docs here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/users#public-registration&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/users#public-registration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Public Registration&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Craft Pro has the option of allowing public user registration. It is not enabled by default, though. To enable it, you must go to Settings → Users → Settings, and check the “Allow public registration?” setting. With that checked, you will also be given the ability to choose a default user group that publicly-registered users are assigned to.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="45" LastEditDate="2016-04-10T20:19:34.180" LastActivityDate="2016-04-10T20:19:34.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14594" PostTypeId="1" CreationDate="2016-04-10T11:15:43.697" Score="3" ViewCount="211" Body="&lt;p&gt;I currently have multiple sections like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for craft.entries.section('mySection').type('oneType')... %}&#xA;   ... {% endfor %}&#xA;{% for craft.entries.section('mySection').type('anotherType')... %}&#xA;   ... {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I would rather have a single loop like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for craft.entries.section('mySection').order('type, title')... %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the &lt;code&gt;type&lt;/code&gt; referred to in &lt;code&gt;order()&lt;/code&gt; will in the DB query refer to &lt;code&gt;craft_elements.type&lt;/code&gt; which in this case always will be &lt;code&gt;Entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to order by &lt;em&gt;entry type&lt;/em&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4966" LastActivityDate="2016-04-10T17:19:29.723" Title="How do I order by _entry type_ when looping through entries in a template?" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14595" PostTypeId="2" ParentId="14586" CreationDate="2016-04-10T12:18:08.483" Score="2" Body="&lt;p&gt;What you could do is to create a new asset source and a new asset field for the backupimage and a plain text field for the HTML (you can later convert this to an &lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft&quot; rel=&quot;nofollow&quot;&gt;Incognito field&lt;/a&gt;). Add those new fields to the ZIP files' field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After unzipping the bundle to a temp directory with you plugin, you can now check if the files meet your requirements. If everything's fine, create an asset file model from the backupimage using the &lt;code&gt;insertFileByLocalPath&lt;/code&gt; method and relate that asset to the ZIP asset by storing its ID to the ZIP's backupimage asset field. Now read the HTML file and store it into the ZIP's html plain text field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want to have a look at the source code of my &lt;a href=&quot;https://github.com/carlcs/craft-assetmetadata&quot; rel=&quot;nofollow&quot;&gt;Asset Metadata&lt;/a&gt; plugin, as I'm doing some quite similar things with the field type it provides.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-10T12:18:08.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14596" PostTypeId="2" ParentId="502" CreationDate="2016-04-10T14:35:28.917" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('{{ entry.topic }}').first() %}`enter code here`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For anyone else who stumbles on this post, I wasn't able to get the code working until I changed a few things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of categories.&lt;em&gt;slug&lt;/em&gt;, I used category.&lt;em&gt;group&lt;/em&gt; and made 'your category-slug' {{ entry.topic }}, topic being how I assign my &lt;em&gt;single&lt;/em&gt; category to entries.&lt;/p&gt;&#xA;" OwnerUserId="5002" LastActivityDate="2016-04-10T14:35:28.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14597" PostTypeId="2" ParentId="14594" CreationDate="2016-04-10T15:58:39.793" Score="1" Body="&lt;p&gt;Craft doesn't join the entrytypes table when you query for entries. You could order by &lt;code&gt;typeId&lt;/code&gt;, but that's probably not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunatelly there's an &lt;code&gt;elements.buildElementsQuery&lt;/code&gt; event, that allows to modify element queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.buildElementsQuery', function(Event $event) {&#xA;    $query = $event-&amp;gt;params['query'];&#xA;&#xA;    if (strpos($query-&amp;gt;order, 'entrytypes') !== false) {&#xA;        $query-&amp;gt;join('entrytypes entrytypes', 'entrytypes.id = entries.typeId');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add this code to the &lt;code&gt;init()&lt;/code&gt; method of your &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;business logic&lt;/a&gt; plugin and you can now order by your entry type handles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'mySection',&#xA;    order: 'entrytypes.handle desc, title asc',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-10T15:58:39.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14598" PostTypeId="2" ParentId="14594" CreationDate="2016-04-10T16:07:44.420" Score="2" Body="&lt;p&gt;You could use Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter for this, but you'll lose the ability to&#xA;use the &lt;code&gt;paginate&lt;/code&gt; tag to paginate your entries by doing so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mySection').order('title') %}&#xA;{% set entriesByType = entries|group('type') %}&#xA;&#xA;{% for type, entriesInType in entriesByType %}&#xA;    &amp;lt;h3&amp;gt;{{ type }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for entry in entriesInType %}&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-10T16:07:44.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14599" PostTypeId="1" AcceptedAnswerId="14600" CreationDate="2016-04-10T16:19:51.427" Score="2" ViewCount="525" Body="&lt;p&gt;Is there a helper tag to output a complete stylesheet link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used helper tag for lack of knowledge. Helper tag is used in Statamic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Statamic &lt;code&gt;{{ theme:css src=&quot;style&quot; tag=&quot;true&quot; }}&lt;/code&gt; outputs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/site/themes/redwood/css/style.css&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen &lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ siteUrl }}assets/css/happylager.css&quot;&amp;gt;&lt;/code&gt; in Happy Lager's template but I'm looking for something shorter.&lt;/p&gt;&#xA;" OwnerUserId="5004" LastEditorUserId="57" LastEditDate="2016-04-11T02:34:32.293" LastActivityDate="2016-04-11T02:34:32.293" Title="Shortest code to link to CSS and JS file" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14600" PostTypeId="2" ParentId="14599" CreationDate="2016-04-10T16:51:38.687" Score="2" Body="&lt;p&gt;In Craft there's &lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% includeJsFile %}&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/includecssfile&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% includeCssFile %}&lt;/code&gt;&lt;/a&gt; which get injected on the &lt;code&gt;getHeadHtml()&lt;/code&gt; and &lt;code&gt;getFootHtml()&lt;/code&gt; functions on your templates.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastEditorUserId="45" LastEditDate="2016-04-10T20:16:55.803" LastActivityDate="2016-04-10T20:16:55.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14601" PostTypeId="2" ParentId="14594" CreationDate="2016-04-10T17:19:29.723" Score="1" Body="&lt;p&gt;You could use my &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse Field plugin&lt;/a&gt;, which let's you run twig code when an entry is saved, and saves the result of the twig as plain text in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just wanted to sort alphabetically by entry type name, you could put something like this in your preparse field settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type | lower }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for craft.entries.section('mySection').order('myPreparseField, title')... %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, you could do more advanced logic if you want some custom order, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type=='type1' ? 1 : (entry.type=='type2' ? 2 : 3) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure you get rid of whitespace in the output, either by not adding any to your code (like above), or by using &lt;code&gt;{{ spaceless }}&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt; on tags.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-04-10T17:19:29.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14602" PostTypeId="1" AcceptedAnswerId="14603" CreationDate="2016-04-11T01:53:05.920" Score="1" ViewCount="799" Body="&lt;p&gt;I have a Matrix with a Super Table in many of its blocks that I'm trying to eager load, but I can't figure out the syntax (or if its possible). The Super Table field's handle is &lt;code&gt;columnSize&lt;/code&gt; and it contains two rows with dropdowns, &lt;code&gt;screenSize&lt;/code&gt; and &lt;code&gt;columnSize&lt;/code&gt;. My Matrix's handle is &lt;code&gt;contentBlocks&lt;/code&gt;. The template code is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.contentBlocks.with(&#xA;    [&#xA;        'text:columnSize', // Super Table field&#xA;        'image:columnSize', // Super Table field&#xA;        ['image:image', {&#xA;            withTransforms: [{width: 1600, width: 1024, width: 768}]&#xA;        }], // Asset field&#xA;        ...&#xA;    ]&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The syntax above works for every field I have except &lt;code&gt;columnSize&lt;/code&gt;, which returns empty in the template when loaded using this method. Are there additional parameters needed for Super Table similar to image transforms?&lt;/p&gt;&#xA;" OwnerUserId="93" LastActivityDate="2016-07-15T23:56:02.450" Title="Can I eager load Super Table fields in a Matrix block?" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-supertable&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14603" PostTypeId="2" ParentId="14602" CreationDate="2016-04-11T02:39:35.390" Score="1" Body="&lt;p&gt;Super Table doesn't yet support eager loading (its certainly high on the list). I'll keep you posted with progress, or feel free to submit an issue on the plugin page &lt;a href=&quot;https://github.com/engram-design/SuperTable/issues&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/SuperTable/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-04-11T02:39:35.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14604" PostTypeId="1" AcceptedAnswerId="14614" CreationDate="2016-04-11T03:01:59.810" Score="0" ViewCount="44" Body="&lt;p&gt;I am using the fileCache command in a custom plugin. I've set it to never expire so that I can provide a special link to our client to force a refresh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is, the cache seems to be killing itself off. On one day I can see record of it regenerating three separate times, so it is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft-&amp;gt;fileCache-&amp;gt;add($cacheKey, $dataToAddToCache, $cacheExpire);&#xA;$craft-&amp;gt;fileCache-&amp;gt;add('my-hardcoded-key', 'string of data', 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically I am doing this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (NEED_TO_REGEN) {&#xA;   $craft-&amp;gt;fileCache-&amp;gt;delete($cacheKey);&#xA;}&#xA;$a_cacheVal = $craft-&amp;gt;fileCache-&amp;gt;get($cacheKey);&#xA;if (empty($a_cacheVal)) {&#xA;    //use the cached data&#xA;} else {&#xA;   $craft-&amp;gt;fileCache-&amp;gt;add($cacheKey, $dataToAddToCache, $cacheExpire);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does admin modification of resources affect fileCache at all (updating an entry wouldn't kill of my plugin fileCache would it?) The admins is not doing a full Clear Cache inside settings or anything. So why would this particular cache be regenerating frequently (multiple times per day in some case)?&lt;/p&gt;&#xA;" OwnerUserId="4616" LastEditorUserId="57" LastEditDate="2016-04-11T18:21:26.830" LastActivityDate="2016-04-11T18:41:24.977" Title="fileCache seems to expire even though I have it set to 0" Tags="&lt;filecache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14608" PostTypeId="2" ParentId="14546" CreationDate="2016-04-11T14:06:35.777" Score="3" Body="&lt;p&gt;You’re close. But the &lt;code&gt;relatedTo&lt;/code&gt; param can’t just be set to some username. It has to either be an element ID or an actual element model (more specifically, a user ID or UserModel in this case).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'users/&amp;lt;username:{handle}&amp;gt;/offers.json' =&amp;gt; function($username) {&#xA;    // Get the actual user model&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('User');&#xA;    $criteria-&amp;gt;username = $username;&#xA;    $user = $criteria-&amp;gt;first();&#xA;&#xA;    // If there was no user, return no results&#xA;    if (!$user) {&#xA;        return [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['id' =&amp;gt; false],&#xA;        ];&#xA;    }&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'specialOffers',&#xA;            'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $user]&#xA;        ],&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-11T14:06:35.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14610" PostTypeId="1" CreationDate="2016-04-11T16:11:40.633" Score="0" ViewCount="883" Body="&lt;p&gt;Is there a way to use a local url when my assets are stored in an S3 bucket?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bucket I'm pointing to and in there I have a folder called backgroundImg with a background.png&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to access this from my CSS like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;background-image: url('backgroundImg/background.png');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it cannot find this url. It's building the url &lt;code&gt;localhost/assets/backgroundImg/background.png&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to use the local path instead of an insanely long s3 url that is hardcoded?&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="45" LastEditDate="2016-08-13T02:46:54.983" LastActivityDate="2016-08-13T02:46:54.983" Title="Craft Assets on S3 bucket" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14611" PostTypeId="2" ParentId="8460" CreationDate="2016-04-11T16:44:44.267" Score="2" Body="&lt;p&gt;Unfortunately, this is a known bug in Craft. &lt;strong&gt;Bulk actions do not trigger their respective events.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure when (if?) a solution will appear. I'm guessing that it won't be fixed in the 2.x branch, since this bug has existed for quite awhile now. With any luck, it'll be fixed when Craft 3 launches.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-04-11T16:44:44.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14612" PostTypeId="2" ParentId="8460" CreationDate="2016-04-11T18:16:41.967" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/14611/57&quot;&gt;Lindsey's answer&lt;/a&gt; is correct, but as a workaround, you can listen to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforePerformAction&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction&quot; rel=&quot;nofollow noreferrer&quot;&gt;onPerformAction&lt;/a&gt; events, check to see if the action parameter to see if it's the action you're interested in and perform  your logic as necessary.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-11T18:16:41.967" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14613" PostTypeId="2" ParentId="14610" CreationDate="2016-04-11T18:20:49.350" Score="2" Body="&lt;p&gt;You would need to build the complete URL to your file in order for it to work in your CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this answer:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12990/do-remote-assets-ie-s3-have-file-paths&quot;&gt;Do Remote Assets (ie. S3) have file paths?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;background-image&lt;/code&gt; is handled by something like a single or an entry template you could handle it with an inline style tag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regular Loading:&lt;/strong&gt;&lt;br&gt;&#xA;&lt;code&gt;{% set image = entry.backgroundImage.first()%}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Eager-loaded:&lt;/strong&gt;&lt;br&gt;&#xA;&lt;code&gt;{% set image = entry.backgroundImage[0] ?? null%}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template:&lt;/strong&gt;&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;main style=&quot;background-image: url({% if image %}{{image.url}}{% endif %});&quot;&amp;gt;&amp;lt;/main&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-11T18:28:16.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14614" PostTypeId="2" ParentId="14604" CreationDate="2016-04-11T18:41:24.977" Score="1" Body="&lt;p&gt;You should be using &lt;code&gt;craft()-&amp;gt;cache&lt;/code&gt; with the &lt;a href=&quot;https://craftcms.com/docs/config-settings#cacheMethod&quot; rel=&quot;nofollow&quot;&gt;cacheMethod&lt;/a&gt; config setting set to &lt;code&gt;file&lt;/code&gt; (which it is by default) instead of &lt;code&gt;craft()-&amp;gt;fileCache&lt;/code&gt;.  The latter is deprecated and won't work in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yii does have &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.17/framework/caching/CFileCache.php#L101&quot; rel=&quot;nofollow&quot;&gt;garbage collection&lt;/a&gt; on cache, and by default an item has a 0.01% change of being purged from cache regardless of expiry time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think you're not being garbage collected, you can check the file modified time of the files in &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt;.  If you explicitly pass in &lt;code&gt;0&lt;/code&gt; as an expiration time, Yii will set the file's modification date to a &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.17/framework/caching/CFileCache.php#L157&quot; rel=&quot;nofollow&quot;&gt;year out&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-11T18:41:24.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14615" PostTypeId="1" AcceptedAnswerId="14616" CreationDate="2016-04-12T09:20:18.427" Score="2" ViewCount="711" Body="&lt;p&gt;I've taken a look at &lt;code&gt;app/services/InstallService.php&lt;/code&gt; for some inspiration, and I'm not great at navigating/understanding the &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;. I really don't know where to begin with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I get a little push in the right direction on &lt;strong&gt;how to create an Asset Source programmatically via a plugin&lt;/strong&gt; please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping there's a way I can generate an asset source &lt;code&gt;onBeforeInstall&lt;/code&gt;. I'll probably need a method to remove it too should  the plugin be uninstalled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2016-07-25T04:33:14.707" Title="How to create an Asset Source programmatically via a plugin?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14616" PostTypeId="2" ParentId="14615" CreationDate="2016-04-12T09:26:56.340" Score="5" Body="&lt;p&gt;I don't think you can add asset source types without modifying core. The list of components that is allowed / scanned for does not contain AssetSourceTypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you mean create an asset source using an existing AssetSourceType programmatically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want an asset source saved, I would guess it is similar to below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$source = new AssetSourceModel();&#xA;$source-&amp;gt;name   = 'Source name';&#xA;$source-&amp;gt;handle = 'Source handle';&#xA;$source-&amp;gt;type   = 'Local';&#xA;// Not sure about the settings here&#xA;$source-&amp;gt;settings = array('path' =&amp;gt; 'path/to/','url' =&amp;gt; 'url/path/to', 'publicURLs' =&amp;gt; '1');&#xA;&#xA;$fieldLayout = craft()-&amp;gt;fields-&amp;gt;getLayoutById(1); // set this to the field layout you want&#xA;$fieldLayout-&amp;gt;type = ElementType::Asset;&#xA;&#xA;$source-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;if (craft()-&amp;gt;assetSources-&amp;gt;saveSource($source)) {&#xA;    // Success saving&#xA;}&#xA;else {&#xA;    // Error saving&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can look at the AssetSources controller actionSaveSource for reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some areas I'm not sure about such as the settings and the field layout, as they get set by POST data, but this should lead you in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="1021" LastEditorUserId="584" LastEditDate="2016-07-25T04:33:14.707" LastActivityDate="2016-07-25T04:33:14.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14617" PostTypeId="1" AcceptedAnswerId="14620" CreationDate="2016-04-12T09:54:26.617" Score="2" ViewCount="811" Body="&lt;p&gt;Background: We are considering using Craft Commerce to replace Shopify for more custom fields.&#xA;However Craft Commerce does not have simple export buttons for exporting orders, so we are looking at the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; plugin to build our custom plugin to get each order as a order-xxx.json&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Can i use Craft Commerce orders as a element in the Element API plugin?&lt;/p&gt;&#xA;" OwnerUserId="5009" LastEditorUserId="57" LastEditDate="2016-04-12T17:20:58.710" LastActivityDate="2016-04-12T17:20:58.710" Title="Can the Element API export Craft Commerce orders as the element?" Tags="&lt;plugin-development&gt;&lt;plugin-elementapi&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14618" PostTypeId="1" AcceptedAnswerId="14619" CreationDate="2016-04-12T10:01:16.187" Score="3" ViewCount="756" Body="&lt;p&gt;I have two Lightswitch fields – &lt;code&gt;lightswitchA&lt;/code&gt; and &lt;code&gt;lightswitchB&lt;/code&gt; – and I need to pull all entries in a certain section, that have &lt;em&gt;one or both&lt;/em&gt; of these fields enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to execute such a query with a standard ElementCriteriaModel, or do I need to construct a custom query? If I need to construct a custom query, how would that look (in a template, not a plugin)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also need to paginate the results, using the &lt;code&gt;{% paginate %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-04-12T11:07:48.603" LastActivityDate="2018-06-29T11:23:35.617" Title="How can I query for entries that have one of two Lightswitch fields enabled?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14619" PostTypeId="2" ParentId="14618" CreationDate="2016-04-12T10:33:54.593" Score="4" Body="&lt;h2&gt;Craft 3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Thanks to the &lt;code&gt;where()&lt;/code&gt; function this has become easy in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries.where([&#xA;    'or',&#xA;    {'field_lightswitchA': 1},&#xA;    {'field_lightswitchB': 1},&#xA;]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Craft 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Custom field parameters are being added with and-logic, so you'd indeed have to&#xA;do it from PHP with custom dbCommands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could either approach it with converting a criteria model to a dbCommand object using the &lt;code&gt;buildElementsQuery&lt;/code&gt; method, or you listen for &lt;code&gt;elements.buildElementsQuery&lt;/code&gt; events and modify the dbCommand if the criteria model meets certain conditions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.buildElementsQuery', function(Event $event) {&#xA;    $criteria = $event-&amp;gt;params['criteria'];&#xA;    $dbCommand = $event-&amp;gt;params['query'];&#xA;&#xA;    if (isset($criteria-&amp;gt;or_lightswitchA) &amp;amp;&amp;amp; isset($criteria-&amp;gt;or_lightswitchB)) {&#xA;        $params = array(&#xA;            ':lightswitchA_value' =&amp;gt; $criteria-&amp;gt;or_lightswitchA,&#xA;            ':lightswitchB_value' =&amp;gt; $criteria-&amp;gt;or_lightswitchB,&#xA;        );&#xA;&#xA;        $conditions = array('or',&#xA;            'content.field_lightswitchA=:lightswitchA_value',&#xA;            'content.field_lightswitchB=:lightswitchB_value',&#xA;        );&#xA;&#xA;        $dbCommand-&amp;gt;andWhere($conditions, $params);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's how you'd trigger that listener from your criteria model in Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    or_lightswitchA: 1,&#xA;    or_lightswitchB: 1,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's example code for the &lt;code&gt;buildElementsQuery&lt;/code&gt; approach, the problem with this is that&#xA;once you've converted to dbCommands you can't go back to a criteria model (which would be&#xA;necessary to use the result with Craft's &lt;code&gt;paginate&lt;/code&gt; tag for example).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function myCustomCriteria($criteria, $lightswitchA_value, $lightswitchB_value)&#xA;{&#xA;    $dbCommand = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;    $params = array(&#xA;        ':lightswitchA_value' =&amp;gt; $lightswitchA_value,&#xA;        ':lightswitchB_value' =&amp;gt; $lightswitchB_value,&#xA;    );&#xA;&#xA;    $conditions = array('or',&#xA;        'content.field_lightswitchA=:lightswitchA_value',&#xA;        'content.field_lightswitchB=:lightswitchB_value',&#xA;    );&#xA;&#xA;    $dbCommand-&amp;gt;andWhere($conditions, $params);&#xA;&#xA;    $results = $dbCommand-&amp;gt;queryAll();&#xA;&#xA;    return EntryModel::populateModels($results);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-06-29T11:23:35.617" LastActivityDate="2018-06-29T11:23:35.617" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14620" PostTypeId="2" ParentId="14617" CreationDate="2016-04-12T12:37:17.637" Score="2" Body="&lt;p&gt;Orders are in fact an &lt;code&gt;ElementType&lt;/code&gt; in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;code&gt;Commerce_OrderElementType.php&lt;/code&gt; inside the commerce plug-in folder. With that said you should have no problem retrieving orders like you would any other element type in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also services available that make it very easy to retrieve orders so you may find a simple PHP plug-in will get the job done in terms of returning JSON for an order(s).&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-04-12T12:37:17.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14621" PostTypeId="2" ParentId="1164" CreationDate="2016-04-12T14:54:02.763" Score="1" Body="&lt;p&gt;Try this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install this on your server &lt;a href=&quot;http://s3tools.org/s3cmd&quot; rel=&quot;nofollow&quot;&gt;http://s3tools.org/s3cmd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a bash script to &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;mysqldump your database&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;place the mysqldump in your directory path. I place mine in /var/www/site/backups/mysql/yyyy-mm-dd/mysql.sql format. My folder structure looks like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/var/www/site/public&#xA;/var/www/site/craft&#xA;/var/www/site/backups&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you complete your mysqldump, simply tar.gz the entire /var/www/site folder and copy it to Amazon s3 with s3cmd utility that you installed earlier. &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-12T14:54:02.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14622" PostTypeId="2" ParentId="9499" CreationDate="2016-04-12T15:06:15.400" Score="0" Body="&lt;p&gt;I hijacked the form submission and generated the URL based on all the checkboxes they checked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating a URL like: /results?category=green,red,blue&amp;amp;number=one,two,three&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input names were not category[], but category and number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the results template, I grabbed the parameters (just displaying one in this example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set number = craft.request.getParam('number') %}&#xA;&#xA;{% if number %}&#xA;    {% for item in mealType|split(',') %}&#xA;        {% set numberCategories = craft.categories.group('number').slug(item) %}&#xA;        {% set relationParam = relationParam|merge([{ targetElement: numberCategories }]) %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{# setup your search parameters #}&#xA;{% set searchParams = {&#xA;    section: 'news',&#xA;    relatedTo: relationParam&#xA;} %}&#xA;&#xA;{# Find your entries #}&#xA;{# {% set entries = craft.entries(searchParams).order('score') %} #}&#xA;{% if relationParam|length &amp;gt; 1 %}&#xA;    {% paginate craft.entries(searchParams).order('score').limit(12) as pageInfo, pageEntries %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The JS for getting the values from each checkbox, I set the checkboxes all to have the same class. I looped thru those checkboxes and built an array to of checkbox input names and the values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#news-form&quot;).submit(function(e) {&#xA;    e.preventDefault();&#xA;    var query_string = '';&#xA;    var categories = [];&#xA;    var i = 0;&#xA;&#xA;    $('.category-checkbox').each(function (index, value) {&#xA;        var checkboxName = $(this).attr('name');&#xA;        var checkboxValue = $(this).val();&#xA;&#xA;        // if checkbox is checked&#xA;        if ($(this).is(':checked'))&#xA;        {&#xA;            categories[checkboxName] = categories[checkboxName] || [];&#xA;            categories[checkboxName].push(checkboxValue);&#xA;        }&#xA;&#xA;    });&#xA;&#xA;    var cat_index = 0;&#xA;&#xA;    for(var key in categories)&#xA;    {&#xA;        console.log(key);&#xA;&#xA;        if(cat_index &amp;gt; 0)&#xA;        {&#xA;            query_string += '&amp;amp;' + key + '=' + categories[key];&#xA;        } else {&#xA;            query_string += key + '=' + categories[key];&#xA;        }&#xA;&#xA;        cat_index++;&#xA;    }&#xA;&#xA;    if( query_string != '')&#xA;    {&#xA;        window.location = '/news/results?' + query_string;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps someone out.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2016-04-12T15:06:15.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14623" PostTypeId="1" AcceptedAnswerId="14703" CreationDate="2016-04-12T17:16:37.217" Score="2" ViewCount="111" Body="&lt;p&gt;Is it possible to grab file (mp3) that has been submitted as part of an entry and post it to a secondary location (Soundcloud via their API) before it gets stored to my asset source at Amazon S3? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complicate things a bit, I am uploading multiple files per entry, each one having its own field. One is the produced file (field name mp3File) selection) and the others are the raw recordings (field name rawFiles). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is produced file (mp3File) that I am wanting to push to SoundCloud with their API. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a handle on how the SoundCloud API works, what I need is to pass the file path to the SoundCloud API. I think it is probably better to do this while the file still resides on the server before it makes its way to Amazon. Or it could be that I don't understand the flow here at all. &lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-18T23:42:56.727" Title="assets.beforeSaveEntry to upload file to secondary location in addition to Amazon S3" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;amazon&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14624" PostTypeId="1" CreationDate="2016-04-12T18:07:51.573" Score="1" ViewCount="104" Body="&lt;p&gt;Just getting starting with templating so apologies if this is obvious. Couldn't find a solution through search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up two sections. These contain different sets of information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one category group that lists UK counties like so..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Country (Parent)&#xA; - County (Child)&#xA; - County (Child)&#xA; - County (Child)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both sections have this category group as a category field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to create a Category page, but that only lists the entries for the section you are currently viewing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say for example you are viewing a list of entries, or single entry in section 1.&#xA;On an index page I'm displaying the category like so..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for category in entry.county.level(2) %}&amp;lt;a href=&quot;#&quot;&amp;gt;{{ category.title }}{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and on a single page like so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set category = entry.county.last() %}&#xA;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to link to the category page plate that will show a list of entries within that category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my category group set up like so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oQbG6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oQbG6.png&quot; alt=&quot;categorygroup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm not quite sure how to set this up so that it will only show the relevant sections entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that make sense? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please ask if it's not clear and I can hopefully clarify!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2016-07-16T14:38:57.577" Title="Two sections sharing one category group" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14625" PostTypeId="1" AcceptedAnswerId="14678" CreationDate="2016-04-12T21:02:48.710" Score="1" ViewCount="2333" Body="&lt;p&gt;I'm new to craft so may it be a basic question, however I can't find an answer for it :-/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have custom field 'width' in my entry type defined as integer.&#xA;What I need to achieve is quite simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('windows').find({'width':'&amp;gt; 0'}).order(width) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important now is the .order part it's not working right now :-(. What is correct way to do this? I have found some plugins but I believe craft can do this somehow… It always does (so far).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any info on this.&lt;/p&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="22" LastEditDate="2017-05-09T22:05:16.090" LastActivityDate="2020-12-23T19:56:13.560" Title="Ordering entries by custom field (integer)" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14626" PostTypeId="2" ParentId="14625" CreationDate="2016-04-12T21:54:56.150" Score="2" Body="&lt;p&gt;Have you tried putting in 'width' instead of width?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order parameter expects a string, not an object, as it just needs to know the name of the field name to filter by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Final code would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('windows').find({'width':'&amp;gt; 0'}).order('width') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-12T21:54:56.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14627" PostTypeId="1" AcceptedAnswerId="14632" CreationDate="2016-04-12T22:31:02.650" Score="2" ViewCount="177" Body="&lt;p&gt;How can I implement security which allows members to only publish an entry in an assigned category / topic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The site is a business directory.&lt;/li&gt;&#xA;&lt;li&gt;Business listings are published in cities: New York, California.&lt;/li&gt;&#xA;&lt;li&gt;Content managers are assigned to either New York or California.&lt;/li&gt;&#xA;&lt;li&gt;Content managers can only publish in the city they are assigned to.&lt;/li&gt;&#xA;&lt;li&gt;Content managers can only see entries in the city they are assigned to.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I first thought this could be done with a custom field that only shows the cities a content manager is assigned to. That shouldn't be so hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'd need to also limit the entry indexes in the Control Panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Just found the onBeforeBuildElementsQuery event: &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('elements.onBeforeBuildElementsQuery', function(Event $event) {&#xA;       // $event-&amp;gt;params['criteria']['tennant'] = 'new-york';&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="963" LastEditorUserId="963" LastEditDate="2016-04-12T23:02:35.097" LastActivityDate="2016-04-13T05:13:40.370" Title="Restrict entry editing to category / topic" Tags="&lt;control-panel&gt;&lt;security&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14628" PostTypeId="2" ParentId="14627" CreationDate="2016-04-12T22:50:32.153" Score="2" Body="&lt;p&gt;So you could definitely use the onBeforeBuildElementQuery event to keep them from showing up in the CP (though you'd have to detect if the query is coming from the CP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also recommend your plugin uses the onBeforeSaveElement event. From there you could check the element's related categories to see if the user has them on their user account, and then allow/deny them to be able to save the element from there. While hiding it from the CP would likely keep them from finding it, putting in more validation will make sure that no one emails an edit link to someone who isn't supposed to be able to edit it.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-12T22:50:32.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14629" PostTypeId="1" AcceptedAnswerId="14630" CreationDate="2016-04-13T00:34:51.220" Score="1" ViewCount="97" Body="&lt;p&gt;Weird issue where a tag was not found using the tags search query.  That tag is in the CMS (in news entries) as well as the DB, and even shows up in other queries.  Query in question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;    set tag = craft.tags({&#xA;        search: { query: slug }&#xA;    }).limit(1)&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All but this tag can't be found for some odd ghostly reason.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-04-13T01:00:13.427" Title="Tag mysteriously not found" Tags="&lt;search&gt;&lt;tags&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14630" PostTypeId="2" ParentId="14629" CreationDate="2016-04-13T00:34:51.220" Score="2" Body="&lt;p&gt;Turns out that Craft's search indexes were corrupted.  After rebuilding the search indexes, that damn tag was correctly showing up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps anyone that might have had just content gone mysteriously MIA.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2016-04-13T00:34:51.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14631" PostTypeId="2" ParentId="14629" CreationDate="2016-04-13T01:00:13.427" Score="3" Body="&lt;p&gt;You don't need to use the search parameter in this case. I'd avoid using it where ever possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.slug(slug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-13T01:00:13.427" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14632" PostTypeId="2" ParentId="14627" CreationDate="2016-04-13T05:13:40.370" Score="2" Body="&lt;p&gt;This can be achieved using the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&quot; rel=&quot;nofollow&quot;&gt;onBeforeBuildElementsQuery&lt;/a&gt; event: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeBuildElementsQuery', function(Event $event) {&#xA;   // $event-&amp;gt;params['criteria']['tennant'] = 'new-york';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With some smarts around group permissions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerUserPermissions()&#xA;{&#xA;    return array(&#xA;        'tennants' =&amp;gt; array('label' =&amp;gt; Craft::t('Tennants'), 'nested' =&amp;gt; array(&#xA;            'newcastle' =&amp;gt;  array('label' =&amp;gt;  Craft::t('Newcastle')),&#xA;            'gosford' =&amp;gt;  array('label' =&amp;gt;  Craft::t('Gosford')),&#xA;        ))&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;a custom plugin for this functionality should be possible.&lt;/p&gt;&#xA;" OwnerUserId="963" LastActivityDate="2016-04-13T05:13:40.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14633" PostTypeId="1" CreationDate="2016-04-13T05:13:53.640" Score="1" ViewCount="71" Body="&lt;p&gt;(This is &lt;em&gt;not&lt;/em&gt; a duplicate of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12842/redactor-ii-craft-2-5-prevent-paragraphs&quot;&gt;Redactor II Craft 2.5 Prevent Paragraphs&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to paste in text from LibreOffice and the text ends up in Redactor II with, as far as I can tell, &lt;strong&gt;completely random&lt;/strong&gt; linebreaks. It is not limited to a single document, but happens with any .odt or .doc I attempt to use. It's adding multiple linebreaks within a single paragraph, sometimes after every word - and they are getting added as [br]s to the HTML source, so it's not just some sort of visual artifact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client is, as you might imagine, furious with the new behavior. Has anyone else seen anything like this? Is there a fix? In the meantime I am using the &quot;Redactor I&quot; plugin by P&amp;amp;T, but that's not sustainable.&lt;/p&gt;&#xA;" OwnerUserId="118" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-04-13T05:13:53.640" Title="Redactor II issue - adding completely random linebreaks to pasted text" Tags="&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14634" PostTypeId="1" AcceptedAnswerId="14635" CreationDate="2016-04-13T07:34:04.633" Score="2" ViewCount="436" Body="&lt;p&gt;i am using a slider in my template, and depending on if the user filled out values in the craft matrix (slides can have up to 4 rows) i want to have twig compile only the necessary code. I am not sure if my attempt is way too long and it could be archived much easier. thanks a lot for the help&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;div id=&quot;slider-with-blocks-1&quot; class=&quot;royalSlider rsMinW&quot;&amp;gt;&#xA;    {% for block in entry.slideitemtop %}&#xA;    {% set Bild = block.ImageSlideTop.first() %}&#xA;    {% if block.textCSlideTop is empty and block.textBSlideTop is empty and block.textASlideTop is empty and block.headlineSlideTop is empty %}&#xA;    &amp;lt;div class=&quot;rsContent slide3&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% elseif block.textCSlideTop is empty and block.textBSlideTop is empty and block.textASlideTop is empty %}&#xA;    &amp;lt;div class=&quot;rsContent slide3&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;div class=&quot;bContainer&quot;&amp;gt;&#xA;        &amp;lt;strong data-move-effect=&quot;none&quot; class=&quot;rsABlock txtCent blockSubHeadline&quot;&amp;gt;{{ block.headlineSlideTop }}&amp;lt;/strong&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% elseif block.textCSlideTop is empty and block.textBSlideTop is empty %}&#xA;    &amp;lt;div class=&quot;rsContent slide4&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;div class=&quot;bContainer&quot;&amp;gt;&#xA;        &amp;lt;strong data-move-effect=&quot;none&quot; class=&quot;rsABlock txtCent blockSubHeadline&quot;&amp;gt;{{ block.headlineSlideTop }}&amp;lt;/strong&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;top&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textASlideTop }}&amp;lt;/span&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% elseif block.textCSlideTop is empty %}&#xA;    &amp;lt;div class=&quot;rsContent slide1&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;div class=&quot;bContainer&quot;&amp;gt;&#xA;        &amp;lt;strong data-move-effect=&quot;none&quot; class=&quot;rsABlock txtCent blockSubHeadline&quot;&amp;gt;{{ block.headlineSlideTop }}&amp;lt;/strong&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;top&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textASlideTop }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;bottom&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textBSlideTop }}&amp;lt;/span&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;    &amp;lt;div class=&quot;rsContent slide1&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;div class=&quot;bContainer&quot;&amp;gt;&#xA;        &amp;lt;strong data-move-effect=&quot;none&quot; class=&quot;rsABlock txtCent blockSubHeadline&quot;&amp;gt;{{ block.headlineSlideTop }}&amp;lt;/strong&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;top&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textASlideTop }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;bottom&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textBSlideTop }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span data-move-effect=&quot;left&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textCSlideTop }}&amp;lt;/span&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="344" LastEditDate="2016-04-13T08:21:49.377" LastActivityDate="2016-04-13T08:21:49.377" Title="Is there a better way than stacked if else" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14635" PostTypeId="2" ParentId="14634" CreationDate="2016-04-13T08:20:31.023" Score="5" Body="&lt;p&gt;There is certainly a lot of repeated code here so we can definitely improve on that! There are so many ways you could handle your Twig templates but this is how I would do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;slider-with-blocks-1&quot; class=&quot;royalSlider rsMinW&quot;&amp;gt;&#xA;    {% for block in entry.slideitemtop %}&#xA;        {% set Bild = block.ImageSlideTop.first() %}&#xA;&#xA;        &amp;lt;div class=&quot;rsContent slide{{ loop.index }}&quot;&amp;gt;&#xA;            &amp;lt;a class=&quot;rsImg&quot; href=&quot;{{ Bild.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;div class=&quot;bContainer&quot;&amp;gt;&#xA;                {% if block.headlineSlideTop|length %}&#xA;                    &amp;lt;strong data-move-effect=&quot;none&quot; class=&quot;rsABlock txtCent blockSubHeadline&quot;&amp;gt;{{ block.headlineSlideTop }}&amp;lt;/strong&amp;gt;&#xA;                {% endif %}&#xA;                {% if block.textASlideTop|length %}&#xA;                    &amp;lt;span data-move-effect=&quot;top&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textASlideTop }}&amp;lt;/span&amp;gt;&#xA;                {% endif %}&#xA;                {% if block.textBSlideTop|length %}&#xA;                    &amp;lt;span data-move-effect=&quot;bottom&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textBSlideTop }}&amp;lt;/span&amp;gt;&#xA;                {% endif %}&#xA;                {% if block.textCSlideTop|length %}&#xA;                    &amp;lt;span data-move-effect=&quot;left&quot; class=&quot;rsABlock txtCent&quot;&amp;gt;{{ block.textCSlideTop }}&amp;lt;/span&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All we are doing here is using the same template code for each slide, but for each loop through we are checking if the 4 fields have any content or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also noticed a &lt;code&gt;slide1&lt;/code&gt; class. You can also automatically increment the number at the end of the class for each loop using &lt;code&gt;{{ loop.index }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-04-13T08:20:31.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14638" PostTypeId="1" AcceptedAnswerId="14639" CreationDate="2016-04-13T12:41:50.960" Score="2" ViewCount="1648" Body="&lt;p&gt;I tried to code an output in twig that should look the following ( 2 columns in one row), i figured that i will need the batch function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;     &amp;lt;/div&amp;gt;    &#xA; &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My attempt is : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for block in entry.content1|batch(2) %}&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for block in row %}&#xA;    &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it doesn't work like that, i looked it up in the twig documentation, the error from craft i get is &quot;Variable &quot;row&quot; does not exist&quot;, so i tried changing it to {% for entry in block %} but that doesn't work either.&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2017-02-23T03:25:08.790" LastActivityDate="2017-02-23T03:25:08.790" Title="Trying to achieve a row column layout with batch" Tags="&lt;templating&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14639" PostTypeId="2" ParentId="14638" CreationDate="2016-04-13T12:52:20.640" Score="5" Body="&lt;p&gt;I think you're getting your variable names mixed up. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.content1|batch(2) %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;   {% for block in row %}&#xA;   &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;Content&amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've changed the name of the first &lt;code&gt;block&lt;/code&gt; to &lt;code&gt;row&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-04-13T12:52:20.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14642" PostTypeId="1" CreationDate="2016-04-13T15:00:12.697" Score="0" ViewCount="952" Body="&lt;p&gt;I'm trying to use php.ini to increase memory_limit etc on my site. An empty php.ini causes the front end to crash throwing a &quot;Service Unavailable&quot; error and the CP to throw the error &quot;Craft requires the PDO extension to operate.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server allows for php.ini files to be used. There is no craft/storage/logs/phperrors.log file and the PHP and apache logs don't seem to show anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another user had the similar issue here but there doesn't seem to be a fix posted that works: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11785/adding-php-ini-file-to-root-crashes-site&quot;&gt;Adding php.ini file to root crashes site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4840" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-04-13T15:35:53.100" Title="php.ini crashes CP with &quot;Craft requires the PDO extension to operate.&quot;" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14643" PostTypeId="2" ParentId="14642" CreationDate="2016-04-13T15:35:53.100" Score="1" Body="&lt;p&gt;I fixed this by adding the PDO extensions in to my php.ini which was overriding the server one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;extension = &quot;pdo.so&quot;&#xA;extension = &quot;pdo_sqlite.so&quot;&#xA;extension = &quot;apc.so&quot;&#xA;extension = &quot;intl.so&quot;&#xA;extension = &quot;pdo_mysql.so&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4840" LastActivityDate="2016-04-13T15:35:53.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14644" PostTypeId="1" CreationDate="2016-04-13T15:47:40.287" Score="1" ViewCount="291" Body="&lt;p&gt;With Sprout Forms is it possible to return an error message if a form submission is bouncing back because unique values are expected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a custom HTML form called &lt;code&gt;signup&lt;/code&gt; I would expect it to throw back an object called &lt;code&gt;signup&lt;/code&gt; but &lt;code&gt;signup&lt;/code&gt; is not defined. Also tried &lt;code&gt;form.getErrors()&lt;/code&gt; but this also returns empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form form--signup&quot; method=&quot;post&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;    {% set form = craft.sproutForms.form('signup') %}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.url }}#newsletter&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;email&quot; name=&quot;fields[email]&quot; id=&quot;ft_email&quot; placeholder=&quot;Email address&quot; class=&quot;form__input&quot; required&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;button btn btn--box btn--send&quot;&amp;gt;Send &amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-04-13T16:00:55.747" Title="Sprout Forms: returning error question" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14645" PostTypeId="1" AcceptedAnswerId="14665" CreationDate="2016-04-13T15:58:42.267" Score="1" ViewCount="324" Body="&lt;p&gt;I have a section called News with 2 locales: 'en' and 'nl'. For some News items I have both languages switched on and for some only 1 language. The screenshot shows an example of an entry with only 1 language switched on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jY6XQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jY6XQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a php method to check the Entry object which languages are switch on? &lt;/p&gt;&#xA;" OwnerUserId="4901" LastActivityDate="2019-04-29T14:16:45.637" Title="Check which locales of an Entry are active" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14646" PostTypeId="2" ParentId="14644" CreationDate="2016-04-13T16:00:55.747" Score="2" Body="&lt;p&gt;Apologies - resolved. Case sensitivity issue with variable (signUp not signup)&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-04-13T16:00:55.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14647" PostTypeId="1" CreationDate="2016-04-13T16:57:49.197" Score="2" ViewCount="693" Body="&lt;p&gt;I'm trying to get our Craft CMS install to use a memcached cluster we created in AWS. I am able to telnet to the memcached server on port 11211 from the server that will be connecting to it. I did a tcpdump (packet trace) on the web server's interface and it did not try to connect to the caching server at all over a period of 12 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the caching method in config/general.php set to use &quot;memcache&quot; and have the useMemcached set to true in config/memcache.php as well as the memcached server info all filled out correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I am missing? It should have at least attempted to connect at least once in that amount of time. I was wondering if my web server was missing some sort of php plugin. I found libphp5-memcached wasn't installed so I installed it, but still no connection out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation on getting Craft CMS to work with a caching server don't appear to have much more than the config stuff, so not sure what we're missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help in advance!&lt;/p&gt;&#xA;" OwnerUserId="5016" LastActivityDate="2017-10-20T22:20:20.453" Title="How do you get memcached working?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14648" PostTypeId="1" CreationDate="2016-04-13T20:38:52.183" Score="3" ViewCount="118" Body="&lt;p&gt;The username that is entered in URL. I need to pass this data to my transformer as well since I have an EntryModel combined with a Matrix Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I have a matrix field where there are multiple matrix blocks. I need to query them based on the user field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is added on to my original question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14546/how-do-i-query-data-using-the-element-api-plugin-based-on-a-custom-field&quot;&gt;How do I query data using the Element API Plugin based on a custom field?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if there is another criteria setting that I could set so that the matrix would only grab the data for the requested user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only other idea was to loop through the matrix blocks and check to see if the username requested was equal to the matrix blocks username field. If it is -- then grab the data that I need and set that in a variable to output in the JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't do this unless I can figure out how to get the username inside the 'transformer'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for all the help. I am learning a lot about this plugin and it is an excellent addition to CraftCMS. &lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-15T02:26:58.437" Title="How can I pull my Username into the transformer of the ElementAPI plugin?" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14649" PostTypeId="2" ParentId="14648" CreationDate="2016-04-13T20:53:33.727" Score="3" Body="&lt;p&gt;I was able to pass the $username data to the transformer. By doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) use ($username)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="57" LastEditDate="2016-04-15T02:26:58.437" LastActivityDate="2016-04-15T02:26:58.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14650" PostTypeId="2" ParentId="13335" CreationDate="2016-04-13T23:46:53.850" Score="4" Body="&lt;p&gt;You can accomplish this by using the set/endset tags to create a variable from the cached output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set finalVariable %}&#xA;    {% cache %}&#xA;        {# heavy lifting (like queries) here #}&#xA;        {# output the contents of your variable here #}&#xA;        your output here or {{ yourOutputHere }}&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example the &lt;code&gt;finalVariable&lt;/code&gt; will be set to the value of the cached content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, in the case of the code example used in the question, something like this could be used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set id %}{% spaceless %}&#xA;    {% cache using key &quot;cacheId&quot; %}&#xA;        1&#xA;    {% endcache %}&#xA;{% endspaceless %}{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's a very basic example that would probably never be used, but the &lt;code&gt;id&lt;/code&gt; variable would be set to a string of &lt;code&gt;1&lt;/code&gt; from the &lt;code&gt;cacheId&lt;/code&gt; cache. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The spaceless tags are just used to remove the whitespace.&lt;/p&gt;&#xA;" OwnerUserId="1116" LastActivityDate="2016-04-13T23:46:53.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14651" PostTypeId="1" CreationDate="2016-04-14T08:56:11.827" Score="1" ViewCount="120" Body="&lt;p&gt;I make use of the front-end entry form for an event registration process. The event is the main entry, and every event registration an entry of a related registration section. The challenge is to see whether a user has already been registered for an event. Today, I do that with a database query before the entry form loads. But for some reason, this works not always (for example when users reload the page). How could I make the combination of two fields (&quot;user id&quot; and &quot;registration status&quot;) unique? (Normally, I would do that on a database level with a unique index over the two fields.) &lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="6007" LastEditDate="2018-05-14T19:36:26.650" LastActivityDate="2018-05-14T19:36:26.650" Title="How to make combination of two field values unique?" Tags="&lt;form&gt;&lt;field&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14652" PostTypeId="1" AcceptedAnswerId="14657" CreationDate="2016-04-14T09:26:54.247" Score="1" ViewCount="72" Body="&lt;p&gt;I updated to craft 2.6.2780 and now I cant see any fields on entries after checking inspector it seems that php is this throwing an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the stack trace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Maximum function nesting level of '100' reached, aborting! in /Users/jerome/Projects/aiglon/craft/app/vendor/twig/twig/lib/Twig/Node.php on line 145&#xA;Call Stack&#xA;# Time  Memory  Function  Location&#xA;1 0.0009  241864  {main}( ) ../index.php:0&#xA;2 0.0033  440584  require_once( '/Users/jerome/Projects/aiglon/craft/app/index.php' ) ../index.php:31&#xA;3 0.1099  10459104  CApplication-&amp;gt;run( )  ../index.php:62&#xA;4 0.1099  10461112  Craft\WebApp-&amp;gt;processRequest( ) ../CApplication.php:185&#xA;5 0.1999  15650696  CWebApplication-&amp;gt;processRequest( )  ../WebApp.php:288&#xA;6 0.2025  15938760  CWebApplication-&amp;gt;runController( ) ../CWebApplication.php:141&#xA;7 0.2083  16649144  CController-&amp;gt;run( ) ../CWebApplication.php:282&#xA;8 0.2090  16694152  CController-&amp;gt;runActionWithFilters( )  ../CController.php:265&#xA;9 0.2090  16694296  CController-&amp;gt;runAction( ) ../CController.php:286&#xA;10  0.2091  16695696  CInlineAction-&amp;gt;runWithParams( ) ../CController.php:308&#xA;11  0.2091  16696272  CAction-&amp;gt;runWithParamsInternal( ) ../CInlineAction.php:47&#xA;12  0.2091  16697296  invokeArgs ( )  ../CAction.php:109&#xA;13  0.2092  16699544  Craft\EntriesController-&amp;gt;actionEditEntry( ) ../CAction.php:109&#xA;14  0.4346  23739520  Craft\BaseController-&amp;gt;renderTemplate( ) ../EntriesController.php:338&#xA;15  0.4346  23739712  Craft\TemplatesService-&amp;gt;render( ) ../BaseController.php:74&#xA;16  0.4446  24822064  Twig_Environment-&amp;gt;render( ) ../TemplatesService.php:246&#xA;17  0.4560  25991112  Twig_Template-&amp;gt;render( )  ../Environment.php:347&#xA;18  0.4560  26008360  Twig_Template-&amp;gt;display( ) ../Template.php:366&#xA;19  1.5365  26493504  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;20  1.5365  26493712  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;21  1.5365  26494408  __TwigTemplate_f8cf647abe35f0f0e2b74a673c12e9c153bbdae0fe4f9a52317d6f0cbef29919-&amp;gt;doDisplay( ) ../Template.php:381&#xA;22  1.5409  26909808  Twig_Template-&amp;gt;display( ) ../1ab3b758ddc29102de0a2a3426a0b984479ce84a67bce3468f2bfdd985918a54.php:53&#xA;23  1.5409  26910736  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;24  1.5409  26910736  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;25  1.5409  26911488  __TwigTemplate_e77ed92aa7988e9c51328e050cece8cacc2a4d0bb697e6268fabe71996e537ab-&amp;gt;doDisplay( ) ../Template.php:381&#xA;26  1.6778  27401304  Twig_Template-&amp;gt;display( ) ../c4729b5ea7be1022d5c997c520461e3e556ed6fa730be71edd4226a06597d3dc.php:165&#xA;27  1.6779  27402352  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;28  1.6779  27402352  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;29  1.6779  27403816  __TwigTemplate_f4c044be1ad93a456f5b792a5ea6839002cbb5321ca4fed8631bc413b4f560db-&amp;gt;doDisplay( ) ../Template.php:381&#xA;30  1.6911  27748184  Twig_Template-&amp;gt;display( ) ../99c63674c7847eb768f7396b0a8d85a5c4045d44723c606bcbe70506672c4f92.php:131&#xA;31  1.6912  27749304  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;32  1.6912  27749304  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;33  1.6912  27749632  __TwigTemplate_a7a80a11c0ed984b9a02484ab4491fe185e9a5d4877c3fa3a6c3833c30d665ce-&amp;gt;doDisplay( ) ../Template.php:381&#xA;34  1.6984  28420648  Twig_Template-&amp;gt;displayBlock( )  ../ceafcd2cd2e3ab1ee29def2ae7ee4d848e03e99baf7863170b3e329031ed8257.php:45&#xA;35  1.6984  28424960  __TwigTemplate_e77ed92aa7988e9c51328e050cece8cacc2a4d0bb697e6268fabe71996e537ab-&amp;gt;block_body( )  ../Template.php:167&#xA;36  2.6415  30805960  Twig_Template-&amp;gt;renderBlock( ) ../c4729b5ea7be1022d5c997c520461e3e556ed6fa730be71edd4226a06597d3dc.php:655&#xA;37  2.6415  30822584  Twig_Template-&amp;gt;displayBlock( )  ../Template.php:229&#xA;38  2.6415  30825904  __TwigTemplate_f8cf647abe35f0f0e2b74a673c12e9c153bbdae0fe4f9a52317d6f0cbef29919-&amp;gt;block_main( )  ../Template.php:167&#xA;39  2.6439  30914272  Twig_Template-&amp;gt;display( ) ../1ab3b758ddc29102de0a2a3426a0b984479ce84a67bce3468f2bfdd985918a54.php:378&#xA;40  2.6439  30914664  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;41  2.6439  31045648  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;42  2.6439  31045968  __TwigTemplate_291c4b321d5fd418706b404a0856597dabcd40ad90cdceeabd7dcaf7bbadc9a9-&amp;gt;doDisplay( ) ../Template.php:381&#xA;43  2.7723  31670296  Twig_Template-&amp;gt;display( ) ../e56e3889fb9fcfc3e18bc98f6987bb0e3dab3d2ae543efebdcdff1f7c60f7905.php:58&#xA;44  2.7724  31672808  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;45  2.7724  31672808  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;46  2.7724  31673360  __TwigTemplate_81f12d81663a85d99f185a10360565a47affbdcfb8d25e4db9e17a56bc2a120e-&amp;gt;doDisplay( ) ../Template.php:381&#xA;47  2.7741  31783112  Twig_Template-&amp;gt;display( ) ../3e1afd1389dbaf0c5f9367ffc7ca788bb5ccd01be8f9e50b79fd988052989e30.php:47&#xA;48  2.7741  31785712  Craft\BaseTemplate-&amp;gt;displayWithErrorHandling( ) ../Template.php:355&#xA;49  2.7741  31785712  Twig_Template-&amp;gt;displayWithErrorHandling( )  ../BaseTemplate.php:26&#xA;50  2.7741  31786760  __TwigTemplate_194eb62d3f869941f884bc57bdefcbe5a1b61c0991eef48bb97e1f27d5ecfb15-&amp;gt;doDisplay( ) ../Template.php:381&#xA;51  2.7770  31914192  Craft\BaseTemplate-&amp;gt;getAttribute( ) ../a5ef763b9421b08aeee887a78999a3a5322aa1c8ba4a2eab68801778ff7038b3.php:52&#xA;52  2.7770  31914288  Twig_Template-&amp;gt;getAttribute( )  ../BaseTemplate.php:64&#xA;53  2.7770  31915072  call_user_func_array:{/Users/jerome/Projects/aiglon/craft/app/vendor/twig/twig/lib/Twig/Template.php:609} ( ) ../Template.php:609&#xA;54  2.7770  31915976  Craft\MatrixFieldType-&amp;gt;getInputHtml( )  ../Template.php:609&#xA;55  2.7837  32255128  Craft\TemplatesService-&amp;gt;render( ) ../MatrixFieldType.php:281&#xA;56  2.7837  32255128  Twig_Environment-&amp;gt;render( ) ../TemplatesService.php:246&#xA;57  2.7837  32255128  Craft\TwigEnvironment-&amp;gt;loadTemplate( )  ../Environment.php:347&#xA;58  2.7837  32255176  Twig_Environment-&amp;gt;loadTemplate( ) ../TwigEnvironment.php:23&#xA;59  2.7846  32259496  Twig_Environment-&amp;gt;compileSource( )  ../Environment.php:396&#xA;60  2.8584  35194320  Twig_Environment-&amp;gt;compile( )  ../Environment.php:667&#xA;61  2.8592  35243968  Twig_Compiler-&amp;gt;compile( ) ../Environment.php:651&#xA;62  2.8592  35244408  Twig_Node_Module-&amp;gt;compile( )  ../Compiler.php:86&#xA;63  2.8592  35244768  Twig_Node_Module-&amp;gt;compileTemplate( )  ../Module.php:52&#xA;64  2.8595  35247784  Twig_Node_Module-&amp;gt;compileDisplay( ) ../Module.php:80&#xA;65  2.8595  35247864  Twig_Compiler-&amp;gt;subcompile( )  ../Module.php:277&#xA;66  2.8595  35247960  Twig_Node-&amp;gt;compile( ) ../Compiler.php:97&#xA;67  2.8595  35247960  Twig_Node-&amp;gt;compile( ) ../Node.php:110&#xA;68  2.8603  35255936  Twig_Node_For-&amp;gt;compile( ) ../Node.php:110&#xA;69  2.8605  35256792  Twig_Compiler-&amp;gt;subcompile( )  ../For.php:83&#xA;70  2.8605  35256840  Twig_Node-&amp;gt;compile( ) ../Compiler.php:97&#xA;71  2.8605  35256840  Twig_Node-&amp;gt;compile( ) ../Node.php:110&#xA;72  2.8620  35261872  Twig_Node_If-&amp;gt;compile( )  ../Node.php:110&#xA;73  2.8623  35262184  Twig_Compiler-&amp;gt;subcompile( )  ../If.php:44&#xA;74  2.8623  35262232  Twig_Node-&amp;gt;compile( ) ../Compiler.php:97&#xA;75  2.8674  35285912  Twig_Node_For-&amp;gt;compile( ) ../Node.php:110&#xA;76  2.8676  35286224  Twig_Compiler-&amp;gt;subcompile( )  ../For.php:83&#xA;77  2.8676  35286272  Twig_Node-&amp;gt;compile( ) ../Compiler.php:97&#xA;78  2.8676  35286272  Twig_Node-&amp;gt;compile( ) ../Node.php:110&#xA;79  2.8679  35287600  Twig_Node_Print-&amp;gt;compile( ) ../Node.php:110&#xA;80  2.8680  35287624  Twig_Compiler-&amp;gt;subcompile( )  ../Print.php:30&#xA;81  2.8680  35287672  Twig_Node_Expression_Filter-&amp;gt;compile( ) ../Compiler.php:97&#xA;82  2.8680  35288600  Twig_Node_Expression_Call-&amp;gt;compileCallable( ) ../Filter.php:37&#xA;83  2.8680  35288664  Twig_Node_Expression_Call-&amp;gt;compileArguments( )  ../Call.php:30&#xA;84  2.8680  35288728  Twig_Compiler-&amp;gt;subcompile( )  ../Call.php:70&#xA;85  2.8680  35288776  Twig_Node_Expression_Filter-&amp;gt;compile( ) ../Compiler.php:97&#xA;86  2.8681  35289600  Twig_Node_Expression_Call-&amp;gt;compileCallable( ) ../Filter.php:37&#xA;87  2.8681  35289656  Twig_Node_Expression_Call-&amp;gt;compileArguments( )  ../Call.php:30&#xA;88  2.8682  35290032  Twig_Compiler-&amp;gt;subcompile( )  ../Call.php:83&#xA;89  2.8682  35290080  Twig_Node_Expression_Array-&amp;gt;compile( )  ../Compiler.php:97&#xA;90  2.8683  35290840  Twig_Compiler-&amp;gt;subcompile( )  ../Array.php:76&#xA;91  2.8683  35290888  Twig_Node_Expression_Filter-&amp;gt;compile( ) ../Compiler.php:97&#xA;92  2.8683  35291712  Twig_Node_Expression_Call-&amp;gt;compileCallable( ) ../Filter.php:37&#xA;93  2.8683  35291776  Twig_Node_Expression_Call-&amp;gt;compileArguments( )  ../Call.php:30&#xA;94  2.8684  35291824  Twig_Compiler-&amp;gt;subcompile( )  ../Call.php:70&#xA;95  2.8684  35291872  Twig_Node_Expression_GetAttr-&amp;gt;compile( )  ../Compiler.php:97&#xA;96  2.8684  35291896  Twig_Compiler-&amp;gt;subcompile( )  ../GetAttr.php:31&#xA;97  2.8684  35291944  Twig_Node_Expression_Name-&amp;gt;compile( ) ../Compiler.php:97&#xA;98  2.8684  35291944  Twig_Node_Expression_Name-&amp;gt;isSpecial( ) ../Name.php:37&#xA;99  2.8684  35291992  Twig_Node-&amp;gt;getAttribute( )  ../Name.php:83&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5019" LastActivityDate="2016-04-14T11:53:25.397" Title="After updating none of my custom fields show" Tags="&lt;error-message&gt;&lt;craft-pro&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14653" PostTypeId="2" ParentId="2599" CreationDate="2016-04-14T09:58:50.940" Score="3" Body="&lt;p&gt;There's a nice plugin by Trevor Davis for this use case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vigetlabs/craft-pendinguser&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vigetlabs/craft-pendinguser&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-14T09:58:50.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14654" PostTypeId="1" AcceptedAnswerId="14656" CreationDate="2016-04-14T10:04:24.337" Score="3" ViewCount="384" Body="&lt;p&gt;Is it possible to choose which plugins appear in the main admin navigation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've installed Entry Count (&lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count&quot; rel=&quot;nofollow&quot;&gt;https://github.com/putyourlightson/craft-entry-count&lt;/a&gt;) and it's now showing in the navigation (under Users). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I'd prefer to just access Entry Count via Settings &gt; Plugins.&lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="144" LastEditDate="2016-04-14T13:50:53.687" LastActivityDate="2016-04-14T13:50:53.687" Title="Plugins in admin navigation" Tags="&lt;plugins&gt;&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14655" PostTypeId="2" ParentId="14654" CreationDate="2016-04-14T10:14:02.477" Score="2" Body="&lt;p&gt;Nothing built-in, but you could hide it using the Control Panel CSS plugin (&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt;) and set it to display those to not display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that plugin your CSS to hide it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#nav-entrycount {display:none;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-14T10:14:02.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14656" PostTypeId="2" ParentId="14654" CreationDate="2016-04-14T10:18:43.580" Score="3" Body="&lt;p&gt;There's a plugin for that by Josh Crawford&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/CPNav&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-14T10:18:43.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14657" PostTypeId="2" ParentId="14652" CreationDate="2016-04-14T11:53:25.397" Score="1" Body="&lt;p&gt;If you are using &lt;code&gt;xdebug&lt;/code&gt;, then it looks like it might be solved by this previous StackOverflow answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/4293870/1809628&quot;&gt;https://stackoverflow.com/a/4293870/1809628&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a nutshell, your &lt;code&gt;php.ini&lt;/code&gt; will have a setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default this is set to 100, so you just need to increase it.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-04-14T11:53:25.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14658" PostTypeId="2" ParentId="14651" CreationDate="2016-04-14T12:19:59.883" Score="2" Body="&lt;p&gt;If I understood you correctly, you have two sections:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;events&lt;/li&gt;&#xA;&lt;li&gt;registrations&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is the user logged in? If yes, you can save the user id in your registration entry. In your events template you can check now, if a registration entry exists that is related to this event and the current user. &#xA;See example code (untested).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;&#xA;   {% set query = &quot;userIdField:&quot;~ currentUser.id %}&#xA;   {% set results = craft.entries({&#xA;      relatedTo: entry.id,&#xA;      section:'registrations'&#xA;      search: query&#xA;   }) %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% if results|length %}&#xA;    user is already registered&#xA;{% else %}&#xA;    show registration form&#xA;{% endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your user is not logged in, you could (temporarily) store the registration information in a cookie (check out this plugin: &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lewisjenkins/craft-lj-cookies&lt;/a&gt;) and do a similar check.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-04-14T12:19:59.883" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14659" PostTypeId="2" ParentId="811" CreationDate="2016-04-14T15:38:44.843" Score="0" Body="&lt;p&gt;I managed to do this for a quiz, getting the row from the url&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theRow = craft.request.getParam('row') %} &#xA;{{entry.matrixField[theRow].body}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just remember zero is the first row.&lt;/p&gt;&#xA;" OwnerUserId="1084" LastActivityDate="2016-04-14T15:38:44.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14661" PostTypeId="1" CreationDate="2016-04-14T22:48:23.890" Score="1" ViewCount="106" Body="&lt;p&gt;I am attempting to strip out &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags around &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags that are automatically getting generated in a WYSIWYG field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The error:&lt;/strong&gt; preg_replace(): &lt;code&gt;Unknown modifier '&amp;amp;gt;'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ story.html|raw|replace('/&amp;lt;p&amp;gt;\s*(&amp;lt;a .*&amp;gt;)?\s*(&amp;lt;img .* \/&amp;gt;)\s*(&amp;lt;\/a&amp;gt;)?\s*&amp;lt;\/p&amp;gt;/iU','\1\2\3') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5021" LastActivityDate="2017-03-07T08:13:10.293" Title="Using 'replace' with a regex is throwing an error. Any ideas why?" Tags="&lt;regex&gt;&lt;wysiwyg&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14662" PostTypeId="2" ParentId="14661" CreationDate="2016-04-15T02:53:17.043" Score="1" Body="&lt;p&gt;I'm not sure what's going on with the &lt;code&gt;story.html&lt;/code&gt; part, but you'll need to double escape your regex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you have an entry already with a &lt;code&gt;story&lt;/code&gt; Rich Text field, it'd look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|raw|replace(&quot;/&amp;lt;p&amp;gt;\\s*(&amp;lt;a .*&amp;gt;)?\\s*(&amp;lt;img .* \\/&amp;gt;)\\s*(&amp;lt;\\/a&amp;gt;)?\\s*&amp;lt;\\/p&amp;gt;/iU&quot;, &quot;\1\2\3&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-15T02:53:17.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14663" PostTypeId="1" AcceptedAnswerId="14669" CreationDate="2016-04-15T09:10:28.687" Score="1" ViewCount="205" Body="&lt;p&gt;Hi I have like 2000 users in my system. I would like to get a count of the active ones, so I did it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{craft.users.group('member').count()}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this returns the count with the limit of 100, so when I remove the limit&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{craft.users.group('member').limit(null).count()}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got this error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /Users/alex/git/website/craft/app/models/BaseModel.php on line 280&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5024" LastActivityDate="2016-04-15T14:15:17.383" Title="Count users, not enough memory error" Tags="&lt;users&gt;&lt;error&gt;&lt;memory&gt;&lt;count&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14664" PostTypeId="1" CreationDate="2016-04-15T09:33:51.683" Score="0" ViewCount="225" Body="&lt;p&gt;Not specifically a Craft problem but I'm struggling to find an answer from Redactors site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got over 100 occurrences of class=&quot;redactor-inline-converted&quot; littered throughout the markup of Rich Text fields. How can I stop Redactor adding this class?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update 2016-04-26&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the steps to recreate this. It's an odd thing between Redactor and Word.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Have styled text in Word with a superscript&lt;/li&gt;&#xA;&lt;li&gt;Copy / paste in to Craft&lt;/li&gt;&#xA;&lt;li&gt;Add some text and format it&lt;/li&gt;&#xA;&lt;li&gt;Check the source and Redactor will add &lt;code&gt;class=&quot;redactor-inline-converted&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This happens randomly on all tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;strong class=&quot;redactor-inline-converted&quot;&amp;gt;&amp;lt;em class=&quot;redactor-inline-converted&quot;&amp;gt;Superscript&amp;lt;/em&amp;gt;&amp;lt;/strong&amp;gt;&#xA;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;em class=&quot;redactor-inline-converted&quot;&amp;gt;list item&amp;lt;/em&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Video example:&#xA;&lt;a href=&quot;http://sendvid.com/h41rosb3&quot; rel=&quot;nofollow&quot;&gt;http://sendvid.com/h41rosb3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1069" LastEditorUserId="1069" LastEditDate="2016-04-26T11:04:34.807" LastActivityDate="2016-04-26T11:04:34.807" Title="Remove/stop 'redactor-inline-converted'" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14665" PostTypeId="2" ParentId="14645" CreationDate="2016-04-15T10:04:22.923" Score="3" Body="&lt;p&gt;After doing a quick search through the Craft app folder I found this method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getEnabledLocalesForElement($variables['entry']-&amp;gt;id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can probably use this and send the EntryModel's id as the parameter&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2016-04-15T10:04:22.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14666" PostTypeId="1" AcceptedAnswerId="14670" CreationDate="2016-04-15T12:43:24.330" Score="1" ViewCount="37" Body="&lt;p&gt;I was doing some design tweaks to the form today, barely touched coding parts and than I went for a test run to see if it submits an entry.&#xA;Everything run as it was on the front end except on the back end I got 3 same entries created with ascending IDs every time an entry is posted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was going through and through the form for hours, but ... aaargh!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has a theory of the issue without seeing the code, post it here please. Otherwise I will submit the code. It's extensive thought.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-04-15T13:07:55.740" LastActivityDate="2016-04-15T14:17:01.323" Title="Three duplicated guest entries posted on form submision" Tags="&lt;guest-entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14669" PostTypeId="2" ParentId="14663" CreationDate="2016-04-15T13:55:44.423" Score="3" Body="&lt;p&gt;Use &lt;code&gt;.total()&lt;/code&gt; instead of &lt;code&gt;.count()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.count()&lt;/code&gt; will query the db and fetch all fields for all items relating to your criteria and then count them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.total()&lt;/code&gt; only counts the number of items your criteria returns without all of their fields. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-04-15T13:55:44.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14670" PostTypeId="2" ParentId="14666" CreationDate="2016-04-15T14:00:17.753" Score="1" Body="&lt;p&gt;The site is running through CodeKit compiler connected to MAMP server. This was odd because it has never happened before with same configurations but When I run the site directly from MAMP server the problem disappeared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have no idea why compiler was causing that.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="57" LastEditDate="2016-04-15T14:17:01.323" LastActivityDate="2016-04-15T14:17:01.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14671" PostTypeId="2" ParentId="14663" CreationDate="2016-04-15T14:15:17.383" Score="0" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/a/14669/57&quot;&gt;Luke's answer&lt;/a&gt;, you might want to consider bumping your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;memory_limit&lt;/a&gt; to something higher than 128M, like 256M.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-04-15T14:15:17.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14672" PostTypeId="2" ParentId="14664" CreationDate="2016-04-15T14:33:04.433" Score="1" Body="&lt;p&gt;Not a solution, but I strip it out as part of a cleanup macro that runs on body text.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro cleanup(string) -%}&#xA;    {%- if string|length -%}&#xA;        {{- string|typogrify|replace('&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/p&amp;gt;','')|replace('redactor-inline-converted','')|raw -}}&#xA;    {%- endif -%}&#xA;{%- endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="57" LastEditDate="2016-04-15T18:54:57.777" LastActivityDate="2016-04-15T18:54:57.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14673" PostTypeId="1" AcceptedAnswerId="14686" CreationDate="2016-04-15T16:30:49.247" Score="2" ViewCount="151" Body="&lt;p&gt;Hi I m using elementapi plugin to create an json object from my elements. I would like to get all entries, but not those ones who have a children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My criteria it looks like this now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'elementType' =&amp;gt; 'Entry',&#xA;'criteria' =&amp;gt; ['section' =&amp;gt; ['pages', 'home']],&#xA;'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this returns all entries. For example I have one single &lt;code&gt;home&lt;/code&gt; and some other pages the result looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home&#xA;About us &amp;lt;- this one has children&#xA;---------&#xA;test1&#xA;test2&#xA;test3&#xA;---------&#xA;Contact us&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to have result like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home&#xA;About us&#xA;Contact us&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to achieve this whit some criteria attribute. I've already tried to add level, like this  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['section'=&amp;gt;['pages','home'], 'level'=&amp;gt;'!=2' ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;not working&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['section'=&amp;gt;['pages','home'], 'level'=&amp;gt;1 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it's working but returns only pages not giving me the home section&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried hasChildren, hasDescendants none of this is working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone can help, thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="5024" LastEditorUserId="57" LastEditDate="2016-04-18T17:11:54.160" LastActivityDate="2016-04-18T17:11:54.160" Title="Is it possible to skip entries with children?" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14674" PostTypeId="1" AcceptedAnswerId="14676" CreationDate="2016-04-15T19:47:57.800" Score="2" ViewCount="641" Body="&lt;p&gt;Very new to Craft CMS...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first route, which i think is very simple, is not working, i'm getting a 404 error.  How can I troubleshoot routing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the URI looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;databases/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Load this template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;library-database-demo-section/index.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5025" LastEditorUserId="57" LastEditDate="2016-04-15T20:05:09.320" LastActivityDate="2016-04-15T20:06:02.427" Title="How to troubleshoot routes" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14675" PostTypeId="1" AcceptedAnswerId="14694" CreationDate="2016-04-15T20:05:39.490" Score="3" ViewCount="236" Body="&lt;p&gt;I have &lt;code&gt;{status}/{category}/{slug}&lt;/code&gt; as the path for uploading photos. When the status changes on the entry, then the photos associated with that entry move to the correct folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it leaves behind empty &lt;code&gt;{category}/{slug}&lt;/code&gt; folders in the &lt;code&gt;{status}&lt;/code&gt; folder it used to sit in. I don't believe it did so when I tried &lt;code&gt;{status}/{slug}&lt;/code&gt; -- is it possible to do this without leaving debris in the previous folders?&lt;/p&gt;&#xA;" OwnerUserId="5020" LastEditorUserId="57" LastEditDate="2016-04-18T17:24:26.103" LastActivityDate="2016-04-18T17:24:26.103" Title="Dynamic Subfolders leaving empty folders behind" Tags="&lt;assets&gt;&lt;upload&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14676" PostTypeId="2" ParentId="14674" CreationDate="2016-04-15T20:06:02.427" Score="4" Body="&lt;p&gt;Remove the &lt;code&gt;/&lt;/code&gt; at the end of &lt;code&gt;databases/&lt;/code&gt; and it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically, &lt;code&gt;index.html&lt;/code&gt; is not required either, so you could just use &lt;code&gt;library-database-demo-section&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-15T20:06:02.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14678" PostTypeId="2" ParentId="14625" CreationDate="2016-04-16T20:14:59.303" Score="3" Body="&lt;h3&gt;Craft 2&lt;/h3&gt;&#xA;&lt;p&gt;Either of these should work (they are equivalent):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.width('&amp;gt; 0').section('windows').order('width') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'windows',&#xA;  order: 'width',&#xA;  width: '&amp;gt; 0'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The reason you are getting &amp;quot;Array to string conversion&amp;quot; error is that &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#find&quot; rel=&quot;nofollow noreferrer&quot;&gt;find&lt;/a&gt; has turned your &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; into an array.&lt;/p&gt;&#xA;&lt;h3&gt;Craft 3&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;order&lt;/code&gt; is now &lt;code&gt;orderBy&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Craft 3 Docs: &lt;a href=&quot;https://craftcms.com/docs/3.x/element-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Queries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="5261" LastEditDate="2020-12-23T19:56:13.560" LastActivityDate="2020-12-23T19:56:13.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14679" PostTypeId="1" AcceptedAnswerId="14682" CreationDate="2016-04-17T22:15:52.563" Score="3" ViewCount="252" Body="&lt;p&gt;I've created a section with a thumbnail image and also a dropdown to allow the user to select the transformation to apply to that image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've pre-created all the asset transformations ready and this is the code I have :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageTransform = storyEntry.storyThumbnailTransform %}&#xA;{% set thumbnailImage = storyEntry.storyThumbnail.first() %}&#xA;&amp;lt;img src=&quot;{{thumbnailImage.url(imageTransform) }}&quot; alt=&quot;&quot; class=&quot;post__preview-img post__preview-img--grid&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, it doesn't appear to be rendering the image. If I output &lt;code&gt;storyEntry.storyThumbnailTransform&lt;/code&gt; to the page, it displays the value of the image transform as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Or is there another way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5031" LastEditorUserId="45" LastEditDate="2016-08-13T02:33:07.790" LastActivityDate="2016-08-13T02:33:07.790" Title="Using Image Transform as another custom field" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14681" PostTypeId="2" ParentId="10241" CreationDate="2016-04-18T02:34:57.250" Score="8" Body="&lt;p&gt;Someone has recently developed a standalone static HTML caching plugin for Craft CMS which does similar to what you're after:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftapi/htmlcache&quot;&gt;HTML Cache plugin for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Craft plugin will generate static HTML files for your website. No need for Reddis/Varnish setups anymore!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Improves the speed drastically: 300-1500MS to 2-50MS (depending on&#xA;server setup) if ubercache is enabled from the settings page &lt;/li&gt;&#xA;&lt;li&gt;Busts the cache automatically when an entry has been updated &lt;/li&gt;&#xA;&lt;li&gt;Cache duration time can be set; defaults to 3600 seconds (1 hour)&lt;/li&gt;&#xA;&lt;li&gt;Active development and support through Craft's Slack&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;NOTE: This plugin is still in beta, so please test if this plugin works as expected on a development environment before pushing to a production site.&lt;/p&gt;&#xA;" OwnerUserId="4890" LastActivityDate="2016-04-18T02:34:57.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14682" PostTypeId="2" ParentId="14679" CreationDate="2016-04-18T05:38:11.853" Score="8" Body="&lt;p&gt;The &lt;code&gt;imageTransform&lt;/code&gt; value is actually an object, representing the entire dropdown field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update the first line to this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageTransform = storyEntry.storyThumbnailTransform.value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will ensure that the selected &lt;strong&gt;value&lt;/strong&gt; is passed on, instead of the full object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The reason that you see the proper value when you output it directly is because the object's &lt;code&gt;__toString&lt;/code&gt; method is automatically being called internally.)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-04-18T05:38:11.853" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14683" PostTypeId="2" ParentId="14679" CreationDate="2016-04-18T06:58:43.480" Score="0" Body="&lt;p&gt;Do you not still have to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for asset in thumbnailImage %}&#xA;            &amp;lt;img src=&quot;{{ asset.getUrl(imageTransform) }}&quot; alt=&quot;&quot; class=&quot;post__preview-img post__preview-img--grid&quot;&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-04-18T06:58:43.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14685" PostTypeId="1" AcceptedAnswerId="14687" CreationDate="2016-04-18T07:45:11.837" Score="3" ViewCount="275" Body="&lt;p&gt;I've just realised that when I duplicate my boilerplate Craft site to start a new client project, I haven't been deleting the license.key file as per the &lt;a href=&quot;https://craftcms.com/support/duplicating-a-craft-site&quot; rel=&quot;nofollow&quot;&gt;docs here&lt;/a&gt;. What are the potential problems here? Does Craft regenerate a key file if it's already used, or have I somehow licensed a single key multiple times?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-04-18T09:19:39.480" Title="Have I accidentally relicensed my key?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14686" PostTypeId="2" ParentId="14673" CreationDate="2016-04-18T09:18:58.713" Score="1" Body="&lt;p&gt;So after some rest, I did find the solution as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['section' =&amp;gt; ['pages', 'home'], 'level'=&amp;gt;array(null,1)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me the desire result.&lt;/p&gt;&#xA;" OwnerUserId="5024" LastActivityDate="2016-04-18T09:18:58.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14687" PostTypeId="2" ParentId="14685" CreationDate="2016-04-18T09:19:39.480" Score="4" Body="&lt;p&gt;You should have seen a warning that the license belongs to another domain (&lt;a href=&quot;https://craftcms.com/support/license-transferring&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/license-transferring&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not; are these duplicate sites still on a non-public (development) domain? That might explain why you did not see the warning. In either case: simply delete the license file for the duplicate sites and Craft will create a new one. You might need to clear the caches as well.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-04-18T09:19:39.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14688" PostTypeId="1" CreationDate="2016-04-18T09:22:46.780" Score="0" ViewCount="1736" Body="&lt;p&gt;I have setup a site with a symlinked dir on nginx ubuntu server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I access the root of the site I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/usr/share/nginx/html/releases/*********/craft/storage isn't writable by PHP. Please fix that.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my structure I have a folder called current that gets symlinked to the new deployed site in releases and then current should point to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed some light on what might be happening here and how I can set the write permissions to the symlinked dir? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Mark&lt;/p&gt;&#xA;" OwnerUserId="5033" LastEditorUserId="45" LastEditDate="2016-08-13T02:47:58.160" LastActivityDate="2016-08-13T02:47:58.160" Title="How possible is it to set write permissions on storage folder on symlinked install?" Tags="&lt;config&gt;&lt;install&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14689" PostTypeId="2" ParentId="10632" CreationDate="2016-04-18T11:17:00.497" Score="4" Body="&lt;p&gt;A simple way to check that a plugin is both installed and enabled is to use Twig's &lt;code&gt;is defined&lt;/code&gt; test (since &lt;code&gt;craft.pluginHandle&lt;/code&gt; is defined only if the plugin is both installed and enabled):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.pluginHandle is defined %}&#xA;  ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Credit due to &lt;a href=&quot;https://craftcms.stackexchange.com/a/7028/328&quot;&gt;this answer&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-04-18T11:17:00.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14690" PostTypeId="1" CreationDate="2016-04-18T11:50:39.843" Score="2" ViewCount="993" Body="&lt;p&gt;Is there an easy way to access global sets from an &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; endpoint, so its content can be included in the JSON response?&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-18T11:50:39.843" Title="Accessing global sets from Element API" Tags="&lt;plugin-elementapi&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14691" PostTypeId="2" ParentId="14690" CreationDate="2016-04-18T11:50:39.843" Score="4" Body="&lt;p&gt;Since Global Sets are elements just like entries, users, etc., you can create API endpoints that are all about them:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'globals/&amp;lt;handle:\w+&amp;gt;' =&amp;gt; function($handle) {&#xA;    return [&#xA;        'elementType' =&amp;gt; 'GlobalSet',&#xA;        'criteria' =&amp;gt; ['handle' =&amp;gt; $handle],&#xA;        'first' =&amp;gt; true,&#xA;        'transformer' =&amp;gt; function(\Craft\GlobalSetModel $globalSet) {&#xA;            return [&#xA;                'foo' =&amp;gt; $globalSet-&amp;gt;foo,&#xA;                'bar' =&amp;gt; $globalSet-&amp;gt;bar,&#xA;            ];&#xA;        }&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also manually query for Global Sets, to include their data in an endpoint that’s tied to another element type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'my/other/endpoint' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    // ...&#xA;    'transformer' =&amp;gt; function(\Craft\EntryModel $globalSet) {&#xA;        // ...&#xA;&#xA;        // Fetch a global set&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::GlobalSet);&#xA;        $criteria-&amp;gt;handle = 'myHandle';&#xA;        $myGlobalSet = $criteria-&amp;gt;first();&#xA;&#xA;        // Include the global set content in the response data&#xA;        return [&#xA;            // ...&#xA;            'foo' =&amp;gt; $myGlobalSet-&amp;gt;foo,&#xA;            'bar' =&amp;gt; $myGlobalSet-&amp;gt;bar,&#xA;        ]&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft also provides a couple methods for fetching Global Sets by ID or handle, so if that happens to be exactly what you need, feel free to use those:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/GlobalsService#getSetById-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;globals-&gt;getSetById()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/GlobalsService#getSetByHandle-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;globals-&gt;getSetByHandle()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-18T11:50:39.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14692" PostTypeId="2" ParentId="2629" CreationDate="2016-04-18T12:30:00.200" Score="3" Body="&lt;p&gt;I just came across this question, for the sake of up to date info for others, it is now possible to do this with the latest release(1.7) of the ContactForm plugin from Pixel &amp;amp; Tonic:&#xA;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fromCompany&quot; type=&quot;text&quot; name=&quot;message[fromCompany]&quot; value=&quot;{% if message is defined %}{{ message.messageFields.['fromCompany'] }}{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4077" LastActivityDate="2016-04-18T12:30:00.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14693" PostTypeId="1" CreationDate="2016-04-18T13:04:27.337" Score="0" ViewCount="148" Body="&lt;p&gt;I'm having trouble logging in to the admin panel if I set &lt;code&gt;omitScriptNameInUrls&lt;/code&gt; to true in the general config file. The login works well on a subdomain, which is odd. It seems that asset loading is messed up with that setting. Random files seems to be broken with an 500 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tested in incognito mode, no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YORiR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YORiR.png&quot; alt=&quot;Js error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen other admin login error questions here, but I had no luck with them. &lt;/p&gt;&#xA;" OwnerUserId="4755" LastEditorUserId="4755" LastEditDate="2016-04-18T13:50:10.577" LastActivityDate="2016-04-18T13:50:10.577" Title="omitScriptNameInUrls breaks admin asset loading" Tags="&lt;admin&gt;&lt;login&gt;&lt;bug&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14694" PostTypeId="2" ParentId="14675" CreationDate="2016-04-18T13:55:44.043" Score="3" Body="&lt;p&gt;When Assets moves files around because of dynamic Assets folder changes, it does not remove empty folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the surface it seems like a no-brainer - just check if the folder is empty and if so, then nuke it! But if you go deeper, it gets complicated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should the physical folder be removed as well? If not, then the next time you index Assets, the folder will be reinstated. If yes, then what to do if there are unindexed files in there? Remove anyway? That's destructive. Don't remove? Then that makes Craft behave differently based on something that is out of its scope. What would users want in this case? Who knows!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see, it's a bit tricky especially in terms of what the users would expect out of that functionality, so we just instead decided to go with leaving empty folder, as the folder path changing should not be that often of an occurrence and does not set us up for complex support tickets down the road.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="57" LastEditDate="2016-04-18T17:24:01.803" LastActivityDate="2016-04-18T17:24:01.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14695" PostTypeId="1" AcceptedAnswerId="14701" CreationDate="2016-04-18T15:45:31.283" Score="2" ViewCount="131" Body="&lt;p&gt;Is there a way to have a dynamic notification subject in Sprout Forms via custom fields, eg if I have a field called &lt;code&gt;subject&lt;/code&gt; can I use this in the Subject option under Notifications as &lt;code&gt;{{ subject }}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="115" LastEditDate="2016-04-18T18:40:23.587" LastActivityDate="2017-03-07T14:38:18.420" Title="Dynamic subject for form notification email" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14696" PostTypeId="1" CreationDate="2016-04-18T16:01:32.713" Score="5" ViewCount="2172" Body="&lt;p&gt;Redactor I had a feature that allowed editing of image alignment (via the image popup) and size (by dragging the square bounding box), is it possible to enable this functionality in Redactor II?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something that can be done with &lt;code&gt;formattingAdd&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QhjnB.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhjnB.png&quot; alt=&quot;example of Redactor 1 image editing controls&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5036" LastActivityDate="2017-02-27T00:06:16.490" Title="Image alignment and size in Redactor 2" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14697" PostTypeId="1" CreationDate="2016-04-18T17:30:13.820" Score="1" ViewCount="81" Body="&lt;p&gt;I have a situation where I'd like to have an entry exist with a particular URL structure by placing it within an existing structure. Let's say this URI is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/one/two/three&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 'three' is the entry I've created in the CP. Currently, this structure uses this section's template, but I'd like to use a unique template for this single entry within the section. My first thought was to create a Dynamic Route that points this URI to the unique template, but that doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that Craft has a checklist of items for routing and a section's template will be checked for first, and if that exists, it gets loaded. Is it possible to override this and load a unique template for a single entry in a section?&lt;/p&gt;&#xA;" OwnerUserId="5037" LastActivityDate="2016-04-18T17:30:13.820" Title="Overriding Craft's default routing process" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-04-18T18:13:19.857" ContentLicense="CC BY-SA 3.0" />
  <row Id="14698" PostTypeId="1" AcceptedAnswerId="14699" CreationDate="2016-04-18T17:31:13.420" Score="2" ViewCount="1259" Body="&lt;p&gt;I am attempting to build an application where Craft handles all of the API based data (JSON). I am using the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt;. I can't find an example anywhere online that outputs Users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to output some basics first before I start outputting the custom Matrix fields etc. Here is my &lt;code&gt;elementapi.json&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'players.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; ['group' =&amp;gt; 'player'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry){&#xA;                return [&#xA;                    'username' =&amp;gt; $entry-&amp;gt;$username,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;player/{$entry-&amp;gt;id}.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help or an example with some custom matrix user fields would be much appreciated! Thanks a bunch!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastEditorUserId="57" LastEditDate="2016-04-18T17:36:05.863" LastActivityDate="2016-04-18T17:47:47.497" Title="Element API User example" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14699" PostTypeId="2" ParentId="14698" CreationDate="2016-04-18T17:45:06.370" Score="2" Body="&lt;p&gt;If you set the &lt;code&gt;elementType&lt;/code&gt; to &lt;code&gt;User&lt;/code&gt;, then the transformer will have a &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;UserModel&lt;/code&gt;&lt;/a&gt; object passed in like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'players.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; ['group' =&amp;gt; 'player'],&#xA;            'transformer' =&amp;gt; function(\Craft\UserModel $user) {&#xA;                return [&#xA;                    'username' =&amp;gt; $user-&amp;gt;username,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;player/{$user-&amp;gt;id}.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-18T17:47:47.497" LastActivityDate="2016-04-18T17:47:47.497" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14700" PostTypeId="2" ParentId="14688" CreationDate="2016-04-18T18:05:52.417" Score="1" Body="&lt;p&gt;Symlinks don't really have &lt;a href=&quot;https://superuser.com/a/303063&quot;&gt;permissions&lt;/a&gt; themselves. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had to hazard a guess, it sounds like your deployment script isn't setting the correct permissions on the &lt;code&gt;craft/storage&lt;/code&gt; directory, maybe because they're being recreated every time you deploy? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you have a couple options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;set the permissions on that directory correctly (see the above link) after you deploy&lt;/li&gt;&#xA;&lt;li&gt;change your deployment strategy a bit.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If it were me, I'd tell the build/deploy script to &lt;a href=&quot;https://craftcms.com/support/craft-storage-gitignore&quot; rel=&quot;nofollow noreferrer&quot;&gt;ignore&lt;/a&gt; the &lt;code&gt;craft/storage&lt;/code&gt; directory altogether. Setup your own &lt;code&gt;storage&lt;/code&gt; folder that won't be touched by your deploy script (say above the releases folder) after you deploy. Then just &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-storage-path&quot; rel=&quot;nofollow noreferrer&quot;&gt;tell Craft&lt;/a&gt; to use that location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the symlink actually pointing to? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could really deploy anywhere on the server too, not just in the typical nginx web root. (I prefer not to even touch the default distro locations because any update could modify your web files.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to go down the path of permissions, it gets a little murkier. I don't have a ton of experience with something like Capistrano (or whatever deployment system you're using) but your deploy user needs to have &lt;code&gt;sudo&lt;/code&gt; permission to be able to change the permissions so your PHP user—likely the same user as the nginx user but not the same as the deploy user—can write to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way around this is PHP-FPM. Setup a new fpm pool with the user/group of the deploy user then add whatever user you're running nginx as to that user's group (eg &lt;code&gt;usermod -a -G deploy-user www-data&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will let nginx read files from the deploy user but let FPM write to the folder because it owns it. Then you won't have to worry as much about after-deployment permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also cheap jail if you set it up properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you're running Apache as &lt;code&gt;mod_php&lt;/code&gt; with nginx in front of it, it'd be a similar setup.)&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-03-20T10:18:35.480" LastActivityDate="2016-04-18T18:05:52.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14701" PostTypeId="2" ParentId="14695" CreationDate="2016-04-18T18:39:56.137" Score="2" Body="&lt;p&gt;Yes.  You can use the value of your custom field &lt;code&gt;subject&lt;/code&gt; in two ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shorthand Syntax:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{subject}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Object Syntax&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.subject }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to perform any conditional logic, you will need to use object syntax for the conditional logic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.subject != '' %}{{ object.subject }}{% else %}Fallback{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="294" LastEditDate="2017-03-07T14:38:18.420" LastActivityDate="2017-03-07T14:38:18.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14702" PostTypeId="1" AcceptedAnswerId="14706" CreationDate="2016-04-18T20:56:54.393" Score="5" ViewCount="1489" Body="&lt;p&gt;We're looking at various CMSs for our large 11,000+ page website. We'd like to use a CMS that is appropriate for sites of that size and that will give us room to grow without impacting site speed, page load time, etc. I see other questions on this forum regarding site size, but all use CraftCMS terminology, such as 'channels', 'structures', etc to describe size.&#xA;How can CraftCMS size capability be described in pages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="5038" LastEditorUserId="22" LastEditDate="2017-05-09T22:04:04.583" LastActivityDate="2017-05-09T22:04:04.583" Title="Is Craft suitable for large websites?" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14703" PostTypeId="2" ParentId="14623" CreationDate="2016-04-18T23:42:56.727" Score="1" Body="&lt;p&gt;So this works. Now that I have the understanding of how things fire I can clean this up. I am open to better solutions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event)&#xA;    {   &#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];    &#xA;        if($event-&amp;gt;params['isNewEntry'] &amp;amp;&amp;amp; $entry-&amp;gt;getSection() == 'Episode')&#xA;&#xA;        {&#xA;&#xA;        require_once(craft()-&amp;gt;path-&amp;gt;getPluginsPath().'cranberry/vendor/soundcloud/autoload.php');&#xA;&#xA;        $clientID       =   'xxxxxxxxxxxxxxx';&#xA;        $clientSecret   =   'xxxxxxx';&#xA;        $username       =   'xxxx';&#xA;        $password       =   'xxxx';&#xA;&#xA;        $facade = new \Njasm\Soundcloud\SoundcloudFacade($clientID, $clientSecret);&#xA;        $facade-&amp;gt;userCredentials($username, $password); &#xA;&#xA;        $mp3File = $entry-&amp;gt;mp3File-&amp;gt;first()-&amp;gt;filename;&#xA;        $url = $entry-&amp;gt;mp3File-&amp;gt;first()-&amp;gt;getUrl();&#xA;&#xA;        $mp3TempFile = &quot;/var/www/pathway/craft/storage/tmp/&quot;.$mp3File;&#xA;&#xA;        // download the file from amazon s3 and push it to soundcloud&#xA;        $fp = file_put_contents($mp3TempFile, fopen($url, 'r'));&#xA;&#xA;        $params = array(&#xA;            'track[title]' =&amp;gt; iconv('UTF-8', 'ASCII//TRANSLIT', $entry-&amp;gt;title),&#xA;            'track[sharing]' =&amp;gt; 'public',&#xA;            //'track[asset_data]' =&amp;gt; $mp3Filepath,&#xA;            'track[description]' =&amp;gt; iconv('UTF-8', 'ASCII//TRANSLIT', strip_tags($entry-&amp;gt;summary)),&#xA;            'track[track_type]' =&amp;gt; 'podcast',&#xA;            'track[genre]' =&amp;gt; 'Learning',&#xA;            'track[license]' =&amp;gt; 'all-rights-reserved'&#xA;            );&#xA;&#xA;        $response = $facade-&amp;gt;upload($mp3TempFile, $params);&#xA;        $fp = unlink($mp3TempFile);&#xA;&#xA;        } &#xA;&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-18T23:42:56.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14704" PostTypeId="1" CreationDate="2016-04-19T02:41:37.193" Score="0" ViewCount="569" Body="&lt;p&gt;I was using the FeedMe plugin engram-design to move my podcast xml items to entries in a podcast section I tried running a task to update some entries and it broke my site. Now I am unable to access the admin portion of my site. I receive the following error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Class 'Craft\FeedMe_FeedModel' not found in /www/sites/mywebsite/craft/app/helpers/ModelHelper.php on line 587&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried replacing the app folder with a fresh copy, but nothing. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="4881" LastActivityDate="2016-04-19T04:40:29.283" Title="FeedMe plugin broke Craft" Tags="&lt;php&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14705" PostTypeId="2" ParentId="14704" CreationDate="2016-04-19T04:40:29.283" Score="3" Body="&lt;p&gt;You'll be able to get better/quicker help through the plugin page and submitting an issue - &lt;a href=&quot;https://github.com/engram-design/FeedMe/issues&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe/issues&lt;/a&gt;. I'd be happy to help and see what might be the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you could, please follow the Support steps as outlined here - &lt;a href=&quot;https://github.com/engram-design/FeedMe#support&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/FeedMe#support&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-04-19T04:40:29.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14706" PostTypeId="2" ParentId="14702" CreationDate="2016-04-19T06:26:28.843" Score="3" Body="&lt;p&gt;Yes, absolutely. Craft have some case studies which illustrate that top brands trust them to handle large amounts of content while making it &lt;strong&gt;easy to publish&lt;/strong&gt; more: &lt;a href=&quot;https://craftcms.com/news/case-studies&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/news/case-studies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second point is a huge selling point for a good CMS. If your publishing process is difficult or confusing then you as an admin/client become frustrated. Craft is fast and easy to digest from a publishers point of view. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Wes mentioned relationships)&#xA;By design, you should only need to add a piece of content to your CMS once - and then 'relate' different entries together as new ones are published. e.g. A new '&lt;strong&gt;Service&lt;/strong&gt;' (entry) is related to an '&lt;strong&gt;office location&lt;/strong&gt;' (entry) where that service is provided.  Then, when a visitor is viewing that office location they are able to see any services which may be available there. (Just a simplified example)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Planning and designing what your content-types consist of and how different types of content can work together to tell a story to a visitor - will mitigate any major shifts in direction which often happen on-the-fly (the most expensive way to build a website). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Coming back to your question.&lt;/strong&gt; &#xA;Craft is very good at storing your content efficiently. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft uses Twig as a template language, which requests content from Craft. The trick is to only tell Twig to get what you need for any given page. This isn't hard once you understand the approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are also uploaded &lt;strong&gt;once&lt;/strong&gt; and then re-saved (&lt;a href=&quot;https://craftcms.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;image transforms)&lt;/a&gt; into different sizes as they are used differently through your site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect is that instead of slowly trying to load an image which is large in size, a small image is loaded quickly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. I'm sure you'll get more answers too... &lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-04-25T12:22:47.780" LastActivityDate="2016-04-25T12:22:47.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14707" PostTypeId="2" ParentId="811" CreationDate="2016-04-19T08:41:53.757" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% set block = entry.bodyRepeater.nth(2) %}&#xA;&#xA;{% if block %}&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft 2.2 introduced the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#nth&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;nth&lt;/code&gt;&lt;/a&gt; method to ElementCriteriaModel objects for fetching the element at a specific offset.&#xA;It's more convienient to use this instead of a combination of the undocumented &lt;code&gt;offsetExists&lt;/code&gt; and &lt;code&gt;findElementAtOffset&lt;/code&gt; methods.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-19T08:41:53.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14708" PostTypeId="1" CreationDate="2016-04-19T09:07:19.920" Score="2" ViewCount="72" Body="&lt;p&gt;I would like to render the DateTime fields in the backend with european time format, even though the user I'm logged in with is set to English/US.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j8dt0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j8dt0.png&quot; alt=&quot;DateTime field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="125" LastEditDate="2016-04-19T10:18:28.590" LastActivityDate="2016-04-19T10:18:28.590" Title="Separate time settings from user locale?" Tags="&lt;localization&gt;&lt;control-panel&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14709" PostTypeId="1" CreationDate="2016-04-19T09:35:27.600" Score="1" ViewCount="52" Body="&lt;p&gt;I am trying to change custom field values of a existing entry, but it won't save them in the database. It saves it on the model but the entry isn't persisted to the database.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('guestEntries.success', function(GuestEntriesEvent $event) {&#xA;    if (!$event-&amp;gt;fakeIt)&#xA;    {&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;        if ($entryModel-&amp;gt;section-&amp;gt;handle == &quot;aanvragen&quot;)&#xA;        {&#xA;            $form = $entryModel-&amp;gt;formulier-&amp;gt;first();&#xA;            if ($form)&#xA;            {&#xA;                // get all entries with that form&#xA;                $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;                $criteria-&amp;gt;section = &quot;aanvragen&quot;;&#xA;                $criteria-&amp;gt;relatedTo = array(&#xA;                    'targetElement' =&amp;gt; $form&#xA;                );&#xA;&#xA;                $total = strval($criteria-&amp;gt;total());&#xA;&#xA;                $form-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                    'aantalAanvragen' =&amp;gt; $total&#xA;                ));&#xA;&#xA;                craft()-&amp;gt;entries-&amp;gt;saveEntry($form);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This for example &lt;code&gt;$form-&amp;gt;setAttribute('slug', &quot;testtestetst&quot;);&lt;/code&gt; won't work.&#xA;Is there something i am missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that it was sticking on entry validation upon saving. There are some fields required. However these fields are already filled in, in the CP, i just want to update one field on a EntryModel is there a way to just do this.&lt;/p&gt;&#xA;" OwnerUserId="4077" LastEditorUserId="125" LastEditDate="2016-04-19T10:44:02.760" LastActivityDate="2016-04-19T10:44:02.760" Title="Change existing EntryModel custom attribute values" Tags="&lt;plugin-development&gt;&lt;entrymodel&gt;&lt;events&gt;&lt;attribute&gt;&lt;plugin-guestentries&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-04-21T08:13:56.430" ContentLicense="CC BY-SA 3.0" />
  <row Id="14710" PostTypeId="2" ParentId="14708" CreationDate="2016-04-19T09:56:14.113" Score="2" Body="&lt;p&gt;No, there's currently no setting to choose your preferred date and time format. What you can do though, is to hack your craft/app/framework/i18n/data/en_us.php&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'dateFormats' =&amp;gt; array (&#xA;    'full' =&amp;gt; 'EEEE, d. MMMM y',&#xA;    'long' =&amp;gt; 'd. MMMM y',&#xA;    'medium' =&amp;gt; 'dd.MM.y',&#xA;    'short' =&amp;gt; 'dd.MM.yy',&#xA;),&#xA;'timeFormats' =&amp;gt; array (&#xA;    'full' =&amp;gt; 'HH:mm:ss zzzz',&#xA;    'long' =&amp;gt; 'HH:mm:ss z',&#xA;    'medium' =&amp;gt; 'HH:mm:ss',&#xA;    'short' =&amp;gt; 'HH:mm',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-19T09:56:14.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14711" PostTypeId="1" CreationDate="2016-04-19T13:33:29.597" Score="3" ViewCount="754" Body="&lt;p&gt;As per the flow diagram below I want to restrict access for users outside my network. However rather then completely stopping external access I want them to be redirected to a login page where they will be required to login via google, there email address will have to be within the organisation to be granted access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help/advice much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://dl.dropboxusercontent.com/u/74074387/2016-04-19.png&quot; alt=&quot;flow diagram&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5041" LastActivityDate="2016-04-19T20:32:59.730" Title="Restricted front-end access" Tags="&lt;login&gt;&lt;authentication&gt;&lt;plugin-social-login&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14712" PostTypeId="2" ParentId="14711" CreationDate="2016-04-19T20:25:14.077" Score="3" Body="&lt;p&gt;Is the physical web server inside your network as well? As mcclaskiem mentioned,  check to see if the IP address is within the subnet of your network and then allow access that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to have the web server listen on another hostname that's not accessible outside the network and allow access to that vhost unconditionally (but do that at the firewall level). The would be the securest way to allow access within your network without logging in. &lt;a href=&quot;https://security.stackexchange.com/questions/4533/in-what-scenarios-is-relying-on-source-ip-address-as-a-security-control-acceptab&quot;&gt;IP addresses can be spoofed&lt;/a&gt; with varying threat so I'd be wary of allowing anyone to authenticate via just an IP Address if your webserver is located off-premise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dealing with google auth on the &quot;other side&quot; would obviously require a plugin for people attempting to connect outside the network.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5042/does-craft-support-a-custom-authentication-backend-for-admin&quot;&gt;another thread&lt;/a&gt; for further reading.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-04-19T20:32:59.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14713" PostTypeId="2" ParentId="14711" CreationDate="2016-04-19T20:25:38.090" Score="3" Body="&lt;p&gt;Sounds like a &lt;a href=&quot;http://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;custom plugin&lt;/a&gt; is in order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin could add a custom &lt;code&gt;{% validateUser %}&lt;/code&gt; Twig tag. That tag would check to see if their logged in OR check &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getIpAddress-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.request.getIpAddress()&lt;/code&gt;&lt;/a&gt; and validate against your internal IP whitelist for your company. You should read the notes on that link, though, since this isn't guaranteed to be secure. It's trivial to spoof these in many circumstances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it passes the check, send them on their merry way to the homepage, otherwise, redirect to your social login page, have them login and send to the homepage.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-19T20:25:38.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14714" PostTypeId="1" AcceptedAnswerId="14728" CreationDate="2016-04-19T20:30:00.853" Score="4" ViewCount="606" Body="&lt;p&gt;I've updated several Assets Sources on my production site. I've exported / imported the database from production into local - the new Assets Sources are in place but the asset thumbs are now missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get Craft to re-generate these please?&lt;/p&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2018-01-19T08:55:11.413" Title="Asset thumbs missing in control panel after Assets Source update" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;image&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14715" PostTypeId="2" ParentId="14714" CreationDate="2016-04-19T20:43:02.547" Score="2" Body="&lt;p&gt;I've had this issue before, and it was always either:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Needed to update the URL in Settings &gt; General&lt;/li&gt;&#xA;&lt;li&gt;Needed to change permissions on thumbs directory.&lt;/li&gt;&#xA;&lt;li&gt;Needed to delete thumbs directory.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5043" LastActivityDate="2016-04-19T20:43:02.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14716" PostTypeId="1" AcceptedAnswerId="14721" CreationDate="2016-04-19T20:43:03.380" Score="3" ViewCount="940" Body="&lt;p&gt;I have been using the ids() method on the ElementCriteriaModel returned by a call to an entries field within a Twig template to return an array of ids for further processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wish to eager-load these entries, but the entries are returned as an array with no access to the ids() method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an efficient way to get this array of ids within Twig, or would I be better moving this to a plugin?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2016-04-20T02:19:04.250" Title="Getting an array of ids from an array of eager-loaded elements within Twig" Tags="&lt;templating&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14717" PostTypeId="2" ParentId="14714" CreationDate="2016-04-19T20:43:07.850" Score="3" Body="&lt;p&gt;Go to Settings &gt; Clear Caches. Should regenerate them all from the new source.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-04-19T20:43:07.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14718" PostTypeId="1" AcceptedAnswerId="14719" CreationDate="2016-04-19T20:43:10.517" Score="0" ViewCount="186" Body="&lt;p&gt;Is it possible to add additional fields to the image popup in redactor? In addition to Title, Caption and Link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lCTsN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lCTsN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5036" LastActivityDate="2016-04-25T11:21:51.947" Title="Add fields to image popup" Tags="&lt;assets&gt;&lt;field&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14719" PostTypeId="2" ParentId="14718" CreationDate="2016-04-19T21:24:14.247" Score="1" Body="&lt;p&gt;I don't think there is a way without hacking Redactor or adding a custom Redactor plugin that mimics/extends the existing Image/Link button functionality.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-19T21:24:14.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14720" PostTypeId="1" AcceptedAnswerId="14723" CreationDate="2016-04-19T21:46:02.900" Score="0" ViewCount="70" Body="&lt;p&gt;When {% cache %} in conjunction with {% include ... %} is it better to wrap the Cache outside of the include or put inside of the included file?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% include %}&#xA;{% endcache %}&#xA;&#xA;or&#xA;&#xA;{% include &quot;...&quot; %} &#xA;&#xA;with the cache directives inside the include file?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assume for this question that the entire contents of the include file will be cached (complex nav).&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2016-04-19T22:56:51.383" Title="Cache Order and Priority" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14721" PostTypeId="2" ParentId="14716" CreationDate="2016-04-19T21:52:00.187" Score="3" Body="&lt;p&gt;You would just loop the entry models to collect the IDs (looks ugly, but it's a simple and efficient for loop). But in case you do not need anything else from the models, I'd actually expect your previous approach using the &lt;code&gt;ids&lt;/code&gt; method to have better performance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = [] %}&#xA;{% for entry in entry.myEagerLoadedEntries %}&#xA;    {% set ids = ids|merge([entry.id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-19T21:52:00.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14722" PostTypeId="1" CreationDate="2016-04-19T22:38:27.090" Score="1" ViewCount="41" Body="&lt;p&gt;Is it possible to add a related matrix field and show the first entry in that field on the &lt;a href=&quot;http://domain.com/admin/entries&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/admin/entries&lt;/a&gt; section of the control panel?&lt;/p&gt;&#xA;" OwnerUserId="5044" LastEditorUserId="45" LastEditDate="2016-08-13T02:41:20.783" LastActivityDate="2016-08-13T02:41:20.783" Title="Can Matrix fields be added/shown on the entries listing of the control panel?" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14723" PostTypeId="2" ParentId="14720" CreationDate="2016-04-19T22:50:58.687" Score="2" Body="&lt;p&gt;It doesn't really matter where you have the tags. Yes, you do save the overhead of the include by wrapping the tag, but the impact is minimal (not really measurable) and once compiled to PHP it's cached anyways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I usually have the cache tags &lt;em&gt;within&lt;/em&gt; my partials. It's more flexible, you can cache blocks of code separately and leave out certain parts. I also often use the &lt;code&gt;globally&lt;/code&gt; flag and include a partial into multiple templates. Defining the cache tag within the partial makes sure I always use the right cache ID.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-04-19T22:56:51.383" LastActivityDate="2016-04-19T22:56:51.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14724" PostTypeId="2" ParentId="14722" CreationDate="2016-04-19T23:50:29.077" Score="1" Body="&lt;p&gt;That's not possible, Matrix blocks (and also Tags) don't have an element index view in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a plugin that adds such a page to the CP. It would list all the Matrix blocks that meet your requirements (owner ID, owner entry, ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea would be to just use an Entries field instead; the entries section you'd set up for the field comes with an index view for free.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-19T23:50:29.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14725" PostTypeId="2" ParentId="14716" CreationDate="2016-04-20T02:19:04.250" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#indexBy&quot; rel=&quot;nofollow&quot;&gt;indexBy&lt;/a&gt; parameter and the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/keys.html&quot; rel=&quot;nofollow&quot;&gt;keys&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Using indexBy updates the results array to be indexed by the Element ID&#xA;   instead of a consecutively numbered array #}&#xA;{% set entries = craft.entries.section('news').with(['featuredImage']).indexBy('id') %}&#xA;&#xA;{# The keys filter returns an array of all the keys within an array,&#xA;   discarding the values #}&#xA;{% set entryIds = entries|keys %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would give you an array of the Element IDs that were retrieved.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-20T02:19:04.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14726" PostTypeId="1" AcceptedAnswerId="14736" CreationDate="2016-04-20T02:24:57.353" Score="0" ViewCount="119" Body="&lt;p&gt;I'm still new to CraftCMS and still learning about site structure. The site that I am asking about below is not (yet?) in CraftCMS:&#xA;Our site is composed of many subsites which have different users contributing to them. Would it be possible within CraftCMS to restrict a user's login to only viewing the content that they can edit (ie- within their 'subsite' area)? I say viewing (not editing) since we have a LOT of content and I'd like to keep the content accessibility separate for different users to prevent confusion.&lt;/p&gt;&#xA;" OwnerUserId="5038" LastActivityDate="2016-04-20T17:53:21.750" Title="Craft User Permissions in subsites" Tags="&lt;users&gt;&lt;sections&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14728" PostTypeId="2" ParentId="14714" CreationDate="2016-04-20T09:34:43.937" Score="3" Body="&lt;p&gt;My basePath was wrong in my config (due to a DropBox syncing issues). Once I corrected that and cleared caches, the asset thumbs reappeared.&lt;/p&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2016-04-20T09:34:43.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14729" PostTypeId="1" CreationDate="2016-04-20T09:44:45.773" Score="0" ViewCount="100" Body="&lt;p&gt;I want to edit the registration form on my site. I have set up new fields and added it to the field layout under setting. However, the changes still don't appear on the registration form. Another problem is that the registration form is not an entry. Under the menu bar, the registration form seems to be just an added URL. Please help.&lt;/p&gt;&#xA;" OwnerUserId="5048" LastActivityDate="2016-04-20T16:34:48.067" Title="How to edit registration form fields?" Tags="&lt;form&gt;&lt;field&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14731" PostTypeId="1" CreationDate="2016-04-20T14:29:40.483" Score="1" ViewCount="518" Body="&lt;p&gt;I have a site with a few channels each with a lot of entries. When retrieving the results from a site search, I’d like to show a paginated list of entries from all sections by default, but then have filters in a sidebar which retrieve only entries from a certain channel, again in a paginated list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I initially show the total number of entries in each channel for a particular search term, without having to actually construct a query for each channel individually which would be really slow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behaviour would be identical to the following example where it lists the number of entries for each ‘Material type’ &lt;a href=&quot;http://explore.bl.uk/primo_library/libweb/action/search.do?dscnt=1&amp;amp;tab=website_tab&amp;amp;dstmp=1461161587439&amp;amp;vl(freeText0)=family&amp;amp;fn=search&amp;amp;vid=BLVU1&amp;amp;mode=Basic&amp;amp;fromLogin=true&quot; rel=&quot;nofollow&quot;&gt;http://explore.bl.uk/primo_library/libweb/action/search.do?dscnt=1&amp;amp;tab=website_tab&amp;amp;dstmp=1461161587439&amp;amp;vl(freeText0)=family&amp;amp;fn=search&amp;amp;vid=BLVU1&amp;amp;mode=Basic&amp;amp;fromLogin=true&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2016-07-23T17:24:51.857" Title="How can I efficiently show the number of total results per channel when retrieving search results?" Tags="&lt;entries&gt;&lt;search&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14732" PostTypeId="1" AcceptedAnswerId="14734" CreationDate="2016-04-20T15:19:02.233" Score="1" ViewCount="371" Body="&lt;p&gt;I've just noticed that there's a Date Created value that appears for each entry in the control panel. Here's a screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4wDSS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4wDSS.png&quot; alt=&quot;screenshot&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I edit this Date Created value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just looked at the &lt;code&gt;craft_entries&lt;/code&gt; table and edited the &lt;code&gt;dateCreated&lt;/code&gt; value for the entry in question, but when I refreshed the entry in the control panel, the Date Created value remained as it was previously.&lt;/p&gt;&#xA;" OwnerUserId="179" LastEditorUserId="57" LastEditDate="2016-04-20T16:41:06.290" LastActivityDate="2016-04-20T16:41:06.290" Title="How to edit the Date Created value that appears on the Entry page" Tags="&lt;control-panel&gt;&lt;database&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14733" PostTypeId="2" ParentId="14729" CreationDate="2016-04-20T16:34:48.067" Score="2" Body="&lt;p&gt;After adding the new fields to your field layout, you still need to update your template to display the new fields.  You can read the &lt;a href=&quot;https://craftcms.com/docs/templating/&quot; rel=&quot;nofollow&quot;&gt;templating docs&lt;/a&gt; on the Craft website to see how to output the individual fields.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-20T16:34:48.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14734" PostTypeId="2" ParentId="14732" CreationDate="2016-04-20T16:40:46.617" Score="3" Body="&lt;p&gt;If you want to edit that value in the database, then you'll need to find the corresponding row in the &lt;code&gt;craft_elements&lt;/code&gt; table and update the &lt;code&gt;dateCreated&lt;/code&gt; column there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-20T16:40:46.617" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14735" PostTypeId="1" AcceptedAnswerId="14738" CreationDate="2016-04-20T17:51:10.667" Score="1" ViewCount="537" Body="&lt;p&gt;For an upcoming site build, I'm going to need to capture information on every page load for a number of sections. These will be pages based on standard entries, so I'd prefer to use traditional routing (so not handled through a custom controller). There will probably be three different sections that will each have the same information captured when the page is loaded – basically just a list of categories so we can track the most popular type of content and display it as a dashboard widget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I assumed I could do this with an event, but it doesn't look like there are any events for a page being loaded. I'm currently thinking that I use JavaScript to fire an AJAX request to a plugin and send the data along. This will work, but generate extra page loads. I'm thinking it'd be more efficient if I could keep everything server side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way to do this that I'm not seeing?&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2016-04-20T18:04:47.517" Title="Have a custom plugin do something on every page load?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14736" PostTypeId="2" ParentId="14726" CreationDate="2016-04-20T17:53:21.750" Score="0" Body="&lt;p&gt;You can certainly restrict user's access to specific sections on a Craft site, using Craft Pro's &lt;a href=&quot;https://craftcms.com/docs/users#permissions&quot; rel=&quot;nofollow&quot;&gt;user and user group permissions&lt;/a&gt;, both in the control panel and on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of different ways to setup these &quot;sub-sites&quot;, but it sounds like you'll be wanting them to share the same Craft installation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-20T17:53:21.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14737" PostTypeId="1" AcceptedAnswerId="14740" CreationDate="2016-04-20T17:58:51.597" Score="3" ViewCount="62" Body="&lt;p&gt;In the entry list for structures, there used to be a column where my client could see the URI of each entry. Now that it dissapeared because of what seems to be the last update of Craft CMS, how can I bring it back? Thanks&lt;/p&gt;&#xA;" OwnerUserId="5050" LastActivityDate="2016-04-20T20:03:50.033" Title="URI not shown anymore for structures?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14738" PostTypeId="2" ParentId="14735" CreationDate="2016-04-20T18:04:47.517" Score="5" Body="&lt;p&gt;Add a &lt;code&gt;init()&lt;/code&gt; method to your plugin and as long as it's installed and enabled, it'll be called on every request.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    /* Do your stuff */&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want it to only happen on front-end requests, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) { ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-20T18:04:47.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14739" PostTypeId="1" CreationDate="2016-04-20T18:13:51.680" Score="0" ViewCount="147" Body="&lt;p&gt;I created a Matrix field with 1 block type called &quot;Logo&quot; and 2 fields inside that: 1) a related entries field and 2) an image asset.  I then created a global that has this Matrix field in it that allows you to create up to 4 logo blocks in the Matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to create any number of logo blocks, whether I add an asset, choose an entry, or both, I get this CDb error when saving the global.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get that the error is saying it can't locate a column of data it needs, but I don't know what the cause could be. I've tried deleting my Matrix field and global and starting over, but it's the same error each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked the asset group for the logo images and everything seems fine: everything's named properly, no missing images, did an asset index update. No dice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of the full error. I'm working on my local machine and the front end is unaffected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OkVWy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OkVWy.png&quot; alt=&quot;CDbException: Column not found&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-04-20T18:13:51.680" Title="CDbException: Column not found" Tags="&lt;matrix&gt;&lt;database&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14740" PostTypeId="2" ParentId="14737" CreationDate="2016-04-20T20:03:50.033" Score="3" Body="&lt;p&gt;For each entry type, there is now an easy way to manage what columns are shown. From the admin, if you choose Entries from the main navigation, and then go to the entry type in question, you should see a small cog in the bottom left:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ePtXs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ePtXs.png&quot; alt=&quot;Entry columns control&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Click that and you'll be shown a number of checkboxes with columns that can displayed. Click the URI checkbox to enable that column, and then click Save. You can also drag and drop the column names here to re-arrange them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CmkbZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CmkbZ.png&quot; alt=&quot;URI column checkbox&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should now see that column in the entry list:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HN1Uj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HN1Uj.png&quot; alt=&quot;Entry list with URI column&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2016-04-20T20:03:50.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14741" PostTypeId="1" CreationDate="2016-04-20T23:21:53.617" Score="1" ViewCount="1753" Body="&lt;p&gt;I make request from my localhost(gulp server) to example domain in to VerifyPassword controller. When i make request without &lt;code&gt;headers: {'X-Requested-With': 'XMLHttpRequest'}&lt;/code&gt;, It comes as expected 400 Bad request&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;        url: 'http://example/index.php/actions/users/verifyPassword',&#xA;        type: 'POST',&#xA;        data: $data,&#xA;        xhrFields: {&#xA;            withCredentials: true&#xA;        },&#xA;        success(data, response) {&#xA;            console.log(data, response);&#xA;        },&#xA;        error(data, response) {&#xA;            console.log(response, data);&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When i make request with &lt;code&gt;headers: {'X-Requested-With': 'XMLHttpRequest'}&lt;/code&gt; comes response &lt;code&gt;XMLHttpRequest cannot load http://example/index.php/actions/users/verifyPassword. Response for preflight is invalid (redirect)&lt;/code&gt;, and are not sent cookies. Done OPTIONS preflight request without cookies and server comes 302 and redirect to &lt;code&gt;example/login&lt;/code&gt;.&#xA;How To be?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/forum/index.php?/topic/4945-yiiapp-request-isajaxrequest/&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/forum/index.php?/topic/4945-yiiapp-request-isajaxrequest/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2016-04-21T16:55:54.977" LastActivityDate="2016-06-23T13:56:56.733" Title="Crossdomain ajax request to controller with requireAjaxRequest()" Tags="&lt;ajax&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14742" PostTypeId="2" ParentId="14566" CreationDate="2016-04-20T23:27:34.400" Score="2" Body="&lt;pre&gt;&lt;code&gt;$postDate = craft()-&amp;gt;request-&amp;gt;getPost('date');&#xA;$nextDay = new DateTime($postDate);    &#xA;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'news',&#xA;    'date' =&amp;gt; 'and,&amp;gt;='.$postDate.',&amp;lt;'.$nextDay-&amp;gt;modify('+1 days')-&amp;gt;format(&quot;Y-m-d&quot;),&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastActivityDate="2016-04-20T23:27:34.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14743" PostTypeId="1" AcceptedAnswerId="14751" CreationDate="2016-04-21T07:39:16.517" Score="2" ViewCount="142" Body="&lt;p&gt;Two channels:&#xA;1) exhibitions, which have a startDate and EndDate&#xA;2) events, which have a date&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to grab the current exhibitions, future exhibitions and future events, which I do using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allOccurrences = craft.entries.section('exhibitions').startDate('&amp;lt;= ' ~ now | date(&quot;U&quot;)).endDate('&amp;gt;= ' ~ now | date(&quot;U&quot;))&#xA;    | merge(craft.entries.section('exhibitions').startDate('&amp;gt; ' ~ now | date(&quot;U&quot;)))&#xA;    | merge(craft.entries.section('events').date('&amp;gt;= ' ~ now | date(&quot;U&quot;))) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now what I need to do is order them, by the startDate (if an exhibition) and the date (if an event). In other words, having already fetched the entries, I need to order them by two different fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure this is possible without a plugin - could anyone give me any pointers?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="125" LastEditDate="2016-04-21T15:46:27.450" LastActivityDate="2016-04-22T20:35:46.520" Title="Query two sections filtered by different custom fields, then order them" Tags="&lt;entries&gt;&lt;array&gt;&lt;order&gt;&lt;merge&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14744" PostTypeId="1" AcceptedAnswerId="14788" CreationDate="2016-04-21T10:22:45.227" Score="3" ViewCount="1413" Body="&lt;p&gt;A project I'm working on requires that publicly registered users pay a fee upon registration, and when payment is successful an Entry belonging to them should automatically be created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have component pieces of this working but am struggling with how to tie them together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a basic plugin I wrote which handles the creation of an Entry when a user is Activated. The plugin has no money-taking facility. It works fine; the public user registration form posts to the built-in 'users/saveUser' action, and the plugin listens for the users.activateUser event which is fired when an admin manually activates their account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to take that 'manual' step out by having the system automatically activate the user if a Charge has been successful. This means integrating Charge into the public registration form. Which would seem to involve me having to change the action for the form to 'charge/charge', so Charge can do its thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How then do I also get it to create the user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that Charge has an event for successful payment, which I'd like to hook onto and trigger the 'user/saveUser' like what's already working - but how, and how do I pass the username/email fields through from the form to 'user/saveUser' via Charge?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2016-04-21T17:23:54.693" LastActivityDate="2016-04-25T16:18:11.667" Title="Using the Charge plugin for membership subscriptions" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14745" PostTypeId="1" CreationDate="2016-04-21T10:32:03.217" Score="2" ViewCount="127" Body="&lt;p&gt;I'm outputting a Sprout form on my site so that users can request an update to their profile using the short code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutForms.displayForm('updateStoreDetails') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to pre-populate the form with information from the current entry object in the template. I tried to do something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutForms.displayForm('updateStoreDetails', {&#xA;    &quot;fields&quot;: {&#xA;        &quot;memberId&quot;: {&#xA;            &quot;value&quot;: 12345&#xA;        },&#xA;        &quot;name&quot;: {&#xA;            &quot;value&quot;: &quot;Michael&quot;&#xA;        }&#xA;    }&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it doesn't seem to do the trick. Is there a way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2017-11-30T11:34:22.813" Title="Prepopulate Sprout Form using an entry" Tags="&lt;plugin-sproutforms&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14746" PostTypeId="1" AcceptedAnswerId="29567" CreationDate="2016-04-21T10:32:31.040" Score="5" ViewCount="643" Body="&lt;p&gt;Is there a way to parse a line of Markdown within Twig – without the surrounding &#xA;&lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is a StringHelper method called &lt;a href=&quot;https://craftcms.com/classreference/helpers/StringHelper#parseMarkdownLine-detail&quot; rel=&quot;noreferrer&quot;&gt;ParseMarkdownLine&lt;/a&gt; that does exactly what I'd like, but I haven't found a way to invoke it in my templates.&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2019-02-19T06:51:11.643" Title="Parse a line of Markdown, without &lt;p&gt;" Tags="&lt;templating&gt;&lt;markup&gt;&lt;markdown&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14748" PostTypeId="1" AcceptedAnswerId="14753" CreationDate="2016-04-21T13:21:06.617" Score="2" ViewCount="200" Body="&lt;p&gt;From a custom plugin controller, I am returning data as json using &lt;a href=&quot;https://craftcms.com/classreference/controllers/BaseController#returnJson-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;$this-&amp;gt;returnJson($data)&lt;/code&gt;&lt;/a&gt;. I need to be able to set the Cache-Control headers for my forward cache proxy to handle caching correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using &lt;a href=&quot;https://craftcms.com/classreference/helpers/HeaderHelper#setExpires-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;HeaderHelper::setExpires(300)&lt;/code&gt;&lt;/a&gt;, but &lt;a href=&quot;https://craftcms.com/classreference/helpers/JsonHelper#sendJsonHeaders-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;JsonHelper::sendJsonHeaders()&lt;/code&gt;&lt;/a&gt;, which is called by &lt;a href=&quot;https://craftcms.com/classreference/controllers/BaseController#returnJson-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;$this-&amp;gt;returnJson()&lt;/code&gt;&lt;/a&gt; from the controller, overrides &lt;code&gt;setExpires&lt;/code&gt; by calling &lt;a href=&quot;https://craftcms.com/classreference/helpers/HeaderHelper#setNoCache-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;HeaderHelper::setNoCache()&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas for working around this or configuring &lt;code&gt;returnJson&lt;/code&gt;? I can do the following in my controller (or create a helper of my own):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HeaderHelper::setExpires(300);&#xA;HeaderHelper::setContentTypeByExtension('json');&#xA;ob_start();&#xA;echo JsonHelper::encode($return);&#xA;craft()-&amp;gt;end();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I'd rather use the super convenient &lt;code&gt;returnJson&lt;/code&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-04-30T04:32:43.663" Title="Using setExpires on returnJson" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14749" PostTypeId="1" AcceptedAnswerId="14763" CreationDate="2016-04-21T13:38:30.847" Score="1" ViewCount="926" Body="&lt;p&gt;I get it that there are hooks, but i can't get enough inside the differences between entries and product, and actually hack together an extension for either of those plugins.&lt;/p&gt;&#xA;" OwnerUserId="5051" LastEditorUserId="57" LastEditDate="2016-04-21T17:39:20.447" LastActivityDate="2016-11-30T22:42:01.000" Title="How do I import existing products into Craft Commerce with the FeedMe or Import plugins?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;import&gt;&lt;plugin-feedme&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14750" PostTypeId="2" ParentId="14746" CreationDate="2016-04-21T15:44:24.953" Score="6" Body="&lt;p&gt;Have a look at the &lt;a href=&quot;https://github.com/pixelandtonic/Parsedown&quot; rel=&quot;noreferrer&quot;&gt;Parsedown&lt;/a&gt; plugin by P&amp;amp;T, it provides a line mode to not output any wrapping &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title|parsedown('line') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-21T15:44:24.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14751" PostTypeId="2" ParentId="14743" CreationDate="2016-04-21T15:57:19.517" Score="3" Body="&lt;p&gt;There's this super useful &lt;a href=&quot;https://topshelfcraft.com/lagniappe/supersort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt; plugin that would make this possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortAsTemplate = '{{ object.section == &quot;Exhibitions&quot; ? object.startDate|date(&quot;U&quot;) : object.date|date(&quot;U&quot;) }}' %}&#xA;{% set sortedOccurrences = allOccurrences|supersort('sortAs', sortAsTemplate) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-04-22T10:26:07.873" LastActivityDate="2016-04-22T10:26:07.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14753" PostTypeId="2" ParentId="14748" CreationDate="2016-04-21T18:04:40.873" Score="3" Body="&lt;p&gt;If you're running Craft CMS &lt;a href=&quot;https://craftcms.com/changelog#build2783&quot; rel=&quot;nofollow&quot;&gt;2.6.2783&lt;/a&gt;, you can pass in an &lt;code&gt;'expires'&lt;/code&gt; key to the optional &lt;code&gt;$options&lt;/code&gt; 2nd parameter of &lt;a href=&quot;https://craftcms.com/classreference/controllers/BaseController#returnJson-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;returnJson&lt;/code&gt;&lt;/a&gt; with the value set to the time in seconds that will be passed to the cache control expiration headers.  If you ignore it, it will have the current behavior of not caching at all.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-04-30T04:32:43.663" LastActivityDate="2016-04-30T04:32:43.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14754" PostTypeId="1" CreationDate="2016-04-21T18:58:59.003" Score="3" ViewCount="553" Body="&lt;p&gt;For those who have implemented Craft Commerce and needed product reviews, what has been a good solution for you?&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2016-04-21T18:58:59.003" Title="Craft Commerce Product Reveiws" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14755" PostTypeId="1" AcceptedAnswerId="14766" CreationDate="2016-04-21T20:15:23.073" Score="2" ViewCount="233" Body="&lt;p&gt;I am trying to access the previous and the next blog entries from my current post. Here is what I am doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('blog').order('postDate asc') %}&#xA;&#xA;    {% set prevEntry = entry.getPrev(params) %}&#xA;    {% set nextEntry = entry.getNext(params) %}&#xA;    {# to access url, I use #}&#xA;    {{ prevEntry.url }}&#xA;    {# to access title, I use #}&#xA;    {{ prevEntry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above works. However, I have an asset under the field handle &quot;featuredImage&quot;. I need to access the image URL as well as I need to apply a transform. I am not sure the code below is the most efficient way to do this. Also the image transform is giving me an error (server returns 500 error)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in prevEntry.featuredImage %}&#xA;    {% do asset.setTransform({ mode:crop, width: 200, height: 200 }) %}&#xA;    &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;&amp;lt;img alt=&quot;{{ prevEntry }}&quot; class=&quot;img-responsive center-block&quot; src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is looping the best way to access the data considering that there is only one image? Is there a better way? Image transform is also not working (not sure why).     &lt;/p&gt;&#xA;" OwnerUserId="4815" LastActivityDate="2016-04-22T05:16:01.440" Title="Best way to access getPrev and getNext asset fields" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14756" PostTypeId="1" CreationDate="2016-04-21T22:07:23.277" Score="1" ViewCount="109" Body="&lt;p&gt;I have a situation where a form needs to have the ability add additional fields on the fly. For example, if the user clicks &quot;add cat&quot; a new section/tab appears with the fields to add a new cat. So if the user wanted to add 10 cats to the form they would have that ability without issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was that we could use a matrix field to dynamically add fields, but the field type is unsupported. Any help or ideas would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dOheP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dOheP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3332" LastActivityDate="2016-04-21T22:47:38.723" Title="Creating on-demand Sprout Fields" Tags="&lt;plugins&gt;&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14757" PostTypeId="2" ParentId="14756" CreationDate="2016-04-21T22:47:38.723" Score="2" Body="&lt;p&gt;Sounds like Matrix is the right field for your situation. The harder part is how you decide to implement this on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While your question doesn't say it explicitly, it is tagged &lt;code&gt;plugin-sproutforms&lt;/code&gt; so I'm going to base my answer on how to approach this using Sprout Forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1: Custom HTML&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only have a single form, building things out in &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html&quot; rel=&quot;nofollow&quot;&gt;Custom HTML&lt;/a&gt; might be worth considering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can grab the &lt;code&gt;SproutForms_FormModel&lt;/code&gt; using the &lt;code&gt;form&lt;/code&gt; tag: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.sproutForms.form('formHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or use the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/templating/craft-sproutforms-displaytab&quot; rel=&quot;nofollow&quot;&gt;displayTab&lt;/a&gt; and &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/templating/craft-sproutforms-displayfield&quot; rel=&quot;nofollow&quot;&gt;displayField&lt;/a&gt; tags to output parts of your form that you don't need additional control over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to build out support for the Matrix Field manually, but Sprout Forms can receive data for a Matrix Field that is built in the &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow&quot;&gt;proper format&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2: Matrix Custom Field Plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to reuse your form in multiple places, or have the need to reuse Matrix fields on the front-end, you might consider building a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow&quot;&gt;Custom Field&lt;/a&gt; for Sprout Forms that adds front-end Matrix support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several examples in the Sprout Fields plugin of how to add front-end Custom Field support for Sprout Forms, it would just require a bit more work to take into account all the scenarios that a Matrix field could present.  Depending on your scenario, you might be able to simplify things and just add support for the fields you need to start off, and add more complexity as the need arose.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-21T22:47:38.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14758" PostTypeId="1" AcceptedAnswerId="14761" CreationDate="2016-04-21T23:17:37.760" Score="0" ViewCount="97" Body="&lt;p&gt;Running into some issues with matrix fields after upgrading from 2.4 to 2.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix in the site includes a whole bunch of block types that are used to build row-based pages (e.g., Intro, Profile, News, Text, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new page everything works just fine at first. However, when you insert certain block types into the matrix, suddenly you can no longer reorder/collapse/add blocks in that matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that when it breaks, the following error pops up in the console:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught: TypeError: Cannot read property '0' of undefined - velocity.min.js&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone run into this or have ideas to what this might be? I can't seem to find a commonality between the blocks that cause the error and am not sure where to go with this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: this particular matrix config has a &lt;em&gt;ton&lt;/em&gt; of fields (we've had to extend the php memory limit etc. when saving changes to the config).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HTJRx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HTJRx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EAYNu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EAYNu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="610" LastActivityDate="2016-04-22T00:06:13.740" Title="Matrix Issues After Upgrading from 2.4 to 2.6" Tags="&lt;matrix&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14759" PostTypeId="1" AcceptedAnswerId="14765" CreationDate="2016-04-21T23:32:56.903" Score="2" ViewCount="1065" Body="&lt;p&gt;Something like &lt;code&gt;craft.entrytypes.section('sectionHandle')&lt;/code&gt; and then loop through them to list out their names.  I'm looking through the docs and can't see how to do this with just the &lt;code&gt;craft.entries&lt;/code&gt; code.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-04-22T04:48:36.140" Title="How to list out entry types in a section" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14761" PostTypeId="2" ParentId="14758" CreationDate="2016-04-22T00:06:13.740" Score="1" Body="&lt;p&gt;Craft 2.5 changed from Redactor I to Redactor II, so chances are you just need to update your Redactor configs to the new format: &lt;a href=&quot;https://craftcms.com/support/redactor-ii-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/redactor-ii-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-22T00:06:13.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14762" PostTypeId="1" CreationDate="2016-04-22T03:41:19.953" Score="0" ViewCount="1081" Body="&lt;p&gt;As I put the CSS files on the public root folder of the live site, the CSS doesn't load on the live site.&lt;/p&gt;&#xA;" OwnerUserId="5054" LastEditorUserId="57" LastEditDate="2016-04-22T15:25:25.730" LastActivityDate="2016-04-22T15:25:25.730" Title="CSS doesn't load on the live server" Tags="&lt;css&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14763" PostTypeId="2" ParentId="14749" CreationDate="2016-04-22T04:03:59.287" Score="3" Body="&lt;p&gt;Feed Me only supports Entries at this stage. Its on the short-term roadmap in allow importing into all Elements, including Commerce Products. This cannot be achieved through hooks at the moment. Keep an eye on the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: FeedMe 2.0 now supports multiple entry types, including Commerce Products: &lt;a href=&quot;http://sgroup.com.au/plugins/feedme/getting-started/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sgroup.com.au/plugins/feedme/getting-started/introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="-1" LastEditDate="2016-11-30T22:42:01.000" LastActivityDate="2016-11-30T22:42:01.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14764" PostTypeId="2" ParentId="14762" CreationDate="2016-04-22T04:17:08.270" Score="3" Body="&lt;p&gt;I'm guessing that the path is not accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're 100% sure that the path is correct, then check your file permissions. Small chance the permissions are locked down too tight.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-04-22T04:17:08.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14765" PostTypeId="2" ParentId="14759" CreationDate="2016-04-22T04:48:36.140" Score="5" Body="&lt;p&gt;Take a look at the sections documentation: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.sections&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.sections&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code lists all entrytypes of all sections.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getAllSections() %}&#xA;&#xA;{% for section in sections %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ section.name }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% set entryTypes = section.getEntryTypes() %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entryType in entryTypes %}&#xA;&#xA;            &amp;lt;li&amp;gt;{{ entryType.name }}&amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you like only to show used entry types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Loop trough all entries&lt;/li&gt;&#xA;&lt;li&gt;Collect all entry types in a array&lt;/li&gt;&#xA;&lt;li&gt;Now, you can loop trough the entry types array&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-04-22T04:48:36.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14766" PostTypeId="2" ParentId="14755" CreationDate="2016-04-22T05:16:01.440" Score="2" Body="&lt;p&gt;If you need only one image, you can use the first() function instead of a for loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend to check always if a image or entry exists, befor use it. Otherwise you risk to get an error. During development you should turn on the devMode, to see all errors (&lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code example i would use in your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if prevEntry %}&#xA;&#xA;    {% set asset = prevEntry.featuredImage.first() %}&#xA;&#xA;    {% if asset|length %}&#xA;&#xA;        {% set thumb = {&#xA;            mode: 'crop',&#xA;            width: 200,&#xA;            height: 200,&#xA;            quality: 75,&#xA;            position: 'center-center'&#xA;        } %}&#xA;&#xA;        &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ asset.getUrl(thumb) }}&quot; class=&quot;img-responsive center-block&quot;  alt=&quot;{{ prevEntry.title }}&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;noImg.png&quot; class=&quot;img-responsive center-block&quot;  alt=&quot;{{ prevEntry.title }}&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;    &#xA;&#xA;    {% endif %}&#xA;{% else %}&#xA;    &amp;lt;!-- There's no previous entry. --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-04-22T05:16:01.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14767" PostTypeId="1" CreationDate="2016-04-22T05:49:20.703" Score="2" ViewCount="199" Body="&lt;p&gt;Is there any &quot;Upload Image&quot; custom field in craft so that I will be able to make my images editable. Thanks for the answer.&lt;/p&gt;&#xA;" OwnerUserId="5054" LastActivityDate="2016-04-22T06:48:00.957" Title="Upload Image Custom Field" Tags="&lt;field&gt;&lt;image&gt;&lt;upload&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14768" PostTypeId="2" ParentId="14767" CreationDate="2016-04-22T06:48:00.957" Score="3" Body="&lt;p&gt;I believe you are looking for the &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow&quot;&gt;Assets Field&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-22T06:48:00.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14769" PostTypeId="1" CreationDate="2016-04-22T13:44:12.500" Score="3" ViewCount="846" Body="&lt;p&gt;This is my first time using Craft Commerce.  I have a client which needs to have multiple prices for a product.  Customers are in one of three price level groups.  Each price level group has a price unique to them as a variant.  How do I get only the one variant for the appropriate price?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I tried, but returned all the variants for each price level instead of just one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                &amp;lt;select name=&quot;purchasableId&quot;&amp;gt;&#xA;                    {% set purchasable = craft.commerce.products %}&#xA;                    {% for purchasable in product.variants %}&#xA;                        &amp;lt;option &#xA;                            {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} &#xA;                            value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;&#xA;                                Product Number: {{ product.stockDescription1 }} | &#xA;                                Price: &#xA;&#xA;                                {% if currentUser.isInGroup( 'priceLevelOne' ) %}&#xA;&#xA;                                    {% set variant = craft.commerce.variants %}&#xA;                                    {% for variant in product.variants %}&#xA;                                        {% if variant.priceLevel1 == 1 %}&#xA;                                            Product Number: {{ product.stockDescription1 }} |&#xA;                                            Price:&#xA;                                            {{ variant.price|currency(cart.currency) }}&#xA;                                        {% endif %}&#xA;                                    {% endfor %}&#xA;&#xA;                                {% elseif currentUser.isInGroup( 'priceLevelTwo' ) %}&#xA;&#xA;                                    {% set variant = craft.commerce.variants %}&#xA;                                    {% for variant in product.variants %}&#xA;                                        {% if variant.priceLevel1 == 2 %}&#xA;                                            Product Number: {{ product.stockDescription1 }} |&#xA;                                            Price:&#xA;                                            {{ variant.price|currency(cart.currency) }}&#xA;                                        {% endif %}&#xA;                                    {% endfor %}&#xA;&#xA;&#xA;                                {% elseif currentUser.isInGroup( 'priceLevelThree' ) %}&#xA;&#xA;                                    {% set variant = craft.commerce.variants %}&#xA;                                    {% for variant in product.variants %}&#xA;                                        {% if variant.priceLevel1 == 3 %}&#xA;                                            Product Number: {{ product.stockDescription1 }} |&#xA;                                            Price:&#xA;                                            {{ variant.price|currency(cart.currency) }}&#xA;                                        {% endif %}&#xA;                                    {% endfor %}&#xA;&#xA;                                {% endif %}&#xA;                        &amp;lt;/option&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="3816" LastEditDate="2016-04-27T18:56:50.413" LastActivityDate="2016-04-29T14:01:42.683" Title="Multiple Prices based on User in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14770" PostTypeId="1" AcceptedAnswerId="14821" CreationDate="2016-04-22T19:55:03.020" Score="2" ViewCount="273" Body="&lt;p&gt;I am using the Venti Events Calendar Plugin. I was wondering how I could go about searching for events between 2 dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can display events between 2 dates below, using the .between parameter. But I have not figured out how to incorporate this into a search.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.venti.events.between('2016-04-01 00:00:00','2016-05-19 00:00:00') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2016-04-26T20:16:41.580" Title="Search Between 2 Dates Venti Calendar Plugin" Tags="&lt;search&gt;&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14772" PostTypeId="1" CreationDate="2016-04-22T20:39:58.100" Score="1" ViewCount="532" Body="&lt;p&gt;I have a client that will only be accepting payments by check at this time.  It is a larger company that has same clients and they bill the client and check is mailed.  However they want to be able to take orders online and I really wanted to try Craft Commerce.  What I need to do is somehow bypass the payment step.  I would like to be able to send them an invoice, but not one that says paid.  Any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="3816" LastActivityDate="2016-04-28T17:56:14.640" Title="How To Accept Payments By Check" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14773" PostTypeId="2" ParentId="14772" CreationDate="2016-04-22T20:50:17.380" Score="3" Body="&lt;p&gt;A pure ghetto method would be to just go into the pdf template and remove the &quot;paid&quot; markup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't remember off hand, but I think it is just a div. Inspect the element to find the hook (id, class). Then either comment out the css rules or remove that element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like this is the file you need to modify:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/craft/templates/commerce/customer/order.html&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-04-24T20:07:20.703" LastActivityDate="2016-04-24T20:07:20.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14775" PostTypeId="1" AcceptedAnswerId="14776" CreationDate="2016-04-23T20:13:06.893" Score="1" ViewCount="92" Body="&lt;p&gt;I've this macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dh_macros.dh_postNav(entry, 'blog', 'postDate', 'prev article', 'next article') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I call it on my blog/_single template and it works for 90% of the posts. But the newest 6 posts doesn't show the next / prev links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/isFji.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/isFji.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the last post how it works fine. In the next newer post it looks like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hecaq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hecaq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the next post link missing. And one post newer there is no link shown neither next nor prev :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To appreciation, there are next / prev posts there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels really random and I've no idea what's going wrong. &#xA;Maybe someone has an idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the Full Code maybe someone need it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;    Prev / Next Link&#xA;    Examples:&#xA;&#xA;    {{ dh_macros.dh_postNav(entry, 'work', 'postDate', 'prev work', 'next work' ) }}&#xA;#}&#xA;&#xA;    {% macro dh_postNav(entry, section, order, prevLabel, nextLabel ) %}&#xA;&#xA;    {# Set vars #}&#xA;    {% set section     = section|default('blog') %}&#xA;    {% set order       = order|default('postDate') %}&#xA;    {% set prevLabel   = prevLabel|default(false) %}&#xA;    {% set nextLabel   = nextLabel|default(false) %}&#xA;&#xA;    {# Set parameters for prev/next elements list #}&#xA;    {% set data = craft.entries.section(section).order(order).limit(null) %}&#xA;&#xA;    {# Get the prev/next elements #}&#xA;    {% set prevEntry = entry.getPrev(data) %}&#xA;    {% set nextEntry = entry.getNext(data) %}&#xA;&#xA;    {# And make sure to only output the links if the element exists #}&#xA;    {% if prevEntry or nextEntry %}&#xA;&#xA;        &amp;lt;ul class=&quot;postNav&quot;&amp;gt;&#xA;            {% if prevEntry %}&#xA;                &amp;lt;li class=&quot;postNav__item  postNav__item--prev&quot;&amp;gt;&#xA;                    &amp;lt;a class=&quot;postNav__link  postNav__link--prev&quot; href=&quot;{{ prevEntry.url }}&quot;&amp;gt;&#xA;&#xA;                        {% if prevLabel != false %}&#xA;                            &amp;lt;span class=&quot;postNav__label&quot;&amp;gt;{{ prevLabel }}&amp;lt;/span&amp;gt;&#xA;                        {% endif %}&#xA;&#xA;                        &amp;lt;span class=&quot;postNav__title&quot;&amp;gt;{{ prevEntry.title }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% if nextEntry %}&#xA;                &amp;lt;li class=&quot;postNav__item  postNav__item--next&quot;&amp;gt;&#xA;                    &amp;lt;a class=&quot;postNav__link  postNav__link--next&quot; href=&quot;{{ nextEntry.url }}&quot;&amp;gt;&#xA;                        {% if nextLabel != false %}&#xA;                            &amp;lt;span class=&quot;postNav__label&quot;&amp;gt;{{ nextLabel }}&amp;lt;/span&amp;gt;&#xA;                        {% endif %}&#xA;&#xA;                        &amp;lt;span class=&quot;postNav__title&quot;&amp;gt;{{ nextEntry.title }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="57" LastEditDate="2016-04-24T00:09:46.380" LastActivityDate="2016-04-24T00:09:46.380" Title="Prev / Next Link Problem" Tags="&lt;previous-next&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14776" PostTypeId="2" ParentId="14775" CreationDate="2016-04-23T20:25:04.103" Score="2" Body="&lt;p&gt;Make sure you are using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.limit(null)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your element criteria model &lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-04-23T20:25:04.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14777" PostTypeId="1" CreationDate="2016-04-23T22:56:19.740" Score="1" ViewCount="141" Body="&lt;p&gt;I migrate my WordPress site into Craft CMS. So far so good. &#xA;But the URLs for most of the Blog Entries are complete new. What's the best way to handle that? My site is good linked on Google and there are a lot of backlinks. It would be nice to have a solution where I can see which pages the Users call and if it a 404. Afterwards I can create rewrite rules for this sites. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finest way was a Plugin that combine this two features. &#xA;Maybe anyone knows one. &lt;/p&gt;&#xA;" OwnerUserId="3898" LastActivityDate="2016-04-24T18:49:27.470" Title="Migrate WordPress Site into Craft CMS. How deal with 404's?" Tags="&lt;redirect&gt;&lt;migration&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14778" PostTypeId="2" ParentId="14777" CreationDate="2016-04-24T04:08:46.400" Score="3" Body="&lt;p&gt;David,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like using &lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow&quot;&gt;Reroute&lt;/a&gt;. It's a Craft plugin that lets you create 301s and 302s to any of your entry pages within Craft. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2016-04-24T04:08:46.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14780" PostTypeId="2" ParentId="14731" CreationDate="2016-04-24T15:47:24.573" Score="1" Body="&lt;p&gt;I would try one of the following solutions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using Ajax to display the search results and the filter&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Use ajax to display your search results. After loading the search results, you'r using a second Ajax call to get the categories filter. With this solution the visitor see the results quickly and get the filter after. You could try to including caching of the filter to speed up the page. Downside: Depending on requests and amount of content, it needs still a lot of server power.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Writing your own Plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Write your own search filter plugin with your logic and optimized SQL to get the filter faster. This solution can be combined with the first one.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using a external Search Engine&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A other solution could be to use a external search engine service like Google Custom Search. Some of them offers filters/logic like you need. Craft CMS Example: On &lt;a href=&quot;https://straightupcraft.com/craft-plugins/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/&lt;/a&gt; the search is provided by Algolia (&lt;a href=&quot;https://www.algolia.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.algolia.com/&lt;/a&gt;). On the right side is a simple developer filter, including number of entries.&#xA;Take also a look at the Algolia Plugin to easy integrate Algolia in Craft CMS -&amp;gt; &lt;a href=&quot;https://straightupcraft.com/craft-plugins/search-plus-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/search-plus-1&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-04-24T15:47:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14781" PostTypeId="1" CreationDate="2016-04-24T16:04:46.987" Score="2" ViewCount="398" Body="&lt;p&gt;I need to submit a form, using SproutForms, via AJAX, so i can get the response and then show some &quot;gated&quot; content on the page. The content (i.e. PDF link, etc) is tied to a particular entry page, so i'd like to stay on that page and not doing a normal POST to a generic success page. I can't find any info on the SproutForms plugin page on how to do this, just that it's supported (noted in the change log). Please help&lt;/p&gt;&#xA;" OwnerUserId="412" LastActivityDate="2016-10-25T15:50:45.723" Title="Ajax submissions using SproutForms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14782" PostTypeId="2" ParentId="14777" CreationDate="2016-04-24T18:44:05.717" Score="1" Body="&lt;p&gt;Why are your blog posts' URLs different after you migrated in the first place? Different slugs, URL format, etc? What you did before is going inform what you can do now.  And how did you do the migration? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see 2 problems here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;404s&lt;/li&gt;&#xA;&lt;li&gt;Keeping link juice&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you can solve #1, #2 can take care of itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd try to get your URLs into same format as what you had for WP and mimic the format. If you can't or won't do that, at least get the post's &lt;code&gt;slug&lt;/code&gt; the same as what you had before, then you at least having a fighting chance to try and rewrite what you had into your newer post format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you changed &lt;code&gt;/blog/post&lt;/code&gt; into &lt;code&gt;news/post&lt;/code&gt; or whatever, you might have rewrite rule that looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteEngine On&#xA;    RewriteRule ^blog/(.*)$ /news/$1 [R=301,NC,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That'll take care of the format problem but I'm guessing it goes deeper than that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How did you import your old content? If your post slugs changed, export the old content from WP into a CSV. You likely just need to export the post title and its slug. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use Bob Olde Hampsink's handy &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt; plugin to change your post slugs back to what they were before. Just pick your section(s), re-import the title and slug, and leave the rest of the fields untouched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also use something like Moz's &lt;a href=&quot;https://moz.com/researchtools/ose/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Open Site Explorer&lt;/a&gt; or &lt;a href=&quot;https://ahrefs.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;AHREFs&lt;/a&gt; to see what your popular posts are from a domain/post authority standpoint and then at least rewrite those so you can keep the link juice happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.google.com/webmasters/tools/home&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google webmaster tools&lt;/a&gt; can let you see which pages are breaking when it crawls as well as who's linking to your content. Then do as Tim mentioned in his &lt;a href=&quot;https://craftcms.stackexchange.com/a/14778/1016&quot;&gt;answer&lt;/a&gt; and rewrite those. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 80/20 rule is probably going to be your friend here, just getting those 20% of popular posts will probably fix 80% of your problem.  Google is smart enough to figure out the rest of your 404s when you submit a sitemap but you still want to keep it as seamless for visitors coming from those old links.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-04-24T18:49:27.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14783" PostTypeId="2" ParentId="14781" CreationDate="2016-04-25T05:33:00.527" Score="5" Body="&lt;p&gt;I figured it out (edited with my FORM mark-up as well):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm actually rendering the FORM using the SproutForms method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;submit-via-ajax&quot;&amp;gt;&#xA;    {{ craft.sproutForms.displayForm(block.gatedContentForm.first().handle) }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then my JS looks for any form submissions from a &quot;.submit-via-ajax&quot; block&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// process the form&#xA;$('.submit-via-ajax form').submit(function(event) {&#xA;&#xA;    // get the form data&#xA;    var formData = $(this).serialize();&#xA;&#xA;    // process the form&#xA;    $.ajax({&#xA;        type        : 'POST', // define the type of HTTP verb we want to use (POST for our form)&#xA;        url         : 'sproutForms/entries/saveEntry', // the url where we want to POST&#xA;        data        : formData, // our data object&#xA;        dataType    : 'json', // what type of data do we expect back from the server&#xA;        encode          : true&#xA;    })&#xA;        // using the done promise callback&#xA;        .done(function(data) {&#xA;&#xA;            // here we will handle errors and validation messages&#xA;            if (data.success == true)&#xA;            {&#xA;                // show/hide content/elements&#xA;            }&#xA;            else&#xA;            {&#xA;                // show an error&#xA;            }&#xA;    });&#xA;&#xA;    // stop the form from submitting the normal way and refreshing the page&#xA;    event.preventDefault();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="412" LastEditorUserId="412" LastEditDate="2016-10-25T15:50:45.723" LastActivityDate="2016-10-25T15:50:45.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14784" PostTypeId="1" AcceptedAnswerId="14873" CreationDate="2016-04-25T10:59:38.143" Score="1" ViewCount="1139" Body="&lt;p&gt;I'm having an issue where Craft seems to change (significantly slowing down) the framerate of animated GIF assets on upload (this doesn't seem to be an image transform problem: if I add the file as an asset in Craft, and then open the uploaded version of the file, the framerate has already changed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server is on the latest version of php-imagick (3.1.2) and ImageMagick (6.6.7-10) that are currently available for the version of Ubuntu that we're running (14.04 LTS)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: is there any way (config setting or similar) of preventing Craft from messing with uploaded GIFs in this way?&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-05-03T11:07:44.933" Title="Is there any way to prevent Craft from doing anything with uploaded GIF assets?" Tags="&lt;assets&gt;&lt;image&gt;&lt;gif&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14785" PostTypeId="2" ParentId="14718" CreationDate="2016-04-25T11:21:51.947" Score="0" Body="&lt;p&gt;If the content of the additional field(s) is directly related to the image itself, then adding custom fields to the Asset-Source might be a solution for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Assets&lt;/strong&gt; &gt; (click the relevant Asset Source Title)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add any custom fields as needed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The beauty of this approach is that the additional data is tied to the asset and so once entered, can be made use of as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14410/when-to-add-a-field-to-an-asset/14414#14414&quot;&gt;Here's a good example...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-04-25T11:21:51.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14786" PostTypeId="2" ParentId="12788" CreationDate="2016-04-25T12:07:49.260" Score="3" Body="&lt;p&gt;I've managed to do this using a plugin which allows you to write CSS affecting the Craft CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt; is installed, click &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Control Panel CSS&lt;/strong&gt; and add this to the &quot;&lt;strong&gt;Additional CSS&lt;/strong&gt;&quot; field...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor-dropdown-outdent, .redactor-dropdown-indent {&#xA;    display: none !important;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's a screen shot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u3dYB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u3dYB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I end up with in Redactor...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M7pYV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M7pYV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-04-25T12:07:49.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14787" PostTypeId="2" ParentId="14784" CreationDate="2016-04-25T12:28:00.673" Score="4" Body="&lt;p&gt;When you upload an image to Craft, the image is automatically “cleansed” using the same basic process that Craft uses to create image transforms. That happens to ensure that there are no malicious scripts hidden in the images, and it’s not something you can disable.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-04-25T12:28:00.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14788" PostTypeId="2" ParentId="14744" CreationDate="2016-04-25T16:18:11.667" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/overview&quot; rel=&quot;nofollow&quot;&gt;Developer of Charge here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Setup for installs up to (and including) 2.0.x  :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest setup would be to use the &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/hook-events#charge.onbeforecharge&quot; rel=&quot;nofollow&quot;&gt;onBeforeCharge event&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fires at the very start of the charge request, after validation but before anything has actually &lt;em&gt;happened&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd use that to jump in, and create your user, entry, or anything else you might want to do. As part of that same event you can modify the actual &lt;strong&gt;ChargeModel&lt;/strong&gt; which will be used in the payment request too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;onBeforeCharge&lt;/em&gt; event fires before we pull out the user for the request, so as long as you're creating the user at that point, you won't need to do anything else to have all the subsequent steps properly associated to that user either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course be aware that a payment can fail for any number of reasons, so check in that &lt;em&gt;onBeforeCharge&lt;/em&gt; event if you actually do need to create the user before blindly going ahead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you can use the &lt;em&gt;onCharge&lt;/em&gt; event to later perform any clean up you might need once the payment has actually succeeded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Setup for installs from 2.1+&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.1 (not yet released as of 25/04/16) is bringing inline user registration to the payment forms, so in that case you'd just pass a new flag on the request to &lt;code&gt;registerUser = true&lt;/code&gt;, and let Charge do the rest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Charge will only attempt to register a new user if required, and will use the &lt;code&gt;customerEmail&lt;/code&gt; as the default base, but that can be overridden with other parameters and inputs on the form. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-25T16:18:11.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14789" PostTypeId="2" ParentId="13822" CreationDate="2016-04-25T16:37:53.887" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow&quot;&gt;Hi, Developer of Search Plus here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Swapping out the js template engine isn't a simple thing. It certainly can be done, but it'd involve a reasonable amount of reworking to change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're less experienced with js I wouldn't recommend it off hand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Instead of swapping out the javascript templating engine, I'd recommend using the &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus/usage/hooks-events#searchplus_alterbasicitemmapping&quot; rel=&quot;nofollow&quot;&gt;alterBasicMapping&lt;/a&gt; (that's exactly what it's designed for) hook to change the actual content to the format you need &lt;em&gt;before&lt;/em&gt; it's passed to algolia for indexing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you did want to dig in and give it a try, the first step would be to create your own clone of the bundled searchplus.js, found in the &lt;code&gt;/plugins/searchplus/resources/js/&lt;/code&gt; folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within that there are a few key parts, from line 48 you'd see the various &lt;code&gt;Hogan.compile&lt;/code&gt; markers which would need changing, and then each of the separate &lt;code&gt;renderHits()&lt;/code&gt;, &lt;code&gt;renderFacets()&lt;/code&gt;, &lt;code&gt;renderPagination()&lt;/code&gt; etc.. would need updating. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of those methods are dedicated to handling the logic, with the last lines of them finally passing the data down to Hogan, which looks like : &lt;code&gt;$hits.html(hitsTemplate.render(content))&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your swig version would replace that &lt;code&gt;hitsTemplate.render()&lt;/code&gt; part. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again - not something I'd directly recommend unless you're comfortable with the javascript side of things.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-25T16:37:53.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14790" PostTypeId="2" ParentId="13885" CreationDate="2016-04-25T16:59:05.650" Score="1" Body="&lt;p&gt;Per the original poster's 2nd edit, the issue had to do with their company firewall blocking the request to S3.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request. We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-25T16:59:05.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14791" PostTypeId="1" AcceptedAnswerId="14802" CreationDate="2016-04-25T18:11:51.193" Score="2" ViewCount="1049" Body="&lt;p&gt;Is it possible to retrieve a field value from an alternate locale? I'm working on a multi-language dictionary website and it would be helpful to display values for an entry in more than one locale (language), while the main content stays in the current locale. Right now I have something setup like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for word in dictionaryWords %}&#xA;    {# returns definition for the word in the current locale #}&#xA;    &amp;lt;p&amp;gt;{{word.definition}}&amp;lt;/p&amp;gt;  &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to add a secondary definition in another language from a different locale. Something like this, but I'm not sure how to get at the field data from a different locale.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for word in dictionaryWords %}&#xA;&#xA;  {# returns definition for the word in the current locale #}&#xA;  &amp;lt;p&amp;gt;{{word.definition}}&amp;lt;/p&amp;gt;&#xA;&#xA;  {# returns definition for the word in a secondary locale #}&#xA;  {% if currentLanguageID == &quot;languageID1&quot; %}&#xA;    &amp;lt;p&amp;gt;{{ word definition in language 2 }}&amp;lt;/p&amp;gt;        &#xA;  {% elseif currentLanguageID == &quot;languageID2&quot; %}&#xA;    &amp;lt;p&amp;gt;{{ word definition in language 1 }}&amp;lt;/p&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-04-26T02:11:51.340" Title="Retrieve entry field value from a different locale?" Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14792" PostTypeId="1" AcceptedAnswerId="14820" CreationDate="2016-04-25T19:14:59.220" Score="2" ViewCount="276" Body="&lt;p&gt;I have a dev server (sandbox.site.com) and a prod server (www.site.com). I copied over the contents from sandbox to dev using cp -r. Loading up my website on the production site looks fine. Everything is where it should be, the few entries I have in place loaded, images are there, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem comes when trying to load the admin panel; I get a white screen. I enabled devMode and that gave me the login fields with no styling. I am unable to login (99% certain I have the user/pw right) and there are no error messages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched for &quot;error&quot; in my craft.log, but nothing really stood out at me. I have a lot of the following errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/user/craft/app/controllers/TemplatesController.php:59&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the timestamp isn't the same time as trying to login to the control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2016-04-26T18:39:51.430" Title="Moved from dev to prod server, admin page blank" Tags="&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14793" PostTypeId="1" CreationDate="2016-04-25T20:14:14.240" Score="2" ViewCount="317" Body="&lt;p&gt;I'm creating a plugin and I need help to query relational data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the table schema I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;collection&#xA;+----+-------------+---------------------+---------------------+-----+&#xA;| id | label       | dateCreated         | dateUpdated         | uid |&#xA;+----+-------------+---------------------+---------------------+-----+&#xA;|  1 | Static page | 2016-03-11 16:19:07 | 2016-03-11 16:19:07 | 0   |&#xA;+----+-------------+---------------------+---------------------+-----+&#xA;&#xA;collection_section&#xA;+----+---------------+-----------+---------------------+---------------------+-----+&#xA;| id | collectionId  | sectionId | dateCreated         | dateUpdated         | uid |&#xA;+----+---------------+-----------+---------------------+---------------------+-----+&#xA;|  1 |             1 |        16 | 2016-03-11 16:19:07 | 2016-03-11 16:19:07 | 0   |&#xA;|  2 |             1 |         9 | 2016-03-11 16:19:07 | 2016-03-11 16:19:07 | 0   |&#xA;|  3 |             1 |        14 | 2016-03-11 16:19:07 | 2016-03-11 16:19:07 | 0   |&#xA;|  4 |             1 |        10 | 2016-03-11 16:19:07 | 2016-03-11 16:19:07 | 0   |&#xA;+----+---------------+-----------+---------------------+---------------------+-----+&#xA;&#xA;craft_content&#xA;+------------+&#xA;| title      |&#xA;+------------+&#xA;| mytitle    |&#xA;+------------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've created 2 records:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// collectionRecord&#xA;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'collectionSection' =&amp;gt; array(&#xA;            static::HAS_MANY,&#xA;            'collectionSectionRecord',&#xA;            'sectionId'&#xA;        )&#xA;    );&#xA;}&#xA;&#xA;// collectionSectionRecord&#xA;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'collection' =&amp;gt; array(&#xA;            static::BELONGS_TO,&#xA;            'collectionRecord',&#xA;            'required' =&amp;gt; true,&#xA;            'onDelete' =&amp;gt; static::CASCADE&#xA;        ),&#xA;        'section'  =&amp;gt; array(&#xA;            static::BELONGS_TO,&#xA;            'SectionRecord',&#xA;            'required' =&amp;gt; true,&#xA;            'onDelete' =&amp;gt; static::CASCADE&#xA;        ),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The section ids are only singles and I need to get a listing of all the sections with their content related to the collectionId.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('s.*')&#xA;    -&amp;gt;from('sections s')&#xA;    -&amp;gt;join('collection_section cs', 'cs.sectionId = s.id')&#xA;    -&amp;gt;where(array('cs.collectionId' =&amp;gt; 1))&#xA;    -&amp;gt;queryAll();&#xA;return SectionModel::populateModels($query);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I actually get the sections from the craft_sections table but I need the related content (title row) &quot;mytitle&quot; in the craft_content table.&#xA;Is there an easy way to do that in Craft?&lt;/p&gt;&#xA;" OwnerUserId="5061" LastActivityDate="2016-04-27T17:22:33.230" Title="Querying relational data in plugin" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14794" PostTypeId="2" ParentId="673" CreationDate="2016-04-25T20:27:36.937" Score="1" Body="&lt;p&gt;For a case like yours, my &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow&quot;&gt;Retour&lt;/a&gt; plugin would work well, because it has a FieldType that you can attach to existing Entries, and do the redirect based on data from the entries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can set up a rule in the FieldType like &lt;code&gt;.*RecipeID={recipeid}&lt;/code&gt; as the default Legacy URL Pattern, and it'll pull the value from the &lt;code&gt;{recipeid}&lt;/code&gt; field in each entry, and create a redirect for it to the new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also doesn't do anything unless a 404 exception actually occurs.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-04-25T20:27:36.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14795" PostTypeId="2" ParentId="221" CreationDate="2016-04-25T20:29:31.023" Score="2" Body="&lt;p&gt;For this, my &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow&quot;&gt;Retour&lt;/a&gt; plugin would work well, because it has a FieldType that you can attach to existing Entries, and do the redirect based on data from the entries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can set up a rule in the FieldType like &lt;code&gt;.*RecipeID={recipeid}&lt;/code&gt; as the default Legacy URL Pattern for the FieldType, and it'll pull the value from the &lt;code&gt;{recipeid}&lt;/code&gt; field in each entry, and create a redirect for it to the new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also doesn't do anything unless a 404 exception actually occurs.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-04-25T20:29:31.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14796" PostTypeId="1" AcceptedAnswerId="14800" CreationDate="2016-04-25T20:30:52.720" Score="1" ViewCount="106" Body="&lt;p&gt;I have set up a user group named Administrators, to be used for the person in charge of managing the website day to day. But I didn't tick the Admin box as I don't want them to be able to access plugins or updates etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want them to be able to create users and fine tune the permissions of the users they create. So I ticked all the boxes in the User section. But if I log in as that Administrator I am allowed to change my own permissions (and all the other users) to access plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can't be right, how do I prevent them increasing their own permissions beyond those I have allocated them?&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2016-04-25T22:07:44.613" LastActivityDate="2017-02-25T05:16:58.040" Title="Users allocating permissions beyond their own" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14797" PostTypeId="1" AcceptedAnswerId="14799" CreationDate="2016-04-25T21:16:27.940" Score="1" ViewCount="69" Body="&lt;p&gt;Is there a way to define my plugins Record start ID? Now it start with ID 1, and for various reasons I would like to define a starting number.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2016-04-26T00:56:47.190" Title="Define record start ID" Tags="&lt;plugin-development&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14798" PostTypeId="1" AcceptedAnswerId="14833" CreationDate="2016-04-25T21:59:55.347" Score="2" ViewCount="338" Body="&lt;p&gt;I've been racking my brains trying to get my head around categories and entries, hopefully someone can help and show me the best way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an entry page with product information and this product is assigned to multiple categories across multiple groups. I need to exclude the category 'preferential' and only show entries that belong to the category group 'offers'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've got so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.relatedTo(entry) %}    &#xA;{% set excludeCat = craft.categories.slug('preferential').first() %}&#xA;&#xA;{% set allIds = [] %}&#xA;{% for id in categories.ids() if id != excludeCat.id %}&#xA;    {% set allIds = allIds|merge([id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(allIds) %}&#xA;&#xA;{% for offer in entries %}                    &#xA;    &amp;lt;a href=&quot;{{ offer.url }}&quot;&amp;gt;{{ offer.title }}&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried variations of 'group', 'ids' and 'groupId' but no joy. This is my first Craft CMS build so still learning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2016-04-28T10:09:35.530" Title="Loop through entries that share current entry category and restrict to Cat Group Id" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14799" PostTypeId="2" ParentId="14797" CreationDate="2016-04-26T00:56:47.190" Score="2" Body="&lt;p&gt;Not the most direct way, but you could do something like this from your plugin's record:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function createTable()&#xA;{&#xA;    // Let the base class do the actual work&#xA;    parent::createTable();&#xA;&#xA;    // Change the PK auto-increment starting point.&#xA;    craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;setText('ALTER TABLE myTable AUTO_INCREMENT=9999')-&amp;gt;execute();&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T00:56:47.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14800" PostTypeId="2" ParentId="14796" CreationDate="2016-04-26T01:04:03.273" Score="2" Body="&lt;p&gt;You should consider voting for this feature request: &lt;a href=&quot;https://github.com/craftcms/cms/issues/915&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/915&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-02-25T05:16:58.040" LastActivityDate="2017-02-25T05:16:58.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14801" PostTypeId="1" CreationDate="2016-04-26T01:25:27.973" Score="2" ViewCount="358" Body="&lt;p&gt;I use the plugin Craft Commerce. I can not find how to output the coupon code used by the customer in the back end on the order page.&#xA;Anyone would know how to?&#xA;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="4759" LastEditorUserId="57" LastEditDate="2016-04-26T18:07:58.973" LastActivityDate="2016-04-28T17:52:38.107" Title="Output coupon in the code back end using Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14802" PostTypeId="2" ParentId="14791" CreationDate="2016-04-26T02:11:51.340" Score="3" Body="&lt;p&gt;You can just manually fetch the entry in the other locale.  Assuming you already have the first &lt;code&gt;entry&lt;/code&gt;, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set localeEntry = craft.entries.id(entry.id).locale(languageID1).first() %}&#xA;&#xA;{% if localeEntry %}&#xA;    {{ localEntry.otherWordDefinition }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T02:11:51.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14803" PostTypeId="1" AcceptedAnswerId="14816" CreationDate="2016-04-26T08:37:13.780" Score="1" ViewCount="77" Body="&lt;p&gt;I'm writing a plugin which synchronizes the content from an external database with the Craft database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the images I receive URL's to the external image then store them in the temp storage and upload them to Craft assets, which works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now want to check additionally if the image in the temp already exists in crafts assets and if the images are identical ( checking for file size ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally comparing the external image and the image in the assets even before saving the external one to the temp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file size from the external source is identical to the tmp saved file but after uploading the file to Craft it somehow gets a little bit bigger so checking for the file size doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong ? Should I check for something else than filesize?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14784/is-there-any-way-to-prevent-craft-from-doing-anything-with-uploaded-gif-assets&quot;&gt;this question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-26T17:33:03.877" Title="Check if local image differs from image on Craft" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14804" PostTypeId="1" AcceptedAnswerId="19573" CreationDate="2016-04-26T08:49:12.473" Score="2" ViewCount="931" Body="&lt;p&gt;We have a client who has quite complex tabular data they need to add to their site. Hitherto they have been preparing these in Excel then pasting in but we are hitting issues with the way Redactor interprets merge table cells.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short of editing the HTML for each of these via source (quite laborious and cannot really expect to do this each time the client wants to add/udpate a table) is there any way through redactor to add more complex table cell formatting?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-03-22T13:56:38.860" Title="Redactor advanced table formatting?" Tags="&lt;redactor&gt;&lt;table&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14805" PostTypeId="1" CreationDate="2016-04-26T10:07:17.240" Score="1" ViewCount="733" Body="&lt;p&gt;I'm familiar with the option in the category settings that allows for categories within a category group to each have their own URLs:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bITPn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bITPn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this setup and it is working fine. However, I'm wondering if there is a URL structure that will allow me to have a category group &quot;home&quot; URL in which entries from all categories within the category group are shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are a couple of different ways I could do this by setting up templates for each category group &quot;home&quot; page, but I would prefer a way to do this using a single template that took into account the URL structure.&lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-05-01T17:02:28.970" Title="Entries from all categories in a category group via URL?" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14806" PostTypeId="1" AcceptedAnswerId="14815" CreationDate="2016-04-26T10:23:09.607" Score="4" ViewCount="104" Body="&lt;p&gt;So I have a user group containing a few thousand users and I want to remove all of those users with a SQL script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These users don't have access to the control panel and so don't have any Entries authored by them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DELETE FROM elements WHERE id IN (SELECT userId FROM usergroups_users WHERE `groupId` = 5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like this removes related entries from the &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;usergroups_users&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt; tables by virtue of the foreign key/cascade constraints. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I need to clean up?&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2016-04-26T17:22:12.340" Title="What SQL query can I run to remove all users assigned to a particular group?" Tags="&lt;users&gt;&lt;permissions&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14807" PostTypeId="1" AcceptedAnswerId="14808" CreationDate="2016-04-26T11:50:18.320" Score="1" ViewCount="85" Body="&lt;p&gt;Currently building a multi-lingual site. Developing locally using WAMP. Using trial version of 'Craft Pro'. Followed the step-by-step instructions of Craft's &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;Setting Up a Localized Site&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All works well except for one thing: &lt;strong&gt;Step 3: Define your translatable fields.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't make this work. When I check/tick my custom field's “This field is translatable” checkboxes, they don't seem to work as expected. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When I create an entry, put some values in the English locale, then hit save, all values get copied over to the French locale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means the moment I hit save, the French version of my site will display English content until I update it with the translation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm considering creating locale-specific sections to get around this problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help, much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current folder structure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;assets&lt;/li&gt;&#xA;&lt;li&gt;craft&lt;/li&gt;&#xA;&lt;li&gt;french&lt;/li&gt;&#xA;&lt;li&gt;uk&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5064" LastActivityDate="2016-04-26T13:01:45.497" Title="I want my custom field values to be stored on a per-locale basis, but can't seem to do this." Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14808" PostTypeId="2" ParentId="14807" CreationDate="2016-04-26T13:01:45.497" Score="1" Body="&lt;p&gt;No, you're not doing anything wrong. Craft copies the content over to all the other locales when you save an entry for the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind this is to give content editors a base for the translation, and for some content it’s not even necessary to translate at all. Imagine a text field for city names for example, you don’t need to translate &quot;Berlin&quot; or &quot;New York&quot; for some locales, but for &quot;Berlin and Munich&quot; the German translation would be &quot;Berlin und München&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One feature you might not have discovered is the &quot;Default Entry Status&quot; setting in the section settings. If you disable a locale by default, Craft will still copy over the content on the first save, but the entry won’t be live for this locale yet, you first have to explicitly enable the locale in the right pane of the edit entry view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jd139.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jd139.png&quot; alt=&quot;entry disabled for a locale&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-04-26T13:01:45.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14809" PostTypeId="1" CreationDate="2016-04-26T13:03:31.420" Score="1" ViewCount="7487" Body="&lt;p&gt;We are having a situation wherein the users are trying to open URLs in the same browser with multiple tabs, while doing that the session variables which store unique identifiers are overwritten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some setting which can help in overcoming this problem?&lt;/p&gt;&#xA;" OwnerUserId="5066" LastEditorUserId="45" LastEditDate="2016-04-26T20:00:40.383" LastActivityDate="2019-11-20T22:47:27.080" Title="Session related question - opening browser with multiple tabs" Tags="&lt;session&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14810" PostTypeId="1" CreationDate="2016-04-26T13:56:52.723" Score="1" ViewCount="390" Body="&lt;p&gt;We have an existing CMS and I'm just learning how to use CraftCMS so that I port the data from SQL Server to MySQL database. I went through a few videos on how to create a basic site so I kinda understand the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used a couple of plugins to import the data and one of them being this:&#xA;&lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/import&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin doesn't export existing data from MySQL data from Matrix field (using sample data). I wanted to see how the data is stored so I can create a similar format. But unfortunately the Matrix field comes back empty. I am not sure how to create and insert data in CraftCMS for this specific field. I will also at some point need to retrieve this data so I would like to know how the insert/select works on these fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="57" LastEditDate="2016-04-26T17:45:44.007" LastActivityDate="2016-09-23T20:40:49.147" Title="Import existing data in Matrix fields" Tags="&lt;matrix&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14811" PostTypeId="2" ParentId="14809" CreationDate="2016-04-26T14:02:00.170" Score="1" Body="&lt;p&gt;Per default, there is no way to have different sessions in the same browser window. The sessions are always shared trough all tabs. If two different Sessions are enough, you could use a privat/incognito browser window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A other solution could be to use HTML 5 SessionStorage for your variables. But this works only for your own variables: Craft CMS use normal sessions/cookies. You can find further informations about your topic here: &lt;a href=&quot;https://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs&quot;&gt;https://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-04-26T14:02:00.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14812" PostTypeId="1" AcceptedAnswerId="14818" CreationDate="2016-04-26T14:26:00.110" Score="2" ViewCount="376" Body="&lt;p&gt;Each time I try to rename a slug within an entry, the page refreshes, but the slug is getting a &lt;code&gt;-1&lt;/code&gt; appended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slug I want is: &lt;code&gt;forms&lt;/code&gt;. The slug I get after saving is: &lt;code&gt;forms-1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked through all the other entries and there's no duplicate slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2016-04-26T17:49:56.517" Title="Can't rename slug" Tags="&lt;entries&gt;&lt;entry&gt;&lt;slug&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14814" PostTypeId="1" CreationDate="2016-04-26T15:56:08.037" Score="1" ViewCount="85" Body="&lt;p&gt;So I'm using Craft to create code to be pasted into a blast email program. My standard template is at the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;newsletter/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I'm having trouble getting the text version to display in any way. I tried creating the following folder structure which did not work (404).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;newsletter/text/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried using routes in the backend to do this, but does not work either. I know I must be missing something simple. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-04-27T06:57:09.757" Title="Creating HTML and Text version of entry via different templates" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14815" PostTypeId="2" ParentId="14806" CreationDate="2016-04-26T17:22:12.340" Score="2" Body="&lt;p&gt;You've done it the correct way.  Assuming all of Craft's foreign keys and cascading deletes are all still in place, removing the user's element ID from the &lt;code&gt;craft_elements&lt;/code&gt; table is the way to go and all related data will cascade delete from there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T17:22:12.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14816" PostTypeId="2" ParentId="14803" CreationDate="2016-04-26T17:32:11.250" Score="1" Body="&lt;p&gt;It is related to the linked question since any images uploaded through Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService&quot; rel=&quot;nofollow&quot;&gt;AssetsService&lt;/a&gt; go through a &quot;cleansing&quot; process to remove any potentially embedded malicious scripts so the file size will inevitably be +/- the original by a small percentage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is instead of uploading through the AssetsService, programmatically copy the file to the final destination on the file system in an Asset Source, then trigger Asset indexing like how the &lt;a href=&quot;https://craftcms.com/classreference/controllers/ToolsController&quot; rel=&quot;nofollow&quot;&gt;ToolsController&lt;/a&gt; does for the &lt;a href=&quot;https://craftcms.com/classreference/tools/AssetIndexTool&quot; rel=&quot;nofollow&quot;&gt;AssetIndexTool&lt;/a&gt;.  That will bypass any cleansing operations.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T17:32:11.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14817" PostTypeId="2" ParentId="14810" CreationDate="2016-04-26T17:44:22.363" Score="1" Body="&lt;p&gt;I'm not 100% clear on exactly what you're looking for, but I'll just throw this out there.  Matrix content is saved in their own tables (table names are dynamically generated on a per-field basis) as opposed to most other fields, which have their content saved in the &lt;code&gt;craft_content&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look in &lt;a href=&quot;https://craftcms.com/classreference/services/MatrixService&quot; rel=&quot;nofollow&quot;&gt;MatrixService&lt;/a&gt; for methods needed for managing Matrix fields.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T17:44:22.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14818" PostTypeId="2" ParentId="14812" CreationDate="2016-04-26T17:49:56.517" Score="3" Body="&lt;p&gt;You can connect to your database and run:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM craft_elements_i18n WHERE slug = 'forms';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to see what other element is already using the slug &lt;code&gt;forms&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see what type of element it is (Entry, Asset, etc.), cross reference the &lt;code&gt;elementId&lt;/code&gt; column of the result with the &lt;code&gt;id&lt;/code&gt; column in the &lt;code&gt;craft_elements&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T17:49:56.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14819" PostTypeId="2" ParentId="14801" CreationDate="2016-04-26T18:07:31.443" Score="0" Body="&lt;p&gt;If you're referring to the order detail page in the control panel (i.e. &lt;code&gt;yourdomain.com/admin/commerce/orders/#####&lt;/code&gt;), then any promotions (sales/discounts) will be listed as a &quot;Discount Adjustment&quot; under the line items for the order.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-26T18:07:31.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14820" PostTypeId="2" ParentId="14792" CreationDate="2016-04-26T18:39:51.430" Score="2" Body="&lt;p&gt;I found the problem - the htaccess file was still the old EE file that had been there. Once I uploaded the Craft-provided htaccess file, I was able to get back into the control panel. Thanks for the help guys!&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2016-04-26T18:39:51.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14821" PostTypeId="2" ParentId="14770" CreationDate="2016-04-26T20:16:41.580" Score="2" Body="&lt;p&gt;I managed to figure this out on my own.  There's a good chance this solution will work for searching for entries between custom date fields using Craft's standard entry system (not the Venti Plugin) as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set start = craft.request.param('startMonth') %}&#xA; {% set end = craft.request.param('endMonth') %}&#xA; {% set entries = craft.venti.events.startDate('and', '&amp;gt;= ' ~ start|date('Y-m-d'), '&amp;lt;= ' ~ end|date('Y-m-d')) %}&#xA;&#xA; {% for entry in entries %}&#xA;      &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2016-04-26T20:16:41.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14823" PostTypeId="2" ParentId="14814" CreationDate="2016-04-27T06:57:09.757" Score="1" Body="&lt;p&gt;The issue may have to do with the extensions on the files in your template folder. By default, Craft only renders &lt;code&gt;.html&lt;/code&gt; and &lt;code&gt;.txt&lt;/code&gt; files. If you want Craft to also render &lt;code&gt;.txt&lt;/code&gt; files, you could update the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultTemplateExtensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;defaultTemplateExtensions&lt;/a&gt; config variable.  Adding something like this to your &lt;code&gt;general.php&lt;/code&gt; would get &lt;code&gt;.txt&lt;/code&gt; files rendering:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'defaultTemplateExtensions' =&amp;gt; array('html', 'twig', 'txt')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to access a &lt;code&gt;.txt&lt;/code&gt; file without enabling it as a &lt;code&gt;defaultTemplateExtension&lt;/code&gt;, you would have to access the template URL with the full file extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This URL would work out of the box:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/newsletter/entry.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would only render &lt;code&gt;.html&lt;/code&gt; or &lt;code&gt;.twig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/newsletter/entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These defaults makes it a little harder to use a hidden template file such as &lt;code&gt;newsletter/_entry&lt;/code&gt; for non-standard extensions. One work around would be to pass your ID as a parameter in the URL and manually grab it in your template code to determine what to do on the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an option:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/newsletter/entry.txt?id=123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As an alternative method, the plugin &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt; helps manage a lot of components of HTML and Text versions of email templates, and ships with a &lt;code&gt;Copy/Paste Mailer&lt;/code&gt; which allows a user to copy and paste the HTML and Text versions of an email directly from a modal in the the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MR7Ex.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MR7Ex.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-27T06:57:09.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14824" PostTypeId="1" AcceptedAnswerId="14830" CreationDate="2016-04-27T08:24:58.137" Score="2" ViewCount="59" Body="&lt;p&gt;I am having an issue whereby a form field is causing errors with Sprout Forms &amp;amp; Sprout Email to function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found the root of the problem in that the field, &lt;code&gt;fullName&lt;/code&gt; was causing errors, so changing it to &lt;code&gt;contactFullName&lt;/code&gt; seemed like a good idea, as not to confuse matters with Craft's own field &lt;code&gt;fullName&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When checking the logs after making these changes, sproutemail.log was still indicating an error related to the &lt;code&gt;fullName&lt;/code&gt; field. Strange! I had changed this! It seems that there is a &lt;code&gt;craft/storage/runtime/compiled_templates/03/****.php&lt;/code&gt; where *** is a long string filename used. Going to Settings -&gt; Refreshing the compiled templates did not fix this either, so what can I do to refresh this compiled template to reflect my changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-04-27T18:13:24.357" Title="Sprout Email compiled_templates" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14825" PostTypeId="2" ParentId="318" CreationDate="2016-04-27T08:29:23.993" Score="2" Body="&lt;p&gt;&lt;code&gt;'localhost'&lt;/code&gt; is simply not recognized when using as a domain-specific db config block. You have to use the general &lt;code&gt;'*'&lt;/code&gt;-block when serving your site via &lt;code&gt;http://localhost/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2016-04-27T08:29:23.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14826" PostTypeId="1" CreationDate="2016-04-27T08:29:40.857" Score="2" ViewCount="258" Body="&lt;p&gt;I've created a Fieldtype to use CK Editor so can take advantage of the advanced table formatting options over Redactor. However I want to keep Redactor for other content management. I came across this post so thought would give it a go: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10752/craft-wysiwyg-editor-and-ckeditor&quot;&gt;Craft WYSIWYG editor and CKEditor&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All seemed to be working well but now whenever I focus on a redactor field the CKEditor buttons pop up. Any thoughts as to why this might be happening? Screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LyvYU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LyvYU.png&quot; alt=&quot;CKEditor overlaying Redactor&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fieldtype code posted up at &lt;a href=&quot;https://gist.github.com/cole007/1ffa5036f8b79516ca34406d7b6833bf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/cole007/1ffa5036f8b79516ca34406d7b6833bf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts as to what might be causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole &lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-06T11:56:51.157" Title="CKEditor fieldtype overlaying redactor" Tags="&lt;plugin-development&gt;&lt;redactor&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14827" PostTypeId="1" AcceptedAnswerId="14828" CreationDate="2016-04-27T15:07:09.547" Score="3" ViewCount="280" Body="&lt;p&gt;Have kind of a weird problem going on with my site, which I just moved over from my staging server to production. Originally, everything looked fine, except I couldn't get into the Admin Panel. I discovered that I had an old .htaccess file in my root directory, and once I replaced that with the Craft CMS one, I was able to login just fine. Now, however, I've noticed that while most of the options on the left (Assets, Entries, Categories, etc) work as expected, if I select Settings, I'm greeted by a blank page. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14792/moved-from-dev-to-prod-server-admin-page-blank/14820#14820&quot;&gt;previous question&lt;/a&gt; as mentioned.&lt;/p&gt;&#xA;" OwnerUserId="895" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-27T16:56:48.283" Title="Settings in Admin Panel Blank" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14828" PostTypeId="2" ParentId="14827" CreationDate="2016-04-27T16:56:48.283" Score="4" Body="&lt;p&gt;There's a chance that one of your plugins is causing this behavior. Go into your &lt;code&gt;craft_plugins&lt;/code&gt; table, and change the value of &lt;code&gt;enabled&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; for every single plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Settings page is then accessible, cautiously re-enable each plugin one-by-one. This will help you hone in on which plugin may be causing the problem.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-04-27T16:56:48.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14829" PostTypeId="2" ParentId="14793" CreationDate="2016-04-27T17:22:33.230" Score="3" Body="&lt;p&gt;I ended up doing it this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$records = Plugin_CollectionSectionRecord::model()&#xA;        -&amp;gt;findAllByAttributes(['collectionId' =&amp;gt; $collectionId]);&#xA;}&#xA;&#xA;$ids = [];&#xA;foreach($records as $value) {&#xA;    $ids[] = $value-&amp;gt;sectionId;&#xA;}&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;elementType = 'Entry';&#xA;$criteria-&amp;gt;sectionId = $ids;&#xA;$result = $criteria-&amp;gt;all();&#xA;return $result;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5061" LastActivityDate="2016-04-27T17:22:33.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14830" PostTypeId="2" ParentId="14824" CreationDate="2016-04-27T18:13:24.357" Score="3" Body="&lt;p&gt;You can delete that folder entirely and it will get re-created on the next request that needs a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not updating, chances are you've got some PHP byte-level caching extension installed like &lt;a href=&quot;https://secure.php.net/manual/en/book.apc.php&quot; rel=&quot;nofollow&quot;&gt;APC&lt;/a&gt; or &lt;a href=&quot;https://secure.php.net/manual/en/book.opcache.php&quot; rel=&quot;nofollow&quot;&gt;OPcache&lt;/a&gt; that's not busting cache properly.  &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-27T18:13:24.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14831" PostTypeId="1" AcceptedAnswerId="14832" CreationDate="2016-04-28T09:15:38.220" Score="1" ViewCount="79" Body="&lt;p&gt;I have a channel of entries I'd like to loop through by order of importance on a scale of 1-5 with 5 being the most important and appearing first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to achieve this using a radio button field called importance and if else statements like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# List most important entries first #}&#xA;{% if entry.importance == &quot;5&quot; %}&#xA;&#xA;    &amp;lt;li class=&quot;deal&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;brand-image-wrapper&quot;&amp;gt;&#xA;            {% if entry.logo | length %}&#xA;                {% for asset in entry.logo %}&#xA;                    &amp;lt;img class=&quot;grayscale&quot; src=&quot;{{ asset.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;info&quot;&amp;gt;&#xA;            &amp;lt;h2 class=&quot;title&quot;&amp;gt;{{ entry.companyName }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    {% elseif entry.importance == &quot;4&quot; %}&#xA;&#xA;        &amp;lt;li class=&quot;deal&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;brand-image-wrapper&quot;&amp;gt;&#xA;                {% if entry.logo | length %}&#xA;                    {% for asset in entry.logo %}&#xA;                        &amp;lt;img class=&quot;grayscale&quot; src=&quot;{{ asset.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;info&quot;&amp;gt;&#xA;                &amp;lt;h2 class=&quot;title&quot;&amp;gt;{{ entry.companyName }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this isn't very DRY and this lists the entries but they are still ordered by date. Is it possible to use .order with a field to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="57" LastEditDate="2016-04-28T15:12:51.220" LastActivityDate="2016-04-28T15:12:51.220" Title="How to loop through entries by importance?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14832" PostTypeId="2" ParentId="14831" CreationDate="2016-04-28T09:46:24.740" Score="4" Body="&lt;p&gt;Yes, you can use &lt;code&gt;.order&lt;/code&gt; with any custom field, an example is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.section( 'sectionHandle' ).order( 'customFieldHandle' )&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info see the docs&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.entries#order&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-04-28T09:46:24.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14833" PostTypeId="2" ParentId="14798" CreationDate="2016-04-28T10:09:35.530" Score="4" Body="&lt;p&gt;You can make use of 'not' to exclude items from your parameters. An example of how this would be implemented in the above use case would be as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.slug( 'not preferential' ) %}&#xA;{% set entries = craft.entries.relatedTo( categories ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to specify category groups or entry sections then use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group( 'groupHandle' ).slug( 'not preferential' ) %}&#xA;{% set entries = craft.entries.section( 'sectionHandle' ).relatedTo( categories ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-04-28T10:09:35.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14834" PostTypeId="1" CreationDate="2016-04-28T11:22:30.963" Score="2" ViewCount="390" Body="&lt;p&gt;I'm trying to activate a user via a plugin so that when the user is returned to the login page they are re-directed to their profile page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm making use of the &lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow&quot;&gt;social logins beta plugin&lt;/a&gt; by dukt (I have written directly to them as well) which works fine if the user is already a craft user. However if the user is completely new to craft it throws an error saying the 'Account Has Not Been Activated'. When checking the CMS though the account has been set up and is active. So somewhere along the line the activation seems to be too late and is being delayed until after the user is sent back to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code creates a new user model in the plugin service with the _registerUser function. Which when looking at the object returned has 'pending =&gt;' so not actually set to anything not even zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a couple of things but neither worked firstly adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;activateUser($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;directly after saving the new UserModel and before returning the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly setting the new UserModel with pending = 0 and pending = '0'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newUser = new UserModel();&#xA;$newUser-&amp;gt;username = $attributes['email'];&#xA;$newUser-&amp;gt;email = $attributes['email'];&#xA;$newUser-&amp;gt;pending = '0';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So can anyone shed any light on this or can advise me if this is possible from within the plugin or how the activation works on a new user when you want to automatically activate them without sending an activation email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-08-11T15:57:07.270" Title="How to activate a user in a plugin?" Tags="&lt;users&gt;&lt;usermodel&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14835" PostTypeId="2" ParentId="8523" CreationDate="2016-04-28T13:27:32.623" Score="2" Body="&lt;p&gt;One way to get around this is to create a new Asset Source (let’s call it “Staging”).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add the folder of unindexed images/assets into &lt;em&gt;Staging&lt;/em&gt;, our new asset source (which should otherwise be empty).&lt;/li&gt;&#xA;&lt;li&gt;Now, run the asset indexer via Settings &gt; Update Asset Indexes only for our new source, &lt;em&gt;Staging&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Once the indexer has done its job, go to the Assets section of the Control Panel and drag the freshly indexed folder of images/assets from &lt;em&gt;Staging&lt;/em&gt; to the desired Asset Source.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Repeat the above process every time you wish to index a bunch of new assets without touching the previously indexed assets.&lt;/p&gt;&#xA;" OwnerUserId="3989" LastActivityDate="2016-04-28T13:27:32.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14836" PostTypeId="1" AcceptedAnswerId="14840" CreationDate="2016-04-28T14:34:27.017" Score="1" ViewCount="351" Body="&lt;p&gt;I'm getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;An exception has been thrown during the rendering of a template (&quot;Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named &quot;CONTACTFULLNAME&quot;.&quot;) in &quot;CONTACT FORM ENQUIRY FROM: {{object.CONTACTFULLNAME|raw}}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form has the following fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;contactFullName&lt;/code&gt;&#xA;&lt;code&gt;email&lt;/code&gt;&#xA;&lt;code&gt;message&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The email notification fields for the first email&lt;/em&gt; &lt;code&gt;Contact Form - Thank You&lt;/code&gt; message contain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subject: &lt;code&gt;Contact Form - Thank You ​{contactFullName}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Message: &lt;code&gt;Thank you for contacting us, {contactFullName}. We will be in touch soon.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;And for the other email:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subject: &lt;code&gt;Contact form enquiry from: {contactFullName}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Message: &lt;code&gt;You have received an enquiry Enquiry from {contactFullName} - {email} “{message}”&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed any light onto why this capitalised reference to the CONTACTFULLNAME missing method or closure (by this I presume field) appears in the logs? The form is getting saved, but no email sent due to this message.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-04-28T21:46:21.093" Title="Sprout Email not triggering from Sprout Form" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14837" PostTypeId="2" ParentId="14801" CreationDate="2016-04-28T17:52:38.107" Score="2" Body="&lt;p&gt;I have gone ahead and made the coupon used more visible on the order edit screen. Will be in the next release of Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, if you want the code to show up in the discount description in the backend, add it to the discount description when setting up the discount.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-04-28T17:52:38.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14838" PostTypeId="2" ParentId="14772" CreationDate="2016-04-28T17:56:14.640" Score="3" Body="&lt;p&gt;The &lt;strong&gt;Manual&lt;/strong&gt; payment gateway is designed for orders to be received without taking a live payment, or to be paid later by check or bank transfer. It allows you to mark the order as paid at a later time by clicking 'capture' in the order review screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Docs here: &lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#manual-gateway&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/payment-gateways#manual-gateway&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The manual gateway is included in the paid version of Craft Commerce.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-04-28T17:56:14.640" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14839" PostTypeId="2" ParentId="13625" CreationDate="2016-04-28T17:59:33.757" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/Propaganistas/Email-Obfuscator&quot; rel=&quot;nofollow&quot;&gt;This email obfuscation library&lt;/a&gt; works really well for me, and I'm using a rich text field. Applies both to mailto links as well as unlinked email addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably have to write a simple wrapper plugin to make it work as a twig extension. Also don't forget to include the library's JS file in the page's head so that it's loaded before it's needed.&lt;/p&gt;&#xA;" OwnerUserId="5071" LastActivityDate="2016-04-28T17:59:33.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14840" PostTypeId="2" ParentId="14836" CreationDate="2016-04-28T21:46:21.093" Score="2" Body="&lt;p&gt;Variables in Craft are case sensitive.  You'll run into the same error if you try to output the Craft &lt;code&gt;{{ siteName }}&lt;/code&gt; global as &lt;code&gt;{{ SITENAME }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating the casing to &lt;code&gt;{contactFullName}&lt;/code&gt; or &lt;code&gt;{{ object.contactFullName }}&lt;/code&gt; should get things working for you.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An extra note regarding the comments above. Luke is onto the right answer in the comments, however, one more distinction needs to be made. There are multiple variables available to your Sprout Email templates. To quote the docs linked in Luke's comment: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In your notification templates you can use any Twig code that you&#xA;  would use elsewhere in your templates. Additionally, Sprout Email&#xA;  Notifications give you access to the Notification Email Object (entry)&#xA;  and any Dynamic Object provided by the event (object)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your variable &lt;code&gt;contactFullName&lt;/code&gt; is not a field on your Notification Email Entry, it's a field on your Sprout Forms Submission Entry.  It's correct that you would get an error trying to refer to it as &lt;code&gt;{entry.contactFullName}&lt;/code&gt; because 1) the Notification Email doesn't have that field and, 2) the shorthand syntax is going to add the &lt;code&gt;object&lt;/code&gt; variable behind the scenes, so the variable would be seen as &lt;code&gt;{{ object.entry.contactFullName }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-28T21:46:21.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14841" PostTypeId="1" CreationDate="2016-04-28T23:23:08.023" Score="0" ViewCount="390" Body="&lt;p&gt;I receive the following error only when I clear the cache:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UcEbV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UcEbV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to rebuild the image index, all of my image paths go missing.&#xA;I'm not sure what caused this error but I do need to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked my image transforms and everything is named correctly. I even tried to delete and re-add and still nothing. I'm getting this same error on another one of my craft sites when I empty the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what's causing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did come across this post:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14739/cdbexception-column-not-found&quot;&gt;CDbException: Column not found&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read through the comments but no solution has been posted. I did a db search for CONSTRAINT or FOREIGN KEY and have both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help is appreciated.&#xA;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things I tested and found&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at the assettransformindex in the database and it was empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran an INSERT statement to populate the rows with proper information - it inserted successfully.&#xA;I refreshed the site, the CBd exception was gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cleared the cache, minus the image transform index and the site still worked perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cleared the cache with image transform index selected and it stripped everything from the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to upload an asset that uses the transform, it throws the CBd exception again and clears the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this information helps...&#xA;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="5073" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-04-30T23:48:36.193" Title="CBdException: Column 'id' cannot be null" Tags="&lt;assets&gt;&lt;database&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14842" PostTypeId="1" AcceptedAnswerId="14843" CreationDate="2016-04-29T02:23:11.217" Score="2" ViewCount="382" Body="&lt;p&gt;Similar to the question asked here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1171/how-to-add-a-tags-field-to-an-entry-form&quot;&gt;How to add a tags-field to an entry form?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to create an entry form that can create tags. I'm using &lt;a href=&quot;http://selectize.github.io/selectize.js/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://selectize.github.io/selectize.js/&lt;/a&gt; for the select element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently able to submit the form with existing tags but when trying to create a new tag using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.post('/tags/createTag', data, function(response) {&#xA;    if (response.success) {&#xA;        alert('Success')&#xA;    } else {&#xA;        alert('Unable to create that tag.');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get &lt;code&gt;http://talkbox.es:8888/index.php/tags/createTag 404 (Not Found)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you guys need any more information, I'll gladly get it for you! Thanks a ton in advance.&lt;/p&gt;&#xA;" OwnerUserId="5074" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-04-29T05:37:04.470" Title="Front-end form, creating a tag" Tags="&lt;form&gt;&lt;entry&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14843" PostTypeId="2" ParentId="14842" CreationDate="2016-04-29T05:37:04.470" Score="2" Body="&lt;p&gt;It looks like you are not targeting the action URL. When accessing a Craft controller, you'll need to use the &lt;code&gt;actionTrigger&lt;/code&gt; in your URL:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your current URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://talkbox.es:8888/index.php/tags/createTag&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be updated to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://talkbox.es:8888/index.php/actions/tags/createTag&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/config-settings#actionTrigger&quot; rel=&quot;nofollow&quot;&gt;actionTrigger is configurable&lt;/a&gt; so if you plan to reuse your code on multiple sites, you won't want to hard code that value. In twig, you can output that value using the &lt;code&gt;craft.config&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.actionTrigger }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-04-29T05:37:04.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14844" PostTypeId="1" AcceptedAnswerId="14845" CreationDate="2016-04-29T11:09:46.890" Score="2" ViewCount="202" Body="&lt;p&gt;How can I check if an Entry was posted less than a month ago?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-04-29T11:09:46.890" Title="How do I check if an Entry is new?" Tags="&lt;entry&gt;&lt;datetime&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14845" PostTypeId="2" ParentId="14844" CreationDate="2016-04-29T11:09:46.890" Score="2" Body="&lt;pre&gt;&lt;code&gt;{% if entry.postDate &amp;gt; now|date_modify(&quot;-1 month&quot;) %}&#xA;    {# Output #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-04-29T11:09:46.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14846" PostTypeId="2" ParentId="14769" CreationDate="2016-04-29T13:54:51.023" Score="3" Body="&lt;p&gt;User groups are not a &lt;code&gt;FieldType&lt;/code&gt; so you can create a category that matches the title of the &lt;code&gt;userGroup&lt;/code&gt; or put the actual category as a field on the &lt;code&gt;User&lt;/code&gt; and the &lt;code&gt;Variant&lt;/code&gt;. Then in your template do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set userGroup = currentUser.userGroup.first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set variants = craft.commerce.variants.product(product).relatedTo(userGroup) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would probably be the best way since you aren't reliant on string matching a title to find the correct variants.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2016-04-29T14:01:42.683" LastActivityDate="2016-04-29T14:01:42.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14847" PostTypeId="1" CreationDate="2016-04-29T14:38:30.270" Score="2" ViewCount="650" Body="&lt;p&gt;Below is my code to output the news entires under the &quot;news&quot; section of my site using the Element API. My question is how do I output the matrix block with a block type of &quot;text&quot; with a field called &quot;blockText&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/qcuestions/13118/how-do-you-use-the-element-api-plugin-to-output-matrix-blocks-for-an-entry&quot;&gt;https://craftcms.stackexchange.com/qcuestions/13118/how-do-you-use-the-element-api-plugin-to-output-matrix-blocks-for-an-entry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/entries' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;              // Check to see if there are any images&#xA;              $featuredImage = $entry-&amp;gt;featuredImage-&amp;gt;first();&#xA;              $bodyBlocks = [];&#xA;               foreach ($entry-&amp;gt;bodyEnhanced as $block) {&#xA;&#xA;                   switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                       case 'text':&#xA;                           $bodyBlocks[] = [&#xA;                            //'text' =&amp;gt; $block-&amp;gt;type-&amp;gt;attributeConfigs,&#xA;                            'content' =&amp;gt; $block-&amp;gt;type-&amp;gt;bodyText&#xA;                           ];&#xA;                       break;&#xA;                   }&#xA;               }&#xA;&#xA;                return [&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'postDate' =&amp;gt; $entry-&amp;gt;postDate,&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'excerpt' =&amp;gt; !empty($entry-&amp;gt;excerpt) ? $entry-&amp;gt;excerpt : false,&#xA;                    'image' =&amp;gt;   !empty($featuredImage) ? $featuredImage-&amp;gt;url : false,&#xA;                    'body' =&amp;gt; $bodyBlocks,&#xA;                ];&#xA;            }&#xA;        ],&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UNpnJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UNpnJ.png&quot; alt=&quot;screenshot of matrix block&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the only line that is breaking my JSON. Any help would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'content' =&amp;gt; $block-&amp;gt;type-&amp;gt;bodyText&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5077" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-09-05T17:20:08.743" Title="Output Matrix Block with Element API Plugin" Tags="&lt;matrix&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14848" PostTypeId="1" CreationDate="2016-04-29T14:55:53.073" Score="3" ViewCount="474" Body="&lt;p&gt;I'm attempting to enable a plugin from within the Craft control panel but I am unable to do so. It shows Disabled and when I click &quot;Enable&quot; it shows &quot;Plugin Enabled&quot; at the top but still shows disabled below and will not enable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not getting any errors reported and it seems to work on other environments just will not work now?&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="45" LastEditDate="2016-04-29T16:55:34.147" LastActivityDate="2016-04-29T18:28:17.707" Title="Cannot enable Craft plugin in control panel" Tags="&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14849" PostTypeId="1" CreationDate="2016-04-29T15:32:37.440" Score="6" ViewCount="368" Body="&lt;p&gt;I manage our corporate marketing website, which is written in PHP and the Zend Framework and is hosted on LAMP servers.  I've been tasked with moving the website to a CMS so other folks on the marketing team can update content without having my dev team be the bottleneck for content publishing and changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, our existing site is more of a web application, in that we use the Zend Framework and PHP code for back-end integrations with HubSpot, WebEx, etc. and various CRON jobs that hit endpoints on our site to do various jobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My concern is - how do I maintain the site as a web application without having to rewrite all that functionality in the language of the CMS.  I'm trying to see if I can split the site into two pieces 1) the majority of the static pages powered by the CMS, and 2) the web application stuff that can remain powered by Zend Framework.  Does anyone have experience doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My concern is if I send some traffic to www.site.com/A and other traffic to www.site.com/B (A being the CMS and B being the web app) how do I handle common layout code like navigation and footer?  Meaning if you update the nav in the CMS, this won't magically appear on the web app side.&lt;/p&gt;&#xA;" OwnerUserId="5079" LastEditorUserId="22" LastEditDate="2017-05-09T22:01:57.523" LastActivityDate="2017-05-09T22:01:57.523" Title="Existing website written in PHP Zend Framework" Tags="&lt;php&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14850" PostTypeId="2" ParentId="14848" CreationDate="2016-04-29T16:49:07.200" Score="5" Body="&lt;p&gt;My guess is it's a case sensitivity issue with the main plugin class/file name (some operating systems have case sensitive filesystems and some don't).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can review the requirements for how things should be named here: &lt;a href=&quot;https://craftcms.com/docs/plugins/setting-things-up&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/plugins/setting-things-up&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or better yet, use a site like &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; to generate the boilerplate plugin code for you and compare it to what you have.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-29T16:49:07.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14851" PostTypeId="2" ParentId="14848" CreationDate="2016-04-29T18:28:17.707" Score="2" Body="&lt;p&gt;In this instance all of the file names and database were correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We had not run our composer dump-autoload script in several months since we updated the name which caused this issue.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2016-04-29T18:28:17.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14852" PostTypeId="2" ParentId="14841" CreationDate="2016-04-30T23:48:36.193" Score="1" Body="&lt;p&gt;Turns out this was because several tables were missing the MySQL auto-increment flag for their &lt;code&gt;id&lt;/code&gt; integer primary keys.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-04-30T23:48:36.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14853" PostTypeId="2" ParentId="14805" CreationDate="2016-05-01T14:43:05.357" Score="4" Body="&lt;p&gt;Create a URL structure like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;yourwebsite.com/categories/groupName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set group = craft.request.getSegment(2) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set categories = craft.categories.group(segment) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the categories you can loop over them and fetch entries related to each. It may however, be more beneficial to do this via a plug-in where you can construct a more complex query based on the categories and therefore be more efficient.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;&#xA;    {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;    {% for entry in entries %}&#xA;        // template stuff&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="57" LastEditDate="2016-05-01T17:02:28.970" LastActivityDate="2016-05-01T17:02:28.970" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14854" PostTypeId="1" AcceptedAnswerId="14855" CreationDate="2016-05-01T19:15:21.450" Score="1" ViewCount="469" Body="&lt;p&gt;I am able to inspect my cart using &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I loop through each line item &amp;amp; check for a specific product type. I need to be able to get the specific product, as there are attributes (values) within that product that I am saving to my plugin's records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if a user purchases &quot;My Product&quot;, &quot;My Product&quot; has attributes that include things like &quot;Follow-Up Meetings Qty&quot; Where the admin is allowed to choose the number of meetings are included with &quot;My Product&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have that is close, I am stumbling getting the correct criteria model back. I know I'm not working with an entry, so I need to use the purchasable element type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete', function (Event $event) {&#xA;    user = $event-&amp;gt;params['order']-&amp;gt;getCustomer()-&amp;gt;getUser();&#xA;    $orderNumber = $event-&amp;gt;params['order']-&amp;gt;number;&#xA;&#xA;    foreach ($event-&amp;gt;params['order']-&amp;gt;lineItems as $item) {&#xA;        if ($item-&amp;gt;snapshot['product']['typeId'] == 123) {&#xA;             $productId = $item-&amp;gt;snapshot['id'];&#xA;&#xA;            // Get order details.&#xA;            switch ($productId) {&#xA;                case 456:&#xA;                    error_log('---- My Product Was Purchased ----');&#xA;                    error_log('user id: ' . $user-&amp;gt;id);&#xA;                    error_log('order number: ' . $orderNumber);&#xA;                    error_log('product id: ' . $productId);&#xA;&#xA;                    // Get the specific product that was purchased.&#xA;                    $criteria = craft()-&amp;gt;commerce_purchasables-&amp;gt;getCriteria(ElementType::Purchasable);&#xA;                    $criteria-&amp;gt;limit = 1;&#xA;&#xA;                    ...&#xA;&#xA;                    $products = $criteria-&amp;gt;find();&#xA;&#xA;                    if ($products) {&#xA;                        foreach ($products as $product) {&#xA;                          // Access the products' attributes&#xA;                          // $product-&amp;gt;meetings_qty  (3)&#xA;                          // $product-&amp;gt;foo_qty  (2)&#xA;                          // $product-&amp;gt;bar_qty&#xA;&#xA;                          ...&#xA;&#xA;                          // Save the values to my plugin record.&#xA;                        }&#xA;                    } else {&#xA;                        error_log('no products found that match criteria!');&#xA;                    }&#xA;&#xA;                break;&#xA;                ...&#xA;            }&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you Brad!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what the solution looks like after I removed the over-complication &quot;stuff&quot;. Hope this helps anyone who comes across this thread.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete', function (Event $event) {&#xA;        $user = $event-&amp;gt;params['order']-&amp;gt;getCustomer()-&amp;gt;getUser();&#xA;        $orderNumber = $event-&amp;gt;params['order']-&amp;gt;number;&#xA;&#xA;        foreach ($event-&amp;gt;params['order']-&amp;gt;lineItems as $item) {&#xA;            error_log('User id: ' . $user-&amp;gt;id);&#xA;            error_log('Order number: ' . $orderNumber);&#xA;            error_log('Product title: ' . $item-&amp;gt;purchasable-&amp;gt;title);&#xA;            error_log('Product id: ' . $item-&amp;gt;purchasable-&amp;gt;id);&#xA;            error_log('Meetings qty: ' . $item-&amp;gt;purchasable-&amp;gt;product-&amp;gt;myFieldHandle);&#xA;&#xA;            ...&#xA;            do some other stuff...&#xA;            ...&#xA;            Save the record.&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-05-02T01:15:17.157" LastActivityDate="2016-05-02T01:15:17.157" Title="How can I get a specific product via plugin?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14855" PostTypeId="2" ParentId="14854" CreationDate="2016-05-01T23:56:46.767" Score="3" Body="&lt;p&gt;I think you have direct access to the purchasable already via a simple&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$lineItem-&amp;gt;purchasable&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. I do things like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($event-&amp;gt;params['order']-&amp;gt;lineItems as $item) {&#xA;    BusinessLogicPlugin::log($item-&amp;gt;purchasable-&amp;gt;title);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should really just be able to access the fields directly on the purchasable via&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$lineItem-&amp;gt;purchasable-&amp;gt;field&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I don't  think you need to use the snapshot side of things at all as long as you're doing this at this stage anyway - the snapshot is something you use if you're dealing with an order when the product data may have since changed etc. as I understand it.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2016-05-02T00:03:01.843" LastActivityDate="2016-05-02T00:03:01.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14856" PostTypeId="1" AcceptedAnswerId="14857" CreationDate="2016-05-02T06:49:47.930" Score="4" ViewCount="3271" Body="&lt;p&gt;I should begin to say that I have no idea really how exactly ajax works. Although I've used it a couple of times with pre-made WordPress plugins. I saw some examples of ajax entry-loading here on Stack Exchange, I tried to make ajax requests in Craft but just ended up with server errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main goal that I want to accomplish is just to have a news-feed that begin to show 5 entries, a button on the bottom that appends five more.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it best to use jQuery for the Ajax-request?  &lt;/li&gt;&#xA;&lt;li&gt;How can I load the &quot;next&quot; five entries in a news-feed, so the call doesn't load the latest five entries over and over?&lt;/li&gt;&#xA;&lt;li&gt;I've seen that you need to build a specific template for ajax-calls. Is there any good examples of those?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If someone got some advice for me how to accomplish this it would make me so happy!&#xA;It'd be really nice to learn how it works, so if you got tips of tutorials, working examples, good reads — please share :)&lt;/p&gt;&#xA;" OwnerUserId="5086" LastEditorUserId="57" LastEditDate="2016-05-02T16:08:32.367" LastActivityDate="2017-04-26T05:13:48.530" Title="How to load entry-objects with Ajax" Tags="&lt;templating&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14857" PostTypeId="2" ParentId="14856" CreationDate="2016-05-02T07:44:25.510" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it best to use jQuery for the Ajax-request?`&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily. jQuery provides an easy-to-use &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ajax&lt;/code&gt; function&lt;/a&gt;, but nowadays it's perfectly simple to &lt;a href=&quot;http://www.sitepoint.com/guide-vanilla-ajax-without-jquery/&quot; rel=&quot;nofollow noreferrer&quot;&gt;make an AJAX call with vanilla JS&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I load the &quot;next&quot; five entries in a news-feed, so the call doesn't load the latest five entries over and over?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You will need to pass an offset and limit to your element query, or use Craft's &lt;code&gt;paginate&lt;/code&gt; tag, in order to only receive data for one 'page' of elements at a time.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've seen that you need to build a specific template for ajax-calls. Is there any good examples of those?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I prefer to use the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API plugin&lt;/a&gt; to serve up my JSON for front-end consumption... but you can also build a JSON feed using a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here are some links that might be helpful:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://learn.jquery.com/ajax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Basic intro info about AJAX&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://codesion.co.uk/2015/10/14/lazy-loading-channel-content-in-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tutorial on front-end lazy-loading with Craft&lt;/a&gt; ... (site appears offline at the moment, so you can also use a &lt;a href=&quot;https://web.archive.org/web/20151019033252/http://codesion.co.uk/2015/10/14/lazy-loading-channel-content-in-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wayback copy&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API plugin&lt;/a&gt;, which allows you to easily create a JSON feed of queried elements: &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2842/infinite-scrolling-with-craft&quot;&gt;Other&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/146/how-do-i-setup-ajax-paging-for-entries&quot;&gt;answers&lt;/a&gt; from SE questions about AJAX pagination/loading&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-05-02T07:44:25.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14858" PostTypeId="1" CreationDate="2016-05-02T11:32:51.583" Score="1" ViewCount="4172" Body="&lt;p&gt;I am new to Craft CMS. I am building my first industrial design portfolio site and am facing a brick wall.. The problem is that I have three image handlers that I set up in field. &lt;code&gt;thumbnail&lt;/code&gt;, &lt;code&gt;projectBanner&lt;/code&gt; and &lt;code&gt;projectThumbnail&lt;/code&gt; that I want to display in project section. I found this code snippet and made changes to it to match one of my image handler.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.projectBanner %}&#xA;    &amp;lt;img src=&quot;{{ asset.getUrl(thumb) }}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I made sure that I have upload the image (projectBanner) to a entry and refreshed the browser. The image does not show up but the title does. Could anyone please tell me what I did wrong and what the correct method to achieve outputting images into entries?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2016-05-02T16:11:03.900" LastActivityDate="2016-05-02T16:11:03.900" Title="Output image in template" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2016-05-04T23:03:27.107" ContentLicense="CC BY-SA 3.0" />
  <row Id="14859" PostTypeId="1" CreationDate="2016-05-02T12:23:22.737" Score="1" ViewCount="82" Body="&lt;p&gt;I followed &lt;a href=&quot;http://craftcookbook.net/recipes/330&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; sample code from craft cookbook to display my entries grouped together by category within a category group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add some context, the site I'm working on is for a dictionary and the words in the dictionary are the main entries. There are several category groups that I use to classify the words. For example, words can belong to different themes: household items are in the household category, names of animals are in the nature category and so on. So far, here is the code I have below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByCat = {} %}&#xA;{% set entries = craft.entries.section('words') %}&#xA;{% set cats = craft.categories.group(themes) %}&#xA;&#xA;{% for cat in cats %}&#xA;  {% set entries = entries.relatedTo(cat) %}&#xA;  {% if entries|length %}&#xA;    {% set entriesByCat = entriesByCat|merge({ (cat.title): entries}) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if cats|length %}&#xA;    {% for catTitle, catEntries in entriesByCat %}&#xA;        &amp;lt;div class=&quot;category-title&quot;&amp;gt;&#xA;          &amp;lt;h2&amp;gt;{{ catTitle }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% for entry in catEntries %}&#xA;          {# Entry content goes here... #}&#xA;          ...&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine to output one field for the category (the category title). However, some of these categories have pictures associated with them, and I would like to be able to access those as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the h2 tag I would like add a conditional to check if a category has an associated image in the &quot;categoryImage&quot; field for the category. If it does have an image I'd like to output the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been able to do this in other situations where I have more direct access to the category but I can't figure out how to access to the category image field within the loop structure that I have setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated. I have to admit that I'm a bit beyond my depth with the twig template code above. :-)&lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-05-03T17:06:40.473" Title="Get additional category field when outputing entries grouped by categories" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14860" PostTypeId="1" CreationDate="2016-05-02T13:26:20.343" Score="0" ViewCount="556" Body="&lt;p&gt;I am new to Craft Commerce and trying to get a handle on how to display variants on the Product Page.  I want to display only the variants which have a specific SKU.  I have the following code.  (I included the all the code as my problem could be any where.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'commerce/_layouts/main' %}&#xA;{% block main %}&#xA;&#xA;{% requireLogin %}&#xA;&#xA;{# -- LISTS PRODUCTS-- #}&#xA;{% for product in craft.commerce.products.order('title asc').limit(5).find() %}&#xA;&#xA;{# --PRODUCT ROW----------------------------------------------------------------------------------------------------- #}&#xA;&amp;lt;div class=&quot;row product&quot;&amp;gt;&#xA;&#xA;    {# --PRODUCT IMAGE-------------------------------------------- #}&#xA;    &amp;lt;div class=&quot;two columns&quot;&amp;gt;&#xA;        {# {% include &quot;commerce/_images/product&quot; with { class: 'u-max-full-width' } %} #}&#xA;&#xA;        {% for image in product.productImage %}&#xA;            &amp;lt;img class=&quot;u-max-full-width&quot; src=&quot;{{ image.url }}&quot; height=&quot;{{ image.height }}&quot; width=&quot;{{ image.width }}&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {# ----------------------------------------end PRODUCT IMAGE-- #}&#xA;&#xA;&#xA;    {# --PRODUCT BODY------------------------------------------------------------------------ #}&#xA;    &amp;lt;div class=&quot;ten columns&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h5&amp;gt;{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}&amp;lt;/h5&amp;gt;&#xA;&#xA;        {% if product.variants|length %}&#xA;&#xA;            {# --PRODUCT INPUT FORM (Add to Cart)------------------------- #}&#xA;            &amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;                {{ getCsrfInput() }}&#xA;&#xA;                &amp;lt;select name=&quot;purchasableId&quot;&amp;gt;&#xA;                    {% for purchasable in product.variants %}&#xA;&#xA;                        &amp;lt;option &#xA;                            {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} &#xA;                            value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;&#xA;&#xA;                                {# --PRICE LEVEL ONE----------------------------------- #}&#xA;                                {% if currentUser.isInGroup( 'priceLevelOne' ) %}&#xA;&#xA;                                    {% set variants = craft.commerce.variants({&#xA;                                            product: product,&#xA;                                            sku: '2654982'&#xA;                                    }) %}&#xA;&#xA;                                    {% for variant in product.variants %}&#xA;                                            Product Number: {{ variant.sku }} |&#xA;                                            Price:  {{ variant.price|currency(cart.currency) }}&#xA;                                    {% endfor %}&#xA;                                {# -------------------------------end PRICE LEVEL ONE-- #}&#xA;&#xA;&#xA;&#xA;                                {# --PRICE LEVEL TWO----------------------------------- #}                                  &#xA;                                {% elseif currentUser.isInGroup( 'priceLevelTwo' ) %}&#xA;&#xA;                                    {% set variants = craft.commerce.variants({&#xA;                                            product: product,&#xA;                                            sku: '2895264'&#xA;                                    }) %}&#xA;&#xA;                                    {% for variant in product.variants %}&#xA;                                        {% if variant.priceLevel == 'priceLevel2' %}&#xA;                                            Product Number: {{ variant.sku }} |&#xA;                                            Price:  {{ variant.price|currency(cart.currency) }}&#xA;                                        {% endif %}&#xA;                                    {% endfor %}&#xA;&#xA;&#xA;&#xA;                                {# --PRICE LEVEL THREE--------------------------------- #}  &#xA;                                {% elseif currentUser.isInGroup( 'priceLevelThree' ) %}&#xA;&#xA;                                    {% set variants = craft.commerce.variants({&#xA;                                            product: product,&#xA;                                            sku: '3568659'&#xA;                                    }) %}&#xA;                                    {% for variant in product.variants %}&#xA;                                        {% if variant.priceLevel == 'priceLevel3' %}&#xA;                                            Product Number: {{ product.stockDescription1 }} |&#xA;                                            Price:  {{ variant.price|currency(cart.currency) }}&#xA;                                        {% endif %}&#xA;                                    {% endfor %}&#xA;&#xA;&#xA;                                {% endif %}&#xA;&#xA;                        &amp;lt;/option&amp;gt;&#xA;&#xA;                    {% endfor %}&#xA;                &amp;lt;/select&amp;gt;&#xA;&#xA;&#xA;&#xA;                {# -- ADD TO CART BUTTON------------------------------- #}&#xA;                {# &amp;lt;select name=&quot;options[giftWrapped]&quot;&amp;gt;&#xA;                    &amp;lt;option value=&quot;no&quot;&amp;gt;No gift wrap.&amp;lt;/option&amp;gt;&#xA;                    &amp;lt;option value=&quot;yes&quot;&amp;gt;Gift wrapped.&amp;lt;/option&amp;gt;&#xA;                &amp;lt;/select&amp;gt; #}&#xA;&#xA;                {% if product.unlimitedStock or (product.unlimitedStock == false and product.totalStock &amp;gt; 0 ) %}&#xA;                    &amp;lt;button type=&quot;submit&quot;&amp;gt;{{ &quot;Add to cart&quot;|t }}&amp;lt;/button&amp;gt;&#xA;                {% else %}&#xA;                    {{ &quot;Out of Stock&quot;|t }}&#xA;                {% endif %}&#xA;                {# --end ADD TO CART BUTTON---------------------------- #}&#xA;&#xA;            &amp;lt;/form&amp;gt;&#xA;            {# ---------------------end PRODUCT INPUT FORM (Add to Cart)-- #}&#xA;&#xA;        {% endif %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {# --------------------------------------------------------------------end PRODUCT BODY-- #}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{# ------------------------------------------------------------------------------------------------ end PRODUCT ROW-- #}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="57" LastEditDate="2016-05-02T16:19:36.513" LastActivityDate="2016-05-02T23:48:34.227" Title="Limit variants In Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14861" PostTypeId="2" ParentId="14858" CreationDate="2016-05-02T13:54:48.013" Score="7" Body="&lt;p&gt;When you are working with an asset field you are actually looking at the object so you need to call &lt;code&gt;{{asset.url}}&lt;/code&gt; in order to actually output the path to the image or whatever asset you are working with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.projectBanner %}&#xA;&#xA;    &amp;lt;img src=&quot;{{asset.url}}&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As some additional information I would checkout eager-loading in craft as it can drastically help performance as your website grows!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-05-02T13:54:48.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14862" PostTypeId="2" ParentId="14860" CreationDate="2016-05-02T14:02:47.880" Score="1" Body="&lt;p&gt;In &lt;code&gt;Commerce&lt;/code&gt; variants are the same as a &lt;code&gt;purchasable&lt;/code&gt; which have a service to get by &lt;code&gt;sku&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;getPurchasableBySku($sku)&lt;/code&gt; on &lt;code&gt;Commerce_PurchasablesService.php&lt;/code&gt; inside the Commerce plug-in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could very easily write your own Twig variable to handle this for you and return only the purchasable, or variant you want to show on the product page.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="57" LastEditDate="2016-05-02T16:20:15.933" LastActivityDate="2016-05-02T16:20:15.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14863" PostTypeId="2" ParentId="9400" CreationDate="2016-05-02T14:15:38.693" Score="4" Body="&lt;p&gt;I have several client Craft sites on &lt;a href=&quot;https://www.nexcess.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nexcess&lt;/a&gt;, using their ExpressionEngine shared plans. The support has always been excellent, and it performs really well. Note that you can use most versions of PHP, you'll just need to request it from support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Nexcess now offers &lt;a href=&quot;https://www.nexcess.net/craftcms/hosting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-specific hosting&lt;/a&gt;, and PHP versions can be selected in the hosting control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently cloned a fairly query-heavy client site to the cheapest EEP 100 Nexcess plan and a ServerPilot-managed 2GB Digitalocean droplet with MySQL tuned a bit based on Percona recommendations. Both were using PHP 7. I didn't do extensive load testing, but with dev mode on, the Nexcess server outperformed my DO server consistently, on all front-end and control panel views.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2016-12-09T23:33:08.000" LastActivityDate="2016-12-09T23:33:08.000" CommentCount="0" CommunityOwnedDate="2016-05-02T14:15:38.693" ContentLicense="CC BY-SA 3.0" />
  <row Id="14864" PostTypeId="1" CreationDate="2016-05-02T17:38:26.677" Score="3" ViewCount="1220" Body="&lt;p&gt;Building on top of the Commerce Example Templates. I've made an order field called 'Customer Reference'. I'm submitting data like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;shopForm&quot; method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;fields[customerReference]&quot;&amp;gt;Your Reference: {{cart.customerReference}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[customerReference]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;input class=&quot;btn btn-outline&quot; type=&quot;submit&quot; value=&quot;Update Reference&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code seems to work ok. But after updating the cart the data doesn't seem to be saved, it doesn't show up in the Commerce back end. I'm also not able to be display the data later on in the ordering process, on the receipt for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this to display the data from the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{cart.customerReference}} or {{order.customerReference}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can somebody tell me, possibly with some examples, how to properly submit and retrieve the content for custom order fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is related to: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13104/how-can-i-update-custom-order-fields-in-the-frontend&quot;&gt;How can I update custom order fields in the frontend&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working with: mamp&lt;/p&gt;&#xA;" OwnerUserId="171" LastActivityDate="2016-07-21T15:56:10.893" Title="How do I make use of the order fields In Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14865" PostTypeId="1" CreationDate="2016-05-02T18:03:44.520" Score="1" ViewCount="223" Body="&lt;p&gt;&lt;strong&gt;Working with the example Commerce templates.&lt;/strong&gt; In the cart template there is an example for adding a note. &lt;a href=&quot;https://craftcommerce.com/docs/line-item-model#note&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/line-item-model#note&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for this form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;shopForm&quot; method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateLineItem&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/cart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;lineItemId&quot; value=&quot;{{ item.id }}&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&#xA;&amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;note&quot;&amp;gt;Note&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; size=&quot;20&quot; name=&quot;note&quot; value=&quot;{{ item.note }}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;qty&quot;&amp;gt;Quantity&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot; min=&quot;1&quot; value=&quot;{{ item.qty }}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; class=&quot;btn btn-outline&quot; value=&quot;Update&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very useful but after submitting the form, how can we display this later on in the ordering process? For example on a receipt or the order overview. Also can we view this in the Commerce back end? I was not able to find …&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody shed some light? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="171" LastActivityDate="2016-05-02T18:24:51.467" Title="How to use a note from the Line Item Model" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14866" PostTypeId="2" ParentId="14865" CreationDate="2016-05-02T18:24:51.467" Score="1" Body="&lt;p&gt;The example template show how to display the note, but here is the jist of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in cart.lineItems %}&#xA; {{item.qty }} x {{ item.description }} - {{ item.note }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-05-02T18:24:51.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14867" PostTypeId="2" ParentId="14860" CreationDate="2016-05-02T23:48:34.227" Score="3" Body="&lt;p&gt;To fill out the answer above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the plugin skeleton builder here to make a plugin:  &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;http://pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fill in the fields at the top, and in the choices below choose just 'variables'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generate your plugin, and then you'll see in the zip you get that it has all the scaffolding a plugin needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the file &lt;code&gt;variables\PluginnameVariable.php&lt;/code&gt; you should change this example function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function exampleVariable($optional = null)&#xA;{&#xA;    return &quot;And away we go to the Twig template...&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function purchasableBySku($sku)&#xA;{&#xA;    return craft()-&amp;gt;commerce_purchasables-&amp;gt;getPurchasableBySku($sku);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your template you can just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set purchasable = craft.pluginName.purchasableBySku(whatever) %}&#xA;{% if purchasable|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...to get a specific purchasable by sku.  (Note untested but should be pretty much right!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**** HOWEVER, all that being said, I would probably in practise do it a different way, unless I am mis-understanding the question.  It seems like you're already looping through the variants so why not just compare the sku??  *Unless you're trying to display a variant of a different product than the one you're looping over??&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for variant in product.variants %}&#xA;    {% if variant.sku == &quot;whatever %}&#xA;        ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc.  As long as you're talking about variants of the same product, you've already fetched what you need, so why do it again?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-02T23:48:34.227" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14868" PostTypeId="1" CreationDate="2016-05-03T00:32:24.147" Score="0" ViewCount="532" Body="&lt;p&gt;I can't get through the install process using MAMP PRO. Here is the log from &lt;code&gt;storage/runtime/logs&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/05/03 00:10:22 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;Stack trace:&#xA;#0 /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php(242): Craft\WebApp-&amp;gt;_processUpdateLogic()&#xA;#1 /Users/amsiMac/craftCMS/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /Users/amsiMac/craftCMS/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /Users/amsiMac/craftCMS/public/index.php(19): require_once('/Users/amsiMac/...')&#xA;#4 {main}&#xA;REQUEST_URI=/index.php/admin/actions/users/getAuthTimeout?dontExtendSession=1&#xA;HTTP_REFERER=http://mycraft/admin/dashboard&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2016/05/03 00:11:22 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;Stack trace:&#xA;#0 /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php(242): Craft\WebApp-&amp;gt;_processUpdateLogic()&#xA;#1 /Users/amsiMac/craftCMS/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /Users/amsiMac/craftCMS/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /Users/amsiMac/craftCMS/public/index.php(19): require_once('/Users/amsiMac/...')&#xA;#4 {main}&#xA;REQUEST_URI=/index.php/admin/actions/users/getAuthTimeout?dontExtendSession=1&#xA;HTTP_REFERER=http://mycraft/admin/dashboard&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2016/05/03 00:11:32 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:798&#xA;Stack trace:&#xA;#0 /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /Users/amsiMac/craftCMS/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /Users/amsiMac/craftCMS/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /Users/amsiMac/craftCMS/public/index.php(19): require_once('/Users/amsiMac/...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2016/05/03 00:12:23 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;Stack trace:&#xA;#0 /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php(242): Craft\WebApp-&amp;gt;_processUpdateLogic()&#xA;#1 /Users/amsiMac/craftCMS/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /Users/amsiMac/craftCMS/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /Users/amsiMac/craftCMS/public/index.php(19): require_once('/Users/amsiMac/...')&#xA;#4 {main}&#xA;REQUEST_URI=/index.php/admin/actions/users/getAuthTimeout?dontExtendSession=1&#xA;HTTP_REFERER=http://mycraft/admin/dashboard&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2016/05/03 00:12:05 [warning] [application] Skipping record /Users/amsiMac/craftCMS/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have all the folder permissions set to 777 and followed &lt;a href=&quot;http://blog-en.mamp.info/2010/02/how-to-set-mysql-default-storage-engine.html&quot; rel=&quot;nofollow&quot;&gt;these directions&lt;/a&gt; to make sure InnoDB was being used&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; new log in devMode&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/05/03 00:55:17 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:798&#xA;2016/05/03 00:55:17 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:55:19 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:55:19 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:55:47 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:55:47 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:55:58 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:55:58 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:56:20 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:56:20 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:56:47 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:56:47 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2016/05/03 00:56:59 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/amsiMac/craftCMS/craft/app/etc/web/WebApp.php:934&#xA;2016/05/03 00:56:59 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;in /Users/amsiMac/craftCMS/craft/app/etc/errors/ErrorHandler.php (281)&#xA;    `status` ENUM('pending','error','running') NULL,&#xA;    `status` ENUM('pending','error','running') NULL,&#xA;    `status` ENUM('pending','error','running') NULL,&#xA;2016/05/03 00:57:03 [info] [application] Creating the deprecationerrors table.&#xA;2016/05/03 00:57:03 [trace] [system.db.CDbCommand] Executing SQL: CREATE TABLE `craft_deprecationerrors` (&#xA;2016/05/03 00:57:03 [profile] [system.db.CDbCommand.execute] begin:system.db.CDbCommand.execute(CREATE TABLE `craft_deprecationerrors` (&#xA;2016/05/03 00:57:03 [profile] [system.db.CDbCommand.execute] end:system.db.CDbCommand.execute(CREATE TABLE `craft_deprecationerrors` (&#xA;2016/05/03 00:57:03 [trace] [system.db.CDbCommand] Executing SQL: CREATE UNIQUE INDEX `craft_deprecationerrors_key_fingerprint_unq_idx` ON `craft_deprecationerrors` (`key`, `fingerprint`)&#xA;2016/05/03 00:57:03 [profile] [system.db.CDbCommand.execute] begin:system.db.CDbCommand.execute(CREATE UNIQUE INDEX `craft_deprecationerrors_key_fingerprint_unq_idx` ON `craft_deprecationerrors` (`key`, `fingerprint`))&#xA;2016/05/03 00:57:03 [profile] [system.db.CDbCommand.execute] end:system.db.CDbCommand.execute(CREATE UNIQUE INDEX `craft_deprecationerrors_key_fingerprint_unq_idx` ON `craft_deprecationerrors` (`key`, `fingerprint`))&#xA;2016/05/03 00:57:03 [info] [application] Finished creating the deprecationerrors table.&#xA;2016/05/03 00:57:08 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42000]: Syntax error or access violation: 1055 'craft_test.elements.type' isn't in GROUP BY. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;2016/05/03 00:57:08 [error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 'craft_test.elements.type' isn't in GROUP BY. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;2016/05/03 00:57:08 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5089" LastEditorUserId="5089" LastEditDate="2016-05-03T01:00:50.350" LastActivityDate="2016-05-05T13:17:13.803" Title="Getting stuck in &quot;Oops&quot; on install with MAMP PRO" Tags="&lt;installation&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14869" PostTypeId="1" CreationDate="2016-05-03T09:21:33.967" Score="1" ViewCount="45" Body="&lt;p&gt;I want to build a fairly large website (over 1000,000 pages and even more users) and I was wandering if Craft was made for large websites or should I look somewhere else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any examples of large websites built with Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="5092" LastActivityDate="2016-05-03T09:21:33.967" Title="Can I build a 100,000 pages website with Craft?" Tags="&lt;entry&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2016-05-03T16:49:36.250" ContentLicense="CC BY-SA 3.0" />
  <row Id="14870" PostTypeId="1" AcceptedAnswerId="14871" CreationDate="2016-05-03T09:53:03.147" Score="3" ViewCount="681" Body="&lt;p&gt;I know how to display every next entry, but is it possible when there is no next entry it displays the first one and if there isn’t a previous display the last entry?&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-03T10:03:40.827" Title="Infinite getPrev and getNext?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14871" PostTypeId="2" ParentId="14870" CreationDate="2016-05-03T09:53:03.147" Score="8" Body="&lt;p&gt;You would need query for these entries using the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#first&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;first&lt;/code&gt;&lt;/a&gt; and the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#last&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;last&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set criteria = craft.entries.section('blog').order('title asc') %}&#xA;&#xA;{% set prevEntry = entry.getPrev(criteria) ?: criteria.last() %}&#xA;{% set nextEntry = entry.getNext(criteria) ?: criteria.first() %}&#xA;&#xA;&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;{{ prevEntry.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;{{ nextEntry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-05-03T10:03:40.827" LastActivityDate="2016-05-03T10:03:40.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14872" PostTypeId="2" ParentId="1415" CreationDate="2016-05-03T10:08:26.397" Score="3" Body="&lt;p&gt;Just updating this thread with another option. Also using Rsync but through the Mac app Dropsync3 &lt;a href=&quot;http://mudflatsoftware.com/&quot; rel=&quot;nofollow&quot;&gt;http://mudflatsoftware.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty cool, I'm currently getting the &quot;dump&quot; plugin to make a daily db backup via Cron and then getting Dropsync to sync the &quot;storage&quot; folder with a folder on my computer (that is version controlled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also doing similarly with assets and just debating the best way to handle system updates.&lt;/p&gt;&#xA;" OwnerUserId="5093" LastActivityDate="2016-05-03T10:08:26.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14873" PostTypeId="2" ParentId="14784" CreationDate="2016-05-03T11:07:44.933" Score="3" Body="&lt;p&gt;Although this issue turned out to be the result of a bug, for the record you can bypass Craft's image processing step by manually uploading an image directly to the assets folder on the server (ie. via FTP rather than Craft) and then selecting &quot;Update Asset Indexes&quot; in Craft's admin panel (under &quot;Settings&quot;). This allowed me to get the problem image up and working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously for most images it's much better - more secure, and more convenient - to upload them via Craft, but if all else fails this may be useful to know.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-05-03T11:07:44.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14874" PostTypeId="2" ParentId="14859" CreationDate="2016-05-03T13:00:25.997" Score="2" Body="&lt;p&gt;Just focusing on the assets part I would try to eager-load the image and insert it into your template that way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByCat = {} %}&#xA;{% set entries = craft.entries.section('words').find() %}&#xA;{% set cats = craft.categories.group(themes).find({&#xA;    with: ['categoryImage']&#xA;}) %}&#xA;&#xA;{% for cat in cats %}&#xA;  {% set entries = entries.relatedTo(cat) %}&#xA;  {% set catImage = cat.categoryImage[0] ?? null %}&#xA;  {% if entries|length %}&#xA;    {% set entriesByCat = entriesByCat|merge({ (cat.title): { entries: entries, image: catImage}) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if cats|length %}&#xA;    {% for catTitle, catInfo in entriesByCat %}&#xA;        &amp;lt;div class=&quot;category-title&quot;&amp;gt;&#xA;          &amp;lt;h2&amp;gt;{{ catTitle }}&amp;lt;/h2&amp;gt;&#xA;          &amp;lt;img src={{catInfo.image.url}}&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% for entry in catInfo.entries %}&#xA;          {# Entry content goes here... #}&#xA;          ...&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may want to change the naming convention a little bit, but I just wanted to try and stick to yours as is.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2016-05-03T17:06:40.473" LastActivityDate="2016-05-03T17:06:40.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14875" PostTypeId="1" AcceptedAnswerId="14879" CreationDate="2016-05-03T13:16:14.467" Score="3" ViewCount="781" Body="&lt;p&gt;&lt;strong&gt;Working with the Commerce example templates.&lt;/strong&gt;&#xA;The example template uses javascript to populate the States which is based on the selected Country. The code for the Country and State select field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;field plaintext {% if model and model.getErrors('countryId') | length %}has-error{% endif %}&quot;&amp;gt;&#xA;&amp;lt;label for=&quot;{{ modelName }}-countryId&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;&amp;lt;select class=&quot;address-country&quot; name=&quot;{{ modelName }}[countryId]&quot;&amp;gt;&#xA;    {% for key, option in countries %}&#xA;        {% set optionValue = (model ? model.countryId : '') %}&#xA;        &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;{% if model and model.getErrors('countryId') %}&#xA;    &amp;lt;p class=&quot;errors&quot;&amp;gt;{{ model.getErrors('countryId')|join }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;field plaintext {% if model and model.getErrors('stateId') | length %}has-error{% endif %}&quot;&amp;gt;&#xA;&amp;lt;label for=&quot;{{ modelName }}-state&quot;&amp;gt;State&amp;lt;/label&amp;gt;&#xA;{% set options = (model and states[model.countryId] is defined ? states[model.countryId] : []) %}&#xA;&amp;lt;select id=&quot;{{ modelName }}-stateId&quot; data-modelname=&quot;{{ modelName }}&quot; class=&quot;address-stateId {% if options|length == 0 or (model and model.stateName) %}hidden{% endif %}&quot; name=&quot;{{ modelName }}[stateValue]&quot;&amp;gt;&#xA;    {% for key, option in options %}&#xA;        {% set optionValue = (model ? model.stateId : '') %}&#xA;        &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %}selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; data-modelname=&quot;{{ modelName }}&quot; id=&quot;{{ modelName }}-stateName&quot; class=&quot;address-stateName {% if options|length &amp;gt; 0 or (model and model.stateId) %}hidden{% endif %}&quot; {% if model and model.stateName %}name=&quot;{{ modelName }}[stateValue]&quot; value=&quot;{{ model.stateName}}&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I'm looking for is a drop down for US States no other Countries will be used. I like to keep the 'model' in place though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includejs %}&#xA;var states = {{ craft.commerce.statesArray|json_encode|raw }};&#xA;&#xA;$('select.address-country').change(function ()&#xA;{&#xA;    // get the value of the selected country.&#xA;    var cid = $(this).val();&#xA;    var $states = $(this).closest('.addressBox').find('select.address-stateId');&#xA;    var $stateName = $(this).closest('.addressBox').find('input.address-stateName');&#xA;    $states.find('option').remove();&#xA;&#xA;    if (states.hasOwnProperty(cid))&#xA;    {&#xA;        // We have states for this country, show the states drop down.&#xA;        $states.removeClass('hidden');&#xA;        $states.attr('name', $states.data('modelname')+'[stateValue]');&#xA;&#xA;        // We have states for this country, hide the stateName input.&#xA;        $stateName.removeAttr('name');&#xA;        $stateName.addClass('hidden');&#xA;        $stateName.val('');&#xA;&#xA;        // Add all states as options to drop down.&#xA;        for (var id in states[cid])&#xA;        {&#xA;            var state = states[cid][id];&#xA;            var $option = $('&amp;lt;option/&amp;gt;');&#xA;            $option.attr('value', id).text(state);&#xA;            $states.append($option);&#xA;        }&#xA;&#xA;    }else{&#xA;        // hide the states dropdown, since this country has none.&#xA;        //$states.addClass('hidden');&#xA;        //$states.removeAttr('name');&#xA;&#xA;        // show the stateName&#xA;        $stateName.removeClass('hidden');&#xA;        $stateName.attr('name', $stateName.data('modelname')+'[stateValue]');&#xA;    }&#xA;&#xA;});&#xA;&#xA;$('select').addClass('form-control input-sm');{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="171" LastActivityDate="2016-05-03T17:10:25.973" Title="How can I create a States drop down?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14876" PostTypeId="1" AcceptedAnswerId="14877" CreationDate="2016-05-03T14:10:18.007" Score="1" ViewCount="3119" Body="&lt;p&gt;I have a redirect setup for &lt;em&gt;www&lt;/em&gt;, it successfully redirects to &lt;em&gt;https://&lt;/em&gt; but it includes &lt;strong&gt;/index.php?p=&lt;/strong&gt; in the URL. I'm not convinced by htaccess file is configured correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;RewriteBase /&#xA;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ https://%1/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2017-07-24T16:22:28.687" Title="When redirecting to HTTPS from www, index.php appears in URL" Tags="&lt;htaccess&gt;&lt;https&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14877" PostTypeId="2" ParentId="14876" CreationDate="2016-05-03T16:54:06.743" Score="3" Body="&lt;p&gt;There are docs for removing &lt;code&gt;index.php&lt;/code&gt; from your URLs here: &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also docs for enforcing SSL for all CP requests here: &lt;a href=&quot;https://craftcms.com/support/force-ssl&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/force-ssl&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that they mention the the SSL rewrite should happen &lt;em&gt;before&lt;/em&gt; the &lt;code&gt;index.php&lt;/code&gt; rewrite in your &lt;code&gt;.htaccess&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-03T16:54:06.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14879" PostTypeId="2" ParentId="14875" CreationDate="2016-05-03T17:10:25.973" Score="3" Body="&lt;p&gt;I ended up just hardcoding based on the US &lt;code&gt;countryId&lt;/code&gt; of &lt;code&gt;233&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set states = craft.commerce.statesArray[&quot;233&quot;] %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then simplified my template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;{{ 'model' ~ '[stateId]' }}&quot; required&amp;gt;&#xA;     {% for key, state in states %}&#xA;          &amp;lt;option value=&quot;{{key}}&quot;&amp;gt;{{state}}&amp;lt;/option&amp;gt;&#xA;     {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-05-03T17:10:25.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14880" PostTypeId="2" ParentId="12999" CreationDate="2016-05-03T18:17:01.133" Score="4" Body="&lt;p&gt;I've encountered this problem before, and it seemed to be solved by replacing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;runSubTask('WassermanNews_TwitterTask');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;runSubTask('WassermanNews_Twitter');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5028" LastEditorUserId="57" LastEditDate="2016-05-03T18:23:35.847" LastActivityDate="2016-05-03T18:23:35.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14881" PostTypeId="1" CreationDate="2016-05-04T07:28:25.110" Score="2" ViewCount="308" Body="&lt;p&gt;According to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5437/errors-occuring-with-assets-and-amazon-s3&quot;&gt;this post&lt;/a&gt; it's not possible to use Craft 2.x with Amazon S3 within the Frankfurt region. As Craft 3 is still not near release it would be nice to have some sort of a fallback solution. For us that issue is a major drawback ... and I can imagine for other folks from the EU region too.&lt;/p&gt;&#xA;" OwnerUserId="3323" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-05-04T08:40:10.057" Title="Using Amazon S3 with Craft 2.x in Frankfurt region" Tags="&lt;s3&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14882" PostTypeId="1" AcceptedAnswerId="15162" CreationDate="2016-05-04T08:15:21.127" Score="3" ViewCount="157" Body="&lt;p&gt;Would like to be able to handle requests for structured requests so that it may be handled in one endpoint &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    about.json&#xA;    about/the-team.json&#xA;    about/contact/london.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Presumably a form of regex would be required for this to work?&#xA;Contemplating:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    pages/about.json&#xA;    pages/about/the-team.json&#xA;    pages/about/contact/london.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All though how would you prepare a check for 'pages' as your first node?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently have this but not fees able. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   '&amp;lt;slug:{slug}&amp;gt;*.json' =&amp;gt; function($slug) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2016-05-23T11:41:51.713" Title="ElementAPI endpoint routing syntax for multi-level structure" Tags="&lt;routing&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14883" PostTypeId="2" ParentId="14881" CreationDate="2016-05-04T08:40:10.057" Score="2" Body="&lt;p&gt;The AWS Frankfurt region (eu-central-1) does only support the &quot;new&quot; v4 signature. Craft 2 uses the v2 signature of the S3 API and that's not easy to fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ireland (eu-west-1) should be good enough in terms of latency.&lt;/p&gt;&#xA;" OwnerUserId="4538" LastActivityDate="2016-05-04T08:40:10.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14884" PostTypeId="2" ParentId="12610" CreationDate="2016-05-04T09:14:57.150" Score="1" Body="&lt;p&gt;I have since discovered that searching on a related model is fairly easy to implement. You just define the related model as an attribute that can be searched on in &lt;code&gt;defineSearchableAttributes&lt;/code&gt; method of the element type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @inheritDoc IElementType::defineSearchableAttributes()&#xA; *&#xA; * @return array&#xA; */&#xA;public function defineSearchableAttributes()&#xA;{&#xA;    return ['dateCreated', 'totalPaid', 'customer'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you just have to have a matching handler for that attribute (&lt;em&gt;customer&lt;/em&gt;) in the &lt;code&gt;modifyElementsQuery&lt;/code&gt; method, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if ($criteria-&amp;gt;customer) {&#xA;        if ($criteria-&amp;gt;customer instanceof MyPlugin_CustomerModel) {&#xA;            if ($criteria-&amp;gt;customer-&amp;gt;id) {&#xA;                $criteria-&amp;gt;customerId = $criteria-&amp;gt;customer-&amp;gt;id;&#xA;                $criteria-&amp;gt;customer = null;&#xA;            } else {&#xA;                return false;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    if ($criteria-&amp;gt;customerId) {&#xA;        $query-&amp;gt;andWhere(DbHelper::parseParam('orders.customerId', $criteria-&amp;gt;customerId, $query-&amp;gt;params));&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then once search indexes are rebuilt, you'll be able to search on all attributes of a customer.&lt;/p&gt;&#xA;" OwnerUserId="4890" LastActivityDate="2016-05-04T09:14:57.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14885" PostTypeId="1" AcceptedAnswerId="14886" CreationDate="2016-05-04T10:03:29.130" Score="2" ViewCount="144" Body="&lt;p&gt;This is a super basic question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a plugin that watches two events, in one event it creates a user. After another event I want it to activate that user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get/store/pass the id of the newly created user from the first event to the second?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('thing.beforeEvent', function(Event $event){&#xA;        // Save the new user if they're not already a user&#xA;        if(!craft()-&amp;gt;userSession-&amp;gt;getUser()){&#xA;            $newUser = new UserModel;&#xA;&#xA;            $newUser-&amp;gt;firstName = craft()-&amp;gt;request-&amp;gt;getPost('firstName');&#xA;            $newUser-&amp;gt;lastName  = craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;            $newUser-&amp;gt;username  = craft()-&amp;gt;request-&amp;gt;getPost('username');&#xA;            $newUser-&amp;gt;email     = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;            $newUser-&amp;gt;password  = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;&#xA;            $newUserSuccess = craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;            if (!$newUserSuccess)&#xA;            {&#xA;                Craft::log('Couldn’t save the new user', LogLevel::Error);&#xA;            }&#xA;        }&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('thing.afterEvent', function(Event $event){&#xA;        // Activate the new user if they're not already a user&#xA;        //if(!craft()-&amp;gt;userSession-&amp;gt;getUser()){&#xA;        //  craft()-&amp;gt;users-&amp;gt;activateUser();&#xA;        //}&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-05-04T10:17:52.263" Title="Storing variables in a plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14886" PostTypeId="2" ParentId="14885" CreationDate="2016-05-04T10:17:52.263" Score="3" Body="&lt;p&gt;Declare a private variable inside your class, &lt;code&gt;private $userId = NULL&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you've saved the user in the first method, update the variable &lt;code&gt;$this-&amp;gt;userId = $user-&amp;gt;id&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second method grab the user by using the variable &lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserById($this-&amp;gt;userId);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't actually tested the code, but it might do the trick :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: You might want to make a null-check before attempting to fetch the user, to ensure that it doesn't break if it tries to run it while the variable is still &lt;code&gt;NULL&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2016-05-04T10:17:52.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14888" PostTypeId="1" AcceptedAnswerId="14890" CreationDate="2016-05-04T10:24:48.027" Score="2" ViewCount="2937" Body="&lt;p&gt;I've got an entry page and at the bottom I would like to show related products and then underneath that, related offers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the main page entry isn't assigned to any categories I've tried to use a custom field and the search param to show 'related' entries and this works fine, BUT, when I try and make it dynamic, it doesn't pull through. I'm guessing this is some kind of parsing order and that the custom field isn't parsed before the loop is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# To exclude certain category #}&#xA;{% set categories = craft.categories.slug('not preferential') %}&#xA;{% set entries = craft.entries.section('offers').search('A1').relatedTo(categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't when I try and make it dynamic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.slug('not preferential') %}&#xA;{% set entries = craft.entries.section('offers').search('{{ entry.model }}').relatedTo(categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried setting the variable first but it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set range = &quot;{{ entry.model }}&quot; %}&#xA;{% set categories = craft.categories.slug('not preferential') %}&#xA;{% set entries = craft.entries.section('offers').search(range).relatedTo(categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this makes sense. Still in the basics I suppose of Craft but worth the learning curve. &lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2016-05-04T13:04:26.753" Title="Using the Search Filter with Entry Fields" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;&lt;field&gt;&lt;search&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14889" PostTypeId="1" AcceptedAnswerId="14893" CreationDate="2016-05-04T11:20:51.847" Score="2" ViewCount="189" Body="&lt;p&gt;Any thoughts why a Sprout Form is not saving a form submission that contains a file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not throwing any errors and on submission the user is returned to the form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a local build - I thought it might be a permissions issue with the file upload but nothing in logs, which seem to suggest that the entry/submission is being saved (event is valid, element saved).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, nothing is being saved in the back-end and the file is not being uploaded to the allotted directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Confused - any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-04T15:08:20.987" Title="Sprout Forms file upload" Tags="&lt;plugin-sproutforms&gt;&lt;files&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14890" PostTypeId="2" ParentId="14888" CreationDate="2016-05-04T13:04:26.753" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% set range = entry.model %}&#xA;{% set categories = craft.categories.slug('not preferential') %}&#xA;{% set entries = craft.entries.section('offers').search('title:' ~ range).relatedTo(categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are only searching titles I would add that in the search params as it will help the effectiveness of the search. In addition when setting a variable you do not need to use the &lt;code&gt;{{}}&lt;/code&gt; syntax as it will automatically use the string representation of the the field if it is a text field.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-05-04T13:04:26.753" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14891" PostTypeId="1" CreationDate="2016-05-04T13:32:21.400" Score="1" ViewCount="871" Body="&lt;p&gt;I have nginx and PHP up and running.  &lt;code&gt;phpinfo()&lt;/code&gt; shows that mcrypt is installed and enabled.  I was sure to &lt;code&gt;sudo php5enmod mcrypt&lt;/code&gt;.  However, Craft is still complaining the mcrypt isn't installed.  What else can I troubleshoot?&lt;/p&gt;&#xA;" OwnerUserId="5099" LastEditorUserId="57" LastEditDate="2016-05-04T16:18:24.083" LastActivityDate="2016-05-04T16:18:24.083" Title="Mcrypt not recognized" Tags="&lt;install&gt;&lt;mcrypt&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-05-05T07:41:59.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="14892" PostTypeId="2" ParentId="14891" CreationDate="2016-05-04T13:39:22.647" Score="0" Body="&lt;p&gt;Nevermind.  Must have been caching or something.  I'm up and running.  Computer voodoo.&lt;/p&gt;&#xA;" OwnerUserId="5101" LastActivityDate="2016-05-04T13:39:22.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14893" PostTypeId="2" ParentId="14889" CreationDate="2016-05-04T15:08:20.987" Score="2" Body="&lt;p&gt;For the record, the issue, as determined from the comments above was that the Asset field settings did not allow the type of file that was being uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating the Asset field settings to allow the uploaded file type solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-05-04T15:08:20.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14895" PostTypeId="1" CreationDate="2016-05-04T17:11:26.267" Score="3" ViewCount="1107" Body="&lt;p&gt;I'm writing a plugin to notify authors when a Disqus comment is posted. There is a Disqus JS callback you can use to hook into this, so I'm doing the following on the front-end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.callbacks.onNewComment = [function(comment) {&#xA;  var commentNotification = new window.VIGET.CommentNotification();&#xA;&#xA;  commentNotification.notify('{{ actionUrl(&quot;vigetDisqus/notify/notify&quot;) }}', comment, {{ entry.id }}, {{ entry.author.id }});&#xA;}];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I am passing the actionUrl of my controller, the comment itself, the entry id, and the author id. This all works perfectly fine, and I am passing it as data along as an AJAX request to the controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CommentNotification.prototype = {&#xA;  notify: function(actionUrl, comment, entryId, authorId) {&#xA;    var data = JSON.stringify({&#xA;      comment: comment,&#xA;      entryId: entryId,&#xA;      authorId: authorId&#xA;    });&#xA;&#xA;    xhr({&#xA;      uri: actionUrl,&#xA;      method: 'POST',&#xA;      body: data,&#xA;      headers: {&#xA;        'Content-Type': 'application/json',&#xA;        'X-Requested-With': 'XMLHttpRequest'&#xA;      }&#xA;    }, function(err, resp) {&#xA;      console.log(resp.body)&#xA;    });&#xA;  }&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I access the posted data inside my controller? I thought I could use the getPost method, but I am always getting null.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class VigetDisqus_NotifyController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionNotify()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;        $authorId = craft()-&amp;gt;request-&amp;gt;getPost('authorId');&#xA;&#xA;        $this-&amp;gt;returnJson(array('authorId' =&amp;gt; $authorId));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="31" LastActivityDate="2016-05-04T19:12:05.807" Title="Access data when posting to controller from front-end" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;controller&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14896" PostTypeId="2" ParentId="14895" CreationDate="2016-05-04T19:12:05.807" Score="2" Body="&lt;p&gt;Turns out the &lt;a href=&quot;https://www.npmjs.com/package/xhr&quot; rel=&quot;nofollow&quot;&gt;ajax library&lt;/a&gt; I was using was expecting the data to be passed in a serialized format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'comment=' + comment + '&amp;amp;entryId=' + entryId + '&amp;amp;authorId=' + authorId&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that as the body of the request, the data became accessible to my controlled by using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2016-05-04T19:12:05.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14897" PostTypeId="2" ParentId="14868" CreationDate="2016-05-05T00:44:04.833" Score="1" Body="&lt;p&gt;I am answering this to report that I did get it working and to collect the links describing edits needed in the my.cnf and httpd.conf files in one place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got it working earlier today by starting over completely with a new server in MAMP Pro, a new db created in PHPMyAdmin, and a freshly downloaded set of files from craftcms.com&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I made the file permissions to 777 as needed&lt;/li&gt;&#xA;&lt;li&gt;Re-edited the https.conf file as described &lt;a href=&quot;https://craftcms.stackexchange.com/a/6573/5089&quot;&gt;here&lt;/a&gt; and&lt;/li&gt;&#xA;&lt;li&gt;reran the tests to make sure &lt;a href=&quot;http://blog-en.mamp.info/2010/02/how-to-set-mysql-default-storage-engine.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;InnoDB was available&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have no idea why it wasn't working the other day. &lt;/p&gt;&#xA;" OwnerUserId="5089" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-05-05T13:17:13.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14898" PostTypeId="1" CreationDate="2016-05-05T01:48:04.757" Score="1" ViewCount="310" Body="&lt;p&gt;I am trying to figure out how to only display the slider on the homepage so that it does not show in other page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting close but not sure what code I should write. Here is what I could think of but does not work..  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if slider in homepage %}&#xA;    slider goes here...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I appreciate any suggestion to what the correct way of displaying content in specific page/section/entry ...&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2016-05-05T02:45:18.787" LastActivityDate="2016-05-05T08:46:24.557" Title="Display sliders on homepage" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14899" PostTypeId="2" ParentId="14898" CreationDate="2016-05-05T08:26:40.363" Score="2" Body="&lt;p&gt;Have a look at the Sections and Entries article in the official Craft documentations. It explains how to set up sections and how to configure them to load a particular template if an entry’s URL is requested. &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/sections-and-entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important topic you should get yourself familiar with is how Craft’s routing mechanism works. &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To configure a template for your homepage you could create a template in &lt;code&gt;craft/templates/index.html&lt;/code&gt; and Craft will use it for homepage requests (routing case 4). Or you configure a section in such a way that the homepage’s URI matches one of the section entries’ URIs (routing case 6). Note that there’s also a special checkbox “This is for the homepage” available in the settings for single sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a designated template for your homepage in place, you can now add your slider code snippet to it. In the case that this template is responsible for multiple entries, e.g., entries of a structure section, you could wrap it in a conditional to check against the entry’s ID for example.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.id == 12 %}&#xA;    &amp;lt;!-- Slider code --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-05-05T08:46:24.557" LastActivityDate="2016-05-05T08:46:24.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14900" PostTypeId="1" AcceptedAnswerId="14912" CreationDate="2016-05-05T09:26:37.140" Score="2" ViewCount="1009" Body="&lt;p&gt;I've got a plugin that creates PDFs using Michael Rog’s Printmaker plugin. I'm able to successfully save these to a local folder and, using &lt;code&gt;insertFileByLocalPath()&lt;/code&gt;, add them to an asset source. Then, by finding the &lt;code&gt;id&lt;/code&gt; of the newly created asset, I can save the PDF to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the asset field in the entry is setup to use dynamically-created subfolders, which I want to use to keep the assets for each entry separate from each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, because the dynamically-created subfolder doesn’t exist until an asset is added to the entry, I am adding the PDF to the parent folder using &lt;code&gt;insertFileByLocalPath()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that when I added the asset to the entry and saved it, Craft would dynamically create the subfolder and move the asset into it, but it doesn’t do this. Instead, it just leaves the assets in the parent folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a simplified version of the code I’m using at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create PDF with $vars and $settings&#xA;$pdf = craft()-&amp;gt;printmaker_pdf-&amp;gt;pdfFromTemplate($template, $vars, $settings);&#xA;&#xA;// Save PDF and get URL&#xA;$pdfUrl = $pdf-&amp;gt;url();&#xA;&#xA;// Get assets parent folder&#xA;$folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'name' =&amp;gt; 'parent-folder'&#xA;));&#xA;&#xA;...&#xA;&#xA;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $localFilePath, &#xA;    $filename, &#xA;    $folder-&amp;gt;id, &#xA;    AssetConflictResolution::KeepBoth&#xA;);&#xA;&#xA;// Get id of pdf (newly created Asset)&#xA;$pdfId = craft()-&amp;gt;assets-&amp;gt;findFile(array(&#xA;    'filename' =&amp;gt; $settings['filename'].'.pdf'&#xA;))-&amp;gt;id;&#xA;&#xA;// Add PDF to entry&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'myAssetField' =&amp;gt; array($pdfId)&#xA;));&#xA;&#xA;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;    // Yay! PDF successfully saved to myAssetField&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here’s what the asset folder layout looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parent-folder/new.pdf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas what I want to achieve is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parent-folder/entry-slug/new.pdf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;entry-slug&lt;/code&gt; is a dynamically created subfolder for each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I can achieve this, or if it is even possible?&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-05-05T19:34:09.480" Title="How do I add a local file to an asset field with a dynamically generated sub-folder?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14901" PostTypeId="1" AcceptedAnswerId="14902" CreationDate="2016-05-05T10:53:02.447" Score="2" ViewCount="1055" Body="&lt;p&gt;I would like to automatically subscribe all newly registered users to a MailChimp mailing list.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2019-11-19T01:48:24.893" Title="Automatically subscribe users to MailChimp list?" Tags="&lt;users&gt;&lt;emails&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14902" PostTypeId="2" ParentId="14901" CreationDate="2016-05-05T10:53:02.447" Score="5" Body="&lt;p&gt;Install the &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MailChimp Subscribe&lt;/a&gt; plugin and add the following &lt;code&gt;users.onActivateUser&lt;/code&gt; event listener to your site’s &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Business Logic&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('users.onActivateUser', function(Event $event) {&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    if (!$user-&amp;gt;admin) {&#xA;        $result = craft()-&amp;gt;mailchimpSubscribe-&amp;gt;subscribe($user-&amp;gt;email, '');&#xA;&#xA;        if (!$result['success']) {&#xA;            Craft::log('Couldn’d subscribe to MailChimp list: '.print_r([&#xA;                'errorCode' =&amp;gt; $result['errorCode'],&#xA;                'message' =&amp;gt; $result['message'],&#xA;            ], true), LogLevel::Error);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-06-04T21:36:37.920" LastActivityDate="2017-06-04T21:36:37.920" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14903" PostTypeId="1" AcceptedAnswerId="14915" CreationDate="2016-05-05T13:16:42.440" Score="4" ViewCount="1635" Body="&lt;p&gt;We are currently updating a brochure website, separating a single list of products into a series of sub-categories. Currently, we have a &quot;single&quot; section to display all products, and then a &quot;channel&quot; which has two entry types (products &amp;amp; accessories). I am trying to work out how best to create the new site structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to display a parent page which lists all products, but then 6 sub-pages which show only the products in that category. I use the word category without specifically meaning the Craft CMS category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read other posts such as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10692/structures-vs-categories-for-product-catalog&quot;&gt;Structure(s) vs. Categories for product catalog&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8571/difference-between-categories-and-structures&quot;&gt;Difference between categories and structures&lt;/a&gt; but these don't seem to help. There seems to be a bit of confusion surrounding Craft categories, structures and using singles to divide the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could we re-organise the existing content into this new structure?&lt;/p&gt;&#xA;" OwnerUserId="4965" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-05-05T21:21:08.370" Title="Product Categories, Structures and Channels" Tags="&lt;categories&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14904" PostTypeId="1" AcceptedAnswerId="14910" CreationDate="2016-05-05T13:37:59.320" Score="1" ViewCount="86" Body="&lt;p&gt;I am attempting to read out the entry field attributes by using the attributeConfigs array of the &lt;a href=&quot;https://craftcms.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I review the EntryModel object, using id and title as an example. I request the attribute configs like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $entry-&amp;gt;attributeConfigs['id'] // Works&#xA;    $entry-&amp;gt;attributeConfigs['title'] // Undefined index error&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All though the index exists in the array &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    [_attributeConfigs:Craft\ContentModel:private] =&amp;gt; Array&#xA;    (&#xA;        [id] =&amp;gt; Array&#xA;            (&#xA;                [maxLength] =&amp;gt; 11&#xA;                [min] =&amp;gt; -2147483648&#xA;                [max] =&amp;gt; 2147483647&#xA;                [decimals] =&amp;gt; 0&#xA;                [type] =&amp;gt; number&#xA;                [unsigned] =&amp;gt; &#xA;                [length] =&amp;gt; 10&#xA;                [column] =&amp;gt; integer&#xA;            )&#xA;&#xA;        [title] =&amp;gt; Array&#xA;            (&#xA;                [required] =&amp;gt; &#xA;                [maxLength] =&amp;gt; 255&#xA;                [label] =&amp;gt; Title&#xA;                [type] =&amp;gt; string&#xA;            )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can access these configurations? &lt;/p&gt;&#xA;" OwnerUserId="4637" LastEditorUserId="57" LastEditDate="2016-05-05T16:42:26.373" LastActivityDate="2016-05-05T16:42:26.373" Title="EntryModel attributeConfigs method throwing undefined index" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14905" PostTypeId="2" ParentId="12813" CreationDate="2016-05-05T14:21:44.997" Score="1" Body="&lt;p&gt;I just had the same issue. You forgot to add the modifyElementsQuery method to your Plugin_FooElementType class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)&#xA;{&#xA;    $query-&amp;gt;join('plugin_foos plugin_foo', 'plugin_foo.id = elements.id');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="963" LastActivityDate="2016-05-05T14:21:44.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14906" PostTypeId="1" AcceptedAnswerId="14908" CreationDate="2016-05-05T15:08:57.853" Score="3" ViewCount="577" Body="&lt;p&gt;I want to link to enabled sibling entries within a structure and am struggling to get it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what my structure looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uEnG3.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I only want to fetch entries that are enabled, I followed the docs instructions and fetch previous entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = craft.entries.positionedBefore(entry).order('lft desc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this, when on the &lt;code&gt;Prince Phillip&lt;/code&gt; entry, I thought that would return &lt;code&gt;null&lt;/code&gt; for &lt;code&gt;prevEntry&lt;/code&gt;, but it is returning the &lt;code&gt;Altynia Asylmoratova&lt;/code&gt; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fetch previous and next entries that are &lt;strong&gt;direct siblings and enabled&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2016-05-05T15:44:29.740" Title="Return previous or next enabled sibling of same parent" Tags="&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14907" PostTypeId="1" CreationDate="2016-05-05T15:29:48.333" Score="2" ViewCount="382" Body="&lt;p&gt;I have a job listing channel. I want to create a form on the front-end that has all the jobs that are created in the channel inside of it. I'm using the Sprout Forms plugin, but when I create a custom plugin that creates a new field type. I get the error that this field isn't meant to be used on the front-end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this situation? Have any recommendations? Or am I going about it all wrong? &lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="57" LastEditDate="2016-05-05T16:43:48.463" LastActivityDate="2016-05-05T16:43:48.463" Title="How do I create a dynamic field on a front-end form with the Sprout Forms plugin?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14908" PostTypeId="2" ParentId="14906" CreationDate="2016-05-05T15:44:29.740" Score="7" Body="&lt;p&gt;After trying a few more things, I realised I needed the &lt;code&gt;descendantOf&lt;/code&gt; parameter to get this working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what my code looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = craft.entries.descendantOf(entry.parent).positionedBefore(entry).order('lft desc').first() %}&#xA;{% if prevEntry is null %}&#xA;  {% set prevEntry = entry.siblings.last() %}&#xA;{% endif %}&#xA;&#xA;{% set nextEntry = craft.entries.descendantOf(entry.parent).positionedAfter(entry).first() %}&#xA;{% if nextEntry is null %}&#xA;  {% set nextEntry = entry.siblings.first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This restricts the &lt;code&gt;positionedBefore&lt;/code&gt; and &lt;code&gt;positionedAfter&lt;/code&gt; parameters to only work with entries that have the same parent as the current entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is no previous or next entry, I link to the first or last sibling entry instead, creating a loop.&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2016-05-05T15:44:29.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14909" PostTypeId="2" ParentId="14907" CreationDate="2016-05-05T15:47:58.413" Score="1" Body="&lt;p&gt;Sprout Forms needs to know how a field should render on the front-end. By default it supports several common fields, but you will need to add support for custom fields on your own.  It sounds like you've got your field created and working, so you'll just need to add &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms front-end field support&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding support on the front-end is very similar to how you added support for your field in the Craft control panel. If you want to see several examples of custom fields adding front-end field support for Sprout Forms, take a look at the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields&quot; rel=&quot;nofollow&quot;&gt;Sprout Fields&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-05-05T15:47:58.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14910" PostTypeId="2" ParentId="14904" CreationDate="2016-05-05T16:41:33.113" Score="0" Body="&lt;p&gt;An entry's &lt;code&gt;title&lt;/code&gt; is stored on the &lt;a href=&quot;https://craftcms.com/classreference/models/ContentModel&quot; rel=&quot;nofollow&quot;&gt;ContentModel&lt;/a&gt;, so you'd need to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$content = $entry-&amp;gt;getContent();&#xA;$content-&amp;gt;attributeConfigs['title'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-05T16:41:33.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14912" PostTypeId="2" ParentId="14900" CreationDate="2016-05-05T19:34:09.480" Score="3" Body="&lt;p&gt;I've now worked out how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I have a copy of the entry that I want to save the file to, I can work out what the name of the dynamic folder will be called.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Generate target folder name&#xA;$targetFolderName = $entry-&amp;gt;slug; // or whatever you want&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, I see if the folder has already been created:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// See if target folder exists&#xA;// I'm searching on the name of the folder, plus the id of the parent folder&#xA;// (see question above for how to find this)&#xA;$targetFolder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'name' =&amp;gt; $targetFolderName,&#xA;    'parent' =&amp;gt; $parentFolder-&amp;gt;id&#xA;));&#xA;&#xA;if (!$targetFolder) {&#xA;    // target folder doesn't exist so we must create it&#xA;    $targetFolder = craft()-&amp;gt;assets-&amp;gt;createFolder($parentFolder-&amp;gt;id, $targetFolderName);&#xA;&#xA;    if ($targetFolder-&amp;gt;status == 'success') {&#xA;        $targetFolderId = $targetFolder-&amp;gt;getDataItem('folderId');&#xA;    } else {&#xA;        throw new Exception(Craft::t(&quot;Failed to create new folder.&quot;));&#xA;    }&#xA;&#xA;} else {&#xA;    $targetFolderId = $targetFolder-&amp;gt;id;&#xA;}&#xA;&#xA;// Now I can move the PDF from its temporary location into out new assets folder&#xA;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $localFilePath, &#xA;    $filename, &#xA;    $targetFolderId, &#xA;    AssetConflictResolution::KeepBoth&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From here I followed the same code as in the question to add the asset to the asset field in &lt;code&gt;$entry&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-05-05T19:34:09.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14913" PostTypeId="1" CreationDate="2016-05-05T19:41:30.613" Score="1" ViewCount="359" Body="&lt;p&gt;I have the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Product');&#xA;$criteria-&amp;gt;search = 'unquieId:' . $result['id'];&#xA;$criteria-&amp;gt;status = null;&#xA;$product = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The unique result returns a product if it's there and ideally empty if it's not. The odd behavior I'm seeing is if the product is marked disabled in Craft Commerce then the product is returned empty. I thought the status null may help but I don't think they equate. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="417" LastEditorUserId="4466" LastEditDate="2016-07-21T15:17:06.267" LastActivityDate="2016-07-21T15:17:06.267" Title="Commerce - Get Model via Custom Field" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14914" PostTypeId="1" CreationDate="2016-05-05T21:04:36.667" Score="1" ViewCount="1185" Body="&lt;p&gt;I am using the following form in Craft&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;parts-search&quot;&amp;gt;&#xA;&#xA;    &amp;lt;form class=&quot;parts-search-block&quot; action=&quot;{{ url('parts/results') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;&#xA;        {#-- CATEGORY SEARCH --#}&#xA;        &amp;lt;div class=&quot;col col-33&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;form-top&quot;&amp;gt;Search by Category:&amp;lt;/label&amp;gt;&amp;lt;br /&amp;gt;&#xA;            &amp;lt;select name=&quot;q&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;--Select A Category--&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Compressors&quot;&amp;gt;Compressors&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Coolers&quot;&amp;gt;Coolers&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Doors&quot;&amp;gt;Doors&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Electrical&quot;&amp;gt;Electrical&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Freezers&quot;&amp;gt;Freezers&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Gaskets&quot;&amp;gt;Gaskets&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;GFV&quot;&amp;gt;GFV&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Glass&quot;&amp;gt;Glass&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Graphics&quot;&amp;gt;Graphics&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Grills&quot;&amp;gt;Grills&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Harnesses&quot;&amp;gt;Harnesses&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Lighting&quot;&amp;gt;Lighting&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Misc&quot;&amp;gt;Misc&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Motors&quot;&amp;gt;Motors&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Plastic&quot;&amp;gt;Plastic&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Refrigeration&quot;&amp;gt;Refrigeration&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Repair Panels&quot;&amp;gt;Repair Panels&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Shelves&quot;&amp;gt;Shelves&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Skins&quot;&amp;gt;Skins&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;Vendor&quot;&amp;gt;Vendor&amp;lt;/option&amp;gt;&#xA;            &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {#-- CATEGORY SEARCH --#}&#xA;&#xA;        &amp;lt;div class=&quot;col col-34&quot;&amp;gt;&#xA;            &amp;lt;button type=&quot;submit&quot; class=&quot;cat-search&quot;&amp;gt;&#xA;                Begin Search&#xA;            &amp;lt;/button&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;clear-fix&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And calling it on the results page with...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set query = craft.request.getParam('q') %}&#xA;    {% set entries = craft.entries.section('parts').search(query).order('score') %}&#xA;&#xA;    {% for entry in entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am now using Craft Commerce and need to use the form to search my Commerce Products.  Is this possible?  Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="45" LastEditDate="2016-08-11T16:59:44.797" LastActivityDate="2016-08-11T16:59:44.797" Title="Search Form with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14915" PostTypeId="2" ParentId="14903" CreationDate="2016-05-05T21:21:08.370" Score="5" Body="&lt;p&gt;Typically, I will create a single for each product &quot;home&quot; page, and then a channel for my products or sub-pages. I will generally use a channel vs. a structure unless I know I want to manually control the order or nest entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a website about automobiles. I would create a section (single) called &lt;code&gt;cars&lt;/code&gt;. That section would have the url of &lt;code&gt;site.com/cars&lt;/code&gt; and the template would be located at &lt;code&gt;/templates/cars/index.html&lt;/code&gt;. This is the template that would be responsible for pulling in all of the cars I have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where things can get tricky, or not...all depends on how you want to roll.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you created a channel called &lt;code&gt;automobiles&lt;/code&gt; (or whatever you like), you could enter each car you have as an entry within the channel. Then on your &lt;code&gt;cars&lt;/code&gt; single, you can tell Craft to loop through all entries in the &lt;code&gt;automobiles&lt;/code&gt; channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you can't nest a channel entry, I would use categories to &quot;tag&quot; your cars. For example, I would create a category called &lt;code&gt;Sports Cars&lt;/code&gt; and relate any sports cars I have to that category. You could also create a category for &lt;code&gt;Trucks&lt;/code&gt; or &lt;code&gt;Vans&lt;/code&gt; to help group/classify each car you had.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would also allow you to create sudo-landing pages for each type of car. For example, &lt;code&gt;site.com/cars/sports-cars&lt;/code&gt; would get all entries that are tagged as a sports car. You could do this for trucks, or you could even divide categories up into &lt;code&gt;trucks/4-wheel-drive&lt;/code&gt; so not only would a truck show when I requested trucks, it would also show in my 4-wheel-drive options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From an authoring experience, this is great. I don't care specifically where I have to create the entry - all I know is that I have a car, and it goes in the cars &quot;bucket&quot; (automobiles channel). It's within that entry (the car entry itself) you are choosing where it is available to the end user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even create different entry types for the kind of automobile you are creating. This would allow you to have a cleaner screen as some fields don't apply for all automobiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate a structure, think about the staff who is in charge of this car-selling company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would create a structure called &lt;code&gt;staff&lt;/code&gt;. It would have the url of &lt;code&gt;site.com/about/staff&lt;/code&gt; and a template of &lt;code&gt;/templates/about/staff/_entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you could create an entry for each person. You can then create &quot;parent&quot; entries for the hierarchy of the office.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Management&#xA;    |-- Bob McKenzie&#xA;    |-- Doug McKenzie&#xA;- Sales Team&#xA;    |-- Tyler Durden&#xA;    |-- Agent Smith&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By using a structure here, you can not only manually set the order of which group (management or sales) is first, but you can also arrange the order of the team members within.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer your question directly:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would like to display a parent page which lists all products, but then 6 sub-pages which show only the products in that category. I use the word category without specifically meaning the Craft CMS category&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a single and give it a name of the url that you would like to show all products on. To use my example, this would be &lt;code&gt;cars&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a Category to relate your products to Ex: &lt;code&gt;Sports Cars&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a channel - called &lt;code&gt;Products&lt;/code&gt;. Every product will go here. When you are creating these product entries, use a Channel Field type so you can select which category the given product belongs to (Sports Cars).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on your &lt;code&gt;cars&lt;/code&gt; page, you would tell Craft &quot;Hey, get every single product&quot;.&#xA;If I navigate to &lt;code&gt;site.com/cars/sports-cars&lt;/code&gt; you can tell Craft &quot;Hey, only get me cars that are related to sports cars&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind of a long-winded answer, hope it helps get you going.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-05-05T21:21:08.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14916" PostTypeId="2" ParentId="14914" CreationDate="2016-05-05T23:20:00.813" Score="2" Body="&lt;p&gt;&lt;strong&gt;The Simplest Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set products = craft.commerce.products.search(query).order('score') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am not sure a search is guaranteed to return ALL the products in quite the same way as using relatedTo, which is how you'd typically get entries/products related to a category - so see below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A Slightly Fuller Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Using your form)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case I think you're just wanting to get all products &lt;em&gt;related&lt;/em&gt; to a category?  As in, you're not actually searching within those right?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so you can leave out the search parameter below, as all you're doing is finding the products related to the category.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you want to search &lt;em&gt;within&lt;/em&gt; those products for something else, &lt;em&gt;then&lt;/em&gt; you need the &lt;code&gt;search: &quot;some value&quot;&lt;/code&gt; part).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, &lt;code&gt;q&lt;/code&gt; has your category (title?) in it (would be better to use the slug in your form values really), so you can just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryTitle= craft.request.getParam('q') %}&#xA;{% set category = craft.categories.title(categoryTitle) %}  {# (or better change form values and this to .slug) #}&#xA;{% set products = craft.commerce.products({&#xA;                relatedTo: category,&#xA;                search: &quot;whatever&quot;,  &#xA;                order: &quot;title asc&quot;,&#xA;            }) %}&#xA;{% for product in products %}&#xA;    etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Obviously a more typical way of doing this is to do it off a url segment or whatever for an index page, rather than by a search)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A Considerably Fuller Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Absolutely you can search products in the same way.  Even better, since about Craft 2.5 when they added the &lt;code&gt;serachScore&lt;/code&gt; to the results, you can simultaneously search multiple element types and combine the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some sample code that will get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if query|length %}&#xA;&#xA;    {% set product_results = craft.commerce.products.search(query).order('score').limit(limit_for_each_section).with('variants') %}  &#xA;    {% set article_results = craft.entries.search(query).order('score').limit(limit_for_each_section) %}&#xA;    {% set category_results = craft.categories.search(query).order('score').limit(limit_for_each_section) %}&#xA;&#xA;    {% set all_results = [] %}&#xA;&#xA;    {% if product_results|length %}&#xA;        {% set all_results = all_results|merge(product_results) %}&#xA;    {% endif %}&#xA;    {% if article_results|length %}&#xA;        {% set all_results = all_results|merge(article_results) %}&#xA;    {% endif %}&#xA;    {% if category_results|length %}&#xA;        {% set all_results = all_results|merge(category_results) %}&#xA;    {% endif %}&#xA;&#xA;    {% if all_results|length %}&#xA;&#xA;        &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;        {% set all_results = all_results|sortByField('searchScore', 'desc') %}&#xA;&#xA;        {% set items = [] %}&#xA;&#xA;            {% for result in all_results %}&#xA;&#xA;            {% if result.url|length %}&#xA;&#xA;                {% if result.elementType == 'Commerce_Product' %}&#xA;&#xA;                     ... etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-05-12T23:18:53.550" LastActivityDate="2016-05-12T23:18:53.550" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14917" PostTypeId="1" AcceptedAnswerId="14918" CreationDate="2016-05-05T23:39:21.977" Score="2" ViewCount="955" Body="&lt;p&gt;Trying to sort products by price. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the price of a product in Commerce isn't a textual custom field it's attached to a variant, I'm having trouble working out the syntax to make this happen.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;     relatedTo: (category), &#xA;     order: defaultPrice,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems close but delivers &quot;Variable &quot;defaultPrice&quot; does not exist&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate any direction.&lt;/p&gt;&#xA;" OwnerUserId="749" LastEditorUserId="57" LastEditDate="2016-05-06T00:28:03.290" LastActivityDate="2016-05-06T00:28:03.290" Title="Craft Commerce: Sort Products By Price" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;ecommerce&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14918" PostTypeId="2" ParentId="14917" CreationDate="2016-05-06T00:27:45.087" Score="5" Body="&lt;p&gt;Close!  This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;    relatedTo: (category), &#xA;    order: 'defaultPrice',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the quotes it's a string.  Without the quotes, Twig is expecting a variable you've defined called &lt;code&gt;defaultPrice&lt;/code&gt; that doesn't exist.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-06T00:27:45.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14919" PostTypeId="1" CreationDate="2016-05-06T09:46:19.437" Score="2" ViewCount="96" Body="&lt;p&gt;I've been trying to get this working but can't seem to find a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two different types of Categories in a commerce project.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Level One&lt;/li&gt;&#xA;&lt;li&gt;Level Two&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Examples&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Level One would be Mens, Ladies, Kids etc&lt;/li&gt;&#xA;&lt;li&gt;Level Two would be T-Shirts, Jumpers, Shoes etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I click on 'Mens' on the navigation, it brings me to the Mens page, I then get a sub navigation on that page which shows me any Level Two categories that are related to the Level One category (Mens).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are related by using the categories field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is got easily by the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for subCat in craft.categories.group('levelTwo').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem that I encounter now, is when you click on one of the Level Two categories on that sub nav (T-Shirts for example), it brings me to the t-shirt category page.  I want to be able to display the same sub nav that is on Level One (Mens), on the Level Two (T-shirts) page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for subCat in craft.categories.group('levelTwo') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above snippet shows me all the categories in Level Two, which is wrong.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to show all the categories in Level Two, that have have the same categories field type.  The handle of this categories field type is topLevelConnection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be greatly appreciated! &lt;/p&gt;&#xA;" OwnerUserId="4783" LastEditorUserId="4783" LastEditDate="2016-05-11T13:11:37.820" LastActivityDate="2016-05-11T13:11:37.820" Title="Relating a Category Entry to a Categories Field Type" Tags="&lt;categories&gt;&lt;relations&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14920" PostTypeId="2" ParentId="14919" CreationDate="2016-05-06T10:18:05.653" Score="3" Body="&lt;p&gt;Turns out I was overthinking it, I was able to connect it with the following piece of code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set levelOne = category.topLevelConnection %}&#xA;{% for subCat in craft.categories.group('levelTwo').relatedTo(levelOne) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2016-05-06T10:18:05.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14921" PostTypeId="1" CreationDate="2016-05-06T10:54:19.850" Score="4" ViewCount="283" Body="&lt;p&gt;In a previous CMS we used (Processwire), one of the authors created a very useful plugin that would warn a user on an edit page that the page was currently being edited by another user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking this would be a useful addition, unless Craft's use of automatic versioning would somewhat rule out the risk of overwriting someone else's work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone had any similar thoughts on the issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5093" LastEditorUserId="57" LastEditDate="2016-05-06T16:39:41.113" LastActivityDate="2016-09-16T06:03:03.283" Title="Would it be possible to create a plugin to warn a user if a page is being edited" Tags="&lt;plugin-development&gt;&lt;admin&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14922" PostTypeId="1" CreationDate="2016-05-06T11:17:53.130" Score="2" ViewCount="862" Body="&lt;p&gt;This seems like it should be possible but I may be missing a trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use a single field multiple times in a section? So, for example, if you have a simple 'text' field and you want to include that twice in one section. The field layout designer only allows you to drag it once and then just move it to different tabs but not create another &lt;em&gt;instance&lt;/em&gt; of it.&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2016-05-06T13:45:53.853" Title="Possible to re-use one field multiple times in a section?" Tags="&lt;dry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14923" PostTypeId="1" AcceptedAnswerId="14925" CreationDate="2016-05-06T11:44:50.573" Score="2" ViewCount="226" Body="&lt;p&gt;This is a very loosely associated question but looking at the plugin page for Pimp My Matrix, they depict icons for Crop Position, and Crop Aspect Ratio:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ARyZV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ARyZV.jpg&quot; alt=&quot;Crop position &amp;amp; aspect ratio icons&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these custom fields from somewhere or is it possible somehow to add your own icons for something which looks to be essentially a radio button or select type of field?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2016-05-06T12:04:35.420" Title="Crop &amp; Aspect Ratio Icons" Tags="&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14924" PostTypeId="1" CreationDate="2016-05-06T11:53:04.080" Score="1" ViewCount="78" Body="&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/relabel&quot; rel=&quot;nofollow&quot;&gt;Relabel&lt;/a&gt; certainly seems quite useful in being able to apply a more generic use to fields. The more I use it the more I see a use case for just creating a generic field with the same name as it's fieldtype which can be re-labeled and re-used in specific instances. &lt;strong&gt;Is anyone doing something similar and are there any potential issues to that approach?&lt;/strong&gt; It seems to make things much more modular and re-usable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for instance you could create an instance of fields such as Plaintext called Plaintext, Richtext called Richtext, etc. Then just relabel them and provide specific instructions in an on-the-fly basis when required. That would help to cut down on the number of fields in use.&lt;/p&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="57" LastEditDate="2016-05-06T16:49:21.773" LastActivityDate="2016-05-07T13:29:50.983" Title="Logistics of loose field naming and re-use with Relabel" Tags="&lt;dry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14925" PostTypeId="2" ParentId="14923" CreationDate="2016-05-06T12:04:35.420" Score="2" Body="&lt;p&gt;This looks like the &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/button-box&quot; rel=&quot;nofollow&quot;&gt;Button Box&lt;/a&gt; plugin, also from the team who developed Pimp My Matrix.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-05-06T12:04:35.420" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14926" PostTypeId="1" AcceptedAnswerId="14930" CreationDate="2016-05-06T12:21:57.333" Score="2" ViewCount="1595" Body="&lt;p&gt;I tried cloning &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&lt;/a&gt; to my plugins folder of my local Craft project and opened the plugins module from admin settings but the formbuilder2 plugin did not show in the list. Can you please help me if somebody has used this plugin for their Craft CMS project? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5106" LastEditorUserId="22" LastEditDate="2017-05-09T22:00:45.703" LastActivityDate="2017-05-09T22:00:45.703" Title="How do I install the FormBuilder 2 plugin in my local Craft project?" Tags="&lt;plugins&gt;&lt;plugin-formbuilder2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14927" PostTypeId="1" AcceptedAnswerId="14935" CreationDate="2016-05-06T12:55:51.687" Score="1" ViewCount="374" Body="&lt;p&gt;I'm writing plugin to extend Craft Commerce and I want to present a good way to select products in CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could use dropdown select for this, but using Craft's elementSelect would make the UI much nicer. Is there a way to use elementSelect dialog / fieldtype not just for entries or assets, but for custom data set (in my case, Commerce Products)?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-05-06T16:13:02.840" Title="Using elementSelect for third-party elements" Tags="&lt;fieldtypes&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14928" PostTypeId="1" CreationDate="2016-05-06T13:29:28.017" Score="1" ViewCount="66" Body="&lt;p&gt;So I've wasted a day because I couldn't figure out how to get an error back from an action I'm using in a plugin...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newUserSuccess = craft()-&amp;gt;users-&amp;gt;saveUser($newUser);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$newUserSuccess&lt;/code&gt; was empty, and it turns out the reason was because the new user was trying to register with an existing user's email address, which fails. I could not figure out how to get any useful information back. I had tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$newUserSuccess)&#xA;{&#xA;    AutoUserEntryPlugin::log('Couldn't save the new user: '.print_r($newUser-&amp;gt;getErrors(), true), LogLevel::Info);&#xA;    throw new Exception(Craft::t('Couldnt save the user.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but in the log all that was output was &quot;Couldn’t save the new user: Array&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I be doing this?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2016-05-06T16:56:38.187" LastActivityDate="2016-05-06T16:56:38.187" Title="Getting errors while developing plugins" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14929" PostTypeId="2" ParentId="14922" CreationDate="2016-05-06T13:45:53.853" Score="4" Body="&lt;p&gt;You can re-use the same text field multiple times in a section on different Entry Types, but if you would like to re-use the same text field multiple times on the same Entry Type (or page) your best bet would be to make it a Matrix Block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a quick overview on Matrix Blocks: &lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/features/matrix&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on Matrix Blocks: &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/matrix-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2016-05-06T13:45:53.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14930" PostTypeId="2" ParentId="14926" CreationDate="2016-05-06T13:49:48.517" Score="3" Body="&lt;p&gt;I rolled old-school and just downloaded the zip file to my local machine.&#xA;When I did that &amp;amp; unzipped the directory the folder is called &lt;code&gt;FormBuilder-2-Craft-CMS-master&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will want to rename that to &lt;code&gt;formbuilder2&lt;/code&gt;, copy/paste that folder to &lt;code&gt;/craft/plugins/&lt;/code&gt; and then it should show up in your list of plugins when you navigate to &lt;code&gt;settings-&amp;gt;plugins&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-05-06T17:37:25.517" LastActivityDate="2016-05-06T17:37:25.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14931" PostTypeId="1" CreationDate="2016-05-06T14:41:55.280" Score="0" ViewCount="885" Body="&lt;p&gt;I have set 755 permissions to these folders and they are owned by the PHP web user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm still getting logs that say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [application] Could not delete the file /var/www/craft/storage/runtime/assets/sources/76.jpg because the file does not exist.&#xA;&#xA;&#xA;&#xA;Tried to read the folder contents of /var/www/craft/storage/runtime/temp/, but could not.&#xA;&#xA;Tried to read the folder contents of /var/www/craft/storage/runtime/cache/, but could not.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;76.jpg does exist. And I don't know why it can't read those folders. Any ideas how to fix this??&lt;/p&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2016-05-06T14:41:55.280" Title="Folder Permissions for Assets, Cache, and temp" Tags="&lt;cache&gt;&lt;error-message&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="14932" PostTypeId="1" AcceptedAnswerId="14951" CreationDate="2016-05-06T14:53:14.490" Score="0" ViewCount="84" Body="&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('artistLocation') %}&#xA;&#xA;    {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;&#xA;    {% if entryCount %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }} ({{ entryCount }})&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason, this is only returning the first six categories with entries associated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/a2ut7j48acnq1g0/Screenshot%202016-05-06%2010.49.34.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/a2ut7j48acnq1g0/Screenshot%202016-05-06%2010.49.34.png?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing in the error logs that are shedding any light on it for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas would be awesome!&lt;/p&gt;&#xA;" OwnerUserId="5043" LastEditorUserId="57" LastEditDate="2016-05-06T17:00:19.700" LastActivityDate="2016-05-07T09:24:24.623" Title="Category list not returning all related entries" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14933" PostTypeId="1" AcceptedAnswerId="14969" CreationDate="2016-05-06T15:31:59.450" Score="1" ViewCount="301" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/boboldehampsink/pushnotifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Push Notification&lt;/a&gt; plugin will send out alerts ONLY if devMode is set to true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't leave my production environment in development mode so I'm trying to figure out why the alerts won't send when devMode is set to false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the &lt;code&gt;PushNotifications_PushService.php&lt;/code&gt; page and the logs will print out that Notified is 1 (which would be correct for my test). However, the alert never sends out. My phone never receives the alert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only assumption is that it deals with the APNSAdapter but that is coming from Sly/NotificationPusher. I've never worked with this class before so I'm not sure exactly how it works. Does anyone have any ideas what is going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pretty sure the problem deals with the NotificationPusher class that the developer is importing. However, I'm not sure what is wrong with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this: &lt;a href=&quot;https://stackoverflow.com/questions/27611388/phonegap-pushplugin-with-notificationpusher-not-working-in-production&quot;&gt;https://stackoverflow.com/questions/27611388/phonegap-pushplugin-with-notificationpusher-not-working-in-production&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an issue also posted on the NotificationPusher GitHub:&#xA;&lt;a href=&quot;https://github.com/Ph3nol/NotificationPusher/issues/111&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Ph3nol/NotificationPusher/issues/111&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tested via command line using the following command:&#xA;./np push --certificate=/path/to/production_ck.pem apns deviceToken &quot;Notification test&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This worked. No errors. Phone received alert. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not sure why it won't receive them from Plugin in Production Mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have placed log statements into the NotificationPusher class. I found no errors when comparing it to the &quot;Dev&quot; process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed when debugging the NotificationPusher project that it utilizes zendframework APNS to send the messages. My assumption is that the error must be somewhere within this project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this: &lt;a href=&quot;http://framework.zend.com/manual/1.12/en/zend.mobile.push.apns.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://framework.zend.com/manual/1.12/en/zend.mobile.push.apns.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first comment, he isn't getting any errors either but the alert is never getting to the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the NotificationPusher project, I was able to determine that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is getting the device token and the message data &lt;/li&gt;&#xA;&lt;li&gt;The response data is the same for both development mode and production mode. (However, the iPhone device never receives the alert message in production mode.) Still no error from code&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Has anyone worked with the Zendframework? Any ideas what is going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 4:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference I have found so far is that the development mode uses the sandbox URL whereas the production mode uses the production mode. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What doesn't make sense is that I'm using my production certificate and it works on the sandbox URL but it doesn't work on the production URL.&lt;/p&gt;&#xA;" OwnerUserId="4072" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-05-09T19:13:46.277" Title="Push Notification plugin will not send iOS alerts when Craft CMS devMode is set to false" Tags="&lt;devmode&gt;&lt;plugin-pushnotifications&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14934" PostTypeId="1" AcceptedAnswerId="14942" CreationDate="2016-05-06T15:35:57.973" Score="2" ViewCount="1586" Body="&lt;p&gt;I have a project which I'm working on which is going to need something similar to the following URL Structure :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;site.com/dfe45c4f/news_title&lt;/code&gt;, &lt;code&gt;site.com/gyb66dx/news_title&lt;/code&gt; or &lt;code&gt;site.com/76vvg3s/news_title&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The First URI Segment is the 'Partner Reference' - a hash value for every partner we work with, the second is a simple entry url title. Every page will show the same data, but each page will be 'branded' differently based on the Partner Reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need to do is to query a Craft channel a set a variety of variables (styling/logo/branding etc) for the page based on the partner reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I set routing to look up the first Segment URI to look at the partner section and return all the field information as variables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5031" LastEditorUserId="45" LastEditDate="2016-08-13T02:39:56.513" LastActivityDate="2021-04-15T20:07:45.540" Title="Craft Routing / Variables with Differing URI" Tags="&lt;routing&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14935" PostTypeId="2" ParentId="14927" CreationDate="2016-05-06T16:13:02.840" Score="1" Body="&lt;p&gt;If you are referring to a custom field to select products, one already exists:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wGU7J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wGU7J.png&quot; alt=&quot;screenshot of product field type&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are building a general attribute field for a plugin, taking a look at the B &lt;code&gt;BaseElementFieldType.php&lt;/code&gt; within the craft/app filder (that the product field above extends) will give you clues on how to recreate the UI to select products (or any other element).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key file being &lt;code&gt;craft/app/templates/_includes/forms/elementSelect.html&lt;/code&gt; which will show you how to instantiate the &lt;code&gt;Craft.BaseElementSelectInput&lt;/code&gt; js class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that points you in the right direction. I am not sure if there is a full guide out there on how to use&lt;code&gt;Craft.BaseElementSelectInput&lt;/code&gt; js, but hopefully the above will get you most of the way there by looking at the code.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-05-06T16:13:02.840" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14937" PostTypeId="2" ParentId="14921" CreationDate="2016-05-06T16:47:48.963" Score="2" Body="&lt;p&gt;I can't think of an easy way for a plugin to currently do this, but you should consider voting for these feature requests that would enable this scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9009169-add-an-alert-or-warning-when-multiple-authors-are&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9009169-add-an-alert-or-warning-when-multiple-authors-are&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10689150-entry-onopen-hook&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10689150-entry-onopen-hook&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-06T16:47:48.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14938" PostTypeId="2" ParentId="14928" CreationDate="2016-05-06T16:56:16.043" Score="2" Body="&lt;p&gt;You're getting &lt;code&gt;&quot;Couldn’t save the new user: Array&quot;&lt;/code&gt; because &lt;code&gt;$newUser-&amp;gt;getErrors()&lt;/code&gt; returns an array of validation errors (in case there are more than one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to print them all to a log file, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AutoUserEntryPlugin::log('Couldn't save the new user: '.implode(', ', $newUser-&amp;gt;getErrors()), LogLevel::Info);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-06T16:56:16.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14939" PostTypeId="1" CreationDate="2016-05-06T19:29:50.833" Score="0" ViewCount="52" Body="&lt;p&gt;When I go to live preview to view my blog entry in draft mode, all I see is a white screen. My co-workers have tested under my account on their computers and it works just fine. Does anyone have any kind of insights for this?&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2016-05-06T22:39:10.047" Title="My live preview for blog entries is not working on my computer, but is working for my account on other computers" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14940" PostTypeId="2" ParentId="14934" CreationDate="2016-05-06T20:21:39.030" Score="1" Body="&lt;p&gt;I can't see a solid way of setting up routing to handle all of the possible use cases for your URL structure as it is now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set up a dynamic route to look for URI's that are of the form &lt;code&gt;slug/slug&lt;/code&gt; and then route them to a custom template where you can then deal with the logic. But this route is very ambiguous and could easily catch false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion a better way would be to use an extra URI segment in your dynamic route, for example &lt;code&gt;partner/slug/slug&lt;/code&gt; or &lt;code&gt;p/slug/slug&lt;/code&gt; for brevity. Then you can be sure that this will load the custom template only in the correct use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;code&gt;slug&lt;/code&gt; in the dynamic route above does not necessarily represent a slug, but any string of characters, except for a forward slash. So you can then do whatever you need to in your custom template.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2016-05-06T20:21:39.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14941" PostTypeId="1" CreationDate="2016-05-06T20:22:08.110" Score="1" ViewCount="77" Body="&lt;p&gt;Is there any way to stop this? It would be nice to stop this (for my purposes) and then tell the template to fallback to content from a certain locale if the current locale does not have content for a given field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, I'm searching for the best way to have fields track the changes of a &quot;default&quot; locale. Currently in Craft content is only tracked on the first save of an entry after adding the locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5109" LastActivityDate="2016-05-06T20:22:08.110" Title="How can I disable automatic copy to new localized fields on first save of an entry?" Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14942" PostTypeId="2" ParentId="14934" CreationDate="2016-05-06T20:25:06.820" Score="3" Body="&lt;p&gt;Go to Settings → Routes, and create a route like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1SjXt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1SjXt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create that &lt;code&gt;partners/_partner_news_entry.html&lt;/code&gt; template. (You can change the location/name of the template if you want; just make sure it matches the “Load this template” setting within your route.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that template, you can get the Partner Reference and the entry slug like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set partnerRef = matches[1] %}&#xA;{% set entrySlug = matches[2] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m not sure how you have it set up, but assuming you have a “Partners” channel with a “Partner Reference” custom field, which stores all of the styling/logo/branding info you need, you can get those relevant entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set partnerEntry = craft.entries({&#xA;    section: 'partners',&#xA;    partnerReference: partnerRef&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure it’s a valid Partner Reference like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not partnerEntry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do the same stuff for the News entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsEntry = craft.entries({&#xA;    section: 'news',&#xA;    slug: entrySlug&#xA;}).first() %}&#xA;&#xA;{% if not newsEntry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there’s an Entries field that actually ties the News entries to a specific partner and you want to ensure that you’re not viewing a News entry that should have only been associated with someone else, you can tweak that like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsEntry = craft.entries({&#xA;    section: 'news',&#xA;    slug: entrySlug,&#xA;    relatedTo: {targetElement: partnerEntry},&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-05-06T20:25:06.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14943" PostTypeId="2" ParentId="14939" CreationDate="2016-05-06T22:39:10.047" Score="2" Body="&lt;p&gt;Are you all using the same browser / operating system? Try testing in a recent release of Chrome, Safari, or Internet Explorer. &lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-05-06T22:39:10.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14944" PostTypeId="1" AcceptedAnswerId="14985" CreationDate="2016-05-06T23:25:53.663" Score="1" ViewCount="887" Body="&lt;p&gt;I am very new to this CMS and I was able to set it up, import some content from csv files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up templates and right now if someone clicks on the article, the URL is www.example.com/articles/{slug} of the article. This is all fine if I wasn't migrating from another system and we have a ton of articles and the URL was based on SEO requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up a channel type and one of the fields is Category type. I have 2 more category type fields but I don't use them to create the URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the screenshot of what it looks like&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PGV86.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PGV86.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;A lot of content from olden days doesn't have the second category (so would just belong to Analog/ Mixed Signal ICs) but the newer content (from last 3 odd years most likely has it). So when the Url is display I want the URL to be either www.example.com/Analog_Mixed_Signal_ICs/Title&#xA;or &#xA;www.example.com/Analog_Mixed_Signal_ICs/Amplifiers/Title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if this simple or complex but I would appreciate if someone can tell me how to achieve this. &lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-05-11T00:26:28.550" Title="Custom URL based on Categories" Tags="&lt;routing&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14945" PostTypeId="1" AcceptedAnswerId="14946" CreationDate="2016-05-06T23:41:21.277" Score="3" ViewCount="97" Body="&lt;p&gt;I want all buyers of a specific product to automatically be added to a specific user group.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-06T23:41:21.277" Title="Commerce - How do I add the purchaser of a specific product to a user group?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14946" PostTypeId="2" ParentId="14945" CreationDate="2016-05-06T23:41:21.277" Score="2" Body="&lt;p&gt;Create a business logic plugin if you haven't already.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two good ways of doing that are : &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;Business Logic Plugin&lt;/a&gt; or via &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;http://pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in your plugin's main file in the &lt;code&gt;init&lt;/code&gt; method, register a listener method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{      &#xA;    craft()-&amp;gt;on('commerce_variants.onOrderVariant', &#xA;        [&#xA;            craft()-&amp;gt;businessLogic_logic,&#xA;            &quot;onOrderVariantHandler&quot;&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, implement the method (I do this in my class BusinessLogic_Logic Service):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onOrderVariantHandler($event){&#xA;&#xA;    $variant = $event-&amp;gt;params['variant'];&#xA;    if ($variant-&amp;gt;product-&amp;gt;id == &quot;4194&quot; ){&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, [3]);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously make sure you use the right &lt;code&gt;id&lt;/code&gt;s for your particular products &amp;amp; groups!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note you can also just implement the method directly in &lt;code&gt;init()&lt;/code&gt; if you want to keep things very simple - but the above method makes for a cleaner main plugin file and once you start doing a lot of this sort of thing (which is where a lot of the real power of Commerce lies I think) - separating the logic into a service and just registering the handlers is a more ordered way to go I think.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_variants.onOrderVariant', function($event){&#xA;    $variant = $event-&amp;gt;params['variant'];&#xA;    if ($variant-&amp;gt;product-&amp;gt;id == &quot;4194&quot; ){&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, [3]);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-06T23:41:21.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14947" PostTypeId="1" AcceptedAnswerId="14948" CreationDate="2016-05-07T01:48:36.473" Score="3" ViewCount="422" Body="&lt;p&gt;In the examples they're used mixed: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;Registration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;{%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;Login&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;input id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot;&#xA;    value=&quot;{{ craft.session.rememberedUsername }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the login form, a field named &quot;username&quot; can not be used, it should be &quot;loginName&quot;. What is the difference between the two?&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2016-05-07T01:58:39.380" Title="The difference between username and loginName" Tags="&lt;login&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14948" PostTypeId="2" ParentId="14947" CreationDate="2016-05-07T01:58:39.380" Score="2" Body="&lt;p&gt;Because you can login with either your email address or your username.  And some sites will be &lt;a href=&quot;https://craftcms.com/docs/config-settings#useEmailAsUsername&quot; rel=&quot;nofollow&quot;&gt;forcing&lt;/a&gt; the username to be the email address.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-07T01:58:39.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14949" PostTypeId="1" AcceptedAnswerId="14950" CreationDate="2016-05-07T02:41:02.567" Score="5" ViewCount="178" Body="&lt;p&gt;I am new to craftcms and did a look through on the documentation just recently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am at the part where it explain about the Categories Field and found out that we can loop through the ElementCriteriaModel with the 'nav' keyword instead of 'for'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked the twig documentation but there are no 'nav' keyword :|&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So which one should I use?&lt;/p&gt;&#xA;" OwnerUserId="5111" LastEditorUserId="45" LastEditDate="2016-05-07T05:11:23.777" LastActivityDate="2016-05-07T05:11:23.777" Title="What is the difference between 'nav' and 'for' for looping?" Tags="&lt;categories&gt;&lt;navigation&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14950" PostTypeId="2" ParentId="14949" CreationDate="2016-05-07T05:10:41.087" Score="7" Body="&lt;p&gt;&lt;code&gt;for&lt;/code&gt; is &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot;&gt;part of the native Twig language&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;for&lt;/code&gt; is for general usage... It's the basic, general looping structure that you'll use 99% of the time. You'll find that it closely mirrors &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;foreach&lt;/code&gt; in other programming languages.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;nav&lt;/code&gt; is &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot;&gt;defined by Craft&lt;/a&gt;, and doesn't exist natively in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;nav&lt;/code&gt; is special... You'll only need it to loop through entries in a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot;&gt;Structure section&lt;/a&gt;, or categories in a &lt;a href=&quot;https://craftcms.com/docs/categories&quot;&gt;Category Group&lt;/a&gt;. &lt;strong&gt;The sole purpose of &lt;code&gt;nav&lt;/code&gt; is to make it easier to create a menu or navigation.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the biggest benefits to using the &lt;code&gt;nav&lt;/code&gt; tag is that you'll then be able to use &lt;code&gt;ifchildren&lt;/code&gt; within it...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% ifchildren %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% children %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endifchildren %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The logical relationship between &lt;code&gt;nav&lt;/code&gt; and its respective &lt;code&gt;children&lt;/code&gt; is slightly complicated... and worthy of a separate post if you need further clarification. :)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-07T05:10:41.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14951" PostTypeId="2" ParentId="14932" CreationDate="2016-05-07T09:24:24.623" Score="2" Body="&lt;p&gt;How many categories do you have in that locations group? A criteria model returns the first 100 elements only by default, so any category falling behind that wouldn't be listed, no matter if there's related entries or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &lt;code&gt;limit(null)&lt;/code&gt; to your &lt;code&gt;craft.categories&lt;/code&gt; criteria model to make it return all categories.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-07T09:24:24.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14952" PostTypeId="2" ParentId="14924" CreationDate="2016-05-07T13:24:19.170" Score="1" Body="&lt;p&gt;Relabel is a great plugin and the option to re-use fields without sacrificing semantics for the content editor can be very useful, especially if you (potentially) face creating &lt;em&gt;a lot&lt;/em&gt; of similar fields (hundreds) in order to provide specific labels and instructions. I'm not aware of any technical or performance related issues with the plugin, but here's a couple of things worth considering before going all in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your content model will be less flexible. For instance, if you use the same Rich Text field everywhere, you're not going to be able to have different settings for different types of content (perhaps entry type X needs a different Redactor config than entry type Y, or you need to disable/enable HTML purification for a specific piece of content – there's no way to make that happen if you use the same field for everything). This is especially troublesome if you only figure out you need different settings for different types of content &lt;em&gt;late in development&lt;/em&gt; (or even after initial development has concluded), i.e. after adding a ton of content to the site. Of course, this applies to Craft even if you're not using Relabel, but personally I always lean towards creating two fields if there's even a slight chance I'm going to need different settings for different things.&lt;/li&gt;&#xA;&lt;li&gt;Your templates will be less semantic. Even if you add the labels &quot;Hero text&quot;, &quot;Body&quot; and &quot;Description&quot; to a Rich Text field with the handle &lt;code&gt;richText&lt;/code&gt; across your content in the CP, you'll still have to call &lt;code&gt;{{ entry.richText }}&lt;/code&gt; everywhere in your templates. Losing the semantics and clarity of &lt;code&gt;entry.heroText&lt;/code&gt;, &lt;code&gt;entry.body&lt;/code&gt; and &lt;code&gt;entry.description&lt;/code&gt; could make your code more confusing and harder to debug and/or read in the long run.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-05-07T13:29:50.983" LastActivityDate="2016-05-07T13:29:50.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14953" PostTypeId="2" ParentId="14921" CreationDate="2016-05-07T13:55:26.440" Score="3" Body="&lt;p&gt;It's definitely a feature Craft is missing, and I've had requests from several clients who are frustrated about it (not super frustrated, fortunately, because everything else in Craft is so much better than whatever else they were using before) :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implemented as a plugin, in my opinion there are two primary problems to solve – the first is how to &quot;store&quot; the &quot;being edited&quot; state for an entry being edited (and obviously, clearing that state once the entry is no longer being edited), and the second is how to communicate that state to any other users attempting to edit the same entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first problem could easily be solved by using AJAX in order to save the entry ID to a custom database row, keeping track of entries being edited. The real problem is how to ascertain that an entry is being edited, or even that a user is in fact interacting with an entry editing form (an issue &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/10689150-entry-onopen-hook&quot; rel=&quot;nofollow&quot;&gt;the second feature request Brad links to&lt;/a&gt; in his answer deals with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem could probably be solved by either using basic AJAX polling, where a script checks with the server on pageload, and then every X seconds, if the &quot;being edited&quot; state of the current entry has changed; displaying the appropriate message to the user once it does (Craft uses this approach for login timeouts). Websockets would of course be an even better approach, but is a bit more troublesome to set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've actually done some work on a plugin just like this myself (unfortunately, its nowhere close to being finished yet, and might never be!), which uses &lt;a href=&quot;https://pusher.com/&quot; rel=&quot;nofollow&quot;&gt;Pusher&lt;/a&gt; (essentially websockets as a service) for problem #2. For problem #1, I've previously &quot;solved&quot; this in other plugins like &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow&quot;&gt;Reasons&lt;/a&gt; by using jQuery to parse the Control Panel HTML, looking for the appropriate form input fields (for instance, the entry editing form would have a hidden &lt;code&gt;action&lt;/code&gt; input with the value &lt;code&gt;entries/saveEntry&lt;/code&gt;, as well as an input named &lt;code&gt;entryId&lt;/code&gt;), in order to identify the current page as an entry editing form. Basically, hacks that could break at any time, e.g. if P&amp;amp;T redesigns the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond this, there are a plethora of other issues to solve. For instance, entries in Craft can be edited in several different ways, so the plugin probably needs to handle element editor modals and Live Preview as well. Also, making sure that an entry is &quot;unlocked&quot; is not as easy as it sounds – a JavaScript &quot;unload&quot; handler would probably work in most cases, but is fickle, in my experience, so there would probably need to be some sort of timestamping feature built in as well, and probably a task to clean up old/stale &quot;being edited&quot; rows from the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the potential complexity of the feature, I really hope P&amp;amp;T builds it into core some day. If not, I'm sure a plugin will pop up sooner or later (mine or someone else's).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-05-07T14:00:43.503" LastActivityDate="2016-05-07T14:00:43.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14954" PostTypeId="1" AcceptedAnswerId="14955" CreationDate="2016-05-07T21:05:48.590" Score="1" ViewCount="130" Body="&lt;p&gt;Like I am stating in the title, I am using the free Craft Personal edition which is perfect for my portfolio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already (and obviously) have an account and only one.&#xA;So I cannot have access to &lt;code&gt;craft.users&lt;/code&gt; but this account already have my Full Name and Email written in it and I want to use those in my website without having to redo them as Globals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible in Craft Personal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I will be able to use &lt;code&gt;{{ account }}&lt;/code&gt; but it is only accessible in the Registration Form as I can see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time.&lt;/p&gt;&#xA;" OwnerUserId="5112" LastEditorUserId="57" LastEditDate="2016-05-08T00:23:40.603" LastActivityDate="2016-05-08T00:23:40.603" Title="Get user data in Craft CMS Personal edition" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14955" PostTypeId="2" ParentId="14954" CreationDate="2016-05-08T00:22:31.773" Score="1" Body="&lt;p&gt;Should be possible with a simple plugin that registers its own Twig extension.  Head over to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and check the &quot;Twig Extensions&quot; option to have it generate the boilerplate code for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;100% untested, but in your &lt;code&gt;PluginNameTwigExtension.php&lt;/code&gt; file, add a &lt;code&gt;getGlobals()&lt;/code&gt; method that does something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getGlobals()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $criteria-&amp;gt;admin = true;&#xA;    $user = $criteria-&amp;gt;first();&#xA;&#xA;    return array('adminAccount' =&amp;gt; $user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then every template should have a global &lt;code&gt;adminAccount&lt;/code&gt; variable available to it that's a &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; object, so you can do things like &lt;code&gt;{{ adminAccount.firstName }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-08T00:22:31.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14956" PostTypeId="1" AcceptedAnswerId="14957" CreationDate="2016-05-08T06:39:01.643" Score="3" ViewCount="328" Body="&lt;p&gt;Can you change the name of the Craft folder? I run several sites on a VPS and to place the Craft folder above the webroot, means that it sits in the User Directory, which has multiple domains running and potentially more domains could run Craft CMS and therefor the Craft folder(s) would conflict if they are all placed in the User Directory.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="57" LastEditDate="2016-05-08T16:47:05.097" LastActivityDate="2016-05-08T16:47:05.097" Title="Changing the name of the Craft folder when placed above the webroot?" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14957" PostTypeId="2" ParentId="14956" CreationDate="2016-05-08T07:10:51.133" Score="4" Body="&lt;p&gt;Yes, you can change the name of the &lt;code&gt;craft&lt;/code&gt; folder. In the &lt;code&gt;index.php&lt;/code&gt; file in the &lt;code&gt;public&lt;/code&gt; folder update the path for the &lt;code&gt;craft&lt;/code&gt; folder in the &lt;code&gt;$craftPath&lt;/code&gt; variable. I use the following naming scheme for my sites: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../craft-domainname';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my server directory looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/(server-root)&#xA;  --craft-domain1&#xA;  --craft-domain2&#xA;  --craft-domain3&#xA;  --public_html&#xA;    --domain1&#xA;    --domain2&#xA;    --domain3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I keep the name &lt;code&gt;craft&lt;/code&gt; in my folder structure but you don’t need to. I just do so it groups all the Craft installations together.&lt;/p&gt;&#xA;" OwnerUserId="3951" LastEditorUserId="3951" LastEditDate="2016-05-08T11:29:04.910" LastActivityDate="2016-05-08T11:29:04.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14958" PostTypeId="1" AcceptedAnswerId="14959" CreationDate="2016-05-09T00:04:12.187" Score="3" ViewCount="462" Body="&lt;p&gt;How/Where/Can I add more address model validations than just &quot;firstName&quot; and &quot;lastName&quot;...?&lt;/p&gt;&#xA;" OwnerUserId="749" LastEditorUserId="45" LastEditDate="2016-08-13T02:28:20.893" LastActivityDate="2016-08-13T02:28:20.893" Title="Craft Commerce: Custom address model validations" Tags="&lt;validation&gt;&lt;models&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14959" PostTypeId="2" ParentId="14958" CreationDate="2016-05-09T00:12:36.057" Score="4" Body="&lt;p&gt;You can do either or both of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use javascript validation on the front end (with e.g. &lt;a href=&quot;http://parsleyjs.org/&quot;&gt;parsley&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a plugin with a method that is registered as a listener on this event:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_addresses.onbeforesaveaddress&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_addresses.onbeforesaveaddress&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;...and perform validation on the address model before it is saved.  use &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt; to stop the address actually being saved if need be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General notes on how to listen to events and get at parameters is &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely, the best way will be to use a bit of both front end and back end validation here to make sure you're getting the data you want in the format you want in to your address fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you don't yet have a business logic plugin for your Commerce setup, then create one using either of two excellent options:&#xA;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot;&gt;Business Logic Plugin&lt;/a&gt; or via &lt;a href=&quot;http://pluginfactory.io&quot;&gt;http://pluginfactory.io&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-09T00:12:36.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14960" PostTypeId="1" AcceptedAnswerId="14964" CreationDate="2016-05-09T08:07:03.870" Score="3" ViewCount="465" Body="&lt;p&gt;We're building a content platform for a bank for a client of us. One required feature lets relationship managers add clients (members) to the platform which get assigned a specific group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We listen to the &lt;code&gt;users.onSaveUser&lt;/code&gt; event and when the specific group is chosen and the user gets added via the CP there should be sent out a specific email to that client. This is the code I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function initRmAddsClient()&#xA;{&#xA;    craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        if ($event-&amp;gt;params['isNewUser'])&#xA;        {&#xA;            //get new user group from form post&#xA;            $groups = craft()-&amp;gt;request-&amp;gt;getPost('groups');&#xA;            if ($groups) &#xA;            {&#xA;                if (count($groups) &amp;gt; 0) &#xA;                {&#xA;                    $userGroup = craft()-&amp;gt;userGroups-&amp;gt;getGroupById($groups[0]);&#xA;&#xA;                    if ($userGroup-&amp;gt;handle == 'premium' || $userGroup-&amp;gt;handle == 'private') &#xA;                    {&#xA;                        craft()-&amp;gt;email-&amp;gt;sendEmailByKey($user, 'rm_adds_client', array(&#xA;                            'user' =&amp;gt; $user,&#xA;                            'link' =&amp;gt; TemplateHelper::getRaw(craft()-&amp;gt;users-&amp;gt;getPasswordResetUrl($user)),&#xA;                            'rm' =&amp;gt; craft()-&amp;gt;userSession-&amp;gt;getUser(),&#xA;                        ));&#xA;                    }&#xA;                }&#xA;&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just want to add one extra check if the submission is done via the control panel since public registration is enabled as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy check for that?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3795" LastActivityDate="2019-01-10T08:43:05.283" Title="Is there a way to detect if a action is triggered from a control panel form?" Tags="&lt;control-panel&gt;&lt;emails&gt;&lt;events&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14961" PostTypeId="1" AcceptedAnswerId="14962" CreationDate="2016-05-09T09:42:38.707" Score="1" ViewCount="139" Body="&lt;p&gt;I’m attempting to setup a site with only a couple of templates and having a LOT of Matrix fields so the client can build content out of component based content, making it super flexible (hopefully).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Matrix Table Field Types for various items but what I really need to do is have the ability to have other types of content within the Table, other than just 'single-line text', 'multi-line text', 'number' or 'checkbox'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know any way to do this or of there are maybe any plugins which would solve this issue?&lt;/p&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2016-05-09T10:30:04.007" Title="Flexible content requirements for Matrix" Tags="&lt;matrix&gt;&lt;plugins&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14962" PostTypeId="2" ParentId="14961" CreationDate="2016-05-09T10:30:04.007" Score="3" Body="&lt;p&gt;If these Matrix fields are going to have a lot of fields then I'd recommend taking a look &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/pimp-my-matrix&quot; rel=&quot;nofollow&quot;&gt;Pimp my Matrix&lt;/a&gt; to keep them well organised. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wanting to make your Tables more powerful and have more field types check out &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;SuperTable&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4119" LastActivityDate="2016-05-09T10:30:04.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14963" PostTypeId="1" AcceptedAnswerId="14966" CreationDate="2016-05-09T11:13:37.600" Score="2" ViewCount="409" Body="&lt;p&gt;Our website offers three different languages. Each language has it own top level domain (example: domain.de, domain.it, domain.fr). Everything works like it should, except the Live Preview function. We have already tryed the things described here: &lt;a href=&quot;https://craftcms.com/support/cross-domain-live-preview&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/cross-domain-live-preview&lt;/a&gt; and a few other tweeks we found in stackoverflow. Every solution we found, only works with subdomains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As i understand, it's not possible because the browser does not allow cookies accross domains (Cross-Domain Policy). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have experience with handling various languages and top level domains in Craft CMS? How can we handle this requirement?&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-05-09T17:28:36.317" Title="Live Preview in different languages on different top level domains" Tags="&lt;localization&gt;&lt;live-preview&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14964" PostTypeId="2" ParentId="14960" CreationDate="2016-05-09T12:58:24.573" Score="6" Body="&lt;p&gt;Yes there is, &lt;code&gt;craft()-&amp;gt;request-&amp;gt;isCpRequest()&lt;/code&gt; returns whether the request is from the CP or not.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-09T12:58:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14965" PostTypeId="1" CreationDate="2016-05-09T15:26:19.867" Score="1" ViewCount="40" Body="&lt;p&gt;I am trying to add several header tags with the same name but different values. The last one prevails where the other don't appear to be output (when examining the output header using a sniffer). eg.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Link: &amp;lt;/css/master.css&amp;gt;; rel=preload; as=style&quot; %}&#xA;{% header &quot;Link: &amp;lt;/js/plugins.js&amp;gt;; rel=preload; as=script&quot; %}&#xA;{% header &quot;Link: &amp;lt;/js/main.js&amp;gt;; rel=preload; as=script&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement HTTP/2 server push for these files. Is this expected behaviour? Thanks&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2016-05-09T17:35:14.397" Title="Last header tag overwrites any previous tag with same name - expected behaviour?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14966" PostTypeId="2" ParentId="14963" CreationDate="2016-05-09T17:28:36.317" Score="2" Body="&lt;p&gt;With the current implementation of Live Preview in Craft, using Live Preview across different top-level domains isn't possible due to the cross-domain policy (as you found out) along with a few others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got a few ideas on how we might address this in the future, but it will definitely be after Craft 3 comes out.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-09T17:28:36.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14967" PostTypeId="2" ParentId="14965" CreationDate="2016-05-09T17:35:14.397" Score="3" Body="&lt;p&gt;It looks like if you want to specify multiple values for a link header, you need to comma separate them: &lt;a href=&quot;https://stackoverflow.com/a/25416118/684&quot;&gt;https://stackoverflow.com/a/25416118/684&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-05-09T17:35:14.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14968" PostTypeId="1" AcceptedAnswerId="14973" CreationDate="2016-05-09T18:36:22.647" Score="1" ViewCount="755" Body="&lt;p&gt;I read through the docs for Commerce, but could not figure out how to use Purchase Orders with Commerce.  I am still working through the trial version to make sure Commerce can do what the client is wanting.  I know the paid version has a manual gateway.  Want to make sure it will allow the collection of a Purchase Order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeremy I tried what you suggest.  Here is what I have...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if not craft.commerce.paymentMethods|length %}&#xA;        &amp;lt;p&amp;gt;No payment methods available.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if craft.commerce.paymentMethods|length %}&#xA;        &amp;lt;form method=&quot;POST&quot; id=&quot;paymentMethod&quot; class=&quot;form-inline&quot;&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/checkout/payment&quot;&amp;gt;&#xA;&#xA;            {{ getCsrfInput() }}&#xA;&#xA;            &amp;lt;label for=&quot;&quot;&amp;gt;Payment Method&amp;lt;/label&amp;gt;&amp;lt;br &amp;gt;&#xA;            &amp;lt;select id=&quot;paymentMethodId&quot; name=&quot;paymentMethodId&quot;&#xA;                    class=&quot;form-control&quot;&amp;gt;&#xA;                {% for id,name in craft.commerce.paymentMethods %}&#xA;                    &amp;lt;option value=&quot;{{ id }}&quot;&#xA;                            {% if id == cart.paymentMethod.id %}selected{% endif %}&amp;gt;{{ name }}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;purchase-order-block&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;Purchase Order Number&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;purchaseOrder&quot;&#xA;                    placeholder=&quot;Purchase Order&quot;&#xA;                    class=&quot;purchase-order-field&quot;&#xA;                    value=&quot;{{ formValues.lastName }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/form&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not surprised that it is not working as I really don't know what I am doing here.  Sure my form is wrong.  Any suggestions.  With your help on other areas I am almost finished.  This is the last thing I need to do and I will be finished.  Any suggestions or help will be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="3816" LastEditDate="2016-05-18T23:02:00.797" LastActivityDate="2016-05-19T23:25:51.980" Title="Purchase Order in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14969" PostTypeId="2" ParentId="14933" CreationDate="2016-05-09T19:13:46.277" Score="2" Body="&lt;p&gt;I finally figured this out! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any iOS application, in order to test the &quot;Production&quot; alerts to a physical iPhone Device -&gt; You have to create an Ad-Hoc Application and deploy that to your iPhone device. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do this, you must have an Ad-Hoc Distribution Profile created in the Member Center of &quot;Certificates, Identifiers, and Profiles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this page for more information: &lt;a href=&quot;https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html&quot; rel=&quot;nofollow&quot;&gt;https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the Push Notification Plugin in debug mode, it works with the sandbox URL of Apple's Push Alerts. It will not use the production URL if you have debugMode set to true in the general.php file of Craft's configs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: You will also have to set up the production certificate and configure that in the Push Notification Plugin settings to use the PEM file for the Production. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you deploy an Ad-Hoc Application to your iPhone device and have the PEM file setting pointed to your Production certificate, then everything should work fine (Make sure debugMode is set to false or remove this setting from the general.php file), the device will receive the alert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested this and it works on my iPhone 6 device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Nothing is wrong with the ZendFramework or Push Notification code.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue was the deployment for the application on the iPhone device. I was testing directly from Xcode and using its build which is a development build (not an Ad-Hoc Build).&lt;/p&gt;&#xA;" OwnerUserId="4072" LastActivityDate="2016-05-09T19:13:46.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14970" PostTypeId="1" AcceptedAnswerId="14975" CreationDate="2016-05-09T20:24:24.793" Score="4" ViewCount="1953" Body="&lt;p&gt;I am having trouble with emails being sent by Commerce.  Checked my settings in Craft and sent test email.  Works.  Followed Commerce docs in setting up email.  Double checked, but still does not work.  My problem may be in my email file.  Not sure what to have here.  Anyone have an example of an email file I could look at to see what I need to do?&lt;/p&gt;&#xA;" OwnerUserId="3816" LastActivityDate="2017-05-04T08:27:57.340" Title="Order Confirmation Email in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14971" PostTypeId="1" CreationDate="2016-05-09T22:35:25.020" Score="1" ViewCount="51" Body="&lt;p&gt;I am trying to redirect a bunch of uploads from our old website that no longer exist. I have one specific section I wanted to route to a resources page, but the rest will simply redirect to the home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/uploads*&lt;/code&gt;: redirects to homepage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/uploads/resources*&lt;/code&gt;: redirects to resources&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first redirect is overruling the second, and everything in /uploads is redirecting to the home page. Is there a way to make a special exception for this one folder? Through using a regex or something else?&lt;/p&gt;&#xA;" OwnerUserId="5116" LastEditorUserId="57" LastEditDate="2016-05-09T23:42:03.610" LastActivityDate="2016-05-10T05:07:12.263" Title="Redirects are Overriding each other" Tags="&lt;redirect&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14973" PostTypeId="2" ParentId="14968" CreationDate="2016-05-09T23:34:28.163" Score="1" Body="&lt;p&gt;There are many ways to skin this particular cat I'm sure, but the easiest way is just to use the manual payment gateway and a/some custom field(s) on your order to record the purchase order details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever you call the &lt;code&gt;updateCart&lt;/code&gt; controller, from your input form where you gather the PO details, you can then pass in the POST parameters as &lt;code&gt;fields[purchaseOrderDetails]&lt;/code&gt; to save the data to your field named &lt;code&gt;purchaseOrderDetails&lt;/code&gt; for later processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update using your code above:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.commerce.paymentMethods|length %}&#xA;    &amp;lt;p&amp;gt;No payment methods available.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if craft.commerce.paymentMethods|length %}&#xA;    &amp;lt;form method=&quot;POST&quot; id=&quot;paymentMethod&quot; class=&quot;form-inline&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/checkout/payment&quot;&amp;gt;&#xA;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        &amp;lt;label for=&quot;&quot;&amp;gt;Payment Method&amp;lt;/label&amp;gt;&amp;lt;br &amp;gt;&#xA;        &amp;lt;select id=&quot;paymentMethodId&quot; name=&quot;paymentMethodId&quot;&#xA;                class=&quot;form-control&quot;&amp;gt;&#xA;            {% for id,name in craft.commerce.paymentMethods %}&#xA;                &amp;lt;option value=&quot;{{ id }}&quot;&#xA;                        {% if id == cart.paymentMethod.id %}selected{% endif %}&amp;gt;{{ name }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;purchase-order-block&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;Purchase Order Number&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[purchaseOrder]&quot;&#xA;                placeholder=&quot;Purchase Order&quot;&#xA;                class=&quot;purchase-order-field&quot;&#xA;                value=&quot;{{ cart.purchaseOrder }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All I have really done here is change how you're referencing the filed  on our order (which must have a handle of &lt;code&gt;purchaseOrder&lt;/code&gt; for the above to work).  And I am presuming you have the cart available in &lt;code&gt;cart&lt;/code&gt; obviously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to accept the answer if it gets you going!&#xA;Untested, but that's pretty much it, you were almost there really!&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-05-19T23:25:51.980" LastActivityDate="2016-05-19T23:25:51.980" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14974" PostTypeId="1" AcceptedAnswerId="14977" CreationDate="2016-05-10T00:01:36.267" Score="5" ViewCount="809" Body="&lt;p&gt;I'm just planning ahead for a project and was hoping for a second opinion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to be making a site that will have about 7 different types of entry - all of which have different fields/URL's; &lt;em&gt;however&lt;/em&gt; &lt;strong&gt;on the front-end they will all behave as if they are part of one channel&lt;/strong&gt;. I will have a single page that lists all of the entries and I will also be giving end-users the ability to perform searches/filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of easy dashboard management I have currently set them up as &lt;strong&gt;separate sections&lt;/strong&gt; instead of &lt;strong&gt;one section with multiple entry types&lt;/strong&gt; (because using individual sections gives me a nice separated 'Entries' page in the dashboard - it's hard to sort/view by entry type at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Seeing as I can get the site to work the same regardless of which method I use, is there a dramatic difference between pulling out entries from multiple sections VS pulling out entries from one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For this example lets just say we are dealing with around 100,000 entries total.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="451" LastActivityDate="2016-05-10T06:31:25.390" Title="Using multiple sections VS a single section with entry types" Tags="&lt;sections&gt;&lt;entry-type&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14975" PostTypeId="2" ParentId="14970" CreationDate="2016-05-10T01:11:35.347" Score="8" Body="&lt;p&gt;To setup/debug email issues in commerce it's easiest to set up the simplest possible email and work your way up from there.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Check your Craft email settings - can you send &amp;amp; receive the test email&#xA;successfully?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Commerce settings, double check you have created your email correctly and that your template exists at the path you set.  To simplify&#xA;things initially, avoid using any variables in the subject and hardcode&#xA;an address to which the email will be sent&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Check your order status and make sure you have assigned your email to it and that a '1' then appears in the 'Has Emails' column for that&#xA;status.  It's easiest to start with an email attached to the default&#xA;order status so you can be sure orders coming in will trigger the&#xA;email.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create the simplest possible template for the email and just put in it something like &lt;code&gt;Huzzah, my email sent!&lt;/code&gt; as an initial end&#xA;to end test that the email is being triggered when you submit an order&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;At that point, your basic email should really send!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, check your &lt;code&gt;commerce.log&lt;/code&gt; file for errors.  If you have parsing errors in your email template, they will appear here, or you may get the somewhat obscure &lt;code&gt;[info] [plugin] [Forced] Can't send email if no status or emails exist.&lt;/code&gt; which indicates something is wrong with the set up of the status &amp;lt;&gt; email relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the errors typically come from template errors in the actual email - trying to get data not available for example.  &lt;code&gt;commerce.log&lt;/code&gt; will help with that, but another handy way of debugging your email templates is to put something like this at the top of them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# for debugging! #}&#xA;{% if craft.request.getSegment(1)==&quot;order-completed-debug&quot; %}&#xA;     {% set order = craft.commerce.orders.id(craft.request.getSegment(2)).first() %}&#xA;     {# No order supplied or other issue?  Load latest order by default... #}&#xA;     {% if not order %}&#xA;         {% set order = craft.commerce.orders.first() %}&#xA;     {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Set up a &lt;code&gt;route&lt;/code&gt; in Craft settings so that &lt;code&gt;/order-completed-debug/(number)&lt;/code&gt; points at your email template and then you will be able to use your browser for much easier testing by going to &lt;code&gt;/order-completed-debug/&amp;lt;someValidOrderID&amp;gt;&lt;/code&gt; in your browser rather than having to submit an order each time you change your email template!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I &lt;strong&gt;very strongly&lt;/strong&gt; recommend you use a transactional email service like mailgun, sparkpost, postmark, mandrill etc. as if you use default phpemail you're very likely to run into email delivery issues.  The logging systems these (often free!) transactional email systems supply are worth their weight in gold as you can see if the email is even being sent or not very simply, which helps with issue diagnosis a LOT.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For completeness, although this is a lot more advanced &amp;amp; less general:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another gotcha to note is that custom order fields are not necessarily set yet in the order completed email template as it seems this is actually sent out BEFORE the final order save occurs so if you're e.g. setting some data in a plugin method listening to &lt;code&gt;onBeforeOrderComplet=&lt;/code&gt;, you'll need to work around this....so to reference those fields you have to use a special approach (currently?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ISOrderNumber = order.content.ISOrderNumber ?? 'NONE' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not the use of &lt;code&gt;.content&lt;/code&gt; there - I need to use this to get at the field that is not yet saved in to the order as such.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-04T08:27:57.340" LastActivityDate="2017-05-04T08:27:57.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14976" PostTypeId="2" ParentId="14971" CreationDate="2016-05-10T05:07:12.263" Score="4" Body="&lt;p&gt;Try &lt;strong&gt;swapping the order of your Routes&lt;/strong&gt; (drag and drop), so that specific resources are routed first and the homepage fallback is positioned second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes are applied in the order the appear in &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Routes&lt;/strong&gt; i.e. If a route criteria is matched then Craft doesn't seem to try the rest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info here: &lt;a href=&quot;https://craftcms.com/docs/routing&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt; just in case you haven't seen it already. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know if that helps. &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-05-10T05:07:12.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14977" PostTypeId="2" ParentId="14974" CreationDate="2016-05-10T06:11:06.210" Score="3" Body="&lt;p&gt;It's hard to answer without examples of your content types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that if you would ever need deliberately &lt;strong&gt;relate&lt;/strong&gt; one Entry to another using the &lt;strong&gt;Entries field type&lt;/strong&gt;, then making use of separate Sections for each type of content would be the way to go. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. If an &quot;office location&quot; entry is the parent to multiple &quot;services&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more obvious factor is when an entry type needs to be a Channel vs a Structure. This can only be set at the Section-level&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-05-10T06:31:25.390" LastActivityDate="2016-05-10T06:31:25.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14978" PostTypeId="1" AcceptedAnswerId="14979" CreationDate="2016-05-10T13:17:47.563" Score="2" ViewCount="140" Body="&lt;p&gt;Is it possible to reduce the available field types that can be used in the Sprout form plugin form builder section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be useful to not let my clients be able to select the Matrix or Tags fields amongst others.&lt;/p&gt;&#xA;" OwnerUserId="3734" LastActivityDate="2018-05-22T01:51:39.650" Title="Sprout Forms - Possible to reduce available field types in form builder" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14979" PostTypeId="2" ParentId="14978" CreationDate="2016-05-10T15:05:19.173" Score="2" Body="&lt;p&gt;Sprout Forms for Craft 3 only displays fields that can be used on the form. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Craft 2 answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Sprout Forms for Craft 2, it is not possible to toggle the visibility of the fields available, it displays all fields that can be received by the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms does break out the fields listed into option groups, so with a training-based approach, you could show a client that only the &lt;code&gt;Standard Fields&lt;/code&gt; are supported and that all the &lt;code&gt;Custom Fields&lt;/code&gt; require a developer to get implemented properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach could be to use a plugin like &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS&lt;/a&gt; and hide the &lt;code&gt;Custom Fields&lt;/code&gt; option group:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.sprout-field-modal .fieldtoggle [label=&quot;Custom Fields&quot;] {&#xA;  display: none;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-05-22T01:51:39.650" LastActivityDate="2018-05-22T01:51:39.650" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14980" PostTypeId="1" CreationDate="2016-05-10T16:07:35.280" Score="3" ViewCount="219" Body="&lt;p&gt;Amazon S3 is returning the following error for a file in a bucket that is in Ireland (s3-eu-west-1):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[PermanentRedirect] The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The URL prefix is setup to be s3-eu-west-1.amazonaws.com, and using the S3.php class standalone with my key/secret, the bucket are listed as being in eu-west-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried logging out inside S3-&gt;getObjectInfo() what endpoint Craft/S3.php was using when accessing the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, it's &lt;code&gt;s3-us-west-2.amazonaws.com&lt;/code&gt;. Isn't that weird?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2016-05-10T16:33:03.280" Title="Amazon S3 endpoint is wrong when accessing Asset info" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14981" PostTypeId="1" AcceptedAnswerId="14984" CreationDate="2016-05-10T16:20:35.670" Score="5" ViewCount="4547" Body="&lt;p&gt;I'm wondering what kind of performance increase, and in what situations, I might expect from using Redis or Memcache over the default file-based caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know template caching always comes from the DB, so I'm not sure what else I can expect to be cached from Craft itself, and how that might impact site performance.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2021-04-03T07:00:02.997" Title="Expected performance benefit of using a non-file CacheMethod (Redis, Memcache)" Tags="&lt;cache&gt;&lt;performance&gt;&lt;redis&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14982" PostTypeId="2" ParentId="14980" CreationDate="2016-05-10T16:33:03.280" Score="3" Body="&lt;p&gt;The problem ended up being that I had completely missed the &lt;code&gt;location&lt;/code&gt; setting in the database column of the Asset source.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2016-05-10T16:33:03.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14984" PostTypeId="2" ParentId="14981" CreationDate="2016-05-10T20:34:23.590" Score="3" Body="&lt;p&gt;As with most performance related questions, the answer is &quot;it depends&quot;. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apps like Redis and Memcache store their key =&gt; value stores in memory as opposed to disk-based file caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accessing data from memory is usually orders of magnitude faster than accessing data from disk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these fall under &quot;&lt;a href=&quot;https://craftcms.stackexchange.com/a/13383/57&quot;&gt;General purpose data caching&lt;/a&gt;&quot; and Craft will use them internally for its own operations and plugins can certainly make use of them as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a plugin that makes extensive use of data caching and/or you've got a heavily trafficked site, then you will likely see some tangible performance benefits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just doing a basic stock Craft install on a low trafficked site, then you likely won't see much of a difference at all.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-05-10T20:34:23.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14985" PostTypeId="2" ParentId="14944" CreationDate="2016-05-10T23:57:53.267" Score="2" Body="&lt;p&gt;I wouldn't normally set up a site like this — but given your setup, the following should work.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the category settings, make sure that your category has 'Entries in this section have their own URLs' checked.&lt;/li&gt;&#xA;&lt;li&gt;Set your category url format to:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;top-level: &lt;code&gt;{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;nested categories: &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Set your article entry url format in the channel settings to &lt;code&gt;{category.last.uri}/{slug}&lt;/code&gt; (where 'category' is the handle of your category field.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note the use of &lt;code&gt;last&lt;/code&gt;. Categories will be returned as an Element Criteria Model which behaves much like an array (even if there is only one defined). The use of &lt;code&gt;last&lt;/code&gt; will return the last category element, which should be the uri pattern that you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if you have other routes in the CMS you will have to be careful about routing conflicts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, you might want to consider using a 'structure' instead of 'categories'. I commonly use a single structure that represents all of the top level pages in a site, using &lt;code&gt;Entry Types&lt;/code&gt; to distinguish the various field requirements and page layouts. You can then include the appropriate template layout automatically based on 'entry.type'. Likewise, you can use this structure to easily generate your site nav, and be fairly confident you won't run into any routing conflicts. The only reason I mention this is that you seem to already be heading in this direction with your current setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I might also add that you will want to make your category field required, otherwise there will be no route to the article in question.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-05-11T00:26:28.550" LastActivityDate="2016-05-11T00:26:28.550" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14986" PostTypeId="1" AcceptedAnswerId="14987" CreationDate="2016-05-11T01:37:09.667" Score="2" ViewCount="203" Body="&lt;p&gt;I have a controller which fetches an asset from an entry (this is the service method that provides the asset):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function findPoster($entryId) {&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;id = $entryId;&#xA;&#xA;    $entry = $criteria-&amp;gt;first();&#xA;&#xA;    if ($entry) {&#xA;        if ($entry-&amp;gt;downloadItem) {&#xA;            return $entry-&amp;gt;downloadItem-&amp;gt;first();&#xA;        }&#xA;    }&#xA;&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works great, however now I need to send the asset to the browser. Having a little poke around in the method listing I see there is a &lt;code&gt;CBaseController::renderFile()&lt;/code&gt; which sounds to be what I need, however I can't work out the correct way to build a path to the file. Accessing &lt;code&gt;$url&lt;/code&gt; from the asset I've fetched returns a public relative path but obviously I need the path on the filesystem.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So far I've got this working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$name = strtolower($asset-&amp;gt;title) . '.' . $asset-&amp;gt;extension;&#xA;&#xA;header('Content-Type: ' . $asset-&amp;gt;getMimeType());&#xA;header('Content-Disposition: attachment; filename=' . $name);&#xA;&#xA;$path = realpath(craft()-&amp;gt;basePath . '/../../public/' . $asset-&amp;gt;url);&#xA;&#xA;die(file_get_contents($path));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this is far from ideal because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have to hardcode the &lt;code&gt;public&lt;/code&gt; directory which isn't the case at any other point in Craft, so it feels really dirty.&lt;/li&gt;&#xA;&lt;li&gt;Manually setting the headers seems like something a controller method would be able to take care of properly.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="938" LastEditorUserId="938" LastEditDate="2016-05-11T02:03:36.953" LastActivityDate="2016-05-11T02:23:19.483" Title="Send an asset from a plugin controller" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;controller&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14987" PostTypeId="2" ParentId="14986" CreationDate="2016-05-11T02:23:19.483" Score="2" Body="&lt;p&gt;There might be a way to do this with &lt;code&gt;CBaseController::renderFile()&lt;/code&gt;, but I'd just use &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#sendFile-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;sendFile()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3rd parameter is an optional &lt;code&gt;$options&lt;/code&gt; array and you can pass a &lt;code&gt;'forceDownload' =&amp;gt; true&lt;/code&gt; as one of the key =&gt; value pairs to force it to download to the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of hardcoding the the path to your public assets folder, you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$path = IOHelper::getFolderName(craft()-&amp;gt;request-&amp;gt;getScriptFile());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should get you the path to the folder your public &lt;code&gt;index.php&lt;/code&gt; file is executing in and you can tack on your public asset path from there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-11T02:23:19.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14988" PostTypeId="1" AcceptedAnswerId="14994" CreationDate="2016-05-11T07:18:31.297" Score="4" ViewCount="546" Body="&lt;p&gt;Is there any way to control the formatting of an asset's title that is created from the filename on upload? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, if you uploaded a file called &lt;code&gt;Craft-CMS.pdf&lt;/code&gt; it would create the title as &lt;code&gt;Craft Cms&lt;/code&gt; - where in most cases I you would expect the uppercase of &lt;code&gt;CMS&lt;/code&gt; to remain intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is a config setting for &lt;code&gt;filenameWordSeparator&lt;/code&gt;, but nothing related to the pattern used to created the title - is there anyway I'm not seeing to configure this?&lt;/p&gt;&#xA;" OwnerUserId="4553" LastActivityDate="2017-12-17T21:50:52.410" Title="How to control the format of an asset's Title" Tags="&lt;assets&gt;&lt;upload&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14989" PostTypeId="1" AcceptedAnswerId="14995" CreationDate="2016-05-11T08:02:56.137" Score="1" ViewCount="93" Body="&lt;p&gt;When I edit an existing entry the post date jumps ahead by an hour meaning I have to manually remove it before saving the changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought it may have something to do with the timezone but this is set to the correct timezone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across this?&lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="4083" LastEditDate="2016-05-11T08:30:31.820" LastActivityDate="2016-05-11T16:18:36.630" Title="postDate keeps jumping ahead when editing an entry" Tags="&lt;postdate&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14990" PostTypeId="1" CreationDate="2016-05-11T14:06:11.933" Score="3" ViewCount="309" Body="&lt;p&gt;I am using Lindsey's &lt;a href=&quot;https://github.com/lindseydiloreto/craft-languagelink&quot; rel=&quot;nofollow&quot;&gt;Language Link&lt;/a&gt; plugin for my language switcher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works well, as long as the url is not a category url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set element = (entry is defined ? entry : null) %}&#xA;&#xA;{% for locale in craft.i18n.getSiteLocales %}&#xA;    &amp;lt;a href=&quot;{{ ll(locale.id, element) }}&quot; class=&quot;dropdown-item&quot;&amp;gt;{{ locale.nativeName|capitalize }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where can I tell Craft to used the translated slug in my language switcher?&lt;/p&gt;&#xA;" OwnerUserId="785" LastEditorUserId="57" LastEditDate="2016-05-11T16:19:47.100" LastActivityDate="2017-03-29T15:16:04.543" Title="Localization with categories" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14992" PostTypeId="2" ParentId="14981" CreationDate="2016-05-11T14:52:56.357" Score="3" Body="&lt;p&gt;How many servers do you have? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Redis and Memcached are most beneficial/intended for a multiple server setup so if you only have one server, there's probably other/betters thing to worry about. (Best speed increase I've found so far: PHP 7.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Brad points out, it all depends on your content, traffic, concurrent users, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It goes without saying having enough ram so you're not swapping can have a huge benefit. Just because those files are stored on disk doesn't mean PHP itself is actually hitting the disk for each request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SSDs are also now coming standard with a lot of the better hosting plans. SSDs can rival in-memory access times. Just changing your hosting can have a big impact on your app's performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go down the deamon route, Redis seems more modern and is the newest contender in this space.  I haven't extensively used Redis or memached with Craft but I have a client with WP on a dedicated server. We tried memcached awhile back and it was actually slower than without it. It's not hard to see why: there's going to be overhead reading/writing to either daemon—after all they communicate via socket or TCP/IP—and whether that solves your particular performance problem is up for debate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;memcached hasn't really evolved much as of late. While memcached is strictly a key/value store, Redis is intended to store object structures better. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;tmpfs&lt;/code&gt; could be an alternative as well. It's basically a ram disk and is built into most Linux distros. It's pretty easy to setup and like everything else it has some caveats (making sure it comes back up on reboot, having enough space so you don't swap to begin with, clearing etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some further reading:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/2393783/php-tmpfs-vs-memcached&quot;&gt;temps vs memcached&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/a/11257333&quot;&gt;memcached vs redis&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-05-11T14:52:56.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14993" PostTypeId="1" CreationDate="2016-05-11T16:13:06.353" Score="1" ViewCount="645" Body="&lt;p&gt;A client's site is currently showing this message: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft does not support backtracking to this version. Please upload&#xA;  Craft 2773 or later.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I understand how to fix it, but I don't understand how it's happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft’s request log I can only see one update:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/02/22 15:37:15 [info] [application] [Forced] Updating from 2.5.2761 to 2.5.2763.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in the &lt;code&gt;craft_info&lt;/code&gt; table the &lt;code&gt;version&lt;/code&gt; and &lt;code&gt;build&lt;/code&gt; are &lt;code&gt;2.6&lt;/code&gt; and &lt;code&gt;2773&lt;/code&gt;, updated_at &lt;code&gt;2016-03-09 22:07:49&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in the log are several requests hitting 404s - &lt;code&gt;/wordpress/&lt;/code&gt;, &lt;code&gt;/administrator/index.php&lt;/code&gt;, &lt;code&gt;/wp/&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then at &lt;code&gt;2016/03/10 04:07:42&lt;/code&gt; (6 hours after craft_info was updated) in the log I'm seeing a load of these errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2016/03/16 09:11:25 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /chroot/home/lincshub/lincshub.com/craft/app/etc/web/WebApp.php:229&#xA;Stack trace:&#xA;#0 /chroot/home/domain/domain.com/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#1 /chroot/home/domain/domain.com/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#2 /chroot/home/domain/domain.com/html/index.php(19): require_once('/chroot/home/li...')&#xA;#3 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The last deployment (local to production) was made on 5 Feb 2016 12:44.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone shed some light on what's going on here please?&lt;/p&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2016-05-11T16:39:53.887" Title="Craft files and DB out of sync" Tags="&lt;database&gt;&lt;server&gt;&lt;updating&gt;&lt;updates&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14994" PostTypeId="2" ParentId="14988" CreationDate="2016-05-11T16:15:44.050" Score="4" Body="&lt;p&gt;For Craft 2, You can write a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listens to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#assets-onBeforeSaveAsset&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeSaveAsset&lt;/a&gt; event, and changes the title from the &lt;code&gt;asset&lt;/code&gt; parameter to whatever you want. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($event-&amp;gt;params['isNewAsset])&#xA;{&#xA;    $asset = $event-&amp;gt;params['asset']&#xA;    $asset-&amp;gt;getContent()-&amp;gt;title = 'My New Title';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Craft 3, you can write a plugin that listens to the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-asset.html#EVENT_BEFORE_HANDLE_FILE-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;BEFORE_HANDLE_FILE&lt;/a&gt; event like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Asset::class, Asset::EVENT_BEFORE_HANDLE_FILE, function(AssetEvent $event) {&#xA;    $asset = $event-&amp;gt;asset;&#xA;    $asset-&amp;gt;title = 'My New Title';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-12-17T21:50:52.410" LastActivityDate="2017-12-17T21:50:52.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14995" PostTypeId="2" ParentId="14989" CreationDate="2016-05-11T16:18:36.630" Score="2" Body="&lt;p&gt;Adding as an official answer since we've had a handful of reports about this.  Best we can tell it's a bug in Firefox that happens when you live in a non-UTC timezone.  There are several Date related bugs in Mozilla's bug tracker, but this one looks to be the most relevant: &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1227499&quot; rel=&quot;nofollow&quot;&gt;https://bugzilla.mozilla.org/show_bug.cgi?id=1227499&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-11T16:18:36.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14996" PostTypeId="2" ParentId="14993" CreationDate="2016-05-11T16:39:53.887" Score="2" Body="&lt;p&gt;It looks like the database schema (at Craft version 2.6.2773) is ahead of the &lt;code&gt;craft/app&lt;/code&gt; files on your file system (at Craft version 2.5.2763).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since (I assume) you're not seeing any update info being logged in production around &lt;code&gt;2016-03-09 22:07:49&lt;/code&gt; (from the &lt;code&gt;dateUpdated&lt;/code&gt; column in the &lt;code&gt;craft_info&lt;/code&gt; table), my guess is that someone updated the site/database locally, then restored the updated database to production with the older files still in place.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-11T16:39:53.887" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="14997" PostTypeId="1" CreationDate="2016-05-11T17:52:24.210" Score="2" ViewCount="328" Body="&lt;p&gt;I’m using Craft to add CMS functionality to an e-commerce website via &lt;code&gt;craft/app/bootstrap.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to pull a 'timeline' structure with a &lt;code&gt;featuredImage&lt;/code&gt; Asset Field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code works and pulls the full size image, but I can’t work out how to pull the ‘small’ size of image which is set up as a transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume it should be something like &lt;code&gt;$entry-&amp;gt;featuredImage[0]-&amp;gt;url['small']&lt;/code&gt; but nothing seems to be working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$timeline = Craft\craft()-&amp;gt;elements-&amp;gt;getCriteria(Craft\ElementType::Entry);&#xA;$timeline-&amp;gt;section = 'timeline';&#xA;$timeline-&amp;gt;with = 'featuredImage';&#xA;$timeline-&amp;gt;withTransforms = 'small';&#xA;&#xA;foreach ($timeline as $entry)&#xA;{                       &#xA;  ?&amp;gt;&#xA;      &amp;lt;li&amp;gt;&#xA;          &amp;lt;div class=&quot;imgholder&quot;&amp;gt;&amp;lt;img src=&quot;&amp;lt;?php echo $entry-&amp;gt;featuredImage[0]-&amp;gt;url; ?&amp;gt;&quot; alt=&quot;&amp;lt;?php echo $entry-&amp;gt;featuredImage[0]-&amp;gt;title; ?&amp;gt;&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;          &amp;lt;h4&amp;gt;&amp;lt;?php echo $entry-&amp;gt;title; ?&amp;gt;&amp;lt;/h4&amp;gt;&#xA;          &amp;lt;?php echo $entry-&amp;gt;body; ?&amp;gt;&#xA;       &amp;lt;/li&amp;gt;&#xA;  &amp;lt;?php&#xA;}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="57" LastEditDate="2016-05-12T00:51:48.960" LastActivityDate="2016-05-12T16:52:52.857" Title="PHP transformed image?" Tags="&lt;image-transforms&gt;&lt;php&gt;&lt;image&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14998" PostTypeId="1" AcceptedAnswerId="15002" CreationDate="2016-05-11T21:29:36.153" Score="2" ViewCount="76" Body="&lt;p&gt;First off, &lt;em&gt;HUGE&lt;/em&gt; thank you to Lindsey for opening this door for me. Opened up a whole new layer!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have (another) plugin that is listening to the &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt; event. My plugin inspects the order, and if a specific product was purchased, I capture that and save the pre-defined values in a custom table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you buy &quot;Product A&quot;, you get to pick two &quot;Product B&quot; options (these options are defined in commerce/CP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to create the custom table and save the correct values - so far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to relate not only the user back to the user account, but the &quot;Product A&quot; back to the purchasable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginRecord.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'id' =&amp;gt; array(AttributeType::Number, 'default' =&amp;gt; null),&#xA;        'packageId' =&amp;gt; array(AttributeType::Number, 'default' =&amp;gt; null),&#xA;        ...&#xA;    );&#xA;}&#xA;&#xA;&#xA;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;        'package' =&amp;gt; array(static::BELONGS_TO, '????', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to get back to the commerce purchasable record?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-05-12T02:59:11.460" LastActivityDate="2016-05-12T02:59:55.117" Title="How can I relate a FK back to the purchasable ID?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14999" PostTypeId="1" AcceptedAnswerId="15005" CreationDate="2016-05-11T21:42:46.660" Score="1" ViewCount="1048" Body="&lt;p&gt;I've created several entries from a feed from the eBay API, but I would like to add images to the entry too! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to get an array of URLs, which I would like to import into an assets field that I have on the new entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw a post from Brandon from a couple years back suggesting it was not possible to do this, unable to find anything more up-to-date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I grab the image with cURL in my plugin then create a &lt;code&gt;new AssetFileModel&lt;/code&gt; and some how sync the temp image file with Craft somehow? As a follow up question how would I add multiple images to the assets field on my new entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Joe&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="57" LastEditDate="2016-05-12T00:02:24.320" LastActivityDate="2017-09-05T14:04:18.437" Title="Is it possible to create a new asset from an image URL?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;image&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15000" PostTypeId="1" CreationDate="2016-05-11T22:59:48.160" Score="0" ViewCount="457" Body="&lt;p&gt;The following code will return the correct result, but since I'm quite new with Craft, I wanted to know if there was a more preferred/efficient way to filter this in the template (or maybe create a custom function).  Here we go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentDay = now|date('l') %}&#xA;{% set currentTime = now|date('H:i') %}&#xA;{% set entries = craft.categories.group('shows') %}&#xA;&#xA;{% for entry in entries %}&#xA;  {% for row in entry.showschedule %}&#xA;    {% for day in row.airingDatesEn %}&#xA;      {% if day == currentDay|lower %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I'm looping over all the &lt;code&gt;entries&lt;/code&gt; in the craft category 'shows', then looping over the SuperTable row &lt;code&gt;showschedule&lt;/code&gt;, then looping over the checkbox category &lt;code&gt;airingdatesEn&lt;/code&gt; to see if it contains the current day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like I'm doing a lot of barrel rolls here, any ideas on how to simplify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="45" LastEditDate="2016-08-13T02:47:47.470" LastActivityDate="2016-08-13T02:47:47.470" Title="Simplify templating query with Super Table" Tags="&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15001" PostTypeId="2" ParentId="15000" CreationDate="2016-05-12T01:53:03.947" Score="1" Body="&lt;p&gt;Someone else will surely better answer the larger question you're asking, but one small point: as you've written it, you're running the filter &lt;code&gt;currentDay|lower&lt;/code&gt; many, many times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since that will be static for the duration of the loop, even if Craft/twig doesn't have more efficient ways to handle your query, you should do something like &lt;code&gt;{% set currentDayLower = currentDay|lower %}&lt;/code&gt; once around line 4 and then compare &lt;code&gt;{% if day == currentDayLower %}&lt;/code&gt; in order to avoid re-doing a filter in a loop.&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2016-05-12T01:53:03.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15002" PostTypeId="2" ParentId="14998" CreationDate="2016-05-12T02:59:55.117" Score="3" Body="&lt;p&gt;Thanks Brad for breaking it down like that. It helped me take a step back and see what it was I was doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the relationship I have that is working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'id' =&amp;gt; AttributeType::Number,&#xA;        'packageId' =&amp;gt; AttributeType::Number,&#xA;        ...&#xA;    );&#xA;}&#xA;&#xA;&#xA;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;        'package' =&amp;gt; array(static::BELONGS_TO, 'Commerce_PurchasableRecord', 'onDelete' =&amp;gt; static::CASCADE),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I am able to have a relation to the user id &lt;code&gt;element&lt;/code&gt; and back to my product &lt;code&gt;package&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-05-12T02:59:55.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15003" PostTypeId="1" AcceptedAnswerId="15012" CreationDate="2016-05-12T06:02:22.617" Score="1" ViewCount="382" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n0VJG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n0VJG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easier way to get the CP's currently selected locale? In my plugin I am currently using this method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getCurrentLocale() {&#xA;    $id = is_array($this-&amp;gt;value) ? $this-&amp;gt;value[0] : false;&#xA;    $segments = craft()-&amp;gt;request-&amp;gt;segments;&#xA;    $lastSegment = end($segments);&#xA;    $locales = craft()-&amp;gt;elements-&amp;gt;getEnabledLocalesForElement($id);&#xA;&#xA;    if (in_array($lastSegment, $locales)) {&#xA;        return $lastSegment;&#xA;    }&#xA;&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-05-12T17:55:22.150" Title="Get CP's current selected locale" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15004" PostTypeId="1" AcceptedAnswerId="15127" CreationDate="2016-05-12T08:19:22.787" Score="1" ViewCount="140" Body="&lt;p&gt;I'm trying to change the URI of a single so on the german site it will show the translated URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I'm just changing it here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V9GcH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V9GcH.png&quot; alt=&quot;Screenshot of entry section settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if I try to browse to /Über-uns on the german site I get a 404, what am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="5128" LastActivityDate="2016-05-20T08:13:41.097" Title="Translated URIs" Tags="&lt;localization&gt;&lt;url&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15005" PostTypeId="2" ParentId="14999" CreationDate="2016-05-12T08:32:08.030" Score="5" Body="&lt;p&gt;Download the image into a temp file, then upload it as an asset. You can find $iAssetSourceId by looking at the URL when editing an asset source&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$iAssetSourceId = 4;&#xA;$iAssetFolderId = (int)craft()-&amp;gt;assets-&amp;gt;getRootFolderBySourceId($iAssetSourceId)-&amp;gt;id;&#xA;$sTempFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $sFilename;&#xA;$sFileContents = file_get_contents($sImageUrl);&#xA;file_put_contents($sTempFilePath, $sFileContents);&#xA;&#xA;// Get craft to copy the temp file into the assets folder&#xA;$oAssetOperationResponse = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $sTempFilePath,&#xA;    $sFilename,&#xA;    $iAssetFolderId,&#xA;    AssetConflictResolution::Replace&#xA;);&#xA;&#xA;return (int)$oAssetOperationResponse-&amp;gt;responseData[&quot;fileId&quot;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2017-09-05T14:04:18.437" LastActivityDate="2017-09-05T14:04:18.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15006" PostTypeId="2" ParentId="15004" CreationDate="2016-05-12T08:59:17.290" Score="1" Body="&lt;p&gt;My experience with foreign characters in the past is that they don't work in URLs. Try changing it to &lt;code&gt;uber-uns&lt;/code&gt; and see what happens.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2016-05-12T08:59:17.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15007" PostTypeId="2" ParentId="14997" CreationDate="2016-05-12T12:26:19.977" Score="3" Body="&lt;p&gt;&lt;code&gt;$entry-&amp;gt;featuredImage[0]-&amp;gt;getUrl('small');&lt;/code&gt; works.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="57" LastEditDate="2016-05-12T16:52:52.857" LastActivityDate="2016-05-12T16:52:52.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15008" PostTypeId="2" ParentId="15004" CreationDate="2016-05-12T12:29:32.613" Score="1" Body="&lt;p&gt;Where are you taken when you click the “Open entry” button next to the “Live Preview” one? Maybe you forgot to change the rest of the URL in your tests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RFSjY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RFSjY.png&quot; alt=&quot;“Open entry” button&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-12T12:29:32.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15009" PostTypeId="1" CreationDate="2016-05-12T13:00:42.810" Score="2" ViewCount="298" Body="&lt;p&gt;I'm working on a site that uses a date slider to select members of the site by birthdate. I want to show the users by gender and between two &quot;ages&quot;. For example: Male, between 40 and 50 years old. The selection on gender works perfect, but I can't seem to get the lowest age set. &#xA;This is does work; with only the lower date set.     &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateRange = '&amp;lt;= ' ~ lower_date %}&#xA;&#xA;{% set queryParams = {&#xA;        geboortedatum : dateRange,&#xA;        order :'lastName'&#xA;    } &#xA;%}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But once I set the upper age I've got an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateRange = '&amp;lt;= ' ~ lower_date ~ ' AND =&amp;gt; ' ~ upper_date %}&#xA;&#xA;{% set queryParams = {&#xA;        geboortedatum : dateRange,&#xA;        order :'lastName'&#xA;    } &#xA;%}  &#xA;&#xA;{% set leden = craft.users(queryParams) %}&#xA;{% set leden = craft.users(queryParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gets this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Call to a member function getTimestamp() on a non-object in /chroot/home/deacteur/deacteursgilde.be/craft/app/helpers/DbHelper.php on line 597&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me out here? I'm totally lost... Thanks a lot!!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-05-12T16:53:39.013" LastActivityDate="2016-05-12T16:53:39.013" Title="Setting a date range on entry parameters" Tags="&lt;users&gt;&lt;datetime&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15010" PostTypeId="2" ParentId="15004" CreationDate="2016-05-12T13:24:15.297" Score="1" Body="&lt;p&gt;When setting up multiple locales you need to also setup sub-directories for each locale except the default one. So if &lt;code&gt;de&lt;/code&gt; is your third locale you should have a &lt;code&gt;/de&lt;/code&gt; folder in your wwwroot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that please browse to the URL &lt;code&gt;/de/uber-uns&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="297" LastActivityDate="2016-05-12T13:24:15.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15011" PostTypeId="1" CreationDate="2016-05-12T15:17:23.923" Score="2" ViewCount="53" Body="&lt;p&gt;I'm working on a site that has logins for members, but I'd like to have a page that shows all members with a name and picture.&#xA;To do this, we had to import an existing database that doesn't have a lot of profile pics. Now I want to hide all users that have no picture uploaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I'm trying, but with no luck...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if geslacht_param_string !=''  %}&#xA;&#xA;{% set queryParams = {&#xA;    search: {&#xA;        query: geslacht_param_string,&#xA;        attribute: 'geslacht'               &#xA;    },&#xA;    geboortedatum : dateRange,&#xA;    order :'lastName',&#xA;    photo : ':notempty:'&#xA;} %}&#xA;&#xA;{% else %}&#xA;    {% set queryParams = {&#xA;        geboortedatum : dateRange,&#xA;        order :'lastName',&#xA;        photo : &quot;:notempty:&quot;&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{% set leden = craft.users(queryParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find the decent syntax for &lt;code&gt;:notempty:&lt;/code&gt;, can anyone help me out here? Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-05-12T17:06:03.897" LastActivityDate="2016-05-12T20:15:56.853" Title="Hide users without profile pics" Tags="&lt;users&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15012" PostTypeId="2" ParentId="15003" CreationDate="2016-05-12T17:55:22.150" Score="1" Body="&lt;p&gt;I assume this is in the context of an &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entry-api-events&quot; rel=&quot;nofollow&quot;&gt;event&lt;/a&gt;, in which case you've got access to the EntryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, &lt;code&gt;$entryModel-&amp;gt;locale&lt;/code&gt; should be what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-12T17:55:22.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15013" PostTypeId="1" CreationDate="2016-05-12T19:01:44.977" Score="1" ViewCount="508" Body="&lt;p&gt;I've inherited a Craft site that is a mix of a custom plugin (the main site) plus a Laravel Dingo plugin (behind which the bulk of the data in the db lives), plus Solr, and I'm trying to untangle it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add a function to my controller that updates multiple entries in the database but I can't figure it out. I'll post a snippet of a working existing code along with my attempt:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Controller&#xA;==working, existing code===&#xA;public function actionUpdateGuide() {&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $attr = craft()-&amp;gt;request-&amp;gt;getPost('guide');&#xA;    $request = craft()-&amp;gt;MyPlugin_guide-&amp;gt;updateGuide($attr);&#xA;&#xA;    if ($request &amp;amp;&amp;amp; $request-&amp;gt;isSuccessful()) {&#xA;        $this-&amp;gt;clearCachedAsset($attr['id'], 'guide');&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    } else {&#xA;        $this-&amp;gt;hydrateInvalidForm($request, $attr);&#xA;    }&#xA;}&#xA;&#xA;==not-working, my function===   &#xA;public function actionPositionGuide() {&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $attr = json_decode(craft()-&amp;gt;request-&amp;gt;getPost('guide.json'), true);&#xA;    $neworder = array();&#xA;&#xA;    foreach($attr as $row) {&#xA;        $guide = array(&#xA;            'id' =&amp;gt; $row['name'],&#xA;            'position' =&amp;gt; $row['value']&#xA;        );&#xA;&#xA;        array_push($neworder, $guide);&#xA;    }&#xA;&#xA;    $request = craft()-&amp;gt;MyPlugin_guide-&amp;gt;positionGuides($neworder);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Service&#xA;==working, existing code=== &#xA;public function getGuideLocations($id, $page) {&#xA;    $url = $this-&amp;gt;getUrl() . &quot;/&quot; . $id . &quot;/locations?page=$page&quot;;&#xA;    $response = craft()-&amp;gt;laravel_plugin-&amp;gt;send('get', $url);&#xA;&#xA;    if (!$response-&amp;gt;isSuccessful()) {&#xA;        return array(&quot;error&quot; =&amp;gt; $response-&amp;gt;getStatusCode(), &quot;msg&quot; =&amp;gt; &quot;get_guide_locations_error&quot;);&#xA;    }&#xA;&#xA;    return $response-&amp;gt;json();&#xA;}&#xA;&#xA;==non-working, my function==&#xA;public function positionGuides($attr) {&#xA;&#xA;    foreach($attr as $guide) {&#xA;        craft()-&amp;gt;laravel_plugin-&amp;gt;update($attr);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm confused because I assumed the normal workflow was controller-&gt;service-&gt;model-&gt;database, but this seems to be controller-&gt;service-&gt;anotherplugin-service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking in the controller for this Laravel plugin, I see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function update($id) {&#xA;    $guide = Guide::find($id);&#xA;&#xA;    if (is_null($guide)) {&#xA;        return 'error';&#xA;    }&#xA;&#xA;    $locations = Input::get(&quot;locations&quot;, array());&#xA;    if(!empty($locations)) {&#xA;        $locations =  Location::whereIn('id', $locations)-&amp;gt;lists('id');&#xA;    }&#xA;&#xA;    $guide-&amp;gt;locations()-&amp;gt;sync($locations);&#xA;&#xA;    $guide = $guide-&amp;gt;fill(Input::all());&#xA;&#xA;    if (!Input::has('image_id')) {&#xA;        $guide-&amp;gt;image_id = null;&#xA;    }&#xA;&#xA;    return $guide-&amp;gt;save() ? $guide : $guide-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the laravel_api model for it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $table = &quot;guides&quot;;&#xA;protected $fillable = [&quot;name&quot;, &quot;city&quot;, &quot;type&quot;, &quot;image_id&quot;, &quot;description&quot;, &quot;status&quot;, &quot;updated_by&quot;, &quot;document&quot;, &quot;position&quot;];&#xA;protected $dates = ['deleted_at'];&#xA;protected $rules = [&quot;name&quot; =&amp;gt; &quot;required&quot;];&#xA;protected $appends = array('location_detail');&#xA;&#xA;protected $searchable = ['name', 'description', 'subtitle'];&#xA;&#xA;public function locations()&#xA;{&#xA;    return $this-&amp;gt;belongsToMany('Location');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any advice would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2016-05-12T20:09:46.627" LastActivityDate="2016-05-13T14:05:38.530" Title="Update multiple database entries via controller" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;controller&gt;&lt;services&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15014" PostTypeId="2" ParentId="15011" CreationDate="2016-05-12T20:15:56.853" Score="2" Body="&lt;p&gt;There's no &lt;code&gt;photo&lt;/code&gt; attribute on the UserElementType, so you can't query by it like you're trying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but you can probably work around that with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if geslacht_param_string !=''  %}&#xA;&#xA;{% set queryParams = {&#xA;    search: {&#xA;        query: geslacht_param_string,&#xA;        attribute: 'geslacht'               &#xA;    },&#xA;    geboortedatum : dateRange,&#xA;    order :'lastName',&#xA;} %}&#xA;&#xA;{% else %}&#xA;    {% set queryParams = {&#xA;        geboortedatum : dateRange,&#xA;        order :'lastName',&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{% set allUsers = craft.users(queryParams).find() %}&#xA;&#xA;{% set usersWithPhotos = [] %}&#xA;&#xA;{% for user in allUsers %}&#xA;    {% if user.photo %}&#xA;        {% set usersWithPhotos = usersWithPhotos|merge([user]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;There are {{ usersWithPhotos|length }} users with photos.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-12T20:15:56.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15015" PostTypeId="1" CreationDate="2016-05-12T23:25:18.850" Score="2" ViewCount="909" Body="&lt;p&gt;Probably a dumb question, but since i wasn't sure while reading on github, i'll ask here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if I can reach the JSON I created with an URL or is it only for use in PHP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to load entries from craft from a json with ajax when i click on a button and i wasn't sure if it was possible with this plugin since there is no exemple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody can help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5133" LastEditorUserId="45" LastEditDate="2016-08-13T02:38:26.003" LastActivityDate="2016-08-13T02:38:26.003" Title="ElementAPI - Can I use javascript/ajax to load json" Tags="&lt;plugin-elementapi&gt;&lt;ajax&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15016" PostTypeId="1" CreationDate="2016-05-13T10:06:46.157" Score="2" ViewCount="61" Body="&lt;p&gt;I've added a Venti fieldtype to an entry and when I try to save it as an all-day event it says &lt;code&gt;Couldn't save entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Start Date and time must be set.&#xA;End Date and time must be set.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-13T10:23:05.733" Title="Venti fieldtype bug" Tags="&lt;fieldtypes&gt;&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ClosedDate="2016-05-13T15:54:03.827" ContentLicense="CC BY-SA 3.0" />
  <row Id="15017" PostTypeId="2" ParentId="15016" CreationDate="2016-05-13T10:23:05.733" Score="1" Body="&lt;p&gt;Have managed to resolve by updating the &lt;code&gt;_convertTimes&lt;/code&gt; function in &lt;code&gt;venti/fieldtypes/Venti_EventFieldType.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change (line 141):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ((is_string($value['startDate']) &amp;amp;&amp;amp; $value['startDate']) || (is_array($value['startDate']) &amp;amp;&amp;amp; $value['startDate']['time']))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ((is_string($value['startDate']) &amp;amp;&amp;amp; $value['startDate']) || (is_array($value['startDate']) &amp;amp;&amp;amp; $value['startDate']['time']) || (is_array($value['startDate']) &amp;amp;&amp;amp; $value['allDay'] == 1 &amp;amp;&amp;amp; $value['startDate']['date']))`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And (line 150):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ((is_string($value['endDate']) &amp;amp;&amp;amp; $value['endDate']) || (is_array($value['endDate']) &amp;amp;&amp;amp; $value['endDate']['time']))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ((is_string($value['endDate']) &amp;amp;&amp;amp; $value['endDate']) || (is_array($value['endDate']) &amp;amp;&amp;amp; $value['endDate']['time']) || (is_array($value['endDate']) &amp;amp;&amp;amp; $value['allDay'] == 1 &amp;amp;&amp;amp; $value['endDate']['date']))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will remove the need to add a time if an all day event is specified.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-13T10:23:05.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15018" PostTypeId="2" ParentId="15015" CreationDate="2016-05-13T11:27:04.293" Score="3" Body="&lt;p&gt;Totally do-able.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;ElementAPI&lt;/a&gt; plugin downloaded and installed, you'll want to make sure you have created a file called &lt;code&gt;elementapi.php&lt;/code&gt; and it is in your &lt;code&gt;/craft/config/&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity's sake, I've used a stripped down version of the example on the github page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elementapi.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;news/{$entry-&amp;gt;id}.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Going back to your &lt;code&gt;/craft/config/&lt;/code&gt; directory, you will want to enable &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow&quot;&gt;CSRF protection.&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, (again for simplicity) here is an example of getting my news entries via ajax on docReay&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;...&#xA;&amp;lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js&quot;&amp;gt;  &amp;lt;/script&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;    $(function () {&#xA;        var data = {&#xA;            'CSRF': $('input[name=&quot;CSRF&quot;]').val(),&#xA;        };&#xA;&#xA;        $.ajax({&#xA;            'type': 'get',&#xA;            'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;            'cache': false,&#xA;            'data': data,&#xA;            'url': 'news.json',&#xA;            'dataType': 'json',&#xA;            'timeout': 50000&#xA;        }).done(function (response) {&#xA;            console.log(response);&#xA;        }).fail(function (error) {&#xA;                // Total fail.&#xA;            });&#xA;        });&#xA;    &amp;lt;/script&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body&amp;gt;&#xA;&amp;lt;div id=&quot;container&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then if you look at your console, you should see something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;data&quot;:[{&quot;title&quot;:&quot;We just installed Craft!&quot;,&quot;url&quot;:&quot;http:\/\/craftsandbox.dev\/news\/2016\/we-just-installed-craft&quot;,&quot;jsonUrl&quot;:&quot;http:\/\/craftsandbox.dev\/news\/3.json&quot;}],&quot;meta&quot;:{&quot;pagination&quot;:{&quot;total&quot;:1,&quot;count&quot;:1,&quot;per_page&quot;:100,&quot;current_page&quot;:1,&quot;total_pages&quot;:1,&quot;links&quot;:[]}}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-05-30T19:14:08.507" LastActivityDate="2016-05-30T19:14:08.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15020" PostTypeId="2" ParentId="1415" CreationDate="2016-05-13T13:44:11.417" Score="1" Body="&lt;p&gt;In case it's of use to anyone coming to this thread, I maintain a project called &lt;a href=&quot;https://github.com/niceandserious/crafty-vagrant&quot; rel=&quot;nofollow&quot;&gt;Crafty Vagrant&lt;/a&gt;, which is intended to be a handy dev environment / boilerplate starting point for Craft projects, and which has (among other things) both asset-syncing, in the form of a Gulp task (eg. &lt;code&gt;gulp rsync:fromstage&lt;/code&gt;), and simplified database provisioning (&lt;code&gt;vagrant provision --provision-with shell&lt;/code&gt; drops the current local database and replaces it with the most recent backup from Craft's backups directory).&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-05-13T13:44:11.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15021" PostTypeId="2" ParentId="13539" CreationDate="2016-05-13T13:55:23.483" Score="1" Body="&lt;p&gt;You can set &lt;code&gt;usePathInfo = true&lt;/code&gt; in your Craft general settings to force Craft to use PATH_INFO to generate URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#usePathInfo&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#usePathInfo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dukt OAuth should now show you a redirect URI without a query string (Facebook doesn’t like slashes in the query string and automatically encodes them) and you should be able to make the URIs match exactly.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-13T13:55:23.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15022" PostTypeId="2" ParentId="15013" CreationDate="2016-05-13T14:05:38.530" Score="1" Body="&lt;p&gt;OK, I managed to figure it out and I'll post the solution for those who run into similar problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, what's happening is Twig template-&gt;Plugin controller-&gt;Plugin Service-&gt;Laravel API-&gt;Laravel Controller-&gt;Database&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Plugin controller&#xA;public function actionPositionGuide() {&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $attr = json_decode(craft()-&amp;gt;request-&amp;gt;getPost('guide.json'), true);&#xA;    $neworder = array();&#xA;    foreach($attr as $row) {&#xA;        $guide = array(&#xA;            'id' =&amp;gt; $row['name'],&#xA;            'position' =&amp;gt; $row['value']&#xA;        );&#xA;        array_push($neworder, $guide);&#xA;    }&#xA;    $request = craft()-&amp;gt;myplugin_guide-&amp;gt;positionGuides($neworder);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Plugin service&#xA;public function positionGuides($attr) {&#xA;    $url = $this-&amp;gt;getBaseUrl() . &quot;/guides/position&quot;;&#xA;    return craft()-&amp;gt;mylaravel_api-&amp;gt;send('post', $url, $attr);&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then add a route to the Laravel routes.php file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Route::post('guides/position', 'GuidesController@position');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the Laravel controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function position() {&#xA;    $data = Input::all();&#xA;    $response = [&quot;msg&quot; =&amp;gt; &quot;success&quot;, &quot;status&quot; =&amp;gt; 200];&#xA;&#xA;    foreach($data as $guide) {&#xA;&#xA;        $oldguide = Guide::find($guide['id']);&#xA;&#xA;        if (is_null($oldguide)) {&#xA;            $response = [&quot;msg&quot; =&amp;gt; &quot;error&quot;, &quot;status&quot; =&amp;gt; 500];&#xA;        }&#xA;&#xA;        $oldguide-&amp;gt;position = $guide['position'];&#xA;&#xA;        $oldguide-&amp;gt;save() ? $oldguide : Log::debug($oldguide-&amp;gt;getErrors());&#xA;    }&#xA;&#xA;    return Response::json($response[&quot;msg&quot;], $response[&quot;status&quot;]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error handling is not great but if anyone has suggestions for improvement, I'm all ears.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2016-05-13T14:05:38.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15024" PostTypeId="2" ParentId="13957" CreationDate="2016-05-13T15:01:14.540" Score="1" Body="&lt;p&gt;Perhaps not the most elegant solution, but this works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryTags = craft.request.getQuery('tags') %}&#xA;&#xA;{% for tag in craft.tags.relatedTo(resourceTags) %}&#xA;   &amp;lt;a&#xA;     href=&quot;{% if tags == &quot;&quot; %}/learning/resources?tags={{ tag.title|kebab }}{% else %}/learning/resources?tags={{ tags|replace(' ', '+') }}+{{ tag.title|kebab }}{% endif %}&quot;&#xA;     class=&quot;btn btn-default{% if tag.title|kebab in queryTags %} disabled{% endif %}&quot;&#xA;   &amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding &lt;code&gt;disabled&lt;/code&gt; rather than &lt;code&gt;active&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="130" LastEditDate="2018-05-16T17:53:20.190" LastActivityDate="2018-05-16T17:53:20.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15025" PostTypeId="1" AcceptedAnswerId="15030" CreationDate="2016-05-13T15:35:11.630" Score="2" ViewCount="63" Body="&lt;p&gt;When I create a permission using the registerUserPermissions hook I would like everyone, in all user groups have access to that permission. An admin has to take an explicit step to restrict access to that pemission. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @return array&#xA; */&#xA;public function registerUserPermissions()&#xA;{&#xA;    return array(&#xA;        'my-permission' =&amp;gt; array(&#xA;            'label' =&amp;gt; Craft::t('Edit Settings'),&#xA;            //****ENABLE BY DEFAULT****&#xA;            'enable'=&amp;gt; true&#xA;        ),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2016-05-14T03:41:58.437" Title="Is there any way to set enable by default a permission on the registerUserPermissions hook?" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15027" PostTypeId="1" AcceptedAnswerId="15028" CreationDate="2016-05-13T16:48:30.757" Score="2" ViewCount="148" Body="&lt;p&gt;Wordpress has a great feature which allows visitors to sign up to receive email notifications whenever there's an update to the site. I'd like to emulate this functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of Postmaster, Brief, Sprout Forms, Sprout Emails, MailChimp Subscribe and have read through similar discussions and solutions here on the Craft SE - but nothing that would get me all the way there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Requirements would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ability to sign up per channel via email (a form per channel)&lt;/li&gt;&#xA;&lt;li&gt;Confirm email address (double opt-in)&lt;/li&gt;&#xA;&lt;li&gt;No (Craft member) registration necessary&lt;/li&gt;&#xA;&lt;li&gt;Ability to unsubscribe&lt;/li&gt;&#xA;&lt;li&gt;Auto send email notification when new entry is posted&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a current solution that could tick all these boxes? If not, would this a possible to build as a plugin? &lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="4215" LastEditDate="2016-05-13T17:26:08.747" LastActivityDate="2016-05-13T17:26:08.747" Title="Wordpress-like Subscription" Tags="&lt;users&gt;&lt;plugins&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15028" PostTypeId="2" ParentId="15027" CreationDate="2016-05-13T17:25:29.480" Score="3" Body="&lt;p&gt;I would consider this carefully from a subscriber's perspective. i.e. If I received an email every time something was published, I may consider unsubscribing very quickly.&lt;/p&gt;&#xA;&lt;p&gt;An alternative which I've found works very well is to send email updates on a &lt;strong&gt;regular basis&lt;/strong&gt; - that way your subscribers have an expectation of the frequency.&lt;/p&gt;&#xA;&lt;p&gt;We've used Campaign Monitor to automatically pull content from a RSS template and then send an email newsletter as well. You also have the flexibility to curate the entries as you see fit.&lt;/p&gt;&#xA;&lt;p&gt;Have a look at this page/video: &lt;a href=&quot;https://www.campaignmonitor.com/blog/new-features/2012/03/one-click-content/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.campaignmonitor.com/blog/new-features/2012/03/one-click-content/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Ability to sign up per channel via email (a form per channel)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can create separate (subscriber) lists within Campaign Monitor, for each Channel/Section&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Confirm email address (double opt-in)&lt;/p&gt;&#xA;&lt;p&gt;No (site) registration necessary&lt;/p&gt;&#xA;&lt;p&gt;Ability to unsubscribe&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;These are all possible.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Auto send email notification when new entry is posted&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Automation is also possible.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully that makes sense - let us know your thoughts?&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-05-13T17:25:29.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15029" PostTypeId="1" AcceptedAnswerId="15032" CreationDate="2016-05-14T03:13:48.653" Score="2" ViewCount="2251" Body="&lt;p&gt;I have a field type that I need to initialize. When the page loads I can use code like the following to handle certain behaviors of the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.myfieldwrapper').each(function() {&#xA;  new Craft.MyField(this);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within the Craft.MyField object, I add a couple listeners like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.addListener(this.$element, 'change', 'handleElementChange');&#xA;this.addListener(this.$element2, 'click', 'handleElement2Click');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That all works fine.  However, this field doesn't just get added to the page on page load. It exists in the row of a table, and a user can add additional rows to the table which add a new row and field to the DOM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to instantiate the newly added field in several ways, and I have been unable to get it right yet. The Craft.MyField seems to be initializing, and I appear to be able to re-initialize the default fields on the page, but my attempts do not have any affect on the dynamic fields that get added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the following is the best way to do this, but it's currently the closest I've come and is the simplest example code I can share reflecting my attempts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a new field gets added dynamically, I trigger an event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#tableId').trigger('rowAddOrRemove');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I have additional code watching for that event and attempting to re-initialize all the fields on the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#tableId').on('rowAddOrRemove', function(event){&#xA;  $('.myfieldwrapper').each(function() {&#xA;    new Craft.MyField(this);&#xA;  });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I do this the initial field on the page still works but none of the dynamically added fields behave as I need them too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I'm doing wrong or what concepts I need to understand better to get this right?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-05-15T16:29:23.880" Title="Add listener to dynamic html elements" Tags="&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15030" PostTypeId="2" ParentId="15025" CreationDate="2016-05-14T03:41:58.437" Score="1" Body="&lt;p&gt;There's not a native way to do this, but you might want to consider adding it as a &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you might be able to work around it a bit with some custom JS in the control panel and using something like the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-14T03:41:58.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15031" PostTypeId="2" ParentId="10725" CreationDate="2016-05-14T08:47:54.160" Score="4" Body="&lt;p&gt;ok i used the answer brad bell posted above and enhanced it slightly. i wanted to be able to specify the target environment on the command line, and i didn't want to edit a framework file to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so i created the following file, yiic_frontend.php, placed it in $root/utils (a new dir), and call it using &lt;code&gt;php $root/utils/yiic_frontend.php --env=envname plugin cmd&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * a front end for yiic.php that looks for env on cmdline and sets CRAFT_ENVIRONMENT&#xA; * accordingly. I put this script in a folder called &quot;utils&quot; in the root of my website&#xA; * install. So instead of doing something like&#xA; *     php $root/craft/app/etc/console/yiic.php plugin cmd&#xA; * you would call&#xA; *     php $root/utils/yiic_frontend.php --env=envname plugin cmd&#xA; * where &quot;envname&quot; is the config environment you wish to use.&#xA; */&#xA;&#xA;for ($i = 1; $i &amp;lt; count($_SERVER['argv']); $i++) {&#xA;    $arg = $_SERVER['argv'][$i];&#xA;    if (strpos($arg, '--env=') === 0) {&#xA;        $env = explode('=', $arg)[1];&#xA;        printf(&quot;---- setting env \&quot;%s\&quot;\n&quot;, $env);&#xA;        define('CRAFT_ENVIRONMENT', $env);&#xA;        array_splice($_SERVER['argv'], $i, 1);&#xA;        break;&#xA;    }&#xA;}&#xA;&#xA;require(__DIR__ . '/../craft/app/etc/console/yiic.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3789" LastActivityDate="2016-05-14T08:47:54.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15032" PostTypeId="2" ParentId="15029" CreationDate="2016-05-14T09:07:21.270" Score="2" Body="&lt;p&gt;You &lt;em&gt;might&lt;/em&gt; be looking at a simple race conditions issue, i.e. that the &lt;code&gt;rowAddOrRemove&lt;/code&gt; event is triggering before the new &lt;code&gt;.myfieldwrapper&lt;/code&gt; elements have been attached to the DOM. To make sure that you don't call &lt;code&gt;new Craft.MyField&lt;/code&gt; too early, you can try to wrap the constructor call in an anonymous &lt;code&gt;requestAnimationFrame&lt;/code&gt; handler:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#tableId').on('rowAddOrRemove', function(event){&#xA;    Garnish.requestAnimationFrame(function () {&#xA;        $('.myfieldwrapper').each(function() {&#xA;            new Craft.MyField(this);&#xA;        });&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if race conditions is even the issue here, but it's the only thing I can think of, based on the code you provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure you actually need the &lt;code&gt;rowAddOrRemove&lt;/code&gt; event – unless other parts of your application also needs to respond to that event, I'd opt for calling a simple function, rather than triggering a jQuery event, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ... field gets added dynamically&#xA;&#xA;Garnish.requestAnimationFrame(initFields); // Instead of $('#tableId').trigger('rowAddOrRemove');&#xA;&#xA;function initFields()&#xA;{&#xA;    $('.myfieldwrapper').each(function () {&#xA;        new Craft.MyField(this);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sidenote: If you &lt;em&gt;do&lt;/em&gt; need to trigger an event, I'd recommend looking at &lt;a href=&quot;https://github.com/millermedeiros/js-signals&quot; rel=&quot;nofollow&quot;&gt;Signals.js&lt;/a&gt;, which is a much more robust Event/Promises implementation than &lt;code&gt;$.trigger&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing: I'm not sure if calling &lt;code&gt;Craft.MyField(this)&lt;/code&gt; on DOM elements that have previously been initialized is an issue, but if it is, you could add a simple classname to the initialized elements, to prevent them being initialized multiple times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function initFields()&#xA;{&#xA;    $('.myfieldwrapper:not(.js-initialized)').each(function () {&#xA;        $(this).addClass('js-initialized');&#xA;        new Craft.MyField(this);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, if you need to destroy instances of &lt;code&gt;Craft.MyField&lt;/code&gt; that have previously been initialized but are now &lt;em&gt;removed&lt;/em&gt; (to prevent memory leaks or other bugs), you could do something like this (note that this example assumes that your &lt;code&gt;Craft.MyField&lt;/code&gt; class has a &lt;code&gt;destroy&lt;/code&gt; method that e.g. removes event listeners, deletes variables etc):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var myFieldInstances = [];&#xA;&#xA;function initFields()&#xA;{&#xA;    // Destroy removed fields&#xA;    var currentFieldInstances = myFieldInstances.slice(0);&#xA;    myFieldInstances = [];&#xA;    for (var i = 0; i &amp;lt; currentFieldInstances.length; ++i) {&#xA;        var field = currentFieldInstances[i],&#xA;            $el = field.$el;&#xA;        if (!$el.closest('#tableId').length) {&#xA;            // This field's DOM element is no longer a child of #tableId – kill it with fire&#xA;            field.destroy();&#xA;        } else {&#xA;            myFieldInstances.push(field);&#xA;        }&#xA;    }&#xA;    // Init new fields&#xA;    $('.myfieldwrapper:not(.js-initialized)').each(function () {&#xA;        $(this).addClass('js-initialized');&#xA;        myFieldInstances.push(new Craft.MyField(this));&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-05-14T09:21:10.603" LastActivityDate="2016-05-14T09:21:10.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15033" PostTypeId="1" AcceptedAnswerId="15034" CreationDate="2016-05-14T22:32:10.260" Score="2" ViewCount="434" Body="&lt;p&gt;I'm new to Craft and PHP, so thanks ahead of time!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to override a model method with a plugin? For example, I want to add some additional functionality to the &lt;code&gt;getUrl&lt;/code&gt; method of the &lt;code&gt;AssetFileModel&lt;/code&gt; class. Can this be done in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5143" LastActivityDate="2018-05-01T05:13:26.717" Title="Override a model method via plugin" Tags="&lt;plugins&gt;&lt;models&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15034" PostTypeId="2" ParentId="15033" CreationDate="2016-05-15T00:53:24.763" Score="3" Body="&lt;p&gt;Kind of, but probably not what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin can certainly do a &lt;code&gt;MyAssetFileModel extends AssetFileModel&lt;/code&gt; and (in the scope of your plugin) take advantage of existing &lt;code&gt;AssetFileModel&lt;/code&gt; methods and properties and override them as needed.  But that's the catch... it will only be within the executing scope of your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no native way (without hacking core Craft files) to tell Craft &quot;use &lt;code&gt;MyAssetFileModel&lt;/code&gt; wherever you would normally use &lt;code&gt;AssetFileModel&lt;/code&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is certainly much more doable in the upcoming Craft 3 release since Yii 2 has native support for things like service locators and dependency injection.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-05-01T05:13:26.717" LastActivityDate="2018-05-01T05:13:26.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15035" PostTypeId="2" ParentId="15029" CreationDate="2016-05-15T15:45:48.037" Score="2" Body="&lt;p&gt;In my question above I was chasing a misspelled class name with a limited understanding of how I should be approaching the problem I was asking about. Mats answer points out several considerations on how the problem could be approached differently and how the discussed code can be improved. I'd like to document one more approach to adding a listener which Mats answer helped me come to, and which is similar to how Craft initializes it's own UI elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throughout the Craft javascript, as elements are dynamically added to the page, you will see that many of them also initialize UI elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.initUiElements($container);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;initUiElements&lt;/code&gt; method checks the page for a handful of class names that are used in the UI (i.e. &lt;code&gt;.grid&lt;/code&gt;, &lt;code&gt;.pane&lt;/code&gt;, &lt;code&gt;.fieldToggle&lt;/code&gt;, &lt;code&gt;.menubtn&lt;/code&gt;, and more). When found, each class calls it's respective initialization method which is a custom jQuery plugin that Craft prepares in &lt;code&gt;craft.js&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up using a similar approach for my situation. It's quite likely my code can still be improved, so take my javascript skills with a grain of salt, but for the sake of documenting multiple approaches, this approach includes:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Create a custom jQuery plugin&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://api.jquery.com/jquery.fn.extend/&quot; rel=&quot;nofollow&quot;&gt;jQuery.fn.extend()&lt;/a&gt; we can &lt;em&gt;merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods.&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.extend($.fn,&#xA;{&#xA;    myfield: function()&#xA;    {&#xA;        return this.each(function()&#xA;        {&#xA;            if (!$.data(this, 'myfield-class'))&#xA;            {&#xA;                new Craft.MyField(this);&#xA;            }&#xA;        });&#xA;    },&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, we are passing two objects to &lt;code&gt;$.extend&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;$.fn&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{ myfield: function() { ... } }&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The result allows us to access our new method directly from the DOM:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.myfield', $container).myfield();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Passing the second argument &lt;code&gt;$container&lt;/code&gt; to the jQuery method allows us to restrict the behavior of our custom method to a specific context, such as elements within the container of whatever we are initializing (instead of the whole page).&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Create a way to initialize your elements&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://api.jquery.com/jquery.extend/&quot; rel=&quot;nofollow&quot;&gt;jQuery.extend&lt;/a&gt; we can &lt;em&gt;merge the contents of two or more objects together into the first object.&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.extend(Craft.MyField,&#xA;{&#xA;    initFields: function($container)&#xA;    {&#xA;        $('.myfield', $container).myfield();&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, we are passing two objects to &lt;code&gt;$.extend&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Craft.MyField&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{ initFields: function($container) { ... } }&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The result is that we can now use the &lt;code&gt;initField&lt;/code&gt; method in the second object on the first object: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.MyField.initField($container);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Initialize your elements when the appropriate action is triggered&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;With the above items in place, now, each time a specific action happens we can initialize our fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.MyField.initFields($container);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my case, the field I needed to initialize was within a table row. So, each time new table row is added to the page, I can now initialize the fields within that row, treating the row as the container:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;addRow: function()&#xA;{&#xA;  // Do stuff that adds the table row and fields&#xA;&#xA;  // Initialize the fields&#xA;  Craft.MyField.initFields($tr);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-05-15T16:29:23.880" LastActivityDate="2016-05-15T16:29:23.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15036" PostTypeId="2" ParentId="9342" CreationDate="2016-05-15T18:42:49.980" Score="-2" Body="&lt;p&gt;You can set transforms in the CMS, then in your template you call the actual name of the transform you make in the dashboard instead, you still use &lt;code&gt;getUrl&lt;/code&gt;, but you can generate the assets with &quot;Update Image Assets&quot; on the settings page in the dashboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;read more here: &lt;a href=&quot;https://craftcms.com/docs/image-transforms#applying-cp-defined-transforms-to-images&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/image-transforms#applying-cp-defined-transforms-to-images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note*: The fixed nav covers this area slightly now...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I think I remember hearing/reading it's better for performance for assets not to be cached with varnish too.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2016-05-15T18:42:49.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15037" PostTypeId="2" ParentId="9342" CreationDate="2016-05-15T19:27:02.030" Score="2" Body="&lt;p&gt;The best advice I could find on this is in another SE page: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7140/any-way-to-manually-generate-a-transform-on-an-asset-source&quot;&gt;Any way to manually generate a transform on an asset source?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems to boil down to two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Brad suggests rightly that trying to do this all at once can be a heavy job, and so to ask Craft to do so may be asking for trouble, e.g. timeouts on PHP, cutouts on web hoster runaway safeties, etc..&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;OTOH the always thoughtful @carlcs offers an offline script suggestion as to how to do this, provided you monitor and arrange batch sizes that would work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm thinking this might be another job best approached as a yiic plugin, so that you would call it from the *nix command line rather than over the web. This would give more scope as to how long the job could run, possibly, and anyway be a more convenient place to arrange the job as a series of batches, if the size of it makes that needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yiic commands run the whole Craft armature, so you can still program the main action in a template.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-05-15T19:27:02.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15038" PostTypeId="1" AcceptedAnswerId="15047" CreationDate="2016-05-15T23:14:13.133" Score="2" ViewCount="116" Body="&lt;p&gt;I am laying out a site which will have a newspaper style IA. There are multiple Main Sections and each section will have multiple Articles and each article has multiple entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client only knows the names of the Articles and needs to create these and then subsequent start adding the  entries to each article. The articles have their own Landing Page (listing the entries) and there will be a Landing page for all Articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating the Articles as sections, with structures would have the benefits of the &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; tag, but the layout for each entry will be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the easiest for the client? Setting the Articles up as Sections or as Main Categories (which they really aren't as the are simply titles for each article), or is there a better way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: the Articles are like mini-books, with multiple chapters......&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-06-15T16:10:43.647" Title="Multiple articles with individual entries" Tags="&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15040" PostTypeId="2" ParentId="9342" CreationDate="2016-05-16T08:32:37.067" Score="3" Body="&lt;p&gt;You could use my &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse Field plugin&lt;/a&gt; to generate transforms when an entry (or any other element) is saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a preparse field and create some twig that makes the same transforms that you do in your template. Don't care about the output, the only thing you want it to do is generate the images on save. Assuming you attach the field to an entry, and you have a field named &lt;code&gt;myImageField&lt;/code&gt;, the code could look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myImageField | length %}&#xA;  {% for image in entry.myImageField %}&#xA;    {{ image.getUrl({ width: 1600 })&#xA;    {{ image.getUrl({ width: 1200 })&#xA;    {{ image.getUrl({ width: 800 })&#xA;    {{ image.getUrl({ width: 400 })&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you save the entry, this code will run, and create any new image transforms. When the entry is displayed in the front-end, the image transforms will already have been created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beware that this will not actually increase the speed of the transforms, only shift the time it takes from the front-end user over to the admin. But I find that this is more acceptable in most of my use-cases.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-05-16T08:32:37.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15041" PostTypeId="2" ParentId="15038" CreationDate="2016-05-16T10:20:52.400" Score="1" Body="&lt;p&gt;There are always so many ways to configure a CMS like Craft. Personally I would make:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;&lt;strong&gt;Articles&lt;/strong&gt;&quot; a Channel&lt;/li&gt;&#xA;&lt;li&gt;&quot;&lt;strong&gt;Main Sections&lt;/strong&gt;&quot; a Structure&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Within &lt;strong&gt;Articles&lt;/strong&gt;, you could have a Matrix field, which would in turn contain an Entries custom field, allowing your client to select &lt;strong&gt;Main Sections&lt;/strong&gt; and sort them as content-blocks, using the drag-n-drop features of the Matrix custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the client's perspective, they would see something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pDx9m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pDx9m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know if that helps, I'm sure others will offer alternatives :)&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-05-16T10:20:52.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15042" PostTypeId="1" CreationDate="2016-05-16T12:12:16.087" Score="1" ViewCount="773" Body="&lt;p&gt;I have a list of checkboxes in a GET form which results in a URL with a querystring like &lt;code&gt;?q=&amp;amp;cat=&amp;amp;city%5B%5D=28&amp;amp;city%5B%5D=26&amp;amp;sort=asc&amp;amp;order=name&lt;/code&gt; when submitted. The Object/Array behind this string looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA;    [q] =&amp;gt; &#xA;    [cat] =&amp;gt; &#xA;    [city] =&amp;gt; Array&#xA;        (&#xA;            [0] =&amp;gt; 28&#xA;            [1] =&amp;gt; 26&#xA;        )&#xA;    [sort] =&amp;gt; asc&#xA;    [order] =&amp;gt; name&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to create a link with one of those GET params changed, but I can't find a way to update a single value. So now I'm rebuilding the URL by creating an object based on the given query params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pass this object (as shown above) to the second argument inside Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/functions#url&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;url()&lt;/code&gt;&lt;/a&gt; function to use this URL on a simple &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag, I get an &lt;code&gt;Array to string conversion&lt;/code&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seems Craft can't handle nested arrays in this function. Is there another method to generate an URL from such an object?&lt;/p&gt;&#xA;" OwnerUserId="3937" LastEditorUserId="3937" LastEditDate="2016-05-16T13:58:46.463" LastActivityDate="2016-07-15T23:24:41.703" Title="Pass a nested array to the params argument inside Craft's url() function" Tags="&lt;url&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15043" PostTypeId="1" AcceptedAnswerId="15046" CreationDate="2016-05-16T14:16:47.110" Score="2" ViewCount="562" Body="&lt;p&gt;I want to show entries according to an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set navsubids = craft.amNav.getNavRaw(&quot;hoofdnavigatie&quot;, {startFromId:25})  %}&#xA;            {% set navsubidarray = [] %}&#xA;&#xA;            {% for navsubid in navsubids %}&#xA;                    {% set navsubidarray = navsubidarray|merge([navsubid.elementId]) %}&#xA;            {% endfor %}&#xA;&#xA;            {% set navsubidarray = navsubidarray|join(', ') %}&#xA;&#xA;            {{ navsubidarray }}&amp;lt;br&amp;gt;&#xA;&#xA;            {% for entry in craft.entries.id('{{ navsubidarray }}') %}&#xA;                {{ entry.title }}&amp;lt;br&amp;gt;&#xA;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable gives back that what I need &lt;code&gt;(18, 17, 19, 4, 20, 21, 22, 23)&lt;/code&gt; but the for entry loop isn't returning anything.&lt;/p&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="57" LastEditDate="2016-05-16T18:10:14.567" LastActivityDate="2016-05-17T00:32:24.500" Title="Using a variable with array of ElementIds to use in craft.entries.id" Tags="&lt;variable&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15044" PostTypeId="1" AcceptedAnswerId="15045" CreationDate="2016-05-16T14:27:32.727" Score="3" ViewCount="1127" Body="&lt;p&gt;How would I access a custom product field in the cart. I did it with the &lt;a href=&quot;https://craftcommerce.com/docs/line-item-model#snapshot&quot; rel=&quot;nofollow&quot;&gt;snapshot&lt;/a&gt; attribute like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# cart.html #}&#xA;&#xA;{% for item in cart.lineItems %}&#xA;  {{ craft.commerce.products.id(item.snapshot.product.id).first().myCustomField }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But is that the right way to do it?&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2016-05-16T14:45:53.377" Title="Display custom product field in cart" Tags="&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15045" PostTypeId="2" ParentId="15044" CreationDate="2016-05-16T14:40:45.180" Score="6" Body="&lt;p&gt;You could set a variable to access the products model like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set product = item.purchasable.product %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then access the fields like normal &lt;code&gt;{{ product.myCustomField }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;snapshot&lt;/code&gt; holds the products fields as they were at the time the line item was added to the cart. So depending on how you're using the fields would dictate the method used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also access the snapshot slightly cleaner using &#xA;&lt;code&gt;{{ item.snapshot.product.myCustomField }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-16T14:45:53.377" LastActivityDate="2016-05-16T14:45:53.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15046" PostTypeId="2" ParentId="15043" CreationDate="2016-05-16T14:54:01.733" Score="3" Body="&lt;p&gt;I'm not sure where you're getting the id's from but you will need to pass an array into &lt;code&gt;craft.entries.id&lt;/code&gt; so try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navsubids = craft.amNav.getNavRaw(&quot;hoofdnavigatie&quot;, {startFromId:25})  %}&#xA;&#xA;{% set navsubidarray = [] %}&#xA;&#xA;{% for navsubid in navsubids %}&#xA;  {% set navsubidarray = navsubidarray|merge([navsubid.elementId]) %}&#xA;{% endfor %}&#xA;&#xA;{% for entry in craft.entries.id( navsubidarray ) %}&#xA;  {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you used &lt;code&gt;{% set navsubidarray = navsubidarray|join(', ') %}&lt;/code&gt; you were creating a string of the values in the array.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-16T14:54:01.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15047" PostTypeId="2" ParentId="15038" CreationDate="2016-05-16T15:15:13.710" Score="1" Body="&lt;p&gt;I'd be tempted to create a Structure section with Level 1 being the Sections, Level 2 being the Articles and Level 3 being the Entries. But that would depend on how many sections/article/entries you anticipate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Sections didn't need to be created by the client, I'd consider adding Sections as their own Structure (as in create a new Structure for each Section), though, as that might help the client when they've got a lot of articles.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-05-16T15:15:13.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15048" PostTypeId="1" AcceptedAnswerId="15120" CreationDate="2016-05-16T15:32:18.380" Score="3" ViewCount="308" Body="&lt;p&gt;I am able to listen to an event when the user checks the checkbox in the assets table. This is within my js file init file that extends garnish: Garnish.Base.extend&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the checkbox is selected, I see &quot;checkbox clicked&quot; in the console. The commented out in the function below is just to explain what I need to do when the checkbox is checked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.elements:first').on('click', '.checkbox', function(event) { &#xA;&#xA;    if ($(event.target).is('#main .elements:first .checkbox')) {&#xA;        console.log('checkbox clicked');&#xA;&#xA;        // if file kind == &quot;Image&quot; &#xA;            // hide &quot;View asset&quot; from actions menu in the toolbar&#xA;        // else&#xA;            // do nothing&#xA;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I need to do is, when the user checks the box, I need to determine the file kind, using the data-attr kind, the html for that td cell is below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;td data-title=&quot;File Kind&quot; data-attr=&quot;kind&quot;&amp;gt;Image&amp;lt;/td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it is an image, then hide the &quot;View asset&quot; from the menu dropdown that displays in the toolbar. (image attached)&#xA;&lt;a href=&quot;https://cdn.pbrd.co/images/Y5QEsf5.png&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;https://cdn.pbrd.co/images/Y5QEsf5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The view asset has an id of: View-actiontrigger&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having trouble accessing it as it does not exist when my code is firing on the checkbox click.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="3618" LastEditDate="2016-05-16T15:43:11.280" LastActivityDate="2016-05-19T15:59:55.447" Title="Listen for checkbox check event for assets table and modify action trigger menu item" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;javascript&gt;&lt;garnish&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15049" PostTypeId="1" AcceptedAnswerId="15052" CreationDate="2016-05-16T18:19:33.887" Score="1" ViewCount="53" Body="&lt;p&gt;I have a PHP file in the &lt;code&gt;public_html&lt;/code&gt; titled &lt;code&gt;categories.php&lt;/code&gt; with the following code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;$craft = require '../craft/app/bootstrap.php';     &#xA;$categories = $craft-&amp;gt;categories-&amp;gt;allGroupIds();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Running this script results in the following message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error error&#xA;Craft can’t connect to the database with the credentials in craft/config/db.php.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;craft/config/db.php&lt;/code&gt; file looks like this. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    'live' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; '',&#xA;        'password' =&amp;gt; '',&#xA;        'database' =&amp;gt; '',&#xA;    ),&#xA;    'staging' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'DB_USER',&#xA;        'password' =&amp;gt; 'DB_PASSWORD',&#xA;        'database' =&amp;gt; 'DB_NAME',&#xA;    ),&#xA;    'dev' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'DB_NAME',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not having database trouble anywhere else, only when I try to call any CategoriesService methods. Is there something that I'm failing to understand here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CRAFT_ENVIRONMENT constant was being set in public_html/index.php, so my craft/config/db.php file could not choose the correct database credentials. The issue was resolved by setting the constant to 'dev' in my categories.php file, like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;define('CRAFT_ENVIRONMENT', 'dev');&#xA;$craft = require '../craft/app/bootstrap.php';&#xA;$categories = $craft-&amp;gt;categories-&amp;gt;allGroupIds();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4764" LastEditorUserId="4764" LastEditDate="2016-05-16T22:19:35.897" LastActivityDate="2016-05-16T22:19:35.897" Title="Getting database error when calling CateogoryService method" Tags="&lt;database&gt;&lt;php&gt;&lt;services&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15050" PostTypeId="1" CreationDate="2016-05-16T20:10:18.343" Score="2" ViewCount="417" Body="&lt;p&gt;I'm trying to run some commands on a Jenkins server to have PHPUnit execute the tests and report the results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do &lt;code&gt;require_once 'craft/app/bootstrap.php';&lt;/code&gt; It is giving an error saying: &lt;code&gt;PHP Notice:  Undefined index: SERVER_NAME in craft/app/bootstrap.php on line 105&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that you cannot use bootstrap.php in the craft/app folder because you're essentially trying to bootstrap a webapp (and this server isn't a webserver). It was suggested that I use &lt;code&gt;craft/etc/console/yiic.php&lt;/code&gt; as my bootstrap file for PHPUnit. However, this is throwing errors about CDbConnection and is unable to connect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to bootstrap Craft from a command line to run PHPUnit? I'm unable to get it working without an apache server.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="57" LastEditDate="2016-05-16T22:05:56.057" LastActivityDate="2018-03-15T22:13:23.017" Title="Bootstrapping Craft for PHPUnit on command line" Tags="&lt;php&gt;&lt;bootstrap-craft&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15051" PostTypeId="2" ParentId="15042" CreationDate="2016-05-16T21:57:20.147" Score="1" Body="&lt;p&gt;Yeah, looks like Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/functions#url&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;url()&lt;/code&gt;&lt;/a&gt; method doesn't support nested array syntax for querystring params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still want to use it, then you'd need to flatten it with unique keys such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA;    [q] =&amp;gt; &#xA;    [cat] =&amp;gt; &#xA;    [city0] =&amp;gt; 28&#xA;    [city1] =&amp;gt; 26&#xA;    [sort] =&amp;gt; asc&#xA;    [order] =&amp;gt; name&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively you can manually build the URL yourself in Twig in whatever format you'd like.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-16T21:57:20.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15052" PostTypeId="2" ParentId="15049" CreationDate="2016-05-16T22:00:28.617" Score="0" Body="&lt;p&gt;You don't show how you're defining the &lt;code&gt;'live'&lt;/code&gt;, &lt;code&gt;'staging'&lt;/code&gt; and &lt;code&gt;'dev'&lt;/code&gt; keys for the multi-environment config, but most likely you just need to explicitly set the &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-environment&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;&lt;/a&gt; PHP constant in your &lt;code&gt;categories.php&lt;/code&gt; file to tell Craft which database credentials to choose.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-16T22:00:28.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15053" PostTypeId="2" ParentId="15050" CreationDate="2016-05-16T22:07:58.103" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I read that you cannot use bootstrap.php in the craft/app folder because you're essentially trying to bootstrap a webapp (and this server isn't a webserver).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not sure where you read that, but that doesn't sound right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming you've got a multi-environment config setup?  If so, then manually set the &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-environment&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;&lt;/a&gt; PHP constant before you load the Craft &lt;code&gt;bootstrap.php&lt;/code&gt; file to the environment you want Craft to load in the config files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will get rid of the &lt;code&gt;Undefined index: SERVER_NAME&lt;/code&gt; error you're getting as well as should fixed your database connection issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-05-17T17:08:26.360" LastActivityDate="2016-05-17T17:08:26.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15055" PostTypeId="2" ParentId="15043" CreationDate="2016-05-17T00:32:24.500" Score="3" Body="&lt;p&gt;Luke's answer above is correct, you might as well just use the array directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But technically you can use a joined string as well, it's just your syntax is wrong - you just call the variable directly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.id(navsubidarray) %}&#xA;      {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just add this here in case it's ever useful to someone who for whatever reason wants to use a string of IDs in another scenario.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-17T00:32:24.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15056" PostTypeId="1" CreationDate="2016-05-17T11:05:42.553" Score="3" ViewCount="676" Body="&lt;p&gt;I think I'm almost there with this one but obviously missing something as the postDate is not updating. I have the following in an onSaveEntry event. It's saying it's successful but the postDate does not change. Ideally I want this to update whether the entry is enabled or not.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onSaveEntry(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    // set postDate from assignedDate&#xA;    if($user-&amp;gt;admin) {&#xA;        if($entry-&amp;gt;assignedDate &amp;amp;&amp;amp; $entry-&amp;gt;assignedTimeslot) {&#xA;            $timeslot = $entry-&amp;gt;assignedDate.' '.$entry-&amp;gt;assignedTimeslot.'.000000';&#xA;            $params = $entry-&amp;gt;postDate = $timeslot;&#xA;            $success = craft()-&amp;gt;elements-&amp;gt;saveElement($entry, $params);&#xA;        }&#xA;    }&#xA;    return $event;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-05-19T04:13:14.837" Title="Updating the postDate field from a plugin?" Tags="&lt;plugins&gt;&lt;postdate&gt;&lt;onsaveentry&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15057" PostTypeId="2" ParentId="15056" CreationDate="2016-05-17T13:07:18.703" Score="4" Body="&lt;p&gt;&lt;code&gt;$timeslot&lt;/code&gt; isn't formatted correctly to be used as the postDate. I'd create a field that takes a date and a time and then use &lt;code&gt;DateTimeHelper::formatTimeForDb()&lt;/code&gt; to format for use as &lt;code&gt;postDate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't modify the &lt;code&gt;postDate&lt;/code&gt; until after the entry has been saved - so will need to resave the entry with the newly set &lt;code&gt;postDate&lt;/code&gt;. More info as to why you have to do this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6722/%E2%80%A6&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'entries.onSaveEntry', function( Event $event ){&#xA;&#xA;  // Grab the entry from post request&#xA;  $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;  // Get logged in user&#xA;  $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;  if ( $user &amp;amp;&amp;amp; $user-&amp;gt;admin ) {&#xA;    $timeSlot = $entry-&amp;gt;getContent()-&amp;gt;assignedTimeslot;&#xA;&#xA;    // If the postDate and Timeslot don't match (stops infinite loop)&#xA;    if ( !( $entry-&amp;gt;postDate == $timeSlot ) ) {&#xA;&#xA;        // Set postDate to timeSlot date&#xA;        $entry-&amp;gt;postDate = DateTimeHelper::formatTimeForDb( $timeSlot );&#xA;&#xA;        // Resave entry&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry( $entry );&#xA;    }&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-05-17T17:35:21.643" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15058" PostTypeId="1" AcceptedAnswerId="15060" CreationDate="2016-05-17T13:36:31.037" Score="4" ViewCount="867" Body="&lt;p&gt;Can anyone confirm if I want to pull back a list of all entries regardless of locale I could do something like &lt;code&gt;craft.entries.locale(null)&lt;/code&gt; to get 100% of entries?&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2016-05-17T13:54:00.323" Title="Getting all entries from all locales" Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15059" PostTypeId="2" ParentId="14624" CreationDate="2016-05-17T13:48:43.997" Score="1" Body="&lt;p&gt;I'd say you want to look at the relations &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/relations#the-relatedTo-param&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then use &lt;code&gt;craft.entries.section( 'sectionHandle' ).relatedTo( category )&lt;/code&gt; to grab all entries related to the category you are viewing.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-17T13:48:43.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15060" PostTypeId="2" ParentId="15058" CreationDate="2016-05-17T13:54:00.323" Score="5" Body="&lt;p&gt;In my experience this has been problematic - instead have looped through locales to fetch entries then merged and sorted with supersort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = craft.i18n.getSiteLocales %}   &#xA;&#xA;{% set pages = [] %}    &#xA;&#xA;{% for locale in locales %}&#xA;    {% set entries = craft.entries.locale(locale.id).localeEnabled(false).find() %} &#xA;    {% set pages = pages|merge(entries) %}&#xA;{% endfor %}    &#xA;&#xA;{% set pages = pages|supersort('rsortAs', &quot;{ postDate|date('Ymd') }&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through pages as you would your entries. Am sure there is a more elegant way of doing this but this is what we had to do for our site.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-17T13:54:00.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15061" PostTypeId="1" CreationDate="2016-05-17T13:58:31.220" Score="2" ViewCount="69" Body="&lt;p&gt;I'm trying to auto-post from my blog to Facebook using Buffer and this plugin (&lt;a href=&quot;https://straightupcraft.com/craft-plugins/buffer&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/buffer&lt;/a&gt;). The addon requires me to create a plugin to do the actual posting to Buffer. This is my first foray into plugins at all. I used his example and got something that works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the question I have is somewhat general. How do I pull an asset from an entry that has been saved to be able to post to the plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the relevant portion of the plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$picture = craft()-&amp;gt;request-&amp;gt;getUrl($entry-&amp;gt;blogImage);&#xA;&#xA;craft()-&amp;gt;buffer_utils-&amp;gt;queueBufferUpdate($updateString, true, $link, $picture, $thumbnail);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, my asset field name is &lt;code&gt;blogImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, and let me know if I need to create a new question for this, how does &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; affect scheduled content? Does/will the plugin run when it's actually saved or when it becomes &quot;live&quot;? If so, is there a workaround for that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: I did reach out directly to the developer but have not had any luck yet and was hoping the question was general enough that someone else might be able to help!&lt;/p&gt;&#xA;" OwnerUserId="2209" LastActivityDate="2016-05-17T14:35:58.620" Title="Pulling assets into a plugin" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15062" PostTypeId="1" AcceptedAnswerId="15069" CreationDate="2016-05-17T14:16:26.167" Score="1" ViewCount="372" Body="&lt;p&gt;There are a few tickets touching on this, but the solutions proposed aren't working and I'd like to share the use case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Table of Contents page that is outputting a set of entries based on an Entries field, in the order they appear in that field. When you click on an entry on that page, it loads on its own page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the bottom of the individual entry page, I have Prev/Next URLs, using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set data = craft.entries.section('works').relatedTo(issue.contents).limit(null) %}&#xA;{% set prevEntry = entry.getPrev(data) %}&#xA;{% set nextEntry = entry.getNext(data) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The prev &amp;amp; next entries there, though, are based on a sort in the 'works' section, not the entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this, per &lt;a href=&quot;https://craftcms.com/docs/entries-fields#templating&quot; rel=&quot;nofollow&quot;&gt;the documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries(&#xA;    {&#xA;        relatedTo: { sourceElement: issue, field: &quot;contents&quot; },&#xA;        order:     &quot;sortOrder&quot;,&#xA;        limit:     null&#xA;    }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gives me the following error. How can I sort &lt;code&gt;.relatedTo&lt;/code&gt; entries based on the source field's order?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Integrity constraint violation: 1052 Column 'sortOrder' in order clause is ambiguous. The SQL statement executed was: SELECT `elements`.`id`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;LEFT JOIN `craft_relations` `sources1` ON (sources1.targetId = elements.id)&#xA;LEFT JOIN `craft_matrixblocks` `target_matrixblocks1` ON target_matrixblocks1.id = sources1.sourceId&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE (((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2016-05-17 14:08:35') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2016-05-17 14:08:35')))) AND (elements_i18n.enabled = 1)) AND ((target_matrixblocks1.ownerId=:target_matrixblocks1ownerId1) AND (target_matrixblocks1.fieldId = 15))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `sortOrder`. Bound with :locale='en_us', :target_matrixblocks1ownerId1='6'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="187" LastEditorUserId="9" LastEditDate="2016-05-17T15:36:22.150" LastActivityDate="2016-05-17T15:44:53.977" Title="Ordering relatedTo entries" Tags="&lt;relations&gt;&lt;entries-field&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15063" PostTypeId="1" AcceptedAnswerId="15067" CreationDate="2016-05-17T14:27:15.440" Score="2" ViewCount="520" Body="&lt;p&gt;I have a matrix field which the user can paste YouTube etc. embed code into, which is working fine with YouTube, but SoundCloud embed code causes it to return a page which simply says &quot;Forbidden&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried every combination of plain text, rich text, purify &amp;amp; clean HTML etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trial and error has shown the problematic part of the embed to be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;width=&quot;100%&quot; height=&quot;166&quot;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I can't seem to pin down which part of this is actually the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a few variations to try to see what's going on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following fragments are saved fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%&quot; h  &#xA;w=&quot;100%&quot; h  &#xA;w=&quot;100%&quot; h=  &#xA;w=&quot;100%&quot; h=&quot;  &#xA;&quot;100%&quot; h  &#xA;100% 166  &#xA;width=&quot;100%&quot;  &#xA;width=&quot;100&quot; height=&quot;166&quot;  &#xA;width=100% height=166  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following are not saved and return Forbidden:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;width=&quot;100%&quot; height=&quot;166&quot;  &#xA;w=&quot;100%&quot; h=&quot;166&quot;  &#xA;w=&quot;100%&quot; h=&quot;1  &#xA;100%&quot; h=&quot;1  &#xA;&quot;100%&quot; &quot;166&quot;  &#xA;width=&quot;1%&quot; height=&quot;1&quot;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried pasting the same SoundCloud embed into various other fields across the site, it's fine everywhere else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curious!&lt;/p&gt;&#xA;" OwnerUserId="5149" LastEditorUserId="45" LastEditDate="2016-05-17T17:30:00.527" LastActivityDate="2016-05-17T17:30:00.527" Title="&quot;Forbidden&quot; response when saving entry with HTML code in matrix field" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15064" PostTypeId="2" ParentId="15061" CreationDate="2016-05-17T14:35:58.620" Score="1" Body="&lt;p&gt;To get the URL of an asset in a plugin, you use a similar technique as you do in twig, so this will fetch the URL of the first image in the &lt;code&gt;blogImage&lt;/code&gt; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$picture = $entry-&amp;gt;blogImage-&amp;gt;first()-&amp;gt;url;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To answer you second question, &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; is run just before the entry is actually saved, not just before it is published live on the site if it has been saved with a post date in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't fire any events just before an entry becomes 'live' on the site, so if you want the post to Buffer to go out at the same time as the entry goes live using this technique, you will need to actually create and save the entry when you want to publish it live on your site.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-05-17T14:35:58.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15065" PostTypeId="1" AcceptedAnswerId="15068" CreationDate="2016-05-17T15:21:52.507" Score="2" ViewCount="163" Body="&lt;p&gt;How can i check if ANY users exist in a particular User Group? I know how to check the current user but not ALL users.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-05-17T15:37:32.067" Title="How to Check All Users against UserGroup" Tags="&lt;users&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15066" PostTypeId="1" AcceptedAnswerId="15071" CreationDate="2016-05-17T15:33:39.003" Score="1" ViewCount="246" Body="&lt;p&gt;When viewing the charts in the entries template of the SproutForms plugin, I receive an &quot;an unknown error occurred&quot; error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the console, I see this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failed to load resource: the server responded with a status of 500 (Internal Server Error): &lt;a href=&quot;https://domain.com/index.php?p=admin/actions/sproutForms/charts/getEntriesData&quot; rel=&quot;nofollow&quot;&gt;https://domain.com/index.php?p=admin/actions/sproutForms/charts/getEntriesData&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clue what's going on here?&lt;/p&gt;&#xA;" OwnerUserId="5150" LastActivityDate="2017-04-12T07:42:15.983" Title="SproutForms: &quot;an unknown error occurred&quot; in entries template chart" Tags="&lt;plugins&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15067" PostTypeId="2" ParentId="15063" CreationDate="2016-05-17T15:33:47.163" Score="4" Body="&lt;p&gt;There are a couple possible explanations for this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You have Suhosin installed, a PHP extension that enhances security by placing some pretty drastic restrictions on what data can be sent to the server. To find out, visit /admin/utils/phpinfo and search the page for &quot;suhosin&quot;. If you see any references to it, you have it installed. Ask your host to uninstall it, or possibly just configure it to be allow this specific use case (and expect to have similar requests in the future).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your server (Apache or nginx) may be configured to deny traffic to the request URI. Check your server logs for recent forbidden/403 activity.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-05-17T15:50:06.807" LastActivityDate="2016-05-17T15:50:06.807" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15068" PostTypeId="2" ParentId="15065" CreationDate="2016-05-17T15:37:32.067" Score="3" Body="&lt;p&gt;Got it all sorted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.users.group('myusergroup').total() &amp;gt; 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-05-17T15:37:32.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15069" PostTypeId="2" ParentId="15062" CreationDate="2016-05-17T15:44:53.977" Score="1" Body="&lt;p&gt;First you’ll need to get the Table Of Contents entry that holds the Entries field (the &lt;strong&gt;source entry&lt;/strong&gt;). I’m going to assume that is in a Single section with the handle &lt;code&gt;toc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set toc = craft.entries.section('toc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have that, you can just pass its Entries field value into getPrev() and getNext():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = entry.getPrev(toc.myEntriesField) %}&#xA;{% set nextEntry = entry.getNext(toc.myEntriesField) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-05-17T15:44:53.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15070" PostTypeId="1" CreationDate="2016-05-17T16:21:27.987" Score="1" ViewCount="1224" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2502/php-warning-var-export-does-not-handle-circular-references-when-devmode-tru&quot;&gt;Here is a similar question that was asked but doesn't resolve my issue&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question has changed, see UPDATE below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new here so I couldn't just tag a comment onto this post asking this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran into a similar issue, the suggested fix does not work even with the config setting &lt;code&gt;'logDumpMethod' =&amp;gt; 'print_r'&lt;/code&gt;, as well as directly editing the CLogFilter.php file&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm relatively knew to PHP, general web design, or any sort of CMS, and Have only been using Craft for about a month now so bare with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last change I was completing was editing the guestEntries plugin to store session data using &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;add($key, $value)&lt;/code&gt; in the guestEntries plugin's controller. The problem persists with or without this addition. Granted that addition is probably not something I needed to try, however now I'm locked out of devmode because I get the same error as mentioned in the title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully it's not something painfully obvious that I'm missing here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, question is related to the error I receive as mentioned in the title and NOT how I should store session data or best practices (I will learn that in due time elsewhere.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller along with the single line of editing I made:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _returnSuccess($entry, $faked = false)&#xA;{&#xA;    $successEvent = new GuestEntriesEvent($this, array('entry' =&amp;gt; $entry, 'faked' =&amp;gt; $faked));&#xA;    craft()-&amp;gt;guestEntries-&amp;gt;onSuccess($successEvent);&#xA;&#xA;    if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest())&#xA;    {&#xA;        $return['success']   = true;&#xA;        $return['title']     = $entry-&amp;gt;title;&#xA;        $return['cpEditUrl'] = $entry-&amp;gt;getCpEditUrl();&#xA;        $return['author']    = $entry-&amp;gt;getAuthor()-&amp;gt;getAttributes();&#xA;        $return['postDate']  = ($entry-&amp;gt;postDate ? $entry-&amp;gt;postDate-&amp;gt;localeDate() : null);&#xA;&#xA;        $this-&amp;gt;returnJson($return);&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Entry saved.'));&#xA;&#xA;        // TODO: Remove for 2.0&#xA;        if (isset($_POST['redirect']) &amp;amp;&amp;amp; mb_strpos($_POST['redirect'], '{entryId}') !== false)&#xA;        {&#xA;            Craft::log('The {entryId} token within the ‘redirect’ param on entries/saveEntry requests has been deprecated. Use {id} instead.', LogLevel::Warning);&#xA;            $_POST['redirect'] = str_replace('{entryId}', '{id}', $_POST['redirect']);&#xA;        }&#xA;        craft()-&amp;gt;httpSession-&amp;gt;add('entry', $entry)//&amp;lt;--the only line I added&#xA;        $this-&amp;gt;redirectToPostedUrl($entry);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Gave it another go of directly editing the CLogFilter.php by replacing &lt;code&gt;public $dumper='print_r';&lt;/code&gt; AND changed the config file &lt;code&gt;'logDumpMethod' =&amp;gt; 'print_r'&lt;/code&gt; and that worked... Why? Should I not be able to just change it in the config file?&lt;/p&gt;&#xA;" OwnerUserId="5120" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-05-17T16:29:32.073" Title="var_export does not handle circular references” when devMode = true and logDumpMethod = print_r" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;error&gt;&lt;controller&gt;&lt;plugin-guestentries&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15071" PostTypeId="2" ParentId="15066" CreationDate="2016-05-17T16:57:41.907" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: This issue has been fixed in Sprout Forms v2.3.0, which also added Entry Status workflows and support for front-end Entries, Categories, and Tags relations fields ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue you’re running into with the Sprout Forms chart is due to your PHP version.  We have it on our list and it should be fixed in the next release.  Until we get that release, the way to fix the issue is to upgrade your PHP version to something higher than PHP 5.4&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-05-26T23:35:07.313" LastActivityDate="2016-05-26T23:35:07.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15072" PostTypeId="2" ParentId="15063" CreationDate="2016-05-17T17:18:50.287" Score="4" Body="&lt;p&gt;I contacted the host and they found that it was mod_security, and disabled the rule that was causing this.&lt;/p&gt;&#xA;" OwnerUserId="5149" LastActivityDate="2016-05-17T17:18:50.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15073" PostTypeId="1" CreationDate="2016-05-17T18:01:25.560" Score="2" ViewCount="1475" Body="&lt;p&gt;For whatever reason &lt;code&gt;https://domain.com/index.php?p=path/to/whatever&lt;/code&gt; and &lt;code&gt;https://domain.com/index.php/to/whatever&lt;/code&gt; both still work and are not being redirected or rewritten to &lt;code&gt;https://domain.com/path/to/whatever/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are enabling these in our CraftCMS configuration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&#xA;'usePathInfo' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But they have not rectified the issue. Does anyone have a solution to this? Here are the important parts of our current &lt;code&gt;Nginx.conf&lt;/code&gt;. I appreciate any help I can get on this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~ /.well-known {&#xA;    allow all;&#xA;}&#xA;&#xA;location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;}&#xA;&#xA;location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;}&#xA;&#xA;location = /favicon.ico { access_log off; log_not_found off; }&#xA;location = /robots.txt  { access_log off; log_not_found off; }&#xA;&#xA;error_log  /var/log/nginx/error_craft_https.log error;&#xA;&#xA;error_page 404 /index.php;&#xA;&#xA;location ~ \.php$ {&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/var/run/php-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi.conf;&#xA;    include fastcgi_params;&#xA;}&#xA;&#xA;location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {&#xA;    deny all;&#xA;}&#xA;&#xA;location ~* \.(?:manifest|appcache|html?|json|xml)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires -1;&#xA;    access_log /var/log/nginx/access.log;&#xA;}&#xA;&#xA;location ~* \.(?:rss|atom)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1h;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|h$&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1M;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;location ~* \.(?:css|js)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1y;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;location ~* \.(?:ttf|ttc|otf|eot|woff)$ {&#xA;    try_files $uri /index.php?$query_string;&#xA;    expires 1M;&#xA;    add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5150" LastEditorUserId="5150" LastEditDate="2016-05-18T16:38:24.900" LastActivityDate="2018-08-16T22:51:33.983" Title="Nginx: index.php URLs still being served alongside pretty URLs" Tags="&lt;url&gt;&lt;redirect&gt;&lt;nginx&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15074" PostTypeId="1" AcceptedAnswerId="15077" CreationDate="2016-05-17T19:20:40.903" Score="1" ViewCount="220" Body="&lt;p&gt;&lt;code&gt;issue&lt;/code&gt; is an entry that has a matrix field named &lt;code&gt;contents&lt;/code&gt;, whose blocks have an entries field named &lt;code&gt;works&lt;/code&gt;, and the related &lt;code&gt;works&lt;/code&gt; channel has an entries field named &lt;code&gt;authorPeople&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue 1's &lt;code&gt;contents&lt;/code&gt; consists of 2 blocks: A 'regular' section and an 'alumni' section. On the cover page, I loop through the blocks. For each block, I get the entries related to their authors, so that I'm outputting entries sorted by author last name, where some authors have more than one entry associated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contributors = craft.entries({&#xA;    section: 'contributors',&#xA;    relatedTo: { sourceElement: block.works, field: &quot;authorPeople&quot; }&#xA;}) %}&#xA;&#xA;{% set articles = craft.entries({&#xA;    section: 'works',&#xA;    relatedTo: contributors&#xA;    order: 'lastName'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works fine, because I've got access to &lt;code&gt;block.works&lt;/code&gt;. Any optimization tips are welcome :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the individual entry page, I want to &lt;code&gt;getPrev&lt;/code&gt; and &lt;code&gt;getNext&lt;/code&gt; entries spanning both blocks. So if you're at the last entry in the 'regular' section, your next link is the first entry in the 'alumni' section. And if you're on the first entry in the 'alumni' section, your prev link is the last entry in the 'regular' section. The last entry in the last section won't return a next link, so I can code in a link to another page, and the first entry in the first section won't return a previous link, so I can code in a link to the cover page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without having to loop through the blocks, how can I get that? Trying to order by &lt;code&gt;issue.contents&lt;/code&gt; doesn't seem to work.&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="187" LastEditDate="2016-05-17T20:33:07.757" LastActivityDate="2016-05-17T20:52:12.443" Title="Sorting across blocks (to get prev/next links)" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;ordering&gt;&lt;sorting&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15076" PostTypeId="1" AcceptedAnswerId="15078" CreationDate="2016-05-17T20:19:06.883" Score="1" ViewCount="152" Body="&lt;p&gt;When the entry is disabled, the Live Preview only shows things which are outer of the main loop. This is a part of my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;header.html&quot; %}&#xA;{% for entry in craft.entries.section('flashback') %}&#xA;    &amp;lt;section id=&quot;intro&quot; style=&quot;background-image: url('{{ entry.heroImage.first().getUrl() }}');&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;Flashback&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;...&#xA;{% endfor %}&#xA;{% include 'footer.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;header&lt;/code&gt; and the &lt;code&gt;footer&lt;/code&gt; are visible but the &lt;code&gt;section&lt;/code&gt; and &lt;code&gt;headline&lt;/code&gt; not.&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="3513" LastEditDate="2016-05-17T21:02:46.040" LastActivityDate="2016-05-17T21:05:10.257" Title="Live Preview error when entry is disabled" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15077" PostTypeId="2" ParentId="15074" CreationDate="2016-05-17T20:52:12.443" Score="3" Body="&lt;p&gt;You can get all of the &lt;code&gt;works&lt;/code&gt; entries related to your &lt;code&gt;contents&lt;/code&gt; Matrix field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set works = craft.entries({&#xA;    relatedTo: { sourceElement: issue, field: 'contents.works' }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They will most likely be out of order though. We can control that with the &lt;code&gt;order&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable Dev Mode and look at the resulting SQL query in your browser console, you will see these two tables getting joined into it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;LEFT JOIN `craft_relations` `sources1` ON (sources1.targetId = elements.id)&#xA;LEFT JOIN `craft_matrixblocks` `target_matrixblocks1` ON target_matrixblocks1.id = sources1.sourceId&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we can pass in an &lt;code&gt;order&lt;/code&gt; param that tells MySQL to order the entries by the block order first and their relation order second:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set works = craft.entries({&#xA;    relatedTo: { sourceElement: issue, field: 'contents.works' },&#xA;    order: 'target_matrixblocks1.sortOrder, sources1.sortOrder'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you’ve got all of the Works entries in the proper order, and you can pass them into getPrev() and getNext():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntry = entry.getPrev(works) %}&#xA;{% set nextEntry = entry.getNext(works) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-05-17T20:52:12.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15078" PostTypeId="2" ParentId="15076" CreationDate="2016-05-17T21:05:10.257" Score="3" Body="&lt;p&gt;Change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('flashback') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('flashback').status(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 2nd one will grab all entries regardless of their enabled/disabled status.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-17T21:05:10.257" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15079" PostTypeId="1" AcceptedAnswerId="15080" CreationDate="2016-05-17T22:17:21.210" Score="3" ViewCount="73" Body="&lt;p&gt;I have a Craft Plugin that is a &lt;a href=&quot;https://github.com/JamesMcFall/WatchTower-CraftCMS&quot; rel=&quot;nofollow&quot;&gt;logging library&lt;/a&gt; I want to use in other plugins I develop, but I don't want it to be a dependancy in these other plugins. Is there a nice, space efficient way in Craft to do something like below? I don't want to have to wrap every call in an if statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# If WatchTower isn't installed... don't explode please!!!&#xA;@craft()-&amp;gt;watchTowerDB-&amp;gt;log($params)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My plugin seems to stop processing and redirect to the current page if it isn't installed. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="22" LastEditDate="2017-05-09T22:00:03.977" LastActivityDate="2017-05-09T22:00:03.977" Title="Safely calling other plugin code from a different plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15080" PostTypeId="2" ParentId="15079" CreationDate="2016-05-17T22:35:44.693" Score="3" Body="&lt;p&gt;You could write a wrapper log method that's abstracts the check away so you only have to do it once.  The update your code to use the wrapper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That method could just use &lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle')&lt;/code&gt; to see if the target plugin is installed and enabled.  Craft will auto-load the plugin's services, so you don't need to check specifically for them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-17T22:35:44.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15081" PostTypeId="1" CreationDate="2016-05-18T01:13:36.603" Score="1" ViewCount="47" Body="&lt;p&gt;You know, the one that gangs blocks together but never really gets explained in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hate that thing. I hate it because double-clicking (or single clicking) anywhere in a Matrix block header toggles the check. And wouldn't one rather collapse/expand a block by double-clicking than by pulling down that menu?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be hidden with CSS (with consequences) but I am wondering if there is something I am missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to restrict its behavior to just the far-left checkbox/label area. I think it's a UI mistake to make the entire header the active checkbox area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anything be done to suppress or limit the clickable area of the checkbox in a Matrix block header? (or &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow&quot;&gt;Neo&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2016-05-19T04:22:44.750" Title="Can anything be done to suppress or limit the clickable area of the checkbox in a Matrix block header?" Tags="&lt;matrix&gt;&lt;control-panel&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15082" PostTypeId="1" AcceptedAnswerId="15557" CreationDate="2016-05-18T01:43:45.997" Score="1" ViewCount="94" Body="&lt;p&gt;I'm trying to extract an attribute from a top level XML node but having some difficulty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given some XML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&#xA;&amp;lt;slots&amp;gt;&#xA;  &amp;lt;slot start=&quot;Monday&quot; finish=&quot;Tuesday&quot;&amp;gt;&#xA;    &amp;lt;title id=&quot;1234&quot;&amp;gt;John&amp;lt;/title&amp;gt;&#xA;  &amp;lt;/slot&amp;gt;&#xA;  &amp;lt;slot start=&quot;Thursday&quot; finish=&quot;Friday&quot;&amp;gt;&#xA;    &amp;lt;title id=&quot;5678&quot;&amp;gt;Fred&amp;lt;/title&amp;gt;&#xA;  &amp;lt;/slot&amp;gt;&#xA;&amp;lt;/slots&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and some Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;        url: 'http://above.xml',&#xA;        type: 'xml',&#xA;} %}&#xA;{% set feed = craft.feedme.feed(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can extract values and attributes from the inner nodes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{feed.slots.slot.0.title.attributes.id}}&#xA;{{feed.slots.slot.0.title}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which yields &lt;code&gt;1234 John&lt;/code&gt; as I would expect. But now, how do I get the attributes from the slot node e.g. I want the 'Monday'. I've tried something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{feed.slots.slot.0.attributes.start}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that just throws an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; If I change the XML (remove the inner title nodes) to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&#xA;&amp;lt;slots&amp;gt;&#xA;  &amp;lt;slot start=&quot;Monday&quot; finish=&quot;Tuesday&quot;&amp;gt;&#xA;  &amp;lt;/slot&amp;gt;&#xA;  &amp;lt;slot start=&quot;Thursday&quot; finish=&quot;Friday&quot;&amp;gt;&#xA;  &amp;lt;/slot&amp;gt;&#xA;&amp;lt;/slots&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{feed.slots.slot.0.attributes.start}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;works. So maybe the question now is how do I extract attributes from a node that has sub-nodes?&lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="695" LastEditDate="2016-05-18T03:45:53.100" LastActivityDate="2016-06-19T00:43:16.757" Title="Extracting an attribute from top level node of a Feedme XML feed using template" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15085" PostTypeId="1" CreationDate="2016-05-18T08:51:37.790" Score="2" ViewCount="248" Body="&lt;p&gt;I would like to be able to save multiple records at once. What is the best way of doing this? I can of course iterate over my records and use the save function for each one. However, this is not very good for performance. The other option I can think of is to create my own database query using the insertAll command. This would be better for performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any built in function to batch save multiple records at once or is the insertAll alternative the way to go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time. &lt;/p&gt;&#xA;" OwnerUserId="4049" LastActivityDate="2016-05-18T09:14:38.453" Title="Save multiple records at once" Tags="&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15086" PostTypeId="2" ParentId="15085" CreationDate="2016-05-18T09:14:38.453" Score="2" Body="&lt;p&gt;You could use a task within your plugin for better performance when looping through your records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the &lt;a href=&quot;https://craftcms.com/classreference/services/TasksService&quot; rel=&quot;nofollow&quot;&gt;TasksService&lt;/a&gt; docs and also &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap/&quot; rel=&quot;nofollow&quot;&gt;PowerNap&lt;/a&gt;, an example plugin that uses a task. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-18T09:14:38.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15087" PostTypeId="2" ParentId="15056" CreationDate="2016-05-18T09:57:19.637" Score="2" Body="&lt;p&gt;Thanks to @LukePearce I managed to re-write the code to work as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'entries.onSaveEntry', function( Event $event ){&#xA;&#xA;  // Grab the entry from post request&#xA;  $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;  // Get logged in user&#xA;  $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;  // Set the timeslot&#xA;  $timeSlot = $entry-&amp;gt;getContent()-&amp;gt;assignedDate.' '.$entry-&amp;gt;getContent()-&amp;gt;assignedTimeslot;&#xA;&#xA;  // Create a new dateTime object from timeslot&#xA;  $postDate = new \DateTime($timeSlot);&#xA;&#xA;  // Check the postDate has changed&#xA;  if ($entry-&amp;gt;postDate != $postDate) {&#xA;&#xA;    // check user is set and is admin&#xA;    if ($user &amp;amp;&amp;amp; $user-&amp;gt;admin) {&#xA;&#xA;      // Set entry postDate to new postDate&#xA;      $entry-&amp;gt;postDate = $postDate;&#xA;&#xA;      // Resave entry&#xA;      $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    }&#xA;   }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-05-18T09:57:19.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15088" PostTypeId="2" ParentId="566" CreationDate="2016-05-18T10:16:23.993" Score="2" Body="&lt;p&gt;You can add a filter to twig (&lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#filters&quot; rel=&quot;nofollow&quot;&gt;adding filters&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And make it sound like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$filter = new Twig_SimpleFilter('roundIf', function ($val) {&#xA;    return number_format($val, (int)$val == $val ? 0 : 2, ',', ' ');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use it in your code like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.width | roundIf }} {{ item.height | roudIf }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5152" LastActivityDate="2016-05-18T10:16:23.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15089" PostTypeId="1" CreationDate="2016-05-18T12:11:33.037" Score="0" ViewCount="800" Body="&lt;p&gt;I have a User entries field called 'company'.&#xA;I'm writing a bespoke plugin to manage users in the front-end and was wondering how I can access the content of this field in my plugin via the user model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts as struggling a wee bit here!  &lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-18T12:49:41.347" Title="Accessing custom fields from User Model" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;entries-field&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15090" PostTypeId="2" ParentId="15089" CreationDate="2016-05-18T12:49:41.347" Score="3" Body="&lt;p&gt;Response via Slack from Brandon Kelly:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Accessing custom field values from PHP is the same as in Twig - once you have the UserModel it's just &lt;code&gt;$user-&amp;gt;myCustomFieldHandle&lt;/code&gt;&#xA;  or &lt;code&gt;$user-&amp;gt;myEntriesField-&amp;gt;first()&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Managed to get via following: &lt;code&gt;$user-&amp;gt;company-&amp;gt;first()-&amp;gt;title&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-05-18T12:49:41.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15091" PostTypeId="1" CreationDate="2016-05-18T12:53:56.403" Score="1" ViewCount="772" Body="&lt;p&gt;I am relatively new to Craft CMS and have been using the formBuilder2 plugin to create forms. No problem this far. I have been able to use ElementApi to output the forms into Json. Still no problem.&#xA;My issue starts when I have to add validation to my form fields. I have read the &quot;The Definitive Guide to Craft Validation for Plugin Developers (The Book)&quot; and I am still very much confused as to how I actually implement validation on specific field in my form. In a nutshell, how can I add a email validator to an field that I named email. Also, how do I implement this to the fieldset if all I have to go with is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set fields = tab.getFields() %}&#xA;        &amp;lt;fieldset class=&quot;{{ tab.name |lower|replace(' ', '-') }}&quot;&amp;gt;&#xA;            &amp;lt;legend&amp;gt;{{ tab.name }}&amp;lt;/legend&amp;gt;&#xA;            {% for field in fields %}&#xA;            {% set input = craft.formBuilder2.getInputHtml(field) %}&#xA;            {{ input | raw }}&#xA;            {% endfor %}&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not to sound silly but why, why, why why????&#xA;Please can someone help me....&lt;/p&gt;&#xA;" OwnerUserId="5154" LastEditorUserId="125" LastEditDate="2016-05-19T05:08:24.593" LastActivityDate="2016-05-19T05:08:24.593" Title="Form field validation" Tags="&lt;field&gt;&lt;custom-fieldtype&gt;&lt;validation&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15092" PostTypeId="1" AcceptedAnswerId="15093" CreationDate="2016-05-18T13:30:31.343" Score="0" ViewCount="897" Body="&lt;p&gt;I'm currently on the latest version of Craft (2.6.2785). When I edit Redactor content I have no issues, but if I enter HTML mode and exit it I end up with &lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt; prepended to the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a GIF of this issue.&#xA;&lt;img src=&quot;https://cl.ly/021k1n1Q1n1d/Screen%20Recording%202016-05-18%20at%2009.26%20AM.gif&quot; alt=&quot;Redactor issue with paragraph and br tags&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I updated from version 2.5.2767 and that version does not have this bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it helps, here's the JSON config for the Redactor field I'm referring to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;buttons&quot;: [&quot;html&quot;, &quot;formatting&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;unorderedlist&quot;, &quot;orderedlist&quot;, &quot;link&quot;, &quot;file&quot;, &quot;image&quot;, &quot;video&quot;],&#xA;  &quot;plugins&quot;: [&quot;fullscreen&quot;, &quot;video&quot;, &quot;table&quot;],&#xA;  &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="712" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:49.807" LastActivityDate="2016-05-18T13:36:16.920" Title="Redactor adding extra paragraph and br tag when entering and exiting HTML source mode" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2016-05-18T18:02:26.540" ContentLicense="CC BY-SA 3.0" />
  <row Id="15093" PostTypeId="2" ParentId="15092" CreationDate="2016-05-18T13:36:16.920" Score="0" Body="&lt;p&gt;This appears to be an issue with Redactor itself. Their example allowing you to edit the &lt;a href=&quot;https://imperavi.com/redactor/examples/source&quot; rel=&quot;nofollow&quot;&gt;source code of a field has the same bug&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2016-05-18T13:36:16.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15095" PostTypeId="1" CreationDate="2016-05-18T16:40:52.587" Score="1" ViewCount="81" Body="&lt;p&gt;I have my local dev setting up using MAMP on port 8888&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  'mydomain.dev:8888' =&amp;gt; array(&#xA;    // ...&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '/Users/mypath/SiteCode/mydomain/dev/',&#xA;        'baseUrl'  =&amp;gt; '//mydomain.dev:8888/',&#xA;        'logDumpMethod' =&amp;gt; 'print_r'&#xA;    ),&#xA;    'logDumpMethod' =&amp;gt; 'print_r',&#xA;    'devMode' =&amp;gt; true,&#xA;    'useCompressedJs' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt;  'http://mydomain.dev:8888/en/',&#xA;        'ar' =&amp;gt;  'http://mydomain.dev:8888/ar/',&#xA;        'zh' =&amp;gt;  'http://mydomain.dev:8888/zh/',&#xA;        'fil' =&amp;gt; 'http://mydomain.dev:8888/fil/',&#xA;        'fr' =&amp;gt;  'http://mydomain.dev:8888/fr/',&#xA;        'hi' =&amp;gt;  'http://mydomain.dev:8888/hi/',&#xA;        'id' =&amp;gt;  'http://mydomain.dev:8888/id/',&#xA;        'ru' =&amp;gt;  'http://mydomain.dev:8888/ru/',&#xA;        'es' =&amp;gt;  'http://mydomain.dev:8888/es/',&#xA;        'tr' =&amp;gt;  'http://mydomain.dev:8888/tr/',&#xA;        'uk' =&amp;gt;  'http://mydomain.dev:8888/uk/',&#xA;        'ur' =&amp;gt;  'http://mydomain.dev:8888/ur/'&#xA;    ),&#xA;&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the admin general settings I am using &lt;code&gt;{siteUrl}&lt;/code&gt; for siteUrl settings. This gets read from the local dev config array as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the admin link on the site in the control panel top left gets the url wrong. &#xA;Instead of &lt;code&gt;http://mydomain.dev:8888&lt;/code&gt; it shows&#xA;&lt;code&gt;http://mydomain.dev:8888/admin/%7BsiteUrl%7D/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have other local craft sites setup with port number 8888 O.K. The only difference here is that the &lt;code&gt;siteUrl&lt;/code&gt; is specified in a multilingual array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-05-18T19:25:17.770" LastActivityDate="2016-05-18T19:27:44.557" Title="Multilingual MAMP port number siteUrl issue" Tags="&lt;localization&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15096" PostTypeId="1" AcceptedAnswerId="15123" CreationDate="2016-05-18T17:14:52.593" Score="3" ViewCount="698" Body="&lt;p&gt;Is it possible to have separate variant option fields on a front end add to cart form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example… have a separate select field for &lt;strong&gt;Color&lt;/strong&gt; and a separate select field for &lt;strong&gt;Size&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5157" LastActivityDate="2017-05-17T03:47:02.850" Title="Is it possible to separate variant options on a front end add to cart form?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15097" PostTypeId="1" CreationDate="2016-05-18T17:21:52.210" Score="1" ViewCount="262" Body="&lt;p&gt;I have the following situation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A section called &quot;membership&quot; and a section called &quot;member&quot;.&lt;br&gt;&#xA;Within the &quot;member&quot; section I can choose one or more memberships.&lt;br&gt;&#xA;Now I'd like to display all memberships with the reverse related members. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output would look something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;membership 1&#xA;    member 1, member 2, member 3&#xA;&#xA;membership 2&#xA;    member 2, member 4&#xA;&#xA;membership 3&#xA;    member 1, member 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code, but it's very slow: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &#xA;&#xA;    Get all membership entries &#xA;&#xA;#}&#xA;{% set entries = craft.entries({&#xA;    section: 'membership',&#xA;    order: 'cf_membershipShorthand',&#xA;}) %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;h2&amp;gt;&amp;lt;a class=&quot;external&quot; href=&quot;{{ entry.cf_membershipLink }}&quot;&amp;gt;{% if entry.cf_membershipShorthand %}{{ entry.cf_membershipShorthand }} – {% endif %}{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    {# &#xA;&#xA;        Get the related members entries&#xA;&#xA;    #}&#xA;    {% set members = craft.entries({&#xA;            section: 'member',&#xA;            relatedTo: entry,&#xA;        })&#xA;    %}&#xA;    {% if members|length %}&#xA;        {% for member in members %}&#xA;            {% set image = member.cf_ma_asset[0] ?? null %}&#xA;            {% if image|length %}&#xA;                {% set imageParams = { width: 30, height: 30 } %}&#xA;                &amp;lt;figure class=&quot;mini_portrait&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ member.getUrl() }}&quot; title=&quot;{{ member.title }}&quot;&amp;gt;&amp;lt;img class=&quot;mini_portrait_image&quot; src=&quot;{{ image.getUrl(imageParams) }}&quot; alt=&quot;Portrait {{ image.title }}&quot;&amp;gt;&amp;lt;/img&amp;gt;&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/figure&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I even tried to eager load the related members entries, but, to my surprise, that even added queries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must be on the wrong path. Could anyone enlighten me? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update to my question: &#xA;I know how to eager load the related entries: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set member = craft.entries({&#xA;        section: 'member',&#xA;        relatedTo: entry,&#xA;        with: [&#xA;            ['cf_ma_asset', { withTransforms: [{ width: 30, height: 30 }] }],&#xA;        ]&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To my surprise that adds queries, but is much faster... &lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="367" LastEditDate="2016-05-25T10:51:33.217" LastActivityDate="2016-05-25T10:51:33.217" Title="How to optimize nested reverse relations?" Tags="&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15098" PostTypeId="2" ParentId="15095" CreationDate="2016-05-18T19:27:44.557" Score="2" Body="&lt;p&gt;Pretty sure the issue is that a port number won't work as part of the key in a multi-environment config.  Because unless you explicitly set &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-environment&quot; rel=&quot;nofollow&quot;&gt;CRAFT_ENVIRONMENT&lt;/a&gt; to use it, Craft is just going to use &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt;, which doesn't include the &lt;code&gt;:port&lt;/code&gt; (that's at &lt;code&gt;$_SERVER['SERVER_PORT']&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's another thread &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1356/multi-environment-configs-and-running-sites-on-different-ports&quot;&gt;here&lt;/a&gt; with some solutions/workarounds.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-18T19:27:44.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15099" PostTypeId="1" CreationDate="2016-05-18T20:53:30.087" Score="1" ViewCount="154" Body="&lt;p&gt;Can the backend entry form be adjusted by a template. It's not a very compressed view.&#xA;&lt;a href=&quot;https://i.imgur.com/vcP1Lgm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;See this image&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LUZPa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LUZPa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would look a lot better if I can add some float:left; to parts.&#xA;&lt;a href=&quot;https://i.imgur.com/5uWXOIE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;See this image&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MxBTR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MxBTR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3583" LastActivityDate="2016-05-18T21:08:44.367" Title="Template backend entry form" Tags="&lt;templating&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15100" PostTypeId="2" ParentId="15099" CreationDate="2016-05-18T21:08:44.367" Score="2" Body="&lt;p&gt;You can use CP CSS to accomplish that...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-18T21:08:44.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15101" PostTypeId="2" ParentId="15056" CreationDate="2016-05-19T04:13:14.837" Score="2" Body="&lt;p&gt;I have written a plugin for this exact use case. You can configure what time is set as the postDate or expiryDate via a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow&quot;&gt;https://github.com/carlcs/craft-autoexpire&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-19T04:13:14.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15102" PostTypeId="2" ParentId="15081" CreationDate="2016-05-19T04:22:44.750" Score="1" Body="&lt;p&gt;Not really an answer, but have you considered posting a feature request on the feedback site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-19T04:22:44.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15103" PostTypeId="2" ParentId="15091" CreationDate="2016-05-19T05:06:58.900" Score="1" Body="&lt;p&gt;The controller you're posting to is responsible for the validation. In the case of the &lt;code&gt;entries/saveEntry&lt;/code&gt; controller for example there's an Entry model populated and then run through the validation. Each model attribute and all the fields (content) have to give their ok for the complete model to validate correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the fields it's the field type's attribute type and an optional &lt;code&gt;validate&lt;/code&gt; method that are responsible. Have a look at this plugin by Marion Newlevant, it provides a simple field type with configurable validation and is probably a good example for what you're trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-mn_matchinput&quot; rel=&quot;nofollow&quot;&gt;https://github.com/marionnewlevant/craft-mn_matchinput&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-19T05:06:58.900" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15104" PostTypeId="1" AcceptedAnswerId="17348" CreationDate="2016-05-19T08:29:18.917" Score="2" ViewCount="74" Body="&lt;p&gt;After logging in to the Craft admin area I sometimes(!) get routed to &lt;code&gt;/admin/undefined&lt;/code&gt; instead of &lt;code&gt;/admin/dashboard&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone knows were to start looking to solve this issue?&lt;/p&gt;&#xA;" OwnerUserId="5161" LastEditorUserId="57" LastEditDate="2016-05-19T18:52:19.317" LastActivityDate="2016-10-19T19:34:18.133" Title="Sometimes getting sent to /admin/undefined after login" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15105" PostTypeId="1" CreationDate="2016-05-19T08:30:14.110" Score="1" ViewCount="189" Body="&lt;p&gt;I want to build a social platform using Craft. The application will be built, hosted and managed by me. Will I need to upgrade the Craft license to Client or Pro before launching the website, or can I run it with Craft Personal ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5162" LastEditorUserId="45" LastEditDate="2016-08-13T02:39:46.027" LastActivityDate="2016-08-13T02:39:46.027" Title="Craft CMS License" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15106" PostTypeId="2" ParentId="15105" CreationDate="2016-05-19T08:48:43.367" Score="3" Body="&lt;p&gt;You won't be able to test the creation of user accounts without upgrading to Craft Pro. However, in development, you can run Craft Pro as a trial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://craftcms.com/pricing&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/pricing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way I can try Craft Client or Pro out before buying?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Yes. As long as you’re running Craft CMS from a non-public-looking&#xA;  domain name (e.g. “mysite.dev” or “staging.mysite.com”), you will have&#xA;  the option to test the Client and Pro editions indefinitely.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-19T08:48:43.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15107" PostTypeId="1" AcceptedAnswerId="15113" CreationDate="2016-05-19T09:07:12.830" Score="1" ViewCount="257" Body="&lt;p&gt;I know &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8271/apply-transform-to-image-uploaded-into-redactor&quot;&gt;this essentially does the trick&lt;/a&gt;, however I was hoping I could apply a custom transform to all image assets if one &lt;strong&gt;hasn't&lt;/strong&gt; been defined by the user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is trying to convey the importance of defining image transforms to my &quot;less-than-savvi&quot; clients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as a fallback I'd like to know if I can query any images and apply an image transform. I feel like this might be a step in the right direction, but not sure what to do next:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ include(template_from_string(entry.body)|raw) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-05-19T12:11:15.360" Title="Force an image transform to images inserted into Redactor" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15108" PostTypeId="1" AcceptedAnswerId="15109" CreationDate="2016-05-19T09:10:41.530" Score="1" ViewCount="637" Body="&lt;p&gt;I have a Products Section and a Product Category Structure Section&#xA;In Products there is an Entries Field where the Category is selected from the Product Category section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to sort the products per category manually?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see with the ManytoMany Plugin - &lt;a href=&quot;https://github.com/page-8/craft-manytomany&quot; rel=&quot;nofollow&quot;&gt;https://github.com/page-8/craft-manytomany&lt;/a&gt;&#xA;You can display the products which appear in each Category and the Custom Ordering of the second Relationship is in the pipeline which would probably work but not available yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other option?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2016-05-19T09:45:50.300" Title="Sort entries in a category or entries field?" Tags="&lt;categories&gt;&lt;entries-field&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15109" PostTypeId="2" ParentId="15108" CreationDate="2016-05-19T09:45:50.300" Score="2" Body="&lt;p&gt;To order the products you'd make the Products section into a structure and display the category you were sorting by in the listing as a table column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then re-order all products to be in category order (using the table column), then re-order each product for each category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then output each product grouped by category with something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cat in categories %}&#xA;&#xA;  {% set products = products.relatedTo( cat ) %}&#xA;&#xA;  {% for product in products %}&#xA;&#xA;    {{ product.title }}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-19T09:45:50.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15110" PostTypeId="1" CreationDate="2016-05-19T10:35:07.543" Score="11" ViewCount="2579" Body="&lt;p&gt;Does anyone know how to make Craft by default use .twig extensions. It helps IDEs better understand Twig blocks. I have tried .twig and .html.twig but it doesn't appear to work by default. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to set up special configs for every template.&lt;/p&gt;&#xA;" OwnerUserId="5164" LastEditorUserId="125" LastEditDate="2016-05-19T13:37:34.117" LastActivityDate="2017-07-14T13:38:05.587" Title="Templates with .twig extension" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15111" PostTypeId="2" ParentId="15110" CreationDate="2016-05-19T11:16:01.237" Score="6" Body="&lt;p&gt;Why do you want to use a .twig extension? The &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;official Twig documentation&lt;/a&gt; uses .html, P&amp;amp;T use .html in the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/tree/master/app/templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft codebase&lt;/a&gt; and in the &lt;a href=&quot;https://craftcms.com/docs/templating-overview#template-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft documentation&lt;/a&gt;. I would say &lt;strong&gt;.html is the standard&lt;/strong&gt; for Craft template files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most editors can be configured to load the Twig language / syntax parser for files with other extensions then .twig&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Configuration instructions for some popular editors and IDEs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/a/8014142&quot;&gt;Sublime Text&lt;/a&gt; (“Open all with current extension as...” setting)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/a/32508353&quot;&gt;Atom Editor&lt;/a&gt; (add extension to &lt;code&gt;text.html.twig&lt;/code&gt; language)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://code.visualstudio.com/docs/languages/overview#_adding-a-file-extension-to-a-language&quot; rel=&quot;nofollow noreferrer&quot;&gt;Visual Studio Code&lt;/a&gt; (add extension to &lt;code&gt;files.associations&lt;/code&gt; setting)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/10143/125&quot;&gt;PHPStorm&lt;/a&gt; (Preferences &gt; Editor &gt; File Types &gt; Twig; also enable all Twig live templates for HTML in Preferences &gt; Editor &gt; Live Templates)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-14T13:38:05.587" LastActivityDate="2017-07-14T13:38:05.587" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15112" PostTypeId="1" CreationDate="2016-05-19T12:11:12.507" Score="1" ViewCount="357" Body="&lt;p&gt;I have a Matrix field which has one block type (1 asset field - I'm using a Matrix field as I'll be adding text fields later on to the same block). On the front end I am using Bootstrap's grid system to output the images in columns.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.blockName %}&#xA;    &amp;lt;div class=&quot;col-md-3&quot;&amp;gt;&#xA;    {% set image = block.image.first() %}&#xA;    {% if image %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA; {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason when I test it the last column on the first row gets shunted down as shown in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v9YKX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v9YKX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This only happens on the first row of items and if I test it out of the matrix field with placeholder images and static HTML it works fine. The CSS isn't changed for the last item so I can't seem to see what's causing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="57" LastEditDate="2016-05-19T19:05:27.307" LastActivityDate="2016-05-19T19:05:27.307" Title="Matrix entry causing last bootstrap column to be shunted down" Tags="&lt;matrix&gt;&lt;blocks&gt;&lt;bootstrap-craft&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15113" PostTypeId="2" ParentId="15107" CreationDate="2016-05-19T12:11:15.360" Score="3" Body="&lt;p&gt;I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon&lt;/a&gt; which is able to apply &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Transform&quot; rel=&quot;nofollow&quot;&gt;bulk image transforms&lt;/a&gt; to images in HTML/Redactor content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconTransform({ width : 1024 }) }}&#xA;{{ entry.body|retconTransform(myAwesomeTransform) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's currently no way to tell Retcon to only transform images that hasn't already been transformed, though – so this might not be exactly what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-05-19T12:11:15.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15115" PostTypeId="2" ParentId="15112" CreationDate="2016-05-19T12:53:57.587" Score="0" Body="&lt;p&gt;White space issue? Seen something similar happening with lists.&lt;/p&gt;&#xA;" OwnerUserId="3489" LastActivityDate="2016-05-19T12:53:57.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15116" PostTypeId="1" AcceptedAnswerId="15117" CreationDate="2016-05-19T12:55:16.393" Score="1" ViewCount="446" Body="&lt;p&gt;I'm trying to attach a custom header image for each entry, if none is selected then the default one will be displayed.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;contentBuilder&lt;/code&gt; is the Matrix field.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;imgHeader&lt;/code&gt; is an assets block type.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;img&lt;/code&gt; is the actual field&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for content in entry.contentBuilder.type('imgHeader') %}&#xA;&#xA;    {% if content.img|length %}&#xA;        {{ content.img.first.url }}&#xA;    {% else %}&#xA;        default jpg&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this doesn't work. Please advise :)&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="57" LastEditDate="2016-05-19T19:03:35.010" LastActivityDate="2016-05-20T17:16:20.923" Title="Matrix Field Conditional" Tags="&lt;matrix&gt;&lt;conditional&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15117" PostTypeId="2" ParentId="15116" CreationDate="2016-05-19T13:02:25.823" Score="1" Body="&lt;p&gt;Image are returned as an array so could use either of the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ content.img[0].url }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or set a variable which fetches the asset to then output its fields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = content.img.first() %}&#xA;{{ asset.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Related: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12483/looping-through-images-in-a-asset-field-type&quot;&gt;Looping through images in a Asset field type&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: The line &lt;code&gt;{% if content.img|length %}&lt;/code&gt; will always be true because you are checking for existence of the field. You need to instead check that the field has a value using one of the methods below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for content in entry.contentBuilder.type('imgHeader') %}&#xA;&#xA;    {% if content.img[0]|length %}&#xA;        {{ content.img[0].url }}&#xA;    {% else %}&#xA;        default jpg&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for content in entry.contentBuilder.type('imgHeader') %}&#xA;&#xA;    {% set image = content.img.first() %}&#xA;&#xA;    {% if image|length %}&#xA;        {{ image.url }}&#xA;    {% else %}&#xA;        default jpg&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-05-20T17:16:20.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15118" PostTypeId="2" ParentId="15112" CreationDate="2016-05-19T13:11:00.403" Score="1" Body="&lt;p&gt;This issue won't be related to the Matrix field or the twig tags outputting it - check the CSS thats being applied. Are you wrapping your columns in a div with a class of &lt;code&gt;.row&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: test by creating a new template and set it up with the following (replace the first line with the entry you're using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section( 'homepage' ).first() %}&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css&quot; media=&quot;screen&quot;&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid&quot;&amp;gt;&#xA;        {% for block in entry.blockName %}&#xA;          &amp;lt;div class=&quot;col-md-3&quot;&amp;gt;&#xA;            {% set image = block.image.first() %}&#xA;            {% if image %}&#xA;              &amp;lt;img src=&quot;{{ image.getUrl }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-19T13:31:33.240" LastActivityDate="2016-05-19T13:31:33.240" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15119" PostTypeId="2" ParentId="15110" CreationDate="2016-05-19T14:09:01.733" Score="12" Body="&lt;p&gt;Craft does already support &lt;code&gt;.twig&lt;/code&gt; as a template file extension option by default (see the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultTemplateExtensions&quot;&gt;defaultTemplateExtensions&lt;/a&gt; config setting docs). If you want to allow &lt;code&gt;.html.twig&lt;/code&gt; as well, just open craft/config/general.php and add this to the config array:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'defaultTemplateExtensions' =&amp;gt; array('html', 'twig', 'html.twig'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that this will only affect front-end templates. The Control Panel is locked to &lt;code&gt;.html&lt;/code&gt; and &lt;code&gt;.twig&lt;/code&gt; for plugins.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-05-19T14:09:01.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15120" PostTypeId="2" ParentId="15048" CreationDate="2016-05-19T15:59:55.447" Score="3" Body="&lt;p&gt;Here is one approach: Whenever an asset is checked on or off, it triggers a manipulation of the hidden ul.menu. You could listen for that update to be complete, then you’ll be able to access and hide the link.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#main .elements:first').on('click', '.checkbox', function(evt) {&#xA;&#xA;    // &quot;View Asset&quot; action is visible by default&#xA;    var isViewActionVisible = true;&#xA;&#xA;    // If only one asset is selected and it is an image, set up to hide &quot;View Asset&quot;&#xA;    // Otherwise, stick with default behavior&#xA;    if ( $('#main .elements:first tr.sel').length == 1 &amp;amp;&amp;amp;&#xA;         $('#main .elements:first tr.sel td[data-attr=&quot;kind&quot;]').html() == &quot;Image&quot; ) {&#xA;        isViewActionVisible = false;&#xA;    }&#xA;&#xA;    // Wait for menu ul to finish updating, then show/hide &quot;View Asset&quot; action&#xA;    $(document).one('DOMNodeInserted', 'ul.menu', function() {&#xA;        $('a#View-actiontrigger').parent().toggle( isViewActionVisible );&#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5165" LastActivityDate="2016-05-19T15:59:55.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15121" PostTypeId="1" AcceptedAnswerId="16360" CreationDate="2016-05-19T16:11:39.310" Score="5" ViewCount="956" Body="&lt;p&gt;Does Craft support any form of single sign-on across separate installations? I don't think there is a native way of doing this, but does anyone have any idea how I would approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need is for users of Site A and Site B to be kept in sync in some way so they can use the same username and password to sign-on to both sites. Bonus points if they can automatically signed into to Site B if they are already signed into Site A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that using some form of social sign-on (e.g. Facebook, Twitter, etc.) is not an option for this client.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-08-18T02:14:11.533" Title="Single-sign on for multiple Craft sites" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15122" PostTypeId="2" ParentId="15097" CreationDate="2016-05-19T16:37:36.567" Score="1" Body="&lt;p&gt;There’s a lot going on here. Let’s first work out the outline of your algorithm, and therefore where things could be improved.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Query and iterate memberships&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Query and iterate members&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Query first asset&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get asset transform&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Every time a transform is used, Craft first has to check whether the transform has been generated (&lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements#eager-loading-image-transform-indexes&quot; rel=&quot;nofollow&quot;&gt;from the docs&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there are multiple levels of nested relations going on. You’ve mentioned using eager-loading already, but it is definitely beneficial here. One of the cool things Craft can do is eager-load nested relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you tried something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set memberships = craft.entries({&#xA;    section: 'membership',&#xA;    order: 'cf_membershipShorthand',&#xA;    with: [&#xA;        '{relatedMembersField}.cf_ma_asset'&#xA;    ]&#xA;}) %}&#xA;&#xA;{% for membership in memberships %}&#xA;    {% for member in membership.{relatedMembersField} %}&#xA;        {% set image = member.cf_ma_asset[0] ?? null %}&#xA;        {% set imageParams = { width: 30, height: 30 } %}&#xA;&#xA;        {% if image %}&#xA;            {# Output image with transform #}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Where {relatedMembersField} is the handle of your entries field.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="148" LastActivityDate="2016-05-19T16:37:36.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15123" PostTypeId="2" ParentId="15096" CreationDate="2016-05-19T23:46:25.847" Score="5" Body="&lt;p&gt;It's definitely possible and doesn't really need any custom back end code to be done in general.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately all add to cart options in Commerce are just a simple case of POSTing the variant id and the quantity of that variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally I would do this all in twig &amp;amp; a bit of JS.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. In twig I wouldt loop through all variants (checking for stock as I go) and build up a JSON array of all the combinations of colour &amp;amp; size, and their availability due to stock.  I'd then 'pass this into' my form as a &lt;code&gt;data-variants&lt;/code&gt; attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually building the selects is slightly trickier because one will depend on the other but basically you'd probably want some JS that listens to your selects and looks at your passed in array to see if a particular size and colour combination was in stock - if a chosen combination is not, some sort of visual indication and disable the add to cart button, otherwise if it is in stock the form just posts the variant id and the qty and away you go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated with some sample  code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some untested/pseudo code that should get you on the right track:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the important thing to understand is that the descriptive data of a variant is really a completely separate concern to the sku of the variant - which in turn is not actually all that relevant to commerce - the variant &lt;code&gt;id&lt;/code&gt; is really all that matters in the end in terms of addToCart.  For specifiying the variant data you can do it any way you like really but in this case if it's just say 3 colours and 3 sizes, then a simple approach would be a dropdown for each of those, with handles &lt;code&gt;colour&lt;/code&gt; and &lt;code&gt;size&lt;/code&gt; say.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then just make the 9 variants, choose the colour and size for each, and enter the sku for each. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you want to make the JSON for use in the JS.  (It's hard for me to see how you'd have a good UX without JS here, to be honest).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the &lt;code&gt;|jsonencode&lt;/code&gt; filter is handy.  Something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stockArray = [] %}&#xA;{% for variant in product.variants %}&#xA;    {% set stockArray = stockArray|merge([{variantId:variant.id, &#xA;                                          variantColourAndSize :variant.colour ~ &quot;-&quot; ~ variant.size,&#xA;                                          variantIsUnlimited:variant.unlimitedStock,&#xA;                                          variantStock:variant.stock, &#xA;                                          }]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you output your form and pass this consolidated data in to it so it's accessible in the JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;OrderForm&quot; &#xA;    data-stockarray=&quot;{{ stockArray|json_encode() }}&quot;&#xA;    data-action=&quot;/actions/multiAdd/multiAdd&quot;&#xA;    data-redirect=&quot;/cart&quot;&#xA;    etc&#xA;&#xA;&amp;gt;&#xA;&amp;lt;selects here&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rest is really just JS operating on that json data - this is thoroughly pseudo code since it's Friday night :) - but should be enough to get the idea:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var $form = document.getElementById('OrderForm');&#xA;var stockArray = $form.dataset.stockarray;&#xA;// Listen to your selects and look up in this array whether the matching colour/size variant is in stock/has unlimited stock&#xA;var variantKey = $select1.val() + &quot;-&quot; + $select2.val();&#xA;if(stockArray[variantKey].variantIsUnlimited || stockArray[variantKey].variantStock &amp;gt; 0 ){&#xA;// Enable/Disable your add to cart button accordingly&#xA;    $addToCartButton.show();&#xA;}&#xA;else {&#xA;    $addToCartButton.hide();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-17T03:47:02.850" LastActivityDate="2017-05-17T03:47:02.850" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15124" PostTypeId="1" AcceptedAnswerId="15125" CreationDate="2016-05-20T05:08:54.430" Score="3" ViewCount="176" Body="&lt;p&gt;I am trying to figure out how to check if a visitor is not logged in so that I can show the correct button. E.g&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.isLoggedIn %}&#xA;    &amp;lt;a href=&quot;{{ logoutUrl }}&quot;&amp;gt;Logout&amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;    {% craft.session.isGuest %}&#xA;    &amp;lt;a href=&quot;{{ logoutUrl }}&quot;&amp;gt;Client/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the best method to display a &quot;sign in&quot; button for a visitor that takes them to a login page and then once logged in, show &quot;Logout&quot;?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="144" LastEditDate="2016-05-20T13:59:07.907" LastActivityDate="2016-05-20T13:59:07.907" Title="Check if Visitor show logon button" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15125" PostTypeId="2" ParentId="15124" CreationDate="2016-05-20T05:34:13.080" Score="4" Body="&lt;p&gt;I believe you'll want something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    &amp;lt;a href=&quot;{{ url('logout') }}&quot;&amp;gt;Logout&amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;{{ url('login') }}&quot;&amp;gt;Login&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-20T05:34:13.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15126" PostTypeId="1" AcceptedAnswerId="15130" CreationDate="2016-05-20T08:13:23.037" Score="1" ViewCount="143" Body="&lt;p&gt;When I view a entry that's belong to a small group of children with a parent assigned. When I view the child, I want to display list all children that the child assigned to? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to achieve this method?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastActivityDate="2016-05-20T10:31:09.567" Title="Show active parent's listed children when viewing it children" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15127" PostTypeId="2" ParentId="15004" CreationDate="2016-05-20T08:13:41.097" Score="1" Body="&lt;p&gt;Turns out I had some stuck tasks so the updated URIs were showing in the settings but the task to actually update them wasn't getting run. Followed instructions here and it worked:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5128" LastActivityDate="2016-05-20T08:13:41.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15128" PostTypeId="1" CreationDate="2016-05-20T09:34:09.953" Score="3" ViewCount="130" Body="&lt;p&gt;I am using a generic Garnish modal from Craft like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$container = $('.upload-modal');&#xA;&#xA;$modal = new Garnish.Modal($container, {&#xA;    autoShow: false&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to have craft's native drag&amp;amp;drop support in this modal, i tried something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dragDrop = new Garnish.DragDrop({&#xA;    dropTargets: ['.upload-modal__drop']&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction. I tried to find some answers here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/master/src/classes/DragDrop.js&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/garnishjs/blob/master/src/classes/DragDrop.js&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually what i am trying to achieve here, is a basic modal without any link to existing assets or so, for uploading a file with dragdrop and file select functionality. This file when processed by the plugin needs te be deleted afterwards.&lt;/p&gt;&#xA;" OwnerUserId="4077" LastEditorUserId="9" LastEditDate="2016-08-22T17:00:15.733" LastActivityDate="2016-08-22T17:00:15.733" Title="How can my plugin use Craft's native dragdrop support" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;ajax&gt;&lt;garnish&gt;&lt;modal&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15129" PostTypeId="2" ParentId="13653" CreationDate="2016-05-20T09:36:02.520" Score="1" Body="&lt;p&gt;Just figured out how to actually use the Smart Map plugin with the Element API plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'endpoints' =&amp;gt; [&#xA;    'entries.json' =&amp;gt; [&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'sectionHandle',&#xA;            'address' =&amp;gt; array(&#xA;                'target' =&amp;gt; '50.25641910,6.10379780',&#xA;                'range' =&amp;gt; 20&#xA;            )&#xA;        ],&#xA;    ]&#xA;]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-05-20T09:36:02.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15130" PostTypeId="2" ParentId="15126" CreationDate="2016-05-20T10:31:09.567" Score="3" Body="&lt;p&gt;I think you're looking for the &lt;code&gt;getSiblings()&lt;/code&gt; method. This will return all sibling entries for the current entry. You can also use &lt;code&gt;getParent()&lt;/code&gt; to get the parent entry and &lt;code&gt;getChildren()&lt;/code&gt; to get the entries child entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example implementation is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set siblings = entry.getSiblings() %}&#xA;{% set parent = entry.getParent() %}&#xA;{% set children = entry.getChildren() %}&#xA;&#xA;{% if parent|length %}&#xA;  &amp;lt;h2&amp;gt;Parent&amp;lt;/h2&amp;gt;&#xA;  &amp;lt;p&amp;gt;{{ parent.title }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if siblings|length %}&#xA;  &amp;lt;h2&amp;gt;Siblings&amp;lt;/h2&amp;gt;&#xA;  {% for entry in siblings %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if children|length %}&#xA;  &amp;lt;h2&amp;gt;Children&amp;lt;/h2&amp;gt;&#xA;  {% for entry in children %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on these methods can be found in the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getSiblings&quot; rel=&quot;nofollow&quot;&gt;EntryModel documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-20T10:31:09.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15131" PostTypeId="1" CreationDate="2016-05-20T11:28:19.113" Score="1" ViewCount="191" Body="&lt;p&gt;I'm working on a plugin, and would like to add a new Record, I already have some records, and would like to keep the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to activate a new record type, without re-installing the plugin, thus loosing the other records data?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastEditorUserId="57" LastEditDate="2016-05-20T18:25:46.283" LastActivityDate="2016-05-20T18:25:46.283" Title="Add Record without deleting data" Tags="&lt;plugin-development&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15132" PostTypeId="1" AcceptedAnswerId="15133" CreationDate="2016-05-20T12:34:28.243" Score="2" ViewCount="694" Body="&lt;p&gt;I'm getting this error when saving a post which has a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;ui&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have ran a search in my templates and don't have a closure named &quot;ui&quot; anywhere...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help with a fix for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Stack Trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#0  &#xA;    +  /Users/Local Dev/site-title/craft/app/models/BaseModel.php(119): CComponent-&amp;gt;__call(&quot;ui&quot;, array())&#xA;    #1  &#xA;    +  /Users/Local Dev/site-title/craft/app/vendor/twig/twig/lib/Twig/Template.php(609): Craft\BaseModel-&amp;gt;__call(&quot;ui&quot;, array())&#xA;    #2  &#xA;    +  /Users/Local Dev/site-title/craft/app/etc/templating/BaseTemplate.php(64): Twig_Template-&amp;gt;getAttribute(Craft\EntryModel, &quot;ui&quot;, array(), &quot;any&quot;, ...)&#xA;    #3  &#xA;    +  /Users/Local Dev/site-title/craft/storage/runtime/compiled_templates/29/293cae55ba17fb39e41eb647a3f0ea1d9993a92c11c0f92b88df31e0da72ed53.php(19): Craft\BaseTemplate-&amp;gt;getAttribute(Craft\EntryModel, &quot;ui&quot;, array())&#xA;    #4  &#xA;    +  /Users/Local Dev/site-title/craft/app/vendor/twig/twig/lib/Twig/Template.php(381): __TwigTemplate_565b9119d77fab485839787af49f6670acfedc6911aa119352914b227f9662d7-&amp;gt;doDisplay(array(&quot;object&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array())&#xA;    #5  &#xA;    +  /Users/Local Dev/site-title/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;object&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array())&#xA;    #6  &#xA;    +  /Users/Local Dev/site-title/craft/app/vendor/twig/twig/lib/Twig/Template.php(355): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;object&quot; =&amp;gt; Craft\EntryModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, &quot;blx&quot; =&amp;gt; Craft\CraftVariable, &quot;now&quot; =&amp;gt; Craft\DateTime, ...), array())&#xA;    #7  &#xA;    +  /Users/Local Dev/site-title/craft/app/vendor/twig/twig/lib/Twig/Template.php(366): Twig_Template-&amp;gt;display(array(&quot;object&quot; =&amp;gt; Craft\EntryModel))&#xA;    #8  &#xA;    +  /Users/Local Dev/site-title/craft/app/services/TemplatesService.php(335): Twig_Template-&amp;gt;render(array(&quot;object&quot; =&amp;gt; Craft\EntryModel))&#xA;    #9  &#xA;    +  /Users/Local Dev/site-title/craft/app/helpers/ElementHelper.php(122): Craft\TemplatesService-&amp;gt;renderObjectTemplate(&quot;{parent.ui}/{slug}&quot;, Craft\EntryModel)&#xA;    #10 &#xA;    +  /Users/Local Dev/site-title/craft/app/services/ElementsService.php(1537): Craft\ElementHelper::setUniqueUri(Craft\EntryModel)&#xA;    #11 &#xA;    +  /Users/Local Dev/site-title/craft/app/services/EntriesService.php(176): Craft\ElementsService-&amp;gt;saveElement(Craft\EntryModel)&#xA;    #12 &#xA;    +  /Users/Local Dev/site-title/craft/app/controllers/EntriesController.php(458): Craft\EntriesService-&amp;gt;saveEntry(Craft\EntryModel)&#xA;    #13 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;    #14 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;p&quot; =&amp;gt; &quot;admin/entries/sections/58-black-sun&quot;))&#xA;    #15 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(CInlineAction)&#xA;    #16 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(CInlineAction, array())&#xA;    #17 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run(&quot;saveEntry&quot;)&#xA;    #18 &#xA;    +  /Users/Local Dev/site-title/craft/app/etc/web/WebApp.php(815): CWebApplication-&amp;gt;runController(&quot;entries/saveEntry&quot;)&#xA;    #19 &#xA;    +  /Users/Local Dev/site-title/craft/app/etc/web/WebApp.php(285): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;    #20 &#xA;    +  /Users/Local Dev/site-title/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;    #21 &#xA;    +  /Users/Local Dev/site-title/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;    #22 &#xA;    +  /Users/Local Dev/site-title/public/index.php(19): require_once(&quot;/Users/Local Dev/site-title/craft/app/index...&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5167" LastEditorUserId="57" LastEditDate="2016-05-20T18:18:55.920" LastActivityDate="2016-05-20T18:18:55.920" Title="Craft\EntryModel and its behaviors do not have a method or closure named &quot;ui&quot;" Tags="&lt;matrix&gt;&lt;saveentry&gt;&lt;onsaveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15133" PostTypeId="2" ParentId="15132" CreationDate="2016-05-20T13:06:33.647" Score="2" Body="&lt;p&gt;My mistake... &#xA;I had {parent.ui} as the nested entry slug for the section. &#xA;{parent.uri} is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TzTqn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TzTqn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5167" LastActivityDate="2016-05-20T13:06:33.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15134" PostTypeId="1" AcceptedAnswerId="15145" CreationDate="2016-05-20T13:15:00.727" Score="1" ViewCount="403" Body="&lt;p&gt;Each Product is associated with a Merchant (a standard Craft User), who has 2-3 flat-rate Shipping Prices. There could be any number of Merchants and Products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is on the Shipping page of Checkout, allow the Customer to select a Shipping method from a drop-down per LineItem. Then when they progress to the Payment Page, these Shipping Costs are Totalled and applied to the overall Order. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got everything up to the drop-downs on the Shipping page and I'm able to save the value the Customer has chosen to the LineItem via the &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;nofollow&quot;&gt;Options&lt;/a&gt; collection, but that's where I've hit a brick wall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look at &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow&quot;&gt;Adjusters&lt;/a&gt; and I don't think that's the solution. It was suggested on the Craft Slack that Custom &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods&quot; rel=&quot;nofollow&quot;&gt;Shipping Methods&lt;/a&gt; might be a way forward, but they are very heavily geared towards applying the Shipping Method to the whole Order rather than having separate ones for each lineItem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas on a suitable approach? Any help gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-05-21T02:11:31.480" Title="Add a shippingCost per lineItem rather than per Order" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15135" PostTypeId="5" CreationDate="2016-05-20T13:56:35.540" Score="0" Body="&lt;p&gt;Craft Commerce is an ecommerce plugin for Craft CMS. As the only 1st-party ecommerce solution, it was built by Pixel &amp;amp; Tonic, the makers of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, check out the &lt;a href=&quot;https://craftcommerce.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce Documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="22" LastEditDate="2017-05-10T02:08:16.353" LastActivityDate="2017-05-10T02:08:16.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15136" PostTypeId="4" CreationDate="2016-05-20T13:56:35.540" Score="0" Body="Use this tag for questions relating to the Craft Commerce product." OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-05-20T21:09:15.417" LastActivityDate="2016-05-20T21:09:15.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15137" PostTypeId="1" AcceptedAnswerId="15150" CreationDate="2016-05-20T16:22:23.563" Score="0" ViewCount="620" Body="&lt;p&gt;I'm writing my first Craft CMS plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following tag in my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;clientnameDonation/donateForm/donate&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I have the following controller code to handle the action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class ClientnameDonation_DonateFormController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = array('actionDonate',&#xA;        );&#xA;&#xA;    public function actionDonate()&#xA;    {&#xA;        // stuff&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to submit the form, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to resolve the request &quot;clientnameDonation/donateForm/donate&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a piece I'm missing, or is there a casing error somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried just using a raw action URL like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://URL/index.php?p=actions/clientnameDonation/donateForm/donate&quot; rel=&quot;nofollow&quot;&gt;http://URL/index.php?p=actions/clientnameDonation/donateForm/donate&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I get the same routing error.&lt;/p&gt;&#xA;" OwnerUserId="5169" LastEditorUserId="57" LastEditDate="2016-05-20T18:22:17.780" LastActivityDate="2016-05-21T09:29:37.323" Title="How do I wire my form action to my controller action?" Tags="&lt;plugins&gt;&lt;routing&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15138" PostTypeId="1" AcceptedAnswerId="15159" CreationDate="2016-05-20T16:27:26.887" Score="4" ViewCount="194" Body="&lt;p&gt;I have profiles (Users) that can have multiple addresses (currently two Smart Map fields called &lt;code&gt;profileAddress1&lt;/code&gt; and &lt;code&gt;profileAddress2&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to filter by a single address:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.users({&#xA;    group: 'profiles',&#xA;    profileAddress1: {&#xA;        target: 'Cologne',&#xA;        range: 20&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I search across both fields? So if a profile had two addresses – one in Cologne and one in Munich – it should show up in the results in both search cases (Cologne and Munich).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that even possible?&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-05-23T06:00:40.173" Title="How do I filter by multiple Smart Map addresses?" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15139" PostTypeId="2" ParentId="14175" CreationDate="2016-05-20T16:34:24.407" Score="2" Body="&lt;p&gt;There may be better ways but here was our approach to setting it up in a way that's easy to duplicate for the next project. This method will allow you to use the existing /commerce folder for your templates, while using any replacement word you want for &quot;commerce&quot;, in your URIs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In /config/general.php, create an enviromentVariable using your desired replacement for &quot;commerce&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;  'baseUrl'   =&amp;gt; 'http://commerce.dev',&#xA;  'basePath'  =&amp;gt; getcwd(),&#xA;  'shopPrefix' =&amp;gt; 'shop' //&amp;lt;- add this line&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In /templates/ create a folder of the same name as your prefix. Inside that folder, create a twig template file, such as _entry.twig. Place the following in that file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shopPrefix = craft.config.environmentVariables.shopPrefix %}&#xA;{% set segmentUri = &quot;/&quot; %}&#xA;{% for segment in craft.request.segments() %}&#xA;    {% set segmentUri = segmentUri ~ &quot;/&quot; ~ segment|replace(shopPrefix, 'commerce') %}&#xA;{% endfor %}&#xA;&#xA;{% include segmentUri %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, open /templates/commerce/_layouts/main.html (or whatever is your primary layout for Commerce pages). After &lt;code&gt;{% set cart = craft.commerce.cart %}&lt;/code&gt;, add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shopPrefix = craft.config.environmentVariables.shopPrefix %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your various templates, replace any commerce links or input fields used for redirects with &lt;code&gt;{{shopPrefix}}/cart&lt;/code&gt;, e.g:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{shopPrefix}}/cart&quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{shopPrefix}}/cart&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any redirect URIs part of Twig functions should be replaced as well. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.isEmpty %}&#xA;    {% redirect shopPrefix ~ '/myProductsPage' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTE: as mentioned above, never replace Commerce action URIs. They are used as controller actions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The benefit of this method is that next time, if a client wants to use &quot;buy&quot; instead of &quot;shop&quot;, you can reuse all these templates, just change the enviromentVariable and one folder name, and you're done.&lt;/p&gt;&#xA;" OwnerUserId="5168" LastActivityDate="2016-05-20T16:34:24.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15140" PostTypeId="2" ParentId="15131" CreationDate="2016-05-20T17:30:42.050" Score="2" Body="&lt;p&gt;The Craft website has a great article on this, you can simply use migrations following this document: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/migrations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If your schema changes over the life of your plugin, you can write a migration to keep existing installations updated with the latest schema. Craft automatically checks for new migrations whenever a plugin’s version number changes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In summary, you can create the Record and define all the attributes, then create a migration that would create the new table with those attributes. This would be done in the &lt;code&gt;safeUp()&lt;/code&gt; method that utilizes Craft create command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;createTable('new_table_record_name', $attributesArray, null, true);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the plugin is updated, it will run the migrations and create the table.&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2016-05-20T17:30:42.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15141" PostTypeId="1" AcceptedAnswerId="15142" CreationDate="2016-05-20T18:03:24.430" Score="1" ViewCount="1975" Body="&lt;p&gt;I'm dumping this var but cant nail down this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submissions = craft.tumblr.submissions %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for key,submits in submissions %}&#xA;        // KEY GIVES ERROR 1&#xA;        &amp;lt;li&amp;gt;{{ dump(submits.key)  }}&amp;lt;/li&amp;gt;&#xA;        &amp;lt;hr&amp;gt;&#xA;        // BLOG_NAME GIVES ERROR 2&#xA;        &amp;lt;li&amp;gt;{{ dump(submits.blog_name)  }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error 1:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Key &quot;key&quot; for array with keys &quot;blog_name, id, post_url, slug, type, date, timestamp, state, format, reblog_key, short_url, summary, recommended_source, recommended_color, followed, is_anonymous, anonymous_name, anonymous_email, is_submission, liked, note_count, title, url, link_author, excerpt, publisher, can_send_in_message, can_reply&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Error 2:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Method &quot;blog_name&quot; for object &quot;Twig_Markup&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Adding scheme for &lt;code&gt;craft.tumblr.submissions&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(7) {&#xA;  [1]=&amp;gt;&#xA;  array(28) {&#xA;    [&quot;blog_name&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;id&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      int()&#xA;    }&#xA;    [&quot;post_url&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(64) &quot;&quot;&#xA;    }&#xA;    [&quot;slug&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(23) &quot;&quot;&#xA;    }&#xA;    [&quot;type&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(4) &quot;&quot;&#xA;    }&#xA;    [&quot;date&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(23) &quot;&quot;&#xA;    }&#xA;    [&quot;timestamp&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      int()&#xA;    }&#xA;    [&quot;state&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(10) &quot;&quot;&#xA;    }&#xA;    [&quot;format&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(4) &quot;&quot;&#xA;    }&#xA;    [&quot;reblog_key&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(8) &quot;&quot;&#xA;    }&#xA;    [&quot;short_url&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(30) &quot;&quot;&#xA;    }&#xA;    [&quot;summary&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(23) &quot;&quot;&#xA;    }&#xA;    [&quot;recommended_source&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;recommended_color&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;followed&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(false)&#xA;    }&#xA;    [&quot;is_anonymous&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(true)&#xA;    }&#xA;    [&quot;anonymous_name&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(13) &quot;&quot;&#xA;    }&#xA;    [&quot;anonymous_email&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(30) &quot;&quot;&#xA;    }&#xA;    [&quot;is_submission&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(true)&#xA;    }&#xA;    [&quot;liked&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(false)&#xA;    }&#xA;    [&quot;note_count&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      int(0)&#xA;    }&#xA;    [&quot;title&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(23) &quot;&quot;&#xA;    }&#xA;    [&quot;url&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(54) &quot;&quot;&#xA;    }&#xA;    [&quot;link_author&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;excerpt&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;publisher&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      string(11) &quot;&quot;&#xA;    }&#xA;    [&quot;can_send_in_message&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(false)&#xA;    }&#xA;    [&quot;can_reply&quot;]=&amp;gt;&#xA;    array(1) {&#xA;      [0]=&amp;gt;&#xA;      bool(true)&#xA;    }&#xA;  }&#xA;  [2]=&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastEditorUserId="353" LastEditDate="2016-05-20T18:29:05.897" LastActivityDate="2016-05-20T18:29:05.897" Title="Twig array key errors" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15142" PostTypeId="2" ParentId="15141" CreationDate="2016-05-20T18:22:02.350" Score="2" Body="&lt;p&gt;I'm not sure what &lt;code&gt;submissions&lt;/code&gt; is, but &lt;code&gt;submits&lt;/code&gt; inside your loop is an array so you can access its values using &lt;code&gt;submits['blog_name']&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="57" LastEditDate="2016-05-20T18:27:06.610" LastActivityDate="2016-05-20T18:27:06.610" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15144" PostTypeId="2" ParentId="15137" CreationDate="2016-05-20T23:24:40.493" Score="2" Body="&lt;p&gt;I had the plugin set up correctly but I didn't go into the administration menu and install the plugin via the GUI.&lt;/p&gt;&#xA;" OwnerUserId="5169" LastActivityDate="2016-05-20T23:24:40.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15145" PostTypeId="2" ParentId="15134" CreationDate="2016-05-21T00:58:08.160" Score="4" Body="&lt;p&gt;You're right that the shipping calculator API doesn't lend itself to different rates per lineItem as such, but I'm pretty sure you can still make it do what you want.  (But longer term I agree that &lt;code&gt;getLineItemRate(lineItem)&lt;/code&gt; or similar should be an option!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, for now, you can do anything you like in the getBaseRate() and return the total from that to the cart.  (Personally I implement all my shipping stuff as services so I can call them from controllers etc too (e.g. to do shipping quotes via a controller separate to the cart as such - but in this I'll do ti right here).  But you can also do stuff like save data to the order in here, which should be enough to make this work for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you'd loop through the lineItems, looking at the value in the dropdown for each and using that to sum up your shipping costs.  You probably want to list out the chosen options and costs for each lineitem separately on that payment page, so you'll also need to save that data somewhere too...so create a holder variable &lt;code&gt;lineItemShippingOptions&lt;/code&gt; in your order for that data and set it as part of the process so you can refer to it in the later templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'd use a non-editable incognito field for that so your order processors can't accidentally change the data later - &lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/IncognitoField-Craft&lt;/a&gt; (I have PR-ed an improvement to that for just this sort of thing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Obviously - this is untested sketch code!)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getBaseRate()&#xA;{&#xA;   $shippingCost = 0;&#xA;   $dataToSave = [];&#xA;&#xA;   $this-&amp;gt;cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;   foreach ($cart-&amp;gt;lineItems as $item){&#xA;        $shippingOptionChosen = item.options.whatever;&#xA;        if($shippingOptionChosen == &quot;service1&quot; ){&#xA;            $shippingCost = $20;&#xA;            $dataToSave[item.id] = ['chosenOption'=&amp;gt;$shippingOptionChosen, 'chosenPrice'=&amp;gt;20];   &#xA;        }&#xA;        elseif ($shippingOptionChosen == &quot;service2&quot;){&#xA;            etc &#xA;        }&#xA;   }&#xA;   //Save this data in to the order&#xA;   $this-&amp;gt;cart-&amp;gt;setContentFromPost(['lineItemShippingOptions'=&amp;gt;$dataToSave]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your templates you can refer to &lt;code&gt;lineItemShippingOptions&lt;/code&gt; to print the info out to the customer.  (That's probably not the ideal way to build the template data you're saving but should serve the purpose to demonstrate the idea...basically you can build any format array you like really).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this same approach in a very complicated custom shipping calculator (crazily this is some 2000 lines of php!) - that deals with multiple services (including some table data ones and some live quote ones), plus grouping &amp;amp; boxing services &amp;amp; caching to make it all work as quickly as possible (live rates always being much slower of course...).  Because at times the checkout flow gets awkward relying on Commerce's template tags, I also have an &lt;code&gt;actionShippingOptions&lt;/code&gt; controller that calls the same services and returns the quotes &amp;amp; data that way (also very handy for debugging purposes!) - but you may well not need that.  But even with the existing API you can do damn near anything you like between setting the rate and saving data to the order and showing it later, basically.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-05-21T02:11:31.480" LastActivityDate="2016-05-21T02:11:31.480" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15146" PostTypeId="1" AcceptedAnswerId="15152" CreationDate="2016-05-21T02:46:51.923" Score="4" ViewCount="1526" Body="&lt;p&gt;When a user logs in, I want to display the message &quot;Login Success&quot; or an error message &quot;Username or Password is incorrect&quot; if a user enters the wrong details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best method for displaying these messages when a user logs in and logs out? I am not sure how to write the correct way using getFlash?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="4466" LastEditDate="2016-05-22T05:24:05.877" LastActivityDate="2016-05-23T01:54:04.907" Title="How can I display a message after login?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15147" PostTypeId="2" ParentId="4661" CreationDate="2016-05-21T04:15:25.040" Score="1" Body="&lt;p&gt;The reason of this problem vary on different situations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently installed/configured xdebug over MAMP and in template &lt;em&gt;php.ini&lt;/em&gt; file as shown in snapshot &lt;a href=&quot;https://i.stack.imgur.com/nn4Ap.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nn4Ap.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;, i wrote &lt;code&gt;zend_extension = /Applications/MAMP/bin/php/php5.5.26/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so&lt;/code&gt; which is wrong because if we successfully install &lt;code&gt;xdebug&lt;/code&gt; over loading MAMP, it automatically writes this line just after &lt;code&gt;[xdebug]&lt;/code&gt; line; therefore on generating &lt;em&gt;php.ini&lt;/em&gt;, it wrote the same line 2 times. &#xA;I removed my hard-coded line from &lt;em&gt;php.ini template file&lt;/em&gt; and my issue was resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it will help someone.&lt;/p&gt;&#xA;" OwnerUserId="5171" LastActivityDate="2016-05-21T04:15:25.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15148" PostTypeId="1" AcceptedAnswerId="15149" CreationDate="2016-05-21T07:49:23.087" Score="1" ViewCount="464" Body="&lt;p&gt;What would be the best approach to have a list of categories (brands in my case.) and if an asset (image) exists that matches that brand name show that asset or instead show a placeholder image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for category in craft.categories.group('brands') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ .. }}&quot; /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3583" LastActivityDate="2016-05-21T09:22:42.077" Title="Find matching asset (image) for category" Tags="&lt;assets&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15149" PostTypeId="2" ParentId="15148" CreationDate="2016-05-21T08:53:36.327" Score="4" Body="&lt;p&gt;I would add the brand category field to the assets field set. This way you can add brands to images and use &lt;code&gt;.relatedTo&lt;/code&gt; to find them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for category in craft.categories.group( 'brands' ) %}&#xA;    // This will give you the first image that relates to the category, you could use .find() to get all images and then loop through them.&#xA;    {% set image = craft.assets.relatedTo( category ).first() %}&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;        {% if image|length %}&#xA;          &amp;lt;img src=&quot;{{ image.url }}&quot; /&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;img src=&quot;http://placehold.it/400x300&quot; /&amp;gt;&#xA;        {% endif %}&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-21T09:22:42.077" LastActivityDate="2016-05-21T09:22:42.077" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15150" PostTypeId="2" ParentId="15137" CreationDate="2016-05-21T09:29:37.323" Score="1" Body="&lt;p&gt;You may need to install your Plugin through the control panel. To do this go to 'Settings&gt;Plugins' and if you've set it up correctly then you should see your Plugin name in the list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply click &quot;Install&quot; and then your plugins file will be accessible from your templates.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-21T09:29:37.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15151" PostTypeId="1" AcceptedAnswerId="15766" CreationDate="2016-05-21T10:54:10.003" Score="1" ViewCount="692" Body="&lt;p&gt;The whole page is disabled in the backend. Like in this screenshot: &lt;a href=&quot;https://i.stack.imgur.com/bKaXe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bKaXe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can't see anything in the Live Preview. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code starts with: &lt;code&gt;{% for entry in craft.entries.section('aboutus') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set &lt;code&gt;.status(null)&lt;/code&gt; I see everything in the Live Preview, but also the entries which are disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is it possible to show a disabled page in a Live Preview but not the disabled entries of this page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Live Preview I can see all outside of this for loop &lt;code&gt;{% for entry in craft.entries.section('aboutus') %}&lt;/code&gt; but nothing inside.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I uploaded my code &lt;a href=&quot;http://jsfiddle.net/zoy2hj0c&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3513" LastEditorUserId="3513" LastEditDate="2016-07-02T10:12:59.463" LastActivityDate="2016-07-02T10:12:59.463" Title="Show Live Preview even if whole page is disabled" Tags="&lt;templating&gt;&lt;live-preview&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15152" PostTypeId="2" ParentId="15146" CreationDate="2016-05-21T13:48:21.933" Score="6" Body="&lt;p&gt;You can achieve this using a plugin and the &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService&quot; rel=&quot;nofollow&quot;&gt;UserSessionService&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'userSession.onLogin', function( Event $event ){&#xA;  // Sets the flash message on log in&#xA;  craft()-&amp;gt;userSession-&amp;gt;setFlash( 'message', &quot;You've been logged in&quot; );&#xA;});&#xA;&#xA;craft()-&amp;gt;on( 'userSession.onLogout', function( Event $event ){&#xA;  // Sets the flash message on log out&#xA;  craft()-&amp;gt;userSession-&amp;gt;setFlash( 'message', &quot;You've been logged out&quot; );&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your template you can see of a flash message exists and print it out.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.session.getFlash( 'message' ) %}&#xA;&#xA;{% if message %}&#xA;  {{ message }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The message for the incorrect login details will be handled by Crafts login controller. Take a look at the example front end log in page in the &lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt; to see how this is handled.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-22T07:10:37.620" LastActivityDate="2016-05-22T07:10:37.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15153" PostTypeId="2" ParentId="15151" CreationDate="2016-05-21T21:05:40.897" Score="2" Body="&lt;p&gt;You can combine &lt;code&gt;.status( null )&lt;/code&gt; with the &lt;code&gt;isLivePreview&lt;/code&gt; property on &lt;code&gt;craft.request&lt;/code&gt;. More info can be found in the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#isLivePreview&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-21T21:05:40.897" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15154" PostTypeId="1" CreationDate="2016-05-21T23:29:23.390" Score="3" ViewCount="907" Body="&lt;p&gt;I am trying to create two subdomain names: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;townsville.example.com&lt;/li&gt;&#xA;&lt;li&gt;brisbane.example.com&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All subdomains would share the same database. They would be tied to the Pro license on example.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the best way to achieve this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to copy index.php to each subdomain root folder?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="45" LastEditDate="2016-05-22T06:17:02.840" LastActivityDate="2016-05-22T21:23:56.317" Title="Subdomain Setup" Tags="&lt;templating&gt;&lt;database&gt;&lt;license&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15155" PostTypeId="2" ParentId="15146" CreationDate="2016-05-21T23:57:22.803" Score="6" Body="&lt;p&gt;There's no need for a plugin here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft sets a &lt;code&gt;notice&lt;/code&gt; flash message by default on login/logout that you can check for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Logged in.&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If there is an error it will return the error (and your form with field errors) to the page as well.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to check explicitly for these messages anywhere else (e.g. where your login form redirects to) - you could:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.session.getFlash( 'notice' ) %}&#xA;&#xA;{% if message == &quot;Logged In.&quot; %}&#xA;    {# Do whatever #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In terms of error handling, generally you will stay on the login page and if there was an error print that our under the form so they can try again.  In simplest form, you just need to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errorMessage is defined %}&#xA;    &amp;lt;p&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is documented here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-05-23T01:54:04.907" LastActivityDate="2016-05-23T01:54:04.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15156" PostTypeId="1" AcceptedAnswerId="15972" CreationDate="2016-05-22T11:30:43.153" Score="2" ViewCount="182" Body="&lt;p&gt;Is it possible to order a section of entries by their child entries post date?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in craft.entries({&#xA;    section: 'articles',&#xA;    type: 'videoArticle',&#xA;    limit: 6&#xA;}).getChildren().order('postDate asc') %}&#xA;    &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;{{ article.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each article has 1 child under it. I want to filter the articles by the latest postDate of the children.&lt;/p&gt;&#xA;" OwnerUserId="5111" LastEditorUserId="4466" LastEditDate="2016-05-23T11:04:50.433" LastActivityDate="2016-07-19T23:51:20.153" Title="How can I order a sections entries by their children entry postDate?" Tags="&lt;entries&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15157" PostTypeId="1" CreationDate="2016-05-22T19:53:38.703" Score="4" ViewCount="287" Body="&lt;p&gt;I use Smart Map for a project, but I have a question for this plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible group the markers per cluster or I need see other options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tks&lt;/p&gt;&#xA;" OwnerUserId="4080" LastActivityDate="2021-01-01T06:35:37.887" Title="Smart Map cluster marker" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15158" PostTypeId="2" ParentId="15154" CreationDate="2016-05-22T21:23:56.317" Score="3" Body="&lt;p&gt;If you create your folder structure like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public_html/&#xA;----townsville.example.com/&#xA;--------index.php&#xA;--------.htaccess&#xA;----brisbane.example.com/&#xA;--------index.php&#xA;--------.htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And set the &lt;code&gt;$craftPath&lt;/code&gt; variable in each &lt;code&gt;index.php&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-22T21:23:56.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15159" PostTypeId="2" ParentId="15138" CreationDate="2016-05-22T22:24:26.993" Score="4" Body="&lt;p&gt;You would need to setup two criteria models, one for each Smart Map field, and query for the element IDs. Merge these IDs and have a 3rd criteria model where you pass in the IDs to the &lt;code&gt;id&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this question for example code:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1948/complex-logic-on-a-elementcriteriamodel-parameter&quot;&gt;Complex logic on a ElementCriteriaModel parameter?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's a blog post describing the technique in details:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manipulating Craft's ElementCriteriaModel objects with Twig&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you need better performance, have a look at the custom Yii query builder code I posted here:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14618/how-can-i-query-for-entries-that-have-one-of-two-lightswitch-fields-enabled&quot;&gt;How can I query for entries that have one of two Lightswitch fields enabled?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-05-23T06:00:40.173" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15160" PostTypeId="2" ParentId="15157" CreationDate="2016-05-23T06:53:08.223" Score="5" Body="&lt;p&gt;&lt;strong&gt;Yes, it's definitely possible to cluster your markers with Smart Map.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In fact, anything that you can do with the Google Maps API can also be done with Smart Map:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/manipulating-the-map-in-javascript/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manipulating the map in JavaScript&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'd recommend adding the &lt;strong&gt;&lt;a href=&quot;https://github.com/googlemaps/js-marker-clusterer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Marker Clusterer&lt;/a&gt;&lt;/strong&gt; JS library to your project.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:35:37.887" LastActivityDate="2021-01-01T06:35:37.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15161" PostTypeId="1" CreationDate="2016-05-23T07:57:48.130" Score="1" ViewCount="441" Body="&lt;p&gt;We're using Dukt Videos to display a video on &lt;a href=&quot;http://www.adventurekent.org/services/schools/ks1-2/adventure-kent-in-action&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; of our website. However, the video no longer appears on the page and just shows the HTML for the iframe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what has happened?&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="4466" LastEditDate="2016-05-23T11:37:49.823" LastActivityDate="2016-05-23T17:30:16.670" Title="Video embed displays HTML code instead of video" Tags="&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15162" PostTypeId="2" ParentId="14882" CreationDate="2016-05-23T11:41:51.713" Score="2" Body="&lt;p&gt;Quite a simple solution set the criteria to uri and you just pass the endpoint as is as a catch all.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$normal =  preg_replace('/.json/', '', craft()-&amp;gt;request-&amp;gt;path);&#xA;return [&#xA;        'endpoints' =&amp;gt; [&#xA;            craft()-&amp;gt;request-&amp;gt;path =&amp;gt; [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['uri' =&amp;gt; $normal],&#xA;                'first' =&amp;gt; true,&#xA;                'transformer' =&amp;gt; new DetailTransformer(),&#xA;            ],&#xA;        ]&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2016-05-23T11:41:51.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15163" PostTypeId="1" CreationDate="2016-05-23T11:54:11.900" Score="3" ViewCount="499" Body="&lt;p&gt;I want to use two block types in one Matrix field. These blocks will be output in a div. At the moment my code adds a new &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; for each block type. How can I output two block types in the same &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;da-slider&quot; class=&quot;da-slider&quot;&amp;gt;&#xA;  {% for block in entry.homepageSlider %}&#xA;    &amp;lt;div class=&quot;da-slide&quot;&amp;gt;&#xA;      {% if block.type == &quot;sliderText&quot; %}&#xA;        &amp;lt;h2&amp;gt;{{ block.sliderHead }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ block.sliderText }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;a href=&quot;#&quot; class=&quot;da-link&quot;&amp;gt;{{ block.sliderButton }}&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {% if block.type == &quot;sliderImage&quot; %}&#xA;        {% set image = block.image.first() %}&#xA;        {% if image %}&#xA;          &amp;lt;div class=&quot;da-img&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('') }}&quot; width=&quot;{{ image.getWidth('') }}&quot; height=&quot;{{ image.getHeight('') }}&quot; align=&quot;{{ block.position }}&quot; alt=&quot;image01&quot;&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;      {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;nav class=&quot;da-arrows&quot;&amp;gt;&#xA;    &amp;lt;span class=&quot;da-arrows-prev&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;da-arrows-next&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/nav&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5060" LastEditorUserId="45" LastEditDate="2016-08-13T02:27:49.077" LastActivityDate="2016-08-13T02:27:49.077" Title="Using the Matrix field to output content in a slideshow" Tags="&lt;matrix&gt;&lt;block-types&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15164" PostTypeId="2" ParentId="15163" CreationDate="2016-05-23T12:15:58.877" Score="2" Body="&lt;p&gt;I reduced your code a little: You can use &lt;code&gt;elseif&lt;/code&gt; to cycle trough each block so you don't have to write each if statement. Now where do you want your div?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want each block with one separate div you write them inside the if statement (As I did in this example).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for block in entry.homepageSlider %}&#xA;    &amp;lt;div class=&quot;da-slide&quot;&amp;gt;&#xA;       {% if block.type == &quot;sliderText&quot; %}&#xA;         &amp;lt;div class=&quot;div-for-sliderText&quot;&amp;gt;{# content of first block #}&amp;lt;/div&amp;gt;&#xA;       {% elseif block.type == &quot;sliderImage&quot; %}&#xA;         &amp;lt;div class=&quot;div-for-sliderImage&quot;&amp;gt;{# content of second block #}&amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;     &amp;lt;/div&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to add the content of both blocks into one single div it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for block in entry.homepageSlider %}&#xA;    &amp;lt;div class=&quot;da-slide&quot;&amp;gt;&#xA;     &amp;lt;div class=&quot;all-blocks-in-one-single-div&quot;&amp;gt;&#xA;       {% if block.type == &quot;sliderText&quot; %}&#xA;         {# content of first block #}&#xA;       {% elseif block.type == &quot;sliderImage&quot; %}&#xA;         {# content of second block #}&#xA;        {% endif %}&#xA;     &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is basically what you already did. So I'm not sure If I understand what you are trying to accomplish.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="4215" LastEditDate="2016-05-23T14:53:37.947" LastActivityDate="2016-05-23T14:53:37.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15165" PostTypeId="1" AcceptedAnswerId="15174" CreationDate="2016-05-23T12:27:22.803" Score="1" ViewCount="504" Body="&lt;p&gt;I have a custom plugin in which I have a controller action which I want to validate some values and then update a custom field on the &lt;code&gt;Cart&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the values from the form and validate them, I'm just missing how to get them saved to the &lt;code&gt;Cart&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;cart-&amp;gt;setRawPostContent('orderShippingOptions', $myValue);&#xA;$this-&amp;gt;cart-&amp;gt;setContentFromPost('fields');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;cart-&amp;gt;setContentFromPost(['orderShippingOptions' =&amp;gt; $myValue]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm feel like I'm in the right area, I'm just missing something simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2019-03-19T11:53:49.837" Title="How can I update a custom Order field in a plugin controller?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15166" PostTypeId="1" CreationDate="2016-05-23T12:36:44.913" Score="7" ViewCount="1072" Body="&lt;p&gt;I want to update my Rich Text field so only &lt;code&gt;H1, H2 and H3&lt;/code&gt; are the available options in the 'Format' selector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4956" LastEditorUserId="344" LastEditDate="2016-05-23T13:19:03.290" LastActivityDate="2016-05-23T13:37:04.827" Title="Can I change which 'Format' options are available in my Rich Text field?" Tags="&lt;redactor&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15167" PostTypeId="2" ParentId="15165" CreationDate="2016-05-23T12:55:35.480" Score="3" Body="&lt;p&gt;Turns out I really overthought this one! It's exactly the same as you would usually do it in Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;cart-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'orderShippingOptions' =&amp;gt; $myValue&#xA;));&#xA;&#xA;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($this-&amp;gt;cart);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bit I was missing was &lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($this-&amp;gt;cart);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-05-23T12:55:35.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15168" PostTypeId="2" ParentId="15166" CreationDate="2016-05-23T13:05:27.757" Score="9" Body="&lt;p&gt;You certainly can using the Redactor &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/&quot;&gt;Formatting config&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locate the config file for the Redactor setting you want to edit in &lt;code&gt;craft/config/redactor&lt;/code&gt; and add this line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;formatting&quot;: [&quot;h1&quot;, &quot;h2&quot;, &quot;h3&quot;],&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or any combination of elements you want to be made available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those reading this who can't see the Formatting option for their Redactor field, it's also worth mentioning you need to have the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/buttons/&quot;&gt;Formatting button&lt;/a&gt; set up in the same config file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;buttons&quot;: [&quot;format&quot;],&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-05-23T13:05:27.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15169" PostTypeId="2" ParentId="15166" CreationDate="2016-05-23T13:37:04.827" Score="8" Body="&lt;p&gt;What I like to do is to override the default options of the Format dropdown by setting &lt;code&gt;&quot;formatting&quot;&lt;/code&gt; to null and adding my own list of options using &lt;code&gt;&quot;formattingAdd&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to come up with your own names for the options.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;  &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;link&quot;],&#xA;  &quot;formatting&quot;: null,&#xA;  &quot;formattingAdd&quot;: {&#xA;    &quot;h3&quot;: {&#xA;      title: 'Heading',&#xA;      args: ['h3']&#xA;    },&#xA;    &quot;p&quot;: {&#xA;      title: 'Normal text',&#xA;      args: ['p']&#xA;    },&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-05-23T13:37:04.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15170" PostTypeId="2" ParentId="15163" CreationDate="2016-05-23T13:44:24.953" Score="2" Body="&lt;p&gt;I think you'd be better off with your Matrix field, &lt;code&gt;entry.homepageSlider&lt;/code&gt; having only one block type called &lt;code&gt;Slide&lt;/code&gt;. This block type would then contain the fields for each slide such as &lt;code&gt;slideHead&lt;/code&gt;, &lt;code&gt;slideText&lt;/code&gt; and &lt;code&gt;slideImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then loop through each block (slide) to output fields within the same slide. If certain fields are not required you would wrap them in conditionals.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;da-slider&quot; class=&quot;da-slider&quot;&amp;gt;&#xA;  {% for block in entry.homepageSlider %}&#xA;    &amp;lt;div class=&quot;da-slide&quot;&amp;gt;&#xA;      // An example of a conditional checking for a completed field inside a content block.&#xA;      {% if block.slideHead|length %}&#xA;        &amp;lt;h2&amp;gt;{{ block.slideHead }}&amp;lt;/h2&amp;gt;&#xA;      {% endif %}&#xA;      &amp;lt;p&amp;gt;{{ block.slideText }}&amp;lt;/p&amp;gt;&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;da-link&quot;&amp;gt;{{ block.slideButton }}&amp;lt;/a&amp;gt;&#xA;&#xA;      {% set image = block.image.first() %}&#xA;      {% if image %}&#xA;        &amp;lt;div class=&quot;da-img&quot;&amp;gt;&#xA;          &amp;lt;img src=&quot;{{ image.getUrl('') }}&quot; width=&quot;{{ image.getWidth('') }}&quot; height=&quot;{{ image.getHeight('') }}&quot; align=&quot;{{ block.position }}&quot; alt=&quot;image01&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;nav class=&quot;da-arrows&quot;&amp;gt;&#xA;    &amp;lt;span class=&quot;da-arrows-prev&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;da-arrows-next&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/nav&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-23T13:44:24.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15171" PostTypeId="1" AcceptedAnswerId="15173" CreationDate="2016-05-23T16:25:47.710" Score="1" ViewCount="555" Body="&lt;p&gt;I'm currently using the Guest Entries plugin with a front-end form to accept contact form submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just wondering if it's possible to output a message on a successful form being saved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an ideal world this might include the name of the submitter but failing that just a plain message informing the user that the form has been submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Previously I've been able to access the craft.request.getPost('name') but I don't think this works when using this plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5093" LastActivityDate="2016-10-12T17:18:08.027" Title="Is it possible to output message on successful save with Guest Entries?" Tags="&lt;guest-entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15172" PostTypeId="2" ParentId="15161" CreationDate="2016-05-23T16:43:59.067" Score="3" Body="&lt;p&gt;You probably need to add the twig raw filter to your field variable. This will allow twig to interpret the data as safe HTML rather than just plain text.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myFieldVariable|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lear more about the raw filter here: &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/filters/raw.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4825" LastEditorUserId="57" LastEditDate="2016-05-23T17:30:16.670" LastActivityDate="2016-05-23T17:30:16.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15173" PostTypeId="2" ParentId="15171" CreationDate="2016-05-23T16:44:04.803" Score="2" Body="&lt;p&gt;You could append a query string on your redirect url that you can then query for in your template. I've used this to display different messages for a new post or an edited post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;my-photos?message=photo-added&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.request.getQuery( 'message' ) %}&#xA;&#xA;{% if message|length and message == 'photo-added' %}&#xA;  &amp;lt;p&amp;gt;Thank's for uploading your image&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To use fields from the saved entry you could use a plugin and watch for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;entries.onSaveEntry&lt;/a&gt; event that will fire when using the Guest Entries plugin. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'entries.onSaveEntry', function( Event $event ){&#xA;  // Grab the entry from post request&#xA;  $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;  // Add some conditionals so you only perform the redirect for the section you're posting to in the front end&#xA;&#xA;  $name = $entry-&amp;gt;getContent()-&amp;gt;fieldName;&#xA;&#xA;  // Render a template and pass the $name in&#xA;  //( not sure how to do this? )&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-23T18:06:33.893" LastActivityDate="2016-05-23T18:06:33.893" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15174" PostTypeId="2" ParentId="15165" CreationDate="2016-05-23T23:31:43.610" Score="3" Body="&lt;p&gt;You can do this directly as:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart-&amp;gt;setContentFromPost(array( 'someKey' =&amp;gt; $someValue ));&#xA;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($cart);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(You'll need the saveOrder step as you're in your own controller, but note e.g. if you're doing this in e.g. a Commerce shipping calculator plugin, you can skip this step for efficiency reasons as a saveOrder occurs at the end of that process anyway).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-23T23:31:43.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15175" PostTypeId="2" ParentId="3079" CreationDate="2016-05-24T02:45:45.360" Score="2" Body="&lt;p&gt;I need something like this and found a solution: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-languagelink&quot; rel=&quot;nofollow&quot;&gt;craft-languagelink&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: This solution does not work for what Adam needs.  &lt;/p&gt;&#xA;" OwnerUserId="5179" LastEditorUserId="5179" LastEditDate="2016-06-23T01:02:30.073" LastActivityDate="2016-06-23T01:02:30.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15176" PostTypeId="1" CreationDate="2016-05-24T07:51:31.577" Score="0" ViewCount="56" Body="&lt;p&gt;We are in the midst of building a few sites in craft and one in craft commerce; need some additional resources to get them completed.  Please message me back with some details of your experience / availability and hourly rate. Cheers Rob&lt;/p&gt;&#xA;" OwnerUserId="5180" LastEditorUserId="45" LastEditDate="2016-08-13T02:46:14.527" LastActivityDate="2016-08-13T02:46:14.527" Title="Developers Needed" Tags="&lt;ecommerce&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-05-24T14:27:49.483" ContentLicense="CC BY-SA 3.0" />
  <row Id="15178" PostTypeId="2" ParentId="15176" CreationDate="2016-05-24T08:21:39.133" Score="3" Body="&lt;p&gt;I'd recommend you join the Craft Slack and post this in the #jobs channel, you might get a better response!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/community#slack&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4119" LastActivityDate="2016-05-24T08:21:39.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15180" PostTypeId="1" AcceptedAnswerId="15182" CreationDate="2016-05-24T09:40:16.140" Score="1" ViewCount="84" Body="&lt;p&gt;How am I able to get or set additional properties on a Task model inside a plugin.&#xA;Eventually I would like to influence the &lt;code&gt;Totalsteps&lt;/code&gt; of a task.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$task = craft()-&amp;gt;tasks-&amp;gt;createTask('Reroute', 'Importing routes', array(&#xA;    'files' =&amp;gt; $files,&#xA;    'steps' =&amp;gt; count($files)&#xA;));&#xA;&#xA;class RerouteTask extends BaseTask&#xA;{&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return $this-&amp;gt;getSettings()-&amp;gt;steps;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is resulting in &lt;code&gt;Craft\TaskModel.steps is not defined&lt;/code&gt;.&#xA;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="4077" LastEditorUserId="4466" LastEditDate="2016-05-24T13:41:46.357" LastActivityDate="2016-05-24T13:41:46.357" Title="How can I access or set a Task's properties inside a class or method?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15181" PostTypeId="1" AcceptedAnswerId="15489" CreationDate="2016-05-24T09:44:43.393" Score="2" ViewCount="264" Body="&lt;p&gt;So, a date field can be added to a plugin template within the control panel using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% from &quot;_includes/forms&quot; import date %}&#xA;{{ date({&#xA;        id: 'fields-invoiceDate',&#xA;        name: 'fields[invoiceDate]'&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do you go about adding an assets field a similar way?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-06-13T16:23:13.163" Title="How to add assets field to control panel plugin template" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15182" PostTypeId="2" ParentId="15180" CreationDate="2016-05-24T10:16:20.107" Score="2" Body="&lt;p&gt;Have you defined the settings and their type in your Task file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had success using the array of things passed to the task to set the total steps like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class RerouteTask extends BaseTask&#xA;{&#xA;&#xA;  protected function defineSettings()&#xA;  {&#xA;    // Files passed from controller&#xA;      return array(&#xA;        'files' =&amp;gt; AttributeType::Mixed,&#xA;      );&#xA;  }&#xA;&#xA;  public function getTotalSteps()&#xA;  {&#xA;    return count( $this-&amp;gt;getSettings()-&amp;gt;files );&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then inside a controller you create the task.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$task = craft()-&amp;gt;tasks-&amp;gt;createTask('Reroute', 'Importing routes', array(&#xA;  'files' =&amp;gt; $files&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-24T10:16:20.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15183" PostTypeId="1" AcceptedAnswerId="15184" CreationDate="2016-05-24T10:37:04.090" Score="2" ViewCount="88" Body="&lt;p&gt;I'm sure I've seen this documented somewhere but can't for the life of me find it. After login I need to check the user's profile for an empty field (e.g. phone number) and redirect them to a reminder to complete that field if empty. I guess this can be done via an intermediary page but I'm sure I saw a better solution somewhere. Any help?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="4466" LastEditDate="2016-05-24T12:40:46.300" LastActivityDate="2016-05-24T12:40:46.300" Title="How can I check a user has completed a field in their profile after log in?" Tags="&lt;login&gt;&lt;user-profile&gt;&lt;member&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15184" PostTypeId="2" ParentId="15183" CreationDate="2016-05-24T11:05:26.827" Score="2" Body="&lt;p&gt;If you have a front end form for user registration then you should mark the fields as required in the CMS, you can then make use of Crafts form validation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a project where we imported user data that didn't contain all required fields so needed to redirect users, after they signed in for the first time, to their profile page if data was missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I achieved this using a Plugin that contains a service that set a &quot;status&quot; for the current user. The service checked for several different fields and their values and also checked that the user had entered all required fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function setUserStatus( $user ){&#xA;    // Get whether user has agreed to current years terms&#xA;    $userAgreedToTerms = ( $user-&amp;gt;getContent()-&amp;gt;agreedCurrentYearsRules == 1 );&#xA;&#xA;    // Use craft validate() function to find ask if user has completed all required fields in profile&#xA;    $userHasCompletedProfile = $user-&amp;gt;validate() &amp;amp;&amp;amp; craft()-&amp;gt;content-&amp;gt;validateContent( $user );&#xA;&#xA;    if ( $userAgreeToTerms ){&#xA;      $userStatus = 'AgreedToTerms';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then used the results of these checks to set a cookie with the &quot;status&quot; of the user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Sets a cookie which is used to determine where the user should be re-directed to&#xA;$cookie = new HttpCookie( 'userStatus', $userStatus, [ 'expire' =&amp;gt; time() + 10 ] );&#xA;craft()-&amp;gt;request-&amp;gt;getCookies()-&amp;gt;add( $cookie-&amp;gt;name, $cookie );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The function was run from the template using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.pluginName.setUserStatus( currentUser ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the result of the check was used to redirect the user to the template I needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userStatus = craft.request.getCookie( 'userStatus' ) %}&#xA;&#xA;{% if ( userStatus == 'needsToPay' ) and ( site_area != 'payment' ) %}&#xA;  {% redirect 'payment' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this provides you with enough to create something that works for your case.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-24T11:05:26.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15185" PostTypeId="2" ParentId="14741" CreationDate="2016-05-24T12:39:25.420" Score="1" Body="&lt;p&gt;Looking further into the problem, I've found that the page tries to do a post request to the other domain. It calls upon the action function in the &lt;code&gt;UsersController.php&lt;/code&gt; file (&lt;code&gt;Location: /craft/app/controllers/&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But because the user isn't logged in on the other domain and anonymous access isn't allowed for this action. You get redirected to /login to login on that domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/12268/635&quot;&gt;https://craftcms.stackexchange.com/a/12268/635&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The developers managed to solve this problem? This applies to almost all controllers require session.&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-05-24T13:30:24.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15186" PostTypeId="1" CreationDate="2016-05-24T13:53:41.127" Score="2" ViewCount="194" Body="&lt;p&gt;It occurred to me that in every case I was using Element API, I wanted a standardized way of requesting, as the only thing that needed to change was my transformers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seemed helpful to standardize the way the input requests were made, and rely solely on transformers for customization.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-05-24T13:53:41.127" Title="Standardize Element API requests" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15187" PostTypeId="2" ParentId="15186" CreationDate="2016-05-24T13:53:41.127" Score="2" Body="&lt;p&gt;Here's what I came up with: &lt;a href=&quot;https://gist.github.com/timkelty/8de8531df688b6ac08d2da0713b6ff00&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/timkelty/8de8531df688b6ac08d2da0713b6ff00&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to pass everything through request params, including specifying the transformer class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now it looks for the transformer in the &lt;code&gt;elementapi&lt;/code&gt; folder: &lt;code&gt;plugins/elementapi/ElementApi_MyCustomThingTransformer.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a full-fledged CRUD API is baked into 3.0, I'm assuming this will be irrelevant by then.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-05-24T13:53:41.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15188" PostTypeId="1" AcceptedAnswerId="15197" CreationDate="2016-05-24T14:00:17.393" Score="2" ViewCount="375" Body="&lt;p&gt;I'm trying to create a command line function, in my plugin, to import some data into entries. The problem is that the &lt;code&gt;Craft\EntriesService-&amp;gt;saveEntry()&lt;/code&gt; method seems to call the &lt;code&gt;Craft\TemplatesService-&amp;gt;renderObjectTemplate()&lt;/code&gt; method which uses the &lt;code&gt;SERVER_NAME&lt;/code&gt;constant. Obviously there is no &lt;code&gt;SERVER_NAME&lt;/code&gt; because the application is being run from the command line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to manually set this, or can this be bypassed in any other way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will include my stack trace here as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Error[8]: Undefined index: SERVER_NAME in file myproject/craft/app/framework/web/CHttpRequest.php at line 352&#xA;0 myproject/craft/app/etc/console/ConsoleApp.php(252): Craft\ConsoleApp-&amp;gt;handleError()&#xA;1 myproject/craft/app/framework/web/CHttpRequest.php(352): Craft\ConsoleApp-&amp;gt;handleError()&#xA;2 myproject/craft/app/services/ConfigService.php(420): Craft\HttpRequestService-&amp;gt;getHostInfo()&#xA;3 myproject/craft/app/helpers/UrlHelper.php(422): Craft\ConfigService-&amp;gt;usePathInfo()&#xA;4 myproject/craft/app/helpers/UrlHelper.php(196): _getUrl()&#xA;5 myproject/craft/app/etc/templating/twigextensions/CraftTwigExtension.php(493): getUrl()&#xA;6 myproject/craft/app/vendor/twig/twig/lib/Twig/Environment.php(1276): Craft\CraftTwigExtension-&amp;gt;getGlobals()&#xA;7 myproject/craft/app/vendor/twig/twig/lib/Twig/Environment.php(1200): Craft\TwigEnvironment-&amp;gt;initGlobals()&#xA;8 myproject/craft/app/vendor/twig/twig/lib/Twig/Environment.php(1217): Craft\TwigEnvironment-&amp;gt;getGlobals()&#xA;9 myproject/craft/app/vendor/twig/twig/lib/Twig/Template.php(355): Craft\TwigEnvironment-&amp;gt;mergeGlobals()&#xA;10 myproject/craft/app/vendor/twig/twig/lib/Twig/Template.php(366): __TwigTemplate_5f77fd774cac1595e134b05c66db80e7998372598504ff29b7e2487f820a3d8c-&amp;gt;display()&#xA;11 myproject/craft/app/services/TemplatesService.php(336): __TwigTemplate_5f77fd774cac1595e134b05c66db80e7998372598504ff29b7e2487f820a3d8c-&amp;gt;render()&#xA;12 myproject/craft/app/services/EntriesService.php(157): Craft\TemplatesService-&amp;gt;renderObjectTemplate()&#xA;13 myproject/craft/plugins/myplugin/services/Myproject_SomeService.php(312): Craft\EntriesService-&amp;gt;saveEntry()&#xA;14 myproject/craft/plugins/myplugin/services/Myproject_SomeService.php(280): Craft\Myproject_SomeService-&amp;gt;update()&#xA;15 myproject/craft/plugins/myplugin/consolecommands/ImportEmployeeCommand.php(24): Craft\Myproject_SomeService-&amp;gt;createOrUpdate()&#xA;16 unknown(0): Craft\ImportCommand-&amp;gt;actionImport()&#xA;17 myproject/craft/app/framework/console/CConsoleCommand.php(172): ReflectionMethod-&amp;gt;invokeArgs()&#xA;18 myproject/craft/app/framework/console/CConsoleCommandRunner.php(71): Craft\ImportCommand-&amp;gt;run()&#xA;19 myproject/craft/app/framework/console/CConsoleApplication.php(92): Craft\ConsoleCommandRunner-&amp;gt;run()&#xA;20 myproject/craft/app/framework/base/CApplication.php(185): Craft\ConsoleApp-&amp;gt;processRequest()&#xA;21 myproject/craft/app/etc/console/yiic.php(81): Craft\ConsoleApp-&amp;gt;run()&#xA;22 myproject/craft/app/etc/console/yiic(4): require_once()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="45" LastEditDate="2016-05-24T16:30:28.790" LastActivityDate="2016-06-23T17:56:56.867" Title="Entry not saving through command line" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15190" PostTypeId="1" AcceptedAnswerId="15194" CreationDate="2016-05-24T14:55:39.350" Score="4" ViewCount="322" Body="&lt;p&gt;If I have three environments; local, dev, and live, and want assets to be setup like this:    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;local: stored in a local directory (/public/uploads)&lt;br&gt;&#xA;dev: stored on S3 dev bucket&lt;br&gt;&#xA;live: stored on S3 live bucket    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to set this in a multi-environment config?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="3481" LastEditDate="2016-05-24T15:40:13.100" LastActivityDate="2018-04-19T16:18:48.910" Title="Multi-Environment S3 Asset Paths" Tags="&lt;multi-environment&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15191" PostTypeId="1" CreationDate="2016-05-24T15:11:24.033" Score="2" ViewCount="601" Body="&lt;p&gt;I'm trying out the Craft Commerce plugin, and i'd like be able to let users order products with a custom price based on a choosen weight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The price is now fixed to what you choose in the control panel, and there seems to be no easy way around that, but perhaps i'm wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? It's pretty crucial feature i need, so any help is appreciated :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers, Bob&lt;/p&gt;&#xA;" OwnerUserId="3829" LastActivityDate="2016-06-13T16:05:07.417" Title="Craft Commerce, variable product prices based on weight. Is this possible?" Tags="&lt;ecommerce&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15192" PostTypeId="1" CreationDate="2016-05-24T15:17:41.053" Score="1" ViewCount="93" Body="&lt;p&gt;I have two different event types in my Events channel. The first one is events and it is very straightforward: Title, Description, Date. The other one is films and it is a little more complex: Title, Description, Screening(s) - which is 1 or more Date/Time. (I am using a supertable to allow the user to add as many screenings as they would like).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have it set up like this to keep the administration of the content as DRY as possible - as all screenings of a movie will share the same description, title and other meta data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to display all of my events and film screenings in an agenda view - sorted by date. How do I accomplish something like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem, if it isn't obvious, is that screenings from films could be staggered amongst screenings from other films so a simple for loop doesn't do the trick. I need to get all of the events and screenings (an individual screening being an &quot;event&quot; in this case) into an array that I can sort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any ideas or tips ahead of time.&lt;/p&gt;&#xA;" OwnerUserId="5183" LastActivityDate="2016-06-23T19:56:56.853" Title="How do I sort and display event entries when each event can have multiple start times?" Tags="&lt;datetime&gt;&lt;events&gt;&lt;sorting&gt;&lt;array&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15193" PostTypeId="2" ParentId="15191" CreationDate="2016-05-24T16:07:54.460" Score="2" Body="&lt;p&gt;1oz = $1 ∴ 10oz = $10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sell in units of weight as the quantity of the item.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2016-05-24T16:07:54.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15194" PostTypeId="2" ParentId="15190" CreationDate="2016-05-24T16:10:38.983" Score="5" Body="&lt;p&gt;Unfortunately, this isn't currently possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/836&quot; rel=&quot;nofollow noreferrer&quot;&gt;This feature request&lt;/a&gt; is very similar to what you're requesting... however, it would still require that all of your environments use the same &lt;em&gt;type&lt;/em&gt; of asset source.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2017-08-24T18:09:53.653" LastActivityDate="2017-08-24T18:09:53.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15195" PostTypeId="2" ParentId="15191" CreationDate="2016-05-24T16:17:04.940" Score="1" Body="&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: A new &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;nofollow&quot;&gt;onPopulateLineItem event&lt;/a&gt; was added to Craft Commerce to enable this exact use case of modifying an items price when added to a users basket. You could use it to get the items weight and multiply it by a value.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what kind of product model you have to want to do this but a possible solution you might want to look at is charging shipping rates based on a products weight. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set up a Shipping Method with a rule that uses the weight of an item multiplied by a &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods#getweightrate&quot; rel=&quot;nofollow&quot;&gt;Weight Rate&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-13T16:05:07.417" LastActivityDate="2016-06-13T16:05:07.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15196" PostTypeId="1" AcceptedAnswerId="15198" CreationDate="2016-05-24T16:42:39.450" Score="1" ViewCount="348" Body="&lt;p&gt;I would like to display the date that the site was last updated. This date is the same as the last entry added to a specific category. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2016-05-24T16:57:41.330" Title="How can I display dateUpdated for the most recent updated entry in a category?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15197" PostTypeId="2" ParentId="15188" CreationDate="2016-05-24T16:43:15.953" Score="1" Body="&lt;p&gt;I'm assuming you're using a multi-environment config.  From wherever your plugin is bootstrapping &lt;code&gt;yiic&lt;/code&gt;, you need to manually set the &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-environment&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;&lt;/a&gt; PHP constant to the environment you want &lt;code&gt;yiic&lt;/code&gt; to load in the config files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-24T16:43:15.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15198" PostTypeId="2" ParentId="15196" CreationDate="2016-05-24T16:57:41.330" Score="2" Body="&lt;p&gt;You can &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;order&lt;/a&gt; entries by &lt;code&gt;dateUpdated&lt;/code&gt; in descending order and then get the first entry. You would use that entries &lt;code&gt;dateUpdated&lt;/code&gt; field to show when the site was last updated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.order( 'dateUpdated desc' ).first() %}&#xA;{{ entry.dateUpdated }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-24T16:57:41.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15199" PostTypeId="1" AcceptedAnswerId="15200" CreationDate="2016-05-24T17:36:17.270" Score="3" ViewCount="102" Body="&lt;p&gt;I'm trying to get something working and I keep breaking my internal links doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'd like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;public/index.html (this page would be the language select screen and can be dealt with outside the cms)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;public/fr/index.php (craft loader for french)&#xA;public/en/index.php (craft loader for english)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like the CP to load from the root.  I thought of having it redirect to a &quot;craft.php&quot; page that would be the loader if the requested file doesn't exist, and it worked for the CP.  But of course, it grabs any of the calls to the site that is not fr/ or en/ only.  As soon as there's something else in the uri, it goes to 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea for this one?&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2016-05-26T14:14:17.543" Title="Multi-lingual site with a splash (language select screen) at the root" Tags="&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15200" PostTypeId="2" ParentId="15199" CreationDate="2016-05-24T17:58:55.227" Score="5" Body="&lt;p&gt;Well that was easy enough.  I had forgotten about the &lt;code&gt;.htaccess&lt;/code&gt; in the subfolders.  Everything works like planned now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public/.htaccess&lt;/code&gt; (redirects to craft.php if file doesn't exist)&lt;br&gt;&#xA;&lt;code&gt;public/index.html&lt;/code&gt; (splash page)&lt;br&gt;&#xA;&lt;code&gt;public/craft.php&lt;/code&gt; (craft loader)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public/fr/.htaccess&lt;/code&gt; (redirects to index.php if file doesn't exist)&lt;br&gt;&#xA;&lt;code&gt;public/fr/index.php&lt;/code&gt; (craft loader for french)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public/en/.htaccess&lt;/code&gt; (redirects to index.php if file doesn't exist)&lt;br&gt;&#xA;&lt;code&gt;public/en/index.php&lt;/code&gt; (craft loader for english)&lt;/p&gt;&#xA;" OwnerUserId="3524" LastEditorUserId="3524" LastEditDate="2016-05-26T14:14:17.543" LastActivityDate="2016-05-26T14:14:17.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15201" PostTypeId="1" AcceptedAnswerId="15202" CreationDate="2016-05-24T18:40:30.097" Score="5" ViewCount="3519" Body="&lt;p&gt;Is it possible to output only the first word of the title of an entry in a template? If so, how? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2016-10-15T18:10:12.100" Title="How Can I Output Only the First Word of the Title of an Entry in a Template?" Tags="&lt;templating&gt;&lt;titles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15202" PostTypeId="2" ParentId="15201" CreationDate="2016-05-24T18:55:06.813" Score="12" Body="&lt;p&gt;Yes, you can do this with Twig alone. Here's how:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title|split(' ')|slice(0, 1)|join }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This series of Twig filters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Uses &lt;code&gt;split&lt;/code&gt; to turn the title into an array, splitting on spaces.&lt;/li&gt;&#xA;&lt;li&gt;Passes that array through &lt;code&gt;slice&lt;/code&gt; to grab the first item in the array.&lt;/li&gt;&#xA;&lt;li&gt;Then uses &lt;code&gt;join&lt;/code&gt; to turn the array back into a string for output. The array is now just one item (the first word of the title), but &lt;code&gt;join&lt;/code&gt; is needed because Twig doesn't want to treat an array as a string.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="248" LastEditorUserId="248" LastEditDate="2016-10-15T17:15:21.300" LastActivityDate="2016-10-15T17:15:21.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15203" PostTypeId="1" CreationDate="2016-05-24T18:55:55.173" Score="1" ViewCount="318" Body="&lt;p&gt;A client is reporting that users are attempting sign up but receiving activation emails with no activation link present, simply a blank space where the {{link}} tag is placed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are unable to re-create the issue at our end. Domain name settings have been verified, we are only using one domain and prefix (www diverts to non-www address).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the screenshot below, the link shouls appear after 'following link:'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;To activate your account, please click the following link, or copy-paste it into your browser:&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;p class=&quot;activation-link&quot;&amp;gt;&amp;lt;strong&amp;gt;{{link}}&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;When the site opens, simply log in to view the Option Grids&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone had any similar issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LgM9Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LgM9Q.png&quot; alt=&quot;email screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="470" LastEditorUserId="470" LastEditDate="2016-05-25T11:40:23.687" LastActivityDate="2016-05-25T11:40:23.687" Title="Activation link missing from activation email" Tags="&lt;users&gt;&lt;emails&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15204" PostTypeId="2" ParentId="15192" CreationDate="2016-05-24T19:20:54.923" Score="1" Body="&lt;p&gt;One thing you could do is have all screenings be Events, and then have Films be a type which contains the film's data, but &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;use relationships&lt;/a&gt; to link to multiple Events which are the film's screening times. You could even have Events have two entry types: Events and Film Screenings (or something similar to this) so they could be displayed differently in the agenda view, and Film Screenings could link back to their parent Film entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's more information about using relationships and reverse relationships: &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this solution would fit your needs, but given my understanding of your issue, I think this is how I'd try to tackle it.&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2016-05-24T19:20:54.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15205" PostTypeId="1" AcceptedAnswerId="15210" CreationDate="2016-05-24T23:27:46.957" Score="3" ViewCount="426" Body="&lt;p&gt;I've looked through several StackExchange threads without specifics on how ImageMagick is tied into Craft. Web host says the binary is installed on server but not the module. Is the PHP module required?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;we looked into this further, and found that we do not have the ImageMagick PHP module installed, but we do have the binary. I'm not sure if Craft needs the PHP module, but if it does, that would be the reason for this not working.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3721" LastActivityDate="2016-05-25T03:40:50.233" Title="Specifics on ImageMagick and animated GIFs" Tags="&lt;gif&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15206" PostTypeId="1" AcceptedAnswerId="15207" CreationDate="2016-05-24T23:38:03.853" Score="2" ViewCount="1110" Body="&lt;p&gt;I'm writing a plugin, and used plugin.io to generate my scaffolding.  In my controller I am attempting to call a service, and getting an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my service code from my generated plugin it lives at &lt;code&gt;fulcrumdonation/services/FulcrumDonation_FulcrumCyberSourceService.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class FulcrumDonation_FulcrumCyberSourceService extends BaseApplicationComponent&#xA;{&#xA;    /**&#xA;     *&#xA;     * From any other plugin file, call it like this:&#xA;     *&#xA;     *     craft()-&amp;gt;fulcrumDonation_FulcrumCyberSource-&amp;gt;exampleService()&#xA;     */&#xA;    public function exampleService()&#xA;    {&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And just as the scaffolding suggests, I'm attempting to call this function in the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;fulcrumDonation_FulcrumCyberSource-&amp;gt;exampleService();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I add that line of code in the controller I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\WebApp.fulcrumDonation_FulcrumCyberSource&quot; is not&#xA;  defined.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="5169" LastActivityDate="2016-05-25T00:27:41.187" Title="How do I call a service from my controller in a plugin?" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;services&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15207" PostTypeId="2" ParentId="15206" CreationDate="2016-05-24T23:42:13.687" Score="4" Body="&lt;p&gt;Try it with a lowercase &lt;code&gt;f&lt;/code&gt; in the middle...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;fulcrumDonation_fulcrumCyberSource-&amp;gt;exampleService();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-24T23:42:13.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15209" PostTypeId="1" CreationDate="2016-05-25T02:24:05.430" Score="1" ViewCount="229" Body="&lt;p&gt;Love hear thoughts on the complexity of this or if anyone has something off the shelf to offer. Thanks&lt;/p&gt;&#xA;" OwnerUserId="5185" LastEditorUserId="45" LastEditDate="2016-05-25T04:05:28.567" LastActivityDate="2016-05-25T04:05:28.567" Title="Has anybody built a plugin or API integration with Xero or Cin7?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15210" PostTypeId="2" ParentId="15205" CreationDate="2016-05-25T03:40:50.233" Score="4" Body="&lt;p&gt;For &lt;a href=&quot;https://craftcms.com/docs/requirements#optional-php-extensions&quot; rel=&quot;nofollow&quot;&gt;Craft&lt;/a&gt; to use it, yes the ImageMagick PHP extension is required because Craft uses &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/36010cd04207eae1c5cb4c8be133cf85454b4f84/app/vendor/imagine/imagine/lib/Imagine/Imagick/Imagine.php&quot; rel=&quot;nofollow&quot;&gt;PHP's bindings&lt;/a&gt; in the library they're using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the host's OS, it should be a package manager update away. Any decent host should be able get it working incident free.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-05-25T03:40:50.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15211" PostTypeId="2" ParentId="15209" CreationDate="2016-05-25T04:04:16.583" Score="1" Body="&lt;p&gt;I don't believe so. The complete list of known plugins can be found here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-25T04:04:16.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15212" PostTypeId="1" CreationDate="2016-05-25T04:14:39.917" Score="2" ViewCount="802" Body="&lt;p&gt;I am trying to index 1.8GB of assets to an asset source on Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created an Asset Source which points to the folder with all of the assets. When I select the Asset Source I want to update the index for and select &quot;Go&quot; the loading screen runs for a while, then shows me a confirmation checkbox, but nothing has happened.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-06-20T07:36:34.573" Title="Update Asset Indexes not working for large number of assets" Tags="&lt;assets&gt;&lt;memory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15213" PostTypeId="2" ParentId="15212" CreationDate="2016-05-25T04:14:39.917" Score="4" Body="&lt;p&gt;While Craft appears to give you a success message when the Update Asset Index modal displays a pretty checkbox, when working with a large number of assets, if you don't see a loading bar appear or see the indexed assets afterwards, it's possible you are running into a memory issue, and that pretty checkbox is lying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likely, if you look at your &lt;code&gt;craft/storage/logs/phperrors.log&lt;/code&gt; you will find a memory error. Try increasing the &lt;a href=&quot;https://craftcms.com/docs/config-settings#phpMaxMemoryLimit&quot; rel=&quot;nofollow&quot;&gt;memory available to your Craft install&lt;/a&gt; or increasing the &lt;code&gt;memory_limit&lt;/code&gt; in your &lt;code&gt;php.ini&lt;/code&gt; settings and trying again.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-05-25T04:14:39.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15214" PostTypeId="1" AcceptedAnswerId="15219" CreationDate="2016-05-25T08:23:19.403" Score="1" ViewCount="189" Body="&lt;p&gt;I am writing a new plugin to hook into a POST event from a bespoke form plugin called &quot;Capture&quot;. The Capture plugin fires two different events; the code taken from &lt;code&gt;/craft/plugins/capture/services/Capture_SubmissionsService.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforePost(Event $event) {&#xA;    $this-&amp;gt;raiseEvent('onBeforePost', $event);&#xA;}&#xA;&#xA;public function onPost(Event $event) {&#xA;    $this-&amp;gt;raiseEvent('onPost', $event);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I called die(); inside each one so I know they are being called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My new plugin is very simple. I would like to be able to hook into the onPost event and receive the form data. My plugin is very simple for now as I am just concerned with hooking into the event. The below example has getName, getDeveloper, getDescription, getVersion etc removed for ease of reading. This is the only file in my plugin: &lt;code&gt;/craft/plugins/myplugin/MyPlugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin extends BasePlugin {&#xA;&#xA;   public function init() {&#xA;      craft()-&amp;gt;on('capture.onPost', function(Event $event){&#xA;         die('onPost &amp;lt;pre&amp;gt;'.print_r($event,true).'&amp;lt;/pre&amp;gt;');&#xA;      });&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't seem to be get called. I am assuming that I need something other than &lt;code&gt;capture.onPost&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the following docs, but would appreciate any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/hooks-and-events&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/events-reference&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-25T12:13:15.007" Title="How do I hook into Capture form onPost event?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15215" PostTypeId="1" AcceptedAnswerId="15216" CreationDate="2016-05-25T08:37:13.703" Score="1" ViewCount="148" Body="&lt;p&gt;Is it possible to somehow notify the user from a completing task?&#xA;I am walking trough a set of .csv files and on completion i would like to notify the user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// last step&#xA;$stepIndex = $step + 1;&#xA;if ( $stepIndex == $this-&amp;gt;getTotalSteps() )&#xA;{&#xA;    craft()-&amp;gt;userSession-&amp;gt;getFlash('notice', 'Reroutes  imported.');&#xA;    // craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Reroutes   imported.'));&#xA;    // craft()-&amp;gt;userSession-&amp;gt;getFlashes();&#xA;}&#xA;&#xA;return true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried with the &lt;code&gt;UserSessionService&lt;/code&gt; but i guess that won't work because the task is running separately from the session. If so reloading the page would be a good alternative but how can I let the front-end know of the task being completed.&lt;/p&gt;&#xA;" OwnerUserId="4077" LastActivityDate="2016-05-25T10:11:50.593" Title="How to notify the user from a Task" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;tasks&gt;&lt;plugin-pushnotifications&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15216" PostTypeId="2" ParentId="15215" CreationDate="2016-05-25T10:06:31.600" Score="3" Body="&lt;p&gt;The simple way to do this would be to log a message to your Plugin's custom log using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ExamplePlugin::log( 'TaskName has completed' );&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would require the user to visit the log and refresh to see if the task had completed - not ideal!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you wanted something that updated as the task was being run you could possibly redirect them to a Plugin template with a text area that  displays a log for the task where you could show completion of each step of the task and then finally a &quot;Completed Task&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create task&#xA;$task = craft()-&amp;gt;tasks-&amp;gt;createTask( 'TaskName', 'desc' ), array(&#xA;  'products' =&amp;gt; $products&#xA;));&#xA;&#xA;// Set session notice for start&#xA;craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Import process started.'));&#xA;&#xA;// Redirect to Plugin template page that displays a log&#xA;$this-&amp;gt;redirect( 'templateName?task=' . $task-&amp;gt;id );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then inside the task you could log messages to be displayed in that template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($step === $this-&amp;gt;getTotalSteps()-1) {&#xA;  Log::message( 'Task finished.' );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-25T10:11:50.593" LastActivityDate="2016-05-25T10:11:50.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15217" PostTypeId="1" AcceptedAnswerId="15232" CreationDate="2016-05-25T11:47:57.143" Score="1" ViewCount="448" Body="&lt;p&gt;I'm thinking about ways to implement this but don't instinctively know the best route in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our infrastructure is in AWS and, due to other applications, we have access to a read-replica DB instance alongside the master instance. I'm wondering about how to write an extension/plugin that would direct all &lt;code&gt;SELECT&lt;/code&gt; requests to either the master OR the slave, and all &lt;code&gt;INSERT / UPDATE / DELETE&lt;/code&gt; requests to the master only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some possible paths for incorporating this?&lt;/p&gt;&#xA;" OwnerUserId="3729" LastEditorUserId="3729" LastEditDate="2016-05-25T18:00:05.247" LastActivityDate="2019-12-09T03:40:05.423" Title="Implementing Read-Replica (slave) database connections" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15218" PostTypeId="1" AcceptedAnswerId="15223" CreationDate="2016-05-25T11:56:42.527" Score="3" ViewCount="6166" Body="&lt;p&gt;I have a page that lists all entries from the section 'work'. I would like the user to be able to filter these entries by category but via ajax so I don't have to go to a new page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('work').limit(null).search('categories:hotel') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but each category has to have its own page. Is it possibly to load the filtered entries by ajax? Something using {% if craft.request.isAjax %}?&#xA;Here is the relevant html:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&quot;filters&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;categories&quot;&amp;gt;Categories&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work') }}&quot;&amp;gt;All&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work/hotel') }}&quot;&amp;gt;Hotel&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work/bar') }}&quot;&amp;gt;Bar&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work/club') }}&quot;&amp;gt;Club&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work/restaurant') }}&quot;&amp;gt;Restaurant&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('work/retail') }}&quot;&amp;gt;Retail&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% set entries = craft.entries.section('work').limit(null) %}&#xA;    &amp;lt;div class=&quot;projects&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li class=&quot;project&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                        {% for asset in entry.mainPhoto %}&#xA;                            &amp;lt;div class=&quot;unveil-wrapper&quot;&amp;gt;&#xA;                                &amp;lt;img class=&quot;unveil&quot; src=&quot;{{ url('assets/images/placeholder.png') }}&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        {% endfor %}&#xA;                        &amp;lt;p class=&quot;name&quot;&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;address&quot;&amp;gt;{{ entry.address }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2016-05-26T03:48:44.947" Title="How to load entries via ajax when a filter is clicked?" Tags="&lt;entries&gt;&lt;filter&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15219" PostTypeId="2" ParentId="15214" CreationDate="2016-05-25T12:13:15.007" Score="1" Body="&lt;p&gt;I found the answer in a bit of a clumsy way, but the capture plugin has two services, &lt;code&gt;capture_forms&lt;/code&gt; and &lt;code&gt;capture_submissions&lt;/code&gt;. The first deals with saving the forms within the CraftCMS admin, the latter is for dealing with the form submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had to simply change my listener to &lt;code&gt;craft()-&amp;gt;on('capture_submissions.onPost', function(Event $event){...});&lt;/code&gt; and I can see the event data.&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-25T12:13:15.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15220" PostTypeId="1" AcceptedAnswerId="15228" CreationDate="2016-05-25T15:39:02.433" Score="2" ViewCount="1359" Body="&lt;p&gt;Currently involved with handling the CategoryModel and using this code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        // Category    &#xA;    'category/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;        require craft()-&amp;gt;path-&amp;gt;getConfigPath().'controllers/CategoryTransformer.php';&#xA;        return [&#xA;            'elementType' =&amp;gt; 'Category',&#xA;            'criteria' =&amp;gt; ['group' =&amp;gt; $slug],&#xA;            'transformer' =&amp;gt; new CategoryTransformer(),&#xA;        ];&#xA;    },&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;refering to CategoryTransformer.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CategoryTransformer extends CategoryFieldTransformer&#xA;{&#xA;    var $entry, $typeMedia;&#xA;    public function transform(CategoryModel $entry)&#xA;    {&#xA;        echo $entry['uri'].&quot;&#xA;        &quot;;&#xA;        $child = $entry-&amp;gt;getChildren();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works all though I am not having success with been able to build a hierarchical object that would have parent and child nodes for the API to return.&#xA;I made a modest attempt at building the categories in another area of the API interface but did not return what I was hoping for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function type_categories($mixedArray){&#xA;    $categories = array();&#xA;    foreach($mixedArray as $rkey =&amp;gt; $rvalue){&#xA;        $level = $mixedArray[$rkey]-&amp;gt;level - 1;&#xA;        $argt = array(&#xA;            'id' =&amp;gt; $mixedArray[$rkey]-&amp;gt;id,&#xA;            'uri' =&amp;gt; $mixedArray[$rkey]-&amp;gt;uri,&#xA;            'title' =&amp;gt; $mixedArray[$rkey]-&amp;gt;title,&#xA;            'level' =&amp;gt; $mixedArray[$rkey]-&amp;gt;level,&#xA;            'slug' =&amp;gt; $mixedArray[$rkey]-&amp;gt;slug,&#xA;            'groupId' =&amp;gt; $mixedArray[$rkey]-&amp;gt;groupId,&#xA;            'level' =&amp;gt; $mixedArray[$rkey]-&amp;gt;level&#xA;            );&#xA;        // Children&#xA;        $obg = $mixedArray[$rkey]-&amp;gt;children;&#xA;        $kids = array();&#xA;        foreach($obg as $kid =&amp;gt; $kidval){&#xA;          $kids[] = array(&#xA;            'id' =&amp;gt; $obg[$kid]-&amp;gt;id,&#xA;            'uri' =&amp;gt; $obg[$kid]-&amp;gt;uri,&#xA;            'title' =&amp;gt; $obg[$kid]-&amp;gt;title,&#xA;            'level' =&amp;gt; $obg[$kid]-&amp;gt;level,&#xA;            'slug' =&amp;gt; $obg[$kid]-&amp;gt;slug,&#xA;            'groupId' =&amp;gt; $obg[$kid]-&amp;gt;groupId,&#xA;            'level' =&amp;gt; $obg[$kid]-&amp;gt;level&#xA;            );&#xA;        } &#xA;        $argt['children'] = $kids;                                                                    &#xA;        $categories[$level][] = $argt;                                        &#xA;    }&#xA;    return $categories;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I as well took a peek at CategoriesController.php in the core and couldn't find anything that could assist me. It ends with Twig handling the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible if anyone has done something similar that I may reference to build a clean object which is intuitive for someone to loop on in JSON format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following is an example of the intended hierarchy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stdClass Object&#xA;(&#xA;[0] =&amp;gt; Array&#xA;    (&#xA;        [id] =&amp;gt; 1&#xA;        [uri] =&amp;gt; cars&#xA;        [title] =&amp;gt; Cars&#xA;        [children] =&amp;gt; Array&#xA;            (&#xA;                [0] =&amp;gt; Array&#xA;                    (&#xA;                        [id] =&amp;gt; 4&#xA;                        [uri] =&amp;gt; bmw&#xA;                        [title] =&amp;gt; BMW&#xA;                    )&#xA;&#xA;                [1] =&amp;gt; Array&#xA;                    (&#xA;                        [id] =&amp;gt; 6&#xA;                        [uri] =&amp;gt; audi&#xA;                        [title] =&amp;gt; Audi&#xA;                    )&#xA;&#xA;                [2] =&amp;gt; Array&#xA;                    (&#xA;                        [id] =&amp;gt; 7&#xA;                        [uri] =&amp;gt; vw&#xA;                        [title] =&amp;gt; VW&#xA;                        [children] =&amp;gt; Array&#xA;                            (&#xA;                                [0] =&amp;gt; Array&#xA;                                    (&#xA;                                        [id] =&amp;gt; 50&#xA;                                        [uri] =&amp;gt; hatchback&#xA;                                        [title] =&amp;gt; Hatchback&#xA;                                    )&#xA;&#xA;                                [1] =&amp;gt; Array&#xA;                                    (&#xA;                                        [id] =&amp;gt; 50&#xA;                                        [uri] =&amp;gt; sedan&#xA;                                        [title] =&amp;gt; Sedan&#xA;                                    )&#xA;&#xA;                            )&#xA;&#xA;                    )&#xA;&#xA;            )&#xA;&#xA;    )&#xA;&#xA;[1] =&amp;gt; Array&#xA;    (&#xA;        [id] =&amp;gt; 1&#xA;        [uri] =&amp;gt; trucks&#xA;        [title] =&amp;gt; trucks&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4637" LastEditorUserId="45" LastEditDate="2016-08-13T02:31:14.267" LastActivityDate="2016-08-13T02:31:14.267" Title="ElementAPI handling CategoryModel and returning a heirachical object" Tags="&lt;categories&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15221" PostTypeId="1" AcceptedAnswerId="15222" CreationDate="2016-05-25T16:14:26.063" Score="2" ViewCount="158" Body="&lt;p&gt;I have written a plugin to hook into an event raised by a contact form plugin. I am running PHP 5.6 locally, and the plugin works just fine. Moving the code to a server running 5.3 (which I cannot change) leads to an error. My &lt;code&gt;init()&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;   /* Intercepts the Capture form submission */&#xA;   craft()-&amp;gt;on('capture_submissions.onBeforePost', function(Event $event) {&#xA;      $data = array(&#xA;         'email_address'   =&amp;gt; $capture_data['email'],&#xA;      );&#xA;      $result = $this-&amp;gt;addMember($data);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When submitting the form, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Using $this when not in object context in /home/mysite/craft/plugins/myplugin/MyPlugin.php on line 69&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By changing the plugin to use MyPlugin:: instead of $this-&gt; leads to an error in Craft core:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Using $this when not in object context in /home/mysite/craft/app/etc/components/BaseSavableComponentType.php on line 41&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the correct way to call my plugin methods when running as an event listener?&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-25T16:37:53.217" Title="Plugin using event listener throws error using $this" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15222" PostTypeId="2" ParentId="15221" CreationDate="2016-05-25T16:37:53.217" Score="3" Body="&lt;p&gt;Seem to be doing well at asking and then answering my own questions.&#xA;If anyone has the same issue as me, it is because you cannot use an anonymous function in the callback. With my example above, the correct way is thus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('capture_submissions.onBeforePost', array($this, 'onCaptureListener'));&#xA;&#xA;public function onCaptureListener(Event $event) {&#xA; ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-25T16:37:53.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15223" PostTypeId="2" ParentId="15218" CreationDate="2016-05-25T18:02:49.700" Score="7" Body="&lt;p&gt;There's a ton of ways to pull this off, but in my opinion setting up pages/URLs for each category is probably a &lt;em&gt;good idea&lt;/em&gt;, for SEO and sharing reasons. It's not something that requires a lot of work and would make implementing the AJAX part a breeze. Another win is that you're going to have a solution which will actually work without AJAX or JavaScript, too – which is always a plus :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start, make sure the template path for your category group points to the same template that you use for your work index listing page (e.g. &lt;code&gt;work/index&lt;/code&gt;), and that the URL pattern is &lt;code&gt;work/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, amend the listing template like this – the idea is to add the category filter to the &lt;code&gt;craft.entries&lt;/code&gt; query only when one of the category URLs are requested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Your basic work entries query #}&#xA;{% set query = {&#xA;    section : 'work',&#xA;    limit : null&#xA;} %}&#xA;&#xA;{% If a category URL is requested, Craft will have populated your template with a global `category` variable #}&#xA;{% if category is defined %}&#xA;    {% set query = query|merge({&#xA;        search : 'categories:'~category.slug&#xA;    }) %}&#xA;{% endif %}&#xA;&#xA;{# Fetch entries #}&#xA;{% set entries = craft.entries(query) %}&#xA;&#xA;&amp;lt;div class=&quot;projects&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li class=&quot;project&quot;&amp;gt;&#xA;                ...&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the AJAX part, here's a super simple implementation – this example uses jQuery, and the concept is basically that we'll have the category URLs load using AJAX, and then just swap out the contents of the &lt;code&gt;.projects&lt;/code&gt; DOM element with the returned HTML – no need for a separate AJAX template, JSON or even a &lt;code&gt;craft.request.isAjaxRequest&lt;/code&gt; test. It's probably also a good idea to use the HTML5 History API to update the browser's address bar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Check if the browser supports HTML5 history&#xA;var historySupport = !!(window.history &amp;amp;&amp;amp; history.pushState);&#xA;&#xA;// Add an event listener for filter clicks&#xA;$(function () {&#xA;    $('body').on('click', '.filters a', onFilterClick);&#xA;});&#xA;&#xA;// Event handler for the filter click&#xA;function onFilterClick (e)&#xA;{&#xA;    e.preventDefault();&#xA;    var $filter = $(e.currentTarget);&#xA;    var href = $filter.attr('href');&#xA;    if (historySupport) {&#xA;        // Update the browser's address bar&#xA;        history.pushState(null, null, href);  &#xA;    }&#xA;    $.ajax($filter.attr('href), {&#xA;        dataType : 'html',&#xA;        success : function (response) {&#xA;            refreshProjects(response);&#xA;        }&#xA;    });&#xA;}&#xA;&#xA;function refreshProjects (html)&#xA;{&#xA;&#xA;    // Update the &amp;lt;title&amp;gt; tag&#xA;    document.title = $(html).filter('title').text();&#xA;&#xA;    // Update the .projects DOM element with new HTML&#xA;    var $html = $('&amp;lt;div /&amp;gt;').append(html);&#xA;    $('.projects').html($html.find('.projects').html());&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="125" LastEditDate="2016-05-26T03:48:44.947" LastActivityDate="2016-05-26T03:48:44.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15224" PostTypeId="1" CreationDate="2016-05-25T18:49:42.070" Score="2" ViewCount="62" Body="&lt;p&gt;I have a form created with Sprout Forms with a custom template to override the HTML. This form needs to pull in plan type information from a structure section that already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the structure entries to the form in the template, but they currently aren't hooked up to form so when I hit submit. How can I hook this up so that when a user selects a plan type it will register with Sprout Forms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could try and create these fields in the form builder, but the way it's set up it's easier for us and the client to pull the information from the existing entries.&lt;/p&gt;&#xA;" OwnerUserId="5192" LastEditorUserId="45" LastEditDate="2016-08-13T02:32:09.020" LastActivityDate="2016-08-13T02:32:09.020" Title="Pulling in Structure entries as radio button options in Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15225" PostTypeId="2" ParentId="15151" CreationDate="2016-05-25T20:39:19.520" Score="1" Body="&lt;p&gt;Jonathan, you have a lot going on with your code, including nested for loops,  which is probably beyond the scope of the Q&amp;amp;A format here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were me, I'd try to simplify what you have until you get the basics working.  If Live Preview isn't working, there's probably other things going on with your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a copy of your code and do a simple &lt;code&gt;for&lt;/code&gt; loop just to start for troubleshooting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for currentEntry in craft.entries.section('aboutus') %}&#xA;    &amp;lt;li&amp;gt;{{currentEntry}}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will spit out the title of the entry and only display the entries that are enabled. If that works, then you keep building up from there until you find the source of what's going on.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-05-25T20:39:19.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15226" PostTypeId="1" AcceptedAnswerId="15235" CreationDate="2016-05-25T21:37:59.287" Score="1" ViewCount="570" Body="&lt;p&gt;I'm working a on website project which includes a web form which asks for various personal details, one of the fields on the form is Date of Birth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form is being validated by a custom plugin which is using &lt;a href=&quot;https://craftcms.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;models&lt;/a&gt; for validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the AttributeType for the Date Of Birth field is defined as &lt;code&gt;AttributeType::DateTime&lt;/code&gt;, so bad values just get removed during POST, however it would be nice to try and catch values that fail a date format validation of &lt;code&gt;dd/MM/yyyy&lt;/code&gt; so the user can correct it, otherwise the field value will simply be discarded and user will be unaware of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is best way to check and catch that the Date Of Birth field value isn't in the required format? I want avoid any regex related parsing as I'm sure there are better ways to examine the format using other PHP date related functions.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2016-05-26T08:22:23.217" LastActivityDate="2018-05-16T12:47:35.223" Title="Validating Date of Birth format from a form field value" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;validation&gt;&lt;models&gt;&lt;attribute&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15228" PostTypeId="2" ParentId="15220" CreationDate="2016-05-25T22:49:43.153" Score="3" Body="&lt;p&gt;Element API doesn’t have any special support for returning nested arrays of element data, but you can hack it by limiting the initial batch of categories to just those at the top level, and within the transformer function, running additional queries to fetch nested elements, and incorporating them into the parent category’s return data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To limit the initial batch to just the ones at the top level, change your &lt;code&gt;criteria&lt;/code&gt; value to:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'criteria' =&amp;gt; ['group' =&amp;gt; $slug, 'level' =&amp;gt; 1],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then update your &lt;code&gt;transform()&lt;/code&gt; method to this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function transform(CategoryModel $category)&#xA;{&#xA;    $data = [&#xA;        'id' =&amp;gt; $category-&amp;gt;id,&#xA;        'uri' =&amp;gt; $category-&amp;gt;uri,&#xA;        'title' =&amp;gt; $category-&amp;gt;title,&#xA;    ];&#xA;&#xA;    $children = $category-&amp;gt;getChildren();&#xA;&#xA;    if ($children) {&#xA;        $data['children'] = [];&#xA;&#xA;        foreach ($children as $child) {&#xA;            $data['children'][] = $this-&amp;gt;transform($child);&#xA;        }&#xA;    }&#xA;&#xA;    return $data;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The caveat here is that this will require an additional SQL query for each individual category, since we need to check each category to see if it has any children. As of &lt;a href=&quot;https://craftcms.com/changelog#build2789&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2789&lt;/a&gt; you can fix that by &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;eager-loading&lt;/a&gt; the categories’ children with the newly-supported &lt;code&gt;children&lt;/code&gt; keyword.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, update your &lt;code&gt;criteria&lt;/code&gt; value with this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'group' =&amp;gt; $slug,&#xA;    'level' =&amp;gt; 1,&#xA;    'with' =&amp;gt; ['children.children.children']&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Put as many &lt;code&gt;.children&lt;/code&gt; as the number of levels the category group will have. So if it’s limited to two levels, &lt;code&gt;children.children&lt;/code&gt; would suffice.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-05-26T12:07:23.013" LastActivityDate="2016-05-26T12:07:23.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15229" PostTypeId="1" AcceptedAnswerId="16782" CreationDate="2016-05-25T23:01:34.680" Score="5" ViewCount="65" Body="&lt;p&gt;I use the following code to link to the CP from the front end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.isEditable() %}&#xA;  &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I have to add to link to the correct locale as it always jumps to the global locale instead of the current one?&lt;/p&gt;&#xA;" OwnerUserId="4707" LastActivityDate="2016-09-14T14:41:54.263" Title="How can I localize cpEditUrl?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15230" PostTypeId="2" ParentId="2889" CreationDate="2016-05-25T23:07:47.227" Score="2" Body="&lt;p&gt;Pixel &amp;amp; Tonic added an article on this some time ago which explains everything very well: &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And it just rulez!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4707" LastActivityDate="2016-05-25T23:07:47.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15231" PostTypeId="1" CreationDate="2016-05-26T03:23:20.540" Score="1" ViewCount="216" Body="&lt;p&gt;I have a purchasable that has a categories field. When the user visits the cart, I inspect the cart via my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to see the field, but I am stumbling on how to actually check the values of the field (get the chosen categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;$lineItems = $cart-&amp;gt;getLineItems();&#xA;&#xA;if ($lineItems) {&#xA;    foreach ($lineItems as $lineItem) {&#xA;        error_log(print_r($lineItem-&amp;gt;purchasable, true));&#xA;    }&#xA;} else {&#xA;    // The cart is empty.&#xA;}&#xA;&#xA;...&#xA;&#xA;&#xA;...&#xA;[myCategoryField] =&amp;gt; Array&#xA;    (&#xA;        [model] =&amp;gt; &#xA;        [column] =&amp;gt; text&#xA;        [type] =&amp;gt; mixed&#xA;        [label] =&amp;gt; My Category&#xA;    )&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I go a step further into the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;error_log(print_r($lineItem-&amp;gt;purchasable-&amp;gt;myCategoryField, true));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[relatedTo] =&amp;gt; Array&#xA;    (&#xA;        [sourceElement] =&amp;gt; 174&#xA;        [sourceLocale] =&amp;gt; en_us&#xA;        [field] =&amp;gt; 25&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the correct field ID, but I'm not sure how to get to the values of the category field. For example &quot;Category A&quot;, &quot;Category B&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-05-27T03:18:47.243" Title="Commerce - How can I get the values of a category field from a plugin?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15232" PostTypeId="2" ParentId="15217" CreationDate="2016-05-26T04:43:08.180" Score="2" Body="&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of how to do read/write splitting in Craft 3 here: &lt;a href=&quot;https://docs.craftcms.com/v3/config/app.html#database-component&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/app.html#database-component&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Definitely not current possibly natively in Craft since Yii's CDbConnection (which is what Craft uses for database connections) has no concept of master/slave connections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, something like the Yii DB &lt;a href=&quot;http://www.yiiframework.com/extension/dbreadwritesplitting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;splitting extension&lt;/a&gt; that &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15217/implementing-read-replica-slave-database-connections#comment20332_15217&quot;&gt;@RitterKnight&lt;/a&gt; mentioned is a start in the right direction, but even then, you'd have to do some pretty significant core hacking to utilize it in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be much more feasible in Craft 3 since the ability to swap out core components like that is planned.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2019-12-09T03:40:05.423" LastActivityDate="2019-12-09T03:40:05.423" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15233" PostTypeId="1" CreationDate="2016-05-26T08:10:16.557" Score="2" ViewCount="226" Body="&lt;p&gt;Not sure that is the best title but:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Section called Research Projects. An entry from this section contains a number of images, videos and audio entries in a grid chosen through an Entry Field. At the moment when one of the grid items is selected it displays a modal showing the details of that entry. There is no issue is showing a relationship as the info is displayed on the same page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if I chose to show the entry selected on a new page how would I show the relationship to the page it appears on / came from? Perhaps as a title from the previous page or a back button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not using a structure as video, image items can appear in multiple projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense and thank for any help anyone can offer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scott&lt;/p&gt;&#xA;" OwnerUserId="5195" LastActivityDate="2016-05-27T15:09:23.867" Title="Maintaining a relationship of parent from children selected through entry field" Tags="&lt;entries-field&gt;&lt;parents&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15234" PostTypeId="2" ParentId="10175" CreationDate="2016-05-26T09:21:57.613" Score="3" Body="&lt;p&gt;Even thought this is an old thread, I recently ran in to the same problem. It turned out to be a PHP version issue. I was running MAMP with PHP 7.0.0, once I switched that host to 5.6.10 it worked perfectly.&lt;/p&gt;&#xA;" OwnerUserId="3856" LastActivityDate="2016-05-26T09:21:57.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15235" PostTypeId="2" ParentId="15226" CreationDate="2016-05-26T11:11:16.127" Score="1" Body="&lt;p&gt;Would it be worth doing some client-side validation first using javascript to check the date of birth field is entered correctly? You can use an &lt;code&gt;onChange&lt;/code&gt; event on your field and then split the string on &quot;/&quot; and check each part is within a valid range &lt;code&gt;0-31&lt;/code&gt;, &lt;code&gt;1-12&lt;/code&gt;, &lt;code&gt;1900-2016&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For serverside checking, you can use &lt;a href=&quot;http://php.net/manual/en/function.strtotime.php&quot; rel=&quot;nofollow&quot;&gt;strtotime()&lt;/a&gt; and check that the return isn't false.&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-26T11:11:16.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15236" PostTypeId="1" AcceptedAnswerId="15241" CreationDate="2016-05-26T13:38:44.820" Score="1" ViewCount="320" Body="&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;: When we insert content for clients on full-service projects, sometimes we leave the original author. This author is usually from my shop and has admin-level permissions. When we turn the site over to clients, many times they can't override an admin due to their own (appropriate) permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: Is there a way to batch-change all authors to either another author or &lt;code&gt;null&lt;/code&gt;? Forethought is obviously the best thing in this case, but it's a pain to go into each entry and remove/change authors, and I'm lazy. I wasn't able to find a workaround or plugin. &lt;a href=&quot;https://craftcms.stackexchange.com/a/377/3653&quot;&gt;This question&lt;/a&gt; shows what to do in the database, but I'm wondering about the CP.&lt;/p&gt;&#xA;" OwnerUserId="3653" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-05-26T15:50:25.127" Title="Can you batch-change all authors in the CP?" Tags="&lt;author&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15237" PostTypeId="2" ParentId="15233" CreationDate="2016-05-26T14:46:15.807" Score="1" Body="&lt;p&gt;This is commonly called 'reverse-related entries' and is achievable using &lt;strong&gt;relatedTo()&lt;/strong&gt;. &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples#displaying-reverse-relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;See here for some info&lt;/a&gt;... &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is if I chose to show the entry selected on a new page how would I show the relationship to the page it appears on / came from? Perhaps as a title from the previous page or a back button.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For example, if a visitor were on an &lt;strong&gt;Audio Entry page&lt;/strong&gt;, your template code would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedResearchProject = craft.entries.section('researchProjects').relatedTo(entry) %}&#xA;{% for researchProject in relatedResearchProject %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ researchProject.url }}&quot;&amp;gt;{{ researchProject.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above, would display any Research Projects which contain related &quot;audio&quot; Entries.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The logic is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedResearchProject = craft.entries.section('researchProjects').relatedTo(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new variable called &quot;relatedResearchProject&quot; (in fact the variable name can be any word which makes sense to you)&lt;/li&gt;&#xA;&lt;li&gt;The new variable should contain any entries from the &lt;strong&gt;Research Projects Section&lt;/strong&gt; which are related to the the (Audio) entry being displayed on the current page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for researchProject in relatedResearchProject %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ researchProject.url }}&quot;&amp;gt;{{ researchProject.title }}&amp;lt;/a&amp;lt;/li&amp;gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop through and display any entries which are in the 'relatedResearchProject' variable.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In a different example below, you can see that &quot;Third news entry...&quot; contains the Entry field. then, on /news/we-just-installed-craft you can see the rendered link back to the &quot;Third news entry...&quot; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, Scott - I hope illustrating two examples isn't confusing! Let us know how you get on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Oz8BH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oz8BH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1dPEv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1dPEv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for researchProject in relatedResearchProject %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ researchProject.url }}&quot;&amp;gt;{{ researchProject.title }}&amp;lt;/a&amp;lt;/li&amp;gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-05-27T15:09:23.867" LastActivityDate="2016-05-27T15:09:23.867" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15238" PostTypeId="1" CreationDate="2016-05-26T14:55:43.007" Score="1" ViewCount="113" Body="&lt;p&gt;Because of some restrictions, some popular software (even Wordpress is a challenge) can't be run on NearlyFreeSpeech.NET. Can Craft be run on NearlyFreeSpeech.NET?&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-05-26T14:55:43.007" Title="Can Craft be run on NearlyFreeSpeech.NET?" Tags="&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15239" PostTypeId="2" ParentId="15238" CreationDate="2016-05-26T14:55:43.007" Score="3" Body="&lt;p&gt;Yes, it is possible to run Craft CMS NearlyFreeSpeech.NET. I did it as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Place the Craft folder in /home/tmp.&lt;/li&gt;&#xA;&lt;li&gt;Place the files in the public folder in /home/public.&lt;/li&gt;&#xA;&lt;li&gt;Change the permissions of the craft folder and all subfolders and all files to 777.&lt;/li&gt;&#xA;&lt;li&gt;Change craftPath in index.php to '../tmp/craft'.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Perhaps it would not be necessary to change all subdirectories and files in the craft folder to 777. But it is the easier way and it should hopefully not create a problem, because the folder is not accessible from the public. Even the update process is running if the folder (including subfolders and files) is 777.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-05-26T14:55:43.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15240" PostTypeId="1" AcceptedAnswerId="15242" CreationDate="2016-05-26T15:06:44.200" Score="1" ViewCount="279" Body="&lt;p&gt;I have added the field &quot;Product Image&quot; to my products. The field is an &quot;asset field&quot; which enables me to upload an image for each product. The field handle is &lt;code&gt;productImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I output this image in my template?&lt;/p&gt;&#xA;" OwnerUserId="5199" LastEditorUserId="1016" LastEditDate="2016-05-27T13:51:38.277" LastActivityDate="2016-05-27T13:51:38.277" Title="Output field content for a product in Craft Commerce" Tags="&lt;templating&gt;&lt;assets&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15241" PostTypeId="2" ParentId="15236" CreationDate="2016-05-26T15:50:25.127" Score="4" Body="&lt;p&gt;There's currently no way to do so natively in the CP, but there is a round-about way to do it using a CSV file with a pair of indispensable plugins from Bob Olde Hampsink:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow noreferrer&quot;&gt;Export&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Do the export/import 2-step&lt;/h1&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the Export plugin to spit out just the &lt;code&gt;Title&lt;/code&gt; and &lt;code&gt;Author&lt;/code&gt; from the section you want. Open up the resulting CSV file in whatever editor you want, you don't necessary have to use Excel or OpenOffice in this case since it's just text.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a find/replace on the author with the new author. Save the file.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open up in the Import plugin, and again, tell it what section you want and to replace the data. On the next screen, confirm &lt;code&gt;Title&lt;/code&gt; and &lt;code&gt;Author&lt;/code&gt; are already selected for you. &lt;code&gt;Title&lt;/code&gt; should be checked as how to match up the data. Run the import.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You're basically telling the plugin to leave everything alone except to replace the &lt;code&gt;Author&lt;/code&gt; and use the &lt;code&gt;Title&lt;/code&gt; (which we exported before) as the source.&lt;/p&gt;&#xA;&lt;p&gt;Rinse and repeat with as many sections you have.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-05-26T15:50:25.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15242" PostTypeId="2" ParentId="15240" CreationDate="2016-05-26T16:11:53.327" Score="3" Body="&lt;p&gt;Welcome to Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very basic piece of code for displaying your image would look like this (the if statement first checks if the field actually has an asset or not):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.productImage|length %}&#xA;    &amp;lt;img src=&quot;{{ product.productImage.first.getUrl() }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This quite simply outputs the image as it has been added in Craft, full size. Of course this isn't ideal as the images could be huge. That's why we have &lt;a href=&quot;https://craftcms.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;Image Transforms&lt;/a&gt;, which allow you define the size of the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the above code again, but updated to use a new transform we have created in Craft called 'Test Transform', with a handle of 'testTransform':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.productImage|length %}&#xA;    &amp;lt;img src=&quot;{{ product.productImage.first.getUrl('testTransform') }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully that gets you started. I'd recommend reading through the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;Craft docs&lt;/a&gt; for using and templating asset fields.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2016-05-27T12:32:05.023" LastActivityDate="2016-05-27T12:32:05.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15243" PostTypeId="2" ParentId="2201" CreationDate="2016-05-26T16:17:15.903" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpusergroup&quot; rel=&quot;nofollow&quot;&gt;Control Panel User Group&lt;/a&gt; plugin to automatically add special classes to the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once those classes are in place, it's easy to use &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CSS&lt;/a&gt; or &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;JavaScript&lt;/a&gt; to hide fields from certain user groups (or trigger other behavior based on user group status).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* Disclaimer: I'm the author of all of those plugins. :)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-05-26T16:17:15.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15244" PostTypeId="2" ParentId="15233" CreationDate="2016-05-26T16:40:32.240" Score="0" Body="&lt;p&gt;Thanks for the response. I had a feeling that RelatedTo might help but I'll admit I was having difficulty understanding the logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just so I understand the first example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set relatedResearchProject = craft.entries.section('researchProjects').relatedTo(entry) %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above sits on the audio file template page and basically defines relatedResearchProject as the entry in the section 'researchProjects' that the details propagating the template relate to. This is essentially creating a relationship from the page I have just come from?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% for researchProject in relatedResearchProject %}&#xA;    &lt;li&gt;{{ researchProject.title }}&lt;/li&gt;&#xA;{% endfor %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above just lists out the title and url from the related project page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wanted to check that you are providing 2 solutions to the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second example would allow me to show the relationship to a project or multiple projects. Which I did consider. But it wouldn't help in navigating back to the previous page or show my audio page as a sub-page of the project I'd come from. Is that about right? &lt;/p&gt;&#xA;" OwnerUserId="5195" LastActivityDate="2016-05-26T16:40:32.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15245" PostTypeId="2" ParentId="4695" CreationDate="2016-05-26T19:27:18.650" Score="4" Body="&lt;p&gt;For what it's worth, you can strip out all non-numerics with this something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ globalPhoneNumber.phoneNumber|replace('/[^0-9]/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, as part of a tel: anchor:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;tel:{{ globalPhoneNumber.phoneNumber|replace('/[^0-9]/', '') }}&quot;&amp;gt;{{ globalPhoneNumber.phoneNumber }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="776" LastActivityDate="2016-05-26T19:27:18.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15246" PostTypeId="1" AcceptedAnswerId="15248" CreationDate="2016-05-26T19:57:54.183" Score="8" ViewCount="1614" Body="&lt;p&gt;Rather than a static price for each product, I need the price to be dynamic based on two other fields of that product. Here's an example of what I need to accomplish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Product&#xA;&#xA;Field 1: Wholesale Cost (int)&#xA;Field 2: Increase Factor (int)&#xA;&#xA;Price: (Wholesale Cost * Increase Factor) + Wholesale Cost&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Digging around, I am finding absolutely nothing in regards to making the price of products dynamic. Is this possible at all with Craft Commerce, and if so how would I go about this?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-12-22T22:44:17.327" Title="Craft Commerce: Dynamic Product Price" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15247" PostTypeId="1" AcceptedAnswerId="15667" CreationDate="2016-05-26T20:36:18.483" Score="3" ViewCount="695" Body="&lt;p&gt;I've seen many similar questions (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6607/multiple-databases-single-codebase&quot;&gt;Multiple databases, single codebase&lt;/a&gt;) but now a little confused on the best approach. This is our first Craft CMS site so still learning the possibilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have domainone.com and domaintwo.com which will be almost identical in design and functionality but the copy throughout will be slightly different as each website is for the same brand but different locations (same country). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a perfect scenario, both websites will share the same assets, CSS/JS, templates and plugins as they require the same functionality, however, they'll have their own login areas to manage their own content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approx. half of the content will be the same i.e. new and used vehicles, but they'll have different pages such as 'about us', 'meet the team' and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the best option be to just copy over the plugins, templates etc to a fresh installation and separate the two completely or is there a way to achieve this 'perfect scenario'?&lt;/p&gt;&#xA;" OwnerUserId="4942" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-27T10:22:34.580" Title="Possible to share assets, templates and plugins across two domains but not all content?" Tags="&lt;assets&gt;&lt;multi-environment&gt;&lt;multi-domain&gt;&lt;multi-site&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15248" PostTypeId="2" ParentId="15246" CreationDate="2016-05-26T22:55:09.400" Score="8" Body="&lt;p&gt;[** Updated Dec 2016]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think at this stage the best approach will be plugin based.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a business logic plugin if you haven't already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two good ways of doing that are : &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Business Logic Plugin&lt;/a&gt; or via &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you listen to:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...then you can do (basically any) logic on the price as it is created as a lineItem in the cart (i.e. added to the cart).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some sketch code to get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;  $purchasable= $event-&amp;gt;params['purchasable'];&#xA;  $lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;  if(isset($lineItem-&amp;gt;options['giftWrapped']) &amp;amp;&amp;amp; $lineItem-&amp;gt;options['giftWrapped'] == 'yes')){&#xA;      $lineItem-&amp;gt;price = $lineItem-&amp;gt;price + 1;&#xA;  }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-12-22T22:44:17.327" LastActivityDate="2016-12-22T22:44:17.327" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15249" PostTypeId="2" ParentId="15224" CreationDate="2016-05-26T23:41:15.127" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; v2.3.0 adds front-end field support for Entries, Categories, and Tags Relations fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, the fields will display a multi-select field on the front-end. If the limit is set to 1, they will display a dropdown field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fields are designed to work for simple use cases. If you have hundreds or thousands of entries, you may need to consider a custom front-end field type for your scenario.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-05-26T23:41:15.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15250" PostTypeId="2" ParentId="15231" CreationDate="2016-05-27T03:18:47.243" Score="2" Body="&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = MyPluginRecord::model()-&amp;gt;findByPk($user-&amp;gt;id);&#xA;&#xA;if ($record) {&#xA;    $field = $record-&amp;gt;getAttributes(); // The plugin model.&#xA;&#xA;    if ($lineItems) {&#xA;        foreach ($lineItems as $lineItem) {&#xA;            foreach ($lineItem-&amp;gt;purchasable-&amp;gt;product-&amp;gt;myCategoryField as $category) {&#xA;                error_log($category-&amp;gt;title); // My Category&#xA;            }&#xA;        }&#xA;    } else {&#xA;        // The cart is empty.&#xA;    }&#xA;} else {&#xA;    // Product not found in cart.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-05-27T03:18:47.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15251" PostTypeId="1" AcceptedAnswerId="15252" CreationDate="2016-05-27T09:24:09.453" Score="8" ViewCount="13367" Body="&lt;p&gt;How do I filter a list of entries by the value of a field? For example, if I have a lightswitch field called &quot;Featured&quot;, how do I output just the featured entries?&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2021-04-08T10:35:43.203" Title="Filter Entries by Field Value" Tags="&lt;entries&gt;&lt;search&gt;&lt;filtering&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15252" PostTypeId="2" ParentId="15251" CreationDate="2016-05-27T09:24:09.453" Score="8" Body="&lt;p&gt;Use the &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;noreferrer&quot;&gt;search parameter&lt;/a&gt; in the &lt;code&gt;craft.entries&lt;/code&gt; model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('Blog').search('featuredFieldName:1') %}&#xA;&#xA;    {# Entry Code #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To filter by a specific text snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('Blog').search('entryColor:&quot;green&quot;') %}&#xA;&#xA;    {# Entry Code #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can create more complex search queries as well, see the documentation for more info. But the basic idea is to use &lt;code&gt;.search()&lt;/code&gt;, then enter your search query in quotes.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2016-05-27T09:24:09.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15253" PostTypeId="1" AcceptedAnswerId="15254" CreationDate="2016-05-27T15:01:50.820" Score="3" ViewCount="486" Body="&lt;p&gt;I'm looking to setup an image transform via the control panel but I only want to resize the image (scale - not crop or fit). The trouble is that I don't know whether the uploaded image will be a portrait or a landscape. Is there a way to set it to just scale to a maximum bounding box?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I want images to be a maximum 1000px width or height (whichever the longer edge is), how can I set that and maintain aspect ratio?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2016-05-27T16:08:33.783" Title="Image Transforms: Is there a way to detect portrait or landscape?" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15254" PostTypeId="2" ParentId="15253" CreationDate="2016-05-27T16:08:33.783" Score="4" Body="&lt;p&gt;The best way would be to use the &lt;a href=&quot;https://craftcms.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;Fit image transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set the transform to 'Fit' and set both your width and height values to 1000px. That way the image will continue to scale until the first longest edge reaches 1000px.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-05-27T16:08:33.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15255" PostTypeId="2" ParentId="15201" CreationDate="2016-05-27T18:01:57.527" Score="5" Body="&lt;p&gt;There is also a nice plugin called &lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw/&quot; rel=&quot;nofollow&quot;&gt;Hacksaw&lt;/a&gt; that gives you a handful of helpers. With this you can do &lt;code&gt;{{ entry.title|hack(words='1') }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5204" LastEditorUserId="57" LastEditDate="2016-10-15T18:10:12.100" LastActivityDate="2016-10-15T18:10:12.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15256" PostTypeId="2" ParentId="15247" CreationDate="2016-05-27T19:25:17.033" Score="1" Body="&lt;p&gt;You could use a deployment solution like &lt;a href=&quot;http://beanstalkapp.com/&quot; rel=&quot;nofollow&quot;&gt;Beanstalk&lt;/a&gt; to update both your template folders with one push. I would think you could use the same assets folder fairly easily as long as the folder lives above the &quot;craft&quot; folder for both installations.&lt;/p&gt;&#xA;" OwnerUserId="4825" LastActivityDate="2016-05-27T19:25:17.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15257" PostTypeId="1" AcceptedAnswerId="15260" CreationDate="2016-05-27T19:45:20.010" Score="1" ViewCount="452" Body="&lt;p&gt;Is it possible to show all tags that are related to a category? I can't find anything on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What I am looking for is this:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know a category slug or name. I want to get all tags associated with entries in that category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get this to work using the relatedTo param.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2016-05-31T17:15:09.540" LastActivityDate="2016-05-31T18:11:18.107" Title="Show all tags related to a category?" Tags="&lt;categories&gt;&lt;relations&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15259" PostTypeId="1" AcceptedAnswerId="15275" CreationDate="2016-05-28T00:27:12.800" Score="3" ViewCount="466" Body="&lt;p&gt;I'm looking at this guide to writing custom validators:&#xA;&lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators&quot; rel=&quot;nofollow&quot;&gt;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-5-custom-validators&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this only allows code that refers to the current field.  The comparison validators exist so I know it's possible.  I want to do a CVV and credit card number validator that check against the credit card type, and also make some fields conditionally required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example only the attribute itself is referred to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateUsername($attribute)&#xA;{&#xA;    $value = $this-&amp;gt;$attribute;&#xA;&#xA;    if ($value &amp;amp;&amp;amp; strtolower($value) == 'spartacus') {&#xA;        $message = Craft::t(&quot;No, I'm Spartcus!&quot;);&#xA;        $this-&amp;gt;addError($attribute, $message);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I refer to another field in the model in my validator?&lt;/p&gt;&#xA;" OwnerUserId="5169" LastEditorUserId="5169" LastEditDate="2016-05-28T01:15:06.420" LastActivityDate="2016-05-30T20:17:33.930" Title="How do I write custom model validators for my plugin that refer to other fields?" Tags="&lt;plugin-development&gt;&lt;validation&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15260" PostTypeId="2" ParentId="15257" CreationDate="2016-05-28T11:18:55.137" Score="4" Body="&lt;p&gt;You can use the relatedTo param on &lt;code&gt;craft.tags&lt;/code&gt; like you can with any Element inside Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All Elements inside Craft can be related to one another. There is a &lt;code&gt;.relatedTo&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/templating/craft.tags#relatedTo&quot; rel=&quot;nofollow&quot;&gt;parameter&lt;/a&gt; available on all of the query elements like &lt;code&gt;craft.entries&lt;/code&gt; and &lt;code&gt;craft.tags&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to pass a category object into this relatedTo parameter. I have included the group param below but this can be omitted if you want to query all of your tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set tags = craft.tags.group( 'groupName' ).relatedTo( category ) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on using Relations in Craft: &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; param takes one of the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An AssetFileModel, CategoryModel, EntryModel, UserModel, or TagModel&#xA;object &lt;/li&gt;&#xA;&lt;li&gt;An element’s ID &lt;/li&gt;&#xA;&lt;li&gt;An array of element objects and/or IDs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To get a CategoryModel using a slug inside your template you can use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set category = craft.categories.slug( 'theslug' ).first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will set &lt;code&gt;category&lt;/code&gt; to a CategoryModel which you can then use inside the &lt;code&gt;.relatedTo&lt;/code&gt; param in the above example.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've set category to have their own URL's then &lt;code&gt;category&lt;/code&gt; inside the template you've set to use is a CategoryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then set &lt;code&gt;entries&lt;/code&gt; to all entries related to the category. Finally, use these entries to get all related tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo( category ).find() %}&#xA;{% set tags = craft.tags.relatedTo( entries ).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-05-31T18:11:18.107" LastActivityDate="2016-05-31T18:11:18.107" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15261" PostTypeId="1" AcceptedAnswerId="15262" CreationDate="2016-05-28T16:57:09.600" Score="3" ViewCount="383" Body="&lt;p&gt;I've got a blog section on a page but want to hide it if there are no blogs. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blog = craft.entries.section('blog').limit(5) %}&#xA;{% if blog !='' %}&#xA;  &amp;lt;div class=&quot;something&quot;&amp;gt;&#xA;    {% for entry in blog %}&#xA;      ...&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="4466" LastEditDate="2016-05-30T01:25:46.007" LastActivityDate="2016-05-30T01:25:46.007" Title="How do I write a conditional for whether a section contains entries?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15262" PostTypeId="2" ParentId="15261" CreationDate="2016-05-28T17:05:36.250" Score="6" Body="&lt;p&gt;Your blog variable is an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which can be treated like an iterable array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if blog|length %}&#xA;    Content&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="109" LastEditorUserId="1098" LastEditDate="2016-05-28T20:36:18.027" LastActivityDate="2016-05-28T20:36:18.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15264" PostTypeId="1" CreationDate="2016-05-30T05:27:19.557" Score="2" ViewCount="441" Body="&lt;p&gt;I'm quite sure the problem is my paths to &lt;code&gt;.css&lt;/code&gt; files in the &lt;code&gt;_layout.html&lt;/code&gt; file but just can't get my head around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got this in my &lt;code&gt;_layout.html&lt;/code&gt;. It works for home page and news page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile &quot;css/material.css&quot; %}&#xA;{% includeCssFile &quot;css/main.css&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I get the unstyled page when viewing a specific news entry. &lt;code&gt;_entry.html&lt;/code&gt; is not extending &lt;code&gt;_layout.html&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My CSS files are on the same level as my templates. What should these paths be?&lt;/p&gt;&#xA;" OwnerUserId="5202" LastEditorUserId="4466" LastEditDate="2016-05-31T07:35:49.497" LastActivityDate="2016-05-31T07:35:49.497" Title="Why is news/_entry not extending _layout?" Tags="&lt;templating&gt;&lt;extends&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15265" PostTypeId="1" CreationDate="2016-05-30T06:22:09.983" Score="1" ViewCount="2077" Body="&lt;p&gt;If I have a Section called &quot;Pages&quot; that uses the &quot;page.html&quot; Entry Template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I override that template for a single page in this Section? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I would be able to use &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Routing&lt;/a&gt; but the Entry request (#4) is picked up before the Dynamic Routes (#5). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a nicer solution to this rather than a bunch of if statements in the template? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPath() == &quot;about&quot; %}&#xA;&#xA;    {% include '_includes/about.html' %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/96/how-can-i-route-a-specific-entry-in-a-structure-section-to-its-own-template&quot;&gt;this solution&lt;/a&gt;, but not sure if it's overkill if I only want to override 1 Entry?&lt;/p&gt;&#xA;" OwnerUserId="4893" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-06-12T03:35:52.417" Title="Different template for an entry in section" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15266" PostTypeId="2" ParentId="15265" CreationDate="2016-05-30T07:01:22.937" Score="1" Body="&lt;p&gt;Hey @zuccs you should look into &lt;code&gt;Entry Types&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/entry-type-templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2016-05-30T07:01:22.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15267" PostTypeId="2" ParentId="15264" CreationDate="2016-05-30T07:30:12.327" Score="2" Body="&lt;p&gt;News/_entry should definitely be extending _layout (or any layout you want to use). That's how it's setup when you download a fresh copy of Craft as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The CSS file should not be in the templates folder (that's only for twig templates), but in your web root which is the same folder as index.php. In your case that would probably be something like public/css/material.css and public/css/main.css Also make sure that any assets used in these CSS files are located in that folder instead of the templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless these CSS files are specific to the news entry template I'd also include them in the layout file.&lt;/p&gt;&#xA;" OwnerDisplayName="user155" LastActivityDate="2016-05-30T07:30:12.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15268" PostTypeId="1" AcceptedAnswerId="15276" CreationDate="2016-05-30T11:03:39.313" Score="2" ViewCount="1247" Body="&lt;p&gt;I'd like to use the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; plugin.&#xA;I've follow the instructions mentioned here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15015/elementapi-can-i-use-javascript-ajax-to-load-json&quot;&gt;ElementAPI - Can I use javascript/ajax to load json&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my config/elementapi.php file :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;news/{$entry-&amp;gt;id}.json&quot;),&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here my ajax request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $(function () {&#xA;        var data = {&#xA;            'CSRF': $('input[name=&quot;CRAFT_CSRF_TOKEN&quot;]').val(),&#xA;        };&#xA;&#xA;        $.ajax({&#xA;            'type': 'post',&#xA;            'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;            'cache': false,&#xA;            'data': data,&#xA;            'url': 'news.json',&#xA;            'dataType': 'json',&#xA;            'timeout': 50000&#xA;        }).done(function (response) {&#xA;           console.log(response);&#xA;        }).fail(function (error) {&#xA;                console.log('totalfail')&#xA;            });&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it always returns a 400 error (as the JSON file looks like it doesn't exist).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I missed? Could someone provide a working example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5210" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-05-30T20:33:15.673" Title="How do I get started with Element API plugin?" Tags="&lt;ajax&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15269" PostTypeId="1" CreationDate="2016-05-30T16:08:58.253" Score="1" ViewCount="50" Body="&lt;p&gt;Can you use the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; plugin to utilize &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow&quot;&gt;UsersController's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionUploadUserPhoto-detail&quot; rel=&quot;nofollow&quot;&gt;actionUploadUserPhoto&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionCropUserPhoto-detail&quot; rel=&quot;nofollow&quot;&gt;actionCropUserPhoto&lt;/a&gt; methods?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2016-05-30T18:47:46.860" LastActivityDate="2016-06-29T19:26:46.610" Title="UsersController's actionUploadUserPhoto and actionCropUserPhoto with Element API" Tags="&lt;plugin-elementapi&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15270" PostTypeId="1" AcceptedAnswerId="15271" CreationDate="2016-05-30T18:23:24.023" Score="1" ViewCount="63" Body="&lt;p&gt;I want to show a user the total sum of all their orders.&#xA;My problem: In the result the decimals are &quot;lost&quot; and always show as zeros.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalOrders = 0 %}&#xA;{% for order in craft.commerce.orders.customer(craft.commerce.customer).find() %}&#xA;  {% set totalOrders = totalOrders + order.totalPrice|currency(order.currency) %}&#xA;{% endfor %}&#xA;{{ totalOrders|currency(order.currency) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5212" LastEditorUserId="4466" LastEditDate="2016-05-31T07:35:15.743" LastActivityDate="2016-05-31T07:35:15.743" Title="Decimals missing in result after adding up order totals for a customer" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15271" PostTypeId="2" ParentId="15270" CreationDate="2016-05-30T18:43:44.533" Score="3" Body="&lt;p&gt;The trouble you are running into is trying to add a string value to an integer to get your total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to use &lt;code&gt;order.totalPrice&lt;/code&gt; without the &lt;code&gt;currency&lt;/code&gt; filter to be able to add all the values together.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.cart %}&#xA;{% set totalOrders = 0 %}&#xA;&#xA;{% for order in craft.commerce.orders.customer( craft.commerce.customer ).find() %}&#xA;  {% set totalOrders = totalOrders + order.totalPrice %}&#xA;{% endfor %}&#xA;&#xA;{{ totalOrders|currency( cart.currency ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only apply the &lt;code&gt;currency&lt;/code&gt; filter once all the calculations are complete.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-05-30T18:43:44.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15272" PostTypeId="2" ParentId="15269" CreationDate="2016-05-30T18:55:22.210" Score="1" Body="&lt;p&gt;Not natively.  The Element API plugin provides a &quot;read only&quot; API to Craft's controller endpoints.  Both &lt;code&gt;actionUploadUserPhoto&lt;/code&gt; and &lt;code&gt;actionCropUserPhoto&lt;/code&gt; request POST/write requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could fork it and add POST/write functionality to the plugin/API, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-30T18:55:22.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15273" PostTypeId="2" ParentId="15015" CreationDate="2016-05-30T18:57:20.443" Score="3" Body="&lt;p&gt;You better use GET rather than POST :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;    var data = {&#xA;        'CSRF': $('input[name=&quot;CRAFT_CSRF_TOKEN&quot;]').val(),&#xA;    };&#xA;&#xA;    $.ajax({&#xA;        'type': 'get',&#xA;        'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;        'cache': false,&#xA;        'data': data,&#xA;        'url': 'news.json',&#xA;        'dataType': 'json',&#xA;        'timeout': 50000&#xA;    }).done(function (response) {&#xA;       console.log(response);&#xA;    }).fail(function (error) {&#xA;       console.log('totalfail')&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5210" LastActivityDate="2016-05-30T18:57:20.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15274" PostTypeId="1" AcceptedAnswerId="15294" CreationDate="2016-05-30T19:57:58.597" Score="-1" ViewCount="69" Body="&lt;p&gt;I have subscriptions setup with Charge and Member Groups setup for reach subscription. The handle and name of both the subscriptions as well as the related member groups is identical. Some of them have a limit of 1 person per member-group. I have the following code that should check what member groups have how many people in them and then output what is available, but for some reason, even if i manually assign users to some of the member groups, they are still being shown as options. Please advise. Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              {% set planChoices = {&#xA;            'floating-desks' : {&#xA;                'isDesk': true,&#xA;                'label': 'Floating Desk',&#xA;                'planAmount' : 175,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'floating-desks'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-220' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 220',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-220'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-221' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 221',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-221'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-230' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 230',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-230'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-231' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 231',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-231'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-232' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 232',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-232'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-233' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 233',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-233'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'private-office-234' : {&#xA;                'isDesk': false,&#xA;                'label': 'Private Office 234',&#xA;                'planAmount' : 1000,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'private-office-234'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-1' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 1',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-1'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-2' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 2',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-2'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-3' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 3',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-3'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-4' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 4',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-4'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-5' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 5',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-5'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-6' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 6',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-6'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-7' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 7',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-7'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-8' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 8',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-8'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-9' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 9',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-9'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-10' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 10',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-10'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-11' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 11',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-11'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-12' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 12',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-12'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-13' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 13',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-13'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-14' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 14',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-14'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-15' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 15',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-15'&#xA;                    },&#xA;                }    &#xA;            },&#xA;            'permanent-desk-16' : {&#xA;                'isDesk': false,&#xA;                'label': 'Permanent Desk 16',&#xA;                'planAmount' : 350,&#xA;                'planInterval' : 'month',&#xA;                'planIntervalCount' : 1,&#xA;                'actions' : {&#xA;                    'onSuccess': {&#xA;                        'subscription' : 'permanent-desk-16'&#xA;                    },&#xA;                }    &#xA;            }&#xA;        } %}&#xA;        ​&#xA;        {% set availablePlanChoices = {} %}&#xA;&#xA;        {% for key, value in planChoices %}&#xA;&#xA;            {% if planChoices['isDesk'] is defined and planChoices['isDesk'] %}&#xA;                {% if craft.users.group('permanent-desk-1,permanent-desk-2,permanent-desk-3,permanent-desk-4,permanent-desk-5,permanent-desk-6,permanent-desk-7,permanent-desk-8,permanent-desk-9,permanent-desk-10,permanent-desk-11,permanent-desk-12,permanent-desk-13,permanent-desk-14,permanent-desk-15,permanent-desk-16, floating-desks').total() &amp;lt; 16 %}&#xA;                    {% set availablePlanChoices = availablePlanChoices|merge({ (key): value }) %}&#xA;                {% endif %}&#xA;            {% else %}&#xA;                {% if craft.users.group(key).total() &amp;lt; 1 %}&#xA;                    {% set availablePlanChoices = availablePlanChoices|merge({ (key): value }) %}&#xA;                {% endif %}&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;        ​&#xA;&#xA;        ​&#xA;        {% set options = {&#xA;            'planChoices' : availablePlanChoices,&#xA;            'planChoiceDefault': 'floating-desks',&#xA;        } %}&#xA;        {{ craft.charge.setPaymentOptions(options) }}&#xA;&#xA;&#xA;         {{ forms.selectField({&#xA;                label: 'Booking Choice',&#xA;                name: 'planChoice',&#xA;                id: 'planChoice',&#xA;                options: options.planChoices,&#xA;                value: (charge is defined ? charge.planChoice),&#xA;                errors: (charge is defined ? charge.getErrors('planChoice'))&#xA;        }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-06-01T05:51:53.010" Title="Conditional being ignored?" Tags="&lt;templating&gt;&lt;users&gt;&lt;conditional&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15275" PostTypeId="2" ParentId="15259" CreationDate="2016-05-30T20:17:33.930" Score="2" Body="&lt;p&gt;Looks like I can just refer to the other field name: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateUsername($attribute)&#xA;{&#xA;    $value = $this-&amp;gt;$attribute;&#xA;    $otherFieldsValue = $this-&amp;gt;otherField;&#xA;&#xA;    if ($value &amp;amp;&amp;amp; strtolower($otherFieldsValue) == 'spartacus') {&#xA;        $message = Craft::t(&quot;No, I'm Spartcus!&quot;);&#xA;        $this-&amp;gt;addError($attribute, $message);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5169" LastActivityDate="2016-05-30T20:17:33.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15276" PostTypeId="2" ParentId="15268" CreationDate="2016-05-30T20:33:15.673" Score="1" Body="&lt;p&gt;There was a mistake in the ajax request. &lt;br&gt;I was using POST instead of GET.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) After installing the plugin :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &lt;strong&gt;elementapi.php&lt;/strong&gt; to your &lt;code&gt;/craft/config/&lt;/code&gt; directory&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;news/{$entry-&amp;gt;id}.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) &lt;strong&gt;Enabling CSRF Protection&lt;/strong&gt;&#xA;add &lt;code&gt;'enableCsrfProtection' =&amp;gt; true&lt;/code&gt; to your &lt;code&gt;/craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) getting entries with ajax :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;...&#xA;&amp;lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js&quot;&amp;gt;  &amp;lt;/script&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;    $(function () {&#xA;        var data = {&#xA;            'CSRF': $('input[name=&quot;CRAFT_CSRF_TOKEN&quot;]').val(),&#xA;        };&#xA;&#xA;        $.ajax({&#xA;            'type': 'get',&#xA;            'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;            'cache': false,&#xA;            'data': data,&#xA;            'url': 'news.json',&#xA;            'dataType': 'json',&#xA;            'timeout': 50000&#xA;        }).done(function (response) {&#xA;            console.log(response);&#xA;        }).fail(function (error) {&#xA;                // Total fail.&#xA;            });&#xA;        });&#xA;    &amp;lt;/script&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body&amp;gt;&#xA;&amp;lt;div id=&quot;container&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5210" LastActivityDate="2016-05-30T20:33:15.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15278" PostTypeId="1" AcceptedAnswerId="15288" CreationDate="2016-05-30T21:25:12.803" Score="1" ViewCount="216" Body="&lt;p&gt;I have a simple photo gallery where logged in users can upload photos. I've set the default status for all pictures to disabled, is it possible to show disabled pictures only to user who just published it, and when status is set to enabled everyone can see it?&lt;/p&gt;&#xA;" OwnerUserId="5214" LastEditorUserId="4215" LastEditDate="2016-05-31T11:58:59.320" LastActivityDate="2016-05-31T14:22:08.717" Title="Displaying disabled posts only to post author" Tags="&lt;templating&gt;&lt;entries&gt;&lt;users&gt;&lt;status&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15279" PostTypeId="1" CreationDate="2016-05-30T21:50:53.223" Score="4" ViewCount="679" Body="&lt;p&gt;I am inspecting my cart when the user visits &lt;code&gt;/commerce/cart&lt;/code&gt; and if the cart contains a specific product, I want to alert the user that they can redeem a credit for &quot;x&quot; item. If the users chooses to use the credit, I would like to assign the qualifying product a discount.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;if ($lineItems) {&#xA;    foreach ($lineItems as $lineItem) {&#xA;        foreach ($lineItem-&amp;gt;purchasable-&amp;gt;product-&amp;gt;foo as $bar) {&#xA;&#xA;            ...&#xA;            // qualifying product found - return json to javascript&#xA;            ...&#xA;        }&#xA;...&#xA;&#xA;$discount = new commerce_DiscountModel();&#xA;...&#xA;??&#xA;// apply discount to cart/update ui via javascript to reflect discount&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm able get all the way up to creating a new discount. I assume I start by creating a new discount model and populate it with the price of the product I am wanting to discount? I'm not really sure where to start - thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, thank you, Jeremy for your help. I (think) I am slowly starting to understand. I don't understand how or why the handler is or isn't getting called. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my updated main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    error_log(__FUNCTION__); // this is logged&#xA;&#xA;    craft()-&amp;gt;on('commerce_discounts.onBeforeMatchLineItem',&#xA;        [&#xA;            craft()-&amp;gt;myPlugin, &#xA;            'onBeforeMatchLineItemHandler'&#xA;        ]&#xA;    );&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then my service file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginService extends BaseApplicationComponent&#xA;{&#xA;    public function onBeforeMatchLineItemHandler($event)&#xA;    {&#xA;        // this method never gets executed&#xA;&#xA;        $cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;        $lineItem = $event-&amp;gt;params['lineItem'];&#xA;        $discount = $event-&amp;gt;params['discount'];&#xA;&#xA;        error_log('line item: ' . $lineItem);&#xA;        error_log('discount: ' . $discount);&#xA;    }&#xA;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change the name of the handler to &quot;myPluginz&quot; or something that doesn't exist, it throws an error, so I know I have the right syntax at least. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The handler was actually called once, but now it never gets executed. The product I have in my cart is promotable, and is not excluded from any sale. So it seems I am matching the criteria needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried this straight from the docs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    error_log(__FUNCTION__); // this is logged&#xA;    craft()-&amp;gt;on('commerce_discounts.onBeforeMatchLineItem', function ($event) {&#xA;        error_log(print_r($event, true)); // this is not executed&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't understand what I've done wrong to cause the event not to fire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I think I have finally managed to get out of my own way. I'll update this thread as I progress through.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-06-05T01:53:08.597" LastActivityDate="2016-06-05T01:53:08.597" Title="Commerce: How can I dynamically create a discount for any given product?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15280" PostTypeId="2" ParentId="15279" CreationDate="2016-05-30T23:44:10.027" Score="2" Body="&lt;p&gt;I would turn this on it's head slightly (assuming you can express the discount itself, i.e. what it does specifically to the discount item, using normal Commerce discount rules).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can, then you can basically make the application of the discount conditional based on what's in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some sketch code - obviously you might need to change the logic etc&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforeMatchLineItemHandler($event){&#xA;&#xA;$lineItem = $event-&amp;gt;params['lineItem'];&#xA;$discount = $event-&amp;gt;params['discount'];&#xA;&#xA;$cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&#xA;$idOfItemToPossiblyDiscount = whatever;&#xA;$idOfParentItem = whatever;&#xA;$idOfDiscount = whatever;&#xA;&#xA;/First check which discount we're thinking about applying&#xA;if($discount-&amp;gt;id == $idOfDiscount){&#xA;&#xA;    $shouldDiscount = false;&#xA;    if ($lineItem-&amp;gt;purchasable instanceof Commerce_VariantModel){&#xA;        //First check if this is the item that might get discounted&#xA;        if($lineItem-&amp;gt;purchasable-&amp;gt;id) == $idOfItemToPossiblyDiscount)){&#xA;            //Ok, so we have that item in the cart now loop through $cart to see if the 'parent' item is in the cart&#xA;            foreach ($cart-&amp;gt;lineItems as $item){&#xA;                if ($item-&amp;gt;purchasable-&amp;gt;$id) == $idOfParentItem){&#xA;                    //do nothing, but finish here - Commerce will carry on and apply the discount as long as&#xA;                    //we dont set event-&amp;gt;performAction = false;&#xA;                    $shouldDiscount = true;&#xA;                    break;&#xA;                }&#xA;            }&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    if(!$shouldDiscount){&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously at the template end of things you can loop through what's in the cart and do similar logic to show messages etc - e.g. if parent item is in, and not the discount item, present the offer, etc....&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-30T23:44:10.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15281" PostTypeId="1" CreationDate="2016-05-31T03:05:04.187" Score="1" ViewCount="604" Body="&lt;p&gt;How can I update all the packages under &lt;code&gt;craft/app/vendor&lt;/code&gt; for Craft CMS 3 (Yii 2)?&lt;/p&gt;&#xA;" OwnerUserId="4874" LastEditorUserId="22" LastEditDate="2017-05-09T21:57:22.180" LastActivityDate="2017-05-09T21:57:22.180" Title="CraftCMS 3 - Composer Update" Tags="&lt;craft3&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15282" PostTypeId="1" AcceptedAnswerId="15513" CreationDate="2016-05-31T04:29:56.450" Score="4" ViewCount="329" Body="&lt;p&gt;I'm getting myself into a potential pickle here and wanting to know the best way to get apply filters on the current scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a central &lt;code&gt;business&lt;/code&gt; section which is getting populated via an API (&lt;em&gt;just a little background info&lt;/em&gt;) and I have a second section &lt;code&gt;drugs&lt;/code&gt; which has a Entries field that contains a link to &lt;code&gt;business&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've designed a table that pulls in all this info that looks a little something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PgAuH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PgAuH.png&quot; alt=&quot;company drug table&quot;&gt;&lt;/a&gt;&#xA;I've built out the table like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# DEFAULTS #}&#xA;{% set queryParams = {&#xA;    section: 'business',&#xA;    order: 'title asc',&#xA;    limit: 30&#xA;} %}&#xA;{% for entry in craft.entries(queryParams) %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--comapny&quot;&amp;gt;&amp;lt;small&amp;gt;{{entry.title}}&amp;lt;/small&amp;gt; &amp;lt;b&amp;gt;{{entry.business_name}}&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--price&quot;&amp;gt;&#xA;        {{entry.business_price}}&#xA;        {% if &quot;+&quot; in entry.business_change %}&#xA;            &amp;lt;small style=&quot;color:#0c0&quot;&amp;gt;{{entry.business_change}} {{entry.business_percentChange}}&amp;lt;/small&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;small style=&quot;color:#c00&quot;&amp;gt;{{entry.business_change}} {{entry.business_percentChange}}&amp;lt;/small&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--market_cap&quot;&amp;gt;${{entry.business_market_cap}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--shares&quot;&amp;gt;{{entry.business_number_of_shares|number}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--short_ratio&quot;&amp;gt;{{entry.business_shortRatio}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;td td--short_ratio&quot;&amp;gt;{{entry.dateUpdated}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;br style=&quot;clear:both&quot; /&amp;gt;&#xA;        &amp;lt;table style=&quot;width: 100%;&quot;&amp;gt;&#xA;            &amp;lt;thead&amp;gt;&#xA;                &amp;lt;tr&amp;gt;&#xA;                    &amp;lt;th style=&quot;text-align: left;width:20%&quot;&amp;gt;Drug&amp;lt;/th&amp;gt;&#xA;                    &amp;lt;th style=&quot;text-align: left;width:30%&quot;&amp;gt;Indication&amp;lt;/th&amp;gt;&#xA;                    &amp;lt;th style=&quot;text-align: left;width:20%&quot;&amp;gt;Stage&amp;lt;/th&amp;gt;&#xA;                    &amp;lt;th style=&quot;text-align: left;width:30%&quot;&amp;gt;News&amp;lt;/th&amp;gt;&#xA;                &amp;lt;/tr&amp;gt;&#xA;            &amp;lt;/thead&amp;gt;&#xA;            &amp;lt;tbody&amp;gt;&#xA;            {% set relatedDrugs = craft.entries.section('drug').relatedTo(entry) %}&#xA;            {% for drug in relatedDrugs %}&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ drug.title }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ drug.drug_indication}}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;{{ drug.drug_stage.label}}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td&amp;gt;&amp;lt;a href=&quot;{{ drug.drug_press_link}}&quot;&amp;gt;{{ drug.drug_note}}&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/tbody&amp;gt;&#xA;        &amp;lt;/table&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now – the pickle is the filtering side of things: I'm wanting to filter on the drug stage, AND to make matters even more exciting this is a multi-select filter which I've done like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;legend&amp;gt;Stage&amp;lt;/legend&amp;gt;&#xA;    {% set stage = craft.fields.getFieldByHandle('drug_stage') %}&#xA;    {% for stage in stage.settings.options %}&#xA;        {% if loop.first %}&amp;lt;select name=&quot;stage[]&quot; multiple&amp;gt;{% endif %}&#xA;          &amp;lt;option value=&quot;{{stage.value}}&quot;&amp;gt;{{stage.label}}&amp;lt;/option&amp;gt;&#xA;        {% if loop.last %}&amp;lt;/select&amp;gt;{% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure how to enable multiple params of the same name so I've called it &lt;code&gt;stage[]&lt;/code&gt; which handily returns an array. The problem I'm having now is building that new param filter query... I got as far as this and stared blankly at the screen for 10 minutes (I'm no programmer...)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stage = craft.request.getParam('stage') %}&#xA;{% if stage is not empty %}&#xA;    {# NO IDEA #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I really have no idea where to start. Any pointers or help would be fantastic!&lt;/p&gt;&#xA;" OwnerUserId="5215" LastEditorUserId="22" LastEditDate="2017-05-09T21:55:33.067" LastActivityDate="2017-05-09T21:55:33.067" Title="Filtering on related entries (with an array query param)" Tags="&lt;templating&gt;&lt;relations&gt;&lt;params&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15283" PostTypeId="2" ParentId="15281" CreationDate="2016-05-31T04:43:34.457" Score="2" Body="&lt;p&gt;You can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;composer.json&lt;/code&gt; file (and the &lt;code&gt;composer.lock&lt;/code&gt; file so you can't even reverse engineer &lt;code&gt;composer.json&lt;/code&gt;) isn't shipped with the official release on purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 is still in development preview status (not even alpha release), but the next release will include updated Composer dependencies.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-31T04:43:34.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15284" PostTypeId="1" AcceptedAnswerId="15418" CreationDate="2016-05-31T09:48:38.327" Score="5" ViewCount="390" Body="&lt;p&gt;Each Product has a &lt;code&gt;Merchant&lt;/code&gt; field which is standard Craft &lt;code&gt;User&lt;/code&gt;. What I'd like to do is list out all Orders which contain one or more Products relating to the &lt;code&gt;currentUser&lt;/code&gt;. I was hoping I'd be able to use &lt;a href=&quot;https://craftcms.com/docs/relations&quot;&gt;Relations&lt;/a&gt; to accomplish this, so something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;  'relatedTo': currentUser&#xA;}) %}&#xA;&#xA;{% set orders = craft.commerce.orders.relatedTo({&#xA;  'sourceElement': products,&#xA;  'field': 'lineItems.purchasable.product'&#xA;}).find %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first query works fine and returns only the &lt;code&gt;Products&lt;/code&gt; relating to the &lt;code&gt;currentUser&lt;/code&gt;, but when I try to use it as the basis for the second query, that's where it collapses in a big heap! Am I in the right ballpark, or isn't this possible in the way I'm trying?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help gratefully received. &lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-05-31T10:29:47.543" LastActivityDate="2016-06-09T12:35:18.770" Title="List only Orders containing specific Products" Tags="&lt;relations&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15285" PostTypeId="2" ParentId="14062" CreationDate="2016-05-31T09:58:35.280" Score="1" Body="&lt;p&gt;I copied your markup, setting and name and label manually and it added the &lt;code&gt;disabled&lt;/code&gt; property if I used &lt;code&gt;disabled: true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;label: 'Example Label',&#xA;name: 'Example Name',&#xA;value : 'Example Value',&#xA;disabled: true,&#xA;required: true&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GOaPu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GOaPu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you could try manually defining the field (as I did) without reading from the variables and confirm that it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that fails, I suggest you &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;enable dev mode&lt;/a&gt; and then use &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;twig's dump() function&lt;/a&gt; to check that you don't have any errors and that the field is given correct values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything in your log file?&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-31T09:58:35.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15286" PostTypeId="1" AcceptedAnswerId="15289" CreationDate="2016-05-31T10:16:28.037" Score="2" ViewCount="451" Body="&lt;h2&gt;starting point&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have the following offer with quantity discounts for a series of my products:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Buy 1 item and get $5 off per item&lt;/li&gt;&#xA;&lt;li&gt;Buy 2 items and get $10 off per item&lt;/li&gt;&#xA;&lt;li&gt;Buy 3 items and get $15 off per item&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I set these &lt;strong&gt;discount rules&lt;/strong&gt; in my control panel under &quot;commerce&quot; &gt; &quot;promotions&quot;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;product template&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now in my product template, I would like to be able to output (for each quantity level):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the normal (non-discounted) price&lt;/li&gt;&#xA;&lt;li&gt;the discounted price&lt;/li&gt;&#xA;&lt;li&gt;savings in terms of $&lt;/li&gt;&#xA;&lt;li&gt;savings in terms of %&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For example it would then say on the product page (output):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;If you buy 2 items, you only pay $[&lt;em&gt;discount price for 2 items&lt;/em&gt;]&#xA;  instead of $[&lt;em&gt;normal price&lt;/em&gt;] per item. So your total today is only&#xA;  $[&lt;em&gt;2 x discount price for 2 items&lt;/em&gt;] insted of $[&lt;em&gt;2 x normal price&lt;/em&gt;].&#xA;  You therefore save $[(2 x normal price)-(2 x discount price for 2&#xA;  items)]. That's a discount of […]%.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The same goes for the discount offer of ordering 1 item or 3 items.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I accomplish this with all the discounts and math operations involved?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5199" LastActivityDate="2016-05-31T12:06:45.437" Title="Commerce: Show quantity discounts" Tags="&lt;plugin-craftcommerce&gt;&lt;promotions&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15287" PostTypeId="2" ParentId="6795" CreationDate="2016-05-31T10:45:44.970" Score="1" Body="&lt;p&gt;I was having this issue and got it fixed by doing the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I am using Ubuntu&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assume &lt;code&gt;apache2&lt;/code&gt; is installed&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;sudo a2enmod rewrite&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ensure &lt;code&gt;Options FollowSymLinks SymLinksIfOwnerMatch&lt;/code&gt; is within your virtualhost &lt;code&gt;&amp;lt;directory&amp;gt;&lt;/code&gt; config&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;sudo service apache2 restart&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="4874" LastEditorUserId="57" LastEditDate="2016-05-31T18:49:43.343" LastActivityDate="2016-05-31T18:49:43.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15288" PostTypeId="2" ParentId="15278" CreationDate="2016-05-31T11:47:47.943" Score="2" Body="&lt;p&gt;There are a couple of aspects to consider in your question.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Display entries to the author who created them&lt;/li&gt;&#xA;&lt;li&gt;Display entries which are disabled&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'll assume your Channel/Structure is named &quot;&lt;strong&gt;&lt;em&gt;Gallery Image&lt;/em&gt;&lt;/strong&gt;&quot;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, establish the &lt;strong&gt;User ID&lt;/strong&gt; of the logged in &lt;strong&gt;User&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set loggedInUserID = currentUser.id %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...then find &lt;strong&gt;Entries&lt;/strong&gt; authored by the Logged in User:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set galleryEntries = craft.entries.section('galleryImage').authorId(loggedInUserID) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#authorId&quot; rel=&quot;nofollow&quot;&gt;Entry Author ID parameter info...&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... then loop through any entries which have a &lt;strong&gt;Status&lt;/strong&gt; of &quot;Disabled&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in galleryEntries.status('disabled') %}&#xA;    &amp;lt;h2&amp;gt;Your draft Gallery entries&amp;lt;/h2&amp;gt;&#xA;&#xA;    ...(template code)...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#status&quot; rel=&quot;nofollow&quot;&gt;Entry Status parameter info...&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another variation which you could use, which moves the Status parameter out of the For-Loop, is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set galleryEntries = craft.entries.section('').authorID(loggedInUserID).status('disabled')%}&#xA;{% for entry in galleryEntries %}&#xA;    &amp;lt;h2&amp;gt;Your draft Gallery entries&amp;lt;/h2&amp;gt;&#xA;&#xA;    ...(template code)...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="4215" LastEditDate="2016-05-31T14:22:08.717" LastActivityDate="2016-05-31T14:22:08.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15289" PostTypeId="2" ParentId="15286" CreationDate="2016-05-31T12:06:45.437" Score="3" Body="&lt;p&gt;What have you tried so far?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcommerce.com/docs/discounts&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; seems to be missing, but looking at &lt;code&gt;/craft/plugins/commerce/models/Commerce_DiscountModel.php&lt;/code&gt; you can find the properties &lt;code&gt;purchaseQty&lt;/code&gt; and &lt;code&gt;perItemDiscount&lt;/code&gt; that you need for the calculations.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for prod in product.variants %}&#xA;   {% for discount in craft.commerce.discounts %}&#xA;      {% set totalPrice = (discount.purchaseQty * prod.price) %}&#xA;      {% set totalDiscountPrice = (discount.purchaseQty * (prod.price + discount.perItemDiscount)) %}&#xA;      {% set totalDiscount = (totalPrice-totalDiscountPrice) %}&#xA;      {% set totalDiscountPercent = (totalDiscount/totalPrice)*100 %}&#xA;&#xA;      &amp;lt;p&amp;gt;If you buy {{ discount.purchaseQty }} items, you only pay {{ totalDiscountPrice|currency(cart.currency) }} instead of {{ prod.price|currency(cart.currency) }} per item. So your total today is only {{ totalDiscountPrice|currency(cart.currency) }} insted of {{ totalPrice|currency(cart.currency) }}. You therefore save {{ totalDiscount|currency(cart.currency) }}. That's a discount of {{ totalDiscountPercent|round }}%.&amp;lt;/p&amp;gt;&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will show all of the discounts for all of the products. You will need to modify it slightly if you have specified the discount for a specific product. You also need to check if the discount is enabled or not using &lt;code&gt;discount.enabled&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2016-05-31T12:06:45.437" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15290" PostTypeId="1" AcceptedAnswerId="19750" CreationDate="2016-05-31T13:39:41.330" Score="2" ViewCount="248" Body="&lt;h2&gt;quantity discounts&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have the following offer with quantity discounts for a series of my products:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Buy 1 item and get $5 off per item&lt;/li&gt;&#xA;&lt;li&gt;Buy 2 items and get $10 off per item&lt;/li&gt;&#xA;&lt;li&gt;Buy 3 items and get $15 off per item&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I set these discount rules in my control panel under &quot;commerce&quot; &gt; &quot;promotions&quot;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The problem is that Craft combines the quantity discounts. So when I put 3 items into the cart, Craft will for each item add a $5 discount plus a $10 discount plus a $15 discount per item – so instead of a $15 discount per item I get a $30 discount per item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I might work around this by taking this process into account and simply reducing the quantity discounts in the control panel so they would add up to the desired amount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that's no solution if I want to display &lt;em&gt;discounts per item&lt;/em&gt; and &lt;em&gt;discounted item price&lt;/em&gt; correctly on the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus another issue: When I put 3 items into the cart, I will then see 3 types of discounts applied to my cart which is confusing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is there any way to avoid this sort of combining of discounts?&#xA;Will I have to create an &lt;strong&gt;Adjuster&lt;/strong&gt; to accomplish my intended pricing structure?&lt;/p&gt;&#xA;" OwnerUserId="5199" LastEditorUserId="5199" LastEditDate="2016-05-31T20:44:05.663" LastActivityDate="2017-04-03T09:54:09.280" Title="Commerce: Combining unwanted quantity discounts" Tags="&lt;plugin-craftcommerce&gt;&lt;promotions&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15291" PostTypeId="1" AcceptedAnswerId="15292" CreationDate="2016-05-31T16:16:14.370" Score="4" ViewCount="1365" Body="&lt;p&gt;When adding a YouTube video to a rich text field the video embed appears as expected. The entry then fails to save with no error (if I make other changes at the same time they don't save either).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strangely, this only happens on the live server (my local MAMP setup saves the entry as expected) so I'm thinking it might be a server config thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have unchecked the 'Clean up HTML' and 'Purify HTML' options for the field. It's in a Matrix field if that makes any difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my Redactor config (added everything to &lt;code&gt;allowedTags&lt;/code&gt; to try to figure it out):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;buttons&quot;: [&quot;html&quot;,&quot;formatting&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;unorderedlist&quot;,&quot;orderedlist&quot;,&quot;link&quot;,&quot;image&quot;,&quot;video&quot;],&#xA;  &quot;plugins&quot;:[&quot;fullscreen&quot;,&quot;video&quot;],&#xA;  &quot;toolbarFixed&quot;: true,&#xA;  &quot;pastePlainText&quot;: true,&#xA;  &quot;allowedTags&quot;: [&quot;a&quot;, &quot;abbr&quot;, &quot;address&quot;, &quot;area&quot;, &quot;article&quot;, &quot;aside&quot;, &quot;audio&quot;, &quot;b&quot;, &quot;bdi&quot;, &quot;bdo&quot;, &quot;blockquote&quot;, &quot;br&quot;, &quot;button&quot;, &quot;canvas&quot;, &quot;caption&quot;, &quot;cite&quot;, &quot;code&quot;, &quot;col&quot;, &quot;colgroup&quot;, &quot;dd&quot;, &quot;del&quot;, &quot;dfn&quot;, &quot;div&quot;, &quot;dl&quot;, &quot;dt&quot;, &quot;em&quot;, &quot;fieldset&quot;, &quot;figcaption&quot;, &quot;figure&quot;, &quot;footer&quot;, &quot;form&quot;, &quot;h1&quot;, &quot;h2&quot;, &quot;h3&quot;, &quot;h4&quot;, &quot;h5&quot;, &quot;h6&quot;, &quot;header&quot;, &quot;hgroup&quot;, &quot;hr&quot;, &quot;i&quot;, &quot;iframe&quot;, &quot;img&quot;, &quot;input&quot;, &quot;ins&quot;, &quot;kbd&quot;, &quot;keygen&quot;, &quot;label&quot;, &quot;legend&quot;, &quot;li&quot;, &quot;map&quot;, &quot;mark&quot;, &quot;menu&quot;, &quot;nav&quot;, &quot;ol&quot;, &quot;optgroup&quot;, &quot;option&quot;, &quot;p&quot;, &quot;picture&quot;, &quot;pre&quot;, &quot;q&quot;, &quot;rp&quot;, &quot;rt&quot;, &quot;ruby&quot;, &quot;s&quot;, &quot;samp&quot;, &quot;section&quot;, &quot;select&quot;, &quot;small&quot;, &quot;source&quot;, &quot;span&quot;, &quot;strong&quot;, &quot;sub&quot;, &quot;summary&quot;, &quot;sup&quot;, &quot;table&quot;, &quot;tbody&quot;, &quot;td&quot;, &quot;textarea&quot;, &quot;tfoot&quot;, &quot;th&quot;, &quot;thead&quot;, &quot;time&quot;, &quot;title&quot;, &quot;tr&quot;, &quot;track&quot;, &quot;u&quot;, &quot;ul&quot;, &quot;var&quot;, &quot;video&quot;, &quot;wbr&quot;],&#xA;  &quot;replaceDivs&quot;: false,&#xA;  &quot;formatting&quot;: [&quot;p&quot;],&#xA;  &quot;formattingAdd&quot;: {&#xA;    &quot;heading&quot;: {&#xA;      &quot;title&quot;: &quot;Heading&quot;,&#xA;      &quot;args&quot;: [&quot;h2&quot;, &quot;class&quot;, &quot;h2&quot;, &quot;toggle&quot;]&#xA;    },&#xA;    &quot;subheading&quot;: {&#xA;      &quot;title&quot;: &quot;Subheading&quot;,&#xA;      &quot;args&quot;: [&quot;h3&quot;, &quot;class&quot;, &quot;h3&quot;, &quot;toggle&quot;]&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1047" LastActivityDate="2016-05-31T18:55:41.547" Title="YouTube video embeds in rich text field not saving" Tags="&lt;control-panel&gt;&lt;redactor&gt;&lt;richtext&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15292" PostTypeId="2" ParentId="15291" CreationDate="2016-05-31T18:55:41.547" Score="4" Body="&lt;p&gt;My guess is you're running into one of two issues.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You're bumping into your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-input-vars&quot; rel=&quot;noreferrer&quot;&gt;max_intput_vars&lt;/a&gt; and/or &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.post-max-size&quot; rel=&quot;noreferrer&quot;&gt;post_max_size&lt;/a&gt; limitations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your server has something like &lt;a href=&quot;https://suhosin.org/stories/index.html&quot; rel=&quot;noreferrer&quot;&gt;Suhosin&lt;/a&gt; or &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;noreferrer&quot;&gt;mod_security&lt;/a&gt; installed and the content you're trying to save in the Rich Text field is triggering one of their security rules.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-05-31T18:55:41.547" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15293" PostTypeId="2" ParentId="15290" CreationDate="2016-05-31T23:52:58.177" Score="1" Body="&lt;p&gt;Not really a good answer as such but at the moment (June 16) there is currently no facility to print the actual price a particular item will sell at after all discounts/sales are applied (unless you calculate it yourself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to me a bit of an oversight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have requested it as a feature, and Luke seemed amenable to the idea but I have no idea on the ETA for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve the cumulative discount issue - you can either express the discount as a cumulative thing as you mention, or you could write a simple plugin that listens to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_discounts.onbeforematchlineitem&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_discounts.onbeforematchlineitem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and only applies the desired discounts when the desired conditions are met&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-05-31T23:52:58.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15294" PostTypeId="2" ParentId="15274" CreationDate="2016-06-01T05:51:53.010" Score="1" Body="&lt;p&gt;Turns out there was nothing wrong with that code at all. In fact i had accidentally set the subscriptions with hyphens as demonstrated above, however users were set with camelCase. Code works exactly as expected now.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-06-01T05:51:53.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15295" PostTypeId="2" ParentId="15284" CreationDate="2016-06-01T09:24:44.590" Score="3" Body="&lt;p&gt;Looks like what I'm trying to do isn't possible (yet).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a suggestion for a solution (not created by me) already on the Craft Feedback site. So if you think this would be a useful thing to be able to do, get over there and vote it up, I know I have!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://feedback.craftcms.com/forums/295386-commerce/suggestions/11458980-fetch-orders-based-on-a-product-and-or-product-var&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/295386-commerce/suggestions/11458980-fetch-orders-based-on-a-product-and-or-product-var&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-06-01T09:24:44.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15296" PostTypeId="1" AcceptedAnswerId="15314" CreationDate="2016-06-01T09:55:13.793" Score="2" ViewCount="560" Body="&lt;p&gt;When uploading a new asset the loading bar appears complete but does not actually upload the JPG. I've investigated the Craft logs and cannot find any errors regarding this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Javascript console I can see the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://your-domain.com/index.php/admin/actions/assets/uploadFile 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using MAMP but this also happens on our development servers running apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This issue does not happen with PNG's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After further investigation I found the Preview for the uploadFile &quot;thing&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Preview had the content&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Error [500]&#xA;&#xA;include(/Users/you/Sites/your-domain/craft/app/vendor/lsolesen/pel/src/PelInvalidDataException.php):&#xA;failed to open stream: No such file or directory &#xA;(/Users/you/Sites/your-domain/craft/app/vendor/composer/ClassLoader.php:412)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then looked in the &lt;code&gt;lsolesen&lt;/code&gt; vendor folder (which happens to handle stuff for Jpg and Tiff files) and the &lt;strong&gt;PelInvalidDataException.php&lt;/strong&gt; file is missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've copied this file from the git repo into the vendor folder and this now works. However this feels sketchy as hell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering whether it could be a composer install issue&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4363" LastEditorUserId="57" LastEditDate="2016-06-02T04:31:56.607" LastActivityDate="2016-06-02T04:31:56.607" Title="JPG upload not completing in Craft 2.6.2789" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15297" PostTypeId="1" CreationDate="2016-06-01T10:42:06.023" Score="2" ViewCount="2300" Body="&lt;p&gt;I have a text field that will accept some German text in it as a headline of a section. I'm using Craft's &lt;code&gt;|kebab&lt;/code&gt; filter to turn that into a lowercase-with-dashes id that my navigation scrolls down to when its corresponding link is clicked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when there's a word like &quot;Über Uns&quot;, the umlaut Ü stays in the output like so: &quot;über-uns&quot; and this messes up my javascript so the scrolling doesn't work for that one item. Is there a filter or something to have it be output to &quot;ueber-uns&quot;?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="57" LastEditDate="2016-06-02T05:18:39.290" LastActivityDate="2016-06-02T05:18:39.290" Title="Twig filter to convert special characters to URL friendly characters" Tags="&lt;templating&gt;&lt;localization&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15298" PostTypeId="1" CreationDate="2016-06-01T10:50:34.287" Score="2" ViewCount="97" Body="&lt;p&gt;I've written a plugin which intercepts the &lt;code&gt;user.onSaveUser&lt;/code&gt; event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if the save fails the user is still redirected to the page specified in the 'redirect' parameter/field of the form. How do I redirect them back to the form with errors and then access those errors? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables()&lt;/code&gt; but still being returned to the page/URL specified in the original form. If I remove the redirect field from the front-end form I am redirected to the form on error but cannot access the errors sent in &lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to specify the redirect destination depending on success/fail and also how to send/access the offending error messages in my original template?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-06-02T15:38:28.840" Title="onSaveUser event - cannot redirect or access errors" Tags="&lt;plugin-development&gt;&lt;usermodel&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15299" PostTypeId="1" CreationDate="2016-06-01T11:38:41.593" Score="2" ViewCount="77" Body="&lt;p&gt;More newbie stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my &lt;code&gt;index.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UJ7Aw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UJ7Aw.png&quot; alt=&quot;screenshot of index.html&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and here's what Chrome is doing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eV1A5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eV1A5.png&quot; alt=&quot;screenshot Chrome dev tools&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, where is it coming from because I obviously don't want that message on the homepage?&lt;/p&gt;&#xA;" OwnerUserId="5202" LastEditorUserId="22" LastEditDate="2017-05-09T21:53:56.550" LastActivityDate="2017-05-09T21:53:56.550" Title="How to change the message on the homepage" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15300" PostTypeId="2" ParentId="15299" CreationDate="2016-06-01T11:59:25.340" Score="6" Body="&lt;p&gt;that's the content of the default 'Homepage' entry, which you'll find in the Entries section of the control panel. That's what is being inserted with the &lt;code&gt;{{ entry.body }}&lt;/code&gt; variable in the index.html template.&lt;/p&gt;&#xA;" OwnerUserId="4553" LastActivityDate="2016-06-01T11:59:25.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15301" PostTypeId="1" AcceptedAnswerId="15302" CreationDate="2016-06-01T13:45:18.130" Score="4" ViewCount="2243" Body="&lt;p&gt;I can't seem to find this anywhere. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/entry/search.json' =&amp;gt; function() {&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'search' =&amp;gt; (craft()-&amp;gt;request-&amp;gt;getParam('search')) ? craft()-&amp;gt;request-&amp;gt;getParam('search') : '' &#xA;        ],&#xA;        'first' =&amp;gt; true,&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            ];&#xA;        },&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the url: &lt;code&gt;api/entry/search.json?search=title:test&lt;/code&gt; did not work.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This code works, but the title needs to be exact:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/entry/search.json' =&amp;gt; function() {&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'title' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getParam('title')&#xA;        ],&#xA;        'first' =&amp;gt; true,&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            ];&#xA;        },&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this url: &lt;code&gt;api/entry/search.json?title=Test%20Article&lt;/code&gt;, works, but not &lt;code&gt;api/entry/search.json?title=Test&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2016-06-01T14:29:55.170" LastActivityDate="2016-06-02T05:21:25.257" Title="How do I use the Element API to search via entry title?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15302" PostTypeId="2" ParentId="15301" CreationDate="2016-06-01T13:57:59.780" Score="5" Body="&lt;p&gt;Following is an example of using the search feature in a GET request with parameter 'search'.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['search' =&amp;gt; (craft()-&amp;gt;request-&amp;gt;getParam('search')) ? 'title:'.craft()-&amp;gt;request-&amp;gt;getParam('search') : '' ],&#xA;    'paginate' =&amp;gt; true,&#xA;    'elementsPerPage' =&amp;gt; 10,&#xA;    'pageParam' =&amp;gt; 'pg',&#xA;    'transformer' =&amp;gt; new ListTransformer(),&#xA;];`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume you can use this instead of the custom transformer class that is being used in the above example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'summary' =&amp;gt; $entry-&amp;gt;summary,&#xA;        'body' =&amp;gt; $entry-&amp;gt;body,&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4637" LastEditorUserId="57" LastEditDate="2016-06-02T05:21:25.257" LastActivityDate="2016-06-02T05:21:25.257" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15303" PostTypeId="1" CreationDate="2016-06-01T14:19:32.373" Score="2" ViewCount="571" Body="&lt;p&gt;I noticed my Craft website is slower to load when it has been idle for awhile. It can take up to 3-4 seconds for the first load, and then it goes down to about 500ms (which is fine) after the first page. I'm also using cache so I could get my query count to about 20-30 per page. I have other websites (non Craft) on the server that are fast to load even when they have been idle for awhile. Any idea what's causing this? &lt;/p&gt;&#xA;" OwnerUserId="5050" LastEditorUserId="57" LastEditDate="2016-06-02T05:17:56.893" LastActivityDate="2016-06-02T05:17:56.893" Title="Slow initial response time when website has been idle?" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15304" PostTypeId="2" ParentId="15297" CreationDate="2016-06-01T14:35:18.410" Score="2" Body="&lt;p&gt;My first idea would be to use the &lt;code&gt;url_encode&lt;/code&gt; filter than would turn your special characters into a URL friendly format. I imagine these would also be Javascript friendly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to convert the characters to something like &quot;ueber-uns&quot; maybe take a look at the &lt;code&gt;convert_encoding&lt;/code&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/convert_encoding.html&quot; rel=&quot;nofollow&quot;&gt;filter&lt;/a&gt; in Twig. It uses a function called &lt;a href=&quot;http://php.net/manual/en/function.mb-convert-encoding.php&quot; rel=&quot;nofollow&quot;&gt;mb-convert-encoding&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to find what encoding you'd need to use to convert &lt;code&gt;Ü&lt;/code&gt; to something javascript friendly but was only able print even more obscure characters.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-01T14:35:18.410" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15305" PostTypeId="1" CreationDate="2016-06-01T14:36:28.083" Score="2" ViewCount="68" Body="&lt;p&gt;I want something sorted like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MyString8&lt;/li&gt;&#xA;&lt;li&gt;MyString9&lt;/li&gt;&#xA;&lt;li&gt;MyString10&lt;/li&gt;&#xA;&lt;li&gt;MyString11&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$criteria-&amp;gt;order = 'myField asc&lt;/code&gt; doesn't get things quite right, as MySQL has not native &quot;natural sorting&quot;.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2016-06-01T14:39:46.507" LastActivityDate="2016-06-01T14:44:37.670" Title="&quot;Natural&quot; sorting for ElementCriteria" Tags="&lt;elementcriteriamodel&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15306" PostTypeId="2" ParentId="15305" CreationDate="2016-06-01T14:37:10.663" Score="2" Body="&lt;p&gt;You can fake it by first sorting by character length, and then by the value: &lt;code&gt;$criteria-&amp;gt;order = 'CHAR_LENGTH(myField) asc, myField asc&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its not perfect, but in certain cases, it will be all you need. Other methods exist as well: &lt;a href=&quot;https://stackoverflow.com/a/8557307/935398&quot;&gt;https://stackoverflow.com/a/8557307/935398&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;code&gt;CHAR_LENGTH&lt;/code&gt; is a MySQL function that is getting passed directly to the &lt;code&gt;ORDER BY&lt;/code&gt; clause. It has nothing to do with Craft directly.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-06-01T14:44:37.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15308" PostTypeId="2" ParentId="10" CreationDate="2016-06-01T16:19:43.457" Score="4" Body="&lt;p&gt;I'm currently implementing a workflow that's very efficient for us. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to use Backup Pro to &quot;backup&quot; locally and then &quot;restore&quot; once the site is deployed. This essentially version controls the DB without lots of manual DB dropping and importing. Communication is very important with this method as Devs and Stakeholders need to be aware of how the data is moving around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft CMS with a multi-environment config:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;LOCAL (Local Machines) localhost:3000&lt;/li&gt;&#xA;&lt;li&gt;DEVELOPMENT (On server for developers only) dev.mysite.com&lt;/li&gt;&#xA;&lt;li&gt;STAGING (On server, for client review) staging.mysite.com&lt;/li&gt;&#xA;&lt;li&gt;PRODUCTION (Live Website) mysite.com&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Private Git repo using Beanstalk(BS):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Development (Deploys automatically on Push)&lt;/li&gt;&#xA;&lt;li&gt;Staging (Deploys manually from BS)&lt;/li&gt;&#xA;&lt;li&gt;Production (Deploys manually from BS)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Developers connect to a remote DB on Dev&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;During initial development, LOCAL and DEV environments share a database that is hosted on the server.&lt;/li&gt;&#xA;&lt;li&gt;Local environments connect remotely to the DB. This is configured in the /config/db.php&lt;/li&gt;&#xA;&lt;li&gt;This allows multiple developers to edit the DB and for content creators to simultaneously create content on the dev environment.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After initial development, we will version the DB utilizing Backup Pro:&#xA;&lt;a href=&quot;https://mithra62.com/projects/view/backup-pro&quot; rel=&quot;nofollow&quot;&gt;https://mithra62.com/projects/view/backup-pro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is where the DB versioning magic comes in:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If changes need to made to the PRODUCTION DB, initiate a planned content freeze.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make a Backup of the DB&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sync your local environment with the Production DB. This can be done manually, or using Backup Pro after editing the config settings.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edit the config file to connect to the DB locally.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make all needed changes to the DB locally.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make a backup of the DB using Backup PRO&#xA;-- This will put a backup of the DB in your project, and since your project is under VC, the database will be included in any commits.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Commit, and push to Dev.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Login to the DEV CMS and using Backup Pro's &quot;restore&quot; option, restore the DEV DB with the newish version (The one you just created using Backup Pro).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This process can be repeated for staging and production environments.  That's the overview. In reality it's bit more involved, but that's the general concept that works for our team. It's also nice to have commit messages that explain what's been done to the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If multiple Developers need access to work on the LOCAL DB, you can all connect remotely to a local DB, or agree to connect to the DEVELOPMENT DB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Always, make backups.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another nice feature of Backup pro, is that you can set up cron jobs to make daily backups for you.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3812" LastEditorUserId="3812" LastEditDate="2016-06-01T16:25:38.817" LastActivityDate="2016-06-01T16:25:38.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15309" PostTypeId="1" CreationDate="2016-06-01T18:50:54.870" Score="2" ViewCount="300" Body="&lt;p&gt;We have a site where Live Preview only works with entries that have been previously published. When trying to preview entries we're working on (or drafts), we see either the latest entry for that section instead - or sometimes the correct entry template but with other/missing data in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Puzzled as to what is going on. There are no console errors.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2016-06-01T22:33:31.287" Title="Live Preview only works with published entries" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15310" PostTypeId="1" AcceptedAnswerId="15311" CreationDate="2016-06-01T21:00:26.883" Score="9" ViewCount="2978" Body="&lt;p&gt;I'm interested in building a highly modular Craft site in which my folder structure might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- craft/&#xA;- modules/&#xA;  - hero-banner/&#xA;      index.html&#xA;      scripts.js&#xA;      styles.css&#xA;  - carousel/&#xA;      index.html&#xA;      scripts.js&#xA;      styles.css&#xA;- templates/&#xA;    404.html&#xA;    index.html&#xA;    _layout.html&#xA;index.php&#xA;robots.txt&#xA;.htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An example of what &lt;code&gt;hero-banner/index.html&lt;/code&gt; would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;hero-banner__contain&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;hero-banner__content&quot;&amp;gt;&#xA;    &amp;lt;h2 class=&quot;hero-banner__title&quot;&amp;gt;{{title}}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;p class=&quot;hero-banner__subtitle&quot;&amp;gt;{{subtitle}}&amp;lt;/p&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;img src=&quot;{{image}}&quot; alt=&quot;{{title}}&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An example of how you'd use this in a Craft template like &lt;code&gt;templates/index.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{&#xA;  craft.componentUI.run('hero-banner/index', {&#xA;    title: 'Welcome to my site!',&#xA;    subtitle: 'This is an intro paragraph that has a bit more detail about this site.',&#xA;    image: 'http://dummyimage.com/800x350/000000/555555'&#xA;  })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A couple reasons I'd like to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;To create a parity between a style guide and the live site.&lt;/strong&gt; This way a change to &lt;code&gt;hero-banner/index.html&lt;/code&gt; would be reflected in the style guide and the live site. I understand a partial can do the same thing, but I'd prefer something like this because...&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;We can encapsulate a module's HTML, CSS and JavaScript in one place.&lt;/strong&gt; Doing this will allow us to utilize Git or npm to manage these modules individually if we'd like to use them on other sites. It also makes locating a module's assets much easier since they're centrally located rather than being in 3 different folders.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://selvinortiz.com/blog/rendering-templates-in-custom-locations&quot; rel=&quot;noreferrer&quot;&gt;I've found a way&lt;/a&gt; to reference template files outside the standard &lt;code&gt;templates/&lt;/code&gt; directory to make this work. So I know this sort of setup &lt;em&gt;can&lt;/em&gt; work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my question is &lt;strong&gt;what problems could arise from this type of setup?&lt;/strong&gt; Do I need to be concerned about performance/security/something else entirely?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Just for further clarification, I'm not looking to serve my CSS and JS &lt;em&gt;through&lt;/em&gt; Craft. I want to keep my CSS and JS as-is, but wondered if I could call the modules from those directories (outside of the normal Craft templates).&lt;/p&gt;&#xA;" OwnerUserId="712" LastEditorUserId="712" LastEditDate="2016-06-08T00:42:51.287" LastActivityDate="2016-06-08T00:42:51.287" Title="Creating partials outside of the templates folder" Tags="&lt;templating&gt;&lt;performance&gt;&lt;security&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15311" PostTypeId="2" ParentId="15310" CreationDate="2016-06-01T21:33:34.310" Score="9" Body="&lt;p&gt;So a few potential things to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You do not want to be serving static assets like Javascript, CSS, etc. out of the templates directory.  I realize you're planning to put them &quot;elsewhere&quot;, but ensure that elsewhere is in the &lt;code&gt;/public/&lt;/code&gt; folder, so that php, Yii, and Craft do not have to be spun up just to serve a static asset.  Do not use a Craft routine/plugin to load them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The entire point of modularization is that the payoff is down the road as you're able to reuse components on future projects by just &quot;plugging them in&quot;.  I've seen this approach taken on many types of software projects, from desktop apps to mobile apps to websites.  It almost never works out as well as people think it will, unless it is seriously well architected, because we're generally not a factory churning out widgets.  There are things unique to each website beyond the basic functionality that requires customization; writing something that is both that general, and also useful is difficult.  Think of how many hours you have spent fighting even well-implemented frameworks like Bootstrap or Foundation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most things of this nature either end up being way, way over engineered and bloated, with a ton of time spent on them, and the promised gains down the road in terms of time savings never being realized due to the aforementioned issues.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Just my two cents.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-06-01T21:33:34.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15312" PostTypeId="2" ParentId="15309" CreationDate="2016-06-01T22:33:31.287" Score="2" Body="&lt;p&gt;My understanding is you have to save an entry first before you can use live preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brandon says as much in his answer here as well:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/12091/103&quot;&gt;https://craftcms.stackexchange.com/a/12091/103&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-01T22:33:31.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15314" PostTypeId="2" ParentId="15296" CreationDate="2016-06-02T04:31:11.820" Score="2" Body="&lt;p&gt;My guess is you had an auto-update or a git deployment go bad and some files didn't get updated properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be safe, I'd download a fresh copy of Craft from &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com&lt;/a&gt; and replace your existing &lt;code&gt;craft/app&lt;/code&gt; folder with the new one to make sure you've got all of the latest files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-02T04:31:11.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15315" PostTypeId="2" ParentId="15303" CreationDate="2016-06-02T05:17:31.957" Score="2" Body="&lt;p&gt;You mention you're using cache, which could mean a whole lot of things, but the symptoms you're describing are typical of what you'd see if you're doing some heavy-handed things inside of a &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;{% cache %}&lt;/a&gt;, you let that expire, then you're the first person to hit the page when the cache has to rebuild.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That &lt;code&gt;{% cache %}&lt;/code&gt; tag, by &lt;a href=&quot;https://craftcms.com/docs/config-settings#cacheDuration&quot; rel=&quot;nofollow&quot;&gt;default&lt;/a&gt;, will purge its cache every 24 hours unless you've specified otherwise.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-02T05:17:31.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15316" PostTypeId="2" ParentId="15310" CreationDate="2016-06-02T07:21:46.363" Score="6" Body="&lt;p&gt;I've been making use of macros to create a component based architecture in a recent project. I've found this way of working useful in a few different ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Jumping around your codebase is much easier as you only have to remember what you've named your components or their parent folder to find and edit them. &lt;/li&gt;&#xA;&lt;li&gt;It keeps your main templates easier to scan. &lt;/li&gt;&#xA;&lt;li&gt;You can quickly see what components are being used in a template.&lt;/li&gt;&#xA;&lt;li&gt;It helps to maintain consistency when components are re-used across&#xA;the site.&lt;/li&gt;&#xA;&lt;li&gt;I haven't noticed any hit regarding performance&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I do try and make these components are simple as they can be to help them be as reusable as possible. An example would be not adding a grid container around the component and instead setting this in my template - this goes a small way to combating those specific use cases on a page level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of keeping your CSS and JS inside these component folders, I'd stay away from using Craft to fetch these for you like khalwat mentioned. I set up a similar structure for my SASS files &lt;code&gt;_components/heroBanner/heroBanner.scss&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking your hero-banner as an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folder structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- templates/&#xA;  _components/&#xA;    image/&#xA;      image.twig&#xA;    heroBanner/&#xA;      heroBanner.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;heroBanner.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro heroBanner( title, subtitle, image ) -%}&#xA;  {% from '_components/image/image' import image %}&#xA;  &amp;lt;div class=&quot;hero-banner__contain&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;hero-banner__content&quot;&amp;gt;&#xA;      &amp;lt;h2 class=&quot;hero-banner__title&quot;&amp;gt;{{ title }}&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;p class=&quot;hero-banner__subtitle&quot;&amp;gt;{{ subtitle }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {{ image( image, title ) }}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Used in a template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Import components used for that template&#xA;{% from '_components/heroBanner/heroBanner' import heroBanner %}&#xA;&#xA;&amp;lt;header&amp;gt;&#xA; {{ heroBanner( 'Welcome to my site!', 'This is an intro paragraph that has a bit more detail about this site.', http://dummyimage.com/800x350/000000/555555' }}&#xA;&amp;lt;/header&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also used the folder structure to show how components can be made up of other smaller related components:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_components/&#xA;  basket/   &#xA;    basketDropdown.twig&#xA;    basketFull.twig&#xA;    basketItemFull.twig&#xA;    basketItemMini.twig&#xA;    basketLogic.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-02T07:21:46.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15318" PostTypeId="1" CreationDate="2016-06-02T13:20:55.377" Score="1" ViewCount="334" Body="&lt;p&gt;Many of the customers we'll be selling to are tax-exempt entities. We're located in OH, so for OH customers we're applying sales tax through the Tax Zone setup in Commerce. Is there a way to not apply the tax based on some conditional, even though their billing address is in OH?&lt;/p&gt;&#xA;" OwnerUserId="251" LastActivityDate="2016-07-15T18:21:49.540" Title="Conditionally apply a tax zone in commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15319" PostTypeId="1" CreationDate="2016-06-02T13:57:34.280" Score="3" ViewCount="611" Body="&lt;p&gt;What would make a site want me to download the index.php when viewed?  I downloaded the database and all files from a staging server where site was fine.  When I go to any site URL on local machine it prompts me to save &quot;login&quot;.  The contents of the saved file are the public index.php.  Is there some setting or cache I need to clear?  I have 10 other sites working local with no issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running latest version of Craft 2.6.2789 on cPanel EasyApache4 server running the new PHP Handler with PHP7 selected for the site..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It actually is asking me to save the file using whatever the last segment is.  Here are contents from my htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&lt;code&gt;&#xA;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&#xA;# php -- BEGIN cPanel-generated handler, do not edit&#xA;# Set the “ea-php70” package as the default “PHP” programming language.&#xA;&#xA;  AddType application/x-httpd-ea-php70 .php .php7 .phtml&#xA;&#xA;# php -- END cPanel-generated handler, do not edit&#xA;&lt;/code&gt;&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="186" LastEditorUserId="45" LastEditDate="2016-08-13T02:30:33.280" LastActivityDate="2016-08-13T02:30:33.280" Title="Site will not load. Asking me to save &quot;login&quot; as a file" Tags="&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15320" PostTypeId="2" ParentId="15319" CreationDate="2016-06-02T14:12:14.507" Score="3" Body="&lt;p&gt;You need to remove this when running local.  The following piece of code is added on servers running the EasyApache4 PHP Handler.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# php -- BEGIN cPanel-generated handler, do not edit&#xA;# Set the &quot;ea-php70&quot; package as the default &quot;PHP&quot; programming language.&#xA;&#xA;  AddType application/x-httpd-ea-php70 .php .php7 .phtml&#xA;&#xA;# php -- END cPanel-generated handler, do not edit&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="186" LastActivityDate="2016-06-02T14:12:14.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15322" PostTypeId="1" AcceptedAnswerId="15323" CreationDate="2016-06-02T14:27:38.943" Score="6" ViewCount="244" Body="&lt;p&gt;I duplicated a site.  What is the easiest way to delete all assets and text data but keep fields and sections in place?&lt;/p&gt;&#xA;" OwnerUserId="186" LastEditorUserId="45" LastEditDate="2016-06-02T16:38:06.417" LastActivityDate="2016-06-02T16:38:06.417" Title="How can I remove all text content and assets from a duplicated site?" Tags="&lt;content&gt;&lt;deletion&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15323" PostTypeId="2" ParentId="15322" CreationDate="2016-06-02T14:34:54.080" Score="8" Body="&lt;p&gt;You can delete all of your existing entries and assets by executing this SQL query:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;DELETE FROM craft_elements&#xA;WHERE type IN ('Entry', 'Category', 'Tag', 'Asset')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All associated content, relationships, etc., will automatically be deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a bunch of users you want to delete, you should at least spare your own admin account, so figure out your user ID and do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;DELETE FROM craft_elements&#xA;WHERE type IN ('Entry', 'Category', 'Tag', 'Asset', 'User')&#xA;AND id != 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The admin account created during installation will have the ID of 1, assuming you haven’t deleted the account.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also delete existing asset sources, assuming those are going to need to change and will have their own sets of files. You can either do that from the Control Panel, or execute this SQL query:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;DELETE FROM craft_assetsources&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-06-02T14:34:54.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15324" PostTypeId="2" ParentId="15298" CreationDate="2016-06-02T15:38:28.840" Score="1" Body="&lt;p&gt;As your code is running during an event, returning the request to the page has to be done a bit more explicitly than when you are performing similar behavior in a controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I'm probably not the best person to explain this in detail, the code below gives one example I was provided in how you can set your route variables and end the request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($errors)&#xA;{&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'errors' =&amp;gt; $errors&#xA;    ));&#xA;&#xA;    $route = craft()-&amp;gt;urlManager-&amp;gt;parseUrl(craft()-&amp;gt;request);&#xA;    craft()-&amp;gt;runController($route);&#xA;    craft()-&amp;gt;end();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-02T15:38:28.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15325" PostTypeId="1" CreationDate="2016-06-02T18:56:10.153" Score="3" ViewCount="364" Body="&lt;p&gt;I have a LEMP droplet on digitalocean that I am trying to get working with Craft CMS. &#xA;Strangely it does not seem to play nice with NGINX. Or maybe it's just me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After installation I am receiving the below message;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RCgsD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RCgsD.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have php5-mcrypt installed and it appears in phpinfo()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9KuuT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9KuuT.png&quot; alt=&quot;phpinfo() screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- NGINX config for craft (craft.conf)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;  listen   80;&#xA;&#xA;  root /var/www/public;&#xA;  index index.php index.html index.htm;&#xA;&#xA;  server_name ger1-riverrun.mydomain.com;&#xA;&#xA;  location / {&#xA;    try_files $uri $uri/ @rewrites;&#xA;  }&#xA;&#xA;  location @rewrites {&#xA;    rewrite ^(.*) /index.php?p=$1 last;&#xA;  }&#xA;&#xA;  location ~ \.php$ {&#xA;    try_files $uri =404;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi_params;&#xA;  }&#xA;&#xA;  error_page 404 /index.php;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5226" LastEditorUserId="45" LastEditDate="2016-08-13T02:32:35.523" LastActivityDate="2016-08-13T02:32:35.523" Title="Craft CMS on LEMP Stack (mcrypt not detected)" Tags="&lt;mcrypt&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15326" PostTypeId="1" CreationDate="2016-06-02T20:10:18.450" Score="1" ViewCount="89" Body="&lt;p&gt;I can access Craft admin page at work, but I cannot access the admin page at home.&#xA;Is it limited by IP address in the code?&#xA;The whole site is hosted at vendor's server with Plesk web host edition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to Craft. Does anybody have any suggestion?&lt;/p&gt;&#xA;" OwnerUserId="5227" LastEditorUserId="45" LastEditDate="2016-08-13T02:41:05.907" LastActivityDate="2016-08-13T02:41:05.907" Title="Craft admin page 403 at home" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15327" PostTypeId="2" ParentId="15326" CreationDate="2016-06-02T20:35:52.110" Score="1" Body="&lt;p&gt;I find the answer. The config is in &quot;Additional nginx directives&quot;&lt;/p&gt;&#xA;" OwnerUserId="5227" LastActivityDate="2016-06-02T20:35:52.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15328" PostTypeId="2" ParentId="15310" CreationDate="2016-06-02T21:19:56.917" Score="3" Body="&lt;p&gt;Some good answers already by &lt;a href=&quot;https://craftcms.stackexchange.com/a/15316/1016&quot;&gt;Luke&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/15311/1016&quot;&gt;khalwat&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I wouldn't try to load any templates outside of the normal Craft folder... you get into plugin territory there and it's not necessary.  Your templates should always live in the &lt;code&gt;templates&lt;/code&gt; folder.&lt;/p&gt;&#xA;&lt;p&gt;That leaves what to do with your static resources.&lt;/p&gt;&#xA;&lt;h1&gt;Inline JS/CSS?&lt;/h1&gt;&#xA;&lt;p&gt;One thing I didn't see brought up in either answer was inlining the styles and JS. If you only have a few lines, why not inline them? Craft provides the &lt;a href=&quot;https://craftcms.com/docs/templating/includecss&quot; rel=&quot;nofollow noreferrer&quot;&gt;{&lt;code&gt;% includeCss %}&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/includejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;{&lt;code&gt;% includeJs %}&lt;/code&gt;&lt;/a&gt; to handle cases just like this.  That'll keep your modules nice and tidy.&lt;/p&gt;&#xA;&lt;h1&gt;Let the webserver handle it&lt;/h1&gt;&#xA;&lt;p&gt;As khalwat mentioned, Craft is happy to serve up those static resources for you but it'll fire up PHP to do so.&lt;/p&gt;&#xA;&lt;p&gt;You can actually work around this with by intercepting the request before it gets to Craft.&lt;/p&gt;&#xA;&lt;p&gt;For example, nginx lets you change the default root to a different directory, based on how you want to handle the request. So a request for &lt;code&gt;\\example.com/resources/style.css&lt;/code&gt; would be served out of the &lt;code&gt;resources&lt;/code&gt; directory inside your &lt;code&gt;templates&lt;/code&gt; folder.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;location ^~ /resources {&#xA;&#xA;   alias /path/to/craft/templates/resources;&#xA;&#xA;   # make sure twig/html templates aren't sent directly &#xA;   location ~* \.(?:html|twig)$ {&#xA;     rewrite ^ /index.php?p=404;&#xA;   }&#xA;&#xA;  location ~* \.(?:css|js)$ {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;&#xA;  }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will break Craft's &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;routing&lt;/a&gt;  of course (#6) but only for files below &lt;code&gt;/resources/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Apache has &lt;a href=&quot;https://httpd.apache.org/docs/current/mod/mod_alias.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;alias&lt;/code&gt;&lt;/a&gt; which works similarly.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-06-02T21:19:56.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15329" PostTypeId="2" ParentId="9005" CreationDate="2016-06-02T22:16:38.040" Score="2" Body="&lt;p&gt;This query cannot be created in the &quot;ideal&quot; way described in the question using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria&lt;/code&gt;. It required several steps to build the results needed. The final solution was a bit specific to our needs. Here is some pseudocode that represents a solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$urls = array();&#xA;&#xA;// Fetch all enabled locales&#xA;foreach (craft()-&amp;gt;i18n-&amp;gt;getSiteLocales() as $locale)&#xA;{&#xA;    // Confirm there are elements in a specific locale and get them&#xA;    ...&#xA;    $criteria-&amp;gt;locale = $locale-&amp;gt;id;&#xA;    $elements = $criteria-&amp;gt;find();&#xA;&#xA;    foreach ($elements as $element)&#xA;    {&#xA;        // Add each location indexed by its id&#xA;        $urls[$element-&amp;gt;id][] = array(...);&#xA;    }&#xA;}&#xA;&#xA;// Process what we created above and adjust it to fit our needs&#xA;$urls = $this-&amp;gt;processUrlsIntoTheRightFormat($urls);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-02T22:16:38.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15330" PostTypeId="1" CreationDate="2016-06-02T23:16:10.827" Score="0" ViewCount="169" Body="&lt;p&gt;I have a simple entry form on the frontend that will not save form data. After submit it returns to the form page with no errors, rather than going to the url I set in the redirect variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done this dozens of times on other sites - the section ID is correct, the user has permission to create an entry (even tried as SuperAdmin, same failure). I then tried using the sample form from the Craft docs page, still no luck. I even recreated everything verbatim on another Craft site and it works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server configuration seems fine and there are no other issues with the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pulling out what is left of my hair trying to figure out what is going on - any suggestions would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2016-06-02T23:16:10.827" Title="Entry Form not working" Tags="&lt;form&gt;&lt;entry&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15331" PostTypeId="2" ParentId="15325" CreationDate="2016-06-02T23:16:13.813" Score="1" Body="&lt;p&gt;RitterKnights solution worked! I hadnt restarted php5-fpm.&lt;/p&gt;&#xA;" OwnerUserId="5226" LastActivityDate="2016-06-02T23:16:13.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15332" PostTypeId="1" AcceptedAnswerId="15333" CreationDate="2016-06-03T09:18:14.157" Score="3" ViewCount="50" Body="&lt;p&gt;There are several enum classes containing constants such as the &lt;code&gt;SectionType&lt;/code&gt; class which I can use to create sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//  …&#xA;$section = new SectionModel();&#xA;$section-&amp;gt;type = SectionType::Single;&#xA;//  …&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what about creating fields? Currently I create fields like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//  …&#xA;$field = new FieldModel();&#xA;$field-&amp;gt;type = 'PlainText';&#xA;//  …&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any enum class containing valid identifiers I could use to create a field? Like in the following way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//  …&#xA;$field = new FieldModel();&#xA;$field-&amp;gt;type = FieldType::PlainText;     // Does something like this exist?&#xA;//  …&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find such a class or any other listing of existing field types, where do I?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, a list of string identifiers is missing on the guide for &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;plugin development and field types&lt;/a&gt;. The &lt;a href=&quot;https://craftcms.com/docs/fields#field-types&quot; rel=&quot;nofollow&quot;&gt;list of field types&lt;/a&gt; only tells me which field types exist but not what identifiers they have.&lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2016-06-03T20:42:16.927" Title="Which string identifiers for field types do exist?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15333" PostTypeId="2" ParentId="15332" CreationDate="2016-06-03T12:12:07.483" Score="5" Body="&lt;p&gt;I don't know if any enum exists (couldn't find it in source), but you could have a look at the contents of the &lt;code&gt;craft/app/fieldtypes&lt;/code&gt; folder (and ignore BaseFieldtypes, DataModels and interfaces) to find the identifiers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;UsersFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;TagsFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;TableFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;RichTextFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;RadioButtonsFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;PositionSelectFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;PlainTextFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;NumberFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;MultiSelectFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;MatrixFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;LightswitchFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;EntriesFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;DropdownFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;DateFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;ColorFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;CheckboxesFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;CategoriesFieldType.php&lt;/li&gt;&#xA;&lt;li&gt;AssetsFieldType.php&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;String identifiers correspond to the file names (without &quot;FieldType.php&quot;, obviously).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2016-06-03T12:12:07.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15334" PostTypeId="1" AcceptedAnswerId="15352" CreationDate="2016-06-03T17:56:21.123" Score="5" ViewCount="762" Body="&lt;p&gt;I am trying to eager load an image asset assigned to a matrix. The template is pulling entries in from a section and each entry has the matrix field assigned to it that serves as an image gallery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I am getting back using the syntax below is&#xA;&lt;strong&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;primaryImage&quot;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section Handle: products&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Field Handle: gallery&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Block Type Handle: productImages&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field Handle: primaryImage, Field Type: Assets&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set products = craft.entries({&#xA;     section: 'products',&#xA;         with:[&#xA;                    ['gallery.productImages:primaryImage', {&#xA;                      withTransforms: [&#xA;                      'heroImage'&#xA;                    ]&#xA;              }],&#xA;          ] &#xA;  }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in products %}&#xA;      {% for block in entry.gallery %}&#xA;            {% if block.type == 'productImages' %}&#xA;                 {% set img = entry.primaryImage[0] ?? null %}&#xA;                       {% if img %}&#xA;                            &amp;lt;img src=&quot;{{ img.url('heroImage') }}&quot;&amp;gt;&#xA;                       {% endif %}&#xA;            {% endif %}&#xA;      {% endfor %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2016-06-06T17:54:05.307" Title="Eager Load Matrix Field with Assets Field Type" Tags="&lt;matrix&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15335" PostTypeId="1" AcceptedAnswerId="15336" CreationDate="2016-06-03T20:16:33.570" Score="2" ViewCount="751" Body="&lt;p&gt;I'm trying to import data from EE using the FeedMe plugin. I'm using the latest version of Craft and the plugin. I've setup the XML file in EE and exported the data. In FeedMe I match up the fields and start the import. However, no entries end up coming in. The logs show lines like &quot;Pages: Entry skipped: 4795.&quot; Which basically is the length of the whole file. I've tried different formatting issues but end up with the same result. I'm guessing the xml file isn't formatted correctly. Any tips on correcting this would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what my template in EE looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    header(&quot;Content-type: application/vnd.ms-excel&quot;);&#xA;header(&quot;Content-Disposition: attachment; filename=pages-export.xml&quot;);&#xA;header(&quot;Pragma: no-cache&quot;);&#xA;header(&quot;Expires: 0&quot;);&#xA;?&amp;gt;&#xA;&amp;lt;xml&amp;gt;&#xA;    &amp;lt;blog&amp;gt;&#xA;{exp:channel:entries channel='site-content' limit='500' disable=&quot;categories|member_data|pagination|comments&quot; status=&quot;open&quot;}&#xA;        &amp;lt;entry&amp;gt;&#xA;            &amp;lt;entry_date&amp;gt;{entry_date format=&quot;%F %d %Y&quot;}&amp;lt;/entry_date&amp;gt;&#xA;            &amp;lt;title&amp;gt;{title}&amp;lt;/title&amp;gt;&#xA;            &amp;lt;slug&amp;gt;{url_title}&amp;lt;/slug&amp;gt;&#xA;            &amp;lt;post&amp;gt;&amp;lt;![CDATA[{main-content}{content}{/main-content}]]&amp;gt;&amp;lt;/post&amp;gt;&#xA;            &amp;lt;images&amp;gt;&#xA;                &amp;lt;![CDATA[{main-content}{photo}{file_name},{/photo}{/main-content}]]&amp;gt;&#xA;            &amp;lt;/images&amp;gt;&#xA;            &amp;lt;video&amp;gt;&amp;lt;![CDATA[{video-page}]]&amp;gt;&amp;lt;/video&amp;gt;&#xA;            &amp;lt;relatedContent&amp;gt;{markets}&amp;lt;/relatedContent&amp;gt;&#xA;        &amp;lt;/entry&amp;gt;&#xA;{/exp:channel:entries}&#xA; &amp;lt;/blog&amp;gt;&#xA;&amp;lt;/xml&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="877" LastEditDate="2016-06-03T21:27:32.077" LastActivityDate="2016-06-03T21:27:32.077" Title="Help with FeedMe" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15336" PostTypeId="2" ParentId="15335" CreationDate="2016-06-03T20:32:55.820" Score="3" Body="&lt;p&gt;Do you need to close out the xml tag at the end? I've used FeedMe successfully several times. Here's a sample xml file I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;xml&amp;gt;&#xA;    &amp;lt;blog&amp;gt;&#xA;        {exp:channel:entries channel=&quot;projects&quot; limit=&quot;500&quot;}&#xA;            &amp;lt;entry&amp;gt;&#xA;                &amp;lt;entry_date&amp;gt;{entry_date format=&quot;%F %d %Y&quot;}&amp;lt;/entry_date&amp;gt;&#xA;                &amp;lt;title&amp;gt;{title}&amp;lt;/title&amp;gt;&#xA;                &amp;lt;slug&amp;gt;{url_title}&amp;lt;/slug&amp;gt;&#xA;                &amp;lt;summary&amp;gt;&amp;lt;![CDATA[{project-body}]]&amp;gt;&amp;lt;/summary&amp;gt;&#xA;                &amp;lt;post&amp;gt;&amp;lt;![CDATA[{project-body-expanded}]]&amp;gt;&amp;lt;/post&amp;gt;&#xA;                &amp;lt;location&amp;gt;&amp;lt;![CDATA[{project-location}]]&amp;gt;&amp;lt;/location&amp;gt;&#xA;                &amp;lt;images&amp;gt;&#xA;                    &amp;lt;![CDATA[{project-images backspace=&quot;1&quot;}{image}{file_name},{/image}{/project-images}]]&amp;gt;&#xA;                &amp;lt;/images&amp;gt;&#xA;                &amp;lt;headline&amp;gt;&amp;lt;![CDATA[{headline}]]&amp;gt;&amp;lt;/headline&amp;gt;&#xA;                &amp;lt;quote&amp;gt;&amp;lt;![CDATA[{client-quote}]]&amp;gt;&amp;lt;/quote&amp;gt;&#xA;                &amp;lt;category&amp;gt;&amp;lt;![CDATA[{categories backspace=&quot;1&quot;}{category_name},{/categories}]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;            &amp;lt;/entry&amp;gt;&#xA;        {/exp:channel:entries}&#xA;    &amp;lt;/blog&amp;gt;&#xA;&amp;lt;/xml&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5233" LastEditorUserId="57" LastEditDate="2016-06-03T20:46:58.547" LastActivityDate="2016-06-03T20:46:58.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15337" PostTypeId="2" ParentId="15332" CreationDate="2016-06-03T20:42:16.927" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/15333/57&quot;&gt;Paul is correct&lt;/a&gt;, but probably worth adding if you want the full list of &quot;enums&quot; Craft has available you can look at &lt;a href=&quot;https://craftcms.com/classreference#craft.app.enums&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.app.enums&lt;/code&gt;&lt;/a&gt; in the class reference.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-06-03T20:42:16.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15340" PostTypeId="1" CreationDate="2016-06-04T14:44:07.797" Score="3" ViewCount="68" Body="&lt;p&gt;May be over thinking this but I wonder if anyone else has had to deal with a similar issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building a site which holds my PhD research. The main type of assets I'll be presenting are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sketches&#xA;Audio files&#xA;Videos&#xA;Video Links&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm am going back an forth between 1) creating individual entries for each asset , defining t's type and linking to the file 2) Adding fields to the assets themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The benefit of 2) is I have no need to create unique entries which feels like additional work. The main drawback of 2) is I have no way of managing youtube links (or other links to external files) as an asset as no physical file exists in craft. I would ideally like to manage all these research elements in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These element can be viewed in various ways in craft through relatedTo. Which will allow sketches to be viewed in a sketchbook as individual sketches to be viewed in relation to a project. It seems that having them as entries (1) would make this easier, but I may be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone any thoughts on this problem? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I response to Mats:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin you suggest sounds perfect, Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a specific example One type of research is a design journal. Each page is made up of a scan of the actual paper journal, Metadata, perhaps a few notes. All of which can be added to the asset. I have 2 options to create the book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Book (Entry type of Journal)&#xA;--Page 1 (Entry type of Page)&#xA;--Page 2 (Entry type of Page)&#xA;-- etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Or, an entry with a matrix&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Book (Entry type of Journal)&#xA;-- Pages (Matrix field)&#xA;---- Page 1 (Matrix block)&#xA;---- etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But, the journal is only useful in that form so it can relate back to a physical copy (which will be handed as evidence). The pages although chronological don't necessarily represent a narrative flow. The narrative comes when I create a separate type of entry, a research project which is a way of pulling together all of the different elements. I would look something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Research Project&#xA;-- Overview&#xA;-- Related Journal Pages&#xA;-- Related Audio recordings&#xA;-- Related Articles&#xA;-- etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the journal were a structure it would be easy to use an entry field in the Research Project, select individual pages and get the name of the journal it's in (it's parent). I'm using ManytoMany plug-in to create a 2-way relationship, so when viewing journal pages you would also see what projects it's mentioned in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I went the matrix approach it would be tidier. But, i could't link the Project to the Matrix Block (page) within a journal. I'd instead have to relate it to the original asset. Which would be fine, but instead of a simple parent.title to get the journal name displaying on the Project page. I'd have to run another query to find what journal the asset is related to. Which seem a bit.. unsatisfactory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not so concerned about not having a unique url for the asset. I'd probably display them from the parent page in 2 ways 1) Thumbnail grid to lightbox slideshow. 2) paginated results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure I've come to any conclusions with this bit or writing. I hoped I would. a) Structure and slightly necessary asset wrapped in an entry or b) asset simplicity and slightly more complicated way of simulating a parent structure ... hmmm.&lt;/p&gt;&#xA;" OwnerUserId="5195" LastEditorUserId="5195" LastEditDate="2016-06-04T20:28:36.270" LastActivityDate="2016-06-04T20:28:36.270" Title="Defining elements of a research project as assets or entries?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15341" PostTypeId="2" ParentId="15340" CreationDate="2016-06-04T16:28:15.477" Score="3" Body="&lt;p&gt;Actually, there's a brilliant plugin called &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow&quot;&gt;Embedded Assets&lt;/a&gt;, which lets you manage YouTube links and other embeddable media like first rate citizen Assets in Craft. I highly recommend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the more general question of whether to go with Entries or Assets – it's difficult to give a solid recommendation without knowing more about your project and its requirements, and it'll also probably come down to choice and preference a little bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also not totally sure where you're going in regards to &lt;code&gt;relatedTo&lt;/code&gt;, but again – Assets are first rate citizens in Craft, and they aren't limited in their capabilities compared to other types of content like Entries or Categories – certainly not when it comes to &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;relations&lt;/a&gt;. Assets can be related to Entries, Categories, other Assets – sky's the limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway – based on what you're describing, I would probably go for an Assets-only solution, rather than having Entries wrapping Assets. When the actual content is a file, and everything else is basically metadata, this is probably far the more elegant and effective solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your requirements, the only thing you may have to work around is the fact that Assets have no URLs (beyond the actual file URL, of course), nor can Asset sources be assigned a default entry template like e.g. Entries or Categories. For listing templates, search results etc. you can always rely on Craft routing your template filenames as URIs and then just create a &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;craft.assets&lt;/code&gt;&lt;/a&gt; template query to fetch the Assets you need, but if you need to link to an individual Asset, you'll probably need to create a custom &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;route&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-06-04T17:01:22.387" LastActivityDate="2016-06-04T17:01:22.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15342" PostTypeId="1" AcceptedAnswerId="15343" CreationDate="2016-06-04T20:38:03.150" Score="5" ViewCount="8867" Body="&lt;p&gt;I'm new in the Craft CMS world. Today I start so build my first website with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Structure with 2 Levels. Now I want so get the children from level 2. The level 1 entries are overview-pages for the content in the level 2 pages. I've build 2 entry types. One for the content and one overview pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx for your help :)&#xA;Alexander&lt;/p&gt;&#xA;" OwnerUserId="5237" LastEditorUserId="45" LastEditDate="2016-08-13T02:28:44.537" LastActivityDate="2016-08-13T02:28:44.537" Title="Get children from a Structure entry" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15343" PostTypeId="2" ParentId="15342" CreationDate="2016-06-04T20:56:25.943" Score="13" Body="&lt;p&gt;If you need to get the level 2 children for &lt;em&gt;a specific Structure entry&lt;/em&gt;, and you have that entry's &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;noreferrer&quot;&gt;EntryModel&lt;/a&gt; (i.e. you have an &lt;code&gt;entry&lt;/code&gt; variable which refers to the Structure entry), you can just use the EntryModel's &lt;code&gt;children&lt;/code&gt; property, appending &lt;code&gt;level&lt;/code&gt; to only pull children from the desired level:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set children = entry.children().level(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's also a &lt;code&gt;descendantOf&lt;/code&gt; parameter which can be used in a &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt; query – obviously, this should be the Structure entry's ID (or the complete EntryModel, i.e. &lt;code&gt;entry&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    'section' : 'yourSectionHandle',&#xA;    'level' : 2,&#xA;    'descendantOf' : entry.id&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, if you want to pull entries at a certain level in a Structure section but not limit it to children of a certain entry, you can append the &lt;code&gt;level&lt;/code&gt; parameter to your basic &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;craft.entries&lt;/code&gt;&lt;/a&gt; query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('yourSectionHandle').level(2) %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;craft.entries&lt;/code&gt; queries can also be typed out using object notation, if you prefer (I find the object notation more readable, especially if you have a lot of parameters):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    'section' : 'yourSectionHandle',&#xA;    'level' : 2&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-06-04T21:10:52.127" LastActivityDate="2016-06-04T21:10:52.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15344" PostTypeId="1" CreationDate="2016-06-05T03:43:06.263" Score="2" ViewCount="292" Body="&lt;p&gt;I am trying to assigned the main-content section in my base.html file so that the skip-to-main-content global link works on every page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;main&quot; aria-label=&quot;main-content&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the opening tag placed as the start of the main content region and it works as it is correctly placed, but I am having trouble placing the &lt;code&gt;&amp;lt;/section&amp;gt;&lt;/code&gt; end tag in the correct place in the template where it will correctly close off the main content area. Right now, when I put the &lt;code&gt;&amp;lt;/section&amp;gt;&lt;/code&gt; in the place I believe appropriate, my pages render as if the main content area ends at the bottom of the page, and this destroys formatting of my 2-column page with all includes and asides falsely being inside of this long content area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I am visually impaired using a screen reader. Could someone take the full code of my base.html file below and help me close the main content area so that content of actual pages in Craft are restricted to the correct area in the base.html template and thus, do not affect the other content. Scroll down to the following opening wsection tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;main&quot; aria-label=&quot;main-content&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if activeNav is not defined %}&#xA;{% set activeNav = &quot;home&quot; %}&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot; xmlns:fb=&quot;http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;&#xA;  {{ craft.sproutSeo.optimize() }}&#xA;&#xA;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/00-reset.css?v=1&quot;&amp;gt;&#xA;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/01-layout.css&quot;&amp;gt;&#xA;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/02-general.css&quot;&amp;gt;&#xA;  &amp;lt;link href='http://fonts.googleapis.com/css?family=Lato:900' rel='stylesheet' type='text/css'&amp;gt;&#xA;&#xA;  &amp;lt;link href='http://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic' rel='stylesheet' type='text/css'&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;skip-link&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;#main-content&quot; class=&quot;element-invisible element-focusable&quot;&amp;gt;Skip to main content&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;   {% set bannerImage = homePage.showcaseImage.first() %}&#xA;&#xA;&#xA;  &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;    nav.footer {&#xA;      font-size: 12px;&#xA;      text-transform: uppercase;&#xA;    }&#xA;    nav.footer a {&#xA;      color: #ccc;&#xA;      display: inline-block;&#xA;      padding: 0 3px;&#xA;      text-decoration: none;&#xA;    }&#xA;    nav.footer a:hover {&#xA;      text-decoration: underline;&#xA;    }&#xA;  &amp;lt;/style&amp;gt;&#xA;&#xA;  &amp;lt;style&amp;gt;&#xA;    h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6, nav a {&#xA;      font-family: 'Lato', sans-serif;&#xA;      font-weight: 900;&#xA;    }&#xA;&#xA;    h1, .h1,&#xA;    h2, .h2 {&#xA;      color: #444;&#xA;    }&#xA;&#xA;    .brand h1 {&#xA;      color: #fafafa;&#xA;      font-size: 3em;&#xA;      text-transform: uppercase;&#xA;      line-height: 1;&#xA;    }&#xA;&#xA;    .brand h1 span {&#xA;      display: block;&#xA;      font-weight: 300;&#xA;      font-size: 80%;&#xA;      text-transform: none;&#xA;    }&#xA;&#xA;    header.primary &#xA;    header.primary:before {&#xA;      background: rgba(70,70,70,0.7);&#xA;      position: absolute;&#xA;      width: 100%;&#xA;      height: 100%;&#xA;      display: block;&#xA;      content: &quot; &quot;;&#xA;      left: 0;&#xA;      top: 0;&#xA;    }&#xA;&#xA;    .banner {&#xA;      background-color #36454f;&#xA;&#xA;    }&#xA;&#xA;    header {&#xA;      margin-bottom: 0;&#xA;    }&#xA;&#xA;    header.primary .brand {&#xA;&#xA;      {% if craft.request.getSegment(1) == &quot;&quot; %}&#xA;      padding-top: 150px;&#xA;      padding-bottom: 100px;&#xA;      {% else %}&#xA;      padding-top: 60px;&#xA;      padding-bottom: 20px;&#xA;      {% endif %}&#xA;    }&#xA;&#xA;    header.primary nav {&#xA;      background: transparent;&#xA;    }&#xA;&#xA;    header.primary nav.main {&#xA;      padding: 0;&#xA;      margin: 0 0 20px 0;&#xA;    }&#xA;&#xA;    header.primary nav.top {&#xA;      height: inherit;&#xA;      overflow: hidden;&#xA;      padding: 0;&#xA;    }&#xA;&#xA;    header.primary nav ul {&#xA;      overflow: hidden;&#xA;    }&#xA;&#xA;    header.primary nav.top li {&#xA;      float: left;&#xA;    }&#xA;&#xA;    header.primary nav li a {&#xA;      border-bottom: none;&#xA;      display: block;&#xA;    }&#xA;&#xA;    header.primary nav li.active a,&#xA;    header.primary nav li a:hover {&#xA;      background: rgba(255, 255, 255, 0.1);&#xA;      border: none;&#xA;    }&#xA;&#xA;    header.primary nav.main li.active a {&#xA;      background: rgba(10, 10, 10, 0.7);&#xA;    }&#xA;&#xA;    header.primary nav.main li a:hover {&#xA;      background: rgba(10, 10, 10, 0.5);&#xA;    }&#xA;&#xA;    header.primary nav.main ul {&#xA;      display: table;&#xA;      width: 100%;&#xA;    }&#xA;&#xA;    header.primary nav.main li {&#xA;      display: table-cell;&#xA;      line-height: 1;&#xA;    }&#xA;&#xA;    header.primary nav.main li a {&#xA;      vertical-align: top;&#xA;      text-align: center;&#xA;      border-bottom: 0 solid transparent;&#xA;      color: #bfbfbf;&#xA;      font-weight: bold;  &#xA;      text-decoration: none;&#xA;      padding: 5px 7px;&#xA;      line-height: 1;&#xA;      display: block;&#xA;      margin: 0 10px;&#xA;      -webkit-border-radius: 3px;&#xA;         -moz-border-radius: 3px;&#xA;              border-radius: 3px;&#xA;&#xA;      -webkit-transition: background ease 0.2s;&#xA;         -moz-transition: background ease 0.2s;&#xA;           -o-transition: background ease 0.2s;&#xA;              transition: background ease 0.2s;&#xA;    }&#xA;&#xA;    header.primary nav.main li.first a {&#xA;      margin-left: 0; &#xA;    }&#xA;&#xA;    header.primary nav.main li.last a {&#xA;      margin-right: 0;  &#xA;    }&#xA;&#xA;    header.primary nav.main li.active a,&#xA;    header.primary nav.main li a:hover {&#xA;      border: 0px solid transparent;&#xA;    }&#xA;&#xA;    .wrapper-top {&#xA;      background: rgba(10, 10, 10, 0.5);&#xA;      z-index: 10;&#xA;      position: relative;&#xA;    }&#xA;&#xA;    body {&#xA;      background: #f5f5f5;&#xA;      color: #666;&#xA;      font-family: Lora, Georgia, &quot;Times New Roman&quot;, Times, serif;&#xA;    }&#xA;    .divider {&#xA;      display: none;&#xA;    }&#xA;&#xA;    footer.container {&#xA;      padding: 70px 0 40px;&#xA;    }&#xA;&#xA;    nav.footer a {&#xA;      color: #777;&#xA;    }&#xA;&#xA;    select {&#xA;      max-width: 310px;&#xA;    }&#xA;&#xA;    div.col.sixteen {&#xA;      padding-top: 30px;&#xA;    }&#xA;&#xA;    .col.two-thirds {&#xA;      padding-top: 30px;&#xA;      padding-right: 15px;&#xA;      margin-right: -1px;&#xA;      border-right: 1px solid #ddd;&#xA;    }&#xA;&#xA;    .col.one-third {&#xA;      padding: 30px 0 20px 25px;&#xA;      margin-left: 0;&#xA;      border-left: 1px solid #ddd;&#xA;      width: 279px;     &#xA;    }&#xA;&#xA;    form {&#xA;      border: 1px solid #ddd;&#xA;&#xA;      -webkit-border-radius: 3px;&#xA;         -moz-border-radius: 3px;&#xA;              border-radius: 3px;&#xA;&#xA;&#xA;      background: #eee;&#xA;&#xA;      margin: 0 -10px 20px;&#xA;      padding:14px 9px;&#xA;    }&#xA;&#xA;    .newsletter input[type=&quot;text&quot;] {&#xA;      width: 160px;&#xA;    }&#xA;&#xA;&#xA;    .divider620 {&#xA;      background: #ddd;&#xA;      height: 1px;&#xA;    }&#xA;&#xA;    .gallery figure {&#xA;      background: transparent;&#xA;      overflow: hidden;&#xA;    }&#xA;&#xA;    .gallery figure img {&#xA;      margin: 0;&#xA;    }&#xA;&#xA;    a:focus, a:hover {&#xA;      color: #4c777a;&#xA;    }&#xA;&#xA;  /*  Accent Color   */&#xA;&#xA;    h3, .h3,&#xA;    a, a:visited {&#xA;      color: #345254;&#xA;    }&#xA;&#xA;    .btn {&#xA;      background-color: #345254;&#xA;    }&#xA;  &amp;lt;/style&amp;gt;&#xA;&#xA;  &amp;lt;!--[if lt IE 9]&amp;gt;&#xA;    &amp;lt;script src=&quot;/assets/js/libraries/modernizr-html5.js?v={{ craft.config.cacheBustValue }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;  &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;  &amp;lt;header class=&quot;primary&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;wrapper-top&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;nav class=&quot;top&quot; aria-label=&quot;Utility Links&quot;&amp;gt; &amp;lt;ul&amp;gt;&#xA;            {% for item in navigation.secondaryNavigation %}&#xA;              &amp;lt;li {% if craft.request.getSegment(1) == item.url|replace({'/':''}) %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;              &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&amp;lt;/nav&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;banner&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;brand&quot;&amp;gt;&#xA;          &amp;lt;img src=&quot;/assets/images/Accessibility-Agent.png&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;nav class=&quot;main&quot; aria-label=&quot;main site links&quot;&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;            {% for item in navigation.primaryNavigation %}&#xA;              &amp;lt;li class=&quot;{% if loop.first %}first{% elseif loop.last %}last{% endif %}{% if craft.request.getSegment(1) == item.url|replace({'/':''}) %}active{% endif %}&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;!-- end .container --&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/header&amp;gt; &amp;lt;section class=&quot;main&quot; aria-label=&quot;main-content&quot;&amp;gt;&#xA;&#xA;  {# Notify the user the form has errors and didn't submit #}&#xA;  {% if (errors is defined) and errors %}&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col&quot; style=&quot;width:960px;&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;alert error fade in&quot;&amp;gt;&#xA;              &amp;lt;strong&amp;gt;Submission Error&amp;lt;/strong&amp;gt;: The form you submitted has errors. Please scroll down to correct these errors and submit the form again.&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&amp;lt;/section&amp;gt;&#xA;&#xA;  {{ layout }}&#xA;&#xA;  &amp;lt;footer class=&quot;container&quot; style=&quot;text-align: center;&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;divider&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;nav class=&quot;footer&quot; aria-label=&quot;Main site links repeated&quot;&amp;gt;  {% for item in navigation.primaryNavigation %}&#xA;        {% if item.url != &quot;/&quot; %}&#xA;          &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;      {% endfor %}&#xA;      &amp;lt;br/&amp;gt;&#xA;      &amp;lt;a href=&quot;/&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&#xA;      {% for item in navigation.secondaryNavigation %}&#xA;        {% if item.url != &quot;/&quot; %}&#xA;          &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;      {% endfor %}&#xA;    &amp;lt;/nav&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;strong&amp;lt;p&amp;gt;&amp;gt;Barriers can only exist if one chooses to acknowledge them. Here at Accessibility Agent, we acknowledge no barriers to achieving accessibility. we have made it our mission to help create a world where all digital technology is accessible to everyone.&amp;lt;/p&amp;gt;&amp;lt;/strong&amp;gt;&#xA;&#xA;&amp;lt;p&amp;gt;&amp;amp;copy; {{ now|date('Y') }} &amp;lt;strong&amp;gt;Accessibility Agent LLC&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;&#xA;&#xA;&amp;lt;/footer&amp;gt;&#xA;&#xA;  {#  Javascript at the bottom for fast page loading  #}&#xA;  {#  Grab Google CDN's jQuery. fall back to local if necessary  #}&#xA;  &amp;lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;  &amp;lt;script&amp;gt;!window.jQuery &amp;amp;&amp;amp; document.write(unescape('%3Cscript src=&quot;/assets/js/libraries/jquery.js&quot;%3E%3C/script%3E'))&amp;lt;/script&amp;gt;&#xA;&#xA;  {# Google Analytics Code - only display on live site #}&#xA;  {% if craft.config.env == 'live' %}&#xA;    &amp;lt;script&amp;gt;&#xA;      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){&#xA;      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),&#xA;      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)&#xA;      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');&#xA;&#xA;      ga('create', 'UA-40824598-1', 'mabspeaks.com');&#xA;      ga('send', 'pageview');&#xA;    &amp;lt;/script&amp;gt;&#xA;  {% endif %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5238" LastEditorUserId="130" LastEditDate="2016-06-05T08:39:23.170" LastActivityDate="2016-06-05T09:39:21.763" Title="help with base.html" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15345" PostTypeId="2" ParentId="15344" CreationDate="2016-06-05T09:39:21.763" Score="3" Body="&lt;p&gt;Difficult to be a 100% sure, but I believe the following should be correct – I put the &lt;code&gt;&amp;lt;/section&amp;gt;&lt;/code&gt; closing tag after the &lt;code&gt;{{ layout }}&lt;/code&gt; variable, which I assume contains your content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also fixed some other other markup errors – specifically, a couple of unclosed tags, which are often the real source of layout issues – in addition to improving indentation in a couple of spots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.diffnow.com/?report=560rj&quot; rel=&quot;nofollow&quot;&gt;Click here&lt;/a&gt; to see a full diff report on all changes I made to the markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;a href=&quot;http://www.aliciaramirez.com/closing-tags-checker/&quot; rel=&quot;nofollow&quot;&gt;here's a tool&lt;/a&gt; which can help you identify unclosed tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if activeNav is not defined %}&#xA;    {% set activeNav = &quot;home&quot; %}&#xA;{% endif %}&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot; xmlns:fb=&quot;http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;&#xA;    {{ craft.sproutSeo.optimize() }}&#xA;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/00-reset.css?v=1&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/01-layout.css&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/02-general.css&quot;&amp;gt;&#xA;    &amp;lt;link href='http://fonts.googleapis.com/css?family=Lato:900' rel='stylesheet' type='text/css'&amp;gt;&#xA;&#xA;    &amp;lt;link href='http://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic' rel='stylesheet' type='text/css'&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;skip-link&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;#main-content&quot; class=&quot;element-invisible element-focusable&quot;&amp;gt;Skip to main content&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;     {% set bannerImage = homePage.showcaseImage.first() %}&#xA;&#xA;&#xA;    &amp;lt;style type=&quot;text/css&quot;&amp;gt;&#xA;        nav.footer {&#xA;            font-size: 12px;&#xA;            text-transform: uppercase;&#xA;        }&#xA;        nav.footer a {&#xA;            color: #ccc;&#xA;            display: inline-block;&#xA;            padding: 0 3px;&#xA;            text-decoration: none;&#xA;        }&#xA;        nav.footer a:hover {&#xA;            text-decoration: underline;&#xA;        }&#xA;    &amp;lt;/style&amp;gt;&#xA;&#xA;    &amp;lt;style&amp;gt;&#xA;        h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6, nav a {&#xA;          font-family: 'Lato', sans-serif;&#xA;          font-weight: 900;&#xA;        }&#xA;&#xA;        h1, .h1,&#xA;        h2, .h2 {&#xA;            color: #444;&#xA;        }&#xA;&#xA;        .brand h1 {&#xA;            color: #fafafa;&#xA;            font-size: 3em;&#xA;            text-transform: uppercase;&#xA;            line-height: 1;&#xA;        }&#xA;&#xA;        .brand h1 span {&#xA;            display: block;&#xA;            font-weight: 300;&#xA;            font-size: 80%;&#xA;            text-transform: none;&#xA;        }&#xA;&#xA;        header.primary &#xA;        header.primary:before {&#xA;            background: rgba(70,70,70,0.7);&#xA;            position: absolute;&#xA;            width: 100%;&#xA;            height: 100%;&#xA;            display: block;&#xA;            content: &quot; &quot;;&#xA;            left: 0;&#xA;            top: 0;&#xA;        }&#xA;&#xA;        .banner {&#xA;            background-color #36454f;&#xA;&#xA;        }&#xA;&#xA;        header {&#xA;            margin-bottom: 0;&#xA;        }&#xA;&#xA;        header.primary .brand {&#xA;&#xA;            {% if craft.request.getSegment(1) == &quot;&quot; %}&#xA;            padding-top: 150px;&#xA;            padding-bottom: 100px;&#xA;            {% else %}&#xA;            padding-top: 60px;&#xA;            padding-bottom: 20px;&#xA;            {% endif %}&#xA;        }&#xA;&#xA;        header.primary nav {&#xA;            background: transparent;&#xA;        }&#xA;&#xA;        header.primary nav.main {&#xA;            padding: 0;&#xA;            margin: 0 0 20px 0;&#xA;        }&#xA;&#xA;        header.primary nav.top {&#xA;            height: inherit;&#xA;            overflow: hidden;&#xA;            padding: 0;&#xA;        }&#xA;&#xA;        header.primary nav ul {&#xA;            overflow: hidden;&#xA;        }&#xA;&#xA;        header.primary nav.top li {&#xA;            float: left;&#xA;        }&#xA;&#xA;        header.primary nav li a {&#xA;            border-bottom: none;&#xA;            display: block;&#xA;        }&#xA;&#xA;        header.primary nav li.active a,&#xA;        header.primary nav li a:hover {&#xA;            background: rgba(255, 255, 255, 0.1);&#xA;            border: none;&#xA;        }&#xA;&#xA;        header.primary nav.main li.active a {&#xA;            background: rgba(10, 10, 10, 0.7);&#xA;        }&#xA;&#xA;        header.primary nav.main li a:hover {&#xA;            background: rgba(10, 10, 10, 0.5);&#xA;        }&#xA;&#xA;        header.primary nav.main ul {&#xA;            display: table;&#xA;            width: 100%;&#xA;        }&#xA;&#xA;        header.primary nav.main li {&#xA;            display: table-cell;&#xA;            line-height: 1;&#xA;        }&#xA;&#xA;        header.primary nav.main li a {&#xA;            vertical-align: top;&#xA;            text-align: center;&#xA;            border-bottom: 0 solid transparent;&#xA;            color: #bfbfbf;&#xA;            font-weight: bold;  &#xA;            text-decoration: none;&#xA;            padding: 5px 7px;&#xA;            line-height: 1;&#xA;            display: block;&#xA;            margin: 0 10px;&#xA;            -webkit-border-radius: 3px;&#xA;               -moz-border-radius: 3px;&#xA;                    border-radius: 3px;&#xA;&#xA;            -webkit-transition: background ease 0.2s;&#xA;               -moz-transition: background ease 0.2s;&#xA;                 -o-transition: background ease 0.2s;&#xA;                    transition: background ease 0.2s;&#xA;        }&#xA;&#xA;        header.primary nav.main li.first a {&#xA;            margin-left: 0; &#xA;        }&#xA;&#xA;        header.primary nav.main li.last a {&#xA;            margin-right: 0;    &#xA;        }&#xA;&#xA;        header.primary nav.main li.active a,&#xA;        header.primary nav.main li a:hover {&#xA;            border: 0px solid transparent;&#xA;        }&#xA;&#xA;        .wrapper-top {&#xA;            background: rgba(10, 10, 10, 0.5);&#xA;            z-index: 10;&#xA;            position: relative;&#xA;        }&#xA;&#xA;        body {&#xA;            background: #f5f5f5;&#xA;            color: #666;&#xA;            font-family: Lora, Georgia, &quot;Times New Roman&quot;, Times, serif;&#xA;        }&#xA;        .divider {&#xA;            display: none;&#xA;        }&#xA;&#xA;        footer.container {&#xA;            padding: 70px 0 40px;&#xA;        }&#xA;&#xA;        nav.footer a {&#xA;            color: #777;&#xA;        }&#xA;&#xA;        select {&#xA;            max-width: 310px;&#xA;        }&#xA;&#xA;        div.col.sixteen {&#xA;            padding-top: 30px;&#xA;        }&#xA;&#xA;        .col.two-thirds {&#xA;            padding-top: 30px;&#xA;            padding-right: 15px;&#xA;            margin-right: -1px;&#xA;            border-right: 1px solid #ddd;&#xA;        }&#xA;&#xA;        .col.one-third {&#xA;            padding: 30px 0 20px 25px;&#xA;            margin-left: 0;&#xA;            border-left: 1px solid #ddd;&#xA;            width: 279px;           &#xA;        }&#xA;&#xA;        form {&#xA;            border: 1px solid #ddd;&#xA;&#xA;            -webkit-border-radius: 3px;&#xA;               -moz-border-radius: 3px;&#xA;                    border-radius: 3px;&#xA;&#xA;&#xA;            background: #eee;&#xA;&#xA;            margin: 0 -10px 20px;&#xA;            padding:14px 9px;&#xA;        }&#xA;&#xA;        .newsletter input[type=&quot;text&quot;] {&#xA;            width: 160px;&#xA;        }&#xA;&#xA;&#xA;        .divider620 {&#xA;            background: #ddd;&#xA;            height: 1px;&#xA;        }&#xA;&#xA;        .gallery figure {&#xA;            background: transparent;&#xA;            overflow: hidden;&#xA;        }&#xA;&#xA;        .gallery figure img {&#xA;            margin: 0;&#xA;        }&#xA;&#xA;        a:focus, a:hover {&#xA;            color: #4c777a;&#xA;        }&#xA;&#xA;    /*  Accent Color     */&#xA;&#xA;        h3, .h3,&#xA;        a, a:visited {&#xA;            color: #345254;&#xA;        }&#xA;&#xA;        .btn {&#xA;            background-color: #345254;&#xA;        }&#xA;    &amp;lt;/style&amp;gt;&#xA;&#xA;    &amp;lt;!--[if lt IE 9]&amp;gt;&#xA;        &amp;lt;script src=&quot;/assets/js/libraries/modernizr-html5.js?v={{ craft.config.cacheBustValue }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;![endif]--&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    &amp;lt;header class=&quot;primary&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;wrapper-top&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                &amp;lt;nav class=&quot;top&quot; aria-label=&quot;Utility Links&quot;&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% for item in navigation.secondaryNavigation %}&#xA;                            &amp;lt;li {% if craft.request.getSegment(1) == item.url|replace({'/':''}) %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/nav&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;banner&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;brand&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;/assets/images/Accessibility-Agent.png&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;nav class=&quot;main&quot; aria-label=&quot;main site links&quot;&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% for item in navigation.primaryNavigation %}&#xA;                            &amp;lt;li class=&quot;{% if loop.first %}first{% elseif loop.last %}last{% endif %}{% if craft.request.getSegment(1) == item.url|replace({'/':''}) %}active{% endif %}&quot;&amp;gt;&#xA;                                &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/nav&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;!-- end .container --&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/header&amp;gt;&#xA;&#xA;    &amp;lt;section class=&quot;main&quot; aria-label=&quot;main-content&quot;&amp;gt;&#xA;&#xA;        {# Notify the user the form has errors and didn't submit #}&#xA;        {% if (errors is defined) and errors %}&#xA;            &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;col&quot; style=&quot;width:960px;&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;alert error fade in&quot;&amp;gt;&#xA;                                &amp;lt;strong&amp;gt;Submission Error&amp;lt;/strong&amp;gt;: The form you submitted has errors. Please scroll down to correct these errors and submit the form again.&#xA;                            &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {{ layout }}&#xA;&#xA;    &amp;lt;/section&amp;gt;&#xA;    &amp;lt;!-- end .main --&amp;gt;&#xA;&#xA;    &amp;lt;footer class=&quot;container&quot; style=&quot;text-align: center;&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;divider&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;nav class=&quot;footer&quot; aria-label=&quot;Main site links repeated&quot;&amp;gt;  {% for item in navigation.primaryNavigation %}&#xA;                {% if item.url != &quot;/&quot; %}&#xA;                    &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;            &amp;lt;br/&amp;gt;&#xA;            &amp;lt;a href=&quot;/&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&#xA;            {% for item in navigation.secondaryNavigation %}&#xA;                {% if item.url != &quot;/&quot; %}&#xA;                    &amp;lt;a href=&quot;{{ item.url }}&quot; title=&quot;{{ item.title }}&quot;&amp;gt;{{ item.navitem }}&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;        &amp;lt;/nav&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;strong&amp;lt;p&amp;gt;&amp;gt;Barriers can only exist if one chooses to acknowledge them. Here at Accessibility Agent, we acknowledge no barriers to achieving accessibility. we have made it our mission to help create a world where all digital technology is accessible to everyone.&amp;lt;/p&amp;gt;&amp;lt;/strong&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;amp;copy; {{ now|date('Y') }} &amp;lt;strong&amp;gt;Accessibility Agent LLC&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;/footer&amp;gt;&#xA;&#xA;    {#  Javascript at the bottom for fast page loading  #}&#xA;    {#  Grab Google CDN's jQuery. fall back to local if necessary  #}&#xA;    &amp;lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script&amp;gt;!window.jQuery &amp;amp;&amp;amp; document.write(unescape('%3Cscript src=&quot;/assets/js/libraries/jquery.js&quot;%3E%3C/script%3E'))&amp;lt;/script&amp;gt;&#xA;&#xA;    {# Google Analytics Code - only display on live site #}&#xA;    {% if craft.config.env == 'live' %}&#xA;        &amp;lt;script&amp;gt;&#xA;            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){&#xA;            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),&#xA;            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)&#xA;            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');&#xA;&#xA;            ga('create', 'UA-40824598-1', 'mabspeaks.com');&#xA;            ga('send', 'pageview');&#xA;        &amp;lt;/script&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In closing, instead of printing variables (i.e. your &lt;code&gt;layout&lt;/code&gt; variable), you might want to check out Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;extends&lt;/code&gt;&lt;/a&gt; tag, which lets you embed content in a &quot;layout&quot; or base template using a special &lt;code&gt;{% block %}&lt;/code&gt; tag. It's by far a more flexible and robust way to use &quot;base&quot; templates.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-05T09:39:21.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15347" PostTypeId="1" AcceptedAnswerId="15348" CreationDate="2016-06-06T10:51:49.693" Score="3" ViewCount="1469" Body="&lt;p&gt;I'm using twigfiddle.com for now because i want to simulate Twig templates before moving on using Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Base.twig&lt;/code&gt; (main template)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block head %}&#xA;    {% block content %}{% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Child.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;Base.twig&quot; %}&#xA;&#xA;{% block content %}&#xA;    Content from child.twig&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I expect an output of &quot;Content from child.twig&quot; but instead get nothing.&lt;/p&gt;&#xA;" OwnerUserId="5242" LastEditorUserId="57" LastEditDate="2016-06-07T06:34:01.323" LastActivityDate="2016-06-07T08:46:39.520" Title="Twig: Parent template does not inherent what's ever inside the child template even using extends in the child" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15348" PostTypeId="2" ParentId="15347" CreationDate="2016-06-06T11:28:21.057" Score="4" Body="&lt;p&gt;You aren't able to nest &lt;code&gt;blocks&lt;/code&gt; in the template where that block is output - all content inside a block in the parent template is replaced by the child templates content, hence why you don't see your content block being output inside your head block. Likewise you can't use multiple &lt;code&gt;extends&lt;/code&gt; within one template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can however nest blocks in a child template and output them in your extended template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Base.twig&lt;/code&gt; (main template)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Will display &quot;content&quot; and &quot;sidebar content&quot;&#xA;{% block content %}{% endblock %}&#xA;&#xA;// Will only display &quot;sidebar content&quot;&#xA;{% block sidebar %}{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Child.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;Base.twig&quot; %}&#xA;&#xA;{% block content %}&#xA;  Content&#xA;  {% block sidebar %}&#xA;    Sidebar content&#xA;  {% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on the topic can be found in &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;Twigs documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-07T08:46:39.520" LastActivityDate="2016-06-07T08:46:39.520" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15350" PostTypeId="2" ParentId="15347" CreationDate="2016-06-06T12:02:12.380" Score="1" Body="&lt;p&gt;The code block you have outlined above calls for a third template. Take a look at this fiddle to see how the nesting would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twigfiddle.com/ul64wd&quot; rel=&quot;nofollow&quot;&gt;http://twigfiddle.com/ul64wd&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2016-06-06T12:02:12.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15351" PostTypeId="1" AcceptedAnswerId="15354" CreationDate="2016-06-06T12:34:09.657" Score="2" ViewCount="1175" Body="&lt;p&gt;I've got a plugin which am triggering emails from (listening to the &lt;code&gt;users.onSaveUser&lt;/code&gt; event).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a conditional to send two emails, depending on the permissions of the person registering the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one instance am using &lt;code&gt;$email-&amp;gt;htmlBody = craft()-&amp;gt;templates-&amp;gt;render('emails/employee', $vars);&lt;/code&gt; which works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in another instance am using &lt;code&gt;$email-&amp;gt;htmlBody = craft()-&amp;gt;templates-&amp;gt;render('emails/prospect', $vars);&lt;/code&gt; and getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to find the template “emails/prospect”.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this might be happening or how to get more useful feedback?&#xA;I have double and triple-checked the spelling of the files and they are indeed available in the file system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nckRq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nckRq.png&quot; alt=&quot;finder screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-06-06T15:04:41.867" Title="Render Template issue" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15352" PostTypeId="2" ParentId="15334" CreationDate="2016-06-06T12:45:13.207" Score="4" Body="&lt;p&gt;The line &lt;code&gt;{% set img = entry.primaryImage[0] ?? null %}&lt;/code&gt; is looking for the &lt;code&gt;primaryImage&lt;/code&gt; field on the &lt;code&gt;entry&lt;/code&gt; inside your &lt;code&gt;for&lt;/code&gt; loop. It is not looking for &lt;code&gt;primaryImage&lt;/code&gt; for the current matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;primaryImage&lt;/code&gt; is a field within your matrix blog you will need to change the line to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set img = block.primaryImage[0] ?? null %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-06T17:54:05.307" LastActivityDate="2016-06-06T17:54:05.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15353" PostTypeId="2" ParentId="11354" CreationDate="2016-06-06T13:41:42.903" Score="1" Body="&lt;p&gt;For those curious how to make sure that &lt;em&gt;all&lt;/em&gt; categories match (&lt;code&gt;and&lt;/code&gt; instead of &lt;code&gt;or&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'entries-by-category' =&amp;gt; function() {&#xA;    $categoryIds = craft()-&amp;gt;request-&amp;gt;getRequiredQuery('categoryIds');&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; ['and', 123, 234, 567]&#xA;        ],&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can even have more related conditions going on and add the &lt;code&gt;and&lt;/code&gt; relationship as well like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'entries-by-category' =&amp;gt; function() {&#xA;    $categoryIds = craft()-&amp;gt;request-&amp;gt;getRequiredQuery('categoryIds');&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'relatedTo' =&amp;gt; [&#xA;                'and',&#xA;                ['targetElement' =&amp;gt; ['and', 22, 33]],&#xA;                ['targetElement' =&amp;gt; ['and', 123, 234]]&#xA;            ]&#xA;        ],&#xA;        // ...&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-06-06T13:41:42.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15354" PostTypeId="2" ParentId="15351" CreationDate="2016-06-06T14:40:55.270" Score="3" Body="&lt;p&gt;The template path needs to include your plugin folder name. So in your case the path to your email templates would be &lt;code&gt;pluginname/templates/emails/prospect&lt;/code&gt; and the path you pass to &lt;code&gt;render()&lt;/code&gt; would be &lt;code&gt;pluginname/emails/prospect&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info: &lt;a href=&quot;https://craftcms.com/docs/plugins/templates#plugin-template-paths-explained&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin template paths explained&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that doesn't explain why the first template path appears to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’d probably keep the templates inside my plugin if they weren’t being used from the front-end. However, if you'd like to change the default template path to your front-end template directory &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4353/rendertemplate-in-a-plugin-for-front-end-request-using-front-end-template&quot;&gt;this answer&lt;/a&gt; will help.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-06-06T15:04:41.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15355" PostTypeId="1" CreationDate="2016-06-06T15:02:12.917" Score="2" ViewCount="132" Body="&lt;p&gt;I want to create a user form that will be filled by an enduser. I'd like to store the forms data in the database.&lt;/p&gt;&#xA;" OwnerUserId="5244" LastEditorUserId="4466" LastEditDate="2016-06-06T16:40:36.287" LastActivityDate="2016-06-07T01:31:38.730" Title="Gated contact form" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15356" PostTypeId="2" ParentId="15355" CreationDate="2016-06-06T15:08:33.467" Score="2" Body="&lt;p&gt;If you just want to add a simple contact then look at &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;Contact Form&lt;/a&gt; by Pixel &amp;amp; Tonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anything more complex then I'd suggest looking at the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin also made by Pixel &amp;amp; Tonic. This enables you to use front-end forms to post to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to look at the docs for creating &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;User registration forms&lt;/a&gt; on the front-end. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-06T15:16:15.607" LastActivityDate="2016-06-06T15:16:15.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15357" PostTypeId="1" AcceptedAnswerId="15358" CreationDate="2016-06-06T17:45:13.433" Score="2" ViewCount="219" Body="&lt;p&gt;I have two globals setup for affiliate and compensated type language - using Matrix and a dropdown I'm trying to find a way to let the user add this language in a new block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot for the life of me get the globals to parse. In my dropdown handle I've made sure to mirror the handle of the globals themselves. Then I'm using something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case 'globals' %}&#xA;{% set legalContent = block.legalVariables %}&#xA;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;{{ legal.legalContent }}&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;'globals' is the block handle, 'legalVariables' is the dropdown handle and 'legal' is the global group. I've tried quite a few different variations on this, but it just spits out 'legal.affiliateLegal' which is right, but it won't parse it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something simple or is this not possible with globals?&lt;/p&gt;&#xA;" OwnerUserId="5220" LastEditorUserId="45" LastEditDate="2016-08-13T02:28:59.100" LastActivityDate="2016-08-13T02:28:59.100" Title="Using a Dropdown field in a Matrix to parse a global" Tags="&lt;matrix&gt;&lt;globals&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15358" PostTypeId="2" ParentId="15357" CreationDate="2016-06-06T18:42:19.283" Score="2" Body="&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Knowing your use case I would use a dropdown as you were inside your matrix block and then query what the chosen value was and output the relevant global field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.dropdownValue == 'globalName' %}&#xA;   {{ globalHandle.globalField }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You won't be able to do this dynamically but as you're adding the values to the dropdown matrix field you can add each 'case' to your template?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What you're trying to do isn't the usually use case for Globals. Globals are used more to output values in your templates independently from the current context (entry or section). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would probably add the languages as categories and use a category field within your Matrix. This won't provide a dropdown but the UI for choosing a category has some extra features like the ability to search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have the same control over the content as you do using Globals by adding fields to Categories.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-06T19:31:55.670" LastActivityDate="2016-06-06T19:31:55.670" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15359" PostTypeId="1" AcceptedAnswerId="15360" CreationDate="2016-06-06T18:54:29.753" Score="2" ViewCount="144" Body="&lt;p&gt;After upgrading a site from 2.4.x to 2.6.x, I'm experiencing an odd issue where Craft throws the following template error whenever I attempt to edit a field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Variable &quot;targetLocaleFieldHtml&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error message only displays if &lt;code&gt;devMode&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;, occurs for all fields and fieldtypes (also when attempting to create a new field), and prevents me from actually editing field settings (unless I turn off &lt;code&gt;devMode&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the full stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template Error&#xA;&#xA;Variable &quot;targetLocaleFieldHtml&quot; does not exist&#xA;&#xA;/somepath/craft/app/templates/_components/fieldtypes/elementfieldsettings.html(33)&#xA;&#xA;21                     options: sources,&#xA;22                     value: settings.source&#xA;23                 }) }}&#xA;24             {% endif %}&#xA;25         {% else %}&#xA;26             {{ forms.field({&#xA;27                 label: (allowMultipleSources ? &quot;Sources&quot;|t : &quot;Source&quot;|t)&#xA;28             }, '&amp;lt;p class=&quot;error&quot;&amp;gt;' ~ &quot;No sources exist yet.&quot;|t ~ '&amp;lt;/p&amp;gt;') }}&#xA;29         {% endif %}&#xA;30     {% endblock %}&#xA;31 &#xA;32     {% block targetLocaleField %}&#xA;33         {{ targetLocaleFieldHtml|raw }}&#xA;34     {% endblock %}&#xA;35 &#xA;36     {% block limitField %}&#xA;37         {% if allowLimit %}&#xA;38             {{ forms.textField({&#xA;39                 label: &quot;Limit&quot;|t,&#xA;40                 instructions: &quot;Limit the number of selectable {type}.&quot;|t({ type: type|lower }),&#xA;41                 id: 'limit',&#xA;42                 name: 'limit',&#xA;43                 value: settings.limit,&#xA;44                 size: 2,&#xA;45                 errors: settings.getErrors('limit')&#xA;2016-06-06 18:44:40 Apache / Craft 2.6.2789&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-08T11:45:01.793" Title="Odd error message when editing field settings (Variable &quot;targetLocaleFieldHtml&quot; does not exist)" Tags="&lt;error-message&gt;&lt;fieldtypes&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15360" PostTypeId="2" ParentId="15359" CreationDate="2016-06-06T18:54:29.753" Score="2" Body="&lt;p&gt;This had me stumped for a while, but it turned out to be a custom fieldtype extending &lt;code&gt;BaseElementFieldType&lt;/code&gt;, in which the settings attribute &lt;code&gt;targetLocaleField&lt;/code&gt; apparently was renamed &lt;code&gt;targetLocaleFieldHtml&lt;/code&gt; with Craft &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/commit/ec08c2a41ccb6e37b9b5309eb9bc768725effd65?diff=split&quot; rel=&quot;nofollow&quot;&gt;2.5.2750&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure why the error was thrown for all fields and fieldtypes (even PlainText fields), but in any case the fix was simply replacing the &lt;code&gt;targetLocaleField&lt;/code&gt; attribute with &lt;code&gt;targetLocaleFieldHtml&lt;/code&gt; in the returned array for the &lt;code&gt;getSettingsHtml()&lt;/code&gt; method in the custom fieldtype.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; It just occurred to me that the reason for getting the error on all fields/fieldtypes is – of course – due to Craft actually pre-rendering the settings templates for &lt;em&gt;all fieldtypes&lt;/em&gt;, I assume to make changing the fieldtype (via the dropdown) seamless/instantaneous.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-06-08T11:45:01.793" LastActivityDate="2016-06-08T11:45:01.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15361" PostTypeId="1" CreationDate="2016-06-06T21:49:55.657" Score="1" ViewCount="918" Body="&lt;p&gt;I'm trying to create manual payments within Craft Commerce so the customer doesn't have to enter their credit card but every time I use the checkout button it says that the payment information is invalid. Is there anyway to have customers checkout without credit card info?&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="45" LastEditDate="2016-08-13T02:38:35.757" LastActivityDate="2016-08-13T02:38:35.757" Title="Is there anyway to use manual payments?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15362" PostTypeId="2" ParentId="15361" CreationDate="2016-06-06T21:53:46.277" Score="2" Body="&lt;p&gt;You need to create a 'Manual' payment gateway in &lt;code&gt;Commerce &amp;gt; Setting &amp;gt; Payment Methods&lt;/code&gt; This will allow the customer to choose the manual payment method on checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'Manual' payment method is the only way a customer can submit an order without payment information. This gateway does not place any validation on the payment form action, so you should not see any errors. If you are seeing errors, make sure you are sending the ID of the manual payment method with the &lt;code&gt;paymentMethodId&lt;/code&gt; param to the payment form action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'Mark as Complete' is a separate action that allows those that have the 'Manage Orders' permission, to turn a Cart that is in progress into an Order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Lnpuh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lnpuh.png&quot; alt=&quot;Order Edit screen in the CP&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-06-07T06:59:11.877" LastActivityDate="2016-06-07T06:59:11.877" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15363" PostTypeId="2" ParentId="15357" CreationDate="2016-06-07T00:36:29.163" Score="1" Body="&lt;p&gt;If I'm understanding the question properly, you have a &lt;code&gt;dropdown&lt;/code&gt; field in a &lt;code&gt;matrix&lt;/code&gt; block that lets the user pick out which phrase they want to spit out on the page. The actual &lt;em&gt;content&lt;/em&gt; of that phrase is defined in a global (with the same field handle name).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft treats fields as content, which means the phrases you stored within those 2 fields is translatable, etc. Behind the scenes, when you do a &lt;code&gt;legal.fieldName&lt;/code&gt; call to a global, it's doing a bunch of things grab the field's actual content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also not like a one-to-one map like you might call a variable inside PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#literals&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; function could get you close here if you setup a hash with the values from the fields first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# two global variables, legal.dumbLawyerLegalese and legal.moreDumbLawyerLegalese #}&#xA;&#xA;{% set legalPhrases = {&#xA;&#xA;      'dumbLawyerLegalese': legal.dumbLawyerLegalese,&#xA;      'moreDumbLawyerLegalese': legal.moreDumbLawyerLegalese &#xA;      }&#xA;&#xA;%}&#xA;&#xA;{# get the value of the dropdown #}&#xA;{% set legalContentHandle = block.legalVariables.value %}&#xA;&#xA;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;{{ attribute(legalPhrases, legalContentHandle }}&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Attribute in Twig would be like &lt;code&gt;$legalPhrases[$legalContentHandle]&lt;/code&gt; in PHP. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-06-07T00:36:29.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15364" PostTypeId="2" ParentId="15355" CreationDate="2016-06-07T01:31:38.730" Score="2" Body="&lt;p&gt;There's no shortage of &lt;a href=&quot;https://straightupcraft.com/craft-plugins?q=form&amp;amp;&quot; rel=&quot;nofollow&quot;&gt;form&lt;/a&gt; builder plugins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;FormBuilder&lt;/a&gt; and  &lt;a href=&quot;https://github.com/xodigital/Formerly&quot; rel=&quot;nofollow&quot;&gt;Formerly&lt;/a&gt; on client sites.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/sprout-forms&quot; rel=&quot;nofollow&quot;&gt;Sprout&lt;/a&gt; from Barrel Strength is a good pick as well if you want a paid product with commercial support.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-06-07T01:31:38.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15365" PostTypeId="1" CreationDate="2016-06-07T08:19:48.810" Score="2" ViewCount="89" Body="&lt;p&gt;I've implemented a plugin for synchronizing an external Database into my Craft project which also includes images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those images have a focuspointer but i lose the focuspointer onSaveEntry by my plugin. &#xA;(I'm using the &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint&quot; rel=&quot;nofollow&quot;&gt;Focuspointer Plugin&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I only lose the focuspointer when updating an entry by my plugin, updating an entry by control panel works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code from the focuspointer plugin where the focuspoint get's deleted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    craft()-&amp;gt;focusPoint_focusPoint-&amp;gt;deleteFocusPointRecordsByFieldIdAndSourceId(&#xA;        $this-&amp;gt;model-&amp;gt;id,&#xA;        $this-&amp;gt;element-&amp;gt;id&#xA;    );&#xA;&#xA;    $hash = spl_object_hash($this-&amp;gt;element);&#xA;&#xA;    $value = isset($this-&amp;gt;values[$hash]) ? $this-&amp;gt;values[$hash] : null;&#xA;&#xA;    if ($value &amp;amp;&amp;amp; isset($value[&quot;focus-attr&quot;])) {&#xA;        $i = 0;&#xA;        foreach ($value[&quot;focus-attr&quot;] as $focus_attr) {&#xA;            craft()-&amp;gt;focusPoint_focusPoint-&amp;gt;createOrUpdateFocusPoint(&#xA;                $focus_attr[&quot;data-focus-x&quot;],&#xA;                $focus_attr[&quot;data-focus-y&quot;],&#xA;                $value[$i],&#xA;                $this-&amp;gt;model-&amp;gt;id,&#xA;                $this-&amp;gt;element-&amp;gt;id&#xA;            );&#xA;            $i++;&#xA;        }&#xA;    }&#xA;&#xA;    parent::onAfterElementSave();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I prevent the loss of the focus point onSaveEntry by my plugin?&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2017-10-01T03:43:31.123" Title="Losing focuspoint on saveEntry by plugin" Tags="&lt;plugin-development&gt;&lt;saveentry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15366" PostTypeId="2" ParentId="15365" CreationDate="2016-06-07T08:29:16.820" Score="1" Body="&lt;p&gt;I recently had the same problem when saving entries in my plugin. I only wanted to update an entry field that had nothing to do with the focus image and save that entry. Turned out the focus image lost its value (I think it happens only when the field is required).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved it by getting the value of the focusImageField and just re-set it when saving the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost(array(&#xA;// imageWithFocusPoint is required but returns empty,&#xA;// so set it with same value it allready had&#xA;   'imageWithFocusPoint' =&amp;gt; $entry-&amp;gt;imageWithFocusPoint-&amp;gt;ids(),&#xA;));&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info that helped me here: &lt;a href=&quot;http://goo.gl/soli9T&quot; rel=&quot;nofollow&quot;&gt;http://goo.gl/soli9T&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution (and the one I used but maybe less of an option for you) is to disable validation on the entry save. By using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;content-&amp;gt;saveContent($entry, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of saveEntry. The &quot;false&quot; as second parameter means it will not validate the entry which is not always necessary.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2016-06-07T08:29:16.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15367" PostTypeId="1" CreationDate="2016-06-07T08:48:54.513" Score="1" ViewCount="1268" Body="&lt;p&gt;I have an issue with uploading files. I got an error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upload failed for filename. Path directory structure&#xA;  &quot;/public_html/assets/images /&quot; set for this resource doesn't exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Path should be good, because the public_html folder is directly in the root and the /assets/images folder is in it, permissions are 777. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It worked well on my local, it stopped working when I moved the site live. All pictures uploaded on my local are displaying on the live site...I just can't upload new&lt;/p&gt;&#xA;" OwnerUserId="3684" LastActivityDate="2016-06-07T09:18:53.930" Title="Upload failed for filename. The path doesn't exist" Tags="&lt;upload&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15368" PostTypeId="2" ParentId="15367" CreationDate="2016-06-07T09:18:53.930" Score="2" Body="&lt;p&gt;I suspect your public root is something else/more than just &lt;code&gt;/public_html&lt;/code&gt;. Try adding the following to your &lt;code&gt;index.php&lt;/code&gt; file, and refresh your site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;die($_SERVER['DOCUMENT_ROOT']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your real public root path should now display in your browser.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-07T09:18:53.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15369" PostTypeId="1" AcceptedAnswerId="15480" CreationDate="2016-06-07T09:33:22.113" Score="2" ViewCount="469" Body="&lt;p&gt;Considering the way table field content is saved to the database, could I search entries for content in a specific column?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, say I have a table field containing X column, I would only want to search for an ID, located in column 3. Did anyone ever successfully try this?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2016-06-13T11:35:28.727" Title="Is it possible to search an entry for specific table content" Tags="&lt;search&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15370" PostTypeId="1" AcceptedAnswerId="15371" CreationDate="2016-06-07T10:32:16.183" Score="2" ViewCount="1401" Body="&lt;p&gt;I have to reinstall it because i f'up by changing &quot;localhost&quot; to &quot;mysite.dev&quot; on the installation page.&lt;/p&gt;&#xA;" OwnerUserId="5242" LastEditorUserId="57" LastEditDate="2016-06-07T16:54:03.807" LastActivityDate="2016-06-07T16:54:03.807" Title="How to remove entire Craft CMS folder? or rather uninstall it" Tags="&lt;uninstall&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15371" PostTypeId="2" ParentId="15370" CreationDate="2016-06-07T11:08:03.093" Score="5" Body="&lt;p&gt;To delete craft, all you need to do is delete the &lt;code&gt;craft/app&lt;/code&gt; folder, so you don't lose all your templates/plugins etc. That said, this won't affect your site url as &lt;code&gt;siteUrl&lt;/code&gt; stored in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a few options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You would need to go into the database under the table &lt;code&gt;craft_info&lt;/code&gt; and then change &lt;code&gt;siteUrl&lt;/code&gt; back to localhost or whatever you need it to be.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have only just gone through the installation page then you can just delete the database and start again.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My most preferred thing to do to avoid these sort of issues is to set the &lt;code&gt;siteUrl&lt;/code&gt; within a config file and simply reference it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in &lt;code&gt;craft/config/general.php&lt;/code&gt; you would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA; '*' =&amp;gt; array(&#xA;   'environmentVariables' =&amp;gt; array(&#xA;     'siteUrl' =&amp;gt; 'localhost'&#xA;   )&#xA; ),&#xA; '.com' =&amp;gt; array(&#xA;   'environmentVariables' =&amp;gt; array(&#xA;     'siteUrl' =&amp;gt; 'http://somedomain.com'&#xA;   )&#xA; )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically here we are setting the &lt;code&gt;siteUrl&lt;/code&gt; config within a wildcard config using &lt;code&gt;*&lt;/code&gt; which means it gets applied to all environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Straight after we are then overriding the &lt;code&gt;siteUrl&lt;/code&gt; config for just &lt;code&gt;.com&lt;/code&gt; domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot;&gt;Multi environment config&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs#environment-specific-variables&quot;&gt;Multi environment variables&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beauty of this is now when you install Craft (or change &lt;code&gt;siteUrl&lt;/code&gt; in the database) you only need to put &lt;code&gt;{siteUrl}&lt;/code&gt; within the input and Craft will automatically fetch the value from your config file, based on your environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-06-07T11:08:03.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15373" PostTypeId="1" AcceptedAnswerId="15388" CreationDate="2016-06-07T11:29:08.563" Score="2" ViewCount="121" Body="&lt;p&gt;I'm listening on an entries save event with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;  //$event-&amp;gt;params['entry']); -&amp;gt; passes to function &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I assess assets that are also part of that saved entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;{fieldname}&lt;/code&gt; doesn't give me the array with information I was hoping for.&lt;/p&gt;&#xA;" OwnerUserId="5161" LastEditorUserId="1098" LastEditDate="2016-06-07T17:19:35.757" LastActivityDate="2016-06-07T17:19:35.757" Title="How do I access an asset field in the 'onSaveEntry' event?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15374" PostTypeId="1" CreationDate="2016-06-07T11:59:16.040" Score="2" ViewCount="118" Body="&lt;p&gt;I'm having a hard time inserting new content into an elementselect field for a user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm working on so far, inside a custom plugin init()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parent::init();&#xA;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $isNew = $event-&amp;gt;params['isNewEntry'];&#xA;&#xA;    if ($isNew) {&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserById($entry['authorId']);&#xA;&#xA;        $focusList = $user-&amp;gt;getContent()-&amp;gt;focusList;&#xA;&#xA;        if (!is_array($focusList)) {&#xA;            $focusList = array();&#xA;        }&#xA;        array_push($focusList, $entry);&#xA;        $user-&amp;gt;getContent()-&amp;gt;focusList = $focusList;&#xA;&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm tring to add a &quot;onBeforeSaveEntry&quot; hook, that first checks if the entry is new. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is, add the entry to the authors &quot;focusList&quot; (an article field without limits) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't get it to work. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error message I'm stuck with so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails&quot; is the error message I'm battling&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3717" LastActivityDate="2016-06-07T20:40:27.330" Title="Insert entry into article field (elementselect?) on a user, with the &quot;onBeforeSaveEntry&quot; hook" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;users&gt;&lt;array&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15375" PostTypeId="1" AcceptedAnswerId="15391" CreationDate="2016-06-07T12:30:45.150" Score="2" ViewCount="613" Body="&lt;p&gt;Within a plugin I'd like to create a table which is linked to the &lt;code&gt;craft_users&lt;/code&gt; table, keyed on the &lt;code&gt;id&lt;/code&gt;. In my table I have a &lt;code&gt;user_id&lt;/code&gt; column which I'd like to be unique and only contain Id's which exist in the &lt;code&gt;craft_users&lt;/code&gt; table. Now, I know I can't monkey about with the &lt;code&gt;craft_users&lt;/code&gt; table or the &lt;code&gt;UserRecord&lt;/code&gt;, so I wondered what the best way of doing this would be? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Record code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_MerchantRecord extends BaseRecord&#xA;{&#xA;  public function getTableName()&#xA;  {&#xA;    return 'myplugin_merchants';&#xA;  }&#xA;&#xA;  protected function defineAttributes()&#xA;  {&#xA;    return [&#xA;      'user_id' =&amp;gt; [AttributeType::Number, 'required' =&amp;gt; true],&#xA;      ...&#xA;    ];&#xA;  }&#xA;&#xA;  public function defineIndexes()&#xA;  {&#xA;      return [&#xA;          ['columns' =&amp;gt; ['user_id'], 'unique' =&amp;gt; true],&#xA;      ];&#xA;  }&#xA;&#xA;  public function defineRelations()&#xA;  {&#xA;    return [&#xA;      'user' =&amp;gt; [static::BELONGS_TO, 'UserRecord', 'user_id'],&#xA;    ];&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try and install the plugin I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint. &#xA;The SQL statement executed was: ALTER TABLE `craft_myplugin_merchants`    &#xA;ADD CONSTRAINT `craft_myplugin_merchant_user_id_fk` FOREIGN KEY (`user_id`) &#xA;REFERENCES `craft_users` (`id`) ON DELETE SET NULL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried it with/without the &lt;code&gt;defineIndexes()&lt;/code&gt; call, and get the same error. I'm sure I'm missing something simple, but can't see the wood for the trees!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always any help gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-06-08T07:56:55.183" Title="Add Database Relationship to craft_user table from a Plugin" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15376" PostTypeId="2" ParentId="15374" CreationDate="2016-06-07T12:32:15.120" Score="2" Body="&lt;p&gt;Sweet, solved it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changed the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array_push($focusList, $entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array_push($focusList, $entry-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it worked! :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;br&gt;&#xA;EDIT: NOPE, it did not fully work. This hook overwrites all the other entries, leaving only the most recent inside the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code does work, without overwriting: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parent::init();&#xA;craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $isNew = $event-&amp;gt;params['isNewEntry'];&#xA;&#xA;    if ($isNew) {&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserById($entry['authorId']);&#xA;        $focusList = $user-&amp;gt;getFieldValue('focusList');&#xA;        $values = [];&#xA;&#xA;&#xA;        foreach ($focusList as $focusEntry) {&#xA;            array_push($values, $focusEntry-&amp;gt;id);&#xA;        }&#xA;&#xA;        array_push($values, $entry-&amp;gt;id);&#xA;&#xA;&#xA;        $user-&amp;gt;setContentFromPost(array(&#xA;            'focusList' =&amp;gt; $values&#xA;         ));&#xA;        craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3717" LastEditorUserId="3717" LastEditDate="2016-06-07T20:40:27.330" LastActivityDate="2016-06-07T20:40:27.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15378" PostTypeId="1" CreationDate="2016-06-07T13:15:43.180" Score="3" ViewCount="113" Body="&lt;p&gt;I want to create a registration form in my website like Name, email and comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the end user filled the details, I would like to allow him to download a PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could any one please let me know how can I achieve it in Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="5244" LastEditorUserId="57" LastEditDate="2016-06-07T16:57:42.013" LastActivityDate="2016-06-07T16:57:42.013" Title="Registration Form" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15379" PostTypeId="1" CreationDate="2016-06-07T14:20:47.743" Score="2" ViewCount="582" Body="&lt;p&gt;I'd like to be able to convert an animated GIF to static for displaying in my mobile view (to reduce bandwidth etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;currently it seems I can only really set the output to JPG for this (PNG seemed to break the image and if i set to GIF it stays animated)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does anyone have any suggestions for this please? is it possible to extend the Image Transforms? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I'd need to create some kind of plugin? at least that way I could extend it to define a frame number to use etc within my twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks,&#xA;J.&lt;/p&gt;&#xA;" OwnerUserId="5248" LastActivityDate="2016-06-07T15:15:53.253" Title="Image Transform to convert animated GIF to static?" Tags="&lt;image-transforms&gt;&lt;gif&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15380" PostTypeId="2" ParentId="15378" CreationDate="2016-06-07T14:21:16.577" Score="2" Body="&lt;p&gt;I would suggest that you us the &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Member Registration&lt;/a&gt; form and have them register as actual Craft members. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once they're members and logged in, you can display elements of a page using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    Download this PDF...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on the above, here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/351/how-can-i-determine-if-a-user-is-logged-in-and-who-that-user-is&quot;&gt;How can I determine if a user is logged in, and who that user is?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An obvious benefit to the above is that a member would only need to log in once and gain access to relevant content, instead of being asked to submit the information each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how you get on.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-06-07T14:21:16.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15381" PostTypeId="2" ParentId="15373" CreationDate="2016-06-07T14:45:55.680" Score="-1" Body="&lt;p&gt;What about &lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;{fieldname}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wouldn't that be enough?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2016-06-07T14:45:55.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15382" PostTypeId="2" ParentId="15379" CreationDate="2016-06-07T15:15:53.253" Score="1" Body="&lt;p&gt;Is this a one-off image or do you need to use the transform for a bunch of GIFs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no way automated way to tap into transforms currently. (Craft 3 is going to be much better in this respect.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other hard part is you're probably going to want to specify what frame of the GIF to use. (Fun fact: years before browsers supported animated gifs, they would simply show either the first frame or the last frame.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were me, I'd set the static frame manually using whatever method you want (Photoshop, Imagemagick/gd on the command line, etc.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use a custom field on the asset to relate that static gif back to its animated counterpart.  Unlike in other CMS, this is where Craft really becomes powerful.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-06-07T15:15:53.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15383" PostTypeId="1" AcceptedAnswerId="15417" CreationDate="2016-06-07T15:20:25.727" Score="3" ViewCount="654" Body="&lt;p&gt;I am currently adding a link to download the order PDF in the confirmation email with &lt;code&gt;{{ order.getPdfUrl() }}&lt;/code&gt; but also want this to be an attachment.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="57" LastEditDate="2016-06-07T17:08:05.767" LastActivityDate="2017-04-06T03:19:02.077" Title="How to attach an order PDF in an order confirmation email?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;pdf&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15384" PostTypeId="1" CreationDate="2016-06-07T15:29:30.770" Score="2" ViewCount="531" Body="&lt;p&gt;In my order PDF template I have an image that shows when I preview the template as a web page but not in the generated PDF. I’ve tried SVG, PNG and JPEG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use a relative path I get the error &lt;code&gt;Image not readable or empty&lt;/code&gt;. With an absolute path I get &lt;code&gt;DOMPDF_ENABLE_REMOTE is set to FALSE&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="4466" LastEditDate="2016-06-09T12:05:23.773" LastActivityDate="2016-06-09T12:05:23.773" Title="How to link images inside an order PDF?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;pdf&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15385" PostTypeId="2" ParentId="15384" CreationDate="2016-06-07T15:40:51.760" Score="5" Body="&lt;p&gt;I found any relative link should not lead with a slash.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-06-07T21:27:49.663" LastActivityDate="2016-06-07T21:27:49.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15386" PostTypeId="1" AcceptedAnswerId="15387" CreationDate="2016-06-07T16:21:11.207" Score="2" ViewCount="89" Body="&lt;p&gt;I'm new to Craft, and have a local installation of version 2.6.2789&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a section with its own field layout. Everytime I enable a matrix field in the field layout, the section entry form won't display anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached is the screenshot of the entry form itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qcHQ8.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcHQ8.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what I'm doing wrong.&lt;/p&gt;&#xA;" OwnerUserId="5232" LastEditorUserId="4466" LastEditDate="2016-06-07T16:23:27.733" LastActivityDate="2016-06-07T16:29:40.957" Title="Entries form in control panel won't display if I have a Matrix field enabled" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15387" PostTypeId="2" ParentId="15386" CreationDate="2016-06-07T16:29:40.957" Score="3" Body="&lt;p&gt;This usually happens if xdebug is installed with the default nesting limit. You can either disable xdebug as PHP itself does not have a function nesting limit,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;change the setting in your php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level = 400&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in your PHP code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ini_set('xdebug.max_nesting_level', 400);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5251" LastActivityDate="2016-06-07T16:29:40.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15388" PostTypeId="2" ParentId="15373" CreationDate="2016-06-07T17:06:28.173" Score="1" Body="&lt;p&gt;This gives you an &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryModel = $event-&amp;gt;params['entry'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you an array of &lt;a href=&quot;https://craftcms.com/docs/templating/assetfilemodel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModels&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assetFileModels = $entryModel-&amp;gt;myAssetFieldHandle&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can loop through them like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($assetFileModels as $assetFileModel)&#xA;{&#xA;    $url = $assetFileModel-&amp;gt;getUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-07T17:06:28.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15389" PostTypeId="1" AcceptedAnswerId="15390" CreationDate="2016-06-07T18:18:26.803" Score="2" ViewCount="415" Body="&lt;p&gt;I've been trying to setup my site on IIS, which runs fine on Apache, without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My setup is this (with rewrites)&#xA;/ (loads craft for the admin panel)&#xA;/en (loads the english homepage)&#xA;/fr (loads the french homepage)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The root works without any issues so the web.config does its job.&#xA;The same web.config lives in the fr and en folder, but as soon as I try to get in there, I hit a 500.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the web.config from those 2 folders, I get the homepage of each language, but nothing for the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anywone knows how to get it to work ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also trying to get everything working with a single php file that checks for the lang in the p parameter and sets it, but Craft doesn't receive the good slug, even if I modify the p parameter to remove the language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-06-21T06:55:52.860" Title="How to setup a multi-lingual site on IIS" Tags="&lt;localization&gt;&lt;windows&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15390" PostTypeId="2" ParentId="15389" CreationDate="2016-06-07T18:55:27.860" Score="4" Body="&lt;p&gt;Looks like it was only because I was missing the clear tag in my rules in the subfolders.  Everything works like a charm now. &lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2016-06-07T18:55:27.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15391" PostTypeId="2" ParentId="15375" CreationDate="2016-06-08T07:56:55.183" Score="2" Body="&lt;p&gt;So it looks like I had a couple of things wrong here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The type of relationship I was trying to use. &lt;/li&gt;&#xA;&lt;li&gt;The fact that I was trying to add an extra unique index.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To solve the problem, what I ended up doing was this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Remove my &lt;code&gt;user_id&lt;/code&gt; column.&lt;/li&gt;&#xA;&lt;li&gt;Remove the &lt;code&gt;defineIndexes()&lt;/code&gt; definition altogether (you'll see why in a minute).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Change my Relationship definition to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;  return [&#xA;    'user' =&amp;gt; [static::BELONGS_TO, 'UserRecord',  'id', 'required' =&amp;gt; true, &#xA;                    'onDelete' =&amp;gt; static::CASCADE],&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So what this ended up doing was using the &lt;code&gt;id&lt;/code&gt; column that is automatically created as both a &lt;code&gt;Primary Key&lt;/code&gt; and a &lt;code&gt;Foreign Key&lt;/code&gt; related to the &lt;code&gt;craft_user&lt;/code&gt; table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I wanted to do this, is my new table which I'm creating is actually just an extension of the &lt;code&gt;craft_user&lt;/code&gt; table anyway. There will be only ever one row per &lt;code&gt;User&lt;/code&gt; (which is made unique by the &lt;code&gt;Primary Key&lt;/code&gt; index) and the &lt;code&gt;Foreign Key&lt;/code&gt; makes sure that only values that exist in the &lt;code&gt;craft_users&lt;/code&gt; &lt;code&gt;id&lt;/code&gt; column are allowed in the &lt;code&gt;id&lt;/code&gt; column of my new table.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completeness, the reason I was getting the error mentioned in the question was because I'd set the &lt;code&gt;user_id&lt;/code&gt; column to &lt;code&gt;'required' =&amp;gt; true&lt;/code&gt;. As I'd not used the &lt;code&gt;onDelete&lt;/code&gt; property on the relationship, it was defaulting to &lt;code&gt;ON DELETE SET NULL&lt;/code&gt;. It can't be both, either it must always have a value or it can be set to &lt;code&gt;NULL&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-06-08T07:56:55.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15392" PostTypeId="1" CreationDate="2016-06-08T09:49:03.803" Score="2" ViewCount="65" Body="&lt;p&gt;Is there a way to include multiple validation masks in Sprout Fields? I've tried to do this (for my phone number validation):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#### ####|### ## ###&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since both of those are valid. If I try to write it out as a real regular expression, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;^([0-9]{4}) ([0-9]{4})|([0-9]{3}) ([0-9]{2}) ([0-9]{3})$&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it just fails: &lt;code&gt;preg_match(): Empty regular expression&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2016-06-08T15:08:56.497" Title="Multiple regexes/masks in Sprout Field validation" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15393" PostTypeId="1" CreationDate="2016-06-08T10:09:05.013" Score="0" ViewCount="425" Body="&lt;p&gt;Since upgrading to craft 2.6.2785 when I delete a user it appears to remove the user from the &lt;code&gt;elements&lt;/code&gt; and &lt;code&gt;elements_il8n&lt;/code&gt; tables but does not delete the user from the &lt;code&gt;users&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then search for the user in the CMS it does not find them however the user has not been removed from the database so if you try and set up a new user with the same email address it fails with &quot;email has already been taken message&quot;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update on this. I re-imported the database from dev to staging. In my dev deleting users works fine. When importing the database which is fairly large due to 20k+ users I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQL Error (1452) Cannot add or update a child row:a foreign key constraint fails ('databaseName'.'#sql-1510_62265', CONSTRAINT 'craft_matrixcontent_newscontent_elementId_fk' FOREIGN KEY ('elementId') REFERENCES 'craft_elements' ('id') ON DELETE CASCADE)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when trying to delete a user it says it's deleted removes the elements from the element tables but does not remove the user from the &lt;code&gt;users&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2016-06-08T20:19:12.540" LastActivityDate="2016-06-08T20:19:12.540" Title="Users not being deleted from the craft_users table?" Tags="&lt;users&gt;&lt;database&gt;&lt;mysql&gt;&lt;delete&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15394" PostTypeId="1" CreationDate="2016-06-08T10:20:38.360" Score="4" ViewCount="820" Body="&lt;p&gt;I am easily able to add a &lt;code&gt;Matrix&lt;/code&gt;. I am also easily able to add a &lt;code&gt;BlockType&lt;/code&gt; to that matrix. &amp;rarr; I am fine so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have no clue what I am missing when I try to add fields to my blocks using the following example (excerpt from a custom plugin).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Performs any actions that should occur after the plugin is installed.&#xA; */&#xA;public function onAfterInstall() {&#xA;    //  create new group&#xA;    $fieldGroup = new FieldGroupModel();&#xA;    $fieldGroup-&amp;gt;name = 'Awesome Field Group';&#xA;    //  save group&#xA;    craft()-&amp;gt;fields-&amp;gt;saveGroup($fieldGroup);&#xA;&#xA;    //  create matrix field&#xA;    $matrixField = new FieldModel();&#xA;    $matrixField-&amp;gt;handle = 'myMatrixField';&#xA;    $matrixField-&amp;gt;name = 'Awesome Matrix';&#xA;    $matrixField-&amp;gt;type = 'Matrix';&#xA;    $matrixField-&amp;gt;required = true;&#xA;    $matrixField-&amp;gt;translatable = true;&#xA;    $matrixField-&amp;gt;groupId = $fieldGroup-&amp;gt;id;&#xA;    //  save matrix field&#xA;    craft()-&amp;gt;fields-&amp;gt;saveField($matrixField);&#xA;&#xA;    //  create block type&#xA;    $blockType = new MatrixBlockTypeModel();&#xA;    $blockType-&amp;gt;handle = 'myAwesomeBlock';&#xA;    $blockType-&amp;gt;name = 'Awesome Block';&#xA;    $blockType-&amp;gt;fieldId = $matrixField-&amp;gt;id; //  also craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('myMatrixField') possible&#xA;&#xA;    //  save it&#xA;    if (craft()-&amp;gt;matrix-&amp;gt;saveBlockType($blockType)) {&#xA;&#xA;        //  UNTIL HERE EVERYTHING WORKS PRETTY FINE.&#xA;&#xA;        //  on saveField() in fields service the given field's context value is ignored because it's overwritten with &quot;craft()-&amp;gt;content-&amp;gt;fieldContext&quot;&#xA;        //  so, after saving the field's context is &quot;global&quot;, but we want something like &quot;matrixBlockType:&amp;lt;id&amp;gt;&quot;&#xA;        //  --&amp;gt; temporarily change this value to ensure we cann passe the block type id&#xA;        $tmp = craft()-&amp;gt;content-&amp;gt;fieldContext;&#xA;        craft()-&amp;gt;content-&amp;gt;fieldContext = 'matrixBlockType:' . $blockType-&amp;gt;id;&#xA;&#xA;        //  create field&#xA;        $field = new FieldModel();&#xA;        $field-&amp;gt;handle = 'myTestField';&#xA;        $field-&amp;gt;name = 'Awesome Field';&#xA;        $field-&amp;gt;type = 'PlainText';&#xA;        $field-&amp;gt;required = true;&#xA;        $field-&amp;gt;translatable = true;&#xA;        //$field-&amp;gt;context = 'matrixBlockType:' . $blockType-&amp;gt;id;&#xA;        //  … last line is commented out because Craft ignores this value --&amp;gt; see implementation of FieldsService::saveField();&#xA;&#xA;        //  save field&#xA;        craft()-&amp;gt;fields-&amp;gt;saveField($field);&#xA;&#xA;        //  FIELD IS ADDED TO DATABASE BUT I CAN'T SEE IT IN MY MATRIX BLOCK&#xA;&#xA;        //  restore original value of &quot;craft()-&amp;gt;content-&amp;gt;fieldContext&quot;&#xA;        craft()-&amp;gt;content-&amp;gt;fieldContext = $tmp;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hoped this is enough to add fields to block types. But as you can see in the screenshot below my &quot;Awesome Field&quot; is missing. :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JFb08.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JFb08.png&quot; alt=&quot;field is missing for block&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When adding this field manually in Craft's admin panel the field definitions in my database look exactly the same. So, any other important step is missing here. I have no idea which one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I have to do to add fields to matrix blocks?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can lead me into the right direction. Thanks in advance. :)&lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2017-10-06T12:36:12.493" Title="How to programmatically add fields to matrix blocks?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;field&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15395" PostTypeId="1" AcceptedAnswerId="15404" CreationDate="2016-06-08T13:40:17.163" Score="1" ViewCount="137" Body="&lt;p&gt;I have an install where I've moved the &lt;code&gt;plugins/&lt;/code&gt; directory outside of the &lt;code&gt;craft/&lt;/code&gt; directory. I've set &lt;code&gt;CRAFT_PLUGINS_PATH&lt;/code&gt; in &lt;code&gt;index.php&lt;/code&gt; and for web requests everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I need to run a console command defined in a plugin. When I invoke the console from my shell, the default (incorrect) value for &lt;code&gt;CRAFT_PLUGINS_PATH&lt;/code&gt; is set and my plugin's console command is not available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've currently worked around this by wrapping &lt;code&gt;craft/app/etc/console/yiic.php&lt;/code&gt;, setting the constant before requiring &lt;code&gt;yiic.php&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env php&#xA;&amp;lt;?php&#xA;&#xA;define('CRAFT_PLUGINS_PATH', realpath(dirname(__FILE__) . &quot;/../plugins&quot;).'/');&#xA;&#xA;require_once(dirname(__FILE__).'/../craft/app/etc/console/yiic.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do this / am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="3574" LastActivityDate="2016-06-08T20:16:04.007" Title="How to set CRAFT_PLUGINS_PATH when invoking a console plugin action" Tags="&lt;plugin-development&gt;&lt;console&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15396" PostTypeId="1" CreationDate="2016-06-08T14:02:13.280" Score="3" ViewCount="2274" Body="&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.testimonials %}&#xA;  &amp;lt;div class=&quot;col-24 {% if loop.last %}gutter-bottom{% else %}gutter-bottom--none{% endif %}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;section inner&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-17 {% if loop.index0 is not divisible by(2) %}last float-right {% endif %}&quot;&amp;gt;&#xA;        {% switch block.type %}&#xA;&#xA;        {% case &quot;testimonials&quot; %}&#xA;&#xA;          &amp;lt;h3&amp;gt;{{ block.personsName }}&amp;lt;/h3&amp;gt;&#xA;          {{ block.quote }}&#xA;          &amp;lt;/div&amp;gt;&#xA;&#xA;          {% for asset in block.image %}&#xA;&#xA;            &amp;lt;div class=&quot;col-7 circle-image-container {% if loop.index0 is divisible by(2) %}last{% endif %}&quot;&amp;gt;&#xA;              &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot;  alt=&quot;{{ asset.title }}&quot;/&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;          {% endfor %}&#xA;&#xA;        {% endswitch %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone point out why the...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;loop.index0 is divisible by(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have on the div around the image isn't working. I'm getting the 'last' class on everything. The one on the previous div is working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just realised it's in it's own image loop causing the problem. How can I get around this?&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="130" LastEditDate="2016-06-08T16:16:31.287" LastActivityDate="2016-06-08T16:21:31.373" Title="Loop divisible by issue" Tags="&lt;loop&gt;&lt;index&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15397" PostTypeId="2" ParentId="15392" CreationDate="2016-06-08T15:08:56.497" Score="1" Body="&lt;p&gt;Currently, Sprout Fields Phone Field only supports a single mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more advanced pattern support, a Regex Field Type is probably the way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is one that came up in my search:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-mn_matchinput&quot; rel=&quot;nofollow&quot;&gt;mn_matchinput&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-08T15:08:56.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15398" PostTypeId="2" ParentId="15396" CreationDate="2016-06-08T15:09:48.707" Score="5" Body="&lt;p&gt;Forgive me if I'm wrong... by using &lt;code&gt;loop.index0 is divisible by(2)&lt;/code&gt; are you trying to determine if the instance is odd or even?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1st - returns &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;2nd - returns &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;3rd - returns &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;4th - returns &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If so Twig does support checking if the loop index is even or odd. Perhaps that would be better to use?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index is even %}Even{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just had a read of the &lt;a href=&quot;https://craftcms.com/docs/templating/switch&quot; rel=&quot;noreferrer&quot;&gt;Craft docs&lt;/a&gt; for the Case and Switch tags and found this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you’re using the {% switch %} tag inside of a {% for %} loop, you won’t be able to access Twig’s loop variable directly inside of the {% switch %} tag. Instead, you can access it like so:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for matrixBlock in entry.matrixField %}&#xA;    {% set loopIndex = loop.index %}&#xA;&#xA;    {% switch matrixBlock.type %}&#xA;&#xA;        {% case &quot;text&quot; %}&#xA;&#xA;            Loop #{{ loopIndex }}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2016-06-08T15:43:27.323" LastActivityDate="2016-06-08T15:43:27.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15399" PostTypeId="2" ParentId="15393" CreationDate="2016-06-08T16:00:40.267" Score="1" Body="&lt;p&gt;Solved this one by adding SET foreign_key_checks = 0; to the beginning of the SQL dump and SET foreign_key_checks = 1; at the end of the file. Not sure if it is the best solution but it certainly worked.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-06-08T16:00:40.267" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15400" PostTypeId="2" ParentId="15396" CreationDate="2016-06-08T16:21:31.373" Score="4" Body="&lt;p&gt;What you want is not the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;loop variable&lt;/a&gt; of the inner loop around the image, but the loop variable of the outer loop. To get to the outer loop, use &lt;code&gt;loop.parent&lt;/code&gt;. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.parent.loop.index0 is divisible by(2) %}last{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-06-08T16:21:31.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15401" PostTypeId="1" CreationDate="2016-06-08T19:12:42.177" Score="1" ViewCount="336" Body="&lt;p&gt;I've already adjusted the php.ini with max values for timeout and file size. This is really perplexing me. I'm on Dreamhost VPS. I've triple checked all file permissions. I consistently get this error: &quot;Upload failed for brooklyn_bridge.jpg. The error message was: “Error uploading the file: Uploaded file was empty&quot; no matter what I try. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here was a recent error after turning devmode on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_FILES=array (&#xA;  'assets-upload' =&amp;gt; &#xA;  array (&#xA;    'name' =&amp;gt; 'brooklyn_bridge.jpg',&#xA;    'type' =&amp;gt; '',&#xA;    'tmp_name' =&amp;gt; '',&#xA;    'error' =&amp;gt; 6,&#xA;    'size' =&amp;gt; 0,&#xA;  ),&#xA;)&#xA;&#xA;$_COOKIE=array (&#xA;  'b8d03c16c0ad94ea360e045e078389acusername' =&amp;gt; 'fef6a177a0a30714376a5da4ec0d0f325256546as:60:&quot;19b3e1b40c907258470bb0eada9aea0a67c491cdczo2OiJqb3NodWEiOw==&quot;;',&#xA;  'CraftSessionId' =&amp;gt; 'XgGRKqGqqi1,Yosu0A37i0',&#xA;  'b8d03c16c0ad94ea360e045e078389ac' =&amp;gt; 'dfb0e07d4a3e09dd9d62a5b04372e50bb9480660s:396:&quot;315becd5240726fc3c5e92aca8e9c9b29fc61fdfYTo2OntpOjA7czo2OiJqb3NodWEiO2k6MTtzOjMyOiJIelM3UzhNWER0ODNlbEdmRUlTUXhORnFXOVFrRVUzbiI7aToyO3M6MzY6IjM4MmM2YzllLTY3NjItNGNiMy1iNjkzLTAxZjZmODQ2MTRmZiI7aTozO2k6MDtpOjQ7czoxMjE6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IEludGVsIE1hYyBPUyBYIDEwXzExXzUpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS81MC4wLjI2NjEuMTAyIFNhZmFyaS81MzcuMzYiO2k6NTthOjA6e319&quot;;',&#xA;)&#xA;&#xA;$_SESSION=array (&#xA;  'b8d03c16c0ad94ea360e045e078389ac__id' =&amp;gt; '1',&#xA;  'b8d03c16c0ad94ea360e045e078389ac__name' =&amp;gt; 'joshua',&#xA;  'b8d03c16c0ad94ea360e045e078389ac__states' =&amp;gt; &#xA;  array (&#xA;  ),&#xA;  'b8d03c16c0ad94ea360e045e078389ac__timeout' =&amp;gt; 1465416905,&#xA;  'b8d03c16c0ad94ea360e045e078389ac__auth_access' =&amp;gt; &#xA;  array (&#xA;    0 =&amp;gt; 'uploadToAssetSource:36',&#xA;  ),&#xA;  'assetsSourcesBeingIndexed' =&amp;gt; &#xA;  array (&#xA;    0 =&amp;gt; '1',&#xA;  ),&#xA;  'assetsMissingFolders' =&amp;gt; &#xA;  array (&#xA;  ),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5256" LastEditorUserId="5256" LastEditDate="2017-05-10T17:58:21.847" LastActivityDate="2017-06-10T13:07:57.383" Title="File empty on all asset uploads" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;php&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15402" PostTypeId="2" ParentId="9248" CreationDate="2016-06-08T19:22:37.643" Score="4" Body="&lt;p&gt;This has now been solved by the addition of the &lt;a href=&quot;https://craftcms.com/docs/config-settings#convertFilenamesToAscii&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;convertFilenamesToAscii&lt;/code&gt;&lt;/a&gt; config setting introduced in Craft 2.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are working on a multilingual site, you might also find the &lt;a href=&quot;https://craftcms.com/docs/config-settings#limitAutoSlugsToAscii&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;limitAutoSlugsToAscii&lt;/code&gt;&lt;/a&gt; config setting useful.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-06-08T19:22:37.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15403" PostTypeId="1" CreationDate="2016-06-08T19:59:44.720" Score="0" ViewCount="192" Body="&lt;p&gt;What I'm looking for is to add in a custom column that either has a checkmark or not based on if the entry's slug has a certain set of characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would get a check: &lt;code&gt;sluggyslug-SC_01234X&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would not: &lt;code&gt;sluggyslug&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be looking at the slug and matching via regex for the &lt;code&gt;SC_XXXXX&lt;/code&gt; portion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is the hook &lt;code&gt;defineAdditionalEntryTableAttributes&lt;/code&gt; and &lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt; but I get an error when I try to set them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I tried in my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAdditionalEntryTableAttributes()&#xA;{&#xA;    return array(&#xA;        'something' =&amp;gt; &quot;Some Column&quot;,&#xA;    );&#xA;}&#xA;&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'something')&#xA;    {&#xA;        if (preg_match(&quot;/(?:SC_\w{5})$/&quot;, $entry-&amp;gt;slug)) {&#xA;          return '&amp;lt;div class=&quot;center&quot;&amp;gt;&amp;amp;#x2713;&amp;lt;/div&amp;gt;';&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try to add the column, I just get this via the &lt;code&gt;getElements&lt;/code&gt; ajax call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CException&#xA;Property &quot;Craft\EntryModel.something&quot; is not defined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to add a column like this?&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2017-03-20T09:06:09.773" Title="Add a column to entries list using defineAdditionalEntryTableAttributes?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15404" PostTypeId="2" ParentId="15395" CreationDate="2016-06-08T20:16:04.007" Score="1" Body="&lt;p&gt;Nope, you've done it the best way in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upcoming Craft 3 treats console requests as more first class citizens like requests so it's not nearly as awkward using them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-08T20:16:04.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15405" PostTypeId="1" AcceptedAnswerId="15451" CreationDate="2016-06-08T20:35:10.530" Score="3" ViewCount="5136" Body="&lt;p&gt;I'm currently trying to use the excellent &quot;Charge&quot; plugin to set up a simple Stripe checkout form for charity donations. The basic example provided in the docs works nicely.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;charge/charge&quot;/&amp;gt;&#xA;  {% set options = { &#xA;    planAmount : 99.99, &#xA;    description : 'This is an extra description', &#xA;   checkout : {&#xA;     name: 'Acme Corp', &#xA;   }} %}&#xA;  {{ craft.charge.setCheckoutOptions(options) }}&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I'm trying to update the 99.99 to use an amount that can be chosen by the client. My attempt at doing this involved having a separate form with a select box which when updated needs to update the planAmount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to do this using &lt;code&gt;craft.request.getPost('name')&lt;/code&gt; tying up to a jQuery post submit but I'm not sure if I'm even going about this the right way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to update a variable in Craft/Twig through JS (or other user interaction)?&lt;/p&gt;&#xA;" OwnerUserId="5093" LastActivityDate="2016-06-10T16:18:25.297" Title="Is it possible to update a Twig variable based on user interaction without page refresh?" Tags="&lt;ajax&gt;&lt;plugin-charge&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15406" PostTypeId="2" ParentId="15405" CreationDate="2016-06-08T20:50:01.757" Score="1" Body="&lt;p&gt;Put the form code in a separate template, and load it via ajax&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-06-08T20:50:01.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15407" PostTypeId="2" ParentId="15405" CreationDate="2016-06-08T20:55:59.157" Score="1" Body="&lt;p&gt;Twig variables are set on the server, and then compiled into HTML. Without a page refresh, I don't see how you can update a variable in a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You COULD, however, set a javascript variable with a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set planAmount = 99.99 %}&#xA;&#xA;&amp;lt;script type=&quot;text/template&quot;&amp;gt;&#xA;var planAmount = {{ planAmount }};&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then elsewhere in your javascript, update the &lt;code&gt;planAmount&lt;/code&gt; variable.&lt;/p&gt;&#xA;" OwnerUserId="4973" LastActivityDate="2016-06-08T20:55:59.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15408" PostTypeId="1" AcceptedAnswerId="15564" CreationDate="2016-06-08T22:02:35.883" Score="2" ViewCount="516" Body="&lt;p&gt;I was developing a site on my server. Craft was living at &lt;code&gt;~/mysite.com/craft/&lt;/code&gt;, the webroot was &lt;code&gt;~/mysite.com/www/&lt;/code&gt;, and the URL was &lt;code&gt;dev.mysite.com&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to deploy the site to &lt;code&gt;www.mysite.com&lt;/code&gt;, but the host (HostGator) requires that the hosting account's primary domain (&lt;code&gt;www.mysite.com&lt;/code&gt;) point to &lt;code&gt;~/public_html/&lt;/code&gt;. Ok, fine. First, I changed the &lt;code&gt;dev&lt;/code&gt; subdomain to point to &lt;code&gt;~/public_html/&lt;/code&gt; instead of to &lt;code&gt;~/mysite.com/www/&lt;/code&gt;. Then I moved the &lt;code&gt;index.php&lt;/code&gt; and &lt;code&gt;.htaccess&lt;/code&gt; from &lt;code&gt;~/mysite.com/www/&lt;/code&gt; to &lt;code&gt;~/public_html/&lt;/code&gt; and updated the &lt;code&gt;$craftPath&lt;/code&gt; variable to point to the proper directory, but now all I get is blank white pages, both on the frontend and the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deleted everything under the &lt;code&gt;craft/storage/runtime/cache/&lt;/code&gt; and &lt;code&gt;craft/storage/runtime/logs/&lt;/code&gt; directories, opened up an incognito Chrome window, and pointed it at &lt;code&gt;dev.mysite.com/admin&lt;/code&gt; (which is now pointing and &lt;code&gt;.htaccess&lt;/code&gt;-requesting &lt;code&gt;~/public_html/index.php?p=admin&lt;/code&gt;, I believe...). I get redirected to &lt;code&gt;dev.mysite.com/admin/login&lt;/code&gt;, but still end up with only a blank white page there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only &lt;code&gt;[error]&lt;/code&gt; appearing in the log file is related to &lt;code&gt;testPathInfo&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2016/06/08 21:52:06 [error] [application] Unable to determine if PATH_INFO is enabled on the server: [curl] 6: Couldn't resolve host 'dev.mysite.com' [url] http://dev.mysite.com/index.php/testPathInfo&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Halp?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2016-06-20T04:46:23.787" Title="Blank white pages after moving index.php" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15409" PostTypeId="2" ParentId="12907" CreationDate="2016-06-08T22:08:45.870" Score="4" Body="&lt;p&gt;I've managed to achieve something which works in the least technical way I can think of. Other solutions might involve migrating data directly within the database, but I figure this is a good starting point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know how you get on.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an RSS feed, &lt;strong&gt;ensuring that the data you want to move&lt;/strong&gt; is populating the feed.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;https://craftcms.com/docs/templating/rss-feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;RSS template from the CraftCMS documentation&lt;/a&gt;...&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Grab the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe plugin&lt;/a&gt;...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Within FeedMe, the Entry Title is required for it to work, so, &lt;strong&gt;if the Entry Title is what you need to move&lt;/strong&gt; to another field, you will need to make sure  it appears more than once within a RSS-item e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for entry in craft.entries.section('location').find() %}&#xA;        &amp;lt;item&amp;gt;&#xA;            &amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;&#xA;            &amp;lt;link&amp;gt;{{ entry.title }}&amp;lt;/link&amp;gt;&#xA;            ...&#xA;        &amp;lt;/item&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my test example, I have a Channel called '&lt;strong&gt;Locations&lt;/strong&gt;' - the Title field contains names of Cities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to migrate these Titles, to a new custom field called '&lt;strong&gt;City name&lt;/strong&gt;'.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Within FeedMe, create a new Feed, choosing the destination &lt;strong&gt;Section&lt;/strong&gt; and &lt;strong&gt;Content Type&lt;/strong&gt;. Hit the 'Save &amp;amp; Continue' button.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The last screen of FeedMe allows you to 'field match' (assign) the different RSS tag content, to a specific field e.g. 'Link' -&gt; 'City name'. See image below...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xrvhx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xrvhx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my test, I migrated field contents between two fields within the SAME &lt;strong&gt;Section&lt;/strong&gt; and &lt;strong&gt;Content-Type&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts welcome.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-08T22:08:45.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15410" PostTypeId="1" AcceptedAnswerId="15411" CreationDate="2016-06-09T08:49:05.933" Score="1" ViewCount="147" Body="&lt;p&gt;I don't want to show up the email recipients in the source code using this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ 'me@example.com,me2@example.com'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to manage multiple emails dynamically from the contactform.php config file in my craft/config folder. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'toEmail' =&amp;gt; (hash('firstemail@domain.com, secondemail@domain.com') ?: null),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This config file is not working and don't override the plugin settings in the CP. What would be the best way to achieve this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[UPDATE]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended to this, but while it is working fine in the front end, this is causing PHP errors in the CP :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'toEmail'  =&amp;gt; array(&#xA;        ('firstemail@domain.com' ?: null),&#xA;        ('secondemail@domain.com' ?: null)&#xA;     )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2016-06-09T10:04:21.123" LastActivityDate="2016-06-09T10:42:32.973" Title="P&amp;T Contact Form plugin : how can I dynamically add multiple email recipients inside the form config file?" Tags="&lt;plugin-development&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15411" PostTypeId="2" ParentId="15410" CreationDate="2016-06-09T09:15:08.887" Score="1" Body="&lt;p&gt;This is how to achieve this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'toEmail' =&amp;gt; ('firstemail@domain.com,secondemail@domain.com' ?: null),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2016-06-09T10:42:32.973" LastActivityDate="2016-06-09T10:42:32.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15412" PostTypeId="1" AcceptedAnswerId="15416" CreationDate="2016-06-09T09:56:44.177" Score="1" ViewCount="446" Body="&lt;p&gt;I'm looking at Craft Commerce as a possible solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the order process we want customers to be able to upload a file against their order which can then be accessed by the shop administrators. Is this possible and how would we go about that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been looking through the documentation and seen nothing that clearly demonstrates this (yet!). &lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="4466" LastEditDate="2016-06-09T12:04:29.300" LastActivityDate="2016-06-10T11:19:12.427" Title="Craft Commerce: Upload File Field in Order?" Tags="&lt;field&gt;&lt;plugin-craftcommerce&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15413" PostTypeId="1" AcceptedAnswerId="16345" CreationDate="2016-06-09T10:33:44.560" Score="3" ViewCount="864" Body="&lt;p&gt;My plugin needs to allow admin to upload an image. I have the field setup and saving ok. But i cant seem to control the upload location. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what i have so far in my settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.file({&#xA;    label: &quot;My Image&quot;|t,&#xA;    instructions: &quot;&quot;|t,&#xA;    name: 'myImage',&#xA;    value: settings.myImage&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I output the &lt;code&gt;settings.myImage&lt;/code&gt;, I get the file name on its own and no path. I would like it to upload to my &lt;code&gt;/uploads&lt;/code&gt; folder.&#xA;So for example, the image I uploaded was &quot;test.jpg&quot;. When I output the result of &lt;code&gt;settings.myImage&lt;/code&gt;, I get &quot;test.jpg&quot; and no path.&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="57" LastEditDate="2016-08-14T02:02:10.097" LastActivityDate="2018-05-24T21:05:26.230" Title="Plugin settings - file field upload location" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15414" PostTypeId="1" AcceptedAnswerId="15433" CreationDate="2016-06-09T11:08:46.843" Score="0" ViewCount="322" Body="&lt;p&gt;I have a plugin which is trying to create a user whilst inside the Charge plugin's onBeforeCharge event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant code in MyPlugin.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onBeforeCharge', function(Event $event){&#xA;    $newUser = new UserModel;&#xA;&#xA;    $newUser-&amp;gt;firstName = craft()-&amp;gt;request-&amp;gt;getPost('firstName');&#xA;    $newUser-&amp;gt;lastName  = craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;    $newUser-&amp;gt;username  = craft()-&amp;gt;request-&amp;gt;getPost('username');&#xA;    $newUser-&amp;gt;email     = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;    $newUser-&amp;gt;password  = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;&#xA;    if ($newUser-&amp;gt;validate()) {&#xA;        // create user&#xA;    } else {&#xA;        MyPlugin::log('User supplied details were invalid, attempting to redirect with errors.', LogLevel::Error);&#xA;&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'myErrors' =&amp;gt; $newUser&#xA;        ));&#xA;&#xA;        $route = craft()-&amp;gt;urlManager-&amp;gt;parseUrl(craft()-&amp;gt;request);&#xA;        craft()-&amp;gt;runController($route);&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem: this logs my message to the MyPlugin log, and it redirects the page back to the calling template: but &quot;myErrors&quot; is blank. Nothing available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-06-09T19:20:30.743" Title="Getting errors back to a template whilst in an event" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15415" PostTypeId="1" CreationDate="2016-06-09T11:18:04.263" Score="2" ViewCount="631" Body="&lt;p&gt;I have a form created by Sprout Forms, which results in an error when submitted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CSRF token could not be verified!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/06/09 11:06:17 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'The CSRF token could not be verified.' in /home/forge/www.fira.co.uk/craft/app/services/HttpRequestService.php:1314&#xA;Stack trace:&#xA;#0 /home/forge/www.fira.co.uk/craft/app/framework/base/CComponent.php(561): Craft\HttpRequestService-&amp;gt;validateCsrfToken(Object(CEvent))&#xA;#1 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(212): CComponent-&amp;gt;raiseEvent('onBeginRequest', Object(CEvent))&#xA;#2 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(183): CApplication-&amp;gt;onBeginRequest(Object(CEvent))&#xA;#3 /home/forge/www.fira.co.uk/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#4 /home/forge/www.fira.co.uk/public/index.php(19): require_once('/home/forge/www...')&#xA;#5 {main}&#xA;REQUEST_URI=/publications/industry-statistics&#xA;HTTP_REFERER=http://www.fira.co.uk/publications/industry-statistics&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-06-09T13:53:48.583" Title="Sprout Form submit: The CSRF token could not be verified!" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15416" PostTypeId="2" ParentId="15412" CreationDate="2016-06-09T11:40:54.687" Score="2" Body="&lt;p&gt;This is definitely possible. First create a file field to attach to your order in the control panel. Then create a &lt;code&gt;file&lt;/code&gt; input type with a name attribute that uses the field you created &lt;code&gt;name=&quot;fields[fieldName]&quot;&lt;/code&gt;. This would then get sent in the post request to &lt;code&gt;updateCart&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;file&quot; name=&quot;fields[fieldName][]&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Upload file&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you could show the image on the cart/order using something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.fieldName|length %}&#xA;  &amp;lt;img src=&quot;{{ cart.fieldName[0].url }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-10T11:19:12.427" LastActivityDate="2016-06-10T11:19:12.427" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15417" PostTypeId="2" ParentId="15383" CreationDate="2016-06-09T12:30:19.750" Score="1" Body="&lt;p&gt;Currently (Craft Commerce 1.1) there is no way to attach the PDF in an order status email, it can only be a link to download the PDF. For now, I suggest you make a feature request here: &lt;a href=&quot;http://feedback.craftcms.com/forums/295386-commerce/filters/top&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/295386-commerce/filters/top&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-06-09T12:30:19.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15418" PostTypeId="2" ParentId="15284" CreationDate="2016-06-09T12:35:18.770" Score="4" Body="&lt;p&gt;This is now possible as of Craft Commerce 1.1.1211 using the new &lt;code&gt;hasPurchasables&lt;/code&gt; criteria attribute:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-orders#haspurchasables&quot;&gt;https://craftcommerce.com/docs/craft-commerce-orders#haspurchasables&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-06-09T12:35:18.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15419" PostTypeId="1" CreationDate="2016-06-09T12:46:59.000" Score="1" ViewCount="81" Body="&lt;p&gt;With the &lt;a href=&quot;https://solspace.com/craft/calendar&quot; rel=&quot;nofollow&quot;&gt;Solspace Calendar&lt;/a&gt; plugin, is there currently a way to pull a list of all events that don't have occurrences in the future?  In other words, we have a calendar with a lot of repeating events and we want to pull up a list of all of the events (not the occurrences) which are not longer actively repeating.  So until &amp;lt; today?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like using the &lt;code&gt;dateRangeEnd&lt;/code&gt; parameter lets you pull up only occurrences in that range but don't seem to know of a way to just get events that have stopped repeating?  &lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2016-06-09T16:41:30.910" LastActivityDate="2016-06-09T16:41:30.910" Title="Get events where all occurrences are in the past with the Solspace Calendar plugin" Tags="&lt;plugin-calendar&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15420" PostTypeId="1" CreationDate="2016-06-09T13:30:58.427" Score="1" ViewCount="74" Body="&lt;p&gt;I am trying to get access to the attribute title using this, but does not work. If I switch out 'title' for slug, uri, etc. It works. But not title. Anyway I can do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{    &#xA;    switch ($attribute) {&#xA;        case 'title':&#xA;            return $entry-&amp;gt;title . ': Something appended to title';&#xA;            break;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added in &lt;code&gt;return $entry-&amp;gt;title . ': Something appended to title';&lt;/code&gt; to the case to show I want to append something to the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to just append some text, icon, or html to the titles in the entries list in the CP.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2016-06-09T18:38:23.803" LastActivityDate="2016-06-09T18:38:23.803" Title="Trying to access 'title' attribute via getEntryTableAttributeHtml. Any idea how?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15421" PostTypeId="2" ParentId="15415" CreationDate="2016-06-09T13:53:48.583" Score="2" Body="&lt;p&gt;The form code in the template was wrapped in a &lt;code&gt;{% cache %}&lt;/code&gt; tag. &lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-06-09T13:53:48.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15422" PostTypeId="1" AcceptedAnswerId="15429" CreationDate="2016-06-09T15:38:31.133" Score="2" ViewCount="70" Body="&lt;p&gt;I need some advise about the best way to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My site is set up with a Channel called 'Product' for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then have entries within this section&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product A&lt;/li&gt;&#xA;&lt;li&gt;Product B&lt;/li&gt;&#xA;&lt;li&gt;Product C&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Only one of these products will be active at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All links on the site for 'Product' will need to link to the active product page (A, B or C).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I'm thinking of doing this is having a lightswitch on the Product pages to state which is the current (active) one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't get my head around how this might work at the moment so any advise would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="4466" LastEditDate="2016-06-09T17:01:16.223" LastActivityDate="2016-06-13T11:12:53.180" Title="Creating an active page within a channel" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15423" PostTypeId="1" AcceptedAnswerId="15443" CreationDate="2016-06-09T15:41:31.193" Score="3" ViewCount="1254" Body="&lt;p&gt;I'm trying to get my head round how Craft Commerce manages product options. My Product has the following (multiple) options.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Material Type&lt;/li&gt;&#xA;&lt;li&gt;Distance between design&lt;/li&gt;&#xA;&lt;li&gt;No. of designs per metre&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;No. of meters (selecting this changes the price, so 1 metre is £100 and 2 metres is 200 etc)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The options can be set independent of each other.&lt;/li&gt;&#xA;&lt;li&gt;Distance and No. of Designs will have set ranges the customer can choose from.&lt;/li&gt;&#xA;&lt;li&gt;As this is just one product that effectively gets customised by the options there is no stock level.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question One:&lt;/strong&gt; Is multiple options on one product possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question Two:&lt;/strong&gt; Do I need to create variants for each option - how if so? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question Three:&lt;/strong&gt; Do I need multiple products based on the number of Metres (which changes the price)? Ideally I'd like one product that gets adjusted on the options selected. Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2016-06-10T07:41:26.733" LastActivityDate="2016-06-10T09:23:58.737" Title="Craft Commerce: Product Options" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15424" PostTypeId="1" AcceptedAnswerId="15428" CreationDate="2016-06-09T15:48:48.623" Score="0" ViewCount="304" Body="&lt;p&gt;This seems pretty simple in a template; along the lines of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if( craft.entries.authorId(10) | length ){ ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I do that from a plugin?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft-&amp;gt;entries-&amp;gt;authorId(10)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't seem to exist and I've been banging my head against the docs not knowing what I'm actually looking for...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$entryCriteria-&amp;gt;authorId = $existingUser-&amp;gt;id;&#xA;$existingPages = $entryCriteria-&amp;gt;find();&#xA;&#xA;if ($existingPages) {&#xA;    AutoUserEntryPlugin::log('User already exists and has a page belonging to them; aborting.', LogLevel::Info);&#xA;    throw new Exception(Craft::t(&quot;You already have an account and a page created for you. Aborting. You have not been charged.&quot;));&#xA;} else {&#xA;    AutoUserEntryPlugin::log('User with ID ' . $existingUser-&amp;gt;id . ' does not seem to have a page.', LogLevel::Info);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But with a user I know for a fact has an Entry for which they are the author, it's returning &quot;User with ID 1198 does not seem to have a page&quot;.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-06-10T08:29:15.077" LastActivityDate="2016-06-10T10:22:18.743" Title="How to check if a user has any entries they're an author of... in a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15425" PostTypeId="2" ParentId="15265" CreationDate="2016-06-09T16:42:58.590" Score="2" Body="&lt;p&gt;Zuccs, have a look at this plugin: &lt;a href=&quot;https://straightupcraft.com/craft-plugins/template-select&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/template-select&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-09T16:42:58.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15426" PostTypeId="1" AcceptedAnswerId="15430" CreationDate="2016-06-09T16:45:36.317" Score="0" ViewCount="394" Body="&lt;p&gt;This snippet displays every post by postDate, which lists a bunch of “October 2015”. I am trying to filter by month/year, so only one “October 2015” shows then one “November 2015”, then one “December 2015” so on and so forth. So choosing the month, shows all posts from that month. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-field select&quot;&amp;gt;&#xA;&amp;lt;label for=&quot;blog-date&quot;&amp;gt;by date&amp;lt;/label&amp;gt;&#xA;&amp;lt;div class=&quot;custom-select&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;blog-date&quot; id=&quot;blog-date&quot; onchange=&quot;window.location.href=this.value;&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;/blog&quot;&amp;gt;All Time&amp;lt;/option&amp;gt;&#xA;        {% cache %}&#xA;        {% nav entry in craft.entries({ group: 'blog', order: 'postDate desc', limit: null }) %}&#xA;            &amp;lt;option value=&quot;{{ entry.postDate | date('F-Y') }}&quot;&#xA;                {% if craft.request.getLastSegment() == entry.postDate %}selected{% endif %}&amp;gt;&#xA;                {{ entry.postDate | title | date('F Y') }}&#xA;            &amp;lt;/option&amp;gt;&#xA;        {% endnav %}&#xA;        {% endcache %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2016-06-09T17:29:13.437" Title="Dropdown that shows all months and when selected displays all entries from that month" Tags="&lt;filter&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15427" PostTypeId="2" ParentId="15424" CreationDate="2016-06-09T16:47:27.453" Score="2" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$entryCriteria-&amp;gt;authorId = 10;&#xA;$entryModels = $entryCriteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-09T16:47:27.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15428" PostTypeId="2" ParentId="15424" CreationDate="2016-06-09T16:52:18.007" Score="4" Body="&lt;p&gt;Getting entries in plugins is slightly different from within templates and you should read the details on &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;Working with Elements&lt;/a&gt; in a plugin in the Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking that as a guide, you need to create an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; instance which selects the entries you are interested in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;authorId = 10;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; won't pull disabled entries by default. If you want to pull both enabled and disabled entries, you can add the &lt;code&gt;status&lt;/code&gt; parameter to your query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;status = null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, you need to call &lt;code&gt;find()&lt;/code&gt; on the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to fetch the entries matching your criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="1098" LastEditDate="2016-06-10T10:22:18.743" LastActivityDate="2016-06-10T10:22:18.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15429" PostTypeId="2" ParentId="15422" CreationDate="2016-06-09T16:59:03.210" Score="2" Body="&lt;p&gt;I would create a single template that is displayed when you visit &lt;code&gt;/product&lt;/code&gt; and set &lt;code&gt;entry&lt;/code&gt; to be the first entry in the Product channel that is live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entry = craft.entries.section('products').status('live').first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do then is disabled all product entries apart from the product you want to display.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: To avoid duplicate content or different content on the &lt;code&gt;/product&lt;/code&gt; page you could redirect to the current product entry page &lt;code&gt;/products/product-a&lt;/code&gt; using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% redirect entry.url %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-13T11:12:53.180" LastActivityDate="2016-06-13T11:12:53.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15430" PostTypeId="2" ParentId="15426" CreationDate="2016-06-09T17:29:13.437" Score="1" Body="&lt;p&gt;The following three resources should be substantial enough to find a solution:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/11508/linking-and-showing-archive-by-month&quot;&gt;Linking and showing archive by month&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/support/entry-archive#grouping-by-year-and-then-month&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Docs: Grouping by year and then month&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6541/need-to-access-year-month-variable-when-grouping-entries-by-date&quot;&gt;Need to access year/month variable when grouping entries by date&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-09T17:29:13.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15431" PostTypeId="2" ParentId="15420" CreationDate="2016-06-09T18:09:25.487" Score="1" Body="&lt;p&gt;If you wanna change the title one way is override the &lt;code&gt;__toString()&lt;/code&gt; method on your model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @return string&#xA; */&#xA;public function __toString()&#xA;{&#xA;    return (string)$this-&amp;gt;name;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanna chage the status icon next to the title you can override the &lt;code&gt;getElementQueryStatusCondition&lt;/code&gt; function on your ElementType class&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getElementQueryStatusCondition(DbCommand $query, $status)&#xA;{}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="57" LastEditDate="2016-06-09T18:22:04.410" LastActivityDate="2016-06-09T18:22:04.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15432" PostTypeId="1" CreationDate="2016-06-09T18:17:11.913" Score="0" ViewCount="220" Body="&lt;p&gt;I've got a Structure entry, enabled, but Live Preview (or just viewing the page on the public site) shows the home page instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might I have a setting incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: It looks like previewing any entry shows me the home page.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastEditorUserId="4992" LastEditDate="2016-06-09T18:42:39.887" LastActivityDate="2016-06-10T17:54:28.760" Title="Live Preview not working - showing home page instead" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15433" PostTypeId="2" ParentId="15414" CreationDate="2016-06-09T19:20:30.743" Score="2" Body="&lt;p&gt;Rather than ending the request in your plugin, you should probably set &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt;, add your errors to the &lt;code&gt;charge&lt;/code&gt; model and return control to &lt;code&gt;Charge&lt;/code&gt; to add it's own error message and return to the calling template template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your code should look more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onBeforeCharge', function(Event $event){&#xA;    $newUser = new UserModel;&#xA;&#xA;    $newUser-&amp;gt;firstName = craft()-&amp;gt;request-&amp;gt;getPost('firstName');&#xA;    $newUser-&amp;gt;lastName  = craft()-&amp;gt;request-&amp;gt;getPost('lastName');&#xA;    $newUser-&amp;gt;username  = craft()-&amp;gt;request-&amp;gt;getPost('username');&#xA;    $newUser-&amp;gt;email     = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;    $newUser-&amp;gt;password  = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;&#xA;    if ($newUser-&amp;gt;validate()) {&#xA;        // create user&#xA;    } else {&#xA;        MyPlugin::log('User supplied details were invalid, attempting to redirect with errors.', LogLevel::Error);&#xA;&#xA;        // Add our error message to the charge object&#xA;        $chargeModel = $event-&amp;gt;params['charge'];&#xA;        $chargeModel-&amp;gt;addError('myErrors', 'Invalid user details supplied');&#xA;&#xA;        // Stop the payment from proceeding&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template you should be able to access the errors by calling &lt;code&gt;charge-&amp;gt;getErrors()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you supply a parameter to the &lt;code&gt;getErrors()&lt;/code&gt; function you will only get those errors back. So if, as above, we add a custom key to the error, we can query for that in the template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myErrors = charge.getErrors('myErrors') %}&#xA;{% if myErrors | length %}&#xA;    {# Oops! Something went wrong, let's handle that… #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-06-09T19:20:30.743" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15434" PostTypeId="1" CreationDate="2016-06-09T19:27:43.160" Score="1" ViewCount="55" Body="&lt;p&gt;I've installed Craft Commerce locally on MAMP Pro a few times. When I click the install button it takes awhile and then finally I get a 500 Error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Apache Log shows only these two lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Thu Jun 09 15:09:06 2016] [error] [client ::1] FastCGI: comm with server &quot;/Applications/MAMP/fcgi-bin/php7.0.0.fcgi&quot; aborted: idle timeout (30 sec), referer: http://craft-prototype.dev/admin/settings/plugins&#xA;[Thu Jun 09 15:09:06 2016] [error] [client ::1] FastCGI: incomplete headers (0 bytes) received from server &quot;/Applications/MAMP/fcgi-bin/php7.0.0.fcgi&quot;, referer: http://craft-prototype.dev/admin/settings/plugins&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After I receive the error if I go to &lt;code&gt;/admin/settings/plugins&lt;/code&gt; the plugin will show as installed and it's completely fine. The issue doesn't happen when I try to uninstall it. The issue will still happen even if I uninstall and reinstall it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention that the Craft CMS install and all other plugins are working great and I receive no other errors until this comes up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming this is probably a MAMP configuration issue. Has this come up for anyone else? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2016-06-09T19:27:43.160" Title="Errors Trying to Install Craft Commerce on MAMP Pro" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;&lt;installation&gt;&lt;mamp&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-06-12T03:09:41.787" ContentLicense="CC BY-SA 3.0" />
  <row Id="15435" PostTypeId="1" AcceptedAnswerId="15441" CreationDate="2016-06-09T19:28:32.537" Score="4" ViewCount="528" Body="&lt;p&gt;I'm working on a site that involves taking a URL and then getting information about that URL using an API. The URL is entered into a field in a Matrix block, and then another field in the same Matrix block is populated automatically on save. This is working, but only when the article is saved. I'd also like it to work in live preview mode. The event I'm using on save is &lt;code&gt;entries.saveEntry&lt;/code&gt;, but I've also tried using &lt;code&gt;entryRevisions.onSaveDraft&lt;/code&gt;, hoping that drafts were saved with live preview changes, but that didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Is there some event I can listen for that lets me know when the live preview is about to refresh? Can this be done with JavaScript in the admin instead? If so, is there documentation that describes how to do this?&lt;/p&gt;&#xA;" OwnerUserId="248" LastActivityDate="2016-06-09T23:16:06.057" Title="Is there a way a plugin can watch for live preview updates?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15436" PostTypeId="5" CreationDate="2016-06-09T19:43:22.483" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;See how your content will look before it goes live with Live Preview. You can even share your work with others by clicking on the Share button.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From: &lt;a href=&quot;https://craftcms.com/features/live-preview&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/features/live-preview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the biggest roadblocks in getting editors to use a CMS is fear of breaking things. The live preview feature of Craft CMS helps editors to feel empowered, and is a great way to help sell the CMS.&lt;/p&gt;&#xA;" OwnerUserId="248" LastEditorUserId="248" LastEditDate="2016-06-09T23:22:42.427" LastActivityDate="2016-06-09T23:22:42.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15437" PostTypeId="4" CreationDate="2016-06-09T19:43:22.483" Score="0" Body="Craft CMS allows editors to preview their content as they create and edit. This tag relates specifically to using and integrating with the live preview feature." OwnerUserId="248" LastEditorUserId="248" LastEditDate="2016-06-09T23:22:24.847" LastActivityDate="2016-06-09T23:22:24.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15438" PostTypeId="2" ParentId="15435" CreationDate="2016-06-09T20:00:03.370" Score="2" Body="&lt;p&gt;You will probably have to use javascript. Something like this would work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.lp-iframe').on('load', function(event) {&#xA;  console.log(event);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;edit&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this to bind the lp-iframe after it gets added to the page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.livepreviewbtn').on('click', bindIframe);&#xA;&#xA;function bindIframe() {&#xA;  $('.livepreviewbtn').off('click', bindIframe);&#xA;  $('.lp-iframe').on('load', function(event) {&#xA;    console.log(event);&#xA;  });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5251" LastEditorUserId="5251" LastEditDate="2016-06-09T22:06:03.450" LastActivityDate="2016-06-09T22:06:03.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15439" PostTypeId="1" CreationDate="2016-06-09T20:09:15.103" Score="0" ViewCount="95" Body="&lt;p&gt;Anyone familiar with InstaBlog plugin? I need to import some entries (not Wordpress) and everything works fine except the published date for all entries is showing today's date. When I view the entries in the control panel, the post date for each entry is correct, but is displaying the wrong date on front end. The InstaBlog template uses this to display the dates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;div itemprop=&quot;datePublished&quot;&amp;gt;{{ blog.postDate.format('F d, Y') }}&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered this?&lt;/p&gt;&#xA;" OwnerUserId="5259" LastEditorUserId="4466" LastEditDate="2016-06-10T09:53:41.577" LastActivityDate="2016-06-10T10:14:45.710" Title="Imported entries showing wrong post date" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15440" PostTypeId="1" CreationDate="2016-06-09T22:50:17.277" Score="3" ViewCount="111" Body="&lt;p&gt;So I'm taking the plunge from ExpressionEngine to Craft! I have a ton of entries I need to move over, though - and I used the &quot;matrix image haystack&quot; technique for my blog posts to inject the images into the body copy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I love the Matrix layouts in Craft and would like to essentially put those images in their own &quot;block&quot; and separate the text around the haystack tags into their own blocks as well. I'm doubting that's possible, but I'm not going to be able to re-publish hundreds of blog posts a new way, either :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone attempted anything like this?&lt;/p&gt;&#xA;" OwnerUserId="5220" LastActivityDate="2016-06-12T15:54:20.823" Title="Migrating Content from ExpressionEngine that used Matrix Image haystack Technique" Tags="&lt;matrix&gt;&lt;image&gt;&lt;import&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15441" PostTypeId="2" ParentId="15435" CreationDate="2016-06-09T23:09:24.263" Score="2" Body="&lt;p&gt;Attaching an event listener for the iframe's &lt;code&gt;load&lt;/code&gt; event is a very good way to solve this. The issue is how/when to attach that listener, as the &lt;code&gt;.lp-iframe&lt;/code&gt; isn't attached to the DOM before the user actually enters Live Preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft exposes the current Live Preview instance (via the global &lt;code&gt;Craft&lt;/code&gt; JavaScript object that is available inside the CP) and the Live Preview instance dispatches an &lt;code&gt;enter&lt;/code&gt; event when the user enters Live Preview – at which point the &lt;code&gt;.lp-iframe&lt;/code&gt; should be available in the DOM. This means that you need to listen for the &lt;code&gt;livePreview.enter&lt;/code&gt; event, before attempting to attach the &lt;code&gt;load&lt;/code&gt; event listener for the iframe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only trouble is actually getting to the &lt;code&gt;Craft.livePreview&lt;/code&gt; instance, as your plugin's JavaScript will usually run before it is created. This means that if you try to read the &lt;code&gt;Craft.livePreview&lt;/code&gt; attribute in your plugin's JavaScript on pageload, you'll just get an &lt;code&gt;undefined&lt;/code&gt; value back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to solve this, is to &lt;em&gt;poll&lt;/em&gt; for the &lt;code&gt;Craft.livePreview&lt;/code&gt; instance. Polling basically involves testing for the attribute continually, until its available (or after a reasonable amount of time has passed, and we can assume the attribute will &lt;em&gt;never&lt;/em&gt; be available – at which point its a good idea to stop polling to avoid memory leaks etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a script which will poll the &lt;code&gt;Craft&lt;/code&gt; object for the &lt;code&gt;livePreview&lt;/code&gt; instance for a full 2 seconds (should be more than enough!) using &lt;code&gt;requestAnimationFrame&lt;/code&gt; (which basically means it'll check as often as 60 times each second). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If/when the &lt;code&gt;livePreview&lt;/code&gt; instance is found, the script attaches event listeners to the &lt;code&gt;enter&lt;/code&gt; and &lt;code&gt;exit&lt;/code&gt; events. Inside the former event's listener (which will fire when Live Preview opens), one more event listener is attached for the &lt;code&gt;.lp-iframe&lt;/code&gt; element's &lt;code&gt;load&lt;/code&gt; event, so that finally, when the iframe loads, the &lt;code&gt;onLivePreviewIframeLoaded&lt;/code&gt; event handler is called. Inside that last event handler, you should hopefully be able to accomplish what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following should be added to the &lt;code&gt;init&lt;/code&gt; method in your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Only add the JS for non-AJAX CP requests&#xA;if (craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; !craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJs(&quot;&#xA;&#xA;        function getLivePreview()&#xA;        {&#xA;&#xA;            // Remove the RAF poller if it exists&#xA;            if (livePreviewPollerRaf) {&#xA;                Garnish.cancelAnimationFrame(livePreviewPollerRaf);&#xA;                livePreviewPollerRaf = null;&#xA;            }&#xA;&#xA;            if (Craft.livePreview) {&#xA;&#xA;                // I can haz live preview. Attach event listeners&#xA;                livePreview = Craft.livePreview;&#xA;                livePreview.on('enter', onLivePreviewEnter);&#xA;                livePreview.on('exit', onLivePreviewExit);&#xA;&#xA;                console.log('Live preview is available');&#xA;&#xA;            } else if (new Date().getTime() - now &amp;lt; 2000) { // Only poll for 2 seconds&#xA;&#xA;                livePreviewPollerRaf = Garnish.requestAnimationFrame(livePreviewPoller);&#xA;&#xA;            }&#xA;        }&#xA;&#xA;        function onLivePreviewEnter()&#xA;        {&#xA;            Garnish.requestAnimationFrame(function () {&#xA;                $('.lp-iframe').on('load', onLivePreviewIframeLoaded);&#xA;            });&#xA;        }&#xA;&#xA;        function onLivePreviewExit()&#xA;        {&#xA;            // Remove the load handler, lets be clean&#xA;            $('.lp-iframe').off('load');&#xA;        }&#xA;&#xA;        function onLivePreviewIframeLoaded(e)&#xA;        {&#xA;            console.log('live preview iframe loaded', e);&#xA;            // ** THIS IS WHERE YOU CAN DO STUFF **&#xA;        }&#xA;&#xA;        // Start by polling for the live preview instance&#xA;        var livePreview = null;&#xA;        var livePreviewPollerRaf = null;&#xA;        var livePreviewPoller = getLivePreview;&#xA;        var now = new Date().getTime();&#xA;&#xA;        livePreviewPoller();&#xA;&#xA;    &quot;);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-06-09T23:16:06.057" LastActivityDate="2016-06-09T23:16:06.057" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15442" PostTypeId="1" CreationDate="2016-06-10T02:13:29.173" Score="2" ViewCount="335" Body="&lt;p&gt;I've been trying to figure this out for a couple days now and haven't been able to. I'm using the Squarebit Charge plugin to accept donations on a website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have everything working fine on my local Vagrant machine. However, when I push it to my staging server, the redirect to the &quot;thank you&quot; page never works. Instead of redirecting to the thank you page, the Donate page is reloaded and displays a single &quot;1&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas? I do get a TypeError in console because the card expiry date field had to be changed. Stripe would complain that the card exp_month field wasn't present so I had to create that field. I get the error on my Vagrant box too so I don't think it's causing the process to fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My staging link is here: &lt;a href=&quot;http://kb.topsdev.net/donate&quot; rel=&quot;nofollow&quot;&gt;kb.topsdev.net/donate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2016-06-10T16:12:01.323" Title="Charge plugin redirecting to page with &quot;1&quot; on it" Tags="&lt;plugins&gt;&lt;redirect&gt;&lt;plugin-charge&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15443" PostTypeId="2" ParentId="15423" CreationDate="2016-06-10T09:17:39.963" Score="4" Body="&lt;p&gt;Normally you would create variations of a product that would then be purchased by a customer. An example could be a plain t-shirt (the product), which is available in small, medium &amp;amp; large (each of these would be a variant of the product). This way you can easily keep track of stock, set different prices (like your No. of meters) and add different field values, if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would create a variant for each &quot;No. of meters&quot; as this will require a different price to be charged. However, creating a variant for each and every configuration would be overkill. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you don't need to track stock and each product will be made to order I would instead look at adding the options to the line item using &lt;code&gt;name=&quot;options[optionName]&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is taken from the default templates that come with Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;options[giftWrapped]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;no&quot;&amp;gt;No gift wrap.&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;yes&quot;&amp;gt;Gift wrapped.&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These options are then set on the line item for that order. These would be viewable on the order summary page in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-10T09:23:58.737" LastActivityDate="2016-06-10T09:23:58.737" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15444" PostTypeId="2" ParentId="15412" CreationDate="2016-06-10T09:53:57.440" Score="0" Body="&lt;p&gt;For anyone wanting to add a field on the front end, this from the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Uploading Files from Front-end Entry Forms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to allow users to upload files to an Assets field from a front-end entry form, you just need to do two things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, make sure your  tag has an &lt;strong&gt;&lt;em&gt;enctype=&quot;multipart/form-data&quot;&lt;/em&gt;&lt;/strong&gt; attribute, so that it is capable of uploading files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a file input to the form, in the same way you would add a textarea for a Plain Text field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;fields[assetsFieldHandle]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want your form to allow multiple files being uploaded at once, just add the multiple attribute, make sure that the input name ends in “&lt;strong&gt;[]&lt;/strong&gt;”:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;file&quot; name=&quot;fields[assetsFieldHandle][]&quot; multiple&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-06-10T09:53:57.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15446" PostTypeId="2" ParentId="15439" CreationDate="2016-06-10T10:14:45.710" Score="1" Body="&lt;p&gt;Try using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html&quot; rel=&quot;nofollow&quot;&gt;date Twig filter&lt;/a&gt; instead&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.postDate|date( 'F d, Y' ) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the post dates on your entries are stored as datetime objects then the above should work.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-10T10:14:45.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15447" PostTypeId="2" ParentId="15442" CreationDate="2016-06-10T10:32:42.127" Score="2" Body="&lt;p&gt;I have seen this before - yesterday in fact, with this plugin. But I was messing about trying to get it to report errors back to the calling template from a plugin I was writing. I still don't know what caused it, but there might be a clue in that :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have an issue with it where the redirect to success url never actually completes. Just hangs there. No errors in the logs, all successful. I'm in testing mode for Stripe though; have you remembered to change your Account mode to Live?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-06-10T10:32:42.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15448" PostTypeId="1" CreationDate="2016-06-10T11:36:31.877" Score="2" ViewCount="544" Body="&lt;p&gt;I would like to let my static assets (JS, CSS and images file) close to my templates files.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public/&#xA;templates/&#xA;    css/&#xA;    images/&#xA;    scripts/&#xA;    template.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Until now, I didn't find a clean way to access these files.&#xA;&lt;code&gt;{% includeCssFile %}&lt;/code&gt; and &lt;code&gt;{% includeJsFile %}&lt;/code&gt; works, but I get strange &quot;compiling&quot; issues with my javascript &quot;templates&quot; saying unclosed comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, does a clean solution, other than copying these files to public, exists ? A variable like siteUrl pointing to the right folder ?&lt;/p&gt;&#xA;" OwnerUserId="5263" LastEditorUserId="57" LastEditDate="2016-06-10T18:42:12.553" LastActivityDate="2016-06-10T18:45:08.853" Title="Custom static assets" Tags="&lt;custom&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15449" PostTypeId="2" ParentId="15442" CreationDate="2016-06-10T16:12:01.323" Score="4" Body="&lt;p&gt;I'm the developer of Charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never directly observed that behaviour, but it sounds like it's most likely hitting a redirect failure and falling back to some base success/fail responses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most likely cause of that, is that you've not specified the default success route in the Charge settings. You'll find that under &lt;strong&gt;Charge &gt; Settings &gt; General &gt; Success URL&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In there, you can specify the exact redirect route to push a user to after a successful transaction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common format would be something like &lt;code&gt;thanks/{slug}&lt;/code&gt;, and load up your receipt template, on a path like &lt;code&gt;payments/receipt&lt;/code&gt; etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you can supply a hidden input on the form called &lt;code&gt;redirect&lt;/code&gt; with the url you'd want the user redirected to after the transaction completes. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-06-10T16:12:01.323" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="15451" PostTypeId="2" ParentId="15405" CreationDate="2016-06-10T16:18:25.297" Score="3" Body="&lt;p&gt;I'm the developer of Charge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to go about the form setup a slightly different way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By design there are &lt;strong&gt;2&lt;/strong&gt; ways to define the value for a Charge, either &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setting the &lt;code&gt;planAmount&lt;/code&gt; variable in your twig template, and passing it to the &lt;code&gt;setCheckoutOptions&lt;/code&gt;/&lt;code&gt;setPaymentOptions&lt;/code&gt; method.&lt;/li&gt;&#xA;&lt;li&gt;Passing the &lt;code&gt;allowDynamic : true&lt;/code&gt; setting to the &lt;code&gt;setCheckoutOptions&lt;/code&gt;/&lt;code&gt;setPaymentOptions&lt;/code&gt; method. With the &lt;code&gt;allowDynamic&lt;/code&gt; option passed, you can then pass the planAmount as a hidden or visible input in your payment form, named &lt;code&gt;planAmount&lt;/code&gt;. This can be directly updated by your users, and is explicitly designed for variable amount and charity donation form setups.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An example of this behaviour is included in the demo templates in &lt;code&gt;template/charge/donation.html&lt;/code&gt; and is also visible here : &lt;a href=&quot;http://demos.squarebit.co.uk/charge/donation&quot; rel=&quot;nofollow&quot;&gt;http://demos.squarebit.co.uk/charge/donation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-06-10T16:18:25.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15452" PostTypeId="2" ParentId="15432" CreationDate="2016-06-10T17:54:28.760" Score="1" Body="&lt;p&gt;My bad. I forgot to call the block in the _layout template!&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2016-06-10T17:54:28.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15453" PostTypeId="2" ParentId="15448" CreationDate="2016-06-10T18:45:08.853" Score="2" Body="&lt;p&gt;The problem with putting them in your &lt;code&gt;templates&lt;/code&gt; folder is now PHP/Craft is going to try and serve them.  Meaning that you've got the overhead of PHP and Craft when trying to request every single asset instead of if they were in the &lt;code&gt;public&lt;/code&gt; folder where Apache can instantly serve them (orders of magnitude faster).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-10T18:45:08.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15455" PostTypeId="1" CreationDate="2016-06-11T18:30:59.750" Score="1" ViewCount="90" Body="&lt;p&gt;I'm using the nav tag to build a menu which works great, but i just want to repeat the parent menu item over to any sub nav. So if there is a sub nav, at the top of the sub navs links, i want the parent url repeated once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code is this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;ul&amp;gt;&#xA;   {% nav page in blah %}&#xA;    &amp;lt;li&amp;gt;&#xA;         {% if page.level == 1 %}&#xA;            &amp;lt;a href=&quot;/{{ section.handle }}#{{ page.slug }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                {% else %}&#xA;                    {{ page.getLink() }}&#xA;         {% endif %}&#xA;&#xA;         {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;         {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and i'm looking at doing something like (but i would love it to work obviously)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;ul&amp;gt;&#xA;   {% nav page in blah %}&#xA;    &amp;lt;li&amp;gt;&#xA;         {% if page.level == 1 %}&#xA;            &amp;lt;a href=&quot;/{{ section.handle }}#{{ page.slug }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                {% else %}&#xA;                    {{ page.getLink() }}&#xA;         {% endif %}&#xA;&#xA;         {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;{{ page.parent.getLink() }}&amp;lt;/li&amp;gt; -- this is dodgy&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;         {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-06-11T18:58:16.870" Title="Using the nav tag repeat the parent once in the children" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15456" PostTypeId="2" ParentId="15455" CreationDate="2016-06-11T18:58:16.870" Score="2" Body="&lt;p&gt;I'm an idiot, i can just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;   {% nav page in blah %}&#xA;    &amp;lt;li&amp;gt;&#xA;         {% if page.level == 1 %}&#xA;            &amp;lt;a href=&quot;/{{ section.handle }}#{{ page.slug }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;                {% else %}&#xA;                    {{ page.getLink() }}&#xA;         {% endif %}&#xA;&#xA;         {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/{{ page.slug }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt; -- this is dodgy&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;         {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-06-11T18:58:16.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15458" PostTypeId="2" ParentId="881" CreationDate="2016-06-12T02:56:04.643" Score="14" Body="&lt;p&gt;Marion Newlevant had a clever, efficient idea in &lt;a href=&quot;https://straightupcraft.com/events/code-review-optimized-tag-clouds-with-taggregate&quot; rel=&quot;noreferrer&quot;&gt;this Straight Up Craft Hangout&lt;/a&gt; if you don't mind having a slight lag (like a day) for your tag counts to be up to date. That idea: &lt;strong&gt;store the counts you need in a Preparse field on each tag, and set up a cron job to re-save all tags periodically.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;1. Set Up Preparse&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;noreferrer&quot;&gt;Preparse&lt;/a&gt; is a free plugin from André Elvan that renders Twig code to a field when an entry is saved. Install it, add a Preparse field to your Tag elements (like &lt;code&gt;tagCount&lt;/code&gt;) for example, and make the contents of said field &lt;code&gt;{{ craft.entries.section('blog').relatedTo(tag).total }}&lt;/code&gt;, where &lt;code&gt;blog&lt;/code&gt; is the section for which we're building the tag cloud. Be sure to set &lt;em&gt;Column Type&lt;/em&gt; → &lt;em&gt;Number&lt;/em&gt;, since we're storing a count and we'll sort on it later in our template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kXyaA.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXyaA.png&quot; alt=&quot;the settings for your Preparse field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a Tag is saved, Craft will count the entries related to it and store the total in this new &lt;code&gt;tagCount&lt;/code&gt; field. Now we just need to make sure tags are saved every now and then!&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;2. Set up a task for resaving elements.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Here we'll make a publicly-accessible PHP script that'll get an instance of Craft (which is easy) and tell it to resave our tags. In this case we'll save &lt;em&gt;all&lt;/em&gt; tags, but you can limit the scope in the task settings if you need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your /public folder, create a file called &lt;code&gt;resave-tags.php&lt;/code&gt; and drop this in it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;$app = require(&quot;../craft/app/bootstrap.php&quot;);&#xA;&#xA;$app-&amp;gt;tasks-&amp;gt;createTask('ResaveElements', 'Resaving tags!', array(&#xA;    'elementType' =&amp;gt; 'Tag'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Note that you don't have to make this public, you can run it from a terminal, shell script, or any old way you'd normally interact with PHP.&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you should be able to hit yourdomain.craft.dev/resave-tags.php and go confirm that Craft has updated your &lt;code&gt;tagCount&lt;/code&gt; values. (You &lt;em&gt;did&lt;/em&gt; already set up entries and tags, right?) Now we just need our reliable friend cron to trigger this for us periodically.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;3. Tie cron to your task.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;If you've never used cron, it's a very simple, powerful tool that lets you run commands at intervals, whether it's every second or every second Tuesday or every decade. The process for editing cron tasks depends on your hosting environment, but the vast majority give you &lt;em&gt;some&lt;/em&gt; way to edit these tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this example, we'll hit our URL at midnight every day and ignore the output (because we're brave):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 * * * /usr/bin/wget --spider \&quot;http://foo.dev/resave-elements.php\&quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;4. Write Your Template&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Here we'll get our tags and order by &lt;code&gt;tagCount&lt;/code&gt; starting with the greatest number. Using just a dash of math, we'll loop through entries and get a number we can use to size text—the biggest tags will be &lt;code&gt;4em&lt;/code&gt; and the smallest will be &lt;code&gt;1em&lt;/code&gt;, per &lt;code&gt;minScale&lt;/code&gt; and &lt;code&gt;maxScale&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set tags = craft.tags.order('tagCount desc').limit(999) %}&#xA;&#xA;{% if tags | length %}&#xA;    {% set minScale = 1 %}&#xA;    {% set maxScale = 4 %}&#xA;    {% set biggestTagCount = (tags|first).tagCount %}&#xA;    {% set smallestTagCount = (tags|last).tagCount %}&#xA;&#xA;    &amp;lt;ul class=&quot;cloud&quot;&amp;gt;&#xA;        {% for tag in tags %}&#xA;            {% set fontSize = ((tag.tagCount - smallestTagCount) / biggestTagCount) * (maxScale - minScale) + minScale  %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;span style=&quot;font-size: {{ fontSize }}em;&quot;&amp;gt;&#xA;                    {{ tag.title }}&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that's one way to make a visually-weighted tag cloud.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-06-12T03:37:09.387" LastActivityDate="2016-06-12T03:37:09.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15459" PostTypeId="2" ParentId="15265" CreationDate="2016-06-12T03:35:52.417" Score="1" Body="&lt;p&gt;Ultimately, you would want to create a single for this type of situation. There are differences in the entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Structures - These are for hierarchical pages, pages that should be displayed in a specific hierarchy and order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channels - These are used when you have a set of pages that fit within a parent but do not need to be in a specific order. For example, a products parent page with 10 product entries within. It wouldn't matter which order the products are in within the channel because you can sort them however you would like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singles - singles are one off pages for exactly what you are looking to do. Singles are cool for say the Home page or a one off Contact Page or About Page if there are no sub pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing about craft is you can pretty much use whatever you want. I'm not sure how your structure works but I believe having a single would be better in your situation. There are quirky workarounds and routing plugins you can use to do what you are trying to accomplish, but better organization with your structures, channels and singles would be the best overall solution.&lt;/p&gt;&#xA;" OwnerUserId="4632" LastActivityDate="2016-06-12T03:35:52.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15461" PostTypeId="2" ParentId="15440" CreationDate="2016-06-12T15:54:20.823" Score="2" Body="&lt;p&gt;You have two main options with a challenge like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;strong&gt;Do it manually&lt;/strong&gt; - While this option doesn't always sound like the most glamourous option, it's often a fairly reasonable step to consider during migrations. Writing and debugging advanced code that is only going to be used once can be costly, and there are plenty of people who specialize in data entry who are capable of helping out if you prepare a good workflow and take the time to train them on the task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;strong&gt;Do it programatically&lt;/strong&gt; - If you take this approach, you'll probably be using an &lt;a href=&quot;https://en.wikipedia.org/wiki/Extract,_transform,_load&quot; rel=&quot;nofollow&quot;&gt;Extract, transform, load&lt;/a&gt; Process (also referred to as an ETL Process). In your case this would roughly equate to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract the data from your ExpressionEngine database&lt;/li&gt;&#xA;&lt;li&gt;Transform that data – processing the body and EE matrix haystack fields and updating the data into the format which you wish to import it into Craft&lt;/li&gt;&#xA;&lt;li&gt;Load your new data into Craft (using a script or import plugin like Brad mentioned in the above comments)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My firm runs a database migration service, &lt;a href=&quot;https://thegreatmigration.net/&quot; rel=&quot;nofollow&quot;&gt;The Great Migration&lt;/a&gt;, and I can confirm that it is possible to migrate ExpressionEngine sites using a &quot;matrix image haystack&quot; technique to Craft CMS. We have used both programmatic and manual steps in doing so for images, videos, and quotes using this technique. Your final solution will largely depend on the format and integrity of your source data and the desired format of your target data.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-12T15:54:20.823" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15462" PostTypeId="1" CreationDate="2016-06-13T04:56:44.780" Score="2" ViewCount="559" Body="&lt;p&gt;I have just started using craft today and I have hit a bit of a bump with Images.&#xA;I created and asset for Work and set it up to point to &lt;code&gt;assets/images/work/&lt;/code&gt; I was able to upload the image but when I tried to preview the 'Work' page the image was going to &lt;code&gt;/work/assets/images/work&lt;/code&gt; relative URL I am guessing.&#xA;I tried then to define and environment variable like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;  'baseAssetUrl'  =&amp;gt; 'http://192.168.99.100:8080/',&#xA;  'baseAssetPath' =&amp;gt; './',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Updated my asset group to the following:&#xA;&lt;code&gt;{baseAssetPath}assets/images/work/&lt;/code&gt;&#xA;&lt;code&gt;{baseAssetUrl}assets/images/work/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try preview the page the image is broken and the variable has not been interpreted&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{baseAssetUrl}assets/images/work/_360xAUTO_crop_center-center/test.jpg&quot; alt=&quot;Test&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can't upload the image I get the following error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Upload failed for test.jpg. The error message was: “Error uploading &#xA;the file: The file system path “{baseAssetPath}assets/images/work/” &#xA;set for this source does not exist.”&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas what am I missing?&lt;/p&gt;&#xA;" OwnerUserId="5269" LastEditorUserId="22" LastEditDate="2017-05-09T21:50:18.557" LastActivityDate="2017-05-09T22:18:57.417" Title="Images are broken when I upload them" Tags="&lt;assets&gt;&lt;image&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15463" PostTypeId="2" ParentId="15462" CreationDate="2016-06-13T05:09:40.570" Score="2" Body="&lt;p&gt;It was a simple misunderstanding of how the general.php should be structured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had &lt;code&gt;environmentVariables&lt;/code&gt; outside of the &lt;code&gt;'*' =&amp;gt; array(&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'sendPoweredByHeader' =&amp;gt; false,&#xA;    'devMode' =&amp;gt; getenv(&quot;CRAFT_DEVMODE&quot;) == &quot;true&quot;,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'baseAssetUrl'  =&amp;gt; 'http://192.168.99.100:8080/',&#xA;      'basePathPublic' =&amp;gt; realpath(dirname(__FILE__)).'/../../html/',&#xA;    ),&#xA;  ),&#xA;);&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5269" LastEditorUserId="4466" LastEditDate="2016-06-13T10:08:50.540" LastActivityDate="2016-06-13T10:08:50.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15464" PostTypeId="1" CreationDate="2016-06-13T05:24:29.393" Score="2" ViewCount="175" Body="&lt;p&gt;I am trying to order the address fields so that they read &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Business name&lt;/li&gt;&#xA;&lt;li&gt;First name&lt;/li&gt;&#xA;&lt;li&gt;Last name&lt;/li&gt;&#xA;&lt;li&gt;Company name&lt;/li&gt;&#xA;&lt;li&gt;Address 1&lt;/li&gt;&#xA;&lt;li&gt;Address 2&lt;/li&gt;&#xA;&lt;li&gt;City&lt;/li&gt;&#xA;&lt;li&gt;State&lt;/li&gt;&#xA;&lt;li&gt;Zip&lt;/li&gt;&#xA;&lt;li&gt;Phone&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I moved some of the items around in the &lt;code&gt;addressFields&lt;/code&gt; array but I can't seem to move the Country or the State. Is there a way to do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% set countries = craft.commerce.countriesList %}&#xA;      {% set states = craft.commerce.statesArray %}&#xA;      {% set addressFields = [&#xA;          { key: 'businessName', label: 'Business Name', required: false },&#xA;          { key: 'firstName', label: 'First Name', required: true },&#xA;          { key: 'lastName', label: 'Last Name', required: true },&#xA;          { key: 'address1', label: 'Address 1', required: false },&#xA;          { key: 'address2', label: 'Address 2', required: false },&#xA;          { key: 'city', label: 'City', required: false },&#xA;          { key: 'zipCode', label: 'Zip Code', required: false },&#xA;          { key: 'phone', label: 'Phone', required: false },&#xA;      ] %}&#xA;&#xA;&#xA;      {% set modelName = modelName is defined ? modelName : 'address' %}&#xA;      {% set model = address is defined ? address : null %}&#xA;&#xA;      &amp;lt;div class=&quot;addressBox {{ modelName }}&quot;&amp;gt;&#xA;          {% for field in addressFields %}&#xA;              &amp;lt;div class=&quot;form-group {% if model and model.getErrors(field.key) %}has-error{% endif %}&quot;&amp;gt;&#xA;                  &amp;lt;label for=&quot;{{ modelName }}-{{ field.key }}&quot;&amp;gt;{{ field.label }}{{ field.required ? '*' : '' }}&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&#xA;                  &amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-{{ field.key }}&quot; class=&quot;u-full-width&quot; name=&quot;{{ modelName }}[{{ field.key }}]&quot;&#xA;                         value=&quot;{{ model ? model[field.key] : '' }}&quot;&amp;gt;      &#xA;                  {% if model and model.getErrors(field.key) %}&#xA;                      &amp;lt;span class=&quot;flash&quot;&amp;gt;{{ model.getErrors(field.key)|join }}&amp;lt;/span&amp;gt;&#xA;                  {% endif %}&#xA;              &amp;lt;/div&amp;gt;&#xA;          {% endfor %}&#xA;&#xA;              &amp;lt;div class=&quot;form-group {% if model and model.getErrors('stateId') %}has-error{% endif %}&quot;&amp;gt;&#xA;              &amp;lt;label for=&quot;{{ modelName }}-stateId&quot;&amp;gt;State&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&#xA;              &amp;lt;select class=&quot;address-state&quot; name=&quot;{{ modelName ~ '[stateId]' }}&quot;&amp;gt;&#xA;                  {% set options = (model and states[model.countryId] is defined ? states[model.countryId] : []) %}&#xA;                  {% for key, option in options %}&#xA;                      {% set optionValue = (model ? model.stateId : '') %}&#xA;                      &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;                  {% endfor %}&#xA;              &amp;lt;/select&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;          &amp;lt;div class=&quot;form-group {% if model and model.getErrors('countryId') %}has-error{% endif %}&quot;&amp;gt;&#xA;              &amp;lt;label for=&quot;{{ modelName }}-countryId&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&#xA;              &amp;lt;select class=&quot;address-country&quot; name=&quot;{{ modelName ~ '[countryId]' }}&quot;&amp;gt;&#xA;                  {% for key, option in countries %}&#xA;                      {% set optionValue = (model ? model.countryId : '') %}&#xA;                      &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;                  {% endfor %}&#xA;              &amp;lt;/select&amp;gt;&#xA;              {% if model and model.getErrors('countryId') %}&#xA;                  &amp;lt;span class=&quot;flash&quot;&amp;gt;{{ model.getErrors('countryId')|join }}&amp;lt;/span&amp;gt;&#xA;              {% endif %}&#xA;          &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;          {% includejs %}&#xA;          var states = {{ craft.commerce.statesArray|json_encode|raw }};&#xA;&#xA;          $('select.address-country').change(function ()&#xA;          {&#xA;              var cid = $(this).val();&#xA;              var $states = $(this).closest('.addressBox').find('select.address-state');&#xA;              $states.find('option').remove();&#xA;&#xA;              if (states.hasOwnProperty(cid))&#xA;              {&#xA;                  for (var id in states[cid])&#xA;                  {&#xA;                      var state = states[cid][id],&#xA;                              $option = $('&amp;lt;option/&amp;gt;');&#xA;&#xA;                      $option.attr('value', id).text(state);&#xA;                      $states.append($option);&#xA;                  }&#xA;              }&#xA;&#xA;          });&#xA;&#xA;          $('select').addClass('form-control input-sm');&#xA;&#xA;          {% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="45" LastEditDate="2016-08-13T02:40:48.233" LastActivityDate="2016-08-13T02:40:48.233" Title="Changing the order of address fields" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15465" PostTypeId="1" CreationDate="2016-06-13T06:50:04.017" Score="1" ViewCount="8050" Body="&lt;p&gt;This will be my first time using Craft, where can I download free templates from or find instructions on how I can create my own templates?&lt;/p&gt;&#xA;" OwnerUserId="5270" LastEditorUserId="4466" LastEditDate="2016-06-13T08:37:16.343" LastActivityDate="2016-06-13T10:06:10.370" Title="Where can I download example templates?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15466" PostTypeId="1" AcceptedAnswerId="15472" CreationDate="2016-06-13T07:25:55.273" Score="0" ViewCount="251" Body="&lt;p&gt;I have a section called Services. I have another section called Case Studies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each Case Study I want to show which service is being used so I add an entry field and choose the right service. On my case study I can see that the service is showing as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Service page I want to see which case studies are being associated with the Service.&lt;/p&gt;&#xA;" OwnerUserId="2224" LastEditorUserId="4466" LastEditDate="2016-06-13T09:43:31.197" LastActivityDate="2016-06-13T09:43:31.197" Title="Showing related entries field" Tags="&lt;entries&gt;&lt;relations&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15467" PostTypeId="2" ParentId="15465" CreationDate="2016-06-13T08:36:14.513" Score="2" Body="&lt;p&gt;You won't find downloadable templates like you're used to in other CMS's because the philosophy of Craft isn't about downloading theme's. You should be building your own: &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating-overview&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-06-13T08:36:14.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15469" PostTypeId="2" ParentId="15465" CreationDate="2016-06-13T08:42:40.190" Score="3" Body="&lt;p&gt;To add to &lt;a href=&quot;https://craftcms.stackexchange.com/a/15467/4466&quot;&gt;Matt's answer&lt;/a&gt; there are example templates which contain enough code to get you started in the templates folder &lt;code&gt;craft/templates&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a repo on Github called &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;'HappyLager'&lt;/a&gt; which contains more example templates along with annotations. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-06-13T10:06:10.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15470" PostTypeId="2" ParentId="15464" CreationDate="2016-06-13T08:56:22.250" Score="2" Body="&lt;p&gt;The State and Country fields are output outside your &lt;code&gt;addressFields&lt;/code&gt; loop so will always appear after all of the fields in that loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a recent project I just hard coded each field as it gave me greater control for things like input type, validation messages and layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to continue using your &lt;code&gt;addressFields&lt;/code&gt; array you could add a query to output your country/state select input.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if field.key == 'country' %}&#xA;  &amp;lt;select class=&quot;address-{{ field.key }}&quot; name=&quot;{{ modelName }}[{{ field.key }}]&quot;&amp;gt;&#xA;    {% for key, option in countries %}&#xA;      {% set optionValue = (model ? model.countryId : '') %}&#xA;      &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T08:56:22.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15471" PostTypeId="1" CreationDate="2016-06-13T09:23:47.547" Score="1" ViewCount="814" Body="&lt;p&gt;I'm trying to leverage the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;Contact Form plugin&lt;/a&gt; so I can dynamically specify the &lt;strong&gt;To&lt;/strong&gt; email/recipient (via a text input, not as a hidden field). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried via my own plugin to tap into the &lt;code&gt;beforeSend&lt;/code&gt; event and also via config (eg &lt;a href=&quot;https://gist.github.com/cole007/e65f028cc58140ed3b0f6910fc9615d6&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/cole007/e65f028cc58140ed3b0f6910fc9615d6&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the sent message always defaults to send to the recipient specified in the plugin settings. Any thoughts on how to resolve, or if this is indeed possible?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="4466" LastEditDate="2016-06-13T09:49:26.550" LastActivityDate="2016-06-13T09:49:26.550" Title="Dynamically specify the 'To' email/recipient using Contact Form plugin" Tags="&lt;plugin-development&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15472" PostTypeId="2" ParentId="15466" CreationDate="2016-06-13T09:41:53.830" Score="2" Body="&lt;p&gt;So your Case Study has a field called &lt;code&gt;services&lt;/code&gt; which is an entry relation. You show the services on that Case Study page using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// entry is the current Case Study&#xA;{% set related_services = craft.entries.section( 'services' ).relatedTo( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To show all Case Studies that are related to a Service you can use the same entries query. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// entry is the current Service&#xA;{% set related_case_studies = craft.entries.section( 'caseStudies' ).relatedTo( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T09:41:53.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15473" PostTypeId="2" ParentId="15471" CreationDate="2016-06-13T09:47:59.447" Score="1" Body="&lt;p&gt;Reading the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/README.md&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; it sounds like you should be able to specify &lt;code&gt;toEmail&lt;/code&gt; using a text input. I'm guessing that it is using the default email because you aren't validating the email address first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;toEmail&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin will get &lt;code&gt;toEmail&lt;/code&gt; from the post request and validate it for use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$toEmail = craft()-&amp;gt;request-&amp;gt;getPost('toEmail');&#xA;$toEmail = craft()-&amp;gt;security-&amp;gt;validateData($toEmail);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T09:47:59.447" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15474" PostTypeId="1" AcceptedAnswerId="15475" CreationDate="2016-06-13T10:11:45.157" Score="5" ViewCount="646" Body="&lt;p&gt;In the cart example code the selected options are displayed in an unformatted list like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.options|json_encode }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I noticed that the note field text could be outputted individually like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.note }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm looking to do the same for the select fields on my product, so if I had a list of options like the gift wrap example, how would I then output the result individually (so that I can format how I like)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;options[giftWrapped]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;no&quot;&amp;gt;No gift wrap.&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;yes&quot;&amp;gt;Gift wrapped.&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-06-13T10:31:08.620" Title="Craft Commerce: Displaying Individual Product Options in the Cart?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15475" PostTypeId="2" ParentId="15474" CreationDate="2016-06-13T10:22:55.867" Score="6" Body="&lt;p&gt;Answer is the example code for the cart:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.options.giftWrapped }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-06-13T10:22:55.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15476" PostTypeId="2" ParentId="15474" CreationDate="2016-06-13T10:31:08.620" Score="4" Body="&lt;p&gt;You can also loop through each object within the &lt;code&gt;options&lt;/code&gt; array using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for key, value in item.options %}&#xA;  {{ key }} - {{ value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T10:31:08.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15477" PostTypeId="1" AcceptedAnswerId="15478" CreationDate="2016-06-13T11:17:16.487" Score="4" ViewCount="541" Body="&lt;p&gt;I'm styling my flash messages in Craft Commerce - I added if statements to detect the type of flash message. I noticed however that the message no longer displays but the styling does get picked up. Any ideas what I might need to do here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('notice') %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box info radius&quot;&amp;gt;&#xA;      {{ craft.session.getFlash('notice') }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if craft.session.getFlash('error') %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box alert radius&quot;&amp;gt;&#xA;      {{ craft.session.getFlash('error') }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="57" LastEditDate="2016-06-13T16:45:29.573" LastActivityDate="2016-06-13T16:45:29.573" Title="Craft Commerce: Detecting &amp; Styling Flash Messages?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15478" PostTypeId="2" ParentId="15477" CreationDate="2016-06-13T11:30:47.893" Score="8" Body="&lt;p&gt;Getting a flash message also deletes it, so you should set it to a variable first, otherwise, when you try to access it a second time, it will be empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you need to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set flashNotice = craft.session.getFlash('notice') %}&#xA;{% if flashNotice %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box info radius&quot;&amp;gt;&#xA;      {{ flashNotice }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% set flashError = craft.session.getFlash('error') %}&#xA;{% if flashError %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box alert radius&quot;&amp;gt;&#xA;      {{ flashError }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-06-13T11:30:47.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15479" PostTypeId="2" ParentId="15477" CreationDate="2016-06-13T11:34:49.050" Score="6" Body="&lt;p&gt;You can use &lt;a href=&quot;https://craftcms.com/classreference/variables/UserSessionVariable#hasFlash-detail&quot;&gt;&lt;code&gt;hasFlash()&lt;/code&gt;&lt;/a&gt; instead, or pass &lt;code&gt;false&lt;/code&gt; as a third argument, otherwise the flash message is discarded after the first time it is accessed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('notice', null, false) %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box info radius&quot;&amp;gt;&#xA;      {{ craft.session.getFlash('notice') }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.hasFlash('error') %}&#xA;    &amp;lt;div data-alert class=&quot;alert-box alert radius&quot;&amp;gt;&#xA;      {{ craft.session.getFlash('error') }}&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;&amp;amp;times;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is because flash messages are generally designed to be accessed or displayed only once, on the subsequent request.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-06-13T11:34:49.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15480" PostTypeId="2" ParentId="15369" CreationDate="2016-06-13T11:35:28.727" Score="2" Body="&lt;p&gt;I don't believe this is possible using the native search functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can search for a specific value within a table field using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search('tableField:&quot;ID&quot;') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should return all entries that contain &quot;ID&quot; in &lt;code&gt;tableField&lt;/code&gt;, but it doesn't restrict the search to a particular column in the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How likely is it that the ID will occur in other columns of the table?&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-06-13T11:35:28.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15481" PostTypeId="1" AcceptedAnswerId="15483" CreationDate="2016-06-13T12:13:27.887" Score="4" ViewCount="2386" Body="&lt;p&gt;I have a problem with &lt;code&gt;{% if loop.first %}&lt;/code&gt; and &lt;code&gt;{{ loop.index0 }}&lt;/code&gt; with the following snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.locationSlideshow %}&#xA;  {% switch block.type %}&#xA;    {% case 'upload' %}&#xA;      {% for image in block.image %}&#xA;        &amp;lt;button {% if loop.first %}class=&quot;is-active&quot; {% endif %}data-slide=&quot;{{ loop.index0 }}&quot;&amp;gt;&amp;lt;span class=&quot;show-for-sr&quot;&amp;gt;{{ image.title }}&amp;lt;/span&amp;gt;&amp;lt;/button&amp;gt;&#xA;      {% endfor %}&#xA;  {% endswitch %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that all buttons get the class &lt;em&gt;is-active&lt;/em&gt; and &lt;em&gt;0&lt;/em&gt; instead of 0, 1, 2, 3...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working fine outside of a Matrix field. Any ideas what I am doing wrong here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;br&gt;&#xA;Ben&lt;/p&gt;&#xA;" OwnerUserId="4707" LastEditorUserId="57" LastEditDate="2016-06-13T16:47:41.167" LastActivityDate="2016-06-13T16:47:41.167" Title="{% if loop.first %} and {{ loop.index0 }} not working with Matrix" Tags="&lt;matrix&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15483" PostTypeId="2" ParentId="15481" CreationDate="2016-06-13T13:11:55.550" Score="8" Body="&lt;p&gt;At the moment &lt;code&gt;loop.first&lt;/code&gt; and &lt;code&gt;loop.index0&lt;/code&gt; are relative to your &lt;code&gt;block.image&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want them to be set based on your &lt;code&gt;entry.locationSlideshow&lt;/code&gt; loop (the parent loop) you can use &lt;code&gt;{{ loop.parent.loop.index0 }}&lt;/code&gt; and &lt;code&gt;{{ loop.parent.loop.first }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information see the &lt;a href=&quot;http://twig.sensiolabs.org/doc/recipes.html#accessing-the-parent-context-in-nested-loops&quot;&gt;Twig documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T13:11:55.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15486" PostTypeId="1" AcceptedAnswerId="15487" CreationDate="2016-06-13T14:52:01.987" Score="2" ViewCount="153" Body="&lt;p&gt;Is there a workaround when using Craft with old versions of ImageMagick to prevent transformed images from being darker than the original?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a look within the Imagine code base and couldn't see a easy fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I'm stuck with ImageMagick 6.7.2-7 on shared hosting with no upgrade path.&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="45" LastEditDate="2016-08-13T02:31:51.737" LastActivityDate="2016-08-13T02:31:51.737" Title="ImageMagick generates dark images" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15487" PostTypeId="2" ParentId="15486" CreationDate="2016-06-13T15:10:11.750" Score="2" Body="&lt;p&gt;Try adding this option to your &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;config file&lt;/a&gt; (&lt;code&gt;craft/config/general.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'preserveImageColorProfiles' =&amp;gt; true&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-13T15:10:11.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15488" PostTypeId="1" CreationDate="2016-06-13T16:18:22.983" Score="1" ViewCount="65" Body="&lt;p&gt;I'm working on a control panel plugin where I want to limit users to a subfolder within a main assets folder. I have the subfolder ID, but am unable to amend the following to make use of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelect({&#xA;    id: 'register',&#xA;    name: 'fields[register]',&#xA;    elementType: craft.elements.getElementType(&quot;Asset&quot;),&#xA;    elements: register.register | default,&#xA;    criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;},&#xA;    jsClass: 'Craft.AssetSelectInput',&#xA;    addButtonLabel: 'Upload register',&#xA;    limit: 1,&#xA;    sources: ['folder:9'],&#xA;    disabled: register.locked | default&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, for example, the folder ID above is a subfolder ID, but the asset ends up being saved within the main folder. If I revert back to the main folder ID, then everything works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be fair, using this subfolder ID means existing assets aren't visible, which is the main reason I'm doing this anyway. But it would still be nice if this did what I wanted to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more info:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the folder ID is a valid asset folder, it works as expected.&lt;/li&gt;&#xA;&lt;li&gt;If the folder ID is a dynamically generated subfolder of a valid asset folder, the modal doesn't show any existing files but does allow uploads (saving them directly into the parent, which actually works nicely for me).&lt;/li&gt;&#xA;&lt;li&gt;If the folder ID isn't a valid folder or subfolder, the modal is empty.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any ideas? This is kind of working from me, but more by accident.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-06-14T06:51:41.973" LastActivityDate="2016-06-14T06:51:41.973" Title="Limit control panel assets modal to a subfolder in plugin" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;subfolder&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15489" PostTypeId="2" ParentId="15181" CreationDate="2016-06-13T16:23:13.163" Score="3" Body="&lt;p&gt;Something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelect({&#xA;    id: 'invoicePdf',&#xA;    name: 'fields[invoicePdf]',&#xA;    elementType: craft.elements.getElementType(&quot;Asset&quot;),&#xA;    elements: invoice.invoicePdf | default,&#xA;    criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;},&#xA;    jsClass: 'Craft.AssetSelectInput',&#xA;    addButtonLabel: 'Upload invoice',&#xA;    limit: 1,&#xA;    sources: ['folder:1']&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-06-13T16:23:13.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15490" PostTypeId="1" AcceptedAnswerId="15492" CreationDate="2016-06-13T18:55:54.957" Score="1" ViewCount="38" Body="&lt;p&gt;How would you go about creating a daily quota for posts? I have a simple photo gallery where users can submit images, problem is some people are a bit too excited. I'd like to limit submission to let's say 10 per day per user. Any tips how to approach this welcomed.&lt;/p&gt;&#xA;" OwnerUserId="5214" LastActivityDate="2016-06-13T20:39:02.850" Title="Daily quota for post submissions" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15491" PostTypeId="1" CreationDate="2016-06-13T19:24:36.570" Score="3" ViewCount="197" Body="&lt;p&gt;I would like to create a plugin/function to move all unused assets (which are not related to a entry) to a specific folder in the same assets source. Now i try to create the function to move a single file by referring the id of the file. But i get always errors... The function should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function moveFileToFolder($fileId,$idOfTargetFolder,$assetSourceId) {&#xA; ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-06-17T08:33:45.813" Title="Move unused Assets to a specific Folder" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15492" PostTypeId="2" ParentId="15490" CreationDate="2016-06-13T19:59:10.130" Score="1" Body="&lt;p&gt;You would have to hide the button or page where users could upload a photo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this you could query for all that users entries with today's postDate. If the total is equal to or more than 10 then you'd redirect them to a different page or hide/disable the button that submits an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something along the lines of the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;add-image.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set todaysEntryCount = craft.entries.section( 'images' ) authorId( currentUser.id ).postDate( '&amp;gt; ' ~ now|date_modify('-1 day') ).total() %}&#xA;{% if daysEntryCount &amp;gt;= 10 %}&#xA;  {% redirect /your-images?message=dailylimit %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if daysEntryCount &amp;lt; 10 %}&#xA;   &amp;lt;button type=&quot;submit&quot;&amp;gt;Add your image&amp;lt;/button&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-13T20:39:02.850" LastActivityDate="2016-06-13T20:39:02.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15493" PostTypeId="1" CreationDate="2016-06-13T21:12:57.400" Score="1" ViewCount="350" Body="&lt;p&gt;I’m trying to bootstrap Craft as a service inside of another framework (lumen). I’m requiring the bootstrap file which seems to get me up and running except that plugins and assets aren’t included in the EntryModel results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m requiring Craft like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;$craft = require_once base_path().'/../craft/app/bootstrap.php'; &#xA;$this-&amp;gt;app-&amp;gt;singleton('Craft', function() use ($craft) { &lt;br&gt;&#xA;    return $craft;&#xA; });&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then getting my EntryModel like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;$criteria = app()-&amp;gt;make('Craft')-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA; $criteria-&amp;gt;section = 'emails'; &#xA;$criteria-&amp;gt;slug = 'tuition-agreement-link'; &#xA;$email = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text content returns perfectly, but asset fields return &lt;code&gt;null&lt;/code&gt;. The one thing I can see that craft/app/index.php does differently than me is calling $app-&gt;run() (since I'm not actually trying to run the full blown app with request routing). Anyone know if there is an additional step I can take to bootstrap assets and plugins without running the full blown app? Am I trying to do the impossible?&lt;/p&gt;&#xA;" OwnerUserId="3886" LastActivityDate="2016-06-14T05:16:09.170" Title="Using Craft inside Lumen / Laravel" Tags="&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15494" PostTypeId="2" ParentId="15493" CreationDate="2016-06-14T05:10:39.823" Score="1" Body="&lt;p&gt;Craig, I really don't know much directly about this, but it occurred to me to look at the ConsoleApp, which is used in one normal way to run Craft headless (from yiic on command line). It's in app/etc/console/ConsoleApp.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little hunting around with PhpStorm, excellent for this sort of thing as others, turns up that ConsoleApp is loading plugins, and I think it will be loading things like Assets through the loadEditionComponents call -- edition checks out to mean Craft Edition, as Personal, Client, Pro, etc. by your license -- so that S3 might be available for Assets, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just what you would need to do, haven't time to go further on. You might find just calling ConsoleApp-&gt;run() would do, or may have to make a modified version of ConsoleApp, but seems it might make a good scaffold in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good fortune on this; interested to know what you work out.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2016-06-14T05:16:09.170" LastActivityDate="2016-06-14T05:16:09.170" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15495" PostTypeId="1" CreationDate="2016-06-14T10:42:50.490" Score="1" ViewCount="205" Body="&lt;p&gt;I try to implement a User Registration Form with Sprout Forms for hours, but it doesn't work ... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have replaced the value for the action from &quot;sproutForms/entries/saveEntry&quot; to &quot;users/saveUser&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I create the fields (username, password, email, first name, last name), that the user are stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a further step, I will add custom fields for the users.&lt;/p&gt;&#xA;" OwnerUserId="5274" LastActivityDate="2016-06-14T23:04:44.540" Title="User Registration Form with Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15496" PostTypeId="2" ParentId="15495" CreationDate="2016-06-14T10:48:28.930" Score="2" Body="&lt;p&gt;You don't need to use Sprout Forms to create users on your website. Take a look at the &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;Craft documentation&lt;/a&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-14T10:48:28.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15497" PostTypeId="1" AcceptedAnswerId="15499" CreationDate="2016-06-14T11:24:58.793" Score="1" ViewCount="452" Body="&lt;p&gt;I'm trying to update a user password on save via a custom field (on registration via the back-end - the admin needs to specify a password on registering a user). Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Came across this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1197/how-do-i-change-a-users-password-programmatically-in-a-plugin&quot;&gt;How do I change a user&amp;#39;s password programmatically in a plugin?&lt;/a&gt; and tried using the &lt;code&gt;users.onBeforeSaveUser&lt;/code&gt; event to update the &lt;code&gt;$user-&amp;gt;newPassword&lt;/code&gt; but the user cannot login with the details registered/created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on above appreciated!&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-14T13:39:01.293" Title="Update user password" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;registration&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15498" PostTypeId="1" AcceptedAnswerId="15525" CreationDate="2016-06-14T13:26:13.260" Score="3" ViewCount="583" Body="&lt;p&gt;Instead of taking payment via the &lt;code&gt;Omnipay/Stripe&lt;/code&gt; Payment Method, what I'm trying to do is just create a new Customer and Credit Card on Stripe during Checkout, no payment taken at all at this stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through the Stripe code it looks as though that functionality already exists. On the Stripe Gateway, this looks like it should do what I want. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function createCard(array $parameters = array())&#xA;{&#xA;    return $this-&amp;gt;createRequest('\Omnipay\Stripe\Message\CreateCardRequest', $parameters);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm struggling with is how/where to call this and finish up the Order by turning the Cart into an Order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Checkout / Payment page submits to the following Controller: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Commerce_PaymentsController-&amp;gt;actionPay()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could just duplicate the functionality in here swapping out what I don't need, but this feels really hacky/wrong! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone any suggestions for a more sensible approach? &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-06-16T11:24:45.430" Title="Create an alternate Stripe Payment Method" Tags="&lt;plugin-craftcommerce&gt;&lt;omnipay-stripe&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15499" PostTypeId="2" ParentId="15497" CreationDate="2016-06-14T13:39:01.293" Score="2" Body="&lt;p&gt;You can't use the &lt;code&gt;users.onBeforeSaveUser&lt;/code&gt; event to set a user's password as this event happens after the supplied password has been hashed by a private method in the &lt;code&gt;UsersService&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you could use the &lt;code&gt;users.onSaveUser&lt;/code&gt; event, check if a new user has just been saved and if so add the password to the &lt;code&gt;userModel&lt;/code&gt; and re-save it. The following is untested, but should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;        // Only fire if new user, this should avoid an infinite loop&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;            // retrieve the userModel from the event&#xA;            $user = $event-&amp;gt;params['user'];&#xA;&#xA;            // set new password&#xA;            $user-&amp;gt;newPassword = 'My Super Secret Password';&#xA;&#xA;            // save user&#xA;            if (craft()-&amp;gt;users-&amp;gt;saveUser($user))&#xA;            {&#xA;                // Password successfully saved!&#xA;            }&#xA;            else&#xA;            {&#xA;                // Oops, something went wrong!&#xA;            }&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-06-14T13:39:01.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15500" PostTypeId="2" ParentId="932" CreationDate="2016-06-14T16:14:51.793" Score="3" Body="&lt;p&gt;I hit a snag for this where I needed to check if a value was a boolean type. This isn't the greatest approach, but it does work and is easy to interpret:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if value is same as(false) or value is same as(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Documentation: &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tests/sameas.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/tests/sameas.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5278" LastEditorUserId="-1" LastEditDate="2019-11-11T11:46:16.330" LastActivityDate="2019-11-11T11:46:16.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15502" PostTypeId="1" AcceptedAnswerId="15508" CreationDate="2016-06-14T20:11:33.060" Score="5" ViewCount="173" Body="&lt;p&gt;I've been thinking about creating the simplest possible cache solution and would like to know if this is a worthwhile option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the outstanding &lt;a href=&quot;https://github.com/mmikkel/CacheFlag-Craft&quot;&gt;cacheflag&lt;/a&gt; plugin, I place the entire layout wrapper template inside these tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cacheflag flagged &quot;content&quot; globally using key craft.request.path %}&#xA; ... lots o code....&#xA;{% endcacheflag %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the back end, I flag each of the section with a &quot;content&quot; flag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think by doing this, each url should have it's own cache file. And all caches are cleared whenever a new entry is posted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Granted it may a bit of a sledgehammer style solution, but if traffic is average it could perhaps be effective?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my understanding correct or is this a bad idea?&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2016-06-15T21:02:04.097" Title="Is caching the layout wrapper template a viable option?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15503" PostTypeId="2" ParentId="15495" CreationDate="2016-06-14T23:04:44.540" Score="0" Body="&lt;p&gt;It's on our list to explore supporting this feature but I do not think it is possible to do this yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the time of this post, while Sprout Forms supports &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/payload-forwarding&quot; rel=&quot;nofollow&quot;&gt;Payload Forwarding&lt;/a&gt; (and would let you set the submission URL to be &lt;code&gt;users/saveUser&lt;/code&gt;) and allows you to customize your templates via &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow&quot;&gt;Template Overrides&lt;/a&gt; (where you could ensure the submitted fields fit the proper format for Craft's User Registration such as the fields &lt;code&gt;username&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, and &lt;code&gt;password&lt;/code&gt; being used as the input name values for the fields they are associated with and the custom fields are wrapped in the &lt;code&gt;fields[]&lt;/code&gt; namespace for their input names).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are a handful of other situations that arise that will need to get sorted out before this works. For example, Craft throws an error when you try to save a field with the name &lt;code&gt;username&lt;/code&gt; citing that it is a reserved word and Sprout Forms validates the submitted fields against the Form Model's validation rules, so you're probably not going to be able to submit the username field properly.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-14T23:04:44.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15504" PostTypeId="1" AcceptedAnswerId="15507" CreationDate="2016-06-15T01:08:44.807" Score="1" ViewCount="421" Body="&lt;p&gt;How do I display something only for one of the parent Structure sections and not others or this sections children?&#xA;I was thinking of using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segment(2) == 'modules' and craft.request.lastSegment|length %}''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that still shows for its children.&lt;/p&gt;&#xA;" OwnerUserId="36" LastActivityDate="2016-06-16T07:20:39.633" Title="How do I show something only for a parent segment and not it's children?" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15505" PostTypeId="1" CreationDate="2016-06-15T08:10:08.127" Score="3" ViewCount="109" Body="&lt;p&gt;I have a couple of excel sheets with a list each of recipients for my e-mail campaigns. Is there a way to import that into Sprout Email? If not, I would really appreciate a pointer to where I could look to start hacking/building my own importer.&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2016-09-12T20:57:20.143" Title="Is there a way to import recipients into a list in Sprout Email?" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15506" PostTypeId="1" CreationDate="2016-06-15T09:10:56.807" Score="3" ViewCount="1335" Body="&lt;p&gt;I'm trying to use php-redis as the session store to my craftcms site.&#xA;What I've tried:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;apt-get install php5-redis&lt;/li&gt;&#xA;&lt;li&gt;Edited php.ini with the following:&#xA;&lt;code&gt;&#xA;session.save_handler = redis&#xA;session.save_path = &quot;tcp://redis:6379?auth=password”&#xA;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Still, I don't see any sessions saved in redis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2016-06-15T10:43:50.643" Title="Using PHP Redis as Session Store" Tags="&lt;session&gt;&lt;redis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15507" PostTypeId="2" ParentId="15504" CreationDate="2016-06-15T09:14:24.377" Score="2" Body="&lt;p&gt;The lastSegment will always have length whether it's 2, 3, 4 etc. I am unclear about your Structure setup, but if there is nothing after &quot;modules&quot;, &quot;modules&quot; is the last segment and therefore exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So maybe something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) == 'modules' and not craft.request.getSegment(3)|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-06-16T07:20:39.633" LastActivityDate="2016-06-16T07:20:39.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15508" PostTypeId="2" ParentId="15502" CreationDate="2016-06-15T09:56:03.567" Score="2" Body="&lt;p&gt;In my opinion it's a good, easy and fast way to caching content. We use similar solutions on different Websites and it works perfect for us. Maybe you should do a more specific flagging to avoid deleting all cached entries at once. And you should take care about possible dynamic code parts like forms.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="57" LastEditDate="2016-06-15T21:02:04.097" LastActivityDate="2016-06-15T21:02:04.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15509" PostTypeId="2" ParentId="15506" CreationDate="2016-06-15T10:43:50.643" Score="5" Body="&lt;p&gt;This may help:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the following to the general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheMethod' =&amp;gt; 'redis',&#xA;'overridePhpSessionLocation' =&amp;gt; 'tcp://localhost:6379' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add the following to the index.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ini_set('session.save_handler', 'redis')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5281" LastActivityDate="2016-06-15T10:43:50.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15511" PostTypeId="1" CreationDate="2016-06-15T17:51:39.033" Score="1" ViewCount="176" Body="&lt;p&gt;With guest entries, am I able to redirect before actually saving the entry to say a review page for the user to see the entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figure I could use the &lt;code&gt;guestEntries.beforeSave&lt;/code&gt; hook, but not sure how I'd show the information on the page... or pass to a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2016-06-15T20:43:58.583" LastActivityDate="2016-06-18T19:19:23.167" Title="Before saving Guest Entries, redirect to an entry review page?" Tags="&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15512" PostTypeId="2" ParentId="15318" CreationDate="2016-06-15T18:06:38.093" Score="4" Body="&lt;p&gt;OK So I figured this one out eventually. It's a very hacky fix. I added an &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;adjuster&lt;/a&gt; that is basically an exact copy of the built-in Tax Adjuster (found at &lt;code&gt;plugins/commerce/Commerce/Adjusters/Commerce_TaxAdjuster.php&lt;/code&gt;). The only difference is that I added a condition to check for my Tax Exempt field (and that we're in the OH tax zone), and then &lt;em&gt;removed&lt;/em&gt; the tax amount instead of added it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie, I changed things like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allRemovedTax += $amount;&#xA;$item-&amp;gt;tax += $amount;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allRemovedTax -= $amount;&#xA;$item-&amp;gt;tax -= $amount;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then added the whole thing to a new custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this results in is tax being applied normally, and then the same tax being removed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://cl.ly/01183O2x1f17/Screen%20Shot%202016-06-15%20at%202.05.28%20PM.png&quot; alt=&quot; &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anybody comes across this and has a better solution, I'd love to hear it. But this works for now.&lt;/p&gt;&#xA;" OwnerUserId="251" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:49.823" LastActivityDate="2016-06-15T18:06:38.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15513" PostTypeId="2" ParentId="15282" CreationDate="2016-06-15T18:17:12.910" Score="1" Body="&lt;p&gt;This should take care of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stage = craft.request.getParam('stage') %}&#xA;&#xA;{# check if stage is an array #}&#xA;{% if stage is iterable %}&#xA;&#xA;    {% for stageItem in stage %}&#xA;&#xA;        {# make sure stageItem has content #}&#xA;        {% if stageItem is not empty %}&#xA;&#xA;            {{ stageItem }}&#xA;            {# would output the selected stage.value #}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="251" LastEditorUserId="251" LastEditDate="2016-06-16T13:36:29.093" LastActivityDate="2016-06-16T13:36:29.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15514" PostTypeId="2" ParentId="14849" CreationDate="2016-06-15T18:42:00.840" Score="1" Body="&lt;p&gt;We've successfully implemented a setup that will solve your issue with several sites. Unfortunately we haven't been able to open source things yet, but this is our general process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We set up a Craft install on a separate domain (or subdomain, in our case). Then we serve the content as JSON instead of html in our layout template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our entry templates are totally normal, outputting html like any other template does. This layout just wraps the whole thing in a json object (and does not include the header/footer etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the ZF side, we wrote a module to pull in the data from the separate domain and output it in our app, using the normal layouts that already existed. It is also obviously heavily caching the content it receives from Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, ZF is actually handling all of the requests by end users, and the only things going to Craft are actually curl requests from ZF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have ZF send along a Header telling Craft that the request is coming from ZF, and then we have Craft check for that header. If it exists, it uses layout.json, and if not, it uses layout.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;layout.html has a dummy version of the header and footer, and is only used for Live Preview basically. The layout.json file serves our content as json to the ZF app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is our &lt;code&gt;layout.json&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header 'Content-type: application/json'&#xA;%}{% set response = {&#xA;    success:true,&#xA;    metadata: {&#xA;        {# some custom data #}&#xA;    },&#xA;    data: {&#xA;        meta: (head is defined ? head : {}),&#xA;        body: block('content')&#xA;    }&#xA;} %}{{ response|json_encode()|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, while this doesn't mess with custom routing, it will allow you to keep your ZF app going and have Craft handle marketing/static pages.&lt;/p&gt;&#xA;" OwnerUserId="251" LastActivityDate="2016-06-15T18:42:00.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15515" PostTypeId="1" CreationDate="2016-06-15T22:09:23.507" Score="0" ViewCount="958" Body="&lt;p&gt;I'm trying to have Craft switch baseUrl in &lt;code&gt;general.ph&lt;/code&gt;p based on the environment. The Craft docs tells me to specify the environment in &lt;code&gt;index.php&lt;/code&gt; by using logic based on the &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; variable. &#xA;But this variable doesn't seem to exist in my server environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, neither &lt;code&gt;craft/config/general.php&lt;/code&gt; and &lt;code&gt;craft/public/index.php&lt;/code&gt; seem to have access to this variable. Where does the &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; for each project live and how do I see what it is? Is it supposed to be the same as the &lt;code&gt;server_name&lt;/code&gt; block in my nginx config?&lt;/p&gt;&#xA;" OwnerUserId="5286" LastEditorUserId="57" LastEditDate="2016-06-16T06:29:31.057" LastActivityDate="2016-06-16T06:29:31.057" Title="multi environment nginx, how to check $_SERVER['SERVER_NAME']" Tags="&lt;php&gt;&lt;multi-environment&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15516" PostTypeId="1" AcceptedAnswerId="15517" CreationDate="2016-06-16T00:04:08.833" Score="2" ViewCount="1131" Body="&lt;p&gt;Starting a substantial project. There will be 100s of images on the site. Few are part of the general design, but there are slide carousels, photos, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand what S3 is, but I'm wondering what the specific value is of using it over local storage. There is plenty of room on the web host's server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;S3 isn't a CDN, right? Or will it replicate files across to other locations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I expect S3 to be faster than local storage? And is my S3 bucket backed up elsewhere, should Amazon's servers crash?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2016-06-16T08:25:43.973" Title="What is the value of hosting assets on Amazon S3? Best practices question" Tags="&lt;assets&gt;&lt;s3&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15517" PostTypeId="2" ParentId="15516" CreationDate="2016-06-16T00:30:34.177" Score="4" Body="&lt;p&gt;S3 is not itself a CDN, no.  However, you can use Cloudflare as a free and very easy to set up CDN service in front of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me the main advantages of S3 are that it's a centralised repository of assets I can point all my environments to (so dev, staging, production all point to the same S3 and thus have identical assets available to them with no need to sync anything).  I trust Amazon to runs servers more than I do individual other companies, simply by virtue of their size and experience (and I know some of the engineers as well - they're smart people!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Cloudflare in front of S3, you get CDN and static asset caching benefits, and images are served &lt;em&gt;very&lt;/em&gt; quickly.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-06-16T08:25:43.973" LastActivityDate="2016-06-16T08:25:43.973" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15518" PostTypeId="2" ParentId="15515" CreationDate="2016-06-16T01:36:33.850" Score="2" Body="&lt;p&gt;&lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; is a global server variable (not a craft variable) and should be available. I don't use nginx, so I can't comment on where the &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; comes from exactly — but a quick google search seems to &lt;a href=&quot;https://fisharebest.stonystratford.org/132/where-does-php-get-_serverserver_name-apache-versus-nginx/&quot; rel=&quot;nofollow noreferrer&quot;&gt;explain things&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Blockquote&#xA;  nginx – $_SERVER['SERVER_NAME'] is the first entry in the server_name directive.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as multi-environment config — this is the method which I have adopted, which has proven to be reliable and flexible. (*The only issue that I've encountered is that it doesn't seem to like non-standard ports — if your using port :8888 in a virtual dev environment for example. Perhaps there is a way to add support for non-standard ports as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your main &lt;code&gt;index.php&lt;/code&gt; page (adapted from this &lt;a href=&quot;http://craftcookbook.net/recipes/273&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft cookbook recipe&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Multi-environment Configuration&#xA;define('CRAFT_ENVIRONMENT', call_user_func_array(function($a,$b){if(array_key_exists('APP_ENV',$_SERVER)&amp;amp;&amp;amp;in_array($c=$_SERVER['APP_ENV'],array_keys($a))){return $c;}foreach($a as $c=&amp;gt;$d){$e=$_SERVER['SERVER_NAME'];if((is_array($d)&amp;amp;&amp;amp;in_array($e,$d))||$e==$d){return $c;}}return $b;}, array(&#xA;&#xA;    // Environment Definitions&#xA;    array(&#xA;        'local' =&amp;gt; array('myproject.craft.dev'),&#xA;        'dev' =&amp;gt; array('myproject.mydevsite.com'),&#xA;        'stage' =&amp;gt; array('stage.myproject.com'),&#xA;        'production' =&amp;gt; array('myproject.com'),&#xA;    ),&#xA;&#xA;    // Default Environment&#xA;    'production',&#xA;&#xA;)));&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your &lt;code&gt;config.php&lt;/code&gt; file (adapted from this &lt;a href=&quot;https://craftcms.stackexchange.com/a/4734/784&quot;&gt;stack exchange answer&lt;/a&gt; by Ben Parizek):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; */&#xA;&#xA;// Ensure our urls have the right scheme&#xA;define('URI_SCHEME', ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&#xA;// The site url (doesn't work well when port numbers are required, i.e. http://site.com:8888)&#xA;define('SITE_URL', URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;&#xA;// The site basepath&#xA;define('BASE_PATH', realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;&#xA;    // default config for all environments&#xA;    '*' =&amp;gt; array(&#xA;&#xA;        // environment variables&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl'  =&amp;gt; SITE_URL,&#xA;            'basePath' =&amp;gt; BASE_PATH . 'html/'&#xA;        ),&#xA;&#xA;        // localization settings&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'en-us' =&amp;gt; SITE_URL,&#xA;        ),&#xA;&#xA;    ),&#xA;&#xA;    // specific environment config&#xA;&#xA;    'local' =&amp;gt; array(&#xA;&#xA;        'devMode'    =&amp;gt; true,&#xA;&#xA;    ),&#xA;&#xA;    'dev' =&amp;gt; array(&#xA;&#xA;        'devMode'    =&amp;gt; true,&#xA;&#xA;    ),&#xA;&#xA;    'stage' =&amp;gt; array(&#xA;&#xA;        // environment variables&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl'  =&amp;gt; SITE_URL,&#xA;            'basePath' =&amp;gt; BASE_PATH . 'public/'&#xA;        ),&#xA;&#xA;    ),&#xA;&#xA;    'production' =&amp;gt; array(&#xA;&#xA;        // environment variables&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl'  =&amp;gt; SITE_URL,&#xA;            'basePath' =&amp;gt; BASE_PATH . 'public/'&#xA;        ),&#xA;&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-06-16T01:43:09.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15519" PostTypeId="1" AcceptedAnswerId="15618" CreationDate="2016-06-16T07:10:47.370" Score="3" ViewCount="318" Body="&lt;p&gt;In Craft Commerce is it possible to order each product variant in the template, I would like to order by price ascending, I've tried the below but nothing is returned?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for purchasable in product.variants.order('price asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below works but displays in order they were added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for purchasable in product.variants %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5288" LastActivityDate="2016-06-22T17:31:48.030" Title="How can I order each product variant in my templates?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15520" PostTypeId="1" AcceptedAnswerId="15541" CreationDate="2016-06-16T08:21:49.417" Score="3" ViewCount="378" Body="&lt;p&gt;I have a console command plugin that needs to periodically go and fetch property data via API and import it into Craft. I can pull in basic property information but when it comes to importing the data into Smart Map field I'm a bit lost as how to format the data so that it saves correctly. Has anyone had to do this before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the console command part should make much difference. Basically I am trying to save a smartmapfield on my entry. From the API I am using I get a string with the full address. I first extract the postcode and then use the smartmap plugin to get the Lat and Lng values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$postcode = $matches[0]; &#xA;&#xA;//Look up Latitude and Longitude from Google API&#xA;&#xA;$response = craft()-&amp;gt;smartMap-&amp;gt;lookupCoords($postcode);&#xA;$lat = $response['lat'];&#xA;$lng = $response['lng'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am not sure of is how to format this data so that it can be saved to the entry. So for standard fields thats straight forward:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;title = $property['RoomName'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do this for my smartmap field?&lt;/p&gt;&#xA;" OwnerUserId="590" LastEditorUserId="1098" LastEditDate="2016-06-17T08:10:30.747" LastActivityDate="2016-06-17T08:10:30.747" Title="How to programmatically set a Smart Map address field in plugin" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15521" PostTypeId="1" AcceptedAnswerId="15523" CreationDate="2016-06-16T09:29:30.157" Score="3" ViewCount="79" Body="&lt;p&gt;After I've turned devMode on live site to see what's going on a &lt;strong&gt;fatal error appeared:&lt;/strong&gt; Using $this when not in object context in /var/www/vhosts/site.com/craft/plugins/preparsefield/PreparseFieldPlugin.php on line 112&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weird thing is, that with same settings on local machine it runs as expected.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-06-28T10:15:29.977" LastActivityDate="2016-06-28T10:15:29.977" Title="I get error on live site after Preparse-field update" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15522" PostTypeId="1" AcceptedAnswerId="15533" CreationDate="2016-06-16T09:47:17.197" Score="5" ViewCount="1733" Body="&lt;p&gt;Is there a way to set &lt;code&gt;async defer&lt;/code&gt; on a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag with the built in: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's for Google Maps e.g.: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;amp;callback=initMap&quot;&#xA;async defer&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd still like to be able to output this at the bottom of the layout from within another template. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="3941" LastEditorUserId="57" LastEditDate="2016-06-16T18:38:44.363" LastActivityDate="2018-01-15T16:47:12.310" Title="Can you set async defer when using {% includeJsFile %}?" Tags="&lt;includejs&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15523" PostTypeId="2" ParentId="15521" CreationDate="2016-06-16T10:43:43.957" Score="4" Body="&lt;p&gt;This was due to version 0.3.0 breaking PHP 5.3 support. A fix has been implemented in 0.3.1 that fixes this.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-06-16T10:43:43.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15524" PostTypeId="1" CreationDate="2016-06-16T10:49:32.143" Score="3" ViewCount="1477" Body="&lt;p&gt;I have this this code -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').first() %}&#xA;    &amp;lt;div class=&quot;container&quot; id=&quot;featured-news&quot;&amp;gt;&#xA;        &amp;lt;div class=col-md-6&amp;gt;&#xA;            &amp;lt;h2 class=&quot;news-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;h3 class=&quot;news-date&quot;&amp;gt;{{ entry.postDate.format('F d, Y') }}&amp;lt;/h3&amp;gt;&#xA;&#xA;            &amp;lt;p&amp;gt;&#xA;                {{ entry.body }}&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;img class=&quot;col-md-4&quot; src=&quot;images/pic-block-pic1.jpg&quot; style=&quot;float:right;&quot;&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;col-xs-12&quot; &amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; style=&quot;float:right; padding: 20px 0px 20px 0px&quot;&amp;gt;READ FULL STORY...&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought the &lt;code&gt;.first()&lt;/code&gt; would pick up just the first news story, however it is returning the same container several times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then want to return all other entries elsewhere, so what should I include in my code below to do this - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;imgOverview&quot;&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in craft.entries.section('news').find() %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;div&amp;gt;&amp;lt;img src=&quot;images/pic-block-pic1.jpg&quot; alt=&quot;&quot;&amp;gt;&amp;lt;div class=&quot;imgOverviewOverlay&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;span&amp;gt;{{ entry.title }}&amp;lt;small&amp;gt;{{ entry.postDate.format('F d, Y') }}&amp;lt;/small&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}    &#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5289" LastEditorUserId="57" LastEditDate="2016-06-16T18:48:20.663" LastActivityDate="2016-06-16T18:48:20.663" Title="How do I get just the first entry with a 'for' loop?" Tags="&lt;templating&gt;&lt;entry&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15525" PostTypeId="2" ParentId="15498" CreationDate="2016-06-16T11:24:45.430" Score="1" Body="&lt;p&gt;A no one has come forward and told me it's a bad idea, I've ploughed on and done the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Created my own Controller action in my plugin to bypass the payment side of things altogether. I didn't use Omnipay to create my Customer on Stripe in the end. I went with using Stripes own API directly as documented &lt;a href=&quot;https://stripe.com/docs/api/php#create_customer&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To complete the Order (as-in convert a &lt;code&gt;Cart&lt;/code&gt; into a full-blown &lt;code&gt;Order&lt;/code&gt;, it was as simple as calling the following &lt;code&gt;Commerce&lt;/code&gt; method:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;completeOrder($cart);&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-06-16T11:24:45.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15526" PostTypeId="2" ParentId="15524" CreationDate="2016-06-16T11:34:36.223" Score="5" Body="&lt;p&gt;As you'll only ever be working with one entry I wouldn't bother with the &lt;code&gt;for&lt;/code&gt; loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredArticle = craft.entries.section('news').first() %}&#xA;&#xA;&amp;lt;div class=&quot;container&quot; id=&quot;featured-news&quot;&amp;gt;&#xA;    &amp;lt;div class=col-md-6&amp;gt;&#xA;        &amp;lt;h2 class=&quot;news-title&quot;&amp;gt;{{ featuredArticle.title }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;h3 class=&quot;news-date&quot;&amp;gt;{{ featuredArticle.postDate.format('F d, Y') }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;&#xA;        {{ featuredArticle.body }}&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;img class=&quot;col-md-4&quot; src=&quot;images/pic-block-pic1.jpg&quot; style=&quot;float:right;&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12&quot; &amp;gt;&#xA;    &amp;lt;a href=&quot;{{ featuredArticle.url }}&quot; style=&quot;float:right; padding: 20px 0px 20px 0px&quot;&amp;gt;READ FULL STORY...&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Then for the second part of your question this other answer tells you how to exclude an &lt;code&gt;Entry&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1276/142&quot;&gt;How can I exclude the current entry when I've structured my syntax like this?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from the other article, you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'news'&#xA;}).id('not ' ~ featuredArticle.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-16T12:27:17.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15527" PostTypeId="1" AcceptedAnswerId="15593" CreationDate="2016-06-16T11:47:46.647" Score="2" ViewCount="211" Body="&lt;p&gt;I've structured my Record as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_MerchantOrderRecord extends BaseRecord&#xA;{&#xA;  public function getTableName()&#xA;  {&#xA;    return 'myplugin_merchant_orders';&#xA;  }&#xA;&#xA;  protected function defineAttributes()&#xA;  {&#xA;    return [&#xA;      'merchant_id' =&amp;gt; AttributeType::Number,&#xA;      'order_id' =&amp;gt; AttributeType::Number,&#xA;      ...&#xA;    ];&#xA;  }&#xA;&#xA;  public function primaryKey()&#xA;  {&#xA;    return ['merchant_id', 'order_id'];&#xA;  }&#xA;&#xA;  public function defineRelations()&#xA;  {&#xA;      return [&#xA;        'merchant' =&amp;gt; [static::BELONGS_TO, 'MyPlugin_MerchantRecord', 'merchant_id', &#xA;               'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE],&#xA;        'order' =&amp;gt; [static::BELONGS_TO, 'Commerce_OrderRecord', 'order_id', &#xA;               'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE],&#xA;      ];&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I install the plugin I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Illegal offset type in isset or empty&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I take away the &lt;code&gt;primaryKey()&lt;/code&gt; definition, the table is created successfully and the &lt;code&gt;foreign keys&lt;/code&gt; are in place as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-06-16T13:58:24.793" LastActivityDate="2016-06-21T03:50:46.277" Title="Is it possible to create composite Primary Keys in Records?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15528" PostTypeId="1" AcceptedAnswerId="15529" CreationDate="2016-06-16T14:10:05.507" Score="1" ViewCount="134" Body="&lt;p&gt;I am trying to search for specific matrix blocks by date like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;&#xA;$criteria-&amp;gt;ownerId = $entry-&amp;gt;id;&#xA;&#xA;$criteria-&amp;gt;type = 'myMatrixBlockType';&#xA;&#xA;$criteria-&amp;gt;myMatrixBlockDateField = &quot;2016-06-01 04:00:00&quot;;&#xA;&#xA;$criteria-&amp;gt;limit = 10;&#xA;&#xA;$blocks = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that no matter what format the date is, all blocks from the matrix field in the entry are returned. Any help is appreciated! &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-06-16T14:25:48.530" Title="Search for Matrix Block by Date in plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15529" PostTypeId="2" ParentId="15528" CreationDate="2016-06-16T14:25:48.530" Score="1" Body="&lt;p&gt;You need to add a &lt;code&gt;fieldId&lt;/code&gt; param to make Craft join the content table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;fieldId = $matrixFieldId;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-16T14:25:48.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15530" PostTypeId="1" AcceptedAnswerId="15534" CreationDate="2016-06-16T14:47:53.520" Score="2" ViewCount="180" Body="&lt;p&gt;I'm trying to figure out a way to attach an asset file to a Craft Commerce order status email when a user purchases a product- the user would be purchasing the file and I'd like to attach it to the order status email that's sent upon completion of purchase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that the Contact Form plugin has a similar functionality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L54&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L54&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do something similar in Craft Commerce?&lt;/p&gt;&#xA;" OwnerUserId="5290" LastActivityDate="2016-06-16T18:54:26.153" Title="Is it possible to add an attachment to a Craft Commerce order status email?" Tags="&lt;plugin-craftcommerce&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15531" PostTypeId="1" AcceptedAnswerId="15537" CreationDate="2016-06-16T15:38:24.267" Score="3" ViewCount="565" Body="&lt;p&gt;I'm looking to get the sub total of all items in the car before and tax is added on. The example shop code doesn't seem to have this implemented. Is it possible to do?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Total Discount: {{ cart.totalDiscount|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Total Shipping: {{ cart.totalShippingCost|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Total Tax: {{ cart.totalTax|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Total Tax (inc): {{ cart.totalTaxIncluded|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Item Total: {{ cart.itemTotal|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Base Discount: {{ cart.baseDiscount|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;  Base Shipping Cost: {{ cart.baseShippingCost|currency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-09T00:07:08.280" Title="Craft Commerce: Sub total before tax in cart?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15532" PostTypeId="2" ParentId="15527" CreationDate="2016-06-16T16:07:21.037" Score="2" Body="&lt;p&gt;It would appear not unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's &lt;code&gt;BaseRecord&lt;/code&gt; (which a &lt;code&gt;Record&lt;/code&gt; should inherit from) tries to uses the &lt;code&gt;primaryKey()&lt;/code&gt; method call to help create the table, but assumes a single column name is returned, not an Array and so falls over on the &lt;code&gt;isset&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$pk = $this-&amp;gt;primaryKey();&#xA;&#xA;if (isset($columns[$pk]))&#xA;{&#xA;  $columns[$pk]['primaryKey'] = true;&#xA;  $addIdColumn = false;&#xA;}&#xA;else&#xA;{&#xA;  $addIdColumn = true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it should work because the &lt;code&gt;CActiveRecord&lt;/code&gt; (which the &lt;code&gt;BaseRecord&lt;/code&gt; inherits from) states in it's comments for PrimaryKey:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@return mixed the primary key of the associated database table.&#xA;&#xA;If the key is a composite one consisting of several columns, it should&#xA;return the array of the key column names.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: In the end I added the following to my Plugin file, and that seemed to do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterInstall()&#xA;{&#xA;  craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;dropColumn('myplugin_merchant_order', 'id');&#xA;  craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;addPrimaryKey('myplugin_merchant_order', ['merchant_id', 'order_id']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also had to add this to my Record, to stop the validation failing because I'd removed the &lt;code&gt;id&lt;/code&gt; column in the above step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function primaryKey()&#xA;{&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2016-06-17T12:38:20.643" LastActivityDate="2016-06-17T12:38:20.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15533" PostTypeId="2" ParentId="15522" CreationDate="2016-06-16T18:44:20.210" Score="4" Body="&lt;p&gt;Not as of &lt;a href=&quot;https://craftcms.com/changelog#build2791&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2791&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's a requirement for you, you can not use that tag and put a block in your footer and manually create the script tag with &lt;code&gt;async defer&lt;/code&gt; set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-16T18:44:20.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15534" PostTypeId="2" ParentId="15530" CreationDate="2016-06-16T18:54:26.153" Score="1" Body="&lt;p&gt;According to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15383/how-to-attach-an-order-pdf-in-an-order-confirmation-email/15417#15417&quot;&gt;How to attach an order PDF in an order confirmation email?&lt;/a&gt;, it is currently not natively possible as of Craft Commerce 1.1.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-16T18:54:26.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15535" PostTypeId="1" AcceptedAnswerId="15536" CreationDate="2016-06-16T19:34:26.550" Score="4" ViewCount="925" Body="&lt;p&gt;So I finally am climbing on board the Craft CMS train, but I have a quick question about how some of you more seasoned Craft-users do things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do a lot of my work using the Foundation framework (by ZURB) for a lot of reasons, but I want to know if there is a &quot;best way&quot; to include the front-end framework with Craft. I've never really used a CMS before, so this isn't really a familiar territory for me at all. I haven't found any good guides online as of yet detailing how to do this with Foundation 6, so I figured this would be the next best place to turn! If someone who knows more than me could walk me through the process to mesh these two awesome elements together, that would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5293" LastEditorUserId="22" LastEditDate="2017-05-09T21:47:20.723" LastActivityDate="2017-05-09T21:47:20.723" Title="Using Craft CMS with Foundation 6 (for Sites)" Tags="&lt;frontend&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15536" PostTypeId="2" ParentId="15535" CreationDate="2016-06-16T19:41:32.813" Score="4" Body="&lt;p&gt;Craft is completely &quot;BYO HTML&quot;, so there is no magic in making Foundation work with Craft, unlike lesser CMSes that force their own HTML on you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add your stylesheet links and script tags to your main base HTML wrapper and have fun building!&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-06-16T19:41:32.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15537" PostTypeId="2" ParentId="15531" CreationDate="2016-06-16T21:06:55.033" Score="5" Body="&lt;p&gt;As of &lt;a href=&quot;https://craftcommerce.com/changelog#build1212&quot; rel=&quot;nofollow&quot;&gt;Commerce 1.1.1212&lt;/a&gt;, &lt;code&gt;cart.itemSubtotalWithSale&lt;/code&gt; is deprecated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;{{ cart.itemSubtotal|currency(cart.currency) }}&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strike&gt;&lt;code&gt;{{ cart.itemSubtotalWithSale|currency(cart.currency) }}&lt;/code&gt;&lt;/strike&gt;&lt;/p&gt;&#xA;" OwnerUserId="5168" LastEditorUserId="1016" LastEditDate="2016-07-09T00:07:08.280" LastActivityDate="2016-07-09T00:07:08.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15538" PostTypeId="2" ParentId="13985" CreationDate="2016-06-16T21:19:28.877" Score="3" Body="&lt;p&gt;I did end up opening a support ticket with Craft- they immediately suggested that this could be caused by a firewall. To which I scoffed! But after talking with some other folks in the office, this seems to be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately we never found a firewall solution to this problem. What &lt;em&gt;did&lt;/em&gt; work was to assign a static IP to my computer that bypasses the http-proxy packet filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yeah. Firewall. Dang.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2016-06-16T21:19:28.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15539" PostTypeId="2" ParentId="15535" CreationDate="2016-06-17T00:21:22.113" Score="2" Body="&lt;p&gt;Patrick is right that Craft let's you do what you wish in your HTML templates. I think it's worth adding a small distinction to where you store your front-end assets as there are two possible locations with slightly different behavior:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Craft templates folder &lt;code&gt;craft/templates/...&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Public folder (i.e. &lt;code&gt;public/...&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example folder structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/app&#xA;craft/storage&#xA;craft/templates (#1)&#xA;public/... (#2)&#xA;public/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Most of your page templates will probably be managed in the first location – your Craft templates folder. If you wanted to, you could put your css and js assets in that folder too (&lt;code&gt;craft/templates/assets/css&lt;/code&gt;, etc.).  Craft will serve your &lt;code&gt;.css&lt;/code&gt; and &lt;code&gt;.js&lt;/code&gt; as the correct file types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, any files that are being served from the Craft templates folder come with the overhead of being routed through Craft's index.php file and being processed by Craft, before they get delivered to the browser.  This can be fine, and gives you an option to use Twig in your css or js templates if you really want to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most static css and js files, this probably isn't necessary. And linking to the files in the Craft templates folder incurs unnecessary overhead.  Your css and js files will also work fine if you link to them in your public folder.  A resource request will first check to see if the file exists in your public folder and, if a match is found, that resource will be returned to the browser immediately without ever hitting Craft's &lt;code&gt;index.php&lt;/code&gt; file and spinning up Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common setups that I have seen on Craft websites follow a pattern like the following, where css, js and other static files are linked to in the public folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/app&#xA;craft/storage&#xA;craft/templates/... (dynamic templates that needs to be processed by Craft)&#xA;public/assets/... (static stuff that doesn't need to be processed by Craft)&#xA;public/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Craft docs on &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;Routing&lt;/a&gt; are a good place to get an overview of how a request is routed.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-17T00:21:22.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15540" PostTypeId="1" CreationDate="2016-06-17T05:12:51.783" Score="3" ViewCount="915" Body="&lt;p&gt;Is there any way to add &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; tags to Redactor II or the Redactor I plugin - would like to upgrade a site to latest version of Craft which had Redactor I and the &lt;a href=&quot;https://github.com/aelvan/RedactorStyles-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aelvan/RedactorStyles-Craft&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site has some tags like &lt;code&gt;&amp;lt;span class=&quot;blue-color&quot;&amp;gt;&lt;/code&gt; etc.&lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="1098" LastEditDate="2016-06-17T06:57:47.833" LastActivityDate="2016-08-01T05:07:40.793" Title="Use &lt;span&gt; in Redactor" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15541" PostTypeId="2" ParentId="15520" CreationDate="2016-06-17T07:18:07.810" Score="5" Body="&lt;p&gt;I figured it out, didn't realise all I had to do was pass array like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;address = array('lat' =&amp;gt; $lat, 'lng' =&amp;gt; $lng, 'street1' =&amp;gt; $street1, 'zip' =&amp;gt; $postcode);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="590" LastActivityDate="2016-06-17T07:18:07.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15542" PostTypeId="1" CreationDate="2016-06-17T08:19:48.220" Score="2" ViewCount="192" Body="&lt;p&gt;i am new to craft.&#xA;Is there a connection between the control panel sorting setting for structure entries and the template output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('projects') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Changing sort method in control panel should leads to different outputs in template. Is that right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Goal is to output entries in sort order related to control panel sort settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did i do wrong?&lt;/p&gt;&#xA;" OwnerUserId="5295" LastEditorUserId="142" LastEditDate="2016-06-17T10:41:28.200" LastActivityDate="2016-06-20T07:50:37.810" Title="Control Panel, sorting issue" Tags="&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15543" PostTypeId="1" CreationDate="2016-06-17T08:22:15.580" Score="3" ViewCount="420" Body="&lt;p&gt;I'm using fancyBox (from fancyApps, &lt;a href=&quot;http://fancyapps.com/fancybox/&quot; rel=&quot;nofollow&quot;&gt;http://fancyapps.com/fancybox/&lt;/a&gt;), and I need to wrap my images added within the Redactor rich text field with a link that had an href to the image source + some attributes as parameters :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;an href attribute to specify the image source to open&lt;/li&gt;&#xA;&lt;li&gt;a data-fancybox-group attribute to specify in which gallery the image&#xA;should open&lt;/li&gt;&#xA;&lt;li&gt;a title attribute to specify the image title in the fancyBox)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tried to add formatting tags to Redactor (cf. &lt;a href=&quot;https://imperavi.com/redactor/examples/formatting-add/&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/examples/formatting-add/&lt;/a&gt;) which let me add links with .fancybox class, but there's still missing parameters that are required to open the fancyBox that I'm not sure that can be retrieved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;fancybox&quot;: {&#xA;    &quot;title&quot;: &quot;Add fancyBox link&quot;,&#xA;    &quot;args&quot;: [&quot;a&quot;, { &quot;data-fancybox-group&quot;: &quot;images-gallery&quot;, &quot;class&quot;: &quot;fancybox&quot; }]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried the Retcon plugin (&lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/RetconHTML-Craft&lt;/a&gt;) which is very cool and lets me automatically wrap each image with a link with data-fancybox-group but I still can't retrieve and apply the img src + title to the link.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | retconWrap( 'img', 'a.fancybox') | retconAttr('.fancybox', { 'href':'', 'data-fancybox-group':'images-gallery' }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is there a way to achieve this with one of this two methods ? Or to do this in another way ? This should be very easy for the end user which is a non-programmer.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="125" LastEditDate="2016-06-17T08:58:37.560" LastActivityDate="2016-06-28T14:59:28.703" Title="Using the Redactor rich text field, how can I dynamically wrap my images with a fancyBox link (with attributes as parameters)?" Tags="&lt;redactor&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15544" PostTypeId="2" ParentId="15491" CreationDate="2016-06-17T08:33:45.813" Score="5" Body="&lt;p&gt;I found the solution: The moveFiles function provide the function to move a file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA;* Move or rename files.&#xA;*&#xA;* @param        $fileIds&#xA;* @param        $folderId&#xA;* @param string $filename If this is a rename operation or not.&#xA;* @param array  $actions  Actions to take in case of a conflict.&#xA;*&#xA;* @throws Exception&#xA;* @return bool|AssetOperationResponseModel&#xA;*/&#xA;&#xA;public function moveFiles($fileIds, $folderId, $filename = '', $actions = array())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So for me the following code works to move the file with the id 21 to the folder with the id 3: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;assets-&amp;gt;moveFiles([21], 3,'', &quot;keepBoth&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-06-17T08:33:45.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15546" PostTypeId="2" ParentId="15542" CreationDate="2016-06-17T11:20:57.820" Score="2" Body="&lt;p&gt;No – whatever you've currently set as the sorting order (Structure, Post Date, Expiry Date, etc) in the &lt;a href=&quot;https://pixelandtonic.com/content/blog/2015-11/customized-entry-index.jpg&quot; rel=&quot;nofollow&quot;&gt;element index&lt;/a&gt; in the control panel &lt;strong&gt;has absolutely no effect&lt;/strong&gt; on how your entries are output in a template, or how they're ordered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Structure sections, the default sorting order in a template is &lt;em&gt;Structure&lt;/em&gt;, i.e. hierarchical:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('myStructureSection') %}&#xA;    {# Will output entries in hierarchical, chronological order #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that if your Structure has multiple levels, i.e. child entries, you'll have to jump through a few hoops – using the &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt; tag is recommended as its able to output child entries recursively, e.g:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in entries %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, if you want to output the entries in a non-hierarchical order, you can use the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;order&lt;/code&gt;&lt;/a&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('myStructureSection').order('postDate desc') %}&#xA;    {# Will output newest first #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-17T11:20:57.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15548" PostTypeId="1" AcceptedAnswerId="15555" CreationDate="2016-06-17T16:35:32.173" Score="1" ViewCount="639" Body="&lt;p&gt;I'm writing a plugin for Craft Commerece that performs action on &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to check the value of product custom field (Matrix) in order to determine action parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use &lt;code&gt;$lineItem-&amp;gt;purchasable-&amp;gt;product-&amp;gt;myCustomFieldHandle&lt;/code&gt;, but this returns me &lt;code&gt;ElementCriteriaModel&lt;/code&gt; without any data entered for product in this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to get actual data saved in custom field for product?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-06-18T06:15:41.580" Title="Get product custom fields in plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15549" PostTypeId="1" CreationDate="2016-06-17T18:48:05.247" Score="2" ViewCount="294" Body="&lt;p&gt;I have a channel which is basically a list of articles. Each article is associated with one or more companies. When I click on companies I want to show all  the articles related to the company. I got that working, but now I want to show all the articles which have download types inside of them. So I had created a Matrix field type. I want to search for articles which will return all the articles which have those and then exclude them from other list which won't have any download association. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this doable?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-11-25T16:18:33.720" Title="How to get data from Matrix field type?" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15551" PostTypeId="1" AcceptedAnswerId="15562" CreationDate="2016-06-17T21:23:53.847" Score="2" ViewCount="391" Body="&lt;p&gt;The development site works locally, but on a live hosted server the admin CSS is missing. The admin JS shows up. The public-facing site works fine on the live server and I can log in to the admin area, but with the admin CSS missing, the admin area is nearly useless. A few potentially useful pieces of information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I followed the Craft &quot;Troubleshooting Missing CSS/JS in the Control Panel&quot; instructions  and verified that zlib.output_compression is disabled.&lt;/li&gt;&#xA;&lt;li&gt;The generated CSS links from the admin area look like they should work, especially since the JS links do work. &lt;/li&gt;&#xA;&lt;li&gt;I'm running PHP 7.0.0 locally, using MAMP.&lt;/li&gt;&#xA;&lt;li&gt;The hosting company, Nexcess, is running PHP 7.0.6 on my account.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm stumped as to why this is happening or how to troubleshoot it.&lt;/p&gt;&#xA;" OwnerUserId="3391" LastEditorUserId="3391" LastEditDate="2016-06-19T15:34:46.143" LastActivityDate="2016-06-19T23:37:34.350" Title="Admin CSS missing from hosted site" Tags="&lt;control-panel&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15554" PostTypeId="2" ParentId="15511" CreationDate="2016-06-18T04:58:06.100" Score="1" Body="&lt;p&gt;You can listen for the &lt;code&gt;beforeSave&lt;/code&gt; event, but by redirecting or rendering another template, you're essentially hijacking the request and cancelling the initial save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could fork the plugin and add some custom logic using a flag you can tell whether it's an initial save and to redirect, or it's a subsequent save and to continue processing as normal.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-18T04:58:06.100" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15555" PostTypeId="2" ParentId="15548" CreationDate="2016-06-18T05:59:40.360" Score="1" Body="&lt;p&gt;I am pretty sure it's the same for a product as it is for any other Craft element, like an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get simple fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$lineItem-&amp;gt;purchasable-&amp;gt;product-&amp;gt;myCustomFieldHandle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To handle matrix fields, just loop through the matrix blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixBlocks = $lineItem-&amp;gt;purchasable-&amp;gt;product-&amp;gt;matrixFieldHandle; &#xA;foreach ($matrixBlocks as $block){&#xA;    echo $block-&amp;gt;id;&#xA;    echo $block-&amp;gt;fieldHandle;&#xA;    if ($block-&amp;gt;fieldHandle == &quot;whatever&quot;){&#xA;          etc&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Certainly that works with SuperTable fields on a product, pretty sure it's the same with matrix fields.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2016-06-18T06:15:41.580" LastActivityDate="2016-06-18T06:15:41.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15556" PostTypeId="2" ParentId="15511" CreationDate="2016-06-18T19:19:23.167" Score="1" Body="&lt;p&gt;Not a Craft specific answer but you could use JS to prevent the form from submitting, and instead save those values in a cookie. After doing so, redirect the user to the review page, and use the cookie values to fill out a hidden form (all hidden except the submit/confirm button, of course).&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-06-18T19:19:23.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15557" PostTypeId="2" ParentId="15082" CreationDate="2016-06-19T00:43:16.757" Score="1" Body="&lt;p&gt;It appears now that this is an issue with the plugin being unable to read attributes of a node which has sub-nodes. The developer has noted this, and will hopefully post a fix. In the meantime as work around I used a short php script on the server to call the XML file first and rework the data into a format that the plugin can read.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2016-06-19T00:43:16.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15558" PostTypeId="1" AcceptedAnswerId="15622" CreationDate="2016-06-19T06:06:54.183" Score="1" ViewCount="171" Body="&lt;p&gt;Is there a way to omit index.php from the URL when using IIS server? Adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;seems to break the site (except for the front page). index.php is removed from the menu links, but when called the sub-pages result in a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first Craft site on IIS, and I have no experience with IIS. It is the client choice unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2016-07-22T21:10:27.927" Title="Omit index.php from URL on IIS" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15560" PostTypeId="1" AcceptedAnswerId="15561" CreationDate="2016-06-19T11:27:39.780" Score="4" ViewCount="339" Body="&lt;p&gt;I have 2 separate plugins that listen to same event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to make sure Plugin B starts its action only after Plugin A has finished its job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way in Craft CMS to set priority / execution order for plugins that listen to same event?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-06-20T10:17:24.477" Title="Set execution order of plugins listening to same event" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15561" PostTypeId="2" ParentId="15560" CreationDate="2016-06-19T18:47:37.830" Score="5" Body="&lt;p&gt;Not really – there's no priority system built into events for Craft or Yii.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;The easy way out is taking advantage of the fact that Craft actually loads plugins alphabetically, by name (i.e. the string returned by the plugins' &lt;code&gt;getName()&lt;/code&gt; method). This means that if your plugins are in fact named &quot;Plugin A&quot; and &quot;Plugin B&quot;, then Plugin A will be loaded before Plugin B and you can be sure that its event listener is also attached earlier, meaning that – in theory, I haven't tested this – it's event listener should also be called before Plugin B's event listener.&lt;/s&gt;&#xA;&lt;strong&gt;Edit: This doesn't actually appear to work, at least not reliably.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the correct way to solve the issue is to write your code in a way that negates the need for sequentially dependent event handlers. One way to do this is to use &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8886/can-a-plugin-fire-a-custom-event?rq=1&quot;&gt;custom events&lt;/a&gt; – for instance, you could have Plugin A listen to the native &lt;code&gt;entries.saveEntry&lt;/code&gt; event, but have Plugin B listen to some custom event instead, where Plugin A fires the custom event after completing its work inside the &lt;code&gt;saveEntry&lt;/code&gt; handler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also consider dropping the event listener altogether for Plugin B, and just call one of its service methods directly from Plugin A's event listener (you can even pass in the event object if you need it):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Plugin A&#xA;craft()-&amp;gt;on('entries.saveEntry', function (Event $event)&#xA;{&#xA;    ...&#xA;    // Stuff happens, then let Plugin B do its thing&#xA;    $pluginB = craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginB');&#xA;    if ($pluginB) {&#xA;        craft()-&amp;gt;pluginB-&amp;gt;someMethodName($event);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond this, its hard to advise without seeing some code examples or a more elaborate use case.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-06-20T10:17:24.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15562" PostTypeId="2" ParentId="15551" CreationDate="2016-06-19T18:58:25.223" Score="3" Body="&lt;p&gt;A single line in my &lt;code&gt;gitignore&lt;/code&gt; file, &lt;code&gt;CSS&lt;/code&gt; was preventing the Admin CSS from deploying to the live server. While this problem isn't specific to Craft, I'm leaving it here in case others encounter the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That line only prevented &lt;em&gt;folders&lt;/em&gt; named CSS from deploying, which is why the public site CSS deployed without a problem, making the problem less obvious.&lt;/p&gt;&#xA;" OwnerUserId="3391" LastEditorUserId="1016" LastEditDate="2016-06-19T23:37:34.350" LastActivityDate="2016-06-19T23:37:34.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15563" PostTypeId="1" AcceptedAnswerId="15599" CreationDate="2016-06-19T19:47:42.537" Score="0" ViewCount="329" Body="&lt;p&gt;No chance to update on my local machine and on my live site.&#xA;On the staging site it works but that's the same server as the live site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've cleared the caches and checked the logs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Local there is only this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/06/19 19:41:01 [error] [application] Error in Craft\Et::phoneHome. Message: Cannot overwrite an existing license.key file.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I run the site in DEV Mode. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I'm a bit unhappy about it :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best&#xA;David&lt;/p&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="57" LastEditDate="2016-06-21T17:36:37.557" LastActivityDate="2016-06-21T17:39:57.573" Title="Craft is unable to determine if an update is available at this time" Tags="&lt;error&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15564" PostTypeId="2" ParentId="15408" CreationDate="2016-06-20T04:46:23.787" Score="3" Body="&lt;p&gt;Not sure the underlying cause, but clearing the &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; folder that both sites shared caused both sites to start working as expected.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-20T04:46:23.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15566" PostTypeId="1" AcceptedAnswerId="15567" CreationDate="2016-06-20T09:34:07.220" Score="2" ViewCount="367" Body="&lt;p&gt;I keep getting an error response for my test field for Charge. I've pretty closely followed the example just for testing and can't seem to get a successful charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting a hidden field for amount and planAmount to no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(1) {&#xA;  [&quot;errors&quot;]=&amp;gt;&#xA;  array(2) {&#xA;    [0]=&amp;gt;&#xA;    string(37) &quot;planAmount : Amount must be a number.&quot;&#xA;    [1]=&amp;gt;&#xA;    string(74) &quot;There was a problem with your details, please check the form and try again&quot;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Form:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; id=&quot;charge-form&quot; class=&quot;charge-form&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;charge/charge&quot;&amp;gt;&#xA;    {% set options = {&#xA;        'planAmount': 79,&#xA;        'planInterval': 'year',&#xA;        'planIntervalCount': 1,&#xA;        'planCurrency': 'aus',&#xA;        'actions': {&#xA;            'onSuccess': {&#xA;                'subscription': 'gold-membership'&#xA;            }&#xA;        }&#xA;    } %}&#xA;    {{ craft.charge.setPaymentOptions(options) }}&#xA;&#xA;    &amp;lt;div id=&quot;payment-errors&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;customerEmail&quot;&amp;gt;Receipt Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;customerEmail&quot; value=&quot;{{ charge is defined ? charge.customerEmail : currentUser ? currentUser.email }}&quot; id=&quot;customerEmail&quot;&amp;gt;&#xA;        {% if charge is defined %}{% for error in charge.getErrors('customerEmail') %}{{ error }}{% endfor %}{% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;cardNumber&quot;&amp;gt;Card Number&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; data-stripe=&quot;number&quot; placeholder=&quot;•••• •••• •••• ••••&quot; id=&quot;cardNumber&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label&amp;gt;&#xA;            &amp;lt;span&amp;gt;Expiration (MM/YY)&amp;lt;/span&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; size=&quot;2&quot; data-stripe=&quot;exp_month&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;        &amp;lt;span&amp;gt; / &amp;lt;/span&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; size=&quot;2&quot; data-stripe=&quot;exp_year&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;cardCvc&quot;&amp;gt;Card CVC&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; data-stripe=&quot;cvc&quot; placeholder=&quot;123&quot; id=&quot;cardCvc&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Upgrade&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS:&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Stripe.setPublishableKey(this.s.publicKey.test);&#xA;$(window).charge(this.s.form);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5302" LastActivityDate="2016-06-20T19:49:33.100" Title="Unable to set planAmount for Charge 2 - Stripe" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15567" PostTypeId="2" ParentId="15566" CreationDate="2016-06-20T10:39:47.487" Score="4" Body="&lt;p&gt;Developer of &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This error is because you're passing an &lt;strong&gt;invalid currency code&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're passing &lt;code&gt;aus&lt;/code&gt; as the planCurrency, but need to be passing &lt;code&gt;aud&lt;/code&gt; for Australian Dollars. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under the hood, Charge is seeing that currency code as invalid, and unsetting the amount from the request, which is why that error is showing up on the planAmount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Charge unsets the amount as a safety mechanism to prevent the request falling back and processing in the default currency)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll update the language of the error to make it clearer the currency code is the invalid value in an upcoming release. &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-06-20T19:49:33.100" LastActivityDate="2016-06-20T19:49:33.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15568" PostTypeId="1" CreationDate="2016-06-20T11:33:49.263" Score="1" ViewCount="500" Body="&lt;p&gt;I'm currently seeing this in the PHP error logs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Uncaught exception 'Craft\\HttpException' with message '' in&#xA;/home/vagrant/htdocs/site/craft/app/controllers/TemplatesController.php:59\nStack&#xA;trace:\n#0 (): Craft\\TemplatesController-&amp;gt;actionRender()\n#1&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/actions/CAction.php(109):&#xA;ReflectionMethod-&amp;gt;invokeArgs()\n#2&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/actions/CInlineAction.php(47):&#xA;CAction-&amp;gt;runWithParamsInternal()\n#3&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/CController.php(308):&#xA;CInlineAction-&amp;gt;runWithParams()\n#4&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/CController.php(286):&#xA;CController-&amp;gt;runAction()\n#5&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/CController.php(265):&#xA;CController-&amp;gt;runActionWithFilters()\n#6&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/CWebApplication.php(284):&#xA;CController-&amp;gt;run()\n#7&#xA;/home/vagrant/htdocs/site/craft/app/framework/web/CWebApplication.php(141):&#xA;CWebApplication-&amp;gt;runController()\n#8&#xA;/home/vagrant/htdocs/site/craft/app/etc/web/WebApp.php(288):&#xA;CWebApplication-&amp;gt;processRequest()\n#9&#xA;/home/vagrant/htdocs/site/craft/app/framework/base/CApplication.php(185):&#xA;Craft\\WebApp-&amp;gt;processRequest()\n#10&#xA;/home/vagrant/htdocs/site/craft/app/index.php(62):&#xA;CApplication-&amp;gt;run()\n#11&#xA;/home/vagrant/htdocs/site/public/index.php(19): include()\n#12 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;_404.html&lt;/code&gt; template under &lt;code&gt;templates/&lt;/code&gt; and the &lt;code&gt;errorTemplatePrefix&lt;/code&gt; set to &lt;code&gt;_&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5304" LastEditorUserId="5275" LastEditDate="2019-06-27T18:25:11.417" LastActivityDate="2019-06-27T18:25:11.417" Title="Why is Craft rendering a blank page instead of an error template?" Tags="&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15571" PostTypeId="1" CreationDate="2016-06-20T12:52:35.363" Score="0" ViewCount="473" Body="&lt;p&gt;I know that others have had issues with transforms and GIFs, but I wanted to post a question as I am running pretty up-to-date versions of everything, which to my understand should mean transforming GIFs should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server is running on PHP 7.0.7 and this is the ImageMagick set up:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1RuCH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1RuCH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the control panel, there is no preview for GIFs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RP6Uv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RP6Uv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when trying to transform the image on the template, it is being changed into a static image with only the first frame showing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another setting I need to look at changing?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2016-06-20T12:52:35.363" Title="GIFs aren't being transformed" Tags="&lt;image-transforms&gt;&lt;gif&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15572" PostTypeId="1" AcceptedAnswerId="15574" CreationDate="2016-06-20T13:04:59.943" Score="1" ViewCount="79" Body="&lt;p&gt;Craft &lt;code&gt;n00b&lt;/code&gt; here. Really loving it so far, but am wondering if how I'm implementing this is the best option, or if maybe there's a more sophisticated solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside our content builder switch statement, I'd like to provide my client with the ability to build an image-and-text block wherein they can change the widths of the columns via a dropdown (&lt;code&gt;columnWidth&lt;/code&gt;), which will then set the widths of the children. Here's what I have so far, but it seems a little inelegant, especially if I were to do more options or columns. Any pointers or is this the best way to handle this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if content.columnWidth == &quot;1-2&quot; %}&#xA;  {% set columnOneWidth = &quot;1-of-3&quot; %}&#xA;  {% set columnTwoWidth = &quot;2-of-3&quot; %}&#xA;{% elseif content.columnWidth == &quot;1-1&quot; %}&#xA;  {% set columnOneWidth = &quot;1-of-2&quot; %}&#xA;  {% set columnTwoWidth = &quot;1-of-2&quot; %}&#xA;{% elseif content.columnWidth == &quot;2-1&quot; %}&#xA;  {% set columnOneWidth = &quot;2-of-3&quot; %}&#xA;  {% set columnTwoWidth = &quot;1-of-3&quot; %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;column-{{ content.columnOneWidth }}&quot;&amp;gt;&#xA;    [...]&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;column-{{ content.columnTwoWidth }}&quot;&amp;gt;&#xA;    [...]&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5272" LastActivityDate="2016-06-20T13:48:29.760" Title="DRYer way to set column widths than with if statement?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15573" PostTypeId="1" AcceptedAnswerId="15585" CreationDate="2016-06-20T13:36:31.470" Score="1" ViewCount="776" Body="&lt;p&gt;If 2 or more people are editing a entry at the same time in Craft, the last person to save the entry overrides everyone else's work. It doesn't seem any diffing is involved to resolve this. I'm using matrix fields mostly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WordPress handles it by locking a post while someone is editing. This is done by sending an AJAX request to the server when auto saving, updating the &quot;last edited&quot; date and which user is editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if a plugin exists already for Craft that implements this post locking feature? Or is there something already in Craft to avoid these conflicts?&lt;/p&gt;&#xA;" OwnerUserId="3464" LastEditorUserId="3464" LastEditDate="2016-06-20T13:58:39.060" LastActivityDate="2016-06-20T17:18:45.403" Title="How to handle multiple users simultaneously editing an entry?" Tags="&lt;entries&gt;&lt;users&gt;&lt;admin&gt;&lt;saveentry&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15574" PostTypeId="2" ParentId="15572" CreationDate="2016-06-20T13:48:29.760" Score="4" Body="&lt;p&gt;One way to make it a bit more DRY and flexible is to use the &lt;code&gt;split&lt;/code&gt; filter to create an array of column widths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can save a bit of markup by calculating the total number of columns, and using a &lt;code&gt;for&lt;/code&gt; loop to output the actual column DOM nodes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set columns = content.columnWidth|default('1-2')|split('-') %}&#xA;{% set totalColumns = columns[0] + columns[1] %}&#xA;&#xA;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    {% for column in columns %}&#xA;        &amp;lt;div class=&quot;column-{{ column }}-of-{{ totalColumns }}&quot;&amp;gt;&#xA;           [...]&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-20T13:48:29.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15575" PostTypeId="2" ParentId="15568" CreationDate="2016-06-20T13:53:18.950" Score="1" Body="&lt;p&gt;Turns out it was HHVM causing the issue. Switching back to 'normal' PHP made the problem disappear.&lt;/p&gt;&#xA;" OwnerUserId="5304" LastActivityDate="2016-06-20T13:53:18.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15576" PostTypeId="1" AcceptedAnswerId="15611" CreationDate="2016-06-20T14:07:58.157" Score="2" ViewCount="424" Body="&lt;p&gt;When importing local user assets to a development server with sftp (including a database import), some of the assets are missing (it gives the impression to be random). Even after updated the indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F2XDU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F2XDU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to access them directly in the browser, I get a Page not Found, but they are well present on the server, within the same folder/name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How It is possible ?&lt;/p&gt;&#xA;" OwnerUserId="5263" LastEditorUserId="5263" LastEditDate="2016-06-22T09:40:58.877" LastActivityDate="2016-06-22T09:40:58.877" Title="Assets Images not being found" Tags="&lt;assets&gt;&lt;image&gt;&lt;import&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15577" PostTypeId="1" AcceptedAnswerId="15594" CreationDate="2016-06-20T15:05:49.887" Score="2" ViewCount="404" Body="&lt;p&gt;I run Craft Commerce and want people to get certain items for free, but still pass them through Commerce order system (in order to collect the emails and also perform some automation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically they enter code and get 100% discount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if the person has ONLY free item in their cart, I don't want to ask them for credit card data or send to payment gateway. I want to just authorize the 'payment' of $0.00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could use some template logic and use Manual or Dummy gateway, but I'm afraid some people will try to fool the system, so I want to make sure the 'free' gateway only works if order total is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know some plugin / custom gateway that I could use here?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-06-21T09:00:45.160" Title="Free orders with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15578" PostTypeId="1" CreationDate="2016-06-20T15:25:31.800" Score="0" ViewCount="146" Body="&lt;p&gt;I'm using the lovely &quot;Imager&quot; plugin to produce a srcset of images, however it seems to only produce one size of image, which isn't really what i was expecting!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.image.first() %}&#xA;{% set transformedImages = craft.imager.transformImage(image, [&#xA;    { width: 1370, height: 600 },&#xA;    { width: 1000 },&#xA;    { width: 800 },&#xA;    { width: 600, jpegQuality: 65 },&#xA;    { width: 400, jpegQuality: 65 }&#xA;], { position: image.focalPoint, mode: 'crop', jpegQuality: 80 }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have i missed something here?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-06-20T19:20:41.817" Title="Imager plugin using it's transformImage method doesn't produce correctly resized images" Tags="&lt;image-transforms&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15580" PostTypeId="1" CreationDate="2016-06-20T15:34:35.470" Score="2" ViewCount="457" Body="&lt;p&gt;I am not able to get User Registration to work properly using a frontend form from the Craft Docs (&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the particulars:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro Version = 2.6.2791&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users &gt; Settings has the ‘verify email addresses’ and ‘allow public registration’ boxes checked, and a default User group selected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I specified a redirect in craft &gt; config &gt; general to 'activateAccountSuccessPath' =&gt; 'registration-success',&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form submits and the user is created, but no verification email is sent and the user is not assigned to the group I selected in User Settings. If I manually send a verification email, following the link causes the user to be verified, but still not added to any Group. Further, the user is redirected to &lt;a href=&quot;http://sitename/dashboard&quot; rel=&quot;nofollow&quot;&gt;http://sitename/dashboard&lt;/a&gt;, despite having a redirect set in the Config &gt; General file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this on two different Craft sites, each on different hosts (one of which is Arcustech) and both of which are running the latest Craft release (2.6.2791).&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-02-11T03:37:25.703" Title="Multiple issues with User Registration from frontend" Tags="&lt;registration&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15581" PostTypeId="1" CreationDate="2016-06-20T15:46:50.610" Score="1" ViewCount="132" Body="&lt;p&gt;Some background information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use a Craft app that has several modular components that we've put into separate plugins. IE: a purchase plugin, &quot;logged in&quot; plugin, and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of breaking this very large app into multiple smaller Craft apps which would be able to be deployed independently to AWS instances. This way when we make a change to our Purchase flow we no longer need to redeploy the entire app /remove-headaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been looking around and haven't found much on terms of people doing this with Craft? The instances would all share the same database instance since we don't store any data in the database anyways so that wouldn't be an issue... but is it just as simple as including the /craft and /public folder on every instance? How would these apps access each other's functions? So if the Purchase Plugin needs to access something from the &quot;Logged in&quot; plugin on the other app it would need to be via HTTP request which would hit the other app's index.php and go from there? I guess we would need to build a gateway for these apps to speak to each other if we need to do cross-app talk?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I was thinking it would look like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remove &quot;Purchase plugin&quot; from the original repo.&lt;/li&gt;&#xA;&lt;li&gt;Create a new repo for purchase app&lt;/li&gt;&#xA;&lt;li&gt;Plug the &quot;Purchase plugin&quot; into the new app which only has the necessary folders for Craft to run. Ie: craft and public folders with only this one plugin.&lt;/li&gt;&#xA;&lt;li&gt;Create a gateway for requests coming from &quot;Logged in&quot; app and &quot;Purchase app&quot; to correctly direct to the other app for cross-talk. This would route purchase app requests to logged in app if/when it needs to access something. &lt;/li&gt;&#xA;&lt;li&gt;These craft instances would point to the same database that has data about all plugins. Or would it be better to each have it's own database? Is this something that would become hectic to maintain for business partners?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Essentially I'd be creating an &quot;API&quot; out of these two apps. They would both be ale to stand independently and the implementation can change for either one so long as it fulfills its contract. This would allow me to deploy them separately and have separate teams maintain them without worrying about something in one app being broken because of something in the other app being deployed.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="45" LastEditDate="2016-08-13T02:36:25.197" LastActivityDate="2016-08-13T02:36:25.197" Title="Breaking one large Craft app into multiple smaller apps" Tags="&lt;deployment&gt;&lt;bootstrap-craft&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15582" PostTypeId="1" CreationDate="2016-06-20T16:14:42.090" Score="3" ViewCount="746" Body="&lt;p&gt;I am looking for a solution that would allow me to sell events tickets within Craft. I'm am currently making a prototype with Craft Commerce plugin for this project, but I am already facing a major problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new product, I can set a ticket price + a total number of tickets available at this price. When using variants, I can define multiple tickets + a total of available tickets under each price. But it does not seems possible to synchronize a total number of available tickets with different price options (full price and other at reduced fare).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do ? Is it possible to set the total number of tickets available outside of variants, such as the variants would be only used to set the price ?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2016-06-20T17:47:49.807" LastActivityDate="2016-06-22T17:23:06.883" Title="Craft Commerce: How to manage different prices with one product?" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;&lt;events&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15583" PostTypeId="1" CreationDate="2016-06-20T16:38:21.110" Score="1" ViewCount="483" Body="&lt;p&gt;Typical scenario: users log in on the front-end and have a profile page where they can update their info, including changing their current password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have referenced this article from 2014 but it's not working for me; maybe it's outdated by now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4714/is-it-possible-to-change-a-users-password-in-the-front-end&quot;&gt;Is it possible to change a user&amp;#39;s password in the front-end?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that article I get:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User needs to be logged in&lt;/li&gt;&#xA;&lt;li&gt;User needs to submit their current password (input name=&quot;password&quot;)&lt;/li&gt;&#xA;&lt;li&gt;User needs to add a new password (input name=&quot;newPassword&quot;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've done all of this in my code and it does not work. For simplicity's sake, I've even copied and pasted the code from the link posted above but it does not work. I've created a fake user called &quot;Mister Test&quot; with a password of &quot;purple&quot;; if I try to change the password on the front end to something like &quot;test123&quot;, it does not redirect to my success url and does not change the password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what else to do. Not much coming up in google searches. My original code is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA;    {# redirecting to homepage just for testing #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;label for=&quot;currentPassword&quot;&amp;gt;{{ &quot;Current password&quot;|t }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;password&quot; name=&quot;password&quot; id=&quot;currentPassword&quot;&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;label for=&quot;newPassword&quot;&amp;gt;{{ &quot;New password&quot;|t }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;password&quot; name=&quot;newPassword&quot; id=&quot;newPassword&quot;&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;button class=&quot;btn&quot; type=&quot;submit&quot;&amp;gt;{{ &quot;Save&quot;|t }}&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-21T11:10:37.437" Title="Front end user profile: update password" Tags="&lt;frontend&gt;&lt;user-profile&gt;&lt;password&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15584" PostTypeId="1" AcceptedAnswerId="15588" CreationDate="2016-06-20T16:56:30.573" Score="2" ViewCount="211" Body="&lt;p&gt;I'm looking to hook into this somehow to adjust the title home page link in the top left corner of the admin pages to stop opening in a new tab. Anyone have any good solutions for removing the &lt;code&gt;target=&quot;_blank&quot;&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a sample of the code in question: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;topbar&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;site-name&quot; href=&quot;http://sitename.com/&quot; title=&quot;Site Homepage&quot; target=&quot;_blank&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;Site Name&amp;lt;/h2&amp;gt;&#xA;     &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5306" LastEditorUserId="45" LastEditDate="2016-08-13T02:34:23.250" LastActivityDate="2016-08-13T02:34:23.250" Title="Disabling the target=&quot;_blank&quot; on admin site title link" Tags="&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15585" PostTypeId="2" ParentId="15573" CreationDate="2016-06-20T17:18:45.403" Score="1" Body="&lt;p&gt;There currently isn't a native way to do this and I'm not aware of a plugin that's has the functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can semi-work around it with entry revisions, but if you think this should be a core feature you can &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/9009169-add-an-alert-or-warning-when-multiple-authors-are&quot; rel=&quot;nofollow&quot;&gt;vote for it&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-20T17:18:45.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15586" PostTypeId="2" ParentId="15583" CreationDate="2016-06-20T17:26:53.323" Score="1" Body="&lt;p&gt;Sounds like it might be a form submission issue rather than anything related to password /profile updates. I ran into a similar issue a while ago and resolved it by disabling Suhosin on my server. May want to give that a try.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2016-06-20T17:26:53.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15587" PostTypeId="2" ParentId="15580" CreationDate="2016-06-20T17:33:33.427" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The form submits and the user is created, but no verification email is sent and the user is not assigned to the group I selected in User Settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That sounds like there is a validation error is happening in your form on the UserModel.  Perhaps on a required custom field. You didn't share your form, but is it checking for errors?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I manually send a verification email, following the link causes the user to be verified, but still not added to any Group.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Make sure you're not running any plugins that might be interfering listening to the &lt;code&gt;onSaveUser&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Further, the user is redirected to &lt;a href=&quot;http://sitename/dashboard&quot; rel=&quot;nofollow&quot;&gt;http://sitename/dashboard&lt;/a&gt;, despite having a redirect set in the Config &gt; General file.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's a bug that's been fixed for the next (post &lt;a href=&quot;https://craftcms.com/changelog#build2791&quot; rel=&quot;nofollow&quot;&gt;2.6.2791&lt;/a&gt;) release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-20T17:33:33.427" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15588" PostTypeId="2" ParentId="15584" CreationDate="2016-06-20T17:40:56.960" Score="3" Body="&lt;p&gt;You can use the handy &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;Control Panel JS plugin&lt;/a&gt; and add some JS that targets the &lt;code&gt;site-name&lt;/code&gt; class on the anchor and removes it.  jQuery's &lt;a href=&quot;https://api.jquery.com/removeAttr/&quot; rel=&quot;nofollow&quot;&gt;removeAttr&lt;/a&gt; should do the trick.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-20T17:40:56.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15589" PostTypeId="2" ParentId="15581" CreationDate="2016-06-20T17:45:27.800" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The instances would all share the same database instance since we don't store any data in the database anyways so that wouldn't be an issue...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Brad or Brandon from P&amp;amp;T is probably going to chime in here with a better answer but it sounds like more trouble than it's worth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one thing, Craft relies on the database to determine if plugins are enabled or not. If your plugin is only &quot;enabled&quot; on one instance, the database is going to reflect that state. That sound likes a recipe for disaster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you make every piece self-contained, with multiple databases for each that &quot;talk&quot; to each via API like JSON or something else, you'll also have the problem of updating Craft's core files in multiple places whenever &lt;em&gt;Craft&lt;/em&gt; itself gets updated. Multiple that by how many instances you have to determine what factor of headache you want...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modularity is a good concept but it reads to me a bigger problem here is your deployment strategy and getting everyone on the same page as to what everyone should be working on, development wise. If one of your developers breaks the API for the other team that's calling it, you're just as screwed as before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your team is pushing up code that's broken, you want some way to revert back. That's true of any kind of system, modular or not. Small commits often. You might want to look at DeployBot or Capistrano or something else of that nature.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-06-20T17:50:33.433" LastActivityDate="2016-06-20T17:50:33.433" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15590" PostTypeId="1" CreationDate="2016-06-20T18:38:06.403" Score="2" ViewCount="2384" Body="&lt;p&gt;After setting an asset resource I am receiving the &quot;your source ' ' appears to be invalid.&quot; on the update indexes, and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error uploading the file: The file system path '{basePath}/assets/images/' set for this source does not exist.` on the assets upload page.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My file structure is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/&#xA;        craft/&#xA;        html/&#xA;            index.php&#xA;            assets/&#xA;                images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried all variations I can think of, ie: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}assets/images/&#xA;/assets/images/&#xA;/var/www/html/assets/images&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've ensured that the basepath is set correctly in &lt;code&gt;general.php&lt;/code&gt; and i've ensured that ownership of the folders is set correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is installed on a digital ocean lamp droplet running 14.04. general.php looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  // Use IP address of your droplet below&#xA;  'ip.address.of.droplet' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://ip.address.of.droplet/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; '/var/www/html/',&#xA;      'baseUrl'  =&amp;gt; 'http://ip.address.of.droplet/',&#xA;    )&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5307" LastEditorUserId="4466" LastEditDate="2016-06-21T10:19:59.083" LastActivityDate="2016-06-21T10:20:44.913" Title="Invalid asset source path" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15591" PostTypeId="2" ParentId="15578" CreationDate="2016-06-20T19:20:41.817" Score="2" Body="&lt;p&gt;Turns out google chrome dev tools was lying to me when i hovered over the images in a srcset and told me their natural size was different to their real size. All working grand!&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-06-20T19:20:41.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15592" PostTypeId="2" ParentId="15590" CreationDate="2016-06-20T22:26:27.263" Score="3" Body="&lt;p&gt;the &lt;code&gt;general.php&lt;/code&gt; file was setup for a multi environment but was missing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as per the notice here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{basePath}assets/images/&lt;/code&gt; was the correct file system path once the array had been added.&lt;/p&gt;&#xA;" OwnerUserId="5307" LastEditorUserId="4466" LastEditDate="2016-06-21T10:20:44.913" LastActivityDate="2016-06-21T10:20:44.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15593" PostTypeId="2" ParentId="15527" CreationDate="2016-06-21T03:50:46.277" Score="2" Body="&lt;p&gt;This should be fixed in the next (&lt;a href=&quot;https://craftcms.com/changelog#build2791&quot; rel=&quot;nofollow&quot;&gt;post 2.6.2791&lt;/a&gt;) release so that plugins can define composite primary keys in their records.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-21T03:50:46.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15594" PostTypeId="2" ParentId="15577" CreationDate="2016-06-21T09:00:45.160" Score="4" Body="&lt;p&gt;Since it looks like the solution does not exist yet, I ended up creating custom plugin/gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works same as Manual gateway with the only difference that it only approves free purchases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/intoeetive/freecheckout&quot; rel=&quot;nofollow&quot;&gt;https://github.com/intoeetive/freecheckout&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-06-21T09:00:45.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15595" PostTypeId="1" AcceptedAnswerId="15596" CreationDate="2016-06-21T14:35:37.113" Score="2" ViewCount="358" Body="&lt;p&gt;I am currently using Craft to manage only certain pages on a site. The static pages all end in &lt;code&gt;.html&lt;/code&gt; but Craft's pages don't. Is there a way to rewrite them via Craft to add &lt;code&gt;.html&lt;/code&gt; or do I have to do some &lt;code&gt;.htaccess&lt;/code&gt; wizardry? I only want to rewrite the pages and not the categories (for example, /news/).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can achieve this, should I? Are there enough SEO benefits to a consistent URL format? I've also read using &lt;code&gt;.htaccess&lt;/code&gt; in this way may affect SEO negatively, which is why I'm wondering if there's a way of doing it with Craft.&lt;/p&gt;&#xA;" OwnerUserId="5309" LastEditorUserId="1016" LastEditDate="2016-06-21T14:55:25.173" LastActivityDate="2017-04-07T05:02:34.273" Title="Adding .html to end of page url?" Tags="&lt;entries&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15596" PostTypeId="2" ParentId="15595" CreationDate="2016-06-21T15:26:58.943" Score="3" Body="&lt;p&gt;You can change your entry's URL format right inside Craft. It's under Settings -&amp;gt; Sections then choose the section you want.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/96PSp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/96PSp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Under URL Format, just add &lt;code&gt;.html&lt;/code&gt; after the &lt;code&gt;{slug}&lt;/code&gt;. In this example, I've also added the year that the entry was added to the URL as well and you can really make it whatever you want.&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;code&gt;.htaccesss&lt;/code&gt; you could also &lt;a href=&quot;https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url&quot;&gt;remove the &lt;code&gt;.html&lt;/code&gt;&lt;/a&gt; extension from the static pages too if you want to follow Craft's format (though be careful with that one).&lt;/p&gt;&#xA;&lt;h1&gt;SEO&lt;/h1&gt;&#xA;&lt;p&gt;As far as whether it's a good idea to do either for SEO purposes, you're going to get a lot of differing opinions. I'm a URL minimalist,  so I tend to keep my URLs simple, including removing &lt;code&gt;www&lt;/code&gt; from the hostname and removing any trailing slash from URLs if possible.&lt;/p&gt;&#xA;&lt;p&gt;Google tends to favor &lt;a href=&quot;http://backlinko.com/search-engine-ranking&quot; rel=&quot;nofollow noreferrer&quot;&gt;short URLs&lt;/a&gt; among other things but it's not a big factor.&lt;/p&gt;&#xA;&lt;p&gt;Content is content. Years ago, I remember there used to be some SEO benefit to adding &lt;code&gt;.html&lt;/code&gt; but if search engines can index it, it doesn't matter what the URL is.&lt;/p&gt;&#xA;&lt;p&gt;The bigger issue for me is any time you change a URL, you risk blowing something up. I'm always reminded of the saying &lt;a href=&quot;http://www.w3.org/Provider/Style/URI.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cool URLs don't change&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If your site has been around awhile,  I wouldn't mess with them. Other people may be linking to your pages and if you change the URLs, you'll want to put in 301 redirects—otherwise they'll 404, which is a much bigger problem.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-06-21T15:26:58.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15597" PostTypeId="1" AcceptedAnswerId="15598" CreationDate="2016-06-21T15:48:43.743" Score="1" ViewCount="188" Body="&lt;p&gt;I'm adding the following to my &lt;code&gt;_product.html&lt;/code&gt; template to try and add a number to a line item in the same way that notes are added. I'm using the following input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;number&quot; name=&quot;numberDistance&quot; step=&quot;any&quot; placeholder=&quot;Add your minimum distance in mm...&quot; id=&quot;distanceNum&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then add the following to my cart template to output the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Min distance: {{ item.numberDistance }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I add an item to my cart I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft\Commerce_LineItemModel and its behaviors do not have a method or closure named &quot;numberDistance&quot;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is going wrong and how do I fix this?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="4466" LastEditDate="2016-06-21T16:02:26.150" LastActivityDate="2016-06-21T16:07:01.933" Title="Craft Commerce: Adding Number fields to product and cart pages" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15598" PostTypeId="2" ParentId="15597" CreationDate="2016-06-21T16:00:11.753" Score="2" Body="&lt;p&gt;You will need to make use of lineitem &quot;options&quot; param. You can attach as many options as you like using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;number&quot; name=&quot;options[numberDistance]&quot; step=&quot;any&quot; placeholder=&quot;Add your minimum distance in mm...&quot; id=&quot;distanceNum&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then these will be avaliable on the lineItem once saved using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ item.options['numberDistance'] }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info can be found on the &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;nofollow&quot;&gt;Craft Commerce docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-21T16:07:01.933" LastActivityDate="2016-06-21T16:07:01.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15599" PostTypeId="2" ParentId="15563" CreationDate="2016-06-21T17:39:57.573" Score="3" Body="&lt;p&gt;You're getting that error message because there is an existing &lt;code&gt;craft/config/license.key&lt;/code&gt; file in place for your local installation and there is no record of that install on the Craft/web service end.  Likely you've just copied an existing &lt;code&gt;license.key&lt;/code&gt; file from another site into this new installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the web service on the Craft end thinks that since it's a new Craft client installation it needs to send down a new &lt;code&gt;license.key&lt;/code&gt; file for you to start using.  But the Craft client knows it should never overwrite an existing &lt;code&gt;license.key&lt;/code&gt; file, so it reports that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution: remove the existing &lt;code&gt;license.key&lt;/code&gt; file (since it probably belongs to another site anyway) and let the web service generate a new one for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-21T17:39:57.573" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15600" PostTypeId="1" AcceptedAnswerId="15604" CreationDate="2016-06-21T18:28:22.620" Score="1" ViewCount="455" Body="&lt;p&gt;After a logged-in user updates their profile on the front end, I'd like to redirect them to the same page but show a success message. I believe I can do this with &lt;code&gt;craft.request.getPost()&lt;/code&gt; but it's not working for me.  Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;test&quot; value=&quot;xyz&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set success = craft.request.getPost('test') %}&#xA;{% if success %}&#xA;    Success message&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see &quot;test&quot; in my dev tools network tab but can't seem to access it.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-06-21T19:58:20.253" Title="get post data after submitting User Profile Form for success message" Tags="&lt;form&gt;&lt;frontend&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15601" PostTypeId="1" CreationDate="2016-06-21T19:34:00.760" Score="2" ViewCount="162" Body="&lt;p&gt;Say, I want to validate an email address or a special URL e.g. YouTube URL, would I be able to use a custom plugin with the &lt;code&gt;guestEntries.beforeSave&lt;/code&gt; hook to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic hook call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'guestEntries.beforeSave', function(Event $event) {&#xA;    // Call custom validation here&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would I be able to setup a model with the method &lt;code&gt;defineAttributes&lt;/code&gt; and run that?&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2016-06-22T21:11:31.480" Title="Is it possible to use `guestEntries.beforeSave` to validate custom fields?" Tags="&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15602" PostTypeId="1" AcceptedAnswerId="15606" CreationDate="2016-06-21T19:51:13.143" Score="2" ViewCount="131" Body="&lt;p&gt;I'm trying to run a quick check to see if any of my user's data has changed before saving them. However, I'm running into a situation where I can &lt;strong&gt;only access the new data&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't tell if this is a bug, or simply a misunderstanding of how it works...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('users.beforeSaveUser', function(Event $event) {&#xA;&#xA;    // Only do this for existing users&#xA;    if(!$event-&amp;gt;params['isNewUser'])&#xA;    {&#xA;&#xA;        // Get ID of user about to be saved&#xA;        $userId = $event-&amp;gt;params['user']-&amp;gt;id;&#xA;&#xA;        // Look up existing user data&#xA;        $existing = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;        // Why does this contain the NEW data?&#xA;        Craft::dd($existing-&amp;gt;myField);&#xA;&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There may be a reasonable explanation as to why the pre-existing user data is not available. If that is the case, then &lt;strong&gt;how can I access the pre-existing data for this user?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-21T20:18:41.000" Title="`onBeforeSaveUser` - Access existing user data" Tags="&lt;events&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15604" PostTypeId="2" ParentId="15600" CreationDate="2016-06-21T19:58:20.253" Score="4" Body="&lt;p&gt;Not possible – any input values added to your profile editing form (such as &lt;code&gt;test&lt;/code&gt; in your case) will be included in the POST request to the &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;users/saveUser&lt;/code&gt;&lt;/a&gt; controller action, but they won't actually be included in the redirect request back to the page (or to whatever URL is in your form's hidden &lt;code&gt;redirect&lt;/code&gt; input).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround you can always check for the Flash notice that the UsersController sets after the user is successfully saved:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('notice') == 'User saved.'|t %}&#xA;    &amp;lt;p&amp;gt;Success message!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-21T19:58:20.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15605" PostTypeId="1" AcceptedAnswerId="15609" CreationDate="2016-06-21T20:15:20.847" Score="7" ViewCount="848" Body="&lt;p&gt;Within Craft, I am renaming the top-level entry URL format for a section from &lt;code&gt;legacy-subdirectory/{slug}&lt;/code&gt; to &lt;code&gt;new-subdirectory/{slug}&lt;/code&gt;. How do I redirect traffic from the legacy URL to the new format within Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware that I may use the rewrite rule within &lt;code&gt;.htaccess&lt;/code&gt; in exchange for a slight performance hit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteRule ^legacy-subdirectory/(.*)$ /new-subdirectory/$1 [R=301,NC,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would prefer handling this within Craft. As there is only one slug in which I need the redirect, I would prefer handling this without plug-ins.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastEditorUserId="1016" LastEditDate="2016-06-22T15:13:53.873" LastActivityDate="2016-06-22T15:13:53.873" Title="How do I redirect traffic from a legacy category URL to a new category URL?" Tags="&lt;redirect&gt;&lt;server&gt;&lt;apache&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15606" PostTypeId="2" ParentId="15602" CreationDate="2016-06-21T20:18:41.000" Score="3" Body="&lt;p&gt;Not totally sure, but I believe this may be because the UsersService actually caches UserModels fetched by &lt;code&gt;getUserById()&lt;/code&gt; locally in a private class variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using &lt;code&gt;getUserById()&lt;/code&gt;, try pulling the user with an ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existing = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User, array(&#xA;    'id' =&amp;gt; $userId,&#xA;))-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-21T20:18:41.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15607" PostTypeId="2" ParentId="15605" CreationDate="2016-06-21T20:28:51.347" Score="7" Body="&lt;p&gt;There are a few plugins which can handle this, but &lt;strong&gt;Retour&lt;/strong&gt; is the newest and shiniest!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/retour&quot;&gt;https://github.com/nystudio107/retour&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's from the same developer as SEOmatic... he puts a lot of love &amp;amp; attention into his plugins, so you know it's safe to rely on.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-21T20:28:51.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15608" PostTypeId="2" ParentId="10498" CreationDate="2016-06-21T22:14:40.727" Score="1" Body="&lt;p&gt;Relational field validation (entries, assets, tags, users, etc.) works the same on the front-end as any other custom field would.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have an Entries field with a handle &lt;code&gt;houseCollege&lt;/code&gt; on an entry and it's marked as required and there is nothing submitted on the front-end for it, then using the error macro you mentioned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would display any validation errors for that &lt;code&gt;houseCollege&lt;/code&gt; field with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {{ errorList(entry.getErrors('houseCollege')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the case of a missing required field, you'd get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;House College cannot be blank.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-21T22:14:40.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15609" PostTypeId="2" ParentId="15605" CreationDate="2016-06-21T23:01:59.413" Score="6" Body="&lt;p&gt;Craft has a &lt;a href=&quot;https://craftcms.com/docs/templating/redirect&quot;&gt;twig redirect tag&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to create a &quot;redirect&quot; template that handles redirects based on {slug} and/or url segments and then use Craft routes to direct &quot;legacy-subdirectory&quot; requests to your redirect template. I have not tested this. &lt;/p&gt;&#xA;" OwnerUserId="232" LastActivityDate="2016-06-21T23:01:59.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15610" PostTypeId="2" ParentId="15582" CreationDate="2016-06-22T07:42:14.823" Score="2" Body="&lt;p&gt;Craft Commerce support has answered to my question :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Currently Craft Commerce can not have a stock counter that covers more&#xA;  than one variant. The default product+variant system is not designed&#xA;  for tickets. We hope to see a ticket 'Purchasable' plugin in the&#xA;  future. You can request this feature &lt;a href=&quot;http://feedback.craftcms.com/forums/295386-commerce/filters/top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you have some plugin experience, you could get around this issue&#xA;  you described with a plugin that updates the stock of other variants&#xA;  when someone purchases a variant using the onOrderVariant event. You&#xA;  would likely need to know the relationships between SKUs for the&#xA;  different variants within your plugin, and deduct the stock from the&#xA;  related variants like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update('commerce_variants',&#xA;  ['stock' =&amp;gt; new \CDbExpression('stock - :qty', [':qty' =&amp;gt; $theQty ])],&#xA;  'id = :variantId',&#xA;  [':variantId' =&amp;gt; $variantId]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;Check out the &lt;a href=&quot;https://github.com/pixelandtonic/CommerceStockNotifier/blob/master/commercestocknotifier/CommerceStockNotifierPlugin.php&quot; rel=&quot;nofollow&quot;&gt;Stock Notifier plugin&lt;/a&gt; as it matches closely to the&#xA;  events you would need to use.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="131" LastEditorUserId="57" LastEditDate="2016-06-22T17:23:06.883" LastActivityDate="2016-06-22T17:23:06.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15611" PostTypeId="2" ParentId="15576" CreationDate="2016-06-22T09:36:52.703" Score="2" Body="&lt;p&gt;I found out that, somehow, the files and the foldernames containing special characters where not well handled (In my case, a lot of é and è).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing the special characters, and adding &lt;code&gt;'convertFilenamesToAscii' =&amp;gt; true&lt;/code&gt; to the general.php config file for future edition / creation / upload resolved this issue for me.&lt;/p&gt;&#xA;" OwnerUserId="5263" LastActivityDate="2016-06-22T09:36:52.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15612" PostTypeId="1" CreationDate="2016-06-22T10:28:24.940" Score="2" ViewCount="698" Body="&lt;p&gt;I want to set up a product filter system based on variants' tags. I encounter two difficulties. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Outputting all variants' tags from a group of products.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Relation does not work --&amp;gt;&#xA;{% set products = craft.commerce.products.type('Custom').find() %}&#xA;{% set variants = craft.commerce.variants.relatedTo(products) %} &#xA;&#xA;{% for pattern in craft.tags.group('patternSwatch').relatedTo(variants) %}&#xA;    &amp;lt;a href=&quot;?pattern={{ pattern.name | url_encode }}&quot;&amp;gt;{{ pattern.name }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;!-- This works but returns tags from ALL products' variants --&amp;gt;&#xA;{% for pattern in craft.tags.group('patternSwatch').relatedTo(craft.commerce.variants) %}&#xA;    &amp;lt;a href=&quot;?pattern={{ pattern.name | url_encode }}&quot;&amp;gt;{{ pattern.name }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Filter product based on the multiple variants' tags&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- This works, but what about filtering by multiple tags? --&amp;gt;&#xA;{% set pattern = craft.request.getParam('pattern') %}&#xA;{% set tag = craft.tags.group('patternSwatch').title(pattern).first() %}&#xA;{% set variants = craft.commerce.variants.relatedTo(tag) %}&#xA;&#xA;{% for v in variants %}&#xA;    {{ v.product.slug }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5009" LastEditorUserId="5009" LastEditDate="2016-06-23T01:56:23.000" LastActivityDate="2016-06-28T17:20:40.650" Title="Filter products by variants' tags" Tags="&lt;plugin-craftcommerce&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15613" PostTypeId="1" CreationDate="2016-06-22T12:57:49.920" Score="2" ViewCount="98" Body="&lt;p&gt;We migrated our dev-Website to the new server for launching the project. Everything works fine except Sprout Forms. We can't access the Plugins settings page in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error says &lt;code&gt;internal server error, the template „sproutforms/settings/general“ can't be found.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we call &lt;code&gt;craft.sproutForms.someFunction()&lt;/code&gt; in the template our front-end stops rendering. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="1064" LastEditorUserId="45" LastEditDate="2016-08-13T02:42:39.760" LastActivityDate="2016-09-12T03:22:39.390" Title="Sprout forms internal server error after migration" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15614" PostTypeId="1" CreationDate="2016-06-22T16:29:45.507" Score="1" ViewCount="137" Body="&lt;p&gt;This is a general SEO question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Wordpress you can create a page and define the permalink URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft I want to do something similar. I want to build the backend with a common sense structure, but then define friendly URLs after. Eg: a page could exist somewhere like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.com/holidays/french-river-cruises&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to define custom routing, so I could make the same page/post accessible on a more descriptive URL (for SEO reasons) to load the same page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.com/summer-cruises-in-france&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know you can play with routes, but in this case I don't see how it would work that was as the slug doesn't match the post. But could this be hardcoded somehow in the advanced routes file?&lt;/p&gt;&#xA;" OwnerUserId="4396" LastEditorUserId="57" LastEditDate="2016-06-22T17:30:34.967" LastActivityDate="2016-06-22T17:30:34.967" Title="Advanced routing descriptive URLs to certain pages/posts" Tags="&lt;routes&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15616" PostTypeId="2" ParentId="15614" CreationDate="2016-06-22T16:55:30.977" Score="2" Body="&lt;p&gt;So from an SEO perspective, the first URL is actually better, in that it provides even more context for the search engines to digest, index, and understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also bad from an SEO perspective to have two pages that have the same content.  As long as you include a canonical URL it won't really hurt you, but the only real benefit I see from using your second URL schema is that it's easier to type.  Which isn't really much of a concern these days imo.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-06-22T16:55:30.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15617" PostTypeId="2" ParentId="15613" CreationDate="2016-06-22T17:29:44.387" Score="1" Body="&lt;p&gt;It sounds like you're missing some necessary Sprout Forms files.  Maybe they weren't FTP/copied over to the new server properly or if you're deploying from Git, maybe there was a gitignore rule that they got caught up in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enable devMode, you'll probably get an error message on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, I'd grab a fresh copy of the plugin and replace the existing &lt;code&gt;craft/plugins/sproutforms&lt;/code&gt; folder with the new one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-22T17:29:44.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15618" PostTypeId="2" ParentId="15519" CreationDate="2016-06-22T17:31:48.030" Score="3" Body="&lt;p&gt;&lt;code&gt;product.variants&lt;/code&gt; just returns an actual array of the variants, not an ElementCriteriaModel. So you can’t chain on additional params like &lt;code&gt;order&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get variants using custom parameters, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variants = craft.commerce.variants({&#xA;    product: product,&#xA;    order: 'price asc'&#xA;}) %}&#xA;&#xA;{% for purchasable in variants %}&#xA;    // ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-06-22T17:31:48.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15620" PostTypeId="1" AcceptedAnswerId="15656" CreationDate="2016-06-22T18:24:02.167" Score="5" ViewCount="711" Body="&lt;p&gt;I am using the following code to save an asset that has been downloaded to the storage/runtime/temp directory from an external API&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $tempPath,&#xA;    $photo['FileName'],&#xA;    $folderId,&#xA;    AssetConflictResolution::Replace&#xA;);&#xA;&#xA;// if the response is a success, get the file id&#xA;if ($response &amp;amp;&amp;amp; $response-&amp;gt;isSuccess()) {&#xA;    $fileIds[] = $response-&amp;gt;getDataItem('fileId');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example &lt;code&gt;$photo[]&lt;/code&gt; array is the response from the api with all photo information. What I need to do is also save $photo['PhotoId'] to a field I have setup on the photo asset source in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't however find an example of how to achieve this. Does anyone know how?&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2016-06-27T10:20:34.533" Title="How to set a field of an asset from within a plugin" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15621" PostTypeId="1" AcceptedAnswerId="15629" CreationDate="2016-06-22T18:55:37.220" Score="2" ViewCount="532" Body="&lt;p&gt;I´m working on a new online shop and want to show the best sellers and the most viewed products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do with craft commerce? I guess so, since it´s a basic functionality, but I could not find how to do this in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks.&#xA;Sebastián.&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="45" LastEditDate="2016-08-13T02:35:12.410" LastActivityDate="2016-08-13T02:35:12.410" Title="Show the best sellers and the most visited products - Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15622" PostTypeId="2" ParentId="15558" CreationDate="2016-06-22T21:03:33.787" Score="1" Body="&lt;p&gt;I'm running the latest IIS 10 on Windows 10 and &quot;pretty URLs&quot; (i.e. &lt;code&gt;craft.dev/admin/dashboard&lt;/code&gt; worked out-of-the-box using Craft's stock &lt;code&gt;web.config&lt;/code&gt; file in the public HTML folder with no modifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd double check you've got that file in place and haven't made any modifications to it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-22T21:03:33.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15623" PostTypeId="2" ParentId="15601" CreationDate="2016-06-22T21:11:31.480" Score="1" Body="&lt;p&gt;The only model passed into the &lt;code&gt;guestEntries.beforeSave&lt;/code&gt; event and returns from it is Craft's &lt;a href=&quot;https://craftcms.com/classreference/models/EntryModel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;, so even if you create your own &lt;code&gt;MyEntryModel&lt;/code&gt; inside the event with it's own attributes and validation rules, there's not a clean way to return that model back to the controller to return to the template to display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest thing to do would be to fork the plugin and change &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/guestentries/controllers/GuestEntriesController.php#L175&quot; rel=&quot;nofollow&quot;&gt;GuestEntriesController&lt;/a&gt; so that's its using a custom &lt;code&gt;MyEntryModel&lt;/code&gt; that extends Craft's &lt;code&gt;EntryModel&lt;/code&gt; and adds it's additional attributes/validation rules as required.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-22T21:11:31.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15624" PostTypeId="1" AcceptedAnswerId="15626" CreationDate="2016-06-22T21:42:50.153" Score="1" ViewCount="592" Body="&lt;p&gt;Is it possible to include a Users Fields Type on a front end form? I'd like to allow people to choose existing users on a front end form rather than giving them access to the admin area of the Craft site. &lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-06-23T01:23:32.943" Title="Users fields on front end form" Tags="&lt;users&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15625" PostTypeId="2" ParentId="9255" CreationDate="2016-06-23T00:58:44.057" Score="3" Body="&lt;p&gt;I need it too and found this: &lt;a href=&quot;https://github.com/gregorterrill/gtpoll&quot; rel=&quot;nofollow&quot;&gt;https://github.com/gregorterrill/gtpoll&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps :)&lt;/p&gt;&#xA;" OwnerUserId="5179" LastActivityDate="2016-06-23T00:58:44.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15626" PostTypeId="2" ParentId="15624" CreationDate="2016-06-23T01:23:32.943" Score="0" Body="&lt;p&gt;Sure is!  You'll want to bookmark this &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow&quot;&gt;ridiculously handy page&lt;/a&gt;, but if you look under &quot;Relations&quot; you'll see the syntax you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select multiple name=&quot;fields[fieldHandle][]&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;13&quot;&amp;gt;Username One&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;42&quot;&amp;gt;Username Two&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;144&quot;&amp;gt;Username Three&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-23T01:23:32.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15627" PostTypeId="1" CreationDate="2016-06-23T08:08:29.967" Score="1" ViewCount="418" Body="&lt;p&gt;On my product page I have the default button that &quot;Adds to cart&quot; which adds a line item to the cart and take you to the cart page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create a second button alongside the default that adds the line item to the cart BUT then redirects the customer to the same page to select and customise another line item to add to cart?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Ill very likely change the styling and text on the button (just in case anyone is concerned about usability) ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RyFI5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RyFI5.png&quot; alt=&quot;Add to cart&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-06-23T08:17:39.903" Title="Craft Commerce: Add to Cart and then Redirect to Product Page?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15628" PostTypeId="2" ParentId="15627" CreationDate="2016-06-23T08:17:39.903" Score="1" Body="&lt;p&gt;You would need to use javascript to change the &lt;code&gt;redirect&lt;/code&gt; input's value&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example on the 'add and create new item' button you could do something like this using jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $('.addAndCreateNewBtn').click(function(e){&#xA;       e.preventDefault();&#xA;       var $form = $(this).closest('form');&#xA;       $form.find(&quot;input[name='redirect']&quot;).val('anotherUrl');&#xA;       $form.submit();&#xA;   });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above is untested, but should replace the redirect value then submit the form.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-06-23T08:17:39.903" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15629" PostTypeId="2" ParentId="15621" CreationDate="2016-06-23T08:45:08.270" Score="3" Body="&lt;p&gt;This functionality does not currently exist natively in Commerce (June 2016).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably use a plugin like entry count (&lt;a href=&quot;https://www.putyourlightson.net/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.putyourlightson.net/craft-entry-count&lt;/a&gt;) to achieve the most viewed (you might need to add commerce products support to that?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the best sellers, your best bet at the moment is probably to make a plugin that uses a query on the &lt;code&gt;craft_commerce_lineitems&lt;/code&gt; table (along the lines of &lt;a href=&quot;https://stackoverflow.com/questions/12235595/find-most-frequent-value-in-sql-column)...to&quot;&gt;https://stackoverflow.com/questions/12235595/find-most-frequent-value-in-sql-column)...to&lt;/a&gt; return a twig variable of the n most popular product objects.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-06-23T08:45:08.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15630" PostTypeId="1" AcceptedAnswerId="15636" CreationDate="2016-06-23T09:58:07.177" Score="1" ViewCount="875" Body="&lt;p&gt;Is there a way to set the system email address and sender name from within the config file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be useful when using multi environment configurations. For instance, during development or on my staging server I wish emails to be sent to me (the developer). While for production they would go to the site owner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the values in serialised data within the database but was hoping I could override them within the config file. I've tried the  keys &quot;emailAddress&quot; and &quot;senderName&quot; to no avail.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-08-02T12:51:52.090" Title="Setting system email address and sender name in multi config" Tags="&lt;config&gt;&lt;emails&gt;&lt;configuration&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15631" PostTypeId="1" AcceptedAnswerId="15635" CreationDate="2016-06-23T10:55:29.360" Score="4" ViewCount="713" Body="&lt;p&gt;I'm building a simple low traffic website in Craft for a customer whose web server only allows access over ftp. How would you have done the work in practical terms? Building the site locally and then copy everything manually over FTP when done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it for this kind of websites completely wrong to make minor adjustments directly on the server? &lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="57" LastEditDate="2016-06-23T17:21:06.820" LastActivityDate="2016-06-23T17:21:06.820" Title="Workflow when you only have FTP access?" Tags="&lt;deployment&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15632" PostTypeId="2" ParentId="15631" CreationDate="2016-06-23T11:07:01.727" Score="5" Body="&lt;p&gt;The best way to go is build it locally then upload it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the initial upload, if you use a smart FTP client like &lt;a href=&quot;http://panic.com/transmit&quot;&gt;Transmit&lt;/a&gt; you can sync both version to update your local version before making local changes then re-sync to upload them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Editing online can be done but for me it is crucial that you always have a local backup just in case something happens, so even if I do edit online I then sync my changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. To keep both version running without changes you’ll have to take advantage of &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot;&gt;Craft multi environment configs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5311" LastActivityDate="2016-06-23T11:07:01.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15633" PostTypeId="2" ParentId="8662" CreationDate="2016-06-23T14:27:29.633" Score="1" Body="&lt;p&gt;Next to &lt;a href=&quot;https://github.com/carlcs/craft-footnotes&quot; rel=&quot;nofollow&quot;&gt;carlcs' plugin&lt;/a&gt; (which is still in private beta apparently) there's also &lt;a href=&quot;https://github.com/Vierbeuter/craft-footnotes&quot; rel=&quot;nofollow&quot;&gt;Craft Footnotes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2016-06-23T14:27:29.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15634" PostTypeId="1" CreationDate="2016-06-23T15:38:06.283" Score="3" ViewCount="252" Body="&lt;p&gt;We are trying to find the best solution for handling repeated content within existing Fields in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, there are bits of information which could be used nearly anywhere within existing fields in the CMS (e.g. inside a Plain Text field / Rich Text field etc) (things like the event booking link, booking deadline, event start date etc etc). The ideal solution would be that these bits of information are housed in one place in the CMS (probably will be a global), and can cleanly be pulled through to other areas of the CMS with a super user-friendly bit of syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've explored a few options, namely the following...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reference Tags&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As these are limited to Plain Text field types, these are not an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Globals&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1268/is-it-possible-to-use-twig-in-a-rich-text-field)&quot;&gt;this SE question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would involve having to add &lt;code&gt;include(template_from_string())&lt;/code&gt; almost everywhere where a content is output from the CMS, which would be a pain and also the syntax might be a little confusing for the end user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Create our own plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst this might mean the syntax could be a bit more user friendly (e.g. something like &lt;code&gt;[main-event-dates]&lt;/code&gt;, we would still have to pass every field output to the plugin (i.e. &lt;code&gt;craft.myPlugin.parseSyntax(entry.body)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Events&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just starting exploring &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hooks and Events&lt;/a&gt;, and this looks like the best solution so far to me. From my understanding, the approach which would be most suitable for us would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;myPluginPlugin.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init() {&#xA;    craft()-&amp;gt;on('elements.onPopulateElement', function(Event $event) {&#xA;        craft()-&amp;gt;myPlugin_main-&amp;gt;parseSyntax($event);&#xA;    });&#xA;}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;myPlugin_MainService.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function parseSyntax($event) {&#xA;    // Parse the content of the fields, using something like the following&#xA;    $event-&amp;gt;params['element']-&amp;gt;getContent();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Considerations with using the 'Events' method&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We would need to build in a mechanism of programatically clearing all template caches when one of those bits of central information is changed (as Craft will not be aware of which templates need their cache clearing)&lt;/li&gt;&#xA;&lt;li&gt;Is there a risk that this will be super php intensive to essentially loop though each field for each bit entry model / matrix block model etc etc?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a better way to achieve what we are trying to achieve? Or feel strongly any way about any of the above?&lt;/p&gt;&#xA;" OwnerUserId="2314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-08-13T02:56:13.623" Title="Best Method of Handling Repeated Content Within Existing Fields?" Tags="&lt;plugins&gt;&lt;events&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15635" PostTypeId="2" ParentId="15631" CreationDate="2016-06-23T16:32:29.600" Score="7" Body="&lt;p&gt;I absolutely agree with &quot;build locally and then upload it&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://deploybot.com/&quot;&gt;Deploybot&lt;/a&gt; can deploy with ftp, and makes it quite painless to keep local and remote and git repo all in sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I make debugging sorts of changes directly on the server (tweak the config, tweak .htaccess, that sort of thing), but any change I want to keep I make sure to get into git.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-06-23T16:32:29.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15636" PostTypeId="2" ParentId="15630" CreationDate="2016-06-23T16:36:11.777" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/config-settings#testToEmailAddress&quot; rel=&quot;nofollow&quot;&gt;testToEmailAddress&lt;/a&gt; config setting which&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Configures Craft to send all system emails to a single email address (or multiple email addresses), for testing purposes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;sounds like the one you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-06-23T16:36:11.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15637" PostTypeId="2" ParentId="15630" CreationDate="2016-06-23T17:27:33.103" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/15636/57&quot;&gt;Marion's answer&lt;/a&gt; is a workaround for Craft 2, but this has been officially addressed in the upcoming Craft 3:  &lt;a href=&quot;https://github.com/craftcms/cms/issues/840&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/840&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-07-12T00:10:20.227" LastActivityDate="2017-07-12T00:10:20.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15638" PostTypeId="1" CreationDate="2016-06-23T19:20:48.243" Score="1" ViewCount="881" Body="&lt;p&gt;I'm using the most recent Craft CMS 2.6.2791. I'd like to generate preview thumbnails for pdf assets in my templates, so I found this plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carnesmedia/pthumb&quot; rel=&quot;nofollow&quot;&gt;https://github.com/carnesmedia/pthumb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, following the instructions on the readme page gives a nonsense url. In my template, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ craft.PThumb.thumbnail(pdf) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I inspect the src generated by this I see&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost:8888/myproject/public//assets/pdfs/previews/b15c8529f2b4a9b354c5e592e84d1ac5.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this renders as a broken image. I check my project structure and the previews directory is nowhere to be found. Am I doing something wrong or perhaps missing a step? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also open to any other solutions that could generate a thumbnail from the first page of a pdf asset automatically. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5286" LastEditorUserId="57" LastEditDate="2016-06-24T16:38:37.490" LastActivityDate="2019-01-10T08:49:56.780" Title="PDF preview thumbnail options?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15639" PostTypeId="1" CreationDate="2016-06-24T00:25:01.127" Score="1" ViewCount="48" Body="&lt;p&gt;I am trying to send custom welcome emails to custom user groups but Sprout email is attempting to send the notification before the user group is created which means the email isn’t sending. The log just outputs that the user doesn't belong to any user group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: We are using a custom plugin to create the user and trigger a set your password email which could be the problem, is there a way to hook into sprout email so we can trigger the send from our plugin?&lt;/p&gt;&#xA;" OwnerUserId="1154" LastActivityDate="2016-07-06T15:59:39.367" Title="Trigger sent before user is added in user group so no email is sent" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15640" PostTypeId="1" AcceptedAnswerId="15653" CreationDate="2016-06-24T01:37:09.173" Score="6" ViewCount="754" Body="&lt;p&gt;I was wondering if anyone who has experience using Sprout Forms might be able to steer me in the right direction on whether I'm better off using the Sprout Forms plugin or coding the forms traditionally. Here's a list of some of the main things in the forms. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;10 unique forms with about 30 fields each &lt;/li&gt;&#xA;&lt;li&gt;One field will be Users Field Type (or another way to choose up to 3 users)&lt;/li&gt;&#xA;&lt;li&gt;Front end forms will allow guests and logged in members to fill out&lt;/li&gt;&#xA;&lt;li&gt;Back end admin will edit submitted entry form and fill out admin only fields which are hidden on front end&lt;/li&gt;&#xA;&lt;li&gt;Ideally be able to conditionally display certain fields on the front end based on selections made by the person filling out the form (example: if person selected &quot;Apple&quot; choice in question 2, then show sub choices &quot;gala&quot;, &quot;Granny Smith&quot;. If person selected &quot;banana&quot; choice in question 2, then don't show any sub choices)&lt;/li&gt;&#xA;&lt;li&gt;Form field content will need to be searchable so info can be displayed on front end template (show user how many forms he submitted, show field content based on date period)&lt;/li&gt;&#xA;&lt;li&gt;Need to be able to create and display different reports on all 10 forms on a front end page (possibly export to csv too)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-06-26T02:07:42.310" Title="Unsure whether to use Sprout Forms or code forms regularly" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15641" PostTypeId="2" ParentId="15639" CreationDate="2016-06-24T01:42:42.213" Score="1" Body="&lt;p&gt;You can programmatically trigger a notification email using the Sprout Email service layer. Notification Emails are sent via the &lt;code&gt;SproutEmail_DefaultMailerService&lt;/code&gt; using the &lt;code&gt;sendNotification()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;sproutEmail_defaultMailer-&amp;gt;sendNotification($campaign, $object);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;$campaign&lt;/code&gt; needs to be a &lt;code&gt;SproutEmail_CampaignModel&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;$object&lt;/code&gt;, in your case, would be the Craft &lt;code&gt;UserModel&lt;/code&gt; (and more generally is any object that you want to make available to your email templates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-24T01:42:42.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15642" PostTypeId="1" AcceptedAnswerId="15643" CreationDate="2016-06-24T14:21:07.433" Score="2" ViewCount="1008" Body="&lt;p&gt;my url looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.tld/slug-1/slug-2/variable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in Twig it shall look for an entry with the slug slug-1 and show it, then an entry with the slug slug-2 and show it and look up for a global where the name of the global is variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this? I found:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('section_handle').slug('my_slug') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I tell Twig whats the first and whats the second slug? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are always 2 slugs and one variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5325" LastEditorUserId="45" LastEditDate="2016-08-13T02:34:56.987" LastActivityDate="2016-08-13T02:34:56.987" Title="Twig: Show specific entry by url" Tags="&lt;templating&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15643" PostTypeId="2" ParentId="15642" CreationDate="2016-06-24T15:42:58.423" Score="2" Body="&lt;p&gt;You can get the parts of your URL using the &lt;code&gt;getSegment()&lt;/code&gt; function. &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getSegment&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.request#getSegment&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use the &lt;code&gt;slug&lt;/code&gt; parameter and the criteria model’s &lt;code&gt;first()&lt;/code&gt; method to grab the entry. Global Sets are already preloaded, to access a set dynamically grab it from the &lt;code&gt;_context&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryA = craft.entries.slug(craft.request.getSegment(1)).first() %}&#xA;{% set entryB = craft.entries.slug(craft.request.getSegment(2)).first() %}&#xA;{% set globalSet = _context[craft.request.getSegment(3)] ?? null %}&#xA;&#xA;{% if not entryA or not entryB or not globalSet %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{{ entryA.title }} - {{ globalSet.myField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-06-24T15:49:07.937" LastActivityDate="2016-06-24T15:49:07.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15644" PostTypeId="1" CreationDate="2016-06-24T15:55:09.807" Score="2" ViewCount="153" Body="&lt;p&gt;User's account has mysteriously vanished and entries default to another user. This has happened multiple times. Not sure what to do so we can not have this happen again. Any help is warranted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5326" LastActivityDate="2016-06-24T23:04:02.147" Title="User mysteriously deleted" Tags="&lt;users&gt;&lt;deletion&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15645" PostTypeId="2" ParentId="15644" CreationDate="2016-06-24T16:36:56.483" Score="4" Body="&lt;p&gt;When a user is deleted from the system via the Craft control panel, they are presented with a model offering them the choice of what they want to do with that user's content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The options are to 1) transfer it to a different user (which you can select) or 2) delete it entirely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the behavior you're describing certainly &lt;em&gt;sounds&lt;/em&gt; like someone went through the UI to delete a user and transfer their content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to consider installing something like the &lt;a href=&quot;https://github.com/boboldehampsink/auditlog&quot; rel=&quot;nofollow&quot;&gt;Audit Log&lt;/a&gt; plugin to catch the borderline criminal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only other time we've seen a user and their content get deleted is from a more convoluted process where a Craft install has users in a &quot;pending&quot; state and they've never authenticated their accounts and they start assigning content to that account (via a custom plugin or some such).  They also have the &lt;a href=&quot;https://craftcms.com/docs/config-settings#purgePendingUsersDuration&quot; rel=&quot;nofollow&quot;&gt;purgePendingUserDuration&lt;/a&gt; config setting set to something other than &lt;code&gt;false&lt;/code&gt; (say 1 month), then once the user account has been &quot;pending&quot; for a month, they get deleted along with all of their content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it doesn't sound like that's what is happening for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-06-24T23:04:02.147" LastActivityDate="2016-06-24T23:04:02.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15646" PostTypeId="1" CreationDate="2016-06-24T17:46:16.190" Score="2" ViewCount="143" Body="&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a plugin for a custom field I want to have an Element Selection Modal so I'm calling: &lt;code&gt;Craft.createElementSelectorModal()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On an Element Detail page this is no problem. But, in a tooltip (say from the element Index for example) calling the same code causes the Field to be completely removed from the DOM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've even tried this with no settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft.createElementSelectorModal('Entry', {})&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it's still the same thing, the entire field gets removed from the DOM just on initialization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;Craft.createElementSelectorModal&lt;/code&gt; still the right thing to use to trigger an Element Selection modal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, is there something else I should use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image Progression:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4Ahytm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Ahytm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zBHSrm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zBHSrm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7o6Ns.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7o6Ns.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5zkoxm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5zkoxm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;For what it's worth I also tried &lt;code&gt;BaseElementSelectInput&lt;/code&gt; and had the exact same results.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2016-06-24T17:51:28.387" LastActivityDate="2016-06-27T15:27:13.467" Title="Craft.createElementSelectorModal in a tooltip is causing field to disappear" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15647" PostTypeId="2" ParentId="5291" CreationDate="2016-06-24T21:55:56.653" Score="7" Body="&lt;p&gt;You can have &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; generate the Craft CMS plugin framework for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're writing a plugin for Craft CMS 3, this may help you as well: &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;So You Wanna Make a Craft 3 Plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-08-28T03:26:40.370" LastActivityDate="2018-08-28T03:26:40.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15648" PostTypeId="1" AcceptedAnswerId="15649" CreationDate="2016-06-25T09:45:24.483" Score="3" ViewCount="2882" Body="&lt;p&gt;I'm trying to set up a simple subscription based site using the Awesome Charge plugin and am wondering if I can change the button text using Stripe Checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be any documentation around Checkout Options on the Squarebit site that indicates I can pass a value, through the options list, that changes the text 'Pay with card' to something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand I could customise the whole process using the Strip.js method but was hoping to just use the out of the box version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2018-10-15T10:39:02.690" Title="Is it possible to change the default text for a Charge plugin checkout button" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15649" PostTypeId="2" ParentId="15648" CreationDate="2016-06-25T12:47:46.137" Score="2" Body="&lt;p&gt;Developer of &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes - you absolutely can control the label generated for the checkout button. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When setting the details for the checkout option, you just need to pass a sub-array called &lt;code&gt;checkout&lt;/code&gt;, along with the extra parameters that get passed straight down the modal js.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically you'd want do some thing like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    planAmount : 99.99,&#xA;    description : 'This is an optional description for the modal',&#xA;    checkout : {&#xA;        name: 'Company Name ltd.',&#xA;        image: 'https://s3.amazonaws.com/stripe-uploads/hSYxIZGM3U0DbmPKsJszRHm3OU3D4CtHmerchant-icon-641868-add-on-icon.png',&#xA;        label: 'Pay with Stripe Checkout'&#xA;    }&#xA; } %}&#xA;&#xA; {{ craft.charge.setCheckoutOptions(options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In that above example you can see we're passing values for &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt; and &lt;code&gt;label&lt;/code&gt; to the Checkout modal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That'll return a button that looks something like this : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/heSdi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/heSdi.png&quot; alt=&quot;Example Stripe Checkout button with custom label&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full details of all the configuration options you can pass through to the checkout modal are detailed in the &lt;a href=&quot;https://stripe.com/docs/checkout#integration-simple-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stripe Checkout documentation&lt;/a&gt;. Just pass the values you want within that &lt;code&gt;checkout&lt;/code&gt; array in the twig. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB. We're working on updating the docs on this usage right now, and they'll be up shortly too &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/reference/checkout-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-06-25T12:47:46.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15650" PostTypeId="1" AcceptedAnswerId="15651" CreationDate="2016-06-25T22:46:58.320" Score="2" ViewCount="4075" Body="&lt;p&gt;I downloaded Lamp and am trying to install Craft CMS, but I keep getting a &quot;Service Unavailable- Our site is temporarily unavailable. Please try again later.&quot; In the log file it printed the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2016/06/25 22:39:51 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /var/www/html/test_craft/craft/app/etc/web/WebApp.php:798&#xA;Stack trace:&#xA;#0 /var/www/html/test_craft/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /var/www/html/test_craft/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /var/www/html/test_craft/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /var/www/html/public/index.php(19): require_once('/var/www/html/t...')&#xA;#4 {main}&#xA;REQUEST_URI=/public/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why this might be happening?&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="45" LastEditDate="2016-08-13T02:48:21.757" LastActivityDate="2016-08-13T02:48:21.757" Title="Service Unavaliable" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15651" PostTypeId="2" ParentId="15650" CreationDate="2016-06-25T23:55:07.177" Score="4" Body="&lt;p&gt;You'll get that message if Craft isn't installed and you hit the front-end of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to load the control panel for the installer to trigger as noted in &lt;a href=&quot;https://craftcms.com/docs/installing#step-5-run-the-installer&quot; rel=&quot;nofollow&quot;&gt;Step 5&lt;/a&gt; of the install docs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-25T23:55:07.177" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15652" PostTypeId="1" CreationDate="2016-06-26T01:18:55.613" Score="1" ViewCount="133" Body="&lt;p&gt;I am in the first step of the installation. I entered my email, username and password and clicked on the next button, but it is not doing anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It makes a post request to:&#xA;/var/www/html/test_craft/craft/app/index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a Get request to:&#xA;&lt;a href=&quot;http://localhost/public/index.php?p=admin/resources/images/spinner_submit.gif&amp;amp;d=1465331044&quot; rel=&quot;nofollow&quot;&gt;http://localhost/public/index.php?p=admin/resources/images/spinner_submit.gif&amp;amp;d=1465331044&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like the get request is not returning anything because in firebug, the response is a spinning wheel.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="45" LastEditDate="2016-08-13T02:37:45.377" LastActivityDate="2018-04-10T09:57:03.553" Title="Craft Installation Next Button Not doing anything" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15653" PostTypeId="2" ParentId="15640" CreationDate="2016-06-26T02:07:42.310" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot;&gt;Sprout Forms&lt;/a&gt; offers you a lot of the same functionality as standard Craft Entries. Both Sprout Forms and Entries allow you to create front-end forms that allow users to submit data to the database. Here are a few thoughts on why you would choose one over the other to manage content that requires front-end forms. None of these reasons are absolute, so take them with a grain of salt for your own situation (and happy to modify this list if anybody has feedback in the comments):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft Entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You want your submitted data to be managed alongside your other content on the Entries tab in the Craft Control Panel&lt;/li&gt;&#xA;&lt;li&gt;Your submitted data has the concept of an &quot;author&quot; and can be related to a user in your database&lt;/li&gt;&#xA;&lt;li&gt;Your submitted data has any other concepts that are specific to Entries, such as Post Date or Expiry Date&lt;/li&gt;&#xA;&lt;li&gt;You want to manage the HTML for all of your forms and fields in your templates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sprout Forms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You want to allow form submissions by anonymous users who are not logged into your website&lt;/li&gt;&#xA;&lt;li&gt;You don't want all of your form data cluttering up the Entries area where you manage the primary content of your website&lt;/li&gt;&#xA;&lt;li&gt;You want to create multiple, similar forms with variations on fields (such as creating a new form with slightly different fields to test a landing page)&lt;/li&gt;&#xA;&lt;li&gt;You just want a backup of a submitted form in the database (the primary workflow will take place via a notification email that gets triggered when a form is submitted)&lt;/li&gt;&#xA;&lt;li&gt;You want to be able to easily output your form in your templates dynamically (Sprout Forms handles all of the front-end code for you – including error states – with a single line of code). In addition, the base templates it uses to output the form can be customized using &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot;&gt;Template Overrides&lt;/a&gt; to meet your website design requirements.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Can Sprout Forms handle all of your requirements? Yes, however there are a few items worth mentioning as they may involve other Sprout plugins or custom development. I'll go into detail below.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;10 unique forms with about 30 fields each&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms can handle as many fields as you need. And makes it easy to output them in your templates without having to create all the necessary HTML by hand using the &lt;code&gt;displayForm&lt;/code&gt;, &lt;code&gt;displayTab&lt;/code&gt; or &lt;code&gt;displayField&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;One field will be Users Field Type (or another way to choose up to 3 users)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently, we support three relations field (Entries, Categories, Tags). Adding support for the Users Relation field would be possible via a custom integration (mostly just copying one of those existing custom fields), or reach out and we may be able to add this to the core plugin. We held off on adding Users at this point as we wanted to get better feedback on how it would be used to know how to implement it best.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Front end forms will allow guests and logged in members to fill out&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any user can fill out a form. If you want to capture information about a logged in user, you can pass the information you want to track to a field in your form. Sprout Fields has two fields that are helpful for this, the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field&quot;&gt;Hidden Field&lt;/a&gt; and the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/invisible-field&quot;&gt;Invisible Field&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Back end admin will edit submitted entry form and fill out admin only fields which are hidden on front end&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Admins can edit the form via the Craft Control Panel. You can hide fields from displaying on the front-end in several ways. The Hidden or Invisible field give you some basic ways to do this, however are more for capturing values that are not visible to the user on the front-end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way is to use &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/rendering-options&quot;&gt;Rendering Options&lt;/a&gt; which allow you to customize the &lt;code&gt;id&lt;/code&gt; or &lt;code&gt;class&lt;/code&gt; names of particular fields as they are dynamically output.  You could, for example, add the class name of &lt;code&gt;hidden&lt;/code&gt; to the fields you don't want displayed on the front-end and either supress their visibility or remove them from the page with javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final way would be to create a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot;&gt;custom field&lt;/a&gt; that behaves exactly how you need it to.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Ideally be able to conditionally display certain fields on the front end based on selections made by the person filling out the form (example: if person selected &quot;Apple&quot; choice in question 2, then show sub choices &quot;gala&quot;, &quot;Granny Smith&quot;. If person selected &quot;banana&quot; choice in question 2, then don't show any sub choices)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is going to be your most challenging item with both Craft Entries and Sprout Forms. You will likely have to write some custom javascript to get this behavior to work, and you'll have to keep this code in mind if you ever update your fields or naming conventions as the code on the page will probably only know what you tell it about how you have things setup in your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest place to start here will be to see if you can target the default IDs output on your fields and add the behavior you need to them. If you need more customization of the class names for your code, &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot;&gt;Template Overrides&lt;/a&gt; and &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/rendering-options&quot;&gt;Rendering Options&lt;/a&gt; give you a lot of flexibility in how you structure your code for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are probably several other approaches that can be taken here based on your specific use case so it would be best to talk this through with a developer who knows your project requirements well.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Form field content will need to be searchable so info can be displayed on front end template (show user how many forms he submitted, show field content based on date period)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms Form Elements and Sprout Forms Form Entry Elements (the user submissions in Sprout Forms) use Craft's Element Type API and are searchable in the same way that all Craft Elements are searchable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to be sure you are capturing the right user information in your form entries to perform the searches your require such as the &lt;code&gt;userId&lt;/code&gt;. Sprout Forms captures date information about when a submission is created and modified.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Need to be able to create and display different reports on all 10 forms on a front end page (possibly export to csv too)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sprout Reports is designed to work closely with Sprout Forms for your custom reporting needs. Out of the box, Sprout Forms has one report integration that lets you run a report on all of your submitted entry data. However, we purposefully de-coupled Sprout Forms and Sprout Reports to allow more customization for your reporting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/reports&quot;&gt;Sprout Reports&lt;/a&gt; enables you to create custom reports that provide different views into your Form data, add additional columns to your reports such as related user data, and customize what options an admin user has to select from when running a report.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Custom reports do require a developer to set them up, but they are very flexible and fairly easy to implement once you have clearly defined what you need. Please reach out to the Sprout Team if you have any questions on how these work or how to set them up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All reports are exportable via CSV.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-26T02:07:42.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15654" PostTypeId="2" ParentId="15652" CreationDate="2016-06-26T03:47:07.750" Score="2" Body="&lt;p&gt;Well, things should be going very smoothly from here, so there is pretty surely something not right with your installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) did you make sure to rename the installed file public/htaccess to public/.htaccess? I'm not sure if this is critical to the installer, but it might be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You can look in craft/storage/runtime/logs. There you find craft.log and phperrors.log. Either may hold information to help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) It sounds that your database login config is ok, as otherwise the Craft installer would notify about that, but you may not have all the other server requirements in place yet. See: &lt;a href=&quot;https://craftcms.com/docs/requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/requirements&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For requirements testing, see: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/137/is-there-a-quick-way-to-check-a-server-for-crafts-minimum-requirements&quot;&gt;Is there a quick way to check a server for Craft&amp;#39;s minimum requirements?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Getting no response would be quite unusual. It's possible that your Craft installation is faulty -- FTP in general is often not entirely reliable. You could remove, then re-upload and replace the installation. If you do this and can, I'd suggest uploading the zip, then unzipping it on the server. Again, then, don't forget to rename the htaccess to .htaccess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) all this presumes you are running on Apache. If Nginx instead, here are two references that should help. I'd go with the first as that's from the Craft team based on what works for others. I use Nginx all the time, as do many others, and it's fine once configured:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;What is the recommended Nginx configuration for Craft?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/kenzie/5811327&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/kenzie/5811327&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good fortune then. Again, Craft installs are nearly as effortless as Craft updates, unless there is something wrong in the configuration or preparations.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-06-26T07:38:28.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15655" PostTypeId="1" CreationDate="2016-06-26T05:43:10.227" Score="2" ViewCount="187" Body="&lt;p&gt;No fancy deployment, version control etc etc. Just a cut and dry walkthrough on how to get Craft CMS up and running on a LEMP stack, does it exist? I'm fairly new to craft but have had no problem with the more documented LAMP stack but there seems to be a lack of LEMP &amp;amp; specifically nginx directives relating to craft. Any help or advice would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5331" LastEditorUserId="45" LastEditDate="2016-08-13T02:37:23.767" LastActivityDate="2016-08-13T02:37:23.767" Title="Barebones LEMP + Craft CMS walkthrough" Tags="&lt;nginx&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15656" PostTypeId="2" ParentId="15620" CreationDate="2016-06-26T18:22:38.677" Score="6" Body="&lt;p&gt;To save a custom field value on an Asset, you'll first need to pull the actual AssetFileModel, set the custom attribute on the Asset's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;ContentModel&lt;/a&gt;, and finally re-save the Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following example assumes you've set a field &lt;code&gt;photoId&lt;/code&gt; on your asset source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fileId = $response-&amp;gt;getDataItem('fileId');&#xA;$asset = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;$asset-&amp;gt;getContent()-&amp;gt;setAttribute('photoId', $photo['PhotoId']);&#xA;$success = craft()-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-27T10:20:34.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15658" PostTypeId="1" CreationDate="2016-06-26T21:57:19.650" Score="2" ViewCount="274" Body="&lt;p&gt;I'm running into an issue here, hopefully someone can shed some light. &#xA;I'm in a news category template, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').relatedTo(category) %} &#xA;  {% for image in news.newsimage %}&#xA;    &amp;lt;a href=&quot;{{ news.url }}&quot;&amp;gt;&amp;lt;img alt=&quot;{{ news.title }}&quot; src=&quot;{{ news.url }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My entry.title, date, etc. all output correctly, I can't figure out how to output the image asset associated with newsimage. &lt;/p&gt;&#xA;" OwnerUserId="4929" LastEditorDisplayName="user1080" LastEditDate="2017-03-12T17:45:43.277" LastActivityDate="2017-03-12T17:45:43.277" Title="Image entry in a category template" Tags="&lt;assets&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15659" PostTypeId="2" ParentId="15658" CreationDate="2016-06-27T02:39:57.267" Score="3" Body="&lt;p&gt;It looks like you are trying to access a &lt;code&gt;news&lt;/code&gt; variable that probably doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').relatedTo(category) %} &#xA;&#xA;    {# Your image field will be found on your `entry` variable (not a `news` variable) #}&#xA;    {% for image in entry.newsimage %}&#xA;&#xA;        {# One you are looping through your image field, &#xA;           you can access the image properties via the `image` &#xA;           variable you defined in your loop #}&#xA;        &amp;lt;a href=&quot;{{ image.getUrl() }}&quot;&amp;gt;&#xA;          &amp;lt;img alt=&quot;{{ image.title }}&quot; src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you only have a single news image, you can grab that image directly using the &lt;code&gt;first()&lt;/code&gt; method, instead of looping through your image field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').relatedTo(category) %} &#xA;&#xA;    {% set image = entry.newsimage.first() %}&#xA;&#xA;    {% if image %}&#xA;        &amp;lt;a href=&quot;{{ image.getUrl() }}&quot;&amp;gt;&#xA;          &amp;lt;img alt=&quot;{{ image.title }}&quot; src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-27T02:39:57.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15660" PostTypeId="2" ParentId="15247" CreationDate="2016-06-27T05:02:34.013" Score="1" Body="&lt;p&gt;You could make use of symbolic links. This works if your sites are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;on the same system &lt;/li&gt;&#xA;&lt;li&gt;your system is running on a Linux server environment&lt;/li&gt;&#xA;&lt;li&gt;you have console access (ex. SSH) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With symbolic links you can easily &quot;mirroring&quot; folders like css/js and templates, plugins, etc.. For the assets it's maybe better to use only one url and pointing to this over all domains. This avoiding dublicated content in Google&amp;amp;Co..&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-06-27T05:02:34.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15662" PostTypeId="1" AcceptedAnswerId="15670" CreationDate="2016-06-27T06:46:37.450" Score="2" ViewCount="2337" Body="&lt;p&gt;I cannot seem to include my CSS and JS files from the &lt;code&gt;craft/templates/&lt;/code&gt; directory into my website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at this answer - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/3092/serving-css-files-from-template-folder#&quot;&gt;Serving CSS files from template folder&lt;/a&gt; - and it tells me I simply need to have a &lt;code&gt;styles/styles.css&lt;/code&gt; folder and I use &lt;code&gt;{% includeCssFile &quot;/styles/styles.css&quot; %}&lt;/code&gt; and it should work. But it doesn't. I have a similar problem with the javascript includes. &lt;code&gt;{% includeJsFile &quot;js/lodash.min.js&quot; %}&lt;/code&gt; command works, but once I navigate to any other URL, it tries to include the file &lt;code&gt;http://localhost/craft/news/2016/js/lodash.min.js&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My folder structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o4yiv.png&quot; width=&quot;170&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to keep all my assets in this &lt;code&gt;craft/templates/&lt;/code&gt; folder because I created a git repo in the craft main folder.&lt;/p&gt;&#xA;" OwnerUserId="4765" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-12-20T09:18:39.640" Title="Including CSS/JS assets from template folder" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15663" PostTypeId="1" AcceptedAnswerId="15666" CreationDate="2016-06-27T08:31:03.980" Score="5" ViewCount="3609" Body="&lt;p&gt;What  is the recommended way to add section specific javascript to entry pages?&#xA;I need to make some 3rd party api calls front end for currency conversion but I want to only use it on a specific section entry.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-06-27T10:03:20.120" Title="Loading javascript on specific sections/pages" Tags="&lt;sections&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15664" PostTypeId="1" CreationDate="2016-06-27T08:31:47.050" Score="1" ViewCount="65" Body="&lt;p&gt;How can i achieve that portrait images in Control Panel are shown as portrait images. Now they all are stretched to fit the width of the parent container. This behaviour is only in &quot;Big View&quot; of images.&#xA;I use newest Craft CMS 2.6.2791.&lt;/p&gt;&#xA;" OwnerUserId="5301" LastActivityDate="2016-06-27T12:46:59.840" Title="Control Panel, Landscape / Portrait Images" Tags="&lt;control-panel&gt;&lt;image&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-06-28T19:36:48.897" ContentLicense="CC BY-SA 3.0" />
  <row Id="15665" PostTypeId="1" AcceptedAnswerId="15668" CreationDate="2016-06-27T09:55:47.317" Score="2" ViewCount="509" Body="&lt;p&gt;My shop has one product. As such there isn't much point in me having a page displaying all products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I paste in my template code for my single product into Cart Commerce's main index template I get the error &lt;strong&gt;&lt;em&gt;Variable &quot;product&quot; does not exist&lt;/em&gt;&lt;/strong&gt; on the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for purchasable in product.variants %}&#xA;&#xA;    &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;{{ purchasable.description }} {{ purchasable.price|currency(cart.currency) }}&amp;lt;/option&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is this being thrown up and how do I remedy this?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="57" LastEditDate="2016-06-27T18:08:38.203" LastActivityDate="2016-06-27T18:08:55.953" Title="Craft Commerce: Variable &quot;product&quot; does not exist" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15666" PostTypeId="2" ParentId="15663" CreationDate="2016-06-27T10:03:20.120" Score="11" Body="&lt;p&gt;A safe way to add JavaScript resources via the frontend, is to use the &lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot;&gt;&lt;code&gt;{% includeJsFile %}&lt;/code&gt;&lt;/a&gt; Twig function in your template. The nice thing about the &lt;code&gt;includeJsFile&lt;/code&gt; function is that it doesn't matter where in your template you call it; the file(s) added will always be output just above your &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag (or wherever else you put your &lt;a href=&quot;https://craftcms.com/docs/templating/functions#getFootHtml&quot;&gt;&lt;code&gt;{% getFootHtml() %}&lt;/code&gt;&lt;/a&gt; call). Also, the function makes sure that no duplicate resources are requested, even if you have multiple calls to &lt;code&gt;includeJsFile&lt;/code&gt; using the same URL (or filepath, for local resources).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not being specific about &lt;em&gt;why&lt;/em&gt; the JavaScript should only be loaded for a specific entry, so it's difficult to advise about the optimal way to achieve this – but there's a few different approaches that could work nicely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one, you could add a conditional to your template, where you hard code the ID to the entry in question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id == 100 %}&#xA;    {% includeJsFile('https://code.jquery.com/jquery-3.0.0.js') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, you can have the conditional look at other attributes, as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section.handle == 'awesomeSection' %}&#xA;    {% includeJsFile('https://code.jquery.com/jquery-3.0.0.js') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the JavaScript should e.g. be loaded whenever a certain Matrix block type is output, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixField %}&#xA;    {% switch block.type %}&#xA;        {% case 'someBlockType' %}&#xA;            ...&#xA;            {% includeJsFile('https://code.jquery.com/jquery-3.0.0.js') %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remember, &lt;code&gt;includeJsFile&lt;/code&gt; handles duplicate requests for you, so it doesn't matter if there's more than one &lt;code&gt;someBlockType&lt;/code&gt; block – the actual external JS resource will only be requested once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the most flexible option – and the one I would recommend – would be to add a custom field to your entry type, where you can add URL(s) to external scripts that should be loaded. This makes it easy to add external JavaScript resources to any entry, via the regular editing form in the CP. For this, the &lt;a href=&quot;https://craftcms.com/docs/table-fields&quot;&gt;Table fieldtype&lt;/a&gt; will do nicely (the following assumes a table field with the handle &lt;code&gt;externalScripts&lt;/code&gt; and a single column called &lt;code&gt;url&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.externalScripts %}&#xA;    {% if row.url %}&#xA;        {% includeJsFile(row.url) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, another approach would be to add a PlainText field to your entry type (multiple lines, i.e. a textarea), where you can paste in a full &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;    &amp;lt;script src=&quot;https://code.jquery.com/jquery-3.0.0.js&quot;   integrity=&quot;sha256-jrPLZ+8vDxt2FnE1zvZXCkCcebI/C8Dt5xyaQBjxQIo=&quot;   crossorigin=&quot;anonymous&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If go down this path, you can't use &lt;code&gt;includeJsFile&lt;/code&gt; and will have to output the string &quot;manually&quot; – making sure to add the &lt;code&gt;|raw&lt;/code&gt; filter to prevent Twig from escaping the HTML (the following assumes your plaintext field is called &lt;code&gt;scripts&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.scripts|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the latter option, you might want to add a &lt;code&gt;{% block scriptsInFooter %}&lt;/code&gt; to your &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot;&gt;base layout&lt;/a&gt;, in order to have the value for the &lt;code&gt;scripts&lt;/code&gt; field render in the appropriate place:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Entry template #}&#xA;{% block scriptsInFooter %}&#xA;    {{ entry.scripts|raw }}&#xA;{% endblock %}&#xA;&#xA;{# Base template #}&#xA;    ...&#xA;    {% block scriptsInFooter %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-06-27T10:03:20.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15667" PostTypeId="2" ParentId="15247" CreationDate="2016-06-27T10:17:20.127" Score="2" Body="&lt;p&gt;As long as your sites are hosted on the same server, you can easily share templates and plugins between them by defining the appropriate &lt;a href=&quot;https://craftcms.com/docs/php-constants#path-constants&quot; rel=&quot;nofollow&quot;&gt;path constants&lt;/a&gt; in the &lt;code&gt;index.php&lt;/code&gt; files for your sites:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_PLUGINS_PATH', '/absolute/path/to/your/plugins/folder');&#xA;define('CRAFT_TEMPLATES_PATH', '/absolute/path/to/your/templates/folder');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for your resources (i.e. CSS and JavaScript files), &lt;a href=&quot;https://en.wikipedia.org/wiki/Symbolic_link&quot; rel=&quot;nofollow&quot;&gt;symbolic linking&lt;/a&gt; is an option. However, I would recommend following Tom Bauer's suggestion in his answer – pick one domain and serve all assets from that domain's public folder, or even better: host the resources on a &lt;a href=&quot;https://www.maxcdn.com/&quot; rel=&quot;nofollow&quot;&gt;CDN&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-06-27T10:22:34.580" LastActivityDate="2016-06-27T10:22:34.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15668" PostTypeId="2" ParentId="15665" CreationDate="2016-06-27T10:18:43.723" Score="1" Body="&lt;p&gt;&lt;code&gt;product&lt;/code&gt; will only be available by default if you're viewing the template set in the CP under that products type settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BbL0B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BbL0B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to display your product elsewhere on your site you will need to set it to a variable like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myProduct = craft.commerce.products.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can then loop through this product's variants&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for purchasable in myProduct.variants %}&#xA;&#xA;    &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;{{ purchasable.description }} {{ purchasable.price|currency(cart.currency) }}&amp;lt;/option&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="57" LastEditDate="2016-06-27T18:08:55.953" LastActivityDate="2016-06-27T18:08:55.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15670" PostTypeId="2" ParentId="15662" CreationDate="2016-06-27T12:03:39.023" Score="2" Body="&lt;p&gt;Your example code worked for me - This may be down to using MAMP and having a &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;config file&lt;/a&gt; that handles my siteUrl and assetsUrl. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few questions already on Stack Exchange that relate to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15310/creating-partials-outside-of-the-templates-folder/&quot;&gt;your folder structure&lt;/a&gt; and how to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15663/loading-javascript-on-specific-sections-pages&quot;&gt;include assets in different templates&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-27T12:03:39.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15672" PostTypeId="1" AcceptedAnswerId="15756" CreationDate="2016-06-27T12:47:58.430" Score="3" ViewCount="1136" Body="&lt;p&gt;I want to get a list of entries in a template that have one specific tag 'weddings' and exclude entries that do not have this tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search('weddings').first() %}&#xA;&#xA;{% if tag %}          &#xA;  {% set entries = craft.entries.relatedTo(tag) %}&#xA;  {% for entry in craft.entries.section('blog').limit(5) %}&#xA;    {# get stuff #}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this gets me all blog entries - even those without the Tag weddings. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4466" LastEditDate="2016-06-27T12:53:23.857" LastActivityDate="2016-07-01T00:08:51.300" Title="List entries for a single tag from blog section" Tags="&lt;templating&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15673" PostTypeId="2" ParentId="15672" CreationDate="2016-06-27T12:50:28.717" Score="4" Body="&lt;p&gt;You were very close! You are looping through &lt;code&gt;craft.entries.section('blog')&lt;/code&gt; which doesn't use your tag query. You simply need to loop through the results of your query which you've set in the &lt;code&gt;entries&lt;/code&gt; variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to grab your weddings tag using the tag's id or slug as &lt;code&gt;.search&lt;/code&gt; will find any tag with the string 'weddings' in it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might also be a good idea to use the conditional to check &lt;code&gt;entries&lt;/code&gt; is returning something first, before outputting it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.slug('weddings').first() %}&#xA;{% set entries = craft.entries.relatedTo(tag) %}&#xA;&#xA;{% if entries|length %}&#xA;  {% for entry in entries.limit(5) %}&#xA;    {# get stuff #}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-27T12:56:24.430" LastActivityDate="2016-06-27T12:56:24.430" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15674" PostTypeId="1" AcceptedAnswerId="15680" CreationDate="2016-06-27T14:41:49.367" Score="1" ViewCount="278" Body="&lt;p&gt;I'm trying to use the Craft Commerce example template code to show a progress bar throughout the checkout process. It currently doesn't correctly display the % value of progress through the checkout. It is just blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url for my checkout is page is: &lt;code&gt;website.com/shop/test/checkout&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see if it was a styling issue I did a test and set a manual override on the span's width with 50% - the styling then comes into play.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else encountered this issue? I don't want to assume anything but the equation to make it kick in doesn't seem to be working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;steps&quot;&amp;gt;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for key, step in steps %}&#xA;      {% set class = '' %}&#xA;      {% if craft.request.requestUri|slice(1) == step.url %}&#xA;        {% set width = ((key + 1) * 100 / steps|length) - 20 %}&#xA;        {% set class = &quot;sel&quot; %}&#xA;        {% set currentStep = key %}&#xA;      {% endif %}&#xA;&#xA;      {% if currentStep is not defined %}&#xA;        {% set class = &quot;done&quot; %}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;li class=&quot;{{ class }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ url( step.url ) }}&quot;&amp;gt;{{ step.label }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;meter&quot;&amp;gt;&#xA;    &amp;lt;span style=&quot;width: {{ width }}%&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2016-06-28T10:19:42.653" LastActivityDate="2016-06-28T10:35:20.247" Title="Craft Commerce: Steps Bar in Checkout" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15676" PostTypeId="1" AcceptedAnswerId="15677" CreationDate="2016-06-27T19:33:27.713" Score="3" ViewCount="190" Body="&lt;p&gt;I’m trying to set a specific lineItem option. Here is the gist of my attempt:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;    $lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;    if (something == true) {&#xA;        $lineItem-&amp;gt;options['optionKey'] = 'newValue';&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Indirect modification of overloaded property…&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What’s the correct way to do this?&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-06-27T19:46:43.980" LastActivityDate="2016-06-27T20:24:05.110" Title="Set a lineItem option from within a plugin?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15677" PostTypeId="2" ParentId="15676" CreationDate="2016-06-27T20:24:05.110" Score="2" Body="&lt;p&gt;I'm guessing you're doing this in a plugin and not the front end using an input for a reason?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I struggled with this recently and had luck using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the line item from the event&#xA;$item = $event-&amp;gt;params['lineItem'];&#xA;&#xA;// We get all the options from the post request&#xA;$options = craft()-&amp;gt;request-&amp;gt;getPost('options', []);&#xA;&#xA;// Add the new value&#xA;$options['optionKey'] = 'newValue';&#xA;&#xA;// Save the options to the line item&#xA;$item-&amp;gt;options = $options;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If somebody can suggest an improvement to this I'd be grateful.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-27T20:24:05.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15678" PostTypeId="1" AcceptedAnswerId="15679" CreationDate="2016-06-28T00:15:29.203" Score="5" ViewCount="574" Body="&lt;p&gt;Our site is using the Craft Commerce plugin, and within that we've enabled the PayPal Express gateway. However, there is a very cryptic dropdown menu on the gateway settings page...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/396hV.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/396hV.png&quot; alt=&quot;Solution Type&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, &lt;strong&gt;what is the &quot;Solution Type&quot;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does that even mean? And what is the difference between the &quot;Sole&quot; and &quot;Mark&quot; options?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-28T00:15:29.203" Title="Commerce &amp; PayPal - What does &quot;Solution Type&quot; mean?" Tags="&lt;plugin-craftcommerce&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15679" PostTypeId="2" ParentId="15678" CreationDate="2016-06-28T00:15:29.203" Score="9" Body="&lt;p&gt;Ignore the terminology, it really makes no sense. What it should say is this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Require customers to use a PayPal account?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;[Sole]&lt;/strong&gt; No, a PayPal account is optional. Customers can still choose to pay with a credit card instead.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;[Mark]&lt;/strong&gt; Yes, a PayPal account will be required to complete a purchase.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of the &lt;a href=&quot;https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/&quot; rel=&quot;noreferrer&quot;&gt;documentation...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aiNuf.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aiNuf.png&quot; alt=&quot;SOLUTIONTYPE&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why did PayPal decide to call this particular choice &quot;Solution Type&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what do &quot;Sole&quot; and &quot;Mark&quot; actually mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://youtu.be/2IA5Cv_5-g8?t=7s&quot; rel=&quot;noreferrer&quot;&gt;The world may never know.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-28T00:15:29.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15680" PostTypeId="2" ParentId="15674" CreationDate="2016-06-28T09:07:24.100" Score="2" Body="&lt;p&gt;The Craft Commerce example template's include a file called &lt;code&gt;meter.html&lt;/code&gt; to display the progress bar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the top of template there is an array of steps that is used to calculate the percentage as the user progresses through the checkout process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get your progress bar to show the correct percentage you will need to change the url's for each step to match your site's structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something along the following lines will likely be what you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set steps = [&#xA;  {&#xA;    label: &quot;Start Order&quot;,&#xA;    url: 'shop/test/checkout'&#xA;  },&#xA;  {&#xA;    label: &quot;Address&quot;,&#xA;    url: 'shop/test/checkout/addresses'&#xA;  },&#xA;  {&#xA;    label: &quot;Shipping&quot;,&#xA;    url: 'shop/test/checkout/shipping'&#xA;  },&#xA;  {&#xA;    label: &quot;Payment&quot;,&#xA;    url: 'shop/test/checkout/payment'&#xA;  }&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will then make the following &lt;code&gt;true&lt;/code&gt; for the current step and the width will be calculated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.requestUri|slice(1) == step.url %}&#xA;  {% set width = ((key + 1) * 100 / steps|length) - 20 %}&#xA;  {% set class = &quot;sel&quot; %}&#xA;  {% set currentStep = key %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="5257" LastEditDate="2016-06-28T10:35:20.247" LastActivityDate="2016-06-28T10:35:20.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15681" PostTypeId="2" ParentId="15634" CreationDate="2016-06-28T10:57:31.993" Score="3" Body="&lt;p&gt;Forgive me but after re-reading everyone's input, I lean towards Moto_Nomad relationships suggestion, mostly because it will make life as easy as possible for the content-administrator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your latest comment you write:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...but the issue is not about relating entries, but smaller bits of information, for which there is not a prescribed location.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q: Could you give us an example of a 'smaller bit of information', please?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That is, there are bits of information which could be used nearly anywhere within the CMS (things like the &lt;strong&gt;event booking link&lt;/strong&gt;, &lt;strong&gt;booking deadline&lt;/strong&gt;, &lt;strong&gt;event start date&lt;/strong&gt; etc etc)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd suggest that the 'smaller bits of information' as well as the info you mention above, which are relevant to a Festival/Event should be stored within those (Event) Entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially if these 'bits of info' are updated over time i.e. from from one event to the next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'll avoid going into an explanation of the &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries field type&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The ideal solution would be that these bits of information are housed in one place in the CMS (probably will be a global), and can cleanly be pulled through to other areas of the CMS with a super user-friendly bit of syntax.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Check out this thread: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1268/is-it-possible-to-use-twig-in-a-rich-text-field&quot;&gt;Is it possible to use Twig in a Rich Text Field?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise the above is about the Front-End but thought it might be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how you get on, Mike :)&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-06-28T10:57:31.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15682" PostTypeId="1" CreationDate="2016-06-28T12:22:57.850" Score="1" ViewCount="711" Body="&lt;p&gt;When I try to install &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow&quot;&gt;Craft CMS 3&lt;/a&gt; by going to &lt;code&gt;/admin&lt;/code&gt; the site redirects me to &lt;code&gt;/index.php?p=admin/install&lt;/code&gt; where the Begin button shows. Clicking next send me to the screen to create an admin user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I enter all the information I see an ajax call going to &lt;code&gt;http://domain.com/index.php?p=admin/actions/install/validate-account&lt;/code&gt; but that responds with 400 Error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea whats wrong? I have .htaccess file in place, so not sure why I see the index.php part in the url. Any help would be appreciated.&#xA;Edit: in the error log file I see those three lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-][-][error][yii\i18n\PhpMessageSource::loadMessages] The message file for category 'yii' does not exist: /home/rrznjzkn/public_html/craft3/craft/app/vendor/yiisoft/yii2/messages/en-US/yii.php Fallback file does not exist as well: /home/rrznjzkn/public_html/craft3/craft/app/vendor/yiisoft/yii2/messages/en/yii.php&#xA;&#xA;[-][-][warning][craft\app\web\ErrorHandler::handleException] 400 - Unable to verify your data submission.&#xA;&#xA;[-][-][error][yii\web\HttpException:400] exception 'yii\web\BadRequestHttpException' with message 'Unable to verify your data submission.' in /home/rrznjzkn/public_html/craft3/craft/app/vendor/yiisoft/yii2/web/Controller.php:110&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5337" LastEditorUserId="45" LastEditDate="2016-08-13T02:47:24.953" LastActivityDate="2016-08-13T02:47:24.953" Title="400 error on Craft 3 installation" Tags="&lt;error&gt;&lt;install&gt;&lt;404&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15683" PostTypeId="2" ParentId="15549" CreationDate="2016-06-28T13:22:07.897" Score="1" Body="&lt;p&gt;Well done for working out how to display &quot;reverse-related&quot; entries!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to separate your Articles into two lists i.e.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Articles with downloads&lt;/li&gt;&#xA;&lt;li&gt;Articles without downloads&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;... I would do something like the following on your Company single-entry template...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedArticles = craft.entries.section('article').relatedTo() %}&#xA;&#xA;{# Related articles which have downloads #}&#xA;{% for articleEntry in relatedArticles %}&#xA;&#xA;    {# check for Matrix content #}&#xA;    {% if articleEntry.downloads != '' %}&#xA;        &amp;lt;h3&amp;gt;{{ articleEntry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {# loop through any matrix items #}&#xA;            {% for block in articleEntry.downloads %}&#xA;&#xA;                {# get the first asset into a variable named 'download' #}&#xA;                {% set download = block.downloadFile.first() %}&#xA;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}{{ download.url }}&quot;&amp;gt;{{ block.downloadName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# Articles which do not have downloads #}&#xA;{% for articleEntry in allArticles %}&#xA;&#xA;    {# check for blank Matrix content #}&#xA;    {% if articleEntry.downloads == '' %}&#xA;&#xA;        {# display article titles #}&#xA;        &amp;lt;h3&amp;gt;{{ articleEntry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. Let us know how you get on...&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-28T13:22:07.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15685" PostTypeId="1" AcceptedAnswerId="15689" CreationDate="2016-06-28T14:40:34.923" Score="3" ViewCount="100" Body="&lt;p&gt;I'm in the middle of creating a plugin that needs a template to display information stored in some records when the user clicks this in the CMS sidebar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to get the template to appear (Yay!) And I've been looking at other plugins with regards to styling / structure of these pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of them are extending and using classes that appear within Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reference to this anywhere? Such as a class / styleguide or any where I can find out a bit easier what blocks etc are used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2016-06-28T17:04:15.543" Title="Plugin Development - Template Resources?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15686" PostTypeId="2" ParentId="15543" CreationDate="2016-06-28T14:59:28.703" Score="1" Body="&lt;p&gt;I managed to achieve this a while back within ExpressionEngine. The approach would be the same...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used this Javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function() {&#xA;    $(&quot;.fancybox&quot;).fancybox();&#xA;&#xA;    // Apply FancyBox to images within the body of an article&#xA;    $(&quot;.articleBody img&quot;).on(&quot;click&quot;, function(){&#xA;       $.fancybox($(this).attr(&quot;src&quot;),{&#xA;           // API options&#xA;           padding : 0 // example&#xA;       });&#xA;    });&#xA;&#xA;    $('.fancybox-media')&#xA;        .attr('rel', 'media-gallery')&#xA;        .fancybox({&#xA;            openEffect : 'none',&#xA;            closeEffect : 'none',&#xA;            prevEffect : 'none',&#xA;            nextEffect : 'none',&#xA;            padding : 0,&#xA;&#xA;            arrows : false,&#xA;            helpers : {&#xA;                media : {},&#xA;                buttons : {}&#xA;        }&#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From memory, this worked on all  tags within .&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-28T14:59:28.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15687" PostTypeId="1" AcceptedAnswerId="15688" CreationDate="2016-06-28T15:39:52.433" Score="2" ViewCount="159" Body="&lt;p&gt;I have a lineItem option that needs validation. It’s actually an input field that can’t be blank, and different to the lineItem’s note.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs for &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;nofollow&quot;&gt;Add to Cart&lt;/a&gt; mention using &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&quot; rel=&quot;nofollow&quot;&gt;onBeforeAddToCart&lt;/a&gt; but it also needs to be validated if a customer decides to edit this field in the cart so perhaps &lt;code&gt;commerce_cart.onBeforeAddToCart&lt;/code&gt; is not the right event here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer an example of how to do this? This needs to be server-side validation, not front-end.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-06-29T10:51:02.030" LastActivityDate="2016-06-29T14:11:36.343" Title="Validate a lineItem option within a plugin?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15688" PostTypeId="2" ParentId="15687" CreationDate="2016-06-28T16:18:41.747" Score="5" Body="&lt;p&gt;I've achieved something similar but used &lt;code&gt;commerce_lineItems.onBeforeSaveLineItem&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This event is fired every time a line item is created or edited. Fired on &lt;code&gt;/updateCart&lt;/code&gt; (product page) or &lt;code&gt;/updateLineItem&lt;/code&gt; (cart page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might run into problems because the lineItems in the event won't contain a post request unless its the lineItem that triggered the event through a form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to grab the events line item and check it against the lineItemId in the post request before doing any comparisons - unless its a new lineItem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the line item being saved from the event&#xA;$item = $event-&amp;gt;params['lineItem'];&#xA;&#xA;// Is this a new line item?&#xA;$isNewLineItem = $event-&amp;gt;params['isNewLineItem'];&#xA;&#xA;// Get the line item id that triggered the save from the post request&#xA;// (this will only exist if we're updated a line item that currently exists)&#xA;$lineItemId = craft()-&amp;gt;request-&amp;gt;getPost( 'lineItemId' );&#xA;&#xA;// If the current line item being saved is new&#xA;// OR&#xA;// If its an existing line item and matches the one that triggered the event&#xA;if ( $isNewLineItem || $item-&amp;gt;id == $lineItemId ) {&#xA;  //rest of the code&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then looked to see if the option was in the post request. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$text = craft()-&amp;gt;request-&amp;gt;getPost( 'options.Text' );&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it wasn't I added a flash message and stopped the action.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;performAction = false;&#xA;craft()-&amp;gt;userSession-&amp;gt;setFlash( &quot;itemError&quot;, &quot;You must add some text before adding this product to your basket&quot; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-29T14:11:36.343" LastActivityDate="2016-06-29T14:11:36.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15689" PostTypeId="2" ParentId="15685" CreationDate="2016-06-28T17:04:15.543" Score="2" Body="&lt;p&gt;No such reference currently exists. Your best bet is to backwards-engineer what you see in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the makers of Craft do such a great job of &quot;eating their own dog food&quot;, they've made sure that most of their CSS classes are fairly generic and reusable. So if you see an element that you want to imitate (ie: a button), just inspect the element, and copy its classes.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-28T17:04:15.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15690" PostTypeId="2" ParentId="15612" CreationDate="2016-06-28T17:20:40.650" Score="2" Body="&lt;p&gt;Personally I would use categories for a 'facetted search' filter you describe, as categories are less likely to get out of control. e.g. If tags are seldom re-used then a search for a tag may only produce a single result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin may help you: &lt;a href=&quot;https://github.com/iainurquhart/FacetedNav_CraftPlugin&quot; rel=&quot;nofollow&quot;&gt;https://github.com/iainurquhart/FacetedNav_CraftPlugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're going to use tags then I suggest making use of Craft's search functionality as this will allow you to submit the tag as a search term and &lt;strong&gt;also display any entries which contain the word/tag in ANY field&lt;/strong&gt; of the entries within Craft.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-28T17:20:40.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15692" PostTypeId="1" AcceptedAnswerId="15693" CreationDate="2016-06-28T20:25:40.667" Score="6" ViewCount="716" Body="&lt;p&gt;In looking at the the &lt;code&gt;BaseElementModel:getDescendants()&lt;/code&gt; method and saw it checks for eager loading elements named 'descendants.'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Eager-loaded?&#xA;if ($this-&amp;gt;hasEagerLoadedElements('descendants'))&#xA;{&#xA;    return $this-&amp;gt;getEagerLoadedElements('descendants');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added &lt;code&gt;with&lt;/code&gt; and the &lt;code&gt;descendants&lt;/code&gt; condition to a Structure and the page is now loading with a few less queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'sectionHandle',&#xA;    limit: null,&#xA;    with: [&#xA;        'descendants'&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anybody explain what is happening here?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-06-28T23:19:19.203" Title="Eager Loading a Structure and descendants" Tags="&lt;structure&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15693" PostTypeId="2" ParentId="15692" CreationDate="2016-06-28T23:19:19.203" Score="7" Body="&lt;p&gt;Craft &lt;a href=&quot;https://craftcms.com/changelog#build2789&quot; rel=&quot;noreferrer&quot;&gt;2.6.2789&lt;/a&gt; added this feature, which is seems you've reverse engineered. :)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is now possible to eager-load Structure entries' and categories' descendants using the &lt;code&gt;'descendants'&lt;/code&gt; handle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-28T23:19:19.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15694" PostTypeId="2" ParentId="15682" CreationDate="2016-06-28T23:26:03.157" Score="1" Body="&lt;p&gt;You're getting that error because CSRF validation is failing.  Whether that's a bug in the Dev Preview of Craft 3 or something environmental on your end is hard to tell with the given information.  I can't reproduce it locally, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-28T23:26:03.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15695" PostTypeId="1" AcceptedAnswerId="15699" CreationDate="2016-06-28T23:30:35.207" Score="3" ViewCount="63" Body="&lt;p&gt;Is it possible to use auto-generated subfolders within an asset field? Each time I've tried, I get errors upon submitting the form that seem unrelated and nothing posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just trying to do a simple job application form on our website and I'd like to have the file dumped into the subfolders: &lt;code&gt;{jobID}\{email}&lt;/code&gt; (&lt;code&gt;jobID&lt;/code&gt; is passed in as a hidden field), this way I know there won't be any issues uploading files unless the same person applies multiple times to the same position in which I guess I could put a timestamp on there as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried those simple variables mentioned above, and I've also tried &lt;code&gt;{object.jobID}\{object.email}&lt;/code&gt; but no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2177" LastActivityDate="2016-06-29T04:44:25.097" Title="Using Asset folder variables with Sprout Forms" Tags="&lt;assets&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15696" PostTypeId="1" CreationDate="2016-06-29T00:19:32.027" Score="1" ViewCount="206" Body="&lt;p&gt;I need to set up a custom route for a particular page, but can't seem to get anything to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I set up this route:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rQfBl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rQfBl.png&quot; alt=&quot;busted routes&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I gather, this should match just about anything... &lt;code&gt;mysite.dev/hello&lt;/code&gt;, or &lt;code&gt;mysite.dev/goodbye&lt;/code&gt;. But no matter what I try, I get tossed back to my index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only theory right now is that the Craft url structure is strange. I navigate around just fine, but there is no rewrite happening. So instead of &lt;code&gt;http://mysite.dev/site-sections/we-work-on&lt;/code&gt;, it's &lt;code&gt;http://mysite.dev/index.php?p=site-sections/we-work-on&lt;/code&gt;. I think this is because I'm developing on a Homestead box, which uses nginx and not apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do dynamic routes depend on url rewriting?&lt;/p&gt;&#xA;" OwnerUserId="5341" LastActivityDate="2016-06-29T23:05:00.950" Title="Do dynamic routes depend on url rewriting?" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15697" PostTypeId="1" CreationDate="2016-06-29T00:53:43.817" Score="2" ViewCount="81" Body="&lt;p&gt;Consider a site with a very flat hierarchy that has a lot of basic pages. Most pages on the site are extremely similar, so they can all share the same entry type (and thus, fields) without problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, there are a few pages that have &lt;em&gt;wildly&lt;/em&gt; unique content layouts. There's special content that will only ever be used on these pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, there's a few solutions to this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use a Matrix field in the Page entry type and add a block for each special page you need. This lets you build the unique pages, but for the dozens of other &quot;normal&quot; pages it becomes very weird and unnatural (plus there's nothing stopping the client from erroneously adding the 'special page' Matrix blocks on non special pages).&lt;/li&gt;&#xA;&lt;li&gt;Using multiple entry types, but this is also a bit clunky and would mean have to using a Channel or Structure.&lt;/li&gt;&#xA;&lt;li&gt;Use Global sets (one for each special page). Also a bit of a dirty workaround.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a cleaner way to achieve &quot;one-off&quot; fields that are used only by a specific entry? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another CMS - Bolt - has a solid solution to this: &lt;a href=&quot;https://docs.bolt.cm/2.2/templates/building-templates#template-specific-fields&quot; rel=&quot;nofollow&quot;&gt;Template Specific Fields&lt;/a&gt;. As another example: using WordPress with ACF, you can assign field layouts on a per-entry basis if required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping something similar could be achieved in Craft.&lt;/p&gt;&#xA;" OwnerUserId="4161" LastActivityDate="2016-06-29T03:12:12.500" Title="Defining fields on a per-entry basis?" Tags="&lt;entries&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15698" PostTypeId="2" ParentId="15697" CreationDate="2016-06-29T03:12:12.500" Score="3" Body="&lt;p&gt;Let's start by saying what you &lt;strong&gt;don't&lt;/strong&gt; want to do...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Don't use Matrix blocks to solve this problem. As you mentioned, the Matrix field would get pretty crazy, and you couldn't prevent people from using the wrong blocks in the wrong places.&lt;/li&gt;&#xA;&lt;li&gt;Don't use Globals to solve this problem. Global fields get loaded automatically on every page load, so you're bound to add a lot of extra page weight that doesn't need to be there.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To me, it sounds like &lt;strong&gt;entry types&lt;/strong&gt; are the perfect solution. You can have multiple entry types which all share the same fields, but then add extra fields to the entry types which specifically need them. If I'm understanding your problem correctly, it's exactly what entry types were created to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, you mention needing a Channel or Structure to use entry types. This is 100% true, but it makes me wonder... Are you currently just using Singles? If you're currently using Singles, then this should be a non-issue... each Single is basically a unique entry type anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, let me know if I missed something.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-29T03:12:12.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15699" PostTypeId="2" ParentId="15695" CreationDate="2016-06-29T03:15:02.047" Score="2" Body="&lt;p&gt;I have created a form with a hidden field and asset field. The hidden field appears before the asset field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s4qhU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s4qhU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll want to make the email field required because we are using that field in the auto-generated subfolders. (if it is empty it will generate an error)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Place a forward slash in before the folder location of the asset field: &lt;code&gt;/{jobid}/{email}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a2KZf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a2KZf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;object&lt;/code&gt; variable will not work in the Sprout Forms context. We can use the field handle (&lt;code&gt;{id}&lt;/code&gt;, &lt;code&gt;{name}&lt;/code&gt;...) or the &lt;code&gt;form&lt;/code&gt; object (&lt;code&gt;{form.id}&lt;/code&gt;, &lt;code&gt;{form.name}&lt;/code&gt;...) if you want to be more specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards.&lt;/p&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="115" LastEditDate="2016-06-29T04:44:25.097" LastActivityDate="2016-06-29T04:44:25.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15700" PostTypeId="1" AcceptedAnswerId="15704" CreationDate="2016-06-29T07:34:23.750" Score="2" ViewCount="169" Body="&lt;p&gt;I have just started reviewing this plugin for e-commerce development. Fully featured though it is, I wanted to know if Craft Commerce can also support custom auth (login and registration) features such as &lt;strong&gt;One Time Password&lt;/strong&gt; using a mobile cell number and &lt;strong&gt;Social Login&lt;/strong&gt; through facebook and twitter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to build or use an existing plugin around these features?&lt;/p&gt;&#xA;" OwnerUserId="597" LastActivityDate="2016-06-29T08:49:52.093" Title="Does Craft Commerce support One Time Password and Social Login features?" Tags="&lt;plugin-craftcommerce&gt;&lt;registration&gt;&lt;authentication&gt;&lt;plugin-social-login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15701" PostTypeId="1" AcceptedAnswerId="15702" CreationDate="2016-06-29T08:05:33.020" Score="4" ViewCount="1255" Body="&lt;p&gt;Using the Pixel &amp;amp; Tonic &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;Contact Form&lt;/a&gt; plugin, I added a config file (&lt;code&gt;config/contactform.php&lt;/code&gt;) to override plugin settings from the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to change some settings if devMode is enabled : recipients from the contact form plugin, to separate my tests addresses from my client addresses.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$recipients = array(&#xA;    'devMode' =&amp;gt; 'example@domain.com,example@domain.com',&#xA;    'prodMode' =&amp;gt; 'john@doe.com,jean@dupont.com'&#xA;);&#xA;&#xA;if (devMode == true) {&#xA;    $recipients = $recipients['devMode'];&#xA;} else {&#xA;    $recipients = $recipients['prodMode'];&#xA;}&#xA;&#xA;return array(&#xA;    'toEmail' =&amp;gt; ($recipients ?: null),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I check if &lt;strong&gt;devMode == true&lt;/strong&gt;? Can I access to this value using &lt;code&gt;craft()-&amp;gt;config&lt;/code&gt; or something else that?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="57" LastEditDate="2016-06-29T17:02:56.437" LastActivityDate="2018-05-15T21:43:02.730" Title="How can I check from a plugin config file if devMode is enabled?" Tags="&lt;plugin-development&gt;&lt;config&gt;&lt;php&gt;&lt;plugin-contactform&gt;&lt;devmode&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15702" PostTypeId="2" ParentId="15701" CreationDate="2016-06-29T08:28:56.847" Score="8" Body="&lt;p&gt;It's as simple as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( craft()-&amp;gt;config-&amp;gt;get( 'devMode' ) )&#xA;{&#xA; //do stuff&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-29T17:17:35.857" LastActivityDate="2016-06-29T17:17:35.857" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15703" PostTypeId="1" CreationDate="2016-06-29T08:49:45.813" Score="2" ViewCount="1021" Body="&lt;p&gt;I would like to know if it's possible to select multiple entries and update a field for them all at once – for example, give all the selected entries the same category.&lt;/p&gt;&#xA;" OwnerUserId="4956" LastEditorUserId="5437" LastEditDate="2017-01-17T01:04:50.980" LastActivityDate="2018-09-06T18:37:38.127" Title="Is it possible to bulk-edit a field across multiple entries at once?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;editor&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15704" PostTypeId="2" ParentId="15700" CreationDate="2016-06-29T08:49:52.093" Score="2" Body="&lt;p&gt;Craft Pro gives you the ability to add multiple user accounts to your site. Craft Commerce is a plugin that extends Craft so user accounts and everything that goes with them are available to use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow&quot;&gt;plugin to enable social logins&lt;/a&gt; (currently in beta) made by Dukt that you may find helpful.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-29T08:49:52.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15705" PostTypeId="1" CreationDate="2016-06-29T09:12:41.263" Score="1" ViewCount="252" Body="&lt;p&gt;I'm trying to debug why certain pages on a site are slow using the 'Profiling Summary Report' data that is logged to the console when devMode is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For easy viewing, I've tried to output the values in a flash message on the front end of the site using the following code, placed in the &lt;code&gt;init()&lt;/code&gt; function of a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( craft()-&amp;gt;config-&amp;gt;get( 'devMode' ) &amp;amp;&amp;amp; craft()-&amp;gt;request-&amp;gt;isSiteRequest() )&#xA;{&#xA;  $debugInfo = 'Time: ' . sprintf( '%0.5f', Craft::getLogger()-&amp;gt;getExecutionTime() ) . 's' . &quot;\n&quot;;&#xA;  $debugInfo .= ' — ' . 'Memory: ' . number_format( Craft::getLogger()-&amp;gt;getMemoryUsage() / 1024 ) . 'Kb';&#xA;  $debugInfo .= ' — ' . 'Queries: ' . count( Craft::getLogger()-&amp;gt;getLogs( '', 'system.db.CDbCommand' ) );&#xA;  craft()-&amp;gt;userSession-&amp;gt;setFlash( 'debug', $debugInfo );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They successfully log values (that look correct for seconds, kb's and query counts) but they are different to what is displayed in the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: These are the values from 4 different page loads. I have a suspicion that these are referring to a different process, not the current page, as they're too consistent.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Time: 0.14093s — Memory: 12,458Kb — Queries: 5&#xA;Time: 0.14069s — Memory: 12,217Kb — Queries: 5&#xA;Time: 0.13179s — Memory: 12,218Kb — Queries: 5&#xA;Time: 0.13125s — Memory: 12,218Kb — Queries: 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anybody know why this might be? I had a feeling it was logging the values of a different process to the console. Is &lt;code&gt;getLogger()&lt;/code&gt; relative to where it's called?&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-29T17:15:10.627" LastActivityDate="2016-06-29T17:15:10.627" Title="Showing Profiling Summary Report data in the frontend" Tags="&lt;devmode&gt;&lt;debugging&gt;&lt;logging&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15706" PostTypeId="1" CreationDate="2016-06-29T09:35:31.143" Score="1" ViewCount="29" Body="&lt;p&gt;I have a site where users can register and login. But in link 70% of the cases the accountVerification e-mail is not sent properly, resulting in users can't verify their account and thus can't login. They all get an Exception page when visiting the link. Below is the not properly formatted link (mark the “id” part):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/actions/users/setpassword/?code=5QJ_3LUkVKkUpX2OVJITkFScUzYFxjnC&amp;amp;id;=49d83ace-1b12-45fa-a24a-9882c0027321&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error in the logs is like this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'Parameter &quot;id&quot; bestaat niet.' in /home/xxxxxx/craft/app/services/HttpRequestService.php:586&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can’t seem to find a solution for this and actually expect I can’t be the only one with this problem. In the e-mail I'm already giving the users two links to verify their account, one normal &lt;code&gt;{{ link }}&lt;/code&gt; tag and an &lt;code&gt;{{ link | escape }}&lt;/code&gt; tag. But it still doesn’t work. Maybe anyone of you can help me? Would be great, thanks!&lt;/p&gt;&#xA;" OwnerUserId="3937" LastActivityDate="2016-06-29T09:35:31.143" Title="Links in e-mails are not properly formatted" Tags="&lt;emails&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15707" PostTypeId="1" AcceptedAnswerId="15877" CreationDate="2016-06-29T09:48:32.793" Score="0" ViewCount="136" Body="&lt;p&gt;In the Address section I have been defining UK counties to populate the State field when a Country is selected. I noticed that there is a standard text input when there is no defined states/regions/areas for a country and a drop down field for states when there is defined states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a country like the US or the UK is selected both fields are shown however ideally it should only be the dropdown. See image of the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fOKke.png&quot; alt=&quot;screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any logic that can be added to toggle it on/off ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;{{ modelName }}-state&quot;&amp;gt;County / State / Region&amp;lt;/label&amp;gt;&#xA;&#xA;{% set options = (model and states[model.countryId] is defined ? states[model.countryId] : []) %}&#xA;&amp;lt;select id=&quot;{{ modelName }}-stateId&quot; data-modelname=&quot;{{ modelName }}&quot; class=&quot;address-stateId u-full-width {% if options|length == 0 or (model and model.stateName) %}hidden{% endif %}&quot; name=&quot;{{ modelName }}[stateValue]&quot;&amp;gt;&#xA;  {% for key, option in options %}&#xA;    {% set optionValue = (model ? model.stateId : '') %}&#xA;    &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %}selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; data-modelname=&quot;{{ modelName }}&quot; id=&quot;{{ modelName }}-stateName&quot; class=&quot;address-stateName {% if options|length &amp;gt; 0 or (model and model.stateId) %}hidden{% endif %} u-full-width&quot; {% if model and model.stateName %}name=&quot;{{ modelName }}[stateValue]&quot; value=&quot;{{ model.stateName}}&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorDisplayName="user1080" LastEditDate="2017-06-02T06:39:44.443" LastActivityDate="2017-06-02T06:39:44.443" Title="Craft Commerce: Duplicate Input for Address State?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15708" PostTypeId="1" AcceptedAnswerId="15721" CreationDate="2016-06-29T10:08:25.310" Score="2" ViewCount="383" Body="&lt;p&gt;I'm trying to update an old site that is still running on Craft 2.2 (from September 2014), but unfortunately the update process to the current version (2.6) breaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any experience of upgrading a Craft site from several versions back? I'm thinking my best bet might be to try doing it in a series of steps by downloading intermediate versions from &lt;a href=&quot;https://craftcms.com/support/download-previous-versions&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. I'm wondering though if there are particular version numbers that are good milestones for updating (or best avoided)? (I half remember a version that had to be manually installed a while back) Or alternatively, whether there's a better approach I haven't thought of?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; the problematic step seems to be upgrading to 2.5. I've managed to run updates up to the last build of 2.4 but the jump from 2.4 to 2.5 always seems to fail. The error message is just &quot;There was a problem updating your database&quot;, so it's hard to know what exactly is going wrong.&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="328" LastEditDate="2016-06-29T15:42:28.070" LastActivityDate="2016-06-29T16:58:42.260" Title="How to update from a very old version of Craft?" Tags="&lt;updating&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15709" PostTypeId="1" AcceptedAnswerId="15712" CreationDate="2016-06-29T10:45:46.640" Score="1" ViewCount="153" Body="&lt;p&gt;I'm looping through a Matrix field called Documents. The matrix has three fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Document (an asset field)&lt;/li&gt;&#xA;&lt;li&gt;Document Title (plain text field)&lt;/li&gt;&#xA;&lt;li&gt;Document Type (a category field)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I need to loop through the matrix and output all the rows, but grouped by Document Type. This seems like it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set grouped = entry.documents | group('documentType.title') %}&#xA;&#xA;{% for categoryTitle, groupedRows in grouped %}&#xA;    TITLE HERE: {{ categoryTitle }}&#xA;&#xA;    {% for document in groupedRows %}&#xA;        &amp;lt;br/&amp;gt;{{ document.documentTitle }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that &lt;code&gt;{{ categoryTitle }}&lt;/code&gt; is blank. Nothing in it. The code runs, but the key is blank. The grouped rows are populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="4466" LastEditDate="2016-06-29T11:17:05.313" LastActivityDate="2016-06-29T11:58:20.340" Title="Why does my Twig for loop not get a Key?" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15710" PostTypeId="2" ParentId="15708" CreationDate="2016-06-29T11:02:06.380" Score="1" Body="&lt;p&gt;It should just work - but I've had a few instances where the automatic one wouldn't work and had to go manual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We had one which simply wouldn't work at all - that was a 2.2 to 2.6 upgrade, and it failed when trying to do the database every single time. We rebuilt it from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on exactly how it's breaking for you would help.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-06-29T11:02:06.380" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15711" PostTypeId="2" ParentId="15709" CreationDate="2016-06-29T11:30:28.030" Score="2" Body="&lt;p&gt;I'm guessing that you'd like &lt;code&gt;{{ categoryTitle }}&lt;/code&gt; to be the current groups &lt;code&gt;documentType.title&lt;/code&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, I would output &lt;code&gt;document.documentType&lt;/code&gt; for the first document in each group using &lt;code&gt;{% if loop.first %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complete code suggestion would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set grouped = entry.documents|group('documentType.first().title') %}&#xA;&#xA;{% for groupedRows in grouped %}&#xA;  {% for document in groupedRows %}&#xA;    {% if loop.first %}&#xA;      {{ document.documentType }}&#xA;    {% endif %}&#xA;    {{ document.documentTitle }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; updated to use &lt;a href=&quot;https://craftcms.stackexchange.com/a/15712/4466&quot;&gt;carlcs&lt;/a&gt; group filter suggestion.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-06-29T11:58:20.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15712" PostTypeId="2" ParentId="15709" CreationDate="2016-06-29T11:31:37.490" Score="2" Body="&lt;p&gt;That &lt;code&gt;documentType&lt;/code&gt; in your group filter returns a criteria model prepared to query for categories related to that Matrix block. Use the &lt;code&gt;first()&lt;/code&gt; method to try and get the first element matching your criteria and you can now access a property like the category’s title.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set grouped = entry.documents|group('documentType.first().title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is also dangerous, as it might happen that a Matrix block does not have a category assigned (may be that this category got deleted). Here’s how you could improve it and write the code a bit more defensively.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set grouped = entry.documents|group('{ documentType.first() ? documentType.first().title : 'No categories }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-29T11:31:37.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15713" PostTypeId="1" CreationDate="2016-06-29T11:34:29.977" Score="2" ViewCount="889" Body="&lt;p&gt;The source website is in ExpressionEngine and I know how to get data out, but I don't know how to structure it and succesfully import entries into Craft where assets and categories also imported. I have tried the plugin FeedMe (XML) and I also tried the plugin Import (SVG).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to work with categories and sub categories an how to use multiple assets with import? Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&#xA;    &amp;lt;products&amp;gt;&#xA;        &amp;lt;entry&amp;gt;&#xA;            &amp;lt;title&amp;gt;My product title&amp;lt;/title&amp;gt;&#xA;            &amp;lt;slug&amp;gt;my-product-title&amp;lt;/slug&amp;gt;&#xA;            &amp;lt;body&amp;gt;&amp;lt;![CDATA[&amp;lt;p&amp;gt;My body text&amp;lt;/p&amp;gt;]]&amp;gt;&amp;lt;/body&amp;gt;&#xA;            &amp;lt;assets&amp;gt;&#xA;                &amp;lt;![CDATA[&#xA;                    http://www.mywebsite.nl/root/path/image1.png,&#xA;                    http://www.mywebsite.nl/root/path/image2.png&#xA;                ]]&amp;gt;&#xA;            &amp;lt;/assets&amp;gt;&#xA;            &amp;lt;category&amp;gt;&#xA;                &amp;lt;![CDATA[&#xA;                   Lightning,&#xA;                   Cities,&#xA;                   Standard,&#xA;                   Special&#xA;                ]]&amp;gt;&#xA;            &amp;lt;/category&amp;gt;&#xA;        &amp;lt;/entry&amp;gt;&#xA;    &amp;lt;/products&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2016-06-29T12:02:25.397" Title="How do I create a well formed CSV or XML to succesfully import entries with assets and categories?" Tags="&lt;import&gt;&lt;plugin-feedme&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15714" PostTypeId="2" ParentId="15713" CreationDate="2016-06-29T12:02:25.397" Score="2" Body="&lt;p&gt;I used FeedMe successfully and this is what I used. The images have to be already present as assets in Craft(ftp and then update asset indexes). Having the full url in the images part stumped me too. In this example I pulled the images twice because in my EE build I was using the first image of many to create a preview image and in craft I actually created a preview image field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;entry&amp;gt;&#xA;    &amp;lt;entry_date&amp;gt;{entry_date format=&quot;{DATE_ATOM}&quot;}&amp;lt;/entry_date&amp;gt;&#xA;    &amp;lt;title&amp;gt;{title}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;slug&amp;gt;{url_title}&amp;lt;/slug&amp;gt;&#xA;    &amp;lt;price&amp;gt;{product_price}&amp;lt;/price&amp;gt;&#xA;    &amp;lt;dimensions&amp;gt;{product_dimensions}&amp;lt;/dimensions&amp;gt;&#xA;    &amp;lt;description&amp;gt;{product_description}&amp;lt;/description&amp;gt;&#xA;    &amp;lt;notes&amp;gt;{private_notes}&amp;lt;/notes&amp;gt;&#xA;    &amp;lt;location&amp;gt;{product_location:title}&amp;lt;/location&amp;gt;&#xA;    &amp;lt;number&amp;gt;{product_number}&amp;lt;/number&amp;gt;&#xA;    &amp;lt;message&amp;gt;&amp;lt;![CDATA[{product_message}{option}, {/product_message}]]&amp;gt;&amp;lt;/message&amp;gt;&#xA;    &amp;lt;status&amp;gt;{status}&amp;lt;/status&amp;gt;&#xA;    &amp;lt;category&amp;gt;&amp;lt;![CDATA[{categories}{category_name}, {/categories}]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&#xA;    &amp;lt;images&amp;gt;&amp;lt;![CDATA[ &#xA;    {finalproductimages}&#xA;        {filename}.{extension},&#xA;    {/finalproductimages}]]&amp;gt;&amp;lt;/images&amp;gt;&#xA;&#xA;    &amp;lt;preview&amp;gt;&amp;lt;![CDATA[ &#xA;    {finalproductimages limit=&quot;1&quot;}&#xA;        {filename}.{extension},&#xA;    {/finalproductimages}]]&amp;gt;&amp;lt;/preview&amp;gt;&#xA;&#xA;&#xA;&#xA;&amp;lt;/entry&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-06-29T12:02:25.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15715" PostTypeId="1" CreationDate="2016-06-29T12:39:46.767" Score="1" ViewCount="331" Body="&lt;p&gt;I'm creating a portfolio page, and I have a summary list of project entries displayed. At the top of the page, I've got a dropdown displaying a Category field. e.g. &lt;code&gt;craft.categories.group('industry')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: Is it possible to display/filter entries of a particular category dynamically/immediately when a dropdown entry is selected (using only Twig)? Or do I have to use Javascript?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for this basic question.&lt;/p&gt;&#xA;" OwnerUserId="5344" LastActivityDate="2016-06-29T17:58:17.080" Title="Filter Entries within a page dynamically based on category" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15716" PostTypeId="1" AcceptedAnswerId="15717" CreationDate="2016-06-29T13:21:14.250" Score="2" ViewCount="429" Body="&lt;p&gt;If I have a lineItem that needs some validation, for example on an option or note filed, how do I show potential errors in a template and repopulate the form with the posted values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I’m working with a template that has multiple products on a page and uses &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow&quot;&gt;MulitAdd&lt;/a&gt; to add items to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m validating lineItem data using &lt;code&gt;onBeforeSaveLineItem&lt;/code&gt; and adding the error with something similar to &lt;code&gt;$lineItem-&amp;gt;addError('text','This is required');&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="374" LastActivityDate="2016-06-29T14:47:59.893" Title="Show lineItem error(s) in template?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15717" PostTypeId="2" ParentId="15716" CreationDate="2016-06-29T14:40:01.710" Score="3" Body="&lt;p&gt;To repopulate the form fields you can use the data from the post request using something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;value=&quot;{{ craft.request.getPost( 'options.text' ) }}&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also think I've got a rough solution for handling the errors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Add the cart to your event&#xA;$cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&#xA;//Check for field/fields&#xA;$text = craft()-&amp;gt;request-&amp;gt;getPost( 'options.text' );&#xA;&#xA;//Check if it's got a value&#xA;if ( $text === '' )&#xA;{&#xA;  $event-&amp;gt;performAction = false;&#xA;&#xA;  //Build the handle we'll attach the error to&#xA;  //Use the purchasable id (variant) and then add the field we're checking for&#xA;  $lineItemErrorHandle = $item-&amp;gt;purchasable-&amp;gt;id . '-options[text]';&#xA;&#xA;  //Add the error to the cart&#xA;  $cart-&amp;gt;addError( $lineItemErrorHandle, 'The text is required' );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template you display it with the following where &lt;code&gt;product.defaultVariant.id&lt;/code&gt; needs to be the id of the purchasable that attempted to be added to the cart.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set string = product.defaultVariant.id ~ '-options[text]' %}&#xA;{% if cart.getError( string ) %}&#xA;  We've got an error its {{ cart.getError( string ) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had to build the string outside of the &lt;code&gt;.getError&lt;/code&gt; method because string interpolation wouldn't work using &lt;code&gt;'#{product.defaultVariant.id}-options[text]'&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-06-29T14:47:59.893" LastActivityDate="2016-06-29T14:47:59.893" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15718" PostTypeId="1" AcceptedAnswerId="15723" CreationDate="2016-06-29T14:44:12.943" Score="3" ViewCount="167" Body="&lt;p&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser&lt;/code&gt; seems to check email for uniqueness across ALL users, not just verified ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like it should only check against verified ones to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;boob@gmail.com registers (only he fat fingered and it was supposed to be bob@gmail.com). Bob never gets his verification email, but that's his fault. Boob gets one, doesn't know what it is and ignores it.&lt;/li&gt;&#xA;&lt;li&gt;Later, the real boob@gmail.com now tries to register, but he can't because boob@gmail.com is sitting there unverified, squatting on that email.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At this point you could have an option to resend the activation code, however once boob@gmail.com get that and verifies it, his account will now be the account that the other guy actually signed up for, so if you're doing stuff with accounts, it might have data associated with it you don't want.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-06-29T17:29:13.700" Title="Unverified emails blocking user registration" Tags="&lt;users&gt;&lt;emails&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15719" PostTypeId="1" CreationDate="2016-06-29T15:29:00.680" Score="3" ViewCount="453" Body="&lt;p&gt;I started to develop my new Craft site in two languages (French &amp;amp; German). Once done here, I have to put the website online temporarily in one of these two languages (French).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I turned off all sections and entries to disable the language (German) but:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This was tedious and time consuming to do this manually via the CP&lt;/li&gt;&#xA;&lt;li&gt;domain.com/de/ now redirects to the homepage with empty content instead of redirect to the 404 page&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Questions :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a faster and safer way to temporarily disable a website language with the General Config Settings?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to disable some website languages depending on the environment and / or if devMode is enabled?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2016-06-30T07:46:53.167" LastActivityDate="2016-06-30T09:42:47.473" Title="Can I disable languages from the General Config Settings?" Tags="&lt;config&gt;&lt;redirect&gt;&lt;language&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15721" PostTypeId="2" ParentId="15708" CreationDate="2016-06-29T16:58:42.260" Score="4" Body="&lt;p&gt;Ok, after a lot of trial and error I've finally managed to get this site upgraded. Here's a rough outline of the process and what the problem turned out to be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, I tried updating one minor version at a time. This led me to find that the problem seemed to be with updating from the last build of 2.4 to the first build of 2.5&lt;/li&gt;&#xA;&lt;li&gt;The error message on update wasn't super helpful (&quot;There was a problem updating your database&quot;), but by trawling through Craft's log file (&lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt;) I found that the update seemed to be failing when trying to create the table &lt;code&gt;elementindexsettings&lt;/code&gt; because (for whatever reason) that table already existed (resulting in the error &lt;em&gt;Failed to apply migration: m150827_000000_element_index_settings&lt;/em&gt;).&lt;/li&gt;&#xA;&lt;li&gt;I can't think why this would be the case, since after each failed update attempt I fully restored my previous database, but since my &lt;code&gt;elementindexsettings&lt;/code&gt; table was empty, I dropped it and tried the update again. At this point it worked.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So in summary, the solution was:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Update to Craft 2.4.2726 (and commit this to version control!)&lt;/li&gt;&#xA;&lt;li&gt;Attempt a manual update to Craft 2.5.2750. When this fails, drop the &lt;code&gt;elementindexsettings&lt;/code&gt; table and try running the update again (ie. go to &lt;code&gt;/admin&lt;/code&gt; and press the &quot;Finish up&quot; button.&lt;/li&gt;&#xA;&lt;li&gt;Update to the latest version.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As a side note, I found setting Craft's &lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;backupDbOnUpdate&lt;/code&gt;&lt;/a&gt; config setting to &lt;code&gt;false&lt;/code&gt; made the update process much faster and less painful when having to do a lot of attempted updates followed by rollbacks (though obviously if doing this be careful to make sure you have a backup you can restore if the process goes wrong).&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2016-06-29T16:58:42.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15722" PostTypeId="2" ParentId="15703" CreationDate="2016-06-29T17:14:21.457" Score="1" Body="&lt;p&gt;Via a plugin, yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via the control panel interface, no.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-29T17:14:21.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15723" PostTypeId="2" ParentId="15718" CreationDate="2016-06-29T17:29:13.700" Score="3" Body="&lt;p&gt;I'm not sure that I agree with your analysis.  At a minimum maybe it's a &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt; with a config setting to change the behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you're really concerned about the behavior, you can currently set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#purgePendingUsersDuration&quot; rel=&quot;nofollow&quot;&gt;purgePendingUsersDuration&lt;/a&gt; config setting to something like 24 hours so they don't hang around very long.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-29T17:29:13.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15724" PostTypeId="2" ParentId="15715" CreationDate="2016-06-29T17:58:17.080" Score="1" Body="&lt;p&gt;You will need to use some JavaScript, since all twig code is parsed on the server and sent to the browser as HTML.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-06-29T17:58:17.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15725" PostTypeId="2" ParentId="1654" CreationDate="2016-06-29T21:03:48.677" Score="6" Body="&lt;p&gt;Check out &lt;a href=&quot;https://github.com/engram-design/FieldManager&quot;&gt;https://github.com/engram-design/FieldManager&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking for a way to duplicate a matrix field to make another variant. This works perfectly for cloning fields and seems to have Export/Import options with a good UI for selecting which field you want to export.&lt;/p&gt;&#xA;" OwnerUserId="4739" LastActivityDate="2016-06-29T21:03:48.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15726" PostTypeId="2" ParentId="15696" CreationDate="2016-06-29T23:05:00.950" Score="2" Body="&lt;p&gt;I first attempted, with the link Mats &lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;posted&lt;/a&gt;, to edit my nginx config. That resulted in a rather terrifying &quot;can't even find the index&quot; error, but there was a silver lining: after destroying and recreating my Vagrant the urls mysteriously fixed themselves, and I no longer see querystrings on the index. Custom routes also now work. So that's mysterious but I'll take it for now.&lt;/p&gt;&#xA;" OwnerUserId="5341" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-06-29T23:05:00.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15727" PostTypeId="2" ParentId="8208" CreationDate="2016-06-30T03:16:37.757" Score="5" Body="&lt;p&gt;This is how I did it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In my custom plugin, in its &lt;code&gt;init&lt;/code&gt; function, I use the following statement to hook into the before delete event: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeDeleteElements', array($this, 'beforeDeleteElements'));&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the same custom plugin, in the &lt;code&gt;beforeDeleteElements&lt;/code&gt; function mentioned in step 1, I examine the passed in event, and determine if the entry type being deleted is the entry type I am interested in, if so, I use the following function to find the related assets and then delete them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function deleteRelatedImages(EntryModel $entry)&#xA;{&#xA;    $criteria            = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;    $criteria-&amp;gt;relatedTo = $entry;&#xA;    $assets              = $criteria-&amp;gt;find();&#xA;&#xA;    if (!$assets) {&#xA;        return;&#xA;    }&#xA;&#xA;    foreach ($assets as $asset) {&#xA;        $sourceType = $asset-&amp;gt;getSource()-&amp;gt;getSourceType();&#xA;        $sourceType-&amp;gt;deleteFile($asset);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3834" LastActivityDate="2016-06-30T03:16:37.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15728" PostTypeId="2" ParentId="15719" CreationDate="2016-06-30T08:17:52.403" Score="2" Body="&lt;p&gt;How about hiding the language switcher on the front-end?&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-06-30T08:17:52.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15729" PostTypeId="1" CreationDate="2016-06-30T08:18:55.940" Score="2" ViewCount="306" Body="&lt;p&gt;According to the Contact Form plugin docs, I can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ 'name@domain.com, name2@domain2.com' | hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That seems to work fine, but one of those email addresses I want to add dynamically. I've tried the following, but none seem to work, generally sending to just the second email address:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# adding first email as var #}&#xA;{% set firstEmail = 'name@domain.com' %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ firstEmail ~ ', name2@domain2.com' | hash }}&quot;&amp;gt;%}&#xA;&#xA;{# adding first email as var and avoiding | hash #}&#xA;{% set firstEmail = 'name@domain.com' %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ firstEmail ~ ', name2@domain2.com' }}&quot;&amp;gt;%}&#xA;&#xA;{% set firstEmail = 'name@domain.com' %}&#xA;{% set emails = firstEmail ~ ', name2@domain2.com' %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ emails | hash }}&quot;&amp;gt;&#xA;{# RESULT: &amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;505103f2971d445c709c131b8eee0a59e3ff668bname@domain.com, name2@domain2.com&quot;&amp;gt;#}&#xA;&#xA;{# adding first email as var with extra quotes #}&#xA;{% set firstEmail = 'name@domain.com' %}&#xA;{% set emails = &quot;'&quot; ~ firstEmail ~ &quot;, name2@domain2.com'&quot; %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ emails | hash }}&quot;&amp;gt;&#xA;{# RESULT: &amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;e3a44b3632212521351d8d44af34742a63f6516e'name@domain.com, name2@domain2.com'&quot;&amp;gt; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-06-30T11:29:03.213" LastActivityDate="2016-06-30T11:55:42.957" Title="Adding dynamic second email address to Contact Form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15730" PostTypeId="2" ParentId="15719" CreationDate="2016-06-30T09:42:47.473" Score="2" Body="&lt;p&gt;What I would probably do is to create a new branch in version control that you can deploy to production as long as you have to disable the locales. The reason for this is that there are probably too many things you have to change in code and I wouldn’t want to clutter it with a lot of conditionals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that new branch you would have to delete the index.php for the locales you want to disable to make all these URLs respond with a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then remove all the references to the locale from your templates. Remove the language switcher altogether or remove just the locales you want to disable from the switcher code, e.g. remove the 'de' from &lt;code&gt;{% for locale in ['en', 'fr', 'de'] %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the above changes in place, you wouldn’t have to disable on a per entry basis.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-30T09:42:47.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15731" PostTypeId="1" CreationDate="2016-06-30T10:53:51.957" Score="6" ViewCount="1362" Body="&lt;p&gt;I have created AJAX page transitions based on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;noreferrer&quot;&gt;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's all working nicely, the main content of the site (everything except the header) is loaded through ajax with a page transition using velocity.js.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how would I go about getting all the metadata (or intact any of the information stored in  to refresh for each page. At the moment the meta data is stuck with whatever is there when the browser loads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this isn't specifically craft but any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scott&lt;/p&gt;&#xA;" OwnerUserId="5195" LastActivityDate="2016-07-01T10:14:07.050" Title="Refreshing meta data when using AJAX page transitions" Tags="&lt;ajax&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15732" PostTypeId="2" ParentId="15731" CreationDate="2016-06-30T11:03:23.787" Score="3" Body="&lt;p&gt;You'll need to send the new pageview to Google Analytics manually on your ajax success. You'll want to read the &lt;a href=&quot;https://developers.google.com/analytics/devguides/collection/analyticsjs/sending-hits&quot; rel=&quot;nofollow&quot;&gt;Google documentation page&lt;/a&gt;, but it can be as simple as added the following line where ga_page is the new url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ga( 'send', 'pageview', ga_page );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-06-30T11:03:23.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15733" PostTypeId="1" CreationDate="2016-06-30T11:17:16.570" Score="1" ViewCount="129" Body="&lt;p&gt;Our User registration is not working correct anymore. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how the Email content part looks after registering a new public user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hallo craft_user.friendlyName,&#xA;danke für das Einrichten eines Benutzerkontos auf craft_siteName. Um &#xA;Ihr Konto zu aktivieren, klicken Sie bitte auf den folgenden Link:&#xA;&#xA;craft_link&#xA;&#xA;Wenn Sie diese Email nicht erwartet haben, ignorieren Sie sie &#xA;bitte einfach.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The markers are not parsed at all. The same result occurs, if I send a second activation mail via the CP.&#xA;It does already work. We started with Craft 2.3 and did all updates to 2.6. I have no idea when and why this happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the part of the (original) &lt;code&gt;/app/translations/de.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'account_activation_body' =&amp;gt; 'Hallo {{user.friendlyName}},&#xA;&#xA;danke für das Einrichten eines Benutzerkontos auf {{siteName}}. Um &#xA;Ihr Konto zu aktivieren, klicken Sie bitte auf den folgenden Link:&#xA;&#xA;{{link}}&#xA;&#xA;Wenn Sie diese E-Mail nicht erwartet haben, ignorieren Sie sie &#xA;bitte einfach.',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2016-06-30T17:19:34.600" LastActivityDate="2016-07-01T07:53:47.243" Title="User activation email markdown not (correctly) parsed, no link etc" Tags="&lt;users&gt;&lt;emails&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15734" PostTypeId="2" ParentId="15733" CreationDate="2016-06-30T11:30:22.833" Score="1" Body="&lt;p&gt;Ok, i found the Email &quot;Message&quot; settings where the wrong markers where (&quot;craft_link&quot; instead of &quot;link&quot; etc.) located.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2016-07-01T07:53:47.243" LastActivityDate="2016-07-01T07:53:47.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15735" PostTypeId="2" ParentId="15731" CreationDate="2016-06-30T11:52:46.600" Score="2" Body="&lt;p&gt;The way I am currently doing this @scott is passing back meta data in the ajax response as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throwing in the Google Analytics line @luke suggested as well!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example Json object:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;meta&quot;:{&#xA;      &quot;title&quot;:&quot;This is the default global title of the site pages. | My Website&quot;,&#xA;      &quot;meta&quot;:{&#xA;        &quot;name&quot;:{&#xA;          &quot;keywords&quot;:&quot;default,global,comma-separated,keywords&quot;,&#xA;          &quot;description&quot;:&quot;This is the default global natural language description of the content on the site pages.&quot;,&#xA;          &quot;dcterms.Identifier&quot;:&quot;http:\/\/mywebsite.com\/competition&quot;,&#xA;          &quot;dcterms.Title&quot;:&quot;This is the default global title of the site pages.&quot;,&#xA;          &quot;dcterms.Subject&quot;:&quot;default,global,comma-separated,keywords&quot;,&#xA;          &quot;dcterms.Date&quot;:&quot;2016-06-30&quot;,&#xA;          &quot;dcterms.Description&quot;:&quot;This is the default global natural language description of the content on the site pages.&quot;&#xA;        },&#xA;        &quot;property&quot;:{&#xA;          &quot;og:type&quot;:&quot;website&quot;,&#xA;          &quot;og:locale&quot;:&quot;en_us&quot;,&#xA;          &quot;og:url&quot;:&quot;http:\/\/mywebsite.com\/competition&quot;,&#xA;          &quot;og:title&quot;:&quot;This is the default global title of the site pages.&quot;,&#xA;          &quot;og:description&quot;:&quot;This is the default global natural language description of the content on the site pages.&quot;,&#xA;          &quot;og:site_name&quot;:&quot;My Website&quot;&#xA;        }&#xA;      },&#xA;      &quot;link&quot;:{&#xA;        &quot;rel&quot;:{&#xA;          &quot;canonical&quot;:&quot;http:\/\/mywebsite.com\/competition&quot;&#xA;        }&#xA;      }&#xA;    },&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through the meta data with JavaScript within you ajax success method. jQuery is used in this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example JS:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $('head').find('title').text(meta.title);&#xA;&#xA;    $.each(meta.link, function(k, v){&#xA;        $.each(v, function(kk, vv){&#xA;            $('head').find('link[' + k + '=&quot;' + kk + '&quot;]').attr('href', vv);&#xA;        });&#xA;    });&#xA;&#xA;    $.each(meta.meta, function(k, v){&#xA;        $.each(v, function(kk, vv){&#xA;            $('meta[' + k + '=&quot;' + kk + '&quot;]').attr('content', vv);&#xA;        });&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-06-30T23:49:12.210" LastActivityDate="2016-06-30T23:49:12.210" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15736" PostTypeId="2" ParentId="15729" CreationDate="2016-06-30T11:55:42.957" Score="1" Body="&lt;p&gt;Both, the example from the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;Contact Form docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'me@example.com,me2@example.com'|hash }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and the 3rd example snippet in your question&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEmail = 'me@example.com' %}&#xA;{% set emails = firstEmail ~ ',me2@example.com' %}&#xA;&#xA;{{ emails|hash }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...output exactly the same string for me! So I think you have to search for an answer to your issue elsewhere.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-30T11:55:42.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15737" PostTypeId="1" CreationDate="2016-06-30T14:06:46.723" Score="1" ViewCount="126" Body="&lt;p&gt;I'm looking to create a way to navigate to the next/previous image in an entry's asset range and display only the current asset at one time(starting from first asset).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout.html' %}&#xA;&#xA;{% block main %}&#xA;&#xA;&#xA;&amp;lt;div class=&quot;tr&quot;&amp;gt;&#xA;    {{ entry.title }}&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;row nav&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;&amp;lt;span class=&quot;name&quot;&amp;gt;Emily Ashcroft&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;a class=&quot;head&quot; href=&quot;{{ siteUrl }}comm.html&quot;&amp;gt;Commissions&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=&quot;head&quot; href=&quot;{{ siteUrl }}port.html&quot;&amp;gt;Portraits&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=&quot;head&quot; href=&quot;{{ siteUrl }}pers.html&quot;&amp;gt;Personal&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=&quot;head&quot; href=&quot;{{ siteUrl }}CV.html&quot;&amp;gt;Info&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&amp;lt;!-- left side of window links to previous image if there is one, right side links to next image or asset if there is on --&amp;gt;&#xA;&#xA;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;&amp;lt;div class=&quot;left&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;&amp;lt;div class=&quot;right&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- output current asset only --&amp;gt;&#xA;&#xA;        {% for photo in entry.photos %}&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;centre&quot;&amp;gt;&#xA;         &amp;lt;img id=&quot;slider&quot; src=&quot;{{ photo.first.getUrl() }}&quot; /&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Click on left side of screen and the previous asset is displayed, click on the right and the next asset is output. I'm struggling to figure if I should use a method similar to paginating links to next/prev entries (but I don't think that would work for assets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code is taken from _entry.html page of a section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help provided.&lt;/p&gt;&#xA;" OwnerUserId="5350" LastActivityDate="2016-06-30T23:18:26.587" Title="Next/Previous Asset or Image within Entry" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15738" PostTypeId="1" CreationDate="2016-06-30T15:12:41.753" Score="3" ViewCount="1797" Body="&lt;p&gt;What is the best way to update Craft on a live website? Preferably without losing any data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few ways to do this, and, can often be situational. &#xA;Essentially the main problem is potentially losing out on data that’s POSTed during the site being updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a site is small: I often crawl the site before hand, making sure everything is cached with varnish, do a DB backup, then do the update locally (sync’d with the live DB), and then push &amp;amp; deploy the files. (Varnish holds the site up despite it being unusable behind the scenes). Even if the DB is a local, there is still downtime involved in updating it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a site is bigger, or the Craft versions differ dramatically: Though more time consuming, I would setup another directory on the same server (with an independent updated database), make sure it’s working on a test link, then switch the nginx config to point to the new directory for that site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any situation I think that all situations could be detrimental to a user. If a user has written out a long form which could potentially be submitted during an update, or, a client could be logged in to Craft, working on a big edit to a page and hit “save&quot; (I know you can disable their access), but the same issue exists, when you use that feature too.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="57" LastEditDate="2016-06-30T17:27:25.480" LastActivityDate="2016-07-01T22:07:35.470" Title="Best method to update Craft on a live site to avoid losing data" Tags="&lt;updating&gt;&lt;auto-updates&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15739" PostTypeId="1" CreationDate="2016-06-30T15:33:12.337" Score="2" ViewCount="154" Body="&lt;p&gt;Hi I have a plugin that loops through users to find out their interests. Counts the number of interests in total for each interest and displays this in a widget on the dashboard with the interest name and amount of users with that interest. The code I have works but fails with a max execution time and only pulls out minimal results for each interest. Is there a way to do this more efficiently so the script does not timeout. This is what I have so far but I'm sure looping through 20k+ users and checking each interest field to see if the category id is in it is highly inefficient. Cheers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInterestRank()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;    $criteria-&amp;gt;group = 'interestTags';&#xA;    $category = $criteria-&amp;gt;find();&#xA;&#xA;    //Get all users&#xA;    $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $users = $user_criteria-&amp;gt;find();&#xA;&#xA;    $interestArray = array();&#xA;&#xA;    foreach($category as $interest)&#xA;    {&#xA;        $title = $interest['title'];&#xA;        $count = 0;&#xA;&#xA;        foreach($users as $user)&#xA;        {&#xA;            if($user['interests']) {&#xA;                if(in_array($interest['id'], $user['interests']))&#xA;                {&#xA;                    $count = $count+1;&#xA;                }&#xA;            }&#xA;        }&#xA;        $interestArray[$title] = $count;&#xA;    }&#xA;&#xA;    arsort($interestArray);&#xA;    return ($interestArray);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2016-06-30T17:25:55.823" LastActivityDate="2016-06-30T18:57:29.357" Title="Efficient way of looping through a large amount of users?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15740" PostTypeId="1" AcceptedAnswerId="15743" CreationDate="2016-06-30T16:07:39.280" Score="1" ViewCount="34" Body="&lt;p&gt;The &lt;code&gt;StringHelper::normalizeKeywords()&lt;/code&gt; doesn't work as I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I normalize &lt;code&gt;überblick&lt;/code&gt; it leads to the expected result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;StringHelper::normalizeKeywords('überblick') -&amp;gt; ueberblick&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I normalize &lt;code&gt;ÜBERBLICK&lt;/code&gt; I expect it also to be &lt;code&gt;ueberblick&lt;/code&gt; but it actually returns &lt;code&gt;überblick&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could be fixed by adding the missing ASCII mappings (e.g. 196 =&gt; 'Ae') to the &lt;code&gt;StringHelper::getAsciiCharMap()&lt;/code&gt; method or converting the string to lowercase before replacing the characters in &lt;code&gt;StringHelper::normalizeKeywords()&lt;/code&gt; on lines 358 - 362:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt; switch these two lines:&#xA;&#xA;// Remove punctuation and diacritics&#xA;$str = strtr($str, static::_getCharMap());&#xA;&#xA;// Normalize to lowercase&#xA;$str = StringHelper::toLowerCase($str);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4200" LastActivityDate="2016-06-30T17:10:10.520" Title="Normalizing Keywords Bug" Tags="&lt;search&gt;&lt;string&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15741" PostTypeId="2" ParentId="15738" CreationDate="2016-06-30T16:40:11.230" Score="3" Body="&lt;p&gt;I think you're asking the IT equivalent of &amp;quot;If I go outside when it's storming, how can I not be hit by lightning?&amp;quot; There's always going to be that chance. When you run a public server, that's pretty similar.&lt;/p&gt;&#xA;&lt;p&gt;I'm not a high availability expert but as someone's who ran servers on behalf for clients, what you're really asking is 2 questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How much &lt;strong&gt;downtime&lt;/strong&gt; can we afford?&lt;/li&gt;&#xA;&lt;li&gt;How do we &lt;strong&gt;engineer a solution&lt;/strong&gt; to minimize that downtime?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;As you alluded to, how you answer question 1) is going to inform 2). Properly answering question 2) is probably beyond the scope of this Q&amp;amp;A format, but since we're going the down the rabbit hole...&lt;/p&gt;&#xA;&lt;p&gt;If your answer to question 1 is next to zero, then you need to evaluate how much time/effort/money will required to do this.  Does it matter if your mom and pop's brochure based site is down for half a minute while you update? Probably not.&lt;/p&gt;&#xA;&lt;p&gt;If you're running a multiple server setup for a largish organization, then this is also a question for them and what they're willing to throw at IT to make that happen. No server is 100% available, 24/7 and responsive to users.  The companies who do this well are also compensated accordingly. When you add redundancy to the mix, you also double your potential for failure so it's a double edged sword.&lt;/p&gt;&#xA;&lt;p&gt;You can minimize that chance of messing up a user's work by doing a few things to proactively protect against downtime and just as importantly, frame the user's expectations:&lt;/p&gt;&#xA;&lt;h1&gt;Communication&lt;/h1&gt;&#xA;&lt;p&gt;When do your users usually work on the site? If the site's users and authors are typically 9-5 corporate in nature, update the site off-hours when less people are going to be working or visiting on the site. And if you think downtime is going to more than a few minutes, inform them of the maintenance window.&lt;/p&gt;&#xA;&lt;p&gt;At least in terms of Craft, updating takes seconds usually. I liken updates to a frog jumping from lily pad to lily pad. The lily pads are point updates.  The smaller jumps are going to be a lot easier to make then jumping from one side of the pond to the other.&lt;/p&gt;&#xA;&lt;p&gt;You're also spreading out your uptime with multiple smaller jumps instead of huge leaps. If you put off updating, you're increasing the risk of something blowing up later on (schema updates, etc).&lt;/p&gt;&#xA;&lt;p&gt;Updating software is not like updating hardware where you know the hardware is going to fail at some point, so you plan for it. Writing bug-free software is harder. Being agile here is important. You also run less of a risk of having unplanned downtime because you didn't jump and now there's a huge security update.&lt;/p&gt;&#xA;&lt;h1&gt;Engineering&lt;/h1&gt;&#xA;&lt;p&gt;The other important piece of uptime is if something does go wrong during the update, how do you recover? When Craft updates, unless you've turned off automatic database backup, it'll save a copy in case things go hairy and then revert back so you're not stuck in a weird state.&lt;/p&gt;&#xA;&lt;p&gt;I would also question the need for a long form to begin with. Can we engineer the form in such a way that it saves the user's work periodically (either to their browser or the server) as they fill it out?  Or make each form part shorter?&lt;/p&gt;&#xA;&lt;p&gt;If someone is working on a long form, it's  counter intuitively also less likely they're going to be hit by server downtime, because they're spending more time on it before it gets submitted.&lt;/p&gt;&#xA;&lt;p&gt;Lindsey D points out that how you deploy can make a difference as well. Deployment services (eg: DeployBot) in coordination with some VPS providers offer &lt;a href=&quot;https://deploybot.com/blog/atomic-deployments-for-digitalocean&quot; rel=&quot;nofollow noreferrer&quot;&gt;atomic deployment&lt;/a&gt;. This guarantees that your site remains &amp;quot;untouched&amp;quot; until the new files are 100% uploaded. Using something like Capistrano can do this as well. AWS offers their own set of deploy and server management tools to help manage your uptime too. (Again, you pay the piper for all of this, which is why AWS gives you a year for free in their free tier.)&lt;/p&gt;&#xA;&lt;p&gt;There's probably a few things you can do but those are just off the top of my head.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-06-30T17:01:00.860" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15743" PostTypeId="2" ParentId="15740" CreationDate="2016-06-30T17:08:20.283" Score="1" Body="&lt;p&gt;This may be a bug, and is probably worth reporting to P&amp;amp;T.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's very difficult (if not impossible) for them to account for every potential ASCII character mapping for every possible language. For that reason, there is a &lt;a href=&quot;https://craftcms.com/docs/config-settings#customAsciiCharMappings&quot; rel=&quot;nofollow&quot;&gt;customAsciiCharMappings&lt;/a&gt; config setting, which you can use as a workaround.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2016-06-30T17:10:10.520" LastActivityDate="2016-06-30T17:10:10.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15744" PostTypeId="2" ParentId="15738" CreationDate="2016-06-30T17:15:28.163" Score="3" Body="&lt;p&gt;I’ve written a plugin that allows to announce scheduled maintenance in the CP and on the front-end by making use of the template variables it provides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/carlcs/craft-maintenance&quot; rel=&quot;nofollow&quot;&gt;https://github.com/carlcs/craft-maintenance&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s some example code for how you can announce the maintenance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Announce maintenance 1 hour in advance #}&#xA;{% set announcement = craft.maintenance.getAnnouncement('1 hour') %}&#xA;&#xA;{% if announcement and announcement.blockCp %}&#xA;    &amp;lt;span&amp;gt;{{ announcement.message }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to make sure your site visitors don’t add or update records to the database you can add conditionals like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Disable shop link when the site is undergoing scheduled maintenance #}&#xA;{{ isCpMaintenance ? 'Shop closed' : '&amp;lt;a href=&quot;/shop&quot;&amp;gt;Shop&amp;lt;/a&amp;gt;' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-30T17:15:28.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15745" PostTypeId="2" ParentId="15739" CreationDate="2016-06-30T17:27:32.760" Score="3" Body="&lt;p&gt;You could just setup a criteria model in your “categories” for-loop, prepared to query for the users related to that category. And then use the &lt;code&gt;total()&lt;/code&gt; method to get the count.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;foreach($category as $interest) {&#xA;    $user_criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $user_criteria-&amp;gt;relatedTo = $interest-&amp;gt;id;&#xA;    $count = $user_criteria-&amp;gt;total();&#xA;&#xA;    $interestArray[$interest-&amp;gt;title] = $count;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;total()&lt;/code&gt; method is a lot faster than &lt;code&gt;find()&lt;/code&gt;, the underlaying SQL which is necessary to get the amount of rows performs better and Craft also doesn’t have to populate the Entry models with all the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Not sure why @LukePearce deleted his answer, where he basically suggested to do the same thing.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-06-30T18:57:29.357" LastActivityDate="2016-06-30T18:57:29.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15746" PostTypeId="1" AcceptedAnswerId="15750" CreationDate="2016-06-30T17:51:23.283" Score="1" ViewCount="784" Body="&lt;p&gt;I know is kind of stupid question, but I need some 'comforting' words :) &#xA;We are going to update a very old version of Craft. We have Craft Client 2.4.2684 and going to update to the last Craft 2.6 version 2794 - 29/06/2016.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a very big update and usually such jumps are never going well :) What about Craft? Do the updates work good or like WP :) do they need lot of fixing of the server afterwards?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I copy all the files present in root to my HD and a copy of the database before the upgrade, will I be able to go back without problems?&lt;/p&gt;&#xA;" OwnerUserId="5352" LastEditorUserId="45" LastEditDate="2016-06-30T19:19:15.360" LastActivityDate="2016-06-30T19:33:11.330" Title="How to update Craft from 2.4 to 2.6?" Tags="&lt;upgrades&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15748" PostTypeId="1" AcceptedAnswerId="15749" CreationDate="2016-06-30T18:08:47.630" Score="5" ViewCount="685" Body="&lt;p&gt;I am auto-generating entry titles based on a plain text field. Now, I would like to limit the characters the title contains of (e.g. 50 chars while the plain text field has 500 chars). How could I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-06-30T18:37:22.020" Title="How to truncate auto-generated entry titles?" Tags="&lt;titles&gt;&lt;auto-generate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15749" PostTypeId="2" ParentId="15748" CreationDate="2016-06-30T18:37:22.020" Score="8" Body="&lt;p&gt;You can use any Twig in the dynamic title field. There are plugins that provide Twig filters to truncate text, but here’s how you can do simple truncation without any plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.myTextField|length &amp;gt; 50 ? object.myTextField|slice(0, 50) ~ '...' : object.myTextField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-06-30T18:37:22.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15750" PostTypeId="2" ParentId="15746" CreationDate="2016-06-30T19:17:22.470" Score="5" Body="&lt;p&gt;The good news is, 2.4 isn't &lt;em&gt;that&lt;/em&gt; old. The bad news is, 2.5 was one of the most significant updates Craft has ever seen. For that reason, you'll want to exercise a little more caution than you typically would need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To begin with, &lt;strong&gt;backup your database!&lt;/strong&gt; I can't emphasize this enough... you want to make sure that you have captured a &quot;moment in time&quot; for your site to roll back to, in the unlikely event that it's necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, you'll want to perform a &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot;&gt;&lt;strong&gt;manual update&lt;/strong&gt;&lt;/a&gt;. The vast majority of times (99%), an auto-update is a clean and easy way to update your Craft site. In fact, it's one of the things that makes Craft so amazing to begin with! However, upgrading from 2.4 -&gt; 2.5 involves &lt;em&gt;a lot&lt;/em&gt; of file changes, so this is one of those rare instances where you'd be wise to upgrade manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, you'll want to &lt;strong&gt;update all of your plugins&lt;/strong&gt; after you update Craft itself. The arrival of 2.5 brought a few breaking changes for some plugins, and several awesome new features for plugins to take advantage of. Besides, it's always best to be running the latest versions of your plugins anyway. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, set aside 1-2 hours. If you're cautious and follow these tips, you'll almost certainly have a smooth transition. And if something goes horribly wrong, just roll back to your backup, and reach out to the community on the &lt;a href=&quot;https://craftcms.com/community#slack&quot;&gt;Craft Slack channel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=SmHeP9Sve48&quot;&gt;Good luck!&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-06-30T19:17:22.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15751" PostTypeId="2" ParentId="15746" CreationDate="2016-06-30T19:33:11.330" Score="4" Body="&lt;p&gt;In additional to Lindsey's excellent &lt;a href=&quot;https://craftcms.stackexchange.com/a/15750/1016&quot;&gt;answer&lt;/a&gt;, I find a lot more comfort in updating Craft than WordPress. P&amp;amp;T spent a lot of time making sure the one click updates just &lt;em&gt;work&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike WordPress, Craft will make a backup of your database before it updates so if anything goes south, it can revert back automatically, though on a big version jump like this, you'd be wise to take a backup of the live site, and test it locally (or another testing server) to see what, if anything, is going to cause any problems since there are a lot of files involved. If all goes well, do it on the live server. If not, than you may have to do a manual update. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saying that, I've rarely had a WP update go wrong—it's usually plugins that have caused the most problems after updating.  If your sites are anything like mine, you rely on plugins far less in Craft than WordPress so it's less of a concern. But it's still a concern.  As Lindsey mentions, theres a few breaking changes in plugins in the newest version of Craft that can bork your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some plugins only work with certain versions of Craft so it's an in-or-out situation. You'll may have to disable the plugin, update Craft, download the newest version of the plugin, &quot;install&quot; it and then Craft will prompt you to migrate the plugin's database schema.  Again, probably best done on another box to see how you fare. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-06-30T19:33:11.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15752" PostTypeId="1" CreationDate="2016-06-30T20:50:50.050" Score="3" ViewCount="119" Body="&lt;p&gt;Trying to set up tiered volume discounts and can't figure out how to &lt;em&gt;not&lt;/em&gt; have multiple discounts get applied when the cart total meets minimum criteria for more than one discount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the simple discounts I'm trying to have applied are here:&lt;a href=&quot;https://i.stack.imgur.com/2Vrv5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Vrv5.png&quot; alt=&quot;Screenshot from spreadsheet containing discount structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dlfgz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dlfgz.png&quot; alt=&quot;Examples of multiple discounts in the CMS Admin and the result of multiple discounts being applied in the cart&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand why Craft is applying both: Because the order meets the criteria for both Purchase Quantities. Is there a way I can specify a range, or other workaround?&lt;/p&gt;&#xA;" OwnerUserId="5354" LastEditorUserId="57" LastEditDate="2016-06-30T21:34:53.830" LastActivityDate="2016-10-19T15:26:40.437" Title="How can I set up tiered volume discounts without enacting a waterfall effect of multiple discounts being applied?" Tags="&lt;plugin-craftcommerce&gt;&lt;promotions&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15753" PostTypeId="1" AcceptedAnswerId="15754" CreationDate="2016-06-30T20:53:06.970" Score="2" ViewCount="126" Body="&lt;p&gt;Link to Github repository for plugin: &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being given an error by the plugin where it is interpreting my Twig variable literally as a string instead of what the variable is representing. I am looking for a way to fix this using the current set-up but having an alternate setup is fine as well. Also for reference, I have followed the guidelines on the README in regards to changing the craft/config/contactform.php file. Much appreciated for the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;        {% for error in errors %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;span&amp;gt;{{ error }}&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;div class=&quot;uk-width-large-1-2 uk-width-medium-1-2 uk-width-small-1-1 uk-container-center&quot;&amp;gt;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul id=&quot;button-content&quot; class=&quot;uk-switcher uk-margin&quot;&amp;gt;&#xA;        &amp;lt;li class=&quot;text-space basic-border&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;b&amp;gt;Email to {{default.defaultcontactreason}}&amp;lt;/b&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ '{{default.defaultContactEmail}}'|hash }}&quot;&amp;gt;{{default.defaultContactEmail}}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% for category in craft.entries.section('Contacts') %}&#xA;        &amp;lt;li class=&quot;text-space basic-border&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;b&amp;gt;Email to {{ category.contactReason }}&amp;lt;/b&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ '{{category.contactEmail}}'|hash }}&quot;&amp;gt;{{category.contactEmail}}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromName&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;fromEmail&quot; type=&quot;text&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{% if message is defined %}{{ message.subject }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{siteUrl}}Contacts&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5353" LastEditorUserId="45" LastEditDate="2016-06-30T20:58:58.250" LastActivityDate="2016-06-30T21:34:12.610" Title="phpmailer Exception while using Pixel &amp; Tonic contact-form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15754" PostTypeId="2" ParentId="15753" CreationDate="2016-06-30T21:34:12.610" Score="1" Body="&lt;p&gt;Looks like you've got some nested escape tags in Twig, which is a no-no.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;{{ '{{category.contactEmail}}'|hash }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You just need to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;{{ category.contactEmail|hash }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-06-30T21:34:12.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15755" PostTypeId="2" ParentId="15737" CreationDate="2016-06-30T23:18:26.587" Score="1" Body="&lt;p&gt;Given that your assets are within an entry, it seems that a gallery browsing mechanism may fit well. I'd suggest a javascript framework such as Fancybox: &lt;a href=&quot;http://fancyapps.com/fancybox/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://fancyapps.com/fancybox/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively and perhaps more in line with your specific question, have a look at this related thread: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14755/best-way-to-access-getprev-and-getnext-asset-fields&quot;&gt;Best way to access getPrev and getNext asset fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-06-30T23:18:26.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15756" PostTypeId="2" ParentId="15672" CreationDate="2016-07-01T00:08:51.300" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/15673/57&quot;&gt;Luke's&lt;/a&gt; answer is correct.  Your issue is that you have two tag groups defined (&lt;code&gt;default&lt;/code&gt; and &lt;code&gt;blogTags&lt;/code&gt;) and you happen to have a &lt;code&gt;weddings&lt;/code&gt; tag defined for both groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Tag field you have in your &lt;code&gt;blog&lt;/code&gt; section has it source limited to the &lt;code&gt;blogTags&lt;/code&gt; tag group, so you need to be explicit about which tags you want to pull from because of the duplicate tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.group('blogTags').slug('weddings').first() %}&#xA;{% set entries = craft.entries.relatedTo(tag) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-01T00:08:51.300" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15757" PostTypeId="1" AcceptedAnswerId="15758" CreationDate="2016-07-01T07:56:54.987" Score="2" ViewCount="121" Body="&lt;p&gt;I'm having a problem with wrong results when filtering order by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orders = craft.commerce.orders.dateOrdered(' &amp;gt;= 2016-07-01 00:00:00').dateOrdered(' &amp;lt;= 2016-07-01 23:59:59').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The last order has been placed on 2016-06-29, and there has been no orders placed on 2016-07-01, so I would expect order to have no results. However it just lists all orders in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the date to 2016-06-10, the result is empty - as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this bug in Craft / Craft Commerce, or do I miss something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I make sure I get no results, if there have been no orders on this date?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="57" LastEditDate="2016-07-01T18:59:08.200" LastActivityDate="2016-07-01T18:59:08.200" Title="Filtering orders by date bring wrong results" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15758" PostTypeId="2" ParentId="15757" CreationDate="2016-07-01T08:13:27.477" Score="1" Body="&lt;p&gt;Try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDayOfMonth = year ~ &quot;-&quot; ~ month ~ &quot;-01&quot; %}&#xA;{% set daysInThisMonth = firstDayOfMonth|date('t') %}&#xA;{% set lastDayOfMonth  = year ~ &quot;-&quot; ~ month ~ &quot;-&quot; ~ daysInThisMonth %}&#xA;&#xA;{% set thisMonthsOrders = craft.commerce.orders.dateOrdered('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-01T08:13:27.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15759" PostTypeId="1" AcceptedAnswerId="15760" CreationDate="2016-07-01T08:52:22.480" Score="3" ViewCount="578" Body="&lt;p&gt;In CP, there is the widget called &quot;Recent Entries&quot;. You can pull out entries from your sections, limit a count of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building a plugin that has very similar widget to recent entries widget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;THE GOAL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter entries by date range within widget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was only able to set a fixed date range within widget's class ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// To get entries from a specific date range&#xA;$criteria-&amp;gt;postDate = array('and', '&amp;gt; 2016-06-10 23:59:59', '&amp;lt; 2016-06-30 00:00:00');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-11-10T03:02:02.957" Title="Filter entries by date range in plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15760" PostTypeId="2" ParentId="15759" CreationDate="2016-07-01T09:56:09.587" Score="3" Body="&lt;p&gt;Have a look at the Dashboard Widget section in the Craft docs. It’ll walk you through defining your “Start Date” and “End Date” settings, and how to render the settings template, where you can make use of the &lt;code&gt;dateTimeField&lt;/code&gt; Twig macros to render the Date and Time fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An important step to make your widget save the values properly to the database. You’ll have to convert them &lt;code&gt;DateTime&lt;/code&gt; objects to string before save in the &lt;code&gt;prepSettings()&lt;/code&gt;, and convert them back in the &lt;code&gt;getSettingsHtml()&lt;/code&gt; before rendering the settings template. There’s this convenient &lt;code&gt;DateTime::createFromString()&lt;/code&gt; helper that you should proabably want to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing that you’ll probably find useful is the &lt;code&gt;mySqlDateTime()&lt;/code&gt; method that prepares a &lt;code&gt;DateTime&lt;/code&gt; object for use in criteria model parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at &lt;a href=&quot;https://github.com/craftcms/store-hours&quot; rel=&quot;nofollow noreferrer&quot;&gt;P&amp;amp;T Store Hours plugin&lt;/a&gt;, that shows some of these methods in code context.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="103" LastEditDate="2017-11-10T03:02:02.957" LastActivityDate="2017-11-10T03:02:02.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15761" PostTypeId="2" ParentId="15731" CreationDate="2016-07-01T10:14:07.050" Score="1" Body="&lt;p&gt;I was having difficultly getting the JS (that is responsible for AJAX page transitions) to read the Json object that the page generated. In the end I had to run a script on the page itself. For the un-JS savy people like me this is what went at the bottom of the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;$(document).ready(function(){&#xA;    var jsonMeta = {{ jsonMeta|json_encode|raw }};&#xA;    $('head').find('title').text(jsonMeta.meta.title);&#xA;    $.each(jsonMeta.meta.link, function(k, v){&#xA;        $.each(v, function(kk, vv){&#xA;            $('head').find('link[' + k + '=&quot;' + kk + '&quot;]').attr('href', vv);&#xA;        });&#xA;    });&#xA;&#xA;    $.each(jsonMeta.meta.meta, function(k, v){&#xA;        $.each(v, function(kk, vv){&#xA;            $('meta[' + k + '=&quot;' + kk + '&quot;]').attr('content', vv);&#xA;        });&#xA;    });&#xA;});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An at the top I did this to get the Json object&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set jsonMeta = [] %}&#xA;{% set jsonMeta = jsonMeta | merge({&#xA;  &quot;meta&quot;:{&#xA;    &quot;title&quot;: entry.title,&#xA;  &quot;meta&quot;:{&#xA;    &quot;name&quot;:{&#xA;      &quot;keywords&quot;:&quot;keywords&quot;,&#xA;      &quot;description&quot;: entry.journalBody|striptags|truncate(180),&#xA;      &quot;author&quot; : entry.author.fullName,&#xA;      &quot;dcterms.Identifier&quot;: craft.request.url,&#xA;      &quot;dcterms.Title&quot;: siteName,&#xA;      &quot;dcterms.Subject&quot;:&quot;keywords&quot;,&#xA;      &quot;dcterms.Date&quot;: entry.dateUpdated.iso8601,&#xA;      &quot;dcterms.Description&quot;: entry.journalBody|striptags|truncate(180)&#xA;    },&#xA;    &quot;property&quot;:{&#xA;      &quot;og:type&quot;:&quot;website&quot;,&#xA;      &quot;og:locale&quot;:&quot;en_uk&quot;,&#xA;      &quot;og:url&quot;: craft.request.url,&#xA;      &quot;og:title&quot;: entry.journalBody|striptags|truncate(180),&#xA;      &quot;og:description&quot;: entry.journalBody|striptags|truncate(180),&#xA;      &quot;og:site_name&quot;: siteName,&#xA;      &quot;article:published_time&quot;:entry.dateCreated.iso8601,&#xA;      &quot;article:modified_time&quot;:entry.dateUpdated.iso8601&#xA;&#xA;&#xA;&#xA;    }&#xA;  },&#xA;  &quot;link&quot;:{&#xA;    &quot;rel&quot;:{&#xA;      &quot;canonical&quot;:craft.request.url&#xA;    }&#xA;  }&#xA;},&#xA;})&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No idea whether this is bad solution but it works.&lt;/p&gt;&#xA;" OwnerUserId="5195" LastActivityDate="2016-07-01T10:14:07.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15762" PostTypeId="1" AcceptedAnswerId="15763" CreationDate="2016-07-01T13:46:14.393" Score="0" ViewCount="142" Body="&lt;p&gt;WorldPay looks to be a terrible Payment Gateway, but it's supported by Craft Commerce so we've gone ahead. Right now, I'm having a problem with the callback's failing with a 302 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our site is updating the order following payment, but the user gets stuck on WorldPay's default thank you page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone used Craft Commerce with WorldPay yet?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-01T16:16:38.833" Title="Craft Commerce WorldPay integration callback failure" Tags="&lt;plugin-craftcommerce&gt;&lt;worldpay&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-07-01T22:02:39.013" ContentLicense="CC BY-SA 3.0" />
  <row Id="15763" PostTypeId="2" ParentId="15762" CreationDate="2016-07-01T16:16:38.833" Score="2" Body="&lt;p&gt;I have answered your support ticket and given you the fix for worldpay. It will be included in the next release of Craft Commerce. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-01T16:16:38.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15764" PostTypeId="1" CreationDate="2016-07-01T17:14:07.937" Score="2" ViewCount="265" Body="&lt;p&gt;I recently came across a website in this situation and am curious to here how others approach this problem.  Here's the scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A client had a website built on Craft 2.4 with a lot of integration work. The site has 10 custom plugins, integrating with several different systems and services. The relationship with the original development firm did not work out and a new development firm is picking up where the old one left off.  This means, the new team initially has limited knowledge of the 10 custom plugins on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new development firm inherits this project just as Craft discovers and releases a critical update with a fix for a security vulnerability (Craft 2.6.2791). It's in the website owners interest to upgrade to the latest version of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as mentioned, the site has 10 custom plugins that have not yet been updated to Craft 2.5. And, for fun, let's just say Craft 3.0 is also on the horizon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are the development firm that inherits this project:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What options do you present to the new client for them to move forward?&lt;/li&gt;&#xA;&lt;li&gt;How do you explain the costs (and the value) of why 10 plugins will need to be updated to Craft 2.5 and to Craft 3?&lt;/li&gt;&#xA;&lt;li&gt;How do you respond if the client expresses concern that this work doesn't relate to value toward their business objectives?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-07-04T06:30:12.993" LastActivityDate="2016-07-04T06:30:12.993" Title="How do I perform a critical update if my Craft site relies on older plugins?" Tags="&lt;plugin-development&gt;&lt;updating&gt;&lt;upgrades&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15765" PostTypeId="2" ParentId="15764" CreationDate="2016-07-01T17:51:05.167" Score="3" Body="&lt;p&gt;I'd want the client knowingly and enthusiastically on board with a sensible plan that'd support business goals and the nature of evolving software.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Either a) do with fewer plugins/integrations, b) invest in privately upgrading the plugins, c) open source the work if possible and ask for improvements with fingers crossed, or d) rethink the site so it's less directly dependent on these plugins and thus safer from a repeat of this scenario should &lt;em&gt;a&lt;/em&gt;-&lt;em&gt;c&lt;/em&gt; seem unattractive. (Freezing the Craft version and avoiding software updates should be unacceptable as it's risky and invites compounding future problems—might as well pick e) move to a static site.) Re-affirm the importance of the CMS and each plugin, or remove the cruft from the equation. &lt;/li&gt;&#xA;&lt;li&gt;The solid and ongoing work behind Craft, and the support that comes with it, is a steal and having a well-tailored CMS likely empowers employees in various ways—decreasing dependency on (and cost of) web nerds or additional training to update content. If nothing else, staying up to date takes advantage of lots and lots of work that's included in the price of a license while keeping the site as fast and secure as possible. &lt;/li&gt;&#xA;&lt;li&gt;I'd encourage the line of thought and compare other ways of meeting those objectives. For example, I might contrast the (nonexistent) maintenance costs of running a SquareSpace site compared to the freedom and flexibility of hosting a Craft install. The site, as it is, is most likely supporting current business objectives and keeping it up to date will make it possible to quickly and elegantly support &lt;em&gt;future&lt;/em&gt; business objectives with great agility. &lt;strong&gt;It may not be worth it&lt;/strong&gt;, but I'd try and help them understand how much versatility they have for the (un-sexy) cost of maintenance and burden of technical diligence. Odds are they chose Craft and their custom plugins for a reason and those reasons are still vitally relevant, as is the ability to stay nimble in the future.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You might also try to get Ben Parizek on the horn and submit the whole site for a Straight Up Craft code review. In my experience, that can be one way to get rid of unnecessary plugins.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-07-01T20:58:52.810" LastActivityDate="2016-07-01T20:58:52.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15766" PostTypeId="2" ParentId="15151" CreationDate="2016-07-01T18:26:27.877" Score="1" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% if craft.request.isLivePreview() %}&#xA;&#xA;        {# if it's Live Preview, grab even the disabled entries #}&#xA;        {% set entries = craft.entries.section('mySection').status(null).find() %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {# not Live Preview, so just grab enabled entries #}&#xA;        {% set entries = craft.entries.section('mySection').find() %}&#xA;&#xA;    {% endif %}&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-01T18:26:27.877" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15767" PostTypeId="1" AcceptedAnswerId="15834" CreationDate="2016-07-01T20:10:00.190" Score="1" ViewCount="180" Body="&lt;p&gt;I want to put a few simple text fields into Craft CP and then be able to retrieve them with JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to structure this in Craft? I'd like to be able to create/edit an &quot;entry&quot; and then do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var homepageContent = {{ craft.entries.homepageContent }};&#xA;    console.log('details: ', homepageContent);&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The homepage content entry in Craft needs to have ~2-3 fields attached to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created the 3 fields that I think I will need to be editable on the homepage. Now I'm unsure how to get these tied to be able to enter an &quot;entry&quot; into something like a Homepage Content group?&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="57" LastEditDate="2016-07-05T21:08:03.133" LastActivityDate="2016-07-07T12:48:46.343" Title="Put simple content into Craft and grab it in JavaScript" Tags="&lt;templating&gt;&lt;entries&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15768" PostTypeId="2" ParentId="15764" CreationDate="2016-07-01T21:09:02.977" Score="2" Body="&lt;p&gt;Matt's &lt;a href=&quot;https://craftcms.stackexchange.com/a/15765/1016&quot;&gt;answer&lt;/a&gt; covers some good ground, especially this line: &quot;Odds are they chose Craft and their custom plugins for a reason and those reasons are still vitally relevant, as is the ability to stay nimble in the future.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wanted to expand on some points...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've walked into these kind of building-on-fire situations before and it's important to figure out the history of the relationship &lt;em&gt;before&lt;/em&gt; you start. That will inform how you tailor your approach. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why didn't the previous firm work out? (Were they nickel-and-diming the client for example? Or did they not frame after-site expectations properly? etc.)&lt;/li&gt;&#xA;&lt;li&gt;What does the client actually value? (Or was it a buddy higher up helping a buddy situation?)&lt;/li&gt;&#xA;&lt;li&gt;Has the client set any money aside for on-going maintenance?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This scenario is all-too-common and almost a cliche. There's too many fly-by-night agencies/developers that are onto the the next client as soon as the job is done and do not support what they created. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's less money in support than creation so I understand this aspect of it. But knowing where the client is coming from is helpful. Designers blame the client but 9/10 the client is not at-fault—that is, if you sell properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to credit Ben Parizek for this &lt;a href=&quot;http://ctrlclickcast.com/episodes/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;quote&lt;/a&gt; on the &lt;em&gt;Control-Click Podcast&lt;/em&gt; but he's right on the money when he says &quot;we're not just building the client one website, we're building them two websites.&quot; In other words, the backend of the site is just as important as the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that means on-going updates, maintenance and hosting. Clients (and some designers) are still treating websites like printed pieces where you build it once and it's done. It's more like a living, breathing entity. The web thrives on change.  If your business objectives ultimately don't involve changing over time, there's not a whole lot you can say to convince the client otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clients also generally don't care what technology you use, they want solutions. If they feel your solution doesn't provide them with any more value than a SquareSpace or Weebly site, than you've not framed your value to the client properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did those plugins actually do in the first place? You don't get custom business logic for free. It's like building a luxury jet; you may have paid for the custom GPS system, leather, stone tile, and jacuzzi, but you still need to fill it up with fuel to fly it, mechanics to work on it, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lately, I've been building in some sort of maintenance agreement with all of our site builds for a period of time (including support, hosting, and CMS updates, etc.)  That helps solidify trust with the client that you're not going to leave them out in the desert and helps makes sure their business objectives have been met. Ultimately after that maintenance period is up, it's an easy renewal contract to keep them in, assuming you've set that initial expectation already. It can often lead to bigger projects, too...&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-01T22:22:35.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15769" PostTypeId="1" CreationDate="2016-07-01T21:45:01.257" Score="2" ViewCount="256" Body="&lt;p&gt;I have an Entry Type with a field called Gallery with a handle of &lt;code&gt;gallery&lt;/code&gt;. Here are two examples of how I can access the Gallery field in a template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set images = entry.gallery %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets({&#xA;    source:    'images',&#xA;    relatedTo: {sourceElement: entry.id, field: 'gallery'},&#xA;    order:     'sortOrder'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first method works with Live Preview, the second does not. This wouldn't be an issue, but it's my understanding that we have to use the second method to eager load elements. So if I wanted to eager load a relationship on my gallery images, then Live Preview wouldn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone else running into this issue? Is it a known bug or a misunderstanding of the implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify via Brad's question, the following is the only thing in my template. This does NOT work with Live Preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = craft.assets({&#xA;    relatedTo: {sourceElement: entry.id, field: 'gallery'}&#xA;}) %}&#xA;{% for image in images %}&#xA;    {{ image.url }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;entry&lt;/code&gt; variable is populated defining the Entry Template in the section settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following WORKS with live preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images = entry.gallery %}&#xA;{% for image in images %}&#xA;    {{ image.url }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2016-07-01T22:40:58.710" LastActivityDate="2017-06-13T17:55:18.137" Title=".find() not working with live preview?" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15771" PostTypeId="1" CreationDate="2016-07-02T00:18:12.977" Score="1" ViewCount="235" Body="&lt;p&gt;I'd like to deploy a Craft site with &lt;a href=&quot;http://capistranorb.com&quot; rel=&quot;nofollow&quot;&gt;Capistrano&lt;/a&gt; but am looking for the best way to get started. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the &lt;a href=&quot;https://github.com/Bluegg/craft-deploy&quot; rel=&quot;nofollow&quot;&gt;Craft Deploy&lt;/a&gt; utility by Bluegg up to date, or would it be better to use a vanilla version of Capistrano? I'm curious because there doesn't seem to be a lot of activity on the github account for the utility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone with experience using the Craft Deploy utility, are there any caveats for bringing the Craft Deploy utility into an existing project? The instructions tell how to use it when setting up a new project but not an existing one. &lt;/p&gt;&#xA;" OwnerUserId="3835" LastActivityDate="2016-07-02T00:18:12.977" Title="Getting started deploying Craft sites with Capistrano" Tags="&lt;deployment&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15772" PostTypeId="1" AcceptedAnswerId="15815" CreationDate="2016-07-03T10:50:40.723" Score="2" ViewCount="782" Body="&lt;p&gt;I've been adapting the very useful geo plugin to fetch currency and exchange rates based on a visitors IP address. [ see: &lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lukeholder/craft-geo&lt;/a&gt; ]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin uses Craft's vendor package &quot;guzzle&quot; to contact 3rd party APIs and request data which then gets cached in JSON form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When its not cached i was wondering how can you tell if Guzzle is making the request - there are no headers in dev tools and no noticeable traffic for the requests. So how can you see if the Guzzle has guzzled when cache is off?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-07-04T03:38:48.270" LastActivityDate="2016-07-07T17:42:55.233" Title="Using guzzle with a plugin and cache" Tags="&lt;cache&gt;&lt;guzzle&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15773" PostTypeId="1" AcceptedAnswerId="15775" CreationDate="2016-07-03T15:54:09.283" Score="3" ViewCount="80" Body="&lt;p&gt;I seem to be having trouble with the performance of my site (on localhost) after including this object. Im using it to build a menu for an archive of the posts section which has about 2,500 entries inside of it. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('posts').limit(null) %}&#xA;&#xA;{% for year, entriesInYear in allEntries | group(&quot;postDate.year&quot;) %}&#xA;    {{ year }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This fetch request spits out the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2016 2015 2014 2013 2012 2011 2010 2009&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I make this fetch request, my page is reload time is ~11s. If I comment out this request my page reload time is ~3s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more economical way to return the years associated with my posts?&lt;/p&gt;&#xA;" OwnerUserId="5357" LastEditorUserId="5357" LastEditDate="2016-07-03T17:00:43.217" LastActivityDate="2016-07-04T03:27:57.373" Title="A more economical method of building an archive menu?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;performance&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15774" PostTypeId="1" CreationDate="2016-07-03T19:07:47.610" Score="3" ViewCount="397" Body="&lt;p&gt;I'm running Nginx on port 8888 locally. fastcgi_params is sending SERVER_PORT to PHP-FPM, which I am able to verify with &lt;code&gt;phpinfo()&lt;/code&gt; output and &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt;. I'm also able to navigate all of the admin pages with the port number intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless I change General Settings &gt; Site URL to include &quot;:8888&quot;, I've noticed that all rendered links (homepage, sample &quot;Recent News&quot; block) do not include the different port. I am new to Craft; am I correct to assume that the Site URL must include the port number manually specified, despite the code having &lt;code&gt;getServerPort()&lt;/code&gt; in the core code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I added the following to general.php:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'siteUrl'  =&amp;gt; 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].'/',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems sub-optimal; is there a better way to do this? What do others do who run Craft on ports other than 80/443?&lt;/p&gt;&#xA;" OwnerUserId="5358" LastEditorUserId="5358" LastEditDate="2016-07-04T01:21:37.740" LastActivityDate="2016-07-05T15:45:39.047" Title="Non-default web port" Tags="&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15775" PostTypeId="2" ParentId="15773" CreationDate="2016-07-04T03:27:57.373" Score="5" Body="&lt;p&gt;If you know which years should appear, and there are no breaks in the timeline, perhaps it would make more sense to do a simple numeric loop instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for year in (now.year)..2009 %}&#xA;    {{ year }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will count backwards from the current year to 2009.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-07-04T03:27:57.373" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15776" PostTypeId="2" ParentId="15772" CreationDate="2016-07-04T03:39:55.893" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out server side initiated remote calls won't be logged in your browser's Network tab (only client-side ones).  Which now that I type that out, seems very obvious.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If Guzzle actually makes a request, then it will show up in your browser's inspector's &quot;Network&quot; tab.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-07-05T21:32:24.087" LastActivityDate="2016-07-05T21:32:24.087" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15778" PostTypeId="2" ParentId="15774" CreationDate="2016-07-04T05:42:19.337" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;For HTTP the default port is 80 and for HTTPS it's 443,&#xA;obviously.&lt;/li&gt;&#xA;&lt;li&gt;If port is omitted in the site URL, then the default&#xA;one is used.&lt;/li&gt;&#xA;&lt;li&gt;If you want to use a different port, you must&#xA;specify a different port in the URL.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, the logical conclusion is that the port must be present in the URL. When building URLs to entries, for example, the site URL is fetched to generate the final URL. So, unless that URL has port specified in it, you'll get URLs with the wrong port. That's exactly how it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to approach this, however, would be to use &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot;&gt;Craft multi-environment settings&lt;/a&gt; to set it up. That way you won't have to dig into the config files whenever you deploy your site.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2016-07-04T05:42:19.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15779" PostTypeId="1" CreationDate="2016-07-04T10:21:05.430" Score="2" ViewCount="45" Body="&lt;p&gt;A client removed a lot of files in a moment of clarity, not realizing these were used in pages (thinking since they were used in those pages, they were no longer necessary in the assets system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before I completely reset the site to a few weeks ago (that was the time before they realized); is there a way to check the site for missing file links, including those in redactor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is there any strategy for preventing clients from removing used assets? In WP for instance you can see which images are &quot;attached&quot;. This is not waterproof, but still. &lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-07-04T22:18:17.400" Title="Check the site for missing file links / warn user before removing used files" Tags="&lt;assets&gt;&lt;files&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15781" PostTypeId="1" CreationDate="2016-07-04T10:23:39.033" Score="0" ViewCount="130" Body="&lt;p&gt;Can anyone tell me if the Tax Code field in Craft Commerce is able to be validated? I'd  be using it for UK VAT Reg numbers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to check how it can currently be used. Is it just a field to store the tax code information or can it be used to perform validations.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="57" LastEditDate="2016-07-04T16:21:01.883" LastActivityDate="2016-07-04T16:21:01.883" Title="Craft Commerce: Tax Code Field" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15784" PostTypeId="1" AcceptedAnswerId="15787" CreationDate="2016-07-04T12:56:50.603" Score="2" ViewCount="90" Body="&lt;p&gt;I have a navi on which one entry consists of a random channel entry from one section among standard singles:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Single 1&lt;/li&gt;&#xA;&lt;li&gt;Single 2&lt;/li&gt;&#xA;&lt;li&gt;Random Channel entry&lt;/li&gt;&#xA;&lt;li&gt;Single 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I thought about something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randEntry = craft.entries.section('channelX').order('RAND()').first() %}&#xA;{% for navi in craft.entries.section(['single1', 'single2', randPortrait]) %}&#xA;  &amp;lt;li&amp;gt;{{ navi.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not work. (no error, but the variable is simply ignored).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a solution to pass in the variable when looping trough the array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randEntry = craft.entries.section('channelX').order('RAND()').first() %}&#xA;{% for navi in craft.entries.section(['single1', 'single2', randPortrait]) %}&#xA;  &amp;lt;li&amp;gt;{{ navi.title }}&amp;lt;/li&amp;gt;&#xA;  {% if loop.index == '2' %}&#xA;    &amp;lt;li&amp;gt;{{ randEntry.title }}&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that's ugly. Is it possible to pass the whole thing into one array without conditional trickery?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="130" LastEditDate="2016-07-04T20:38:45.087" LastActivityDate="2016-07-04T20:38:45.087" Title="Adding a random entry to an array" Tags="&lt;navigation&gt;&lt;variable&gt;&lt;array&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15785" PostTypeId="1" CreationDate="2016-07-04T15:07:30.707" Score="2" ViewCount="1387" Body="&lt;p&gt;There is an option when setting up Tax Rates to apply the tax to &quot;&lt;strong&gt;both (item + shipping costs)&lt;/strong&gt;&quot; however when testing on the front end the shipping cost is added after tax is applied to the product and no tax percentage is applied to the shipping cost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total amount payable is &lt;em&gt;(Product + Tax) + Shipping&lt;/em&gt;. I want &lt;em&gt;(Product + Shipping) + Tax&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there more configuration needed so that the adjustments show correctly at checkout and the customer is charged the right amount?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2017-07-11T04:44:07.043" Title="Craft Commerce: Calculating (Product + Shipping) + Tax?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15786" PostTypeId="1" CreationDate="2016-07-04T15:57:32.860" Score="1" ViewCount="155" Body="&lt;p&gt;What would be the best way of adding an Agree to Terms checkbox during the the checkout process of craft commerce? I'm thinking this would be best in the address section.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-05T00:44:12.157" Title="Craft Commerce: Agree to Terms Checkbox?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15787" PostTypeId="2" ParentId="15784" CreationDate="2016-07-04T17:04:12.220" Score="3" Body="&lt;p&gt;You can use &lt;code&gt;slice&lt;/code&gt; and &lt;code&gt;merge&lt;/code&gt; filters to “insert” that random entry into your array of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following example I’m using the &lt;code&gt;id&lt;/code&gt; param to query for the selected entries and I’m also setting &lt;code&gt;fixedOrder&lt;/code&gt;, as this returns the entries in the same order as the IDs entered into the &lt;code&gt;id&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selectEntries = craft.entries.id('7, 2, 83, 9, 90').fixedOrder(true) %}&#xA;{% set randEntry = craft.entries.section('channelX').order('RAND()').first() %}&#xA;&#xA;{% set navEntries = selectEntries[:2]|merge([randEntry])|merge(selectEntries[2:]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-04T17:04:12.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15788" PostTypeId="2" ParentId="15774" CreationDate="2016-07-04T18:47:17.377" Score="3" Body="&lt;p&gt;I'm not sure why you believe this is sub-optimal?  You only have to set this &lt;em&gt;once&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm speculating here but since Craft makes no assumptions about your content, it stands to reason that it also makes no assumptions about how it should respond to a non-standard port unless you specify it—the key word there being &lt;em&gt;non-standard&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, Craft uses the &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt; setting to build up the final URL it spits out on the front end for assets, links, etc. Craft will actually build up the link with the correct host you specified automatically. This is especially useful when you use a &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment config&lt;/a&gt;.  (If you've ever used WordPress you can attest to how much of a pain this is, so being able to skip the search/replace step on the database is convenient.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the environment variable config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl'  =&amp;gt; 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].'/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That certainly works but I would be wary of setting &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; dynamically in production, since &lt;code&gt;$_SERVER_NAME&lt;/code&gt; could be &lt;a href=&quot;https://ellislab.com/blog/entry/http-host-and-server-name-security-issues&quot; rel=&quot;nofollow&quot;&gt;spoofed&lt;/a&gt;. The article  was written for EE, though the information contained applies regardless of CMS. The threat is small, even less so on nginx, but it's a consideration nonetheless.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2016-07-05T15:45:39.047" LastActivityDate="2016-07-05T15:45:39.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15789" PostTypeId="1" AcceptedAnswerId="15808" CreationDate="2016-07-04T20:23:06.970" Score="3" ViewCount="893" Body="&lt;p&gt;I'm building a plugin which creates a few tables, and need to store some fairly robust data. I've done this before and previously gotten by with mostly &lt;code&gt;AttributeType::String&lt;/code&gt; and &lt;code&gt;AttributeType::Mixed&lt;/code&gt;, but this time I'd like to ensure I'm doing things by the book. Problem is: so far as I can tell, nobody's written the book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out by &lt;a href=&quot;https://craftcms.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Model&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Record&lt;/a&gt; documentation, but they don't reference the possible AttributeType options. Next I read the &lt;a href=&quot;https://craftcms.com/classreference/enums/AttributeType&quot; rel=&quot;nofollow&quot;&gt;class reference&lt;/a&gt;, but this isn't helpful either. Then I looked at the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/ModelHelper.php&quot; rel=&quot;nofollow&quot;&gt;ModelHelper&lt;/a&gt; and &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/DbHelper.php&quot; rel=&quot;nofollow&quot;&gt;DbHelper&lt;/a&gt; code. These were a bit helpful, but they don't explain how exactly an AttributeType affects throughout Craft. Eventually I found Experience's &lt;a href=&quot;https://experiencehq.net/blog/the-definitive-guide-to-validation-in-craft-part-2-attributetypes&quot; rel=&quot;nofollow&quot;&gt;Definitive Guide to Validation in Craft series&lt;/a&gt; (specifically the linked AttributeType entry). This is quite helpful, but because it's focused mostly on validation, it doesn't answer many of my questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible that &lt;a href=&quot;https://leanpub.com/craft-validation&quot; rel=&quot;nofollow&quot;&gt;the book by Experience&lt;/a&gt; answers gives more detail, but I'm surprised I need a book to learn about this. It also seems like a slight gamble, as I'm only potentially interested in one chapter right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the sort of thing I'm hoping to learn:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the &lt;code&gt;Name&lt;/code&gt; type used for?&lt;/li&gt;&#xA;&lt;li&gt;What's the difference between &lt;code&gt;Handle&lt;/code&gt; and &lt;code&gt;Slug&lt;/code&gt;? Why choose one over the other?&lt;/li&gt;&#xA;&lt;li&gt;What exactly does &lt;code&gt;Template&lt;/code&gt; do, and why does it need its own type?&lt;/li&gt;&#xA;&lt;li&gt;What's the difference between &lt;code&gt;Url&lt;/code&gt; and &lt;code&gt;Uri&lt;/code&gt;? Is it just the validation?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Maybe it's not important to know these things, but I think it would be helpful to understand what I'm doing and how these types are processed and affect the system. It's also not completely clear what types are available, as the ModelHelper source doesn't list types like &lt;code&gt;String&lt;/code&gt;. I assume that's getting inherited from Yii, but I'm not certain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Is there some documentation, or blog post, out there that explains the types available through &lt;code&gt;AttributeType&lt;/code&gt;? &lt;/p&gt;&#xA;" OwnerUserId="248" LastEditorUserId="248" LastEditDate="2016-07-05T14:00:21.217" LastActivityDate="2016-07-05T23:22:54.820" Title="Model/Record AttributeType documentation?" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;records&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15790" PostTypeId="2" ParentId="15779" CreationDate="2016-07-04T22:18:17.400" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;is there a way to check the site for missing file links, including those in redactor?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can't think of a way to do this outside of writing a custom plugin/PHP script that loaded everywhere an Asset field might exist on an install, grabbed its contents and verified them against the file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, it would have to load any Rich Text field you have setup with Asset sources, use some regex to match any Assets reference tags it might contain and do a similar file system verification to check for the existence of the images.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also is there any strategy for preventing clients from removing used assets?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Take away their &quot;Remove Files&quot; permission from the Asset source under their user/user group permissions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-04T22:18:17.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15791" PostTypeId="2" ParentId="15785" CreationDate="2016-07-04T23:34:15.047" Score="3" Body="&lt;p&gt;Currently there is a caveat, that order level shipping costs can not have tax applied to them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means if you have any 'base shipping costs' applied  to the cart the tax engine can not see them because they are not on a line item. Currently the tax adjuster system only adds tax to line items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an issue that will be fixed in a future release but will mean there needs to be a change to the way the adjustment system works. We would need to allow tax to be added to adjustments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want tax on shipping cost you would need to make all shipping rules only add tax to line items. Let me know if you have further questions and I will update my answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: see other answer for the final solution.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-07-11T04:44:07.043" LastActivityDate="2017-07-11T04:44:07.043" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15792" PostTypeId="1" CreationDate="2016-07-05T00:22:59.697" Score="2" ViewCount="110" Body="&lt;p&gt;I am new to Craft and I am trying to figure out how routing works. When I click on an entries nav item, it makes a request to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.com/index.php?p=admin/actions/elementIndex/getElements&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url of the item is &lt;code&gt;.com/entries/affiliates&lt;/code&gt; and the call is ajax. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a section called affiliates, but the 'template' field is Null. I can't seem to figure out where the response is coming from.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="125" LastEditDate="2016-08-04T22:55:03.863" LastActivityDate="2016-09-03T23:11:57.907" Title="How URL Mapping Works" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15793" PostTypeId="2" ParentId="15786" CreationDate="2016-07-05T00:44:12.157" Score="4" Body="&lt;p&gt;We've implemented this using front end JS, simply don't allow submission until it is ticked, but you could (and/or) in theory add a field to your orders and then validate it as set during the onBeforeSaveOrder event I guess?  If not set, you'd set &lt;code&gt;$event-&amp;gt;performAction&lt;/code&gt; to false to stop the order being saved and show an error in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...but frond end JS is probably going to be the easier route here.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-07-05T00:44:12.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15795" PostTypeId="1" AcceptedAnswerId="15796" CreationDate="2016-07-05T02:48:55.450" Score="2" ViewCount="969" Body="&lt;p&gt;Apologies if this has been asked before, I couldn't find any documentation specifically about it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I come from a largely WordPress background but am looking into using Craft Pro for a new client that'll need user registration (real estate website), but I don't want said users to be able to get to the actual CMS backend, rather a simple sort of 'my account' page where it saves their listed properties etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these sorts of things difficult to pull off in Craft? It seems like this aspect of site dev is quite strictly locked down from what I can extrapolate. &lt;/p&gt;&#xA;" OwnerUserId="5360" LastActivityDate="2016-07-05T03:49:47.383" Title="Custom login/profile sections?" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15796" PostTypeId="2" ParentId="15795" CreationDate="2016-07-05T03:49:47.383" Score="3" Body="&lt;p&gt;Its not at all difficult. Here's the example form from the docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you can find a login form here: &lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-profile-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a profile editing template here: &#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-profile-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also remember that you can use all kinds of custom fields on your users&lt;/p&gt;&#xA;" OwnerUserId="597" LastActivityDate="2016-07-05T03:49:47.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15797" PostTypeId="2" ParentId="15767" CreationDate="2016-07-05T10:19:21.163" Score="2" Body="&lt;p&gt;One way to go about this is to use the JSON Expand plugin from &lt;a href=&quot;https://familiar-studio.com/&quot; rel=&quot;nofollow&quot;&gt;Familiar Studio&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/familiar-studio/craft-json-expand&quot; rel=&quot;nofollow&quot;&gt;https://github.com/familiar-studio/craft-json-expand&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's pretty easy to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set hpContent = craft.entries.section('homepageContent').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can just grab the data you need from the json object like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var homepageContent = hpContent|json_expand|raw }};&#xA;    console.log({{ hpContent|json_expand|raw }});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One caveat I've found though is that content in Rich Text editors doesn't output.  If you're just using simple text fields, then you should be fine.  If you do need something Rich Text-like, you could use Craft's &lt;code&gt;|markdown&lt;/code&gt; filter on data from a simple text field.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-07-05T10:19:21.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15798" PostTypeId="1" CreationDate="2016-07-05T10:56:21.513" Score="1" ViewCount="156" Body="&lt;p&gt;I have set up environments in my config file and included a different siteUrl for each. This is so I can change the navigation on the fly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have noticed however that siteUrl when defined in the CP is being used instead of the defined value in the config file. I was under the impression that the CP setting for siteUrl got ignored. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the same database across both environments - would that be an issue?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;     '*' =&amp;gt; array(&#xA;         // ...&#xA;     ),&#xA;     // Local Dev&#xA;     'test.dev' =&amp;gt; array(&#xA;         // ...&#xA;         'devMode' =&amp;gt; true,&#xA;         'environmentVariables' =&amp;gt; array(&#xA;             'assetsBasePath' =&amp;gt; '/Users/joebloggs/Sites/work/example/shop/assets/',&#xA;             'assetsUrl' =&amp;gt; 'http://test.dev/shop/assets/',&#xA;             'siteUrl'  =&amp;gt; 'http://test.dev/',&#xA;         )&#xA;     ),&#xA;     // Live Dev&#xA;     'test.example.com' =&amp;gt; array(&#xA;         // ...&#xA;         'environmentVariables' =&amp;gt; array(&#xA;             'assetsUrl' =&amp;gt; 'http://test.example.com/shop/assets/',&#xA;             'assetsBasePath' =&amp;gt; '/home/example/public_html/shop/assets/',&#xA;             'siteUrl'  =&amp;gt; 'http://test.example.com/',&#xA;         )&#xA;     ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="45" LastEditDate="2016-07-05T21:06:34.943" LastActivityDate="2016-07-05T21:06:34.943" Title="siteUrl config and Control Panel conflict" Tags="&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15799" PostTypeId="2" ParentId="15798" CreationDate="2016-07-05T11:11:33.777" Score="5" Body="&lt;p&gt;The &lt;code&gt;siteUrl&lt;/code&gt; config setting is not meant to be added under &lt;code&gt;environmentVariables&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'test.dev' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://test.dev/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        // ...&#xA;    ),&#xA;    // ...&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-05T11:11:33.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15800" PostTypeId="2" ParentId="15798" CreationDate="2016-07-05T11:13:11.113" Score="2" Body="&lt;p&gt;This seems to solve the problem: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('SERVER_NAME', $_SERVER['SERVER_NAME']);&#xA; if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != &quot;on&quot;) {&#xA;     define('SITE_URL', &quot;http://&quot;.SERVER_NAME . '/');&#xA; } else {&#xA;     define('SITE_URL', &quot;https://&quot;.SERVER_NAME . '/');&#xA; }&#xA;&#xA; return array(&#xA;     '*' =&amp;gt; array(&#xA;         'siteUrl' =&amp;gt; SITE_URL,&#xA;     ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-05T11:13:11.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15802" PostTypeId="1" AcceptedAnswerId="15803" CreationDate="2016-07-05T16:47:27.573" Score="1" ViewCount="621" Body="&lt;p&gt;I am just learning how to use this CMS and I am able to get basic things done but I have no idea what a ajax layout will look like. I have few pages in old system which fetch info using ajax calls (.net based system so it was very easy). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how a layout in this CMS should look like&lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-07-05T17:11:40.343" Title="Ajax layout sample" Tags="&lt;ajax&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15803" PostTypeId="2" ParentId="15802" CreationDate="2016-07-05T17:11:40.343" Score="3" Body="&lt;p&gt;You're not specific about what your Ajax template should return (HTML, JSON...?) – but assuming you want your payload in JSON format, here's a basic layout example which will 1) test if the current request is indeed an Ajax request and 2) set headers for JSON and Access-Control-Allow-Origin (crossdomain):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;/templates/_layouts/ajax&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjaxRequest %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;{% header &quot;Content-Type: application/json; charset=utf-8&quot; %}&#xA;{% header &quot;Access-Control-Allow-Origin: *&quot; %}&#xA;{% block content %}{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;/templates/api/sometemplate&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layouts/ajax' %}&#xA;{% block content %}&#xA;    {&#xA;        &quot;foo&quot;: &quot;bar&quot;,&#xA;        &quot;baz&quot;: &quot;qux&quot;&#xA;    }&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-07-05T17:11:40.343" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15804" PostTypeId="1" AcceptedAnswerId="15805" CreationDate="2016-07-05T17:47:51.947" Score="3" ViewCount="642" Body="&lt;p&gt;I've got a content type for team members but whenever I try to add one it gives me an error saying &quot;the URI 'team' has already been taken&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the URI is made from the slug, which is where I get the error.&#xA;The title of the team members is made automatically from the first name and last name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And even when I type in the slug myself it keeps giving the same error. What's weird is that I was able to create one team member successfully but it started failing afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URI error:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qrghh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qrghh.png&quot; alt=&quot;URI Error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Title settings:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/q8seJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q8seJ.png&quot; alt=&quot;Content type auto title&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5363" LastActivityDate="2016-07-08T08:36:23.313" Title="Error: URI already taken" Tags="&lt;slug&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15805" PostTypeId="2" ParentId="15804" CreationDate="2016-07-05T18:35:45.033" Score="7" Body="&lt;p&gt;(I'm writing this in case someone comes across the same problem)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @MatsMikkelRummelhoff pointed out, I still had to change the URL's format settings to team/{slug}&lt;/p&gt;&#xA;" OwnerUserId="5363" LastEditorUserId="5363" LastEditDate="2016-07-08T08:36:23.313" LastActivityDate="2016-07-08T08:36:23.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15806" PostTypeId="2" ParentId="15792" CreationDate="2016-07-05T21:06:40.087" Score="2" Body="&lt;p&gt;There is an overview of how routing works in Craft here: &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt; and that guide works for front-end routing as well as Craft's own control panel routing when deciding which (if any) templates to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The call to &lt;code&gt;p=admin/actions/elementIndex/getElements&lt;/code&gt; is a control panel AJAX action request (#3 is the routing list) that's going to the &lt;code&gt;craft/app/controllers/ElementIndexController.php&lt;/code&gt;'s &lt;code&gt;actionGetElements&lt;/code&gt; method and returning data.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-05T21:06:40.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15807" PostTypeId="2" ParentId="12870" CreationDate="2016-07-05T21:35:05.787" Score="2" Body="&lt;p&gt;To revitalize this valuable post and expand a bit on what the accepted answer covers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done this using the same template (with conditionals).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're going to have to handle all of your routes manually anyways, I've set up a controller (in a plugin) to give me a little more control over what data these pages get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By wrapping the renderTemplate method in my own, I'm adding context that can be used in templates to control how things are output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function renderAmp($template, array $variables = array()){&#xA;        craft()-&amp;gt;config-&amp;gt;set('amp','');&#xA;        if($variables['amp'] == 'amp'){&#xA;            craft()-&amp;gt;config-&amp;gt;set('devMode',0);&#xA;            craft()-&amp;gt;config-&amp;gt;set('siteUrl',craft()-&amp;gt;config-&amp;gt;get('siteUrl').'/amp/');&#xA;            craft()-&amp;gt;config-&amp;gt;set('amp','/amp');&#xA;        }&#xA;&#xA;        $this-&amp;gt;renderTemplate($template, $variables);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use that config to generate a URL for entries that can be used globally. It sits in my plugin's service and looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryUrl($entry){&#xA;        $channel = craft()-&amp;gt;sections-&amp;gt;getSectionById($entry-&amp;gt;sectionId);&#xA;        $date = str_replace('-', '/', $entry-&amp;gt;postDate);&#xA;        $slug = $entry-&amp;gt;slug;&#xA;&#xA;        $url = implode('/',&#xA;            array(&#xA;                craft()-&amp;gt;config-&amp;gt;get('amp'),&#xA;                $channel,&#xA;                $date,&#xA;                $slug&#xA;            )&#xA;        );&#xA;&#xA;        return strtolower($url);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for completion's sake, my routes &amp;amp; some useful stuff from my templates. Also, note -- I chose to prefix my slugs with amp instead of adding it to the end. Mostly preference, I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Primary&#xA;$routes = array(&#xA;&#xA;    // News&#xA;    '(?P&amp;lt;channel&amp;gt;news)/(?P&amp;lt;year&amp;gt;\d{4})/(?P&amp;lt;month&amp;gt;\d{2})/(?P&amp;lt;day&amp;gt;\d{2})/(?P&amp;lt;slug&amp;gt;.*)/?$' =&amp;gt; array('action' =&amp;gt; 'pluginName/newsEntry'),&#xA;    '(?P&amp;lt;channel&amp;gt;news)/?$' =&amp;gt; array('action' =&amp;gt; 'pluginName/newsAll'),&#xA;&#xA;    // Home&#xA;    '(?P&amp;lt;slug&amp;gt;.*)?/?$' =&amp;gt; array('action' =&amp;gt; 'pluginName/home'),&#xA;&#xA;);&#xA;&#xA;// Amp&#xA;$routes = array_combine(&#xA;    array_map(function($k){&#xA;        $pre = '^(?P&amp;lt;amp&amp;gt;amp)?/?';&#xA;        return $pre.$k;&#xA;    }, array_keys($routes)),&#xA;    $routes&#xA;);&#xA;&#xA;return $routes;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if amp is empty %}&#xA;&#xA;    {% set htmlTag = 'xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot;' %}&#xA;&#xA;    {% set head %}&#xA;        &amp;lt;link rel=&quot;canonical&quot; href=&quot;/{{ matches[0] }}&quot;&amp;gt;&#xA;        &amp;lt;link rel=&quot;amphtml&quot; href=&quot;/amp/{{ matches[0] }}&quot;&amp;gt;&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/css/main.css&quot;&amp;gt;&#xA;    {% endset %}&#xA;&#xA;    {% set scripts %}&#xA;        &amp;lt;script type=&quot;text/javascript&quot; src=&quot;/js/main.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    {% endset %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set htmlTag = 'amp' %}&#xA;&#xA;    {% set head %}&#xA;        &amp;lt;link rel=&quot;canonical&quot; href=&quot;/{{ matches[0]|slice(4) }}&quot;&amp;gt;&#xA;        &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,minimum-scale=1,initial-scale=1&quot;&amp;gt;&#xA;&#xA;        &amp;lt;style amp-boilerplate&amp;gt;&amp;lt;/style&amp;gt;&#xA;&#xA;        &amp;lt;script async src=&quot;https://cdn.ampproject.org/v0.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;        &amp;lt;style amp-custom&amp;gt;&#xA;            {{ source('html/css/amp.css')|raw }}&#xA;        &amp;lt;/style&amp;gt;&#xA;&#xA;        &amp;lt;link href='https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'&amp;gt;&#xA;    {% endset %}&#xA;&#xA;    {% set scripts = '' %}&#xA;&#xA;{% endif %}&#xA;&#xA;// To output an entry's proper URL in a template:&#xA;craft.pluginName.getEntryUrl(entry)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5364" LastActivityDate="2016-07-05T21:35:05.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15808" PostTypeId="2" ParentId="15789" CreationDate="2016-07-05T23:22:54.820" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Problem is: so far as I can tell, nobody's written the book.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's partly our fault... we've never really documented the Attribute parts of Models and Records.  And it probably won't happen now since the majority of that has been stripped out of the upcoming Craft 3 making it much easier to follow Yii 2 conventions (which happens to be way more documented).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the Name type used for?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the context of a Record, it's a shortcut for saying you're going to get a &lt;code&gt;varchar&lt;/code&gt; datatype set to 255 chars.  In the context of a Model, it'll just enforce the 255 character limit.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What's the difference between Handle and Slug? Why choose one over the other?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A handle is a &lt;code&gt;varchar(255)&lt;/code&gt; that has a few pre-defined reserve words.  &lt;code&gt;id, dateCreated, dateUpdated, uid, title&lt;/code&gt;.  Currently used in Craft for defining the &lt;code&gt;handles&lt;/code&gt; that things like Asset Sources, Global Sets, Asset Transforms, etc. uses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isn't a &lt;code&gt;AttributeType::Slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What exactly does &lt;code&gt;Template&lt;/code&gt; do, and why does it need its own type?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's just a shortcut for a &lt;code&gt;varchar(500)&lt;/code&gt;, currently used in Craft when defining a template path for Category and Section settings.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What's the difference between Url and Uri? Is it just the validation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Semantically, a URL is a subset of a URI: &lt;a href=&quot;https://danielmiessler.com/study/url-uri/&quot; rel=&quot;nofollow&quot;&gt;https://danielmiessler.com/study/url-uri/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of Craft, yeah - the only practical difference is the validation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-05T23:22:54.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15809" PostTypeId="1" AcceptedAnswerId="15814" CreationDate="2016-07-06T00:31:04.763" Score="2" ViewCount="114" Body="&lt;p&gt;Our client is a builder and they need a way for their contractors to login and upload/download documents about each build (plans, building consents, information etc). They (the builder) also need a way to share build information with their clients whose homes they're building (plans, progress, photos etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;contractors would be able to log in and we'd present them with a front-end page listing their projects, view the projects' files and maybe allow them to upload files? We want to be able to restrict the contractors only to builds that they're working on. If absolutely necessary it might be ok if the contractors needed to upload files through the CP rather than the front-end.&lt;/li&gt;&#xA;&lt;li&gt;clients would be able to log in to a front-end page and see their build(s) and any files that the contractors/builder had uploaded and made visible to them. they shouldn't be able to view other clients' builds' information.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do this with vanilla Craft, or would we have to write a plugin to enable us to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How easy is it to associate a user/users/groups with entries/asset sources?&lt;/p&gt;&#xA;" OwnerUserId="3529" LastActivityDate="2016-07-06T08:14:47.787" Title="Sharing files with logged-in users" Tags="&lt;entries&gt;&lt;users&gt;&lt;control-panel&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15810" PostTypeId="1" CreationDate="2016-07-06T00:54:09.430" Score="4" ViewCount="402" Body="&lt;p&gt;I'm trying to use the fresh new &lt;a href=&quot;https://github.com/pixelandtonic/DigitalProducts&quot; rel=&quot;nofollow&quot;&gt;Digital Products&lt;/a&gt; plugin in my website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to create some products and assigned licenses, I see some  licenses when I log in as an end user - but the last link is missing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the process of getting a specific product object in my &quot;digital product detail page&quot;, adding it into the order along with other products, paying and getting the license auto generated?&lt;/p&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="45" LastEditDate="2016-07-06T02:41:45.153" LastActivityDate="2016-07-06T15:33:57.207" Title="How do I actually add a Digital Product to an order?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15811" PostTypeId="2" ParentId="15810" CreationDate="2016-07-06T04:30:15.430" Score="2" Body="&lt;p&gt;You would start out by listing the digital products in your templates. For example, if you had digital product type with the handle of &lt;code&gt;onlineCourses&lt;/code&gt;, you would get the list of products like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.digitalProducts.products({type: 'onlineCourses'}).order('price desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looping through those is just like looping through variants (since digital products don't have variants) or entries. One thing to note, is that currently digital products do no have a &lt;code&gt;salePrice&lt;/code&gt;, if you've been using that for Commerce products - just &lt;code&gt;price&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would add digital products to the cart exactly like you would add a Commerce product and, as soon as an order is completed, any digital products that were in the order will have their licenses automatically generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, unlike Craft Commerce standard products where the purchasable is the products' variant, in the case of Digital Products, the purchasable is the product itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ product.defaultVariant.purchasableId}}&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;vs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ digitalProduct.purchasableId}}&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastEditorUserId="91" LastEditDate="2016-07-06T15:33:57.207" LastActivityDate="2016-07-06T15:33:57.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15812" PostTypeId="1" CreationDate="2016-07-06T05:26:52.103" Score="2" ViewCount="301" Body="&lt;p&gt;How do I show possible discounts available to the current product?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-06T15:25:01.957" Title="How can I know the discounts available to a product before adding it to the cart?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15813" PostTypeId="2" ParentId="15812" CreationDate="2016-07-06T05:26:52.103" Score="2" Body="&lt;p&gt;You currently can not know if a product matches a discount until it is added to the cart and the discount engine does the checks based on the full conditions of the discount. Many conditions of which are directly related to the product being in the cart. For example a minimum order qty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want to return a possible list of discounts to show the custom of which the product MAY be eligible before adding to the cart then you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for discount in craft.commerce.discounts %}&#xA;  Possible Discounts:&amp;lt;br&amp;gt;&#xA;  {% if product.id in discount.productIds or product.typeId in discount.productTypeIds %}&#xA;    {{discount.description}}&amp;lt;br&amp;gt;&#xA;  {% endif%}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This only checks the product and it's product type is explicitly listed in the discount, but you can add additional conditions if you wished.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is recommended the discount description has a readable sentance for how this discount could be applied. For example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Buy 2 or more sneakers and get 75% off.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-07-06T15:25:01.957" LastActivityDate="2016-07-06T15:25:01.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15814" PostTypeId="2" ParentId="15809" CreationDate="2016-07-06T08:14:47.787" Score="3" Body="&lt;p&gt;Welcome to the community Adam. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes. Completely possible with vanilla Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's always more than one way to achieve things but here's a first round. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by creating two &lt;strong&gt;User Groups&lt;/strong&gt;; Contractors and Clients. This will allow you to define permissions as needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 'Property Projects' &lt;strong&gt;Section&lt;/strong&gt; could contain fields like. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Title&lt;/li&gt;&#xA;&lt;li&gt;Description&lt;/li&gt;&#xA;&lt;li&gt;Images&lt;/li&gt;&#xA;&lt;li&gt;Related Contractors (user)&lt;/li&gt;&#xA;&lt;li&gt;Related Client (user)&lt;/li&gt;&#xA;&lt;li&gt;Etc as needed&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Craft has a custom &lt;strong&gt;field type&lt;/strong&gt; called '&lt;strong&gt;User&lt;/strong&gt;' which will allow you to &lt;strong&gt;relate&lt;/strong&gt; all of the relevant contractors to the project and also define who the client is, all within the 'project' Entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the client also has a user profile and is able to log in to Craft (front end only), you can present their project information to them in the 'client area' of the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you actually want the client to edit their project Entry, then you could also consider making them the Author of their Entry. (Just an idea)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at Craft's &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-07-06T08:14:47.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15815" PostTypeId="2" ParentId="15772" CreationDate="2016-07-06T09:54:46.047" Score="1" Body="&lt;p&gt;As Brad says, server side requests won't show up in your browser's dev tools. There's a few ways you can debug the calls:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, if you simply want to know if the Guzzle request ran and completed successfully, the easiest option is to use Craft's built-in logging feature by calling &lt;code&gt;MyPlugin::log&lt;/code&gt; (obviously, replace &quot;MyPlugin&quot; with the real handle for your plugin):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::log('For those about to guzzle.');&#xA;&#xA;try {&#xA;    $response = $client-&amp;gt;send($request);&#xA;    MyPlugin::log('I guzzled!');&#xA;} catch (\Exception $e) {&#xA;    MyPlugin::log('Omg guzzling failed: '.$e-&amp;gt;getMessage(), LogLevel::Error);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;MyPlugin::log&lt;/code&gt; will write whatever you feed it to a file called &lt;code&gt;/craft/storage/runtime/logs/myplugin.log&lt;/code&gt;. On a Unix-based system (such as OS X) you can monitor this file for changes by writing &lt;code&gt;$ tail -f myplugin.log&lt;/code&gt; in your Terminal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the &lt;code&gt;log&lt;/code&gt; function will only accept string values. If you need to debug an object – e.g. the Guzzle response – you can simply JSON encode it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::log('I guzzled, and all I got was '.json_encode($response));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For large/complex objects, this isn't really feasible, though – the log file will quickly become too large and/or unreadable. Beyond JSON, there's a few other options for object logging &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8427/output-array-to-pluginlog&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative (or in addition) to Craft's built-in logging, you may want to look into remote logging tools as well. There's several, though I'm personally a big fan of &lt;a href=&quot;https://rollbar.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rollbar&lt;/a&gt;. Rollbar is designed to catch exceptions, but it also has a logging feature similar to Craft's – the difference being that the message isn't output to a local file, but sent off to your Rollbar account (and, optionally, to wherever you want – your email, a private Slack channel, whatever). &lt;a href=&quot;https://github.com/boboldehampsink/rollbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;There's even a Craft plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond simple logging: For real object inspection, you may want to look into XDebug, a debugging extension for PHP. By configuring an IDE like &lt;a href=&quot;https://www.jetbrains.com/help/phpstorm/10.0/configuring-xdebug.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHPStorm&lt;/a&gt; with XDebug, you'll be able to set breakpoints in your code, and debug/inspect variables at runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to use a tool like &lt;a href=&quot;https://craig.is/writing/chrome-logger&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chrome Logger&lt;/a&gt;, which will let you log strings and objects to Chrome's console (basically just like you'd use &lt;code&gt;console.log&lt;/code&gt; in JavaScript).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &#xA;I just realized that you're not actually writing your own plugin, which makes the above answer less useful.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-07-07T17:42:55.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15816" PostTypeId="2" ParentId="15639" CreationDate="2016-07-06T10:14:43.773" Score="1" Body="&lt;p&gt;I don't think this is a bug. If you are saying that you are using a custom plugin on creating a user you will have to define an on onSaveUser event after the save user script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;onSaveUser(new Event($this, array(&#xA;    'user'      =&amp;gt; $user,&#xA;    'isNewUser' =&amp;gt; $isNewUser&#xA;)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sprout Email uses Craft events to trigger the notification.&lt;/p&gt;&#xA;" OwnerUserId="5365" LastEditorUserId="115" LastEditDate="2016-07-06T15:59:39.367" LastActivityDate="2016-07-06T15:59:39.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15817" PostTypeId="1" AcceptedAnswerId="15828" CreationDate="2016-07-06T11:07:39.343" Score="1" ViewCount="342" Body="&lt;p&gt;I'm pretty new to Craft and Craft Commerce and right now I'm struggling with the following: in the navigation I want a list item for every product type. This works with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;    &amp;lt;li&amp;gt;{{ productType.name }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I now link this product type to an collection template and show only products of this type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the second question is: If at least one product has the tag &quot;new&quot; I want a list item for this in the menu as well. I created a tag field for this. But how can I now check if there are products with this tag and can I link this to an collection template as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="5366" LastEditorUserId="45" LastEditDate="2016-07-12T17:15:49.337" LastActivityDate="2016-07-12T17:15:49.337" Title="Product Type Collections &amp; Tags" Tags="&lt;plugin-craftcommerce&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15818" PostTypeId="2" ParentId="14826" CreationDate="2016-07-06T11:56:51.157" Score="1" Body="&lt;p&gt;At first glance, it looks like a little conflict around absolute positioning&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had good success in 'massaging' the Craft CP using: &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CPCSS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here for a little more, too: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12788/remove-outdent-indent-from-redactor2-lists-button/14786#14786&quot;&gt;Remove outdent &amp;amp; indent from Redactor2 &amp;quot;lists&amp;quot; button&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps, Cole&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-06T11:56:51.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15819" PostTypeId="1" CreationDate="2016-07-06T12:30:57.340" Score="2" ViewCount="881" Body="&lt;p&gt;Hi I have a plugin which I am running an sql statement from.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$users = craft()-&amp;gt;db-&amp;gt;createCommand(&quot;SELECT craft_users.id as userId, craft_users.firstName, craft_users.lastName, craft_users.email FROM craft_users INNER JOIN craft_content on craft_users.id = craft_content.elementId WHERE craft_content.field_interests LIKE '%\&quot;8948\&quot;%'&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The query is not returning the expected results from the createCommand function in fact it returns an empty array. But if I run it directly in the database it works perfectly and returns the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried building this with the query builder but it was throwing errors and not finding the user table.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-07-06T15:19:43.153" Title="createCommand sql query not working in plugin" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;mysql&gt;&lt;createcommand&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15820" PostTypeId="1" AcceptedAnswerId="15822" CreationDate="2016-07-06T14:21:26.477" Score="2" ViewCount="969" Body="&lt;p&gt;A client wants his CRM connected to Craft Commerce. If someone finishes an order the customer data and the ordered products should be send to the CRM.&#xA;I assume I have to write a plugin for that, but I have no idea how to start and how the grab the desired data. Can anyone point me to the right direction? The CRM used is &lt;a href=&quot;https://www.bitrix24.com/&quot; rel=&quot;nofollow&quot;&gt;https://www.bitrix24.com/&lt;/a&gt; if that's of importance.&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2016-07-06T15:30:26.813" Title="How can I get Craft Commerce talk to the API of a CRM?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15821" PostTypeId="2" ParentId="15819" CreationDate="2016-07-06T15:09:59.473" Score="3" Body="&lt;p&gt;Thanks to @carlcs for pointers managed to get this working with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$criteria-&amp;gt;limit = NULL;&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$params = array(&#xA;    ':interest' =&amp;gt; '%&quot;8948&quot;%',&#xA;);&#xA;$query-&amp;gt;andWhere(&quot;field_interests LIKE :interest&quot;, $params);&#xA;$result = $query-&amp;gt;queryAll() ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2016-07-06T15:19:43.153" LastActivityDate="2016-07-06T15:19:43.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15822" PostTypeId="2" ParentId="15820" CreationDate="2016-07-06T15:30:26.813" Score="2" Body="&lt;p&gt;You will need to write a plugin to perform the integration. If you make it generic enough, you could share it with the community.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin would use Craft Commerce &lt;strong&gt;events&lt;/strong&gt; to run PHP code at specific points in the code, which would communicate with the third-party systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Docs on event:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The event you would probably be most interested in is the &lt;code&gt;onOrderComplete&lt;/code&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-06T15:30:26.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15823" PostTypeId="1" AcceptedAnswerId="15824" CreationDate="2016-07-06T16:41:43.897" Score="1" ViewCount="77" Body="&lt;p&gt;Is there anyway to send a custom field by email? For example if a customer were to enter a shipping note and submits an order is there a way to send that note to an email address?&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="45" LastEditDate="2016-08-13T02:47:04.280" LastActivityDate="2016-08-13T02:47:04.280" Title="Send a custom field by email" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15824" PostTypeId="2" ParentId="15823" CreationDate="2016-07-06T18:17:17.630" Score="2" Body="&lt;p&gt;Best way to do this would be creating a small plugin (recommended on every Commerce install, to be able to easily extend it). In this plugin's init method, you could listen to the OrderComplete event and send the mail. This is untested, but should get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('commerce_orders.onOrderComplete', function($event) {&#xA;        $order = $event-&amp;gt;params['order'];&#xA;        $note = $order-&amp;gt;getContent()-&amp;gt;shippingNoteFieldHandle;&#xA;&#xA;        if ($note) {&#xA;            //Send Mail&#xA;            $email = new EmailModel();&#xA;            $email-&amp;gt;toEmail = 'address@tospam.com';&#xA;            $email-&amp;gt;subject = 'New order completed';&#xA;            $email-&amp;gt;body    = $note;&#xA;&#xA;            craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;pluginfactory.io&lt;/a&gt; to quickly create a plugin, then put the init method in the plugin's base class.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2016-07-06T18:17:17.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15825" PostTypeId="1" CreationDate="2016-07-06T19:24:04.233" Score="2" ViewCount="128" Body="&lt;p&gt;Is there a way, via an Event or otherwise, to catch the first time a post is saved and isn't in disabled mode? I want to send out an email alert to users when a new entry is published, but I want it to be possible to work on it in disabled mode first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the &lt;code&gt;entries.onSaveEntry&lt;/code&gt; event, it comes with the a param for isNewEntry, but I can't use this because it's only true the very first time an entry is saved, even if it's saved in disabled status. After that it will always return false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It wouldn't be difficult to add an additional field to the entry that would track whether or not emails were sent, but I was wondering if there's a more straightforward way to handle it.&lt;/p&gt;&#xA;" OwnerUserId="3454" LastActivityDate="2016-07-07T04:27:18.623" Title="Checking for first time an entry is &quot;published&quot; i.e. saved with a Live status" Tags="&lt;entry&gt;&lt;events&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15827" PostTypeId="2" ParentId="15825" CreationDate="2016-07-06T22:26:02.623" Score="2" Body="&lt;p&gt;There isn't an &quot;event&quot; that gets fired when an entry goes live, but you should be able to listen to the &lt;code&gt;onSaveEntry&lt;/code&gt; event, then check the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11686/set-status-in-a-plugin/11693#11693&quot;&gt;same criteria&lt;/a&gt; that Craft uses to determine if an entry is live or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as tracking if it's the first time the entry had a live status or not, it's kind of lame, but your plugin could have a &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Record&lt;/a&gt;/table that kept track of the entry ID and status so you'd know if it was the first time an entry ID had a status of Live or not.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-07-07T04:27:18.623" LastActivityDate="2016-07-07T04:27:18.623" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15828" PostTypeId="2" ParentId="15817" CreationDate="2016-07-07T04:20:47.007" Score="1" Body="&lt;p&gt;Well as always with Craft there are many ways to skin this particular cat.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple approach would be to have a catalogue template (either just one for all product types or separate ones for each product type if you want to vary the format significantly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming just one template for your various catalogues, this could live in your  templates folder at e.g. &lt;code&gt;_site/product-catalogue.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set up a route in Settings-&gt;Routes, such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;*/catalogue&lt;/code&gt; pointed to  &lt;code&gt;/_site/product-catalogue&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this template would then load whenever someone went to e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;yoursite.com/monitors/catalogue&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In there you could query for all products of that type and display them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment_1 = craft.request.getSegment(1) %}&#xA;{% set products = craft.commerce.products.type(segment_1).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and proceed from there any way you like, really, in terms of display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of building you nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/{{ productType.handle }}/catalogue&quot;&amp;gt;{{ productType.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Another approach would be to add all the products to a category, and then use category fields and a category template to display your product list).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used tags much, and I am not sure I'm 100% on what you're asking (do you want to highlight sections with new products, or create an extra element in your nav for these?)....but in essense you'd probably have to search for products in that category and look for a tag of New.  Here's some sketch code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;   results = search for entries with this type that have the tag New&#xA;   if the length of results &amp;gt; 0&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/productType.handle/catalogue&quot;&amp;gt;*** NEW *** {{ productType.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;   else&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/productType.handle/catalogue&quot;&amp;gt;{{ productType.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;   endif&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft docs on doing the search are here: &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="5366" LastEditDate="2016-07-07T09:35:59.800" LastActivityDate="2016-07-07T09:35:59.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15829" PostTypeId="1" CreationDate="2016-07-07T08:37:36.780" Score="1" ViewCount="680" Body="&lt;p&gt;I'm a little bit new to Craft, but it's already my favorite CMS, even after 8 years or so in Wordpress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I need to do. I have integrated a preloader into my site, using preload.js, and I need to know if there is a way to utilize Twig within my JavaScript files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, preload.js gets all of the assets to preload from a load Manifest, which is created with JSON. I got this working properly as an inline script, simply pulling the sources of all my assets, based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2006/how-do-i-display-a-list-of-assets-with-the-entries-they-are-related-to&quot;&gt;this question.&lt;/a&gt; What I need to know is, is there a way to use these Twig tags inside of an external JavaScript file? I know that there is in liquid, but I'd like to get this working here as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-07T15:52:56.970" Title="Twig in External jQuery" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15830" PostTypeId="1" AcceptedAnswerId="15837" CreationDate="2016-07-07T09:07:43.157" Score="1" ViewCount="172" Body="&lt;p&gt;I'm doing some testing on file uploads and discovered that the .bmp file format gets rejected even though defined in my config file as an allowed file extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have added the following to my config file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 'extraAllowedFileExtensions' =&amp;gt; 'bmp, jpeg, tiff, pdf, cdr, gbr, gtl, dxf, dwg',&#xA; 'allowedFileExtensions' =&amp;gt; 'bmp, jpeg, tiff, pdf, cdr, gbr, gtl, dxf, dwg',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is the error I receive:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file “/private/var/tmp/php7Md2bj” does not appear to be an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/shop/craft/app/etc/image/Image.php(138)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;138    throw new Exception(Craft::t('The file “{path}” does not appear to be an image.', array('path' =&amp;gt; $path)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I fix this?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="45" LastEditDate="2016-07-07T16:42:56.660" LastActivityDate="2016-07-07T16:42:56.660" Title="Error uploading .bmp file format - gets rejected" Tags="&lt;upload&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15831" PostTypeId="2" ParentId="15829" CreationDate="2016-07-07T09:21:47.317" Score="2" Body="&lt;p&gt;Just put your javascript file in the templates folder. E.g. place a file called &lt;code&gt;external.js&lt;/code&gt; in the folder &lt;code&gt;craft/templates/includes/&lt;/code&gt;. Then include it like this &lt;code&gt;&amp;lt;script src=&quot;/includes/external.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is an official way to do it, but it works.&lt;/p&gt;&#xA;" OwnerUserId="3874" LastEditorUserId="125" LastEditDate="2016-07-07T10:09:37.700" LastActivityDate="2016-07-07T10:09:37.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15832" PostTypeId="1" AcceptedAnswerId="15904" CreationDate="2016-07-07T11:27:24.767" Score="1" ViewCount="113" Body="&lt;p&gt;I'm trying to test for a taxCategory within Craft Commerce and finding it awkward to do so. I can't see much in the docs, but have managed to put this together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.taxCategory | length %}&#xA;    {% for taxCategory in product.taxCategory %}&#xA;        {# loops through the taxCategory with the first string being the id, #}&#xA;        {# the second the name and the third string seems to be the slug #}&#xA;        {% if loop.index == 3 and taxCategory == &quot;withVat&quot; %}&#xA;            +VAT&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't seem very elegant. Any suggestions? The docs example probably needs updating, I think, because:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for taxCategory in craft.commerce.taxCategories %}&#xA;    {{ taxCategory.id }} - {{ taxCategory.name }}&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...outputs: &quot;Impossible to access an attribute (&quot;id&quot;) on a string variable&quot;&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-14T02:32:40.147" Title="How to output taxCategory in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15833" PostTypeId="1" CreationDate="2016-07-07T12:16:40.747" Score="1" ViewCount="160" Body="&lt;p&gt;I am using the GuestEntries (&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries&lt;/a&gt;) Plugin to try to allow guests to update entries. I have it working to where a guest can come to the page and fill out the form but unfortunately it is creating a new entry rather than editing the existing one. &lt;/p&gt;&#xA;" OwnerUserId="5369" LastActivityDate="2016-07-07T14:15:25.280" Title="Guest Entries creating new entry instead of editing the current one" Tags="&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15834" PostTypeId="2" ParentId="15767" CreationDate="2016-07-07T12:48:46.343" Score="1" Body="&lt;p&gt;This is how I did it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;     var bpDetails = {&#xA;         buttonText: '{{ siteOptions.buttonText }}',&#xA;         descriptionText: '{{ siteOptions.descriptionText }}'&#xA;     };&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was then able to access this variable in my AngularJS portion and check &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(bpDetails)&#xA;  vm.bpDetails = bpDetails; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way I was able to use the craft content stored into a JS object to display/manipulate in the view.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2016-07-07T12:48:46.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15835" PostTypeId="2" ParentId="15833" CreationDate="2016-07-07T14:15:25.280" Score="3" Body="&lt;p&gt;I got it to work by adding the below at line 182 of GuestEntriesController.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $entry-&amp;gt;id = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I added a hidden field with the current entries id in the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is the best way to do it but it seems to be working. If this is going to cause issuees or there is a better way to do it let me know and I will swap my fix out with yours. &lt;/p&gt;&#xA;" OwnerUserId="5369" LastActivityDate="2016-07-07T14:15:25.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15836" PostTypeId="1" CreationDate="2016-07-07T15:36:13.037" Score="2" ViewCount="665" Body="&lt;p&gt;I have had a Craft install running for some time now, and it has come to the point where I want to run it securely over HTTPS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Laravel Forge, I have set up a Let's Encrypt certificate successfully, so on certain pages of the site it all works well. In my &lt;code&gt;config/general.php&lt;/code&gt; file I altered the &lt;code&gt;siteUrl&lt;/code&gt; and &lt;code&gt;environmentVariables&lt;/code&gt; -&gt; &lt;code&gt;baseUrl&lt;/code&gt; to use https.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I try to log in to the admin on this server, in the JS Console, the GET requests for all the admin/resources CSS / JS files are returning 404. So the admin login screen shows without any styling, and crucially, logging in returns a bad CSRF token screen!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my nginx config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# FORGE CONFIG (DOT NOT REMOVE!)&#xA;include forge-conf/www.fira.co.uk/before/*;&#xA;&#xA;server {&#xA;    listen      80;&#xA;    server_name www.fira.co.uk;&#xA;    rewrite     ^   https://$server_name$request_uri? permanent;&#xA;}&#xA;&#xA;server {&#xA;    listen 443 ssl;&#xA;    server_name www.fira.co.uk;&#xA;    root /home/forge/www.fira.co.uk/public;&#xA;&#xA;    # FORGE SSL (DO NOT REMOVE!)&#xA;    ssl_certificate /etc/nginx/ssl/www.fira.co.uk/105882/server.crt;&#xA;    ssl_certificate_key /etc/nginx/ssl/www.fira.co.uk/105882/server.key;&#xA;&#xA;    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;&#xA;    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';&#xA;    ssl_prefer_server_ciphers on;&#xA;    ssl_dhparam /etc/nginx/dhparams.pem;&#xA;&#xA;    index index.html index.htm index.php;&#xA;&#xA;    charset utf-8;&#xA;&#xA;    # FORGE CONFIG (DOT NOT REMOVE!)&#xA;    include forge-conf/www.fira.co.uk/server/*;&#xA;&#xA;    location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;&#xA;    location = /favicon.ico { access_log off; log_not_found off; }&#xA;    location = /robots.txt  { access_log off; log_not_found off; }&#xA;&#xA;    access_log off;&#xA;    error_log  /var/log/nginx/www.fira.co.uk-error.log error;&#xA;&#xA;    error_page 404 /index.php;&#xA;&#xA;    location ~ \.php$ {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;    }&#xA;&#xA;    location ~ /\.ht {&#xA;        deny all;&#xA;    }&#xA;&#xA;    # Media: images, icons, video, audio, HTC&#xA;location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {&#xA;  expires 1M;&#xA;  access_log off;&#xA;  add_header Cache-Control &quot;public&quot;;&#xA;}&#xA;&#xA;# CSS and Javascript&#xA;location ~* \.(?:css|js)$ {&#xA;  expires 1M;&#xA;  access_log off;&#xA;}&#xA;}&#xA;&#xA;# FORGE CONFIG (DOT NOT REMOVE!)&#xA;include forge-conf/www.fira.co.uk/after/*;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2016-07-07T15:57:45.063" LastActivityDate="2016-07-07T16:41:44.157" Title="Craft site moved to HTTPS - now having issues" Tags="&lt;server&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15837" PostTypeId="2" ParentId="15830" CreationDate="2016-07-07T15:51:54.767" Score="5" Body="&lt;p&gt;You're probably using &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt;, which doesn't support BMP files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you install  &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt; on your server, Craft will use it automatically and it supports a much wider range of file types, including BMP files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-07T15:51:54.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15838" PostTypeId="2" ParentId="15836" CreationDate="2016-07-07T16:41:44.157" Score="3" Body="&lt;p&gt;So, removing the cache settings for CSS and JS in my nginx config fixed this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# CSS and Javascript&#xA;location ~* \.(?:css|js)$ {&#xA;expires 1M;&#xA;access_log off;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, once I got into the admin area after adjusting this, resaving certain entries flushed the twig template cache.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-07-07T16:41:44.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15839" PostTypeId="1" CreationDate="2016-07-07T16:49:47.973" Score="1" ViewCount="118" Body="&lt;p&gt;I’m moving new project from Wordpress to Craft, which has the hierarchy in URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m try to compose URL for this new project:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New category field have an option &quot;Limit the number of selectable categories.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I change to 1, because this category is part of URL structure: blog/{state.first.slug}/&lt;strong&gt;{myCategory.last.uri}&lt;/strong&gt;/{postDate|date(&quot;Y&quot;)}/{postDate|date(&quot;m&quot;)}/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{myCategory.last.uri} can be nested, but, as I limited to 1, and I select any category of level 2 is automatically selected level 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't able to select only one category keeping levels? (I know it sounds weird) Like: /blog/stateCategory/&lt;strong&gt;myCategoryLevel1&lt;/strong&gt;/&lt;strong&gt;myCategoryLevel2&lt;/strong&gt;/2016/07/slug ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, I just wanted to limit the “one&quot; inside the hierarchy... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Selecting “&lt;strong&gt;myCategoryLevel2&lt;/strong&gt;” automatically place the “&lt;strong&gt;MyCategoryLevel1&lt;/strong&gt;&quot; in the url. I know this sounds very strange, but this new project, I need to leave identical url structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5179" LastActivityDate="2016-07-07T16:49:47.973" Title="Compose entry URL with hierarchy" Tags="&lt;categories&gt;&lt;entry&gt;&lt;url&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15840" PostTypeId="1" AcceptedAnswerId="15844" CreationDate="2016-07-07T17:37:16.593" Score="1" ViewCount="426" Body="&lt;p&gt;Is there a way to add &lt;code&gt;tel:&lt;/code&gt; links in the Redactor WYSIWYG?&lt;br&gt;&#xA;I tried &lt;code&gt;Link&lt;/code&gt; &gt; &lt;code&gt;Insert link&lt;/code&gt; to enter &lt;code&gt;tel:+43123456789&lt;/code&gt; as URL,&lt;br&gt;&#xA;but all I got was &lt;code&gt;&amp;lt;a&amp;gt;+43123456789&amp;lt;/a&amp;gt;&lt;/code&gt;. The href is missing.&lt;/p&gt;&#xA;" OwnerUserId="5261" LastActivityDate="2016-07-07T21:26:54.983" Title="Adding tel: links using Redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15841" PostTypeId="1" CreationDate="2016-07-07T19:11:32.243" Score="2" ViewCount="143" Body="&lt;p&gt;I got this weird error message when trying to view a previous revision...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_8mvcY59Y5sz9qAyfufetQi5LWATEmqwdMnVR' in 'field list'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CcBvg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CcBvg.png&quot; alt=&quot;Error: Unknown column&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I didn't really do anything too unusual... I simply tried to view a previous version of the entry.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TxncT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxncT.png&quot; alt=&quot;View revisions&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Disclaimer... This is a very large website, and it's evolved &lt;em&gt;a lot&lt;/em&gt; over the past year or so. I'm guessing this might have something to do with a field that has changed, but I really have no clue.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What does this mean? How did I get here? And how do I fix it?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-07-07T19:11:32.243" Title="Error when trying to view a previous version of an entry" Tags="&lt;error-message&gt;&lt;entry-versions&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15842" PostTypeId="1" CreationDate="2016-07-07T21:10:23.413" Score="2" ViewCount="115" Body="&lt;p&gt;Another easy question for you all.... &#xA;I'm trying to display all entries in a specific category. I'm using the below code from the Craft site, but not sure what I'm missing. I'm replacing the &quot;entries&quot; in the output section with the category name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you... &lt;/p&gt;&#xA;" OwnerUserId="4929" LastEditorUserId="57" LastEditDate="2016-07-07T21:26:09.950" LastActivityDate="2016-07-07T21:26:09.950" Title="Category Entries" Tags="&lt;entries&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15843" PostTypeId="2" ParentId="15842" CreationDate="2016-07-07T21:24:22.957" Score="1" Body="&lt;p&gt;You need to set the category variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, I'm using a slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('catSlug') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So full code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug('catSlug') %}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2016-07-07T21:24:22.957" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15844" PostTypeId="2" ParentId="15840" CreationDate="2016-07-07T21:26:54.983" Score="2" Body="&lt;p&gt;Under your Rich Text field settings, if you uncheck the &quot;Purify HTML?&quot; option, the &lt;code&gt;tel:&lt;/code&gt; reference will stay in tact.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-07T21:26:54.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15845" PostTypeId="1" CreationDate="2016-07-08T07:44:39.383" Score="1" ViewCount="212" Body="&lt;p&gt;I have a site where am registering users via the front-end.&#xA;I want to use email address as username and also want people to define their password on registration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the following in &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'useEmailAsUsername' =&amp;gt; true,&#xA;'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;'activateAccountSuccessPath' =&amp;gt; 'register/success',&#xA;'verificationCodeDuration' =&amp;gt; 'P1W'     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when a user registers via the front-end - or I resend the activation link via the Control Panel - they are directed to a page/URL eg &lt;code&gt;actions/users/verifyemail?code=XXXX&amp;amp;id=XXXX&lt;/code&gt; and get the following error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Oops!&#xA;&#xA;Invalid verification code. Please login or reset your password.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can't figure out why the verification code is not working.&#xA;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-07-08T08:35:47.090" Title="Member activation query" Tags="&lt;users&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15846" PostTypeId="2" ParentId="15845" CreationDate="2016-07-08T08:35:47.090" Score="1" Body="&lt;p&gt;Solved - bizarre one this.&#xA;Was using a third-party email service via SMTP and it was manipulating the URL somehow. Switching to use a direct SMTP connection with a specific email account has resolved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go figure!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-07-08T08:35:47.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15847" PostTypeId="1" AcceptedAnswerId="15868" CreationDate="2016-07-08T12:50:31.407" Score="2" ViewCount="412" Body="&lt;p&gt;The url: &lt;a href=&quot;https://www.fira.co.uk/fullmembers.json&quot; rel=&quot;nofollow&quot;&gt;https://www.fira.co.uk/fullmembers.json&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is an endpoint for Craft's element API plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been working fine until recently I did a few things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I changed the site to https&lt;/li&gt;&#xA;&lt;li&gt;There have been some tweaks to the server config (nginx caching etc)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem I am having is that the URL returns a 404 header but still displays the JSON response in the browser. This 404 is affecting my wget script that systematically saves the response to a static file, as to improve performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why the endpoint would be behaving like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't altered the elementapi.php recently but here it is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'fullmembers.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'User',&#xA;            'criteria' =&amp;gt; ['group' =&amp;gt; 'fullMembership', 'limit' =&amp;gt; null, 'order' =&amp;gt; 'companyName'],&#xA;            'paginate' =&amp;gt; false,&#xA;            'transformer' =&amp;gt; function(UserModel $member) {&#xA;                // var_dump($member-&amp;gt;memberAddress);&#xA;                $businessCategories = [];&#xA;                foreach ($member-&amp;gt;businessTypeMarketSectorsProducts as $block) {&#xA;                    switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                        case 'businessCategory':&#xA;&#xA;                        $productValues = [];&#xA;                        foreach ($block-&amp;gt;product as $prod) {&#xA;                            if ($prod-&amp;gt;selected) {&#xA;                                $productValues[] = $prod-&amp;gt;value;&#xA;                            }&#xA;                        }&#xA;&#xA;                        $businessCategories[] = [&#xA;                            'businessType' =&amp;gt; $block-&amp;gt;businessType-&amp;gt;value,&#xA;                            'marketSector' =&amp;gt; $block-&amp;gt;marketSector-&amp;gt;value,&#xA;                            'product' =&amp;gt; $productValues&#xA;                        ];&#xA;&#xA;                        break;&#xA;                    }&#xA;                }&#xA;                // $urlslug = strtolower(implode('-',explode(&quot; &quot;, $member-&amp;gt;membersCompanyName)));&#xA;                $urlslug = StringHelper::toKebabCase($member-&amp;gt;membersCompanyName);&#xA;&#xA;                return [&#xA;                    'id' =&amp;gt; $member-&amp;gt;id,&#xA;                    'companyName' =&amp;gt; $member-&amp;gt;membersCompanyName,&#xA;                    // 'memberAddress' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;attributes,&#xA;                    'lat' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lat,&#xA;                    'lng' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;lng,&#xA;                    'city' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;city,&#xA;                    'street1' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;street1,&#xA;                    'street2' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;street2,&#xA;                    'street3' =&amp;gt; $member-&amp;gt;membersAddressLine3,&#xA;                    'zip' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;zip,&#xA;                    'country' =&amp;gt; $member-&amp;gt;memberAddress-&amp;gt;country,&#xA;                    'email' =&amp;gt; $member-&amp;gt;email,&#xA;                    'phone' =&amp;gt; $member-&amp;gt;membersPhoneNumber,&#xA;                    'profile' =&amp;gt; UrlHelper::getUrl(&quot;directory/company/{$member-&amp;gt;id}/{$urlslug}&quot;),&#xA;                    'businessCategories' =&amp;gt; $businessCategories&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-09-20T23:55:56.007" Title="Element API Endpoint returns data but has 404 header" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15848" PostTypeId="1" CreationDate="2016-07-08T14:06:27.510" Score="1" ViewCount="144" Body="&lt;p&gt;Using a plugin, I have added some nested entry sources to some of the default section entry sources in my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'section:6' =&amp;gt; [&#xA;    'label' =&amp;gt; 'News',&#xA;    ...&#xA;    'nested' =&amp;gt; [&#xA;        'foo' =&amp;gt; [&#xA;            'label' =&amp;gt; 'Foo',&#xA;            ...&#xA;        ],&#xA;        'bar' =&amp;gt; [&#xA;            'label' =&amp;gt; 'Bar',&#xA;            ...&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, for the main entry source (section:6), I am able to select the visible columns (table attributes) that appear in the element index listing. However, that selection of table attributes does not filter down to the nested entry sources. When I click on a nested entry source, the default table attributes are utilised rather than the attributes that were selected for the parent source. I want my nested entry sources to utilise the same table attributes as the parent entry source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some digging around in the Craft CMS code and database, and it appears as though the craft_elementindexsettings table only saves the table attributes selected for top level entry sources and not nested ones. So when the ElementIndexesService is called upon to getTableAttributes for the nested source key, it is returning the default attributes (as evident below).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTableAttributes($elementTypeClass, $sourceKey)&#xA;{&#xA;    ...&#xA;&#xA;    // Is there a custom attributes list?&#xA;    if (isset($settings['sources'][$sourceKey]['tableAttributes']))&#xA;    {&#xA;        $attributeKeys = $settings['sources'][$sourceKey]['tableAttributes'];&#xA;    }&#xA;    else&#xA;    {&#xA;        $elementType = craft()-&amp;gt;elements-&amp;gt;getElementType($elementTypeClass);&#xA;        $attributeKeys = $elementType-&amp;gt;getDefaultTableAttributes($sourceKey);&#xA;    }&#xA;&#xA;    ...&#xA;&#xA;    return $attributes;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can shed some light on why I cannot customise the table attributes of the nested entry source.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is a real life demonstration of the issue using Pixel and Tonic's &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager demo site&lt;/a&gt; and &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources&quot; rel=&quot;nofollow noreferrer&quot;&gt;Category sources plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M0LDf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M0LDf.png&quot; alt=&quot;Top level entry source&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see above, in my 'Alcoholic' top-level entry source, I've specified custom columns/attributes so that the 'Heading', 'Section' and 'Entry Type' are also included in the element index listing for the entry source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I then click one of the nested entry sources, 'Beer' for instance, those 3 custom columns/attributes are no longer present as is evident below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PngwQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PngwQ.png&quot; alt=&quot;Nested entry source&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, the expected behaviour would be that the nested entry sources would utilise the custom columns/attributes defined for the top level entry source. So  'Heading', 'Section' and 'Entry Type' should have been visible when clicking on 'Beer'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect it's more work technically, but it might also be useful if it were possible to independently configure the columns/attributes of the nested entry sources too.&lt;/p&gt;&#xA;" OwnerUserId="4890" LastEditorUserId="4890" LastEditDate="2016-07-19T04:13:41.717" LastActivityDate="2016-07-19T04:13:41.717" Title="Table attributes not customisable for nested entry sources" Tags="&lt;entry&gt;&lt;attribute&gt;&lt;custom&gt;&lt;sources&gt;&lt;table&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2016-07-27T03:52:52.640" ContentLicense="CC BY-SA 3.0" />
  <row Id="15849" PostTypeId="1" CreationDate="2016-07-08T14:08:45.810" Score="1" ViewCount="147" Body="&lt;p&gt;So Right now I am working on &lt;a href=&quot;https://munisense.com/sound&quot; rel=&quot;nofollow&quot;&gt;https://munisense.com/sound&lt;/a&gt;, and since a week or so the Image Transform functionality seems to be working in another way (ever since the last mandatory update). &#xA;The strangest part is that in my local/offline version of the website, the paths to the transformed images are working correctly. But online, the image paths point to the fullsized versions.&#xA;For examples, take a look at the 'services' paragraph, each of those three images isn't scaled down by Craft. Right now I solved the problem temporarily with some CSS rules, giving the images a fixed width. Just turn them off to see what it looked like when I checked it out this morning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The syntax I am using is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in services_info.image %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl('productTransform') }}&quot; alt=&quot;{{ services_info.title }}&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this syntax hasn't changed for a long while now, so I think the problem is somewhere else. Also because locally the correct paths are working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can it be that Craft is not applying the paths of the resized versions of my images? Where do I need to look instead to fix this?&lt;/p&gt;&#xA;" OwnerUserId="3697" LastActivityDate="2016-07-08T14:08:45.810" Title="Image Transform not passing correct URL" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15850" PostTypeId="1" CreationDate="2016-07-08T15:06:54.433" Score="1" ViewCount="180" Body="&lt;p&gt;I have some issues with saving fields and entries in Craft. For some reason, some entries, and a Matrix field I have, take approx. 1 to 2 minutes to save. There are then errors in my server log. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I thought it was due to using Assets fields, as when I deleted those, the matrix field saved OK, and the entry. I recreated a field using Assets and when added some images to an entry, the issue came back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It still saves, just takes 1 to 2 minutes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For info, this is a site I copied from another site, then changed it's database, any paths/domains in config, then deleted a bunch of entries and assets we don't need on the new site, then the issue started to happen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the error in the server log. Online it says increate the timeout, but thats not a solution, it should not be taking this long in the first place. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Fri Jul 08 16:00:24.139890 2016] [fcgid:warn] [pid 32671] (70007)The timeout specified has expired: [client xx.xx.xx.xx:50434] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: http://mydomain.co.uk/admin/entries/homepage/2-homepage&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: I have since copied the site again and gone through the same process as above, and its working OK now. So not urgent for me, but will leave this issue here nevertheless as its a serious issue of course. &lt;/p&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="45" LastEditDate="2016-07-12T17:13:16.800" LastActivityDate="2016-07-12T17:13:16.800" Title="Saving some entries and a matrix field settings takes a very long time" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15853" PostTypeId="1" CreationDate="2016-07-08T21:54:42.000" Score="15" ViewCount="2913" Body="&lt;p&gt;The current state of events/calendars in Craft is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calendars - &lt;a href=&quot;https://topshelfcraft.com/calendars/introduction&quot;&gt;https://topshelfcraft.com/calendars/introduction&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Venti - &lt;a href=&quot;http://tippingmedia.com/venti&quot;&gt;http://tippingmedia.com/venti&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Solspace Calendar - &lt;a href=&quot;https://solspace.com/craft/calendar&quot;&gt;https://solspace.com/craft/calendar&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Whats the benefits of each? Anything to note?&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="331" LastEditDate="2016-07-08T22:03:48.573" LastActivityDate="2017-05-06T00:23:43.910" Title="Events calendar for Craft - which one should I use?" Tags="&lt;events&gt;&lt;calendar&gt;&lt;plugin-ventievents&gt;&lt;plugin-calendar&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15855" PostTypeId="2" ParentId="15853" CreationDate="2016-07-09T04:00:29.270" Score="5" Body="&lt;p&gt;I started using Solspace a couple weeks ago. The GUI is wonderful for content editors that will make use of it. ICS export so you could use it as the primary calendar manager and import the ICS into gcal or ical. The template integration is super easy and there are a number of bootstrapped demo calendar templates included that make extending, learning and integrating a breeze. You can extend its content type with whatever extra fields you need. It has its own sidebar link and therefore its content is separated from the rest of crafts entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calendars is essentially a field that allows you to extend existing content types. I've only had a few hours to mess around with it but it seems like it has potential. At first I wasn't sure if I'd installed it correctly as it doesn't have a GUI. Venti I haven't tried, but looks a little more 'designy' than the other two plugins, which can be good or bad depending on where your skill set lies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am primarily a designer creating a website using craft for a few content editors and therefore will likely stick with Solspace. Given its familiar GUI and easy to follow template code it leaves little to figure out, which I need. If I was more on the developer end of the spectrum, weren't already using bootstrap, and had no use for a GUI for creating events, I'd likely roll with Calendars. &lt;/p&gt;&#xA;" OwnerUserId="5307" LastActivityDate="2016-07-09T04:00:29.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15857" PostTypeId="2" ParentId="11380" CreationDate="2016-07-09T22:24:27.400" Score="4" Body="&lt;p&gt;I'm on a Windows 10 environment with WAMP installed and I had exactly the same problem. Front End failed. Back End worked fine. News links failed. Clicking on website name link from the Localhost screen reveals directory contents. No matter how many times I kept clean installing Craft and tweaking and adding .htaccess files, the problem remained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved the problem in the following way, without the need to add any .htaccess files. It's best to do a complete clean install of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need the original, untouched, &lt;strong&gt;craft&lt;/strong&gt; and &lt;strong&gt;public&lt;/strong&gt; folders. Apologies if these following points go over what you already know.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Copy the &lt;strong&gt;craft&lt;/strong&gt; and &lt;strong&gt;public&lt;/strong&gt; folders into the wamp/www/sitename folder as normal (or the Mac equivalent)&lt;/li&gt;&#xA;&lt;li&gt;Remove all the files from the &lt;strong&gt;public&lt;/strong&gt; folder and place them at the base level (i.e. same level as the &lt;strong&gt;craft&lt;/strong&gt; folder)&lt;/li&gt;&#xA;&lt;li&gt;Delete the &lt;strong&gt;public&lt;/strong&gt; folder.&lt;/li&gt;&#xA;&lt;li&gt;Rename the root &lt;strong&gt;htaccess&lt;/strong&gt; file to &lt;strong&gt;.htaccess&lt;/strong&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open up the &lt;strong&gt;.htaccess&lt;/strong&gt; file and add this line &lt;/p&gt;&#xA;&#xA;&lt;p&gt;RewriteBase /&lt;/p&gt;&#xA;&#xA;&lt;p&gt;after this line&lt;/p&gt;&#xA;&#xA;&lt;p&gt;RewriteEngine On&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the root index.php file change line 4 to &lt;em&gt;$craftPath = './craft';&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create your localhost database.&lt;/li&gt;&#xA;&lt;li&gt;Set up your database connection details within craft/config/db.php.&lt;/li&gt;&#xA;&lt;li&gt;Via your browser, enter localhost/&lt;em&gt;sitename&lt;/em&gt;/index.php/admin/install &lt;/li&gt;&#xA;&lt;li&gt;Click on the &lt;strong&gt;Begin&lt;/strong&gt; button.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Create your account&lt;/strong&gt; page, fill out as normal.&lt;/li&gt;&#xA;&lt;li&gt;When you get to the &lt;strong&gt;Setup your site&lt;/strong&gt; page, complete the &lt;strong&gt;Site URL&lt;/strong&gt; details like this:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://localhost/&quot; rel=&quot;nofollow&quot;&gt;http://localhost/&lt;/a&gt;&lt;em&gt;sitename&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finish off the install as normal and when your dashboard gets displayed, click on the Website name (top left) to go to the Front End and it will work. Click on the News link and it will work. As will Live Preview. Go to the Localhost page, click on the website name and you will go to your home page instead of having directory details displayed. Finally, if you upload this whole website to your live site it will still work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a slight caveat, I have only been testing Craft for a couple of days and installing it is about as far as I have got to at the moment. So if I've broken Craft no-no's like 'never delete the &lt;strong&gt;public&lt;/strong&gt; folder, then I apologise (obviously, it doesn't have to be deleted and just remain empty)&lt;/p&gt;&#xA;" OwnerUserId="5356" LastEditorUserId="5356" LastEditDate="2016-07-11T01:54:29.763" LastActivityDate="2016-07-11T01:54:29.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15858" PostTypeId="1" AcceptedAnswerId="15873" CreationDate="2016-07-10T19:09:51.010" Score="2" ViewCount="2158" Body="&lt;p&gt;I can't stand this and have to ask for help again.. Still working on my buddy's website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to increase a entry's counter (using Entry Count plugin)&#xA;So for my _entry.html I added an if statement to see if the request is for Ajax or not. If not, show the entire page. If it is only run the counter twig line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_entry.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax and not craft.request.isLivePreview %}&#xA;    {% extends &quot;_layout&quot; %}&#xA;    {% set title = entry.title|t %}&#xA;&#xA;{% block content %}&#xA; {# CONTENT GOES HERE #}&#xA;{% endblock %}&#xA;&#xA;{% else %}&#xA;    {# ONLY INCREASE THE VIEWS/COUNT #}&#xA;    {% do craft.entryCount.increment(entry.id) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Javascript on main page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.get($(this).attr('data-url-item'), function(data) {&#xA;console.log(data);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I don't need to actually pickup any data or show it, so I'm using $.get() currently have the console.log() there so I can see which version of the page I'm getting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3583" LastActivityDate="2016-07-11T20:41:27.780" Title="if isAjax not working or not detecting ajax request in template" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15859" PostTypeId="1" AcceptedAnswerId="15860" CreationDate="2016-07-10T19:26:07.543" Score="9" ViewCount="315" Body="&lt;p&gt;This is going to be informational, as we had a good conversation over this area on Craft Slack. And good fun trying to get around the idiotic StackExchange 'subjective' monitor to publish it here -- couldn't imagine what this wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why would you want to avoid PCI compliance on your own server? Because it's a bank-level task to get and maintain it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the conversation linked in the answer below, thank you.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="45" LastEditDate="2016-07-12T17:15:03.963" LastActivityDate="2016-07-12T17:15:03.963" Title="How do you gain PCI compliance without certifying your server for Craft, with or without Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15860" PostTypeId="2" ParentId="15859" CreationDate="2016-07-10T19:31:31.980" Score="5" Body="&lt;p&gt;The takeaway is to use api packages provided by payment providers such as Stripe and Authorize.net. The Craft Charge plugin can very much simplify and smooth doing so with Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a link to a Git Gist of the conversation, as Slack erases content within a week:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://goo.gl/bYIFLV&quot;&gt;https://goo.gl/bYIFLV&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well, though I don't guarantee it will stay up, is an experiment with Storify to show the same thing. I'm not sure which version reads better -- maybe Storify on a mobile phone, one reason for trying it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://goo.gl/5hEcLS&quot;&gt;https://goo.gl/5hEcLS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2016-07-10T19:31:31.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15861" PostTypeId="1" AcceptedAnswerId="15867" CreationDate="2016-07-10T23:28:13.607" Score="3" ViewCount="1541" Body="&lt;p&gt;I'm trying to integrate the ElementAPI plugin into my site. Essentially, I need to output all of the assets within the website into a JSON file that I can link to in the load manifest of &lt;a href=&quot;http://www.createjs.com/docs/preloadjs/classes/LoadQueue.html&quot; rel=&quot;nofollow&quot;&gt;PreloadJS&lt;/a&gt;. If you read the docs here, you'll see that the images can be loaded from an external JSON file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've been working with so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'assets.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;$images = [];&#xA;        foreach ($entry-&amp;gt;featuredImage as $image) {&#xA;        $images[] = $image-&amp;gt;url;&#xA;        }&#xA;                return [&#xA;                    'image' =&amp;gt; $entry-&amp;gt;image&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;assets/data.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, to sum up, what I'm needing to do is build an API that will get a list of all the assets used in my site and output them into a JSON file that I can link to in a JS file as part of the PreloarJs plugin. This would make my preloader dynamic and allow me to keep my javascript external, rather than getting the assets inline, which I have been doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="5370" LastEditDate="2016-07-11T09:56:39.783" LastActivityDate="2016-07-11T20:46:24.087" Title="Get Assets in JSON with ElementAPI" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15862" PostTypeId="1" CreationDate="2016-07-11T02:33:25.927" Score="1" ViewCount="311" Body="&lt;p&gt;First, which template does the &lt;code&gt;actionGetElements&lt;/code&gt; use to generate a response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, how can I customize the template for a single entry section?&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="22" LastEditDate="2017-05-09T21:45:51.150" LastActivityDate="2017-05-09T21:45:51.150" Title="Customizing CP Entries section template" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15864" PostTypeId="2" ParentId="15862" CreationDate="2016-07-11T03:48:38.803" Score="2" Body="&lt;p&gt;First, there isn't a single specific template that &lt;a href=&quot;https://craftcms.com/classreference/controllers/ElementIndexController&quot; rel=&quot;nofollow&quot;&gt;ElementIndexController's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/controllers/ElementIndexController#actionGetElements-detail&quot; rel=&quot;nofollow&quot;&gt;actionGetElements&lt;/a&gt; uses to return data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It implements &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/IElementType&quot; rel=&quot;nofollow&quot;&gt;IElementType's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/IElementType#getIndexHtml-detail&quot; rel=&quot;nofollow&quot;&gt;getIndexHtml&lt;/a&gt; method which &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/BaseElementType&quot; rel=&quot;nofollow&quot;&gt;BaseElementType&lt;/a&gt; provides a &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/BaseElementType#getIndexHtml-detail&quot; rel=&quot;nofollow&quot;&gt;default implementation&lt;/a&gt; of, but any &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;ElementType&lt;/a&gt; (Entry, User, Asset, custom plugin ElementType, etc.) is free to implement that method with their own logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, it sounds like you want to hack core files in the &lt;code&gt;craft/app&lt;/code&gt; folder, which I definitely wouldn't recommend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be able to make the modifications you're looking for with something like the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;CP JS&lt;/a&gt; plugins.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-11T03:48:38.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15865" PostTypeId="1" CreationDate="2016-07-11T05:00:44.943" Score="4" ViewCount="590" Body="&lt;p&gt;I can (almost) appreciate the recent impositions of Redactor 2, but when it comes to handing off the site to a client, Redactor 2 is virtually unusable for anything more than paragraph text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other rich text editors being considered as core replacements in the future? If so, +1 for an implementation of &lt;a href=&quot;https://www.froala.com/wysiwyg-editor&quot; rel=&quot;nofollow&quot;&gt;Froala&lt;/a&gt; into Craft. I see there is already a &lt;a href=&quot;https://github.com/froala/yii2-froala-editor&quot; rel=&quot;nofollow&quot;&gt;Yii2&lt;/a&gt; implementation available.&lt;/p&gt;&#xA;" OwnerUserId="543" LastEditorUserId="45" LastEditDate="2016-07-11T18:39:01.853" LastActivityDate="2016-07-11T18:56:10.517" Title="What is the future for the Craft rich text editor?" Tags="&lt;redactor&gt;&lt;editor&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15866" PostTypeId="1" CreationDate="2016-07-11T06:48:13.757" Score="1" ViewCount="169" Body="&lt;p&gt;I need to add an event handler for the &lt;code&gt;onSaveEntry&lt;/code&gt; event in order to integrate with another system. In the admin screens for the form where and how do I add this event handler?&lt;/p&gt;&#xA;" OwnerUserId="5380" LastEditorUserId="45" LastEditDate="2016-07-12T17:11:21.367" LastActivityDate="2016-07-12T17:11:21.367" Title="Sprout Forms `onSaveEntry` event" Tags="&lt;events&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15867" PostTypeId="2" ParentId="15861" CreationDate="2016-07-11T11:05:16.377" Score="5" Body="&lt;p&gt;Something like the following should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// elementapi.php&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'assets.json' =&amp;gt; [&#xA;            'paginate' =&amp;gt; false,&#xA;            'elementType' =&amp;gt; ElementType::Asset,&#xA;            'criteria' =&amp;gt; [&#xA;                'limit' =&amp;gt; null,&#xA;            ],&#xA;            'transformer' =&amp;gt; function(AssetFileModel $asset) {&#xA;                // Set `generateTransformsBeforePageLoad` to `true` to have Craft generate transforms at runtime&#xA;                craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;                return [&#xA;                    'title' =&amp;gt; $asset-&amp;gt;title,&#xA;                    'url' =&amp;gt; $asset-&amp;gt;url,&#xA;                    'thumb' =&amp;gt; $asset-&amp;gt;getUrl(['width' =&amp;gt; 100, 'height' =&amp;gt; 100]),&#xA;                ];&#xA;            },&#xA;       ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One small gotcha: By default, Element API will paginate results. To avoid that, you can add a &lt;code&gt;'paginate' =&amp;gt; false,&lt;/code&gt; parameter to your endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another small gotcha: If you want to return transformed Assets (e.g. a thumbnail version), you can pass a named or inline (array) transform to &lt;code&gt;$asset-&amp;gt;getUrl()&lt;/code&gt;, but you'll need to set the &lt;code&gt;generateTransformsBeforePageLoad&lt;/code&gt; config setting to &lt;code&gt;true&lt;/code&gt; at runtime in order to have Craft actually generate the transforms when the endpoint is requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally: Depending on the number of Assets and Entries, you might see some performance issues with this method (especially if you're going to include transforms and don't paginate the results), so it'll probably be a good idea to &lt;a href=&quot;https://craftcms.stackexchange.com/a/13455/1098&quot;&gt;cache the assets.json output in some way&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-11T20:46:24.087" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15868" PostTypeId="2" ParentId="15847" CreationDate="2016-07-11T13:25:23.247" Score="3" Body="&lt;p&gt;Removing this from my site's nginx conf fixed it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(?:manifest|appcache|html?|xml|json)$ {&#xA; expires -1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, what I really want to do is cache stuff, without breaking this endpoint&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-07-11T13:25:23.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15870" PostTypeId="2" ParentId="15865" CreationDate="2016-07-11T18:28:25.363" Score="3" Body="&lt;p&gt;Eventually, if a Craft CKEditor plugin doesn't come to life, then we might consider developing a 1st party (Pixel &amp;amp; Tonic) CKEditor plugin, although it would likely not replace the native Redactor Rich Tech Field implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And of course, 3rd party plugins can implement whatever WYSIWYG they want to use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-11T18:28:25.363" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15871" PostTypeId="2" ParentId="15865" CreationDate="2016-07-11T18:56:10.517" Score="3" Body="&lt;p&gt;Asking us to predict the future is hard (and probably a little off-topic). But I'll go ahead and contribute what little knowledge I have...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per conversations in Craft Slack, a few reputable plugin developers have casually mentioned that they may or may not be working on plugins for the following WYSIWYG editors...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Froala&lt;/li&gt;&#xA;&lt;li&gt;CKeditor&lt;/li&gt;&#xA;&lt;li&gt;Tiny MCE&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Because Slack conversations are so ephemeral, it's hard to say how much weight these comments truly carry. Multiple people mentioned working on a CKeditor, though it's possible they all stopped because &quot;someone else is working on it&quot;. Froala was mentioned, although the cost was certainly an issue. And Tiny MCE was mentioned, although possibly as a joke.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend tuning into &lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Slack&lt;/a&gt;, where you may be able to get a more up-to-date answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Personally, I'd love to see a &lt;a href=&quot;https://craftcms.stackexchange.com/a/15870/45&quot;&gt;P&amp;amp;T version&lt;/a&gt; of the CKeditor. But that's like, &lt;a href=&quot;https://www.youtube.com/watch?v=pWdd6_ZxX8c&quot; rel=&quot;nofollow noreferrer&quot;&gt;my opinion&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-11T18:56:10.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15872" PostTypeId="1" AcceptedAnswerId="15885" CreationDate="2016-07-11T20:14:33.307" Score="2" ViewCount="177" Body="&lt;p&gt;I previously ran Vesta CP on Ubuntu and wanted to run something a little faster so chose centOS7 minimal. Installed Vesta CP and restored my backup. All my sites are running fine. Except for the ones running Craft CMS.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I would like to stress that the backup worked perfectly before&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I get the error &amp;quot;Please ensure that $craftPath is set correctly&amp;quot;&#xA;Now I'v been (honestly) trying for the past 6 hours to fix this on my own but I can't figure it out.&lt;/p&gt;&#xA;&lt;p&gt;PHP runs as adminBOB (determent using: )&#xA;And checking my chmod the user and group are adminBOB:adminBOB (same as if I make a new folder or upload a new file)&lt;/p&gt;&#xA;&lt;p&gt;Apache/httpd runs as &amp;quot;apache:apache&amp;quot; changing the owner of all my files for this site doesn't make the error go away either.&lt;/p&gt;&#xA;&lt;p&gt;I'm also my http.conf (and tried php.ini) configured to have:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;php_admin_flag safe_mode off&lt;/p&gt;&#xA;&lt;p&gt;php_admin_value open_basedir none&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So I'm almost certain those two are not on.&#xA;Everything (folder/files) wise is the same. Same control panel (that installs all services)&lt;/p&gt;&#xA;&lt;p&gt;I have no idea what to do next to try and get CraftCMS working again.&#xA;Please assist! Thank you!!&lt;/p&gt;&#xA;" OwnerUserId="3583" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-07-12T18:07:19.550" Title="Moved server (centOS7) &quot;Please ensure that $craftPath is set correctly&quot;" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15873" PostTypeId="2" ParentId="15858" CreationDate="2016-07-11T20:17:12.850" Score="2" Body="&lt;p&gt;You're bumping into a Twig gotcha: you can't conditionally extend a template. Either a template extends another template (i.e. it has an &lt;code&gt;{% extends %}&lt;/code&gt; tag in it) or it doesn't. It doesn't matter if the &lt;code&gt;{% extends %}&lt;/code&gt; statement is inside an &lt;code&gt;{% if %}&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to create an additional layout template – e.g. &lt;code&gt;_ajax.html&lt;/code&gt; – and use a &lt;a href=&quot;https://en.wikipedia.org/wiki/%3F:&quot; rel=&quot;nofollow&quot;&gt;ternary operator&lt;/a&gt; to have your entry template extend &lt;em&gt;one or the other&lt;/em&gt;, before putting the conditional that loads either the content or the call to &lt;code&gt;entryCount.increment&lt;/code&gt; inside the &lt;code&gt;{% block content %}&lt;/code&gt;. Note that for your purposes, the &lt;code&gt;_ajax.html&lt;/code&gt; template can be completely blank, except of course for the &lt;code&gt;{% block content %}{% endblock %}&lt;/code&gt;). Also note that since we now need to test if the request is an Ajax request twice, it makes sense to cache the test to a variable &lt;code&gt;isAjax&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isAjax = craft.request.isAjax and not craft.request.isLivePreview %}&#xA;{% extends not isAjax ? '_layout' : '_ajax' %}&#xA;{% block content %}&#xA;    {% if not isAjax %}&#xA;        {# CONTENT GOES HERE #}&#xA;    {% else %}&#xA;        {% do craft.entryCount.increment(entry.id) %}&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not very elegant, is it? A better option might be to create a different endpoint for incrementing the counter entirely, negating the need to create an additional layout template and to wrap most of your content in a conditional. To create a dedicated endpoint for incrementing the counter, you can create &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;a dynamic route&lt;/a&gt;. Make sure the route contains a &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt; token, which will hold your entry ID (the route could just be &lt;code&gt;count/&amp;lt;number&amp;gt;&lt;/code&gt;, for instance). Have the route point to a new template called &lt;code&gt;_count.html&lt;/code&gt; or the like, and put the following in that template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.entryCount.increment(number) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll have to expose the current entry's ID to your JavaScript somehow, but that's easily done by setting a data attribute somewhere in your markup – e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body data-entryid=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you just need to use jQuery or the like to issue a request to &lt;a href=&quot;http://yourwebsite.com/count&quot; rel=&quot;nofollow&quot;&gt;http://yourwebsite.com/count&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax('/count/'+$('body').data('entryid'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Closing thought: So long as you &quot;don't need to actually pickup any data or show it&quot;, I'm curious why you couldn't just request the basic template as-is. As long as the template contains the call to &lt;code&gt;entryCount.increment&lt;/code&gt; somewhere inside the &lt;code&gt;{% block content %}&lt;/code&gt; block, does it really matter if it loads the full layout behind the scenes? Sure, there's a little overhead, but it's way less work and probably doesn't matter that much in the scheme of things.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-11T20:41:27.780" LastActivityDate="2016-07-11T20:41:27.780" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15874" PostTypeId="2" ParentId="15866" CreationDate="2016-07-11T21:19:24.393" Score="4" Body="&lt;p&gt;Adding an event handler is not something you do through the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is create a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; (&lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;pluginfactory.io&lt;/a&gt; makes this fairly easy), and in your plugin's main class, you have an &lt;code&gt;init()&lt;/code&gt; function that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('sproutForms.onSaveEntry', function (Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry']; // fetch the new entry&#xA;        ... do things with $entry ...&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you structure your plugin properly, you will &quot;do things with &lt;code&gt;$entry&lt;/code&gt;&quot; by calling a &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;Service&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-11T21:19:24.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15875" PostTypeId="1" AcceptedAnswerId="15893" CreationDate="2016-07-11T21:21:10.673" Score="6" ViewCount="4891" Body="&lt;p&gt;I understand that to add a &quot;note&quot; class to the redactor text editor drop down, I need to use formattingAdd. But each iteration I've tried does not work. The example is: &lt;a href=&quot;https://imperavi.com/redactor/examples/formatting-add/&quot; rel=&quot;noreferrer&quot;&gt;https://imperavi.com/redactor/examples/formatting-add/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the example, edited it for my needs, and added it to the header of my layout template on the Craft site...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;style&amp;gt;&#xA;.article-note {&#xA;  font-style: italic;&#xA;  font-size: 1.2em;&#xA;  font-weight: 700;&#xA;}&#xA;&amp;lt;/style&amp;gt;&#xA;&#xA;&amp;lt;script&amp;gt;&#xA;    $(function()&#xA;    {&#xA;        $('#redactor').redactor({&#xA;            focus: true,&#xA;            formatting: ['p', 'blockquote'],&#xA;            formattingAdd: {          &#xA;                &quot;article-note-add&quot;: {&#xA;                    title: 'Note',&#xA;                    args: ['h6', 'class', 'article-note', 'toggle']&#xA;                },    &#xA;            }&#xA;        });&#xA;    });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Didn't work. Also, I didn't know how the textarea in the example is used or where it should go. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of people in the discussion boards I've researched have recommended plugins. I am not interested in a plugin. Both Craft CMS and redactor state that there is a way to do it without a plugin. While it hasn't worked from me so far, I'm sure someone has succeeded and I'm hoping to learn. &lt;/p&gt;&#xA;" OwnerUserId="5384" LastActivityDate="2016-07-13T07:54:28.690" Title="How do I add class to redactor format list?" Tags="&lt;redactor&gt;&lt;custom&gt;&lt;format&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15877" PostTypeId="2" ParentId="15707" CreationDate="2016-07-12T08:59:29.613" Score="0" Body="&lt;p&gt;This ended up being a css issue. In the CSS I had to create the following rule.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input[type=&quot;text&quot;].hidden { display: none; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-12T08:59:29.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15878" PostTypeId="1" AcceptedAnswerId="15879" CreationDate="2016-07-12T10:46:48.237" Score="3" ViewCount="1272" Body="&lt;p&gt;&lt;strong&gt;I just want to confirm how accounts are created for customers in Craft Commerce.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently in the the Craft Commerce download the checkout processes provides the option to &quot;login&quot; or proceed with as a &quot;guest&quot; just providin the email. Is this the method of creating a customer account OR do we have to activate public registrations and point people to a registration page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little unsure what needs putting into effect here. Any documentation people can point me to would be useful. &lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-12T11:22:35.823" Title="Craft Commerce: Creating Customer Accounts?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15879" PostTypeId="2" ParentId="15878" CreationDate="2016-07-12T10:58:51.373" Score="4" Body="&lt;p&gt;Yes, if you want users to be able to register, you would need to allow public registrations and implement your own standard registration form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they enter their email as a guest (anonymous) user a 'guest' customer record is created and related to the current cart, but it is not associated with a craft user account. This customer record is not retrievable and is only created for the purpose of having a related customer to the current order. There is no way to see this customer record in the back-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user is logged in a related customer record is created that has a 1:1 relationship with the user. The same customer record is used every time the useris logged in. This customer is the central place that addresses and orders are related to. If you want to see the previous orders for a customer, add the &quot;Customer Info&quot; field to your user profile custom fields.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-07-12T11:22:35.823" LastActivityDate="2016-07-12T11:22:35.823" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15881" PostTypeId="1" CreationDate="2016-07-12T13:46:18.837" Score="-2" ViewCount="358" Body="&lt;p&gt;While working with guest checkout in craft I noticed that the &quot;Edit&quot; address links were not available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I removed {% if currentUser %} from the shipping template to reveal the edit links. Now when editing the billing address it also updates the shipping address - manipulating two different addresses does not seem possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code for both edit links:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;edit&quot; href=&quot;/shop/checkout/customer/addresses/edit?addressId={{ cart.billingAddressId }}&amp;amp;redirect={{ craft.request.path }}&quot;&amp;gt;Edit&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gtxcx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gtxcx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2016-07-13T10:29:36.937" LastActivityDate="2017-07-11T04:41:43.763" Title="Craft Commerce: Editing Guest Address?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15882" PostTypeId="1" CreationDate="2016-07-12T14:13:23.537" Score="1" ViewCount="478" Body="&lt;p&gt;I am building a new website using Craft CMS and I have a requirement from the design team that they want to be able to re-use templates across multiple sections. For example define how a product looks like and then be able to add a product from any sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought implementing this using a Matrix or having a channel/structure section with multiple entry types however I am bit unclear when to use entry types and when to use matrix or maybe there is better way to implement this and I am not aware?&lt;/p&gt;&#xA;" OwnerUserId="5388" LastActivityDate="2016-07-12T16:21:42.033" Title="Matrix vs Multiple entry types" Tags="&lt;matrix&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15883" PostTypeId="1" AcceptedAnswerId="15891" CreationDate="2016-07-12T14:59:38.037" Score="1" ViewCount="685" Body="&lt;p&gt;PayPal Express is one of the &lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways&quot; rel=&quot;nofollow&quot;&gt;payment gateways&lt;/a&gt; included in Craft Commerce but I can’t find an example of how to set this up. Is it something that would require a custom plugin for posting secure data to PayPal or is there an easier way to do this out of the box?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a payment form as per the Commerce example templates with everything working through the Dummy gateway but now looking to replace that form with a simple PayPal Express checkout button, returning to the order page if successful. Any examples or pointers appreciated.&lt;/p&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-07-12T18:42:24.173" LastActivityDate="2016-07-13T01:11:46.163" Title="Using PayPal Express with Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15884" PostTypeId="2" ParentId="15882" CreationDate="2016-07-12T16:15:11.577" Score="4" Body="&lt;p&gt;I see this question as two parts: information architecture and templating.&lt;/p&gt;&#xA;&lt;p&gt;If you're used to something like WordPress where the template has a one-to-one relationship with how the template gets data and how information is routed, ignore everything you've learned.&lt;/p&gt;&#xA;&lt;h1&gt;Templating&lt;/h1&gt;&#xA;&lt;p&gt;Let's get the requirement of reusing templates out of the way first. &lt;a href=&quot;http://twig.sensiolabs.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt;, Craft's templating language,  lets your reuse templates quite easily.&lt;/p&gt;&#xA;&lt;p&gt;Not only can you use reuse templates from any page inside Craft, you can also &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#template-inheritance&quot; rel=&quot;nofollow noreferrer&quot;&gt;extend&lt;/a&gt; templates from other templates.&lt;/p&gt;&#xA;&lt;p&gt;Craft then lets you define &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;which template&lt;/a&gt; is going to be used for each section. You could just set it to a single one and be done with it if your content doesn't change that much from section to section. A single Matrix field could pull off quite a bit across the entire site.  Speaking of...&lt;/p&gt;&#xA;&lt;h1&gt;Matrix&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix fields&lt;/a&gt; can be used for &amp;quot;site builder&amp;quot; like functionality. Matrix lets you define block types (eg Pullquote, Featured Image with Caption, etc) and then by mixing and matching the blocks, you can &amp;quot;build up&amp;quot; a page. The blocks can also be reordered. That gives authors a lot of flexibility in how they layout the pages.&lt;/p&gt;&#xA;&lt;h1&gt;Entry Types&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/features/entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry types&lt;/a&gt; define what content Sections contain but unless you define the same Entry Types across multiple Sections, they're not &amp;quot;global&amp;quot; like Matrix fields would be.&lt;/p&gt;&#xA;&lt;p&gt;Entry Types are useful if you need to define content (and layout) requirements for entries in the same section. If you curate a blog for example, you might have a &amp;quot;Link&amp;quot; Entry Type that links to other entries or even other blogs. Then you might have a &amp;quot;Blog Article&amp;quot; Entry Type for &amp;quot;regular&amp;quot; content.&lt;/p&gt;&#xA;&lt;p&gt;In your templates, you have the ability to check which Entry Type the entry happens to be and have your template format it how it should look. The Happy Lager does this inside the &lt;a href=&quot;https://demo.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;News&lt;/a&gt; section.&lt;/p&gt;&#xA;&lt;h1&gt;Information Architecture&lt;/h1&gt;&#xA;&lt;p&gt;In my experience, there aren't any hard and fast rules for using Matrix and Entry types, it really depends on your content and requirements. You could probably pull off what you're asking for with either.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If your templates are &amp;quot;designed&amp;quot;, meaning the products are always going to live in a certain spot inside a template, then you can probably use a relational field to define the relationship.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want your authors to be able to define multiple elements on a page and then pull in the products from anywhere, Matrix is going to be your weapon of choice&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://mijingo.com/products/screencasts/reusable-twig-templates-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo&lt;/a&gt; just introduced a course you might find useful on the subject as well.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-07-12T16:21:42.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15885" PostTypeId="2" ParentId="15872" CreationDate="2016-07-12T17:45:12.253" Score="2" Body="&lt;p&gt;So as it turns out Vesta has a funny way of handing httpd config files.&#xA;There was another one tucked away somewhere where &quot;open_basedir&quot;&#xA;They are kept in &quot;/home/admin(username)/conf/web/httpd.conf&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing that fixed it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a pain, tooks me hours to figure out something so simple.&#xA;I had already removed it from the httpd.conf in the default location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something to keep in mind if anyone has the error and is running VESTA CP!&lt;/p&gt;&#xA;" OwnerUserId="3583" LastEditorUserId="3583" LastEditDate="2016-07-12T18:07:19.550" LastActivityDate="2016-07-12T18:07:19.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15886" PostTypeId="1" AcceptedAnswerId="15887" CreationDate="2016-07-12T18:48:56.263" Score="2" ViewCount="149" Body="&lt;p&gt;To allow one-click updates on my site, I need to make the Craft 'app' folder writeable by the web server.&#xA;Doesn't this present a security concern...to allow the actual php files of the application to be writeable by the web server? &lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2016-07-13T16:28:12.503" Title="Is it safe to make the 'app' folder writeable by the web server?" Tags="&lt;auto-updates&gt;&lt;updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15887" PostTypeId="2" ParentId="15886" CreationDate="2016-07-12T19:15:06.197" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Doesn't this present a security concern&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not in-and-of itself, but if a malicious user finds an exploit through another means, it does make it easier for them to drop their payload on the file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, of course, not make the &lt;code&gt;craft/app&lt;/code&gt; folder writeable by Apache/PHP and just do &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow&quot;&gt;manual updates&lt;/a&gt;.  Or better yet, do the auto-updates on development or staging boxes (so you can properly test) and deploy to production where &lt;a href=&quot;https://craftcms.com/docs/config-settings#allowAutoUpdates&quot; rel=&quot;nofollow&quot;&gt;auto-updates are disabled&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-12T19:15:06.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15888" PostTypeId="2" ParentId="15886" CreationDate="2016-07-12T20:06:37.627" Score="4" Body="&lt;p&gt;Security is not off or on, it's layers of an onion.  Anything you do has to factor into the bigger picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My layers include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;What user does the web server run as? What user is your content?&lt;/strong&gt;&#xA;Your web server should never be the same as the user who owns the files, typically www-data, www, apache, etc. Also, don't run apache as the user nobody.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Are you using PHP-FPM, su-PHP, fastcgi, or Apache w/ mod_PHP baked in?&lt;/strong&gt; I prefer fpm since you can run every website as a separate pool and separate PHP ini / open_basedir configs, increasing security. If a site gets hacked, only that pool is affected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What are the permissions of the folders/files?&lt;/strong&gt; Shouldn't ever be 777, ideally 750 for directories and 640 for files. The web server should be added to the user's group and given read permissions (so it can only access static files).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Who else has access to the server?&lt;/strong&gt; Deploy users via SSH, (s)FTP, MySQL replication users, etc. Limit access to need-to-know.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Just to play devil's advocate, if you do disable the one-click updates in production, that also makes it harder to simply &lt;em&gt;update&lt;/em&gt;, which could be worse than not updating at all. I've seen well-meaning WP Devs tend to fall into this trap, keeping their client's sites in a sort-of cryogenic state. While Craft is not as widely used, the same security precautions apply. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm reminded of &lt;a href=&quot;https://craftcms.stackexchange.com/a/4449/1016&quot;&gt;Brad's post about security here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Perhaps the biggest thing Craft has going for it, in the event a security related bug is that &lt;strong&gt;we can get the fix deployed quickly to our users with Craft's one-click auto-updating.&lt;/strong&gt; In addition to that, we can mark a release as &quot;critical&quot;, which gets special attention in the control panel.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft probably needs to eventually write files to the server anyway, including cache files, and assets, so unless you're shutting off access there as well, I'd wager it's the same risk—maybe even more so—because asset files/uploads tend to be in the web root unless you do some file aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And without question, if you're not backing up your database and filesystem regularly, you're asking for trouble. Let's assume you are hacked. If you don't have good back-ups, whether auto-update is on or off is not going to help you. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-12T20:18:37.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15890" PostTypeId="2" ParentId="15875" CreationDate="2016-07-12T23:44:00.100" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://imperavi.com/redactor/examples/formatting-add/&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; you referenced is assuming that you've got full-control over the output/HTML of the page and you've already got an instance of Redactor up-and-running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of Craft, the only place you have full control over is the front-end of your site, not the control panel.  You certainly can include the HTML/CSS/JS to load Redactor on the front-end of your site, in which case you can have the Redactor configuration do whatever you want it to do (including adding classes to the Redactor format list).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the control panel, you got much more limited options.  You can probably pull off what you're looking for by using the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;CP JS&lt;/a&gt; plugins that inject CSS and JS into control panel pages, you'd just want to be sure and target actual pages that have Redactor instances on them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-12T23:44:00.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15891" PostTypeId="2" ParentId="15883" CreationDate="2016-07-13T01:11:46.163" Score="2" Body="&lt;p&gt;The example templates work with PayPal express out of the box, there is nothing special you need to do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can only add PayPal Express as a Payment method when you have bought and registered Craft Commerce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paypal Express is an 'offsite' gateway, and it uses the exact same form as the dummy payment form but posts the form without the credit card inputs - that form then redirects you to PayPal. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-13T01:11:46.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15893" PostTypeId="2" ParentId="15875" CreationDate="2016-07-13T07:54:28.690" Score="7" Body="&lt;p&gt;Your example code attempts to create a new Redactor instance, which (as Brad says) won't work inside the control panel (where Craft has created the Redactor instances already).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, however, use the Redactor config files to add an element with the classname &lt;code&gt;.note&lt;/code&gt;. To do that, add the following to the file &lt;code&gt;config/redactor/Standard.json&lt;/code&gt; (or if you configured your RichText field to use a different configuration, the JSON file corresponding to that configuration):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;formattingAdd&quot;: {&#xA;  &quot;note&quot;: {&#xA;    &quot;title&quot;: &quot;Note&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;, &quot;class&quot;, &quot;note&quot;]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the first parameter in the &lt;code&gt;args&lt;/code&gt; property is the tag which the &lt;code&gt;.note&lt;/code&gt; element will use – according to the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formattingAdd&quot; rel=&quot;noreferrer&quot;&gt;Redactor docs&lt;/a&gt;, only &lt;code&gt;p&lt;/code&gt;, &lt;code&gt;pre&lt;/code&gt;, &lt;code&gt;blockquote&lt;/code&gt;, &lt;code&gt;div&lt;/code&gt; and heading tags can be used with &lt;code&gt;formattingAdd&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that unless you add some custom CSS, the &lt;code&gt;.note&lt;/code&gt; will – of course – not be styled any differently than a normal paragraph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there's no way to add custom CSS and JavaScript to the Control Panel without a custom plugin – either by &lt;a href=&quot;https://craftcms.stackexchange.com/a/270/1098&quot;&gt;writing your own&lt;/a&gt; or by installing the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;CP CSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;noreferrer&quot;&gt;CP JS&lt;/a&gt; plugins.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-13T07:54:28.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15894" PostTypeId="1" AcceptedAnswerId="15896" CreationDate="2016-07-13T11:02:27.833" Score="1" ViewCount="489" Body="&lt;p&gt;My Craft blog has the path &lt;code&gt;localhost:8888/blog&lt;/code&gt;&#xA;The Assets are in the folder assets, so its &lt;code&gt;localhost:8888/blog/assets&lt;/code&gt;.&#xA;I set the path of an image to &lt;code&gt;/assets&lt;/code&gt;, but then it looks for an image at &lt;code&gt;localhost:8888/assets&lt;/code&gt;. Is there any way to handle this dynamically, without needing to write blog/ in front of every asset url? &lt;/p&gt;&#xA;" OwnerUserId="5325" LastEditorUserId="45" LastEditDate="2016-08-13T02:37:12.797" LastActivityDate="2016-08-13T02:37:12.797" Title="Correct Asset URL when using folders" Tags="&lt;assets&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15896" PostTypeId="2" ParentId="15894" CreationDate="2016-07-13T11:50:50.613" Score="2" Body="&lt;p&gt;I have also found this slightly confusing from time to time. These settings work well for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, on the server the path is: &lt;strong&gt;.../public_html/uploads/services&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kNFff.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kNFff.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-07-13T11:50:50.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15897" PostTypeId="1" CreationDate="2016-07-13T12:27:35.483" Score="7" ViewCount="1632" Body="&lt;p&gt;Can someone break down how I should validate empty address fields as a plugin for Craft Commerce and take the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14958/craft-commerce-custom-address-model-validations&quot;&gt;following answer&lt;/a&gt; further?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft Commerce documentation provides the following example for the name field - but I'm not sure what my next steps should be...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress', function($event){&#xA;            $address = $event-&amp;gt;params['address'];&#xA;            $address-&amp;gt;addError('firstName','Not a cool name man.');&#xA;            $event-&amp;gt;performAction = false;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="22" LastEditDate="2017-05-09T21:44:40.587" LastActivityDate="2019-04-16T15:02:40.033" Title="Craft Commerce: Validation on Address Fields" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15898" PostTypeId="1" AcceptedAnswerId="15899" CreationDate="2016-07-13T12:57:29.683" Score="2" ViewCount="388" Body="&lt;p&gt;I am puzzling the best way to implement hero images per 'section' of a site.&#xA;I can set a global default hero image no problem. But I want to set one header image for the root and children of a particular section.&#xA;I can't use url segments as the site is multi-lingual and it will change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried detecting the root of the current structure to base my template code on. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rootEntry = entry.getAncestors().first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this returns null - like there is no model returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;NO answer yet but a repharasing of the question.&#xA;IN order to do this you need to get the top level entry based on where you are in the site structure/tree. This link &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6995/building-a-nav-from-the-top-level-page-of-a-structure/6997#6997&quot;&gt;Building a nav from the top level page of a structure&lt;/a&gt; demonstrates great working code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the assumption in the above posts and many others is that the structure is built out of the actual entry pages themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two structures. Pages and menus. The menu structure has related entry fields that 'point' to the pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in in my scenario the menu structure is built out of related entry fields - not the entry being viewed. Hence, the reasons getAncestors was not working was because it was taking the existing entry a visitor was viewing and looking for a hierarchy structure that was flat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is now more complex - how do you get the top level tree branch of your structure menu based on the current entry viewed when that current entry is a related entry field in your structure menu? It seems very complicated to achieve. Especially just for flexible headers per sections....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FINAL UPDATE&#xA;Thanks Mats - i couldn't have done this without your diligent replies.&#xA;Below is my final solution to find out what the top level root is. It is expressed as sub navigation for structure menu but it does two things - build s the sub nav and identifies the root of the tree where you are. NB macro is used for active links. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the sidebar structure subnavigation #}&#xA;{# check for entry so channels do not break #}&#xA;{% if entry is defined %}&#xA;    {% set navEntry = craft.entries.section('menu').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'entryLink'&#xA;    }).first() %}&#xA;&#xA;    {# get the root entry of the structure set to null if we are at top #}&#xA;    {% set root = navEntry ? craft.entries.ancestorOf(navEntry).level(1).first() : null %}&#xA;&#xA;    {# setup variables in switch for ouput of heading and sub links#}&#xA;    {% switch root %}&#xA;        {% case null %}&#xA;            {% if navEntry.hasDescendants() %}&#xA;                {% set heading = navEntry.title %}&#xA;                {% set thisSubMenu = craft.entries.descendantOf(navEntry) %}&#xA;            {% endif %}&#xA;            {% set rootEntry = navEntry %}&#xA;        {% case true %}&#xA;            {% set heading = root.title %}&#xA;            {% set thisSubMenu = craft.entries.descendantOf(root) %}&#xA;            {% set rootEntry = root %}&#xA;    {% endswitch %}&#xA;{% endif %}&#xA;&#xA;{% if heading is defined %}&#xA;    &amp;lt;h3&amp;gt;{{ heading }}&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Get entries to build the sub-menu #}&#xA;{% if thisSubMenu is defined %}&#xA;{% set subMenu = thisSubMenu %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in subMenu %}&#xA;&#xA;        {% if entry.entryLink.first|length %}&#xA;&#xA;            {% set subNavLink = entry.entryLink.first().uri %}&#xA;&#xA;        {% elseif entry.customMenuUrl|length %}&#xA;&#xA;            {% set subNavLink = entry.customMenuUrl %}&#xA;&#xA;    {% endif %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a  href=&quot;{{ siteUrl }}{{ subNavLink }}&quot; class=&quot;{{ macros.isActiveChildClass(entry.slug) | trim }} level{{ entry.level }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endif %}&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-14T14:42:18.730" Title="How to set hero image for root and children in a structure" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15899" PostTypeId="2" ParentId="15898" CreationDate="2016-07-13T13:08:18.053" Score="1" Body="&lt;p&gt;Something like this should do the trick (obviously, change &lt;code&gt;navStructureHandle&lt;/code&gt; and &lt;code&gt;entriesFieldHandle&lt;/code&gt; to real values):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the related nav entry for the current entry being viewed #}&#xA;{% set navEntry = craft.entries.section('navStructureHandle').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'entriesFieldHandle'&#xA;}).first() %}&#xA;&#xA;{# Get the root (top level parent) structure entry for the nav entry #}&#xA;{% set rootEntry = navEntry ? craft.entries.ancestorOf(navEntry).level(1).first() : null %}&#xA;&#xA;{# If a root entry was found, print out the title #}&#xA;{% if rootEntry %}&#xA;    &amp;lt;span class=&quot;nav-header-title&quot;&amp;gt;{{ rootEntry.title }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, &lt;code&gt;rootEntry&lt;/code&gt; will be &lt;code&gt;null&lt;/code&gt; if the current entry doesn't have a related nav structure entry, or if a top level parent can't be found for the nav entry (i.e. the nav entry &lt;em&gt;is&lt;/em&gt; top level).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wouldn't worry too much about the performance with the above, but if you do feel it's too complex for printing a header, you could consider using the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse plugin&lt;/a&gt; instead. Preparse basically lets you create a custom field containing Twig code that will be parsed whenever the entry is saved. This basically lets you &quot;cache&quot; the result of costly Twig operations to a plain text, custom field on an actual entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Preparse, you could add a field called &lt;code&gt;navHeaderTitle&lt;/code&gt; to your child entries (i.e. &lt;em&gt;not&lt;/em&gt; the nav section). The field should contain the Twig code above, in addition to actually printing out the &lt;code&gt;rootEntry&lt;/code&gt; title if a root entry is found (note that it's a good idea to wrap the whole thing in a &lt;code&gt;{% spaceless %}&lt;/code&gt; tag pair):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %} &#xA;    {% set navEntry = craft.entries.section('navStructureHandle').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'entriesFieldHandle'&#xA;}).first() %}&#xA;    {% set rootEntry = navEntry ? craft.entries.ancestorOf(navEntry).level(1).first() : null %}&#xA;    {{ rootEntry ? rootEntry.title }}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you could simply do something like this in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# No need to pull any entries; just test for the `navHeaderTitle` field #}&#xA;{% if entry.navHeaderTitle %}&#xA;    &amp;lt;span class=&quot;nav-header-title&quot;&amp;gt;{{ entry.navHeaderTitle }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, the caveat with the Preparse approach is that if you ever change your root entry's title, you'll have to re-save all your child entries in order to re-parse the Twig and update the entries' &lt;code&gt;navHeaderTitle&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good compromise could be to use Preparse, but echo out the root entry ID instead of the title – then you could do this in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rootEntry = entry.navHeaderEntryId ? craft.entries.id(entry.navHeaderEntryId).first() : null %}&#xA;{% if rootEntry %}&#xA;    &amp;lt;span class=&quot;nav-header-title&quot;&amp;gt;{{ rootEntry.title }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-13T19:24:23.677" LastActivityDate="2016-07-13T19:24:23.677" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15900" PostTypeId="1" AcceptedAnswerId="15988" CreationDate="2016-07-13T13:14:52.560" Score="1" ViewCount="511" Body="&lt;p&gt;When I test with my payment gateway (Sage Pay) I get a server error stating Craft Commerce isn't providing a redirect after payment is received:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what is shown in my error logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] &quot;POST /index.php/actions/commerce/payments/completePayment?commerceTransactionId=9&amp;amp;commerceTransactionHash=b965d6bb8ca17ffc475849ab878721d5 HTTP/1.1&quot; 404 50171 &quot;-&quot; &quot;SagePay-Notifier/1.0&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what might be causing the redirect issue?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2016-07-21T08:36:23.110" LastActivityDate="2017-09-28T15:48:42.943" Title="Craft Commerce: Sage Pay - Redirect Required after payment?" Tags="&lt;plugin-craftcommerce&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15901" PostTypeId="1" AcceptedAnswerId="15907" CreationDate="2016-07-13T14:51:42.770" Score="1" ViewCount="115" Body="&lt;p&gt;I see there is an undocumented event called &lt;code&gt;onBeforeMessageCompile&lt;/code&gt; in the Contact Form plugin source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::import('plugins.contactform.events.ContactFormMessageEvent');&#xA;$event = new ContactFormMessageEvent($this, array('postedMessage' =&amp;gt; $postedMessage));&#xA;craft()-&amp;gt;contactForm-&amp;gt;onBeforeMessageCompile($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How does one use this event? What can it be used for? and&lt;/li&gt;&#xA;&lt;li&gt;Why is an &lt;code&gt;$event&lt;/code&gt; object being instantiated &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/controllers/ContactFormController.php#L55&quot; rel=&quot;nofollow&quot;&gt;at this point in the controller&lt;/a&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="597" LastActivityDate="2016-07-13T17:57:43.530" Title="What does the Before compile event inside the Contact Form plugin do?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15902" PostTypeId="2" ParentId="15897" CreationDate="2016-07-13T16:10:30.817" Score="5" Body="&lt;p&gt;You'll need to add some kind of validation query to the field first. Something along the lines of this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress', function(Event $event){&#xA;   $address = $event-&amp;gt;params['address'];&#xA;&#xA;   if (empty($address-&amp;gt;address1))&#xA;   {&#xA;     $address-&amp;gt;addError('address1', Craft::t('Address Line 1 is required'));&#xA;     $event-&amp;gt;performAction = false;&#xA;   }&#xA;&#xA;   if ($address-&amp;gt;city == 'London')&#xA;   {&#xA;     $address-&amp;gt;addError('city', Craft::t('Sorry, you can\'t be from London'));&#xA;     $event-&amp;gt;performAction = false;&#xA;   }&#xA;});  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4628" LastEditDate="2017-08-22T13:47:04.427" LastActivityDate="2017-08-22T13:47:04.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15904" PostTypeId="2" ParentId="15832" CreationDate="2016-07-13T16:40:43.493" Score="1" Body="&lt;p&gt;You can simplify your first bit of code by using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ product.taxCategory.name == 'withVat' ? '+VAT' }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason you get the error with your second bit of code is because &lt;code&gt;craft.commerce.taxCategories&lt;/code&gt; is only an array of Tax Category names. Only the models of each Tax Category would have properties such as &lt;code&gt;.id&lt;/code&gt; and &lt;code&gt;.name&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-13T16:40:43.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15905" PostTypeId="1" AcceptedAnswerId="15908" CreationDate="2016-07-13T17:48:27.820" Score="4" ViewCount="436" Body="&lt;p&gt;I'm working with dates and want to use Craft's Class reference to speed things along but am struggling to figure out how to use them. For example, this works as expected and returns the siteUrl:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return craft()-&amp;gt;getSiteUrl();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I format something more complicated? Say I want to format a date variable, how do I use any of these classes: &lt;a href=&quot;https://craftcms.com/classreference/etc/dates/DateTime&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/classreference/etc/dates/DateTime&lt;/a&gt;? I've tried all sorts but generally end up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\WebApp and its behaviors do not have a method or closure named...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-13T18:17:01.783" Title="How to access Craft classes within plugin?" Tags="&lt;plugin-development&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15906" PostTypeId="1" AcceptedAnswerId="15909" CreationDate="2016-07-13T17:55:48.663" Score="1" ViewCount="64" Body="&lt;p&gt;I have an entries field called 'customerLogoBarUrl'. It contains one entry. So I can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.customerLogoBarUrl.limit(1) %}&#xA;  {% set theUrl = item.url %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I need to output that variable inside an assets loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.customerLogoBar %}&#xA;  {% for asset in item.logo %}&#xA;    &amp;lt;a href=&quot;{{ theUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url() }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This yields &lt;em&gt;theUrl doesn't exist&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2016-07-14T20:10:43.907" Title="How do I make my variable available inside an assets loop?" Tags="&lt;assets&gt;&lt;variable&gt;&lt;forloop&gt;&lt;set&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15907" PostTypeId="2" ParentId="15901" CreationDate="2016-07-13T17:57:43.530" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How does one use this event? What can it be used for?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It gives plugins a chance to manipulate the posted message to however they want instead of using the plugin's default implementation.  A plugin would listen to it like they listen to any &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;other event&lt;/a&gt;. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('contactForm.onBeforeMessageCompile', function(Event $event) {&#xA;        $postedMessage = $event-&amp;gt;params['postedMessage'];&#xA;        $event-&amp;gt;messageFields = $postedMessage;&#xA;&#xA;        // Do your thing.&#xA;&#xA;        $event-&amp;gt;message = &quot;Your custom compiled message&quot;;&#xA;        $event-&amp;gt;htmlMessage = &quot;Your custom compiled HTML message&quot;;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is an &lt;code&gt;$event&lt;/code&gt; object being instantiated at this point in the controller?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The short answer is &quot;because that's how events work&quot;. :) Is there a particular thing that's confusing you?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-13T17:57:43.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15908" PostTypeId="2" ParentId="15905" CreationDate="2016-07-13T18:17:01.783" Score="5" Body="&lt;p&gt;&lt;code&gt;craft()&lt;/code&gt; is just a wrapper for the singleton instance of the &lt;a href=&quot;https://craftcms.com/classreference/etc/web/WebApp&quot; rel=&quot;noreferrer&quot;&gt;WebApp&lt;/a&gt; class and you can call its &lt;a href=&quot;https://craftcms.com/classreference/etc/web/WebApp#public-methods&quot; rel=&quot;noreferrer&quot;&gt;methods directly&lt;/a&gt; like you're doing with &lt;code&gt;getSiteUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll notice that &lt;code&gt;getSiteUrl()&lt;/code&gt; actually isn't in that list of WebApp methods, though.  That's because it (along with other methods) live in &lt;a href=&quot;https://craftcms.com/classreference/etc/behaviors/AppBehavior&quot; rel=&quot;noreferrer&quot;&gt;AppBehavior&lt;/a&gt;, which is a &lt;a href=&quot;http://www.yiiframework.com/wiki/44/behaviors-events/&quot; rel=&quot;noreferrer&quot;&gt;Yii behavior&lt;/a&gt; and is very similar to a &lt;a href=&quot;https://secure.php.net/manual/en/language.oop5.traits.php&quot; rel=&quot;noreferrer&quot;&gt;trait&lt;/a&gt; that gets it's methods &quot;mixed-in&quot; to the class that wants them (in this case, WebApp).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stand-alone classes that are't attached to &lt;code&gt;WebApp&lt;/code&gt; (&lt;code&gt;craft()&lt;/code&gt;), like &lt;a href=&quot;https://craftcms.com/classreference/etc/dates/DateTime&quot; rel=&quot;noreferrer&quot;&gt;DateTime&lt;/a&gt;, you can instantiate like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dateTime = new DateTime();&#xA;$dateTime-&amp;gt;format(...);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if they are static classes (like the &lt;a href=&quot;https://craftcms.com/classreference/#craft.app.helpers&quot; rel=&quot;noreferrer&quot;&gt;Helpers&lt;/a&gt;), you can use directly like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lowerCaseString = StringHelper::toLowerCase('ABC');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-13T18:17:01.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15909" PostTypeId="2" ParentId="15906" CreationDate="2016-07-13T18:23:04.377" Score="3" Body="&lt;p&gt;Your problem is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Scope_(computer_science)&quot; rel=&quot;nofollow&quot;&gt;scoping&lt;/a&gt; issue. You've defined &lt;code&gt;theUrl&lt;/code&gt; inside the scope of a &lt;code&gt;for&lt;/code&gt; loop, so it only ever lives inside of that loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this to have it exist outside of the loop, too.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theUrl = '' %}&#xA;&#xA;{% for item in entry.customerLogoBarUrl.limit(1) %}&#xA;    {% set theUrl = item.url %}&#xA;{% endfor %}&#xA;&#xA;{% for item in entry.customerLogoBar %}&#xA;    {% for asset in item.logo %}&#xA;        &amp;lt;a href=&quot;{{ theUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url() }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="110" LastEditDate="2016-07-14T20:10:43.907" LastActivityDate="2016-07-14T20:10:43.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15910" PostTypeId="1" CreationDate="2016-07-13T20:04:53.553" Score="0" ViewCount="315" Body="&lt;p&gt;I am trying to use the &lt;code&gt;relatedTo&lt;/code&gt; parameter to get user details for a given entry with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(1) %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;    {% set authorDetails =  craft.users.relatedTo(entry) %}&#xA;&#xA;    {% for person in authorDetails %}&#xA;        {{ person.firstName }} {{ person.lastName }}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Title returns fine, but nothing else. First time I have used &lt;code&gt;relatedTo&lt;/code&gt; and guess there is something I don't understand about usage. Any advice greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roi&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2016-07-13T20:30:23.840" LastActivityDate="2016-07-13T22:13:02.000" Title="Get User Object for a given Entry" Tags="&lt;relatedto&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15911" PostTypeId="2" ParentId="15910" CreationDate="2016-07-13T22:13:02.000" Score="2" Body="&lt;p&gt;If you're just looking to get the author of an entry, it's a simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(1) %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;    {{ entry.author.firstName }} {{ entry.author.lastName }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're looking to get every user associated with every &lt;a href=&quot;https://craftcms.com/docs/users&quot; rel=&quot;nofollow&quot;&gt;Users field&lt;/a&gt; for an entry, your &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; syntax will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(1) %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;    {% set allRelatedUsers =  craft.users.relatedTo(entry) %}&#xA;&#xA;    {% for user in allRelatedUsers %}&#xA;        {{ user.firstName }} {{ user.lastName }}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason that returned nothing in your original question is because the &quot;author&quot; field isn't a proper Users field type - it's more of a special case user field.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-13T22:13:02.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15912" PostTypeId="2" ParentId="15832" CreationDate="2016-07-14T02:32:40.147" Score="1" Body="&lt;p&gt;A full &lt;code&gt;Commerce_TaxCategoryModel&lt;/code&gt; array will be returned in Craft Commerce 1.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like this functionality now, please replace the &lt;code&gt;getTaxCategories()&lt;/code&gt; function in the &lt;code&gt;plugins/commerce/variables/CommerceVariable.php&lt;/code&gt; file with this replacement function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTaxCategories()&#xA;{&#xA;    $taxCategories = craft()-&amp;gt;commerce_taxCategories-&amp;gt;getAllTaxCategories();&#xA;&#xA;    // Need to put the methods into an array keyed by method ID for backwards compatibility.&#xA;    $newArray = [];&#xA;    foreach ($taxCategories as $model)&#xA;    {&#xA;        $newArray[$model-&amp;gt;id] = $model;&#xA;    }&#xA;&#xA;    return $newArray;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-14T02:32:40.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15914" PostTypeId="1" CreationDate="2016-07-14T06:39:04.397" Score="1" ViewCount="136" Body="&lt;p&gt;I am trying to pull an image from services marked with a category of left. I would only like to display one image. I would also like to randomize the image if possible from all the images marked left. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# RANDOM IMAGE FROM SERVICES - LEFT #}&#xA;&amp;lt;div class=&quot;grid-item&quot;&amp;gt;&#xA;    {% for homepage in craft.entries.section('services').limit('1').relatedTo(left).find() %}&#xA;        &amp;lt;div class=&quot;image-wrapper overlay-fade-in&quot;&amp;gt;&#xA;&#xA;            &amp;lt;img src=&quot;{{ homepage.homepageImage.first().getUrl }}&quot; alt=&quot;{{ homepage.title }}&quot;/&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;image-overlay-content&quot;&amp;gt;&#xA;&#xA;                &amp;lt;h2&amp;gt;{{ homepage.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ homepage.description }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;a href=&quot;services.html&quot; class=&quot;button&quot;&amp;gt;View Rental Pricing&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5396" LastEditorUserId="57" LastEditDate="2016-07-14T17:29:17.387" LastActivityDate="2016-07-14T17:29:17.387" Title="Pull random image from entries marked with a certain category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15915" PostTypeId="2" ParentId="15914" CreationDate="2016-07-14T08:01:29.957" Score="3" Body="&lt;p&gt;Welcome to the Craft community @bjyama&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Step one: pick a random service #}&#xA;{% set randomService = craft.entries.section('services').relatedTo(left).order('RAND()').first() %}&#xA;&#xA;{# Step two: pick a random image from the above service #}&#xA;{% set randomServiceImage = service.homepageImage.order('RAND()').first() %}&#xA;&#xA;{% if randomServiceImage %}&#xA;    &amp;lt;img src=&quot;{{ randomServiceImage.getUrl('imageTransformName') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info, have a look here: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#order&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.entries#order&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how you get on :)&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="1098" LastEditDate="2016-07-14T08:11:27.770" LastActivityDate="2016-07-14T08:11:27.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15916" PostTypeId="1" AcceptedAnswerId="15934" CreationDate="2016-07-14T08:20:17.267" Score="2" ViewCount="268" Body="&lt;p&gt;I've set up a Spout Form, and I can customize the form.html file after copying it and moving it to my own &lt;code&gt;templates/_form/formHandle&lt;/code&gt; folder. But when I want to customize the &lt;code&gt;field.html&lt;/code&gt; file (I do the exact same thing as with the &lt;code&gt;form.html&lt;/code&gt; file) nothing happens. Does anyone know what I'm doing wrong? I only want to add some custom classes, nothing fancy :-).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-07-14T17:30:04.870" LastActivityDate="2016-07-18T13:07:11.620" Title="Customize the field.html file for Sprout Forms" Tags="&lt;templating&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15917" PostTypeId="1" AcceptedAnswerId="15923" CreationDate="2016-07-14T09:48:15.840" Score="3" ViewCount="103" Body="&lt;p&gt;I've amended the time people have to verify an account, using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'verificationCodeDuration' =&amp;gt; 'P7D',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, I've done this retrospectively, after the verification emails have all gone out (quite a lot of them). Will this new verification time be applied to verification links that have already been sent out? Or will I need to get those emails sent again, as only new verification links will have this applied?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-14T17:40:54.010" Title="Will a change to verificationCodeDuration be updated retrospectively?" Tags="&lt;users&gt;&lt;config&gt;&lt;verification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15918" PostTypeId="1" AcceptedAnswerId="15921" CreationDate="2016-07-14T13:27:43.370" Score="7" ViewCount="1122" Body="&lt;p&gt;I'm new to Craft CMS and I would appreciate some advice re the best approach to take for modelling content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm coming from an ExpressionEngine background, where I would typically use one pages channel for standard text pages, usually in conjuction with the Structure add-on to generate a nice site tree in the control panel where users could move page entries around between various sections as needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in Craft, I see a Structure type and it's tempting to have one structure called Pages to act in a similar way. This would enable the main nav for the site to be dynamic using the nav tag, and users could easily move pages wherever they want site wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would end up with the following content model:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Singles: Homepage &lt;/li&gt;&#xA;&lt;li&gt;Channels: News, Events etc &lt;/li&gt;&#xA;&lt;li&gt;Structures: Pages&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Pages would end up as a site map excluding the homepage, with each top level entry being a site section e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;About&#xA;-History&#xA;-Team&#xA;News (page used for news landing)&#xA;Events (page used for events landing)&#xA;Visit&#xA;-Facilities&#xA;-Opening Hours&#xA;Contact&#xA;etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I see that the Happy Lager demo site takes a one structure per section approach. Also, early on in the Mijingo video series, it cautions against using one structure for most/all your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am keen to use best practice from the off, so would appreciate if you could advise whether having one master pages structure is a valid approach or why it's a bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="135" LastEditorUserId="135" LastEditDate="2016-07-14T19:44:30.523" LastActivityDate="2016-12-05T11:13:49.210" Title="One structure vs a structure per section?" Tags="&lt;structure&gt;&lt;best-practice&gt;&lt;content&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15919" PostTypeId="1" CreationDate="2016-07-14T13:33:08.237" Score="5" ViewCount="952" Body="&lt;p&gt;I have a Structure section that contains most of the pages on my website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have users that need to edit only some of those pages. Since permissions are set on a per-section basis, right now they can edit either all or none of those pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about building custom user permissions for only some of those pages?&lt;/p&gt;&#xA;" OwnerUserId="5050" LastEditorUserId="4466" LastEditDate="2016-07-14T18:36:27.930" LastActivityDate="2016-07-14T18:36:27.930" Title="User permissions on a per-entry basis?" Tags="&lt;control-panel&gt;&lt;permissions&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15920" PostTypeId="2" ParentId="15919" CreationDate="2016-07-14T14:20:27.120" Score="1" Body="&lt;p&gt;As far as I'm aware this is not currently possible, Frabo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a potential, somewhat long-winded workaround... If it was a single user, you could make that person/User the Author of the entries which you want them to be able to edit, then uncheck the option (in Settings &gt; Users &gt; User Groups ) to &quot;&lt;strong&gt;Edit other authors’ entries&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be interesting to hear what others suggest... &lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2016-07-14T14:20:27.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15921" PostTypeId="2" ParentId="15918" CreationDate="2016-07-14T15:00:11.153" Score="9" Body="&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Let the content dictate how you model and architect it.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If the site is sufficiently &lt;em&gt;small&lt;/em&gt; or sufficiently &lt;em&gt;simple&lt;/em&gt;, I think either approach is ok. My team has used both approaches, and it really depends on the Client's needs.&lt;/p&gt;&#xA;&lt;p&gt;An incomplete list of reasons to use separate channels and structures are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tagging/Categorizing things like Products is probably easier to manage when they are in their own channel&lt;/li&gt;&#xA;&lt;li&gt;Your client has multiple divisions and they are managing their content separately, and thus need to control permissions&lt;/li&gt;&#xA;&lt;li&gt;You want to reference content pieces in multiple places&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;An incomplete list of reasons to use a &lt;em&gt;Site Pages&lt;/em&gt; approach are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The content isn't highly relatable, or doesn't rely much on relationships/categories/tags&lt;/li&gt;&#xA;&lt;li&gt;The site is small enough&lt;/li&gt;&#xA;&lt;li&gt;The client has demonstrated an ignorance or apathy for understanding content and &amp;quot;just needs a site&amp;quot;&lt;/li&gt;&#xA;&lt;li&gt;Project management constraints: fast timeline, cheap budget, or pain-in-the-ass-go-away clients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you're familiar with ExpressionEngine and channels, then you probably know that things don't have to be pages to be in a channel or structure. You can combine the two approaches for a slightly sophisticated site.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Here's an example we have done that uses both approaches:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We used structures for things like &lt;a href=&quot;http://www.cswindustrials.com/about/management&quot; rel=&quot;noreferrer&quot;&gt;Executive Team Bios&lt;/a&gt; that appear on one page. The landing page is in the Site Pages structure, which supports 3 levels max, while the bios themselves are managed in a separate structure (a channel would have been fine here, but the structure allows us to order by rank without an &amp;quot;order&amp;quot; field). We put a &lt;em&gt;Management Widget&lt;/em&gt; blockType in a Matrix/Neo field so the user can put that content where they need to. That block allows them to select &amp;quot;Management&amp;quot; or &amp;quot;Board of Directors&amp;quot;, so the block is reusable on multiple pages.&lt;/p&gt;&#xA;&lt;p&gt;This block could have easily been a nested block using Neo/SuperTable fields, but the categorization (Management/Board) is what led us to make it it's own structure. Some members belong to both groups, and without the relationship it would have required inputting and managing duplicate content.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If navigation is your concern, you can use plugins like &lt;a href=&quot;https://straightupcraft.com/craft-plugins/navee&quot; rel=&quot;noreferrer&quot;&gt;Navee&lt;/a&gt; or &lt;a href=&quot;https://straightupcraft.com/craft-plugins/a-m-navigation&quot; rel=&quot;noreferrer&quot;&gt;A &amp;amp; M Navigation&lt;/a&gt; to allow content managers to build navigations. Or on smaller sites, we just have a &amp;quot;Navigation&amp;quot; global field group with entries fields, and users can build out header and footer navigation as they deem appropriate.&lt;/p&gt;&#xA;&lt;p&gt;My advice is let the content dictate how you model and architect it. If you have complex content requirements, don't try to shoehorn them into a one-structure architecture. Craft's CP allows you to group channels and structures, and the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/expanded-singles&quot; rel=&quot;noreferrer&quot;&gt;Expanded Singles&lt;/a&gt; plugin allows you to put singles in the entry sidebar. This can help content managers know what they are editing while allowing for more complex models. See below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ytFBw.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ytFBw.jpg&quot; alt=&quot;Groups in a control panel help content managers know what to edit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3653" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-07-14T16:37:14.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15922" PostTypeId="2" ParentId="15919" CreationDate="2016-07-14T15:56:41.480" Score="3" Body="&lt;p&gt;This might be considered more of a &quot;workaround&quot; than a technical solution, but I think it could actually solve your problem quite nicely...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You can use &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow&quot;&gt;CP CSS&lt;/a&gt; and/or &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;CP JS&lt;/a&gt; to show or hide certain fields.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably find that the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpbodyclasses&quot; rel=&quot;nofollow&quot;&gt;CP Body Classes&lt;/a&gt; plugin is helpful for narrowing in on specific conditions. For example, you could show/hide certain fields based on a specific user group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I wrote each of those plugins. Feel free to leave feedback on Github!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-07-14T15:56:41.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15923" PostTypeId="2" ParentId="15917" CreationDate="2016-07-14T17:40:54.010" Score="3" Body="&lt;p&gt;If you check &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#isVerificationCodeValidForUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersService-&gt;isVerificationCodeValidForUser()&lt;/a&gt;, you &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UsersService.php#L155&quot; rel=&quot;nofollow&quot;&gt;can see&lt;/a&gt; that it's taking the current date/time and subtracting the &lt;a href=&quot;https://craftcms.com/docs/config-settings#verificationCodeDuration&quot; rel=&quot;nofollow&quot;&gt;verificationCodeDuration&lt;/a&gt; config setting value, then comparing that to the &lt;code&gt;verificationCodeIssuedDate&lt;/code&gt; time that is saved for that user in the &lt;code&gt;craft_users&lt;/code&gt; table.  If the issued date/time is greater than the result of the subtraction date/time, then it's still valid, otherwise, not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So because it's checking at runtime against the current date/time, the new &lt;code&gt;verificationCodeDuration&lt;/code&gt; value will immediately take affect for any existing verification codes on a user.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-14T17:40:54.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15924" PostTypeId="1" CreationDate="2016-07-14T19:09:32.717" Score="1" ViewCount="1069" Body="&lt;p&gt;I've been running into issues where the Delete Stale Template Caches tasks on my Production environment are running up to 20x longer than on my identical Staging environment. The config/environment settings are the same across both (including devMode being disabled on Stage) but they use separate databases. So I imported my Prod database into my Stage environment just to get complete parity across both environments to try and diagnose the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I edited the same entry on Prod/Staging and hit save, both kick off the DSTC task, but I got ~10,000 steps on Production as opposed to ~500 on Staging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I copied the SQL row on each database and this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;14  14  1   2   0   263 555 running DeleteStaleTemplateCaches   NULL    {&quot;elementId&quot;:[&quot;3282&quot;,&quot;3342&quot;,&quot;3343&quot;,&quot;3341&quot;,&quot;3548&quot;,&quot;3549&quot;,&quot;3550&quot;,&quot;3547&quot;,&quot;3382&quot;,&quot;3383&quot;,&quot;3381&quot;,&quot;9171&quot;,&quot;9172&quot;,&quot;3395&quot;,&quot;3391&quot;,&quot;14629&quot;,&quot;14630&quot;,&quot;14628&quot;,&quot;3281&quot;]} 2016-07-14 18:38:46 2016-07-14 18:38:52 d39e2b0f-e6d6-446d-9d2b-30d35ecca378&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Production:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;16042   16042   1   2   0   439 9864    running DeleteStaleTemplateCaches   NULL    {&quot;elementId&quot;:[&quot;3282&quot;,&quot;3342&quot;,&quot;3343&quot;,&quot;3341&quot;,&quot;3548&quot;,&quot;3549&quot;,&quot;3550&quot;,&quot;3547&quot;,&quot;3382&quot;,&quot;3383&quot;,&quot;3381&quot;,&quot;9171&quot;,&quot;9172&quot;,&quot;3395&quot;,&quot;3391&quot;,&quot;14629&quot;,&quot;14630&quot;,&quot;14628&quot;,&quot;3281&quot;]} 2016-07-14 18:36:46 2016-07-14 18:37:07 b152c337-2316-45c9-8b29-4716faf41897&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The settings of the tasks are the exact same as far as the ElementIds that it involves, but the Stage task is 555 steps while the Production task is 9864. I'm seeing this pretty consistently across all entries - the number of steps in the Production environment is around 20x the Staging on identical entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit stumped as to why this is happening -- what determines the number of steps involved in any given DSTC task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Another odd thing is that it's kicking off the tasks on entries that don't have any &lt;code&gt;cache&lt;/code&gt; tags inside the templates. Again this is only happening in Production, it seems that the Staging site seems to recognize that these templates shouldn't be getting cached in the first place.&lt;/p&gt;&#xA;" OwnerUserId="5400" LastEditorUserId="5400" LastEditDate="2016-07-14T19:39:01.810" LastActivityDate="2016-07-14T20:00:24.057" Title="Delete Stale Template Caches tasks much larger in Production than Staging" Tags="&lt;cache&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15925" PostTypeId="2" ParentId="15924" CreationDate="2016-07-14T20:00:24.057" Score="4" Body="&lt;p&gt;First, this is perfectly normal. :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at Brandons explanation &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6633/how-does-template-caching-work&quot;&gt;here&lt;/a&gt; on how the cache tag works.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the element was added or modified, it queues up a new “Delete Stale&#xA;  Template Caches” task, which cycles through the templatecachecriteria&#xA;  table to see if there are any cached element queries which (if not&#xA;  cached) would have started showing the just-saved element. If the&#xA;  query returns the element, its corresponding cache will be deleted.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, the number of steps corresponds to the number of rows in the &lt;code&gt;templatecachecriteria&lt;/code&gt; table in the database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why would this be different between staging and production? Probably because you're getting different kind of traffic on the production site than the staging site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to understand that the cache is tied to the url, so mydomain.com/news and mydomain.com/news?id=212 will result in two different caches being created in the database, and a number of rows in the &lt;code&gt;templatecachecriteria&lt;/code&gt; table being created based on the number of criterias created inside the cached code (which can be alot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example given above is an example that we encounter a lot, where when an old site is replaced by a new one, there will still be a lot of links pointing to the new one. If these aren't handled correctly by either rewriting them to new url's, or returning 404's, this could result in many old urls generating new caches for the same page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recommended way to avoid this is to use the &lt;code&gt;globally&lt;/code&gt; keyword, and using the request path as the key, &lt;a href=&quot;https://craftcms.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;see the example in the &quot;using key&quot; section of the docs for &lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another common caveat is that there are caches on the 404 page that is not declared as globally, for instance a menu that needs a selected state or something. Then all urls that results in a 404 not found page, will create new caches with new criterias in templatecachecriteria. I've seen examples where this will eventually just kill the server because of the number of criterias that are rerun when an entry is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you I'd have a look in the &lt;code&gt;templatecaches&lt;/code&gt; table, and look at the path column to identify the paths of the created caches. This will often reveal groups of urls which generates more caches than they ideally should, and you could work from there to reduce the number.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-07-14T20:00:24.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15926" PostTypeId="1" CreationDate="2016-07-14T21:10:16.907" Score="0" ViewCount="412" Body="&lt;p&gt;I have this simple code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;services/{slug}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    Service &amp;lt;input type=&quot;text&quot; name=&quot;fields[service]&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;    {# Entry field (required) #}&#xA;    Client &amp;lt;input type=&quot;text&quot; name=&quot;fields[client][]&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% if entry is defined %}&#xA;    &amp;lt;pre&amp;gt;{{ dump(entry.getErrors()) }}&amp;lt;/pre&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The client field is set as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Submitting the form with empty client field I get no validation error but a CDbException.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the line with the client input field I get a validation error as expected:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;array(1) {   [&quot;client&quot;]=&gt;   array(1) {&#xA;      [0]=&gt;&#xA;      string(23) &quot;Client cannot be blank.&quot;   } }&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&#xA;How can I validate entry fields?&lt;/p&gt;&#xA;" OwnerUserId="623" LastActivityDate="2016-07-14T23:36:00.693" Title="Front-end entry field validation problem" Tags="&lt;frontend&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15927" PostTypeId="1" AcceptedAnswerId="15931" CreationDate="2016-07-14T21:22:53.957" Score="3" ViewCount="339" Body="&lt;p&gt;I am updating an entry using the entries service, I want to add a tag value into a tag field type (classifiedTags).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(120);&#xA;$entry-&amp;gt;getContent()-&amp;gt;classifiedTags = 'tagtest';&#xA;$entry-&amp;gt;title = 'Updating title to this';&#xA;$entry-&amp;gt;getContent()-&amp;gt;description = 'this is the new description';&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It runs and updates everything except the tag field (classifiedTags).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change it from a string to array like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;classifiedTags = array('tagtest');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]:&#xA;  Integrity constraint violation: 1452 Cannot add or update a child row:&#xA;  a foreign key constraint fails (&lt;code&gt;ggmg_craft&lt;/code&gt;.&lt;code&gt;craft_relations&lt;/code&gt;,&#xA;  CONSTRAINT &lt;code&gt;craft_relations_targetId_fk&lt;/code&gt; FOREIGN KEY (&lt;code&gt;targetId&lt;/code&gt;)&#xA;  REFERENCES &lt;code&gt;craft_elements&lt;/code&gt; (&lt;code&gt;id&lt;/code&gt;) ON DELETE CASCADE). The SQL&#xA;  statement executed was: INSERT INTO &lt;code&gt;craft_relations&lt;/code&gt; (&lt;code&gt;fieldId&lt;/code&gt;,&#xA;  &lt;code&gt;sourceId&lt;/code&gt;, &lt;code&gt;sourceLocale&lt;/code&gt;, &lt;code&gt;targetId&lt;/code&gt;, &lt;code&gt;sortOrder&lt;/code&gt;, &lt;code&gt;dateCreated&lt;/code&gt;,&#xA;  &lt;code&gt;dateUpdated&lt;/code&gt;, &lt;code&gt;uid&lt;/code&gt;) VALUES (:row0_col0, :row0_col1, NULL,&#xA;  :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7). Bound&#xA;  with :row0_col0='43', :row0_col1='31823', :row0_col3='tagtest',&#xA;  :row0_col4=1, :row0_col5='2016-07-14 21:16:04', :row0_col6='2016-07-14&#xA;  21:16:04', :row0_col7='d2228ed9-cc60-478d-929c-98efd776b63c'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which leads me to believe I am getting warmer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS v 2.6.2796&#xA;PHP v 5.6.13&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2016-07-15T07:25:32.377" Title="How do I add a value to a tag field type using the entries service saveEntry method?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;tags&gt;&lt;fieldtypes&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15928" PostTypeId="2" ParentId="15926" CreationDate="2016-07-14T23:36:00.693" Score="2" Body="&lt;p&gt;You'll need to make sure the entries title is set otherwise that will throw an error. You can do this using a field in your form or set it in the Control Panel to automatically be set using another field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently you are setting the client field to save using an array with &lt;code&gt;[client][]&lt;/code&gt; but the form input is set to &lt;code&gt;text&lt;/code&gt; which only provides string values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that when you leave the field blank it uses an empty array as it's value ( &lt;code&gt;[&quot;&quot;]&lt;/code&gt; ) hence why you don't get the required validation error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to provide an array of clients you'd need to use a different input type and also make sure that your client fieldType is set to something that can store arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code suggestion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;services/{slug}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;  Title&#xA;  &amp;lt;input type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  Service&#xA;  &amp;lt;input type=&quot;text&quot; name=&quot;fields[service]&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  Client &#xA;  &amp;lt;input type=&quot;text&quot; name=&quot;fields[client]&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% if entry is defined %}&#xA;  &amp;lt;pre&amp;gt;{{ dump(entry.getErrors()) }}&amp;lt;/pre&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-14T23:36:00.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15929" PostTypeId="2" ParentId="13132" CreationDate="2016-07-15T02:32:29.560" Score="1" Body="&lt;p&gt;If I understand your question correctly, you are looking to see your custom field in under the Entries index page of the Section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I know from Craft CMS ver. 2.5 or 2.6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Entries index page of the Section, click on the settings icon found on the left side bar, ensure you are on the section to show/hide the columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this is useful for you.&lt;/p&gt;&#xA;" OwnerUserId="4874" LastActivityDate="2016-07-15T02:32:29.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15930" PostTypeId="1" AcceptedAnswerId="15943" CreationDate="2016-07-15T05:12:05.497" Score="3" ViewCount="828" Body="&lt;p&gt;The Commerce site I'm working on (my first Craft project) will have a product listing page with filters. These will function as you would expect, but clicking a filter name will link to another version of the product listing page with another set of products, as opposed to updating the page via AJAX. I'm doing the content modeling now and am wondering if Craft categories are the best way to structure this or if there is a better way. I see it working somewhat like the &lt;a href=&quot;http://www.patagonia.com/shop/mens-jackets-vests&quot; rel=&quot;nofollow noreferrer&quot;&gt;Patagonia product page&lt;/a&gt; (click through the categories toward the top of the sidebar and note the URI change). However, unless there's an advantage to doing otherwise, I was just going to use categories for both of the filter sets below. Patagonia uses query string parameters when filtering by sport, whereas this site would have a unique slug(s) for each combination of filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what the filters look like. A checkbox or some other visual indication would be given when a filter is selected:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Product Categories&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category 1 (slug: &lt;code&gt;category-1&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Category 2&lt;/li&gt;&#xA;&lt;li&gt;Category 3&lt;/li&gt;&#xA;&lt;li&gt;New Products&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shop by Use&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use A (slug: &lt;code&gt;use-a&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Use B&lt;/li&gt;&#xA;&lt;li&gt;Use C&lt;/li&gt;&#xA;&lt;li&gt;Use D&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The selection options are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only one Product Category can be selected at a time (choosing another deselects the previous selection), but a selection is not required.&lt;/li&gt;&#xA;&lt;li&gt;Only one Use can be checked at a time (choosing another deselects the previous selection), but a selection is not required.&lt;/li&gt;&#xA;&lt;li&gt;A selected filter can be unselected by clicking it.&lt;/li&gt;&#xA;&lt;li&gt;With the Product Category and Use options unselected, a page with ALL products is displayed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A few more notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every product will belong to at least one Product Category but can belong to multiple.&lt;/li&gt;&#xA;&lt;li&gt;Every product has at least one Use and most have multiple.&lt;/li&gt;&#xA;&lt;li&gt;'New Products' is a unique category that would ideally expire based on a date chosen when adding a product.&lt;/li&gt;&#xA;&lt;li&gt;I was picturing the URIs being something like the following:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category selected: &lt;code&gt;domain.com/products/category-1&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Use selected: &lt;code&gt;domain.com/products/use-a&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category and Use selected: &lt;code&gt;domain.com/products/category-1/use-a&lt;/code&gt; or &lt;code&gt;domain.com/products/category-1-use-a&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are categories the best tool for this job? If not, what would work better? If so:&lt;/li&gt;&#xA;&lt;li&gt;Would it make sense for Product Categories and Shop by Use to be their own category groups?&lt;/li&gt;&#xA;&lt;li&gt;Creating category pages is simple enough, but I'm not sure how best to create a page that represents a combination of categories / selected filters (e.g. Category 2 + Use A). I know I can use &lt;code&gt;relatedTo&lt;/code&gt; to list products from multiple categories, but what is the best Craft element to use as a container for these pages? &lt;a href=&quot;https://craftcms.stackexchange.com/a/14915/4748&quot;&gt;This answer&lt;/a&gt; was helpful, but it's not quite the same (for one thing, it's not Commerce-specific; it refers to products but I believe they are just standard channel entries). Should the combined-category pages be in their own channel?&lt;/li&gt;&#xA;&lt;li&gt;New Products: I'm thinking this should be a static link, possibly to a single (&lt;code&gt;/products/new&lt;/code&gt;) that lists products whose &quot;newness&quot; has not expired. Is there a better way?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm probably overthinking this! I mainly want to know if I'm heading in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="4748" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-07-27T05:11:11.640" Title="Are categories the best way to organize Commerce product filters?" Tags="&lt;categories&gt;&lt;structure&gt;&lt;plugin-craftcommerce&gt;&lt;contentmodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15931" PostTypeId="2" ParentId="15927" CreationDate="2016-07-15T07:03:24.067" Score="6" Body="&lt;p&gt;The Tags field &lt;code&gt;classifiedTags&lt;/code&gt; needs an array of tag IDs, not slugs/titles. Also, if this is an existing entry and you want to retain tags already added to the field, you'll need to pull the existing tag IDs using &lt;code&gt;$entry-&amp;gt;classifiedTags-&amp;gt;ids()&lt;/code&gt; and merge with those.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tag = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Tag, [&#xA;    'groupId' =&amp;gt; 1,&#xA;    'slug' =&amp;gt; 'tagtest',&#xA;])-&amp;gt;first();&#xA;if ($tag) {&#xA;  $existingTags = $entry-&amp;gt;classifiedTags-&amp;gt;ids();&#xA;  $entry-&amp;gt;getContent()-&amp;gt;setAttribute('classifiedTags', array_merge($existingTags, [$tag-&amp;gt;id]));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if the tag doesn't already exist, you'll need to create it using the &lt;a href=&quot;https://craftcms.com/classreference/services/TagsService&quot;&gt;TagsService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tag-&amp;gt;groupId = 1;&#xA;$tag-&amp;gt;getContent()-&amp;gt;title = 'tagtest';&#xA;$success = craft()-&amp;gt;tags-&amp;gt;saveTag($tag);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-15T07:25:32.377" LastActivityDate="2016-07-15T07:25:32.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15932" PostTypeId="1" CreationDate="2016-07-15T08:06:13.887" Score="1" ViewCount="88" Body="&lt;p&gt;I have the following code in my header of a multilingual site. It produces the correct urls in english.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in menuentries %}&#xA;&#xA;    {% if entry.entryLink.first|length %}&#xA;        {% set navlink = entry.entryLink.first().uri %}&#xA;    {% elseif entry.customMenuUrl|length %}&#xA;        {% set navlink = entry.customMenuUrl %}&#xA;    {% endif %}&#xA;&#xA;    {% if entry.level == 1 and entry.children|length %}&#xA;        &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ siteUrl }}{{ navlink }}&quot; class=&quot;dropdown-toggle {{ macros.activeLinkClass(entry.uri, entry.level)|trim }} level{{ entry.level }}&quot; data-toggle=&quot;dropdown&quot; role=&quot;button&quot; data-hover=&quot;dropdown&quot; data-length=&quot;{{ entry.title|length }}aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&amp;gt;{{ entry.title }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;ul class=&quot;dropdown-menu&quot; &amp;gt;&#xA;                {% for child in entry.getDescendants() %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;a  href=&quot;{{ siteUrl }}{{ child.entryLink.first().uri  }}&quot; class=&quot;{{ macros.isActiveChildClass(child.slug) | trim }} level{{ child.level }}&quot;&amp;gt;{{ child.title }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% elseif entry.level == 1 and not entry.hasDescendants() %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ siteUrl }}{{ navlink }}&quot; class=&quot;{{ macros.activeLinkClass(entry.uri, entry.level) |trim }} level{{ entry.level }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when I switch languages eg. to french the &lt;code&gt;child.entryLink.first().uri&lt;/code&gt; returns null. Even if I just change the &lt;code&gt;en&lt;/code&gt; to &lt;code&gt;fr&lt;/code&gt; I get the same result. Bit confused.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorDisplayName="user1080" LastEditDate="2017-05-29T05:42:45.190" LastActivityDate="2017-05-29T05:42:45.190" Title="Dropdown template URI breaks on language switch" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15933" PostTypeId="1" AcceptedAnswerId="15939" CreationDate="2016-07-15T08:49:05.370" Score="1" ViewCount="327" Body="&lt;p&gt;So I’ve got fuzzy search activated and it works as it should... going to the right; but if I have a plural? Is there no way around this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search term: &quot;intaglio&quot; = 12 results … includes &quot;intaglio&quot; and &quot;intaglios”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search term: &quot;intaglios&quot; = 9 results … only includes “intaglios”&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-07-15T21:33:04.367" Title="Fuzzy Search and Plurals" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15934" PostTypeId="2" ParentId="15916" CreationDate="2016-07-15T09:29:59.953" Score="4" Body="&lt;p&gt;To override &lt;code&gt;field.html&lt;/code&gt; you will also have to provide an override for &lt;code&gt;tab.html&lt;/code&gt; and &lt;code&gt;errors.html&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;field.html&lt;/code&gt; template is a bit more complex and the Twig code to get it to work depends on a few other files to work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated the documentation to better reflect this requirement: &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow&quot;&gt;Template Overrides&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you only need to update the classes, you may also want to consider &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/rendering-options&quot; rel=&quot;nofollow&quot;&gt;Rendering Options&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rendering options would let you dynamically pass the class names to the underlying form code. Depending on how predictable your field names are, it could work like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    &quot;class&quot;: &quot;form-class form-class-customized&quot;,&#xA;    &quot;errorClass&quot;: &quot;form-has-error&quot;,&#xA;    &quot;fields&quot;: {&#xA;        &quot;fieldHandle&quot;: {&#xA;            &quot;class&quot;: &quot;my-fancy-class&quot;,&#xA;            &quot;errorClass&quot;: &quot;field-has-error&quot;,            }&#xA;    }&#xA;} %}&#xA;&#xA;{{ craft.sproutForms.displayForm(&quot;formHandle&quot;, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-07-18T13:07:11.620" LastActivityDate="2016-07-18T13:07:11.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15935" PostTypeId="1" AcceptedAnswerId="15936" CreationDate="2016-07-15T16:08:55.763" Score="2" ViewCount="2280" Body="&lt;p&gt;I am trying to view an entry, even if it disabled on the front end but having no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the _entry.html (which works perfectly for entries that are live), I have tried the following.  Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(entry.slug).status(null).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5403" LastEditorUserId="45" LastEditDate="2016-08-13T02:36:01.710" LastActivityDate="2018-07-23T16:41:42.287" Title="Display an entry page if entry is disabled" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15936" PostTypeId="2" ParentId="15935" CreationDate="2016-07-15T16:49:01.360" Score="9" Body="&lt;p&gt;Out of the box, Craft won't even load your &lt;code&gt;_entry.html&lt;/code&gt; file for a disabled entry – it'll just throw a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around that, you can create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;noreferrer&quot;&gt;dynamic route&lt;/a&gt; which matches the entry type URL format 1:1, and point that route to the same template (i.e. &lt;code&gt;_entry.html&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if your entry type's URL format is &lt;code&gt;news/{postDate.year}/{slug}&lt;/code&gt;, you'd create a dynamic route using the &quot;year&quot; and &quot;slug&quot; tokens (i.e. &lt;code&gt;news/(year)/(slug)&lt;/code&gt;). Then, Craft will automatically match your dynamic route whenever an entry URL &lt;em&gt;doesn't&lt;/em&gt; (e.g. when the entry is disabled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not home free yet, though – as you're probably aware, Craft automatically populates a template with an &lt;code&gt;entry&lt;/code&gt; variable whenever the current URL request matches an entry type's URL format, and an enabled entry is found at that URL. This won't be the case for any entries matched by your dynamic route, so put this at the top of your template (replacing the line in your question!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry ?? slug ? craft.entries.section('yourSectionHandle').slug(slug).status(null).first() %}&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does, is to test for the &lt;code&gt;entry&lt;/code&gt; variable Craft would set if the entry was enabled. If that evaluates to &lt;code&gt;false&lt;/code&gt;, then it checks to see if there's a &lt;code&gt;slug&lt;/code&gt; variable set – which there will be if the URL was matched by the dynamic route. If there is a slug, it'll then attempt to pull the entry using &lt;code&gt;craft.entries&lt;/code&gt;, similar to your initial code. Finally, if an entry is &lt;em&gt;not&lt;/em&gt; found, it'll throw a 404 error, as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template, you can easily test for the entry's status:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.enabled %}&#xA;    &amp;lt;p&amp;gt;Danger danger! I am disabled!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-23T16:41:42.287" LastActivityDate="2018-07-23T16:41:42.287" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15937" PostTypeId="1" CreationDate="2016-07-15T18:00:57.557" Score="2" ViewCount="1313" Body="&lt;p&gt;I am trying to create a plugin that takes the POST data from an order and emails it to the end user. Which property should I use to do this? I've already tried to use &lt;code&gt;getContent()&lt;/code&gt; and &lt;code&gt;getContentFromPost()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example if I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         &amp;lt;input type=&quot;text&quot; name=&quot;dataName&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my plugin I'm trying to get the value of &quot;dataName&quot; which property should I use?&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="45" LastEditDate="2016-08-13T02:46:26.950" LastActivityDate="2021-05-18T07:45:40.667" Title="Getting Information from POST data" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15938" PostTypeId="2" ParentId="15937" CreationDate="2016-07-15T18:06:25.947" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService&quot; rel=&quot;noreferrer&quot;&gt;HttpRequestService&lt;/a&gt;'s &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getPost-detail&quot; rel=&quot;noreferrer&quot;&gt;getPost&lt;/a&gt; is what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$value = craft()-&amp;gt;request-&amp;gt;getPost('dataName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-15T18:06:25.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15939" PostTypeId="2" ParentId="15933" CreationDate="2016-07-15T21:33:04.367" Score="4" Body="&lt;p&gt;With the current search implementation in Craft, if you have &lt;code&gt;subLeft&lt;/code&gt; and &lt;code&gt;subRight&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt; for the &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;defaultSearchTermOptions&lt;/a&gt; config setting and you search for &quot;intaglios&quot;, what Craft does behind the scenes is &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;search for&lt;/a&gt; &lt;code&gt;*intaglios*&lt;/code&gt;, which would never match &lt;code&gt;intaglio&lt;/code&gt; because the wildcard is after the last &lt;code&gt;s&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-15T21:33:04.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15940" PostTypeId="2" ParentId="8512" CreationDate="2016-07-15T22:38:30.130" Score="6" Body="&lt;p&gt;I'm not familiar with ACF, but if you're looking for blocks-within-blocks, you could use the &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;noreferrer&quot;&gt;Neo plugin/fieldType&lt;/a&gt;. It allows you to define blocks, and then have nested blocks. It allows for decent management of blocks, too, so that you have children of specific parents. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;You could have the following blocks/content types:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Copy&lt;/li&gt;&#xA;&lt;li&gt;Card&lt;/li&gt;&#xA;&lt;li&gt;Image slider&lt;/li&gt;&#xA;&lt;li&gt;Form&lt;/li&gt;&#xA;&lt;li&gt;Ad Unit&lt;/li&gt;&#xA;&lt;li&gt;Related Content&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And then the following layouts and components:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Two-column&lt;/li&gt;&#xA;&lt;li&gt;Three-column&lt;/li&gt;&#xA;&lt;li&gt;Single column w/ Sidebar&lt;/li&gt;&#xA;&lt;li&gt;Column&lt;/li&gt;&#xA;&lt;li&gt;Sidebar&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The Neo fieldType would allow you to make block groups, and then allow the content blocks to be limited to certain layout blocks. It would look like this (demo only, not fully configured):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;layouts&lt;/code&gt; are selectable at the top level. You need these to target template files (or at least it makes it easier, IMHO).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cpUdB.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cpUdB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The layouts can only have &lt;code&gt;columns&lt;/code&gt; or &lt;code&gt;sidebars&lt;/code&gt;. The two- and three-column only have columns, while the single has column and sidebar.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Currently blocks are only limited on the page level and not the block level, meaning if you set the max number of &lt;code&gt;columns&lt;/code&gt; to 1, you'll only be allowed one column per entry.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cE07N.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cE07N.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;column&lt;/code&gt; block has the main content types, while the &lt;code&gt;sidebar&lt;/code&gt; block has the sidebar content types.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Aincx.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aincx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3653" LastActivityDate="2016-07-15T22:38:30.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15941" PostTypeId="2" ParentId="6732" CreationDate="2016-07-15T22:43:44.160" Score="6" Body="&lt;p&gt;This question was asked prior to the release of the &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo plugin/field type&lt;/a&gt;. I think this would offer a better approach than the SuperTable (which was/is still awesome), just because I think it's easier to manage and template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I posted an answer to a similar question with examples &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8512/modelling-flexible-content-sections-and-reccomendations&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3653" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-15T22:43:44.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15942" PostTypeId="2" ParentId="14602" CreationDate="2016-07-15T23:56:02.450" Score="2" Body="&lt;p&gt;This appears to have been added in the &lt;a href=&quot;https://github.com/engram-design/SuperTable/releases/tag/0.4.7&quot; rel=&quot;nofollow&quot;&gt;0.4.7 release&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;View the original issue &lt;a href=&quot;https://github.com/engram-design/SuperTable/issues/66&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;em&gt;I have not personally verified this functionality.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2016-07-15T23:56:02.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15943" PostTypeId="2" ParentId="15930" CreationDate="2016-07-16T08:24:31.237" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Hard to say if they're the 'best' tool, but I don't see anything here you can't do with Craft categories and they seem the logical and built in way to go about it.  In essence you simply look at your url segments and use these as category filters when retrieving the products&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I think so.  It keeps the two separate data concerns nicely separated - but do be aware from a UI point of view, separate category groups are very separate things - you can't use one field to select from both groups (quite a surprise to me the first time I implemented this!)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I think you really only need one template here that simply inspects the url segments and builds the products query from whatever is there.  This part of the question reads a little as if you're confusing the presentation concerns and the data holding concerns (which is not criticism - it's very easy to do!) - your products will live as products over in Commerce, but your actual url routing and display of those at the category level (i.e. the product listing level) - can probably be handled by just one display template.  .  You don't need a 'channel' for these pages as such (they're not pages, rather filtered views).  So probably just a route that points, say, &lt;code&gt;/catalogue/*&lt;/code&gt; -&gt; to your one product listing template.  (The actual individual product pages (if they have significantly different displays) - can use multiple templates if need be (or again, conditional logic within the one template)).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;There's really no reason that you could not use a route to point say  &lt;code&gt;/products/new&lt;/code&gt; to the same template and again inspect the url to build your products query, showing only the newer products.  There's no need per se for a single here unless you want other content on the page or something.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While you described this on slack as a 'noob' question it's not, and it's good to think it through - in some ways this stuff is the hardest part to get your head around with Craft/Commerce.  Once you actually get to implementing it you'll find this bit was actually a lot harder than making it work (well, I did!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact you're using separate urls for everything probably makes it a lot easier than some approaches I think, so nothing in your message really strikes me as unachievable.  The point to understand is that you don't need a channel or section to hold all of these &lt;code&gt;pages&lt;/code&gt; - they aren't really pages as such, really they are all views on the same data (all, or some subsets thereof) - you simply have route(s) which point to a single template with logic that inspects the url and filters the products based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More than happy to chat this through more on Slack if that would help.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-07-27T05:11:11.640" LastActivityDate="2016-07-27T05:11:11.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15944" PostTypeId="2" ParentId="15932" CreationDate="2016-07-16T13:52:03.417" Score="2" Body="&lt;p&gt;UPDATE:&#xA;Mats you were right - I didnt have any data in the french menus or i had random custom url data. Once corrected the entry model came back whole. Phew&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-07-16T13:52:03.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15945" PostTypeId="1" CreationDate="2016-07-16T23:16:51.297" Score="1" ViewCount="111" Body="&lt;p&gt;I am trying to loop through an assets field called &lt;code&gt;gallery&lt;/code&gt; on entries in a commerce &lt;code&gt;products&lt;/code&gt; channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This field can have multiple images in it. I can get this to work on a channel listing page &lt;code&gt;domain.com/shop/&lt;/code&gt; but can't get this to work on the entry detail page &lt;code&gt;domain.com/shop/products/detail/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in product.gallery.first() %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5396" LastEditorUserId="340" LastEditDate="2016-07-18T01:13:49.150" LastActivityDate="2016-07-18T01:15:52.930" Title="Loop through assets field on detail/product page" Tags="&lt;assets&gt;&lt;plugin-craftcommerce&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15946" PostTypeId="1" AcceptedAnswerId="15947" CreationDate="2016-07-17T01:57:37.053" Score="2" ViewCount="2747" Body="&lt;p&gt;I have a plugin called EducatorEntriesPlugin, and in the controller of the plugin, I have a method called actionExportEducator. In this method, I am logging an error using the code below, but when the action is called, the error is not logged into the log file, why might this be?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::log(&quot;There was an error&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also did &lt;code&gt;EducatorEntriesPlugin::log&lt;/code&gt;, that doesn't do anything either.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="45" LastEditDate="2016-08-13T02:32:55.523" LastActivityDate="2016-09-26T19:44:03.323" Title="Craft Error Logging not doing anything?" Tags="&lt;logging&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15947" PostTypeId="2" ParentId="15946" CreationDate="2016-07-17T03:24:26.667" Score="7" Body="&lt;p&gt;Turn &lt;code&gt;devMode&lt;/code&gt; on &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot;&gt;https://craftcms.com/support/dev-mode&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the errors to log regardless of &lt;code&gt;devMode&lt;/code&gt; or not, pass in &lt;code&gt;true&lt;/code&gt; as the third parameter, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::log(&quot;There was an error&quot;, LogLevel::Info, true);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/articles/how-do-i-log-errors-warnings-and-info-in-my-plugins-to-a-craft-log-file&quot;&gt;https://straightupcraft.com/articles/how-do-i-log-errors-warnings-and-info-in-my-plugins-to-a-craft-log-file&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-07-17T03:24:26.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15948" PostTypeId="2" ParentId="12595" CreationDate="2016-07-17T06:07:17.370" Score="2" Body="&lt;p&gt;In March, I released a &lt;strong&gt;Digital Download&lt;/strong&gt; plugin which makes this process extremely simple...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ craft.digitalDownload.url(asset) }}&quot;&amp;gt;{{ asset.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;View the &lt;a href=&quot;https://craftpl.us/plugins/digital-download&quot; rel=&quot;nofollow&quot;&gt;complete documentation&lt;/a&gt; to read more about how it works.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-07-17T06:07:17.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15949" PostTypeId="1" CreationDate="2016-07-17T21:38:55.323" Score="1" ViewCount="418" Body="&lt;p&gt;I am building an event booking system for a restaurant using Charge 2.0. Everything is working great, but having problems implementing a feature that shows how many spots are left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An Event channel entry (created by the restaurant) provides parameters such as price, event name, etc and passes them to a Charge form. The Event entry also includes a field that specifies the maximum number of guests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Charge form includes a field for specifying a 'number of guests' for the booking. To indicate how many spots are left, we first need to calculate how many guests have already been booked, which is a simple matter of getting the 'numberOfGuests' field from all of the existing Charge entries and summing them. The problem arises when trying to filter the results using a Search parameter, which limits the entries to a specific event (the Event name is passed to the Charge description field). Here is a bit of the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set q = 'description:' ~ '&quot;' ~ entry.title ~ '&quot;' %}&#xA;{% for entry in craft.charge.charges().search(q) %}&#xA;   //get the number of guests&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried a few different things, including a wildcard search, and none of them return any results. Does anyone know if the Charge model supports a Search parameter?&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2016-07-19T12:06:46.857" Title="Booking system based on Charge 2.0" Tags="&lt;search&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15950" PostTypeId="2" ParentId="15945" CreationDate="2016-07-18T00:44:50.703" Score="3" Body="&lt;p&gt;&lt;code&gt;product.gallery&lt;/code&gt; returns an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which you can think of as a list of elements. &lt;code&gt;product.gallery.first()&lt;/code&gt; will return the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#first&quot; rel=&quot;nofollow&quot;&gt;first&lt;/a&gt; element in this list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is to loop over all the elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in product.gallery %}&#xA;  &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that this will work if there are no elements in the list (because the for loop will never be entered). One thing you should avoid doing is &lt;code&gt;product.gallery.first().url&lt;/code&gt;, because it is &lt;strong&gt;never&lt;/strong&gt; possible to be certain without checking that there &lt;em&gt;is&lt;/em&gt; a first element in the list.)&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="340" LastEditDate="2016-07-18T01:15:52.930" LastActivityDate="2016-07-18T01:15:52.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15951" PostTypeId="2" ParentId="15853" CreationDate="2016-07-18T09:58:54.423" Score="15" Body="&lt;p&gt;I haven't used Venti, so I can't comment on it. However, I have tried out both Calendars from Top Shelf Craft and Solspace Calendar on a recent project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out using Top Shelf Craft Calendars (Solspace Calendar hadn't been released at this point). However, during the project, I switched to Solpsace Calendar which has ended up being used on the final build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my view, Craft Calendars and Solspace Calendar have distinctly different approaches as to how they work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Top Shelf Craft Calendars&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://topshelfcraft.com/calendars&quot;&gt;Craft Calendars&lt;/a&gt;, any element (entries, users, assets, etc.) can be attached to a calendar event. If you want to store custom fields associated with an event, then you would store these on the element you are attaching to the calendar event, not on the event itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, you can think of Craft Calendars as creating a specialist fieldtype which enables you to schedule events, either on a one-off basis, or using sophisticated recurring rules. So to create an event, it must be associated with another element, since the event date is set using the &lt;a href=&quot;https://topshelfcraft.com/calendars/event-dates-fields&quot;&gt;Event Dates Fieldtype&lt;/a&gt; on the host element, rather than creating an event directly on a calendar element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Calendars doesn't currently have a nice GUI for the control panel and the front end output and styling are also left to you. This means that there is no native way to see an overview of the events that have been created. This may or may not be important to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solspace Calendar&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, with &lt;a href=&quot;https://solspace.com/craft/calendar&quot;&gt;Solspace Calendar&lt;/a&gt;, events belong to a calendar first and foremost. There is an &lt;a href=&quot;https://solspace.com/craft/calendar/docs/fieldtype/&quot;&gt;Events Fieldtype&lt;/a&gt; which can be used to relate another element (entries, users, assets, etc.) to a specific event using native Craft relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Events can also have their own custom fields. However, at the moment it is is not currently possible to search for Solspace Calendar events based on the contents of their custom fields. You can only search for events based on 'native' Solspace Calendar attributes, such as calendar name, start date, end date and author (&lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.events/&quot;&gt;see the docs for full details&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The control panel GUI for Solspace Calendar really shines and is very easy to use. It is based on &lt;a href=&quot;http://fullcalendar.io&quot;&gt;Full Calendar&lt;/a&gt;, a JavaScript event calendar JQuery plugin. Solspace provide sample front end templates using Full Calendar, so it is fairly quick and easy to get a similar system up and running on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Full Calendar interface, plus the ability to have events that weren't associated with existing elements, were the main factors in my choice of Solspace Calendar for the project I used it on. Though at the time I developed it, Solspace had not yet released their Full Calendar front end templates and there was little support for calling the event creation controllers from the front end, I was able to work through their code to see how they had achieved it in the control panel and create what I needed for the front end of my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it wasn't an easy choice between the two so I completely understand the motivation behind your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Comment on development and coding style&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have spent a lot of time looking through the code for both plugins and Solspace Calendar in particular. From a development and coding point of view (if that matters to you), Craft Calendars seems to me to follow Craft coding conventions more closely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solspace seem to have introduced extra levels of complexity and abstraction into Calendar that, in my opinion, for what it's worth, make it more complicated that it perhaps needed to be and lose some of the native behaviour you would get if they had used a more 'Crafty' approach. I have noticed this before with some of their EE add-ons. That said, they were very responsive to all the bug reports and questions I raised with them during the active development of the project.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-07-18T09:58:54.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15953" PostTypeId="1" AcceptedAnswerId="15955" CreationDate="2016-07-18T19:29:11.143" Score="4" ViewCount="264" Body="&lt;p&gt;I have a Product Type where every product has the same price. What are some good ways to avoid having to enter this same price for every product?&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-19T00:47:50.933" Title="Default price in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15954" PostTypeId="1" AcceptedAnswerId="15957" CreationDate="2016-07-18T22:05:42.010" Score="1" ViewCount="749" Body="&lt;p&gt;How can I get the number of a current entry in a structure? In other words, I'm getting the total number of entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set count = craft.entries.section('projects').total() %}&#xA;&amp;lt;h1&amp;gt;{{ count }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, I'd like to be able to output the number of the current entry in the hierarchy, i.e. something like 1/10. How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="4466" LastEditDate="2016-07-19T10:09:21.820" LastActivityDate="2016-07-19T16:54:46.503" Title="Get the current structure entry's order" Tags="&lt;templating&gt;&lt;count&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15955" PostTypeId="2" ParentId="15953" CreationDate="2016-07-19T00:47:50.933" Score="4" Body="&lt;p&gt;I don't think there is a way to do this from the back end data entry point of view currently - that is, right now, the price field is required, and indeed is required to be a number.  You can't use e.g. the value of another field in there (in which case you could have used e.g. a global or something to store a single record of the price elsewhere).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other solution would be to deal with it via a plugin - you could listen to &lt;code&gt;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&lt;/code&gt; and intercept this product, setting the price for the lineItem in there.  You could make a setting field in your plugin to store the actual price so there was a UI based way of changing it globally easily.  However, you'd still have to enter &lt;em&gt;some&lt;/em&gt; price in the product when entering the product, something token like 0.01 perhaps.  Not perfect from a UI point of view and easily  misunderstood by anyone coming new to the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, and it might we worth making a feature request to P &amp;amp; T for this - a price field that can parse twig and pulls values from elsewhere - this could certainly be &lt;em&gt;very&lt;/em&gt; handy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option would be to write a product importer and deal with the data entry that way - so that the price is set at the time of import of the data.  There's a gist that would get you started with here - &lt;a href=&quot;https://gist.github.com/lukeholder/bbff8caef82078fc76e4&quot;&gt;https://gist.github.com/lukeholder/bbff8caef82078fc76e4&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All said and done, though, this might be just one of those instances where you have to just deal with the data entry (at the moment) - it all depends of course whether the extra work/maintenance of an importer or plugin is worth doing (which all depends on how many products you're talking about and perhaps how often the price would change).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-07-19T00:47:50.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15956" PostTypeId="1" CreationDate="2016-07-19T09:19:34.647" Score="2" ViewCount="256" Body="&lt;p&gt;If you are running multiple domains on one craft install as suggested here &lt;a href=&quot;https://craftcms.com/support/sharing-craft-files&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/sharing-craft-files&lt;/a&gt;&#xA;What are the pro licence implications?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-07-19T17:33:38.197" Title="Multi site licences" Tags="&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15957" PostTypeId="2" ParentId="15954" CreationDate="2016-07-19T10:06:46.727" Score="2" Body="&lt;p&gt;If you're using a &lt;code&gt;for&lt;/code&gt; loop to output the entries you can make use of &lt;code&gt;loop.index&lt;/code&gt; which will give you the current iteration of the loop (starting from 1) and &lt;code&gt;loop.length&lt;/code&gt; which is the total number of items in the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('projects') %}&#xA;   {{ entry.title }} - {{ loop.index }} / {{ loop.length }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you're on a single entry you can use &lt;a href=&quot;https://craftcms.stackexchange.com/a/10546/4466&quot;&gt;this answer&lt;/a&gt; by Marion Newlevant.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-19T16:54:46.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15958" PostTypeId="2" ParentId="15949" CreationDate="2016-07-19T12:06:46.857" Score="3" Body="&lt;p&gt;Developer of &lt;a href=&quot;https://squarebit.co.uk/software/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes - Charge supports all the native Craft criteria search parameters for fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you mentioned, there are a few special fields that aren't supported currently within that. Those are fields like &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;notes&lt;/code&gt; etc.. The &lt;strong&gt;supported&lt;/strong&gt; direct attributes on the Charge model that can be searched (in addition to all the basic ElementType attributes) are : &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;userId&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sourceUrl&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;timestamp&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;hash&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;customerId&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;mode&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;meta&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is in addition to all Craft fields you might have attached to the charges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example - if I wanted to find all the charges based on a specific &lt;code&gt;customerId&lt;/code&gt; (the stripe identifier), it'd look something like this : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set charges = craft.charge.charges({ customerId : 'cus_00000000' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They can be of course be combined, so all charges for that customer only in live mode : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set charges = craft.charge.charges({ mode: 'live', customerId : 'cus_00000000' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If we had a field on the charge model with a name of &lt;code&gt;ourCustomField&lt;/code&gt;, we could search for that like : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set charges = craft.charge.charges({ search : { query : 'ourCustomField:' ~ someSearchValue }}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also, we could combine all those into a single thing too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set charges = craft.charge.charges(&#xA;   { mode: 'live', &#xA;     customerId : 'cus_00000000', &#xA;     search : { &#xA;        query : 'ourCustomField:' ~ someSearchValue &#xA;   }}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or in the alternative syntax, that could be: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set q = 'ourCustomField:' ~ someSearchValue %}&#xA;{% set charges = craft.charge.charges()&#xA;      .customerId('cus_00000000')&#xA;      .mode('live')&#xA;      .search(q) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-07-19T12:06:46.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15959" PostTypeId="1" AcceptedAnswerId="15966" CreationDate="2016-07-19T12:19:32.643" Score="0" ViewCount="1216" Body="&lt;p&gt;My Craft files are structured correctly, I have the Craft file level with the &lt;code&gt;public_html&lt;/code&gt; file on the server (which contains the &lt;code&gt;index.php&lt;/code&gt; file), within &lt;code&gt;index.php&lt;/code&gt; I have set my &lt;code&gt;$craftpath&lt;/code&gt; correctly to &lt;code&gt;$craftPath = '../craft';&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I go to my live url I get a Craft styled error of: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Service Unavailable&#xA;Our site is temporarily unavailable. Please try again later.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to reach my admin I get an error of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error error&#xA;Craft can’t connect to the database with the credentials in craft/config/db.php.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it helps, my general.php file looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true&#xA;    ),&#xA;&#xA;    // development&#xA;    'example.dev' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'devMode' =&amp;gt; true,&#xA;            'siteUrl'  =&amp;gt; 'http://example.dev/',&#xA;            'assetPath' =&amp;gt; 'http://example.dev/assets/'&#xA;        )&#xA;    ),&#xA;&#xA;    // production&#xA;    'example.com' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'devMode' =&amp;gt; false,&#xA;            'siteUrl'  =&amp;gt; 'http://example.com/',&#xA;            'assetPath' =&amp;gt; 'http://example.com/assets/'&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the db.php file is as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array (&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    'example.dev' =&amp;gt; array (&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'localdatabase',&#xA;    ),&#xA;    'example.com' =&amp;gt; array (&#xA;        'cooldownDuration' =&amp;gt; 0,&#xA;        'server' =&amp;gt; 'server',&#xA;        'user' =&amp;gt; 'user',&#xA;        'password' =&amp;gt; 'password',&#xA;        'database' =&amp;gt; 'database',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope you can help becuase I'm lossing my mind as to whats wrong, but I'm sure it's something minor that I'm overlooking.&lt;/p&gt;&#xA;" OwnerUserId="5390" LastEditorUserId="45" LastEditDate="2016-08-13T02:45:47.417" LastActivityDate="2016-08-13T02:45:47.417" Title="Craft can't connect to db.php on live server" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15961" PostTypeId="1" CreationDate="2016-07-19T12:44:34.423" Score="2" ViewCount="296" Body="&lt;p&gt;Is there way to a create an entry type that you can re-use on different sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially what I would like to do is define one entry type, such as a &quot;Product&quot; entry type, and add fields for a product. Then I'd assign this &quot;Product&quot; entry type to each section, as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would prevent me from having to create a &quot;Product&quot; entry type on every section and add the same fields to each one.&lt;/p&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="4466" LastEditDate="2016-07-19T13:39:04.947" LastActivityDate="2016-07-19T13:39:04.947" Title="Re-using entry types across multiple sections" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15962" PostTypeId="2" ParentId="15961" CreationDate="2016-07-19T13:35:42.760" Score="1" Body="&lt;p&gt;Entry Types are unique to their Sections. You can't have one Entry type shared between multiple Sections. You can however use Field Groups to set your Field Layouts for each Entry Type. This will remove the need to add each and every field individually to each Entry Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on &lt;a href=&quot;https://craftcms.com/docs/fields#field-layouts&quot; rel=&quot;nofollow&quot;&gt;Field Layouts&lt;/a&gt; can be found on the docs.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-19T13:35:42.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15963" PostTypeId="1" AcceptedAnswerId="15965" CreationDate="2016-07-19T13:48:12.383" Score="1" ViewCount="203" Body="&lt;p&gt;I have a Structure with my entries in. How can I hide the parent entries that contain children? I still want to show the parents children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I want all the below entries bar &quot;About&quot; and &quot;Services&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Home&#xA;- About&#xA;    - Sub&#xA;    - Sub&#xA;    - Sub&#xA;- Stuff&#xA;- Services&#xA;    - Sub&#xA;    - Sub&#xA;    - Sub&#xA;- Things &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, this is my code right now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set parameters for prev/next elements list #}&#xA;{% set params = craft.entries.section('pages') %}&#xA;&#xA;{# Get the prev/next elements #}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do I need to modify the params to remove the entries that are parents?&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="4466" LastEditDate="2016-07-19T14:25:40.523" LastActivityDate="2016-07-19T15:55:40.420" Title="Only fetch structure entries that are first level or sub level that don't have a parent" Tags="&lt;structure&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15965" PostTypeId="2" ParentId="15963" CreationDate="2016-07-19T14:41:54.227" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#hasDescendants&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;hasDescendants()&lt;/code&gt;&lt;/a&gt; method to filter out any parent entry with children. You have to use an ElementCriteriaModel with &lt;code&gt;.getPrev()&lt;/code&gt; and &lt;code&gt;.getNext()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section( 'pages' ) %}&#xA;{% set entryIds = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;  {% if not entry.hasDescendants() %}&#xA;    {% set entryIds = entryIds|merge( [entry.id] ) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set criteria = craft.entries.id( entryIds ) %}&#xA;&#xA;{% set prevEntry = entry.getPrev( criteria ) %}&#xA;{% set nextEntry = entry.getNext( criteria ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will also need to add logic to get the first and last entry is next or previous is null.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-07-19T15:55:40.420" LastActivityDate="2016-07-19T15:55:40.420" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15966" PostTypeId="2" ParentId="15959" CreationDate="2016-07-19T16:16:55.127" Score="5" Body="&lt;p&gt;The &lt;code&gt;cooldownDuration&lt;/code&gt; setting should go in your &lt;code&gt;general.php&lt;/code&gt; config file, not in your &lt;code&gt;db.php&lt;/code&gt; config file. On your server, is the db on a separate server or is it on the same server? If so, the value for server in example.com should be &lt;code&gt;localhost&lt;/code&gt; not &lt;code&gt;server&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-07-19T16:16:55.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15967" PostTypeId="1" AcceptedAnswerId="15969" CreationDate="2016-07-19T17:18:35.140" Score="1" ViewCount="1246" Body="&lt;p&gt;I'm building my first Craft site and need to set a variable if a field has an image and then use that variable elsewhere in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is part of a matrix and will repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have so far is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# extra image #}&#xA;{% set asset = block.extraImage.first() %}&#xA;{# set variable empty so it's avialble outside of conditional #}&#xA;{% set float = &quot;&quot; %}&#xA;&#xA;{% if asset %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;&quot; class=&quot;img-responsive pull-right&quot; /&amp;gt;&#xA;&#xA;    {% set float = yes %}           &#xA;{% endif %}&#xA;&#xA;&amp;lt;div class=&quot;{{ float }}&quot;&amp;gt; more code here &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code doesn't give me any template errors. But it also doesn't output the class as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full template code can be viewed &lt;a href=&quot;http://pastie.org/10912043&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="4466" LastEditDate="2016-07-19T17:41:58.123" LastActivityDate="2016-07-19T17:41:58.123" Title="Set a Variable inside a conditional" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;conditional&gt;&lt;variable&gt;&lt;logic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15968" PostTypeId="2" ParentId="15956" CreationDate="2016-07-19T17:33:38.197" Score="3" Body="&lt;p&gt;If the multiple sites are based on sub-domains (i.e. site1.site.com, site2.site.com), then a single &lt;code&gt;craft/config/license.key&lt;/code&gt; file will cover all of the sites with no issues.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-19T17:33:38.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15969" PostTypeId="2" ParentId="15967" CreationDate="2016-07-19T17:40:42.390" Score="3" Body="&lt;p&gt;You're trying to your &lt;code&gt;float&lt;/code&gt; variable using another variable at the moment that isn't defined. I expect you mean to set &lt;code&gt;float&lt;/code&gt; to the string value &quot;yes&quot; like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set float = &quot;yes&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use a conditional around your &lt;code&gt;class&lt;/code&gt; declaration so you don't end up with empty classes and it'd also remove the need to define &lt;code&gt;float&lt;/code&gt; as an empty value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div{% if float is defined %} class=&quot;{{ float }}&quot;{% endif %}&amp;gt; more code here &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-19T17:40:42.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15970" PostTypeId="2" ParentId="15156" CreationDate="2016-07-19T20:59:27.233" Score="1" Body="&lt;p&gt;If I'm reading this correctly, you need two loops: one to loop over the parent entries in the section and then a second to get the parent's children. That'll give you the control you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for parentArticle in craft.entries({ &#xA;           section: 'articles', type: 'videoArticle', limit: 6&#xA;        }).order('postDate asc') &#xA; %}&#xA;&#xA; {# do what you want with the parent, just a heading and description here #}&#xA;&#xA; &amp;lt;h2&amp;gt;{{parentArticle.title}}&amp;lt;/h2&amp;gt;&#xA;  {{parentArticle.topLevelDescription}}&#xA;&#xA; {# loop over the children underneath the parent sorted by most recent #}&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;  {% for childArticle in parentArticle.children.order('postDate asc') %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{childArticle.url}}&quot;&amp;gt;{{childArticle.title}}&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-07-19T20:59:27.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15971" PostTypeId="1" CreationDate="2016-07-19T22:03:59.753" Score="2" ViewCount="735" Body="&lt;p&gt;I've spent all of today trying to configure a server block that will let me install Craft 2.62797 on a Digital Ocean droplet running Ubuntu 14.04 with NGINX and PHP 7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After uploading the craft directory and a public directory with the index.php file, a visit to my site gets the&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;**Service Unavailable** Our site is temporarily unavailable. Please try again later.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I was using the server block recommended by Brad Bell in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft&quot;&gt;this post.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that setup uses 127.0.0.1:9000 for a socket, and none of the other sites on our droplet uses a TCP socket -- they all use this chunk for fastcgi&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;location ~ \.php$ {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;   }&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried dropping that in, no dice. Here's some of the debug info from the site's error log. I think this is where it all goes wrong:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2016/07/19 16:50:08 [debug] 4362#4362: *18 connect to unix:/var/run/php/php7.0-fpm.sock, fd:23 #20&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 connected&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http run request: &quot;/index.php?&quot;&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http upstream check client, write event:1, &quot;/index.php&quot;&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http upstream recv(): -1 (11: Resource temporarily unavailable)&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http upstream request: &quot;/index.php?&quot;&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http upstream dummy handler&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 post event 00007FB15402C770&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 post event 00007FB15403E780&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 delete posted event 00007FB15402C770&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http upstream request: &quot;/index.php?&quot;&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http fastcgi parser: 0&#xA;2016/07/19 16:50:08 [debug] 4362#4362: *18 http fastcgi header: &quot;Status: 503 Service Unavailable&quot;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I edited it for brevity, don't think I clipped out anything relevant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, I tried editing PHP's www.conf settings, to allow for listening on 127.0.0.1 and port 9000, as per &lt;a href=&quot;https://stackoverflow.com/questions/21524373/nginx-connect-failed-111-connection-refused-while-connecting-to-upstream&quot;&gt;this post&lt;/a&gt;. I knew this would break all the other sites, but I wanted to see if I could get it working -- still got a bad gateway error. (Possible that I hadn't restarted PHP after that change, though.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bizarre thing about all this is that I have a working Craft CMS install on this same droplet. I tried duplicating its server block, which was auto-generated by Laravel Forge, but that netted me the same error message &lt;em&gt;and&lt;/em&gt; didn't log anything to the error log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, that's about all I know -- I'm sure I'm leaving something out, but I'm a bit frayed by the debugging process. Would be grateful for any advice.&lt;/p&gt;&#xA;" OwnerUserId="5341" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-07-20T14:29:50.133" Title="503 Response on fresh install, FastCGI possible culprit" Tags="&lt;php&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15972" PostTypeId="2" ParentId="15156" CreationDate="2016-07-19T23:51:20.153" Score="3" Body="&lt;p&gt;This should do what you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set videos = craft.entries({&#xA;    section: 'articles',&#xA;    type: 'video',&#xA;    level: 2,&#xA;}) %}&#xA;&#xA;{% set articleIds = [] %}&#xA;{% for video in videos %}&#xA;    {% set article = video.getParent() %}&#xA;    {% set articleIds = articleIds|merge([article.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% set articles = craft.entries({&#xA;    id: articleIds,&#xA;    fixedOrder: true,&#xA;    limit: 6&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You go through all the videos and collect the IDs of the parent article entries. Once you have the IDs, make sure to set &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#fixedOrder&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fixedOrder&lt;/code&gt;&lt;/a&gt; in the final criteria model and the entries are retuned in the same order as the IDs in the &lt;code&gt;id&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getParent&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getParent&lt;/code&gt;&lt;/a&gt; function queries the database for each video in your section. You might want to consider caching that piece of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can also test if replacing the code in the for loop with the following performs better.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articleId = video.getAncestors(1).ids()[0] %}&#xA;{% set articleIds = articleIds|merge([articleId]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-19T23:51:20.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15973" PostTypeId="2" ParentId="5400" CreationDate="2016-07-20T00:56:29.190" Score="1" Body="&lt;p&gt;I'm doing a very similar thing. This is the approach I got to work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_base_template.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set default vars here ... this could also be put in an include file to share across different base templates #}&#xA;{% set title_default = title_default ? title_default : 'This is the default title' %}&#xA;{% set meta_desc_default = meta_desc_default ? meta_desc_default : 'This is the default meta description' %}&#xA;{% set meta_keywords_default = meta_keywords_default ? meta_keywords_default : 'These,are,the,default,meta,keywords' %}&#xA;&#xA;{# page_info is set from the CMS ... #}&#xA;&amp;lt;title&amp;gt;{{ page_info.page_title | default(title_default) ~ &quot; | #{company_name}&quot; }}&amp;lt;/title&amp;gt;&#xA;&#xA;&amp;lt;body&amp;gt;&#xA;{% block content %}&#xA;{% endblock content %}&#xA;{# etc. #}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;child_page.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_base_template.html&quot; %}&#xA;&#xA;{# only set the ones we need to override here #}&#xA;{% set title_default = 'This is the child page title.' %}&#xA;&#xA;{% block content %}&#xA;{# etc. #}&#xA;{% endblock content %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key, for me, was in using the conditionals when setting the default variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What appears to happen, for me, is that it processes the &lt;code&gt;set&lt;/code&gt; blocks in the child template first, and then the ones in the base template.  So without the conditionals, the defaults in the base template end up overriding the page-specific ones I set in the child page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conditionals allow me to only set the defaults if they're not already &quot;overridden&quot; in the child page (so to speak).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They could also be written in non-ternary form, which might make them easier to read, but take up more lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not title_default %}{% set title_default = 'This is the default title!!' %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if title_default is not defined %}{% set title_default = 'This is the default title!!' %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's more work than using, say, PHP, but it's better than repeating all that logic on every child page.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some point, one may question whether it's better to move something like this up to the PHP level (or whatever one is using), more on the level of the &quot;controller&quot; than the &quot;view&quot;.  But it still might make sense to do this on the view level.  And in some instances, maybe one doesn't have access further up the chain, before Perch gets called. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the record, I'm using Twig 1.14.0 with a home-grown CMS, without CraftCMS.&lt;/p&gt;&#xA;" OwnerUserId="5328" LastActivityDate="2016-07-20T00:56:29.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15974" PostTypeId="2" ParentId="5400" CreationDate="2016-07-20T02:41:09.023" Score="2" Body="&lt;p&gt;What you're trying to do is how I used to do it; for your specific case, I'd suggest trying out &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow&quot;&gt;SEOmatic&lt;/a&gt;, which will keep all of this out of your templates, but still give you the control you want.  It will also give you a ton of meta and functionality that you're missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in terms of solving the generalized case of how to do this via templates, some pretty good examples have already been given.  I'd also suggest looking into the Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/embed.html&quot; rel=&quot;nofollow&quot;&gt;Embed&lt;/a&gt; functionality as well.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-07-20T02:41:09.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15975" PostTypeId="2" ParentId="15971" CreationDate="2016-07-20T14:29:50.133" Score="2" Body="&lt;p&gt;Okay, my next stackexchange question will be &quot;Where is the dunce cap?&quot; because I could use one. My problem was not actually a problem, and Lindsey D was exactly right: I was just going to &lt;code&gt;mysite.com&lt;/code&gt;, not to &lt;code&gt;mysite.com/admin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I see now that that was clearly stated in the install instructions, a tab that I was referring to over the course of the whole afternoon!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Lindsey, my morning just opened up. And to the dev of posterity who finds his way to this question and answer: I know it hurts.&lt;/p&gt;&#xA;" OwnerUserId="5341" LastActivityDate="2016-07-20T14:29:50.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15977" PostTypeId="1" AcceptedAnswerId="15978" CreationDate="2016-07-20T15:44:55.853" Score="1" ViewCount="2687" Body="&lt;p&gt;Working on my first craft site and I'm setting up a thankyou template for after a form submission, but am getting an error when calling the contact entry (it's a single).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried several code variations with no luck. This is my current template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Contact Thank You template&#xA; # ---------------&#xA; #}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{# pass body id to layout template #}&#xA;{% set bodyId = 'contact' %}&#xA;&#xA;    {% set entries = craft.entries.section('contact').id(5).find() %}&#xA;    {% for entry in entries %}&#xA;&#xA;        {# Top Images/Slider Content Here #}&#xA;        {% block headImage %}&#xA;        {{ entry.title }}&#xA;&#xA;        {% endblock %}&#xA;&#xA;    {% endfor %}{# end contact entry for loop #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="16" LastEditDate="2016-07-20T15:54:46.010" LastActivityDate="2016-07-20T15:55:35.107" Title="Variable &quot;entry&quot; does not exist" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15978" PostTypeId="2" ParentId="15977" CreationDate="2016-07-20T15:55:35.107" Score="3" Body="&lt;p&gt;I'd simplify the entry like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set entry = craft.entries.id(5) %}&#xA;   {{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-07-20T15:55:35.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15980" PostTypeId="1" CreationDate="2016-07-20T21:40:10.223" Score="0" ViewCount="895" Body="&lt;p&gt;How can I set the criteria for an endpoint based on the current category view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;elementapi.php&lt;/code&gt; looks like this where I can pass the slug of a category url to force a return of entries from the slug name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;slug = &quot;albania&quot;;&#xA;$category = $criteria-&amp;gt;first();&#xA;&#xA;return [&#xA;                'endpoints' =&amp;gt; [&#xA;                    'directory.json' =&amp;gt; [&#xA;                        'elementType' =&amp;gt; 'Entry',&#xA;                        'criteria' =&amp;gt; [&#xA;                                'section' =&amp;gt; 'directory',&#xA;                                'limit' =&amp;gt; null,&#xA;                            ],&#xA;                        'paginate' =&amp;gt; false,&#xA;                        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                            return [&#xA;                                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                                'mapinfo' =&amp;gt; $entry-&amp;gt;mapaddress,&#xA;                                'url' =&amp;gt; $entry-&amp;gt;slug&#xA;                            ];&#xA;                        },&#xA;                    ],&#xA;                    'directory-category.json' =&amp;gt; [&#xA;                        'elementType' =&amp;gt; 'Entry',&#xA;                        'criteria' =&amp;gt; [&#xA;                            'section' =&amp;gt; 'directory',&#xA;                            'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;                            'limit' =&amp;gt; null,&#xA;                        ],&#xA;                        'paginate' =&amp;gt; false,&#xA;                        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                            return [&#xA;                                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                                'mapinfo' =&amp;gt; $entry-&amp;gt;mapaddress,&#xA;                                'url' =&amp;gt; $entry-&amp;gt;slug&#xA;                            ];&#xA;                        },&#xA;                    ],&#xA;                    'seafarers-directory/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;                        return [&#xA;                            'elementType' =&amp;gt; 'Entry',&#xA;                            'criteria' =&amp;gt; ['id' =&amp;gt; $entryId],&#xA;                            'first' =&amp;gt; true,&#xA;                            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                                return [&#xA;                                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                                    'body' =&amp;gt; $entry-&amp;gt;body,&#xA;                                    'mapinfo' =&amp;gt; $entry-&amp;gt;mapaddress&#xA;                                ];&#xA;                            },&#xA;                        ];&#xA;                    },&#xA;                ]&#xA;            ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried setting the criteria category slug name with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;getMatchedElement(); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it always returned nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can a dynamic category be set for the criteria from the existing url like the dynamic entry is?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-07-20T23:56:01.150" LastActivityDate="2016-07-21T21:19:21.000" Title="How to set dynamic criteria for endpoint with the Element API plugin?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15981" PostTypeId="1" CreationDate="2016-07-20T21:45:11.453" Score="0" ViewCount="38" Body="&lt;p&gt;Currently I have a light switch on some commerce items that make them private to users that are not logged in but they still show up when the user is logged out. Is there a way to do this? I'm continuing development for a webpage and I'm still new to craft so I am sort of lost&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="45" LastEditDate="2016-07-20T21:58:57.087" LastActivityDate="2016-07-20T22:19:53.640" Title="Creating private items" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15982" PostTypeId="2" ParentId="15981" CreationDate="2016-07-20T22:19:53.640" Score="4" Body="&lt;p&gt;Assuming &lt;code&gt;yourLightSwitchFieldHandle&lt;/code&gt; is labeled &quot;Hide From Logged Out Users&quot;, something like this should work.  Completely untested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# if the user is logged in OR they are not logged in but we don't want to hide the current product #}&#xA;&#xA;{% if currentUser OR (not currentUser and not yourProduct.yourLightSwitchFieldHandle) %}&#xA;        Show Product&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-20T22:19:53.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15984" PostTypeId="1" CreationDate="2016-07-21T09:48:07.113" Score="2" ViewCount="134" Body="&lt;p&gt;The project that I'm working on requires that I generate an EAN13 barcode for display on vouchers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to implement the following as a Craft Plugin: &lt;a href=&quot;https://github.com/rlt3/php-barcode&quot; rel=&quot;nofollow&quot;&gt;https://github.com/rlt3/php-barcode&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part that I am unclear about is how exactly to define my Model to return an image to the calling template. Do I even need a Model ? &lt;/p&gt;&#xA;" OwnerUserId="5416" LastEditorUserId="45" LastEditDate="2016-07-21T16:02:22.523" LastActivityDate="2016-11-06T17:38:27.350" Title="Generate EAN13 barcode" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15985" PostTypeId="1" AcceptedAnswerId="15986" CreationDate="2016-07-21T13:16:53.370" Score="1" ViewCount="106" Body="&lt;p&gt;So I am new to Craft and I am attempting a site build with Craft Commerce.&#xA;I currently have a channel for Testimonials. Within this I have a relatedProducts field to assign products to testimonials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to achieve is to pull out the specific related testimonials on each specific product page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code for my testimonials.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for testimonial in craft.entries.section('testimonials') %}&#xA;&amp;lt;blockquote class=&quot;testimonial // testimonial--large&quot;&amp;gt;&#xA;    {{ testimonial.body }}&#xA;    &amp;lt;cite&amp;gt;&#xA;        {{ testimonial.citation }}&#xA;        {% if testimonial.relatedProducts|length %}&#xA;        &amp;lt;span class=&quot;testimonial__product&quot;&amp;gt;&#xA;            {% for testimonial in testimonial.relatedProducts %}&#xA;                {{ testimonial.title }}&#xA;            {% endfor %}&#xA;        &amp;lt;/span&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/cite&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is anyone able to assist or offer some guidance on how I can achieve this?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="4466" LastEditDate="2016-07-21T15:04:02.973" LastActivityDate="2016-07-21T15:04:02.973" Title="Relating testimonials to Products" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15986" PostTypeId="2" ParentId="15985" CreationDate="2016-07-21T13:26:47.467" Score="3" Body="&lt;p&gt;It works the same way related entries, (and all other elements) work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So assuming you are on the products page, and have the &lt;code&gt;product&lt;/code&gt; variable this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedTestimonials = craft.entries.section('testimonials').relatedTo(product) %}&#xA;&#xA;{% for testimonial in relatedTestimonials %}&#xA;  {{ testimonial.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-21T13:26:47.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15987" PostTypeId="2" ParentId="15881" CreationDate="2016-07-21T13:36:49.890" Score="4" Body="&lt;p&gt;Guests do not have an address book so editing the address is not the right way to think about it. Logged in users can edit the addresses in their address book, but only one at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the guest user to change their addresses for the current cart, just use the data from the current cart addresses to populate the &quot;commerce/cart/updateCart&quot; form to submit 2 new addresses to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have further questions in the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To edit a completed order's addresses, see this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21079/craft-commerce-edit-complete-order-address-from-frontend/21155#21155&quot;&gt;Craft Commerce - Edit Complete Order Address from frontend&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-07-11T04:41:43.763" LastActivityDate="2017-07-11T04:41:43.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15988" PostTypeId="2" ParentId="15900" CreationDate="2016-07-21T13:40:38.090" Score="2" Body="&lt;p&gt;Looks like your redirect does not contain the full url back to your site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error shows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] &quot;POST /index.php/actions/commerce/payments/...&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would expect to see a url starting with &lt;code&gt;http://sitename.com/&lt;/code&gt; since your gateway needs the full url to redirect you back to your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you have a siteUrl set up in your craft settings: &lt;a href=&quot;https://craftcms.com/support/site-url&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/site-url&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-21T13:40:38.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15989" PostTypeId="2" ParentId="15752" CreationDate="2016-07-21T13:44:33.350" Score="1" Body="&lt;p&gt;Currently at Craft Commerce 1.1 this is not possible with the current discount engine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would need to implement features like a min qty &lt;em&gt;AND&lt;/em&gt; a max qty for the discount rules. It is on our radar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fee free to vote for extended discount conditions features here: &lt;a href=&quot;http://feedback.craftcms.com/forums/295386-commerce/filters/top&quot; rel=&quot;nofollow&quot;&gt;http://feedback.craftcms.com/forums/295386-commerce/filters/top&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-21T13:44:33.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15990" PostTypeId="1" AcceptedAnswerId="16010" CreationDate="2016-07-21T15:14:05.403" Score="2" ViewCount="583" Body="&lt;p&gt;I have a structure set up like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What we do (set as a structure)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;2nd level page A&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;* 3rd level page A&#xA;* 3rd level page A&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;2nd level page B&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;* 3rd level page B&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm setting up breadcrumbs for this so it's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home / What we do / 2nd level page A / 3rd level page A&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far but I can't figure out how to get the entry section url working (what-we-do) which is set in the Entry Url format.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set crumbs = entry.ancestors|default([]) %}&#xA;{% if crumbs|length %}&#xA;&amp;lt;ul class=&quot;breadcrumbs&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ NEED HELP }}&quot;&amp;gt; {{ entry.section.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% for crumb in crumbs %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ crumb.url }}&quot;&amp;gt;{{ crumb.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2016-07-22T11:09:45.573" Title="Get structure url" Tags="&lt;structure&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15991" PostTypeId="2" ParentId="14864" CreationDate="2016-07-21T15:56:10.893" Score="3" Body="&lt;p&gt;The text that is submitted using your &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; field will display as expected with &lt;code&gt;Your Reference: {{ cart.customerReference }}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have a feeling that because the page is re-rendered with the inputs &lt;code&gt;value&lt;/code&gt; as empty, when the &lt;code&gt;/updateCart&lt;/code&gt; action is submitted again the blank value will override and erase the old value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve this use the &lt;code&gt;customerReference&lt;/code&gt; stored on the cart in the &lt;code&gt;value&lt;/code&gt; attribute of your text &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input ... value=&quot;{{ cart.customerReference|length ?? cart.customerReference }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-21T15:56:10.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15994" PostTypeId="1" AcceptedAnswerId="15997" CreationDate="2016-07-21T19:10:59.390" Score="1" ViewCount="1139" Body="&lt;p&gt;By using &lt;code&gt;line total: {{ cart.lineItems|length }}&lt;/code&gt; it returns the number of 'products' in the current sessions cart. However, this doesn't seem to take into account the qty of each variant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I add 3 of variant A and 2 of variant B, the lineItems|length would equal 2. But I want to cart to show there are 5 items added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the total of all the items in the cart including qty of each variant?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-07-21T20:39:32.623" Title="Cart Items Total to include qty of variants" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15995" PostTypeId="1" AcceptedAnswerId="16017" CreationDate="2016-07-21T19:14:23.513" Score="5" ViewCount="682" Body="&lt;p&gt;I'm using a Matrix field for menu section blocks that each have a name, section and menu items. The menu items for that menu section are assigned using an Entries fieldtype that displays entries from food and beverage entries. Here's a screenshot of the field setup in case that helps explain it better:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bZSfo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bZSfo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is generate a menu endpoint that has the individual sections and within each section display the item data. The json response I'm looking for should be similar to this structure:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;&#xA;        &quot;menu&quot;: {&#xA;          &quot;id&quot;: 1,&#xA;          &quot;sections&quot;: [&#xA;            {&#xA;              &quot;id&quot;: 1,&#xA;              &quot;name&quot;: &quot;Heavy&quot;,&#xA;              &quot;description&quot;: &quot;All our heavy draft beers.&quot;,&#xA;              &quot;items&quot;: [&#xA;                {&#xA;                  &quot;id&quot;: 2,&#xA;                  &quot;name&quot;: &quot;Samuel Adams Utopias&quot;,&#xA;                },&#xA;                {&#xA;                  &quot;id&quot;: 3,&#xA;                  &quot;name&quot;: &quot;Samuel Adams Utopias&quot;,&#xA;                },&#xA;              ]&#xA;            },&#xA;            {&#xA;              &quot;id&quot;: 2,&#xA;              &quot;name&quot;: &quot;Light&quot;,&#xA;              &quot;description&quot;: &quot;All our light draft beers.&quot;,&#xA;              &quot;items&quot;: [&#xA;                {&#xA;                  &quot;id&quot;: 2,&#xA;                  &quot;name&quot;: &quot;Samuel Adams Utopias&quot;,&#xA;                },&#xA;                {&#xA;                  &quot;id&quot;: 3,&#xA;                  &quot;name&quot;: &quot;Samuel Adams Utopias&quot;,&#xA;                },&#xA;              ]&#xA;            },&#xA;          ]&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can accomplish the section structure just fine, but I can't get the data from the sectionItems field which is an Entries type. This is what I have minus the items call.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&#xA;        'api/v1/locations/&amp;lt;entryId:\d+&amp;gt;/menu.json' =&amp;gt; function($entryId) {&#xA;          return [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;              'id' =&amp;gt; $entryId,&#xA;              'type' =&amp;gt; 'location'&#xA;            ],&#xA;            'first' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;              foreach ($entry-&amp;gt;menu as $block) {&#xA;                $menuBlocks[] = [&#xA;                  'id' =&amp;gt; $block-&amp;gt;id,&#xA;                  'menu_id' =&amp;gt; $block-&amp;gt;fieldId,&#xA;                  'name' =&amp;gt; $block-&amp;gt;sectionName,&#xA;                  'description' =&amp;gt; $block-&amp;gt;sectionDescription,&#xA;                  'items' =&amp;gt; $block-&amp;gt;sectionItems,&#xA;                ];&#xA;              }&#xA;&#xA;              return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'menu' =&amp;gt; [&#xA;                  'sections' =&amp;gt; $menuBlocks&#xA;                ]&#xA;              ];&#xA;            },&#xA;          ];&#xA;        },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4963" LastEditorUserId="3951" LastEditDate="2019-04-04T17:04:00.240" LastActivityDate="2019-04-04T17:04:00.240" Title="Retrieve entry data from an Entries field in a Matrix Block" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15996" PostTypeId="2" ParentId="15994" CreationDate="2016-07-21T19:52:52.210" Score="1" Body="&lt;p&gt;After working on this for a while and the help of a fellow developer. The following solution seems to work. Unless anyone can improve on it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cartQty = 0 %}&#xA;{% for item in cart.lineItems %}&#xA;    {% set cartQty = cartQty + item.qty %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-07-21T19:52:52.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15997" PostTypeId="2" ParentId="15994" CreationDate="2016-07-21T20:39:32.623" Score="6" Body="&lt;p&gt;You can get the total quantity of items with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cart.totalQty&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Docs: &lt;a href=&quot;https://craftcommerce.com/docs/order-model#totalqty&quot; rel=&quot;noreferrer&quot;&gt;https://craftcommerce.com/docs/order-model#totalqty&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-21T20:39:32.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15998" PostTypeId="2" ParentId="15980" CreationDate="2016-07-21T21:19:21.000" Score="2" Body="&lt;p&gt;Finally figured this out.&#xA;By using the variable slug in the endpoint URL I was able to listen for the category in the currently viewed category slug and pull the data i needed for my google map. The trick is to typomake the end point a function - i was trying to set the criteria outside of the endpoint which is, in retrospect, silly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'locations/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;&#xA;                        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;                        $criteria-&amp;gt;slug = $slug;&#xA;                        $category = $criteria-&amp;gt;first();&#xA;                        return [&#xA;                            'elementType' =&amp;gt; 'Entry',&#xA;                            'criteria' =&amp;gt; [&#xA;                                'section' =&amp;gt; 'directory',&#xA;                                'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;                                'limit' =&amp;gt; null,&#xA;                            ],&#xA;                            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                                return [&#xA;                                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                                    'mapinfo' =&amp;gt; $entry-&amp;gt;mapaddress,&#xA;                                    'url' =&amp;gt; $entry-&amp;gt;slug&#xA;                                ];&#xA;                            },&#xA;                        ];&#xA;                    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-07-21T21:19:21.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15999" PostTypeId="1" CreationDate="2016-07-21T21:47:03.317" Score="0" ViewCount="242" Body="&lt;p&gt;I've moved my site to the staging server but now I'm getting a craft can't connect to the database with credentials in craft/config/db.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thing is I uploaded this script with the same credentials and it connects just fine. Any idea what I could be doing wrong&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;# Fill our vars and run on cli&#xA;# $ php -f db-connect-test.php&#xA;$dbname = 'name';&#xA;$dbuser = 'user';&#xA;$dbpass = 'pass';&#xA;$dbhost = 'localhost';&#xA;$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die(&quot;Unable to Connect to '$dbhost'&quot;);&#xA;mysql_select_db($dbname) or die(&quot;Could not open the db '$dbname'&quot;);&#xA;​&#xA;echo &quot;connected to the database&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My full db.php file with actual db creds removed - updated to include domain from live site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;​&#xA;/**&#xA; * Database Configuration&#xA; *&#xA; * All of your system's database configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA; */&#xA;​&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    'nec.dev' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'nec',&#xA;    ),&#xA;    'nec.dev.stagingdomain.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'staging-user',&#xA;        'password' =&amp;gt; 'staging-password',&#xA;        'database' =&amp;gt; 'staging-database',&#xA;    ),&#xA;    'nec-inc.com' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; '',&#xA;        'password' =&amp;gt; '',&#xA;        'database' =&amp;gt; '',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out why this doesn't work on staging when the same credentials work with the connection testing script.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2016-07-22T13:42:55.663" LastActivityDate="2016-07-22T15:08:15.570" Title="Staging Server Database Not Connecting" Tags="&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16000" PostTypeId="1" AcceptedAnswerId="16003" CreationDate="2016-07-21T22:14:16.487" Score="4" ViewCount="1258" Body="&lt;p&gt;What is the best method to organise products, and subsequently the order of these products within a group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have setup a product type of Canine. I can access each of these products via a URL of /canine/productslug/ but I am unable to change the order of these products when viewed at /commerce/products/.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shop will consist of two sections Canine and Equine. I don't think I need to have two product types as they contain the same structure/layout/format. So I can perhaps change the product type to general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, being new to Craft, I am unsure how I should be structuring these products? Presumably I need to create either categories or structures and then assign products to these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some searching but can't find anything to direct me over how I should be setting up the shop for product listings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer some direction, advise or pointers for this?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-07-22T00:11:01.910" Title="Ordering of products?" Tags="&lt;categories&gt;&lt;structure&gt;&lt;plugin-craftcommerce&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16002" PostTypeId="1" CreationDate="2016-07-21T23:59:04.710" Score="1" ViewCount="28" Body="&lt;p&gt;I have Structure type section and each of the entry contain at least 10 level 1 entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to preserve the structure of the entries while filtering/searching entries? What I mean by this is that, I want to search the parent entries only (Ignoring the level 1 &lt;em&gt;child&lt;/em&gt; entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MXa5B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXa5B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5111" LastActivityDate="2016-07-21T23:59:04.710" Title="Preserve Structure while searching for entries?" Tags="&lt;entries&gt;&lt;search&gt;&lt;sections&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16003" PostTypeId="2" ParentId="16000" CreationDate="2016-07-22T00:11:01.910" Score="6" Body="&lt;p&gt;Product &lt;em&gt;types&lt;/em&gt; are really all about data concerns - so if the data you're storing for your canines/equines (hereafter known as dogs and horses to save some typing ;) ) - is the same, then you're right you don't need more than one product type.  So let's say you make one type of product &lt;code&gt;Animal&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most obvious tool for grouping that Craft provides is categories.  You might make a category &lt;em&gt;group&lt;/em&gt; of &lt;code&gt;Animal Categories&lt;/code&gt;, and then two categories in that &lt;code&gt;Dogs&lt;/code&gt; and &lt;code&gt;Horses&lt;/code&gt;.  You then add a categories &lt;em&gt;field&lt;/em&gt; to your product type and select that category &lt;em&gt;group&lt;/em&gt; as the source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when entering each product, you just choose the appropriate category at that time (i.e. you don't so much assign product to a category from the category itself, rather the product is related to the category using the field on the product entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of then listing those on a listing (rather than individual) page, in the category settings, set your categories to resolve to e.g. &lt;code&gt;animals/{slug}&lt;/code&gt; (i.e. an actual url might be &lt;code&gt;animals/dogs&lt;/code&gt; and define a template for Craft to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When someone hits that url, your chosen template will be loaded, and this template will have an auto-populated variable of &lt;code&gt;category&lt;/code&gt; you can then use that to filter your products display&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.product.relatedTo(category) %}&#xA;{% for product in products %}&#xA;    etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's the basics of doing a listing  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sort orders, you can do it in any normal Craft way, such as by the title in alphabetic order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.product.relatedTo(category).order('title asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want an explicit order, you can do it at the template level by &lt;code&gt;id&lt;/code&gt;s and used &lt;code&gt;fixedOrder('true&lt;/code&gt;) and so on.  There is currently no GUI method of sorting products in Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It is fair to say though that it would be nice to have a native ability to create a default sort order for products in the back end, by e.g. drag and drop, which does not exist currently.  You can achieve this by using a Commerce Products field (which is really a relations field, just to products) - and simply manually sort all your product in that, and use that field to build your listings, but this is kind of frustrating to be honest - as where you then store that field?  We use a global set for this currently but it's not ideal). &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-07-22T00:11:01.910" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16004" PostTypeId="1" CreationDate="2016-07-22T02:10:52.193" Score="2" ViewCount="437" Body="&lt;p&gt;I am trying to update an asset index from a plugin but can't seem to get it to work.  Looking at the docs this seems to me like it should work but it does not. I am on the right path here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ses = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexingSessionId();&#xA;craft()-&amp;gt;assetIndexing-&amp;gt;processIndexForSource($ses, null, 7);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;7 is the id of the asset folder I want to re-index.&lt;/p&gt;&#xA;" OwnerUserId="518" LastEditorUserId="57" LastEditDate="2016-07-22T17:45:31.250" LastActivityDate="2016-07-23T13:24:57.543" Title="How do you programmatically update an asset index?" Tags="&lt;assets&gt;&lt;index&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16005" PostTypeId="1" CreationDate="2016-07-22T03:06:45.577" Score="0" ViewCount="110" Body="&lt;p&gt;This is related to the question previously asked and answered by OP. I tried to follow this method but couple of things that I don't understand (and of course can't solve the issue because of that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page where I fetch data based on a field (it is text field whose values are mm/yy and then I need to look for data that belong to certain categories but that is for round 2). I have drop downs, click on year, then click on the month and that would be the filter for entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1: How to do I call the code (even though I tried using this code &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15015/elementapi-can-i-use-javascript-ajax-to-load-json&quot;&gt;ElementAPI - Can I use javascript/ajax to load json&lt;/a&gt;). I have a button which is supposed to call news.json but nothing happen.&#xA;2: He is using _layout.html to put that ajax call. I have many pages where I need to fetch data with different parameters, so ideally I would like to have the ajax code in the template itself rather than _layout.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I really asking is for a working example that I can look at as I find it very confusing at this point. Like how would I debug/ look at the return values from news.json?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-22T13:42:11.813" Title="How to get started with ElementAPI &amp; Ajax" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16006" PostTypeId="1" CreationDate="2016-07-22T04:36:43.777" Score="1" ViewCount="465" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12870/approaching-google-amp&quot;&gt;This&lt;/a&gt; is a great post about how to integrate AMP into your Craft CMS website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens though if you have a standard 'img' tag in your existing content block? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought it would be neat to be able to set up a custom Craft/Twig AMP filter that automatically converts: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;/img/logo.svg&quot; alt=&quot;Logo&quot; width=&quot;150&quot; height=&quot;100&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;amp-img src=&quot;/img/logo.svg&quot; alt=&quot;Logo&quot; width=&quot;150&quot; height=&quot;100&quot;&amp;gt;&amp;lt;/amp-img&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %} {{ entry.body | amp }} {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something existing that I could modify to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any pointers!&lt;/p&gt;&#xA;" OwnerUserId="4893" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-08-02T05:58:37.943" Title="Google AMP Filter" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16007" PostTypeId="2" ParentId="16006" CreationDate="2016-07-22T05:04:47.580" Score="2" Body="&lt;p&gt;You could use the &lt;code&gt;replace&lt;/code&gt; filter, it accepts regex:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/filters#replace&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-07-22T05:04:47.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16010" PostTypeId="2" ParentId="15990" CreationDate="2016-07-22T11:09:45.573" Score="3" Body="&lt;p&gt;I think you've made this more complicated that it needs to be for yourself. Reading the Craft docs on &lt;a href=&quot;https://craftcms.com/support/breadcrumbs#outputting-the-entrys-ancestors-in-a-structure-section&quot; rel=&quot;nofollow&quot;&gt;Outputting the Entry’s Ancestors in a Structure Section&lt;/a&gt; it looks like you can use the handle &lt;code&gt;.getAncestors()&lt;/code&gt; method to output the entries leading up to the currently viewed entry automatically, and have access to their URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give the example a go.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level &amp;gt; 1 %}&#xA;  &amp;lt;ul class=&quot;crumbs&quot;&amp;gt;&#xA;    {% for crumb in entry.getAncestors() %}&#xA;      &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-07-22T11:09:45.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16011" PostTypeId="1" CreationDate="2016-07-22T11:22:12.207" Score="0" ViewCount="83" Body="&lt;p&gt;I'm displaying a Users field within a template within a CP plugin, but when editing the entry, only Users that are active are being shown. Here is my field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelect({&#xA;    id: 'schoolteacher',&#xA;    name: 'fields[schoolTeacher]',&#xA;    elementType: craft.elements.getElementType(&quot;User&quot;),&#xA;    elements: school.schoolTeacher | default,&#xA;    criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;},&#xA;    jsClass: 'Craft.AssetSelectInput',&#xA;    addButtonLabel: 'Select school teacher',&#xA;    sources: ['group:2']&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Viewing the exact same Users field within the standard CP entries section, all users are displayed irresepective of status. I think what I need to do is amend my field to allow usrs with the Pending status to be displayed. I've tried the following, but it makes no difference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;, &quot;status&quot;: &quot;active, pending&quot;},&#xA;criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;, &quot;status&quot;: &quot;Pending&quot;},&#xA;criteria: {&quot;kind&quot;:[],&quot;localeEnabled&quot;:null,&quot;locale&quot;:&quot;en_gb&quot;, &quot;status&quot;: null},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking through the app, I think status: null should return all of users of any status. Any ideas anyone?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-22T11:22:12.207" Title="Displaying Pending users within CP users field (in plugin template)" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16012" PostTypeId="2" ParentId="15853" CreationDate="2016-07-22T12:33:20.103" Score="0" Body="&lt;p&gt;I've recently required a Calendar which worked with Craft Commerce, as in a booking system. It was important to me that the Craft Commerce products could be used as dates for the Calendar, simply with me adding a field to the Product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solspace Calendar doesn't work like that, which I feel doesn't offer the flexibility you get elsewhere in Craft CMS. It also took them a few days to let me know that, when I'd have expected a simple request like that answered within 24 hours on a weekday. I'd used them a lot in my ExpressionEngine days, so would have let them off the slow repsonse but the plugin just wasn't right for what I was after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top Shelf Craft's Calendar sounded like exactly what I was after. I asked the developer whether it would work with Craft Commerce, got a yes, and bought it immediately. It uses a field-type which you add to your entries, rather than using its own entry type like the Solspace one. Unfortunately, I then found it didn't work with Craft Commerce (depsite being told it would) and found support slower than expected and not very thorough. A week later, to make sure I met the deadline I was working-to, I made the decision to not use it, despite having paid for it. I also felt small details like the font sizes in the field weren't as consistent with the CP as I'd have liked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish I'd seen Venti (has anyone used Venti?), as that looks similar to what I was after, though I haven't tested support nor do I know it works with Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, I used Boris Jerenec's Multi Date plugin and built my own calendar plugin on top of that. If Venti works with Craft Commerce (and works first time without further work needed) I'll probably try that with another similar project I've got coming up. I'd give Top Shelf Craft's plugin another go as well, but would need to see the support I received was the exception rather than the rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failing that I'll be sticking with the Multi Dates field and my own plugin.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-07-22T12:39:31.523" LastActivityDate="2016-07-22T12:39:31.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16013" PostTypeId="2" ParentId="16005" CreationDate="2016-07-22T13:42:11.813" Score="1" Body="&lt;p&gt;I don't think I quite understand, so I apologize in advance for what will be some revised answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;news.json&lt;/code&gt; doesn't really exist. Meaning, I don't have a physical file called &lt;code&gt;news.json&lt;/code&gt; in the filesystem anywhere. It is just an endpoint, and you'll want one for each of your calls. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;news.json&lt;/code&gt; or &lt;code&gt;blog.json&lt;/code&gt; or &lt;code&gt;events.json&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have many pages where I need to fetch data with different parameters&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's no problem. I would still keep your javascript in the &lt;code&gt;_layout&lt;/code&gt; template just to keep things clean. If you put js in each of your templates, you'll end up having chunks of js all over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can define different listeners for different things within a single &lt;code&gt;docReady&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function(){ &#xA;    $('news').click(function(){&#xA;        // Ajax for news&#xA;    });&#xA;&#xA;    $('events').click(function(){&#xA;        // Ajax for events&#xA;    });&#xA;&#xA;&#xA;    $('blog').click(function(){&#xA;        // Ajax for blog&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Like how would I debug/ look at the return values from news.json&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I use chrome for all development - so I'll right click anywhere and choose &quot;Inspect Element&quot;. I'll then click on the network tab. That way I can see the XHR requests. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you click the button, you can see the request being made, and the response that is returned. It will look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {&quot;data&quot;:[{&quot;title&quot;:&quot;We just installed Craft!&quot;,&quot;url&quot;:&quot;http:\/\/craftsandbox.dev\/news\/2016\/we-just-installed-craft&quot;,&quot;jsonUrl&quot;:&quot;http:\/\/craftsandbox.dev\/news\/3.json&quot;}],&quot;meta&quot;:{&quot;pagination&quot;:{&quot;total&quot;:1,&quot;count&quot;:1,&quot;per_page&quot;:100,&quot;current_page&quot;:1,&quot;total_pages&quot;:1,&quot;links&quot;:[]}}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you will parse through the response and handle it however you want. In the past I've used things like &lt;a href=&quot;https://github.com/janl/mustache.js&quot; rel=&quot;nofollow&quot;&gt;mustache&lt;/a&gt; to keep the templates as clean as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps a little? Let me know and I can revise the answer to help get you rolling. There is much about the ElementAPI I am unfamiliar with myself, but since you were referencing a thread I answered I thought I'd try and help.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-07-22T13:42:11.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16014" PostTypeId="1" AcceptedAnswerId="16019" CreationDate="2016-07-22T13:42:48.197" Score="0" ViewCount="640" Body="&lt;p&gt;I’ve got a task running called “GeneratePendingTransforms”, but it seems to stop/get stuck just over 65% of the way through and never completes. Is there anything that could cause this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve got Task Manager plugin (&lt;a href=&quot;https://github.com/boboldehampsink/taskmanager&quot; rel=&quot;nofollow&quot;&gt;https://github.com/boboldehampsink/taskmanager&lt;/a&gt; - Which is amazing) installed to see whats happening and tried restarting the task multiple times but it gets stuck at the same point every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets stuck on Step 121 of 205.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I could debug this?&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2016-07-22T14:42:24.517" Title="Stalled / Stuck Task (GeneratePendingTransforms)" Tags="&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2016-07-25T04:32:36.610" ContentLicense="CC BY-SA 3.0" />
  <row Id="16015" PostTypeId="1" AcceptedAnswerId="16027" CreationDate="2016-07-22T14:16:22.653" Score="4" ViewCount="252" Body="&lt;p&gt;What’s the best way to check if an order has been refunded in a template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you may want to: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a message to the order/invoice template if a refund has been successful.&lt;/li&gt;&#xA;&lt;li&gt;Determine the status of the refund; perhaps displaying a different message if the status is not yet &lt;code&gt;success&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Show the time of refund.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="374" LastEditorUserId="374" LastEditDate="2016-07-22T19:14:05.170" LastActivityDate="2016-07-23T01:51:20.103" Title="Check if an order has been refunded in a template?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16016" PostTypeId="1" CreationDate="2016-07-22T14:21:23.580" Score="1" ViewCount="1082" Body="&lt;p&gt;I have a large list of entries. Each entry has a a bunch of fields and a file-field with one or two files. Those files have related field (Author, Date, ..).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have now implemented a search. All things are working so far. However, the search does not include the asset's fields. Only the asset's title is recognized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I somehow search in asset fields? I tried something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field1: *query* AND files.author: *query*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this does not work :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that I can search all assets that are related to that section, but I would like to include this query in one query than in two queries..&lt;/p&gt;&#xA;" OwnerUserId="5424" LastEditorUserId="5424" LastEditDate="2016-08-24T22:08:49.420" LastActivityDate="2016-08-24T22:08:49.420" Title="Search entries AND within associated assets fields" Tags="&lt;assets&gt;&lt;field&gt;&lt;search&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16017" PostTypeId="2" ParentId="15995" CreationDate="2016-07-22T14:25:55.257" Score="3" Body="&lt;p&gt;You’re off to a great start here, in the way that you are first assembling the $menuBlocks array, and then finally returning the main array with the &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;menu&lt;/code&gt; keys. For the section items, you just need to take the exact same approach:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;  // Note: you should also make sure you define the $menuBlocks&#xA;  // array, to avoid a PHP error in case there are 0 blocks.&#xA;  $menuBlocks = [];&#xA;&#xA;  foreach ($entry-&amp;gt;menu as $block) {&#xA;    // Now start by defining an $items array:&#xA;    $items = [];&#xA;&#xA;    // And loop through your sectionItems field just like&#xA;    // you are doing with the menu field.&#xA;    // (Note - you can’t name the individual item entries &quot;$entry&quot;,&#xA;    // because that would override the other $entry variable.)&#xA;    foreach ($block-&amp;gt;sectionItems as $itemEntry) {&#xA;      $items[] = [&#xA;        'title' =&amp;gt; $itemEntry-&amp;gt;title,&#xA;        // ...&#xA;      ];&#xA;    }&#xA;&#xA;    $menuBlocks[] = [&#xA;      'id' =&amp;gt; $block-&amp;gt;id,&#xA;      'menu_id' =&amp;gt; $block-&amp;gt;fieldId,&#xA;      'name' =&amp;gt; $block-&amp;gt;sectionName,&#xA;      'description' =&amp;gt; $block-&amp;gt;sectionDescription,&#xA;&#xA;      // Now insert that whole $items array here:&#xA;      'items' =&amp;gt; $items,&#xA;    ];&#xA;  }&#xA;&#xA;  return [&#xA;    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;    'menu' =&amp;gt; [&#xA;      'sections' =&amp;gt; $menuBlocks&#xA;    ]&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-22T14:25:55.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16018" PostTypeId="1" AcceptedAnswerId="16022" CreationDate="2016-07-22T14:42:00.210" Score="1" ViewCount="302" Body="&lt;p&gt;I have tried to setup the following Macro to reuse code for product teasers across my site. The macros looks like this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro teaser(imgSize, className) %}&#xA;    &amp;lt;div class=&quot;product-teaser{% if className %} // {{ className }}{% endif %}&quot;&amp;gt;&#xA;        {% import '_macros/_img' as m_img %}&#xA;        {% set thumbAsset = product.productImage.first() %}&#xA;        &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;            {{ m_img.fixedSize(thumbAsset, imgSize, {alt: product.title, class: 'product-teaser__img' }) }}&#xA;        &amp;lt;/a&amp;gt;&#xA;        &amp;lt;h3 class=&quot;product-teaser__title{% if className %} // {{ className }}__title{% endif %}&quot;&amp;gt;{{ product.title }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p class=&quot;product-teaser__price{% if className %} // {{ className }}__price{% endif %}&quot;&amp;gt;{{ product.defaultPrice|currency(cart.currency) }}&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ product.url }}&quot; class=&quot;btn // btn--sub&quot;&amp;gt;View Product&amp;lt;/a&amp;gt;&#xA;            {# &amp;lt;a href=&quot;&quot; class=&quot;btn // btn--base&quot;&amp;gt;Canine Range&amp;lt;/a&amp;gt; #}&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and an example to call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(category)%}&#xA;{% for product in products %}&#xA;    {% import '_macros/_product' as product %}&#xA;    {{ product.teaser(300, &quot;product-teaser--in-list&quot;) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the error I get back is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;product&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any idea what I am doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: just to add a bit more feedback. The full error is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Vub44.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vub44.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2016-07-22T15:05:46.733" LastActivityDate="2016-07-22T15:16:56.760" Title="Help with Macros" Tags="&lt;macro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16019" PostTypeId="2" ParentId="16014" CreationDate="2016-07-22T14:42:24.517" Score="2" Body="&lt;p&gt;There is a support article about stuck tasks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case I would take a look at your logs, especially the phplog. &#xA;You find them at: yourdomain.com/cp-path/utils/logs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2016-07-22T14:42:24.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16020" PostTypeId="2" ParentId="16018" CreationDate="2016-07-22T14:48:16.480" Score="2" Body="&lt;p&gt;Yes! You have two things called &lt;code&gt;product&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for product in products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/_product' as product %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I would do is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/_product' as m_product %}&#xA;{{ m_product.teaser(300, &quot;product-teaser--in-list&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-22T14:48:16.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16021" PostTypeId="2" ParentId="15999" CreationDate="2016-07-22T15:08:15.570" Score="3" Body="&lt;p&gt;It looks as if you've sorted thing out (&lt;code&gt;dev.nec...&lt;/code&gt; vs &lt;code&gt;nec.dev...&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, I find the domain name matching in the config files to be confusing and error prone. I always follow the advice in the &lt;a href=&quot;http://craftcookbook.net/recipes/210&quot; rel=&quot;nofollow&quot;&gt;Foolproof Multi-Environment Config&lt;/a&gt; recipe. Put this at the top of your index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch (strtolower($_SERVER['SERVER_NAME'])) {&#xA;  case 'nec.dev':&#xA;    define('CRAFT_ENVIRONMENT', 'DEV');&#xA;    break;&#xA;  case 'nec.dev.stagingdomain.com':&#xA;    define('CRAFT_ENVIRONMENT', 'STAGE');&#xA;    break;&#xA;  case 'nec-inc.com':&#xA;    define('CRAFT_ENVIRONMENT', 'LIVE');&#xA;    break;&#xA;  default:&#xA;    exit('No environment defined for '.$_SERVER['SERVER_NAME']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your db.php and general.php will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(...),&#xA;  'DEV' =&amp;gt; array(...),&#xA;  'STAGE' =&amp;gt; array(...),&#xA;  'LIVE' =&amp;gt; array(...),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you hit &lt;code&gt;dev.nec.stagingdomain.com&lt;/code&gt; you will see that &lt;em&gt;No environment defined&lt;/em&gt; error and fairly quickly see what is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There is also an &lt;a href=&quot;http://craftcookbook.net/recipes/273&quot; rel=&quot;nofollow&quot;&gt;Enhanced Foolproof Multi-Environment Config&lt;/a&gt; recipe)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-22T15:08:15.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16022" PostTypeId="2" ParentId="16018" CreationDate="2016-07-22T15:16:56.760" Score="2" Body="&lt;p&gt;&lt;code&gt;product&lt;/code&gt; is not defined inside your macro. As the twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;macro&lt;/a&gt; documentation says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;as with PHP functions, macros don't have access to the current template variables.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you will need to pass this one in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro teaser(product, imgSize, className) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you call it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ m_product.teaser(product, 300, &quot;product-teaser--in-list&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would also add sensible defaults (if there are any that are sensible) for the macro arguments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro teaser(product, imgSize=300, className='product-teaser--in-list') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-22T15:16:56.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16024" PostTypeId="1" AcceptedAnswerId="16025" CreationDate="2016-07-22T19:46:38.640" Score="1" ViewCount="348" Body="&lt;p&gt;I have categories of cities and states set up as parents and children, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;California&#xA;  - Los Angeles&#xA;  - San Francisco&#xA;&#xA;New York&#xA;  - New York City&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for place in entry.location %}&#xA;  {{ place }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it returns to me the city state (for example: &quot;Los Angeles California&quot;). How can I separate out the parent and child? Ideally, I want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ place.child }}, {{ place.parent }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2016-07-22T20:14:11.350" Title="How to separate a parent and it's children when looping through a category?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16025" PostTypeId="2" ParentId="16024" CreationDate="2016-07-22T20:14:11.350" Score="4" Body="&lt;p&gt;If you have a 2-level category, and you select one of the nested categories (&lt;code&gt;Los Angeles&lt;/code&gt;), what you get in your entry is &lt;code&gt;Los Angeles&lt;/code&gt; &lt;strong&gt;and&lt;/strong&gt; its parent (&lt;code&gt;California&lt;/code&gt;). There is no way to have &lt;code&gt;Los Angeles&lt;/code&gt; without also &lt;code&gt;California&lt;/code&gt;, though you can have &lt;code&gt;California&lt;/code&gt; without &lt;code&gt;Los Angeles&lt;/code&gt;. Anyway, that for loop &lt;code&gt;{% for place in entry.location %}&lt;/code&gt; will loop over both of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to be more explicit about the cities and the states is to loop over just the cities using &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#level&quot; rel=&quot;nofollow&quot;&gt;level&lt;/a&gt; to fetch only the categories at a specific level in the category, and then for each city, fetch its ancestors with &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#ancestorOf&quot; rel=&quot;nofollow&quot;&gt;ancestorOf&lt;/a&gt;. Your code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for city in entry.location.level(2) %}&#xA;  {{city.title}},&#xA;  {% for state in craft.categories.ancestorOf(city) %}&#xA;    {{ state.title }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-22T20:14:11.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16027" PostTypeId="2" ParentId="16015" CreationDate="2016-07-23T01:51:20.103" Score="7" Body="&lt;p&gt;You get the related transactions for an order with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;order.transactions&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can loop over the transactions like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for transaction in order.transactions %}&#xA;  {{ transaction.type|title }}&#xA;  {{ transaction.status|title }}&#xA;  {{ transaction.amount|currency(transaction.currency) }} ({{ transaction.currency }})&#xA;  {{ transaction.paymentMethod.name }}&#xA;  {{ transaction.dateUpdated|date }} // could also format to get the time&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The transaction 'type' column can hold the following values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;authorize, capture, purchase, refund&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transaction 'status' column can hold the following values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pending, direct, success, failed&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of those transaction types have a 'parent' transaction, for example, if you authorized a credit card, you would have a authorize transaction. When you capture that authorization you get a capture transactions whose parent is the authorize transaction.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ transaction.type }} // could return 'refund'&#xA;{% set parent = transaction.parent %}&#xA;{{ parent.type }} // could return 'purchase' or 'capture'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have further questions and I will improve the answer.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-07-23T01:51:20.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16028" PostTypeId="2" ParentId="16004" CreationDate="2016-07-23T13:24:57.543" Score="3" Body="&lt;p&gt;This is what I ended up with which works great for me. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ses = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexingSessionId(); &#xA;$src = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexListForSource($ses, 7); &#xA;&#xA;for ($i = 1; $i &amp;lt;= $src['total']; $i++) { &#xA;    craft()-&amp;gt;assetIndexing-&amp;gt;processIndexForSource($ses, $i, 7); &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="518" LastActivityDate="2016-07-23T13:24:57.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16029" PostTypeId="1" AcceptedAnswerId="16030" CreationDate="2016-07-23T14:54:05.410" Score="12" ViewCount="1734" Body="&lt;p&gt;Is there any guidance or pitfalls/benefits of using one over another? I see that includes can be done more or less the same way a Macro can be done (certainly for simple variable changes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example being with a series of social sharing links.&#xA;So I currently have the following setup as an include like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;social-list&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;https://twitter.com//intent/tweet/?text={{ object.title }}&amp;amp;amp;url={{ craft.request.url|url_encode }}&amp;amp;amp;via={{ socialMedia.twitter }}&quot; target=&quot;_blank&quot; title=&quot;Share on Twitter&quot; class=&quot;js-social-share // track-social&quot; data-label=&quot;Shared&quot;&amp;gt;&#xA;            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-social  // icon-social--share // icon-twitter&quot;&amp;gt;&#xA;            &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#share-twitter&quot;&amp;gt;Twitter&amp;lt;/use&amp;gt;&#xA;            &amp;lt;/svg&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;https://www.facebook.com/sharer/sharer.php?u={{ craft.request.url|url_encode }}&quot; target=&quot;_blank&quot; title=&quot;Share on Facebook&quot;  class=&quot;js-social-share // track-social&quot; data-label=&quot;Shared&quot;&amp;gt;&#xA;            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-social  // icon-social--share // icon-facebook&quot;&amp;gt;&#xA;            &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#share-facebook&quot;&amp;gt;Facebook&amp;lt;/use&amp;gt;&#xA;            &amp;lt;/svg&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;https://plus.google.com/share?url={{ craft.request.url|url_encode }}&quot; target=&quot;_blank&quot; title=&quot;Share on Google Plus&quot; class=&quot;js-social-share // track-social&quot; data-label=&quot;Shared&quot;&amp;gt;&#xA;            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-social  // icon-social--share // icon-google-plus&quot; class=&quot;js-social-share // track-social&quot; data-label=&quot;Shared&quot;&amp;gt;&#xA;            &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#share-googleplus&quot;&amp;gt;Google Plus&amp;lt;/use&amp;gt;&#xA;            &amp;lt;/svg&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;mailto:?Subject={{ object.title }}&amp;amp;amp;Body=I%20saw%20this%20and%20thought%20it%20might%20be%20of%20interest! {{ craft.request.url|url_encode }}&quot; title=&quot;Share via Email&quot; class=&quot;track-social&quot; data-label=&quot;Shared&quot;&amp;gt;&#xA;            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-social  // icon-social--share // icon-share-email&quot;&amp;gt;&#xA;            &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#share-email&quot;&amp;gt;Email&amp;lt;/use&amp;gt;&#xA;            &amp;lt;/svg&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then calling the file like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/social-sharing' with { object : product } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the same could easily be achieved using a Macro. Something I have previously used for something else, where an include would have also worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a best case for when to use a Macro or an Include and what would be better in the above instance and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="125" LastEditDate="2016-07-23T16:18:22.237" LastActivityDate="2016-07-23T18:02:27.877" Title="Macros vs Includes" Tags="&lt;templating&gt;&lt;best-practice&gt;&lt;macro&gt;&lt;include&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16030" PostTypeId="2" ParentId="16029" CreationDate="2016-07-23T15:46:18.127" Score="19" Body="&lt;p&gt;Fabien Potencier, the main developer of the Twig templating language &lt;a href=&quot;https://github.com/twigphp/Twig/issues/1697&quot;&gt;answered the question&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Macros: reusable markup across a lot of templates&lt;/li&gt;&#xA;  &lt;li&gt;Includes: part of &quot;pages&quot; that are extracted for readability and reusability&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The reason for this, as far as I understand, is that you can only use the &lt;code&gt;include&lt;/code&gt; tag to render the complete file containing your partial. Whereas the &lt;code&gt;macro&lt;/code&gt; tag allows to render a partial from a file with multiple macros / partials in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, you are totally right in saying that both basically do the same thing. You can pass in variables, use them recursively, I do not know of a single thing one can do that the other can’t. Even performance shouldn’t be different really, at least within the context of Craft, as your Twig code gets compiled down to PHP and will then be cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I personally do is to use macros for all the small things, something simple like the following example. I wouldn’t want to create a separate file for every little helper that allows me to keep things DRY.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro icon(iconId) %}&#xA;    &amp;lt;svg class=&quot;icon icon-{{ iconId }}&quot; role=&quot;img&quot; title=&quot;{{ iconId }}&quot;&amp;gt;&#xA;        &amp;lt;use xlink:href=&quot;{{ url('assets/icons/icons.svg#icon-' ~ iconId) }}&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;    &amp;lt;/svg&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For larger chunks of code like a partial for a teaser card that I want to reuse throughout the site I’d definitly go with an &lt;code&gt;include&lt;/code&gt;. I really want to have one dedicated file for each of these partials, main reason here is that I wouldn’t want any unrelated code in that file as they usually contain quite a lot of code. Another reason might be the better discoverability in the file structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I could also setup files with only one macro in them instead. But then I’d end up with a bunch of &lt;code&gt;import&lt;/code&gt; tags to load the macro files. So in the end it’s probably only a matter of the more appropriate syntax for each situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My project usually end up with between 20 and 100 partials for &lt;code&gt;include&lt;/code&gt; tags, but I almost never have more than a single file for the macros.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-07-23T18:02:27.877" LastActivityDate="2016-07-23T18:02:27.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16031" PostTypeId="1" AcceptedAnswerId="16032" CreationDate="2016-07-23T16:02:26.910" Score="2" ViewCount="455" Body="&lt;p&gt;I am thinking about a possibility to let members subscribe to a blog entry, and then get notified in case of new comments related to the respective entry. The comments are stored as entries in a Craft CMS channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to use the &lt;a href=&quot;https://github.com/dukt/craft-like&quot; rel=&quot;nofollow&quot;&gt;Like for Craft CMS&lt;/a&gt; plugin for the subscription to a blog entry. In a second step I would try to use the &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster for Craft CMS&lt;/a&gt; plugin to notify the subscribers by email. I hope that this will be possible using the &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS/wiki/Developer-API&quot; rel=&quot;nofollow&quot;&gt;Postmaster Developer API&lt;/a&gt;, but I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is your opinion regarding my idea? Do you know perhaps an easier approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I very much appreciate your help, thanks!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-08-02T09:14:44.343" Title="How to subscribe to an entry and get notified by email in case of new comments?" Tags="&lt;emails&gt;&lt;comments&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16032" PostTypeId="2" ParentId="16031" CreationDate="2016-07-23T17:34:04.000" Score="3" Body="&lt;p&gt;I really like the idea of using a simple plugin like Like to keep track of what entries users are interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead of writing the code to integrate with Postmaster, I’d probably just use Craft’s API directly to send the mail after new entries are saved in your comments section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Like plugin and Craft API you need to look into:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;entries.onSaveEntry&lt;/code&gt; event&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/dukt/craft-like/blob/1.0.0/services/LikeService.php#L109&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getLikesByElementId()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmailByKey-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;sendEmailByKey()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-23T17:34:04.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16033" PostTypeId="1" AcceptedAnswerId="16034" CreationDate="2016-07-23T23:45:03.987" Score="5" ViewCount="130" Body="&lt;p&gt;In the general.php config file, I can target settings for multi-environments like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; false&#xA;  ),&#xA;&#xA;  '.loc' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to do something similar in the routes.php file too?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'test' =&amp;gt; 'index'&#xA;  ),&#xA;&#xA;  '.loc' =&amp;gt; array(&#xA;    'test' =&amp;gt; '_test/index'&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't want to differentiate the locales, but the environment instead. I know it's possible to query how content gets included within the templates themselves. I just wondered if this is possible instead... I don't actually have a use-case example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a time will arise where I want to allow certain content to be accessible for 'staging.' domains only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2016-07-24T09:00:15.190" Title="Is environmental routing possible?" Tags="&lt;routes&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16034" PostTypeId="2" ParentId="16033" CreationDate="2016-07-24T08:52:33.340" Score="6" Body="&lt;p&gt;The &lt;code&gt;routes.php&lt;/code&gt; config file doesn't support multi-environment setups in the manner that &lt;code&gt;general.php&lt;/code&gt; or &lt;code&gt;db.php&lt;/code&gt; does – in other words, your example code using a multidimensional array would throw an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you can write some PHP in your &lt;code&gt;routes.php&lt;/code&gt; file. For simple stuff, a ternary operator may suffice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'test' =&amp;gt; strpos(CRAFT_ENVIRONMENT, '.loc') !== false ? '_test/index' : 'index', &#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more complex stuff, you could set up different arrays of routes for different enviroments, and maybe do some merging:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$routes = array(&#xA;    'foo' =&amp;gt; '_foo',&#xA;    'bar' =&amp;gt; '_bar',&#xA;);&#xA;&#xA;$devRoutes = array(&#xA;    'baz' =&amp;gt; '_baz',&#xA;);&#xA;&#xA;$stagingRoutes = array(&#xA;    'baz' =&amp;gt; '_staging/baz',&#xA;);&#xA;&#xA;if (strpos(CRAFT_ENVIRONMENT, '.loc') !== false) {&#xA;    $routes = array_merge($routes, $devRoutes);&#xA;} else if (strpos(CRAFT_ENVIRONMENT, '.staging') !== false) {&#xA;    $routes = array_merge($routes, $stagingRoutes);&#xA;}&#xA;&#xA;return $routes;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're wondering about the &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-environment&quot;&gt;&lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;&lt;/a&gt; constant, that'll default to your hostname (e.g. &lt;code&gt;myawesomesite.loc&lt;/code&gt;) unless you explicitly set it to something else before bootstrapping Craft (e.g. in your &lt;code&gt;index.php&lt;/code&gt; file). The simple &lt;code&gt;strpos(CRAFT_ENVIRONMENT, $env)&lt;/code&gt; test is how Craft merges multi-enviroment configs (e.g. from &lt;code&gt;general.php&lt;/code&gt;) &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/ConfigService.php#L861&quot;&gt;under the hood&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-24T09:00:15.190" LastActivityDate="2016-07-24T09:00:15.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16037" PostTypeId="2" ParentId="15655" CreationDate="2016-07-25T06:56:03.263" Score="3" Body="&lt;p&gt;Here is one: &lt;a href=&quot;https://medium.com/good-dog/deploying-craft-cms-to-amazon-ec2-running-the-lemp-stack-using-mina-e2ad955138fa#.54s4y29co&quot; rel=&quot;nofollow&quot;&gt;https://medium.com/good-dog/deploying-craft-cms-to-amazon-ec2-running-the-lemp-stack-using-mina-e2ad955138fa#.54s4y29co&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I work for the company that published this.&lt;/p&gt;&#xA;" OwnerUserId="5434" LastActivityDate="2016-07-25T06:56:03.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16039" PostTypeId="1" CreationDate="2016-07-25T14:58:59.847" Score="1" ViewCount="91" Body="&lt;p&gt;Craft's Asset Fields allow you to restrict uploads to a single folder—and even pass through a variable to create a dynamic path. How may I restrict uploads to a single folder with variables like this within Craft's Rich Text Field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to collect images added within the Redactor-powered editor within folders that are unique to each entry within Craft.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2016-07-25T14:58:59.847" Title="How may I restrict uploads to a single folder with variables within a Rich Text Field?" Tags="&lt;assets&gt;&lt;redactor&gt;&lt;richtext&gt;&lt;variable&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16040" PostTypeId="1" AcceptedAnswerId="16041" CreationDate="2016-07-25T15:51:06.330" Score="1" ViewCount="156" Body="&lt;p&gt;I am trying to loop through a list of categories to add some text to the page. If it is the last item I want to replace the ',' with the words 'and' but only adda a ',' if there are more than 2 categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('products') %}&#xA;{% for category in categories %}&#xA;    {{ loop.last ? 'and ' }}{{ category.title }}{{ loop.index &amp;gt; 2 ? ', ' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if there is only category it would output:&lt;br&gt;&#xA;hello&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if there are two categories it would output:&lt;br&gt;&#xA;hello and world &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if there are 3 or more it would output:&lt;br&gt;&#xA;hello, world and space&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code looks like this. but isn't quite working correctly.&#xA;Anyone able to help? or point in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-07-25T16:22:49.507" Title="Target first and last items and append if greater than 2" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16041" PostTypeId="2" ParentId="16040" CreationDate="2016-07-25T16:22:49.507" Score="2" Body="&lt;p&gt;The way I would think of it is: I print the category title, then if this is not the last category I print the separator (&lt;code&gt;and&lt;/code&gt; or &lt;code&gt;,&lt;/code&gt;). I would use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;loop variable&lt;/a&gt; &lt;code&gt;revindex&lt;/code&gt; to distinguish the next-to-last category (which gets the &lt;code&gt;and&lt;/code&gt;) from the others (which get the &lt;code&gt;,&lt;/code&gt;). &lt;code&gt;loop.revindex&lt;/code&gt; is like &lt;code&gt;loop.index&lt;/code&gt; except that it counts the number of iterations from the end. So your code starts to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;  {{category.title}}&#xA;  {% if not loop.last %}&#xA;    {{ loop.revindex == 2 ? ' and' : ',' }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That code will leave a space before the &lt;code&gt;,&lt;/code&gt;, which you can fix by sticking everything on one line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;  {{category.title}}{% if not loop.last %}{{ loop.revindex == 2 ? ' and' : ',' }}{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-07-25T16:22:49.507" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16043" PostTypeId="1" CreationDate="2016-07-25T20:01:42.857" Score="1" ViewCount="228" Body="&lt;p&gt;IS there a way of getting redactor to accept text pasted from arabic in a right to left flow? Should this be solved with custom style for editor based on locale? (Am already doing RTL direction in front end based on locale)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2016-07-27T16:12:06.537" LastActivityDate="2016-07-27T16:12:25.100" Title="Pasting into redactor with Arabic" Tags="&lt;localization&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="16044" PostTypeId="1" AcceptedAnswerId="16049" CreationDate="2016-07-25T20:31:19.877" Score="1" ViewCount="1187" Body="&lt;p&gt;Really struggling with this (perhaps my brain is tired), but how would I get the image of a product for each entry in the cart screen in Craft Commerce? &lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-07-26T05:36:10.367" Title="Getting image for product in Cart Screen" Tags="&lt;plugin-craftcommerce&gt;&lt;image&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16045" PostTypeId="2" ParentId="16044" CreationDate="2016-07-25T22:05:21.760" Score="1" Body="&lt;p&gt;You'd access the product images just like you would any other &lt;a href=&quot;https://craftcms.com/docs/assets-fields#examples&quot; rel=&quot;nofollow&quot;&gt;Assets field&lt;/a&gt; in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you've already got the cart, and your Assets field is called &lt;code&gt;productImages&lt;/code&gt;, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in cart.lineItems %}&#xA;    &amp;lt;p&amp;gt;SKU: {{ item.sku }}&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for image in item.purchasable.product.productImages %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-07-25T23:13:32.413" LastActivityDate="2016-07-25T23:13:32.413" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16046" PostTypeId="2" ParentId="15984" CreationDate="2016-07-25T22:26:37.023" Score="1" Body="&lt;p&gt;For reference, I highly recommend reading the Craft plugin docs: &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can certainly use a &lt;a href=&quot;https://craftcms.com/docs/plugins/models&quot; rel=&quot;nofollow&quot;&gt;Model&lt;/a&gt;, but it depends on how you want to architect the rest of your plugin.  I like to think of a Model as a convenient way of transporting objects/data across the different layers of your plugin (&lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow&quot;&gt;Template Variables&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;Services&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers&lt;/a&gt;, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin currently will just generate the image and &lt;a href=&quot;https://github.com/rlt3/php-barcode/blob/master/ean.php#L167&quot; rel=&quot;nofollow&quot;&gt;output it directly to the browser&lt;/a&gt;, which may or may not be what you want from a template.  What you may want to do is take that image and save it to the file system (in a temporary or permanent public place) and have your Twig template reference that file directly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-25T22:26:37.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16047" PostTypeId="1" CreationDate="2016-07-25T23:06:50.897" Score="1" ViewCount="326" Body="&lt;p&gt;We have a localized site with separate public directories. I'm looking for a method to handle image uploads for the different asset paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when uploading an asset within a particular locale, the image will be deposited in that &lt;code&gt;public_*/uploads&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BhqFN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BhqFN.png&quot; alt=&quot;Asset Upload Locale&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought perhaps concatenating the &lt;code&gt;{craft.locale}&lt;/code&gt; in the asset path might work but it threw an error. I'm thinking that the locale doesn't change when selecting the language from the sidebar or asset dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qtDNA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qtDNA.png&quot; alt=&quot;AssetPaths&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty stuck on this one and there doesn't seem to be any answers online. Any other ideas or solutions would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3332" LastActivityDate="2016-07-25T23:29:13.667" Title="Change asset upload path based on locale" Tags="&lt;assets&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16048" PostTypeId="2" ParentId="16047" CreationDate="2016-07-25T23:29:13.667" Score="2" Body="&lt;p&gt;&lt;code&gt;{craft.locale}&lt;/code&gt; won't work because the single curly brace syntax is short for &lt;code&gt;{{object.craft.locale}}&lt;/code&gt; where &lt;code&gt;object&lt;/code&gt; is the element that is currently being edited (in your case, the entry).  You can read more about that here: &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your screenshot shows the double curly syntax, though (which should work fine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could use &lt;code&gt;{locale}&lt;/code&gt;, which would translate into &lt;code&gt;{{object.locale}}&lt;/code&gt;, which would be the currently locale of the entry.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-25T23:29:13.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16049" PostTypeId="2" ParentId="16044" CreationDate="2016-07-26T05:36:10.367" Score="4" Body="&lt;p&gt;This actually depends where the image is stored - if the asset (image) field is on the product, and is called &lt;code&gt;myImage&lt;/code&gt;, then as per Brad's example you'd use: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;lineitem.purchasable.product.myImage&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...BUT if it's in rather a field on the variant you would instead reference it as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;lineitem.purchasable.myImage&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is because lineitem refers to a variant....in the case of a product without variants it references the implicitly created &lt;code&gt;defaultVariant&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-07-26T05:36:10.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16050" PostTypeId="1" AcceptedAnswerId="16068" CreationDate="2016-07-26T09:18:30.810" Score="1" ViewCount="66" Body="&lt;p&gt;We are developing over multiple environments and production stages, and we would like to be able to track the SQL changes that happen when we make a change to entries etc. on the CP. The changes don't seem to be very easily transferable between productions e.g. Development and Staging through something like an mysql_delta. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible already? If not, what would the process be to record the SQL?&lt;/p&gt;&#xA;" OwnerUserId="4390" LastActivityDate="2016-07-27T15:29:49.500" Title="Tracking SQL queries from CP changes" Tags="&lt;control-panel&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16052" PostTypeId="1" AcceptedAnswerId="16056" CreationDate="2016-07-26T11:59:18.160" Score="3" ViewCount="883" Body="&lt;p&gt;I'm trying to return just one entry from Element API based on custom fields created?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'students.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; [&#xA;                    'studentNumber' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('studentNumber'),&#xA;                    'email' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('email'),&#xA;                    'section' =&amp;gt; 'students',&#xA;                ],&#xA;                'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'studentNumber' =&amp;gt; $entry-&amp;gt;studentNumber,&#xA;                    'email' =&amp;gt; $entry-&amp;gt;email,&#xA;                ];&#xA;            }&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Fields are &lt;code&gt;studentNumber&lt;/code&gt; and &lt;code&gt;email&lt;/code&gt; but it seems to be returning everything. Even when specifying &lt;code&gt;first =&amp;gt; true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody point me in the right direction on this? I'd imagine I'm missing something obvious?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even hitting the url &lt;code&gt;students.json?studentNumber=001&lt;/code&gt; is returning everything.&lt;/p&gt;&#xA;" OwnerUserId="5438" LastEditorUserId="5438" LastEditDate="2016-07-26T12:17:49.550" LastActivityDate="2016-07-26T14:12:16.360" Title="Query Entry Using multiple custom Fields Element API" Tags="&lt;entries&gt;&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16053" PostTypeId="1" AcceptedAnswerId="16072" CreationDate="2016-07-26T12:31:13.600" Score="1" ViewCount="1305" Body="&lt;p&gt;I am using a 3rd party service to run the image processing so I do not need full URL's for the images. I just need it to spit out the relative path name of the asset, not the absolute URL. I seem to be able to get either the &lt;code&gt;asset.folder&lt;/code&gt; or the &lt;code&gt;asset.filename&lt;/code&gt; but not both.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.homepageImage|length %}&#xA;{% set asset = entry.homepageImage.first() %}&#xA;  &amp;lt;img ix-path=&quot;{{ asset.filename }}&quot; alt=&quot;Test Image&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did try including the folder when setting the asset but that didn't work either, plus seems quite convoluted for something relatively simple.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.homepageImage.folderId(2).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="914" LastActivityDate="2016-07-27T00:10:08.700" Title="Get asset folder and filename together" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16054" PostTypeId="1" CreationDate="2016-07-26T13:38:01.263" Score="1" ViewCount="53" Body="&lt;p&gt;I'm having difficulty returning a category from inside a matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm returning a student based on a studentNumber variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set studentParams = {&#xA;    section : 'students',&#xA;    'studentNumber': studentNumber,&#xA;} %}&#xA;&#xA;{% set student = craft.entries(studentParams).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm then returning the fee associated with this student&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fee = student.studentFee[0] ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside this fee, I have a matrix block. Within that matrix block I have a field that is set using categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;    Looping through fee types to get the installment amounts for the course and various fee types.&#xA;    Currently not returning the FeeType title - Grant holder etc&#xA;#}&#xA;&#xA;{% for block in fee.fee %}&#xA;&#xA;    {% if block.firstInstallment is defined and block.firstInstallment is not null %}&#xA;        &amp;lt;h1&amp;gt;First Installment : {{ block.firstInstallment }} &amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if block.secondInstallment is defined and block.secondInstallment is not null %}&#xA;        &amp;lt;h1&amp;gt;Second Installment : {{ block.secondInstallment }} &amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if block.full is defined and block.full is not null %}&#xA;        &amp;lt;h1&amp;gt;Full :  {{ block.full }} &amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;hr /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am able to return everything inside the Matrix block aside from the category field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why this might be?&lt;/p&gt;&#xA;" OwnerUserId="5438" LastActivityDate="2016-07-26T13:38:01.263" Title="Return Category from Inside Matrix" Tags="&lt;templating&gt;&lt;entries&gt;&lt;matrix&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16055" PostTypeId="1" CreationDate="2016-07-26T13:54:57.933" Score="1" ViewCount="97" Body="&lt;p&gt;I have a list of year from a form field, not in consecutive order. (ES: 2008, 2010, 2012) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built an url in this way: &lt;code&gt;q=&amp;amp;year[]=2008&amp;amp;year[]=2010&lt;/code&gt; to get all the records of years 2008 and 2010.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the array from url, but was unable to build a query by year on the entries section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a way to query over multiple years?&lt;/p&gt;&#xA;" OwnerUserId="5439" LastEditorUserId="45" LastEditDate="2016-08-13T02:42:28.383" LastActivityDate="2016-08-13T02:42:28.383" Title="Query over multiple split years" Tags="&lt;querystring&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16056" PostTypeId="2" ParentId="16052" CreationDate="2016-07-26T14:12:16.360" Score="3" Body="&lt;p&gt;&lt;code&gt;getPost()&lt;/code&gt; will search the request’s POST data, but you are setting the parameter values as query string params, so you should be using &lt;code&gt;getQuery()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'studentNumber' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getQuery('studentNumber'),&#xA;'email' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getQuery('email'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-26T14:12:16.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16057" PostTypeId="1" AcceptedAnswerId="16071" CreationDate="2016-07-26T14:37:02.130" Score="0" ViewCount="73" Body="&lt;p&gt;I was just playing around with my payment methods. I deleted them. Then I tried to re-add them with the same names and settings but I couldn't. &quot;Name &quot;Manual&quot; has already been taken.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently they have been soft deleted? How do you reinstate a soft delete?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2016-07-26T23:34:33.070" Title="Craft Commerce: Soft Delete on Payment Methods?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16058" PostTypeId="1" AcceptedAnswerId="16065" CreationDate="2016-07-26T14:53:30.917" Score="2" ViewCount="1016" Body="&lt;p&gt;I have a matrix set up with some blocks in it, and one of those blocks is to add &quot;steps&quot; to a page in a matrix. Now I'm trying to get the number of the step so that they only have to enter the content of the &quot;steps&quot; block, and that it automatically numbers it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix has 2 block types: &quot;steps&quot; and &quot;image&quot;.&#xA;If I make 2 &quot;steps&quot; blocks and 1 &quot;image&quot; block in this order: step - image - step, index.loop numbers the first step as one, and the 2nd step as three since image is in between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have the &quot;steps&quot; numbered by position in the &quot;steps&quot; loop, and not in the full matrix?&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="125" LastEditDate="2016-07-26T16:57:55.787" LastActivityDate="2016-07-27T05:43:28.183" Title="Matrix: get the index number of a certain block" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16059" PostTypeId="1" CreationDate="2016-07-26T14:54:51.960" Score="1" ViewCount="712" Body="&lt;p&gt;I have followed the points set out in the Craft Docs relating to environmentVariables, making sure to include &lt;code&gt;'*' =&amp;gt; array()&lt;/code&gt; before other config arrays. Here is my &lt;code&gt;craft/config/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;return array(&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'defaultImageQuality' =&amp;gt; 49,&#xA;    ),&#xA;&#xA;    'dev.sitename' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'http://dev.sitename/',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/Users/adammenczykowski/Sites/Sitename/sitename/public/',&#xA;            'baseUrl' =&amp;gt; 'http://dev.sitename/',&#xA;        )&#xA;    ),&#xA;&#xA;    'sitename' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; false,&#xA;        'siteUrl' =&amp;gt; 'http://sitename.youi.design/',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/home/forge/sitename/public/',&#xA;            'baseUrl'  =&amp;gt; 'http://sitename/',&#xA;        )&#xA;    )&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Asset sources reference the basePath when configuring the &lt;code&gt;File System Path&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, the folder exists. I have been using &lt;code&gt;pwd&lt;/code&gt; and copying the result into the respective &lt;code&gt;general.php&lt;/code&gt; setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I try to update asset indexes, I get the popup: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The path of your source &quot;SVG&quot; appears to be invalid.`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any tips? Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running &lt;code&gt;Craft CMS 2.6.2797&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-07-27T13:51:45.847" LastActivityDate="2016-07-27T13:52:42.943" Title="Asset URL's invalid" Tags="&lt;assets&gt;&lt;url&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16060" PostTypeId="1" CreationDate="2016-07-26T15:16:34.220" Score="1" ViewCount="235" Body="&lt;ul&gt;&#xA;&lt;li&gt;I have &lt;code&gt;defaultCookieDomain&lt;/code&gt; set to &lt;code&gt;.site.com&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;I am logged into &lt;code&gt;www.site.com&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;I expected to also be logged into &lt;code&gt;sub.site.com&lt;/code&gt; (which is pointing to the same web root), but I'm not.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-07-28T11:58:35.440" Title="How do I preserve user sessions across subdomains?" Tags="&lt;session&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16062" PostTypeId="2" ParentId="16059" CreationDate="2016-07-26T15:38:16.830" Score="2" Body="&lt;p&gt;2 factors were at play here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The HTML-Cache plugin was clouding my development analysis by not showing me updated templated entries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I had set the local path wrong, it should have respected my Vagrant VM file structure, &lt;code&gt;/home/vagrant/Sites/Sitename/sitename/public&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Disabling the html cache plugin and repairing the &lt;code&gt;basePath&lt;/code&gt; environment variable did the trick.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-07-27T13:52:42.943" LastActivityDate="2016-07-27T13:52:42.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16063" PostTypeId="1" CreationDate="2016-07-26T16:00:06.570" Score="1" ViewCount="45" Body="&lt;p&gt;I'm specifically having this issue with Sprout SEO, but I would imagine the problem would persist across any plugin, given whatever solution is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anywho, so I've got three environments - dev, stage, and production (live site). I've reinstalled the plugin multiple times, and checked permissions several times as well. All environments are running Ubuntu, so I know that a case-sensitivity issue (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/5225/plugin-fieldtype-giving-error-on-live-server-fine-locally&quot;&gt;as seen here&lt;/a&gt;) isn't the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything database related that could be causing the problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if not that, our &lt;code&gt;.gitignore&lt;/code&gt; file just looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/storage/backups/&#xA;craft/storage&#xA;*.swp&#xA;public/uploads&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Wasn't sure if anything in storage needed to be not ignored for any plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5442" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-26T16:00:06.570" Title="The fieldtype class “insert fieldtype class here” could not be found" Tags="&lt;database&gt;&lt;fieldtypes&gt;&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16065" PostTypeId="2" ParentId="16058" CreationDate="2016-07-26T16:50:57.127" Score="7" Body="&lt;p&gt;You can use a custom counter instead of using the &lt;code&gt;loop.index&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set step = 0 %}&#xA;&#xA;{% for block in entry.matrixBlocks %}&#xA;    {% if block.type == 'stepBlockType' %}&#xA;&#xA;        {% set step = step + 1 %}&#xA;        Current step: {{ step }}&#xA;&#xA;    {% elseif block.type == 'otherBlockType' %}&#xA;&#xA;        {# Don't increase step count #}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-07-27T05:43:28.183" LastActivityDate="2016-07-27T05:43:28.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16067" PostTypeId="2" ParentId="4361" CreationDate="2016-07-26T18:08:34.837" Score="17" Body="&lt;p&gt;No need for a plugin, just use twig's &lt;code&gt;slice&lt;/code&gt; filter, combined with the &lt;code&gt;striptags&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've thrown in the &lt;code&gt;default&lt;/code&gt; filter for good measure, in case the body is empty for some reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|striptags|slice(0,100)|default('Read more') }}...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;slice&lt;/code&gt; will simply output the first 100 characters (starting at &lt;code&gt;0&lt;/code&gt; the first character), including spaces into the template. &lt;code&gt;striptags&lt;/code&gt; ensures that no html tags will be output.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="3991" LastEditDate="2016-07-28T08:49:06.307" LastActivityDate="2016-07-28T08:49:06.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16068" PostTypeId="2" ParentId="16050" CreationDate="2016-07-26T21:08:37.463" Score="3" Body="&lt;p&gt;Lots of smart people have tried to solve this problem and it's a tough one to solve, not just in Craft land but WP, and others. And because of Craft's flexible nature, a change in one table usually means many more updates from others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arguably the most reliable way I've seen it done is to use a &quot;top-down&quot; approach. Make the content changes in the production data first, then pull them down to staging/dev since production is essentially the &quot;canonical&quot; version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to make a new field or whatever to keep things current, add it on both sides. Then do your logic part—anything that could cause something to break the front end—on staging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you write your own logic for plugins, look into migrations; Craft can handle schema changes pretty well from an old schema to a new one if you write them properly. If you find your developers are doing this a lot, you may need to revisit your content strategy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping the content in sync is one thing; doing dev work on a rapidly changing schema is tough no matter how you keep things in sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some tools to help with this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/auditlog&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audit Log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/itmundi/schematic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schematic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/engram-design/FieldManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Field Manager&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/10/1016&quot;&gt;This thread&lt;/a&gt; has more details on different environments; here's another that talks about some &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1654/exporting-importing-fields&quot;&gt;tools&lt;/a&gt; I just linked up above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be awesome for P&amp;amp;T to pull a rabbit out of their hat and have some sort of sync across environments as a first party solution, like they did with Commerce. If you want to see something like that, &lt;a href=&quot;http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/7202893-database-sync-across-multiple-environments&quot; rel=&quot;nofollow noreferrer&quot;&gt;vote for it&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-27T15:29:49.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16069" PostTypeId="1" AcceptedAnswerId="16070" CreationDate="2016-07-26T22:46:38.743" Score="2" ViewCount="598" Body="&lt;p&gt;It appears that getting a entry that is a single is more tricky that it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('footer').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not work,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('footer').limit(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not work,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('footer')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does any one know of any documentation that lays out the usage of when to use limit, nothing, and first()? Seems very confusing. &lt;/p&gt;&#xA;" OwnerUserId="4480" LastActivityDate="2016-07-26T23:10:43.827" Title="Getting a Single" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16070" PostTypeId="2" ParentId="16069" CreationDate="2016-07-26T23:10:43.827" Score="8" Body="&lt;p&gt;&lt;strong&gt;The first example you showed is the exact right way to do it.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second &amp;amp; third examples you showed will technically work, but return an array of entries. Your single would be the only entry inside that array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your second &amp;amp; third examples, you're dealing with an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot;&gt;ElementCriteriaModel&lt;/a&gt;. You can append several methods to an ECM to generate results from it...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;first()&lt;/code&gt; - Returns an individual Entry (in this case your Single)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;find()&lt;/code&gt; - Returns an array of matching entries&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ids()&lt;/code&gt; - Returns an array of entry IDs&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;total()&lt;/code&gt; - Returns a number (total matches)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;last()&lt;/code&gt; - Opposite of &lt;code&gt;first()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nth()&lt;/code&gt; - Returns an individual Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Important to note...&lt;/strong&gt; If you don't specify one of these methods, then &lt;code&gt;find()&lt;/code&gt; will be automatically applied when it's used as an array.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-07-26T23:10:43.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16071" PostTypeId="2" ParentId="16057" CreationDate="2016-07-26T23:34:33.070" Score="3" Body="&lt;p&gt;Commerce soft deletes payment methods instead of hard deletes them because even if a payment method is no longer in use, you still need to be able to have a reference to them for existing orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can &quot;un-delete&quot; the payment method by going into the &lt;code&gt;craft_commerce_paymentmethods&lt;/code&gt; table in the database and changing the &lt;code&gt;isArchived&lt;/code&gt; column from &lt;code&gt;1&lt;/code&gt; back to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-26T23:34:33.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16072" PostTypeId="2" ParentId="16053" CreationDate="2016-07-27T00:10:08.700" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModel&lt;/a&gt;'s &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel#getPath-detail&quot; rel=&quot;nofollow&quot;&gt;getPath&lt;/a&gt; should do what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img ix-path=&quot;{{ asset.getPath() }}&quot; alt=&quot;Test Image&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-27T00:10:08.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16073" PostTypeId="1" AcceptedAnswerId="16075" CreationDate="2016-07-27T03:23:36.027" Score="4" ViewCount="1223" Body="&lt;p&gt;I am trying to export data from a database to a csv file, I am using the code below to retrieve the data from the DB, but it only returns 100 rows, how can I fix that?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'educators';&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$query-&amp;gt;order('title asc');&#xA;$queryResults = $query-&amp;gt;queryAll();&#xA;$educators = EntryModel::populateModels($queryResults);&#xA;&#xA;foreach ($educators as $educator) {&#xA;   //Write to file&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastActivityDate="2016-07-27T06:31:59.620" Title="Query only returning 100 records at a time?" Tags="&lt;database&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16074" PostTypeId="2" ParentId="16073" CreationDate="2016-07-27T03:49:28.360" Score="5" Body="&lt;p&gt;By default, Craft sets a limit of 100. Set it to null: &lt;code&gt;limit(null)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5447" LastActivityDate="2016-07-27T03:49:28.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16075" PostTypeId="2" ParentId="16073" CreationDate="2016-07-27T03:50:04.143" Score="10" Body="&lt;p&gt;Craft imposes a default limit of 100 for element queries. To disable this you need to specify a limit of &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;limit = null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3811" LastEditorUserId="3811" LastEditDate="2016-07-27T06:31:59.620" LastActivityDate="2016-07-27T06:31:59.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16076" PostTypeId="1" CreationDate="2016-07-27T09:11:57.707" Score="1" ViewCount="894" Body="&lt;p&gt;I'm just wondering when it comes to Element API is there a way of returning a type of Category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm returning all the other information fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tLTPx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tLTPx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fees.json' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'title' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getQuery('title'),&#xA;            'section' =&amp;gt; 'fees',&#xA;        ],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            foreach ($entry-&amp;gt;fee as $block) {&#xA;                $matrixSections[] = [&#xA;                    'first' =&amp;gt; $block-&amp;gt;firstInstallment,&#xA;                    'second' =&amp;gt; $block-&amp;gt;secondInstallment,&#xA;                    'full' =&amp;gt; $block-&amp;gt;full,&#xA;                    'grant' =&amp;gt; $block-&amp;gt;feeCategory&#xA;                ];&#xA;            }&#xA;        return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'menu' =&amp;gt; [&#xA;                'sections' =&amp;gt; $matrixSections&#xA;            ]&#xA;        ];&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KGhTx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KGhTx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5438" LastEditorUserId="5438" LastEditDate="2016-07-27T22:14:07.850" LastActivityDate="2016-07-28T10:09:57.497" Title="Element API return a type of Category" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;categories&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16077" PostTypeId="1" AcceptedAnswerId="23983" CreationDate="2016-07-27T09:55:02.643" Score="3" ViewCount="623" Body="&lt;p&gt;I'm looping through products (&lt;code&gt;$rawProduct&lt;/code&gt;) within Craft Commerce, within a plugin, and returning products which fulfill a certain criteria. I'm then returning a &lt;code&gt;$products&lt;/code&gt; array of objects with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product = new \stdClass;&#xA;$product-&amp;gt;url = $rawProduct-&amp;gt;url;&#xA;$product-&amp;gt;courseTitle = $rawProduct-&amp;gt;relatedFieldTitle[0]['title'];&#xA;$product-&amp;gt;courseUrl = $rawProduct-&amp;gt;relatedFieldTitle[0]['url'];&#xA;array_push($products, $product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working great. However, when the target entry of the related field is disabled, lines three and four above are returning empty. I'd like to get this information no matter whether the target entry is disabled. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-07-28T10:46:05.813" LastActivityDate="2018-02-24T22:20:26.530" Title="Get disabled related entry's data within plugin" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16078" PostTypeId="1" CreationDate="2016-07-27T10:05:39.360" Score="2" ViewCount="552" Body="&lt;p&gt;I'm going wrong here somewhere, but I have a (edit) entry form and I'd like a 'disable' field to change status. The edit form works fine but status changes are ignored. Here's my field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;enabled&quot; id=&quot;enabled&quot; value=&quot;{{ entry.enabled }}&quot;{{ entry.enabled == '1' ? ' checked' }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? Thanks guys.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2016-07-27T10:16:55.553" Title="Change entry status on front end" Tags="&lt;form&gt;&lt;entry&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16079" PostTypeId="2" ParentId="16078" CreationDate="2016-07-27T10:16:55.553" Score="4" Body="&lt;p&gt;You need to include a hidden field with the value of &lt;code&gt;0&lt;/code&gt; before the checkbox to ensure that the value is included in the form data if the checkbox is unchecked. See the docs on &lt;a href=&quot;https://craftcms.com/docs/checkboxes-fields#templating&quot; rel=&quot;nofollow&quot;&gt;templating for checkbox fields&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'll need to have this in your form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;enabled&quot; id=&quot;enabled&quot; value=&quot;1&quot;{{ entry.enabled == '1' ? ' checked' }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the checkbox is checked, the value of &lt;code&gt;1&lt;/code&gt; for &lt;code&gt;enabled&lt;/code&gt; will override the value of the earlier hidden field.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-07-27T10:16:55.553" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16080" PostTypeId="2" ParentId="16077" CreationDate="2016-07-27T10:22:31.037" Score="1" Body="&lt;p&gt;Related fields will always ignore disabled entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of disabling entries, you could add a lightswitch field to your entries to indicate whether or not they are disabled. This would preserve relations to those entries and would return all entries, regardless of the value of the lightswitch field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When fetching entries in other circumstances, if you only wanted to show enabled entries, you would need to always need to explicitly include a condition that the lightswitch was on (&lt;code&gt;=='1'&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-07-27T10:22:31.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16081" PostTypeId="1" CreationDate="2016-07-27T13:25:20.900" Score="1" ViewCount="1328" Body="&lt;p&gt;I could've sworn I've read somewhere on here that the contact form plugin should use the same template as defined in the site's email settings, but it's not working for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if the Contact Form plugin supports this (and has it working)?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2019-04-02T09:37:04.303" Title="Choose custom email template for Contact Form plugin" Tags="&lt;templating&gt;&lt;plugin-contactform&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16082" PostTypeId="1" CreationDate="2016-07-27T13:55:41.497" Score="3" ViewCount="770" Body="&lt;p&gt;Hey so I am quite new to Craft CMS &amp;amp; this might be a dumb question so please bear with me. I know that I can manually backup my database at any given point by going into Settings and Backup Database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a lot of different sub folders for the assets to help create organizing and separate certain content. Is this also being backed-up when I back-up the DB? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help&lt;/p&gt;&#xA;" OwnerUserId="5448" LastEditorUserId="45" LastEditDate="2016-07-27T16:45:22.867" LastActivityDate="2016-07-27T16:45:22.867" Title="Craft CMS Backup DB" Tags="&lt;assets&gt;&lt;database&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16083" PostTypeId="2" ParentId="16077" CreationDate="2016-07-27T14:03:16.770" Score="2" Body="&lt;p&gt;To pull both enabled and disabled entries from an Entries field, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;entriesField-&amp;gt;status = 'any';&#xA;$relatedEntries = $entry-&amp;gt;entriesField-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-27T14:28:04.953" LastActivityDate="2016-07-27T14:28:04.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16084" PostTypeId="2" ParentId="16082" CreationDate="2016-07-27T14:38:26.750" Score="3" Body="&lt;p&gt;The database backup will only backup the tables within your database, which does include references to your assets; such as their title, filename etc. However, the asset files themselves will not be included in the backup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most hosting providers will allow you to backup your filesystem. If yours doesn't, there are third-party services that can handle scheduled backups for you or you could write your own backup script that creates copies of your assets in another location.&lt;/p&gt;&#xA;" OwnerUserId="3394" LastActivityDate="2016-07-27T14:38:26.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16085" PostTypeId="2" ParentId="16082" CreationDate="2016-07-27T14:39:50.380" Score="3" Body="&lt;p&gt;The assets themselves are not included in the backup. But if you have added assets into those directories, the paths to them are saved in the database and will therefore be included in the backup.&lt;/p&gt;&#xA;" OwnerUserId="5447" LastActivityDate="2016-07-27T14:39:50.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16086" PostTypeId="2" ParentId="16082" CreationDate="2016-07-27T15:46:58.733" Score="2" Body="&lt;p&gt;Craft doesn't backup the file system but it's not hard to setup a cron on your server to do a backup periodically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throw this in a crontab (&lt;code&gt;crontab -e&lt;/code&gt; on most systems):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;30 2 * * * /bin/tar -czf /path/to/backup/location/backup.tar.gz /path/to/craft/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That'll backup every night at 2:30 am.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get even craftier, you might want to &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-create-an-off-site-backup-of-your-site-with-rsync-on-centos-6&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;rsync&lt;/code&gt;&lt;/a&gt; the file to a another server, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/16084/1016&quot;&gt;Scott&lt;/a&gt; mentions in his answer, if you use something like Linode or Digital Ocean, you might consider using their backup services as well. I haven't used DO's but Linode has worked well for us for years.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-07-27T15:46:58.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16087" PostTypeId="1" CreationDate="2016-07-27T15:47:21.590" Score="1" ViewCount="76" Body="&lt;p&gt;Is it possible to update a matrix field for a know entry id and a known matrixfield id with &lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrixfield has 3 fields as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;time (already set - category field set as times i.e. 09:00:00)&lt;/li&gt;&#xA;&lt;li&gt;session (entries field)&lt;/li&gt;&#xA;&lt;li&gt;booked (lightswitch)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I want to do is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE (tablename??) SET matrixfield.session = knownEntry, matrixfield.booked = 1 where matrixfieldId = knownMatrixfieldId&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for doing it with &lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt; is it will be fired within the &lt;code&gt;onSaveEntry&lt;/code&gt; event as per my &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16051/is-it-possible-to-update-an-entry-in-one-section-whilst-saving-data-of-an-entry&quot;&gt;previous post&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done a lot of head scratching and searching on this one but I'm coming up blank.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-07-27T15:47:21.590" Title="How to update a matrix field for an entry with craft()-&gt;db-&gt;createCommand()?" Tags="&lt;createcommand&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16088" PostTypeId="2" ParentId="16043" CreationDate="2016-07-27T16:12:25.100" Score="1" Body="&lt;p&gt;Update: temp fix&#xA;as per comments below i fixed with js plugin &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-cpjs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rough and ready hack to only run extra js when editing arabic entry.&#xA;On CpjsPlugin.php I edited the bottom:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; private function _renderJs()&#xA; {&#xA;    $settings = $this-&amp;gt;getSettings();&#xA;    if (trim($settings-&amp;gt;jsFile)) {&#xA;        $filepath = craft()-&amp;gt;config-&amp;gt;parseEnvironmentString($settings-&amp;gt;jsFile);&#xA;        if ($hash = @sha1_file($filepath)) {&#xA;            craft()-&amp;gt;templates-&amp;gt;includeJsFile($filepath.'?e='.$hash);&#xA;        } else {&#xA;            craft()-&amp;gt;templates-&amp;gt;includeJsFile($filepath);&#xA;        }&#xA;    }&#xA;    //joomkit hack for arabic redactor  fix&#xA;    $lang =  $this-&amp;gt;_getCurrentLocale();&#xA;    //only add extra js if arabic is set in url&#xA;    if($lang == &quot;ar&quot;){ &#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs($settings-&amp;gt;additionalJs);&#xA;    }    &#xA;}&#xA;&#xA;private function _getCurrentLocale() {&#xA;&#xA;    $segments = craft()-&amp;gt;request-&amp;gt;segments;&#xA;    $lastSegment = end($segments);&#xA;&#xA;    return $lastSegment;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The the extra js settings;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function()&#xA;{&#xA;$('.redactor-editor&amp;gt;*').css({&#xA;    direction: 'rtl',&#xA;    float: 'right'&#xA;});&#xA;$('.input #title').css({&#xA;    direction: 'rtl',&#xA;    float: 'right'&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;});&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this will help arabic translators start translating hopefully&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-07-27T16:12:25.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16089" PostTypeId="2" ParentId="16081" CreationDate="2016-07-27T16:47:06.470" Score="1" Body="&lt;p&gt;The first part of the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2232/pt-contact-form-plugin-html-email-templates&quot;&gt;answer in the post you linked to&lt;/a&gt; is wrong in the context of the Contact Form plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft only takes the custom &quot;HTML Template Path&quot; email setting into account when &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmailByKey-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;sendEmailByKey&lt;/a&gt; is called, which is used for pre-defined Craft emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Contact Form uses &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;sendEmail&lt;/a&gt;, which won't take it into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It hasn't been released as part of an official Contact Form plugin release yet so there's no documentation, but thanks to &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/commit/167e830665683deab22026ea3808d00f4b33e107&quot; rel=&quot;nofollow noreferrer&quot;&gt;this pull request&lt;/a&gt;, you've got an &lt;code&gt;onBeforeMessageCompile&lt;/code&gt; event that will give a plugin a chance to modify the contents of the email.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-07-27T16:47:06.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16090" PostTypeId="1" AcceptedAnswerId="16091" CreationDate="2016-07-27T17:18:53.163" Score="3" ViewCount="65" Body="&lt;p&gt;I want to show quotes for my french visitors like so:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;« Something intelligent someone said. »&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but visitors of my english locale should see the quotes formatted like so:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“Something intelligent someone said.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-27T17:18:53.163" Title="Wrap a quote in differently styled quotes depending on locale?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16091" PostTypeId="2" ParentId="16090" CreationDate="2016-07-27T17:18:53.163" Score="3" Body="&lt;p&gt;You could do this by adding the locale ID as a class to the body tag and then use a technique like described in this nice CSS-Tricks to add the quotes depending on that body class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://css-tricks.com/almanac/properties/q/quotes/&quot; rel=&quot;nofollow&quot;&gt;https://css-tricks.com/almanac/properties/q/quotes/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want them to be in the HTML you could write a quick Twig macro that adds the quotes depending on the locale ID.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro wrapInQuotes(string) %}&#xA;    {%- set quotes = {&#xA;        'en': ['“', '”'],&#xA;        'de': ['„', '“'],&#xA;        'fr': ['« ', ' »'],&#xA;    } %}&#xA;&#xA;    {{- quotes[craft.locale][0] }}&#xA;    {{- string }}&#xA;    {{- quotes[craft.locale][1] -}}&#xA;{% endmacro %}&#xA;&#xA;{% import _self as macros %}&#xA;{{ macros.wrapInQuotes(entry.quote) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-07-27T17:18:53.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16092" PostTypeId="2" ParentId="16076" CreationDate="2016-07-27T21:22:45.040" Score="2" Body="&lt;p&gt;The Element API plugin returns JSON, so you'll need to be specific about what you want to return for your categories – i.e. you can't return a CategoryModel (or an array of CategoryModels) in full directly from a Categories field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest option is to use &lt;a href=&quot;http://php.net/manual/en/function.array-map.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;array_map()&lt;/code&gt;&lt;/a&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'first' =&amp;gt; $block-&amp;gt;firstInstallment,&#xA;'second' =&amp;gt; $block-&amp;gt;secondInstallment,&#xA;'full' =&amp;gt; $block-&amp;gt;full,&#xA;'grant' =&amp;gt; array_map(function (CategoryModel $category) {&#xA;    return [&#xA;        'id' =&amp;gt; $category-&amp;gt;id,&#xA;        'title' =&amp;gt; $category-&amp;gt;title,&#xA;    ];&#xA;}, $block-&amp;gt;categoriesField-&amp;gt;find()),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, if your individual category has a lot of fields, you can always create an external function in your &lt;code&gt;elementapi.php&lt;/code&gt; file and use that for the &lt;code&gt;array_map&lt;/code&gt; call, instead of inlining the function (the external function needs to live above the &lt;code&gt;return ['endpoints']...&lt;/code&gt; part):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getCategoryData(CategoryModel $category)&#xA;{&#xA;    return [&#xA;        'id' =&amp;gt; $category-&amp;gt;id,&#xA;        'title' =&amp;gt; $category-&amp;gt;title,&#xA;        ...&#xA;    ];&#xA;}&#xA;&#xA;...&#xA;&#xA;'grant' =&amp;gt; array_map('getCategoryData', $block-&amp;gt;categoriesField-&amp;gt;find()),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, there's the &lt;code&gt;$category-&amp;gt;getAttributes()&lt;/code&gt; method which can be handy if you want to return all stock attributes (i.e. &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;dateUpdated&lt;/code&gt; etc – pretty much everything sans the title, for some reason):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getCategoryData(CategoryModel $category)&#xA;{&#xA;    return array_merge($category-&amp;gt;getAttributes(), [&#xA;        'title' =&amp;gt; $category-&amp;gt;title,&#xA;        'someCustomField' =&amp;gt; $category-&amp;gt;someCustomField,&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-07-27T22:25:21.423" LastActivityDate="2016-07-27T22:25:21.423" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16093" PostTypeId="1" CreationDate="2016-07-27T22:06:39.253" Score="1" ViewCount="458" Body="&lt;p&gt;Having an issue with htaccess redirects adding parameters to the new locations. I have done some research on this and apparently its from the default htaccess rules. I have tried a few suggestions which fixes it, but then I run into another issue where all of my channels load without www so none of the css or scripts load. I have a redirect to redirect all non www to www, but for some reason it must be conflicting with my rules because it will not redirect the channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my redirect code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;#only way the below redirects work without the parameter&#xA;RewriteRule (.+) index.php [QSA,L]&#xA;&#xA;Redirect 301 /services/ http://www.domain.com/healthcare-it-services/&#xA;Redirect 301 /services/optimization/ http://www.domain.com/healthcare-it-services/optimization/&#xA;Redirect 301 /services/insurance-authorization/ http://www.domain.com/healthcare-it-services/insurance-authorization/&#xA;Redirect 301 /solutions/ http://www.domain.com/healthcare-it-solutions/&#xA;Redirect 301 /solutions/schedule-maximizer/ http://www.domain.com/healthcare-it-solutions/schedule-maximizer/&#xA;Redirect 301 /solutions/provider-network-manager/  http://www.domain.com/healthcare-it-solutions/provider-network-manager/&#xA;&#xA;# send any asp page back to home&#xA;#RewriteRule \.asp$ http://domain.com [R=301,L]&#xA;&#xA;RewriteCond %{HTTP_HOST} ^domain.com$&#xA;RewriteRule (.*) http://www.domain.com/$1 [R=301,L] &#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2017-04-27T06:31:24.007" Title="Issue with htaccess redirect adding parameters" Tags="&lt;templating&gt;&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16094" PostTypeId="1" CreationDate="2016-07-28T01:07:38.013" Score="2" ViewCount="725" Body="&lt;p&gt;I am trying to export query data to a CSV file, everything works fine when I limit the number of rows to 500 (&lt;code&gt;$criteria-&amp;gt;limit&lt;/code&gt;), but when I increase it to around 530 it gives a 500 Internal Server error. I changed PHP timeout time to 300 from 30 seconds and the issue is still there. I feel like it might be a memory issue or a PHP issue. Does anyone has this happened to them, if so how could you fix it?&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="57" LastEditDate="2016-07-28T05:18:18.257" LastActivityDate="2016-12-25T09:07:16.570" Title="Throwing 500 error, but nothing logged in error logs or apache logs?" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16095" PostTypeId="1" AcceptedAnswerId="16132" CreationDate="2016-07-28T01:41:00.973" Score="1" ViewCount="450" Body="&lt;p&gt;Can't view image assets in web browser (403 error) after uploaded in Craft CMS Dashboard.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked permissions according to previous thread:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9592/403-forbidden-assets&quot;&gt;403 Forbidden Assets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help please!&lt;/p&gt;&#xA;" OwnerUserId="5374" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-07-30T19:00:31.600" Title="Can't view image assets in web browser (403 error) after uploaded in Craft CMS Dashboard" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16096" PostTypeId="1" AcceptedAnswerId="16097" CreationDate="2016-07-28T03:34:04.440" Score="2" ViewCount="342" Body="&lt;p&gt;I'm using Laravel Valet for my Craft development environment (which is awesome, btw) except for an issue with Tasks not kicking off. I initially stumbled upon the problem while using the Import plugin. The task created by the plugin would never start. Instead, it would sit in a &quot;Pending&quot; state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured this was a bug with the plugin, because other tasks seemed to start and run just fine. I then also discovered another task-related problem with P&amp;amp;T's example task plugin, &quot;Power Nap&quot;, where running the task would cause the whole site to hang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What gives?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these issues aren't present when running the site with MAMP. I've narrowed it down to something to do with &lt;a href=&quot;https://laravel.com/docs/5.2/valet&quot; rel=&quot;nofollow&quot;&gt;Valet&lt;/a&gt; (which is using &lt;a href=&quot;https://caddyserver.com&quot; rel=&quot;nofollow&quot;&gt;Caddy&lt;/a&gt; to serve PHP sites).&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="3380" LastEditDate="2016-07-28T03:44:29.667" LastActivityDate="2016-09-23T16:46:03.697" Title="Tasks either don't start or don't run as background processes" Tags="&lt;tasks&gt;&lt;caddy&gt;&lt;valet&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16097" PostTypeId="2" ParentId="16096" CreationDate="2016-07-28T03:34:04.440" Score="1" Body="&lt;p&gt;The issue seemed to stem from the fact that Caddy serves up PHP with fastcgi, instead of Apache or Nginx, and something to do with http requests used to start the task. AJAX requests (what my other functioning task plugins were using to kickoff) were unaffected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following a suggestion found here: &lt;a href=&quot;https://stackoverflow.com/questions/11758334/fastcgi-finish-request-creates-hung-connection-when-open-session-exists&quot;&gt;https://stackoverflow.com/questions/11758334/fastcgi-finish-request-creates-hung-connection-when-open-session-exists&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've placed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;session_write_close();&#xA;fastcgi_finish_request();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;at the top of the &lt;code&gt;runStep($step)&lt;/code&gt; function in each plugin's Task class and it resolved the issue!&#xA;Though, I'm not sure if either of the lines above have other implications.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;I should add, that from what I can tell, the above snippet &lt;em&gt;does&lt;/em&gt; cause issues with tasks on Apache setups. (tasks will start yet never finish). Unless you are using Caddy Server in production, (you're probably not and using Valet for development) the snippet above should only be used as a temporary hack to get through your tasks.&lt;/p&gt;&#xA;" OwnerUserId="3380" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-09-23T16:46:03.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16098" PostTypeId="1" CreationDate="2016-07-28T05:06:54.117" Score="0" ViewCount="286" Body="&lt;p&gt;I updated Craft to version 2.6.2798.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since then I'm getting a PHP error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parse error: syntax error, unexpected '[' in /craft/app/fieldtypes/BaseElementFieldType.php on line 428&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP version on the server is 5.53.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas to fix that issue?&lt;/p&gt;&#xA;" OwnerUserId="5452" LastActivityDate="2016-07-28T13:52:27.953" Title="PHP error after one click update" Tags="&lt;php&gt;&lt;error&gt;&lt;updates&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2016-07-28T18:10:57.507" ContentLicense="CC BY-SA 3.0" />
  <row Id="16099" PostTypeId="2" ParentId="16094" CreationDate="2016-07-28T05:23:01.743" Score="1" Body="&lt;p&gt;It's likely environmental/configuration related and unfortunately some hosts do some things to make it really hard to debug stuff like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head, some common ones are if you've got something like &lt;a href=&quot;https://suhosin.org/stories/index.html&quot; rel=&quot;nofollow&quot;&gt;Suhosin&lt;/a&gt; or &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow&quot;&gt;mod_security&lt;/a&gt; installed, then they have their own configuration limits on top of the usual PHP/Apache limits that might be coming into play.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if you're running nginx/php-fpm as a proxy in front of Apache, you might be bumping into its configuration limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or we've seen some hosts &lt;code&gt;&amp;lt;cough&amp;gt;&lt;/code&gt;RACKSPACE&lt;code&gt;&amp;lt;/cough&amp;gt;&lt;/code&gt; that have hard-coded execution times of 30 seconds &lt;em&gt;at the router/firewall level&lt;/em&gt; and there is absolutely nothing you can do to get around it, other than the obvious thing, which is to never use Rackspace.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-28T05:23:01.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16100" PostTypeId="1" CreationDate="2016-07-28T06:08:09.347" Score="1" ViewCount="121" Body="&lt;p&gt;I attempted to update my website by pressing the update button in the control panel. It failed and now site is down. How do I fix this? I don't have a backup to restore.&lt;/p&gt;&#xA;" OwnerUserId="5453" LastEditorUserId="4466" LastEditDate="2016-07-28T10:01:51.257" LastActivityDate="2016-07-28T14:08:00.973" Title="My site is down and I can't access the admin panel after attempting an automatic update" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2016-07-28T18:10:49.960" ContentLicense="CC BY-SA 3.0" />
  <row Id="16102" PostTypeId="1" CreationDate="2016-07-28T09:41:48.843" Score="2" ViewCount="144" Body="&lt;p&gt;I have a simple task: one particular front-end form on a website is being used to update a logged in user's profile. It works. It uses the &lt;code&gt;users.onSaveUser&lt;/code&gt; action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to fire off notification emails when a particular input value is true on form submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempt was a plugin that just watched the &lt;code&gt;onSaveUser&lt;/code&gt; event; but while I could get that to send email, I could not seem to get access to the form fields in order to check whether the email should be sent or not. Therefore it sent emails whenever a user was saved, including when edited in the back-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying a plugin that has its own action - &lt;code&gt;myPlugin/saveUser&lt;/code&gt;. But I am essentially duplicating the code in the existing users/saveUser function... and that makes it brittle. Is there not a way to get this done by just testing a field property and then passing everything over to the built-in users/saveUser action?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the simple plugin I had, which couldn't get the POST data and was therefor no good...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // is in the relevant user group?&#xA;        if($event-&amp;gt;params['user']-&amp;gt;isInGroup('applications')){&#xA;&#xA;            // check this is a submission from the front end form&#xA;            $applicationFormFrontend = craft()-&amp;gt;request-&amp;gt;getPost('applicationFormFrontend', 'default');&#xA;&#xA;            // check the Consent field was true on this submission&#xA;            $consentGiven = craft()-&amp;gt;request-&amp;gt;getPost('fields[consentGiven]', 'default');&#xA;&#xA;            NotifyPlugin::log(&quot;The value of applicationFormFrontend is $applicationFormFrontend.&quot;, LogLevel::Info);&#xA;            NotifyPlugin::log(&quot;The value of consentGiven is $consentGiven.&quot;, LogLevel::Info);&#xA;&#xA;            if($applicationFormFrontend == '1' and $consentGiven == '1') {&#xA;                // Write Email&#xA;&#xA;                ...&#xA;&#xA;                // send the mail&#xA;                craft()-&amp;gt;email-&amp;gt;sendEmail($notificationEmail);&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT, SOLUTION:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I was not getting values for&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$consentGiven = craft()-&amp;gt;request-&amp;gt;getPost('fields[consentGiven]', 'default');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is because it's the wrong style. It's why it was always getting 'default'. The fix is to use dot notation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$consentGiven = craft()-&amp;gt;request-&amp;gt;getPost('fields.consentGiven', 'default');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The original code (as above) works with this modification.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-07-28T15:14:14.710" LastActivityDate="2016-07-28T15:14:14.710" Title="Conditional email notification on saveUser action?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16103" PostTypeId="2" ParentId="16102" CreationDate="2016-07-28T09:52:30.890" Score="2" Body="&lt;p&gt;You should be able to do something like this using the event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;&#xA;  $testfield = craft()-&amp;gt;request-&amp;gt;getPost('someField');&#xA;&#xA;  if($testfield)&#xA;  {&#xA;    // Send the email&#xA;  }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-07-28T09:52:30.890" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16104" PostTypeId="2" ParentId="16098" CreationDate="2016-07-28T09:53:31.343" Score="1" Body="&lt;p&gt;I got exactly the same issue, not sure what PHP version i'm on though. It is possible to access the login screen, but after getting redirected to the dashboard it shows a HTTP 500 error message and with 'devmode on' it gives me this same error on whatever page off my site I try to access. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Ok, this may be a bit of a radical solution, but I just deleted the following on line 428 in the file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'criteria' =&amp;gt; [&#xA;        'locale' =&amp;gt; $targetLocale&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At least everything is working again... But a more substantiated solution would be nice ;)&lt;/p&gt;&#xA;" OwnerUserId="5454" LastEditorUserId="5454" LastEditDate="2016-07-28T09:58:31.983" LastActivityDate="2016-07-28T09:58:31.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16105" PostTypeId="2" ParentId="16076" CreationDate="2016-07-28T10:09:57.497" Score="0" Body="&lt;p&gt;I'm sure the answer from Mats also works but I thought the cleaner way would be the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fees.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'title' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getQuery('title'),&#xA;                'section' =&amp;gt; 'fees',&#xA;            ],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            $matrixSections = [];&#xA;            foreach ($entry-&amp;gt;fee as $block) {&#xA;            $items = [];&#xA;&#xA;            foreach ($block-&amp;gt;grantType as $itemEntry) {&#xA;                $items[] = [&#xA;                'title' =&amp;gt; $itemEntry-&amp;gt;title,&#xA;                ];&#xA;            }&#xA;            $matrixSections[] = [&#xA;                'first' =&amp;gt; $block-&amp;gt;firstInstallment,&#xA;                'second' =&amp;gt; $block-&amp;gt;secondInstallment,&#xA;                'full' =&amp;gt; $block-&amp;gt;full,&#xA;&#xA;                'items' =&amp;gt; $items,&#xA;            ];&#xA;            }&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'menu' =&amp;gt; [&#xA;                    'sections' =&amp;gt; $matrixSections,&#xA;                ]&#xA;            ];&#xA;        }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5438" LastActivityDate="2016-07-28T10:09:57.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16106" PostTypeId="2" ParentId="16102" CreationDate="2016-07-28T10:40:27.897" Score="2" Body="&lt;p&gt;I think the following will complete all your requirements. If I've understood correctly you're trying to send an email notification by using a hidden field in a front end form. You don't want the email notification to send twice and you don't want it to send if a user is new or being saved from the control panel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    // Returns if the user is a new user&#xA;    if ( $event-&amp;gt;params['isNewUser'] )&#xA;    {&#xA;      return&#xA;    }&#xA;&#xA;    // If the user hasn't had an email before&#xA;    if ( $user-&amp;gt;emailHasBeenSent == 0 )&#xA;    {&#xA;      // Get the frontEnd field value from the post request&#xA;      $frontEnd = craft()-&amp;gt;request-&amp;gt;getPost('frontEnd');&#xA;&#xA;      // Check the frontEnd value (will be null if user saved through the CP)&#xA;      if ( $frontEnd == 1 )&#xA;      {&#xA;        // Send the email&#xA;        // Save the emailHasBeenSent on the user to true so we don't send another email the next time the user is saved&#xA;      }&#xA;    {&#xA;&#xA; });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-07-28T10:58:50.307" LastActivityDate="2016-07-28T10:58:50.307" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16107" PostTypeId="2" ParentId="12084" CreationDate="2016-07-28T11:07:58.400" Score="1" Body="&lt;p&gt;open terminal :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;sudo nano /etc/mysql/my.cnf&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scroll to the bottom of file and A to enter insert mode&#xA;Copy and paste &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION &lt;/p&gt;&#xA;&#xA;&lt;p&gt;save file then restart mysql service by the below command :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;sudo service mysql restart&quot;  to restart MySQL.&lt;/p&gt;&#xA;" OwnerUserId="5455" LastActivityDate="2016-07-28T11:07:58.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16108" PostTypeId="2" ParentId="16060" CreationDate="2016-07-28T11:58:35.440" Score="1" Body="&lt;p&gt;Figured this out, the &lt;code&gt;appId&lt;/code&gt; setting was the culprit: &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/config-settings#appId&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If using this setting, you probably don't want to set it to something dynamic (as I was, e.g. &lt;code&gt;md5($url)&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-07-28T11:58:35.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16109" PostTypeId="1" AcceptedAnswerId="16110" CreationDate="2016-07-28T12:25:09.767" Score="2" ViewCount="824" Body="&lt;p&gt;I'm trying to display the value/price of the default variant for a product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for variant in product.variants %}&#xA;  From {{ variant.price|currency(cart.currency) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This displays the price of every variant that a product has. How can I just display the default variant price? Or better still, the product variant with the lowest price.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastEditorUserId="4466" LastEditDate="2016-07-28T13:00:52.377" LastActivityDate="2016-07-28T14:33:25.327" Title="Show value of default variant" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16110" PostTypeId="2" ParentId="16109" CreationDate="2016-07-28T12:35:11.673" Score="3" Body="&lt;p&gt;You can access the default variant using &lt;code&gt;{{ product.defaultVariant }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because &lt;code&gt;product.variants&lt;/code&gt; isn't an ElementCriteriaModel you can't sort it like one. You'd have to retrieve the products variants as an ElementCriteriaModel first like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lowestPriceVariant = craft.commerce.variants({&#xA;  productId: product.id,&#xA;  order: 'variants.price'&#xA;}).first() %}&#xA;&#xA;{{ lowestPriceVariant.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-07-28T14:33:25.327" LastActivityDate="2016-07-28T14:33:25.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16111" PostTypeId="2" ParentId="16081" CreationDate="2016-07-28T13:01:35.537" Score="1" Body="&lt;p&gt;As Brad points out in his answer, the Contact Form plugin doesn't use the same template. I found the easiest thing to do was replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;body      = $message-&amp;gt;message;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$htmlTemplateTopHalf= &amp;lt;&amp;lt;&amp;lt;TEMPLATETOP&#xA;    // insert html here&#xA;TEMPLATETOP;&#xA;&#xA;$htmlTemplateBottomHalf= &amp;lt;&amp;lt;&amp;lt;TEMPLATEBOTTOM&#xA;    // insert html here&#xA;TEMPLATEBOTTOM;&#xA;&#xA;$email-&amp;gt;body      = $htmlTemplateTopHalf;&#xA;$email-&amp;gt;body      .= $message-&amp;gt;message;&#xA;$email-&amp;gt;body      .= $htmlTemplateBottomHalf;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-07-28T13:01:35.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16112" PostTypeId="2" ParentId="16098" CreationDate="2016-07-28T13:52:27.953" Score="3" Body="&lt;p&gt;This has been fixed in &lt;a href=&quot;https://craftcms.com/changelog#build2804&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2804&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-28T13:52:27.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16113" PostTypeId="2" ParentId="16100" CreationDate="2016-07-28T14:08:00.973" Score="2" Body="&lt;p&gt;This has been fixed in &lt;a href=&quot;https://craftcms.com/changelog#build2804&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2804&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-28T14:08:00.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16114" PostTypeId="1" CreationDate="2016-07-28T16:12:22.030" Score="1" ViewCount="233" Body="&lt;p&gt;I have a Craft site which seems to function properly but I see a 404 in the header http status code. I’ve located the following in the error logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/07/28 15:22:30 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in   /var/www/touchtunesmedia.com/craft/app/controllers/Templat$&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('home', Array)&#xA;#1 /var/www/touchtunesmedia.com/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /var/www/touchtunesmedia.com/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Obje$&#xA;#3 /var/www/touchtunesmedia.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /var/www/touchtunesmedia.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /var/www/touchtunesmedia.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /var/www/touchtunesmedia.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /var/www/touchtunesmedia.com/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /var/www/touchtunesmedia.com/craft/app/etc/web/WebApp.php(288): CWebApplication-&amp;gt;processRequest()&#xA;#9 /var/www/touchtunesmedia.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /var/www/touchtunesmedia.com/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /var/www/touchtunesmedia.com/public/index.php(19): require_once('/var/www/toucht...')&#xA;#12 {main}&#xA;REQUEST_URI=/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a home partial which is rendering fine so I’m having a hard time diagnosing where the error may be stemming from. Additionally everything returns a 200 status code in my network profiler other than the request for the document. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vnFHg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vnFHg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the public dir’s index.php to echo test there is no 404 in the header status code. If I change my main layout template to a basic html file with nothing in it I get a 404 in the status code.&lt;/p&gt;&#xA;" OwnerUserId="976" LastActivityDate="2016-07-28T16:41:00.893" Title="404 in HTTP Header on working site" Tags="&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16116" PostTypeId="2" ParentId="16114" CreationDate="2016-07-28T16:41:00.893" Score="2" Body="&lt;p&gt;I resolved this by adding a new 'home' template which extends my main layout. This resolved the 404 in the header status code.&lt;/p&gt;&#xA;" OwnerUserId="976" LastActivityDate="2016-07-28T16:41:00.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16117" PostTypeId="1" AcceptedAnswerId="16118" CreationDate="2016-07-29T11:58:48.583" Score="1" ViewCount="177" Body="&lt;p&gt;We've rewritten an EE site on Craft and now need to import the members.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that since passwords are hashed &amp;amp; not encrypted there is no way to transfer the passwords from EE to Craft without having to force members to reset their passwords. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct ? &lt;/p&gt;&#xA;" OwnerUserId="5417" LastEditorUserId="45" LastEditDate="2016-07-29T16:47:22.647" LastActivityDate="2016-07-29T16:58:17.437" Title="Importing members from EE without password reset" Tags="&lt;migration&gt;&lt;password&gt;&lt;member&gt;&lt;hash&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16118" PostTypeId="2" ParentId="16117" CreationDate="2016-07-29T13:17:22.060" Score="5" Body="&lt;p&gt;It would be possible to write a plugin that provides an alternative login controller action, based on &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionLogin-detail&quot;&gt;UsersController::actionLogin()&lt;/a&gt;. The difference would be that, if normal login fails, it could try checking the old ExpressionEngine database to see if the user exists there, and if so, it could hash up the password in the same way EE does it, and see if it matches. When a password matches, the plugin could then A) update the user's password in the Craft database, and B) log the user in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only caveat (besides that this is a bit of work) is that it will only work for front-end login forms; you can’t change where the CP login form is submitted to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your plugin would need a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot;&gt;controller&lt;/a&gt; class, with the following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class CustomLoginController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionLogin()&#xA;    {&#xA;        // Attempt to log the user in&#xA;        $this-&amp;gt;_login();&#xA;&#xA;        // Now pass back to the normal login controller&#xA;        craft()-&amp;gt;runController('users/login');&#xA;    }&#xA;&#xA;    private function _login()&#xA;    {&#xA;        if (craft()-&amp;gt;userSession-&amp;gt;isLoggedIn())&#xA;        {&#xA;            return;&#xA;        }&#xA;&#xA;        if (craft()-&amp;gt;request-&amp;gt;isPostRequest())&#xA;        {&#xA;            $loginName = craft()-&amp;gt;request-&amp;gt;getPost('loginName');&#xA;            $password = craft()-&amp;gt;request-&amp;gt;getPost('password');&#xA;            $rememberMe = (bool) craft()-&amp;gt;request-&amp;gt;getPost('rememberMe');&#xA;&#xA;            // Try logging them in normally&#xA;            if (craft()-&amp;gt;userSession-&amp;gt;login($loginName, $password, $rememberMe))&#xA;            {&#xA;                return;&#xA;            }&#xA;&#xA;            // Is it an actual user account, at least?&#xA;            $user = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($loginName);&#xA;&#xA;            if ($user)&#xA;            {&#xA;                // See if they had an EE user account&#xA;                $host = craft()-&amp;gt;config-&amp;gt;get('server', ConfigFile::Db);&#xA;                $port = craft()-&amp;gt;config-&amp;gt;get('port', ConfigFile::Db);&#xA;                $dbName = 'ee_database_name';&#xA;                $dbUser = 'ee_database_username';&#xA;                $dbPass = 'ee_database_password';&#xA;                $db = new DbConnection('mysql:host='.$host.';dbname='.$dbName.';port='.$port.';', $dbUser, $dbPass);&#xA;&#xA;                $row = $db-&amp;gt;createCommand()&#xA;                    -&amp;gt;select('member_id, password, salt')&#xA;                    -&amp;gt;from('exp_members')&#xA;                    -&amp;gt;where(array('or', 'username=:login', 'email=:login'), array(':login' =&amp;gt; $loginName))&#xA;                    -&amp;gt;queryRow();&#xA;&#xA;                if ($row)&#xA;                {&#xA;                    $hashedPassword = $this-&amp;gt;_hashEEPassword($password);&#xA;&#xA;                    if ($hashedPassword == $row['password'])&#xA;                    {&#xA;                        // Eureka! Now update the local user account&#xA;                        $user-&amp;gt;newPassword = $password;&#xA;                        craft()-&amp;gt;users-&amp;gt;changePassword($user);&#xA;&#xA;                        // Delete the old user row so their old password stops working&#xA;                        $db-&amp;gt;createCommand()-&amp;gt;delete('exp_members',&#xA;                            array('member_id=:id'),&#xA;                            array(':id' =&amp;gt; $row['member_id']));&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    private function _hashEEPassword($password)&#xA;    {&#xA;        // Hash the password using EE's hashing technique&#xA;        // ...&#xA;&#xA;        return $hashedPassword;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The actual code that would go into _hashEEPassword() depends on your EE version. In EE 3.1 it lives in system/ee/legacy/libraries/Auth.php, function &lt;code&gt;hash_password()&lt;/code&gt;. Not going to repost it here as it is copyrighted, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the plugin in place and installed, you can start pointing front-end login forms to the new controller action by changing the &lt;code&gt;action&lt;/code&gt; hidden input value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;customLogin/login&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-29T13:17:22.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16119" PostTypeId="1" AcceptedAnswerId="16120" CreationDate="2016-07-29T14:03:58.540" Score="1" ViewCount="727" Body="&lt;p&gt;I use a front-end entry form based on the official documentation (&lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;), but after saving the entry, I am running in an error 404 on the entry page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;viewentry/{id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I replace the entry id with the slug in the browser (example.com/viewentry/example), then it works.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-07-29T14:13:03.883" Title="Entry Form: redirect not working" Tags="&lt;form&gt;&lt;redirect&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16120" PostTypeId="2" ParentId="16119" CreationDate="2016-07-29T14:13:03.883" Score="1" Body="&lt;p&gt;Try replacing &lt;code&gt;{id}&lt;/code&gt; with &lt;code&gt;{slug}&lt;/code&gt;. I guess it needs a slug, not an ID.&lt;/p&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2016-07-29T14:13:03.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16121" PostTypeId="1" CreationDate="2016-07-29T16:00:58.243" Score="2" ViewCount="374" Body="&lt;p&gt;Is there a method or for integrating Craft with Magento? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a new project coming up and we've done this with EE, but would like to try with Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally it would be a single login, but if we can even just get it so that they share the same header/footer stuff, that would be awesome.  I know you can do this with WordPress too, but again, we'd rather use Craft here. And I know there is Craft Commerce, but it just doesn't have all of the functionality we need, where Magento does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone integrated the two and/or have any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="57" LastEditDate="2016-07-29T17:04:17.043" LastActivityDate="2016-07-29T17:04:17.043" Title="Is there a way to integrate Craft with Magento?" Tags="&lt;plugins&gt;&lt;login&gt;&lt;ecommerce&gt;&lt;integration&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16122" PostTypeId="1" CreationDate="2016-07-29T16:11:15.563" Score="2" ViewCount="96" Body="&lt;p&gt;I am trying to setup a user permissions such that only a specific user group has permissions to create and edit SproutForms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When editing the permissions for a user group, there is an option for SproutForms labeled &lt;code&gt;Edit Form Settings&lt;/code&gt;. If I leave this setting unchecked, but check the &lt;code&gt;Access SproutForms&lt;/code&gt; under the &lt;code&gt;General&lt;/code&gt; heading so that the user may view form submissions, a user in this group is still able to create and edit forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug? Running SproutForms version &lt;code&gt;2.3.2&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2017-08-31T14:09:53.867" Title="SproutForms: User permissions to edit form settings not being honored" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16123" PostTypeId="2" ParentId="16117" CreationDate="2016-07-29T16:58:17.437" Score="2" Body="&lt;p&gt;Check out the &lt;strong&gt;Legacy Login&lt;/strong&gt; plugin...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/TopShelfCraft/Legacy-Login&quot; rel=&quot;nofollow&quot;&gt;https://github.com/TopShelfCraft/Legacy-Login&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's designed to handle a migration of users between EE and Craft.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-07-29T16:58:17.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16124" PostTypeId="1" AcceptedAnswerId="16125" CreationDate="2016-07-29T19:21:33.353" Score="2" ViewCount="241" Body="&lt;p&gt;I'm trying to figure out a way from Twig to get a distinct list of products purchased by a user. Help?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-29T19:21:33.353" Title="How can I get a list of unique products a Craft Commerce customer has purchased?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16125" PostTypeId="2" ParentId="16124" CreationDate="2016-07-29T19:21:33.353" Score="5" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab the currently logged in users past orders %}&#xA;{% set pastOrders = craft.commerce.orders.customer(craft.commerce.customer).find() %}&#xA;&#xA;{% set uniqueSKUs = [] %}&#xA;&#xA;{# loop through the orders #}&#xA;{% for order in pastOrders %}&#xA;&#xA;    {# loop through the line items #}&#xA;    {% for item in order.lineItems %}&#xA;&#xA;        {# did we find a unique one? #}&#xA;        {% if item.purchasable.sku not in uniqueSKUs %}&#xA;&#xA;            {# add it to the list #}&#xA;            {% set uniqueSKUs = uniqueSKUs|merge([item.purchasable.sku]) %}&#xA;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;h1&amp;gt;Unique SKUs for customer ID {{ craft.commerce.customer.id }}:&amp;lt;/h1&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for sku in uniqueSKUs %}&#xA;        &amp;lt;li&amp;gt;{{ sku }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-07-29T19:21:33.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16126" PostTypeId="1" AcceptedAnswerId="16148" CreationDate="2016-07-29T20:19:50.340" Score="1" ViewCount="183" Body="&lt;p&gt;I've got a client requesting that their subscribers get an email notification before their membership is renewed (via Stripe / Charge).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having glanced over Stripe's documentation, it doesn't look like there's a webhook to handle this, nor does it look like something that Charge supports out of the box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution out there more straightforward than rolling my own plugin (which I haven't done before, but am certainly willing to attempt)?&lt;/p&gt;&#xA;" OwnerUserId="776" LastActivityDate="2016-08-01T13:10:21.763" Title="Email Before Membership / Subscription Renews via Charge / Stripe?" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16127" PostTypeId="1" CreationDate="2016-07-30T00:37:15.560" Score="3" ViewCount="237" Body="&lt;p&gt;I'm converting a large EE site into Craft with the FeedMe plugin. So far it's working great. However, I've hit a speed bump. I need to import the SEO data attached to each article into Sprout SEO. When attempting to map the meta title, keyword and description data into the Sprout SEO field it only shows one destination field - the Meta:Basic field. Is it possible to import those 3 sets of data into the corresponding fields within Sprout SEO? &lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2016-07-30T02:47:47.217" Title="Import data into Sprout SEO" Tags="&lt;import&gt;&lt;plugin-sproutseo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16128" PostTypeId="2" ParentId="16127" CreationDate="2016-07-30T02:17:20.967" Score="3" Body="&lt;p&gt;The problem you're running into is that FeedMe doesn't know how to import into custom element types; I think a special hook would need to be written.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use my &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow&quot;&gt;SEOmatic plugin&lt;/a&gt; it has a FieldType that lets you choose what fields to pull things like the title, description, etc. from which solves this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the section of the wiki docs on &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/05.-SEO-Entry-Meta&quot; rel=&quot;nofollow&quot;&gt;SEO Entry Meta&lt;/a&gt; to see how that all works.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-07-30T02:17:20.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16129" PostTypeId="2" ParentId="16127" CreationDate="2016-07-30T02:47:47.217" Score="3" Body="&lt;p&gt;In general, I feel the field types in the current version Sprout SEO (2.x) are overused. We're currently working on a big update that should help resolve this but the field types are really only needed if you are doing advanced SEO work and need to have the ability to modify your SEO values to be different than other field values that already exist on your entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's much easier to manage SEO if you reuse key fields in your content. This helps content administrators focus on the content, reduces the need for duplicate data entry, and creates an effortless relationship between the keywords you are using in your content and your meta data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My recommendation is to remove the Sprout SEO Meta Basic field from your content architecture. You can probably use the value Title field for your Meta Title, Open Graph Title, and Twitter Title. You can reuse a Summary or Excerpt field for the Descriptions across meta types. And a Featured Image field for the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you are reusing the fields you already have in your content architecture, you can then setup your template code to use those values across the meta data options that fit.  For example, let's say you want to use the following 2 fields for your meta:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;entry.title &lt;/li&gt;&#xA;&lt;li&gt;entry.body&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With your &lt;code&gt;optimize&lt;/code&gt; tag in your header:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutSeo.optimize() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now call the &lt;code&gt;meta&lt;/code&gt; tag on your specific pages to build your meta:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({ &#xA;    title: entry.title,&#xA;    description: entry.body|striptags|slice(0, 160)     &#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method takes a little more setup in your templates but simplifies the management of the SEO for your content editors significantly. This was the way we intended Sprout SEO to be used initially. The fields were only intended to be used for more advanced use cases. In retrospect, we've learned that many people default to trying to use the fields for SEO rather than leveraging the existing fields and using the code overrides. This adds an additional step for preparing a clean SEO workflow for your websites and in the coming version of Sprout SEO we're refactoring the way that the fields work to allow you to select the fields you wish to use for SEO in the Control Panel without the overhead of additional fields to fill in, which will also add the benefit of significantly simplifying your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the example above a step further, you can also reuse those same fields you started with to address Open Graph and Twitter meta data. A simple example of that would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set metaTitle = entry.title %}&#xA;{% set metaDescription = entry.body|striptags|slice(0, 160)  %}&#xA;&#xA;{% do craft.sproutSeo.meta({&#xA;    title: metaTitle,&#xA;    description: metaDescription,&#xA;    ogType: &quot;article&quot;,&#xA;    ogTitle: metaTitle,&#xA;    ogDescription: metaDescription,&#xA;    twitterCard: &quot;summary&quot;,&#xA;    twitterTitle: entry.title,&#xA;    twitterDescription: metaDescription,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;While above I argue that importing to the Sprout SEO field type is usually not the best approach to managing your meta data, if your meta data is very unique and your project demands more customization, it appears that the FeedMe plugin has a way to map a custom field that's being imported in the &lt;a href=&quot;https://github.com/engram-design/FeedMe/wiki/Hooks&quot; rel=&quot;nofollow&quot;&gt;Hooks Documentation&lt;/a&gt; on their Github repo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would currently need to add support for the Meta field type that you wanted to import things into, but it appears possible. If you really need to go this direction, consider reaching out to us at Sprout. We have some internal tools we use to import data into Sprout SEO and other plugins and I'd be happy to discuss options.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-07-30T02:47:47.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16130" PostTypeId="2" ParentId="2753" CreationDate="2016-07-30T07:11:52.567" Score="2" Body="&lt;p&gt;For general SEO plugins I'd give &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow&quot;&gt;SEOMatic&lt;/a&gt; a try. I've used it on a number of projects. It's a well supported plugin, regularly updated by the developer.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-07-30T07:11:52.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16131" PostTypeId="2" ParentId="16031" CreationDate="2016-07-30T08:35:25.623" Score="2" Body="&lt;p&gt;Just wanted to give a short update on this project:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to build this plugin. The only problem was, that sendEmailByKey() took a lot of time and delayed the saving process extremely (probably because of the slow sending by SMTP). So I've decided to replace SMTP by the Sparkpost API which allows to use templates in a similar way than sendEmailByKey. This solution is faster than the SMTP one. But I am afraid that with a bigger amount of followers the thing will become slow again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, I am of the opinion, that doing email notification as part of the onSaveEntry event is probably not the best solution. Background tasks could be interesting, but I was not yet able to understand the Craft CMS TaskService ...&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="517" LastEditDate="2016-07-30T10:04:06.633" LastActivityDate="2016-07-30T10:04:06.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16132" PostTypeId="2" ParentId="16095" CreationDate="2016-07-30T19:00:31.600" Score="3" Body="&lt;p&gt;Fixed the image issue. Such a simple oversite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just needed to change the Asset Source settings and change the URL to include :8888 since I was running a local build with MAMP Pro.&lt;/p&gt;&#xA;" OwnerUserId="5374" LastActivityDate="2016-07-30T19:00:31.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16133" PostTypeId="1" AcceptedAnswerId="16134" CreationDate="2016-07-31T02:52:30.043" Score="2" ViewCount="495" Body="&lt;p&gt;I updated to the latest version of Craft, and I am getting this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /storage/xxxxxxx/www/public_html/index.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have updated the same way each time. This is the first time I am seeing this error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The files are setup like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;www/&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft/&lt;/li&gt;&#xA;&lt;li&gt;public_html/&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is what the index.php file has always been:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://cl.ly/281K2H3a3r1y&quot; rel=&quot;nofollow&quot;&gt;https://cl.ly/281K2H3a3r1y&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Permissions are the same as the previous app folder: 775&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas about what may be causing this? As I said, I have updated Craft several times before without any problems. I've also read other threads on this and didn't find a solution that works for me. I am wondering why this would be a problem now, when it hasn't been an issue during previous Craft updates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help you can give!&lt;/p&gt;&#xA;" OwnerUserId="504" LastEditorUserId="57" LastEditDate="2016-08-01T04:45:59.593" LastActivityDate="2016-08-01T04:45:59.593" Title="'Could Not Find Your Craft/ Folder' After Updating" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16134" PostTypeId="2" ParentId="16133" CreationDate="2016-07-31T03:41:09.433" Score="1" Body="&lt;p&gt;Actually, the permissions have been 774, not 775 as mentioned in my post. I think that was messed up somehow during the upload, and I missed that it wasn't the correct setting. I had also cleared my firewall cache earlier and it hadn't worked. When I cleared again just now after resetting permissions, everything seems ok. &lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2016-07-31T03:41:09.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16135" PostTypeId="1" AcceptedAnswerId="16138" CreationDate="2016-07-31T04:58:16.583" Score="2" ViewCount="618" Body="&lt;p&gt;I am querying data using the code below. In the database, there are duplicate entries for 'title', how can I get distinct values?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'institutions';&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;//$query-&amp;gt;setDistinct('title');&#xA;$query-&amp;gt;order('title asc');&#xA;&#xA;$queryResults = $query-&amp;gt;queryAll();&#xA;$institutions = EntryModel::populateModels($queryResults);&#xA;&#xA;return $institutions;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="57" LastEditDate="2016-08-01T04:47:50.187" LastActivityDate="2016-08-01T04:47:50.187" Title="Getting Unique entries?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;query&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16136" PostTypeId="2" ParentId="16135" CreationDate="2016-07-31T06:50:42.363" Score="1" Body="&lt;p&gt;The &lt;code&gt;setDistinct&lt;/code&gt; method should be passed a &lt;code&gt;boolean&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#setDistinct-detail&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/doc/api/1.1/CDbCommand#setDistinct-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, you may need to use the &lt;code&gt;selectDistinct&lt;/code&gt; method to override the &lt;code&gt;SELECT&lt;/code&gt; portion of the query. By default, this sets &lt;code&gt;distinct = true&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#selectDistinct-detail&quot; rel=&quot;nofollow&quot;&gt;http://www.yiiframework.com/doc/api/1.1/CDbCommand#selectDistinct-detail&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5447" LastActivityDate="2016-07-31T06:50:42.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16137" PostTypeId="1" CreationDate="2016-07-31T16:04:50.880" Score="5" ViewCount="486" Body="&lt;p&gt;Did anybody successfully install Craft on Google Cloud SQL? Or on any MySQL engine with activated replication and active GTID mode?&lt;/p&gt;&#xA;" OwnerUserId="5412" LastEditorUserId="22" LastEditDate="2020-06-17T16:19:04.333" LastActivityDate="2020-06-17T16:19:04.333" Title="Craft CMS with Google Cloud SQL as backend database" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16138" PostTypeId="2" ParentId="16135" CreationDate="2016-07-31T21:29:43.580" Score="2" Body="&lt;p&gt;The query returned by buildElementsQuery() is already prepped to fetch unique entries. But it’s possible for two distinct entries to have the same title, which is why it may &lt;em&gt;look&lt;/em&gt; like duplicate entries are being returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To only fetch entries with unique titles, do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$query-&amp;gt;group('content.title');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-07-31T21:29:43.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16139" PostTypeId="2" ParentId="11628" CreationDate="2016-07-31T22:17:31.343" Score="2" Body="&lt;p&gt;Potentially just figured out why you were getting the error &lt;code&gt;An exception has been thrown during the rendering of a template (&quot;&quot;)&lt;/code&gt; which was happening to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was doing a check where I wanted the result to a 404 page within a layout &lt;code&gt;{% extends &quot;_layout&quot; %}&lt;/code&gt;, BUT, the 404 page itself was using the layout template, so was essentially causing a loop.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2016-07-31T22:17:31.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16141" PostTypeId="1" AcceptedAnswerId="16163" CreationDate="2016-08-01T03:39:19.823" Score="1" ViewCount="647" Body="&lt;p&gt;I have a user group called Content Loaders with limited permissions. After creating a test user in this group I got an &quot;An unknown error occurred&quot; message every time I navigated anywhere in the CP or saved a change (though both were successful). I started adding back permissions and when I re-enabled &lt;em&gt;General &gt; Perform Craft CMS and plugin updates&lt;/em&gt;, the errors went away. Not sure if this is a configuration issue on this new staging server, but everything else seems to be working. I can't find any posts about similar issues. Obviously I don't want people doing data entry to be able to perform Craft updates! ;) Anyone have a clue what might be causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly related: even with an admin account checking for updates just shows the spinner image endlessly. I have no problem checking for updates on my local install. This is running on DigitalOcean (with ServerPilot), Ubuntu 14.04.4 x64 with PHP 7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only errors I saw in craft.log (which I cleared before doing something that caused the cpanel error to appear) looked like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2016/07/31 03:45:43 [error] [php] include([snipped path]craft/plugins/commerce/vendor/composer/../guzzle/guzzle/src/Guzzle/Http/Client.php): failed to open stream: No such file or directory ([snipped path]craft/app/vendor/composer/ClassLoader.php:412)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4748" LastActivityDate="2016-08-01T23:39:28.383" Title="&quot;Unknown error&quot; constantly, seems tied to user preferences" Tags="&lt;control-panel&gt;&lt;server&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16142" PostTypeId="2" ParentId="8494" CreationDate="2016-08-01T04:56:18.050" Score="1" Body="&lt;p&gt;As @carlcs mentioned, it's likely due to the way you're saving the ID...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would omit this line to ensure you save a new comment each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you actually want to have a form that allows &lt;em&gt;editing&lt;/em&gt; of existing comments, then you need to pass in the ID of the &lt;em&gt;comment&lt;/em&gt;, not the ID of the parent entry.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2016-08-01T04:56:18.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16143" PostTypeId="2" ParentId="15540" CreationDate="2016-08-01T05:07:40.793" Score="2" Body="&lt;p&gt;It appears that Craft filters out &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; tags by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can control this in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;By disabling the &quot;&lt;em&gt;Clean up HTML&lt;/em&gt;&quot; setting applied to the custom field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FS5MI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FS5MI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For more control, you can create your own custom redactor config JSON file. It's discussed in the docs here:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/rich-text-fields#redactor-configs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2016-08-01T05:07:40.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16144" PostTypeId="1" AcceptedAnswerId="16145" CreationDate="2016-08-01T08:05:55.760" Score="9" ViewCount="4514" Body="&lt;p&gt;I'm trying to make a upcoming and past event page. I can make an if statement for displaying the past or upcoming events but the problem is if I limit the amount of entries to be displayed I realised it is still going through the other entries (obviously) so it wont display anything. So I was looking for any filter of some kind to only display entries based on field value greater then other value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something in the range of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('event').limit(2).search('eventDate &amp;lt; now') %}&#xA;&amp;lt;!-- Past events go here --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2018-09-10T16:31:13.433" Title="Display entries if Field Date is past Now" Tags="&lt;templating&gt;&lt;search&gt;&lt;datetime&gt;&lt;filter&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16145" PostTypeId="2" ParentId="16144" CreationDate="2016-08-01T08:19:33.137" Score="11" Body="&lt;p&gt;You can combine a &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;if&lt;/code&gt; statement in twig, so you don't necessarily need to use &lt;code&gt;search&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this might get you a bit closer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('event') if entry.postDate &amp;lt; now %}&#xA;{# output your event here #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It'll just output what meets the criteria if your &lt;code&gt;if&lt;/code&gt; statement. The bonus is it doesn't mess with your loop variables either, so things like &lt;code&gt;loop.index&lt;/code&gt; work out as you'd expect (or at least they have for me so far). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Here's an alternate way of doing it, which neatens up the query and adds ordering... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries({&#xA;    section:  'event',&#xA;    startDate:  '&amp;lt; ' ~ now,&#xA;    order: 'postDate desc'&#xA;}).find() %}&#xA;&#xA;{% for event in events %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2018-09-10T16:31:13.433" LastActivityDate="2018-09-10T16:31:13.433" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16146" PostTypeId="1" CreationDate="2016-08-01T10:40:00.063" Score="1" ViewCount="230" Body="&lt;p&gt;I have recently added the Customer Info field to user profiles for the CP. I noticed however that the recorded addresses for the user are not listed. I checked against the order and there is addresses associated with it. Is there something I need to be doing to enable the address to show?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See screen shot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TQK4B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TQK4B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2017-07-11T04:40:10.913" Title="Craft Commerce: Addresses not showing in profile" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16148" PostTypeId="2" ParentId="16126" CreationDate="2016-08-01T13:10:21.763" Score="2" Body="&lt;p&gt;Developer of &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it's not a feature that's &lt;em&gt;currently&lt;/em&gt; supported out the box with Charge, it is something that's on the FR list, and is something I'm looking at adding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you drop me a &lt;a href=&quot;https://squarebit.co.uk/support&quot; rel=&quot;nofollow&quot;&gt;line directly&lt;/a&gt; I can talk over some of the options with you. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-08-01T13:10:21.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16151" PostTypeId="1" CreationDate="2016-08-01T14:29:51.603" Score="1" ViewCount="2211" Body="&lt;p&gt;I have a filter system on my website which uses categories. The categories have all got their own ID tagged to their HTML Element. Now I just need to get the clicked checkboxes to add their ID to the Twig variable which displays the entries in the for loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.section('retrospect') %}&#xA;&#xA;{% set relatedCategories = [] %}&#xA;&#xA;{% for category in categories %}&#xA;  {% set relatedCategories = relatedCategories|merge([taggedIds]) %}&#xA;{% endfor %}&#xA;&#xA;{% set related = craft.categories.section('retrospect').id(relatedCategories) %}&#xA;&#xA;{% set relatedArticles = craft.entries.section('retrospect').relatedTo(related) %}&#xA;&#xA;{% for entry in relatedArticles.order('caseNumber asc').after('2016-01').before('2016-12') %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="4466" LastEditDate="2016-08-01T17:21:51.647" LastActivityDate="2016-08-01T17:21:51.647" Title="Set Twig variable with javascript/jquery for displaying entries based on clicked value" Tags="&lt;templating&gt;&lt;categories&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16152" PostTypeId="1" CreationDate="2016-08-01T16:19:15.010" Score="2" ViewCount="106" Body="&lt;p&gt;I want to use AVG/SUM mysql and add it to the results of a criteria.&#xA;Trying to strategize the best way to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at &lt;code&gt;elements.onBuildElementsQuery&lt;/code&gt;, where it seems I could do something like...&lt;code&gt;$query-&amp;gt;addSelect('AVG(field_reviewRating) as reviewRatingAverage');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I need to make this a field type (read only)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to be dealing with several thousands of entries, so I don't want to have to query everything and loop through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could also just call a service from Twig e.g. (&lt;code&gt;craft.custom.getReviewStats(entryModel)&lt;/code&gt;), but I wanted to avoid having to add another query for each returned element.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2016-08-01T16:30:02.887" LastActivityDate="2019-04-01T17:19:06.903" Title="Add AVG, SUM to an element field" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16153" PostTypeId="1" AcceptedAnswerId="16155" CreationDate="2016-08-01T16:21:26.213" Score="1" ViewCount="194" Body="&lt;p&gt;How would I loop through all categories in a group to get this scenario: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get 4 entries per category&lt;/li&gt;&#xA;&lt;li&gt;No duplicates across any of the categories, if it's in Cat 1, should not show in any other.&lt;/li&gt;&#xA;&lt;li&gt;Category info (title, URL, etc)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So here is a visual:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category 1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1&lt;/li&gt;&#xA;&lt;li&gt;Entry 2&lt;/li&gt;&#xA;&lt;li&gt;Entry 3&lt;/li&gt;&#xA;&lt;li&gt;Entry 4&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Category 2&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strike&gt;Entry 1&lt;/strike&gt; (duplicate from Category 1, do not want here, so get 4 different)&lt;/li&gt;&#xA;&lt;li&gt;Entry 5&lt;/li&gt;&#xA;&lt;li&gt;Entry 6&lt;/li&gt;&#xA;&lt;li&gt;Entry 7&lt;/li&gt;&#xA;&lt;li&gt;Entry 8&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Category 3&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strike&gt;Entry 2&lt;/strike&gt; (duplicate from Category 1, do not want here, so get 4 different)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strike&gt;Entry 6&lt;/strike&gt; (duplicate from Category 2, do not want here, so get 4 different)&lt;/li&gt;&#xA;&lt;li&gt;Entry 9&lt;/li&gt;&#xA;&lt;li&gt;Entry 10&lt;/li&gt;&#xA;&lt;li&gt;Entry 11&lt;/li&gt;&#xA;&lt;li&gt;Entry 12&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I hope this gives a decent visual of what I want.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2016-08-02T13:41:03.133" Title="Get Entries within a Category Group with no duplicates in each category" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16154" PostTypeId="2" ParentId="16151" CreationDate="2016-08-01T17:20:34.907" Score="2" Body="&lt;p&gt;The Twig code to fetch entries occurs on page load - Your JS code will run after the page loads and won't be able to update/fetch new entries. Instead, you should look at building a system that uses query strings to add the id's to the Twig variable on page load - then enhance this using AJAX.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-08-01T17:20:34.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16155" PostTypeId="2" ParentId="16153" CreationDate="2016-08-01T18:00:41.607" Score="2" Body="&lt;p&gt;I've tested this with some of my own content and believe it works to your spec. You need to keep a track of all entries that have been displayed so far. You then loop through each categories related entries and if the entry hasn't been shown in a previous category we add it to a new array within that category loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Set empty array to hold id's of all currently displayed entries&#xA;    {% set entries_displayed = [] %}&#xA;&#xA;    // Loop over a category group&#xA;    {% for category in craft.categories.group( 'productBrand' ) %}&#xA;      &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;      // Get related entries to the category&#xA;      {% set related_entries = craft.entries.relatedTo( category ) %}&#xA;&#xA;      // Set empty array to hold id's of entries we'll eventually output&#xA;      {% set entries_to_display = [] %}&#xA;&#xA;      // Loop through related entries&#xA;      {% for entry in related_entries %}&#xA;&#xA;        // If the entry hasn't been displayed&#xA;        {% if entry.id not in entries_displayed %}&#xA;&#xA;          // We want to show the entry&#xA;          {% set entries_to_display = entries_to_display|merge([entry.id]) %}&#xA;        {% endif %}&#xA;      {% endfor %}&#xA;&#xA;      // Finally grab the entries to display from the array of id's that haven't already been shown&#xA;      {% set entries = craft.entries.id( entries_to_display ).limit( 4 ) %}&#xA;      {% for entry in entries %}&#xA;&#xA;        // Add the id to our &quot;already displayed&quot; array&#xA;        {% set entries_displayed = entries_displayed|merge([entry.id]) %}&#xA;&#xA;        {{ entry.id }} - {{ entry.title }}&amp;lt;br&amp;gt;&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Erik later discovered an error in my original answer where I was setting &lt;code&gt;entries_displayed&lt;/code&gt; in the first &lt;code&gt;for&lt;/code&gt; loop before they'd actually been output in the last &lt;code&gt;for&lt;/code&gt; loop. I've updated the code to reflect his fix.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I had to move the &lt;code&gt;entries_displayed&lt;/code&gt; array to the last &lt;code&gt;for&lt;/code&gt; loop which displayed the entries. That way I knew exactly what entries had been displayed. If I didn't do that, it would assume more than 4 were shown per category.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-08-02T13:41:03.133" LastActivityDate="2016-08-02T13:41:03.133" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16156" PostTypeId="2" ParentId="16152" CreationDate="2016-08-01T18:51:15.890" Score="2" Body="&lt;p&gt;In this case, since I happen to be dealing with reviews, The Star Reviews plugin calculates averages when new ratings are posted: &lt;a href=&quot;https://www.doublesecretagency.com/plugins/star-ratings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.doublesecretagency.com/plugins/star-ratings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="45" LastEditDate="2019-04-01T17:19:06.903" LastActivityDate="2019-04-01T17:19:06.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16157" PostTypeId="1" AcceptedAnswerId="16254" CreationDate="2016-08-01T19:25:11.267" Score="3" ViewCount="421" Body="&lt;p&gt;I've got a site with one base URL that is run on one Craft instance. The site is for a yearly event and each year the header / footer / body page elements / design are different. However, we want to keep all previous years pages in existence with the look and feel of that year so people can look at that page exactly as it existed in that year. URL structure would be something like example.com (current year), example.com/2017, example.com/2018, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are some of consistent codebase elements that I would like to have as easily editable for each unique year. For example, SEO elements like meta descriptions and social media descriptions should be unique for each year, while still being easily updatable using the same field across individual year entries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm debating is the best way to set this up in Craft to balance site speed and overall manageability. A few options I'm thinking about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a different entry and layout for each year and then reuse the individual fields that need to be editable across all pages in the different templates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do one base template and then use conditional logic that swaps in the CSS, header structure, footer structure, etc. for each year. Would also somehow need to have multiple matrix fields available in this to add unique content structure for each year. Concerned about lots of database queries for this one and impact on site speed. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some sort of hybrid approach leveraging different entry types across template(s) but not exactly sure what that would look like.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Other suggestions on approach or thoughts about which option is better? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2016-08-01T19:30:51.343" LastActivityDate="2016-08-07T20:15:04.720" Title="Recommended Structure - One Site with Pages With Totally Different Layouts?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;structure&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16158" PostTypeId="1" AcceptedAnswerId="16160" CreationDate="2016-08-01T20:04:16.703" Score="0" ViewCount="54" Body="&lt;p&gt;Ok so this is part I need help part heads up for others. The back story... I a client messaged me saying that they couldn't save posts anymore for specific entries. I noticed the ones that were having issues were the larger ones. The entries are fairly complex with the supertable plugin. I tried EVERYTHING I could to diagnose the problem, modifying every server setting etc. I realized it worked locally but not remote. I also realized it worked fine on my phone but not my machine. it worked on a co-workers air but not my macbook pro. craziness. I did eventually get it to work but I'm not sure why. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Switching out of DevMode made everything work fine, but that isn't a real acceptable solution for me because I use devMode. I hope anyone struggling with this, sees this but I appeal to some of you more seasoned Craft devs, why the heck is this happening in devMode and only remote on some machines? &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-08-01T20:57:08.750" Title="DevMode causing stuck entry saves" Tags="&lt;devmode&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16159" PostTypeId="1" AcceptedAnswerId="16169" CreationDate="2016-08-01T20:35:40.843" Score="1" ViewCount="75" Body="&lt;p&gt;I have a structure section called products. The entry url format is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;products{category.productCategory.first().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However the category never shows in the preview or real world url (real world url gives a 404)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each product entry only has one category so am puzzled as to why the category doesn't appear in the url.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-08-02T07:55:22.017" Title="Top level entry url not rendering category in url" Tags="&lt;routing&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16160" PostTypeId="2" ParentId="16158" CreationDate="2016-08-01T20:50:38.767" Score="3" Body="&lt;p&gt;Dev Mode introduces a lot of extra overhead for many processes. It profiles and logs all MySQL queries to the browser's console. For a detailed description of what Dev Mode does, please check out this page of the docs...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;What Dev Mode Does&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Specifically, this line is critical...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;&quot;Dev Mode is definitely &lt;strong&gt;not&lt;/strong&gt; suited for production environments.&quot;&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-01T20:50:38.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16161" PostTypeId="2" ParentId="16158" CreationDate="2016-08-01T20:57:08.750" Score="3" Body="&lt;p&gt;I'll be a bit over-the-top here, but this is like complaining that your air conditioning isn't working as well as you'd hope because of the raging fire coming out of the hood of your car.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should absolutely not be running devMode in any publicly-accessible area — it exposes tons of information about your build, and under some circumstances (like if you use PHP dotenv) will expose server usernames and passwords to users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use Craft's multi-environment configuration so that you can set general.php to use devMode on your local, but keep it turned off in production: &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-08-01T20:57:08.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16162" PostTypeId="2" ParentId="16137" CreationDate="2016-08-01T21:00:02.250" Score="5" Body="&lt;p&gt;Craft currently won't operate properly if you have GTID enabled because GTID enforces that every table involved in a SQL statements in one transaction have to utilize the same storage engine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While virtually all of Craft's tables use InnoDB as the storage engine, the &lt;code&gt;craft_searchindex&lt;/code&gt; table is still on MyISAM, because InnoDB didn't add full-text support until MySQL 5.6 and Craft still supports back to MySQL 5.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running MySQL 5.6+ (which you should be because I don't believe GTID was introduced until 5.6), then you can manually change the storage engine of the &lt;code&gt;craft_searchindex&lt;/code&gt; table from MyISAM to InnoDB and you shouldn't run into any issues.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-01T21:00:02.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16163" PostTypeId="2" ParentId="16141" CreationDate="2016-08-01T23:39:28.383" Score="1" Body="&lt;p&gt;This was apparently caused by an &lt;em&gt;almost&lt;/em&gt; complete but failed deployment of the &lt;code&gt;app&lt;/code&gt; folder. Only a few files were missing/corrupted so Craft still worked other than the issue described. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I replaced the entire &lt;code&gt;craft/app&lt;/code&gt; folder (deleted it, unzipped Craft on the server and used &lt;code&gt;mv&lt;/code&gt;) and updated the permissions. At this point I got the same error. The error continued to show up after disabling all plugins other than Commerce. But when I disabled Commerce I was able to check for updates again (Craft was already up to date), and under the limited user the errors no longer appear. Oddly, re-enabling Commerce changes nothing. I did encounter a PHP error when navigating within Commerce, so I followed similar steps to upload a fresh copy. Everything appears to be working correctly now.&lt;/p&gt;&#xA;" OwnerUserId="4748" LastActivityDate="2016-08-01T23:39:28.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16164" PostTypeId="1" AcceptedAnswerId="16166" CreationDate="2016-08-02T00:33:43.520" Score="2" ViewCount="199" Body="&lt;p&gt;I have an entry slug like this: &lt;code&gt;cics-west-belden-1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the -1 seems to be auto appended to the slug, but there are no other entries with the project &lt;code&gt;cics-west-belden&lt;/code&gt; in my project. When I remove the &lt;code&gt;-1&lt;/code&gt; from the end of the slug and save, the &lt;code&gt;-1&lt;/code&gt; always comes back. changing it to &lt;code&gt;cics-west-belden-2&lt;/code&gt; saves works. Even changing it to &lt;code&gt;cics-west-belden-&lt;/code&gt; works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as soon as I try to save it as  &lt;code&gt;cics-west-belden&lt;/code&gt;, it changes back to &lt;code&gt;cics-west-belden-1&lt;/code&gt; again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug with craft or maybe my database somehow got corrupted where it thinks this entry already exists when in fact it doesn't&lt;/p&gt;&#xA;" OwnerUserId="5286" LastEditorUserId="115" LastEditDate="2016-08-02T05:08:24.993" LastActivityDate="2016-08-02T05:15:59.637" Title="Entry slug auto appends -1 even when the original slug is unique" Tags="&lt;database&gt;&lt;slug&gt;&lt;saveentry&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16165" PostTypeId="2" ParentId="16006" CreationDate="2016-08-02T04:30:08.007" Score="1" Body="&lt;p&gt;Just building on the answer from @khalwat, if you use the &lt;code&gt;replace&lt;/code&gt; filter, your solution might look something like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.body | amp | replace(/(&amp;lt;img )(.*?)(\\/&amp;gt;)/g, '&amp;lt;amp-img $2&amp;gt;&amp;lt;/amp-img&amp;gt;') }}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be cleaner regex solutions out there, but I think that one will cut the mustard.&lt;/p&gt;&#xA;" OwnerUserId="5468" LastEditorUserId="5468" LastEditDate="2016-08-02T05:58:37.943" LastActivityDate="2016-08-02T05:58:37.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16166" PostTypeId="2" ParentId="16164" CreationDate="2016-08-02T05:15:59.637" Score="4" Body="&lt;p&gt;I don't know the specific rules Craft uses but I believe Craft auto appends the &lt;code&gt;-1&lt;/code&gt; when it tries to save an Element that has a matching URI in the &lt;code&gt;craft_elements_i18n&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few scenarios that I can think of that may behave like you describe:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Somehow, there is an existing record in your database that matches the URI of your Entry using the &lt;code&gt;cics-west-belden&lt;/code&gt; slug&lt;/li&gt;&#xA;&lt;li&gt;You have another Section, Category Group, or other custom Element set to generate URIs in the same format as the Section you are posting the Entry to which already has an Element saved using your &lt;code&gt;cics-west-belden&lt;/code&gt; slug.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To rule out the scenario where a matching record already exists in your database, open your database and look in the &lt;code&gt;craft_elements_i18n&lt;/code&gt; table. Search for all records that match your slug and see if you only find the one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT *&#xA;FROM craft_elements_i18n&#xA;WHERE slug = 'cics-west-belden';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To confirm that no other URIs already match your Entry, you could do a similar search in the URI table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT *&#xA;FROM craft_elements_i18n&#xA;WHERE uri LIKE '%cics-west-belden%';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-02T05:15:59.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16167" PostTypeId="1" CreationDate="2016-08-02T07:13:59.347" Score="1" ViewCount="625" Body="&lt;p&gt;I am trying to set up a Craft CMS website with Twig. I have done all the setup but getting the following error when I try to open the website- &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;Twig_Error_Runtime&#xA;&#xA;Variable &quot;global&quot; does not exist in &quot;503&quot; at line 9 (C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php:436)&#xA;&#xA;#0 C:\wamp64\www\west\craft\storage\runtime\compiled_templates\00\0009102817a5d89769207212bd179d422974c0400e0d4db894ad4fd45f35fd9d.php(29): Twig_Template-&amp;gt;getContext(Array, 'global')&#xA;#1 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(381): __TwigTemplate_37e5d62204d15e3586ae79a226d2d0e58f18084c697fef1d38e94cf3b75f8fb0-&amp;gt;doDisplay(Array, Array)&#xA;#2 C:\wamp64\www\west\craft\app\etc\templating\BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#3 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(355): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#4 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(366): Twig_Template-&amp;gt;display(Array)&#xA;#5 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Environment.php(347): Twig_Template-&amp;gt;render(Array)&#xA;#6 C:\wamp64\www\west\craft\app\services\TemplatesService.php(248): Twig_Environment-&amp;gt;render('503', Array)&#xA;#7 C:\wamp64\www\west\craft\app\controllers\BaseController.php(74): Craft\TemplatesService-&amp;gt;render('503', Array)&#xA;#8 C:\wamp64\www\west\craft\app\controllers\TemplatesController.php(200): Craft\BaseController-&amp;gt;renderTemplate('503', Array)&#xA;#9 C:\wamp64\www\west\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#10 C:\wamp64\www\west\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#11 C:\wamp64\www\west\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#12 C:\wamp64\www\west\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#13 C:\wamp64\www\west\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#14 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(368): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#15 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(281): CErrorHandler-&amp;gt;renderError()&#xA;#16 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(351): Craft\ErrorHandler-&amp;gt;renderError()&#xA;#17 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(218): CErrorHandler-&amp;gt;renderException()&#xA;#18 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(145): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#19 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#20 C:\wamp64\www\west\craft\app\framework\base\CApplication.php(750): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#21 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#22 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Here's the code from where the exception is thrown-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;        &#xA;    echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute((isset($context[&quot;global&quot;]) ? $context[&quot;global&quot;] : $this-&amp;gt;getContext($context, &quot;global&quot;)), &quot;siteName&quot;, array()), &quot;html&quot;, null, true);&#xA;    &amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template 503 - &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html class=&quot;no-js&quot; lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, maximum-scale=1&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;robots&quot; content=&quot;noindex&quot;&amp;gt;&#xA;&#xA;    &amp;lt;title&amp;gt;{{ global.siteName }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body style=&quot;height: 100%; margin: 0;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;h1 style=&quot;text-align:center; margin: 100px 0 100px;&quot;&amp;gt;{{ global.siteName }}&amp;lt;/h1&amp;gt;&#xA;&#xA;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;" OwnerUserId="5469" LastEditorUserId="45" LastEditDate="2016-08-02T07:26:12.023" LastActivityDate="2017-06-25T03:46:49.610" Title="Getting Twig_Error_Runtime when trying to open the website" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16168" PostTypeId="2" ParentId="16167" CreationDate="2016-08-02T07:24:31.860" Score="5" Body="&lt;p&gt;&lt;code&gt;siteName&lt;/code&gt; is automatically global... you don't need to include the &lt;code&gt;global.&lt;/code&gt; prefix.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-02T07:24:31.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16169" PostTypeId="2" ParentId="16159" CreationDate="2016-08-02T07:55:22.017" Score="2" Body="&lt;p&gt;I imagine it's because you're trying to access &lt;code&gt;productCategory&lt;/code&gt; on &lt;code&gt;category&lt;/code&gt; instead of the &lt;code&gt;entry&lt;/code&gt;. When you're setting entry urls you don't need to use the &lt;code&gt;entry&lt;/code&gt; prefix as it automatically expects this to be the case. So try &lt;code&gt;products{productCategory.first().slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-08-02T07:55:22.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16170" PostTypeId="2" ParentId="16031" CreationDate="2016-08-02T09:14:44.343" Score="2" Body="&lt;p&gt;Just a further update on this project:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was now able to create a task for each notification email. This makes the onSaveEntry event much faster, because emails are now processed in the background. This makes it possible to use sendEmailByKey() instead of a third party API, which reduces the maintenance effort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating tasks was much easier than expected (based on the &lt;a href=&quot;https://github.com/pixelandtonic/PowerNap&quot; rel=&quot;nofollow&quot;&gt;PowerNap&lt;/a&gt; plugin). &lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-08-02T09:14:44.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16171" PostTypeId="1" AcceptedAnswerId="16176" CreationDate="2016-08-02T10:00:15.307" Score="1" ViewCount="50" Body="&lt;p&gt;My entry template looks for the category of the entry &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.productCategory %}&#xA;      {{ category.uri }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output &lt;code&gt;products/[category slug]&lt;/code&gt; as I intended. There is only one value in the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I wrap the category URI in HTML like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.productCategory %}&#xA;     &amp;lt;a href=&quot;{{ category.uri }}&quot;&amp;gt;view&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The URI doubles: eg the output is repeated so the template renders &lt;code&gt;{{ category.uri }}&lt;/code&gt; as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;products/[category slug]/products/[category slug]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing something in the loop / or Twig behaviour?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-08-02T16:56:22.703" LastActivityDate="2016-08-02T21:42:42.880" Title="Entry template category loop repeats URI when HTML added" Tags="&lt;templating&gt;&lt;category&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16173" PostTypeId="1" AcceptedAnswerId="16174" CreationDate="2016-08-02T10:57:07.003" Score="1" ViewCount="175" Body="&lt;p&gt;By following the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI#examples&quot; rel=&quot;nofollow&quot;&gt;ElementAPI plugin documentation&lt;/a&gt; I was able to set up pagination of entries from the &lt;em&gt;ingredients&lt;/em&gt; section on an entry page. Entries from the &lt;em&gt;ingredients&lt;/em&gt; section have a relation field called &lt;em&gt;relatedEntries&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sections structures involved - set as an example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;em&gt;ingredients&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;drinks&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Desired output would be to show entries related to currently loaded entry from &lt;em&gt;drinks&lt;/em&gt; section.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I'm at &lt;em&gt;site.com/drink-entry-alfa&lt;/em&gt; I'd like to display all related entries from section &lt;em&gt;ingredients&lt;/em&gt; to that current entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Twig I'd request current &lt;code&gt;entry.id&lt;/code&gt; and use the &lt;code&gt;.relatedTo()&lt;/code&gt; parameter to get related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example from ElementAPI's documentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'ingredients.json' =&amp;gt; [&#xA;      'criteria' =&amp;gt; ['section' =&amp;gt; 'ingredients'],&#xA;      'elementsPerPage' =&amp;gt; 10,&#xA;      'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        return [&#xA;          'title' =&amp;gt; $entry-&amp;gt;title&#xA;        ];&#xA;      },&#xA;    ],&#xA;  ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-08-02T14:05:22.363" LastActivityDate="2016-08-02T15:05:11.903" Title="Display related entries on entry page using ElementAPI" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16174" PostTypeId="2" ParentId="16173" CreationDate="2016-08-02T11:54:40.767" Score="2" Body="&lt;p&gt;If you want to show all ingredients related to the current entry you'd use the Single Entry Endpoint to pass the entry into the &lt;code&gt;relatedTo&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'ingredients/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;  return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; [&#xA;        'section' =&amp;gt; 'ingredients',&#xA;        'relatedTo' =&amp;gt; $entryId&#xA;    ],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;      return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url&#xA;      ];&#xA;    },&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-08-02T15:05:11.903" LastActivityDate="2016-08-02T15:05:11.903" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16175" PostTypeId="1" AcceptedAnswerId="16933" CreationDate="2016-08-02T14:12:20.633" Score="2" ViewCount="810" Body="&lt;p&gt;Is it possible to apply a shipping cost to the cart before a customer enters their shipping address? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site I am working on has a fixed shipping rate of £3.50 for UK orders under £22. If the order value is over £22 then the shipping is free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone based in and shipping to, Europe has a set rate based on weight of the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set the initial base shipping cost to the cart screen before checkout and then change the shipping cost and method when the customer adds a shipping address during checkout?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best approach for setting these shipping rates in the Control Panel, and how to apply these in the cart?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="4466" LastEditDate="2016-09-22T09:28:26.543" LastActivityDate="2016-09-22T11:07:42.813" Title="Shipping in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16176" PostTypeId="2" ParentId="16171" CreationDate="2016-08-02T15:21:49.887" Score="1" Body="&lt;p&gt;Using &lt;code&gt;{{category.uri}}&lt;/code&gt; is likely just appending to the page's URL. You can use either &lt;code&gt;{{category.url}}&lt;/code&gt; or &lt;code&gt;{{siteUrl~category.uri}}&lt;/code&gt; to get the full URL.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-08-02T15:21:49.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16177" PostTypeId="2" ParentId="16171" CreationDate="2016-08-02T21:42:42.880" Score="1" Body="&lt;p&gt;Looked into this some more: I think this was due to my local development  multiconfig environment having a similar url to the live and the order in which they appear in the config seemed to be responsible for creating some repeated URL segments. I changed the local URL ( MAMP) to something different and {{ category.url }} works fine&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-08-02T21:42:42.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16178" PostTypeId="1" CreationDate="2016-08-02T22:56:33.137" Score="1" ViewCount="114" Body="&lt;p&gt;I'm investigating a switch to Craft CMS for my non-profit as an alternative to Drupal or Wordpress. We're on Drupal right now, and our website gets used daily to sign up for public events that we host.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The functionality of the Drupal Signups module (ttps://www.drupal.org/project/signup), combined with the Events module, is one thing we'd be want to replicate if we moved to another CMS. Essentially, we want to enable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) registration for the event (name, email address, phone number that is temporarily stored -- we don't want to deal with usernames or passwords to sign into the site)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) a registration cap (i.e. registration closes at 40 attendees)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) confirmation emails, as well as reminder emails to be automatically sent to registered users that the event is coming up &lt;/p&gt;&#xA;&#xA;&lt;p&gt;d) the ability for staff to send a group email to all registrants in case the event is delayed/cancelled from within the CMS;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e) the ability for our staff to view and manage signups from the admin interface (i.e. delete a registrant if they want to cancel their spot) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that Craft has plugins such as Venti to handle the event side of things. Is there anything currently available that could similarly handle signups and reminder notices? Does anyone know of similar examples using Craft CMS for other websites? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5472" LastActivityDate="2016-10-02T00:08:53.297" Title="Craft equivalent to Drupal Signups module" Tags="&lt;plugins&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16179" PostTypeId="2" ParentId="16178" CreationDate="2016-08-02T23:28:00.320" Score="1" Body="&lt;p&gt;For the calendar portion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solspace Calendar: &lt;a href=&quot;https://solspace.com/craft/calendar&quot; rel=&quot;nofollow&quot;&gt;https://solspace.com/craft/calendar&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Calendars: &lt;a href=&quot;https://topshelfcraft.com/calendars/introduction&quot; rel=&quot;nofollow&quot;&gt;https://topshelfcraft.com/calendars/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the membership part it'd be pretty easy to just add the people who register onto the event itself&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-08-02T23:28:00.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16180" PostTypeId="2" ParentId="2854" CreationDate="2016-08-03T00:08:19.850" Score="2" Body="&lt;p&gt;I know this is a year old, but I was scratching around trying to find a solution to this, and I came up with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try the kebab modifier.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;http://example.com/{{ entry.section|kebab }}&quot;&amp;gt;{{ entry.section }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The kebab case makes it possible to convert your section titles to usable links -- at least they did in my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone in the future.&lt;/p&gt;&#xA;" OwnerUserId="4554" LastActivityDate="2016-08-03T00:08:19.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16181" PostTypeId="1" AcceptedAnswerId="16184" CreationDate="2016-08-03T02:52:53.433" Score="3" ViewCount="3902" Body="&lt;p&gt;I have a _layout.html template which has both an include partial &lt;code&gt;{% include '_partials/_header.html' %}&lt;/code&gt; and a block section (e.g. Content) for other templates to extend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I put another block section (e.g. Breadcrumb) inside the include file and use that in a template which extends _layout.html? So far it doesn't seem to work. If I move the Breadcrumb block from the include template into _layout.html it works fine, and when I move it back the content in the template extension does not show.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2016-08-03T05:07:46.680" Title="Can I use a Block inside an Include file?" Tags="&lt;templating&gt;&lt;include&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16182" PostTypeId="1" AcceptedAnswerId="16183" CreationDate="2016-08-03T02:52:56.987" Score="3" ViewCount="1574" Body="&lt;p&gt;I just ‘discovered’ that the developer on my client’s craft website has been migrating his old landing pages to the new setup by cramming the older static pages into the public directory instead of using the CMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of PHP files there but they are mostly using a PHP mailer setup - not any database queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how dangerous or safe is it to have PHP files in the public directory?&lt;/p&gt;&#xA;" OwnerUserId="597" LastEditorUserId="597" LastEditDate="2016-08-03T04:44:37.303" LastActivityDate="2016-08-04T10:37:26.623" Title="Is it safe to have PHP files in the public directory of a craft cms website?" Tags="&lt;security&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16183" PostTypeId="2" ParentId="16182" CreationDate="2016-08-03T03:20:14.247" Score="7" Body="&lt;p&gt;As long as the PHP files themselves don't introduce any security holes, having them in your web root is perfectly fine. That's not uncommon at all. How they were written makes all the difference, of course. If you aren't sure whether the developer followed best practices for the security of the mailer scripts, that might be of some concern.&lt;/p&gt;&#xA;" OwnerUserId="4748" LastActivityDate="2016-08-03T03:20:14.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16184" PostTypeId="2" ParentId="16181" CreationDate="2016-08-03T03:32:19.753" Score="4" Body="&lt;p&gt;I believe it is possible @jack. Take a look at this working demo - &lt;a href=&quot;http://twigfiddle.com/9rwjeo&quot; rel=&quot;nofollow&quot;&gt;http://twigfiddle.com/9rwjeo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On closer inspection the original example did not work. You can not have a block inside an include how you are describing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have update the twig fiddle with a work around though&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-08-03T05:07:46.680" LastActivityDate="2016-08-03T05:07:46.680" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16185" PostTypeId="1" CreationDate="2016-08-03T03:50:52.347" Score="1" ViewCount="529" Body="&lt;p&gt;I keep getting an error when I am in the CP. The stack trace of the error that is logged is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/08/02 01:12:05 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/capspacedevhosti/craft/app/controllers/TemplatesController.php:59&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('(X(1)S(q325ycaz...', Array)&#xA;#1 /home/capspacedevhosti/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /home/capspacedevhosti/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /home/capspacedevhosti/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /home/capspacedevhosti/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /home/capspacedevhosti/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /home/capspacedevhosti/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /home/capspacedevhosti/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /home/capspacedevhosti/craft/app/etc/web/WebApp.php(279): CWebApplication-&amp;gt;processRequest()&#xA;#9 /home/capspacedevhosti/craft/app/framework/base/CApplication.php(184): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /home/capspacedevhosti/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /home/capspacedevhosti/public_html/index.php(19): require_once('/home/capspaced...')&#xA;#12 {main}&#xA;REQUEST_URI=/(X(1)S(q325ycazg05lq11ktn1hqjtx))/copyright&#xA;---&#xA;2016/08/02 01:12:05 [error] [application] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone knows how to fix it?&lt;/p&gt;&#xA;" OwnerUserId="5330" LastActivityDate="2016-08-03T17:44:04.787" Title="Debugging an error (&quot;An unknown error occurred&quot;)" Tags="&lt;control-panel&gt;&lt;error-message&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16186" PostTypeId="2" ParentId="16182" CreationDate="2016-08-03T09:16:36.477" Score="3" Body="&lt;p&gt;You should always be careful with PHP source files in a public folder. Typically it's fine, however a small mistake in the server's configuration can lead to big problems. It might cause .php files not to be processed by PHP, leading to leaked source files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This famously &lt;a href=&quot;https://techcrunch.com/2007/08/11/facebook-source-code-leaked/&quot; rel=&quot;nofollow&quot;&gt;happened with Facebook in 2007&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5474" LastEditorUserId="5474" LastEditDate="2016-08-04T10:37:26.623" LastActivityDate="2016-08-04T10:37:26.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16187" PostTypeId="1" CreationDate="2016-08-03T10:39:32.490" Score="1" ViewCount="571" Body="&lt;p&gt;I would like to use Craft's devMode but when I set it to true I get the following error: unserialize(): Unexpected end of serialized data. I believe this might be something to do with PHP7 for which this post seemed to have a solution &lt;a href=&quot;https://www.jackreichert.com/2014/02/handling-a-php-unserialize-offset-error/&quot; rel=&quot;nofollow&quot;&gt;https://www.jackreichert.com/2014/02/handling-a-php-unserialize-offset-error/&lt;/a&gt; but obviously I don't want to start changing core files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else having this problem?&lt;/p&gt;&#xA;" OwnerUserId="5475" LastActivityDate="2016-08-03T10:39:32.490" Title="devMode &amp; PHP7.1" Tags="&lt;devmode&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2016-08-05T04:22:17.413" ContentLicense="CC BY-SA 3.0" />
  <row Id="16188" PostTypeId="1" CreationDate="2016-08-03T11:36:48.657" Score="1" ViewCount="468" Body="&lt;p&gt;As a newbie to Craft and Craft Commerce. I wondered if someone could explain the difference between all these error codes that I have seen either in the docs, this forum or the templates and when they get set and when I should use each method in which situations? Apologies if this is a broad question...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errors is defined %}&#xA;    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;        {% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&#xA;&#xA;{% if errorMessage is defined %}&#xA;   &amp;lt;p class=&quot;error&quot;&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if model and model.getErrors('firstName') %}&#xA;   &amp;lt;span class=&quot;error&quot;&amp;gt;{{ model.getErrors('firstName')|join }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-08-03T16:58:44.760" LastActivityDate="2016-08-03T17:06:58.410" Title="Getting to grips with errors and flash messages" Tags="&lt;plugin-craftcommerce&gt;&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16189" PostTypeId="1" CreationDate="2016-08-03T12:17:17.783" Score="0" ViewCount="247" Body="&lt;p&gt;My customer clicked the update button and updated number 2.6.2791 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;now we are getting errors trying to save new images to the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internal Server Error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could not resolve the subpath “project-images/{slug}”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if this is a permissions thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hugh&lt;/p&gt;&#xA;" OwnerUserId="5476" LastActivityDate="2016-08-03T17:21:09.673" Title="Did a crtitical update now getting errors" Tags="&lt;updates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16190" PostTypeId="1" CreationDate="2016-08-03T14:05:41.210" Score="3" ViewCount="1007" Body="&lt;p&gt;I can use &lt;a href=&quot;https://craftcms.com/classreference/models/EntryModel#getLocales-detail&quot; rel=&quot;nofollow&quot;&gt;getLocales()&lt;/a&gt; off of the entry model to get all locales in the system, and whether they are enabled by default for that entry type, but it doesn't actually return which locales are enabled for that given entry. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2016-08-03T23:31:15.970" Title="How can I get the locales that are actually enabled for a given entry?" Tags="&lt;localization&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16191" PostTypeId="1" AcceptedAnswerId="16200" CreationDate="2016-08-03T14:24:41.853" Score="1" ViewCount="139" Body="&lt;p&gt;From the Creating an Archive Page for Entries article in the Craft docs. How could I limit it so that it grouped by month but limited things to 6 months?:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog').limit(null) %}&#xA;{% for date, entries in allEntries | group(&quot;postDate|date('F Y')&quot;) %}&#xA;    &amp;lt;h2&amp;gt;{{ date }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2016-08-03T23:27:42.403" Title="Date Archives: Last 6 months" Tags="&lt;group&gt;&lt;limit&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16192" PostTypeId="1" AcceptedAnswerId="16193" CreationDate="2016-08-03T15:45:29.587" Score="2" ViewCount="339" Body="&lt;p&gt;I am putting together my Business Logic plugin, as I want to validate the address fields throughout the checkout process of my Cart. I understand in order to do this I need to create a plugin and us the Craft Commerce &lt;code&gt;commerce_addresses.onBeforeSaveAddress&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided to try and use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lindseydiloreto/craft-businesslogic&lt;/a&gt; as a starting place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is as follows;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress', function(Event $event){&#xA;        $address = $event-&amp;gt;params['address'];&#xA;&#xA;        if (empty($address-&amp;gt;firstName))&#xA;        {&#xA;            $address-&amp;gt;addError('firstName', Craft::t('Please enter your Name'));&#xA;             $event-&amp;gt;performAction = false;&#xA;        }&#xA;&#xA;        if (empty($address-&amp;gt;address1))&#xA;        {&#xA;            $address-&amp;gt;addError('address1', Craft::t('Please enter an Address'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;&#xA;        if (empty($address-&amp;gt;city))&#xA;        {&#xA;            $address-&amp;gt;addError('city', Craft::t('Please enter your Town/City'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;&#xA;        if (empty($address-&amp;gt;zipCode))&#xA;        {&#xA;            $address-&amp;gt;addError('zipCode', Craft::t('Please enter your Post Code'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;&#xA;        if (empty($address-&amp;gt;countryId))&#xA;        {&#xA;            $address-&amp;gt;addError('countryId', Craft::t('Please select your Country'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I have this code inside my to level plugin file named &lt;code&gt;BusinessLogicPlugin.php&lt;/code&gt; it seems to work and it validates some of the fields as specified. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I move this code into the controllers folder inside &lt;code&gt;/controllers/BusinessLogicController.php&lt;/code&gt; it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure what I need to do to move this out of the main/top level file, as I see this file getting very logon/messy if I need to add several 'business logics' to the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed light on this as to why it might not work within /controllers/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="22" LastEditDate="2017-05-09T21:43:36.563" LastActivityDate="2017-05-09T21:43:36.563" Title="Business Logic Controller for Validating Address in Commerce" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16193" PostTypeId="2" ParentId="16192" CreationDate="2016-08-03T16:09:16.157" Score="4" Body="&lt;p&gt;You can move it all into a &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow&quot;&gt;Service&lt;/a&gt; and then call it from your main plugin file if you find it is getting unwieldy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;file: &lt;code&gt;craft/plugins/businesslogic/BusinessLogicPlugin.php&lt;/code&gt;:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;class BusinessLogicPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress', function(Event $event)&#xA;        {&#xA;            craft()-&amp;gt;businessLogic_events-&amp;gt;onBeforeSaveAddress($event);&#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;file: &lt;code&gt;craft/plugins/businesslogic/services/BusinessLogic_EventsService.php&lt;/code&gt;:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;class BusinessLogic_EventsService extends BaseApplicationComponent&#xA;{&#xA;    public function onBeforeSaveAddress(Event $event)&#xA;    {&#xA;        $address = $event-&amp;gt;params['address'];&#xA;&#xA;        if (empty($address-&amp;gt;firstName))&#xA;        {&#xA;            $address-&amp;gt;addError('firstName', Craft::t('Please enter your Name'));&#xA;            $event-&amp;gt;performAction = false;&#xA;&#xA;            // ...&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because &lt;code&gt;$event&lt;/code&gt; is an object it will be &lt;a href=&quot;http://php.net/manual/en/language.oop5.references.php&quot; rel=&quot;nofollow&quot;&gt;passed by reference&lt;/a&gt;, and you don't need to return anything.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-08-03T16:09:16.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16194" PostTypeId="2" ParentId="16188" CreationDate="2016-08-03T17:06:58.410" Score="1" Body="&lt;p&gt;It's hard to be more specific without some more context for each of the snippets you post, but:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errors is defined %}&#xA;    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;        {% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's checking if a variable named &lt;code&gt;errors&lt;/code&gt; has been passed into the template, and if so it assumes it's an array and loops through the array to display each error in an unordered list.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errorMessage is defined %}&#xA;    &amp;lt;p class=&quot;error&quot;&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's checking is a variable named &lt;code&gt;errorMessage&lt;/code&gt; has been passed into the template and if so it assumes it's a string and just displays the single error message.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if model and model.getErrors('firstName') %}&#xA;   &amp;lt;span class=&quot;error&quot;&amp;gt;{{ model.getErrors('firstName')|join }}&amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's checking if a variable named &lt;code&gt;model&lt;/code&gt; has been passed into the template and assumes it's an instance of &lt;a href=&quot;https://craftcms.com/classreference/models/BaseModel&quot; rel=&quot;nofollow&quot;&gt;BaseModel&lt;/a&gt;.  Then it calls the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel#getErrors-detail&quot; rel=&quot;nofollow&quot;&gt;getErrors&lt;/a&gt; method of the class passing in &lt;code&gt;firstName&lt;/code&gt; as a parameter to specifically check if any errors have been set on its &lt;code&gt;firstName&lt;/code&gt; attribute.  If so, it will take that array of errors and display them using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/join.html&quot; rel=&quot;nofollow&quot;&gt;join&lt;/a&gt; filter.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-03T17:06:58.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16195" PostTypeId="2" ParentId="16189" CreationDate="2016-08-03T17:21:09.673" Score="3" Body="&lt;p&gt;Most likely you've got an Assets field inside of a Matrix field somewhere on your site and you're referencing &lt;code&gt;project-images/{slug}&lt;/code&gt; in that field's upload location setting when it should be &lt;code&gt;project-images/{owner.slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some point, those settings were more loosely enforce, but now the error you're getting will be shown if it is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here for more info: &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-03T17:21:09.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16196" PostTypeId="2" ParentId="16185" CreationDate="2016-08-03T17:44:04.787" Score="1" Body="&lt;p&gt;The error you're showing from the logs is a simple 404 error that occurs whenever someone or something requests a URI on your site that doesn't resolve to anything.  In this case it is &lt;code&gt;/(X(1)S(q325ycazg05lq11ktn1hqjtx))/copyright&lt;/code&gt;, which is likely a script probing for vulnerabilities, which is very common for any public website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've moved those 404 messages into their own &lt;code&gt;404.log&lt;/code&gt; file in the upcoming Craft 3 so they don't clutter the main log file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The underlying error message for &lt;code&gt;An unknown error occurred&lt;/code&gt; will be elsewhere in your log files.  Sometimes it's helpful to nuke all of your logs (or move them somewhere else), then reproduce the issue as you'll have left to sift through.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-03T17:44:04.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16197" PostTypeId="1" AcceptedAnswerId="16199" CreationDate="2016-08-03T20:45:35.250" Score="5" ViewCount="1517" Body="&lt;p&gt;I am brand new to Craft so excuse me if the question seems a little simple. Is this the best way to return the contents of a 'singles' section. Does everything end up in a for loop even if you are only returning a single entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle').limit(1).find() %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also I am curious if 'entry' in the for loop actually means anything or is just a good symantic name to use for example could you say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for oranges in ...%}{% oranges.title %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5478" LastActivityDate="2016-08-04T01:32:53.120" Title="Singles Entry return content" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16198" PostTypeId="1" AcceptedAnswerId="16205" CreationDate="2016-08-03T22:45:01.813" Score="2" ViewCount="151" Body="&lt;p&gt;First site using Craft and impressed thus far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to be allowing CP access for all users, and these users will have access to multiple channels. I want them to be able to relate their entries from different channels to each other, but only be able to select from their own entries within the relationship field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find anywhere that allows this. I did a test with 2 separate users, and when I went to relate, I could see the other user's entries available for relationship in the entries relationship field. This won't be acceptable as each user should be in their own silo and only have the ability to relate their own entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can accomplish this that I'm missing? (edit: without custom field type)&lt;/p&gt;&#xA;" OwnerUserId="5479" LastActivityDate="2016-08-04T15:23:41.537" Title="Restricting relationship field by author" Tags="&lt;relations&gt;&lt;fieldtypes&gt;&lt;entries-field&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16199" PostTypeId="2" ParentId="16197" CreationDate="2016-08-03T23:05:09.500" Score="5" Body="&lt;p&gt;It's not a simple question, but a fundamental one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever you query one of Craft's Element API services (such as &lt;code&gt;craft.entries&lt;/code&gt;, &lt;code&gt;craft.assets&lt;/code&gt; and &lt;code&gt;craft.categories&lt;/code&gt;) or a relational field (such as an Entries or Assets field, i.e. &lt;code&gt;entry.myAssetsField&lt;/code&gt;) you'll get back an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ElementCriteriaModel is basically a fancy wrapper for your query, which you can call methods on (such as &lt;code&gt;.find()&lt;/code&gt;, &lt;code&gt;.ids()&lt;/code&gt;, &lt;code&gt;.first()&lt;/code&gt; and &lt;code&gt;.last()&lt;/code&gt;), in order to actually pull elements based on your criteria (e.g. &lt;code&gt;.section('sectionHandle')&lt;/code&gt;). Some methods – such as &lt;code&gt;.find()&lt;/code&gt; – will return an array of elements (Craft actually calls &lt;code&gt;.find()&lt;/code&gt; implicitly unless you use &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#fetching-the-elements&quot; rel=&quot;nofollow&quot;&gt;one of the other methods&lt;/a&gt;), while others will return a single element (&lt;code&gt;.first()&lt;/code&gt;, &lt;code&gt;.last()&lt;/code&gt;). There are also methods that can do different things entirely, such as returning an array of matching element IDs (&lt;code&gt;.ids()&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, you're using &lt;code&gt;.find()&lt;/code&gt; – which means Craft will return an array of elements (even if there's only one). In such cases, it usually makes more sense to use &lt;code&gt;.first()&lt;/code&gt;, to make Craft return a single element and avoid the &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('sectionHandle').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, since the query may not always return any matching elements, it's usually a good idea to wrap the result in a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('sectionHandle').first() %}&#xA;{% if entry %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will of course also be true for any relational fields – consider an Assets field for a &quot;featured image&quot;; even if you limit the field to a single image, simply accessing the field in a template will always return an ElementCriteriaModel, unless you use &lt;code&gt;.first()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Returns an ElementCriteriaModel #}&#xA;{% set featuredImage = entry.someAssetsField %}&#xA;&#xA;{# Returns an array of elements #}&#xA;{% set featuredImage = entry.someAssetsField.find() %}&#xA;&#xA;{# Returns a single Asset #}&#xA;{% set featuredImage = entry.someAssetsField.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also I am curious if 'entry' in the for loop actually means anything or is just a good symantic name to use&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's just a semantic name – the result variable for your query can be named whatever you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myAwesomeSingleEntry = craft.entries.section('sectionHandle').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, a good thing to know about is that whenever Craft &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;matches the current URL request to an element&lt;/a&gt; – e.g. your Single entry – it'll automatically populate your template with an &lt;code&gt;entry&lt;/code&gt; variable. In other words, if the current page is the actual URL for your Single entry, you won't need to do any &lt;code&gt;craft.entries&lt;/code&gt; query at all (this is true for all Entries and Categories that have URLs enabled).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-04T01:32:53.120" LastActivityDate="2016-08-04T01:32:53.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16200" PostTypeId="2" ParentId="16191" CreationDate="2016-08-03T23:27:42.403" Score="1" Body="&lt;p&gt;100% untested, but something like this should work using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date_modify.html&quot; rel=&quot;nofollow&quot;&gt;date_modify&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = now|date_modify(&quot;-6 months&quot;) %}&#xA;&#xA;{% set allEntries = craft.entries.section('blog').limit(null).postDate('&amp;gt;= ' ~ startDate) %}&#xA;&#xA;{% for date, entries in allEntries | group(&quot;postDate|date('F Y')&quot;) %}&#xA;    &amp;lt;h2&amp;gt;{{ date }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-03T23:27:42.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16201" PostTypeId="2" ParentId="16190" CreationDate="2016-08-03T23:31:15.970" Score="5" Body="&lt;p&gt;Actually, &lt;code&gt;entry.getLocales()&lt;/code&gt; (or just &lt;code&gt;entry.locales&lt;/code&gt;) will return an array of the locales enabled for the entry's section, not all locales in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there's no easy way to determine which locales a single entry is enabled for. One way to do it, is to use a &lt;code&gt;craft.entries&lt;/code&gt; query per locale, and add the locale ids to an array whenever you get an element back from the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set localesEnabledForEntry = [entry.locale] %}&#xA;{% for locale in entry.locales|keys %}&#xA;    {% set localeEntry = locale not in localesEnabledForEntry ? craft.entries.id(entry.id).locale(locale).first() : null %}&#xA;    {% if localeEntry %}&#xA;        {% set localesEnabledForEntry = localesEnabledForEntry|merge([locale]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, if you're looping through a lot of entries (and/or you have a lot of locales enabled for the entries' section(s)), this will quickly become a performance issue (you're basically doing 1 additional database query per entry per locale, except for the current locale being viewed).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-03T23:31:15.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16202" PostTypeId="2" ParentId="16198" CreationDate="2016-08-03T23:33:08.633" Score="2" Body="&lt;p&gt;Craft's permission system doesn't go down to the field level, which is what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd either have to replicate the functionality you're looking for on the front-end of the site, or develop a custom field type that took into account &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerUserPermissions&quot; rel=&quot;nofollow&quot;&gt;custom permissions&lt;/a&gt; for your users.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-03T23:33:08.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16203" PostTypeId="2" ParentId="1528" CreationDate="2016-08-04T03:00:13.057" Score="7" Body="&lt;p&gt;As of 2016, I have come across two options that attempt to handle the &lt;em&gt;matrix-within-a-matrix&lt;/em&gt; scenario (to varying extents):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Neo plugin&lt;/strong&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-neo&lt;/a&gt;&lt;br&gt;&#xA;Provides the ability to place &lt;em&gt;existing Craft fields&lt;/em&gt; inside a matrix, group fields into tabs, and also nest blocks as &quot;children&quot; of other blocks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Super Table plugin&lt;/strong&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;br&gt;&#xA;Allows you to create repeatable fields that include almost any field type, including matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This wiki page from the Neo repository also lists a few videos and other resources which delve into this topic:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/benjamminf/craft-neo/wiki/6.-Resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-neo/wiki/6.-Resources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I recently made the proud discovery that both these great plugins were made in my home city, Melbourne, Australia. Woo!)&lt;/p&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="5437" LastEditDate="2016-12-20T01:50:35.620" LastActivityDate="2016-12-20T01:50:35.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16204" PostTypeId="1" AcceptedAnswerId="16215" CreationDate="2016-08-04T06:26:47.950" Score="1" ViewCount="400" Body="&lt;p&gt;I want to make a tabbed content section of book citations where the tabs are years, made from categories.  I am using a model I found in the cookbook here, which seems to be exactly what I am trying to do.  &lt;a href=&quot;http://craftcookbook.net/recipes/330&quot; rel=&quot;nofollow&quot;&gt;http://craftcookbook.net/recipes/330&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have the resulting citations listing in the proper order, but the tab ID that is exported in the resulting html does not give the slug [which is a year], but rather a consecutive number, always 0,1,2,3,etc. … Like id=“0”, instead of id=“2016”     SO the panel container does not display the correctly when the tab is clicked, instead it displays all entries , instead of only those from 2016, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm close, but not quite there, and stumped as to why the html ends up with a number instead of the year/category. Here is the code I have, largely taken from the cookbook:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;light-wrapper&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;container inner&quot;&amp;gt;&#xA;{% set entriesByCat = {} %}&#xA;{% set entries = craft.entries.section('newsArchive') %}&#xA;{% set cats = craft.categories.group('newsArchive') %}&#xA;&#xA;{% for cat in cats %}&#xA;{% set entries = entries.relatedTo(cat) %}&#xA;    {% if entries|length %}&#xA;        {% set entriesByCat = entriesByCat|merge({ (cat.slug): entries }) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if cats|length %}&#xA;&amp;lt;div class=&quot;tabs tabs-side tab-container&quot;&amp;gt;&#xA;    &amp;lt;ul class=&quot;etabs&quot;&amp;gt;&#xA;    {% for cat in cats %}&#xA;        &amp;lt;li class=&quot;tab&quot;&amp;gt;&amp;lt;a href=&quot;#{{ cat.slug }}&quot;&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% for catSlug, catEntries in entriesByCat %}&#xA;    &amp;lt;div class=&quot;panel-container&quot;&amp;gt;&#xA;        &amp;lt;div id=&quot;{{ catSlug }}&quot; class=&quot;tab-block&quot; &amp;gt;&#xA;&#xA;            {% for entry in catEntries %}&#xA;            &amp;lt;ul class=&quot;circled&quot; &amp;gt;&#xA;                {% for block in entry.bibliography %}       &#xA;                    {% if block.type == &quot;biblioBook&quot; %}&#xA;                &amp;lt;li&amp;gt;{{ entry.authorLast }}, {{ entry.authorFirst }}. &amp;lt;strong&amp;gt;{{ entry.title }}&amp;lt;/strong&amp;gt;. {{ block.publisherCity }}: {{ block.publisherName }}, {{ block.publicationDate.format('Y') }}. Print.&amp;lt;/li&amp;gt;&#xA;                    {% endif %} &#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;!-- /.tab-block --&amp;gt; &#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- /.panel-container --&amp;gt; &#xA;{% endfor %}&#xA;     &amp;lt;/div&amp;gt;&#xA;     &amp;lt;!-- /.tabs --&amp;gt; &#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- /.container --&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the resulting HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;light-wrapper&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;container inner&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;tabs tabs-side tab-container&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;etabs&quot;&amp;gt;&#xA;            &amp;lt;li class=&quot;tab&quot;&amp;gt;&amp;lt;a href=&quot;#2016&quot;&amp;gt;2016&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li class=&quot;tab&quot;&amp;gt;&amp;lt;a href=&quot;#2015&quot;&amp;gt;2015&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li class=&quot;tab&quot;&amp;gt;&amp;lt;a href=&quot;#2013&quot;&amp;gt;2013&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;div class=&quot;panel-container&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;0&quot; class=&quot;tab-block&quot; &amp;gt;&#xA;                &amp;lt;ul class=&quot;circled&quot; &amp;gt;&#xA;                    &amp;lt;li&amp;gt; Author, A. &amp;lt;strong&amp;gt;”TITLE.”&amp;lt;/strong&amp;gt; &amp;lt;em&amp;gt;Random House&amp;lt;/em&amp;gt; 04 April 2016: . Print.&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;ul class=&quot;circled&quot; &amp;gt;&#xA;                    &amp;lt;li&amp;gt; Author, B. &amp;lt;strong&amp;gt;”TITLE.”&amp;lt;/strong&amp;gt; &amp;lt;em&amp;gt; Random House &amp;lt;/em&amp;gt; 04 June 2016: . Print.&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;panel-container&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;1&quot; class=&quot;tab-block&quot; &amp;gt;&#xA;                &amp;lt;ul class=&quot;circled&quot; &amp;gt;&#xA;                    &amp;lt;li&amp;gt; Author, C. &amp;lt;strong&amp;gt;”TITLE.”&amp;lt;/strong&amp;gt; &amp;lt;em&amp;gt; Random House &amp;lt;/em&amp;gt; 04 May 2015: . Print.&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;panel-container&quot;&amp;gt;&#xA;            &amp;lt;div id=“2” class=&quot;tab-block&quot; &amp;gt;&#xA;                &amp;lt;ul class=&quot;circled&quot; &amp;gt;&#xA;                    &amp;lt;li&amp;gt; Author, D. &amp;lt;strong&amp;gt;”TITLE.”&amp;lt;/strong&amp;gt; &amp;lt;em&amp;gt; Random House &amp;lt;/em&amp;gt; 04 Oct 2013: . Print.&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;!-- /.panel-container --&amp;gt; &#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- /.tabs --&amp;gt; &#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- /.container --&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;" OwnerUserId="3994" LastActivityDate="2016-08-04T20:11:42.353" Title="Tabbed Content &amp; Categories - Tab ID html displays a category number instead of the slug" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16205" PostTypeId="2" ParentId="16198" CreationDate="2016-08-04T09:00:01.897" Score="2" Body="&lt;p&gt;Brad is correct – this isn't possible to do without &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;writing a plugin&lt;/a&gt;. For your particular use case, this will be very simple, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you'll have to do, is to write a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow&quot;&gt;FieldType&lt;/a&gt; that extends the stock &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/EntriesFieldType&quot; rel=&quot;nofollow&quot;&gt;EntriesFieldType&lt;/a&gt; class. The only thing your custom fieldtype needs to do, is to add an additional criteria to the query that pulls entries for input selection. Don't worry, this is going to be quite easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quickest way to get started is to use the excellent &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;Plugin Factory&lt;/a&gt; to scaffold your plugin. Call it whatever you like. Don't enable any of the plugin components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download and unzip your plugin, and put the folder in your &lt;code&gt;craft/plugins&lt;/code&gt; directory. Add a sub folder called &lt;code&gt;fieldtypes&lt;/code&gt; to your plugin's directory (i.e. &lt;code&gt;{pluginhandle}/fieldtypes&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a new file in the &lt;code&gt;fieldtypes&lt;/code&gt; directory called &lt;code&gt;MyPlugin_RestrictedEntriesFieldType.php&lt;/code&gt; or the like (where &lt;code&gt;MyPlugin&lt;/code&gt; should be replaced with the real name for your plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside that file, paste the following code (remember to change the class name to whatever you called the file):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_RestrictedEntriesFieldType extends EntriesFieldType&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        // This can be whatever you want, but avoid &quot;Entries&quot;&#xA;        return Craft::t('Restricted Entries');&#xA;    }&#xA;&#xA;    protected function getInputSelectionCriteria()&#xA;    {&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        return array(&#xA;            'authorId' =&amp;gt; $user-&amp;gt;id,&#xA;        );&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's the whole thing; your custom fieldtype. Save the file and install your plugin. Convert whatever relevant Entries fields you may have to your new &quot;Restricted Entries&quot; fieldtype.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code above should be fairly self explanatory – it extends EntriesFieldType which means it'll work exactly like the stock Entries field (and any fields can also be converted to and from the Entries fieldtype without losing data). The only difference is that your custom fieldtype includes the &lt;code&gt;authorId&lt;/code&gt; criteria when Craft pulls entries for input selection, where the &lt;code&gt;authorId&lt;/code&gt; needs to match the currently logged in user's ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need similar fields for other element types, you can just repeat the process – i.e. for a restricted Categories field, you'd create an additional file called &lt;code&gt;myplugin/fieldtypes/MyPlugin_RestrictedCategoriesFieldType.php&lt;/code&gt; that extends &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/CategoriesFieldType&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CategoriesFieldType&lt;/code&gt;&lt;/a&gt;, and include the same &lt;code&gt;getInputSelectionCriteria()&lt;/code&gt; method as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a bit of flexibility, you can also limit the restrictive behaviour to non-admins – i.e., if an &lt;em&gt;admin&lt;/em&gt; is editing a post, that user should able to select entries authored by all users:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function getInputSelectionCriteria()&#xA;{&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    if (!$user-&amp;gt;admin) {&#xA;        return array(&#xA;            'authorId' =&amp;gt; $user-&amp;gt;id,&#xA;        );&#xA;    }&#xA;    return array();&#xA;}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, a different option is to set the &lt;code&gt;authorId&lt;/code&gt; criteria to the current entry's (or category's) author's ID, instead of the currently logged in user's ID. This is more flexible and perhaps more future proof, in that any user that has permission to edit the entry will only be able to select entries that have the same author as the entry's original author. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, if the entry hasn't been saved yet it won't have an author, so this code should fall back to using the current user's ID for new entries, as above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function getInputSelectionCriteria()&#xA;{&#xA;    if ($this-&amp;gt;element) {&#xA;        return array(&#xA;            'authorId' =&amp;gt; $this-&amp;gt;element-&amp;gt;authorId,&#xA;        );&#xA;    }&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    return array(&#xA;        'authorId' =&amp;gt; $user-&amp;gt;id,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-04T15:23:41.537" LastActivityDate="2016-08-04T15:23:41.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16206" PostTypeId="2" ParentId="10221" CreationDate="2016-08-04T10:03:14.057" Score="2" Body="&lt;p&gt;I'm a bit late to the party here, but for future reference you can get the widget id by looking at the &lt;code&gt;data-id&lt;/code&gt; attribute of the widget HTML, or by using &lt;code&gt;$this-&amp;gt;model-&amp;gt;id&lt;/code&gt; in the widget code.&lt;/p&gt;&#xA;" OwnerUserId="5304" LastEditorUserId="5304" LastEditDate="2016-08-04T10:11:43.260" LastActivityDate="2016-08-04T10:11:43.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16207" PostTypeId="1" CreationDate="2016-08-04T10:57:46.017" Score="0" ViewCount="68" Body="&lt;p&gt;I have created a new entry in which user can also add images(already uploaded or new upload)&lt;/p&gt;&#xA;&lt;p&gt;I can save entry successfully if I don't add any images to it. When I add any image and try to save the entry following error is displayed-&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Craft\Exception&lt;/p&gt;&#xA;&lt;p&gt;This file type is not allowed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Earlier different error was displayed which was related to &lt;strong&gt;imagick&lt;/strong&gt;.&#xA;Since I have installed imagick and it's php extension, the error is replaced by this new error.&lt;/p&gt;&#xA;" OwnerUserId="5469" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-08-04T20:14:32.860" Title="Craft\Exception on saving entries having images" Tags="&lt;entry&gt;&lt;image&gt;&lt;saveentry&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16208" PostTypeId="1" CreationDate="2016-08-04T13:07:34.077" Score="0" ViewCount="55" Body="&lt;p&gt;I currently have the following code as part of the address form in Craft Commerce. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;label class=&quot;label&quot; for=&quot;{{ modelName }}-firstName&quot;&amp;gt;First Name (*)&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-firstName&quot; {% if model and model.getErrors('firstName') %}class=&quot;has-error&quot;{% endif %} name=&quot;{{ modelName }}[firstName]&quot; value=&quot;{{ model ? model.firstName : '' }}&quot;&amp;gt;&#xA;        {% if model and model.getErrors('firstName') %}&#xA;            &amp;lt;span class=&quot;has-error&quot;&amp;gt;&#xA;                &amp;lt;svg role=&quot;img&quot; class=&quot;icon&quot; title=&quot;Error Icon&quot;&amp;gt;&#xA;                    &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-error&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                &amp;lt;/svg&amp;gt;&#xA;                {{ model.getError('firstName') }}&#xA;            &amp;lt;/span&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This repeats several times for each form item (surname, address1, address2, postcode, country etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to reuse the error code part for other areas on the website, when errors occur, be this discount code box, login form etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&quot;has-error&quot;&amp;gt;&#xA;    &amp;lt;svg role=&quot;img&quot; class=&quot;icon&quot; title=&quot;Error Icon&quot;&amp;gt;&#xA;        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-error&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;    &amp;lt;/svg&amp;gt;&#xA;    {{ model.getError('firstName') }} //This part will change based on application.&#xA;&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is how can I extract this part to ensure it is DRYer and not repeat it over and over? So if I want to change the class, the icon etc, I won't have loads of separate pieces of code to update.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-08-04T13:07:34.077" Title="Error Icon and DRYer Code" Tags="&lt;plugin-craftcommerce&gt;&lt;best-practice&gt;&lt;dry&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16209" PostTypeId="1" AcceptedAnswerId="16214" CreationDate="2016-08-04T14:47:36.670" Score="1" ViewCount="131" Body="&lt;p&gt;I'm using the &lt;code&gt;saveRelations&lt;/code&gt; method in the &lt;code&gt;RelationsService&lt;/code&gt; to save entry relationships in a plugin I'm working on. Everything is working as expected, however, &lt;code&gt;saveRelations&lt;/code&gt; is returning &lt;code&gt;null&lt;/code&gt; on success, which seems odd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a portion of the code I'm working with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCategoryRelation(CategoryModel $category, EntryModel $entry)&#xA;{&#xA;    $field        = $craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('handle');&#xA;    $handle       = $field-&amp;gt;handle;&#xA;    $relations    = $category-&amp;gt;$handle;&#xA;    $relationsIds = [];&#xA;&#xA;    /**&#xA;     * Get the ids for the relations.&#xA;     */&#xA;    foreach ($relations as $entry) {&#xA;        $relationsIds[] = $entry-&amp;gt;id;&#xA;    }&#xA;&#xA;    if (!in_array($entry-&amp;gt;id, array_values($relationsIds))) {&#xA;        $relationsIds[] = $entry-&amp;gt;id;&#xA;        return craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $category, $relationsIds);&#xA;    } else {&#xA;        return [&#xA;            'error' =&amp;gt; 'Entry already saved.',&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="198" LastEditorUserId="198" LastEditDate="2016-08-04T14:54:07.840" LastActivityDate="2016-08-04T19:46:11.573" Title="`saveRelations` returning `null`" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16210" PostTypeId="1" CreationDate="2016-08-04T15:56:22.113" Score="4" ViewCount="450" Body="&lt;p&gt;I am building a transactional email platform for my users.&lt;br&gt;&#xA;Users will subscribe to a digital program and receive daily emails depending on their profile and parameters.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This email sending will be:&lt;br&gt;&#xA; - time based&lt;br&gt;&#xA; - and user subscription based&lt;br&gt;&#xA; (and not event based)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I found these plugins:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow&quot;&gt;Sprout Email&lt;/a&gt; &gt; for marketing campaigns and email notifications triggered by events&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;Postmaster for Craft CMS&lt;/a&gt; &gt; looks more promising for my need but the plugin seems not maintained anymore (last commit was two years ago) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So do you know another recent Craft plugin to do transactional emails?&lt;br&gt;&#xA;Or would you recommend another approach/idea?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2016-08-04T19:46:33.823" LastActivityDate="2016-08-04T19:46:33.823" Title="How to build a transactional email platform with Craft" Tags="&lt;plugins&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16211" PostTypeId="1" AcceptedAnswerId="16212" CreationDate="2016-08-04T16:12:16.127" Score="2" ViewCount="147" Body="&lt;p&gt;I'm working a plugin and part of the task is to grab the entry based on the current URI using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getRequestUri()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to grab the entry based on the URI from the request?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2016-08-04T16:12:16.127" Title="Retrieving an entry based on the request URI in a plugin controller" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16212" PostTypeId="2" ParentId="16211" CreationDate="2016-08-04T16:12:16.127" Score="2" Body="&lt;p&gt;You can grab the current entry using the &lt;code&gt;$uri = craft()-&amp;gt;request-&amp;gt;getRequestUri()&lt;/code&gt; which will return the URI in a format like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/path/to/uri&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To grab the entry, its easiest to grab the element first, based on the URI, using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getElementByUri($uri)&lt;/code&gt;. However, this will not work because of the beginning slash that is returned by &lt;code&gt;getRequestUri&lt;/code&gt;. So you must remove the slash using &lt;code&gt;ltrim&lt;/code&gt; like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$uri = ltrim(craft()-&amp;gt;request-&amp;gt;getRequestUri(), '/')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the URI, minus the beginning slash (&lt;code&gt;path/to/uri&lt;/code&gt;), you can use &lt;code&gt;$element = craft()-&amp;gt;elements-&amp;gt;getElementByUri($uri)&lt;/code&gt; to return the element and then grab the entry using &lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($element-&amp;gt;id)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were going to need this often, you can place it in a helper method on the controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function getEntryByRequestUri()&#xA;{&#xA;    // remove the first trailing slash&#xA;    $uri = ltrim(craft()-&amp;gt;request-&amp;gt;getRequestUri(), '/');&#xA;    $element = craft()-&amp;gt;elements-&amp;gt;getElementByUri($uri);&#xA;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($element-&amp;gt;id);&#xA;    if ($entry == null) {&#xA;        // log something and do something&#xA;    }&#xA;    return $entry;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastActivityDate="2016-08-04T16:12:16.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16213" PostTypeId="2" ParentId="16210" CreationDate="2016-08-04T19:20:58.517" Score="5" Body="&lt;p&gt;This answer will focus on using Sprout Email for transactional emails.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Transactional Emails&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First, a comment on semantics. I feel the question above is drawing a distinction between two types of transactional emails: triggered and automated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Triggered emails are a one-off, context-specific email that get sent to a user when an event is triggered by a user's interaction with the application. Automated emails, which seems to be the focus of the question, are transactional in the sense that they are a one-to-one email to a user, however the email is not triggered by a specific event, but by an automated process. A user takes an action to be placed in a specific category, and transactional emails are sent to all users in that category on a specified schedule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Triggered emails are fairly easy to build a UI around in Craft. Automated emails are harder, as you probably have to rely on either tasks (which can't be reliably scheduled at a specific time) or cron-jobs (which require extra steps by web developers to be setup).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sprout Email and triggered emails&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;While the default Sprout Email Notifications are mostly User and Entry events, Sprout Email is not at all limited to User and Entry events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Email has a flexible &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events&quot; rel=&quot;noreferrer&quot;&gt;Custom Event API&lt;/a&gt; where you can create custom triggers for the events you need to support with as many settings as you wish to control them with. An example can be seen in Sprout Forms, which adds a trigger for &lt;em&gt;When a form entry is submitted&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Email allows you to manage the Triggered Email content right in Craft alongside your other content and all the admin needs to do is select the event which should trigger them being sent.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sprout Email and automated emails&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You'll have to create a custom script and setup a cron to ping your script to send out emails on the schedule you require, but Sprout Email can support (and is in use for) advanced transactional campaigns that allow content editors to easily manage email content in a Craft-friendly way, and programmatically send out transactional email on a regular schedule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can programmatically trigger a Notification Email using the Sprout Email service layer. Notification Emails are sent via the &lt;code&gt;SproutEmail_DefaultMailerService&lt;/code&gt; using the &lt;code&gt;sendNotification()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;sproutEmail_defaultMailer-&amp;gt;sendNotification($campaign, $object);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;$campaign&lt;/code&gt; needs to be a &lt;code&gt;SproutEmail_CampaignModel&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;$object&lt;/code&gt; is any object that you want to make available to your email templates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At some point we'll probably add additional support in Sprout Email around dynamic list management and automated emails. Right now, it's quite possible, it just requires a custom integration that fits your needs.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-04T19:20:58.517" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16214" PostTypeId="2" ParentId="16209" CreationDate="2016-08-04T19:46:11.573" Score="1" Body="&lt;p&gt;You're getting &lt;code&gt;null&lt;/code&gt; back simply because the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/RelationsService.php#L29&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;saveRelations()&lt;/code&gt; method&lt;/a&gt; doesn't actually return anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to return &lt;code&gt;true&lt;/code&gt; from &lt;code&gt;addCategoryRelation&lt;/code&gt; if the relations are successfully saved, or possibly an error message (or &lt;code&gt;false&lt;/code&gt;) if they aren't, you can consider wrapping the call to &lt;code&gt;saveRelations()&lt;/code&gt; in a try/catch block – something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addCategoryRelation(CategoryModel $category, EntryModel $entry)&#xA;{&#xA;    ...&#xA;    if (in_array($entry-&amp;gt;id, array_values($relationsIds))) {&#xA;        return [&#xA;            'error' =&amp;gt; 'Entry already saved.',&#xA;        ];&#xA;    }&#xA;    try {&#xA;        $relationsIds[] = $entry-&amp;gt;id;&#xA;        return craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $category, $relationsIds);&#xA;    } catch (\Exception $e) {&#xA;        // Something went wrong – return `false` or an error message, log the exception?&#xA;        return false;&#xA;    }&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-04T19:46:11.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16215" PostTypeId="2" ParentId="16204" CreationDate="2016-08-04T20:06:40.390" Score="1" Body="&lt;p&gt;The problem is that your category slugs (which double as array keys) are integers (i.e. years). I'm not sure exactly what happens, but Twig doesn't handle integer keys very well and actually seems to &quot;normalize&quot; the keys (i.e. the first numeric key, for example &lt;code&gt;2012&lt;/code&gt;, will become &lt;code&gt;0&lt;/code&gt;, the second numeric key will be &lt;code&gt;1&lt;/code&gt;, etc – this happens to the numeric keys even if you have both numeric and non-numeric keys in your array).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, the workaround is to prefix the slugs with an arbitrary character (or string) when you use them as array keys, and then remove that arbitrary character when you print the key later (i.e. your &lt;code&gt;catSlug&lt;/code&gt; variable). Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByCat = entriesByCat|merge({ ('%'~cat.slug): entries }) %}&#xA;&#xA;...&#xA;&#xA;&amp;lt;div id=&quot;{{ catSlug|trim('%') }}&quot; class=&quot;tab-block&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-04T20:11:42.353" LastActivityDate="2016-08-04T20:11:42.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16216" PostTypeId="2" ParentId="16207" CreationDate="2016-08-04T20:14:32.860" Score="2" Body="&lt;p&gt;I'm going to go out on a limb and say you're trying to upload a file type that isn't allowed under that Asset fields &quot;Restrict Allowed File Types?&quot; section.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-04T20:14:32.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16217" PostTypeId="1" CreationDate="2016-08-04T20:40:34.647" Score="1" ViewCount="124" Body="&lt;p&gt;So I have a categories with sub categories. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Anakena (Wine Brand Name)&#xA;-Ona (Wine line)&#xA;&#xA;--product one&#xA;--product two&#xA;&#xA;-Tama (Wine Line)&#xA;&#xA;--product one&#xA;--product two&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Im trying to make links to the specific lines. So I want to add Anakena under a field, and have it display an ul of Ona, Tama, etc. all the subcategories within Anakena. Once I click on this link, will take me to the category page with all of Ona's produtcs, etc.. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in craft.categories.group('products').slug('anakena') %}&#xA;   &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;a&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this it gives me the main category, Anakena, how can I display the child categories assigned to Anakena.? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4929" LastActivityDate="2016-08-05T09:02:20.387" Title="Category listing." Tags="&lt;category&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16218" PostTypeId="1" AcceptedAnswerId="16220" CreationDate="2016-08-04T22:58:49.000" Score="2" ViewCount="159" Body="&lt;p&gt;I'm trying to build a front end to display entries collected through Sprout Forms. I want to create a list of all entry titles that can be clicked through to see the full entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can list a single entry, or all entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for formEntry in craft.sproutForms.entries.formHandle('entry') %}&#xA;  {{ formEntry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I try to create a link, {{ formEntry.url }} doesn't work. I'm not entirely sure if this is a Sprout Forms issue or a Craft routing issue, or if I'm just missing something obvious&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="115" LastEditDate="2016-08-04T23:47:03.260" LastActivityDate="2016-08-04T23:47:03.260" Title="Sprout Forms -- How to link to individual entries on the front-end" Tags="&lt;elementcriteriamodel&gt;&lt;routing&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16219" PostTypeId="1" CreationDate="2016-08-04T23:32:50.807" Score="1" ViewCount="665" Body="&lt;p&gt;I have an issue that I really do not expect. When using the image function in the Redactor wysiwyg editor, images come up broken. In the editor, and in the rendered entry. All that is missing is a / in the img tag and they work. So redactor is rendering,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;assets/page/AdobeStock_53786360.jpeg&quot; alt=&quot;AdobeStock_53786360.jpeg#asset:99&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and but what it needs is the beginning /&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;/assets/page/AdobeStock_53786360.jpeg&quot; alt=&quot;AdobeStock_53786360.jpeg#asset:99&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have I configured something else wrong?&lt;/p&gt;&#xA;" OwnerUserId="4480" LastEditorUserId="45" LastEditDate="2016-08-08T04:49:28.407" LastActivityDate="2019-03-03T05:10:58.033" Title="Images Broken In Redactor" Tags="&lt;redactor&gt;&lt;image&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16220" PostTypeId="2" ParentId="16218" CreationDate="2016-08-04T23:46:09.733" Score="2" Body="&lt;h2&gt;A note on Elements&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Craft allows plugins to create custom Element Types. Elements have the option to support URIs, but it is not required. Out of the box, Craft currently has 7 Element Types and only two of them (Entries, Categories) support URIs.  Here's a good &lt;a href=&quot;https://straightupcraft.com/articles/master-the-element-types-craft-cms&quot; rel=&quot;nofollow&quot;&gt;overview of the default Elements&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sprout Form Element Types and URIs&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms adds two new Elements to Craft. The &lt;code&gt;SproutForms_Form&lt;/code&gt; Element and the &lt;code&gt;SproutForms_Entry&lt;/code&gt; Element both which do not support URIs simply because we didn't feel there was a strong use case for them to be implemented for most form submission scenarios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it may not make sense to support URIs for all &lt;code&gt;SproutForm_Entry&lt;/code&gt; Elements out of the box, you can still create a way for those Elements to be linked to in your templates, you will just have to do it manually.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How to manually create URIs for Sprout Form Entry Elements&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To customize Craft to handle custom URLs for an Element that doesn't support URLs (of even for an Element that supports that that you need to do something fancy with), here is a rough example of the steps needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loop through your Elements and output the URL you wish them to have to link to your Entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/submissions/{{ formEntry.id }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will then need to &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;setup a route&lt;/a&gt; to tell Craft which template it should load when it encounters a URL like that. You can create a route in the CP or in the &lt;code&gt;craft/config/routes.php&lt;/code&gt; file. This route tells Craft to load the &lt;code&gt;submission/_entry.html&lt;/code&gt; template each time a URL matches &lt;code&gt;submission/ANYTHING&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'submissions/(?P&amp;lt;formEntryId&amp;gt;.*)' =&amp;gt; 'submissions/_entry'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;submissions/_entry&lt;/code&gt; template, you will need to use the ID information in the URL to query for the Form Entry that you wish to display:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.sproutForms.getEntryById(formEntryId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example, we're able to use the &lt;code&gt;formEntryId&lt;/code&gt; variable because we setup our route to assign the second segment of the URL to the value &lt;code&gt;formEntryId&lt;/code&gt;. If you setup your route in the control panel, you may need to grab the ID using &lt;code&gt;getSegment&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set formEntryId = craft.request.getSegment(2) %}&#xA;{% set entry = craft.sproutForms.getEntryById(formEntryId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-04T23:46:09.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16221" PostTypeId="1" AcceptedAnswerId="16226" CreationDate="2016-08-05T00:14:44.403" Score="4" ViewCount="169" Body="&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.section('products').relatedTo(object).first.uri }}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in this case, I need to use the extended &lt;code&gt;relatedTo&lt;/code&gt; property, which includes curly braces:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries({relatedTo: {targetElement: object, field: 'productConfigs'}}).first.uri }}/{{ object.slug }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because of the way &lt;code&gt;renderObjectTemplate&lt;/code&gt; replacement &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow&quot;&gt;seems to happen&lt;/a&gt;, the braces get screwed up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to work around this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd actually rather do this in PHP/plugin if possible, but I'm not sure if a relevant hook/event exists.&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="57" LastEditDate="2016-08-05T04:41:45.710" LastActivityDate="2016-08-05T19:30:23.380" Title="Trouble with curly braces in Entry URL Format / renderObjectTemplate" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16222" PostTypeId="2" ParentId="16221" CreationDate="2016-08-05T00:35:09.180" Score="2" Body="&lt;p&gt;I'm not sure this is the best answer, but since others can post answers too:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution to this may be to disable the Section setting &lt;em&gt;Entries in this section have their own URLs&lt;/em&gt; and manage your URLs manually using a custom route and the appropriate template logic. &lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-05T00:35:09.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16224" PostTypeId="2" ParentId="16217" CreationDate="2016-08-05T09:02:20.387" Score="1" Body="&lt;p&gt;By far, the easiest way to do this is to use the &lt;a href=&quot;https://craftcms.com/docs/templating/nav#showing-children&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% children %}&lt;/code&gt;&lt;/a&gt; tag which is available inside a &lt;code&gt;{% nav %}{% endnav %}&lt;/code&gt; tag pair, i.e. something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav category in craft.categories.group('products') %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;a&amp;gt;&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: The above will print a recursive, unordered list of all your top level &lt;code&gt;product&lt;/code&gt; categories (i.e. &quot;Akana&quot;, &quot;Tama&quot; etc) and their children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your current code, you won't actually be able to use the &lt;code&gt;{% children %}&lt;/code&gt;, because you have a &lt;code&gt;slug('akana')&lt;/code&gt; parameter on your &lt;code&gt;craft.categories&lt;/code&gt; query for some reason. Using the &lt;code&gt;slug()&lt;/code&gt; parameter means that Craft will &lt;em&gt;only pull categories with that particular slug&lt;/em&gt; – in other words, the child category &quot;Ona&quot; won't be returned by your query and the &lt;code&gt;{% children %}&lt;/code&gt; tag will output nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have to use the &lt;code&gt;slug&lt;/code&gt; parameter, there's no real use to the `{% nav %} tag (it's designed for recursive, hierarchical lists).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more &quot;manual&quot; approach, you can also get to a categories children by doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('products').slug('akana').first() %}&#xA;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% set children = category.children %}&#xA;{% for child in children %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One gotcha to note is that &lt;code&gt;category.children&lt;/code&gt; will pull all your category's children, from all levels. To get children for different levels, you can use the &lt;code&gt;level&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set childrenA = category.children.level(2) %}&#xA;{% set childrenB = category.children.level(3) %)    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-05T09:02:20.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16225" PostTypeId="1" AcceptedAnswerId="16247" CreationDate="2016-08-05T10:58:42.200" Score="2" ViewCount="2344" Body="&lt;p&gt;What is the best way to get a random number within a certain range?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made something but I guess there is a better way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example I want to position some elements randomly. This approach works, but I have to define a variable for each value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomizr = range(10, 90) %}&#xA;&#xA;{% set randomHeight1 = shuffle(randomizr) | first %}&#xA;{% set randomWidth1 = shuffle(randomizr) | first %}&#xA;&#xA;{% set randomHeight2 = shuffle(randomizr) | first %}&#xA;{% set randomWidth2 = shuffle(randomizr) | first %}&#xA;&#xA;{% set randomHeight3 = shuffle(randomizr) | first %}&#xA;{% set randomWidth3 = shuffle(randomizr) | first %}&#xA;&#xA;{% set randomHeight4 = shuffle(randomizr) | first %}&#xA;{% set randomWidth4 = shuffle(randomizr) | first %}&#xA;&#xA;{% set randomHeight5 = shuffle(randomizr) | first %}&#xA;{% set randomWidth5 = shuffle(randomizr) | first %}&#xA;&#xA;&amp;lt;div class=&quot;sandbox&quot;&amp;gt;&#xA;    &amp;lt;div style=&quot;left: {{ randomHeight1 }}%; top: {{ randomWidth1 }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div style=&quot;left: {{ randomHeight2 }}%; top: {{ randomWidth2 }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div style=&quot;left: {{ randomHeight3 }}%; top: {{ randomWidth3 }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div style=&quot;left: {{ randomHeight4 }}%; top: {{ randomWidth4 }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div style=&quot;left: {{ randomHeight5 }}%; top: {{ randomWidth5 }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this somehow possible without writing each variable manually?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-08-05T20:06:05.590" Title="Random Number from range" Tags="&lt;array&gt;&lt;range&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16226" PostTypeId="2" ParentId="16221" CreationDate="2016-08-05T11:16:55.290" Score="6" Body="&lt;p&gt;It's not documented so I guess not officially supported, but you can use template variables in the URL formats. For example if you had a &lt;code&gt;UrlFormats&lt;/code&gt; plugin, you could use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class UrlFormatsVariable&#xA;{&#xA;    // Use in the URL Format box:&#xA;    // &#xA;    //  {{ craft.urlFormats.yourSectionHandle(object) }}&#xA;    public function yourSectionHandle($entry)&#xA;    {&#xA;        // Craft checks the URL format with an array &quot;object&quot; first, to see if there's a {slug},&#xA;        // and so whether it should be checked for uniqueness and incremented if necessary.&#xA;        if (!$entry || !($entry instanceof EntryModel))&#xA;        {&#xA;            return '{slug}';&#xA;        }&#xA;&#xA;        $relation = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)&#xA;            -&amp;gt;relatedTo(array(&#xA;                'targetElement' =&amp;gt; $entry,&#xA;                'field'         =&amp;gt; 'productConfigs',&#xA;            ))-&amp;gt;first();&#xA;&#xA;        if (!$relation)&#xA;        {&#xA;            // throw an exception or default to something&#xA;        }&#xA;&#xA;        return $relation-&amp;gt;uri.'/'.$entry-&amp;gt;slug;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can keep your URL Format and Nested URL Format inputs cleaner:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.urlFormats.yourSectionHandle(object) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-08-05T11:16:55.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16227" PostTypeId="1" AcceptedAnswerId="16229" CreationDate="2016-08-05T11:33:51.633" Score="1" ViewCount="71" Body="&lt;p&gt;I have a comment section with comments and subcomments. A comment relates directly to the blog post while a subcomment relates to a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have the following problem on the entry page: Showing the comments only is not a problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for comment in craft.entries({&#xA;    section: comments,&#xA;    relatedTo: { targetElement: entry, field: &quot;relentry&quot; },&#xA;    order:     &quot;sortOrder&quot;,&#xA;    limit:     null&#xA;}) %}&#xA;    &amp;lt;p&amp;gt;X&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I insert the subcomments, I get the error message &lt;code&gt;Unexpected &quot;}&quot;&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for comment in craft.entries({&#xA;    section: comments,&#xA;    relatedTo: { targetElement: entry, field: &quot;relentry&quot; },&#xA;    order:     &quot;sortOrder&quot;,&#xA;    limit:     null&#xA;}) %}&#xA;    &amp;lt;p&amp;gt;X&amp;lt;/p&amp;gt;&#xA;    {% for subcomment in craft.entries({&#xA;        section: comments,&#xA;        relatedTo: { targetElement: comment, field: &quot;relentry&quot; },&#xA;        order:     &quot;sortOrder&quot;,&#xA;        limit:     null&#xA;    }) %}&#xA;        &amp;lt;p&amp;gt;Y&amp;lt;/p&amp;gt;&#xA;    {% endfor % }&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-08-05T12:31:09.263" Title="Error in case of nested for loops" Tags="&lt;forloop&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16228" PostTypeId="1" AcceptedAnswerId="16240" CreationDate="2016-08-05T12:12:37.623" Score="1" ViewCount="182" Body="&lt;p&gt;Stuck on a problem at the moment… trying to output a Rich Text field (copy) from an entry. The copy is contained in a matrix field (so: Entry -&gt; Matrix Field -&gt; Copy Field) but I can’t access it no matter what I try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matrix Field Type is &lt;code&gt;genericContent&lt;/code&gt;, the entry is &lt;code&gt;relatedContent&lt;/code&gt; and the copy field is simply named &lt;code&gt;copy&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I currently have, I've tried various other options but none work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry.relatedContent %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% switch entries|length %}&#xA;        {% case '1' %}&#xA;            one&#xA;        {% case '2' %}&#xA;            &amp;lt;article class=&quot;t{% if loop.first %} t--tall{% endif %}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;subtitle&quot;&amp;gt;{{ entry.sectionTag.first }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ entry.genericContent.copyMatrix.copy.first }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/article&amp;gt;&#xA;            &amp;lt;pre&amp;gt;{{dump(entry.genericContent.copyMatrix.copy.first)}}&amp;lt;/pre&amp;gt;&#xA;            &amp;lt;br&amp;gt;&#xA;        {% case '3' %}&#xA;            three&#xA;        {% case '4' %}&#xA;            four&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5481" LastEditorUserId="57" LastEditDate="2016-08-05T18:07:53.890" LastActivityDate="2016-08-05T18:07:53.890" Title="Can't access data in Matrix field" Tags="&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16229" PostTypeId="2" ParentId="16227" CreationDate="2016-08-05T12:31:09.263" Score="2" Body="&lt;p&gt;It's probably your second-from-last line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% endfor % }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-08-05T12:31:09.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16230" PostTypeId="1" AcceptedAnswerId="16232" CreationDate="2016-08-05T13:44:02.100" Score="2" ViewCount="688" Body="&lt;p&gt;When a user saves a front-end form, and has a custom field with a set value, I want to send an email - and set another field on the users profile to indicate a mail has been sent, so that if the form is saved again, another email will not be sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this I have a small plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        $consentGiven = craft()-&amp;gt;request-&amp;gt;getPost('fields.consentGiven', 'no');&#xA;        $notificationAlreadySent = $user-&amp;gt;notificationAlreadySent;&#xA;&#xA;        if($consentGiven == 'yes' and $notificationAlreadySent != '1') {&#xA;            ... SEND EMAIL CODE ...&#xA;&#xA;            // now set the notificationAlreadySent to '1' so we dont get in this conditional next time&#xA;                $userModel = new UserModel();&#xA;&#xA;                // why we need to manually read these to write the same values I don't know&#xA;                $userModel-&amp;gt;id        = $user-&amp;gt;id;&#xA;                $userModel-&amp;gt;username  = $user-&amp;gt;username;&#xA;                $userModel-&amp;gt;firstName = $user-&amp;gt;firstName;&#xA;                $userModel-&amp;gt;lastName  = $user-&amp;gt;lastName;&#xA;                $userModel-&amp;gt;email     = $user-&amp;gt;email;&#xA;&#xA;                // update the one field we actually wanted to update in the first place&#xA;                $userModel-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                    'notificationAlreadySent' =&amp;gt; '1'&#xA;                ));&#xA;&#xA;                // Actually save it&#xA;                craft()-&amp;gt;users-&amp;gt;saveUser($userModel);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Problem: This ends up in a loop because it's watching the onSaveUser event, and inside that event it's calling saveUser. I figure I actually need the onBeforeSaveUser event, and I need to tweak the value of that field there so that it'll &quot;just work&quot; once it gets to the saveUser action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being the case I've tried this instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;        $consentGiven = craft()-&amp;gt;request-&amp;gt;getPost('fields.consentGiven', 'no');&#xA;        $notificationAlreadySent = $user-&amp;gt;notificationAlreadySent;&#xA;&#xA;        if($consentGiven == 'yes' and $notificationAlreadySent != '1') {&#xA;            ... SEND EMAIL CODE ...&#xA;&#xA;            // now set the notificationAlreadySent to '1' so we dont get in this conditional next time&#xA;                $user-&amp;gt;fields['notificationAlreadySent'] = '1';&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;New problem: The syntax $user-&gt;fields['notificationAlreadySent'] = '1'; doesn't appear to be correct, and I can not work out how to reference that property...&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-08-05T14:48:15.210" LastActivityDate="2016-08-05T14:48:15.210" Title="Editing a custom user field onBeforeSave" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16231" PostTypeId="1" AcceptedAnswerId="16282" CreationDate="2016-08-05T13:54:02.303" Score="1" ViewCount="82" Body="&lt;p&gt;I'm trying to create a confirmation page for a Sprout form, where I want to check if a certain field is present, and if so, check for a value, so I can return a message based on that value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using lastEntry, and am able to pull the valid fields in without a problem, but it's having issues checking whether the field is defined. I'm currently using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastEntry = craft.sproutForms.lastEntry() %}&#xA;{% set qualified = true %}&#xA;{% if lastEntry.fieldName is defined and lastEntry.fieldName == 'no' %}&#xA;    {% set qualified = false %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use the code above, and the field has not been used in the particular form, I see:&#xA;&lt;code&gt;Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named &quot;fieldName&quot;.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears Craft is seeing the field as defined, but not. Anyone have any ideas on what I could do to figure this out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2016-08-09T15:08:32.317" Title="Sprout Forms Confirmation Page Field Not Defined" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16232" PostTypeId="2" ParentId="16230" CreationDate="2016-08-05T14:47:54.633" Score="5" Body="&lt;p&gt;Solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;fields['notificationAlreadySent'] = '1';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'notificationAlreadySent' =&amp;gt; 1&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of note: I find this sort of thing extremely hard to research. I know what I want to do (edit the value of a field in an event via the onBefore listener) but documentation on &lt;em&gt;how&lt;/em&gt; to do that seems non-existent. I keep finding this sort of problem with developing Craft plugins - that unless you know the internals, you're really hard pressed to even articulate what you're wanting to search for in order to find a solution.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-08-05T14:47:54.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16233" PostTypeId="1" CreationDate="2016-08-05T15:05:48.790" Score="1" ViewCount="538" Body="&lt;p&gt;I am making a plugin which has a controller to be called every hour.&lt;br&gt;&#xA;My server environment is using &lt;strong&gt;Anacron&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wrote this anacron job:&lt;br&gt;&#xA;&lt;code&gt;1@hourly 0 cron.hourly wget http://www.mydomain.com/actions/controlername&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I got 2 questions:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to log my cron job into a file on the server? (so I can follow when it has been triggered)&lt;/li&gt;&#xA;&lt;li&gt;What is the best way to log and follow my controller actions in Craft CP side?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2016-10-28T13:48:24.650" Title="Call Craft controller with cron job" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;cron&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16234" PostTypeId="1" AcceptedAnswerId="16237" CreationDate="2016-08-05T15:36:52.933" Score="1" ViewCount="94" Body="&lt;p&gt;As of July 2016, PHP branch 5.5 is unsupported. The PHP version my server currently is running is 5.5.9 which implies that the server will not receive any security updates going forwards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm told that Craft recommends using 5.7. Is there any danger that parts of my website may stop working if the PHP is updated?&lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="45" LastEditDate="2016-08-05T16:52:52.890" LastActivityDate="2016-08-06T03:43:36.730" Title="Is there any danger to Craft from upgrading from PHP 5.5 to PHP 5.7?" Tags="&lt;php&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16235" PostTypeId="1" AcceptedAnswerId="16241" CreationDate="2016-08-05T15:39:12.607" Score="1" ViewCount="114" Body="&lt;p&gt;This should have been simple.  A client's site is required to display current weather observation data retrieved via XML from w1.weather.gov.  My solution was to use the on-demand features of FeedMe in a twig template to accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, weather.gov recently began requiring inclusion of a user agent string in the header to identify the requestor of any XML feed.  If no user agent string is present, it returns error 403.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to configure Craft or FeedMe to send a custom user agent string in all GET requests for external data?&lt;/p&gt;&#xA;" OwnerUserId="4170" LastEditorUserId="57" LastEditDate="2016-08-05T17:51:56.903" LastActivityDate="2016-08-05T17:51:56.903" Title="FeedMe plugin and weather.gov XML" Tags="&lt;plugin-feedme&gt;&lt;xml&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16236" PostTypeId="1" CreationDate="2016-08-05T16:20:06.490" Score="0" ViewCount="1145" Body="&lt;p&gt;I'm totally new to Craft (having previously developed on Silverstripe) but have read through the basic docs, have a local version installed and have set-up a HelloWorld plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am now wondering is how to produce a flexible layout that provides editors with &quot;drag &amp;amp; drop&quot; components each in, for instance, Bootstrap style rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance a page layout that allows components for &#xA;- an advert&#xA;- a list of customers&#xA;- a block of custom text with a custom image etc. etc. &#xA;(e.g. &lt;a href=&quot;https://www.salesforceiq.com/&quot; rel=&quot;nofollow&quot;&gt;https://www.salesforceiq.com/&lt;/a&gt; which is Craft driven I believe). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The editor provides the relevant content for each custom component and can drag &amp;amp; drop them around to change their order as required &amp;amp; that order is reflected on the front end.  And those types of pages can appear anywhere in the site structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing the answer is a section with a Matrix field, but I'm struggling to make the leap on how that can allow it to call on a set of custom fields that each call on custom templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5484" LastActivityDate="2016-08-08T12:39:17.057" Title="Drag and drop-able &quot;components&quot;" Tags="&lt;matrix&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16237" PostTypeId="2" ParentId="16234" CreationDate="2016-08-05T16:52:01.870" Score="3" Body="&lt;p&gt;&lt;strong&gt;Don't worry, you should be fine.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently supports &lt;a href=&quot;https://craftcms.com/docs/requirements&quot; rel=&quot;nofollow&quot;&gt;a minimum of PHP 5.3&lt;/a&gt;. Any higher version of PHP is also compatible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Craft 3 ships (late 2016 / early 2017), it will require a minimum of PHP 5.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side note... If you're about to upgrade PHP, &lt;strong&gt;I highly recommend switching to PHP 7&lt;/strong&gt;. The performance boost is notable, and should speed up your site by about 50-80%!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-05T16:52:01.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16238" PostTypeId="2" ParentId="16225" CreationDate="2016-08-05T17:21:34.033" Score="2" Body="&lt;p&gt;Instead of using &lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/array.html&quot; rel=&quot;nofollow&quot;&gt;shuffle&lt;/a&gt;, which is only available in the extra &lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/index.html#extensions-install&quot; rel=&quot;nofollow&quot;&gt;Array extensions library&lt;/a&gt;, you could just use &lt;a href=&quot;http://twig.sensiolabs.org/doc/extensions/index.html#extensions-install&quot; rel=&quot;nofollow&quot;&gt;random&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set range = range(10, 90) %}&#xA;&#xA;{% set randomHeight1 = random(range) %}&#xA;{% set randomWidth1 = random(range) %}&#xA;&#xA;{% set randomHeight2 = random(range) %}&#xA;{% set randomWidth2 = random(range) %}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-05T17:21:34.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16239" PostTypeId="2" ParentId="16233" CreationDate="2016-08-05T17:22:07.353" Score="4" Body="&lt;p&gt;In answer to your second question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;What is the best way to log and follow my controller actions in Craft CP side?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can log actions to a plugin-specific log file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPluginNamePlugin::log('Controller action triggered', LogLevel::Info, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting the third parameter to &lt;code&gt;true&lt;/code&gt; forces the logging to happen, even if you are not in &lt;code&gt;devMode&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log file can be found in the &lt;code&gt;craft/storage/runtime/logs/&lt;/code&gt; directory and will be called &lt;code&gt;mypluginname.log&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To view logs in the CP visit &lt;code&gt;/admin/utils/logs&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2016-10-28T13:48:24.650" LastActivityDate="2016-10-28T13:48:24.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16240" PostTypeId="2" ParentId="16228" CreationDate="2016-08-05T17:49:02.293" Score="2" Body="&lt;p&gt;You're close! The &lt;code&gt;relatedContent&lt;/code&gt; field is an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, so you need to loop over it (or otherwise treat it somewhat like an array) to get to the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix field is also an array like thing, and you need to loop over it to get at the blocks. &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow&quot;&gt;See here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I would do (assuming the matrix field handle is &lt;code&gt;genericContent&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for oneRelatedContent in entry.relatedContent %}&#xA;  {% for block in oneRelatedContent.genericContent %}&#xA;    &amp;lt;article class=&quot;t{% if loop.first %} t--tall{% endif %}&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;subtitle&quot;&amp;gt;{{ oneRelatedContent.sectionTag.first }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ oneRelatedContent.title }}&amp;lt;/h1&amp;gt;&#xA;        {{ copy }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You want to use &lt;code&gt;loop.index&lt;/code&gt; to tell you which matrix block this is.&#xA;If you need to count the entries in &lt;code&gt;relatedContent&lt;/code&gt;, you will need &lt;code&gt;loop.parent.loop.index&lt;/code&gt; &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow&quot;&gt;Loop variable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-08-05T17:49:02.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16241" PostTypeId="2" ParentId="16235" CreationDate="2016-08-05T17:51:34.353" Score="1" Body="&lt;p&gt;This would be up to the FeedMe plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like they're using &lt;a href=&quot;https://github.com/engram-design/FeedMe/blob/master/feedme/services/FeedMe_FeedService.php#L193&quot; rel=&quot;nofollow&quot;&gt;cURL&lt;/a&gt; directly, so they would need to either directly set &lt;a href=&quot;https://curl.haxx.se/libcurl/c/CURLOPT_USERAGENT.html&quot; rel=&quot;nofollow&quot;&gt;CURLOPT_USERAGENT&lt;/a&gt; or allow for it to be configured via a setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to create an &lt;a href=&quot;https://github.com/engram-design/FeedMe/issues&quot; rel=&quot;nofollow&quot;&gt;issue&lt;/a&gt; / &lt;a href=&quot;https://github.com/engram-design/FeedMe/pulls&quot; rel=&quot;nofollow&quot;&gt;pull request&lt;/a&gt; on their repo.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-05T17:51:34.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16242" PostTypeId="1" AcceptedAnswerId="16244" CreationDate="2016-08-05T18:26:48.570" Score="1" ViewCount="113" Body="&lt;p&gt;Trying to pull in a limit of 2 events that are upcoming (so the event's eventDate should be newer than today). I currently have this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('events').order('eventDate asc') %}&#xA;{% set today = now|date('Y-m-d') %} &#xA;&#xA;{% for event in entries %}&#xA;  {% if today &amp;lt;= event.eventDate %}&#xA;    &amp;lt;!-- markup here --&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this returns all events that are upcoming. I would like to only limit it to 2. The problem when I put the .limit(2) on my for loop is that it chooses the first two (and those happen to be older events). Do I need to do another loop within the if statement and add .limit(2) to that or is there a better way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4872" LastEditorUserId="4872" LastEditDate="2016-08-05T18:50:04.650" LastActivityDate="2016-08-05T20:11:35.850" Title="Possible to filter an entry based on property?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16243" PostTypeId="1" AcceptedAnswerId="16246" CreationDate="2016-08-05T18:51:54.063" Score="3" ViewCount="1906" Body="&lt;p&gt;I have a super table that has 4 columns. I'm trying to create an array based off one column (&lt;code&gt;contentType&lt;/code&gt;) and merges to get only the unique values while taking the sum of a different column (&lt;code&gt;points&lt;/code&gt;). Here is a screen shot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XtX75.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XtX75.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based off that screenshot I would have the following results:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Motivation-To-Achieve : 2&lt;/li&gt;&#xA;&lt;li&gt;Emotional-Stability : 2&lt;/li&gt;&#xA;&lt;li&gt;Openness : 4&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm able to get the unique content types, however, I can't figure out how to take the sum of the points column. This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = {} %}&#xA;&#xA;{% for row in entry.surveyData %}&#xA;    {% set type = row.contentType %}&#xA;    {% set pts = row.points %}&#xA;    {% set results = results|merge({ (type) : {'name': type, 'points': pts } }) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastActivityDate="2016-08-05T19:57:22.517" Title="Possible to merge and sum the values of an array?" Tags="&lt;templating&gt;&lt;array&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16244" PostTypeId="2" ParentId="16242" CreationDate="2016-08-05T19:04:01.657" Score="5" Body="&lt;p&gt;This should work below. Rather than querying all entries and looping through, just select the entries you need (ie. &lt;code&gt;now&lt;/code&gt;) and limit them. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upcomingEvents = craft.entries.section('events').eventDate('&amp;gt;= '~now).limit(2) %}&#xA;{% for event in upcomingEvents %}&#xA;    &amp;lt;!-- markup here --&amp;gt;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2016-08-05T20:11:35.850" LastActivityDate="2016-08-05T20:11:35.850" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16245" PostTypeId="2" ParentId="16221" CreationDate="2016-08-05T19:30:23.380" Score="3" Body="&lt;p&gt;Using template variables in URL formats is brilliant, but if you don't want to write your own plugin, you could use the fantastic &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;Preparse&lt;/a&gt; plugin as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, create a Preparse field that contains the following Twig code, and add the field to your entry type's field layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;    {{ craft.entries({&#xA;        relatedTo: {&#xA;            targetElement: entry,&#xA;            field: 'productConfigs'&#xA;        }&#xA;    }).first().uri|default('') }}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, add the following to your URL format setting (&lt;code&gt;preparseFieldHandle&lt;/code&gt; should be the handle for your Preparse field, obviously):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{object.preparseFieldHandle ? object.preparseFieldHandle ~ '/'}}{slug}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that any existing entries in the relevant section would have to be re-saved in order to have the Preparse field actually parse.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-05T19:30:23.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16246" PostTypeId="2" ParentId="16243" CreationDate="2016-08-05T19:43:39.460" Score="3" Body="&lt;p&gt;What you need to do is to add the &lt;code&gt;row.points&lt;/code&gt; to any existing points for each &lt;code&gt;type&lt;/code&gt;, before merging – otherwise you'll just overwrite the existing type/attribute and its values (in other words, the &lt;code&gt;|merge&lt;/code&gt; filter won't automatically merge number values inside an object).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work – note the use of the &lt;code&gt;|default&lt;/code&gt; filter, to fall back to &lt;code&gt;0&lt;/code&gt; if the &lt;code&gt;results[type]&lt;/code&gt; key doesn't exist:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = {} %}&#xA;&#xA;{% for row in entry.surveyData %}&#xA;    {% set type = row.contentType %}&#xA;    {% set pts = row.points + results[type].points|default(0) %}&#xA;    {% set results = results|merge({ (type) : {'name': type, 'points': pts } }) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-05T19:57:22.517" LastActivityDate="2016-08-05T19:57:22.517" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16247" PostTypeId="2" ParentId="16225" CreationDate="2016-08-05T20:06:05.590" Score="4" Body="&lt;p&gt;Building off of Brad's answer, you might consider using a &lt;code&gt;for&lt;/code&gt; loop to render your markup, instead of setting all of those variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set range = range(10, 90) %}&#xA;{% set totalDivs = 5 %}&#xA;&#xA;&amp;lt;div class=&quot;sandbox&quot;&amp;gt;&#xA;  {% for i in 1..totalDivs %}&#xA;    &amp;lt;div style=&quot;left: {{ random(range) }}%; top: {{ random(range) }}%;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-05T20:06:05.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16248" PostTypeId="2" ParentId="16234" CreationDate="2016-08-06T03:43:36.730" Score="2" Body="&lt;p&gt;What OS are you running? Since you mentioned PHP 5.5.9, it sounds like you might be running Ubuntu 14.04 (Trusty), which is a &lt;a href=&quot;https://wiki.ubuntu.com/LTS&quot; rel=&quot;nofollow noreferrer&quot;&gt;LTS&lt;/a&gt; release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you're using a 3rd party package (like a Ubuntu PPA) or compiled PHP yourself, 5.5 isn't suddenly going to stop being supported. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;CentOS/RHEL or a Ubuntu LTS release all have long term support that backport any security fixes if necessary to the older distros.  (What's confusing is you might be getting security fixes from, say 5.5.34, but the package maintainers don't bump the version because you're not actually running it. This is a common false positive in PCI compliance scans, for example.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these kinds of things, I would spin up a VPS or fire up MAMP and test the install yourself. While Craft itself runs fine in my experience, you could run into trouble with plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, I'll echo Lindsey's &lt;a href=&quot;https://craftcms.stackexchange.com/a/16237/1016&quot;&gt;answer&lt;/a&gt; and agree that PHP 7 screams. Skip the 5.x branch if you're not running any other software and jump on 7 if you plan to upgrade because you'll be upgrading to it at some point anyway.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-08-06T03:43:36.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16249" PostTypeId="1" AcceptedAnswerId="16250" CreationDate="2016-08-06T20:55:29.870" Score="3" ViewCount="786" Body="&lt;p&gt;So, I'm newer to Craft, and so I need to figure out the best way to set up a portfolio page with child entries. I've set up a structure, but I need the parent page to load a different template than &lt;code&gt;_entry.html&lt;/code&gt;. I still haven't been able to figure out a good solution for this, so any help would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="1098" LastEditDate="2016-08-07T16:14:14.117" LastActivityDate="2016-08-07T16:14:14.117" Title="How to load a different template for parent page" Tags="&lt;templating&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16250" PostTypeId="2" ParentId="16249" CreationDate="2016-08-07T09:42:21.513" Score="7" Body="&lt;p&gt;First, I'd recommend that you have a total of 3 templates: &lt;code&gt;_child.html&lt;/code&gt; for your child entries, &lt;code&gt;_parent.html&lt;/code&gt; for your parent entries, and finally &lt;code&gt;_entry.html&lt;/code&gt; which will basically work as a &quot;controller&quot; template (the only code contained in &lt;code&gt;_entry.html&lt;/code&gt; should be the code that includes either the child or parent templates). You can, of course, name the templates whatever you want, but make sure that the Section's entry template is pointing to &lt;code&gt;_entry.html&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, put this in your &lt;code&gt;_entry.html&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.level %}&#xA;    {% case 1 %}&#xA;        {% include '_parent.html' %}&#xA;    {% default %}&#xA;        {% include '_child.html' %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does, is simply to look at the &lt;code&gt;entry.level&lt;/code&gt; attribute, which returns the level your Structure entry is at. Top level entries are level 1, so for a simple 2-level Structure, this may work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need something more flexible, where a &quot;parent&quot; template should be loaded unrelated to levels but based on whether an entry has children or not, you could do something like this (also in &lt;code&gt;entry.html&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.children|length %}&#xA;    {% include '_parent.html' %}&#xA;{% else %}&#xA;    {% include '_child.html' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option is to test for an entry's &lt;code&gt;parent&lt;/code&gt; property instead (i.e. if an entry has a parent entry, it should load the child template):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.parent %}&#xA;    {% include '_child.html' %}&#xA;{% else %}&#xA;    {% include '_parent.html' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You may need to correct the paths to your templates for the examples above – the &lt;code&gt;{% include %}&lt;/code&gt; always works relative to your &lt;code&gt;/templates&lt;/code&gt; folder, so if your templates actually live inside &lt;code&gt;/templates/news&lt;/code&gt;, you'd have to use &lt;code&gt;{% include 'news/_parent.html' %}&lt;/code&gt; (even if &lt;code&gt;_entry.html&lt;/code&gt; and &lt;code&gt;_parent.html&lt;/code&gt; is inside the same folder).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-07T09:42:21.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16251" PostTypeId="1" AcceptedAnswerId="16252" CreationDate="2016-08-07T11:15:16.380" Score="1" ViewCount="81" Body="&lt;p&gt;I'm currently setting up a site. One routine operation there is to 1) create a category group and 2) create a 'Categories' field for it to attach to a section later. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for safety's sake I'm giving different handle names to the category group and the related field. For example, a category group has a handle called &lt;code&gt;genre&lt;/code&gt; and the field — &lt;code&gt;genre_field&lt;/code&gt;, just to ensure that no clashes between them would happen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is it actually a possible situation that handles of two different entities (here, fields and cat/groups, but it could be sections and fields as well and so on) could conflict? &lt;/p&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2016-08-07T13:31:26.220" Title="Could different entities have the same handle?" Tags="&lt;field&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16252" PostTypeId="2" ParentId="16251" CreationDate="2016-08-07T13:31:26.220" Score="2" Body="&lt;p&gt;No, having a field and a category group (or a section and a user group etc) share handles isn't dangerous at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being specific and semantic with handles in general can be a huge boon for keeping things easily memorable and templates and other source code readable, though – so for example you might want to have handles like &lt;code&gt;genre&lt;/code&gt; (for the category group) and &lt;code&gt;selectedGenres&lt;/code&gt; (for the categories field), instead of both using &lt;code&gt;genre&lt;/code&gt;. Though technically, both can be named &lt;code&gt;genre&lt;/code&gt;, no worries.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-07T13:31:26.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16253" PostTypeId="1" CreationDate="2016-08-07T19:25:27.760" Score="-1" ViewCount="83" Body="&lt;p&gt;I'm trying to add a product to cart but response is http status code 500. How can i fix it?. I'm using a basic Craft Commerce template and just created some products.&lt;/p&gt;&#xA;" OwnerUserId="5488" LastEditorUserId="57" LastEditDate="2016-08-08T03:37:57.903" LastActivityDate="2016-08-08T03:37:57.903" Title="Add to cart returning error code 500" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16254" PostTypeId="2" ParentId="16157" CreationDate="2016-08-07T20:15:04.720" Score="5" Body="&lt;p&gt;Option 1 is a safe bet. This allows you to have completely separate, editable templates for each chosen year. You can then change the page slug to match the year of that page. You can reuse fields year over year if you'd like or create new fields for each year. Plugins like seomatic will help you create individual SEO content on a per template basis.&lt;/p&gt;&#xA;" OwnerUserId="4632" LastActivityDate="2016-08-07T20:15:04.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16255" PostTypeId="2" ParentId="16253" CreationDate="2016-08-07T20:19:21.323" Score="0" Body="&lt;p&gt;I fixed it by deleteing line 15 and 17 on orderssetting twig template, than updating entry on db with save button, than restoring twig template&lt;/p&gt;&#xA;" OwnerUserId="5488" LastActivityDate="2016-08-07T20:19:21.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16257" PostTypeId="2" ParentId="16219" CreationDate="2016-08-08T02:38:51.877" Score="1" Body="&lt;p&gt;I was adding a slash in from after grabbing image urls in my template code,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/{{ image }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Did not think about how it might break redactor.&lt;/p&gt;&#xA;" OwnerUserId="4480" LastActivityDate="2016-08-08T02:38:51.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16258" PostTypeId="1" CreationDate="2016-08-08T03:23:14.627" Score="2" ViewCount="108" Body="&lt;p&gt;I'm building an overview page that will show a title, thumbnail, etc of the pages inside the structure. I want the nav children to start at the parent page we're currently on. I can get the correct elements to display - they just don't have any entry data like title.  If there's a better way to approach this let me know. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set overview = (entry.level == 1) ? entry : entry.getAncestors().level(1).first() %}&#xA;&#xA;{% nav entry in overview %}&#xA;&#xA;{{ cycle(['&amp;lt;div class=&quot;overviewrow&quot;&amp;gt;', '', '', ''], loop.index0)|raw }}&#xA;    &amp;lt;div class=&quot;col&quot;&amp;gt;&#xA;        &amp;lt;a class=&quot;marketlink href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;marketwrap&quot;&amp;gt;&#xA;            {% for block in entry.contents.type('image').limit(1) %}&#xA;            {% if block.image | length %}&#xA;            {% for image in block.image.limit(1) %}    &#xA;                      &amp;lt;img src=&quot;{{ image.getUrl('blogThumb')}}&quot; alt=&quot;{{ image.altText }}&quot;&amp;gt;   &#xA;            {% endfor %} &#xA;            {% else %}&#xA;                      &amp;lt;img src=&quot;/something.jpg&quot;&amp;gt;&#xA;            {% endif %} &#xA;          {% endfor %} &#xA;                      &amp;lt;div&amp;gt;{{ entry.title }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&#xA;        {% ifchildren %}&#xA;                {% children %}&#xA;        {% endifchildren %}&#xA;&#xA;  {{ cycle(['', '', '', '&amp;lt;/div&amp;gt;'], loop.index0)|raw }}&#xA;&#xA;&#xA; {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2016-08-08T06:55:33.187" Title="display entries inside nav" Tags="&lt;entries&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16259" PostTypeId="2" ParentId="16258" CreationDate="2016-08-08T06:55:33.187" Score="3" Body="&lt;p&gt;You don't necessarily need to use the &lt;code&gt;nav&lt;/code&gt; tag, you can just spin through the &lt;code&gt;entries&lt;/code&gt; in a normal &lt;code&gt;{% for entry in entries %}&lt;/code&gt; loop, making use of the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#level&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;level&lt;/code&gt;&lt;/a&gt; property and the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getDescendants&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some good suggestions for more complicated &lt;code&gt;nav&lt;/code&gt; code in this answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/1847/142&quot;&gt;How do you handle complex navigation in Craft?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and there's some good pointers in the answers to this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/q/1733/142&quot;&gt;Custom or complex nav tag&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-08T06:55:33.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16260" PostTypeId="1" CreationDate="2016-08-08T12:12:34.293" Score="2" ViewCount="725" Body="&lt;p&gt;I want to do an autocomplete search engine on my website. But I don't know how to use Ajax in Craft CMS. How can I set an Ajax function in Craft CMS templating? The search engine must have dynamic auto-complete feature according to title and content.&lt;/p&gt;&#xA;" OwnerUserId="5060" LastEditorUserId="57" LastEditDate="2019-03-30T22:28:56.037" LastActivityDate="2020-06-15T06:11:46.467" Title="How can I use Ajax function in Craft CMS?" Tags="&lt;ajax&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16261" PostTypeId="1" CreationDate="2016-08-08T12:22:03.837" Score="2" ViewCount="479" Body="&lt;p&gt;I'm building a plugin and want to trigger some JavaScript on an event being fired (eg an entry being saved). What is the best way to achieve this? Coming up short looking through the documentation and Stack Overflow.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-08-10T09:15:16.730" Title="Triggering JavaScript from back-end event" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16262" PostTypeId="2" ParentId="16236" CreationDate="2016-08-08T12:39:17.057" Score="2" Body="&lt;p&gt;I'm not totally sure I fully understand your question, but what you're describing definitely sounds like a job for Matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I have no experience with Silverstripe, so I can't make any comparisons to Craft or Matrix and similar functionality in that system, but as a basic overview of what Matrix is and does, I'll just quote &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow&quot;&gt;the official docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Matrix fields allow you to create multiple blocks of content within a single field.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, you can think of a Matrix field as a glorified table of repeating content. If you ever worked with WordPress and Advanced Custom Fields, Matrix is basically the same thing as the Flexible Content field in ACF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix fields have many use cases, but using them as &quot;layout&quot; builders in modular design is very common, and is (as far as I can tell) what you're looking to achieve here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;block type&lt;/em&gt; in a Matrix field is basically a self contained set of fields. A &lt;em&gt;block&lt;/em&gt; is an instance of a block type. After configuring a Matrix field with a selection of different block types (or layouts) such as a WYSYWIG editor, an image gallery, an embedded video, a news feed etc. When a user is editing the entry, he or she can add one or several blocks of each type to the entry, in any order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your use case (such as I understand it) let's say you create a Matrix field with the handle &lt;code&gt;pageLayout&lt;/code&gt;, and add the following block types to it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Advert (handle &lt;code&gt;advert&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Customer list (handle &lt;code&gt;customerList&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Text and image (handle &lt;code&gt;textAndImage&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For each block type, you add the fields you need. Since the block types are sandboxed, you can have a field with the same handles in more than one block type, e.g. an image field called &lt;code&gt;image&lt;/code&gt; or a text field called &lt;code&gt;text&lt;/code&gt; in both the &lt;code&gt;advert&lt;/code&gt; and &lt;code&gt;textAndImage&lt;/code&gt; blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's difficult to advise on specific fields you'd need for the three block types above, but for your &lt;code&gt;advert&lt;/code&gt; block type you might need a Plain Text field for &lt;code&gt;URL&lt;/code&gt; and an Assets field called &lt;code&gt;image&lt;/code&gt;. Assuming your customers are Users or even Entries you might need a Users or Entries field for your &lt;code&gt;customerList&lt;/code&gt; block type, and the &lt;code&gt;textAndImage&lt;/code&gt; field should probably have a Rich Text and an Assets field. You also might want to give the content editor the option to add a custom heading to each block, in which case you could add a PlainText &lt;code&gt;heading&lt;/code&gt; field to each block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you edit your entries, you can create one or several of each of the three block types. You can reorder blocks you already created, remove single blocks or add new blocks of either type above or below existing blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To render your Matrix content, you'll usually work with a Twig &lt;code&gt;for&lt;/code&gt; loop to run through all your blocks and render their data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;{% switch %}&lt;/code&gt; tag to render different code based on the block type is a good way to keep things readable and clean – here's an example where all the individual block type markup is inline:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageLayout %}&#xA;    {# Inside here, `block` refers to a single block in the Matrix field #}&#xA;    {% switch block.type %}&#xA;        {% case 'advert' %}&#xA;            &amp;lt;figure class=&quot;advert&quot;&amp;gt;&#xA;                {% set image = block.image.first() %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;            &amp;lt;/figure&amp;gt;&#xA;        {% case 'customerList' %}&#xA;            &amp;lt;ul class=&quot;customerList&quot;&amp;gt;&#xA;                {% set customers = block.customers %}&#xA;                {% for customer in customers %}&#xA;                    &amp;lt;li&amp;gt;{{ customer.name }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;           &amp;lt;/ul&amp;gt;&#xA;        {% case 'textAndImage' %}&#xA;           {% set image = block.image.first() %}&#xA;           &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;           &amp;lt;p&amp;gt;{{ block.text }}&amp;lt;/p&amp;gt;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, to keep things even more tidy, you might opt for an approach using template partials, where you put the markup for each block type in their own template (e.g. &lt;code&gt;templates/blocks/advert.html&lt;/code&gt;), and use the &lt;code&gt;{% include %}&lt;/code&gt; tag to render them inside the Matrix &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageLayout %}&#xA;    {% switch block.type %}&#xA;        {% case 'advert' %}&#xA;            {% include 'blocks/advert' %}&#xA;        {% case 'customerList' %}&#xA;            {% include 'blocks/customerList' %}&#xA;        {% case 'textAndImage' %}&#xA;           {% include 'blocks/textAndImage' %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In fact, if you name your templates after your block type handles, you may get away with not having a &lt;code&gt;{% switch %}&lt;/code&gt; tag at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageLayout %}&#xA;    {% include 'blocks/'~block.type %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-08T12:39:17.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16263" PostTypeId="1" AcceptedAnswerId="16265" CreationDate="2016-08-08T12:45:42.190" Score="3" ViewCount="293" Body="&lt;p&gt;Importing &lt;code&gt;data.csv&lt;/code&gt; using Bob Olde Hampsink's &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt; plugin. Given that &lt;code&gt;data.csv&lt;/code&gt; has a 'table' item string thusly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Alcohol and Drug Treatment:RX-8450.3300,Counseling:RP-1400.8000-145,Mental Health Services:RR-5150.1500,Support Groups:PNPH-8100.4500-050&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(two columns, four rows. dead simple)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lindsay tells us &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6889/inserting-data-into-a-table-fieldtype-via-plugin&quot;&gt;here&lt;/a&gt; that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a table field contains a simple &lt;strong&gt;JSON string&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So we are writing a plugin using Import's &lt;a href=&quot;https://github.com/boboldehampsink/import#modifyimportrow&quot; rel=&quot;nofollow noreferrer&quot;&gt;modifyImportRow&lt;/a&gt; hook and here's what we have in the hook loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;// Arrange your content in a way that makes sense for your plugin&#xA;foreach ($fields as $handle =&amp;gt; $value) {&#xA;&#xA;    if ($handle==&quot;myTableHandle&quot;){&#xA;&#xA;      $rows = explode(',', $value);&#xA;&#xA;      $tabledata = array();&#xA;&#xA;      foreach ($rows as $row) {&#xA;        $rowarray = explode(':',$row);&#xA;&#xA;        $rowdata['col1'] = $rowarray[0];&#xA;        $rowdata['col2'] = $rowarray[1];&#xA;&#xA;        $tabledata[] = $rowdata;&#xA;      }&#xA;&#xA;      $value = json_encode($tabledata);&#xA;&#xA;   }&#xA;&#xA;   $content[$handle] = $value;&#xA;&#xA;}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The import works, but the table field data (myTableHandle) remains NULL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else can we do to that string of table data to get the Import plugin to accept?&lt;/p&gt;&#xA;" OwnerUserId="4097" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-08-08T17:18:20.243" Title="Why won't the Import plugin accept this JSON string?" Tags="&lt;table-field&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16264" PostTypeId="1" AcceptedAnswerId="16303" CreationDate="2016-08-08T13:04:30.150" Score="0" ViewCount="388" Body="&lt;p&gt;How can I show the shipping rate on the cart screen? At the moment this defaults to 0.00 - I assume as we don;t know the customers location so no shipping method can be applied. Ideally I want to show the standard shipping rate based on UK and then allow the user to click and change location to apply a different shipping rate. Ideally I want to do this in the Cart screen so users can see the full total before logging in or checkout out as a guest. I want to eliminate the shipping selection page. Any ideas on how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-08-08T17:19:34.200" LastActivityDate="2016-08-10T14:35:08.127" Title="Show shipping rate on Cart screen in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16265" PostTypeId="2" ParentId="16263" CreationDate="2016-08-08T13:45:02.190" Score="6" Body="&lt;p&gt;You're close!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method that Lindsey recommends should work with the following method of adding content to a field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'tableFieldHandle' =&amp;gt; json_encode($tableData)&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the &lt;a href=&quot;https://github.com/boboldehampsink/import#modifyimportrow&quot;&gt;&lt;code&gt;modifyImportRow&lt;/code&gt;&lt;/a&gt; documentation uses the (arguably better) method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set modified content&#xA;$element-&amp;gt;setContentFromPost($content);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this method, you should add an &lt;code&gt;array&lt;/code&gt; to a table field, rather than a &lt;code&gt;JSON&lt;/code&gt; strong, since &lt;code&gt;setContentFromPost()&lt;/code&gt; will call the relevant methods to format the field data appropriately for the database, so you don't need to worry about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$content[$handle] = $tabledata;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then add it to the element using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set modified content&#xA;$element-&amp;gt;setContentFromPost($content);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it should work.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The full code for the &lt;code&gt;modifyImportRow&lt;/code&gt; function in your plugin should now look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Modify data just before importing&#xA; *&#xA; * @param BaseElementModel $element  The current element receiving import data.&#xA; * @param array            $map      Mapping of data between CSV -&amp;gt; Craft fields.&#xA; * @param array            $data     Raw data provided for this row.&#xA; */&#xA;public function modifyImportRow($element, $map, $data)&#xA;{&#xA;    // Map data to fields&#xA;    $fields = array_combine($map, $data);&#xA;&#xA;    // Initialize content array&#xA;    $content = array();&#xA;&#xA;    // Arrange your content in a way that makes sense for your plugin&#xA;    foreach ($fields as $handle =&amp;gt; $value) {&#xA;&#xA;        if ($handle==&quot;myTableHandle&quot;){&#xA;&#xA;            $rows = explode(',', $value);&#xA;&#xA;            $tabledata = array();&#xA;&#xA;            foreach ($rows as $row) {&#xA;                $rowarray = explode(':',$row);&#xA;&#xA;                $rowdata['col1'] = $rowarray[0];&#xA;                $rowdata['col2'] = $rowarray[1];&#xA;&#xA;                $tabledata[] = $rowdata;&#xA;            }&#xA;&#xA;        }&#xA;&#xA;        $content[$handle] = $tabledata;&#xA;&#xA;    }&#xA;&#xA;    // Set modified content&#xA;    $element-&amp;gt;setContentFromPost($content);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2016-08-08T15:22:07.823" LastActivityDate="2016-08-08T15:22:07.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16266" PostTypeId="1" AcceptedAnswerId="16270" CreationDate="2016-08-08T14:48:08.830" Score="2" ViewCount="3284" Body="&lt;p&gt;I'm having a problem installing locally on my Mac (using MAMP Pro, Sequel Pro).  I followed all the steps in the Mijingo installation video - plus a few others.  When I go to install Craft CMS I get the following error message:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Service Unavailable  Our site is temporarily unavailable.  Please try again later.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I checked terminal and &lt;code&gt;.htaccess&lt;/code&gt; appears hidden under the public directory.  I changed the permissions.  And the config file appears to be pointing in the correct places. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might I be missing? ...or at the very least, how do I delete and start again fresh?  Is it as simple as deleting the Craft files and starting over again or are there hidden files that need to be addressed before I can start clean again?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="4466" LastEditDate="2016-08-08T17:14:27.570" LastActivityDate="2016-08-08T17:14:27.570" Title="&quot;Service Unavailable&quot; Error" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16267" PostTypeId="1" AcceptedAnswerId="16278" CreationDate="2016-08-08T14:58:30.307" Score="1" ViewCount="108" Body="&lt;p&gt;Within Settings, the cart currency is set to Euros. But when I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ product.defaultVariant.price | currency(cart.currency) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;¤150.49&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone encountered this before?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-08-09T10:44:54.803" Title="Craft Commerce not outputting € symbol" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16268" PostTypeId="2" ParentId="1268" CreationDate="2016-08-08T15:15:11.163" Score="2" Body="&lt;p&gt;I'm not sure when this changed, but Rich Text fields now appear to be parsed for reference tags (Craft 2.6)&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-08-08T15:15:11.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16269" PostTypeId="2" ParentId="15634" CreationDate="2016-08-08T15:17:22.240" Score="3" Body="&lt;pre&gt;&lt;code&gt;Reference Tags&#xA;&#xA;As these are limited to Plain Text field types, these are not an option.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Despite what the docs say, in my tests, Rich Text fields actually &lt;em&gt;are&lt;/em&gt; parsed for reference tags. Not sure if/when this actually changed, but it seems to work now (Craft 2.6)&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-08-08T15:17:22.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16270" PostTypeId="2" ParentId="16266" CreationDate="2016-08-08T15:26:07.213" Score="1" Body="&lt;p&gt;It sounds like you're missing permission on a folder in the &lt;code&gt;/craft&lt;/code&gt; directory. Best thing to do, is just retrace your steps by following the official &lt;a href=&quot;https://craftcms.com/docs/installing&quot; rel=&quot;nofollow&quot;&gt;install guide&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't use MAMP though, so there might be extra stuff you need to do, but if you scroll down to the bottom of that page to the &lt;a href=&quot;https://craftcms.com/docs/installing#additional-resources&quot; rel=&quot;nofollow&quot;&gt;Additional Resources&lt;/a&gt; section. There are some other links to articles which might help, in particular this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://a73cram5ay.blogspot.co.uk/2015/04/installing-craft-cms-on-mac-os-x-using.html&quot; rel=&quot;nofollow&quot;&gt;Installing Craft CMS on Mac OS X Using MAMP &amp;amp; Sequel Pro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do want to start again then you should be safe to delete the &lt;code&gt;/craft&lt;/code&gt; folder and try again. Although unless you're missing files, you shouldn't really need to start again.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-08-08T15:26:07.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16271" PostTypeId="1" AcceptedAnswerId="16283" CreationDate="2016-08-08T16:15:30.367" Score="0" ViewCount="567" Body="&lt;p&gt;So I have setup a macro based on the excellent article here;&lt;br&gt;&#xA;&lt;a href=&quot;https://straightupcraft.com/articles/responsive-images-with-twig-macros&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/articles/responsive-images-with-twig-macros&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro responsive(asset, options={}) %}&#xA;{% import _self as self %}&#xA;&#xA;{% set options = {&#xA;    alt: '',&#xA;    class: [],&#xA;    style: 'default'&#xA;}| merge(options) %}&#xA;&#xA;    {% set transform = {&#xA;        mode: 'crop',&#xA;    } %}&#xA;&#xA;{% set nativeWidth = asset.getWidth(false) %}&#xA;&#xA;{% set config = {&#xA;    default: {&#xA;        srcsetWidths: [300, 600, 1000,],&#xA;        sizes: [&#xA;            '(max-width: 47.5em) 100vw',&#xA;            '50vw'&#xA;        ],&#xA;        defaultWidth: 600&#xA;    },&#xA;&#xA;    cards: {&#xA;        srcsetWidths:   [345, 600, 700, 905, 1000, 1200, 1400],&#xA;        sizes: [&#xA;            '(max-width: 47.5em) 100vw',&#xA;            '(max-width: 60em) 50vw',&#xA;            '33vw'&#xA;        ],&#xA;        defaultWidth: 600&#xA;    }&#xA;} %}&#xA;&#xA;{% set params = config[options.style] %}&#xA;{% set srcset = [asset.getUrl(false)~' '~nativeWidth~'w'] %}&#xA;&#xA;{% for width in params['srcsetWidths'] %}&#xA;    {% if width &amp;lt; nativeWidth %}&#xA;    {% set srcset&#xA;         = srcset|merge([asset.getUrl(transform|merge({width: width}))~' '~width~'w'])&#xA;    %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;img&#xA;    {# src attr: transformed only if necessary #}&#xA;    {% if nativeWidth &amp;lt;= params['defaultWidth'] %}&#xA;      src=&quot;{{ asset.getUrl(false) }}&quot;&#xA;    {% else %}&#xA;      src=&quot;{{ asset.getUrl(transform|merge({width: params['defaultWidth']})) }}&quot;&#xA;    {% endif %}&#xA;&#xA;    srcset=&quot;{{ srcset|join(', ') }}&quot;&#xA;    sizes=&quot;{{ params['sizes']|join(', ') }}&quot;&#xA;&#xA;    alt=&quot;{{options.alt}}&quot;&#xA;    {{ self._classAttr(options.class) }}&#xA;/&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to be able to generate each individual responsive set based on different transform parameters. The first instance I have is created a series of card images images for a 1x3 row of feature cards. These will be a fixed ratio which I want the system to handle and not the user. These cards have the following sizes for each srcset width;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1400 x 875&lt;/li&gt;&#xA;&lt;li&gt;1200 x 750&lt;/li&gt;&#xA;&lt;li&gt;1000 x 625&lt;/li&gt;&#xA;&lt;li&gt;905 x 566&lt;/li&gt;&#xA;&lt;li&gt;700 x 438&lt;/li&gt;&#xA;&lt;li&gt;600 x 375&lt;/li&gt;&#xA;&lt;li&gt;345 x 216 &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have created an image transform in the Control Panel called Card Image that has been set to crop and the width/height set to the largest size (1400x875). I wondered if I could use this handle in the macro, but I run into errors;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The merge filter only works with arrays or &quot;Traversable&quot;, got &quot;string&quot; as first argument.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As I will have different use cases and create different 'responsive images' throughout the site, I want the flexibility of setting up different transforms, I thought it was perhaps sensible to keep these all in the control panel under the Image Transforms section, as these are easily referable and editable. Then pass in the required handle into the Macro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a better approach or solution, and any ideas how I can overcome the error mentioned? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-08-09T16:47:14.487" Title="Responsive Images Srcset and Sizes based on Image Transform" Tags="&lt;error-message&gt;&lt;macro&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16273" PostTypeId="1" AcceptedAnswerId="16275" CreationDate="2016-08-08T16:53:18.343" Score="1" ViewCount="121" Body="&lt;p&gt;I have a super table field (&lt;code&gt;scoreRanges&lt;/code&gt;) that has two columns: &lt;a href=&quot;https://github.com/MaxLazar/mx-rangeslider-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;mx range slider&lt;/a&gt; (&lt;code&gt;range&lt;/code&gt;) &amp;amp; rich text (&lt;code&gt;summary&lt;/code&gt;). Some entries can have multiple rows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q6R9o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q6R9o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying search a row in that field that has a range between a certain value. MX range slider saves data ranges to the database text field like &lt;code&gt;9;20&lt;/code&gt; which is a range from &lt;code&gt;9&lt;/code&gt; to &lt;code&gt;20&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea of how to search for a row between a certain range? So far I have tried this which returns no results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for range in profile.scoreRanges.range('and', '&amp;gt;=' ~ result.points, '&amp;lt;=' ~ result.points) %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the template side, I have variables like &lt;code&gt;{{ range.range.from }}&lt;/code&gt; &amp;amp; &lt;code&gt;{{ range.range.to }}&lt;/code&gt; to use.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Currently not ideal. Using a conditional to filter the correct row, but will work now &lt;code&gt;¯\_(ツ)_/¯&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for range in profile.scoreRanges %}&#xA;    {% if result.points &amp;gt;= range.range.from and result.points &amp;lt;= range.range.to %}&#xA;        &amp;lt;p&amp;gt;&amp;lt;span class=&quot;label label-warning&quot;&amp;gt;Range:&amp;lt;/span&amp;gt; {{ range.range.from }} - {{ range.range.to }}&amp;lt;br&amp;gt; &amp;lt;span class=&quot;label label-primary&quot;&amp;gt;Your Score:&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;{{ result.points }}&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&#xA;        {{ range.summary }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastEditorUserId="202" LastEditDate="2016-08-08T18:55:19.480" LastActivityDate="2019-04-22T22:45:36.203" Title="Search using the MX Range Slider plugin" Tags="&lt;search&gt;&lt;range&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16274" PostTypeId="2" ParentId="16260" CreationDate="2016-08-08T17:14:41.970" Score="4" Body="&lt;p&gt;Since Craft makes no assumptions about the front-end content of your website, it's 100% up to you on how you want to implement AJAX functionality on your site.  So it wouldn't be any different if you were trying to use AJAX on a simple static page with no CMS managing the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a popular method is to use &lt;a href=&quot;https://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow&quot;&gt;jQuery's ajax method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-08T17:14:41.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16275" PostTypeId="2" ParentId="16273" CreationDate="2016-08-09T00:05:16.357" Score="3" Body="&lt;p&gt;The way the plugin is currently written, it won't support your initial syntax. i.e. &lt;code&gt;range('and', '&amp;gt;=' ~ result.points, '&amp;lt;=' ~ result.points)&lt;/code&gt;.  It would need to override &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/BaseFieldType#modifyElementsQuery-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;BaseFieldType's modifyElementsQuery&lt;/a&gt; to support that syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could slightly improve on your solution by using the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/mn-break-and-continue&quot; rel=&quot;nofollow noreferrer&quot;&gt;MN Break and Continue&lt;/a&gt; plugin to at least break out of the for loop once a match is found.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="6007" LastEditDate="2019-04-22T22:45:36.203" LastActivityDate="2019-04-22T22:45:36.203" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16276" PostTypeId="1" CreationDate="2016-08-09T00:12:12.720" Score="1" ViewCount="102" Body="&lt;p&gt;I need to get Matrix field content from a entries sibling. Essentially, I have a block type called &lt;code&gt;gallery&lt;/code&gt; within my project pages, and under the project content on each page, I have a section for Other Recent Projects. I'd like to be able to get the first image from the &lt;code&gt;gallery&lt;/code&gt; block of the previous and next siblings and output it in this recent projects section. How can I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;J&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2016-08-09T21:53:11.170" Title="Output Matrix Content from Sibling" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;gallery&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16277" PostTypeId="2" ParentId="16267" CreationDate="2016-08-09T03:07:09.567" Score="0" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16267/craft-commerce-not-outputting-%E2%82%AC-symbol#comment22613_16267&quot;&gt;Steve mentions&lt;/a&gt;, most likely this is because the font you are using on the front-end of your site doesn't know how to display the € symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just tested on a fresh Craft/Commerce install on OSX/Chrome and the default Commerce templates display € as expected.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-09T03:07:09.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16278" PostTypeId="2" ParentId="16267" CreationDate="2016-08-09T10:44:54.803" Score="2" Body="&lt;p&gt;What does &lt;code&gt;cart.currency&lt;/code&gt; return?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Twig &lt;code&gt;currency&lt;/code&gt; filter ultimately uses Yii's &lt;a href=&quot;http://yiiframework.com/doc/api/1.1/CNumberFormatter#format-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;CNumberFormatter&lt;/code&gt;&lt;/a&gt; class. This uses the symbol you are seeing as a default placeholder for the currency symbol if one cannot be determined from the value of the &lt;code&gt;$currency&lt;/code&gt; parameter passed to it. This would indicate that the value of &lt;code&gt;cart.currency&lt;/code&gt; is not as expected. You'll need to make sure that the &lt;code&gt;cart&lt;/code&gt; variable is being set correctly in your template, then this should work.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-08-09T10:44:54.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16279" PostTypeId="1" AcceptedAnswerId="16284" CreationDate="2016-08-09T13:39:19.020" Score="1" ViewCount="364" Body="&lt;p&gt;Hope all is good. One of our clients wants to migrate project from core PHP to Craft CMS. I'm still new to Craft. My major task is to integrate custom social oAuth provider in CMS project, but before that I was trying to use built-in implementations (Google &amp;amp; Facebook). I setup test applications on Google and FB and I also included a social login plugin too in project ref: &lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net/craft/social&lt;/a&gt;. I was successfully redirected from my app to google login and then permission page, but when redirected to my profile page I am getting cURL Error &lt;strong&gt;(cURL error 60: SSL certificate problem: unable to get local issuer certificate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I googled a lot, but couldn't find a proper solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please find the attached screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hbcso.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hbcso.png&quot; alt=&quot;Getting error after authentication &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5494" LastEditorUserId="45" LastEditDate="2016-08-13T02:40:26.733" LastActivityDate="2016-08-13T02:40:26.733" Title="Social Login issue" Tags="&lt;plugin-duktoauth&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16280" PostTypeId="1" AcceptedAnswerId="16288" CreationDate="2016-08-09T14:26:12.537" Score="2" ViewCount="156" Body="&lt;p&gt;I have succesfully shown some related entries that are in the same category, using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries({&#xA;    section: 'blog',&#xA;    relatedTo: entry.blogCategory.first(),&#xA;    id: 'not ' ~ entry.id,&#xA;    limit: 3&#xA;}) %}           &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Entries generally only have 1 category on this site).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do next, is look for entries that have some of the same  tags as the current entry, making this list of entries even more relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially I want the related entries to be as relevant as possible, this could even go as far as ignoring the Category if there are more tags in common, is that possible by somehow grading the results and displaying the most 'in-common' entries?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-08-09T20:00:18.603" Title="Show related entries that have the same Category, and some of the same tags?" Tags="&lt;categories&gt;&lt;relations&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16281" PostTypeId="2" ParentId="16261" CreationDate="2016-08-09T14:54:24.830" Score="4" Body="&lt;p&gt;When an entry is saved, an &lt;code&gt;Entry saved.&lt;/code&gt; flash message is set and displayed by Craft. You could use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot;&gt;Control Panel JS plugin&lt;/a&gt; to write a script to detect this flash message and perform your desired action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The flash message is set in a &lt;code&gt;div&lt;/code&gt; with an &lt;code&gt;id=&quot;notifications&quot;&lt;/code&gt;. When there is no notification present, this &lt;code&gt;div&lt;/code&gt; is empty. When there is a notification present, the &lt;code&gt;div&lt;/code&gt; contains another &lt;code&gt;div&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;notifications&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;notification notice&quot; style=&quot;opacity: 0; display: none;&quot;&amp;gt;Entry saved.&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you test for the presence of this inner &lt;code&gt;div&lt;/code&gt; and also the specific notification content (i.e. &lt;code&gt;Entry saved.&lt;/code&gt;) you should be able to trigger the actions you need to.&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2016-08-09T15:02:59.847" LastActivityDate="2016-08-09T15:02:59.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16282" PostTypeId="2" ParentId="16231" CreationDate="2016-08-09T15:08:32.317" Score="0" Body="&lt;p&gt;When you set the &lt;code&gt;lastEntry&lt;/code&gt; variable on your page. You are either setting &lt;code&gt;lastEntry&lt;/code&gt; to be the &lt;code&gt;SproutForms_FormEntryModel&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;. In both cases you are defining the variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Sets lastEntry to SproutForms_FormEntryModel or null #}&#xA;{% set lastEntry = craft.sproutForms.lastEntry() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you then want to test the &lt;code&gt;lastEntry&lt;/code&gt; variable, you'll need to use something different that &lt;code&gt;is defined&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the following will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastEntry = craft.sproutForms.lastEntry() %}&#xA;{% set qualified = true %}&#xA;{% if lastEntry and lastEntry.fieldName == 'no' %}&#xA;    {% set qualified = false %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Testing for &lt;code&gt;if lastEntry&lt;/code&gt; will work just like using &lt;code&gt;if lastEntry is not null&lt;/code&gt;. The secondary part of your conditional should only be evaluated if &lt;code&gt;if lastEntry&lt;/code&gt; returns true, in which case your &lt;code&gt;SproutForms_FormEntryModel&lt;/code&gt; would exist and the &lt;code&gt;fieldName&lt;/code&gt; field would be defined, with or without a value.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-09T15:08:32.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16283" PostTypeId="2" ParentId="16271" CreationDate="2016-08-09T16:47:14.487" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow&quot;&gt;Merge&lt;/a&gt; operates on arrays or array-like things, and you probably handed it the string &lt;code&gt;&quot;card&quot;&lt;/code&gt;, which is why you got that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you want to do here is use the transform in the control panel to define the aspect ratio, but use the &lt;code&gt;img&lt;/code&gt; macro to determine which sizes to transform to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate the aspect ratio like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aspectRatio = asset.getHeight(options.style) / asset.getWidth(options.style) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And generate transforms like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;transform|merge({width: width, height: width * aspectRatio})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will want to be careful with the native (untransformed) image: only use it if it has the correct aspect ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will want to be careful with avoiding transforming to a larger image - skip the ones where the width would be greater than the native width &lt;em&gt;and&lt;/em&gt; the ones where the height would be greater than the native height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;crop&lt;/code&gt; transform instead of the &lt;code&gt;stretch&lt;/code&gt; one (that the article uses) is the right thing to do too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, consider the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow&quot;&gt;imager&lt;/a&gt; plugin, which has some useful srcset supporting features (and postdates that article)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-08-09T16:47:14.487" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16284" PostTypeId="2" ParentId="16279" CreationDate="2016-08-09T17:52:27.210" Score="1" Body="&lt;p&gt;Not really Craft related, but that cURL error is because you're trying to connect to an https endpoint, but your local server doesn't have a matching certificate to verify against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see here for some solutions across different environments: &lt;a href=&quot;https://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate&quot;&gt;https://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-09T17:52:27.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16285" PostTypeId="1" CreationDate="2016-08-09T18:12:08.470" Score="4" ViewCount="153" Body="&lt;p&gt;When I install the plugin, I need to automatically create a few records. How can I have my plugin automatically create those records when it is installed?&lt;/p&gt;&#xA;" OwnerUserId="41" LastActivityDate="2016-08-09T18:12:08.470" Title="How can I populate some records after my plugin is installed?" Tags="&lt;plugin-development&gt;&lt;records&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16286" PostTypeId="2" ParentId="16285" CreationDate="2016-08-09T18:12:08.470" Score="5" Body="&lt;p&gt;On the main &lt;code&gt;MyPluginPlugin&lt;/code&gt; class, there is a method you can override called &lt;code&gt;onAfterInstall()&lt;/code&gt;. Which will run after your plugin is installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create those records, you can place the following code into the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterInstall()&#xA;{&#xA;    $record = new MyPlugin_ExampleRecord;&#xA;    $record-&amp;gt;setAttribute('attributeName', 'value');&#xA;    $record-&amp;gt;save();&#xA;&#xA;    $record2 = new MyPlugin_ExampleRecord;&#xA;    $record2-&amp;gt;setAttribute('attributeName', 'value2');&#xA;    $record2-&amp;gt;save();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="41" LastActivityDate="2016-08-09T18:12:08.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16287" PostTypeId="2" ParentId="16261" CreationDate="2016-08-09T19:02:26.770" Score="2" Body="&lt;p&gt;Since you're building your own plugin, you can make use of the UserSessionService's &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#addJsFlash-detail&quot; rel=&quot;nofollow&quot;&gt;addJsFlash() method&lt;/a&gt; to queue up some JavaScript that will be injected and executed upon the next request after an entry is saved:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In your plugin's main class)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('entries.saveEntry', function (Event $event) {&#xA;      craft()-&amp;gt;userSession-&amp;gt;addJsFlash('(function () {&#xA;        if (window.Craft) {&#xA;            Craft.setLocalStorage(&quot;elementindex.Entry&quot;, &quot;&quot;);&#xA;        }&#xA;      })();');&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-09T19:02:26.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16288" PostTypeId="2" ParentId="16280" CreationDate="2016-08-09T19:37:53.680" Score="2" Body="&lt;p&gt;If you don't mind using a plugin, &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow&quot;&gt;Similar&lt;/a&gt; would work very well for your use case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.similar.find({&#xA;    element: entry,&#xA;    context: entry.tagsField.ids()|merge(entry.blogCategory.ids()),&#xA;    criteria: {&#xA;        section: 'blog',&#xA;        limit: 3&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, be sure to replace &lt;code&gt;tagsField&lt;/code&gt; in the above example with the actual handle for your entry type's Tags field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, the entries returned by Similar will be ordered after the number of relations in common with the current &lt;code&gt;entry&lt;/code&gt; (or whatever you pass into the &lt;code&gt;element&lt;/code&gt; parameter). In other words, the entry with the most tags and/or categories in common with the current &lt;code&gt;entry&lt;/code&gt; will be the first. The entries returned by Similar will also have an &lt;code&gt;entry.count&lt;/code&gt; attribute that will indicate the number of relations in common with the current entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to do this without a plugin, it's possible to add multiple criteria to the &lt;code&gt;relatedTo&lt;/code&gt; parameter in order to pull entries that has either one or more categories &lt;em&gt;or&lt;/em&gt; tags in common with the current entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries({&#xA;    section: 'blog',&#xA;    relatedTo: ['or', {&#xA;        targetElement: entry.blogCategory.ids(),&#xA;        field: 'blogCategory'&#xA;    }, {&#xA;        targetElement: entry.tagsField.ids(),&#xA;        field: 'tagsField'&#xA;    }],&#xA;    id: 'not ' ~ entry.id,&#xA;    limit: 3&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of a way to query the EntriesService for the 3 entries with the most relations in common with &lt;code&gt;entry&lt;/code&gt;, though (the lack of such a feature is why the Similar plugin exists). I guess this could be achieved in plain Twig by possibly setting the &lt;code&gt;limit&lt;/code&gt; parameter to &lt;code&gt;null&lt;/code&gt; (to return all entries – yikes! performance), looping over the returned entries and comparing the number of relations in &lt;code&gt;entry.tagsField&lt;/code&gt; and &lt;code&gt;entry.blogCategory&lt;/code&gt; to each related entry and add the entries to an array ordered by the amount of relations somehow, but I suspect it will get pretty dirty and quickly go beyond what Twig is designed to comfortably do, logic-wise.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-09T20:00:18.603" LastActivityDate="2016-08-09T20:00:18.603" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16289" PostTypeId="2" ParentId="16276" CreationDate="2016-08-09T20:16:13.547" Score="1" Body="&lt;p&gt;Something like this might work (obviously, replace the &lt;code&gt;matrixField&lt;/code&gt;, &lt;code&gt;assetsField&lt;/code&gt; and &lt;code&gt;imageTransform&lt;/code&gt; handles with real values):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Basic query parameters for your sibling entries #}&#xA;{% set siblingCriteria = craft.entries.section(entry.section.handle) %}&#xA;&#xA;{# Creates an array with the next and previous entries, based on the basic query parameters #}&#xA;{% set siblingEntries = [entry.getPrev(siblingCriteria), entry.getNext(siblingCriteria)] %}&#xA;&#xA;{# Loop through the next and previous entries&#xA;{% for siblingEntry in siblingEntries %}&#xA;&#xA;    {% if siblingEntry %}{# This might be null, if there isn't a next or previous entry #}&#xA;&#xA;        {# Get the first `gallery` block for the entry's Matrix field #}&#xA;        {% set galleryBlock = siblingEntry.matrixField.type('gallery').first() %}&#xA;&#xA;        {# Get the first asset in the gallery block's Assets field #}&#xA;        {% set galleryImage = galleryBlock ? galleryBlock.assetsField.first() : null %}&#xA;&#xA;        {# Render the image #}&#xA;        {% if galleryImage %}&#xA;            &amp;lt;a href=&quot;{{ siblingEntry.url }}&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ galleryImage.getUrl('imageTransform') }}&quot; /&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-09T20:21:30.883" LastActivityDate="2016-08-09T20:21:30.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16290" PostTypeId="1" CreationDate="2016-08-09T20:44:03.457" Score="0" ViewCount="97" Body="&lt;p&gt;So I want to hide certain items if a user is not logged into the website. I already have a custom lightswitch field on each of the items but I'm not sure on how to write the code for it. Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="57" LastEditDate="2016-08-09T21:03:28.730" LastActivityDate="2016-08-09T21:03:28.730" Title="Hiding specific items from public" Tags="&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16291" PostTypeId="2" ParentId="16290" CreationDate="2016-08-09T21:01:19.273" Score="3" Body="&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.com/docs/lightswitch-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/lightswitch-fields&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/a/352/5134&quot;&gt;https://craftcms.stackexchange.com/a/352/5134&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.lightswitchFieldHandle %}&#xA;    {% if currentUser %}&#xA;        Display entry that only logged users can see&#xA;    {% endif %}&#xA;{% else %}&#xA;    Display entry that anyone can see&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5134" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-08-09T21:01:19.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16292" PostTypeId="2" ParentId="16276" CreationDate="2016-08-09T21:53:11.170" Score="1" Body="&lt;p&gt;I was able to figure this out on my own, based off this answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4536/get-related-entries-from-matrix-field&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I ended up using to achieve what I needed, used inside my matrix field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;featuredProjects&quot; %}&#xA;  {% set relatedEntries = craft.entries.section('projects').relatedTo(block).limit(12) %}&#xA;  {% for entry in relatedEntries %}&#xA;  {% for asset in entry.mainHero %}&#xA;  &amp;lt;figure id=&quot;{{ entry.slug }}&quot; class=&quot;featured-item position-relative&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;      &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;      &amp;lt;figcaption class=&quot;project-info position-absolute gap-left-right pin-top-center&quot;&amp;gt;&#xA;        &amp;lt;h3 class=&quot;title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;span&amp;gt;View Project&amp;lt;/span&amp;gt;&#xA;      &amp;lt;/figcaption&amp;gt; &#xA;    &amp;lt;/a&amp;gt;  &#xA;  &amp;lt;/figure&amp;gt;&#xA;  {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-09T21:53:11.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16293" PostTypeId="1" AcceptedAnswerId="16296" CreationDate="2016-08-10T00:34:07.457" Score="2" ViewCount="3299" Body="&lt;p&gt;I have looked a lot through this StackExchange but I guess I am not too advanced in using AJAX/Json. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to have page transitions using Ajax. This was rather easy to accomplish following this article: &#xA;&lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;nofollow&quot;&gt;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what this article is missing out is the updating of the page title and meta tags. I have done a lot of searches and from what I understand I need to build json files for each page/entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I installed ElementAPI and tried to get the basics working&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;news/{$entry-&amp;gt;id}.json&quot;)&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I am getting stuck at this point. &#xA;I know that I can get the jquery through &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $.ajax({&#xA;      type: 'get',&#xA;      url: 'news.json',&#xA;      data: {&#xA;        format: 'json'&#xA;      },&#xA;      success: function(result){&#xA;        $main.html(result);&#xA;      },&#xA;      error: function(){&#xA;        console.log(&quot;error.&quot;);&#xA;        location.reload();&#xA;      }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I do that I am getting an empty body that loads nothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I kind of am stuck here as my knowledge ends. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be very grateful for any information on how to progress. I am really looking to understand how this works but without having at least a working model it's hard for me to analyze and reverse-engineer the code. &lt;/p&gt;&#xA;" OwnerUserId="5495" LastActivityDate="2016-08-10T15:37:52.637" Title="How do I add meta data and a page title through ajax?" Tags="&lt;ajax&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16294" PostTypeId="1" CreationDate="2016-08-10T01:13:11.043" Score="1" ViewCount="429" Body="&lt;p&gt;Has anyone implemented auto linking of words within a redactor field? For example, a rich text field would contain this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;​&lt;em&gt;A small &lt;strong&gt;boat&lt;/strong&gt; surrounds a large ​&lt;strong&gt;island&lt;/strong&gt;​&lt;/em&gt;​&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In a channel there are entries titled &lt;strong&gt;boat&lt;/strong&gt; and &lt;strong&gt;island&lt;/strong&gt;. I would like to automatically link to these without the editor having to manually link them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how approach this so any hints to get me on my way are most appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3560" LastActivityDate="2016-08-10T09:55:34.660" Title="Automatically link to entries in rich text field" Tags="&lt;redactor&gt;&lt;search&gt;&lt;richtext&gt;&lt;replace&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16295" PostTypeId="1" CreationDate="2016-08-10T07:17:25.040" Score="1" ViewCount="380" Body="&lt;p&gt;We have been trying to implement &lt;a href=&quot;https://simplesamlphp.org/&quot; rel=&quot;nofollow&quot;&gt;SimpleSAML PHP&lt;/a&gt; in a Craft plugin to facilitate a SAML login for one of our sites. The problem we are running into is that we always get the NOSTATE error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response that gets logged does seem to be correct and the login does succeed, only the way it gets handled in the ACS callback seems to be wrong. That is the moment we get the NOSTATE error. The ACS code is copied from the default SimpleSAML PHP implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We think it has something to do with the session. Something weird seems also to be going regarding the session id that's generated, SimpleSAML PHP generates a new session id regardless of an existing session from Craft. After debugging we located where the session id was generated and forced this to use the Craft session id. However this doesn't have any effect at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've been debugging a lot but can't seem to figure where the State should be fixed. Does anyone have any clue or any idea how to fix this problem.&lt;/p&gt;&#xA;" OwnerUserId="5496" LastEditorUserId="57" LastEditDate="2016-08-10T18:51:17.043" LastActivityDate="2016-08-11T13:44:03.357" Title="Implementing SimpleSAML PHP in Craft plugin" Tags="&lt;plugin-development&gt;&lt;session&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16296" PostTypeId="2" ParentId="16293" CreationDate="2016-08-10T07:22:18.440" Score="3" Body="&lt;p&gt;You almost certainly don't have to update the meta tags when you use AJAX to load pages like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meta tags are not exposed to the end user; they're there for search engine crawlers and social media embedding (e.g. Facebook) etc. Crawlers will read the meta tag values from the original HTML at the URL being crawled or shared, not whatever values you update to using JavaScript in an AJAX callback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, updating the page/document title can be a good idea, as users will see this value in their browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can update the document title simply by setting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;document.title = &quot;Who let the dogs out?&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;somewhere in your JavaScript. A good place to do this in regards to &lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;nofollow&quot;&gt;the tutorial script you're using&lt;/a&gt; would be inside the &lt;code&gt;ajaxLoad()&lt;/code&gt; method, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ajaxLoad = function(html) {&#xA;    init();&#xA;&#xA;    /* ----- Here you could maybe add logic to set the HTML title to the new page title ----- */&#xA;    document.title = &quot;Who let the dogs out?&quot;;&#xA;&#xA;    ...&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, you'll want to set the document title to something relevant – preferably the &quot;real&quot; page title for that URL. You certainly &lt;em&gt;could&lt;/em&gt; use the ElementAPI plugin to pull your entry's title, but that would mean a ton of work &lt;em&gt;and&lt;/em&gt; an additional AJAX request. A much simpler way to do it is to set a data-attribute somewhere in the markup returned by the original AJAX call, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;js-ajax-wrapper&quot; data-title=&quot;{{ siteName }}: {{ entry.title }}&quot;&amp;gt;&#xA;    {{ entry.body }}&#xA;    ...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then do something like this in your &lt;code&gt;ajaxLoad()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ajaxLoad = function(html) {&#xA;    ...&#xA;    document.title = $('&amp;lt;div /&amp;gt;').append(html).children('.js-ajax-wrapper').data('title');&#xA;    ...&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the designbycosmic.com script has a small bug – in order for the above to work you'll have to change the call to &lt;code&gt;ajaxLoad()&lt;/code&gt; inside the &lt;code&gt;success&lt;/code&gt; callback for the &lt;code&gt;loadPage()&lt;/code&gt; method to &lt;code&gt;ajaxLoad(result);&lt;/code&gt; – alternatively, you can ignore the &lt;code&gt;ajaxLoad()&lt;/code&gt; method and just change the document title inside the &lt;code&gt;success&lt;/code&gt; callback:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;success: function(result){&#xA;    ...&#xA;    document.title = $('.js-main .js-ajax-wrapper').data('title');&#xA;    /* ----- Bring In New Content ----- */&#xA;    ...    &#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, as an aside your issue with the ElementAPI plugin is that you're returning a JSON payload (containing only the &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;jsonUrl&lt;/code&gt; for the entry), yet you're attempting to inject that data into the DOM as HTML (i.e. &lt;code&gt;$main.html(result);&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-10T15:37:52.637" LastActivityDate="2016-08-10T15:37:52.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16297" PostTypeId="2" ParentId="16294" CreationDate="2016-08-10T07:26:46.247" Score="3" Body="&lt;p&gt;How about just using the replace filter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set text = &quot;A small boat surrounds a large ​island​​&quot; %}&#xA;&#xA;{% set linkedText = text|replace({'boat':'&amp;lt;a href=&quot;/whatever&quot;&amp;gt;boat&amp;lt;/a&amp;gt;'}) %}&#xA;&#xA;{{ linkedText|raw }}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory there should be a way to do it with parseRefs too, but my initial test isn't working yet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set refText = text|replace({'boat':'&amp;lt;a href=&quot;{entry:11102:}&quot;&amp;gt;boat&amp;lt;/a&amp;gt;'}) %}&#xA;&#xA;{% set parsedText = refText|parseRefs %}&#xA;&#xA;{{ parsedText|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which leaves an unparsed ref tag so far.  I'm just heading out of the office but maybe a simple replace as above is enough to get you started?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-08-10T07:26:46.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16298" PostTypeId="2" ParentId="16261" CreationDate="2016-08-10T09:15:16.730" Score="2" Body="&lt;p&gt;Thanks both for answers - realised that was probably going about things the wrong way so have tried a different approach. Using a plugin to store a timestamp of last updated article. This is saved as a cookie in front-end and on page load the value in the users session is compared to the value from the plugin. If these don't match then the cookie is reset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not really worked on this kind of plugin before so some really useful feedback and suggestions, thanks!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-08-10T09:15:16.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16299" PostTypeId="2" ParentId="16294" CreationDate="2016-08-10T09:55:34.660" Score="1" Body="&lt;p&gt;Assuming you only need this to work on the front end of your site (i.e., you don't actually need to see the links inside the Redactor field in the control panel), something like this might do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the rich text content #}&#xA;{% set text = entry.richTextField %}&#xA;&#xA;{# Get all entries that could possibly be linked #}&#xA;{% set entries = craft.entries.section('someSection').limit(null) %}&#xA;&#xA;{# Loop through entries, replacing any words matching entry titles with a link #}&#xA;{% for entry in entries #}&#xA;    {% set text = text|replace({(entry.title|lower):'&amp;lt;a href=&quot;'~entry.url~'&quot;&amp;gt;'~entry.title|lower~'&amp;lt;/a&amp;gt;'}) %}&#xA;{% endfor %}&#xA;&#xA;{# Render the text #}&#xA;{{ text|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that there are several possible issues with the above:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You might see performance issues if you have a lot of entries to match (consider using the &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag)&lt;/li&gt;&#xA;&lt;li&gt;Lower/uppercase and capitalization issues are difficult to deal with (the above example only matches lowercase words and phrases to the entry titles)&lt;/li&gt;&#xA;&lt;li&gt;Words and phrases with HTML tags inside won't match, i.e. &quot;something &lt;strong&gt;something&lt;/strong&gt;&quot; wouldn't match the entry title &quot;Something something&quot;&lt;/li&gt;&#xA;&lt;li&gt;Entries can have identical titles, so if you have more than one entry called &quot;Something something&quot; only the last one will be linked&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-10T09:55:34.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16300" PostTypeId="1" AcceptedAnswerId="16312" CreationDate="2016-08-10T13:35:47.623" Score="2" ViewCount="561" Body="&lt;p&gt;I feel like I'm overlooking something simple here, but I can't for the life of me figure out how to add markers to a map. I had this working with the &lt;a href=&quot;https://github.com/objectivehtml/Google-Maps-for-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Maps for Craft&lt;/a&gt; plugin but since switching to Smart Map I get as far as rendering a map and that's it.&lt;/p&gt;&#xA;&lt;p&gt;My set up is such: I have a structure with multiple same-level entries, each of which has an address. I have an index page that's rendering a map which should be populated with markers based on the the addresses from each entry's address field.&lt;/p&gt;&#xA;&lt;p&gt;Historically, I looped through the entries, defined each marker's address and then added that to the map variable like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{# Look for each location listed #}&#xA;{% for entry in craft.entries.section('locations').limit(null) %}&#xA;    {# For each location found, set the map marker properties to have an &#xA;       address and a link to the location page within the pop-out menu that &#xA;       shows on-click #}&#xA;    {% set marker = {&#xA;        address: entry.locationAddress,&#xA;        content: '...'&#xA;    } %}&#xA;    {# Then we add the marker to our map variable #}&#xA;    {{ craft.googleMaps.marker('map', marker) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, now with Smart Map, I can't figure out how to recreate this. I don't quite understand how to set the &lt;code&gt;locations&lt;/code&gt; for the &lt;code&gt;{{ craft.smartMap.map(locations, options) }}&lt;/code&gt; call. The docs show that one can pass an array into it via &lt;code&gt;craft.entries.section('myLocations')&lt;/code&gt; but since my address fields are not entries in a section I'm not sure how to parse that out.&lt;/p&gt;&#xA;&lt;p&gt;Any help or insight would be greatly appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="5272" LastEditorUserId="45" LastEditDate="2021-01-01T06:42:09.940" LastActivityDate="2021-01-01T06:42:09.940" Title="Adding markers to map from field in entries within section" Tags="&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16301" PostTypeId="2" ParentId="16300" CreationDate="2016-08-10T13:46:36.327" Score="2" Body="&lt;p&gt;I fiddled around with some fields and got this working. Not sure it's the most direct way, but hey. Progress is progress :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.entries.section('locations').limit(null) %}&#xA;&#xA;{# Look for each campus listed #}&#xA;{% for entry in craft.entries.section('campuses').limit(null) %}&#xA;    {% if entry.campusAddress|length %}&#xA;        {% set options = {&#xA;            markerOptions: {&#xA;                address: entry.campusAddress&#xA;            }&#xA;        } %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5272" LastActivityDate="2016-08-10T13:46:36.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16302" PostTypeId="1" CreationDate="2016-08-10T14:19:35.867" Score="1" ViewCount="94" Body="&lt;p&gt;I know this is a long shot, but is there a way to order a Structure differently per locale? As in the standard drag and drop ordering that comes with a structure but with the ordering saved for each locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to avoid having to create a translatable entries field to achieve the same thing on an overview page, as that means whene&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-08-10T14:19:35.867" Title="Different order per locale for Structures" Tags="&lt;structure&gt;&lt;ordering&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16303" PostTypeId="2" ParentId="16264" CreationDate="2016-08-10T14:35:08.127" Score="2" Body="&lt;p&gt;I've not tried this so early in the checkout process, but how about adding the following to your Add To Cart forms? Replace the # with the correct value obviously.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[countryId]&quot; value=&quot;#&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingMethod&quot; value=&quot;#&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way, as soon as people arrive on the Cart page a country has been added already as a shipping address, which, I think, should be enough for shipping to be calculated.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-08-10T14:35:08.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16304" PostTypeId="1" AcceptedAnswerId="16306" CreationDate="2016-08-10T14:37:17.833" Score="2" ViewCount="585" Body="&lt;p&gt;I have a field of the dropdown fieldtype, let's call it &lt;code&gt;myDropdown&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;myDropdown&lt;/code&gt; has a list of options, one of which has the &quot;default&quot; checkbox checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use a front-end form to submit a new entry, but the form does not contain the &lt;code&gt;myDropdown&lt;/code&gt; field, will Craft insert the value designated as the the default into that field, or will it just leave the field empty?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-08-10T15:07:45.373" Title="Dropdown field 'default'" Tags="&lt;drop-down&gt;&lt;default&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16305" PostTypeId="1" AcceptedAnswerId="16310" CreationDate="2016-08-10T14:39:34.713" Score="1" ViewCount="5145" Body="&lt;p&gt;Under Nginx/PHP-FPM, I can't get PHP errors logged to &lt;code&gt;craft/storage/runtime/logs/phperrors.log&lt;/code&gt; as they should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, errors weren't logging &lt;em&gt;anywhere&lt;/em&gt;, but I discovered I needed:&#xA;&lt;code&gt;catch_workers_output = yes&lt;/code&gt; in our PHP-FPM config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Errors are now logging to &lt;code&gt;/var/log/php7.0-fpm.log&lt;/code&gt;, but not to Craft's custom location.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-08-10T19:14:17.003" Title="Getting PHP errors to log in Nginx/PHP-FPM" Tags="&lt;nginx&gt;&lt;logging&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16306" PostTypeId="2" ParentId="16304" CreationDate="2016-08-10T15:07:45.373" Score="4" Body="&lt;p&gt;Yes, if you don't include the dropdown field in your entry form, Craft will store the default value for that field, if one has been set. If no default value has been set, then the value will be &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-08-10T15:07:45.373" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16307" PostTypeId="1" AcceptedAnswerId="16309" CreationDate="2016-08-10T16:58:28.280" Score="2" ViewCount="603" Body="&lt;p&gt;I am working on a site that needs to both list all categories and also pull out individual categories by their id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to query the DB once for all the categories (to improve performance), and then pull out which ones I want, but am struggling to find a solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catNavigation = craft.categories.group('products').limit(null).find() %}&#xA;&#xA;&amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ catNavigation.id(102).first.url }}&quot;&amp;gt;{{ catNavigation.id(102).first.title|raw }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&amp;lt;h2&amp;gt;{{ catNavigation.id(126).first.title|raw }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is giving me an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array to string conversion&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I guess I can't grab pieces of an element criteria model after using find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I don't use find, then I query the DB multiple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about creating my own array of categories dynamically with twig, but that has not gone well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to accomplish what I'm after? It's as if I need to search within an array of data that has already been returned from the DB. Hope that makes sense.&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2016-08-11T11:30:36.717" Title="Query all categories once and get individual categories from array" Tags="&lt;categories&gt;&lt;elementcriteriamodel&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16308" PostTypeId="1" CreationDate="2016-08-10T18:24:23.393" Score="1" ViewCount="110" Body="&lt;p&gt;I'm working on importing a database and I was looking at some of the available import plugins. However I am unable to figure out how to import a body field (just a string) into a Matrix block. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Old database entry structure (non-Crafty)&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;description&lt;/li&gt;&#xA;&lt;li&gt;body&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;New database entry structure (Crafty)&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;description&lt;/li&gt;&#xA;&lt;li&gt;matrix [body, image, gallery, etc]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does anyone have experience with this? Any advice?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2016-08-10T20:09:42.010" Title="Import body field into a matrix text block" Tags="&lt;matrix&gt;&lt;plugins&gt;&lt;database&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16309" PostTypeId="2" ParentId="16307" CreationDate="2016-08-10T18:54:37.730" Score="4" Body="&lt;p&gt;Your issue is that as soon as you call &lt;code&gt;.find()&lt;/code&gt;, your &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt; returns &lt;em&gt;an array of elements&lt;/em&gt;. In other words, the ElementCriteriaModel is gone, and it's no longer possible to add parameters (i.e. &lt;code&gt;id()&lt;/code&gt;) or call other methods that you'd otherwise be able to call on that object (i.e. &lt;code&gt;.first()&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand – like you say in your description; if you don't use &lt;code&gt;.find()&lt;/code&gt; (keeping the ElementCriteriaModel around) you'll hit the database every time you use the &lt;code&gt;.id()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A workaround could be to loop over the categories and add them to an indexed array (using the category IDs as keys) and then pull your individual categories from that index instead of the original array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important: One gotcha to note is that the &lt;code&gt;|merge&lt;/code&gt; filter will actually renumber numeric keys, so you have to add an arbitrary character to the ID to retain the actual ID values (the example below uses an underscore prefix):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the categories #}&#xA;{% set categories = craft.categories.group('products').limit(null).find() %}&#xA;&#xA;{# Create category index #}&#xA;{% set categoryIndex = {} %}&#xA;{% for category in categories %}&#xA;    {% set categoryIndex = categoryIndex|merge({('_'~category.id): category}) %}&#xA;{% endfor %}&#xA;&#xA;{# Do your thing #}&#xA;&amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ categoryIndex['_102'].url }}&quot;&amp;gt;{{ categoryIndex['_102'].title|raw }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&amp;lt;h2&amp;gt;{{ categoryIndex['_126'].title|raw }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that when you want to pull a category from the index, &lt;code&gt;categoryIndex['_102']&lt;/code&gt; and &lt;code&gt;categoryIndex._102&lt;/code&gt; will both work – I just find that the former looks a bit cleaner, with the underscore in front of it (obviously you can use any character, it doesn't have to be an underscore).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pointed out by @carlcs in the comments below, another approach to creating the index is to use the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;group&lt;/code&gt;&lt;/a&gt; filter. With this approach you'll avoid the underscore hack and the &lt;code&gt;for&lt;/code&gt; loop. The gotcha here is that this filter will actually create an array of arrays, meaning you'll have to use &lt;code&gt;categoryIndex[102][0]&lt;/code&gt; (note the &lt;code&gt;[0]&lt;/code&gt; at the end) to access a specific category (you could also use &lt;code&gt;categoryIndex[102]|first&lt;/code&gt;, of course):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('products').limit(null).find() %}&#xA;{% set categoryIndex = categories|group('id') %}&#xA;&#xA;&amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ categoryIndex[102][0].url }}&quot;&amp;gt;{{ categoryIndex[102][0].title|raw }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&amp;lt;h2&amp;gt;{{ categoryIndex[126][0].title|raw }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-11T11:30:36.717" LastActivityDate="2016-08-11T11:30:36.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16310" PostTypeId="2" ParentId="16305" CreationDate="2016-08-10T19:14:17.003" Score="1" Body="&lt;p&gt;I'm only 80% confident in this answer, but I'm pretty sure that runtime PHP &lt;a href=&quot;https://secure.php.net/manual/en/function.ini-set.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ini_set&lt;/code&gt;&lt;/a&gt; calls won't work with nginx running with FastCGI (which is what Craft uses to change the &lt;a href=&quot;https://secure.php.net/manual/en/function.error-log.php&quot; rel=&quot;nofollow&quot;&gt;error_log&lt;/a&gt; path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting that path directly in your &lt;code&gt;/etc/php5/fpm/php.ini&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-10T19:14:17.003" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16311" PostTypeId="2" ParentId="16308" CreationDate="2016-08-10T20:09:42.010" Score="3" Body="&lt;p&gt;Nevermind. &lt;a href=&quot;https://github.com/clearbold/craftimport&quot; rel=&quot;nofollow&quot;&gt;Clearbold's Craft Import&lt;/a&gt; plugin has the starting code for it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// new entry&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = 1;&#xA;$entry-&amp;gt;typeId    = 12;&#xA;$entry-&amp;gt;authorId  = 123;&#xA;$entry-&amp;gt;enabled   = true;&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = &quot;Here goes my title!&quot;;&#xA;&#xA;// new matrix and matrix block&#xA;$block = array();&#xA;$block['new1'] = array(&#xA;    'type' =&amp;gt; 'body',&#xA;    'enabled' =&amp;gt; true,&#xA;    'fields' =&amp;gt; array(&#xA;        'text' =&amp;gt; 'Here goes my article.'&#xA;    )&#xA;);&#xA;&#xA;// add content to entry including created matrix&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'description' =&amp;gt; &quot;And of course the description...&quot;,&#xA;    'matriz' =&amp;gt; $block,&#xA;));&#xA;&#xA;// save entry&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="47" LastActivityDate="2016-08-10T20:09:42.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16312" PostTypeId="2" ParentId="16300" CreationDate="2016-08-10T22:09:58.520" Score="4" Body="&lt;p&gt;Author of Smart Map here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like your locations &lt;em&gt;are&lt;/em&gt; in a section (a Structure is a type of section). The first line of your solution is exactly what you'd need to get the &lt;code&gt;locations&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.entries.section('locations').limit(null) %}&#xA;&#xA;{{ craft.smartMap.map(locations) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just to clarify...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are you using the &quot;Address (Smart Map)&quot; field to store your addresses?&lt;/li&gt;&#xA;&lt;li&gt;And do each of those addresses contain &quot;Latitude&quot; and &quot;Longitude&quot; values?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If so, the code example above should definitely work for you!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-10T22:09:58.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16313" PostTypeId="1" AcceptedAnswerId="16317" CreationDate="2016-08-11T05:42:04.810" Score="4" ViewCount="356" Body="&lt;p&gt;I am writing a plugin with a Record. I want the primary key of the table to also be a &lt;em&gt;foreign key&lt;/em&gt; relating to the &lt;code&gt;craft_relations&lt;/code&gt; table. Ordinarily, I would add something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, it seems like the &lt;code&gt;craft_relations&lt;/code&gt; table &lt;strong&gt;does not have a matching Record&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add a primary key column which is also a foreign key?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-11T13:37:50.437" Title="Foreign Key column pointing to `craft_relations` table" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16316" PostTypeId="2" ParentId="13518" CreationDate="2016-08-11T09:32:37.697" Score="4" Body="&lt;p&gt;You can see in the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/controllers/ContactFormController.php#L148&quot; rel=&quot;nofollow&quot;&gt;code for the plugin on GitHub&lt;/a&gt; that it sets a 'notice':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setNotice($settings-&amp;gt;successFlashMessage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As the &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#setNotice-detail&quot; rel=&quot;nofollow&quot;&gt;official documentation&lt;/a&gt; mentions, this can later be grabbed with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.session.getFlash('notice') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then used as a normal message thereafter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ message }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5034" LastEditorUserId="5034" LastEditDate="2016-08-11T10:06:34.427" LastActivityDate="2016-08-11T10:06:34.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16317" PostTypeId="2" ParentId="16313" CreationDate="2016-08-11T12:03:32.413" Score="5" Body="&lt;p&gt;I might be wrong, but I don't believe you'll be able to do that within the &lt;code&gt;defineRelations()&lt;/code&gt; method – &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/records/BaseRecord.php#L565&quot; rel=&quot;nofollow&quot;&gt;Craft needs a record class for the table you want to create a relation with&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A workaround is to override the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/records/BaseRecord.php#L239&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;createTable()&lt;/code&gt;&lt;/a&gt; method in your record class and add the foreign key constraint manually using &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function createTable()&#xA;{&#xA;    parent::createTable();&#xA;    craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;addForeignKey($this-&amp;gt;getTableName(), 'id', 'relations', 'id', 'CASCADE', 'CASCADE');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To be perfectly honest the above feels quite hacky and there might be a better way – but it seems to work :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-11T13:37:50.437" LastActivityDate="2016-08-11T13:37:50.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16318" PostTypeId="1" AcceptedAnswerId="16319" CreationDate="2016-08-11T12:17:11.667" Score="2" ViewCount="420" Body="&lt;p&gt;I've been looking through the forum, it seems there's a few methods to retrieve a tags page but I'm looking for the most efficient method (both speed- and template-wise).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/828/looking-to-use-a-tag-slug-uri-and-loop-through-entries-of-that-tag&quot;&gt;&lt;code&gt;tag.name&lt;/code&gt;&lt;/a&gt; with &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;tag token (routes)&lt;/a&gt;, which utilises the original article template for rendering.&lt;/li&gt;&#xA;&lt;li&gt;Using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14629/tag-mysteriously-not-found&quot;&gt;&lt;code&gt;tag.slug&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10344/how-can-i-use-tag-slugs-in-urls&quot;&gt;&lt;code&gt;tag.title&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;search()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think #2 is the simplest and prettiest solution, but it's relatively undocumented as far as I can tell. Also, I'm using &lt;a href=&quot;https://craftcms.com/docs/tags#tag-groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;two tag groups&lt;/a&gt; and, although I've mentioned to my client to not add duplicate tags (e.g. &lt;code&gt;{ 'group 1': 'stress' }&lt;/code&gt; &lt;code&gt;{ 'group 2': 'Stress' }&lt;/code&gt; I'm interested to know the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is #2 the most optimised solution?&lt;/li&gt;&#xA;&lt;li&gt;Can it be used with a &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;tag token&lt;/code&gt;&lt;/a&gt; route?&lt;/li&gt;&#xA;&lt;li&gt;Will duplicate tags accross tag groups cause conflicts?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In my tests using #1 (the urls are ugly in my opinion), &lt;code&gt;Depression&lt;/code&gt; seems to return no results, perhaps because there is already a &lt;code&gt;depression&lt;/code&gt; tag in another tag group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I want one place for all tags, without having to create two different routes for both tag groups.&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-08-11T13:05:15.317" Title="Best solution for articles tag page?" Tags="&lt;url&gt;&lt;routes&gt;&lt;tags&gt;&lt;routing&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16319" PostTypeId="2" ParentId="16318" CreationDate="2016-08-11T13:05:15.317" Score="1" Body="&lt;p&gt;Ok, so I'm tenatively answering my own question — although I'd like someone to shed light on the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16318/best-solution-for-articles-tag-page&quot;&gt;duplicate tag problem&lt;/a&gt; — it seems like a combination of #1 and #2 works quite nicely, although I haven't extensively tested it yet.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if tag is defined %}&#xA;  {% set tag = craft.tags.slug(tag).first() %}&#xA;  {% set entries = craft.entries.section('articles').relatedTo(tag) %}&#xA;{% else %}&#xA;  {% set entries = craft.entries.section('articles') %}&#xA;{% endif %}&#xA;&#xA;{% for entry in entries %}&#xA;  ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working with the route &lt;code&gt;articles/tag/[tag token]&lt;/code&gt; set up. The only issue is when a tag that has a duplicate slug, whether that be within the same tag group or a different one, it returns no results (I'm not great at reading logs, but it doesn't seem to throw any errors either).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any additions to this answer would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3888" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-08-11T13:05:15.317" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16320" PostTypeId="1" CreationDate="2016-08-11T13:30:16.710" Score="2" ViewCount="137" Body="&lt;p&gt;First of all let me just say that I have only been using Craft for a few months and still has allot to learn about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is quite simple in that I have an express server running to display the data on the front-end. I am using Craft as a solution for the client to add or change content on their site. This is working well. I am even able to use your Element API to retrieve data from Craft and together with my Express server I can manipulate and display content where it is needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client has now recently asked me to add a section that would allow users to register users and this is where I am starting to have problems. Or at least, this is where I need some expert knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would just like to save the user data via post. I have looked at a few options out there but honestly I don't want to build a plugin to handle this. Is there a way I could post and save data to Craft without it being too complicated?&lt;/p&gt;&#xA;" OwnerUserId="5154" LastEditorUserId="4466" LastEditDate="2016-08-11T14:00:08.447" LastActivityDate="2016-08-11T14:03:35.640" Title="Express Server posting user data to Craft" Tags="&lt;users&gt;&lt;post&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16321" PostTypeId="2" ParentId="16295" CreationDate="2016-08-11T13:44:03.357" Score="4" Body="&lt;p&gt;We managed to circumvent the issue by using the sql session storage SimpleSAML PHP also provides. Not a real solution but a viable workaround.&lt;/p&gt;&#xA;" OwnerUserId="5496" LastActivityDate="2016-08-11T13:44:03.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16322" PostTypeId="2" ParentId="16320" CreationDate="2016-08-11T14:03:35.640" Score="2" Body="&lt;p&gt;You'd normally use a front-end form to create users on a Craft site. You can add fields to this form to submit more than the standard set of fields. I believe you could use the same form within your Express app. You are just sending the data via a POST request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow&quot;&gt;the documentation&lt;/a&gt; for an example.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-08-11T14:03:35.640" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16324" PostTypeId="1" AcceptedAnswerId="16327" CreationDate="2016-08-11T14:30:51.357" Score="6" ViewCount="960" Body="&lt;p&gt;Is it possible to implement PHPUnit into Craft CMS? If so, where can I find a good explanation or tutorial? I already tried a Github link for a plugin (testing the plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am new to both but really want to TDD the plugins. Any example pages or a quick guide would be great!&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="4466" LastEditDate="2016-08-11T14:32:51.690" LastActivityDate="2016-08-11T17:04:38.837" Title="PHPUnit testing for Craft plugins or controllers" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16325" PostTypeId="2" ParentId="14834" CreationDate="2016-08-11T15:57:07.270" Score="2" Body="&lt;p&gt;You'll need to save the new user before you can activate them. This code should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;users-&amp;gt;saveUser($newUser)) {&#xA;    craft()-&amp;gt;users-&amp;gt;activateUser($newUser);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2016-08-11T15:57:07.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16326" PostTypeId="1" AcceptedAnswerId="16391" CreationDate="2016-08-11T16:30:23.090" Score="4" ViewCount="679" Body="&lt;p&gt;We are seeing the following symptoms:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We routinely encounter stuck &lt;code&gt;Generating pending image transforms&lt;/code&gt; tasks and have to manually mark the tasks as failed using SQL in the table &lt;code&gt;craft_tasks&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Broken image links on pages that use image transforms. This can sometimes be fixed with multiple page refreshes.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;phperrors.log&lt;/code&gt; message &lt;code&gt;PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /.../craft/app/vendor/imagine/imagine/lib/Imagine/Imagick/Image.php on line 228&lt;/code&gt;, even though are php.ini sets the max execution time to 300. I am pretty sure this is from the hard-coded limit set in &lt;code&gt;AssetTransformsService.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Our site has a large variety of images; the site is for a advertising agency. We can reproduce the problem pretty easily with animated GIFs, although size of the GIF does not alone seem to be the factor, because some 2mb GIFs never transform, while some 4mb GIFs transform very quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there are a few issues going on:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The 120 second limit is affecting some images that take a long time to transform, resulting in a exceeded exec time log message.&lt;/li&gt;&#xA;&lt;li&gt;Some images are never completing the transform process, seemingly regardless of the transform time, resulting in an exceeded exec time log message.&lt;/li&gt;&#xA;&lt;li&gt;Some images mysteriously get stuck in the image transform process, resulting in no log messages.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the recommended way for increasing the hard-coded 120 second limit?&lt;/li&gt;&#xA;&lt;li&gt;How can we track down the cause(s) of the stuck transforms?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;AssetTransformsService.php Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft core file &lt;code&gt;craft/app/services/AssetTransformsService.php&lt;/code&gt; has a hard-coded PHP &lt;code&gt;max_execution_time&lt;/code&gt; of 120 seconds.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;line 421: ini_set('max_execution_time', 120);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some Craft Info&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are using Craft CMS version 2.6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some Sever Info&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have &lt;code&gt;imagick&lt;/code&gt; enabled as our image driver.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imagick module version  3.4.1&#xA;Imagick compiled with ImageMagick version   ImageMagick 6.7.2-7 2016-06-16 Q16 http://www.imagemagick.org&#xA;Imagick using ImageMagick library version   ImageMagick 6.7.2-7 2016-06-16 Q16 http://www.imagemagick.org&#xA;ImageMagick release date    2016-06-16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3834" LastEditorUserId="3834" LastEditDate="2016-08-12T15:30:22.420" LastActivityDate="2016-08-17T03:44:12.463" Title="Image Transform Problems, Timeouts, Stuck Transforms" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16327" PostTypeId="2" ParentId="16324" CreationDate="2016-08-11T17:04:38.837" Score="3" Body="&lt;p&gt;There is a good example of testing with PHPUnit in a Craft plugin here: &lt;a href=&quot;https://github.com/selvinortiz/craft.loath&quot; rel=&quot;nofollow&quot;&gt;https://github.com/selvinortiz/craft.loath&lt;/a&gt; and an example on how to stub out the global &lt;code&gt;craft()&lt;/code&gt; class here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10049/stub-out-the-global-craft-object-for-phpunit-tests&quot;&gt;Stub out the global craft() object for PHPUnit tests&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that testing in Craft should be a lot easier/convenient in the upcoming Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-11T17:04:38.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16328" PostTypeId="1" CreationDate="2016-08-12T00:12:12.453" Score="1" ViewCount="87" Body="&lt;p&gt;I'm building my first site with Craft, so this is a bit newbie question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've build a category with a some fields.&#xA;How can I output all fields form the selected category on the current entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5237" LastEditorUserId="57" LastEditDate="2016-08-12T03:14:39.453" LastActivityDate="2016-08-12T03:21:30.393" Title="How do I output all field values from a Category on the current entry?" Tags="&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16329" PostTypeId="2" ParentId="16328" CreationDate="2016-08-12T03:21:30.393" Score="2" Body="&lt;p&gt;If you have a &lt;a href=&quot;https://craftcms.com/docs/categories-fields&quot; rel=&quot;nofollow&quot;&gt;Categories field&lt;/a&gt; on your entry called &lt;code&gt;myCategoryField&lt;/code&gt;, you can check if it has any Categories selected by going:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myCategoryField | length %}&#xA;    There are categories selected!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to loop through all of the selected categories for that field, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myCategoryField | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for category in entry.myCategoryField %}&#xA;            &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info you can read more in the &lt;a href=&quot;https://craftcms.com/docs/categories-fields#templating&quot; rel=&quot;nofollow&quot;&gt;templating section&lt;/a&gt; of the Categories field's documentation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-12T03:21:30.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16331" PostTypeId="1" AcceptedAnswerId="16332" CreationDate="2016-08-12T09:56:45.587" Score="4" ViewCount="235" Body="&lt;p&gt;I've looked at every option I can think of so hoping that someone can assist. We're on a dedicated server with full root access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've got a relatively small site that now needs a Spanish locale adding. When I go to add it, everything seems to be smooth running until 'ResaveAllElements - step 3' and 'ResaveElements - step 99 (sometimes around 94 ish too). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing I checked was the error log and found:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Allowed memory size of 268435456 bytes exhausted (tried to allocate 79 bytes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, I then changed this to 1024M - no joy. Changed it to -1 and still get exactly the same issue. These settings are reflected in the phpinfo too so they seem to be in place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then phoned our server company and ran it by them who suggested placing .user.ini files in there to be sure and so we've done that and now we're at a loss. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found another post on here with a similar issue where the suggestion was to examine the craft.log - did that and found:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WHERE (lft = 1) AND (status = :status). Bound with :status='running') 2016/08/12 09:36:53 [trace] [system.CModule] Loading &quot;components&quot; application component in /*/craft/app/etc/web/WebApp.php (593) in /*/craft/app/models/TaskModel.php (81) in /*/craft/app/models/TaskModel.php (39)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything else we can try to get the locale that we've missed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2017-03-09T19:51:15.283" Title="Adding new locale - hangs at Step 3 'ResaveAllElements'" Tags="&lt;localization&gt;&lt;php&gt;&lt;memory&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16332" PostTypeId="2" ParentId="16331" CreationDate="2016-08-12T11:50:06.143" Score="6" Body="&lt;p&gt;You probably need to up &lt;a href=&quot;https://craftcms.com/docs/config-settings#phpMaxMemoryLimit&quot; rel=&quot;noreferrer&quot;&gt;Craft's internal memory limit&lt;/a&gt;, as well – the following should go into the array in your &lt;code&gt;general.php&lt;/code&gt; configuration file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'phpMaxMemoryLimit' =&amp;gt; '1024M',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-12T11:50:06.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16334" PostTypeId="1" AcceptedAnswerId="16335" CreationDate="2016-08-12T16:43:19.873" Score="1" ViewCount="893" Body="&lt;p&gt;I have been searching through the admin panel on our staging site trying to find where to turn off the application log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that you can turn off dev mode, and that will turn off the log, but I still want dev mode on, I just want to turn off the log itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did look at the documentation &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and was not able to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="45" LastEditDate="2016-08-12T18:29:47.283" LastActivityDate="2016-08-12T18:29:47.283" Title="How to turn off application log in dev mode" Tags="&lt;devmode&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16335" PostTypeId="2" ParentId="16334" CreationDate="2016-08-12T17:04:39.140" Score="2" Body="&lt;p&gt;Lifting from &lt;a href=&quot;https://craftcms.stackexchange.com/a/489/1098&quot;&gt;this answer&lt;/a&gt; to a similar question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll have to write a simple, custom plugin, and add the following to the &lt;code&gt;init()&lt;/code&gt; method in your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;log-&amp;gt;removeRoute('WebLogRoute');&#xA;craft()-&amp;gt;log-&amp;gt;removeRoute('ProfileLogRoute');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For instant success, you can scaffold your plugin by visiting &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the plugin factory&lt;/a&gt; – name it whatever you want and don't enable any components.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-08-12T17:04:39.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16336" PostTypeId="1" CreationDate="2016-08-12T19:08:23.557" Score="0" ViewCount="190" Body="&lt;p&gt;I am getting the error in the image below.  It is not always generated by the same file (in this case &quot;.../IOHelper.php&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BSKZP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BSKZP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't quite figure out what is causing this, Can anyone provide some insight into what can cause this error specifically (I understand there is a memory issue) and maybe point to where I could be looking as far as a culprit.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My hunch is it could be due to this relational query being done on users (team is what it is called here).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedDepartment = craft.entries.section('departments').relatedTo({&#xA;     sourceElement: teamEntry,&#xA;     field: 'departmentLabel'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My understanding is this is set up correctly and should only pull the department information related to that entry in the loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the whole block looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for teamEntry in craft.entries.section('team').order('title').find() %}&#xA;&#xA;    {% set relatedDepartment = craft.entries.section('departments').relatedTo({&#xA;        sourceElement: teamEntry,&#xA;        field: 'departmentLabel'&#xA;    }) %}&#xA;&#xA;      &amp;lt;div class=&quot;photo team-photo col-xs-6 col-sm-4 col-md-3 col-lg-2 team-photo-{% for department in teamEntry.departmentLabel %}{{ department.id }}{% endfor %} all&quot; data-department-id=&quot;{% for department in teamEntry.departmentLabel %}{{ department.id }}{% endfor %}&quot; data-border-color=&quot;{% for department in relatedDepartment %}{{ department.departmentColor }}{%endfor%}&quot;&amp;gt;&#xA;&#xA;        {% set mad = teamEntry.imgMad.first() %}&#xA;        {% set disgusted = teamEntry.imgDisgusted.first() %}&#xA;        {% set sad = teamEntry.imgSad.first() %}&#xA;        {% set neutral = teamEntry.imgNeutral.first() %}&#xA;        {% set content = teamEntry.imgContent.first() %}&#xA;        {% set happy = teamEntry.imgHappy.first() %}&#xA;&#xA;        {% if neutral | length&amp;gt;0 %}&#xA;          &amp;lt;img src=&quot;{{ neutral.url }}&quot; class=&quot;image mood team-{% for department in teamEntry.departmentLabel %}{{ department.id }}{% endfor %}&quot;/&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;img src=&quot;/img/nophoto.png&quot; class=&quot;team-{% for department in teamEntry.departmentLabel %}{{ department.id }}{% endfor %} image&quot; alt=&quot;no photo for {{ teamEntry.title }}&quot;/&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;names&quot;&amp;gt;{{ teamEntry.title }}&amp;lt;br&amp;gt;&amp;lt;span&amp;gt;{% for department in teamEntry.departmentLabel %}{{ department.title }}{% endfor %}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;hovertext t3modal&quot; href=&quot;#modalContent&quot; data-slug-url=&quot;/people/detail?q={{ teamEntry.slug }}&quot; data-slug=&quot;{{ teamEntry.slug }}&quot; &amp;gt;&#xA;          &amp;lt;div class=&quot;inhover&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;title&quot;&amp;gt;View Profile&amp;lt;/span&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3817" LastActivityDate="2016-08-12T19:08:23.557" Title="How to solve &quot;fatal error: out of memory&quot;" Tags="&lt;craft-pro&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-08-16T16:45:31.927" ContentLicense="CC BY-SA 3.0" />
  <row Id="16337" PostTypeId="1" AcceptedAnswerId="16344" CreationDate="2016-08-12T21:24:24.440" Score="3" ViewCount="219" Body="&lt;p&gt;I need to give users the ability to be able to choose which channel of the company their message goes to, i.e. General Inquiries, Estimates etc. using the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;P&amp;amp;T Contact Form Plugin&lt;/a&gt; and a &lt;code&gt;select&lt;/code&gt; box. How would I be able to make that work?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-04-18T05:35:10.590" Title="Recipients as dropdown with Contact Form Plugin" Tags="&lt;templating&gt;&lt;plugin-contactform&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16338" PostTypeId="1" AcceptedAnswerId="16347" CreationDate="2016-08-12T23:09:35.180" Score="1" ViewCount="159" Body="&lt;p&gt;I've tried creating a &lt;code&gt;contactform.php&lt;/code&gt; file with the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;P&amp;amp;T Contact Form plugin&lt;/a&gt; and using the code in the documentation to be able to programmatically add recipients. However, when I use this code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    namespace Craft;&#xA;&#xA;    $toEmail = craft()-&amp;gt;request-&amp;gt;getPost('toEmail');&#xA;    $toEmail = craft()-&amp;gt;security-&amp;gt;validateData($toEmail);&#xA;&#xA;    return array(&#xA;        'toEmail' =&amp;gt; ($toEmail ?: null),&#xA;        ...&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I end up getting a white screen of death and a 500 Internal Server Error. I don't know why it's doing this, I tried editing the permissions of my &lt;code&gt;craft&lt;/code&gt; folder and the &lt;code&gt;contactform.php&lt;/code&gt; file, but nothing has worked and I keep getting a white screen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2016-08-14T02:09:21.533" Title="contactform.php messing up site" Tags="&lt;templating&gt;&lt;config&gt;&lt;php&gt;&lt;plugin-contactform&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16339" PostTypeId="1" CreationDate="2016-08-13T00:49:18.623" Score="1" ViewCount="126" Body="&lt;p&gt;I have a Craft installation on DigitalOcean, with the smallest package:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;512MB Memory&#xA;1 Core Processor&#xA;20GB SSD Disk&#xA;1TB Transfer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I installed the default LAMP droplet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PROBLEM:&#xA;MySQL crashes from time to time. There were no significant server load either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might be a root cause? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a plugin that automatically reports when the site is down?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RzXjx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RzXjx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4755" LastEditorUserId="22" LastEditDate="2016-08-13T03:07:18.270" LastActivityDate="2016-08-13T03:07:18.270" Title="Plugin to report when site becomes unavailable" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16341" PostTypeId="2" ParentId="16339" CreationDate="2016-08-13T02:18:30.503" Score="3" Body="&lt;p&gt;There's no plugin for that... it wouldn't quite make sense. If the site went down, the plugin would be down too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to find a 3rd party service to monitor the site's uptime. There are several services which will alert (via text or email) if your site becomes unavailable. Here are a few examples...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://uptimerobot.com/&quot; rel=&quot;nofollow&quot;&gt;Uptime Robot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://newrelic.com/&quot; rel=&quot;nofollow&quot;&gt;New Relic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.pingdom.com/&quot; rel=&quot;nofollow&quot;&gt;Pingdom&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-13T02:18:30.503" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16342" PostTypeId="2" ParentId="16337" CreationDate="2016-08-13T04:33:31.870" Score="2" Body="&lt;p&gt;There isn't a way to do this natively with the plugin, so you'd end up having to fork the plugin and adding your own custom business logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the plugin is set to only send to one &quot;To Email&quot; globally under its settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your fork would probably need to change that in the settings page to a dropdown for each of your defined sections and to be able to specify an email address for each one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-13T04:33:31.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16343" PostTypeId="2" ParentId="10278" CreationDate="2016-08-13T06:42:00.577" Score="3" Body="&lt;p&gt;I wrote a plugin called &lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft&quot; rel=&quot;nofollow&quot;&gt;Incognito Field&lt;/a&gt;, which is basically a plain ol' PlainText field that can be set to &lt;code&gt;disabled&lt;/code&gt;, &lt;code&gt;readonly&lt;/code&gt; or &lt;code&gt;hidden&lt;/code&gt;. Perfect when you need to update a field via a plugin and never via the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-13T06:42:00.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16344" PostTypeId="2" ParentId="16337" CreationDate="2016-08-13T14:50:24.833" Score="3" Body="&lt;p&gt;A custom dropdown that allows you to trigger emails to different departments is possible using &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; and the Sprout Fields &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/email-select-field&quot; rel=&quot;nofollow&quot;&gt;Email Select&lt;/a&gt; field.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-13T14:50:24.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16345" PostTypeId="2" ParentId="15413" CreationDate="2016-08-13T18:41:09.100" Score="10" Body="&lt;p&gt;Unfortunately, a simple HTML file input on its own isn't enough to upload an image (in Craft or anywhere else) – the input simply exposes the file on your local filesystem to the browser/server. In other words, with your current setup, you're not actually uploading anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, you have two choices:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use Assets and Craft's built-in Assets ElementSelect input (easy)&lt;/li&gt;&#xA;&lt;li&gt;Don't use Assets; upload the image natively using a file input (harder)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Personally, I'd recommend that unless you &lt;em&gt;can't&lt;/em&gt; have the image be an Asset file for some reason, you should definitely go with the Assets approach. It's way easier to set up, offers a familiar user experience and you can even use image transforms and whatnot since your &lt;code&gt;myImage&lt;/code&gt; file will be a bona fide Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, here's how option 1 could look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugin's &lt;code&gt;settings.html&lt;/code&gt; file, replace your current call to the &lt;code&gt;forms.file()&lt;/code&gt; macro with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.field({&#xA;  label: &quot;My Image&quot;&#xA;}, include('_includes/forms/elementSelect', myImageSelectConfig)) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, fire up your plugin's primary class. Revise your &lt;code&gt;getSettingsHtml()&lt;/code&gt; method to include the &lt;code&gt;myImageSelectConfig&lt;/code&gt; attribute referenced in &lt;code&gt;settings.html&lt;/code&gt; above, so the method looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('yourpluginhandle/settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;        'myImageSelectConfig' =&amp;gt; array(&#xA;            'id'                 =&amp;gt; 'myImage',&#xA;            'name'               =&amp;gt; 'myImage',&#xA;            'jsClass'            =&amp;gt; 'Craft.AssetSelectInput',&#xA;            'elementType'        =&amp;gt; new ElementTypeVariable(craft()-&amp;gt;elements-&amp;gt;getElementType(ElementType::Asset)),&#xA;            'elements'           =&amp;gt; $this-&amp;gt;getSettings()['myImage'] ? craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset, array('id' =&amp;gt; $this-&amp;gt;getSettings()['myImage'])) : null,&#xA;            'sources'            =&amp;gt; array('folder:2'),&#xA;            'criteria'           =&amp;gt; array('kind' =&amp;gt; array('image'), 'localeEnabled' =&amp;gt; null),&#xA;            'limit'              =&amp;gt; 1,&#xA;            'viewMode'           =&amp;gt; 'table',&#xA;            'selectionLabel'     =&amp;gt; Craft::t('Add image'),&#xA;        ),&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: The &lt;code&gt;sources&lt;/code&gt; attribute refers to the ID(s) for the Asset folder the admin should upload images to (and choose images from). You can look at the &lt;code&gt;craft_assetfolders&lt;/code&gt; database table to figure out which ID(s) you want. Alternatively you can remove the &lt;code&gt;sources&lt;/code&gt; property entirely, to enable all folders – which is probably the best option if this is going to be a publicly available plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's it. The actual &lt;code&gt;myImage&lt;/code&gt; setting value stored will be an array with the ID to the selected Asset file, e.g. &lt;code&gt;{&quot;myImage&quot;:[&quot;42&quot;]}&lt;/code&gt;. If you need to pull the Asset in a template, you'll need to add a &lt;a href=&quot;http://buildwithcraft.com/docs/plugins/variables&quot; rel=&quot;noreferrer&quot;&gt;Variable&lt;/a&gt; class to your plugin, exposing the plugin settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPluginVariable&#xA;{&#xA;    public function settings()&#xA;    {&#xA;        return craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assetId = craft.myPlugin.settings.myImage %}&#xA;{% set asset = craft.assets.id(assetId).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you don't want to go with the Assets approach&lt;/strong&gt;, you can keep your &lt;code&gt;forms.file()&lt;/code&gt; macro in &lt;code&gt;settings.html&lt;/code&gt;. However, there's a few more things you'll need to handle to get the upload working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, in order to actually upload a file from a file input, the enclosing form needs to have an &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; attribute. Unfortunately, plugin settings forms don't, and there's no real way to add it. However, you can use jQuery to hack it in – add this to your plugin's &lt;code&gt;settings.html&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJs '$(&quot;form:first&quot;).attr(&quot;enctype&quot;, &quot;multipart/form-data&quot;);' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second, you'll need some server side code to actually handle the upload. Add the following to your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepSettings($settings)&#xA;{&#xA;&#xA;    $imageFile = UploadedFile::getInstanceByName('settings.myImage');&#xA;&#xA;    if ($imageFile) {&#xA;&#xA;        // Where should the image be stored?&#xA;        $basePath = $_SERVER['DOCUMENT_ROOT'];&#xA;        $uploadFolder = '/uploads/yourpluginhandle/';&#xA;        $filePath = $basePath.$uploadFolder.$imageFile-&amp;gt;name;&#xA;&#xA;        // Make sure the upload folder exists&#xA;        IOHelper::ensureFolderExists($basePath.$uploadFolder);&#xA;&#xA;        // Attempt to upload the file&#xA;        if ($imageFile-&amp;gt;saveAs($filePath)) {&#xA;            // File uploaded successfully – store the relative filepath in the plugin settings&#xA;            $settings['myImage'] = str_replace($basePath, '', $filePath);&#xA;        } else {&#xA;            // Aw.&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Unable to upload image {filename}', array(&#xA;                'filename' =&amp;gt; $imageFile-&amp;gt;name,&#xA;            )));&#xA;        }&#xA;    }&#xA;&#xA;    return $settings;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above example is pretty much the bare minimum you'd need in order to upload a file from your plugin's settings page, to an arbitrary folder on your server's file system. The example &lt;code&gt;prepSettings()&lt;/code&gt; script will upload the file to a folder called &lt;code&gt;/uploads/yourpluginhandle&lt;/code&gt; in the public webroot (i.e. &lt;code&gt;$_SERVER['DOCUMENT_ROOT']&lt;/code&gt;), before storing the &lt;em&gt;relative&lt;/em&gt; path to the file in the settings, if the upload was successful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that file uploading is actually fairly complex (lots of things can go wrong), and also a potential security risk. You should probably consider adding some code to ensure that the file's mime type (&lt;code&gt;$imageFile-&amp;gt;type&lt;/code&gt;), size (&lt;code&gt;$imageFile-&amp;gt;size&lt;/code&gt;) and other properties are legit, before calling &lt;code&gt;$file-&amp;gt;saveAs()&lt;/code&gt;. You might also need to create a UI for displaying and deleting the current image, and making sure old and no longer selected files are deleted from the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I'd posit that a vanilla browser file input is a pretty terrible user experience, compared to the Assets select input in Craft proper. There's all sorts of JavaScript libraries to help out with that, of course – in any case the above is hopefully a good starting point if you go down this road.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-13T18:46:34.880" LastActivityDate="2016-08-13T18:46:34.880" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16346" PostTypeId="1" AcceptedAnswerId="16349" CreationDate="2016-08-14T00:52:03.293" Score="2" ViewCount="536" Body="&lt;p&gt;So, I am new.  I want to display the 1-n most recent posts in the same category as the current entry (preferably excluding the current entry) -- i.e., I want to have a section with Other Similar Posts at the bottom of an entry page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only have one Category Group = beerStyles. There are multiple categories to choose from in beerStyles. Each news entry includes a field called &quot;style&quot; to assign a category from beerStyles. Each entry can have only 1 category.  (Note there is no entries field in news entry, just the style field to select a category form beerStyles.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;aside&amp;gt;&#xA;        &amp;lt;h4 class=&quot;text-center&quot;&amp;gt;Related Posts&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;div class=&quot;columns&quot;&amp;gt;&#xA;            &amp;lt;ul class=&quot;medium-block-grid-3&quot;&amp;gt;  &#xA;                {% set category = craft.categories.slug('beerStyles') %}&#xA;                {% set entries = craft.entries.relatedTo(category) %}&#xA;                {% for entry in entries %}&#xA;                &amp;lt;li class=&quot;text-center&quot;&amp;gt;&amp;lt;a href=&quot;{{entry.url}}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt; &#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/aside&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error is thrown, but other news entries with the same category assigned are not appearing.  Nothing is appearing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?  And thank you in advance for your time and assistance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.  I know I left off the .limit(x) to limit the number of posts  I just want to get it working first. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-08-14T13:35:02.913" Title="Show Other Entries in Same Category" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16347" PostTypeId="2" ParentId="16338" CreationDate="2016-08-14T02:09:21.533" Score="3" Body="&lt;p&gt;The problem is the &lt;code&gt;...&lt;/code&gt; in your &lt;code&gt;contactform.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs use it because they assume you might have some other valid config settings you want to include in that config file, but it's not real code, which is why PHP is choking on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove the &lt;code&gt;...&lt;/code&gt; and you should be set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-14T02:09:21.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16348" PostTypeId="1" AcceptedAnswerId="16350" CreationDate="2016-08-14T13:34:05.660" Score="4" ViewCount="1301" Body="&lt;p&gt;I'm a newbie to Craft and am working with a raw version of Craft CMS 2.6.2903 on localhost and am trying to understand some of the basics. The problem that I am encountering at the moment is to do with the Twig &lt;strong&gt;&lt;em&gt;includeCssFile&lt;/em&gt;&lt;/strong&gt; command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a folder that will contain all my CSS details, so I went to &lt;strong&gt;_layout.html&lt;/strong&gt; and moved all the CSS script from between the &#xA;&lt;strong&gt;style&lt;/strong&gt; tags into a new script which I saved at &lt;strong&gt;craft/templates/styles/index.css&lt;/strong&gt;. I then deleted the &lt;strong&gt;style&lt;/strong&gt; tags from _layout.html. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added this line to the &amp;lt;&lt;strong&gt;head&lt;/strong&gt;&gt; section of the &lt;strong&gt;_layout.html&lt;/strong&gt; script:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% includeCssFile &quot;styles/index.css&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that the &amp;lt;&lt;strong&gt;head&lt;/strong&gt;&gt; section looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;&amp;lt;meta charset=&quot;utf-8&quot; /&amp;gt;&#xA;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt; /title&amp;gt;&#xA;&amp;lt;link rel=&quot;home&quot; href=&quot;{{ siteUrl }}&quot; /&amp;gt;&#xA;{% includeCssFile &quot;styles/index.css&quot; %}&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and once again the Home page worked perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem occurred after I moved the whole &lt;strong&gt;styles&lt;/strong&gt; folder up one level (i.e. to the same level as the &lt;em&gt;templates&lt;/em&gt; folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the calling code to &#xA;{% includeCssFile &quot;../styles/index.css&quot; %}&#xA;and refreshed the home page and had lost all the page styling. I played around with removing the '&lt;strong&gt;../&lt;/strong&gt;' and changing it to '&lt;strong&gt;./&lt;/strong&gt;' and even '&lt;strong&gt;/&lt;/strong&gt;' but it still didn't work. When I returned the &lt;strong&gt;styles&lt;/strong&gt; folder to the &lt;strong&gt;templates&lt;/strong&gt; folder, it all worked okay again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been a couple of similar questions already posted on this group, but they haven't resolved my problem (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15662/including-css-js-assets&quot;&gt;link 1&lt;/a&gt;, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15264/why-is-news-entry-not-extending-layout&quot;&gt;link 2&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please tell me what I need to do?&lt;/p&gt;&#xA;" OwnerUserId="5356" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-09-13T20:04:06.800" Title="Newbie: Trying to understand includeCssFile" Tags="&lt;css&gt;&lt;include&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16349" PostTypeId="2" ParentId="16346" CreationDate="2016-08-14T13:35:02.913" Score="4" Body="&lt;p&gt;Based on your description, this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.style|length %}&#xA;&amp;lt;aside&amp;gt;&#xA;    &amp;lt;h4 class=&quot;text-center&quot;&amp;gt;Related Posts&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;div class=&quot;columns&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;medium-block-grid-3&quot;&amp;gt;  &#xA;            {% set styleCategory = entry.style.first() %}&#xA;            {% set relatedEntries = craft.entries.section('news').relatedTo({&#xA;                targetElement: styleCategory,&#xA;                field: 'style'&#xA;            }).id('not '~entry.id) %}&#xA;            {% for relatedEntry in relatedEntries %}&#xA;                &amp;lt;li class=&quot;text-center&quot;&amp;gt;&amp;lt;a href=&quot;{{relatedEntry.url}}&quot;&amp;gt;{{relatedEntry.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt; &#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/aside&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A few notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– I've wrapped the whole &quot;Related posts&quot; in a conditional testing if the &lt;code&gt;entry.style&lt;/code&gt; categories field is not empty (&lt;code&gt;if entry.style|length&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Personal preference, but for readability's sake I find its usually a good idea to be specific/semantic with variable names (e.g. &lt;code&gt;styleCategory&lt;/code&gt; instead of just &lt;code&gt;category&lt;/code&gt;, &lt;code&gt;relatedEntries&lt;/code&gt; instead of &lt;code&gt;entries&lt;/code&gt; etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– The &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;field&lt;/code&gt; attributes for the &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo()&lt;/code&gt;&lt;/a&gt; parameter are not required – you could just do &lt;code&gt;.relatedTo(styleCategory)&lt;/code&gt;. Being specific is a minor performance win and avoids wrong results if you have multiple relations involving the same elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– The &lt;code&gt;id('not '~entry.id)&lt;/code&gt; prevents the current entry from being returned&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-14T13:35:02.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16350" PostTypeId="2" ParentId="16348" CreationDate="2016-08-14T14:04:22.590" Score="3" Body="&lt;p&gt;Whenever Craft receives an URL request, &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;it tries to figure out what resource to serve the client&lt;/a&gt;. Among other things, it'll look inside your &lt;code&gt;templates&lt;/code&gt; folder and try to find the requested resource there – which is why a request to &lt;code&gt;styles/index.css&lt;/code&gt; works if that file exists inside your templates folder. However, Craft only looks at files in your templates folder when it evaluates the request URL, nowhere else – which is why &lt;code&gt;../styles/index.css&lt;/code&gt; doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, &lt;a href=&quot;https://craftcms.stackexchange.com/a/3093/1098&quot;&gt;it's usually a bad idea to serve external resources (CSS, JS files etc) from outside your public web root&lt;/a&gt;. If you can, put your CSS and JavaScript files somewhere in your public root directory, and make sure you're not using relative URLs for &lt;code&gt;{% includeCssFile %}&lt;/code&gt; – i.e. you should use &lt;code&gt;{% includeCssFile '/styles/index.css' %}&lt;/code&gt; if you have a folder called &lt;code&gt;styles&lt;/code&gt; in your public web root (alongside your &lt;code&gt;index.php&lt;/code&gt; file).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to inline your CSS files, in which case you can put the files whereever you want. I recommend &lt;a href=&quot;https://github.com/aelvan/Inlin-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Inlin plugin&lt;/a&gt; for all your inlining needs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    &amp;lt;style&amp;gt;&#xA;        {{ craft.inlin.er('styles/index.css') }}&#xA;    &amp;lt;/style&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to inline files without a plugin, you can use the Twig &lt;code&gt;source&lt;/code&gt; function – outlined in &lt;a href=&quot;https://craftcms.stackexchange.com/a/12314/1098&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-14T14:35:31.737" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16351" PostTypeId="1" AcceptedAnswerId="16352" CreationDate="2016-08-14T14:55:12.980" Score="3" ViewCount="54" Body="&lt;p&gt;So, I'm in the process of building a fieldtype, and I'd like to output an HTML element and some javascript when a developer calls my plugin like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.fieldtypeHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field returns an object with other methods/properties on it, but I'd like to specifically provide something different when a developer calls my fieldtype without any other chaining.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried pass a class with a &lt;code&gt;__toString()&lt;/code&gt; method, but it just returns a string. (I don't know what I expected, honestly.) I also know that coupling the HTML output with the class &lt;em&gt;seems&lt;/em&gt; a bit dirty, even if that did work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4086" LastEditorUserId="125" LastEditDate="2016-08-14T21:03:07.703" LastActivityDate="2016-08-14T21:03:07.703" Title="How can I specify what happens when someone calls my fieldtype without any further dot chains?" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16352" PostTypeId="2" ParentId="16351" CreationDate="2016-08-14T17:24:27.330" Score="3" Body="&lt;p&gt;&lt;code&gt;entry.myFieldHandle&lt;/code&gt; will return whatever the field type’s &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/IFieldType#prepValue-detail&quot; rel=&quot;nofollow&quot;&gt;prepValue()&lt;/a&gt; function returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;always&lt;/em&gt; want that to be HTML, then prepValue() can just return the HTML as a string or \Twig_Markup object via &lt;a href=&quot;https://craftcms.com/classreference/helpers/TemplateHelper#getRaw-detail&quot; rel=&quot;nofollow&quot;&gt;TemplateHelper::getRaw()&lt;/a&gt; so devs don't have to type &lt;code&gt;|raw&lt;/code&gt; when outputting the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it to be an object that supports sub-properties and methods, then have prepValue() return the object. Give the class a &lt;code&gt;__toString()&lt;/code&gt; method, which defines the string that should be returned when the object is treated like a string. Behind the scenes, &lt;code&gt;__toString()&lt;/code&gt; is what will be called when a template has &lt;code&gt;{{ entry.myFieldHandle }}&lt;/code&gt;. But note that this is a PHP construct and PHP mandates that the method returns an actual string, so you can’t return a \Twig_Markup object here. Devs will have to type &lt;code&gt;{{ entry.myFieldHandle|raw }}&lt;/code&gt; to prevent Twig from escaping the HTML.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-08-14T17:24:27.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16353" PostTypeId="2" ParentId="12313" CreationDate="2016-08-14T18:38:10.930" Score="5" Body="&lt;p&gt;An alternative to the &lt;code&gt;source&lt;/code&gt; function is using &lt;a href=&quot;https://github.com/aelvan/Inlin-Craft&quot; rel=&quot;noreferrer&quot;&gt;my Inlin plugin&lt;/a&gt;. It lets you inline files from wherever you want; the document root is the base folder, but &lt;code&gt;..&lt;/code&gt; works just fine.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-08-14T18:38:10.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16354" PostTypeId="1" AcceptedAnswerId="18948" CreationDate="2016-08-14T19:20:36.027" Score="3" ViewCount="1226" Body="&lt;p&gt;My image transform task always gets stuck halfway through so that I have to &quot;repair&quot; the task as per &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;this guide&lt;/a&gt;. Im trying to convert about 150 images (amounts to ~300 steps). Resetting the task within the database does work but it's not a permanent solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've upped the php memory limit to 1024M, execution time is 0 and Apaches timeout is set to a ridiculously high number. Disk space is available and it's happening with imagemagick as well as gd. It also happens both on my local dev VM running Ubuntu 14.04 as well as on my Debian server. PHP and Apache error logs are empty on both machines. I'm running the Personal edition and the latest version of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to set &lt;code&gt;ini_set('max_execution_time', 0);&lt;/code&gt; in &lt;code&gt;craft/app/services/AssetTransformsService.php&lt;/code&gt; but it didn't change anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Some image transforms are missing after restarting the task until it's complete. That renders the workaround by resetting the task in the db basically useless because not all images are transformed by the time it's complete.&lt;/li&gt;&#xA;&lt;li&gt;It's not a specific image that is preventing the task from completing, as it's always a different image that it's stuck on. &lt;/li&gt;&#xA;&lt;li&gt;There are usually 75-85 images converted until it's stuck.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Update Asset Indexes&lt;/code&gt; doesn't help.&lt;/li&gt;&#xA;&lt;li&gt;Clearing all caches makes Craft convert all images again. It doesn't delete the old files, it just overwrites them (and gets stuck, as usual).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5518" LastEditorUserId="5518" LastEditDate="2016-08-14T20:35:17.877" LastActivityDate="2017-02-22T17:04:57.343" Title="Generating pending image transforms stuck" Tags="&lt;image-transforms&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16355" PostTypeId="1" CreationDate="2016-08-14T19:51:34.047" Score="1" ViewCount="1176" Body="&lt;p&gt;Does anyone know a proper way to DRY up an entry template so that it can dynamically become an item listing vs. an entry page? For a (non-working) example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if item is defined %}{% else %}{% extends [entry.locale ~ &quot;/layout&quot;, &quot;_layout&quot;] %}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure why this isn’t working, but it would allow creating one template per section/type and then conditional output based on how you called it in a template, i.e. &lt;code&gt;{% include &quot;entry&quot; with { &quot;item&quot;: &quot;small&quot; }&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of having to create a separate template to output a smaller/truncated version of an item in a list.&lt;/p&gt;&#xA;" OwnerUserId="5520" LastActivityDate="2016-09-14T09:02:11.523" Title="Dynamically Extend Layout" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16357" PostTypeId="1" CreationDate="2016-08-14T23:28:47.593" Score="3" ViewCount="116" Body="&lt;p&gt;I'm trying to customize the markup of an email select field in Sprout Forms, however, when I customize the markup with &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html&quot; rel=&quot;nofollow&quot;&gt;Custom HTML&lt;/a&gt;, as specified in the documentation, it outputs the actual &lt;code&gt;value&lt;/code&gt; rather than purging it to hide them from spam bots. I just need to know what I should include in the options to purge these. Here is the code I've been using.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set recipient = form.getField('emailRecipient') %}  &#xA;&amp;lt;select name=&quot;fields[{{ recipient.handle }}]&quot;&amp;gt;&#xA;  {% for option in recipient.settings.options %}&#xA;  &amp;lt;option value=&quot;{{ option.value }}&quot; {% if option.value == value.value %}selected{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2016-09-26T16:37:55.240" Title="Customize markup of email select field in Sprout Forms" Tags="&lt;templating&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16358" PostTypeId="1" CreationDate="2016-08-15T04:33:12.893" Score="1" ViewCount="402" Body="&lt;p&gt;We're looking to pull entries from a channel that starts with a specific letter. We've tried using Craft's search option, with &lt;code&gt;'C*'&lt;/code&gt;, to pull any title with a word that starts with C. However, it's pulling entries whose second or third words begin with C as well. Is there another route we should consider to achieve this result?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myQuery = craft.entries.section('channelName').limit(null).search('title:C*').order('title') | group('title|first') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3437" LastActivityDate="2016-08-15T09:12:41.033" Title="Searching entries by title's first initial only" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16359" PostTypeId="2" ParentId="16355" CreationDate="2016-08-15T08:36:11.353" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/27268519/4663184&quot;&gt;Can't be done.&lt;/a&gt; In short, a template is either extending another template (i.e. it contains an &lt;code&gt;{% extends %}&lt;/code&gt; tag anywhere in the code), or it doesn't. Twig doesn't permit the &lt;code&gt;{% extends %}&lt;/code&gt; tag inside an &lt;code&gt;{% if %}&lt;/code&gt; statement, which makes &quot;conditional extending&quot; impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a ternary operation to conditionally select &lt;em&gt;which template to extend&lt;/em&gt; is allowed, though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends item is defined ? &quot;_item&quot; : [entry.locale ~ &quot;/layout&quot;, &quot;_layout&quot;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure how you apply the concept of &lt;code&gt;{% extends %}&lt;/code&gt;, but personally, I very rarely have more than one &quot;layout&quot; template, and that layout template is fairly stark – usually it'll only contain the stuff that &lt;em&gt;all&lt;/em&gt; pages across the site should have, i.e. the basic HTML structure (&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;body&amp;gt;&lt;/code&gt;, global header/footer etc) and global CSS/JavaScript). Sure, some designs require more layouts, but usually that's not where the DRY stuff happens – instead, I tend to use &quot;partial&quot; templates (and &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macros&lt;/a&gt;) a lot, to re-use markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your &lt;code&gt;_layout.html&lt;/code&gt; contains the basic HTML framework for your site, and that the entry page and an entry inside a listing is basically the same thing (the former just displays more content), you could do something like this to create a template that works for both listings and single entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Template /news/index.html #}&#xA;{% extends '_layout.html' %}&#xA;{% block main %}&#xA;    {% if entry is defined %}&#xA;        {# Single entry #}&#xA;        {% include '_partials/entry' %}&#xA;    {% else %}&#xA;        {# Listing, pull entries and include the entry partial with a &quot;teaser&quot; flag #}&#xA;        {% set entries = craft.entries.section('news') %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li&amp;gt;{% include '_partials/entry' with { teaser: true } %}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&#xA;{# Template /_partials/entry.html #}&#xA;{% set isTeaser = teaser is defined and teaser %}&#xA;&amp;lt;article class=&quot;entry{{ isTeaser ? ' entry--teaser' }}&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    {% if entry.thumbnail|length %}&#xA;        &amp;lt;img src=&quot;{{ entry.thumbnail.getUrl() }}&quot; /&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;p class=&quot;excerpt&quot;&amp;gt;{{ entry.excerpt }}&amp;lt;/p&amp;gt;&#xA;    {% if isTeaser %}&#xA;        {# Just a teaser – display a &quot;Read more&quot; link #}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;        {# Not a teaser – render the content in full #}&#xA;        {{ entry.body }}&#xA;    {% endif %}&#xA;&amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-08-15T08:36:11.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16360" PostTypeId="2" ParentId="15121" CreationDate="2016-08-15T08:50:41.677" Score="5" Body="&lt;p&gt;No, Craft doesn't have any native notion of SSO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You &lt;em&gt;can&lt;/em&gt; technically run multiple sites from the same Craft instance. If you had sites sharing the same server, you could run them from the same Craft installation, thereby enacting a &lt;em&gt;de facto&lt;/em&gt; shared user roster by virtue of the shared database. If such sites also shared a root domain, you could gracefully maintain a persistent session between them. However, for the purpose of this answer, I'm assuming such a circumstance does not apply.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless, you could enable a limited/simple SSO-ish setup using a custom plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What I need is for users of Site A and Site B to be kept in sync in some way so they can use the same username and password to sign-on to both sites.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Trying to keep user records &lt;em&gt;perfectly&lt;/em&gt; in sync across multiple sites would not be simple. However, you probably don't &lt;em&gt;need&lt;/em&gt; records to be &lt;em&gt;perfectly&lt;/em&gt; in sync. Rather, you only need &lt;em&gt;one&lt;/em&gt; site to serve as the authoritative source of truth, and the other site(s) only needs to keep track of a unique reference (i.e. a username, or even better, a UUID.):&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Master/Slave setup&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let's say &lt;strong&gt;Site A&lt;/strong&gt; is the &lt;strong&gt;master&lt;/strong&gt;, &lt;strong&gt;Site B&lt;/strong&gt; is the &lt;strong&gt;slave&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;All user registration takes place on the Master site. (User registration is &lt;em&gt;not allowed&lt;/em&gt; on the Slave site.)&lt;/li&gt;&#xA;&lt;li&gt;Login on Master uses Craft's native &lt;code&gt;users/login&lt;/code&gt; controller method.&lt;/li&gt;&#xA;&lt;li&gt;Login on Slave uses a custom controller method that submits a username/password combo to Master, receives back a response, and logs in the user if Master says their credentials are valid. (If a record for this user doesn't already exist on Slave, one is created 'just-in-time' and logged in.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt; — &lt;em&gt;If profile values are allowed to change&lt;/em&gt;, then we do need to create a mechanism for the Master site to notify its Slave sites of any changes. (We don't care about the slave sites' copy of the user's password, because only the Master site ever needs to do any authentication. We &lt;em&gt;might&lt;/em&gt; care about keeping username/email/profile values in sync, because the Slave sites may want to display User info in templates or something.) This can be accomplished using a custom controller action (authenticated by some secret key, perhaps) by which the Master site triggers the Slave site's &lt;code&gt;users/saveUser&lt;/code&gt; method with new/updated content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Bonus points if they can automatically signed into to Site B if they are already signed into Site A.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If the sites share a root domain...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft decides that a user is &quot;still signed in&quot; by matching a known session ID (stored in the &lt;code&gt;craft_sessions&lt;/code&gt; table) to the cookie sent by the user's client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your sites share a root domain (e.g. &lt;em&gt;mysite.com&lt;/em&gt; and &lt;em&gt;other.mysite.com&lt;/em&gt;) then they will be able to share cookies. (You'd use the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultCookieDomain&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;defaultCookieDomain&lt;/code&gt;&lt;/a&gt; setting to cause both sites to store cookies under the root domain.) That means the Slave site can read the user's &lt;code&gt;CraftSessionId&lt;/code&gt; cookie, validate it with the Master site, and log the user in as appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If the sites don't share a root domain...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alas, due to cross-domain restrictions, sites not sharing a root domain are not allowed to receive/read each other's cookies. Automatic multi-site login might still be possible, but it'd involve bouncing the user back and forth in a series of [hopefully imperceptible] redirects between Master and Slave that would accomplish something basically single-sign-on-y (&lt;a href=&quot;http://www.roguelynn.com/words/explain-like-im-5-kerberos/&quot; rel=&quot;nofollow&quot;&gt;Kerberos&lt;/a&gt;, anyone?). It'd be convoluted and weird and I don't have brainpower to think about it anymore tonight.  :-P &lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2016-08-18T02:14:11.533" LastActivityDate="2016-08-18T02:14:11.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16361" PostTypeId="2" ParentId="16358" CreationDate="2016-08-15T09:11:46.353" Score="1" Body="&lt;p&gt;You're close! According to &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow&quot;&gt;the entry on searching in the Craft docs&lt;/a&gt;, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myQuery = craft.entries.section('channelName').limit(null).search('title::C*').order('title') | group('title|first') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the format of the search string with a double colon: &lt;code&gt;title::C*&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-08-15T09:11:46.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16362" PostTypeId="2" ParentId="16358" CreationDate="2016-08-15T09:12:41.033" Score="1" Body="&lt;p&gt;Changing &lt;code&gt;.search('title:C*')&lt;/code&gt; to &lt;code&gt;.search('title::C*')&lt;/code&gt; appears to work, on my end – the &lt;code&gt;::&lt;/code&gt; essentially tells Craft that there shouldn't be anything in front of the &quot;C&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, for this to work you need to &lt;strong&gt;not&lt;/strong&gt; have enabled &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;fuzzy search&lt;/a&gt; by default.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-15T09:12:41.033" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16363" PostTypeId="2" ParentId="629" CreationDate="2016-08-15T11:14:56.133" Score="2" Body="&lt;p&gt;There is a plugin for that. It can do many things, but most importantly... destroy items :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/am-impact/amcommand&quot; rel=&quot;nofollow&quot;&gt;https://github.com/am-impact/amcommand&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-08-15T11:14:56.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16364" PostTypeId="1" AcceptedAnswerId="16371" CreationDate="2016-08-15T15:06:35.653" Score="2" ViewCount="352" Body="&lt;p&gt;In one of my Plugin's CP templates I am using a element select field to grab elements from a custom element type.  This field saves an array of element ids to a specific record's attribute called &quot;location&quot;.  How do you return an element criteria model instead of the array of ids when the model attribute is called via twig?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Model&#xA;protected function defineAttributes()&#xA;{&#xA;    return array_merge(parent::defineAttributes(), array(&#xA;        'location'          =&amp;gt; Attributetype::Mixed,&#xA;        'specificLocation'  =&amp;gt; AttributeType::String,&#xA;        'registration'      =&amp;gt; AttributeType::Mixed,&#xA;    ));&#xA;}&#xA;&#xA;// Front end template&#xA;{{ craft.pluginname.variable.location }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2016-08-15T18:34:42.577" LastActivityDate="2016-08-15T22:32:42.367" Title="Return element criteria model from attribute of a model" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16365" PostTypeId="1" AcceptedAnswerId="16372" CreationDate="2016-08-15T15:31:42.067" Score="0" ViewCount="262" Body="&lt;p&gt;I noticed while doing some testing that assigned emails for the default order status do not get sent. An email does get sent on every other order status change without any problems. Has anyone else had this issue? &lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="57" LastEditDate="2016-08-15T21:00:14.427" LastActivityDate="2016-08-15T21:00:14.427" Title="Craft Commerce: No Emails sent on Default Order Status" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16366" PostTypeId="1" AcceptedAnswerId="16368" CreationDate="2016-08-15T15:36:26.077" Score="3" ViewCount="1295" Body="&lt;p&gt;HTML Purifier is deleting a custom link attribute. As I understand the HTML Purifier docs, it should be possible to customize it to allow a defined attribute. Is there in Craft CMS a defined way for doing such a customizing (like the Redactor configuration)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Would probably possible in &quot;RichTextFieldType.php&quot; (Line 205ff)?&lt;/p&gt;&#xA;" OwnerUserId="517" LastEditorUserId="517" LastEditDate="2016-08-15T15:54:05.917" LastActivityDate="2016-08-15T17:03:14.900" Title="How to customize HTML Purifier?" Tags="&lt;richtext&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16367" PostTypeId="2" ParentId="16366" CreationDate="2016-08-15T16:47:37.103" Score="3" Body="&lt;p&gt;There's no way to configure the default Rich Text Field's use of HTMLPurifier, unfortunately, though it has been brought up before and is on our list to look at exposing to a config file post Craft 3 launch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your custom plugin could create it's own &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier&quot; rel=&quot;nofollow&quot;&gt;CHtmlPurifier&lt;/a&gt; instance and configure it however you want, though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$purifier = new \CHtmlPurifier();&#xA;$purifier-&amp;gt;setOptions(array(&#xA;    'Attr.AllowedFrameTargets' =&amp;gt; array('_blank'),&#xA;    'HTML.AllowedComments' =&amp;gt; array('pagebreak'),&#xA;    ...&#xA;));&#xA;&#xA;$value = $purifier-&amp;gt;purify($value);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-15T16:47:37.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16368" PostTypeId="2" ParentId="16366" CreationDate="2016-08-15T17:03:14.900" Score="3" Body="&lt;p&gt;Like Brad says above, there's no way to configure the RichTextField's HTML Purifier instance – but you could easily create a custom fieldtype that instantiates HTML Purifier w/ different options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, scaffold a custom plugin using &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;pluginfactory.io&lt;/a&gt;. Name the plugin what you want, don't enable any components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, create a file called &lt;code&gt;/fieldtypes/MyPluginHandle_RichTextFieldType.php&lt;/code&gt; inside your custom plugin's directory (replacing &lt;code&gt;MyPluginHandle&lt;/code&gt; with the actual handle for your plugin, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, paste in everything from &lt;code&gt;craft/app/fieldtypes/RichTextFieldType.php&lt;/code&gt; into your custom fieldtype; then remove everything except the &lt;code&gt;prepValueFromPost()&lt;/code&gt; and &lt;code&gt;getName()&lt;/code&gt; methods. Make sure you're returning something different than &quot;Rich Text&quot; from the latter method, and configure &lt;code&gt;\CHtmlPurifier()&lt;/code&gt; according to your needs inside the &lt;code&gt;prepValueFromPost()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, install your plugin and convert any existing Rich Text fields to your custom fieldtype.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-15T17:03:14.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16369" PostTypeId="1" CreationDate="2016-08-15T17:40:43.337" Score="2" ViewCount="211" Body="&lt;p&gt;I am making a simple call to entries near a zip code using this url format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;example.com/locations-zip-ajax?near=93003&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My template includes this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set target = craft.request.getParam('near') %}&#xA;{% set params = {&#xA;  target: target|length ? target : 37212,&#xA;  range: target|length ? 30 : 7000,&#xA;} %}&#xA;{% set locations = craft.entries.section('locationsFeed').address(params).order('distance').find() %}&#xA;&#xA;{% for location in locations %}&#xA;      //do some stuff&#xA;&#xA;{% else %}&#xA;  &amp;lt;li class=&quot;locations__item&quot;&amp;gt;&#xA;    &amp;lt;h4&amp;gt;No results found&amp;lt;/h4&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But no matter what zip code is entered, the results are always in the same order and the nearest entry is always 5,828.2 miles away even if the result entry's zip code is identical to the 'near' param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have ensured that my target param is being populated correctly and that my range param is working as well.&lt;/p&gt;&#xA;" OwnerUserId="5522" LastEditorUserId="5522" LastEditDate="2016-08-15T17:51:30.167" LastActivityDate="2021-01-01T06:43:17.900" Title="Filter locations by zip in Smart Map" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16370" PostTypeId="1" AcceptedAnswerId="16373" CreationDate="2016-08-15T20:43:00.700" Score="3" ViewCount="11888" Body="&lt;p&gt;I have a plugin that listens for new users to be created. I am then sending that user to system &quot;B&quot; via an API call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All is working fine the old fashion way, I am curious how to accomplish the same using Guzzle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client('http://api.site.dev/');&#xA;$uri = 'my/endpoint/path';&#xA;&#xA;$request = $client-&amp;gt;post($uri, array(&#xA;   'headers' =&amp;gt; array('Content-type' =&amp;gt; 'application/x-www-form-urlencoded'),&#xA;   'body' =&amp;gt; array(&#xA;       'craft_id' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;id,&#xA;       'name' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;friendlyName,&#xA;       'email' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;email&#xA;    ),&#xA;    'timeout' =&amp;gt; 10&#xA;));&#xA;&#xA;$response = $request-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each time I get this response/error back:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Client error response&#xA;[status code] 422&#xA;[reason phrase] Unprocessable Entity&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which tells me that system &quot;B&quot; isn't getting the information in the correct format. The docs aren't so great with post examples, so I'm not quite sure where I'm going down the wrong path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-08-15T21:25:16.533" Title="How do I use Guzzle to send a post request from my plugin?" Tags="&lt;plugin-development&gt;&lt;guzzle&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16371" PostTypeId="2" ParentId="16364" CreationDate="2016-08-15T20:47:49.027" Score="2" Body="&lt;p&gt;If I'm following you correctly, seems like you could override your Model's &lt;a href=&quot;https://craftcms.com/classreference/models/BaseModel#getAttribute-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getAttribute&lt;/code&gt;&lt;/a&gt; method to do something like this completely untested code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAttribute($name, $flattenValue = false)&#xA;{&#xA;    if ($name == 'location' &amp;amp;&amp;amp; $flattenValue != false)&#xA;    {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('MyPlugin_MyElementType');&#xA;        $criteria-&amp;gt;location = parent::getAttribute($name, $flattenValue);&#xA;        return $criteria;&#xA;    }&#xA;&#xA;    return parent::getAttribute($name, $flattenValue);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I'm not following you correctly, then that was pointless.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="331" LastEditDate="2016-08-15T22:32:42.367" LastActivityDate="2016-08-15T22:32:42.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16372" PostTypeId="2" ParentId="16365" CreationDate="2016-08-15T20:59:48.813" Score="1" Body="&lt;p&gt;I just tested this with a default Craft Commerce installation, assigned an email to the default &quot;Processing&quot; order status, placed an order and received the email as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd double check under &lt;code&gt;Settings-&amp;gt;Email&lt;/code&gt; in the Craft control panel you're not using phpmail or sendmail and you're using a proper SMTP server or transactional email provider like &lt;a href=&quot;https://www.mailgun.com/&quot; rel=&quot;nofollow&quot;&gt;Mailgun&lt;/a&gt; or &lt;a href=&quot;https://www.mandrill.com/&quot; rel=&quot;nofollow&quot;&gt;Mandrill&lt;/a&gt;, etc.  The others are notoriously unreliable at delivering email.  See: &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-15T20:59:48.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16373" PostTypeId="2" ParentId="16370" CreationDate="2016-08-15T21:25:16.533" Score="5" Body="&lt;p&gt;It is pretty obvious now, but indeed the API is looking for json formatted values and I was in fact sending name:value pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what the updated logic looks like for anyone who comes across this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client('http://api.site.dev/');&#xA;$uri = 'my/endpoint/path';&#xA;$post_data = array(&#xA;    'craft_id' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;id,&#xA;    'name' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;friendlyName,&#xA;    'email' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;email&#xA;);&#xA;&#xA;$data = json_encode($post_data);&#xA;&#xA;$request = $client-&amp;gt;post($uri, array(&#xA;    'content-type' =&amp;gt; 'application/json'&#xA;));&#xA;&#xA;$request-&amp;gt;setBody($data);&#xA;$response = $request-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-08-15T21:25:16.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16374" PostTypeId="1" CreationDate="2016-08-15T21:33:28.173" Score="1" ViewCount="490" Body="&lt;p&gt;I was working on a plugin with a hook on onBeforeSaveEntry in my dev environment (which is configured exactly like my live environment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a &lt;code&gt;var_dump&lt;/code&gt; with an &lt;code&gt;exit&lt;/code&gt; in the hook to check output of some variables on save. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After deleting the &lt;code&gt;var_dump&lt;/code&gt; and &lt;code&gt;exit&lt;/code&gt; from the code the control panel now gives a unknown error on top of every page (which has an AJAX request).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've deleted any entry I've made today since the code changes but still no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After inspecting the logs the exception seems to be thrown in the BaseController class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Throws a 400 error if this isn’t an Ajax request.&#xA; *&#xA; * @throws HttpException&#xA; * @return null&#xA; */&#xA;public function requireAjaxRequest()&#xA;{&#xA;    if (!craft()-&amp;gt;request-&amp;gt;isAjaxRequest())&#xA;    {&#xA;        throw new HttpException(400);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Log output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/08/15 21:05:16 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' in /...myserverpath.../craft/app/controllers/BaseController.php:217&#xA;Stack trace:&#xA;#0 /...myserverpath.../craft/app/controllers/BaseElementsController.php(30): Craft\BaseController-&amp;gt;requireAjaxRequest()&#xA;#1 /...myserverpath.../craft/app/controllers/ElementIndexController.php(66): Craft\BaseElementsController-&amp;gt;init()&#xA;#2 /...myserverpath.../craft/app/framework/web/CWebApplication.php(281): Craft\ElementIndexController-&amp;gt;init()&#xA;#3 /...myserverpath.../craft/app/etc/web/WebApp.php(815): CWebApplication-&amp;gt;runController('elementIndex/ge...')&#xA;#4 /...myserverpath.../craft/app/etc/web/WebApp.php(285): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#5 /...myserverpath.../craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#6 /...myserverpath.../craft/app/index.php(58): CApplication-&amp;gt;run()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I comment out the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;throw new HttpException(400);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is working fine.&#xA;Because it seems to be an AJAX error, I tried another browser as well but the same error occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody got any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5222" LastEditorUserId="57" LastEditDate="2016-08-15T23:15:13.523" LastActivityDate="2016-08-17T17:36:21.570" Title="Unknown error occurs on every AJAX call in CP" Tags="&lt;control-panel&gt;&lt;ajax&gt;&lt;error&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16375" PostTypeId="1" AcceptedAnswerId="16376" CreationDate="2016-08-15T22:48:33.530" Score="2" ViewCount="347" Body="&lt;p&gt;I've got a Matrix field with an image. If I use a pre-defined transform that's defined in Assets everything works fine. However, I need to set a transform manually in the template but it keeps returning an error &quot;The transform “wideCrop” cannot be found!&quot;. I have used transforms in templates all over the site that work fine so I'm puzzled why this particular one isn't working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is from an embedded template inside the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contents %}&#xA;    {% for image in block.image %}          &#xA;&#xA;        {% switch block.position %}&#xA;            {% case 'full' %}&#xA;                {% set wideCrop = { width: 940, height: 360, mode: 'fit' } %}&#xA;                &amp;lt;img class=&quot;full&quot; src=&quot;{{ image.getUrl('wideCrop') }}&quot;&amp;gt;   &#xA;        {% endswitch %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="877" LastEditorUserId="57" LastEditDate="2016-08-15T23:08:56.157" LastActivityDate="2016-08-15T23:08:56.157" Title="Transform cannot be found" Tags="&lt;assets&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16376" PostTypeId="2" ParentId="16375" CreationDate="2016-08-15T23:00:34.440" Score="4" Body="&lt;p&gt;Remove the single quotes around wideCrop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img class=&quot;full&quot; src=&quot;{{ image.getUrl(wideCrop) }}&quot;&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/image-transforms&quot; rel=&quot;nofollow&quot;&gt;Details for why the difference in &quot;template defined&quot; transforms here:&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-08-15T23:06:11.177" LastActivityDate="2016-08-15T23:06:11.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16377" PostTypeId="1" CreationDate="2016-08-15T23:38:49.783" Score="2" ViewCount="698" Body="&lt;p&gt;I suspect this boils down to a feature request, but I'll start here in case there are any other ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to be able to define multiple URL formats for a single section or category group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the scenario:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Section &lt;code&gt;gear&lt;/code&gt; with URL format &lt;code&gt;gear/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category group &lt;code&gt;productTypes&lt;/code&gt; with URL format &lt;code&gt;gear/{slug}&lt;/code&gt;, &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Section &lt;code&gt;reviews&lt;/code&gt; with URL format &lt;code&gt;reviews/{slug}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I want to do but can't, is define a &lt;em&gt;second&lt;/em&gt; URL format for &lt;code&gt;productTypes&lt;/code&gt;, with the format &lt;code&gt;reviews/{slug}&lt;/code&gt;, and &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, I want to define a 2nd format for &lt;code&gt;gear&lt;/code&gt;, of &lt;code&gt;reviews/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'd end up with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;gear/gear-entry/&lt;/li&gt;&#xA;&lt;li&gt;gear/category/&lt;/li&gt;&#xA;&lt;li&gt;reviews/category/&lt;/li&gt;&#xA;&lt;li&gt;reviews/gear-entry/&lt;/li&gt;&#xA;&lt;li&gt;reviews/review-entry/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I really need Craft to know about those additional formats to avoid crossover URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routing and assigning the &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; variables is not a problem, I'm really just concerned with the slug/uri validation.&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2017-03-15T22:24:18.813" Title="Multiple URL Formats per element type (Entries, Categories)" Tags="&lt;url&gt;&lt;routes&gt;&lt;slug&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16378" PostTypeId="1" CreationDate="2016-08-16T01:39:39.813" Score="5" ViewCount="1011" Body="&lt;p&gt;First Craft project and off to a great start. I don't think i'll ever touch Wordpress again. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the Element API plugin to build out one of my feeds of entries and hoping to use that on a couple sites as a little widget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JSON: &lt;a href=&quot;https://csgoevents.gg/api/events.json&quot;&gt;https://csgoevents.gg/api/events.json&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using jQuery for now: &lt;a href=&quot;http://codepen.io/eboyer/pen/kXqNXJ&quot;&gt;http://codepen.io/eboyer/pen/kXqNXJ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting this error: &quot;XMLHttpRequest cannot load &lt;em&gt;. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '&lt;/em&gt;' is therefore not allowed access.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Historically, i'm more of a designer/html/css developer, so HTTP &amp;amp; API work is new to me. From what I understand this can be avoided if the server could return JSONP? Or if I had any sort of control over nginx configurations? (I'm hosting with Web Faction)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any examples out there of using Element API data on other domains?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully its something with a quick solve. Thanks in advance, excited to be here!&lt;/p&gt;&#xA;" OwnerUserId="5524" LastActivityDate="2016-08-26T07:37:58.287" Title="Access Element API JSON in another environment" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16379" PostTypeId="2" ParentId="16378" CreationDate="2016-08-16T07:12:36.320" Score="2" Body="&lt;p&gt;I don't know whether you've seen this answer to another similar question, but it might get you a bit closer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/13188/142&quot;&gt;Ajax Post to guestEntries/saveEntries from another domain&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could maybe combine what the answer says with the &lt;a href=&quot;https://craftcms.com/docs/templating/header&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% header %}&lt;/code&gt;&lt;/a&gt; tag to output the two headers mentioned in the answer.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could always tailor the &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt; to be more specific to your setup if you don't want open up access to all domains. You can find more information on the Headers themselves here :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mozilla Developer Network: HTTP access control (CORS)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(About half way down the page where it explains what &lt;code&gt;Lines 13 - 22&lt;/code&gt; in the example are doing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used the &lt;code&gt;Element API&lt;/code&gt; myself yet, so all this may be way off, but hopefully it'll point you in the right direction!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As you're using WebFaction, you should have access to add/edit the &lt;code&gt;.htaccess&lt;/code&gt; file for you site, so you might be able to add those headers straight in there. There's more info in their docs here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.webfaction.com/software/static.html#static-cgi-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Webfaction: Static Files, CGI Scripts, and PHP Pages&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-16T07:20:17.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16380" PostTypeId="1" AcceptedAnswerId="16403" CreationDate="2016-08-16T09:45:20.687" Score="2" ViewCount="1448" Body="&lt;p&gt;A common workflow for me when building a web page is the following. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'm getting a PSD-file (Photoshop) from a external advertising agency&lt;/li&gt;&#xA;&lt;li&gt;Build the site in Webflow and then export to plain html/css/js&lt;/li&gt;&#xA;&lt;li&gt;Build the site locally in Craft CMS using Textmate&lt;/li&gt;&#xA;&lt;li&gt;Deploy to dev.customer.com using DeployBot and Github&lt;/li&gt;&#xA;&lt;li&gt;Send username and password for Craft to advertising agency, they then start to fill the site with content &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The problem with this workflow is when the agency in step 5 want changes (new fields, sections).  I don't want to add fields on both localhost and dev.customer.com. And I don't want to temporarily shut down dev.customer.com, export database on dev.customer.com to localhost and then import to dev.customer.com when done (there is often a tight schedule).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you do? Does Craft 3 solve this?  If not, maybe me and the agency should work on the same codebase and database. One way is to have a small server locally (which i don't have) turned on 24h and open port 80 from outside so the agency could work in Craft. Another way is to use SSHFS to mount file system over SSH on a remote Linux VPS (which i have plenty of), but i'm not sure how stable this is.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2017-07-27T15:00:39.103" Title="Recommended workflow when developing new websites" Tags="&lt;deployment&gt;&lt;workflow&gt;&lt;git&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16382" PostTypeId="1" AcceptedAnswerId="16385" CreationDate="2016-08-16T16:26:28.537" Score="2" ViewCount="1870" Body="&lt;p&gt;I have a pretty standard type entry page (&lt;code&gt;_entry.html&lt;/code&gt;) which displays the details of an entry having navigated to it through 2 levels of categories. On this page I'd like to be able to query the two immediate category parents of this entry (sub-cat &amp;amp; cat) for use in a breadcrumb and page title variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to approach this, or what the correct dot syntax is - I'm just getting up-to-speed with Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips/references?&lt;/p&gt;&#xA;" OwnerUserId="4962" LastEditorUserId="57" LastEditDate="2016-08-16T17:25:23.247" LastActivityDate="2016-08-16T23:14:35.240" Title="How to get parent categories from an entry?" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16383" PostTypeId="1" CreationDate="2016-08-16T16:41:30.697" Score="1" ViewCount="50" Body="&lt;p&gt;I'm having a very bizarre problem and was wondering if anyone else has had this happen. I have a page displaying thumbnails of product sheets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My loop code starts with this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('resources').order('title asc') if entry.industry.label == &quot;Healthcare&quot; and entry.documentType.label == &quot;Product Sheet&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I leave it like this, I am missing the last three entries alphabetically (they start with V, W and Z). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change it to be descending order by title instead of ascending, I get all but one entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I change the order to be based on a field I have called lastUpdated, it will show all of the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the above loop code, if I change the names of the missing three entries to have earlier letters in front of them (i.e. changing Value Care to AValue Care), all entries will appear and no additional entries will fall off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is such a strange problem, and I feel like I'm crazy. Has anyone else seen something like this happen? &lt;/p&gt;&#xA;" OwnerUserId="5527" LastActivityDate="2016-08-16T16:41:30.697" Title="Missing entries if order of entries is changed" Tags="&lt;entries&gt;&lt;order&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16384" PostTypeId="2" ParentId="16377" CreationDate="2016-08-16T17:53:51.273" Score="3" Body="&lt;p&gt;So semantically, I don’t love the URL format you’re coming up with.  I’d like to see something like &lt;code&gt;/gear/{category}/{entry}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives you a few benefits&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it’s semantically readable…  &lt;/li&gt;&#xA;&lt;li&gt;it gives you natural breadcrumbs for the hierarchy of content&lt;/li&gt;&#xA;&lt;li&gt;it’s likely going to be better from an SEO perspective&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Relevant feature request: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1189&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1189&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2017-03-15T22:24:18.813" LastActivityDate="2017-03-15T22:24:18.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16385" PostTypeId="2" ParentId="16382" CreationDate="2016-08-16T19:26:15.610" Score="3" Body="&lt;p&gt;Assuming you have a Categories field associated with the entry, you can get all of the related categories in your template via &lt;code&gt;entry.myCategoriesField&lt;/code&gt; (replace with the actual Categories field handle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here’s how you would loop through all of them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.myCategoriesField %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you just want the last 2 categories, you can use Twig’s &lt;a href=&quot;http://php.net/array_slice&quot; rel=&quot;nofollow&quot;&gt;slice&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;normal syntax:&#xA;{% for category in entry.myCategoriesField|slice(-2) %}&#xA;&#xA;shortcut syntax:&#xA;{% for category in entry.myCategoriesField[-2:] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to set these categories to their own variables, so they can be referenced later on in your template, you could do this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentCategory = entry.myCategoriesField.last() %}&#xA;{% set grandparentCategory = parentCategory.parent() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2016-08-16T23:14:35.240" LastActivityDate="2016-08-16T23:14:35.240" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16386" PostTypeId="2" ParentId="12143" CreationDate="2016-08-16T21:33:58.097" Score="1" Body="&lt;p&gt;This was a &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow&quot;&gt;ModSecurity&lt;/a&gt; rule tripping up the request and causing an infinite redirect loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know which rule it was exactly, but disabling ModSecurity resolved the issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-16T21:33:58.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16387" PostTypeId="2" ParentId="12084" CreationDate="2016-08-16T22:04:16.560" Score="6" Body="&lt;p&gt;Here are some fairly specific instructions if you happen to be hosted on a server configured through ServerPilot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html&quot;&gt;https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-08-16T22:04:16.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16388" PostTypeId="2" ParentId="16380" CreationDate="2016-08-16T22:41:49.163" Score="8" Body="&lt;p&gt;Essentially the question is &quot;how can I manage changing database content across environments&quot; which has been covered several times here before.  Some leisure reading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What&amp;#39;s the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/55/git-workflow-and-multi-environment-how-to-approach&quot;&gt;Git Workflow and Multi Environment - how to approach&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13/whats-the-best-practice-for-upgrading-a-versioned-craft-site&quot;&gt;What&amp;#39;s the best practice for upgrading a versioned Craft site?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does Craft 3 solve this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft 3.0 will not have a solution for this at launch, but we are planning on something post 3 launch that will help making managing Craft content across environments easier to manage.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-16T22:41:49.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16389" PostTypeId="1" AcceptedAnswerId="16390" CreationDate="2016-08-16T23:26:15.703" Score="2" ViewCount="129" Body="&lt;p&gt;I'm trying to select 1 random entry out of a section based on whether a field has content (&lt;code&gt;schedulerBio&lt;/code&gt;). I can get all the entries based on the conditional but can't seem to randomize a single selection. Any help would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('team').limit(1).find() if entry.schedulerBio|length %}&#xA;... stuff&#xA;{% endfor }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="4466" LastEditDate="2016-08-17T11:16:49.967" LastActivityDate="2016-08-17T11:16:49.967" Title="Selecting a random entry based on conditional" Tags="&lt;templating&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16390" PostTypeId="2" ParentId="16389" CreationDate="2016-08-17T00:16:40.807" Score="4" Body="&lt;p&gt;I Think this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('team').limit(1).order('RAND()').schedulerBio(':notempty:') %}&#xA;   ...stuff&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-08-17T00:16:40.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16391" PostTypeId="2" ParentId="16326" CreationDate="2016-08-17T03:44:12.463" Score="3" Body="&lt;p&gt;Craft release 2.6.2911 has made a significant improvement, and with it, our troublesome animated GIFs are transforming correctly.&lt;/p&gt;&#xA;" OwnerUserId="3834" LastActivityDate="2016-08-17T03:44:12.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16393" PostTypeId="1" CreationDate="2016-08-17T11:05:13.840" Score="2" ViewCount="641" Body="&lt;p&gt;I am trying to create a portfolio site. I have set up field for image, description and  a link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description and link are being pulled through but the image is not working.  This is what I have for the images field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for assets in entry.image %}&#xA;    &amp;lt;img class=&quot;portfolio-images&quot; src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the full entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;portfolio-section&quot; id=&quot;portfolio&quot;&amp;gt; &#xA;    &amp;lt;h2 id=&quot;opaque&quot; style=&quot;color:white;&quot;&amp;gt;Here are a few of the projects I have been working on recently.&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul class=&quot;portfolio Grid&quot;&amp;gt;&#xA;&#xA;        {% for entry in craft.entries.section('portfolio').limit(9) %}&#xA;            &amp;lt;li class=&quot;portfolio-item Grid-item Grid-third&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;portfolio-info&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;portfolio-title&quot;&amp;gt;{{entry.title}}&amp;lt;/h3&amp;gt;&#xA;&#xA;                    {% for assets in entry.image %}&#xA;                        &amp;lt;img class=&quot;portfolio-images&quot; src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;                    {% endfor %}&#xA;&#xA;                    {{entry.description}}&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;a href=&quot;{{entry.website_link}}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;button class=&quot;button&quot; type=&quot;button&quot;&amp;gt;View website&amp;lt;/button&amp;gt; &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is the text and link working but the image not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5530" LastEditorUserId="57" LastEditDate="2016-08-17T17:12:46.280" LastActivityDate="2016-08-17T17:12:46.280" Title="Assets in Template" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16394" PostTypeId="2" ParentId="16393" CreationDate="2016-08-17T11:14:28.830" Score="5" Body="&lt;p&gt;You are looping through &lt;code&gt;entry.image&lt;/code&gt; with the key &lt;code&gt;assets&lt;/code&gt; but inside your loop you are trying to access the URL on &lt;code&gt;asset&lt;/code&gt;. These need to be the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.image %}&#xA;  &amp;lt;img class=&quot;portfolio-images&quot; src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-08-17T12:14:15.183" LastActivityDate="2016-08-17T12:14:15.183" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16395" PostTypeId="1" AcceptedAnswerId="16397" CreationDate="2016-08-17T16:11:09.393" Score="3" ViewCount="132" Body="&lt;p&gt;I wrote a little plugin that reads some entries (Events) from my events section, orders them in a calendar-like structure and returns them to be displayed in a template. (I couldn't do this twig-only)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I would like to use &lt;code&gt;{% cache %}&lt;/code&gt; on the calendar. I know that Craft normally busts the template cache when updating/adding an element if it detects, that those elements were used in a cached template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as I am fetching the elements in my custom plugin with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume, that Craft can't know when to bust the cached output of the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way (with the TemplateCacheService for example) to make sure that this cache also gets busted when saving/updating one of my events?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if I can do this just in twig or if I would have to put a hook before the element gets saved? How does it relate to the cache key?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints, which direction to take?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Robert&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Update:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Okay, I'll provide some more details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Plugin looks (simplified) like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// MyPluginVariable.php: &#xA;public function getMonthWithEvents($month, $year)&#xA;{&#xA;    ...&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'events';&#xA;    $criteria-&amp;gt;date = ['and', '&amp;gt;='.$monthStart, '&amp;lt;='.$monthEnd];&#xA;    $eventsInMonth = $criteria-&amp;gt;find();&#xA;&#xA;    $month = [];&#xA;&#xA;    // Put events in month array with dates etc....&#xA;&#xA;    return $month;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the twig template, I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// agenda.twig&#xA;...&#xA;&#xA;{% cache %}&#xA;&#xA;    {% set month = craft.migrosAgenda.getMonthWithEvents(10, 2016) %}&#xA;&#xA;    {% for day in month %}&#xA;        ...&#xA;        &amp;lt;div class=&quot;day&quot;&amp;gt;&#xA;            {{ day.date|date('d.M.Y') }}&#xA;            {{ day.event.title }}&#xA;            {{ day.event.date }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="4226" LastEditDate="2016-08-18T07:03:38.353" LastActivityDate="2016-08-18T07:03:38.353" Title="Define elements that bust cache on save" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16396" PostTypeId="2" ParentId="16377" CreationDate="2016-08-17T16:38:55.793" Score="1" Body="&lt;p&gt;If you're only worried about URL collisions, it looks like there's only a few places where your routes overlap:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;gear/{slug}&lt;/code&gt; could match a gear entry or a category.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/{slug}&lt;/code&gt; could match a category, gear entry, or review entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One easy way around this is to just just make some of these routes more specific. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;gear/{slug}&lt;/code&gt; (gear entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;gear/category/{slug}&lt;/code&gt; (product type category)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/category/{slug}&lt;/code&gt; (product type category)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/gear/{slug}&lt;/code&gt; (gear entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/{slug}&lt;/code&gt; (review entry)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note: &quot;category&quot; above is the literal string, not the category's slug. But if &quot;category&quot; is too verbose, possibly just &lt;code&gt;gear/cat/{slug}&lt;/code&gt; or &lt;code&gt;gear/c/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to alter your URL formats minimally from your original scheme, another option would be to setup &lt;code&gt;gear&lt;/code&gt;, &lt;code&gt;productTypes&lt;/code&gt;, and &lt;code&gt;reviews&lt;/code&gt; to all use the same route of &lt;code&gt;reviews/{slug}&lt;/code&gt;. Craft &lt;em&gt;will&lt;/em&gt; use a section's Entry URL Format when saving an entry to check for duplicate slugs. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/{slug}&lt;/code&gt; (product type category)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/{slug}&lt;/code&gt; (gear entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reviews/{slug}&lt;/code&gt; (review entry)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then just add a &quot;category&quot; segment for gear to make sure &lt;code&gt;gear&lt;/code&gt; entries don't clash with &lt;code&gt;productTypes&lt;/code&gt; categories:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;gear/{slug}&lt;/code&gt; (gear entry)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;gear/category/{slug}&lt;/code&gt; (product type category)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2016-08-18T08:43:56.530" LastActivityDate="2016-08-18T08:43:56.530" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16397" PostTypeId="2" ParentId="16395" CreationDate="2016-08-17T17:22:16.983" Score="3" Body="&lt;p&gt;Hard to know for sure without seeing some plugin code, but my guess is you'll want to use the &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService&quot; rel=&quot;nofollow&quot;&gt;TemplateCacheService's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService#includeElementInTemplateCaches-detail&quot; rel=&quot;nofollow&quot;&gt;includeElementInTemplateCaches&lt;/a&gt; similar to how &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/templating/BaseTemplate.php&quot; rel=&quot;nofollow&quot;&gt;BaseTemplate's&lt;/a&gt; &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/templating/BaseTemplate.php#L77&quot; rel=&quot;nofollow&quot;&gt;_includeElementInTemplateCaches&lt;/a&gt; does.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-17T17:22:16.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16398" PostTypeId="2" ParentId="16374" CreationDate="2016-08-17T17:36:21.570" Score="1" Body="&lt;p&gt;This will be a environmental configuration issue. The only reason you could get that error is if your web server either isn't setting the global &lt;code&gt;$_SERVER['HTTP_X_REQUESTED_WITH']&lt;/code&gt; variable or it is setting it and it's a value other than &lt;code&gt;XMLHttpRequest&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.17/framework/web/CHttpRequest.php#L679&quot; rel=&quot;nofollow&quot;&gt;https://github.com/yiisoft/yii/blob/1.1.17/framework/web/CHttpRequest.php#L679&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd check the server config and make sure there's nothing odd in your &lt;code&gt;.htaccess&lt;/code&gt; files (if on Apache) that might be interfering.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-17T17:36:21.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16399" PostTypeId="1" AcceptedAnswerId="16400" CreationDate="2016-08-17T17:55:28.947" Score="0" ViewCount="134" Body="&lt;p&gt;I've looked at several answers on here regarding this one and as far as I can make out this should bring out all entries related to a specific category slug. However it just seems to be returning all entries regardless of whether it's related or not? What am I missing? Also in case it makes a difference there is one category level but an entry can have multiple categories selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('markets').slug('marine').first() %}&#xA;{% set products = craft.entries.section('products').realtedTo(category).limit(null) %}&#xA;{% for product in products %}&#xA;    {{ product.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-08-17T18:02:45.537" Title="RelatedTo does not seem to work!" Tags="&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16400" PostTypeId="2" ParentId="16399" CreationDate="2016-08-17T18:02:45.537" Score="3" Body="&lt;p&gt;There's a typo in your code :) You misspelled relatedTo. I'm assuming that's the issue because other that than, the code looks like it should work.&lt;/p&gt;&#xA;" OwnerUserId="5400" LastActivityDate="2016-08-17T18:02:45.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16401" PostTypeId="1" AcceptedAnswerId="16404" CreationDate="2016-08-17T18:35:49.127" Score="1" ViewCount="218" Body="&lt;p&gt;I'm trying to setup a product that has multiple variant groups that need to be simultaneously selectable and that have their own up-charges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example use-case: Say I have a digital product that I'm selling that has multiple license options as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Standard vs Pro&lt;/li&gt;&#xA;&lt;li&gt;Commercial vs Non-Commercial&lt;/li&gt;&#xA;&lt;li&gt;License levels based on Users&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each of these items would need to be individually selectable, with appropriate up-charges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2016-08-18T00:53:42.113" Title="Simultaneous Variants in Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16402" PostTypeId="1" CreationDate="2016-08-17T19:06:44.193" Score="1" ViewCount="99" Body="&lt;p&gt;Is there any documentation other than on the CraftCMS web site with details and examples of Entry URL Format options/syntax? I came across an &lt;a href=&quot;https://craftcms.stackexchange.com/questions/353/how-do-i-add-a-subcategory-to-the-url-slug-for-a-channel-entry?rq=1&quot;&gt;example from Brandon Kelly in this thread&lt;/a&gt; yesterday which gave me much insight and a solution to an entry url issue of my own, and I'd like to learn more about this as well as Routing options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tips appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4962" LastEditorUserId="22" LastEditDate="2017-05-09T21:43:19.500" LastActivityDate="2017-05-09T21:43:19.500" Title="Where to find info on Entry URL Formats and routing syntax/options?" Tags="&lt;templating&gt;&lt;url&gt;&lt;routing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16403" PostTypeId="2" ParentId="16380" CreationDate="2016-08-17T23:08:44.410" Score="2" Body="&lt;p&gt;You could open up the db used by dev.customer.com for external access and connect to it from your local dev environment.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-08-18T06:03:50.307" LastActivityDate="2016-08-18T06:03:50.307" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16404" PostTypeId="2" ParentId="16401" CreationDate="2016-08-18T00:53:42.113" Score="1" Body="&lt;p&gt;As mentioned on Slack, the best approach to this currently is to set up all your variants and then use the plugin MultiAdd &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/MultiAdd&lt;/a&gt; to set up a form that can handle this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example code is in the ReadMe there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It uses a single fast controller to update the cart all in one go, so there's no real speed penalty, and it raises events onMultiAddToCart etc. if needed too.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-08-18T00:53:42.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16405" PostTypeId="1" AcceptedAnswerId="16408" CreationDate="2016-08-18T05:19:48.293" Score="0" ViewCount="220" Body="&lt;p&gt;In my plugin settings I am allowing the user to specify url formats for each locale along with desired template path, much like sections.  How do I then register those custom url formats as site routes?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-08-18T06:33:33.307" Title="How to setup custom site routes created by user in plugin settings" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16406" PostTypeId="1" AcceptedAnswerId="16407" CreationDate="2016-08-18T05:43:40.270" Score="2" ViewCount="662" Body="&lt;p&gt;How can I get the fields of a matrix field? I want to loop through the fields. I have the fields of the section, if the &lt;code&gt;field.handle&lt;/code&gt; is of type matrix, I want to get the fields of the matrix.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastActivityDate="2016-08-20T02:50:15.877" Title="Getting fields of Matrix?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16407" PostTypeId="2" ParentId="16406" CreationDate="2016-08-18T06:04:01.797" Score="4" Body="&lt;p&gt;Looping through a Matrix field is pretty easy, here is an example. Also read the docs on the Matrix field here - &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/matrix-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrix %}&#xA;    {% set handle = block.type.handle %} {# Grab the current block handle #}&#xA;&#xA;    {{ handle }} {# Echo out the handle #}&#xA;&#xA;    {% if handle == 'myMatrixBlock' %}&#xA;        {{ myMatrixBlock.heading }}  {# If you have a field called heading in myMatrixBlock #}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at these examples...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/5346/getting-fields-of-a-section-getfields&quot;&gt;getting fields of a section (getFields())&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/11068/how-to-loop-through-matrix-block-fields-and-pull-out-handle-and-content&quot;&gt;How to loop through matrix block fields and pull out handle and content?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-08-20T02:50:15.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16408" PostTypeId="2" ParentId="16405" CreationDate="2016-08-18T06:33:33.307" Score="5" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;registerSiteRoutes()&lt;/code&gt;&lt;/a&gt; hook in your plugin's primary class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your custom URL formats are stored in an array in a plugin setting called &lt;code&gt;customRoutes&lt;/code&gt; (use &lt;code&gt;AttributeType::Mixed&lt;/code&gt; for arrays), and that the array consists of key/value paired routes and template paths:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return $this-&amp;gt;getSettings()['customRoutes'] ?: array();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's how the &lt;code&gt;customRoutes&lt;/code&gt; array should look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'some-custom-route' =&amp;gt; '_some-custom-template',&#xA;    'another-custom-route' =&amp;gt; '_another-custom-template',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-18T06:33:33.307" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16412" PostTypeId="1" AcceptedAnswerId="16448" CreationDate="2016-08-18T10:51:42.750" Score="2" ViewCount="8839" Body="&lt;p&gt;I have simple loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for total in thing %}&#xA;  {{ total.seatsKids }} {{ total.seatsParents }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a string of numbers eg. &lt;code&gt;1 3 4&lt;/code&gt;. I want the sum of all numbers. So how do I get &lt;code&gt;7&lt;/code&gt; at the end? I don't understand how to write math operations within loops.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="4433" LastEditDate="2017-09-13T07:33:39.440" LastActivityDate="2017-09-13T07:33:39.440" Title="Total sum within loop" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;group&gt;&lt;math&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16413" PostTypeId="2" ParentId="961" CreationDate="2016-08-18T11:35:38.190" Score="0" Body="&lt;p&gt;I see this is 2 years old post but just wanted to share my findings. So, if anyone comes for a solution next time, he will be able to find a better solution. Please use this &lt;a href=&quot;https://gist.github.com/williamgomes/5749c8f54936823af15c9f1a45713861&quot; rel=&quot;nofollow&quot;&gt;gist&lt;/a&gt; created by me for details configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thnx.&lt;/p&gt;&#xA;" OwnerUserId="5534" LastActivityDate="2016-08-18T11:35:38.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16414" PostTypeId="1" AcceptedAnswerId="16420" CreationDate="2016-08-18T11:36:52.873" Score="1" ViewCount="613" Body="&lt;p&gt;I may be missing something really obvious in the docs - so sorry if I have - but is there a way to send both the user (sender) a notification email, and the admin a different notification email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like what I want has been hinted at: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11370/sprout-forms-cc&quot;&gt;Sprout Forms CC&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could set multiple email addresses in the notifications option: &lt;em&gt;Sprout Form &gt; Forms &gt; My Form &gt; Notifications (tab) &gt; Email Recipients (field)&lt;/em&gt; but the issue I have is how can I dictate which template is used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm happy to set/use the default options for the Admin email, if you could point me in the right direction for a custom user email option, that would be great.&lt;/p&gt;&#xA;" OwnerUserId="4168" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2018-12-13T01:18:10.637" Title="User and Admin email notifications" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16415" PostTypeId="1" AcceptedAnswerId="16416" CreationDate="2016-08-18T11:44:07.617" Score="2" ViewCount="328" Body="&lt;p&gt;Site design I am working on the first word of ever page title is bold. The code looks like this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1 class=&quot;section__heading&quot;&amp;gt;&amp;lt;strong&amp;gt;Discover&amp;lt;/strong&amp;gt; Riaflex Today&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am struggling to find a simple solution to do this in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I setup a simple rich text field then it wraps &quot;p&quot; tags around it. I have tried to used Markdown but this is the same and also end up with ** in the &amp;lt;'title'&gt; output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone done something similar or can offer a fairly simple approach. I had a quick  attempt at editing radactor but dropped it as it didn't seem to work and remove 'p' tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-08-18T12:16:23.033" Title="Bold first word in title field" Tags="&lt;redactor&gt;&lt;markdown&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16416" PostTypeId="2" ParentId="16415" CreationDate="2016-08-18T12:02:15.627" Score="5" Body="&lt;p&gt;You can grab the first word with the split filter according to this &lt;a href=&quot;https://stackoverflow.com/questions/24281925/twig-how-to-get-the-first-word-of-a-string&quot;&gt;thread&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set array = entry.title|split(' ', 2) %}&#xA;&amp;lt;h1 class=&quot;section__heading&quot;&amp;gt;&#xA;   &amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt;&#xA;   {{ attribute(array, 1) }}&#xA;&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I didn't test this tough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: there is a &lt;a href=&quot;http://twigfiddle.com/j3hfyu&quot; rel=&quot;nofollow&quot;&gt;Twig Fiddle&lt;/a&gt; demonstrating it.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2016-08-18T12:16:23.033" LastActivityDate="2016-08-18T12:16:23.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16418" PostTypeId="1" AcceptedAnswerId="16434" CreationDate="2016-08-18T12:48:11.313" Score="1" ViewCount="209" Body="&lt;p&gt;Does Craft have a built-in Controller/action for clearing the cache?&#xA;We have auto-deployment set to a server and would be useful to set up a POST-receive hook to force the cache to clear when deployments are made.&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="45" LastEditDate="2016-08-18T15:57:47.583" LastActivityDate="2016-08-19T17:16:38.837" Title="Cache controller/action" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16419" PostTypeId="1" AcceptedAnswerId="16423" CreationDate="2016-08-18T13:51:19.083" Score="2" ViewCount="114" Body="&lt;p&gt;In my general config I have enabled URLS to have trailing slashes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'addTrailingSlashesToUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working for products and entries. But it is not working on Categories. Category links are not adding trailing slashes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some additional config I need to add/setup or is this a bug?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="45" LastEditDate="2016-08-18T21:46:51.947" LastActivityDate="2016-08-18T21:46:51.947" Title="Categories not adding trailing slash" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16420" PostTypeId="2" ParentId="16414" CreationDate="2016-08-18T15:06:04.707" Score="1" Body="&lt;p&gt;Sprout Forms supports multiple Notification Emails (as of Craft 3) and multiple Email Template. Sprout Forms also now supports CC and BCC functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a new Notification Email on the &lt;code&gt;Sprout Forms-&amp;gt;Notifications&lt;/code&gt; tab. Each Notification Email has a setting for the Event that you would like to use to trigger it. You can select the &quot;When a form entry is saved&quot; event to trigger an email when a form submission is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While there are numerous ways to trigger an email to both an admin and the user submitting a form, two common methods are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setup a single Notification Email and set the &lt;code&gt;To&lt;/code&gt; field to the handle of a custom field that has the users email, such as: &lt;code&gt;{email}&lt;/code&gt; and set the BCC field to your email address of the admin who you wish to receive it as well. You can separate multiple recipients using a comma-delimited list.&lt;/li&gt;&#xA;&lt;li&gt;Setup two Notifications Emails and adjust the messages of each to each respective audience. You can create custom, company-branded Email Templates for the user-facing email. Impress them and set expectations for any follow-up communications. Send a workflow-oriented email to the admin, showing all data submitted in the form and linking to any next steps the admin may have to take after the email is received. The default &lt;code&gt;Basic Notification (Sprout Forms)&lt;/code&gt; Email Template will loop through and display all values of the Form submission.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Legacy Answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2, you are correct that Sprout Forms can send multiple notification emails to both admins and users, however the default Sprout Forms notification currently only supports a single template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our list to consider updating this default behavior. For now, your best options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Send the same email to both users and admins. &lt;/li&gt;&#xA;&lt;li&gt;Add &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt; to the mix which integrates with Sprout Forms and allows you to customize as many emails and templates as you'd like and trigger them on the Event: &lt;em&gt;When a Sprout Form Entry is submitted&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-12-13T01:18:10.637" LastActivityDate="2018-12-13T01:18:10.637" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16421" PostTypeId="1" AcceptedAnswerId="16422" CreationDate="2016-08-18T19:01:04.650" Score="0" ViewCount="80" Body="&lt;p&gt;How do you template to output across a grid that switches between vertical and horizontal posts?  I left the Craft/Trig off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to loop through and print entries using one orientation.  But how do I get it to change direction after every 2 and then switch back again, repeat...&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2016-08-18T19:36:42.933" LastActivityDate="2016-08-18T19:36:42.933" Title="How to Template Grid for Entries that Switch from Horizontal to Vertical?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16422" PostTypeId="2" ParentId="16421" CreationDate="2016-08-18T19:32:01.313" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% if loop.index is divisible by(2) %}stuff{% else %}other-stuff{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-08-18T19:32:01.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16423" PostTypeId="2" ParentId="16419" CreationDate="2016-08-18T20:55:56.363" Score="4" Body="&lt;p&gt;Whoops! Sorry. As I went to check the code I realised, I was using &lt;code&gt;{{ category.uri }}&lt;/code&gt; instead of &lt;code&gt;{{ category.url }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-08-18T21:09:59.487" LastActivityDate="2016-08-18T21:09:59.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16424" PostTypeId="1" CreationDate="2016-08-19T07:26:47.643" Score="3" ViewCount="98" Body="&lt;p&gt;I have a plugin that extends various Craft templates and styles, however, in one area it requires some custom Control Panel styles that Craft has not already created. As the Craft Control Panel is responsive, I'd like the UI elements I'm creating to also be responsive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears Craft makes it's UI components responsive using a combination of @media queries and javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way for me to build out a custom plugin UI that is consistent with the breakpoints that Craft is using and will be least likely to break if Craft updates anything down the road? &lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-19T07:26:47.643" Title="Responsive control panel styles" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;user-interface&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16425" PostTypeId="1" CreationDate="2016-08-19T09:01:25.123" Score="2" ViewCount="159" Body="&lt;p&gt;So I am creating a website using Craft with JavaScript for making it a single page app. I load my layout which then calls the pages which works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem is that when viewing pages through Live Preview I can't load the content. The layout gets loaded but not the content that the JavaScript adds calling for the pages. At first I thought it might be a problem with JavaScript in the iframe, but I don't think this is the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the calls to my JavaScript is getting the saved data from the DB and not the data from the Live Preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make Live Preview work with my single page app? Would somebody be able to explain how Live Preview works? Can I watch for the update event so that I can update the page with the Live Preview data?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-08-19T17:20:27.963" LastActivityDate="2016-08-19T17:20:27.963" Title="Live Preview not showing correct content when using single page app with JavaScript" Tags="&lt;javascript&gt;&lt;live-preview&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16426" PostTypeId="1" CreationDate="2016-08-19T09:17:51.530" Score="2" ViewCount="257" Body="&lt;p&gt;I've only recently started using Craft, so please excuse me if this is an obvious or silly question, but I've run into this problem when trying to create notifications on Sprout Emails (triggered by a Sprout Form).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP warning&#xA;&#xA;Creating default object from empty value&#xA;&#xA;/var/www/craft/plugins/sproutemail/services/SproutEmailService.php(506)&#xA;&#xA;...&#xA;505         // Add a few additional variables to our info table&#xA;506         $event-&amp;gt;params['variables']['info']-&amp;gt;deliveryStatus = $deliveryStatus;&#xA;507         $event-&amp;gt;params['variables']['info']-&amp;gt;message        = $message;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm really not sure how to fix this - each form worked perfectly before, and it's only since I started using Sprout Email twenty minutes ago!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I've not included enough code please tell me and I can include more!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="5540" LastActivityDate="2016-08-19T14:18:20.057" Title="Creating default object from empty value - Sprout Email" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16427" PostTypeId="1" AcceptedAnswerId="16438" CreationDate="2016-08-19T13:17:29.323" Score="3" ViewCount="162" Body="&lt;p&gt;I set up a Redactor config to add h3 headings only. If I copy-paste texts from a text edition software like Microsoft Word and uses h1 or h2 for example in his document, these un-wanted headings will be pasted in the rich text field. In another way, if I add an heading tag like &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; in the source code mode of Redactor, this unwanted heading will also be added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I prevent this and set a list of unwanted tags that could be dynamically deleted or converted in &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;em&gt;pasteBlockTags&lt;/em&gt; and &lt;em&gt;pasteInlineTags&lt;/em&gt; options in the Redactor doc (&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/paste/#setting-pasteBlockTags&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/docs/settings/paste/#setting-pasteBlockTags&lt;/a&gt;), but it doesn't seems possible to add these options inside the JSON file stored in &lt;code&gt;craft/config/redactor&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to add a new &lt;em&gt;formattingAdd&lt;/em&gt; option, which I called Remove format, and replace unwanted tags by &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, but this is an annoying solution because it needs to review each pieces of texts.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2016-08-19T13:24:02.467" LastActivityDate="2016-08-19T22:53:58.943" Title="How can I dynamically remove some unwanted formatting tags inside rich text fields?" Tags="&lt;control-panel&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16428" PostTypeId="1" AcceptedAnswerId="16446" CreationDate="2016-08-19T13:27:02.153" Score="5" ViewCount="1949" Body="&lt;p&gt;Can someone explain why and when we need to use &lt;code&gt;.first()&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example to use would be this code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredProductsHome = craft.entries.id(2).first() %}&#xA;{% for product in featuredProductsHome.featuredProducts %}&#xA;    {% import '_macros/_product' as m_product %}&#xA;    {{ m_product.teaser(product, 500, &quot;product-teaser--featured&quot;) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above works, but when I had &lt;code&gt;{% set featuredProductsHome = craft.entries.id(2) %}&lt;/code&gt; without calling &lt;code&gt;.first()&lt;/code&gt; it returned nothing.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="4466" LastEditDate="2016-08-19T13:58:25.000" LastActivityDate="2016-08-20T21:40:53.430" Title="When to use .first() and why?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16429" PostTypeId="1" CreationDate="2016-08-19T13:29:58.467" Score="1" ViewCount="134" Body="&lt;p&gt;I was getting an 'unknown error' when trying to access the admin. I couldn't see anything in the Craft logs apart from 404 related errors.&#xA;I replaced the app folder but still no luck, eventually I discovered it was a rewrite rule in my &lt;code&gt;.htaccess&lt;/code&gt; causing the problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# redirect PHP or HTM to no extension&#xA;RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)&#xA;RewriteRule ^ /%1 [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd love to understand why, and how I can get around this in the future?&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="4466" LastEditDate="2016-08-19T13:59:35.990" LastActivityDate="2016-08-19T13:59:35.990" Title="'Unknown error' caused by redirect in htaccess" Tags="&lt;error&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16430" PostTypeId="2" ParentId="16429" CreationDate="2016-08-19T13:37:54.340" Score="2" Body="&lt;p&gt;It might be down to the order you have the code in your htaccess file? Did you try putting your code above the Craft rewrite code?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# redirect PHP or HTM to no extension&#xA;RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)&#xA;RewriteRule ^ /%1 [L,R=301]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also I tend to exclude certain directories when I don't want rewrites to apply. One way to do this would be;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ------------------------------------------------------------------------------&#xA;# | Exclude directories from the rewrite rules                                 |&#xA;# ------------------------------------------------------------------------------&#xA;RewriteRule ^craft - [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-08-19T13:37:54.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16431" PostTypeId="2" ParentId="16426" CreationDate="2016-08-19T14:18:20.057" Score="2" Body="&lt;p&gt;This error can be triggered when you try to use a variable name in your Sprout Email template or fields that is not present in the submitted Form data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example where this can occur is if you try to reuse the example Welcome Notification email provided in Sprout Email and don't update the &lt;code&gt;{email}&lt;/code&gt; or &lt;code&gt;{username}&lt;/code&gt; values in the HTML and Text body fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add it to our list to revisit the error thrown here, as it's not clear at all what is happening from the error provided in the message you received above.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-19T14:18:20.057" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16432" PostTypeId="2" ParentId="16428" CreationDate="2016-08-19T14:28:22.103" Score="3" Body="&lt;p&gt;It's because &lt;code&gt;craft.entries.id(2)&lt;/code&gt; could be an object/array containing many entries. &lt;code&gt;.first()&lt;/code&gt; gets the first object within it, which in your case is the 1 entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit*: I'm wrong, see the comment beneath.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="4066" LastEditDate="2016-08-20T21:40:53.430" LastActivityDate="2016-08-20T21:40:53.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16433" PostTypeId="1" CreationDate="2016-08-19T15:08:17.463" Score="2" ViewCount="405" Body="&lt;p&gt;I'm trying to access a custom variant dropdown field in a plugin inside the &lt;code&gt;commerce_lineItems.onPopulateLineItem&lt;/code&gt; event. How would I access the value of the dropdown, in order to do a comparison on it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2018-05-12T20:59:17.263" Title="Get value of variant field in plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16434" PostTypeId="2" ParentId="16418" CreationDate="2016-08-19T17:16:38.837" Score="2" Body="&lt;p&gt;You'd need to write a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;super-simple plugin&lt;/a&gt; that exposes a controller's action URL your deploy hook could hit.  That action would basically just mimic what the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php&quot; rel=&quot;nofollow&quot;&gt;ClearCachesTool&lt;/a&gt; does for clearing the various caches in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L123&quot; rel=&quot;nofollow&quot;&gt;Template caches&lt;/a&gt;, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L128&quot; rel=&quot;nofollow&quot;&gt;Asset Transform Index caches&lt;/a&gt;, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L133&quot; rel=&quot;nofollow&quot;&gt;Asset Index caches&lt;/a&gt;, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L110&quot; rel=&quot;nofollow&quot;&gt;general data caches&lt;/a&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-19T17:16:38.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16435" PostTypeId="2" ParentId="16433" CreationDate="2016-08-19T18:47:21.023" Score="1" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function(Event $event) {&#xA;        $purchasable = $event-&amp;gt;params['purchasable'];&#xA;&#xA;        $myDropdownFieldValue = $purchasable-&amp;gt;getProduct()-&amp;gt;getContent()-&amp;gt;myDropdownField;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Relevant event docs: &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3951" LastEditDate="2017-11-13T17:43:19.357" LastActivityDate="2017-11-13T17:43:19.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16436" PostTypeId="1" CreationDate="2016-08-19T19:53:26.580" Score="1" ViewCount="187" Body="&lt;p&gt;Does anyone have an idea as to what might be causing this query? My only guess is that it has something to do with Element API which we are using on the production site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is locking up the database and seems to coincide with a series of other malicious XSS requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Got this from MySQL Slow Query Log - 548190019 rows examined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SET timestamp=1471114282;&#xA;SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `ele&#xA;ments`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `co&#xA;ntent`.`id` AS `contentId`, `content`.`title`, `content`.`field_allowCrop`, `content`.`field_imgAltText`, `content`.`f&#xA;ield_backgroundColor`, `content`.`field_blockTemplate`, `content`.`field_blogAuthor`, `content`.`field_blockLink`, `co&#xA;ntent`.`field_buttonColor`, `content`.`field_buttonStyle`, `content`.`field_certificationActivity`, `content`.`field_c&#xA;olor`, `content`.`field_blockContent`, `content`.`field_continents`, `content`.`field_countries`, `content`.`field_cta&#xA;Text`, `content`.`field_description`, `content`.`field_propertyDesc`, `content`.`field_protectedDescription`, `content&#xA;`.`field_eventLocation`, `content`.`field_eventUrl`, `content`.`field_externalLink`, `content`.`field_protectedExterna&#xA;lUrl`, `content`.`field_feature`, `content`.`field_featuredResource`, `content`.`field_protectedType`, `content`.`fiel&#xA;d_firstName`, `content`.`field_formCode`, `content`.`field_formUrl`, `content`.`field_heading`, `content`.`field_heroL&#xA;ink`, `content`.`field_footHtml`, `content`.`field_bodyHtmlTop`, `content`.`field_headHtml`, `content`.`field_exampleH&#xA;tmlEmailBody`, `content`.`field_iconColor`, `content`.`field_iconPosition`, `content`.`field_lastName`, `content`.`fie&#xA;ld_mediaContacts`, `content`.`field_seoMaticMeta`, `content`.`field_new`, `content`.`field_oldId`, `content`.`field_pa&#xA;geTemplate`, `content`.`field_podcastDescription`, `content`.`field_podcastKeywords`, `content`.`field_podcastLength`, `content`.`field_podcastSubtitle`, `content`.`field_position`, `content`.`field_promoLink`, `content`.`field_quote`, `content`.`field_quoteSource`, `content`.`field_resource`, `content`.`field_featuredResourceText`, `content`.`field_shortDescription`, `content`.`field_tagline`, `content`.`field_taglinePosition`, `content`.`field_textColor`, `content`.`field_exampleTextEmailBody`, `content`.`field_tripleNet`, `content`.`field_videoUrl`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;LEFT JOIN `craft_relations` `sources1` ON (sources1.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets1` ON (targets1.sourceId = elements.id)&#xA;LEFT JOIN `craft_relations` `sources2` ON (sources2.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets2` ON (targets2.sourceId = elements.id)&#xA;LEFT JOIN `craft_relations` `sources3` ON (sources3.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets3` ON (targets3.sourceId = elements.id)&#xA;LEFT JOIN `craft_relations` `sources4` ON (sources4.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets4` ON (targets4.sourceId = elements.id)&#xA;LEFT JOIN `craft_relations` `sources5` ON (sources5.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets5` ON (targets5.sourceId = elements.id)&#xA;LEFT JOIN `craft_relations` `sources6` ON (sources6.targetId = elements.id)&#xA;LEFT JOIN `craft_relations` `targets6` ON (targets6.sourceId = elements.id)&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE ((((((elements_i18n.locale = 'en_us') AND (content.locale = 'en_us')) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2016-08-13 18:11:07') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2016-08-13 18:11:07')))) AND (elements_i18n.enabled = 1)) AND (((sources1.sourceId='3103') OR (targets1.targetId='3103')) OR ((sources2.sourceId='3104') OR (targets2.targetId='3104')) OR ((sources3.sourceId='3107') OR (targets3.targetId='3107')) OR ((sources4.sourceId='3108') OR (targets4.targetId='3108')) OR ((sources5.sourceId='4694') OR (targets5.targetId='4694')) OR ((sources6.sourceId='3109') OR (targets6.targetId='3109')))) AND (sections.handle='properties')&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `lft`, `postDate` DESC LIMIT 100;```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5109" LastEditorUserId="5109" LastEditDate="2016-08-19T20:00:05.943" LastActivityDate="2016-08-19T20:18:33.870" Title="What is creating this huge query?" Tags="&lt;plugin-elementapi&gt;&lt;mysql&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16437" PostTypeId="2" ParentId="16436" CreationDate="2016-08-19T20:18:33.870" Score="2" Body="&lt;p&gt;That's definitely an element selection query.  In order to tell where it's coming from, you'd either have to cross reference the timestamp &lt;code&gt;1471114282&lt;/code&gt; or (if devMode is enabled) the query itself against the &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-19T20:18:33.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16438" PostTypeId="2" ParentId="16427" CreationDate="2016-08-19T22:53:58.943" Score="4" Body="&lt;p&gt;Not a &quot;real&quot; answer because it won't fix your actual content, but I wrote &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;a plugin&lt;/a&gt; that would make it easy to remedy your issue on the front end (i.e. in the template) –&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To remove all &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; tags (content inside tags will not be removed):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.someRedactorField|retconChange(['h1','h2'], false) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To change &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; tags into &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.someRedactorField|retconChange(['h1','h2'], 'p') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more about the &lt;code&gt;rectonChange&lt;/code&gt; filter used in the two examples above &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Change&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-19T22:53:58.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16439" PostTypeId="1" AcceptedAnswerId="16440" CreationDate="2016-08-19T22:59:53.843" Score="3" ViewCount="103" Body="&lt;p&gt;I am retrieving a data set with about 5000 records and I am using the &lt;code&gt;EntryModel::populateModels($results)&lt;/code&gt; to populate the model, this is causing a 500 error. When I limit the number of records returned to 100, it is working fine but when i set the limit to null it throws the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There isnt any error logged in the logs, and nor can it be a timeout because it only takes about 5 secs to return the error.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="22" LastEditDate="2017-05-09T21:42:58.843" LastActivityDate="2017-05-09T21:42:58.843" Title="EntryModel::populateModels throws a 500 error" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16440" PostTypeId="2" ParentId="16439" CreationDate="2016-08-19T23:34:15.127" Score="2" Body="&lt;p&gt;There's probably an error in &lt;code&gt;craft/storage/runtime/logs/phperrors.log&lt;/code&gt; and there's a 99% chance the problem is you're hitting your &lt;code&gt;php.ini&lt;/code&gt; file's &lt;a href=&quot;http://www.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow&quot;&gt;memory_limit&lt;/a&gt; setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Populating 5,000 models is going to take a significant amount of memory.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-19T23:34:15.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16441" PostTypeId="1" AcceptedAnswerId="16442" CreationDate="2016-08-20T00:36:21.120" Score="3" ViewCount="124" Body="&lt;p&gt;I have a Matrix block with a description field and a number field for hours. Let's say while creating an entry I add in 3 of these blocks with each having a different amount for the hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add each of those 3 amounts and get a total amount?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spent quite a while researching and can't figure out what kind of syntax would make this work.&lt;/p&gt;&#xA;" OwnerUserId="5220" LastActivityDate="2016-08-20T15:10:34.157" Title="Adding all the Matrix Block field types of the same kind to get a total" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;math&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16442" PostTypeId="2" ParentId="16441" CreationDate="2016-08-20T04:46:05.383" Score="4" Body="&lt;p&gt;Twig allows you to add variables just as they were integers. You'll want to setup your &lt;code&gt;totalHours&lt;/code&gt; variable before your loop begins so that the &lt;code&gt;totalHours&lt;/code&gt; variable is available in the scope outside of the loop itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Create a variable to track your total hours #}&#xA;{% set totalHours = 0 %}&#xA;&#xA;{% for block in entry.matrixFieldHandle %}&#xA;&#xA;    {% if block.type == 'hoursBlock' %}&#xA;        {# Increment your total hours by adding the value&#xA;           of your hours block to the current totalHours #}&#xA;        {% set totalHours = totalHours + block.hoursFieldHandle %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Output the result #}&#xA;Total Hours: {{ totalHours }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While I can't test your specific code, here's a generic example that is doing the same thing that will work if you copy and paste it to your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalHours = 0 %}&#xA;&#xA;{% for hours in 0..3 %}&#xA;    {% set totalHours = totalHours + hours %}&#xA;{% endfor %}&#xA;&#xA;Total Hours: {{ totalHours }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-08-20T15:10:34.157" LastActivityDate="2016-08-20T15:10:34.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16443" PostTypeId="2" ParentId="9756" CreationDate="2016-08-20T11:13:23.690" Score="2" Body="&lt;p&gt;This will work if you want to diff from &lt;code&gt;now&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set leftDays = meet.dateStart.diff( date(&quot;now&quot;) ).format('%a') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5543" LastEditorUserId="4466" LastEditDate="2016-08-22T08:51:31.377" LastActivityDate="2016-08-22T08:51:31.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16444" PostTypeId="1" CreationDate="2016-08-20T13:34:35.927" Score="3" ViewCount="171" Body="&lt;p&gt;I'm trying to access a CP template from the frontend, and i'm doing something like this in my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;...&#xA;$oldMode  = craft()-&amp;gt;templates-&amp;gt;getTemplateMode();&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::CP);&#xA;&#xA;$widget = craft()-&amp;gt;templates-&amp;gt;render('plugin/Plugin_Template', array(&#xA;    'chatraID' =&amp;gt; $chatraID,&#xA;));&#xA;&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode($oldMode);&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting the &lt;em&gt;Unable to find the template&lt;/em&gt; error, though. I have verified that the plugin is installed, and that the template  &lt;em&gt;plugin/Plugin_Template&lt;/em&gt; is accessible from the CP.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2016-08-20T20:29:53.347" Title="Using setTemplateMode on the frontend" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16445" PostTypeId="2" ParentId="16412" CreationDate="2016-08-20T14:36:12.407" Score="2" Body="&lt;p&gt;You could use some twig math, found at the bottom of the page here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html&quot; rel=&quot;nofollow&quot;&gt;Twig Templating&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure without seeing the rest of your code, but you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totals = [3,4]%}&#xA;{% for total in totals %}&#xA;  {{ total }}&#xA;  {% set sum = total + sum ?? 0 %}&#xA;  {% if loop.last %}{{ sum }}{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should output 34 and lastly 7&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or more specifically to your code, roughly (not tested)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for total in thing %}&#xA;  {{ total.seatsKids }} {{ total.seatsParents }}&#xA;  {% set sum = total.seatKids + total.seatsParents + sum ?? 0 %}&#xA;  {% if loop.last %}{{ sum }}{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should output 123456 and lastly 21&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-08-20T14:41:58.930" LastActivityDate="2016-08-20T14:41:58.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16446" PostTypeId="2" ParentId="16428" CreationDate="2016-08-20T18:34:20.140" Score="7" Body="&lt;p&gt;By default, when you query elements you get back an array of Elements. Craft assumes you are using &lt;code&gt;find()&lt;/code&gt; to query your elements if you don't explicitly say otherwise. You can loop through those elements and display attributes of those elements like you are doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.find() %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More generally, here an abstract example of what you are getting back from your query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# A query for several Entry elements #}&#xA;craft.entries.find()&#xA;&#xA;{# Results are an array of Entry Models #}&#xA;array(&#xA;  EntryModel,&#xA;  EntryModel,&#xA;  EntryModel&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the case, you are only querying a single entry, you still get it back in the format of an array when using the default &lt;code&gt;find()&lt;/code&gt; behavior.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# A query for a single Entry element using find() #}&#xA;craft.entries.id(11).find()&#xA;&#xA;{# Results are an array of a single Entry Model #}&#xA;array(&#xA;  EntryModel&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if you update your query to use &lt;code&gt;first()&lt;/code&gt;, you get back the Model directly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# A query for a single Entry element using first() #}&#xA;craft.entries.id(11).first()&#xA;&#xA;{# Results are the Entry Model itself (not within an array) #}&#xA;EntryModel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There is one more scenario to consider when using &lt;code&gt;first()&lt;/code&gt;. If you happen to be &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot;&gt;Eager Loading Elements&lt;/a&gt;, the results that you get back for your Element fields are not ElementCriteriaModels, but just normal arrays. So, in the case of accessing the data returned from Eager Loaded Elements you will not be able to use &lt;code&gt;first()&lt;/code&gt; as the &lt;code&gt;first()&lt;/code&gt; method is only available when you interact with ElementCriteriaModels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these cases, or in cases where you are sharing a partial template between two pages, one which uses eager loading and one that doesn't, you will need to access your first entry in an array using array syntax.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry.entryRelationsFieldHandle[0] ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example, since we are accessing the first element in the array directly &lt;code&gt;[0]&lt;/code&gt;, if it doesn't exist, we will get an error (The first &lt;code&gt;first()&lt;/code&gt; method is a bit smarter and will not throw an error). So, in the above example we have to explicitly plan for the situation of having no results using the null-coalescing operator &lt;code&gt;??&lt;/code&gt; and falling back to null. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer form discussion of this scenario can be found in the article &lt;a href=&quot;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&quot;&gt;Examples of Eager Loading Elements in Twig and PHP&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-08-20T18:34:20.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16447" PostTypeId="2" ParentId="16444" CreationDate="2016-08-20T20:29:53.347" Score="-1" Body="&lt;p&gt;May have answered on Stack/plugindev: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;@sjelfull  was intrigued, so started reading code about this, until the thought occurred: you seem to be asking a front end instance to access a CP template? This shouldn't be allowed unless it was a CP or action request, no?  The setting to TemplateMode can't fail this way, must be in trying to use the template, and that may fall apart at line 904 of TemplateService.php, would think. I don't put it past you to have another clever idea, though :wink: -- Takk for de...&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2016-08-20T20:29:53.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16448" PostTypeId="2" ParentId="16412" CreationDate="2016-08-20T20:38:09.187" Score="13" Body="&lt;p&gt;To do math in twig, you will need to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot;&gt;set&lt;/a&gt; tag to do assignments, and the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#math&quot;&gt;+&lt;/a&gt; operator to do addition. When doing math inside a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html&quot;&gt;for&lt;/a&gt; loop, you will need to keep in mind that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;loops are scoped in Twig; therefore a variable declared inside a for loop is not accessible outside the loop itself.&#xA;  If you want to access the variable, just declare it before the loop.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It looks as if you have a collection of things that represent seat counts, and you want to loop over them and calculate the totals. So, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# define and intialize our variables outside the loop #}&#xA;{% set kidSeatTotal = 0 %}&#xA;{% set parentSeatTotal = 0 %}&#xA;&#xA;{# loop over the seatCounts and add them up #}&#xA;{% for seatCount in thing %}&#xA;  {% set kidSeatTotal = kidSeatTotal + seatCount.seatsKids %}&#xA;  {% set parentSeatTotal = parentSeatTotal + seatCount.seatsParents %}&#xA;{% endfor %}&#xA;&#xA;{# maybe we want the grand total as well #}&#xA;{% set grandSeatTotal = kidSeatTotal + parentSeatTotal %}&#xA;&#xA;{# now we can output them: #}&#xA;kid seat total: {{ kidSeatTotal }}&#xA;parent seat total: {{ parentSeatTotal }}&#xA;grand total: {{ grandSeatTotal }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-08-20T20:38:09.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16449" PostTypeId="1" CreationDate="2016-08-20T20:42:13.153" Score="3" ViewCount="175" Body="&lt;p&gt;I'm writing a Craft CMS plugin with a widget. This widget needs to make calls to the Github-API trough javascript (&lt;a href=&quot;http://selectize.github.io/selectize.js/&quot; rel=&quot;nofollow&quot;&gt;Selectize&lt;/a&gt; is used in the widget). Now, the problem is that it's not allowed, made clear by this message in the console:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Refused to connect to '&lt;a href=&quot;https://api.github.com/search/repositories/?q=i&quot; rel=&quot;nofollow&quot;&gt;https://api.github.com/search/repositories/?q=i&lt;/a&gt;' because it violates the following Content Security Policy directive: &quot;default-src 'self' data:&quot;. Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can fix this by setting the Content-Security-Policy meta tag in the head:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'self' https://api.github.com/&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've attempted to add this with the following code in the template for my widget:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set meta %}&#xA;    &amp;lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'self' https://api.github.com/&quot;&amp;gt;&#xA;{% endset %}&#xA;{% includeHeadHtml(meta) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this correct or is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="4750" LastEditorUserId="4750" LastEditDate="2016-08-23T19:05:12.150" LastActivityDate="2016-08-23T19:05:12.150" Title="How to set a meta-tag from a plugin" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16450" PostTypeId="2" ParentId="16449" CreationDate="2016-08-20T20:52:49.613" Score="3" Body="&lt;p&gt;It looks as if there is a &lt;a href=&quot;https://content-security-policy.com/&quot; rel=&quot;nofollow&quot;&gt;Content-Security-Policy&lt;/a&gt; header that may also do what you want. You should be able to use the &lt;a href=&quot;https://craftcms.com/docs/templating/header&quot; rel=&quot;nofollow&quot;&gt;header&lt;/a&gt; tag to set this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;script-src: 'self' https://api.github.com/;&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="5424" LastEditDate="2016-08-22T17:26:29.920" LastActivityDate="2016-08-22T17:26:29.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16451" PostTypeId="1" CreationDate="2016-08-20T21:18:06.957" Score="1" ViewCount="80" Body="&lt;p&gt;I have a section that is a single type. On this page there is a relation ship ('entries') field where the user can select a related photo gallery. Photo gallery is its own section with a matrix field on it that contains image files and image names. How when I am displaying the single page pull in the matrix field to display an image gallery. This is what I have tried but not with much luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if entry.associatedGallery is not null %}&#xA;    {% set theGallery = craft.entries.section('bb').relatedTo(entry.associatedGallery) %}&#xA;      &amp;lt;div class=&quot;galleria associated-gallery&quot;&amp;gt;&#xA;        {% for matrixBlock in theGallery.albumImages %}&#xA;          {% set asset = matrixBlock.imageFile.first() %}&#xA;            {% if asset %}&#xA;              &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('homeThumb') }}&quot; data-title=&quot;{{ matrixBlock.imageName }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;h1&amp;gt; Apparently its null&amp;lt;/h1&amp;gt;  &#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if entry.associatedGallery is not null %}&#xA;    {% set theGallery = entry.associatedGallery %}&#xA;      &amp;lt;div class=&quot;galleria associated-gallery&quot;&amp;gt;&#xA;        {% for matrixBlock in theGallery.albumImages %}&#xA;          {% set asset = matrixBlock.imageFile.first() %}&#xA;            {% if asset %}&#xA;              &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('homeThumb') }}&quot; data-title=&quot;{{ matrixBlock.imageName }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;h1&amp;gt; Apparently its null&amp;lt;/h1&amp;gt;  &#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I am missing something fundamental about how relationships are defined.&lt;/p&gt;&#xA;" OwnerUserId="5478" LastActivityDate="2016-08-21T03:01:35.667" Title="Displaying images from a matrix field from a related field" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16452" PostTypeId="2" ParentId="16451" CreationDate="2016-08-20T21:46:40.190" Score="1" Body="&lt;p&gt;Relationship field is defined like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedItem in entry.relatedItemField %}&#xA;  {{ relatedItem.someField }} {{ relatedItem.someOtherField }}    &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So maybe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.associatedGallery | length %}&#xA;    {% for theGallery in entry.associatedGallery %}&#xA;        {% for matrixBlock in theGallery.albumImages %}&#xA;            {% if matrixBlock.imageFile | length %}&#xA;                {% for asset in matrixBlock.imageFile.first() %}&#xA;                    &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('homeThumb') }}&quot; data-title=&quot;{{ matrixBlock.imageName }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                {% endfor %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-08-20T21:46:40.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16453" PostTypeId="1" CreationDate="2016-08-21T02:54:00.560" Score="1" ViewCount="770" Body="&lt;p&gt;I want to filter data based on category, I would prefer to do this using a &lt;code&gt;join&lt;/code&gt; statement, but I can't figure out how an entry is related to its category. I had the same problem with matrix field, but figured it out after hours of research, the code for this is below. A similar statement to filter based on category would be great.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'affiliates';&#xA;$criteria-&amp;gt;limit = null;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$query-&amp;gt;join('matrixblocks matrixblocks', 'matrixblocks.ownerId = entries.id');&#xA;$mat_name = 'field_handle';&#xA;$query-&amp;gt;join('matrixcontent_'.$mat_name.' matrixcontent_'.$mat_name, 'matrixcontent_'.$mat_name.'.elementId = matrixblocks.id');&#xA;$query-&amp;gt;join('relations relations', 'relations.sourceId = matrixcontent_'.$mat_name.'.elementId');&#xA;$query-&amp;gt;join('content '.$mat_name, $mat_name.'.elementId = relations.targetId');&#xA;$query-&amp;gt;andWhere($mat_name.&quot;.title&quot;.&quot; IN ('abc', 'def')&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="5330" LastEditDate="2016-08-21T04:35:20.047" LastActivityDate="2016-08-23T11:07:41.417" Title="Filtering entries based on category?" Tags="&lt;plugin-development&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16454" PostTypeId="2" ParentId="16451" CreationDate="2016-08-21T03:01:35.667" Score="1" Body="&lt;p&gt;After using the above and re-reading the docs I got this to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set relatedGallery = entry.associatedGallery.first() %}&#xA;  {% if relatedGallery %}&#xA;    {% for matrixBlock in relatedGallery.albumImages %}&#xA;      {% set asset = matrixBlock.imageFile.first() %}&#xA;        {% if asset %}&#xA;          &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('homeThumb') }}&quot; data-title=&quot;{{ matrixBlock.imageName }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}    &#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5478" LastActivityDate="2016-08-21T03:01:35.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16455" PostTypeId="2" ParentId="16369" CreationDate="2016-08-21T03:07:14.290" Score="1" Body="&lt;p&gt;This turned out to be an issue with a misconfigured Google API key.&lt;/p&gt;&#xA;&lt;p&gt;When setting up your Google API keys, make sure that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your domain is whitelisted (including any staging servers).&lt;/li&gt;&#xA;&lt;li&gt;Your keys have granted permission to the necessary functionality.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Be sure to read the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/get-google-api-keys/&quot; rel=&quot;nofollow noreferrer&quot;&gt;full instructions&lt;/a&gt; for how to set up your Google API keys.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:43:17.900" LastActivityDate="2021-01-01T06:43:17.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16456" PostTypeId="1" CreationDate="2016-08-21T15:44:34.277" Score="0" ViewCount="117" Body="&lt;p&gt;I'm trying to set the price of the item being added to the cart by a global variable, which is a number field. Here's what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event)&#xA;{&#xA;    $lineItem = $event-&amp;gt;params['lineItem'];&#xA;    $globalPrices = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('defaultPrices');&#xA;    $itemPrice = var_dump($globalPrices-&amp;gt;fontStylePrice);&#xA;    $lineItem-&amp;gt;price = $itemPrice;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just results in a $0 price being set, and not the value from the Global Variable. But again, &lt;code&gt;$lineItem-&amp;gt;price = 25&lt;/code&gt; works fine. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="4700" LastEditorUserId="57" LastEditDate="2016-08-22T00:05:01.983" LastActivityDate="2016-08-22T13:22:16.280" Title="Using Global Variable as Price for Variant" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16457" PostTypeId="2" ParentId="16456" CreationDate="2016-08-22T00:55:55.317" Score="0" Body="&lt;p&gt;Just a wild guess really, but it feels like this might be a type issue - is the price you're getting back from the global a float?  Or is it a string maybe?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;lineItem-&amp;gt;price = floatval($itemPrice);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...might be what you need?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-08-22T00:55:55.317" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16458" PostTypeId="1" AcceptedAnswerId="16481" CreationDate="2016-08-22T03:08:01.593" Score="1" ViewCount="81" Body="&lt;p&gt;I am still having a problem looping through related posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get zero, not even the HTML. And there are no Craft template errors. There are plenty of entries that were assigned the same market, so there should be something.  AND this exact approach worked perfectly before !@$!@#!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h5&amp;gt;Similar Projects&amp;lt;/h5&amp;gt;&#xA;&#xA;{% set relatedMarket = entry.market.first() %}&#xA;{% set relatedEntries = craft.entries.section('posts').relatedTo({ targetElement: relatedMarket, field: 'market'}).id('not'~entry.id) %}&#xA;&#xA;{% for relatedEntry in relatedEntries %}&#xA;    &amp;lt;a href=&quot;{{ relatedEntry.url }}&quot;&amp;gt;&amp;lt;p&amp;gt; Entry title goes here. {{ relatedEntry.title  }} &amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;&#xA;{% endfor %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I double checked.  My entry section handle is &lt;code&gt;posts&lt;/code&gt;. The handle for the &lt;code&gt;posts&lt;/code&gt; entry type is &lt;code&gt;notifications&lt;/code&gt;. The category group handle is &lt;code&gt;markets&lt;/code&gt;.  The category entry field handle is &lt;code&gt;market&lt;/code&gt;.  I included the entry type and category group handles just in case I am missing something. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2016-08-23T15:47:54.757" LastActivityDate="2016-08-23T18:45:02.700" Title="Related Items in a Category not Appearing in Results" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="16459" PostTypeId="1" AcceptedAnswerId="16460" CreationDate="2016-08-22T06:05:01.767" Score="1" ViewCount="38" Body="&lt;p&gt;Has anyone used Dreamhost's cloud service: DreamObjects, an Object-Based-Storage to host their assets? If so, how do you configure this with Craft 2.6.2911?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-08-22T06:35:41.650" Title="Using DreamObjects to store assets" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16460" PostTypeId="2" ParentId="16459" CreationDate="2016-08-22T06:35:41.650" Score="1" Body="&lt;p&gt;If I'm understanding you correctly, it sounds like you're trying to add another &lt;a href=&quot;https://craftcms.com/classreference/assetsourcetypes/BaseAssetSourceType&quot; rel=&quot;nofollow&quot;&gt;Assets Source Type&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this isn't possible in Craft 2. This feature is expected to be introduced in &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow&quot;&gt;Craft 3&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Volume Types&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Asset Sources have been renamed to “Volumes” in Craft 3, and their API has been dramatically simplified. In addition to Craft’s built-in Local, S3, Google, and Rackspace Volume types, plugins are now able to supply their own. There’s even a base Volume class that makes it really easy to implement Flysystem-based Volume types.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-22T06:35:41.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16461" PostTypeId="1" CreationDate="2016-08-22T08:06:47.920" Score="2" ViewCount="1448" Body="&lt;p&gt;I am building a VOD site using Craft and Craft Commerce. This is the first time I'm working with their Commerce plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create subscription products and assign them to plan types.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subscription period of any duration and frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Trial period to lower a price barrier for subscribers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Payments processed via external gateways.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is the best way of implementing such functionality?&lt;/p&gt;&#xA;" OwnerUserId="5544" LastEditorUserId="4466" LastEditDate="2016-08-22T08:52:56.653" LastActivityDate="2016-08-22T17:27:40.520" Title="How would you handle subscriptions and recurring payments using Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16462" PostTypeId="2" ParentId="16461" CreationDate="2016-08-22T10:45:30.680" Score="4" Body="&lt;p&gt;At time of writing (22/08/16) - there is no support for subscriptions in Commerce.  You could attempt to do them as traditional products but I suspect it would be a lot of custom work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a &lt;em&gt;very frequently&lt;/em&gt; &lt;a href=&quot;http://feedback.craftcms.com/forums/295386-commerce/suggestions/7814868-subscriptions&quot; rel=&quot;nofollow&quot;&gt;requested feature&lt;/a&gt; and I suspect proper subscriptions support will come to Commerce sooner rather than later.  Hopefully much sooner!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, the solution most people seem to talk about is the Charge plugin instead of Commerce (or alongside Commerce for other commerce needs): &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;https://squarebit.co.uk/software/craft/charge&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2016-08-22T17:27:40.520" LastActivityDate="2016-08-22T17:27:40.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16463" PostTypeId="2" ParentId="16456" CreationDate="2016-08-22T13:22:16.280" Score="1" Body="&lt;p&gt;Removed the var_dump() from setting the variable as follows, and it works perfectly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event)&#xA;{&#xA;    $lineItem = $event-&amp;gt;params['lineItem'];&#xA;    $globalPrices = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('defaultPrices');&#xA;    $itemPrice = $globalPrices-&amp;gt;fontStylePrice;&#xA;    $lineItem-&amp;gt;price = $itemPrice;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2016-08-22T13:22:16.280" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16464" PostTypeId="1" AcceptedAnswerId="16470" CreationDate="2016-08-22T13:55:17.637" Score="1" ViewCount="450" Body="&lt;p&gt;I'm trying to add a global set, with a Matrix and two required fields for a product. This always works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I am in version 2.6.2791 it fails to add the fields with error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;Warning&amp;lt;/b&amp;gt;&#xA;: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in&#xA;&amp;lt;b&amp;gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php&amp;lt;/b&amp;gt;&#xA;on line&#xA;&amp;lt;b&amp;gt;17&amp;lt;/b&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;&#xA;: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in&#xA;&amp;lt;b&amp;gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php&amp;lt;/b&amp;gt;&#xA;on line&#xA;&amp;lt;b&amp;gt;17&amp;lt;/b&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;&#xA;: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in&#xA;&amp;lt;b&amp;gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php&amp;lt;/b&amp;gt;&#xA;on line&#xA;&amp;lt;b&amp;gt;1519&amp;lt;/b&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;br&amp;gt;&#xA;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;&#xA;: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in&#xA;&amp;lt;b&amp;gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php&amp;lt;/b&amp;gt;&#xA;on line&#xA;&amp;lt;b&amp;gt;1507&amp;lt;/b&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CSRF token could not be validated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas or fixes would be great!&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="57" LastEditDate="2016-08-22T17:30:27.227" LastActivityDate="2016-08-22T17:38:46.107" Title="Failed to add a custom field in settings" Tags="&lt;error-message&gt;&lt;globals&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16465" PostTypeId="1" AcceptedAnswerId="16466" CreationDate="2016-08-22T14:32:26.860" Score="1" ViewCount="117" Body="&lt;p&gt;I notice that the Craft admin pages append random query parameters to their static files, i.e. &lt;code&gt;jquery-2.2.1.min.js?x=AKVKl03So&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bhOl0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bhOl0.png&quot; alt=&quot;example network data from admin, showing query parameters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This prevents those static files being cached in browsers, which can make the admin views unreliable in less-than-optimal network conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see the logic to make this happen is in Craft's &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/768ba7b2afd471771f6f449b28308c7e1fe8fefd/app/helpers/UrlHelper.php#L254-L307&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;app/helpers/UrlHelper.php&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a sane way to deactivate that behavior, and allow browsers to cache Craft's static files?&lt;/p&gt;&#xA;" OwnerUserId="5547" LastEditorUserId="57" LastEditDate="2016-08-22T17:39:48.317" LastActivityDate="2016-08-22T17:39:48.317" Title="How to allow browsers to cache Craft's admin static files?" Tags="&lt;cache&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16466" PostTypeId="2" ParentId="16465" CreationDate="2016-08-22T14:52:23.253" Score="2" Body="&lt;p&gt;I don't think it's a great idea to disable this cache busting; they put it in there for a reason.  However, if you really need/want to do it, instead of modifying Craft, I'd just configure Apache/Nginx to discard the query string for paths that match &lt;code&gt;/admin/resources/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://wiki.apache.org/httpd/RewriteQueryString&quot; rel=&quot;nofollow&quot;&gt;https://wiki.apache.org/httpd/RewriteQueryString&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-08-22T14:52:23.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16468" PostTypeId="1" AcceptedAnswerId="16473" CreationDate="2016-08-22T16:24:15.773" Score="2" ViewCount="448" Body="&lt;p&gt;I am trying to create an endpoint that outputs the latest updated entry in each section (Themes, Videos and Screensavers) like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;url/updated.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA; themes: '2016-08-22',&#xA; videos: '2016-08-18',&#xA; screensavers: '2016-07-20'&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't think of how to do this but here is my code so far, no dice so far tho:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'updates.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'paginate' =&amp;gt; false,&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; '', 'limit' =&amp;gt; null,],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            $screensaversLastUpdated = $entry-&amp;gt;dateUpdated;&#xA;            $videosLastUpdated = $entry-&amp;gt;dateUpdated;&#xA;            $themesLastUpdated = $entry-&amp;gt;dateUpdated;&#xA;            return [&#xA;                'themes' =&amp;gt; $screensaversLastUpdated ,&#xA;                'screensavers' =&amp;gt; $screensaversLastUpdated ,&#xA;                'videos' =&amp;gt; $videosLastUpdated&#xA;            ];&#xA;        }&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Thanks!&lt;/h2&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2016-08-23T12:27:36.373" Title="Element API &quot;Last Updated Sections&quot;" Tags="&lt;elementcriteriamodel&gt;&lt;php&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16469" PostTypeId="1" AcceptedAnswerId="16471" CreationDate="2016-08-22T16:57:42.733" Score="3" ViewCount="208" Body="&lt;p&gt;Currently in the source down migrations are not supported by Craft CMS. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function safeDown()&#xA;{&#xA;    Craft::log('Down migrations are not supported.', LogLevel::Warning);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why are they not supported? Also, how can I implement this for my own plugins? &lt;/p&gt;&#xA;" OwnerUserId="4390" LastEditorUserId="57" LastEditDate="2016-08-22T17:43:47.403" LastActivityDate="2016-08-22T18:00:55.630" Title="Down Migrations" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16470" PostTypeId="2" ParentId="16464" CreationDate="2016-08-22T17:38:46.107" Score="2" Body="&lt;p&gt;You're getting that error message because your PHP environment is displaying &lt;a href=&quot;https://secure.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting&quot; rel=&quot;nofollow&quot;&gt;PHP Strict mode&lt;/a&gt; error messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, Craft will explicitly disable those if &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; is enabled (&lt;code&gt;error_reporting(E_ALL &amp;amp; ~E_STRICT);&lt;/code&gt;) and disable all messages if devMode is disabled (&lt;code&gt;error_reporting(0);&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my guess is you've either got a plugin that's messing with error_reporting and re-enabling strict messages or you've doing it from your public &lt;code&gt;index.php&lt;/code&gt; or &lt;code&gt;craft/config&lt;/code&gt; files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the upcoming Craft 3, we've made it so that you can run Craft with PHP strict error messaging enabled.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-22T17:38:46.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16471" PostTypeId="2" ParentId="16469" CreationDate="2016-08-22T18:00:55.630" Score="4" Body="&lt;p&gt;The main reason down migrations aren't officially supported is because of the additional support overhead they would incur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just one simple example: a down migration would have to &quot;undo&quot; what the up migration did.  If that happened to be something destructive, like removing a database column that was storing content on your site, and you waited long enough for users to enter content that used that column, now you've lost the content they've entered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets more complicated if you take into account dependencies. Plugin A depends on Craft schema version B to be in place to work, but if you down migrate  Craft to schema version A, plugin A will break despite any schema version checks they might have done on installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same goes for dependencies between plugin A and plugin B as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to support this in your plugin, your migration is probably already extending &lt;a href=&quot;https://craftcms.com/classreference/etc/db/BaseMigration&quot; rel=&quot;nofollow&quot;&gt;BaseMigration&lt;/a&gt; and you can extend the &lt;a href=&quot;https://craftcms.com/classreference/etc/db/BaseMigration#safeDown-detail&quot; rel=&quot;nofollow&quot;&gt;safeDown&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just note that there's no way to trigger this through the Craft CP natively. You'd have to write a plugin that exposed a controller action to trigger it or if you wanted it from the &lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;command line&lt;/a&gt;, you'd have to create a custom console command that exposed it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-22T18:00:55.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16472" PostTypeId="1" CreationDate="2016-08-23T06:24:56.463" Score="1" ViewCount="305" Body="&lt;p&gt;I need to batch process a set of data. To do this I am using the code below. I am trying to process 100 at a time, but the offset doesn't seem to work. It works the first time, but in the second iteration of the loop it doesn't set the offset properly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;  $criteria-&amp;gt;section = 'affiliates';&#xA;  $criteria-&amp;gt;limit = null;&#xA;  $row_count = 6000;&#xA;  $batch_size = 100;&#xA;  $num_batches = ceil($row_count / $batch_size);&#xA;  $offset = 100;&#xA;&#xA;  for ($j=0; $j &amp;lt;= $num_batches; $j++) {&#xA;      $query-&amp;gt;setOffset($offset);&#xA;      $query-&amp;gt;limit = $batch_size;&#xA;      $offset = $offset + $batch_size;        &#xA;      $queryResults = $query-&amp;gt;queryAll();&#xA;      $affiliates = EntryModel::populateModels($queryResults);    &#xA;&#xA;      foreach ($affiliates as $affiliate) {&#xA;        //process&#xA;      }&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="57" LastEditDate="2016-08-23T18:17:23.357" LastActivityDate="2016-08-23T18:17:23.357" Title="Setting query offset" Tags="&lt;plugin-development&gt;&lt;yii&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16473" PostTypeId="2" ParentId="16468" CreationDate="2016-08-23T09:45:36.203" Score="2" Body="&lt;p&gt;This isn't really a job for the Element API plugin. You can accomplish what you want much easier by just creating a plain ol' Twig template (e.g. &lt;code&gt;templates/updates.json&lt;/code&gt;) that pulls the three latest updated entries from each section, and returns the entries' &lt;code&gt;dateUpdated&lt;/code&gt; values as JSON:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header &quot;Content-Type: application/json&quot; %}&#xA;&#xA;{%- spaceless -%}&#xA;&#xA;{% set sections = ['themes', 'videos', 'screensavers'] %}&#xA;{% set entries = [] %}&#xA;{% for section in sections %}&#xA;    {% set entry = craft.entries.section(section).order('dateUpdated desc').limit(1).first() %}&#xA;    {% set entries = entry ? entries|merge([entry]) : entries %}&#xA;{% endfor %}&#xA;&#xA;{&#xA;  {%- for entry in entries -%}&#xA;    &quot;{{ entry.section.handle }}&quot;:&quot;{{ entry.dateUpdated }}&quot;{% if not loop.last %},{% endif %}&#xA;  {%- endfor -%}&#xA;}&#xA;&#xA;{%- endspaceless -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above would render a JSON payload exactly like the one you have in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to use Element API for some reason, you can get pretty close to what you want (but not quite). Here's why it's difficult to do, though:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one, the &lt;code&gt;transformer&lt;/code&gt; property function operates on a single entry at the time, which is a problem in terms of your desired payload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, with Element API you don't have full control of the JSON format the plugin returns – so you'll never get the payload to look exactly like you want (the actual data will be wrapped in a &lt;code&gt;data&lt;/code&gt; property).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third and most importantly, an Element API endpoint requires a single query (or actually, a single &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;) to pull your elements. Unfortunately, it isn't possible to tell an ElementCriteriaModel to return 1 entry from each section – notice that even in the template example above, there's actually &lt;em&gt;three&lt;/em&gt; queries – one for each section (they're just wrapped in a &lt;code&gt;for&lt;/code&gt; loop to keep the code small and DRY).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically, you'll need to &quot;trick&quot; Element API to return something similar to your example JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, since you can't use a single ElementCriteriaModel to query your 3 latest entries, you'll actually need three of those suckers. The Element API plugin gives you one, but you'll need to create the other two inside the &lt;code&gt;transformer&lt;/code&gt; function – you just need to ensure that Element API actually runs that function, and &lt;em&gt;only runs it once&lt;/em&gt;, by pulling a single entry (in other words; you'll need a &lt;code&gt;limit =&amp;gt; 1&lt;/code&gt; for your endpoint's &lt;code&gt;criteria&lt;/code&gt;). It makes sense to have the endpoint pull one of the three entries you need, so you'll avoid a redundant database query. Then, you'll have to pull the other two entries &quot;manually&quot;. Finally, for the return value you can return an array similar to what you have in your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'updates.json' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'paginate' =&amp;gt; false,&#xA;    'criteria' =&amp;gt; ['section' =&amp;gt; 'themes', 'order' =&amp;gt; 'dateUpdated desc', 'limit' =&amp;gt; 1],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;        $themesEntry = $entry;&#xA;&#xA;        $videosEntry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;            'section' =&amp;gt; 'videos',&#xA;            'order' =&amp;gt; 'dateUpdated desc',&#xA;            'limit' =&amp;gt; 1&#xA;        ])-&amp;gt;first();&#xA;&#xA;        $screensaversEntry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;            'section' =&amp;gt; 'screensavers',&#xA;            'order' =&amp;gt; 'dateUpdated desc',&#xA;            'limit' =&amp;gt; 1&#xA;        ])-&amp;gt;first();&#xA;&#xA;        return [&#xA;            'themes' =&amp;gt; date('Y-m-d', $themesEntry-&amp;gt;dateUpdated-&amp;gt;getTimestamp()),&#xA;            'videos' =&amp;gt; date('Y-m-d', $videosEntry-&amp;gt;dateUpdated-&amp;gt;getTimestamp()),&#xA;            'screensavers' =&amp;gt; date('Y-m-d', $screensaversEntry-&amp;gt;dateUpdated-&amp;gt;getTimestamp()),&#xA;        ];&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above would return a JSON payload looking something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;data&quot;:[{&quot;themes&quot;:&quot;2016-02-23&quot;,&quot;videos&quot;:&quot;2016-08-23&quot;,&quot;screensavers&quot;:&quot;2016-07-16&quot;}]}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-23T12:27:36.373" LastActivityDate="2016-08-23T12:27:36.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16474" PostTypeId="2" ParentId="16472" CreationDate="2016-08-23T10:05:17.323" Score="1" Body="&lt;p&gt;Not totally sure I understand everything going on in your example code, but I believe it could be a simplified a little:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'affiliates';&#xA;$criteria-&amp;gt;limit = null;&#xA;&#xA;$rowCount = $criteria-&amp;gt;total();&#xA;$batchSize = 100;&#xA;$numBatches = ceil($rowCount / $batchSize);&#xA;&#xA;$criteria-&amp;gt;limit = $batchSize;&#xA;&#xA;for ($i = 0; $i &amp;lt; $numBatches; ++$i) {&#xA;    $criteria-&amp;gt;offset = $batchSize * $i;&#xA;    $affiliates = $criteria-&amp;gt;find();&#xA;    foreach ($affiliates as $affiliate) {&#xA;        //process&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tested, and works.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-23T10:10:45.393" LastActivityDate="2016-08-23T10:10:45.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16475" PostTypeId="2" ParentId="16453" CreationDate="2016-08-23T11:07:41.417" Score="14" Body="&lt;p&gt;Craft has a pretty solid engine for relational queries, so unless what you want to do is totally outside the box, there's a good chance you can accomplish what you want by using the &lt;a href=&quot;https://craftcms.com/docs/relations&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter available to the &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot;&gt;ElementCriteriaModel&lt;/a&gt;. &lt;em&gt;Note that the &lt;code&gt;relatedTo&lt;/code&gt; entry in the docs pertain to templates and not plugin development per se, but aside from the syntax the concept and approach will be identical in PHP.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some examples, since its not obvious to me exactly what you hope to achieve:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To pull entries related to a certain category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;    'section' =&amp;gt; 'affiliates',&#xA;    'limit' =&amp;gt; null,&#xA;    'relatedTo' =&amp;gt; [&#xA;        'element' =&amp;gt; $category, // Instance of CategoryModel, or a category ID&#xA;    ],&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries related to multiple categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; [&#xA;    'element' =&amp;gt; $categories, // Array of CategoryModels or category IDs&#xA;],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries related to a category, where the relation is made in a certain Categories field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; [&#xA;    'element' =&amp;gt; $category,&#xA;    'field' =&amp;gt; 'someCategoriesFieldHandle',&#xA;],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries related to a category, where the relation is made in a certain Categories field on the EntryModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; [&#xA;    'targetElement' =&amp;gt; $category,&#xA;    'field' =&amp;gt; 'someCategoriesField',&#xA;],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries related to a category, where the relation is made in a certain Entries field on the CategoryModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; [&#xA;    'sourceElement' =&amp;gt; $category,&#xA;    'field' =&amp;gt; 'someEntriesField',&#xA;],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries with multiple possible relations, where &lt;em&gt;any&lt;/em&gt; of the relational parameters can be met:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; ['or', [&#xA;    'targetElement' =&amp;gt; $categories,&#xA;    'field' =&amp;gt; 'someCategoriesField',&#xA;], [&#xA;    'targetElement' =&amp;gt; $someOtherCategories,&#xA;    'field' =&amp;gt; 'someOtherCategoriesField',&#xA;]],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull entries with multiple possible relations, where &lt;em&gt;all&lt;/em&gt; of the relational parameters must be met:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;'relatedTo' =&amp;gt; ['and', [&#xA;    'targetElement' =&amp;gt; $categories,&#xA;    'field' =&amp;gt; 'someCategoriesField',&#xA;], [&#xA;    'targetElement' =&amp;gt; $someOtherCategories,&#xA;    'field' =&amp;gt; 'someOtherCategoriesField',&#xA;]],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you edit your question to include exactly what you want to do, I might be able to give you more specific advice or examples.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-23T11:07:41.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16476" PostTypeId="1" CreationDate="2016-08-23T11:36:44.327" Score="2" ViewCount="320" Body="&lt;p&gt;I had what I thought was a very simple issue: Select some categories on the front-end, filtering by a Checkbox field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Checkbox has values, which correlate to Locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end goal was to create a 'workaround' to the fact that you can't disable/enable a category per Locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on the template, I attempted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for collection in craft.categories.group('dressCollection').regionAvailability(craft.locale) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="175" LastEditorUserId="57" LastEditDate="2016-08-23T18:20:15.837" LastActivityDate="2016-08-23T18:20:15.837" Title="Selecting entries using a checkbox field" Tags="&lt;categories&gt;&lt;localization&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16477" PostTypeId="2" ParentId="16476" CreationDate="2016-08-23T11:36:44.327" Score="2" Body="&lt;p&gt;Reply via Brandon:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single field does probably make more sense here, as you have it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're close to getting it working, but your syntax for filtering categories based on craft.locale is wrong. Checkboxes fields store the selected option values as JSON, so if you check your craft_content table you will find values like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[&quot;option_1&quot;,&quot;option_2&quot;,&quot;option_3&quot;]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.regionAvailability(craft.locale)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is looking for a row where the &lt;code&gt;regionAvailability&lt;/code&gt; value is equal to &lt;code&gt;craft.locale&lt;/code&gt;. Even if only a single locale is checked, its value would still be &lt;code&gt;[&quot;locale_id&quot;]&lt;/code&gt;, not just &lt;code&gt;locale_id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to fix this just change that parameter to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.regionAvailability('*&quot;'~craft.locale~'&quot;*')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.regionAvailability(&quot;*\&quot;#{craft.locale}\&quot;*&quot;)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(both do the same thing; just pick the one you think is more clear)&lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2016-08-23T11:36:44.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16478" PostTypeId="2" ParentId="7152" CreationDate="2016-08-23T13:32:05.880" Score="1" Body="&lt;p&gt;Just wanted to add to this thread...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on which event you are listening to/watching for in your plugin, you might have to use a different approach to getting the user. For example, the &lt;code&gt;onActivateUser&lt;/code&gt; event won't have a user's session to check just yet. But, you &lt;em&gt;do&lt;/em&gt; have access to the event params...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    ...&#xA;&#xA;    craft()-&amp;gt;on('users.onActivateUser', function (Event $event) {&#xA;        if (craft()-&amp;gt;config-&amp;gt;get('devMode')) {&#xA;        error_log('----- users.onActivateUser called -----');&#xA;    }&#xA;&#xA;    // Get the user.&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($event-&amp;gt;params['user']-&amp;gt;id);&#xA;&#xA;    // Check for user group.&#xA;    if ($user &amp;amp;&amp;amp; $user-&amp;gt;isInGroup('groupHandle')) {&#xA;        // Do stuff..&#xA;    } else {&#xA;        // User does not belong to this group.&#xA;    }&#xA;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-08-23T18:21:11.130" LastActivityDate="2016-08-23T18:21:11.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16479" PostTypeId="2" ParentId="16380" CreationDate="2016-08-23T14:40:02.573" Score="4" Body="&lt;p&gt;At step 5 you basically start working with another person. Their content input is just as important as your code changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you'll need to alter the workflow as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt; flowing in  &quot;Local &lt;strong&gt;&gt;&lt;/strong&gt; Staging &lt;strong&gt;&gt;&lt;/strong&gt; Production&quot; direction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Database&lt;/strong&gt; flowing in &quot;Local &lt;strong&gt;&amp;lt;&lt;/strong&gt; Staging &lt;strong&gt;&amp;lt;&lt;/strong&gt; Production&quot; direction&lt;/p&gt;&#xA;" OwnerUserId="5552" LastActivityDate="2016-08-23T14:40:02.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16481" PostTypeId="2" ParentId="16458" CreationDate="2016-08-23T17:04:10.717" Score="4" Body="&lt;p&gt;The code above was missing a space after not&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.id('not'~entry.id)&lt;/code&gt; should have been &lt;code&gt;.id('not '~entry.id)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one is an easy one to miss and I have done it a million times.&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="130" LastEditDate="2016-08-23T18:45:02.700" LastActivityDate="2016-08-23T18:45:02.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16483" PostTypeId="1" AcceptedAnswerId="16484" CreationDate="2016-08-23T20:36:30.403" Score="3" ViewCount="1354" Body="&lt;p&gt;I'm using WampServer Version 3.0.4 64bit on Windows 10 to run a local dev site. It's been working fine for a few weeks, and I last opened the site about 5 days ago. Today when I go to my site, I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft CMS requires the PHP multibyte string extension in order to run.&#xA;  Please talk to your host/IT department about enabling it on your&#xA;  server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I checked my PHP extensions menu in Wamp, and there is a check mark next to php_mbstring, so it seems to be enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to localhost in my browser to view my Wamp home page, I see the following error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;* ERROR *&lt;/strong&gt; The PHP configuration loaded file is: - should be: c:/wamp64/bin/apache/apache2.4.18/bin/php.ini or&#xA;  c:/wamp64/bin/php/php5.6.19/phpforapache.ini&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is new, but I haven't changed anything in my wamp configuration files since the site was working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full Wamp configuration, in case it's helpful:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/N472N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N472N.png&quot; alt=&quot;Here&amp;#39;s my wamp setup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to both Wamp and Craft, so not sure where the problem lies. Thanks in advance for any help!&lt;/p&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2016-08-24T23:45:23.357" Title="PHP mbstring extension isn't enabled? (WampServer)" Tags="&lt;error-message&gt;&lt;php&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16484" PostTypeId="2" ParentId="16483" CreationDate="2016-08-23T20:40:35.010" Score="2" Body="&lt;p&gt;As these things go, after I posted my question, I clicked &quot;Refresh&quot; in the Wamp menu and now my site works. I'm not sure what changed, especially since I already restarted the entire program several times, but all's well that ends well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Configuration after refreshing:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/2k0Ra.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2k0Ra.png&quot; alt=&quot;new wamp config&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2016-08-24T23:45:23.357" LastActivityDate="2016-08-24T23:45:23.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16485" PostTypeId="1" AcceptedAnswerId="16486" CreationDate="2016-08-24T00:14:31.873" Score="4" ViewCount="92" Body="&lt;p&gt;I changed the language locale to Hungarian, but the translation for the singles looks a bit funny. Is there an easy way to override it with my version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singles are translated to &quot;Egyedülállók&quot; but that 99% of the time here means a single person and not a single something. &lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-08-24T00:51:48.200" Title="Override admin local name" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16486" PostTypeId="2" ParentId="16485" CreationDate="2016-08-24T00:36:11.077" Score="6" Body="&lt;p&gt;You can add your own translations by placing a region-specific translation file in a &lt;code&gt;craft/translations&lt;/code&gt; folder. The filename should be named after your locale and return an array of translations.  In your case this may look like a file named:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/translations/hu.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And within that file, returning an array like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php &#xA;&#xA;return array(&#xA;    &quot;Singles&quot; =&amp;gt; &quot;Something Better than Egyedülállók&quot;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All strings that are identified as translatable in your front-end templates and the Craft Control Panel files, will be checked against these translations when loading a page in your particular locale. Craft's help doc on &lt;a href=&quot;https://craftcms.com/support/static-translations&quot;&gt;Static Translations&lt;/a&gt; discusses what this could look like in your templates.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If the phrase is really off in your language, you may want to reach out to Pixel &amp;amp; Tonic and let them know as well. I believe they welcome recommendations from community members on how language translations can be improved.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-08-24T00:51:48.200" LastActivityDate="2016-08-24T00:51:48.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16487" PostTypeId="1" AcceptedAnswerId="16495" CreationDate="2016-08-24T08:16:03.657" Score="1" ViewCount="99" Body="&lt;p&gt;I am hoping that somebody can help with this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1286/how-to-create-a-simple-widget&quot;&gt;this excellent tutorial&lt;/a&gt; on creating a custom widget in Craft. On completion, I uploaded the plugin to the &lt;code&gt;/craft/plugins/&lt;/code&gt; directory, visited the page at &lt;code&gt;/admin/settings/plugins&lt;/code&gt; and installed the plugin. All fine so far. Then, on returning to the dashboard, I clicked on New Widget, and selected the name of the widget. Following this, a message flashed up saying 'An unknown error occurred.' and little else happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably user error, but if you could point out what I might have done incorrectly, that'd be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Plugin Structure&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin's called &lt;code&gt;Adlister&lt;/code&gt; and the widget's called &lt;code&gt;Alu&lt;/code&gt;, so in &lt;code&gt;/craft/plugins/adlister/&lt;/code&gt; I have two folders ( &lt;code&gt;templates/&lt;/code&gt; and &lt;code&gt;widgets/&lt;/code&gt; ), and a file: &lt;code&gt;AdListerPlugin.php&lt;/code&gt;. Within &lt;code&gt;templates/&lt;/code&gt; is a file: &lt;code&gt;AluWidget.html&lt;/code&gt; and within &lt;code&gt;widgets/&lt;/code&gt; is &lt;code&gt;AdLister_AluWidget.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;File Contents&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;AdListerPlugin.php&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AdListerPlugin extends BasePlugin&#xA;{&#xA;    function getName()&#xA;    {&#xA;         return Craft::t('AdLister');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;        return 'Mark Syred';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;        return 'http://www.sypo.uk';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;AluWidget.html&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Click to perform &amp;lt;a href=&quot;http://example.co.uk/adlister-update.php?numDays=1&quot;&amp;gt;a daily update&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Click to perform &amp;lt;a href=&quot;http://example.co.uk/adlister-update.php?numDays=3&quot;&amp;gt;an update on a Monday&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Click to perform &amp;lt;a href=&quot;http://example.co.uk/adlister-update.php?numDays=7&quot;&amp;gt;a weekly update&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Click to perform &amp;lt;a href=&quot;http://example.co.uk/adlister-update.php?numDays=30&quot;&amp;gt;a monthly update&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;AdLister_AluWidget.php&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Adlister_AluWidget extends BaseWidget&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Adlister Update');&#xA;    }&#xA;&#xA;    public function getBodyHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('adlister/AluWidget');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help that anyone could provide would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this has any bearing, but the version of Craft I'm running is 2.6.2911.&lt;/p&gt;&#xA;" OwnerUserId="4736" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-24T16:33:06.083" Title="'An unknown error occurred.' when trying to add new custom widget" Tags="&lt;plugin-development&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16488" PostTypeId="1" CreationDate="2016-08-24T08:43:24.697" Score="0" ViewCount="1087" Body="&lt;p&gt;I'm new to Craft CMS and would like to getting started, I searched for several hours now but I was not able to find an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I downloaded and copied craft to my htdocs folder, created a database and changed the db access but when I open my page I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in C:\xampp\htdocs\craft\public\index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I have to change the permission of that folder but I have no idea how to do this. Could you help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't change any path, so it is correct and points to the right file but there is only one directory visible in &lt;code&gt;C:\xampp\htdocs\craft\&lt;/code&gt; in my browser&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;my Files looks like this&lt;br&gt;&#xA;&lt;code&gt;htdocs&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;-craft&lt;/code&gt;&lt;br&gt;&lt;br&gt;&#xA;&lt;code&gt;--craft&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---app&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---config&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---plugins&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---storage&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---templates&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---.htaccess&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---web.config&lt;/code&gt;&lt;br&gt;&lt;br&gt;&#xA;&lt;code&gt;--public&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;---index.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-08-26T09:27:23.043" LastActivityDate="2016-08-26T11:38:00.183" Title="XAMPP Windows 10 - Could not find your craft/ folder error" Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16489" PostTypeId="1" AcceptedAnswerId="16490" CreationDate="2016-08-24T09:58:57.117" Score="2" ViewCount="496" Body="&lt;p&gt;I need to order the results of a search query &lt;em&gt;after&lt;/em&gt; I got back the results. The reason to do this is that I want to make different lists on the same page (with the same results) and I dont't want to search over and over again just to reorder te results. Can I do that? So basically I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results =  craft.entries.section('player').search('team:&quot;thenameoftheteam&quot;') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do with this result is:&#xA;loop&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;through the results and order them by &lt;code&gt;playerPosition&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;show the longest player (lengths are in the field &lt;code&gt;playerHeight&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;show the oldest player (birth dates are in the field &lt;code&gt;playerBirth&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I could run this query 3 times and order by a different field each time, but I don't think that's the way to go.&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2016-08-24T10:18:22.097" Title="Order by fields after searching" Tags="&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16490" PostTypeId="2" ParentId="16489" CreationDate="2016-08-24T10:18:22.097" Score="3" Body="&lt;p&gt;Not really feasible without a plugin – fortunately, there's the excellent &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow&quot;&gt;SuperSort&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results =  craft.entries.section('player').search('team:&quot;thenameoftheteam&quot;') %}&#xA;&#xA;{% set resultsByPlayerPosition = entries|supersort('sortAs', '{playerPosition}') %}&#xA;{% set resultsByPlayerHeight = entries|supersort('sortAs', '{playerHeight}') %}&#xA;{% set resultsByPlayerBirth = entries|supersort('sortAs', '{playerBirth}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need the sorted results in the opposite order, you can just apply the &lt;code&gt;|reverse&lt;/code&gt; filter, i.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resultsByPlayerHeight = entries|supersort('sortAs', '{playerHeight}')|reverse %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If e.g. &lt;code&gt;playerPosition&lt;/code&gt; is a relational field (a category, perhaps), you'll need to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resultsByPlayerPosition = entries|supersort('sortAs', '{{ playerPosition.first.title }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-24T10:18:22.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16491" PostTypeId="1" AcceptedAnswerId="16492" CreationDate="2016-08-24T10:35:30.040" Score="4" ViewCount="508" Body="&lt;p&gt;I know Craft gives us access to &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#getTwig-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twigs getTwig template service&lt;/a&gt;; so when I attempt to use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#globals&quot; rel=&quot;nofollow noreferrer&quot;&gt;addGlobal&lt;/a&gt; function like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;addGlobal('var', $var);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;... nothing happens. No errors. I had hoped putting this in my plugins &lt;code&gt;init()&lt;/code&gt; would allow me to call the variable in a twig template like so: &lt;code&gt;{{ var }}&lt;/code&gt;. But that just returns an error.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Variable &amp;quot;var&amp;quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I know of &lt;a href=&quot;https://craftcms.stackexchange.com/a/7088/584&quot;&gt;other methods to define global variables&lt;/a&gt;. I just wondered where I was going wrong with that quick one-liner that doesn't seem to work.&lt;/p&gt;&#xA;&lt;p&gt;Maybe Craft has ommitted it?&lt;/p&gt;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-08-24T11:32:46.323" Title="Does Twigs 'addGlobal' exist in Craft?" Tags="&lt;plugin-development&gt;&lt;variable&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16492" PostTypeId="2" ParentId="16491" CreationDate="2016-08-24T11:02:38.217" Score="7" Body="&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I needed to do a little digging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internally, Craft can actually have multiple instances of &lt;a href=&quot;http://twig.sensiolabs.org/api/master/Twig_Environment.html&quot; rel=&quot;noreferrer&quot;&gt;Twig_Environment&lt;/a&gt; running (a Twig_Environment instance is what you get back by calling &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;getTwig()&lt;/code&gt;). &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/TemplatesService.php#L165&quot; rel=&quot;noreferrer&quot;&gt;Craft caches each instance in a private class variable&lt;/a&gt;, with the template loader classname and a hash of the environment's options making up the cache key. If a Twig_Environment instance doesn't exist for the loader classname and options array you pass to &lt;code&gt;getTwig()&lt;/code&gt; (&lt;code&gt;null&lt;/code&gt; and &lt;code&gt;null&lt;/code&gt;, in your case), Craft will actually create a new Twig_Environment instance and return it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that you're probably not getting back the same Twig_Environment instance that Craft is using to actually render your template – which explains why the call to &lt;code&gt;addGlobal()&lt;/code&gt; works, but the variable is still undefined in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to make sure to pass in the same loader classname and options as Craft does, to make the TemplateService return the same instance. The default here appears to be &lt;code&gt;null&lt;/code&gt; for the loader classname, and &lt;code&gt;['safe_mode' =&amp;gt; false]&lt;/code&gt; for the options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    $var = 'something';&#xA;    $twig = craft()-&amp;gt;templates-&amp;gt;getTwig(null, ['safe_mode' =&amp;gt; false]);&#xA;    $twig-&amp;gt;addGlobal('var', $var);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I don't know if Craft can ever be expected to use different options (or even a different loader) in certain circumstances – e.g. if &lt;code&gt;safe_mode&lt;/code&gt; would ever be &lt;code&gt;true&lt;/code&gt;. In any case, it is &lt;code&gt;false&lt;/code&gt; by default in the TemplatesService &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/TemplatesService.php#L244&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;render()&lt;/code&gt;&lt;/a&gt; method. Hopefully, someone might clear this up further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Anyway – for a less hacky way to add globals to the Twig environment, here's my original answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to &lt;a href=&quot;https://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot; rel=&quot;noreferrer&quot;&gt;create a custom Twig extension&lt;/a&gt;. In your extension class, add a &lt;code&gt;getGlobals()&lt;/code&gt; method, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;use Twig_Extension;  &#xA;use Twig_Filter_Method;&#xA;&#xA;class AwesomeTwigExtension extends \Twig_Extension  &#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return 'Awesome';&#xA;    }&#xA;    public function getGlobals()&#xA;    {&#xA;        $var = 'something';&#xA;        return [&#xA;            'var' =&amp;gt; $var,&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget to actually load your custom extension – in your plugin's primary class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addTwigExtension()&#xA;{&#xA;    Craft::import('plugins.pluginhandle.twigextensions.AwesomeTwigExtension');&#xA;    return new AwesomeTwigExtension();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, adding the globals in a custom extension instead of just using your plugin's primary class' &lt;code&gt;init()&lt;/code&gt; method is a bit more verbose, but remember that you could easily add a method to your plugin's primary class returning the globals and just call that from your extension, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// In your plugin's primary class&#xA;public function getGlobals()&#xA;{&#xA;    $var = ...&#xA;    return [&#xA;        'var' =&amp;gt; $var,&#xA;        ...&#xA;    ];&#xA;}&#xA;&#xA;// In your custom Twig extension&#xA;public function getGlobals()&#xA;{&#xA;    return craft()-&amp;gt;plugins-&amp;gt;getPlugin('pluginHandle')-&amp;gt;getGlobals();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(You could of course also return the globals from a plugin &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;noreferrer&quot;&gt;service&lt;/a&gt;, which would be cleaner).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully somebody else will have an explanation for why the &lt;code&gt;addGlobal()&lt;/code&gt; method doesn't work – and perhaps an even easier solution.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-24T11:32:46.323" LastActivityDate="2016-08-24T11:32:46.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16493" PostTypeId="1" AcceptedAnswerId="16501" CreationDate="2016-08-24T16:00:13.210" Score="0" ViewCount="201" Body="&lt;p&gt;I am trying to validate first name and last name on my user registration form. I have tested and the following works for existing users when updating their profile via the form. Both use the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSaveUser&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this wouldn't validate for registering users?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event)&#xA;    {&#xA;        craft()-&amp;gt;businessLogic_events-&amp;gt;onBeforeSaveUser($event);&#xA;    });&#xA;}&#xA;&#xA;public function onBeforeSaveUser(Event $event)&#xA;{&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    if (empty($user-&amp;gt;firstName))&#xA;    {&#xA;        $user-&amp;gt;addError('firstName', Craft::t('Name cannot be empty.'));&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;&#xA;    if (empty($user-&amp;gt;lastName))&#xA;    {&#xA;        $user-&amp;gt;addError('lastName', Craft::t('Last Name cannot be empty.'));&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="22" LastEditDate="2017-05-09T21:42:13.533" LastActivityDate="2017-05-09T21:42:13.533" Title="onBeforeSaveUser validation for existing user but not new user" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16494" PostTypeId="1" CreationDate="2016-08-24T16:21:39.470" Score="1" ViewCount="263" Body="&lt;p&gt;Does anyone know why &lt;code&gt;currentUser&lt;/code&gt; would return null? I'm logged in as an admin.. actually the only user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've cleared cache, logged out and back in, etc. I can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set an edit link for an entry like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;&#xA;        Edit&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.isEditable() %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}&quot;&amp;gt;&#xA;        Edit&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Neither are working. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2016-08-24T20:26:51.340" Title="currentUser global is null. I can't figure out why" Tags="&lt;templating&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16495" PostTypeId="2" ParentId="16487" CreationDate="2016-08-24T16:33:06.083" Score="2" Body="&lt;p&gt;I feel quite embarrassed, but I have finally got this thing working. The error that I had made was within &lt;code&gt;AdLister_AluWidget.php&lt;/code&gt;. I had written at line 4: &lt;code&gt;class Adlister_AluWidget extends BaseWidget&lt;/code&gt; instead of what it should have been: &lt;code&gt;class AdLister_AluWidget extends BaseWidget&lt;/code&gt;. So, AdLister should have been written with an UPPER-CASE 'L' and not lower-case. If anyone else is struggling, hopefully my error will help them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct code in full:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AdLister_AluWidget extends BaseWidget&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Adlister Update');&#xA;    }&#xA;&#xA;    public function getBodyHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('adlister/AluWidget');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4736" LastActivityDate="2016-08-24T16:33:06.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16496" PostTypeId="1" AcceptedAnswerId="16497" CreationDate="2016-08-24T17:13:58.243" Score="2" ViewCount="452" Body="&lt;p&gt;I'd like to have images in my field instructions, but adding the Markdown code doesn't work, nor does HTML. Is there a way to include images and other HTML within?&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2016-08-24T18:44:31.140" Title="How can I add images to field instructions?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16497" PostTypeId="2" ParentId="16496" CreationDate="2016-08-24T18:44:31.140" Score="5" Body="&lt;p&gt;This works with standard markdown code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;![Alt text](/path/to/image.png)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use either a full URL, or a local path to the image.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-24T18:44:31.140" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16499" PostTypeId="1" AcceptedAnswerId="16505" CreationDate="2016-08-24T19:11:27.210" Score="2" ViewCount="45" Body="&lt;p&gt;Is it possible to display the number of variants a product has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be in order to achieve the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This product is available in &lt;strong&gt;3&lt;/strong&gt; colors&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-08-24T22:26:32.040" Title="Display number of variants as a value" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16500" PostTypeId="2" ParentId="16494" CreationDate="2016-08-24T20:26:51.340" Score="2" Body="&lt;p&gt;Per Brad's request. I am answering my own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured out that I was logging in via non-www, and accessing the site at www.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the official answer is to choose either www or non-www. I chose to remove the www from the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my .htaccess for that, including allowing for fonts to be accessed cross domain, as I had issues with this as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Remove www&#xA;    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;FilesMatch &quot;\.(eot|ttf|otf|woff|svg)&quot;&amp;gt;&#xA;    Header set Access-Control-Allow-Origin &quot;*&quot;&#xA;&amp;lt;/FilesMatch&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note!!!&lt;/strong&gt; Once this is done, make sure to clear your Craft cache., especially if using fonts/font-icons.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2016-08-24T20:26:51.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16501" PostTypeId="2" ParentId="16493" CreationDate="2016-08-24T21:11:23.383" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If you hit the submit button and don't fill out any fields. Then the only errors back are Email and Password (standard and set out by Craft). If you do enter an email and password then my validation code works and it errors again this time with the firstName and lastName errors. But these don't trigger on first submit when all fields are blank.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a known issue (specifically with the &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow&quot;&gt;UserModel&lt;/a&gt; when saving a user) because &quot;First Name&quot; and &quot;Last Name&quot; aren't true fields in Craft, but more special case fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When saving a user, the UserModel validation runs first and immediately bails when the validation error occurs before the &lt;code&gt;onBeforeSaveUser&lt;/code&gt; event fires not giving any plugins a chance to participate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be fixed in the upcoming Craft 3 release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-24T21:11:23.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16502" PostTypeId="1" AcceptedAnswerId="16508" CreationDate="2016-08-24T21:33:29.583" Score="1" ViewCount="46" Body="&lt;p&gt;I have a grid.  The pattern is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;**Row 1**&lt;/code&gt; = &lt;code&gt;1 x featured post&lt;/code&gt; and &lt;code&gt;2 x vertical posts&lt;/code&gt;.  (The feature is the equivalent of 2 vertical posts.) &lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;**Row 2**&lt;/code&gt; = &lt;code&gt;2 x horizontal posts&lt;/code&gt;  &lt;code&gt;Row 2&lt;/code&gt; starts with the &lt;code&gt;4th most recent post&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;**Row 3**&lt;/code&gt; = &lt;code&gt;4 x vertical posts&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;**Rows 4-n**&lt;/code&gt; repeat &lt;code&gt;Row 2&lt;/code&gt; and &lt;code&gt;Row 3&lt;/code&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have experimented with &lt;code&gt;{% if loop.index is divisible by(2) %}stuff{% else %}other-stuff{% endif %}&lt;/code&gt; to switch between the horizontal and vertical alignments.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this is a 2 part question.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do I pull the 2nd and 3rd most recent posts to populate the 2 vertical posts in &lt;code&gt;Row 1&lt;/code&gt;? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am already calling the &lt;code&gt;featured post&lt;/code&gt; using &lt;code&gt;{% for post in craft.entries.section('posts') %}{% if loop.first and craft.request.pageNum == 1 %}&lt;/code&gt;...  &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Next, how do I then tell Craft to populate 2 horizontals in &lt;code&gt;Row 2&lt;/code&gt; and then switch to 4 verticals in &lt;code&gt;Row 3&lt;/code&gt;?   I assume its best to separate step #1 from step #2 which would require &lt;code&gt;Row 2&lt;/code&gt; to start with &lt;code&gt;4th most recent post&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-08-25T00:13:51.347" Title="How do you tell Craft to change post directions from row-to-row?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16503" PostTypeId="2" ParentId="16016" CreationDate="2016-08-24T22:04:28.697" Score="1" Body="&lt;p&gt;I have now found a workaround using the information @brad-bell provided, that is working, but not exactly what I wanted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Normal search #}&#xA;{% set resultsA = craft.entries(search_criteria).ids() %}&#xA;&#xA;{# Assets search #}&#xA;{% set assets = craft.assets.customFieldName('*'~query~'*') %}&#xA;{% set resultsB = craft.entries.relatedTo({&#xA;        targetElement: assets,&#xA;        field: 'customFieldName'&#xA;    }).ids() | without(resultsA) %}&#xA;&#xA;{# Merge results, paginate #}&#xA;{% set results = resultsA | merge(resultsB) %}&#xA;{% paginate results.limit(10) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How I did it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform a &lt;strong&gt;normal&lt;/strong&gt; search for entries containing the &lt;em&gt;query&lt;/em&gt; in one of their fields (specified in search_criteria, not included in the code above) and &lt;strong&gt;get the IDs&lt;/strong&gt; of the found entries.&lt;/li&gt;&#xA;&lt;li&gt;Search for assets that contain the &lt;em&gt;query&lt;/em&gt; in their &lt;em&gt;customField&lt;/em&gt;. Since I'm only searching one field, I do not use the search-function, which would be an option when searching multiple fields.&lt;/li&gt;&#xA;&lt;li&gt;Now I'm getting the entries that are related to the assets. As in step 1, I attain the IDs, ignoring IDs already present in the first set of results, to avoid duplicates &lt;em&gt;(which I found out late are not a problem, since &lt;code&gt;craft.entries&lt;/code&gt; - in point 5 - only returns each entry once)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;I merge both arrays.&lt;/li&gt;&#xA;&lt;li&gt;Get an &lt;em&gt;ElementCriteriaObject&lt;/em&gt; containing all entries with the IDs collected before.&lt;/li&gt;&#xA;&lt;li&gt;I paginate them as usual.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you do not need to paginate, step 5-6 are might be unnecessary. You could simple use &lt;code&gt;find()&lt;/code&gt; instead of &lt;code&gt;ids()&lt;/code&gt; to get arrays which you then could merge. This however will cause duplicates!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Although this code works, it has a few disadvantages:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The results are &lt;strong&gt;ordered by their position in both arrays&lt;/strong&gt;. &lt;em&gt;resultsA&lt;/em&gt; are listed first, followed by &lt;em&gt;resultsB&lt;/em&gt;. In my application I can live with that, since queries fetching many results in assets will usually fetch almost no results in entries and vice versa. I tried to &lt;strong&gt;sort&lt;/strong&gt; and &lt;strong&gt;order&lt;/strong&gt; them by the number of occurrences, however, this did not work using only twig functions. With the help of a simple plugin as host for some php array sorting, ordering of the results could be improved.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt; is not very good, since many queries are necessary. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Idea&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;One idea in my mind was to build a custom MySQL-query, which JOINS the assets fields (combined to a string if there are multiple ones) to the entry's row. However, I was not able to accomplish that. If anyone knows how to do so: Let me know!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2016-08-24T22:04:28.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16504" PostTypeId="1" AcceptedAnswerId="16506" CreationDate="2016-08-24T22:15:20.093" Score="4" ViewCount="213" Body="&lt;p&gt;I would like to set some variables for every entry within a section ('courses'), and then use those variables in loops that are filtering by entry types and categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some simplified markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Required Courses&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for entry in craft.entries.section('courses').type('safsCourse') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ courseName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;h2&amp;gt;Elective Courses&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;h3&amp;gt;At least one agricultural science course&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for entry in craft.entries.relatedTo(65) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ msuLink }}&quot;&amp;gt;{{ courseName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;h3&amp;gt;At least one social science course (3cr)&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for entry in craft.entries.relatedTo(66) %}&#xA;        &amp;lt;li&amp;gt;a href=&quot;{{ msuLink }}&quot;&amp;gt;{{ courseName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I'm using the variables &lt;code&gt;msulink&lt;/code&gt; and &lt;code&gt;courseName&lt;/code&gt;. The code works as intended if I include the following within each &lt;code&gt;{% for entry... %}&lt;/code&gt; block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set courseName = entry.deptCode ~ ' ' ~ entry.courseNumber ~ ': ' ~ entry.title %}&#xA;{% set msuLink = 'https://reg.msu.edu/Courses/Request.aspx?SubjectCode=' ~&#xA;    entry.deptCode ~ '&amp;amp;CourseNumber=' ~ entry.courseNumber ~ '#Results' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't want to set those variables three identical times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I set those variables once and use them when I'm pulling various subsets of my Course section entries?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="1098" LastEditDate="2016-08-25T09:05:45.387" LastActivityDate="2016-08-25T09:05:45.387" Title="Reusing logic to set string variables" Tags="&lt;templating&gt;&lt;structure&gt;&lt;filter&gt;&lt;variable&gt;&lt;index&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16505" PostTypeId="2" ParentId="16499" CreationDate="2016-08-24T22:26:32.040" Score="1" Body="&lt;p&gt;Assuming you've already got the product (which is a &lt;a href=&quot;https://craftcommerce.com/docs/product-model#variants&quot; rel=&quot;nofollow&quot;&gt;ProductModel&lt;/a&gt;) in Twig, it's a simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This product is available in {{ product.variants|length }} colors.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-24T22:26:32.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16506" PostTypeId="2" ParentId="16504" CreationDate="2016-08-24T22:29:10.747" Score="4" Body="&lt;p&gt;I would use &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;macros&lt;/a&gt;. A Twig macro is basically a function, that can take arguments and render HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Macros can be defined inline (i.e. in the same template where it's used) or in a separate file (better if you're writing a generic macro that'll possibly be used in several different templates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how your template could look, using macros:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro courseName(entry) %}&#xA;    {{ entry.deptCode ~ ' ' ~ entry.courseNumber ~ ': ' ~ entry.title }}&#xA;{% endmacro %}&#xA;&#xA;{% macro msuLink(entry) %}&#xA;    {{ 'https://reg.msu.edu/Courses/Request.aspx?SubjectCode=' ~&#xA;entry.deptCode ~ '&amp;amp;CourseNumber=' ~ entry.courseNumber ~ '#Results' }}&#xA;{% endmacro %}&#xA;&#xA;{% import _self as helpers %}&#xA;&#xA;&amp;lt;h2&amp;gt;Required Courses&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('courses').type('safsCourse') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ helpers.courseName(entry) }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;h2&amp;gt;Elective Courses&amp;lt;/h2&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;At least one agricultural science course&amp;lt;/h3&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.relatedTo(65) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ helpers.msuLink(entry) }}&quot;&amp;gt;{{ helpers.courseName(entry) }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're wondering about the &lt;code&gt;{% import _self as helpers %}&lt;/code&gt; directive below the actual macros, the &lt;code&gt;{% import %}&lt;/code&gt; tag is neccessary to actually expose your macros to your template (even if the macros are declared in the same file), and the &quot;helpers&quot; part is just a contextual variable that could be named anything you want (as semantic as possible is always a good thing).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-08-24T22:29:10.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16507" PostTypeId="1" AcceptedAnswerId="16510" CreationDate="2016-08-24T22:37:56.943" Score="1" ViewCount="189" Body="&lt;p&gt;In a project I have a checkbox field called &lt;code&gt;gradeLevels&lt;/code&gt; with 3 options (k-5,6-8, and 9-12). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to design changes, I need to convert this field into a category field. I've made a new category with the same names (k-5,6-8, and 9-12), but I already have data in all of the entries that uses the old checkbox field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I poked around in mysql and listed all the columns in craft_fields table, but I don't see the newly created categories field in the list, or any categories/entries field for that matter. I'm guessing associations are stored in a different manner?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a possible way using mysql to map all the string values in the check box fields into the corresponding category in the categories field?&lt;/p&gt;&#xA;" OwnerUserId="5286" LastActivityDate="2016-08-25T00:12:33.243" Title="map values from checkbox field into category field using SQL" Tags="&lt;categories&gt;&lt;database&gt;&lt;fieldtypes&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16508" PostTypeId="2" ParentId="16502" CreationDate="2016-08-24T23:02:39.863" Score="3" Body="&lt;p&gt;You could do multiple &quot;for&quot; loops on the first craft.entries request using limits and offsets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set posts = craft.entries.section('posts') %}&#xA;&#xA;{# ROW ONE #}&#xA;{% for post in posts.limit(1) %}&#xA;   html stuff for first post&#xA;{% endfor %}&#xA;&#xA;{% for post in posts.limit(2).offset(1) %}&#xA;   html stuff for 2nd and 3rd posts skipping 1&#xA;{% endfor %}&#xA;&#xA;{# ROW TWO #}&#xA;{% for post in posts.limit(2).offset(3) %}&#xA;   html stuff for 4th and 5th posts skipping 3&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the switching back and forth between horizontal and vertical, you can set up a couple of macros and call them where needed(or includes for that matter, lots of ways to skin this cat).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro vertical(url, title) %}&#xA;&amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ url }}&quot; title=&quot;{{ title }}&quot;&amp;gt;{{ title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endmacro %}&#xA;&#xA;{% macro horizontal(url, title) %}{# different html #}&#xA;&amp;lt;div&amp;gt;&#xA;    &amp;lt;h1&amp;gt;{{ title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;Learn More&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then where you need them in the first part of your question above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in posts.limit(2).offset(3) %}&#xA;   {{ _self.vertical(post.url, post.title) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in posts.limit(2).offset(3) %}&#xA;   {{ _self.horizontal(post.url, post.title) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow&quot;&gt;Twig Macros&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mijingo.com/blog/using-macros-in-twig-and-craft&quot; rel=&quot;nofollow&quot;&gt;Using Macros by Mijingo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alternatively with includes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in posts.limit(2).offset(1) %}&#xA;  {% include &quot;_includes/vertical_layout&quot; %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-08-25T00:13:51.347" LastActivityDate="2016-08-25T00:13:51.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16509" PostTypeId="2" ParentId="772" CreationDate="2016-08-24T23:41:42.813" Score="3" Body="&lt;p&gt;You can use twig filters in url structures as mentioned by RhealPoirier in a comment above, no need for a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-section/{type.handle|replace('/(^|[a-z])([A-Z])/', '\\1-\\2')|lower}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-section/{type.name|kebab}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5473" LastActivityDate="2016-08-24T23:41:42.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16510" PostTypeId="2" ParentId="16507" CreationDate="2016-08-25T00:12:33.243" Score="2" Body="&lt;p&gt;FeedMe plugin imports categories, so you could create an xml template file that outputs your entries and their checkbox values(separated by commas), then use FeedMe to import that file back in and map those checkboxes to your categories. They just have to match spelling, otherwise FeedMe will create a new category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow&quot;&gt;FeedMe&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;xml&amp;gt;&#xA;  &amp;lt;blog&amp;gt;&#xA;    {% for entry in entries %}&#xA;      &amp;lt;entry&amp;gt;&#xA;        &amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;{# required for import #}&#xA;        &amp;lt;category&amp;gt;&amp;lt;![CDATA[{% for option in entry.checkboxFieldHandle %}{{ option }}, {% endfor %}]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;      &amp;lt;/entry&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/blog&amp;gt;&#xA; &amp;lt;/xml&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-08-25T00:12:33.243" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16511" PostTypeId="1" AcceptedAnswerId="16514" CreationDate="2016-08-25T00:26:38.640" Score="4" ViewCount="409" Body="&lt;p&gt;I have an entry type (&lt;code&gt;outsideCourse&lt;/code&gt;) that will never need its own page. It only exists so I can manipulate it in various lists of required courses. Thanks to Mats Mikkel Rummelhoff, I have a macro to plug its field attributes into a search URL for another website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another entry type in the same section, &lt;code&gt;safsCourse&lt;/code&gt;, DOES have its own template URL scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to have a mostly blank page show up if someone happens to go to the entry page for one of the &lt;code&gt;outsideCourse&lt;/code&gt; entries (example: &lt;code&gt;localhost/craftcms/courses/ecological-economics&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The options I can think of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Somehow eliminate slugs or URLs for the &lt;code&gt;outsideCourse&lt;/code&gt; entry type, so their URLs go to the 404 page&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.htaccess&lt;/code&gt; redirects&lt;/li&gt;&#xA;&lt;li&gt;A separate template just for this entry type that redirects either to my preferred destination (the &lt;a href=&quot;http://msu.edu&quot; rel=&quot;nofollow&quot;&gt;http://msu.edu&lt;/a&gt; link generated by my macro) or the index page for this section (&lt;code&gt;localhost/craftcms/courses&lt;/code&gt;). &lt;/li&gt;&#xA;&lt;li&gt;One template for both entry types, with a conditional redirect. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've been working on Option 4. I've tried adding the following to the very beginning of my &lt;code&gt;courses/_entry.html&lt;/code&gt; template, before &lt;code&gt;{% extends '_layout' %}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('courses').type('outsideCourse') %}&#xA;     {% import 'partials/_helpers' as helpers %}&#xA;        {% redirect helpers.msuLink(entry) %}&#xA; {% else %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It tries to go to &lt;code&gt;http://localhost/craftcms/%20%20%20%20https://reg.msu.edu/Courses/Request.aspx?SubjectCode=EEP&amp;amp;amp;CourseNumber=260#Results&lt;/code&gt; and gives me a 403 Forbidden error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I replace &lt;code&gt;helpers.msuLink(entry)&lt;/code&gt; with &lt;code&gt;&quot;http://msu.edu&quot;&lt;/code&gt;, it redirects but ignores the conditional. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So here's what I'm wondering:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why isn't the conditional working?&lt;/li&gt;&#xA;&lt;li&gt;How can I add an absolute link to a redirect without just writing a string?&lt;/li&gt;&#xA;&lt;li&gt;Should I be going about this in a different way altogether?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2016-08-25T15:30:06.023" LastActivityDate="2016-08-25T15:30:06.023" Title="Redirect entry type to another domain" Tags="&lt;templating&gt;&lt;routes&gt;&lt;entry-type&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16512" PostTypeId="1" AcceptedAnswerId="16513" CreationDate="2016-08-25T02:05:37.047" Score="2" ViewCount="839" Body="&lt;p&gt;I need to update the value of an entry attribute programatically. I've tried a couple things, but the record is not updated. The code I am using is below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;      $criteria-&amp;gt;section = 'affiliates';          &#xA;      $criteria-&amp;gt;limit = null;&#xA;      $criteria -&amp;gt; search ='email:'.$email;&#xA;      $criteria = $criteria -&amp;gt; first();&#xA;&#xA;      $criteria-&amp;gt;getContent()-&amp;gt;setAttribute(&quot;optOut&quot;, &quot;true&quot;);&#xA;&#xA;      craft()-&amp;gt;entries-&amp;gt;saveEntry($criteria);&#xA;      return $criteria-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="57" LastEditDate="2016-08-25T02:19:51.577" LastActivityDate="2016-08-25T02:30:37.767" Title="Updating an entry record programatically?" Tags="&lt;plugin-development&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16513" PostTypeId="2" ParentId="16512" CreationDate="2016-08-25T02:30:37.767" Score="4" Body="&lt;p&gt;After you call &lt;code&gt;$criteria-&amp;gt;first()&lt;/code&gt;, you no longer have an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;ElementCriteriaModel&lt;/a&gt;, but an actual &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt;, so probably more semantic to change to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'affiliates';          &#xA;$criteria-&amp;gt;limit = null;&#xA;$criteria -&amp;gt; search ='email:'.$email;&#xA;$entry = $criteria-&amp;gt;first();&#xA;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttribute(&quot;optOut&quot;, &quot;true&quot;);&#xA;&#xA;craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;return $entry-&amp;gt;title;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But my guess about your actual problem is you're getting a validation error.  You can verify and guard against that in your code by doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry))&#xA;{&#xA;    return $entry-&amp;gt;title;&#xA;}&#xA;else&#xA;{&#xA;    $errors = $entry-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-25T02:30:37.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16514" PostTypeId="2" ParentId="16511" CreationDate="2016-08-25T09:01:53.490" Score="4" Body="&lt;p&gt;The reason that you get that odd URL with the &lt;a href=&quot;https://craftcms.com/docs/templating/redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% redirect %}&lt;/code&gt;&lt;/a&gt; tag is just because there's some whitespace at the beginning of the value returned from your &lt;code&gt;helpers.msuLink()&lt;/code&gt; macro. Using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/trim.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;|trim&lt;/code&gt;&lt;/a&gt; filter (which removes whitespace from both ends of a string) fixes that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect helpers.msuLink(entry)|trim %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you prefer, you could also modify &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16504/setting-variables-for-nested-filters&quot;&gt;your macro&lt;/a&gt; so it returns the value without whitespace, by using the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/spaceless.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% spaceless %}&lt;/code&gt;&lt;/a&gt; tag – then you don't need the &lt;code&gt;|trim&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro msuLink(entry) %}&#xA;{% spaceless %}&#xA;    {{ 'https://reg.msu.edu/Courses/Request.aspx?SubjectCode=' ~ entry.deptCode ~ '&amp;amp;CourseNumber=' ~ entry.courseNumber ~ '#Results' }}&#xA;{% endspaceless %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the conditional, I don't believe you want the &lt;code&gt;craft.entries&lt;/code&gt; query there – just put the following at the top of your &lt;code&gt;courses/_entry.html&lt;/code&gt; template (note that I'm also putting the &lt;code&gt;{% import %}&lt;/code&gt; statement outside the conditional – it doesn't really matter but its cleaner and shouldn't impact performance):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'partials/_helpers' as helpers %}&#xA;&#xA;{% if entry.type == 'outsideCourse' %}&#xA;    {% redirect helpers.msuLink(entry)|trim %}&#xA;{% endif %}&#xA;&#xA;{# Rest of template below #}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you decide that having the &lt;code&gt;outsideCourse&lt;/code&gt; URLs 404 instead of redirect makes the most sense (I believe it would, and is cleaner, in most cases), the easiest way to achieve that is to put this at the top of your entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'outsideCourse' %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{# Rest of the template below #}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-25T09:01:53.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16515" PostTypeId="1" AcceptedAnswerId="16552" CreationDate="2016-08-25T09:45:10.087" Score="2" ViewCount="436" Body="&lt;p&gt;I recently started learning plugin development for Craft CMS. I'm creating a plugin that deals with video content. For this example I'll use two models: &lt;code&gt;MyPlugin_ChannelModel&lt;/code&gt; and &lt;code&gt;MyPlugin_VideoModel&lt;/code&gt;. I've also setup two record classes that mirror the model's properties (&lt;code&gt;MyPlugin_ChannelRecord&lt;/code&gt; and &lt;code&gt;MyPlugin_VideoRecord&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two record classes have a many to many relationship with each other. So, a channel can have multiple videos and a video can be in multiple channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create, delete and modify records. So far, so good. Now, this next part confuses me. I want to use these records in my templates. Ideally, I'd like to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for video in channel.videos %}&#xA;    {{ video.someProperty }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I think the &quot;rule&quot; is that only services can interact with records. Models should be used in all other parts of a plugin to pass data (like passing data from a service to a template).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since models do not have the relationship properties, I've written some getter methods on those models to help me get to my channels/videos from the opposite end of the relationship. An example for &lt;code&gt;MyPlugin_ChannelModel&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getVideos()&#xA;{&#xA;    if ($this-&amp;gt;_videos === null &amp;amp;&amp;amp; $this-&amp;gt;id !== null)&#xA;    {&#xA;        // Helper method that gets the record for this model&#xA;        $channelRecord = craft()-&amp;gt;myPlugin_helpers-&amp;gt;findRecordForModel($this);&#xA;&#xA;        // Convert each related record back to a model&#xA;        $videoModels = array();&#xA;        foreach ($channelRecord-&amp;gt;videos as $videoRecord) {&#xA;            $videoModel = new MyPlugin_VideoModel($videoRecord);&#xA;            $videoModels[] = $videoModel;&#xA;        }&#xA;&#xA;        $this-&amp;gt;_videos = $videoModels;&#xA;    }&#xA;&#xA;    return $this-&amp;gt;_videos;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's nice that these getter methods automatically map to their corresponding property names (&lt;code&gt;$model-&amp;gt;getVideos()&lt;/code&gt; becomes &lt;code&gt;model.videos&lt;/code&gt; in Twig), but this means I have to write each of these helper methods by hand on all my model classes to get the related models. Am I missing something, is there an easier way?&lt;/p&gt;&#xA;" OwnerUserId="5562" LastEditorUserId="57" LastEditDate="2016-08-25T19:28:12.817" LastActivityDate="2016-08-29T17:08:39.477" Title="Getting related models in templates?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16517" PostTypeId="1" CreationDate="2016-08-25T12:33:45.703" Score="1" ViewCount="118" Body="&lt;p&gt;I want to set a Javascript variable using a Craft variable. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchJs %}&#xA;&#xA;$( &quot;#search&quot; ).keydown(function() {&#xA;&#xA;  var query = document.getElementById('search').value;&#xA;&#xA;  {% set query = craft.request.getParam('q') %}&#xA;  {% set results = craft.weightedSearch.substringSearch(query) %}&#xA;&#xA;  {% if results | length %}&#xA;    {% for entry in results %}&#xA;      console.log( &quot;{{ entry.title }}&quot; );&#xA;    {% endfor %}&#xA;  {% else %}&#xA;    console.log( &quot;Sonuc Bulunamadı&quot; );&#xA;  {% endif %}&#xA;&#xA;  console.log( &quot;{{ query }}&quot; );&#xA;  console.log( query );&#xA;});&#xA;&#xA;{% endset %}&#xA;&#xA;{% includeJs searchJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5060" LastEditorUserId="22" LastEditDate="2017-05-09T21:41:16.863" LastActivityDate="2017-05-09T21:41:16.863" Title="How do I get an input value to dynamically update a Craft query on each keypress?" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16518" PostTypeId="1" CreationDate="2016-08-25T12:44:31.807" Score="0" ViewCount="139" Body="&lt;p&gt;Is there a way to connect one structure entry to multiple structure entries? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GT8jQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GT8jQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(wonderfully drawn image represents the connection of Food Festival to both structure entries)&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-08-25T12:44:31.807" Title="Structure entry connected to multiple parent entries" Tags="&lt;templating&gt;&lt;entries&gt;&lt;structure&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16519" PostTypeId="1" CreationDate="2016-08-25T13:02:41.987" Score="3" ViewCount="408" Body="&lt;p&gt;Under Commerce &gt; Promotions there are the two options: Sales &amp;amp; Discounts. Sales is a flat rate with little conditions, so that leaves Discounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discounts have a bit more flexibility, but only seem to have a minimum quantity option. So, if I want to make a buy one get one free deal, I can't limit it to the quantity to a maximum of 2, therefore the discount gets applied to the total amount regardless of how many are added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else had any success setting up a BOGOF deal or anything similar?&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-11-23T22:53:22.587" Title="How can I set a BOGOF (Buy One, Get One Free) promotion using Craft Commerce?" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16520" PostTypeId="1" AcceptedAnswerId="16551" CreationDate="2016-08-25T13:30:26.283" Score="2" ViewCount="73" Body="&lt;p&gt;Why is &lt;code&gt;LongText&lt;/code&gt; supported but not &lt;code&gt;LongBlob&lt;/code&gt; for Craft records? Is it because of the reliance on Yii? Is there some way I can circumvent that and hard-code that change to the DB, (i.e. changing a field from &lt;code&gt;blob&lt;/code&gt; to &lt;code&gt;longblob&lt;/code&gt;), without having to change any core Craft code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently my field looks like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'data_blob' =&amp;gt;   array(AttributeType::String, 'column' =&amp;gt; ColumnType::Binary),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to have &lt;code&gt;LongBinary&lt;/code&gt; (or &lt;code&gt;longblob&lt;/code&gt; in mysql) as I'm reaching the max length for &lt;code&gt;blob&lt;/code&gt; and my data is getting truncated. &lt;/p&gt;&#xA;" OwnerUserId="4390" LastEditorUserId="4466" LastEditDate="2016-08-25T13:45:48.257" LastActivityDate="2016-08-26T20:54:16.207" Title="Supporting LongBlob / LongBinary in Craft record ColumnType" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16521" PostTypeId="1" AcceptedAnswerId="16538" CreationDate="2016-08-25T14:12:08.827" Score="2" ViewCount="515" Body="&lt;p&gt;Time for my first question. &quot;we have a client...&quot; :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to achieve something like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A visitor (User A) is able to register and create a 'Team' Entry.&lt;/li&gt;&#xA;&lt;li&gt;They then invite new users (Users B, C, D, E etc) to register by adding them to their 'Team' Entry(s)&lt;/li&gt;&#xA;&lt;li&gt;User A then pays for the Teams they have created - I am planning on constructing a &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce 'purchasable'&lt;/a&gt; item for each Team Entry and passing all of the Teams to the Cart for the usual Checkout process...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Challenge 1:&lt;/strong&gt; The client would like payments for a given city to be directed to a specific Payment Gateway i.e. Payments for the Paris Team Entries, should go to a Stripe account which the Paris office has access to and can administrate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a similar way, payments for London team entries, need to go via a different Stripe account which only the London office has access to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;there will be over 13 different cities in various countries by 2017 with more added thereafter&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q&lt;/strong&gt;: How could I extend or override the default Stripe Account in Craft Commerce settings, based on the location of the Event which a Team is registered for? e.g. I could use Stripe API custom fields in the City Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Challenge 2&lt;/strong&gt;: Allowing a user to pay for creating Team entries - I spotted this solution by Mr Kelly from earlier this year: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13192/using-commerce-to-pay-for-posting-entry/13193#13193&quot;&gt;Using Commerce to pay for posting entry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd appreciate any solutions or ideas you might have - thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-08-30T11:31:35.750" Title="Craft Commerce - Purchasables and multiple gateway accounts" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16522" PostTypeId="1" AcceptedAnswerId="16528" CreationDate="2016-08-25T14:40:45.580" Score="4" ViewCount="247" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;EmailService now has Twig render email messages in safe mode.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;-- &lt;a href=&quot;https://craftcms.com/changelog#build2903&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/changelog#build2903&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think this is really a bug as it's intended behaviour, but this is causing me a pretty big issue because my email layout has code in it like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set contactDetails = craft.globals.getSetByHandle('contactDetails') -%}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think safe mode now means that the &lt;code&gt;craft&lt;/code&gt; variable isn't actually available. I can pass it in manually when I'm sending non-standard emails with &lt;code&gt;craft()-&amp;gt;emails-&amp;gt;sendEmail()&lt;/code&gt;, but has anyone found a way around this for the built-in ones like the activation/verification emails?&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-08-25T19:12:02.977" Title="EmailService now has Twig render email messages in safe mode" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16523" PostTypeId="1" CreationDate="2016-08-25T14:44:58.223" Score="0" ViewCount="129" Body="&lt;p&gt;I want to use locales like &lt;code&gt;en-US&lt;/code&gt; instead of &lt;code&gt;en_us&lt;/code&gt;.&#xA;Is there a way to do this other than creating totally new locales?&#xA;Can I set it up at the siteUrl ?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-08-25T17:27:24.860" LastActivityDate="2016-08-25T17:27:24.860" Title="Use en-US instead of en_us locale code" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16524" PostTypeId="1" AcceptedAnswerId="16526" CreationDate="2016-08-25T15:11:08.560" Score="3" ViewCount="62" Body="&lt;p&gt;I have a large dataset of active records (not Craft entries) that I'd like to display in the admin frontend. Yii comes with a widget called CGridView, found here: &lt;code&gt;framework/zii/widgets/grid/CGridView.php&lt;/code&gt;, which would fit the bill perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've discovered that zii is not available in Craft, even though it's built on Yii. Is there an alternative to use in Craft that can provide a paginated grid view of active records or is there a way to include zii without affecting Craft core code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for version 2.6 PRO of Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="5566" LastEditorUserId="4466" LastEditDate="2016-08-26T08:20:13.063" LastActivityDate="2016-08-26T08:20:13.063" Title="Including Zii in Craft CMS" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16525" PostTypeId="2" ParentId="16522" CreationDate="2016-08-25T15:25:42.383" Score="4" Body="&lt;p&gt;OK so it's pretty easy to pass additional variables to the email template using the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#email-onBeforeSendEmail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;email.onBeforeSendEmail&lt;/code&gt;&lt;/a&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('email.onBeforeSendEmail', function(Event $event)&#xA;{&#xA;    $event-&amp;gt;params['variables']['craft'] = new CraftVariable();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although I guess there are security reasons for email templates being rendered in safe mode in the first place so I don't know how much of a good idea this is...&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-08-25T15:25:42.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16526" PostTypeId="2" ParentId="16524" CreationDate="2016-08-25T17:22:05.007" Score="4" Body="&lt;p&gt;Craft 2.x ships with a subset of the Yii framework files with things like zii and Yii widgets stripped out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to utilize them, you'd have to &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;create&lt;/a&gt; a &lt;a href=&quot;http://craftcms.com/docs/plugins&quot; rel=&quot;nofollow&quot;&gt;Craft plugin&lt;/a&gt; and manually include the files that you're looking to use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-25T17:22:05.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16527" PostTypeId="2" ParentId="16523" CreationDate="2016-08-25T17:26:58.673" Score="2" Body="&lt;p&gt;When &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-4-define-your-site-uRLs&quot; rel=&quot;nofollow&quot;&gt;defining&lt;/a&gt; your &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;siteUrl&lt;/a&gt;, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_us' =&amp;gt; 'http://example.com/en-US/',&#xA;        // ...&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-25T17:26:58.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16528" PostTypeId="2" ParentId="16522" CreationDate="2016-08-25T19:12:02.977" Score="3" Body="&lt;p&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#build2916&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2916&lt;/a&gt;, the email fields are no longer ran through Twig's safe mode.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;EmailService no longer has Twig render email messages in safe mode, which was a little heavy-handed and prevented email message templates from accessing global variables and other things.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-25T19:12:02.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16529" PostTypeId="1" AcceptedAnswerId="16536" CreationDate="2016-08-25T19:17:07.713" Score="1" ViewCount="63" Body="&lt;p&gt;I have my general config file set up as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  'localhost' =&amp;gt; array(&#xA;  'devMode' =&amp;gt; true,&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'baseUrl' =&amp;gt; 'http://localhost:8888/path/to/site/'&#xA;  )&#xA; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I have an asset source set up as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;File Base Path: assets/img/general/&#xA;URL: {baseUrl}assets/img/general/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The assets pulled within a template get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;GET http://localhost:8888/path/to/site/%7BbaseUrl%7Dassets/img/headers/image.jpg 404 (Not Found)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've used this format with several other sites before, and haven't had a problem. Does anyone have any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2016-08-26T04:21:50.717" Title="Environmental variable coming back as literal braces" Tags="&lt;templating&gt;&lt;assets&gt;&lt;404&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16531" PostTypeId="1" AcceptedAnswerId="16533" CreationDate="2016-08-25T21:22:18.783" Score="3" ViewCount="180" Body="&lt;p&gt;I am storing a value (number 1-5) in a drop down field and would like to do a calculation based on the numbers filled in.  The only way I could get my calculation to work was to store the number (1-5) in a number field (not a drop down field) so I'm wondering if it's because the drop down content is seen as a string and not an integer. If so, perhaps I need to convert the string to an integer.  Although I have it working with the value (1-5) stored in a number field, I'd like to understand how I could make it work with a drop down.  I saw another post that sounded similar: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/141/how-can-i-convert-a-dropdown-field-value-to-an-integer-within-a-hash&quot;&gt;How can I convert a dropdown field value to an integer within a hash?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my template code that works with my number field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- AORTA --&amp;gt;&#xA;    &amp;lt;!-- Get entries for study type Aorta for logged in sonographer. Filter out any scores that are default zero. --&amp;gt;&#xA;        {% set imageQualityScoreAorta = craft.entries.section('logsQA').logGeneral_statusWorkflow('reviewed').search('logGeneral_studyType:aorta -logReviewer_imageQualityNumberTest:0').relatedTo(&#xA;            { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;        ) %}&#xA;&#xA;    &amp;lt;!-- Get average image quality score IF there are any --&amp;gt;&#xA;        {% if imageQualityScoreAorta|length %}&#xA;            &amp;lt;!-- Set default numbers --&amp;gt;&#xA;            {% set additionAorta = 0 %}&#xA;            {% set countAorta = 0 %}&#xA;&#xA;            &amp;lt;!-- Loop --&amp;gt;&#xA;            {% for entry in imageQualityScoreAorta %}&#xA;                {% set additionAorta = additionAorta + entry.logReviewer_imageQualityNumberTest %}&amp;lt;/td&amp;gt;&#xA;                {% set countAorta = loop.index %}&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;!-- Get average image quality score --&amp;gt;&#xA;            {% set averageValueAorta = (additionAorta / countAorta)|round(1, 'floor') %}&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Current User Total Studies --&amp;gt;&#xA;&amp;lt;table class=&quot;table&quot;&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;Aorta&amp;lt;/th&amp;gt;&#xA;            {% if imageQualityScoreAorta|length %}&#xA;                &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt;{{ averageValueAorta }}&amp;lt;/td&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt;N/A&amp;lt;/td&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-08-25T22:39:09.437" Title="Calculating a score based on a drop down field value" Tags="&lt;drop-down&gt;&lt;number&gt;&lt;integer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16533" PostTypeId="2" ParentId="16531" CreationDate="2016-08-25T22:39:09.437" Score="3" Body="&lt;p&gt;When working with a dropdown in Twig, it's important to remember that you're dealing with an &lt;strong&gt;object&lt;/strong&gt; (not a simple string).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is an object:&#xA;{{ entry.myDropdown }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's easy to forget, however, because Craft works a little magic behind the scenes. There are many objects (including this one) which have an internal &lt;code&gt;__toString&lt;/code&gt; behavior. This is called a &quot;magic method&quot;, because it will automatically convert the value to a string &lt;em&gt;when you use it as a string&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in your case, you're not directly outputting it as a string. You're trying to do math with the object, and the object isn't really sure how to respond to that. So nothing gets converted, and your object remains mathematically useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you'll need to append &lt;code&gt;.value&lt;/code&gt; to your object. This will give you the &lt;strong&gt;selected value&lt;/strong&gt; of your dropdown, in a format that you can use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is the dropdown's selected value:&#xA;{{ entry.myDropdown.value }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-08-25T22:39:09.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16534" PostTypeId="1" AcceptedAnswerId="16555" CreationDate="2016-08-26T01:39:52.790" Score="3" ViewCount="673" Body="&lt;p&gt;I'm attempting to install the &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form plugin&lt;/a&gt;. I believe that I've uploaded the correct folder to the correct location, but it's not showing up in the control panel. I'm relatively new to Craft, so this is the first plugin that I've installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my folder structure: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BLtGY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BLtGY.png&quot; alt=&quot;Plugin Folder Structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1905/why-are-my-plugins-not-showing&quot;&gt;couple&lt;/a&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1536/two-plugins-not-showing-in-cp-after-pushing-to-staging-server/1537#1537&quot;&gt;questions&lt;/a&gt; that indicate that the most common problem is improper capitalization on the plugin folder. However, as you can see, mine is all lower case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building this site on a Linux localhost and I've even gone so far as to &lt;code&gt;chmod 777 plugins -R&lt;/code&gt; just to be sure it's not a permissions issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made sure to clear caches after every change, but no matter what I do I can not get the plugin to show up in the CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else should I look at to diagnose and fix this?&lt;/p&gt;&#xA;" OwnerUserId="3709" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-08-26T23:52:19.453" Title="Plugin not showing up in CP" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16535" PostTypeId="1" AcceptedAnswerId="16542" CreationDate="2016-08-26T02:39:56.487" Score="1" ViewCount="69" Body="&lt;p&gt;I need to reuse logic for 15 entry groupings in a template.  In my non DRY version, I simply changed one word in the variable name to create a new variable and although it works just fine, it's very cumbersome to make changes because if I need to make a logic change, I have to do it for all 15 groupings. I'm wondering if there's a way to create a main variable group where I could specify each variable keyword once and then have that keyword replaced in the code. I found a similar post: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16504/reusing-logic-to-set-string-variables&quot;&gt;Reusing logic to set string variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a sample of the code in non DRY fashion. You'll notice the code is almost identical except for the words &quot;Aorta&quot; and &quot;Cardiac&quot;.  I'm treating each of those words as their respective grouping keyword (the top example in each section shows you were the KEYWORD is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set the variables:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Get study count for logged in sonographer --&amp;gt;&#xA;    {% set entriesLogKEYWORD = craft.entries.section('logsQA').search('logGeneral_studyType:KEYWORD').relatedTo(&#xA;        { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;    ) %}&#xA;    {% set entriesLogAorta = craft.entries.section('logsQA').search('logGeneral_studyType:Aorta').relatedTo(&#xA;        { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;    ) %}&#xA;    {% set entriesLogCardiac = craft.entries.section('logsQA').search('logGeneral_studyType:Cardiac').relatedTo(&#xA;        { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;&#xA;&amp;lt;!-- Starting study count --&amp;gt;&#xA;    {% set startingCountKEYWORD = currentUser.userProfile_startingCountKEYWORD %}&#xA;    {% set startingCountAorta = currentUser.userProfile_startingCountAorta %}&#xA;    {% set startingCountCardiac = currentUser.userProfile_startingCountCardiac %}&#xA;&#xA;&amp;lt;!-- Count logged --&amp;gt;&#xA;    {% set countLogKEYWORD = entriesLogKEYWORD.total %}&#xA;    {% set countLogAorta = entriesLogAorta.total %}&#xA;    {% set countLogCardiac = entriesLogCardiac.total %}&#xA;&#xA;&amp;lt;!-- Count total --&amp;gt;&#xA;    {% set countTotalKEYWORD = countLogKEYWORD + startingCountKEYWORD %}    &#xA;    {% set countTotalAorta = countLogAorta + startingCountAorta %}&#xA;    {% set countTotalCardiac = countLogCardiac + startingCountCardiac %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output to front end:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table class=&quot;table&quot;&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;KEYWORD&amp;lt;/th&amp;gt;&#xA;            &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt; {{ countTotalKEYWORD }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;Aorta&amp;lt;/th&amp;gt;&#xA;            &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt;{{ countTotalAorta }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;Cardiac&amp;lt;/th&amp;gt;&#xA;            &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt;{{ countTotalCardiac }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Possible to set the keyword variable and then call it elsewhere like this so template would look something like this where I'd only be writing the logic code once?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set KEYWORD = &quot;Aorta %}&#xA;{% set KEYWORD = &quot;Cardiac&quot; %}&#xA;etc...&#xA;&#xA;&amp;lt;!-- Get study count for logged in sonographer --&amp;gt;&#xA;    {% set entriesLogKEYWORD = craft.entries.section('logsQA').search('logGeneral_studyType:KEYWORD').relatedTo(&#xA;        { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;    ) %}&#xA;&#xA;&amp;lt;!-- Starting study count --&amp;gt;&#xA;    {% set startingCountKEYWORD = currentUser.userProfile_startingCountKEYWORD %}&#xA;&#xA;&amp;lt;!-- Count logged --&amp;gt;&#xA;    {% set countLogKEYWORD = entriesLogKEYWORD.total %}&#xA;&#xA;&amp;lt;!-- Count total --&amp;gt;&#xA;    {% set countTotalKEYWORD = countLogKEYWORD + startingCountKEYWORD %}&#xA;&#xA;&amp;lt;!-- OUTPUT --&amp;gt;&#xA;&amp;lt;table class=&quot;table&quot;&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;        &amp;lt;!-- Loop through all keyword groups? --&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;KEYWORD&amp;lt;/th&amp;gt;&#xA;            &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt; {{ countTotalKEYWORD }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;!-- END Loop --&amp;gt;&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-08-26T15:36:01.093" Title="Reusing logic by setting different keywords to create new variables" Tags="&lt;templating&gt;&lt;variable&gt;&lt;logic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16536" PostTypeId="2" ParentId="16529" CreationDate="2016-08-26T04:21:50.717" Score="2" Body="&lt;p&gt;Your &lt;code&gt;config/general.php&lt;/code&gt; file code has some problem with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're missing a closing &lt;code&gt;)&lt;/code&gt; for an array, which I suspect is a typo, but the issue to your real problem is probably the fact you're missing the required &lt;code&gt;'*'&lt;/code&gt; key for multi-environment configs to work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the first warning note on this page: &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-26T04:21:50.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16537" PostTypeId="2" ParentId="13074" CreationDate="2016-08-26T04:56:35.353" Score="2" Body="&lt;p&gt;I had the same problem, changing &lt;code&gt;post_max_size&lt;/code&gt; in &lt;code&gt;php.ini&lt;/code&gt; to something other than 0 (I used 8M) did it for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why this works: &lt;code&gt;php.ini&lt;/code&gt; says a value of 0 should disable the limit altogether, and this was never an issue on my other Craft installs. Perhaps a bug?&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2016-08-26T04:56:35.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16538" PostTypeId="2" ParentId="16521" CreationDate="2016-08-26T07:07:29.937" Score="2" Body="&lt;p&gt;You wouldn't need to dynamically change the Stripe credentials on the Stripe payment method, rather it is more likely you would set up a seperate Stripe payment method for each Stripe account. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a little known feature that you can set up more than one payment method per gateway with different credentials. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then hard code the payment method ID to the relevant teams payment screen (or set it on the cart before they get to the payment page). You could even store the payment method ID in that teams entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps for the initial question.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="4466" LastEditDate="2016-08-26T09:45:52.410" LastActivityDate="2016-08-26T09:45:52.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16539" PostTypeId="2" ParentId="16378" CreationDate="2016-08-26T07:37:58.287" Score="3" Body="&lt;p&gt;Brandon answered this in a github issue &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI/issues/4&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ElementAPI/issues/4&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do that by setting your endpoint config to an anonymous function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'my/endpoint/pattern' =&amp;gt; function() {&#xA;    HeaderHelper::setHeader([&#xA;        'Access-Control-Allow-Origin' =&amp;gt; 'http://example.com'&#xA;    ]);&#xA;&#xA;    return [&#xA;        // ...&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="195" LastActivityDate="2016-08-26T07:37:58.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16540" PostTypeId="1" CreationDate="2016-08-26T10:16:07.943" Score="0" ViewCount="108" Body="&lt;p&gt;I have a little issue with Redactor. Whenever I have a link within a link: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;#&quot;&amp;gt;main link &amp;lt;a href=&quot;#&quot;&amp;gt;link within link&amp;lt;/a&amp;gt; &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Redactor automatically modifies it to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;#&quot;&amp;gt;main link&amp;lt;/a&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt;link within link&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to stop this auto-modification?&lt;/p&gt;&#xA;" OwnerUserId="5569" LastEditorUserId="45" LastEditDate="2016-08-27T22:17:45.180" LastActivityDate="2016-08-30T10:44:56.253" Title="Redactor splitting nested &lt;a&gt; tags" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16541" PostTypeId="2" ParentId="16540" CreationDate="2016-08-26T10:45:16.063" Score="6" Body="&lt;p&gt;The template engine (&lt;a href=&quot;http://twig.sensiolabs.org/&quot; rel=&quot;nofollow&quot;&gt;Twig&lt;/a&gt;) doesn't do anything like that – my guess is that the links only &lt;em&gt;appear&lt;/em&gt; to render like your second example, because you're looking at the markup in your browser's dev tools, and modern browsers (e.g. Chrome) do a pretty good job of rendering invalid HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the raw source code (i.e. &quot;View source&quot; in your browser), and I suspect the actual rendered HTML will look exactly like your first example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, nesting &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags is not allowed and a very bad idea – so I'd recommend not doing it all :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-08-26T15:40:36.543" LastActivityDate="2016-08-26T15:40:36.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16542" PostTypeId="2" ParentId="16535" CreationDate="2016-08-26T11:03:38.800" Score="1" Body="&lt;p&gt;If you use brackets notation instead of the usual dot notation to access your different properties, you can &lt;a href=&quot;https://stackoverflow.com/questions/10470328/how-to-combine-two-string-in-twig&quot;&gt;append&lt;/a&gt; a &lt;code&gt;keyword&lt;/code&gt; variable to the property handle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startingCount = currentUser['userProfile_startingCount'~keyword] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, you can use the &lt;code&gt;~&lt;/code&gt; operator to append a keyword to your &lt;code&gt;craft.entries&lt;/code&gt; &lt;code&gt;.search()&lt;/code&gt; parameter as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesLog = craft.entries.section('logsQA').search('logGeneral_studyType:'~keyword) ... %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So with that in mind, it'd probably make sense to create a simple array with your keywords, and just loop over them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table class=&quot;table&quot;&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;&#xA;        {% set keywords = ['Aorta', 'Cardiac'] %}&#xA;&#xA;        &amp;lt;!-- Loop through all keyword groups --&amp;gt;    &#xA;        {% for keyword in keywords %}&#xA;&#xA;            &amp;lt;!-- Get study count for logged in sonographer --&amp;gt;&#xA;            {% set entriesLog = craft.entries.section('logsQA').search('logGeneral_studyType:'~keyword).relatedTo(&#xA;    { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;) %}&#xA;&#xA;            &amp;lt;!-- Starting study count --&amp;gt;&#xA;            {% set startingCount = currentUser['userProfile_startingCount'~keyword]|default(0) %}&#xA;&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td class=&quot;c-font-uppercase c-font-bold&quot; scope=&quot;row&quot;&amp;gt;{{ keyword }}&amp;lt;/th&amp;gt;&#xA;                &amp;lt;td class=&quot;c-center c-font-bold&quot;&amp;gt;{{ entriesLog.total() + startingCount }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;        &amp;lt;!-- END Loop --&amp;gt;&#xA;&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: I've omitted the &lt;code&gt;countLog&lt;/code&gt; and &lt;code&gt;countTotal&lt;/code&gt; variables completely in the above example; unless those two variables are going to be re-used, in this case its perfectly fine to just add up &lt;code&gt;entriesLog.total() + startingCount&lt;/code&gt; when you echo the value, saving a few lines of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that I've added a &lt;code&gt;|default(0)&lt;/code&gt; to the &lt;code&gt;startingCount&lt;/code&gt; variable, just in case the &lt;code&gt;'userProfile_startingCount'~keyword&lt;/code&gt; property doesn't exist for &lt;code&gt;currentUser&lt;/code&gt; (in which case you'd probably get a template error).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-08-26T11:03:38.800" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16543" PostTypeId="1" AcceptedAnswerId="16545" CreationDate="2016-08-26T11:36:21.440" Score="1" ViewCount="73" Body="&lt;p&gt;I have a structure which is  basically categories of Downloads.&#xA;In each Entry there is an &quot;Files&quot; field where multiple assets can be selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JbiFy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JbiFy.png&quot; alt=&quot;Downloads&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a Summary page I want to display the latest assets added.&#xA;How can I pull these? &lt;/p&gt;&#xA;" OwnerUserId="622" LastEditorUserId="4466" LastEditDate="2016-08-26T12:00:33.883" LastActivityDate="2016-08-26T12:00:33.883" Title="Get latest assets added to structure" Tags="&lt;entries&gt;&lt;assets&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16544" PostTypeId="2" ParentId="16488" CreationDate="2016-08-26T11:38:00.183" Score="1" Body="&lt;p&gt;I believe the problem is that you've got craft within htdocs, so your web server is trying to run craft from the root, instead of where it should be, &lt;code&gt;/public&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate, this is where htdocs &lt;em&gt;should&lt;/em&gt; be. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-craft&#xA;&#xA;--craft&#xA;---app&#xA;---config&#xA;---plugins&#xA;---storage&#xA;---templates&#xA;---.htaccess&#xA;---web.config&#xA;&#xA;--public &amp;lt;- htdocs&#xA;---index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suggest, to test, that you change the httpd.conf to make apache run from the public folder rather than the pre-made htdocs folder xampp has given you. Go into the xampp config, click on &lt;code&gt;httpd.conf&lt;/code&gt; and change the following lines:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SmTPd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SmTPd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;DocumentRoot &quot;your\path\to\htdocs\craft\public&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;Directory &quot;your\path\to\htdocs\craft\public&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Restart your server, and you should be golden. On windows, you shouldn't have any permission issues with folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, here is what my lines look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DocumentRoot &quot;D:\Documents\work\bud\public&quot;&#xA;&amp;lt;Directory &quot;D:\Documents\work\bud\public&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd avoid just dumping the code in the pre-made htdocs folder provided and just route your httpd.conf to wherever your codebase is. &lt;/p&gt;&#xA;" OwnerUserId="4390" LastActivityDate="2016-08-26T11:38:00.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16545" PostTypeId="2" ParentId="16543" CreationDate="2016-08-26T11:59:58.070" Score="1" Body="&lt;p&gt;It's as simple as passing &lt;code&gt;dateCreated&lt;/code&gt; into the &lt;code&gt;order&lt;/code&gt; parameter, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set downloads = entry.files.order( 'dateCreated desc' ) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're showing these from multiple entries you'd need to get all assets that relate to those entries and then order them as above. Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set downloads = craft.assets.relatedTo( entries ).order( 'dateCreated desc' ) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-08-26T11:59:58.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16547" PostTypeId="2" ParentId="4431" CreationDate="2016-08-26T14:37:50.630" Score="1" Body="&lt;p&gt;I had the same problem and all PHP settings were set OK. I couldn't upload a 2MB file, but uploading a 20KB file was fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem was that the &lt;code&gt;/tmp&lt;/code&gt; folder was almost completely full (because PHP stores the temporary file in &lt;code&gt;/tmp&lt;/code&gt; before moving it to web/user space i.e. your assets folder). Freeing up space in this folder solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="3382" LastActivityDate="2016-08-26T14:37:50.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16548" PostTypeId="1" AcceptedAnswerId="16550" CreationDate="2016-08-26T14:48:21.813" Score="1" ViewCount="384" Body="&lt;p&gt;We've got a site with a navigation on top, which navigates to anchorpoints on the page, but the whole page is built with 1 matrix. The page will probably be very long and will have all kinds of images (small &amp;amp; big) in it. I've set image transforms, so images won't be a problem.&#xA;BUT: is it possible to speed up the site with lazyloading or something like that when there's 100+ matrix elements in it? &#xA;And on that note I guess the biggest problem we'll face is having the anchor points still working: if they click the anchorpoint they should be able to scroll to that point, even if it's not visible yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-08-26T19:02:44.260" LastActivityDate="2016-08-26T19:14:34.757" Title="Speeding up the pageload of a page with a huge Matrix" Tags="&lt;matrix&gt;&lt;speed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16549" PostTypeId="2" ParentId="14290" CreationDate="2016-08-26T15:02:26.453" Score="3" Body="&lt;p&gt;I needed to add the country values to the array so used &lt;a href=&quot;https://craftcms.stackexchange.com/a/14293/4466&quot;&gt;Brad's answer&lt;/a&gt; to come up with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countryList = [{'77':'United Kingdom'},{'233':'United States'}] %}&#xA;{% for key, country in craft.commerce.countriesList %}&#xA;  {% if country != 'United Kingdom' and country != 'United States' %}&#xA;    {% set key_string = key|json_encode() %}&#xA;    {% set countryList = countryList|merge([{(key_string):country}]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above builds the array of countries with their values. The below is the code to loop over the array and fill a &lt;code&gt;select&lt;/code&gt; menu with their values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select&amp;gt;&#xA;  {% for country in countryList %}&#xA;    {% for key, option in country %}&#xA;      {% set optionValue = (model ? model.countryId : '') %}&#xA;      &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-08-26T15:02:26.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16550" PostTypeId="2" ParentId="16548" CreationDate="2016-08-26T19:14:34.757" Score="3" Body="&lt;p&gt;Kind of a broad topic, but here are some resources to get your started:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Great article on Craft optimizations here: &lt;a href=&quot;http://www.patpohler.com/performance-optimization-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;http://www.patpohler.com/performance-optimization-craft-cms/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Make sure your environment isn't a bottleneck.&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You're not on an overloaded shared hosting server.&lt;/li&gt;&#xA;&lt;li&gt;PHP has plenty of memory allocated to it.&lt;/li&gt;&#xA;&lt;li&gt;Your server has plenty of resources (memory, CPU, disk space).&lt;/li&gt;&#xA;&lt;li&gt;Run PHP 7.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Eager load elements as necessary: &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Judiciously use template caching in Craft where necessary: &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Enable devMode and review the profile output in the browser's console (as well as &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files to spot any bottlenecks (# of queries, types of queries, plugins involved, etc.)&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow&quot;&gt;template hooks&lt;/a&gt; as necessary.&lt;/li&gt;&#xA;&lt;li&gt;Go through the plethora of client side things that can slow a page down. &lt;a href=&quot;https://developers.google.com/speed/pagespeed/insights/&quot; rel=&quot;nofollow&quot;&gt;Google Pagespeed Insights&lt;/a&gt; is a good place to start for that.&lt;/li&gt;&#xA;&lt;li&gt;If none of these work, you can looking into changing your content architecture so that 100+ Matrix blocks on one page aren't necessary.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-26T19:14:34.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16551" PostTypeId="2" ParentId="16520" CreationDate="2016-08-26T20:54:16.207" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is LongText supported but not LongBlob for Craft records?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Support, mainly... and there hasn't been a demand for it (you're the first to ask that I'm aware of).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently Craft's PHP based database backup logic chokes on MySQL datatypes that can't be represented as textual data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the upcoming Craft 3, we've done away with the AttributeType magic and you've got more direct/exact control over how your want your schema to be defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also plan on updating the backup logic to be able to handle non-textual datatypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, if you want this in Craft 2, you'll have to move that attribute/column out of an &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow&quot;&gt;Active Record&lt;/a&gt;, create it with a &lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;migration&lt;/a&gt; and have your service layer use &lt;a href=&quot;https://craftcms.com/classreference/etc/db/DbCommand&quot; rel=&quot;nofollow&quot;&gt;DbCommand&lt;/a&gt; to interact with it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-26T20:54:16.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16552" PostTypeId="2" ParentId="16515" CreationDate="2016-08-26T21:13:54.880" Score="2" Body="&lt;p&gt;I would move that logic out of your model class and into a service method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your model could still have a thin wrapper for it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getVideos()&#xA;{&#xA;    return craft()-&amp;gt;myPluginVideoService-&amp;gt;getVideosByChannelId($this-&amp;gt;id);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your plugin's video service would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getVideosByChannelId($channelId)&#xA;{&#xA;    // Can memoize by channelId if this will be called frequently&#xA;&#xA;    $result = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('*')&#xA;        -&amp;gt;from('myVideoTable')&#xA;        -&amp;gt;where('channelId = :channelId', array(':channelId' =&amp;gt; $channelId))&#xA;        -&amp;gt;queryAll();&#xA;&#xA;    if ($result)&#xA;    {&#xA;        return MyPlugin_VideoModel::populateModels($result);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The benefits are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Less cruft in your models, which should (as much as possible) be used as data transport objects&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're not leaking records out of your service layer (like your original model was doing)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're building a consistent API at your service layer that any other classes (other models, other template variables, other services, other plugins, etc.) can go through.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But essentially you're correct. You'll need to write methods to expose the relationships you're looking for to the templates.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what is the reason you use the direct database API, in stead of the &lt;code&gt;Record::model()-&amp;gt;findAllByPk($pksArray)&lt;/code&gt; method?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Habit. Active records, while convenient for simple use-cases, have performance overhead associated with them, so usually I just default to DbCommand.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-08-29T17:08:39.477" LastActivityDate="2016-08-29T17:08:39.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16553" PostTypeId="1" AcceptedAnswerId="16556" CreationDate="2016-08-26T21:14:14.113" Score="2" ViewCount="1416" Body="&lt;p&gt;I have entries which contain a drop down list of items that I need to run calculations on. In my template, I am filtering the entries by the drop down field so I can get the sum total of the entries that meet the criteria and then run calculations based on that.  I am running into a &quot;&lt;strong&gt;Division by zero&lt;/strong&gt;&quot; error when I try to output some calculations. I believe I'm getting that error because there are no results for some of my entries (meaning an item in the drop down list was not selected in any of the entries). I believe I need to add &lt;code&gt;|default(0)&lt;/code&gt; so that if the entry search turns up with no results then the number 0 is used in the calculation for that result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please refer below for the simplified version of my code. I'll pull one area out as an example. If there are no results for &lt;code&gt;entriesLogInterpretationTrueNegative&lt;/code&gt; then I get the &quot;&lt;strong&gt;Division by zero&lt;/strong&gt;&quot; error. In this example, there are no entries in the database where &quot;True Negative&quot; is selected in the drop down menu.  I believe I need to say that if there are no results then use &quot;0&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table id=&quot;&quot; class=&quot;table table-striped table-bordered table-hover&quot;&amp;gt;&#xA;    &amp;lt;thead&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;th class=&quot;c-center c-font-sbold&quot;&amp;gt;Sensitivity&amp;lt;/th&amp;gt;&#xA;            &amp;lt;th class=&quot;c-center c-font-sbold&quot;&amp;gt;Specificity&amp;lt;/th&amp;gt;&#xA;            &amp;lt;th class=&quot;c-center c-font-sbold&quot;&amp;gt;Accuracy&amp;lt;/th&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;/thead&amp;gt;&#xA;&#xA;    &amp;lt;tbody&amp;gt;&#xA;&#xA;        &amp;lt;!-- Loop through all study type groups. (Global Variable set in Base Layout). --&amp;gt;    &#xA;        {% for keywordStudyType in GVstudyTypeGroup %}&#xA;&#xA;            &amp;lt;!-- Get count total for result for logged in sonographer. --&amp;gt;&#xA;            {% set entriesLogInterpretationTruePositive = craft.entries.section('logsQA').logGeneral_statusWorkflow('reviewed').search('logReviewer_interpretation:truePositive -logReviewer_interpretation:0 logGeneral_studyType:'~keywordStudyType).relatedTo(&#xA;                { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;            ).total() %}&#xA;&#xA;            {% set entriesLogInterpretationTrueNegative = craft.entries.section('logsQA').logGeneral_statusWorkflow('reviewed').search('logReviewer_interpretation:trueNegative -logReviewer_interpretation:0 logGeneral_studyType:'~keywordStudyType).relatedTo(&#xA;                { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;            ).total() %}&#xA;&#xA;            {% set entriesLogInterpretationFalsePositive = craft.entries.section('logsQA').logGeneral_statusWorkflow('reviewed').search('logReviewer_interpretation:falsePositive -logReviewer_interpretation:0 logGeneral_studyType:'~keywordStudyType).relatedTo(&#xA;                { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;            ).total() %}&#xA;&#xA;            {% set entriesLogInterpretationFalseNegative = craft.entries.section('logsQA').logGeneral_statusWorkflow('reviewed').search('logReviewer_interpretation:falseNegative -logReviewer_interpretation:0 logGeneral_studyType:'~keywordStudyType).relatedTo(&#xA;                { targetElement: currentUser, field: 'logGeneral_sonographerName' }&#xA;            ).total() %}&#xA;&#xA;            &amp;lt;!-- Get interpretation score. --&amp;gt;&#xA;            {% set interpretationSensitivity = entriesLogInterpretationTruePositive / (entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative) %}&#xA;            {% set interpretationSpecificity = entriesLogInterpretationTrueNegative / (entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive) %}&#xA;            {% set interpretationAccuracy = (entriesLogInterpretationTruePositiveAorta + entriesLogInterpretationTrueNegative) / (entriesLogInterpretationTruePositive + entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive + entriesLogInterpretationFalseNegative) %}&#xA;&#xA;&#xA;            &amp;lt;!-- Table Rows --&amp;gt;&#xA;            &amp;lt;tr&amp;gt;&#xA;                &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationSensitivity|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationSpecificity|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationAccuracy|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/tbody&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-08-27T16:26:08.663" Title="Division by zero error as a result of calculation" Tags="&lt;templating&gt;&lt;filter&gt;&lt;logic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16554" PostTypeId="2" ParentId="16553" CreationDate="2016-08-26T21:30:12.083" Score="1" Body="&lt;p&gt;Calling &lt;code&gt;total()&lt;/code&gt; is already going to return a 0 if no results are found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe you've just got a math problem.  In your denominators, the sums of either:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entriesLogInterpretationTruePositive + entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive + entriesLogInterpretationFalseNegative&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;are returning 0 calling the division to fail (since you can't divide by 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what the actual number you're trying to calculate here it, but you can guard against dividing by 0 with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set denominator = entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative %}&#xA;&#xA;{% if denominator &amp;gt; 0 %}&#xA;    {% set interpretationSensitivity = entriesLogInterpretationTruePositive / denominator %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-26T21:30:12.083" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16555" PostTypeId="2" ParentId="16534" CreationDate="2016-08-26T23:52:19.453" Score="4" Body="&lt;p&gt;Well, I deleted the whole contactform folder, downloaded it again, and added it back to the plugins folder. Just to be safe, I ran service httpd restart. After that, it showed up immediately. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't be sure, but I'm assuming that there was just something wrong with the originally downloaded files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps someone else in the future.&lt;/p&gt;&#xA;" OwnerUserId="3709" LastActivityDate="2016-08-26T23:52:19.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16556" PostTypeId="2" ParentId="16553" CreationDate="2016-08-27T00:57:21.860" Score="1" Body="&lt;p&gt;Turns out my code was correct.  My problem was that the test data I had entered in my Interpretation field just happened to calculate where the denominator was &quot;0&quot; which was causing a mathematical error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I ended up doing was checking to make sure the denominators sum were greater than 0. If they were then run the calculation code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Prevent Division by zero error --&amp;gt;&#xA;{% if (entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative &amp;gt; 0) and (entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive &amp;gt; 0) %}&#xA;&#xA;    &amp;lt;!-- Get interpretation score. --&amp;gt;&#xA;    {% set interpretationSensitivity = entriesLogInterpretationTruePositive / (entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative) %}&#xA;    {% set interpretationSpecificity = entriesLogInterpretationTrueNegative / (entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive) %}&#xA;    {% set interpretationAccuracy = (entriesLogInterpretationTruePositiveAorta + entriesLogInterpretationTrueNegative) / (entriesLogInterpretationTruePositive + entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive + entriesLogInterpretationFalseNegative) %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output section:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;!-- Table Rows --&amp;gt;&#xA;    &amp;lt;!-- Prevent Division by zero error --&amp;gt;&#xA;    {% if (entriesLogInterpretationTruePositive + entriesLogInterpretationFalseNegative &amp;gt; 0) and (entriesLogInterpretationTrueNegative + entriesLogInterpretationFalsePositive &amp;gt; 0) %}&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationSensitivity|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationSpecificity|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;{{ interpretationAccuracy|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;N/A&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;N/A&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;c-center&quot;&amp;gt;N/A&amp;lt;/td&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="3418" LastEditDate="2016-08-27T16:26:08.663" LastActivityDate="2016-08-27T16:26:08.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16558" PostTypeId="1" AcceptedAnswerId="16562" CreationDate="2016-08-27T17:29:06.337" Score="0" ViewCount="95" Body="&lt;p&gt;I've got a calendar template set up and would like to have &lt;a href=&quot;http://domain.com/calendar&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/calendar&lt;/a&gt; redirect to &lt;a href=&quot;http://domain.com/calendar/current_year/current_month&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/calendar/current_year/current_month&lt;/a&gt; but am having trouble getting this to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segment(2) == &quot;&quot; %}&#xA;  {% redirect &quot;calendar/{{ now.year }}/{{ now.month }}&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this ends up going to a 404 with this url:&#xA;&lt;a href=&quot;http://domain.com/calendar/%7B%7B%20now.year%20%7D%7D/%7B%20now.month%20%7D/&quot; rel=&quot;nofollow&quot;&gt;http://domain.com/calendar/%7B%7B%20now.year%20%7D%7D/%7B%20now.month%20%7D/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-08-27T18:45:03.093" Title="Redirect to url based on current year/month" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16559" PostTypeId="1" AcceptedAnswerId="16561" CreationDate="2016-08-27T17:53:49.077" Score="1" ViewCount="279" Body="&lt;p&gt;I've got a list of entries grouped by year which is working correctly except that the months are being output in the the reverse order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code outputs the years in the correct order but the months in reverse order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# all entries sorted by year/month #}&#xA;     {% set allEntries = craft.entries.section('photoblog').limit(null).order('postDate desc') %}&#xA;&#xA;  {% for year, entriesInYear in allEntries | group(&quot;postDate.year&quot;) %}&#xA;      &amp;lt;div class=&quot;col-sm-3 col-xs-6&quot; data-mh=&quot;years&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ year }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;        {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot; ) %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/calendar/{{ year }}/{{ month|date('m') }}&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change the '''.order('postDate desc') to asc then the months are in the correct order but the years are reversed. is there a way to get it so that the years are descending but the months are ascending?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;screenshot of current code results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qzz8b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qzz8b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-08-27T18:40:11.460" Title="Yearly/Monthy archive listing sorted by month" Tags="&lt;templating&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16561" PostTypeId="2" ParentId="16559" CreationDate="2016-08-27T18:40:11.460" Score="3" Body="&lt;p&gt;Add the &lt;code&gt;reverse&lt;/code&gt; filter to your inner array of entries in month.&lt;br&gt;&#xA;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/reverse.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/filters/reverse.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-08-27T18:40:11.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16562" PostTypeId="2" ParentId="16558" CreationDate="2016-08-27T18:45:03.093" Score="2" Body="&lt;p&gt;You never use &lt;code&gt;{{&lt;/code&gt; echo tags within other Twig tags. What you have to do instead is to use string concatenation.&lt;br&gt;&#xA;&lt;code&gt;{% redirect &quot;calendar/&quot; ~ now.year ~ &quot;/&quot; ~ now.month %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-08-27T18:45:03.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16563" PostTypeId="1" AcceptedAnswerId="35126" CreationDate="2016-08-28T21:14:00.233" Score="2" ViewCount="1321" Body="&lt;p&gt;I have a website where by default I would like all external links to have the &quot;open in a new tab&quot; option to be selected by default. I'm wondering if this is possible either through craft or redactor? I came across &lt;a href=&quot;https://github.com/fruitstudios/LinkIt&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; but think it may be overkill so I'm wondering if its possible without a plugin. &lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="2158" LastEditDate="2016-08-30T08:30:49.683" LastActivityDate="2020-04-16T15:28:58.593" Title="Is it possible to make links open in a new tab by default?" Tags="&lt;redactor&gt;&lt;link&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16564" PostTypeId="2" ParentId="16563" CreationDate="2016-08-29T00:19:31.517" Score="6" Body="&lt;p&gt;Merits of doing this aside, I agree that JS is probably the easiest way to go here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code adds &lt;code&gt;target=&quot;_blank&quot;&lt;/code&gt; to all external links. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Make sure any offsite links (non js/mailtos) open in a new window&#xA;// from https://css-tricks.com/snippets/jquery/open-external-links-in-new-window/ - comment at end.&#xA;function openAllExternalLinksInANewWindow() {&#xA;    $(document).on('mousedown', 'a:not([href*=&quot;mailto:&quot;],[href*=&quot;javascript&quot;])', function(e) {&#xA;        var isInternalLink = new RegExp('/' + window.location.host + '/');&#xA;        if (!isInternalLink.test(this.href)) {&#xA;            $(this).attr('target', '_blank');&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-08-30T23:47:13.430" LastActivityDate="2016-08-30T23:47:13.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16565" PostTypeId="1" AcceptedAnswerId="16566" CreationDate="2016-08-29T03:32:33.030" Score="3" ViewCount="269" Body="&lt;p&gt;In my plugin, I am checking to see if the current logged in user has permission to save a commerce product.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;if (craft()-&amp;gt;userPermissions-&amp;gt;doesUserHavePermission($user-&amp;gt;id, 'ManageClothingProducts')) {&#xA;    // yes permission&#xA;} else {&#xA;  // no permission&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, it seems I'm always getting into the &lt;code&gt;else&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The commerce docs mention this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Manage [type] products&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm not using the correct syntax? I'm only using the clothing products as an example. Ultimately I'll be checking for my own products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-08-29T14:40:17.550" Title="What is the correct syntax to check if a user has permission?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16566" PostTypeId="2" ParentId="16565" CreationDate="2016-08-29T05:02:08.800" Score="5" Body="&lt;p&gt;The correct permission key is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;commerce-manageProductType:ID_OF_PRODUCT_TYPE_HERE&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;commerce-manageProductType:2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your code would therefore be:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;if (craft()-&amp;gt;userPermissions-&amp;gt;doesUserHavePermission($user-&amp;gt;id, 'commerce-manageProductType:2')) {&#xA;    // yes permission&#xA;} else {&#xA;  // no permission&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could use &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#checkPermission-detail&quot; rel=&quot;nofollow&quot;&gt;UserSessionService::checkPermission()&lt;/a&gt;, which is a shortcut for checking permissions for the currently logged-in user:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if (craft()-&amp;gt;userSession-&amp;gt;checkPermission('commerce-manageProductType:2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="2275" LastEditDate="2016-08-29T14:40:17.550" LastActivityDate="2016-08-29T14:40:17.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16567" PostTypeId="1" CreationDate="2016-08-29T11:20:43.553" Score="2" ViewCount="214" Body="&lt;p&gt;I have managed to get Printmaker up &amp;amp; running, spitting out images, entry data, tags etc. However I cannot style the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built up a template which has a html structure and links to an internal (same domain) CSS file. However the outputted style is browser-default sans serif text and no styling whatsoever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html class=&quot;&quot; lang=&quot;en-gb&quot;&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/css/templates.css&quot;&amp;gt;&#xA;    &amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;&#xA;            &amp;lt;section class=&quot;page&quot;&amp;gt;&#xA;&#xA;              // Page content here...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried the &lt;code&gt;.pdfFromTemplate&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = {&#xA;    entry: entry&#xA;} %}&#xA;{% set settings = { &#xA;    orientation : 'portrait',&#xA;    filename: entry.slug,&#xA;    cacheDirectory: 'pdf/' ~ craft.request.getSegment(1) ~ '/' ~ craft.request.getSegment(2)&#xA;} %}&#xA;{% set pdfUrl = craft.printmaker.pdfFromTemplate('technical-information/_pdf', vars, settings).url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also the &lt;code&gt;.pdfFromHtml&lt;/code&gt; way, too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set html %}&#xA;    {{ include('technical-information/_pdf') }}&#xA;{% endset %}&#xA;{% set settings = { &#xA;    orientation : 'portrait',&#xA;    filename: entry.slug,&#xA;    cacheDirectory: 'pdf/' ~ craft.request.getSegment(1) ~ '/' ~ craft.request.getSegment(2)&#xA;} %}&#xA;{% set pdfUrl = craft.printmaker.pdfFromHtml(html, settings).url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-09-27T19:16:08.683" Title="Render styled output using Printmaker plugin" Tags="&lt;plugin-printmaker&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16568" PostTypeId="1" CreationDate="2016-08-29T12:02:17.977" Score="0" ViewCount="336" Body="&lt;p&gt;I have an object &lt;code&gt;look&lt;/code&gt; which contains an object categories from type of &lt;code&gt;array&lt;/code&gt;. Currently I have to do the following to display the categories proper in the response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;        'looks.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'looks'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;                // Create an array of all the photo URLs&#xA;                $categories = [];&#xA;                foreach ($entry-&amp;gt;categories as $category) {&#xA;                    $object = (object) ['id' =&amp;gt; $category-&amp;gt;id, 'title' =&amp;gt; $category-&amp;gt;title];&#xA;                    $categories[] = $object;&#xA;                }&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'categories' =&amp;gt; $categories&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a more elegant way to doing this? Especially because I'll have a lot of more cases where I have to deal with arrays in objects and arrays in objects and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A structure could looks something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    {&#xA;      name: &quot;ads&quot;&#xA;      categories: [&#xA;         {&#xA;            name: &quot;asdasda&quot;&#xA;            subCategories: [&#xA;                name: &quot;asdasdsa&quot;&#xA;           ]&#xA;          }&#xA;      ]&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5572" LastEditorUserId="57" LastEditDate="2016-08-29T18:02:54.103" LastActivityDate="2016-09-28T22:05:31.817" Title="Nested objects containing array in the Elements API plugin" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16569" PostTypeId="1" CreationDate="2016-08-29T15:05:36.777" Score="1" ViewCount="265" Body="&lt;p&gt;I'm experimenting with Craft 2.6, and am having a bit of difficulty with animated GIFs. The original animated GIF files I'm working with are set up to only loop once, but when I upload them into Craft and they're processed, the resulting GIFs loop infinitely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is running locally on my Mac, and I've made sure that ImageMagick is installed and working via MAMP and PHP 5.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something that could be added as a feature to Craft 2 (having it check for the original number of loops in the GIF file, then recreating it with the same value)?  Or is that already in the works for Craft 3 and not in the cards for version 2?  :)  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5573" LastEditorUserId="22" LastEditDate="2017-05-09T21:40:36.320" LastActivityDate="2017-05-09T21:40:36.320" Title="Specify number of loops for animated GIF (ImageMagick)?" Tags="&lt;image-transforms&gt;&lt;craft-features&gt;&lt;gif&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2016-08-29T17:00:53.977" ContentLicense="CC BY-SA 3.0" />
  <row Id="16570" PostTypeId="1" CreationDate="2016-08-29T18:40:00.017" Score="2" ViewCount="183" Body="&lt;p&gt;I’m trying to sort entries from a section called &lt;em&gt;exhibitions&lt;/em&gt; by &lt;code&gt;startDate&lt;/code&gt; and then by the &lt;code&gt;title&lt;/code&gt; field of a related &lt;em&gt;gallery&lt;/em&gt; entry. So  &lt;em&gt;exhibition&lt;/em&gt; entries with the same &lt;code&gt;entry.startDate&lt;/code&gt; are ordered alphabetically by &lt;code&gt;entry.gallery|first.title&lt;/code&gt; if you will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can use SQL statements in the &lt;code&gt;order&lt;/code&gt; attribute for &lt;code&gt;craft.entries.section('exhibitions').order('...')&lt;/code&gt;. Is it possible to achieve something similar to the answer given in &lt;a href=&quot;https://stackoverflow.com/questions/10786849/sorting-with-related-tables-in-mysql&quot;&gt;https://stackoverflow.com/questions/10786849/sorting-with-related-tables-in-mysql&lt;/a&gt; with the &lt;code&gt;craft.entries&lt;/code&gt; API from a twig template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other solution I discovered was using a &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse Field&lt;/a&gt; and have it save the &lt;code&gt;gallery|first.title&lt;/code&gt; on the exhibition entry and then query entries like this: &lt;code&gt;craft.entries.section('exhibitions').order('startDate, galleryTitle')&lt;/code&gt;. I would prefer not to use this trick however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any suggestions on this topic.&lt;/p&gt;&#xA;" OwnerUserId="879" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-08-29T18:40:00.017" Title="Sort entries by related entry title" Tags="&lt;relations&gt;&lt;ordering&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16571" PostTypeId="1" AcceptedAnswerId="16574" CreationDate="2016-08-29T19:30:09.773" Score="2" ViewCount="454" Body="&lt;p&gt;I'm attempting to get the Control Panel assets to load from a CDN instead of locally from Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going through the config options &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; I can't seem to find a way to change the asset URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to change the asset url (in this case for control panel)?&lt;/p&gt;&#xA;" OwnerUserId="5574" LastEditorUserId="57" LastEditDate="2016-08-29T21:32:32.847" LastActivityDate="2016-08-29T21:42:27.060" Title="Changing the asset url for the Control Panel" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16572" PostTypeId="1" AcceptedAnswerId="16575" CreationDate="2016-08-29T20:55:31.330" Score="0" ViewCount="470" Body="&lt;p&gt;I've got a bizarre issue that is only happening on staging. Locally all urls work correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on staging &lt;a href=&quot;http://domain.com/archives&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/archives&lt;/a&gt; and &lt;a href=&quot;http://domain.com/photography/entry_slug&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/photography/entry_slug&lt;/a&gt; both return a 404 page generated by the host see screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Fct15.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fct15.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if I actually try to visit a page that truly does not exist the craft 404 page shows, which is what I would expect for a real 404 error. For example &lt;a href=&quot;http://domain.com/foo&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/foo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4rIJA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4rIJA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only my second craft site and I have no idea how to troubleshoot. All help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-08-30T16:33:33.190" Title="404 problems, staging only" Tags="&lt;error&gt;&lt;404&gt;&lt;404-page&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16573" PostTypeId="2" ParentId="16568" CreationDate="2016-08-29T21:25:33.570" Score="2" Body="&lt;p&gt;Seems a bit unnecessary to cast it to an object.  This should work identically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;    // Create an array of all the photo URLs&#xA;    $categories = [];&#xA;&#xA;    foreach ($entry-&amp;gt;categories as $category) {&#xA;        $categories[] = ['id' =&amp;gt; $category-&amp;gt;id, 'title' =&amp;gt; $category-&amp;gt;title];&#xA;    }&#xA;&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        'categories' =&amp;gt; $categories&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-29T21:25:33.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16574" PostTypeId="2" ParentId="16571" CreationDate="2016-08-29T21:42:27.060" Score="2" Body="&lt;p&gt;I can't think of a way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem #1: the URLs generated for control panel resources are based on the Craft install's Site URL (whether that's defined in Settings-&gt;General or via the &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow&quot;&gt;config setting&lt;/a&gt; and that is taken into account when creating &lt;em&gt;all&lt;/em&gt; links in Craft, not just for control panel resources requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem #2: in Craft 2, all control panel resources are actually served through PHP, not the web server.  I suspect even if you found a way around #1, this would cause separate issues.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-29T21:42:27.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16575" PostTypeId="2" ParentId="16572" CreationDate="2016-08-29T22:02:25.407" Score="2" Body="&lt;p&gt;Probably your paths are not set up right; or the SERVER_NAME isn't what you think it is, so it's not matching the paths in your &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-08-29T22:02:25.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16576" PostTypeId="1" AcceptedAnswerId="16577" CreationDate="2016-08-30T01:21:36.240" Score="1" ViewCount="68" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;getUrl&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's the error message generated by a blank search and some searches.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fuzzy search is enabled in &lt;code&gt;config/general.php&lt;/code&gt;, and it works.  The search template is straight from the Craft CMS &quot;search form&quot; tutorial.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;&amp;lt;h2&amp;gt;Search Results for &quot;{{ query }}&quot;&amp;lt;/h2&amp;gt;&#xA;{% if entries|length %}&#xA;    {% for post in entries %}&#xA;        &amp;lt;div class=&quot;box col-sm-3&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;post-box vertical clearfix&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ post.url }}&quot; class=&quot;image-link arrow-icon dark-overlay&quot;&amp;gt;&amp;lt;img src=&quot;{{ post.postImage.first().getUrl('thumbImage')}}&quot; width=&quot;434&quot; height=&quot;434&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                &amp;lt;div class=&quot;extra-info&quot;&amp;gt;&#xA;                    &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;{{ post.title}}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;                    &amp;lt;p class=&quot;meta small&quot;&amp;gt;{{ post.postDate | date('F d, Y') }} &amp;lt;a href=&quot;#&quot;&amp;gt;Nicole&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;You search for &quot;{{ query }}&quot; didn't retun any results&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ post.postImage.first().getUrl('thumbImage')}}&lt;/code&gt; works without error every place else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I am missing?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2016-08-30T03:16:45.570" LastActivityDate="2016-08-30T20:00:44.170" Title="Search Error Appears on Blank Searches" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16577" PostTypeId="2" ParentId="16576" CreationDate="2016-08-30T03:33:04.317" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;{{ post.postImage.first().getUrl('thumbImage')}}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Whatever entry &lt;code&gt;post&lt;/code&gt; is referencing for whatever search term you're using when you get the error, doesn't have any &lt;code&gt;postImage&lt;/code&gt; assets selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you call &lt;code&gt;post.postImage.first()&lt;/code&gt;, that returns &lt;code&gt;null&lt;/code&gt; and you can't call &lt;code&gt;getUrl&lt;/code&gt; on &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either make &lt;code&gt;postImage&lt;/code&gt; required and make sure that all existing entries have at least one asset selected, or guard against it in Twig via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = post.postImage.first() %}&#xA;&#xA;{% if image|length %}&#xA;    {{ image.getUrl('thumbImage') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-08-30T20:00:44.170" LastActivityDate="2016-08-30T20:00:44.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16578" PostTypeId="1" AcceptedAnswerId="16595" CreationDate="2016-08-30T05:30:15.483" Score="5" ViewCount="3980" Body="&lt;p&gt;After going through the documentation I believe that this is the correct code to output the url for the asset field but its not working and I have no idea why. Please help!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav program in craft.entries.section('program').level(1) %}&#xA;  {% set active = entry is defined and program.isAncestorOf(entry) %}&#xA;&#xA;  &amp;lt;div class=&quot;{% if active %}active{% endif %}&quot;&amp;gt;&#xA;      {% if program.featureImage|length %}&#xA;        &amp;lt;img src=&quot;{{ program.featureImage.first().url }}&quot; alt=&quot;{{ program }}&quot;&amp;gt;&#xA;      {% endif %}&#xA;      &amp;lt;h3 href=&quot;{{ program.url }}&quot;&amp;gt;{{ program.title }}&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ program.description }}&amp;lt;/p&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3470" LastEditorUserId="45" LastEditDate="2017-01-20T17:29:44.107" LastActivityDate="2018-05-20T08:05:28.013" Title="Image asset url is not being output" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16579" PostTypeId="1" CreationDate="2016-08-30T07:50:37.647" Score="1" ViewCount="50" Body="&lt;p&gt;In my plugin, when I go to the elementtype index page with the search bar and the dropdown for ordering by certain fields, when I choose a field which has been added through the fieldLayout, the response throws an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem in the query is in the &lt;code&gt;ORDER BY&lt;/code&gt; clause. Specifically: &lt;code&gt;ORDER BY 'field:22'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about resolving this issue?&lt;br&gt;&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2016-08-30T07:50:37.647" Title="Ordering elementtype by custom field throws an error" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16580" PostTypeId="2" ParentId="16540" CreationDate="2016-08-30T10:44:56.253" Score="5" Body="&lt;p&gt;Redactor is, very sensibly, correcting your invalid html. &lt;strong&gt;You can't have links inside links&lt;/strong&gt;, the spec does not allow it: &lt;a href=&quot;https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element&quot;&gt;https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if Redactor didn't do this, the browser will treat your invalid html as invalid and take a best guess at reconstructing it to form valid html; probably with varying results.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2016-08-30T10:44:56.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16581" PostTypeId="1" AcceptedAnswerId="16585" CreationDate="2016-08-30T11:25:21.903" Score="2" ViewCount="287" Body="&lt;p&gt;I've created a custom field.html which is working fine when I manually specify the formHandle for use with &lt;code&gt;submittedEntry&lt;/code&gt; as mentioned in the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html&quot; rel=&quot;nofollow&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ourForm = craft.sproutForms.form('formHandle') %}&#xA;{% set submittedEntry = craft.sproutForms.getEntry(ourForm) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I need to be able to have a dynamic formHandle in the field.html as I am using the same file for an infinite number of forms. This means I cannot manually specify the formHandle as it throws the below error (as the form methods for &lt;em&gt;Form A&lt;/em&gt; won't exist in &lt;em&gt;Form B&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named &quot;fieldNameFormB&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can pass &lt;code&gt;form.handle&lt;/code&gt; from &lt;em&gt;form.html&lt;/em&gt; into &lt;em&gt;field.html&lt;/em&gt; so that I can use the below code, or is there another method by which I'm not forced to manually specify the form?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ourForm = craft.sproutForms.form(form.handle) %}&#xA;{% set submittedEntry = craft.sproutForms.getEntry(ourForm) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5546" LastActivityDate="2016-09-01T10:33:33.830" Title="How to use form.handle in Custom field.html" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16583" PostTypeId="1" CreationDate="2016-08-30T15:36:27.783" Score="2" ViewCount="432" Body="&lt;p&gt;I have a template which I want to use for different sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I have this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('catering').level(1) %}&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for page in pages %}&#xA;    &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to select the current section by Craft self. So I can use the same template for multiple sections.&lt;/p&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="4466" LastEditDate="2016-08-30T15:52:53.263" LastActivityDate="2016-08-31T09:25:57.307" Title="Get Level 1 entry on a section as Nav" Tags="&lt;navigation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16584" PostTypeId="1" CreationDate="2016-08-30T15:43:58.300" Score="1" ViewCount="156" Body="&lt;p&gt;Is it possible to control if some content shows that's within a Matrix field if a lightswitch field on the entry is &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect not as you're inside the matrix loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.section3 %}&#xA; ...&#xA;{% if block.applyButton %}&#xA; ...&#xA;   {% if entry.applicationsClosed('not 1') %}&#xA;    {% for asset in entry.applyButtonDocument %}&#xA;     &amp;lt;a href=&quot;{{ asset.getUrl() }}&quot; class=&quot;button button--black&quot;&amp;gt;apply&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;   {% endif %}&#xA;...&#xA;{% endif %} &#xA;....&#xA;{% endfor %}        &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't want to put the lightswitch within the Matrix as that would put it in an illogical place and would be needed to be switched multiple times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's being used as more of a global setting across the page to change various bits of content.&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="4466" LastEditDate="2016-08-30T16:12:34.633" LastActivityDate="2016-08-30T16:20:28.783" Title="Entries lightswitch field within matrix" Tags="&lt;matrix&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16585" PostTypeId="2" ParentId="16581" CreationDate="2016-08-30T15:56:38.423" Score="1" Body="&lt;p&gt;I have updated the plugin files to make this work as I needed it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;sproutforms/variables/SproutFormsVariables.php&lt;/code&gt;, I have updated the &lt;code&gt;$bodyHtml&lt;/code&gt; variable at Line 57 to include &lt;code&gt;handle =&amp;gt; $formHandle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$bodyHtml = craft()-&amp;gt;templates-&amp;gt;render(&#xA;    'tab', array(&#xA;        'handle'               =&amp;gt; $formHandle,&#xA;        'tabs'                 =&amp;gt; $form-&amp;gt;getFieldLayout()-&amp;gt;getTabs(),&#xA;        'entry'                =&amp;gt; $entry,&#xA;        'formFields'           =&amp;gt; $fields,&#xA;        'thirdPartySubmission' =&amp;gt; !!$form-&amp;gt;submitAction,&#xA;        'displaySectionTitles' =&amp;gt; $form-&amp;gt;displaySectionTitles,&#xA;        'renderingOptions'     =&amp;gt; $renderingOptions&#xA;    )&#xA;); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means in my Template Override in &lt;code&gt;_forms/tabs.html&lt;/code&gt; I can pass the &lt;code&gt;handle&lt;/code&gt; as a variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- if formField -%}&#xA;    {% include &quot;field&quot; with {&#xA;        form:                 handle,&#xA;        field:                field,&#xA;        element:              entry,&#xA;        required:             required,&#xA;        formField:            formField,&#xA;        renderingOptions:     renderingOptions,&#xA;        thirdPartySubmission: thirdPartySubmission,&#xA;    } only %}&#xA;{%- endif %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can then do as I required with not needing to specifically specify a form name in my &lt;code&gt;submittedEntry&lt;/code&gt; variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ourForm = craft.sproutForms.form(form) %}&#xA;{% set submittedEntry = craft.sproutForms.getEntry(ourForm) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The use case for this update is if clients can add forms through the Matrix, you need to get &lt;code&gt;form.handle&lt;/code&gt; in &lt;code&gt;submittedEntry&lt;/code&gt; so that you can populate the form post using &lt;code&gt;value=&quot;{{ attribute(submittedEntry, fieldName) }}&lt;/code&gt; if the form fails validation (so that the form doesn't return empty on validation failure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the documentation the &lt;code&gt;submittedEntry&lt;/code&gt; value is always manually set, however in this example you need to be able to set &lt;code&gt;submittedEntry&lt;/code&gt; dynamically so that you can use generic Template Overrides in &lt;code&gt;_forms&lt;/code&gt; rather than having overrides per form in &lt;code&gt;_forms/formHandle&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5546" LastEditorUserId="5546" LastEditDate="2016-09-01T10:33:33.830" LastActivityDate="2016-09-01T10:33:33.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16586" PostTypeId="2" ParentId="16583" CreationDate="2016-08-30T15:57:05.433" Score="2" Body="&lt;p&gt;To expand on my comment you could do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;templates/_pages/index.twig&lt;/code&gt; you would do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% include '_pages/_types/_' ~ entry.type %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a folder in &lt;code&gt;/templates/_pages/&lt;/code&gt; called &lt;code&gt;_types&lt;/code&gt; in it use, an example &lt;code&gt;_standard.twig&lt;/code&gt; in which &quot;standard&quot; coincides to your Entry Type slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps. I couldn't find the original SE post but I know that this method has been mentioned and preferred by many Crafters!&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2016-08-30T15:57:05.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16587" PostTypeId="2" ParentId="16584" CreationDate="2016-08-30T16:20:28.783" Score="3" Body="&lt;p&gt;You can definitely access and use fields on the entry you're viewing within a matrix field loop. The only thing you need to watch out for is repeating the &lt;code&gt;entry&lt;/code&gt; variable in your &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simplify your &lt;code&gt;if&lt;/code&gt; statement slightly by using &lt;code&gt;{% if not entry.applicationsClosed %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-08-30T16:20:28.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16588" PostTypeId="2" ParentId="16572" CreationDate="2016-08-30T16:23:04.603" Score="3" Body="&lt;p&gt;Looking at your screenshots, the host names are different.  The cPanel 404 shows mysphotos instead of myphotos.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably a typo somewhere in your templates.&lt;/p&gt;&#xA;" OwnerUserId="4170" LastEditorUserId="4170" LastEditDate="2016-08-30T16:33:33.190" LastActivityDate="2016-08-30T16:33:33.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16589" PostTypeId="1" CreationDate="2016-08-30T17:08:13.327" Score="1" ViewCount="227" Body="&lt;p&gt;I have a lot of data that sits outside of Craft (the data is in MS SQL Server) and I plan on writing a simple .NET Service which will return JSON. I need to display this data but not sure on how to connect to a service using Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any clients (plugins) which will connect to a service get the JSON data and display it?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="57" LastEditDate="2016-08-30T17:53:30.583" LastActivityDate="2016-08-30T18:06:49.720" Title="Need a way to connect to a webservice" Tags="&lt;plugins&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16592" PostTypeId="2" ParentId="16589" CreationDate="2016-08-30T18:06:49.720" Score="2" Body="&lt;p&gt;Craft 2.x includes &lt;a href=&quot;https://guzzle3.readthedocs.io/index.html&quot; rel=&quot;nofollow&quot;&gt;Guzzle 3&lt;/a&gt; natively, so you could write a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;Craft plugin&lt;/a&gt; that uses it to consume your web service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are plenty of examples in the &lt;a href=&quot;https://guzzle3.readthedocs.io/docs.html&quot; rel=&quot;nofollow&quot;&gt;Guzzle 3 docs&lt;/a&gt; on how to do that (as well as in Craft itself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use something like this: &lt;a href=&quot;https://straightupcraft.com/craft-plugins/guzzle&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/guzzle&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is a wrapper for Craft's Guzzle 3 you can use from a template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-30T18:06:49.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16593" PostTypeId="1" AcceptedAnswerId="16617" CreationDate="2016-08-30T18:43:09.147" Score="3" ViewCount="1074" Body="&lt;p&gt;I need to set programmatically the value of an Entries field type when I'm going to create a new entry from the admin form, after the form loads I'm searching for the entry I need to set in the Entries field, so I'm making something like &lt;code&gt;setAttribute('companyField', $companyEntry)&lt;/code&gt; but it didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to find a way to set/lookup that value in the Entries field type so the user can see it in the UI.&lt;/p&gt;&#xA;" OwnerUserId="5580" LastActivityDate="2016-08-31T19:15:57.773" Title="How can I programmatically set the value of an Entries field type?" Tags="&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16595" PostTypeId="2" ParentId="16578" CreationDate="2016-08-30T22:48:19.353" Score="15" Body="&lt;p&gt;So after looking through other craft websites to see how they where able to get images to work I discovered what I did wrong when setting up the asset source. The thing is though that the craft documentation is not very helpful in this regard, also there are no errors or helpful output to indicate that my configuration might be the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yhllh.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yhllh.png&quot; alt=&quot;What I needed to do&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3470" LastEditorUserId="3470" LastEditDate="2016-09-05T05:38:03.913" LastActivityDate="2016-09-05T05:38:03.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16596" PostTypeId="1" AcceptedAnswerId="16597" CreationDate="2016-08-30T22:57:15.117" Score="1" ViewCount="1124" Body="&lt;p&gt;I have a matrix field with a Super Table block type. Then I have a matrix field as a field within the Super Table block. I am having trouble filtering by block type from within the child matrix field. Is what I am trying to achieve even possible? Any solution would save me from pulling my hair out any further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the last attempt I made to filter through before posting here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldParent %}&#xA;&#xA;    {% if block.type == &quot;superTableBlock&quot; %}&#xA;&#xA;        {% for row in superTableBlock %}&#xA;&#xA;            {% for block in row.superTableBlock %}&#xA;&#xA;                {% switch block.type %}&#xA;&#xA;                    {% case &quot;contentBlock1&quot; %}&#xA;&#xA;                       {{ block.contentField }}&#xA;&#xA;                    {% case &quot;contentBlock2&quot; %}&#xA;&#xA;                       {{ block.contentField }}&#xA;&#xA;                {% endswitch %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edited to include if statement previously left out by mistake&lt;/p&gt;&#xA;" OwnerUserId="5581" LastActivityDate="2016-08-31T00:01:43.470" Title="Matrix -&gt; Super Table - &gt; Matrix" Tags="&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16597" PostTypeId="2" ParentId="16596" CreationDate="2016-08-30T23:14:46.427" Score="2" Body="&lt;p&gt;Firstly, you'll need to change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for row in superTableBlock %}&lt;/code&gt; to &lt;code&gt;{% for row in block.superTableBlock %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can reference the Super Table field within your out Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also don't need to loop through &lt;code&gt;{% for block in row.superTableBlock %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't tell if you're looping through the inner Matrix field. Have you tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldParent %}&#xA;    {% if block.type == &quot;sectionBuilder&quot; %}&#xA;        {% for row in block.sectionBlock %}&#xA;            {% for sectionLayout in row.sectionLayout %}&#xA;                {% switch sectionLayout.type %}&#xA;                    {% case &quot;contentBlock&quot; %}&#xA;                       {{ sectionLayout.sectionGrid }}&#xA;                    {% case &quot;articlesFeedBlock&quot; %}&#xA;                       {{ sectionLayout.sectionBackground }}&#xA;                {% endswitch %}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2016-08-31T00:01:43.470" LastActivityDate="2016-08-31T00:01:43.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16598" PostTypeId="1" CreationDate="2016-08-31T07:48:34.023" Score="2" ViewCount="201" Body="&lt;p&gt;Setting template mode to CP with &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::CP)&lt;/code&gt; only lets me load templates from &lt;code&gt;app/templates&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i load &lt;code&gt;app/templates/entries/_fields.html&lt;/code&gt; and I use custom fields in the entry, this will attempt to load those edit templates from &lt;code&gt;plugins/{pluginName}/templates&lt;/code&gt; and I receive an error because the templates could not be found in &lt;code&gt;app/templates&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't templateMode -&gt; CP behave more like proper CP and not just set a single load path?&lt;/p&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2016-08-31T07:48:34.023" Title="Setting template mode to CP doesn't let me load plugin templates" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16600" PostTypeId="2" ParentId="16583" CreationDate="2016-08-31T09:25:57.307" Score="1" Body="&lt;p&gt;What i want do is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will get all level 1 childs from the current Section to build a Subnav with it. Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set pages = craft.entries.section(getCurrentSection).level(1) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i need to know is the current section handle. Thank you ;)&lt;/p&gt;&#xA;" OwnerUserId="5577" LastActivityDate="2016-08-31T09:25:57.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16601" PostTypeId="1" AcceptedAnswerId="16602" CreationDate="2016-08-31T11:02:04.033" Score="3" ViewCount="1740" Body="&lt;p&gt;I want to create an ICS file that people can download to add events to their calendar. I have done this with ExpressionEngine by creating an xml template and just calling it. Below is the code I have so far but I think the problem is that twig doesn't allow php in a template. I'm guessing that means I need to put this in a plugin, but that's beyond my skills. Any help/advice appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;$ical = &quot;BEGIN:VCALENDAR&#xA;X-WR-TIMEZONE:Europe/London&#xA;PRODID:-//Orienteering Club//NONSGML v1.0//EN&#xA;CALSCALE:GREGORIAN&#xA;X-WR-CALNAME:Orienteering Club&#xA;VERSION:2.0&#xA;{% set events = craft.entries.find({section:'events,activities', eventDate : &quot;&amp;gt;= &quot; ~ now.w3cDate() , order:'eventDate'}) %}&#xA;{% if events %}&#xA;{% for entry in events %}&#xA;BEGIN:VEVENT&#xA;UID:{entry_id}&#xA;URL;VALUE=URI:{{ entry.url }}&#xA;DTSTAMP:{{ entry.eventDate.format('Ymd') }}&#xA;DTSTART:{{ entry.eventDate.format('Ymd') }}&#xA;DTEND;VALUE=DATE:{{ entry.eventDate.format('Ymd') }}&#xA;LOCATION:{{ entry.eventName }}&#xA;SUMMARY:Orienteering,nr.{{ entry.map.parts.postal_town }}&#xA;END:VEVENT&#xA;{% endfor %}&#xA;{% endif %}&#xA;END:VCALENDAR&quot;;&#xA;&#xA;//set correct content-type-header&#xA;header('Content-type: text/calendar; charset=utf-8');&#xA;header('Content-Disposition: inline; filename=calendar.ics');&#xA;echo $ical;&#xA;exit;&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2017-03-24T06:23:30.440" Title="How can I create an ICS calendar file" Tags="&lt;calendar&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16602" PostTypeId="2" ParentId="16601" CreationDate="2016-08-31T11:08:21.683" Score="7" Body="&lt;p&gt;You don't need a plugin.  Here's some example code from an old project of mine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;&#xA;    {% set thisPackage = &quot;&quot; %}&#xA;&#xA;    {% set packageId = craft.request.getSegment(2) %}&#xA;    {% if packageId %}&#xA;        {% set thisPackage = craft.entries.section('packages').id(packageId).find()[0] %}&#xA;    {% endif %}&#xA;    {% set craftAdminId = craft.users.admin('1').first().id %}&#xA;&#xA;    {# -- Do some sanity checking, make sure they have perms #}&#xA;&#xA;    {% if thisPackage %}&#xA;        {% set authorInfo = craft.users.id(thisPackage.authorId)[0] %}&#xA;        {% set thisCurrency = thisPackage.currency.value %}&#xA;        {% if authorInfo.id != currentUser.id and craftAdminId != currentUser.id %}&#xA;            {% redirect siteUrl %}&#xA;        {% endif %}&#xA;    {% else %}&#xA;            {% redirect siteUrl %}&#xA;    {% endif %}&#xA;&#xA;    {% header &quot;Content-Type: text/calendar; charset=utf-8&quot; %}&#xA;    {% header &quot;Content-Disposition: attachment; filename=cal.ics&quot; %}&#xA;{% endspaceless %}&#xA;BEGIN:VCALENDAR&#xA;VERSION:2.0&#xA;METHOD:PUBLISH&#xA;X-WR-CALNAME:{{ thisPackage.packageTitle | raw | escape }}&#xA;PRODID:-//tastystakes/tourneycal//NONSGML v1.0//EN&#xA;{% spaceless %}&#xA;{% for block in thisPackage.packageTournaments %}&#xA;BEGIN:VEVENT&#xA;UID:{{ thisPackage.id }}{{ block.id }}{{ authorInfo.email }}&#xA;DTSTART:{{ block.date.getTimestamp() | date_modify(&quot;+3 hours&quot;) | date(&quot;Ymd&quot;, &quot;UTC&quot;) }}T{{ block.date.getTimestamp() | date_modify(&quot;+3 hours&quot;) | date(&quot;Gi&quot;, &quot;UTC&quot;) }}00Z&#xA;DTEND:{{ block.date.getTimestamp() | date_modify(&quot;+3 hours&quot;) | date_modify(&quot;+&quot; ~ block.days ~ &quot; days&quot;) | date(&quot;Ymd&quot;, &quot;UTC&quot;) }}T{{ block.date.getTimestamp() | date_modify(&quot;+3 hours&quot;) | date_modify(&quot;+&quot; ~ block.days ~ &quot; days&quot;) |date(&quot;Gi&quot;, &quot;UTC&quot;) }}00Z&#xA;SUMMARY:{{ block.tourneyName }}&#xA;DESCRIPTION:{{ block.tourneyName }}&#xA;END:VEVENT&#xA;{% endfor %}&#xA;END:VCALENDAR&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-08-31T11:08:21.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16603" PostTypeId="2" ParentId="2116" CreationDate="2016-08-31T11:34:48.867" Score="0" Body="&lt;p&gt;I had a similar issue when using an if statement to define a block element. The correct way doing this will be following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block metaOgImage %}&#xA;  {% if og.image is defined %}&#xA;   &amp;lt;meta property=&quot;og:image&quot; content=&quot;{{ og.image }}&quot;&amp;gt;&#xA;  {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do not use the if statement outside the block statement.&lt;/p&gt;&#xA;" OwnerUserId="5583" LastActivityDate="2016-08-31T11:34:48.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16604" PostTypeId="1" AcceptedAnswerId="16605" CreationDate="2016-08-31T12:05:35.890" Score="1" ViewCount="481" Body="&lt;p&gt;I want to build a subnav with all entries from the current Section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section(getCurrentSection).level(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm looking for the handle &quot;getCurrentSection&quot;. I will use this for pages in 5 different sections, so I don't want to select the section by hand, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('Section 1').level(1) %}&#xA;{% set pages = craft.entries.section('Section 2').level(1) %}&#xA;......&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="45" LastEditDate="2016-08-31T15:04:24.330" LastActivityDate="2016-08-31T15:04:24.330" Title="Current Section handle" Tags="&lt;navigation&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16605" PostTypeId="2" ParentId="16604" CreationDate="2016-08-31T12:26:14.277" Score="2" Body="&lt;p&gt;You can get the current section handle from the entry like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.section.handle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2016-08-31T12:26:14.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16606" PostTypeId="1" CreationDate="2016-08-31T14:31:02.527" Score="1" ViewCount="344" Body="&lt;p&gt;I'm in need of help (again ;-) )...&#xA;I'm trying to paginate the content of a matrix in a structure, but can't seem to get it done... This is the code I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for inhoud in entry.getDescendants() %}&#xA;    {% if inhoud.type == 'segment' %}&#xA;        &amp;lt;section id=&quot;{{ inhoud.title|kebab }}&quot; class=&quot;segment&quot;&amp;gt;&#xA;            &amp;lt;h2 class=&quot;section-h2&quot;&amp;gt;{{ inhoud.title }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;/section&amp;gt;&#xA;    {% endif %}&#xA;    {% if inhoud.type == 'inhoud' %}&#xA;    {#{% paginate inhoud.trace.limit(10) as inhoud %}#}&#xA;        {% for inhoud in inhoud.trace %}&#xA;            {% include [&quot;trace/&quot; ~ inhoud.type, &quot;trace/default&quot; ] %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My pagination code is in comments since it doesn't work, but that's where I need the pagination. Is there anyone nice enough to want to help me figure this out?&#xA;We've got a big matrix field (it's the route of certain products from farm 'till the shop, so lots of blocks in there), and I'd like to paginate the content of these 'segments', but we'll need those segments printed out because there's a navigation with anchorpoints on top of the site.&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2016-09-01T12:18:32.173" Title="Paginate a matrix" Tags="&lt;matrix&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16607" PostTypeId="1" AcceptedAnswerId="16654" CreationDate="2016-08-31T14:31:59.087" Score="3" ViewCount="956" Body="&lt;p&gt;I've got a generic newsletter template. Now some of our newsletters are in Spanish. It's overkill and more complicated for the admins to bother with settings up different locales, so instead I'd like to set the locale from the entry (currently using a dropdown).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All good, and I can use the |translate(language=&quot;&quot;) filter to achieve this using the value from the dropdown field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem is that when formatting a date, it remains in English because it translated using the current locale, which is English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering whether I can manually override the locale in the template. &lt;code&gt;{% set locale = 'es' %}&lt;/code&gt;&#xA;or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if I can force the date to format using a specific locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2016-09-02T02:40:10.477" Title="Is it possible to use set the locale manually in a template?" Tags="&lt;localization&gt;&lt;datetime&gt;&lt;language&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16608" PostTypeId="1" AcceptedAnswerId="16611" CreationDate="2016-08-31T14:37:35.407" Score="1" ViewCount="223" Body="&lt;p&gt;As a content strategist, I'm trying to take the memory and guesswork out of my client's experience while updating the site (check out this great article, &quot;&lt;a href=&quot;http://alistapart.com/article/training-the-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Training the CMS&lt;/a&gt;&quot;). Field instructions are great for that. But I'm doing some things that aren't intuitive to the user on the back end, and I want to add instructions/explanation on the affected entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this could be effective in various places:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Above the Title field&lt;/li&gt;&#xA;&lt;li&gt;In an Instructions tab&lt;/li&gt;&#xA;&lt;li&gt;Above or below the right sidebar&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rN4OK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rN4OK.png&quot; alt=&quot;outside course entry type&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a field type that would let me just include text with no user interaction? Or a way to add instructional text to the entry interface?&lt;/strong&gt; Bonus if I have the option to include images, links, and basic formatting too. I haven't explored plugins yet, because I'm still learning my way around Craft, but I'm open to using them.&lt;/p&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2016-08-31T15:28:33.370" Title="Inline help text for entries" Tags="&lt;control-panel&gt;&lt;entry&gt;&lt;field&gt;&lt;admin&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16609" PostTypeId="1" AcceptedAnswerId="16636" CreationDate="2016-08-31T14:48:36.103" Score="1" ViewCount="1623" Body="&lt;p&gt;I have a question. How can I output the Childs from a Neo (Neo Plugin) Block?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this code, i get the output for all level 1 blocks but i don't get a output for the deeper levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how can I handle different child templates for the Output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to have a switch with different case for the level 2 output. Because i've different child block options.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixNeo.level(1) %}&#xA;    {% switch block.type.handle %}&#xA;&#xA;        {% case 'title' %}&#xA;            &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;&#xA;&#xA;        {% case 'boxes' %}&#xA;             &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;   &#xA;&#xA;            {% for item in block.children %}&#xA;                {% switch block.type.handle %}&#xA;&#xA;                    {% case 'box' %}&#xA;                        &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;&#xA;                        {% case 'image' %}&#xA;                        &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;&#xA;                {% endswitch %}&#xA;            {% endfor %}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can somebody help me out, please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=====================&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my code works fine but i've a new questione:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i output a real Matix-Field in a child element (level 2 in Neo).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav block in entry.myField.level(1) %}&#xA;    {% switch block.type.handle %}&#xA;        {% case 'title' %}&#xA;            &amp;lt;hgroup&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ block.subTitle }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;/hgroup&amp;gt;&#xA;&#xA;        {% case 'intro' %}&#xA;            &amp;lt;section class=&quot;block&quot;&amp;gt;&#xA;                {% for item in block.children %}&#xA;                    {% include &quot;_includes/elements/&quot; ~ item.type %}&#xA;                {% endfor %}&#xA;            &amp;lt;/section&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The child Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;box&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;{{ item.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for button in block.myButton %}&#xA;        {% switch button.type %}&#xA;            {% case 'buttonIntern' %}&#xA;                &amp;lt;a class=&quot;button&quot; href=&quot;{{ button.linkIntern }}&quot;&amp;gt;{{ button.linkText }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% case 'buttonExtern' %}&#xA;                &amp;lt;a class=&quot;button&quot; target=&quot;_blank&quot; href=&quot;{{ button.linkIntern }}&quot;&amp;gt;{{ button.linkExtern }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="5577" LastEditDate="2016-09-08T07:47:03.897" LastActivityDate="2017-10-05T06:45:56.310" Title="Craft Neo – childs Output" Tags="&lt;layout&gt;&lt;plugin-neo&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16610" PostTypeId="2" ParentId="16601" CreationDate="2016-08-31T15:04:30.210" Score="5" Body="&lt;p&gt;Thanks to the starter from khalwat I got this working with the following simplified template code. There do seem to be a few variations on what validates and I got a lot of info from &lt;a href=&quot;http://icalendar.org/&quot; rel=&quot;noreferrer&quot;&gt;http://icalendar.org/&lt;/a&gt;&#xA;The GEO field doesn't seem to be used by Google calendar or Apple calendar but I'm guessing some calendars out there can use it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;    {% set events = craft.entries.find({section:'events,activities', eventDate : &quot;&amp;gt;= &quot; ~ now.w3cDate() , order:'eventDate'}) %}&#xA;    {% header &quot;Content-Type: text/calendar; charset=utf-8&quot; %}&#xA;    {% header &quot;Content-Disposition: attachment; filename=calendar.ics&quot; %}&#xA;{% endspaceless %}&#xA;BEGIN:VCALENDAR&#xA;PRODID:-//{{ siteName }}//NONSGML v1.0//EN&#xA;CALSCALE:GREGORIAN&#xA;X-WR-CALNAME:{{ siteName }}&#xA;VERSION:2.0&#xA;{% spaceless %}&#xA;    {% for entry in events %}&#xA;    BEGIN:VEVENT&#xA;    UID:{{ entry.id }}@orienteeringclub.org.uk&#xA;    DTSTAMP:{{ entry.eventDate.format('Ymd') }}T120101Z&#xA;    DTSTART:{{ entry.eventDate.format('Ymd') }}T120101Z&#xA;    DTEND:{{ entry.eventDate.format('Ymd') }}T120101Z&#xA;    LOCATION:Near {{ entry.map.parts.postal_town }}&#xA;    GEO:{{ entry.map.lat|round(6) }};{{ entry.map.lng|round(6) }}&#xA;    SUMMARY:Orienteering, {{ entry.eventName }}&#xA;    DESCRIPTION:{{ entry.times|striptags }}&#xA;    URL:{{ entry.url }}&#xA;    END:VEVENT&#xA;    {% endfor %}&#xA;    END:VCALENDAR&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2016-08-31T15:04:30.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16611" PostTypeId="2" ParentId="16608" CreationDate="2016-08-31T15:12:16.490" Score="2" Body="&lt;p&gt;I got it! The &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/notes-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Notes Field plugin&lt;/a&gt; was what I needed. It allows HTML input with various formatting options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uqerg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uqerg.png&quot; alt=&quot;course page with help text&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2016-08-31T15:28:33.370" LastActivityDate="2016-08-31T15:28:33.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16612" PostTypeId="1" CreationDate="2016-08-31T16:16:29.687" Score="1" ViewCount="583" Body="&lt;p&gt;I'm a newcomer to Craft from the far-off lands of WordPress. I hope my stay is long and fruitful, but at the moment that prospect is in danger. The problem I'm having must be embarrassingly simple, but I can't find my way through it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simple task I am attempting to accomplish it to display an image I uploaded to an entry via a new asset field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a method or practice for displaying an image via asset fields found on the internet, I have tried it. Currently, this is how I am trying to render the image in my twig file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.featuredImage %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;blah&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No image shows up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I &lt;code&gt;dump(image)&lt;/code&gt;, should it be returning an array with 666 lines? I understand an asset returns a kind of Asset File Model (although I don't entirely understand &lt;em&gt;what&lt;/em&gt; that means), but I find it hard to believe it's supposed to be that large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hoping to find at least the url of the asset, I perform &lt;code&gt;dump(image.url)&lt;/code&gt;, but it only returns &lt;code&gt;bool(false)&lt;/code&gt;. Why would it be doing that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created my &lt;code&gt;uploads&lt;/code&gt; directory, and setup my asset source. I've tried doing this on an entirely fresh, up-to-date and clean install, but it still behaves the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing or doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2016-08-31T16:58:42.910" Title="I am unable to correctly return the url of an uploaded asset" Tags="&lt;templating&gt;&lt;assets&gt;&lt;url&gt;&lt;field&gt;&lt;image&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16613" PostTypeId="2" ParentId="16612" CreationDate="2016-08-31T16:30:48.363" Score="0" Body="&lt;pre&gt;&lt;code&gt;{% set image = entry.featuredImage.first() %}&#xA;{% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4628" LastActivityDate="2016-08-31T16:30:48.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16614" PostTypeId="2" ParentId="16612" CreationDate="2016-08-31T16:58:42.910" Score="5" Body="&lt;p&gt;I found the answer in a similar post here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16578/image-asset-url-is-not-being-output&quot;&gt;Image asset url is not being output&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem was with my Asset Source settings. Now that I think about it, it's obvious: I had no public URL declared for assets from my 'Uploads' source. Giving that a public url fixed the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said, it's obvious now, but it'd be nice in the documentation could make even just a small reference to this.&lt;/p&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-08-31T16:58:42.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16615" PostTypeId="1" AcceptedAnswerId="16631" CreationDate="2016-08-31T17:35:30.487" Score="5" ViewCount="1074" Body="&lt;p&gt;Does anyone have any recommendation on how to reformat the Commerce checkout workflow to be on one page? More specifically, how to pass the address/customer info before the payment info without having to redirect to another page? I've tried combining them into one form without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2016-09-01T07:58:19.153" Title="One-Page Commerce Checkout" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16617" PostTypeId="2" ParentId="16593" CreationDate="2016-08-31T19:15:57.773" Score="1" Body="&lt;p&gt;For relationship fields (Entries, Assets, Users, Tags, etc.) you need to pass in an array of element IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setAttribute('companyField', array($companyEntry-&amp;gt;id));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-08-31T19:15:57.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16618" PostTypeId="1" CreationDate="2016-08-31T19:21:31.413" Score="2" ViewCount="84" Body="&lt;p&gt;I want to replace the login function with a custom one validating against Office 365 oAuth.  I already have the connection to MS coded, but I can't find a way to replace the core login function.  I can see the &quot;before login&quot; hook, but that would still display the login screen.  Is there any way to accomplish via plugin, or do I have to alter the core code to accomplish what I want?&lt;/p&gt;&#xA;" OwnerUserId="5585" LastActivityDate="2016-08-31T19:53:29.873" Title="Replace core login function" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16619" PostTypeId="2" ParentId="16618" CreationDate="2016-08-31T19:53:29.873" Score="1" Body="&lt;p&gt;I believe what you're trying to accomplish can be done with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps this OAuth plugin could at least offer some boilerplate for you: &lt;a href=&quot;https://dukt.net/craft/oauth/&quot; rel=&quot;nofollow&quot;&gt;https://dukt.net/craft/oauth/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;dukt's github also has some provider-specific plugins: &lt;a href=&quot;https://github.com/dukt&quot; rel=&quot;nofollow&quot;&gt;https://github.com/dukt&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5570" LastActivityDate="2016-08-31T19:53:29.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16622" PostTypeId="1" AcceptedAnswerId="16625" CreationDate="2016-09-01T00:36:38.983" Score="1" ViewCount="114" Body="&lt;p&gt;After playing around with Craft CMS for awhile I'm a little curious how some of you would approach this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you add a tabbed div to an entry? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the tab div below, it's the first example in the Bourbon Refill framework site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://refills.bourbon.io/&quot; rel=&quot;nofollow&quot;&gt;Bourbon Refills&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5390" LastEditorUserId="22" LastEditDate="2017-05-09T21:39:30.953" LastActivityDate="2017-05-09T21:39:30.953" Title="How to layout a tabbed div" Tags="&lt;templating&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16623" PostTypeId="1" CreationDate="2016-09-01T00:49:25.827" Score="1" ViewCount="37" Body="&lt;p&gt;I have a block of text I'd like to make translatable. Within that block of text there is a link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;Lorem ipsum. &amp;lt;a href='{url}' target='_blank'&amp;gt;Aenean commodo ligula&amp;lt;/a&amp;gt; eget dolor.&quot;|t({&#xA;    url: &quot;#&quot;&#xA;})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But doesn't feel like the best way to do it as the translation file now requires HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/translations/en_us.php&#xA;&#xA;&amp;lt;?php&#xA;&#xA;return array(&#xA;    &quot;Lorem ipsum. &amp;lt;a href='{url}' target='_blank'&amp;gt;Aenean commodo ligula&amp;lt;/a&amp;gt; eget dolor.&quot; =&amp;gt; &quot;Lorem ipsum. &amp;lt;a href='{url}' target='_blank'&amp;gt;Aenean commodo ligula&amp;lt;/a&amp;gt; eget dolor.&quot;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Are there any other ways to do this that lead to a better separation of translatable text and HTML that relates to how the translator can interact with that text?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-09-01T01:49:17.660" LastActivityDate="2016-09-01T01:49:17.660" Title="What is the best way to make text that has html translatable?" Tags="&lt;localization&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16624" PostTypeId="1" AcceptedAnswerId="16630" CreationDate="2016-09-01T01:00:49.030" Score="1" ViewCount="146" Body="&lt;p&gt;I want to display some content only if a user from a certain group (wholesalers) is currently logged-in. The following syntax seems to work - but is there something more shorthand than the nested conditionals I'm using?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% if currentUser.isInGroup('wholesalers') %}&#xA;        Do something here...&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4962" LastActivityDate="2016-09-01T07:34:48.233" Title="Login test for user's group?" Tags="&lt;conditional&gt;&lt;login&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16625" PostTypeId="2" ParentId="16622" CreationDate="2016-09-01T01:13:26.237" Score="3" Body="&lt;p&gt;You could achieve this by using a Matrix field for complex content or the awesome Super Table field for something a little more basic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how complicated the content is you are putting in the tabs would determine if you would use either the Matrix or Super Table fields respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the Super Table plugin if you aren't already using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-09-01T04:13:04.067" LastActivityDate="2016-09-01T04:13:04.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16626" PostTypeId="2" ParentId="16624" CreationDate="2016-09-01T03:07:41.537" Score="1" Body="&lt;p&gt;You could use a &lt;code&gt;switch&lt;/code&gt; statement or an &lt;code&gt;if&lt;/code&gt; statement using &lt;code&gt;getGroups()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of me taking all the credit, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1578/how-do-you-display-a-users-user-group&quot;&gt;here is a great thread along with an example&lt;/a&gt; of using &lt;code&gt;getGroups&lt;/code&gt; at the template level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what that might look like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12762/get-groups-from-user-in-plugin&quot;&gt;within a plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the actual ID of the group - I'm sure there is a more scientific way, but If I'm always going to know what the ID is, I'll just hover over the handle and look at the url. It will be something like &lt;code&gt;/settings/users/groups/2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-01T03:07:41.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16627" PostTypeId="1" AcceptedAnswerId="16628" CreationDate="2016-09-01T03:15:07.560" Score="1" ViewCount="159" Body="&lt;p&gt;I have a page that will allow the user to change their name, email address etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have an &lt;code&gt;email&lt;/code&gt; field on my page and submit I get this error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Param “password” doesn’t exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have read that in order to change a users' email, they need to enter their existing password. I don't have the password field on my profile page...I suppose I could.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I make the whole thing an ajax submit, if the email has changed - show a modal or something asking for a password?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How have others solved this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-09-01T03:44:34.717" Title="What is the least intrusive way to allow a user to change their email address on the front-end?" Tags="&lt;plugin-development&gt;&lt;user-profile&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16628" PostTypeId="2" ParentId="16627" CreationDate="2016-09-01T03:44:34.717" Score="3" Body="&lt;p&gt;On the front-end of the site, if you're going through Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow&quot;&gt;UsersController-&gt;actionSaveUser()&lt;/a&gt;, then you're correct... we do require the current user's existing password to create an &lt;a href=&quot;https://craftcms.com/news/new-security-features&quot; rel=&quot;nofollow&quot;&gt;elevated session&lt;/a&gt; for several security purposes.  How you present that to the user is completely up to you (as with anything else front-end related in Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you absolutely, 100%, don't want that workflow and are willing to accept the security risks of bypassing that behavior, then you can create your own plugin that exposes its own controller action, point your form to it and do whatever necessary business logic needed (modifying email directly in the database, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-01T03:44:34.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16629" PostTypeId="1" CreationDate="2016-09-01T06:50:16.340" Score="3" ViewCount="147" Body="&lt;p&gt;I'm trying to query a range of entries and my results are not returning all the entries in the range I am trying to target. My situation relates to displaying data on a chart using the Craft ChartHelper class, but I'm not sure if this issue is specific to that situation or more general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe Craft saves records to the database based on the UTC timezone. So if I'm in Los Angeles (UTC-7) and save an Entry on &lt;code&gt;2016-08-31 18:00:00&lt;/code&gt; in Los Angeles, the &lt;code&gt;dateCreated&lt;/code&gt; value in the database will be 7 hours later in the UTC/GMT timezone: &lt;code&gt;2016-09-01 01:00:00&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to query all entries that happened in the month of August. The following, largely taken from the Craft Commerce chart codebase, gets me roughly what I need – entries that range over the month of August:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$startDate = DateTime::createFromString('2016-08-01', craft()-&amp;gt;timezone);&#xA;$endDate   = DateTime::createFromString('2016-08-31', craft()-&amp;gt;timezone);&#xA;$endDate-&amp;gt;modify('+1 day');&#xA;&#xA;$criteria         = $this-&amp;gt;getElementCriteria();&#xA;$criteria-&amp;gt;limit  = null;&#xA;$criteria-&amp;gt;search = null;&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria)&#xA;  -&amp;gt;select('COUNT(elements.id) as value');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code gets handed off to the &lt;code&gt;ChartHelper::getRunChartDataFromQuery()&lt;/code&gt; method which performs the query with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$results = $query&#xA;  -&amp;gt;addSelect(&quot;DATE_FORMAT({$dateColumn}, '{$sqlDateFormat}') as date&quot;)&#xA;  -&amp;gt;andWhere(&#xA;    array('and', $dateColumn.' &amp;gt;= :startDate', $dateColumn.' &amp;lt; :endDate'),&#xA;    array(':startDate' =&amp;gt; $startDate-&amp;gt;mySqlDateTime(), ':endDate' =&amp;gt; $endDate-&amp;gt;mySqlDateTime()))&#xA;  -&amp;gt;group($sqlGroup)&#xA;  -&amp;gt;order($dateColumn.' asc')&#xA;  -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While I get back a month's worth of entries, the query does not return entries that were saved after 5pm on August 31st in Los Angeles. I believe this is because the &lt;code&gt;dateCreated&lt;/code&gt; value in the database is actually on the following day, September 1st.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to adjust this query to return entries from within the month of the timezone of the website – in this case Los Angeles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do I need to adjust how the date values are being set in order to get back the right data?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-20T19:33:30.183" Title="How to query entries and take into account the timezone offset? - ChartHelper" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16630" PostTypeId="2" ParentId="16624" CreationDate="2016-09-01T07:34:48.233" Score="0" Body="&lt;p&gt;You could combine your conditions like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('wholesalers') %}&#xA;  Do something here...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-09-01T07:34:48.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16631" PostTypeId="2" ParentId="16615" CreationDate="2016-09-01T07:58:19.153" Score="7" Body="&lt;p&gt;You won't be able to collect all information and take payment using one form/action. The customer information is added to the cart using &lt;code&gt;commerce/cart/updateCart&lt;/code&gt; and payment is processed using &lt;code&gt;commerce/payments/pay&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show the available shipping methods to a customer, Craft Commerce needs to know the shipping address to match against the rules you've set up. For this reason you'll need to split your checkout into separate forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built a &quot;one-page&quot; checkout with 'Customer Details', 'Delivery Method' and 'Payment' sections. Each section has a 'Continue' button that submits the information and updates the cart. Each section has the same redirection URL (&lt;code&gt;/checkout&lt;/code&gt;) so the user lands back on the &quot;one-page&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to do away with 'Continue' buttons, you could use Javascript to submit the customer's information and receive a JSON response. This would include the available shipping methods and the cart totals which you'd use to update the page without the need for a refresh.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-09-01T07:58:19.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16632" PostTypeId="1" AcceptedAnswerId="16655" CreationDate="2016-09-01T08:30:07.157" Score="4" ViewCount="273" Body="&lt;p&gt;Twig lets you provide alternate (or multiple) template loaders. I'd like to take advantage of this to do use a bespoke loader to pull in components from a pattern library using a shorthand syntax like &lt;code&gt;{% include '*mycomponent' %}&lt;/code&gt; or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft expose the environment used for loading templates in a way that I can append/overwrite the default filesystem loader with my own custom implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers in the right direction would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5586" LastActivityDate="2016-09-02T02:48:07.817" Title="Is is possible to add a bespoke Twig template loader?" Tags="&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16633" PostTypeId="1" AcceptedAnswerId="16634" CreationDate="2016-09-01T09:40:34.583" Score="2" ViewCount="496" Body="&lt;p&gt;Trying to get my head around this and make my code a little DRYer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;_helpers&lt;/code&gt; macro file. Like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro date_formatted(givenDate) %}&#xA;    {{ givenDate|date(&quot;l, jS F Y&quot;) }}&#xA;{% endmacro %}&#xA;&#xA;{% macro product_title(product) %}&#xA;    {{ product|replace(' HA', '&amp;lt;sup&amp;gt;HA&amp;lt;/sup&amp;gt;')|raw }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This file is used in various places throughout the website and is included in various base templates using &lt;code&gt;{% import '_macros/_helpers' as helpers %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then have another macro for creating products (teasers and various code that would be repeated). This contains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% macro teaser(product, imgSize, className) %}&#xA;    {% set cart = craft.commerce.getCart() %}&#xA;    {% set category = product.category.first() %}&#xA;    {% import '_macros/_helpers' as helpers %}&#xA;&#xA;    &amp;lt;div class=&quot;product-teaser{% if className %} // {{ className }}{% endif %}&quot;&amp;gt;&#xA;        {% set thumbAsset = product.productImage.first() %}&#xA;        {% if thumbAsset %}&#xA;        &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;            &amp;lt;img&#xA;                src=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}}&quot;&#xA;                srcset=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}} 1x, {{ craft.imager.transformImage(thumbAsset, { width:imgSize * 2, height:imgSize * 2 }) }} 2x&quot;&#xA;                alt=&quot;{{ product.title }}&quot;&#xA;                class=&quot;product-teaser__img&quot;&#xA;            /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;h3 class=&quot;product-teaser__title{% if className %} // {{ className }}__title{% endif %}&quot;&amp;gt;{{ helpers.product_title(product.title) }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p class=&quot;product-teaser__price{% if className %} // {{ className }}__price{% endif %}&quot;&amp;gt;{{ product.defaultPrice|currency(cart.currency) }}&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ product.url }}&quot; class=&quot;btn // btn--sub&quot;&amp;gt;View Product&amp;lt;/a&amp;gt;&#xA;&#xA;            {% if className == &quot;product-teaser--featured&quot; %}&#xA;                &amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;btn // btn--base&quot;&amp;gt;{{ category.title }} Range&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endmacro %}&#xA;&#xA;&#xA;{% macro alsoPurchased(product, imgSize) %}&#xA;    {% set cart = craft.commerce.getCart() %}&#xA;    {% import '_macros/_helpers' as helpers %}&#xA;&#xA;    &amp;lt;li class=&quot;productAlsoPurchased__item&quot;&amp;gt;&#xA;        {% set thumbAsset = product.productImage.first() %}&#xA;        {% if thumbAsset %}&#xA;        &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;            &amp;lt;img&#xA;                src=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}}&quot;&#xA;                srcset=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}} 1x, {{ craft.imager.transformImage(thumbAsset, { width:imgSize * 2, height:imgSize * 2 }) }} 2x&quot;&#xA;                alt=&quot;{{ product.title }}&quot;&#xA;                class=&quot;productAlsoPurchased__img&quot;&#xA;            /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;p class=&quot;productAlsoPurchased__content&quot;&amp;gt;&#xA;            &amp;lt;strong&amp;gt;{{ helpers.product_title(product.title) }}&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&#xA;            &amp;lt;span class=&quot;product-teaser__price&quot;&amp;gt;{{ product.defaultPrice|currency(cart.currency) }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem/question I have come up against is that it seems I have to include &lt;code&gt;{% import '_macros/_helpers' as helpers %}&lt;/code&gt; in each Macro and also the same goes for setting the variable for cart. &lt;code&gt;{% set cart = craft.commerce.getCart() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way of doing this? Or a DRYer way of doing this? So I don't have to repeat my includes and setting of variables for each Macro block?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="22" LastEditDate="2017-05-09T21:37:55.817" LastActivityDate="2017-05-09T21:37:55.817" Title="Macros, Variables and Includes" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;variable&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16634" PostTypeId="2" ParentId="16633" CreationDate="2016-09-01T11:56:48.927" Score="3" Body="&lt;p&gt;You aren't able to pass an import into a macro. So &lt;code&gt;helpers&lt;/code&gt; needs to be imported into each macro file that uses it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can however pass the &lt;code&gt;cart&lt;/code&gt; to your macros. As a side note, it's definitely best to set the &lt;code&gt;cart&lt;/code&gt; variable in a global template - this means you're only ever setting it once. All templates that extend this global template then inherit &lt;code&gt;cart&lt;/code&gt;. The way macro's work though means they need to have these variables &lt;em&gt;explicitly passed to them&lt;/em&gt;. They don't inherit variables in the same way includes do or when you extend templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then pass &lt;code&gt;cart&lt;/code&gt; to your macro like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Variable set in an extended template or current template #}&#xA;{% set cart = craft.commerce.cart %}&#xA;&#xA;{# Variable is passed to the macro #}&#xA;{{ teaser(product, imgSize, className, cart) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Macro file then edited to take variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro teaser(product, imgSize, className, cart) %}&#xA;    {# We still need to import our helpers into this macro file #}&#xA;    {% import '_macros/_helpers' as helpers %}&#xA;&#xA;    {% set category = product.category.first() %}&#xA;&#xA;    &amp;lt;div class=&quot;product-teaser{% if className %} // {{ className }}{% endif %}&quot;&amp;gt;&#xA;        {% set thumbAsset = product.productImage.first() %}&#xA;        {% if thumbAsset %}&#xA;        &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;            &amp;lt;img&#xA;                src=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}}&quot;&#xA;                srcset=&quot;{{ craft.imager.transformImage(thumbAsset, { width:imgSize, height:imgSize })}} 1x, {{ craft.imager.transformImage(thumbAsset, { width:imgSize * 2, height:imgSize * 2 }) }} 2x&quot;&#xA;                alt=&quot;{{ product.title }}&quot;&#xA;                class=&quot;product-teaser__img&quot;&#xA;            /&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;h3 class=&quot;product-teaser__title{% if className %} // {{ className }}__title{% endif %}&quot;&amp;gt;{{ helpers.product_title(product.title) }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p class=&quot;product-teaser__price{% if className %} // {{ className }}__price{% endif %}&quot;&amp;gt;{{ product.defaultPrice|currency(cart.currency) }}&amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ product.url }}&quot; class=&quot;btn // btn--sub&quot;&amp;gt;View Product&amp;lt;/a&amp;gt;&#xA;&#xA;            {% if className == &quot;product-teaser--featured&quot; %}&#xA;                &amp;lt;a href=&quot;{{ category.url }}&quot; class=&quot;btn // btn--base&quot;&amp;gt;{{ category.title }} Range&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-09-02T08:44:02.317" LastActivityDate="2016-09-02T08:44:02.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16635" PostTypeId="2" ParentId="16606" CreationDate="2016-09-01T12:18:32.173" Score="2" Body="&lt;p&gt;Found the answer - I had to paginate the children of &quot;inhoud&quot;. Works like a charm now :-)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for inhoud in entry.getDescendants() %}&#xA;        {% if inhoud.type == 'segment' %}&#xA;            &amp;lt;section id=&quot;{{ inhoud.title|kebab }}&quot; class=&quot;segment&quot;&amp;gt;&#xA;                &amp;lt;h2 class=&quot;section-h2&quot;&amp;gt;{{ inhoud.title }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;/section&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% paginate inhoud.children.limit(10) as pageInfo, pageEntries %}&#xA;        {% for inhoud in pageEntries %}&#xA;           {% for inhoud in inhoud.trace %}&#xA;              {% include [&quot;trace/&quot; ~ inhoud.type, &quot;trace/default&quot; ] %}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;&#xA;     {% if pageInfo.totalPages&amp;gt;1 %}&#xA;            &amp;lt;div class=&quot;pagination&quot; style=&quot;border-bottom: 0;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;w-row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;pagination-left w-col w-col-6&quot;&amp;gt;&#xA;                        &amp;lt;div&amp;gt;pagina {{ pageInfo.currentPage }} van {{ pageInfo.totalPages }}&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;pagination-right w-col w-col-6&quot;&amp;gt;&#xA;                        &amp;lt;a class=&quot;pag-link&quot;&amp;gt;&#xA;                            {% if pageInfo.prevUrl %}&#xA;                            &amp;lt;a class=&quot;pag-link&quot; href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;&amp;lt;/a&amp;gt;{% endif %}&#xA;                            {% for page, url in pageInfo.getPrevUrls(2) %}&#xA;                                &amp;lt;a href=&quot;{{ url }}&quot; class=&quot;pag-link&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                            {% endfor %}&#xA;                            &amp;lt;span&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/span&amp;gt;&#xA;                            {% for page, url in pageInfo.getNextUrls(2) %}&#xA;                                &amp;lt;a class=&quot;pag-link&quot; href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;                            {% endfor %}&#xA;                            {% if pageInfo.nextUrl %}&#xA;                            &amp;lt;a class=&quot;pag-link&quot; href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;&amp;lt;/a&amp;gt;{% endif %}&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2016-09-01T12:18:32.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16636" PostTypeId="2" ParentId="16609" CreationDate="2016-09-01T13:42:48.883" Score="2" Body="&lt;p&gt;Your above code is not working because you are using &quot;block&quot; instead of &quot;item&quot; in your children. So...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in block.children %}&#xA;    {% switch item.type.handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't necessarily need to do a switch here, you could do a series of includes and make their file names match your block type... so &quot;_includes/neo/box.twig&quot; and &quot;_includes/neo/image.twig&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example below I am replacing &quot;item&quot; with &quot;child&quot; to explain it better.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixNeo.level(1) %}&#xA;      &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;      {% for child in block.children %}&#xA;           {% include &quot;_includes/neo/&quot; ~ child.type %}&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-01T13:42:48.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16637" PostTypeId="1" CreationDate="2016-09-01T14:55:15.063" Score="0" ViewCount="760" Body="&lt;p&gt;I'm using a macro to check segment 1 to set an active state on my navigation and all is working correctly. However I would like to change it so that if segment_2 is not empty it doesn't display the active state, with the exception of being pagination in segment-2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;code&gt;domain.com/photography&lt;/code&gt; and &lt;code&gt;domain.com/photography/p2&lt;/code&gt; would get active but &lt;code&gt;domain.com/photography/slug&lt;/code&gt; would not be active&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my current code is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;macro:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro is_active(segment) %}{% if craft.request.firstSegment == segment %}active{% endif %}{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and nav:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;nav navbar-nav&quot;&amp;gt;&#xA;  &amp;lt;li class=&quot;{{ macro.is_active('') }}&quot;&amp;gt;&amp;lt;a href=&quot;/&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li class=&quot;{{ macro.is_active('photography') }}&quot;&amp;gt;&amp;lt;a href=&quot;/photography&quot;&amp;gt;All Photography&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li class=&quot;{{ macro.is_active('calendar') }}&quot;&amp;gt;&amp;lt;a href=&quot;/calendar&quot;&amp;gt;Archives&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-09-01T20:10:40.330" Title="active state macro how to check if segment 2 is empty" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;macro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16639" PostTypeId="1" AcceptedAnswerId="16640" CreationDate="2016-09-01T18:13:04.177" Score="0" ViewCount="128" Body="&lt;p&gt;I've got a single set up to point to /calendar on my site. the single has only one field, SEOmatic so I can add meta title, description etc.. the rest of he page is loaded with content from the photoblog channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that I've got things organized by months and if there are no month segments in the url I redirect to the current year and month so that for example today the site would redirect to /calendar/2016/08 and when it does this the meta tags are getting pulled from the homepage single and I don't know why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a template route set like this &lt;a href=&quot;https://i.stack.imgur.com/XSEZr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XSEZr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the redirect code for the year/month the meta tags come through correctly, but if it's there no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;simplified template code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segment(2) == &quot;&quot; %}&#xA;  {% redirect &quot;/calendar/&quot; ~ now.year ~ &quot;/&quot; ~ now|date(&quot;m&quot;) %}&#xA;{% endif %}&#xA;&#xA;&#xA;{#&#xA;  // take month digit and convert to date format so we can output&#xA;  // the full month name below next to the year&#xA;  // if this isn't done will only output 08 or 09 for august or september etc...&#xA;#}&#xA;{% set viewMonth = '00-' ~ month ~ '-01' %}&#xA;&#xA;{% set entryAfterDate = year ~ '-' ~ month %}&#xA;{% set entryBeforeDate = year ~ '-' ~ (month + 1) %}&#xA;&#xA;          {% set entries = craft.entries.section('photoblog').limit(null).after(entryAfterDate).before(entryBeforeDate) %}&#xA;&#xA;          {% for entry in entries | reverse %}&#xA;&#xA;            more code here&#xA;&#xA;          {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-09-01T18:34:57.167" Title="Single not loading correctly with additional segments" Tags="&lt;routes&gt;&lt;redirect&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16640" PostTypeId="2" ParentId="16639" CreationDate="2016-09-01T18:34:57.167" Score="2" Body="&lt;p&gt;If I understand your question correctly you might be better off using &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/04.-SEO-Template-Meta&quot; rel=&quot;nofollow&quot;&gt;SEOmatic's Template Meta feature&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Template Meta you're be able to set the meta info on a per template basis. So in this case you'd create a one to use for your &lt;code&gt;calendar.html&lt;/code&gt; template.&lt;/p&gt;&#xA;" OwnerUserId="44" LastActivityDate="2016-09-01T18:34:57.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16641" PostTypeId="2" ParentId="16637" CreationDate="2016-09-01T19:14:05.323" Score="2" Body="&lt;p&gt;Not tested, but I think you can test if it is a pagination page. So &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (craft.request.getSegment('2') == '') or (craft.request.getPageNum() != 1) %}active{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-01T19:14:05.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16643" PostTypeId="2" ParentId="16637" CreationDate="2016-09-01T20:10:40.330" Score="1" Body="&lt;p&gt;Here is a possible macro. It uses &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getSegment&quot; rel=&quot;nofollow&quot;&gt;getSegment()&lt;/a&gt; to get the second segment, and twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#comparisons&quot; rel=&quot;nofollow&quot;&gt;matches&lt;/a&gt; operator to compare that segment to the page trigger. Note that there is a &lt;a href=&quot;https://craftcms.com/docs/config-settings#pageTrigger&quot; rel=&quot;nofollow&quot;&gt;pageTrigger&lt;/a&gt; setting, and this macro assumes you haven't changed that trigger.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro is_active(segment) %}&#xA;  {% set firstSeg = craft.request.getSegment(1) %}&#xA;  {% set secondSeg = craft.request.getSegment(2) %}&#xA;  {# is secondSeg a pagination segment? #}&#xA;  {% set isPagination = secondSeg and secondSeg matches '/^p[0-9]+/' %}&#xA;&#xA;  {# active: firstSeg is our segment, and no secondSeg, or secondSeg is pagination seg #}&#xA;  {% if firstSeg == 'segment' and (not secondSeg or isPagination) %}&#xA;    active&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might also want to use the &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion&quot; rel=&quot;nofollow&quot;&gt;twigperversion&lt;/a&gt; plugin which provides a &lt;code&gt;{% return %}&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro is_active(segment) %}&#xA;  ...&#xA;  {% return firstSeg == 'segment' and (not secondSeg or isPagination) %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then &lt;code&gt;{{ macro.is_active('photography') ? 'active' }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-01T20:10:40.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16644" PostTypeId="1" AcceptedAnswerId="16656" CreationDate="2016-09-01T20:50:28.847" Score="1" ViewCount="101" Body="&lt;p&gt;In the Commerce plugin, there are several ways to download a PDF of a specific order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the default formatting of the PDF filename isn't very helpful...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;⁠⁠⁠⁠Order-14ef9b78dae6893cd2ca75ec047ed9a0.pdf&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any way to control the formatting of PDF receipt filenames?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-02T03:08:33.513" Title="Change how the PDF filename is formatted?" Tags="&lt;plugin-craftcommerce&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16645" PostTypeId="1" AcceptedAnswerId="16650" CreationDate="2016-09-01T20:59:29.980" Score="1" ViewCount="400" Body="&lt;p&gt;I have a checkbox field to enable my client to choose what entry categories to have as an article feed on a page. How can I output the checked option categories when setting the entries in the for loop? Below is what I have done to return the checked option's value but what I want to do is use the checked options value to filter through entry categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm looking to do is set the entries as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category, 'checkedOptionValue','checkedOptionValue','checkedOptionValue').limit(10).find() %}&#xA;&#xA;&amp;lt;!-- This is returning the checked options value --&amp;gt;&#xA;{% for option in checkboxFieldHandle.options %}&#xA;    {% if option.selected %}&#xA;        {{ option }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="5581" LastActivityDate="2016-09-01T22:43:11.837" Title="Get entries from client checked options" Tags="&lt;checkboxes&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16646" PostTypeId="1" AcceptedAnswerId="16665" CreationDate="2016-09-01T21:43:52.873" Score="1" ViewCount="823" Body="&lt;p&gt;&lt;code&gt;craft.request.urlReferrer&lt;/code&gt; returns the full URL of the referrer, while &lt;code&gt;craft.entries.uri&lt;/code&gt; accepts the URI only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to split the URL just to get URI path, write a twig filter, a custom plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I can’t see the forest for the trees, but it seems like there should be an easier way.&lt;/p&gt;&#xA;" OwnerUserId="857" LastActivityDate="2016-09-02T16:32:46.843" Title="Querying the entry for an HTTP Referer" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16647" PostTypeId="1" AcceptedAnswerId="16649" CreationDate="2016-09-01T22:35:22.137" Score="2" ViewCount="110" Body="&lt;p&gt;In a plugin, I'd like to pull all Assets with filenames starting with a certain string (the &lt;code&gt;$prefix&lt;/code&gt; variable, in the below examples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible to do this with a custom DbCommand:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$results = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('assetfiles.*')&#xA;    -&amp;gt;from('assetfiles assetfiles')&#xA;    -&amp;gt;where(array(&#xA;        'like',&#xA;        'assetfiles.filename',&#xA;        $prefix.'%',&#xA;    ))&#xA;    -&amp;gt;queryAll();&#xA;$assets = AssetFileModel::populateModels($results);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to do this using an ElementCriteriaModel. The below doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assets = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset, array(&#xA;    'filename' =&amp;gt; 'LIKE &quot;'.$prefix.'%&quot;',&#xA;    'limit' =&amp;gt; null,&#xA;))-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example, is the syntax off, or is not possible to use LIKE in an ElementCriteriaModel parameter?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-01T22:42:31.363" Title="Is it possible to use the MySQL LIKE directive in an ElementCriteriaModel?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16648" PostTypeId="2" ParentId="16647" CreationDate="2016-09-01T22:35:54.787" Score="1" Body="&lt;p&gt;A possible workaround is to use the &lt;code&gt;search&lt;/code&gt; parameter like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assets = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset, array(&#xA;    'search' =&amp;gt; 'filename::'.$prefix.'*',&#xA;    'limit' =&amp;gt; null,&#xA;))-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-01T22:35:54.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16649" PostTypeId="2" ParentId="16647" CreationDate="2016-09-01T22:39:43.547" Score="2" Body="&lt;p&gt;The &lt;code&gt;*&lt;/code&gt; wildcard character should do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f. &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assets = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset, array(&#xA;    'filename' =&amp;gt; $prefix.'*',&#xA;    'limit' =&amp;gt; null,&#xA;))-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="1098" LastEditDate="2016-09-01T22:42:31.363" LastActivityDate="2016-09-01T22:42:31.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16650" PostTypeId="2" ParentId="16645" CreationDate="2016-09-01T22:43:11.837" Score="2" Body="&lt;p&gt;&lt;strong&gt;The most straightforward way would be to use a Categories field.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The value that a Categories field returns to the template is an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;, which fits perfectly as a value for the &lt;code&gt;.relatedTo&lt;/code&gt; parameter.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntries = craft.entries.relatedTo( entry.selectedCategories ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only circumstance where I can envision a Checkboxes field being better suited to this use-case is if you need to only provide a specific subset of the categories in a group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(If you want to make all the categories from a group available for selection, using a Categories field is definitely best; otherwise you have to go back and update the options of your Checkboxes field every time a category is created, changed, or deleted.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, I recommend using the category IDs as the option values for your checkboxes, so that you can pass them to an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntries = craft.entries.relatedTo( entry.selectedCheckboxes | join ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-09-01T22:43:11.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16651" PostTypeId="2" ParentId="16646" CreationDate="2016-09-01T23:19:43.423" Score="2" Body="&lt;p&gt;No obvious solution sticks out to me using only native Twig functions/filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be pretty trivial to write a custom filter using &lt;a href=&quot;http://php.net/manual/en/function.parse-url.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;parse_url()&lt;/code&gt;&lt;/a&gt;, though...&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-09-01T23:19:43.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16652" PostTypeId="2" ParentId="7124" CreationDate="2016-09-02T00:21:01.083" Score="1" Body="&lt;p&gt;&lt;em&gt;I don't believe myself to be an authority on this topic, nor this answer to be complete, but below I try to pull together a summary of several of the things you'll want to consider when adding localization to your plugins. Please correct me where I'm wrong and I'll try to make updates to this as I learn more until proper documentation exists.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Adding localization to your plugin will require addressing at least three different scenarios in the Control Panel:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How are you saving your data in a localized way?&lt;/li&gt;&#xA;&lt;li&gt;How are you retrieving your data in a localized way?&lt;/li&gt;&#xA;&lt;li&gt;How are you managing the UI around switching between locales?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While there may be related settings, the primary thing that gets localized in Craft is the Element.  As you localize your plugin you may need to ask: how does what I am trying to add localization support for relate to the Elements in the system?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Craft-managed tables that relate to localization&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I believe Craft will manage the locale-specific behavior for several tables in the database for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_elements_i18n&lt;/li&gt;&#xA;&lt;li&gt;craft_locales&lt;/li&gt;&#xA;&lt;li&gt;craft_routes&lt;/li&gt;&#xA;&lt;li&gt;craft_searchindex&lt;/li&gt;&#xA;&lt;li&gt;craft_templatecaches&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Element-specific tables that relate to localization&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Each respective Element Type will need to manage and make sure locale-related data is saved to the tables that relate to that specific Element Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Entries, Entries manage locale-specific data in the following tables:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_content&lt;/li&gt;&#xA;&lt;li&gt;craft_entrydrafts&lt;/li&gt;&#xA;&lt;li&gt;craft_entryversions&lt;/li&gt;&#xA;&lt;li&gt;craft_sections_i18n&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Categories manage locale-specific data with different requirements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_categorygroups_i18n&lt;/li&gt;&#xA;&lt;li&gt;craft_content&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Localization and Field Types&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Many fields get added directly to Elements via Field Layouts. By default, fields store the data they save as a field-specific column on the content table that relates to the Element the field has been added to. An Entry With a Plain Text field named &lt;code&gt;stuff&lt;/code&gt; will store it's data in the &lt;code&gt;craft_content&lt;/code&gt; table with the column name &lt;code&gt;field_stuff&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fields that use this default method of storing their data, you do not need to add additional localization support. The &lt;code&gt;craft_content&lt;/code&gt; table already has a &lt;code&gt;locale&lt;/code&gt; column and populating that value will be handled by the Element that your field is assigned to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For custom fields that are advanced enough to require a field-specific database table to store their data (consider an Address Field, perhaps), the plugin developer will need to add locale support (discussed in more detail below).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;How are you saving your data in a localized way?&lt;/h2&gt;&#xA;&#xA;&lt;h2&gt;Elements&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Craft does not do much to help you save your Element data in a locale-friendly way. You'll need to manage a lot of this on your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start off, you'll want to give your Element an &lt;code&gt;isLocalized&lt;/code&gt; method and return &lt;code&gt;true&lt;/code&gt;. One class to read up on to understand a bit more about how localization works on Element Types is the &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/IElementType&quot; rel=&quot;nofollow noreferrer&quot;&gt;IElementType Class&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Craft appears to manage saving the locale data to &lt;code&gt;craft_elements_i18n&lt;/code&gt; for you, it appears Elements that support locales also have a secondary &lt;code&gt;i18n&lt;/code&gt; table that relates to something that I don't know what to call but tend to refer to as the Element Group. The Element Group for Entries is Sections, for Categories is Category Groups, for Craft Commerce Products is Product Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_sections&lt;/li&gt;&#xA;&lt;li&gt;craft_sections_i18n&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Categories&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_categorygroups&lt;/li&gt;&#xA;&lt;li&gt;craft_categorygroups_i18n&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Commerce Products&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft_commerce_producttypes&lt;/li&gt;&#xA;&lt;li&gt;craft_commerce_producttypes_i18n&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It would seem that if your Element has URL support, and those URL Format settings are managed on the Element Group for that Element, you will need a similar &lt;code&gt;i18n&lt;/code&gt; table in your plugin for your Element.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Advanced Fields&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Advanced fields will need to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a &lt;code&gt;locale&lt;/code&gt; column to the database table that stores their field info&lt;/li&gt;&#xA;&lt;li&gt;Populate that locale column while saving data to their custom table in the Field Types &lt;code&gt;onAfterElementSave&lt;/code&gt; method. The locale ID can be found via &lt;code&gt;$this-&amp;gt;element-&amp;gt;locale&lt;/code&gt; value in your Field Type class.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;How are you retrieving your data in a localized way?&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Elements&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;When Elements are retrieved from the database using an Element Query, the Element Types &lt;code&gt;modifyElementsQuery()&lt;/code&gt; method will be called. This gives the Element a chance to make changes to the query and is where you will need to update the query to ensure that the locale is being considered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is discussed in &lt;a href=&quot;https://craftcms.stackexchange.com/a/13000/115&quot;&gt;this question here&lt;/a&gt; and seems to make sense, however, it doesn't appear to be used in the Entry or Category Elements and I cannot explain why.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Advanced Fields&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Retrieve the locale-specific record from the database when retrieving the field data in the &lt;code&gt;getInputHtml&lt;/code&gt; method.  The locale ID can be found via &lt;code&gt;$this-&amp;gt;element-&amp;gt;locale&lt;/code&gt; value in your Field Type class.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;How are you managing the UI around switching between locales?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When a user switches between locales while editing an Entry a few things need to happen. Craft appears to manage this with entries in part by reloading the page which probably also means they are re-querying the database for the content specific to the locale of the page being loaded.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://happylager.dev/admin/entries/news/slug-1/en_us&#xA;http://happylager.dev/admin/entries/news/slug-1/es&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The switch may actually be triggered by javascript. &lt;code&gt;craft.js&lt;/code&gt; has a class called &lt;code&gt;Craft.ElementEditor&lt;/code&gt; which includes a &lt;code&gt;switchLocale&lt;/code&gt; method and calls elements/getEditorHtml and an updateForm method. I don't know much more than that!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input field values for the &lt;code&gt;locale&lt;/code&gt; will need to be updated to the locale ID of the locale you want to save your data for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;en_us&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will want to give visual indications of which locale is in use as well. This may include the controls the user uses to switch between languages as well as pass the locale value to any form macros that should display a locale indicator.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;    label: &quot;Title&quot;|t,&#xA;    locale: element.locale,&#xA;    name: 'title',&#xA;    value: element.title,&#xA;    errors: element.getErrors('title'),&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;locale&lt;/code&gt; attribute in the above macro will output a locale specific indicator in the &lt;code&gt;label&lt;/code&gt; tag of the form: &lt;code&gt;&amp;lt;span class=&quot;locale&quot;&amp;gt;{{ locale }}&amp;lt;/span&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-02T00:31:29.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16653" PostTypeId="1" AcceptedAnswerId="16678" CreationDate="2016-09-02T01:34:50.410" Score="1" ViewCount="489" Body="&lt;p&gt;I’m using the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;Element API&lt;/a&gt; plugin to retrieve my entries as JSON. It is available under the &lt;code&gt;/api&lt;/code&gt; route. For getting entries in a different locale I pass a &lt;code&gt;locale&lt;/code&gt; query param and use it inside the ElementQuery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All works fine so far, BUT when I want to use &lt;code&gt;Craft::t&lt;/code&gt; inside of a transformer, I get the translations from the main locale, because this is where my &lt;code&gt;/api&lt;/code&gt; namespace lives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to modify the &lt;code&gt;locale&lt;/code&gt; that Craft is set to, from inside the Element API plugin?&lt;/p&gt;&#xA;" OwnerUserId="879" LastEditorUserId="57" LastEditDate="2016-09-02T03:10:33.747" LastActivityDate="2018-10-15T10:14:10.450" Title="Modify Craft locale inside Element API plugin?" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;plugin-elementapi&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16654" PostTypeId="2" ParentId="16607" CreationDate="2016-09-02T02:40:10.477" Score="3" Body="&lt;p&gt;Completely, 100% untested, but I think you'd be able to pull it off with a pretty simple &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that added a new &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/index.html&quot; rel=&quot;nofollow&quot;&gt;Twig filter&lt;/a&gt; (check the Twig Extensions switch).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a template you'd something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myDate|myDateFilter('es') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your plugin's &lt;code&gt;myDateFilter&lt;/code&gt; method would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function myDateFilter(\Twig_Environment $env, $date, $locale)&#xA;{&#xA;    $localeData = craft()-&amp;gt;i18n-&amp;gt;getLocaleData($locale);&#xA;    $dateFormatter = $localeData-&amp;gt;getDateFormatter();&#xA;&#xA;    return $dateFormatter-&amp;gt;formatDateTime($date-&amp;gt;getTimestamp());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-02T02:40:10.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16655" PostTypeId="2" ParentId="16632" CreationDate="2016-09-02T02:48:07.817" Score="0" Body="&lt;p&gt;When you call Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#getTwig-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;TemplatesService-&amp;gt;getTwig()&lt;/code&gt;&lt;/a&gt;  (&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;getTwig()&lt;/code&gt;), the first parameter you can pass in is your custom template loader classname.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;getTwig('\My\Awesome\Plugin\TemplateLoader, array('my' =&amp;gt; 'options')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-02T02:48:07.817" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16656" PostTypeId="2" ParentId="16644" CreationDate="2016-09-02T03:08:33.513" Score="2" Body="&lt;p&gt;There's currently not a native way to change this format, but it is planned for a future release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime as a workaround, you can listen to the &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveOrder&lt;/a&gt; event and change the order number to whatever format you want.  A by-product of that is that the PDF receipt filename should change to your format as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-02T03:08:33.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16657" PostTypeId="2" ParentId="16653" CreationDate="2016-09-02T03:16:11.887" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;Craft::t()&lt;/code&gt;&lt;/a&gt; has a whole bunch of parameters you can pass into it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function t($message, $variables = array(), $source = null, $language = null, $category = 'craft')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It sounds like what you're looking for is the 4th one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::t('my string', null, null, 'es')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;'es'&lt;/code&gt; would be a target locale other than your main one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-02T03:16:11.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16658" PostTypeId="1" AcceptedAnswerId="16659" CreationDate="2016-09-02T09:56:49.313" Score="2" ViewCount="503" Body="&lt;p&gt;Anybody got any suggestions on debugging &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; and &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; not working? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are set in &lt;code&gt;general.php&lt;/code&gt; of my config but when a user activates their account (sets their password) they are redirected to the homepage and not logged in. The user is showing as active in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hayelp!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cartoonscrapbook.com/01pics-L/penelope-pitstop_L20.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hayelp! http://www.cartoonscrapbook.com/01pics-L/penelope-pitstop_L20.jpg&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2021-05-04T23:20:12.557" Title="Auto-login on account activation" Tags="&lt;config&gt;&lt;login&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16659" PostTypeId="2" ParentId="16658" CreationDate="2016-09-02T10:28:13.467" Score="3" Body="&lt;p&gt;(Not necessarily a great answer to your question, but it's in the same wheelhouse and might be handy if you're working in this area)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remember having issues with this myself (to be honest the precise details are a bit lost in time for me - but basically IIRC it's by design that they're not logged in after creation, perhaps to force them to practise login/their password?  I can't remember but do remember I found it odd behavour) - anyway in my case the issues arose as part of adding user registration during commerce checkout.  It was discussed on Slack and the solution was that Steve Rowling made a very handy plugin to auto-login newly created users:&#xA;&lt;a href=&quot;https://github.com/steverowling/autologin&quot; rel=&quot;nofollow&quot;&gt;https://github.com/steverowling/autologin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using it, works a treat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I should also wrap up my code for registration during checkout as a plugin and release that one of these days!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-09-02T10:28:13.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16660" PostTypeId="1" AcceptedAnswerId="16668" CreationDate="2016-09-02T13:36:10.553" Score="1" ViewCount="790" Body="&lt;p&gt;We're receiving the following error when uploading Assets:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upload failed for Michael-Mabry-COO-MOOYAH-executive.png. The error&#xA;  message was: “Error uploading the file: The file&#xA;  “/nfs/c12/h03/mnt/215595/domains/mooyah.com/html/craft/storage/runtime/temp/assets57c97ea812e213.88692692.png”&#xA;  does not appear to be an image.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aGjzp.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aGjzp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assumed this was a case of the client formatting the images incorrectly, but I tried it myself and they are valid image files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone come across this before?&lt;/p&gt;&#xA;" OwnerUserId="5043" LastActivityDate="2017-08-27T11:03:26.910" Title="Error Uploading Assets" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16661" PostTypeId="1" AcceptedAnswerId="16664" CreationDate="2016-09-02T14:27:34.520" Score="1" ViewCount="130" Body="&lt;p&gt;In my base template i set some variables  like currency , currency symbol based on the IP address detected. This is done from a geolocation plugin which caches the result (ip,currency, currency symbol,lang) and makes them available to the template as {{craft.geo.info.currency}}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our site is in UK&#xA;When a visitor from overseas eg. USA comes they get dollar prices and conversions etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the product list template I am caching the entry loop with cache tags and rendering the currency symbol with the plugins global template variable like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.geo.info.currency_symbol |raw}} price XX&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;USA ip addresses sees US dollars - great!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in the UK view of product list, and within the product page template loop, we suddenly see the dollar symbol too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my footer i spit out the &lt;code&gt;{{craft.geo.info.currency_symbol}}&lt;/code&gt; with no cache tags and I get UK GBP currency as I expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess Craft/Twig is just showing the template cache regardless of plugin variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way around this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution for now is to remove the cache tags from the product list - its not that many products and performance is still good - but I'd like to know how to combine the plugin currency symbol variable within the cached loop.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-09-02T17:14:21.643" LastActivityDate="2016-09-02T17:14:21.643" Title="How can I bust a template cached plugin variable in a loop?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16662" PostTypeId="1" AcceptedAnswerId="16673" CreationDate="2016-09-02T15:00:47.070" Score="3" ViewCount="742" Body="&lt;p&gt;When a payment is made and something is incorrect e.g. card number is invalid, expiry date is in the past etc. The form just refreshes with no warning / notification of what's happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've noticed that this message is stored in the CMS on each order, under the &quot;Message&quot; column (e.g. Card Has Expired)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to output this message in to the template when the error occurs? Even on the example templates it does this issue.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2016-09-03T06:09:59.003" Title="Transaction Error Message in Template" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16663" PostTypeId="1" AcceptedAnswerId="16667" CreationDate="2016-09-02T16:09:09.837" Score="3" ViewCount="166" Body="&lt;p&gt;I spent a fair amount of time yesterday searching for any other questions that may have been answered that are similar to this one, but haven't had much luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Essentially what I want to do&lt;/strong&gt; is to daisy chain some Entry relationship fields. I'm not entirely sure if this is possible in Craft, as I haven't seen any documentation or commentary on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is how I would like to have my content organized.&lt;/strong&gt; The site will have a few channels: States, Regions, Counties, Towns and Inductees. As you can tell, the relationships basically drill-down in an obvious way: States have Regions; Regions have Counties; while Counties have both Towns and Inductees. I like the idea of being able to add a new Town, select which County it belongs to, and automatically inherit the Region and State data. Ideally, I'd like to be able to do something in a Town template like &lt;code&gt;{{entry.state.title}}&lt;/code&gt; which would pull the title of the state to which this town's county belongs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the States and Regions basically are just lists... The States page will be an archive listing all the Regions in the State. The Regions page will be an archive listing all the Counties in the Region. Would these be better suited as Categories, than Channels? If so, would there still be a way to access the State from, say, a Town or Inductee entry? I'd rather not have to rely on the content editor to have to select states and regions for each new Town/Inductee entry. I'd rather they only have to select its County.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft, so I apologize if this question seems either absurd or incoherent :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2016-09-02T16:52:36.190" Title="How/Can does Craft handle ancestor/grandparent relationships?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16664" PostTypeId="2" ParentId="16661" CreationDate="2016-09-02T16:24:14.053" Score="1" Body="&lt;p&gt;Left to itself, the &lt;code&gt;{% cache %}&lt;/code&gt; tag will cache the content per-url. The problem you have is that the same url sometimes has $'s, and sometimes has GBP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the &lt;a href=&quot;https://craftcms.com/docs/templating/cache#using-key&quot; rel=&quot;nofollow&quot;&gt;using key&lt;/a&gt; feature to cache based on the url &lt;em&gt;and&lt;/em&gt; the currency:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path ~ craft.geo.info.currency_symbol %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;code&gt;craft.geo.info.currency_symbol&lt;/code&gt; may not be the best disambiguator string, but this should get you started.)&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-02T16:24:14.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16665" PostTypeId="2" ParentId="16646" CreationDate="2016-09-02T16:32:46.843" Score="1" Body="&lt;p&gt;I ended up writing a custom Twig filter, per Michael's suggestion.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;use Twig_Extension;&#xA;use Twig_Filter_Method;&#xA;&#xA;class BusinessLogicTwigExtension extends \Twig_Extension&#xA;{&#xA;    public function getFilters()&#xA;    {&#xA;        return array(&#xA;            'pathFromUrl' =&amp;gt; new \Twig_Filter_Method($this, 'pathFromUrl')&#xA;        );&#xA;    }&#xA;&#xA;    public function getName() {&#xA;        return Craft::t('Path From URL Extension');&#xA;    }&#xA;&#xA;    public function pathFromUrl($url)&#xA;    {&#xA;        return ltrim(parse_url($url, PHP_URL_PATH), '/');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add that to a plugin, and add the &lt;code&gt;addTwigExtension&lt;/code&gt; method to your main plugin file, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function addTwigExtension() {&#xA;    Craft::import('plugins.businesslogic.twigextensions.BusinessLogicTwigExtension');&#xA;    return new BusinessLogicTwigExtension();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use the filter with &lt;code&gt;craft.entries.uri&lt;/code&gt; and &lt;code&gt;craft.request.urlReferrer&lt;/code&gt; to obtain the entry for the referring page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set referringEntry = craft.entries.uri(craft.request.urlReferrer|pathFromUrl).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="857" LastActivityDate="2016-09-02T16:32:46.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16667" PostTypeId="2" ParentId="16663" CreationDate="2016-09-02T16:52:36.190" Score="4" Body="&lt;p&gt;As usual with Craft you have several options. If you didn't need the index pages, I would suggest a &lt;code&gt;location&lt;/code&gt; category, which you organized into 3 levels: states, regions, counties. Selecting a county location would also select its containing region and state. In your town entry you would do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for l in entry.locations %}&#xA;  {{l.title}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would go through the loop three times, and &lt;code&gt;{{l.title}}&lt;/code&gt; would be the state, region, and then county.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disadvantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;nothing in Craft enforces that you properly organize your location categories&lt;/li&gt;&#xA;&lt;li&gt;nothing in Craft keeps you from choosing 3 states instead of one county for your town entry&lt;/li&gt;&#xA;&lt;li&gt;the location index pages will be hard to write&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Another option is to use a channel (or category) for states, a channel for regions, a channel for counties. The county entry would have a field for the containing region, the region entry would have a field for the containing state. And the town entry would have a field for the region. Then in the town template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.region.first.county.first.state.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will fail badly if any of the required relationships aren't there. You can test everything before you use it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.region.first %} ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use the &lt;code&gt;??&lt;/code&gt; (&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow&quot;&gt;null-coalescing&lt;/a&gt;) operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.region.first.county.first.state.title ?? 'no state' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetching the state title will be fairly expensive. You could use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow&quot;&gt;preparse&lt;/a&gt; plugin to save the state name on the town entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the index pages, you will want the regions that are &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;related to&lt;/a&gt; the state, etc.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-02T16:52:36.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16668" PostTypeId="2" ParentId="16660" CreationDate="2016-09-02T17:12:57.210" Score="0" Body="&lt;p&gt;My guess is you're using &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow&quot;&gt;GD&lt;/a&gt; for your image processing library and the PNG is in a format that it doesn't recognize. Try installing &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow&quot;&gt;Imagick&lt;/a&gt;.  Craft will use it automatically if it sees it's installed and it support a much wider range of image formats.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-02T17:12:57.210" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16669" PostTypeId="2" ParentId="342" CreationDate="2016-09-02T17:27:21.027" Score="2" Body="&lt;p&gt;I'm personally using Disqus for most things; though Facebook Comments make sense for some sites as well.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-09-02T17:27:21.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16670" PostTypeId="1" CreationDate="2016-09-02T17:37:03.037" Score="1" ViewCount="173" Body="&lt;p&gt;In Craft, is it possible to map one field containing string value to another?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bunch of image assets that has a title field and &lt;code&gt;altTag&lt;/code&gt; fields. I've entered data into the alt tag field, but now I would like to copy that data for each asset into the &lt;code&gt;title&lt;/code&gt; field for that same asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing this manually for each asset would take forever, but it sounds like something that could be done with mysql queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I poked around the database to see where the &lt;code&gt;title&lt;/code&gt; fields or the &lt;code&gt;altTag&lt;/code&gt; fields are stored. The &lt;code&gt;altTag&lt;/code&gt; field is in the &lt;code&gt;craft_fields&lt;/code&gt; table, and I can see all my assets in the &lt;code&gt;craft_assetfiles&lt;/code&gt; table. But &lt;code&gt;title&lt;/code&gt; is not one of the columns in this table, I do see the &lt;code&gt;filename&lt;/code&gt; column. But I think my knowledge of the structure of craft tables are lacking to find where the values for the &lt;code&gt;altTag&lt;/code&gt; fields are stored or how to copy the value of each alt tag into the corresponding title field for the asset.&lt;/p&gt;&#xA;" OwnerUserId="5286" LastEditorUserId="57" LastEditDate="2016-09-02T20:42:41.773" LastActivityDate="2016-09-02T20:42:41.773" Title="Map one asset attribute field to another using MySQL" Tags="&lt;assets&gt;&lt;relations&gt;&lt;database&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16671" PostTypeId="2" ParentId="16670" CreationDate="2016-09-02T19:36:35.783" Score="1" Body="&lt;p&gt;You want to look at the &lt;code&gt;craft_content&lt;/code&gt; table. There you should find the &lt;code&gt;title&lt;/code&gt; column and the &lt;code&gt;field_altTag&lt;/code&gt; column. You could set the &lt;code&gt;title&lt;/code&gt; to the &lt;code&gt;field_altTag&lt;/code&gt; value where that value is not empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back up the database first...&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-02T19:36:35.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16672" PostTypeId="2" ParentId="12816" CreationDate="2016-09-02T23:02:30.403" Score="2" Body="&lt;p&gt;If your categories are only one level deep, you could hard-code the breadcrumbs into the category template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block breadcrumb %}&#xA;  &amp;lt;ul class=&quot;breadcrumbs&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;_layout.html&lt;/code&gt; you would have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block breadcrumb %}&#xA;  &amp;lt;ul class=&quot;breadcrumbs&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% if craft.request.segments %}&#xA;      {% for crumb in entry.getAncestors() %}&#xA;        &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;li&amp;gt;{{ entry.title() }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Haven't tried this myself, but I think it would work - the category template would override the layout. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if you have multiple levels of categories, the intermediate levels won't be included, so it's not an ideal solution.&lt;/p&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2016-09-02T23:02:30.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16673" PostTypeId="2" ParentId="16662" CreationDate="2016-09-03T06:09:59.003" Score="6" Body="&lt;p&gt;The error messages are returned to the template as flash messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Handling those is documented here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.session&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.session&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to watch out for is that flash messages are only available once, and are by default 'consumed' when you retrieve them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.session.getFlashes() }}&#xA;...some other template code here....&#xA;{{ craft.session.getFlashes() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...if there is a message, the first tag will output it, but the second one won't as it has been consumed.  So best to set the message to a variable if you want to save it, or you can call &lt;code&gt;craft.session.getFlashes(false)&lt;/code&gt; to stop the message from being consumed if you'll want to use it later in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During development it is worth having some code to always display the flash messages at the top or bottom of your main layout template, so you can see them as they are occurring, and thus anticipate what you might need to handle.  I use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if craft.config.devMode and (craft.session.hasFlash('notice') or craft.session.hasFlash('error')) %}&#xA;&#xA;    {% set noticeFlash = craft.session.getFlash('notice')|join('|') %}&#xA;    {% set errorFlash = craft.session.getFlash('error')|join('|') %}&#xA;&#xA;    Notice: [{{  noticeFlash }}]&#xA;    Error: [{{  errorFlash }}]&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, if you're doing your payment operations via ajax, things are a little different...that case you'll get back results in json.  If there is an error, it will look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;error&quot;:[&quot;Credit Card Invalid&quot;]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in your js you would check for the lack of &lt;code&gt;response.success&lt;/code&gt; and then look for this error message.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-09-03T06:09:59.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16674" PostTypeId="1" AcceptedAnswerId="16911" CreationDate="2016-09-03T07:56:41.997" Score="2" ViewCount="1303" Body="&lt;p&gt;This is so simple in ExpressionEngine and yet I've tried everything for several hours and can't find a way to get it working in Craft???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 User Groups: &lt;strong&gt;userGroup1&lt;/strong&gt;, &lt;strong&gt;userGroup2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the currently logged-in User belongs to &lt;strong&gt;either&lt;/strong&gt; of those groups, show them &quot;==SECRET CONTENT==&quot; that guests (not logged-in users) do not see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following IF will only show &quot;==SECRET CONTENT==&quot; to userGroup1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('userGroup1') %}&#xA;    ==SECRET CONTENT==&#xA;{% endif #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, based on everything I've found and read, it would seem the following &lt;strong&gt;SHOULD&lt;/strong&gt; show ==SECRET CONTENT== to Users belonging to EITHER &lt;strong&gt;userGroup1&lt;/strong&gt; OR &lt;strong&gt;userGroup2&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('userGroup1','userGroup2') %}&#xA;    ==SECRET CONTENT==&#xA;{% endif #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it only shows ==SECRET CONTENT== to &lt;strong&gt;userGroup1&lt;/strong&gt;. And if I switch the isInGroup values to the following, only &lt;strong&gt;userGroup2&lt;/strong&gt; see the ==SECRET CONTENT==&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('userGroup2','userGroup1') %}&#xA;    ==SECRET CONTENT==&#xA;{% endif #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried Group IDs. I've tried every variation of formatting, array syntax, etc. &#xA;I've searched the docs and StackExchange dozens of times...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I display &quot;==SECRET CONTENT==&quot; to users belonging to &lt;strong&gt;userGroup1 OR userGroup2&lt;/strong&gt; ??&lt;/p&gt;&#xA;" OwnerUserId="5593" LastActivityDate="2016-09-21T17:42:19.110" Title="Show content if logged in user is in userGroup1 OR userGroup2?" Tags="&lt;conditional&gt;&lt;user-groups&gt;&lt;current-user&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16675" PostTypeId="2" ParentId="16674" CreationDate="2016-09-03T08:29:46.510" Score="9" Body="&lt;p&gt;According to the docs, the &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel#isInGroup-detail&quot;&gt;&lt;code&gt;userModel.isInGroup()&lt;/code&gt;&lt;/a&gt; method takes a &quot;user group model, its handle, or ID&quot; – in other words, it can only test for membership in a single group, not several.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want in this case is the &lt;code&gt;or&lt;/code&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and (currentUser.isInGroup('userGroup1') or currentUser.isInGroup('userGroup2')) %}&#xA;    {# secret content #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-03T08:29:46.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16676" PostTypeId="1" CreationDate="2016-09-03T09:04:43.883" Score="0" ViewCount="150" Body="&lt;p&gt;I'm using the craft contact form plugin and I am trying to format the sent email as html. I have added the following to the primary contact form plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;    {&#xA;        craft()-&amp;gt;on('contactForm.onBeforeMessageCompile', function(Event $event) {&#xA;            $postedMessage = $event-&amp;gt;params['postedMessage'];&#xA;            $event-&amp;gt;messageFields = $postedMessage;&#xA;&#xA;            $html = '';&#xA;            foreach ($event-&amp;gt;messageFields as $field) {&#xA;                $html .= '&amp;lt;p&amp;gt;'.$field.'&amp;lt;/p&amp;gt;';&#xA;            }&#xA;&#xA;            $event-&amp;gt;message = $html;&#xA;            $event-&amp;gt;htmlMessage = $html;&#xA;        });&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simply to format into paragraphs. The event is fired ok and the desired output is being created. However the plugin service does not seem to be picking up the the htmlMessage variable has been set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently this sends the email as plain text showing the paragraphs in the text as per $event-&gt;message but even if I remove $event-&gt;message it still sends the default plain text message ignoring the html one has been set. Any ideas anyone?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-09-03T14:25:48.793" Title="Craft Contact Form Not Picking Up HTML" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-09-03T15:02:11.320" ContentLicense="CC BY-SA 3.0" />
  <row Id="16678" PostTypeId="2" ParentId="16653" CreationDate="2016-09-03T14:04:59.927" Score="1" Body="&lt;p&gt;I tried solving my problem by passing the additional parameters to the &lt;code&gt;Craft::t()&lt;/code&gt; function mentioned by Brad. For static translations this worked fine, but it still left me with wrong formatted dates inside of twig templates, that were rendered by my transformer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found another solution to the problem: Setting the current language globally on the craft instance by using &lt;code&gt;craft()-&amp;gt;setLanguage()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my code looks like this inside &lt;code&gt;craft/config/elementapi.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; function () {&#xA;        'api/galleries' =&amp;gt; function () {&#xA;            $locale = craft()-&amp;gt;request-&amp;gt;getQuery('locale', craft()-&amp;gt;getLanguage());&#xA;            craft()-&amp;gt;setLanguage($locale);&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; [&#xA;                    'section' =&amp;gt; 'galleries',&#xA;                    'locale' =&amp;gt; $locale&#xA;                ],&#xA;                'transformer' =&amp;gt; new GalleryTransformer()&#xA;            ];&#xA;        }&#xA;    }&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you set the language globally like this, &lt;code&gt;Craft:t()&lt;/code&gt; works like expected, without specifying the additional parameters.&lt;/p&gt;&#xA;" OwnerUserId="879" LastActivityDate="2016-09-03T14:04:59.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16679" PostTypeId="2" ParentId="14183" CreationDate="2016-09-03T14:22:49.753" Score="4" Body="&lt;p&gt;I had the same problem lately and solved it with a &lt;code&gt;locale&lt;/code&gt; query parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for this inside &lt;code&gt;craft/config/elementapi.php&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; function () {&#xA;        'entries.json' =&amp;gt; function () {&#xA;            // Get the `locale` query param and fallback to&#xA;            // current locale if not defined.&#xA;            $locale = craft()-&amp;gt;request-&amp;gt;getQuery('locale', craft()-&amp;gt;getLanguage());&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; [&#xA;                    'section' =&amp;gt; 'myEntries',&#xA;                    'locale' =&amp;gt; $locale&#xA;                ],&#xA;                'transformer' =&amp;gt; new EntriesTransformer()&#xA;            ];&#xA;        }&#xA;    }&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to use static translations or formatted dates inside your &lt;code&gt;transformer&lt;/code&gt; you will need to specify the locale for that too. Look at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16653/modify-craft-locale-inside-element-api-plugin&quot;&gt;Modify Craft locale inside Element API plugin?&lt;/a&gt; for a possible solutions.&lt;/p&gt;&#xA;" OwnerUserId="879" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-03T14:22:49.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16680" PostTypeId="2" ParentId="16676" CreationDate="2016-09-03T14:25:48.793" Score="1" Body="&lt;p&gt;We just fixed this yesterday with &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/tree/1.8.1&quot; rel=&quot;nofollow&quot;&gt;Contact Form 1.8.1&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-09-03T14:25:48.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16681" PostTypeId="1" AcceptedAnswerId="16688" CreationDate="2016-09-04T03:29:23.540" Score="4" ViewCount="1369" Body="&lt;p&gt;I've installed the latest ImageMagick on my ubuntu 14 server. If I force imageDriver to use 'imagick', I can only upload Gif images. And if I force it to use GD, I can upload all images but only static gif images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/639DA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/639DA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images are not changed in any programs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important for me to have both options. Any ideas what this issues can be? I use php 7.0 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Upload failed for background.jpg. The error message was: “Error uploading the file: The file “/var/www/html/craftcms/craft/storage/runtime/temp/assets57cb93709cf445.74590720.jpg” does not appear to be an image.”&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5525" OwnerDisplayName="william" LastEditorUserId="5525" LastEditDate="2016-09-04T12:34:57.267" LastActivityDate="2016-09-05T12:58:20.813" Title="The file does not appear to be an image. Bug?" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16682" PostTypeId="1" AcceptedAnswerId="16686" CreationDate="2016-09-04T21:42:04.183" Score="4" ViewCount="181" Body="&lt;p&gt;Say I have a record defining a foreign key relationship which is set to required, such as:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return [&#xA;        'type' =&amp;gt; [&#xA;            static::BELONGS_TO,&#xA;            'Events_EventTypeRecord',&#xA;            'required' =&amp;gt; true,&#xA;            'onDelete' =&amp;gt; static::CASCADE&#xA;        ]&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try to save the record with &lt;code&gt;typeId&lt;/code&gt; not set I'll eventually get a database exception but the error won't show up if I call &lt;code&gt;$record-&amp;gt;validate()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I make a relationship fail validation?&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-09-05T16:21:45.100" Title="How do I include record relationships in validation?" Tags="&lt;relations&gt;&lt;validation&gt;&lt;records&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16683" PostTypeId="1" CreationDate="2016-09-04T23:40:17.577" Score="1" ViewCount="197" Body="&lt;p&gt;I tried to upgrade a website that I have to the latest version 2.6.2930 from an older 2.6.2804 and for an unknown reason the upgrade failed. I couldn't log in the administration area but the front end was working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I tried to roll back to an old backup that I had 20 days ago. So I restored mysql database askitis.gr_160813_184933_v2.6.2804.sql and I uploaded only the folder /craft/app from the older version of craft Craft-2.6.2804&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I get to the website administration panel I get the button to finish up the installation like I'm updating the website. Any ideas what's going on? According to everything I read in order to roll back you need the db and files to be of the same version. I check the craft_info and this is the case&lt;/p&gt;&#xA;" OwnerUserId="4337" LastActivityDate="2016-09-05T21:08:51.113" Title="Problem with manual upgrade" Tags="&lt;updating&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16684" PostTypeId="2" ParentId="16683" CreationDate="2016-09-04T23:57:29.570" Score="2" Body="&lt;p&gt;Delete your &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; and &lt;code&gt;craft/storage/runtime/compiled_templates&lt;/code&gt; folder after doing this manual update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise Craft still references the (now renamed) Garnish Javascript, and the UI for the AdminCP is not functional.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-09-04T23:57:29.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16686" PostTypeId="2" ParentId="16682" CreationDate="2016-09-05T04:43:21.283" Score="3" Body="&lt;p&gt;Yii/Active Record won't do this by default.  You'd need to manually add an &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CExistValidator&quot; rel=&quot;nofollow&quot;&gt;exists&lt;/a&gt; validation rule to the &lt;code&gt;typeId&lt;/code&gt; attribute to get it to behave like you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-05T04:43:21.283" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16687" PostTypeId="1" CreationDate="2016-09-05T08:35:23.020" Score="1" ViewCount="350" Body="&lt;p&gt;I need to build a product page with filters on the side to filter the product by : price ( less than 100, between 100 and 200 , between 200 and 300 , greater than 300 ) &#xA;and also by category,&#xA;Category only now is working : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;   {% paginate craft.commerce.products.relatedTo(category).limit(limit) as products %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not using variants right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;" OwnerUserId="5598" LastActivityDate="2017-09-26T18:06:40.247" Title="Need to build products page with filters (price, category,..etc)" Tags="&lt;plugin-craftcommerce&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16688" PostTypeId="2" ParentId="16681" CreationDate="2016-09-05T09:28:36.380" Score="4" Body="&lt;p&gt;That error will occur if the fileinfo extension or imagick (ImageMagick) extension are not configured with a comprehensive list of file MIME types (the &quot;magic file&quot;, as they refer to it, I think), or the images you're uploading aren't really images despite their extensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding GIFs - you must use ImageMagick if you want to upload animated GIFs, as it's not possible for Craft to reconstruct an animated gif using the GD library.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="1098" LastEditDate="2016-09-05T12:58:20.813" LastActivityDate="2016-09-05T12:58:20.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16689" PostTypeId="1" CreationDate="2016-09-05T10:37:32.027" Score="2" ViewCount="248" Body="&lt;p&gt;I am using the Dukt Twitter plugin and want to display the time since the tweet was created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Twitter API returns a string in the format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fri Sep 02 14:42:42 +0000 2016&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use the date filter on this string to alter the format, but cannot pass this through the &lt;code&gt;diff&lt;/code&gt; method that twig exposes. I think I need to create a dateTime object, would this require a plugin to be created for this task or can I achieve this in twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A reference post on this forum discusses the &lt;code&gt;diff&lt;/code&gt; method: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9137/get-age-from-date-of-birth/9138#9138&quot;&gt;Get Age from Date of Birth&lt;/a&gt; - however I think I need to have a date object, not a string, to use it. Ideally I'd like to just achieve this in twig as I have never written a plugin before! Thanks&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-09-05T12:42:24.697" Title="Twitter plugin - Time since tweet" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16690" PostTypeId="2" ParentId="16689" CreationDate="2016-09-05T11:04:15.390" Score="2" Body="&lt;p&gt;You can use the date method for creating a date object. &#xA;e.g.: &#xA;&lt;code&gt;{% set tweetDate = date(&quot;Fri Sep 02 14:42:42 +0000 2016&quot;) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5599" LastActivityDate="2016-09-05T11:04:15.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16691" PostTypeId="2" ParentId="16689" CreationDate="2016-09-05T11:14:27.123" Score="2" Body="&lt;p&gt;Great! Thank you @techgyver&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my final code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tweet in tweets %}&#xA;{% set tweetDate = date(tweet.created_at).diff(now).format('%a') %}&#xA;    {% if tweetDate == 0 %}&#xA;        {% set tweetTimeAgo = 'today' %}&#xA;    {% else %}&#xA;        {% set tweetTimeAgo = tweetDate ~ ' days ago' %}&#xA;    {% endif %}&#xA;&#xA;&amp;lt;div class=&quot;tweet-time&quot;&amp;gt;{{ tweetTimeAgo }}&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;tweet-text&quot;&amp;gt;{{ tweet.text|autoLinkTweet }}&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which either outputs 'today' or '3 days ago' depending on diff since tweet.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-09-05T11:14:27.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16692" PostTypeId="2" ParentId="16689" CreationDate="2016-09-05T12:42:24.697" Score="2" Body="&lt;p&gt;Further to Adam's answer, and for everyone else who is reading this question, there is a Craft plugin that can do the date calculation logic, as well as providing more readable timestamps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/blue-mantis/BM-Time-Ago-In-Words&quot; rel=&quot;nofollow&quot;&gt;https://github.com/blue-mantis/BM-Time-Ago-In-Words&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well as '...days ago' it extends into weeks and months, which may not be &lt;em&gt;as&lt;/em&gt; useful in this scenario but could prove more useful for blog/news sections.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-09-05T12:42:24.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16693" PostTypeId="2" ParentId="4928" CreationDate="2016-09-05T12:57:49.890" Score="5" Body="&lt;p&gt;I just published a plugin called &lt;a href=&quot;https://github.com/mmikkel/limitblocktype&quot; rel=&quot;noreferrer&quot;&gt;Limit Block Type&lt;/a&gt;, which adds the ability to limit Matrix blocks per block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/7192758-limit-matrix-blocks-per-block-type&quot; rel=&quot;noreferrer&quot;&gt;feature request&lt;/a&gt; for adding this feature to core.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-05T12:57:49.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16694" PostTypeId="1" CreationDate="2016-09-05T15:32:06.087" Score="2" ViewCount="431" Body="&lt;p&gt;I have some entries and I want to order them in the Control Panel based on a date field of those entries. Is that possible ?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-09-05T17:05:22.590" LastActivityDate="2016-09-05T17:41:25.930" Title="Order entries based on date field in the Control Panel" Tags="&lt;entries&gt;&lt;admin&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16695" PostTypeId="2" ParentId="16694" CreationDate="2016-09-05T15:45:24.657" Score="1" Body="&lt;p&gt;No, the only Date/Time fields you can sort entries in Craft by are Post Date, Expiry Date, Date Created or Date Updated. You can't sort your entries in Craft by a &lt;em&gt;custom&lt;/em&gt; Date/Time field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does allow you to define which fields you would like visible when viewing your sections in the control panel. To test this out, I created a new Date/Time field and tried to sort my entries by that field, but wasn't able.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention that Craft entries are sortable in the control panel by this dropdown field, but only by the Date/Time fields mentioned above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QhO20.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhO20.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-09-05T15:45:24.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16696" PostTypeId="2" ParentId="16682" CreationDate="2016-09-05T16:21:45.100" Score="2" Body="&lt;p&gt;Thanks to Brad for pointing me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added this &lt;code&gt;rules&lt;/code&gt; method to my record.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;{&#xA;   $rules = parent::rules();&#xA;&#xA;   $rules[] = [&#xA;       'typeId',&#xA;       'exist',&#xA;       'allowEmpty' =&amp;gt; false,&#xA;       'attributeName' =&amp;gt; 'id',&#xA;       'className' =&amp;gt; 'Craft\Events_EventTypeRecord',&#xA;       'message' =&amp;gt; 'You must enter a valid type'&#xA;   ];&#xA;&#xA;   return $rules;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;exist&lt;/code&gt; is &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/validators/CValidator.php#L64&quot; rel=&quot;nofollow&quot;&gt;a shortcut&lt;/a&gt; to Yii's built-in &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CExistValidator&quot; rel=&quot;nofollow&quot;&gt;CExistValidator&lt;/a&gt; validator. The other key =&gt; value pairs are properties of that built-in validator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also do it as a separate validator class. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;use CExistValidator;&#xA;&#xA;class Events_EventTypeExistValidator extends CExistValidator&#xA;{&#xA;&#xA;    public function validateAttribute($object,$attribute)&#xA;    {&#xA;        $this-&amp;gt;message = &quot;You must enter a type&quot;;&#xA;        $this-&amp;gt;allowEmpty = false;&#xA;        $this-&amp;gt;attributeName = 'id';&#xA;        $this-&amp;gt;className = 'Craft\Events_EventTypeRecord';&#xA;&#xA;        parent::validateAttribute($object,$attribute);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you did it this way your record's &lt;code&gt;rules&lt;/code&gt; method would include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;{&#xA;   $rules = parent::rules();&#xA;&#xA;   $rules[] = ['typeId', 'Craft\Events_EventTypeExistValidator'];&#xA;&#xA;   return $rules;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-09-05T16:21:45.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16697" PostTypeId="2" ParentId="16694" CreationDate="2016-09-05T17:41:25.930" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/mmikkel/CpSortableCustomColumns-Craft&quot; rel=&quot;nofollow&quot;&gt;CpSortableCustomColumns&lt;/a&gt; plugin lets you sort your element index tables on custom fields. Sounds like it does exactly what you want.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-05T17:41:25.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16698" PostTypeId="1" CreationDate="2016-09-05T19:22:27.037" Score="2" ViewCount="419" Body="&lt;p&gt;Is there a kind of “search in results after you retreived all entries” thing? Thing is: I have this query:&#xA;&lt;code&gt;craft.entries.section('players').limit(null)&#xA;&lt;/code&gt;&#xA;I want to show all entries where &lt;code&gt;playerPosition&lt;/code&gt; = goalie. And on the same page, I want to show all players where &lt;code&gt;playerNationality&lt;/code&gt; = Nederlands. And on the same page I want to show the longest player (sorted by &lt;code&gt;playerHeight&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can off course run a query 3 times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;goalies = craft.entries.section('players').playerPosition('goalie').limit(null)&#xA;nationalplayers = craft.entries.section('players').playerNationality('Nederlands').limit(null)&#xA;longest = craft.entries.section('players').order('playerLength desc').first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would work, but I'm running a query 3 times on the same section. There must be a better way, right? – Some have told me about the SuperSort plugin (which was indeed the right solution for my &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16489/order-by-fields-after-searching&quot;&gt;previous question&lt;/a&gt;), but that only &lt;em&gt;sorts&lt;/em&gt; results. It's not a real filter.&lt;/p&gt;&#xA;" OwnerUserId="3874" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-06T04:30:32.483" Title="Filter results after searching" Tags="&lt;entries&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16699" PostTypeId="1" AcceptedAnswerId="16732" CreationDate="2016-09-05T19:27:30.597" Score="6" ViewCount="4654" Body="&lt;p&gt;How can I detect when a modal window has been opened or closed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing a plugin which wants to detect when a garnish elementeditor modal window has been opened or closed.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-09-18T17:07:05.457" Title="Javascript events when modal window is opened or closed" Tags="&lt;control-panel&gt;&lt;garnish&gt;&lt;modal&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16700" PostTypeId="2" ParentId="16683" CreationDate="2016-09-05T21:08:51.113" Score="1" Body="&lt;p&gt;I found the source of the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had 2 custom locales and when I uploaded the new files for the manual update and I didn’t include those 2 locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I copied those 2 files in the folder app/framework/i18n/data everything worked.&lt;/p&gt;&#xA;" OwnerUserId="4337" LastActivityDate="2016-09-05T21:08:51.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16702" PostTypeId="2" ParentId="16698" CreationDate="2016-09-06T04:30:32.483" Score="1" Body="&lt;p&gt;You've got your two obvious choices nailed down.  You're either offloading the filtering to MySQL (running 3 separate queries so that MySQL filters the data) or you're grabbing all of the data and filtering it on the Twig/PHP side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is more performant likely depends on 1) how much data you're talking about and 2) your environment (resources allocated to MySQL vs. PHP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your particular case, I'd enable &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt; and analyze the performance metrics between the two methods while taking into account how fast the data might increase in the future and make an educated guess based on that information.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-06T04:30:32.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16703" PostTypeId="1" AcceptedAnswerId="16704" CreationDate="2016-09-06T08:41:54.220" Score="1" ViewCount="392" Body="&lt;p&gt;I'm using the plugin Redactor Extras &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt; as I need be able to insert IDs to then anchor link to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm finding the plugin adds the IDs as it should but on save they get stripped out. Oddly this plugin also allows you to add Classes which seems to be working but is still a bit temperamental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any settings I could try for Redactor to stop it doing this?&lt;/p&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2016-09-06T09:05:26.903" Title="Redactor removing IDS" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16704" PostTypeId="2" ParentId="16703" CreationDate="2016-09-06T09:05:26.903" Score="3" Body="&lt;p&gt;To prevent Rich Text fields from stripping your ID attributes, you'll need to &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields#settings&quot; rel=&quot;nofollow&quot;&gt;disable the &quot;Purify HTML?&quot; setting&lt;/a&gt; for your field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that disabling the HTML purifier does represent a potential security risk, but as long as you trust your content editor(s), you should be fine.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-06T09:05:26.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16705" PostTypeId="2" ParentId="1626" CreationDate="2016-09-06T09:40:06.413" Score="3" Body="&lt;p&gt;If you want to get all values from a global set without having to specify each field handle you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$set = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('globalHandleHere');&#xA;$fieldLayoutFields = $set-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&#xA;foreach ($fieldLayoutFields as $fieldLayoutField) {&#xA;    $field = craft()-&amp;gt;fields-&amp;gt;getFieldById($fieldLayoutField-&amp;gt;fieldId);   &#xA;    $value = $set-&amp;gt;getContent()[$field-&amp;gt;handle];&#xA;&#xA;    // Do whatever with $value here.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4049" LastEditorUserId="57" LastEditDate="2016-09-06T17:42:42.137" LastActivityDate="2016-09-06T17:42:42.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16706" PostTypeId="1" CreationDate="2016-09-06T09:41:53.233" Score="0" ViewCount="101" Body="&lt;p&gt;So how do i redirect to error/inferior template.  I could add my template at the templates folder but thats not really nice.  Is there something like &lt;code&gt;{% exit 404 %}&lt;/code&gt; but for the inferior page?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-09-06T17:43:24.683" LastActivityDate="2016-09-07T10:39:47.023" Title="Redirect to inferior" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16707" PostTypeId="2" ParentId="16706" CreationDate="2016-09-06T11:59:24.770" Score="4" Body="&lt;p&gt;Without knowing if this a channel, structure or single and no provided code I can't give you a detailed answer, but I think you are looking for Craft's redirect tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/redirect&quot; rel=&quot;nofollow&quot;&gt;Redirect Tag&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-06T11:59:24.770" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16708" PostTypeId="1" AcceptedAnswerId="16713" CreationDate="2016-09-06T14:06:20.917" Score="2" ViewCount="110" Body="&lt;p&gt;I am adding a logo to the email message &lt;code&gt;When someone creates an account:&lt;/code&gt; via &lt;code&gt;Settings &amp;gt; Email &amp;gt; Messages&lt;/code&gt;, the image displays/renders correctly when viewed as &quot;HTML / Rich Text&quot; within mail clients, however; when the email is viewed as plain text, the html for the image is still output (as plain text) rather than being omitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to conditionally render output from within the message depending on if the type of email content currently being parsed by Craft is for &lt;code&gt;text/html&lt;/code&gt; or &lt;code&gt;text/plain&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Desired usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if html %}&#xA;    This is the text/html part of the email message.&#xA;{% elseif plain %}&#xA;    This is the text/plain part of the email message.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For reference the message content is currently:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;http://www.example.org/admin/resources/rebrand/logo/logo.svg&quot; width=&quot;200&quot;&amp;gt;&#xA;&#xA;Dear X,&#xA;&#xA;As a registered user...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Aside: This assumes that Craft processes the email message twice within the same process, once as plain and again as html. If this is not the case then this would likely be unachievable. I do not have an &lt;code&gt;HTML Email Template&lt;/code&gt; set within &lt;code&gt;Settings &amp;gt; Email&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4118" LastActivityDate="2016-09-06T18:05:05.150" Title="Email Messages – If current email type is html or text" Tags="&lt;conditional&gt;&lt;admin&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16709" PostTypeId="1" AcceptedAnswerId="16710" CreationDate="2016-09-06T15:37:06.883" Score="0" ViewCount="88" Body="&lt;p&gt;I have a field &lt;code&gt;isotope&lt;/code&gt;.  It's a dropdown field with a single word text input.   Only one value (out of 6) can be assigned to an entry.  It is not a tag.  It is not a category.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a button for each value within the &lt;code&gt;isotope&lt;/code&gt; field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for button in entry.isotope %}  &#xA;&#xA;    &amp;lt;button class=&quot;button&quot; data-filter=&quot;{{button.title}}&quot;&amp;gt;{{button.title}}&amp;lt;/button&amp;gt;&#xA;&#xA;{% endear %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is wrong and generates the error &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt;.  I know this is basic, but I am obviously missing something.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="344" LastEditDate="2016-09-06T15:56:36.690" LastActivityDate="2016-09-06T16:05:38.603" Title="How can I loop through a field and print each value individually?" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16710" PostTypeId="2" ParentId="16709" CreationDate="2016-09-06T16:05:38.603" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;entry&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This error is being caused by the first line of your code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;... in entry.isotope %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are either using this template code on an element that isn't an entry or haven't defined a variable called &lt;code&gt;entry&lt;/code&gt; anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can help you more, what type of element is this field being used on?&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-09-06T16:05:38.603" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16711" PostTypeId="1" AcceptedAnswerId="16712" CreationDate="2016-09-06T16:53:55.180" Score="2" ViewCount="376" Body="&lt;p&gt;I'd like to examine the memory usage per-page on my website using Craft CMS. Is there a configuration option to enable memory logging or to display memory usage at the bottom of the page?&lt;/p&gt;&#xA;" OwnerUserId="5607" LastActivityDate="2016-09-06T17:45:53.227" Title="Monitor PHP memory usage" Tags="&lt;php&gt;&lt;memory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16712" PostTypeId="2" ParentId="16711" CreationDate="2016-09-06T17:45:53.227" Score="4" Body="&lt;p&gt;If you enable &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow&quot;&gt;devMode&lt;/a&gt;, then memory usage, along with tons of other debugging information (# of database queries, query profiles, execution timestamps, etc.) will be output to your browser's console.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-06T17:45:53.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16713" PostTypeId="2" ParentId="16708" CreationDate="2016-09-06T18:05:05.150" Score="2" Body="&lt;p&gt;There currently isn't a native way to do what you're looking for, but you should consider voting for &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/12295260-there-were-separate-plain-text-and-html-inputs-for&quot; rel=&quot;nofollow&quot;&gt;this feature request&lt;/a&gt; which would make it natively possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you could write a plugin that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#email-onBeforeSendEmail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onBeforeSendEmail&lt;/code&gt;&lt;/a&gt; event, checked to make sure it's the email you're looking for, then modify the &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel#body-detail&quot; rel=&quot;nofollow&quot;&gt;body&lt;/a&gt; property of the &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel&quot; rel=&quot;nofollow&quot;&gt;EmailModel&lt;/a&gt; however you wish.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-06T18:05:05.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16714" PostTypeId="2" ParentId="1429" CreationDate="2016-09-07T04:44:51.587" Score="2" Body="&lt;p&gt;You need to define the &lt;code&gt;value=&lt;/code&gt; attribute on your select fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select class=&quot;form-control margin-bottom&quot; id=&quot;renting&quot; name=&quot;fields[renting]&quot;&amp;gt;&#xA;{% for option in user.renting.options %}&#xA;&amp;lt;option {% if option.selected %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should be:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select class=&quot;form-control margin-bottom&quot; id=&quot;renting&quot; name=&quot;fields[renting]&quot;&amp;gt;&#xA;{% for option in user.renting.options %}&#xA;&amp;lt;option value=&quot;{{option.value}}&quot;{% if option.selected %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was looking for the answer to the same problem. I narrowed my issue down to the  field. When I removed it the form would submit properly. I fixed a typo in the value attribute and that fixed it.&lt;/p&gt;&#xA;" OwnerUserId="5609" LastActivityDate="2016-09-07T04:44:51.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16715" PostTypeId="2" ParentId="16706" CreationDate="2016-09-07T10:39:47.023" Score="0" Body="&lt;p&gt;I don't really know what you mean by an &quot;inferior template&quot; but I assume you're talking about either a scaled down version of your site or just a custom error template. Tons of ways to skin this cat, here are some options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can name your error/inferior template after &lt;a href=&quot;https://stackoverflow.com/a/14511133/4663184&quot;&gt;a semi-appropriate HTTP status&lt;/a&gt;, and exit using that status (the below will load &lt;code&gt;/templates/403.html&lt;/code&gt;, if it exists):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if browserNotSupported %}&#xA;    {% redirect 403 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can redirect to a different URI:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if browserNotSupported %}&#xA;    {% redirect '/some/other/url' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also include a different template, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if browserNotSupported %}&#xA;    {% include '_inferior' %}&#xA;{% else %}&#xA;    {# Your other template or code #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you can use a ternary operation to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;extend&lt;/a&gt; a different layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends browserNotSupported ? '_inferior' : '_layout' %}&#xA;{# Template code #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-09-07T10:39:47.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16716" PostTypeId="1" CreationDate="2016-09-07T10:42:02.633" Score="1" ViewCount="1005" Body="&lt;p&gt;I have again some trouble with a &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow&quot;&gt;Neo&lt;/a&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've a Neo field with different layouts. In one I will output content from some entries with a entries field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is: Sometimes I get output, sometimes I get only some of the selected entries as output and sometimes I don't get any output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav block in entry.myContent.level(1) %}&#xA;    {% switch block.type.handle %}&#xA;&#xA;        {% case 'team' %}&#xA;            &amp;lt;section class=&quot;block&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;                    {% include &quot;_includes/elements/teamGetMember&quot; %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/section&amp;gt;&#xA;    {% endswitch %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the call of the entries field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = entry.teamGetEntres %}&#xA;&#xA;{% if entries | length %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;p class=&quot;description&quot;&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="57" LastEditDate="2016-09-07T16:54:50.370" LastActivityDate="2016-09-07T17:42:48.650" Title="Entries Fields inside a Neo Field" Tags="&lt;matrix&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16717" PostTypeId="1" AcceptedAnswerId="16733" CreationDate="2016-09-07T12:56:47.367" Score="2" ViewCount="319" Body="&lt;p&gt;Duplicating models is easy if you do it from the edit view, where you can just omit the ID and pass it along to &lt;code&gt;save()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how would I go about doing that programmatically without having a POST array to work with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried removing the ID from the model, before I pass it to &lt;code&gt;save()&lt;/code&gt;, in the end I had two identical entries in the database, but I could only access the new one when finding records by ID.&lt;br&gt;&#xA;The original or any subsequent &quot;original&quot; items I clone from become unavailable even though they're in the database.&lt;br&gt;&#xA;My guess is that the Content model just changes its ownership to the newly created entry and that causes this to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried &lt;code&gt;$model-&amp;gt;copy()&lt;/code&gt; and removing the ID, and that held the same results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried copying the &lt;code&gt;$model-&amp;gt;getContent()&lt;/code&gt; and removing its ID, then using &lt;code&gt;$model-&amp;gt;setContent($clonedContent)&lt;/code&gt;. This, at least, didn't prevent me from being able to access the original entry, but the content was never copied (all of my custom field data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how should go about this?&lt;br&gt;&#xA;Any help greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2016-09-08T23:07:18.773" Title="How to duplicate an element type model with content?" Tags="&lt;control-panel&gt;&lt;elementtype&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16718" PostTypeId="1" AcceptedAnswerId="16724" CreationDate="2016-09-07T15:48:17.843" Score="1" ViewCount="122" Body="&lt;p&gt;I don't understand what's going on in my code logic because I'm getting unexpected output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to sum up three number fields in entries loop for the given post date range. Output gets almost doubled as expected. What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get this month's data #}&#xA;{% set thisMonthStatistic = orders.postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{% if thisMonthStatistic|length %}&#xA;{# We must set variable &quot;0&quot; and pass it in for the looping's variable #}&#xA;{% set thisMonthEarning = 0 %}&#xA;&#xA;  {# looping in &quot;thisMonthStatistic&quot; #}&#xA;  {% for statistic in thisMonthStatistic %}&#xA;&#xA;    {% set aPrice = statistic.aPrice %}&#xA;    {% set bPrice = statistic.bPrice %}&#xA;    {% set cPrice = statistic.cPrice %}&#xA;&#xA;    {% if aPrice &amp;gt; 0 %}&#xA;      {% set aPrice = aPrice + thisMonthEarning %}&#xA;    {% endif %}&#xA;&#xA;    {% if bPrice &amp;gt; 0 %}&#xA;      {% set bPrice = bPrice + thisMonthEarning %}&#xA;    {% endif %}&#xA;&#xA;    {% if cPrice &amp;gt; 0 %}&#xA;      {% set cPrice = cPrice + thisMonthEarning %}&#xA;    {% endif %}&#xA;&#xA;    {% set thisMonthEarning = aPrice + bPrice + cPrice %}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% else %}&#xA;&#xA;  {% set thisMonthEarning = 0 %}&#xA;&#xA;{% endif %}&#xA;&#xA;&#xA;{# Final variable output #}&#xA;{{ thisMonthEarning }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2016-09-07T18:07:40.010" Title="Sum up number fields in the loop" Tags="&lt;number&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16719" PostTypeId="2" ParentId="16718" CreationDate="2016-09-07T16:02:32.087" Score="3" Body="&lt;p&gt;Hmm... hard to tell because I can’t know what your expected result would be. But if I had to guess then you might be looking for just this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if aPrice %}&#xA;    {% set thisMonthEarning = thisMonthEarning + aPrice %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-09-07T16:02:32.087" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16720" PostTypeId="2" ParentId="2789" CreationDate="2016-09-07T16:33:38.003" Score="12" Body="&lt;p&gt;You can also the hyphen/dash '-' modifier for shorter syntax and in place of the spaceless tags. Plus you get a bit more granular control where you want it, like trimming only leading or trailing space.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Example 1 taken from Twig Docs: &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#whitespace-control&quot; rel=&quot;noreferrer&quot;&gt;Whitespace Control&lt;/a&gt;, this would remove whitespace around the if's and output of value.&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set value = 'no spaces' %}&#xA;{#- No leading/trailing whitespace -#}&#xA;{%- if true -%}&#xA;    {{- value -}}&#xA;{%- endif -%}&#xA;&#xA;{# output 'no spaces' #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Example 2 is a possible real world scenario for retentive space people:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set metaDescription = 'Page description.' -%}&#xA;{%- set metaKeywords = 'word1 word2 word3' -%}&#xA;{%- set pageTitle = 'A Title' %}&#xA;&#xA;{% if metaKeywords is defined -%}&#xA;    &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ metaKeywords }}&quot; /&amp;gt;&#xA;{%- endif %}&#xA;&#xA;{% if metaDescription is defined -%}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ metaDescription }}&quot; /&amp;gt;&#xA;{%- endif %}&#xA;&#xA;{% if pageTitle is defined -%}&#xA;    &amp;lt;title&amp;gt;{{ pageTitle }}&amp;lt;/title&amp;gt;&#xA;{%- endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rendered output: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta name=&quot;keywords&quot; content=&quot;word1 word2 word3&quot; /&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;Page description.&quot; /&amp;gt;&#xA;&amp;lt;title&amp;gt;A Title&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5611" LastActivityDate="2016-09-07T16:33:38.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16721" PostTypeId="1" CreationDate="2016-09-07T17:31:44.760" Score="1" ViewCount="515" Body="&lt;p&gt;A similar bug with this plugin has be brought up before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue that I'm having is that the post handle &lt;em&gt;mailchimpSubscribe/list/Subscribe&lt;/em&gt; doesn't seems to be working correctly. I'm wondering if this is due to any recent changes to Craft CMS? It has worked in the past but it doesn't seem to want to work now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;newsletter-form&quot; action=&quot;#subscribe&quot; method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;mailchimpSubscribe/list/Subscribe&quot;&amp;gt;&#xA;&#xA;{% if mailchimpSubscribe is defined %}&#xA;  {% if (not mailchimpSubscribe.success) and (mailchimpSubscribe.errorCode!='1000') %}&#xA;    &amp;lt;p&amp;gt;An error occured. Please try again.&amp;lt;/p&amp;gt;&#xA;  {% endif %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;{% if (mailchimpSubscribe is defined) and (not mailchimpSubscribe.success) %}{{ mailchimpSubscribe.values.email }}{% endif %}&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After submitting the form I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to resolve the request &quot;mailchimpSubscribe/list/Subscribe&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought maybe it was to do with an incorrect character that should be uppercase/lowercase but i've tried a few different combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across the same issue recently?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2016-09-09T09:49:31.760" Title="MailChimp Subscribe Plugin" Tags="&lt;plugin-mailchimpsubscribe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16722" PostTypeId="2" ParentId="16716" CreationDate="2016-09-07T17:42:48.650" Score="1" Body="&lt;p&gt;So it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = block.teamGetEntres %}&#xA; {% if entries | length %}&#xA;  {% for entry in entries %}&#xA;    &amp;lt;p class=&quot;description&quot;&amp;gt;{{ entry.description }}&amp;lt;/p&amp;gt;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;replace &quot;entry&quot; in &lt;code&gt;entry.teamGetEntries&lt;/code&gt; with &quot;block&quot;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-07T17:42:48.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16723" PostTypeId="2" ParentId="16721" CreationDate="2016-09-07T17:44:31.443" Score="2" Body="&lt;p&gt;Try lowercasing the &quot;Subscribe&quot; part of the action URL...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mailchimpSubscribe/list/subscribe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-07T17:44:31.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16724" PostTypeId="2" ParentId="16718" CreationDate="2016-09-07T18:07:40.010" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get this month's data #}&#xA;{% set thisMonthStatistic = orders.postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{# We must set variable &quot;0&quot; and pass it in for the looping's variable #}&#xA;{% set thisMonthEarning = 0 %}&#xA;&#xA;{# looping in &quot;thisMonthStatistic&quot;. 0 times if none exists #}&#xA;{% for statistic in thisMonthStatistic %}&#xA;&#xA;  {# fetch aPrice, bPrice, cPrice, but only if &amp;gt; 0 #}&#xA;  {% set aPrice = (statistic.aPrice &amp;gt; 0) ? statistic.aPrice : 0 %}&#xA;  {% set bPrice = (statistic.bPrice &amp;gt; 0) ? statistic.bPrice : 0 %}&#xA;  {% set cPrice = (statistic.cPrice &amp;gt; 0) ? statistic.cPrice : 0 %}&#xA;&#xA;  {% set thisMonthEarning = thisMonthEarning + aPrice + bPrice + cPrice %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Final variable output #}&#xA;{{ thisMonthEarning }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't need the &lt;code&gt;{% if thisMonthStatistic|length %}&lt;/code&gt; - if there is no data, you will go through the loop 0 times, and &lt;code&gt;thisMonthEarning&lt;/code&gt; will be &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure what you intend to do if &lt;code&gt;aPrice&lt;/code&gt; is less than 0. My guess is that you want to just skip those, which is what the &lt;code&gt;?:&lt;/code&gt; operator is doing here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option (this one includes the prices &amp;lt; 0):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thisMonthStatistic = orders.postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&#xA;{% set aPrice = 0 %}&#xA;{% set bPrice = 0 %}&#xA;{% set cPrice = 0 %}&#xA;&#xA;{% for statistic in thisMonthStatistic %}&#xA;&#xA;  {% set aPrice = aPrice + statistic.aPrice %}&#xA;  {% set bPrice = bPrice + statistic.bPrice %}&#xA;  {% set cPrice = cPrice + statistic.cPrice %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{{ aPrice + bPrice + cPrice }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-07T18:07:40.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16725" PostTypeId="1" AcceptedAnswerId="16726" CreationDate="2016-09-08T09:17:14.293" Score="2" ViewCount="428" Body="&lt;p&gt;I'm trying to do something like this for all the SEO meta info in my head&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry or category is defined %}&#xA; ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the right way to code this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is I have archive pages which won't be using some the meta information.&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2016-09-08T09:30:19.660" LastActivityDate="2016-09-08T16:58:28.750" Title="Conditions in an if statement 'or'" Tags="&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16726" PostTypeId="2" ParentId="16725" CreationDate="2016-09-08T09:24:31.443" Score="5" Body="&lt;p&gt;You have to type out the complete statement for each condition, i.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined or category is defined %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-08T09:24:31.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16727" PostTypeId="1" AcceptedAnswerId="16731" CreationDate="2016-09-08T14:37:07.717" Score="1" ViewCount="126" Body="&lt;p&gt;I don't even know how I should ask the question. I'll try to explain it as clear as I can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to order entries by year-month and output single value &lt;em&gt;(from certain number fields)&lt;/em&gt; from all entries from a month like so: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;em&gt;( July(10) )&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;( August(20) )&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;( September(30) )&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is the piece of code I'm trying to figure out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;{% set allEntries = craft.entries.section('orders').limit(null).order('postDate desc') %}&#xA;&#xA;{% set currentMonthEarning = 0 %}&#xA;&#xA;{% for year, entriesInYear in allEntries | group(&quot;postDate.year&quot;) %}&#xA;    {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot; ) %}&#xA;        {% for entry in entries %}&#xA;&#xA;            {# fetch aPrice, bPrice, cPrice, but only if &amp;gt; 0 #}&#xA;            {% set aPrice = (entry.aPrice &amp;gt; 0) ? entry.aPrice : 0 %}&#xA;            {% set bPrice = (entry.bPrice &amp;gt; 0) ? entry.bPrice : 0 %}&#xA;            {% set cPrice = (entry.cPrice &amp;gt; 0) ? entry.cPrice : 0 %}&#xA;&#xA;            {% set currentMonthEarning = currentMonthEarning + aPrice + bPrice + cPrice %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;        {{ currentMonthEarning }}{{ not loop.last ? ', ' }}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Desire output would be:&lt;/strong&gt; &lt;code&gt;[10,20,30]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's going on there actually?:&lt;/strong&gt; It loops through current year's entries from section &lt;code&gt;mySection&lt;/code&gt;, then months and then entries. While it loops through &lt;code&gt;entries&lt;/code&gt;, it does summing up of three number fields and sets it into the variable &lt;code&gt;currentMonthEarning&lt;/code&gt; outside the &lt;code&gt;entries&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Current output:&lt;/strong&gt; &lt;code&gt;[10,30,70]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that &lt;code&gt;currentMonthEarning&lt;/code&gt; is passed over to the next &quot;month&quot; with a value set from previous &quot;month&quot; in the loop. The value for the last month (latest) is correct because of &lt;code&gt;('postDate desc')&lt;/code&gt;. If you understand what I'd like can you find a way to get it done?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-09-09T11:20:18.333" LastActivityDate="2016-09-09T11:20:18.333" Title="Reseting variable" Tags="&lt;variable&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16729" PostTypeId="2" ParentId="16725" CreationDate="2016-09-08T16:58:28.750" Score="4" Body="&lt;p&gt;Another way to approach this would be to standardize the different elements by passing them to a common included template with the same variable&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For entry pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% include '_partials/meta' with {&#xA;        element: entry&#xA;    } %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For category pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;  {% include '_partials/meta' with {&#xA;        element: category&#xA;    } %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can use the common &lt;code&gt;element&lt;/code&gt; variable to output any values. This would be easiest if you also used the same seo fields (title, description, etc.) on all of the different Elements you wanted to support SEO for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# _partials/meta #}&#xA;&#xA;&amp;lt;title&amp;gt;{{ element.title }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{{ element.description }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-08T16:58:28.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16731" PostTypeId="2" ParentId="16727" CreationDate="2016-09-08T19:18:15.537" Score="2" Body="&lt;p&gt;You have three &lt;code&gt;for&lt;/code&gt; loops, and are setting &lt;code&gt;currentMonthEarning&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; outside of all of them, and then adding to it (and never resetting it to &lt;code&gt;0&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably you should move the &lt;code&gt;{% set currentMonthEarning = 0 %}&lt;/code&gt; inside either the first or second &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-08T19:18:15.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16732" PostTypeId="2" ParentId="16699" CreationDate="2016-09-08T19:34:11.653" Score="1" Body="&lt;p&gt;It looks as if there is no clean way to do this. The solution I am using to detect a new modal is&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;detect double click on the element&lt;/li&gt;&#xA;&lt;li&gt;wait a second until the modal has opened&lt;/li&gt;&#xA;&lt;li&gt;find the modal which is actually open&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('body').on('dblclick', 'div.element.small', function() {&#xA;  window.setTimeout(function(event) {&#xA;    // get our modal (there may be several, only one is displayed)&#xA;    var $modalContainer = $('div.hud[style*=&quot;display: block;&quot;]');&#xA;    if ($modalContainer.length) {&#xA;      // we have a new modal, do our thing&#xA;    }&#xA;  }, 1000);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To detect a modal closing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;use &lt;code&gt;window.setInterval&lt;/code&gt; for polling (I needed that anyway)&lt;/li&gt;&#xA;&lt;li&gt;check whether the modal container is still &lt;code&gt;display: block&lt;/code&gt;. (I have hold of something in the container, and so I look outward from there.)&lt;/li&gt;&#xA;&lt;li&gt;if not, the modal has closed&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (! $somethingInTheModal.closest('div.hud[style*=&quot;display: block;&quot;]').length) {&#xA;  // our modal is closed&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By no means ideal, but it seems to be working at the moment for me.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-08T19:34:11.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16733" PostTypeId="2" ParentId="16717" CreationDate="2016-09-08T23:07:18.773" Score="2" Body="&lt;p&gt;I'm going to look pretty dumb if somebody drops a one-line answer down the line, but here goes: AFAIK, unfortunately, &quot;cloning&quot; an element (e.g. an EntryModel) isn't that simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one, &lt;code&gt;$model-&amp;gt;getContent()&lt;/code&gt; will pull the entry's &lt;a href=&quot;https://craftcms.stackexchange.com/a/4487/1098&quot;&gt;ContentModel&lt;/a&gt;, which basically contains all the custom fields that are stored in the &lt;code&gt;craft_content&lt;/code&gt; table for your particular entry. Unfortunately, certain fieldtypes (e.g. Matrix, relational fields such as Assets, Categories, Entries etc) don't actually store their content in the &lt;code&gt;craft_content&lt;/code&gt; table, so their values in the ContentModel will be &lt;code&gt;null&lt;/code&gt;. To get to those values, you'll basically have to loop over your original entry's FieldLayout, and pull each field's actual value. You could then apply those values to your new EntryModel's &lt;code&gt;setContentFromPost()&lt;/code&gt; method, but remember that relational fields (such as Assets and Entries) should be set as an array of IDs, not an ElementCriteriaModel (which is what you'll get back when you pull the field using &lt;code&gt;$entry-&amp;gt;$someFieldHandle&lt;/code&gt; or &lt;code&gt;$entry-&amp;gt;getFieldValue('someFieldHandle')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the entry you want to clone has Matrix fields, that's another can of worms. Matrix blocks are actually elements in themselves, and you'll basically need to follow the same pattern as with cloning the entry itself, in order to properly &quot;clone&quot; the blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I don't have a full, working example typed out, but here's some non-tested boilerplate code to get you started (I conveniently skipped the Matrix part, but there's a link at the bottom which may be helpful):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newModel = $model-&amp;gt;copy();&#xA;$newModel-&amp;gt;id = null;&#xA;&#xA;// Loop through the original model's custom field values, and set them to the new model; account for relational fields&#xA;$customFieldValues = [];&#xA;foreach ($model-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $fieldLayoutField) {&#xA;    $field = $fieldLayoutField-&amp;gt;getField();&#xA;    $fieldType = $field-&amp;gt;type;&#xA;    $fieldHandle = $field-&amp;gt;handle; &#xA;    $fieldValue = null;&#xA;    switch ($fieldType) {&#xA;        case 'Assets': case 'Entries': case 'Categories': case 'Tags': case 'Users':&#xA;            $fieldValue = $model-&amp;gt;$fieldHandle-&amp;gt;ids();&#xA;            break;&#xA;        case 'Matrix':&#xA;            // Whoa, Nelly&#xA;            break;&#xA;        default:&#xA;            $fieldValue = $model-&amp;gt;$fieldHandle;&#xA;    }&#xA;    if ($fieldValue) {&#xA;        $customFieldValues[$fieldHandle] = $fieldValue;&#xA;    }&#xA;}&#xA;$newModel-&amp;gt;setContentFromPost($customFieldValues);&#xA;&#xA;// Save the new entry&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($newModel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if you need this to work for all element types, you may get away with calling &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement($newModel)&lt;/code&gt; at the end, instead of the &lt;code&gt;EntriesService::saveEntry&lt;/code&gt; method. Otherwise, you'll need to check the &lt;code&gt;$newModel-&amp;gt;elementType&lt;/code&gt; property, and call the appropriate service's method for saving the element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, here are some other SE threads that may be of interest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4552/1098&quot;&gt;Getting all content, including Matrix fields from an EntryModel&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14157/how-to-get-all-prepped-field-values-from-an-entry-indexed-by-field-handle?rq=1&quot;&gt;How to get all (prepped) field values from an entry, indexed by field handle&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/11781/1098&quot;&gt;Duplicating Matrix fields with content from another locale&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-09-08T23:07:18.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16734" PostTypeId="1" AcceptedAnswerId="16736" CreationDate="2016-09-09T08:45:43.327" Score="5" ViewCount="740" Body="&lt;p&gt;I created a plugin settings page following the example shown &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5067/how-to-use-plugin-settings&quot;&gt;here&lt;/a&gt; but my entries need to include multilines (they are email bodies). My Twig template for the settings page is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.textField({&#xA;    label: &quot;Submitted Subject&quot;|t,&#xA;    id: 'submittedSubject',&#xA;    name: 'submittedSubject',&#xA;    instructions: &quot;Input your setting&quot;|t,&#xA;    value: settings.submittedSubject,&#xA;    errors: settings.getErrors('submittedSubject'),&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(this field is repeated 6 times).&#xA;I tried using textAreas instead of textFields, but it doesn't have the same options and I don't think it works (doesn't have a value field). Also it doesn't help that there's barely any documentation for this. Is there a way for me to have multiline text inside the text field?&lt;/p&gt;&#xA;" OwnerUserId="5618" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-09T16:52:40.600" Title="Plugin settings multiline input field" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16735" PostTypeId="1" CreationDate="2016-09-09T09:00:56.587" Score="2" ViewCount="259" Body="&lt;p&gt;I have just gone back to a site I am working on locally to continue working on it. 2 days ago it was working fine and I have made no changes. I now have this error when I load the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unserialize(): Error at offset 0 of 24 bytes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C:\Websites\website\craft\app\framework\caching\CCache.php(108)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea why this has happened and how to fix it as I say nothing had changed with the files or with the MAMP install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-09-14T15:26:30.563" Title="Error on homepage of local server no changes made since last working?" Tags="&lt;cache&gt;&lt;error&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16736" PostTypeId="2" ParentId="16734" CreationDate="2016-09-09T09:19:44.737" Score="4" Body="&lt;p&gt;You are close, the template loaded by the macro can be found in &lt;code&gt;craft/app/templates/_includes/forms/textarea.html&lt;/code&gt;. It does have a &lt;code&gt;value&lt;/code&gt; attribute, and a few others, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textareaField({&#xA;    label:         &quot;Submitted Subject&quot;|t,&#xA;    id:            'submittedSubject',&#xA;    name:          'submittedSubject',&#xA;    instructions:  &quot;Input your setting&quot;|t,&#xA;    value:         settings.submittedSubject,&#xA;    rows:          4,&#xA;    cols:          50,&#xA;    errors:        settings.getErrors('submittedSubject'),&#xA;    maxlength:     250,&#xA;    showCharsLeft: true,&#xA;    autofocus:     settings.hasErrors('submittedSubject'),&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All the form macros are defined in &lt;code&gt;craft/app/templates/_includes/forms.html&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2016-09-09T09:27:03.563" LastActivityDate="2016-09-09T09:27:03.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16737" PostTypeId="1" AcceptedAnswerId="16746" CreationDate="2016-09-09T09:42:17.430" Score="5" ViewCount="1314" Body="&lt;p&gt;I am trying to create the PHP &lt;code&gt;$_SESSION&lt;/code&gt; equivalent in Craft CMS using Twig.&#xA;I have searched very long and I can't find how you can create sessions in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In previous posts I have found that I should edit some PHP controllers for this to work but I have just started using Craft and Twig and have no idea what controllers to edit to let this work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if someone has an solution to this can you please explain it like you are explaining it to a 2 year old kid?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="57" LastEditDate="2016-09-09T17:29:32.100" LastActivityDate="2016-09-09T17:29:32.100" Title="Creating sessions in Twig" Tags="&lt;controller&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16738" PostTypeId="2" ParentId="16721" CreationDate="2016-09-09T09:49:31.760" Score="3" Body="&lt;p&gt;This is an obvious one, but have you checked the plugin is installed correctly? If you're working from multiple development locations, or servers then perhaps you have a discrepancy between them?&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2016-09-09T09:49:31.760" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16739" PostTypeId="2" ParentId="16735" CreationDate="2016-09-09T10:39:35.893" Score="1" Body="&lt;p&gt;Ok I have resolved this by deleting all the cache files in the craft|storage|runtime|cache folder. But whilst this has worked my question is now why did it happen. Not something I want to experience on a live site?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-09-09T10:39:35.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16740" PostTypeId="1" CreationDate="2016-09-09T11:53:13.153" Score="5" ViewCount="942" Body="&lt;p&gt;Does anyone know of a good way of handling emojis in a rich text field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware that is possible to copy and paste them into one, but does anything along the lines of an emoji 'button' (i.e. to sit in the toolbar with a dropdown of categorised emojis) exist? Other suggestions welcome! Just keen to avoid the extra steps of having to find the emoji on an external source, copy, and paste in to the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A reference point would be &lt;a href=&quot;https://get.slack.help/hc/en-us/articles/202931348-Emoji-and-emoticons&quot; rel=&quot;noreferrer&quot;&gt;Slack's 'emoji menu'&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2020-02-21T00:55:58.463" Title="Emojis in Rich Text Field" Tags="&lt;richtext&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16743" PostTypeId="1" CreationDate="2016-09-09T13:49:49.250" Score="3" ViewCount="299" Body="&lt;p&gt;I am trying to develop a loop in a craft template that adjust the numbers of rows and awards per row based on the total number of awards.  The numbers are all coming back correct but I am struggling with getting the syntax of the loop correct. Below is the type of loop I am trying to execute.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for ($i = 1; ; $i++) {&#xA;if ($i &amp;gt; 10) {&#xA;  break;&#xA;}&#xA;  echo $i;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I am getting errors because my syntax is not correct and I cannot seem to find this, although I realize I am probably either just missing it somewhere or not recognizing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying something like this, along with other variations, but it keeps throwing errors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exactRowsNeeded = count / 7 %} &amp;lt;!-- correct --&amp;gt;&#xA;{% set rows = ceil(exactRowsNeeded) %} &amp;lt;!-- correct --&amp;gt;&#xA;{% set exactAwardsPerRow = count / rows %} &amp;lt;!-- correct --&amp;gt;&#xA;{% set awardsPerRow = ceil(exactAwardsPerRow) %} &amp;lt;!-- correct --&amp;gt;&#xA;&#xA;{% set r = 1 %}&#xA;{% for r %}&#xA;{% if r &amp;lt;= 2 %} &#xA;  {{ r }}&#xA;{% set r = r++ %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here throws an error at the &quot;for r&quot; line.  It seems to be looking for something like &quot;for r in rows&quot; or something.  Even just a link to an example would be awesome I just cannot seem to get this syntax correct.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="45" LastEditDate="2016-09-09T17:08:05.137" LastActivityDate="2016-09-09T17:08:05.137" Title="The twig syntax for this for loop" Tags="&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16744" PostTypeId="2" ParentId="16743" CreationDate="2016-09-09T14:28:10.473" Score="2" Body="&lt;p&gt;The code below ended up solving the issue for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in 0..rows %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3817" LastActivityDate="2016-09-09T14:28:10.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16746" PostTypeId="2" ParentId="16737" CreationDate="2016-09-09T17:23:03.773" Score="9" Body="&lt;p&gt;Go to &lt;a href=&quot;https://pluginfactory.io/&quot;&gt;https://pluginfactory.io/&lt;/a&gt; to generate a boilerplate Craft plugin.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;API Version: Craft CMS version 2.5.x&lt;/li&gt;&#xA;&lt;li&gt;PluginName: Twig Session&lt;/li&gt;&#xA;&lt;li&gt;Description: Anything&lt;/li&gt;&#xA;&lt;li&gt;Version: 1.0.0&lt;/li&gt;&#xA;&lt;li&gt;Plugin Author: Anything&lt;/li&gt;&#xA;&lt;li&gt;Author URL: Anything&lt;/li&gt;&#xA;&lt;li&gt;Github Name: Blank&lt;/li&gt;&#xA;&lt;li&gt;Uncheck: Tweet it out&lt;/li&gt;&#xA;&lt;li&gt;Check: Variables&lt;/li&gt;&#xA;&lt;li&gt;Click: Build Plugin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Download &lt;code&gt;twigsession.zip&lt;/code&gt; and unzip it. Place the unzipped &lt;code&gt;twigsession&lt;/code&gt; folder in your &lt;code&gt;craft/plugins&lt;/code&gt; folder.  Open &lt;code&gt;craft/plugins/twigsession/variables/TwigSessionVariable.php&lt;/code&gt; and change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function exampleVariable($optional = null)&#xA;{&#xA;    return &quot;And away we go to the Twig template...&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function add($key, $value)&#xA;{&#xA;    craft()-&amp;gt;httpSession-&amp;gt;add($key, $value)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And add a new:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function get($key)&#xA;{&#xA;    return craft()-&amp;gt;httpSession-&amp;gt;get($key)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Go to Settings-&gt;Plugins in the control panel. Install the &quot;Twig Session&quot; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your front end templates, you can now use &lt;code&gt;craft.twigSession.add('foo', 'bar')&lt;/code&gt; and &lt;code&gt;craft.twigSession.get('foo')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-09T17:23:03.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16747" PostTypeId="1" AcceptedAnswerId="21386" CreationDate="2016-09-10T00:30:22.160" Score="2" ViewCount="1641" Body="&lt;p&gt;JS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.on('submit', '#application-form', function(e) {&#xA;    e.preventDefault();&#xA;&#xA;    var form = $(this),&#xA;        formData = new FormData(form[0]),&#xA;        msgBox = form.find('.msg-box'),&#xA;        submitBtn = form.find('.submit'),&#xA;        loader = submitBtn.find('.fa');&#xA;&#xA;&#xA;    submitBtn.prop('disabled', true);&#xA;    loader.css('display', 'inline-block');&#xA;&#xA;    formData.append('attachment[]', form.find('#resume')[0].files[0]);&#xA;    formData.append('attachment[]', form.find('#portfolio')[0].files[0]);&#xA;&#xA;    $.ajax({&#xA;        url: '/',&#xA;        type: 'post',&#xA;        data: formData,&#xA;        dataType: 'json',&#xA;        contentType: false,&#xA;        processData: false,&#xA;        success: function(data) {&#xA;            msgBox.fadeOut(function() {&#xA;                if(data.success) {&#xA;                    $(this).text( 'Your application has been submitted!').removeClass('error');&#xA;                    form[0].reset();&#xA;                } else {&#xA;                    $(this).text('An error occurred. Please try again.').addClass('error');&#xA;                }&#xA;&#xA;                submitBtn.removeAttr('disabled');&#xA;                loader.removeAttr('style');&#xA;&#xA;                msgBox.fadeIn();&#xA;            });&#xA;        }&#xA;    });&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;HTML&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;application-form&quot; class=&quot;content-block-lg&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;utf-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;grid-parent grid-sm-90 prefix-sm-5&quot;&amp;gt;&#xA;            {{ getCsrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fromEmail&quot; value=&quot;no-reply@example.com&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;subject&quot; value=&quot;Application Form&quot;&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;address&quot; name=&quot;address&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-50 content-block&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;message[Name]&quot; placeholder=&quot;Name&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-50 content-block&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;message[EmailOrPhone]&quot; placeholder=&quot;Email or Phone&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-100 content-block&quot;&amp;gt;&#xA;                &amp;lt;textarea name=&quot;message[body]&quot; rows=&quot;3&quot; placeholder=&quot;Tell us about you&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-100 content-block&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;message[LinkToOnlinePortfolio]&quot; placeholder=&quot;link to online portfolio&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-100 stripe-md actions&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Upload a pdf of...&amp;lt;/span&amp;gt;&#xA;                &amp;lt;input id=&quot;resume&quot; type=&quot;file&quot; placeholder=&quot;resume&quot;&amp;gt;&#xA;                &amp;lt;input id=&quot;portfolio&quot; type=&quot;file&quot; placeholder=&quot;portfolio&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;&#xA;                    &amp;lt;a class=&quot;btn-file&quot; href=&quot;#resume&quot;&amp;gt;resume&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;a class=&quot;btn-file&quot; href=&quot;#portfolio&quot;&amp;gt;portfolio&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;grid-sm-100 text-right actions&quot;&amp;gt;&#xA;                &amp;lt;button class=&quot;submit&quot; type=&quot;submit&quot;&amp;gt;send &amp;lt;i class=&quot;fa fa-spinner fa-pulse&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;                &amp;lt;div class=&quot;msg-box&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I am getting is that, with the code above, submitting the form, I get a response of the entire Homepage html.  I've tried using the url set in the action hidden input, but that just gives me a 404 response.  It's like it can't see the &quot;Action&quot; being passed in because it's in FormData?&lt;/p&gt;&#xA;" OwnerUserId="5621" LastEditorUserId="5621" LastEditDate="2016-09-10T21:59:19.980" LastActivityDate="2020-01-09T12:48:32.883" Title="How to do an ajax submission to Craft Contact Form with attachments using FormData?" Tags="&lt;emails&gt;&lt;ajax&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16748" PostTypeId="1" AcceptedAnswerId="16749" CreationDate="2016-09-10T04:44:04.987" Score="3" ViewCount="1270" Body="&lt;p&gt;I am getting all entries from a section like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get the parent entry.&#xA;{% set author = craft.entries.section('mySection').authorId(currentUser.id).first() %}&#xA;&#xA;// get the child entries from the parent.&#xA;{% set entires = craft.entries({&#xA;    'section': 'mySection',&#xA;    'level': 2,&#xA;    'descendantOf': author.id&#xA; })%}&#xA;&#xA;// myDate is a dateTime filed (yyyy-mm-dd)&#xA;&#xA;{% for year, entry in entries|group('myDate') %}&#xA;            &amp;lt;h4&amp;gt;{{ year|date('Y') }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in entries %}&#xA;                    {% if attempt.myDate|date('Y') == year|date('Y') %}&#xA;                        &amp;lt;li&amp;gt;{{ entry.myDate }} &amp;gt; {{ entry.type.name }} - {{ entry.foo }}&amp;lt;/li&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I have is close, however, it's outputting multiple years. For example, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016&#xA;  [entry]&#xA;&#xA;2016&#xA;  [entry]&#xA;&#xA;2015&#xA;  [entry]&#xA;&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to group all of the child entries by year. For example, if I have 3 entires with the same year (2016) I am trying to show: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016&#xA;  [entry]&#xA;  [entry]&#xA;  [entry]&#xA;&#xA;2015&#xA;  [entry]&#xA;&#xA;2014&#xA;  [entry]&#xA;  [entry]&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-09-10T05:05:21.223" LastActivityDate="2017-03-10T19:01:24.007" Title="How can I group entries based on a dateTime field?" Tags="&lt;datetime&gt;&lt;group&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16749" PostTypeId="2" ParentId="16748" CreationDate="2016-09-10T09:57:33.293" Score="4" Body="&lt;p&gt;You're currently grouping on the &lt;code&gt;myDate&lt;/code&gt; field, which essentially creates a new array index for each date (e.g. &lt;code&gt;2016-01-01&lt;/code&gt;) which is why you're getting your current output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To group by &lt;em&gt;year&lt;/em&gt;, this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for year, entries in entries|group('myDate.year') %}&#xA;    &amp;lt;h4&amp;gt;{{ year }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            ...&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-10T09:57:33.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16750" PostTypeId="1" CreationDate="2016-09-11T08:38:15.697" Score="1" ViewCount="171" Body="&lt;p&gt;So I raised a previous thread here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd&quot;&gt;https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically with the site behind a &lt;code&gt;htpasswd&lt;/code&gt; (as it is a staging url) after entering the correct u/p I would get redirected to a 404 which was in fact a 401 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After further investigation and some support from CPanel. I understand that there is a requirement to add the following line to the &lt;code&gt;htaccess&lt;/code&gt; file before the rewrites (in the Craft rewrites).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;RewriteCond %{LA-U:REMOTE_USER} !^$&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Craft rewrites now look like this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{LA-U:REMOTE_USER} !^$&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This only became an issue this week. Previously it all worked fine before this. The above solution does seem to be a fix. But I'm a little stumped as to why this is required now and was working ok before. Has anyone else come up against this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CPanel seemed to think it wouldn't have ever worked without this line. But it did and I am sure others have it working without a need to add this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difficult thing is that I am unable to get a clear reason as to why this is now required and what has changed to enforce this. Over the past week a few things have occurred and so I cannot pinpoint. These updates to the server have included;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Updating Apache 2.2 to 2.4&lt;/li&gt;&#xA;&lt;li&gt;Upgrading to easyapache 4 from easyapache 3&lt;/li&gt;&#xA;&lt;li&gt;Updating Craft after the latest releases.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If anyone can shed any additional light on this it would be useful. Also if anyone can confirm if they also need to include the &lt;code&gt;RewriteCond %{LA-U:REMOTE_USER} !^$&lt;/code&gt; into their &lt;code&gt;htaccess&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-09-12T00:49:37.850" Title="htpasswd issues with Craft" Tags="&lt;htaccess&gt;&lt;password&gt;&lt;apache&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16751" PostTypeId="1" CreationDate="2016-09-11T21:34:05.987" Score="3" ViewCount="158" Body="&lt;p&gt;This looks like a bug to me:&#xA;If I set the &lt;code&gt;setPasswordPath&lt;/code&gt; in the general config file, then the template that I've set up is not showing up, it loads the default one when I try to load:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://site.local/admin/actions/users/setpassword?code=&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-09-11T21:34:05.987" Title="setPasswordPath doesn't seem to be working" Tags="&lt;admin&gt;&lt;password&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2016-09-11T23:25:36.973" ContentLicense="CC BY-SA 3.0" />
  <row Id="16752" PostTypeId="1" AcceptedAnswerId="16767" CreationDate="2016-09-12T12:36:29.987" Score="7" ViewCount="263" Body="&lt;p&gt;Is it possible to let customers enter their email on individual product pages if the stock is 0, and then automatically send them an email when the stock goes above 0 again?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2017-07-21T15:01:22.030" Title="Notify users when item is back in stock" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16753" PostTypeId="1" CreationDate="2016-09-12T13:53:55.663" Score="2" ViewCount="202" Body="&lt;p&gt;I'm trying to submit a form containing items from a users' cart, using A&amp;amp;M forms, but cannot seem to populate the table field with the items. I'm using the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in cart.lineItems %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[selections][{{loop.index}}][col1]&quot; value=&quot;{{item.qty}} x {{item.description}}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason, though, it's creating the rows in the table, but not actually populating it with any content. Any idea what to do to get it to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4700" LastEditorUserId="57" LastEditDate="2016-09-12T17:28:40.897" LastActivityDate="2017-09-12T22:26:42.517" Title="A&amp;M Form Table Field Submission" Tags="&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16754" PostTypeId="1" AcceptedAnswerId="16765" CreationDate="2016-09-12T16:11:13.287" Score="2" ViewCount="1001" Body="&lt;p&gt;I'm running into a &lt;code&gt;500 Internal Server Error&lt;/code&gt; when trying to install craft (on openshift).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Environment:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Platform: OpenShift (nginx-php7 cartridge: &lt;a href=&quot;https://github.com/pinodex/openshift-cartridge-nginx-php7&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pinodex/openshift-cartridge-nginx-php7&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Craft CMS v2.6.2931&lt;/li&gt;&#xA;&lt;li&gt;Nginx: 1.11.3&lt;/li&gt;&#xA;&lt;li&gt;PHP: 7.0.9 (FPM)&lt;/li&gt;&#xA;&lt;li&gt;MySQL: 5.5.50&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The installation starts ok but crashes shortly after:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL: &lt;code&gt;http://my-domain.com/admin/install&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0XhAG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0XhAG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Console output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://my-domain.com/index.php/admin/actions/install/install 500 (Internal Server Error)&#xA;send @ jquery-2.2.1.min.js?d=1473694215:4&#xA;ajax @ jquery-2.2.1.min.js?d=1473694215:4&#xA;postActionRequest @ craft.js:388&#xA;(anonymous function) @ install.js:84&#xA;f @ jquery-2.2.1.min.js?d=1473694215:2&#xA;(anonymous function) @ install.js:152&#xA;f @ jquery-2.2.1.min.js?d=1473694215:2&#xA;l @ velocity.min.js?d=1473694215:3&#xA;k @ velocity.min.js?d=1473694215:3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;nginx default configuration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    root              /var/lib/openshift/xxxxxxx/app-root/runtime/repo//public_html;&#xA;    listen            127.0.0.1:8080;&#xA;    server_name       mydomain.com;&#xA;    index             index.php index.html index.htm ;&#xA;&#xA;    set_real_ip_from  127.0.0.1;&#xA;    real_ip_header    X-Forwarded-For;&#xA;&#xA;    # avoid caching by proxies&#xA;    add_header        Cache-Control private;&#xA;&#xA;    error_page 404 /index.php;&#xA;&#xA;    location ~ \.php$ {&#xA;        try_files $uri =404;&#xA;        fastcgi_pass   unix:/var/lib/openshift/xxxxxxx/nginx-php7//run/php-fpm.sock;&#xA;        fastcgi_index  index.php;&#xA;        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;&#xA;        include        fastcgi_params;&#xA;        include        openshift_params;&#xA;&#xA;        # uncomment to export all environment variables to fastcgi&#xA;        #include        /var/lib/openshift/xxxxxxx/app-root/runtime/repo//config/nginx.d/export_env;&#xA;    }&#xA;&#xA;    location ~ ^(.*)$ {&#xA;        try_files $uri $uri/ /index.php?p=$uri&amp;amp;$args;&#xA;    }&#xA;&#xA;    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf|ttc|otf|eot|woff)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires max;&#xA;        add_header Pragma public;&#xA;        add_header Cache-Control &quot;public, must-revalidate, proxy-revalidate&quot;;&#xA;    }&#xA;&#xA;    location ~* \.(?:css|js)$ {&#xA;        try_files $uri /index.php?$query_string;&#xA;        expires 1y;&#xA;        add_header Cache-Control &quot;public&quot;;&#xA;    }&#xA;&#xA;    location = /robots.txt  { access_log off; log_not_found off; }&#xA;    location = /favicon.ico { access_log off; log_not_found off; }&#xA;    location ~ /\. { access_log off; log_not_found off; deny all; }&#xA;&#xA;    location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {&#xA;        deny all;&#xA;        access_log off;&#xA;        log_not_found off;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;craft.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/09/12 15:30:56 [warning] [application] Skipping record /var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/records/BaseRecord.php because it’s abstract or an interface.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only PHP error I'm seeing (repeated about 6 times during the install):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[12-Sep-2016 16:44:29 UTC] PHP Warning:  strpos(): Empty needle in /var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/bootstrap.php on line 126&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've checked the permissions on all required write-enabled folders are ok, but still can't figure out what's preventing the install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me identify whats causing this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my &lt;code&gt;craft/config/general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Get environment&#xA;require('_env.php');&#xA;&#xA;/**&#xA; * General Configuration&#xA; *&#xA; * All of your system's general configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/general.php&#xA; */&#xA;&#xA;return array(&#xA;&#xA;    // Universal settings&#xA;    '*' =&amp;gt; array(&#xA;        'usePathInfo' =&amp;gt; true,&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        // 'enableCsrfProtection' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl'  =&amp;gt; $customEnv['baseUrl'],&#xA;            'basePath' =&amp;gt; $customEnv['basePath'],&#xA;        )&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my &lt;code&gt;craft/config/_env.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$customEnv = array(&#xA;&#xA;    // Path info&#xA;    'baseUrl'  =&amp;gt; 'http://my-domain.com',&#xA;    'basePath' =&amp;gt; '/var/lib/openshift/xxxxxxx/app-root/runtime/repo//public_html',&#xA;&#xA;    // Database connection info&#xA;    'server'   =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_HOST'),&#xA;    'user'     =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_USERNAME'),&#xA;    'password' =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),&#xA;    'database' =&amp;gt; getenv('OPENSHIFT_APP_NAME'),&#xA;&#xA;    // General config settings&#xA;    'general' =&amp;gt; array(&#xA;        // Config settings for this environment&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my &lt;code&gt;craft/config/db.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Get environment&#xA;&#xA;// require('_env.php');&#xA;&#xA;/**&#xA; * Database Configuration&#xA; *&#xA; * All of your system's database configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA; */&#xA;&#xA;return array(&#xA;&#xA;    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;        'server' =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_HOST'),&#xA;&#xA;        // The database username to connect with.&#xA;        'user' =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_USERNAME'),&#xA;&#xA;        // The database password to connect with.&#xA;        'password' =&amp;gt; getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),&#xA;&#xA;        // The name of the database to select.&#xA;        'database' =&amp;gt; getenv('OPENSHIFT_APP_NAME'),&#xA;&#xA;        // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5624" LastEditorUserId="5624" LastEditDate="2016-09-12T19:21:16.027" LastActivityDate="2016-09-12T21:17:15.403" Title="500 Internal Server Error in OpenShift install" Tags="&lt;error-message&gt;&lt;ajax&gt;&lt;error&gt;&lt;install&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16755" PostTypeId="2" ParentId="16754" CreationDate="2016-09-12T17:04:39.980" Score="1" Body="&lt;p&gt;I think this is the causing the installer to trip up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[12-Sep-2016 16:44:29 UTC] PHP Warning:  strpos(): Empty needle in /var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/bootstrap.php on line 126&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My guess is that there is something wrong with your environmental logic in &lt;code&gt;craft/config/general.php&lt;/code&gt; (or maybe some off if you've modified Craft's public &lt;code&gt;index.php&lt;/code&gt; as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start by stripping that down to the basics and adding things back in one at a time until you find the culprit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-12T17:04:39.980" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16758" PostTypeId="1" AcceptedAnswerId="16785" CreationDate="2016-09-12T17:35:05.180" Score="3" ViewCount="712" Body="&lt;p&gt;Is there a plugin, similar to &lt;a href=&quot;https://wordpress.org/plugins/broken-link-checker/&quot; rel=&quot;nofollow&quot;&gt;https://wordpress.org/plugins/broken-link-checker/&lt;/a&gt; or other Wordpress plugins, that can test links in the database and report which ones are broken? It doesn't have to be pretty or fancy.&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2016-09-14T15:37:41.027" LastActivityDate="2017-09-08T14:45:29.070" Title="Plugin to check for broken links?" Tags="&lt;plugins&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16759" PostTypeId="2" ParentId="16758" CreationDate="2016-09-12T20:00:32.367" Score="4" Body="&lt;p&gt;nystudio107 has a great plugin that takes care of this and lets you implement redirects when broken links are found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow&quot;&gt;retour on Github&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-12T20:00:32.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16760" PostTypeId="1" AcceptedAnswerId="16761" CreationDate="2016-09-12T20:32:26.823" Score="6" ViewCount="3355" Body="&lt;p&gt;I want to make it super easy for my user to embed a video from YouTube (maybe eventually from other sources) without having to get the iframe code. They should only have to enter the URL for the video, and maybe check a couple of optional settings, and the code will do the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm planning to share the snippet and field architecture I develop here to save myself/others time in the future, but if someone else has already done this and wants to share first, even better!&lt;/p&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2020-02-09T16:48:03.113" Title="What's the most user friendly way to create a video block in a matrix field?" Tags="&lt;matrix&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16761" PostTypeId="2" ParentId="16760" CreationDate="2016-09-12T20:52:26.947" Score="6" Body="&lt;p&gt;From basic to robust:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.imperavi.com/redactor/plugins/video/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor&lt;/a&gt; has a plugin along that same vein but it's more basic—feed it a URL and it spits out the embed code in a Redactor field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Staplegun-US/craft-video-embed-utility&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-video-embed-utilty&lt;/a&gt; sounds like it might work as a basic option here. It's not a field type but a Twig filter that'll take the video URL the user enters (you could use it with any field, including a plain text field) and then spit out the necessary Twig embed code. If you want to build your own &quot;options&quot; from scratch, this could work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedded Assets&lt;/a&gt; allows you to use embeddable media such as YouTube videos to your assets manager and spit out the embed code necessary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dukt's premium &lt;a href=&quot;https://dukt.net/craft/videos&quot; rel=&quot;nofollow noreferrer&quot;&gt;Videos&lt;/a&gt; plugin is probably the most robust option. It'll actually connect to YouTube or Vimeo, hooks into Craft's interface, and visually allow you to search for and embed videos. It includes a videos field type that matrix compatible.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="115" LastEditDate="2020-02-09T16:48:03.113" LastActivityDate="2020-02-09T16:48:03.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16762" PostTypeId="2" ParentId="16760" CreationDate="2016-09-12T20:53:27.737" Score="4" Body="&lt;p&gt;There are quite a few plugins here that you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;Some Video Plugins on Straightup Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My personal preference after trying some of these out is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow&quot;&gt;Embedded Assets&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-09-12T20:58:31.153" LastActivityDate="2016-09-12T20:58:31.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16763" PostTypeId="2" ParentId="15505" CreationDate="2016-09-12T20:57:20.143" Score="1" Body="&lt;p&gt;Sprout Email 2.x is not designed to be sending bulk email on it's own (September 2016). The feature is on our list to explore in future releases, and currently, Sprout Email can be used to manage sending bulk email via a third party mailer such as MailChimp or Campaign Monitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current incarnation of &quot;Recipient Lists&quot; in Sprout Email is meant to be for very simple use cases where you may need to send Notification emails to a small list of people.  We will be revisiting the Recipient List feature to handle larger lists and integrations in the future.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-12T20:57:20.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16764" PostTypeId="1" AcceptedAnswerId="16840" CreationDate="2016-09-12T21:01:03.603" Score="1" ViewCount="588" Body="&lt;p&gt;Running Craft CMS 2.6.2903 and Redactor I 1.1.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;lists&quot;, &quot;image&quot;],&#xA;    &quot;plugins&quot;:[&quot;fullscreen&quot;, &quot;source&quot;],&#xA;    &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fullscreen and source no longer work, not sure but possibly a recent Craft update? I have all my rich text fields set to Rich Text (Redactor I) and Standard as &lt;code&gt;Standard.json&lt;/code&gt; is the config I edited for above settings. No html or source button shows up, fullscreen shows up but doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what could possibly be wrong, this config worked a while back.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="57" LastEditDate="2016-09-12T23:55:16.627" LastActivityDate="2016-09-17T16:43:43.577" Title="Redactor I source button no longer working?" Tags="&lt;redactor&gt;&lt;config&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16765" PostTypeId="2" ParentId="16754" CreationDate="2016-09-12T21:17:15.403" Score="1" Body="&lt;p&gt;Turns out that this was an issue with the OpenShift cartridge not Craft (&lt;a href=&quot;https://github.com/pinodex/openshift-cartridge-nginx-php7/issues/8&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pinodex/openshift-cartridge-nginx-php7/issues/8&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PHP &lt;code&gt;session.save_path&lt;/code&gt; value was set to a different (non-existent)  directory than that which is created/defined when the cartridge is deployed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft.log&lt;/code&gt; error (dev mode):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/09/12 20:10:55 [error] [php] session_regenerate_id(): open(/var/lib/openshift/xxxxxxx/app-root/data//php-session/sess_vdm5q1ulu7285qmi6g86jnph87, O_RDWR) failed: No such file or directory (2) (/var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/framework/web/CHttpSession.php:185)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure why I didn't get any errors in the PHP error logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating the &lt;code&gt;php-session&lt;/code&gt; directory fixes the issue, but the cartridge needs to be updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL:DR&lt;/strong&gt; PHP session settings issue caused by the OpenShift cartridge not Craft.&lt;/p&gt;&#xA;" OwnerUserId="5624" LastActivityDate="2016-09-12T21:17:15.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16767" PostTypeId="2" ParentId="16752" CreationDate="2016-09-13T02:14:29.930" Score="5" Body="&lt;p&gt;This is not currently possible out of the box with Commerce at time of writing (Sept 2016).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a custom plugin to do it, which would basically keep a table of these people-to-contact, and run a task (or use a controller you trigger by cronjob) -&gt; to send out the emails at such a time the product is re-stocked.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It wouldn't be spectacularly difficult to implement.  Here's a rough sketch:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A form on the site to accept the email addresses -&gt; that form posts to a controller in your plugin - which stores a record of the product, customer email, and date emailed (date emailed is initially null).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then have a task that periodically runs and checks these records - for each record, if there is no date emailed, check the stock of the product - if greater than zero, send an email and log when it was sent.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-09-13T02:55:49.213" LastActivityDate="2016-09-13T02:55:49.213" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16768" PostTypeId="2" ParentId="16758" CreationDate="2016-09-13T02:58:12.127" Score="4" Body="&lt;p&gt;(I don't think retour actually looks for broken links actively - it does log 404s coming in to your site though and make it easy to set up re-directs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of online services that will spider your site and report on broken internal or external links - e.g. &lt;a href=&quot;https://www.semrush.com&quot; rel=&quot;nofollow&quot;&gt;https://www.semrush.com&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not aware of a plugin for Craft that does this directly by looking in the db as such.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-09-13T02:58:12.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16769" PostTypeId="1" AcceptedAnswerId="16770" CreationDate="2016-09-13T04:57:12.703" Score="5" ViewCount="146" Body="&lt;p&gt;I need to get all the entries that were updated after a certain date, I tried a couple things, but it doesn't seem to work, does anyone know how I can accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems wrong to me, but it doesn't throw any error, neither does it accomplish what I want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'affiliates';&#xA;$criteria-&amp;gt;dateUpdated(&quot;&amp;gt; '2015-09-02'&quot;);&#xA;&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;$queryResults = $query-&amp;gt;queryAll();&#xA;&#xA;$affiliates = EntryModel::populateModels($queryResults);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="22" LastEditDate="2017-05-09T21:05:54.330" LastActivityDate="2017-05-09T21:05:54.330" Title="Getting Entries that were updated after a certain day?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16770" PostTypeId="2" ParentId="16769" CreationDate="2016-09-13T08:30:36.370" Score="6" Body="&lt;p&gt;Your criteria for the date updated was written in the wrong syntax. It should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$criteria-&amp;gt;dateUpdated = '&amp;gt; 2015-09-02';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also simplify the way you query your Element Criteria Model like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'affiliates';&#xA;$criteria-&amp;gt;dateUpdated = '&amp;gt; 2015-09-02';&#xA;$affiliates = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Take a look at the &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot;&gt;Working with Elements&lt;/a&gt; documentation for more info.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-09-13T15:19:40.280" LastActivityDate="2016-09-13T15:19:40.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16772" PostTypeId="1" AcceptedAnswerId="16773" CreationDate="2016-09-13T15:51:05.387" Score="2" ViewCount="73" Body="&lt;p&gt;Unfortunatley we need to develop an Import plug-in helper with dev mode OFF, for - according to Brad at P&amp;amp;T:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;devMode uses a lot more memory on a given PHP request and importing&#xA;  probably already requires significant memory, so my guess is that&#xA;  you're running into your php.ini file's memory_limit or&#xA;  max_execution_time limits or something similar.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Import plug-in is definitely a resource pig. We can't get it to work &lt;em&gt;at all&lt;/em&gt; in dev mode. But we need to develop a plug-in using its hooks to help with things it can't handle in our situation (tables, dates, switches) so we're in a tough spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://straightupcraft.com/articles/how-do-i-log-errors-warnings-and-info-in-my-plugins-to-a-craft-log-file&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; article:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you want a log item to appear regardless of whether devMode is&#xA;  enabled, you can pass true as the third argument to the log() method.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SproutActivePlugin::log('Log this with or without devMode enabled.', LogLevel::Info, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this accurate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've tried it. Doesn't seem to work as advertised. Nothing in the logs unless dev mode is turned on. And when it's turned on the Import plug-in hangs up. We're in a tough spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else should we be looking for? What else can we try?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2930 / Import 0.8.28 / PHP 5.6.10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;br&gt;&#xA;We have increased memory_limit 10 fold (1280M)&lt;br&gt;&#xA;We have increased max_execution_time 100 fold (30000)&lt;br&gt;&#xA;We have increased max_input_time 100 fold (60000)&lt;/p&gt;&#xA;" OwnerUserId="4097" LastEditorUserId="4097" LastEditDate="2016-09-13T17:02:07.957" LastActivityDate="2016-09-13T21:07:44.737" Title="Why can't we log items regardless of dev mode?" Tags="&lt;plugin-development&gt;&lt;import&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16773" PostTypeId="2" ParentId="16772" CreationDate="2016-09-13T21:07:44.737" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;If you want a log item to appear regardless of whether devMode is enabled, you can pass true as the third argument to the log() method.&lt;/p&gt;&#xA;&lt;p&gt;Is this accurate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes. Logs will only get flushed to disk is a proper &lt;code&gt;craft()-&amp;gt;end()&lt;/code&gt; occurs, firing the &lt;code&gt;onEndRequest&lt;/code&gt; event.  So if you're doing something in your plugin like calling PHP's &lt;code&gt;exit()&lt;/code&gt; directly or there is some other logic that inadvertently kills the request, then they won't get written to the log file.&lt;/p&gt;&#xA;&lt;p&gt;I'd suspect that's what you're running into.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-09-13T21:07:44.737" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16774" PostTypeId="1" CreationDate="2016-09-13T23:40:25.180" Score="2" ViewCount="646" Body="&lt;p&gt;We've got quite a few PNG image files for a site build, so naturally we're running them through tinypng to reduce size. This works great locally, but when we upload them to assets (S3) the file size is getting huge again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pic: &lt;a href=&quot;https://cl.ly/152u2C2D3g2n&quot; rel=&quot;nofollow&quot;&gt;https://cl.ly/152u2C2D3g2n&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;193kb to 440kb in this example ^ which is typical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="670" LastActivityDate="2016-09-14T03:42:01.557" Title="Why are PNG images bigger in file size on the (S3) server?" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16775" PostTypeId="1" AcceptedAnswerId="16776" CreationDate="2016-09-14T01:49:17.620" Score="4" ViewCount="357" Body="&lt;p&gt;This code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ foo.getLink() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputs this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;URL_HERE&quot;&amp;gt;NAME_OF_PAGE&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I really want is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;URL_HERE&quot; class=&quot;bar&quot;&amp;gt;NAME_OF_PAGE&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set &quot;class&quot; and/or other html attributes when using Craft CMS Entry Property &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getLink&quot; rel=&quot;nofollow&quot;&gt;getLink()&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5616" LastEditorUserId="4466" LastEditDate="2016-09-14T09:20:01.507" LastActivityDate="2016-09-21T22:57:14.383" Title="Is it possible to set any attributes (such as a class) of the `a` tag when using `getLink()`?" Tags="&lt;templating&gt;&lt;link&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16776" PostTypeId="2" ParentId="16775" CreationDate="2016-09-14T03:31:55.903" Score="8" Body="&lt;p&gt;No, &lt;code&gt;getLink&lt;/code&gt; outputs a very simple version of the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want something more complex, you'll need to build it manually...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ foo.url }}&quot; class=&quot;bar&quot;&amp;gt;{{ foo.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-14T03:31:55.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16777" PostTypeId="2" ParentId="16774" CreationDate="2016-09-14T03:42:01.557" Score="4" Body="&lt;p&gt;I agree with Brad's comment, this is very similar to those two other threads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, here is an &lt;a href=&quot;https://craftcms.stackexchange.com/a/1452/45&quot;&gt;important quote&lt;/a&gt; which is buried on one of those threads...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When an image is first uploaded, Craft will &quot;sanitize&quot; the image for any malicious code by re-saving the image out to a new file. It jumps through some pretty significant to ensure that the sanitized image is as close to possible as the originally uploaded image in both quality and file size, which usually explains the differences people see in file sizes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe this is what the OP is experiencing.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-14T03:42:01.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16778" PostTypeId="1" AcceptedAnswerId="16780" CreationDate="2016-09-14T08:46:43.020" Score="2" ViewCount="678" Body="&lt;p&gt;I would like to &lt;strong&gt;manually crop the image transforms&lt;/strong&gt; for an uploaded image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are crop plugins for Craft (&lt;a href=&quot;https://github.com/engram-design/ImageResizer&quot; rel=&quot;nofollow&quot;&gt;image-resizer&lt;/a&gt;, &lt;a href=&quot;https://github.com/fruitstudios/AviaryImageEditor&quot; rel=&quot;nofollow&quot;&gt;AviaryImageEditor&lt;/a&gt;), but these plugins crop the original image and &lt;strong&gt;not&lt;/strong&gt; the image transforms.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for something very similar to the &lt;a href=&quot;https://www.drupal.org/project/manualcrop&quot; rel=&quot;nofollow&quot;&gt;manual crop module in Drupal&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can upload one image, afterwards you manually crop the different image styles / image transforms..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5334" LastEditorUserId="4466" LastEditDate="2016-09-14T09:23:11.127" LastActivityDate="2017-10-31T16:42:47.797" Title="Manual crop in Image Transforms" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16780" PostTypeId="2" ParentId="16778" CreationDate="2016-09-14T14:33:26.480" Score="2" Body="&lt;p&gt;I don't know a plugin like this for Craft. But this solution does a similar thing. Maybee it works for you: &lt;a href=&quot;https://craftcookbook.net/recipes/simple-way-to-let-clients-set-crop-position-for-images&quot; rel=&quot;nofollow noreferrer&quot;&gt;Let clients set crop position for images&lt;/a&gt;. &#xA;Otherwise you could also take a look on the focuspoint plugin: &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/smcyr/Craft-FocusPoint&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="37" LastEditDate="2017-10-31T16:42:47.797" LastActivityDate="2017-10-31T16:42:47.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16781" PostTypeId="1" CreationDate="2016-09-14T14:39:16.230" Score="1" ViewCount="143" Body="&lt;p&gt;I created a new Single section and named it &quot;test&quot;, added some content and tried to view it on &lt;code&gt;domain.com/test&lt;/code&gt;. Unfortunately I get my default server 404 and not the new single section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to add a new route using &lt;code&gt;&quot;test&quot; =&amp;gt; &quot;_layout&quot;&lt;/code&gt; but can't see any change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea why this isn't working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the both screenshots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RtgBB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://i.stack.imgur.com/RtgBB.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JomkJ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://i.stack.imgur.com/JomkJ.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="5628" LastEditorUserId="45" LastEditDate="2016-09-14T17:19:25.480" LastActivityDate="2016-09-14T20:53:12.083" Title="Can't open new single section" Tags="&lt;routes&gt;&lt;sections&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16782" PostTypeId="2" ParentId="15229" CreationDate="2016-09-14T14:41:54.263" Score="2" Body="&lt;p&gt;The following code should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if entry.isEditable() %}&#xA;    &amp;lt;a href=&quot;{{ entry.cpEditUrl }}/{{ craft.locale }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-09-14T14:41:54.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16783" PostTypeId="1" AcceptedAnswerId="16786" CreationDate="2016-09-14T14:49:28.903" Score="2" ViewCount="415" Body="&lt;p&gt;My question is similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5232/subdomain-database-configuration-picking-up-root-domain-config&quot;&gt;Subdomain database configuration picking up root domain config&lt;/a&gt;, but I don't have any custom database variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a staging site and a (forthcoming) production site on the same remote shared hosting server. The staging site is at a &lt;code&gt;staging&lt;/code&gt; subdomain and the production site will be at the root. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The staging site seems to be using the config variables from the root domain in &lt;code&gt;general.php&lt;/code&gt; and &lt;code&gt;db.php&lt;/code&gt;. I had to take the production site out of &lt;code&gt;db.php&lt;/code&gt; to get the staging site to work at all, and anywhere I'm using environment variables (like my asset paths), they're coming from the production config instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;    'loginPath' =&amp;gt; 'admin',&#xA;  ),&#xA;  'localhost' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; 'C:\wamp\www\craftcms',&#xA;      'baseUrl'  =&amp;gt; 'localhost/craftcms/',&#xA;    )&#xA;  ),&#xA;  'staging.safs.msu.edu' =&amp;gt; array(&#xA;        'server' =&amp;gt; '35.8.12.67',&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; 'staging',&#xA;      'baseUrl'  =&amp;gt; 'http://staging.safs.msu.edu',&#xA;    ),&#xA;  ),&#xA;  'safs.msu.edu' =&amp;gt; array(&#xA;    'server' =&amp;gt; '35.8.12.67',&#xA;    'devMode' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; '',&#xA;      'baseUrl'  =&amp;gt; 'http://safs.msu.edu',&#xA;    ),&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I get my config files to recognize the staging subdomain's settings?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-09-14T15:27:09.803" Title="Root domain config overriding subdomain config" Tags="&lt;database&gt;&lt;config&gt;&lt;multi-environment&gt;&lt;subdomain&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16784" PostTypeId="1" CreationDate="2016-09-14T15:09:31.940" Score="2" ViewCount="308" Body="&lt;p&gt;I've written a plugin that stores records in it's own table. I can see that the &lt;code&gt;dateCreated&lt;/code&gt; and &lt;code&gt;dateUpdated&lt;/code&gt; fields are stored in UTC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I want to display them in a CP template, I'm using &lt;code&gt;populateModel&lt;/code&gt; and my model contains &lt;code&gt;'dateCreated' =&amp;gt; AttributeType::DateTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I output this with &lt;code&gt;{{ entry.dateCreated|dateTime }}&lt;/code&gt; then I'm still getting UTC time and not BST (the Timezone in Settings).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use &lt;code&gt;{{ entry.dateCreated|date('d M Y H:i', 'Europe/London') }}&lt;/code&gt; then it's correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to get the date with the correct timezone set automatically?&lt;/p&gt;&#xA;" OwnerUserId="536" LastEditorUserId="4466" LastEditDate="2016-09-14T15:17:38.407" LastActivityDate="2016-10-15T09:34:46.973" Title="Correct timezone for AttributeType::DateTime in CP" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16785" PostTypeId="2" ParentId="16758" CreationDate="2016-09-14T15:11:42.143" Score="1" Body="&lt;p&gt;Can't seem to find a plugin that does this. I may build a link into the CP dashboard for a third party link-checking service like &lt;a href=&quot;https://validator.w3.org/checklink&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://validator.w3.org/checklink&lt;/a&gt;, &lt;a href=&quot;http://www.deadlinkchecker.com/website-dead-link-checker.asp&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.deadlinkchecker.com/website-dead-link-checker.asp&lt;/a&gt;, or &lt;a href=&quot;http://www.brokenlinkcheck.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.brokenlinkcheck.com/&lt;/a&gt;. Or just recommend a browser extension that will do it on a page-by-page basis, like &lt;a href=&quot;http://www.brokenlinkcheck.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check My Links&lt;/a&gt; for Chrome.&lt;/p&gt;&#xA;&lt;p&gt;Maybe once I get into plugin development, I'll make one myself. :)&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-09-14T15:11:42.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16786" PostTypeId="2" ParentId="16783" CreationDate="2016-09-14T15:14:59.053" Score="2" Body="&lt;p&gt;Craft looks for partial matches to apply config settings (both &lt;code&gt;general.php&lt;/code&gt; and &lt;code&gt;db.php&lt;/code&gt; which means you can do things like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.dev' =&amp;gt; array(&#xA;.. &#xA;&#xA;'.com' =&amp;gt; array(&#xA;..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft applies these settings for each match from the top of the file to the bottom. So in your case because you have the the production domain after your subdomain config it matches and overrides your subdomain settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply swap your config variables over and it'll work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;    'loginPath' =&amp;gt; 'admin',&#xA;  ),&#xA;  'localhost' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; 'C:\wamp\www\craftcms',&#xA;      'baseUrl'  =&amp;gt; 'localhost/craftcms/',&#xA;    )&#xA;  ),&#xA;  'safs.msu.edu' =&amp;gt; array(&#xA;    'server' =&amp;gt; '35.8.12.67',&#xA;    'devMode' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; '',&#xA;      'baseUrl'  =&amp;gt; 'http://safs.msu.edu',&#xA;    ),&#xA;  ),&#xA;  'staging.safs.msu.edu' =&amp;gt; array(&#xA;    'server' =&amp;gt; '35.8.12.67',&#xA;    'devMode' =&amp;gt; true,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; 'staging',&#xA;      'baseUrl'  =&amp;gt; 'http://staging.safs.msu.edu',&#xA;    ),&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-09-14T15:27:09.803" LastActivityDate="2016-09-14T15:27:09.803" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16787" PostTypeId="2" ParentId="16760" CreationDate="2016-09-14T15:20:00.077" Score="2" Body="&lt;p&gt;I've always had a Plain Text field for the user to paste a Vimeo or YouTube URL into and then used the &lt;a href=&quot;https://github.com/A-P/Embedder&quot; rel=&quot;nofollow&quot;&gt;Embedder&lt;/a&gt; plugin in the template to generate the correct embed code (with options to turn off related videos etc).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set video = craft.embedder.url(matrix.videoUrl, {max_width:1200, youtube_rel:0, youtube_showinfo:0, vimeo_portrait:'false', vimeo_title:'false', vimeo_byline:'false'}) %}&#xA;&amp;lt;div class=&quot;widescreen&quot;&amp;gt;{{ video.embed_code }}&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="536" LastActivityDate="2016-09-14T15:20:00.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16788" PostTypeId="2" ParentId="16783" CreationDate="2016-09-14T15:23:23.327" Score="0" Body="&lt;p&gt;I tend to put the settings for the Production site under the wildcard settings '*' and then overwrite any for dev and staging below that.&lt;/p&gt;&#xA;" OwnerUserId="536" LastActivityDate="2016-09-14T15:23:23.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16789" PostTypeId="2" ParentId="16735" CreationDate="2016-09-14T15:26:30.563" Score="1" Body="&lt;p&gt;Also make sure your Cache option is set to OFF in MAMP &gt; Preferences &gt; PHP. I think it defaults to OPCache which can cause problems with local development if it set to on.&lt;/p&gt;&#xA;" OwnerUserId="536" LastActivityDate="2016-09-14T15:26:30.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16791" PostTypeId="1" AcceptedAnswerId="16799" CreationDate="2016-09-14T18:57:18.593" Score="5" ViewCount="587" Body="&lt;p&gt;I tried to get all tags that are related to an section.&#xA;Everything I tried failed. Is there a way to get all assigned tags for a particular element type by using element criteria model.&#xA;In this case &lt;code&gt;travelImages&lt;/code&gt;? I want to avoid to display not related tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'elementType' =&amp;gt; 'Tag',&#xA;'criteria' =&amp;gt; ['relatedto' =&amp;gt; 'travelImages']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5630" LastEditorUserId="4466" LastEditDate="2016-09-15T07:55:16.103" LastActivityDate="2016-10-02T17:43:03.550" Title="In the Element API plugin, how can I get only tags that are related to a particular section?" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16792" PostTypeId="1" AcceptedAnswerId="16897" CreationDate="2016-09-14T19:27:53.253" Score="1" ViewCount="161" Body="&lt;p&gt;Background... I took a look at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14903/product-categories-structures-and-channels&quot;&gt;this post&lt;/a&gt; answered by @Damon&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My objective is similar.  I have a channel for news.  Each entry in news is assigned various categories (e.g. product category).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not have a &quot;single&quot; in Craft for each product category.  However, I do have a &lt;code&gt;_productCategory.html&lt;/code&gt; template.  And each product category has its own page. ...that is, &lt;code&gt;productCategory/{slug}&lt;/code&gt; with &lt;code&gt;{slug}&lt;/code&gt; being an individual product category.   And I have a link to each product category in my nav.   I know, pretty basic.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are multiple ways to skin the cat, but am I missing out on anything by not using a single for each product category page?  Is there any impact on SEO?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-09-20T19:38:18.073" Title="Categories, Single and Channels ....SEO" Tags="&lt;templating&gt;&lt;categories&gt;&lt;seo&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16793" PostTypeId="1" AcceptedAnswerId="16794" CreationDate="2016-09-14T20:27:10.080" Score="1" ViewCount="321" Body="&lt;p&gt;I have the 404 page setup as a single in sections under &lt;code&gt;page404&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;postImage&lt;/code&gt; field that pulls images from assets.  It is assigned to the &lt;code&gt;page404&lt;/code&gt; field layout and it is assigned in the entry.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the this template approach:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notFound = craft.entries.section('page404') %}&#xA;&amp;lt;img src=&quot;{{ notFound.postImage.first().url }}&quot; width=&quot;800&quot; height=&quot;800&quot; alt=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I keep getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;url&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;What am I doing wrong, and how should it be template?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2016-09-14T20:42:18.983" LastActivityDate="2016-09-14T20:42:18.983" Title="Can't Access Image URL on Single Page" Tags="&lt;templating&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16794" PostTypeId="2" ParentId="16793" CreationDate="2016-09-14T20:41:15.880" Score="1" Body="&lt;p&gt;You left off the &lt;code&gt;.first()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notFound = craft.entries.section('page404').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without that, the Element Criteria Model will default to &lt;code&gt;.find()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;first&lt;/code&gt; - Returns a single Entry Model.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;find&lt;/code&gt; - Returns an array of Entry Models.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;It doesn't matter this this is a Single section!&lt;/strong&gt; All Element Criteria Models have the same behavior, whether they're fetching data from a Single, Channel, or Structure.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-14T20:41:15.880" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16795" PostTypeId="1" AcceptedAnswerId="16802" CreationDate="2016-09-14T20:42:53.483" Score="3" ViewCount="208" Body="&lt;p&gt;Is there comparable syntax to display dimension and weight filter settings from Commerce similar to those for currency eg: &lt;code&gt;{{ variant.price|currency('CAD') }}&lt;/code&gt;? Couldn't see any info on this in the docs. &lt;/p&gt;&#xA;" OwnerUserId="4962" LastEditorUserId="57" LastEditDate="2016-09-15T04:27:31.337" LastActivityDate="2016-09-15T04:53:17.620" Title="Filter syntax for Dimensions &amp; Weight?" Tags="&lt;plugin-craftcommerce&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16796" PostTypeId="2" ParentId="16781" CreationDate="2016-09-14T20:53:12.083" Score="1" Body="&lt;p&gt;You will need to add a template called test.html that extends the &quot;_layout.html&quot; template. The layout template is just a wrapper template, and with the &quot;_&quot; in front of it, it will always be invisible to a browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the twig references on extending templates. Also look at the templates supplied with the initial install to get a better idea how this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;Twig Extend&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes are for more refined routing of templates and you should not need a route for current implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine if &quot;_layout.html&quot; were named &quot;_wrapper.html&quot; and it makes a little more sense.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-14T20:53:12.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16797" PostTypeId="1" CreationDate="2016-09-14T21:09:18.243" Score="1" ViewCount="229" Body="&lt;p&gt;I have multiple checkboxs in a form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;Classification[]&quot; value=&quot;Hub Zone&quot;&amp;gt;Hub Zone&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;Classification[]&quot; value=&quot;Not Applicable&quot;&amp;gt;Not &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After submit Get info is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 'Classification' =&amp;gt; &#xA;  array (&#xA;    0 =&amp;gt; 'Hub',&#xA;    1 =&amp;gt; 'Not Applicable',&#xA;  ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get error : array to string conversion on below code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 'Classification'  =&amp;gt; array(AttributeType::Mixed, 'required' =&amp;gt; true, 'label' =&amp;gt; 'Classification')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;stack Trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP notice&#xA;Array to string conversion&#xA;&#xA;/home/www/html/www3/craft/storage/runtime/compiled_templates/3d/3df3f71b6051f05e907988ee087f2136f9ad04870a88d4a66539df50db139f6d.php(39)&#xA;&#xA;27         }&#xA;28         // line 6&#xA;29         if ((array_key_exists(&quot;fields&quot;, $context) &amp;amp;&amp;amp; twig_length_filter($this-&amp;gt;env, (isset($context[&quot;fields&quot;]) ? $context[&quot;fields&quot;] : $this-&amp;gt;getContext($context, &quot;fields&quot;))))) {&#xA;30             // line 7&#xA;31             echo &quot;    &quot;;&#xA;32             $context['_parent'] = $context;&#xA;33             $context['_seq'] = twig_ensure_traversable((isset($context[&quot;fields&quot;]) ? $context[&quot;fields&quot;] : $this-&amp;gt;getContext($context, &quot;fields&quot;)));&#xA;34             foreach ($context['_seq'] as $context[&quot;_key&quot;] =&amp;gt; $context[&quot;field&quot;]) {&#xA;35                 // line 8&#xA;36                 echo &quot;        &quot;;&#xA;37                 echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute($context[&quot;field&quot;], &quot;label&quot;, array()), &quot;html&quot;, null, true);&#xA;38                 echo &quot;: &quot;;&#xA;39                 echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute($context[&quot;field&quot;], &quot;value&quot;, array()), &quot;html&quot;, null, true);&#xA;40                 echo &quot;&#xA;41 &#xA;42     &quot;;&#xA;43             }&#xA;44             $_parent = $context['_parent'];&#xA;45             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['field'], $context['_parent'], $context['loop']);&#xA;46             $context = array_intersect_key($context, $_parent) + $_parent;&#xA;47         }&#xA;48         // line 12&#xA;49         if ((array_key_exists(&quot;footer&quot;, $context) &amp;amp;&amp;amp; twig_length_filter($this-&amp;gt;env, (isset($context[&quot;footer&quot;]) ? $context[&quot;footer&quot;] : $this-&amp;gt;getContext($context, &quot;footer&quot;))))) {&#xA;50             // line 13&#xA;51             echo &quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5227" LastEditorUserId="5227" LastEditDate="2016-09-15T13:12:17.853" LastActivityDate="2016-09-15T13:30:03.457" Title="form submission with checkbox list" Tags="&lt;form&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16798" PostTypeId="1" AcceptedAnswerId="20422" CreationDate="2016-09-14T21:24:30.080" Score="9" ViewCount="4255" Body="&lt;p&gt;I want to build my first website with Vue.js but have difficulties how to start. &#xA;Craft and Vue.js both use &lt;code&gt;{{ }}&lt;/code&gt; as delimiters, but I &lt;a href=&quot;http://vuejs.org/api/#delimiters&quot;&gt;found out&lt;/a&gt; that I can change this for Vue. So to start, I tried the following in my JS file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Vue.config.debug = true;&#xA;Vue.config.delimiters = ['${', '}'];&#xA;&#xA;new Vue({&#xA;    el: '#content',&#xA;    data: {&#xA;        message: 'Hello Vue.js!'&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the output I get is &lt;code&gt;${ message }&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the html file I have the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;    ${ message }&#xA;&amp;lt;/div&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the html file, I first load vue.js, then my script.&#xA;I use Vue.js v2.0.0-rc.6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can make this work?&lt;/p&gt;&#xA;" OwnerUserId="5366" LastEditorUserId="22" LastEditDate="2017-05-09T21:05:16.313" LastActivityDate="2018-06-15T13:08:17.627" Title="Use Vue.js with Craft" Tags="&lt;templating&gt;&lt;frontend&gt;" AnswerCount="3" CommentCount="10" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16799" PostTypeId="2" ParentId="16791" CreationDate="2016-09-15T00:43:08.107" Score="3" Body="&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; parameter accepts either a single element ID or model, or an array of element IDs or models. It doesn't accept asset source handles, section handles, or a particular element type constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that in order to pull all tags related to a specific element type, you'll need to give the &lt;code&gt;relatedTo&lt;/code&gt; parameter &lt;em&gt;an array of all IDs for that particular element type&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not specific about what &lt;code&gt;travelImages&lt;/code&gt; are, but assuming it's an Asset source, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'elementType' =&amp;gt; ElementType::Tag,&#xA;'criteria' =&amp;gt; [&#xA;    'relatedTo' =&amp;gt; craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset, [&#xA;        'limit' =&amp;gt; null,&#xA;    ])-&amp;gt;ids(),&#xA;    'limit' =&amp;gt; null,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if &lt;code&gt;travelImages&lt;/code&gt; isn't an Asset source, you'll need to change &lt;code&gt;ElementType::Asset&lt;/code&gt; to &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/enums/ElementType.php#L21&quot; rel=&quot;nofollow&quot;&gt;the appropriate element type&lt;/a&gt; (e.g. &lt;code&gt;ElementType::Entry&lt;/code&gt;, &lt;code&gt;ElementType::Category&lt;/code&gt; etc).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-02T17:43:03.550" LastActivityDate="2016-10-02T17:43:03.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16800" PostTypeId="1" CreationDate="2016-09-15T04:41:32.160" Score="1" ViewCount="52" Body="&lt;p&gt;My plugin has a custom &lt;code&gt;ResponseRecord&lt;/code&gt; with relations to a &lt;code&gt;UserRecord&lt;/code&gt; and &lt;code&gt;ElementRecord&lt;/code&gt; as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;    return array(&#xA;        'user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord', 'user_id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;        'element' =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'question_id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can I query custom fields on the user or element models when querying with &lt;code&gt;findAll()&lt;/code&gt; on this custom &lt;code&gt;ResponseRecord&lt;/code&gt; record? If not, is there a more efficient way than iterating through all &lt;code&gt;ResponseModel&lt;/code&gt; and &lt;code&gt;UserModel&lt;/code&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I need to query where &lt;code&gt;user.industry&lt;/code&gt; (custom text field) is 'Agriculture' and where the &lt;code&gt;ResponseRecord&lt;/code&gt;'s &lt;code&gt;year&lt;/code&gt; attribute is &lt;code&gt;2016&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4042" LastActivityDate="2016-09-15T04:41:32.160" Title="Filter conditions on related UserModel in custom Record" Tags="&lt;relations&gt;&lt;models&gt;&lt;custom-field&gt;&lt;records&gt;&lt;usermodel&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16801" PostTypeId="2" ParentId="16784" CreationDate="2016-09-15T04:43:34.510" Score="1" Body="&lt;p&gt;It's a bit confusing at the moment (should be cleaner in the upcoming Craft 3), but for now, if you use &lt;code&gt;{{ entry.dateCreated|date }}&lt;/code&gt;, it should take the timezone into account and display the correct time.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="1098" LastEditDate="2016-09-15T09:04:30.907" LastActivityDate="2016-09-15T09:04:30.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16802" PostTypeId="2" ParentId="16795" CreationDate="2016-09-15T04:46:52.927" Score="3" Body="&lt;p&gt;There is currently no filter but you can access the units of measurement from your settings, and display the measurement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set weightUnits = craft.commerce.settings.weightUnits %}&#xA;{% set dimensionUnits = craft.commerce.settings.dimensionUnits %}&#xA;&#xA;&#xA;{{ variant.weight }} {{ weightUnits }} // 10 mm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-09-15T04:53:17.620" LastActivityDate="2016-09-15T04:53:17.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16803" PostTypeId="2" ParentId="10137" CreationDate="2016-09-15T06:31:06.170" Score="4" Body="&lt;p&gt;Even easier way… Just add &lt;code&gt;.html.twig&lt;/code&gt; to &lt;code&gt;defaultTemplateExtensions&lt;/code&gt; and update your template file extension to &lt;code&gt;.html.twig&lt;/code&gt;. PHPStorm will pick up both html and twig syntax highlighting.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; *&#xA; * All of your system's general configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/general.php&#xA; */&#xA;&#xA;return array(&#xA;    'defaultTemplateExtensions' =&amp;gt; array('html.twig', 'html'),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="963" LastActivityDate="2016-09-15T06:31:06.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16804" PostTypeId="1" AcceptedAnswerId="16810" CreationDate="2016-09-15T13:14:31.970" Score="2" ViewCount="364" Body="&lt;p&gt;We are using Hampsink's &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import&lt;/a&gt; plug-in (0.8.33) and we have a very simple CSV for testing. One row, three columns. One of these columns contains a comma-separated list of categories. These are top level, no heiarchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've tried the titles:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Provider Id,Provider Name,Service Areas&#xA;62686,Walgreens,&quot;Defiance County,Erie County,Fulton County,Henry County,Lucas County,Ottawa County,Paulding County,Sandusky County,Williams County,Wood County&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've tried the slugs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Provider Id,Provider Name,Service Areas&#xA;62686,Walgreens,&quot;defiance-county,erie-county,fulton-county,henry-county,lucas-county,ottawa-county,paulding-county,sandusky-county,williams-county,wood-county&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Category field always ends up blank after an otherwise successful import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, categories are set and have their own URL. Since there is no heirarchy, that is set to simply &lt;code&gt;{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've read the several, several related posts and questions about this and there seems to be a lot of frustration around importing entries with categories. Yet still... What are we doing wrong? What's the trick? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2931&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2016-09-15T17:55:19.557" Title="What's the trick to importing an entry with a categories field?" Tags="&lt;categories&gt;&lt;import&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16805" PostTypeId="2" ParentId="16797" CreationDate="2016-09-15T13:30:03.457" Score="1" Body="&lt;p&gt;I think your checkboxes need to be as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[Classification][]&quot; value=&quot;Hub Zone&quot;&amp;gt;Hub Zone&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[Classification][]&quot; value=&quot;Not Applicable&quot;&amp;gt;Not &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-15T13:30:03.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16806" PostTypeId="1" AcceptedAnswerId="16808" CreationDate="2016-09-15T13:39:38.987" Score="4" ViewCount="502" Body="&lt;p&gt;I'm attempting to create a simple route that points to a template from a plugin. Note that I am attempting to create a page on the front-facing website, &lt;strong&gt;not&lt;/strong&gt; the admin panel. Plugin (named: 'curious') is created with the following method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/plugins/curious/CuriousPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CuriousPlugin extends BasePlugin&#xA;{&#xA;&#xA;    ...&#xA;&#xA;    public function registerSiteRoutes()&#xA;    {&#xA;        return array(&#xA;            'example' =&amp;gt; 'curious/templates/example'&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a template in &lt;code&gt;craft/plugins/curious/templates/example.html&lt;/code&gt;, however, going to the URL &lt;code&gt;/example&lt;/code&gt; just gives me a 404. If I visit &lt;code&gt;/admin/curious/example&lt;/code&gt; it does exist and works. However, I don't want the page to be in the admin, I would like it to be visible on the front-facing website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? &lt;/p&gt;&#xA;" OwnerUserId="5607" LastEditorUserId="5607" LastEditDate="2016-09-15T15:00:28.050" LastActivityDate="2016-09-16T02:53:16.423" Title="Simple template routes with plugins" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16808" PostTypeId="2" ParentId="16806" CreationDate="2016-09-15T15:13:45.137" Score="4" Body="&lt;p&gt;This is a tricky topic for a simple answer. Off the top of my head, there are two general approaches you may fall in for this. I'll keep my answer fairly broad:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;URL-Enabled Elements&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You can create an Element Type and implement the method &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/BaseElementType#routeRequestForMatchedElement-detail&quot; rel=&quot;nofollow&quot;&gt;routeRequestForMatchedElement&lt;/a&gt;. This approach would require you to have a Custom Element, and have a need for that Element to be URL-enabled like Entries or Categories or Products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this approach you would not need to setup &lt;code&gt;registerSiteRoutes&lt;/code&gt; .The Element API would handle the front-end request in the same way other URL-enabled Element requests are handled.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Your Plugin has a template in the plugins template folder that you want to render on the front-end of the website&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The main concept to understand here is that Craft has two Template Modes: &lt;code&gt;Site&lt;/code&gt; and &lt;code&gt;CP&lt;/code&gt;. Depending on which template mode is active, Craft will look in different places for the template to load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To set the template mode in your code, you can use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Tell craft to look in the front end craft/templates folder for a template&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;&#xA;// Tell craft to look in the back end craft/app/templates folder for a template (where you can later update the path to target your plugin template folder)&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::CP);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you are on the right side of the fence, you can then render the template you want and return it to the page. You would do this in one of two places:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controllers&lt;/strong&gt; If your logic is taking place in a controller you will need to render the template and return the rendered template to the page as a variable. Two scenarios in controllers where this may occur:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Responding to a page with errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$output = craft()-&amp;gt;curiousService-&amp;gt;getTemplate()&#xA;&#xA;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;  'stuff' =&amp;gt; $output&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rendering a template as the final step in the controller action (this may apply to CP scenarios more than front-end scenarios).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('curious/example', array(&#xA;    'stuff' =&amp;gt; $stuff,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt; If your logic is taking place in the middle of the page, you may need to create a custom variable that renders your template and outputs it when the variable is called: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myCuriousPlugin.getMyTemplate() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Be sure to Flip/Flop&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In either case, since you are flip/flopping on which part of the site is rendering your templates, you'll want to be sure to set your Template Mode back to the &lt;code&gt;Site&lt;/code&gt; side of things once you are done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Front end page calls your plugin&#xA;&#xA;// Switch things to look for templates on the back end&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::CP);&#xA;&#xA;// Do your thing&#xA;//&#xA;// Note the template path is just the name of the plugin &#xA;// and the folder in the plugins template folder that you &#xA;// want to access, and that we are omitting the word 'templates'&#xA;$html = craft()-&amp;gt;templates-&amp;gt;render('curious/example', array(&#xA;  'someVariable'      =&amp;gt; $yourResults,&#xA;  'someOtherVariable' =&amp;gt; $someOtherStuff&#xA;));&#xA;&#xA;// Switch things back to look for templates on the front-end&#xA;// so that any template-related things that after you behave&#xA;// as normal&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-09-16T02:53:16.423" LastActivityDate="2016-09-16T02:53:16.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16810" PostTypeId="2" ParentId="16804" CreationDate="2016-09-15T17:55:19.557" Score="1" Body="&lt;p&gt;It's the &lt;strong&gt;modifyImportRow&lt;/strong&gt; hook. If one uses that sample code in the &lt;a href=&quot;https://github.com/boboldehampsink/import/blob/develop/README.md&quot; rel=&quot;nofollow&quot;&gt;Read Me&lt;/a&gt;, related categories will not import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we will have to run at least two imports, one with our Import Helper that uses the hook enabled  (for tables, booleans, dates, etc.), and one without, in order to append the related categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless someone can provide better example code to exclude an entry category field, but I can't think of how right now.&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2016-09-15T17:55:19.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16811" PostTypeId="1" AcceptedAnswerId="16826" CreationDate="2016-09-15T18:37:39.320" Score="2" ViewCount="500" Body="&lt;p&gt;Question is similar to some others I've looked through but their solutions don't work as there are some differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently this doesn't output any of the fields I try to access within the internal matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle').find() %}&#xA;    {% for block in entry.matrixHandle.limit(1) %}&#xA;        {% for entry in block.entryFieldMatrixHandle.first() %}&#xA;            {% for block in entry.entrysMatrixHandle.limit(1) %}&#xA;                {{ block.fieldHandle }}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="45" LastEditDate="2016-09-15T18:55:29.753" LastActivityDate="2016-09-16T19:42:52.620" Title="Display text field from Matrix of an Entry Field in Matrix" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;loop&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16812" PostTypeId="1" AcceptedAnswerId="16878" CreationDate="2016-09-15T20:57:53.503" Score="4" ViewCount="715" Body="&lt;p&gt;I am having the same issue as here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9960/another-index-phpp-problem&quot;&gt;Another index.php?p= problem&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to post this as a comment rather than open another post but I don't have enough reputation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried all of the suggestions listed and none of them are working. Without index.php I get 404's.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried with the rule applied to the config file it breaks the admin (doesn't load asset files like css - they're still pointing to URLs with index.php) and I still get 404's on the entry URLs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also double checked with the hosting company on the apache configurations and the &lt;code&gt;AllowOverride All&lt;/code&gt; is indeed set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did try to add &lt;code&gt;RewriteBase /&lt;/code&gt; just below &lt;code&gt;RewriteEngine On&lt;/code&gt; and nothing happened. I also verified the file is actually working by adding invalid stuff in it and getting a server error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this in my general.php config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array (&#xA;        'omitScriptNameInUrls' =&amp;gt; true&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I do, it doesn't fix the index.php issue, but it removes index.php from the admin, but breaks the admin because the assets 404 (mentioned above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions out there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2018-02-10T03:53:19.853" Title="Cannot remove index.php from URLs either" Tags="&lt;config&gt;&lt;htaccess&gt;&lt;index&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16813" PostTypeId="1" AcceptedAnswerId="16886" CreationDate="2016-09-16T01:16:12.073" Score="2" ViewCount="433" Body="&lt;p&gt;I'm trying to submit a guest entry by building a javascript array of objects to mimic a form submission and submit using ajax. I've managed to successfully submit the entry with just a title but when trying to add Matrix/Super Table rows I'm having no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked here &lt;a href=&quot;https://github.com/engram-design/SuperTable/wiki/Updating-a-Super-Table-field-from-a-front-end-form&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/SuperTable/wiki/Updating-a-Super-Table-field-from-a-front-end-form&lt;/a&gt; to get ideas for how this should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Super table block handle is &lt;code&gt;answers&lt;/code&gt; and the Super Table field I'm trying to submit is a plain text field with the handle &lt;code&gt;question&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#submitQuiz').on('click', function (e) {&#xA;  e.preventDefault();&#xA;&#xA;  var testEntrySubmission = [&#xA;    {&#xA;      name: 'action',&#xA;      value: 'guestEntries/saveEntry'&#xA;    },&#xA;    {&#xA;      name: 'sectionId',&#xA;      value: '5'&#xA;    },&#xA;    {&#xA;      name: 'enabled',&#xA;      value: '1'&#xA;    },&#xA;    {&#xA;      name: 'redirect',&#xA;      value: '/'&#xA;    },&#xA;    {&#xA;      name: 'title',&#xA;      value: 'user name'&#xA;    },&#xA;    {&#xA;      name: 'answers[new1][fields][question]',&#xA;      value: 'fingers crossed'&#xA;    }&#xA;  ];&#xA;&#xA;  $.post('http://mywebsite.dev/', testEntrySubmission, function(response) {&#xA;    if (response.success) {&#xA;      console.log('success')&#xA;    } else {&#xA;      // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;      // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;      alert('An error occurred. Please try again.');&#xA;    }&#xA;  });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5636" LastEditorUserId="4466" LastEditDate="2016-09-16T11:26:05.773" LastActivityDate="2016-09-20T12:53:14.013" Title="Creating a guest entry, with a Matrix field, using Ajax" Tags="&lt;matrix&gt;&lt;ajax&gt;&lt;json&gt;&lt;guest-entries&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16814" PostTypeId="1" AcceptedAnswerId="16815" CreationDate="2016-09-16T05:00:59.477" Score="2" ViewCount="101" Body="&lt;p&gt;I have a chunk of PHP code which &lt;em&gt;should not&lt;/em&gt; be run if the script is being executed from a task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We already have these methods, which are similar to what I'm looking for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;craft()-&amp;gt;isConsole()&lt;/code&gt; - Whether the script is running in the console.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;isCpRequest()&lt;/code&gt; - Whether the script is running in the CP.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to tell if the script is running inside of a task?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Since my research has turned up nothing so far, I opened a &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/16112530-an-istask-method-to-determine-if-script-is-occ&quot; rel=&quot;nofollow&quot;&gt;related feature request...&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-16T05:10:31.613" Title="Is it possible to determine if a script is running within a task?" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16815" PostTypeId="2" ParentId="16814" CreationDate="2016-09-16T05:10:31.613" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/TasksService#getRunningTask-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;TasksService-&amp;gt;getRunningTask()&lt;/code&gt;&lt;/a&gt; will tell you if a task &lt;em&gt;is currently running&lt;/em&gt;. However, it doesn't tell you whether a particular chunk of code is being executed by that Task or by some other function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most straightforward solution I can think of would be to write yourself a little helper method to check whether the call stack includes a Task class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;static function inTask()&#xA;{&#xA;   foreach(debug_backtrace() as $caller)&#xA;   {&#xA;      if (substr($caller['file'], -8) === 'Task.php') return true;&#xA;   }&#xA;   return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add that to your plugin class, and then you can call it anywhere you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (MyPlugin::inTask()) ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-09-16T05:10:31.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16816" PostTypeId="2" ParentId="14921" CreationDate="2016-09-16T06:03:03.283" Score="4" Body="&lt;p&gt;Inspired in part by Mats' detailed answer, I've written a plugin that does just this: &lt;a href=&quot;https://straightupcraft.com/craft-plugins/mn-snitch&quot; rel=&quot;nofollow&quot;&gt;MN Snitch&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy!&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-16T06:03:03.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16817" PostTypeId="1" AcceptedAnswerId="16818" CreationDate="2016-09-16T11:05:15.483" Score="2" ViewCount="746" Body="&lt;p&gt;I have added a form to my front-end to edit the user's first and last name. Editing all the other fields is not a problem but when I try to edit the first or last name it doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I might need to change &lt;code&gt;name=&quot;fields[firstName]&quot;&lt;/code&gt; to something else, but I don't know to what I should change it to.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; id=&quot;loginForm&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;h1 class=&quot;login-text&quot;&amp;gt;{{'Profiel bewerken'|upper}}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;profile&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;  &#xA;&#xA;    &amp;lt;label for=&quot;voornaam&quot;&amp;gt;{{&quot;voornaam&quot;|title}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;voornaam&quot; name=&quot;fields[firstName]&quot;&#xA;    {% if currentUser.firstName %}value=&quot;{{ currentUser.firstName }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;achternaam&quot;&amp;gt;{{&quot;achternaam&quot;|title}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;achternaam&quot; name=&quot;fields[lastName]&quot;&#xA;    {% if currentUser.lastName %}value=&quot;{{ currentUser.lastName }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;woonplaats&quot;&amp;gt;{{&quot;woonplaats&quot;|title}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;woonplaats&quot; name=&quot;fields[woonplaats]&quot;&#xA;    {% if currentUser.woonplaats %}value=&quot;{{ currentUser.woonplaats }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;postcode&quot;&amp;gt;{{&quot;postcode&quot;|title}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;postcode&quot; name=&quot;fields[postcode]&quot;&#xA;    {% if currentUser.postcode %}value=&quot;{{ currentUser.postcode }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;adres&quot;&amp;gt;{{&quot;adres&quot;|title}}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;adres&quot; name=&quot;fields[adres]&quot;&#xA;    {% if currentUser.adres %}value=&quot;{{ currentUser.adres }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {# Check to see if the user has a photo  #}&#xA;    &amp;lt;label&amp;gt;Profielfoto&amp;lt;/label&amp;gt;&amp;lt;br /&amp;gt;&#xA;    {% if currentUser.photoUrl %}&#xA;        &amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot; alt=&quot;{{ currentUser.title }}&quot;&amp;gt;&amp;lt;br /&amp;gt;&#xA;        &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Change Photo&quot;&amp;gt;&#xA;    {% else %}&#xA;        {# If no photo exists, give the option to upload a new one #}&#xA;        &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {# &amp;lt;input type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}&quot;&amp;gt; #}&#xA;&#xA;    &amp;lt;br /&amp;gt;&amp;lt;button type=&quot;submit&quot;&amp;gt;Opslaan&amp;lt;/button&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="4466" LastEditDate="2016-09-16T11:15:07.860" LastActivityDate="2016-09-16T11:16:38.293" Title="Edit user's first and last name" Tags="&lt;templating&gt;&lt;form&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16818" PostTypeId="2" ParentId="16817" CreationDate="2016-09-16T11:16:38.293" Score="3" Body="&lt;p&gt;A User's first and last name fields don't need the &lt;code&gt;fields[]&lt;/code&gt; prefix as they aren't custom fields added to the user field group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So using the following should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;voornaam&quot;&amp;gt;{{&quot;voornaam&quot;|title}}&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;voornaam&quot; name=&quot;firstName&quot;&#xA;{% if currentUser.firstName %}value=&quot;{{ currentUser.firstName }}&quot;{% endif %}&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;achternaam&quot;&amp;gt;{{&quot;achternaam&quot;|title}}&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;achternaam&quot; name=&quot;lastName&quot;&#xA;{% if currentUser.lastName %}value=&quot;{{ currentUser.lastName }}&quot;{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-09-16T11:16:38.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16819" PostTypeId="1" CreationDate="2016-09-16T13:11:48.820" Score="2" ViewCount="20" Body="&lt;p&gt;I have a group of users who are allowed to create entries and edit them but I want to put a window on how much time they have in which they can edit it. For example, after initial submission they would only have two weeks to edit the entry before only an admin can make changes to that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how to run the logic to check the user groups and calculate cut-off dates but I have no idea where I need to hook in to be able to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anywhere I can hook in to run this logic? If so, where is this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance would be really appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5638" LastActivityDate="2016-09-16T23:36:24.810" Title="Close entry editing after set time (for certain a user group)" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;admin&gt;&lt;events&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16821" PostTypeId="1" AcceptedAnswerId="16827" CreationDate="2016-09-16T14:58:57.153" Score="1" ViewCount="143" Body="&lt;p&gt;I'm trying to build a plugin that fires on the Contact Form Plugins &lt;code&gt;contactForm.beforeSend&lt;/code&gt;what the plugin needs to do is add a recipient email if certain countries are selected. So far I have created the below which checks for the countries and checks against an array to see if they are in it. This works, so far so good. What I need to do now is somehow add to the contact form plugins &lt;code&gt;$toEmails&lt;/code&gt; variable if a country is in the array but I'm not sure how to do this from within the event listener. Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    craft()-&amp;gt;on('contactForm.beforeSend', function(ContactFormEvent $event) {&#xA;        $message = $event-&amp;gt;params['message'];&#xA;        $ukArray = array('United Kingdom','Wales','Scotland','Ireland');&#xA;        $country = '';&#xA;        foreach ($message as $key =&amp;gt; $field) {&#xA;            if($key == 'messageFields') {&#xA;                $country = $field['Country'];&#xA;            }&#xA;        }&#xA;        if (in_array($country, $ukArray)) {&#xA;            // add an email address to the contact form $toEmails array&#xA;        } &#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2016-09-16T23:30:08.387" Title="Contact Form Plugin how to send to different recipients based on country selected?" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16822" PostTypeId="1" AcceptedAnswerId="16825" CreationDate="2016-09-16T16:10:22.177" Score="1" ViewCount="87" Body="&lt;p&gt;I have a list of forms which I want to sort by day:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupVerbund = 'datum.day' %}&#xA;&#xA;{% set allSubmissions = craft.amForms.submissions({&#xA;   formHandle: 'reservation',&#xA;   limit: null}).find()&#xA;%}&#xA;{% set entriesByDay = allSubmissions | group(groupVerbund) %}&#xA;&#xA;&#xA;{% for entriesInDay in entriesByDay %}&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for entry in entriesInDay %}&#xA;      {% if loop.first %}&amp;lt;h2&amp;gt;{{ entry.datum | date('d.m.Y') }}&amp;lt;/h2&amp;gt;{% endif %}&#xA;       &amp;lt;li&amp;gt;{{ entry.datum | date('d. M Y') }} | {{ entry.vorname }} {{ entry.nachname }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but there are two entries which just are at the wrong place:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entries in: 22. Okt. 2016&#xA;------------------&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;22. Jan. 2017 | Name Surname // This one is wrong&#xA;22. Okt. 2016 | Name Surname&#xA;22. Okt. 2016 | Name Surname&#xA;&#xA;Entries in: 13. Nov.2016&#xA;------------------&#xA;13. Nov. 2016 | Name Surname&#xA;13. Dez. 2016 | Name Surname // This one is wrong&#xA;13. Nov. 2016 | Name Surname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything else is at the right place except these two entries. &lt;code&gt;{{ entry.datum}}&lt;/code&gt; is a custom date field so it's not possible to add a wrong date format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-09-16T19:39:34.840" Title="Group by day does strange exeptions" Tags="&lt;datetime&gt;&lt;filter&gt;&lt;group&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16823" PostTypeId="1" CreationDate="2016-09-16T17:51:01.833" Score="0" ViewCount="20" Body="&lt;p&gt;The move symbol -  the one that allows you to move a category in the list up or down, etc. -- is gone from one of my category groups.  It's the one that appears just after the checkbox to select a category and right before the name of a category.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get it back?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know, stupid question. But I have no clue what I did to make it disappear.  The other category groups are okay. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-09-16T17:55:02.893" Title="Move Icon Disappears from Categories editor" Tags="&lt;categories&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16824" PostTypeId="2" ParentId="16823" CreationDate="2016-09-16T17:55:02.893" Score="1" Body="&lt;p&gt;Ugh...never mind.  I guess I took it off structure without realizing it.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-09-16T17:55:02.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16825" PostTypeId="2" ParentId="16822" CreationDate="2016-09-16T19:05:22.990" Score="4" Body="&lt;p&gt;When you specifically group on &lt;code&gt;dateField.day&lt;/code&gt; (in your case, the &lt;code&gt;|group('datum.day')&lt;/code&gt; part), the group filter won't care about the month or year for the date field – only the day. This means that any entry posted on the 22nd of any month in any year will be grouped together, which is probably not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the solution is simply to group on the date field without a postfix (which will create an array index for each unique day/date):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupVerbund = 'datum' %}&#xA;{% set entriesByDay = allSubmissions | group(groupVerbund) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additionally, I can't help but notice the &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; tag inside your &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;, which is strictly speaking non-valid HTML. A better solution might be to do something like this (this would also save you a conditional):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for day, entries in entriesByDay %}&#xA;    &amp;lt;div class=&quot;day&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ day|date('d.m.Y') }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                {{ entry.datum | date('d. M Y') }} | {{ entry.vorname }} {{ entry.nachname }}&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One final issue is sorting – you'll probably see the dates mixed up, which is just how the &lt;code&gt;|group&lt;/code&gt; filter works – it only groups, and cares less about sorting. Basically, the &lt;code&gt;group&lt;/code&gt; filter will return an array that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    '2016-10-22' =&amp;gt; [array of entries],&#xA;    '2017-01-22' =&amp;gt; [array of entries],&#xA;    '2016-11-13' =&amp;gt; [array of entries],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which means that if you want the output to be sorted by date, you'll need to sort that array on its &lt;em&gt;keys&lt;/em&gt; (i.e. the dates) – something Twig's native &lt;code&gt;sort&lt;/code&gt; filter regrettably doesn't do, but which is easily accomplished with the fantastic &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow&quot;&gt;SuperSort plugin&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesByDay = allSubmissions | group(groupVerbund) | supersort('ksort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-09-16T19:39:34.840" LastActivityDate="2016-09-16T19:39:34.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16826" PostTypeId="2" ParentId="16811" CreationDate="2016-09-16T19:35:15.740" Score="1" Body="&lt;p&gt;There's a couple of problems with your current code – for one, you're (as Brad mentions in the comments above) doing some variable overwriting by reusing the &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;block&lt;/code&gt; names. Also, you're attempting to do a &lt;code&gt;for&lt;/code&gt; loop on the result from a call to &lt;code&gt;first()&lt;/code&gt;, which won't work (&lt;code&gt;first()&lt;/code&gt; returns a single element, not an array).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, I'd suggest getting rid of all the &lt;code&gt;for&lt;/code&gt; loops (you're looping on a resultset with a single element in each of your inner loops), in an attempt to make the code a tad more clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle') %}&#xA;    {% set outerBlock = entry.matrixHandle.first() %}&#xA;    {% set outerBlockEntry = outerBlock ? outerBlock.entryFieldMatrixHandle.first() %}&#xA;    {% set innerBlock = outerBlockEntry ? outerBlockEntry.entrysMatrixHandle.first() %}&#xA;    {{ innerBlock ? innerBlock.fieldHandle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's a lot of &lt;code&gt;{% set %}&lt;/code&gt; statements, though – you could also do this (although I'm honestly not sure which option is more readable):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle') %}&#xA;    {% set block = entry.matrixHandle.first().entryFieldMatrixHandle.first().entrysMatrixHandle.first()|default %}&#xA;    {{ block ? block.fieldHandle }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, as an alternative approach altogether you could use the &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; param:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle') %}&#xA;&#xA;    {% set block = craft.entries.relatedTo({&#xA;        sourceElement: entry.matrixHandle.first(),&#xA;        field: 'entryFieldMatrixHandle'&#xA;    }).first().entrysMatrixHandle.first()|default %}&#xA;&#xA;    {{ block ? block.fieldHandle }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;None of the above examples are tested, and now my head hurts – but hopefully it'll prove helpful :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-09-16T19:42:52.620" LastActivityDate="2016-09-16T19:42:52.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16827" PostTypeId="2" ParentId="16821" CreationDate="2016-09-16T23:30:08.387" Score="0" Body="&lt;p&gt;I'm not sure this is going to be possible with the current version (1.8.1) of Contact Form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing passed into the &lt;code&gt;beforeSend&lt;/code&gt; event is the message, so it doesn't really give you a chance to modify other properties of the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could pull it off by &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow&quot;&gt;dynamically adding these addresses&lt;/a&gt; with some JavaScript that checked selected countries and added to post, but those values are expected to be &lt;code&gt;|hash&lt;/code&gt;ed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could always just fork the plugin and modify it for your specific needs, too.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-16T23:30:08.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16828" PostTypeId="2" ParentId="16819" CreationDate="2016-09-16T23:36:24.810" Score="2" Body="&lt;p&gt;Seems like you'd just need to write a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; that &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;listened&lt;/a&gt; to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveEntry&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin would check if the entry author is in the user group you're interested in, and if it's a new entry just let it save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's an existing entry, check the dateCreated date against your window and see if it's still valid.  If it's outside of your window you can set &lt;a href=&quot;https://craftcms.com/classreference/etc/events/Event#performAction-detail&quot; rel=&quot;nofollow&quot;&gt;performAction&lt;/a&gt; to &lt;code&gt;false&lt;/code&gt; so the entry won't save and set a flash message indicating they're outside the window.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-16T23:36:24.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16829" PostTypeId="1" AcceptedAnswerId="16830" CreationDate="2016-09-17T00:19:37.633" Score="1" ViewCount="759" Body="&lt;p&gt;We just started this process, and I'm having issues migrating. We have a server which we use to build up generic fields and sections, plugins, with dummy content and our developer accounts intact. The way we do fields takes a long time to keep typing in. The idea is that when we deploy a new website, we copy everything to the new site and we have what we need to start content entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I did:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Made a copy of the source craft folder and public folder.&lt;/li&gt;&#xA;&lt;li&gt;Pulled the database from Craft&lt;/li&gt;&#xA;&lt;li&gt;Uploaded new copy of craft to target server&lt;/li&gt;&#xA;&lt;li&gt;Replace the config, plugins, templates, and public directories on the target server with the materials from the source.&lt;/li&gt;&#xA;&lt;li&gt;Create a new database in the Serverpilot backend. (We use SP on all our customer accounts.) We name the database the same, and use the same table prefixes in the settings, as to avoid issues.&lt;/li&gt;&#xA;&lt;li&gt;In PHPMyAdmin, change the collation of the table to utf8_unicode_ci - as it is on the source server.&lt;/li&gt;&#xA;&lt;li&gt;Use PHPMyAdmin to upload copy of source SQL to target database.&lt;/li&gt;&#xA;&lt;li&gt;modify general and db config files to reflect changes&lt;/li&gt;&#xA;&lt;li&gt;Change permissions on target server App, Storage and Config directories to 774&lt;/li&gt;&#xA;&lt;li&gt;go to the admin URL and login. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I can get to the back end. When I go to the Entries section, and click on add entry, or go into a specific section, I get an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level   profile&#xA;Category    system.db.CDbCommand.query&#xA;Message end:system.db.CDbCommand.query(SELECT `t`.`id` AS `t0_c0`, `t`.`structureId` AS `t0_c1`, `t`.`fieldLayoutId` AS `t0_c2`, `t`.`name` AS `t0_c3`, `t`.`handle` AS `t0_c4`, `t`.`hasUrls` AS `t0_c5`, `t`.`template` AS `t0_c6`, `t`.`dateCreated` AS `t0_c7`, `t`.`dateUpdated` AS `t0_c8`, `t`.`uid` AS `t0_c9`, `structure`.`id` AS `t1_c0`, `structure`.`maxLevels` AS `t1_c1`, `structure`.`dateCreated` AS `t1_c2`, `structure`.`dateUpdated` AS `t1_c3`, `structure`.`uid` AS `t1_c4` FROM `craft_categorygroups` `t` LEFT OUTER JOIN `craft_structures` `structure` ON (`t`.`structureId`=`structure`.`id`) ORDER BY name)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I go to the front page, I get an CDbException error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #48 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'craft.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_n2address`, `content`.`field_n2bannerAlignContentContainer`, `content`.`field_n2allDayEvent`, `content`.`field_n2weatherIcon`, `content`.`field_body`, `content`.`field_n2caption`, `content`.`field_n2careerClassification`, `content`.`field_n2careerEndDate`, `content`.`field_n2careerHoursPerWeek`, `content`.`field_n2careerLocation`, `content`.`field_n2careerStartDate`, `content`.`field_n2contactReasons`, `content`.`field_n2eventDirections`, `content`.`field_n2bannerDisplayOnFrontPage`, `content`.`field_n2eventEnd`, `content`.`field_n2eventRegistrationBegins`, `content`.`field_n2eventRegistrationCutoff`, `content`.`field_n2eventStart`, `content`.`field_n2eventHostedBy`, `content`.`field_n2utilityLink`, `content`.`field_metaDescription`, `content`.`field_n2metaSchemaType`, `content`.`field_n2teamMiniBio`, `content`.`field_n2motto`, `content`.`field_n2description`, `content`.`field_n2phone`, `content`.`field_n2status`, `content`.`field_n2weatherTemp`, `content`.`field_n2eventData`, `content`.`field_n2weatherWindBearing`, `content`.`field_n2weatherWindSpeed`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE (((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.id=:elementsid1)) AND (elements.archived = 0)&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `lft`, `postDate` DESC LIMIT 1. Bound with :locale='en_us', :elementsid1='2'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Followed by a MASSIVE stack trace. I've tried exporting from PHPMyAdmin instead, I get the same. I've tried imports and exports from PHPMyMiniAdmin as well, but I'm still throwing the same errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at various articles on how to migrate, but I feel I'm missing something. Are there settings I should be using on import and export in PHPMyAdmin to side-step this? Is there a good step-by-step migration guide for this?&lt;/p&gt;&#xA;" OwnerUserId="4554" LastActivityDate="2016-09-17T16:44:36.253" Title="Migration Errors" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16830" PostTypeId="2" ParentId="16829" CreationDate="2016-09-17T02:26:59.050" Score="3" Body="&lt;p&gt;As the link posted by Moto_Nomad indicated, it was an issue with MySQL strict mode GROUP_BY. In my case, I remedied this by using the following guide:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html&quot; rel=&quot;nofollow&quot;&gt;https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't know if this will be of much help to anyone not running a Digital Ocean / ServerPilot stack, but if it saves someone some grief, I hope it helps. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working like a charm. THANK YOU so soooo much, Moto. You have saved my low-fat turkey bacon!&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="4554" LastEditDate="2016-09-17T16:44:36.253" LastActivityDate="2016-09-17T16:44:36.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16831" PostTypeId="1" CreationDate="2016-09-17T14:41:07.533" Score="5" ViewCount="535" Body="&lt;p&gt;I have a plugin that needs to do something when an entry is deleted. I've recently discovered that the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8460/delete-change-status-from-cp-via-ajax-trigger-event/14612#14612&quot;&gt;entries.deleteEntry event is not fired when deleting bulk entries&lt;/a&gt; (the list view with checkboxes) in the Control Panel (CP). Instead, an &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction&quot; rel=&quot;nofollow noreferrer&quot;&gt;elements.onPerformAction&lt;/a&gt; event is fired (you can also listen for onBeforePerformAction). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I know that these are the events that are fired when deleting an entry from the list view in the CP, and that I'm working with an Element event instead of a Entry event, I'm struggling to access the type of information I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;what type of action is being performed on the element? (Save, Delete, etc.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;how do I identify the entry that the action is being performed on?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="335" LastEditorUserId="22" LastEditDate="2017-06-06T22:03:54.987" LastActivityDate="2017-06-06T22:03:54.987" Title="Get the type of action and the elements(s) that an action is being performed on when listening to elements.onPerformAction?" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16832" PostTypeId="2" ParentId="16831" CreationDate="2016-09-17T14:41:07.533" Score="9" Body="&lt;p&gt;It appears that when one or more Entries (or other types of content) are manipulated (in my case, deleted) from the bulk edit view in the Control Panel, the type of events that are triggered are &lt;strong&gt;Element&lt;/strong&gt; events, rather than &lt;strong&gt;Entry&lt;/strong&gt; events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you refer to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction&quot; rel=&quot;noreferrer&quot;&gt;Craft documentation on elements.onPerformAction&lt;/a&gt;, you can see that the 2 params you get access to are &lt;strong&gt;action&lt;/strong&gt; and &lt;strong&gt;criteria&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I was able to find what I needed when working with elements.onPerformAction and the elements.onBeforePerformAction events.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;What type of action is being performed on the element? (Save, Delete, etc.)&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I was able to capture what type of action was being being performed on my element by looking at the &quot;action&quot; param of the event. Using the following code output the action that was taking place:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$action = $event-&amp;gt;params['action']-&amp;gt;classHandle; //Outputs 'Delete'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This bit of code will output the string 'Delete'. Perfect.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;How do I identify the entry that the action is being performed on.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I learned is that, when working with an Element event, you're not just working with a single entry. You're potentially working with many Entries, or rather &quot;Elements&quot; to be more specific. Because of this, you can't just grab the Element being manipulated in the same style you can with an Entries event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$entry = $event-&amp;gt;params['entry'];&lt;/code&gt; won't work here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This brings us to the &quot;criteria&quot; param of the Element event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simply grab the &quot;criteria&quot; param of the event to get the elements that the event is taking place on. This param contains an ElementCriteriaModel object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Viewing the &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;noreferrer&quot;&gt;class reference for ElementCriteriaModel&lt;/a&gt; shows us what we can do with this object. In my case, I can simply use &lt;code&gt;-&amp;gt;find()&lt;/code&gt; on it to get all of the elements I'm working with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$elements = $event-&amp;gt;params['criteria']-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I now have an array of the Elements having actions taken on them, stored in $entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I have both the type of action and the elements, I have what I was needing to move forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my event listeners in full context. One handles a &lt;code&gt;entries.deleteEntry&lt;/code&gt; event, and the other handles a &lt;code&gt;elements.onBeforePerformAction&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.deleteEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    craft()-&amp;gt;lhngroups_organizations-&amp;gt;deleteOrgCustomerAddress($entry);&#xA;});&#xA;&#xA;craft()-&amp;gt;on('elements.onBeforePerformAction', function(Event $event) {&#xA;    $action = $event-&amp;gt;params['action']-&amp;gt;classHandle; //Outputs 'Delete'&#xA;    $elements = $event-&amp;gt;params['criteria']-&amp;gt;find(); //Array of Elements&#xA;    if ($action == 'Delete') {&#xA;        foreach ($elements as $element) {&#xA;            craft()-&amp;gt;lhngroups_organizations-&amp;gt;deleteOrgCustomerAddress($element);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's important to remember that since we could theoretically be working with many types of Elements (Entries, Assets, Categories, Users, etc.), rather than &lt;em&gt;just&lt;/em&gt; Entries, we may need to validate that we're working on the right &lt;em&gt;types&lt;/em&gt; of Elements before we operate on them. Since I have multiple event handlers calling my &lt;code&gt;deleteOrgCustomerAddress()&lt;/code&gt; service, I did this validation check there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function deleteOrgCustomerAddress($element)&#xA;{&#xA;&#xA;    // Make sure we're working with an entry in the organizations section&#xA;    if ($element-&amp;gt;elementType !== 'Entry' &amp;amp;&amp;amp; $element-&amp;gt;section-&amp;gt;handle !== 'organizations') {&#xA;        return;&#xA;    }&#xA;&#xA;    // We are good to go! Do stuff with the Entry...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to @lindsey-d for some help along the way!&lt;/p&gt;&#xA;" OwnerUserId="335" LastEditorUserId="335" LastEditDate="2016-09-17T23:14:45.253" LastActivityDate="2016-09-17T23:14:45.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16833" PostTypeId="1" CreationDate="2016-09-17T15:25:01.003" Score="2" ViewCount="64" Body="&lt;p&gt;I would like to retrieve a list of all commerce customer addresses except for one. When working with entries, this can be done with the &lt;code&gt;{id: 'not ' ~ some.id }&lt;/code&gt; parameter. This doesn't seem to work with &lt;code&gt;craft.commerce.customer.addresses&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently achieving what I need with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set customerAddresses = craft.commerce.customer.addresses %}&#xA;{% for address in customerAddresses %}&#xA;    {% if address.id != craft.lhngroups.orgCommerceAddressId %}&#xA;        output the address&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but it throws off some &lt;code&gt;{{ loop.index }}&lt;/code&gt; operations I'm trying to perform since the actual array of addresses contains 1 more address than what I'm displaying.&lt;/p&gt;&#xA;" OwnerUserId="335" LastActivityDate="2018-02-05T20:04:26.027" Title="Can I exclude a commerce address by ID when retrieving a list of addresses?" Tags="&lt;plugin-craftcommerce&gt;&lt;array&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16834" PostTypeId="2" ParentId="16833" CreationDate="2016-09-17T15:28:31.123" Score="3" Body="&lt;p&gt;I still haven't found a succinct way to exclude a particular address by ID within the commerce customer addresses tags, but I did come up with the following as a way to get a nice clean set of addresses I want to iterate over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than use a conditional in my loop, I decided to create the collection first, with the address I want to exclude being kept out of the collection. This gets the job done!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set customerAddresses = [] %}&#xA;&#xA;{% for address in craft.commerce.customer.addresses %}&#xA;    {% if address.id != craft.lhngroups.orgCommerceAddressId %}&#xA;        {% set customerAddresses = customerAddresses|merge([address]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="335" LastActivityDate="2016-09-17T15:28:31.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16835" PostTypeId="1" CreationDate="2016-09-17T15:45:22.817" Score="3" ViewCount="557" Body="&lt;p&gt;I am attempting to update my craft instance from Craft CMS 2.6.2781 to the latest. (Critical Update).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike before where there was a button that would do everything for me nicely and automatically, this update just downloads a zip file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to auto update this fix? If not are there instructions on what to do for this update? The readme.txt has pretty generic instructions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="774" LastActivityDate="2016-09-17T16:20:52.330" Title="Where is Auto Update?" Tags="&lt;auto-updates&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16837" PostTypeId="1" CreationDate="2016-09-17T16:18:49.197" Score="2" ViewCount="267" Body="&lt;p&gt;After uploading the app-new folder to my server, renaming it and logging in to the admin area. The website responds with a 'System not available message' (in Dutch) for both front and admin end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wCRbf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wCRbf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resetting the app-old as the default app folder again does not solve the error message. I've cleared the &lt;code&gt;storage/runtime/cache&lt;/code&gt; and &lt;code&gt;storage/runtime/compiled_templates&lt;/code&gt; folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What actions are needed to restore the site to working order first, before going into the update again?&lt;/p&gt;&#xA;" OwnerUserId="5030" LastEditorUserId="4466" LastEditDate="2016-09-19T09:37:32.847" LastActivityDate="2016-09-19T09:37:32.847" Title="Manual update to 2.6.2931" Tags="&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16838" PostTypeId="2" ParentId="16835" CreationDate="2016-09-17T16:20:52.330" Score="7" Body="&lt;p&gt;When the folks at Craft cut a release they can tag an update in one of several ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/updating#one-click-updating&quot;&gt;One-click Update&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot;&gt;Manual Update&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;They can also tag their updates with a level of importance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Normal Update&lt;/li&gt;&#xA;&lt;li&gt;Critical Update&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This helps Craft manage several scenarios that might occur that they need to account for during a release. When you see the &quot;Manual Download&quot; button it probably means that something changed in the code that could fail if an auto-update were performed or that they need to make sure everybody updates to that particular release before updating to any releases beyond that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I believe the two things you have identified are from different releases. The Critical Update flag relates to release &lt;a href=&quot;https://craftcms.com/changelog#build2791&quot;&gt;2.6.2791&lt;/a&gt; and makes the update badge in the Craft CP red, to indicate its importance. And the Manual Update flag relates to release &lt;a href=&quot;https://craftcms.com/changelog#build2922&quot;&gt;2.6.2922&lt;/a&gt; where one of the bugs fixed related to the updater functionality itself, and they needed to trigger a manual download to make sure the files got updated properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer discussion of Critical Updates is available in this Straight Up Hangout: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/events/critical-updates-and-craft-cms&quot;&gt;Critical Updates and Craft CMS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-17T16:20:52.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16839" PostTypeId="2" ParentId="16837" CreationDate="2016-09-17T16:34:34.083" Score="1" Body="&lt;p&gt;Did you backup the database before trying to install the new version? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new update might have messed something up with the DB so the previous version isn't working with the old version of &lt;code&gt;/app&lt;/code&gt;. So you might want to try re-add the old DB and previous version of &lt;code&gt;/app&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3652" LastActivityDate="2016-09-17T16:34:34.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16840" PostTypeId="2" ParentId="16764" CreationDate="2016-09-17T16:43:43.577" Score="1" Body="&lt;p&gt;Updated the files, still didn't work, clicked uninstall, then installed again and its back, not sure what happened.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2016-09-17T16:43:43.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16841" PostTypeId="2" ParentId="16837" CreationDate="2016-09-17T17:19:08.120" Score="3" Body="&lt;p&gt;Replace the &lt;code&gt;/app&lt;/code&gt; folder, per the &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow&quot;&gt;Manual Update&lt;/a&gt; instructions. It sounds like you may have already done this, but rolled it back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the new &lt;code&gt;/app&lt;/code&gt; folder is in place, &lt;strong&gt;you must visit the admin section&lt;/strong&gt;. This will run any necessary migrations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-17T17:19:08.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16842" PostTypeId="2" ParentId="2888" CreationDate="2016-09-18T06:05:44.990" Score="4" Body="&lt;p&gt;Not sure when this was added, but this is now available in Craft core. The select modal has a button to create a new entry of that type.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-09-18T06:05:44.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16843" PostTypeId="2" ParentId="16837" CreationDate="2016-09-18T13:01:07.547" Score="1" Body="&lt;p&gt;Thank you all for your thoughts, pushed me into th right direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was a mismatch between the db version and the app/ folder version. &#xA;I took the latest SQL backup and downloaded the corresponding Craft CDN repository installation. Imported the SQL backup into the database, and uploaded the corresponding app/ folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After checking all functionallity updated to the latest build. All is working as expected again !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-R&lt;/p&gt;&#xA;" OwnerUserId="5030" LastActivityDate="2016-09-18T13:01:07.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16844" PostTypeId="1" CreationDate="2016-09-18T13:29:57.550" Score="0" ViewCount="21" Body="&lt;p&gt;I have a strange problem with the following public method on a model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAttributes()&#xA;{&#xA;    return $this-&amp;gt;getId() . $this-&amp;gt;getStyle() . $this-&amp;gt;getDataAttributes();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CMapIterator&lt;/code&gt; warns with the following &lt;code&gt;array_keys() expects parameter 1 to be array, string given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I alter it to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAttributes()&#xA;{&#xA;    return array($this-&amp;gt;getId() . $this-&amp;gt;getStyle() . $this-&amp;gt;getDataAttributes())[0];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everybody is happy. It's late and I'm probably shouldn't be coding but any thoughts on the issue would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete model for reference...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class Core_CodeModel extends BaseModel&#xA;{&#xA;    /**&#xA;     * @return array&#xA;     */&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array_merge(parent::defineAttributes(), array(&#xA;            'cssId' =&amp;gt; array(AttributeType::String),&#xA;            'cssClass' =&amp;gt; array(AttributeType::String),&#xA;            'style' =&amp;gt; array(AttributeType::String),&#xA;            'dataAttributes' =&amp;gt; array(AttributeType::Mixed),&#xA;        ));&#xA;    }&#xA;&#xA;    public function getDataAttributes()&#xA;    {&#xA;        return is_array($this-&amp;gt;dataAttributes) ? ' ' . craft()-&amp;gt;core_code-&amp;gt;joinDataAttributes($this-&amp;gt;dataAttributes) : '';&#xA;    }&#xA;&#xA;    public function getId()&#xA;    {&#xA;        return !empty($this-&amp;gt;cssId) ? ' id=&quot;' . $this-&amp;gt;cssId . '&quot;' : '';&#xA;    }&#xA;&#xA;    public function getStyle()&#xA;    {&#xA;        return !empty($this-&amp;gt;style) ? ' style=&quot;' . str_replace(array(&quot;\r&quot;, &quot;\n&quot;), '', $this-&amp;gt;style) . '&quot;' : '';&#xA;    }&#xA;&#xA;    public function getAttributes()&#xA;    {&#xA;        return $this-&amp;gt;getId() . $this-&amp;gt;getStyle() . $this-&amp;gt;getDataAttributes();&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2016-09-18T23:11:50.230" Title="Model public method throws CMapIterator warning" Tags="&lt;models&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16845" PostTypeId="1" CreationDate="2016-09-18T15:13:40.947" Score="0" ViewCount="155" Body="&lt;p&gt;I am trying to embed a Google Map widget as a field in Craft. I am doing plugin development to achieve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding a foundation 5 css in a &lt;code&gt;PluginName_FieldType.php&lt;/code&gt; file into the &lt;code&gt;getInputHtml()&lt;/code&gt; function results in changes is Craft Control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;includeCssResource('pluginhandle/foundation.css');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologise if it is something silly. I am a newbie to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S9QzW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S9QzW.png&quot; alt=&quot;Craft_Foundation5_messup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5634" LastActivityDate="2016-09-18T17:04:33.543" Title="Plugin development - Adding Foundation 5 CSS changes Craft CMS control panel" Tags="&lt;css&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16847" PostTypeId="2" ParentId="16845" CreationDate="2016-09-18T17:04:33.543" Score="2" Body="&lt;p&gt;I don't use Foundation 5. I've been using Foundation 6, but I'll offer a suggestion based on Foundation 6 usage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like your Foundation CSS is overriding the base Craft control panel CSS, specifically the button classes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that because you're including &lt;strong&gt;all&lt;/strong&gt; the Foundation classes available. If you're using the SASS version, you can comment out the parts you aren't using to minimize the size of what you're using from the base Foundation code. For example, you can try to exclude the button classes from Foundation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, if you remove the .button styling rules from your foundation.css file, the Craft buttons would go back to normal.&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2016-09-18T17:04:33.543" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16848" PostTypeId="1" AcceptedAnswerId="16849" CreationDate="2016-09-18T17:39:19.030" Score="1" ViewCount="270" Body="&lt;p&gt;Okay, all I want to do is list all categories AND the # of entries associated with each category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numofEntries = craft.entries.section('posts').relatedTo(category).total() %}&#xA;&#xA;&amp;lt;p class=&quot;tags&quot;&amp;gt;&#xA;    {% for categoryName in craft.categories.group('markets') %}&#xA;        &amp;lt;a href=&quot;{{ categoryName.url }}&quot;&amp;gt;{{ categoryName.title }}-{{numofEntries}}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/p&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error is thrown (and I am in dev mode), but the number that appears (49) is the same for all categories (and doesn't even equal the number of total entries).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things...  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;market group = markets ...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the category field handler = marketName &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2016-09-18T21:45:34.107" LastActivityDate="2016-09-18T21:55:30.313" Title="How do I print the number of entries assigned to a category?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16849" PostTypeId="2" ParentId="16848" CreationDate="2016-09-18T21:55:21.197" Score="2" Body="&lt;p&gt;You'll want to query for the number of entries &lt;em&gt;inside&lt;/em&gt; the for loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for categoryName in craft.categories.group('markets') %}&#xA;    {% set numofEntries = craft.entries.section('posts').relatedTo(categoryName).total() %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ categoryName.url }}&quot;&amp;gt;{{ categoryName.title }}-{{numofEntries}}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt; &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-18T21:55:21.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16850" PostTypeId="2" ParentId="16848" CreationDate="2016-09-18T21:55:30.313" Score="2" Body="&lt;p&gt;If you want to display the total number of entries related to &lt;em&gt;each&lt;/em&gt; category, you'll need to put the &lt;code&gt;{% set numofEntries ... %}&lt;/code&gt; statement inside your &lt;code&gt;for&lt;/code&gt; loop. You'll also need to change the &lt;code&gt;relatedTo(category)&lt;/code&gt; part to &lt;code&gt;relatedTo(categoryName)&lt;/code&gt; (or change the &lt;code&gt;categoryName&lt;/code&gt; to &lt;code&gt;category&lt;/code&gt;, which would probably be more appropriate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numofEntries = craft.entries.section('posts').relatedTo(category).total() %}&#xA;&#xA;&amp;lt;p class=&quot;tags&quot;&amp;gt;&#xA;    {% set categories = craft.categories.group('markets') %}&#xA;    {% for category in categories %}&#xA;        {% set numofEntries = craft.entries.section('posts').limit(null).relatedTo({&#xA;            targetElement: category,&#xA;            field: marketName&#xA;        }).total() %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}-{{numofEntries}}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/p&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You don't actually need to feed the &lt;code&gt;targetElement&lt;/code&gt; and &lt;code&gt;field&lt;/code&gt; attributes to the &lt;code&gt;relatedTo()&lt;/code&gt; parameter – simply &lt;code&gt;relatedTo(category)&lt;/code&gt; will usually work just fine – but it's supposedly more performant to be as specific as possible about the relation you're looking for – in this case; any entries that have the &lt;code&gt;category&lt;/code&gt; selected (i.e. the &lt;code&gt;targetElement&lt;/code&gt;) in the Categories field &lt;code&gt;marketName&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-18T21:55:30.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16851" PostTypeId="2" ParentId="16844" CreationDate="2016-09-18T21:58:32.937" Score="1" Body="&lt;p&gt;Difficult to know for sure without seeing what's going on in &lt;code&gt;craft()-&amp;gt;core_code-&amp;gt;joinDataAttributes&lt;/code&gt; and what type of data is in &lt;code&gt;$this-&amp;gt;dataAttributes&lt;/code&gt;, but my guess is its because you're effectively casting whatever the results of &lt;code&gt;craft()-&amp;gt;core_code-&amp;gt;joinDataAttributes&lt;/code&gt; to a string by prepending an space to it here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;' '.craft()-&amp;gt;core_code-&amp;gt;joinDataAttributes($this-&amp;gt;dataAttributes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And whatever code is working with that data isn't expecting a string, but an array.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-18T21:58:32.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16852" PostTypeId="2" ParentId="16844" CreationDate="2016-09-18T22:00:58.823" Score="2" Body="&lt;p&gt;User error. It's a naming collision with the &lt;code&gt;getAttributes&lt;/code&gt; method within my model and the &lt;code&gt;CModel&lt;/code&gt; class.&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-09-18T23:11:50.230" LastActivityDate="2016-09-18T23:11:50.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16853" PostTypeId="1" AcceptedAnswerId="16854" CreationDate="2016-09-19T07:27:28.263" Score="1" ViewCount="109" Body="&lt;p&gt;I have a situation where I'd like to watch for a change in an Element Select field and determine if any Elements have been selected or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Element Select fields have two &lt;code&gt;input&lt;/code&gt; elements. One, is always present and never changes, and the other gets added and removed from the page depending on if any items have been selected. Here's a simplified version of the HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;field&quot; id=&quot;fields-fieldhandle-field&quot;&amp;gt;&#xA;&#xA;    {# This input field is always present and never changes #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assets]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;elements&quot;&amp;gt;&#xA;&#xA;        {# When you add or remove elements, this .element div and input &#xA;           get added and removed from the DOM #}&#xA;        &amp;lt;div class=&quot;element&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assets][]&quot; value=&quot;430&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;    &#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried various listeners but so far they all get destroyed when the second input gets removed from the page, or never get added to the right input field if it is not on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I listen for an element that may or may not exist on the page?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-19T09:33:38.297" Title="How to watch for changes on an Element Select Relations field?" Tags="&lt;plugin-development&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16854" PostTypeId="2" ParentId="16853" CreationDate="2016-09-19T09:16:00.383" Score="2" Body="&lt;p&gt;I think there's a few ways to skin this cat, but &lt;a href=&quot;https://craftcms.stackexchange.com/a/11656/1098&quot;&gt;the most robust way&lt;/a&gt; would probably be to listen to the the &lt;code&gt;selectElements&lt;/code&gt; event for the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L3660&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;BaseElementSelectInput&lt;/code&gt;&lt;/a&gt; instances bound to each field's container element (the instance will be bound to the &lt;code&gt;&amp;lt;div class=&quot;elementselect&quot;&amp;gt;&lt;/code&gt; node, except for Categories fields where it'll be bound to the &lt;code&gt;&amp;lt;div class=&quot;categoriesfield&quot;&amp;gt;&lt;/code&gt; node, for some reason) and can be accessed by calling &lt;code&gt;$('.elementselect').data('elementSelect')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the &lt;code&gt;.on()&lt;/code&gt; method to listen to the actual events, here's one way to do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.elementselect, .categoriesfield').each(function () {&#xA;    $(this).data('elementSelect').on('selectElements', onSelectElements);&#xA;});&#xA;&#xA;function onSelectElements(e) {&#xA;    var $field = $(e.target);&#xA;    var selectedElements = e.elements;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;HUGE CAVEAT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on &lt;em&gt;when&lt;/em&gt; your plugin's JavaScript runs, the &lt;code&gt;elementSelect&lt;/code&gt; data attribute for the element select input DOM nodes may return &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because Craft actually initialises the BaseElementSelectInput instances in some inline JavaScript injected into the source, and this JavaScript is, unfortunately, written to the page &lt;em&gt;after&lt;/em&gt; your plugin's JavaScript resources are queued up (after any inline JavaScript your plugin adds, too).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if you need to hook into the BaseElementSelctInput instances on pageload, you'll need to &lt;em&gt;poll&lt;/em&gt; for the &lt;code&gt;data('elementSelect)&lt;/code&gt; attribute (ew, I know):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.elementselect, '.categoriesfield').each(function () {&#xA;    var now = new Date().getTime();&#xA;    var getElementSelect = (function () {&#xA;        var elementSelect = $(this).data('elementSelect');&#xA;        if (elementSelect) {&#xA;            // Woo, I can haz elementSelect&#xA;            elementSelect.on('selectElements', onSelectElements);&#xA;        } else if (new Date().getTime() - now &amp;lt; 5000) {&#xA;            // Poll for 5 secs (then give up)&#xA;            Garnish.requestAnimationFrame(getElementSelect);&#xA;        }&#xA;    }).bind(this)&#xA;    getElementSelect();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hack alert: If you don't want to poll for the elementSelect instances, there is another way. Credit due, I learnt this trick from looking at &lt;a href=&quot;https://github.com/benjamminf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Benjamin Fleming's&lt;/a&gt; source code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var elementSelectInit = Craft.BaseElementSelectInput.prototype.init;&#xA;Craft.BaseElementSelectInput.prototype.init = function () {&#xA;    elementSelectInit.apply(this, arguments);&#xA;    this.on('selectElements', onSelectElements);&#xA;    this.on('removeElements', onRemoveElements);&#xA;}&#xA;&#xA;function onSelectElements (e) {&#xA;    console.log(e);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does, is to basically hijack the BaseElementSelectInput class' &lt;code&gt;init&lt;/code&gt; method, in order to add some custom event listeners &lt;em&gt;when each BaseElementSelectInput instance is initialised&lt;/em&gt;. Works like a charm and – even if it's a huge hack – is quite a bit cleaner than the polling method, in my opinion.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-19T09:33:38.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16857" PostTypeId="1" CreationDate="2016-09-19T13:03:05.840" Score="1" ViewCount="154" Body="&lt;p&gt;I am using the Pixel &amp;amp; Tonic Contact Form plugin.  I set it up using the Mijingo tutorial.  Everything appears to be working ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hit submit, redirects to thank you, no message received.  Setup looks good.  Hidden input fields appear good.  Error messages working when required inputs (&lt;code&gt;fromEmail&lt;/code&gt; and &lt;code&gt;message&lt;/code&gt;) left blank.  Redirects to thank you.  Honeypot setup looks good.   But, &lt;strong&gt;no message received.  And I don't know how to confirm it is really being sent.  What might I try? Thanks&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am in dev mode&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-08-30T09:52:22.533" Title="Contact Form plugin email is not being received, not clear if it is being sent" Tags="&lt;templating&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16858" PostTypeId="2" ParentId="16857" CreationDate="2016-09-19T13:22:23.897" Score="1" Body="&lt;p&gt;Are you testing in a local environment? If you don't have a mail server configured then PHP won't be able to send the email.&lt;/p&gt;&#xA;" OwnerUserId="5481" LastActivityDate="2016-09-19T13:22:23.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16859" PostTypeId="1" AcceptedAnswerId="16882" CreationDate="2016-09-19T13:23:44.993" Score="1" ViewCount="368" Body="&lt;p&gt;How do you save Widget Settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read this tutorial &lt;a href=&quot;https://craftcms.com/docs/plugins/widgets&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/widgets&lt;/a&gt; several times but I could not find an answer. I'm new to Craft and this is my first plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to save plugin settings I create a Twig template like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sRGoogleAnalytics/settings/saveSettings&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;srgoogleanalytics/settings&quot;&amp;gt;&#xA;        &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Submit'|t }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and know my function &lt;code&gt;public function actionSaveSettings()&lt;/code&gt; in my &lt;code&gt;SRGoogleAnalytics_SettingsController&lt;/code&gt; is going to be executed but I don't know how to do the same for widget settings since the widget itself already has a &quot;submit&quot; button and when I create a form in the template there will be two submits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please explain what I have to do exactly in order to get a callback into a specific function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2016-09-19T23:05:02.877" LastActivityDate="2016-09-20T06:34:03.547" Title="How to save widget settings" Tags="&lt;plugin-development&gt;&lt;settings&gt;&lt;dashboard-widgets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16860" PostTypeId="1" CreationDate="2016-09-19T13:34:24.267" Score="1" ViewCount="77" Body="&lt;p&gt;Can this be done? I have a section called Bookings. I have 2 user groups A and B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like both groups to have access to the section (bookings) but for some of the entries in the section, I would like to exclude one of the groups. Giving access to only A or B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks.&lt;/p&gt;&#xA;" OwnerUserId="2185" LastActivityDate="2016-09-19T13:40:44.540" Title="Group specific entry from section" Tags="&lt;permissions&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16861" PostTypeId="2" ParentId="16860" CreationDate="2016-09-19T13:40:44.540" Score="1" Body="&lt;p&gt;Craft doesn't have an entry-level (or even entry type-level) permissions system; it's only possible to define permissions for sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, &quot;anything&quot; is possible with a custom &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;, but without knowing more about your use case (what's the criteria for excluding group A or B for a particular entry?) it's difficult to advise further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can edit your question and elaborate on the use case/goal, I might be able to update this answer.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-19T13:40:44.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16863" PostTypeId="1" CreationDate="2016-09-19T14:58:16.807" Score="1" ViewCount="165" Body="&lt;p&gt;I'm trying to set the value of a custom field on an order when saving an entry. I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15165/how-can-i-update-a-custom-order-field-in-a-plugin-controller&quot;&gt;an example of how to do this&lt;/a&gt; for a simple text field, but the field I'm trying to set is an &lt;strong&gt;entries&lt;/strong&gt; field, not just a text field. I've attempted to set the value using the following code in my entries.saveEntry event. I'm assuming I'm doing this wrong since this is an entries field, not a simple text field, but I don't know the syntax for setting content on an entries field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;$cart-&amp;gt;setContentFromPost(['entriesFieldHandle' =&amp;gt; $entry-&amp;gt;id]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="335" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-09-20T01:44:37.047" Title="How do I set the value of a custom entries order field from a plugin?" Tags="&lt;plugin-craftcommerce&gt;&lt;entries-field&gt;&lt;custom-field&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16864" PostTypeId="2" ParentId="16863" CreationDate="2016-09-19T14:58:16.807" Score="4" Body="&lt;p&gt;I was close. I was correct in assuming my syntax was incorrect for setting the value of an entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since an entries field is an array of elements, not just a single element, I just needed to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16593/how-can-i-programmatically-set-the-value-of-an-entries-field-type&quot;&gt;set the value of the field as an array&lt;/a&gt; instead of a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart-&amp;gt;setContentFromPost(['entriesFieldHandle' =&amp;gt; $entry-&amp;gt;id]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart-&amp;gt;setContentFromPost(['entriesFieldHandle' =&amp;gt; [$entry-&amp;gt;id]]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;seemed to do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To zoom in a little more, the value needs to be set with &lt;code&gt;'entriesFieldHandle' =&amp;gt; [$entry-&amp;gt;id]&lt;/code&gt; instead of &lt;code&gt;'entriesFieldHandle' =&amp;gt; $entry-&amp;gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="335" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-19T14:58:16.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16865" PostTypeId="2" ParentId="9400" CreationDate="2016-09-19T15:05:09.440" Score="1" Body="&lt;p&gt;I would recommend you to go with a managed host provider like Cloudways for &lt;a href=&quot;https://www.cloudways.com/blog/install-craft-cms-on-cloud/&quot; rel=&quot;nofollow&quot;&gt;Craft hosting&lt;/a&gt;. Some of its good features are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ThunderStack consists of Nginx, Varnish, Apache, PHP-FPM&lt;/li&gt;&#xA;&lt;li&gt;Vertical Scaling&lt;/li&gt;&#xA;&lt;li&gt;Cloud providers i.e AWS, GCE, DO, Vultr and Kyup &lt;/li&gt;&#xA;&lt;li&gt;1-Click installations &lt;/li&gt;&#xA;&lt;li&gt;Caches (MemCache, MemCached, Redis)&lt;/li&gt;&#xA;&lt;li&gt;CloudwaysBot&lt;/li&gt;&#xA;&lt;li&gt;24/7 Support&lt;/li&gt;&#xA;&lt;li&gt;User Friendly UI experience&lt;/li&gt;&#xA;&lt;li&gt;Provides their custom Cpanel from which you can manage your server in 1-click&lt;/li&gt;&#xA;&lt;li&gt;Latest PHP versions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2016-09-20T08:48:34.067" LastActivityDate="2016-09-20T08:48:34.067" CommentCount="2" CommunityOwnedDate="2016-09-19T15:05:09.440" ContentLicense="CC BY-SA 3.0" />
  <row Id="16866" PostTypeId="1" CreationDate="2016-09-19T16:40:00.963" Score="1" ViewCount="96" Body="&lt;p&gt;I've written a stock import routine that takes data from a CSV, the column I need to match on is a custom field &lt;code&gt;supplierSku&lt;/code&gt;. I can't find an easy way to search variants for this specifically so am using SQL at the moment, which may be faster but not very elegant. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($stock as $item) {            &#xA;    craft()-&amp;gt;db-&amp;gt;createCommand('UPDATE craft_commerce_variants v JOIN craft_content c ON c.elementId=v.id SET stock=:stock WHERE c.field_supplierSku=:sku')&#xA;        -&amp;gt;bindParam(&quot;:stock&quot;,$item[1])&#xA;        -&amp;gt;bindParam(&quot;:sku&quot;,$item[0])&#xA;        -&amp;gt;query();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="536" LastEditorUserId="4466" LastEditDate="2016-09-22T09:00:10.823" LastActivityDate="2016-09-22T09:00:10.823" Title="Update a variant by searching for a custom field value" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16867" PostTypeId="2" ParentId="16857" CreationDate="2016-09-19T16:58:56.730" Score="3" Body="&lt;p&gt;There's a good article here for troubleshooting email errors and well as email deliverability issues: &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL/DR: Don't use PHP's mail/sendmail methods in production and even in development, you aren't guaranteed email deliverability with those.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-19T16:58:56.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16868" PostTypeId="1" AcceptedAnswerId="16870" CreationDate="2016-09-19T17:42:59.920" Score="3" ViewCount="48" Body="&lt;p&gt;We currently use cache tags with a condition referencing the &lt;code&gt;cache&lt;/code&gt; config setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache for 1 hour if craft.config.cache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the condition necessary to stop HTML being inserted into the database cache? &lt;/p&gt;&#xA;" OwnerUserId="975" LastEditorUserId="975" LastEditDate="2016-09-20T10:08:52.100" LastActivityDate="2016-09-20T10:08:52.100" Title="Is cache condition necessary to stop HTML being inserted into database cache?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16870" PostTypeId="2" ParentId="16868" CreationDate="2016-09-19T18:01:46.063" Score="3" Body="&lt;p&gt;No, there is a better way to do this. Set the &lt;code&gt;enableTemplateCaching&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/config-settings#enableTemplateCaching&quot; rel=&quot;nofollow&quot;&gt;config value&lt;/a&gt; to false.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'enableTemplateCaching' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that setting disabled, all caching will be skipped.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Won't be cached&#xA;{% cache for 1 hour %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-19T18:01:46.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16872" PostTypeId="1" AcceptedAnswerId="16875" CreationDate="2016-09-19T20:30:28.833" Score="0" ViewCount="393" Body="&lt;p&gt;I have made a new &quot;section&quot; called Blog. In the dashboard I now have a quick post panel but I can only input a title and nothing else? How can I add the ability to have a body etc?&lt;/p&gt;&#xA;" OwnerUserId="5650" LastActivityDate="2016-09-19T21:10:21.833" Title="I can't add a body field?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16873" PostTypeId="1" CreationDate="2016-09-19T20:48:01.737" Score="1" ViewCount="540" Body="&lt;p&gt;so I'm using an asset field for an OG Image. I need to get the full url for this and I've yet to find a clean way to do this. I figured I could just combine siteUrl and the asset url but I have a weird issue with a double slash. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;{{siteUrl}}{{entry.ogImage.first().url}}/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does what I expect except it adds a slash at the end of {{siteUrl}} and the beginning of the asset so my url is bad, leaving me with a double slash. Short of some programatical removal of the slash, is there another way to do this? Why does my siteUrl have that trailing slash? is something wrong there? &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-09-19T21:10:58.487" Title="Get full file url, avoiding the siteUrl trailing slash" Tags="&lt;config&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16875" PostTypeId="2" ParentId="16872" CreationDate="2016-09-19T21:10:21.833" Score="5" Body="&lt;p&gt;You've probably gone through the process of creating a new &lt;em&gt;Section&lt;/em&gt;, but have not assigned any fields to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, the differences between each of your &lt;em&gt;Sections&lt;/em&gt; and &lt;em&gt;Entry Types&lt;/em&gt; comes in the various fields you assign to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you take a look at the intro to &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;noreferrer&quot;&gt;Sections and Entries&lt;/a&gt;, then at &lt;a href=&quot;https://craftcms.com/docs/fields&quot; rel=&quot;noreferrer&quot;&gt;Fields&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The typical content structure definition process looks something like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a &lt;em&gt;Section&lt;/em&gt; and at least one &lt;em&gt;Entry Type&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;em&gt;Field Group&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;em&gt;Fields&lt;/em&gt; to the &lt;em&gt;Field Group&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add the Field Group or individual &lt;em&gt;Fields&lt;/em&gt; to your &lt;em&gt;Entry Type(s)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add or Edit your content by creating or modifying an &lt;em&gt;Entry&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In your case, you've probably done step 1 and step 5. Try adding some fields (like &quot;Body&quot; or &quot;Tags&quot;) and assigning them to your Entry Type.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2016-09-19T21:10:21.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16876" PostTypeId="2" ParentId="16873" CreationDate="2016-09-19T21:10:58.487" Score="2" Body="&lt;p&gt;Instead of &lt;code&gt;{{siteUrl}}{{entry.ogImage.first().url}}&lt;/code&gt;, try &lt;code&gt;{{entry.ogImage.first().getUrl()}}&lt;/code&gt;. &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel#getUrl-detail&quot; rel=&quot;nofollow&quot;&gt;getUrl()&lt;/a&gt; should return the full image path, including host.&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-09-19T21:10:58.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16877" PostTypeId="1" AcceptedAnswerId="16881" CreationDate="2016-09-19T21:36:16.927" Score="2" ViewCount="198" Body="&lt;p&gt;There is an issue with using &lt;code&gt;unique =&amp;gt; true&lt;/code&gt; in defining an attribute as a primary key when using MYSQL 5.7.*. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineAttributes()&#xA;{&#xA;    return array(&#xA;        'eid' =&amp;gt; array(AttributeType::Number, 'unique' =&amp;gt; true, 'column' =&amp;gt; ColumnType::PK) &#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to my setting this error should not occur. Here is the error. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the SQL executed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;system.db.CDbCommand.execute(CREATE TABLE `craft_venti_events` (&#xA;    `eid` int(11) NOT NULL AUTO_INCREMENT NULL,&#xA;    `eventid` INT(10) NULL,&#xA;    `startDate` datetime NULL,&#xA;    `endDate` datetime NULL,&#xA;    `allDay` INT(10) NULL,&#xA;    `repeat` INT(10) NULL,&#xA;    `rRule` VARCHAR(255) NULL,&#xA;    `summary` VARCHAR(255) NULL,&#xA;    `isrepeat` INT(10) NULL,&#xA;    `locale` VARCHAR(255) NULL,&#xA;    `dateCreated` datetime NOT NULL,&#xA;    `dateUpdated` datetime NOT NULL,&#xA;    `uid` CHAR(36) NOT NULL DEFAULT 0,&#xA;    PRIMARY KEY (eid)&#xA;) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="57" LastEditDate="2016-09-19T23:02:55.093" LastActivityDate="2016-09-20T04:37:10.060" Title="How would I write this differently to make it compatible with MYSQL 5.7" Tags="&lt;plugin-development&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16878" PostTypeId="2" ParentId="16812" CreationDate="2016-09-19T22:27:48.140" Score="4" Body="&lt;p&gt;In this case, the Apache &lt;code&gt;mod_rewrite&lt;/code&gt; module wasn't installed, so the &lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&lt;/code&gt; block of Craft's default &lt;code&gt;.htaccess&lt;/code&gt; file was being skipped not allowing &lt;code&gt;index.php&lt;/code&gt; to be rewritten in the URL.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-19T22:27:48.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16879" PostTypeId="1" AcceptedAnswerId="16999" CreationDate="2016-09-19T23:09:39.723" Score="2" ViewCount="258" Body="&lt;p&gt;I am building a site which uses one content type as its primary holder for content. This is to make content editing easier on the content editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All URL's are primarily accessing this one content type, 'events'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within 'events' I have a matrix field 'authors'. Authors contains 1 block (also 'authors') with 4 fields, Name, Image, Bio and URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to output the matrix blocks fine, but I am not familiar with a way to call all event entries without running them through a for loop first. Doing so causes my row/col layout to break but without batching them into groups of 4, my column layout also breaks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attempted all solutions shown on stackexchange but none of them are suited for this scenario (calling all entries from a section) and my attempts at rewriting it to fit my solution has failed. Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in events %} {# loop through all events #}&#xA;    {% if event.startDate|date('Y') == now|date('Y') %} {#check to see if the event's start date is happening this year #}&#xA;        {% for row in event.authors|batch(4) %} {# use batch to create rows #}&#xA;            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                {% for block in row %}&#xA;                    {% switch block.type %}&#xA;                        {% case &quot;author&quot; %}&#xA;                            &amp;lt;div class=&quot;col-md-3 author&quot;&amp;gt; &#xA;                                {% set image = block.image.first() %}&#xA;                                    {% if image|length %}&#xA;                                        &amp;lt;img src=&quot;{{ image.getUrl('authorThumb') }}&quot;&amp;gt;&#xA;                                     {% endif %}&#xA;                                &amp;lt;p class=&quot;name&quot;&amp;gt;{{ block.authorName }}&amp;lt;/p&amp;gt;&#xA;                                {% if block.twitterHandle|length %}&#xA;                                &amp;lt;p class=&quot;subtitle&quot;&amp;gt;&amp;lt;a href=&quot;http://twitter.com/{{ block.twitterHandle }}&quot; target=&quot;_blank&quot;&amp;gt;@{{ block.twitterHandle }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                                {% endif %}&#xA;                                 &amp;lt;small&amp;gt;{{ event.startDate|date('m/d/y') }} @ {{ event.startDate|date('g:ia') }} &amp;lt;/small&amp;gt;&#xA;                                 &amp;lt;hr&amp;gt;&#xA;                                 &amp;lt;p class=&quot;bio&quot;&amp;gt;{{ block.bio }}&amp;lt;/p&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                    {% endswitch %}&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is as close as I've gotten, but unfortunately this just creates rows for each entry as opposed to every 4 blocks.&lt;/p&gt;&#xA;" OwnerUserId="5307" LastActivityDate="2016-09-27T07:19:18.263" Title="How do I group matrix blocks into batches of 4?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16880" PostTypeId="2" ParentId="16792" CreationDate="2016-09-19T23:52:19.317" Score="1" Body="&lt;p&gt;Here's some things to consider with SEO and URLs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&lt;li&gt;Readability of the url&lt;/li&gt;&#xA;&lt;li&gt;Including keywords in the url&lt;/li&gt;&#xA;&lt;li&gt;Shorter &gt; longer&lt;/li&gt;&#xA;&lt;li&gt;Fewer /folders/ in the url&lt;/li&gt;&#xA;&lt;li&gt;Generally don't want any caps in the URL&lt;/li&gt;&#xA;&lt;li&gt;Separate words with hyphens or underscores&lt;/li&gt;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, &quot;/particular-product-title&quot; would be preferable to &quot;/productCategory/particular-product&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that's helpful!&lt;/p&gt;&#xA;" OwnerUserId="5651" LastActivityDate="2016-09-19T23:52:19.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16881" PostTypeId="2" ParentId="16877" CreationDate="2016-09-20T04:37:10.060" Score="3" Body="&lt;p&gt;Turns out this is a bug as of &lt;a href=&quot;https://craftcms.com/changelog#build2931&quot; rel=&quot;nofollow&quot;&gt;Craft 2.6.2931&lt;/a&gt; with the &lt;code&gt;ColumnType::PK&lt;/code&gt; enum &#xA;in a record's attribute type definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty sure it'd be a bug in &amp;lt; MySQL 5.7 because it's invalid SQL syntax as well unless they're just more forgiving of it there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a non-issue in the upcoming Craft 3 release (the concept of attributes no longer exists and plugins explicitly define their table schema create statements), but the workaround for Craft 2 until the bug is fixed is to not use a record here and manually create the table schema that you need by adding an &lt;code&gt;onBeforeInstall&lt;/code&gt; method to your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-20T04:37:10.060" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16882" PostTypeId="2" ParentId="16859" CreationDate="2016-09-20T06:34:03.547" Score="1" Body="&lt;p&gt;You're over-thinking it a little bit. To save your widget settings, you don't need a controller class, you only need &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) a method called &lt;code&gt;defineSettings()&lt;/code&gt; in your widget class, returning the settings you need, e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;{&#xA;  return array(&#xA;    'url'   =&amp;gt; array(AttributeType::Url, 'required' =&amp;gt; true, 'label' =&amp;gt; 'URL'),&#xA;    'title' =&amp;gt; array(AttributeType::Name, 'required' =&amp;gt; true),&#xA;    'limit' =&amp;gt; array(AttributeType::Number, 'min' =&amp;gt; 0, 'default' =&amp;gt; 5),&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can take a look at the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/enums/AttributeType.php&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;AttributeType&lt;/code&gt;&lt;/a&gt; class to see which attribute types Craft support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) a template to render your settings – you don't actually need to create the actual &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element or add hidden &lt;code&gt;action&lt;/code&gt; or &lt;code&gt;redirect&lt;/code&gt; inputs in this template; Craft wraps the fields you render inside a form tag. Here's an example settings template corresponding to the settings from the &lt;code&gt;defineSettings()&lt;/code&gt; example method above (this is the whole template):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.textField({&#xA;  label: &quot;URL&quot;|t,&#xA;  id: 'url',&#xA;  name: 'url',&#xA;  value: settings.url,&#xA;  required: true,&#xA;  errors: settings.getErrors('url')&#xA;}) }}&#xA;&#xA;{{ forms.textField({&#xA;  label: &quot;Title&quot;|t,&#xA;  id: 'title',&#xA;  name: 'title',&#xA;  value: settings.title,&#xA;  required: true,&#xA;  errors: settings.getErrors('title')&#xA;}) }}&#xA;&#xA;{{ forms.textField({&#xA;  label: &quot;Limit&quot;|t,&#xA;  id: 'limit',&#xA;  name: 'limit',&#xA;  value: settings.limit,&#xA;  size: 2,&#xA;  errors: settings.getErrors('limit')&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Save the template to &lt;code&gt;/yourplugin/templates/widgethandle_settings.html&lt;/code&gt;. Finally, you need &lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) a method called &lt;code&gt;getSettingsHtml()&lt;/code&gt;, also in your widget class, which simply renders the settings template you added above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('yourplugin/widgettitle_settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With these three things in place, you should be able to click the cogwheel that appears when you mouse over your widget in the Dashboard, which will display your settings form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, this is actually exactly the same way &lt;em&gt;plugin&lt;/em&gt; settings work, although for plugins themselves the &lt;code&gt;defineSettings()&lt;/code&gt; and &lt;code&gt;getSettingsHtml()&lt;/code&gt; method should exist in the primary plugin class. In short – you don't need a controller and you don't need the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag, neither for plugin nor widget settings.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-20T06:34:03.547" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16883" PostTypeId="1" CreationDate="2016-09-20T07:49:49.370" Score="1" ViewCount="87" Body="&lt;p&gt;Is it already built-in in CraftCMS to make multiple editableTable in a CP page? The behaviour would be similar to Matrix field where you add a matrix block, the matrix block appears. What I want is that instead of the matrix block, editableTable appears. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="5652" LastEditorUserId="45" LastEditDate="2016-09-20T16:40:49.337" LastActivityDate="2016-09-20T23:45:14.000" Title="Multiple editableTable in a CP page" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;form&gt;&lt;table&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16884" PostTypeId="1" CreationDate="2016-09-20T10:40:04.003" Score="1" ViewCount="38" Body="&lt;p&gt;I would like to auto create a an aggregated newsletter each month based on Craft content and have &lt;a href=&quot;http://mailchimp.com/&quot; rel=&quot;nofollow&quot;&gt;Mailchimp&lt;/a&gt; deliver it via their API. It doesn't need to be complicated so I was wondering whether a standalone PHP script or custom plugin is the best way to go......or custom API end point and feed content to Mailchimp that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am open to suggestions and previous experiences as what would work effectively.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-09-21T02:58:39.663" LastActivityDate="2016-09-21T02:58:39.663" Title="What is a good approach for building an aggregated newsletter?" Tags="&lt;emails&gt;&lt;cron&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16885" PostTypeId="1" AcceptedAnswerId="16892" CreationDate="2016-09-20T12:00:33.230" Score="0" ViewCount="335" Body="&lt;p&gt;Having a problem where uploading an infinitely looping gif only loops once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tested it with and without image transforms and get the same issue.&#xA;I know there there was an issue previously stated here &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16569/specify-number-of-loops-for-animated-gif-imagemagick&quot;&gt;Specify number of loops for animated GIF (ImageMagick)?&lt;/a&gt; and that was fixed in a recent release. Any thoughts on what the issue could be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2931 (multilingual)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ImageMagick 6.7.7-10 (dev)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ImageMagick 6.7.8-9 (staging)&lt;/p&gt;&#xA;" OwnerUserId="5653" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-20T15:25:29.553" Title="Uploaded .gif only loops once instead of infinitely" Tags="&lt;image-transforms&gt;&lt;image&gt;&lt;upload&gt;&lt;loop&gt;&lt;gif&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-09-21T19:02:21.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="16886" PostTypeId="2" ParentId="16813" CreationDate="2016-09-20T12:53:14.013" Score="0" Body="&lt;p&gt;Answer to my question. I ended up making a form and printing out the post as JSON.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#submitQuiz').on('click', function (e) {&#xA;  e.preventDefault();&#xA;&#xA;  var testEntrySubmission = [&#xA;    {&#xA;      name: 'action',&#xA;      value: 'guestEntries/saveEntry'&#xA;    },&#xA;    {&#xA;      name: 'sectionId',&#xA;      value: '5'&#xA;    },&#xA;    {&#xA;      name: 'enabled',&#xA;      value: '1'&#xA;    },&#xA;    {&#xA;      name: 'redirect',&#xA;      value: '/'&#xA;    },&#xA;    {&#xA;      name: 'title',&#xA;      value: 'user name'&#xA;    },&#xA;    {&#xA;    'name':'fields[answers]',&#xA;    'value':''&#xA;    },&#xA;    {&#xA;      'name':'fields[answers][new1][type]',&#xA;      'value':'6'&#xA;    },&#xA;    {&#xA;      'name':'fields[answers][new1][enabled]',&#xA;      'value':'1'&#xA;    },&#xA;    {&#xA;      'name':'fields[answers][new1][fields][question]',&#xA;      'value':'John Smith'&#xA;    },&#xA;  ];&#xA;&#xA;  $.post('http://mywebsite.dev/', testEntrySubmission, function(response) {&#xA;    if (response.success) {&#xA;      console.log('success')&#xA;    } else {&#xA;      // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;      // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;      alert('An error occurred. Please try again.');&#xA;    }&#xA;  });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5636" LastActivityDate="2016-09-20T12:53:14.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16888" PostTypeId="1" AcceptedAnswerId="16889" CreationDate="2016-09-20T13:29:38.430" Score="3" ViewCount="158" Body="&lt;p&gt;I'm looking in to setting up a new site which has a Craft site in front of the open source version of Vanilla Forums. I'm a bit stuck on exactly where I should put vanilla though, and how to access it on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I've got this setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/&#xA;    /craft&#xA;    /public&#xA;        /vanilla&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then vanilla's URLs look like &lt;code&gt;http://domain.dev/vanilla/index.php?p=&lt;/code&gt; and it seems to conflic with Craft's .htaccess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also seen on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4323/localized-craft-build-with-vanilla-forums&quot;&gt;another question&lt;/a&gt; that someone installed vanilla in the templates directory. Is that better or a bad idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, should I be trying to run the forums under something like &lt;code&gt;domain.dev/forums/&lt;/code&gt;, or would it be easier to run it on a subdomain like &lt;code&gt;forums.domain.dev&lt;/code&gt;? I'm going to be using the &lt;a href=&quot;https://github.com/nystudio107/vanillaforums&quot; rel=&quot;nofollow noreferrer&quot;&gt;Single Sign On plugin&lt;/a&gt; to integrate it with Craft.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="45" LastEditDate="2018-08-20T21:41:54.790" LastActivityDate="2018-08-20T21:41:54.790" Title="What's the correct directory setup for Craft with Vanilla Forums?" Tags="&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16889" PostTypeId="2" ParentId="16888" CreationDate="2016-09-20T13:48:55.897" Score="4" Body="&lt;p&gt;Daryl,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've setup a few sites with Craft and Vanilla Forums, I've always named the folder &quot;Vanilla&quot; to either &quot;Community&quot; or &quot;Forum&quot; so the url being &quot;vanilla&quot; isn't a problem. Also you should know you can do a javascript include into another craft template so the URL can be anything you want really. I've never had a .htaccess conflict though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've always run the forums under /forums or /community or something of the sort when not using the javascript iframe embed method at which point the url can be anything. I've never attempted using a sub-domain, just did not see the point.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2016-09-20T13:55:28.363" LastActivityDate="2016-09-20T13:55:28.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16890" PostTypeId="1" AcceptedAnswerId="16900" CreationDate="2016-09-20T13:51:59.390" Score="1" ViewCount="295" Body="&lt;p&gt;I'm using Zurb foundation's Block Grid and using this in a matrix field where users can (using a block called 'wrapper') add a row and define the number of columns which appear side by side across a desktop device in that row, then using another block 'textBlocks' add divs of text within the row. I also want to add an option of 'fullwidth' a lightswitch field in the 'wrapper' block, so if this is selected then the 'following' will wrap around the row:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;fullwidth&quot;&amp;gt;&#xA;…row/text content&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I can't seem to add the closing  in the right place (at the end of the row), code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isWrapperOpen = false %}&#xA;{% for block in entry.pagedesigner %}&#xA;&#xA;  {% switch block.type %}&#xA;&#xA;    {% case &quot;wrapper&quot; %}&#xA;&#xA;&#xA;      {% if block['fullwidth'] is defined %}&amp;lt;div class=&quot;fullwidth&quot;&amp;gt;{% endif %}&#xA;      {% if isWrapperOpen %}&amp;lt;/div&amp;gt;{% endif %}&#xA;&#xA;      &amp;lt;div class=&quot;row large-up-{{ block.columns }}&quot;&amp;gt;&#xA;      {% set isWrapperOpen = true %}&#xA;      {{ block.heading }}&#xA;&#xA;    {% case &quot;textBlocks&quot; %}&#xA;        &amp;lt;div class=&quot;column&quot;&amp;gt; &#xA;          {{ block.text }}      &#xA;        &amp;lt;/div&amp;gt; &#xA;&#xA;  {% endswitch %}&#xA;&#xA;  {% if loop.last and isWrapperOpen %}&amp;lt;/div&amp;gt;{% endif %}&#xA;&#xA;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;pic added of Publish page&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qUwhg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qUwhg.png&quot; alt=&quot;Matrix publish page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate semantics need some work but need to figure logic first&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE I've since chatted with Andrew Fairlie from Mutual and got this working (with his guidance) excuse the crude inline styles – just helps aid making visual sense to me :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set isWrapperOpen = false %}&#xA;{% set isFullWrapperWidthOpen = false %}&#xA;{% for block in entry.pageDesigner %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% switch block.type %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;wrapper&quot; %}&#xA; {# Close the previous fullwidth wrapper before we open a new one #}&#xA;  {% if isFullWrapperWidthOpen %}&amp;lt;/div&amp;gt;{% endif %}&#xA;  {# Close the previous wrapper before we open a new one #}&#xA;  {% if isWrapperOpen %}&amp;lt;/div&amp;gt;{% endif %}&#xA;&#xA;&#xA;  {% if block.fullWidth %}&#xA;    {% set isFullWrapperWidthOpen = true %}&#xA;     &amp;lt;div class=&quot;row expanded&quot; style=&quot;background-color: red; margin-bottom: 30px;&quot;&amp;gt;&#xA;     {% else %}&#xA;       {% set isFullWrapperWidthOpen = false %}&#xA;    {% endif %}&#xA;&#xA;&#xA;  &amp;lt;div class=&quot;row large-up-{{ block.columns }}&quot;&amp;gt;&#xA;  {% set isWrapperOpen = true %}&#xA;&#xA;  {% case &quot;heading&quot; %}&#xA;   &amp;lt;h2  style=&quot;background-color: blue;&quot; class=&quot;column text-{{ block.position }} heading heading--{{ block.size }}&quot;&amp;gt;&#xA;    {{ block.text }}&#xA;   &amp;lt;/h2&amp;gt;     &#xA;&#xA;&#xA;  {% case &quot;textBlocks&quot; %}&#xA;    &amp;lt;div class=&quot;column&quot; style=&quot;background-color: yellow;&quot;&amp;gt; &#xA;      {{ block.text }}      &#xA;    &amp;lt;/div&amp;gt;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endswitch %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{# If we're on the last block, close up the last wrapper div #}&#xA;  {% if loop.last and isWrapperOpen %}{% endif %}&#xA;  {% if loop.last and isFullWrapperWidthOpen %}**{% endif %}&#xA;{% endfor %}&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="5654" LastEditDate="2016-09-29T12:16:45.373" LastActivityDate="2016-09-29T12:16:45.373" Title="Checking if matrix lightswitch is true, and add wrapper div" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16891" PostTypeId="1" AcceptedAnswerId="16902" CreationDate="2016-09-20T13:56:21.187" Score="0" ViewCount="327" Body="&lt;p&gt;So I am using a plugin to import data and it isn't assigning the values (asset is inside of Matrix) so I am going to modify the plugin and add code to lookup values that I need to assign to &lt;code&gt;MatrixBlockModel&lt;/code&gt; and then re-save the item. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked up how to create a command and based on that I wrote 3 lines of code but I have no idea on how to iterate through the results. Here is the sample code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query=craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;  -&amp;gt;select('id, folderId, filename, kind')&#xA;  -&amp;gt;from('{{ assetfiles }}')&#xA;  -&amp;gt;where('filename= :fileName', array(':fileName' =&amp;gt; 'somefilename'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I iterate through the results and how can I access info from the query?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="4466" LastEditDate="2016-09-20T14:37:45.183" LastActivityDate="2016-09-21T03:05:15.393" Title="Anyone have a createCommand example?" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;createcommand&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16892" PostTypeId="2" ParentId="16885" CreationDate="2016-09-20T15:25:29.553" Score="0" Body="&lt;p&gt;We have the same problem here. I downgraded to version 2.6.2922 for testing purposes and the gif loops infinitely again. I suspect the bugfix in 2.6.2923&#xA;&quot;Fixed a bug where animated GIF loop limits were not being respected.&quot; to be responsible. Unfortunately a downgrade on production is currently not possible for us, since the Schema version changed...&lt;/p&gt;&#xA;" OwnerUserId="5655" LastActivityDate="2016-09-20T15:25:29.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16893" PostTypeId="1" CreationDate="2016-09-20T17:10:03.380" Score="1" ViewCount="79" Body="&lt;p&gt;We're putting together a site where there is regional content managed by regional editors. I want to override the sources to only list entries from regions they are allocated to. I also want to group them by region rather than having entries for all their regions in one list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All was going well until I tried to remove the default Craft sources by clearing the &lt;code&gt;$sources&lt;/code&gt; array at the start. This has resulted in the New Entry button no longer being displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my function at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntrySources(&amp;amp;$sources, $context)&#xA;{&#xA;    if ($context == 'index')&#xA;    {&#xA;        if ($this-&amp;gt;regionalEd)&#xA;        {&#xA;            $sources = [];&#xA;            foreach ($this-&amp;gt;regions as $region)&#xA;            {&#xA;                $sources[] = ['heading' =&amp;gt; $region['title']];&#xA;                $sources['news:'.$region['id']] = [&#xA;                    'label'       =&amp;gt; 'News',&#xA;                    'criteria'    =&amp;gt; ['relatedTo' =&amp;gt; $region['id'], 'section' =&amp;gt; 'news', 'editable' =&amp;gt; true],&#xA;                    'data'        =&amp;gt; array('type' =&amp;gt; SectionType::Channel, 'handle' =&amp;gt; 'news'),&#xA;                    'defaultSort' =&amp;gt; array('postDate', 'desc'),&#xA;                ];&#xA;                $sources['notifications:'.$region['id']] = [&#xA;                    'label'       =&amp;gt; 'Notifications',&#xA;                    'criteria'    =&amp;gt; ['relatedTo' =&amp;gt; $region['id'], 'section' =&amp;gt; 'notifications', 'editable' =&amp;gt; true],&#xA;                    'data'        =&amp;gt; array('type' =&amp;gt; SectionType::Channel, 'handle' =&amp;gt; 'notifications'),&#xA;                    'defaultSort' =&amp;gt; array('postDate', 'desc'),&#xA;                ];&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something I need to add/remove, (other than the &lt;code&gt;$sources = [];&lt;/code&gt; line!), to allow the New Entry button to be displayed?&lt;/p&gt;&#xA;" OwnerUserId="173" LastActivityDate="2016-09-21T23:05:56.320" Title="Add Entry Button Not Shown When Overriding Entry Sources" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16894" PostTypeId="1" CreationDate="2016-09-20T18:17:45.373" Score="0" ViewCount="98" Body="&lt;p&gt;When adding custom sources as per the docs &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#modifyEntrySources&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/plugins/hooks-reference#modifyEntrySources&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($this-&amp;gt;regions as $region)&#xA;{&#xA;    $sources[] = ['heading' =&amp;gt; $region['title']];&#xA;    $sources['news:'.$region['id']] = [&#xA;        'label'    =&amp;gt; 'News',&#xA;        'criteria' =&amp;gt; ['relatedTo' =&amp;gt; $region['id'], 'section' =&amp;gt; 'news', 'editable' =&amp;gt; true],&#xA;        'data'     =&amp;gt; array('type' =&amp;gt; SectionType::Channel, 'handle' =&amp;gt; 'news'),&#xA;        'defaultSort' =&amp;gt; array('postDate', 'desc'),&#xA;    ];&#xA;    $sources['notifications:'.$region['id']] = [&#xA;        'label'    =&amp;gt; 'Notifications',&#xA;        'criteria' =&amp;gt; ['relatedTo' =&amp;gt; $region['id'], 'section' =&amp;gt; 'notifications', 'editable' =&amp;gt; true],&#xA;        'data'     =&amp;gt; array('type' =&amp;gt; SectionType::Channel, 'handle' =&amp;gt; 'notifications'),&#xA;        'defaultSort' =&amp;gt; array('postDate', 'desc'),&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the headings are not being shown between the sources. Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Ok, I've managed to figure out that it is to do with ElementIndexSettings. In &lt;code&gt;ElementIndexesService-&amp;gt;getSources()&lt;/code&gt; is a check for &lt;code&gt;sourceOrder&lt;/code&gt; in the settings...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Should we output the sources in a custom order?&#xA;if (isset($settings['sourceOrder']))&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I reverse the logic to mimic there being no settings my headings are displayed as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question has changed somewhat, firstly is this expected behaviour? If it is I'm only applying these sources for certain users, can I temporarily disable the index settings from within my plugin's &lt;code&gt;init&lt;/code&gt; function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="173" LastEditorUserId="173" LastEditDate="2016-09-20T21:51:17.363" LastActivityDate="2016-10-21T23:48:28.803" Title="Headings Not Shown When Adding Custom Source" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16896" PostTypeId="2" ParentId="16629" CreationDate="2016-09-20T19:33:30.183" Score="1" Body="&lt;p&gt;I'm not sure what kind of server you are running, but you should be able to set the server timezone in your control panel. You may need to then restart your database in order for you database's settings to be updated.&lt;/p&gt;&#xA;" OwnerUserId="5651" LastActivityDate="2016-09-20T19:33:30.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16897" PostTypeId="2" ParentId="16792" CreationDate="2016-09-20T19:38:18.073" Score="0" Body="&lt;p&gt;I am going to throw out some pure speculation here that Google and other bots are going to want something to be at &quot;/productCategory/&quot;. Hell, I'll even delete a slug when navigating a website. Whether it be via just a template that links subcategories, a single, part of structure, or categories, take the opportunity to create more landing pages.(just don't overdo it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only suggestion would be to make the category trigger word something other than &quot;productCategory&quot; or &quot;category&quot; or &quot;cat&quot; etc. Below I am using &quot;cars&quot; as the category trigger.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/cars/imported/fiat&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And there is content on &quot;/cars/&quot;, &quot;/imported/&quot;, and &quot;/fiat&quot;.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-20T19:38:18.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16898" PostTypeId="1" AcceptedAnswerId="16908" CreationDate="2016-09-20T21:51:51.280" Score="2" ViewCount="269" Body="&lt;p&gt;I have the following code that will output the UNAVAILABLE (previously booked) times of a Target Date. How would i edit this to output (in 30 minute increments) only the AVAILABLE times with Solspace Calendar?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetDate = &quot;2016/09/27&quot; %}&#xA;{% set calendarHandle = &quot;default&quot; %}&#xA;{% set day = craft.calendar.day({&#xA;     date: targetDate,&#xA;     calendar: calendarHandle&#xA;}) %}&#xA;&#xA;{% for event in day.events %}&#xA;    {{ event.startDate.format('g:i a') }} - {{ event.endDate.format('g:i a') }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastEditorUserId="4496" LastEditDate="2016-09-21T15:33:30.603" LastActivityDate="2016-09-26T16:39:01.247" Title="List Only Available Times/Dates in Solspace Calendar" Tags="&lt;datetime&gt;&lt;query&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16899" PostTypeId="2" ParentId="16883" CreationDate="2016-09-20T22:46:25.160" Score="2" Body="&lt;p&gt;I think you are looking for a plugin called Table Maker. I've never tried it but it looks like it lets your users create tables in the cp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/table-maker&quot; rel=&quot;nofollow&quot;&gt;Table Maker&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-09-20T23:45:14.000" LastActivityDate="2016-09-20T23:45:14.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16900" PostTypeId="2" ParentId="16890" CreationDate="2016-09-20T23:44:36.043" Score="2" Body="&lt;p&gt;Judging from your code it looks like you are struggling with one of Matrix's limitations. Nesting. I have seen, and used, a number of hacks to get around this until I stumbled upon the Neo plugin. I, in fact, use it exclusively for this kind of thing; Bootstrap's and Foundation's rows and columns.... or any other flex grid system for that matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this answer's kinda a non answer because I am going to point you in another direction to achieve Foundations Block Grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because Neo can nest and the code is very similar to a structure using levels, you can do something like this for Foundation's Block Grid.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.neoField.level(1) %}&#xA;&#xA;  {% for column in row.children %}&#xA;    {% if loop.first %}&amp;lt;div class=&quot;row small-up-1 medium-up-{{ loop.total }}&quot;&amp;gt;{% endif %}&#xA;        &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;            {% for field in column.children %}&#xA;            stuff... (use your switch code or I prefer per-field includes)&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% if loop.last %}&amp;lt;/div&amp;gt;{% endif %}&#xA; {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;div class=&quot;row small-up-1 medium-up-3&quot;&amp;gt;&#xA;     &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;       &amp;lt;img src=&quot;//placehold.it/300x300&quot;&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;     &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;       &amp;lt;img src=&quot;//placehold.it/300x300&quot;&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;     &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;       &amp;lt;img src=&quot;//placehold.it/300x300&quot;&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in Neo I have a top level block called &quot;Row&quot;. It has no fields, but it could, you can make it as complicated as you want adding class, background etc. This row block can only have one type of child block called &quot;Column&quot; again, no fields if you don't want. This &quot;Column&quot; block can have any number of child blocks including photo, text, video(even a Row! Inception!). For each row you add, you can have as many columns you want(zurb block grid only works to 8). The total amount of columns you add gets added to the &lt;code&gt;medium-up-3&lt;/code&gt; per the &lt;code&gt;{{ loop.total }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow&quot;&gt;Neo Field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The code above is a simplified version. Doing the Row &gt; Column &gt; Row works, but the code's a little more complicated.&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2016-09-21T00:09:49.540" LastActivityDate="2016-09-21T00:09:49.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16902" PostTypeId="2" ParentId="16891" CreationDate="2016-09-21T03:05:15.393" Score="1" Body="&lt;p&gt;I'd suggest reading through the Yii &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow&quot;&gt;QueryBuilder docs&lt;/a&gt;, which is what the code you've written is using.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;from('{{ assetfiles }}')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;from('assetfiles')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you want multiple rows returns as a a result, you need to add a:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the end of the statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you can do a &lt;code&gt;foreach&lt;/code&gt; loop to access the results of your query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($query as $row)&#xA;{&#xA;    $id = $result['id'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-21T03:05:15.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16903" PostTypeId="1" AcceptedAnswerId="16904" CreationDate="2016-09-21T07:59:16.280" Score="3" ViewCount="114" Body="&lt;p&gt;I've built a custom FieldType, and I'd like editors to be able to add any fields using this FieldType to element indexes. Unfortunately, fields using my custom FieldType aren't included in the list of fields in the Customizable Element Index configurator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make it possible to add fields using my custom FieldType to element indexes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is it possible to define how the value returned from my custom FieldType displays in the element index?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-21T07:59:16.280" Title="How can I make my custom FieldType show up in an element index?" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16904" PostTypeId="2" ParentId="16903" CreationDate="2016-09-21T07:59:16.280" Score="3" Body="&lt;p&gt;To make it possible to select fields from a custom FieldType in the Customizable Element Indexes interface, your FieldType class needs to implement the &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/IPreviewableFieldType&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;IPreviewableFieldType&lt;/code&gt;&lt;/a&gt; interface, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ExamplePluginHandleFieldType extends BaseFieldType implements IPreviewableFieldType&#xA;{&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to modify how the values from your custom FieldType displays in element indexes, you need to add a &lt;code&gt;getTableAttributeHtml&lt;/code&gt; method to your FieldType class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTableAttributeHtml($value)&#xA;{&#xA;    return $value ? $value-&amp;gt;id : null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-21T07:59:16.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16905" PostTypeId="1" AcceptedAnswerId="16941" CreationDate="2016-09-21T09:47:44.940" Score="1" ViewCount="572" Body="&lt;p&gt;I wanted to install a single instance of craft on my local machine. However upon starting the installation via calling &lt;code&gt;/admin/&lt;/code&gt; or &lt;code&gt;/admin/install&lt;/code&gt;, the only message I get, is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected&#xA;  The SQL being executed was: SHOW TABLES LIKE 'craft_%'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which in itself is weird, since I have modified the configuration already to not use craft_ as a table prefix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are my settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;OS: Mac OS X 10.11.3 (El Capitan)&lt;/li&gt;&#xA;&lt;li&gt;PHP 5.6.25&lt;/li&gt;&#xA;&lt;li&gt;MySQL 5.7.14&lt;/li&gt;&#xA;&lt;li&gt;Apache 2.4.16&lt;/li&gt;&#xA;&lt;li&gt;Latest Craft 2 build from today / Latest Craft 3 build from today&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have made the following changes to the configuration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/config/db.php&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    '.local' =&amp;gt; [&#xA;        // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;        'server' =&amp;gt; '127.0.0.1',&#xA;&#xA;        // The database username to connect with.&#xA;        'user' =&amp;gt; 'root',&#xA;&#xA;        // The database password to connect with.&#xA;        'password' =&amp;gt; '',&#xA;&#xA;        // The name of the database to select.&#xA;        'database' =&amp;gt; 'craft_cms',&#xA;&#xA;        // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;        'tablePrefix' =&amp;gt; '',&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/config/general.php&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    '.local' =&amp;gt; [&#xA;        'devMode' =&amp;gt; true,&#xA;    ],&#xA;    '*' =&amp;gt; [&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I even went the extra mile and updated the my.cnf for mysql in order to work properly in 5.7:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; Since the mods removed the craft3 tag due to my typo, I thought it was necessary to say that this error occurs on both the latest version of craft3 and craft2.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastEditorUserId="5659" LastEditDate="2016-09-21T12:23:51.063" LastActivityDate="2016-09-22T18:06:35.187" Title="Local install does not start, PDO Exception" Tags="&lt;install&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16906" PostTypeId="2" ParentId="16905" CreationDate="2016-09-21T12:17:01.333" Score="0" Body="&lt;p&gt;Not sure, but maybe you can't have the table prefix as blank? &lt;code&gt;'tablePrefix' =&amp;gt; ''&lt;/code&gt; It needs to be something no?&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-21T12:17:01.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16908" PostTypeId="2" ParentId="16898" CreationDate="2016-09-21T14:13:11.470" Score="5" Body="&lt;p&gt;&lt;strong&gt;Edited to provide a cleaner solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code will display different contents for available times and unavailable times in 30 min increments, and makes no assumption on how long your events are.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetDate = &quot;today&quot; %}&#xA;&#xA;{% set events = craft.calendar.events({&#xA;    dateRangeStart: targetDate,&#xA;    dateRangeEnd: targetDate&#xA;}) %}&#xA;&#xA;&#xA;{% for hour in craft.calendar.day({date: targetDate}) %}&#xA;    {% set dateFirstHalfHour = hour.date.copy.addMinutes(30) %}&#xA;    {% set dateSecondHalfHour = hour.date.copy.addMinutes(60) %}&#xA;&#xA;    {% set hasEventsInFirstHalf = false %}&#xA;    {% set hasEventsInSecondHalf = false %}&#xA;    {% for event in events %}&#xA;        {% if hour.date &amp;gt;= event.startDate and hour.date &amp;lt; event.endDate %}&#xA;            {% set hasEventsInFirstHalf = true %}&#xA;        {% endif %}&#xA;&#xA;        {% if dateFirstHalfHour &amp;gt;= event.startDate and dateFirstHalfHour &amp;lt; event.endDate %}&#xA;            {% set hasEventsInSecondHalf = true %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;        {{ hour.date.format(&quot;H:i&quot;) }} - {{ hasEventsInFirstHalf ? &quot;unavailable&quot; : &quot;available&quot; }}&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        {{ dateFirstHalfHour.format(&quot;H:i&quot;) }} - {{ hasEventsInSecondHalf ? &quot;unavailable&quot; : &quot;available&quot; }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="45" LastEditDate="2016-09-26T16:39:01.247" LastActivityDate="2016-09-26T16:39:01.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16909" PostTypeId="1" AcceptedAnswerId="16934" CreationDate="2016-09-21T15:46:32.217" Score="4" ViewCount="1610" Body="&lt;p&gt;I want to set the default &lt;code&gt;countryId&lt;/code&gt; and a default shipping method (there is only one shipping method but contain several rules), so that the cart screen shows this and we can then present a shipping cost. I then want to build a facility for the customer to change their country on the cart screen so that they can update their country to see the new shipping costs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pass in the following;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[countryId]&quot; value=&quot;77&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingMethod&quot; value=&quot;standard&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;on the product/add to cart screen then the flash messages shows;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ERROR! CART NOT COMPLETELY UPDATED.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And whilst it sets the &lt;code&gt;shippingAddress[countryId]&lt;/code&gt; on that product page (I checked for it) when I navigate to the cart screen the &lt;code&gt;shippingAddress[countryId]&lt;/code&gt; is then not set at all.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="45" LastEditDate="2016-09-26T16:42:21.510" LastActivityDate="2016-11-24T14:03:45.480" Title="Setting Shipping Country and Method for the Cart screen" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16910" PostTypeId="1" CreationDate="2016-09-21T16:41:30.120" Score="1" ViewCount="81" Body="&lt;p&gt;With Craft Commerce, users have the ability to save, edit and delete addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present, if a user wants to add or edit an address, they are taken to a separate page. I want to know how I can embed a new address form (or indeed one with an existing address) into a modal on the same page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the default code that displays the list of saved addresses and an 'Edit' link:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.commerce.customer.addresses %}&#xA;  {% for address in craft.commerce.customer.addresses %}&#xA;    &amp;lt;div class=&quot;block p3&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;u-pull-right&quot; href=&quot;/commerce/customer/addresses/edit?addressId={{ address.id }}&quot;&amp;gt;Edit&amp;lt;/a&amp;gt;&#xA;      &amp;lt;form style=&quot;position:absolute;&quot; method=&quot;POST&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/customerAddresses/delete&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;{{ address.id }}&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; class=&quot;button button-outline&quot; value=&quot;x&quot;/&amp;gt;&#xA;      &amp;lt;/form&amp;gt;&#xA;      {% include 'commerce/_includes/address' with {'address': address} %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;You currently have no addresses saved. Go ahead and add one.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the code for the modal dialog:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;remodal&quot; data-remodal-id=&quot;modal&quot;&amp;gt;&#xA;  &amp;lt;button data-remodal-action=&quot;close&quot; class=&quot;remodal-close&quot;&amp;gt;&amp;lt;/button&amp;gt;&#xA;  [CODE HERE]&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;....which is triggered by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a data-remodal-target=&quot;modal&quot;&amp;gt;Call the modal with data-remodal-id=&quot;modal&quot;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I go about embedding the address form into a modal? So that when a user clicks 'edit' or 'Add' a modal dialog appears with the relevant content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help would be much appreciated as this is a little beyond me.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastEditorUserId="4466" LastEditDate="2016-09-22T08:55:49.150" LastActivityDate="2016-09-22T08:55:49.150" Title="How do I embed a form within a modal?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16911" PostTypeId="2" ParentId="16674" CreationDate="2016-09-21T17:42:19.110" Score="6" Body="&lt;p&gt;Going to chime in here as I ran into a similar issue, and solved it a bit differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using group handles I was using a dynamic set of Group IDs. However, the problem still remains that &lt;code&gt;isInGroup()&lt;/code&gt; doesn't support an array of handles or ids. So you gotta run some checks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, I think you can be little more dynamic using IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set coolArrayOfGroupIds = [2, 4, 5, 400] %}&#xA;&#xA;{% if currentUser %}&#xA;    {% set allowedAccess = false %}&#xA;&#xA;    {% for group in currentUser.getGroups() %}&#xA;        {% if group.id in coolArrayOfGroupIds %}&#xA;            {% set allowedAccess = true %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if currentUser.admin or allowedAccess %}&#xA;        {# You win! Secrets Time #}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="222" LastActivityDate="2016-09-21T17:42:19.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16912" PostTypeId="1" AcceptedAnswerId="16950" CreationDate="2016-09-21T17:57:48.983" Score="1" ViewCount="858" Body="&lt;p&gt;I need to display an entry only if the date fields within its Matrix are current. So, only display if the &lt;code&gt;startDate&lt;/code&gt; is greater than or equal to today and the &lt;code&gt;endDate&lt;/code&gt; is less than or equal to today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have this code and am having trouble finding how to compare multiple dates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle') %}&#xA;    {% set present = now|date %}&#xA;    {% set entryStart = entry.matrixHandle.startDate %}&#xA;    {% set entryEnd = entry.matrixHandle.endDate %}&#xA;&#xA;    {% if entryStart &amp;gt;= present and entryEnd &amp;lt;= present %}&#xA;        display entry information&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that I'm using the operators incorrectly or that &quot;and&quot; isn't allowed. Either way, it's not displaying anything and yes, I have a made sure that I have an entry with dates that would activate this if statement.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="57" LastEditDate="2016-09-21T23:52:34.570" LastActivityDate="2016-09-23T00:00:09.633" Title="Comparing current date to multiple entry matrix date fields" Tags="&lt;entry&gt;&lt;datetime&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16913" PostTypeId="1" AcceptedAnswerId="16914" CreationDate="2016-09-21T18:39:13.027" Score="2" ViewCount="432" Body="&lt;p&gt;I have a front end form with checkboxes which submits the data as an array into a plain text field in craft (named &lt;code&gt;logGeneral_logInputIndications&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of what the content looks in the plain text field in Craft CP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;Abdominal Pain&quot;,&quot;RUQ&quot;,&quot;Vomiting&quot;,&quot;&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of outputting the field content in it's default state into my template, I'd like to convert it to an unordered list.  If I were to code it by hand it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;Abdominal Pain&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;RUQ&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;Vomiting&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas if it's possible to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(Mats answered the above question and his suggestion worked perfectly.)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I just realized that I have checkbox choices that contain non-alphanumeric content like &lt;code&gt;Normal CBD (&amp;lt;0.4cm)&lt;/code&gt;  Is there a way to pick and choose which non-alphanumeric content I'd like to strip out vs keep?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's a new question that builds upon my initial one...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add a conditional to this?  Some of the text is really a child so it should be inset by another unordered list.  What my initial thought was is that perhaps I could add an identifier to the form input text if it's a child like &quot;•&quot; or something else, and then in the template, use that identifier in a conditional to say if you see &quot;•&quot; indent it and then strip the marker &quot;•&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then my plain text content would be: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;Abdominal Pain&quot;,&quot;•RUQ&quot;,&quot;Vomiting&quot;,&quot;&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my template code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;Abdominal Pain&amp;lt;/li&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;RUQ&amp;lt;/li&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;Vomiting&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I was able to combine the suggestion Mats gave me with the following to conditionally indent child items.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listItems = entry.logGeneral_logInputIndications|replace('/[^,()&amp;lt;&amp;gt;• a-zA-Z0-9_-]|[, ]$/s','')|split(',') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% if entry.logGeneral_logInputIndications|length %}&#xA;        {% for listItem in listItems %}&#xA;            {% if listItem starts with '•' %}&#xA;                &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;{{ listItem|trim|slice(1) }}&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;li&amp;gt;{{ listItem|trim }}&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="3418" LastEditDate="2016-09-22T01:54:03.453" LastActivityDate="2016-09-22T01:54:03.453" Title="Is it possible to convert plain text array to an unordered list?" Tags="&lt;templating&gt;&lt;array&gt;&lt;checkboxes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16914" PostTypeId="2" ParentId="16913" CreationDate="2016-09-21T18:52:11.213" Score="2" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listItems = plainTextValue|replace('/[^, a-zA-Z0-9_-]|[, ]$/s','')|split(',') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for listItem in listItems %}&#xA;    {% if listItem|length %}&#xA;      &amp;lt;li&amp;gt;{{ listItem|trim }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does is to first use the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;replace&lt;/code&gt;&lt;/a&gt; filter to remove any character that isn't alphanumeric (except spaces and commas), before the resulting string (which would look something like &lt;code&gt;'Abdominal Pain,RUQ,Vomiting'&lt;/code&gt;) is split on the commas. The resulting array is stored in a variable &lt;code&gt;listItems&lt;/code&gt;. Finally, it's just a matter of looping through that array, to create the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the above example, &lt;code&gt;plainTextValue&lt;/code&gt; is a variable containing the string &lt;code&gt;'[&quot;Abdominal Pain&quot;,&quot;RUQ&quot;,&quot;Vomiting&quot;,&quot;&quot;]'&lt;/code&gt; – so swap that out with &lt;code&gt;entry.logGeneral_logInputIndications&lt;/code&gt;, or whatever fits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit (OP added more info to the original question)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your &quot;symptoms&quot; are in fact &lt;em&gt;hierarchical&lt;/em&gt;, I'd suggest not using a PlainText field at all. You're quickly running into a situation where your back-end solution is way too simple, which will make your front-end solution way too complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My definitive recommendation would be to create a Categories group for the symptoms, and swap out the PlainText field for a Categories field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can still render the actual symptoms form element on the front end as checkboxes, you'd just pass in an array of category IDs instead of a plain text string (the following example assumes a Categories group with the handle &lt;code&gt;symptoms&lt;/code&gt; and a Categories field with the handle &lt;code&gt;selectedSymptoms&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all available symptoms #}&#xA;{% set symptoms = craft.categories.group('symptoms').limit(null) %}&#xA;&#xA;{# Get the symptoms that have been selected for this entry earlier #}&#xA;{% set selectedSymptoms = entry.selectedSymptoms.ids() %}&#xA;&#xA;{# Loop through the available symptoms, creating checkboxes #}&#xA;{% for symptom in symptoms %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[selectedSymptoms][]&quot; value=&quot;{{ symptom.id }}&quot;{% if symptom.id in selectedSymptoms %} checked{% endif %} /&amp;gt;{{ symptom.title }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and to display whatever symptoms are already selected – in nested lists, as per the category hiearchy, you can use the &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav symptom in entry.selectedSymptoms %}&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ symptom.title }}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-09-21T20:30:04.377" LastActivityDate="2016-09-21T20:30:04.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16915" PostTypeId="1" CreationDate="2016-09-21T19:03:26.540" Score="1" ViewCount="197" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow&quot;&gt;Embedded Assets plugin&lt;/a&gt; to get YouTube videos and its working great within the CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to show the asset(s) on my page by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ embed.safeHtml|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works great. I'm able to see the YT video that was uploaded in the CP. It's &lt;em&gt;huge&lt;/em&gt; but it is getting rendered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the user to be able to &quot;upload&quot; videos from the front-end so reading this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As embedded assets are stored as JSON files&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The instructions above are pretty clear - I just don't &quot;get it&quot;. I have clicked the oEmbed page as suggested for more info to see an example json output, but I guess its getting from point A to B is what I'm not sure about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I create a &lt;code&gt;plainText&lt;/code&gt; field, and have the user paste in a video url? Then my controller method (somehow) creates the json file and saves it somewhere? I'm not sure where/how to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to specify a width on the rendered iframe that is getting generated, but I'm not sure how to incorporate that either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2016-09-22T00:16:59.293" LastActivityDate="2016-09-22T00:16:59.293" Title="How can I use the Embedded assets plugin to save assets on the front-end?" Tags="&lt;plugin-development&gt;&lt;plugin-embeddedassets&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16916" PostTypeId="2" ParentId="16913" CreationDate="2016-09-21T19:16:19.100" Score="2" Body="&lt;p&gt;Is the data a pseudo-syntax, or is it JSON?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is JSON, then the following may be a more robust solution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a barebones plugin (&lt;code&gt;craft/plugins/helpers/HelpersPlugin.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;? namespace Craft;&#xA;&#xA;class HelpersPlugin extends BasePlugin&#xA;{&#xA;  public function getName()&#xA;  {&#xA;    return Craft::t('Helpers');&#xA;  }&#xA;&#xA;  public function getVersion()&#xA;  {&#xA;    return '1.0';&#xA;  }&#xA;&#xA;  public function getDeveloper()&#xA;  {&#xA;    return 'Your Name';&#xA;  }&#xA;&#xA;  public function getDeveloperUrl()&#xA;  {&#xA;    return 'http://domain.com/';&#xA;  }&#xA;&#xA;  public function hasCpSection()&#xA;  {&#xA;    return false;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add the class that will get loaded as a set of helpers within your templates: (&lt;code&gt;craft/plugins/helpers/variables/HelpersVariable.php&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;? namespace Craft;&#xA;&#xA;class HelpersVariable&#xA;{&#xA;  public function parseSymptoms(String $json)&#xA;  {&#xA;    return array_filter(json_decode($json));&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the helper like this: (&lt;code&gt;craft/templates/your-template.twig&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for ailment in craft.helpers.parseSymptoms(entry.logGeneral_logInputIndications) %}&#xA;    &amp;lt;li&amp;gt;{{ ailment }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You could add methods to the &lt;code&gt;HelpersVariable&lt;/code&gt; class do additional checks— you'll be able to use the full range of PHP methods to manipulate the data, rather than rely on the subset of functions available as Twig filters.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2016-09-21T19:16:19.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16917" PostTypeId="1" AcceptedAnswerId="16945" CreationDate="2016-09-21T19:32:31.460" Score="2" ViewCount="195" Body="&lt;p&gt;How can I use the shortener plugin to get and shorten the current URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried both twig and plugin methods shown in the docs, but the twig method outputs the FULL url, and the plugin method doesn't work at all (no output).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set longUrl = craft.request.getUrl() %}&#xA; &amp;lt;p&amp;gt;share link: &amp;lt;a href=&quot;{{ longUrl|shorten }}&quot;&amp;gt;{{ longUrl|shorten }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result with this is the full URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My configs in the plugin settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NJ36L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NJ36L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cleared my system cache after I updated the settings as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="45" LastEditDate="2016-09-21T19:45:28.257" LastActivityDate="2016-09-22T18:25:49.390" Title="How to shorten 'craft.request.getUrl()' with the shortener plugin?" Tags="&lt;plugins&gt;&lt;url&gt;&lt;filter&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16918" PostTypeId="1" CreationDate="2016-09-21T20:29:25.003" Score="4" ViewCount="700" Body="&lt;p&gt;I have a Neo Field: I want to work with blocks up to 3 levels deep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My output code works fine: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav block in entry.myField.level(1) %}&#xA;    {% switch block.type.handle %}&#xA;        {% case 'title' %}&#xA;            &amp;lt;h2&amp;gt;{{ block.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% case 'blocks' %}&#xA;             {% for item in block.children %}&#xA;                 {% include &quot;_includes/elements/&quot; ~ item.type %}&#xA;             {% endfor %}&#xA;&#xA;    {% endswitch %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I output the deeper block levels? &#xA;I don't find any way to do this.&lt;/p&gt;&#xA;" OwnerUserId="5237" LastActivityDate="2016-09-21T20:51:11.283" Title="Neo Children Output" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16919" PostTypeId="2" ParentId="16918" CreationDate="2016-09-21T20:35:10.567" Score="1" Body="&lt;p&gt;Not tested – I've no idea if the &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt; tag even works properly with Neo, but assuming it does, you're not actually rendering the children for each &lt;code&gt;block&lt;/code&gt; with your current code. This might do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav block in entry.myField.level(1) %}&#xA;&#xA;    {% switch block.type.handle %}&#xA;&#xA;        {% case 'title' %}&#xA;            &amp;lt;h2&amp;gt;{{ block.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% case 'blocks' %}&#xA;            {% for item in block.children %}&#xA;                {% include &quot;_includes/elements/&quot; ~ item.type %}&#xA;             {% endfor %}&#xA;&#xA;    {% endswitch %}&#xA;&#xA;    {% ifchildren %}&#xA;        {% children %}&#xA;    {% endifchildren %}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-21T20:35:10.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16920" PostTypeId="2" ParentId="16918" CreationDate="2016-09-21T20:51:11.283" Score="3" Body="&lt;p&gt;You take the same approach as the original child.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd nest a &lt;code&gt;{% for 3rdChild in item.children %}&lt;/code&gt; in your &lt;code&gt;{% for item in block.children %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2016-09-21T20:51:11.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16921" PostTypeId="2" ParentId="16894" CreationDate="2016-09-21T22:53:22.773" Score="1" Body="&lt;p&gt;So I have my headings displaying now but this is more of a flawed workaround than an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically when the &lt;code&gt;ElementIndexesService-&amp;gt;getSources()&lt;/code&gt; function finds element index settings it then works through the sources ordering them and applying headings based on the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As my sources are custom ones added by a plugin they don't exist in the settings. Because of this they are shuffled to the end of the list and the headings are removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My fix is to add them to the settings in the database. This can be done using... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$elementIndexesService = new ElementIndexesService();&#xA;$settings = $elementIndexesService-&amp;gt;getSettings(ElementType::Entry);&#xA;// and&#xA;$elementIndexesService-&amp;gt;setSettings(ElementType::Entry, $settings);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$settings&lt;/code&gt; consists of two sub arrays containing the sources and their order. By adding my custom sources to these everything appears in the entries index as planned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The flaws are that I now need to maintain this whenever the entries that effect the sources are created or deleted. Also the index settings modal overwrites the settings in the database so again I have to maintain it if they are changed.&lt;/p&gt;&#xA;" OwnerUserId="173" LastActivityDate="2016-09-21T22:53:22.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16922" PostTypeId="2" ParentId="16775" CreationDate="2016-09-21T22:57:14.383" Score="0" Body="&lt;p&gt;Try LinkIt. Allows you to set attributes.&#xA;&lt;a href=&quot;https://github.com/fruitstudios/LinkIt/blob/master/README.md&quot; rel=&quot;nofollow&quot;&gt;https://github.com/fruitstudios/LinkIt/blob/master/README.md&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2016-09-21T22:57:14.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16923" PostTypeId="2" ParentId="16893" CreationDate="2016-09-21T23:05:56.320" Score="1" Body="&lt;p&gt;The New Entry button is not being displayed as Craft is not seeing my sources as containing publishable entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft JS object contains a list of &lt;code&gt;publishableSections&lt;/code&gt; which is checked by &lt;code&gt;craft.js&lt;/code&gt; using &lt;code&gt;this.getSourceByKey('section:'+section.id)&lt;/code&gt;. Since my sources use a custom &lt;code&gt;key&lt;/code&gt; value they are not included in this list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have resolved the problem by adding my own New Entry button.&lt;/p&gt;&#xA;" OwnerUserId="173" LastActivityDate="2016-09-21T23:05:56.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16924" PostTypeId="1" AcceptedAnswerId="16926" CreationDate="2016-09-21T23:19:23.737" Score="1" ViewCount="36" Body="&lt;p&gt;Is there a way to call a custom function after an entry is deleted successfully?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there isn't, is there a record of the deleted record stored anywhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I am thinking of editing the &lt;code&gt;actionPerformAction&lt;/code&gt; in &lt;code&gt;elementIndexController&lt;/code&gt;, but I don't want to edit the application files, so if there is another method I would prefer that.&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="4466" LastEditDate="2016-09-22T08:35:22.297" LastActivityDate="2016-09-22T08:35:22.297" Title="Calling a plugin function after an entry is deleted?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16925" PostTypeId="1" AcceptedAnswerId="16952" CreationDate="2016-09-22T00:05:43.710" Score="2" ViewCount="409" Body="&lt;p&gt;Doing a quick redactor plugin to added a class to images after upload. Based on the docs, &lt;code&gt;imageUpload&lt;/code&gt; should be the callback used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin loads, but am I doing this wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!RedactorPlugins) var RedactorPlugins = {};&#xA;&#xA;RedactorPlugins.responsiveimage = function () {&#xA;  return {&#xA;    init: function()&#xA;    {&#xA;      var that = this;&#xA;      console.log(&quot;loaded&quot;);&#xA;    },&#xA;    imageUpload: function(image, json){&#xA;      console.log(image);&#xA;      image.addClass(&quot;img-responsive&quot;);    &#xA;    }   &#xA;  };&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastActivityDate="2016-09-23T05:28:13.543" Title="Redactor plugin for Bootstrap Responsive Image" Tags="&lt;plugins&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16926" PostTypeId="2" ParentId="16924" CreationDate="2016-09-22T00:20:43.577" Score="2" Body="&lt;p&gt;You can create a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;simple plugin&lt;/a&gt; that listens to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onDeleteEntry&quot; rel=&quot;nofollow&quot;&gt;onDeleteEntry&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow&quot;&gt;event&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an &lt;code&gt;entry&lt;/code&gt; parameter passed into that event that is the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow&quot;&gt;EntryModel&lt;/a&gt; object that represents the entry that was just deleted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-22T00:20:43.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16927" PostTypeId="1" AcceptedAnswerId="16928" CreationDate="2016-09-22T05:31:04.093" Score="3" ViewCount="156" Body="&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class AffiliatesExportPlugin extends BasePlugin&#xA;{&#xA;  //All other functions&#xA;&#xA;  public function init() {&#xA;    craft()-&amp;gt;on('entries.onDeleteEntry', function(Event $event) {&#xA;      Craft::log(&quot; on delete ######\n\n&quot;, LogLevel::Info, true);&#xA;    });&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added this as a plugin activated the plugin, but when I delete an entry, it doesn't seem to get triggered. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="45" LastEditDate="2016-09-22T05:47:56.967" LastActivityDate="2016-09-22T05:57:21.820" Title="'onDeleteEntry' Event is not triggered when an Entry is deleted?" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16928" PostTypeId="2" ParentId="16927" CreationDate="2016-09-22T05:57:21.820" Score="3" Body="&lt;p&gt;&lt;strong&gt;Bulk actions do not trigger their respective events.&lt;/strong&gt; When you delete an entry (or multiple entries) via the checkboxes, you are performing a bulk action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you can listen to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforePerformAction&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction&quot; rel=&quot;nofollow noreferrer&quot;&gt;onPerformAction&lt;/a&gt; events, check to see if the action parameter to see if it's the action you're interested in and perform  your logic as necessary. *&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;* Much of this answer was copied from my &amp;amp; Brad's answers on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8460/delete-change-status-from-cp-via-ajax-trigger-event&quot;&gt;this similar thread...&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-09-22T05:57:21.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16929" PostTypeId="1" CreationDate="2016-09-22T08:16:15.947" Score="1" ViewCount="384" Body="&lt;p&gt;I'm having issues with the following code every since I added barbs.js (a page transition library) to my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I have a js file that controls the transition and ajax. The following code exists within an event that triggers when the page transition has completed. The event works as I've tested it. The son array exists as I have rendered it at the bottom of the page and content is there. My javascript say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SyntaxError: Unexpected token '{'. Expected a property name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var jsonMeta = {{ jsonMeta|json_encode|raw }};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This used to work work but doesn't anymore. The full code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var Contentpage = Barba.BaseView.extend({&#xA;  namespace: 'contentpage',&#xA;&#xA;    onEnter: function() {&#xA;       $('#navigation').removeClass('invert-nav-bar');&#xA;  },&#xA;&#xA;  onEnterCompleted: function() {&#xA;       Barba.Dispatcher.on('transitionCompleted', function(currentStatus) {&#xA;        var jsonMeta = {{ jsonMeta|json_encode|raw }};&#xA;        $('head').find('title').text(jsonMeta.meta.title);&#xA;        $.each(jsonMeta.meta.link, function(k, v){&#xA;            $.each(v, function(kk, vv){&#xA;                $('head').find('link[' + k + '=&quot;' + kk + '&quot;]').attr('href', vv);&#xA;            });&#xA;        });&#xA;&#xA;        $.each(jsonMeta.meta.meta, function(k, v){&#xA;            $.each(v, function(kk, vv){&#xA;                $('meta[' + k + '=&quot;' + kk + '&quot;]').attr('content', vv);&#xA;            });&#xA;        });&#xA;        });&#xA;&#xA;&#xA;  }&#xA;&#xA;&#xA;});&#xA;&#xA;Contentpage.init();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5195" LastActivityDate="2016-09-22T08:16:15.947" Title="Twig json array error in javascript with barbs.js" Tags="&lt;json&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16930" PostTypeId="2" ParentId="16909" CreationDate="2016-09-22T08:48:59.830" Score="1" Body="&lt;p&gt;A shipping address needs a First Name (&lt;code&gt;firstName&lt;/code&gt;) and Last Name (&lt;code&gt;lastName&lt;/code&gt;) as they are required fields - This is why your cart won't update. You will also run into issues if you write any &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15897/craft-commerce-validation-on-address-fields&quot;&gt;address validation&lt;/a&gt; for use during the checkout process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For these reasons it isn't advisable to set fields on an order's address for a customer. It is perhaps a better idea to list your shipping methods and costs manually somewhere on your site or your product pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final solution - &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;An adjuster&lt;/a&gt; could be written that adds a base shipping cost to an order without the need for a shipping address. There would be a lot of things to consider whilst implementing something like that though.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-09-22T09:24:42.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16931" PostTypeId="1" CreationDate="2016-09-22T08:53:22.793" Score="1" ViewCount="33" Body="&lt;p&gt;We have a multilingual site with about 30 different locales and about 5 pages of content for each. We're using Craft as a content API for the editors to manage content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of those locales share the same language - for example there's USA (English), Singapore (English) and UK (English).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a big hassle for them to have to copy the English text into 3 different localisations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'd like to add a custom field at the top of each entry edit page to say &quot;Inherit from another locale?&quot; and provide a dropdown list of all the locales which are currently available and enabled in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should this be possible? Does anyone have any code samples of this being done? Is it likely to present any issues if we attempt to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tips appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4672" LastActivityDate="2016-09-22T08:53:22.793" Title="Is it possible to create a custom field listing all enabled locales?" Tags="&lt;localization&gt;&lt;custom-field&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16932" PostTypeId="1" CreationDate="2016-09-22T10:08:47.123" Score="1" ViewCount="191" Body="&lt;p&gt;I made the update for Redactor 2 and I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;VM463:1 Uncaught TypeError: Cannot read property 'accessibility-help-label' of undefined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? I can't find the problem.&lt;/p&gt;&#xA;" OwnerUserId="5646" LastEditorUserId="57" LastEditDate="2016-09-22T23:17:01.433" LastActivityDate="2016-09-27T09:21:45.940" Title="Redactor 2 error 'accessibility-help-label'" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16933" PostTypeId="2" ParentId="16175" CreationDate="2016-09-22T11:07:42.813" Score="3" Body="&lt;p&gt;The short answer is no, it is not possible.  The much longer answer I will add to your other question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16909/setting-shipping-country-and-method-for-the-cart-screen&quot;&gt;Setting Shipping Country and Method for the Cart screen&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-09-22T11:07:42.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16934" PostTypeId="2" ParentId="16909" CreationDate="2016-09-22T11:20:54.740" Score="6" Body="&lt;p&gt;I agree with the basic underlying premise that showing full cost - i.e. with shipping - is essential on the cart index page for a modern checkout.  Customers loathe what they see as a hidden surprise if they hit shipping costs later in the process and your completion rate plummets in my experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luke's answer is right about the root cause of the issue - Commerce currently requires a customer with a valid 'address' before you can set shipping on the cart, and a 'valid address' is (out of the box) at least a &lt;code&gt;firstName&lt;/code&gt; and a &lt;code&gt;lastName&lt;/code&gt; .  You can definitely throw a countryId in a hidden field as a default, but only in addition to setting the address details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has become without doubt my &lt;em&gt;least&lt;/em&gt; favourite thing about Commerce as it currently stands, and I have spent WAY more time on solving this problem than anything else in Commerce.  To be fair I really should have discussed this a lot more with Luke (Holder, not Pearce above!) - as I really think this needs to be solved (by Commerce) sooner rather than later for a sophisticated checkout flow to be achievable without too much hassle.  But at a certain point I was too far along to contemplate going back to scratch with it (as I will have to once a proper fix comes I guess!).  So I've hacked away at it and have it all working pretty well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what ARE your options (I've tried all three, and none of them are great):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From easiest to hardest:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a fake 'address' for your customer (I used Mr. Shipping Quote for this) - i.e. set firstName Shipping, lastName Quote, and have a select for your countries I guess -&gt; so that you can then use standard methods to set shipping on the cart, and then on your shipping page basically update this with the actual details when you get them&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(as per Luke above) - Write an adjuster to add this shipping until such a point as you do get an address, then once you do make the adjuster adjsut to $0...as you'll then have shipping set on the cart appropriately 'for real'&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(And this is what we do on imagescience.com.au for a variety of reasons) - write a shipping plugin of your own and ALSO give this an option of being called by controller separate to all the regular shipping stuff in Commerce- so that you can then do a bit of fancy JS on the front end to add the result of the controller to the cart totals on your cart page.  That is, fake it totally until late in your checkout when you really do have an address.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of these, I think option 1 is about as far as you want to hack in most situations.  Depending on your checkout flow, and how fancy you want to get with address handling/customer address libraries, this can potentially be a relatively simple fix for the issue.  It works for basic scenarios, you basically just need, on your address input form, to test for the Shipping Quote values for those fields and if those are set, display blank fields for user input.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 2 was where I started and could also work, but it gets fairly fiddly fast and it seems a shame to just abandon all of Commerce's shipping stuff - seemed more future proof to not do it this way, to me.  But in retrospect I'm not sure about that, this may have proved easier than option 3 in the end...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 3 is actually diabolical to get right.  But, it can solve pretty much all the problems.  However, there are MANY complications with it because if you allow a flow back and forth between your cart/shipping/payment pages, there are a bunch of scenarios that arise to do with the possibility that the cart MAY or MAY NOT not have shipping on it, and/or DOES/DOES NOT have coupons, discounts applied - to make it work consistently you have to do stuff like manually summing the lineItem totals etc.  It works, but it's a right mess if you want a really flexible checkout flow - and it's a lot more complicated than it initially looks.  Add to that address handling such as deleting addresses, adding new ones for billing/shipping etc along the way, and you'll end up writing well more JS than you like (well, I have).  Whilst I have it working, I honestly can't recommend it as an approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In retrospect, I wish I had persisted with option 1 as an approach for longer, although it soon gets complicated by the same issues as option 3 really, if you allow back and forth flow between your cart pages (and how can you not?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Oh, and shipping currently doesn't deal with tax, which further complicated getting your totals/tax right with these approaches)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To really solve this area I'd love to see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(The biggie!) Set shipping on the cart without requiring irrelevant&#xA;data at that point like names - shipping should only need what it&#xA;actually needs for each shipping option (including custom plugins).  &lt;/li&gt;&#xA;&lt;li&gt;Some basic address controllers - that are separate from the cart - add/remove (and addresses should be elements with fields etc!)&lt;/li&gt;&#xA;&lt;li&gt;Tax support with shipping&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I wish I could give you a 'this is how you do it' answer but it's really pretty complicated and far from ideal at this point.  If you CAN live without shipping being shown in the cart (and just use e.g. a chart as Luke suggests) - your life will be vastly simpler, that's for sure!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-09-22T11:20:54.740" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16935" PostTypeId="1" CreationDate="2016-09-22T12:26:48.580" Score="1" ViewCount="78" Body="&lt;p&gt;Looking for a way to search (in the CP), for elements where a matrixField is empty or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;em&gt;seems&lt;/em&gt; to work:&#xA;- with matrix rows: &lt;code&gt;myMatrixField::*&lt;/code&gt;&#xA;- without matrix rows: &lt;code&gt;-myMatrixField::*&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this &lt;em&gt;doesn't&lt;/em&gt; work in the event that you have fuzzy enabled by default: &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/support/enabling-fuzzy-search-by-default&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-09-22T12:26:48.580" Title="Search syntax for searching matrix fields (in the CP)" Tags="&lt;matrix&gt;&lt;control-panel&gt;&lt;search&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16936" PostTypeId="1" AcceptedAnswerId="16996" CreationDate="2016-09-22T12:44:12.313" Score="1" ViewCount="602" Body="&lt;p&gt;This question is coming from a complete noob, so pls bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;a href=&quot;https://github.com/ethercreative/simplemap&quot; rel=&quot;nofollow&quot;&gt;SimpleMap plugin&lt;/a&gt; in a Craft site. I am able to install and configure the plugin, create a field, add it to a section etc. I am not sure how to embed the map as shown in CP, into an article on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In short&lt;/strong&gt; How to display the map frontend as it is displayed in the control panel?&lt;/p&gt;&#xA;" OwnerUserId="5634" LastActivityDate="2016-09-27T08:42:35.843" Title="SimpleMap plugin - How to render it on a webpage?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16937" PostTypeId="1" CreationDate="2016-09-22T13:40:51.913" Score="0" ViewCount="82" Body="&lt;p&gt;We needed to use Imagick so that our users could upload &lt;code&gt;.bmp&lt;/code&gt; files to Craft - this works fine, however we noticed this directly stops users downloading PDFs orders from the website and a server errors gets applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone had any similar issues or advice on how to remedy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is our original issue with &lt;code&gt;.bmp&lt;/code&gt; files: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15830/error-uploading-bmp-file-format-gets-rejected&quot;&gt;Error uploading .bmp file format - gets rejected&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-09-22T23:28:45.567" Title="Craft Commerce: Imagick stops PDF order downloads" Tags="&lt;plugin-craftcommerce&gt;&lt;pdf&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16938" PostTypeId="2" ParentId="16905" CreationDate="2016-09-22T13:54:42.033" Score="0" Body="&lt;p&gt;Apparently the solution to my immediate problem is to remove the enviromental part of the database configuration, although it seemed to work for the general configuration just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a little bit unsatisfied by this, however I can finally start playing around with craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a solution for the bug with the environmental database configuration pops up, I'm as glad for it as the next guy.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastEditorUserId="5659" LastEditDate="2016-09-22T14:02:35.190" LastActivityDate="2016-09-22T14:02:35.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16939" PostTypeId="1" AcceptedAnswerId="19163" CreationDate="2016-09-22T16:08:23.053" Score="2" ViewCount="426" Body="&lt;p&gt;Is it possible to output content from previous revisions of entries in the twig templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to do a score comparison between say entry 1 and entry 1.1 to see if the value has increased then output an indicator on the front end to indicate the outcome (Up arrow or down arrow most likely) kind of like a music chart style.&lt;/p&gt;&#xA;" OwnerUserId="5663" LastActivityDate="2018-02-21T23:44:10.737" Title="Display old entry version content through twig?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;entry-versions&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16940" PostTypeId="1" CreationDate="2016-09-22T16:47:00.753" Score="0" ViewCount="110" Body="&lt;p&gt;When i use a &quot;Default&quot; Richtext field - the image button displays and works.&#xA;When i change Default to &quot;Standard&quot; (the out of the box one) the image button does not display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All instructions suggest Craft should be handling this to map asset fields to the richtext field. But it is failing for these - Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="406" LastActivityDate="2016-10-22T23:56:53.373" Title="Richtext Redactor Field - Standard Layout does not show image button" Tags="&lt;redactor&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16941" PostTypeId="2" ParentId="16905" CreationDate="2016-09-22T18:06:35.187" Score="1" Body="&lt;p&gt;You are using &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow&quot;&gt;multi-environment configs&lt;/a&gt; improperly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You &lt;strong&gt;must&lt;/strong&gt; have an environment with the &lt;code&gt;*&lt;/code&gt; key. This is how Craft knows that you are using a multi-environment config. Even if the value is simply an empty array, it must exist.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;code&gt;'*'&lt;/code&gt; array is required to enable Craft’s multi-environment config support, even if you don’t need it. Craft specifically checks for it when deciding whether to enable multi-environment config support or not.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And this is a bit of speculation... but I'd highly recommend having your &lt;code&gt;*&lt;/code&gt; environment as the &lt;em&gt;first&lt;/em&gt; item in the array. I'm not sure if it makes a difference to Craft, but it's at least a bit of a standard.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-22T18:06:35.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16942" PostTypeId="1" AcceptedAnswerId="25759" CreationDate="2016-09-22T18:12:05.970" Score="1" ViewCount="151" Body="&lt;p&gt;In my projects section, each project entry has a Entry field in a Matrix. The Entry field references a tool. On the tool entry page I am trying to display all the projects that use that tool in their Matrix entry field. How do I do that? Currently I use this code but it doesn't display anything. I'm guessing I need to reference the Matrix handle and Entry field handle somehow but I haven't seen it done yet.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedProjects = craft.entries.section('projects').relatedTo(entry) %}&#xA;&#xA;{% for project in relatedProjects %}&#xA;    {{ project.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5501" LastEditDate="2016-09-23T11:01:33.860" LastActivityDate="2018-04-19T14:37:33.217" Title="Find related entries from section entry Matrix entry field" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;sections&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16943" PostTypeId="1" AcceptedAnswerId="16946" CreationDate="2016-09-22T18:13:20.883" Score="2" ViewCount="718" Body="&lt;p&gt;I have a category page that lists all of the entries related to that category. And then I want to display the selected child category for the entry... in brief like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry Title 1&lt;/strong&gt;&lt;br&gt;&#xA;&lt;em&gt;Entry 1's Child-Category&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry Title 2&lt;/strong&gt;&lt;br&gt;&#xA;&lt;em&gt;Entry 2's Child-Category&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entry Title 3&lt;/strong&gt;&lt;br&gt;&#xA;&lt;em&gt;Entry 3's Child-Category&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My category field handle is &lt;code&gt;chooseLocation&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have in my template:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16328/how-do-i-output-all-field-values-from-a-category-on-the-current-entry&quot;&gt;(snippet taken from here)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% if entry.chooseLocation | length %}&#xA;    {% for category in entry.chooseLocation %}&#xA;         &amp;lt;a href=&quot;/location/{{ category.slug }}&quot;&amp;gt;{{ category }}&amp;lt;/a&amp;gt;&#xA;            {% if not loop.last %}, {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, this get's the parent category (which is the category page we're on) but not the &lt;em&gt;child&lt;/em&gt; category. I need to show just the child category and not the parent.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked through the docs but I can't find anything on how to do this.&lt;/p&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-22T18:43:45.063" Title="How can I get an entry's child category, and not the parent category?" Tags="&lt;categories&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16945" PostTypeId="2" ParentId="16917" CreationDate="2016-09-22T18:25:49.390" Score="2" Body="&lt;p&gt;The issue was that the custom short name I was using (in this case the development domain) was not associated with the bitly account.  Total oversight! I've removed that and it works perfectly.&lt;/p&gt;&#xA;" OwnerUserId="2201" LastActivityDate="2016-09-22T18:25:49.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16946" PostTypeId="2" ParentId="16943" CreationDate="2016-09-22T18:43:45.063" Score="3" Body="&lt;p&gt;Your Categories field (&lt;code&gt;entry.chooseLocation&lt;/code&gt;) is an &lt;strong&gt;Element Criteria Model&lt;/strong&gt;. It's exactly the same as if you'd done something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.group('myGroup')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Element Criteria Model (ECM) is an important concept in Craft, because it's the driver for &lt;em&gt;most&lt;/em&gt; content handling. Once you've got a bearing on what the ECM is, you can use it fairly consistently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, just like &lt;code&gt;craft.entries&lt;/code&gt;, you can apply &lt;code&gt;.find&lt;/code&gt;, &lt;code&gt;.first&lt;/code&gt;, and &lt;a href=&quot;https://craftcms.stackexchange.com/a/16070/45&quot;&gt;other methods&lt;/a&gt; to retrieve a specific subset of elements. And depending on the element type, you can chain other filtering methods in between...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.group('myGroup').limit(3).find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returning to your question, &lt;code&gt;entry.chooseLocation&lt;/code&gt; will be an ECM for Categories. So it's just a matter of filtering it appropriately.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.chooseLocation.level(2).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;full list of filtering options&lt;/a&gt; you can use on a Categories ECM.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-22T18:43:45.063" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16948" PostTypeId="2" ParentId="16939" CreationDate="2016-09-22T23:35:46.393" Score="1" Body="&lt;p&gt;Probably something very similar to what Craft does when displaying past entry revisions from a template in the control panel. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/templates/entries/_revisions.html#L23-L36&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/templates/entries/_revisions.html#L23-L36&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if section.enableVersioning %}&#xA;    {% set versions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}&#xA;    {% if versions %}&#xA;        &amp;lt;h6&amp;gt;{{ &quot;Recent Versions&quot;|t }}&amp;lt;/h6&amp;gt;&#xA;        &amp;lt;ul class=&quot;padded&quot;&amp;gt;&#xA;            {% for version in versions %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a{% if entry.getClassHandle() == 'EntryVersion' and version.versionId == versionId %} class=&quot;sel&quot;{% endif %} href=&quot;{{ url(baseUrl~'versions/'~version.versionId) }}&quot;&amp;gt;&#xA;                    {{ &quot;Version {num}&quot;|t({ num: version.num }) }}&#xA;                    &amp;lt;span class=&quot;light&quot;&amp;gt;{{ version.dateCreated.uiTimestamp() }}, {{ version.creator }}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-02-21T23:44:10.737" LastActivityDate="2018-02-21T23:44:10.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16949" PostTypeId="2" ParentId="16940" CreationDate="2016-09-22T23:37:54.813" Score="1" Body="&lt;p&gt;Tested and it works fine for me locally with the stock &lt;code&gt;Standard.json&lt;/code&gt; config of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;    plugins: ['fullscreen','video'],&#xA;    toolbarFixed: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd make sure you don't have any other plugins installed that might be interfering and that you've actually got the &lt;code&gt;'image'&lt;/code&gt; value listed under your &lt;code&gt;buttons:&lt;/code&gt; key.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-22T23:37:54.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16950" PostTypeId="2" ParentId="16912" CreationDate="2016-09-23T00:00:09.633" Score="2" Body="&lt;p&gt;I think you've just got a logic problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entryStart &amp;gt;= present and entryEnd &amp;lt;= present %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only way this will ever evaluate to &lt;code&gt;true&lt;/code&gt; is if the &lt;code&gt;entryStart&lt;/code&gt; and &lt;code&gt;entryEnd&lt;/code&gt; DateTime fields have the exact same date and time (down to the second) that the present time is, which seems like a very small window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're essentially looking for an entry that lives in the future &lt;em&gt;and&lt;/em&gt; in the past.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-23T00:00:09.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16951" PostTypeId="1" AcceptedAnswerId="16954" CreationDate="2016-09-23T00:27:08.643" Score="1" ViewCount="48" Body="&lt;p&gt;Is there an alternate event for &lt;code&gt;onBeforePerformAction&lt;/code&gt;? I want to handle an &lt;code&gt;onDeleteEntry&lt;/code&gt;, but apparently that doesn't work on a bulk delete (deleting from the check boxes).&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="57" LastEditDate="2016-09-23T23:41:23.157" LastActivityDate="2016-09-23T23:41:23.157" Title="'onBeforePerformAction' alternative for craft 2.4.0?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16952" PostTypeId="2" ParentId="16925" CreationDate="2016-09-23T01:13:30.047" Score="3" Body="&lt;p&gt;For those who find this, After some more digging into Redactor, looks like Craft overrides the original button to accommodate for sources and transforms in &lt;code&gt;RichTextInput.js&lt;/code&gt; at  &lt;code&gt;onImageButtonClick&lt;/code&gt; - line 261.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;onImageButtonClick: function()&#xA;{&#xA;    this.redactor.selection.save();&#xA;&#xA;    if (typeof this.assetSelectionModal == 'undefined')&#xA;    {&#xA;        this.assetSelectionModal = Craft.createElementSelectorModal('Asset', {&#xA;            storageKey: 'RichTextFieldType.ChooseImage',&#xA;            multiSelect: true,&#xA;            sources: this.assetSources,&#xA;            criteria: { locale: this.elementLocale, kind: 'image' },&#xA;            onSelect: $.proxy(function(assets, transform)&#xA;            {&#xA;                if (assets.length)&#xA;                {&#xA;                    this.redactor.selection.restore();&#xA;                    for (var i = 0; i &amp;lt; assets.length; i++)&#xA;                    {&#xA;                        var asset = assets[i],&#xA;                            url   = asset.url+'#asset:'+asset.id;&#xA;&#xA;                        if (transform)&#xA;                        {&#xA;                            url += ':'+transform;&#xA;                        }&#xA;&#xA;                        this.redactor.insert.node($('&amp;lt;img src=&quot;'+url+'&quot; /&amp;gt;')[0]);&#xA;                        this.redactor.code.sync();&#xA;                    }&#xA;                    this.redactor.observe.images();&#xA;                }&#xA;            }, this),&#xA;            closeOtherModals: false,&#xA;            transforms: this.transforms&#xA;        });&#xA;    }&#xA;    else&#xA;    {&#xA;        this.assetSelectionModal.show();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ended up using &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon Twig filters plugin&lt;/a&gt; to add the class: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconAttr('img', {class: 'img-responsive'}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastEditorUserId="1098" LastEditDate="2016-09-23T05:28:13.543" LastActivityDate="2016-09-23T05:28:13.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16953" PostTypeId="1" AcceptedAnswerId="16961" CreationDate="2016-09-23T01:48:27.360" Score="1" ViewCount="185" Body="&lt;p&gt;I would like to set up Postmaster or Sprout Email to send an e-mail notification when a new entry is added. I only want the email sent to users who are linked to the entry via a custom field (type:user).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've having trouble solving this without writing a plugin to extend either plugin. If I have to write a plugin to do this, any tips? Otherwise, how can I do this with either plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reiterate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I have notifications sent only to users who are linked to the new entry via a custom field (type:user)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5609" LastEditorUserId="4466" LastEditDate="2016-09-23T09:48:55.400" LastActivityDate="2016-09-23T15:54:04.377" Title="Send e-mail only to users related to entry with Postmaster/Sprout" Tags="&lt;plugins&gt;&lt;emails&gt;&lt;plugin-sproutemail&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16954" PostTypeId="2" ParentId="16951" CreationDate="2016-09-23T05:33:07.130" Score="4" Body="&lt;p&gt;No, there isn't. That's why &lt;code&gt;onBeforePerformAction&lt;/code&gt; was introduced in &lt;a href=&quot;https://craftcms.com/changelog#build2750&quot; rel=&quot;nofollow&quot;&gt;2.5&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would &lt;strong&gt;highly&lt;/strong&gt; recommend that you update Craft to the latest version (&lt;a href=&quot;https://craftcms.com/changelog#build2944&quot; rel=&quot;nofollow&quot;&gt;2.6.2944&lt;/a&gt;). In addition to all of the cool features that you are missing out on, there was also a &lt;strong&gt;critical security update&lt;/strong&gt; released in &lt;a href=&quot;https://craftcms.com/changelog#build2791&quot; rel=&quot;nofollow&quot;&gt;2.6.2791&lt;/a&gt;. Without that update, you may be leaving sensitive data exposed.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-23T05:33:07.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16955" PostTypeId="1" CreationDate="2016-09-23T07:16:07.340" Score="1" ViewCount="340" Body="&lt;p&gt;The issue I am experiencing is very similar to the one described here: &lt;a href=&quot;https://craftcms.com/support/missing-cp-css-js&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.  The fix described there does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what happens when I request a resource from that page directly using curl:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ curl -v 'http://localhost/admin/resources/js/craft.js?d=1474612391'&#xA;*   Trying ::1...&#xA;* Connected to localhost (::1) port 80 (#0)&#xA;&amp;gt; GET /admin/resources/js/craft.js?d=1474612391 HTTP/1.1&#xA;&amp;gt; Host: localhost&#xA;&amp;gt; User-Agent: curl/7.47.0&#xA;&amp;gt; Accept: */*&#xA;&amp;gt; &#xA;&amp;lt; HTTP/1.1 200 OK&#xA;&amp;lt; Server: nginx&#xA;&amp;lt; Date: Fri, 23 Sep 2016 07:07:59 GMT&#xA;&amp;lt; Content-Type: application/javascript; charset=utf-8&#xA;&amp;lt; Transfer-Encoding: chunked&#xA;&amp;lt; Connection: keep-alive&#xA;&amp;lt; Vary: Accept-Encoding&#xA;&amp;lt; X-Powered-By: PHP/7.0.8-0ubuntu0.16.04.2&#xA;&amp;lt; Content-Disposition: attachment; filename=&quot;craft.js&quot;&#xA;&amp;lt; X-Sendfile: [CENSORED]/craft/app/resources/js/compressed/craft.js&#xA;&amp;lt; &#xA;* Connection #0 to host localhost left intact&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is some version info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Linux: 16.04 LTS (Xenial Xerus)&lt;/li&gt;&#xA;&lt;li&gt;PHP: 7.0.8-0ubuntu0.16.04.2&lt;/li&gt;&#xA;&lt;li&gt;nginx: 1.10.0&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is a &lt;a href=&quot;https://gist.github.com/kenzie/5811327&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; to my nginx config (approximately).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of what the page looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3nDJ1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3nDJ1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5664" LastEditorUserId="5665" LastEditDate="2016-09-23T16:28:13.220" LastActivityDate="2016-09-28T04:50:46.530" Title="Missing CSS/JS in the Control Panel" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16956" PostTypeId="1" AcceptedAnswerId="16982" CreationDate="2016-09-23T08:10:21.090" Score="1" ViewCount="97" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&quot; rel=&quot;nofollow&quot;&gt;FormBuilder plugin&lt;/a&gt; and I want users to be able to fill in a form. If they abandon the form without completing it or submitting it, I want the form to be saved and when they login and return to the form I want the user to be able to continue where they left off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am fairly new to Craft CMS and Twig so I don't know where to start with this or if this is even possible in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="57" LastEditDate="2016-09-23T23:43:19.630" LastActivityDate="2016-09-26T08:39:17.997" Title="Save the form if not complete and come back another time to complete the form" Tags="&lt;form&gt;&lt;ajax&gt;&lt;user-profile&gt;&lt;plugin-formbuilder2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16958" PostTypeId="1" AcceptedAnswerId="16965" CreationDate="2016-09-23T08:52:27.613" Score="1" ViewCount="99" Body="&lt;p&gt;A little question , does anybody have or know someone with a plugin for Craft which can show Offie365 files/docs in Craft to use on an intranet/site?&#xA;Just like the feature below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assets are files managed by Craft. They live in “asset sources”, which represent physical folders on your server. And with Craft Pro, you can also set up Asset Sources that live on Amazon S3, Rackspace Cloud, and Google Cloud.&lt;/p&gt;&#xA;" OwnerUserId="5497" LastActivityDate="2016-09-23T17:14:36.947" Title="office365 onedrive to use with assets" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16960" PostTypeId="1" CreationDate="2016-09-23T09:37:20.523" Score="1" ViewCount="168" Body="&lt;p&gt;I'm getting a &lt;code&gt;nn&lt;/code&gt; string when I just click on HTML (code mirror),&#xA;is there a bug from redactor ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have put in hide function of Redactor these lines of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;code = code.replace('nn&amp;lt;/p&amp;gt;', &quot;&amp;lt;/p&amp;gt;&quot;);&#xA;code = code.replace('&amp;lt;p&amp;gt;n&amp;lt;span', &quot;&amp;lt;p&amp;gt;&amp;lt;span&quot;);&#xA;code = code.replace('&amp;lt;/span&amp;gt;nn&amp;lt;p', &quot;&amp;lt;/span&amp;gt;&amp;lt;p&quot;);&#xA;code = code.replace('&amp;lt;p&amp;gt;n&amp;lt;/p&amp;gt;', &quot;&quot;);&#xA;code = code.replace('&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/p&amp;gt;', &quot;&quot;);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there another solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5646" LastEditorUserId="57" LastEditDate="2016-09-23T23:46:45.463" LastActivityDate="2016-09-26T17:06:20.227" Title="Redactor 2 integration with code mirror" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16961" PostTypeId="2" ParentId="16953" CreationDate="2016-09-23T09:48:28.753" Score="1" Body="&lt;p&gt;If I'm correct in thinking that you want users who have been added to a relation field on an entry to receive an email, then the following will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have to write a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt; to listen for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onSaveEntry&lt;/a&gt; event. You can then loop through any users added to the custom field of the entry and send them an email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code would look something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'entries.onSaveEntry', function( Event $event ){&#xA;&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    // The users field returns user id's&#xA;    $userIds = $entry-&amp;gt;getContent()-&amp;gt;users;&#xA;&#xA;    // Grab the user models using the id's from the entry field&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria( ElementType::User );&#xA;    $criteria-&amp;gt;id = $userIds;&#xA;    $users = $criteria-&amp;gt;find();&#xA;&#xA;    // If we have users&#xA;    if ( $users ){&#xA;        // For each user&#xA;        foreach ( $users as $user ){&#xA;            // Builds and sents the email&#xA;            $email = new EmailModel();&#xA;            $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;            $email-&amp;gt;subject = &quot;You've been added to an entry&quot;;&#xA;            // Use this for a plain text email body&#xA;            $email-&amp;gt;body = '';&#xA;            // This uses a html body from a twig template, you can pass the entry to it to access the entries fields&#xA;            $email-&amp;gt;htmlBody = craft()-&amp;gt;templates-&amp;gt;render( 'pluginname/_emails/email-template-name', array(&#xA;                'entry' =&amp;gt; $entry&#xA;            ) );&#xA;            craft()-&amp;gt;email-&amp;gt;sendEmail( $email );&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-09-23T09:48:28.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16962" PostTypeId="1" CreationDate="2016-09-23T14:05:39.953" Score="2" ViewCount="50" Body="&lt;p&gt;A bit of an extension of my previous query at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16658/auto-login-on-account-activation&quot;&gt;Auto-login on account activation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to a user to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;automatically login on account activation, and &lt;/li&gt;&#xA;&lt;li&gt;be redirected to a predetermined page on account activation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks to @steverowling managed to do the former using his autologin plugin(&lt;a href=&quot;https://github.com/steverowling/autologin&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;). However struggling with the latter. I can't see how to specify the redirect location and on activation/login the user is always redirected to the site homepage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to specify a redirect destination in conjunction with the above functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-09-28T08:29:49.490" Title="Autologin destination" Tags="&lt;users&gt;&lt;login&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16963" PostTypeId="2" ParentId="16953" CreationDate="2016-09-23T15:54:04.377" Score="1" Body="&lt;p&gt;You can do this in Sprout Email by creating a &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events&quot; rel=&quot;nofollow&quot;&gt;Custom Event Integration&lt;/a&gt;. I'm not familiar with Postmaster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Sprout Email comes with a &lt;em&gt;When an Entry is Saved&lt;/em&gt; event, it's not going to work for you because the Users field submits data via User IDs to create the relations and you can't create a list of recipients from the IDs along, before some extra processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a new Custom Event which uses &lt;code&gt;SproutEmail_EntriesSaveEntryEvent&lt;/code&gt; as a starting point. The &lt;code&gt;SproutEmail_EntriesSaveEntryEvent&lt;/code&gt; can be found at &lt;code&gt;sproutemail/integrations/sproutemail/SproutEmail_EntriesSaveEntryEvent.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a Custom Event you can customize what options are available to the Event, or just make bold assumptions based on the way you plan to be using the Event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you'll want to update the &lt;code&gt;prepareParams&lt;/code&gt; method to find your user field and process it to get the user emails you need, and then return the list of emails as an array in the event object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepareParams(Event $event)&#xA;{&#xA;    // Process your User Field and get your emails&#xA;    $userEmails =&amp;gt; $this-&amp;gt;processUsersFieldIdsIntoEmails($event-&amp;gt;params['entry']);&#xA;&#xA;    return array(&#xA;        'value' =&amp;gt; array(&#xA;          'userEmails' =&amp;gt; $userEmails&#xA;        ),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your dynamic event object as specified by the &lt;code&gt;value&lt;/code&gt; parameter becomes available to your Sprout Email using Craft's object syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then use this value in the Recipients field of your Notification Email :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.userEmails|join(',') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Syntax may vary depending on how you choose to hand back your list of emails, and any other variables you may want to exist in the dynamic object to use throughout your email.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-23T15:54:04.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16964" PostTypeId="1" AcceptedAnswerId="16973" CreationDate="2016-09-23T16:54:42.410" Score="3" ViewCount="104" Body="&lt;p&gt;I have a front end form which contains text fields that are connected to a Craft table field.  The issue I have is that if I do not fill out the text input fields on the front end it is still creating table rows in the Craft entry.  When I looked in the database, I can see that even though I'm not filling out the text input fields in the form, it is still submitting information. This is what is being submitted when the text input field not being filled out: &lt;code&gt;[{&quot;col1&quot;:&quot;&quot;,&quot;col2&quot;:&quot;&quot;},{&quot;col1&quot;:&quot;&quot;,&quot;col2&quot;:&quot;&quot;}]&lt;/code&gt; My guess is that I have something incorrect in how I'm coding the text input field in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; Is there a way to either prevent the table row from getting added if the text input field is empty on the front end form?  If not, is there a way that I can use code on the summary template page where the images would be displayed on the front end to filter out any table rows that have no content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's a screenshot of the form input:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nzrz3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nzrz3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's my input form code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;stillImages1&quot; class=&quot;field-label&quot;&amp;gt;Still Image 1&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;section&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;frm-row&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot; class=&quot;field prepend-icon&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;url&quot; name=&quot;fields[logReviewer_feedbackStillImages][0][col1]&quot; class=&quot;gui-input&quot; placeholder=&quot;Paste image 1 link&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;field-icon&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-image&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;  &#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- end frm-row --&amp;gt;&#xA;        &amp;lt;br /&amp;gt;&#xA;        &amp;lt;div class=&quot;frm-row&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot; class=&quot;field prepend-icon&quot;&amp;gt;&#xA;                &amp;lt;textarea class=&quot;gui-textarea&quot; name=&quot;fields[logReviewer_feedbackStillImages][0][col2]&quot; placeholder=&quot;Type image 1 comments&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;span class=&quot;field-icon&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-comments&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;  &#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- end frm-row --&amp;gt;                                          &#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- end section --&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;stillImages2&quot; class=&quot;field-label&quot;&amp;gt;Still Image 2&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;section&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;frm-row&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot; class=&quot;field prepend-icon&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;url&quot; name=&quot;fields[logReviewer_feedbackStillImages][1][col1]&quot; class=&quot;gui-input&quot; placeholder=&quot;Paste image 2 link&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;field-icon&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-image&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;  &#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- end frm-row --&amp;gt;&#xA;        &amp;lt;br /&amp;gt;&#xA;        &amp;lt;div class=&quot;frm-row&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot; class=&quot;field prepend-icon&quot;&amp;gt;&#xA;                &amp;lt;textarea class=&quot;gui-textarea&quot; name=&quot;fields[logReviewer_feedbackStillImages][1][col2]&quot; placeholder=&quot;Type image 2 comments&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;                &amp;lt;span class=&quot;field-icon&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-comments&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;  &#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- end frm-row --&amp;gt;                                           &#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- end section --&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's a screenshot of the table field in Craft.  Even if I don't actually enter text in the text fields in the form, 2 table rows are created in the entry as shown in this screenshot below.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1BJRO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1BJRO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's my code to display images if they were submitted.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.logReviewer_feedbackStillImages|length %}&#xA;&#xA;    &amp;lt;div class=&quot;c-margin-b-40 &quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;c-content-divider c-icon-bg c-bg-blue-3&quot;&amp;gt;&#xA;            &amp;lt;i class=&quot;icon-picture c-rounded c-bg-blue-3 c-font-white&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;c-body&quot;&amp;gt;&#xA;        {% for row in entry.logReviewer_feedbackStillImages %}&#xA;&#xA;            &amp;lt;div class=&quot;c-margin-b-80&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;cl-feedbackText c-center c-margin-b-30&quot;&amp;gt;{{ row.comment|ucfirst }}&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;embed-responsive embed-responsive-4by3 c-center c-margin-b-50&quot;&amp;gt;&#xA;                    &amp;lt;img class=&quot;embed-responsive-item&quot; src=&quot;{{ row.droplrImageLink }}+&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-09-24T21:12:42.390" Title="How do I prevent empty table rows from being created when a front end form is submitted?" Tags="&lt;templating&gt;&lt;form&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16965" PostTypeId="2" ParentId="16958" CreationDate="2016-09-23T17:14:36.947" Score="3" Body="&lt;p&gt;This will be possible in Craft 3, when the concept of &quot;Assets&quot; will get converted into &quot;Volumes&quot;. Unlike Craft 2, it will be possible to create a custom Volume with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware though, everything you're describing will require a custom plugin. At this point, no such plugin exists.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-23T17:14:36.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16966" PostTypeId="1" AcceptedAnswerId="16967" CreationDate="2016-09-23T20:26:03.707" Score="2" ViewCount="232" Body="&lt;p&gt;Is there a way to partially match text in a URL segment? I would like to conditionally show code if the text &quot;vascular&quot; is in Segment 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my URL is: &lt;code&gt;https://website.com/segment1/segment2/10009-vascular-access&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've tried so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(3) == 'vascular' %}&#xA;&#xA;{% if craft.request.getSegment(3).contains(&quot;vascular&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-09-23T20:35:07.213" Title="Partial match in URL getSegment()" Tags="&lt;url&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16967" PostTypeId="2" ParentId="16966" CreationDate="2016-09-23T20:35:07.213" Score="2" Body="&lt;p&gt;You should be able to utilize twig's built-in containment operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'vascular' in craft.request.getSegment(3) %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is official documentation on the containment operator: &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#containment-operator&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/templates.html#containment-operator&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5570" LastActivityDate="2016-09-23T20:35:07.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16968" PostTypeId="1" CreationDate="2016-09-24T02:37:19.963" Score="2" ViewCount="98" Body="&lt;p&gt;I am displaying inputs on the front-end of my form that are populating a matrix within the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall everything is working fine. The problem I am having is validation. I've got the field marked as required, but it seems leaving the fields empty still passes validation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    ....&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myMatrix][new1][type]&quot; value=&quot;myField&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myMatrix][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    ...&#xA;&#xA;    {{ account is defined and account ? errorList(account.getErrors('myMatrix')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whenever I comment these fields out, I get the validation message that the field is required. I believe it has something to do with those hidden input(s) a value. But, if I take those out, the fields do not populate the input in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I show the fields on the front-end and still show the error message? &lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-09-24T02:37:19.963" Title="How can I validate/make a matrix field required on the front-end?" Tags="&lt;matrix&gt;&lt;frontend&gt;&lt;registration&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16969" PostTypeId="1" CreationDate="2016-09-24T11:33:02.027" Score="1" ViewCount="61" Body="&lt;p&gt;Here's a sample of a matrix block:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/i5BAg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i5BAg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have my own fields inside the block and retain the basic functionalities like Collapse, Disable, etc. Basically, just use the Matrix block UI without using the Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2016-09-26T05:04:14.020" Title="How can my plugin render a generic Matrix block in the Control Panel?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16970" PostTypeId="1" AcceptedAnswerId="16974" CreationDate="2016-09-24T14:45:34.973" Score="2" ViewCount="68" Body="&lt;p&gt;The Rails cli has a &lt;a href=&quot;http://guides.rubyonrails.org/command_line.html#rails-runner&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;runner&lt;/code&gt;&lt;/a&gt; feature that allows you to run a file (or a string of code) from the command line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. &lt;code&gt;rails runner my-script.rb&lt;/code&gt; (where &lt;code&gt;my-script.rb&lt;/code&gt; will run in the context of a fully bootstrapped Rails application). It's a fantastic way to write scripts/backfills/etc without needing to alter your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that craft includes&lt;code&gt;yiic&lt;/code&gt; but it seems to be focused on migrations or code generation and not necessarily providing the same bootstrapped playground.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to give an arbitrary script access to a bootstrapped craft application? My specific use case is that I want access to models and plugins to be able to migrate fields from one event plugin to another (this is actual content, not just a schema migration). &lt;/p&gt;&#xA;" OwnerUserId="762" LastEditorUserId="57" LastEditDate="2016-09-25T03:54:43.510" LastActivityDate="2016-09-25T03:54:43.510" Title="Craft equivalent to Rails runner" Tags="&lt;database&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16971" PostTypeId="1" AcceptedAnswerId="32670" CreationDate="2016-09-24T15:40:47.930" Score="2" ViewCount="263" Body="&lt;p&gt;I am building a plugin that grants access to a &quot;hidden&quot; (for lack of better words) entry. if a user has purchased a specific product &lt;em&gt;type&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I don't care which piece of clothing the user purchases, just as long as it was of type clothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I check the users order history to see if they have purchased a qualifying product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-09-25T13:37:17.343" LastActivityDate="2019-10-01T23:26:04.003" Title="Commerce: How can I check order history to see if a product type has been purchased?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16972" PostTypeId="2" ParentId="16971" CreationDate="2016-09-24T15:54:10.670" Score="4" Body="&lt;p&gt;First you'll need to grab the user's orders. Then you can check the product type through the purchasable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orders = craft.commerce.orders.user(currentUser).find() %}&#xA;&#xA;{% if orders|length %}&#xA;    {% for order in orders %}&#xA;        {% for lineItem in order.lineItems %}&#xA;            {{ lineItem.purchasable.product.typeId }} {# 1 #}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can take that a step further by doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orders = craft.commerce.orders.user(currentUser).find() %}&#xA;{% set product = false %} {# set the condition to false by default. #}&#xA;&#xA;{% if orders|length %}&#xA;    {% for order in orders %}&#xA;        {% for lineItem in order.lineItems if lineItem.purchasable.product.typeId == 1 %}&#xA;            {% set product = true %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {# No orders found. #}&#xA;{% endif %}&#xA;&#xA;...&#xA;&#xA;{% if product %}&#xA;    {# User has purchased product type at some point in time. #}&#xA;{% else %}&#xA;    {# User has never purchased product type. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-09-24T18:15:44.200" LastActivityDate="2016-09-24T18:15:44.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16973" PostTypeId="2" ParentId="16964" CreationDate="2016-09-24T21:12:42.390" Score="3" Body="&lt;p&gt;I figured out a solution.  When I looked in the database I could see &lt;code&gt;{&quot;col1&quot;:&quot;&quot;,&quot;col2&quot;:&quot;&quot;}&lt;/code&gt; in the content even though the user didn't enter any content in the front end text form field.  I couldn't figure out how to prevent the form from sending a value even if the field was empty, therefore, I added a conditional to the template page which displays the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My conditional filters out any table rows that has a value of &lt;code&gt;&quot;&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if row.col1 != &quot;&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also added a conditional so my divider graphic either doesn't show (if all rows are &lt;code&gt;&quot;&quot;&lt;/code&gt;) or just once if any of the rows have user submitted content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if row.col1 != &quot;&quot; and loop.first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's my new code to display images if they were submitted.:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.logReviewer_feedbackStillImages %}&#xA;    {% for row in entry.logReviewer_feedbackStillImages %}&#xA;        {% if row.col1 != &quot;&quot; and loop.first %}&#xA;            &amp;lt;div class=&quot;c-margin-b-40 &quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-content-divider c-icon-bg c-bg-blue-3&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;icon-picture c-rounded c-bg-blue-3 c-font-white&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;div class=&quot;c-body&quot;&amp;gt;&#xA;        {% for row in entry.logReviewer_feedbackStillImages %}&#xA;            {% if row.col1 != &quot;&quot; %}&#xA;            &amp;lt;div class=&quot;c-margin-b-80&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;cl-feedbackText c-center c-margin-b-30&quot;&amp;gt;{{ row.comment|ucfirst }}&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;embed-responsive embed-responsive-4by3 c-center c-margin-b-50&quot;&amp;gt;&#xA;                    &amp;lt;img class=&quot;embed-responsive-item&quot; src=&quot;{{ row.droplrImageLink }}+&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-09-24T21:12:42.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16974" PostTypeId="2" ParentId="16970" CreationDate="2016-09-25T03:53:42.373" Score="2" Body="&lt;p&gt;Maybe you're just looking for a bootstrapped Craft instance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require '/path/to/craft/app/bootstrap.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there you'll have access to the Craft instance as usual:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft-&amp;gt;entries-&amp;gt;saveEntry();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Along with your models, records, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-25T03:53:42.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16975" PostTypeId="1" CreationDate="2016-09-25T13:29:48.253" Score="8" ViewCount="1340" Body="&lt;p&gt;I am building a plugin in Craft, I want to use the Element Types, the documentation seems so hard to grasp. Can you give an example or a template code?&lt;/p&gt;&#xA;" OwnerUserId="5675" LastEditorUserId="57" LastEditDate="2016-09-25T16:55:04.360" LastActivityDate="2016-09-25T21:25:04.700" Title="How to make use of Element Types" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16976" PostTypeId="2" ParentId="16975" CreationDate="2016-09-25T14:25:58.523" Score="10" Body="&lt;p&gt;Element Types are powerful and there are probably too many possible implementations to give a very meaningful example without additional information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a couple resources beyond the docs that could help you get started:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/articles/master-the-element-types-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Master the Elements&lt;/a&gt; - A comparison of all native Craft CMS Element Types and what makes them unique.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/events/introduction-to-element-types-in-craft-cms-part-1-of-3&quot; rel=&quot;noreferrer&quot;&gt;Introduction to Element Types in Craft CMS&lt;/a&gt; - In this Hangout Brandon Kelly walks through a lot of details about Element Types. There are also a couple of other related videos you can find in the resources section here: &lt;a href=&quot;https://straightupcraft.com/articles/getting-started-with-plugin-development-for-craft-cms#tutorials-and-other-resources&quot; rel=&quot;noreferrer&quot;&gt;Getting Started with Plugin Development for Craft CMS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/Events&quot; rel=&quot;noreferrer&quot;&gt;Events Sample Plugin&lt;/a&gt; - Example plugin that demonstrates how Craft plugins can take advantage of Craft’s Element Type APIs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd recommend taking a close look at the &lt;code&gt;ElementType&lt;/code&gt; Class and related Element Type &lt;code&gt;Model&lt;/code&gt; Class for each of the native Elements in Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset&lt;/li&gt;&#xA;&lt;li&gt;Category&lt;/li&gt;&#xA;&lt;li&gt;Entry&lt;/li&gt;&#xA;&lt;li&gt;Global Set&lt;/li&gt;&#xA;&lt;li&gt;Matrix Block&lt;/li&gt;&#xA;&lt;li&gt;Tag&lt;/li&gt;&#xA;&lt;li&gt;User&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each Element implements the API slightly differently and understanding those differences will help you make sense of what you may need to include in your Element, or where you can piggy back on existing behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also several plugins that use Elements. Each implementation is fairly custom, so which examples will work best for you are hard to say. Off the top of my head, there are plenty of examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Commerce_Product Element&lt;/li&gt;&#xA;&lt;li&gt;Commerce_Order Element&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sprout Plugins:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SproutForms_Form Element (Sprout Forms)&lt;/li&gt;&#xA;&lt;li&gt;SproutForms_Entry Element (Sprout Forms)&lt;/li&gt;&#xA;&lt;li&gt;SproutEmail_NotificationEmail Element (Sprout Email)&lt;/li&gt;&#xA;&lt;li&gt;SproutEmail_CampaignEmail Element (Sprout Email)&lt;/li&gt;&#xA;&lt;li&gt;SproutEmail_SentEmail Element (Sprout Email)&lt;/li&gt;&#xA;&lt;li&gt;SproutSeo_Redirect Element (Sprout SEO)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A few others (if anybody would like to share others in the comments, happy to add them to the list)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Neo_Block Element (Neo)&lt;/li&gt;&#xA;&lt;li&gt;SuperTable_Block Element (Super Table)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-09-25T21:25:04.700" LastActivityDate="2016-09-25T21:25:04.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16979" PostTypeId="1" CreationDate="2016-09-26T00:21:12.193" Score="1" ViewCount="59" Body="&lt;p&gt;I have an article called Main Article and I am rolling out the chapters each week (8x). So, each chapter will have the MAIN Article Title AND Chapter Title.&#xA;eg: Stories from the top of the World; The Journey of the arborists&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stories from the top of the World; The way to the top&#xA;etc, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could create the MAIN Article as a single entry (with an excerpt) but this is not the brief from the client and use a relationship field to add the chapters to the Main Article Title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could add the Main Article title as a category and select this at each chapter entry, but how do I create the URL format to do this? This might also be tough to explain as a workflow for the client....&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles/{category}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What else are the options?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="437" LastEditDate="2016-09-26T13:07:24.770" LastActivityDate="2016-09-26T13:07:24.770" Title="Using the same title" Tags="&lt;routes&gt;&lt;routing&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16980" PostTypeId="2" ParentId="16979" CreationDate="2016-09-26T02:10:32.893" Score="2" Body="&lt;p&gt;You can set the URL format to be anything you want really, just setup your templates and then setup some routes; then it's all going to work automatic for your client and they never have to worry about it.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-09-26T02:10:32.893" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16981" PostTypeId="2" ParentId="16969" CreationDate="2016-09-26T05:04:14.020" Score="2" Body="&lt;p&gt;I was able to pull this off by referencing &lt;strong&gt;MatrixInput.js&lt;/strong&gt; and &lt;strong&gt;/_components/fieldtypes/Matrix/input.html&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iveQ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iveQ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2016-09-26T05:04:14.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16982" PostTypeId="2" ParentId="16956" CreationDate="2016-09-26T08:39:17.997" Score="2" Body="&lt;p&gt;The FormBuilder plugin has no option to edit a submitted form. I think the best way is to use a channel in Craft CMS and write your own form. You can find the documentation on how to create/edit entries in frontend here: &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-09-26T08:39:17.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16983" PostTypeId="1" CreationDate="2016-09-26T09:59:34.037" Score="2" ViewCount="796" Body="&lt;p&gt;My company would use the current version of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Content_Security_Policy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content-Security-Policy&lt;/a&gt; header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have problems with inline JavaScript and would not use MD5 checksums with the policy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CSRF Token support&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the login.html template&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/templates/login.html#L15&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/templates/login.html#L15&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Maybe other source code files&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both the CSRF suggestion and the login implementation uses inline javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exist best practices to solve the problems?&#xA;Without ESI how could I include the CSRF token in a separate Javascript file (access the Craft environment variables)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add the header only for none CP requests?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5667" LastEditorUserId="57" LastEditDate="2018-02-21T23:43:43.257" LastActivityDate="2018-02-21T23:43:43.257" Title="Content-Security-Policy Header vs. CSRF Token and login.html" Tags="&lt;javascript&gt;&lt;security&gt;&lt;html-entities&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16984" PostTypeId="1" CreationDate="2016-09-26T12:40:16.983" Score="1" ViewCount="271" Body="&lt;p&gt;I have a Matrix with a block for a contact form. I have a field for the email recipients. But the output doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I render/output the output a tag within another tag, like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;toEmail&quot; value=&quot;{{ '{{item.mailto}}'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="57" LastEditDate="2016-09-26T18:49:21.263" LastActivityDate="2016-09-26T18:49:21.263" Title="Output a Twig tag within another Twig tag" Tags="&lt;templating&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16985" PostTypeId="2" ParentId="16984" CreationDate="2016-09-26T13:16:32.740" Score="3" Body="&lt;p&gt;You are hashing the string &lt;code&gt;'{{item.mailto}}'&lt;/code&gt;. There shouldn't be any need for the quotes or second set of curly braces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig does not permit curly braces inside curly braces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;{{ item.mailto|hash }}&lt;/code&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2016-09-26T13:16:32.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16987" PostTypeId="1" CreationDate="2016-09-26T15:49:02.940" Score="1" ViewCount="117" Body="&lt;p&gt;I am having difficulty moving the user's cart over to being an order. I understand that a cart is essentially an order with &lt;code&gt;isCompleted&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt; and no date set but I can't seem to access anything when setting &lt;code&gt;orders = craft.commerce.orders&lt;/code&gt;, etc. I can see the cart on the backend along with the guest's email but cannot get orders. I can easily get the current cart and all my products have a price of $0 if that is relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5677" LastEditorUserId="57" LastEditDate="2016-09-26T18:54:50.553" LastActivityDate="2016-09-27T12:33:58.143" Title="Moving from Cart to Order" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16988" PostTypeId="1" AcceptedAnswerId="16994" CreationDate="2016-09-26T15:51:02.623" Score="2" ViewCount="677" Body="&lt;p&gt;I want to return JSON with some asset URLs, but i want these URLs to be transformed asset URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way for me to get the asset transformed URL in the controller? Will the assets be automatically transformed or i need to somehow do it manually ?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-09-26T18:56:24.173" LastActivityDate="2016-09-26T19:04:21.557" Title="Get transformed asset URL in controller" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16989" PostTypeId="2" ParentId="16357" CreationDate="2016-09-26T16:37:55.240" Score="2" Body="&lt;p&gt;This feature has been added in &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields&quot; rel=&quot;nofollow&quot;&gt;Sprout Fields&lt;/a&gt; v2.1.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now use the Email Select field via custom HTML and obfuscate email addresses. I've added &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/email-select-field&quot; rel=&quot;nofollow&quot;&gt;an example in the docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contact = craft.sproutForms.form('contact') %}&#xA;&#xA;{% set emailSelectField = contact.getField('emailSelect') %}&#xA;&#xA;&amp;lt;select name=&quot;fields[{{ emailSelectField.handle }}]&quot;&amp;gt;&#xA;&#xA;  {% set value = contact is defined ? contact.emailSelect.value : null %}&#xA;&#xA;  {% set options = craft.sproutFields.obfuscateEmailAddresses(emailSelectField.settings.options, value) %}&#xA;&#xA;  {% for option in options %}&#xA;&#xA;    {% if value != &quot;&quot; %}&#xA;      {% set selected = (option.selected == 1) ? true : false %}&#xA;    {% else %}&#xA;      {% set selected = (option.default == 1) ? true : false %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;option value=&quot;{{ option.value }}&quot; {% if selected %}selected{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-26T16:37:55.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16990" PostTypeId="2" ParentId="16960" CreationDate="2016-09-26T17:06:20.227" Score="3" Body="&lt;p&gt;&lt;strong&gt;Adding Code Mirror to a Redactor field is a bad idea.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire point of a WYSIWYG field is to allow a content editor to easily format text to be displayed on the front-end. Conversely, the entire point of Code Mirror is to colorize a snippet of code. It's hard to imagine a use-case where you'd want to colorize the value of your WYSIWYG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I'd recommend using a plugin like &lt;a href=&quot;https://github.com/httpster/Ace-Freely/&quot; rel=&quot;nofollow&quot;&gt;Ace Freely&lt;/a&gt; to store code snippets. This will allow you to easily view your code snippet in the control panel, &lt;em&gt;without&lt;/em&gt; giving it unnecessary paragraph tags and awkward spacing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then apply Code Mirror on the front-end to render a colorized version of that code snippet.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-26T17:06:20.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16991" PostTypeId="1" CreationDate="2016-09-26T17:28:44.707" Score="1" ViewCount="911" Body="&lt;p&gt;I'm having an issue where a user is uploading images but they're not showing up correctly. The photo is listed in /admin/assets and shows the correct file size, kind, dimensions, etc but I'm getting a 404 error on the file's url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to able to upload images without issue myself.&lt;/p&gt;&#xA;" OwnerUserId="5678" LastActivityDate="2016-09-27T00:27:51.750" Title="Uploaded image not appearing" Tags="&lt;assets&gt;&lt;upload&gt;&lt;404&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16992" PostTypeId="2" ParentId="16991" CreationDate="2016-09-26T17:38:19.027" Score="2" Body="&lt;p&gt;My first step to troubleshooting this is to confirm that the Asset Source URL is correct in the source settings. &lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2016-09-26T17:38:19.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16994" PostTypeId="2" ParentId="16988" CreationDate="2016-09-26T19:04:21.557" Score="2" Body="&lt;p&gt;You'd do it from PHP nearly idential to how you'd do it from Twig... by passing in the Asset Transform's handle to &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel&quot; rel=&quot;nofollow&quot;&gt;AssetFileModel's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel#getUrl-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getUrl()&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.id(1).first() %}&#xA;&#xA;{% if asset %}&#xA;    {{ asset.getUrl('myTransform') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$criteria-&amp;gt;id = 1;&#xA;$asset = $criteria-&amp;gt;first();&#xA;&#xA;if ($asset)&#xA;{&#xA;    $url = $asset-&amp;gt;getUrl('myTransform');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-26T19:04:21.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16996" PostTypeId="2" ParentId="16936" CreationDate="2016-09-26T20:18:30.037" Score="3" Body="&lt;p&gt;Someone asked this question on the Simplemap Github issues, &lt;a href=&quot;https://github.com/ethercreative/simplemap/issues/11&quot; rel=&quot;nofollow&quot;&gt;read the answer here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've copy/pasted pasted the answer below in case that link dies, but stress this is not my code, the credit goes to &lt;a href=&quot;https://github.com/Tam&quot; rel=&quot;nofollow&quot;&gt;Tam&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin returns an array containing lat, lng, and others (see docs). You can use these as the location for any front-end map library (e.g. Google Maps or Mapbox).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Google Maps as an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;map&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;  var map;&#xA;  function initMap() {&#xA;    map = new google.maps.Map(document.getElementById('map'), {&#xA;      center: {&#xA;        lat: {{ entry.myMapField.lat }},&#xA;        lng: {{ entry.myMapField.lng }}&#xA;      },&#xA;      zoom: 8&#xA;    });&#xA;  }&#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;amp;callback=initMap&quot; async defer&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And Mapbox:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src='https://api.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;link href='https://api.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' /&amp;gt;&#xA;&#xA;&amp;lt;div id='map' style='width: 400px; height: 300px;'&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;  mapboxgl.accessToken = 'pk.eyJ1IjoiZXRoZXJjcmVhdGl2ZSIsImEiOiJjaWhjMDQ4cDUwMDg0dm9ranV3ZWZtY3B2In0.KQKSKysuha7MW19Q_cCJCA';&#xA;  var map = new mapboxgl.Map({&#xA;    container: 'map',&#xA;    style: 'mapbox://styles/mapbox/streets-v9',&#xA;    center: [&#xA;      {{ entry.myMapField.lng }},&#xA;      {{ entry.myMapField.lat }}&#xA;    ]&#xA;  });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2016-09-27T08:42:35.843" LastActivityDate="2016-09-27T08:42:35.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16997" PostTypeId="2" ParentId="16991" CreationDate="2016-09-27T00:27:51.750" Score="0" Body="&lt;p&gt;Turns out this was an issue with hosting on Heroku. Heroku apps cannot write to the file system.&lt;/p&gt;&#xA;" OwnerUserId="5678" LastActivityDate="2016-09-27T00:27:51.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16998" PostTypeId="1" AcceptedAnswerId="17015" CreationDate="2016-09-27T01:48:02.233" Score="2" ViewCount="881" Body="&lt;p&gt;I have a channel (projects) that has two different &lt;strong&gt;entries fields&lt;/strong&gt; (year &amp;amp; research theme), both of which I want to be able to search in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;The docs for the relatedTo&lt;/a&gt; entries method show under the heading &quot;Passing Multiple Relation Criteria&quot; that it's possible to do this within twig, however I'm not sure how to do this in my plugin using php. Obviously the below won't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Find all projects that match the supplied year and research theme.&#xA;$projectCriterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$projectCriterea-&amp;gt;section = 'projects';&#xA;&#xA;# Something like this?&#xA;$projectCriterea-&amp;gt;customField1-&amp;gt;relatedTo = $yearEntryModel;&#xA;$projectCriterea-&amp;gt;customField2-&amp;gt;relatedTo = $researchThemeEntryModel;&#xA;&#xA;$projects = $projectCriterea-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be amazing. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2016-09-27T20:54:27.050" LastActivityDate="2016-09-27T21:09:24.500" Title="Passing Multiple Relation Criteria In Plugin" Tags="&lt;entries&gt;&lt;relations&gt;&lt;entries-field&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16999" PostTypeId="2" ParentId="16879" CreationDate="2016-09-27T07:19:18.263" Score="3" Body="&lt;p&gt;You could use your own variable to count the matrix blocks in your loop. The code could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rows = 0 %}&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for event in events %} {# loop through all events #}&#xA;        {% if event.startDate|date('Y') == now|date('Y') %} {#check to see if the event's start date is happening this year #}&#xA;            {% for row in event.authors %}&#xA;                    {% for block in row %}&#xA;                        {% switch block.type %}&#xA;                            {% case &quot;author&quot; %}&#xA;&#xA;                                {% if rows == 4 %}&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                                    {% set rows = 0 %}&#xA;                                {% endif %}&#xA;&#xA;&#xA;                                &amp;lt;div class=&quot;col-md-3 author&quot;&amp;gt; &#xA;                                    {% set image = block.image.first() %}&#xA;                                        {% if image|length %}&#xA;                                            &amp;lt;img src=&quot;{{ image.getUrl('authorThumb') }}&quot;&amp;gt;&#xA;                                         {% endif %}&#xA;                                    &amp;lt;p class=&quot;name&quot;&amp;gt;{{ block.authorName }}&amp;lt;/p&amp;gt;&#xA;                                    {% if block.twitterHandle|length %}&#xA;                                    &amp;lt;p class=&quot;subtitle&quot;&amp;gt;&amp;lt;a href=&quot;http://twitter.com/{{ block.twitterHandle }}&quot; target=&quot;_blank&quot;&amp;gt;@{{ block.twitterHandle }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                                    {% endif %}&#xA;                                     &amp;lt;small&amp;gt;{{ event.startDate|date('m/d/y') }} @ {{ event.startDate|date('g:ia') }} &amp;lt;/small&amp;gt;&#xA;                                     &amp;lt;hr&amp;gt;&#xA;                                     &amp;lt;p class=&quot;bio&quot;&amp;gt;{{ block.bio }}&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;&#xA;                               {% set rows = rows + 1 %}&#xA;&#xA;                        {% endswitch %}&#xA;                    {% endfor %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's important to set the variable outside the for loop, otherwise it does not work.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-09-27T07:19:18.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17000" PostTypeId="2" ParentId="16932" CreationDate="2016-09-27T09:21:45.940" Score="1" Body="&lt;p&gt;The solution is set the right translations... the problem was using translations &quot;pt_pt&quot; instead of &quot;pt_br&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take care of using the right translations&lt;/p&gt;&#xA;" OwnerUserId="5646" LastActivityDate="2016-09-27T09:21:45.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17001" PostTypeId="1" AcceptedAnswerId="17004" CreationDate="2016-09-27T12:00:03.560" Score="1" ViewCount="123" Body="&lt;p&gt;So in Craft Commerce, we have stock items. What I want is to display items in stock, but adjust it to active checkout charts containing those items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(only when an active had a checkout or being disband stock must correct itself)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would it be possible to implement such a thing?&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="57" LastEditDate="2016-09-27T17:23:33.367" LastActivityDate="2021-04-15T21:23:41.660" Title="Adjust item stock accordingly to checkout carts" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17002" PostTypeId="2" ParentId="16987" CreationDate="2016-09-27T12:33:58.143" Score="1" Body="&lt;p&gt;&lt;code&gt;craft.commerce.orders&lt;/code&gt; returns an element criteria model that defaults to setting the criteria param &lt;code&gt;isCompleted&lt;/code&gt; to true. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to set &lt;code&gt;isCompleted&lt;/code&gt; to false on the criteria to override it, in order to get someone else's cart from the front-end.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-09-27T12:33:58.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17003" PostTypeId="1" CreationDate="2016-09-27T14:01:43.410" Score="1" ViewCount="883" Body="&lt;p&gt;I have a Matrix field in my Craft control panel which contains content which creates a front end form.  If the form field has a placeholder text entered in my Matrix field, I would like that text to be submitted along with the user's text input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If the user entered &quot;100&quot; in the front end form text input field, and my placeholder text is &quot;bpm&quot;, the result I would like submitted is: &quot;100 bpm&quot;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my text input field form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;{{ row.inputType }}&quot; name=&quot;{{ block.fieldName }}&quot; class=&quot;gui-input&quot; placeholder=&quot;{{ row.label }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of my Matrix field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BjJs1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BjJs1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of my front end form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/db8QR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/db8QR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding a hidden input field below the text input field but the problem I ran into is that all placeholder text is submitted regardless of whether the user actually filled out a field.                                                                 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ block.fieldName }}&quot; value=&quot;{{ row.label }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So let's say that the user filled out the &quot;fetal heart rate&quot; text field but did not fill out the &quot;estimated gestational age&quot;. Using the hidden text field both &quot;bpm&quot; and &quot;weeks&quot; is submitted even if the user didn't fill out the &quot;estimated gestational age&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary of my question:&lt;/strong&gt; Is there a way to conditionally append a value along user text input? Example, if the user entered &quot;100&quot; for &quot;fetal heart rate&quot; in the front end form text input field, and my placeholder text is &quot;bpm&quot;, the result I would like submitted is: &quot;100 bpm&quot;. If he skipped filling out any other text input fields then no additional values are submitted (like &quot;weeks&quot;).&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2016-09-27T22:21:36.843" Title="Append a placeholder value to a text input field when form is submitted" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17004" PostTypeId="2" ParentId="17001" CreationDate="2016-09-27T14:11:20.903" Score="1" Body="&lt;p&gt;Well I made a workaround, I'm going to use Custom Order Status to manage &quot;in stock&quot; and &quot;pending in cart&quot; and get both the values and make a calculation that will be put in the &quot;stock&quot; value displaying in the front. &lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="57" LastEditDate="2016-09-27T17:23:56.433" LastActivityDate="2016-09-27T17:23:56.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17005" PostTypeId="1" CreationDate="2016-09-27T15:54:28.037" Score="3" ViewCount="740" Body="&lt;p&gt;I am trying to setup some error trapping on the discount code to output an error message if there are no products that qualify for the discount code the user enters. Here is the code I have;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set currentDiscount = craft.commerce.getDiscountByCode(cart.couponCode)%}&#xA;&#xA;    {% for item in cart.lineItems %}&#xA;        {% set cartProductIds = item.purchasable.product.id %}&#xA;&#xA;        {% if currentDiscount %}&#xA;            {% if not cartProductIds in currentDiscount.productIds %}You have no products in the cart that meet this discount{% endif %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently this doesn't give me anything back. Can anyone point me further in the right direction...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I have since found the code I pasted as an answer no longer works or never fully worked. I am struggling to loop through an array and check against the other array and if no id's match then set an error. I want to check if any of the cart Id's match against any of the discount code id's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my revised code, but it just doesn't match fully. I don;t think it is a bug, but more likely a failing of my code. Can anyone shed any light?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# THIS CHECKS THE DICOUNT CODE FOR IF THERE ARE ANY VALID/ELIGABLE PRODUCTS IN THE CART #}&#xA;        {% set currentDiscount = craft.commerce.getDiscountByCode(cart.couponCode) %}&#xA;        {% set codeError = null %}&#xA;&#xA;        {% if currentDiscount %}&#xA;            {% set cartProductIds = [] %}&#xA;            {% set discountProductsIds = [] %}&#xA;&#xA;            {% for item in cart.lineItems %}&#xA;                {% set cartProductIds = cartProductIds|merge([item.purchasable.product.id]) %}&#xA;            {% endfor %}&#xA;&#xA;            {% set cartProductIds = cartProductIds|join('|') %}&#xA;&#xA;            {% for product in currentDiscount.products %}&#xA;                {% set discountProductsIds = discountProductsIds|merge([product.id]) %}&#xA;            {% endfor %}&#xA;&#xA;            {% set discountProductsIds = discountProductsIds|join('|') %}&#xA;&#xA;            Products in Cart = {{cartProductIds}}&#xA;            Products in Discount = {{discountProductsIds}}&#xA;&#xA;            {% if cartProductIds not in discountProductsIds %}&#xA;                {% set codeError = 'Sorry there are no products in your cart that are eligiable for the code ' ~ cart.couponCode %}&#xA;            {% endif %}&#xA;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2016-10-10T19:26:53.270" LastActivityDate="2021-02-17T13:38:03.713" Title="Check if cart contains valid products for discount code" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17006" PostTypeId="1" AcceptedAnswerId="17018" CreationDate="2016-09-27T16:08:10.077" Score="3" ViewCount="942" Body="&lt;p&gt;I am building a site where all the content (and users) are being managed using the front end. The site owner needs to invite customers to the site but would like to control the time when that customer receives his activation mail. Is that possible without having access to the control panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So ideal journey would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The site owner creates new customer via the front end (no activation&#xA;mail sent)&lt;/li&gt;&#xA;&lt;li&gt;The site owner does stuff on the site (preparing content&#xA;for the customer)&lt;/li&gt;&#xA;&lt;li&gt;The site owner pushes a button on the customer’s&#xA;profile which fires off the activation mail to the customer&lt;/li&gt;&#xA;&lt;li&gt;Profit&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I could just have my client send out a password reset mail (?) but that seems a bit hack-ish and raises security concerns since that form needs to be publicly available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no methods available which are giving me access to the verification code so that route wasn’t successful either. Is there a way to grab that code and serve it to the template? That would do it for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way to make that happen? It might actually be easy to solve. I would be grateful if someone could push me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2016-09-27T22:55:15.527" Title="Send activation mail from front end" Tags="&lt;users&gt;&lt;frontend&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17007" PostTypeId="2" ParentId="17005" CreationDate="2016-09-27T16:16:38.960" Score="5" Body="&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentDiscount = craft.commerce.getDiscountByCode(cart.couponCode) %}&#xA;&#xA;{% if currentDiscount %}&#xA;&#xA;{% set cartProductIds = [] %}&#xA;&#xA;{% for item in cart.lineItems %}&#xA;  {% set cartProductIds = cartProductIds|merge([item.purchasable.product.id]) %}&#xA;{% endfor %}&#xA;&#xA;{% for product in currentDiscount.products %}&#xA;  {% if not product.id in cartProductIds %}{{ product.title }} not in cart.{% endif %}&#xA;{% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="340" LastEditDate="2016-09-28T03:04:39.703" LastActivityDate="2016-09-28T03:04:39.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17008" PostTypeId="1" CreationDate="2016-09-27T17:06:32.643" Score="1" ViewCount="48" Body="&lt;p&gt;We have a lot of exemptions, re-seller and agriculture, as well as states to report. this tool calculates and accepts the customers exemptions. We are looking at making a plugin but wanted to see if it has already been done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The service is no or low cost and does the filing for a good number of states. So this is a great alternative to other sales tax services. &lt;/p&gt;&#xA;" OwnerUserId="5368" LastEditorUserId="57" LastEditDate="2016-09-27T17:25:34.723" LastActivityDate="2016-09-27T17:30:23.827" Title="Taxcloud.net integration for Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17009" PostTypeId="1" CreationDate="2016-09-27T17:16:51.183" Score="3" ViewCount="911" Body="&lt;p&gt;Is there any way to think about building a site as a Progressive Web App when using Craft CMS? Any steps / plugins that can help build a site as a PWA to enable features like Add to Homescreen, Offline reading support, push notifications?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PWA Overview&lt;/strong&gt;&#xA;&lt;a href=&quot;https://developers.google.com/web/fundamentals/getting-started/your-first-progressive-web-app/?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developers.google.com/web/fundamentals/getting-started/your-first-progressive-web-app/?hl=en&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Wordpress to PWA&lt;/strong&gt;&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/36565068/converting-wordpress-website-to-progressive-web-app&quot;&gt;https://stackoverflow.com/questions/36565068/converting-wordpress-website-to-progressive-web-app&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5682" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2019-05-16T15:03:10.680" Title="Progressive Web App" Tags="&lt;plugin-development&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17010" PostTypeId="2" ParentId="17008" CreationDate="2016-09-27T17:30:23.827" Score="2" Body="&lt;p&gt;As of Sept. 27 2016, I'm not aware of any existing taxcloud.net integrations with Craft Commerce and I'm not seeing any on &lt;a href=&quot;https://straightupcraft.com/craft-plugins/&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins/&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-27T17:30:23.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17012" PostTypeId="1" CreationDate="2016-09-27T19:22:13.617" Score="1" ViewCount="55" Body="&lt;p&gt;I'm building an editorial system on Craft which has 6-8 editorial stages, such as Assignment, Initial Proofing, Secondary Proofing, etc.  It seems that the simplest solution would be to have the current stage be a custom field.  &lt;strong&gt;I'd like to build this system entirely using Craft's &lt;em&gt;backend&lt;/em&gt; so I don't have to reinvent all of the niceties Craft provides.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fuzzy part, however, comes when I'd like to be able to have a &quot;Send to Next Stage&quot; button.  For instance, if the article is done with its initial proofing, the proofreader should be able to mark it as done and automatically send it to the Secondary Proofing step.  I realize that I could just have a dropdown where the user changes the status and saves it, but that feels cumbersome.  Stage 1 should only be able to send entries to Stage 2.  Stage 2 should only be able to send entries to Stage 3.  Things should never skip steps or move backwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current thought is to hook into the &lt;code&gt;entries.onSave&lt;/code&gt; event and have a &lt;code&gt;switch&lt;/code&gt; or something to automatically change the status.  Then, I suppose that &lt;em&gt;within&lt;/em&gt; a stage, all versions would have to be saved as drafts rather than entries, as saving would have that side-effect of essentially marking the entry as complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simpler, more foolproof, or more intuitive way to walk an article through an editorial process like this?  I suppose I could use categories rather than a custom field type, but the &lt;code&gt;entries.onSave&lt;/code&gt; hook would still have to be the mechanism I'd use to automatically send the article to the next stage of the editorial process.&lt;/p&gt;&#xA;" OwnerUserId="5684" LastActivityDate="2016-09-28T09:57:53.210" Title="How should a multi-stage editorial process be implemented in Craft?" Tags="&lt;events&gt;&lt;custom-fieldtype&gt;&lt;hook&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17013" PostTypeId="1" AcceptedAnswerId="17014" CreationDate="2016-09-27T19:53:09.390" Score="4" ViewCount="141" Body="&lt;p&gt;I’m working on a plugin that includes a custom fieldtype. Using Craft 2.6.2911, the fieldtype’s &lt;code&gt;defineSettings&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSettings ( ) {&#xA;    return [&#xA;        'json_data'  =&amp;gt;  [&#xA;            AttributeType::String,&#xA;            'column'  =&amp;gt;  ColumnType::LongText&#xA;        ]&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I add this field to a tab group, the new column is added to the &lt;code&gt;craft_content&lt;/code&gt; table as a &lt;code&gt;varchar(255)&lt;/code&gt;, not a &lt;code&gt;text&lt;/code&gt;-type column.  Is there an additional definition I need somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not see a relevant note in the changelog for builds of Craft between 2.6.2911 and 2.6.2944.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When reviewing my database schema, I'm seeing the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;| field_jsonSync             | varchar(255)           | YES  |     | NULL    |                |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5508" LastActivityDate="2016-09-27T20:23:41.383" Title="Plugin fieldtype settings for ColumnType::LongText being inserted as varchar(255)" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17014" PostTypeId="2" ParentId="17013" CreationDate="2016-09-27T20:23:41.383" Score="3" Body="&lt;p&gt;The Field Types &lt;code&gt;defineSettings&lt;/code&gt; method defines the settings that get handled when you create the field. Those field settings get stored as &lt;code&gt;json&lt;/code&gt; in the &lt;code&gt;craft_fields.settings&lt;/code&gt; column when the field is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;BaseFieldType&lt;/code&gt; class has another method you can add to your class called &lt;code&gt;defineContentAttribute&lt;/code&gt;. In your case, getting the column to be the data type you want would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return [&#xA;        AttributeType::String,&#xA;        'column'  =&amp;gt;  ColumnType::LongText&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;PlainTextFieldType&lt;/code&gt; and &lt;code&gt;RichTextFieldType&lt;/code&gt; classes have similar use cases which modify the default &lt;code&gt;defineContentAttribute&lt;/code&gt; value if you want to take a look at a few more examples.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-09-27T20:23:41.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17015" PostTypeId="2" ParentId="16998" CreationDate="2016-09-27T21:09:24.500" Score="2" Body="&lt;p&gt;I need someone more experienced with Craft to vet this, but it seems that this is working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supplying an array to relatedTo returns results if it matches one &lt;strong&gt;OR&lt;/strong&gt; the other entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$projectCriterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$projectCriterea-&amp;gt;section = 'projects';&#xA;$projectCriterea-&amp;gt;relatedTo = [$themeEntry, $yearCat];&#xA;$projectResults = $projectCriterea-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you supply &quot;and&quot; as the first entry in the array, it only returns results that are related to &lt;strong&gt;BOTH&lt;/strong&gt; entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$projectCriterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$projectCriterea-&amp;gt;section = 'projects';&#xA;$projectCriterea-&amp;gt;relatedTo = [&quot;and&quot;, $themeEntry, $yearCat];&#xA;$projectResults = $projectCriterea-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This was figured out by tinkering and guessing, hence I'm not sure it's the &quot;correct&quot; way to do this. It also doesn't let me search individual custom entries type fields, but this does do what I was after.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-09-27T21:09:24.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17016" PostTypeId="2" ParentId="17003" CreationDate="2016-09-27T22:21:36.843" Score="1" Body="&lt;p&gt;You could either do this the JavaScript way (listen to onSubmit, grab DOM values, append if necessary, otherwise remove), or the PHP way (from a plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll pseudocode the latter because I hate the former.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a Craft &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Have it &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow&quot;&gt;listen&lt;/a&gt; for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow&quot;&gt;onBeforeSaveEntry&lt;/a&gt; event.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Inside that event listener, you can check if the entry being saved belongs to the section you're interested in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If so, check your Fetal Heart Rate field.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If its value is &quot;bpm&quot;, set it to null or an empty string.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If it's anything other than &quot;bpm&quot;, append &quot; bpm&quot; to its existing value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Repeat 4-6 for the &quot;Estimated Gestational Age&quot; field.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Bob%27s_your_uncle&quot; rel=&quot;nofollow&quot;&gt;Bob's your uncle&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-27T22:21:36.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17017" PostTypeId="2" ParentId="17006" CreationDate="2016-09-27T22:44:31.477" Score="2" Body="&lt;p&gt;Since this is on the front-end of a site, you can create a plugin that mimics as much of or as little of the default Craft user registration workflow as you want in &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow&quot;&gt;UsersController&lt;/a&gt; and possibly &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService&quot; rel=&quot;nofollow&quot;&gt;UsersService&lt;/a&gt; by pointing your user registration form to your plugin's controller's registration action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd &lt;em&gt;almost&lt;/em&gt; be able to pull this off with native functionality, but by unchecking &quot;Verify Email Addresses?&quot; under Settings-&gt;Users-&gt;Settings in the control panel, Craft will (by default) set the user account's status to active on user registration, which it doesn't sound like is what you're going for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-09-27T22:44:31.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17018" PostTypeId="2" ParentId="17006" CreationDate="2016-09-27T22:55:15.527" Score="4" Body="&lt;p&gt;I'll focus on the &quot;sending an activation email from the front end&quot; part of your question, since that seems to be the crux of it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd have to write a very simple, custom plugin. For instant success, scaffold your plugin using the &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow&quot;&gt;Plugin Factory&lt;/a&gt;. Under &lt;em&gt;Plugin Components&lt;/em&gt;, enable &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow&quot;&gt;Controllers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unzip and install your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Controller class, add something like the following method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSendActivationEmail()&#xA;{&#xA;&#xA;    // Get the user from the `id` URL parameter&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById(craft()-&amp;gt;request-&amp;gt;getParam('id'));&#xA;&#xA;    if ($user) {&#xA;        // Send the activation email&#xA;        craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user);&#xA;    }&#xA;&#xA;    // Redirect back to the page we came from&#xA;    $this-&amp;gt;redirect(craft()-&amp;gt;request-&amp;gt;getUrlReferrer());&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To create &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#linking-directly-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;a link to this controller action&lt;/a&gt; in your template, do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ actionUrl('yourPluginHandle/sendActivationEmail', { id: user.id }) }}&quot;&amp;gt;Send activation email&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-27T22:55:15.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17019" PostTypeId="2" ParentId="16955" CreationDate="2016-09-28T04:50:46.530" Score="1" Body="&lt;p&gt;The setting useXSendFile was set to true.  I changed this setting to false and everything works now.  Looks like this &lt;a href=&quot;https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/&quot; rel=&quot;nofollow&quot;&gt;guide&lt;/a&gt; could help to get things working when this setting is set to true.&lt;/p&gt;&#xA;" OwnerUserId="5665" LastActivityDate="2016-09-28T04:50:46.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17020" PostTypeId="1" AcceptedAnswerId="17037" CreationDate="2016-09-28T05:01:23.227" Score="2" ViewCount="148" Body="&lt;p&gt;I have a folder with 10GB of files that I need to sync with Craft. It has 12 subfolders, one for each year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/1999&#xA;  /01&#xA;  /02&#xA;  /03&#xA;  /...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's possible to run Update Asset Indexes on the top-level folder but this process takes several hours and can't be interrupted. If things get interrupted, for whatever reason, some of the sub-folders are successfully imported but the other subfolders aren't, and there is no simple way to pick things up where they left off without restarting the full process. Ouch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to sync a specific asset subfolder, or list of subfolders? How would I approach this programmatically? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems I may want to call the &lt;code&gt;AssetIndexTool::performAction&lt;/code&gt; method but only pass in the subfolder IDs or something like that. I haven't interfaced with the Tool classes at all. Is this a reasonable direction to consider or am I not considering another potential direction?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-09-28T05:28:22.700" LastActivityDate="2016-10-03T06:03:19.490" Title="Is it possible to use Update Asset Indexes on a target subfolder or subfolders?" Tags="&lt;assets&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17021" PostTypeId="1" CreationDate="2016-09-28T08:05:18.490" Score="1" ViewCount="121" Body="&lt;p&gt;I am running Craft locally using default/update Laravel Homestead/Vagrant box. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image Transforms are returning the CP resources URL 404 error outlined in this related question:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/827/image-transforms-returning-cpresources-url&quot;&gt;Image transforms returning cpresources url&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've confirmed that my host and vagrant box have the correct permissions&lt;/li&gt;&#xA;&lt;li&gt;I've cleared cache and reindexed assets&lt;/li&gt;&#xA;&lt;li&gt;I've tried the 'generateTransformsBeforePageLoad' =&gt; true,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I still receive the error: Failed to load resource: the server responded with a status of 404 (Not Found)&lt;/p&gt;&#xA;" OwnerUserId="594" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-09-28T18:40:38.033" Title="Laravel Homestead image transforms 404" Tags="&lt;image-transforms&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17022" PostTypeId="2" ParentId="16962" CreationDate="2016-09-28T08:29:49.490" Score="3" Body="&lt;p&gt;Okay - got to the bottom of this.&#xA;Was using the wrong setting. Should have been &lt;code&gt;setPasswordSuccessPath&lt;/code&gt; not &lt;code&gt;setPasswordSuccess&lt;/code&gt;!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-09-28T08:29:49.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17023" PostTypeId="2" ParentId="17005" CreationDate="2016-09-28T08:37:31.200" Score="1" Body="&lt;p&gt;So some persistence I have this working as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentDiscount = craft.commerce.getDiscountByCode(cart.couponCode) %}&#xA;&#xA;{% if currentDiscount %}&#xA;    {% set cartProductIds = [] %}&#xA;    {% set codeError = null %}&#xA;&#xA;    {% for item in cart.lineItems %}&#xA;        {% set cartProductIds = cartProductIds|merge([item.purchasable.product.id]) %}&#xA;    {% endfor %}&#xA;&#xA;    {% for product in currentDiscount.products %}&#xA;        {% if not cartProductIds in product %}&#xA;            {% set codeError = 'true' %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if codeError == 'true' %}&#xA;        &amp;lt;br /&amp;gt;&#xA;        {% include '_includes/formError' with { error : 'Sorry there are no products in your cart that are eligiable for the code ' ~ cart.couponCode } %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sure the code can be cleaned up a little. So feel free to refine if anyone wishes to make it better.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-09-28T08:37:31.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17024" PostTypeId="2" ParentId="17012" CreationDate="2016-09-28T09:57:53.210" Score="1" Body="&lt;p&gt;Have you already seen the workflow plugin? Maybe it could give you some inputs for your further development: &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/Workflow&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2016-09-28T09:57:53.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17025" PostTypeId="1" AcceptedAnswerId="17031" CreationDate="2016-09-28T10:57:19.807" Score="5" ViewCount="1187" Body="&lt;p&gt;Our search index table (craft_searchindex) is over 500,000 rows and it takes a few hours to index. We have 11 languages, and each is being fully indexed. It takes a few hours to complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any ways we can reduce the search index size (e.g. only one language, or specific sections?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2019-10-14T18:18:21.907" Title="Is there a way to reduce the search index?" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17026" PostTypeId="1" AcceptedAnswerId="17027" CreationDate="2016-09-28T13:48:07.267" Score="1" ViewCount="627" Body="&lt;p&gt;I've followed &lt;a href=&quot;https://craftcms.com/support/tag-urls&quot; rel=&quot;nofollow&quot;&gt;this guide&lt;/a&gt; for creating a routes to list entries with specific tags. It is working fine except that I have muli-word tags so using the tag token from &lt;code&gt;Settings -&amp;gt; Routes&lt;/code&gt; gives me urls like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mysite.com/tags/my%20tag%20name&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to us the tag.slug instead which should allow me to have urls end in &lt;code&gt;.../my-tag-name&lt;/code&gt; instead, but I can't figure out how to do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to refer to tag.slug in craft/config/routes.php?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so what should the custom route look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'tags/what goes here?' =&amp;gt; 'tags/_tag.html',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template code is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;&#xA;{% block content %}&#xA;&#xA;{% set tag = craft.tags.title(tag).first() %}&#xA;&#xA;{% if not tag %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;h2&amp;gt;Entries tagged with “{{ tag.title }}”&amp;lt;/h2&amp;gt;&#xA;&#xA;{% set entries = craft.entries.relatedTo(tag).order('title') %}&#xA;&#xA;{% if entries | length %}&#xA;&#xA;        {% for entry in entries %}&#xA;            {{ include('./partials/entryListItem.html', {'entry': entry}) }}&#xA;        {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with that tag.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the include points to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class='entry-list-item'&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;sm-txt&quot;&amp;gt; continue reading&amp;lt;/span&amp;gt;&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;        {% if entry.tags | length %}&#xA;          &amp;lt;p class='sm-txt'&amp;gt;&#xA;          {% for tag in entry.tags %}&#xA;            &amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot;&amp;gt;{{ tag.title }}, &amp;lt;/a&amp;gt;&#xA;          {% endfor %}&#xA;          &amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The route is set in the dashboard &lt;code&gt;tags/(tag token)&lt;/code&gt; points to tags/_tag.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the route to &lt;code&gt;tags/(slug token)&lt;/code&gt; I get template error: variable tag does not exist.&lt;/p&gt;&#xA;" OwnerUserId="5089" LastEditorUserId="57" LastEditDate="2016-09-28T18:52:04.890" LastActivityDate="2016-09-29T07:27:16.477" Title="Use of tag.slug instead of tag.title in a custom route" Tags="&lt;routes&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17027" PostTypeId="2" ParentId="17026" CreationDate="2016-09-28T14:06:58.687" Score="3" Body="&lt;p&gt;You do not have to change your route. Instead modify your template where you are linking the tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot;&amp;gt;{{ tag.title }}, &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.slug }}&quot;&amp;gt;{{ tag.title }}, &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATED&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify the above snippet goes in the template that generates the link to take the the user to your &lt;code&gt;_tag.html&lt;/code&gt; template, not in the &lt;code&gt;_tag.html&lt;/code&gt; template itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your route should be as below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I5yVA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I5yVA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above snippet updated to match your example above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the &lt;code&gt;tag&lt;/code&gt; variable made available to your template is now the tag’s slug, make sure to update the code to query for the tag model to use the &lt;code&gt;slug&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.slug(tag).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="125" LastEditDate="2016-09-29T07:27:16.477" LastActivityDate="2016-09-29T07:27:16.477" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17028" PostTypeId="1" AcceptedAnswerId="17030" CreationDate="2016-09-28T14:10:49.440" Score="2" ViewCount="172" Body="&lt;p&gt;We are building a family community website with 600+ members.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the gimmicks will be some stats, like average age all members.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a smart way to calculate this?&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2016-09-28T19:46:00.077" Title="How to calculate average age members" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17029" PostTypeId="2" ParentId="17028" CreationDate="2016-09-28T15:21:43.413" Score="2" Body="&lt;p&gt;I don't think this will exactly answer your question, but I think it will help get you going in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my application, I am grabbing entries that belong to the currently logged in user - finding the fields and then displaying an average distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'll notice I am setting a &lt;code&gt;level': 2&lt;/code&gt; in my parameters. That's because I am working with a structure and the first level is the &quot;parent&quot; entry that does not have any of the data I am attempting to average.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all of the entries entered by the user. #}&#xA;{% set entries = craft.entries({&#xA;    'section': 'mySection',&#xA;    'level': 2,&#xA;    'descendantOf': user.id&#xA;}) %}&#xA;&#xA;{% if entries|length %}&#xA;&#xA;    ...&#xA;&#xA;    {% set value = 0 %}&#xA;    {% set count = 0 %}&#xA;&#xA;    {% for entry in entires %}&#xA;        {% set value = value + entry.distance %}&#xA;        {% set count = loop.index %}&#xA;    {% endfor %}&#xA;&#xA;    {% set averageDistance = (value / count)|round(1, 'floor') %}&#xA;&#xA;    &amp;lt;p&amp;gt;Avg: {{ averageDistance }}&amp;lt;/p&amp;gt;&#xA;&#xA;    ...&#xA;&#xA;{% else %}&#xA;    {# Could not find any entries. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in a nutshell, you'll want to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;grab the entries from the appropriate section&lt;/li&gt;&#xA;&lt;li&gt;find the field(s) you want to average ex: distance&lt;/li&gt;&#xA;&lt;li&gt;do math&lt;/li&gt;&#xA;&lt;li&gt;return the result&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For you (this is a stab in the dark) you would want to get all users, get the value of the &lt;code&gt;age&lt;/code&gt; field. Then loop over to get your &lt;code&gt;count&lt;/code&gt; and divide that by the ages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-09-28T15:21:43.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17030" PostTypeId="2" ParentId="17028" CreationDate="2016-09-28T17:54:25.427" Score="2" Body="&lt;pre&gt;&lt;code&gt;{# Get all members #}&#xA;{% set members = craft.users().limit(null) %}&#xA;&#xA;{# Get total number of members #}&#xA;{% set memberCount = members.total() %}&#xA;&#xA;{# Set this outside the 'for' loop so you can use it later #}&#xA;{% set ageSum = 0 %}&#xA;&#xA;{# Add 'em up #}&#xA;{# We assume here you have a custom member field with the handle 'age' #}&#xA;{% for member in members %}&#xA;    {% set ageSum = ageSum + member.age %} &#xA;{% endfor %}&#xA;&#xA;{# Get the average #}&#xA;{% set avgAge = ageSum / memberCount %}&#xA;&#xA;{# Print it #}&#xA;&amp;lt;p&amp;gt;Average member age is {{ avgAge }}&amp;lt;p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to limit the calculation to a particular user group, just add its handle to the end of the first &lt;code&gt;set&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set members = craft.users().group('groupHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;age&lt;/code&gt; is not a required field you might want to skip records that don't have an &lt;code&gt;age&lt;/code&gt;. I'm not entirely sure what including them would do to the math.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ageSum = (member.age and member.age &amp;gt; 0) ? ageSum + member.age : ageSum %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="1098" LastEditDate="2016-09-28T19:46:00.077" LastActivityDate="2016-09-28T19:46:00.077" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17031" PostTypeId="2" ParentId="17025" CreationDate="2016-09-28T18:51:19.403" Score="3" Body="&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, a plugin can listen to the &lt;code&gt;Element::EVENT_REGISTER_SEARCHABLE_ATTRIBUTES&lt;/code&gt; event to modify the searchable attribute list of an element before it is indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the answer is no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe it &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;makes the case&lt;/a&gt; for some sort of &lt;code&gt;onBeforeSearchIndex&lt;/code&gt; event a plugin could listen to and influence what Craft adds to the search index, but given that manually updating the search index isn't meant to be a common occurrence (Craft keeps them up to date in normal element saving operations), I'd probably add the workflow you're using that requires frequent updates to the feature request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2019-10-14T18:18:21.907" LastActivityDate="2019-10-14T18:18:21.907" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17032" PostTypeId="1" AcceptedAnswerId="17034" CreationDate="2016-09-28T19:46:00.183" Score="2" ViewCount="427" Body="&lt;p&gt;We are building a family community website with more than 600 members all over the world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;strong&gt;craft.users&lt;/strong&gt; we have added many fields and one of them is &lt;strong&gt;country&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to display and count all countries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example of the desired output could be something like:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our members are living in the next 5 countries&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the Netherlands (545)&lt;/li&gt;&#xA;&lt;li&gt;Chili (26)&lt;/li&gt;&#xA;&lt;li&gt;USA (14)&lt;/li&gt;&#xA;&lt;li&gt;Italy (6)&lt;/li&gt;&#xA;&lt;li&gt;Sweden (8)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="4892" LastEditDate="2016-09-28T20:12:18.733" LastActivityDate="2016-09-29T01:09:30.030" Title="Count all unique values" Tags="&lt;templating&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17033" PostTypeId="1" AcceptedAnswerId="17035" CreationDate="2016-09-28T20:57:45.833" Score="1" ViewCount="458" Body="&lt;p&gt;I'm looking to add additional shipping methods through a plugin, using the documentation here: &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/shipping-methods&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little bit lost about how to hook things up, according to the docs I'm supposed to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function commerce_registerShippingMethods()&#xA;{&#xA;    return [new CustomShipper_CourierDeliveryMethod()];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The docs don't really cover where and how to do this, other than to include it in the base plugin file. That part I can follow. Could someone help me understand what file to create, the basics of what it should include and how to connect it (referring to &lt;strong&gt;new CustomShipper_CourierDeliveryMethod()&lt;/strong&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is new to me for Craft Plugin development - I'm used to connecting to files using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [craft()-&amp;gt;pluginHandle_serviceName-&amp;gt;function_name()];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which obviously is very differently than the above. Any help would be HUGELY appreciated.. thanks!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-09-29T04:37:47.303" Title="Commerce Custom Shipping Methods via Plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17034" PostTypeId="2" ParentId="17032" CreationDate="2016-09-29T01:09:30.030" Score="5" Body="&lt;p&gt;Something like this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set usersGroupedByCountry = craft.users.limit(null)|group('postaddress.country') %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for country, users in usersGroupedByCountry %}&#xA;        {% if country and users|length %}&#xA;           &amp;lt;li&amp;gt;{{ country }} ({{ users|length }})&amp;lt;/li&amp;gt;&#xA;        {% endif %}   &#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if you want to order the list of countries, you'll need the &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot;&gt;SuperSort plugin&lt;/a&gt;. Here's how you would sort the list alphabetically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set usersGroupedByCountry = craft.users.limit(null)|group('postaddress.country)|supersort('ksort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also note that if you have a lot of users (say, hundreds), it is probably a good idea to wrap the whole thing (including the &lt;code&gt;{% set usersGroupedByCountry ... %}&lt;/code&gt; part) in a &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag pair, for performance reasons.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-09-29T01:09:30.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17035" PostTypeId="2" ParentId="17033" CreationDate="2016-09-29T03:24:20.780" Score="3" Body="&lt;p&gt;Ok, so what you're doing is returning a new instance of a shipping method class - this class must meet the Shipping Method interface - documented here: &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods#shipping-method-interface&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/shipping-methods#shipping-method-interface&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, you must implement each of those functions as defined by the interface in your shipping method class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd define this class in a file of it's own named after the class, and in your base plugin file you &lt;code&gt;require&lt;/code&gt; this class definition to bring it in to scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same goes for your shipping rules - you again create a class that meets the interface and then &lt;code&gt;require&lt;/code&gt; that in your main plugin file (or wherever you need to access the rule).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-09-29T04:37:47.303" LastActivityDate="2016-09-29T04:37:47.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17036" PostTypeId="1" CreationDate="2016-09-29T05:33:59.400" Score="1" ViewCount="572" Body="&lt;p&gt;I'm trying to setup our Craft CMS dev environment with &lt;a href=&quot;https://laravel.com/docs/5.3/valet&quot; rel=&quot;nofollow&quot;&gt;Valet&lt;/a&gt; which is just a wrapper for Caddy Server and dnsmasq.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to be running into some redirect/locale issues that's preventing these pages from loading. The rest of the site and the CMS admin itself is working fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've previously had things setup on apache and have followed the &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;localization guides&lt;/a&gt; but I'm thinking it has to do with the fact that caddy server doesn't honor &lt;code&gt;.htaccess&lt;/code&gt; files so I need to add some rewrite rules in my &lt;code&gt;Caddyfile&lt;/code&gt; for the various locales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to load the regional sites it's just giving me a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else got this working?&lt;/p&gt;&#xA;" OwnerUserId="450" LastEditorUserId="57" LastEditDate="2016-10-13T17:35:44.180" LastActivityDate="2016-10-13T17:35:44.180" Title="Redirect and locale issues when using Valet / Caddy Server" Tags="&lt;localization&gt;&lt;redirect&gt;&lt;caddy&gt;&lt;valet&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17037" PostTypeId="2" ParentId="17020" CreationDate="2016-09-29T08:22:11.837" Score="3" Body="&lt;p&gt;There is no good solution in Craft 2.x, but you probably can put together a plugin or a console app that does what you want it to do. Here's all the background info you, hopefully, need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole indexing process is controlled by javascript as well but let's just pretend you've instantiated the &lt;code&gt;AssetIndexTool&lt;/code&gt; class and are operating on that via &lt;code&gt;performAction()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Asset indexer operates strictly on the data in &lt;code&gt;craft_assetindexdata&lt;/code&gt; table. When you start an indexing task, the very first thing it does is query the Asset Sources for all the actual files that are there, stores a list of them in the said table and from that point on uses that table to reference what files have been indexed and which not. As it does it, Craft also creates all the folders already (because, apparently, a long time ago it seemed like a good idea to me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, the tool returns an array for each of the steps it needs to take, where one step is generated per file and also an additional &quot;overview&quot; step at the end. Each array entry basically contains parameters that you should throw back at the Index Tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're interested in each of those &quot;step&quot; arrays (if you want to understand how the whole process works) is &lt;code&gt;sessionId&lt;/code&gt; variable there to track the indexing session in the indexing table, the &lt;code&gt;sourceId&lt;/code&gt; variable so you know which source you're operating on and the &lt;code&gt;offset&lt;/code&gt; variable that tells the Index Tool which file in the indexing table to look up and actually index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should definitely also follow through with the last overview step. Never mind that it presents the user with a HTML dialog for all the files that are in the DB but are not present in the source, but, more importantly, it cleans up the asset indexing table and removes the obsolete data in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The great news is that it will be significantly less convoluted and way more accessible programmatically in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2016-10-03T06:03:19.490" LastActivityDate="2016-10-03T06:03:19.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17038" PostTypeId="1" AcceptedAnswerId="17044" CreationDate="2016-09-29T08:48:47.350" Score="1" ViewCount="71" Body="&lt;p&gt;I am getting some global entries from the CMS that I want to use as meta-tags content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I load the page I see in the inspection that the meta-tags are moved inside the body.  When I remove the dynamic meta-tags and use only the hardcoded, everything is ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have something like that in the head:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set metadata = craft.globals.getSetByHandle('metadata') %}&#xA;&#xA;&amp;lt;title&amp;gt;{{ metadata.title }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{{ metadata.description }}&quot;&amp;gt;&#xA;&amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ metadata.keywords}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why the meta-tags are moved? How can I fix that? Is it a Craft issue or a Twig issue or my mistake?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-09-29T17:16:41.930" LastActivityDate="2016-09-29T17:16:41.930" Title="Meta are moved to body" Tags="&lt;templating&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17039" PostTypeId="1" AcceptedAnswerId="17259" CreationDate="2016-09-29T09:21:45.907" Score="1" ViewCount="139" Body="&lt;p&gt;On my production server, each time I try to change or upload a user photo I get the &quot;an unknown error occurred&quot; message. If I check the logs, the error says it couldn't delete the folder of the userphotos because it is not writable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I checked the settings and everything is set to 755, the same as the assets folder where I have no problems uploading. The only way I got the userphotos to work is to set the permission on the folder to 777, but that's not the best solution security-wise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why isn't the userphotos folder writeable but the assets folder is?&lt;/p&gt;&#xA;" OwnerUserId="5692" LastActivityDate="2016-10-13T17:48:09.740" Title="permissions userphotos &quot;an unknown error occurred&quot;" Tags="&lt;error&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17040" PostTypeId="2" ParentId="13602" CreationDate="2016-09-29T10:05:03.463" Score="1" Body="&lt;p&gt;I know this is a late reply. I hope it will help others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to &lt;code&gt;return false;&lt;/code&gt; so that the background color is red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     if (count($criteria-&amp;gt;ids()) &amp;gt; 1)&#xA;     {&#xA;         $this-&amp;gt;setMessage($this-&amp;gt;getParams()-&amp;gt;warningMessage);&#xA;&#xA;         return false;&#xA;     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5652" LastEditorUserId="57" LastEditDate="2016-09-29T17:12:42.463" LastActivityDate="2016-09-29T17:12:42.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17041" PostTypeId="1" AcceptedAnswerId="17042" CreationDate="2016-09-29T10:41:22.803" Score="2" ViewCount="167" Body="&lt;p&gt;I want to cache the cart using key &lt;code&gt;cart.id&lt;/code&gt; to save some db queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.cart %}&#xA;&#xA;{% cache globally using key &quot;cartId=&quot; ~ cart.id ?? &quot;empty&quot; until cart.dateUpdated %}&#xA;&#xA;{% if cart.lineItems | length %}&#xA;    {% for item in cart.lineItems %}&#xA;        {{ item.sku }},&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Cart has no items&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is caching by cart.id sufficient?&lt;/li&gt;&#xA;&lt;li&gt;Is there any potential risk?&lt;/li&gt;&#xA;&lt;li&gt;What is &lt;code&gt;{% set cart = craft.commerce.cart %}&lt;/code&gt; actually setting when cart.id = null ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5009" LastEditorUserId="57" LastEditDate="2016-09-29T17:13:56.490" LastActivityDate="2016-09-29T17:13:56.490" Title="Cache cart globally using key cart.id" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17042" PostTypeId="2" ParentId="17041" CreationDate="2016-09-29T11:34:38.103" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is caching by cart.id sufficient?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would not cache the cart, it could always be changing. You would need to create a cache ID based on every aspect of the cart that could change (line items, coupons, addresses, sales, discounts, tax etc). Bottom line, do not cache dynamic things like the cart.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any potential risk?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See above.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is {% set cart = craft.commerce.cart %} actually setting when cart.id = null ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are getting an order model returned, it just does not get an ID until the first item is added to the cart and the order/cart is saved to the database.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2016-09-29T11:55:30.377" LastActivityDate="2016-09-29T11:55:30.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17043" PostTypeId="1" CreationDate="2016-09-29T11:52:47.363" Score="2" ViewCount="32" Body="&lt;p&gt;Is it possible to use the saveUser method to import users with an existing ID?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser($userModel)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to import 2000+ users and when doing so, I need to make sure that their old ID doesn't change after inserted, because I need to import other tables too and match them based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The excellent import plugin tries to update the users instead of creating new ones when I tell it to import the ID as well. I'm not sure if that's intended behavior or a bug.&lt;/p&gt;&#xA;" OwnerUserId="4755" LastEditorUserId="4755" LastEditDate="2016-09-29T19:17:21.490" LastActivityDate="2016-09-29T19:17:21.490" Title="Import users with specific ID" Tags="&lt;import&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17044" PostTypeId="2" ParentId="17038" CreationDate="2016-09-29T12:11:31.920" Score="2" Body="&lt;p&gt;So the problem was caused by a secret character, the character was not visible in code but it was noticed in the w3c validator for html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JaUxJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JaUxJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after removing that character issue solved.&lt;/p&gt;&#xA;" OwnerUserId="5504" LastActivityDate="2016-09-29T12:11:31.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17045" PostTypeId="1" AcceptedAnswerId="17046" CreationDate="2016-09-29T12:29:03.410" Score="2" ViewCount="42" Body="&lt;p&gt;I have a commissions section in where we have a matrix field where we add the user (from craft.users) and the function of the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A user can be in more that one commissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the user profile page, we want to show besides some personal information, all the commissions in which he is active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a single relation field (user type field), we have no problem, but I can't get it working with this matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix field info:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section: &lt;code&gt;commissionmembers&lt;/code&gt;&lt;br&gt;&#xA;Blocktype: &lt;code&gt;members&lt;/code&gt;&lt;br&gt; &#xA;Fields: &lt;code&gt;member&lt;/code&gt; (fieldtype users)&lt;br&gt;&#xA;        &lt;code&gt;function&lt;/code&gt; (plain text)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a working example with a Users field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for user in craft.users.id( craft.request.lastSegment ).limit(1) %}&#xA;    {% set commissions = craft.entries.section('commissions').relatedTo(user) %}&#xA;        {% for commission in commissions %}&#xA;            {{ commission.title }}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope you can point me in the right direction how to get it working with the matrix field&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2016-09-29T14:01:38.377" Title="Show on user profile page the commissions he is connected to" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;users&gt;&lt;fieldtypes&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17046" PostTypeId="2" ParentId="17045" CreationDate="2016-09-29T14:01:38.377" Score="2" Body="&lt;p&gt;You’d need to query for all Matrix Blocks the user is related to using a Matrix Block ElementCriteriaModel. Unfortunatelly this is not possible from the template level by default, you need to either install the plugin &lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow&quot;&gt;Low Blocks&lt;/a&gt;, or write some some lines of PHP in a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s how you would have to set the params for the Low Blocks function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userId = craft.request.lastSegment %}&#xA;{% set user = craft.users.id(userId).first() %}&#xA;&#xA;{% if not user %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% set matrixField = craft.fields.getFieldByHandle('commissionmembers') %}&#xA;&#xA;{% set blocks = craft.lowblocks.blocks.fieldId(matrixField.id).type('members').relatedTo({&#xA;    targetElement: userId,&#xA;    field: 'member',&#xA;}) %}&#xA;&#xA;{% for block in blocks %}&#xA;    {% set commission = block.getOwner() %}&#xA;&#xA;    {{ commission.title }}&#xA;    {{ block.function }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-09-29T14:01:38.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17047" PostTypeId="1" CreationDate="2016-09-29T14:22:09.590" Score="2" ViewCount="142" Body="&lt;p&gt;I'm trying to use custom order fields in Craft Commerce to store a reference to an object, but all I am getting back is an ElementCriteria model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two custom order fields defined: &lt;code&gt;twoDayOption&lt;/code&gt; and &lt;code&gt;fourDayOption&lt;/code&gt;. Both are events from Solspace Calendar (&lt;code&gt;Calendar_EventElementType&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Commerce -&gt; Orders page, I can set these fields with no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my product page I have a dropdown for selecting the values of each of these fields. They look pretty much the same. Here is the &lt;code&gt;twoDayOption&lt;/code&gt; one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[twoDayOption]&quot;&amp;gt;&#xA;    {%- for days in craft.calendar.events({calendar: 'workshops'}) -%}&#xA;        &amp;lt;option value=&quot;{{ days.id }}&quot;&amp;gt;{{ days.title }}&amp;lt;/option&amp;gt;&#xA;    {%- endfor -%}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After submitting the form the values for &lt;code&gt;twoDayOption&lt;/code&gt; and &lt;code&gt;fourDayOption&lt;/code&gt; seem to be lost. When I call &lt;code&gt;{{ dump( cart.twoDayOption) }}&lt;/code&gt; I get an object of type &lt;code&gt;Craft\ElementCriteriaModel&lt;/code&gt;. It references the &lt;code&gt;Calendar_EventElementType&lt;/code&gt;, but the ID that was submitted is not there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the first part of the output of that dump:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(Craft\ElementCriteriaModel)#757 (17) {&#xA;  [&quot;strictAttributes&quot;:protected]=&amp;gt;&#xA;  bool(false)&#xA;  [&quot;_elementType&quot;:&quot;Craft\ElementCriteriaModel&quot;:private]=&amp;gt;&#xA;  object(Craft\Calendar_EventElementType)#990 (7) {&#xA;    [&quot;componentType&quot;:protected]=&amp;gt;&#xA;    string(11) &quot;ElementType&quot;&#xA;    [&quot;_sourcesByContext&quot;:&quot;Craft\BaseElementType&quot;:private]=&amp;gt;&#xA;    NULL&#xA;    [&quot;_classHandle&quot;:&quot;Craft\BaseComponentType&quot;:private]=&amp;gt;&#xA;    NULL&#xA;[snip]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking through &lt;code&gt;Commerce_CraftController&lt;/code&gt;, I found that it calls &lt;code&gt;BaseElementModel-&amp;gt;setContentFromPost(&quot;fields&quot;)&lt;/code&gt; to set the custom order fields. I added in some logging statements to make sure it was getting the information I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it enters the method it finds these values from &lt;code&gt;$_POST['fields']&lt;/code&gt;:&#xA;    Array&#xA;    (&#xA;        [twoDayOption] =&gt; 16&#xA;        [fourDayOption] =&gt; 12&#xA;    )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is exactly whe I expect. It then finds the two custom field handles that match this. I have other logging statements that show what handle it's processing, and the value it gets from the POST:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/09/29 13:54:39 [info] [application] setContentFromPost twoDayOption&#xA;2016/09/29 13:54:39 [info] [application] setContentFromPost twoDayOption: 16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;setContentFromPost&lt;/code&gt; also gets the &lt;code&gt;fieldType&lt;/code&gt;, and calls &lt;code&gt;$fieldType-&amp;gt;prepValueFromPost&lt;/code&gt;. The value 16 is passed in, and 16 is returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, that value is put into &lt;code&gt;$this-&amp;gt;_content-&amp;gt;$handle&lt;/code&gt;, and I have a logging statement immediately after that verifies I can retrieve 16 from it. But when I log &lt;code&gt;$this-&amp;gt;twoDayOption&lt;/code&gt;, I'm getting the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm at a loss. It seems to know it's supposed to have a Calendar Event for that field. Should I not be passing in the ID? Is there another step I am missing?&lt;/p&gt;&#xA;" OwnerUserId="5693" LastActivityDate="2016-09-29T14:49:59.627" Title="Unable to store Model in Commerce Order Fields" Tags="&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17048" PostTypeId="1" AcceptedAnswerId="17049" CreationDate="2016-09-29T14:41:07.477" Score="1" ViewCount="55" Body="&lt;p&gt;&lt;em&gt;I already have a solution for this but am writing it up in case others run into the same issue.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After creating a new user, &lt;em&gt;my&lt;/em&gt; email address was showing up as the username of the new user. (This site uses email addresses as the username; &lt;code&gt;useEmailAsUsername&lt;/code&gt; is set to true in config/general.php.) Here's how it looked in the user list:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://monosnap.com/file/3IhesgfS95FQmQPP3OQ2FCw65uHQAN.png&quot; alt=&quot;Admin email showing up as new user username&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also showed up on the user page: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://monosnap.com/file/JgoxLd9AkR0MaX462K0jrickQIc8sK.png&quot; alt=&quot;User card&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I might have stumbled on a bug related to &lt;code&gt;useEmailAsUsername&lt;/code&gt;. Silly me. Craft support (hi, Brad) wasn't able to reproduce it and suggested it might be an auto-fill browser extension misbehaving. Sure enough…&lt;/p&gt;&#xA;" OwnerUserId="4748" LastActivityDate="2016-09-29T14:41:07.477" Title="LastPass causing incorrect email address to be saved in new user form" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17049" PostTypeId="2" ParentId="17048" CreationDate="2016-09-29T14:41:07.477" Score="2" Body="&lt;p&gt;After disabling my password manager, LastPass, my email address stopped sneaking into the username field. Upon closer inspection, here's what was happening:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After filling out the new user form and clicking 'Save,' you are prompted for your password. &lt;strong&gt;THIS&lt;/strong&gt; is where LastPass misbehaves, or more accurately, does what it's designed to do but not very helpfully. It not only fills the password input, but replaces the contents of the 'Username' field with &lt;em&gt;your&lt;/em&gt; email address (that is, the email address associated with the login stored in LastPass). It's easy to miss this, however, with the transluscent white overlay.&#xA;&lt;img src=&quot;https://monosnap.com/file/PrADrCO9SEVyDnEXtCaMpddkL6mSQQ.png&quot; alt=&quot;Craft password dialog - LastPass inserts wrong email address&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Configuring LastPass to not fill forms on the new user page isn't helpful, as you likely want it to enter your password when prompted. The best solution I could come up with is to clone my Craft login, delete the email address / username, and add 'New User' to the label. Now when prompted for the password I can select &lt;em&gt;that&lt;/em&gt; login and avoid overwriting the new user's email address.&lt;/p&gt;&#xA;" OwnerUserId="4748" LastActivityDate="2016-09-29T14:41:07.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17050" PostTypeId="2" ParentId="17047" CreationDate="2016-09-29T14:49:59.627" Score="4" Body="&lt;p&gt;When you assign element IDs to a relation field you need to pass the data in an array format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this related answer: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1264/in-a-plugin-how-do-i-save-an-entry-with-a-related-entry&quot;&gt;In a plugin, how do I save an entry with a related entry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Key information in that answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[customTextField]&quot; value=&quot;My Text Data&quot;&amp;gt; &#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[customRelationField][]&quot; value=&quot;101&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in the input field name of 'customRelationField' relations field we are passing an array: &lt;code&gt;fields[customRelationField][]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note the relation field data is a full replace. So if you ever want to add an element ID to an existing relation field that has relation already set, you need to get the existing IDs as an array and add your additional IDs when updating the field.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-09-29T14:49:59.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17051" PostTypeId="1" CreationDate="2016-09-29T15:48:48.803" Score="1" ViewCount="137" Body="&lt;p&gt;I'm using Redactor 2 and I set config &lt;code&gt;air: true&lt;/code&gt; and &lt;code&gt;plugin: ['codemirror']&lt;/code&gt;.&#xA;The issue is when I click on html button the air toolbar disappears and is not possible to have toolbar on redactor again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5646" LastEditorUserId="57" LastEditDate="2016-09-29T17:20:46.767" LastActivityDate="2017-11-28T23:43:22.567" Title="Redactor air not visible when code mirror is enabled" Tags="&lt;redactor&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17052" PostTypeId="2" ParentId="17051" CreationDate="2016-09-29T16:01:40.803" Score="1" Body="&lt;p&gt;I found a quick solution to show toolbar when hover code mirror&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; callbacks: {   &#xA;   init: function() {    &#xA;   $('.CodeMirror-scroll').on('hover',function(){&#xA;         $('.redactor-air').css('display','block');       &#xA;          });&#xA;       } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the issue is the same when i have more then one redactor in same page, because it shows both toolbar...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on this ?&#xA;Thanks &lt;/p&gt;&#xA;" OwnerUserId="5646" LastEditorUserId="5646" LastEditDate="2016-09-29T16:30:28.790" LastActivityDate="2016-09-29T16:30:28.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17053" PostTypeId="2" ParentId="17043" CreationDate="2016-09-29T17:43:10.760" Score="1" Body="&lt;p&gt;If the &lt;code&gt;UserModel&lt;/code&gt; contains a user ID, then the existing user will be &lt;em&gt;updated&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;UserModel&lt;/code&gt; does not contain a user ID, then a new user will be &lt;em&gt;created&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, the &lt;code&gt;UserModel&lt;/code&gt; will contain an ID after being saved. Since models in PHP are passed by reference, the ID will get set automatically for new users.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-09-29T17:43:10.760" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17054" PostTypeId="1" CreationDate="2016-09-29T18:57:11.640" Score="1" ViewCount="160" Body="&lt;p&gt;I am posting this in case anyone will encounter this problem. I also reported a potential bug about that. (see here: &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you start to suddenly get redirection loops with HTTP-302 redirects to our own page, you might want to check your loginPath value in general.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we spent hours investigating into the usual .htaccess and other places for redirection loops, we eventually figured out, that loginPath set to '/' will cause that behaviour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We wanted to redirect users to the homepage if they were not logged in and tried to access a page that required a login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our setting was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'loginPath' =&amp;gt; '/'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which proved to cause the redirection loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct setting instead was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'loginPath' =&amp;gt; ''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this saves somebody else from future pain :)&lt;/p&gt;&#xA;" OwnerUserId="5694" LastEditorUserId="57" LastEditDate="2018-03-28T23:50:22.287" LastActivityDate="2018-03-28T23:50:22.287" Title="Page redirects permanently to itself" Tags="&lt;config&gt;&lt;redirect&gt;&lt;loop&gt;&lt;https&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-09-29T19:12:14.997" ContentLicense="CC BY-SA 3.0" />
  <row Id="17055" PostTypeId="2" ParentId="17054" CreationDate="2016-09-29T18:57:56.860" Score="0" Body="&lt;p&gt;Answer is provided in the original post and this can be assumed solved.&lt;/p&gt;&#xA;" OwnerUserId="5694" LastActivityDate="2016-09-29T18:57:56.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17056" PostTypeId="1" CreationDate="2016-09-29T19:43:30.697" Score="0" ViewCount="134" Body="&lt;p&gt;I am using the Charge plugin and am not able to pass the customer name to Stripe. The form field name I am using is &quot;customerName&quot; and I have successfully done this in the past - it shows up in the Craft CP, but not in the Stripe account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="45" LastEditDate="2016-09-29T19:47:07.683" LastActivityDate="2016-09-29T19:47:07.683" Title="Field name for customer name in Squarebit Charge for Stripe" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17057" PostTypeId="2" ParentId="426" CreationDate="2016-09-29T23:08:47.407" Score="3" Body="&lt;p&gt;Craft CMS plugin that does exactly this: &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow&quot;&gt;https://github.com/benjamminf/craft-embedded-assets&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="963" LastActivityDate="2016-09-29T23:08:47.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17058" PostTypeId="1" AcceptedAnswerId="17062" CreationDate="2016-09-30T02:17:45.373" Score="2" ViewCount="269" Body="&lt;p&gt;So I have been using &lt;a href=&quot;https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; CSS Tricks responsive video trick for years. The problem I'm having is that this new Craft site I built imported data over from EE into a single Redactor field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to run s conditional check that &lt;code&gt;if&lt;/code&gt; there is a YouTube video embedded that would wrap a &lt;code&gt;div&lt;/code&gt; around said content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm probably asking too much but Craft has been amazing for the past few years I've using it. I fear the only way to do this would be to run an elaborate &lt;code&gt;MYSQL&lt;/code&gt; commands to wrap that content in a &lt;code&gt;div&lt;/code&gt; (or use JS to wrap each iframe) but I would love to be proven wrong!&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2019-08-31T21:22:56.587" Title="If YouTube in Redactor Then Wrap in Div" Tags="&lt;conditional&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17059" PostTypeId="1" AcceptedAnswerId="17086" CreationDate="2016-09-30T03:56:22.717" Score="1" ViewCount="337" Body="&lt;p&gt;I am using DUKT's Twitter 1.0.32 but am fresh at reading APIs, so would like a little help. &#xA;I would like to request tweets with image only from our main ID.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set tweets = craft.twitter.get('statuses/user_timeline', {count:3}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine, but even an attempt to play around with the other parameters within user_timeline baffles me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I ask for some examples to display tweet text &amp;amp; image, plus some other relevant parameters?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-10-03T07:44:58.023" Title="Twitter API request for images with DUKT twitter" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17060" PostTypeId="1" CreationDate="2016-09-30T05:17:58.770" Score="4" ViewCount="451" Body="&lt;p&gt;I'm facing a problem which, on the surface, seems similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11170/cannot-grant-user-group-plugin-permission-without-hascpsection&quot;&gt;this thread...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like that other thread, I've found that a specific user group is unable to access my plugin's pages because the plugin is lacking a &lt;a href=&quot;https://craftcms.com/docs/plugins/templates#giving-your-plugin-its-own-cp-section&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;hasCpSection&lt;/code&gt;&lt;/a&gt; method. My plugin doesn't &lt;em&gt;need&lt;/em&gt; a &lt;code&gt;hasCpSection&lt;/code&gt; method, because there really isn't a &quot;section&quot; for people to access. Specifically, &lt;strong&gt;I don't need a link in the side nav, because my plugin doesn't have a main index page.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my plugin &lt;em&gt;does&lt;/em&gt; have other pages. These other pages are only accessible via special links. Those special links appear on Entry edit pages, as a custom Fieldtype. &lt;strong&gt;These random pages are what I want my client to have access to.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/55RWL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/55RWL.png&quot; alt=&quot;&amp;quot;Unauthorized&amp;quot; message&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's where I'm unable to use the solution provided in the related thread. Because when I link directly to a template, &lt;strong&gt;those pages are restricted by default.&lt;/strong&gt; There's no way for me to &quot;allow anonymous&quot;. I would have to give the user group full admin access (which is crazy), and &lt;em&gt;then&lt;/em&gt; circle back and restrict permissions on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? This kinda feels like a bug to me, or perhaps a feature request.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-09-30T08:52:26.207" Title="Allow a User Group to access plugin pages (without hasCpSection)" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;control-panel&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17061" PostTypeId="1" AcceptedAnswerId="17067" CreationDate="2016-09-30T05:39:15.843" Score="2" ViewCount="147" Body="&lt;p&gt;I'm working with Craft Commerce with a set of individual items in a product type and in another, I have packaged sets of the same. The sets (cardSets) have a relation field to select the required individual cards. The code is in the product entry template for the individual card and my intention is to highlight that the single card can be purchased in a set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code to do a simple reverse relationship but I can't get this to work and I'm not sure if I've got the syntax correct. I'm not seeing any return or error. How do I know if I'm getting an object back? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedProduct = craft.commerce.products({&#xA;    type: 'cardSets',&#xA;    relatedTo: {&#xA;        targetElement: product,&#xA;        field: 'productsInSet'&#xA;        }&#xA;}) %}&#xA;&#xA;{{ relatedProduct.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4962" LastEditorUserId="57" LastEditDate="2016-09-30T15:17:09.430" LastActivityDate="2016-09-30T15:17:09.430" Title="Reverse relationship in Craft Commerce?" Tags="&lt;relations&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17062" PostTypeId="2" ParentId="17058" CreationDate="2016-09-30T05:51:31.187" Score="4" Body="&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon&lt;/a&gt; plugin! &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Retcon is a small Craft CMS plugin offering a series of easy-to-use Twig filters for manipulating HTML content.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Specifically, it sounds like you need the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Wrap&quot; rel=&quot;nofollow&quot;&gt;wrap&lt;/a&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconWrap('iframe', '.videoWrapper') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="1098" LastEditDate="2016-09-30T07:00:25.523" LastActivityDate="2016-09-30T07:00:25.523" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17063" PostTypeId="1" AcceptedAnswerId="17068" CreationDate="2016-09-30T06:29:50.890" Score="1" ViewCount="485" Body="&lt;p&gt;I am considering using Craft to develop a website for a client.&#xA;One of the requirements is that members have access tot he backend to edit a single entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the use case:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;entry is created manually by admins, unpublished&lt;/li&gt;&#xA;&lt;li&gt;members are in a group with &quot;editEntries:[SectionID]&quot; permission only (no create, delete and others)&lt;/li&gt;&#xA;&lt;li&gt;members edit their entry and submit for review/approval&lt;/li&gt;&#xA;&lt;li&gt;admins publish the entry&lt;/li&gt;&#xA;&lt;li&gt;members come back and edit the entry if necessary and submit for review/approval of changes&lt;/li&gt;&#xA;&lt;li&gt;admin reviews changes and amend or approves the changes&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The question is what would be the best way to achieve the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a member comes back, edits and submits the entry (step 5), it create a new revision for review/approval by admins (step 6), &lt;strong&gt;but keeps the current revision published in the frontend&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="5698" LastActivityDate="2016-09-30T09:27:22.767" Title="Entry publishing workflow" Tags="&lt;entries&gt;&lt;users&gt;&lt;permissions&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17064" PostTypeId="1" CreationDate="2016-09-30T08:10:49.430" Score="0" ViewCount="46" Body="&lt;p&gt;Is it possible to render the search time after a query (out-of-the-box)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg: 2 results(.0271 seconds)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of plugins available but I would like to find out what's possible within Craft's core.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-09-30T09:35:06.017" Title="Time to search query" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17065" PostTypeId="1" AcceptedAnswerId="17070" CreationDate="2016-09-30T08:17:47.313" Score="1" ViewCount="27" Body="&lt;p&gt;Following block in &lt;code&gt;generateColumnDefinition($config)&lt;/code&gt; function in &lt;code&gt;DbHelper.php&lt;/code&gt; class is always converting default value to int if it is a numeric value. A numeric value can be a float so this is causing an issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (isset($config['default']) &amp;amp;&amp;amp; (is_string($config['default']) || is_bool($config['default']) || is_numeric($config['default'])))&#xA;{&#xA;    if (is_string($config['default']) &amp;amp;&amp;amp; !is_numeric($config['default']))&#xA;    {&#xA;        $def .= ' DEFAULT &quot;'.$config['default'].'&quot;';&#xA;    }&#xA;    else&#xA;    {&#xA;        $def .= ' DEFAULT '.(int)$config['default'];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I can override this method? Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="5699" LastEditorUserId="57" LastEditDate="2016-09-30T15:18:44.077" LastActivityDate="2016-09-30T15:18:44.077" Title="Attribute default value is always being saved as an int" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17066" PostTypeId="2" ParentId="17060" CreationDate="2016-09-30T08:39:50.183" Score="2" Body="&lt;p&gt;Register new user permissions to restrict access to those pages using the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerUserPermissions&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;registerUserPermissions&lt;/code&gt;&lt;/a&gt; hook.&#xA;Then use &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerCpRoutes&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;registerCpRoutes&lt;/code&gt;&lt;/a&gt; to setup routes to a controller action which checks for required user permissions before rendering the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if I’m missing something, but I don’t see how this has anything to do with the &lt;code&gt;hasCpSection&lt;/code&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-09-30T08:52:26.207" LastActivityDate="2016-09-30T08:52:26.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17067" PostTypeId="2" ParentId="17061" CreationDate="2016-09-30T09:18:01.720" Score="2" Body="&lt;p&gt;When you use the &lt;code&gt;craft.commerce.products&lt;/code&gt; tag, it will return a criteria model, but you are treating it as the first result by accessing the title attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;{{ relatedProduct.first().title }}&lt;/code&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-09-30T09:18:01.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17068" PostTypeId="2" ParentId="17063" CreationDate="2016-09-30T09:27:22.767" Score="2" Body="&lt;p&gt;With a mixture of the permissions you mention above and user groups, you should be able to use the &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow&quot;&gt;Workflow&lt;/a&gt; plugin to get the results you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-09-30T09:27:22.767" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17069" PostTypeId="2" ParentId="17064" CreationDate="2016-09-30T09:35:06.017" Score="2" Body="&lt;p&gt;You can easily measure the time your request takes using JS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this Stack Overflow question for example code: &lt;a href=&quot;https://stackoverflow.com/questions/3498503/find-out-how-long-an-ajax-request-took-to-complete&quot;&gt;https://stackoverflow.com/questions/3498503/find-out-how-long-an-ajax-request-took-to-complete&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var start_time = new Date().getTime();&#xA;&#xA;jQuery.get('your-url', data, &#xA;    function(data, status, xhr) {&#xA;        var request_time = new Date().getTime() - start_time;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-09-30T09:35:06.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17070" PostTypeId="2" ParentId="17065" CreationDate="2016-09-30T09:54:20.067" Score="1" Body="&lt;p&gt;You can’t override that method from a plugin, if you really think it should be changed I’d suggest to file a feature request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround you could try to set a default manually before the attribute is stored to the database or before the value is used. If it’s for a custom field type you could look into utilizing &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/IFieldType#prepValue-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;prepValue&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/IFieldType#prepValueFromPost-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;prepValueFromPost&lt;/code&gt;&lt;/a&gt; for example.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-09-30T09:54:20.067" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17071" PostTypeId="1" AcceptedAnswerId="17072" CreationDate="2016-09-30T11:32:27.667" Score="6" ViewCount="675" Body="&lt;p&gt;I'm seeing a lot of goodies among the v3 infos, but not much about how licensing will work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if my client has a paid license will they get v3 for free or as a paid upgrade. If paid will it be a full price or a discounted? &lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2017-10-31T20:03:32.490" Title="Will the v3 upgrade be free?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17072" PostTypeId="2" ParentId="17071" CreationDate="2016-09-30T13:11:51.833" Score="8" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/pricing&quot; rel=&quot;nofollow noreferrer&quot;&gt;All Craft CMS updates are free of charge&lt;/a&gt; - including major versions. In other words, Craft 3 will be a free upgrade.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As announced under &lt;a href=&quot;http://dotall.com/2017&quot; rel=&quot;nofollow noreferrer&quot;&gt;DotAll 2017&lt;/a&gt;, following the release of Craft 3 in April 2018, P&amp;amp;T is changing the pricing model for Craft CMS. In order to stay updated, Craft 3 sites will have to renew their license yearly (for a reduced fee; $39/year for Client edition, $59/year for Pro) in order to continue to receive updates after the first year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;em&gt;Craft 3 will still be a free upgrade for Craft 2 licenses purchased before the release of Craft 3&lt;/em&gt;, as these licenses will be exempt from the yearly updating fee and will continue to receive free updates indefinitely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://craftcms.com/news/dot-all-2017-announcements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/dot-all-2017-announcements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-10-31T20:03:32.490" LastActivityDate="2017-10-31T20:03:32.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17073" PostTypeId="1" AcceptedAnswerId="17074" CreationDate="2016-09-30T13:27:32.853" Score="1" ViewCount="369" Body="&lt;p&gt;How can I pull out other entries related by tag using the Element API?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular case I'm using the &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow&quot;&gt;Similar&lt;/a&gt; plugin to pull out related entries by tag in the templates. I'm not sure if this would help to provide an easier way or not...?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2016-09-30T18:09:35.243" Title="Element API: List entries related by tag" Tags="&lt;tags&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17074" PostTypeId="2" ParentId="17073" CreationDate="2016-09-30T16:06:03.723" Score="1" Body="&lt;p&gt;The Similar plugin allows access to its &lt;code&gt;find()&lt;/code&gt; method from PHP and your Element API configuration file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$similarEntriesByTags = craft()-&amp;gt;similar-&amp;gt;find([&#xA;    element =&amp;gt; $entry,&#xA;    context =&amp;gt; $entry-&amp;gt;tags,&#xA;    criteria =&amp;gt; $limitCriteria,&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the equivalent to the Twig example code in the readme.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you’re inexperienced in quering for entries or using element criteria in PHP in general have a look a the &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow&quot;&gt;Working with Elements&lt;/a&gt; article in the Craft documentation.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-09-30T18:09:35.243" LastActivityDate="2016-09-30T18:09:35.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17075" PostTypeId="1" AcceptedAnswerId="17077" CreationDate="2016-09-30T21:24:41.000" Score="1" ViewCount="286" Body="&lt;p&gt;I am using the profile photo on users' posts (author image) and I would like to provide a link to download a larger image. I am currently able to get the &quot;full&quot; size of the cropped image like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.author.getPhotoUrl('original') }}&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get to the image that &lt;em&gt;looks&lt;/em&gt; like is stored here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/storage/userphotos/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-10-01T03:42:19.880" Title="How can I access the raw profile photo for any given user?" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;author&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17076" PostTypeId="1" AcceptedAnswerId="17078" CreationDate="2016-10-01T00:51:36.233" Score="2" ViewCount="162" Body="&lt;p&gt;I'm trying to figure out if there's a way to either treat product variants as ww.site.com/product/variant or pass variables from a variant list (for example thumbnails that click to product and passes along variables for the layout of that page). Any takers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming it would be better to create a category &gt; sub-category &gt; product. Just would be great to have the same product information but be able to point to .com/pillow/green whilst returning the same basic product information.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2016-10-01T04:59:42.540" Title="Is there a way to treat variants in a similar way as products?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17077" PostTypeId="2" ParentId="17075" CreationDate="2016-10-01T03:42:19.880" Score="2" Body="&lt;p&gt;As you've discovered, you can get the full cropped version of the image with &lt;code&gt;author.getPhotoUrl('original')&lt;/code&gt;, but Craft doesn't keep a copy of the original un-cropped version of the image around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17075/how-can-i-access-the-raw-profile-photo-for-any-given-user#comment23612_17075&quot;&gt;Lindsey is more than 60% correct&lt;/a&gt;... user photos are &lt;a href=&quot;https://craftcms.com/3/changelog#build2915&quot; rel=&quot;nofollow&quot;&gt;1st class Asset citizens&lt;/a&gt; in Craft 3, making this less awkward.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-01T03:42:19.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17078" PostTypeId="2" ParentId="17076" CreationDate="2016-10-01T04:59:42.540" Score="2" Body="&lt;p&gt;Put simply, if you define the url for your product type as, say,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;products/{categories.first().slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...then if you visit this url (&lt;code&gt;products/pillows/my-pretty-pillow&lt;/code&gt;) you would perhaps loop through and show all variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they hit a url like &lt;code&gt;products/pillows/my-pretty-pillow/green&lt;/code&gt; (to make this url work you'd need to define a route to point at the same template I think -&gt; &lt;code&gt;products/pillows/*/*&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....then you can simple look at &lt;code&gt;craft.request.getSegment(4)&lt;/code&gt; and use that to determine which specific variant to show at that url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is  much the same question actually:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12708/how-do-i-select-a-specific-product-variant-by-element-field-entry&quot;&gt;How do I select a specific product variant by element/field/entry?&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-10-01T04:59:42.540" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="17079" PostTypeId="1" AcceptedAnswerId="17080" CreationDate="2016-10-01T14:16:11.007" Score="0" ViewCount="314" Body="&lt;p&gt;I've set up a structure channel that has entries at /services/slug however I want the /services template to redirect to the first entry in the services structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have now is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('services').limit(1) %}&#xA;  {% redirect '{{ entry.url }}' %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when visiting /services this redirects to a 404 page with url of &lt;code&gt;/%7B%7B%20entry.url%20%7D%7D/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried {% redirect &quot;services/{{ entry.slug }}&quot; %} but that didn't work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set up a redirect in the way that I am trying to do here?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-10-01T14:39:54.820" Title="{% redirect &quot;{{ entry.url }}&quot; %} doesn't work" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17080" PostTypeId="2" ParentId="17079" CreationDate="2016-10-01T14:39:54.820" Score="8" Body="&lt;p&gt;You do not use the {{ }} inside other brackets you also should not use ' ' unless it is a specific string you want interpreted. Try instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('services').limit(1) %}&#xA;     {% redirect entry.url %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you should be good to go&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-10-01T14:39:54.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17081" PostTypeId="1" CreationDate="2016-10-01T21:38:11.660" Score="3" ViewCount="70" Body="&lt;p&gt;I'm writing a custom plugin, and I want to specify a custom order of the Fields in a tab. My plugin installs several fields, and I want the user to be able to simply add the tab that contains my fields, and not worry about shuffling the fields into their proper order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now it's ordering my fields alphabetically. Is there a way to specify this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated! I &lt;em&gt;think&lt;/em&gt; it might have something to do with creating a Field Layout Model for my plugin, but I'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, I'm talking about specifying a custom order this area:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TxYtT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxYtT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2016-10-01T21:38:11.660" Title="Set default order of Custom Fields inside Layout Tab" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17082" PostTypeId="1" AcceptedAnswerId="17084" CreationDate="2016-10-02T07:22:23.597" Score="3" ViewCount="130" Body="&lt;p&gt;I am working on a testimonial slider and each slide is wrapped in an &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; tag. The JS looks for a similar id number, one for each layer of the slide, in this case I need to change the 1 in the example below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;rs-1&quot;&#xA;id=&quot;slide-1-layer-2&quot; &#xA;id=&quot;slide-1-layer-3&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I loop through the entries with a normal {% for %}{% endfor %} statement and I tried rendering the required number (1) with the {{ loop.index }} but I guess you can only use this once...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a method do this? Perhaps with Twig? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am not clear this is what the result should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&quot;rs-1&quot;&#xA;        id=&quot;slide-1-layer-2&quot; &#xA;        id=&quot;slide-1-layer-3&quot; &#xA;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&quot;rs-2&quot;&#xA;        id=&quot;slide-2-layer-2&quot; &#xA;        id=&quot;slide-2-layer-3&quot; &#xA;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&quot;rs-3&quot;&#xA;        id=&quot;slide-3-layer-2&quot; &#xA;        id=&quot;slide-3-layer-3&quot; &#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc...&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="103" LastEditDate="2016-10-03T19:01:23.160" LastActivityDate="2016-10-03T19:01:33.143" Title="How to add a unique number for each reiteration and render it multiple times?" Tags="&lt;count&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17084" PostTypeId="2" ParentId="17082" CreationDate="2016-10-02T08:59:34.490" Score="6" Body="&lt;p&gt;Set it as a variable inside your loop and you can reuse it all you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in craft.entries.section('yourSection') %}&#xA;    {% set loopIndex = loop.index %}&#xA;    &amp;lt;li&amp;gt;&quot;rs-{{loopIndex}}&quot; id=&quot;slide-{{loopIndex}}-layer-2&quot;&amp;lt;/li&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="103" LastEditDate="2016-10-03T19:01:33.143" LastActivityDate="2016-10-03T19:01:33.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17085" PostTypeId="1" CreationDate="2016-10-02T09:00:07.510" Score="2" ViewCount="332" Body="&lt;p&gt;I'm building a craftcommerce based site, where each item added to the cart must be individually customised through a wizard interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the item first gets added to the cart, I'd like to immediately redirect to a page where we can customise the item further&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like the redirect shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/item?item={id}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;{{ &quot;Buy&quot;|t }}&quot; class=&quot;btn btn-default&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is possible with user form submission for instance, where the newly created user id is accessible via the method described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how I would go about doing this?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2016-10-02T16:51:29.803" Title="Craft Commerce: After add to cart, redirect to specific line item" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17086" PostTypeId="2" ParentId="17059" CreationDate="2016-10-02T09:09:30.380" Score="1" Body="&lt;p&gt;I have used it like this. You can find the documentation for most fields on &lt;a href=&quot;https://dev.twitter.com/overview/api/tweets&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;. Truth be told, the DUKT documentation is not too transparent.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('statuses/user_timeline', { user_id:'', count: 10, trim_user: false }) %}&#xA;{% if tweets %}&#xA;    &amp;lt;ul class=&quot;tweet__list&quot;&amp;gt;&#xA;        {% for tweet in tweets %}&#xA;        &amp;lt;li&quot;&amp;gt;&#xA;           &amp;lt;img src=&quot;{{ tweet.user.profile_image_url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;           &amp;lt;p&amp;gt;{{tweet.text|autoLinkTweet}}&amp;lt;/p&amp;gt;&#xA;           &amp;lt;span class=&quot;date&quot;&amp;gt;{{ tweet.created_at | twitterTimeAgo )}&amp;lt;/span&amp;gt;        &#xA;        &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have several entities in the data you get back from Twitter API (as described by Twitter):  media, urls, user_mentions, hashtags, and symbols. The DUKT plugin, however only gives back urls, user_mentions, hashtags, and symbols as far as I see in the error messages they provide. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {{tweet.entities}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2016-10-03T07:44:58.023" LastActivityDate="2016-10-03T07:44:58.023" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17087" PostTypeId="2" ParentId="17085" CreationDate="2016-10-02T09:11:01.893" Score="2" Body="&lt;p&gt;I created a simple plugin to redirect using the &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart&quot; rel=&quot;nofollow&quot;&gt;onAddToCart method&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  craft()-&amp;gt;on('commerce_cart.onAddToCart', function($event){&#xA;&#xA;      $lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;      craft()-&amp;gt;request-&amp;gt;redirect(&quot;/commerce/item/?item=&quot; . $lineItem-&amp;gt;id);&#xA;&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="100" LastEditorUserId="57" LastEditDate="2016-10-02T16:51:29.803" LastActivityDate="2016-10-02T16:51:29.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17088" PostTypeId="1" AcceptedAnswerId="17106" CreationDate="2016-10-02T11:04:35.430" Score="1" ViewCount="353" Body="&lt;p&gt;I have the following code to further validate passwords when creating/registering an account which is working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when trying to use this same validation for resetting a password I am not getting any errors back?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction...?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforeSetPassword(Event $event)&#xA;{&#xA;    $user = $event-&amp;gt;params['user'];&#xA;    $password = $event-&amp;gt;params['password'];&#xA;&#xA;    if (mb_strlen($password) &amp;lt; 8)&#xA;    {&#xA;        $user-&amp;gt;addError('password', 'Sorry but your password must be at least 8 characters.');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;&#xA;    if (!preg_match('/(\d.*[A-Z]|[A-Z].*\d)/', $password))&#xA;    {&#xA;        $user-&amp;gt;addError('password', 'Sorry but your password must contain at least one uppercase letter and one number.');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if account is defined and account.getErrors('password') %}&#xA;    {% include '_includes/formError' with { error : account.getErrors('password')|join('&amp;lt;br&amp;gt;') } %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-10-02T16:52:19.570" LastActivityDate="2016-10-04T18:04:10.827" Title="Password validation for resetting password" Tags="&lt;users&gt;&lt;registration&gt;&lt;validation&gt;&lt;password&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17089" PostTypeId="1" CreationDate="2016-10-02T17:22:20.610" Score="3" ViewCount="5740" Body="&lt;p&gt;Hope you guys can help. I was working on my Craft site locally and now trying to upload it to the server but no matter what it says &quot;Craft can’t connect to the database with the credentials in craft/config/db.php&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created the database in phpmyadmin along with the username and password. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also my hosting provider is HostGator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have locally for the &lt;code&gt;db.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;    'server' =&amp;gt; 'localhost',&#xA;&#xA;    // The name of the database to select.&#xA;    'database' =&amp;gt; 'simple-portfolio',&#xA;&#xA;    // The database username to connect with.&#xA;     'user' =&amp;gt; 'portfolio-rc',&#xA;&#xA;    // The database password to connect with.&#xA;    'password' =&amp;gt; 'r*****',&#xA;&#xA;    // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the server's &lt;code&gt;db.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;    'server' =&amp;gt; 'localhost',&#xA;&#xA;    // The name of the database to select.&#xA;    'database' =&amp;gt; 'rchohan9_website',&#xA;&#xA;    // The database username to connect with.&#xA;    'user' =&amp;gt; 'rchohan9_portfol',&#xA;&#xA;    // The database password to connect with.&#xA;    'password' =&amp;gt; 'p************',&#xA;&#xA;    // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also the whole site is put in a folder so its not sitting in the root directory&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally &lt;code&gt;general.php&lt;/code&gt; looks like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://localhost/portfolio',&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'baseUrl'  =&amp;gt; 'http://localhost/portfolio/',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and on the server it's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://rachnachohan.ca/website',&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'baseUrl'  =&amp;gt; 'http://rachnachohan.ca/website/',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am completely out of ideas of why its not able to connect to the db.&lt;/p&gt;&#xA;" OwnerUserId="5448" LastEditorUserId="57" LastEditDate="2016-10-02T20:52:40.940" LastActivityDate="2021-02-26T15:20:10.610" Title="Craft can't connect to db" Tags="&lt;database&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17090" PostTypeId="1" CreationDate="2016-10-02T21:21:30.570" Score="1" ViewCount="49" Body="&lt;p&gt;I have built a credit system that is working great. My original plan was to use the &lt;code&gt;onOrderComplete&lt;/code&gt; event, but it turns out after testing I need to update the user's credits &lt;em&gt;before&lt;/em&gt; they actually pay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, A user could have one credit, but have two items in their cart. Or, have a quantity of two of any given item. Either way, the user does not have enough credits, and will have to pay for one of the items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I am updating the user's credits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the user's credit entry to find out how many credits they have left.&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = craft()-&amp;gt;config-&amp;gt;get('section', 'myplugin');&#xA;$criteria-&amp;gt;authorId = $user-&amp;gt;id;&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;limit = 1;&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;...&#xA;&#xA;craft()-&amp;gt;on('commerce_discounts.onBeforeMatchLineItem', function ($event) {&#xA;&#xA;    foreach ($entries as $entry) {&#xA;        if ((int)$entry-&amp;gt;qualifyingItem &amp;gt; 0) {&#xA;            $entry-&amp;gt;setContentFromPost([&#xA;                'qualifyingItem' =&amp;gt; ((int)$entry-&amp;gt;qualifyingItem &amp;gt; 0) ? ((int)$entry-&amp;gt;qualifyingItem - (int)$lineItem-&amp;gt;qty) : 0&#xA;            ]);&#xA;&#xA;            error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'CREDITS LEFT: ' . (int)$entry-&amp;gt;qualifyingItem : '');&#xA;&#xA;            if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;                error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'SUCCESS: credits successfully updated.' : '');&#xA;            } else {&#xA;                error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'ERROR: Could not update the user\'s credits.' : '');&#xA;            }&#xA;        } else {&#xA;            $event-&amp;gt;performAction = false;&#xA;            error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'Uh - oh: User is out of credits . ' : '');&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it seems the credits are working a bit &lt;em&gt;too&lt;/em&gt; well. Either everything is &quot;free&quot; or the user has to pay for everything. I am having trouble figuring out how to allow one item be &quot;free&quot; and the other is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-10-02T21:21:30.570" Title="How can I split a discount/line item during checkout?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17091" PostTypeId="1" CreationDate="2016-10-03T08:11:33.450" Score="1" ViewCount="372" Body="&lt;p&gt;I can use &lt;code&gt;{product.slug}&lt;/code&gt; for generating Auto SKU but does anyone know how to use the Product ID&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;SKU{product.id}&lt;/code&gt; the create product form won't submit because no SKU is generated. I think it might be because there's an error there but I can't see anything in the logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using just &lt;code&gt;SKU{id}&lt;/code&gt; allows the form to submit but the result is just &quot;SKU&quot;, so it isn't fetching the product id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;ID&lt;/code&gt; and &lt;code&gt;id&lt;/code&gt; in both cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure this should work. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-10-03T08:22:11.547" LastActivityDate="2016-10-04T01:16:43.230" Title="Craft Commerce auto SKU with product ID" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17093" PostTypeId="1" CreationDate="2016-10-03T13:50:32.783" Score="1" ViewCount="127" Body="&lt;p&gt;I have a structure with 3 levels.&lt;/p&gt;&#xA;&lt;p&gt;The first 2 levels are for structuring the content and most of the content comes from the 3.rd level.&#xA;This 3.rd level are the entries which are written by different authors.&lt;/p&gt;&#xA;&lt;p&gt;I now want to display all entries written by a certain author.&lt;/p&gt;&#xA;&lt;p&gt;The output i’m looking for would be like this:&#xA;2017 / 01 / 3rd Level entry title&lt;/p&gt;&#xA;&lt;p&gt;2017 -&amp;gt; title of 1st level entry&lt;/p&gt;&#xA;&lt;p&gt;01   -&amp;gt; Index of 2nd level entry&lt;/p&gt;&#xA;&lt;p&gt;title -&amp;gt; title of 3rd level entry&lt;/p&gt;&#xA;&lt;p&gt;I struggle with displaying the index of the 2nd level entry. I didn’t find a field in the database which stores the index of an entry.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know how to get the index of a certain entry?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SgnJa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SgnJa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5247" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-05-09T21:02:55.430" Title="How to get the order index of a structure entry?" Tags="&lt;templating&gt;&lt;structure&gt;&lt;order&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17095" PostTypeId="1" CreationDate="2016-10-03T16:16:01.510" Score="0" ViewCount="83" Body="&lt;p&gt;Any thoughts on the best way (if at all) of bulk-migrating content within a site from one locale to another? We have a large(ish) site and want to streamline into a single locale. This means moving a load of content from one locale to another so appreciate any thoughts on how this might be achieved - if at all!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-10-03T16:16:01.510" Title="Locale migration …" Tags="&lt;localization&gt;&lt;migration&gt;&lt;content&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17096" PostTypeId="2" ParentId="14382" CreationDate="2016-10-03T18:19:33.017" Score="1" Body="&lt;p&gt;Here's another way to avoid the &quot;saveEntry&quot; infinite loop. I like to have a method in a service class that my plugin that can reuse over and over again to update entry values. As you can see, we avoid unnecessary statics and clutter in the plugin init() method.&#xA;The main thing to point out is the use of &quot;saveElement()&quot; instead of &quot;saveEntry()&quot; which is the key to not triggering the saveEntry event endlessly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Plugin Init&#xA; */&#xA;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    // triggers&#xA;    craft()-&amp;gt;on('entries.saveEntry', array($this, '_processUsersToNotify'));&#xA;}&#xA;&#xA;/**&#xA; * Process Users To Notify&#xA; *&#xA; * @param Event $event&#xA; */&#xA;public function _processUsersToNotify(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry']-&amp;gt;attributes;&#xA;&#xA;    $entryData = [&#xA;        'fieldSlug1' =&amp;gt; 'lorem ipsum',&#xA;        'usersToNotify' =&amp;gt; [1,2,3,4,5],&#xA;    ];&#xA;&#xA;    // using a service method (replace pluginName/serviceName accordingly)&#xA;    craft()-&amp;gt;pluginName_serviceName-&amp;gt;updateEntry($entry['id'], $entryData);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your service file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Update Entry Data&#xA; */&#xA;public function updateEntry($entryId, $data)&#xA;{&#xA;    // placeholder for phase 2 feature&#xA;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;    // set attrs&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes($data);&#xA;&#xA;    if ($entry-&amp;gt;validate())&#xA;    {&#xA;        craft()-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    }&#xA;    else&#xA;    {&#xA;        return $entry-&amp;gt;getErrors();&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-03T18:19:33.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17097" PostTypeId="1" AcceptedAnswerId="17105" CreationDate="2016-10-04T00:32:06.267" Score="2" ViewCount="1224" Body="&lt;p&gt;All the documentation, and answers here say this should work... But it returns the 404 instead of redirecting and I can't figure out why?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Section: Structure = help &lt;/li&gt;&#xA;&lt;li&gt;Entry URL Format: Top-Level Entries =&#xA;help/{slug} &lt;/li&gt;&#xA;&lt;li&gt;Entry URL Format: Nested Entries = help/{slug} &lt;/li&gt;&#xA;&lt;li&gt;Entry 'sTemplate = help/_entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Top line of the &quot;help/_entry.html&quot; template contains&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% redirect &quot;/help/welcome-to-help&quot; 301 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &quot;welcome-to-help&quot; is an Entry slug in the Help Section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I hit &quot;example.com/help/welcome-to-help/&quot; &lt;em&gt;(or any other valid Slug)&lt;/em&gt;, everything works fine. But if I hit &quot;example.com/help/asdf/&quot; it returns the 404 instead of redirecting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am at a loss at this point??&lt;/p&gt;&#xA;" OwnerUserId="5593" LastActivityDate="2016-10-04T12:01:31.383" Title="Redirecting &quot;if entry is not defined&quot; returns 404 instead" Tags="&lt;entry&gt;&lt;redirect&gt;&lt;routing&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17098" PostTypeId="2" ParentId="17091" CreationDate="2016-10-04T01:16:43.230" Score="1" Body="&lt;p&gt;I'm going to guess that the id for the new product entry doesn't yet exist when the sku is being generated....it's probably created at the end of the save process once Craft is sure the save will complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you really need to use the ID in the sku?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't immediately see an obvious in built way around it either, but perhaps someone cleverer than me will come along with a good idea).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-04T01:16:43.230" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17099" PostTypeId="1" AcceptedAnswerId="17121" CreationDate="2016-10-04T01:50:55.910" Score="1" ViewCount="161" Body="&lt;p&gt;Trying to add an &lt;code&gt;actionUrl&lt;/code&gt; to this plugin. &#xA;When I set &lt;code&gt;offset&lt;/code&gt; manually to a number, everything works, so I think the controller is working properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get the &lt;code&gt;offset&lt;/code&gt; from the button using getParam (or anything else).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to get a &lt;code&gt;offset&lt;/code&gt; back into the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class TumblrController extends BaseController{&#xA;&#xA;    public function actionOffset(){&#xA;&#xA;        $offset = craft()-&amp;gt;request-&amp;gt;getRequiredParam('offset', null);&#xA;&#xA;        craft()-&amp;gt;tumblr-&amp;gt;getSubmissionData($offset);&#xA;&#xA;        $this-&amp;gt;redirect($_SERVER['HTTP_REFERER']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Service&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSubmissionData($offset){&#xA;&#xA;$submission_data = array();&#xA;&#xA;// some variables that will be pretttty useful&#xA;$settings       = craft()-&amp;gt;plugins-&amp;gt;getPlugin('tumblr')-&amp;gt;getSettings();&#xA;$publicKey      = 'example';&#xA;$secretKey      = 'example';&#xA;$token          = 'example';&#xA;$tokenSecret    = 'example';&#xA;$callback_url   = 'tumblr/callback';&#xA;$blogName       = 'example.tumblr.com';&#xA;&#xA;$client = new \Tumblr\API\Client($publicKey, $secretKey, $token, $tokenSecret);&#xA;&#xA;//SETTING UP OFFSET&#xA;//$offset = (!isset($offset) || is_null($offset)) ? '0' : $offset; &#xA;&#xA;$submissions = $client-&amp;gt;getSubmissionPosts($blogName, array('offset' =&amp;gt; $offset, 'limit' =&amp;gt; 50));&#xA;&#xA;$i = 0;&#xA;&#xA;foreach($submissions-&amp;gt;posts as $submission) {&#xA;    $i++;&#xA;    foreach($submission as $key =&amp;gt; $value){&#xA;        if ($key == &quot;timestamp&quot; || $key ==  &quot;publisher&quot; || $key == &quot;video_type&quot; || $key == &quot;thumbnail_url&quot; || $key == &quot;thumbnail_width&quot; || $key == &quot;thumbnail_height&quot; ||     $key == &quot;html5_capable&quot; || $key == &quot;id&quot; || $key == &quot;short_url&quot; || $key == &quot;video&quot; || $key == &quot;content_raw&quot; || $key == &quot;player&quot; || $key == &quot;highlighted&quot; || $key     == &quot;photos&quot; || $key == &quot;trail&quot; || $key == &quot;tags&quot; || $key == &quot;description&quot; || $key == &quot;reblog&quot; || $key == &quot;followed&quot; || $key == &quot;blog_name&quot; || $key ==     &quot;reblog_key&quot; || $key == &quot;liked&quot; || $key == &quot;note_count&quot; || $key == &quot;link_author&quot; || $key == &quot;excerpt&quot; || $key == &quot;can_send_in_message&quot; || $key == &quot;can_reply&quot; ||     $key == &quot;recommended_source&quot; || $key == &quot;recommended_color&quot; || $key == &quot;font&quot; || $key == &quot;background&quot; || $key == &quot;format&quot; || $key == &quot;post_url&quot; || $key ==     &quot;slug&quot; || $key == &quot;is_submission&quot; || $key == &quot;is_anonymous&quot;)&#xA;            continue;&#xA;        $submission_data[$i][$key][] = isset($value) ? $value : &quot;Nothing set&quot;; &#xA;&#xA;    } &#xA;}&#xA;&#xA;&#xA;$charset = craft()-&amp;gt;templates-&amp;gt;getTwig()-&amp;gt;getCharset();&#xA;$twig_html = new \Twig_Markup(json_encode($submission_data), $charset);&#xA;&#xA;$tagdata = $submission_data;&#xA;foreach($submission_data as $key =&amp;gt; $value){&#xA;    foreach($value as $k =&amp;gt; $v){&#xA;        $tagdata = str_replace(&quot;{&quot;.$key.&quot;}&quot;, $v[0], $submission_data);&#xA;    }&#xA;}&#xA;&#xA;// // // // replace the embed code with the Twig object&#xA;$tagdata['embed_code'] = $twig_html;&#xA;&#xA;&#xA;return $tagdata;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = &quot;Tumblr Submissions&quot;|t %}&#xA;{% includeCssResource &quot;tumblr/css/table.css&quot; %}&#xA;&#xA;{% set offset = craft.request.getParam('offset') %}&#xA;{% set submissions = craft.tumblr.submissions(offset) %}&#xA;&#xA;{% block content %}&#xA;&#xA;&amp;lt;pre&amp;gt;{{ dump(offset) }}&amp;lt;/pre&amp;gt;&#xA;    &amp;lt;div id=&quot;page-wrap&quot;&amp;gt;&#xA;        {% for i in range(1, 10, 1) %}&#xA;            &amp;lt;a href=&quot;{{ actionUrl('tumblr/offset', {offset: i}) }}&quot;&amp;gt;&amp;lt;button type=&quot;button&quot;&amp;gt;{{i}}&amp;lt;/button&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;table class=&quot;table&quot;&amp;gt;&#xA;            {% for key,submit in submissions %}&#xA;                {% if loop.index == 1 %}&#xA;                    &amp;lt;thead&amp;gt;&#xA;                        &amp;lt;tr class=&quot;row header&quot;&amp;gt;&#xA;                            {% for ref,items in submit %}&#xA;                                &amp;lt;th class=&quot;cell&quot;&amp;gt;{{ ref }}&amp;lt;/th&amp;gt;&#xA;                            {% endfor %}&#xA;                        &amp;lt;/tr&amp;gt;&#xA;                    &amp;lt;/thead&amp;gt;&#xA;                    &amp;lt;tbody&amp;gt;&#xA;                {% endif %}&#xA;                    &amp;lt;tr class=&quot;row&quot;&amp;gt;&#xA;                        {% for ref,items in submit %}&#xA;                            &amp;lt;td class=&quot;cell&quot;&amp;gt;{{ items[0]|e }}&amp;lt;/td&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/tr&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/tbody&amp;gt;&#xA;        &amp;lt;/table&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastActivityDate="2016-10-04T22:33:37.220" Title="Plugin ActionUrl not being set" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17100" PostTypeId="1" AcceptedAnswerId="17101" CreationDate="2016-10-04T02:07:40.147" Score="1" ViewCount="104" Body="&lt;p&gt;I want to put the index of section in order by two fields: &lt;code&gt;featured&lt;/code&gt; and &lt;code&gt;startDate&lt;/code&gt;. Basically, I want the &lt;code&gt;featured&lt;/code&gt; entries to rise to the top of the index, and then within the featured posts I want them to be sorted by &lt;code&gt;startDate&lt;/code&gt; field. Below the featured entries, I want the other entries to also be sorted by &lt;code&gt;startDate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;entries.order('featured desc').order('startDate desc')&lt;/code&gt; but, as I expected, it simply ordered by &lt;code&gt;startDate&lt;/code&gt; because that method executed after ordering by &lt;code&gt;featured&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve what I'm tring to do?&lt;/p&gt;&#xA;" OwnerUserId="3709" LastEditorUserId="437" LastEditDate="2016-10-04T20:31:57.883" LastActivityDate="2016-10-04T20:31:57.883" Title="How can I do nested ordering?" Tags="&lt;templating&gt;&lt;search&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17101" PostTypeId="2" ParentId="17100" CreationDate="2016-10-04T06:03:11.947" Score="3" Body="&lt;p&gt;This should get you the desired results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('yoursection').order('startDate desc, featured desc') %}&#xA;&#xA;    {# Entry Code #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If for any reason that doesn't achieve exactly what it is you are looking for, you could always break it up into multiple loops, 1 for featured, and 1 for not featured. It's not as clean as the above solution but should also solve the issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will use 2 loops, one for the featured and 1 for the not featured, assuming the 'featured' field is a lightswitch.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('yoursection').search('featured:1').order('startDate desc') %}&#xA;&#xA;    {# Entry Code #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('yoursection').search('featured:not 1').order('startDate desc') %}&#xA;&#xA;    {# Entry Code #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2016-10-04T06:29:07.740" LastActivityDate="2016-10-04T06:29:07.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17102" PostTypeId="1" CreationDate="2016-10-04T06:14:48.900" Score="4" ViewCount="755" Body="&lt;p&gt;In Craft CMS 2.6.2945, I've added the &quot;&lt;code&gt;image&lt;/code&gt;&quot; button in the Redactor config.  In the editor, I've added an image and added a caption (by clicking the inserted image).  When the image is saved, the caption shows up properly and I could see that it was set as &lt;code&gt;figure&lt;/code&gt;/&lt;code&gt;figcaption&lt;/code&gt; tags after inspecting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, after saving the entry (save and continue editing doesn't even work now as it takes you to the Entries page), the formatting gets lost and the image ends up in a &lt;code&gt;p&lt;/code&gt; tag, followed by the caption in a &lt;code&gt;p&lt;/code&gt; tag in the editor, but in no tags in templates as raw html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone using captions and having troubles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added the following comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After some more testing and debugging, I'm noticing that Redactor is&#xA;  outputting malformed HTML. The img is going in a p tag, following by a&#xA;  figcaption tag. Since my rich text field was set up to clean malformed&#xA;  HTML, saving the entry would get rid of the orphaned figcaption tag.&#xA;  Any ideas why the img is not going in a figure tag?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Edit: here's the JSON:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also turned off the HTML purify and clean options but that didn't work out.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;image&quot;],&#xA;    &quot;plugins&quot;:[&quot;video&quot;,&quot;source&quot;],&#xA;    &quot;toolbarFixed&quot;: true,&#xA;    &quot;formatting&quot;: [&quot;p&quot;, &quot;blockquote&quot;, &quot;h2&quot;, &quot;h3&quot;, &quot;h4&quot;, &quot;h5&quot;, &quot;h6&quot;],&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;para-intro&quot;: {&#xA;            &quot;title&quot;: &quot;Paragraph Intro&quot;,&#xA;            &quot;args&quot;: [&quot;p&quot;, &quot;class&quot;, &quot;intro&quot;, &quot;toggle&quot;]&#xA;        },&#xA;        &quot;caption&quot;: {&#xA;            &quot;title&quot;: &quot;Caption&quot;,&#xA;            &quot;args&quot;: [&quot;p&quot;, &quot;class&quot;, &quot;cap&quot;]&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="4646" LastEditDate="2016-10-05T00:32:53.817" LastActivityDate="2016-10-05T09:11:15.717" Title="Redactor image caption not saved and formatting lost" Tags="&lt;redactor&gt;&lt;image&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17103" PostTypeId="1" AcceptedAnswerId="17302" CreationDate="2016-10-04T08:00:15.447" Score="2" ViewCount="258" Body="&lt;p&gt;I've created a (apply for a job) form using &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow&quot;&gt;amforms&lt;/a&gt;.&#xA;I'm using this form for multiple jobs. Whenever someone replies with this form, I want to pass the job name in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tries many thing but can't find a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone?&lt;/p&gt;&#xA;" OwnerUserId="5271" LastEditorUserId="57" LastEditDate="2016-10-04T17:46:02.757" LastActivityDate="2017-09-12T22:08:14.593" Title="Pass value in form using the amforms plugin" Tags="&lt;form&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17104" PostTypeId="1" CreationDate="2016-10-04T11:07:34.313" Score="3" ViewCount="148" Body="&lt;p&gt;I've upgraded to El Capitan from Yosemite, created several Image Transforms in the CP (see pic) but they don't seem to be creating the folders in the uploads dir. I've checked folder permissions for the assets dir and all have read and write and double checked the folder paths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running on Craft Pro ver: 2.6.2796&lt;/p&gt;&#xA;&#xA;&lt;p&gt;!(&lt;a href=&quot;https://imgur.com/a/stX27&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imgur.com/a/stX27&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I'm using in the template is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set xxxlarge = transform(bgImage, 'bigImageXx') %}&#xA;{% set small = transform(bgImage, 'bigImageS') %}&#xA;{% set medium = transform(bgImage, 'bigImageM') %}&#xA;{% set large = transform(bgImage, 'bigImageL') %}&#xA;{% set xlarge = transform(bgImage, 'bigImageX') %}&#xA;{% set xxlarge = transform(bgImage, 'bigImage') %}&#xA;&#xA;&#xA;&amp;lt;picture class=&quot;ce-mast-background&quot;&amp;gt;&#xA;    &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;video style=&quot;display: none;&quot;&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;    &amp;lt;source srcset=&quot;{{ xxxlarge }}, {{ xxxlarge }} 2x&quot; media=&quot;(min-width: 1281px)&quot;&amp;gt;&#xA;    &amp;lt;source srcset=&quot;{{ xxlarge }}, {{ xxlarge }} 2x&quot; media=&quot;(min-width: 800px)&quot;&amp;gt;&#xA;    &amp;lt;source srcset=&quot;{{ medium }}, {{ large }} 2x&quot; media=&quot;(min-width: 400px)&quot;&amp;gt;&#xA;    &amp;lt;source srcset=&quot;{{ small }}, {{ medium }} 2x&quot;&amp;gt;&#xA;    &amp;lt;!--[if IE 9]&amp;gt;&amp;lt;/video&amp;gt;&amp;lt;![endif]--&amp;gt;&#xA;    &amp;lt;img srcset=&quot;{{ xxxlarge }}&quot; alt=&quot;{{ entry.title }}&quot; class=&quot;ce-mast-image&quot; /&amp;gt;&#xA;&#xA;&amp;lt;/picture&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5711" LastEditorUserId="5845" LastEditDate="2018-08-20T16:09:17.437" LastActivityDate="2018-08-20T16:09:17.437" Title="Image transforms directory not being created" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;image&gt;&lt;responsive-images&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17105" PostTypeId="2" ParentId="17097" CreationDate="2016-10-04T12:01:31.383" Score="3" Body="&lt;p&gt;The reason you're getting a 404 is because Craft isn't even hitting your &lt;code&gt;help/_entry.html&lt;/code&gt; template. Because there's no entry matching the URI &lt;code&gt;/help/asdf&lt;/code&gt;, the template will never render and the request will go straight to 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; matching your section's URL format (i.e. &lt;code&gt;help/&amp;lt;slug&amp;gt;&lt;/code&gt;), and point it to the same template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works, because whenever Craft can't match a URI to an entry or category, it'll then try to render any dynamic route matching the URI's format (for a deeper understanding of how Craft manages routes and requests, I'd recommend looking at the &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow&quot;&gt;the official docs' page on routing&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-04T12:01:31.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17106" PostTypeId="2" ParentId="17088" CreationDate="2016-10-04T14:29:42.020" Score="2" Body="&lt;p&gt;I wasn't validating againts the field newPassword, only validating against password. Hence why I wasn't getting any feedback. Duplicating the validation for newPassword seems to have resolved this.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-10-04T18:04:10.827" LastActivityDate="2016-10-04T18:04:10.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17108" PostTypeId="1" AcceptedAnswerId="17114" CreationDate="2016-10-04T14:33:45.413" Score="1" ViewCount="137" Body="&lt;p&gt;I have a customers area as part of the Craft Commerce site I am working on. Ideally I want the user to be able to update their password from their customer profile screen. I have it working and validating for First Name and Surname. I have made the email address a disabled field so this cannot be changed (as email is used t login).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am having difficulty getting validation for the password fields. If I enter the old password correctly and a new password it does work and updates the password. However, I want some feedback/error trapping on the old password box to ensure the old password was correct and to offer some feedback if the passwords cannot be updated for whatever reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this something we would need to write to validate the old password, or is this baked into Craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone able to point me in the right direction on this?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-10-05T17:01:43.227" Title="Change password on user profile (customer account in Craft Commerce)" Tags="&lt;users&gt;&lt;plugin-craftcommerce&gt;&lt;user-profile&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17109" PostTypeId="1" AcceptedAnswerId="17110" CreationDate="2016-10-04T14:43:19.667" Score="2" ViewCount="586" Body="&lt;p&gt;I'm using Commerce, and Orders can have a custom field on them. I need customers to be able to update that field from a front end form. I can't use the built in contoller for Orders because that requires Admin users.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-05T08:24:53.503" Title="In Commerce how can I have a customer update custom fields on an order after the order is completed?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17110" PostTypeId="2" ParentId="17109" CreationDate="2016-10-04T14:57:10.027" Score="4" Body="&lt;p&gt;Create a new plugin with a new controller class that enables this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plugins/myplugin/MyPlugin.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;class MyPlugin extends BasePlugin&#xA;{&#xA;    ... the usual stuff from https://pluginfactory.io/ etc ...&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;plugins/myplugin/controllers/My_OrdersController.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class My_OrdersController extends BaseController&#xA;{&#xA;&#xA;    public function actionUpdateOrder()&#xA;    {&#xA;        // basic security precautions&#xA;            $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // get the fields&#xA;            $orderNumber = craft()-&amp;gt;request-&amp;gt;getPost('orderNumber');&#xA;            $customField = craft()-&amp;gt;request-&amp;gt;getPost('customField');&#xA;            $order       = craft()-&amp;gt;commerce_orders-&amp;gt;getOrderByNumber($orderNumber);&#xA;&#xA;        // do the stuff&#xA;            if ($order &amp;amp;&amp;amp;&#xA;                $order-&amp;gt;customer-&amp;gt;userId == craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id &amp;amp;&amp;amp;&#xA;                $customField != '')&#xA;            {&#xA;                    $order-&amp;gt;setContentFromPost(['customField'=&amp;gt;$customField]);&#xA;&#xA;                    // Lets also change the Order Status&#xA;                        $order-&amp;gt;orderStatusId = 3; // this line changes the Status if wanted. Use the ID of the custom status.&#xA;                        $order-&amp;gt;message = &quot;Order status changed to 'To be cancelled' by customer&quot;;&#xA;&#xA;                    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);&#xA;            }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Front end form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myplugin/orders/updateOrder&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/customer/order?number={{ number }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;orderNumber&quot; value=&quot;{{ number }}&quot;&amp;gt; &#xA;&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;span&amp;gt;Custo Field&amp;lt;/span&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot;&#xA;                name=&quot;customField&quot;&#xA;                value=&quot;{{ order.customField }}&quot;&#xA;        /&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button warning&quot; value=&quot;Confirm&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-10-05T08:24:53.503" LastActivityDate="2016-10-05T08:24:53.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17111" PostTypeId="1" AcceptedAnswerId="17112" CreationDate="2016-10-04T15:24:15.467" Score="3" ViewCount="408" Body="&lt;p&gt;I have a template where I would like to pass a search parameter to a craft.entries.section in an included template. The current main template has this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/testimonial&quot; with&#xA;  { type: &quot;agency&quot; } &#xA;  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the include I have this code where &lt;strong&gt;entry.clientsOrAgency&lt;/strong&gt; is a dropdown field and I want it to only show results of the &quot;type&quot; passed in the parent template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get one random testimonial entry #}&#xA;{% set testimonial = craft.entries.section('testimonials').search(entry.clientsOrAgency,type).order('RAND()').limit(1) %}&#xA;&#xA;{% for quotes in testimonial %}&#xA;&amp;lt;div class=&quot;testimonial&quot;&amp;gt;&#xA;&#xA;  {# matrix field is 'testimonial' - find different quote types #}&#xA;  {% for quote in quotes.testimonial %}&#xA;    more code here&#xA;  {% endfor %} {# quotes.testimonial #}&#xA;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!--testimonial--&amp;gt;&#xA;{% endfor %}{# quote in testimonial #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code results in a template error &lt;strong&gt;Undefined index: query&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to resolve this.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-10-04T16:04:10.007" Title="search parameter passed to include" Tags="&lt;templating&gt;&lt;include&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17112" PostTypeId="2" ParentId="17111" CreationDate="2016-10-04T15:42:29.933" Score="3" Body="&lt;p&gt;Your syntax is a bit off – the &lt;code&gt;search()&lt;/code&gt; parameter doesn't accept multiple parameters, only a &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;search query&lt;/a&gt; (e.g. &lt;code&gt;.search('body:foobar')&lt;/code&gt;) or an object containing the search query plus &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&quot; rel=&quot;nofollow&quot;&gt;search term options&lt;/a&gt;. In your case, you're actually passing an object (&lt;code&gt;.search(entry.clientsOrAgency)&lt;/code&gt;), in which case Craft will look for a &lt;code&gt;query&lt;/code&gt; parameter on that object (the second parameter is just ignored). Hence your error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, here's what you probably want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testimonial = craft.entries.section('testimonials').search('clientsOrAgency:'~type).order('RAND()').limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will search for entries in the &lt;code&gt;testimonials&lt;/code&gt; section, which has the value equal to &lt;code&gt;type&lt;/code&gt; in each &lt;code&gt;clientsOrAgency&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However – unless you need (which can be enabled &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow&quot;&gt;as a default&lt;/a&gt; for all searching in Craft, or per-search using search term options mentioned above) for the &lt;code&gt;clientsOrAgency&lt;/code&gt; field, I don't actually think using &lt;code&gt;search()&lt;/code&gt; is the appropriate approach here. The following would be easier and probably more performant:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testimonial = craft.entries.section('testimonials').clientsOrAgency(type).order('RAND()').limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, you should probably add &lt;code&gt;.first()&lt;/code&gt; to your &lt;code&gt;craft.entries&lt;/code&gt; query, in order to only pull a single entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set testimonial = craft.entries.section('testimonials').clientsOrAgency(type).order('RAND()').limit(1).first() %}&#xA;&#xA;{% if testimonial %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-04T16:04:10.007" LastActivityDate="2016-10-04T16:04:10.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17114" PostTypeId="2" ParentId="17108" CreationDate="2016-10-04T18:01:36.953" Score="1" Body="&lt;p&gt;Commerce just relies on existing Craft functionality for this and if you look at &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L915-L920&quot; rel=&quot;nofollow&quot;&gt;UsersController-&gt;saveUser&lt;/a&gt;, you can see that if the existing password is incorrect, then the error will be added to the UserModel's currentPassword property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for error in user.getErrors('currentPassword') %}&#xA;        &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="5418" LastEditDate="2016-10-05T17:01:43.227" LastActivityDate="2016-10-05T17:01:43.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17115" PostTypeId="1" CreationDate="2016-10-04T18:39:18.177" Score="1" ViewCount="72" Body="&lt;p&gt;I've been trying to get the homepage to show up in the navigation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to display is the following...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li class=&quot;nav-item active&quot;&amp;gt;                                    &#xA;    &amp;lt;a class=&quot;nav-link&quot; href=&quot;/&quot;&amp;gt;About&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  &amp;lt;li class=&quot;nav-item&quot;&amp;gt;                                    &#xA;    &amp;lt;a class=&quot;nav-link&quot; href=&quot;/schedule&quot;&amp;gt;Schedule&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  &amp;lt;li class=&quot;nav-item&quot;&amp;gt;                                    &#xA;    &amp;lt;a class=&quot;nav-link&quot; href=&quot;/media&quot;&amp;gt;Media&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  &amp;lt;li class=&quot;nav-item&quot;&amp;gt;                                    &#xA;    &amp;lt;a class=&quot;nav-link&quot; href=&quot;/contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following works to create the last 3 pages, but the homepage (about) does not seem to create.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% set entries = craft.entries.section('page').find() %}&#xA;  {% nav navItem in entries %}&#xA;  &amp;lt;li class=&quot;nav-item{{ navItem.id == entry.id ? ' active' }}&quot;&amp;gt;                                    &#xA;    &amp;lt;a class=&quot;nav-link&quot; href=&quot;{{ navItem.url }}&quot;&amp;gt;{{ navItem.title }}&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following works for a semi-dynamic homepage... however the name does not create... (If they change the title of the homepage on the backend, I'd like it to switch on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;nav-item{{ craft.request.firstSegment == &quot;&quot; ? ' active' }}&quot;&amp;gt;&#xA;  &amp;lt;a class=&quot;nav-link&quot; href=&quot;/&quot;&amp;gt;{{ craft.entries.slug('_home_').entry.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could anyone with a bit more experience with this give me some insight? I'm confused outta my mind.&lt;/p&gt;&#xA;" OwnerUserId="5712" LastActivityDate="2016-10-04T18:54:24.910" Title="Homepage in Navigation" Tags="&lt;navigation&gt;&lt;craft-features&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17116" PostTypeId="2" ParentId="17115" CreationDate="2016-10-04T18:54:24.910" Score="1" Body="&lt;p&gt;I was able to figure out how to get this working...See the following..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('homepage, page').find() %}&#xA;{% nav navItem in entries %}&#xA;&amp;lt;li class=&quot;nav-item{{ navItem.id == entry.id ? ' active' }}&quot;&amp;gt;                                    &#xA;  &amp;lt;a class=&quot;nav-link&quot; href=&quot;{{ navItem.uri }}&quot;&amp;gt;{{ navItem.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5712" LastActivityDate="2016-10-04T18:54:24.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17117" PostTypeId="1" CreationDate="2016-10-04T20:23:36.987" Score="0" ViewCount="372" Body="&lt;p&gt;I just upgraded a fully functional Craft website to Craft 2.6. The site is hosted on Heroku with assets uploading to S3. So all of that has been working really well for about 10 months. Now I can't upload any more assets. When I choose a file from my computer, the upload hangs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a console error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Failed to load resource: the server responded with a status of 500 (Internal Server Error)&#xA;&#xA;https://www.example.com/index.php?p=admin/actions/assets/uploadFile Failed to load resource: the server responded with a status of 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the response body of the 500 error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;PHP Error [500]&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;Trying to get property of non-object (/app/craft/app/services/AssetsService.php:707)&amp;lt;/p&amp;gt;&#xA;&amp;lt;pre&amp;gt;#0 /app/craft/app/etc/errors/ErrorHandler.php(184): Craft\ErrorHandler-&amp;gt;handleError()&#xA;#1 /app/craft/app/framework/base/CErrorHandler.php(133): Craft\ErrorHandler-&amp;gt;handleError()&#xA;#2 /app/craft/app/framework/base/CApplication.php(834): Craft\ErrorHandler-&amp;gt;handle()&#xA;#3 /app/craft/app/etc/web/WebApp.php(688): Craft\WebApp-&amp;gt;handleError()&#xA;#4 /app/craft/app/services/AssetsService.php(707): Craft\WebApp-&amp;gt;handleError()&#xA;#5 /app/craft/app/controllers/AssetsController.php(52): Craft\AssetsService-&amp;gt;uploadFile()&#xA;#6 /app/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController-&amp;gt;actionUploadFile()&#xA;#7 /app/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#8 /app/craft/app/framework/web/CController.php(286): Craft\AssetsController-&amp;gt;runAction()&#xA;#9 /app/craft/app/framework/web/CController.php(265): Craft\AssetsController-&amp;gt;runActionWithFilters()&#xA;#10 /app/craft/app/framework/web/CWebApplication.php(282): Craft\AssetsController-&amp;gt;run()&#xA;#11 /app/craft/app/etc/web/WebApp.php(818): Craft\WebApp-&amp;gt;runController()&#xA;#12 /app/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /app/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 /app/craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#15 /app/public/index.php(19): require_once()&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? This happens when I try to upload an asset directly in the Assets section of Craft as well as uploading a new image to an Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4388" LastActivityDate="2016-11-14T20:05:16.353" Title="Craft 2.6 Asset Upload 500 Error (on Heroku with Amazon S3)" Tags="&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17118" PostTypeId="1" AcceptedAnswerId="17120" CreationDate="2016-10-04T20:27:09.497" Score="1" ViewCount="57" Body="&lt;p&gt;I installed Import.  I tried to run a test import and it froze.   Now the pop-up status that appears in Craft's menu - just below Settings - will not disappear.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even uninstalled the plugin.  But, the status notification is still in the menu.   It's driving me nuts.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mhglf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mhglf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How do I get rid of it?&lt;/em&gt;   At this point, I don't care about getting import to work or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Oh, and there were no image transforms with the test import - it was only 21 lines of a simple css file.)&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2016-10-04T21:13:45.210" LastActivityDate="2016-10-04T21:13:45.210" Title="How do I hide notifications about running tasks?" Tags="&lt;tasks&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17119" PostTypeId="2" ParentId="17117" CreationDate="2016-10-04T20:29:25.377" Score="0" Body="&lt;p&gt;Line 707 of &lt;code&gt;craft/app/services/AssetsService.php&lt;/code&gt; in the &lt;a href=&quot;https://craftcms.com/changelog#build2945&quot; rel=&quot;nofollow&quot;&gt;latest&lt;/a&gt; Craft release references &lt;code&gt;$folder-&amp;gt;sourceId&lt;/code&gt;, which is where your error is occurring, so my guess is there is something incorrectly setup with your Asset source settings. I'd start by verifying those.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-04T20:29:25.377" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17120" PostTypeId="2" ParentId="17118" CreationDate="2016-10-04T20:33:41.390" Score="2" Body="&lt;p&gt;Those are running tasks that Craft (and plugins) use to perform long running maintenance operations and an Import task got &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;stuck&lt;/a&gt; causing the ones to come after it not to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you don't care about the Import task anymore, you can open the &lt;code&gt;craft_tasks&lt;/code&gt; table in the database and delete the one for the Import task (probably the top row).  The next time you load the control panel, the remaining tasks should complete.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-04T20:33:41.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17121" PostTypeId="2" ParentId="17099" CreationDate="2016-10-04T22:33:37.220" Score="1" Body="&lt;p&gt;After some testing the answer to this was that I needed to setup custom CP routes to pass the &lt;code&gt;offset&lt;/code&gt; variable from template to controller and back to template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes(){&#xA;    return array(&#xA;        'tumblr/offset' =&amp;gt; array('action' =&amp;gt; 'tumblr/offset')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastActivityDate="2016-10-04T22:33:37.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17122" PostTypeId="1" AcceptedAnswerId="17136" CreationDate="2016-10-05T01:09:41.623" Score="4" ViewCount="1687" Body="&lt;p&gt;I have a chart generated in script.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;country&quot;: &quot;China&quot;,&#xA;    &quot;visits&quot;: 1882,&#xA;    &quot;color&quot;: &quot;#FF6600&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I want to do (and I know this is not correct).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;country&quot;: &quot;{{ entry.country }}&quot;,&#xA;    &quot;visits&quot;: {{ entry.visits }},&#xA;    &quot;color&quot;: &quot;#FF6600&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I need to do?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2016-10-05T16:57:58.520" LastActivityDate="2016-10-05T16:57:58.520" Title="How can I pass a Craft Field into a JavaScript function?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17123" PostTypeId="1" AcceptedAnswerId="17127" CreationDate="2016-10-05T04:10:19.180" Score="3" ViewCount="153" Body="&lt;p&gt;I'm documenting Craft permissions for internal use but there are some permissions that I'm not clear on.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Access the site when the system is off&quot; What system?  &lt;/li&gt;&#xA;&lt;li&gt;&quot;Publish live changes&quot; How can you do that?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5714" LastActivityDate="2016-10-05T08:30:05.370" Title="What do some Craft permissions mean?" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17124" PostTypeId="1" AcceptedAnswerId="17125" CreationDate="2016-10-05T07:47:32.303" Score="1" ViewCount="74" Body="&lt;p&gt;I'm trying to create a craft plugin but I have problems with rendering the settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I used the same way like &lt;a href=&quot;https://craftcms.com/docs/plugins/plugin-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; so this is my plugin code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class testPlugin extends BasePlugin&#xA;{&#xA;&#xA;&#xA;    function getName()&#xA;    {&#xA;        return Craft::t('Test');&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '0.1';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'Secondred Newmedia GmbH';&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'http://www.secondred.de';&#xA;    }&#xA;&#xA;    public function getSourceLanguage()&#xA;    {&#xA;        return 'de';&#xA;    }&#xA;&#xA;    protected function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'accountID' =&amp;gt; array(AttributeType::Mixed)&#xA;        );&#xA;    }&#xA;&#xA;    public function getSettingsHtml()&#xA;    {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('test/tools/config', array(&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;        ));&#xA;    }&#xA;&#xA;    public function hasCpSection()&#xA;    {&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is my config.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set page = 'Settings'|t %}&#xA;{% set title = 'Settings'|t %}&#xA;&#xA;{% set content %}&#xA;    &amp;lt;div class=&quot;pane&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;Hello Craft&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it always ends up like this &#xA;&lt;a href=&quot;https://i.stack.imgur.com/7QTWa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7QTWa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;The menu is always rendered inside my plugin Settings and If I just use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsUrl()&#xA;{&#xA;    return 'test/tools/configuration';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the template is rendered correctly but I can't pass my variables anymore (of course in that example there are no, but I use some in my real plugin I just didn't want to show you 1000 lines of unneeded code) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please tell me what I'm doing wrong? My actual real plugin is nearly ready and this is the last error I have to fix but I don't know how. I need your help thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-10-05T07:54:52.583" LastActivityDate="2016-10-05T08:03:50.850" Title="Plugin settings are rendered wrong" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugins&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17125" PostTypeId="2" ParentId="17124" CreationDate="2016-10-05T08:03:50.850" Score="2" Body="&lt;p&gt;Just remove the &lt;code&gt;extends&lt;/code&gt; and &lt;code&gt;set content&lt;/code&gt;. The settings twig-code is rendered in a container inside the CP anyways:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;&amp;lt;p&amp;gt;Hello Craft&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2016-10-05T08:03:50.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17126" PostTypeId="1" AcceptedAnswerId="17129" CreationDate="2016-10-05T08:16:46.353" Score="2" ViewCount="364" Body="&lt;p&gt;I've installed a Craft Pro site with 3 locales: Dutch, French &amp;amp; English, but the people who are going to input data will speak those languages too, so I need to translate the instructions field in the control panel (and, if possible, the field names too since most of the time that makes it clear enough).&#xA;Is this possible, and if it is: how?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-10-05T16:24:51.813" LastActivityDate="2016-10-05T16:24:51.813" Title="Control panel field name &amp; instructions translations" Tags="&lt;control-panel&gt;&lt;localization&gt;&lt;field&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17127" PostTypeId="2" ParentId="17123" CreationDate="2016-10-05T08:30:05.370" Score="2" Body="&lt;p&gt;Access the site when the system is off means that a logged in user with that permission can view the website front end (I think - never actually used this). You can set the system status in Settings &gt; General, or via the craft/config/general.php file using 'isSystemOn' =&gt; true/false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user doesn't have &quot;Publish live changes&quot; it means that the user can create new entries, but they can't appear on the front end of the site because they can't set the entry status to be published (the green lightswitch button on all Entries). This means you can review their content as a more privelidged user before they get made public.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-05T08:30:05.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17128" PostTypeId="1" CreationDate="2016-10-05T08:42:32.957" Score="0" ViewCount="111" Body="&lt;p&gt;I have build a Blog. Now I've tried to add the commenting function with &quot;Comments&quot;:&#xA;&lt;a href=&quot;https://github.com/engram-design/Comments&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/Comments&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the absolute basic template:&#xA;&lt;a href=&quot;https://github.com/engram-design/Comments/blob/master/examples/standard/standard.html&quot; rel=&quot;nofollow&quot;&gt;https://github.com/engram-design/Comments/blob/master/examples/standard/standard.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The call in my Tpl:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;   order: 'dateCreated asc'&#xA;} %}&#xA;&#xA;{{ craft.comments.form(entry.id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Until here everything is fine. When I want so send the comment, i always get this Error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Property &quot;Craft \ EntryModel.owner is undefined.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;Comments&quot; Plugin use EntryModel.owner when I want so submit a comment on any entry. Now the problem is that {{ entry.owner }} is undefined. But how can I define the {{ entry.owner }}?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a noobie Question, but how can I fix this?&lt;/p&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="5577" LastEditDate="2016-10-05T16:47:12.590" LastActivityDate="2016-10-05T16:47:12.590" Title="Blog Comments / EntryModel.owner is undefined" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17129" PostTypeId="2" ParentId="17126" CreationDate="2016-10-05T08:52:18.927" Score="4" Body="&lt;p&gt;If your main language site is dutch for example, you can do that using your own php files locale and naming them according the other locales languages, en.php, fr.php and put those files in craft/translations/ (a folder you must create yourself). Then you can translate in the array all your string (field name and instructions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a check at the documentation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow&quot;&gt;Translating Static Text&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="522" LastActivityDate="2016-10-05T08:52:18.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17130" PostTypeId="2" ParentId="17102" CreationDate="2016-10-05T09:11:15.717" Score="4" Body="&lt;p&gt;I copied your Redactor settings to a clean installation of Craft (2.6.2945) and added an image to a Rich Text field set to use those specific settings. Initially I encountered the same behaviour. However, unlike in your experience, after disabling the &lt;strong&gt;Purify HTML?&lt;/strong&gt; option on the Rich Text field, the &lt;code&gt;figcaption&lt;/code&gt; element persisted after saves.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-05T09:11:15.717" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17131" PostTypeId="1" AcceptedAnswerId="17133" CreationDate="2016-10-05T11:07:53.023" Score="4" ViewCount="319" Body="&lt;p&gt;I am just wondering, when will Pixel and Tonic release Craft 3 stable version?&lt;/p&gt;&#xA;" OwnerUserId="5111" LastActivityDate="2017-01-04T21:20:09.823" Title="How long will it take Pixel and Tonic to release Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17132" PostTypeId="2" ParentId="17131" CreationDate="2016-10-05T12:10:01.337" Score="4" Body="&lt;p&gt;It will be released before the end of Q1 2017 as stated in the yearly round up in December.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2017-01-04T21:20:09.823" LastActivityDate="2017-01-04T21:20:09.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17133" PostTypeId="2" ParentId="17131" CreationDate="2016-10-05T12:12:21.770" Score="7" Body="&lt;p&gt;I asked them on twitter regarding this yesterday and got the &lt;a href=&quot;https://twitter.com/CraftCMS/status/783272809661292544&quot;&gt;following answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Hope to have Craft 3 in beta by the end of year.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-05T12:12:21.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17134" PostTypeId="1" AcceptedAnswerId="17145" CreationDate="2016-10-05T12:38:51.550" Score="2" ViewCount="58" Body="&lt;p&gt;Is it possible to automatically re-render a widget after the number of columns is changed? I have a widget that has to be re-rendered/re-executed after the widget columns change and I don't know how to realize it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't just make a javascript event like &lt;code&gt;$(window).resize()&lt;/code&gt; because I already have this function and check if the client client height changes there because otherwise it would trigger every second for no reason.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2016-10-06T07:25:25.083" Title="Re-render Widget after column number changes" Tags="&lt;plugin-development&gt;&lt;dashboard-widgets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17136" PostTypeId="2" ParentId="17122" CreationDate="2016-10-05T13:05:26.597" Score="9" Body="&lt;p&gt;Is the JavaScript inline in your template file? e.g. using &lt;code&gt;{% includeJs %}&lt;/code&gt; or even just a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag? If so you should be able to do it as you suggested by outputting Craft variables directly into the JavaScript within your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the function is in an external script, you could call a function from within your template, something along these lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/path/to/myfile.js&quot; %}&#xA;{% set myJs %}&#xA;   myFunction('{{entry.country}}','{{entry.visits}}');&#xA;{% endset %}   &#xA;{% includeJs myJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your JS file you can have something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function myfunction(country, visits){&#xA;   //do something&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3941" LastEditorUserId="57" LastEditDate="2016-10-05T16:57:23.597" LastActivityDate="2016-10-05T16:57:23.597" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17137" PostTypeId="1" AcceptedAnswerId="17141" CreationDate="2016-10-05T13:08:06.357" Score="1" ViewCount="65" Body="&lt;p&gt;I am trying to check the value of a checkbox as part of my checkout process. I have the following function at the moment.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function (Event $event) {&#xA;        $order = $event-&amp;gt;params['order'];&#xA;        echo '&amp;lt;pre&amp;gt;';&#xA;        print_r($order-&amp;gt;signupForNewsletter);&#xA;            if ($order-&amp;gt;signupForNewsletter == 'joinMailingList') {&#xA;                echo &quot;I've opted in&quot;;&#xA;            } else {&#xA;                echo 'Not matched';&#xA;            }&#xA;        echo '&amp;lt;/pre&amp;gt;';&#xA;        exit;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But whether the checkbox is ticked or not I am only get the 'Not matched' statement, so my if statement is always false. I have tried several things, but cannot see how to resolve this.&#xA;I think perhaps because the signupForNewsletter is a checkbox in the custom order fields, so it is an array rather than an object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the print_r results of this code;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Craft\MultiOptionsFieldData Object&#xA;(&#xA;    [_options:Craft\MultiOptionsFieldData:private] =&amp;gt; Array&#xA;        (&#xA;            [0] =&amp;gt; Craft\OptionData Object&#xA;                (&#xA;                    [label] =&amp;gt; Join Mailing List&#xA;                    [value] =&amp;gt; joinMailingList&#xA;                    [selected] =&amp;gt; 1&#xA;                )&#xA;&#xA;        )&#xA;&#xA;    [storage:ArrayObject:private] =&amp;gt; Array&#xA;        (&#xA;        )&#xA;&#xA;    )&#xA;    Not matched&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The checkbox was ticked in this instance as you can see in the value field.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2016-10-05T16:28:16.610" LastActivityDate="2016-10-05T16:56:28.557" Title="Checking value of customer order field within Plugin" Tags="&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17138" PostTypeId="1" AcceptedAnswerId="23083" CreationDate="2016-10-05T13:32:50.073" Score="1" ViewCount="586" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Example from the frontend&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jxu5B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jxu5B.png&quot; alt=&quot;Example from the frontend&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Example in dev tools&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sFEo2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sFEo2.png&quot; alt=&quot;Example in dev tools&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;If I &quot;view-source&quot; on the page&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kpati.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kpati.png&quot; alt=&quot;If I &amp;quot;view-source&amp;quot; on the page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;Example from Rich Text Field&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9UzXn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9UzXn.png&quot; alt=&quot;Example from Rich Text Field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;Example from Rich Text Field HTML&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UZYeT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UZYeT.png&quot; alt=&quot;Example from Rich Text Field HTML&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a Rich Text field within a matrix, it's output in the template like this: &lt;code&gt;{{ block.text }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pass the &quot;|raw&quot; filter I get the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you notice, the Rich Text Field has a &amp;nbsp; before the closing &lt;code&gt;&amp;lt;/p&amp;gt;&lt;/code&gt;, which isn't output in the markup, instead I get this strange character.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a similar thing with hacksaw recently bringing up this character here:&#xA;&lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw/issues/16&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ehousestudio/craft_hacksaw/issues/16&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to resolve this?&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-12-06T22:05:25.143" Title="Rich Text field is producing weird space character instead of &amp;nbsp;" Tags="&lt;richtext&gt;&lt;whitespace&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17139" PostTypeId="1" CreationDate="2016-10-05T14:54:55.193" Score="1" ViewCount="172" Body="&lt;p&gt;I have this conditional included in a layout file I use within others, using the extends feature in twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is at the very top of _layouts/application.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser %}&#xA;    {% redirect &quot;login&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have this at the very top of account/index.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/application&quot; %}&#xA;{% set name = currentUser.getFullName() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the user is not logged in, I expect it to redirect the user to the login page, as it contains the if not currentUser conditional at the very beginning of the extends file: _layouts/application.twig&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then copied and pasted the if not currentUser code and placed it above the extends call within the account/index.twig file (like seen below):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser %}&#xA;    {% redirect &quot;login&quot; %}&#xA;{% endif %}&#xA;&#xA;{% extends &quot;_layouts/application&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it works as I expect it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does it not work with the if conditional being included in _layouts/application.twig file that I include by using {% extends &quot;_layouts/application&quot; %}&lt;/p&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="3618" LastEditDate="2016-10-06T01:54:43.887" LastActivityDate="2016-10-06T01:54:43.887" Title="conditional does not run first in a file that is included using the extends feature for twig" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;session&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17140" PostTypeId="2" ParentId="17128" CreationDate="2016-10-05T15:11:49.020" Score="2" Body="&lt;p&gt;Somewhere in your template you are trying to access the &lt;code&gt;owner&lt;/code&gt; attribute on an &lt;code&gt;EntryModel&lt;/code&gt;. The example above doesn't show any details on where you might be trying to do that in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try commenting out any area of your template where you may be trying to output values that relate to the Entry Model. Maybe even comment out your whole template. Comment things out until you get your page to load again. As you mentioned this error occurs when you try to send a comment, you may also want to comment things out on whatever template gets loaded after you submit the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you're getting the page to load without errors, add your code back line by line until you get the error. This will help you isolate where the error is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you find it, you'll probably need to add a conditional check to the offending code to get things working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry['owner'] is defined %}&#xA;    Then it's safe to try to output {{ entry.owner }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-05T15:11:49.020" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17141" PostTypeId="2" ParentId="17137" CreationDate="2016-10-05T16:56:28.557" Score="3" Body="&lt;p&gt;What you're probably looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($order-&amp;gt;signupForNewsletter-&amp;gt;contains('joinMailingList'))&#xA;{&#xA;    echo &quot;I've opted in&quot;;&#xA;}&#xA;else&#xA;{&#xA;    echo 'Not matched';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-05T16:56:28.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17142" PostTypeId="2" ParentId="17139" CreationDate="2016-10-05T20:59:59.490" Score="3" Body="&lt;p&gt;The issue here is that extends isn't the same thing, neither conceptually or technically, as an include. When you &lt;code&gt;extend&lt;/code&gt; a template with a layout template, the template is &quot;decorated&quot; by the layout. So, what's happening is that the code in the layout is parsed after all of the code in the template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;https://straightupcraft.com/articles/twig-processing-order&quot; rel=&quot;nofollow&quot;&gt;this article on straightupcraft&lt;/a&gt; explains the order of which things happen in Twig. In short:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) All code in your &lt;strong&gt;template&lt;/strong&gt;, except code inside blocks, gets processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) All code in your &lt;strong&gt;layout&lt;/strong&gt;, except code inside blocks, gets processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Code inside &lt;strong&gt;blocks&lt;/strong&gt; gets processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what the solution to your problem is, depends on your setup. But, if your code that accesses currentUser is inside the block in your page template, the redirect should fire first. If you need to access currentUser outside of the blocks in your page template, you have to do the redirect there.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2016-10-05T21:17:55.497" LastActivityDate="2016-10-05T21:17:55.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17145" PostTypeId="2" ParentId="17134" CreationDate="2016-10-06T07:25:25.083" Score="2" Body="&lt;p&gt;I found an answer that works for me at least..&#xA;Since I render my widget via Javascript and not via PHP/Twig I can use this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).on(&quot;click&quot;, &quot;.colspan-picker a&quot;, function(){&#xA;    var container = $(this).parent().parent().parent();&#xA;    widgetID = container.data(&quot;id&quot;);&#xA;    sRGoogleAnalyticsRerenderChart(widgetID);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.colspan-picker a&lt;/code&gt; is the element for columnchange and its &lt;code&gt;parent().parent().parent()&lt;/code&gt; has a data-id of the widget container&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2016-10-06T07:25:25.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17146" PostTypeId="1" AcceptedAnswerId="17147" CreationDate="2016-10-06T08:24:27.363" Score="1" ViewCount="314" Body="&lt;p&gt;Will Google Analytics be recording page views / events from within a Live Preview? And if so, is there a way to prevent this from happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that with Google Analytics you can set the domain for which it should track (e.g. to prevent it trying to track any local build events etc), but I am presuming that the domain used for Live Preview views will be the same as as if a user was viewing the front end of the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it would track Live Preview views, I understand that an option for some people would be to wrap their GA code block in a conditional:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if not craft.request.isLivePreview %}{# ga code here #}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but because we have custom event tracking built into the JS, which therefore uses the global &lt;code&gt;ga&lt;/code&gt; object, it would not be as simple in our case (though is still an option with a few checks for whether &lt;code&gt;ga&lt;/code&gt; is defined).&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2016-10-06T08:46:59.770" Title="Does Google Analytics track Live Preview 'page views'?" Tags="&lt;live-preview&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17147" PostTypeId="2" ParentId="17146" CreationDate="2016-10-06T08:46:59.770" Score="3" Body="&lt;p&gt;If you're using SEOmatic - no. It's built in that the GA doesn't get spat out for the preview. If you're using a regular template - yes; you may want to wrap your GA code in a conditional so that it's not spat out when requested via the live preview.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.config.devMode and not craft.request.isLivePreview %}{# GA code here #}{% else %}&amp;lt;!-- Google Analytics script is NOT included in LivePreview or if devMode is on --&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[edit] Whoops, saw the other half of your question. What is it about your set up that's stopping you doing this? Sounds more like an Analytics issue than a Craft one to me.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-06T08:46:59.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17148" PostTypeId="1" AcceptedAnswerId="17149" CreationDate="2016-10-06T12:14:43.463" Score="2" ViewCount="515" Body="&lt;p&gt;I have a website with a few thousand entries. At the bottom of the entry template, we show 4 random news posts from the last 4 weeks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when someone adds a new entry, the &lt;code&gt;DeleteStaleTemplateCaches&lt;/code&gt; task starts running. This causes cpu and memory peaks on our server that go to 100%. This task also takes about 30 minutes to complete, meaning that our cached homepage only shows the new article after 30 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why it takes so long, solutions on how to fix this? (Apart from caching the 4 entries on the bottom of the page, and caching the homepage, we didn't do anything weird.)&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2016-10-06T14:11:03.977" Title="DeleteStaleTemplateCaches taking forever" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17149" PostTypeId="2" ParentId="17148" CreationDate="2016-10-06T14:11:03.977" Score="6" Body="&lt;p&gt;This is a side-effect of Craft's amazing automagical cache system. :) Check out my answer on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15924/delete-stale-template-caches-tasks-much-larger-in-production-than-staging&quot;&gt;this question&lt;/a&gt; for an explanation of what happens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question of how to fix this, part of the solution is probably what I wrote in the answer, to make sure that you don't create more caches than you need, by caching globally and using the request path as key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other ways to counter this problem is to use the &lt;a href=&quot;https://github.com/pixelandtonic/ColdCache&quot; rel=&quot;nofollow noreferrer&quot;&gt;ColdCache&lt;/a&gt; and &lt;a href=&quot;https://github.com/mmikkel/CacheFlag-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;CacheFlag&lt;/a&gt; plugins. They serve different purposes, and isn't right for all caches, but they have one thing in common, they doesn't save anything to the &lt;code&gt;templatecachecriteria&lt;/code&gt; table, which determines the length of the delete stale template caches task. I usually end up with a combination of all three on projects that have a lot of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ColdCache is good to use in the cases where you primarily are caching a single entry, and you can get away with breaking the cache when the entry is saved. By using the modified date of the entry as part of your cache key, Craft will create a new cache every time you save the entry (don't worry, the old caches will be deleted when they expire, and doesn't affect performance in any way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CacheFlag is good to use when you know what sections, globals, categories or... whatever, you're caching. For instance, if you have a news section, and are caching a list of news entries, you could add a flag to the section in CacheFlags settings, wrap the list in the CacheFlag tags and add the flag. Whenever an entry in that section gets saved, all caches with that flag gets deleted and refreshed the next time the list is shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these approaches sacrifices something in terms of cache breaking - and it takes some thinking through to get right - but performance wise you gain a lot.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-10-06T14:11:03.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17150" PostTypeId="1" CreationDate="2016-10-06T16:31:41.023" Score="1" ViewCount="692" Body="&lt;p&gt;What is the best way to implement a typeahead search in Craft. I looked at using ElementAPI to do something similar at this example but it doesn't seem to allow me to wildcard search&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/search-form&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/search-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of the endpoints I have configured:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one entry with a title of &quot;test&quot; when I call the API doing &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I call &lt;code&gt;/entries/te&lt;/code&gt; its returns 0 results. When I call &lt;code&gt;/entries/test&lt;/code&gt; it returns 1 result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;&#xA;        'entries/&amp;lt;search:\w+&amp;gt;' =&amp;gt; function($search) {&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['title' =&amp;gt; $search]&#xA;            ];&#xA;        }&#xA;&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="57" LastEditDate="2016-10-06T20:12:04.093" LastActivityDate="2016-10-07T18:12:24.760" Title="Implementing search with Ajax" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17151" PostTypeId="1" CreationDate="2016-10-06T17:51:51.277" Score="0" ViewCount="293" Body="&lt;p&gt;I’m having some trouble getting a contact form to submit and function correctly. The live instance of the site is on Windows Azure but my staging and local versions are unix. Is there any reason for Pixel &amp;amp; Tonic's Contact Form plugin not to function because of the platform? Perhaps it's a lower level issue with PHP setup or my Craft configuration on Windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5729" LastEditorUserId="57" LastEditDate="2016-10-06T18:06:23.453" LastActivityDate="2016-10-06T19:02:00.080" Title="Contact Form on Windows Azure" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17152" PostTypeId="2" ParentId="17151" CreationDate="2016-10-06T19:02:00.080" Score="1" Body="&lt;p&gt;No, there's no reason why Contact Form would fail on Windows Azure specifically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had to guess, I bet you've got your email settings &quot;Protocol&quot; configured to use &lt;code&gt;PHP Mail&lt;/code&gt;. That particular method of handling email is notoriously unreliable, which would explain why it's working on some of your servers but not others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd highly recommend switching to an &lt;code&gt;SMTP&lt;/code&gt; service. I've personally had a very good experience with &lt;a href=&quot;http://www.mailgun.com/&quot; rel=&quot;nofollow&quot;&gt;Mailgun&lt;/a&gt;, and I've heard others rave about &lt;a href=&quot;https://www.sparkpost.com/&quot; rel=&quot;nofollow&quot;&gt;SparkPost&lt;/a&gt;. Regardless of which service you choose, SMTP is far superior to PHP mail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also suggest reading the full Craft article on &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors&quot; rel=&quot;nofollow&quot;&gt;Troubleshooting Email Errors...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-06T19:02:00.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17153" PostTypeId="1" AcceptedAnswerId="17161" CreationDate="2016-10-06T20:00:21.050" Score="1" ViewCount="1124" Body="&lt;p&gt;I'm building a plugin for Craft CMS. This plugin will load on the edit/content page, where the standard Redactor WYSIWYG editor will be loaded too (by CraftCMS).&#xA;I want to get the HTML/text contents of the Redactor editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;code&gt;tinymce.activeEditor.getContent()&lt;/code&gt; will get the HTML contents of the &lt;strong&gt;TinyMCE&lt;/strong&gt; editor in WordPress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I achieve this in Craft CMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The API documentation says &lt;code&gt;var text = this.clean.getPlainText(html);&lt;/code&gt;.&#xA;But how do I know reference to &lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5730" LastActivityDate="2016-10-07T02:42:57.443" Title="I want to get the HTML/text contents of the Redactor editor" Tags="&lt;redactor&gt;&lt;javascript&gt;&lt;content&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17154" PostTypeId="1" AcceptedAnswerId="17158" CreationDate="2016-10-06T20:48:43.893" Score="2" ViewCount="357" Body="&lt;p&gt;I use Datagrab on an EE site to import data to a Channel/fields and category assignment – is there an equivalent plugin or approach for Craft CMS, typically I want to allow the editor to import wine lists and display as listing pages (category title via EE e.g Burgundy) and click throughs from here to entry pages&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2016-10-06T22:19:03.723" Title="Datagrab style plugin for importing CSV data to sections (Channels)" Tags="&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17155" PostTypeId="1" AcceptedAnswerId="17156" CreationDate="2016-10-06T21:39:28.953" Score="3" ViewCount="1457" Body="&lt;p&gt;If I've got an array of entries, is there a less long winded approach to convert that to an array of ids so I can use it in another lookup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Look up authors that match the entered query.&#xA;{% set authorEntries = craft.users.search('fullName:*' ~ query ~ '*')|default([]) %}&#xA;&#xA;{% set authorIds = [] %}&#xA;{% for author in authorEntries %}&#xA;    {% set authorIds = authorIds|merge([author.id]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-10-06T22:14:03.303" Title="Converting array of entries to an array of ids" Tags="&lt;templating&gt;&lt;entries&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17156" PostTypeId="2" ParentId="17155" CreationDate="2016-10-06T21:53:34.793" Score="5" Body="&lt;p&gt;Simply append &lt;code&gt;.ids()&lt;/code&gt; to your initial query...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorIds = craft.users.search('fullName:*' ~ query ~ '*').ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without the &lt;code&gt;.ids()&lt;/code&gt; method, you're actually working with an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Element Criteria Model&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behavior that you're seeing is the default... it's as if you had appended &lt;code&gt;.find()&lt;/code&gt; to your initial query.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[&lt;code&gt;.find()&lt;/code&gt;] will be called automatically as soon as the ElementCriteriaModel is treated like an array (that is, as soon as you...  start looping through the elements)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So instead of allowing the default behavior to kick in, just apply &lt;code&gt;.ids()&lt;/code&gt; to the initial query, and get a batch of entry IDs instead of a full array of entries&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-06T21:53:34.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17157" PostTypeId="2" ParentId="17155" CreationDate="2016-10-06T22:14:03.303" Score="1" Body="&lt;p&gt;Lindsey's answer should be the accepted one, but just for kicks – here's an additional approach that makes sense if you need an array of IDs &lt;em&gt;and&lt;/em&gt; you want to loop over the entries, as well. Calling &lt;code&gt;.ids()&lt;/code&gt; on the ElementCriteriaModel will result in an additional database query, but using the &lt;code&gt;|group&lt;/code&gt; and &lt;code&gt;|keys&lt;/code&gt; filters won't:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authorEntries = craft.users.search('fullName:*' ~ query ~ '*').find() %}&#xA;{% set authorIds = authorEntries|group('id')|keys %}&#xA;&#xA;{% for authorId in authorIds %}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;{% for author in authorEntries %}&#xA;   ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-06T22:14:03.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17158" PostTypeId="2" ParentId="17154" CreationDate="2016-10-06T22:19:03.723" Score="1" Body="&lt;p&gt;I'm not familiar with Datagrab, but from your description it sounds like the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow&quot;&gt;Import plugin&lt;/a&gt; might work for you.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-06T22:19:03.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17159" PostTypeId="1" AcceptedAnswerId="17162" CreationDate="2016-10-07T00:56:29.897" Score="0" ViewCount="199" Body="&lt;p&gt;The slider requires an unique ID per slide, wrapped in &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; tags, so I am trying this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;rev_slider_15_1&quot; class=&quot;rev_slider fullwidthabanner&quot; style=&quot;display:none;&quot; data-version=&quot;5.2.5.4&quot;&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;    &amp;lt;!-- SLIDES --&amp;gt;&#xA;&#xA;    {% for testimonials in craft.entries.section('testimonials').limit(3) %} &#xA;&#xA;    &amp;lt;li data-index=&quot;rs-{{ testimonials.id }}&quot; &amp;gt;&#xA;&#xA;        &amp;lt;!-- LAYERS --&amp;gt;&#xA;&#xA;        &amp;lt;!-- LAYER NR. 1 --&amp;gt;&#xA;&#xA;        &amp;lt;p class=&quot;tp-caption tp-resizeme&quot; &#xA;           id=&quot;slide-{{ testimonials.id }}-layer-2&quot;&amp;gt;&#xA;&#xA;            {{ testimonials.body_testimonial }}&#xA;&#xA;        &amp;lt;/p&amp;gt;&#xA;&#xA;        &amp;lt;!-- LAYER NR. 2 --&amp;gt;&#xA;&#xA;        &amp;lt;span class=&quot;tp-caption tp-resizeme author&quot; &#xA;              id=&quot;slide-{{ testimonials.id }}-layer-3&quot; &amp;gt;&#xA;&#xA;            {{ testimonials.title }}&#xA;&#xA;        &amp;lt;/span&amp;gt;&#xA;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endfor %}    &#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in the first slide entry with both Title &amp;amp; Body, but the second and third slides only parse the Title not the Body.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone verify the craft code is correct? The entries are made in a Channel section with a handle; testimonials.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="689" LastEditDate="2016-10-07T03:01:00.477" LastActivityDate="2016-10-07T03:03:10.647" Title="Implementing Revolution Slider" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17160" PostTypeId="1" AcceptedAnswerId="17168" CreationDate="2016-10-07T01:39:01.143" Score="3" ViewCount="1356" Body="&lt;p&gt;Basically, I'm trying to show &quot;Out of stock&quot; and disable a button for when none of the variants have stock, and unlimited stock is unchecked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this, which isn't working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.variants.stock &amp;lt;= 0 and product.variants.unlimitedStock == false %}&#xA;    {{ &quot;Out of stock&quot;|t }}&#xA;{% else %}&#xA;    {{ &quot;Add to cart&quot;|t }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="57" LastEditDate="2016-10-07T04:05:06.697" LastActivityDate="2020-09-01T19:19:33.323" Title="How do I check if a product has stock in any of it's variants?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17161" PostTypeId="2" ParentId="17153" CreationDate="2016-10-07T02:42:57.443" Score="2" Body="&lt;p&gt;I'm not 100% sure I follow, but I think this is what you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your javascript file, you'll want &lt;code&gt;code.set&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/api/code/&quot; rel=&quot;nofollow&quot;&gt;API Reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;$('#yourTextArea').redactor('code.set', your.data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-10-07T02:42:57.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17162" PostTypeId="2" ParentId="17159" CreationDate="2016-10-07T03:03:10.647" Score="3" Body="&lt;p&gt;Yes, your code looks fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible that the second and third entries just don't have content in the &lt;code&gt;body_testimonial&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Unrelated — I recommend using &lt;code&gt;testimonial&lt;/code&gt; as your loop variable, since it represents a single Testimonial entry. This is a good practice in general: Variables that represent a list should have a plural name, and variables that represent a single object should have a singular name.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-10-07T03:03:10.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17163" PostTypeId="1" AcceptedAnswerId="17253" CreationDate="2016-10-07T04:22:58.987" Score="2" ViewCount="191" Body="&lt;p&gt;Can someone tell me how to do an image transform on a reference tag? I've tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set images %}&#xA;&amp;lt;img src=&quot;{asset:123:getUrl('transform')}&quot; /&amp;gt;&#xA;&amp;lt;img src=&quot;{asset:124:getUrl('transform')}&quot; /&amp;gt;&#xA;{% endset %}&#xA;&#xA;{{ images|parseRefs|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this just gives back the source urls and not the crops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="5161" LastActivityDate="2016-10-13T15:25:43.253" Title="image transform on reference tag" Tags="&lt;image-transforms&gt;&lt;reference-tags&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17164" PostTypeId="1" AcceptedAnswerId="17167" CreationDate="2016-10-07T05:46:21.887" Score="1" ViewCount="1231" Body="&lt;p&gt;I'm running Craft CMS with MAMP at &lt;code&gt;localhost:8888&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I pass in a URL with &lt;code&gt;{{ entry.title }}&lt;/code&gt;, I get &lt;a href=&quot;http://localhost/news/2016/we-just-installed-craft&quot; rel=&quot;nofollow&quot;&gt;http://localhost/news/2016/we-just-installed-craft&lt;/a&gt; which gives me a 404 until I manually put in the &lt;code&gt;:8888&lt;/code&gt; after localhost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something in the set up here?&lt;/p&gt;&#xA;" OwnerUserId="5732" LastEditorUserId="344" LastEditDate="2016-10-07T12:54:37.857" LastActivityDate="2016-10-07T12:54:37.857" Title="URL drops :8888 from localhost" Tags="&lt;url&gt;&lt;routes&gt;&lt;mamp&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17165" PostTypeId="2" ParentId="17163" CreationDate="2016-10-07T07:54:04.383" Score="1" Body="&lt;p&gt;I think you are forgetting to loop through the images. If not could you be clearer in your question?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should work like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imageHandle %}&#xA;    &amp;lt;img src=&quot;('{{ image.getUrl('transform') }}')&quot; width=&quot;{{ image.getWidth('transform') }}&quot; height=&quot;{{ image.getHeight('transform') }}');&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-10-07T07:54:04.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17166" PostTypeId="1" AcceptedAnswerId="17170" CreationDate="2016-10-07T07:59:18.987" Score="1" ViewCount="1069" Body="&lt;p&gt;I made an ajax function so my page wont refresh and my search window wont disappear on form submit. It works fine in all browsers but it keeps refreshing on Safari.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax %}&#xA;    {% set pagingJs %}&#xA;        $(function () {             &#xA;            $('#searchBtn').click(function (e) {&#xA;                $( &quot;.searchResult&quot; ).remove();&#xA;                $( &quot;.noResult&quot; ).remove();&#xA;                e.preventDefault();&#xA;                var search = $('#searchField').val();&#xA;&#xA;                $('#loading').show();&#xA;                $.get( &quot;/?q=&quot;+search, function( data ) {&#xA;                    data = $('#searchQuery', data).html();&#xA;                    $( &quot;#searchQuery&quot; ).append(data);&#xA;                });&#xA;            });&#xA;        });&#xA;        $( document ).ajaxStop(function() {&#xA;           $('#loading').hide();&#xA;        });&#xA;    {% endset %}&#xA;{% includeJs pagingJs %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2016-10-07T08:08:48.927" LastActivityDate="2016-10-07T09:42:28.867" Title="Ajax Function on a search form not working in Safari &amp; IE" Tags="&lt;search&gt;&lt;ajax&gt;&lt;javascript&gt;&lt;request&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17167" PostTypeId="2" ParentId="17164" CreationDate="2016-10-07T08:05:59.117" Score="3" Body="&lt;p&gt;I would try and put the port in your siteUrl config param:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; 'http://localhost:8888',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively you might be able to use this though haven't tested it (I believe the php server variable uses the server name &amp;amp; port number):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'localhost' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'http://'.$_SERVER['HTTP_HOST'],&#xA;    'devMode' =&amp;gt; true,&#xA;    'cacheMethod' =&amp;gt; 'file'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2016-10-07T08:05:59.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17168" PostTypeId="2" ParentId="17160" CreationDate="2016-10-07T08:13:48.550" Score="6" Body="&lt;p&gt;I managed do this with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variants = craft.commerce.variants({&#xA;    product: product,&#xA;    hasStock: true&#xA;}) %}&#xA;&#xA;{% if variants|length &amp;lt;= 0 %}&#xA;  Sold out&#xA;{% else %}&#xA;  Add to basket&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;hasStock&lt;/code&gt; criteria takes &lt;code&gt;unlimitedStock&lt;/code&gt; into consideration.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (isset($criteria-&amp;gt;hasStock) &amp;amp;&amp;amp; $criteria-&amp;gt;hasStock === true)&#xA;{&#xA;  $hasStockCondition = ['or', '(variants.stock &amp;gt; 0 AND variants.unlimitedStock != 1)', 'variants.unlimitedStock = 1'];&#xA;  $query-&amp;gt;andWhere($hasStockCondition);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-10-07T08:13:48.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17169" PostTypeId="2" ParentId="17164" CreationDate="2016-10-07T08:44:44.387" Score="2" Body="&lt;p&gt;Are you required to run port 8888? If not, you can set the port to 80 in MAMP and this would resolve the issue. I know this is not really a fix for your problem but it might be a potential work-around.&lt;/p&gt;&#xA;" OwnerUserId="4049" LastActivityDate="2016-10-07T08:44:44.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17170" PostTypeId="2" ParentId="17166" CreationDate="2016-10-07T09:42:28.867" Score="3" Body="&lt;p&gt;Try attaching the listener on the forms submit event instead, and prevent that instead of just the click on the button. Something like this (make sure you change the selector for your form):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax %}&#xA;    {% set pagingJs %}&#xA;        $(function () {             &#xA;            $('#myForm').on('submit', function (e) {&#xA;                e.preventDefault();&#xA;&#xA;                $( &quot;.searchResult&quot; ).remove();&#xA;                $( &quot;.noResult&quot; ).remove();&#xA;&#xA;                var search = $('#searchField').val();&#xA;&#xA;                $('#loading').show();&#xA;                $.get( &quot;/?q=&quot;+search, function( data ) {&#xA;                    data = $('#searchQuery', data).html();&#xA;                    $( &quot;#searchQuery&quot; ).append(data);&#xA;                });&#xA;            });&#xA;        });&#xA;        $( document ).ajaxStop(function() {&#xA;           $('#loading').hide();&#xA;        });&#xA;    {% endset %}&#xA;{% includeJs pagingJs %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-10-07T09:42:28.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17171" PostTypeId="1" AcceptedAnswerId="17172" CreationDate="2016-10-07T09:58:43.177" Score="1" ViewCount="517" Body="&lt;p&gt;Hey I'm writing my first Craft plugin and would like to add a button to have a dialog box in &lt;a href=&quot;https://i.stack.imgur.com/tAA1a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tAA1a.png&quot; alt=&quot;Choose an entry&quot;&gt;&lt;/a&gt;. I want to create a link to a page entry with this and save it to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I want to extend in my template: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;    &amp;lt;div class=&quot;&quot; style=&quot;width: 50%&quot;&amp;gt;&#xA;        &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;glossary/entry/saveEntry&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;glossary&quot;&amp;gt;&#xA;            {{ forms.textField({&#xA;               label: 'Glossary Entry'|t,&#xA;               instructions: 'Enter a new Word'|t,&#xA;               id: 'entry',&#xA;               name: 'entry',&#xA;               value: ''}) }}&#xA;            &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Submit'|t }}&quot;&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5735" LastEditorUserId="4466" LastEditDate="2016-10-07T13:45:40.867" LastActivityDate="2016-10-07T13:45:40.867" Title="Add an add entry button to my Plugin in Craft CP" Tags="&lt;plugins&gt;&lt;control-panel&gt;&lt;cp-dashboard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17172" PostTypeId="2" ParentId="17171" CreationDate="2016-10-07T11:59:35.663" Score="3" Body="&lt;p&gt;I believe what you need is the elementSelect field type which Craft bundles with the CMS. You can find the template of this field in &lt;code&gt;craft/app/templates/_includes/elementSelect.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a quick example that will get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.elementSelectField({&#xA;    label: 'Select An Entry'|t,&#xA;    instructions: 'Select...'|t,&#xA;    id: 'entry',&#xA;    name: 'entry',&#xA;    elementType: craft.elements.getElementType(&quot;Entry&quot;),&#xA;    source: '',&#xA;    criteria: '',&#xA;    sourceElementId: '',&#xA;    elements: '',&#xA;    storageKey: '',&#xA;    viewMode: 'list',&#xA;    limit: 1&#xA; }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5034" LastEditorUserId="5034" LastEditDate="2016-10-07T13:09:51.483" LastActivityDate="2016-10-07T13:09:51.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17173" PostTypeId="1" CreationDate="2016-10-07T13:03:40.167" Score="1" ViewCount="488" Body="&lt;p&gt;I am running a local install of Craft 3 Pro dev preview using MAMP and Sequel Pro on my iMac.  I downloaded the Commerce plugin to try it out and dropped the 'commerce' folder into my &lt;code&gt;craft/plugins&lt;/code&gt; folder.  When I visit the admin control panel and click on plugins, I can't see the Commerce folder/plugin I just added. Any suggestions as to why?&lt;/p&gt;&#xA;" OwnerUserId="5736" LastEditorUserId="57" LastEditDate="2016-10-07T17:51:11.370" LastActivityDate="2016-10-08T17:53:32.573" Title="Craft 3 doesn't see my Commerce plugin" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17174" PostTypeId="1" CreationDate="2016-10-07T13:08:57.233" Score="0" ViewCount="69" Body="&lt;p&gt;I have a Structure Section, with the following settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entries in this section have their own URLs = Checked&lt;/li&gt;&#xA;&lt;li&gt;Entry URL Format = recommendations/{slug} &amp;amp; {parent.uri}/{slug}&lt;/li&gt;&#xA;&lt;li&gt;Max Levels = 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This worked for the first few entries (both Parent and Child) I created but after saving and returning to the Structure page (from Entries), the entries are no longer nested and the 'move' icon is missing. And, 'Create a new child entry' is created but also not nested when created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another Structure Section I have set up is working correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried clearing both browser and Craft cache. Not sure else what to try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2949&lt;/p&gt;&#xA;" OwnerUserId="4413" LastEditorUserId="4413" LastEditDate="2016-10-07T13:14:53.150" LastActivityDate="2016-10-07T13:14:53.150" Title="Structure not allowing me to nest" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2016-10-07T19:32:16.877" ContentLicense="CC BY-SA 3.0" />
  <row Id="17175" PostTypeId="1" AcceptedAnswerId="17176" CreationDate="2016-10-07T15:53:49.020" Score="3" ViewCount="248" Body="&lt;p&gt;I was on the Twig StackExchange forum and found &lt;a href=&quot;https://stackoverflow.com/questions/13876023/check-if-variable-is-string-or-array-in-twig#answer-29642662&quot;&gt;&lt;strong&gt;an answer that suited my needs&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't for the life of me figure out how to implement this into a Craft CMS Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm familiar with &lt;code&gt;Twig_Function_Method&lt;/code&gt; and &lt;code&gt;Twig_Filter_Method&lt;/code&gt;, but I can't find anything on &lt;code&gt;Twig_SimpleTest&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has the option to include &quot;tests&quot; been omitted from Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-12-31T17:50:16.513" Title="Is it possible to extend twig with 'Twig_SimpleTest'?" Tags="&lt;plugin-development&gt;&lt;twigextension&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17176" PostTypeId="2" ParentId="17175" CreationDate="2016-10-07T18:03:24.373" Score="3" Body="&lt;p&gt;When you call Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#getTwig-detail&quot; rel=&quot;nofollow&quot;&gt;TemplatesService-&gt;getTwig()&lt;/a&gt; (&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;getTwig()&lt;/code&gt;), you get an instance of the Twig environment and from there you could be able to call &lt;a href=&quot;http://twig.sensiolabs.org/doc/advanced.html#tests&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;addTest&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;100% untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$twig = craft()-&amp;gt;templates-&amp;gt;getTwig();&#xA;$twig-&amp;gt;addTest(new My_Twig_SimpleTest());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-07T18:03:24.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17177" PostTypeId="2" ParentId="17150" CreationDate="2016-10-07T18:12:24.760" Score="2" Body="&lt;p&gt;If you want to enable fuzzy searching globally (across the entire Craft install - CP, front-end, ElementAPI, etc.), you can use the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&quot; rel=&quot;nofollow&quot;&gt;defaultSearchTerms&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also just do it programmatically from the ElementAPI plugin with something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suffix wildcard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['title' =&amp;gt; $search ~ '*']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Prefix wildcard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['title' =&amp;gt; '*' ~ $search]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both sides:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; ['title' =&amp;gt; '*' ~ $search ~ '*']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use any of the other search syntaxes listed on the &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow&quot;&gt;search docs&lt;/a&gt; page.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-07T18:12:24.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17178" PostTypeId="1" AcceptedAnswerId="17194" CreationDate="2016-10-08T07:36:10.543" Score="2" ViewCount="78" Body="&lt;p&gt;Realizing Twig can't escape a &lt;code&gt;for&lt;/code&gt; loop, how would one go about setting a variable for the current item and not the following?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scenario;&#xA;Color swatches are radio buttons, if default purchasable stock &amp;lt;= 0 and default purchasable unlimitedStock == false, the next radio button should be checked, and if this has stock &amp;lt;= 0 and so on, you get the idea, the next would be checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find a way to only check the next, and not all the following radio buttons if previous purchasable in the loop is out of stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of checking of the checkers being checked here. Hah.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="57" LastEditDate="2016-10-09T16:09:30.717" LastActivityDate="2016-10-10T16:00:42.430" Title="Any ideas on how to set/output something if the previous variant in a for loop has a parameter?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17180" PostTypeId="1" AcceptedAnswerId="17195" CreationDate="2016-10-08T10:01:30.480" Score="2" ViewCount="259" Body="&lt;p&gt;We have a change profile page where members can choose out of the users table who of the other members is their mother (or father).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below my (simplified) user profile form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&amp;lt;script&amp;gt;$(':checkbox').checkboxpicker();&amp;lt;/script&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;leden/wijzig-profiel?m=updated&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[mother][]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;mother&quot;&amp;gt;{{ 'mother'|t }}&amp;lt;/label&amp;gt;&#xA;&amp;lt;select name=&quot;fields[mother][]&quot; &amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;There is no mother&amp;lt;/option&amp;gt;&#xA;    {% for mother in mothers %}&#xA;    &amp;lt;option value=&quot;{{ mother.id }}&quot;&amp;gt;{{ mother.name }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;    {% for user in users %}&#xA;    &amp;lt;option value=&quot;{{ user.id }}&quot;&amp;gt;{{ user.name}}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}    &#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;{{ 'Save'|t }}&quot; name=&quot;proceed&quot; &amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to empty the field mother but that results in a CDbException error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand faalde tijdens het uitvoeren van volgend SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`familywebsite`.`craft_relations`, CONSTRAINT `craft_relations_targetId_fk` FOREIGN KEY (`targetId`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_relations` (`fieldId`, `sourceId`, `sourceLocale`, `targetId`, `sortOrder`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, NULL, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7), (:row1_col0, :row1_col1, NULL, :row1_col3, :row1_col4, :row1_col5, :row1_col6, :row1_col7). Bound with :row0_col0='136', :row0_col1='1', :row0_col3='', :row0_col4=1, :row0_col5='2016-10-08 09:54:35', :row0_col6='2016-10-08 09:54:35', :row0_col7='e4211e99-5bbd-46c1-b703-c44e82bc4667', :row1_col0='136', :row1_col1='1', :row1_col3='2409', :row1_col4=2, :row1_col5='2016-10-08 09:54:35', :row1_col6='2016-10-08 09:54:35', :row1_col7='c0fb9927-89f1-4993-ba26-bc47a63bdc50'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This I can understand because the mother is a relation of the user, and by clearing the mother field value, it probably does not delete the relation and it will give and error like it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So question is how to delete the relation with mother field?&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2016-10-10T16:43:02.440" Title="Delete a relation in frontend form" Tags="&lt;users&gt;&lt;relations&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17181" PostTypeId="2" ParentId="17175" CreationDate="2016-10-08T14:40:18.600" Score="3" Body="&lt;p&gt;Thanks Brad, that's what I was after. In the case of what I was trying to achieve; the following in my plugins init function did the job:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$twig = craft()-&amp;gt;templates-&amp;gt;getTwig();&#xA;&#xA;$twig-&amp;gt;addTest(new \Twig_SimpleTest('array', function ($value) {&#xA;  return is_array($value);&#xA;}));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I always struggle with syntax, so hopefully this example will help others.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3 Solution&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this to your plugins main init() function: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;addTests(Craft::$app-&amp;gt;view-&amp;gt;getTwig());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then add this function after the init(): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function addTests($twig) {&#xA;  // Is String&#xA;  $twig-&amp;gt;addTest(new \Twig_SimpleTest('string', function ($value) {&#xA;    return is_string($value);&#xA;  }));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2017-12-31T17:50:16.513" LastActivityDate="2017-12-31T17:50:16.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17182" PostTypeId="2" ParentId="17178" CreationDate="2016-10-08T14:49:57.203" Score="1" Body="&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion&quot; rel=&quot;nofollow&quot;&gt;MN Twig Perversion&lt;/a&gt; plugin. It adds a &lt;code&gt;break&lt;/code&gt; Twig tag, which allows you to escape from a loop once you have the data you need. &lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-08T14:49:57.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17183" PostTypeId="2" ParentId="17173" CreationDate="2016-10-08T15:29:45.177" Score="4" Body="&lt;p&gt;The whole plugin API has gotten an overhaul in Craft 3, so all plugins needs to be rewritten/updated to work with Craft 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce hasn't been updated yet. If it had there would be separate versions for Craft 2 and 3 for download. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-10-08T15:29:45.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17185" PostTypeId="1" AcceptedAnswerId="17186" CreationDate="2016-10-08T18:15:49.937" Score="9" ViewCount="1465" Body="&lt;p&gt;I am just about to start a new project and Craft seems the best fit as a CMS. The projects timescale is 3 months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that a beta for Craft 3 is due out at the end of this year (2016). In view of this, should i start development on Craft 3? Or run with Craft 2 for now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The project will involved bespoke plugin development and use of the Commerce plugin. Is there any timeframe in place for updating the Commerce plugin to run on v3?&lt;/p&gt;&#xA;" OwnerUserId="5740" LastActivityDate="2017-06-05T20:54:22.740" Title="New Project: Wait for Craft 3 or start now with Craft 2?" Tags="&lt;craft3&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17186" PostTypeId="2" ParentId="17185" CreationDate="2016-10-08T19:17:16.877" Score="22" Body="&lt;p&gt;My recommendation would be to go with Craft 2: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A bird in the hand is worth two in the bush&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no doubt that Pixel &amp;amp; Tonic has turned their focus to Craft 3, but software projects are complex and often take longer than expected and Craft 3 currently only has speculative release dates. It has also had speculative release dates in the past.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've made the decision to go with Craft it's likely your additional costs based on the Craft 3 transition will either be to deal with uncertainty and moving targets while developing on Craft 3 for the next several months or to go with the stability of Craft 2 and deal with some extra costs of upgrading to Craft 3 when the transition is well documented and Craft 3 is stable.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-08T19:17:16.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17187" PostTypeId="1" CreationDate="2016-10-08T20:15:13.170" Score="2" ViewCount="486" Body="&lt;p&gt;I get a stuck &lt;code&gt;GeneratePendingTransforms&lt;/code&gt; task over and over again. In the first place, I don't know why any transforms are getting created at that point. By now, almost every image transform for every image on the site must have been create once. And it seems like those generations happen on the weirdest moments. It can't be the images of a freshly posted entry that had to be created, because there's always +300 steps in the tasks (and there are 5 images at most on a new entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway. It seems that those tasks also get stuck every time. I don't know why they get stuck. And yes, I know you can change the status to &lt;code&gt;pending&lt;/code&gt;. But I can't keep doing this 10 times a day. The craft log doesn't give me much more information. Right now I have a &lt;code&gt;GeneratePendingTransforms&lt;/code&gt; task that is stuck at step 333 from 341. And this is the latest info in the craft log file:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;2016-10-08 21:55:00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level   error&#xA;Category    exception.Craft\HttpException.404&#xA;Message Craft\HttpException in /srv/users/ijnluser/apps/ijnl/craft/app/controllers/TemplatesController.php:59&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I don't know if stuck tasks also prevent the execution of pending tasks? But I also noticed cached items don't get cleared at all, and I have to clear them manually. Could this be because they are waiting to run, after the stuck task is done?&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2016-10-09T21:59:41.750" Title="GeneratePendingTransforms stuck every time" Tags="&lt;image-transforms&gt;&lt;tasks&gt;&lt;logs&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17189" PostTypeId="2" ParentId="17185" CreationDate="2016-10-08T23:30:13.673" Score="9" Body="&lt;p&gt;&lt;strong&gt;Ben's answer is excellent, and should be marked as correct.&lt;/strong&gt; This is simply some additional information to reinforce the decision to use Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current version of Craft 3 is a &lt;s&gt;&lt;em&gt;developer preview&lt;/em&gt;&lt;/s&gt; &lt;em&gt;beta&lt;/em&gt; (thanks Simon)... This means that there are no implicit claims of stability, and anything could change at any time. Similarly, there is no guarantee that you will be provided with a clean migration path for your data, if something were to change internally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, Commerce is not yet compatible with Craft 3. It's possible that Commerce won't be adapted to C3 until the official launch of C3 (tentatively slated for late 2017).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, upgrading your completed site from Craft 2 to Craft 3 should be (reasonably) painless. The facets of the site which do not directly depend on plugins should be a nearly seamless transition to C3. For the parts of your site which do depend on plugins, it will mostly be a matter of adapting those plugins to the new C3 architecture. While this will probably amount to a small-to-medium sized challenge, it will require the exact same learning curve as you'd be taking on if you were to jump into Craft 3 now. In fact, the learning curve would (theoretically) be easier if you waited, since the Craft build would be considered stable, and there may even be some documentation (and/or tutorials) available at that time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, &lt;strong&gt;definitely go with Craft 2 for now&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-06-05T20:54:22.740" LastActivityDate="2017-06-05T20:54:22.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17190" PostTypeId="2" ParentId="17187" CreationDate="2016-10-09T19:26:45.420" Score="2" Body="&lt;p&gt;I think to solve your issue we're going to need a bit more of information. A couple of things you can try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;set a higher max execution time. I think normally the max execution time is 120 sec. and this sometimes blocks other transforms&lt;/li&gt;&#xA;&lt;li&gt;try using the &lt;a href=&quot;https://github.com/boboldehampsink/taskmanager&quot; rel=&quot;nofollow&quot;&gt;craft task manager plugin&lt;/a&gt; to remove any tasks that get stuck. &lt;/li&gt;&#xA;&lt;li&gt;try reindexing the images, remove all the cached items, check your folder permissions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That being said, I stopped using the image transforms Craft provides out of the box and started using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow&quot;&gt;Imager&lt;/a&gt;. Imager provides a handy way to do transforms in your template. Works like a charm and lots of handy options.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2016-10-09T19:26:45.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17192" PostTypeId="2" ParentId="17187" CreationDate="2016-10-09T21:59:41.750" Score="1" Body="&lt;p&gt;I'd suggest reading over the &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow&quot;&gt;Stuck Tasks&lt;/a&gt; support article.  It has general debugging tips for all tasks for figuring out why they get stuck and more specifically debugging tips for the &lt;a href=&quot;https://craftcms.com/support/stuck-tasks#debugging-stuck-generate-pending-transforms-tasks&quot; rel=&quot;nofollow&quot;&gt;Generate Pending Transforms&lt;/a&gt; task.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't know if stuck tasks also prevent the execution of pending tasks?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, a stuck task will prevent any other tasks created after it became stuck from running.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-09T21:59:41.750" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17194" PostTypeId="2" ParentId="17178" CreationDate="2016-10-10T16:00:42.430" Score="1" Body="&lt;p&gt;Here's a simple solution that might be viable for your scenario:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selected = false %}&#xA;{% for purchasable in product.variants %}&#xA;    {% if selected == false and (purchasable.stock &amp;gt; 0 or purchasable.unlimitedStock) %}&#xA;        {# output selected radio #}&#xA;        {% set selected = true %}&#xA;    {% else %}&#xA;        {# output unselected radio #}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially set a variable (&lt;code&gt;selected&lt;/code&gt; in this case) that once set cannot be re-set, and is only set under the circumstances you mentioned (stock available or unlimitedStock set to true).&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-10T16:00:42.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17195" PostTypeId="2" ParentId="17180" CreationDate="2016-10-10T16:14:04.740" Score="4" Body="&lt;p&gt;I believe you're getting that error because you're supplying an array (&lt;code&gt;[]&lt;/code&gt;) for the mother field and the only value in that array would be an empty string (&lt;code&gt;&quot;&quot;&lt;/code&gt;) if they select the &lt;code&gt;There is no mother&lt;/code&gt; option. So what Craft is attempting to save as a relation is &lt;code&gt;[&quot;&quot;]&lt;/code&gt;. Instead of an array of integer ID numbers, it's getting an empty string which isn't a valid value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you remove the value attribute of the option tag for the &lt;code&gt;There is no mother&lt;/code&gt; option, the field will use the inner text of the tag as the value, so this does not solve your problem either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One suggestion would be to use radio buttons instead and do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; name=&quot;&quot; value=&quot;&quot;&amp;gt; There is no mother&amp;lt;/label&amp;gt;&#xA;{% for mother in mothers %}&#xA;    &amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; name=&quot;fields[mother][]&quot; value=&quot;{{ mother.id }}&quot;&amp;gt; {{ mother.name }}&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;{% for user in users %}&#xA;    &amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; name=&quot;fields[mother][]&quot; value=&quot;{{ user.id }}&quot;&amp;gt; {{ user.name }}&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will keep the field empty if someone selects the &lt;code&gt;There is no mother&lt;/code&gt; option.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastEditorUserId="5034" LastEditDate="2016-10-10T16:43:02.440" LastActivityDate="2016-10-10T16:43:02.440" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17197" PostTypeId="1" AcceptedAnswerId="17199" CreationDate="2016-10-10T22:03:41.333" Score="2" ViewCount="506" Body="&lt;p&gt;I have adjusters that dynamically add/remove costs to things like &lt;code&gt;baseShippingCost&lt;/code&gt; and &lt;code&gt;baseDiscount&lt;/code&gt;, and want to be able to specifically show the numbers for those adjusters on the cart page - not just the total &lt;code&gt;baseDiscount&lt;/code&gt; or &lt;code&gt;baseShippingCost&lt;/code&gt; number - as things like shipping costs, or coupons, are also bundled into those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the adjuster example from documentation, I'll use this as the example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {&#xA;&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;    $myAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;    $order-&amp;gt;baseDiscount = $order-&amp;gt;baseDiscount - 5;&#xA;&#xA;    $myAdjuster-&amp;gt;type = &quot;Tax Remover&quot;;&#xA;    $myAdjuster-&amp;gt;name = &quot;Australian GST Remover&quot;;&#xA;    $myAdjuster-&amp;gt;description = &quot;Removes the 10% GST&quot;;&#xA;    $myAdjuster-&amp;gt;amount = -5.0;&#xA;    $myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;    $myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt;null];&#xA;    $myAdjuster-&amp;gt;included = false;&#xA;&#xA;    return [$myAdjuster];&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I access the &lt;code&gt;$myAdjuster-&amp;gt;amount&lt;/code&gt; in the template/twig file for the order? I've tried &lt;code&gt;{{ cart.myAdjusterName.amount }}&lt;/code&gt; and I simply get the error &quot;Craft\Commerce_OrderModel and its behaviors do not have a method or closure named &quot;&lt;strong&gt;myAdjusterName&lt;/strong&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to get this information? Any help would be great!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-10-11T10:38:24.053" Title="Show Adjuster Amount Only in Commerce" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17199" PostTypeId="2" ParentId="17197" CreationDate="2016-10-11T10:38:24.053" Score="1" Body="&lt;p&gt;You can access each adjuster and its respective amount via the &lt;code&gt;cart.adjustments&lt;/code&gt; tag. Here's the example supplied with the templates from the commerce plugin (commerce/cart.html):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for adjustment in cart.adjustments %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ adjustment.type }}&#xA;        &amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;&amp;lt;strong&amp;gt;{{ adjustment.name }}&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;({{ adjustment.description }})&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;text-right&quot;&amp;gt;{{ adjustment.amount|currency(cart.currency) }}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have set the &lt;code&gt;included&lt;/code&gt; attribute of your Adjuster to true then it won't show up as an adjuster but only affect the cart amounts outputted (such as &lt;code&gt;baseShippingCost&lt;/code&gt; and &lt;code&gt;baseDiscount&lt;/code&gt;) so if you have something similar to the above already, that's why it won't be displayed. You can read more about the &lt;code&gt;included&lt;/code&gt; attribute &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-11T10:38:24.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17200" PostTypeId="1" CreationDate="2016-10-11T13:05:41.020" Score="2" ViewCount="540" Body="&lt;p&gt;&lt;strong&gt;I need to show a list of Child Categories which only have Entries attached.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From about 6 different solutions here, I have assembled the following. It works perfectly on a Section that has &amp;lt; 200 Entries with a Category Group that contains 50 Parent Cats that each may have up to 10 Child Cats. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My concern is that with a larger Section (3,200 entries, yet to be imported into Craft) it will break down, timeout, etc. because in order for this to work, ALL the Entries from a Section must be present in the Array for the Categories to check Relations against. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For brevity and clarity, the following URL structure is required by the client for several reasons... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;URL = /alpha/yadda/news&#xA;syntax = /[parent-category]/identifier/[section]&#xA;&#xA;Section = News&#xA;Category Group = 1&#xA;Category Examples =&#xA;alpha&#xA;    alpha-1&#xA;    alpha-2&#xA;    alpha-3&#xA;beta&#xA;    beta-1&#xA;    beta-2&#xA;    beta-3&#xA;    beta-4&#xA;etc....&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on that, here is what I've assembed that works great for 200 entries in News. It outputs a list of Child categories that only have News entries, based on the Parent's Category Slug in segment 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{# 1. find ALL the entry ids for a channel #}&#xA;{% set entryIds = craft.entries.section('news').limit(null).ids() %}&#xA;&#xA;{# 2. find all the cats in Group 1 related to those entries #}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).groupId(1).limit(null).find() %}&#xA;&#xA;{# 3. set var from URL seg1 and use to get CatModel Object: catParent #}&#xA;{% set parentSlug = craft.request.getSegment(1) %}&#xA;{% set catParent = craft.categories.slug(parentSlug).first() %}&#xA;&#xA;{# 4. using catParent, get child cats #}&#xA;{% set subCategories = craft.categories.descendantOf(catParent) %}&#xA;&#xA;{# 5. loop through cats found matching entries in step 2 &#xA;        then subloop through this Parent Cat's descendants for match #}&#xA;{% for category in categories %}&#xA;    {% set currentCat = category.title %}&#xA;    {% for subCat in subCategories %}&#xA;        {% if subCat.title == currentCat %}&#xA;            &amp;lt;li&amp;gt;{{ subCat.title }}&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, this all works...for 200 entries in News. But I don't see how it's scalable for the 3,200 blog entries that will be imported. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Just seems like there must be a better, more efficient way to display a list of Categories (or only descendants of a specific Parent Cat) that have Entries attached?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5593" LastActivityDate="2018-08-10T18:38:06.000" Title="List Only Child Categories Related to Entries" Tags="&lt;entries&gt;&lt;category&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17201" PostTypeId="1" CreationDate="2016-10-11T13:37:37.810" Score="1" ViewCount="2212" Body="&lt;p&gt;I'm trying to get a dev environment set up and have got stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use Linux in the office and Windows at home. I simply wanted a basic LAMP stack to run craft on so I could develop locally. Given the two OSs, I figured I'd use Xampp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've installed Xampp on my Linux Mint PC. localhost seems to take me to htdocs, which I understand is normal? I've put Craft in htdocs, and then created a folder called public and put the index.php etc. in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;htdocs&#xA; - craft&#xA; - public&#xA;   - index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I then do localhost/public/admin, I get&#xA;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /opt/lampp/htdocs/public/index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My craft path is set to ../craft (i.e. the default)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a google, and there do seem to be similar questions, but mostly on Windows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I move everything up a level? Or am I doing something else wrong?&lt;/p&gt;&#xA;" OwnerUserId="5727" LastActivityDate="2016-10-11T14:01:55.460" Title="Installing Craft on Xampp" Tags="&lt;setup&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17202" PostTypeId="2" ParentId="17201" CreationDate="2016-10-11T14:01:55.460" Score="1" Body="&lt;p&gt;It might be easier for you to set up a local domain and access it via my-site.dev rather than localhost/public/admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using xampp this is a bit of a manual process. You'll need to go into:&#xA;xampp/apache/conf/extra/httpd-vhosts.conf and the following &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;## my site name Site  &#xA;&amp;lt;VirtualHost *:80&amp;gt; &#xA;    DocumentRoot &quot;D:/xampp/htdocs/my-site&quot;&#xA;    ServerName my-site.dev&#xA;    ServerAlias www.my-site.dev&#xA;    &amp;lt;Directory &quot;d:/xampp/htdocs/my-site&quot;&amp;gt;&#xA;        Order allow,deny&#xA;        Allow from all&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The open your text editor with administrator rights and go to: c:\windows\system32\drivers\etc\hosts and add the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;127.0.0.1 my-site.dev&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For an easier process to set this up use &lt;a href=&quot;http://www.ampps.com/&quot; rel=&quot;nofollow&quot;&gt;Ampps instead&lt;/a&gt; the gui is simpler and everything is automated. Though you may still need to open your hosts file with your text editor if you haven't set up ampps to run with administrator privileges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used to use xampps, but now much prefer ampps on windows.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-10-11T14:01:55.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17203" PostTypeId="1" AcceptedAnswerId="17204" CreationDate="2016-10-11T14:14:08.987" Score="5" ViewCount="753" Body="&lt;p&gt;Is it possible to include any tax values in the price on the products page (not just the cart)?&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2016-10-18T11:44:40.857" Title="Include tax in price on product page" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17204" PostTypeId="2" ParentId="17203" CreationDate="2016-10-11T14:19:53.600" Score="2" Body="&lt;p&gt;I believe the only way to do this at present is to select the &lt;code&gt;Include in Price&lt;/code&gt; option on the Tax Rate in Commerce settings.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-11T14:19:53.600" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17206" PostTypeId="1" AcceptedAnswerId="17219" CreationDate="2016-10-11T15:16:04.650" Score="1" ViewCount="153" Body="&lt;p&gt;I've searched and searched for info on regex backreferences in Craft's route.php file to no avail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a URL structure required by the client along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/ [state] / [section] / region / [region]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so for examples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;/ hawaii / hotels / region / oahu&#xA;/ hawaii / retaurants / region / oahu&#xA;/ hawaii / hotels / region / maui&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;hotels&quot; and &quot;restaurants&quot; are each their own Section (Channels) and require their own templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the above URL examples, I've created template directories: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;/hotels/region.html&#xA;/restaurants/region.html&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can manage the routes if I spell them all out. But what I'd like to do is use regex backreferences in the target templates. &#xA;Tried but it fails. tried something like the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;'hawaii/(.*)/region' =&gt; '\1/region'&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The '\1' backreference doesn't catch the first group of either &quot;hotels&quot; or &quot;restaurants.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it simply not possible to use backrefs in the target route templates...or is my syntax not correct for Craft?&lt;/p&gt;&#xA;" OwnerUserId="5593" LastActivityDate="2016-10-11T21:25:07.243" Title="Possible to use REGEX Backreference in Routes" Tags="&lt;templating&gt;&lt;routes&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17207" PostTypeId="1" CreationDate="2016-10-11T15:31:05.723" Score="2" ViewCount="46" Body="&lt;p&gt;I'm running Craft CMS 2.6.2949 on PHP 7.0.10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up 3 locales: nl_be, en and fr. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the following config into general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    '.dev' =&amp;gt; array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'nl_be' =&amp;gt; 'http://xxx.dev/',&#xA;        'en' =&amp;gt; 'http://xxx.dev/en/',&#xA;        'fr' =&amp;gt; 'http://xxx.dev/fr/'&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have set the section to translateable and set some fields to be translateable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have translated some entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I open the entry in the main language (nl_be) the website load with the desired template and styling. &lt;a href=&quot;http://xxx.dev/nieuws/2016/we-installeerden-net-dit&quot; rel=&quot;nofollow&quot;&gt;http://xxx.dev/nieuws/2016/we-installeerden-net-dit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I open the translated version &#xA;&lt;a href=&quot;http://xxx.dev/en/news/2016/we-just-installed-craft&quot; rel=&quot;nofollow&quot;&gt;http://xxx.dev/en/news/2016/we-just-installed-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a white, empty page. It seems like the template is not loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks a lot in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first time I'm trying Craft and I really love it. Great work Pixel &amp;amp; Tonic!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bart&lt;/p&gt;&#xA;" OwnerUserId="5748" LastEditorUserId="22" LastEditDate="2017-05-09T21:01:50.563" LastActivityDate="2017-05-09T21:01:50.563" Title="Translated pages load a white empty page on localised site" Tags="&lt;localization&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17208" PostTypeId="1" AcceptedAnswerId="17418" CreationDate="2016-10-11T16:44:28.180" Score="1" ViewCount="114" Body="&lt;p&gt;First post here and I am a complete newbie when it comes to Craft and any kind of server config but I am trying to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying get my Craft site that I built locally up to a server today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed a pretty detailed guide about setting up EC2 for craft here:&#xA;&lt;a href=&quot;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I'm running into is that when I go to my EC2 URL I'm getting a &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Service Unavailable&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Our site is temporarily unavailable. Please try again later.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then trying to login, I get a&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Craft can’t connect to the database with the credentials in&#xA;  craft/config/db.php.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;With devmode on and looking at the console, its throwing me this error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;install:82 [16:36:40.799][error][exception.Craft\DbConnectException]&#xA;  exception 'Craft\DbConnectException' with message 'Craft can’t connect&#xA;  to the database with the credentials in craft/config/db.php.' in&#xA;  /var/www/craft/app/etc/behaviors/AppBehavior.php:855&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So clearly Craft is unable to find the database that I created locally but I'm not really sure how to fix this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My db.php&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;'server' =&amp;gt; 'localhost',&#xA;&#xA;// The name of the database to select.&#xA;'database' =&amp;gt; 'mydatabasename',&#xA;&#xA;// The database username to connect with.&#xA;'user' =&amp;gt; 'root',&#xA;&#xA;// The database password to connect with.&#xA;'password' =&amp;gt; 'root',&#xA;&#xA;// The prefix to use when naming tables. This can be no more than 5 characters.&#xA;'tablePrefix' =&amp;gt; 'craft',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5553" LastEditorUserId="3951" LastEditDate="2017-11-08T20:11:55.803" LastActivityDate="2017-11-08T20:11:55.803" Title="Transitioning local Craft site to AWS EC2" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17210" PostTypeId="1" CreationDate="2016-10-11T17:18:26.930" Score="0" ViewCount="868" Body="&lt;p&gt;We’re having a big issue with SEO data. Any link preview does not pull the entry title but the global site title. For example, &lt;a href=&quot;http://bridgepartnersconsulting.com/insights/detail/darby-greenwell-joins-bridge-partners-to-lead-analytics-practice&quot; rel=&quot;nofollow&quot;&gt;on this blog post&lt;/a&gt;, all link previews (Google, Twitter, Facebook, LinkedIn, etc) show just Bridge Partners as the title and not the page title of Darby Greenwell Joins Bridge Partners To Lead Analytics Practice. I have searched high and low for solutions to this problem. Can anyone help point me in the right direction? Thank you! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.bridgepartnersconsulting.com&lt;/p&gt;&#xA;" OwnerUserId="5749" LastActivityDate="2017-09-11T18:53:27.470" Title="SEO Title Tags Not Showing" Tags="&lt;titles&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17211" PostTypeId="2" ParentId="17207" CreationDate="2016-10-11T17:29:50.087" Score="2" Body="&lt;p&gt;I found this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only copied the lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the German content&#xA;define('CRAFT_LOCALE', 'de');&#xA;&#xA;// Do not edit below this line&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from the example here: &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt; to the index.php file in the localised folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not copy the $path lines from the original index.php file in the webroot. This way I got the white empty pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for the help on Twitter. I'm on my way to finish my first site!&lt;/p&gt;&#xA;" OwnerUserId="5748" LastActivityDate="2016-10-11T17:29:50.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17212" PostTypeId="2" ParentId="17185" CreationDate="2016-10-11T17:59:36.087" Score="3" Body="&lt;p&gt;If you use a lot of third-party plugins, it can be more risky to start the project in Craft 2. Because you never know whether and if when an upgraded Craft 3 version of the plugin will be available.&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2016-10-11T17:59:36.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17213" PostTypeId="1" CreationDate="2016-10-11T18:15:36.020" Score="0" ViewCount="71" Body="&lt;p&gt;Having an issue searching a Matrix field for a block with a certain value and storing the entire block in a variable. Right now it only seems to be storing the &lt;code&gt;location&lt;/code&gt; value. The &lt;code&gt;navigations&lt;/code&gt; field is a Super Table.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{## looping through matrix blocks works ##}&#xA;{% for block in siteNav.navigations %}&#xA;&#xA;    {{ block.location }}&#xA;&#xA;    {% for row in block.navLinks %}&#xA;        {{ row.label }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{## set variable via search matrix block only selects location field ##}&#xA;{% set utilityNav = siteNav.navigations.location('utility').limit(1) %}&#xA;&#xA;{{ utilityNav.location }}&#xA;&#xA;{% for row in utilityNav.navLinks %}&#xA;  {{ row.label }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="202" LastEditorUserId="57" LastEditDate="2016-10-11T21:39:41.800" LastActivityDate="2016-10-11T21:39:41.800" Title="Storing a Matrix block data in a variable" Tags="&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17214" PostTypeId="2" ParentId="17210" CreationDate="2016-10-11T18:48:14.700" Score="2" Body="&lt;p&gt;It would be helpful if you post your code instead of a link, as the metadata available on the linked page may change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few considerations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure your page is outputting metadata for each of the services you mention. It looks like you are outputting some basic and Open Graph metadata, but you don't appear to have any Twitter Card metadata. I've added a list of common meta tags that should help address most social sharing scenarios below.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most of the services you have document which tags matter to them and some even have debugger tools that can help you troubleshoot.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ogp.me&quot; rel=&quot;nofollow&quot;&gt;Open Graph Protocol&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://developers.facebook.com/tools/debug/&quot; rel=&quot;nofollow&quot;&gt;Facebook Debugger&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dev.twitter.com/cards/overview&quot; rel=&quot;nofollow&quot;&gt;Twitter Card Spec&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cards-dev.twitter.com/validator&quot; rel=&quot;nofollow&quot;&gt;Twitter Card validator&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/help/linkedin/answer/46687/making-your-website-shareable-on-linkedin?lang=en&quot; rel=&quot;nofollow&quot;&gt;LinkedIn Sharing&lt;/a&gt; uses the same Open Graph tags as Facebook&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure you consider caching. Sometimes, when you test your shared content the services you share it on will cache it. If you then update your content you may not see the updated version of your content in a link you have already shared until you break that cache.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Structured Data is also becoming an important type of metadata to add to your pages: &lt;a href=&quot;https://developers.google.com/search/docs/guides/intro-structured-data&quot; rel=&quot;nofollow&quot;&gt;https://developers.google.com/search/docs/guides/intro-structured-data&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This stuff gets complicated to maintain directly in your templates very quickly. Several Craft plugins are available to help manage that complexity. &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow&quot;&gt;Sprout SEO&lt;/a&gt; and &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow&quot;&gt;SEOmatic&lt;/a&gt; are two SEO plugins that are well supported and try to address the majority of SEO best practices that you need to worry about.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Common Meta Tags for Search and Social Sharing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Search --&amp;gt;&#xA;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;&quot; /&amp;gt;&#xA;&amp;lt;meta name=&quot;keywords&quot; content=&quot;&quot; /&amp;gt;&#xA;&amp;lt;meta name=&quot;robots&quot; content=&quot;&quot; /&amp;gt;&#xA;&amp;lt;link rel='canonical' href='' /&amp;gt;&#xA;&#xA;&amp;lt;!-- Open Graph --&amp;gt;&#xA;&amp;lt;meta property='og:type' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:url' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:site_name' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:title' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:description' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:image' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:image:width' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:image:height' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:image:type' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:author' content='' /&amp;gt;&#xA;&amp;lt;meta property='og:publisher' content='' /&amp;gt;&#xA;&#xA;&amp;lt;!-- Twitter Card --&amp;gt;&#xA;&amp;lt;meta property='twitter:card' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:url' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:site' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:creator' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:title' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:description' content='' /&amp;gt;&#xA;&amp;lt;meta property='twitter:image' content='' /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-10-11T20:07:18.430" LastActivityDate="2016-10-11T20:07:18.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17215" PostTypeId="1" CreationDate="2016-10-11T18:55:08.733" Score="1" ViewCount="289" Body="&lt;p&gt;I've been trying to deal with saving matrix fields to an external API by hooking onto the &lt;code&gt;craft()-&amp;gt;on('entries.saveEntry)&lt;/code&gt; function in a custom plugin I made. Matrices are nice for content authoring, but aren't quite nice for efficient retrieval in their current craft implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I made a matrix field like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2G65W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2G65W.png&quot; alt=&quot;matrix block&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I wanted to handle parsing this using the &lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {}&lt;/code&gt; hook inside of a plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($event-&amp;gt;params['entry']-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $fieldLayoutField)&#xA;{&#xA;    $imageArray = array();&#xA;    $field = $fieldLayoutField-&amp;gt;getField();&#xA;    // Now get the prepped field value&#xA;    $value = $event-&amp;gt;params['entry']-&amp;gt;getFieldValue($field-&amp;gt;handle);&#xA;    //Check what type of field that is being saved&#xA;    if(is_object($value)) {&#xA;          switch (get_class($value)) {&#xA;            case 'Craft\ElementCriteriaModel':&#xA;                $matrixBlocks = $value;&#xA;                $value = array();&#xA;                $elementType = $matrixBlocks-&amp;gt;getElementType();&#xA;                if(is_object($elementType)) {&#xA;                    switch(get_class($elementType)) {&#xA;                        case 'Craft\MatrixBlockElementType':&#xA;                            //Get each element block&#xA;                            foreach($matrixBlocks as $blocks) {&#xA;                                $valueNested = array();&#xA;                                $valueNested['type'] = $blocks-&amp;gt;type-&amp;gt;handle;&#xA;                                $valueNested['status'] = $blocks-&amp;gt;status;&#xA;                                //Loop over each field in the matrix field&#xA;                                foreach ($blocks-&amp;gt;getContent()-&amp;gt;getAttributes() as $key =&amp;gt; $blockVal) &#xA;                                {&#xA;                                    //How do I get the type of this element???&#xA;                                    //This could be an asset, or text field, etc.&#xA;                                    $valueNested[$key] = $blockVal;&#xA;                                }//End Foreach blocks-&amp;gt;getContent()&#xA;                                //Add the results to the value array, since we can have multiple matrix types&#xA;                                array_push($value, $valueNested);&#xA;                            } // End For-each matrix blocks&#xA;                         break;&#xA;                    } //End switch&#xA;    } //End if object($value)&#xA;} // End For Each&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code works to save the matrix items into an array along with the value. I'm trying to figure out if it is possible to figure out what type the element inside of the matrix is programmatically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex. Figure out if the item is a text field or a asset, etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spent hours in xdebug trying functions, looking through the matrix block type reference and seem quite lost. Anyone have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5750" LastActivityDate="2016-10-11T18:55:08.733" Title="Getting type of element inside of a matrix field using plugin hook" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;php&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17216" PostTypeId="1" AcceptedAnswerId="17217" CreationDate="2016-10-11T19:21:29.953" Score="1" ViewCount="84" Body="&lt;p&gt;This is really a Redactor-specific question, but I wondered if there is a simple way for clients to view what H1, H2 etc. text is formatted as? I currently instruct them to click on the HTML button whilst selecting the text / having the cursor on the text to view what heading the text is, however it would be really nice for them to be able to see what the text is formatted as without having to look at HTML code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the 2nd or 3rd client now that has asked me the same question. I wonder if anyone has experience in providing a cleaner solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2016-10-11T19:53:51.377" Title="Check formatting of text in Redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17217" PostTypeId="2" ParentId="17216" CreationDate="2016-10-11T19:53:51.377" Score="2" Body="&lt;p&gt;There is a Redactor setting that should do what you’re looking for: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Stucture&lt;/strong&gt;&lt;br&gt;&#xA;  This settings introduces visual indicators for HTML tags h1-h6 and div, helping users understand the structure of the document.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/special/#setting-structure&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/docs/settings/special/#setting-structure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example editor:&lt;br&gt;&#xA;&lt;a href=&quot;https://imperavi.com/redactor/examples/structure/&quot; rel=&quot;nofollow&quot;&gt;https://imperavi.com/redactor/examples/structure/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-10-11T19:53:51.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17218" PostTypeId="1" AcceptedAnswerId="17220" CreationDate="2016-10-11T20:04:36.543" Score="1" ViewCount="391" Body="&lt;p&gt;I have multiple custom shipping methods, each with rules which determine whether or not they will be available to the user. Basic things like minimum order cost and their address which would determine if a certain shipping method is available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some scenarios where a shipping method wont be available and the reason could depend. I need to be able to tell the user what exactly caused it to be unavailable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function matchOrder(\Craft\Commerce_OrderModel $order){&#xA;&#xA;    // If this is true, do not enable shipping method.&#xA;    if($scenario_1) { return false; }&#xA;&#xA;    // If this is true, do not enable shipping method.&#xA;    if($scenario_2) { return false; }&#xA;&#xA;    return true;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the event that one of those is true, the shipping method is not available to the user. On the shipping page, I can check if it is enabled or not like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'myShippingMethod' not in craft.commerce.availableShippingMethods|keys %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that only does me good in simply whether or not it's available - not for knowing why it isn't available. Is there a way I could somehow 'pass' information to the templates for the shipping methods that didn't return true? That way I could tell user &quot;This shipping method isn't available because of &lt;code&gt;$scenario_1&lt;/code&gt;&quot; or &quot;This shipping method isn't available due to &lt;code&gt;$scenario_2&lt;/code&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make sense? Trying to think of a good way to go about this. Any thoughts about how I should go about this would be super appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-10-11T22:03:41.637" Title="Custom Shipping Method Availability in Commerce - User Messages" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17219" PostTypeId="2" ParentId="17206" CreationDate="2016-10-11T21:25:07.243" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it simply not possible to use backrefs in the target route templates&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Right now it's not possible (although might be worth a &lt;a href=&quot;https://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The right hand side of the route &lt;code&gt;key =&amp;gt; value&lt;/code&gt; pair can currently only be a &lt;a href=&quot;https://craftcms.com/docs/routing#basic-syntax&quot; rel=&quot;nofollow&quot;&gt;static string&lt;/a&gt; that is a path to the template to load or an array that defines a &lt;a href=&quot;https://craftcms.com/docs/routing#routing-to-controller-actions&quot; rel=&quot;nofollow&quot;&gt;controller action&lt;/a&gt; to load.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-11T21:25:07.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17220" PostTypeId="2" ParentId="17218" CreationDate="2016-10-11T22:03:41.637" Score="1" Body="&lt;p&gt;100% untested, but I think one way to go would be to use &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CModel#addError-detail&quot; rel=&quot;nofollow&quot;&gt;addError&lt;/a&gt; on one of the &lt;code&gt;Commerce_OrderModel&lt;/code&gt;'s attributes (in the &lt;code&gt;defineAttributes&lt;/code&gt; method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your template could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'myShippingMethod' not in craft.commerce.availableShippingMethods|keys %}&#xA;    {% for error in order.getErrors('theAttribute') %}&#xA;        {{ error }}&amp;lt;br /&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-11T22:03:41.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17221" PostTypeId="1" CreationDate="2016-10-11T22:22:02.677" Score="1" ViewCount="147" Body="&lt;p&gt;I am fairly new to Craft but have managed to build a combined search feature that users can filter from dropdowns. I used this as a guide and it works great:&#xA;&lt;a href=&quot;https://webstoemp.com/blog/combined-searches-and-filters-craft-cms/&quot; rel=&quot;nofollow&quot;&gt;https://webstoemp.com/blog/combined-searches-and-filters-craft-cms/&lt;/a&gt; implemented here (still rough but working): &lt;a href=&quot;http://resources.sttrcancer.org/resources-connect&quot; rel=&quot;nofollow&quot;&gt;http://resources.sttrcancer.org/resources-connect&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now building out another search feature for an additional section ('members') but members has a MatrixBlock called ('position'), which contains a category field ('institution'). I am struggle with getting the institution list to show in my dropdown. I understand it is nested within the MatrixBlock and I am obviously missing a part of the syntax. Here is my working category dropdown that does not included the nested category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all entries to display only the categories related to entries #}&#xA;{% set memberAllEntries = craft.entries.section('member').limit(null).find() %}  &#xA;&#xA;{# disease categories #}&#xA;{% set memberDisease = craft.categories.group('disease').relatedTo(memberAllEntries).order('title asc').find() %}&#xA;&#xA;&amp;lt;div class=&quot;dropdown filter-button-container&quot;&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot; dropdown-toggle filter-button&quot;  data-toggle=&quot;dropdown&quot;&amp;gt;Disease&amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;dropdown-menu scrollable-menu&quot; role=&quot;menu&quot;&quot;&amp;gt;&#xA;        {% for category in memberDisease %}&#xA;&#xA;            {% set diseaseCategory = craft.request.getParam('disease') %}&#xA;            {% set diseaseActive = (diseaseCategory == category.slug) ? 'selected' : '' %}&#xA;&#xA;            &amp;lt;li&amp;gt;&amp;lt;label for=&quot;disease&quot;/&amp;gt;&amp;lt;input type=&quot;checkbox&quot; class=&quot;cbxDisease&quot; value=&quot;{{ category.slug }}&quot; {{ diseaseTypeActive }}&amp;gt;&amp;amp;nbsp;{{ category.title }}&amp;lt;/label&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I need on additional set command before here: &lt;code&gt;{% set memberDisease = craft.categories.group('disease').relatedTo(memberAllEntries).order('title asc').find() %}&lt;/code&gt; to first select the matrix, then the previous code should select the 'institution' field within it. I have tried everything, I would LOVE any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="5751" LastEditorUserId="57" LastEditDate="2016-10-11T22:30:19.207" LastActivityDate="2016-10-11T22:30:19.207" Title="Combined searches and filters with a Matrix" Tags="&lt;matrix&gt;&lt;search&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17222" PostTypeId="1" CreationDate="2016-10-11T22:45:55.793" Score="0" ViewCount="428" Body="&lt;p&gt;I'm a content marketer looking to get contact information for customers visiting my site. Does Craft support workflows with form fills?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;User sees an ad for an ebook, white paper, or other marketing content. Goes to landing page &gt; form fill with contact information &gt; thank you page with content&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;User sees an ad for a webinar or other event. User goest to event page &gt; form fill &gt; thank you page with confirmation time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Wondering if Craft supports this type of multi-step content workflow.&lt;/p&gt;&#xA;" OwnerUserId="5752" LastEditorUserId="57" LastEditDate="2016-10-11T23:04:00.180" LastActivityDate="2016-10-11T23:35:07.073" Title="Does Craft support gated content and form fills?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17223" PostTypeId="2" ParentId="17222" CreationDate="2016-10-11T23:35:07.073" Score="2" Body="&lt;p&gt;Craft is definitely a good fit to manage content around these workflows, but the workflows themselves will require a bit of planning as to how they get implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While there are several potential solutions, I'll share one workflow that can be used for this type of content using the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; plugin (which my team is behind).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a Landing Pages or Events Channel in Craft. Add whatever fields you want to customize your Landing Page or Events however you need to. These fields can be related to the content, layout, design; event information; or promotional content like the items you mentioned (ebook, white paper, etc)&lt;/li&gt;&#xA;&lt;li&gt;Create a Form in Sprout Forms for each type of lead capture form you want. You could have one that just requests an email; another that requests name, email, and a few other details; and another that let's a user select which event Date/Time they want to participate in.&lt;/li&gt;&#xA;&lt;li&gt;On the Landing Page Channel add the Forms Relations field. This will allow you to build flexible Landing pages with variations on your layout and design, as well as relate the form that you want to the Landing Pages or Event pages you are going to be sharing with your users.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After a user submits a form they will be redirected to a thank you page that you can set in the form settings. Depending on how you'd like to protect any content there are several different ways you could grant access to the page, but you have complete flexibility (some of these methods may require more setup than others):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Just redirect and share the confirmation info or marketing content&lt;/li&gt;&#xA;&lt;li&gt;Redirect with a token that enables the content on the thank you page to only be seen by someone submitting the form&lt;/li&gt;&#xA;&lt;li&gt;Trigger an email to the user who submits the form with a unique link to the content you want them to have access to&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-11T23:35:07.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17224" PostTypeId="1" AcceptedAnswerId="17226" CreationDate="2016-10-12T03:03:45.687" Score="2" ViewCount="266" Body="&lt;p&gt;I have a scenario in a plugin where I need to create / check data obtained by reading files. This currently happens on plugin &lt;code&gt;init&lt;/code&gt; but isn't completed in time to make use of by other functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin needs to parse a few SVG's and stylesheets and create data accordingly. I'am currently checking against a last modified date to avoid extraneous work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SVG's and stylesheets are from the website public directory and can be modified by the developer at any time and I would like to avoid any manual interaction within the CP when it comes to parsing these files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be an acceptable way to ensure this data is generated before my plugin attempts to use it?&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-10-12T04:16:24.797" LastActivityDate="2016-10-13T00:24:54.837" Title="Parse files on plugin init" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17225" PostTypeId="1" CreationDate="2016-10-12T05:28:17.907" Score="1" ViewCount="96" Body="&lt;p&gt;After successfully logging into admin I seem to be getting this message in a browser auth dialog:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Brute force protection, Please use these credentials: User = 'u' and Password is the answer to 1+1”&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's causing this and how do I disable it? Very annoying!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerDisplayName="user3585" LastActivityDate="2016-10-12T17:59:44.973" Title="Why is a &quot;Brute Force Protection&quot; dialog appearing on login? How to remove?" Tags="&lt;login&gt;&lt;security&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2016-10-12T18:43:18.810" ContentLicense="CC BY-SA 3.0" />
  <row Id="17226" PostTypeId="2" ParentId="17224" CreationDate="2016-10-12T06:24:07.723" Score="3" Body="&lt;p&gt;After some reordering of my logic and moving code to the init method of the plugins service I have been able to solve this problem with the below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SvgIconsService extends BaseApplicationComponent&#xA;{&#xA;    public function init()&#xA;    {&#xA;        $this-&amp;gt;createResources(); // Method call to perform file operations&#xA;&#xA;        parent::init();&#xA;    }&#xA;&#xA;    private function createResources()&#xA;    {&#xA;        $folders = IOHelper::getFolderContents(craft()-&amp;gt;config-&amp;gt;get('iconSetsPath', 'svgicons'), false);&#xA;&#xA;        if (is_array($folders)) {&#xA;            foreach ($folders as $idx =&amp;gt; $f)&#xA;            {&#xA;                $iconSets[IOHelper::getFolderName($f) . IOHelper::getFolderName($f, false)] = IOHelper::getFolderName($f, false);&#xA;&#xA;                // Create sprite sheet resources from Stylesheet&#xA;                $stylesheets = IOHelper::getFolderContents($f, false, '\-sprites.css');&#xA;&#xA;                if(!empty($stylesheets)) {&#xA;                    foreach ($stylesheets as $stylesheetIdx =&amp;gt; $stylesheet) {&#xA;                        craft()-&amp;gt;templates-&amp;gt;includeCss(IOHelper::getFileContents($stylesheet));&#xA;                        $this-&amp;gt;getSpritesFromStylesheet($stylesheet);&#xA;                    }&#xA;                }&#xA;&#xA;                // Create sprite sheet resources from SVG&#xA;                $svgs = IOHelper::getFolderContents($f, false, '\-sprites.svg');&#xA;&#xA;                if(!empty($svgs)) {&#xA;                    foreach ($svgs as $svgIdx =&amp;gt; $svg) {&#xA;                        $this-&amp;gt;getSpritesFromSvg($svg);&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was originally calling &lt;code&gt;craft()-&amp;gt;svgIcons-&amp;gt;createResources();&lt;/code&gt; from the plugin &lt;code&gt;init&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2016-10-13T00:24:54.837" LastActivityDate="2016-10-13T00:24:54.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17227" PostTypeId="1" AcceptedAnswerId="17229" CreationDate="2016-10-12T07:48:45.870" Score="2" ViewCount="191" Body="&lt;p&gt;I know that I can apply a discount if a specific number of products is ordered. I could also add a discount for a specific product, with a specific amount. But, am I able to create a discount with this conditions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Applies to entire product type&lt;/li&gt;&#xA;&lt;li&gt;A specific number of &lt;strong&gt;one product&lt;/strong&gt; is added to the cart&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, if I set this discount for 3 products, but people buy 2 x PRODUCT A, 1 x PRODUCT B, it would not apply. If customers buy 3 x PRODUCT A, 2 x PRODUCT B, it would apply for product A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could probably fix it with a plugin, but is it possible out of the box? Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2016-10-12T07:54:49.563" LastActivityDate="2017-09-08T14:05:17.113" Title="In Commerce, can I apply a discount only on a specific number of one product?" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17228" PostTypeId="1" CreationDate="2016-10-12T07:57:37.040" Score="2" ViewCount="122" Body="&lt;p&gt;Are there any PaaS providers out there delivering Craft as a platform continuously updated and secured?&lt;/p&gt;&#xA;" OwnerUserId="5753" LastActivityDate="2016-10-12T18:06:15.823" Title="Any cloud providers hosting and securing Craft as a service" Tags="&lt;security&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17229" PostTypeId="2" ParentId="17227" CreationDate="2016-10-12T08:13:36.517" Score="1" Body="&lt;p&gt;As far as the release notes from Commerce 1.2:&#xA;&lt;a href=&quot;https://craftcommerce.com/changelog#build1323&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/changelog#build1323&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can only be given a minimum quantity of items now.&lt;/p&gt;&#xA;" OwnerUserId="5497" LastActivityDate="2016-10-12T08:13:36.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17230" PostTypeId="1" CreationDate="2016-10-12T08:59:48.990" Score="1" ViewCount="92" Body="&lt;p&gt;I want every structure entry to have a follow up page, &lt;a href=&quot;http://thisismysite.com/handle/slug/followuppage&quot; rel=&quot;nofollow&quot;&gt;http://thisismysite.com/handle/slug/followuppage&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So every slug, get a follow up page with different content but the same template. Is there a simple way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="5754" LastEditorUserId="57" LastEditDate="2016-10-12T18:08:17.817" LastActivityDate="2016-10-13T05:58:17.220" Title="Can I give every structure entry a custom layout by using the same template?" Tags="&lt;entries&gt;&lt;structure&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17231" PostTypeId="2" ParentId="14581" CreationDate="2016-10-12T11:44:15.727" Score="1" Body="&lt;p&gt;I've run into this same issue without the field being &quot;required&quot;, so I don't think that is the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can recreate the problem by submitting a relationship input with an empty string as a value (e.g. I have a &lt;code&gt;fields[myEntriesField]&lt;/code&gt; &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; input with an empty &quot;Choose One&quot; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same error can be triggered programmatically by passing a &lt;code&gt;null&lt;/code&gt; field value to &lt;code&gt;$entry-&amp;gt;setContentFromPost&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a workaround, but the core issue seems like a bug to me. This is within &lt;code&gt;guestEntries.beforeSave&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $event-&amp;gt;params['entry'];&#xA;&#xA;// Seemingly, when the `fields.product` post data has an array&#xA;// with an empty string (like it does from an unselected &amp;lt;select&amp;gt;),&#xA;// we get a CDbException SQLSTATE[23000]: Integrity constraint violation error.&#xA;// The same thing seems to happen when setContentFromPost receives null on a&#xA;// relation field, so we'll coalesce to empty string.&#xA;$product = array_filter(craft()-&amp;gt;request-&amp;gt;getPost('fields.product'));&#xA;$entry-&amp;gt;setContentFromPost([&#xA;  'product' =&amp;gt; $product ?? '',&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: posted a bug report here: &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/issues/14&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/GuestEntries/issues/14&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2016-10-12T11:56:24.343" LastActivityDate="2016-10-12T11:56:24.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17232" PostTypeId="2" ParentId="17230" CreationDate="2016-10-12T12:57:15.877" Score="2" Body="&lt;p&gt;You can setup a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow&quot;&gt;dynamic route&lt;/a&gt; for &lt;code&gt;/handle/&amp;lt;slug&amp;gt;/followuppage&lt;/code&gt; and route the requests to your follow-up page template. From that template you’d have access to a variable called &lt;code&gt;slug&lt;/code&gt; that you would then use to query for your structure entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('mystructure').slug(slug).first() %}&#xA;&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-10-13T05:58:17.220" LastActivityDate="2016-10-13T05:58:17.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17233" PostTypeId="2" ParentId="15171" CreationDate="2016-10-12T14:17:01.163" Score="1" Body="&lt;p&gt;From what I can tell, Luke's answer wont actually work, because ultimately after the saveEntry event, &lt;code&gt;GuestEntries&lt;/code&gt; will &lt;code&gt;redirectToPostedUrl&lt;/code&gt;, which will lose any variables you have passed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You options are explained here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2210/is-it-possible-to-setroutevariables-when-redirecting-after-a-successful-form-sub&quot;&gt;Is it possible to setRouteVariables when redirecting after a successful form submission?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example using SESSION:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// custom/CustomPlugin.php&#xA;craft()-&amp;gt;on('guestEntries.onSuccess', function($event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    craft()-&amp;gt;httpSession-&amp;gt;add('lastEntryId', $entry-&amp;gt;id);&#xA;});&#xA;&#xA;// custom/CustomVariable.php&#xA;public function getLastEntry()&#xA;{&#xA;    if (craft()-&amp;gt;httpSession-&amp;gt;get('lastEntryId'))&#xA;    {&#xA;        $entryId = craft()-&amp;gt;httpSession-&amp;gt;get('lastEntryId');&#xA;        $entry   = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;        craft()-&amp;gt;httpSession-&amp;gt;destroy('lastEntryId');&#xA;    }&#xA;&#xA;    return $entry ?? null;&#xA;}&#xA;&#xA;// In your success template&#xA;{% if lastEntry %}&#xA;    &amp;lt;h2&amp;gt;Review &quot;{{ lastEntry.title }}&quot; submission successful.&amp;lt;/h2&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="314" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-10-12T17:18:08.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17234" PostTypeId="1" CreationDate="2016-10-12T14:23:57.177" Score="2" ViewCount="383" Body="&lt;p&gt;Just looking for pros and cons here, I guess. My gut says to let updates flow through version control, but the part of me that wants to give up web design and become a mountain man says it might be beneficial if the client was at least able to patch in critical updates if necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thought I remember glancing at a conversation about this in the Slack channel, but couldn't find it. &lt;/p&gt;&#xA;" OwnerUserId="4426" LastActivityDate="2016-10-12T18:01:01.410" Title="craft/app: gitignore, or no?" Tags="&lt;best-practice&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17235" PostTypeId="1" AcceptedAnswerId="17241" CreationDate="2016-10-12T14:25:55.080" Score="3" ViewCount="79" Body="&lt;p&gt;I am attempting to install the &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow&quot;&gt;Charge plugin&lt;/a&gt; on a Craft site.  When I upload the plugin folder I get an error when opening the plugin page that says that the page cannot be loaded.  It works locally.  If I remove the plugin folder that page loads.  There is not a Craft error, I get an error that the page is &quot;unable to handle the request&quot;, or just a total white screen. Anyone aware of an issue with the plugin?  I could not find anything here or online about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The folder is in the correct place and all the files are there, nothing has been tampered with or altered that would cause an issue.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-10-12T18:12:43.973" LastActivityDate="2016-10-12T18:12:43.973" Title="Installing the Charge plugin breaks plugin page" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17236" PostTypeId="1" AcceptedAnswerId="17240" CreationDate="2016-10-12T14:58:05.860" Score="1" ViewCount="134" Body="&lt;p&gt;So I have a structure with a few entries and a single. I want to list out the first level of the structure, plus the single. Then somewhere else, list out the second level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myPages = craft.entries.section('structureName')|merge(craft.entries.section('singleName')) %}&#xA;&#xA;&amp;lt;nav&amp;gt;&#xA;{% nav entry in myPages.level(1) %}&#xA;  {{ entry.title }}&#xA;{% endnav %}&#xA;&amp;lt;nav&amp;gt;&#xA;&#xA;&amp;lt;aside&amp;gt;&#xA;{% for entry in myPages.level(2) %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&amp;lt;aside&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which returns this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Array to string conversion&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I remove the &lt;code&gt;.level(X)&lt;/code&gt; function it will return all the entries, on all levels; including the single. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the purposes of making my problem more understandable, I've simplified my above example. I know I could just add the single entry directly into the &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;. But I'm curious about ways to add to a entries section object without losing the ability to query levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in the same way I can &lt;a href=&quot;https://craftcms.stackexchange.com/a/1276/584&quot;&gt;exclude entries&lt;/a&gt;, is there a way to &lt;strong&gt;include&lt;/strong&gt; an entry from a different section without relying on &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twigs merge&lt;/a&gt; filter?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-10-12T17:48:56.847" Title="Include entries to a entries section object, without 'merge'" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17239" PostTypeId="1" CreationDate="2016-10-12T15:39:42.997" Score="3" ViewCount="117" Body="&lt;p&gt;We are creating a new website using Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main functionality of it is to let user to create their own mini-site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the users should have their own control panel and manage their pages and menu.&#xA;There should be url per user like &lt;code&gt;username.site-name.com/nameofthepage&lt;/code&gt;&#xA;The administrator should be able to manage all mini-site&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone already done something like this? Is there any plugin already done for this kind of functionality ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5756" LastEditorUserId="22" LastEditDate="2017-05-09T20:59:11.070" LastActivityDate="2017-05-09T20:59:11.070" Title="Create mini-site community with Craft" Tags="&lt;plugin-development&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17240" PostTypeId="2" ParentId="17236" CreationDate="2016-10-12T15:57:24.077" Score="1" Body="&lt;p&gt;A &lt;a href=&quot;https://craftcms.stackexchange.com/users/1021/jay&quot;&gt;colleague of mine&lt;/a&gt; shed some light on a very simple solution&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myPages = craft.entries.section(['structureName', 'singleName']).order('sectionId desc') %}&#xA;&#xA;&amp;lt;nav&amp;gt;&#xA;{% nav entry in myPages.level([1, null]) %}&#xA;  {{ entry.title }}&#xA;{% endnav %}&#xA;&amp;lt;nav&amp;gt;&#xA;&#xA;&amp;lt;aside&amp;gt;&#xA;{% for entry in myPages.level(2) %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&amp;lt;aside&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Passing an array of handles/slugs instead of just a string works perfectly. Since singles don't have levels; defining &lt;code&gt;null&lt;/code&gt; in the level pulls them out too. &lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-10-12T16:24:03.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17241" PostTypeId="2" ParentId="17235" CreationDate="2016-10-12T16:02:48.243" Score="3" Body="&lt;p&gt;So the answer at the bottom of the page &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10882/plugin-cp-page-causes-white-screen&quot;&gt;here&lt;/a&gt; ended up solving my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin was using php short array syntax &quot; [ ] &quot; which is available in 5.4 + and the server was set at 5.3.29.  When I changed that it worked perfectly.  &lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-10-12T16:02:48.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17242" PostTypeId="2" ParentId="17239" CreationDate="2016-10-12T16:27:18.327" Score="2" Body="&lt;p&gt;There is no plugin that provides this type of functionality but there really isn't any need for one either. Depending on how many pages their mini-sites needs to be, this really can all be handled with front-end entry forms and how complicated it can get is entirely up to you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should create their control-panel's using routes (possibly not even necessary depending on how you structure it). There you'd allow for any of the entry forms, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to give more advice on how to go about this we'd really need more detail on exactly what each of these multi-sites needs to be capable of but this just seems like a standard site allowing unique front-end entry creation which is all able to be done without the use of any plugins, even while allowing it to get quite advanced and complicated.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2016-10-12T16:27:18.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17243" PostTypeId="1" AcceptedAnswerId="17247" CreationDate="2016-10-12T17:25:18.177" Score="1" ViewCount="373" Body="&lt;p&gt;I'm converting an EE site to Craft. During the conversion we are establishing LOCAL &gt; DEV &gt; LIVE environments and using GitHub. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;LOCAL = My local MAMP PRO setup. &#xA;DEV &amp; LIVE = a single account at Arcustech.&#xA;    DEV = ~/www/dev_html/public&#xA;    LIVE = ~/www/public_html/public&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The site currently has 354,000 images/thumbnail files in the /images directory. We'll eventually move images/assets to S3/Cloudfront, but for now/launch we're keeping them local. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously I don't want to duplicate 354K images in the DEV directory, AND keep them sync'd, but want the DEV to correctly display images/assets for the client to see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I was thinking a &lt;code&gt;/images&lt;/code&gt; symbolic link in DEV, pointing to &lt;code&gt;/images&lt;/code&gt; in LIVE would maintain all the correct image/asset paths and display for the DEV site and Craft configs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make sense? Am I missing something or is there a better/easier/default way to do handle large numbers of images/assets across DEV &amp;amp; LIVE environments when they are on the same server/account?&lt;/p&gt;&#xA;" OwnerUserId="5593" LastActivityDate="2016-10-12T18:18:47.753" Title="Using Symbolic Links for Very Large Image directories" Tags="&lt;assets&gt;&lt;config&gt;&lt;server&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17244" PostTypeId="2" ParentId="17225" CreationDate="2016-10-12T17:59:44.973" Score="1" Body="&lt;p&gt;That message definitely isn't coming from Craft natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You've got a Craft plugin installed that's listening to &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;nofollow&quot;&gt;onBeforeLogin&lt;/a&gt; and/or &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onLogin&quot; rel=&quot;nofollow&quot;&gt;onLogin&lt;/a&gt; events and is performing some custom business logic&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your host has some library/extension/etc. installed globally that is affecting your Craft install.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-12T17:59:44.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17245" PostTypeId="2" ParentId="17234" CreationDate="2016-10-12T18:01:01.410" Score="2" Body="&lt;p&gt;&lt;strong&gt;No.&lt;/strong&gt; Keep &lt;code&gt;craft/app&lt;/code&gt; in your repo.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; This is my own personal opinion. The topic comes up with some frequency on Craft Slack, and you will find advocates of both approaches. I fully expect to see an opposing position posted by someone else.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Benefits to keeping &lt;code&gt;app&lt;/code&gt; in your repo...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can properly vet an update, and make sure it does not create any problems in your site before pushing that update to production.&lt;/li&gt;&#xA;&lt;li&gt;You have a guarantee that every environment (dev, staging, production) all contain the exact same version of Craft. This means that you can take advantage of specific features with confidence, and similarly, rule out bugs which may have been fixed between Craft versions.&lt;/li&gt;&#xA;&lt;li&gt;You can prevent your client from &quot;accidentally&quot; upgrading, and potentially making a mess. Though it is rare, some breaking changes (or new bugs) are occasionally introduced when updating.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-12T18:01:01.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17246" PostTypeId="2" ParentId="17228" CreationDate="2016-10-12T18:06:15.823" Score="2" Body="&lt;p&gt;I'm not aware of any PaaS service that also keeps Craft up-to-date for you automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some like &lt;a href=&quot;https://www.fortrabbit.com/craft-hosting&quot; rel=&quot;nofollow&quot;&gt;Fortrabbit&lt;/a&gt;, that are PaaS and are very familiar with Craft installs, but you'd still be on the hook for updating Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some more traditional, managed, non-PaaS hosts like &lt;a href=&quot;https://www.arcustech.com/&quot; rel=&quot;nofollow&quot;&gt;ArcusTech&lt;/a&gt; that are also very familiar with Craft installs, and they keep the OS configured and secured for you are responsible for installing and updating Craft as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some more discussions about hosting options for Craft here: &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9400/recommended-hosting-company-for-a-craft-site&quot;&gt;Recommended hosting company for a Craft site?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-12T18:06:15.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17247" PostTypeId="2" ParentId="17243" CreationDate="2016-10-12T18:18:47.753" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Am I missing something or is there a better/easier/default way to do handle large numbers of images/assets across DEV &amp;amp; LIVE environments when they are on the same server/account?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Ideally you'd move them to a cloud-based solution (S3, etc.), but locally using a symlink is a perfectly fine option, too.  Just make sure that Apache is configured to &lt;a href=&quot;https://superuser.com/questions/244245/how-do-i-get-apache-to-follow-symlinks&quot;&gt;follow symlinks&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wither either the symlink or cloud-based solution, just remember if you've got dev and live using their own databases and you perform an Asset operation on one (upload a file, delete a file, rename, etc.), then the other database will be out of sync and you'd need to run the &quot;Update Asset Indexes&quot; tool to pick up the change.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-12T18:18:47.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17248" PostTypeId="1" AcceptedAnswerId="17262" CreationDate="2016-10-12T18:46:09.297" Score="2" ViewCount="834" Body="&lt;p&gt;I have a blog listing page which works correctly. I also have categories that I would like to use the same template rather than creating a whole new template since the design is exactly the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I set the category template to &lt;code&gt;blog/index&lt;/code&gt; the page loads correctly but doesn't limit by categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at my simplified template code, I'm not sure how to get it to display only the category being viewed or all if on the blog index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My urls are &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/blog/&#xA;/blog/p2 (pagination)&#xA;/blog/{{ slug }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like the following url's to use the same template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/blog/category/{{ category_url }}&#xA;/blog/category/{{ category_url }}/p2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blog').limit(6) as pageInfo, pageEntries %}&#xA;{% for entry in pageEntries %}&#xA;  &amp;lt;article class=&quot;col-sm-6 block&quot; data-mh=&quot;blog-rows&quot;&amp;gt;&#xA;&#xA;    some code&#xA;&#xA;    &amp;lt;aside&amp;gt;&#xA;      more code&#xA;    &amp;lt;/aside&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn btn-primary&quot;&amp;gt;Keep Reading&amp;lt;/a&amp;gt;&#xA;&#xA;  &amp;lt;/article&amp;gt;&amp;lt;!--block--&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If necessary I can create a &lt;code&gt;category.html&lt;/code&gt; template, but then I'd essentially have duplicate code. Is there a way to do what I want to?&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="4466" LastEditDate="2016-10-13T13:45:34.340" LastActivityDate="2016-10-13T20:25:18.807" Title="Use blog index template as category template" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17250" PostTypeId="1" AcceptedAnswerId="17252" CreationDate="2016-10-12T19:30:52.930" Score="3" ViewCount="172" Body="&lt;p&gt;Is there a way I can run some code from a plugin when a future dated entry goes 'live' from 'pending'? I am trying to send an email update that a new entry has been posted. The related post below helped me with this, but it doesn't seem to cover future dated entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if ($entry-&amp;gt;section-&amp;gt;handle !== 'blog') {&#xA;        return;&#xA;    }&#xA;    if ($entry-&amp;gt;status !== 'live') {&#xA;        return;&#xA;    }&#xA;&#xA;    if (!$entry-&amp;gt;getContent()-&amp;gt;emailSent) {&#xA;        // send email&#xA;    }&#xA;&#xA;    $entry-&amp;gt;setContentFromPost(array('emailSent' =&amp;gt; true));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Related to: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15825/checking-for-first-time-an-entry-is-published-i-e-saved-with-a-live-status&quot;&gt;Checking for first time an entry is &amp;quot;published&amp;quot; i.e. saved with a Live status&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5109" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-03-10T17:41:13.650" Title="Fire event first time future dated entry goes 'live' from 'pending'" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17251" PostTypeId="1" AcceptedAnswerId="17260" CreationDate="2016-10-12T20:22:52.283" Score="1" ViewCount="235" Body="&lt;p&gt;I have a plugin that's loaded on the edit page of an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I open the entry edit page, I would like to retrieve the id of this particular entry. I've tried this:&#xA;&lt;code&gt;{% set someId = craft.request.getParam('entryId') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this just returns null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the id because I use it in my service: &lt;code&gt;craft.pluginName.getRecordByEntryId(someId)&lt;/code&gt;.&#xA;Which will return information that's bound to that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries %}&#xA;{% if entry.id %}&#xA;    &amp;lt;p&amp;gt;EntryId: &amp;lt;input type=&quot;text&quot; value=&quot;{{ entry.id }}&quot;/&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this will return all the entry id's, which I can't really use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or advice on how I should tackle this differently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5730" LastActivityDate="2016-10-13T17:56:43.147" Title="craft.request.getParam('entryId') returns null on edit page of an entry" Tags="&lt;entry&gt;&lt;error&gt;&lt;null&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17252" PostTypeId="2" ParentId="17250" CreationDate="2016-10-12T21:20:54.510" Score="2" Body="&lt;p&gt;There's not an easy way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the related to link mentions, there isn't an event or anything that Craft fires when a future post dated entry goes live because the way Craft decides if an entry is &quot;live&quot; or not is if it is enabled (both on a per-locale and global basis), it has a post date in the past and an expiration date that doesn't exist or hasn't been met yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no actual PHP code that executes when that current time actually passes the post date time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One semi-hacky way to get around it would be to setup a cronjob that hit a controller action every minute in a custom plugin that and plugin would keep a record of every entry's post date (via the onSaveEntry) event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That controller action would check the current date/time against its internal record of entry post dates and you could fire off an email for any entries when the post date has passed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-12T21:20:54.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17253" PostTypeId="2" ParentId="17163" CreationDate="2016-10-12T22:39:50.927" Score="3" Body="&lt;p&gt;I believe a Reference Tag can not perform an image transform because it doesn't return an ElementCriteriaModel object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I worked around this by using the craft asset id parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set assetSearch  = craft.assets.id(12651) %}&#xA;&#xA;    {{assetSearch.first().getUrl('transform')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3987" LastEditorUserId="3987" LastEditDate="2016-10-13T15:25:43.253" LastActivityDate="2016-10-13T15:25:43.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17254" PostTypeId="2" ParentId="17036" CreationDate="2016-10-12T22:59:48.493" Score="1" Body="&lt;p&gt;Discussion with solutions here &lt;a href=&quot;https://github.com/laravel/valet/issues/179&quot; rel=&quot;nofollow&quot;&gt;https://github.com/laravel/valet/issues/179&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="450" LastActivityDate="2016-10-12T22:59:48.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17255" PostTypeId="1" CreationDate="2016-10-13T09:48:15.553" Score="1" ViewCount="74" Body="&lt;p&gt;I have a project with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.filmPoster | length %}&#xA;    &amp;lt;img src=&quot;{{ entry.filmPoster.first().getUrl('filmPoster') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% elseif entry.locale('en_gb').filmPoster | length %}{# fall back to English if there is one #}&#xA;    &amp;lt;img src=&quot;{{ entry.locale('en_gb').filmPoster.first().getUrl('filmPoster') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;filmPoster is an Asset field, and it is translatable. It's set to restrict uploads to a single folder, and the upload location is [whats on] {slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the back end, I go to an Entry and upload an asset in this field in English, save, switch to Welsh, upload the Welsh version of the asset and save. In both cases, in the CMS, I can switch between languages for the entry and see the correct image asset in each locale. If I then look on the server, I can see the correct files have been saved in the appropriate file-path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/content/whats-on/entry-title/image-name.jpg&#xA;/content/whats-on/entry-title-in-welsh/image-name-welsh.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the front end template, however, the image for the Welsh version is a 404 broken image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I remove the transform from the equation, the correct image loads...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.filmPoster | length %}&#xA;    &amp;lt;img src=&quot;{{ entry.filmPoster.first().getUrl() }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% elseif entry.locale('en_gb').filmPoster | length %}{# fall back to English if there is one #}&#xA;    &amp;lt;img src=&quot;{{ entry.locale('en_gb').filmPoster.first().getUrl() }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is attempting to use a transform breaking? What have I got wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I see in the logs is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/10/13 09:39:03 [warning] [application] [Forced] Image “entry-title-in-welsh/image-name-welsh.jpg” cannot be found&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-13T09:48:15.553" Title="Why does getUrl fail when using transforms on a translatable asset?" Tags="&lt;assets&gt;&lt;localization&gt;&lt;image-transforms&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17256" PostTypeId="1" AcceptedAnswerId="20356" CreationDate="2016-10-13T10:11:27.353" Score="2" ViewCount="285" Body="&lt;p&gt;We have a client with fairly extensive security requirements. They have asked us if it is feasible to implement something like &lt;a href=&quot;https://github.com/authy/authy-php&quot; rel=&quot;nofollow&quot;&gt;Authy&lt;/a&gt; in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm provisionally planning to disable the &quot;normal&quot; CP login form and implementing a new login flow via a plugin that checks the OTP first and then hands off to &lt;code&gt;UserSessionService&lt;/code&gt; for the actual login. Is there any reason that wouldn't work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it will, what's best way to effectively disable the default CP form and direct users to the plugin's form instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, are there any gotchas that I should look out for in terms of maintaining as close to &quot;normal&quot; Craft behaviour as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS I know there's the &lt;code&gt;userSession.onBeforeLogin&lt;/code&gt; event, but unless I'm missing something, that looks fairly limited (only receives the username of the User as a param etc)&lt;/p&gt;&#xA;" OwnerUserId="3574" LastActivityDate="2017-05-05T10:54:30.237" Title="Implementing two factor authentication / TOTP for CP logins" Tags="&lt;plugin-development&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17257" PostTypeId="1" AcceptedAnswerId="17332" CreationDate="2016-10-13T13:37:41.973" Score="1" ViewCount="508" Body="&lt;p&gt;This is happening for all users and only on production environment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Your session has ended. Enter your password to log back in.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entering your password does not allow you to actually see the admin panel again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things we have tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;li&gt;Deleting the contents of &lt;code&gt;craft/storage/runtime&lt;/code&gt;&#xA;&lt;li&gt;Removing all rows from &lt;code&gt;craft_sessions&lt;/code&gt; in db&#xA;&lt;li&gt;Setting &lt;code&gt;'overridePhpSessionLocation' =&amp;gt; false&lt;/code&gt;&#xA;&lt;li&gt;Setting &lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false&lt;/code&gt;&#xA;&lt;li&gt;Setting &lt;code&gt;'userSessionDuration' =&amp;gt; false&lt;/code&gt;&#xA;&lt;li&gt;Setting &lt;code&gt;craft/app/&lt;/code&gt;, &lt;code&gt;craft/storage&lt;/code&gt; and &lt;code&gt;craft/config&lt;/code&gt; as &lt;code&gt;CHMOD 774&lt;/code&gt;&#xA;&lt;li&gt;Changing &lt;code&gt;craft/&lt;/code&gt; folders to be owned by &lt;code&gt;www-data&lt;/code&gt;&#xA;&lt;li&gt;Setting &lt;code&gt;session.auto_start = 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our environment is PHP 7 with Ubuntu 16.04 running Apache 2.4.18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something to consider is we run with an Akamai CDN cache that is set to ignore our entire &lt;code&gt;/admin&lt;/code&gt; directory, but my suspicion is that something elsewhere is getting cached. Thoughts about that? Is there another directory we should be ignoring?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also as a point of info, our &lt;code&gt;/craft&lt;/code&gt; folder is above the &lt;code&gt;docroot&lt;/code&gt; so not publicly accessible and therefore unlikely to be cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, what's very strange is if I remove the modal containing the error message from the DOM in Chrome Inspect, I am able to still navigate the panel fine, without having to re-authenticate. Error also happens in both Chrome and Firefox.&lt;/p&gt;&#xA;" OwnerUserId="5757" LastEditorUserId="5757" LastEditDate="2016-10-13T14:20:20.243" LastActivityDate="2016-10-18T22:16:56.227" Title="Getting error &quot;Your session has ended. Enter your password to log back in.&quot; every 30 seconds or so" Tags="&lt;control-panel&gt;&lt;error-message&gt;&lt;session&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="17258" PostTypeId="2" ParentId="17248" CreationDate="2016-10-13T14:08:23.820" Score="2" Body="&lt;p&gt;I'm confused: if the supplied code is what you're using for both the index page and category page then it won't filter by category because there's no code to tell it to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category would need something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p class=&quot;meta&quot;&amp;gt;Posted: {{ entry.postDate|date(&quot;d.m.Y&quot;) }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than trying to use the same template - given the logic is actually slightly different - I'd perhaps suggest setting up a shared template to extend from (i.e., another _layout.twig).&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-13T14:08:23.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17259" PostTypeId="2" ParentId="17039" CreationDate="2016-10-13T17:48:09.740" Score="0" Body="&lt;p&gt;Changing the &lt;code&gt;userphotos&lt;/code&gt; folder's owner to be the same as the user:group Apache was running as solved the issue.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chown -R www-data:www-data userphotos&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-13T17:48:09.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17260" PostTypeId="2" ParentId="17251" CreationDate="2016-10-13T17:56:43.147" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getParam-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getParam()&lt;/code&gt;&lt;/a&gt; is only going to check for the value as part of the query string in the URI or in POST if it is a POST request, which is why it's returning null on the edit entry page in the control panel (it isn't in either).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since it &lt;a href=&quot;https://craftcms.stackexchange.com/a/14526/57&quot;&gt;looks like&lt;/a&gt; you're using a template hook in your plugin, you can get the entry id directly from the context:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $context['entry'];&#xA;&#xA;if (!$entry-&amp;gt;id)&#xA;{&#xA;    // New entry&#xA;}&#xA;else&#xA;{&#xA;    $entryId = $entry-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-10-13T17:56:43.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17261" PostTypeId="1" CreationDate="2016-10-13T18:23:41.087" Score="1" ViewCount="86" Body="&lt;p&gt;First off, I'd like to thank Jeremy for his help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a set of add-on products that go along with my primary product. The options are a radio group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow&quot;&gt;Multi-Add&lt;/a&gt; to tie everything together - and it's all working great. I'm able to add the primary and optional products to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I am hung up is, because I have a radio group - no matter which option I choose, I am always ending up with the &lt;em&gt;last&lt;/em&gt; option being chosen. &#xA;Which makes perfect sense since that's the last radio in the group that gets picked up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;// items[1][qty] is a &amp;lt;select&amp;gt; input for the primary product&#xA;...&#xA;&#xA;{% for foo in products %}&#xA;    &amp;lt;div class=&quot;radio&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;&#xA;            &amp;lt;input type=&quot;radio&quot; name=&quot;items[2][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;               {{ foo.title }} &amp;amp;ndash; {% if foo.defaultVariant.price == 0 %} Included with registration {% else %} {{ foo.defaultVariant.price|currency(cart.currency) }}{% endif %}&#xA;        &amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;items[2][purchasableId]&quot; value=&quot;{{ foo.defaultVariant.purchasableId }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see whatever the &lt;em&gt;last&lt;/em&gt; radio input is, will be the value that is picked up by Craft regardless of what the user has actually chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought since each radio is a product (with no variants), I could just use the loop index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ loop.index }}][purchasableId]&quot; value=&quot;{{ foo.defaultVariant.purchasableId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works, but the loop will start at &lt;code&gt;1&lt;/code&gt; each time. I am hung up on how I can start the loop at a specific number. Or, perhaps there is a better way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were using checkboxes, I'd only have one option per product/input name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried using a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; element, but I get hung up on how I can offer a &quot;No thanks&quot; option.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;items[2][purchasableId]&quot; class=&quot;form-control required&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;     {% for foo in products %}&#xA;         &amp;lt;option value=&quot;{{ foo.defaultVariant.purchasableId }}&quot;&amp;gt;&#xA;         {{ foo.title }} &amp;amp;ndash; {% if foo.defaultVariant.price == 0 %} Included with registration {% else %} {{ foo.defaultVariant.price|currency(cart.currency) }}{% endif %}&#xA;         &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[2][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which also works well, but if the user does not choose an option, because I am passing a value of &lt;code&gt;1&lt;/code&gt; with the hidden input, I get an error that I am attempting to use an invalid purchasable ID. Which also makes perfect sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I am so close, but just can't quite see clear enough to know what to do. Worst case I suppose I just listen for either a change/click event via javascript and update the qty value accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-10-13T19:56:36.680" LastActivityDate="2016-10-14T05:23:36.977" Title="How can I start a loop at a specific number?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17262" PostTypeId="2" ParentId="17248" CreationDate="2016-10-13T20:25:18.807" Score="4" Body="&lt;p&gt;Yup, you can totally re-use the same template. When it is a category page, you will have access to a &lt;code&gt;category&lt;/code&gt; variable which is a &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel&quot; rel=&quot;nofollow&quot;&gt;CategoryModel&lt;/a&gt;, and you can use that to filter your entries by category.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2016-10-13T20:25:18.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17263" PostTypeId="1" AcceptedAnswerId="17267" CreationDate="2016-10-13T21:39:41.723" Score="0" ViewCount="436" Body="&lt;p&gt;Craft Commerce newbie question....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I display the image asset for a custom variant field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to display the associated image of a product variant in the cart.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-10-14T02:44:26.900" Title="Display image asset of a variant" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17264" PostTypeId="1" AcceptedAnswerId="17269" CreationDate="2016-10-13T22:13:20.497" Score="1" ViewCount="308" Body="&lt;p&gt;Is it possible to query assets by it's filetype? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: I have a generic asset field, but I want to get the first asset that's an .mp4 file. &lt;/p&gt;&#xA;" OwnerUserId="3335" LastActivityDate="2016-10-14T03:11:01.973" Title="Get asset by extension or mime type?" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17265" PostTypeId="1" CreationDate="2016-10-13T23:16:24.757" Score="1" ViewCount="111" Body="&lt;p&gt;Does anyone have experience hosting a Craft site on 1984 Hosting? It's an Icelandic company whose ethos I like and I'm considering making my new site in Craft, so would be good to hear of anyone who's managed it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.1984.is/&quot; rel=&quot;nofollow&quot;&gt;https://www.1984.is/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5760" LastActivityDate="2018-11-14T15:30:17.710" Title="Can you host a Craft site on 1984 Hosting?" Tags="&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17266" PostTypeId="1" AcceptedAnswerId="17272" CreationDate="2016-10-14T02:04:39.767" Score="0" ViewCount="829" Body="&lt;p&gt;So I usually have multiple sites inside of my MAMP htdocs folder which I then access through &lt;code&gt;localhost:8888/sitefolder&lt;/code&gt;. How would this work for a Craft set up? The only way I got my initial Craft site to work was to point MAMPs document root to the public folder of the Craft site I was working on. But this seems pretty messy if I was to be working on multiple Craft sites at once. Surely I wouldn't need to keep changing my MAMP settings every time I wanted to look at another dev site? &lt;/p&gt;&#xA;" OwnerUserId="5732" LastEditorUserId="57" LastEditDate="2016-10-14T03:24:50.443" LastActivityDate="2016-10-14T12:44:47.837" Title="localhost and root directory for multiple site installs" Tags="&lt;mamp&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17267" PostTypeId="2" ParentId="17263" CreationDate="2016-10-14T02:44:26.900" Score="1" Body="&lt;p&gt;Ok so in general this depends on if the custom field is on the product or the variant.   Assume the filed is called &lt;code&gt;masterImage&lt;/code&gt; either way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the field is on a variant:&#xA;&lt;code&gt;{% set image = lineItem.purchasable.product.masterImage.first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the field is on the product:&#xA;&lt;code&gt;{% set image = lineItem.purchasable.masterImage.first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember (either way) you should always check there is an image first really:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if lineItem.purchasable.product.masterImage|length %} ... set the image&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practise I usually have code that falls back to the product image if the variant image is not set for whatever reason:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set image = lineItem.purchasable.masterImage.first() ?? null %}&#xA;    {# Fallback on product image if there is no variant image set #}&#xA;    {% if not image|length %}&#xA;        {% set image = lineItem.purchasable.product.masterImage.first() ?? null %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note here I am not doing the initial test on the asset because I am instead using the null coalescing operator)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-14T02:44:26.900" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17268" PostTypeId="2" ParentId="17261" CreationDate="2016-10-14T02:59:59.687" Score="1" Body="&lt;p&gt;You definitely don't need JS here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm  a bit pushed for time, so this won't be an epic answer, but e.g. with your select, you should not be using a hidden field for the qty.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The select itself just sets the quantity value - either &lt;code&gt;1&lt;/code&gt; if the option is chosen or no value if the option is not chosen....it really is as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA;&#xA;  {# primary item - use whatever input you like for qty, or just do it in a hidden... #}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;items[9999][purchasableId&quot; value=&quot;{{ mainproduct.purchasableId }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;items[9999][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;  {# accessories #}&#xA;  {% for accessory in accessories %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;items[loop.index][puchasableId]&quot; value==&quot;{{ accessory.purchasableId }}&quot;&#xA;    &amp;lt;select name=&quot;items[loop.index][qty]&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;1&quot;&amp;gt;Yes Please&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;0&quot;&amp;gt;No Thanks&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt; &#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will cause the following to be posted - &#xA;&lt;code&gt;items[0][purchasableId] = 45&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and depending on the user choice, either &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;items[0][qty] = 1&lt;/code&gt; or &lt;code&gt;items[0][qty] = 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and multiAdd will just ignore this if the &lt;code&gt;qty&lt;/code&gt; = &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key thing to understand is the value of the index is totally irrelevant as long as it is the same for the purchasableId and the qty - it just acts to join the data together - you could literally send:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;items['TrumpIsInsane'][purchasableId] = 45&#xA;items['TrumpIsInsane'][qty] = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and it should still work.  So for the primary product I just use something like &lt;code&gt;9999&lt;/code&gt; so that I am sure it won't conflict with any of the loop indexes (I'm not going to have 10000 accessories eh?) -&gt; it's just a made up number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completeness, radios would only be slightly different:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA;&#xA;  {# primary item - use whatever input you like for qty, or just do it in a hidden... #}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;items[9999][purchasableId&quot; value=&quot;{{ mainproduct.purchasableId }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;items[9999][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;  {# accessories #}&#xA;  {% for accessory in accessories %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;items[loop.index][puchasableId]&quot; value==&quot;{{ accessory.purchasableId }}&quot;&#xA;    &amp;lt;input type=&quot;radio&quot; name=&quot;items[loop.index][qty]&quot; value=&quot;1&quot; checked&amp;gt; Yes Please&amp;lt;br&amp;gt;&#xA;    &amp;lt;input type=&quot;radio&quot; name=&quot;items[loop.index][qty]&quot; value=&quot;&quot;&amp;gt; No Thanks&amp;lt;br&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/form&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-10-14T05:23:36.977" LastActivityDate="2016-10-14T05:23:36.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17269" PostTypeId="2" ParentId="17264" CreationDate="2016-10-14T03:11:01.973" Score="1" Body="&lt;p&gt;To get all .mp4 files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mp4s = craft.assets.filename('*.mp4').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the first .mp4:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mp4 = craft.assets.filename('*.mp4').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-14T03:11:01.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17270" PostTypeId="2" ParentId="17265" CreationDate="2016-10-14T03:15:28.370" Score="3" Body="&lt;p&gt;As long as a host meets Craft's minimum requirements listed here: &lt;a href=&quot;https://craftcms.com/docs/requirements#server-requirements&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/requirements#server-requirements&lt;/a&gt;, then Craft should run fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on their shared hosting server specs here: &lt;a href=&quot;https://www.1984.is/product/hosting/&quot; rel=&quot;nofollow&quot;&gt;https://www.1984.is/product/hosting/&lt;/a&gt; (PHP 7, MySQL 5.5+), my guess is it'll run fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-14T03:15:28.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17271" PostTypeId="1" AcceptedAnswerId="17286" CreationDate="2016-10-14T06:40:29.403" Score="1" ViewCount="949" Body="&lt;p&gt;I am trying to edit an entry automatically when you press a button. Is there a way to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit more detail: I have listed up a few entries, each with their own button. When I press the button on a specific entry, I want the currentUser to be added to the User Field of that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have managed to get this semi-working with a form where the user can edit the entry through input fields etc., changing their value, then submiting (as outlined under &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow&quot;&gt;Entry Form&lt;/a&gt; in the docs). This is the prossess I want automated. When you press the button in the front-end the entry is edited with values set in the code and submitted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5761" LastEditorUserId="125" LastEditDate="2016-10-14T23:44:56.703" LastActivityDate="2019-04-01T17:22:55.197" Title="Editing entry in front-end" Tags="&lt;users&gt;&lt;relations&gt;&lt;form&gt;&lt;entry&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17272" PostTypeId="2" ParentId="17266" CreationDate="2016-10-14T12:44:47.837" Score="1" Body="&lt;p&gt;Why not use MAMP Pro to define seperate local url's for your projects? Or use something like Virtual Host X.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can define some made up url like: yourporoject.dev and point that url to the public folder of your project.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-10-14T12:44:47.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17273" PostTypeId="1" AcceptedAnswerId="17325" CreationDate="2016-10-14T14:53:13.190" Score="1" ViewCount="236" Body="&lt;p&gt;I have a directory of sea ports with a google map that loads about 450 records. The map and listings and pagination work fine. On their own, I get a 2.5 sec page load average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However as soon as I add a search form that populates a chained select for countries and ports the load time goes up to 8 secs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search form code looks like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('locations').limit(null) %}&#xA;&#xA;&amp;lt;label&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;countries&quot; class=&quot;countries&quot; name=&quot;country&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select...&amp;lt;/option&amp;gt;&#xA;&#xA;    {% cache %}&#xA;        {% for country in categories %}&#xA;            {% if country.level == 1 %}&#xA;                &amp;lt;option value=&quot;{{ country.slug }}&quot;&amp;gt;{{ country.title }}&amp;lt;/option&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endcache %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;Ports&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;ports&quot; name=&quot;port&quot; class=&quot;ports&quot; disabled=&quot;disabled&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select a country first&amp;lt;/option&amp;gt;&#xA;&#xA;    {% cache %}&#xA;        {% for port in categories %}&#xA;            &amp;lt;option value=&quot;{{ port.slug }}&quot; class=&quot;{{ port.parent | lower }}&quot;&amp;gt;{{ port.title }}&amp;lt;/option&amp;gt;&#xA;       {% endfor %}&#xA;    {% endcache %}&#xA;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that this code cost about 5 seconds of load time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the profile output and seen the query for the categories. It's huge.  I can't see how to get the page to load faster as I can't see eager loading applying to a category group, and caching doesn't really help here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to optimise this portion?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-10-14T19:46:59.930" LastActivityDate="2016-10-18T13:27:48.887" Title="Category query very slow on multilingual site" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17274" PostTypeId="1" CreationDate="2016-10-14T15:26:36.100" Score="0" ViewCount="538" Body="&lt;p&gt;&lt;p&gt;&#xA;I'm installing Craft CMS on my domain which was formerly functional (previously used Wordpress). I removed all Wordpress files through FileZilla FTP and uploaded Craft files.&lt;p&gt;&#xA;I put the /Craft folder in its entirety above the root.&lt;p&gt;&#xA;I put the files in /Public in the Public_html folder.&lt;p&gt;&#xA;I set up a new Database through my hosting provider and edited the db.php file with the credentials.&lt;p&gt;&#xA;Now when I go to mydomain/admin I get an Apache 404: &quot;Apache/2.4.10 (Debian) Server at chrislee.is Port 80&quot;&lt;p&gt;&#xA;I've triple checked the installation instructions given on the Craft site and can't see any mistakes. Any ideas about what may have gone wrong would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5760" LastActivityDate="2016-10-14T15:36:24.663" Title="404 message after following Craft installation instructions" Tags="&lt;install&gt;&lt;404&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17275" PostTypeId="2" ParentId="17274" CreationDate="2016-10-14T15:36:24.663" Score="1" Body="&lt;p&gt;How did you create the database? &#xA;Did you use phpMyAdmin or did you create it manually, or using other tools?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a similar 404 error last week (db was created with phpMyAdmin) then I created database with Sequel Pro and that resolve the problem.&lt;/p&gt;&#xA;" OwnerUserId="522" LastActivityDate="2016-10-14T15:36:24.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17276" PostTypeId="1" CreationDate="2016-10-14T15:54:08.160" Score="0" ViewCount="78" Body="&lt;p&gt;When a user clicks 'Add to Cart', rather than redirecting them to the cart page, I would like to trigger an off-canvas menu that contains the contents of their shopping cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;a href=&quot;http://git.blivesta.com/drawer&quot; rel=&quot;nofollow&quot;&gt;http://git.blivesta.com/drawer&lt;/a&gt; for the menu implementation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The menu can be toggled/opened with javascript, but I'm unsure as to how to trigger the opening of the menu when a user clicks 'Add to Cart'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I would like this to be possible, without reloading the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone implemented anything similar? &lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-10-18T11:39:34.267" Title="Trigger off canvas menu upon adding product to cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17277" PostTypeId="1" AcceptedAnswerId="17278" CreationDate="2016-10-14T18:01:40.750" Score="3" ViewCount="1278" Body="&lt;p&gt;The &lt;em&gt;Craft&lt;/em&gt; docs call for using &lt;code&gt;utf8_unicode_ci&lt;/code&gt; for MySQL collation. MySQL 5.5.3 introduced support for &lt;code&gt;utf8mb4_unicode_ci&lt;/code&gt;, which, I believe, is required to support the storage of emojis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have experience running &lt;em&gt;Craft&lt;/em&gt; with the &lt;code&gt;utf8mb4_unicode_ci&lt;/code&gt; collation? Any issues to watch out for?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2017-11-05T02:14:09.413" Title="MySQL Collation: utf8mb4_unicode_ci (emojis)" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17278" PostTypeId="2" ParentId="17277" CreationDate="2016-10-14T20:18:20.433" Score="6" Body="&lt;p&gt;When you create a database in MySQL in Craft 2, you can set the &lt;em&gt;default&lt;/em&gt; charset and collation, so that any SQL statements that get executed that don't explicitly specify what charset/collation to use, MySQL will fall back on those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 will always explicitly set what to use based on what the &lt;code&gt;charset&lt;/code&gt; and &lt;code&gt;collation&lt;/code&gt; database config settings are set to in (by default &lt;code&gt;utf8&lt;/code&gt; and &lt;code&gt;utf8_unicode_ci&lt;/code&gt;).  Craft 3 does away with this and falls back on the database default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you set those config settings to &lt;code&gt;utf8mb4&lt;/code&gt; and &lt;code&gt;utf8mb4_unicode_ci&lt;/code&gt; and try to install Craft 2 you'll run into errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because MySQL's &lt;code&gt;utf8&lt;/code&gt; implementation uses 3 bytes per character and &lt;code&gt;utf8mb4&lt;/code&gt; uses 4-bytes, that pushes many of Craft's indexes over InnoDB's &lt;a href=&quot;https://stackoverflow.com/a/1814594/684&quot;&gt;767 byte limitation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's worth noting that if the only place you think you'll need 4-byte support for emojis is in a Rich Text field, then Craft will &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/StringHelper.php#L474&quot; rel=&quot;nofollow noreferrer&quot;&gt;automatically HTML encode&lt;/a&gt; them so they fit in MySQL's 3-byte &lt;code&gt;utf8&lt;/code&gt; charset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need them outside the context of a Rich Text field, then your best bet would be to manually set just that column's charset and encoding to use &lt;code&gt;mb4&lt;/code&gt; in the database directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth noting that the upcoming Craft 3 supports PostgreSQL where none of this matters and it just works.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-11-05T02:14:09.413" LastActivityDate="2017-11-05T02:14:09.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17279" PostTypeId="1" AcceptedAnswerId="17324" CreationDate="2016-10-14T22:06:13.060" Score="0" ViewCount="412" Body="&lt;p&gt;I've got a website in development with new pages loaded via AJAX instead of traditional page loads. Most links on the site will use AJAX to load a new page, however there are some links I need to exclude from this behaviour. For example, local hash links that simply scroll you down to an anchor on the same page. Or, links to PDF files that are hosted locally but should obviously not be loaded via AJAX. I have enough control over the HTML that I can simply add a class to these links that I want to exclude, such as .local-anchor, or .pdf. The code I have effectively excludes these links if you directly load the page the first time, however any time the page is loaded via AJAX my exclusion no longer works. The .local-anchor links and any others that should be excluded are still somehow executing the AJAX functions. Example of the relevant JS code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).on(&quot;click&quot;, &quot;a:not('.local-anchor, .pdf')&quot;, function(e) {&#xA;    var href = $(this).attr(&quot;href&quot;);&#xA;&#xA;    // check that it points to this domain&#xA;    if ( href.indexOf(document.domain) &amp;gt; -1 || href.indexOf(':') === -1 ) {&#xA;      history.pushState({}, '', href);&#xA;      loadPage(href);&#xA;      e.stopPropagation(); &#xA;      e.preventDefault();&#xA;    } &#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You can see this live page (in development) here:&lt;/strong&gt; &lt;a href=&quot;http://dma.nz/practice/&quot; rel=&quot;nofollow&quot;&gt;http://dma.nz/practice/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The links:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Our approach to design  &lt;/li&gt;&#xA;&lt;li&gt;The architectural process  &lt;/li&gt;&#xA;&lt;li&gt;Awards + Publications  &lt;/li&gt;&#xA;&lt;li&gt;Contact&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Scroll you to anchors further down the same page and should be excluded. Yet if this page is loaded via AJAX (test by navigating to one of the other main nav links on top right and then return to Practice) then these links are triggering AJAX to reload this same page which screws things up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I need to amend this JS to make sure they are ALWAYS excluded?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;----------- UPDATE ----------- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per August's suggestion I tried removing the single quotes around the :not, as well as adding an extra if statement to double check. Neither of these solutions work. My current JS is looking like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).on(&quot;click&quot;, &quot;a:not(.local-anchor, .pdf)&quot;, function(e) {&#xA;    var href = $(this).attr(&quot;href&quot;);&#xA;&#xA;    if ( !$(e.target).is('.local-anchor, .pdf') ) { &#xA;      // check that it points to this domain&#xA;      if ( href.indexOf(document.domain) &amp;gt; -1 || href.indexOf(':') === -1 ) {&#xA;        history.pushState({}, '', href);&#xA;        loadPage(href);&#xA;        e.stopPropagation(); &#xA;        e.preventDefault();&#xA;      } &#xA;    }&#xA;  });  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The :not exclusion is working. If the page is first loaded directly (not via AJAX) then those local anchor links do as they should. &lt;strong&gt;However if the page is loaded via AJAX then the exclusion stops working.&lt;/strong&gt; Whether it's in the form of :not on the selector and/or an if statement to catch those classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm baffled here. Can't understand why that exclusion would work in one case but not the other. Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="4377" LastEditorUserId="4377" LastEditDate="2016-10-14T22:38:42.883" LastActivityDate="2016-10-18T11:54:55.170" Title="Craft and AJAX page transitions - how to exclude local hash links from executing AJAX?" Tags="&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2016-10-19T16:33:14.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="17280" PostTypeId="2" ParentId="17276" CreationDate="2016-10-14T22:13:47.837" Score="2" Body="&lt;p&gt;The basic recipe is this, and you can definitely do it without a page reload:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In your JS, listen for the form's submit event &lt;/li&gt;&#xA;&lt;li&gt;Prevent the default submit &lt;/li&gt;&#xA;&lt;li&gt;Ajax submit the form's data to the Commerce &lt;code&gt;addToCart&lt;/code&gt; controller &lt;/li&gt;&#xA;&lt;li&gt;Grab the result of this call... &lt;/li&gt;&#xA;&lt;li&gt;If error - show error &lt;/li&gt;&#xA;&lt;li&gt;If cart - JS pass the cart's data off to your drawer system and print out the cart that way (that's the quickest way, or you can just ajax load in a Craft template to where you have your drawer, the &lt;code&gt;cart&lt;/code&gt; variable in that will have the updated cart data)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="340" LastEditorUserId="4466" LastEditDate="2016-10-18T11:39:34.267" LastActivityDate="2016-10-18T11:39:34.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17281" PostTypeId="1" AcceptedAnswerId="17282" CreationDate="2016-10-14T22:52:55.183" Score="2" ViewCount="383" Body="&lt;p&gt;I'm having a small problem with table fields. My issue is that by default a table fields starts with one row. Even if you leave this row empty (no values at all in any column) the field will never return as empty because that row exists even though it has no value. In order to get an empty field check like this to work: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.whiskeyTableHandle | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have to actually delete that first empty row rather than simply leave it blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot count on my client to remember to delete the row to indicate an empty field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would there be any way to have the table field show in the CP publish page with no rows visible by default? That means if nothing is added to the field it will properly return as empty.&lt;/p&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2016-10-14T23:30:36.393" Title="Table fields, default single empty row, and never returning as empty?" Tags="&lt;templating&gt;&lt;field&gt;&lt;fieldtypes&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17282" PostTypeId="2" ParentId="17281" CreationDate="2016-10-14T23:30:36.393" Score="4" Body="&lt;p&gt;You could test if the first cell is empty&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.whiskeyTableHandle|length and entry.whiskeyTableHandle[0][0] %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you simply remove all default rows in the field’s settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-10-14T23:30:36.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17283" PostTypeId="2" ParentId="17271" CreationDate="2016-10-15T00:07:09.547" Score="3" Body="&lt;p&gt;Looks like you want to implement a feature to vote for entries. Have a look at these plugins, they make this really easy for you.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.doublesecretagency.com/plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.doublesecretagency.com/plugins/upvote&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/dukt/craft-like&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/craft-like&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you want to implement something yourself, I would look into adding the button behavior using JavaScript, listen for click events and send the data over XMLHttpRequests to the entries/saveEntry controller.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2019-04-01T17:22:55.197" LastActivityDate="2019-04-01T17:22:55.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17286" PostTypeId="2" ParentId="17271" CreationDate="2016-10-15T06:25:22.000" Score="3" Body="&lt;p&gt;I managed to find a solution, using hidden input fields :) Thank you for all the help :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Ended up solving this by using tables and saving the username and ID in that. Used a plugin called Super Tables, which gives you a lot more control over the table.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/#{{ annonse.title }}{{ annonse.annonsePremie }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ annonse.sectionId }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ annonse.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;{# Start with the top-level Super Table field #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;{# Ensure any existing rows in your Super Table field are saved #}&#xA;{% for block in annonse[fieldHandle] %}&#xA;                            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ block.id }}][type]&quot; value=&quot;{{ blocktype }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Add a new row of data - note the `new1` #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][type]&quot; value=&quot;{{ blocktype }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;{# Repeat for all your fields in your Super Table field #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][fields][bruker]&quot; value=&quot;{{ currentUser }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][fields][brukerId]&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;button class=&quot;button submit&quot; type=&quot;submit&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;Submit&amp;lt;/p&amp;gt;&#xA;&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5761" LastEditorUserId="5761" LastEditDate="2016-10-16T08:04:29.670" LastActivityDate="2016-10-16T08:04:29.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17287" PostTypeId="1" AcceptedAnswerId="17292" CreationDate="2016-10-15T09:52:00.463" Score="2" ViewCount="1005" Body="&lt;p&gt;I'm currently making a website with the Foundation 6 ZURB template, and want to connect to Craft CMS, but I'm pretty new at this stuff, and can't figure out wht the right installation and workflow would be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So questions I'm dealing with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I on my local machine install Craft, and change Foundation to build to that location?&lt;/li&gt;&#xA;&lt;li&gt;Should I install them alongside each other (i.e. install Craft in the same folder as my Foundation)?&lt;/li&gt;&#xA;&lt;li&gt;Should I make a fresh installation of Craft somewhere else, and install Foundation within the Craft structure somehow?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I found this on Github that looks interesting:&#xA;&lt;a href=&quot;https://github.com/johanneslamers/craft-workflow&quot; rel=&quot;nofollow&quot;&gt;https://github.com/johanneslamers/craft-workflow&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know how I would take it from there to get my existing Foundation code into the project. Could I just copy it over to this new installation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if these are silly questions, but I want to get off on the right foot here. All help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2016-10-15T18:37:41.133" Title="Craft CMS with Foundation 6 workflow / installation" Tags="&lt;installation&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17289" PostTypeId="1" CreationDate="2016-10-15T14:07:03.980" Score="3" ViewCount="295" Body="&lt;p&gt;I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder). &lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2016-10-15T17:55:07.797" Title="Keep on getting logged out when deploying using Capistano" Tags="&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17290" PostTypeId="2" ParentId="17289" CreationDate="2016-10-15T14:07:03.980" Score="5" Body="&lt;p&gt;The problem is that the basepath changes each time you deploy (Capistrano uses versioned release directories). The basepath is used to generate a session key, which is invalidated each time a new deployment is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is to add the &lt;code&gt;appId&lt;/code&gt; parameter to &lt;code&gt;config/general.php&lt;/code&gt;. &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;noreferrer&quot;&gt;The docs&lt;/a&gt; give a good explanation&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The application ID, which is used for things like storing data caches and user sessions. If it’s not set, Craft will automatically generate one based on the server path. Setting it will help avoid the loss of data caches and user sessions when Craft is deployed using a deployment script that will store Craft in an inconsistent location, such as Capistrano.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So add this to &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'appId' =&amp;gt; 'chooseyourownrandomstring',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="100" LastEditorUserId="1098" LastEditDate="2016-10-15T17:55:07.797" LastActivityDate="2016-10-15T17:55:07.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17291" PostTypeId="1" AcceptedAnswerId="17294" CreationDate="2016-10-15T18:25:42.680" Score="1" ViewCount="430" Body="&lt;p&gt;Having a really difficult times with variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classic t-shirt example: The t-shirt comes in red and blue, where each color has 4 sizes. That means I create 4 variants for red, and the same for blue, thus the product &quot;T-shirt A&quot; contains 8 variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each variant has their own stock level, differing prices, image etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For size I created a dropdown field and attached to the variants (&quot;Small, Medium, Large&quot; etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can output all variants at the same time on the page, thus allowing the user to select which one they want, but it's not very slick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make this look like a single product to the user, and simply have a dropdown for Size and Color? When the user selects something in the dropdown, the size and color would update on the page. More importantly, Craft also has to check the color/size combo to see if it's in stock, and reflect that on the page as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Expresso Store (EE) this was easily done with &quot;modifiers&quot;, but I'm sure it's even easier in Craft, I just can't wrap my head around it without some help.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2016-10-16T00:19:49.730" Title="Multiple variants as &quot;one product&quot;" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17292" PostTypeId="2" ParentId="17287" CreationDate="2016-10-15T18:37:41.133" Score="2" Body="&lt;p&gt;They aren't silly questions. There are a number of ways you might want to do this. Personally what I do on Craft projects when I've used Foundation is use the SASS only version which has directions located here: &lt;a href=&quot;http://foundation.zurb.com/sites/docs/sass.html&quot; rel=&quot;nofollow&quot;&gt;http://foundation.zurb.com/sites/docs/sass.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to be familiar with NPM or Bower and Gulp to get the most out of that. If you're not familiar with them, do some reading there first. I stick exclusively to NPM since I have some other projects that I use Node for as well. This is up to your preference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do my local install of Craft in my new repository, set up environment variables and then install on dev/production servers as well. If you have a deploy process to install, I normally do that next so I am done configuring servers. Then I will install any npm packages and set up my gulp build process. I recommend using a lot of the same packages they have in that project like &lt;code&gt;browser-sync&lt;/code&gt;. I am surprised I don't see &lt;code&gt;autoprefixer&lt;/code&gt; in there which I feel is essential.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I on my local machine install Craft, and change Foundation to build to that location?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Yes but when you install Foundation via the method I mentioned above, it will build wherever you set it to build in your Gulpfile.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I install them alongside each other (i.e. install Craft in the same folder as my Foundation)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I would not install the Foundation files in your Craft folder. This could make updates tricky. The core files will be in &lt;code&gt;node_modules&lt;/code&gt; folder in your root anyway. When you locate your SASS files to build, I normally put those in public in their own folder at the same level as the compiled CSS. You don't have to deploy them to your server but it's helpful in local.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I make a fresh installation of Craft somewhere else, and install Foundation within the Craft structure somehow?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I think the above info probably answers this. Basically all Foundation related content I locate in the public folder wherever you want to locate your assets (sass, js, images, css).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5772" LastActivityDate="2016-10-15T18:37:41.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17294" PostTypeId="2" ParentId="17291" CreationDate="2016-10-16T00:19:49.730" Score="1" Body="&lt;p&gt;Commerce makes no assumptions about, but also provides not real support for, the front end of your store (other than some simple example templates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's up to you to build the UI you're looking for - be it a table of variants, or some sort of multi/select type system.  You simply retrieve the product &amp;amp; variants (checking availability as you do) - and then in your twig code build the UI you want.  And if you want dynamic updates of pictures etc, without page reloads, you'll use JS to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Super flexible, and quite deliberately built this way to allow complete freedom in content presentation, like Craft itself, but definitely a little less 'for free out of the box' than with some systems.  &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-16T00:19:49.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17295" PostTypeId="1" AcceptedAnswerId="17296" CreationDate="2016-10-16T14:35:02.753" Score="1" ViewCount="618" Body="&lt;p&gt;I'm in the process of adding a second site to a Craft installation using custom locales. The two sites will be accessed on different sub-domains, e.g. &lt;code&gt;site1.domain.com&lt;/code&gt; and &lt;code&gt;site2.domain.com&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to ensure that logged in users can access both sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I developed the first site, I didn't know that there would be a requirement to add a second site at a later date, so I set the &lt;code&gt;defaultCookieDomain&lt;/code&gt; config setting to &lt;code&gt;site1.domain.com&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I am developing the second site, I have changed this config setting to &lt;code&gt;.domain.com&lt;/code&gt;, which should mean that sessions are recognised across both sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in my testing, due to the fact that cookies still exist for &lt;code&gt;site1.domain.com&lt;/code&gt;, Craft is not recognising that I am logged in when I visit &lt;code&gt;site2.domain.com&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I delete the cookies from my browser and log into either site, Craft correctly recognises that I am logged into both sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is fine for me to do, if a little annoying. However there are over 4000 registered users of &lt;code&gt;site1.domain.com&lt;/code&gt; and I don't want to have to expect them to delete their cookies to enable them to access both sites. Is there something I can do to get Craft to avoid this problem by automatically delete their existing cookies and regenerate ones for &lt;code&gt;.domain.com&lt;/code&gt; with no user intervention?&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-10-17T17:14:16.590" Title="Session cookies" Tags="&lt;localization&gt;&lt;session&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17296" PostTypeId="2" ParentId="17295" CreationDate="2016-10-16T16:41:20.033" Score="1" Body="&lt;p&gt;You could write a plugin and put some code in it's &lt;code&gt;init()&lt;/code&gt; method which would get fired on every request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;init()&lt;/code&gt; method, that plugin could call &lt;code&gt;craft()-&amp;gt;httpSession-&amp;gt;getCookieParams()&lt;/code&gt; (which is just a wrapper for PHP's &lt;a href=&quot;http://us2.php.net/manual/en/function.session-get-cookie-params.php&quot; rel=&quot;nofollow&quot;&gt;session_get_cookie_params&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you could check the existing session cookie domain and if it's &lt;code&gt;site1.domain.com&lt;/code&gt;, nuke the cookie.  The request should automatically generate a new session cookie with the &lt;code&gt;.domain.com&lt;/code&gt; domain set.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-10-17T17:14:16.590" LastActivityDate="2016-10-17T17:14:16.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17297" PostTypeId="2" ParentId="17273" CreationDate="2016-10-16T16:49:15.650" Score="1" Body="&lt;p&gt;It's hard to know for sure without seeing your query profile output, but try eager loading your &lt;code&gt;ports&lt;/code&gt; field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories({&#xA;    group: 'locations',&#xA;    limit: null,&#xA;    with: ['ports']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-16T16:49:15.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17298" PostTypeId="1" CreationDate="2016-10-16T22:15:34.760" Score="0" ViewCount="38" Body="&lt;p&gt;I have a site that I need to remain turned off for a while (while the client enters content). I do however need public user registration to be available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to make this one page visible even when the system is switched off in the settings?&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-10-16T22:15:34.760" Title="Public registration when system is off" Tags="&lt;registration&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17299" PostTypeId="1" AcceptedAnswerId="17313" CreationDate="2016-10-17T08:12:30.003" Score="3" ViewCount="2507" Body="&lt;p&gt;&lt;strong&gt;Before you think this has already been answered, yes it is but I can't manage to get that fix working so I'm looking for another one.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &quot;title&quot; field in a couple of my matrix blocks but my client want's to add a Bold word every now and then. Now I tried that with a rich text field which works fine except that it keeps adding a &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag to my text which makes the Indexing go wrong etc plus it shouldn't be so hard to remove but apparently it is...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my custom json at the moment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['bold', 'italic'],&#xA;    maxHeight: 50,&#xA;    paragraphize: false,&#xA;    replaceDivs: false,&#xA;    linebreaks: true,&#xA;    enterKey: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In every fix I find here this should do it but somehow it wont..&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-10-19T16:22:30.580" Title="Removing P tag's in rich text area's" Tags="&lt;templating&gt;&lt;redactor&gt;&lt;richtext&gt;&lt;json&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17300" PostTypeId="1" CreationDate="2016-10-17T10:02:02.480" Score="0" ViewCount="207" Body="&lt;p&gt;I have a site (Craft 2.5.2754) and am trying to add a class to a table within Redactor. Even if I disable Clean up HTML and Purify HTML (which would rather not do) the style is getting stripped out on save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look through the config/settings for Redactor and there is an 'allowedAttr' setting for earlier versions but seems to have been removed in Redactor II.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on stopping the class being stripped out, preferably without having to disable Clean up HTML and/or Purify HTML?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-10-17T22:12:00.317" Title="Redactor settings: stripping out classes from table" Tags="&lt;redactor&gt;&lt;settings&gt;&lt;table&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17301" PostTypeId="1" AcceptedAnswerId="17310" CreationDate="2016-10-17T10:46:06.580" Score="1" ViewCount="420" Body="&lt;p&gt;I want to get all images from the section &lt;code&gt;projekte&lt;/code&gt; which are bound to the asset field &lt;code&gt;bild&lt;/code&gt; I then want to fiddle around with &lt;code&gt;.limit()&lt;/code&gt; and maybe &lt;code&gt;random&lt;/code&gt; filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I grabbed all images like described &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12152/how-to-grab-all-images-from-and-section&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works but as soon as I add &lt;code&gt;.limit()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set projectImg = craft.entries.section('projekte').find() %}&#xA;{% set projectImages = [] %}&#xA;&#xA;{% for item in projectImg %}&#xA;  {% set currentImage = item.bild %}&#xA;  {% set projectImages = projectImages | merge(currentImage) %}&#xA;{% endfor %}&#xA;&#xA;{% for asset in projectImages.limit(3) %}&#xA;   &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;PHP Notice: Array to string conversion&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why can't I just ad whatever filter I want on that new loop now?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2016-10-17T17:19:02.237" LastActivityDate="2016-10-17T17:37:36.503" Title="Get all images from a section" Tags="&lt;assets&gt;&lt;filter&gt;&lt;loop&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17302" PostTypeId="2" ParentId="17103" CreationDate="2016-10-17T12:23:01.473" Score="1" Body="&lt;p&gt;I presume the title of the entry is the name of the job. So if that's the case, just add a hidden input in the form and add the entry's title to the value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[jobTitle]&quot; value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then make sure to create a 'jobTitle' text field in the CMS and attach it to that form.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2017-09-12T22:08:14.593" LastActivityDate="2017-09-12T22:08:14.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17303" PostTypeId="1" CreationDate="2016-10-17T12:33:19.687" Score="0" ViewCount="1090" Body="&lt;p&gt;Thanks in advance for any help - I'm starting to feel like a fool for coming up against errors so often. But here goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have confirmed with my hosting provider that Craft CMS is compatible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have put /craft/ folder and the &lt;strong&gt;contents&lt;/strong&gt; of the /public/ folder next to each other in the htdocs directory on my hosting server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated the location of the /craft/ folder in index.php (to &lt;code&gt;$craftPath = './craft';&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I navigate to mysite.com/admin I get &lt;code&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/virtual/mysite/htdocs/index.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked that the root folder is performing correctly - I can successfuly navigate to an image at &lt;code&gt;mysite.com/pic.jpg&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5760" LastActivityDate="2016-12-16T14:12:36.657" Title="'Could not find your craft/ folder' error despite following installation instructions" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17304" PostTypeId="2" ParentId="17303" CreationDate="2016-10-17T13:10:43.543" Score="1" Body="&lt;p&gt;I have a similar set up for one particular installation and have the &lt;code&gt;$craftPath&lt;/code&gt; set as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = 'craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works fine.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-17T13:10:43.543" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17305" PostTypeId="1" AcceptedAnswerId="17306" CreationDate="2016-10-17T15:07:24.483" Score="4" ViewCount="635" Body="&lt;p&gt;I'm using Dukt's very nice Twitter plugin and it's working nicely returning the most recent tweet as I want, however I cannot seem to access the tweet's image. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get(&quot;statuses/user_timeline.json?screen_name=#{twitterHandle}&amp;amp;count=1&amp;amp;exclude_replies=true&amp;amp;include_rts=true&amp;amp;include_entities=true&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried adding &lt;code&gt;&amp;amp;include_entities=true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I print out the json, I can't seem to see any media URLs. Has anyone else had any joy here? Thanks&lt;/p&gt;&#xA;" OwnerUserId="5093" LastEditorUserId="125" LastEditDate="2016-10-17T15:49:45.637" LastActivityDate="2018-08-14T20:48:51.943" Title="Is it possible to get a tweet image when using Twitter plugin" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17306" PostTypeId="2" ParentId="17305" CreationDate="2016-10-17T15:44:51.570" Score="4" Body="&lt;p&gt;There should actually be a &lt;code&gt;entities.media&lt;/code&gt; property available in the JSON, when there are images attached to the tweet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what works for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('statuses/user_timeline') %}&#xA;&#xA;{% for tweet in tweets %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ tweet.text }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% if tweet.entities.media is defined %}&#xA;            {% for item in tweet.entities.media if item.type == 'photo' %}&#xA;                &amp;lt;img src=&quot;{{ item.media_url }}&quot;&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-10-17T15:44:51.570" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17307" PostTypeId="2" ParentId="2179" CreationDate="2016-10-17T16:06:18.987" Score="2" Body="&lt;p&gt;For a plugin-based solution, it's possible to create Reports based on arbitrary queries using &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/reports&quot; rel=&quot;nofollow&quot;&gt;Sprout Reports&lt;/a&gt;. Reports created in Sprout Reports can all be viewed in the same area of the Control Panel. A user can run reports from a simple user interface and export the results as a CSV. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create reports that are just a specific query or customizable reports that give the user any number of options to customize the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A report based on a Custom SQL query can be created in the interface, or you can create a more customized report via the &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/reports/docs/custom-reports/data-sources&quot; rel=&quot;nofollow&quot;&gt;Custom Reports Data Source API&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-17T16:06:18.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17308" PostTypeId="1" AcceptedAnswerId="17331" CreationDate="2016-10-17T16:23:38.010" Score="1" ViewCount="1144" Body="&lt;p&gt;I have been able to successfully &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16748/how-can-i-group-entries-based-on-a-datetime-field&quot;&gt;group entries via dateTime field&lt;/a&gt;. I have been trying to carry over the same type of logic only instead of using &lt;code&gt;.date&lt;/code&gt; just key off of the field value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all entries from the section. #}&#xA;{% set entries = craft.entries.section('mySection') %}&#xA;&#xA;{# Loop through the entries and get the user account associated with each. #}&#xA;{% for profiles in entries %}&#xA;    {% set users = profiles.userAccount %}&#xA;&#xA;    {% if users|length %}&#xA;        {% for year, user in users|group('myYearField') %}&#xA;            &amp;lt;h4&amp;gt;{{ year }}&amp;lt;/h4&amp;gt; {# 2016 #}&#xA;            &amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;                {% for user in users %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ profiles.url }}&quot;&amp;gt;{{ user.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently what I am getting is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016&#xA;    User&#xA;2016&#xA;    User&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am trying to get (I swear I had this working at one point) is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016&#xA;    User&#xA;    User&#xA;&#xA;2017&#xA;   User&#xA;   User&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems my trouble comes from not accessing the &lt;code&gt;users&lt;/code&gt; field correctly.&#xA;Updated (but still incorrect) example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProfiles = craft.entries.section('mySection') %}&#xA;{% if allProfiles|length %}&#xA;    {{ allProfiles|length }} {# 3 #}&#xA;    {% for profiles in allProfiles %}&#xA;        {% for profile in profiles.userAccount %}&#xA;            {% for year, user in profile|group('yearFieldHandle') %}&#xA;                &amp;lt;h1&amp;gt;{{ year }}&amp;lt;/h1&amp;gt;  {# No output #}&#xA;                &amp;lt;h2&amp;gt;{{ profile.firstName }}&amp;lt;/h2&amp;gt;    {# Bob #}&#xA;                &amp;lt;h3&amp;gt;{{ profile.myYear }}&amp;lt;/h3&amp;gt; {# 2016 #}&#xA;            {% endfor %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-10-18T17:44:09.427" Title="How can I group entries based on a string value?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17309" PostTypeId="1" AcceptedAnswerId="17327" CreationDate="2016-10-17T16:34:46.197" Score="1" ViewCount="349" Body="&lt;p&gt;I have a situation where I need a form to submit and be sent to my company's email address AND to an email address outputted from an email field from the entry that the form sits on. Is it possible to have a hidden input in the template that contains the email addresses I want the notification to go to?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-10-18T16:26:53.250" Title="Dynamic email recipients with amforms" Tags="&lt;form&gt;&lt;emails&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17310" PostTypeId="2" ParentId="17301" CreationDate="2016-10-17T17:37:36.503" Score="0" Body="&lt;p&gt;This is a misunderstanding of the difference between an ElementCriteria model and actual fetched elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some useful background reading: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements&quot;&gt;What are the differences between an elementCriteriaModel and fetched elements?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do what you're looking for using Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/random.html&quot; rel=&quot;nofollow&quot;&gt;random&lt;/a&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set projectImg = craft.entries.section('projekte').find() %}&#xA;{% set projectImages = [] %}&#xA;&#xA;{% for item in projectImg %}&#xA;    {% set currentImage = item.bild %}&#xA;    {% set projectImages = projectImages | merge(currentImage) %}&#xA;{% endfor %}&#xA;&#xA;{# Grab 3 random images from the array #}&#xA;{% for counter in 0..2 %}&#xA;    {% set asset = random(projectImages) %}&#xA;&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-17T17:37:36.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17311" PostTypeId="1" AcceptedAnswerId="17312" CreationDate="2016-10-17T18:00:48.187" Score="0" ViewCount="119" Body="&lt;p&gt;I am building a section in which a client will list their various social network connections. There are fields for each social network's name and icon, as well as a field with the URL to the client's page on the specified network.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also need a field that contains the code needed for each network's &quot;Share&quot; button. The code for &quot;Share&quot; buttons varies, but typically includes some HTML as well as &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags. When I output this field in a template, its contents are HTML encoded and displayed literally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I keep this from being encoded so the HTML and Javascript can be parsed by the browser?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-10-17T18:17:54.090" Title="HTML and Scripts in Entries?" Tags="&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17312" PostTypeId="2" ParentId="17311" CreationDate="2016-10-17T18:17:54.090" Score="3" Body="&lt;p&gt;Giving the enduser the ability to include scripts is risky way to present social media links. Any errors could protentialy break the entire html page / site If you really want to do it this way you can use &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow&quot;&gt;twig's raw filter&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="232" LastActivityDate="2016-10-17T18:17:54.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17313" PostTypeId="2" ParentId="17299" CreationDate="2016-10-17T19:29:33.927" Score="5" Body="&lt;p&gt;Seems like a simple &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/striptags.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;striptags&lt;/code&gt;&lt;/a&gt; filter would do nicely in this case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.titleField|striptags('&amp;lt;strong&amp;gt;&amp;lt;em&amp;gt;&amp;lt;br&amp;gt;')|raw }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're having issues with linebreaks, you might want to add the &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/nl2br.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;nl2br&lt;/code&gt;&lt;/a&gt; filter as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.titleField|striptags('&amp;lt;strong&amp;gt;&amp;lt;em&amp;gt;&amp;lt;br&amp;gt;')|raw|nl2br }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-19T12:46:00.153" LastActivityDate="2016-10-19T12:46:00.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17314" PostTypeId="2" ParentId="17300" CreationDate="2016-10-17T19:34:01.883" Score="3" Body="&lt;p&gt;If all your tables should use the same class or classes, you could use my &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow&quot;&gt;Retcon&lt;/a&gt; plugin to add the classname(s) in Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconAttr('table', {class: 'someclassname'}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If different tables need different classes, this isn't a solution, though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-17T22:12:00.317" LastActivityDate="2016-10-17T22:12:00.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17315" PostTypeId="1" CreationDate="2016-10-17T19:53:24.140" Score="1" ViewCount="400" Body="&lt;p&gt;I did search for this but was unable to find the documentation for getting user's data on a return when logging them in from a front-end facing login form (I need to do the same for a registration as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get a return of the user's Id and their email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code for the form. It works fine,  I just cannot seem to find the user's info in the data return so if anyone has an example or suggestion it would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#workshop-registration-user-login-form').submit(function (e) {&#xA;  e.preventDefault();&#xA;  var data = $('#workshop-registration-user-login-form').serialize();&#xA;&#xA;  $.ajax({&#xA;    type: 'POST',&#xA;    url: '/users/login',&#xA;    data: data,&#xA;    headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;  })&#xA;  .success(function(data) {&#xA;    console.log(data.currentUserId);&#xA;&#xA;    ...&#xA;&#xA;    // get data populate the fields&#xA;  })&#xA;  .error(function(data) {&#xA;    console.log('error');&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="3817" LastEditDate="2016-10-17T20:28:33.463" LastActivityDate="2018-03-29T11:59:25.970" Title="How to get user's information when registering or logging in via ajax form" Tags="&lt;ajax&gt;&lt;craft-pro&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17316" PostTypeId="2" ParentId="17315" CreationDate="2016-10-17T20:21:35.893" Score="1" Body="&lt;p&gt;Not sure what other user info you're looking for, but Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow&quot;&gt;UsersController&lt;/a&gt; will only return &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L1601-L1608&quot; rel=&quot;nofollow&quot;&gt;two things&lt;/a&gt; in the JSON response of a successful login for an AJAX request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;code&gt;success&lt;/code&gt; key set to &lt;code&gt;true&lt;/code&gt; and a &lt;code&gt;returnUrl&lt;/code&gt; key set to where the login redirect should go to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-17T20:21:35.893" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17319" PostTypeId="1" AcceptedAnswerId="17320" CreationDate="2016-10-18T06:42:28.190" Score="2" ViewCount="207" Body="&lt;p&gt;I have a front-end registration page and need to change the validation to add (minimum characters for information on the page and to make fields to accept only letters and other to accept only number how can I accomplish this )&#xA;if there is any guide or step by step it will be nice ,&#xA;thanks in advance &#xA;my site is on this link : todo.net&#xA;registration page is : todo.net/register &lt;/p&gt;&#xA;" OwnerUserId="5598" LastActivityDate="2016-10-19T16:11:41.570" Title="Front-end registration validation" Tags="&lt;registration&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17320" PostTypeId="2" ParentId="17319" CreationDate="2016-10-18T08:29:34.933" Score="3" Body="&lt;p&gt;You could use Regex (Regular Expression), &lt;code&gt;/^[a-zA-Z]{3,}$/&lt;/code&gt; would for instance allow a minimum of 3 characters behind the comma would be the max value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for numbers it would be something like this &lt;code&gt;/^[0-9]{3,}$/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://regexr.com/&quot; rel=&quot;nofollow&quot;&gt;http://regexr.com/&lt;/a&gt; to test your regex en examples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I would do this before the user is saved with the &lt;code&gt;users.onBeforeSaveUser&lt;/code&gt; Event in a plugin.&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="57" LastEditDate="2016-10-18T17:59:38.237" LastActivityDate="2016-10-18T17:59:38.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17321" PostTypeId="1" CreationDate="2016-10-18T10:55:09.340" Score="1" ViewCount="242" Body="&lt;p&gt;On the cart page, I currently display items that have been added to the cart with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ lineItem.description }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do, rather than displaying the product name and variant title as one, is to split them. So that I can display the variant title separately from the product name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct model for this?&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-10-18T11:28:50.013" Title="Display variant title on cart page" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17322" PostTypeId="2" ParentId="17321" CreationDate="2016-10-18T11:28:50.013" Score="2" Body="&lt;p&gt;&lt;code&gt;lineItem.purchasable.title&lt;/code&gt; is the variant title, &lt;code&gt;lineItem.purchasable.product.title&lt;/code&gt; is the product title.  &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-18T11:28:50.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17323" PostTypeId="2" ParentId="17203" CreationDate="2016-10-18T11:44:40.857" Score="2" Body="&lt;p&gt;I made a really hacky way of applying 20% UK VAT to any value using a custom template variable. I expect you could grab Tax rule values from Commerce settings if you wanted the percentage to be dynamic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.businessLogic.taxAddedPrice( product.defaultVariant.price, 20 )|currency( cart.currency, true ) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function taxAddedPrice( $productPrice, $percentage )&#xA;{&#xA;  return ( ( ( ( $productPrice ) / 100 ) * $percentage ) + $productPrice );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2016-10-18T11:44:40.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17324" PostTypeId="2" ParentId="17279" CreationDate="2016-10-18T11:54:55.170" Score="1" Body="&lt;p&gt;The function you mention isn't the problem. It isn't being called because, as you say, the exclusion clause is working perfectly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you also have a hook on the &lt;code&gt;window.popstate&lt;/code&gt; which is triggered when you change the URL (by adding #contact to it for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This hook, as below, subsequently fires the &lt;code&gt;loadPage&lt;/code&gt; function you have coded:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(window).on(&quot;popstate&quot;, function(e) {&#xA;    // -------------------------------------&#xA;    //   If there was an AJAX page transition already,&#xA;    //   then AJAX page load the requested page from the back or forwards button click.&#xA;    //   Variable initially set after the $main variable.&#xA;    // -------------------------------------&#xA;    if (changedPage) loadPage(location.href);&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See more on the popstate event:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate&quot; rel=&quot;nofollow&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As others have mentioned though, this is Javascript specific rather than Craft, so should probably be moved or archived?&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-18T11:54:55.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17325" PostTypeId="2" ParentId="17273" CreationDate="2016-10-18T13:27:48.887" Score="1" Body="&lt;p&gt;Your n+1 problem comes from accessing &lt;code&gt;port.parent&lt;/code&gt; in the Ports menu loop. That is being called for each category, and each time it is triggering a new element query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The right way to go about this is to load only the top-level categories (the Countries) using the &lt;code&gt;level=1&lt;/code&gt; param, &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow&quot;&gt;eager-loaded&lt;/a&gt; with their children (the Ports):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countries = craft.categories({&#xA;    group: 'locations',&#xA;    level: 1,&#xA;    limit: null,&#xA;    with: ['children']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then build the Countries menu without worrying about which level the categories have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;countries&quot; class=&quot;countries&quot; name=&quot;country&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select...&amp;lt;/option&amp;gt;&#xA;&#xA;    {% for country in countries %}&#xA;        &amp;lt;option value=&quot;{{ country.slug }}&quot;&amp;gt;{{ country.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to build the Ports menu, just loop over the countries again, and for each one, loop through its eager-loaded children. Set each port option’s &lt;code&gt;class&lt;/code&gt; attribute to the current country’s slug (since that’s what you’re setting the country menu options’ values to).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Ports&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;ports&quot; name=&quot;port&quot; class=&quot;ports&quot; disabled=&quot;disabled&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select a country first&amp;lt;/option&amp;gt;&#xA;&#xA;    {% for country in countries %}&#xA;        {% for port in country.children %}&#xA;            &amp;lt;option value=&quot;{{ port.slug }}&quot; class=&quot;{{ country.slug }}&quot;&amp;gt;{{ port.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-10-18T13:27:48.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17326" PostTypeId="1" CreationDate="2016-10-18T15:28:58.557" Score="1" ViewCount="128" Body="&lt;p&gt;I thought that a simple &lt;code&gt;.fixedOrder(true)&lt;/code&gt; would make the files order in the same way as in the CMS. Instead of that, there is no output. Where I go wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set files = craft.assets.kind('pdf,word,excel').fixedOrder(true) %}&#xA;&amp;lt;section class=&quot;bestanden&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-12-md&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;documenten&quot;&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for file in files %}&#xA;                &amp;lt;li&amp;gt;&#xA;                   &amp;lt;i class=&quot;fa fa-file-{{ file.kind }}-o&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;a href=&quot;{{ file.url }}&quot; target=&quot;_blank&quot;&amp;gt;{{ file }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="57" LastEditDate="2016-10-18T17:58:56.827" LastActivityDate="2016-10-18T17:58:56.827" Title="fixedOrder(true) not working?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17327" PostTypeId="2" ParentId="17309" CreationDate="2016-10-18T16:26:53.250" Score="2" Body="&lt;p&gt;I've figured this out (the solution is not in the docs). Follow these steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; In the amforms plugin's settings, create a custom text field called 'notificationRecipients'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Add that field to your form's list of fields in the form's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; Under the notifications tab of your form, add this to your &quot;Email Recipients&quot; field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;defaultAddress@domain.com,{notificationRecipients}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; Now in your template, add a hidden input in the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[notificationRecipients]&quot; value=&quot;{{ entry.yourCustomFieldEmailAddress }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that multiple emails should be separated by commas like &lt;code&gt;example1@gmail.com,example2@gmail.com,example3@gmail.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want the list of email recipients to appear in your notification email, then you need to edit line 24 of craft/plugins/amforms/templates/_display/templates/email.twig to look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for field in fields if field.getField().handle != 'notificationRecipients' -%}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional examples and info can be found on these closed issues of the developer's git page:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/am-impact/amforms/issues/72&quot; rel=&quot;nofollow&quot;&gt;#72&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/am-impact/amforms/issues/86&quot; rel=&quot;nofollow&quot;&gt;#86&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/am-impact/amforms/issues/99&quot; rel=&quot;nofollow&quot;&gt;#99&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2016-10-18T16:26:53.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17328" PostTypeId="2" ParentId="17326" CreationDate="2016-10-18T16:41:04.613" Score="4" Body="&lt;p&gt;&lt;code&gt;fixedOrder&lt;/code&gt; only works with the &lt;code&gt;id&lt;/code&gt; param. (If &lt;code&gt;fixedOrder&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;id&lt;/code&gt; is set to a list of IDs, it will return the elements in the exact order that the IDs were listed.) It’s currently not possible to query elements in a fixed order based on any other params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your use case, the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow&quot;&gt;|group&lt;/a&gt; filter should work nicely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set kinds = ['pdf', 'word', 'excel'] %}&#xA;{% set filesByKind = craft.assets.kind(kinds)|group('kind') %}&#xA;&#xA;&amp;lt;section class=&quot;bestanden&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-12-md&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;documenten&quot;&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {# Loop through the file kinds in the order we want #}&#xA;                {% for kind in kinds %}&#xA;                    {% for file in filesByKind[kind] %}&#xA;                        &amp;lt;li&amp;gt;&#xA;                           &amp;lt;i class=&quot;fa fa-file-{{ kind }}-o&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;a href=&quot;{{ file.url }}&quot; target=&quot;_blank&quot;&amp;gt;{{ file }}&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-10-18T16:41:04.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17329" PostTypeId="1" AcceptedAnswerId="17330" CreationDate="2016-10-18T17:20:42.943" Score="1" ViewCount="149" Body="&lt;p&gt;I encountered a problem which is very similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10416/getparam-not-working-on-live-server#comment23803_10442&quot;&gt;this post&lt;/a&gt;. I've been using the letter &quot;p&quot; as part of a search string so &lt;code&gt;www.website.com/test?p=querystring&lt;/code&gt;. It worked for more 6 months and now all of a sudden it doesn't work. Thanks to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10416/getparam-not-working-on-live-server#comment23803_10442&quot;&gt;the other post&lt;/a&gt; I looked in my .htaccess file and see this rewrite rule: &lt;code&gt;RewriteRule (.+) index.php?p=$1 [QSA,L]&lt;/code&gt; which was there by default when I installed Craft. I changed my query string parameter to &quot;q&quot; and now it works again. Not sure if something changed when I updated to the latest Craft version which at the time was version 2.6.2945, or if it's something else. &lt;/p&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-10-18T17:43:32.107" Title="getParam not working anymore" Tags="&lt;templating&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17330" PostTypeId="2" ParentId="17329" CreationDate="2016-10-18T17:43:32.107" Score="3" Body="&lt;p&gt;The query value for &lt;code&gt;p&lt;/code&gt; has been the &lt;a href=&quot;https://craftcms.com/docs/config-settings#pageTrigger&quot; rel=&quot;nofollow&quot;&gt;pageTrigger&lt;/a&gt; since Craft 1.0 (and probably in the beta as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why you were still able to use it for other purposes up until recently. To be honest, it sounds like you were accidentally exploiting a bug, which has since been fixed.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-18T17:43:32.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17331" PostTypeId="2" ParentId="17308" CreationDate="2016-10-18T17:44:09.427" Score="7" Body="&lt;p&gt;There’s a lot to unpack here. Before I get to the solution, I’ll step through each of your examples, line-by-line. Hopefully that will help explain the behavior you’re seeing.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;First Example&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all entries from the section. #}&#xA;{% set entries = craft.entries.section('mySection') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your comment is correct – this will fetch all the entries from section &lt;code&gt;mySection&lt;/code&gt; and assign them to a new variable called &lt;code&gt;entries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through the entries and get the user account associated with each. #}&#xA;{% for profiles in entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Start a loop on the &lt;code&gt;entries&lt;/code&gt; variable. Within the loop, each profile entry will be represented by a &lt;code&gt;profiles&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: it’s misleading to call your variable “profiles” rather than “profile”, since it will only represent a single profile entry.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set users = profiles.userAccount %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetch all of the user accounts related to the current profile (&lt;code&gt;profiles&lt;/code&gt;) via the &lt;code&gt;userAccount&lt;/code&gt; field, and assign them to a new variable called &lt;code&gt;users&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if users|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only do the following if there were any related users…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for year, user in users|group('myYearField') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Turn the users (&lt;code&gt;users&lt;/code&gt;) that are related to the current profile (&lt;code&gt;profiles&lt;/code&gt;) into a multi-dimensional array, grouped by their &lt;code&gt;myYearField&lt;/code&gt; field values. Then start a loop on that multi-dimensional array. Within the loop, each &lt;code&gt;myYearField&lt;/code&gt; value will be represented by a &lt;code&gt;year&lt;/code&gt; variable, and the array of grouped user accounts will be represented by a &lt;code&gt;user&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This is where things start really going wrong. You want to group &lt;strong&gt;all&lt;/strong&gt; of your users by year – not just the ones that are related to the current profile. Also, your choice of “user” as a variable name here is misleading since it’s actually an array of grouped users; not a single user.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;h4&amp;gt;{{ year }}&amp;lt;/h4&amp;gt; {# 2016 #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the current grouping’s &lt;code&gt;myYearField&lt;/code&gt; value, which was assigned to a &lt;code&gt;year&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;                {% for user in users %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Start a loop on the same &lt;code&gt;users&lt;/code&gt; variable that you’re already in the middle of looping through. &lt;code&gt;users&lt;/code&gt; here refers to the same &lt;code&gt;users&lt;/code&gt; variable that was defined in the 3rd codeblock.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ profiles.url }}&quot;&amp;gt;{{ user.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the profile entry’s (&lt;code&gt;profiles&lt;/code&gt;) URL, and the current user’s (&lt;code&gt;user&lt;/code&gt;) name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the user accounts related to the current profile entry (&lt;code&gt;users&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the multi-dimensional array of year-user groupings based on the user accounts related to the current profile entry (&lt;code&gt;users&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the conditional checking if there any users related to the current profile entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the profile entries (&lt;code&gt;entries&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Second Example&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProfiles = craft.entries.section('mySection') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetch all the entries from section &lt;code&gt;mySection&lt;/code&gt; and assign them to a new variable called &lt;code&gt;allProfiles&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if allProfiles|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only do the following if there were any profile entries…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {{ allProfiles|length }} {# 3 #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the total number of profile entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for profiles in allProfiles %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Start a loop on the &lt;code&gt;allProfiles&lt;/code&gt; variable. Within the loop, each profile entry will be represented by a &lt;code&gt;profiles&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: as with the last example, it’s misleading to call your variable “profiles” rather than “profile”, since it will only represent a single profile entry.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for profile in profiles.userAccount %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetch all of the user accounts related to the current profile (&lt;code&gt;profiles&lt;/code&gt;) via the &lt;code&gt;userAccount&lt;/code&gt; field. Start a loop on the user accounts. Within the loop, each user account will be represented by a &lt;code&gt;profile&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: it’s misleading to call your variable “profile”, since it is actually the user account, not the profile entry.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% for year, user in profile|group('yearFieldHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Turn the current user account (&lt;code&gt;profile&lt;/code&gt;) into a multi-dimensional array, grouped by its properties’ &lt;code&gt;yearFieldHandle&lt;/code&gt; sub-property values (which isn’t a thing). Then start a loop on that multi-dimensional array. Within the loop, each &lt;code&gt;yearFieldHandle&lt;/code&gt; value will be represented by a &lt;code&gt;year&lt;/code&gt; variable, and the array of grouped user account properties will be represented by a &lt;code&gt;user&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Since &lt;code&gt;profile&lt;/code&gt; is a single element (the user account) and not an array of elements, nothing about this is likely doing what you expected it to.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                &amp;lt;h1&amp;gt;{{ year }}&amp;lt;/h1&amp;gt;  {# No output #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the current grouping’s &lt;code&gt;yearFieldHandle&lt;/code&gt; value, which was assigned to a &lt;code&gt;year&lt;/code&gt; variable. (This is the equivalent of doing something like &lt;code&gt;profile.id.yearFieldHandle&lt;/code&gt;. It’s expected that you wouldn’t get any output.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                &amp;lt;h2&amp;gt;{{ profile.firstName }}&amp;lt;/h2&amp;gt;    {# Bob #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the user account’s first name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                &amp;lt;h3&amp;gt;{{ profile.myYear }}&amp;lt;/h3&amp;gt; {# 2016 #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output the user account’s &lt;code&gt;myYear&lt;/code&gt; custom field value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the multi-dimensional array of year-user account property groupings based on the current user account defined by the parent loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the user accounts related to the current profile entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the loop on the profile entries (&lt;code&gt;allProfiles&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Close out the conditional checking if there any profile entries.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To group all of your profiles by their related user accounts’ custom date fields, first let’s load the profiles, &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;noreferrer&quot;&gt;eager-loaded&lt;/a&gt; with their related user accounts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profiles = craft.entries({&#xA;    section: 'userProfiles',&#xA;    with: ['userAccount']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next let’s group the profiles by the &lt;code&gt;myYear&lt;/code&gt; custom field on their related user accounts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profilesByYear = profiles|group('userAccount[0].myYear') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now we can loop through the years, and their corresponding user profiles/accounts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for year, yearProfiles in profilesByYear %}&#xA;    &amp;lt;h1&amp;gt;{{ year }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% for profile in yearProfiles %}&#xA;        {% set user = profile.userAccount[0] ?? null %}&#xA;        {% if user %}&#xA;            &amp;lt;h2&amp;gt;{{ user.firstName }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ user.myYear }}&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2016-10-18T17:44:09.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17332" PostTypeId="2" ParentId="17257" CreationDate="2016-10-18T22:16:56.227" Score="3" Body="&lt;p&gt;Thanks for the troubleshooting help. It appears as though the issue was the cache and how Craft handles sessions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For those who use a cache/CDN and are having issues with control panel session timeout:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even after ignoring &lt;code&gt;/admin&lt;/code&gt; on our cache, the cached pages on the public-facing portion of the site were conflicting somehow with how Craft was handling the sessions in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our solution was to create a cookie we called &lt;code&gt;isAuth&lt;/code&gt; that was created on login and destroyed on logout. We did this by creating a plugin and using &lt;code&gt;userSession.onLogin&lt;/code&gt; and &lt;code&gt;userSession.onLogout&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we set our Akamai cache to &lt;code&gt;no-cache, no-store&lt;/code&gt; if isAuth cookie is present. This fixed all timeout issues.&lt;/p&gt;&#xA;" OwnerUserId="5757" LastActivityDate="2016-10-18T22:16:56.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17334" PostTypeId="1" AcceptedAnswerId="17337" CreationDate="2016-10-19T11:26:53.333" Score="1" ViewCount="115" Body="&lt;p&gt;Is there an easy way to check if the current page is the Dashboard?&#xA;I have a widget that needs several Javascript resources but if I include them in the widget library I get a google maps error that I should not do that.&#xA;&lt;code&gt;You have included the Google Maps API multiple times on this page. This may cause unexpected errors.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could make a workaround and set a static public variable to false after the first include but that would be kinda dirty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all I want to know id there is something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init()&#xA;{&#xA;    if (craft()-&amp;gt;isDashBoard()) {&#xA;        //include all JS ressources&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or if there is a better way to include Javascript. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-10-19T11:32:14.283" LastActivityDate="2016-10-19T12:59:45.083" Title="Plugin init check if current page is dashboard" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17335" PostTypeId="1" CreationDate="2016-10-19T12:48:38.237" Score="4" ViewCount="1586" Body="&lt;p&gt;I am wondering if there is a best practice around using channels and structures. When you have a single section you can link to that section by selecting the entry for it. For channels and structures there is no &quot;entry&quot; that represents the landing page where I just want to display the list of entries. Do I need to create a single section as the landing page and loop entries from my channel section in order to link to that landing page?&lt;/p&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="5437" LastEditDate="2016-12-13T19:49:43.287" LastActivityDate="2016-12-13T19:49:43.287" Title="Best practice for channels and structures" Tags="&lt;structure&gt;&lt;channels&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17336" PostTypeId="2" ParentId="17334" CreationDate="2016-10-19T12:55:24.720" Score="1" Body="&lt;p&gt;You know that init() would fire everytime an action is done, so you would load multiple google map apis it is mostly used for hooking into Events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try something else to load it in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Control Panel JS plugin for craft and then by there load in your javascript. &amp;lt;- works good if i remember correctly&lt;/p&gt;&#xA;" OwnerUserId="5497" LastActivityDate="2016-10-19T12:55:24.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17337" PostTypeId="2" ParentId="17334" CreationDate="2016-10-19T12:59:45.083" Score="3" Body="&lt;p&gt;Nope, but you can use the &lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% includeJsFile %}&lt;/code&gt;&lt;/a&gt; tag to include the file(s) from your widget template. In whatever template you render in your widget's &lt;code&gt;getBodyHtml()&lt;/code&gt; method, add this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to queue up several files, you'll need several &lt;code&gt;{% includeJsFile %}&lt;/code&gt; tags. There's also a &lt;code&gt;{% includeCssFile %}&lt;/code&gt;, if you need to add some external CSS, as well.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-19T12:59:45.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17338" PostTypeId="1" AcceptedAnswerId="17356" CreationDate="2016-10-19T13:20:24.253" Score="2" ViewCount="424" Body="&lt;p&gt;Is it possible to allow certain payments per user in Craft Commerce and if so how and if not how would it be possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just breaking my head around it.&lt;/p&gt;&#xA;" OwnerUserId="5497" LastActivityDate="2016-10-20T05:31:16.620" Title="Craft Commerce payment methods per user" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17339" PostTypeId="1" AcceptedAnswerId="17341" CreationDate="2016-10-19T14:54:26.623" Score="1" ViewCount="175" Body="&lt;p&gt;I'm using a row layout SuperTable to create a recipe (ingredients are entries). Is there a way to &lt;strong&gt;show another field inside the related entry (not just the title) together with the entry title?&lt;/strong&gt; I need to specify the measure (like &lt;em&gt;tbsp&lt;/em&gt;) otherwise it's hard to know the quantity for what you're editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gKC0f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gKC0f.png&quot; alt=&quot;supertable connected entries&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to show Spinach &lt;strong&gt;(100g)&lt;/strong&gt; in the ingredient row. The 100g is a field called &lt;em&gt;ingredientMeasure&lt;/em&gt; inside the ingredient entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/szIkS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/szIkS.png&quot; alt=&quot;ingredient entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about using a hook (modifyEntryTableAttributes) - but not sure how to do it with ST. This is my hook example (from Ben's plugin tutorial):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ADD A HOOK - modify the contents of table cell on entry index page&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute) {&#xA;    // check if setting is enabled and we're editing our column&#xA;    if ($this-&amp;gt;getSettings()-&amp;gt;showCountOnEntryIndex AND $attribute == 'count')&#xA;    {&#xA;        return 'C&amp;lt;b&amp;gt;' . craft()-&amp;gt;entryCount-&amp;gt;getCount($entry-&amp;gt;id)-&amp;gt;count . '&amp;lt;/b&amp;gt;';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2016-10-19T19:01:49.843" Title="How to show details on linked entry in CP (another field inside related entry)" Tags="&lt;control-panel&gt;&lt;hook&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17340" PostTypeId="2" ParentId="17335" CreationDate="2016-10-19T14:58:59.203" Score="7" Body="&lt;p&gt;You basically have two options for creating a &quot;listing&quot; or &quot;archive&quot; view for your Channel or Structure sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first option is to create a Single. This is in many cases appropriate, e.g. if you need to add content to the listing view in addition to the actual entry list, such as a visual banner, introductory text etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the Single section's entry template, you'll need to pull the entries you want to display in the list using &lt;code&gt;craft.entries&lt;/code&gt; – here's a very basic example for how the Single section's entry template could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% block content %}&#xA;&#xA;    {# Display some content from our Single #}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ entry.introduction }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {# ...and a list of entries in the &quot;news&quot; Section #}&#xA;    &amp;lt;h2&amp;gt;Entries&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for newsEntry in craft.entries.section('news') %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ newsEntry.url }}&quot;&amp;gt;{{ newsEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second option is to &lt;em&gt;not&lt;/em&gt; create a Single :) Of course, then you need to solve the problem of there not being an actual URL for your &quot;archive&quot; or &quot;list&quot; view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many ways to approach this, but a simple and good solution to this problem is to leverage Craft's template routing pattern. If your Channel or Structure section's URL format is &lt;code&gt;news/{slug}&lt;/code&gt;, and the entry template is &lt;code&gt;news/_entry.html&lt;/code&gt;, you can simply create a template called &lt;code&gt;news/index.html&lt;/code&gt;, and Craft will render that template for any requests to &lt;code&gt;example.com/news&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without a Single, the &lt;code&gt;templates/news/index.html&lt;/code&gt; template will look much the same as the above example (you'll still need the &lt;code&gt;craft.entries&lt;/code&gt; query to actually pull the entries) albeit without a pre-populated &lt;code&gt;entry&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;h1&amp;gt;News archive&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;Here's our awesome news archive&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;h2&amp;gt;Entries&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in craft.entries.section('news') %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;About &quot;Craft's template routing pattern&quot; mentioned above; these are two important things to know about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Whenever Craft can't match a URL request to an entry or category (and also no &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;noreferrer&quot;&gt;dynamic routes&lt;/a&gt;) it'll look for a matching template &lt;em&gt;path&lt;/em&gt;. This means that if there's no entry or category with a URL format matching the request &lt;code&gt;example.com/news&lt;/code&gt;, Craft will look for a template with the filepath &lt;code&gt;/templates/news/index.html&lt;/code&gt;. If that template exists, Craft will render it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Any template prefixed with an underscore (or in a folder prefixed with an underscore), such as &lt;code&gt;/templates/news/_entry&lt;/code&gt;, is excluded from template routing. This means that Craft won't match the URL &lt;code&gt;example.com/news/entry&lt;/code&gt; to the &lt;code&gt;news/_entry.html&lt;/code&gt; template.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-19T15:04:55.273" LastActivityDate="2016-10-19T15:04:55.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17341" PostTypeId="2" ParentId="17339" CreationDate="2016-10-19T15:52:47.603" Score="3" Body="&lt;p&gt;Basically, what you want to do isn't possible – there's no hook for modifying the content in a relational field's input HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt; hook is meant for element indexes (such as the entry list displayed at &lt;code&gt;/admin/settings/entries&lt;/code&gt;), not relational fields (such as Entries, which is what you're using in your SuperTable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The easiest workaround would be to add the value of the &lt;code&gt;ingredientMeasure&lt;/code&gt; field to your ingredient entries' title format.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you'll need to create a new custom field for your entries' titles – the handle &lt;code&gt;title&lt;/code&gt; is reserved, so call it &lt;code&gt;ingredientTitle&lt;/code&gt; or the like, and add it to your &quot;Ingredients&quot; section's entry type. Make the field &lt;em&gt;required&lt;/em&gt;. Second, you'll need to go into your &quot;Ingredients&quot; section's entry type settings, and uncheck the &quot;Show the Title field&quot; checkbox. Then, add something like this to &quot;Title format&quot; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ingredientTitle} ({ingredientMeasure})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally – you'll need to re-save all your ingredient entries in order to have their titles updated to the new format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the big tradeoff with this method is that your ingredient won't actually be titled &lt;em&gt;&quot;Spinach&quot;&lt;/em&gt; anymore – it'll be titled something like &lt;em&gt;&quot;Spinach (100g)&quot;&lt;/em&gt;. In your templates, this can easily be remedied by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.ingredientTitle }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of the normal &lt;code&gt;entry.title&lt;/code&gt;, wherever appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, unless you want the &lt;code&gt;ingredientsMeasure&lt;/code&gt; field to be part of the Ingredient entries' slugs, you should replace &lt;code&gt;{slug}&lt;/code&gt; in your Ingredients Section's URL format with &lt;code&gt;{ingredientsTitle|kebab}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-19T19:01:49.843" LastActivityDate="2016-10-19T19:01:49.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17343" PostTypeId="2" ParentId="17319" CreationDate="2016-10-19T16:11:41.570" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/marionnewlevant/craft-mn_matchinput&quot; rel=&quot;nofollow&quot;&gt;MN Match Input&lt;/a&gt; plugin is a fieldtype for fields that match a regular expression. It sound to me as if it will do what you want.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-10-19T16:11:41.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17344" PostTypeId="1" CreationDate="2016-10-19T16:20:40.647" Score="1" ViewCount="137" Body="&lt;p&gt;I have over 9000 photos that I need to add to my site however using the upload feature in assets is taking an extremely long time. I have tried to just simply add the images to the correct folder in public but they are not showing up on craft. Is there something additional I must do for them to show up or is using the upload feature the only way for photos to show in assets?&lt;/p&gt;&#xA;" OwnerUserId="5677" LastActivityDate="2016-10-19T16:25:22.250" Title="Adding images directly to public folder" Tags="&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17345" PostTypeId="2" ParentId="17299" CreationDate="2016-10-19T16:22:30.580" Score="1" Body="&lt;p&gt;Another option would be to use &lt;a href=&quot;https://github.com/pixelandtonic/Parsedown&quot; rel=&quot;nofollow&quot;&gt;Parsedown&lt;/a&gt; to add formatting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{entry.titleField|pd('line')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-10-19T16:22:30.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17346" PostTypeId="2" ParentId="17344" CreationDate="2016-10-19T16:25:22.250" Score="4" Body="&lt;p&gt;You need to use the &lt;a href=&quot;https://craftcms.com/docs/assets#updating-your-asset-indexes&quot; rel=&quot;nofollow&quot;&gt;Update Asset Indexes&lt;/a&gt; tool in Settings in the control panel:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Whenever there are files within your asset source that were not added directly by Craft (e.g. via FTP), you will need to tell Craft to go and look for them. You can do that from the “Update Asset Indexes” tool within Settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-10-19T16:25:22.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17347" PostTypeId="1" AcceptedAnswerId="17354" CreationDate="2016-10-19T18:03:30.987" Score="5" ViewCount="2192" Body="&lt;p&gt;Is there a way to update the cart using ajax?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('span.quick-cart-add&amp;gt;p&amp;gt;a').click(function(e){&#xA;&#xA;    e.preventDefault();&#xA;&#xA;    var data                    = {};&#xA;    data[&quot;purchasableId&quot;]       = $(this).data(&quot;id&quot;);&#xA;    data[&quot;qty&quot;]                 = $(this).data(&quot;qty&quot;);&#xA;    data[window.csrfTokenName]  = window.csrfTokenValue;&#xA;&#xA;&#xA;    $.post( &quot;/actions/commerce/cart/updateCart&quot;, data, function(response) {&#xA;&#xA;        alert( &quot;success&quot; );&#xA;&#xA;    }).always(function(response) { console.log(data, response); });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried passing &lt;code&gt;&quot;lineItemId&quot;&lt;/code&gt; instead of &lt;code&gt;&quot;purchasableId&quot;&lt;/code&gt;, and also sending to &lt;code&gt;&quot;/actions/commerce/cart/updateLineItem&quot;&lt;/code&gt;, they all return &lt;code&gt;response.success&lt;/code&gt; but the cart is never actually updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I not sending the right amount of fields/values, or is there something I'm missing when trying to accomplish this via ajax?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-10-20T05:12:20.777" Title="Update Commerce Cart using Ajax" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17348" PostTypeId="2" ParentId="15104" CreationDate="2016-10-19T19:34:18.133" Score="3" Body="&lt;p&gt;This happened for me when I had the LastPass browser plugin version 3.3.1. Once I upgraded to 4.1.29, the issue went away.&lt;/p&gt;&#xA;" OwnerUserId="5786" LastActivityDate="2016-10-19T19:34:18.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17349" PostTypeId="1" CreationDate="2016-10-19T21:43:31.520" Score="1" ViewCount="104" Body="&lt;p&gt;I have a very complex layout which is requiring me to have quite a few {% for %} loops on the page and in each loop I need to set a bunch of variables. In order to make my template more DRY I was hoping I could save that block of code where I set the variables as a partial so I could simply include that partial in each loop rather than writing out each variable that needs to be set every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work. Variables in the parent templates are available to imported partials, but variables in partials aren't available to the rest of the parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What other templating options does Craft/Twig supply that would allow me to make this DRY?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of the variables I'm repeatedly setting on multiple loops in the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if article.newsHero | length %}&#xA;  {% set photo = article.newsHero.first().url('w600') %}&#xA;  {% set w = article.newsHero.first().width() %}&#xA;  {% set h = article.newsHero.first().height() %}&#xA;{% endif %}&#xA;{% set cat = article.newsCategory.first().title %}&#xA;{% set summary = article.newsArticle.type('text').first().text|hacksaw(words='35', append='...') %}&#xA;{% set count = loop.index %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2016-10-19T21:43:31.520" Title="I'm repeatedly setting the same variables. How to reuse code block to make this DRY?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;dry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17350" PostTypeId="1" AcceptedAnswerId="17355" CreationDate="2016-10-19T23:02:20.480" Score="3" ViewCount="576" Body="&lt;p&gt;I have shipping methods that will require additional information from the user. For example, a local delivery &lt;code&gt;shipping method&lt;/code&gt; which requires the user to include a timeframe for delivery (say, Thursday @ 3pm.)&lt;/p&gt;&#xA;&lt;p&gt;I thought I'd go about it doing something like this:&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;On select shipping page during checkout, user selects the delivery date/time (based on what is available.)&lt;/li&gt;&#xA;&lt;li&gt;User selects date, then submits form.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;That date is attached somewhere to the order model.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;The shipping method rules will validate the chosen date.&lt;/li&gt;&#xA;&lt;li&gt;Include this additional information (selected delivery date) in saved order on checkout completion.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Is there a way to do this? Basically, I need to attach additional information for this shipping method (and another similar one.) I've looked through the &lt;a href=&quot;https://craftcommerce.com/docs/order-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;order model docs&lt;/a&gt; but can't find a field I could add &lt;em&gt;&lt;strong&gt;custom&lt;/strong&gt;&lt;/em&gt; data to.&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-10-24T20:04:23.150" Title="Attach Custom Information to Commerce Order Model" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17351" PostTypeId="1" AcceptedAnswerId="17352" CreationDate="2016-10-19T23:47:47.470" Score="1" ViewCount="156" Body="&lt;p&gt;In the Craft docs for &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;nofollow&quot;&gt;validationKey config settings&lt;/a&gt;, it states that &lt;code&gt;validationKey&lt;/code&gt; should be used in load-balanced environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious on how to set this up for a load-balanced site. Does each  server need a different key, or should they all share the same setting in the config?&lt;/p&gt;&#xA;" OwnerUserId="222" LastEditorUserId="57" LastEditDate="2016-10-20T00:54:22.767" LastActivityDate="2016-10-20T01:01:33.113" Title="validationKey on load balanced enviornments" Tags="&lt;config&gt;&lt;load-balancer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17352" PostTypeId="2" ParentId="17351" CreationDate="2016-10-20T01:01:33.113" Score="0" Body="&lt;p&gt;It should be the same for every server in the load balanced environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow&quot;&gt;appId&lt;/a&gt; config setting to a consistent value for every server in the cluster as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated the documentation for those config settings to clarify.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-20T01:01:33.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17353" PostTypeId="1" CreationDate="2016-10-20T02:29:24.377" Score="4" ViewCount="378" Body="&lt;p&gt;&lt;strong&gt;preface&lt;/strong&gt;: i'm new to craft so may get terminology incorrect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;basic idea&lt;/strong&gt;: i would like to show entries of a particular channel which have multi-select field values which intersect with another set of values. e.g. given set ['a','c','e'] it would show entries with values such as ['a','b',c'] and ['e'] but not ['b','d'].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what i have done so far&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my basic ElementCriteriaModel for entries in the past is defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;    section: ['mysection'],&#xA;    when: ' &amp;lt;= ' ~ now,&#xA;    order: 'when desc',&#xA;}) %}&#xA;&#xA;{% for entry in results %}&#xA;.... blah blah do stuff&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and what i would like to do is add another criteria on there for the multi-select field. however, from what i am reading and have tried it doesn't seem like that kind of filtering is available. please stop now and prove me wrong if this is not the case!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i was able to filter matching a single option of the multi-select by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in results if entry.myMultiSelect.contains('a') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but was unable to determine syntax to &quot;OR&quot; the results with another contains(). really not much documentation that i could find on that method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alternately i possibly could use a search, but sounds like that relies on indexes that may get out of date which i would like to avoid. wouldn't be a huge deal, but looking for the &quot;right&quot; answer before i settle on brute forcing it by just looping through the multi-select values inside the loop to check for a match.&lt;/p&gt;&#xA;" OwnerUserId="5789" LastActivityDate="2016-12-02T08:49:39.467" Title="multi-select OR values to filter entries" Tags="&lt;elementcriteriamodel&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17354" PostTypeId="2" ParentId="17347" CreationDate="2016-10-20T05:12:20.777" Score="7" Body="&lt;p&gt;Yes, you can do all the normal commerce actions via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A basic recipe is this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;form method=&quot;POST&quot; id=&quot;addToCartForm&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/cart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ product.id }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot;&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $form = (&quot;#addToCartForm&quot;);&#xA;        var form_data = $form.serializeArray()&#xA;        form_data.push({&#xA;            name: window.csrfTokenName,&#xA;            value: window.csrfTokenValue&#xA;        })&#xA;&#xA;        $.ajax({&#xA;            type: 'post',&#xA;            url: '/',&#xA;            data: form_data,&#xA;            success: function(response) {&#xA;                if (response.success) {&#xA;                    alert(response.cart)&#xA;                }&#xA;            ...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;....response.cart will have the updated cart in it.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-20T05:12:20.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17355" PostTypeId="2" ParentId="17350" CreationDate="2016-10-20T05:26:10.773" Score="4" Body="&lt;p&gt;Add a custom plain text field to your orders, say &lt;code&gt;test&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when calling &lt;code&gt;updateCart&lt;/code&gt;, you can add data in to this custom field using a form with an input named like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;input name=&quot;fields[test]&quot; type=&quot;text&quot;&amp;gt; etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This data will then get saved with the order.  This same approach can basically be applied to any field/type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually validate the data, you'll need to look to making a plugin, most likely listening to onBeforeSaveOrder to check the vailidity of the data.  If valid, great, if not, set &lt;code&gt;perfomAction&lt;/code&gt; to false and return an error on the Order model.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-20T05:26:10.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17356" PostTypeId="2" ParentId="17338" CreationDate="2016-10-20T05:31:16.620" Score="2" Body="&lt;p&gt;There are a variety of ways you can solve this depending on your needs.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible way would be to assign users to groups and then use simple twig code to limit the shown payment options at the template level depending on which user (i.e which user of which group) is viewing the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, some validation logic in a custom plugin should probably be used to prevent accidents in case a user does somehow submit a payment of a type you don't want them to be using.  However I don't necessarily see an ideal event to listen to for that - I'd check with Luke Holder but perhaps onBeforeSaveOrder would work - see &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it comes down to how you'll be differentiating these users - without more info it's hard to provide a more substantial answer.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-20T05:31:16.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17357" PostTypeId="1" AcceptedAnswerId="17364" CreationDate="2016-10-20T08:40:11.033" Score="1" ViewCount="409" Body="&lt;p&gt;I'm using the P&amp;amp;T ContactForm Plugin. How can I make more field required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the version from Github only the message and email field are required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this with the ContactForm Plugin? &lt;/p&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="5577" LastEditDate="2016-10-20T15:50:57.693" LastActivityDate="2016-10-21T16:18:52.540" Title="ContactForm – How to make fields required" Tags="&lt;templating&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17358" PostTypeId="1" AcceptedAnswerId="17361" CreationDate="2016-10-20T11:24:23.063" Score="2" ViewCount="177" Body="&lt;p&gt;I've having an issue where a Date/Time field (time only) is outputting the time in the front-end template with an extra 10 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I'm using &lt;code&gt;entry.startTime|date(&quot;g:ma”)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the DB the &lt;code&gt;field_startTime&lt;/code&gt; for the entry is &lt;code&gt;2016-10-15 16:00:00&lt;/code&gt;, but on the front-end I’m seeing 4:10pm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone tell me where are these extra 10 minutes coming from, please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is happening both locally and on the dev server, using Craft CMS 2.6.2949&lt;/p&gt;&#xA;" OwnerUserId="4413" LastActivityDate="2016-10-24T07:48:07.730" Title="Date/Time field outputting time with additional minutes" Tags="&lt;entries&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17359" PostTypeId="1" AcceptedAnswerId="17360" CreationDate="2016-10-20T12:34:37.530" Score="5" ViewCount="489" Body="&lt;p&gt;I am involved with researching various CMS solutions and Craft CMS is one of the options for our organization as an Enterprise soluton, so not just for development use cases. When it comes to development we are mostly a Microsoft shop when it comes to the front-end so my question is, and I apologize for my ignorance on this, can I have an ASP.NET web application pull content from Craft? From what I can tell it looks like Twig is the development language, which again as I understand it is a language that generates PHP. We are not a PHP shop by any means so just wondering if there is some sort of plug-in or API that I could make calls to from an ASP.NET web application to pull out content from Craft. Is there anyone doing anything like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, I apologize for my ignorance but just trying to clear up some of the high level questions being brought up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5793" LastEditorUserId="22" LastEditDate="2017-05-09T20:58:06.040" LastActivityDate="2017-05-09T20:58:06.040" Title="Researching Craft CMS but we are a .NET Shop" Tags="&lt;plugin-development&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17360" PostTypeId="2" ParentId="17359" CreationDate="2016-10-20T13:21:43.413" Score="6" Body="&lt;p&gt;Craft can definitely work as a &quot;headless&quot; CMS that you can put whatever want in front of. The go-to solution for such setups is the first-party &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot;&gt;Element API plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, &lt;a href=&quot;https://craftcms.com/news/mijingo-element-api-lesson&quot;&gt;Mijingo just released a free lesson on Element API&lt;/a&gt; and using Craft as a headless CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth mentioning that &lt;a href=&quot;https://craftcms.com/3&quot;&gt;Craft 3&lt;/a&gt; (currently in dev preview; public beta ETA early 2017) is expected to add a RESTful API implementation to Craft core (either on release or after).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-20T13:21:43.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17361" PostTypeId="2" ParentId="17358" CreationDate="2016-10-20T13:42:14.900" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow&quot;&gt;You are using the wrong variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;10&lt;/code&gt; is there because it means &lt;code&gt;October&lt;/code&gt; not &lt;code&gt;10 minutes&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to use &lt;code&gt;| date(&quot;g:ia”)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2016-10-24T07:48:07.730" LastActivityDate="2016-10-24T07:48:07.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17364" PostTypeId="2" ParentId="17357" CreationDate="2016-10-20T13:50:55.700" Score="2" Body="&lt;p&gt;For form validation I typically use &lt;a href=&quot;http://parsleyjs.org/&quot; rel=&quot;nofollow&quot;&gt;Parsley.js&lt;/a&gt; - it's dead easy to use.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-10-20T13:50:55.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17365" PostTypeId="1" AcceptedAnswerId="17367" CreationDate="2016-10-20T14:34:44.683" Score="1" ViewCount="21" Body="&lt;p&gt;I've got an entry-type, which has images and sound-files assigned through an asset-field.&#xA;When i create an entry, those fields won't be synced in my other languages, even though the mark for &quot;This field is translatable&quot; is checked.&lt;/p&gt;&#xA;" OwnerUserId="5795" LastActivityDate="2016-10-20T15:06:47.200" Title="Assigned Files in entries won't get synced on localization" Tags="&lt;entries&gt;&lt;assets&gt;&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17366" PostTypeId="1" CreationDate="2016-10-20T14:35:32.303" Score="1" ViewCount="246" Body="&lt;p&gt;In the sample code, Logout doesn't actually do anything. Once a user has created a cart / order and the go to a different page, I want to force log them out, so if they go back to the cart page, it's a new order etc where they have to enter their email in again. Thanks&lt;/p&gt;&#xA;" OwnerUserId="4187" LastActivityDate="2016-10-21T18:23:16.340" Title="How do I log out a guest user?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17367" PostTypeId="2" ParentId="17365" CreationDate="2016-10-20T15:06:47.200" Score="1" Body="&lt;p&gt;If you want this field to be synced (always same assets selected) across your locales you actually have to &lt;em&gt;uncheck&lt;/em&gt; &quot;This field is translatable&quot;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-10-20T15:06:47.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17368" PostTypeId="1" AcceptedAnswerId="17369" CreationDate="2016-10-20T16:07:10.473" Score="1" ViewCount="75" Body="&lt;p&gt;This works (but only obtains the active users):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get entry&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;// get existing users in field&#xA;$entry-&amp;gt;customUserField-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in attempting to get the non-active users I've switched to using the ElementCriteriaModel but have been unsuccessful:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get entry&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;// get field model&#xA;$field = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('customUserField');&#xA;&#xA;// get all users for entry+field&#xA;$getUsers = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$getUsers-&amp;gt;relatedTo([&#xA;    'targetElement' =&amp;gt; $entry,&#xA;    'field' =&amp;gt; $field,&#xA;    'status' =&amp;gt; null  // user status null&#xA;]);&#xA;&#xA;$users = $getUsers-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm certain I'm doing something wrong within my relatedTo parameters. Help!&lt;/p&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-20T16:44:14.040" Title="Fetching &quot;Pending&quot; Users Related To Entry Within Plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;entrymodel&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17369" PostTypeId="2" ParentId="17368" CreationDate="2016-10-20T16:44:14.040" Score="3" Body="&lt;p&gt;As always, spent hours trying to figure this out and came upon the answer within an hour after posting the question on Stack.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the working code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // get entry&#xA;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;    // get ALL users related to entry&#xA;    $users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;    $users-&amp;gt;status = null;&#xA;    $users-&amp;gt;relatedTo = [$entry];&#xA;    $userIds = $users-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-20T16:44:14.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17371" PostTypeId="1" CreationDate="2016-10-20T20:01:43.153" Score="0" ViewCount="121" Body="&lt;p&gt;How do I save and show the credit card fee on the order page. When I get the response from the gateway I too get the credit card fee amount but it's not being added to the order and isn't viewable anywhere - does anyone have any experience with that?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2016-10-20T22:07:32.030" LastActivityDate="2016-10-27T00:21:31.827" Title="Save and show card fee for Commerce plugin" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17373" PostTypeId="1" AcceptedAnswerId="17385" CreationDate="2016-10-21T06:45:13.857" Score="2" ViewCount="149" Body="&lt;p&gt;Could it be possible in Craft Commerce to let an admin create a customer with a one time set billing address and that the customer can only set shipping address in the order process?&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="57" LastEditDate="2016-10-21T18:08:51.077" LastActivityDate="2016-10-21T23:46:33.127" Title="Craft Commerce one time billing address creation" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17374" PostTypeId="1" CreationDate="2016-10-21T07:10:37.423" Score="1" ViewCount="750" Body="&lt;p&gt;I got a section called &lt;code&gt;news&lt;/code&gt; which contain 2 types of entries: &#xA;&lt;code&gt;news&lt;/code&gt; and &lt;code&gt;press&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those entries are linked with 2 different categories :&lt;br&gt;&#xA;&lt;code&gt;news&lt;/code&gt; entries have category &lt;code&gt;newsType&lt;/code&gt;&lt;br&gt;&#xA;and &lt;code&gt;press&lt;/code&gt; entries have category &lt;code&gt;pressType&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In twig template I want to make 2 entries listing:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;one from &lt;code&gt;news&lt;/code&gt; entries and category &lt;code&gt;newstype = A&lt;/code&gt;   &lt;/li&gt;&#xA;&lt;li&gt;the other from &lt;code&gt;press&lt;/code&gt; entries and category &lt;code&gt;presstype = X&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then merge those 2 lists to display them ordered by &lt;code&gt;publication date&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="3383" LastEditDate="2016-10-21T07:15:50.120" LastActivityDate="2016-10-21T11:02:16.683" Title="Merge two queries of entries ordered by publication date" Tags="&lt;entries&gt;&lt;merge&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17375" PostTypeId="2" ParentId="17374" CreationDate="2016-10-21T07:39:34.423" Score="3" Body="&lt;p&gt;You can probably use the &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter with multiple relation criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(['news', 'press']).relatedTo('or',&#xA;    { targetElement: newsTypeCategory, field: 'newsTypeCategoryField' },&#xA;    { targetElement: pressTypeCategory, field: 'pressTypeCategoryField' }).order('postDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;newsTypeCategory&lt;/code&gt; and &lt;code&gt;pressTypeCategory&lt;/code&gt; should be category IDs (or CategoryModels) so you might need to pull the relevant categories as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsTypeCategory = craft.categories.group('newstype').slug('someslug') %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also note that you'll obviously need to change the &lt;code&gt;field&lt;/code&gt; values to the real handles for your Categories fields, in the example criteria above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;An alternative approach&lt;/em&gt; is to use the &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow&quot;&gt;SuperSort plugin&lt;/a&gt; to sort two arrays of entries on the &lt;code&gt;postDate&lt;/code&gt; attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsEntries = craft.entries.section('news').relatedTo(newsTypeCategory) %}&#xA;{% set pressEntries = craft.entries.section('press').relatedTo(pressTypeCategory) %}&#xA;{% set allEntries = newsEntries|merge(pressEntries)|supersort('sortAs', '{ postDate }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-21T11:02:16.683" LastActivityDate="2016-10-21T11:02:16.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17376" PostTypeId="1" AcceptedAnswerId="17377" CreationDate="2016-10-21T08:36:51.520" Score="1" ViewCount="463" Body="&lt;p&gt;I'm currently trying to call variables called &lt;code&gt;{{entry.title}}&lt;/code&gt;, &lt;code&gt;{{entry.latitude}}&lt;/code&gt; and so on in an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markerArray = [] %}&#xA;{% for entry in craft.entries.section('xSpots') %}&#xA;    {% set tempMarkerArray = [&#xA;    {'name':'{{entry.title}}','url':'{{entry.Url}}','lat':'{{entry.latitude}}','lng':'{{entry.longitude}}'}&#xA;    ] %}&#xA;    {% set markerArray = markerArray|merge(tempMarkerArray) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When calling &lt;code&gt;{{markerArray[0].name}}&lt;/code&gt; afterwards I am expecting it to return the proper title of the entry in Craft, instead it only returns &quot;{{entry.title}}&quot;, as if the variable is not properly recognized while filling the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help? Am I doing something fundamentally wrong?&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="57" LastEditDate="2016-10-21T18:09:26.080" LastActivityDate="2016-10-21T18:09:26.080" Title="Call a Craft variable inside array" Tags="&lt;variable&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17377" PostTypeId="2" ParentId="17376" CreationDate="2016-10-21T08:55:49.377" Score="3" Body="&lt;p&gt;To output variables inside an array like that you'd simply omit the twig braces.. at the moment the &lt;code&gt;'&lt;/code&gt; are telling whatever is inside them to output as a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: try adding parentheses around each variables like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'name':(entry.title),'url':(entry.Url),'lat':(entry.latitude),'lng':(entry.longitude)} ] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="4466" LastEditDate="2016-10-21T09:05:47.653" LastActivityDate="2016-10-21T09:05:47.653" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17379" PostTypeId="1" AcceptedAnswerId="18810" CreationDate="2016-10-21T14:45:23.680" Score="1" ViewCount="614" Body="&lt;p&gt;I have 2 Craft sites that share the same Craft codebase. For both sites, i was getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #18 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'creighton_mma_craft.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12084/getting-this-sql-error-group-by-incompatible-with-sql-mode-only-full-group-by/12106#&quot;&gt;this Craft Stack Exchange solution&lt;/a&gt; and implemented Brad's second suggestion ('initSQLs' array) on both sites (see config/db.php below). It seems to have fixed it in the site called 'craft' but not the site called 'pc'. Though the question referenced above says that he can reach his control panel, i cannot reach the site or the control panel. What am I doing wrong? As far as I know, there are no differences between the 2 sites. All configuration details listed below.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;O/S:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;O/S: GNU/Linux&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue: Ubuntu 16.04.1 LTS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kernel Release: 4.4.0-43-generic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kernel Version: #63-Ubuntu SMP Wed Oct 12 13:50:36 UTC 2016&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Apache:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server version: Apache/2.4.18 (Ubuntu)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server built:   2016-07-14T12:32:26&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MySQL:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysql  Ver 14.14 Distrib 5.7.15, for Linux (i686) using  EditLine wrapper&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )&#xA;Copyright (c) 1997-2016 The PHP Group&#xA;Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies&#xA;    with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_VERSION', '2.6');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_BUILD', '2949');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_SCHEMA_VERSION', '2.6.7');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_RELEASE_DATE', '1475689624');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_MIN_BUILD_REQUIRED', '2570');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_MIN_BUILD_URL', '&lt;a href=&quot;https://download.craftcdn.com/craft/2.1/2.1.2570/Craft-2.1.2570.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://download.craftcdn.com/craft/2.1/2.1.2570/Craft-2.1.2570.zip&lt;/a&gt;');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define('CRAFT_TRACK', 'stable');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft's db.php:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;        '*' =&amp;gt; array(&#xA;                // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;                'server' =&amp;gt; 'localhost',&#xA;&#xA;                // The database username to connect with.&#xA;                'user' =&amp;gt; '&amp;lt;redacted&amp;gt;',&#xA;&#xA;                // The database password to connect with.&#xA;                'password' =&amp;gt; '&amp;lt;redacted&amp;gt;',&#xA;        ),&#xA;&#xA;        'devappsCraft' =&amp;gt; array(&#xA;                // The name of the database to select.&#xA;                'database' =&amp;gt; 'craft',&#xA;&#xA;                // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;                'tablePrefix' =&amp;gt; 'path',&#xA;&#xA;                // Work-around for newer version of MySQL&#xA;                'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;),&#xA;        ),&#xA;&#xA;        'devappsPc' =&amp;gt; array(&#xA;                // The name of the database to select.&#xA;                'database' =&amp;gt; 'craftPc',&#xA;&#xA;                // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;                'tablePrefix' =&amp;gt; 'pc',&#xA;&#xA;                // Work-around for newer version of MySQL&#xA;                'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;),&#xA;        ),&#xA;); ?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5264" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-02-03T17:15:16.407" Title="What's the difference? SQL_MODE error in one site and not the other" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17380" PostTypeId="2" ParentId="17357" CreationDate="2016-10-21T16:18:52.540" Score="0" Body="&lt;p&gt;There isn't a way (as far as I am aware) to make fields required from within your template or the plugin UI. The suggestion above fails as soon as JS is disabled and no JS solution should be relied on for validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could fork the plugin and make fields required by editing &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/models/ContactFormModel.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/models/ContactFormModel.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-21T16:18:52.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17381" PostTypeId="2" ParentId="17366" CreationDate="2016-10-21T16:26:27.790" Score="2" Body="&lt;p&gt;I'm not clear on what you're asking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A user's cart is created as soon as they land on any page that has &lt;code&gt;{% set cart = craft.commerce.cart %}&lt;/code&gt; in it; whether they are a logged in user or not. Carts are not attached to Users until the order is complete (and only if you were a logged in user). You can have a cart as a guest, add to it, then log in and you'll still have the same cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you saying that you want someone to fill out a cart, pay for it, complete the order - then be logged out immediately? Why? If they complete an order and then make another order it will already be a different cart.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2016-10-21T18:23:16.340" LastActivityDate="2016-10-21T18:23:16.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17382" PostTypeId="1" CreationDate="2016-10-21T20:54:11.060" Score="1" ViewCount="687" Body="&lt;p&gt;I am looking for a simple solution &amp;amp; if possible resources on how to go about getting Craft CMS setup behind a load balancer. Craft CMS is going to be hosted on AWS EC2 instance, I have MySQL on a different instance. I have read about setting up and using shared storage variables but I haven't really found a way to setup a shared storage. Anyone has any idea on where to begin?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="57" LastEditDate="2016-10-22T01:27:14.997" LastActivityDate="2016-10-22T01:27:14.997" Title="Craft CMS, Amazon EC2 &amp; Load balancers" Tags="&lt;aws&gt;&lt;load-balancer&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17383" PostTypeId="2" ParentId="17382" CreationDate="2016-10-21T21:11:15.747" Score="3" Body="&lt;p&gt;I don't know if anything on AWS can be considered simple, but there is a good writeup on getting Craft up and running with EC2: &lt;a href=&quot;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&quot; rel=&quot;nofollow&quot;&gt;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-21T21:11:15.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17384" PostTypeId="1" AcceptedAnswerId="17387" CreationDate="2016-10-21T21:30:52.087" Score="2" ViewCount="37" Body="&lt;p&gt;I am trying to call an image in my twig template whose identity is known. Here is my code that does not work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = craft.assets.kind('image').folderId('9').filename('fitness-strength-strong-male-1.jpg') %}&#xA;&#xA;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 800,&#xA;    height: 600,&#xA;    quality: 75,&#xA;    position: 'center-center'&#xA;} %}&#xA;&#xA; {% if asset %}&#xA;    &amp;lt;img alt=&quot;No More Posts&quot; class=&quot;img-responsive center-block&quot; src=&quot;{{ asset.getUrl(thumb) }}&quot; &amp;gt;&#xA; {% endif %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not working at all. My &lt;code&gt;folderId&lt;/code&gt; is correct (got it from &lt;code&gt;craft_assetfolders&lt;/code&gt; table) and filename is copied and pasted. Not sure what I am doing wrong.&lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="57" LastEditDate="2016-10-21T21:43:58.603" LastActivityDate="2016-10-22T11:27:11.527" Title="How to make calls to render a fixed asset" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17385" PostTypeId="2" ParentId="17373" CreationDate="2016-10-21T23:46:33.127" Score="2" Body="&lt;p&gt;Currently there's not much in the way of back end support for creating customers as such.  You can create craft Users in the back end, but given a commerce customer is not necessarily a Craft user, I think the short answer is no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could certainly create front end stuff that effectively achieves this though - how you prep all the form work for addresses is up to you, so you could e.g. force your checkout flow to go through a 'set billing address' page the first time and then simply never offers the opportunity to change that later.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even create forms for this part of the process that are only accessible by admin, so that you're creating your own 'back end' interface for this....and then pass off the created customers to your actual customers who then see a checkout that only lets them set the billing address.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-21T23:46:33.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17387" PostTypeId="2" ParentId="17384" CreationDate="2016-10-22T11:27:11.527" Score="2" Body="&lt;p&gt;This is more of a suggestion than a real answer (assuming the &lt;code&gt;folderId&lt;/code&gt; and filename are correct, what you've got should probably work), but anyway:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd strongly advise against hard coding an Asset into a template like this. By creating a &lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;nofollow&quot;&gt;Global set&lt;/a&gt; with an Assets field, you'll save yourself a lot of (potential) trouble, both short and long term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how your code could look using a Global set called &lt;code&gt;siteSettings&lt;/code&gt;, with an Assets field called &lt;code&gt;noMorePostsImage&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = siteSettings.noMorePostsImage.first() %}&#xA;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 800,&#xA;    height: 600,&#xA;    quality: 75,&#xA;    position: 'center-center'&#xA;} %}&#xA;{% if asset %}&#xA;    &amp;lt;img alt=&quot;No More Posts&quot; class=&quot;img-responsive center-block&quot; src=&quot;{{ asset.getUrl(thumb) }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, the code is (a little bit) simpler than what you currently have, and (more importantly) the chance of something going wrong is much smaller. As a bonus, it'll be much simpler to change the image later on, should the need arise. You'll also avoid future issues if someone e.g. moves or renames the Asset from inside Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your content editor(s) shouldn't be able to change or remove the image, you can simply exclude the Global set from your content editors' user group permissions (assuming you're not running Craft Personal, of course).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-22T11:27:11.527" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17388" PostTypeId="1" CreationDate="2016-10-23T09:24:08.440" Score="1" ViewCount="48" Body="&lt;p&gt;I have a venue search tool which has two categories - event type and event size. How do I create an entries loop that returns entries that have both categories assigned?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2016-10-23T09:24:08.440" Title="Simple search using two categories" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17389" PostTypeId="2" ParentId="17388" CreationDate="2016-10-23T09:24:08.440" Score="3" Body="&lt;p&gt;Use the &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow&quot;&gt;relatedTo&lt;/a&gt; method and pass an array using the &lt;code&gt;and&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set venueEventType = craft.request.getParam('catVenueEventType') %}&#xA; {% set venueEventSize = craft.request.getParam('catVenueEventSize') %}&#xA;&#xA; {% set entries = craft.entries.section('venues').relatedTo(['and', venueEventType, venueEventSize]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="100" LastActivityDate="2016-10-23T09:24:08.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17390" PostTypeId="1" CreationDate="2016-10-23T15:50:15.153" Score="0" ViewCount="368" Body="&lt;p&gt;Referring to my older &lt;a href=&quot;https://craftcms.stackexchange.com/q/17251/5730&quot;&gt;question&lt;/a&gt;, I have the entryId working on an &lt;strong&gt;existing&lt;/strong&gt; entry. However I've noticed a new entry doesn't have an entryId set (makes sense).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some custom information in text fields that needs to be saved after onSaveEntry is fired (which I have working). I have a custom model, record, controller and service setup. In my controller I retrieve these custom text fields including the entryId field from Craft. But because a new entry doesn't have an entryId set yet, my controller/service is not working as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the entry is saved and the page redirects to wherever, I also lose all the information in the text fields. So that's why I want to save my custom information directly after the entry is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how do I handle this when I don't have the entry id. I don't want the user saving the entry first (to basically generate the entry id), then fill in the custom text fields and then save again (which works). But I think this is very devious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveRecord() {&#xA;   $this-&amp;gt;requirePostRequest();&#xA;&#xA;   if ($id = craft()-&amp;gt;request-&amp;gt;getPost('recordId')) {&#xA;          $model = craft()-&amp;gt;plugin-&amp;gt;getRecordById($id);&#xA;     } else {&#xA;        $model = craft()-&amp;gt;plugin-&amp;gt;newRecord($id);&#xA;   }&#xA;&#xA;   $model-&amp;gt;entryId = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;   $model-&amp;gt;customField = craft()-&amp;gt;request-&amp;gt;getPost('customField ');&#xA;&#xA;   if ($model-&amp;gt;validate()) {&#xA;       craft()-&amp;gt;plugin-&amp;gt;saveRecord($model);&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveRecord(PluginModel &amp;amp;$model)&#xA;{&#xA;    if ($id = $model-&amp;gt;getAttribute('id')) {&#xA;        $pluginRecord = PluginRecord::model()-&amp;gt;findById($id);&#xA;&#xA;        if (!$pluginRecord) {&#xA;            throw new Exception(Craft::t('Can\'t find record with ID &quot;{id}&quot;', array('id' =&amp;gt; $id)));&#xA;        }&#xA;    } else {&#xA;        $pluginRecord = new PluginRecord();&#xA;    }&#xA;&#xA;    if ($model-&amp;gt;validate()) {&#xA;        $attributes = array(&#xA;            'entryId' =&amp;gt; $model-&amp;gt;entryId,&#xA;            'customField' =&amp;gt; $model-&amp;gt;customField,&#xA;        );&#xA;&#xA;        foreach ($attributes as $k =&amp;gt; $v) {&#xA;            $pluginRecord -&amp;gt;setAttribute($k, $v);&#xA;        }&#xA;&#xA;        if ($pluginRecord -&amp;gt;save()) {&#xA;            // update id on model (for new records)&#xA;            $model-&amp;gt;setAttribute('id', $pluginRecord-&amp;gt;getAttribute('id'));&#xA;            return true;&#xA;        } else {&#xA;            $model-&amp;gt;addErrors($pluginRecord-&amp;gt;getErrors());&#xA;            return false;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rest of the plugin can be found here for reference: &lt;a href=&quot;https://github.com/iNalgiev/webtexttool1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/iNalgiev/webtexttool1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5730" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-11-27T07:20:43.057" Title="How to handle entry save in plugin when entryId is not set?" Tags="&lt;controller&gt;&lt;services&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17391" PostTypeId="1" AcceptedAnswerId="17394" CreationDate="2016-10-23T16:56:05.357" Score="1" ViewCount="255" Body="&lt;p&gt;I'm trying to write a plugin that lives in the admin interface, that reads external data (a cinema program), parses it, and creates entries based on this (movie info and screening times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While doing so I build a log of the additions/updates made, that I want to return to the template (the plugin page from where I trigger the update) and display the changes listed in a table. But I have trouble reading anything out with &lt;code&gt;craft.request.getPost()&lt;/code&gt; from the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log, basically an array of custom models (log items), seems to be fine while still in the controller. I try to pass this array via &lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables()&lt;/code&gt;, but at the template, it seems the only variables it finds are the &lt;code&gt;action&lt;/code&gt; and &lt;code&gt;redirect&lt;/code&gt; parameters from the original form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in the controller looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$log = craft()-&amp;gt;updateProgram_program-&amp;gt;update();&#xA;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;   'log' =&amp;gt; $log&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I try to read the &lt;code&gt;log&lt;/code&gt; variable in my template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set log = craft.request.getPost('log') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whatever I do, it seems to always be &lt;code&gt;NULL&lt;/code&gt;. I've also tried to set a simple text string as the value, in case it's not possible to post an array like this, but it's still &lt;code&gt;NULL&lt;/code&gt; when it comes to the template. It seems the &lt;code&gt;log&lt;/code&gt; parameter is simply not found in the &lt;code&gt;POST&lt;/code&gt; request at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything obvious I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've scratched my head all day over this, so any tips are extremely welcome!&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2016-10-23T21:03:14.430" Title="Is it possible to return data/models from controller to template via setRouteVariables?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;models&gt;&lt;post&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17392" PostTypeId="1" AcceptedAnswerId="17393" CreationDate="2016-10-23T19:39:02.693" Score="2" ViewCount="697" Body="&lt;p&gt;I thought this would be easy.  I cut and pasted code that works from the Mijingo Happy Lager tutorial site. But, I keep getting the template error below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('posts').limit(8) as postEntries %}&#xA;&#xA;    {% for post in postEntries %}&#xA;&#xA;        &amp;lt;div class=&quot;element-item {{post.isotope}} box col-md-3 &quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;post-box vertical clearfix&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ post.url }}&quot; class=&quot;image-link arrow-icon dark-overlay&quot;&amp;gt;&amp;lt;img src=&quot;{{ post.postImage.first().getUrl('thumbImage')}}&quot; width=&quot;434&quot; height=&quot;434&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;extra-info&quot;&amp;gt;                                    &#xA;                    &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;{{ post.title}}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;&#xA;                    &amp;lt;p class=&quot;meta small&quot;&amp;gt;{{ post.postDate | date('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{post.url}}&quot; class=&quot;go-to-arrow&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-arrow-circle-o-right fa-2x&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% if paginate.prevUrl %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot; class=&quot;pag-prev-link&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% for page, url in paginate.getPreviousUrls(5) %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;li class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/li&amp;gt;&#xA;&#xA;            {% for page, url in paginate.getNextUrls(5) %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            {% if paginate.nextUrl %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot; class=&quot;pag-next-link&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endpaginate %}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Neither the property &quot;getPreviousUrls&quot; nor one of the methods &quot;getPreviousUrls()&quot;, &quot;getgetPreviousUrls()&quot;/&quot;isgetPreviousUrls()&quot; or &quot;__call()&quot; exist and have public access in class &quot;Craft\PaginateVariable&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I forgetting?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2016-10-23T20:23:53.290" LastActivityDate="2018-07-16T19:42:28.367" Title="How do I get Pagination to Work?" Tags="&lt;templating&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17393" PostTypeId="2" ParentId="17392" CreationDate="2016-10-23T20:31:57.887" Score="1" Body="&lt;p&gt;Not sure about the Mijingo tutorial, but pretty sure you need to change this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('posts').limit(8) as postEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('posts').limit(8) as paginate, postEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, then there is probably a conflict with your using &lt;code&gt;paginate&lt;/code&gt; as a variable inside the &lt;code&gt;{% paginate %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should update it to be something else like the example in the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow&quot;&gt;pagination docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-23T20:31:57.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17394" PostTypeId="2" ParentId="17391" CreationDate="2016-10-23T21:03:14.430" Score="2" Body="&lt;p&gt;I believe you are overwriting the &lt;code&gt;log&lt;/code&gt; variable you are sending back to the template when you set log equal to the response of getPost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can see of your code, when you return variables to your template via &lt;code&gt;setRouteVariables&lt;/code&gt;, you should be providing the variables you define in that array to your template, &lt;em&gt;without&lt;/em&gt; having to take a second step and retrieve them.  So, when your controller returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;   'log' =&amp;gt; $log&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should then be able to access that variable in your template if it exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if log is defined %}&#xA;    {{ dump(log) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;setRouteVariables&lt;/code&gt; adds your variables to Twig's context, which you can see in your template by dumping &lt;code&gt;_context&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(_context) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, a handy way to just see the variables available in the context and not the full models is using the &lt;code&gt;keys&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(_context|keys) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In your case, I believe when your page reloads, your &lt;code&gt;log&lt;/code&gt; variable is available, but then you set it to null when you try to retrieve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Sets log to null, because no post variable exists named `log` #}&#xA;{% set log = craft.request.getPost('log') %}&#xA;&#xA;{% if log is defined %}&#xA;    {{ dump(log) }} {# outputs null #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try outputting the log variable before setting your getPost value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Outputs log if it exists in Twig's context #}&#xA;{% if log is defined %}&#xA;    {{ dump(log) }} {# will probably output your value #}&#xA;{% endif %}&#xA;&#xA;{# Delete this. It just overwrites your existing log variable #}&#xA;{% set log = craft.request.getPost('log') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-23T21:03:14.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17396" PostTypeId="1" AcceptedAnswerId="17399" CreationDate="2016-10-24T09:53:21.067" Score="1" ViewCount="576" Body="&lt;p&gt;I'm building a cinema program, and I'm trying to build entries for movies and shows loading external data via a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting close, but now I've hit a roadblock trying to save the entries. I build an array of the data to set as content that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$movie = [&#xA;  'movieID'       =&amp;gt; (int)$ctx_movie['MOVIE_ID'],&#xA;  'title'         =&amp;gt; $ctx_movie['VERANSTALTUNGSTITEL'],&#xA;  'audioLanguage' =&amp;gt; $ctx_movie['SPRACHVERSION'],&#xA;  'country'       =&amp;gt; $ctx_movie['COUNTRY'],&#xA;  'director'      =&amp;gt; $ctx_movie['DIRECTOR']&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I make an entry model, and try to set the content to the above array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('movies')-&amp;gt;id;&#xA;$entry-&amp;gt;typeId    = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('movies')-&amp;gt;type('movie')-&amp;gt;id;&#xA;$entry-&amp;gt;authorId  = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;$entry-&amp;gt;enabled   = true;&#xA;&#xA;// This doesn't work:&#xA;$entry-&amp;gt;setContentFromPost($movie);&#xA;&#xA;// This seems to work, creating an entry and populating fields:&#xA;// $entry-&amp;gt;setContent($movie);&#xA;&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I keep getting this error for every entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array ( 'title' =&amp;gt; array ( 0 =&amp;gt; 'Name cannot be blank.', ), )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value I set to the &lt;code&gt;'title'&lt;/code&gt; element definitely has a value, and even if I hard code it to be a dummy string, it still fails in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to work when using &lt;code&gt;setContent($movie)&lt;/code&gt; instead of &lt;code&gt;setContentFromPost($movie)&lt;/code&gt;, but from what I've read the latter is the correct (or best practice) way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it has something to do with the extra validation, but I can't for the life of me understand why a simple string like &lt;code&gt;'Dummy title'&lt;/code&gt; fails the same way as my variable. The name &lt;code&gt;setContentFromPost&lt;/code&gt; throws me off a bit, as I'm unsure if it means the data should come via a &lt;code&gt;post&lt;/code&gt; request, but it seems to be fine with my other variables, and from the documentation they seem to be used in the same way, passing an array of values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(On a side note, I got a similar error for a field that is of type dropdown. I guess here I just haven't understood what value to pass to a dropdown fieldType, so if someone has any tips here too, that would also be great, but I assume it may be two different issues.)&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2016-10-24T13:18:35.690" Title="Problem saving new entry populated with setContentFromPost() while setContent() works" Tags="&lt;plugin-development&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17397" PostTypeId="1" AcceptedAnswerId="17398" CreationDate="2016-10-24T11:04:47.940" Score="4" ViewCount="5549" Body="&lt;p&gt;I have a snippet within a template which I want to pass a variable into:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;page.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lightswitchTest = entry.aktivesProjekt('1').find() %}&#xA;&#xA;{% include '_snippets/thingy' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;thingy.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;panel{% if lightswitchTest == null %} notActive{% endif %}&quot;&amp;gt;&#xA;   {# bla bla #}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to add pass in the variable with the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow&quot;&gt;with keyword&lt;/a&gt; but I guess my syntax is wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_snippets/thingy' with lightswitchTest %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If i use the varibale now in the snippet there is just the &lt;em&gt;&lt;code&gt;Array to string conversion&lt;/code&gt;&lt;/em&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-10-24T11:21:56.367" Title="Pass variable into include" Tags="&lt;variable&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17398" PostTypeId="2" ParentId="17397" CreationDate="2016-10-24T11:21:56.367" Score="12" Body="&lt;p&gt;You can leave the &lt;code&gt;with lightswitchTest&lt;/code&gt; part off altogether, and all the variables from the parent template will be available inside the include too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;with&lt;/code&gt; expects an array, where the keys correspond to the variable names and their values, so if you &lt;em&gt;did&lt;/em&gt; want to explicitly pass that in (say as a different variable) you could use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;page.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_snippets/thingy&quot; with { active: lightswitchTest } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;thingy.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;panel{% if not active %} notActive{% endif %}&quot;&amp;gt;&#xA;    {# bla bla #}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-10-24T11:21:56.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17399" PostTypeId="2" ParentId="17396" CreationDate="2016-10-24T12:53:55.010" Score="6" Body="&lt;p&gt;I believe that &lt;code&gt;setContentFromPost&lt;/code&gt; can only be used to set the content of custom fields on an &lt;code&gt;EntryModel&lt;/code&gt;, not standard fields such as &lt;code&gt;title&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you need to use &lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;title&lt;/code&gt; to set the &lt;code&gt;title&lt;/code&gt; on the &lt;code&gt;EntryModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$movie = [&#xA;  'movieID'       =&amp;gt; (int)$ctx_movie['MOVIE_ID'],&#xA;  'audioLanguage' =&amp;gt; $ctx_movie['SPRACHVERSION'],&#xA;  'country'       =&amp;gt; $ctx_movie['COUNTRY'],&#xA;  'director'      =&amp;gt; $ctx_movie['DIRECTOR']&#xA;];&#xA;&#xA;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('movies')-&amp;gt;id;&#xA;$entry-&amp;gt;typeId    = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('movies')-&amp;gt;type('movie')-&amp;gt;id;&#xA;$entry-&amp;gt;authorId  = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;$entry-&amp;gt;enabled   = true;&#xA;&#xA;// Set the title directly on the $entry&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = $ctx_movie['VERANSTALTUNGSTITEL'];&#xA;&#xA;// This should now work:&#xA;$entry-&amp;gt;setContentFromPost($movie);&#xA;&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2016-10-24T13:18:35.690" LastActivityDate="2016-10-24T13:18:35.690" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17401" PostTypeId="2" ParentId="14696" CreationDate="2016-10-24T17:26:13.627" Score="0" Body="&lt;p&gt;Redactor 2 removed a lot of functionality and delegated to plugins, including the functionality you're after. It made Redactor more lightweight but more of a hassle to get functionality back in, especially when using Craft CMS, where a plugin is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin should provide you with the image position functionality:&#xA;&lt;a href=&quot;https://github.com/picdorsey/craft-redactorimageposition&quot; rel=&quot;nofollow&quot;&gt;https://github.com/picdorsey/craft-redactorimageposition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not yet seen a plugin for the image size functionality, although it should be straightforward to create. Good luck!!&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2016-10-24T17:26:13.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17402" PostTypeId="1" AcceptedAnswerId="17403" CreationDate="2016-10-24T17:30:22.823" Score="2" ViewCount="1542" Body="&lt;p&gt;Looking for a way to show Channel entries directly on the sidebar for content editors. So if someone has access to: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DEFAULT STRUCTURE of Sidebar Menu&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entries -&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CHANNELS -&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News Item 1&lt;/li&gt;&#xA;&lt;li&gt;News Item 2&lt;/li&gt;&#xA;&lt;li&gt;News Item 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PREFERRED STRUCTURE of Sidebar Menu&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News Item 1&lt;/li&gt;&#xA;&lt;li&gt;News Item 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In other words, Content Editors don't need to see &quot;Entries&quot; and then &quot;CHANNELS&quot; to get to their section they update. When someone has permissions for a specific Section or Channel, it should be neatly accessible on the left side. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, what is the correct approach to make this happen?&lt;/p&gt;&#xA;" OwnerUserId="5768" LastEditorUserId="22" LastEditDate="2017-05-09T20:54:46.827" LastActivityDate="2017-05-09T20:54:46.827" Title="Customize Admin Sidebar Menu Items?" Tags="&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17403" PostTypeId="2" ParentId="17402" CreationDate="2016-10-24T18:33:19.010" Score="5" Body="&lt;p&gt;Craft does not offer this functionality natively. Luckily there's a few plugins out there that will help your users navigate around a bit easier:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CP Nav&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/engram-design/CPNav&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/engram-design/CPNav&lt;/a&gt; (This should accomplish your need)&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/picdorsey/craft-sidebarenhancer&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/picdorsey/craft-sidebarenhancer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Entries index&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/james1238/EntryTypeSources&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/james1238/EntryTypeSources&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/engram-design/ExpandedSingles&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/engram-design/ExpandedSingles&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2016-10-24T18:33:19.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17404" PostTypeId="1" AcceptedAnswerId="17405" CreationDate="2016-10-24T19:53:11.423" Score="1" ViewCount="233" Body="&lt;p&gt;I want to place my Craft folder above the root.   But, this is for an add-on site that sits within the public_html folder of the main site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the index.php file sits here...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;../public_html/add-onsite-folder/public/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Craft folder sits just above the &lt;code&gt;/public_html&lt;/code&gt; folder of the main site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how - specifically - do I set the &lt;code&gt;$craftPath&lt;/code&gt;?   It's not the default &lt;code&gt;'../craft';&lt;/code&gt; and I have tried numerous variations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not installing locally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-10-24T20:27:23.547" Title="What do I use for the Path to the Craft folder?" Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17405" PostTypeId="2" ParentId="17404" CreationDate="2016-10-24T20:15:11.893" Score="1" Body="&lt;p&gt;You will definitely want to put it above the root even if it's an add-on site, in which case the proper setup would be &lt;code&gt;'../../../../craft'&lt;/code&gt; but this would generate a conflict with the main site craft install since there would be two folders with the same name above &lt;code&gt;/public_html&lt;/code&gt;, so you could rename the add-on site craft folder to &lt;code&gt;craftaddon&lt;/code&gt; and than the path would be &lt;code&gt;'../../../../craftaddon'&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case there's a really good reason for leaving it below the root, you would just use &lt;code&gt;'../../../craft'&lt;/code&gt; but that does come with security risks that are pretty much not worth taking.&lt;/p&gt;&#xA;" OwnerUserId="5707" LastEditorUserId="5707" LastEditDate="2016-10-24T20:27:23.547" LastActivityDate="2016-10-24T20:27:23.547" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17406" PostTypeId="1" AcceptedAnswerId="17408" CreationDate="2016-10-24T20:35:28.487" Score="1" ViewCount="614" Body="&lt;p&gt;I have a page with a featured entry at the top and then remaining entries showing below. On the first &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'articles',&#xA;  limit: 1,&#xA;  search: 'featuredOnHomepage:1'&#xA;}) %}&#xA;{% for entry in entries %}&#xA;  entry print out&#xA;  {% set homeFeature = entry.id %}&#xA;{% endfor}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Later in the template I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set entries = craft.entries({&#xA;        section:        'articles',&#xA;        order:          'postDate',&#xA;        limit:          4&#xA;    }).id('not ' ~ homeFeature) &#xA;    %}&#xA;    {% for entry in entries %}&#xA;      &amp;lt;div class=&quot;summary-box&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;    &#xA;        {% set asset = entry.articleImage.first() %}&#xA;        {% if asset %}&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('summaryImage') }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it is still including the feature id. If I hardcode in the entry id it works fine. I have tried to print the {{ homeFeature }} variable in the second part and I get nothing yet in the first part it prints out the correct ID. I am assuming the variables don't persist through the different loops. Is there a way to make them persist or write the code differently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Further Info&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the solution from Edit 2 and still having an issue. Perhaps a little more info. There is a template _layout as is common. The template I am accessing is called index.html and is the homepage for the site. It includes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends _layout %}&#xA;{% block headercontent %}&#xA;  code that prints out featured article&#xA;{% endblock %}&#xA;{% block content %}&#xA;  code that prints out remainder of articles minus feature&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Trying to implement your Edit 2 solution I tried just declaring the variable in index.html outside of the blocks. That didn't work so I tried declaring it in _layout before the block calls. That also didn't work so then I tried in _layout {% set homeFeature = &quot;foo&quot; %} and in index.html {% set homeFeature = &quot;bar&quot; %} Then I added a print out of the {{ homeFeature }} variable within both blocks. Within the headercontent block i get 13 (the entry's id) and within the content block i get &quot;foo&quot; which I find very odd. Here is the full code minus some html if it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set homeFeature = &quot;foo&quot; %}&#xA; &amp;lt;header&amp;gt;&#xA; some other html&#xA; {% block headercontent %}&#xA; {% endblock %}&#xA; &amp;lt;/header&amp;gt;&#xA; {% block content %}&#xA; {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set homeFeature = &quot;bar&quot; %}&#xA;{% block headercontent %}&#xA;  &amp;lt;div id=&quot;home-featured&quot;&amp;gt;&#xA;    {% set entries = craft.entries({&#xA;      section: 'articles',&#xA;      limit: 1,&#xA;      search: 'featuredOnHomepage:1'&#xA;    }) %}&#xA;    {% for entry in entries %}&#xA;      {% set homeFeature = entry.id %}&#xA;      &amp;lt;h1&amp;gt;The feature id is: {{ homeFeature }}&amp;lt;/h1&amp;gt;&#xA;      &amp;lt;h4&amp;gt;Featured&amp;lt;/h4&amp;gt;&#xA;      &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;/articles/{entry.url}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;      {{ entry.articleSummary }}&#xA;      &amp;lt;p&amp;gt;FILED IN: &#xA;      {% set categories = craft.categories({&#xA;        relatedTo: { sourceElement: entry, field: &quot;typeCategory, mainCategory&quot; },&#xA;        limit:     null&#xA;      }) %}&#xA;      {% for category in categories %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}{% if not loop.last %}, {% endif %}&amp;lt;/a&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;  &amp;lt;main id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;green-block&quot;&amp;gt;&#xA;      &amp;lt;div id=&quot;home-stamp&quot; class=&quot;wrapper&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;/css/gfx/home-map.gif&quot; /&amp;gt;&#xA;        {{ entry.body }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;      {% set entries = craft.entries({&#xA;        section:        'articles',&#xA;        order:          'postDate',&#xA;        limit:          4,&#xA;        id: 'not '~homeFeature&#xA;      }) &#xA;      %}&#xA;      {% for entry in entries %}&#xA;        &amp;lt;h1&amp;gt;The feature id is: {{ homeFeature }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;div class=&quot;summary-box&quot;&amp;gt;&#xA;          &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;  &#xA;          {% set asset = entry.articleImage.first() %}&#xA;          {% if asset %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('summaryImage') }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;          {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endfor %} &#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/main&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5478" LastEditorUserId="5478" LastEditDate="2016-10-24T21:31:03.050" LastActivityDate="2016-10-24T23:12:42.453" Title="Test a variable in a set entries tag" Tags="&lt;variable&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17407" PostTypeId="1" CreationDate="2016-10-24T20:44:48.327" Score="3" ViewCount="529" Body="&lt;p&gt;I'm having a pretty consistent issue with the user activation links sent out in the registration emails. Having a hard time diagnosing because I can't replicate it myself, but getting several users a day contacting saying their link doesn't work. In the logs I see this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2016/10/24 16:03:59 [warning] [application] The verification code (7TU6Z3adW6CXBmPjmgYqpJI9BeNi3cLN) given for userId: 44253 does not match the hash in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the validationKey set in the config file and not sure if that may affect it(such as invalid characters in it), or maybe something is causing the verification code to include incorrect characters in the URL that is causing it to be truncated or read incorrectly when decoding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The users email the end client directly, so often by the time they send me the info along, they've already manually activated them so I can't further troubleshoot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5479" LastActivityDate="2016-10-26T08:20:26.880" Title="Problem with user activation links" Tags="&lt;emails&gt;&lt;registration&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17408" PostTypeId="2" ParentId="17406" CreationDate="2016-10-24T20:45:36.877" Score="3" Body="&lt;p&gt;A quick fix would be to set homeFeature outside the for loop and than the one inside the loop would change the one outside, you could than access it from other parts of your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homeFeature = &quot;&quot; %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'articles',&#xA;    limit: 1,&#xA;    search: 'featuredOnHomepage:1'&#xA;}) %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% set homeFeature = entry.id %}&#xA;{% endfor}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; here it is at the twig docs - &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/tags/set.html&lt;/a&gt; - &quot;Note that loops are scoped in Twig; therefore a variable declared inside a for loop is not accessible outside the loop itself. ... If you want to access the variable, just declare it before the loop&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2 :&lt;/strong&gt; For the id part you just need to make sure that the homeFeature is declared outside any block scope. after that you could use this later in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section:        'articles',&#xA;    order:          'postDate',&#xA;    limit:          4,        &#xA;    id:             'not '~homeFeature&#xA;}) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 3:&lt;/strong&gt; Given the extra information, it seems that you are over complicating the task, and scopes can get tricky. So this is what i would do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&#xA;&lt;em&gt;set the featured article globally, why not?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homeFeature = craft.entries({ &#xA;    section: 'articles', &#xA;    limit: 1,&#xA;    featuredOnHomepage: '1'&#xA;    })|first %}        &#xA;&amp;lt;header&amp;gt;&#xA;    some other html&#xA;    {% block headercontent %}&#xA;    {% endblock %}&#xA;&amp;lt;/header&amp;gt;&#xA;{% block content %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block headercontent %}&#xA;    &amp;lt;div id=&quot;home-featured&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;The feature id is: {{ homeFeature.id }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;h4&amp;gt;Featured&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;/articles/{entry.url}&quot;&amp;gt;{{ homeFeature.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;        {{ homeFeature.articleSummary }}&#xA;        &amp;lt;p&amp;gt;FILED IN: &#xA;        {% set categories = craft.categories({&#xA;            relatedTo: { sourceElement: homeFeature, field: &quot;typeCategory, mainCategory&quot; },&#xA;            limit:     null&#xA;        }) %}&#xA;        {% for category in categories %}&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}{% if not loop.last %}, {% endif %}&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;&amp;lt;main id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;green-block&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;home-stamp&quot; class=&quot;wrapper&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;/css/gfx/home-map.gif&quot; /&amp;gt;&#xA;        {{ entry.body }}&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    {% set entries = craft.entries({&#xA;        section:        'articles',&#xA;        order:          'postDate',&#xA;        limit:          4,&#xA;        id: 'not '~homeFeature.id&#xA;    }) &#xA;    %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;h1&amp;gt;The feature id is: {{ entry.id }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;div class=&quot;summary-box&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;  &#xA;        {% set asset = entry.articleImage.first() %}&#xA;        {% if asset %}&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.getUrl('summaryImage') }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %} &#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/main&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5707" LastEditorUserId="5707" LastEditDate="2016-10-24T23:11:48.953" LastActivityDate="2016-10-24T23:11:48.953" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17409" PostTypeId="2" ParentId="17406" CreationDate="2016-10-24T20:45:52.423" Score="3" Body="&lt;p&gt;You're dealing with scope issues – both related to &lt;code&gt;for&lt;/code&gt; loops and in regards to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/extends.html&quot; rel=&quot;nofollow&quot;&gt;extending templates&lt;/a&gt; (blocks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, any variable set &lt;em&gt;inside&lt;/em&gt; a &lt;code&gt;for&lt;/code&gt; loop will not be available outside that loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to declare the variable outside the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homeFeature = null %}&#xA;{% for entry in entries %}&#xA;    {% set homeFeature = entry.id %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;p&amp;gt;The home feature's ID is {{ homeFeature }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;{% block %}&lt;/code&gt; tags, the same applies – any variable set inside a block is &lt;em&gt;not&lt;/em&gt; available outside that block. Much like with &lt;code&gt;for&lt;/code&gt; loops, you can declare a variable outside a block, and it will be available inside the block. &lt;em&gt;However&lt;/em&gt;, unlike with &lt;code&gt;for&lt;/code&gt; loops if you change the value of that variable inside a block, &lt;a href=&quot;https://github.com/twigphp/Twig/issues/1302&quot; rel=&quot;nofollow&quot;&gt;the updated variable will &lt;em&gt;not&lt;/em&gt; be available to other blocks&lt;/a&gt; in the same template. In other words, this doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set homeFeature = null %}&#xA;&#xA;{% block headerContent %}&#xA;    {% set homeFeature = 'foo' %}&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;    {{ homeFeature }} {# Still a `null` value! #}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are a lot of potential workarounds to your specific issue, though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, since you &lt;em&gt;can&lt;/em&gt; set a variable outside the blocks, something like this would work – simply execute the &lt;code&gt;craft.entries&lt;/code&gt; query for the featured entry outside the blocks, and store the result in a variable that can be accessed inside the blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set homeFeature = craft.entries({&#xA;    section: 'articles',&#xA;    limit: 1,&#xA;    featuredOnHomepage: '1'&#xA;}).first() %}&#xA;&#xA;{% block headercontent %}&#xA;    &amp;lt;div id=&quot;home-featured&quot;&amp;gt;&#xA;        {% if homeFeature %}&amp;lt;h1&amp;gt;The feature id is: {{ homeFeature.id }}&amp;lt;/h1&amp;gt;{% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;    {% set entries = craft.entries({&#xA;        section:        'articles',&#xA;        order:          'postDate',&#xA;        limit:          4,&#xA;        id: homeFeature ? 'not '~homeFeature.id : null&#xA;    }) %}&#xA;    ...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The drawback with the above, is that it's going to be difficult to &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; the &lt;code&gt;craft.entries&lt;/code&gt; query outside the blocks. For a single, basic query this probably doesn't matter much in the scheme of things, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is to simply query for the &lt;code&gt;homeFeature&lt;/code&gt; entry inside each &lt;code&gt;{% block %}&lt;/code&gt;. You can even make things a bit more DRY by storing the actual query parameters in a variable outside the blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;&#xA;{% set homeFeatureQuery = {&#xA;    section: 'articles',&#xA;    limit: 1,&#xA;    featuredOnHomepage: '1'&#xA;} %}&#xA;&#xA;{% block headercontent %}&#xA;    &amp;lt;div id=&quot;home-featured&quot;&amp;gt;&#xA;        {% set homeFeature = craft.entries(homeFeatureQuery).first() %}&#xA;        {% if homeFeature %}&amp;lt;h1&amp;gt;The feature id is: {{ homeFeature.id }}&amp;lt;/h1&amp;gt;{% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;    {% set homeFeature = craft.entries(homeFeatureQuery).first() %}&#xA;    {% set entries = craft.entries({&#xA;        section:        'articles',&#xA;        order:          'postDate',&#xA;        limit:          4,&#xA;        id: homeFeature ? 'not '~homeFeature.id : null&#xA;    }) %}&#xA;    ...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, the drawback with this approach is that you need to do two separate queries – but at least everything can be cached.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-24T23:12:42.453" LastActivityDate="2016-10-24T23:12:42.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17410" PostTypeId="1" CreationDate="2016-10-25T03:00:14.750" Score="2" ViewCount="222" Body="&lt;p&gt;I'm trying to set a title for a STRUCTURE entry dynamically based on the structure level within the section hierarchy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level('not 1') %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried using the above for the title format of my entry type but it only appears to work for setting YYYY for the parent entry and doesn't add the month for child entries.&lt;/p&gt;&#xA;" OwnerUserId="2197" LastActivityDate="2016-10-25T06:56:19.153" Title="Setting structure section entry titles dynamically based on the entry level" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17411" PostTypeId="2" ParentId="17410" CreationDate="2016-10-25T06:56:19.153" Score="2" Body="&lt;p&gt;I resolved the issue by using the following code for my title format&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.parent %}{ postDate|date('M') }{% else %}{ postDate|date('Y') }{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2197" LastActivityDate="2016-10-25T06:56:19.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17412" PostTypeId="1" AcceptedAnswerId="17413" CreationDate="2016-10-25T07:18:12.380" Score="1" ViewCount="247" Body="&lt;p&gt;I want to get all the categories in a specific category group inside my controller. How do you do that?&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2016-10-25T07:33:03.573" Title="How do you get all the categories in a category group in a controller?" Tags="&lt;categories&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17413" PostTypeId="2" ParentId="17412" CreationDate="2016-10-25T07:33:03.573" Score="3" Body="&lt;p&gt;I found the answer. This might help others:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categories = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category)-&amp;gt;group('handle');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2016-10-25T07:33:03.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17414" PostTypeId="1" AcceptedAnswerId="28321" CreationDate="2016-10-25T08:37:50.877" Score="3" ViewCount="1008" Body="&lt;p&gt;I am trying to create a form that anyone can submit regardless if they are logged in or not. I found the Pixel &amp;amp; Tonic &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow&quot;&gt;Guest Entries&lt;/a&gt; plugin for this.&#xA;Now that I've installed and configured the plugin updating entries doesn't work. Whenever I want to update an entry a new one is created instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; id=&quot;loginForm&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}    &#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;88&quot;&amp;gt;        &#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;entryform?hash={{ hash }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;text-naamSite&quot;&amp;gt;Wat is de naam van uw organisatie/onderneming?&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;text-naamSite&quot; name=&quot;fields[naamSite]&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;reset&quot; style=&quot;float:left;&quot;&amp;gt;Reset&amp;lt;/button&amp;gt;&#xA;&#xA;    &amp;lt;button id=&quot;send-btn&quot; type=&quot;submit&quot;&amp;gt;Opslaan&amp;lt;/button&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="57" LastEditDate="2016-10-25T18:03:31.263" LastActivityDate="2019-06-20T17:12:11.363" Title="Update form entry using the Guest Entries plugin" Tags="&lt;form&gt;&lt;saveentry&gt;&lt;plugin-guestentries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17415" PostTypeId="2" ParentId="17414" CreationDate="2016-10-25T10:17:33.763" Score="4" Body="&lt;p&gt;I've figured it out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to GuestEntriesController.php and add this line of code on the 182nd line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;id = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then add an hidden input field with the id you wish to edit like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2016-10-25T10:17:33.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17416" PostTypeId="1" CreationDate="2016-10-25T14:58:05.597" Score="0" ViewCount="106" Body="&lt;p&gt;I'm looking for a plugin like ContactForm from P&amp;amp;T but with more options like validation for custom fields or the possibility to build a own mail template for the mail at his self.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to handle all with the same plugin if this is possible.&lt;/p&gt;&#xA;" OwnerUserId="5577" LastActivityDate="2016-10-26T10:18:45.320" Title="Form Plugin for Craft CMS" Tags="&lt;templating&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17417" PostTypeId="1" AcceptedAnswerId="20718" CreationDate="2016-10-25T15:31:49.400" Score="2" ViewCount="159" Body="&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found a workaround for the problem. It's not really a &lt;em&gt;solution&lt;/em&gt; to the original problem per se, so I didn't want to mark it as an answer, as the solution isn't optimal in my case. I would really LOVE to understand what the problem is, as I guess it can effect both me and others in other cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short recap:&lt;/strong&gt; In a plugin I'm trying to read the content of an &lt;code&gt;entries&lt;/code&gt; field type, add new entries to it, and save it back (adding cinema screenings to a movie entry). For some reason it only adds one item the first time, and none after that, but leaves existing entries intact (no matter how many). I've tried checking the array both before and after modifying it in every possible way, and it looks correct. Passing an identical array, only hard coded, works perfectly every time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I simply cannot figure out why an array that looks well-formed, and with the correct content, won't be accepted, and without throwing errors of any kind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Temporary workaround:&lt;/strong&gt; Building a new array with the movie ID as key, and an array of shows as value, without ever reading out the existing shows connected to a movie. When looping through this array and adding the shows to the movie, I'm able to save it, and everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Drawback:&lt;/strong&gt; With this &quot;solution&quot;, I have to overwrite a movie's show listing every single time, regardless of what was there before. Most of the time this is fine, as the &quot;master data&quot; usually is the external data I'm loading from the ticketing system. However, I would like to add shows manually in Craft at times (for instance free shows, or shows that are not sold through the ticketing system). These will now be overwritten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a hack I've considered to make these extra shows as a different entry type, but that means I also need a second entry field (as the first one will always be overwritten), and then merge the contents of the two in my template to build a program. This doesn't seem like a good solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL POST:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a problem that's doing my head in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building a cinema program with entries for films and shows (screenings), read from external data via a custom plugin. So far, so good, I am able to create entries for both types (also with help from you guys – thanks!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each movie has an &lt;code&gt;Entries&lt;/code&gt; field type with the handle &lt;code&gt;shows&lt;/code&gt; that links to the shows that each represents a screening for that movie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to retrieve the shows that are currently listed for a specific movie, and I manage with test data to save new shows to a movie, but something weird goes wrong when trying to tie it all together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I do it now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get the movie for the show we try to add from array of all movies&#xA;$movieEntry = $movies[$showEntry-&amp;gt;movieID];&#xA;&#xA;// Get the currently listed shows from the movie&#xA;$movieEntryShows = $movieEntry-&amp;gt;shows-&amp;gt;ids();&#xA;// Add show if not already there&#xA;if ( !in_array( $showEntry-&amp;gt;id, $movieEntryShows ) ) {&#xA;  array_push( $movieEntryShows, $showEntry-&amp;gt;id );&#xA;}&#xA;&#xA;// Set updated list of shows back to the movie&#xA;$movieEntry-&amp;gt;setContentFromPost(['shows' =&amp;gt; $movieEntryShows]);&#xA;&#xA;// Save movie&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($movieEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is that when I run this the first time, every movie seem to get exactly &lt;em&gt;one&lt;/em&gt; show added (and neither the first nor the last, although the data is loaded chronologically). Consecutive updates makes no change or addition. And no error is thrown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've debugged the &lt;code&gt;$movieEntryShows&lt;/code&gt; to check that it's actually an array, and that the values are updated and correct. They are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried taking the data and setting it manually to a test array, and saving that instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$test = ['1288', '1299', '1291'];&#xA;$movieEntry-&amp;gt;setContentFromPost(['shows' =&amp;gt; $test]);&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($movieEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This, for some reason, works like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried every test I can think of to understand why the &lt;code&gt;$test&lt;/code&gt; array works, but the &lt;code&gt;$movieEntryShows&lt;/code&gt; does not. I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tested the types of both, and they are both &lt;code&gt;arrays&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Tested the types of all values in both arrays, and they are the same&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;var_dump()&lt;/code&gt;-ed and &lt;code&gt;print_r()&lt;/code&gt;-ed the arrays to check that they look the same (they do)&lt;/li&gt;&#xA;&lt;li&gt;Checked that there is no index vs. &lt;code&gt;key=&amp;gt;value&lt;/code&gt; mismatch (there isn't)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;array_diff()&lt;/code&gt;-ed the arrays before and after adding elements, and behaves as expected&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Basically, I can't for the life of me find any difference between the two arrays on any level. Still, one of them works, and the other doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've even tried, for one specific film, to only update for one specific screening, in case there was a problem that Craft was still in the process of saving the entry from the last loop through (for other movies, it tried to add all as normal). But this doesn't seem to be the case (can't guarantee 100%, though). Also, when I've use my test array, it can add 8 shows to all movies without a hitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyone having any idea whatsoever why it won't accept this one specific array as a parameter, although it looks to be fine?&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="5771" LastEditDate="2016-10-25T23:15:10.193" LastActivityDate="2017-06-06T08:46:51.877" Title="Entries field won't save/update from plugin, although data seems to be correct" Tags="&lt;plugin-development&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17418" PostTypeId="2" ParentId="17208" CreationDate="2016-10-25T15:59:54.993" Score="2" Body="&lt;p&gt;Figured out the issue. I had one character off in my MySQL database name versus what I was telling craft it was called in the db.php file which is why it was failing to access it. User error prevails again!&lt;/p&gt;&#xA;" OwnerUserId="5553" LastActivityDate="2016-10-25T15:59:54.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17419" PostTypeId="1" AcceptedAnswerId="17422" CreationDate="2016-10-25T16:11:47.383" Score="1" ViewCount="391" Body="&lt;p&gt;New Craft user here and I am working on wrapping up my first Craft site and am running into a Live Preview error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Live Preview is activated in either Firefox or Safari, I just get a blank white page and am getting this error thrown in the console:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;XMLHttpRequest cannot load &lt;a href=&quot;http://mysite.com/section/slug&quot; rel=&quot;nofollow&quot;&gt;http://mysite.com/section/slug&lt;/a&gt;. Cross-origin redirection denied by Cross-Origin Resource Sharing policy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure what that is other than it sounds like I need to give something access that doesn't have it.   And I'm not sure why this error doesn't get thrown in for Chrome or IE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5553" LastEditorUserId="57" LastEditDate="2016-10-25T18:06:32.043" LastActivityDate="2016-10-25T18:27:46.230" Title="Live Preview failing in Safari and Firefox only" Tags="&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17420" PostTypeId="2" ParentId="17419" CreationDate="2016-10-25T17:43:52.037" Score="3" Body="&lt;p&gt;CORS (or Cross-Origin Resource Sharing) issues usually occur when you are attempting to load a resource such as a font, a stylesheet, or a script from a remote location that does not give your domain explicit permission to access it. Thinking the resource is unsafe, your browser will block it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these pages attempting to load any resources from remote locations such as a CDN or web storage like an S3 bucket? If so, you may need to edit your CORS policy for those services to mark your resources as &quot;safe&quot; for your domain.&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-10-25T17:43:52.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17421" PostTypeId="2" ParentId="17416" CreationDate="2016-10-25T18:01:10.363" Score="3" Body="&lt;p&gt;You can find most plugins for Craft here: &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow&quot;&gt;https://straightupcraft.com/craft-plugins&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a few different form plugins to choose from, not sure if all of them will have what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow&quot;&gt;Sprout Forms&lt;/a&gt; a few times and you should be able to do both of what you're asking for.&lt;/p&gt;&#xA;" OwnerUserId="44" LastActivityDate="2016-10-25T18:01:10.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17422" PostTypeId="2" ParentId="17419" CreationDate="2016-10-25T18:27:46.230" Score="3" Body="&lt;p&gt;Ok, so after going through the logs in craft/storage/runtime I found the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using environment variables for my sites url and had it set to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;mysite.com&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However when going to the site using Safari or Firefox it was tacking on the www subdomain so I was actually at www.mysite.com.  I guess according to that CORS thing the subdomain of www didn't have permission to access anything, only the origin of mysite.com did.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went ahead and changed my environment variables to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;www.mysite.com&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and then created a redirect in my .htaccess file to always point to the www subdomain. I don't know if this is the proper fix but it works! I'm sure theres a way to tell the CORS thing that the www subdomain is an ok guy and can have permission.  I just don't know how.&lt;/p&gt;&#xA;" OwnerUserId="5553" LastActivityDate="2016-10-25T18:27:46.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17423" PostTypeId="1" AcceptedAnswerId="17440" CreationDate="2016-10-25T18:31:57.147" Score="0" ViewCount="784" Body="&lt;p&gt;I used to connect to my database over SSL by directly modifying the createDbConnection method in Craft's AppBehavior.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dbConnection = new DbConnection();&#xA;&#xA;$dbConnection-&amp;gt;connectionString = $this-&amp;gt;_processConnectionString();&#xA;$dbConnection-&amp;gt;emulatePrepare   = true;&#xA;$dbConnection-&amp;gt;username         = craft()-&amp;gt;config-&amp;gt;get('user', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;password         = craft()-&amp;gt;config-&amp;gt;get('password', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;charset          = craft()-&amp;gt;config-&amp;gt;get('charset', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;tablePrefix      = $dbConnection-&amp;gt;getNormalizedTablePrefix();&#xA;$dbConnection-&amp;gt;driverMap        = array('mysql' =&amp;gt; 'Craft\MysqlSchema');&#xA;&#xA;// additional attributes to connect over SSL&#xA;if (getenv('DB_SSL_ENABLED') == 'true') &#xA;{&#xA;    $dbConnection-&amp;gt;attributes   = array(&#xA;        PDO::MYSQL_ATTR_SSL_CIPHER =&amp;gt; 'DHE-RSA-AES256-SHA:AES128-SHA',&#xA;        PDO::MYSQL_ATTR_SSL_CA     =&amp;gt; CRAFT_CONFIG_PATH . 'rds-combined-ca-bundle.pem',&#xA;    );&#xA;}&#xA;&#xA;$dbConnection-&amp;gt;init();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as of a new Craft &lt;a href=&quot;https://craftcms.com/changelog#build2945&quot; rel=&quot;nofollow&quot;&gt;release&lt;/a&gt; there is a native Craft way to do this by setting a new &quot;attributes&quot; key in the database config file. Unfortunately, Craft won't make a connection when I connect using this new method. I get the dreaded &lt;em&gt;Craft can’t connect to the database with the credentials in craft/config/db.php&lt;/em&gt; error. My revised db.php looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = parse_url(getenv(&quot;DATABASE_URL&quot;));&#xA;&#xA;define(SERVER, $url[&quot;host&quot;]);&#xA;define(USER, $url[&quot;user&quot;]);&#xA;define(PASSWORD, $url[&quot;pass&quot;]);&#xA;define(DATABASE, substr($url[&quot;path&quot;], 1));&#xA;&#xA;return array(&#xA;    'server' =&amp;gt; SERVER,&#xA;    'user' =&amp;gt; USER,&#xA;    'password' =&amp;gt; PASSWORD,&#xA;    'database' =&amp;gt; DATABASE,&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;    'attributes' =&amp;gt; array(&#xA;        PDO::MYSQL_ATTR_SSL_CIPHER =&amp;gt; 'DHE-RSA-AES256-SHA:AES128-SHA',&#xA;        PDO::MYSQL_ATTR_SSL_CA     =&amp;gt; CRAFT_CONFIG_PATH . 'rds-combined-ca-bundle.pem',&#xA;     )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what could be going wrong here. Are there additional attributes that need to be set when doing this the Yii way?&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-10-26T14:51:13.627" Title="Problems Securing Database Connection Over SSL" Tags="&lt;database&gt;&lt;security&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17425" PostTypeId="1" AcceptedAnswerId="17427" CreationDate="2016-10-26T04:15:27.527" Score="1" ViewCount="216" Body="&lt;p&gt;I am trying to add some logic that can stop an order transaction from happening depending on values stored in the &lt;strong&gt;Order Model&lt;/strong&gt;. Due to how my client wants the purchase page setup, I need to be able to do last-minute validating through the &lt;code&gt;commerce/payments/pay&lt;/code&gt; action, which I can intervene before it happens using the &lt;code&gt;onBeforeGatewayRequestSend&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a simplified version of what I'm trying to do. The issue I am having is accessing the &lt;strong&gt;Order Model&lt;/strong&gt;, It looks like it isn't available in the &lt;code&gt;$event&lt;/code&gt; parameter - which is why the below doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_payments.onBeforeGatewayRequestSend', function($event) {&#xA;&#xA;    // This doesn't work. No 'order' param available.&#xA;    $order = $event-&amp;gt;params['order']; &#xA;&#xA;    /* logic using $order, &#xA;    -- set $is_valid (boolean) */;&#xA;&#xA;    if(!$is_valid) {&#xA;&#xA;       $transaction = $event-&amp;gt;params['transaction'];&#xA;       $transaction-&amp;gt;message = &quot;This order is not yet complete.&quot;;&#xA;       $event-&amp;gt;performAction = false;&#xA;       return $event;&#xA;&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it at all possible to get the order model inside of this hook? Or is this just not the right place to be doing this?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-10-26T08:01:34.247" Title="Commerce Order Model in Gateway Event Plugin Hook" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17426" PostTypeId="2" ParentId="17425" CreationDate="2016-10-26T04:57:23.260" Score="1" Body="&lt;p&gt;You can see what is available for each event in the docs here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_payments.onbeforegatewayrequestsend&quot; rel=&quot;nofollow&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_payments.onbeforegatewayrequestsend&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and indeed order is not one of the parameters.  (I would say it should be really, and you might want to request @lukeholder add this!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However it's very simple to get the current cart (it's a cart at this point, technically, but that's just an &lt;code&gt;OrderModel&lt;/code&gt; that is not set as completed yet). Use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One other note - you don't need to &lt;code&gt;return $event;&lt;/code&gt; as the event is passed in by reference anyway (hence you can set &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt; and that sets it on the original event passed in by reference, not a local copy of the event).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-26T04:57:23.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17427" PostTypeId="2" ParentId="17425" CreationDate="2016-10-26T05:51:00.997" Score="3" Body="&lt;p&gt;You have access to the order from the transaction like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_payments.onBeforeGatewayRequestSend', function($event) {&#xA;&#xA;    $transaction = $event-&amp;gt;params['transaction']; &#xA;    $order = $transaction-&amp;gt;order;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="340" LastEditDate="2016-10-26T08:01:34.247" LastActivityDate="2016-10-26T08:01:34.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17428" PostTypeId="2" ParentId="17407" CreationDate="2016-10-26T08:20:26.880" Score="2" Body="&lt;p&gt;Just to add; we are apparently seeing this issue too. Or to be more clear: we haven't seen it ourselves, but our client keeps getting reports from their customers that Activation links are not working - giving &quot;error messages&quot; when clicked. We've then had the trouble mail forwarded to us, we've clicked the link, and it's been fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like there is some mail client out there mangling the activation links. Which is bad. And we don't know of a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The codes are not expired.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-26T08:20:26.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17429" PostTypeId="1" AcceptedAnswerId="17430" CreationDate="2016-10-26T09:03:04.510" Score="2" ViewCount="256" Body="&lt;p&gt;I'm really struggling with understanding how Craft works at the moment. &#xA;I've been started mid-way on a particular project and I just can't get my head around how Craft works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their documentation seems to assume some knowledge I just don't have and combined with the intermediate-to-expert level of Craft-use in the project I'm on, I just can't figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm failing at even the simplest things. I see fields as 'variables' of an entry, which are then sectioned? &#xA;I'm doing things that work one particular way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.slug('xyz') %}&#xA;{{entries.navigationCaptionTitle}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..but not another:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for block in entries %}&#xA;  {{ block.navigationCaptionTitle }}&#xA;{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..and I think it's down to my basic understanding of how Sections, Entries and Fields work, how Craft manages them and their basic terminology. I'm definitely a visual learner so anything remotely graphical will help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any CMS background, largely just working on html, css and js.&lt;/p&gt;&#xA;" OwnerUserId="5816" LastActivityDate="2016-10-26T11:47:44.417" Title="Is there simpler, less assuming Craft documentation?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sections&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17430" PostTypeId="2" ParentId="17429" CreationDate="2016-10-26T09:50:48.327" Score="5" Body="&lt;p&gt;Best is to create fresh Craft instalation and experiment, learn basics. I did the same thing when I was assigned to a large drupal project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a resource list on Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcookbook.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcookbook.net&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://straightupcraft.com/articles/getting-started-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://straightupcraft.com/articles/getting-started-with-craft-cms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://webdesign.tutsplus.com/courses/building-landing-pages-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://webdesign.tutsplus.com/courses/building-landing-pages-with-craft-cms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms.com/docs/templating/craft.entries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/support&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://straightupcraft.com/events/matrix-entry-types-and-advanced-content-layouts&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://straightupcraft.com/events/matrix-entry-types-and-advanced-content-layouts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&quot;..and I think it's down to my basic understanding of how Sections, Entries and Fields work&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's quite simple really :)&#xA;You attach fields to section - this defines a &quot;template&quot; for your entry/entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Single type section has one entry, Channel &amp;amp; Structure have multiple entries. Also you can create few entry types for Channel &amp;amp; structure (&lt;a href=&quot;https://straightupcraft.com/articles/how-do-i-output-an-assets-field-inside-a-matrix-field-inside-an-entry-type&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/how-do-i-output-an-assets-field-inside-a-matrix-field-inside-an-entry-type&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STRUCTURE SECTION EXAMPLE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create fields&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hsTMp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hsTMp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create section&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aoATo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aoATo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create Entry types (Click Edit Entry types)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Mnmu3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mnmu3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Drag&amp;amp;Drop fields&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c6XZN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c6XZN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8mLXH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8mLXH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create new Entries&#xA;&lt;a href=&quot;https://i.stack.imgur.com/E6o6D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E6o6D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Note: Entry type changes&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xjo3N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xjo3N.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nqI0S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nqI0S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create entry template file (see step 2 for file location). &#xA;File located under (installation folder)/craft/templates/example/_entry.twig&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/msqqx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/msqqx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;6&quot;&gt;&#xA;&lt;li&gt;Result&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N51dY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N51dY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CSrp7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CSrp7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can also pull those two entries from any twig file like this (&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Details&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('example') %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR just first one&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstExample = craft.entries.section('example').first() %}&#xA;&amp;lt;a href=&quot;{{ firstExample.url }}&quot;&amp;gt;{{firstExample.title}}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="480" LastEditDate="2016-10-26T11:47:44.417" LastActivityDate="2016-10-26T11:47:44.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17433" PostTypeId="1" CreationDate="2016-10-26T11:18:21.887" Score="3" ViewCount="385" Body="&lt;p&gt;Unless I'm missing something, it seems like it is impossible to search by ID in the CP (and therefore via ElementCriteriaModel's search).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can make it sortable using &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt;, but it still doesn't make it searchable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried id::&quot;123&quot;, which doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to do this?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-10-26T11:47:58.853" Title="Search by ID in the CP" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17434" PostTypeId="2" ParentId="17433" CreationDate="2016-10-26T11:34:56.447" Score="2" Body="&lt;p&gt;If you analyze POST request you will see this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZrZ3s.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZrZ3s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get items by id you need to create custom request and add criteria[id]=(int id here) e.x. use &lt;a href=&quot;https://coderwall.com/p/-fdgoq/chrome-developer-tools-adds-copy-as-curl&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is most likely related to the way how &lt;code&gt;ElementCriteriaModel&lt;/code&gt; works (99% sure) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;    id: 123, // search by ID*&#xA;    search: 'search query'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#id&quot; rel=&quot;nofollow noreferrer&quot;&gt;search by ID*&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries&lt;/code&gt; returns &lt;code&gt;ElementCriteriaModel&lt;/code&gt; - &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't be able to use default CP search form to get entries by ID&lt;/p&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="5818" LastEditDate="2016-10-26T11:47:58.853" LastActivityDate="2016-10-26T11:47:58.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17437" PostTypeId="1" CreationDate="2016-10-26T12:37:28.583" Score="0" ViewCount="29" Body="&lt;p&gt;I need to add the credit card fee to the order in the CP. I get a response from the gateway with a custom txnfee variable and would like to view it in the CP. Just like an custom adjuster. Does anyone have any experience with that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Order = $100&#xA;Tax = $5&#xA;Credit card fee = $1&#xA;Total = $106&lt;/p&gt;&#xA;" OwnerUserId="5796" LastActivityDate="2016-10-27T00:20:05.890" Title="Credit card fee to the final order in CP" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17438" PostTypeId="1" CreationDate="2016-10-26T12:59:10.333" Score="0" ViewCount="51" Body="&lt;p&gt;Hope this question isn't too vague.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was any documentation or guidance on the database(s) underpinning Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to be working on a website with a fair amount of data and, crucially, the need to pull quite a lot of pieces of data frequently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a version of it here: &lt;a href=&quot;http://unlockinglovelocks.co.uk&quot; rel=&quot;nofollow&quot;&gt;http://unlockinglovelocks.co.uk&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, using the dropdowns, you can navigate to a large picture which is mapped, so that clicking on each padlock will bring up its details. Eventually, my friend who requested the site expects to catalog a large number of these (potentially several large images, each featuring dozens of locks, related to just one site --- multiple sites per area --- multiple areas)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am looking for a setup that won't end up being slow or inefficient. Basically want to understand a bit more about how the data storage with Craft works, so I can try and do it right :p&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any recommended resources would be welcome - I have had a google, and a browse of the Craft docs, without much luck.&lt;/p&gt;&#xA;" OwnerUserId="5727" LastEditorUserId="22" LastEditDate="2017-05-09T20:54:15.327" LastActivityDate="2017-05-09T20:54:15.327" Title="Database documentation / tips / resources" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2016-10-28T18:49:15.383" ContentLicense="CC BY-SA 3.0" />
  <row Id="17439" PostTypeId="1" AcceptedAnswerId="17506" CreationDate="2016-10-26T13:26:58.223" Score="1" ViewCount="271" Body="&lt;p&gt;This has me a bit stumped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two forms - posting to two different actions within the same controller. On error I am attempting to have them both display a flash-notice, as well as pass the model back to my template so that I can display the errors to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works as intended for one of my forms/actions, but not for the other - well, that is, the flash-message works for both, but for the latter form/action &lt;code&gt;model&lt;/code&gt; is undefined in my template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples (I've stripped out some code to not clutter the question):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Working action&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCreateArtist()&#xA;{&#xA;  $this-&amp;gt;requirePostRequest();&#xA;  $request = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;  $model   = new CoverApp_ArtistModel();&#xA;  $model-&amp;gt;setAttributes($request);&#xA;  if ($model-&amp;gt;validate() &amp;amp;&amp;amp; craft()-&amp;gt;coverApp_data-&amp;gt;createArtist($model)) {&#xA;    craft()-&amp;gt;userSession-&amp;gt;setNotice('Artist created.');&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;  }&#xA;  craft()-&amp;gt;userSession-&amp;gt;setError('Unable to create artist');&#xA;  craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array('model' =&amp;gt; $model));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Working form&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; class=&quot;styled-form&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;coverApp/data/createArtist&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;coverapp/record-company/{{ companyId }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Create artist&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{{ model is defined ? 'Yes' : 'No' }}&#xA;{% set error = craft.session.getFlash('error', false, false) %}&#xA;{% if error and model is defined %}&#xA;  &amp;lt;div&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for errorType in model.getErrors() %}&#xA;        {% for error in errorType %}&#xA;          &amp;lt;li&amp;gt;- {{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The example above outputs &quot;Yes&quot; and any errors that happened during validation/save, per-example name already taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Action I am struggling with&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCreateRecordCompany()&#xA;{&#xA;  $this-&amp;gt;requirePostRequest();&#xA;  $request = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;  $model   = new CoverApp_RecordCompanyModel();&#xA;  $model-&amp;gt;setAttributes($request);&#xA;  if ($model-&amp;gt;validate() &amp;amp;&amp;amp; craft()-&amp;gt;coverApp_data-&amp;gt;createRecordCompany($model)) {&#xA;    craft()-&amp;gt;userSession-&amp;gt;setNotice('Record company created.');&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;  }&#xA;  craft()-&amp;gt;userSession-&amp;gt;setError('Unable to create record-company');&#xA;  craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array('model' =&amp;gt; $model));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Form I am struggling with&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; class=&quot;styled-form&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;coverApp/data/createRecordCompany&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;coverapp&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Create record-company&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{{ model is defined ? 'Yes' : 'No' }}&#xA;{% set error = craft.session.getFlash('error', false, false) %}&#xA;{% if error and model is defined %}&#xA;  &amp;lt;div&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for errorType in model.getErrors() %}&#xA;        {% for error in errorType %}&#xA;          &amp;lt;li&amp;gt;- {{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above outputs 'No' and none of the errors that happened during validation/save, per example name already taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To further obfuscate the problem, if I have no errors during validation/save everything works peachy - which at least leads me to believe that my models are fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update 31/10/2016&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;registerCpRoutes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;  return array('coverapp/record-company/create' =&amp;gt; array('action' =&amp;gt; 'coverApp_Rendering/renderCreateRecordCompany'),&#xA;  'coverapp/record-company/(?P&amp;lt;companyId&amp;gt;[\d]+)/createArtist' =&amp;gt; array('action' =&amp;gt; 'coverApp_Rendering/renderCreateArtist'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;rendering-controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRenderCreateRecordCompany()&#xA;{&#xA;  $this-&amp;gt;renderPluginTemplate('coverapp/recordCompanyCreate');&#xA;}&#xA;&#xA;public function actionRenderCreateArtist(array $variables = array())&#xA;{&#xA;  $this-&amp;gt;renderPluginTemplate('coverapp/artistCreate', $variables);&#xA;}&#xA;&#xA;private function renderPluginTemplate($template, $variables = array())&#xA;{&#xA;  $oldMode = craft()-&amp;gt;templates-&amp;gt;getTemplateMode();&#xA;  craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;  if (!$templatePath = craft()-&amp;gt;templates-&amp;gt;findTemplate($template)) {&#xA;    throw new Exception(Craft::t('Could not find template with path: ' . $template));&#xA;  }&#xA;  else {&#xA;    $templateContent   = file_get_contents($templatePath);&#xA;    $templateExtension = IOHelper::getExtension($templatePath, 'html');&#xA;  }&#xA;  craft()-&amp;gt;templates-&amp;gt;setTemplateMode($oldMode);&#xA;  if ($output = craft()-&amp;gt;templates-&amp;gt;renderString($templateContent, $variables)) {&#xA;    if (!HeaderHelper::isHeaderSet('Content-Type')) {&#xA;      HeaderHelper::setContentTypeByExtension($templateExtension);&#xA;    }&#xA;    HeaderHelper::setHeader(array('charset' =&amp;gt; 'utf-8'));&#xA;    if (in_array(HeaderHelper::getMimeType(), array('text/html', 'application/xhtml+xml'))) {&#xA;      $headHtml = craft()-&amp;gt;templates-&amp;gt;getHeadHtml();&#xA;      $footHtml = craft()-&amp;gt;templates-&amp;gt;getFootHtml();&#xA;      if ($headHtml) {&#xA;        if (($endHeadPos = mb_stripos($output, '&amp;lt;/head&amp;gt;')) !== FALSE) {&#xA;          $output = mb_substr($output, 0, $endHeadPos) . $headHtml . mb_substr($output, $endHeadPos);&#xA;        }&#xA;        else {&#xA;          $output .= $headHtml;&#xA;        }&#xA;      }&#xA;      if ($footHtml) {&#xA;        if (($endBodyPos = mb_stripos($output, '&amp;lt;/body&amp;gt;')) !== FALSE) {&#xA;          $output = mb_substr($output, 0, $endBodyPos) . $footHtml . mb_substr($output, $endBodyPos);&#xA;        }&#xA;        else {&#xA;          $output .= $footHtml;&#xA;        }&#xA;      }&#xA;    }&#xA;    ob_start();&#xA;      echo $output;&#xA;      craft()-&amp;gt;end();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4465" LastEditDate="2016-10-31T09:36:22.563" LastActivityDate="2016-10-31T12:12:27.153" Title="Trouble passing errors back to form through setRouteVariables" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;controller&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17440" PostTypeId="2" ParentId="17423" CreationDate="2016-10-26T14:51:13.627" Score="0" Body="&lt;p&gt;Silly mistake. I forgot to update AppBehaviors.php to the newest release after moving the attributes logic to db.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dbConnection = new DbConnection();&#xA;&#xA;$dbConnection-&amp;gt;connectionString = $this-&amp;gt;_processConnectionString();&#xA;$dbConnection-&amp;gt;emulatePrepare   = true;&#xA;$dbConnection-&amp;gt;username         = craft()-&amp;gt;config-&amp;gt;get('user', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;password         = craft()-&amp;gt;config-&amp;gt;get('password', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;charset          = craft()-&amp;gt;config-&amp;gt;get('charset', ConfigFile::Db);&#xA;$dbConnection-&amp;gt;tablePrefix      = $dbConnection-&amp;gt;getNormalizedTablePrefix();&#xA;$dbConnection-&amp;gt;driverMap        = array('mysql' =&amp;gt; 'Craft\MysqlSchema');&#xA;&#xA;// Support for Yii's $initSQLs&#xA;if ($initSQLs = craft()-&amp;gt;config-&amp;gt;get('initSQLs', ConfigFile::Db))&#xA;{&#xA;    $dbConnection-&amp;gt;initSQLs = $initSQLs;&#xA;}&#xA;// See if we have any extra PDO attributes passed in.&#xA;if ($attributes = craft()-&amp;gt;config-&amp;gt;get('attributes', ConfigFile::Db))&#xA;{&#xA;    $dbConnection-&amp;gt;attributes = $attributes;&#xA;}&#xA;&#xA;$dbConnection-&amp;gt;init();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After adding the new lines of code, I was able to connect :)&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-10-26T14:51:13.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17441" PostTypeId="1" AcceptedAnswerId="17443" CreationDate="2016-10-26T15:15:01.793" Score="5" ViewCount="1300" Body="&lt;p&gt;I'm building a site that makes heavy use of the Matrix field, which overall has been great. The one problem I'm running into is that I find myself duplicating a lot of Matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; as an example, you see block types such as heading, pull quote, image, etc. Building out a complex site, I find myself using these common types of blocks in various matrixes(matricies?) and the only way I've found to do so is literally to just type the same thing over and over, which leads to more time and potential inconsistencies, not to mention the maintenance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously I could just define one large matrix field and put it everywhere, but I'd like to have more control than that across different pages. Is there a way to reuse these components or perhaps a different style that is recommended?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/533/is-it-possible-to-share-a-field-between-matrix-blocks?rq=1&quot;&gt;here&lt;/a&gt;, but I'm specifically asking about entire blocks, not individual fields.&lt;/p&gt;&#xA;" OwnerUserId="4115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-10-26T17:47:44.140" Title="Reusable Matrix block types" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17442" PostTypeId="2" ParentId="17441" CreationDate="2016-10-26T15:17:49.887" Score="2" Body="&lt;p&gt;Check out the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/neo&quot; rel=&quot;nofollow&quot;&gt;NEO plugin&lt;/a&gt; which is basically Matrix on steroids.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-10-26T15:17:49.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17443" PostTypeId="2" ParentId="17441" CreationDate="2016-10-26T15:49:32.173" Score="6" Body="&lt;p&gt;A few options to consider:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use one big Matrix Block and a plugin such as &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/pimp-my-matrix&quot;&gt;Pimp My Matrix&lt;/a&gt; to get added control over which blocks display in which channels and various other details.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you find yourself reusing the same Matrix Patterns from site to site, consider a plugin that can help you manage reusable schema such as &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/import&quot;&gt;Sprout Import&lt;/a&gt; or &lt;a href=&quot;https://github.com/Pennebaker/craftcms-thearchitect&quot;&gt;The Architect&lt;/a&gt;, both plugins let you define your schema in a JSON format that you can tweak and import multiple times.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'll add this here as a third option as I think it's relevant for consideration but it probably doesn't address your question about reusing blocks: Consider using a plugin like &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot;&gt;Neo&lt;/a&gt; which takes a Matrix-style approach but let's your blocks use global fields which you can reuse as well as several other features.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-10-26T15:49:32.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17444" PostTypeId="1" AcceptedAnswerId="17451" CreationDate="2016-10-26T19:34:47.180" Score="1" ViewCount="44" Body="&lt;p&gt;We will be creating a website for a large clinical trial. The catch is that this trial will have study sites in many different areas of the world. We want to appeal to use user depending on their demographic. For example, when a user from one of our Thailand sites visits the website, we want them to see photos of Asian study participants (from photos we provide). Is this a possibility? It would sort of be like text translation but with photos instead.&lt;/p&gt;&#xA;" OwnerUserId="5821" LastActivityDate="2016-10-27T09:01:56.210" Title="Photo demographic targeting in Craft?" Tags="&lt;image&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17445" PostTypeId="1" AcceptedAnswerId="17473" CreationDate="2016-10-26T20:18:49.710" Score="0" ViewCount="333" Body="&lt;p&gt;I've got &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;A&amp;amp;M forms&lt;/a&gt; set up and I'm trying to get a assets field to upload files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current form code is below. If I remove the first line then the form works correctly but I can't get a file upload to work without it as I am unable to figure out how to manually code the file upload field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current commented out code for the file was cribbed from a previous ExpressionEngine install and uses some Javascript to allow styling of the field. Everything seems to work here as I can upload a file but due to the internal server error on submit I can't be sure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without line 1 the form works but I can't get file uploads. How do I resolve this?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set form = craft.amForms.getForm('requestQuote') %}&#xA;&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; class=&quot;form-horizontal contact-form&quot;&amp;gt;&#xA;{# This should always be here! #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;&#xA;{# Insert your forms handle. #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;requestQuote&quot;&amp;gt;&#xA;&#xA;{# Optional: Redirect URL. Will redirect to current page by default. #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;contact/thankyou&quot;&amp;gt;&#xA;&#xA;{# Optional: Anti-spam protection. #}&#xA;  {{ craft.amForms.displayAntispam() }}&#xA;&#xA;  {# Optional: Google reCAPTCHA protection. #}&#xA;  {{ craft.amForms.displayRecaptcha() }}&#xA;&#xA;  &amp;lt;fieldset class=&quot;row&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;textinput&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;name&quot; name=&quot;fields[fullName]&quot; type=&quot;text&quot; placeholder=&quot;Name&quot; class=&quot;form-control input-md&quot; required&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;Email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; name=&quot;fields[emailAddress]&quot; type=&quot;email&quot; placeholder=&quot;Email&quot; class=&quot;form-control input-md&quot; required&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;phone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;phone&quot; name=&quot;fields[telephoneNumber]&quot; type=&quot;text&quot; placeholder=&quot;Phone&quot; class=&quot;form-control input-md&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;companyName&quot;&amp;gt;Company Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;company&quot; name=&quot;fields[companyName]&quot; type=&quot;text&quot; placeholder=&quot;Company Name&quot; class=&quot;form-control input-md&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;      &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;budget&quot;&amp;gt;Budget&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select id=&quot;budget&quot; name=&quot;fields[budget]&quot; class=&quot;form-control&quot; required&amp;gt;&#xA;          &amp;lt;option disabled=&quot;&quot; selected&amp;gt;expected budget&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;&amp;lt; $2,500&quot;&amp;gt;&amp;lt; $2,500&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;$2,500-$5,000&quot;&amp;gt;$2,500-$5,000&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;$5,000-$10,000&quot;&amp;gt;$5,000-$10,000&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;$10,000-$15,000&quot;&amp;gt;$10,000-$15,000&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;&amp;gt; $15,000&quot;&amp;gt;&amp;gt;$15,000&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;More Details below&quot;&amp;gt;More Details below&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;I'm not sure&quot;&amp;gt;I'm not sure&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{#&#xA;// commmented out for testing&#xA;// unstyled field added below this commented block&#xA;    &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;      &amp;lt;span id=&quot;changefree&quot;&amp;gt;{{ form.displayField('attachment') }}&amp;lt;/span&amp;gt;&#xA;      &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[attachment][]&quot; id=&quot;fields-attachment&quot; class=&quot;form-control&quot; disabled placeholder=&quot;Upload File&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;input-group-btn&quot;&amp;gt;&#xA;          &amp;lt;button class=&quot;browse btn btn-default extra-pad&quot; type=&quot;button&quot;&amp;gt;&amp;lt;i class=&quot;glyphicon glyphicon-search&quot;&amp;gt;&amp;lt;/i&amp;gt; Browse&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/span&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    #}&#xA;&#xA;    {{ form.displayField('attachment') }}&#xA;&#xA;&#xA;&#xA;    &amp;lt;!-- Textarea --&amp;gt;&#xA;    &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;      &amp;lt;label class=&quot;sr-only control-label&quot; for=&quot;projectDetails&quot;&amp;gt;Project Details and Message&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea class=&quot;form-control&quot; id=&quot;project_details&quot; name=&quot;fields[projectDetails]&quot; placeholder=&quot;Project Details and Message&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;!-- Button --&amp;gt;&#xA;    &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;      &amp;lt;button id=&quot;singlebutton&quot; type=&quot;submit&quot; name=&quot;singlebutton&quot; class=&quot;btn btn-primary&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;/fieldset&amp;gt;&#xA;&#xA;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:22.427" LastActivityDate="2017-11-09T19:38:22.427" Title="A&amp;M forms on submit internal server error" Tags="&lt;form&gt;&lt;error&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17446" PostTypeId="1" CreationDate="2016-10-26T20:56:39.193" Score="0" ViewCount="88" Body="&lt;p&gt;I just uploaded my site to a live server.  My image assets all show a grayed-out broken image icon.  I assume this is because the image assets settings are not set to the correct new path.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, why can I view the image when I select it and the images appear on all pages and posts?  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-10-26T20:56:39.193" Title="Why can I view images assets if the asset link is broken?" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17447" PostTypeId="1" AcceptedAnswerId="17448" CreationDate="2016-10-26T22:03:39.353" Score="3" ViewCount="1708" Body="&lt;p&gt;I am currently using the Standard JSON configuration. My config is below. I cannot get the image button to show up for my Body Field/Rich Text. This is the same configuration I've used on other CraftCMS sites without issue. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;    plugins: ['fullscreen','video'],&#xA;    toolbarFixed: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-02-21T21:30:01.447" Title="Redactor Images Button Missing" Tags="&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17448" PostTypeId="2" ParentId="17447" CreationDate="2016-10-26T22:40:14.680" Score="5" Body="&lt;p&gt;not sure if it matters but in my config I have buttons in quotes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;underline&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;image&quot;,&quot;horizontalrule&quot;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5478" LastActivityDate="2016-10-26T22:40:14.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17449" PostTypeId="2" ParentId="17437" CreationDate="2016-10-27T00:20:05.890" Score="1" Body="&lt;p&gt;I would save the response to an incognito field (or fields) on your order (probably both the entire response and also just the fee separate out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/IncognitoField-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;readonly&lt;/code&gt; incognito field is particularly good for this sort of thing - I use a bunch of these fields in a debug tab on my order layout to save useful things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just create the fields, add the fields to your order, and you update the values with the usual &lt;code&gt;&amp;lt;input name=&quot;fields[fieldName]&quot;&amp;gt;&lt;/code&gt; syntax with any cart operation, or use &lt;code&gt;setContentFromPost&lt;/code&gt; if you're in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $order-&amp;gt;setContentFromPost(array(&#xA;        'fieldName' =&amp;gt; $creditCardFee,&#xA;    ));&#xA;    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-27T00:20:05.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17450" PostTypeId="2" ParentId="17371" CreationDate="2016-10-27T00:21:31.827" Score="1" Body="&lt;p&gt;I would save the response to an incognito field (or fields) on your order (probably both the entire response and also just the fee separate out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft&quot; rel=&quot;nofollow&quot;&gt;https://github.com/mmikkel/IncognitoField-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The readonly incognito field is particularly good for this sort of thing - I use a bunch of these fields in a debug tab on my order layout to save useful things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just create the fields, add the fields to your order, and you update the values with the usual &lt;code&gt;&amp;lt;input name=&quot;fields[fieldName]&quot;&amp;gt;&lt;/code&gt; syntax with any cart operation, or use &lt;code&gt;setContentFromPost&lt;/code&gt; if you're in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $order-&amp;gt;setContentFromPost(array(&#xA;        'fieldName' =&amp;gt; $creditCardFee,&#xA;    ));&#xA;    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-27T00:21:31.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17451" PostTypeId="2" ParentId="17444" CreationDate="2016-10-27T08:08:18.917" Score="2" Body="&lt;p&gt;If I'm understanding you correctly, this is possible using the standard Craft Pro &quot;locale&quot; stuff. In addition to making text translatable, you can make Assets translatable - in which case you can upload a different image for each translated region. The appropriate asset will be used. This assumes you target each region by having a dedicated URL prefix for each (mysite.com/thailand, mysite.com/japan etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-27T08:08:18.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17452" PostTypeId="2" ParentId="17444" CreationDate="2016-10-27T09:01:56.210" Score="2" Body="&lt;p&gt;I've used the Craft Geo Plugin for a project previously and it worked really well. It allowed us to serve specific content to detectable regions and areas, so that sounds like what you're after:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;nofollow&quot;&gt;https://github.com/lukeholder/craft-geo&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2016-10-27T09:01:56.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17453" PostTypeId="1" CreationDate="2016-10-27T09:38:31.593" Score="1" ViewCount="60" Body="&lt;p&gt;Within a frontend Add Product form (using Craft Commerce) I'm having problems with a database error whenever a Users field is left empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teachers = craft.users.group('teachers') %}&#xA;&amp;lt;select name=&quot;fields[teacher][]&quot;&amp;gt;&#xA;&amp;lt;option value=&quot;&quot;&amp;gt;n/a&amp;lt;/option&amp;gt;&#xA;{% for teacher in teachers %}&#xA;  &amp;lt;option value=&quot;{{ teacher.id }}&quot;&amp;gt;{{ teacher.name }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried setting the empty value to zero, but no luck. The forms works fine apart from this, so I don't think it's anything specific to Craft Commerce.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-10-27T11:30:58.480" Title="Frontend form database error with empty Users field" Tags="&lt;users&gt;&lt;form&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17454" PostTypeId="1" AcceptedAnswerId="17461" CreationDate="2016-10-27T10:36:14.007" Score="1" ViewCount="78" Body="&lt;p&gt;Users in my project have a Favourite Entries field. In my plugin I want to check whether a specific Entry is present in that field for that user. I'm passing the Entry ID to look for. I am not interested in getting the Entry itself - I just want to check to see if it's already in the Favourite Entries field or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd hoped that this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if( $user-&amp;gt;favouriteEntriesField-&amp;gt;id($searchingForThisEntryId)-&amp;gt;total() === 0 ) {&#xA;    ... doesn't contain the Entry yet ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't work ( Object of class Craft\ElementCriteriaModel could not be converted to string )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[edit]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A working solution is to loop through everything:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($user-&amp;gt;favouriteEntriesField as $favouriteEntry) {&#xA;    MyPlugin::log(&quot;ID of loop iterations Favourite Entry: $favouriteEntry-&amp;gt;id&quot;, LogLevel::Info);&#xA;&#xA;    if($favouriteEntry-&amp;gt;id === $searchingForThisEntryId) {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('This document is already favourited.'));&#xA;&#xA;        $this-&amp;gt;documentFavourited = &quot;yes&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2016-10-27T11:40:54.613" LastActivityDate="2016-10-27T15:31:00.767" Title="How, in a plugin, can I check that a User's &quot;Favourite Entries&quot; field contains a specific Entry?" Tags="&lt;plugin-development&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17455" PostTypeId="2" ParentId="17453" CreationDate="2016-10-27T10:44:00.983" Score="1" Body="&lt;p&gt;Yep, seen this before. You can't just have an empty value like that because the validation stuff just sees it as a missing field that's required to not be missing. We got around it by adding the n/a value into the field itself in the back end of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which doesn't help you for User Groups unless you want to create an 'n/a' group.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-27T10:44:00.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17456" PostTypeId="1" AcceptedAnswerId="17465" CreationDate="2016-10-27T11:20:21.187" Score="1" ViewCount="165" Body="&lt;p&gt;I'm working on a site that will have lots of content. Our customer now asked to have their images upload into a different subfolder, by date.&#xA;I can get it done in a &quot;normal&quot; Assets field, but in a Matrix I get an error: &lt;code&gt;Could not resolve the subpath “{postDate|date(&quot;d-m-Y&quot;)}”&lt;/code&gt;, with &lt;code&gt;postDate&lt;/code&gt; being the name of the generated folder.&#xA;I did the exact same thing in a &quot;regular&quot; Assets field and that does its job as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="57" LastEditDate="2016-10-27T16:13:28.010" LastActivityDate="2016-10-27T16:13:28.010" Title="Uploading to a date subfolder within a Matrix" Tags="&lt;assets&gt;&lt;upload&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17457" PostTypeId="2" ParentId="17453" CreationDate="2016-10-27T11:30:58.480" Score="2" Body="&lt;p&gt;Figured it out. If you want to return an empty Users field, the field name attribute has to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[teacher]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if you want to return a non-empty Users field, the name attribute is different:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[teacher][]&quot; value=&quot;{user.id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, I'm starting with the first example, and using an onChange event to switch the name attribute depending on whether the value is a valid user ID or not. Here's my final template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teachers = craft.users.group('teachers') %}&#xA;&amp;lt;select class=&quot;ui search dropdown&quot; name=&quot;fields[teacher]&quot; id=&quot;teacherselect&quot;&amp;gt;&#xA;&amp;lt;option value=&quot;nA&quot;&amp;gt;n/a&amp;lt;/option&amp;gt;&#xA;{% for teacher in teachers %}&#xA;  &amp;lt;option value=&quot;{{ teacher.id }}&quot;&amp;gt;{{ teacher.name }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the jquery if anyone wants it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;($(this).val() == &quot;nA&quot;) ? $(this).attr('name', 'fields[teacher]') : $(this).attr('name', 'fields[teacher][]')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-10-27T11:30:58.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17458" PostTypeId="1" AcceptedAnswerId="17466" CreationDate="2016-10-27T12:29:02.737" Score="2" ViewCount="379" Body="&lt;p&gt;I've got a few issues with a site but I'll try to separate in case they're not related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly I keep getting &quot;Failed task - Deleting stale template caches&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked in the logs and some messages include:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Encountered an error running task 3 (DeleteStaleTemplateCaches), step 156 of 166: An exception was thrown: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand::fetchAll() failed: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous. The SQL statement executed was: SELECT &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;sectionId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;typeId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;authorId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;postDate&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;expiryDate&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2016-10-27T16:44:00.943" Title="Failed Task and various errors in logs" Tags="&lt;error-message&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17459" PostTypeId="2" ParentId="17454" CreationDate="2016-10-27T12:40:40.620" Score="3" Body="&lt;p&gt;You can avoid looping by getting an array of the IDs of the favourite entries, then check to see if the specific Entry ID is in the array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$favouriteEntryIds = $user-&amp;gt;favouriteEntriesField-&amp;gt;ids();&#xA;if( in_array($searchingForThisEntryId, $favouriteEntryIds) ) {&#xA;    ... the Entry has already been favourited ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2016-10-27T14:16:13.157" LastActivityDate="2016-10-27T14:16:13.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17460" PostTypeId="1" AcceptedAnswerId="17462" CreationDate="2016-10-27T14:07:00.237" Score="2" ViewCount="1490" Body="&lt;p&gt;I need to access just the ID of a specific section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do that like this and it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set enroll = craft.sections.getSectionByHandle('workshopEnrollments') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for e in enroll %} {{ e.sectionId }} {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for e in enroll %} {{ e.id }} {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impossible to access an attribute (&quot;sectionId&quot;) on a string variable (&quot;32&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I view the variable inside my form what I actually see is exactly this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;32Workshop EnrollmentsworkshopEnrollmentschannel1workshop-enrollments/_entry1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my question is, how can I just display the id.  Both &quot;.id&quot; and &quot;.sectionId&quot; produce the same error mentioned above.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;32&quot; is the id I want so it is the correct return, but this seems to show everything about it in a string and I need just the id. I am using getSectionByHandle because I have no other data to use in this particular view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-10-27T16:45:29.997" LastActivityDate="2016-10-27T16:45:29.997" Title="How do you get a section's ID" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17461" PostTypeId="2" ParentId="17454" CreationDate="2016-10-27T15:25:42.820" Score="1" Body="&lt;p&gt;You can also use &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel#find-detail&quot; rel=&quot;nofollow&quot;&gt;find()&lt;/a&gt; method or better &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel#first-detail&quot; rel=&quot;nofollow&quot;&gt;first()&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;first()&lt;/code&gt; returns &lt;code&gt;EntryModel&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if( $user-&amp;gt;favouriteEntriesField-&amp;gt;first(['id' =&amp;gt; $searchingForThisEntryId]) ) {&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('This document is already favourited.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we take advantage of &lt;a href=&quot;https://craftcms.com/classreference/models/BaseModel#setAttributes-detail&quot; rel=&quot;nofollow&quot;&gt;baseModel's setAttributes() method&lt;/a&gt; that is being used by first() method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; *   @var searchingForThisEntry EntryModel&#xA; */&#xA;&#xA;if( $user-&amp;gt;favouriteEntriesField-&amp;gt;first($searchingForThisEntry) ) {&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('This document is already favourited.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="5818" LastEditDate="2016-10-27T15:31:00.767" LastActivityDate="2016-10-27T15:31:00.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17462" PostTypeId="2" ParentId="17460" CreationDate="2016-10-27T15:35:30.000" Score="5" Body="&lt;p&gt;&lt;code&gt;getSectionByHandle&lt;/code&gt; doesn't return an array, but a single SectionModel - so you need to remove the &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set enroll = craft.sections.getSectionByHandle('workshopEnrollments') %}&#xA;&#xA;{{ enroll.id }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-10-27T15:35:30.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17464" PostTypeId="1" AcceptedAnswerId="17508" CreationDate="2016-10-27T15:52:29.180" Score="1" ViewCount="84" Body="&lt;p&gt;When editing an entry (actually it's a product within Craft Commerce but everything seems the same) with a pre-existing date, the field looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;fields[date][date]&quot; value=&quot;06/12/2016&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when re-saving the entry it won't save if I leave the date the same. I'm not getting any errors. If I change the date and re-save the entry, all is fine. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-10-31T13:35:37.213" LastActivityDate="2016-10-31T15:21:57.620" Title="Entry not saving when date isn't changed using frontend form" Tags="&lt;datetime&gt;&lt;frontend&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17465" PostTypeId="2" ParentId="17456" CreationDate="2016-10-27T16:13:15.757" Score="1" Body="&lt;p&gt;You're probably looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{owner.postDate|date(&quot;d-m-Y&quot;)}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the note about dynamic subfolders on an Assets field inside of Matrix here: &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-27T16:13:15.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17466" PostTypeId="2" ParentId="17458" CreationDate="2016-10-27T16:44:00.943" Score="2" Body="&lt;p&gt;Similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4343/how-to-fix-ambiguous-column-error-generated-when-deletestaletemplatecaches-is&quot;&gt;How to fix &amp;quot;ambiguous&amp;quot; column error generated when DeleteStaleTemplateCaches is run?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But somewhere, in one of your templates that are using the &lt;code&gt;{% cache %}&lt;/code&gt; tag, you're ordering by &lt;code&gt;dateCreated&lt;/code&gt; in your template and it should be &lt;code&gt;elements.dateCreated&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag has already picked up the invalid Twig code and cached it to the database so whenever the DeleteStaleTemplateCaches task tries to run, it trips up on the invalid Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after you fix the original error, you'll want to clear your template caches using the Clear Caches tool under settings in the control panel to purge the invalid cached code as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-27T16:44:00.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17468" PostTypeId="2" ParentId="11982" CreationDate="2016-10-27T17:54:39.327" Score="1" Body="&lt;p&gt;I'm probably late to answer this, but I've recentry encountered same problem and here's the solution I came to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;use params for dropdown fields and search for checkbox fields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my code looks similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderParams = {} %}&#xA;&#xA;{% for key, val in craft.request.query %}&#xA;    {% if val is not empty %}&#xA;        {% if key=='orderFinance' %}&#xA;            {% set orderParams = orderParams|merge({orderFinance:val}) %}&#xA;        {% elseif key=='orderStatus' %}&#xA;            {% set orderParams = orderParams|merge({orderStatus:val}) %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set flagSearchQuery = [] %}&#xA;{% for flag in craft.request.query.orderFlag %}&#xA;    {% if flag is not empty %}&#xA;        {% set flagSearchQuery = flagSearchQuery|merge({query: 'orderFlag:'~flag}) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set orders = craft.commerce.orders(orderParams).search(flagSearchQuery).limit(100) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2016-10-27T17:54:39.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17469" PostTypeId="1" AcceptedAnswerId="17470" CreationDate="2016-10-27T18:20:44.063" Score="1" ViewCount="372" Body="&lt;p&gt;I am trying to have a overview page where I want to loop through all available product categories in separate rows. Somehow I was only able to achieve it when I specify the type of the product. That isn't ideal since I want the customer to be able to add new product types which will be displayed in a new row then. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.type('all').find() %}&#xA;&#xA;{% for 'type #1' in products %}&#xA;    ...&#xA;{% endfor  %}&#xA;&#xA;{% for 'type #2' in products %}&#xA;    ...&#xA;{% endfor  %}&#xA;&#xA;etc..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thanks a lot guys &lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2016-10-27T18:36:03.927" LastActivityDate="2016-10-27T18:48:04.850" Title="How can I loop through all different Product Types in Craft Commerce?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17470" PostTypeId="2" ParentId="17469" CreationDate="2016-10-27T18:48:04.850" Score="3" Body="&lt;p&gt;Hoping this is what you are looking to do?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;&#xA;  {{ productType.name }}&amp;lt;br&amp;gt;&#xA;&#xA;{% for product in craft.commerce.products.type(productType.handle).find() %}&#xA;&#xA;  {{ product.title }}&amp;lt;br&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-10-27T18:48:04.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17471" PostTypeId="1" AcceptedAnswerId="17478" CreationDate="2016-10-27T19:11:48.727" Score="1" ViewCount="691" Body="&lt;p&gt;I am trying to display the Discount Value (%) of Products with the onSale Tag. What works for now is to display only the Products which are onSale. But I can't figure out which value stores the Discount Value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.find() %} {% for product in products %}&#xA;&amp;lt;li class=&quot;list-item&quot;&amp;gt;&#xA;    {% if product.defaultVariant.onSale == true %}&#xA;    &amp;lt;div class=&quot;pin circle&quot;&amp;gt;&#xA;        &amp;lt;h6&amp;gt;Sale!&amp;lt;/h6&amp;gt;&#xA;        &amp;lt;h6 class=&quot;percent&quot;&amp;gt;{{ amount.saleAmount }}/h6&amp;gt;&#xA;        &amp;lt;h6&amp;gt;off&amp;lt;/h6&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/li&gt;&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2016-10-28T00:38:31.270" LastActivityDate="2017-06-08T21:48:41.063" Title="How can I display the Discount Value onSale of Products" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17472" PostTypeId="1" CreationDate="2016-10-27T20:26:13.670" Score="1" ViewCount="109" Body="&lt;p&gt;Is there a way to sort the customer items by item number under commerce customer orders in the control panel?&lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="340" LastEditDate="2016-10-28T00:41:48.047" LastActivityDate="2018-03-28T23:56:02.663" Title="Display Items in customer order in a particular order" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17473" PostTypeId="2" ParentId="17445" CreationDate="2016-10-27T20:49:44.800" Score="3" Body="&lt;p&gt;If you want to upload assets with your form, you will need to include &lt;code&gt;enctype=&quot;multipart/form-data&quot;&lt;/code&gt; in your form tag:&#xA;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; ...&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="549" LastActivityDate="2016-10-27T20:49:44.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17475" PostTypeId="2" ParentId="17471" CreationDate="2016-10-27T23:04:46.893" Score="1" Body="&lt;p&gt;I believe &lt;a href=&quot;https://craftcommerce.com/docs/line-item-model#saleamount&quot; rel=&quot;nofollow&quot;&gt;saleAmount&lt;/a&gt; is what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set amount = product.defaultVariant.saleAmount %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="340" LastEditDate="2016-10-28T00:06:34.630" LastActivityDate="2016-10-28T00:06:34.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17476" PostTypeId="2" ParentId="17472" CreationDate="2016-10-28T00:05:41.033" Score="2" Body="&lt;p&gt;There is no current built-in solution for this.  I suspect they are displayed in the order they were added to the cart most likely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best hope would be something like the cpjs addon and some magic JS to swap the rows, but it would be...non-trivial at best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-cpjs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to put in a feature request here:&#xA;&lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2018-03-28T23:56:02.663" LastActivityDate="2018-03-28T23:56:02.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17477" PostTypeId="1" AcceptedAnswerId="17479" CreationDate="2016-10-28T00:34:34.220" Score="2" ViewCount="1450" Body="&lt;p&gt;I have set up a custom search of entries on a page in my Craft site which includes filters to filter the results.  I would like to be able to export these results (filtered or otherwise) as a CSV through a link on the page:&#xA;&lt;a href=&quot;http://www.joycefdn.org/grants&quot; rel=&quot;nofollow&quot;&gt;http://www.joycefdn.org/grants&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this?&lt;/p&gt;&#xA;" OwnerUserId="5824" LastActivityDate="2016-10-28T06:07:46.853" Title="How do I export search results as a csv?" Tags="&lt;entries&gt;&lt;search&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17478" PostTypeId="2" ParentId="17471" CreationDate="2016-10-28T00:38:15.677" Score="2" Body="&lt;p&gt;I haven't done this myself, but I see two ways to get the percentage:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the &lt;code&gt;product.defaultVariant.saleAmount&lt;/code&gt; and use maths in twig to work out the percentage - that should definitely work.  Twig math is a good general solution if you can't get the numbers you need directly from Commerce. See:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#math&quot; rel=&quot;nofollow&quot;&gt;http://twig.sensiolabs.org/doc/templates.html#math&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think you can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set sales = craft.commerce.getSales() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...to get all your SalesModels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see &lt;code&gt;/craft/plugins/commerce/models/Commerce_SaleModel.php&lt;/code&gt;) as this model is not really documented yet it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd loop through those and get the particular sale you're after (e.g. by &lt;code&gt;id&lt;/code&gt;).  Then, it appears there is code in there to  &lt;code&gt;getDiscountAmountAsPercent&lt;/code&gt; to get what you're after....however while &lt;code&gt;DiscountModel&lt;/code&gt; has an attribute of &lt;code&gt;percentDiscount&lt;/code&gt; on it, SaleModel does not appear to so I don't &lt;em&gt;think&lt;/em&gt; you can get at it directly in your templates currently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I am a bit pushed for time in terms of actually trying it to see.  But Twig maths will do it for sure if you get stuck with a more direct approach!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-28T00:38:15.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17479" PostTypeId="2" ParentId="17477" CreationDate="2016-10-28T06:07:46.853" Score="4" Body="&lt;p&gt;You can just make link to a twig template to output a csv quite simply...just like any other template really, except it won't extend you layout etc. and will simply contain something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%for result in results %}&#xA;    {{var1}},{{var2}},{{var3}} etc...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on what sort of csv you're after and what you're going to do with the data, you may want to consider escaping the data as you output it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/escape.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://twig.sensiolabs.org/doc/filters/escape.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of setting it up as a  link, your csv template could just accept the same search parameters passed through and essentially repeat the search and output the csv results as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. in your original results page you could build the link to the CSV as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/utility/csvmaker?q={{q}}&quot;&amp;gt;Get Results As CSV&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in the csvmaker&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.search(q).order('score') %}&#xA;...etc as above&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But a lot depends on how you've built your search in the first place really.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it to trigger an actual file download, then I've found that's pretty easy to do that on the front end with some JS, e.g. I use this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/19721439/download-json-object-as-a-file-from-browser/20343999&quot;&gt;https://stackoverflow.com/questions/19721439/download-json-object-as-a-file-from-browser/20343999&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-10-28T06:07:46.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17480" PostTypeId="1" CreationDate="2016-10-28T08:33:11.800" Score="1" ViewCount="84" Body="&lt;p&gt;I have made a custom fieldtype.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.textField({&#xA;    label: &quot;business&quot;|t,&#xA;    required: true,&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And added it to the user fields.&#xA;Where do I need to save data entered in at a user profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to hook into the &lt;code&gt;onSaveUser&lt;/code&gt; event with my plugin to save my values into the address model of Craft Commerce, but how would I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="22" LastEditDate="2017-05-09T20:53:09.243" LastActivityDate="2017-05-09T20:53:09.243" Title="Custom Fieldtype in a plugin at user profile save" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17481" PostTypeId="1" AcceptedAnswerId="17482" CreationDate="2016-10-28T09:04:59.007" Score="1" ViewCount="15" Body="&lt;p&gt;With Craft Commerce, I have a custom field that allows you to select which user from a defined group the product belongs to/is associated with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to set the user in order to access additional information about this user (profile info etc) and display this on the relevant product page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2016-10-28T09:28:23.540" Title="Set user based on their attachment to a product" Tags="&lt;users&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17482" PostTypeId="2" ParentId="17481" CreationDate="2016-10-28T09:28:23.540" Score="1" Body="&lt;p&gt;&lt;code&gt;{% set user = product.usersFieldHandle.first() %}&lt;/code&gt; will give you the &lt;code&gt;UserModel&lt;/code&gt; of the first related user.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then e.g. &lt;code&gt;{{ user.fieldHandle }}&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-10-28T09:28:23.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17483" PostTypeId="2" ParentId="17480" CreationDate="2016-10-28T09:36:05.863" Score="3" Body="&lt;p&gt;The best approach is probably to use the &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/BaseElementFieldType#onAfterElementSave-detail&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;onAfterElementSave&lt;/code&gt;&lt;/a&gt; hook available to custom fieldtypes. Here's what that could look like (the following method should go into your custom fieldtype class, e.g. &lt;code&gt;myawesomeplugin/fieldtypes/MyAwesomePluginFieldType.php&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;    $field = $this;&#xA;    $fieldId = $this-&amp;gt;model-&amp;gt;id;&#xA;    $fieldHandle = $this-&amp;gt;model-&amp;gt;handle;&#xA;    $element = $this-&amp;gt;element; // This is the UserModel, in your case&#xA;    $fieldContent = $element-&amp;gt;getContent()-&amp;gt;getAttribute($fieldHandle); // This is the content for the field&#xA;&#xA;    // Do something awesome with the data above&#xA;    ...&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-10-28T09:54:24.270" LastActivityDate="2016-10-28T09:54:24.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17485" PostTypeId="1" AcceptedAnswerId="17488" CreationDate="2016-10-28T14:42:29.090" Score="0" ViewCount="104" Body="&lt;p&gt;Is there a way to add a button to remove the current styles inside of a Rich Text field? I know there are options for customizing the toolbar, but I haven't found anything about removing styles. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3351" LastEditorUserId="57" LastEditDate="2016-10-28T17:15:18.243" LastActivityDate="2016-10-28T18:37:46.543" Title="Strip styles option in Rich Text field?" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17487" PostTypeId="2" ParentId="17438" CreationDate="2016-10-28T17:39:43.867" Score="3" Body="&lt;p&gt;It's difficult to answer this without specifics on what you're looking for and what your plugin is trying to do, but I'd recommend following the &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow&quot;&gt;plugin development docs&lt;/a&gt;, which includes &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow&quot;&gt;working&lt;/a&gt; with &lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow&quot;&gt;databases&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also recommend using somethign like &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow&quot;&gt;https://pluginfactory.io&lt;/a&gt; to generate the plugin boilerplate code for the plugin components you might need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-28T17:39:43.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17488" PostTypeId="2" ParentId="17485" CreationDate="2016-10-28T18:37:46.543" Score="1" Body="&lt;p&gt;Found this that works well. Reverts to p tags or normal text:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://bitbucket.org/kreisvierdigital/redactorremoveformat&quot; rel=&quot;nofollow&quot;&gt;https://bitbucket.org/kreisvierdigital/redactorremoveformat&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2016-10-28T18:37:46.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17489" PostTypeId="1" CreationDate="2016-10-28T19:32:17.483" Score="0" ViewCount="610" Body="&lt;p&gt;I've been trying to get a quick staging environment setup on GoDaddy all day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using &lt;code&gt;die('foo')&lt;/code&gt; I can tell that GoDaddy is able to reach all of my files (&lt;code&gt;public/index.php&lt;/code&gt;, &lt;code&gt;craft/config/db.php&lt;/code&gt; and &lt;code&gt;general.php&lt;/code&gt;). I have created two different databases and users to try to connect to. I am also using the hostname's generated by GoDaddy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even with the correct db information and knowing for a fact that Craft is able to find my &lt;code&gt;db.php&lt;/code&gt; file, when I browser to &lt;code&gt;mydomain.com/index.php?p=admin/install&lt;/code&gt; I'm still receiving the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft can’t connect to the database with the credentials in craft/config/db.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Database Configuration&#xA; *&#xA; * All of your system's database configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/db.php&#xA; */&#xA;&#xA;// die('foo');&#xA;&#xA;return array(&#xA;&#xA;    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;    'server' =&amp;gt; 'dbhost',&#xA;&#xA;    // The name of the database to select.&#xA;    'database' =&amp;gt; 'dbname',&#xA;&#xA;    // The database username to connect with.&#xA;    'user' =&amp;gt; '***',&#xA;&#xA;    // The database password to connect with.&#xA;    'password' =&amp;gt; '***',&#xA;&#xA;    // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="57" LastEditDate="2016-10-28T20:56:36.720" LastActivityDate="2016-10-28T20:56:36.720" Title="How to get GoDaddy to connect to db?" Tags="&lt;database&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17490" PostTypeId="1" AcceptedAnswerId="17513" CreationDate="2016-10-28T19:54:16.023" Score="1" ViewCount="118" Body="&lt;p&gt;Thank you for your time and patience I'm a newbie to the Craft world. I've been all over the Craft Documentation and this site trying to figure out the best approach for a site I am putting together. The prototype I did makes sense however when it came time to put it into Craft I'm hesitant or lacking confidence in the setup. I just need a sound board to bounce off my setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current Section setup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home (Single)&lt;/li&gt;&#xA;&lt;li&gt;Company (Single)&lt;/li&gt;&#xA;&lt;li&gt;Products (Single and Structure with multiple entry types)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product Category A&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type A&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Size A&lt;/li&gt;&#xA;&lt;li&gt;Size B&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Type B&lt;/li&gt;&#xA;&lt;li&gt;Type C&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Product Category B&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Product Category C&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type D&lt;/li&gt;&#xA;&lt;li&gt;Type E&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Support (Single)&lt;/li&gt;&#xA;&lt;li&gt;Contact (Single)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How would I best create a template structure for the products section? How can I setup categories to help create this structure? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL would ideally be&#xA;site.com/products/product-category/product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or do I even need products? Just jump to the product-category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to have a category page, comparison page (Size) and dedicated product page. The category page with the type category wouldn't need an intermediate page.&lt;/p&gt;&#xA;" OwnerUserId="3781" LastActivityDate="2016-10-31T18:31:25.253" Title="Can someone help me with my site structure? Sections/Category setup" Tags="&lt;categories&gt;&lt;structure&gt;&lt;sections&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17491" PostTypeId="1" AcceptedAnswerId="17492" CreationDate="2016-10-28T20:27:51.903" Score="1" ViewCount="246" Body="&lt;p&gt;I'm trying to take advantage of the &lt;code&gt;userSession.onBeforeLogin&lt;/code&gt; event to interrupt the normal Control Panel login (/admin/login) so that I can first authenticate the user against an LDAP server. However, in my testing it seems that Craft runs its own authentication prior to &lt;code&gt;onBeforeLogin&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class AdminAuthPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        craft()-&amp;gt;on('userSession.BeforeLogin', function (Event $event) {&#xA;            if (craft()-&amp;gt;request-&amp;gt;isCpRequest() == true) {&#xA;                $event-&amp;gt;performAction = false;&#xA;                exit();&#xA;            }&#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the above example, attempting to log in with a known username (with correct password) who has access to the CP, &lt;code&gt;UserSessionService&lt;/code&gt; throws an error--which I expect to see due to the &lt;code&gt;exit()&lt;/code&gt;: &quot;An unknown error occurred.&quot; However, if I try to log in with the same username and an invalid password, &lt;code&gt;UserSessionService&lt;/code&gt; throws the standard error, &quot;Invalid username or password&quot;, which indicates that &lt;code&gt;onBeforeLogin&lt;/code&gt; has not been executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct to understand that the &lt;code&gt;userSession.onBeforeLogin&lt;/code&gt; event indeed fires after the default authentication attempt?&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2016-10-28T21:09:23.540" Title="Does normal authentication occur before userSession.onBeforeLogin event?" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17492" PostTypeId="2" ParentId="17491" CreationDate="2016-10-28T21:09:23.540" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L572&quot; rel=&quot;nofollow&quot;&gt;onBeforeLogin event&lt;/a&gt; is fired after the username/password is already authenticated, but before the actual authenticated session is started, which is why you're seeing the behavior you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the same reason that you wouldn't expect the &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; event to be fired before entry validation has occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe to pull off what you're looking for, we'd need to add a new event... something like &lt;code&gt;onBeforeAuthenticateUser&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding as a &lt;a href=&quot;https://feedback.craftcms.com&quot; rel=&quot;nofollow&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-10-28T21:09:23.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17494" PostTypeId="1" AcceptedAnswerId="17496" CreationDate="2016-10-29T01:16:09.527" Score="5" ViewCount="338" Body="&lt;p&gt;Well, I know for a fact I am doing this incorrectly &amp;amp; it's going to be painfully obvious. I can see why (I think) but to be honest I just don’t “get it”.&lt;/p&gt;&#xA;&lt;p&gt;I’m trying to style a Google map using Smart Map &amp;amp; JavaScript, but keep getting the JS error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught ReferenceError: smartMap is not defined(…)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is what my template looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{# Google Map of location. #}&#xA;{% set options = {&#xA;    height: 500,&#xA;    width: '100%',&#xA;    zoom: 15,&#xA;    markerOptions: {&#xA;    },&#xA;    infoWindowOptions: {&#xA;        maxWidth: 200&#xA;    }&#xA;} %}&#xA;&#xA;    &amp;lt;div id=&amp;quot;mapCanvas&amp;quot;&amp;gt;&#xA;        {{ craft.smartMap.map(product.address, options) }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;script src=&amp;quot;/assets/js/app.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Within &lt;code&gt;app.min.js&lt;/code&gt; I am doing this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if ($('#mapCanvas').length) {&#xA;    var styles = [{&#xA;        &amp;quot;featureType&amp;quot;: &amp;quot;all&amp;quot;,&#xA;        &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;        &amp;quot;stylers&amp;quot;: [{&amp;quot;visibility&amp;quot;: &amp;quot;simplified&amp;quot;}, {&amp;quot;hue&amp;quot;: &amp;quot;#ff7700&amp;quot;}]&#xA;    },&#xA;&#xA;    ...&#xA;&#xA;    smartMap.map['smartmap-mapcanvas-1'].setOptions({styles: styles});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've been reading &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1886/how-do-you-auto-zoom-center-smartmap-with-multiple-markers&quot;&gt;this post&lt;/a&gt; which literally has the answer to my problem I believe. I just don't understand how to tell the system where/what &lt;code&gt;smartMap&lt;/code&gt; is.&lt;/p&gt;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is what the rendered page looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&amp;quot;/assets/js/app.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;https://maps.googleapis.com/maps/api/js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://mysite.dev/cpresources/smartmap/js/smartmap.js?d=1449217510&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Just for future reference in case someone else comes across this thread. It ended up being the way I was initializing my js file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// This executes before we're ready&#xA;(function () {&#xA;    'use strict';&#xA;    ...&#xA;&#xA;})();&#xA;&#xA;&#xA;// This works&#xA;$(function () {&#xA;   ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="45" LastEditDate="2021-01-01T06:45:14.163" LastActivityDate="2021-01-01T06:45:14.163" Title="How do I talk to Smart Map in JavaScript?" Tags="&lt;plugins&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17495" PostTypeId="2" ParentId="1886" CreationDate="2016-10-29T04:11:52.643" Score="1" Body="&lt;p&gt;&lt;strong&gt;UPDATE: You no longer need to apply &lt;code&gt;fitBounds&lt;/code&gt; manually.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As of &lt;a href=&quot;https://github.com/doublesecretagency/craft-smartmap/blob/v3/CHANGELOG.md#230---2015-12-04&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map 2.3.0&lt;/a&gt;, &lt;code&gt;fitBounds&lt;/code&gt; will automatically be applied when rendering a map.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T05:41:03.607" LastActivityDate="2021-01-01T05:41:03.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17496" PostTypeId="2" ParentId="17494" CreationDate="2016-10-29T04:46:01.187" Score="4" Body="&lt;p&gt;I'd recommend loading your JS file &lt;strong&gt;after&lt;/strong&gt; the &lt;code&gt;smartmap.js&lt;/code&gt; file has been loaded. The &lt;code&gt;smartMap&lt;/code&gt; JS object needs to exist before your code gets run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try loading your JS using the &lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot; rel=&quot;nofollow&quot;&gt;includeJsFile&lt;/a&gt; tag... I believe that should place it in the correct position.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/assets/js/app.min.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, then you may need to wrap your code in something that would prevent it from running until the page is fully loaded...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$(function () {&#xA;    // Your code goes here&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;^ That example uses jQuery. The same can be achieved without jQuery, if you're not using it.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-10-29T04:46:01.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17497" PostTypeId="1" AcceptedAnswerId="17503" CreationDate="2016-10-29T20:50:28.233" Score="1" ViewCount="163" Body="&lt;p&gt;Some of the products on my page are time sensitive (events). Currently I am getting them all like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.commerce.products.type('event').order('eventStartDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't use the &lt;code&gt;expiryDate&lt;/code&gt; as the end date for my event, as I am keeping an archive that I want users to be able to click though. But, I don't want to include these &quot;expired&quot; events in my &quot;upcoming events&quot; list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reading through &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8992/how-to-show-entries-which-are-live-between-dates-regardless-of-postdate-or-expir&quot;&gt;this SO thread&lt;/a&gt; which I think is doing the same thing I am. It's painfully obvious that I don't know what I am doing though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set today = now %}&#xA;{% set events = craft.commerce.products.type('event').eventEndDate('&amp;gt;= today') %}&#xA;&#xA;: Call to a member function getTimestamp() on boolean&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;eventEndDate&lt;/code&gt; is a &lt;code&gt;dateTime&lt;/code&gt; field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying (and failing) to get all events that have an end date that is equal to, or before today. Once the event is over &lt;code&gt;eventEndDate&lt;/code&gt; is after today, I do not want to show it in my list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-10-30T21:04:25.793" Title="How can I get all entries that are equal to, but not after a date?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17498" PostTypeId="1" AcceptedAnswerId="17502" CreationDate="2016-10-29T23:49:14.633" Score="1" ViewCount="98" Body="&lt;p&gt;I'm working on a Commerce Grocery Store that allows users to select a day to have their order either picked up or delivered. Furthermore, some products will have a set quantity for each day of the week. As an example, Fresh Cinnamon Rolls may have 20 available on Thursday, and only 5 available on Friday. With users being able to make an order and then select 'Pickup on Friday', that would mean Friday's quantity for the product needs to be checked and adjusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This kind of thing is going to be a bit of work with a Craft Plugin. I've been struggling to come up with simply a concept/path for how I would go about this quantity-by-calander situation. The client is imagining the 'Quantity' field in variants being a calander, where he can define the quantity for each day of the month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this isn't the most technical question as I'm not providing code. But it would be incredibly helpful to get some insight from some of you Craft/Commerce experts on just how you would go about something like this in a plugin. If you thought of an approach while reading this, I'd love to hear it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!!&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-10-30T20:52:31.060" Title="Commerce: Calendar to Product Quantity" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17499" PostTypeId="1" AcceptedAnswerId="17501" CreationDate="2016-10-30T01:57:21.830" Score="0" ViewCount="36" Body="&lt;p&gt;As the title says, I can successfully return the &quot;existing user IDs&quot; from an entry field if the &quot;entries.saveEntry&quot; event is called after saving the entry from the CMS admin area; however, if I save an entry via a front-end form, the same code produces empty results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used xDebug to verify that the objects are the same line by line; somehow the data isn't there for $users-&gt;ids() for front-end triggered events.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get entry&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId); // elementType =&amp;gt; &quot;Entry&quot;&#xA;&#xA;// get ALL users related to entry&#xA;$users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User); // elementType =&amp;gt; Craft\UserElementType&#xA;$users-&amp;gt;status = null;&#xA;$users-&amp;gt;relatedTo = [$entry]; // elementType =&amp;gt; &quot;Entry&quot;&#xA;$userIds = $users-&amp;gt;ids(); // elementType =&amp;gt; Craft\UserElementType&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example result when triggered from backend (good):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    0 =&amp;gt; 251,&#xA;    1 =&amp;gt; 252,&#xA;    3 =&amp;gt; 257&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example result when triggered from front-end (help!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastEditorUserId="57" LastEditDate="2016-10-30T02:52:25.080" LastActivityDate="2016-10-31T03:00:18.800" Title="Fetching Existing Users In Users Field Doesnt Work When entries.saveEntry Event Triggerred From Frontend" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17500" PostTypeId="1" CreationDate="2016-10-30T18:39:52.003" Score="1" ViewCount="305" Body="&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;: For a redesign and port to CraftCMS, I need to import the content from a blog hosted on another platform with a lot of content (over 500 posts and over 3000 images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Strategy&lt;/strong&gt;: To import the images from external URLS, I have written a simple &quot;dedicated&quot; plugin which uses the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10678/how-to-upload-assets-without-user-interaction&quot;&gt;technique described here&lt;/a&gt; and relies on &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService#insertFileByLocalPath-detail&quot; rel=&quot;nofollow&quot;&gt;craft()-&gt;assets-&gt;insertFileByLocalPath()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue&lt;/strong&gt;: To make sure each import uploads the latest version of the images, I pass &lt;code&gt;AssetConflictResolution::Replace&lt;/code&gt; as fourth argument to the method. This works perfectly the first time I run the import, but dies when files were uploaded before and there is a filename conflict:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Trying to get property of non-object&#xA;[...] $source = craft()-&amp;gt;assetSources-&amp;gt;getSourceTypeById($theNewFile-&amp;gt;sourceId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure why this error occurs, but I suspect it is because newly imported files are not uploaded yet at the time Craft tries to resolve the conflict.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Possible solutions&lt;/strong&gt;: I tried to handle conflicts manually, by first deleting the existing file with &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;deleteFiles($response-&amp;gt;getDataItem('fileId'), true)&lt;/code&gt;, and then re-uploading the new file with &lt;code&gt;insertFileByLocalPath&lt;/code&gt; but no success...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the target assets source is reserved for the imported images, I also thought about dumping all files in the target assets source before the import starts. But that would cause problems if I want to import only a subset of all the post images (very likely since the import needs time to execute).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: How can I work around this error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution should make sure:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;newly uploaded files always replaces existing files with the same filename.&lt;/li&gt;&#xA;&lt;li&gt;partial imports don't remove unrelated files that were uploaded before.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5829" LastActivityDate="2016-10-30T18:39:52.003" Title="Upload assets manually: replace existing files" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;upload&gt;&lt;import&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17501" PostTypeId="2" ParentId="17499" CreationDate="2016-10-30T20:01:49.607" Score="1" Body="&lt;p&gt;Turns out I was inadvertently &quot;emptying&quot; my user field on form post. Essentially I had named one of the form fields &quot;fields[customUserField]&quot; which upon submitting the form, was saving an empty value into the &quot;Users&quot; field. Then my custom event would trigger and fetch the &quot;Users&quot; field thereby retrieving an empty &quot;array&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So nothing is wrong with the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get entry&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;// get ALL users related to entry&#xA;$users = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;$users-&amp;gt;status = null;&#xA;$users-&amp;gt;relatedTo = [$entry];&#xA;$userIds = $users-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastEditorUserId="270" LastEditDate="2016-10-31T03:00:18.800" LastActivityDate="2016-10-31T03:00:18.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17502" PostTypeId="2" ParentId="17498" CreationDate="2016-10-30T20:52:31.060" Score="4" Body="&lt;p&gt;Sounds like a fun project. :) My thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– I'd ditch using Commerce' stock management, and set all products to have unlimited stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– I'd build a plugin that has a field type that attaches to products/variants, that lets the client add stock to certain dates for that product/variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– I'd have template variable for getting stock for a given date and product/variant, and use it to show availability in the templates. If you need to show availability in product listings, I'd probably also create a custom template variable for getting products (instead of using &lt;code&gt;craft.commerce.products&lt;/code&gt; directly), that extends the element criteria to add your custom stock availability to it (see &lt;a href=&quot;https://blog.tighten.co/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;, or my &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow&quot;&gt;Similar plugin&lt;/a&gt; for examples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– I'd listen for some Commerce events (&lt;code&gt;commerce_orders.beforeOrderComplete&lt;/code&gt; and &lt;code&gt;commerce_variants.onOrderVariant&lt;/code&gt;) to update the stock level when an order is placed (see the &lt;a href=&quot;https://github.com/pixelandtonic/CommerceStockNotifier&quot; rel=&quot;nofollow&quot;&gt;Stock Notifier plugin&lt;/a&gt; from P&amp;amp;T for examples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be honest, I think the biggest challenge is the second point, making the interface and database structure that lets the client update availability. A real simple solution where they add a date and a number for stock, is easy enough. But making a nicer calendar interface, and adding support for stuff like recurring dates (&quot;we have 20 fresh cinnamon rolls every thursday&quot;), gets pretty complicated pretty fast. But, it all depends on the use case how advanced it needs to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, that's my initial thoughts. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-10-30T20:52:31.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17503" PostTypeId="2" ParentId="17497" CreationDate="2016-10-30T20:58:54.633" Score="2" Body="&lt;p&gt;I think the only issue is that you're adding &quot;today&quot; to the query as a string, not the variable you've created. try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set today = now %}&#xA;{% set events = craft.commerce.products.type('event').eventEndDate('&amp;gt;=' ~ today) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code in the answer you referred to had the same error, I've fixed it. &lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2016-10-30T21:04:25.793" LastActivityDate="2016-10-30T21:04:25.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17504" PostTypeId="1" CreationDate="2016-10-31T05:25:42.363" Score="1" ViewCount="218" Body="&lt;ul&gt;&#xA;&lt;li&gt;User account is &quot;pending&quot;&lt;/li&gt;&#xA;&lt;li&gt;verificationCode is created in database, and erases when visiting the hyperlink.&lt;/li&gt;&#xA;&lt;li&gt;I'm able to successfully produce an activation email using the code below:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Code:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;users-&amp;gt;getUserByEmail($emailAddress);&#xA;&#xA;if ($user-&amp;gt;getStatus() != &quot;active&quot;)&#xA;{&#xA;    craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm redirected to the page set for &lt;strong&gt;activateAccountSuccessPath&lt;/strong&gt; in config/general.php which an account edit page.&lt;/li&gt;&#xA;&lt;li&gt;I'm &quot;sort of&quot; half logged in... able to see the email address for my account filled in the edit profile form, but the CMS otherwise does not recognize me as logged in.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-31T18:06:00.387" Title="Activation Email for Pending User Doesn't Work" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17505" PostTypeId="1" AcceptedAnswerId="17507" CreationDate="2016-10-31T11:27:26.787" Score="0" ViewCount="33" Body="&lt;p&gt;I have a plugin which allows Users to &quot;buy&quot; documents associated with an Entry. All it consists of is two fields on the User; a &quot;Credits Available&quot; text field, and an &quot;Owned Documents&quot; Entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front end for each Entry I have a block of code which checks to see if the Entry being viewed is in the &quot;Owned Documents&quot; field or not. If it is, a message of &quot;you own this&quot; is shown, if not a form to &quot;purchase&quot; the document is shown. The code is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% set displayPurchaseButton = 'yes' %}&#xA;&#xA;    {# Work out if we need to show the purchase button #}&#xA;    {% if currentUser.purchasedDocuments | length %}{# there are already purchased documents #}&#xA;        {% for document in currentUser.purchasedDocuments %}{# loop through all the currently purchased documents #}&#xA;            {% if document.id == entry.id %}{# The entry being viewed is currently purchased #}&#xA;                {% set displayPurchaseButton = 'no' %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    {% if displayPurchaseButton == 'yes' %}&#xA;        {% if currentUser.creditsAvailable &amp;lt; entry.creditCost %}{# They don't have enough to buy the document #}&#xA;            &amp;lt;p&amp;gt;Buy more credits&amp;lt;/p&amp;gt;&#xA;        {% else %}{# Show the buy button #}&#xA;            &amp;lt;form action=&quot;&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; id=&quot;favourite&quot;&amp;gt;&#xA;                {{ getCsrfInput() }}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;usingCredits/credits/creditPurchase&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;documentId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;&#xA;                &amp;lt;input type=&quot;submit&quot; value=&quot;Buy Document ({{ entry.creditCost }} Cr)&quot; class=&quot;favourite&quot;&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        {% endif %}&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;You own this document&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works... except immediately after 'buying' the document. In which case the reloaded page shows an updated Credit field (the cost of the purchase has been deducted from the Available Credits) but does not show the &quot;you own this&quot; message, instead showing the Purchase button. However, if I manually re-load the page, it behaves properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCreditPurchase()&#xA;{&#xA;    // basic security precautions&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;    // Get info about the logged in user&#xA;        $user             = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        $ownedDocuments   = $user-&amp;gt;getContent()-&amp;gt;purchasedDocuments;&#xA;        $creditsAvailable = $user-&amp;gt;getContent()-&amp;gt;creditsAvailable;&#xA;&#xA;    // what's the Entry ID for what they want to buy?&#xA;        $purchaseDocumentId = craft()-&amp;gt;request-&amp;gt;getPost('documentId');&#xA;&#xA;    // does such a document exist?&#xA;        $document         = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $document-&amp;gt;id     = $purchaseDocumentId;&#xA;        $purchaseDocument = $document-&amp;gt;first();&#xA;&#xA;        if(!$purchaseDocument) {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('An error occured: the document could not be found.'));&#xA;        }&#xA;&#xA;    // check the user has the credits required&#xA;        $documentCost = $purchaseDocument-&amp;gt;getContent()-&amp;gt;creditCost;&#xA;&#xA;        if($documentCost &amp;gt; $creditsAvailable) {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('You do not have enough credits to purchase this document.'));&#xA;        }&#xA;&#xA;    // also check that they don't already own the document&#xA;        $purchasedDocumentIds = $user-&amp;gt;purchasedDocuments-&amp;gt;ids();&#xA;        if( in_array($purchaseDocumentId, $purchasedDocumentIds) )&#xA;        {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('You already own this document.'));&#xA;            $this-&amp;gt;documentOwned = &quot;yes&quot;;&#xA;        }&#xA;&#xA;    // ok, buy the item&#xA;        if($purchaseDocument &amp;amp;&amp;amp;&#xA;           $documentCost &amp;lt; $creditsAvailable &amp;amp;&amp;amp;&#xA;           $this-&amp;gt;documentOwned !== &quot;yes&quot;)&#xA;        {&#xA;            // append the document ID to the existing array of owned documents&#xA;            array_push($purchasedDocumentIds, $purchaseDocumentId);&#xA;&#xA;            // calculate the new creditsAvailable value&#xA;            $newCreditsAvailable = $creditsAvailable - $documentCost;&#xA;&#xA;            // update the user fields&#xA;            $user-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                'creditsAvailable' =&amp;gt; $newCreditsAvailable,&#xA;                'purchasedDocuments' =&amp;gt; $purchasedDocumentIds&#xA;            ));&#xA;&#xA;            // save the user&#xA;            craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-10-31T16:54:54.257" Title="Form action updates multiple User fields, but front-end template &quot;caches&quot; one field?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17506" PostTypeId="2" ParentId="17439" CreationDate="2016-10-31T12:12:27.153" Score="1" Body="&lt;p&gt;So, it turns out (as is often the case) that posting the problem makes you look at it in a fresh light, and as such I found my own solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I needed to do (leaving this here in case someone else has a similar problem and come looking for help) was to make the following change to my rendering-controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;old&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRenderCreateRecordCompany()&#xA;{&#xA;  $this-&amp;gt;renderPluginTemplate('coverapp/recordCompanyCreate');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;new&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRenderCreateRecordCompany(array &amp;amp;variables = array())&#xA;{&#xA;  $this-&amp;gt;renderPluginTemplate('coverapp/recordCompanyCreate');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess this makes sense - I didn't include it originally as my route never passed any variables to it - but of course when I use &lt;code&gt;setRouteVariables&lt;/code&gt; in my controller-action I need something on the receiving end to catch it.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2016-10-31T12:12:27.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17507" PostTypeId="2" ParentId="17505" CreationDate="2016-10-31T12:36:14.483" Score="1" Body="&lt;p&gt;Although submitting the form causes the same page to be loaded again, it turns out that Craft isn't actually re-parsing the loaded page. You have to tell it to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the plugin was successful you need to set it to redirect back to the URL that POSTed in the first place. Like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// save the user&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;// redirect back to the original page if successful (as a new page request)&#xA;if($success) {&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;} else {&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Could not purchase document.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks to Hubert Prein on Slack for that :)&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2016-10-31T16:54:54.257" LastActivityDate="2016-10-31T16:54:54.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17508" PostTypeId="2" ParentId="17464" CreationDate="2016-10-31T14:06:33.163" Score="1" Body="&lt;p&gt;Something I'd not done with the edit form was replace [new1] with [{{variant.id}}] for the variant inputs. As I said, the form was saving correctly anyway if I changed the date, so I didn't expect correcting these to fix the issue I'd been having.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that correcting these does in fact fix the issue I was having with saving products with an unchanged custom date field. Here is the corrected template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if variant is defined %}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[{{ variant.id }}][unlimitedStock]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[{{ variant.id }}][minQty]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[{{ variant.id }}][maxQty]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; value=&quot;{{ variant.stock }}&quot; name=&quot;variants[{{ variant.id }}][stock]&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; value=&quot;{{ variant.price | number_format(0) }}&quot; name=&quot;variants[{{ variant.id }}][price]&quot;&amp;gt;&#xA;{% else %}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[new1][unlimitedStock]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[new1][minQty]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;variants[new1][maxQty]&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;variants[new1][stock]&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;variants[new1][price]&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm left wondering whether only having a single default variant allowed still permits new variants to be submitted, which might explain why I wasn't getting any errors? Similarly, I'm not sure why correcting the variant field names fixed the problem I was having with the custom date field not saving when the date wasn't changed.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2016-10-31T15:21:57.620" LastActivityDate="2016-10-31T15:21:57.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17509" PostTypeId="2" ParentId="6505" CreationDate="2016-10-31T16:07:47.540" Score="3" Body="&lt;p&gt;After seeing this and hitting the same problem ourselves, we decided to create a plugin to index the assets from S3 in batches. We have not yet moved to using tasks in the plugin but it is on our roadmap. We know that Craft 3.x will have improvements to asset indexing but until then, please feel free to give our plugin a go if you are still experiencing issues with this. Our plugin can be downloaded from: &lt;a href=&quot;https://github.com/a-digital/assetindexer&quot; rel=&quot;nofollow&quot;&gt;https://github.com/a-digital/assetindexer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2016-10-31T16:07:47.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17510" PostTypeId="2" ParentId="2769" CreationDate="2016-10-31T16:08:49.780" Score="1" Body="&lt;p&gt;Here is a &lt;strong&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10862/how-to-use-a-numeric-field-with-a-default-value&quot;&gt;feature request to add a default value&lt;/a&gt;&lt;/strong&gt; to the native Number field type – voting for it will hopefully bring this functionality to Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, Brad Bell &lt;a href=&quot;https://craftcms.stackexchange.com/a/10863/37&quot;&gt;suggests another solution&lt;/a&gt;: Write a plugin that extends Craft's native Number field type.) &lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-10-31T16:08:49.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17512" PostTypeId="2" ParentId="17504" CreationDate="2016-10-31T18:06:00.387" Score="1" Body="&lt;p&gt;After following the stack trace for activating a user (with the link), I discovered that activation fails at /craft/app/services/UsersService.php:822:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;820:   public function verifyEmailForUser(UserModel $user)&#xA;821:   {&#xA;822:      if ($user-&amp;gt;unverifiedEmail)&#xA;823:      {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apparently I needed to set the unverifiedEmail property when creating &quot;Pending&quot; users via a plugin as opposed to only setting the 'pending' property to false.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;email = 'pendinguser@email.com;&#xA;// ... set other properties&#xA;$user-&amp;gt;pending = false;&#xA;$user-&amp;gt;unverifiedEmail = '';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-31T18:06:00.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17513" PostTypeId="2" ParentId="17490" CreationDate="2016-10-31T18:31:25.253" Score="0" Body="&lt;p&gt;It's fairly straight forward. You could go with a single &quot;layout&quot; file and then a template file for each unique template that utilizes that simple header/footer layout&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;templates/layouts/_layout.html &lt;/li&gt;&#xA;&lt;li&gt;templates/index.html (homepage)&lt;/li&gt;&#xA;&lt;li&gt;templates/products.html&lt;/li&gt;&#xA;&lt;li&gt;templates/support.html&lt;/li&gt;&#xA;&lt;li&gt;templates/contact.html&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Extending a layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;layouts/_layout&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your product template would then just need to be coded to handle the category handle in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, listing entries (products) that are assigned to a category (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get categorySlug from URL segment 2 #}&#xA;{% set category = craft.request.getSegment(2) %}&#xA;&#xA;{# get instance of category #}&#xA;{% set category = craft.categories.slug('categorySlug') %}&#xA;&#xA;{# get entries related to the category instance #}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{# loop through the entries #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's obviously just an example, but should get you going in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related reading material:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getSegments&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/templating/craft.request#getSegments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="270" LastActivityDate="2016-10-31T18:31:25.253" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17515" PostTypeId="1" AcceptedAnswerId="17533" CreationDate="2016-10-31T20:02:36.447" Score="1" ViewCount="343" Body="&lt;p&gt;How can we do fields linked to products that the user can personalises when buying that product, ie writes in a custom gift message and picks an option of gif wrapped with additional cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our client would have a few of these on each product some with costs and some free of charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have looks at variants but seem we would have to make a new product/variant for each combination which would be a lot not variants, is there another way?&lt;/p&gt;&#xA;" OwnerUserId="5838" LastEditorUserId="57" LastEditDate="2016-10-31T20:38:04.997" LastActivityDate="2016-11-02T08:58:45.883" Title="Per item ie gift wrapped with additional cost in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17516" PostTypeId="1" AcceptedAnswerId="17521" CreationDate="2016-10-31T20:50:03.100" Score="1" ViewCount="61" Body="&lt;p&gt;I need to display a block from a matrix for the following week.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the query I need to build is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in workshop.workshopSession.where(sessionDate &amp;gt; now).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just can't quite get this to work and have been searching for a while. Perhaps I am just missing something obvious. There will be more than one entry with a date greater than &quot;now&quot; so I need to limit it to 1.&lt;/p&gt;&#xA;" OwnerUserId="3817" LastActivityDate="2016-11-01T12:38:37.947" Title="How to get next entry by date in matrix block but limit to just 1" Tags="&lt;matrix&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17517" PostTypeId="1" CreationDate="2016-10-31T23:22:30.353" Score="4" ViewCount="217" Body="&lt;p&gt;We have the choice of engaging services like Forge and ServerPilot, or rolling our  own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides pricing, the opacity of what the services are actually providing can be a question -- just how well do they protect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be equal or better to provide our own securing when using VPS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To decide, it would be good to understand an apparent baseline for server security.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2016-11-01T18:19:56.447" LastActivityDate="2016-11-01T18:19:56.447" Title="What are useful guidelines for Craft CMS security on VPS (virtual private servers)?" Tags="&lt;server&gt;&lt;security&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17518" PostTypeId="2" ParentId="17517" CreationDate="2016-10-31T23:35:20.873" Score="8" Body="&lt;p&gt;This morning a couple of postings on Craft Slack #devops area linked good descriptions of basic server security, led by @merlingore there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their instructions are tilted towards Ubuntu as far as specifics, but should fit for any Linux VPS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recording the links here so we don't lose the patterns. I agree with them because they're actually the same as what I came up with personally in arranging VPS security, and they say what's needed clearly and concisely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers&quot; rel=&quot;noreferrer&quot;&gt;https://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and to complete on automatic security updates, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blog.mafr.de/2015/02/26/ubuntu-unattended-upgrades/&quot; rel=&quot;noreferrer&quot;&gt;https://blog.mafr.de/2015/02/26/ubuntu-unattended-upgrades/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IT's quite worth reading the comments also on each of these, particularly the second. I like the so-often Germanic completeness there, if would suggest that auto-reboot is not just for personal servers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can control time-of-day via the auto-cron setting, and if you need 100% uptime, this is very likely better managed (and likely only actually possible for many scenarios) by providing more than one load-balanced server, updating them in a sequence, which again the cron portion could be one way of handling.&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2016-10-31T23:35:20.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17519" PostTypeId="1" AcceptedAnswerId="17520" CreationDate="2016-11-01T11:48:39.140" Score="1" ViewCount="68" Body="&lt;p&gt;On my local dev sever, as well as the production server, the &lt;code&gt;craft&lt;/code&gt; folder is one level above web root, so &lt;code&gt;$craftPath&lt;/code&gt; in &lt;code&gt;index.php&lt;/code&gt; is set like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$craftPath = '../craft';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the staging server, the &lt;code&gt;craft&lt;/code&gt; folder is two levels above web root, so &lt;code&gt;$craftPath&lt;/code&gt; needs to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$craftPath = '../../craft';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this be accomplished in a single index.php file? Something similar to the multi-environment array in &lt;code&gt;config/general.php&lt;/code&gt; and &lt;code&gt;config/db.php&lt;/code&gt; perhaps?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2016-11-01T17:40:31.697" Title="Can multi-environment configuration be used in 'index.php'?" Tags="&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17520" PostTypeId="2" ParentId="17519" CreationDate="2016-11-01T12:36:18.543" Score="3" Body="&lt;p&gt;Should be able to. Use a switch statement to check on the host and then server up the correct environment configuration like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;public/index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch (strtolower($_SERVER['SERVER_NAME']))&#xA;{&#xA;    // Staging&#xA;    case 'stage.mydomain.com' :&#xA;        define('CRAFT_ENVIRONMENT', 'stage');&#xA;        $craftPath = '../../craft';&#xA;        break;&#xA;&#xA;    // Local&#xA;    default :&#xA;        define('CRAFT_ENVIRONMENT', 'local');&#xA;        $craftPath = '../craft';&#xA;        break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="3481" LastEditDate="2016-11-01T17:40:31.697" LastActivityDate="2016-11-01T17:40:31.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17521" PostTypeId="2" ParentId="17516" CreationDate="2016-11-01T12:38:37.947" Score="2" Body="&lt;p&gt;I think this should do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in workshop.workshopSession.sessionDate('&amp;gt;=' ~ now|date('Y-m-d')).limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If not you always can go with a &quot;dirty&quot; fix by just showing the &lt;code&gt;{% loop.first %}&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-11-01T12:38:37.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17522" PostTypeId="1" AcceptedAnswerId="17524" CreationDate="2016-11-01T14:06:38.407" Score="0" ViewCount="112" Body="&lt;p&gt;I have an upcoming project where it may be necessary to have a mobile site and a desktop site as the desktop design will not work well responsively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I built a similar site recently in ExpressionEngine and used Multiple Site Manager (MSM) which allowed me to have separate templates with the same url structure pulling content all from the main site. Since that build I've starting moving new projects to Craft and would like to find a solution to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Craft does not have a feature similar to MSM, at this point, what would be the best way to approach this. Urls need to be the same on both domain.com and m.domain.com with all content being sharing the same channels.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-11-01T17:49:44.657" Title="How to run domain.com and m.domain.com from one install" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17524" PostTypeId="2" ParentId="17522" CreationDate="2016-11-01T17:24:11.690" Score="2" Body="&lt;p&gt;To use separate templates I created plugin and within &lt;code&gt;init()&lt;/code&gt; method I overwritten &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#templatesPath-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;templatesPath&lt;/a&gt; variable. Seems to be working although you need to test it with other plugins as I have tested it with fresh Craft instance only.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    $templatesPath = craft()-&amp;gt;templates-&amp;gt;getTemplatesPath();&#xA;&#xA;    if(craft()-&amp;gt;request-&amp;gt;isMobileBrowser()){&#xA;        $templatesPath .= 'mobile/';&#xA;    } else {&#xA;        $templatesPath .= 'desktop/';&#xA;    }&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;setTemplatesPath($templatesPath);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#isMobileBrowser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;isMobileBrowser()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example assumes that &lt;code&gt;templates&lt;/code&gt; folder contains &lt;code&gt;mobile&lt;/code&gt; and &lt;code&gt;desktop&lt;/code&gt; folders. Both have a mirror template files structure. Also you don't need m.domain.com anymore.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;But it you need m.domain.com you can use &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi environment config variables (environmentVariables)&lt;/a&gt; or stick to the previous solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'templatesPath' =&amp;gt; 'desktop',&#xA;    ),&#xA;    'm.domain.com' =&amp;gt; array(&#xA;        'templatesPath' =&amp;gt; 'mobile',&#xA;    ),&#xA;);&#xA;&#xA;public function init() {&#xA;    $templatesPath = craft()-&amp;gt;templates-&amp;gt;getTemplatesPath();&#xA;&#xA;    if(craft()-&amp;gt;config-&amp;gt;get('environmentVariables')['templatesPath']){ //this line changed&#xA;        $templatesPath .= 'mobile/';&#xA;    } else {&#xA;        $templatesPath .= 'desktop/';&#xA;    }&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;setTemplatesPath($templatesPath);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To force mobile URL insert this code to desktop base layout file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(craft.request.isMobileBrowser()) {&#xA;    {% redirect 'http://m.domain.com' %}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="5818" LastEditDate="2016-11-01T17:49:44.657" LastActivityDate="2016-11-01T17:49:44.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17525" PostTypeId="2" ParentId="961" CreationDate="2016-11-01T19:01:13.370" Score="6" Body="&lt;p&gt;This Nginx-Craft configuration is one I've been using in production for some time, and it implements many best-practices that you might want to be using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-11-01T19:01:13.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17526" PostTypeId="1" AcceptedAnswerId="17636" CreationDate="2016-11-01T19:10:19.317" Score="3" ViewCount="254" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/ryanshrum/hacksaw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hacksaw&lt;/a&gt; plugin to truncate text and it does a great job except instead of rendering HTML entities such as &quot;&amp;amp;&quot;, it's outputting them as &quot;&lt;code&gt;&amp;amp;amp;&lt;/code&gt;&quot;. How can I correct this? Putting them in &lt;code&gt;allow=&quot;&quot;&lt;/code&gt; doesn't work. Do I need to do something to manipulate the text string first before applying the Hacksaw filter? Or is there a Hacksaw option that would correct this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit for more info...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of text as it should appear:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Colour &amp;amp; Light; A House Re-crafted, cover &amp;amp; pg.99-108&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example of text output from Hacksaw:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Colour &amp;amp;amp;amp; Light; A House Re-crafted, cover &amp;amp;amp;amp; pg.99-108&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Stupidly I hadn't looked at the HTML until now. It looks like the first &lt;code&gt;&amp;amp;amp;&lt;/code&gt; is rendering correctly but then there's a second partial entity after it?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set summary = article.newsArticle.type('text').first().text|hacksaw(words='35', append='...') %}&#xA;&#xA;{% set summary = article.newsArticle.type('text').first().text|hacksaw(words='35', append='...')|raw %}&#xA;&#xA;{% set summary = article.newsArticle.type('text').first().text|raw|hacksaw(words='35', append='...') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The order of plugin doesn't appear to have any effect. I get same result with all three of these arrangment above, including no Raw plugin at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit for answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per accepted answer below, final working code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set summary = article.newsArticle.type('text').first().text|htmlEntityDecode|hacksaw(words='35', append='...') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Craft Helpers plugins did the trick.&lt;/p&gt;&#xA;" OwnerUserId="4377" LastEditorUserId="4377" LastEditDate="2016-11-08T07:05:58.880" LastActivityDate="2016-11-08T07:05:58.880" Title="Hacksaw replacing &quot;&amp;&quot; with &quot;&amp;amp;&quot;" Tags="&lt;plugins&gt;&lt;plugin-hacksaw&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17527" PostTypeId="2" ParentId="17526" CreationDate="2016-11-01T19:34:30.840" Score="2" Body="&lt;p&gt;Try using the &lt;code&gt;raw&lt;/code&gt; twig filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ variable|hacksaw(words='100')|raw }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not test this answer since I have't used hacksaw yet. However I believe you can combine filters like this just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/raw.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://twig.sensiolabs.org/doc/filters/raw.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5251" LastActivityDate="2016-11-01T19:34:30.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17529" PostTypeId="2" ParentId="17390" CreationDate="2016-11-02T00:00:19.413" Score="1" Body="&lt;p&gt;Had to browse through your plugin repo for a bit to try and wrap my head around what's going on, but I think you have the problem nailed down in that the issue is this: &lt;a href=&quot;https://github.com/iNalgiev/webtexttool1/blob/1.0.0/WebtexttoolPlugin.php#L57&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/iNalgiev/webtexttool1/blob/1.0.0/WebtexttoolPlugin.php#L57&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to grab the entry ID from the &lt;code&gt;cp.entries.edit.right-pane&lt;/code&gt; template hook for a new entry is going to return null because IDs aren't assigned until after the element is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head, you've got two not-so-thought-out options.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Refactor your plugin logic so that the code that eventually calls your controller/service's &lt;code&gt;saveRecord&lt;/code&gt; methods happen after the entry has been saved in &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveEntry&lt;/a&gt; and you've got a valid entry ID.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Come up with some AJAXy way to calling Craft's &lt;code&gt;saveEntry&lt;/code&gt; method from the &lt;code&gt;cp.entries.edit.right-pane&lt;/code&gt; template hook that returns the entry ID so the rest of your logic can assume that the entry already exists.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-02T00:00:19.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17530" PostTypeId="2" ParentId="10667" CreationDate="2016-11-02T04:13:29.847" Score="5" Body="&lt;p&gt;I have a site with quite a lot of traffic and user submissions. After a while DB backups started taking too long (uncompressed sql dump over 300mb). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of keeping the last change, I now keep 30 days worth of changes. I have a cron job set up to remove older revisions. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysql -e 'DELETE FROM craft_entryversions WHERE dateUpdated &amp;lt; DATE_SUB(NOW(),INTERVAL 30 DAY)' dbname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't need revisions for certain sections, just disable revisions altogether on a per section basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps other people with large &lt;code&gt;craft_entryversions&lt;/code&gt; tables. &lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2017-03-13T01:14:00.203" LastActivityDate="2017-03-13T01:14:00.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17531" PostTypeId="2" ParentId="17353" CreationDate="2016-11-02T08:31:38.583" Score="1" Body="&lt;p&gt;Not an expert myself, but you can try &lt;code&gt;.contains('OR', 'a', 'b', 'c', 'e')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, rather than first fetch all entries and then filter them, I would look into using relations when looking them up, so that the initial result only contains the entries you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt; to get started, and don't be afraid to ask for help if you can't quite figure them out (I found them a little tricky myself when first attempting to use them).&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2016-11-02T08:31:38.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17532" PostTypeId="1" AcceptedAnswerId="17583" CreationDate="2016-11-02T08:42:33.883" Score="1" ViewCount="287" Body="&lt;p&gt;I'd like to create a Solspace Calendar Event on Commerce &lt;code&gt;onOrderComplete&lt;/code&gt;. I've done this with Charge where on Charge Success an event was created however I know that I did that in a less than ideal way so hopefully the answer to this allows me to both achieve what this question is asking as well as fix my previous plugin (that works but just seems less than ideal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd need to pass some of the fields from the Order Fields such as the Start Date, End Date, Products Purchased.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know i need to create a plugin for this, i'm just not quite sure how to call the Solspace Calendar plugin &lt;code&gt;onOrderComplete&lt;/code&gt; and send it the appropriate data to create said event. Any help (with examples if possible) would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify: I am not looking for someone to write a plugin for me. I am simply looking to be put on the right track in terms of connecting to Solspace Calendar and sending it the appropriate data on completion of a commerce order.  I can write the code myself once pointed in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2016-11-02T15:10:27.603" LastActivityDate="2016-11-04T19:46:17.433" Title="Create Solspace Calendar Event on Commerce onOrderComplete" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;events&gt;&lt;plugin-charge&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17533" PostTypeId="2" ParentId="17515" CreationDate="2016-11-02T08:58:45.883" Score="3" Body="&lt;p&gt;To add additional information about a product when adding to cart, you can use the &lt;code&gt;options&lt;/code&gt; param to submit any data you wish along with the product you are adding to cart. You can see documentation on this here: &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for modifying the price of the product based on those options; this is not possible by default in Craft Commerce, although we have provided a way that a plugin can achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 possible solutions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Write a plugin that provides a &lt;code&gt;Purchasable&lt;/code&gt;. A purchasable is a Craft Element, which your customers could build or edit on the front-end, and then add it to the cart. This is the more advanced path. You would need to know how to create a Craft Element, allow front end users to create and edit them, then make the element a purchasable. Documentation on Purchasables here: &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/purchasables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Submit line item option data, but write a plugin that uses the &lt;code&gt;onPopulateLineItem&lt;/code&gt; event to modify the price of the line item based on the option data submitted. It would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;    $purchasable= $event-&amp;gt;params['purchasable'];&#xA;    $lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;    if(isset($lineItem-&amp;gt;options['giftWrapped']) &amp;amp;&amp;amp; $lineItem-&amp;gt;options['giftWrapped'] == 'yes'){&#xA;        $lineItem-&amp;gt;price = $purchasable-&amp;gt;getPrice() + 10; // gift wrap is 10 dollars&#xA;        $lineItem-&amp;gt;saleAmount = 0;&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The original price would still show in the product listing, but the option submitted when adding to cart would change the price of the line item when in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2 methods above allow you to have configurable prices of products.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-02T08:58:45.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17534" PostTypeId="1" AcceptedAnswerId="17535" CreationDate="2016-11-02T10:07:31.767" Score="3" ViewCount="343" Body="&lt;p&gt;Orders can not be edited in Commerce. Makes sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we want to do however is make it very easy for someone to re-order a previous order. So for example they've had an order that contains &quot;two pairs of socks, two pairs of pants, toothpaste, and soap&quot; but they need all of that again as a new order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than manually having to do so, we want to offer a &quot;re-order&quot; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that an order is just a cart that's been marked complete, we're thinking it should just clone the order into a new cart, so they can review it and make any amends they need to, then just continue as normal with the checkout process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can not figure out how to do this though. Getting the Order is simple enough, and there's an existing cart set up too. But how would I punt that old Order into the new cart?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-11-20T13:32:17.153" Title="Duplicate an existing Order as a new Cart in Commerce" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17535" PostTypeId="2" ParentId="17534" CreationDate="2016-11-02T10:41:36.827" Score="3" Body="&lt;p&gt;Using the &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiAdd&lt;/a&gt; plugin, you can do the following on the order page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;multiAdd/multiAdd&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    {% for item in order.lineItems %}&#xA;        {% set itemNumber = loop.index %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ itemNumber }}][qty]&quot; value=&quot;{{ item.qty }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ itemNumber }}][note]&quot; value=&quot;{{ item.note }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ itemNumber }}][purchasableId]&quot; value=&quot;{{ item.purchasableId }}&quot;&amp;gt;&#xA;        {% for key, option in item.options %}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;items[{{ itemNumber }}][options][{{ key }}]&quot; value=&quot;{{ option }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Order Again&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds a &quot;Order Again&quot; button with the same products and quantities, but options may be bit more difficult to sort out.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastEditorUserId="219" LastEditDate="2016-11-02T12:13:58.227" LastActivityDate="2016-11-02T12:13:58.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17536" PostTypeId="2" ParentId="17534" CreationDate="2016-11-02T10:45:47.157" Score="2" Body="&lt;p&gt;Re-ordering could be possible by building a cart update form on the front-end that is populated by a previous order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to use the &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Add plugin&lt;/a&gt; to submit more than one purchasableId at once, but everything else should work as expected.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-02T10:45:47.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17537" PostTypeId="2" ParentId="5442" CreationDate="2016-11-02T12:17:58.553" Score="6" Body="&lt;p&gt;Another cause of Live Preview not working that can be a pain to debug, because there are no 'errors' as such is your .htaccess setup. For example, on one site we had the following .htaccess entry to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9501/force-trailing-slash-on-urls&quot;&gt;force trailing slashes&lt;/a&gt; (at server level, not &lt;a href=&quot;https://craftcms.com/docs/config-settings#addTrailingSlashesToUrls&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's config option&lt;/a&gt;) in order to prevent duplicate listings in the client's analytics:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Force trailing slash:&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteRule ^(.*[^/])$ http://%{HTTP_HOST}/$1/ [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However that 301 redirect kills the Live Preview and returns the page at it's current saved state. No errors in the logs and easy to miss. Our workaround for this issue was to only apply the trailing slash for non-POST requests, allowing Craft to POST to the Live Preview system uninterrupted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Force trailing slash:&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_METHOD} !=POST&#xA;  RewriteRule ^(.*[^/])$ http://%{HTTP_HOST}/$1/ [L,R=301]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="365" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-11-02T12:17:58.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17541" PostTypeId="2" ParentId="17526" CreationDate="2016-11-02T15:07:28.243" Score="1" Body="&lt;p&gt;I have used hacksaw on a few projects, but I haven't come across this before so I can't replicate it. The above answer may work but you could try reordering it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.thing|raw|hacksaw(words='100') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this doesn't work, I'll try and replicate it. Can you paste the code for us?&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2016-11-02T15:07:28.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17542" PostTypeId="1" CreationDate="2016-11-02T15:32:39.953" Score="1" ViewCount="76" Body="&lt;p&gt;I'm using A&amp;amp;M forms which is working great. However when a form is submitted the reply to address is the address set in the Control Panel. Ideally one could fill this in with a variable so that it uses the email address submitted by the end user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lohU6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lohU6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-11-02T15:36:52.317" Title="A&amp;M Forms reply to address" Tags="&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17543" PostTypeId="1" AcceptedAnswerId="17545" CreationDate="2016-11-02T15:34:21.263" Score="4" ViewCount="338" Body="&lt;p&gt;&lt;strong&gt;When is it advisable or prudent to use &lt;code&gt;without&lt;/code&gt; rather than a conditional statement to exclude something, eg a set of entries, based on one parameter?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say I have real towns and fictional Towns that are listed on a related Regional page. These Towns are sorted real/fictional by a toggle field -- &lt;code&gt;0&lt;/code&gt; for real, &lt;code&gt;1&lt;/code&gt; for fictional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fictional towns are used elsewhere and should not be listed on any Regional page. &lt;strong&gt;In this case, should I be using &lt;code&gt;if&lt;/code&gt; (see below) or &lt;code&gt;without&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I am doing it right now in my Regional template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if town.townFictional == 0 %}&#xA;    &amp;lt;li&amp;gt;{{town.link}}&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working fine, but I came across &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1758/what-is-the-best-way-to-exclude-an-array-of-entries&quot;&gt;this question&lt;/a&gt; where using &lt;code&gt;without&lt;/code&gt; was suggested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;without&lt;/code&gt; preferred in my case, and if so how do I use it? Here is my &lt;code&gt;towns&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set towns = craft.entries.section('towns').relatedTo(counties) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-11-08T00:24:11.100" Title="When to use &quot;if&quot; or &quot;without&quot;?" Tags="&lt;entries&gt;&lt;conditional&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17544" PostTypeId="2" ParentId="17542" CreationDate="2016-11-02T15:36:52.317" Score="2" Body="&lt;p&gt;Of course a couple of minutes after posting this I find the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is put the email field handle in the reply to email address input like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{emailAddress}&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-11-02T15:36:52.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17545" PostTypeId="2" ParentId="17543" CreationDate="2016-11-02T16:03:59.127" Score="8" Body="&lt;p&gt;For your example, you should exclude the fictional towns in the initial query itself rather than filtering them out afterwards:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set towns = craft.entries.section('towns').townFictional('not 1').relatedTo(counties) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that no towns with the Fictional Lightswitch &lt;em&gt;on&lt;/em&gt; will be returned from the database at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would use the &lt;code&gt;|without&lt;/code&gt; filter, if you &lt;em&gt;already&lt;/em&gt; had an array of items and you wanted to filter some of them out while looping over them. &lt;a href=&quot;https://craftcms.stackexchange.com/a/7178/157&quot;&gt;This works best with arrays of simple primitives, such as an array of entry IDs, rather than whole objects&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would be more likely to use an &lt;code&gt;{% if %}&lt;/code&gt; tag if you still wanted to fetch the entry, but wanted to adjust some part of your output based on a condition. So for example if you had an array of entries from different sections, and they might not all have URLs, you might decide to output a link &lt;em&gt;or&lt;/em&gt; just the title:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% if entry.getUrl() %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl()&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-11-08T00:24:11.100" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17546" PostTypeId="1" CreationDate="2016-11-02T16:15:25.590" Score="2" ViewCount="293" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; plugin.  They payment process happens in a modal.  If I enter in a bad number from one of the stripe test numbers and submit, when the payment fails the modal goes away and no errors are shown.  The errors are not getting loaded into the div set for payment errors.  I do get the errors before form submit but that doesn't help with a bad card or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the error in the cp and can see it but I cannot find anything in their documentation to log this to the view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/usage/quickstart/using-stripe-js&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; quite a bit and also viewed thier example and I am not doing anything different.  But for some reason I cannot get the declined error to show on the entry page once it returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the script&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;  (function () {&#xA;    Stripe.setPublishableKey('{{ craft.charge.getPublicKey() }}');&#xA;    $(this).charge('#charge-form', '#payment-errors', '.charge-indicator');&#xA;  })();&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Form is almost exactly the same as their example except that I have a few custom fields (those are not the fields with errors in them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any experience with this plugin that can shed some light on how to return a declined card error or any errors that occur after form submission it would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see this in the cp&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IdUAe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IdUAe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-11-02T16:57:43.963" LastActivityDate="2018-08-23T15:54:22.107" Title="Charge plugin not showing errors on payment fail" Tags="&lt;craft-pro&gt;&lt;plugin-charge&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17547" PostTypeId="1" CreationDate="2016-11-02T17:33:03.350" Score="0" ViewCount="117" Body="&lt;p&gt;I would like to be able retrieve all entries based on a category selected in a drop down list. From a UX perspective, I would like this to be as seamless as possible and not have to do full page refresh. Is this something I should build using the ElementAPI or is there better way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5389" LastActivityDate="2016-11-03T11:47:57.630" Title="Handling dynamic content" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17548" PostTypeId="1" AcceptedAnswerId="17551" CreationDate="2016-11-02T18:44:53.123" Score="1" ViewCount="307" Body="&lt;p&gt;I have the following problem:&#xA;My Craft site was setted up normally. I made entries with matrix structure and build one after another. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then after i built a lot of entries i wanted to set up a second locale for the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i used the craft manual on your site and i told the fields that i want to have in the second language as well that its translateable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now if i want to translate my matrix fields in the entry, THE HOLE matrix structure is gone :O but of course i do not want to create them new. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i do ne entries now after setting up the second language, matrix fields are translateable, but not my entries that were exist before... How can i now fix it?&#xA;I read on different blogs that is a bug..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Regards&lt;/p&gt;&#xA;" OwnerUserId="5847" LastActivityDate="2016-11-04T19:25:29.883" Title="Matrix Fields translation not working" Tags="&lt;matrix&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17550" PostTypeId="1" AcceptedAnswerId="17552" CreationDate="2016-11-02T20:46:04.103" Score="1" ViewCount="169" Body="&lt;p&gt;Our site's control panel needs to be on a subdomain for security purposes. So our &lt;code&gt;baseCpUrl&lt;/code&gt; setting in our &lt;code&gt;general.php&lt;/code&gt; file is &lt;code&gt;http://craft-admin.domain.com/&lt;/code&gt; while our &lt;code&gt;siteUrl&lt;/code&gt; is set at &lt;code&gt;http://www.domain.com/&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not able to access user information (specifically if a user is logged in and has &lt;code&gt;accessCp&lt;/code&gt; permissions) on the main site. Dumping &lt;code&gt;user&lt;/code&gt; information on a template is giving me &lt;code&gt;NULL&lt;/code&gt;, I assume because there's no connection being made between &lt;code&gt;craft-admin.domain.com/&lt;/code&gt; and &lt;code&gt;www.domain.com/&lt;/code&gt;, so pages on &lt;code&gt;www.domain.com&lt;/code&gt; can't tell me anything about logged-in users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran into this trying to add in the &lt;a href=&quot;https://github.com/wbrowar/adminbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Admin Bar plugin&lt;/a&gt; so logged-in users can have quicker access to the Control Panel edit screen for a particular page if they're viewing it on the public-facing site. However, since there's no user information being passed along, the admin bar will never show up because it assumes I'm just a regular person browsing the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something else I need to do in order to access logged-in user information on the front end if the &lt;code&gt;baseCpUrl&lt;/code&gt; is different than the &lt;code&gt;siteUrl&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5531" LastActivityDate="2016-11-02T22:16:46.233" Title="Access logged-in user info when `baseCpUrl` is different than `siteUrl`" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17551" PostTypeId="2" ParentId="17548" CreationDate="2016-11-02T22:14:08.213" Score="1" Body="&lt;p&gt;My guess is that you've got xDebug installed and you're running into this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1559/why-are-some-entry-detail-views-empty-in-the-control-panel/1560#1560&quot;&gt;Why are some entry detail views empty in the control panel?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;memory_limit&lt;/a&gt; is set to something low and you're running out of memory and it needs to be bumped up.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-02T22:14:08.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17552" PostTypeId="2" ParentId="17550" CreationDate="2016-11-02T22:16:46.233" Score="0" Body="&lt;p&gt;My guess is you probably need to add the root &lt;code&gt;.domain.com&lt;/code&gt; to the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultCookieDomain&quot; rel=&quot;nofollow noreferrer&quot;&gt;defaultCookieDomain&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-02T22:16:46.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17553" PostTypeId="1" AcceptedAnswerId="17569" CreationDate="2016-11-03T09:01:57.523" Score="1" ViewCount="83" Body="&lt;p&gt;Craft CMS allows you to save entries without any validation if it's not an enabled entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to disable this? I've had a dig through the core Craft code but can't actually find the conditional that makes this happen. It doesn't seem to be in the Entries service or model or their parents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-11-03T21:37:59.370" Title="Force validation on disabled entries" Tags="&lt;entries&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17555" PostTypeId="2" ParentId="17547" CreationDate="2016-11-03T11:47:57.630" Score="1" Body="&lt;p&gt;The proper way to do this would be to use &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementAPI&lt;/a&gt;, however you could create an alternative template with a JSON header coupled with a route. &lt;/p&gt;&#xA;" OwnerUserId="4289" LastActivityDate="2016-11-03T11:47:57.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17556" PostTypeId="1" AcceptedAnswerId="17558" CreationDate="2016-11-03T12:08:38.707" Score="1" ViewCount="91" Body="&lt;p&gt;Further from yesterday's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17534/duplicate-an-existing-order-as-a-new-cart-in-commerce&quot;&gt;Duplicate an existing Order as a new Cart in Commerce&lt;/a&gt; I need to step in front of MultiAdd to set up a couple of other things - such as to duplicate the Shipping details from the old order to the new cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to do it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionReorder()&#xA;{&#xA;    // basic security precautions&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;    // get the current cart&#xA;        $cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&#xA;    // get the fields passed to us in the form&#xA;        $oldOrderNumber = craft()-&amp;gt;request-&amp;gt;getPost('oldOrderNumber');&#xA;&#xA;    // get the 'old' order&#xA;        $oldOrder = craft()-&amp;gt;commerce_orders-&amp;gt;getOrderByNumber($oldOrderNumber);&#xA;&#xA;    // set the shipping etc on the cart to the same as the old order&#xA;        $cart-&amp;gt;shippingAddressId    = $oldOrder-&amp;gt;shippingAddressId;&#xA;        $cart-&amp;gt;shippingAddress      = $oldOrder-&amp;gt;shippingAddress;&#xA;        $cart-&amp;gt;shippingMethodHandle = $oldOrder-&amp;gt;shippingMethodHandle;&#xA;&#xA;    // ok now pass it all over to the multiAdd controller...&#xA;        craft()-&amp;gt;runController('multiAdd/multiAdd');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work because &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\Commerce_OrderModel.shippingMethodHandle&quot; is read only.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have also tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;commerce_cart-&amp;gt;setShippingMethod($cart, $oldOrder-&amp;gt;shippingMethod, $error)) {&#xA;    $cart-&amp;gt;addError('shippingMethod', $error);&#xA;    LogicPlugin::log(&quot;error adding shipping method to cart: &quot; . $error, LogLevel::Error);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of $cart-&gt;shippingMethodHandle = $oldOrder-&gt;shippingMethodHandle;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that doesn't appear to work either. It tells me that the Shipping method not available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's particularly problematic for me because my Commerce set up required the Shipping address to be set in order for the Product Options to work (the options are based on the address the cart will ship to).&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-11-03T12:40:01.667" Title="Duplicating shipping details from an Order into a Cart" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17557" PostTypeId="1" AcceptedAnswerId="17560" CreationDate="2016-11-03T12:15:36.187" Score="1" ViewCount="6665" Body="&lt;p&gt;I just recently upgraded to PHP 7. The browser is now showing following error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/xxx/craft/storage isn't writable by PHP. Please fix that&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have not changed any permissions on any of the folders. How to fix this problem?&lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="57" LastEditDate="2016-11-03T21:45:28.137" LastActivityDate="2016-11-03T21:45:28.137" Title="After upgrading to PHP 7 I started getting &quot;storage folder isn't writable by PHP&quot; errors" Tags="&lt;craft-pro&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17558" PostTypeId="2" ParentId="17556" CreationDate="2016-11-03T12:40:01.667" Score="1" Body="&lt;p&gt;Simple error on my part. You don't pass the old order's &quot;shippingMethod&quot; model to the new cart's 'setShippingMethod' function. You pass the old order's shippingMethodHandle to the setShippingMethod function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionReorder()&#xA;{&#xA;    // basic security precautions&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;    // get the current cart&#xA;        $cart = craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&#xA;    // get the fields passed to us in the form&#xA;        $oldOrderNumber = craft()-&amp;gt;request-&amp;gt;getPost('oldOrderNumber');&#xA;&#xA;    // get the 'old' order&#xA;        $oldOrder = craft()-&amp;gt;commerce_orders-&amp;gt;getOrderByNumber($oldOrderNumber);&#xA;&#xA;    // set the shipping etc on the cart to the same as the old order&#xA;        $cart-&amp;gt;shippingAddressId    = $oldOrder-&amp;gt;shippingAddressId;&#xA;        $cart-&amp;gt;shippingAddress      = $oldOrder-&amp;gt;shippingAddress;&#xA;&#xA;&#xA;        if (!craft()-&amp;gt;commerce_cart-&amp;gt;setShippingMethod($cart, $oldOrder-&amp;gt;shippingMethodHandle, $error)) {&#xA;            $cart-&amp;gt;addError('shippingMethod', $error);&#xA;            LogicPlugin::log(&quot;error adding shipping method to cart: &quot; . $error, LogLevel::Error);&#xA;        }&#xA;&#xA;    // ok now pass it all over to the multiAdd controller...&#xA;        craft()-&amp;gt;runController('multiAdd/multiAdd');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-11-03T12:40:01.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17560" PostTypeId="2" ParentId="17557" CreationDate="2016-11-03T13:20:58.683" Score="4" Body="&lt;p&gt;Try resetting the permissions of the storage folder:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow&quot;&gt;https://craftcms.com/docs/installing#step-2-set-the-permissions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It's possible that PHP was running with higher-than-default permissions in the previous setup, in which case everything may have worked even if you hadn't explicitly made the storage folder writable.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2016-11-03T13:28:23.020" LastActivityDate="2016-11-03T13:28:23.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17561" PostTypeId="1" AcceptedAnswerId="17563" CreationDate="2016-11-03T15:58:51.993" Score="0" ViewCount="54" Body="&lt;p&gt;I'm struggling to figure out how to do what I need to do, and I think it's more a lack of PHP skill than Craft/Commerce per-se.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that receives POSTed data such as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;items[1][qty]&quot; value=&quot;6&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][note]&quot; value=&quot;&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][purchasableId]&quot; value=&quot;164&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][endDate]&quot; value=&quot;2026-11-03&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][friday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][monday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][startDate]&quot; value=&quot;2016-11-05&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][wednesday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[1][options][uniqueCode]&quot; value=&quot;1553135711&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&#xA;&amp;lt;input name=&quot;items[2][qty]&quot; value=&quot;6&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][note]&quot; value=&quot;&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][purchasableId]&quot; value=&quot;193&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][endDate]&quot; value=&quot;2026-11-03&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][friday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][monday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][startDate]&quot; value=&quot;2016-11-05&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][wednesday]&quot; value=&quot;2&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input name=&quot;items[2][options][uniqueCode]&quot; value=&quot;736114426&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to amend any and all inputs that represent a startDate (e.g., &lt;code&gt;&amp;lt;input name=&quot;items[1][options][startDate]&quot; value=&quot;2016-11-05&quot; type=&quot;hidden&quot;&amp;gt;&lt;/code&gt; ). Then hand over to the controller that's going to process the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In detail: this is a Commerce related thing using MultiAdd. I need to adjust those startDate values prior to handing off to MultiAdd to do it's thing. The pertinent bit of my plugin looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionReorder() {&#xA;    ... a bunch of stuff relating to the cart ...&#xA;&#xA;    // loop through all the inputs for line items and amend any startDate&#xA;        $items = craft()-&amp;gt;request-&amp;gt;getPost('items');&#xA;&#xA;        ... magic happens here ? ...&#xA;&#xA;    // ok now pass it all over to the multiAdd controller...&#xA;        craft()-&amp;gt;runController('multiAdd/multiAdd');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-11-03T16:50:25.553" Title="Editing specific fields from a POSTed form in a plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17562" PostTypeId="1" AcceptedAnswerId="17571" CreationDate="2016-11-03T16:27:28.877" Score="5" ViewCount="783" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Z8Bmp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z8Bmp.png&quot; alt=&quot;Subfolder Environment Variable&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Dt5Zo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dt5Zo.png&quot; alt=&quot;S3 subfolder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an environment variable &quot;bucketUrl&quot; that I would like to use as the subfolder path in my S3 bucket. However, Craft is not parsing the variable. When I upload an image, I see in my S3 bucket that a new subfolder &quot;{bucketUrl}&quot; was created with the uploaded image inside it. Why is Craft not parsing the environment variable? Craft is parsing my site url variable I am using elsewhere in the Craft admin, so I'm not sure why Craft is not parsing the bucket url variable.&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="1098" LastEditDate="2016-11-04T00:09:07.827" LastActivityDate="2016-11-04T00:09:07.827" Title="Using Craft environment variable for Asset source subfolder" Tags="&lt;s3&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17563" PostTypeId="2" ParentId="17561" CreationDate="2016-11-03T16:50:25.553" Score="2" Body="&lt;p&gt;You will want to use PHP's &lt;code&gt;foreach&lt;/code&gt; to loop over each of the items (using &lt;code&gt;$i&lt;/code&gt; here to keep track of the index). Then if the current item has a start date, do whatever it is you need to edit it inside the loop. Once you've finished iterating over each item, you will need to set that &lt;em&gt;back&lt;/em&gt; to &lt;code&gt;$_POST['items']&lt;/code&gt;, so that the MultiAdd plugin can pick up your modified array as usual, using &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('items')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionReorder() {&#xA;    // ... a bunch of stuff relating to the cart ...&#xA;&#xA;    // loop through all the inputs for line items and amend any startDate&#xA;    $items = craft()-&amp;gt;request-&amp;gt;getPost('items');&#xA;&#xA;    foreach ($items as $i =&amp;gt; $item)&#xA;    {&#xA;        if (isset($item['options']['startDate']))&#xA;        {&#xA;            $items[$i]['options']['startDate'] = '???';&#xA;        }&#xA;    }&#xA;&#xA;    // re-set back to $_POST&#xA;    $_POST['items'] = $items;&#xA;&#xA;    // ok now pass it all over to the multiAdd controller...&#xA;    craft()-&amp;gt;runController('multiAdd/multiAdd');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2016-11-03T16:50:25.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17564" PostTypeId="1" AcceptedAnswerId="17696" CreationDate="2016-11-03T16:53:24.247" Score="1" ViewCount="322" Body="&lt;p&gt;Recently, anytime an update to Craft core or a plugin is attempted on my site that requires a database migration I get an Internal Server Error: Could not validate update handle. Does anyone know what handle Craft is talking about here? Looking for help debugging this issue. My guess is that somewhere in the midst of updates and rollbacks the database got out of sync with the source code. Just need to track down where this faulty handle is.&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-11-11T22:03:29.067" Title="Update Error: Could not validate update handle" Tags="&lt;error&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="17565" PostTypeId="1" AcceptedAnswerId="17566" CreationDate="2016-11-03T18:29:31.080" Score="4" ViewCount="6871" Body="&lt;p&gt;I've cloned an existing Craft site into MAMP Pro, set up my database in sequel pro and am able to access the site's homepage when I go to the URL I set up in MAMPS hosts. But whenever I click on a link, or try to access /admin, I get the following&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Not Found&lt;br&gt;&#xA;  The requested URL /(page name) was not found on this server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm sure it's something simple, probably something I'm missing when I set up the site locally, but I'm at a loss. &lt;/p&gt;&#xA;" OwnerUserId="5732" LastEditorDisplayName="user1080" LastEditDate="2017-05-11T05:42:45.667" LastActivityDate="2017-05-11T05:42:45.667" Title="The requested URL was not found on this server" Tags="&lt;url&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17566" PostTypeId="2" ParentId="17565" CreationDate="2016-11-03T19:18:53.703" Score="5" Body="&lt;p&gt;Try going to yoursite.com/index.php/(pagename). If that works, check out this article on how to remove it: &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2016-11-03T19:18:53.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17567" PostTypeId="1" AcceptedAnswerId="17570" CreationDate="2016-11-03T20:22:18.013" Score="3" ViewCount="360" Body="&lt;p&gt;Is there a way to remove the 2 Craft specific menu items from Redactor's Link menu without losing access to the &quot;Insert link&quot; menu item?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing the Link button in the redactor configs is too draconian as I don't want to lose access to the basic Insert and Unlink functions previously in that menu. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've dug into the src, and the only hook/event I can find related to the redactor settings allows addition of menu items to the Links menu, but not removal of the Craft added &quot;Link to an Entry&quot; and &quot;Link to a Category&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Td9Ux.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Td9Ux.png&quot; alt=&quot;Rich text field with link menu exposed with menu items crossed out.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="502" LastActivityDate="2019-06-13T20:22:50.437" Title="How to remove Link To Category from Redactor" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17568" PostTypeId="1" CreationDate="2016-11-03T21:23:23.387" Score="2" ViewCount="595" Body="&lt;p&gt;Coming from the EE world, when I need a hierarchical site structure along with sections that have channel-type content, I use the Structure add-on for EE. Events, for example, go in a listing channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L0B7Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L0B7Q.png&quot; alt=&quot;Events&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, while there is far more flexibility among the three section types: structure, channel, and single, there is no facility to create something akin to &lt;strong&gt;Structure for EE&lt;/strong&gt;'s listing channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I did instead. I created one master section of the structure type, and a whole bunch of different entry types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vsj2q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vsj2q.png&quot; alt=&quot;Master structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each landing page, for example, Staff, calls a template that aggregates content from a channel (which is distinct from the master section). This keeps content neatly segregated - I don't want items that are listings (news, events, staff, etc.) clogging up the master section - it would end up with hundreds of entries over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the staff channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VNrPN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VNrPN.png&quot; alt=&quot;Staff channel&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the staff landing page, part of the &lt;strong&gt;master&lt;/strong&gt; section just calls all the entries in the staff channel, and each entry links to a detail page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('staff') %}&#xA;  &amp;lt;a href=&quot;/about/staff/{slug}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Overall, this method works very well. However, creating navigation is messy. Why? In order to load the staff detail page, I have to link to entries and their template which &lt;strong&gt;lie outside the master section&lt;/strong&gt;, so I can't navigation or create breadcrumbs with Craft's {% nav %} tag or a for loop. Also, I have to hard code the full path to the staff detail template, which includes its parents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wcVvc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wcVvc.png&quot; alt=&quot;Staff section&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How are others solving this problem?&lt;/li&gt;&#xA;&lt;li&gt;Is there a better way to make the staff detail entry url format more dynamic, in case the client decides to move the staff parent page elsewhere? Currently, if they move it out of about/staff, the staff detail urls are no longer correct.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2016-11-14T19:09:23.553" Title="Creating a manageable site structure" Tags="&lt;entries&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17569" PostTypeId="2" ParentId="17553" CreationDate="2016-11-03T21:37:59.370" Score="1" Body="&lt;p&gt;Sounds like the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/always-validate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Always Validate&lt;/a&gt; plugin does what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-03T21:37:59.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17570" PostTypeId="2" ParentId="17567" CreationDate="2016-11-03T22:09:29.603" Score="1" Body="&lt;p&gt;I don't think there's an easy way to do this natively in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could pull it off with combination of &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-cpcss&lt;/a&gt; and/or &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-cpcjs&lt;/a&gt; and manipulate the DOM directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe by going from the Redactor site and listening to their &lt;a href=&quot;https://imperavi.com/redactor/docs/callbacks/events/#callback-click&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt; event.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-03T22:09:29.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17571" PostTypeId="2" ParentId="17562" CreationDate="2016-11-03T22:11:43.517" Score="4" Body="&lt;p&gt;From the &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs#setting-support&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt;, environment variables are currently only parsed in 3 places in the control panel. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File System Path (in asset source settings)&lt;/li&gt;&#xA;&lt;li&gt;URL (in asset source settings)&lt;/li&gt;&#xA;&lt;li&gt;Site URL (in Settings → General)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So they won't work in the &quot;subfolder&quot; setting.  You can add a &lt;a href=&quot;https://feedback.craftcms.com&quot; rel=&quot;noreferrer&quot;&gt;feature request&lt;/a&gt; if you think that should change.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-03T22:11:43.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17572" PostTypeId="1" AcceptedAnswerId="17644" CreationDate="2016-11-03T22:31:52.393" Score="1" ViewCount="154" Body="&lt;p&gt;I pretty much followed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1171/how-to-add-a-tags-field-to-an-entry-form?rq=1&quot;&gt;this&lt;/a&gt; and the answer there really helped me a lot so far. Currently I'm stuck with either a &lt;code&gt;500 (Internal Server Error)&lt;/code&gt; or a &lt;code&gt;400 (Bad Request)&lt;/code&gt; Error.&#xA;My &lt;code&gt;craft/storage/runtime/logs/craft.log&lt;/code&gt; read the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;400&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [exception.Craft\HttpException.400] Craft\HttpException: POST param “title” doesn’t exist. in XXX/craft/app/services/HttpRequestService.php:509&#xA;Stack trace:&#xA;0 XXX/craft/app/controllers/TagsController.php(235): Craft\HttpRequestService-&amp;gt;getRequiredPost('title')&#xA;1 XXX/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TagsController-&amp;gt;actionCreateTag()&#xA;2 XXX/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;3 XXX/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;4 XXX/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;5 XXX/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('createTag')&#xA;6 XXX/craft/app/etc/web/WebApp.php(818): CWebApplication-&amp;gt;runController('tags/createTag')&#xA;7 XXX/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;8 XXXcraft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;9 XXX/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;10 XXX/index.php(19): require_once('/var/www/vhosts...')&#xA;11 {main}&#xA;REQUEST_URI=/actions/tags/createTag&#xA;HTTP_REFERER=XXX&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I add &lt;code&gt;title: &quot;Tags&quot;&lt;/code&gt; to the &lt;code&gt;POST data&lt;/code&gt; it results in the &lt;code&gt;500&lt;/code&gt; with following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`craft_`.`craft_tags`, CONSTRAINT `craft_tags_groupId_fk` FOREIGN KEY (`groupId`) REFERENCES `craft_taggroups` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_tags` (`uid`, `groupId`, `id`, `dateUpdated`, `dateCreated`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4).&#xA;2016/11/03 22:16:01 [error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`craft_`.`craft_tags`, CONSTRAINT `craft_tags_groupId_fk` FOREIGN KEY (`groupId`) REFERENCES `craft_taggroups` (`id`) ON DELETE CASCADE) in XXX/craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 XXX/craft/app/framework/db/ar/CActiveRecord.php(1081): CDbCommand-&amp;gt;execute()&#xA;#1 XXX/craft/app/framework/db/ar/CActiveRecord.php(810): CActiveRecord-&amp;gt;insert(NULL)&#xA;#2 XXX/craft/app/services/TagsService.php(396): CActiveRecord-&amp;gt;save(false)&#xA;#3 XXX/craft/app/controllers/TagsController.php(237): Craft\TagsService-&amp;gt;saveTag(Object(Craft\TagModel))&#xA;#4 XXX/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TagsController-&amp;gt;actionCreateTag()&#xA;#5 XXX/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#6 XXX/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#7 XXX/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#8 XXX/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('createTag')&#xA;#9 XXX/craft/app/etc/web/WebApp.php(818): CWebApplication-&amp;gt;runController('tags/createTag')&#xA;#10 XXX/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#11 XXX/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#12 XXX/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#13 XXX/index.php(19): require_once('/var/www/vhosts...')&#xA;#14 {main}&#xA;REQUEST_URI=/actions/tags/createTag&#xA;HTTP_REFERER=XXX&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be much appreciated. This is the JS code I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#new-tag').click(function() {&#xA;    var name = prompt('What’s the new tag name?');&#xA;    if (!name) return;&#xA;    var data = {&#xA;        title: 'tags',&#xA;        groupId: 2,&#xA;        name: name&#xA;    };&#xA;    $.post('/actions/tags/createTag', data, function(response) {&#xA;        if (response.success) {&#xA;            $('&amp;lt;label&amp;gt;' +&#xA;            '&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[tags][]&quot; value=&quot;'+response.id+'&quot; checked=&quot;checked&quot;/&amp;gt; ' +&#xA;            name +&#xA;            '&amp;lt;/label&amp;gt;').appendTo($('#tags'));&#xA;        }&#xA;        else {&#xA;            alert('Unable to create that tag.');&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5855" LastEditorUserId="5855" LastEditDate="2016-11-04T09:05:07.370" LastActivityDate="2016-11-08T21:35:04.183" Title="Tags via AJAX actionTrigger" Tags="&lt;form&gt;&lt;entry&gt;&lt;ajax&gt;&lt;tags&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17573" PostTypeId="2" ParentId="936" CreationDate="2016-11-04T00:06:43.337" Score="2" Body="&lt;p&gt;I wrote &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;a plugin called Retcon&lt;/a&gt; which uses &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DOMDocument&lt;/a&gt; to rewrite HTML content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you could unwrap your images using the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Unwrap&quot; rel=&quot;nofollow noreferrer&quot;&gt;retconUnwrap&lt;/a&gt; filter in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconUnwrap('img') }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Of course, this won't actually remove the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags in your content; it'll only strip them out when that content is rendered.)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-04T00:06:43.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17575" PostTypeId="1" AcceptedAnswerId="17577" CreationDate="2016-11-04T10:05:48.223" Score="1" ViewCount="868" Body="&lt;p&gt;I'm trying out the new FeedMe plugin v2 beta 1 and am trying to download my recent photos posted on Instagram via the Instagram API. It appears Instagram is appending a cache parameters to the end of image URLs so when I try to download the images to a CraftCMS Assets folder Craft doesn't allow me to as it's not an allowed file extension. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific example is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instagram Request to get recent posts:&#xA;&lt;a href=&quot;https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example URL for image returned:&#xA;somepic_n.jpg?ig_cache_key=hghhh....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any bright ideas how to handle this so I can download the images at the URLs or some option / feature then could be incorporated into the plugin to remove querystrings from the end of asset urls?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="2197" LastEditorUserId="57" LastEditDate="2016-11-04T18:28:22.483" LastActivityDate="2016-11-04T18:28:22.483" Title="Craft CMS FeedMe plugin - Process Instagram JSON Feed" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17577" PostTypeId="2" ParentId="17575" CreationDate="2016-11-04T11:55:37.810" Score="3" Body="&lt;p&gt;Check out the &lt;code&gt;cleanAssetUrls&lt;/code&gt; configuration added just for you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sgroup.com.au/plugins/feedme/getting-started/configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sgroup.com.au/plugins/feedme/getting-started/configuration&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-11-04T11:55:37.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17579" PostTypeId="1" CreationDate="2016-11-04T14:32:02.790" Score="1" ViewCount="417" Body="&lt;p&gt;So, I'm currently building out an eCommerce site for a client. I'm adding products to the cart via AJAX. I'm then sliding out a 'Cart' view panel with the current cart contents, which is being updated with Craft's JSON response for the cart. (Via &lt;code&gt;response.cart&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is this: I need to display the thumbnail image of a product, and there doesn't seem to be anywhere I can get the asset field (or any fields) associated with the product. There is no &lt;code&gt;purchasable&lt;/code&gt; key in the cart object, just a &lt;code&gt;purchasableId&lt;/code&gt;. I've looked in the &lt;code&gt;snapshot&lt;/code&gt; object within &lt;code&gt;lineItems&lt;/code&gt;, and in the &lt;code&gt;product&lt;/code&gt; object within that &lt;code&gt;snapshot&lt;/code&gt; object. There doesn't seem to be any asset field (or any field) attached to this information at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can make an additional request to fetch that information, but I'd like to avoid that if at all possible; I'm hoping it's just buried somewhere in the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated! Let me know if I need to clarify something.&lt;/p&gt;&#xA;" OwnerUserId="5858" LastActivityDate="2016-11-05T05:35:57.133" Title="Displaying assets from Craft's cart AJAX response" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17580" PostTypeId="1" CreationDate="2016-11-04T16:02:35.607" Score="2" ViewCount="3073" Body="&lt;p&gt;Our client build tons of articles in our craft system instead of &lt;em&gt;his&lt;/em&gt;. Both systems have the identical structure, in fact, his system is a exact copy of ours, which runs on a different server. How can we move all &lt;em&gt;his&lt;/em&gt; content on  &lt;em&gt;our&lt;/em&gt;  craft system into  &lt;em&gt;his&lt;/em&gt;  system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As you may have noticed I am not a developer. I hope you get what my problem is here ... )&lt;/p&gt;&#xA;" OwnerUserId="5082" LastEditorUserId="57" LastEditDate="2017-07-11T21:17:37.117" LastActivityDate="2017-07-11T21:17:37.117" Title="How can I export or move content from one Craft system into another? (with exactly the same configuration)" Tags="&lt;migration&gt;&lt;import&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17582" PostTypeId="1" CreationDate="2016-11-04T19:36:35.153" Score="1" ViewCount="74" Body="&lt;p&gt;I have two types of related entries for the current entry.&#xA;Category: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Interviews -&gt; Photographer&lt;/li&gt;&#xA;&lt;li&gt;Interviews -&gt; Skateboarder&lt;/li&gt;&#xA;&lt;li&gt;Interviews -&gt; Filmer&lt;/li&gt;&#xA;&lt;li&gt;Interviews -&gt; Owner&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am now on an entry with the child category &quot;Skateboarder&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first i get entries of the same child category, so random entries of the childcategory &quot;skateboarder&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedCategory = craft.entries({&#xA;  section: 'news',&#xA;  relatedTo: entry.newsCategory.level(2),&#xA;  id: 'not ' ~ entry.id,&#xA;  order: 'RAND()',&#xA;  limit: 3  &#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My second goal is now to get other entries from the parent category &quot;Interviews&quot; BESIDES the current childcategory (Skateboarder)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So only random entries of the child categories Photographer, Filmer, Owner...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do i get this? :)&#xA;thx!!!&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="57" LastEditDate="2016-11-04T20:29:37.580" LastActivityDate="2016-11-04T20:29:37.580" Title="Get Related entries from Category besides the category of the entry itself" Tags="&lt;entry&gt;&lt;category&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17583" PostTypeId="2" ParentId="17532" CreationDate="2016-11-04T19:46:17.433" Score="2" Body="&lt;p&gt;To listen to Craft Commerce order save event, you must make a new plugin (or use an existing one) and in it's &lt;code&gt;::init()&lt;/code&gt; method, listen to the &lt;code&gt;commerce_orders.onSaveOrder&lt;/code&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class TestPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        craft()-&amp;gt;on(&#xA;            &quot;commerce_orders.onSaveOrder&quot;,&#xA;            function (Commerce_OrderModel $order) {&#xA;                // Create the event&#xA;                $event = new Calendar_EventModel();&#xA;&#xA;                $event-&amp;gt;getContent()-&amp;gt;title = &quot;New Event Title&quot;;&#xA;                $event-&amp;gt;slug                = &quot;new-event-title&quot;;&#xA;&#xA;                // Any custom fields go through the ::getContent() model&#xA;                $event-&amp;gt;getContent()-&amp;gt;body = &quot;This is a custom rich text field&quot;;&#xA;&#xA;                // Do whatever you need to do with the order data&#xA;                // By using the $order OrderModel&#xA;                // For example:&#xA;                //&#xA;                // $event-&amp;gt;getContent()-&amp;gt;body = &quot;Order total: &quot; . $order-&amp;gt;totalPrice;&#xA;&#xA;                // Mandatory fields&#xA;                $event-&amp;gt;calendarId = 1;&#xA;                $event-&amp;gt;authorId   = craft()-&amp;gt;getUser()-&amp;gt;id;&#xA;                $event-&amp;gt;startDate  = new DateTime();&#xA;                $event-&amp;gt;endDate    = new DateTime();&#xA;&#xA;                $event-&amp;gt;allDay = true;&#xA;&#xA;                // Save the event using Calendar Events service ::saveEvent() method&#xA;                craft()-&amp;gt;calendar_events-&amp;gt;saveEvent($event);&#xA;            }&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-11-04T19:46:17.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17584" PostTypeId="2" ParentId="17580" CreationDate="2016-11-04T21:11:44.240" Score="1" Body="&lt;p&gt;You should be able to back up the database in the Settings panel in &lt;em&gt;your&lt;/em&gt; version of Craft, and then drop the database on &lt;em&gt;his&lt;/em&gt; server in PHPmyAdmin and load in the backup. This will replace everything on his server with what's on yours.&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2016-11-04T21:11:44.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17585" PostTypeId="2" ParentId="17580" CreationDate="2016-11-04T21:17:50.923" Score="1" Body="&lt;p&gt;If your systems are &lt;em&gt;exactly&lt;/em&gt; the same, you should be able to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) back up the Craft database for each system: client and 'ours'. This is your protection against errors or unknown issues, so don't skip it please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) if your backup isn't a kind to create a full structure and content sql file for each database, make this kind of backup also, for safety and for the actual transfer of content that you want. A tool like Navicat should make this very easy, but your database administrator will know how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) you're fully backed up, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;d) on the 'client' system, delete all tables in the Craft database, or drop the database itself, in which case you'll have to re-create it,set utf8mb4 character and sort, and add back allowed users. Again, a tool like Navicat can make this easy, and your database administrator should know how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e) with the now-empty 'client' database, execute (play back) the structure and content sql file from the 'ours' system, that you createdd in step a) or b)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f) now the 'client' system is running with the same data as the 'ours' system, so you will have successfully transferred the work they did there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat. If the client actually did some work on their system, like setting up users or adding/changing content, this would be lost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recovering it from the backup won't be possible, as complex record identities and relations won't be the same. The way to prepare for this is to re-key any extra work like this into the 'ours' Craft system, before you do the backups and start the above procedure. If you don't prepare this way, then you can re-key on the client system after you've moved the 'ours' data to it as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I've covered everything, but have your database administrator look at these notes and have a think about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good fortune, and since you're near the beginning, probably the worst that could happen is to need more re-keying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This procedure is the one many developers use all the time -- it's standard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have doubts, please don't use this process; instead, re-key the missing work, as that will be safest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the procedure fails, you will have your structure-and-content sql file, and can replay it into the client database after emptying it again, to restore the current situation. Or use your other database backup restore method from step a), if there was one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best fortune, then.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2016-11-05T06:03:36.017" LastActivityDate="2016-11-05T06:03:36.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17586" PostTypeId="2" ParentId="17580" CreationDate="2016-11-04T23:58:50.033" Score="3" Body="&lt;p&gt;This can be a challenging situation. Craft content can be highly relational which makes it tricky to just export and re-import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scenario 1: &lt;em&gt;If your database and your clients database were both equivalent before your client added the additional content, you may be able to just migrate over your clients database and replace your own database and get both back in sync.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To &lt;strong&gt;migrate the database&lt;/strong&gt; would involve exporting the database from the clients environment (either via &lt;code&gt;Settings-&amp;gt;Tools-&amp;gt;Backup Database&lt;/code&gt; or via a database admin tool) and reimporting it into your environment with a database admin tool. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scenario 2: &lt;em&gt;If both you and your client made changes to your respective databases (for example, you both added articles in each environment) and you need to preserve the new articles added in your environment while also migrating over the articles added in the clients environment you have two options.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you could just &lt;strong&gt;manually re-enter the articles&lt;/strong&gt; in the right environment. As it sounds like your client added a lot of articles, that might be time consuming, but sometimes these types of mistakes take time to correct manually. It's often the best option.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case you added a few articles and your client added many articles, it may make more sense to add your articles to your clients database and then migrate the full database back to your servers as described in Scenario 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second option would be to &lt;strong&gt;migrate the content programmatically&lt;/strong&gt;. This becomes a bit more technical so you'd probably need to get a front-end or back-end developer involved. And it will only make sense to go this route if the quantity of data you need to migrate is too much to just do manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plugin like &lt;a href=&quot;http://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; can help with this scenario. (Full disclosure, my team developed Sprout Import.) The steps would involve outputting the content from your clients database into a template into an importable JSON format. And then importing the content defined in the JSON file into your database.  The docs and examples within the plugin would go into more detail about the exact format you would need. For this answer, the more general point is that if your data was complex enough, a database migration plugin like Sprout Import could help provide a path toward a solution.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-11-05T01:38:55.460" LastActivityDate="2016-11-05T01:38:55.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17588" PostTypeId="2" ParentId="17579" CreationDate="2016-11-05T05:35:57.133" Score="1" Body="&lt;p&gt;The cart response definitely does not include direct access to fields on the product.  You will need to make an extra request for the information...of course you'd need to make an extra request for the image itself anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One easy way of implement what you want is to simply update your cart view by ajax instead loading a template into it (rather than targeting values and using the response.cart object).  In that template you would just get the cart as normal, and therefore have access to all the product fields via that as you loop through the lineitems.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-05T05:35:57.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17589" PostTypeId="1" AcceptedAnswerId="17592" CreationDate="2016-11-05T06:12:31.187" Score="2" ViewCount="713" Body="&lt;p&gt;How can you access the parent of a section using the Element API? I have the following where I use the &lt;code&gt;getParent()&lt;/code&gt; function which does return an empty object when an entry has a parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to pass in the element criteria model or something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also could someone expand on this to show how you just get the level 1 parent or the level 2 parent please.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'brands.json' =&amp;gt; [&#xA;      'elementType' =&amp;gt; 'Entry',&#xA;      'criteria' =&amp;gt; ['section' =&amp;gt; 'brand'],&#xA;      'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            'level' =&amp;gt; $entry-&amp;gt;level,&#xA;            'parent' =&amp;gt; $entry-&amp;gt;getParent()-&amp;gt;first(),&#xA;        ];&#xA;      },&#xA;    ],&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastActivityDate="2016-11-05T16:59:34.803" Title="Get parent entry from a section using the Element API" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17590" PostTypeId="1" AcceptedAnswerId="17591" CreationDate="2016-11-05T14:03:41.133" Score="1" ViewCount="107" Body="&lt;p&gt;I have been a wordpress user for the longest time, a friend of mine now uses Craft, I took a look at his backend and really liked the way he creates his content in it. I also like that it uses Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I watched some of the Craft movies on the website about the entry types, structures etc. but it would be of some help if some experienced user could help me with the question if Craft is the right choice for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a small magazine website about movies, so I would need the following structure:&#xA;- Movies (a list of movies, when I click on a movie I would like to have a list of all news, reviews regarding to this movie)&#xA;- News &#xA;- Reviews&#xA;- Directors (a list of directors, when I click on the director I would like to display a list of all of this directors movies)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible out of the box with Craft CMS? I'd be thankful for any hint on how you would realize this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards&#xA;Florian&lt;/p&gt;&#xA;" OwnerUserId="5859" LastEditorUserId="22" LastEditDate="2017-05-09T20:52:06.903" LastActivityDate="2017-05-09T20:52:06.903" Title="Magazine possible in Craft?" Tags="&lt;categories&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17591" PostTypeId="2" ParentId="17590" CreationDate="2016-11-05T14:13:41.770" Score="5" Body="&lt;p&gt;you can do all of that with Craft CMS, the thing you're searching for are &quot;related entries&quot; where you can relate news to a certain movie ... director ... basically you can relate everything to everything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find more information about relationships here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5860" LastActivityDate="2016-11-05T14:13:41.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17592" PostTypeId="2" ParentId="17589" CreationDate="2016-11-05T16:59:34.803" Score="5" Body="&lt;p&gt;A couple of issues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the &lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel#getParent-detail&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;EntryModel::getParent()&lt;/code&gt;&lt;/a&gt; method returns an &lt;a href=&quot;https://craftcms.com/classreference/models/EntryModel&quot; rel=&quot;noreferrer&quot;&gt;EntryModel&lt;/a&gt;, not an &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which means that calling &lt;code&gt;getParent()-&amp;gt;first()&lt;/code&gt; will throw an exception. In other words, you'll need to remove the call to &lt;code&gt;first()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you'll need to be specific about which fields you want to return from your parent entry – just passing in the raw EntryModel won't work – so your code should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    $parent = $entry-&amp;gt;getParent();&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'level' =&amp;gt; $entry-&amp;gt;level,&#xA;        'parent' =&amp;gt; $parent ? [&#xA;            'title' =&amp;gt; $parent-&amp;gt;title,&#xA;            'url' =&amp;gt; $parent-&amp;gt;url,&#xA;            'someCustomField' =&amp;gt; $parent-&amp;gt;someCustomField,&#xA;        ] : null,&#xA;    ];&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above, I'm using a ternary operator to conditionally include the array containing the parent entry's data (the condition being if the parent entry exists or not). If you want your code to be less &quot;inline&quot;, you could also do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;    $parent = $entry-&amp;gt;getParent();&#xA;    $return = [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'level' =&amp;gt; $entry-&amp;gt;level&#xA;    ];&#xA;    if ($parent) {&#xA;        $return['parent'] = [&#xA;            'title' =&amp;gt; $parent-&amp;gt;title,&#xA;            'url' =&amp;gt; $parent-&amp;gt;url,&#xA;            'someCustomField' =&amp;gt; $parent-&amp;gt;someCustomField,&#xA;        ];&#xA;    }&#xA;    return $return;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, if you need to be specific about the parent entry's level, you'll need to swap out the &lt;code&gt;getParent()&lt;/code&gt; method for &lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel#getAncestors-detail&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;EntryMode::getAncestors()&lt;/code&gt;&lt;/a&gt; (which &lt;em&gt;does&lt;/em&gt; return an ElementCriteriaModel). Here's how you'd get the top level parent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$parent = $entry-&amp;gt;getAncestors()-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and since &lt;code&gt;getAncestors()&lt;/code&gt; returns an ECM, pulling a parent entry with a specific level is trivial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$parent = $entry-&amp;gt;getAncestors()-&amp;gt;level(2)-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-05T16:59:34.803" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17594" PostTypeId="1" AcceptedAnswerId="17600" CreationDate="2016-11-05T22:47:25.310" Score="0" ViewCount="862" Body="&lt;p&gt;How would I enable search in a single section only?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want my search results template to be used regardless of which search option is used. Ideally I'm looking to pass another value from my search form to the search results to do &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% paginate craft.entries.search(query).section(sectionPassedFromSearchForm).limit(5) as entries %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-11-06T04:46:45.583" Title="Search in section only" Tags="&lt;search&gt;&lt;sections&gt;&lt;include&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17595" PostTypeId="1" AcceptedAnswerId="17596" CreationDate="2016-11-05T23:26:15.483" Score="1" ViewCount="188" Body="&lt;p&gt;How do I parse the breadcrumbs code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level &amp;gt; 1 %}&#xA;    &amp;lt;ul class=&quot;crumbs&quot;&amp;gt;&#xA;        {% for crumb in entry.getAncestors() %}&#xA;            &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into lowercase?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home &amp;gt; blog &amp;gt; entry title &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  home &amp;gt; blog &amp;gt; entry title &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-11-05T23:34:09.173" Title="lowercase breadcrumbs" Tags="&lt;case&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17596" PostTypeId="2" ParentId="17595" CreationDate="2016-11-05T23:34:09.173" Score="5" Body="&lt;p&gt;You can do this with CSS, or with Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ul.crumbs li {&#xA;  text-transform: lowercase;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…or, if you need to start &lt;em&gt;after&lt;/em&gt; a particular index…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ul.crumbs li:nth-child(n + 2) { /* Start with the 2nd `li` */&#xA;  text-transform: lowercase;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level &amp;gt; 1 %}&#xA;  &amp;lt;ul class=&quot;crumbs&quot;&amp;gt;&#xA;    {% for crumb in entry.getAncestors() %}&#xA;      {# Build the link yourself, passing just the title through the `lower` filter: #}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ crumb.url }}&quot;&amp;gt;{{ crumb.title | lower }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2016-11-05T23:34:09.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17597" PostTypeId="1" AcceptedAnswerId="17606" CreationDate="2016-11-06T00:45:22.197" Score="0" ViewCount="163" Body="&lt;p&gt;My Entry URL Format looks like this: &lt;code&gt;{section}/{slug}&lt;/code&gt; and I am using the standard breadcrumbs code;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% if entry.level &amp;gt; 1 %}&#xA;    &amp;lt;ul class=&quot;crumbs&quot;&amp;gt;&#xA;        {% for crumb in entry.getAncestors() %}&#xA;            &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will parse:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home &amp;gt; article &amp;gt; entry-title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how can you add the {section} in as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home &amp;gt; section name &amp;gt; article &amp;gt; entry-title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-11-06T21:40:47.730" Title="Adding section in breadcrumbs" Tags="&lt;navigation&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17598" PostTypeId="1" CreationDate="2016-11-06T01:41:44.093" Score="0" ViewCount="60" Body="&lt;p&gt;How do I access the Dropdown Option Label in this matrix?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;post-weather&quot;&amp;gt;&#xA;    {% for block in entry.weather %}&#xA;        {% if block.type == &quot;condition&quot; %}&#xA;            &amp;lt;span data-tooltip aria-haspopup=&quot;true&quot; title=&quot;{{ condition.label }}&quot; class=&quot;has-tip wi {{ block.condition }}&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;        {% elseif block.type == &quot;temperature&quot; %}&#xA;            &amp;lt;p class=&quot;post-temperature right&quot;&amp;gt;&#xA;            {{ block.degrees }}&#xA;            &amp;lt;sup&amp;gt;°C&amp;lt;/sup&amp;gt;&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="45" LastEditDate="2016-11-06T04:06:43.437" LastActivityDate="2016-11-06T04:06:43.437" Title="Parsing a Dropdown Option Label in Matrix" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17599" PostTypeId="1" AcceptedAnswerId="18186" CreationDate="2016-11-06T02:57:06.540" Score="0" ViewCount="600" Body="&lt;p&gt;This question is identical to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9162/resaving-blog-entries-keeps-failing&quot;&gt;Resaving blog entries keeps failing&lt;/a&gt; except that I'm not finding any [error] or [warning] in my log entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have changed my entry URL format for the section named Events from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{mainCategory.last().uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{mainCategory.last().uri}/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as described here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8226/is-it-possible-to-view-expired-entrys-on-the-front-end&quot;&gt;Is it possible to view 'Expired' entrys on the front end?&lt;/a&gt; and when I hit save on the section page, then it immediately gives the failed task: Resaving Events entries. Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, I did find this error:&#xA;2016/12/18 02:26:41 [error] [application] Encountered an error running task 422 (ResaveElements), step 2 of 197: Encountered the following validation errors when trying to save entry element &quot;Transforming Work&quot; with the ID &quot;19&quot;:&#xA; - URI &quot;fort-collins/weekly/buddhist-meditation-classes/_entry&quot; has already been taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure quite what it means. There's only one entry named Transforming Work.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-12-18T08:03:08.623" Title="Resaving Events Entries failed" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17600" PostTypeId="2" ParentId="17594" CreationDate="2016-11-06T04:46:45.583" Score="1" Body="&lt;p&gt;You would just pass the other value (i.e. the section handle) in to that template as GET or POST parameter and in the search results template grab the paramater and use it, as in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If using GET, the url you'd construct would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://whatever.com/search?query=blah&amp;amp;sectionHandle=blah2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or with POST you might use e.g. a radio for the section option with the &lt;code&gt;name&lt;/code&gt; being &lt;code&gt;sectionHandle&lt;/code&gt; and the &lt;code&gt;value&lt;/code&gt; being the actual handle of the chosen section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, in your template you then just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionHandle = craft.request.getParam(sectionHandle) %}&#xA;{% paginate craft.entries.search(query).section(sectionHandle).limit(5) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-06T04:46:45.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17601" PostTypeId="1" AcceptedAnswerId="17602" CreationDate="2016-11-06T13:40:36.510" Score="2" ViewCount="111" Body="&lt;p&gt;My runtime/cache folder is over 200GB in size. Is there a config setting or some way of limiting the size of the folder, rather than the cache duration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, what could cause such disk usage?&lt;/p&gt;&#xA;" OwnerUserId="100" LastActivityDate="2016-11-06T16:11:20.513" Title="How to limit cache folder size" Tags="&lt;cache&gt;&lt;filecache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17602" PostTypeId="2" ParentId="17601" CreationDate="2016-11-06T16:11:20.513" Score="2" Body="&lt;p&gt;There's not a native Craft way to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could setup a cron job that hit a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; and delete items in cache based on size/date created, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you've got a plugin installed doing some heavy caching. You can try opening the largest cache files (it's all just serialized text data) and see if the type of data gives you a clue to where it's coming from.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-06T16:11:20.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17603" PostTypeId="2" ParentId="15984" CreationDate="2016-11-06T17:38:27.350" Score="2" Body="&lt;p&gt;Bit of a late reply (But hope you can use this!), but I created a plugin to output barcodes within Craft templates via Twig:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/madebyshape/barcode&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/madebyshape/barcode&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created it because one of our clients required a barcode to be output in to a generated PDF that got sent to their customers.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2016-11-06T17:38:27.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17604" PostTypeId="1" AcceptedAnswerId="17605" CreationDate="2016-11-06T19:22:41.733" Score="1" ViewCount="88" Body="&lt;p&gt;Is there a way to either add a parent selector to the category field modal, or remove/hide the &quot;+ New Category&quot; button when editing an entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are using a category group to contain Locations, which are nested as State &gt; County &gt; City. I recently noticed that several new Cities have been added to the site, but they are all at the root level instead of being nested under the correct State and County parent categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because when an author creates a new City via the Location field modal while adding or editing an entry, there is no visible way to specify a parent like there is when adding it from the main Categories CP area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see this getting out-of-hand quickly without some way to keep these categories nested properly, so any advice would be appreciated.  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4170" LastActivityDate="2016-11-06T20:53:30.417" Title="Limitation of adding a Category from the CP field modal within an entry" Tags="&lt;categories&gt;&lt;control-panel&gt;&lt;field&gt;&lt;modal&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17605" PostTypeId="2" ParentId="17604" CreationDate="2016-11-06T20:53:30.417" Score="1" Body="&lt;p&gt;The easiest solution is to simply hide that DOM element using &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2016-11-06T20:53:30.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17606" PostTypeId="2" ParentId="17597" CreationDate="2016-11-06T21:40:47.730" Score="1" Body="&lt;p&gt;I don't believe there's a more &quot;magic&quot; way than just hard coding the first list item/link, i.e. something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level &amp;gt; 1 %}&#xA;    &amp;lt;ul class=&quot;crumbs&quot;&amp;gt;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/{{ entry.section.handle }}&quot;&amp;gt;{{ entry.section.name }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% for crumb in entry.getAncestors() %}&#xA;            &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-06T21:40:47.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17607" PostTypeId="1" AcceptedAnswerId="17933" CreationDate="2016-11-06T21:45:10.763" Score="2" ViewCount="1088" Body="&lt;p&gt;What is the preferred image handling method when using the WYSIWYG editor? Are inline transforms the only way to prevent large images, or are there any other solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I am aware of offering more control by &quot;bodybuilding&quot; the front end, this question is specifically related to the WYSIWYG editor.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2016-11-17T19:58:32.387" LastActivityDate="2016-11-28T22:19:02.590" Title="Redactor II image resizing?" Tags="&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17608" PostTypeId="1" CreationDate="2016-11-06T23:43:03.690" Score="0" ViewCount="89" Body="&lt;p&gt;Anyone know what could be wrong? It doesn't load files residing in /craft/templates/js that I include with for example &lt;code&gt;{% includeJsFile &quot;/js/file.min.js&quot; %}&lt;/code&gt;, only if the js folder is in the public folder.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2016-11-06T23:43:03.690" Title="IncludeJsFile doesn't load from within the templates directory" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17609" PostTypeId="1" AcceptedAnswerId="17620" CreationDate="2016-11-07T09:51:49.620" Score="1" ViewCount="411" Body="&lt;p&gt;I can only find the following method in the documentation (&lt;a href=&quot;https://solspace.com/craft/freeform/docs/form/#templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/form/#templates&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;form.hasErrors&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there an array available with all the error messages combined? I'm looking for a way to iterate over all form errors.&lt;/p&gt;&#xA;" OwnerUserId="5564" LastEditorUserId="57" LastEditDate="2016-11-07T19:01:14.297" LastActivityDate="2016-11-07T19:01:14.297" Title="Solspace Freeform: loop over all form errors" Tags="&lt;templating&gt;&lt;form&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17610" PostTypeId="1" CreationDate="2016-11-07T10:49:56.763" Score="2" ViewCount="103" Body="&lt;p&gt;I have been trying to fine tune the performance of a heavy page:&#xA;see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17273/category-query-very-slow-on-multilingual-site&quot;&gt;Category query very slow on multilingual site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that my initial hope of getting the page under 2 seconds was not quite accurate. &#xA;After cache tagging the page the performance was great.&#xA;However I had left out an &lt;code&gt;{% endcache %}&lt;/code&gt; tag - ie not closed it. This makes the performance in the network inspector less than 1 sec to load. Very nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am using Nginx microcaching set to 1 sec. As soon as I cleared the Nginx cache i started seeing the error in my template tag that was missing the closing cache tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why does it load lightning fast with an unclosed tag?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When experimenting with placement of cache tags, I also managed to generate the following error in dev mode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An exception has been thrown during the compilation of a template &#xA;(&quot;Node &quot;body&quot; does not exist for Node &quot;Craft\Cache_Node&quot;.&quot;).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was wondering what exactly this means / indicates and if there is some interaction effect I am getting between craft cache and my Nginx server cache?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-12-07T19:21:58.057" Title="How to understand this exception error in context?" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17611" PostTypeId="1" CreationDate="2016-11-07T11:21:05.810" Score="1" ViewCount="574" Body="&lt;p&gt;I'm using P&amp;amp;T's Guest Entries plugin along with my front end entry forms. All working fine except I want front end entries submitted with status 'pending'. Thought this would be pretty straightforward but something's not right. Atop my form I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;status&quot; value=&quot;pending&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone got statuses working in entry forms?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="57" LastEditDate="2016-11-07T18:57:29.920" LastActivityDate="2016-11-07T18:57:29.920" Title="Set status 'pending' on Guest Entry form" Tags="&lt;form&gt;&lt;status&gt;&lt;plugin-guestentries&gt;&lt;pending&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17613" PostTypeId="2" ParentId="17611" CreationDate="2016-11-07T12:38:58.933" Score="3" Body="&lt;p&gt;The &quot;status&quot; on an entry isn't explicitly set like that. It is determined based on other properties of the entry. You will need to set these other criteria for the entry to appear as &quot;pending&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;An entry is 'pending' if it is enabled and has Post and Expiration Dates in the future.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information on status' and the criteria can be found on the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#status&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Depending on your use case, the following answer may be helpful: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7044/editorial-workflow-custom-status?rq=1&quot;&gt;Editorial workflow / custom status&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-11-07T12:48:52.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17614" PostTypeId="1" AcceptedAnswerId="17634" CreationDate="2016-11-07T12:49:10.910" Score="1" ViewCount="69" Body="&lt;p&gt;I would like to exclude entries from appearing in the template results that contain Users from specific User group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code below works if &lt;strong&gt;all&lt;/strong&gt; the User(s) in the RelatedTo field are part of the excluded User group, but it doesn't work if the field contains Users from both the excluded group and a non-excluded group. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludeFellows = craft.users.groupId('not 11') %}&#xA;&#xA;{% set entries = craft.entries.section('logsQA').logGeneral_statusWorkflow('submitted').relatedTo(&#xA;    { targetElement: excludeFellows, field: 'logGeneral_sonographerName' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Also if it's better to check for specific User IDs rather than a User Group for my excluded list that's fine too. I only have 3 Users to exclude.)&lt;/p&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="57" LastEditDate="2016-11-07T18:58:28.557" LastActivityDate="2016-11-07T23:16:48.223" Title="Filter results by users contained in a Users Relations RelatedTo field" Tags="&lt;templating&gt;&lt;users&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17615" PostTypeId="1" AcceptedAnswerId="18195" CreationDate="2016-11-07T12:50:29.403" Score="1" ViewCount="499" Body="&lt;p&gt;I have a dynamic navigation consisting out of matrix and entries fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Tsatu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tsatu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then gets printed on the frontend as a dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No is it somehow possible to add a active class to the dropdown toplevel button?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basicaly passing the active state back up to the toplevel button.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for dropNavi in block.dropdownNavi %}&#xA;   {% if loop.first %}&#xA;      &amp;lt;li class=&quot;dropdown {# that's where the class should end up #}&quot;&amp;gt;&#xA;         &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-toggle&quot; data-toggle=&quot;dropdown&quot;&amp;gt;&#xA;           {{ block.seite }} &amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;         &amp;lt;/a&amp;gt;&#xA;         &amp;lt;ul class=&quot;dropdown-menu&quot;&amp;gt;&#xA;   {% endif %}&#xA;   &amp;lt;li {# here adding an active class is easy #}&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ dropNavi.url }}&quot;&amp;gt;{{ dropNavi.title }}&amp;lt;/a&amp;gt;&#xA;   &amp;lt;/li&amp;gt;&#xA;  {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that this is a matrix field so there could be 3 or 6 or 5 dropdowns. Therefore the &lt;code&gt;{{ loop.index }}&lt;/code&gt; does not work as a identifier. I can't see a way. Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried things like &lt;code&gt;&amp;lt;li class=&quot;dropdown {% if craft.request.getLastSegement == dropNavi.url %}&quot;&amp;gt;&lt;/code&gt; and various versions of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But stuff like this aplies an active class to all the dropdowns present. Never on the one containing the current url.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-19T13:25:11.550" Title="Pass active class into dropdown" Tags="&lt;matrix&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17616" PostTypeId="2" ParentId="827" CreationDate="2016-11-07T13:54:47.133" Score="1" Body="&lt;p&gt;I have had the same issue when using a custom function to calculate the image's resulting size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem happened when that function returned decimals. So if you ever calculate the transform's dimensions, make sure you round the results to avoid this.&lt;/p&gt;&#xA;" OwnerUserId="5829" LastActivityDate="2016-11-07T13:54:47.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17617" PostTypeId="1" AcceptedAnswerId="17618" CreationDate="2016-11-07T14:07:22.907" Score="1" ViewCount="525" Body="&lt;p&gt;I'm currently trying to create a for-loop that loops through all options of a dropdown field created in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a field called &quot;Season&quot;, with the possible options to choose from being &quot;2015/16&quot; and &quot;2016/17&quot;. What I'm trying to do now is to create a loop that would loop as many times as there are options available in that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of something like this:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in fields.season %}&#xA;    ...code...&#xA;{% endfor %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to accomplish this within Craft?&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="57" LastEditDate="2016-11-07T19:02:15.740" LastActivityDate="2016-11-07T19:02:15.740" Title="Loop through all possible options of a Dropdown-field" Tags="&lt;field&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17618" PostTypeId="2" ParentId="17617" CreationDate="2016-11-07T14:30:11.010" Score="2" Body="&lt;pre&gt;&lt;code&gt;{% for option in entry.dropdownFieldHandle.options %}&#xA;    &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should be it :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionname') %}&#xA;  {% for option in entry.dropdownFieldHandle.options %}&#xA;    &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use the above if it is only one page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myArray = [] %}&#xA;&#xA;{% for entry in craft.entries.section('sectionname') %}&#xA;  {% for option in entry.dropdownFieldHandle.options %}&#xA;        {% set value = option %}&#xA;&#xA;        {% set myArray = myArray|merge([value]) %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And loop over that variable , better to load 1 variable as array if you need it over multiple pages. Just make sure all pages have access to this variable (or create a macro for it)&lt;/p&gt;&#xA;" OwnerUserId="5860" LastEditorUserId="5860" LastEditDate="2016-11-07T15:36:20.203" LastActivityDate="2016-11-07T15:36:20.203" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17619" PostTypeId="1" CreationDate="2016-11-07T14:52:17.350" Score="1" ViewCount="114" Body="&lt;p&gt;Given a category based set of entries/products, and a filter system based on tags, how would I accept (one of) the following urls and let one template process them all (not interested in the processing, just want to know how to set up the route):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/category/foo -&gt; category page, containing products&lt;/li&gt;&#xA;&lt;li&gt;example.com/category/foo/type/bar -&gt; category page, filtered by relation to tag (group = 'type') with value 'bar'&lt;/li&gt;&#xA;&lt;li&gt;example.com/category/foo/type/bar/country/usa -&gt; category page, filtered by multiple relations (filters)&lt;/li&gt;&#xA;&lt;li&gt;example.com/category/foo/country/usa/type/bar -&gt; category page, filtered by same relations as above&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This would be more SEO-friendly than example.com/category/foo?type=bar&amp;amp;country=usa&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone done this before?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2016-11-07T15:39:39.090" Title="How can I set up a filter URL like example.com/category/foo/type/bar/country/usa" Tags="&lt;categories&gt;&lt;url&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17620" PostTypeId="2" ParentId="17609" CreationDate="2016-11-07T14:57:51.723" Score="1" Body="&lt;p&gt;There currently isn't a way to get all errors directly from the form, but you could do it this way for now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in form %}&#xA;    {% for field in row %}&#xA;        {% for error in field.getErrors %}&#xA;            {{ error }}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-11-07T14:57:51.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17621" PostTypeId="1" CreationDate="2016-11-07T15:10:51.193" Score="1" ViewCount="212" Body="&lt;p&gt;I built a site in another CMS with an add-on which allows entries to be converted to member bios, and another add-on which makes sure all files uploaded by different members are viewable to that member only. The site allows users to search bands and read band profiles/listen to demos (Mp3s), each Member (band) uses a front end publish page to create their profiles (bios), would this workflow be possible using Craft?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2016-11-07T15:48:38.290" Title="Members' site in Craft possible out of the box?" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17622" PostTypeId="2" ParentId="17619" CreationDate="2016-11-07T15:39:39.090" Score="2" Body="&lt;p&gt;The parameterized paths (as opposed to the queries) implies a certain hierarchy. According to &lt;a href=&quot;http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/en//webmasters/docs/search-engine-optimization-starter-guide.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google's SEO document&lt;/a&gt;, you have to anticipate that users will cut a part of the URL off. What happens if they cut out &quot;usa&quot;, but &quot;country&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're doing right now is filtering/searching, not creating a hierarchy. So, you're complicating your own routing (making it more likely to fail and thus hurting your SEO even further), and not conveying the information particularly accurately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the parameterized URLs as opposed to query strings, you'll want to &lt;a href=&quot;https://www.woorank.com/en/blog/guide-to-clean-urls-for-seo-and-usability&quot; rel=&quot;nofollow noreferrer&quot;&gt;reorganize your URL structure to be hierarchical&lt;/a&gt; -- i.e. - &lt;code&gt;products/shirts/tshirts&lt;/code&gt; -- and drop off the &quot;parameter names&quot; that you're trying to shoe-horn in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, consider whether that particular page actually &lt;em&gt;needs&lt;/em&gt; to be indexed by search engines, and if it needs to be indexed &lt;em&gt;with the query string&lt;/em&gt;. Can you simply allow it to be indexed without any filtering? Does it need to be indexed at all? If you don't need to index it, then you can keep the query string for human usability, and tell spiders not to index it at all. If you don't need to index it as filtered and going to the page, without a query string, results in the non-filtered content, then most spiders will do that by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, look at &lt;code&gt;google.com&lt;/code&gt;, before and after a search. Obviously, search result pages don't need to be indexed (nor would you want to, because that would result in a ton of botched indexed), but the main page, itself, probably should be. As a result, they use a query string that includes &lt;code&gt;q=searchstring&lt;/code&gt; on their search results page.&lt;/p&gt;&#xA;" OwnerUserId="5822" LastActivityDate="2016-11-07T15:39:39.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17623" PostTypeId="2" ParentId="17615" CreationDate="2016-11-07T15:44:35.160" Score="1" Body="&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ page.getUrl }}&quot; {{craft.request.getSegment(2)|lower==page.slug|lower ? 'class=is-active'|e : ''}}&amp;gt;&#xA;    {{ page.title}}&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use something like this, only you compare your &lt;code&gt;getSegment()&lt;/code&gt; with the related Title field instead of &lt;code&gt;page.slug&lt;/code&gt; if your page in your url has the pagetitle name.&lt;/p&gt;&#xA;" OwnerUserId="5860" LastEditorUserId="57" LastEditDate="2016-11-07T19:05:52.290" LastActivityDate="2016-11-07T19:05:52.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17624" PostTypeId="2" ParentId="17621" CreationDate="2016-11-07T15:48:38.290" Score="3" Body="&lt;p&gt;Yes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In Craft, all Elements — including Users — can have custom fields of their own. (So, for example, each User could have a &quot;Bio&quot; field.) You can use a &lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Profile Form&lt;/a&gt; to allow Users to edit their own profiles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can &lt;a href=&quot;https://craftcms.com/docs/assets-fields#restricting-uploads-to-a-single-folder&quot; rel=&quot;nofollow noreferrer&quot;&gt;restrict the upload directory&lt;/a&gt; for each Assets field. So, for example, you could create an Assets field that stores files in a directory based on each User's ID, which would effectively keep one User from viewing/disturbing another User's files.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="689" LastActivityDate="2016-11-07T15:48:38.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17625" PostTypeId="1" AcceptedAnswerId="17629" CreationDate="2016-11-07T16:00:29.723" Score="1" ViewCount="47" Body="&lt;p&gt;I am new to Craft CMS and although it is quite simple to use I am stuck on this one. I have 3 sections ('books', 'games', 'movies') and want to do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sub_entry in craft.entries('{{ entry.sectionName }}').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that it gives me all sub_entries not just the ones within a specific section i.e. &lt;code&gt;entry.sectionName&lt;/code&gt;? If I print out &lt;code&gt;{{ entry.sectionName }}&lt;/code&gt; on my website it gives me the correct sectionNames but somehow I can not pass it on to the for loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I solve this?&#xA;Kind regards,&#xA;Pete&lt;/p&gt;&#xA;" OwnerUserId="5865" LastEditorUserId="22" LastEditDate="2017-05-09T20:51:16.433" LastActivityDate="2017-05-09T20:51:16.433" Title="Database Request with entry variable as argument" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17626" PostTypeId="2" ParentId="17625" CreationDate="2016-11-07T17:58:29.700" Score="1" Body="&lt;p&gt;hmm, wat do you mean with sub_entries? As a general pointer I would do it like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set books = craft.entries.section('books') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then loop over the books. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get back to your question, I would suggest moving all the different sections into 1 channel with multiple types in it. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel: Media&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Types: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Books&lt;/li&gt;&#xA;&lt;li&gt;Games&lt;/li&gt;&#xA;&lt;li&gt;Movies&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then you can query them like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set books = craft.entries.section('media').type(['books']) %}&#xA;&#xA;{% for entry in books %}&#xA;    &amp;lt;h2&amp;gt;{{entry.title}}&amp;lt;/h2&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More info on types &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2016-11-07T17:58:29.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17627" PostTypeId="1" AcceptedAnswerId="17632" CreationDate="2016-11-07T18:48:37.787" Score="0" ViewCount="44" Body="&lt;p&gt;I think I am doing exactly the same as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2582/how-do-i-cycle-a-class-on-a-matrix-block&quot;&gt;here&lt;/a&gt; but I only get the &quot;even&quot; class at each iteration.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.articlebody %}&#xA;&#xA;    {% set index0 = loop.index0 %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'heading' %}&#xA;            &amp;lt;h2 class=&quot;section-title&quot;&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&amp;lt;!-- /.section-title --&amp;gt;&#xA;&#xA;        {% case 'text' %}&#xA;            &amp;lt;div class=&quot;{{ cycle(['odd', 'even'], index0) }}&quot;&amp;gt;{{ block.text }}&amp;lt;/div&amp;gt;    &#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-11-07T23:04:57.937" Title="How do I (also) cycle a class on a Matrix block?" Tags="&lt;matrix&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17628" PostTypeId="2" ParentId="17610" CreationDate="2016-11-07T18:56:54.233" Score="1" Body="&lt;p&gt;If you leave off the closing &lt;code&gt;{% endcache %}&lt;/code&gt; tag, then you should always get the error that you received with &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; enabled.  If devMode is disabled, you'll get the default 500 error template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would disable the nginx microcaching while you're testing this to make sure that you're not getting erroneous caching results.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-07T18:56:54.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17629" PostTypeId="2" ParentId="17625" CreationDate="2016-11-07T19:12:13.383" Score="0" Body="&lt;p&gt;In Craft/Twig, you'll never need to nest &lt;code&gt;{{&lt;/code&gt; and &lt;code&gt;{%&lt;/code&gt; tags inside of each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sub_entry in craft.entries('{{ entry.sectionName }}').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sub_entry in craft.entries(entry.sectionName).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-07T19:12:13.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17630" PostTypeId="1" AcceptedAnswerId="17635" CreationDate="2016-11-07T22:00:29.957" Score="1" ViewCount="368" Body="&lt;p&gt;I'm working on a project where we need to post publication &lt;em&gt;Editions&lt;/em&gt;, each containing any number of &lt;em&gt;Stories&lt;/em&gt;, of which there can be one of three entry types. The URL structure we're shooting for is &lt;code&gt;foo.com/pub/edition-slug/story-slug&lt;/code&gt;, and I'm not sure how to set the &quot;URL Format&quot; field for each Section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I've set the &lt;em&gt;Editions&lt;/em&gt; Section to &lt;code&gt;pub/{slug}&lt;/code&gt;, and have tried setting the &lt;em&gt;Stories&lt;/em&gt; Section to the following...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;pub/*/{slug}&lt;/code&gt;: literally includes &lt;code&gt;*/&lt;/code&gt; in resulting URL&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{parent.last.uri}/{slug}&lt;/code&gt;: only results in &lt;code&gt;foo.com/story-slug&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My questions, then:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it &lt;em&gt;possible&lt;/em&gt; to dynamically reference a parent Section's slug when we're not in a Structure?&lt;/li&gt;&#xA;&lt;li&gt;If no to #1, is there a more appropriate layout (rather than two independent Sections) that'd allow the Edition &gt; Story relationship given that Editions and Stories are distinctly different? (I'm avoiding a Structure because I can't rely on editors not to make a Story top-level with nested Editions, for example—no way I understand to enforce that Edition &gt; Story hierarchy.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I can get the URLs working with a custom route, but at the loss of a proper Live Preview and the other benefits of clean URLs like sitemap generation, etc.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2016-11-07T22:35:32.317" LastActivityDate="2016-11-08T00:03:44.173" Title="What's the best way to build URLs for dynamic content collections?" Tags="&lt;entries&gt;&lt;url&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17631" PostTypeId="1" AcceptedAnswerId="17633" CreationDate="2016-11-07T22:22:36.313" Score="1" ViewCount="1489" Body="&lt;p&gt;New to Craft Commerce and doing something pretty template intensive. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am following this &lt;a href=&quot;https://craftcommerce.com/support/product-taxonomy&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/support/product-taxonomy&lt;/a&gt;  and &lt;a href=&quot;https://craftcommerce.com/support/products-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/support/products-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My categories group handle &quot;productCategories&quot;&#xA;My categories field handle &quot;whatFinish&quot;&#xA;Categories so far are &quot;metallic&quot; and &quot;standard&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code returns a short list of both categories from the page above&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in product.productDepartments %}&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% ifchildren %}&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% children %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endifchildren %}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use this code with any of a variety of options to replace(category) I get a template error with a variable issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the products related to this category #}&#xA;{% set products = craft.commerce.products.relatedTo(category) %}&#xA;&#xA;{# Output them #}&#xA;{% for product in products %}&#xA;    &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Examples things I have tried: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          {# Fetch all of the products related to this category #}&#xA;{% set products = craft.commerce.products.relatedTo(standard) %}&#xA;&#xA;{# Output them #}&#xA;{% for product in products %}&#xA;    &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA; {# Fetch all of the products related to this category #}&#xA;{% set products = craft.commerce.products('whatFinish').relatedTo(standard) %}&#xA;&#xA;{# Output them #}&#xA;{% for product in products %}&#xA;    &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Fetch all of the products related to this category #}&#xA;{% set products = craft.commerce.products('standard').relatedTo(whatFinish) %}&#xA;&#xA;{# Output them #}&#xA;{% for product in products %}&#xA;    &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before to get all of the products (not desired as I want just the ones form a specific category) my code worked fine: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;div class=&quot;row &quot;&amp;gt;&#xA;{% for product in craft.commerce.products.limit(5).find() %}&#xA;&amp;lt;div class=&quot;col-md-4 col-sm-4  col-xs-12&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot; text-center&quot;&amp;gt;&#xA;        {% set image = product.slider.first() %} {% if image %}&#xA;        &amp;lt;img alt=&quot;product.title&quot; class=&quot;&quot; src=&quot;{{ image.getUrl({ height: 250 }) }}&quot;&amp;gt; {% endif %}&#xA;        &amp;lt;div class=&quot;title&quot;&amp;gt;&#xA;            &amp;lt;h5 class=&quot;mb0&quot;&amp;gt;{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}&amp;lt;/h5&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!--end three col--&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to bracket the category code with something I am not aware of? Sorry just completely lost here. I was directed to post form the support email. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steph&lt;/p&gt;&#xA;" OwnerUserId="5866" LastEditorUserId="167" LastEditDate="2016-11-09T11:38:09.577" LastActivityDate="2016-11-09T11:56:09.787" Title="Displaying products from a category" Tags="&lt;categories&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17632" PostTypeId="2" ParentId="17627" CreationDate="2016-11-07T23:04:57.937" Score="2" Body="&lt;p&gt;The &lt;code&gt;loop.index0&lt;/code&gt; variable will be incremented for each block, regardless of type, so assuming every other block is a &lt;code&gt;header&lt;/code&gt;, it's not surprising that the &lt;code&gt;cycle&lt;/code&gt; method prints &lt;code&gt;&quot;even&quot;&lt;/code&gt; for every &lt;code&gt;text&lt;/code&gt; block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you need is a different variable which only increments whenever you hit a &lt;code&gt;text&lt;/code&gt; block (note that this variable should be declared outside the &lt;code&gt;for&lt;/code&gt; loop):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set textIndex = 0 %}&#xA;&#xA;{% for block in entry.articlebody %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'heading' %}&#xA;            &amp;lt;h2 class=&quot;section-title&quot;&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&amp;lt;!-- /.section-title --&amp;gt;&#xA;&#xA;        {% case 'text' %}&#xA;            &amp;lt;div class=&quot;{{ cycle(['odd', 'even'], textIndex) }}&quot;&amp;gt;{{ block.text }}&amp;lt;/div&amp;gt;&#xA;            {% set textIndex = textIndex + 1 %}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-07T23:04:57.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17633" PostTypeId="2" ParentId="17631" CreationDate="2016-11-07T23:12:19.570" Score="1" Body="&lt;p&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(category) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...is the correct code for finding products related to a category &lt;strong&gt;IF&lt;/strong&gt; category is actually a Category Model at this point - e.g. it is the auto populated &lt;code&gt;category&lt;/code&gt; variable in a template set to the template for that category group.  I would check, in the catgeory group settings, what you're using for the Category URL formats and the Category Template settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be also very helpful to know what's the actual error you are getting?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-07T23:12:19.570" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17634" PostTypeId="2" ParentId="17614" CreationDate="2016-11-07T23:16:48.223" Score="3" Body="&lt;p&gt;If I understand you correctly, you want to exclude any entry that has any user from a certain user group selected in a certain Users field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an approach that I believe would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the users that should be excluded #}&#xA;{% set excludedUsers = craft.users.group('groupToExclude').limit(null) %}&#xA;&#xA;{# Get the entries that should be excluded #}&#xA;{% set excludedEntries = craft.entries.section('logsQA').relatedTo({&#xA;    targetElement: excludedUsers.ids(),&#xA;    field: 'logGeneral_sonographerName'&#xA;}).limit(null) %}&#xA;&#xA;{# Get the entries that should be displayed #}&#xA;{% set entries = craft.entries.section('logsQA').id('and, not '~excludedEntries.ids()|join(', not ')) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the above does is to first pull the users that should be excluded (you could use the &lt;code&gt;groupId&lt;/code&gt; parameter instead of &lt;code&gt;group&lt;/code&gt; if you want to), before using those users to pull the entries that should be excluded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the entries that should be displayed are pulled – the key here is the use of the &lt;code&gt;id&lt;/code&gt; parameter to specifically exclude a list of entry IDs.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-07T23:16:48.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17635" PostTypeId="2" ParentId="17630" CreationDate="2016-11-07T23:42:58.150" Score="3" Body="&lt;p&gt;You need that custom route. With the dynamic URI setting the &quot;entry route&quot; is generated dynamically on entry save, but it stores a single, fixed route only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you don't have to miss out on Live Preview when you leave the &quot;entry route&quot; enabled in addition to your custom route. Set up separate Live Preview URIs that you don't link to and if you prefer you can 404 the request for all non Live Preview visits.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isLivePreview %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-11-08T00:03:44.173" LastActivityDate="2016-11-08T00:03:44.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17636" PostTypeId="2" ParentId="17526" CreationDate="2016-11-08T00:13:46.377" Score="5" Body="&lt;p&gt;You could try to fight that ampersand with the &lt;code&gt;htmlEntityDecode&lt;/code&gt; filter that is included in my Craft Helpers plugin &lt;a href=&quot;https://github.com/carlcs/craft-helpers&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/carlcs/craft-helpers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-08T00:13:46.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17638" PostTypeId="1" AcceptedAnswerId="17643" CreationDate="2016-11-08T15:33:49.123" Score="3" ViewCount="1235" Body="&lt;p&gt;Simple question: I made a button in my plugin settings that creates a &lt;code&gt;Craft.postActionRequest&lt;/code&gt; but what should the controller return?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not need to return anything else than true (successful) or string (action was not successful -&gt;  errormessage) but if I return a true or a false or anything else than a template to render I get an error...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Little example:&lt;br&gt;&#xA;my template is just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ response }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//correct -&amp;gt; no error, this template is just empty&#xA;public function actionDeleteAccessToken(){&#xA;    return $this-&amp;gt;renderTemplate('srgoogleanalytics/tools/empty', array(response =&amp;gt; true));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but if I make something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDeleteAccessToken(){&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I receive a PHP error file not found.&#xA;What do I wrong?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2016-11-08T21:27:21.217" LastActivityDate="2016-11-08T21:27:21.217" Title="What should my controller return in a Craft.postActionRequest" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17639" PostTypeId="1" CreationDate="2016-11-08T17:55:58.933" Score="2" ViewCount="1249" Body="&lt;p&gt;I am trying to get to grips with Eager Loading. I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in entry.relatedArticles %}&#xA;&amp;lt;div class=&quot;c-card // l-card--third&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;            {% set array = article.title|split(' ', 2) %}&#xA;            &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p class=&quot;c-card__msg // js-fittext&quot;&amp;gt;Posted on {{ helpers.date_formatted(entry.postDate) }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                    &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;Related&amp;lt;/strong&amp;gt; Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p class=&quot;c-card__msg  // half-margin-bottom&quot;&amp;gt;&#xA;                        &amp;lt;strong&amp;gt;{{ article.title }}&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;time datetime=&quot;{{ entry.postDate|date('Y-m-d H:i:s') }}&quot; class=&quot;date&quot;&amp;gt;&#xA;                            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                                &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                            &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(entry.postDate) }}&#xA;                        &amp;lt;/time&amp;gt;&#xA;                    &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking on the console this combined with the other page requests totals 76 requests. I thought I perhaps should add some eager loading 9at least tot he image transform) So I tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in entry.relatedArticles.withTransforms('cardImage') %}&#xA;&amp;lt;div class=&quot;c-card // l-card--third&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;            {% set array = article.title|split(' ', 2) %}&#xA;            &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p class=&quot;c-card__msg // js-fittext&quot;&amp;gt;Posted on {{ helpers.date_formatted(entry.postDate) }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                    &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;Related&amp;lt;/strong&amp;gt; Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p class=&quot;c-card__msg  // half-margin-bottom&quot;&amp;gt;&#xA;                        &amp;lt;strong&amp;gt;{{ article.title }}&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;time datetime=&quot;{{ entry.postDate|date('Y-m-d H:i:s') }}&quot; class=&quot;date&quot;&amp;gt;&#xA;                            &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                                &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                            &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(entry.postDate) }}&#xA;                        &amp;lt;/time&amp;gt;&#xA;                    &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this also still results in 76 requests. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is this; Have I misunderstood when I need to use Eager Loading? or is my code incorrect and thus eager loading isn't actually taking place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-10-02T04:39:03.667" Title="Understanding Eager Loading" Tags="&lt;performance&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17640" PostTypeId="1" CreationDate="2016-11-08T19:03:59.103" Score="0" ViewCount="487" Body="&lt;p&gt;I have a problem uploading images on the CP. Small images success, but one with a 2Mb site fails with the error below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File was renamed to only ASCII chars, but problem still occures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uWlLT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uWlLT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;PHP settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;memory_limit    128M&#xA;upload_max_filesize 64M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft version: 2.6.2791&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-11-08T19:03:59.103" Title="Error uploading images on admin panel ( Failed to load resource: net::ERR_EMPTY_RESPONSE )" Tags="&lt;image&gt;&lt;admin&gt;&lt;debugging&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17641" PostTypeId="1" AcceptedAnswerId="17679" CreationDate="2016-11-08T20:03:59.853" Score="2" ViewCount="82" Body="&lt;p&gt;&lt;code&gt;{{siteUrl}}&lt;/code&gt;, &lt;code&gt;{{category.url}}&lt;/code&gt;, &lt;code&gt;{{product.url}}&lt;/code&gt;, etc. is not outputting any language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main language is Norwegian. I created a folder for English (/en/) with &lt;code&gt;define('CRAFT_LOCALE', 'en_us');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Navigating to &lt;code&gt;site.com/en&lt;/code&gt; works fine, and all the english content shows as expected. However any link generated by craft simply omits &quot;/en/&quot;, thus throwing me back to Norwegian. I don't get it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything in particular I should look into? Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="57" LastEditDate="2016-11-08T21:29:40.740" LastActivityDate="2016-11-10T19:17:12.887" Title="Craft not generating language links correctly" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17642" PostTypeId="1" CreationDate="2016-11-08T20:23:00.400" Score="1" ViewCount="102" Body="&lt;p&gt;I tried up update to the latest Craft, but assets are not loading and the process stops here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deleted the &lt;code&gt;storage/runtime&lt;/code&gt; folder but I got no luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4LYPO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4LYPO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t8RyK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t8RyK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/11/08 20:17:23 [error] [application] Tried to read the folder contents of /var/www/dev/craft/craft/storage/runtime/compiled_templates/, but could not.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't matter if I set it to 777 or correct user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even stranger is that dispite the error log, I get content created in the compiled_templates folder.&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-11-08T22:53:47.383" Title="Manual update fails on server" Tags="&lt;server&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17643" PostTypeId="2" ParentId="17638" CreationDate="2016-11-08T21:27:08.443" Score="5" Body="&lt;p&gt;If you're just looking to return &lt;code&gt;true&lt;/code&gt; or an error message from your controller's action, then it should probably be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;returnJson(array('success' =&amp;gt; true));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or on error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;returnErrorJson($e-&amp;gt;getMessage());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;returnErrorJson&lt;/code&gt; will set an &lt;code&gt;'error'&lt;/code&gt; key and pass whatever mess you use as its value.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-08T21:27:08.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17644" PostTypeId="2" ParentId="17572" CreationDate="2016-11-08T21:35:04.183" Score="2" Body="&lt;p&gt;After some debugging I found, what I did wrong:&#xA;I had for some reason the wrong groupID (checked that in the backend and DB) as well as &lt;code&gt;title&lt;/code&gt; needs to be present in the passed data and is the name of the tag itself.&lt;/p&gt;&#xA;" OwnerUserId="5855" LastActivityDate="2016-11-08T21:35:04.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17645" PostTypeId="1" AcceptedAnswerId="17647" CreationDate="2016-11-08T21:46:38.227" Score="1" ViewCount="44" Body="&lt;p&gt;&lt;code&gt;{{ entry.postDate|date('jS F Y \at ga') }}&lt;/code&gt;This should produce this &lt;code&gt;5th November 2016 at 4am&lt;/code&gt;but it doesn't seem to recognise the escape and adds 30 instead of at.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="45" LastEditDate="2016-11-08T22:19:59.777" LastActivityDate="2016-11-08T22:19:59.777" Title="Escaping characters in entry.postDate|date" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17646" PostTypeId="2" ParentId="17639" CreationDate="2016-11-08T21:58:14.767" Score="4" Body="&lt;p&gt;Your syntax is a bit off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;withTransforms&lt;/code&gt; parameter is an &lt;em&gt;Asset criteria&lt;/em&gt;, meaning it is only relevant when you're pulling Assets. Appending it to &lt;code&gt;entry.relatedArticles&lt;/code&gt; (an Entries field, returning an ElementCriteriaModel) like you're currently attempting does nothing, but this does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = entry.someAssetsField.find({&#xA;    withTransforms: ['someTransform', 'someOtherTransform']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means your current code should probably be refactored to look something like this (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in entry.relatedArticles %}&#xA;    ...&#xA;    {% set bannerImage = article.bannerImage.find({&#xA;        withTransforms: ['cardImage']&#xA;    })[0] ?? null %}&#xA;    {% if bannerImage %}&#xA;        &amp;lt;img src=&quot;{{ bannerImage.getUrl('cardImage') }}&quot; /&amp;gt;&#xA;    {% endif %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming there's not a &lt;em&gt;ton&lt;/em&gt; of &lt;code&gt;relatedArticles&lt;/code&gt; entries, and considering the fact that there's only one image per entry, the above might not make a huge impact on your performance. To take things a step further, you might consider eager loading the actual Asset field(s) as well as their transforms. There's a couple of ways to do this – you could use the same approach as above, adding the eager loading criteria to the Entries field &lt;code&gt;relatedArticles&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedArticles = entry.relatedArticles.find({&#xA;  with: [&#xA;      ['bannerImage', {&#xA;          withTransforms: ['cardImage']&#xA;      }]&#xA;  ]&#xA;}) %}&#xA;{% for article in relatedArticles %}&#xA;    ...&#xA;    {% set bannerImage = article.bannerImage[0] ?? null %}&#xA;    {% if bannerImage %}&#xA;        &amp;lt;img src=&quot;{{ bannerImage.getUrl('cardImage') }}&quot; /&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you could use a more &quot;traditional&quot; eager loading approach, using &lt;code&gt;craft.entries&lt;/code&gt; and &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;relatedTo&lt;/code&gt; parameter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in craft.entries({&#xA;    relatedTo: {&#xA;      sourceElement: entry,&#xA;      field: 'relatedArticles'&#xA;    },&#xA;    with: [&#xA;        ['bannerImage', {&#xA;            withTransforms: ['cardImage']&#xA;        }]&#xA;    ]&#xA;}) %}&#xA;    ...&#xA;    {% set bannerImage = article.bannerImage[0] ?? null %}&#xA;    {% if bannerImage %}&#xA;        &amp;lt;img src=&quot;{{ bannerImage.getUrl('cardImage') }}&quot; /&amp;gt;&#xA;    {% endif %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, assuming there's a fair amount of entries involved you'll probably see a decrease in the number of queries executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to learn more about eager loading, I recommend taking a look at &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;the official docs on the subject&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-11-10T20:12:59.793" LastActivityDate="2016-11-10T20:12:59.793" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17647" PostTypeId="2" ParentId="17645" CreationDate="2016-11-08T22:03:15.357" Score="1" Body="&lt;p&gt;You'll actually need to add a double backwards slash in front of each character you want to escape, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate|date('jS F Y \\a\\t ga') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://twig.sensiolabs.org/doc/filters/date.html#date&quot; rel=&quot;nofollow noreferrer&quot;&gt;the official Twig docs&lt;/a&gt; for more info.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-08T22:03:15.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17648" PostTypeId="1" CreationDate="2016-11-08T22:22:37.130" Score="1" ViewCount="263" Body="&lt;p&gt;I am using the Social Login plugin from Dukt. It mentions in the configuration instructions to add things to a social.php file that you place in craft&gt;config. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done that, but I assume I'm doing something wrong with the PHP file, as it just shows up in the CP on the social login settings page, rather than actually performing the additional functions I'm looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not super well-versed in PHP, so I'm sure its user error. Can anyone help? Here's the contents of my PHP file: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'lockDomains' =&amp;gt; [&#xA;'awebaddress.net']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is what is showing up in the control panel: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/I5iti.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I5iti.png&quot; alt=&quot;control panel screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5527" LastActivityDate="2016-11-08T22:37:31.693" Title="Social Login plugin question" Tags="&lt;php&gt;&lt;configuration&gt;&lt;plugin-social-login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17649" PostTypeId="2" ParentId="17648" CreationDate="2016-11-08T22:37:31.693" Score="3" Body="&lt;p&gt;Your &lt;code&gt;/craft/config/social.php&lt;/code&gt; file should probably look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'lockDomains' =&amp;gt; [&#xA;        'awebaddress.net',&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to add more config settings, that would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'lockDomains' =&amp;gt; [&#xA;        'awebaddress.net',&#xA;    ],&#xA;    'allowEmailMatch' =&amp;gt; false,&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-08T22:37:31.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17650" PostTypeId="2" ParentId="17642" CreationDate="2016-11-08T22:53:47.383" Score="3" Body="&lt;p&gt;I figured it out. It was super unexpected, after turning on errors finally, I got&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Fatal error: Class 'Craft\AppPathCacheDependency' not found in &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I realized that GIT didn't include that file, still not sure why, but now I know the cause.&lt;/p&gt;&#xA;" OwnerUserId="4755" LastActivityDate="2016-11-08T22:53:47.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17651" PostTypeId="1" AcceptedAnswerId="17666" CreationDate="2016-11-09T02:50:39.260" Score="1" ViewCount="353" Body="&lt;p&gt;I need only 2 main categories, A and B, and both can have unlimited subcategories. Ideal would be to split these into groups but how can an editor choose between groups AND only select or create a category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could setup a checkbox field which asks is this A or B but this then needs to be linked to the category groups and might make the template tags to call the data unnecessary complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the craft-way todo this?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-11-10T08:28:29.913" Title="Category structure with multiple groups" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17652" PostTypeId="2" ParentId="661" CreationDate="2016-11-09T10:21:15.040" Score="13" Body="&lt;p&gt;Doesn't answer the specific question but based on the title in search results it might be helpful for anyone just wanting to truncate a string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title | length &amp;gt; 75 ? entry.title | slice(0, 75) ~ '...' : entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also doesn't require a plugin. Based on &lt;a href=&quot;https://stackoverflow.com/questions/13143001/symfony-2-twig-limit-the-length-of-the-text-and-put-three-dots&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-11-09T11:33:08.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17653" PostTypeId="2" ParentId="17631" CreationDate="2016-11-09T11:56:09.787" Score="0" Body="&lt;p&gt;In this line here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(standard) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You want to fetch all products related to the category 'standard' right? What I think you're missing is you haven't defined what your variable &lt;code&gt;standard&lt;/code&gt; is, yet. It should refer to a category model with the slug 'standard', but if you haven't defined it that probably explains your errors. This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# fetch the category standard from the relevant categories group #}&#xA;{% set standardCategory = craft.categories.group('productCategories').slug('standard').first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then fetch your products like so (because you're feeding 'relatedTo' a category model now):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(standardCategory) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you want to loop through your categories and fetch their products, you could just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# fetch the categories in the category group #}&#xA;{% set categories = craft.categories.group('productCategories') %}&#xA;&#xA;{# loop through them, fetching their respective products #}&#xA;{% for category in categories %}&#xA;    {% set products = craft.commerce.products.relatedTo(category) %}&#xA;    {% if products | length %}&#xA;        {{ category.title }}&#xA;        {# do whatever you need to do with the products #}&#xA;        {% for product in products %}&#xA;            {{ product.title }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not the most efficient way of doing it if products have more than one category but should get you going.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-11-09T11:56:09.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17654" PostTypeId="1" CreationDate="2016-11-09T13:36:25.117" Score="1" ViewCount="495" Body="&lt;p&gt;I would like to create a link to another page in my plugin and send a specific ID with it but I don't really know how to do it in craft and twig.. I spend too much time on that little task and searched in the internet but could not really find something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//loop through all database entries&#xA;{% for val in entries %}&#xA;    .....&#xA;    &amp;lt;a href=&quot;{{ url('pluginName/editEntry/' + val.id) }}&quot;&amp;gt;Edit&amp;lt;/a&amp;gt;&#xA;    .....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it does not really work. How can I pass a specific id in my url and how can I receive this parameter in my php backend?&#xA;I didn't find something like &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getGetVar()&lt;/code&gt;and my &lt;code&gt;$_GET&lt;/code&gt; is always empty. Of course I could just take the URL and use subtring and explode to get the correct value but I'm not sure if this is the intended way&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-11-09T13:42:33.570" LastActivityDate="2016-11-09T13:59:26.383" Title="Twig create link with variable" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17655" PostTypeId="2" ParentId="17654" CreationDate="2016-11-09T13:59:26.383" Score="4" Body="&lt;p&gt;Use the &lt;code&gt;~&lt;/code&gt; symbol to concat strings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//loop through all database entries&#xA;{% for val in entries %}&#xA;    .....&#xA;    &amp;lt;a href=&quot;{{ url('pluginName/editEntry/' ~ val.id) }}&quot;&amp;gt;Edit&amp;lt;/a&amp;gt;&#xA;    .....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5251" LastActivityDate="2016-11-09T13:59:26.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17656" PostTypeId="1" CreationDate="2016-11-09T14:34:46.353" Score="1" ViewCount="437" Body="&lt;p&gt;We’re using Craft over SSL and everything is working fine apart from the admin fonts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ewESj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ewESj.png&quot; alt=&quot;Admin settings with missing fonts&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is due to a mixed content, because craft.css is requesting the fonts from non-ssl URLs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eCImr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eCImr.png&quot; alt=&quot;Non-ssl URLs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CSS file requesting these non-ssl assets is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/admin/resources/css/craft.css?d=1478612388&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I clear caches, everything works for one page load, then reverts to broken fonts on the next page load. This is because for one page load after clearing caches, the CSS file is requested with a different query string:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/admin/resources/css/craft.css?x=EVPBt6yJn&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This file uses the correct SSL URLs for font files, as does any other variation on the query string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried completely emptying the storage directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can’t find anything in the docs about how Craft generates these CSS files, or the query strings. Can anyone give me any pointers?&lt;/p&gt;&#xA;" OwnerUserId="5869" LastEditorUserId="57" LastEditDate="2016-11-09T17:54:48.800" LastActivityDate="2016-11-14T13:47:12.643" Title="Admin pages request a broken version of the craft.css file" Tags="&lt;cache&gt;&lt;admin&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17657" PostTypeId="1" CreationDate="2016-11-09T16:30:20.030" Score="1" ViewCount="297" Body="&lt;p&gt;Anyone here using the Imager plugin and creating responsive images using srcset and sizes?&#xA;Any ideas on how to avoid creating multiple versions of the same image if the original asset uploaded is smaller than the set transforms? I added the setting &lt;code&gt;'allowUpscale'       =&amp;gt;      false,&lt;/code&gt; but this has resulted in 7 versions of the same image (same dimensions etc)&#xA;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/imager/resources/general/359/Golden-Retriever-Isolated_b4a9cbfcf0e16c2bbe8891faf2f17377.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_46442a24ab3b20705cf025765c954564.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_dc3d89e10897fe49613e23ec867b72c7.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_13d85085a2b68d4289e86166bdc76d2f.jpg 302w,&#xA;/imager/resources/general/359/Golden-Retriever-Isolated_033ae678b7fe3957fc7ac9eab98c2dac.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_78f5cce99e1c3c7765fb260eb99fceaa.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_3907e8c0ed1757af4be1f9f097fb579b.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_6e4e16791425f7dfc1ab06a09cd800f4.jpg 302w, &#xA;/imager/resources/general/359/Golden-Retriever-Isolated_042ca14a1382a40b78a83ee7d3f8e3dd.jpg 300w&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: here is my code as requested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;image&quot; %}&#xA;{% set image = block.image.first() %}&#xA;{% set transformedImages = craft.imager.transformImage(image, [&#xA;        { width: 1680 },&#xA;        { width: 1430 },&#xA;        { width: 1350 },&#xA;        { width: 1150 },&#xA;        { width: 840 },&#xA;        { width: 715 },&#xA;        { width: 660 },&#xA;        { width: 450},&#xA;        { width: 300}&#xA;    ], { mode: 'fit' })&#xA;%}&#xA;&amp;lt;figure{%- if block.position != &quot;full&quot; %} class=&quot;img-{{ block.position }}--small&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;img&#xA;        src=&quot;{{ craft.imager.transformImage(image, { width: 715, mode: 'fit' }) }}&quot;&#xA;        srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;        sizes=&quot;{{ (block.position == 'full') ? '(max-width: 60em) 100vw, 61.5vw' : '(max-width: 37.5em) 100vw, (max-width: 81.25em) 30vw, 400px'  }}&quot;&#xA;        alt=&quot;{{ image.altText ?: image.title }}&quot;&#xA;    /&amp;gt;&#xA;    {% if block.caption|length %}&#xA;    &amp;lt;figcaption class=&quot;figcaption&quot;&amp;gt;&#xA;        {{ block.caption }}&#xA;    &amp;lt;/figcaption&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2016-11-09T22:10:48.817" LastActivityDate="2016-11-09T22:10:48.817" Title="Responsive images using Imager when original asset isn't large enough" Tags="&lt;image-transforms&gt;&lt;responsive-images&gt;&lt;plugin-imager&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17658" PostTypeId="2" ParentId="17656" CreationDate="2016-11-09T17:58:53.387" Score="1" Body="&lt;p&gt;Craft will use whatever protocol (http/https) you've defined for your siteURL (either as the &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;config setting&lt;/a&gt;) or in the control panel under Settings-&gt;General-&gt;Site URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also possible you've got some &lt;code&gt;.htaccess&lt;/code&gt; URL rewrite rules interfering with those specific requests as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-09T17:58:53.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17659" PostTypeId="1" CreationDate="2016-11-09T18:39:41.433" Score="1" ViewCount="144" Body="&lt;p&gt;I've got Solspace Calendar installed to the best of my knowledge. I have repurposed the 'calendar_demo' files to 'calendar'. Both /calendar and /calendar_demo just show:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Call to undefined method Calendar\Library\Carbon::setWeekStartsAt()&quot; in DateHelper.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;/calendar/week does the same. A path like calendar/2016/11 just give a Twig error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't understand why this is happening. I'll give more details if you ask me, I don't know what else to give.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="57" LastEditDate="2016-11-09T18:55:06.347" LastActivityDate="2016-12-13T04:02:17.803" Title="&quot;Call to undefined method Calendar\Library\Carbon::setWeekStartsAt()&quot; Solspace Calendar" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17660" PostTypeId="2" ParentId="6526" CreationDate="2016-11-09T21:41:47.003" Score="3" Body="&lt;pre&gt;&lt;code&gt;HeaderHelper::setHeader(array('status' =&amp;gt; 404));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2016-11-09T21:41:47.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17661" PostTypeId="1" AcceptedAnswerId="17681" CreationDate="2016-11-09T22:57:31.993" Score="0" ViewCount="105" Body="&lt;p&gt;I've encountered a similar problem as in this post: &lt;a href=&quot;https://craftcms.stackexchange.com/q/8931/4468&quot;&gt;How to order numbers naturally?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some products I need sorted on a page by model number, and currently they sort as ABC-1, ABC-12, ABC-2, etc. instead of ABC-1, ABC-2, ABC-12. Is it possible to extend the existing methods or create a custom sort method to use with the order parameter, rather than using a twig filter as suggested in the link above?&lt;/p&gt;&#xA;" OwnerUserId="4468" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-12-10T20:28:25.807" Title="Extend order methods to sort numbers naturally" Tags="&lt;order&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17662" PostTypeId="1" AcceptedAnswerId="17663" CreationDate="2016-11-09T23:31:06.757" Score="2" ViewCount="69" Body="&lt;p&gt;Two recent sites I’ve built have plugins built to handle filtering through projects based on some categories and related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the lookups look similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Get element criterea for searching projects&#xA;$projectCriterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$projectCriterea-&amp;gt;section = 'projects';&#xA;$projectCriterea-&amp;gt;limit = null;&#xA;$projectCriterea-&amp;gt;relatedTo = $relatedElements; # This is an array of categories and related entries.&#xA;$projects = $projectCriterea-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All these lookups aren’t particularly fast, and there aren’t that many different variants. Is there a way I can add some caching into these lookups?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a bit of a look into the &lt;a href=&quot;https://craftcms.com/classreference/services/CacheService&quot; rel=&quot;nofollow noreferrer&quot;&gt;CacheService&lt;/a&gt; but I'm not sure how to apply that to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2016-11-10T02:32:09.800" LastActivityDate="2016-11-10T07:33:35.973" Title="Caching ElementCriteria Lookups In Craft CMS Plugins" Tags="&lt;entries&gt;&lt;cache&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17663" PostTypeId="2" ParentId="17662" CreationDate="2016-11-10T00:37:17.037" Score="2" Body="&lt;p&gt;I have figured it out, but am not sure if this is the best way so could still use some advice.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Get a unique hash of your search criteria (still figuring this out).&#xA;$hash = md5(json_encode($projectCriterea));&#xA;&#xA;# Look up the cache&#xA;$cache = craft()-&amp;gt;cache-&amp;gt;get($hash);&#xA;&#xA;# Did we find this search criterea in the cache already? If so, return it.&#xA;if ($cache) {&#xA;    return $cache;&#xA;}&#xA;&#xA;# No cache? Do searchy business&#xA;# ...&#xA;$projects = $projectCriterea-&amp;gt;find();&#xA;# ...&#xA;&#xA;# Save to the cache&#xA;if ($cache === false) {&#xA;    craft()-&amp;gt;cache-&amp;gt;set($hash, $projects, 604800); # Cache for 1 week&#xA;}&#xA;&#xA;return $projects;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="125" LastEditDate="2016-11-10T07:33:35.973" LastActivityDate="2016-11-10T07:33:35.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17664" PostTypeId="1" AcceptedAnswerId="17665" CreationDate="2016-11-10T02:03:48.117" Score="1" ViewCount="140" Body="&lt;p&gt;I've read &lt;a href=&quot;https://craftcommerce.com/docs/customer-address-management&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt; but I can't seem to get this to work properly. I want to edit a single address on a separate page from where all addresses for a customer are listed. I have the link to the edit page, which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url('account/edit-address') }}?addressId={{ address.id }}&quot;&amp;gt;Edit&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on that edit-address template I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set addressId = craft.request.getParam('addressId') %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/customerAddresses/save&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/address-book&quot;&amp;gt;&#xA;&#xA;    {% if addressId %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;address[id]&quot; value=&quot;{{ addressId }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;address[firstName]&quot; value=&quot;{{ address ? address[firstName] : '' }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;address[lastName]&quot; value=&quot;{{ address ? address[lastName] : '' }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That leads to a &quot;Variable 'address' does not exist&quot; error. I understand why I get that error but I'm not sure how to get the value field to show the address info. Having a blank form field isn't going to cut it.&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2016-11-10T02:25:41.553" Title="Edit a single address in Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17665" PostTypeId="2" ParentId="17664" CreationDate="2016-11-10T02:25:41.553" Score="2" Body="&lt;p&gt;Are you looking for something like this? The second example will ensure an address variable exists, even if it is set to null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set address = craft.commerce.customer.address(addressId) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set address = address is defined ? address : null %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for accessing the data, you would just do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ address ? address.firstName : '' }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to do it (without needing to define a null address variable) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ address.firstName ?? '' }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-10T02:25:41.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17666" PostTypeId="2" ParentId="17651" CreationDate="2016-11-10T08:28:29.913" Score="2" Body="&lt;p&gt;A rather sneaky solution to your issue could be to create a matrix field that has one block type per category group. Each of those block types then could contain a single category field with the category source set to the corresponding category group. Limit those category fields to 1 category each and then limit the matrix field to one matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way your editors will be able to select only one of the matrix block types and that block type will limit the categories to the selected group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need this for some custom markup wizardry in your templates, make sure you understand &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/set.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;variable scoping in Twig loops&lt;/a&gt; if you're trying to set some variable value while looping through your matrix data.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2016-11-10T08:28:29.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17667" PostTypeId="1" CreationDate="2016-11-10T10:55:01.857" Score="1" ViewCount="284" Body="&lt;p&gt;I'm using php-resque + Redis to get queues/workers into Craft, and so far I've managed to get it all running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My test worker looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class JobHandler&#xA;{&#xA;    public function perform ()&#xA;    {&#xA;        $criteria          = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;section = 'products';&#xA;        $criteria-&amp;gt;limit   = 20;&#xA;        $entries           = $criteria-&amp;gt;count();&#xA;&#xA;        if ( $entries ) {&#xA;            ElasticSearchPlugin::log(&quot;Found! $entries entries&quot;, LogLevel::Info, $force = true);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I add a job to the queue, the worker successfully runs the perform() method, and it shows up in the console and log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, all jobs after the first fails consistently, with the following stacktrace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/11/10 10:49:25 [error] [php] Error while sending QUERY packet. PID=80844 (/src/craft/app/framework/db/CDbCommand.php:508)&#xA;Stack trace:&#xA;#0 /src/craft/app/framework/db/CDbCommand.php(396): Craft\DbCommand-&amp;gt;queryInternal()&#xA;#1 /src/craft/app/services/FieldsService.php(251): Craft\DbCommand-&amp;gt;queryAll()&#xA;#2 /src/craft/app/elementtypes/BaseElementType.php(445): Craft\FieldsService-&amp;gt;getAllFields()&#xA;#3 /src/craft/app/elementtypes/BaseElementType.php(463): Craft\EntryElementType-&amp;gt;getFieldsForElementsQuery()&#xA;#4 /src/craft/app/services/ElementsService.php(665): Craft\EntryElementType-&amp;gt;getContentFieldColumnsForElementsQuery()&#xA;#5 /src/craft/app/services/ElementsService.php(528): Craft\ElementsService-&amp;gt;buildElementsQuery()&#xA;#6 /src/craft/app/models/ElementCriteriaModel.php(385): Craft\ElementsService-&amp;gt;getTotalElements()&#xA;#7 /src/craft/app/models/ElementCriteriaModel.php(174): Craft\ElementCriteriaModel-&amp;gt;total()&#xA;#8 /src/craft/plugins/queue/handlers/JobHandler.php(23): Craft\ElementCriteriaModel-&amp;gt;count()&#xA;#9 /src/craft/plugins/queue/vendor/chrisboulton/php-resque/lib/Resque/Job.php(182): Craft\JobHandler-&amp;gt;perform()&#xA;#10 /src/craft/plugins/queue/vendor/chrisboulton/php-resque/lib/Resque/Worker.php(241): Resque_Job-&amp;gt;perform()&#xA;#11 /src/craft/plugins/queue/vendor/chrisboulton/php-resque/lib/Resque/Worker.php(203): Resque_Worker-&amp;gt;perform()&#xA;#12 /src/craft/plugins/queue/consolecommands/JobCommand.php(85): Resque_Worker-&amp;gt;work()&#xA;#13 unknown(0): Craft\JobCommand-&amp;gt;actionWork2()&#xA;#14 /src/craft/app/framework/console/CConsoleCommand.php(172): ReflectionMethod-&amp;gt;invokeArgs()&#xA;#15 /src/craft/app/framework/console/CConsoleCommandRunner.php(71): Craft\JobCommand-&amp;gt;run()&#xA;#16 /src/craft/app/framework/console/CConsoleApplication.php(92): Craft\ConsoleCommandRunner-&amp;gt;run()&#xA;#17 /src/craft/app/framework/base/CApplication.php(185): Craft\ConsoleApp-&amp;gt;processRequest()&#xA;#18 /src/craft/app/etc/console/yiic.php(81): Craft\ConsoleApp-&amp;gt;run()&#xA;#19 /src/craft/app/etc/console/yiic(4): require_once()&#xA;&#xA;in /src/craft/app/etc/console/ConsoleApp.php (265)&#xA;in /src/craft/app/services/FieldsService.php (251)&#xA;in /src/craft/app/elementtypes/BaseElementType.php (445)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After googling, most suggestions hover around adjusting max_allowed_packet and/or wait_timeout. This doesn't make sense to me. I've set max_allowed_packet to 512M, and wait_timeout defaults to 8 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is CDbCommand not cleaning up after it self because the process runs forever?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-04-25T16:04:35.793" Title="Error while sending QUERY packet in continuously running process" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;mysql&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17668" PostTypeId="1" AcceptedAnswerId="17690" CreationDate="2016-11-10T11:58:58.220" Score="1" ViewCount="239" Body="&lt;p&gt;Part of a plugin I am writing needs to handle impersonating a user, in the same way that Craft offers the built in &quot;Log in as X&quot; for admins in the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have that working by essentially copying the &lt;code&gt;/app/controllers/UsersController actionImpersonate()&lt;/code&gt; function into my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the action is run, the newly logged in user is always being redirected to the homepage - which makes sense as it's the default page that front-end logins go to. But, I want to override it. I want my plugin to take them to a page I dynamically set. I can't seem to get it to happen. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAction()&#xA;{&#xA;&#xA;    // basic security precautions&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $this-&amp;gt;requireAdmin();&#xA;&#xA;    ... some stuff not relevant to the question ...&#xA;&#xA;    // get the user we want to impersonate&#xA;    $originalUserId = craft()-&amp;gt;userSession-&amp;gt;getId();&#xA;    $orderOwnerId = $order-&amp;gt;customer-&amp;gt;user-&amp;gt;id;&#xA;&#xA;    // impersonate the user&#xA;    craft()-&amp;gt;httpSession-&amp;gt;add(UserSessionService::USER_IMPERSONATE_KEY, $originalUserId);&#xA;&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;loginByUserId($orderOwnerId))&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Logged in.'));&#xA;        // $this-&amp;gt;_handleSuccessfulLogin(true);&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;httpSession-&amp;gt;remove(UserSessionService::USER_IMPERSONATE_KEY);&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('There was a problem impersonating this user.'));&#xA;        Craft::log(craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;username.' tried to impersonate userId: '.$userId.' but something went wrong.', LogLevel::Error);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm expecting that to redirect the newly logged in user to the page that the form was posted from - but it doesn't. Also, and I don't know if it's related, if I uncomment the &lt;code&gt;$this-&amp;gt;_handleSuccessfulLogin(true);&lt;/code&gt; line I get an error. That line is not commented out in the original function, and looking at the Craft docs to try and learn what it does, it says the function is deprecated ( &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#handleSuccessfulLogin-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/UsersService#handleSuccessfulLogin-detail&lt;/a&gt; )&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2016-11-10T23:39:02.633" LastActivityDate="2016-11-11T10:25:43.900" Title="Impersonating a User from a plugin, with specific page redirect" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17669" PostTypeId="1" AcceptedAnswerId="17682" CreationDate="2016-11-10T12:52:38.317" Score="2" ViewCount="409" Body="&lt;p&gt;Is there a easy way to start Craft Commerce order ids form a higher number?&#xA;So the can follow on from an old system and not overlap?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;autoincrement in the DB table maybe?&lt;/p&gt;&#xA;" OwnerUserId="5838" LastActivityDate="2016-11-10T21:26:18.843" Title="Craft Commerce starting order ids form a higher number?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17670" PostTypeId="1" CreationDate="2016-11-10T13:31:48.357" Score="1" ViewCount="44" Body="&lt;p&gt;Admin users can replace asset files without having to deal with re-uploading/re-creating a new asset using the feature/technique described in Peter's answer here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1550/is-it-possible-to-replace-uploaded-assets&quot;&gt;Is it possible to replace uploaded assets?&lt;/a&gt;. This has the advantage of preserving any values in the asset's custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to populate some of those fields dynamically though, so they correspond to the new file for the asset. So, I wrote a small plugin that listens to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#assets-onReplaceFile&quot; rel=&quot;nofollow noreferrer&quot;&gt;assets.onReplaceFile&lt;/a&gt; event like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.replaceFile', function(Event $event) {&#xA;  Craft::dd($event-&amp;gt;params); // or whatever&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the code in the handler never gets executed. Is this the right event to listen to this specific user action or is there another event for it? Or am I doing something wrong here? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5829" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-11-10T13:31:48.357" Title="Listen to replacing files through CP's assets section" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;control-panel&gt;&lt;replace&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17671" PostTypeId="1" AcceptedAnswerId="17683" CreationDate="2016-11-10T13:57:15.037" Score="1" ViewCount="366" Body="&lt;p&gt;Using commerceCurrency filter from the Craft commerce plugin, how can I add the currency name after the price instead of before the price, and drop the zeros when not necessary ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ product.variants[0].salePrice | commerceCurrency(cart.currency) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;€68.00&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I output this :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;68€&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2016-11-10T22:13:37.223" Title="How to set the commerceCurrency filter in an European style" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17672" PostTypeId="2" ParentId="12930" CreationDate="2016-11-10T14:26:41.463" Score="2" Body="&lt;p&gt;I recently found that if your deleting an entry on the entries list, you need to use the onBeforePerformAction event. Then break this down, like J Thomas states on this -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16831/get-the-type-of-action-and-the-elementss-that-an-action-is-being-performed-on&quot;&gt;Get the type of action and the elements(s) that an action is being performed on when listening to elements.onPerformAction?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-11-10T14:26:41.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17674" PostTypeId="1" CreationDate="2016-11-10T16:19:13.803" Score="0" ViewCount="174" Body="&lt;p&gt;Related to this previous post. But I have created a new post with more information.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17639/understanding-eager-loading/17646?noredirect=1#comment24277_17646&quot;&gt;Understanding Eager Loading&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So My template code with Eager Loading looks like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articles = craft.entries({&#xA;        section: 'blog',&#xA;        with: [&#xA;            ['bannerImage', { withTransforms: ['cardImage'] } ]&#xA;        ]&#xA;}) %}&#xA;&#xA;&#xA;{% block main %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;blogPrimary&quot;&amp;gt;&#xA;        &amp;lt;h1 class=&quot;section__heading // flush-bottom&quot;&amp;gt;&amp;lt;strong&amp;gt;Riaflex&amp;lt;/strong&amp;gt; Blog&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;p class=&quot;section__msg // margin-bottom&quot;&amp;gt;Latest and featured articles from Riaflex&amp;amp;trade;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;section class=&quot;row&quot;&amp;gt;&#xA;{% for article in articles.featured('1').limit(1)  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // l-blogCard--featured&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;featuredPost&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Featured&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            {# &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt; #}&#xA;&#xA;            {% set image = article.bannerImage[0] ?? null %}&#xA;            {% if image %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('cardImage') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for article in articles.featured('not 1')  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // {{ loop.first ? 'l-blogCard--featured' : 'l-blogCard' }}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;            {% if  loop.first %}&#xA;            &amp;lt;div class=&quot;featuredPost // featuredPost--latest&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Latest&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% set image = article.bannerImage[0] ?? null %}&#xA;            {% if image %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('cardImage') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA;{# DUMMY TO RPEAT THE CONTENT #}&#xA;{% for article in articles  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // l-blogCard&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;&#xA;            {% set image = article.bannerImage[0] ?? null %}&#xA;            {% if image %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('cardImage') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in &lt;strong&gt;38 queries&lt;/strong&gt; according to the log in the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the original code without Eager Loading:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articles = craft.entries.section('blog').order('postDate desc') %}&#xA;&#xA;{% for article in articles.featured('1').limit(1)  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // l-blogCard--featured&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;featuredPost&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Featured&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for article in articles.featured('not 1')  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // {{ loop.first ? 'l-blogCard--featured' : 'l-blogCard' }}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;            {% if  loop.first %}&#xA;            &amp;lt;div class=&quot;featuredPost // featuredPost--latest&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;Latest&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;&#xA;            &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# DUMMY TO RPEAT THE CONTENT #}&#xA;{% for article in articles  %}&#xA;{% set array = article.title|split(' ', 2) %}&#xA;    &amp;lt;div class=&quot;c-card // l-blogCard&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;img src=&quot;{{ article.bannerImage.first().getUrl('cardImage') }}&quot; alt=&quot;{{ article.title }}&quot; class=&quot;c-card__img&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c-card__bar // js_fitcontent&quot;&amp;gt;&#xA;                &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p class=&quot;flush-bottom&quot;&amp;gt;&#xA;                    &amp;lt;svg role=&quot;img&quot; class=&quot;icon // icon-date&quot; title=&quot;Date Icon&quot;&amp;gt;&#xA;                        &amp;lt;use xlink:href=&quot;/assets/img/icons.svg#icon-date&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                    &amp;lt;/svg&amp;gt;{{ helpers.date_formatted(article.postDate) }}&#xA;                &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;c-card__over&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;c-card__over-content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;animate&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;c-card__title&quot;&amp;gt;&amp;lt;strong&amp;gt;{{ attribute(array, 0) }}&amp;lt;/strong&amp;gt; {{ attribute(array, 1) }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;half-margin-bottom&quot;&amp;gt;&#xA;                            {{ article.subHeading }}&amp;amp;hellip;&amp;lt;br /&amp;gt;&#xA;                        &amp;lt;/p&amp;gt;&#xA;                        &amp;lt;p class=&quot;btn // btn--sub&quot;&amp;gt;Read Article&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in &lt;strong&gt;39 queries&lt;/strong&gt; according to the log in the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this isn't being reduced more and what might be off in my syntax? I have tried to follow the docs as best I can so really not sure where else to turn.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-11-10T16:19:13.803" Title="Eager Loading not reducing the queries" Tags="&lt;performance&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17675" PostTypeId="1" AcceptedAnswerId="17678" CreationDate="2016-11-10T16:21:56.163" Score="1" ViewCount="342" Body="&lt;p&gt;This is my Matrix set up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AoxjL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AoxjL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stumped to how to get the Categories URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.galleriesItem %}&#xA;    {% switch block.type %}&#xA;&#xA;        {% case &quot;galleriesItem&quot; %}&#xA;            &amp;lt;a href=&quot;{{ block.linkTo.first().url() }}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;grid-item panel {% if loop.index is divisible by(3) %}last{% endif %}&quot;&amp;gt;&#xA;                    {% for asset in block.image %}&#xA;                        &amp;lt;img src=&quot;{{ asset.getUrl }}&quot;  alt=&quot;{{ asset.title }}&quot;/&amp;gt;&#xA;                    {% endfor %}&#xA;&#xA;                    &amp;lt;div class=&quot;bg-white panel__title&quot;&amp;gt;&#xA;                        &amp;lt;span class=&quot;cta-link cta-link--black&quot;&amp;gt;{{ block.galleryType }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I previously used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.linkTo.first().url() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when the field type was an entry.&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2016-11-11T00:35:34.300" LastActivityDate="2016-11-11T00:35:34.300" Title="How to get Category URL from field in Matrix" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17676" PostTypeId="1" CreationDate="2016-11-10T16:37:29.017" Score="3" ViewCount="304" Body="&lt;p&gt;I'm trying to create a Dropdown field and add it to the User field layout. I've successfully created an empty dropdown field (no options) and added it to the User field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current code for that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$subscriptionStatusField = new FieldModel();&#xA;$subscriptionStatusField-&amp;gt;groupId = 1;&#xA;$subscriptionStatusField-&amp;gt;name = &quot;Subscription Status&quot;;&#xA;$subscriptionStatusField-&amp;gt;handle = &quot;subscriptionStatus&quot;;&#xA;$subscriptionStatusField-&amp;gt;translatable = false;&#xA;$subscriptionStatusField-&amp;gt;type = &quot;Dropdown&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm having trouble with is how to add options to the dropdown field. How can I do this programmatically?&lt;/p&gt;&#xA;" OwnerUserId="5570" LastActivityDate="2016-11-10T16:37:29.017" Title="How can I create a dropdown field programmatically with a plugin?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;field&gt;&lt;usermodel&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17677" PostTypeId="1" AcceptedAnswerId="17680" CreationDate="2016-11-10T17:05:39.550" Score="10" ViewCount="15536" Body="&lt;p&gt;Very simple request!&#xA;All I want to do is to be able to get the full URL of the page &amp;amp; output that in the HTML (for a 'share this page' link).&lt;br&gt;&#xA;Can anyone help please?&#xA;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2020-12-08T21:32:54.593" Title="How to output the full page URL?" Tags="&lt;siteurl&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17678" PostTypeId="2" ParentId="17675" CreationDate="2016-11-10T17:30:39.773" Score="4" Body="&lt;p&gt;&lt;code&gt;{{ block.linkTo.first().url() }}&lt;/code&gt; looks basically right, but a couple of things could be going wrong here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does the &lt;code&gt;Galleries&lt;/code&gt; category have a url assigned? (make sure the &quot;Categories in this group have their own URLs&quot; box is checked)&lt;/li&gt;&#xA;&lt;li&gt;Is there a category? You should &lt;em&gt;always&lt;/em&gt; check, even if it is a required field. You can do &lt;code&gt;{% if block.linkTo.first() %}...{% endif %}&lt;/code&gt; or &lt;code&gt;{{ block.linkTo.first().url() ?? '' }}&lt;/code&gt; and use the &lt;a href=&quot;https://github.com/TopShelfCraft/QQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;A null coalescing operator&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="130" LastActivityDate="2016-11-10T17:30:39.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17679" PostTypeId="2" ParentId="17641" CreationDate="2016-11-10T19:17:12.887" Score="2" Body="&lt;p&gt;In a multilingual site, your &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-4-define-your-site-uRLs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;siteUrl&lt;/code&gt; config setting&lt;/a&gt; in &lt;code&gt;/craft/config/general.php&lt;/code&gt; needs to be an array where the keys correspond to your installed locales:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'no' =&amp;gt; 'http://example.com/',&#xA;        'en_us' =&amp;gt; 'http://example.com/en/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-10T19:17:12.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17680" PostTypeId="2" ParentId="17677" CreationDate="2016-11-10T19:34:23.847" Score="22" Body="&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 this is now &lt;code&gt;{{ craft.app.request.absoluteUrl }}&lt;/code&gt; — for those who land here from a search and want to avoid using the deprecation notice to update it! (see answer from @natebeaty)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in case you are looking for more options like &lt;code&gt;{{ craft.app.request.pathInfo }}&lt;/code&gt; to get current url path, look up the Craft 3 &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-request.html#public-properties&quot; rel=&quot;noreferrer&quot;&gt;Craft Web Request Class&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to include the query string (like &lt;code&gt;?foo=bar&lt;/code&gt;), this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.request.getHostInfo() ~ craft.request.getRequestUri() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond that, &lt;code&gt;craft.request&lt;/code&gt; is mapped to the &lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-httprequestvariable.html&quot; rel=&quot;noreferrer&quot;&gt;HttpRequestVariable class&lt;/a&gt;, which contain a plethora of methods and properties to render information about the current request.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="10151" LastEditDate="2019-11-12T10:01:41.707" LastActivityDate="2019-11-12T10:01:41.707" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17681" PostTypeId="2" ParentId="17661" CreationDate="2016-11-10T19:55:03.973" Score="1" Body="&lt;p&gt;It's possible to pass MySQL functions to the &lt;code&gt;order&lt;/code&gt; parameter. &lt;a href=&quot;https://www.copterlabs.com/natural-sorting-in-mysql/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using the MySQL &lt;code&gt;LENGTH&lt;/code&gt; function&lt;/a&gt;, I believe the following should do the trick &lt;em&gt;(assuming your &quot;model number&quot; field's handle is &lt;code&gt;modelNumber&lt;/code&gt;)&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('yourSection').order('LENGTH(modelNumber) asc, modelNumber asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-11-10T20:22:47.473" LastActivityDate="2016-11-10T20:22:47.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17682" PostTypeId="2" ParentId="17669" CreationDate="2016-11-10T21:26:18.843" Score="0" Body="&lt;p&gt;You can write a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt; that listens to the &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforeordercomplete&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeOrderComplete&lt;/a&gt; event and implement whatever sort of order number format your business requirements require.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively here's an existing plugin that uses that method that might already cover your needs: &lt;a href=&quot;https://github.com/bossanova808/CommerceFriendlyOrderNumbers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bossanova808/CommerceFriendlyOrderNumbers&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-10T21:26:18.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17683" PostTypeId="2" ParentId="17671" CreationDate="2016-11-10T22:13:37.223" Score="1" Body="&lt;p&gt;The current formatter looks at the currency's format and the current locale of the user. What locale are you set to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can drop the zeros with the stripZeros param in the currencyConvert filter. See docs here: &lt;a href=&quot;https://craftcommerce.com/docs/twig-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/twig-filters&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-10T22:13:37.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17684" PostTypeId="2" ParentId="17668" CreationDate="2016-11-10T23:46:12.013" Score="1" Body="&lt;p&gt;Since this is an action in your own plugin's controller, you can literally do anything you want after the login happens.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;userSession-&amp;gt;loginByUserId($orderOwnerId))&#xA;{&#xA;    $this-&amp;gt;redirect('https://www.reddit.com/');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if I uncomment the &lt;code&gt;$this-&amp;gt;_handleSuccessfulLogin(true);&lt;/code&gt; line I get an error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because that's a private method you probably didn't copy over from Craft's &lt;code&gt;UsersController.php&lt;/code&gt;.  You don't have to use it if you don't want to.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;it says the function is deprecated (&lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#handleSuccessfulLogin-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/UsersService#handleSuccessfulLogin-detail&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Same method name (mostly), but not in the UsersController... it's on the UsersService.  It's also public, not private.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-10T23:46:12.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17685" PostTypeId="1" CreationDate="2016-11-11T07:50:29.920" Score="0" ViewCount="153" Body="&lt;p&gt;I have just completed a fresh install of Craft CMS Pro and the Commerce plugin on my local host.  To view the website I go to localhost:8888 and I see the generic home page that says &quot;Welcome to Localhost. Recent News - We just installed Craft&quot; etc...   My question is, how do I view the page that my sample Commerce template is on that I dropped into the templates folder?  In my templates folder it is &lt;code&gt;/templates/shop&lt;/code&gt;.  I also still have &lt;code&gt;/templates/news/&lt;/code&gt; in there that came with the Craft Pro in the &lt;code&gt;templates&lt;/code&gt; folder as well. Maybe I'm confused but I thought my homepage would be overwritten with some sort of shopping website template, or do I need to go to localhost:8888/xxxxx? &lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="57" LastEditDate="2016-11-11T17:53:28.123" LastActivityDate="2016-11-11T17:53:28.123" Title="Commerce template question" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17686" PostTypeId="1" CreationDate="2016-11-11T07:53:21.070" Score="0" ViewCount="233" Body="&lt;p&gt;Can you give an example of returning entries from a section in JSON format using a custom query? &lt;/p&gt;&#xA;" OwnerUserId="5675" LastEditorUserId="57" LastEditDate="2016-11-11T17:55:49.537" LastActivityDate="2016-11-11T17:55:49.537" Title="How to create a custom query inside a plugin in Craft?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17687" PostTypeId="2" ParentId="17686" CreationDate="2016-11-11T08:00:51.270" Score="2" Body="&lt;p&gt;Easy enough:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$query-&amp;gt;section = 'mySection';&#xA;$results = $query-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can obviously refine the query before calling &lt;code&gt;find()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query-&amp;gt;limit   = null;&#xA;$query-&amp;gt;myCustomField = 'value';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2016-11-11T08:00:51.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17688" PostTypeId="2" ParentId="17685" CreationDate="2016-11-11T08:19:58.433" Score="1" Body="&lt;p&gt;Yes, the example templates are designed to be used inside a subdirectory like &lt;code&gt;/shop&lt;/code&gt;. This does not stop you from putting the example templates anywhere else (like the root template directory), but links inside the example template referencing &lt;code&gt;/shop&lt;/code&gt; would need to be updated.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-11T08:19:58.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17689" PostTypeId="1" AcceptedAnswerId="17983" CreationDate="2016-11-11T10:13:44.910" Score="1" ViewCount="471" Body="&lt;p&gt;So I made an account with MultiSafePay:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Added my website where i need to get payments from.&lt;/li&gt;&#xA;&lt;li&gt;Filled in the API key and Locale&lt;/li&gt;&#xA;&lt;li&gt;Enabled it for customers (me)&lt;/li&gt;&#xA;&lt;li&gt;Changed the Gateway of MultiSafepay from XmlGateway to RestGateway.&#xA;(Because XMLGateway is deprecated)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How would I add it to the checkout process in Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I only get to see the credit card fields if MultiSafePay is selected in the dropdown, but I enabled all the payment options at MultiSafePay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody explain to me and others how to implement it correctly?&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="22" LastEditDate="2017-05-09T20:50:29.567" LastActivityDate="2017-08-01T12:36:49.663" Title="Commerce PaymentGateway configuration" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;&lt;omnipay&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17690" PostTypeId="2" ParentId="17668" CreationDate="2016-11-11T10:25:43.900" Score="1" Body="&lt;p&gt;AGH: my problem was only that the redirect value I was passing was incomplete, which caused the template I was redirecting to to itself redirect elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complete solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myplugin/mycontroller/myaction&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.path }}?{{ craft.request.queryStringWithoutPath }}&quot;&amp;gt;{# redirect back to this page #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;orderNumber&quot; value=&quot;{{ number }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button warning&quot; value=&quot;Disable date restrictions &amp;amp;amp; impersonate customer&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The controller action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAction()&#xA;{&#xA;&#xA;    // basic security precautions&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $this-&amp;gt;requireAdmin();&#xA;&#xA;    ... some stuff not relevant to the question ...&#xA;&#xA;    // get the user we want to impersonate&#xA;    $originalUserId = craft()-&amp;gt;userSession-&amp;gt;getId();&#xA;    $orderOwnerId = $order-&amp;gt;customer-&amp;gt;user-&amp;gt;id;&#xA;&#xA;    // impersonate the user&#xA;    craft()-&amp;gt;httpSession-&amp;gt;add(UserSessionService::USER_IMPERSONATE_KEY, $originalUserId);&#xA;&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;loginByUserId($orderOwnerId))&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Logged in.'));&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;httpSession-&amp;gt;remove(UserSessionService::USER_IMPERSONATE_KEY);&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('There was a problem impersonating this user.'));&#xA;        Craft::log(craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;username.' tried to impersonate userId: '.$userId.' but something went wrong.', LogLevel::Error);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-11-11T10:25:43.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17692" PostTypeId="1" AcceptedAnswerId="23986" CreationDate="2016-11-11T16:41:38.430" Score="1" ViewCount="263" Body="&lt;p&gt;Despite using null and paginate false i can still only return 100 queries with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;    limit: null,&#xA;    paginate: false,&#xA;    section: 'directory',&#xA;    relatedTo: relationParam&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get all of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* UPDATE *&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well I found the problem and solution which is a bit strange - makes no sense to me.&#xA;I am passing relatedTo a merged string 'relationParam' which has the mulitpple categories I want to search for. Once I set the limits on the categories that are related to the entries -see below - it all works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set c = craft.categories.group('locations').slug(countrySlug).limit(null) %}&#xA;{% set p = craft.categories.group('locations').slug(portSlug).limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what doesn't make sense to me is that I am having to set the limit outside of the main entries query. I would have thought the entry limit specification would do this  not on the categories related.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2016-11-14T14:34:20.073" LastActivityDate="2018-02-25T18:39:46.803" Title="Only allowed 100 queries with relatedto?" Tags="&lt;limit&gt;&lt;query&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17694" PostTypeId="1" AcceptedAnswerId="17712" CreationDate="2016-11-11T18:02:21.890" Score="0" ViewCount="606" Body="&lt;p&gt;Background: I've inherited a site built in craft that has a page called &quot;updates&quot; with a button to load additional entries through ajax. The updates page is an entry in the &quot;page&quot; structure and when it's template is called it loads entries stored in a channel also called &quot;updates&quot;. The template the &quot;pages&quot; structure points to is pages/_entry.html, and this holds the logic for gathering entries stored in the &quot;updates&quot; channel. However, the ajax script calls /updates/q?param=1 which is somehow calling the template updates/index.html. All while the channel is set to call template entries/_entry.html for the individual entries in the channel.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried to create a blog page that would work the same way. I created an entry in the &quot;pages&quot; structure called blog, then created the template blog/index.html which is the same as updates/index.html. The ajax script calls /blog/q?param=1 but it returns a 404. I even created a channel in the cms called blog wondering if that was the case but it hasn't helped. What does the url need to be to return blog/index.html?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pages/_entry.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;{% set myJs %}&#xA;window.entryType = '{{ entry.type }}';&#xA;{% endset %}&#xA;&#xA;{% includeJs myJs %}&#xA;{% cache unless craft.config.devMode %}&#xA;&#xA;  {% if entry.type != 'contact' %}&#xA;    {% include ['_partials/_page-header-' ~ entry.type, '_partials/_page-header'] %}&#xA;  {% endif %}&#xA;&#xA;  {% include ['_partials/_page-content-' ~ entry.type, '_partials/_page-content' ] %}&#xA;&#xA;{% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;updates/index.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;  {% set layout = &quot;_ajax&quot; %}&#xA;{% else %}&#xA;  {% set layout = &quot;_layout&quot; %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% extends layout %}&#xA;{% set title = 'Updates' %}&#xA;{% block content %}&#xA;&#xA;{% cache for 3 hours unless craft.config.devMode %}&#xA;  {% if craft.request.isAjax %}&#xA;    {% include '_partials/_get-updates' %}&#xA;  {% else %}&#xA;    {% set entry = craft.entries.slug('updates').featuredUpdate %}&#xA;&#xA;    &amp;lt;section class=&quot;l-section u-bg--light-gray&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;l-container&quot;&amp;gt;&#xA;        {% include '_partials/_updates-filter' %}&#xA;        {% include '_partials/_grid-cards' %}&#xA;        &amp;lt;div class=&quot;l-section__cta&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;#&quot; class=&quot;btn btn--large&quot; id=&quot;load-more&quot;&amp;gt;Load More&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5876" LastActivityDate="2016-11-14T12:31:46.853" Title="Can't get correct template for ajax call" Tags="&lt;templating&gt;&lt;ajax&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17695" PostTypeId="2" ParentId="5175" CreationDate="2016-11-11T18:06:49.610" Score="1" Body="&lt;p&gt;More recently, you're required to install the Guest Entries plugin and configure it to allow public posts. Without said configuration, submissions will be rejected one way or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1nXc6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1nXc6.png&quot; alt=&quot;configure the thing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2016-11-11T18:06:49.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17696" PostTypeId="2" ParentId="17564" CreationDate="2016-11-11T22:03:29.067" Score="2" Body="&lt;p&gt;Looks like the issue had to do with my production environment being load-balanced. To avoid errors like these on load balanced sites, remember to set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;nofollow noreferrer&quot;&gt;validationKey&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow noreferrer&quot;&gt;appId&lt;/a&gt; config keys in your general.php file.&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-11-11T22:03:29.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17697" PostTypeId="1" AcceptedAnswerId="17698" CreationDate="2016-11-12T15:36:03.083" Score="3" ViewCount="2312" Body="&lt;p&gt;Is there any simple way to automatically add a version number when referencing a CSS file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &lt;code&gt;&amp;lt;link href=&quot;style.css?v=VERSION-HERE&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Version could be a timestamp when the style.css was last modified or something like that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is that I often have to tell my clients to force the browser to reload because they don't see the latest changes I've made in style.css. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it matters, I use Deploybot and github.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="5034" LastEditDate="2016-11-15T14:07:18.493" LastActivityDate="2016-11-21T17:09:34.620" Title="Force browser to download latest CSS file" Tags="&lt;cache&gt;&lt;css&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17698" PostTypeId="2" ParentId="17697" CreationDate="2016-11-12T15:52:32.223" Score="7" Body="&lt;p&gt;There are several plugins that can do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my plugin &lt;a href=&quot;https://github.com/aelvan/Stamp-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stamp&lt;/a&gt;, you can add a timestamp to the filename or path in the following formats:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;/assets/build/js/1399647655/scripts.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/assets/build/js/scripts.1399647655.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&quot;/assets/build/js/scripts.js?ts=1399647655&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The last one, which is the one you're looking for is made with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;{{ craft.stamp.er('/assets/build/js/scripts.js', 'query') }}&quot;&amp;gt;&amp;lt;/script&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also get only the timestamp, and use it however you want, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timestamp = craft.stamp.er('/assets/build/js/scripts.js', 'tsonly') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's worth noting that you'd ideally want to not use a query string for this, as various frontside proxies could ignore it. But, you need to be able to set up the proper url rewriting in your webserver for the filename and folder versions, so that might not always be possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also &lt;a href=&quot;https://github.com/focuslabllc/craftcms-cachebuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cache Buster&lt;/a&gt; from Focuslab which can add a query string, but also supports file revisioning based on a manifest file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there's &lt;a href=&quot;https://github.com/clubstudioltd/craft-asset-rev&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Rev&lt;/a&gt; from Club Studio which is primarily for file revisioning based on a manifest file, but falls back to a query string. &lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2016-11-12T16:37:08.763" LastActivityDate="2016-11-12T16:37:08.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17699" PostTypeId="1" AcceptedAnswerId="17700" CreationDate="2016-11-12T21:15:37.467" Score="0" ViewCount="478" Body="&lt;p&gt;I need to setup a way to quick-edit products while viewing them in a list, similar to woocommerce bulk edit feature: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6SY8C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6SY8C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find any documentation on actual editing of the products, as opposed to editing the product in a cart (such as quantity.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I can grab products in my plugin template file using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.order('title ASC').limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't give me access to things like how much inventory is left, so that I can output that and offer a field to edit it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I miss the docs to do this? Not sure if Commerce is setup with services available for other plugins to edit products.&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-11-13T02:06:35.927" Title="Commerce - Edit Products via Plugin" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17700" PostTypeId="2" ParentId="17699" CreationDate="2016-11-13T02:06:35.927" Score="3" Body="&lt;p&gt;This is a fairly complex question and this is only really a sketch of an answer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to get to know the available models and services in Commerce pretty well to achieve this in all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll most likely do much more work in the plugin side of things than the template side of things - that is, you'll pull together the models/data you want in the plugin, and then pass those things through to the template, rather than just retrieve the data in the template I'd say (as per your example there).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd take the various selection paramaters (categories, stock level, whatever) and post these to a controller in your plugin. Then in your plugin, you'd get the variant models you want via PHP, and then post this data through to a template that would render it into a form, and probably just return this whole form via json as some html that you then display with some front end ajax&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         $this-&amp;gt;requirePostRequest();&#xA;         $param1 = craft()-&amp;gt;request-&amp;gt;getPost('whatever'));              &#xA;&#xA;        //This is a service in your plugin that gathers and returns variant models&#xA;        $data = craft()-&amp;gt;yourplugin-&amp;gt;searchStock($param1,...);&#xA;&#xA;&#xA;       $html = $this-&amp;gt;renderTemplate('yourplugin/stockEditForm', array(&#xA;            'products' =&amp;gt; $data,&#xA;        ), true);&#xA;&#xA;        $this-&amp;gt;returnJson([&quot;success&quot;=&amp;gt;true, &quot;html&quot;=&amp;gt;$html]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... in your stockEditForm you then just loop through the products as normal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       {% for product in products %} ...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... then some ajax to actually render that on the plugin page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $.ajax({&#xA;        type: 'POST',&#xA;        url: '/actions/yourplugin/bulkStockEdit',&#xA;        data: form_data,&#xA;        success: function(response) {&#xA;            $spinner.hide();&#xA;            $results.html(response.html);&#xA;            $results.show();&#xA;        },&#xA;        statusCode: {&#xA;            500: function(jqXHR, textStatus, errorThrown) {&#xA;              $spinner.hide();&#xA;              $results.html(jqXHR.responseText);&#xA;              $results.show();&#xA;            }&#xA;        },&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will get you a form with the data populated into it.  From there, each &lt;code&gt;save&lt;/code&gt; button in your constructed will need to be hooked up to some ajax to call appropriate Commerce controllers to actually save the changed variants... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that, as a basic structure, would get you going with this.  Bulk stock editing certainly would be handy at times!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-13T02:06:35.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17701" PostTypeId="1" AcceptedAnswerId="17703" CreationDate="2016-11-13T17:39:07.570" Score="0" ViewCount="1630" Body="&lt;p&gt;So I've created a globals set (socialMedia) with 10 input fields, but this could grow in the future, for clients to add links to various social media accounts. This works fine except that the code for this seems overly long and reptitive since I need to put a conditional to check if each field has been output. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;social list-inline&quot;&amp;gt;&#xA;  {% if socialMedia.facebook | length %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.facebook }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-facebook&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.twitter | length %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.facebook }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-twitter&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.flickr | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.flickr }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-flickr&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.instagram | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.instagram }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-instagram&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.email | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.email }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-envelope-o&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.vimeo | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.vimeo }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-vimeo-square&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.youtube | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.youtube }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-youtube&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.linkedin | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.linked }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-linkedin&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.tumblr | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.tumblr }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-tumblr-square&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.googlePlus | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.googlePlus }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-google-plus-official&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% if socialMedia.dribble | length %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ socialMedia.dribble }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-dribbble&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ideally I could set an array and then do a for loop and output everything as needed in a couple of lines. However I'm not sure how to proceed with that or if it is even possible.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2016-11-13T17:46:48.683" LastActivityDate="2016-11-13T18:17:47.130" Title="Create an Array in Twig and loop through fields in global set" Tags="&lt;templating&gt;&lt;globals&gt;&lt;array&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17702" PostTypeId="2" ParentId="17701" CreationDate="2016-11-13T17:47:06.880" Score="1" Body="&lt;p&gt;Why not just use a single table field or SuperTable (plugin) field and iterate over its rows?&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2016-11-13T17:47:06.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17703" PostTypeId="2" ParentId="17701" CreationDate="2016-11-13T17:54:20.937" Score="2" Body="&lt;p&gt;Seems like a great use case for a &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig macro&lt;/a&gt;.  Completely untested, but something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro social(object, type) %}&#xA;&#xA;    {% set value = attribute(object, type) %}&#xA;&#xA;    {% if value | length %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ value }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-{{ type }}&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% import &quot;myMacros.html&quot; as myMacros %}&#xA;&#xA;{% set socialArray = ['facebook', 'twitter', 'instagram', 'vimeo', 'youtube'] %}&#xA;&#xA;{% for socialType in socialArray %}&#xA;    {{ myMacros.social(socialMedia, socialType) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-11-13T18:17:47.130" LastActivityDate="2016-11-13T18:17:47.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17704" PostTypeId="1" AcceptedAnswerId="17705" CreationDate="2016-11-13T18:22:24.950" Score="1" ViewCount="481" Body="&lt;p&gt;I have an include setup for Navigation which works fine if I hard code in the level of the structure I want to use. However I need this to be set differently if the nav appears in the head or the footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;head:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% include &quot;_includes/nav&quot;&#xA;        with {&#xA;          'listType' : 'list-inline pull-right',&#xA;          'navLevel'  : '2'&#xA;        }&#xA;      %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;footer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% include &quot;_includes/nav&quot;&#xA;        with {&#xA;          'listType' : 'list-unstyled',&#xA;          'navLevel'  : '1'&#xA;        }&#xA;      %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The include looks like this where I want the &lt;code&gt;.level('&amp;lt;=2')&lt;/code&gt; to have the value passed via the include. However when I attempt this &lt;code&gt;.level('&amp;lt;=navLevel')&lt;/code&gt; or similar the entire nav does not render.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation %}&#xA;&#xA; {% set pages = craft.entries.section('navigation').level('&amp;lt;=2') %}&#xA;&#xA; &amp;lt;ul class=&quot;{{ listType }}&quot;&amp;gt;&#xA;   {% nav page in pages %}&#xA;     &amp;lt;li&amp;gt;&#xA;       {# Check for entry type / get related entry #}&#xA;       {% if page.type == 'internalLink' %}&#xA;           {% set linkedEntry = page.sitePageLink.limit(1).first() %}&#xA;           &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;  data-url=&quot;{{ entry.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;       {% endif %}&#xA;&#xA;       {# Check for entry type / get offsiteLinks #}&#xA;       {% if page.type == 'offsiteLink' %}&#xA;           &amp;lt;a href=&quot;{{ page.offSiteLink }}&quot;  data-url=&quot;{{ entry.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;       {% endif %}&#xA;&#xA;       {% ifchildren %}&#xA;         {# dropdown not set up yet #}&#xA;          &amp;lt;ul class=&quot;dropdown&quot; style=&quot;background:pink&quot;&amp;gt;&#xA;              {% children %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;&#xA;     &amp;lt;/li&amp;gt;&#xA;   {% endnav %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&#xA; {% endset %}&#xA;&#xA; {# replace data-uri with active class #}&#xA; {{ navigation|replace({('data-url=&quot;' ~ craft.request.getUrl() ~ '&quot;'): 'class=&quot;active&quot;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2016-11-13T18:50:15.120" Title="Use variable passed via include to set value of paramenter" Tags="&lt;templating&gt;&lt;variable&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17705" PostTypeId="2" ParentId="17704" CreationDate="2016-11-13T18:50:15.120" Score="2" Body="&lt;p&gt;You'll need to concatenate the string you pass to the &lt;code&gt;level&lt;/code&gt; parameter, using the &lt;code&gt;~&lt;/code&gt; operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('navigation').level('&amp;lt;='~navLevel) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-13T18:50:15.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17707" PostTypeId="1" AcceptedAnswerId="17708" CreationDate="2016-11-14T02:03:15.160" Score="0" ViewCount="75" Body="&lt;p&gt;I thought this was going to be easy; showing the order number of children against their parent, but the only answer I can find is in this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13214/how-to-get-the-order-number-of-the-current-entry-in-a-structure&quot;&gt;thread&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I'm unsure how to implement this into my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for chapter in entry.descendants %}&#xA;&amp;lt;div class=&quot;part&quot;&amp;gt;&amp;lt;span&amp;gt;Part {{ chapter.orderNumber | numbersToWords }}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;                      &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Resulting in: &lt;strong&gt;Part One&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;code&gt;numbersToWords&lt;/code&gt; is the Helpers Plugin by &lt;a href=&quot;https://github.com/carlcs/craft-helpers&quot; rel=&quot;nofollow noreferrer&quot;&gt;carlcs&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-11-14T09:27:19.537" Title="Display children's order numbers" Tags="&lt;entries&gt;&lt;order&gt;&lt;children&gt;&lt;number&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17708" PostTypeId="2" ParentId="17707" CreationDate="2016-11-14T09:20:09.027" Score="1" Body="&lt;p&gt;If you're getting all the descendants in the for loop, you can use &lt;code&gt;loop&lt;/code&gt; to get the index of the current iteration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for chapter in entry.descendants %}&#xA;    &amp;lt;div class=&quot;part&quot;&amp;gt;&amp;lt;span&amp;gt;Part {{ loop.index | numbersToWords }}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation for loop in the Twig docs&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives you the index of the current iteration in the for loop though, not the actual position of the child in the structure. So if you query only a subset of the descendants, or reorder and manipulate the descendants, this won't work.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2016-11-14T09:27:19.537" LastActivityDate="2016-11-14T09:27:19.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17711" PostTypeId="1" AcceptedAnswerId="17724" CreationDate="2016-11-14T12:21:08.063" Score="2" ViewCount="245" Body="&lt;p&gt;From Brad's answer to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8341/is-crafts-search-case-insensitive/17710&quot;&gt;question&lt;/a&gt; it's obvious that Craft doesn't have a case sensitive search from the start, but he mentions that it depends on MySQL database and table collation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is however related to the way Craft saves keywords in &lt;code&gt;craft_searchindex&lt;/code&gt; table. Here they are converted to lowercase. So my question is if there is a way to enable case sensitive search through MySQL collation changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that the client sees an issue when searching for a Persons name in an article content he also finds results which only include words starting the same. However fuzzy search on the right side is needed, so turning it off isn't an option.&lt;/p&gt;&#xA;" OwnerUserId="4183" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-11-14T19:27:40.663" Title="Case sensitive craft.entries.search() in Craft" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17712" PostTypeId="2" ParentId="17694" CreationDate="2016-11-14T12:31:46.853" Score="1" Body="&lt;p&gt;It looks like a custom route has been set up for &lt;code&gt;/updates/q&lt;/code&gt; which points to the &lt;code&gt;updates/index.html&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two places this could have been configured:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic routes&lt;/a&gt; set up in the control panel, or&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advanced routing&lt;/a&gt; set up in the &lt;code&gt;routes.php&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Look in both of those places to see if a custom route has been set up for &lt;code&gt;/updates/q&lt;/code&gt;. If so, you will need to set up a similar one for &lt;code&gt;/blog/q&lt;/code&gt; so that Craft knows which template to render for those requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;routing&lt;/a&gt; docs are a good place to start to understand how all of this works.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-11-14T12:31:46.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17713" PostTypeId="1" CreationDate="2016-11-14T12:32:13.457" Score="0" ViewCount="557" Body="&lt;p&gt;Our site is hosted on AWS with assets uploading to an S3. Everything has worked great until the last update. Locally, I can upload assets without issue, but on the stage we're receiving an error &lt;code&gt;/index.php?p=admin/actions/assets/uploadFile 500 (Internal Server Error)&lt;/code&gt; preventing us from uploading. The files upload to the directory, but the upload bar hangs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the assets directory when pressing &quot;refresh&quot; on the bucket name, we receive the error &lt;code&gt;/index.php?p=admin/actions/assetSources/getS3Buckets 500 (Internal Server Error)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Version: &lt;code&gt;Craft CMS 2.6.2950&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the data from the logs.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/11/14 12:05:47 [error] [exception.Error] Error: Call to undefined function simplexml_load_string() in /var/www/stage.website.com/craft/app/lib/S3.php:2221&#xA;Stack trace:&#xA;#0 /var/www/stage.website.com/craft/app/lib/S3.php(420): S3Request-&amp;gt;getResponse()&#xA;#1 /var/www/stage.website.com/craft/app/assetsourcetypes/S3AssetSourceType.php(438): S3::getBucket('website-craft', 'banners/IR_shar...')&#xA;#2 /var/www/stage.website.com/craft/app/assetsourcetypes/BaseAssetSourceType.php(237): Craft\S3AssetSourceType-&amp;gt;getNameReplacementInFolder(Object(Craft\AssetFolderModel), 'IR_shareholder_...')&#xA;#3 /var/www/stage.website.com/craft/app/assetsourcetypes/BaseAssetSourceType.php(172): Craft\BaseAssetSourceType-&amp;gt;insertFileByPath('/var/www/stage....', Object(Craft\AssetFolderModel), 'IR_shareholder_...')&#xA;#4 /var/www/stage.website.com/craft/app/services/AssetsService.php(709): Craft\BaseAssetSourceType-&amp;gt;uploadFile(Object(Craft\AssetFolderModel))&#xA;#5 /var/www/stage.website.com/craft/app/controllers/AssetsController.php(52): Craft\AssetsService-&amp;gt;uploadFile('1', NULL, 0, NULL)&#xA;#6 /var/www/stage.website.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController-&amp;gt;actionUploadFile()&#xA;#7 /var/www/stage.website.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 /var/www/stage.website.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 /var/www/stage.website.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 /var/www/stage.website.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('uploadFile')&#xA;#11 /var/www/stage.mediatek.com/craft/app/etc/web/WebApp.php(818): CWebApplication-&amp;gt;runController('assets/uploadFi...')&#xA;#12 /var/www/stage.website.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /var/www/stage.website.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 /var/www/stage.website.com/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#15 /var/www/stage.website.com/public/index.php(19): require_once('/var/www/stage....')&#xA;#16 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/assets/uploadFile&#xA;HTTP_REFERER=http://stage.website.com/admin/assets&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016-11-14 20:25:28&#xA;&#xA;Level   error&#xA;Category    exception.Error&#xA;Message Error: Call to undefined function simplexml_load_string() in /var/www/stage.website.com/craft/app/lib/S3.php:2221&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We haven't made any system changes, so I'm unsure what the next step is. Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="3332" LastEditorUserId="3332" LastEditDate="2016-11-14T20:15:32.510" LastActivityDate="2016-11-16T08:07:16.170" Title="Craft 2.6 Asset Upload 500 Error (EC2 and Amazon S3)" Tags="&lt;assets&gt;&lt;upload&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2016-11-18T12:30:16.323" ContentLicense="CC BY-SA 3.0" />
  <row Id="17714" PostTypeId="1" AcceptedAnswerId="17732" CreationDate="2016-11-14T13:23:01.847" Score="0" ViewCount="150" Body="&lt;p&gt;Is there something else you have to add to Craft Commerce Email templates to show the amounts in the order currency used? It always shows the default currency (i.e. GBP) when it was ordered in USD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email template has been updated to the new tag of commerceCurrency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="5838" LastEditorUserId="57" LastEditDate="2016-11-14T19:17:24.880" LastActivityDate="2016-11-15T00:03:44.937" Title="Craft Commerce Currency - Email template not showing currency" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17715" PostTypeId="2" ParentId="17656" CreationDate="2016-11-14T13:47:12.643" Score="2" Body="&lt;p&gt;The fix in this particular case was to modify and save &lt;code&gt;/craft/app/resources/css/craft.css&lt;/code&gt; — this revs the timestamp in the query string.&lt;/p&gt;&#xA;" OwnerUserId="5869" LastActivityDate="2016-11-14T13:47:12.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17716" PostTypeId="1" CreationDate="2016-11-14T15:03:21.273" Score="1" ViewCount="244" Body="&lt;p&gt;I have a frontend Entry Form that will not save an entry and goes to a 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically i have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; class=&quot;add-a-resource__form&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/resources/thank-you&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;4&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;typeId&quot; value=&quot;4&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[topContent]&quot; value=&quot;test&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the log in the session array i have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'9df612913c35fa7bdbde58405537f412__timeout' =&amp;gt; 1479139200,&#xA;  '9df612913c35fa7bdbde58405537f412Yii.CWebUser.flash.error' =&amp;gt; 'Couldn’t save entry.',&#xA;  '9df612913c35fa7bdbde58405537f412Yii.CWebUser.flashcounters' =&amp;gt; &#xA;  array (&#xA;    'error' =&amp;gt; 0,&#xA;  ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am logged in as an admin so have permission to write to the channel, the details are right in the hidden fields, but when i submit the form, it goes to a 404 page no matter what i put in the redirect input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-11-14T15:18:37.960" Title="Entry Form doesn't save the entry and goes to 404 page" Tags="&lt;form&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17717" PostTypeId="2" ParentId="17716" CreationDate="2016-11-14T15:18:37.960" Score="1" Body="&lt;p&gt;Right, the issues was that there was a validation error on a field, but the form didn't reload and display those errors, it just went to a 404 page.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-11-14T15:18:37.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17718" PostTypeId="1" AcceptedAnswerId="17719" CreationDate="2016-11-14T16:38:02.930" Score="0" ViewCount="148" Body="&lt;p&gt;I have an entry page that lists out specific info for a product. I am using categories to sort the entries. I'm trying to figure out how to write a conditional that pulls in something specific if the entry belongs to a specific category.&lt;/p&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2016-11-14T17:56:43.667" Title="Category conditionals" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17719" PostTypeId="2" ParentId="17718" CreationDate="2016-11-14T17:03:48.127" Score="3" Body="&lt;p&gt;The category field returns an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which means you can use all the methods that you'd usually use to get a specific category on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if the category field is named &lt;code&gt;entryCategories&lt;/code&gt;, and you know the slug of the category you want to test for, you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.entryCategories.slug('my-category-slug').total() %}&#xA;    Do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could use the &lt;code&gt;id&lt;/code&gt;the same way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, this does not work if the entryCategory field was eager-loaded, since &lt;code&gt;entry.entryCategories&lt;/code&gt; would then return an array. In that case you could just loop over the array and have a check inside for loop that checks the category you're looping over is the correct one. A bit dirty, but it does the job. &lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="125" LastEditDate="2016-11-14T17:56:43.667" LastActivityDate="2016-11-14T17:56:43.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17721" PostTypeId="1" AcceptedAnswerId="17723" CreationDate="2016-11-14T18:16:36.833" Score="1" ViewCount="1040" Body="&lt;p&gt;This isn't &lt;em&gt;entirely&lt;/em&gt; Craft specific, but I am using this in my plugin so I guess if I get booed out - I deserve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a plugin that makes a call to a 3rd party API. I am using Guzzle to make the post/put requests and all is working well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am struggling though, now that I want to move beyond a 1:1 parameter:value query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client('http://site.com/api/');&#xA;$uri = 'users?id=' . $event-&amp;gt;params['user']-&amp;gt;id .&#xA;       '&amp;amp;first_name=' . $event-&amp;gt;params['user']-&amp;gt;firstName .&#xA;       '&amp;amp;last_name='  . $.event-&amp;gt;params['user']-&amp;gt;lastName;&#xA;&#xA;$request = $client-&amp;gt;post($uri, array('content-type' =&amp;gt; 'application/x-www-form-urlencoded'));&#xA;$request-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to add an &quot;activities&quot; parameter. Any user could have more than one activity. I am displaying them as a checkbox on my registration form - and I'm able to get the values. I am just not sure how to pass those values in my plugin to the api call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$activities = $event-&amp;gt;params['user']-&amp;gt;activity;&#xA;$selectedActivities = array();&#xA;&#xA;foreach ($activities as $option) {&#xA;    if ($option-&amp;gt;selected) {&#xA;        $selectedActivities[] = $option-&amp;gt;value;&#xA;    }&#xA;}&#xA;&#xA;error_log(print_r($selectedActivities, true));&#xA;&#xA;// [0] =&amp;gt; 2&#xA;// [1] =&amp;gt; 3&#xA;// [2] =&amp;gt; 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each value is the id of the activity I am passing along.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does that array get passed into my existing call? This is obviously incorrect, but here is what I am trying to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$uri = 'users?id=' . $event-&amp;gt;params['user']-&amp;gt;id .&#xA;       '&amp;amp;first_name=' . $event-&amp;gt;params['user']-&amp;gt;firstName .&#xA;       '&amp;amp;last_name='  . $.event-&amp;gt;params['user']-&amp;gt;lastName .&#xA;       '&amp;amp;activities=' .$selectedActivities; &#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried using &lt;code&gt;serialize()&lt;/code&gt; but I get some funky results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have updated my calls accordingly - thank you for the tip!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm seeing all values come across &lt;em&gt;except&lt;/em&gt; the activities array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client('http://mysite.com/');&#xA;$uri = 'api/students?api_token=123';&#xA;&#xA;$post_data = array(&#xA;    'first_name' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;firstName,&#xA;    'last_name' =&amp;gt; $event-&amp;gt;params['user']-&amp;gt;lastName,&#xA;    ...&#xA;&#xA;  );&#xA;&#xA;$request = $client-&amp;gt;post($uri, array(&#xA;    'content-type' =&amp;gt; 'application/json'&#xA;));&#xA;&#xA;foreach ($selectedActivities as $option) {&#xA;    $request-&amp;gt;getPostFields('activity', $option);&#xA;}&#xA;&#xA;$data = json_encode($post_data);&#xA;&#xA;$request-&amp;gt;setBody($data);&#xA;$response = $request-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is coming across and getting saved correctly, I'm just not seeing 'activity' in the request at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you again for your help!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-11-15T05:08:37.867" LastActivityDate="2016-11-15T05:08:37.867" Title="How can I pass an array to an api call from my plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17722" PostTypeId="1" CreationDate="2016-11-14T18:45:12.360" Score="0" ViewCount="45" Body="&lt;p&gt;I have a simple Matrix field that includes two sub-fields: a one line plain text field, and a multi-line plain text field. When I try to create an entry Craft freezes at the Create New Entry screen. &lt;strong&gt;When I run the same Craft configuration on a remote apache server no freezing occurs&lt;/strong&gt;. I'm using a wamp server (on a PC of course). I have the same problem on my wamp-craft setup on PC at work and my PC at home. I've never had a problem with any wamp server before and have never had a problem with Craft. My guess is it's a wamp permissions problem that's specific to the Matrix field (this is my first attempt at using the Matrix field feature). Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5885" LastEditorUserId="57" LastEditDate="2016-11-14T19:19:19.970" LastActivityDate="2016-11-24T19:22:16.740" Title="Matrix field freezes on localhost when I try to make a new entry" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="17723" PostTypeId="2" ParentId="17721" CreationDate="2016-11-14T18:49:21.473" Score="1" Body="&lt;p&gt;You're right, this won't work— PHP doesn't know how to flatten an array into a URL param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But! Guzzle has it's own way of collating multiple values for one param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you build your query with Guzzle's API, then repeatedly add values to the same param with the &lt;code&gt;getPostFields()-&amp;gt;add()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Note that the second argument below may need to be populated with your custom headers— but Guzzle may also take care of this when using this method…&#xA;$req = new \Guzzle\Http\Client('https://www.site.com/api/')-&amp;gt;post('users', [], [&#xA;  'param' =&amp;gt; 'val' # …and any other single-use keys can be set early&#xA;]);&#xA;&#xA;&#xA;foreach ( $selectedActivities as $option ) {&#xA;  $req-&amp;gt;getPostFields()-&amp;gt;add('param-name', $option-&amp;gt;value);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't tell you how to visualize the URL this eventually builds, but I think the key is sending data in the body, rather than trying to manually build a query string (which still ought to work, but there are odd behaviors when duplicate params exist).&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2016-11-14T20:01:21.157" LastActivityDate="2016-11-14T20:01:21.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17724" PostTypeId="2" ParentId="17711" CreationDate="2016-11-14T19:27:40.663" Score="2" Body="&lt;p&gt;My answer in that other question was wrong (I've updated it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you pointed out, Craft normalizes all search keywords to be lowercase.  Case  sensitive searches &lt;em&gt;would&lt;/em&gt; rely on the database's underlying collation if Craft didn't do that normalization first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth adding as a &lt;a href=&quot;http://feedback.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;, if you think that shouldn't be the default behavior.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-14T19:27:40.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17725" PostTypeId="1" AcceptedAnswerId="17726" CreationDate="2016-11-14T19:35:33.257" Score="2" ViewCount="329" Body="&lt;p&gt;I have the following code for my news page. The links show up but I'm seeing all the entries on every page. I'm not sure if this is related to my featured entry at the top.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;News&quot; %}&#xA;{% paginate craft.entries.section('news').limit(5) as pageInfo, pageEntries %}&#xA;{% block content %}&#xA;&amp;lt;section class=&quot;news-page section-wrap news-list&quot;&amp;gt;&#xA;&amp;lt;h1&amp;gt;Company News&amp;lt;/h1&amp;gt;&#xA;{% for featuredEntry in craft.entries.section('news').featured('1') %}&#xA;        &amp;lt;article class=&quot;news-list--item news-list--feature&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;feature-img&quot;&amp;gt;&#xA;                {% for image in featuredEntry.featuredImage %}&#xA;                &amp;lt;img src=&quot;{{ image.getUrl('featuredArticleImage') }}&quot; alt=&quot;{{ featuredEntry.title }}&quot; /&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;feature-content&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;{{ featuredEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                {{ featuredEntry.body.getPage(1) }}&#xA;                &amp;lt;a class=&quot;btn btn-secondary&quot; href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;  &#xA;        &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;{% for regularEntries in craft.entries.section('news').featured('not 1') %}&#xA;    &amp;lt;article class=&quot;news-list--item&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ regularEntries.url }}&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ regularEntries.title }}&amp;lt;/h2&amp;gt;&#xA;            {{ regularEntries.body|hacksaw(words='25', allow='&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;') }}&#xA;            &amp;lt;span class=&quot;cta-border&quot;&amp;gt;Continue reading&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/section&amp;gt;  &#xA;&amp;lt;nav&amp;gt;&#xA;{% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    &amp;lt;/nav&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2016-11-14T20:40:57.747" Title="pagination showing all entries" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17726" PostTypeId="2" ParentId="17725" CreationDate="2016-11-14T19:57:00.293" Score="2" Body="&lt;p&gt;When you use &lt;code&gt;{% paginate %}&lt;/code&gt;, the second variable that's returned, &lt;code&gt;pageEntries&lt;/code&gt;, is  the paginated entries. When you do &lt;code&gt;craft.entries.section('news').featured('not 1')&lt;/code&gt; later in the template, you're doing a new query that's not paginated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming what you want is to return all featured entries at the top, then a paginated list of news below, try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;News&quot; %}&#xA;&#xA;{% paginate craft.entries.section('news').featured('not 1').limit(5) as pageInfo, pageEntries %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;section class=&quot;news-page section-wrap news-list&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;Company News&amp;lt;/h1&amp;gt;&#xA;        {% for featuredEntry in craft.entries.section('news').featured('1') %}&#xA;            &amp;lt;article class=&quot;news-list--item news-list--feature&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;feature-img&quot;&amp;gt;&#xA;                    {% for image in featuredEntry.featuredImage %}&#xA;                        &amp;lt;img src=&quot;{{ image.getUrl('featuredArticleImage') }}&quot; alt=&quot;{{ featuredEntry.title }}&quot;/&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;feature-content&quot;&amp;gt;&#xA;                    &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;{{ featuredEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                    {{ featuredEntry.body.getPage(1) }}&#xA;                    &amp;lt;a class=&quot;btn btn-secondary&quot; href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/article&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {% for regularEntry in pageEntries %}&#xA;            &amp;lt;article class=&quot;news-list--item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ regularEntry.url }}&quot;&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ regularEntry.title }}&amp;lt;/h2&amp;gt;&#xA;                    {{ regularEntry.body|hacksaw(words='25', allow='&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;') }}&#xA;                    &amp;lt;span class=&quot;cta-border&quot;&amp;gt;Continue reading&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/article&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;    &amp;lt;/section&amp;gt;&#xA;    &amp;lt;nav&amp;gt;&#xA;        {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;        {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    &amp;lt;/nav&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If additionally, you only want to show the featured entry on the first page, you could wrap the first for loop in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.currentPage == 1 %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details on pagination &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="125" LastEditDate="2016-11-14T20:40:57.747" LastActivityDate="2016-11-14T20:40:57.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17727" PostTypeId="2" ParentId="17117" CreationDate="2016-11-14T20:05:16.353" Score="1" Body="&lt;p&gt;My answer to my own question: after exhausting all avenues I ended up having to abandon Heroku for this Craft site. I moved the Craft site over to a DV server at Media Temple, moved over the database, and everything is working fine.&lt;/p&gt;&#xA;" OwnerUserId="4388" LastActivityDate="2016-11-14T20:05:16.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17728" PostTypeId="1" CreationDate="2016-11-14T20:31:51.667" Score="1" ViewCount="506" Body="&lt;p&gt;My account is locked and I cant figure out how to unlock it. I tried resetting the password, but have yet to receive an email with a new one. Is there an alternative way to logging back on? I recently changed the password and because it is a shared dashboard, I think someone (who was unaware of the pw change) may have tried logging in too many times which is how the account locked. &lt;/p&gt;&#xA;" OwnerUserId="5886" LastActivityDate="2017-02-09T21:13:12.630" Title="How do I UNLOCK my account?" Tags="&lt;users&gt;&lt;admin&gt;&lt;tags&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17729" PostTypeId="2" ParentId="17728" CreationDate="2016-11-14T20:37:52.107" Score="5" Body="&lt;p&gt;If you don’t have access to another admin account, you could unlock the account directly in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change the &lt;code&gt;lock&lt;/code&gt; value to 0 for the account in the &lt;code&gt;craft_users&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-14T20:37:52.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17730" PostTypeId="1" AcceptedAnswerId="17741" CreationDate="2016-11-14T21:03:13.100" Score="2" ViewCount="2672" Body="&lt;p&gt;I've got my news entries paginated and I have a featured entry on the first page so I'm wondering what the best approach would be to filter by category. Here is what my template looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;News&quot; %}&#xA;&#xA;{% paginate craft.entries.section('news').featured('not 1').limit(6) as pageInfo, pageEntries %}&#xA;{% set segment = craft.request.segment(2) %}&#xA;{% set pageCats = craft.categories('newsCategories').slug('segment') %}&#xA; {% block content %}&#xA;&amp;lt;section class=&quot;news-page section-wrap news-list&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Company News&amp;lt;/h1&amp;gt;&#xA;    {% if pageInfo.currentPage == 1 %}       &#xA;    {% for featuredEntry in craft.entries.section('news').featured('1') %}&#xA;        &amp;lt;article class=&quot;news-list--item news-list--feature&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;feature-img&quot;&amp;gt;&#xA;                {% for image in featuredEntry.featuredImage %}&#xA;                    &amp;lt;img src=&quot;{{ image.getUrl('featuredArticleImage') }}&quot; alt=&quot;{{ featuredEntry.title }}&quot;/&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;feature-content&quot;&amp;gt;&#xA;                &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;{{ featuredEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                {{ featuredEntry.body.getPage(1) }}&#xA;                &amp;lt;a class=&quot;btn btn-secondary&quot; href=&quot;{{ featuredEntry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;    {% endif %}&#xA;    {% for regularEntry in pageEntries %}&#xA;        &amp;lt;article class=&quot;news-list--item&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ regularEntry.url }}&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ regularEntry.title }}&amp;lt;/h2&amp;gt;&#xA;                {{ regularEntry.body|hacksaw(words='25', allow='&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;', append='...') }}&#xA;                &amp;lt;span class=&quot;cta-border&quot;&amp;gt;Continue reading&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/section&amp;gt;&#xA;&amp;lt;nav class=&quot;pagination&quot;&amp;gt;&#xA;    {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&amp;lt;/nav&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% nav category in craft.categories.group('news') %}&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4660" LastEditorUserId="4660" LastEditDate="2016-11-15T15:05:15.857" LastActivityDate="2016-11-15T15:19:44.900" Title="filtering entries by category" Tags="&lt;categories&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17731" PostTypeId="1" AcceptedAnswerId="17751" CreationDate="2016-11-14T21:12:52.587" Score="1" ViewCount="35" Body="&lt;p&gt;I'm trying to write a simple plugin that will intercept registration form's data, manipulate it and move it forward. What I'm struggling with is how to set the Post content of a field after the manipulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to achieve something like that, how do I set the Post field after manipulation, setRawPostContent doesn't seem to work here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;        if(craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;        {&#xA;            $companyId = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;            $event-&amp;gt;params['user']-&amp;gt;setRawPostContent('fields[companyId]', $companyId);&#xA;        }&#xA;&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2016-11-15T21:57:30.607" Title="How do I set the Post field after manipulation" Tags="&lt;plugin-development&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17732" PostTypeId="2" ParentId="17714" CreationDate="2016-11-15T00:03:44.937" Score="2" Body="&lt;p&gt;You need to pass the currency to the conversion filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order is always made in the primary currency, but the payment currency that they made the payment in might be different, so you need to pass &lt;code&gt;order.paymentCurrency&lt;/code&gt; to the conversion filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read about using different currencies here: &#xA;&lt;a href=&quot;https://craftcommerce.com/docs/payment-currencies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-currencies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to just changing the filter to &lt;code&gt;|commerceCurrency&lt;/code&gt; take a look at the docs for the filter for the optional formatting and conversion options:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/twig-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/twig-filters&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-15T00:03:44.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17733" PostTypeId="1" AcceptedAnswerId="17736" CreationDate="2016-11-15T00:22:59.093" Score="0" ViewCount="110" Body="&lt;p&gt;I am trying to exclude the current entry in a &quot;Recommended Reading&quot; section which works at level 1 with the ID tag, but I also need it to do the same at level 2 (children). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; `{% for entry in craft.entries.section('Thunder').level(1).id('not '~entry.id).limit(3).order('RAND()') %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The level 1 entry is the Article and the level 2's are the Chapters. The recommended reading section displays other Articles and should therefor exclude the level(1) article also when viewing the Chapters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I use &lt;code&gt;craft.request.getSegment(2)&lt;/code&gt; to exclude the current entry, but how do you write that conditional statement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Url structures are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/site/article&#xA;/site/article/chapter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Section: &lt;strong&gt;Structure&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-11-15T09:22:43.827" Title="Exclude entry based on segment" Tags="&lt;structure&gt;&lt;conditional&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17734" PostTypeId="1" CreationDate="2016-11-15T02:59:14.383" Score="1" ViewCount="110" Body="&lt;p&gt;We've had a half a dozen cases now of people editing content in different Craft 2.6 sites taking down our webservers.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One staff member here editing a basic entry in the CMS has taken down a large cloud server multiple times over the past couple of months.&lt;/li&gt;&#xA;&lt;li&gt;A group of 20~ students uploading some basic projects in the CMS took down a different quad core webserver with 12GB of RAM and spiked the load to 250 - again multiple times.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have little info to go off at this stage but I do know the load was caused by post requests made by php from the CMS. Front end traffic isn't the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm nervous enough about this at the moment that the latest craft site I launched is on its own VPS to keep it away from other sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy to provide login/server deets to any of the Craft guys if they're curious, or if there's any more info people want, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="45" LastEditDate="2016-11-18T19:57:04.970" LastActivityDate="2016-11-18T19:57:04.970" Title="Craft 2.6 CMS Posts Overloading Servers" Tags="&lt;performance&gt;&lt;hosting&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17735" PostTypeId="1" AcceptedAnswerId="17740" CreationDate="2016-11-15T08:27:43.263" Score="2" ViewCount="353" Body="&lt;p&gt;The basic idea is that I want to group my entries by category, but I want more than just the category title—I need the entire category entry. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17706/ordering-related-items-by-cp-display-order&quot;&gt;My previous post alludes to this&lt;/a&gt;, but I've since discovered the query I was doing there was returning all related entries regardless of their existance in the &lt;code&gt;block.result&lt;/code&gt; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently doing this—which is exactly what I want, but it doesn't see very efficient... Is there a better way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = block.result %}&#xA;{% for category, catEntries in results | group('infographicSection.first().title') %}&#xA;    {% set fullCat = craft.categories.title(category).first() %}&#xA;    &amp;lt;h1 class=&quot;{{fullCat.className}}&quot;&amp;gt;{{fullCat.title}}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{fullCat.body}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in catEntries %}&#xA;&#xA;        &amp;lt;li&amp;gt;{{entry.title}}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-11-15T12:14:45.320" Title="Better way to group by category and include full category entry" Tags="&lt;templating&gt;&lt;categories&gt;&lt;performance&gt;&lt;queries&gt;&lt;group&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17736" PostTypeId="2" ParentId="17733" CreationDate="2016-11-15T09:22:43.827" Score="0" Body="&lt;p&gt;No matter how many levels there are in your structure &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#ancestorOf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancestorOf&lt;/a&gt; will fetch level one entry. &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#parent&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry.parent&lt;/a&gt; could be used but covers only one level up.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludeEntry = entry %}&#xA;{% if entry.level &amp;gt; 1 %}&#xA;    {% set excludeEntry = craft.entries.ancestorOf(entry).level(1).first() %}&#xA;{% endif %}&#xA;&#xA;{% for entry in craft.entries.section('Thunder').level(1).id('not '~excludeEntry.id).limit(3).order('RAND()') %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2016-11-15T09:22:43.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17737" PostTypeId="1" AcceptedAnswerId="17738" CreationDate="2016-11-15T09:52:27.013" Score="1" ViewCount="96" Body="&lt;p&gt;I have a question about relations... or maybe its also about making queries. First I want to select a set of data, and then I want to select a subset of that data, based on a relatedTo call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I first do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set caseEntries = craft.entries.section('case').relatedTo({ targetElement: creatorEntry, field: 'creator' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then, to get a sub-set of what I got before, do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set caseEntries = caseEntries.relatedTo('and', { targetElement: categoryEntry, field: 'caseCategories' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it seems as if the first relation is “forgotten” (note that it wont work if I dont include an “and” in the second related to call). Do I &lt;em&gt;have to&lt;/em&gt; add the first relation in the second call? Feels like repeating myself... I want to avoid doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set caseEntries = caseEntries.relatedTo('and', { targetElement: creatorEntry, field: 'creator' }, { targetElement: categoryEntry, field: 'caseCategories' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3720" LastActivityDate="2016-11-15T10:26:55.273" Title="Selecting a subset of entries, based on a relatedTo call" Tags="&lt;entries&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17738" PostTypeId="2" ParentId="17737" CreationDate="2016-11-15T10:26:55.273" Score="3" Body="&lt;p&gt;Second &lt;code&gt;relatedTo&lt;/code&gt; call overrides first one. Calling it again won't add more parameters to the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to repeat yourself you can always do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set creatorRelated = { targetElement: creatorEntry, field: 'creator' } %}&#xA;&#xA;{% set caseEntries = craft.entries.section('case').relatedTo(creatorRelated) %}&#xA;&#xA;{% set caseEntries = caseEntries.relatedTo('and', creatorRelated, { targetElement: categoryEntry, field: 'caseCategories' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2016-11-15T10:26:55.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17740" PostTypeId="2" ParentId="17735" CreationDate="2016-11-15T12:09:39.140" Score="2" Body="&lt;p&gt;Your actual code is pretty effective – the problem is that it's potentially going to result in &lt;em&gt;a lot&lt;/em&gt; of queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a good example of the so-called &lt;em&gt;N+1&lt;/em&gt; query problem, where each iteration over the result set of a single query generates an additional number of queries. Depending on the number of elements involved, this issue can easily result in hundreds of queries, which can be a huge problem for performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to the N+1 query problem is &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt;. With eager loading, you explicitly tell Craft which relational data it should include with the first query, unlike with the common &quot;lazy loading&quot; pattern where relational data is queried on a &quot;need to use&quot; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how your code could look, refactored to use eager loading:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = block.result.find({&#xA;    with: ['infographicSection']&#xA;}) %}&#xA;&#xA;{% for category, catEntries in results|group('infographicSection[0].title') %}&#xA;    {% set fullCat = catEntries[0].infographicSection[0] %}&#xA;    &amp;lt;h1 class=&quot;{{fullCat.className}}&quot;&amp;gt;{{fullCat.title}}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{fullCat.body}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in catEntries %}&#xA;            &amp;lt;li&amp;gt;{{entry.title}}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With something like the above, you should see the number of queries drop drastically (remember to turn on &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt; in development and you'll see a profiling report in your browser's dev tools console, containing the total number of queries).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-11-15T12:14:45.320" LastActivityDate="2016-11-15T12:14:45.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17741" PostTypeId="2" ParentId="17730" CreationDate="2016-11-15T12:36:51.467" Score="2" Body="&lt;p&gt;You don't actually need to look at the URL segments, because Craft automatically populates your template with a &lt;code&gt;category&lt;/code&gt; variable whenever it matches the current URL to a category's URL. All you need to do, is to make sure that your category URLs point to the correct template, and to account for that template being rendered both with a &lt;code&gt;category&lt;/code&gt; variable and without (i.e. for the default news index listing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you'll need to make sure that the URL format for your category group is correct – you should probably use something like &lt;code&gt;news/{slug}&lt;/code&gt; or perhaps &lt;code&gt;news/categories/{slug}&lt;/code&gt;. Also, set the &quot;Category template&quot; to your news index template, e.g. &lt;code&gt;news&lt;/code&gt; or whatever template path you're actually using for the news index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you can filter your entries like the following, using the &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;relatedTo&lt;/code&gt;&lt;/a&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = category ?? null %}&#xA;{% paginate craft.entries.section('news').featured('not 1').relatedTo(category).limit(6) as pageInfo, pageEntries %}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One gotcha to note is that whenever you pass a &lt;code&gt;NULL&lt;/code&gt; value to the &lt;code&gt;relatedTo()&lt;/code&gt; parameter (which will happen whenever the &lt;code&gt;category&lt;/code&gt; variable is empty), Craft will ignore the parameter and return all entries – which works in this case, as the same template should also double as your news index.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-11-15T15:19:44.900" LastActivityDate="2016-11-15T15:19:44.900" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17742" PostTypeId="2" ParentId="5442" CreationDate="2016-11-15T17:00:05.607" Score="1" Body="&lt;p&gt;Make sure &lt;code&gt;{{ siteUrl }}&lt;/code&gt; is used in your links in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;href=&quot;{{ siteUrl }}stylesheets/styles.css&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;href=&quot;stylesheets/styles.css&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="852" LastEditorUserId="57" LastEditDate="2016-11-15T21:06:24.210" LastActivityDate="2016-11-15T21:06:24.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17743" PostTypeId="1" CreationDate="2016-11-15T17:05:59.930" Score="1" ViewCount="1344" Body="&lt;p&gt;I was wondering if there is way to enable CORS for the ElementAPI plugin? I want to be able to call the API from the website and not allow external client to access the API&lt;/p&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="57" LastEditDate="2016-11-15T21:10:16.273" LastActivityDate="2019-01-28T11:50:54.557" Title="Enable CORS on ElementAPI" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17744" PostTypeId="1" AcceptedAnswerId="18040" CreationDate="2016-11-15T18:16:31.857" Score="1" ViewCount="224" Body="&lt;p&gt;Any help would be greatly appreciated! I hope I explained my situation in enough detail to get the help that is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have two channels that need to share information. This is going from one channel to an other.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel One is called Resellers&#xA;This information needs to be feed into my other channel called Products.&#xA;Reseller contains info about various resellers, places to purchase a product. &#xA;In this channel I have a field for Category. The category is actually a Country name. The rest of the fields are plain text.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel 2 is called Products &#xA;Products has various fields but I am interested in doing is pulling in info from Resellers and displaying it. I am able to pull in everything from Resellers except for the Category name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Products I have a matrix field that contains an entry field and a plain text field. &#xA;The entry field pulls in the information about each reseller. &#xA;The plain text field allows me to override a field from Reseller to display per product information. I got this part working without an issue.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to create is the following structure:&#xA;Country name then under the country list out each reseller alphabetically.&#xA;You will see Country Name A, A means nothing it just shows alphabetical listing. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Country Name A &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reseller A &lt;/li&gt;&#xA;&lt;li&gt;Reseller T&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Country Name C&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reseller D&lt;/li&gt;&#xA;&lt;li&gt;Reseller H&lt;/li&gt;&#xA;&lt;li&gt;Reseller R&lt;/li&gt;&#xA;&lt;li&gt;Reseller T&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Below I have listed out my field handle names that are relevant to this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Resellers&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;rdCountry - field where category is selected from&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am able to pull in all other fields easily that are part of Resellers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Products&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Matrix field - chooseResellers&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entries field - chooseReseller&lt;/li&gt;&#xA;&lt;li&gt;Plain text field - customProductLink&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Again I am able to display each reseller just fine. What I am having issues with is pulling in the Category/Country name. Once I pull in the country name I might need help with setting up my loop to display everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time and help, it is greatly appreciated! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;So the below code seems to solve my issue listed above. Now I just gotta loop through everything correctly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.slug(entrySlug).find() %}&#xA;    {% for block in entry.chooseResellers %}&#xA;        {% for reseller in block.chooseReseller %}&#xA;            &amp;lt;h3&amp;gt;{{ reseller.rdCountry.first() }}&amp;lt;/h3&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}{# /matrix #}&#xA;{% endfor %}{# /for product #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT TWO - the code solves part of the problem but I do not think will allow me to loop through everything as I was expecting. Help is appreciated! &lt;/p&gt;&#xA;" OwnerUserId="3571" LastEditorUserId="57" LastEditDate="2016-11-16T17:54:12.787" LastActivityDate="2016-12-06T19:29:53.170" Title="Matrix with an entries field and need to grab category title" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17745" PostTypeId="1" CreationDate="2016-11-15T19:48:38.800" Score="0" ViewCount="563" Body="&lt;p&gt;I want to have the option to have social media icons that will link to different URLs. I currently have it set up so the user can click which icons will display on the page, but how would I have it so they can change the link to what URL they want?&lt;/p&gt;&#xA;" OwnerUserId="5732" LastActivityDate="2016-12-15T21:57:18.913" Title="External URL with image" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17746" PostTypeId="1" AcceptedAnswerId="17750" CreationDate="2016-11-15T21:00:26.813" Score="2" ViewCount="469" Body="&lt;p&gt;For performance reasons I'm caching full HTML responses to Redis. This does wonders for response times, but cache invalidation becomes a bit tricky... I'm currently purging the entire cache on 'entries.saveEntry' which will suffice most of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with scheduled posts. Scheduled posts are not saved when they're published so the cache is not invalidated and the post doesn't show up unless I clear the cache manually. I need to register 2 events listeners to clear the cache: one on entry save and one one on publish. Does this second event exist? If not, is there a way to create one?&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2017-03-10T17:44:32.987" Title="Event Listener for Publishing Scheduled Posts" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17747" PostTypeId="2" ParentId="17743" CreationDate="2016-11-15T21:11:10.243" Score="1" Body="&lt;p&gt;Not really anything to do with Craft or the ElementAPI plugin, but you can enable CORS at the Apache/.htaccess level &lt;a href=&quot;http://enable-cors.org/server_apache.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;easy enough&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-15T21:11:10.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17748" PostTypeId="2" ParentId="17745" CreationDate="2016-11-15T21:18:50.793" Score="1" Body="&lt;p&gt;Many, many possible ways to go about this, but the simplest would be to create a &lt;a href=&quot;https://craftcms.com/docs/plain-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plain Text field&lt;/a&gt; in the control panel and call it something like &quot;Social Media Link&quot; with a handle of &quot;socialMediaLink&quot; and give it some field instructions along the lines of &quot;Enter the URL for the social media button&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attach that to the field layout for your &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;section&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your client edits the entry for that section, then can enter whatever URL they want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your template would display it something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.socialMediaLink }}&quot;&amp;gt;&amp;lt;img src=&quot;mySocialMediaButton.jpg&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-15T21:18:50.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17749" PostTypeId="2" ParentId="17745" CreationDate="2016-11-15T21:20:37.803" Score="2" Body="&lt;p&gt;Sounds like you're on the right path. Create a Global matrix field containing an asset field for Social Icon, a text field for Social Url, and a lightswitch field for Enabled/Disabled. Then the user can add new social media icons as needed and manipulate the url.&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-11-15T21:20:37.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17750" PostTypeId="2" ParentId="17746" CreationDate="2016-11-15T21:24:49.540" Score="2" Body="&lt;p&gt;There isn't an event that fires when an entry with a future post date goes live, since it's just compared against the existing time and there's no guarantee that any PHP will be executing at that exact time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a cron job that hits a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin's&lt;/a&gt; controller that checks every minute or so for any entries about to go live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe adopt something &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2610/how-can-i-cache-a-list-of-entries-with-pending-postdates-and-have-it-automatical&quot;&gt;similar to this&lt;/a&gt; for your Redis/full page caching solution.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-15T21:24:49.540" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17751" PostTypeId="2" ParentId="17731" CreationDate="2016-11-15T21:57:30.607" Score="0" Body="&lt;p&gt;If you're just looking to update a custom field on the user, something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;&#xA;    if(craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;    {&#xA;        $companyId = craft()-&amp;gt;request-&amp;gt;getPost('email');&#xA;        $event-&amp;gt;params['user']-&amp;gt;getContent()-&amp;gt;companyId = $companyId;&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-15T21:57:30.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17752" PostTypeId="1" AcceptedAnswerId="17753" CreationDate="2016-11-15T23:07:37.323" Score="2" ViewCount="5178" Body="&lt;p&gt;I've setup an S3 asset source for images and it's working well for everything but SVGs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SVGs are uploaded with the default content-type of &lt;code&gt;binary/octet-stream&lt;/code&gt; where the correct content-type would be &lt;code&gt;image/svg+xml&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong or is this a bug?&lt;/p&gt;&#xA;" OwnerUserId="5808" LastEditorUserId="57" LastEditDate="2016-11-15T23:21:14.567" LastActivityDate="2019-02-25T17:56:47.963" Title="Incorrect content/mime-type on S3 SVG upload" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17753" PostTypeId="2" ParentId="17752" CreationDate="2016-11-15T23:20:56.290" Score="5" Body="&lt;p&gt;Your SVG file is probably missing the the XML declaration at the top (&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/code&gt;). PHP's FileInfo detects XML files (which SVG is) without that declaration as text/html files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of SVG editors/exporters will (annoyingly) omit that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-15T23:20:56.290" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17754" PostTypeId="2" ParentId="8575" CreationDate="2016-11-15T23:39:41.330" Score="3" Body="&lt;p&gt;I'm rusty on MySQL so it took me a while to go through this. I'm leaving this here for future internet travelers. It's based on Brad's solution, so read through that first, then you can use these commands. If you forget what your database user/name is, go into Craft &gt; App &gt; Config &gt; db.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Login to MySQL on the command line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ mysql -u craftuser -p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Choose the corrrect database:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysql&amp;gt; USE craftdatabasename;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure that the tablename is craft_users (it might be just users if you didn't use a prefix):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysql&amp;gt; SHOW TABLES;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Show what the current hash is (you'll want to do this from your local install as well to compare and be able to copy in the new hash)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysql&amp;gt; SELECT username,password FROM craft_users;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update it to the new hash:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysql&amp;gt; UPDATE craft_users SET password='passwordhash' WHERE username='admin';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2016-11-15T23:39:41.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17755" PostTypeId="1" AcceptedAnswerId="17758" CreationDate="2016-11-15T23:55:10.473" Score="0" ViewCount="50" Body="&lt;p&gt;One of our shipping methods let's the customer have their purchase delivered at home. When the user selects that method, we'd like to include a simple textarea where the user can write when he wants his order delivered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to go about this? Basically just attach a &quot;user note&quot; to the cart as a whole, not to any individual lineItem&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2016-11-16T12:02:08.813" Title="Let user add a message when selecting shipping method" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17756" PostTypeId="1" AcceptedAnswerId="17761" CreationDate="2016-11-16T01:55:51.037" Score="1" ViewCount="634" Body="&lt;p&gt;I have a matrix inside of which I have 2 fields, 1. dropdown list containing download types and another asset field. I would like to search first by a category and then I would like to further filter them and see if they have downloads of a certain type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to avoid a 2 step searching if possible and search articles that belong to certain category that have a certain download type associated with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-11-16T09:12:59.527" Title="Search entries by matrix field" Tags="&lt;matrix&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17757" PostTypeId="1" AcceptedAnswerId="17764" CreationDate="2016-11-16T04:32:03.487" Score="5" ViewCount="106" Body="&lt;p&gt;I need to create a plugin that prevents select user groups from reordering a Structure content type in the Entries listing. I could quickly do this by just hiding the &lt;code&gt;a.move.icon&lt;/code&gt; element, but I worry about the longevity of this solution. For example, if this class were to change then the plugin wouldn't hide the element any longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better, more long-term fix that someone might recommend here? &lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2016-11-16T12:11:31.870" Title="How to prevent select user groups from reordering structures" Tags="&lt;plugin-development&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17758" PostTypeId="2" ParentId="17755" CreationDate="2016-11-16T06:01:28.953" Score="2" Body="&lt;p&gt;Create a text field and add it you field layout for Orders in Commerce settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in any &lt;code&gt;updateCart&lt;/code&gt; form you can simply place a value in this by using &lt;code&gt;&amp;lt;input name=&quot;fields[fieldHandle]&quot; etc&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-11-16T12:02:08.813" LastActivityDate="2016-11-16T12:02:08.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17760" PostTypeId="2" ParentId="17713" CreationDate="2016-11-16T08:07:16.170" Score="1" Body="&lt;p&gt;Apparently PHP hadn't installed the XML Parser appropriately. The amazing Craft team provided this link. Which solved my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get install php-xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/35604148/520520&quot;&gt;https://stackoverflow.com/a/35604148/520520&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3332" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-11-16T08:07:16.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17761" PostTypeId="2" ParentId="17756" CreationDate="2016-11-16T09:12:59.527" Score="3" Body="&lt;p&gt;You could loop through the Matrix field on every entry save using the awesome Preparse plugin, to store the categories an entry contains in a new field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s example code for your Preparse field, it would store strings like &lt;code&gt;firstCategory,thirdCategory,secondCategory&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set categories = [] %}&#xA;&#xA;{%- for block in entry.myMatrixField.type('myRelevantBlockType') %}&#xA;    {%- if block.myDropdownField %}&#xA;        {%- set categories = categories|merge([ block.myDropdownField.value ]) %}&#xA;    {%- endif %}&#xA;{%- endfor %}&#xA;&#xA;{{- categories|join(',') -}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have populated that field for all your entries, you can filter them by a category using this criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryToSearch = 'secondCategory' %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'myEntriesSection',&#xA;    search: 'myPreparseFieldHandle:*' ~ categoryToSearch ~ '*',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to say that I’m not very proud of this solution as it uses &lt;code&gt;search&lt;/code&gt; which I usually try to avoid. But I wasn’t able to come up with a better idea.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-16T09:12:59.527" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17763" PostTypeId="2" ParentId="17757" CreationDate="2016-11-16T09:42:39.960" Score="3" Body="&lt;p&gt;Impossible out of the box – there's no permission setting for ordering Structures. For now, I'd &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;add a feature request&lt;/a&gt; and hack it in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest solution is probably to use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpbodyclasses&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP Body Classes&lt;/a&gt; and &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP CSS&lt;/a&gt; plugins to hide the &lt;code&gt;a.move.icon&lt;/code&gt; element (like you say) based on the current user's user group affiliation(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I wouldn't worry too much about the longevity of such a hack; if it ever breaks (due to future DOM structure changes in the CP) it's probably not a huge problem, beyond the fact that your user group will be able to reorder Structures while you find another solution. Also, with a little luck your feature request gets implemented sooner or later.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-16T09:42:39.960" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17764" PostTypeId="2" ParentId="17757" CreationDate="2016-11-16T11:30:56.470" Score="4" Body="&lt;p&gt;You should be able to ensure that the elements aren't moved by using the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#structures-onBeforeMoveElement&quot; rel=&quot;nofollow noreferrer&quot;&gt;structures.onBeforeMoveElement&lt;/a&gt; hook in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('structures.beforeMoveElement', function(Event $event)&#xA;    {&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;        if (!$user-&amp;gt;isInGroup('allowedGroup'))&#xA;        {&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've had a quick look through the source but I'm not 100% sure if this is also run when an element's parent is changed. I would think it is.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You could also create your own custom user permission that can be assigned to individual users or multiple groups for more flexibility:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('structures.beforeMoveElement', function(Event $event)&#xA;    {&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;        if (!$user-&amp;gt;can('pluginName-moveElements'))&#xA;        {&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    });&#xA;}&#xA;&#xA;public function registerUserPermissions()&#xA;{&#xA;    return array(&#xA;        'pluginName-moveElements' =&amp;gt; array('label' =&amp;gt; Craft::t('Move Elements in Structures')),&#xA;    );&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2016-11-16T12:11:31.870" LastActivityDate="2016-11-16T12:11:31.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17765" PostTypeId="1" CreationDate="2016-11-16T15:37:51.600" Score="1" ViewCount="532" Body="&lt;p&gt;I have been working as a freelance web designer now for over 2 years, building websites using plain html, css and jquery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of my clients require simple showcase websites that look well, load fast, well optimised for Google, are easily navigated and show a portfolio of projects. Most also require a blog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is the level of knowledge required in order to take a static html, css website and add Craft CMS to it. The only areas of the website that I would want my clients to have access to would be for them to complete simple tasks such as adding on another project page with an image slider and project details or to add a blog post with a few pictures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have little to no knowledge of PHP and don't have the time to learn anything too advanced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All replies would be very much appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5894" LastEditorUserId="22" LastEditDate="2017-05-09T20:47:29.480" LastActivityDate="2018-01-02T17:17:48.377" Title="Turning static website to Craft?" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17766" PostTypeId="1" CreationDate="2016-11-16T15:49:06.687" Score="2" ViewCount="687" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a client with very specific shipping requirements. Essentially, he wants to assign specific shipping costs for every single zone for every single product. Like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product A shipping to Canada = $25&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Continental US = $40&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Alaska and Hawaii = $60&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Europe Zone 1 = $100&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Europe Zone 2 = $125&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Europe Zone 3 = $150&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Asia Zone 1 = $200&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Asia Zone 2 = $220&lt;/li&gt;&#xA;&lt;li&gt;Product A shipping to Asia Zone 3 = $230&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now multiply this by 25 products. And he wants to be able to change the shipping costs whenever he needs to so it will be essential that he can adjust it from the backend rather than through code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this? My initial idea was to use the Default Item Weight Rate option and have each product assigned a weight. Of course, the weight wouldn't reflect the actual weight of the product, it would just be a way of easily adjusting the shipping rate. The problem I see is that adjusting the weight would adjust the shipping cost across &lt;em&gt;all&lt;/em&gt; zones rather than just the zone he wants to change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my only option then to create a shipping category for every product and using Category Rate Overrides?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2016-11-17T05:16:34.950" Title="Setting shipping costs on a per-product basis" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17767" PostTypeId="2" ParentId="17765" CreationDate="2016-11-16T16:31:31.407" Score="2" Body="&lt;p&gt;First of all to use Craft you need &lt;a href=&quot;https://craftcms.com/docs/requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;a server and a database&lt;/a&gt; - e.x. Apache and MySQL so it's not just PHP. Assuming you will get your hands on pre-installed craft instance basic &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;configuration&lt;/a&gt; is pretty straightforward. Also you need to understand craft concepts of &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;sections&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;fields&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt;. Then you can setup blog or portfolio. Next you need to create views (TWIG language).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different plugins to help you with your content. Like this &lt;a href=&quot;https://github.com/70kft/craft-instablog&quot; rel=&quot;nofollow noreferrer&quot;&gt;one&lt;/a&gt; (blog). Installing plugin is as simple as copy folder and then hit install button in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17429/is-there-simpler-less-assuming-craft-documentation/17430#17430&quot;&gt;this answer&lt;/a&gt; where I included some resources to get you going with Craft.&lt;/p&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-11-16T16:36:33.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17768" PostTypeId="1" CreationDate="2016-11-16T17:45:43.873" Score="0" ViewCount="124" Body="&lt;p&gt;I feel like I'm missing something very obvious, all I need to do is return plain text (not JSON) in response to an action.  If I use &lt;code&gt;returnJson()&lt;/code&gt; it returns the value with quotation marks around it.  I'm dealing with a closed system that expects a VERY specific format, so the added quotations cause the submission to fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for added clarification:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$returnValue = &quot;abc,123&quot;&#xA;$this-&amp;gt;returnJson($returnValue)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get: &lt;code&gt;&quot;abc,123&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I NEED: &lt;code&gt;abc,123&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5585" LastEditorUserId="57" LastEditDate="2016-11-16T18:11:17.270" LastActivityDate="2016-11-16T20:14:03.957" Title="Return plain text" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17769" PostTypeId="2" ParentId="17768" CreationDate="2016-11-16T18:07:40.980" Score="1" Body="&lt;p&gt;So I realized I can just do die(&quot;abc,123&quot;) and get the result I need.  I am definitely open to better or more &quot;correct&quot; solutions though.&lt;/p&gt;&#xA;" OwnerUserId="5585" LastActivityDate="2016-11-16T18:07:40.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17770" PostTypeId="2" ParentId="17768" CreationDate="2016-11-16T18:12:20.330" Score="1" Body="&lt;p&gt;You can just use PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.echo.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;echo&lt;/a&gt; method to directly output to the browser.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$returnValue = &quot;abc,123&quot;;&#xA;echo $returnValue;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-16T18:12:20.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17772" PostTypeId="2" ParentId="17768" CreationDate="2016-11-16T20:14:03.957" Score="1" Body="&lt;p&gt;Nothing wrong with a plain old &lt;code&gt;echo()&lt;/code&gt; statement, even &lt;code&gt;returnJson()&lt;/code&gt; &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/BaseController.php#L324&quot; rel=&quot;nofollow noreferrer&quot;&gt;essentially just echoes&lt;/a&gt; your data (after JSON encoding it, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it &lt;em&gt;feels&lt;/em&gt; better, you can use &lt;code&gt;$this-&amp;gt;renderText('abc,123');&lt;/code&gt; – although &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.17/framework/web/CController.php#L840&quot; rel=&quot;nofollow noreferrer&quot;&gt;it'll also basically just call &lt;code&gt;echo()&lt;/code&gt;&lt;/a&gt; for you.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-16T20:14:03.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17773" PostTypeId="1" AcceptedAnswerId="17779" CreationDate="2016-11-16T21:27:22.290" Score="1" ViewCount="906" Body="&lt;p&gt;I just want to print a value from Craft into a JavaScript function to filter a dashboard.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;showOnly(filterName, values);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;showOnly('Short Names','{{ entry.title }}');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that did not work.  And yes, the filter does work If I hard wire the value that Craft/Twig should print.  But, I need it to match the title of the page as one navigates from entry to entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the actual &lt;code&gt;showOnly&lt;/code&gt; function in its entirety:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;function showOnly(filterName, values) {&#xA;    // Think a single select filter.&#xA;    sheet = mainViz.getWorkbook().getActiveSheet();&#xA;    if(sheet.getSheetType() === 'worksheet') {&#xA;        sheet.applyFilterAsync(filterName, values, 'REPLACE');&#xA;    } else {&#xA;        // for dashboards&#xA;        worksheetArray = sheet.getWorksheets();&#xA;        for(var i = 0; i &amp;lt; worksheetArray.length; i++) {&#xA;            worksheetArray[i].applyFilterAsync(filterName, values, 'REPLACE');&#xA;        }&#xA;    }&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2017-08-29T17:15:24.670" LastActivityDate="2017-08-29T17:15:24.670" Title="How do I print a value from Craft/Twig into a Javascript function?" Tags="&lt;templating&gt;&lt;javascript&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17774" PostTypeId="2" ParentId="17744" CreationDate="2016-11-16T21:56:31.083" Score="2" Body="&lt;p&gt;&lt;strong&gt;To achieve structure:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Country Name A&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reseller C&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Country Name C&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reseller B&lt;/li&gt;&#xA;&lt;li&gt;Reseller D&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;With configuration:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Category&lt;/em&gt; Countries&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Channel&lt;/em&gt; Resellers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;rdCountry (Country &lt;em&gt;Categories&lt;/em&gt;) field&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Channel&lt;/em&gt; Products:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;chooseResellers (&lt;em&gt;Matrix&lt;/em&gt;) field&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;block&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;chooseReseller (Reseller &lt;em&gt;Entries&lt;/em&gt;) field&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You gonna need code like this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.slug(entrySlug).find() %}&#xA;    {% set countries = {} %}&#xA;    {% for block in entry.chooseResellers %}&#xA;        {% for reseller in block.chooseReseller.with(['rdCountry']) %}&#xA;            {% set countryName = reseller.rdCountry[0].title %}&#xA;&#xA;            {% if countries[countryName] is defined %}&#xA;                {% set temp = countries[countryName] | merge([reseller]) %}&#xA;                {% set countries = countries | merge({(countryName): temp}) %}&#xA;            {% else %}&#xA;                {% set countries = countries | merge({(countryName): [reseller]}) %}&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;    {% endfor %} &#xA;&#xA;    {% for countryName, resellers in countries %}&#xA;        &amp;lt;h3&amp;gt;{{ countryName }}&amp;lt;/h3&amp;gt;&#xA;        {% for reseller in resellers %}&#xA;            &amp;lt;p&amp;gt;{{ reseller.title }}&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Because of the current section/field/relation configuration we need to use &lt;code&gt;countries&lt;/code&gt; temporary array to store &lt;code&gt;Country&lt;/code&gt; =&gt; &lt;code&gt;Reseller&lt;/code&gt; structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.with(['rdCountry'])&lt;/code&gt; is what you call &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt;. It allows you to reduce sql queries, speed up the whole process. With eager loaded &lt;em&gt;entries&lt;/em&gt; field you replace &lt;code&gt;find()&lt;/code&gt; with index number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;countries&lt;/code&gt; looks like this at the end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{  &#xA;   &quot;Country Name A&quot;:[  &#xA;      {  &#xA;         &quot;title&quot;:&quot;Reseller C&quot;&#xA;      }&#xA;   ],&#xA;   &quot;Country Name C&quot;:[  &#xA;      {  &#xA;         &quot;title&quot;:&quot;Reseller B&quot;&#xA;      },&#xA;      {  &#xA;         &quot;title&quot;:&quot;Reseller D&quot;&#xA;      }&#xA;   ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="5818" LastEditDate="2016-11-16T22:06:08.780" LastActivityDate="2016-11-16T22:06:08.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17776" PostTypeId="1" AcceptedAnswerId="17777" CreationDate="2016-11-17T00:54:28.590" Score="2" ViewCount="649" Body="&lt;p&gt;I'm trying to get, update, and save products &amp;amp;/or variants in my plugin controller, and am stuck on accessing/changing/saving updated fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get product ID from post&#xA;$variant_id = craft()-&amp;gt;request-&amp;gt;getPost('variant_id');&#xA;&#xA;// create criteria&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Variant');&#xA;$criteria-&amp;gt;id = $variant_id;&#xA;&#xA;// query&#xA;$variant = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above works just fine and gets the variant. But now I need to update a few fields and save it. Any idea how to do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$variant-&amp;gt;getContent()-&amp;gt;myCustomField = 'new value';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I then save &lt;code&gt;$variant&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastEditorUserId="2221" LastEditDate="2016-11-17T07:27:36.830" LastActivityDate="2016-11-17T07:27:36.830" Title="Craft Commerce update variant field in plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;elementcriteriamodel&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17777" PostTypeId="2" ParentId="17776" CreationDate="2016-11-17T04:30:50.947" Score="4" Body="&lt;p&gt;This is the general mechanism for updating custom fields on elements - use &lt;code&gt;setContentFromPost&lt;/code&gt; and then call the element's save function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $variant-&amp;gt;setContentFromPost(array(&#xA;        'fieldHandle' =&amp;gt; $newValue,&#xA;    ));&#xA;    craft()-&amp;gt;commerce_variants-&amp;gt;saveVariant($variant);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should catch exceptions around that really, to handle any errors that may arise (as the model gets validated during save etc.)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-11-17T05:01:31.670" LastActivityDate="2016-11-17T05:01:31.670" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17778" PostTypeId="2" ParentId="17766" CreationDate="2016-11-17T05:09:19.777" Score="1" Body="&lt;p&gt;Were I doing this, I would create a single (or an entry, or a global I guess) with a table (or maybe Matrix) field that would hold the shipping price chart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd then create a custom shipping plugin in Commerce, that references this data and returns the shipping cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would give a very nice UI for editing the products shipping, and would be a simple plugin to make.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example function that gets rate from a table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getRatesForZone($zone, $slug){&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'freightData';&#xA;    $criteria-&amp;gt;slug = $slug;&#xA;&#xA;    $ratesTable = $criteria-&amp;gt;first();&#xA;&#xA;    $rates = [];&#xA;    foreach ($ratesTable-&amp;gt;postRates as $row){&#xA;&#xA;        if($row['destinationZone']==$zone){&#xA;            $rates = $row;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    // If we reach here we couldn't find rates, return nothing&#xA;    return $rates;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond that you just implement a shipping rule/method - see  &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/shipping-methods&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, a small amount of custom code  will give both a better result and better UI I think, rather than trying to shoehorn in to the methods Commerce provides (although note I have not really investigated the Commerce methods much of late - I find custom shipping is usually the more controllable way to go!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2016-11-17T05:16:34.950" LastActivityDate="2016-11-17T05:16:34.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17779" PostTypeId="2" ParentId="17773" CreationDate="2016-11-17T05:20:20.473" Score="2" Body="&lt;p&gt;That is the correct way of doing it but you need to be sure that &lt;code&gt;entry&lt;/code&gt; is a variable and set to an entry model at that point.  And that you're in an appropriate part of your template in general for outputting the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. this works for analytics for example, placed at the end of my main structure block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# ANALYTICS GOOGLE #}&#xA;{% set js %}&#xA;&amp;lt;!-- Google Code for Website Conversions Conversion Page --&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;/* &amp;lt;![CDATA[ */&#xA;var google_conversion_id = XXXXXXXXX;&#xA;var google_conversion_language = &quot;en&quot;;&#xA;var google_conversion_format = &quot;3&quot;;&#xA;var google_conversion_color = &quot;ffffff&quot;;&#xA;var google_conversion_label = &quot;XXXXXXXXXX&quot;;&#xA;var google_conversion_value = {{order.totalPrice}};&#xA;var google_conversion_currency = &quot;AUD&quot;;&#xA;var google_remarketing_only = false;&#xA;/* ]]&amp;gt; */&#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;//www.googleadservices.com/pagead/conversion.js&quot;&amp;gt;&#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;noscript&amp;gt;&#xA;&amp;lt;div style=&quot;display:inline;&quot;&amp;gt;&#xA;&amp;lt;img height=&quot;1&quot; width=&quot;1&quot; style=&quot;border-style:none;&quot; alt=&quot;&quot; src=&quot;//www.googleadservices.com/pagead/conversion/XXXXXXX/?value={{order.totalPrice}}&amp;amp;amp;currency_code=AUD&amp;amp;amp;label=XXXXXXXXX&amp;amp;amp;guid=ON&amp;amp;amp;script=0&quot;/&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/noscript&amp;gt;&#xA;&#xA;{% endset %}&#xA;&#xA;{% includejs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-17T05:20:20.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17780" PostTypeId="1" AcceptedAnswerId="17781" CreationDate="2016-11-17T09:28:34.220" Score="2" ViewCount="927" Body="&lt;p&gt;Has anyone used Craft to manage content within a Cordova/PhoneGap app?  How successful was it? What are the pitfalls?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an idea to create a website managed by Craft CMS.  We then want to &quot;wrap&quot; the website in Cordova/PhoneGap so we can make it available as an App. Our immediate questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Is the App immediately updated as a website would be or are there further steps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Are there any issues to look out for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2016-11-17T18:01:29.163" LastActivityDate="2016-11-17T18:01:29.163" Title="Using Craft CMS to manage content within an app" Tags="&lt;app&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17781" PostTypeId="2" ParentId="17780" CreationDate="2016-11-17T10:19:13.907" Score="4" Body="&lt;p&gt;Several people are using Craft to power apps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a good hangout: &lt;a href=&quot;https://straightupcraft.com/events/craft-powered-apps&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Powered Apps&lt;/a&gt;, with Aaron Berkowitz discussing how PBS Kids uses Craft to power multiple apps, by making the data in Craft available to the apps available via a JSON API. I believe they use Cordova, which runs independently of Craft but grabs all the data for the app via the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aaron also discusses how publishing content via Craft helps them get around some app-update requirements.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2016-11-17T15:40:48.397" LastActivityDate="2016-11-17T15:40:48.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17782" PostTypeId="2" ParentId="14172" CreationDate="2016-11-17T10:34:29.730" Score="1" Body="&lt;p&gt;Check to make sure you have a &lt;code&gt;db.php&lt;/code&gt; file here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/app/etc/config/defaults/db.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If not, &lt;a href=&quot;https://craftcms.com/support/download-previous-versions&quot; rel=&quot;nofollow noreferrer&quot;&gt;download a fresh copy of the version of Craft you're using&lt;/a&gt; and replace your &lt;code&gt;craft/app&lt;/code&gt; folder with the one you just downloaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This file was missing in my Git repository because the &lt;code&gt;.gitignore&lt;/code&gt; file was set to ignore all &lt;code&gt;db.php&lt;/code&gt; files on the site, not just the one they wanted to ignore in the &lt;code&gt;craft/config&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, make sure your .gitignore file uses a line like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/config/db.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of just this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;db.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2016-11-17T10:34:29.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17783" PostTypeId="2" ParentId="17780" CreationDate="2016-11-17T11:39:15.637" Score="3" Body="&lt;p&gt;You can't actually use server side scripting within PhoneGap&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Q: CAN YOU USE PHP/ASP/JSF/JAVA/.NET WITH PHONEGAP?&lt;/p&gt;&#xA;&lt;p&gt;A: A PhoneGap application may only use HTML, CSS, and JavaScript. However, you can make use of network protocols (XmlHTTPRequest, Web Sockets, etc) to easily communicate with backend services written in any language. This allows your PhoneGap app to remotely access existing business processes while the device is connected to the Internet.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So in answer to wrapping a Craft CMS within Phonegap, I'd say it's not possible. However you can always use the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementApi Plugin&lt;/a&gt; by P&amp;amp;T to create endpoints on your Craft website that exposes content.&lt;/p&gt;&#xA;&lt;p&gt;Then you could just create a client in HTML/JS (VueJS/Angular/jQuery/Ember) to query these endpoints and show the content on your app.&lt;/p&gt;&#xA;&lt;p&gt;This approach has a wealth of benefits as it means you only need to have one backend (Craft install) that could serve multiple Clients (PhoneGap apps) and when you update content on Craft it will cascade through your apps in realtime (minus any caching you may have)&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-11-17T11:39:15.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17784" PostTypeId="1" CreationDate="2016-11-17T13:17:11.633" Score="1" ViewCount="677" Body="&lt;p&gt;Maybe I have not understand how entries work but I would like to create a rich text field in my plugin without having an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I want is creating a rich text field with twig but how can I do this? I already read this &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/rich-text-fields&lt;/a&gt; but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;    label: 'Ingredient Name'|t,&#xA;    required: true,&#xA;    name: 'ingredient[name]',&#xA;    value: ingredient ? ingredient.name : null,&#xA;    errors: ingredient ? ingredient.errors('name') : null,&#xA; }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could someone please help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if I make &lt;code&gt;{{ entry.richTextFieldHandle }}&lt;/code&gt; I get the error &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt; and I don't know how to define entry since I don't use an entry. Do I have to include my own redactor.js if I just want to have an html editor?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-11-17T13:24:30.277" LastActivityDate="2017-02-04T13:52:40.630" Title="Twig - render a rich text field" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17786" PostTypeId="1" CreationDate="2016-11-17T16:37:05.803" Score="2" ViewCount="663" Body="&lt;p&gt;We've recently set up a Redis cluster to handle our PHP sessions since we use a load balancer to direct traffic into different craft instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're seeing issues with redis when making back to back PHP session calls (using craft wrapper) very quickly. If we update a variable in the httpSession and then try to update it/get it very quickly it isn't updating. If we wait to access it then it is updated correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it's set up:&#xA;We modified the Apache2 php.ini to update the session handler to redis and the save path to our redis cluster (bypassing doing this via Craft). So Craft still uses its' default session handling but when it makes the request to save the session it gets redirected by apache to our redis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it more beneficial to tie this to Craft by updating the General.php with the session override options? Will we see faster/better session handling? Is there a session lock happening in craft? Is Craft opening/closing the session after each httpSessionService call?&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2016-11-17T21:03:24.860" Title="Craft with Redis session handling" Tags="&lt;config&gt;&lt;session&gt;&lt;redis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17788" PostTypeId="1" AcceptedAnswerId="17800" CreationDate="2016-11-17T18:07:05.810" Score="1" ViewCount="325" Body="&lt;p&gt;A year ago I asked this question and thanks to the answers I got things working.  A year later and i'm trying to do the same thing on a different website...  only this time it's not working!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Section Handle = &lt;strong&gt;artist&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;SuperTable Field Handle = &lt;strong&gt;lineUp&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;SuperTable 'Entry' Field = &lt;strong&gt;artistPerforming&lt;/strong&gt;, which is linked to Section '&lt;strong&gt;artist&lt;/strong&gt;'&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reverseRelatedElements = craft.supertable.getRelatedElements({&#xA;    relatedTo: {&#xA;        targetElement: entry,&#xA;        field: 'lineUp.artistPerforming'&#xA;    },&#xA;    section: 'artist'&#xA;}) %}&#xA;&#xA;{% for eventLineUp in reverseRelatedElements %}&#xA;    {{ eventLineUp.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My SuperTable field is assigned to a Section with handle &lt;strong&gt;stageEvent&lt;/strong&gt;, so from my &lt;strong&gt;stageEvent&lt;/strong&gt; entry i'm trying to pull related entry information from Section &lt;strong&gt;artist&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing is outputting but I don't get any errors??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone see what i'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="125" LastEditDate="2016-11-18T11:03:37.257" LastActivityDate="2018-09-26T21:26:06.533" Title="Related Entry within SuperTable" Tags="&lt;relations&gt;&lt;plugin-supertable&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17789" PostTypeId="2" ParentId="17786" CreationDate="2016-11-17T21:03:24.860" Score="1" Body="&lt;p&gt;I can't say for certain if you would see faster session handling if you added the overridePhpSessionLocation config key, but have you added the &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow noreferrer&quot;&gt;appId&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;nofollow noreferrer&quot;&gt;validationKey&lt;/a&gt; configuration keys? I was recently having issues in my load balanced environments because these keys were not set.&lt;/p&gt;&#xA;" OwnerUserId="5814" LastActivityDate="2016-11-17T21:03:24.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17790" PostTypeId="1" CreationDate="2016-11-17T21:37:47.853" Score="1" ViewCount="102" Body="&lt;p&gt;I'm looping over my sections to produce a section filter group. But I want to exclude at least 2 of the sections. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd have thought I could do &lt;code&gt;craft.sections.getAllSections('not 18')&lt;/code&gt; for example but it seems not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's best approach?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-11-17T22:23:03.373" Title="getAllSections but not these specific sections" Tags="&lt;sections&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17791" PostTypeId="2" ParentId="17790" CreationDate="2016-11-17T22:16:27.177" Score="1" Body="&lt;p&gt;Here's how I've gone about that in the past.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loop through all sections, and only if section.type is structure and doesn't have the handle 'pages' (skip that section, essentially);&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in craft.sections.getAllSections() if section.type == 'structure' and section.handle != 'pages' %}&#xA;  What you want to do here... Print the content or whatnot.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you only want to get channels;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in craft.sections.getAllSections() if section.type == 'channel' %}&#xA;  What you want to do with the channels here...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2016-11-17T22:23:03.373" LastActivityDate="2016-11-17T22:23:03.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17792" PostTypeId="1" CreationDate="2016-11-18T02:24:44.800" Score="0" ViewCount="51" Body="&lt;p&gt;I'm sure this is a simple question, but I'm a newbie in this, so I'd greatly appreciate all the help I can get! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is carstensphotos.lumenage.com for now. It's a one page site, so I used the index as the template for the Gallery Section ('gallery'), where the photographer will be able to upload his pics. I'm trying to get the first image of the first entry to show with no success. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;menu&quot;&amp;gt;&#xA;  {% for galleryEntries in craft.entries.section ('gallery') %}       &#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ galleryEntries.url }}&quot; {% if craft.request.url == galleryEntries.url %}class=&quot;active&quot;{% endif %}&amp;gt;{{ galleryEntries.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;  &#xA;&amp;lt;section class=&quot;photoslider&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;photos&quot;&amp;gt;&#xA;   {% for image in entry.galleryPhotos.first() %}               &#xA;      &amp;lt;div class=&quot;item responsive&quot; id=&quot;1&quot;&amp;gt;&#xA;           &amp;lt;div class=&quot;image-wrap&quot;&amp;gt;          &#xA;                &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;           &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;    &#xA;    {% endfor %}                 &#xA;    &amp;lt;/div&amp;gt;&#xA; &amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!   &lt;/p&gt;&#xA;" OwnerUserId="5900" LastEditorUserId="340" LastEditDate="2016-11-18T02:49:28.477" LastActivityDate="2016-11-18T02:55:01.247" Title="I can't get the first image to show on the homepage" Tags="&lt;templating&gt;&lt;assets&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17793" PostTypeId="2" ParentId="17792" CreationDate="2016-11-18T02:48:55.877" Score="2" Body="&lt;p&gt;Just a slight syntax issue it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want just the first image - always test if there is an image, then get it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.galleryPhotos.first()|length %}&#xA;    {% set image = entry.galleryPhotos.first() %}`&#xA;    &amp;lt;img src={{ image.url }} etc&amp;gt;&#xA;{% endif %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you want to loop over a few images...note here you don't need the &lt;code&gt;|length&lt;/code&gt; test as the for loop will not be entered if there is no image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.galleryPhotos %}&#xA;    &amp;lt;img src={{ image.url }} etc&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-11-18T02:55:01.247" LastActivityDate="2016-11-18T02:55:01.247" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17794" PostTypeId="2" ParentId="17784" CreationDate="2016-11-18T02:52:50.467" Score="3" Body="&lt;p&gt;&lt;strong&gt;If you want a rich text field on a front end&lt;/strong&gt; - this question has been answered in detail here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4225/how-do-i-enable-redactor-rich-text-editor-in-a-front-end-form/4238#4238&quot;&gt;How do I enable redactor rich text editor in a front-end form?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short technically possible but not recommended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you want a rich text field for a back end, i.e. plugin, form&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The craft macros for form fields live in &lt;code&gt;craft/app/templates/forms&lt;/code&gt; - however I do not believe there is a macro for a rich text field.  There are &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;textarea&lt;/code&gt; macros you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think it is possible in a plugin - this apparently creates a rich text field widget in your craft dashboard, so you should be able to pinch the relevant code from: &lt;a href=&quot;https://github.com/gilleard/RichTextWidget/blob/master/richtextwidget/widgets/RichTextWidget_DashboardWidget.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/gilleard/RichTextWidget/blob/master/richtextwidget/widgets/RichTextWidget_DashboardWidget.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Specifically look at &lt;code&gt;public function getSettingsHtml()&lt;/code&gt; I think)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-11-19T08:02:44.113" LastActivityDate="2016-11-19T08:02:44.113" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17795" PostTypeId="2" ParentId="228" CreationDate="2016-11-18T05:47:35.430" Score="5" Body="&lt;p&gt;This works for me just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Removes all characters other than numbers and + #}&#xA;{{ profile.phone|replace('/[^0-9+]/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-11-18T05:47:35.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17796" PostTypeId="1" CreationDate="2016-11-18T06:06:04.877" Score="1" ViewCount="270" Body="&lt;p&gt;I'm getting this error on the back-end and have no idea how to solve it. I re-uploaded the APP directory already once to no avail. Any input on how to resolve this would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'POST param “code” doesn’t exist.' in /path to craft/craft/app/services/HttpRequestService.php:509&#xA;Stack trace:&#xA;/path to craft/craft/app/controllers/UsersController.php(333): Craft\HttpRequestService-&amp;gt;getRequiredPost('code')&#xA;/path to craft/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UsersController-&amp;gt;actionSetPassword()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="437" LastEditorUserId="1016" LastEditDate="2017-08-16T19:47:11.090" LastActivityDate="2017-08-16T19:47:11.090" Title="POST param &quot;code&quot; doesn't exist" Tags="&lt;error-message&gt;&lt;error&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17797" PostTypeId="1" CreationDate="2016-11-18T10:52:31.560" Score="1" ViewCount="805" Body="&lt;p&gt;I'm trying to create a Modal and have a question:&#xA;my code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;my-modal&quot; class=&quot;modal&quot; &amp;gt;&#xA;    &amp;lt;div id=&quot;modal&quot; class=&quot;body&quot;&amp;gt;&#xA;        &amp;lt;header class=&quot;header&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;Modal header&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;/header&amp;gt;&#xA;        &amp;lt;div style=&quot;overflow:auto;&quot;&amp;gt;&#xA;            {{ include('srgooglemaps/infobubble/addEntry'}}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;button id=&quot;newInfoBubble&quot;  type=&quot;button&quot; class=&quot;btn submit&quot; value=&quot;test&quot;&amp;gt;new&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Javascript&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#newInfoBubble&quot;).click(function(){&#xA;    $modal = new Garnish.Modal($('#my-modal'));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I manage to make overscroll auto working? My included template is higher than the modal and I would like to add a scrollbar or another option to make everything visible.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2016-11-20T22:14:33.597" Title="How to create a Modal with a scrollbar" Tags="&lt;modal&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17798" PostTypeId="2" ParentId="17607" CreationDate="2016-11-18T11:43:25.983" Score="4" Body="&lt;p&gt;You can use this superb plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;RetconHTML&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Ever have a client put 4 MB PNG files in their Redactor fields, failing to apply any of your meticulously crafted image transforms? Writers consistently using the  tag for headers? Have you ever needed to implement lazy loading of images embedded in WYSIWYG content, responsive images or wanted to remove pesky inline styles without breaking a sweat? This is for you.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is super easy. Just add this filter to your WYSIWYG template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.wysiwyg | retcon('transform', 'yourImageTransform') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an option you can install &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt;.&#xA;If installed, Retcon uses Imager to apply the transform. Imager is faster and more flexibel than the standard image transforms in Craft.&lt;/p&gt;&#xA;" OwnerUserId="294" LastActivityDate="2016-11-18T11:43:25.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17800" PostTypeId="2" ParentId="17788" CreationDate="2016-11-18T12:18:40.333" Score="2" Body="&lt;p&gt;You can’t use this special Twig function to get reverse related entries at all, as you’re not dealing with reverse relations in that context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a &lt;code&gt;stageEvent&lt;/code&gt; entry you can just loop through the Super Table rows and get the related &lt;code&gt;artist&lt;/code&gt; entry like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.lineUp %}&#xA;    {% set artistPerforming = row.artistPerforming.first() %}&#xA;&#xA;    {% if artistPerforming %}&#xA;        {{ artistPerforming.title }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-18T12:18:40.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17801" PostTypeId="1" AcceptedAnswerId="17802" CreationDate="2016-11-18T13:09:55.213" Score="1" ViewCount="2580" Body="&lt;p&gt;I can get Craft to generate page titles for entries and individual pages using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;News and Insights&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I need to be able to generate a full page title for an entry, that includes the section name, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;News Item | News and Insights | Company Name&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please explain how...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2016-11-18T13:16:42.393" Title="How to include a section name in the page title?" Tags="&lt;set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17802" PostTypeId="2" ParentId="17801" CreationDate="2016-11-18T13:16:42.393" Score="2" Body="&lt;pre&gt;&lt;code&gt;{{ entry.section }} - {{ entry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are a list of properties you can get from the Entry model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entrymodel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;#{entry.section} | #{entry.title}&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-11-18T13:16:42.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17803" PostTypeId="1" CreationDate="2016-11-18T13:17:05.740" Score="1" ViewCount="502" Body="&lt;p&gt;When a customer completes an order using Stripe they get an email notification from Stripe. I have configured notifications to be sent from Craft and would like them to only get those emails. After looking into this for a bit, it seems like I need to stop Commerce from passing the receipt_email to Stripe to stop this from happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/changelog#build1323&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/changelog#build1323&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce now provides Stripe with the customer’s email address to support Stripe’s receipt email feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://support.stripe.com/questions/email-receipts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://support.stripe.com/questions/email-receipts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you charge a customer that already has an email address attached to it, passing in a receipt_email with a charge will override the customer’s stored email address, and we’ll send the receipt to the email address specified in your charge request’s receipt_email regardless of your email settings.&lt;/p&gt;&#xA;" OwnerUserId="5109" LastActivityDate="2017-03-29T18:46:55.783" Title="Disable Stripe email notifications from Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;emails&gt;&lt;omnipay-stripe&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17804" PostTypeId="1" CreationDate="2016-11-18T14:08:46.247" Score="2" ViewCount="750" Body="&lt;p&gt;I'm looking for a way to order the ElementAPI json array by &lt;em&gt;category&lt;/em&gt; and &lt;em&gt;title&lt;/em&gt;. I can only get one to work whether it's &lt;code&gt;'group' =&amp;gt; 'stockistRegion.first().title'&lt;/code&gt; or &lt;code&gt;'order' =&amp;gt; 'title'&lt;/code&gt; using the &lt;code&gt;criteria&lt;/code&gt; attribute. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone achieved this or know of a solution?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'stockists.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'stockistsListing', &#xA;                'search' =&amp;gt; 'stockistRegion:*',&#xA;                'group' =&amp;gt; 'stockistRegion.first().title', &#xA;                'order' =&amp;gt; 'title'&#xA;            ],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'stockistWebsiteUrl' =&amp;gt; (string)$entry-&amp;gt;stockistWebsiteUrl[url],&#xA;                    'address' =&amp;gt; $entry-&amp;gt;stockistAddress1 . ', ' . $entry-&amp;gt;stockistAddress2 . ' ' . $entry-&amp;gt;stockistAddress3 . ' ' . $entry-&amp;gt;stockistPostcode,&#xA;                    'formatted_address' =&amp;gt; $entry-&amp;gt;stockistAddress1 . '&amp;lt;br&amp;gt;' . $entry-&amp;gt;stockistAddress2 . '&amp;lt;br&amp;gt;' . $entry-&amp;gt;stockistAddress3 . '' . $entry-&amp;gt;stockistPostcode,&#xA;                    'stockistAddress2' =&amp;gt; $entry-&amp;gt;stockistAddress2,&#xA;                    'stockistAddress3' =&amp;gt; $entry-&amp;gt;stockistAddress3,&#xA;                    'stockistPostcode' =&amp;gt; $entry-&amp;gt;stockistPostcode,&#xA;                    'stockistRegion' =&amp;gt; (string)$entry-&amp;gt;stockistRegion[0],&#xA;                    'latitude' =&amp;gt; $entry-&amp;gt;latitude,&#xA;                    'longitude' =&amp;gt; $entry-&amp;gt;longitude,&#xA;                    //'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;stockist/{$entry-&amp;gt;id}.json&quot;),&#xA;                ];&#xA;            },&#xA;        ],&#xA;&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4147" LastEditorDisplayName="user4694" LastEditDate="2019-02-01T09:19:44.177" LastActivityDate="2019-02-01T09:19:44.177" Title="Ordering Element API by Category and Title" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17805" PostTypeId="1" AcceptedAnswerId="17806" CreationDate="2016-11-18T14:12:53.440" Score="3" ViewCount="58" Body="&lt;p&gt;I tried 'draft page' but that only shows it in live preview. I need it accessible through the navigation as well. I was expecting a concept button in the CP that would allow this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to make a specific light switch and create conditionals or is there some logic in the system?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-11-18T15:42:55.883" Title="How can I make an entry (in this case a page from structure) only visible to users with cp access?" Tags="&lt;control-panel&gt;&lt;editing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17806" PostTypeId="2" ParentId="17805" CreationDate="2016-11-18T15:42:55.883" Score="3" Body="&lt;p&gt;Craft has a handy &lt;code&gt;{% requireLogin %}&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/templating/requirelogin&quot; rel=&quot;nofollow noreferrer&quot;&gt;tag&lt;/a&gt;; this seems like the quickest and easiest solution for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this particular entry has its own Twig template you can just put this tag at the top of the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, as you say you could create a lightswitch field, add that to your entry type and simply tick the entries you would like to be password protected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple piece of Twig code that checks the lightswitch and does what you need could look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.requireLogin %}&#xA;    {% requireLogin %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-11-18T15:42:55.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17807" PostTypeId="2" ParentId="17803" CreationDate="2016-11-18T15:58:58.770" Score="2" Body="&lt;p&gt;You shouldn't need to adjust Craft Commerce at all. You can disable email receipts on the Stripe side in your account settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Account Settings &gt; Emails&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uncheck &quot;Email Customers for: Successful Payments&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZpRwJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZpRwJ.png&quot; alt=&quot;Stripe Email Settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as Stripe using the previous email address saved with the Customer, as far as I know OmniPay (which powers Commerce) doesn't create a Customer in Stripe, it only creates a Charge.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2016-11-18T15:58:58.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17808" PostTypeId="1" AcceptedAnswerId="17815" CreationDate="2016-11-18T19:48:25.603" Score="2" ViewCount="738" Body="&lt;p&gt;I can have many 'settings' fields for a fieldType and they're saved as a serialized string in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have more than one field for the fieldType itself? It looks like there's only one column in &lt;code&gt;craft_content&lt;/code&gt;. So I'm not sure you can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the preferred way to create your own table and store multiple field data there? And would that be using &lt;code&gt;prepValueFromPost()&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1069" LastEditorUserId="1069" LastEditDate="2016-11-19T01:49:47.007" LastActivityDate="2017-04-20T04:41:44.367" Title="More than one field for a fieldtype plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17809" PostTypeId="1" AcceptedAnswerId="17811" CreationDate="2016-11-18T22:58:42.517" Score="1" ViewCount="316" Body="&lt;p&gt;I have multiple sections (channels) that use the same index and _entry templates. &lt;strong&gt;In my index template, given that the section is dynamic, how do I define the &lt;em&gt;current&lt;/em&gt; section and access it?&lt;/strong&gt; Eg, I'd like to make the template's header dynamic: &lt;code&gt;&amp;lt;h1&amp;gt;{{ section.name ~ &quot; Blog&quot; }}&amp;lt;/h1&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my fragile, hacked solution that I hope I never have to use in production:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I start things off by grabbing a section of the current URL. This returns a string, eg: &quot;southwest-mn&quot;, that I use to load the actual section.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handle = craft.request.getSegment(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Next, I convert the string to one that reflects the section's handle format, eg: blog_southwest_mn (I changed it from blogSouthwestMn to make this string wizardry faster and easier)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionHandle = handle|replace('-', '_') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Now we can patch together a dynamic section name based on our URL, so let's grab the entries&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blog = craft.entries.section('blog_' ~ sectionHandle) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This is the most embarrassing part of the code... I'm not sure how to get to the actual section model, so I used the following to display the correct header in the template&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if handle == &quot;southwest-mn&quot; %}&#xA;    {% set blogTitle = &quot;Southwest MN Blog&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's how I was able to at least get a prototype template working. But &lt;strong&gt;how can I load a dynamic section's model&lt;/strong&gt; so I don't have to write such madness?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2016-11-21T16:19:50.697" Title="Many sections use one template: How do I get current section?" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17810" PostTypeId="1" AcceptedAnswerId="17812" CreationDate="2016-11-19T09:02:01.777" Score="1" ViewCount="63" Body="&lt;p&gt;The example below will continue to save entries with the same title and slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a built in validation when using &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = $sectionId;&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'title' =&amp;gt; '123',&#xA;        ));&#xA;$re = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2016-11-19T19:28:22.020" Title="Built in validate of title when using EntryModel?" Tags="&lt;plugin-development&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17811" PostTypeId="2" ParentId="17809" CreationDate="2016-11-19T12:02:49.300" Score="2" Body="&lt;p&gt;If I understand you right, you could just use the Entry Model which is automatically populated as &lt;code&gt;entry&lt;/code&gt; if you call the Index. Entry Model objects have a method &lt;code&gt;getSection()&lt;/code&gt; which returns the Section Model to which the Entry Model object belongs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getSection&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entrymodel#getSection&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;Okay I think I didn't understand you right. I think you get the error because no section is related to your index template and instead you call it directly. You actually don't want that, so rename your index file to &lt;code&gt;_index&lt;/code&gt; in order to prevent direct call. If you call it directly, no entry object is populated and voilà: error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can probably achieve what you want by utilizing the way Craft's example website &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager&lt;/a&gt; does it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You have your channel sections with their handles &lt;code&gt;a, b, c...&lt;/code&gt;. Entry Template of all is let's say &lt;code&gt;whatever/_entry&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For every channel section you create a section of type single, the handles like &lt;code&gt;aIndex, bIndex, cIndex...&lt;/code&gt;. All of these single sections point to &lt;code&gt;whatever/_index&lt;/code&gt; as Entry Template but have different URIs, e.g. &lt;code&gt;a&lt;/code&gt; for section &lt;code&gt;aIndex&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When you hit &lt;code&gt;craft.dev/a&lt;/code&gt; now, you get your index template &lt;code&gt;whatever/_index&lt;/code&gt; populated with &lt;code&gt;entry&lt;/code&gt; and &lt;code&gt;entry.getSection()&lt;/code&gt; returns a section model of &lt;code&gt;aIndex&lt;/code&gt;. Now you can get all entries of channel section &lt;code&gt;a&lt;/code&gt; by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set channel = entry.getSection().handle | replace(&quot;Index&quot;, &quot;&quot;) %}&#xA;{% set entries = craft.entries.section(channel) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is still kind of hacky because you have to name the section handles appropriately. &lt;/p&gt;&#xA;" OwnerUserId="5851" LastEditorUserId="5851" LastEditDate="2016-11-21T16:19:50.697" LastActivityDate="2016-11-21T16:19:50.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17812" PostTypeId="2" ParentId="17810" CreationDate="2016-11-19T19:28:22.020" Score="2" Body="&lt;p&gt;You could hook into the &lt;code&gt;entries.beforeSaveEntry&lt;/code&gt; event like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.beforeSaveEntry', function (Event $e) {&#xA;&#xA;    // Get the entry we're saving, and it's title&#xA;    $entry = $e-&amp;gt;params['entry'];&#xA;    $title = $entry-&amp;gt;getContent()-&amp;gt;title;&#xA;&#xA;    // Look for existing entries with the same title&#xA;    $existingEntry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;      'title' =&amp;gt; $title,&#xA;      'id' =&amp;gt; $entry-&amp;gt;id ? 'not '.$entry-&amp;gt;id : null&#xA;    ])-&amp;gt;first();&#xA;&#xA;    // If an existing entry is found, prevent saving and pass an error message&#xA;    if ($existingEntry) {&#xA;      $entry-&amp;gt;addErrors([&#xA;        'title' =&amp;gt; Craft::t(&quot;An entry titled $title already exists&quot;),&#xA;      ]);&#xA;      $e-&amp;gt;performAction = false;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-19T19:28:22.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17813" PostTypeId="1" AcceptedAnswerId="17824" CreationDate="2016-11-20T08:41:18.073" Score="0" ViewCount="58" Body="&lt;p&gt;I want to show a child entry and can so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('products') %}&#xA;&#xA;    {% switch entry.level %}&#xA;        {% case '1' %}&#xA;            {# level 1 #}&#xA;            &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;        {% case '2' %}&#xA;        &amp;lt;li&amp;gt;    &#xA;            {# level 2 #}&#xA;            &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% case '3' %}&#xA;        &amp;lt;ul&amp;gt; &amp;lt;li&amp;gt;&#xA;            {# level 3 #}&#xA;            &amp;lt;h4&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% case '4' %}&#xA;            {# level 4 #}&#xA;            4&#xA;            &amp;lt;/li&amp;gt;&#xA;    {% endswitch %}&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I can't get a matrix field to show for the child entry, using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrix %}&#xA;&#xA;            {{ block.intro }}&#xA;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within any of the cases?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="57" LastEditDate="2016-11-21T19:01:41.957" LastActivityDate="2016-11-21T19:01:41.957" Title="Show a child's Matrix within a Structure" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17814" PostTypeId="1" AcceptedAnswerId="17816" CreationDate="2016-11-20T09:34:22.867" Score="1" ViewCount="186" Body="&lt;p&gt;I'm building a custom registration process in which a set of entries &lt;strong&gt;and&lt;/strong&gt; a user are created at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Currently I'm not able to pass back my errors in my controller into the front-end template.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The following code &lt;strong&gt;&lt;em&gt;should&lt;/em&gt;&lt;/strong&gt; error out on purpose to test this functionality)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In my plugin controller:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel;&#xA;$wasSaved = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;if ($wasSaved) {&#xA;     $was_assigned = craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, array(1));&#xA;} else {&#xA;     $user-&amp;gt;addErrors($user-&amp;gt;getErrors());&#xA;     var_export($user-&amp;gt;getErrors());&#xA;     return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In my template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;  &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;     {% for error in errors %}&#xA;         &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% if account.getErrors is defined %}&#xA;    {{ _self.errorList(account.getErrors()) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the &lt;code&gt;var_export($user-&amp;gt;getErrors());&lt;/code&gt; in my controller, I can see the errors at the top of the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array ( 'username' =&amp;gt; array ( 0 =&amp;gt; 'Username cannot be blank.', 1 =&amp;gt; 'Username cannot be blank.', ),&#xA;'email' =&amp;gt; array ( 0 =&amp;gt; 'Email cannot be blank.', 1 =&amp;gt; 'Email cannot be blank.', ), )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but these errors are not making it back into the actual template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2016-11-20T12:08:13.500" Title="Custom registration User validation" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17815" PostTypeId="2" ParentId="17808" CreationDate="2016-11-20T10:13:24.220" Score="3" Body="&lt;p&gt;Nope – a single field can only have a single column in the &lt;code&gt;craft_content&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need your &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;FieldType&lt;/a&gt; to save complex data, you have two options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest approach – by far – is to simply have Craft serialize the data before it's saved to the &lt;code&gt;craft_content&lt;/code&gt; table. Simply return &lt;code&gt;AttributeType::Mixed&lt;/code&gt; from your FieldType class' &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types#customizing-the-database-column-type&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;defineContentAttribute()&lt;/code&gt;&lt;/a&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return AttributeType::Mixed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, your FieldType's &lt;em&gt;value&lt;/em&gt; will be an array. This means that when you save the data, you'll need to use the array syntax for the input fields' &lt;code&gt;name&lt;/code&gt; attributes; e.g. if you had two &quot;sub fields&quot; called &lt;code&gt;foo&lt;/code&gt; and &lt;code&gt;bar&lt;/code&gt;, your input fields should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;myFieldHandle[foo]&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;myFieldHandle[bar]&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To output the sub fields in a template, you'd do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myFieldHandle.foo }}&#xA;{{ entry.myFieldHandle.bar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;other&lt;/em&gt; approach for saving complex values is to have your FieldType use a custom database table. Explaining this in any great detail is impossible without knowing a lot more about your particular use case and a good overview is already given in &lt;a href=&quot;https://craftcms.stackexchange.com/a/11000/1098&quot;&gt;Ben Parizek's great answer to a similar question&lt;/a&gt; – but here's the gist of it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you'll need to create a &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;Record&lt;/a&gt; class, containing your custom FieldType's columns (sub fields) and their attribute types. Whenever your plugin is installed, Craft will create custom database tables based on your plugin's Records (which means that if your plugin is already installed, you'll need to uninstall and install it again to actually have Craft create the tables – if this is a publicly available plugin you should probably write a &lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Migration&lt;/a&gt; to ensure the table is created whereever the plugin is already installed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your custom table should probably have &lt;a href=&quot;https://craftcms.com/docs/plugins/records#defining-relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;foreign keys&lt;/a&gt; for the element and field ID's, to create the necessary relations between the field data, the field and the actual element (e.g. entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually &lt;em&gt;save&lt;/em&gt; the data to your custom table, you'll need to add a &lt;code&gt;onAfterElementSave&lt;/code&gt; hook to your FieldType class. This hook is run whenever an element with a field using your custom FieldType is saved. The field and element ID's (and the actual data to save), is available via the FieldType's &lt;code&gt;model&lt;/code&gt; and &lt;code&gt;element&lt;/code&gt; properties, respectively:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onAfterElementSave()&#xA;{&#xA;&#xA;    $element = $this-&amp;gt;element; // The element being saved&#xA;    $elementId = $this-&amp;gt;element-&amp;gt;id; // The ID for the element being saved&#xA;    $fieldModel = $this-&amp;gt;model; // The field's model&#xA;    $fieldHandle = $field-&amp;gt;model-&amp;gt;handle; // The field's handle&#xA;    $data = $this-&amp;gt;element-&amp;gt;getContent()-&amp;gt;getAttribute($fieldHandle); // The data you want to save&#xA;&#xA;    ...&#xA;&#xA;    // Some custom logic to save the data&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To save the data via the &lt;code&gt;onAfterElementSave&lt;/code&gt; hook, you'll most likely need to use the &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;DbCommand&lt;/code&gt;&lt;/a&gt; class to build a custom query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to populuate your field (i.e. pull the data) for use in templates and the &lt;code&gt;getInputHtml()&lt;/code&gt; method, you'll also need to write a custom query. A good place to do this is in your FieldType's &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;prepValue()&lt;/code&gt;&lt;/a&gt; method, i.e. something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepValue($value) {&#xA;    $value = null;&#xA;    $fieldId = $this-&amp;gt;model-&amp;gt;id;&#xA;    if ($this-&amp;gt;element-&amp;gt;id) {&#xA;        // Then element has been saved before and there might be existing data – try to pull it&#xA;        $value = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;            -&amp;gt;select('foo, bar')&#xA;            -&amp;gt;from('yourcustomdatabasetable')&#xA;            -&amp;gt;where([&#xA;                'fieldId' =&amp;gt; $this-&amp;gt;model-&amp;gt;id,&#xA;                'elementId' =&amp;gt; $this-&amp;gt;element-&amp;gt;id,&#xA;            ])&#xA;            -&amp;gt;queryAll();&#xA;    }&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, to save some overhead its a good idea to return &lt;code&gt;false&lt;/code&gt; from your FieldType class' &lt;code&gt;defineContentAttribute&lt;/code&gt; method (this basically tells Craft to not save anything to the &lt;code&gt;craft_content&lt;/code&gt; table):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineContentAttribute()&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that there are other aspects to consider as well, such as offloading the business logic in saving and retrieving the data to a &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;service layer&lt;/a&gt; (a good idea), and using &lt;a href=&quot;https://craftcms.com/docs/plugins/models&quot; rel=&quot;nofollow noreferrer&quot;&gt;Models&lt;/a&gt; to pass data between records, the service layer and your templates (a &lt;em&gt;very&lt;/em&gt; good idea), but it's a bit out of scope for an SE answer like this. In any case, I hope the above will get you up and running. In any case, if you simply need to two text fields, I'd go with the first approach – it's way easier.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="3931" LastEditDate="2017-04-20T04:41:44.367" LastActivityDate="2017-04-20T04:41:44.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17816" PostTypeId="2" ParentId="17814" CreationDate="2016-11-20T12:08:13.500" Score="3" Body="&lt;p&gt;It looks like you're not returning the user model back to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need something like this in your controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;    'account' =&amp;gt; $user&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-11-20T12:08:13.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17817" PostTypeId="1" AcceptedAnswerId="17984" CreationDate="2016-11-20T17:50:09.067" Score="3" ViewCount="1472" Body="&lt;p&gt;I want to use the Element API plugin, but the content must only be visible when users are logged in. How I do this for a section? Is it possible to use &lt;code&gt;requirelogin&lt;/code&gt; or &lt;code&gt;currentUser&lt;/code&gt; for this?&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2016-11-21T01:47:19.023" LastActivityDate="2016-12-02T21:48:41.403" Title="How to use the Element API plugin only when logged in?" Tags="&lt;plugin-elementapi&gt;&lt;authentication&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17818" PostTypeId="1" AcceptedAnswerId="17821" CreationDate="2016-11-20T19:08:29.867" Score="2" ViewCount="701" Body="&lt;p&gt;Is it possible to 'view' an order's PDF rather than download/create it first? I ask because I'm working on PDF templates and I can't figure out how to view the progress/changes I'm making without having to re-download a order PDF everytime. &lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2016-11-20T21:44:51.307" Title="Craft Commerce View Order PDF, Not Download" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17819" PostTypeId="2" ParentId="17697" CreationDate="2016-11-20T19:41:52.940" Score="4" Body="&lt;p&gt;I tend to use a config.php variable (called assetVersion) for the production site, and just generate a random value for the dev site using Twig's random function. Looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/assets/css/style-min.css{{ craft.config.devMode ? '?v=' ~ random() : '?v=' ~ craft.config.assetVersion }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2016-11-20T19:41:52.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17820" PostTypeId="2" ParentId="17817" CreationDate="2016-11-20T19:46:59.667" Score="5" Body="&lt;p&gt;If you want to restrict the whole API, you can add some code to the top of your &lt;code&gt;/config/elementapi.php&lt;/code&gt; file (right below &lt;code&gt;namespace Craft;&lt;/code&gt;) that checks for a logged in user, and ends the request with an appropriate status if the user isn't logged in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;if (!$user) {&#xA;    HeaderHelper::setHeader(array('status' =&amp;gt; 404));&#xA;    craft()-&amp;gt;end();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you can replace the &lt;code&gt;404&lt;/code&gt; with &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error&quot; rel=&quot;noreferrer&quot;&gt;another HTTP status code&lt;/a&gt; if you want to; pick whatever feels appropriate to your app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If you want to restrict specific endpoints&lt;/em&gt;, but leave others open, the best approach is probably to wrap the above code in a function, i.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php &#xA;namespace Craft;&#xA;&#xA;function requireLogin() {&#xA;    $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;    if (!$user) {&#xA;        HeaderHelper::setHeader(array('status' =&amp;gt; 404));&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;}&#xA;&#xA;return [&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, it's simply a matter of calling this function from your restricted endpoints' &lt;code&gt;transformer&lt;/code&gt; callbacks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'news.json' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;        // This endpoint should be restricted&#xA;        requireLogin();&#xA;&#xA;        return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            ...&#xA;        ];&#xA;&#xA;    },&#xA;],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-20T19:46:59.667" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17821" PostTypeId="2" ParentId="17818" CreationDate="2016-11-20T21:44:51.307" Score="3" Body="&lt;p&gt;No, I don't think there's a way of having a &quot;live&quot; pdf open, in the same way as a webpage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, what I usually do is just open the pdf template directly in the browser and create the HTML and CSS while using my normal workflow to check how it looks in the browser. This usually get me 95% of the way, and then I can do the final tweaks when I see what dompdf makes of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need a variable &lt;code&gt;order&lt;/code&gt; that's an OrderModel to make this work, so I just grab one like this at the top of my template or in my layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not order is defined %}&#xA;    {% set order = craft.commerce.orders.first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you want to test with different orders you can get one at random, or a specific one by id. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-11-20T21:44:51.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17822" PostTypeId="2" ParentId="17797" CreationDate="2016-11-20T22:14:33.597" Score="3" Body="&lt;p&gt;Although I agree to close this, I think Anubarak deserves an answer as to why this is not Craft related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Garnish Modal doesn't care what you use it for, it's just a modal. So, what Daryl and Mats is hinting at, is that you just need to style the content of the modal properly, and you'll have scroll. Which is what you've tried to do with &lt;code&gt;overflow: auto&lt;/code&gt; on the div. But this doesn't work since the wrapping element doesn't have a height. Also, the div itself needs a height to know when to introduce the scroll. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the header into account (assuming you want it fixed in the top of the modal), something like this should get you started (inline styles cause I'm lazy, these should of course go into classes):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;my-modal&quot; class=&quot;modal&quot;&amp;gt;&#xA;  &amp;lt;div id=&quot;modal&quot; class=&quot;body&quot; style=&quot;height: 100%;&quot;&amp;gt;&#xA;    &amp;lt;header class=&quot;header&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;Modal header&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;/header&amp;gt;&#xA;    &amp;lt;div style=&quot;overflow: auto; height: calc(100% - 66px); position: absolute; top: 66px; left: 0;&quot;&amp;gt;&#xA;        (insert long content here)&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, this isn't specific to craft, it's a pure CSS question.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-11-20T22:14:33.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17824" PostTypeId="2" ParentId="17813" CreationDate="2016-11-21T05:31:21.027" Score="1" Body="&lt;p&gt;This should do it, user2569  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrix %}&#xA;    {% if block.type == 'intro' %}&#xA;        {{ block.intro }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="344" LastEditDate="2016-11-21T09:39:31.397" LastActivityDate="2016-11-21T09:39:31.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17825" PostTypeId="1" AcceptedAnswerId="17906" CreationDate="2016-11-21T10:25:05.627" Score="2" ViewCount="1157" Body="&lt;p&gt;I'm in the process of setting up a shop with Craft Commerce but I'm having some trouble organising the data structure of the products. The problem is that some products have both sizing and color options but I'm not sure how to enter these in the back-end. The most obvious way of doing this would be to make a product variant for each possible combination, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Variant 1:&lt;/strong&gt; color 1 - size 1&lt;br&gt;&#xA;&lt;strong&gt;Variant 2:&lt;/strong&gt; color 2 - size 1&lt;br&gt;&#xA;&lt;strong&gt;Variant 3:&lt;/strong&gt; color 1 - size 2&lt;br&gt;&#xA;&lt;strong&gt;Variant 4:&lt;/strong&gt; color 2 - size 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this would work but there will be a lot of variants. And if another one or two options are added in the future the amount of variants will grow exponentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight on this would be much appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-11-26T03:18:54.083" Title="Structuring products variants" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17826" PostTypeId="1" AcceptedAnswerId="17827" CreationDate="2016-11-21T11:44:00.400" Score="1" ViewCount="1078" Body="&lt;p&gt;I want to remove the option to add a H1 from the dropdown in the Redactor rich-text component. I have edited the Standard.json file in craft&gt;config&gt;redactor to the below but it still hasn't done the job: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;horizontalrule&quot;],&#xA;    &quot;plugins&quot;: [&quot;source&quot;,&quot;fullscreen&quot;],&#xA;    &quot;formattingTags&quot;: [&quot;h2&quot;,&quot;h3&quot;,&quot;p&quot;,&quot;blockquote&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I followed instructions from &lt;a href=&quot;https://straightupcraft.com/articles/custom-redactor-toolbars-for-the-rich-text-field-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, but it looks like &quot;formattingTags&quot; doesn't work. Anyone know how to fix this? &lt;/p&gt;&#xA;" OwnerUserId="5907" LastActivityDate="2016-11-21T11:49:46.387" Title="How can I change the rich-text editor to remove the &quot;Heading 1&quot; option" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17827" PostTypeId="2" ParentId="17826" CreationDate="2016-11-21T11:49:46.387" Score="4" Body="&lt;p&gt;&lt;code&gt;formattingTags&lt;/code&gt; is not the correct syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be using &lt;code&gt;formatting&lt;/code&gt; instead, as per my answer on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15166/can-i-change-which-format-options-are-available-in-my-rich-text-field/15168&quot;&gt;this&lt;/a&gt; question.&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-11-21T11:49:46.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17828" PostTypeId="1" CreationDate="2016-11-21T14:27:40.003" Score="1" ViewCount="189" Body="&lt;p&gt;I was wondering if there was a way I could set the SEO tags based off of a category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg. If a entry is in the &quot;Marketing&quot; category, use marketing Meta data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5909" LastEditorUserId="45" LastEditDate="2016-11-21T20:09:01.460" LastActivityDate="2016-11-21T20:09:01.460" Title="SEOmatic - Set the SEO tags based off of a category?" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17829" PostTypeId="1" AcceptedAnswerId="17836" CreationDate="2016-11-21T15:12:27.983" Score="1" ViewCount="2581" Body="&lt;p&gt;I have a contact form that works using Postmark and &lt;a href=&quot;http://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find a way to edit the format of the email that I'm getting when someone sends a message via the website contact form. &#xA;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Subject: &#xA;Message from: {{ name.field }}&#xA;&#xA;Full name:&#xA;{{ name.field }}&#xA;&#xA;Email:&#xA;{{ email.field }}&#xA;&#xA;Department:&#xA;{{ department.field }}&#xA;&#xA;Message:&#xA;{{ message.field }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see that there's a &quot;HTML Email Template&quot; option in Settings &gt; Email. But I couldn't find any documentation.&lt;/p&gt;&#xA;" OwnerUserId="5910" LastEditorUserId="22" LastEditDate="2017-05-09T20:46:33.777" LastActivityDate="2017-05-09T20:46:33.777" Title="Craft CMS HTML Email Template" Tags="&lt;templating&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17830" PostTypeId="2" ParentId="17828" CreationDate="2016-11-21T15:23:19.943" Score="2" Body="&lt;p&gt;Absolutely. Just create those fields then assign them to your categories under field layout just like you would do for your sections.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2016-11-21T15:23:19.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17831" PostTypeId="1" CreationDate="2016-11-21T15:24:09.587" Score="2" ViewCount="484" Body="&lt;p&gt;I'm trying to get the most popular entries of my site in a certain time period, for example 24h, based on the amount of views (clicks) it gets. I'm using the entry count plugin to do the counting but I can't get it working like I want. It can get a most viewed of all time array, but I need a most viewed of the last 24h.&#xA;I've followed the course that the plugin is based on, but I only get errors when trying to customize it...&#xA;Can anyone help me out? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2016-12-04T08:23:09.927" Title="Entry Count plugin" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugins&gt;&lt;count&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17834" PostTypeId="2" ParentId="17697" CreationDate="2016-11-21T17:09:34.620" Score="0" Body="&lt;p&gt;Funny that you mention DeployBot — I actually wrote a post at DeployBot's blog about solving this exact problem with Craft, DeployBot, and Gulp.js: &lt;a href=&quot;https://deploybot.com/blog/adding-fingerprints-to-assets-with-gulp-and-deploybot&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://deploybot.com/blog/adding-fingerprints-to-assets-with-gulp-and-deploybot&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach doesn't require any Craft plugins, but assumes that you use a task runner like Gulp or Grunt for building your assets.&lt;/p&gt;&#xA;" OwnerUserId="3911" LastActivityDate="2016-11-21T17:09:34.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17835" PostTypeId="1" CreationDate="2016-11-21T17:12:20.783" Score="2" ViewCount="248" Body="&lt;p&gt;I’m trying to find a way to ‘group’ pages in a structure, where that group page has no function other than to visually organise the entries in the structure, and does not need to be part of the url structure.. eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Major Campaigns &#xA;   type: landingPageGroup&#xA;   slug: major-campaigns&#xA;&#xA;    - Moving Office&#xA;       type: landingPage&#xA;       slug: moving-office&#xA;       uri: /moving-office&#xA;&#xA;        - Your Moving Checklist &#xA;           type: landingPage&#xA;           slug: your-moving-checklist&#xA;           uri: /moving-office/your-moving-checklist&#xA;&#xA;- Major Events&#xA;   type: landingPageGroup&#xA;   slug: major-events&#xA;&#xA;    - Conference 2016&#xA;       type: landingPage&#xA;       slug: conference-2016 &#xA;       uri: /conference-2016&#xA;&#xA;        - Agenda &#xA;           type: landingPage&#xA;           slug: agenda&#xA;           uri: /conference-2016/agenda&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I set the Entry URL Format to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top level: &lt;code&gt;{% if entry.type != 'landingPageGroup' %}{slug}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nested: &lt;code&gt;{% if object.parent.type != 'landingPageGroup' %}{parent.uri}{% endif %}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...the URLs look correct in the entries listing, but it will throw a 404 when you try to access them... is there anyway I can get around this with some custom routing maybe?&lt;/p&gt;&#xA;" OwnerUserId="4553" LastActivityDate="2016-11-22T10:14:32.317" Title="Exclude certain entry types from Entry URL format?" Tags="&lt;url&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17836" PostTypeId="2" ParentId="17829" CreationDate="2016-11-21T19:09:13.267" Score="0" Body="&lt;p&gt;The &quot;HTML Email Template&quot; option in Settings &gt; Email in the Craft control panel is completely unrelated to the Contact Form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change the body of the email that gets sent out, you'll need to write a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listens to the &lt;code&gt;beforeMessageCompile&lt;/code&gt; event as documented here: &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#the-contactformbeforemessagecompile-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/ContactForm#the-contactformbeforemessagecompile-event&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-21T19:09:13.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17839" PostTypeId="2" ParentId="17835" CreationDate="2016-11-21T23:34:13.493" Score="2" Body="&lt;p&gt;I don't know of good, non-hacky way to do what you're doing.  Every entry in a structure should have some meaning otherwise you're going to fight the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reason why those top level &lt;code&gt;landingPageGroups&lt;/code&gt; are just &quot;vestigial&quot; and serve no purpose? That would make them good candidates to break into separate sections. So &lt;code&gt;Major Campaigns&lt;/code&gt; would be a new structure section, &lt;code&gt;Major Events&lt;/code&gt; would be another new structure section, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably hack your web server to rewrite slugs so that /major-campaigns/moving-office becomes /moving-office but for every section you add, that becomes a nightmare.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you think you'll use one template across the board, it's inevitable that at some point you'll be using different templates for each &quot;section&quot; as well. I don't know your content strategy but if you only use one section, your entry types will likely multiply too.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-11-21T23:34:13.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17840" PostTypeId="1" AcceptedAnswerId="17883" CreationDate="2016-11-22T03:24:59.000" Score="1" ViewCount="1090" Body="&lt;p&gt;We're using Stripe for an ecomm project that we're testing out right now and nothing is hitting Stripe. If we use a bad card number (&lt;a href=&quot;https://stripe.com/docs/testing#cards&quot; rel=&quot;nofollow noreferrer&quot;&gt;per Stripe's docs&lt;/a&gt;) like 4000000000000002, the order still goes through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Stripe account is brand new (hasn't fully been activated yet) and in Test mode and the test secret and publishable keys are in Commerce's settings. I'm not sure what else to check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had forgotten stripe.js altogether but now I'm getting &quot;Payment information submitted is invalid.&quot; which I think is a Craft/Commerce error. &lt;a href=&quot;http://d.pr/f/Ogol&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's a link&lt;/a&gt; to my checkout template code. The wrapper template (extended template) contains &lt;a href=&quot;http://d.pr/f/kj4y&quot; rel=&quot;nofollow noreferrer&quot;&gt;this javascript&lt;/a&gt; before the closing body tag.&lt;/p&gt;&#xA;" OwnerUserId="256" LastEditorUserId="256" LastEditDate="2016-11-22T23:01:45.597" LastActivityDate="2016-11-23T21:11:48.187" Title="Getting Stripe to work with Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;omnipay-stripe&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17843" PostTypeId="1" AcceptedAnswerId="17845" CreationDate="2016-11-22T11:27:59.907" Score="1" ViewCount="312" Body="&lt;p&gt;When checking if a field has content or not in my templates I usually write something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.fieldHandle|length %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.fieldHandle }}&amp;lt;/h1&amp;gt; &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Writing the same code without the &lt;code&gt;|length&lt;/code&gt; filter does also work, so can I just exclude the use of the filter from my code altogether? Are there any caveats with &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; using the filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, I am aware that &lt;code&gt;|length&lt;/code&gt; does have its uses. You can use this to check the exact value of something, etc etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question was more suited for a simple yes/no check to see if a field has any content and outputting something if it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example of the &lt;code&gt;|length&lt;/code&gt; filter in my code would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homepageServices = craft.entries.section('services').type('serviceGroup').level(1) %}&#xA;{% if homepageServices|length %}&#xA;    &amp;lt;p&amp;gt;Output the services here&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would removing &lt;code&gt;|length&lt;/code&gt; (which does work at the moment) cause me any headaches down the line?&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-11-22T12:38:32.397" Title="Is the length filter required when checking if a field has content or not?" Tags="&lt;templating&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17844" PostTypeId="1" AcceptedAnswerId="17858" CreationDate="2016-11-22T11:41:45.727" Score="4" ViewCount="659" Body="&lt;p&gt;I set up a new shop and the base currency is US dollars. However I want to change this to Euro's. How can I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Commerce --&gt; Settings --&gt; Payment Currencies I can add new currencies but I can't set it as the new default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I looking in the wrong spot?&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-11-22T19:37:29.427" Title="Changing base currency" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17845" PostTypeId="2" ParentId="17843" CreationDate="2016-11-22T12:38:32.397" Score="4" Body="&lt;p&gt;You can probably get away with removing &lt;code&gt;|length&lt;/code&gt; for most conditionals that check for the existence of content in a custom field and just check on &lt;code&gt;entry.fieldHandle&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One exception to this would be for lightswitch fields, which always return &lt;code&gt;true&lt;/code&gt; for a &lt;code&gt;|length&lt;/code&gt; check, but return &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; when checking on &lt;code&gt;entry.fieldHandle&lt;/code&gt; depending on whether the lightswitch is &lt;code&gt;on&lt;/code&gt; or &lt;code&gt;off&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;StraightUpCraft has a great article on &lt;a href=&quot;https://straightupcraft.com/articles/testing-if-something-exists-is-defined-length-is-not-null-is-not-empty&quot; rel=&quot;nofollow noreferrer&quot;&gt;Testing if something exists&lt;/a&gt; and another on &lt;a href=&quot;https://straightupcraft.com/articles/how-to-check-if-a-variable-or-value-exists-using-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to check if a variable or value exists using Twig&lt;/a&gt;, which cover a multitude of cases and ways of accessing variables using Twig.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-11-22T12:38:32.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17847" PostTypeId="1" AcceptedAnswerId="17860" CreationDate="2016-11-22T14:01:58.313" Score="1" ViewCount="187" Body="&lt;p&gt;The client wants related products on individual product pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have the “Commerce Products”-field allow for selection of variants rather than products as a whole? Or is there another way to achieve this functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, I was thinking about letting the client paste the variant ids into a table field or something, then pull the variants onto the product page with ajax. Seems quite hacky though, so any alternatives are most welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you kindly&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2018-03-28T23:26:16.137" Title="Can the “Commerce Products”-field allow for selection of variants?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17848" PostTypeId="2" ParentId="17831" CreationDate="2016-11-22T14:13:03.763" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Count plugin&lt;/a&gt; does not record the individual times at which each entry was counted, therefore there is no way to filter by a specific time period. For that you'll need to find another solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've requested it in the comments, the only way to get this to work without the existing plugin would be to reset all entry counts once a day using a cron job. For sure not ideal but it would require a minimal amount of code refactoring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To set this up you would need to add an anonymous controller method (that requires a key to be accessed) to reset all entry counts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionResetAll()&#xA;{&#xA;    // verify query parameter key&#xA;    if (craft()-&amp;gt;request-&amp;gt;getParam('key') != 'xyzxyzxyzxyzxyzxyz') {&#xA;        die('Unauthorised key');&#xA;    }&#xA;&#xA;    craft()-&amp;gt;entryCount-&amp;gt;resetAll();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As well as a service method to do the work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function resetAll()&#xA;{&#xA;    // delete all records from DB&#xA;    EntryCountRecord::model()-&amp;gt;deleteAll();&#xA;&#xA;    // log reset&#xA;    EntryCountPlugin::log('All entry counts reset.');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2016-12-04T08:23:09.927" LastActivityDate="2016-12-04T08:23:09.927" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17849" PostTypeId="1" CreationDate="2016-11-22T14:28:56.500" Score="0" ViewCount="259" Body="&lt;p&gt;I have a Unix timestamp in my feed (1457685095000) and I am trying to map it to the date created entry field and I have another that I am trying to map to a time input field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The created date is setting the date to a wildly incorrect value and the time field isn't getting set at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2279" LastActivityDate="2016-11-22T23:32:42.930" Title="Importing Unix timestamp into date time field" Tags="&lt;datetime&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17851" PostTypeId="1" AcceptedAnswerId="17853" CreationDate="2016-11-22T16:05:06.253" Score="3" ViewCount="887" Body="&lt;p&gt;This won't work in a template:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entry = craft.entries.id(43) %}&amp;lt;h1&amp;gt;Titel: {{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this does:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.id(43) %}&amp;lt;h1&amp;gt;Titel: {{ entry.title }}&amp;lt;/h1&amp;gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it really necessary to use the for loop? I tried to use set because I'd like to over rule the entry variable for the whole template that I'm using if a specific url is visited&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if craft.request.segment(2)==&quot;openings-en-trainingstijden&quot; %} {% set entry = craft.entries.id(43) %}{% endif %} {{ entry.title }} etc..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another example this code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry1 in craft.entries.id(43) %}Titel: {{ entry1.title }}{% endfor %}&#xA;{% set entry2 = craft.entries.id(43) %}Titel: {{ entry2.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;Titel: Openings- en trainingstijden&#xA;Titel:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="3951" LastEditDate="2017-11-08T20:12:35.623" LastActivityDate="2017-11-08T20:12:35.623" Title="How do I set a specific entry in a template with &quot;set&quot;" Tags="&lt;entries&gt;&lt;set&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17852" PostTypeId="2" ParentId="17851" CreationDate="2016-11-22T16:15:42.387" Score="1" Body="&lt;p&gt;Your first line must work. But there is a typo with double &lt;code&gt;))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(43).first() %}&#xA;&#xA;{{ entry.title}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But normally when you add a template for a specific single you doesn't have to set the entry.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="344" LastEditDate="2016-11-25T13:29:06.137" LastActivityDate="2016-11-25T13:29:06.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17853" PostTypeId="2" ParentId="17851" CreationDate="2016-11-22T16:22:58.887" Score="5" Body="&lt;p&gt;You need to add &lt;code&gt;.first&lt;/code&gt; where you are setting the &lt;code&gt;entry&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entry = craft.entries.id(43).first %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you can avoid doing a for loop.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-11-22T16:22:58.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17854" PostTypeId="2" ParentId="492" CreationDate="2016-11-22T16:25:03.630" Score="2" Body="&lt;p&gt;I had the same issue but I had to update the settings in Plesk, as rules being set elsewhere were being ignored. Someone may have a similar set up to me, and this will save them a few minutes of head-bashing.&lt;/p&gt;&#xA;" OwnerUserId="4168" LastActivityDate="2016-11-22T16:25:03.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17856" PostTypeId="1" CreationDate="2016-11-22T18:02:07.360" Score="1" ViewCount="849" Body="&lt;p&gt;I'm very new to Craft and am having some trouble creating an image carousel from a Super Table. I created a Matrix field called 'rotator' it has one field called 'rotatorContents' which is a Super Table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GXPjk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GXPjk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S0E1l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S0E1l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rotatorContents has 3 fields: slide image, slide description, and slide title. I'm using a for loop to loop through the rows of the Super Table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if module.type == &quot;rotator&quot; %}&#xA;    {% for row in module.rotatorContents %}&#xA;        {% set slide = row.slideImage.first() %}&#xA;        &amp;lt;div class=&quot;rotator&quot;&amp;gt; &#xA;       &amp;lt;div class=&quot;rotator__item&quot;&amp;gt;&#xA;          &amp;lt;img src=&quot;{{ slideImage.first().url}}&quot; alt=&quot;slideImage.title&quot;&amp;gt;&#xA;       &amp;lt;/div&amp;gt;&#xA;       &amp;lt;div class=&quot;switcher&quot;&amp;gt;&#xA;       &amp;lt;span class=&quot;previous&quot;&amp;gt;&#xA;       &amp;lt;a href=&quot;{{ need prev slide link here}}&quot;&amp;gt; ‹&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/span&amp;gt;&#xA;     &amp;lt;span class=&quot;previous__title&quot;&amp;gt;&#xA;     {{need prev slide title here}}&#xA;    &amp;lt;/span&amp;gt;&#xA;&amp;lt;div class=&quot;divider&quot;&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;span class=&quot;content&quot;&amp;gt;&#xA;    {% set title = row.slideTitle.first() %}&#xA;    {% set description = row.slideDescription.first() %}&#xA;    &amp;lt;p&amp;gt;{{ title }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ description }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;/span&amp;gt;&#xA;&amp;lt;span class=&quot;next&quot;&amp;gt;&#xA;      &amp;lt;a href=&quot;{{need link to next slide here}}&quot;&amp;gt; ›&amp;lt;/a&amp;gt;&#xA;&amp;lt;/span&amp;gt;&#xA; &amp;lt;span class=&quot;previous__title&quot;&amp;gt;&#xA;     {{need prev slide title here}}&#xA;  &amp;lt;/span&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA; {% endfor %}&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see from the code above I am not sure how to reference the previous row in the Super Table. From a user standpoint they can input as many slides as they like. So at any given time there should be an active slide that is displayed and arrows linking to the previous slide and next slide. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about fetching the slide that's before the active slide and the slide that's after the active slide? Or in other terms getting the previous row and the next row after the current one in the Super Table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I'm sure there are also some other things I'm referring to wrong since this is my first time using Super Table, such as my usage of .first(). &lt;/p&gt;&#xA;" OwnerUserId="5919" LastEditorUserId="22" LastEditDate="2017-05-09T20:45:33.853" LastActivityDate="2017-05-09T20:45:33.853" Title="How to use Super Table to create an Image Carousel?" Tags="&lt;templating&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17857" PostTypeId="2" ParentId="17856" CreationDate="2016-11-22T19:07:39.217" Score="2" Body="&lt;p&gt;Welcome to Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it essential that you use SuperTable for this? The behavior you are describing is exactly what Matrix fields are designed to do, so you could quite easily achieve this without using SuperTable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at this screenshot; this is how I would set up my matrix field to allow me to content manage a slider (using the field names in your example):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RRbJf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RRbJf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that screenshot is easy to follow. This also means the markup is much easier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Check if the &quot;Rotator&quot; matrix field has any content #}&#xA;{% if entry.rotator %}&#xA;  &amp;lt;div class=&quot;slider-wrapper&quot;&amp;gt;&#xA;&#xA;    {# For each slide, do this #}&#xA;    {% for slide in entry.rotator %}&#xA;      &amp;lt;h2&amp;gt;{{ slide.rotatorTitle }}&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ slide.rotatorDescription }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just a quick markup example to get you started. Take a look through the Craft Docs for &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;using matrix fiels&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to answer your question, I'd recommend checking out &lt;a href=&quot;http://bxslider.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;BXSlider&lt;/a&gt;. The markup is very simple and easy to integrate with Craft/Twig. It's what I use myself and I love it. It will just build a simple next/previous slider for you.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2016-11-22T19:07:39.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17858" PostTypeId="2" ParentId="17844" CreationDate="2016-11-22T19:37:29.427" Score="6" Body="&lt;p&gt;Click on USD under Commerce-&gt;Settings-&gt;Payment Currencies and change the dropdown from USD to EUR.  That will become Commerce's new base/primary currency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you also want to support USD, you can add it as a second currency now and setup a conversion rate.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-22T19:37:29.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17859" PostTypeId="1" CreationDate="2016-11-22T19:46:18.543" Score="1" ViewCount="301" Body="&lt;p&gt;Is there a way to modify a variant's price based on a custom field in the product? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, Let's say I have a matrix field with a block that has a text input with the handle &lt;code&gt;name&lt;/code&gt; and a numeric input field with the handle &lt;code&gt;price&lt;/code&gt;. This is then outputs as a radio button select list in the template like &quot;Original&quot; and &quot;Name&quot;. When the &quot;Name&quot; radio button is selected, the price is picked up from the field &lt;code&gt;price&lt;/code&gt; in that matrix block. The user could then add to cart with the modified price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to do this without plugins, or is there a plugin available for this logic? I'm not PHP savvy, so any light that can be shed on this is much appreciated. Ideally there's a way to do this within the template.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2016-11-23T06:22:25.693" Title="Modify/add to price based on custom field?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17860" PostTypeId="2" ParentId="17847" CreationDate="2016-11-22T21:55:57.400" Score="2" Body="&lt;p&gt;At the moment there is no Commerce variants field type unfortunately.   It comes up a lot, someone should post it here: &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit - I've gone ahead and posted this here - &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime yes a text or eg table field could store variant IDs...which I suppose is ultimately what a proper field type would do basically.  &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2018-03-28T23:26:16.137" LastActivityDate="2018-03-28T23:26:16.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17861" PostTypeId="1" CreationDate="2016-11-22T22:30:27.507" Score="1" ViewCount="198" Body="&lt;p&gt;I'm trying to pull in the contents of a matrixField block and merge it with some default info — &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set interviews = craft.entries.section('interviews') %}&#xA;&#xA;{% for interview in interviews %}&#xA;&#xA;    {% set blocks = interview.thumb %}&#xA;    {% for block in blocks %}&#xA;&#xA;        {% set options = block|merge({&#xA;            'class': 'episode',&#xA;            'more': 'Listen to this interview...',&#xA;            'slug': craft.request.firstSegment,&#xA;            'linkUrl': interview.url,&#xA;        }) %}&#xA;&#xA;        {% include '_includes/blocks/half-block.html' with { options: options } %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error: &lt;code&gt;Key &quot;body&quot; for array with keys &quot;id, enabled, archived, locale, localeEnabled, slug, uri, dateCreated, dateUpdated, root, lft, rgt, level, searchScore, fieldId, ownerId, ownerLocale, typeId, sortOrder, collapsed, class, more, reverse, linkUrl&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why am I getting &lt;code&gt;block&lt;/code&gt; with the values of the entry instead of that single block of type &lt;code&gt;thumb&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(where &lt;code&gt;thumb&lt;/code&gt; has a field called &lt;code&gt;body&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had tried &lt;code&gt;{% set block = interview.thumb.first() %}&lt;/code&gt; instead of &lt;code&gt;{% set blocks = interview.thumb %}{% for block in blocks %}&lt;/code&gt; but was trying to be more explicit to see if it made a difference.&lt;/p&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="57" LastEditDate="2016-11-23T16:20:56.190" LastActivityDate="2016-11-23T16:20:56.190" Title="Merging options to pass with an include" Tags="&lt;matrix&gt;&lt;include&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17862" PostTypeId="2" ParentId="17849" CreationDate="2016-11-22T23:32:42.930" Score="1" Body="&lt;p&gt;According to the documentation for the &lt;a href=&quot;http://sgroup.com.au/plugins/feedme/importing-content/field-types#date-time&quot; rel=&quot;nofollow noreferrer&quot;&gt;Date field&lt;/a&gt;, Feed Me uses &lt;a href=&quot;http://php.net/manual/en/function.date-parse.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;date_parse&lt;/a&gt; to parse a provided date string into a proper date object. &lt;code&gt;date_parse&lt;/code&gt; uses &lt;code&gt;strtotime&lt;/code&gt; underneath, which seems to have issues with timestamps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wanted to confirm your timestamp though, as it seems to not produce the correct date for me using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo date('Y-m-d H:i:s', 1457685095000);&#xA;&#xA;// Results in&#xA;48162-03-15 06:23:20&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-11-22T23:32:42.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17863" PostTypeId="1" AcceptedAnswerId="17873" CreationDate="2016-11-22T23:35:54.237" Score="3" ViewCount="454" Body="&lt;p&gt;I have a couple of imminent projects that will need some type of multi-site support. One is a large project that will need to share data between at least 3 sites. Where data is entered in one site and displayed on all. I've setup many sites in EE with MSM so I'm familiar with that method but never done this with Craft. I have read a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10403/multi-site-multi-domain&quot;&gt;few articles&lt;/a&gt; about how to set this up using the local function and modifying core files. I've also read about how this will be &lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;built into Craft 3&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is - what route would any of you recommend taking? If I use the locale method will that the work be invalidated when Craft 3 comes out? Or is it advisable to go with the Craft 3 alpha hoping it's stable enough for production? I'm not sure when it will be released or if plugins will be compatible.  &lt;/p&gt;&#xA;" OwnerUserId="877" LastEditorUserId="5437" LastEditDate="2017-06-15T06:27:52.343" LastActivityDate="2017-06-15T20:57:08.117" Title="Multi sites: should I use Craft 2 locales, or go with Craft 3 alpha?" Tags="&lt;multi-domain&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17864" PostTypeId="2" ParentId="17861" CreationDate="2016-11-23T00:03:44.750" Score="2" Body="&lt;p&gt;I suspect this isn't so much a problem with the strategy as the implementation of the &lt;code&gt;MatrixBlockModel&lt;/code&gt;, which is the object type you're trying to merge with a standard Twig &quot;object&quot; or associative array (not sure exactly what Twig uses, behind the scenes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to provide some defaults for various Matrix fields, those ought to be set within the fields, individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, I think the solution you need is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# ... #}&#xA;{% set blocks = entry.matrixBlockField %}&#xA;{% for block in blocks %}&#xA;&#xA;  {% set options = {&#xA;    'class': 'episode',&#xA;    'more': 'Listen to this interview...',&#xA;    'slug': craft.request.firstSegment,&#xA;    'linkUrl': interview.url&#xA;  } %}&#xA;&#xA;  {% include '_includes/blocks/half-block.html' with {&#xA;    options: options,&#xA;    data: block&#xA;  } %}&#xA;{% endfor %}&#xA;{# ... #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your partial, you have a bit more work ahead of you, but the special behavior of Twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;ternary operator&lt;/a&gt; should help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ data.field ?: options.fallbackField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I may be misunderstanding the problem, though— is there something about fetching the &lt;code&gt;MatrixBlockModel&lt;/code&gt; elements that appears to be going wrong? As a general rule, I try and avoid using any Twig/Craft reserved words/terms for variable names, but I don't think that's the root of the problem here…&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2016-11-23T00:03:44.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17865" PostTypeId="1" CreationDate="2016-11-23T04:24:45.770" Score="1" ViewCount="295" Body="&lt;p&gt;I've set up a shipping method/zone purely for testing but it doesn't show up during checkout. :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a shipping zone only for the state of Oregon:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PQ28o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PQ28o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for the shipping method there's just ONE rule with the ONLY condition being that the shipping zone is Oregon:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/79FOc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/79FOc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I have for the shipping page of the checkout process:&#xA;&lt;a href=&quot;http://d.pr/n/fizP&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://d.pr/n/fizP&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, when I go through the checkout process, I make sure that my shipping address uses Oregon as the state. I've confirmed this by using this on the shipping page (not seen in the code above): &lt;code&gt;{{ cart.shippingAddress.state }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing??&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2016-11-29T04:00:29.463" Title="Shipping Method option not showing" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17866" PostTypeId="2" ParentId="17859" CreationDate="2016-11-23T06:22:25.693" Score="1" Body="&lt;p&gt;You could simply use variants to handle this couldn't you?  A non-name and named variant, each with a different price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no other built in way to do what you want without PHP, I think.  The PHP would not be too complex though, if you fancy adventuring into Craft plugins, which are super-useful with Commerce in general, opening up all sorts of extra possibilities.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-23T06:22:25.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17867" PostTypeId="2" ParentId="11219" CreationDate="2016-11-23T06:35:00.403" Score="5" Body="&lt;p&gt;I finally found the answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/BaseElementType#defineAvailableTableAttributes-detail&quot;&gt;BaseElementType defineAvailableTableAttributes() docs&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;em&gt;first&lt;/em&gt; item that this array returns will just identify the database&#xA;  column name, and the table column’s header, but will not have any&#xA;  effect on what shows up in the table’s body. That’s because the first&#xA;  column is reserved for displaying whatever your element model’s&#xA;  &lt;em&gt;__toString()&lt;/em&gt; method returns (the string representation of the element).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So all you need to do is add a &lt;em&gt;__toString()&lt;/em&gt; method in your model and return the string representation of your element:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __toString()&#xA;{&#xA;   return $this-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vf1DD.png&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vf1DD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2016-11-23T06:35:00.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17868" PostTypeId="1" AcceptedAnswerId="17869" CreationDate="2016-11-23T08:54:23.053" Score="1" ViewCount="151" Body="&lt;p&gt;Is there a way to get the tax and discount percentage when applicable?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2016-11-23T09:54:25.470" Title="Is there a way to print the tax and discount percentages?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17869" PostTypeId="2" ParentId="17868" CreationDate="2016-11-23T09:54:25.470" Score="2" Body="&lt;p&gt;See my answer here for discount percentages:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17471/how-can-i-display-the-discount-value-onsale-of-products&quot;&gt;How can I display the Discount Value onSale of Products&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For tax, I think there answer is actually currently the same, I don't &lt;em&gt;think&lt;/em&gt; you can currently retrieve tax rates in templates as such (you can get tax categories models, but not, it seems, the rate models.  So again, twig maths might be your best bet here.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-11-23T09:54:25.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17870" PostTypeId="1" CreationDate="2016-11-23T12:53:28.413" Score="0" ViewCount="92" Body="&lt;p&gt;I just upgraded to the latest version of Craft.  I can login and create a new entry, but then it hangs when I try to save it.  I can't even stop and go back to the entries panel.  I have to exit out of Safari or Chrome and go back in.  Sometimes it has saved the entry and other times it has not.  There are no error or pop of notification of any sort.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And by hang - I mean seizes up and freezes for about 5-10 minutes ...and sometimes creates a duplicate entry.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2016-11-23T18:17:49.847" LastActivityDate="2017-01-22T21:10:10.877" Title="Why is Craft hanging every time I try to save an entry?" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17871" PostTypeId="1" AcceptedAnswerId="17886" CreationDate="2016-11-23T13:05:22.937" Score="1" ViewCount="72" Body="&lt;p&gt;I am making a custom store that can sell half pounds of items. I've noticed through sending calls through my plugin to the &lt;code&gt;craft()-&amp;gt;commerce_cart-&amp;gt;addToCart($cart, $itemNumber, $qty);&lt;/code&gt; to add an item to an order while specifying a non-integer quantity gives me the error: &lt;strong&gt;&quot;Qty must be an integer&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to allow quantity to be a non-integer? Customers will be ordering in .5 pound increments occasionally. I am not anemic to plugin development and php so I thought I'd ask the community if there was a way around this, or if I'm stuck with Qty being an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couple other options I've though of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Make a custom field to deal with qty&lt;/li&gt;&#xA;&lt;li&gt;Split my items into .5 increments so someone adding 5.5 lbs would really be adding qty 11 and there'd be special things going on with the admin and front-end to hide that fact&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5750" LastActivityDate="2016-11-23T21:57:33.137" Title="Non Integer Quantities in Craft Commerce" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17872" PostTypeId="1" AcceptedAnswerId="17875" CreationDate="2016-11-23T13:09:49.833" Score="3" ViewCount="176" Body="&lt;p&gt;I'm currently implementing a search function on a website based on craft, and I was wondering if there was a way of actually showing a small snippet of text that shows in what context the search actually matched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment the result simply returns the corresponding &lt;code&gt;{{entry.title}}&lt;/code&gt;, however I would like the result to also display something like &lt;code&gt;[...] a chain of mountains with the highest *peak* being around x-thousand metres [...]&lt;/code&gt; when 'peak' was the search term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve this within Craft?&#xA;thanks&lt;/p&gt;&#xA;" OwnerUserId="5798" LastActivityDate="2016-11-23T14:54:39.423" Title="Show context of match in search result" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17873" PostTypeId="2" ParentId="17863" CreationDate="2016-11-23T13:35:43.977" Score="2" Body="&lt;p&gt;Brandon has stated (on the CraftCMS Slack channel, so, sadly, not easily linkable here) that custom locales will automatically translate to sites when upgrading from Craft 2 to Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, Craft 3 is still in developer preview and not recommended for production sites, so I would recommend developing in Craft 2 and updating when a stable, final version of Craft 3 is released, along with any compatible versions of plugins that you need for the site(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the changes in Craft 3 (many of which are still in flux) plugins will need to be re-written to be compatible with it. Depending on the developer and the complexity of the plugin, this may take some time.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2016-11-23T13:35:43.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17875" PostTypeId="2" ParentId="17872" CreationDate="2016-11-23T14:54:39.423" Score="2" Body="&lt;p&gt;Yes, there is. There is a plugin called Weighted Search which I have used a few times which does exactly that. &lt;a href=&quot;https://straightupcraft.com/craft-plugins/weighted-search&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/weighted-search&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4168" LastActivityDate="2016-11-23T14:54:39.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17876" PostTypeId="1" CreationDate="2016-11-23T17:35:53.437" Score="2" ViewCount="391" Body="&lt;p&gt;I'm trying to render a template from a console command, but i'm getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\ConsoleApp and its behaviors do not have a method or closure named &quot;getTheme&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionIndexTemplate ($id = null)&#xA;{&#xA;    $criteria          = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'products';&#xA;    $criteria-&amp;gt;limit   = 1;&#xA;    $criteria-&amp;gt;id      = $id;&#xA;    $entry             = $criteria-&amp;gt;first();&#xA;&#xA;    if ( $entry ) {&#xA;        $output = craft()-&amp;gt;templates-&amp;gt;render('indexer/Product', [&#xA;            'element' =&amp;gt; $entry&#xA;        ]);&#xA;        $data       = json_decode($output, $assoc = true);&#xA;    }&#xA;    else {&#xA;        echo &quot;No entry found\n&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CException: Craft\ConsoleApp and its behaviors do not have a method or closure named &quot;getTheme&quot;. in /craft/app/framework/base/CComponent.php:266&#xA;Stack trace:&#xA;#0 /craft/app/framework/base/CErrorHandler.php(390): CComponent-&amp;gt;__call('getTheme', Array)&#xA;#1 /craft/app/framework/base/CErrorHandler.php(340): CErrorHandler-&amp;gt;getViewFile('exception', 500)&#xA;#2 /craft/app/etc/errors/ErrorHandler.php(233): CErrorHandler-&amp;gt;render('exception', Array)&#xA;#3 /craft/app/etc/errors/ErrorHandler.php(137): Craft\ErrorHandler-&amp;gt;handleTwigError(Object(Craft\TemplateLoaderException))&#xA;#4 /craft/app/framework/base/CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\TemplateLoaderException))&#xA;#5 /craft/app/framework/base/CApplication.php(750): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#6 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\TemplateLoaderException))&#xA;#7 {main}%&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the underlying error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/11/23 18:15:13 [error] [exception.Craft\TemplateLoaderException] Craft\TemplateLoaderException: Ikke i stand til å finne malen “indexer/Product”. in /craft/app/etc/templating/twigextensions/TemplateLoader.php:123&#xA;Stack trace:&#xA;#0 /craft/app/etc/templating/twigextensions/TemplateLoader.php(71): Craft\TemplateLoader-&amp;gt;_findTemplate('indexer/P...')&#xA;#1 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(312): Craft\TemplateLoader-&amp;gt;getCacheKey('indexer/P...')&#xA;#2 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(378): Twig_Environment-&amp;gt;getTemplateClass('indexer/P...', NULL)&#xA;#3 /craft/app/etc/templating/TwigEnvironment.php(61): Twig_Environment-&amp;gt;loadTemplate('indexer/P...', NULL)&#xA;#4 /craft/app/vendor/twig/twig/lib/Twig/Environment.php(347): Craft\TwigEnvironment-&amp;gt;loadTemplate('indexer/P...')&#xA;#5 /craft/app/services/TemplatesService.php(253): Twig_Environment-&amp;gt;render('indexer/P...', Array)&#xA;#6 /craft/plugins/indexer/services/Indexer_IndexService.php(136): Craft\TemplatesService-&amp;gt;render('indexer/P...', Array)&#xA;#7 /craft/plugins/indexer/consolecommands/IndexerCommand.php(93): Craft\Indexer_IndexService-&amp;gt;renderTemplate(Array)&#xA;#8 [internal function]: Craft\IndexerCommand-&amp;gt;actionIndexTemplate('35262')&#xA;#9 /craft/app/framework/console/CConsoleCommand.php(172): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\IndexerCommand), Array)&#xA;#10 /craft/app/framework/console/CConsoleCommandRunner.php(71): CConsoleCommand-&amp;gt;run(Array)&#xA;#11 /craft/app/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner-&amp;gt;run(Array)&#xA;#12 /craft/app/framework/base/CApplication.php(185): CConsoleApplication-&amp;gt;processRequest()&#xA;#13 /craft/app/etc/console/yiic.php(81): CApplication-&amp;gt;run()&#xA;#14 /craft/app/etc/console/yiic(4): require_once('/Ind...')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2016-11-23T19:27:10.560" LastActivityDate="2016-11-23T19:27:10.560" Title="Craft\ConsoleApp and its behaviors do not have a method or closure named &quot;getTheme&quot;" Tags="&lt;templating&gt;&lt;console&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17877" PostTypeId="1" CreationDate="2016-11-23T18:37:55.957" Score="0" ViewCount="320" Body="&lt;p&gt;In my controller, I can add new users when a user with the right privileges is logged in via &lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser()&lt;/code&gt;, but this doesn't work when no user is logged in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &quot;users/saveUser&quot; the only service method I can use? I would prefer to be able to use my custom one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;code below works fine when I'm logged in as an admin user, otherwise it redirects me to login form, after form submission. Have I missed something in here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionAddPartner() &#xA;{&#xA;        $content = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;        $companyId = explode(&quot;@&quot;, $content['email']);&#xA;        $user = new UserModel();&#xA;        $user-&amp;gt;username         = $content['email'];&#xA;        $user-&amp;gt;email            = $content['email'];&#xA;        $user-&amp;gt;unverifiedEmail  = $content['email'];&#xA;        $user-&amp;gt;firstName        = $content['firstName'];&#xA;        $user-&amp;gt;lastName         = $content['lastName'];&#xA;        $user-&amp;gt;pending          = true;&#xA;        $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;        if ($success) {&#xA;            // Assign them to the Partner Admin user group&#xA;            craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, 1);&#xA;            // Update the Element Index&#xA;            craft()-&amp;gt;search-&amp;gt;indexElementAttributes($user);&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2016-11-23T21:46:53.933" LastActivityDate="2016-11-23T21:47:05.450" Title="Is there a way to programatically add a user when no one is logged in" Tags="&lt;plugin-development&gt;&lt;usermodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17880" PostTypeId="2" ParentId="17870" CreationDate="2016-11-23T19:52:29.810" Score="1" Body="&lt;p&gt;The problem appears to be Intego anti-virus software on my one machine.  The problem does not appear on computers that lack Intego.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-11-23T19:52:29.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17881" PostTypeId="2" ParentId="17877" CreationDate="2016-11-23T19:52:55.097" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UsersService.php#L240&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;UsersService-&amp;gt;saveUser()&lt;/code&gt;&lt;/a&gt; (at &lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser()&lt;/code&gt;) doesn't do any sort of permissions checking or authentication checks because it assumes that all of that has been performed at the controller level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll find this similar interactions between controllers and services elsewhere in Craft as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you're hitting some sort of validation error when trying to save a user with an authenticated session.  Try checking the output of &lt;code&gt;$user-&amp;gt;getErrors()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, of course, in your plugin write your own service method that saves a user in a method that differs from Craft's implementation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-23T19:52:55.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17882" PostTypeId="1" CreationDate="2016-11-23T19:59:10.483" Score="0" ViewCount="157" Body="&lt;p&gt;I have search working on my local .dev site.   It does not work on my live hosted site.  There are no error messages; it just reloads the home page.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the search code in my site template.  The results code is below...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;menu-item-search&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;search.html&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-search&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;form method=&quot;get&quot; id=&quot;site-searchform&quot; class=&quot;searchform&quot; action=&quot;{{ url('search/results')}}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; autocomplete=&quot;off&quot; placeholder=&quot;Search&amp;amp;hellip;&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results page...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;main id=&quot;content&quot; class=&quot;cointainer container-masonry&quot; role=&quot;main&quot;&amp;gt; &#xA;    &amp;lt;div id=&quot;grid-fix&quot; class=&quot;container&quot;&amp;gt;&#xA;&#xA;        {% if entries|length %}     &#xA;            {% for post in entries %}&#xA;                &amp;lt;div class=&quot;box col-sm-3&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;post-box vertical clearfix&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;extra-info&quot;&amp;gt;                &#xA;                            &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;{{ post.url }}&quot;&amp;gt;{{ post.title}}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;                            &amp;lt;p class=&quot;meta small&quot;&amp;gt;{{ post.postDate | date('F d, Y') }} &amp;lt;a href=&quot;#&quot;&amp;gt;Name&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt; &#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}    &#xA;        {% else %}&#xA;            &amp;lt;p&amp;gt;You search for &quot;{{ query }}&quot; didn't retun any results&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/main&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2016-11-23T20:09:59.837" LastActivityDate="2016-11-23T20:09:59.837" Title="Why isn't search working on the live page?" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17883" PostTypeId="2" ParentId="17840" CreationDate="2016-11-23T21:11:48.187" Score="1" Body="&lt;p&gt;Issue was not RTFM. :) Basically I didn't include &lt;a href=&quot;https://stripe.com/docs/custom-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;every part of the stripe.js setup&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2016-11-23T21:11:48.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17884" PostTypeId="1" CreationDate="2016-11-23T21:26:44.763" Score="2" ViewCount="746" Body="&lt;p&gt;Is it possible to have a Structure section ordered by date (desc) as a default and then take the custom ordering in the CP into account?&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2016-11-24T00:00:17.430" Title="Order/sort a structure section by date too?" Tags="&lt;structure&gt;&lt;sections&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17885" PostTypeId="2" ParentId="17877" CreationDate="2016-11-23T21:45:50.423" Score="2" Body="&lt;p&gt;Oh well, totally forgot to allow anonymous access at the top of the controller.&#xA;I guess I can leave this answer here in case somebody is as forgetful as me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="57" LastEditDate="2016-11-23T21:47:05.450" LastActivityDate="2016-11-23T21:47:05.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17886" PostTypeId="2" ParentId="17871" CreationDate="2016-11-23T21:57:33.137" Score="1" Body="&lt;p&gt;Given how much of Commerce internally will be relying on whole number quantities, I think option 2 is the far better plan. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't add custom fields to line items currently, and while you might be able to hack something using the options/notes systems, or custom order fields on the order as a whole, I'd think this would get complex to maintain quickly. Best to use your minimum selling measure as the unit and dress it up front end.... that should work well and will be substantially easier to implement and (importantly) maintain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With stores, even more than websites, long term ease of understanding and maintenance should be a high priority goal. &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-23T21:57:33.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17887" PostTypeId="2" ParentId="16519" CreationDate="2016-11-23T22:53:22.587" Score="5" Body="&lt;p&gt;I've used a relatively simple plugin to listen to &lt;code&gt;commerce_cart.onBeforeAddToCart&lt;/code&gt;which checks what is being added to a cart and if it is a certain item it will automatically add the free item to the cart (or increment the qty if it's already in there).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Of course you must then also listen to &lt;code&gt;commerce_cart.onRemoveFromCart&lt;/code&gt; to remove the free item if the 'parent' item is removed...as I recall this is slightly trickier as you get a copy of the order with the item removed (there's no &lt;code&gt;beforeRemoveFromCart&lt;/code&gt; yet) - so you jsut have to loop over the whole cart and look at it holistically).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&quot; rel=&quot;noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&lt;/a&gt; &#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart&quot; rel=&quot;noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In general a business logic plugin can implement most discount things fairly easily but I am hoping a really nice, flexible GUI driven discounts plugin thingy comes along for Commerce!).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-23T22:53:22.587" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17888" PostTypeId="2" ParentId="12612" CreationDate="2016-11-23T23:12:54.130" Score="3" Body="&lt;p&gt;I'll go ahead and add this as an answer with a bit more detial....we have a large number of variants in total - about 50 different box sizes for about 110 types of product (each product has ~ 10 sizes associated with it).  In addition, we do services and there are about 50 variants there, for each of about 12 products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all, the simplest solution if things are relatively static is a bit of data entry...people, in my experience, worry far too much about programmatically generating things that then become hard to maintain (ecommerce tends to have al ot of exceptions and unusual scenarios and programmatic things soon get out of hand) - sometimes a tedious hour or two of data entry is actually a much more effective long term solution to the problem.  (And they invented student/interns for this right?!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, Craft's excellent relations system can help &lt;em&gt;a lot&lt;/em&gt; here - if your variation sizes are standard things, you can create a section to store your 'standard boxes' or 'standard variants' or whatever, and then relate these to your variants using an entries field on your variants for that product type.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in your templates and/or shipping plugin etc, you simply refer to these standardised entries - rather than the variant itself - to get the data you need for your width, height, depth, and weight.  This can dramatically reduce your data entry work and keep things MUCH more DRY - there's one standardised place to add/change/remove data for your variants.  It's very effective...but it does mean you do need to have your own shipping plugin as you're sort of over-ruling Commerce's default behaviour here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(One great thing Commerce could do to help and avoid the need for a plugin here would be to make it an option to specify a bit of twig for these standard fields so you could do things like specify a default value for height of  &lt;code&gt;{standardBox.first().height}&lt;/code&gt; -  where &lt;code&gt;standardBox&lt;/code&gt; is a field on the variant and that would then be parsed into the product when it is saved...)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-11-23T23:12:54.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17889" PostTypeId="2" ParentId="17884" CreationDate="2016-11-24T00:00:17.430" Score="4" Body="&lt;p&gt;This should work &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'news',&#xA;    sortOrder: 'postDate desc, lft asc',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-24T00:00:17.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17890" PostTypeId="1" AcceptedAnswerId="17891" CreationDate="2016-11-24T12:05:20.103" Score="2" ViewCount="208" Body="&lt;p&gt;I've been here before &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14796/users-allocating-permissions-beyond-their-own&quot;&gt;Users allocating permissions beyond their own&lt;/a&gt; and the only solution offered was to &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/12285582-users-with-the-assign-user-groups-and-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;vote for it as a feature request&lt;/a&gt;, which I did. But after 7 months there have only been 10 votes for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't understand how so few people find this a problem.&#xA;You need to give someone the ability to add users and put them in a suitable user group, but you then give them a free pass to increase their own access permissions and potentially reduce the access permissions for me the prime admin, this can't be acceptable for any user management system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to have an administrator role that can register users and put them into suitable groups, but not let that person manage the permissions for themselves or others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most obvious option is to separate &quot;assign user groups&quot; from &quot;assign user groups and permissions&quot;&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="22" LastEditDate="2017-05-09T22:33:41.853" LastActivityDate="2017-12-14T09:48:39.027" Title="How can I separate assign user groups and permissions for users?" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17891" PostTypeId="2" ParentId="17890" CreationDate="2016-11-24T12:22:29.370" Score="2" Body="&lt;p&gt;Non-admin users cannot change permissions for Admin users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I agree with what you've said on users being able to assign groups and permissions. On practically every site I build, I need the client to be able to assign users to the groups &lt;strong&gt;that I created&lt;/strong&gt;, but not be able to change a new user's permissions manually. This should definitely be separated in to two different options in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: In &lt;a href=&quot;https://craftcms.com/changelog#2-6-2996&quot; rel=&quot;nofollow noreferrer&quot;&gt;2.6.2996&lt;/a&gt; Craft added this functionality:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The “Assign user groups and permissions” permission has now been&#xA;split into “Assign user permissions” and “Assign user groups”, and&#xA;the latter now has nested permissions for each of the user groups.&lt;/li&gt;&#xA;&lt;li&gt;Users with the “Assign user permissions” permission are no longer&#xA;allowed to grant new permissions to user accounts that they&#xA;themselves don’t already have.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2017-12-14T09:48:39.027" LastActivityDate="2017-12-14T09:48:39.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17892" PostTypeId="2" ParentId="16909" CreationDate="2016-11-24T14:03:45.480" Score="1" Body="&lt;p&gt;I've also been struggling with this a lot. I get why you have to have an address defined in order to process the shipping rules, but the lack of defaults is maddening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client's checkout process is very lean - ideally one page. There are no user accounts, no shipping method choice (it's enforced by cart contents and address) and no payment method choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a challenge to get Commerce to work that way without submitting hidden form fields etc. It was also important to me to show at least an informed estimate of shipping on the cart page (I fear abandoned carts otherwise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've explored similar options to Jeremy but in my case I found using an Adjuster by far the easier path (at least for solving shipping cost display).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My adjuster closely resembles the &lt;a href=&quot;https://craftcommerce.com/docs/adjusters#example&quot; rel=&quot;nofollow noreferrer&quot;&gt;example from the docs&lt;/a&gt;. It simply iterates the cart contents and adds to &lt;code&gt;$order-&amp;gt;baseShippingCost&lt;/code&gt; based on my default country rules. (This is custom code shared with my Shipping Rules). The adjuster takes no action if &lt;code&gt;$order-&amp;gt;getShippingAddress()&lt;/code&gt; returns a value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my cart template I then have a &lt;code&gt;{% if cart.shippingAddress %}&lt;/code&gt; conditional and if it doesn't I present the &lt;code&gt;cart.totalShippingCost&lt;/code&gt; as an estimate. This works really nicely and I hope will prevent any nasty surprises for customers just before payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other problems to solve related to this were auto-completion of &lt;code&gt;shippingMethod&lt;/code&gt; and &lt;code&gt;paymentMethod&lt;/code&gt;. I've done this using the &lt;code&gt;onSaveOrder&lt;/code&gt; event to set the values if they are empty. You just need to watch this event as it can get into an infinite loop if you don't follow the &quot;out-the-box&quot; Craft checkout process (i.e. set loads of stuff at once).&lt;/p&gt;&#xA;" OwnerUserId="5794" LastActivityDate="2016-11-24T14:03:45.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17893" PostTypeId="1" AcceptedAnswerId="17894" CreationDate="2016-11-24T17:14:42.410" Score="2" ViewCount="239" Body="&lt;p&gt;Is there a possibility or plugin that I can see all my tags that I am using on my Craft page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that I can edit the tags when I, for example, wrote some tags wrong or just want to delete some and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the best.&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="57" LastEditDate="2016-11-24T17:23:11.897" LastActivityDate="2016-11-24T18:30:38.973" Title="Tag overview in the Craft backend" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17894" PostTypeId="2" ParentId="17893" CreationDate="2016-11-24T17:24:38.317" Score="3" Body="&lt;p&gt;There is a &lt;a href=&quot;https://github.com/boboldehampsink/tagmanager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tag Manager&lt;/a&gt; plugin you can use for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want to consider voting for &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/7179221-tag-management&quot; rel=&quot;nofollow noreferrer&quot;&gt;this feature request&lt;/a&gt; if you think this should be in core!&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-24T17:24:38.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17897" PostTypeId="2" ParentId="17722" CreationDate="2016-11-24T19:22:16.740" Score="2" Body="&lt;p&gt;I resolved this by upgrading my wampserver from ver 2.5 to 3.03. &lt;/p&gt;&#xA;" OwnerUserId="5885" LastActivityDate="2016-11-24T19:22:16.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17898" PostTypeId="1" CreationDate="2016-11-24T19:49:32.110" Score="0" ViewCount="479" Body="&lt;p&gt;I am building a navigation section which is a structure. The idea is that it is a flexible place to build links to other entries/ custom urls etc. It has one entry.type called page which has an entries Field called 'entryLink' to link to other entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has no urls of its own set in 'Entries in this section have their own URLs'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i try to get the entriesField called 'entryLink' all i can get is the title: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set navEntries = craft.entries.section('navigation').hidePage('&amp;lt; 1')  %}&#xA;   {% for nav in navEntries %}&#xA;     &amp;lt;p&amp;gt; {{ nav.entryLink.first() }}&amp;lt;/p&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If i try and get the slug or uri I always get an error. Eg when using :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set navEntries = craft.entries.section('navigation').hidePage('&amp;lt; 1')  %}&#xA;   {% for nav in navEntries %}&#xA;     &amp;lt;p&amp;gt; {{ nav.entryLink.first().uri }}&amp;lt;/p&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impossible to access an attribute (&quot;uri&quot;) on a null variable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&#xA;I notice the documentation here: &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/entries-fields&lt;/a&gt;&#xA;specifies 'target locale' which i do not have in my entrie field setup.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-11-25T16:57:26.920" LastActivityDate="2016-11-25T16:57:26.920" Title="Getting the URI of an Entries field in a Structure with no URLs" Tags="&lt;structure&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17899" PostTypeId="1" AcceptedAnswerId="17939" CreationDate="2016-11-25T09:19:51.437" Score="1" ViewCount="299" Body="&lt;p&gt;I'm trying to render my HTML, CSS, JavaScript with the use of template hooks from a plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook 'video.slider' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible? If it is, can you give some snippet?&lt;/p&gt;&#xA;" OwnerUserId="5675" LastEditorUserId="57" LastEditDate="2016-11-25T16:49:24.490" LastActivityDate="2016-11-29T04:04:11.433" Title="How to add HTML, CSS, JavaScript on the front-end using a template hook in a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17901" PostTypeId="2" ParentId="17898" CreationDate="2016-11-25T11:58:07.907" Score="1" Body="&lt;p&gt;So this is what worked for me. It's a bootstrap drop-down menu system using the nav tag from the structure 'menu' with custom fields as described above&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;nav navbar-nav navbar-right&quot;&amp;gt;&#xA;{% set menu = craft.entries.section('menu').hidePage('&amp;lt; 1') %}&#xA;{% set navlink = &quot;&quot; %}&#xA;&#xA;{% nav entry in menu %}&#xA;    {% if entry.entryLink.first|length %}&#xA;    {% set navlink = entry.entryLink.first.uri %}&#xA;    {% else %}&#xA;    {% set navlink = entry.customMenuUrl %}&#xA;    {% endif %}&#xA;&#xA;    {% if entry.level == 1 and entry.children|length %}&#xA;        &amp;lt;li class=&quot;dropdown&quot;&amp;gt;&#xA;            &amp;lt;a  href=&quot;{{ siteUrl }}{{ navlink}}&quot;  role=&quot;button&quot; data-hover=&quot;dropdown&quot; data-length=&quot;{{ entry.title|length }}&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&amp;gt;{{ entry.title }}&amp;lt;span class=&quot;caret&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;!-- get children --&amp;gt;&#xA;            &amp;lt;ul class=&quot;dropdown-menu&quot; &amp;gt;&#xA;                &amp;lt;!-- get children --&amp;gt;&#xA;                {% for child in entry.getDescendants().hidePage('&amp;lt; 1') %}&#xA;                {% if child.entryLink.first|length %}&#xA;&#xA;                &amp;lt;li&amp;gt; &amp;lt;a  href=&quot;{{ siteUrl }}{{  child.entryLink.first.uri }}&quot; class=&quot;{{ macros.isActiveChildClass(child.slug) | trim }} level{{ child.level }}&quot;&amp;gt;{{ child.entryLink.first.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% elseif entry.level == 1 and not entry.hasDescendants() %}&#xA;     &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}{{ navlink }}&quot; class=&quot;{{ macros.isParentMenuActive(entry.slug) |trim }} level{{ entry.level }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has managed to produce a bootstrap drop down menu from the nav tag on a structure section with two fields: customMenuUrl (plain text) and entryLink (Entries field)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-11-25T16:56:59.117" LastActivityDate="2016-11-25T16:56:59.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17902" PostTypeId="1" AcceptedAnswerId="17907" CreationDate="2016-11-25T16:39:48.267" Score="2" ViewCount="238" Body="&lt;p&gt;I am using the Craft Pro trial version and I want to use S3 for my Assets.  However, I enter my credentials but the refresh button does not show my bucket.  Also, when I try the refresh with wrong credentials it shows the error message but with correct it just doesn't show anything. I tried to connect to by bucket with other tools and was successful so this is why am thinking that is a restriction on the trial version of Pro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is it a Craft trial issue? Are you allowed to connect to S3 in trial version of Craft Pro?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2016-11-25T17:00:14.590" LastActivityDate="2016-11-26T08:31:46.137" Title="Can't find S3 bucket using Craft Pro in trial mode" Tags="&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17903" PostTypeId="2" ParentId="17902" CreationDate="2016-11-25T17:08:17.527" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So is it a Craft trial issue? Are you allowed to connect to S3 in trial version of Craft Pro?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.  There are no limitations when running Craft on a &lt;a href=&quot;https://craftcms.com/support/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;non-public&quot;&lt;/a&gt; domain in trial mode.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, I enter my credentials but the refresh button does not show my bucket.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Check your browser's console and see if it's logging any errors.  My guess is you'll see a 500 Internal Server Error and the underlying error message will be logged into &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-25T17:08:17.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17904" PostTypeId="1" AcceptedAnswerId="17962" CreationDate="2016-11-25T17:48:23.437" Score="2" ViewCount="151" Body="&lt;p&gt;I'm currently redoing a import mechanism for a site we've inherited.  I'm trying to use Feedme version 2 for this as opposed to the custom import script that was written (and is not working too well).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The import needs to be transferred via FTP with basic authentication.  I saw that version 1.4.7 included this FTP support and I'm wondering if that includes FTP with basic authentication and if that function is actually at all available in Feedme2&lt;/p&gt;&#xA;" OwnerUserId="397" LastActivityDate="2016-11-30T15:38:46.147" Title="Is FeedMe v2 supporting FTP with basic authentication" Tags="&lt;plugin-feedme&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17905" PostTypeId="1" CreationDate="2016-11-25T18:03:47.817" Score="1" ViewCount="98" Body="&lt;p&gt;We've got a client who would like to be able to create &quot;Child&quot; user accounts, the idea being that someone could register and then create multiple child accounts that would inherit the settings of their parent account. It would also mean that any entries created by those child accounts would be visible, and editable, by the parent account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current, and only, idea would be to have Parent / Children user relations fields on the users that I would read to work out what I should be displaying to or letting the current user do, but I have a feeling that this might prove cumbersome to manage down the line and messy to code &lt;sup&gt;&lt;sup&gt;&lt;sup&gt;at least the way I code&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a clean way of doing this, or perhaps a plugin that does this already (I've looked but couldn't find anything). I'm also open to writing a plugin that would do this, I just don't really know where to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will all be happening front-end, so no need to touch the control panel in any way.&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2016-11-28T09:37:56.440" Title="Parent / Child user accounts" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17906" PostTypeId="2" ParentId="17825" CreationDate="2016-11-26T03:18:54.083" Score="8" Body="&lt;p&gt;Usually when selling goods that come in different size and colors, a different SKU would exist for any size/color combination that you sell, thus a unique variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when that item becomes low in stock (&lt;code&gt;S&lt;/code&gt;tock &lt;code&gt;K&lt;/code&gt;eeping &lt;code&gt;U&lt;/code&gt;nit), you can order more in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft Commerce we do not automatically generate every combination of variant based on the custom fields attached to a variant because most stores never sell every combination, and also, not every custom field is a unique aspect of that variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If more options are added to a product, there is nothing forcing you to make every combination as a variant, you could just use an option/custom field to mark a single variant as special (i.e Gold Edition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are selling something that has a lot of options that customers are required to choose from each option, there is nothing stopping you from building a UI on the front end that makes selecting a variant possible based on all the options of all the custom fields. In that case your front end UI is building a query for a variant (&lt;code&gt;craft.commerce.variants&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not really selling a unique single SKU, but rather wanting a 'build a product' type product based on smaller SKUs, like building a bike, then you would need to build that yourself on the front end and/or with a plugin. That plugin would track what is in the cart, and which items still need to be added to complete the bike.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative to that is building a &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;noreferrer&quot;&gt;custom purchasable&lt;/a&gt; with a plugin. This would allow you to expose the building of the purchasable element to the customer (with any options or custom logic you wish), and once the purchasable is saved by the customer, they can add it to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, if you don't want to go down the custom purchasable route, you can always just use generic &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;options&lt;/code&gt; params&lt;/a&gt; when adding a product to the cart to allow any extra customer choices for the product. If the price is the same for the product regardless of the option chosen, this might be the easiest path if you have a huge amount of options and don't want to have a variant for each. The only thing you would want to do is validate the options for the current product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcommerce.com/docs/add-to-cart#line-item-options-and-notes&quot; rel=&quot;noreferrer&quot;&gt;line item options&lt;/a&gt; feature mentioned above can also be combined with a small plugin that modifies the price of the line item based on the options choosen with the &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;noreferrer&quot;&gt;onPopulateLineItem&lt;/a&gt; event. The plugin would use the event something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;$purchasable= $event-&amp;gt;params['purchasable'];&#xA;$lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;  if(isset($lineItem-&amp;gt;options['giftWrapped']) &amp;amp;&amp;amp; $lineItem-&amp;gt;options['giftWrapped'] == 1){&#xA;    $lineItem-&amp;gt;price = $lineItem-&amp;gt;price + 1;&#xA;    $lineItem-&amp;gt;salePrice = $lineItem-&amp;gt;price;&#xA;    $lineItem-&amp;gt;saleAmount = 0;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remembering that using the options method above will not be compatible with any stock tracking or inventory features now or in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have any follow up questions and I can improve the answer above.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2016-11-26T03:18:54.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17907" PostTypeId="2" ParentId="17902" CreationDate="2016-11-26T08:31:46.137" Score="3" Body="&lt;p&gt;The bucket you're trying to list is probably in the Frankfurt S3 region. The 3rd party library used in Craft 2.x for Amazon S3 support does not support Signature Version 4 that Frankfurt region requires, so you won't be able to use buckets in that region, as outlined &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5437/errors-occuring-with-assets-and-amazon-s3&quot;&gt;in this answer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3.0 will not have this limitation, however.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-11-26T08:31:46.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17908" PostTypeId="1" CreationDate="2016-11-26T19:50:06.870" Score="2" ViewCount="73" Body="&lt;p&gt;So a client is setting up a subscription website. It has an initial payment of $10, and then $0.99 monthly. Has anyone gotten trial amounts to work? I basically need to charge them $10 then set up a subscription. I'm trying to figure out a way to make it seamless for the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no way to make a charge programmatically via Charge without writing a second plugin. I know this is doable via vanilla Stripe, but I'd like to use Charge for all the convenient features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2016-11-26T19:50:06.870" Title="Trial amounts in Charge" Tags="&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17909" PostTypeId="1" AcceptedAnswerId="17918" CreationDate="2016-11-27T00:43:13.083" Score="1" ViewCount="65" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortlist&lt;/a&gt; plugin as a rating system throughout the site and need to display the numeral for the total, with a very simple conditional.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set item = craft.shortlist.item('favourites') %}&#xA;&#xA;{% if craft.shortlist.itemCount &amp;gt; 0 %}&#xA;    **{{ number }}**&amp;lt;i class=&quot;fa fa-large fa-heartbeat&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;i class=&quot;fa fa-large fa-heart-o&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried &lt;code&gt;{{ item }}&lt;/code&gt;, &lt;code&gt;{{ count }}&lt;/code&gt;, &lt;code&gt;{{ itemCount }}&lt;/code&gt;, but am unable to display a numeral.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="57" LastEditDate="2016-11-27T21:42:09.823" LastActivityDate="2016-11-28T00:17:07.683" Title="How to display itemCount using the Shortlist plugin?" Tags="&lt;plugin-shortlist&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17910" PostTypeId="1" CreationDate="2016-11-27T03:31:18.630" Score="0" ViewCount="40" Body="&lt;p&gt;Necessary disclaimer. Web design dilettante, so I ll probably have trouble following your answers if they get too technical. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building a blog. I am am trying to use tags bellow posts and when the user clicks on them, go on a page that shows all the relevant posts containing that tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed the instructions on &lt;a href=&quot;https://craftcms.com/support/tag-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; and while I can get the tags bellow the blog post, when I click on them, I am getting a 404 page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, I tried creating an archive page by following the instructions on this &lt;a href=&quot;https://craftcms.com/support/entry-archive&quot; rel=&quot;nofollow noreferrer&quot;&gt;page&lt;/a&gt; but while I can get the code to appear if I append it at the end of my index.html page, I cannot get it to appear on a separate web page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect I am making a blindingly obvious mistake, but I can't figure out what. Do you have any suggestions of things to try?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4921" LastActivityDate="2016-11-28T13:00:18.103" Title="I can't get Tags and Archive pages to appear" Tags="&lt;tags&gt;&lt;archives&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17911" PostTypeId="2" ParentId="17910" CreationDate="2016-11-27T06:44:27.923" Score="1" Body="&lt;p&gt;Sounds like you are missing a few tags, which we can fix when you post your code. Meanwhile, if you can spare the time, checkout &lt;a href=&quot;https://mijingo.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo.com&lt;/a&gt; Craft Essentials, it's like being in the matrix as within one day you'll know lots about Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will safe you lots of time figuring out the basics....&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2016-11-27T06:49:29.280" LastActivityDate="2016-11-27T06:49:29.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17912" PostTypeId="1" AcceptedAnswerId="17919" CreationDate="2016-11-27T13:43:47.460" Score="1" ViewCount="343" Body="&lt;p&gt;I'm looking to create a &lt;code&gt;.txt&lt;/code&gt; file with table field data taken from an entry on the fly. All entries would have their own designated files. It's for video chapters with JW Player. They ask for a &lt;code&gt;.vtt&lt;/code&gt; file but with testing a &lt;code&gt;.txt&lt;/code&gt; seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a good search but can't seem to find much. I guess the worst case scenario is uploading them via FTP, but preferably not! Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3489" LastEditorUserId="57" LastEditDate="2016-11-27T21:30:08.713" LastActivityDate="2016-11-28T07:51:46.380" Title="Creating an .txt file for every entry dynamically" Tags="&lt;files&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17913" PostTypeId="1" AcceptedAnswerId="17920" CreationDate="2016-11-27T13:55:28.467" Score="2" ViewCount="272" Body="&lt;p&gt;I'm trying to create a front end system where users can create and manage listings with multiple photos. Everything saves as a draft until approved by an admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the front end edit page, uploading multiple assets works and I'm able to display those assets to the user from their draft. However, when trying to upload additional assets, the existing ones are 'removed' and replaced by the new uploads. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried just about everything I can think of and searched through a ton of documentation but haven't figured out how to make it work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entryRevisions/saveDraft&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;...&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;...&quot;&amp;gt;&#xA;    {% if drafts %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;draftId&quot; value=&quot;{{ entry.draftId }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;...&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;...&#xA;&#xA;    {% if entry.photos|length %}&#xA;    {% for photo in entry.photos %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is where I think something should be happening to save existing photos...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% endfor %}&#xA;    &amp;lt;input type=&quot;file&quot; id=&quot;photos&quot; name=&quot;fields[photos][]&quot; class=&quot;upload&quot; multiple&amp;gt;&#xA;    {% else %}&#xA;    &amp;lt;input type=&quot;file&quot; id=&quot;photos&quot; name=&quot;fields[photos][]&quot; class=&quot;upload&quot; multiple&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd also like to be able to display the existing photos and give users the option to manually remove photos they've already uploaded, but that's step 2. Need to get past this point first. Any help or links to appropriate documentation would be much appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5002" LastActivityDate="2016-11-28T08:18:20.573" Title="Front End Asset Management - Upload New Photos without Deleting/Overriding Existing" Tags="&lt;assets&gt;&lt;form&gt;&lt;entry&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17914" PostTypeId="1" AcceptedAnswerId="17923" CreationDate="2016-11-27T16:50:01.523" Score="0" ViewCount="219" Body="&lt;p&gt;Or to say it in a different way, paginate siblings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this question on stack: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1203/how-do-you-page-through-child-entries-in-a-structure&quot;&gt;How do you page through child entries in a structure?&lt;/a&gt; which seems to have a working answer. However trying this myself I get no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, I have a two level structure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level 1 (parent)&#xA; - Level 2 (child)&#xA; - Level 2 (child)&#xA; - and so on..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I paginate the children?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any input!&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-11-28T11:57:43.387" Title="Paginate children in a structure" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17915" PostTypeId="1" CreationDate="2016-11-27T20:34:37.477" Score="1" ViewCount="116" Body="&lt;p&gt;I am trying to export entries from my EE 3 install to Craft and import them using the Feed Me 2 beta plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have followed the instructions on creating a template from within ExpressionEngine 3 with the export.php code from engram-design's github.  I have enabled PHP on the template from within EE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the &lt;code&gt;mysite-url/export?id=1&lt;/code&gt; file, it gives me this error page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{!-- ra:0000000004427cd500000000745c77df --}&#xA;  Notice&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Undefined property: EE_Functions::$EE&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;ee/legacy/libraries/Functions.php(680) : eval()'d code, line 4 show details&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Severity: E_NOTICE&#xA;  Notice&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Trying to get property of non-object&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;ee/legacy/libraries/Functions.php(680) : eval()'d code, line 4 show details&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Severity: E_NOTICE&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Fatal error: Uncaught Error: Call to a member function query() on null in /home/iwatermt/public_html/system/ee/legacy/libraries/Functions.php(680) : eval()'d code:4 Stack trace: #0 /home/iwatermt/public_html/system/ee/legacy/libraries/Functions.php(680): eval() #1 /home/iwatermt/public_html/system/ee/legacy/libraries/Template.php(1825): EE_Functions-&gt;evaluate('{!-- ra:0000000...') #2 /home/iwatermt/public_html/system/ee/legacy/libraries/Template.php(559): EE_Template-&gt;parse_template_php('{!-- ra:0000000...') #3 /home/iwatermt/public_html/system/ee/legacy/libraries/Template.php(237): EE_Template-&gt;parse('{!-- ra:0000000...', false, '1', false) #4 /home/iwatermt/public_html/system/ee/legacy/libraries/Template.php(168): EE_Template-&gt;fetch_and_parse('', Array, false) #5 /home/iwatermt/public_html/system/ee/legacy/libraries/Core.php(680): EE_Template-&gt;run_template_engine('', '') #6 /home/iwatermt/public_html/system/ee/legacy/controllers/ee.php(68): EE_Core-&gt;generate_page() #7 [internal function]: EE-&gt;index() #8 /home/iwatermt/p in /home/iwatermt/public_html/system/ee/legacy/libraries/Functions.php(680) : eval()'d code on line 4&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="5933" LastEditorUserId="57" LastEditDate="2016-11-27T21:34:30.247" LastActivityDate="2016-11-27T22:49:43.017" Title="Problems exporting entries from ExpressionEngine 3 with Feed Me 2 beta plugin" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17916" PostTypeId="2" ParentId="17912" CreationDate="2016-11-27T21:29:25.320" Score="3" Body="&lt;p&gt;You can write a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listens to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveEntry&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that event fires, you can grab any of the data you need for the text file from any of the custom fields and your plugin can write it out to the filesystem at whatever place it needs for JW Player to consume.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-27T21:29:25.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17917" PostTypeId="2" ParentId="17915" CreationDate="2016-11-27T22:49:43.017" Score="1" Body="&lt;p&gt;Just some additional context here, we're referring to the guide for Feed Me 2 &lt;a href=&quot;http://sgroup.com.au/plugins/feedme/guides/migrating-from-ee-to-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, which leads to the Gist &lt;a href=&quot;https://gist.github.com/engram-design/5fbe54ef0abb15e3ff6f667291098464&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. This Gist has not been tested with EE3, but should work just fine for EE2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That Gist is really just a guide to get you started quickly with an export. It's in no way a requirement, as you can simply create your own JSON or XML templates in Expression Engine to output your content. Once that's done, its over to Feed Me to continue as normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might like to refer to &lt;a href=&quot;https://github.com/rsanchez/json&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/rsanchez/json&lt;/a&gt; or simply write your own JSON/XML templates.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-11-27T22:49:43.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17918" PostTypeId="2" ParentId="17909" CreationDate="2016-11-28T00:17:07.683" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist/usage/variables#itemCount&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; is looks like the correct syntax to use is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.shortlist.itemCount }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-28T00:17:07.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17919" PostTypeId="2" ParentId="17912" CreationDate="2016-11-28T07:51:46.380" Score="2" Body="&lt;p&gt;An alternative to using a plugin to write an actual text file to the local filesystem is to create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; that looks like your entry URL format, except with &lt;code&gt;.txt&lt;/code&gt; at the end (e.g. &lt;code&gt;news/{slug}.txt&lt;/code&gt;), and point that route to a template called &lt;code&gt;text.html&lt;/code&gt; or the like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the &lt;code&gt;text.html&lt;/code&gt; template, you'll need to pull the entry using the &lt;code&gt;slug&lt;/code&gt; token:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- spaceless -%}&#xA;&#xA;    {# Get the entry #}&#xA;    {% set entry = craft.entries.section('news').slug(slug).first() %}&#xA;&#xA;    {% if not entry %}&#xA;        {% exit 404 %}&#xA;    {% endif %}&#xA;&#xA;    {# Set some headers #}&#xA;    {% header &quot;Content-Type: text/plain; charset=utf-8&quot; %}&#xA;    {% header &quot;Access-Control-Allow-Origin: *&quot; %}&#xA;&#xA;    {# Print the table #}&#xA;    {% for row in entry.tableField %}&#xA;        ...&#xA;    {% endfor %}&#xA;&#xA;{%- endspaceless -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea is that with the above, you'll be able to just append &lt;code&gt;.txt&lt;/code&gt; to your existing entry URLs to serve a text version of each entry – I have no idea if JW Player can be configured to use such a setup, but there it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat: This solution will have a slightly larger overhead than simply serving an actual text file, since you'll be invoking Craft and hitting the database for each request.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-11-28T07:51:46.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17920" PostTypeId="2" ParentId="17913" CreationDate="2016-11-28T08:18:20.573" Score="4" Body="&lt;p&gt;You're right that your template needs some adjustments. Whenever you're saving an Assets field, you need to have &lt;em&gt;all&lt;/em&gt; of the Asset id's not just the new ones. You're looking for something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.photos|length %}&#xA;    {% for photo in entry.photos %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[photos][]&quot; value=&quot;{{ photo.id }}&quot; /&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;input type=&quot;file&quot; id=&quot;photos&quot; name=&quot;fields[photos][]&quot; class=&quot;upload&quot; multiple&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastActivityDate="2016-11-28T08:18:20.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17921" PostTypeId="2" ParentId="17905" CreationDate="2016-11-28T09:37:56.440" Score="1" Body="&lt;p&gt;The only way to do what you're describing out-of-the-box is by adding a user field for Users. Then you can either check that field for child users or get a little creative with &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;relatedTo&lt;/a&gt; to get parent users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to, for example, prevent a child user being linked to several parents or you want the same field to display the parent (if any), you're looking at a custom field type implemented by a plugin.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2016-11-28T09:37:56.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17922" PostTypeId="1" AcceptedAnswerId="17930" CreationDate="2016-11-28T10:36:38.013" Score="6" ViewCount="371" Body="&lt;p&gt;On my home page template I include a couple of extracts from single entries and I'm not sure which is the best/most efficient way to call them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('information').slug('about') %}&#xA;    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;    {{ entry.summary }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(13).first() %}&#xA;&amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;{{ entry.summary }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They both generate the same amount of queries in the Chrome dev tools profile summary report, but I don't understand why, as the second looks like it's more specific and not a loop.&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="57" LastEditDate="2016-11-28T19:19:16.400" LastActivityDate="2016-12-01T08:16:50.997" Title="Which is best practice, SET or FOR?" Tags="&lt;performance&gt;&lt;best-practice&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17923" PostTypeId="2" ParentId="17914" CreationDate="2016-11-28T11:57:43.387" Score="2" Body="&lt;p&gt;There are many ways to paginate:&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;To show next / prev links&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;#1&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getPrevSibling&quot; rel=&quot;nofollow noreferrer&quot;&gt;getPrevSibling&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNextSibling&quot; rel=&quot;nofollow noreferrer&quot;&gt;getNextSibling&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.getPrevSibling %}&#xA;    &amp;lt;a href=&quot;{{entry.getPrevSibling.url}}&quot;&amp;gt;{{entry.getPrevSibling.title}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if entry.getNextSibling %}&#xA;    &amp;lt;a href=&quot;{{entry.getNextSibling.url}}&quot;&amp;gt;{{entry.getNextSibling.title}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;#2 &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow noreferrer&quot;&gt;getPrev&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow noreferrer&quot;&gt;getNext&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {section: entry.section.handle} %}&#xA;{% set prev = entry.getPrev(params) %}&#xA;{% set next = entry.getNext(params) %}&#xA;&#xA;{% if prev %}&#xA;    &amp;lt;a href=&quot;{{prev.url}}&quot;&amp;gt;{{prev.title}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if next %}&#xA;    &amp;lt;a href=&quot;{{next.url}}&quot;&amp;gt;{{next.title}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;To show list of children (single type page)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% paginate %}&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('sectionHandle').limit(10) as pageEntries %}&#xA;&#xA;{% for entry in pageEntries %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2016-11-28T11:57:43.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17924" PostTypeId="2" ParentId="17910" CreationDate="2016-11-28T13:00:18.103" Score="0" Body="&lt;p&gt;Ok, I found the mistake. I put the wrong URI in Routes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the mijingo suggestion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alas, I am afraid at some point I ll be back to ask another silly question. :)&lt;/p&gt;&#xA;" OwnerUserId="4921" LastActivityDate="2016-11-28T13:00:18.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17925" PostTypeId="2" ParentId="17922" CreationDate="2016-11-28T13:06:05.480" Score="5" Body="&lt;p&gt;Both are essentially the same query, the only thing that differs is the WHERE statement.&#xA;The ID approach will always be the most efficient, since it uses the primary key index, thus finding the result faster. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also do the first example the same way you did the second one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('information').slug('about').first() %}&#xA;&amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;{{ entry.summary }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2016-11-28T13:06:05.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17926" PostTypeId="2" ParentId="12232" CreationDate="2016-11-28T14:55:45.187" Score="3" Body="&lt;p&gt;I’ve had the problem with &lt;code&gt;storeFolder()&lt;/code&gt; that it doesn’t create a folder that is accessible via the control panel or the file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService#createFolder-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;createFolder()&lt;/a&gt; much easier to use and it did what I expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = craft()-&amp;gt;assets-&amp;gt;createFolder($parentFolderId, $folderName);&#xA;$folderId = $response-&amp;gt;getResponseData()['folderId'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2016-11-28T14:55:45.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17927" PostTypeId="1" AcceptedAnswerId="17932" CreationDate="2016-11-28T15:19:57.070" Score="4" ViewCount="633" Body="&lt;p&gt;Can anyone provide details on how to add Redactor (II) Image resizing and positioning to the Rich Text field in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2016-11-28T22:43:06.697" Title="How to add Redactor Image resizing and positioning to the Rich Text field in Craft?" Tags="&lt;redactor&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17928" PostTypeId="2" ParentId="17922" CreationDate="2016-11-28T15:41:02.910" Score="0" Body="&lt;p&gt;Personally I would pick the For loop to keep my code look equal plus you are looping over an entry so in my opinion you should use FOR&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2016-11-28T15:41:02.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17929" PostTypeId="2" ParentId="17922" CreationDate="2016-11-28T16:50:47.013" Score="2" Body="&lt;p&gt;Working with singles you can use them both. However, the set has the advantage that you can apply multiple filters etc. on it afterwards. Especially handy with more complex designs and when working with channels etc.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2016-11-28T16:50:47.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17930" PostTypeId="2" ParentId="17922" CreationDate="2016-11-28T18:16:31.490" Score="8" Body="&lt;p&gt;Regardless of the number of elements involved, Craft will return an iterable &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; whenever you query for content (e.g. via &lt;code&gt;craft.entries&lt;/code&gt;, or using relational FieldTypes like Assets, Entries or Categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that even if you &lt;em&gt;know&lt;/em&gt; that there'll only be a single element returned (e.g. when you query for a Single section entry, or have a relational field restricted to a single element) using a &lt;code&gt;for&lt;/code&gt; loop to actually access that element is totally viable and whether to actually use a loop or not in such cases, is mostly a matter of personal preference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looping on single-element query results may seem counter-intuitive, although you're not actually looping on a single element, but the ElementCriteriaModel (which just happens to &quot;contain&quot; a single element and not several). Personally I tend to only use loops when I actually &lt;em&gt;need&lt;/em&gt; loops (i.e. there is or could be more than one element returned), but its up to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, beyond personal preference there are a few minor differences to each approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a &lt;code&gt;{% for %}&lt;/code&gt; loop, it's easy to render alternative content if the query doesn't return anything, by adding an &lt;code&gt;{% else %}&lt;/code&gt; statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('mySingleSection') %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Sorry, the entry wasn't found!&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;.first()&lt;/code&gt; and &lt;code&gt;{% set %}&lt;/code&gt;, you should – in most cases – add an &lt;code&gt;{% if %}&lt;/code&gt; statement testing the value returned, to avoid template errors if the query doesn't return a valid element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('mySingleSection').first() %}&#xA;{% if entry %}&#xA;   &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also using &lt;code&gt;.first()&lt;/code&gt; and &lt;code&gt;{% set %}&lt;/code&gt;, it's easy to declare fallback data if the query doesn't return anything, using the &lt;code&gt;|default&lt;/code&gt; filter – this may negate the need for an &lt;code&gt;{% if %}&lt;/code&gt; statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageUrl = entry.assetsField.first().url|default('/assets/fallback.jpg') %}&#xA;&amp;lt;img src=&quot;{{ imageUrl }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Performance-wise, I doubt there'll be any real-world difference between the two methods, with only a single element involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the query part of your question; even if you're using a &lt;code&gt;for&lt;/code&gt; loop, Craft won't run the &lt;code&gt;craft.entries&lt;/code&gt; query in your example more than once – which is why you're seeing the same amount of queries in your profiling report. When talking about queries and performance, it's however worth noting that both the amount of queries and the &lt;em&gt;efficiency&lt;/em&gt; of those queries are relevant. In your example, the first query will probably be a tiny, tiny bit faster than the second (Gustavs' answer explains why).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-01T08:16:50.997" LastActivityDate="2016-12-01T08:16:50.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17931" PostTypeId="1" AcceptedAnswerId="18039" CreationDate="2016-11-28T19:07:15.493" Score="1" ViewCount="116" Body="&lt;p&gt;I am setting up 2 node cluster with GlusterFS for shared file system. I have mounted the shared mount on each of the nodes but when I try to access login page I get this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/data/websites/websiteapp/craft/storage/ doesn't exist or isn't writable by PHP. Please fix that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The folder permissions are lrwxrwxrwrx. Is there anything I need to do make it work?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-12-06T17:33:07.233" Title="Help needed with 2 node setup" Tags="&lt;config&gt;&lt;performance&gt;&lt;install&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17932" PostTypeId="2" ParentId="17927" CreationDate="2016-11-28T19:15:58.817" Score="3" Body="&lt;p&gt;If you're on &lt;a href=&quot;https://craftcms.com/changelog#2-6-2950&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.2950&lt;/a&gt; or greater, it includes Redactor II 1.3.1, where they re-introduced image &lt;a href=&quot;https://imperavi.com/redactor/examples/image-resize/&quot; rel=&quot;nofollow noreferrer&quot;&gt;resizing and positioning&lt;/a&gt; support. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll just need to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imageResizable: true,&#xA;imagePosition: true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to whatever &lt;code&gt;craft/config/redactor&lt;/code&gt; config file your Rich Text field is set to use under its settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-28T19:15:58.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17933" PostTypeId="2" ParentId="17607" CreationDate="2016-11-28T22:19:02.590" Score="5" Body="&lt;p&gt;Quoting Brad Bell in a recent &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17927/how-to-add-redactor-image-resizing-and-positioning-to-the-rich-text-field-in-cra&quot;&gt;thread&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you're on Craft 2.6.2950 or greater, it includes Redactor II 1.3.1,&#xA;  where they re-introduced image resizing and positioning support.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;You'll just need to add:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;imageResizable: true, imagePosition: true to whatever&#xA;  craft/config/redactor config file your Rich Text field is set to use&#xA;  under its settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This combined with the mentioned 3rd party plugins creates a bullet proof and front-end friendly setup.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2016-11-28T22:19:02.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17934" PostTypeId="2" ParentId="17927" CreationDate="2016-11-28T22:21:25.670" Score="1" Body="&lt;p&gt;Similar &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17607/redactor-ii-image-resizing/17933#17933&quot;&gt;Q&amp;amp;A&lt;/a&gt; with additional bulletproofing techniques using 3rd party plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example for Standard.json:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;horizontalrule&quot;],&#xA;    &quot;plugins&quot;: [&quot;source&quot;,&quot;fullscreen&quot;],&#xA;    imageResizable: true,&#xA;    imagePosition: true&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-11-28T22:43:06.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17935" PostTypeId="1" AcceptedAnswerId="17940" CreationDate="2016-11-28T22:33:07.117" Score="2" ViewCount="94" Body="&lt;p&gt;UPDATE: We've resolved this one. Here is the working code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;2&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;file&quot; &#xA;         name=&quot;replaceFile-{{ asset.id }}” &#xA;         class=&quot;replace-file&quot; &#xA;         data-id=&quot;{{ asset.id }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;http://code.jquery.com/jquery-latest.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &#xA;&amp;lt;script&amp;gt;&#xA;$(&quot;.replace-file&quot;).change(function() {&#xA;  var url = '/actions/assets/replaceFile',&#xA;      fileId = $(this).attr(&quot;data-id&quot;),&#xA;      file = $(&quot;[name=replaceFile-&quot;+fileId+&quot;]&quot;)[0].files[0],&#xA;      formdata = new FormData();&#xA;&#xA;  formdata.append(&quot;replaceFile&quot;, file);&#xA;  formdata.append(&quot;fileId&quot;, fileId);&#xA;&#xA;  $(&quot;#output&quot;).html(&quot;Uploading...&quot;);&#xA;&#xA;  $.ajax({&#xA;    url: url,&#xA;    type: 'POST',&#xA;    data:  formdata,&#xA;    cache: false,&#xA;    contentType: false,&#xA;    processData: false,&#xA;    success: function(data) {&#xA;      $(&quot;#output&quot;).html(&quot;Supposedly worked...&quot;);&#xA;    }&#xA;  });&#xA;});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastEditorUserId="5938" LastEditDate="2016-12-01T15:33:12.693" LastActivityDate="2016-12-01T15:33:12.693" Title="Trying to replace an asset via replaceFile action in entry form" Tags="&lt;assets&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17936" PostTypeId="1" AcceptedAnswerId="17937" CreationDate="2016-11-29T00:14:15.107" Score="1" ViewCount="49" Body="&lt;p&gt;I'm not sure if this is a two part question yet. I need to enforce field limitations (specifically, character limits for plain text fields) when working with drafts. In the CP, I discovered that drafts ignore all limitations related to character length and only throw errors when attempting to publish the draft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that enforcing the draft field limitations in the CP will also apply to front end entries that are saved as drafts as well. If not, this is what I'm doing: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a front end form for user created entries. Everything has been working correctly with the exception of field limitations (users submit draft revisions until published by an admin). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to force field limitations for a draft?&lt;/p&gt;&#xA;" OwnerUserId="5002" LastEditorUserId="57" LastEditDate="2016-11-29T00:55:52.063" LastActivityDate="2016-11-29T00:58:22.227" Title="Force Field Limitation in Drafts - Front End Form" Tags="&lt;entries&gt;&lt;field&gt;&lt;draft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17937" PostTypeId="2" ParentId="17936" CreationDate="2016-11-29T00:58:22.227" Score="2" Body="&lt;p&gt;Custom field validation won't run for disabled entries or for drafts, regardless of whether it's a front-end request or a CP request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an &lt;a href=&quot;https://github.com/mmikkel/AlwaysValidate-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Always Validate&lt;/a&gt; plugin that changes that behavior for disabled entries/categories.  It could pretty easily be modified to do that for drafts as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-29T00:58:22.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17938" PostTypeId="2" ParentId="17865" CreationDate="2016-11-29T04:00:29.463" Score="1" Body="&lt;p&gt;My issue was that the country wasn't being set properly. Since we're only shipping to the US, I had mistakenly commented out my hidden input for the country field.&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2016-11-29T04:00:29.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17939" PostTypeId="2" ParentId="17899" CreationDate="2016-11-29T04:04:11.433" Score="6" Body="&lt;p&gt;In your plugin's main file init method setup your template hook. In this hook you can call a service method to return your rendered HTML.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;    {&#xA;        craft()-&amp;gt;templates-&amp;gt;hook('video.slider', function(&amp;amp;$context)&#xA;        {&#xA;            $response = craft()-&amp;gt;pluginname_service-&amp;gt;serviceMethod();&#xA;            return $response;&#xA;        });&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin's service file create a method to return your rendered HTML. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function serviceMethod() &#xA;    {   &#xA;&#xA;        $oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;&#xA;        $newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'path/templates/folder';&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;&#xA;        $templateName = '_templatename';&#xA;&#xA;        //If you need to get data from somewhere else to pass to the template&#xA;        $htmlData = craft()-&amp;gt;plugin_service-&amp;gt;serviceMethod();&#xA;&#xA;        $htmlResponse = craft()-&amp;gt;templates-&amp;gt;render($templateName, array(&quot;variableName&quot; =&amp;gt; $htmlData));&#xA;&#xA;        //reset path&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&#xA;        return $htmlResponse;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2016-11-29T04:04:11.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17940" PostTypeId="2" ParentId="17935" CreationDate="2016-11-29T07:02:42.797" Score="1" Body="&lt;p&gt;In short, you have the right idea, but you're not uploading any files with that JavaScript. All you're doing is sending a file id to a Craft action that expects an uploaded file as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find an insight on how to change your javascript to include file data as well &lt;a href=&quot;https://stackoverflow.com/a/10899796/2040791&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-11-29T07:02:42.797" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17941" PostTypeId="1" AcceptedAnswerId="17943" CreationDate="2016-11-29T10:21:58.483" Score="1" ViewCount="228" Body="&lt;p&gt;Can you pass params to Freeform’s &lt;code&gt;render&lt;/code&gt; tag ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. &lt;code&gt;{{ entry.form.render({ entry: entry }) }}&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to access &lt;code&gt;entry&lt;/code&gt; data inside formatting templates...but I get &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt; error.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2016-11-29T11:06:16.427" Title="Passing params to Freeform’s `render` tag" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17943" PostTypeId="2" ParentId="17941" CreationDate="2016-11-29T11:06:16.427" Score="2" Body="&lt;p&gt;That isn't possible right now, the things you &lt;em&gt;can&lt;/em&gt; pass to the &lt;code&gt;render&lt;/code&gt; tag are listed here under &lt;a href=&quot;https://solspace.com/craft/freeform/docs/form/#prop-custom-attributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;customAttributes&lt;/code&gt;&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We might, however, add such functionality in the future.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-11-29T11:06:16.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17944" PostTypeId="1" AcceptedAnswerId="17946" CreationDate="2016-11-29T11:09:10.413" Score="1" ViewCount="289" Body="&lt;p&gt;I have a site set up that uses Craft as a CMS only, not used to display templates, as this is handled by React JS separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My site is set up so that Craft responds on &lt;code&gt;/api&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot for the life of me figure out how to POST data into a section!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a route set up, so my routes file is like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'post-message' =&amp;gt; array(&#xA;        'action' =&amp;gt; 'entries/saveEntry',&#xA;        'sectionId' =&amp;gt; 13,&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to test this using Rested app, posting a couple of fields into my section, but it doesn't do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rested is pointing to &lt;code&gt;/api/post-message&lt;/code&gt; using a POST request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find any documentation that tutors a developer on how to post data into a section, so I'm completely stuck here.&lt;/p&gt;&#xA;" OwnerUserId="5942" LastActivityDate="2016-11-29T15:11:06.073" Title="POSTing data into Craft" Tags="&lt;routing&gt;&lt;post&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17945" PostTypeId="1" AcceptedAnswerId="18233" CreationDate="2016-11-29T12:07:16.627" Score="2" ViewCount="346" Body="&lt;p&gt;The Craft CMS instance where I noticed this is running version 2.6, but I updated it last month from version 2.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While we did not notice any problem, according to the client, they were able to upload pictures taken with their smartphone and Craft would rotate the images correctly before the update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, Imagick is not available on this server (I checked PHPInfo) so GD has always been used. I also made sure that the &quot;rotateImagesOnuploadByExifData&quot; setting is set to true by adding it explicitly to the general config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what could be causing the issue and would installing Imagick solve the problem?&lt;/p&gt;&#xA;" OwnerUserId="3570" LastEditorUserId="3570" LastEditDate="2016-11-29T13:13:49.880" LastActivityDate="2016-12-21T14:24:06.017" Title="Images containing EXIF orientation tag are not rotated on upload" Tags="&lt;image&gt;&lt;upload&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17946" PostTypeId="2" ParentId="17944" CreationDate="2016-11-29T15:11:06.073" Score="2" Body="&lt;p&gt;If you don't want to get into plugin controllers and actions you can replicate this format here: &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And trick Craft into believing your data comes from an entry form. &lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2016-11-29T15:11:06.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17948" PostTypeId="1" CreationDate="2016-11-29T15:58:27.913" Score="1" ViewCount="1205" Body="&lt;p&gt;Very new to Craft &amp;amp; Twig. So I get the following error: &lt;em&gt;Impossible to invoke a method (&amp;quot;url&amp;quot;) on a integer variable (&amp;quot;0&amp;quot;)&lt;/em&gt; with the below code:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if module.type == &amp;quot;rotator&amp;quot; %}&#xA;    &amp;lt;div class=&amp;quot;rotator&amp;quot;&amp;gt;&#xA;        {% for row in module.contents %}&#xA;            {% set position = loop.index0 %}&#xA;            {% set previous = loop.index -1 %}&#xA;            {% set next = loop.index + 1 %}&#xA;            &amp;lt;div class=&amp;quot;rotator__item active&amp;quot;&amp;gt;&#xA;                &amp;lt;img src=&amp;quot;{{ row.slideImage.first().url}}&amp;quot; alt=&amp;quot;slideImage.title&amp;quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&amp;quot;switcher&amp;quot;&amp;gt;&#xA;                &amp;lt;span class=&amp;quot;rotator__control left&amp;quot;&amp;gt;&#xA;                    &amp;lt;a href=&amp;quot;{{ previous.url() }}&amp;quot;&amp;gt; ‹&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&amp;quot;previous__title&amp;quot;&amp;gt;&#xA;                    {{ previous.slideTitle }}&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;div class=&amp;quot;divider&amp;quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;span class=&amp;quot;content&amp;quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{row.slideTitle}}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;a href=&amp;quot;row.slideImage.first().url&amp;quot;&amp;gt;&#xA;                        {{row.slideCaption}}&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&amp;quot;rotator__control right&amp;quot;&amp;gt;&#xA;                    {{ next.slideTitle }}&#xA;                &amp;lt;span&amp;gt;&#xA;                    &amp;lt;a href=&amp;quot;{{ next.url() }}&amp;quot;&amp;gt; ›&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So basically I need a 'previous' and 'next' variable that corresponds to the previous row and the next row in the Super Table. Essentially I need a way to call the current row in the Super Table I'm at, and the previous row and next row relative to the row I'm on.&lt;/p&gt;&#xA;&lt;p&gt;Here's what my set up looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JAB2I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JAB2I.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pj71H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pj71H.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've tried loop.index0 + 1 and loop.index + 1. But neither work and I know I am calling them in the wrong way.&lt;/p&gt;&#xA;" OwnerUserId="5919" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-12-09T19:48:38.230" Title="Looping through rows in a Super Table" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17949" PostTypeId="2" ParentId="17948" CreationDate="2016-11-29T19:16:06.883" Score="1" Body="&lt;p&gt;&lt;code&gt;loop.index&lt;/code&gt; and &lt;code&gt;loop.index0&lt;/code&gt; will &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;both return integers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you do &lt;code&gt;{% set previous = loop.index - 1 %}&lt;/code&gt;, on the first iteratin of that loop, &lt;code&gt;loop.index&lt;/code&gt; returns &lt;code&gt;1&lt;/code&gt;, then you subtract &lt;code&gt;1&lt;/code&gt; from it and &lt;code&gt;previous&lt;/code&gt; is now equal to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later you call &lt;code&gt;previous.url()&lt;/code&gt;, which is equal to &lt;code&gt;0.url()&lt;/code&gt; and the error message you get says there is no method named &lt;code&gt;url()&lt;/code&gt; for the integer &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to access the previous &lt;em&gt;row&lt;/em&gt;, then you can probably do something like &lt;code&gt;{% set previousRow = module.contents[previous] %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-29T19:16:06.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17950" PostTypeId="1" CreationDate="2016-11-29T20:57:20.927" Score="0" ViewCount="2128" Body="&lt;p&gt;I've got a Craft plugin that returns some results based on filter options on the front end. The filter sends an ajax submissions and returns the markup to populate the front end with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs on CSRF protection&lt;/a&gt; and specifically implemented what it says for jQuery based post submissions. However I'm still getting a 400 error saying &quot;&lt;strong&gt;Bad Request - The CSRF token could not be verified.&lt;/strong&gt;&quot; for every post request. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GkDXm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GkDXm.jpg&quot; alt=&quot;CSRF &amp;amp; 400 error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a token is being sent in the post data.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2016-11-29T21:58:09.230" LastActivityDate="2016-11-29T21:58:09.230" Title="CSRF token could not be verified - ajax" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;csrf&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17951" PostTypeId="1" CreationDate="2016-11-30T00:49:28.277" Score="1" ViewCount="113" Body="&lt;p&gt;So.. it turns out commerce cannot apply tax to base shipping rates, see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15785/craft-commerce-calculating-product-shipping-tax/15791&quot;&gt;Calculating (Product + Shipping) + Tax?&lt;/a&gt; previously asked on stack.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried setting the tax to a &quot;Per Item Rate&quot; to 99 and the &quot;Maximum Total Shipping Cost&quot; to 99, which I don't want exceeded no matter what. At first this seemed to work fine with a test product (price 5,-), however that was until I increased the qty to 2. The shipping cost for the cart stays at 99, however the shipping cost of the product doubles, which in this case also doubles the cart tax (20.8 to 41.6). This makes no sense to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached a video demonstrating what I mean (I get the same result in the demo templates that come with commerce). See video: &lt;a href=&quot;https://drive.google.com/open?id=0B8JsOGTrYBIjZUF6cFhTY2RVd0k&quot; rel=&quot;nofollow noreferrer&quot;&gt;watch directly on Google Drive&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are just a week away from launch, and I just discovered this issue. Stressing out right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you to anyone who can help enlighten me.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-07-11T04:44:56.190" Title="Prevent shipping tax from doubling when item qty goes from 1 to 2 in cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17952" PostTypeId="1" AcceptedAnswerId="17954" CreationDate="2016-11-30T01:34:24.563" Score="2" ViewCount="67" Body="&lt;p&gt;I'd like to be able to create a Sprout Forms entry from another plugin I'm working on. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a bit of a look at the &lt;strong&gt;SproutForms_EntriesController-&gt;actionSaveEntry()&lt;/strong&gt; action but it's kind of all bundled up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This other plugin is a self contained booking system that I don't want to use an actual Sprout Forms form for - but to keep it consistent for the client I'd like to write (for reference) these entries into a pre-existing form I've set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-12-06T07:17:11.463" Title="Write into Sprout Forms from another plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17953" PostTypeId="2" ParentId="17904" CreationDate="2016-11-30T01:37:27.147" Score="2" Body="&lt;p&gt;FTP should still work just fine in Feed Me 2. You can also use basic authentication by providing the username/password in the URL.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ftp://username:password@website.com/public_html/feed.xml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use the &lt;code&gt;curlOptions&lt;/code&gt; settings in the &lt;a href=&quot;http://sgroup.com.au/plugins/feedme/getting-started/configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;configuration&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2016-11-30T01:37:27.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17954" PostTypeId="2" ParentId="17952" CreationDate="2016-11-30T04:54:34.830" Score="3" Body="&lt;p&gt;When leveraging another plugin programmatically, you will typically want to use the service layer. In your case, the &lt;code&gt;SproutForms_EntriesService.php&lt;/code&gt; is where the &lt;code&gt;saveEntry&lt;/code&gt; action gets processed. The &lt;code&gt;saveEntry&lt;/code&gt; service method expects a &lt;code&gt;SproutForms_EntryModel&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;sproutForms-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a longer example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create a new instance of a SproutForms_EntryModel&#xA;$entry = new SproutForms_EntryModel();&#xA;&#xA;// Set some SproutForms_EntryModel attributes&#xA;$entry-&amp;gt;formId    = 4051;&#xA;$entry-&amp;gt;ipAddress = '127.0.0.1';&#xA;$entry-&amp;gt;userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36';&#xA;&#xA;// Set the custom fields&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'fullName' =&amp;gt; 'Test Name',&#xA;    'message' =&amp;gt; 'Test message'&#xA;));&#xA;&#xA;// Save the entry&#xA;craft()-&amp;gt;sproutForms_entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms should dynamically set the title value for you, based on the value you have in the &lt;code&gt;Advanced-&amp;gt;Title Format&lt;/code&gt; setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case it doesn't seem to work, a quick way to see if there are any errors is to kill your script after you tried to save the entry and view the full list of errors (or use a more advanced &lt;a href=&quot;https://straightupcraft.com/events/troubleshooting-and-debugging-errors-in-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP debugging workflow&lt;/a&gt; with a tool like XDebug):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::dd($entry-&amp;gt;getErrors());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the answer from Brandon Kelly on this post for more information on how to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;set custom fields on an Element&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-12-06T07:17:11.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17955" PostTypeId="1" CreationDate="2016-11-30T06:45:17.757" Score="0" ViewCount="49" Body="&lt;p&gt;Is it possible to setup messages (for transactional emails) as global text fields that include variables such as {{ firstName }}, {{ lastName }}, {{ email }} etc.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Custom plugin fires off transactional email&lt;/li&gt;&#xA;&lt;li&gt;Email copy is pulled from global text field&lt;/li&gt;&#xA;&lt;li&gt;Variables like {{ firstName }} are substituted from plugin action&lt;/li&gt;&#xA;&lt;li&gt;Email is sent&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="67" LastActivityDate="2016-11-30T06:45:17.757" Title="Custom Messages including variables in global field?" Tags="&lt;plugin-development&gt;&lt;emails&gt;&lt;globals&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17956" PostTypeId="1" AcceptedAnswerId="18099" CreationDate="2016-11-30T09:18:49.197" Score="1" ViewCount="50" Body="&lt;p&gt;I have two channels: A event and a news channel which I want the cache to expire based on both their expiry Date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsDate = craft.entries.section('newsDate').order('expiryDate asc').first() %}&#xA;{% set eventDate = craft.entries.section('event').order('konzertStartdate asc').first() %}&#xA;{% set currentTime = now |date('c') %}&#xA;&#xA;{% if currentTime &amp;lt;= newsDate %}&#xA;    {% set invalidate = newsDate.expiryDate | date('c') %}&#xA;{% else %}&#xA;    {% set invalidate = auffuehrung.konzertStartdate |date('c') %}&#xA;{% endif %}&#xA;&#xA;{% cache unless invalidate %}&#xA; {# blablabla #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I create two variables and then check which one is newer. But its not working properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The news never seem to invalidate the cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-11T11:00:01.450" Title="Invalidate cache from two channel expiry dates" Tags="&lt;templating&gt;&lt;cache&gt;&lt;expiration&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17957" PostTypeId="1" AcceptedAnswerId="17958" CreationDate="2016-11-30T09:56:07.887" Score="1" ViewCount="55" Body="&lt;p&gt;Right know for my search engine i am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages, references, trainingsList, maps, trendsAndInnovation, currentTopics).search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now if i would add another section i have to add it to the code as well of course.&#xA;Is there a way to directly search for everything on the page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the support :)&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="57" LastEditDate="2016-11-30T20:56:42.510" LastActivityDate="2016-11-30T20:56:42.510" Title="Search everywhere" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17958" PostTypeId="2" ParentId="17957" CreationDate="2016-11-30T10:48:32.413" Score="4" Body="&lt;p&gt;Sure, just remove the &lt;code&gt;section&lt;/code&gt; parameter altogether.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-11-30T10:48:32.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17959" PostTypeId="1" AcceptedAnswerId="17967" CreationDate="2016-11-30T11:43:41.477" Score="1" ViewCount="295" Body="&lt;p&gt;In &lt;strong&gt;config.php&lt;/strong&gt; file, &lt;code&gt;setPasswordPath&lt;/code&gt; is set to match a custom template. This is working fine by following the reset password link sent by email (for a front end user).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after I've changed the password (with &lt;code&gt;users/setPassword&lt;/code&gt; action), if I click again on the reset password link in the email, I am redirected to a page within the default Craft template that inform me that the verification code is now wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I also set a custom template for this page?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2016-11-30T21:11:43.943" Title="How to keep the setPasswordPath config when reset password link is expired?" Tags="&lt;config&gt;&lt;password&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17960" PostTypeId="1" CreationDate="2016-11-30T12:36:06.830" Score="3" ViewCount="610" Body="&lt;p&gt;For maximum security I'd like to implement data encryption in Craft CMS for all data stored in the database. So if it gets hacked the data is pretty much useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's a way to accomplish this? Or is there any plugin that takes care of this? I found &lt;a href=&quot;https://github.com/romainwurtz/SecureField-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; one but it hasn't been updated in 3 years and only supports text-fields.&lt;/p&gt;&#xA;" OwnerUserId="5692" LastActivityDate="2016-11-30T21:47:15.167" Title="Data encryption" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17961" PostTypeId="1" AcceptedAnswerId="17971" CreationDate="2016-11-30T15:16:48.407" Score="2" ViewCount="187" Body="&lt;p&gt;Is there a way to force a request type (&lt;code&gt;HttpRequestService::isCpRequest&lt;/code&gt; vs. &lt;code&gt;HttpRequestService::isSiteRequest&lt;/code&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I'm generating some indexing data on &lt;code&gt;entries.onSaveEntry&lt;/code&gt;. I'm trying to use some &lt;code&gt;UrlHelper&lt;/code&gt; methods, but the resulting urls are wrong, since it thinks it is a cp request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to do something like this load templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do something similar for request type?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2016-12-01T08:36:25.920" Title="How can I force a request type (HttpRequestService::isCpRequest vs. HttpRequestService::isSiteRequest)?" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17962" PostTypeId="2" ParentId="17904" CreationDate="2016-11-30T15:38:46.147" Score="2" Body="&lt;p&gt;For sake of completeness: the problem was that FeedMe was checking for statuscode 200 (http ok) instead of 226 that is used to determine a successful FTP transaction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been fixed in the latest FeedMe 2.0.0 branch that can be found on &lt;a href=&quot;https://github.com/engram-design/FeedMe/tree/2.0.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/FeedMe/tree/2.0.0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="397" LastActivityDate="2016-11-30T15:38:46.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17963" PostTypeId="1" CreationDate="2016-11-30T16:00:27.580" Score="1" ViewCount="114" Body="&lt;p&gt;I'm using Craft Commerce with the default checkout template. At the step of completing addresses, only First Name, Last Name &amp;amp; Country are required fields by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I'll sell non-digital products, other fields like Address, City, Zip Code must be required and the next step of the checkout process (i.e. Shipping) should not be reached if some fields are still empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make these other fields required with Craft validation ?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2016-11-30T16:00:27.580" Title="How to set other fields as required in Craft Commerce checkout process?" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;&lt;validation&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2016-12-01T10:04:20.533" ContentLicense="CC BY-SA 3.0" />
  <row Id="17964" PostTypeId="1" AcceptedAnswerId="17965" CreationDate="2016-11-30T16:39:00.947" Score="1" ViewCount="223" Body="&lt;p&gt;I'm trying to use a custom action with Charge. When a successful charge has been made I want to edit a user field. Charge appears to have Actions but little documentation on how they should be used ( &lt;a href=&quot;http://demos.squarebit.co.uk/charge/actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://demos.squarebit.co.uk/charge/actions&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I had opened charge/services/Charge_ActionsService.php and created a new one in there, which worked...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function triggerActionCredits($details, ChargeModel $chargeModel)&#xA;{&#xA;    craft()-&amp;gt;charge_log-&amp;gt;action('Credits action triggered successfully');&#xA;&#xA;    if (!is_array($details)) {&#xA;        craft()-&amp;gt;charge_log-&amp;gt;action(&quot;Details passed were: $details&quot;);&#xA;    } else {&#xA;        $detailsAsString = print_r($details);&#xA;        craft()-&amp;gt;charge_log-&amp;gt;action(&quot;Details passed were: $detailsAsString&quot;);&#xA;    }&#xA;&#xA;    $userID = $chargeModel-&amp;gt;userId;&#xA;    $theUser = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;    $currentCredits = $theUser-&amp;gt;creditsAvailable;&#xA;&#xA;    craft()-&amp;gt;charge_log-&amp;gt;action(&quot;Got the user: $theUser&quot;);&#xA;    craft()-&amp;gt;charge_log-&amp;gt;action(&quot;Current credits: $currentCredits&quot;);&#xA;    craft()-&amp;gt;charge_log-&amp;gt;action(&quot;Details passed were: $detailsAsString&quot;);&#xA;&#xA;    ... do stuff ...&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this should really be a plugin - so I've tried to port that code out of the Actions file and into its own plugin as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('charge.onCharge', function($charge){&#xA;        craft()-&amp;gt;charge_log-&amp;gt;action('Credits action triggered successfully');&#xA;&#xA;        $pounds = $charge-&amp;gt;amount;&#xA;        ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that the line &lt;code&gt;$pounds = $charge-&amp;gt;amount;&lt;/code&gt; is throwing an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Property &quot;Craft\Event.amount&quot; is not defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But; the event should be getting a Charge model? What am I doing wrong? &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/developer/hooks-and-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://squarebit.co.uk/software/craft/charge/usage/developer/hooks-and-events&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/models/charge-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://squarebit.co.uk/software/craft/charge/usage/models/charge-model&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-11-30T17:14:42.737" Title="Custom action with Charge" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17965" PostTypeId="2" ParentId="17964" CreationDate="2016-11-30T17:14:42.737" Score="2" Body="&lt;p&gt;You want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onCharge', function($event)&#xA;{&#xA;    $charge = $event-&amp;gt;params['charge'];&#xA;&#xA;    $pounds = $charge-&amp;gt;amount;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2016-11-30T17:14:42.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17966" PostTypeId="1" CreationDate="2016-11-30T17:19:40.033" Score="1" ViewCount="215" Body="&lt;p&gt;I'm using composer to import a third-party (vendor) plugin into my own Craft plugin. But can't figure out how I extend the functionality of the imported (vendor) plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example assuming imported plugin defines a base class of &lt;code&gt;XXX&lt;/code&gt; I can try to extend this with &lt;code&gt;class YYY extends \XXX&lt;/code&gt; but not sure where I save this so I can access this in my code, eg I want to extend the base plugin through a class, eg&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class YYY extends \XXX&#xA;{&#xA;    public function doThis($str) { return $str; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd then want to access this in my Craft plugin with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$var = new \XXX();&#xA;$var-&amp;gt;doThis = 'CONTENT HERE';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously grossly simplified but hope you get the gist.&#xA;Just can't figure out how to achieve above or where I should save the code that is extending the vendor class?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2016-11-30T21:49:29.267" LastActivityDate="2016-11-30T21:55:11.390" Title="Plugin Development: extending a vendor plugin" Tags="&lt;plugin-development&gt;&lt;extends&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17967" PostTypeId="2" ParentId="17959" CreationDate="2016-11-30T21:11:43.943" Score="3" Body="&lt;p&gt;Pretty sure the &lt;a href=&quot;https://craftcms.com/docs/config-settings#invalidUserTokenPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;invalidUserTokenPath&lt;/a&gt; config setting is what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-30T21:11:43.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17968" PostTypeId="2" ParentId="17960" CreationDate="2016-11-30T21:47:15.167" Score="3" Body="&lt;p&gt;You might want to re-think/clarify your strategy here. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it only custom fields you want to encrypt? Or maybe only specific fields (not every custom one).  Encrypting every bit of data (custom field or not) in a database has &lt;a href=&quot;https://stackoverflow.com/a/7252046/684&quot;&gt;many&lt;/a&gt; drawbacks.  And it doesn't make sense in most cases since 99% of the data in a Craft install usually isn't considered sensitive.  i.e. What does it matter if someone that gets access to your database knows the asset ID for &lt;code&gt;cat.jpg&lt;/code&gt; is &lt;code&gt;5&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Encryption/decryption requires a key to be stored somewhere, too. Encryption uses that key to encrypt the data and decryption uses it to decrypt the data.  Chances are, if someone has access to your database, then there's a good chance they'll have access to that key as well.  Because if Craft/PHP is the one doing the encryption/decryption, then the code will need to be able to read that key wherever it might be stored.  And if PHP can read the key, then an attacker probably could as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/romainwurtz/SecureField-Craft/blob/master/secureField/fieldTypes/SecureField_SecureFieldType.php#L64&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; you linked simply provides a single custom field type that will encrypt any data that is entered into it, but it has a design flaw in that the encryption key is actually stored in the database. So if the database is compromised, then it's trivial to decrypt the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MySQL has some &lt;a href=&quot;https://serverfault.com/a/538738/232999&quot;&gt;native support&lt;/a&gt; for encryption/decryption at the field level where you have to pass in a key with those SQL queries, but that would probably need to be done in the context of a Craft plugin that was maintaining its own database tables.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2016-11-30T21:47:15.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17969" PostTypeId="2" ParentId="17966" CreationDate="2016-11-30T21:55:11.390" Score="2" Body="&lt;p&gt;In your example, if you do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$var = new \XXX();&#xA;$var-&amp;gt;doThis = 'CONTENT HERE';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then &lt;code&gt;doThis&lt;/code&gt; will never exist for class &lt;code&gt;\XXX&lt;/code&gt; because &lt;code&gt;\XXX&lt;/code&gt; isn't where the method was defined.  It would work from your extended class, though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$var = new YYY();&#xA;$var-&amp;gt;doThis = 'CONTENT HERE';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that (usually) if the vendor plugin instantiates any instances of that class internally, it will always be of instance &lt;code&gt;\XXX&lt;/code&gt;, not your &lt;code&gt;YYY&lt;/code&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where that wouldn't be true, is if the vendor plugin supports &lt;a href=&quot;https://en.wikipedia.org/wiki/Dependency_injection&quot; rel=&quot;nofollow noreferrer&quot;&gt;dependency injection&lt;/a&gt; where they allow you to inject your extended &lt;code&gt;YYY&lt;/code&gt; class wherever &lt;code&gt;\XXX&lt;/code&gt; would usually be referenced.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-11-30T21:55:11.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17971" PostTypeId="2" ParentId="17961" CreationDate="2016-12-01T08:36:25.920" Score="2" Body="&lt;p&gt;There's no &lt;code&gt;setRequestType()&lt;/code&gt; method or the like, no. The &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#isCpRequest-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;HttpRequestService&lt;/a&gt; will consider any request with the &lt;code&gt;cpTrigger&lt;/code&gt; in its URL a control panel request, and I don't see any easy way around that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a bit convoluted, but what you could do is to wrap whatever code you're currently executing in your &lt;code&gt;entries.onSaveEntry&lt;/code&gt; in a controller action method, and then use &lt;a href=&quot;http://guzzle3.readthedocs.io/docs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guzzle&lt;/a&gt; in your &lt;code&gt;onSaveEntry&lt;/code&gt; event handler to trigger a &lt;em&gt;site&lt;/em&gt; request (i.e. a request &lt;em&gt;without&lt;/em&gt; the &lt;code&gt;cpTrigger&lt;/code&gt; in the URL) to that action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how your controller action could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?&#xA;namespace Craft;&#xA;&#xA;class MyPluginController extends BaseController&#xA;{&#xA;&#xA;    protected $allowAnonymous = ['actionGenerateIndex'];&#xA;&#xA;    public function actionGenerateIndex ()&#xA;    {&#xA;&#xA;        // Get entry (based on a ?entryId URL parameter&#xA;        $entryId = craft()-&amp;gt;request-&amp;gt;getParam('entryId');&#xA;        $entry = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;            'id' =&amp;gt; $entryId,&#xA;        ])-&amp;gt;first();&#xA;&#xA;        // ...your code to generate the index data here&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's how you could fire off a request to this action using Guzzle, stripping the &lt;code&gt;cpTrigger&lt;/code&gt; from the action URL to make sure Craft treats the action as a site request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onSaveEntry', function (Event $e) {&#xA;&#xA;    // Get entry&#xA;    $entry = $e-&amp;gt;params['entry'];&#xA;&#xA;    // Get action URL, strip the `cpTrigger` segment&#xA;    $actionUrl = UrlHelper::getActionUrl('myPlugin/generateIndex', [&#xA;        'entryId' =&amp;gt; $entry-&amp;gt;id,&#xA;    ]);&#xA;    $actionUrl = str_replace(craft()-&amp;gt;config-&amp;gt;get('cpTrigger').'/', '', $actionUrl);&#xA;&#xA;    // Request action&#xA;    $client = new Guzzle\Http\Client();&#xA;    $request = $client-&amp;gt;get($actionUrl, [], [&#xA;      'headers' =&amp;gt; [&#xA;        'X-Requested-With' =&amp;gt; 'XMLHttpRequest',&#xA;      ],&#xA;    ]);&#xA;    $request-&amp;gt;send();&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-01T08:36:25.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17972" PostTypeId="1" AcceptedAnswerId="17998" CreationDate="2016-12-01T10:46:10.317" Score="1" ViewCount="64" Body="&lt;p&gt;I need some advise on the best way to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have entries within a section which could belong to category A, B, C, D. Any of these entries could also belong to a Featured category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each category has it's own page, and from an entry you can go to the next or previous entry (within that category).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see how I can do this for the Featured entries as they also belong to another category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking I'll have to do something with the URLs so the entry knows its been clicked on from the 'Featured' category page rather than 'B' so the Previous and Next buttons stay within 'Featured'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my Next and Previous buttons code on the entry template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('galleries').relatedTo(categories.galleries) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;&#xA;&amp;lt;div class=&quot;previous-next-links align-right&quot;&amp;gt;&#xA;    {% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot; class=&quot;cta-link prev cta-link--back&quot;&amp;gt;Prev&amp;lt;/a&amp;gt; |{% endif %}&#xA;&#xA;    {% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot; class=&quot;cta-link next&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;span class=&quot;cta-link cta-link--inactive next&quot;&amp;gt;Next&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2016-12-04T20:15:05.490" LastActivityDate="2016-12-04T20:15:05.490" Title="Navigating through entries within a category when they belong to multiple" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17973" PostTypeId="1" AcceptedAnswerId="17976" CreationDate="2016-12-01T13:32:00.080" Score="2" ViewCount="399" Body="&lt;p&gt;I hope this question does not sound to banal:&#xA;I am currently switching to Craft CMS and I am used to build my HTML/CSS/JS templates as static pages with dummy content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This (seemingly?) has 3 advantages for me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have an early, clickable prototype, presentable to the client&#xA;before I have to touch any CMS&lt;/li&gt;&#xA;&lt;li&gt;I am not forced to insert real content via the CMS yet &lt;/li&gt;&#xA;&lt;li&gt;It gives me a very clean Git Repository for the frontend without any&#xA;CMS dependencies yet&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The disadvantage is of course that I have to manually split my static pages up later to work with Craft CMS (or any other CMS) templating logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus I was wondering how you approach templating, especially with Craft: Whether you start directly building your frontend from scratch in Craft’s Templates folder or if you start independently, and do the splitting of files every time as a necessary step …&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastEditorUserId="57" LastEditDate="2016-12-01T21:06:05.957" LastActivityDate="2016-12-06T00:36:25.993" Title="Best Practice for Templating-Workflow, coming from static HTML" Tags="&lt;templating&gt;&lt;workflow&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17976" PostTypeId="2" ParentId="17973" CreationDate="2016-12-01T15:11:46.100" Score="4" Body="&lt;p&gt;We used to do what you are doing, for a good many years - it was especially helpful when we didn't know what CMS we were going to use yet, or when we had a front end specialist (hello) who would send the files off to the back end specialist for implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, with Craft, we've found that the front-end people can use it well enough to not need a 'back end specialist', so we find ourselves no longer doing site builds as front-end assets first. It's just faster and easier to build the HTML/CSS/JS from inside the Craft templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also used to (and still do for larger projects) build a completely non-styled &quot;blueprint&quot; of the website. The objective was to ensure that the site structure was correct - here's an example: &lt;a href=&quot;http://example.bp.myvcsite.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.bp.myvcsite.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was/is part of our whole approach where we split things into blueprint; visuals; static build; CMS integration: &lt;a href=&quot;http://example.myvcsite.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.myvcsite.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-12-01T15:11:46.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17978" PostTypeId="1" AcceptedAnswerId="17982" CreationDate="2016-12-02T16:21:23.107" Score="2" ViewCount="133" Body="&lt;p&gt;I have been working with data received from Guzzle and it is producing a Unicode String that looks similar to this &lt;code&gt;Bachelor\u2019s Degree&lt;/code&gt; (after some parsing). When I save other content within craft through &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry( $entry )&lt;/code&gt; The unicode items are converted to their appropriate characters. However, when I use this in the ElementCriteriaModel searches, it does not work because it is using the literal &lt;code&gt;Bachelor\u2019s Degree&lt;/code&gt;. It does work when I hard code &lt;code&gt;Bachelor's Degree&lt;/code&gt; so the lookup code is functional. Also, I tried all of the &lt;code&gt;StringHelper&lt;/code&gt; static functions and have done tons of iterations of &lt;code&gt;mb_convert_encoding( 'Bachelor\u2019s Degree', 'HTML-ENTITIES', 'utf-8' )&lt;/code&gt;, &lt;code&gt;htmlspecialchars&lt;/code&gt;, and &lt;code&gt;htmlentities&lt;/code&gt;, but it has not produced a good result. Here is the code I am using for the query just in case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria( ElementType::Category );&#xA;$criteria-&amp;gt;title = $job[ 'eduReq' ];&#xA;$eduReq = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you all know how to convert this string correctly so that the ElementCriteriaModel uses &lt;code&gt;Bachelor's Degree&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4026" LastEditorUserId="57" LastEditDate="2016-12-02T18:11:40.297" LastActivityDate="2016-12-02T18:11:40.297" Title="ElementCriteriaModel UTF-8 Encoding" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17980" PostTypeId="1" AcceptedAnswerId="18133" CreationDate="2016-12-02T17:03:01.893" Score="1" ViewCount="214" Body="&lt;p&gt;I'm working on a profile management form for a site with public registration enabled. I'd like users to be able to change their email address. I've got it working as Craft intended -- they enter their email + current password, a &quot;Verify new email address&quot; email is triggered, and following the verification link updates their email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The UX wall I'm hitting is that a) the user is logged out when click the verification link and b) they get no messaging around whether or not the email was actually changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've reviewed the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L409-L433&quot; rel=&quot;nofollow noreferrer&quot;&gt;code&lt;/a&gt; and don't see any way to improve this experience. I found &lt;a href=&quot;https://github.com/craftcms/cms/issues/1421&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1421&lt;/a&gt; but the workaround in there seems heavy handed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come up with an elegant solution for this?&lt;/p&gt;&#xA;" OwnerUserId="5911" LastEditorUserId="8180" LastEditDate="2018-04-01T06:04:04.827" LastActivityDate="2018-04-01T06:04:04.827" Title="UX issue with new email verification link" Tags="&lt;emails&gt;&lt;frontend&gt;&lt;user-profile&gt;&lt;verification&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17982" PostTypeId="2" ParentId="17978" CreationDate="2016-12-02T17:55:05.320" Score="2" Body="&lt;p&gt;Could this maybe be a unicode issue? Maybe the api plugin is producing \u2019 instead of the unicode to produce a normal &lt;code&gt;'&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2016-12-02T17:55:05.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17983" PostTypeId="2" ParentId="17689" CreationDate="2016-12-02T17:57:41.967" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/changelog#build1328&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce 1.2.1238&lt;/a&gt; added support for the REST based Multi-Safepay gateway. &lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2016-12-02T18:12:46.763" LastActivityDate="2016-12-02T18:12:46.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17984" PostTypeId="2" ParentId="17817" CreationDate="2016-12-02T19:59:06.033" Score="0" Body="&lt;p&gt;For the people who needs something similar. The basic auth function for the Element API.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function requireLogin()&#xA;{&#xA;    header(&quot;Access-Control-Allow-Origin: *&quot;);&#xA;    header(&quot;Access-Control-Allow-Headers: X-Requested-With&quot;);&#xA;&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;isLoggedIn()) {&#xA;        // you are authenticated&#xA;    } else {&#xA;        // check params&#xA;        $loginName = craft()-&amp;gt;request-&amp;gt;getQuery('loginName');&#xA;        $password = craft()-&amp;gt;request-&amp;gt;getQuery('password');&#xA;&#xA;        if (craft()-&amp;gt;userSession-&amp;gt;login($loginName, $password)) {&#xA;            // login success&#xA;            $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        } else {&#xA;            // login fails echo message&#xA;            $errorCode = craft()-&amp;gt;userSession-&amp;gt;getLoginErrorCode();&#xA;            $errorMessage = craft()-&amp;gt;userSession-&amp;gt;getLoginErrorMessage($errorCode, $loginName);&#xA;            craft()-&amp;gt;end(JsonHelper::encode(array('data' =&amp;gt; array( ['status' =&amp;gt; 'error','message' =&amp;gt;'wrong login']  ))));&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you use these params in your url: &lt;code&gt;?loginName=username&amp;amp;password=yourpass&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2016-12-02T21:48:41.403" LastActivityDate="2016-12-02T21:48:41.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17985" PostTypeId="1" CreationDate="2016-12-02T20:25:22.603" Score="1" ViewCount="111" Body="&lt;p&gt;I'm just in the process of migrating a site from staging to live. I've pushed everything over and have copied/moved a license.key file from a site that we're no longer using to this one. However, when I log into the backend, I'm stll getting the &lt;code&gt;You’re running Craft Pro with a Craft Personal license.&lt;/code&gt; message at the top. If I click on 'Resolve' - I get a spinner modal and nothing else happens, until eventually I get &lt;code&gt;An unknown error occurred&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running version &lt;code&gt;Craft CMS 2.6.2952&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm presuming it's not able to phone home for some reason to validate the license key - but I'm unsure what could be stopping it? Anyone?&lt;/p&gt;&#xA;" OwnerUserId="5031" LastActivityDate="2016-12-02T21:39:43.447" Title="Local and Staging Environments allow for updates, Live doesn't (and doesn't recognise the license.key)" Tags="&lt;license&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17986" PostTypeId="2" ParentId="17985" CreationDate="2016-12-02T20:29:59.697" Score="1" Body="&lt;p&gt;The problem is that I had disabled a few PHP functions as part of a security tweak.... I'm assuming it's using cURL to make the request to phone home.&lt;/p&gt;&#xA;" OwnerUserId="5031" LastEditorUserId="57" LastEditDate="2016-12-02T21:39:43.447" LastActivityDate="2016-12-02T21:39:43.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17987" PostTypeId="2" ParentId="17973" CreationDate="2016-12-02T23:01:01.287" Score="3" Body="&lt;p&gt;Tobias: I don't think there's a &quot;right&quot; answer for everyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do find is that Craft &quot;gets out the way&quot; a lot more. Craft's file structure and Twig templates aren't that far away from just static HTML. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can actually throw an &lt;code&gt;index.html&lt;/code&gt; file inside Craft's &lt;code&gt;templates&lt;/code&gt; folder and Craft will serve it just fine. All the stuff you need to grab from the database just won't pull in. Then when you're ready to break out the &lt;code&gt;header&lt;/code&gt; and &lt;code&gt;footer&lt;/code&gt; into the &lt;code&gt;_layout&lt;/code&gt; template and hit the CMS, it's ready for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other CMS, for example WordPress, where it expects a theme to work in a certain way and live in a certain folder structure, Craft is a bit more flexible in this respect.  (In WP land can change these defaults of course and use something like Timber but that's getting off track.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We try to get a lot of the content roughed in as early as possible because it can dictate design decisions. A lot of designers work backwards and make content fit the layout. I find Craft fits our &quot;content first&quot; methodology a bit better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We still produce static comps, get design approval and then build from those but a lot of people design in the browser because they find it faster and can show off a responsive design better. I'd argue Craft is no better or worse in this respect. I tend to switch from &quot;design mode&quot; to &quot;programming&quot; mode; when a design I created is set, then I figure out how to make it work, oftentimes incorporating the content we setup with the client at the same time. In this way, we are able to show the client a more &quot;complete&quot; website. At that point, we're just tweaking image and copy.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2016-12-02T23:01:01.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17988" PostTypeId="1" AcceptedAnswerId="17989" CreationDate="2016-12-03T08:55:45.567" Score="2" ViewCount="1408" Body="&lt;p&gt;i am trying to figure out the right way to display elements on a page.&#xA;Its about a website for a fashion designer. There will be parent elements like :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent X&lt;/li&gt;&#xA;&lt;li&gt;Parent Y &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;both of those elements use the same template and i used structure for it. i figured structure is the right choice because of the ability to sort them in the panel etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be possible to add child elements to the parents like &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parent X&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item a&lt;/li&gt;&#xA;&lt;li&gt;Item b &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Parent Y&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item c&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;those elements are using a different template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like &#xA;- ParentTemplate/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &#xA;- ParentTemplate/ItemTemplate/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how can i structure them in the craft panel without making them a new structure, because the new structure isnt related to parents then anymore , what they have to be ... ot is it the wrong approach here ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks a lot guys &lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2016-12-03T09:12:59.663" LastActivityDate="2016-12-04T17:40:33.503" Title="How to manage different templates for a structure" Tags="&lt;entries&gt;&lt;structure&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17989" PostTypeId="2" ParentId="17988" CreationDate="2016-12-03T12:19:29.553" Score="4" Body="&lt;p&gt;Your approach looks good to me. There are different ways you can make it happen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set up your structure in the CP you can decide how many levels you want to allow for that structure. (By default the number of levels is not limited.) If you have entered at least one parent entry in your structure, you can assign child entries in two ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 – When you create a new entry you can choose a parent for that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 – If you miss that step or you change your mind later, you can move your entries around in the structure entries list: Choose your structure under „Entries“, klick and hold the cross in front of the entry you want to move and then drag it to the desired location. (So it´s possible to move a child entry from one parent to another later on.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the templates for this set up, you have different options as described here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16249/how-to-load-a-different-template-for-parent-page&quot;&gt;How to load a different template for parent page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibly interesting solution would be „Entry types“. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you find that your parent entries would also use different fields than your child entries it could make sense to define a second entry type for the children in that section (&lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/sections-and-entries&lt;/a&gt;). When you define the „child&quot; entry type, you assign fields to that just like for the first (parent) entry type. If you now enter a new entry for the section you can choose between the entry types and then are presented with the different field sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the templates you can still use the first solution but now you could change the layouts based on entry types as well:&#xA;In your template for single entries you could something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == &quot;child&quot; %}&#xA;    {% include &quot;sectionTemplateFolder/_types/child&quot; %}&#xA;{% else %}&#xA;    {% include &quot;sectionTemplateFolder/_types/parent&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(This example assumes that you have an actual entry type called „child“, replace the „child“ in the if statement with your desired name.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An elegant solution how to change layouts between several entry types is given here:&#xA;&lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entry-type-templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever approach you take you do not need to structure your templates like your entries. Within the Craft templates folder, the templates can live where it makes the most sense to you. For the entry-type example it could be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sectionName (folder)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;index.html (for listing)&lt;/li&gt;&#xA;&lt;li&gt;_entry.html (for the single entries)&lt;/li&gt;&#xA;&lt;li&gt;_types (folder)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;child.html&lt;/li&gt;&#xA;&lt;li&gt;parent.html&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helps?&lt;/p&gt;&#xA;" OwnerUserId="549" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-12-04T17:40:33.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17990" PostTypeId="1" AcceptedAnswerId="17995" CreationDate="2016-12-03T23:35:29.093" Score="2" ViewCount="489" Body="&lt;p&gt;how would I go about setting up a route and twig template to filter by multiple tags?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Example URL scheme: example.com/tags/tag1/tag2/tag3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;tag1&lt;/code&gt;, &lt;code&gt;tag2&lt;/code&gt; and &lt;code&gt;tag3&lt;/code&gt; are tags defined in a tag field inside an entry. The resulting entries list should only output entries with &lt;code&gt;tag1&lt;/code&gt; &lt;strong&gt;AND&lt;/strong&gt; &lt;code&gt;tag2&lt;/code&gt; &lt;strong&gt;AND&lt;/strong&gt; &lt;code&gt;tag3&lt;/code&gt;. &lt;code&gt;tag2&lt;/code&gt; and &lt;code&gt;tag3&lt;/code&gt; should be optional. I want to avoid the use of get params such as ?tag=tag1,tag2,tag3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ultimate goal is chain multiple tags to get finer results, similar to pinboard.in tag chaining. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;a href=&quot;https://pinboard.in/t:javascript/t:css/t:webdev&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pinboard.in/t:javascript/t:css/t:webdev&lt;/a&gt;&#xA;will return entries with &lt;code&gt;javascript&lt;/code&gt; AND &lt;code&gt;css&lt;/code&gt; AND &lt;code&gt;webdev&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My route looks as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;URI: tags/tag-token/tag-taken2/tag-token3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my twig template looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(tag) %}&#xA;&#xA;{% if craft.request.getSegment(2) !='' %}&#xA;&amp;lt;h1&amp;gt;Entries tagged with “{{ tag.title }}”&amp;lt;/h1&amp;gt;&#xA;{% if entries | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}..&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with that tag.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% if craft.request.getSegment(3) !='' %}&#xA;{% set tag2entries = craft.entries.relatedTo('and',&#xA;    { element: entry, field: 'tags' },&#xA;    { element: entries, field: 'tags' }&#xA;) %}&#xA;{% set tag2entries = craft.entries.relatedTo(tag2-token) %}&#xA;&amp;lt;h1&amp;gt;Entries tagged with “{{ tag.title }} and {{ tag-token2}}”&amp;lt;/h1&amp;gt;&#xA;{% if tag2entries | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in tag2entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}..&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with those tags.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;{% endif %}&#xA;&#xA;{% if craft.request.getSegment(4) !='' %}&#xA;{% set tag3entries = craft.entries.relatedTo(tag3-token) %}&#xA;&amp;lt;h1&amp;gt;Entries tagged with “{{ tag.title }} and {{ tag-token2}} and {{tag-token3}}”&amp;lt;/h1&amp;gt;&#xA;{% if tag3entries | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in tag3entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}..&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with those tags.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm am not sure how to go about using the relatedTo() function to filter entries based on those 3 tag parameters in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight on how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2016-12-05T06:40:09.603" Title="Display entries that meet multiple tag params" Tags="&lt;templating&gt;&lt;tags&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17991" PostTypeId="1" AcceptedAnswerId="18025" CreationDate="2016-12-04T00:47:31.540" Score="8" ViewCount="417" Body="&lt;p&gt;We are currently working on a Craft project with 3 developers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our setup:&#xA;3 Local machines running Laravel Homestead and a local DB + Craft.&#xA;1 remote server holding Craft + db.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our workflow:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;We are using Github for version control of our local files.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the DB we are currently using a dumb workaround we are very unhappy with :) . We are saving the DB in the craft-cp and git pushing the export to whatever branch we are working in. Then the next person has to import it locally whenever he makes changes to it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We just thought using the same remote db on our server would be a better idea. Any better ideas? Is there something as good as Github but for DBs?&lt;br&gt;&#xA;Or is there a better way to collaborate on a craft project anyway?&lt;/p&gt;&#xA;" OwnerUserId="5954" LastEditorUserId="22" LastEditDate="2017-05-09T20:43:12.640" LastActivityDate="2017-05-09T20:43:12.640" Title="Developing in Teams - What is the best Craft setup?" Tags="&lt;setup&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17992" PostTypeId="1" AcceptedAnswerId="17996" CreationDate="2016-12-04T01:00:45.200" Score="1" ViewCount="536" Body="&lt;p&gt;With FeedMe I'm importing some data and one of them I get is a complete array that is stored a plain text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This array is a bunch of car options what I want to add in a table like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = entry.optionsAndAccessoiries %}&#xA;&#xA;output {{ options }} = [&quot;Achterbank in delen neerklapbaar&quot;,&quot;Airbag bestuurder&quot;,&quot;Airconditioning&quot;,&quot;Anti-slipregeling&quot;,&quot;Antiblokkeersysteem&quot;,&quot;Centrale deurvergrendeling afstandbediend&quot;,&quot;Elektrisch bedienbare ramen voor&quot;,&quot;Elektrisch verstelbare buitenspiegels&quot;,&quot;Getint glas&quot;,&quot;Hoofdsteunen achter&quot;,&quot;Hoofdsteunen voor&quot;,&quot;In hoogte verstelbare bestuurdersstoel&quot;,&quot;Metallic lak&quot;,&quot;Middenarmsteun voor&quot;,&quot;Mistlampen voor&quot;,&quot;Radio\/CD speler&quot;,&quot;Startonderbreker&quot;,&quot;Stoelverwarming bestuurder&quot;,&quot;Stoffen bekleding&quot;,&quot;Stuurbekrachtiging&quot;,&quot;Trekhaak&quot;,&quot;Verstelbaar stuurwiel&quot;]&#xA;&#xA;{% set items = options %}&#xA;&#xA; &amp;lt;table&amp;gt;&#xA;  {% for row in items|batch(3, 'No item') %}&#xA;  &amp;lt;tr&amp;gt;&#xA;    {% for column in row %}&#xA;    &amp;lt;td&amp;gt;{{ column }}&amp;lt;/td&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/tr&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is causing an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array_chunk() expects parameter 1 to be array, string given&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Who can help me out to point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="57" LastEditDate="2016-12-04T02:16:06.943" LastActivityDate="2016-12-04T10:10:51.487" Title="How to convert this 'array'" Tags="&lt;entrymodel&gt;&lt;array&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17993" PostTypeId="1" AcceptedAnswerId="17994" CreationDate="2016-12-04T01:19:28.750" Score="1" ViewCount="138" Body="&lt;p&gt;Is there a way to dynamically get all the related products based on the product type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to be getting all the products regardless of product type when I use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(category).order('postDate desc') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(obviously since I don't have any categories).&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2016-12-04T07:08:32.530" Title="relatedTo using product type?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17994" PostTypeId="2" ParentId="17993" CreationDate="2016-12-04T02:21:08.513" Score="1" Body="&lt;p&gt;I'm a little unclear but I think you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.type('productTypeHandle').order('postDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2016-12-04T07:08:32.530" LastActivityDate="2016-12-04T07:08:32.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17995" PostTypeId="2" ParentId="17990" CreationDate="2016-12-04T09:44:40.817" Score="1" Body="&lt;p&gt;Ideally, you'll use a dynamic route that can match any number of tags – negating the need to hard code the number of possible tag segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't pull this off using the Routes admin inside the CP, so crack open your &lt;strong&gt;/craft/config/routes.php&lt;/strong&gt; file and add this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'tags/(.+)' =&amp;gt; 'path_to_your_tags_template',&#xA;); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above route can have any number of segments under &lt;code&gt;/tags&lt;/code&gt;, but will require at least one. &lt;em&gt;Be sure to delete any conflicting routes defined in Settings -&gt; Routes!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside your tags template, you can get an array of all the tags in the URI like this (the &lt;code&gt;|slice(1)&lt;/code&gt; part removes the first segment, i.e. &quot;tags&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagSegments = craft.request.segments|slice(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pull the actual tags, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags.slug(tagSegments) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pulling it all together, here's how a (simplified) version of your template could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get tags #}&#xA;{% set tagSegments = craft.request.segments|slice(1) %}&#xA;{% set tags = craft.tags.slug(tagSegments) %}&#xA;&#xA;{# Get entries related to tags #}&#xA;{% set relatedTo = [] %}&#xA;{% for tagId in tags.ids() %}&#xA;    {% set relatedTo = relatedTo|merge([{&#xA;        targetElement: tagId,&#xA;        field: 'tags'&#xA;    }]) %}&#xA;{% endfor %}&#xA;{% if relatedTo|length &amp;gt; 1 %}&#xA;    {% set relatedTo = ['and']|merge(relatedTo) %}&#xA;{% endif %}&#xA;{% set entries = craft.entries.relatedTo(relatedTo) %}&#xA;&#xA;{% if entries|length %}&#xA;    &amp;lt;h1&amp;gt;Entries tagged with {% for tag in tags %}{{ tag.title }}{% if not loop.last %}{{ loop.revindex == 2 ? ' and' : ',' }}{% endif %}{% endfor %}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}..&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with {{ tagSegments|length &amp;gt; 1 ? 'those tags' : 'that tag' }}.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-05T06:40:09.603" LastActivityDate="2016-12-05T06:40:09.603" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17996" PostTypeId="2" ParentId="17992" CreationDate="2016-12-04T10:10:51.487" Score="2" Body="&lt;p&gt;Sounds like your options simply need to be JSON decoded. Unfortunately, Twig doesn't ship with a &lt;code&gt;json_decode&lt;/code&gt; filter, so you'll need a plugin – there are &lt;a href=&quot;https://straightupcraft.com/craft-plugins?q=json&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;several that fit the bill over at StraightUpCraft&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/json-decode-twig-filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSON Decode Filter&lt;/a&gt; plugin, here's how your code would look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = entry.optionsAndAccessoiries|json_decode %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-04T10:10:51.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17997" PostTypeId="2" ParentId="6799" CreationDate="2016-12-04T14:16:42.910" Score="2" Body="&lt;p&gt;Adding to Paul Verheul's excellent answer (and to answer question by Floriskoch) — to test for the existence of a category before creating it, you might try something like the following (untested).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get category group from known id&#xA;$categoryGroup = craft()-&amp;gt;categories-&amp;gt;getGroupById(2);&#xA;&#xA;// Find categories matching group and title&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = $categoryGroup;&#xA;$criteria-&amp;gt;title = &quot;My Category Title&quot;;&#xA;$criteria-&amp;gt;limit = null;&#xA;$categories = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&#xA;// 1 or more matching categories exist; select first category&#xA;if($categories) {&#xA;    $categoryId = $categories[0]-&amp;gt;id; // only want first category if more than one with the same title&#xA;&#xA;// no categories exist; create category&#xA;} else {&#xA;    $category = new CategoryModel();&#xA;    $category-&amp;gt;groupId = 2;&#xA;    $category-&amp;gt;getContent()-&amp;gt;title = 'My new category title';&#xA;    if(craft()-&amp;gt;categories-&amp;gt;saveCategory($category)) {&#xA;        $categoryId = $category-&amp;gt;id;&#xA;    }&#xA;}&#xA;&#xA;// double check we have a category id&#xA;if($categoryId) {&#xA;    $entryModel = new EntryModel();&#xA;    $entryModel-&amp;gt;title = 'My entry's title';&#xA;    $entryModel-&amp;gt;myCategoryFieldHandle[] = $categoryId;&#xA;&#xA;    if(craft()-&amp;gt;entries-&amp;gt;saveEntry($entryModel)) {&#xA;        ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-12-04T14:16:42.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17998" PostTypeId="2" ParentId="17972" CreationDate="2016-12-04T15:33:32.723" Score="2" Body="&lt;p&gt;I think you are on the right track, in that you will likely need to create a separate route for the entries when they are 'featured', so that you can configure the nav properly in the template. I can think of a few ways to do this (and I'm sure there are more).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Add a custom route, adding a '/featured/' segment to the uri. Then in the entries template test for the segment, and modify the entries ('params') and the nav accordingly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isFeatured = (craft.request.getSegment(2) == 'featured') ? true : false %}&#xA;{% if isFeatured %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.featured) %}&#xA;    {% nextUrl = siteUrl ~ '/featured/' ~ entry.getNext(params).slug %}&#xA;    {% prevUrl = siteUrl ~ '/featured/' ~ entry.getPrev(params).slug %}&#xA;{% else %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.galleries) %}&#xA;    {% nextUrl = entry.getNext(params).url %}&#xA;    {% prevUrl = entry.getPrev(params).url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Add a parameter to the uri (i.e. &lt;code&gt;?v=featured&lt;/code&gt; and test for the parameter in the template. Then pass the parameter on in the navigation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isFeatured = (craft.request.getParam('v') == 'featured') ? true : false %}&#xA;{% if isFeatured %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.featured) %}&#xA;    {% nextUrl = entry.getNext(params).url ~ '?v=featured' %}&#xA;    {% prevUrl = entry.getPrev(params).url ~ '?v=featured' %}&#xA;{% else %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.galleries) %}&#xA;    {% nextUrl = entry.getNext(params).url %}&#xA;    {% prevUrl = entry.getNext(params).url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Abstract the relationship by creating a new 'featured' entries channel, with an &lt;code&gt;entries&lt;/code&gt; field that links to the actual entry. Then the 'featured' category can link to the 'featured' entries (which are subsequently linked to the real entries). The featured template can then just include the normal entry with a variable &lt;code&gt;isFeatured=true&lt;/code&gt; or something.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// In 'featured' entry template&#xA;{% include 'mychannel/_entry' with { entry: entry.myEntriesField, isFeatured: true } only %}&#xA;&#xA;// In native entries template&#xA;{% if isFeatured %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.featured) %}&#xA;{% else %}&#xA;    {% set params = craft.entries.section('galleries').relatedTo(categories.galleries) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm sure there are more but one those might work.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-12-04T15:33:32.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17999" PostTypeId="2" ParentId="13591" CreationDate="2016-12-04T17:23:56.680" Score="1" Body="&lt;p&gt;You might find this helpful: &lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Environment Config for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-04T17:23:56.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18000" PostTypeId="2" ParentId="460" CreationDate="2016-12-04T17:24:53.107" Score="1" Body="&lt;p&gt;You might find this helpful: &lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Environment Config for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-04T17:24:53.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18001" PostTypeId="2" ParentId="1538" CreationDate="2016-12-04T17:29:25.020" Score="3" Body="&lt;p&gt;Yes, you can do this if you use the Imager plugin. Here's how: &lt;a href=&quot;https://nystudio107.com/blog/creating-optimized-images-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating Optimized Images in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-04T17:29:25.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18002" PostTypeId="1" AcceptedAnswerId="18073" CreationDate="2016-12-05T01:28:31.630" Score="1" ViewCount="136" Body="&lt;p&gt;I'm trying to create a &amp;quot;teaser&amp;quot; form in Sprout Forms.&lt;/p&gt;&#xA;&lt;p&gt;First form has radio buttons and a group of checkboxes, and it's easy to pass the radio value (via redirect), but I'm not finding the documentation on how to pass checkbox fields as URL params.&lt;/p&gt;&#xA;&lt;p&gt;Redirect: /contact/?radio_button={radio_value}&amp;amp;checkbox={fields-goals-1}&lt;/p&gt;&#xA;&lt;p&gt;The second form will accept those params and ask for contact information.&lt;/p&gt;&#xA;&lt;p&gt;Anyone got an example of how this?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1ehMi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ehMi.png&quot; alt=&quot;Screen shot of checkbox options&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5957" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2016-12-08T17:47:50.110" Title="Sprout Forms: Passing Checkbox variable in url parameter" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18003" PostTypeId="2" ParentId="1774" CreationDate="2016-12-05T01:59:35.363" Score="1" Body="&lt;p&gt;Just wanted to add some additional info for anyone who comes across this thread. I also needed to check if, and handle accordingly if a user belonged to a specific group upon registration from my plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what that looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onSaveUser', function (Event $event) {&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'User is getting created from CP.' : '');&#xA;&#xA;        if (isset($_POST['groups'])) {&#xA;            if (empty($_POST['groups'])) {&#xA;                // User does not have a user group.&#xA;            } else {&#xA;                foreach ($_POST['groups'] as $group) {&#xA;                    if ($group == 1) {&#xA;                        $this-&amp;gt;_registerAccount($event);&#xA;                    } else {&#xA;                        // Not who I'm looking for.&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    } else {&#xA;        error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'User is getting created from the front-end.' : '');&#xA;&#xA;        $this-&amp;gt;_registerAccount($event);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-12-05T01:59:35.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18004" PostTypeId="1" CreationDate="2016-12-05T05:16:21.400" Score="1" ViewCount="149" Body="&lt;p&gt;I have a plugin that is listening to the &lt;code&gt;onSaveProduct&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my product settings, in the &quot;Automatic SKU Format&quot; field I have: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{product.title}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way I am always working the main product title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the SKU, I want to only use the first initial of each word - so I am doing this from my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$default_sku = $event-&amp;gt;params['product']-&amp;gt;defaultVariant-&amp;gt;sku;&#xA;$expr = '/(?&amp;lt;=\s|^)[a-z]/i';&#xA;&#xA;preg_match_all($expr, $default_sku, $matches);&#xA;&#xA;$sku = strtoupper(implode('', $matches[0]));&#xA;&#xA;...&#xA;&#xA;error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'SKU: ' . $sku : '');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say I have &quot;My Super Product&quot; as the title. The above is generating this: &lt;strong&gt;MSP&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perfect!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, now I'm not sure how to go &lt;em&gt;back&lt;/em&gt; and re-save the product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to re-find the product and then set the &lt;code&gt;defaultSku&lt;/code&gt; and then re-save it? Not sure how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-12-06T00:41:22.567" Title="Commerce: How can I save a custom SKU from a plugin?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18005" PostTypeId="1" CreationDate="2016-12-05T06:29:10.843" Score="1" ViewCount="299" Body="&lt;p&gt;Is there a way to obfuscate an email address link that's generated by a global variable? I tried using Sprout's &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/encode-email/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Encode Email&lt;/a&gt;, but it doesn't seem to work with an email address I've generated by a global variable. Specifically, the global variable doesn't work within an anchor tag. For example, the following doesn't work with Sprout's Encode Email:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email = &quot;&amp;lt;a href='mailto:{{ emailContact.emailField }}'&amp;gt;{{ emailContact.emailField }}&amp;lt;/a&amp;gt;&quot; %}&#xA;{{ email | rot13 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the code above, &quot;emailContact&quot; is the global set and &quot;emailField&quot; is the associated handle for the actual email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd be great to figure this one out, especially because it seems a lot of folks would want to use a global variable for a contact email address. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5959" LastActivityDate="2016-12-06T10:51:07.783" Title="Obfuscating email set by global variable" Tags="&lt;craft3&gt;&lt;plugin-sproutemail&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18007" PostTypeId="2" ParentId="1538" CreationDate="2016-12-05T09:28:57.503" Score="0" Body="&lt;p&gt;Double check that the page speed reports are not flagging the images because you're rendering them at a smaller size than their natural pixel size. I believe it give a very similar message if you do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example; check you're not using a 1000px wide image and displaying it at only 700px. You'll want to look into the Picture element if that's happening and you're not already using it. In fact you'd want to use the picture element for different pixel densities too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en/docs/Web/HTML/Element/picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developer.mozilla.org/en/docs/Web/HTML/Element/picture&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-12-05T09:28:57.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18008" PostTypeId="1" AcceptedAnswerId="18041" CreationDate="2016-12-05T10:17:48.767" Score="1" ViewCount="190" Body="&lt;p&gt;I'm not a plugin developer, nor is my knowledge of PHP sufficient to handle this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a simple method or plugin, to be able to generate this PHP code in a template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?&#xA;$params=&quot;&quot;;&#xA;&#xA;foreach($_POST as $name=&amp;gt;$value)&#xA;{&#xA;    if ($name!=&quot;controllerPage&quot;)&#xA;    {&#xA;        $params=$params.$name.&quot;=&quot;.$value.&quot;&amp;amp;&quot;;&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the same template I need this code to retrieve the above&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;? echo $params; ?&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Who can show me the way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the POST data that is attached to the URL&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_POST=array (&#xA;'view' =&amp;gt; 'SearchResult',&#xA;'controllerPage' =&amp;gt; 'https://navigantes.eu/yachts-search',&#xA;'customCssPath' =&amp;gt; 'https://navigantes.eu/css/booking-manager-small.css',&#xA;'setlang' =&amp;gt; 'en',&#xA;'target' =&amp;gt; '_blank',&#xA;'companyid' =&amp;gt; '1234',&#xA;'filter_country' =&amp;gt; 'HR',&#xA;'filter_region' =&amp;gt; '',&#xA;'filter_base' =&amp;gt; '',&#xA;'filter_year' =&amp;gt; '2016',&#xA;'filter_month' =&amp;gt; '11',&#xA;'filter_date' =&amp;gt; '10',&#xA;'filter_duration' =&amp;gt; '7',&#xA;'filter_flexibility' =&amp;gt; 'on_day',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which needs to be translated to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;view=SearchResult&amp;amp;amp;customCssPath=https://navigantes.eu/css/booking-manager-small.css&amp;amp;amp;setlang=en&amp;amp;amp;target=_blank&amp;amp;amp;companyid=1234&amp;amp;amp;filter_country=HR&amp;amp;amp;filter_region=&amp;amp;amp;filter_base=&amp;amp;amp;filter_year=2016&amp;amp;amp;filter_month=11&amp;amp;amp;filter_date=10&amp;amp;amp;filter_duration=7&amp;amp;amp;filter_flexibility=on_day&amp;amp;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Solved the issue by using {{ craft.request.getPost('') }} method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;iframe name=&quot;&quot; width=&quot;100%&quot; height=&quot;800&quot; frameborder=&quot;0&quot; scrolling=&quot;auto&quot;&#xA;            src=&quot;https://www.booking-manager.com/wbm2/page.html?&#xA;                view={{ craft.request.getPost( 'view' ) }}&amp;amp;&#xA;                customCssPath={{ craft.config.environmentVariables.rootUrl }}/css/booking-manager-small.css&amp;amp;&#xA;                setlang={{ craft.request.getPost( 'setlang' ) }}&amp;amp;&#xA;                companyid={{ craft.request.getPost( 'companyid' ) }}&amp;amp;&#xA;                filter_country={{ craft.request.getPost( 'filter_country' ) }}&amp;amp;&#xA;                filter_region={{ craft.request.getPost( 'filter_region' ) }}&amp;amp;&#xA;                filter_base={{ craft.request.getPost( 'filter_base' ) }}&amp;amp;&#xA;                filter_year={{ craft.request.getPost( 'filter_year' ) }}&amp;amp;&#xA;                filter_month={{ craft.request.getPost( 'filter_month' ) }}&amp;amp;&#xA;                filter_date={{ craft.request.getPost( 'filter_date' ) }}&amp;amp;&#xA;                filter_duration={{ craft.request.getPost( 'filter_duration' ) }}&amp;amp;&#xA;                filter_flexibility={{ craft.request.getPost( 'filter_flexibility' ) }}&amp;amp;&#xA;            &quot;&amp;gt;&#xA;        &amp;lt;/iframe&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally Brad's suggested method worked by changing craft.request.getSegments() into craft.request.getPost():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.request.getPost() %}&#xA;{% set stringParams = '' %}&#xA;&#xA;{% for name, segment in segments %}&#xA;{% if name != 'controllerPage' %}&#xA;    {% set stringParams = stringParams ~ name ~ '=' ~ segment ~ '&amp;amp;' %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;iframe name=&quot;&quot; width=&quot;100%&quot; height=&quot;800&quot; frameborder=&quot;0&quot; scrolling=&quot;auto&quot; src=&quot;https://www.booking-manager.com/wbm2/page.html?{{ stringParams }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="3627" LastEditDate="2016-12-07T10:06:49.523" LastActivityDate="2016-12-07T17:23:30.270" Title="Need help with simple PHP plugin" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;plugins&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18010" PostTypeId="2" ParentId="18005" CreationDate="2016-12-05T12:48:11.520" Score="2" Body="&lt;p&gt;It might be that you're trying to parse the variables within quotes &lt;code&gt;&quot;&lt;/code&gt; as you set &lt;code&gt;email&lt;/code&gt; so you're actually encoding &lt;code&gt;{{ emailContact.emailField }}&lt;/code&gt; as a string, not the value it represents. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email = &quot;&amp;lt;a href='mailto:&quot; ~ emailContact.emailField ~ &quot;'&amp;gt;&quot; ~ emailContact.emailField ~ &quot;&amp;lt;/a&amp;gt;&quot; %}&#xA;&#xA;{{ email|rot13 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-12-05T12:48:11.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18011" PostTypeId="1" AcceptedAnswerId="18045" CreationDate="2016-12-05T16:35:32.627" Score="0" ViewCount="95" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/wja-no/craft-weighted-search&quot; rel=&quot;nofollow noreferrer&quot;&gt;Weighted Search&lt;/a&gt; on a site and want to prevent the results from listing entries from certain sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the README.md suggests that this functionality has not been built into the plugin. However, does anyone have any experience of getting the plugin to only search in certain sections? Either through the &lt;code&gt;{% set results %}&lt;/code&gt; OR tweaking the plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried added &lt;code&gt;.section('mysection')&lt;/code&gt; to the &lt;code&gt;{% set results %}&lt;/code&gt; but this seems to break the search.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Working&#xA;&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set results = craft.weightedSearch.substringSearch(query) %}&#xA;&#xA;// Not working&#xA;&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set results = craft.weightedSearch.substringSearch(query).section('mysection') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hoping someone else has managed this and I don't have to go back to the standard Craft search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4168" LastEditorUserId="57" LastEditDate="2016-12-05T19:00:05.103" LastActivityDate="2016-12-07T10:50:18.123" Title="Limit by section in Weighted Search" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18012" PostTypeId="1" CreationDate="2016-12-05T17:00:45.203" Score="2" ViewCount="202" Body="&lt;p&gt;I'm working on a webshop that should have an integration with Mollie to provide the payment methods. Craft Commerce's docs mention that Mollie is already integrated by using the Omnipay interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct that Omnipay only provides a basic interface to communicate with various Payment Gateways (including Mollie) and does not include more concrete functionality, like getting the payment methods/issuing banks?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the code like below I still have to write myself? Or am I doing double work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionGetPaymentMethods()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $paymentResponse = $this-&amp;gt;gateway-&amp;gt;fetchPaymentMethods()-&amp;gt;send();&#xA;&#xA;    if ($paymentResponse-&amp;gt;isSuccessful()) {&#xA;        $paymentMethods = array();&#xA;        foreach ($paymentResponse-&amp;gt;getPaymentMethods() as $paymentMethod) {&#xA;            $paymentMethods[] = array(&#xA;                'id' =&amp;gt; $paymentMethod-&amp;gt;getId(),&#xA;                'name' =&amp;gt; $paymentMethod-&amp;gt;getName(),&#xA;            );&#xA;        }&#xA;&#xA;        $this-&amp;gt;returnJson($paymentMethods);&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnErrorJson('error');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-12-06T11:54:33.867" Title="Omnipay Mollie implementation" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18013" PostTypeId="2" ParentId="18008" CreationDate="2016-12-05T17:04:14.817" Score="4" Body="&lt;p&gt;I think you can do this in the template by using for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getSegments&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getParam( name )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-12-05T17:04:14.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18014" PostTypeId="1" AcceptedAnswerId="18021" CreationDate="2016-12-05T18:58:30.577" Score="3" ViewCount="597" Body="&lt;p&gt;I heard that Wordpress has a BuddyPress plugin could set up as intranet which has shared files, shared calendars, chat .. etc feature. Does Craft CMS has any plugin to do a similar feature?&lt;/p&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2016-12-05T19:29:22.973" LastActivityDate="2016-12-07T15:38:38.110" Title="Does anyone use Craft CMS to set up an intranet for client?" Tags="&lt;plugins&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18015" PostTypeId="1" AcceptedAnswerId="18018" CreationDate="2016-12-05T19:53:00.550" Score="1" ViewCount="54" Body="&lt;p&gt;I have been using EE for over 5 years now, and am just starting to get into Craft (and I love it!).  In my recent EE sites, I've used Content Elements, and it has been a great way to give my clients flexibility in adding content to pages and blog posts, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a similar fieldtype available for Craft? Or is there another simple method to accomplish the same thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5836" LastActivityDate="2016-12-05T21:14:17.913" Title="Is there a fieldtype in Craft like &quot;Content Elements&quot; or &quot;Bloqs&quot; for ExpressionEngine?" Tags="&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18016" PostTypeId="2" ParentId="18011" CreationDate="2016-12-05T19:54:37.940" Score="0" Body="&lt;p&gt;Without having used the plugin - have you tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section: 'mysection' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2016-12-05T19:54:37.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18017" PostTypeId="1" AcceptedAnswerId="19229" CreationDate="2016-12-05T20:00:46.793" Score="1" ViewCount="168" Body="&lt;p&gt;Looking to build a largish site with Craft and I need a way to organize the entries for content editors/creators. Adding headers down the side will help for channels/structures, but all singles seem stuck in the predefined singles tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9inNc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9inNc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding a custom field to each page but it doesn't seem possible to sort by a custom field from within the entries view, which makes this rather useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything built in that I'm missing or perhaps a plugin that can help me to group together related content on this page? You can imagine this becoming hard to navigate with dozens or even hundreds of pages.&lt;/p&gt;&#xA;" OwnerUserId="4115" LastEditorUserId="57" LastEditDate="2017-03-01T20:27:40.287" LastActivityDate="2017-03-01T20:27:40.287" Title="Organize singles in Entries tab" Tags="&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18018" PostTypeId="2" ParentId="18015" CreationDate="2016-12-05T21:14:17.913" Score="1" Body="&lt;p&gt;You should check out the &lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;fieldtype&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-05T21:14:17.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18019" PostTypeId="2" ParentId="18017" CreationDate="2016-12-05T21:19:32.147" Score="1" Body="&lt;p&gt;I'm not aware of a plugin that tackles this or a way around it, but you might want to consider voting for this &lt;a href=&quot;https://github.com/craftcms/cms/issues/990&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;, which looks to be asking for the same thing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-03-01T20:23:54.103" LastActivityDate="2017-03-01T20:23:54.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18021" PostTypeId="2" ParentId="18014" CreationDate="2016-12-05T21:47:53.690" Score="6" Body="&lt;p&gt;There currently isn't a single plugin that does everything that BuddyPress does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;a href=&quot;https://straightupcraft.com/craft-plugins/?q=calendar&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;calender&lt;/a&gt; plugins, &lt;a href=&quot;https://straightupcraft.com/craft-plugins/?q=comment&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;commenting&lt;/a&gt; plugins, &lt;a href=&quot;https://dukt.net/craft/social&quot; rel=&quot;nofollow noreferrer&quot;&gt;social login&lt;/a&gt; and &lt;a href=&quot;https://dukt.net/craft/oauth&quot; rel=&quot;nofollow noreferrer&quot;&gt;oauth&lt;/a&gt; plugins and Craft Pro has built-in front-end registrations with member accounts with user groups and permissions. It would be up to you to tie all of these pieces together for your site's requirements.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="115" LastEditDate="2016-12-07T15:38:38.110" LastActivityDate="2016-12-07T15:38:38.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18022" PostTypeId="2" ParentId="17973" CreationDate="2016-12-06T00:36:25.993" Score="2" Body="&lt;p&gt;Interesting question. I think one answer depends on the speed of fidelity, ie that point at which you need to show something to a client AND how much fidelity they need ( ie in terms of completed visual design). I'm still finding the sweet spot and doing it both ways depending upon project time and budget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do think there is a lot of merit for building it in html/css within craft as it enables resources like js and sass, images etc to be more ready to go.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-12-06T00:36:25.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18023" PostTypeId="2" ParentId="18004" CreationDate="2016-12-06T00:41:22.567" Score="1" Body="&lt;p&gt;You should be able to do this the usual way of setting entry fields in a plugin I think:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $product-&amp;gt;setContentFromPost(array(&#xA;            'sku' =&amp;gt; $sku,&#xA;        );&#xA;        craft()-&amp;gt;commerce_products-&amp;gt;saveProduct($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Alternatively, you could listen to &lt;code&gt;onBeforeSaveProduct&lt;/code&gt; -  &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_products.onbeforesaveproduct&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_products.onbeforesaveproduct&lt;/a&gt; - and since the product will be saved after that anyway you could probably leave out the call to &lt;code&gt;saveProduct&lt;/code&gt; in that case)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think I've tried it with products but it certainly works with orders for much the same sort of thing.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-06T00:41:22.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18024" PostTypeId="1" AcceptedAnswerId="18061" CreationDate="2016-12-06T07:00:24.850" Score="1" ViewCount="101" Body="&lt;p&gt;I am trying to get the price and add to cart link for a product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I am testing at the moment, is it completely wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;========== Setting Variables ===========&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set giftDepositID = 6901 %}&#xA;{% set giftDepositPrices = 0 %}&#xA;&#xA;{% if craft.commerce.products.id(giftDepositID)|length %}&#xA;    {% set giftDepositproduct = craft.commerce.products.id(giftDepositID).find() %}&#xA;    {% set giftDepositvariant = giftDepositproduct.defaultVariant %}&#xA;    {% set giftDepositpurchasableId = giftDepositvariant.purchasableId %}&#xA;    {% set giftDepositPrices = craft.childsown.getVariantPrice(giftDepositpurchasableId) %}&#xA;{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;========== Example HTML ===========&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;div class=&quot;col-xs-12 mobile-price-item&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;{{baseUrl}}/assets/images/softie-robot.jpg&quot; class=&quot;img-responsive&quot;&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;clearfix bg-gradient-yellow&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;col-xs-8&quot;&amp;gt;&#xA;                        &amp;lt;h3 class=&quot;text-gloria&quot;&amp;gt;{{&quot;Deposit&quot;|t}}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;col-xs-4&quot;&amp;gt;&#xA;                        &amp;lt;h1 class=&quot;text-white text-gloria&quot;&amp;gt;&amp;lt;span class=&quot;initprice&quot; data-usd=&quot;{{giftDepositPrices}}&quot;&amp;gt;${{giftDepositPrices}}&amp;lt;/span&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt;&#xA;                        &amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;                            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;                            &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;                            &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;                            &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{giftDepositpurchasableId}}&quot;&amp;gt;&#xA;                            &amp;lt;button class=&quot;form-control btn btn-yellow text-white&quot; type=&quot;submit&quot; data-click=&quot;.softie-form .red .btn&quot;&amp;gt;{{&quot;BUY NOW&quot;|t}} &amp;lt;i class=&quot;fa fa-play&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;                        &amp;lt;/form&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help/guidance is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;======= EDIT ========&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New Variable set, I have updated the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set giftDepositID = 6901 %}&#xA;{% set giftDepositPrices = 0 %}&#xA;{% set giftStandardID = 6899 %}&#xA;{% set giftStandardPrices = 0 %}&#xA;{% set giftLargeID = 6897 %}&#xA;{% set giftLargePrices = 0 %}&#xA;&#xA;{% if craft.commerce.products.id(giftDepositID)|length %}&#xA;    {% set giftDepositproduct = craft.commerce.products.id(giftDepositID).find() %}&#xA;    {% set giftDepositvariant = giftDepositproduct.defaultVariant %}&#xA;    {% set giftDepositpurchasableId = giftDepositvariant.purchasableId %}&#xA;    {% set giftDepositPrices = giftDepositvariant.getVariantPrice(giftDepositpurchasableId) %}&#xA;{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the output of the HTML&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;col-sm-4 pad-sm red&quot;&amp;gt;&#xA;&amp;lt;img src=&quot;https://childsown.com/assets/images/softie-alien.jpg&quot; class=&quot;img-responsive&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;block-container&quot;&amp;gt;&#xA;&amp;lt;h3 class=&quot;text-gloria&quot;&amp;gt;Deposit&amp;lt;/h3&amp;gt;&#xA;&amp;lt;div class=&quot;block&quot;&amp;gt;&#xA;&amp;lt;h1 class=&quot;text-white text-gloria&quot;&amp;gt;&amp;lt;span class=&quot;initprice&quot; data-usd=&quot;&quot;&amp;gt;$&amp;lt;/span&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;button class=&quot;form-control btn btn-red text-white&quot; type=&quot;submit&quot; data-click=&quot;.softie-form .red .btn&quot;&amp;gt;BUY NOW &amp;lt;i class=&quot;fa fa-play&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5966" LastEditorUserId="5966" LastEditDate="2016-12-06T07:35:42.097" LastActivityDate="2016-12-08T04:11:34.997" Title="Getting Price and Add to Cart Button. Any thoughts on what I am doing wrong" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18025" PostTypeId="2" ParentId="17991" CreationDate="2016-12-06T09:26:30.807" Score="3" Body="&lt;p&gt;The articles might be useful to you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Multi-Environment Config for Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-06T09:26:30.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18026" PostTypeId="2" ParentId="18005" CreationDate="2016-12-06T09:28:51.720" Score="1" Body="&lt;p&gt;If you're using the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin, it exposes an &lt;code&gt;encodeEmailAddress()&lt;/code&gt; function that you can use in your templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#encodeemailaddress&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#encodeemailaddress&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-06T09:28:51.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18027" PostTypeId="1" CreationDate="2016-12-06T09:45:27.033" Score="0" ViewCount="198" Body="&lt;p&gt;The question isn't that relevant to Craft's scope but it bounds to understand How entry from front end is processed... I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to P&amp;amp;T I'm learning on &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow noreferrer&quot;&gt;GuestEntries&lt;/a&gt; plugin to send a POST request using &lt;a href=&quot;https://www.ampproject.org/docs/reference/components/amp-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;AMP-FORM&lt;/a&gt;. A validation and sending is done via their JavaScript where XHR request is sent without a full load of the page. So AJAX request.&#xA;One of AMP's requirements were to set a &lt;code&gt;headers&lt;/code&gt; for &lt;a href=&quot;https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;CORS&lt;/a&gt; requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I set the header in my .htaccess file like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Header set AMP-Access-Control-Allow-Source-Origin &quot;https://example.craft.dev&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With no &lt;code&gt;header&lt;/code&gt; set I couldn't pass through validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After fulfilling AMP's requirements to submit a AMP-FORM I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST https://example.craft.dev/someURI/send?__amp_source_origin=https%3A%2F%2Fexample.craft.dev &#xA;400 (Bad Request)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my simple form I'm sending:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action-xhr=&quot;{{ craft.request.url }}&quot; target=&quot;_top&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- {{ getCsrfInput() }} --&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;18&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had to comment &lt;code&gt;getCsrfInput()&lt;/code&gt; because It was throwing me an error about some polifiling JSON or something.&#xA;I hope You folks can give me some pointers Whether Craft can handle it.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="57" LastEditDate="2016-12-06T22:00:32.120" LastActivityDate="2016-12-06T22:00:32.120" Title="Posting a Guest Entry using AMP" Tags="&lt;plugin-guestentries&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18028" PostTypeId="1" AcceptedAnswerId="18029" CreationDate="2016-12-06T09:45:55.013" Score="2" ViewCount="39" Body="&lt;p&gt;I'm trying to put a single category (as long as it's populated) at the end of an category list. My code is working so far, is there an easy way to pick out the 'Others' category and append it to the list?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('toys').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement:&#xA;    entryIds }).craft.categories.group('brands').find() %}&#xA;&#xA;{% for category in categories %}&#xA;    {% set image = craft.assets.relatedTo(category).first() %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;        {% if image|length %}&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot; /&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;img src=&quot;{{siteUrl}}assets/img/placeholder.jpg&quot; /&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help, ready to learn something new.&lt;/p&gt;&#xA;" OwnerUserId="3583" LastEditorUserId="125" LastEditDate="2016-12-06T10:40:05.080" LastActivityDate="2016-12-06T11:18:52.443" Title="Sorting categories into list put single one at end of it" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18029" PostTypeId="2" ParentId="18028" CreationDate="2016-12-06T10:44:26.793" Score="2" Body="&lt;p&gt;Is there a reason why you don’t just drag the “Others” category to the end in the CP? The sort order will be the same for the front-end with your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('toys').ids() %}&#xA;{% set categories = craft.categories({&#xA;    relatedTo: { sourceElement: entryIds },&#xA;    group: 'brands',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I corrected your code, you never append another &lt;code&gt;.craft.categories&lt;/code&gt; criteria model to a criteria model. Have a look at the docs for the allowed syntax: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s example code that should work to list the categories alphabetically with the special “Others” category listed at the end.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('toys').ids() %}&#xA;&#xA;{% set categories = craft.categories({&#xA;    relatedTo: { sourceElement: entryIds },&#xA;    group: 'brands',&#xA;    order: 'title',&#xA;}) %}&#xA;&#xA;{% set otherCategory = null %}&#xA;&#xA;{% for category in categories %}&#xA;    {% if category.id == 72 %}&#xA;        {% set otherCategory = category %}&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if otherCategory %}&#xA;    &amp;lt;a href=&quot;{{ otherCategory.url }}&quot;&amp;gt;{{ otherCategory.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-12-06T11:18:52.443" LastActivityDate="2016-12-06T11:18:52.443" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18030" PostTypeId="2" ParentId="18005" CreationDate="2016-12-06T10:51:07.783" Score="1" Body="&lt;p&gt;There is also this &lt;a href=&quot;https://github.com/70kft/craft-emailobfuscate&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailObfuscate plugin for Craft CMS&lt;/a&gt; which seems to add obfuscation via filter on strings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|emailObfuscate }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-06T10:51:07.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18031" PostTypeId="2" ParentId="18012" CreationDate="2016-12-06T11:54:33.867" Score="2" Body="&lt;p&gt;Nevermind, I did not understand that Mollie is an off-site implementation. So the checkout just redirects you to the Mollie environment. If you want to implement on-site payments using Mollie you'd have to write your own logic I presume.&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-12-06T11:54:33.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18033" PostTypeId="1" CreationDate="2016-12-06T15:06:45.663" Score="1" ViewCount="79" Body="&lt;p&gt;I'm building a service where a few user attributes (category fields) are needed and have to be compared against an entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I get the current user and try to load these attributes, they show as &lt;code&gt;NULL&lt;/code&gt;. They are filled in at the user's profile, so they shouldn't be &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code I have used to get try and get the attributes values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$user-&amp;gt;getContent()-&amp;gt;getAttributes()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some values are filled out, like the custom field for postal code and phone number. However those category fields are all &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5968" LastEditorUserId="5970" LastEditDate="2016-12-06T22:03:32.897" LastActivityDate="2016-12-06T22:03:32.897" Title="Getting custom user attributes in a service, they return NULL" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18035" PostTypeId="2" ParentId="18033" CreationDate="2016-12-06T15:56:14.830" Score="2" Body="&lt;p&gt;Here's some code that should return categories related to a user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;relatedTo = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;return craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2016-12-06T15:56:14.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18036" PostTypeId="1" CreationDate="2016-12-06T16:09:06.013" Score="1" ViewCount="492" Body="&lt;p&gt;I'm having trouble getting the Structure parent title on a search results page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11614/title-of-the-current-parent-structure/11617#11617&quot;&gt;these instructions&lt;/a&gt; but I'm getting a &quot;Impossible to access an attribute (&quot;title&quot;) on a null variable&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following code the all ancestors do print except the first level Structure title.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{# {% set entries = craft.entries.search(query).order('score') %} #}&#xA;{% set entries = craft.entries.section().search(query).order('score') %}&#xA;&#xA;&#xA;&amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;  {% for entry in entries %}&#xA; &amp;lt;li&amp;gt;&#xA;  &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;  {% set parent1 = entry.getAncestors().level(1) %}&#xA;  {% for item in parent1 %}&#xA;      / {{ item.title }}&#xA;    {% endfor %}&#xA;  {% set parent2 = entry.getAncestors().level(2) %}&#xA;  {% for item in parent2 %}&#xA;      / {{ item.title }}&#xA;    {% endfor %}&#xA;  {% set parent3 = entry.getAncestors().level(3) %}&#xA;  {% for item in parent3 %}&#xA;    / {{ item.title }}&#xA;  {% endfor %}&#xA; &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-12-06T17:08:23.613" Title="How to get Structure parent title and ancestors on search results page" Tags="&lt;structure&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18037" PostTypeId="2" ParentId="18036" CreationDate="2016-12-06T16:58:49.237" Score="2" Body="&lt;p&gt;Found the answer in &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getSection&quot; rel=&quot;nofollow noreferrer&quot;&gt;getSection()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;  {% set section = entry.getSection() %}&#xA;   {{ section }}&#xA;  {% set parent1 = entry.getAncestors() %}&#xA;   {% for item in parent1 %}&#xA;    / {{ item }}&#xA;   {% endear %}&#xA;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="36" LastEditorUserId="36" LastEditDate="2016-12-06T17:08:23.613" LastActivityDate="2016-12-06T17:08:23.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18038" PostTypeId="1" CreationDate="2016-12-06T17:31:31.220" Score="1" ViewCount="216" Body="&lt;p&gt;Is there any automatic Error trapping built into Craft for discount codes for the following rules?  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Orders over a set Total&lt;/li&gt;&#xA;&lt;li&gt;Orders over a set Quantity&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The codes work/apply, but if the rules don’t match I am not getting any errors/messages back.&#xA;Any ideas? Do we have to write checks for every scenario?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are likely more scenarios than the two I have listed above. It seems a little poor UX to appear to do nothing, no error, no discount applied if the contents of the cart don't qualify. &lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-12-07T23:37:20.633" Title="Error trapping on discount codes based on Cart contents" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18039" PostTypeId="2" ParentId="17931" CreationDate="2016-12-06T17:33:07.233" Score="1" Body="&lt;p&gt;So I figured out the issue, it is related to Ubuntu and how the mount process works using Upstart. I had a line in fstab to load the network drive but Ubuntu fails. Because of that failure, craft couldn't find the shared path which points to craft/storage/ &lt;/p&gt;&#xA;" OwnerUserId="5067" LastActivityDate="2016-12-06T17:33:07.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18040" PostTypeId="2" ParentId="17744" CreationDate="2016-12-06T19:29:53.170" Score="0" Body="&lt;p&gt;I was able to get help from a co-worker on this issue. Below is the code used to get Countries and Resellers to sort correctly. Krzysztof Boduch's answer was pretty solid and allowed for a great starting point.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.slug(entrySlug).find() %}&#xA;{% set resellersByCountry = {} %}&#xA;{% for block in entry.chooseResellers %}&#xA;    {% for reseller in block.chooseReseller.with(['rdCountry']) %}&#xA;        {% set countryName = reseller.rdCountry[0].title %}&#xA;&#xA;        {% if resellersByCountry[countryName] is defined %}&#xA;            {% set temp = resellersByCountry[countryName] %}&#xA;            {% set temp = resellersByCountry[countryName] | merge([reseller]) %}&#xA;            {% set resellersByCountry = resellersByCountry | merge({(countryName): temp}) %}&#xA;        {% else %}&#xA;            {% set resellersByCountry = resellersByCountry | merge({(countryName): [reseller]}) %}&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %} &#xA;&#xA;{# United States #}&#xA;{% for countryKey in resellersByCountry | keys | sort %}&#xA;    {% if countryKey == &quot;United States&quot; %}&#xA;    &amp;lt;h3&amp;gt;{{ countryKey }}&amp;lt;/h3&amp;gt;&#xA;    {% for reseller in resellersByCountry[countryKey] | sort %}&#xA;        &amp;lt;p&amp;gt;{{ reseller.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# International #}&#xA;{% for countryKey in resellersByCountry | keys | sort %}&#xA;    {% if countryKey != &quot;United States&quot; %}&#xA;    &amp;lt;h3&amp;gt;{{ countryKey }}&amp;lt;/h3&amp;gt;&#xA;    {% for reseller in resellersByCountry[countryKey] | sort %}&#xA;        &amp;lt;p&amp;gt;{{ reseller.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endfor %}&lt;/p&gt;&#xA;" OwnerUserId="3571" LastActivityDate="2016-12-06T19:29:53.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18041" PostTypeId="2" ParentId="18008" CreationDate="2016-12-06T21:52:11.540" Score="1" Body="&lt;p&gt;100% untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.request.getPost() %}&#xA;{% set stringParams = '' %}&#xA;&#xA;{% for name, segment in segments %}&#xA;    {% if name not 'controllerPage' %}&#xA;        {% set stringParams = stringParams ~ name ~ '=' ~ segment ~ '&amp;amp;'&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-12-07T17:23:30.270" LastActivityDate="2016-12-07T17:23:30.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18043" PostTypeId="1" AcceptedAnswerId="18044" CreationDate="2016-12-06T22:47:14.527" Score="0" ViewCount="273" Body="&lt;p&gt;I am trying to integrate with &lt;code&gt;sendinblue API&lt;/code&gt; and I installed it with &lt;a href=&quot;https://github.com/mailin-api/mailin-api-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;composer&lt;/a&gt; as a third party library.&lt;br&gt;&#xA;But it still does not work:&lt;br&gt;&#xA;&lt;code&gt;Fatal error: Class 'Mailin' not found in /localfolder/www/craft/plugins/stepsprogram/controllers/StepsProgramController.php on line 225&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;code&gt;composer.json&lt;/code&gt; file at the root of my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;name&quot;: &quot;/stepsprogram&quot;,&#xA;    &quot;description&quot;: &quot;Steps Program.&quot;,&#xA;    &quot;type&quot;: &quot;craft-plugin&quot;,&#xA;    &quot;require&quot;: {&#xA;        &quot;composer/installers&quot;: &quot;~1.0&quot;,&#xA;        &quot;mailin-api/mailin-api-php&quot;: &quot;^1.0&quot;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;init&lt;/code&gt; function of my plugin: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    // If using composer&#xA;    require_once __DIR__ . '/vendor/autoload.php';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the error happen here when trying to call the &lt;code&gt;mailin&lt;/code&gt; class in my controller:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $mailin = new \Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);    //Optional parameter: Timeout in MS&#xA;        var_dump($mailin-&amp;gt;get_account());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="57" LastEditDate="2016-12-07T00:14:35.497" LastActivityDate="2016-12-07T14:19:06.470" Title="Plugin dev with Sendinblue mailer integration" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18044" PostTypeId="2" ParentId="18043" CreationDate="2016-12-07T00:17:50.780" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/mailin-api/mailin-api-php/blob/master/src/Sendinblue/Mailin.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Looks like&lt;/a&gt; you're missing the proper namespace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mailin = new \Sendinblue\Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here also is the other syntax for a global call in the controller.&lt;br&gt;&#xA;Controller beginning would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;use Sendinblue\Mailin;&#xA;&#xA;class FooController extends BaseController&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then class call will be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mailin = new Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3383" LastEditDate="2016-12-07T14:19:06.470" LastActivityDate="2016-12-07T14:19:06.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18045" PostTypeId="2" ParentId="18011" CreationDate="2016-12-07T10:50:18.123" Score="1" Body="&lt;p&gt;I've also seen this issue myself when using weightedsearch and as a result I have jsut gone and created a solution for this by adding a new parameter to the substringSearch function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also commented on the issue which was raised back in January on the weightedsearch github page and added my updated files as a zip file, so please feel free to download it and give it a go if you wish. By putting it onto the issue tracker they will hopefully pull this feature into the plugin in a future release now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see further details here: &lt;a href=&quot;https://github.com/wja-no/craft-weighted-search/issues/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/wja-no/craft-weighted-search/issues/1&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2016-12-07T10:50:18.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18046" PostTypeId="1" AcceptedAnswerId="18048" CreationDate="2016-12-07T13:38:58.370" Score="2" ViewCount="901" Body="&lt;p&gt;Until now I've always done backend plugin development but my next task is to create a homepage with craft. To make an Ajax request I used &lt;code&gt;Craft.postActionRequest&lt;/code&gt; but if I try this in my frontend template I always receive the error &lt;code&gt;Uncaught ReferenceError: Craft is not defined&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to include &lt;code&gt;{%- includejsresource &quot;js/craft.js&quot; first -%}&lt;/code&gt; but it does not work. Of course I could just create a normal request via Ajax/jQuery but I would like to do it with craft methods...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question: what do I have to do, to get access to craft.js library?&#xA;edit: Just like this &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions-with-javaScript&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2016-12-07T13:45:56.110" LastActivityDate="2016-12-07T15:28:16.650" Title="Use Craft.postActionRequest in frontend template" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18047" PostTypeId="1" AcceptedAnswerId="18050" CreationDate="2016-12-07T14:33:20.563" Score="0" ViewCount="166" Body="&lt;p&gt;We developed a website under the trail Pro license. But now on the production server, we downgraded Craft to Personal. Since then we can't save entries and get a warning about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logfile gives the next errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016-12-07 15:23:53&#xA;&#xA;Level   error&#xA;Category    exception.Craft\HttpException.404&#xA;Message Craft\HttpException in /removed-path-for-sec/craft/app/controllers/TemplatesController.php:59&#xA;2016-12-07 15:23:47&#xA;&#xA;Level   error&#xA;Category    application&#xA;Message CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Upgrading to Pro solves the problem again. Could do that of course, but I'm wondering if there is an other solution :)&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2016-12-07T17:45:29.240" Title="Error after downgrading from Pro to Personal" Tags="&lt;entries&gt;&lt;license&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18048" PostTypeId="2" ParentId="18046" CreationDate="2016-12-07T14:50:48.493" Score="3" Body="&lt;p&gt;The global &lt;code&gt;Craft&lt;/code&gt; object available in the Control Panel is exposed in the &lt;code&gt;craft.js&lt;/code&gt; file, which is a bundle containing most of the JavaScript code used in Craft's Control Panel (i.e. admin area). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This file is not meant to be used in your front end!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft.js&lt;/code&gt; file has dependencies on other CP-only JavaScript files, and weighs – by itself – a whopping ~250 kb minified, which is &lt;em&gt;a lot&lt;/em&gt; of bytes to force on your end users just because you'd like to use a tiny part of the library in your front end code. Additionally, because the file is only meant to be used with core functionality in the Control Panel, it can be updated/changed by Pixel &amp;amp; Tonic at any time (i.e. any time Craft is updated), possibly breaking your custom code which depends on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using the whole &lt;code&gt;craft.js&lt;/code&gt; package, I'd strongly advice you to cherry pick (i.e. copy and paste) any methods or functionality you need from &lt;code&gt;craft.js&lt;/code&gt; to a custom JavaScript bundle. For specific functionality (e.g. AJAX requests), you might also consider using other, established open source libraries (like SuperAgent, Axios or even jQuery). &lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-07T15:28:16.650" LastActivityDate="2016-12-07T15:28:16.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18049" PostTypeId="1" AcceptedAnswerId="18059" CreationDate="2016-12-07T17:44:29.120" Score="2" ViewCount="831" Body="&lt;p&gt;Requests for non-existent templates/pages (404s) result in an uncaught HttpException.404 being thrown, though the correct 404 template is displayed. Is there some way to suppress or handle this exception? It's flooding my error reporting tool. For reference, here's the stack trace from the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/12/07 17:29:07 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /project/craft/app/controllers/TemplatesController.php:59&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('page-no-existy', Array)&#xA;#1 /project/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /project/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /project/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /project/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /project/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /project/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /project/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /project/craft/app/etc/web/WebApp.php(290): CWebApplication-&amp;gt;processRequest()&#xA;#9 /project/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /project/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /project/src/static/index.php(21): require_once('/project...')&#xA;#12 {main}&#xA;REQUEST_URI=/page-no-existy&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3750" LastActivityDate="2016-12-07T23:30:38.513" Title="Suppress HttpException.404 for bad URLs" Tags="&lt;templating&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18050" PostTypeId="2" ParentId="18047" CreationDate="2016-12-07T17:45:29.240" Score="3" Body="&lt;p&gt;I was only able to answer this because the OP sent a support ticket to and was able to look at their database. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the site was setup in Craft Pro trial mode, the content was built out with multiple locales and those locales were enabled for the sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Personal only allows for 1 locale, so when you try to save an entry in a section that was originally setup for multiple locales under Craft Pro, you get an pretty generic &quot;can't save entry&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go back to Craft Pro and remove the other 2 non-primary locales, the Craft Personal entry saving will work again.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-07T17:45:29.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18051" PostTypeId="1" CreationDate="2016-12-07T19:03:35.637" Score="1" ViewCount="242" Body="&lt;p&gt;What is the proper syntax in the &lt;strong&gt;ElementAPI 'criteria'&lt;/strong&gt; configuration settings for limiting entries based on custom start and end date/time fields. I can't use the default postDate and expiryDate due to localization requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the proper syntax working in my twig template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.startDateTime('&amp;lt;=' ~ now.date,':empty:').endDateTime('&amp;gt;=' ~ now.date,':empty:')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I mimic this same logic in the ElementAPI config settings? This is what I have so far. It doesn't throw any php errors but doesn't return the results I am expecting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'mySection', &#xA;    'type' =&amp;gt; 'mySectionType',&#xA;    'startDateTime' =&amp;gt; '&amp;lt;=' . date(&quot;Y-m-d H:i:s&quot;) . ', :empty:',&#xA;    'endDateTime' =&amp;gt; '&amp;gt;=' . date(&quot;Y-m-d H:i:s&quot;) . ', :empty: '&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3746" LastEditorUserId="3746" LastEditDate="2016-12-08T17:17:22.607" LastActivityDate="2016-12-08T19:52:41.910" Title="Limit ElementAPI results with custom date/time field" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18052" PostTypeId="2" ParentId="6587" CreationDate="2016-12-07T19:34:26.977" Score="5" Body="&lt;p&gt;While I am adding them from a plugin, I ran into a similar issue as you, and like you, I didn't like the &quot;recreate the layout from scratch&quot; method the linked answer used. I know this question is old, but it seems the most apt place to put my solution to this issue and contribute to more code samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some experimenting, I got a solution that works (whether it's &quot;the Craft way,&quot; I'm not totally sure, and I'm sure some of it could be cleaned up, but it's not like there's a lot of documentation on that front, as we've both found).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code creates the fields, a field group, and a tab, then adds the tab and fields to the User Layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Create the field group&#xA;    $groupModel = new FieldGroupModel();&#xA;    $groupModel-&amp;gt;name = 'CustomGroupName';&#xA;    craft()-&amp;gt;fields-&amp;gt;saveGroup($groupModel);&#xA;&#xA;    // I haven't yet found a way to get the group ID without looping through all of the groups. saveGroup() returns a boolean and doesn't appear to update the id attribute of the original model instance.&#xA;    $groups = craft()-&amp;gt;fields-&amp;gt;getAllGroups();&#xA;    foreach($groups as $group) {&#xA;        if($group-&amp;gt;name != 'CustomGroupName') {&#xA;            continue;&#xA;        }&#xA;        $groupModel = $group;&#xA;    }&#xA;&#xA;    // Create the tab&#xA;    $tabModel = new FieldLayoutTabModel();&#xA;    // Get the desired layout (in this case, the User layout) and use the tab's setLayout to link the two&#xA;    $layout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType(ElementType::User);&#xA;    $tabModel-&amp;gt;setLayout($layout);&#xA;    $tabModel-&amp;gt;name = 'CustomTabName';&#xA;&#xA;&#xA;    // Create the fields. I have a protected class member that contains the fields in a 'fieldName' =&amp;gt; 'FieldName' format.&#xA;    foreach($this-&amp;gt;fields as $field =&amp;gt; $name) {&#xA;        $fieldModel = new FieldModel();&#xA;        $fieldModel-&amp;gt;groupId = $groupModel-&amp;gt;id;&#xA;        $fieldModel-&amp;gt;name = Craft::t($name);&#xA;        $fieldModel-&amp;gt;handle = $field;&#xA;        $fieldModel-&amp;gt;translatable = false;&#xA;        $fieldModel-&amp;gt;type = 'PlainText';&#xA;&#xA;        craft()-&amp;gt;fields-&amp;gt;saveField($fieldModel);&#xA;    }&#xA;&#xA;    // Get all of the group's fields. This could also be done by saving an array of the fields in the loop above, but this seems a bit cleaner to me, and since we already have the group object, saves us an object/variable declaration.&#xA;    $fields = $groupModel-&amp;gt;getFields();&#xA;&#xA;    // Set the tab's fields. This gives us a custom grouping in the layout editor.&#xA;    $tabModel-&amp;gt;setFields($fields);&#xA;&#xA;    // Get the existing tabs (and, by extension, fields), since we don't want to nuke the layout, just add to it. I couldn't find any sort of &quot;addTab&quot; type function, so this is how we have to do it.&#xA;    $layoutTabs = $layout-&amp;gt;getTabs();&#xA;&#xA;    // getTabs() returns an array, so simply add our new tab to the array.&#xA;    $layoutTabs[] = $tabModel;&#xA;&#xA;    // Now, set the tabs back in the layout.&#xA;    $layout-&amp;gt;setTabs($layoutTabs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reversal is exactly that--a reversal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $group = null;&#xA;&#xA;    // Delete the fields&#xA;    foreach($this-&amp;gt;fields as $field =&amp;gt; $name) {&#xA;        $fieldModel = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($field);&#xA;        if($fieldModel) {&#xA;            // Grab the group from one of the fields. Presumably (in my case), they're all in the same group. This could be refined for a less ham-fisted approach. Unfortunately, it's either this, or doing the loop-through-all-groups method we did in the create section, that I've found.&#xA;            $group = $fieldModel-&amp;gt;group;&#xA;            craft()-&amp;gt;fields-&amp;gt;deleteField($fieldModel);&#xA;        }&#xA;    }&#xA;&#xA;    // Delete the field group&#xA;    if($group) {&#xA;        $groupModel = craft()-&amp;gt;fields-&amp;gt;getGroupById($group-&amp;gt;id);&#xA;        // I made sure it was empty, since I don't want to delete the group if more fields were added.&#xA;        if($groupModel &amp;amp;&amp;amp; empty($groupModel-&amp;gt;getFields())) {&#xA;            craft()-&amp;gt;fields-&amp;gt;deleteGroupById($groupModel-&amp;gt;id);&#xA;        }&#xA;    }&#xA;&#xA;    // Delete the layout tab&#xA;    // Get the layout...&#xA;    $layout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType(ElementType::User);&#xA;&#xA;    // Get the tabs...&#xA;    $tabs = $layout-&amp;gt;tabs;&#xA;&#xA;    // Find and delete the tab we want, in the same fashion, except now we're unsetting the array instead of setting it.&#xA;    foreach($tabs as $index =&amp;gt; $tab) {&#xA;        if($tab-&amp;gt;name != &quot;CustomTabName&quot;) {&#xA;            continue;&#xA;        }&#xA;        unset($tabs[$index]);&#xA;    }&#xA;    $layout-&amp;gt;setTabs($tabs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5822" LastActivityDate="2016-12-07T19:34:26.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18055" PostTypeId="1" CreationDate="2016-12-07T21:30:31.893" Score="1" ViewCount="93" Body="&lt;p&gt;Is it possible to insert data with the query builder if so how? &#xA;I want to make (backend) fields by queries. What is the easiest way to do this? Or do I have to use regular mysql queries? &lt;/p&gt;&#xA;" OwnerUserId="5977" LastActivityDate="2016-12-07T21:30:31.893" Title="How to insert data with the querybuilder?" Tags="&lt;field&gt;&lt;query&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18056" PostTypeId="1" AcceptedAnswerId="18058" CreationDate="2016-12-07T22:21:28.877" Score="1" ViewCount="164" Body="&lt;p&gt;Live preview is not working.  The following error appears in Inspect Element (Safari).  It then times out and generates a whole bunch of can't load errors. but this appears to the root of those subsequent errors.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;XMLHttpRequest cannot load &lt;a href=&quot;http://www.mydomain.com/index.php?p=posts/2016/thisost&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mydomain.com/index.php?p=posts/2016/thisost&lt;/a&gt;. Origin &lt;a href=&quot;http://mydomain.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mydomain.com&lt;/a&gt; is not allowed by Access-Control-Allow-Origin.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I saw a related question that referred to the &lt;code&gt;.htaccess&lt;/code&gt; file.  But I can't seem to find the&lt;code&gt;.htaccess&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I guess this is an A and then B question.  The first (A) being the focus and B only of import if its related to the solution for A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense.  Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="125" LastEditDate="2016-12-08T20:51:15.027" LastActivityDate="2016-12-08T20:51:15.027" Title="Live Preview fails to load" Tags="&lt;error-message&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18057" PostTypeId="2" ParentId="4661" CreationDate="2016-12-07T22:29:11.927" Score="1" Body="&lt;p&gt;My solution is similar to @mohsin-mr's answer.  I disabled XDebug (MAMP Pro &gt; PHP tab &gt; uncheck Debugger) and the FastCGI errors went away.&lt;/p&gt;&#xA;" OwnerUserId="5980" LastActivityDate="2016-12-07T22:29:11.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18058" PostTypeId="2" ParentId="18056" CreationDate="2016-12-07T23:20:44.797" Score="1" Body="&lt;p&gt;A browser will give that error by default when you try make an AJAX call from domain A to domain B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your particular case, it looks like you're loading the control panel from &lt;code&gt;mydomain.com&lt;/code&gt;, but the live preview request (which comes from how you defined your Site URL under Settings-&gt;General) has &lt;code&gt;www.mydomain.com&lt;/code&gt; in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the &lt;code&gt;www&lt;/code&gt;.  A browser will treat that as an entirely separate domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's how you want it, great.  You need to modify your public &lt;code&gt;.htaccess&lt;/code&gt; file (the one that sits next to Craft's public &lt;code&gt;index.php&lt;/code&gt; file to allow the other domain via &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likely it's just a mistake though and you should correct the Site URL setting or access the control panel from the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth &lt;a href=&quot;https://stackoverflow.com/questions/1157255/how-to-redirect-non-www-to-www-urls-using-htaccess&quot;&gt;forcing one or the other&lt;/a&gt; (www redirect to non, or non redirect to www) via &lt;code&gt;.htaccess&lt;/code&gt; for consistency and because search engines will treat them as one site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-07T23:20:44.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18059" PostTypeId="2" ParentId="18049" CreationDate="2016-12-07T23:30:38.513" Score="1" Body="&lt;p&gt;The good news in the upcoming Craft 3 this isn't an issue.  404's get logged to their own separate log files and won't clutter up the main Craft log files specifically for this reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2, I think you'd have to do something like write a plugin that listens for Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;onException event&lt;/a&gt;, makes sure it's a 404 status code, then go through Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/topics.logging&quot; rel=&quot;nofollow noreferrer&quot;&gt;CLogger&lt;/a&gt; to get the full list of log entries and remove the last one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-07T23:30:38.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18060" PostTypeId="2" ParentId="18038" CreationDate="2016-12-07T23:37:20.633" Score="1" Body="&lt;p&gt;So this is for coupons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a coupon can't be applied during an &lt;code&gt;updateCart&lt;/code&gt;, you'll get back the rather unhelpful response in JSON of &lt;code&gt;{&quot;error&quot;:&quot;Cart not completely updated.&quot;}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We intercept this, and because we know it's a coupon operation just replace the text of that to 'Could not apply coupon'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it does not give you a reason or anything, unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-07T23:37:20.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18061" PostTypeId="2" ParentId="18024" CreationDate="2016-12-08T02:34:28.780" Score="1" Body="&lt;p&gt;I am a little confused with your twig code assigning so many variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put simply, only a &lt;code&gt;purchasableId&lt;/code&gt; can be used to add something to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the product ID then it is as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set product = craft.commerce.products.id(6901}.first() %}&#xA;&#xA;{% if product %}&#xA;    &amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ product.defaultVariant.purchasableId }}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;button type=&quot;submit&quot;&amp;gt;BUY NOW {{ product.defaultPrice|commerceCurrency }}&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2016-12-08T04:11:34.997" LastActivityDate="2016-12-08T04:11:34.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18062" PostTypeId="1" AcceptedAnswerId="18064" CreationDate="2016-12-08T08:22:04.810" Score="2" ViewCount="273" Body="&lt;p&gt;I can't find a way to clean up the search address from&#xA;&lt;code&gt;/search/?q=.../&lt;/code&gt; to &lt;code&gt;/search/query/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see ways of getting the last segment of the url with something like &lt;code&gt;craft.request.getSegment&lt;/code&gt;. My other permalinks work fine, but for search I can't get the search template to pickup the &lt;code&gt;/query/&lt;/code&gt; bit (results in a logical 404 page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So either it's my .htaccess (using the one provided) missing something. Or alter something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3583" LastEditorUserId="125" LastEditDate="2016-12-08T10:00:46.440" LastActivityDate="2016-12-09T08:41:21.887" Title="Prettify search URL" Tags="&lt;search&gt;&lt;routes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18063" PostTypeId="2" ParentId="18062" CreationDate="2016-12-08T09:52:54.963" Score="3" Body="&lt;p&gt;If you go to &lt;code&gt;Settings &amp;gt; Routes&lt;/code&gt; in the CP you're able to add routes with wildcard characters like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/search/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then point that to a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;register site routes&lt;/a&gt; in a plugin if you want to go down that route (no pun intended)&lt;/p&gt;&#xA;" OwnerUserId="3563" LastEditorUserId="3563" LastEditDate="2016-12-09T08:41:21.887" LastActivityDate="2016-12-09T08:41:21.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18064" PostTypeId="2" ParentId="18062" CreationDate="2016-12-08T09:55:32.563" Score="5" Body="&lt;p&gt;You forgot to setup the routes for your search URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I’d recommend to use an advanced route with a regular expression, as it allows to use patterns that will ignore the slashes between your search terms. You’d setup the route in your craft/config/routes.php file (see &lt;a href=&quot;https://craftcms.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advanced Routing&lt;/a&gt; in the Craft docs).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return array(&#xA;    'search/(?P&amp;lt;query&amp;gt;.+)' =&amp;gt; 'search/_result',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This route matches all URLs which start with &lt;code&gt;search/&lt;/code&gt;, populates a variable named &lt;code&gt;query&lt;/code&gt; with everything that comes after the &lt;code&gt;search/&lt;/code&gt; and routes the request to a template search/_result.html. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template you can now use the &lt;code&gt;split&lt;/code&gt; filter to get the individual words. You can then join them to a nice search string for your criteria model (see &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search Syntax&lt;/a&gt; in the docs).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set words = query|split('/') %}&#xA;{% set searchParam = words|join(' OR ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this Twig code you’d prepare a search string that finds elements containing “advanced” or “routes” for an example URL &lt;a href=&quot;http://example.com/search/advanced/routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/search/advanced/routes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-08T09:55:32.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18065" PostTypeId="1" AcceptedAnswerId="18066" CreationDate="2016-12-08T10:21:51.537" Score="3" ViewCount="454" Body="&lt;p&gt;I've got an asset folder where i need to bring over about 20Gb of assets, obviously trying to update asset indexes from the Craft Cpanel is causing a serious failure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than adding my assets in smaller chunks is there any other option to make it less memory intensive?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the assets were on S3 rather than local, would it be less intense?&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2016-12-08T12:51:44.717" Title="Asset indexing failing with large asset source" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18066" PostTypeId="2" ParentId="18065" CreationDate="2016-12-08T10:40:12.800" Score="6" Body="&lt;p&gt;I've done this before with a combination of a Craft console command that replicates the indexing process, and a external way that processes each row.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class BusinessLogicCommand extends BaseCommand&#xA;{&#xA;    /**&#xA;    * ./craft/app/etc/console/yiic businesslogic --offset=x --sourceId=y --sessionId=z&#xA;    */&#xA;    public function actionIndex ($offset = '', $sourceId = '', $sessionId = '')&#xA;    {&#xA;        if ( $offset ) {&#xA;            $index = craft()-&amp;gt;assetIndexing-&amp;gt;processIndexForSource($sessionId, $offset, $sourceId);&#xA;&#xA;            if ( $index ) {&#xA;                echo sprintf(&quot;Processed offset: %s for source %s&quot;, $offset, $sourceId);&#xA;&#xA;                return 1;&#xA;            }&#xA;        }&#xA;&#xA;        return 0;&#xA;    }&#xA;&#xA;    /**&#xA;    * ./craft/app/etc/console/yiic businesslogic getIndexOverview&#xA;    */&#xA;    public function actionGetIndexOverview ($sourceIds = '')&#xA;    {&#xA;&#xA;        // Get batches&#xA;        $batches   = array();&#xA;        $sessionId = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexingSessionId();&#xA;&#xA;        // Selection of sources or all sources?&#xA;        if ( $sourceIds ) {&#xA;            $sourceIds = explode(',', $sourceIds);&#xA;        }&#xA;        else {&#xA;            $sourceIds = craft()-&amp;gt;assetSources-&amp;gt;getViewableSourceIds();&#xA;        }&#xA;&#xA;        $missingFolders = array();&#xA;        $grandTotal     = 0;&#xA;&#xA;        foreach ($sourceIds as $sourceId) {&#xA;            // Get the indexing list&#xA;            $indexList = craft()-&amp;gt;assetIndexing-&amp;gt;getIndexListForSource($sessionId, $sourceId);&#xA;&#xA;            if ( !empty($indexList['error']) ) {&#xA;                echo json_encode($indexList);&#xA;&#xA;                return 0;&#xA;            }&#xA;&#xA;            if ( isset($indexList['missingFolders']) ) {&#xA;                $missingFolders += $indexList['missingFolders'];&#xA;            }&#xA;&#xA;            $batch = array();&#xA;&#xA;            for ($i = 0; $i &amp;lt; $indexList['total']; $i++) {&#xA;                $batch[] = [&#xA;                    'sessionId' =&amp;gt; $sessionId,&#xA;                    'sourceId'  =&amp;gt; $sourceId,&#xA;                    'total'     =&amp;gt; $indexList['total'],&#xA;                    'offset'    =&amp;gt; $i,&#xA;                    'process'   =&amp;gt; 1,&#xA;                ];&#xA;            }&#xA;&#xA;            $batches[] = $batch;&#xA;        }&#xA;&#xA;&#xA;        // Overview&#xA;&#xA;        $assetsSourcesBeingIndexed = $sourceIds;&#xA;        $assetsMissingFolders      = $missingFolders;&#xA;&#xA;        $job = [&#xA;            'batches' =&amp;gt; $batches,&#xA;            'total'   =&amp;gt; $grandTotal,&#xA;        ];&#xA;&#xA;        echo json_encode($job);&#xA;&#xA;    }&#xA;&#xA;&#xA;    public function actionCleanUpIndex ()&#xA;    {&#xA;        // Get overview&#xA;        $sourceIds      = $assetsSourcesBeingIndexed;&#xA;        $missingFiles   = craft()-&amp;gt;assetIndexing-&amp;gt;getMissingFiles($sourceIds, $sessionId);&#xA;        $missingFolders = $assetsMissingFolders;&#xA;&#xA;        $responseArray = array();&#xA;&#xA;        if ( !empty($missingFiles) || !empty($missingFolders) ) {&#xA;            $responseArray['confirm'] = craft()-&amp;gt;templates-&amp;gt;render('assets/_missing_items', array( 'missingFiles' =&amp;gt; $missingFiles, 'missingFolders' =&amp;gt; $missingFolders ));&#xA;            $responseArray['params']  = array( 'finish' =&amp;gt; 1 );&#xA;        }&#xA;        // Clean up stale indexing data (all sessions that have all recordIds set)&#xA;        $sessionsInProgress = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;                                        -&amp;gt;select('sessionId')&#xA;                                        -&amp;gt;from('assetindexdata')&#xA;                                        -&amp;gt;where('recordId IS NULL')&#xA;                                        -&amp;gt;group('sessionId')&#xA;                                        -&amp;gt;queryScalar();&#xA;&#xA;        if ( empty($sessionsInProgress) ) {&#xA;            craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;delete('assetindexdata');&#xA;        }&#xA;        else {&#xA;            craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;delete('assetindexdata', array( 'not in', 'sessionId', $sessionsInProgress ));&#xA;        }&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is done in 3 steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Trigger getIndexOverview, which returns an JSON object string that lists all your index rows.&lt;/li&gt;&#xA;&lt;li&gt;Use the JSON object in some way, and create a job for each row, which should trigger step #3.&lt;/li&gt;&#xA;&lt;li&gt;Trigger the index command with the parameters  --offset=x --sourceId=y --sessionId=z&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have used Laravel + Queue backed by Redis for this. If you have huge files, or a lot of data to process, think about spinning up a big VPS somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you can run 10-12 jobs in parallel, export your database/file structure, and tear the VPS down after. With hourly pricing, you'd end up paying a few $.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2016-12-08T11:39:55.223" LastActivityDate="2016-12-08T11:39:55.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18068" PostTypeId="2" ParentId="18065" CreationDate="2016-12-08T12:51:44.717" Score="3" Body="&lt;p&gt;I've encountered this issue myself when syncing asset indexes with S3 and after going through the Pixel &amp;amp; Tonic support channels, they advised me to create a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently my plugin only indexes sources that are held on S3 but I may update it in future to also do local sources. Assets will be getting a big overhaul for Craft 3 though. If you wish to move your assets to S3 and cannot find any other solutions to get it working then here is my plugin to help the indexing service: &lt;a href=&quot;https://github.com/a-digital/assetindexer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/a-digital/assetindexer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you manage to get it sorted.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2016-12-08T12:51:44.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18069" PostTypeId="2" ParentId="2359" CreationDate="2016-12-08T14:22:02.463" Score="0" Body="&lt;p&gt;Check your &lt;code&gt;craft/config/license.key&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ours got out of sync with a remote repo and contained unresolved conflict.&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2016-12-08T14:22:02.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18070" PostTypeId="1" AcceptedAnswerId="18072" CreationDate="2016-12-08T15:49:58.157" Score="1" ViewCount="62" Body="&lt;p&gt;Is there a hook in Craft to intercept an Entry before being returned to a (front-end) template? Thinking here of ways we can manipulate what is being returned in the Element Criteria Model without affecting the underlying content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts appreciated&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2016-12-08T17:38:34.227" Title="Plugin Development: intercept Entry before returned to template" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18071" PostTypeId="2" ParentId="18056" CreationDate="2016-12-08T16:53:45.913" Score="1" Body="&lt;p&gt;Also; in case this is part of your issue - the .htaccess file is a system file (starts with a dot) and will be hidden by default in your file browser. You either need to google how to show hidden files in your operating system, or open your project in an editor such as Visual Studio Code (free, cross platform) to see it.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-12-08T16:53:45.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18072" PostTypeId="2" ParentId="18070" CreationDate="2016-12-08T17:38:34.227" Score="0" Body="&lt;p&gt;Probably depends on the specifics of what you're trying to accomplish, but your best bets I'm guessing would be to listen to some of the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#element-api-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;element level events&lt;/a&gt;, make sure it's an entry and a site request, then do your logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeBuildElementsQuery&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBuildElementsQuery&lt;/a&gt;, and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onPopulateElements&quot; rel=&quot;nofollow noreferrer&quot;&gt;onPopulateElements&lt;/a&gt; are potential candidates. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-08T17:38:34.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18073" PostTypeId="2" ParentId="18002" CreationDate="2016-12-08T17:47:50.110" Score="1" Body="&lt;p&gt;There are a few possible ways to do this right now (Sprout Forms v2.3.4), all likely with a few trade-offs. We do have this situation on our radar to improve on in the future.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You could consider updating how you are storing those checkbox fields to use one or multiple Sprout Fields &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hidden Fields&lt;/a&gt;. With this method, the first page with your initial options doesn't need to be a part of the Form and you could dynamically populate the hidden field with the value of whatever is selected. The trade-off here may be in how you wish to create reporting around your data, and whether this format makes that easier or harder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could manage a multi-page form using a Javascript library on the front-end (something like &lt;a href=&quot;http://parsleyjs.org/doc/examples/multisteps.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;parsley.js&lt;/a&gt;). The trade-off here is that you have to add a javascript library to your setup, if you don't already need it for other things. We do have multi-page form support on our list. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can also do this by building your Form using &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Custom HTML&lt;/a&gt;. The trade-off here is that things become harder to maintain for a fairly small item.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It might be possible to use &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; and modify how the &quot;value&quot; parameter gets processed to make the &lt;code&gt;value&lt;/code&gt; variable for your checkbox field use the initially selected items.  I expect this path would get tricky. The template you'd probably want start with when overriding things is the &lt;code&gt;field.html&lt;/code&gt; template and the line that sets the value: &lt;code&gt;{%- set value            = ... %}&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2016-12-08T17:47:50.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18074" PostTypeId="1" AcceptedAnswerId="18079" CreationDate="2016-12-08T18:21:03.503" Score="1" ViewCount="106" Body="&lt;p&gt;I have setup chevrons to links to the previous and next posts.  It seems to work for all but a handful of posts.  Those posts generate the following template error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;url&quot;) on a null variable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;p class=&quot;post-meta&quot;&amp;gt;&#xA;            {% set prev = entry.getPrev( 'posts' ) %}&#xA;            {% set next = entry.getNext( 'posts' ) %}&#xA;&#xA;        &amp;lt;!-- previous post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-chevron-left&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;!--date of post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;{{ entry.postDate | date('F d, Y') }} &amp;lt;/span&amp;gt; &#xA;        &amp;lt;!-- next post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-chevron-right&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The specific line the template error references is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-chevron-left&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are previous entries to access.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-12-09T00:43:14.853" Title="Why do some entries generate a template error on get next or previous post when others do not?" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18075" PostTypeId="1" AcceptedAnswerId="18080" CreationDate="2016-12-08T19:49:03.430" Score="1" ViewCount="39" Body="&lt;p&gt;I have a related question regarding previous and next throwing a template error for some entries.  This is similar, but different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few entries in the same section depict the wrong previous and next ent.   Instead of linking to the previous or next entry they link to the About or 404 page.  It only impacts 2 or 3 out of 100 entries - but always the same 2-3 entries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no templates errors - just the wrong urls being printed for a small subset of the entries.  Here is the code...   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;`&#xA;                {% set prev = entry.getPrev( 'posts' ) %}&#xA;                {% set next = entry.getNext( 'posts' ) %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;!-- previous post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-chevron-left&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;!--date of post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;{{ entry.postDate | date('F d, Y') }} &amp;lt;/span&amp;gt; &#xA;        &amp;lt;!-- next post --&amp;gt;&#xA;        &amp;lt;span&amp;gt;&amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-chevron-right&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/p&amp;gt;`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-12-09T00:39:09.330" Title="Wrong urls printed for small subset using getNext and getPrev" Tags="&lt;templating&gt;&lt;error-templates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18076" PostTypeId="2" ParentId="18051" CreationDate="2016-12-08T19:52:41.910" Score="2" Body="&lt;p&gt;After some exploration and trial and error, I was able to find a solution. Ultimately there are two problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;startDateTime&lt;/code&gt;, &lt;code&gt;endDateTime&lt;/code&gt; and php’s &lt;code&gt;date()&lt;/code&gt; function were not returning the same timezone date &amp;amp; time.&lt;/li&gt;&#xA;&lt;li&gt;The correct formatting for matching multiple values needs to be in an array.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the top of my elementapi.php file I added this line to make sure php’s &lt;code&gt;date()&lt;/code&gt; function returns the same timezone craft has been set to in the admin config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;date_default_timezone_set(craft()-&amp;gt;timezone);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I reformatted my &lt;code&gt;criteria&lt;/code&gt; settings as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'mySection', &#xA;    'type' =&amp;gt; 'mySectionType',&#xA;    'startDateTime' =&amp;gt; ['&amp;lt;=' . date(&quot;Y-m-d H:i:s.u&quot;), ':empty:'],&#xA;    'endDateTime' =&amp;gt; ['&amp;gt;=' . date(&quot;Y-m-d H:i:s.u&quot;), ':empty:']&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2016-12-08T19:52:41.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18077" PostTypeId="2" ParentId="18074" CreationDate="2016-12-08T22:08:07.933" Score="1" Body="&lt;p&gt;Take a look at this: &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/paginate&lt;/a&gt; &#xA;This is the standard craft reference what I use all the time. If you use this it will work!&lt;/p&gt;&#xA;" OwnerUserId="5977" LastActivityDate="2016-12-08T22:08:07.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18078" PostTypeId="2" ParentId="18075" CreationDate="2016-12-08T22:15:35.763" Score="1" Body="&lt;p&gt;Take a look at this: &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/paginate&lt;/a&gt; &#xA;I use this all the time and it will work then. &lt;/p&gt;&#xA;" OwnerUserId="5977" LastActivityDate="2016-12-08T22:15:35.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18079" PostTypeId="2" ParentId="18074" CreationDate="2016-12-09T00:25:47.587" Score="2" Body="&lt;p&gt;First – you're passing a string value (&lt;code&gt;'posts'&lt;/code&gt;) to the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getPrev()&lt;/code&gt;&lt;/a&gt; methods, which will produce unreliable results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; methods actually expect either an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; instance, or an object representing an ElementCriteriaModel's attributes (i.e. a query like &lt;code&gt;{ section: 'posts' }&lt;/code&gt; – not a string, number or any other, non-iterable value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing &lt;code&gt;'posts'&lt;/code&gt; is a section handle, but Craft won't know that and it will just ignore the string and &lt;em&gt;return any element matching the current element's type&lt;/em&gt; - so if you call &lt;code&gt;entry.getNext('posts')&lt;/code&gt;, you're probably going to get an entry back, but it won't reliably be an entry from the &lt;code&gt;'posts'&lt;/code&gt; section; it could be an entry from &lt;em&gt;any&lt;/em&gt; section in your system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's how your code probably should look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = { section: 'posts' } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;{% set next = entry.getNext(criteria) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If this code is in an entry template, you could even do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = { section: entry.section } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An additional tidbit: The only instance where it's ok to call &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; without passing an ECM (or pass an invalid value, like a string), is whenever your &lt;code&gt;entry&lt;/code&gt; variable is already part of an element result set – for instance, whenever you're looping on the result of a &lt;code&gt;craft.entries&lt;/code&gt; query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('posts') %}&#xA;    ...&#xA;    {% set next = entry.getNext() %}&#xA;    {% if next %}&#xA;        &amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;{{ next.title }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for the error message you're seeing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; methods should always be wrapped in a conditional, because &lt;em&gt;they won't realibly, always return an element&lt;/em&gt; (i.e., there might not &lt;em&gt;be&lt;/em&gt; a &quot;next&quot; or &quot;previous&quot; entry in your current context):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = entry.getNext(criteria) %}&#xA;{% set next = entry.getPrev(criteria) %}&#xA;&#xA;{% if prev %}&#xA;    &amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;{{ prev.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if next %}&#xA;    &amp;lt;a href=&quot;{{ next.url }}&quot;&amp;gt;{{ next.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message you're getting, is simply stating that there is no &lt;code&gt;url&lt;/code&gt; attribute for one of your &lt;code&gt;next&lt;/code&gt; or &lt;code&gt;prev&lt;/code&gt; variables – meaning that those variables don't actually refer to valid elements, because the &lt;code&gt;getNext()&lt;/code&gt; and/or &lt;code&gt;getPrev()&lt;/code&gt; methods returned a NULL value. Simply wrap your code in conditionals, and the error will go away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to make sure that you're always displaying both a &quot;next&quot; and a &quot;previous&quot; link, you can make the links &quot;loop&quot; by having them point to the &lt;em&gt;first&lt;/em&gt; and &lt;em&gt;last&lt;/em&gt; entries respectively, whenever there isn't a next or previous entry in the set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = craft.entries.section('posts') %}&#xA;...&#xA;{% set next = entry.getNext(criteria) ?? criteria.first() %}&#xA;{% set prev = entry.getPrev(criteria) ?? criteria.last() %} &#xA;...&#xA;{% if next %}&#xA;    &amp;lt;a href=&quot;{{ next.url )}&quot;&amp;gt;{{ next.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-09T00:43:14.853" LastActivityDate="2016-12-09T00:43:14.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18080" PostTypeId="2" ParentId="18075" CreationDate="2016-12-09T00:33:36.197" Score="2" Body="&lt;p&gt;I believe I already answered this in the OP's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18074/why-do-some-entries-generate-a-template-error-on-get-next-or-previous-post-when/18079#18079&quot;&gt;other, similar question&lt;/a&gt;, but:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You shouldn't pass a string value (i.e. &lt;code&gt;'posts'&lt;/code&gt;) to &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getPrev()&lt;/code&gt;&lt;/a&gt; – those methods expect either an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; instance, or an object with attributes representing a query (i.e. something like &lt;code&gt;{ section: 'posts' }&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What actually happens when you call &lt;code&gt;entry.getPrev('posts')&lt;/code&gt;, is that Craft will just &lt;em&gt;ignore&lt;/em&gt; the string value (I'm guessing &lt;code&gt;'posts'&lt;/code&gt; is a section handle, but there's no way for Craft to know that), and you're probably going to get an EntryModel back, but it won't reliably be from the same section as your current &lt;code&gt;entry&lt;/code&gt; – it can be an entry from &lt;em&gt;any&lt;/em&gt; section in your system, which is probably where your problem is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's how your code should probably look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = { section: 'posts' } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;{% set next = entry.getNext(criteria) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also include other attributes, like for example &lt;code&gt;order&lt;/code&gt; (otherwise, default attributes will apply, such as &lt;code&gt;postDate desc&lt;/code&gt; for a Channel section, or &lt;code&gt;structure&lt;/code&gt; for a Structure):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = { section: 'posts', order: 'title asc' } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and of course, you can make the criteria dynamic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = { section: entry.section } %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, make sure to always wrap the returned values from &lt;code&gt;getNext()&lt;/code&gt; and &lt;code&gt;getPrev()&lt;/code&gt; in a conditional – you can't always be sure that there'll &lt;em&gt;be&lt;/em&gt; a valid &quot;next&quot; or &quot;previous&quot; element for any given entry, so this avoids template errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = entry.getPrev(criteria) %}&#xA;...&#xA;{% if prev %}&#xA;    &amp;lt;a href=&quot;{{ prev.url }}&quot;&amp;gt;{{ prev.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, it's possible to declare a fallback value whenever there isn't a next or previous element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set next = entry.getNext(criteria) ?? craft.entries(criteria).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2016-12-09T00:39:09.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18081" PostTypeId="1" AcceptedAnswerId="18082" CreationDate="2016-12-09T02:03:33.557" Score="0" ViewCount="201" Body="&lt;p&gt;I have a for loop for all entries.  There is no limit set, yet the loop is not displaying all the entries.  The missing entries are the oldest.  These missing entries do appear on category specific pages.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no errors.  I have approximately 100 entries.  The for loop is only displaying the most recent 80 or so.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? &#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in craft.entries.section('posts') %}&#xA;                {% if loop.first and craft.request.pageNum == 1 %}  &#xA;                    &amp;lt;div class=&quot;box col-sm-4 col-md-6&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;thumb featured dark-overlay&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;photo&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{post.url}}&quot;&amp;gt;&#xA;                                &amp;lt;img src=&quot;{{post.postImage.first().getUrl('featuredImage')}}&quot; alt=&quot;&quot; width=&quot;715&quot; height=&quot;715&quot;&amp;gt;&#xA;&#xA;                                &amp;lt;span class=&quot;info&quot;&amp;gt;&amp;lt;strong class=&quot;big-title&quot;&amp;gt;{{post.title}}&amp;lt;/strong&amp;gt;&amp;lt;span class=&quot;excerpt&quot;&amp;gt;{{post.tagline}}&amp;lt;/span&amp;gt;&#xA;                                &amp;lt;em class=&quot;arrow-right&quot;&amp;gt;&amp;lt;/em&amp;gt;&amp;lt;/span&amp;gt;&#xA;                            &amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                {% else %}&#xA;                &amp;lt;div class=&quot;box col-xs-6 col-sm-4 col-md-3&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;thumb&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;photo&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{post.url}}&quot;&amp;gt;&#xA;                                &amp;lt;img src=&quot;{{post.postImage.first().getUrl('thumbImage')}}&quot; alt=&quot;&quot; width=&quot;434&quot; height=&quot;434&quot;&amp;gt;&#xA;                                &amp;lt;span class=&quot;info&quot;&amp;gt;&amp;lt;strong class=&quot;title&quot;&amp;gt;{{post.title}}&amp;lt;/strong&amp;gt;&#xA;                                    &amp;lt;!--&amp;lt;span class=&quot;excerpt&quot;&amp;gt;{{post.tagline}}&amp;lt;/span&amp;gt;--&amp;gt;&#xA;                                &amp;lt;em class=&quot;arrow-right&quot;&amp;gt;&amp;lt;/em&amp;gt;&amp;lt;/span&amp;gt;&#xA;                            &amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;      &#xA;                {% endif %}&#xA;                {% endfor %}                &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2016-12-09T02:12:56.457" Title="For loop does not display all entries in section" Tags="&lt;forloop&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18082" PostTypeId="2" ParentId="18081" CreationDate="2016-12-09T02:12:56.457" Score="4" Body="&lt;p&gt;Craft has a default limit of a 100 elements returned via an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;. To pull &lt;em&gt;all&lt;/em&gt; elements, you'll need to explicitly set &lt;code&gt;limit&lt;/code&gt; to &lt;code&gt;null&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for post in craft.entries.section('posts').limit(null) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-09T02:12:56.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18083" PostTypeId="1" CreationDate="2016-12-09T02:17:08.293" Score="1" ViewCount="216" Body="&lt;p&gt;I am looking for a way to send an email based on the products ordered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking this needed to be done using custom order statuses. Although, this would require the ability to change the default order status based on product. And with multiple product types ordered, would require the ability to set multiple statuses to an order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, at this stage the ideal solution would be a custom email that is sent conditionally based on products ordered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have so far been unable to find a solution for this. Any chance this is possible?&lt;/p&gt;&#xA;" OwnerUserId="5966" LastActivityDate="2016-12-09T03:17:14.720" Title="Custom Email Based on Product Ordered" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18084" PostTypeId="2" ParentId="18083" CreationDate="2016-12-09T03:03:13.933" Score="1" Body="&lt;p&gt;This is not hard to implement in Commerce if you're ok with all the content going in one email (which I think is a better approach from the customer's point of view - we used to do this as separate emails years ago but customers got irritated that one order results in a whole bunch of emails). If you do want to trigger multiple separate emails, that's a tiny bit harder - but would not be difficult to implement in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Sketch of that approach - listen to &lt;code&gt;onOrderComplete&lt;/code&gt; and loop through cart items.  For any that match your desired triggers, parse a template and then email it off with Craft's email functions - simple stuff as far as plugins go - let me know if you want me to expand on this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But back to the one email approach - your order emails (receipts or any triggered by any other status) - are full twig templates - that means you can use conditionals, includes etc, to achieve what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, in your email template, you can loop through the products in the order and set content into some 'storage' variables (with the content being directly written in that template, or stored in fields on your products, or stored in entries in a section, or using include of other templates - anything really!).... and then output that content later in the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do this to produce a 'Super Receipt' - basically a receipt that includes a whole lot of additional 'How To Get The Best From Your XXX' type content.  This content comes, in our case, from 3 levels - the product category for stuff that applies to e.g. all monitors, the brand, for brand specific stuff (how to get support from NEC, for example), and finally from product specific content.  This allows for very quickly building up libraries of this content, and a nice hierarchy of concerns.  Categories, Brands and Products each have a field &lt;code&gt;autoResponder&lt;/code&gt; that holds this content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clients love it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# Store items we've seen already so we don't get duplicate AR content #}&#xA;    {% set seenItems = [] %}&#xA;    {% set seenProductCategories = [] %}&#xA;    {% set seenProductBrands = [] %}&#xA;&#xA;    {# And store the actual content we need to print out at the end in groups #}&#xA;    {% set arProductContent = {} %}&#xA;    {% set arBrandContent = {} %}&#xA;    {% set arCatgeoryContent = {} %}&#xA;&#xA;    {% for lineItem in order.lineItems %}&#xA;&#xA;        {# No need to look at the same products twice... #}&#xA;        {% if lineItem.purchasable.product.id not in seenItems %}&#xA;&#xA;            {% set seenItems = seenItems|merge([lineItem.purchasable.product.id]) %}&#xA;&#xA;&#xA;                {# Category AR content #}&#xA;                {% if lineItem.purchasable.product.id not in suppressedIds %}&#xA;                    {% for category in lineItem.purchasable.product.categories %}&#xA;                        {% if category.autoResponder|length %}&#xA;                            {% set arCatgeoryContent = arCatgeoryContent|merge({(category.title):category.autoResponder})  %}                             &#xA;                        {% endif %}&#xA;                    {% endfor %}  &#xA;                {% endif %} &#xA;&#xA;                {# Brand AR Content #}&#xA;                {% set brand = lineItem.purchasable.product.brand.first() %}&#xA;                {% if brand|length %}&#xA;                    {% if brand.id not in seenProductBrands %}&#xA;                        {% if brand.autoResponder|length %}&#xA;                            {% set seenProductBrands = seenProductBrands|merge([brand.id]) %}&#xA;                            {% set arBrandContent = arBrandContent|merge({(brand.title):brand.autoResponder})  %}&#xA;                        {% endif %}&#xA;                    {% endif %}&#xA;                {% endif %}&#xA;&#xA;                {# Product AR Content  #}&#xA;                {% set product = lineItem.purchasable.product %}&#xA;                {% if product.autoResponder|length and product.type != &quot;service&quot; %}                        &#xA;                    {% set preamble = '&amp;lt;small&amp;gt;See also: &amp;lt;a href=&quot;' ~ product.url ~ '#wiki&quot;&amp;gt;' ~ product.title ~ ' wiki&amp;lt;/a&amp;gt;&amp;lt;/small&amp;gt;' %}&#xA;                    {% set arProductContent = arProductContent|merge({(product.title): preamble|raw ~ product.autoResponder})  %}&#xA;                {% endif %}&#xA;&#xA;         {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {# Now, print it all out, most general &amp;amp; needed to most specific #}&#xA;&#xA;    {% for key, content in arCatgeoryContent %}&#xA;        {{ emailLib.paraWithHeader ( key, content|raw )}}&#xA;    {% endfor %}&#xA;&#xA;    {% for key, content in arBrandContent %}&#xA;        {{ emailLib.paraWithHeader ( key, content|raw )}}&#xA;    {% endfor %}&#xA;&#xA;    {% for key, content in arProductContent %}&#xA;        {{ emailLib.paraWithHeader ( key, content|raw )}}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-12-09T03:17:14.720" LastActivityDate="2016-12-09T03:17:14.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18085" PostTypeId="1" AcceptedAnswerId="18093" CreationDate="2016-12-09T09:13:32.650" Score="2" ViewCount="825" Body="&lt;p&gt;For production site, the backend url is like - 'www.abc-prod.com'&#xA;While the actual live site url is - 'www.xyz.com'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When opening live preview for an entry, page never loads. Instead '301 Moved Permanently' is the status of response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HsXb8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HsXb8.png&quot; alt=&quot;Response Headers&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have enabled CORS by adding following headers in response-&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Access-Control-Allow-Origin: &lt;a href=&quot;https://www.abc-prod.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.abc-prod.com&lt;/a&gt;&lt;br&gt;&#xA;  Access-Control-Allow-Headers: origin, x-requested-with, content-type&lt;br&gt;&#xA;  Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS&lt;br&gt;&#xA;  Access-Control-Allow-Credentials: true&lt;br&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Still getting blank page for live review. What exactly I am missing?&lt;/p&gt;&#xA;" OwnerUserId="5469" LastActivityDate="2016-12-09T19:04:25.733" Title="Live preview not working for CORS" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18086" PostTypeId="1" AcceptedAnswerId="18087" CreationDate="2016-12-09T09:39:06.400" Score="2" ViewCount="709" Body="&lt;p&gt;I have the following text search input field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to search each keyword in the user's query with the OR logic as per &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;salty OR dog  containing either “salty” or “dog” (or both).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I separate the user's text search for &quot;salty dog&quot; so that the search query returns results for &quot;salty&quot; or &quot;dog&quot; instead of only for results containing &quot;salty dog&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is how I currently have the search set up in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search('*' ~ query ~ '*').order('score') %}&#xA;{% paginate craft.entries.search('*' ~ query ~ '*').limit(10).order('score') as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have fuzzy search enabled via config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'defaultSearchTermOptions' =&amp;gt; array(&#xA;   'subLeft' =&amp;gt; true,&#xA;   'subRight' =&amp;gt; true,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4095" LastActivityDate="2016-12-09T10:15:17.280" Title="Searching for any keyword in query" Tags="&lt;search&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18087" PostTypeId="2" ParentId="18086" CreationDate="2016-12-09T10:09:17.303" Score="3" Body="&lt;p&gt;One way to do it is to split the search query on spaces, and then join it with &lt;code&gt;'OR'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q')|split(' ')|join(' OR ') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will convert the search term &lt;code&gt;&quot;salty dog&quot;&lt;/code&gt; to &lt;code&gt;&quot;salty OR dog&quot;&lt;/code&gt;. It'll work regardless of the number of keywords in the original search query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably also make sure that you remove redundant whitespace from the original query, if you don't then a search query like &lt;code&gt;&quot;salty  dog&quot;&lt;/code&gt; (double space) will result in a query like &lt;code&gt;&quot;salty OR OR dog&quot;&lt;/code&gt;. Here's how you could do that using some regex and the &lt;code&gt;replace&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q')|replace('/(( )+|(\\n)+)/', ' ')|split(' ')|join(' OR ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-09T10:15:17.280" LastActivityDate="2016-12-09T10:15:17.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18088" PostTypeId="1" CreationDate="2016-12-09T12:59:33.593" Score="1" ViewCount="324" Body="&lt;p&gt;I know this question has come up many times before, although after reading and trying dozens of answers, I am none the wiser.&#xA;I am currently rebuilding my website with Ubuntu 16.04, PHP7 and apache. And what worked flawlessly on my old site (Ubuntu 14) is now not, and I cannot hide the index.php within the URL without the site crashing. This of course breaks any links to finish the craft completion and therefore is not operational.&#xA;Here is my .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [$&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;    &amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have entered garbage within the .htaccess and am not receiving any change, therefore I presume it is an issue with this.&#xA;The .hta is within my web route of /var/www/public_html, which is indexed correctly withing the apache config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've edited apache config to  allow overriding:       &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory /&amp;gt;&#xA;  Options FollowSymLinks&#xA;  AllowOverride All&#xA;  Require all granted&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also made sure that omitting script names is enabled:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array( // production by default&#xA;    'siteName' =&amp;gt; '*****',&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://' . $_SERVER['SERVER_NAME'] . '/',&#xA;    'timezone' =&amp;gt; 'Europe/London',&#xA;    'allowAutoUpdates' =&amp;gt; true,&#xA;    'cpTrigger' =&amp;gt; 'mgmt',&#xA;    'rememberUsernameDuration' =&amp;gt; false,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Sigh&lt;/em&gt; If anybody could suggest anything else, it would be very much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5984" LastEditorUserId="57" LastEditDate="2016-12-09T19:06:32.077" LastActivityDate="2016-12-15T12:01:02.033" Title="Cannot omit index.php from URL" Tags="&lt;url&gt;&lt;htaccess&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18091" PostTypeId="1" AcceptedAnswerId="18101" CreationDate="2016-12-09T17:45:41.717" Score="2" ViewCount="326" Body="&lt;p&gt;Any ideas how to add custom fields to the address Model? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add a free text input for County, so that it can be used for the equivalent in any country, as the shop sells to more than UK. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon doing so, I get the following error when trying to edit an address;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\Commerce_AddressModel and its behaviors do not have a method or closure named &quot;county&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2016-12-13T16:17:16.657" Title="Adding a County input field into Address in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18093" PostTypeId="2" ParentId="18085" CreationDate="2016-12-09T19:04:25.733" Score="2" Body="&lt;p&gt;Live Preview across different root domains is currently not possible in Craft. See here for more info: &lt;a href=&quot;https://craftcms.stackexchange.com/a/14966/57&quot;&gt;https://craftcms.stackexchange.com/a/14966/57&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use it across different subdomains that share the same root domain, though: &lt;a href=&quot;https://craftcms.com/support/cross-domain-live-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/cross-domain-live-preview&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2016-12-09T19:04:25.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18094" PostTypeId="1" CreationDate="2016-12-09T21:31:18.527" Score="1" ViewCount="148" Body="&lt;p&gt;I'm using solspace's freeform with the mailchimp mailing list plugin. All is working OK except I don't want to see the checkbox on the form. Can this be hidden with with an 'override' in the form tag?&lt;/p&gt;&#xA;" OwnerUserId="4962" LastActivityDate="2016-12-09T21:31:18.527" Title="Hide mailchimp checkbox?" Tags="&lt;plugin-mailchimpsubscribe&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18096" PostTypeId="2" ParentId="18091" CreationDate="2016-12-09T21:49:17.760" Score="2" Body="&lt;p&gt;Currently (Dec '16) - custom fields are not able to be used with addresses in Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best best is probably to add a field to your orders and pretend it's on addresses, but obviously if you deal with multiple addresses, as you probably do, that gets a bit tricky quickly.  You could implement a plugin that has it's own table of records that associate addressIDs with a county field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pretty sure it's on the Commerce radar but you're a bit stuck right now I think, without some extra work.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-09T21:49:17.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18097" PostTypeId="1" AcceptedAnswerId="18098" CreationDate="2016-12-10T22:44:31.853" Score="2" ViewCount="241" Body="&lt;p&gt;Is it possible to output Profiling Summary Report when in devMode? Looking to print this out onto a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Time:   0.36980s&#xA;Memory: 20,563Kb&#xA;Total Queries: 19&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2016-12-11T13:57:35.577" Title="Is it possible to output Profiling Summary Report (devMode)" Tags="&lt;devmode&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18098" PostTypeId="2" ParentId="18097" CreationDate="2016-12-10T23:00:15.380" Score="2" Body="&lt;p&gt;Off the top of my head, I don't think it's going to be possible, at least in the context of outputting it from a Twig variable.  That info comes from Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CProfileLogRoute&quot; rel=&quot;nofollow noreferrer&quot;&gt;CProfileLogRoute&lt;/a&gt; class, which Craft extends at &lt;a href=&quot;https://craftcms.com/classreference/etc/logging/ProfileLogRoute&quot; rel=&quot;nofollow noreferrer&quot;&gt;etc\logging\ProfileLogRoute&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But with all of Yii's logging, that stuff doesn't get flushed to disk (for FileLogRoute) or to the browser's console (for ProfileLogRoute) until the very end of the request, which will be after the template has already rendered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you view source with devMode enabled, you can see they just append it to the very end of the DOM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could write a plugin that used &lt;code&gt;craft()-&amp;gt;log-&amp;gt;addLogRoute()&lt;/code&gt; that added your own custom ProfileLogRoute that extended Craft's and instead of appending to the end of the DOM, added it to some other part of the template, but seems like a pretty brittle solution.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="91" LastEditDate="2016-12-11T13:57:35.577" LastActivityDate="2016-12-11T13:57:35.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18099" PostTypeId="2" ParentId="17956" CreationDate="2016-12-11T11:00:01.450" Score="1" Body="&lt;p&gt;the error was with the &lt;code&gt;date&lt;/code&gt; format in the date comparison conditional and the &lt;code&gt;until&lt;/code&gt; tag instead of &lt;code&gt;unless&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentTime &amp;lt;= newsDate | date('c') %} {# those two dates were formated differentely #}&#xA;    {% set invalidate = newsDate.expiryDate | date('c') %}&#xA;{% else %}&#xA;    {% set invalidate = auffuehrung.konzertStartdate |date('c') %}&#xA;{% endif %}&#xA;&#xA;{% cache until invalidate %} {# not unless #}&#xA; {# blablabla #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-11T11:00:01.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18101" PostTypeId="2" ParentId="18091" CreationDate="2016-12-11T19:20:55.053" Score="2" Body="&lt;p&gt;Currently (Dec '16) I have managed to get around this by re-using the Region/State field and passing this information through as a text field input that the user can enter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label class=&quot;label&quot; for=&quot;{{ modelName }}-stateName&quot;&amp;gt;County&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-stateName&quot; name=&quot;{{ modelName }}[stateName]&quot; value=&quot;{{ model.stateName}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This ensures that the County is saved in the address model. It can be access as per any other address field in the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set the back-end has all States/Regions to be empty. But the user-entered text field is still stored against each customer saved address or order billing/shipping addresses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only downfall at the moment, is that in the back-end this is stored out-of order in terms of a structured UK address. The system stores this AFTER the postcode/zip code field.&#xA;So an address format looks like this;&#xA;Address Line 1&lt;br&gt;&#xA;Address Line 2&lt;br&gt;&#xA;Town/City&lt;br&gt;&#xA;Postcode&lt;br&gt;&#xA;Region&lt;br&gt;&#xA;Country  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Address Line 1&lt;br&gt;&#xA;Address Line 2&lt;br&gt;&#xA;Town/City&lt;br&gt;&#xA;Region &#xA;Postcode&lt;br&gt;&#xA;Country&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2016-12-13T16:17:16.657" LastActivityDate="2016-12-13T16:17:16.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18102" PostTypeId="1" AcceptedAnswerId="18110" CreationDate="2016-12-11T19:56:35.340" Score="3" ViewCount="496" Body="&lt;p&gt;In my user profiles, I have a text field where the user's timezone is set, in the standard &lt;code&gt;America/New_York&lt;/code&gt; format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's timezone is set to New York, and the server's timezone is set to UTC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to use the Twig date filter to localize the times using the user profile timezone field, but it doesn't seem to be working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ message.postDate | date('n/d/Y g:ia') }}&lt;/code&gt; outputs 12/11/2016 1:00pm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping that for a user in the pacific timezone, this time will display as 10:00am. But this is what happens:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ currentUser.userTimezone }}&lt;/code&gt; outputs America/Los_Angeles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ message.postDate | date('n/d/Y g:ia', currentUser.userTimezone) }}&lt;/code&gt; still outputs 12/11/2016 1:00pm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried just hard-coding a different timezone in, to no avail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ message.postDate | date('n/d/Y g:ia', 'America/Los_Angeles') }}&lt;/code&gt; still outputs 12/11/2016 1:00pm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong? Or is there a different way to do this?&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2016-12-12T11:10:21.257" Title="Using user-selectable timezones to show localized post dates" Tags="&lt;localization&gt;&lt;filter&gt;&lt;postdate&gt;&lt;timezone&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18103" PostTypeId="2" ParentId="4935" CreationDate="2016-12-11T20:02:26.007" Score="2" Body="&lt;p&gt;Just wanted to add another example to this since this post help point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my example, I am getting back a list of events from a 3rd party. All that is returned to me is the slug. But, you can see that I wanted the url to be prepended with &lt;code&gt;/event-results/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url('/evnet-results/'~event.slug) }}&quot;&amp;gt;{{ event.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2016-12-11T20:02:26.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18105" PostTypeId="1" CreationDate="2016-12-11T21:27:32.370" Score="0" ViewCount="166" Body="&lt;p&gt;I've got a basic jQuery script that I use to update the cart, either through the actions &lt;code&gt;/actions/commerce/cart/updateCart&lt;/code&gt; (if product isn't in cart yet) or &lt;code&gt;/actions/commerce/cart/updateLineItem&lt;/code&gt; (if product is already in cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been working fine, however I'm noticing the ajax return object is returning with property &lt;code&gt;.success&lt;/code&gt; as true even if the product that was added was out of stock. This leaves the user thinking the product was added, rather than being able to say it wasn't and was out of stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example (not the direct code, might have some errors, but the gist of what I am doing is:)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTML&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;addToCartForm&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/cart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ product.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;jQuery .. on submit form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$form = (&quot;#addToCartForm&quot;);&#xA;&#xA;var form_data = $form.serializeArray()&#xA;&#xA;form_data.push({&#xA;    name: window.csrfTokenName,&#xA;    value: window.csrfTokenValue&#xA;})&#xA;&#xA;&#xA;$.post('/actions/commerce/cart/updateCart', form_data, function(response) {&#xA;&#xA;    if(response.success) { &#xA;    console.log(&quot;success&quot;); &#xA;    }&#xA;&#xA;    else if(response.error) { &#xA;    console.log(response.error); &#xA;    }&#xA;&#xA;    else {&#xA;    console.log(&quot;neither a success nor an error returned.. ¯\_(ツ)_/¯&quot;);&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that if the product has no stock left, &lt;code&gt;response&lt;/code&gt; still returns with &lt;code&gt;success&lt;/code&gt;. Right now, I figured the best thing I can do is look inside &lt;code&gt;response.cart.lineItems&lt;/code&gt; and see if the new purchasableId exists in there. If not, than I can assume it wasn't added and will just have to use that as an indicator that stock was empty - although that'd be an assumption not always true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or would there be a reason/mistake that could cause commerce to return &lt;code&gt;.success&lt;/code&gt; as true even when the product being added is out of stock?&lt;/p&gt;&#xA;" OwnerUserId="2221" LastActivityDate="2017-01-12T08:14:15.050" Title="Commerce - Ajax returning obj.success even when failed" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18106" PostTypeId="1" AcceptedAnswerId="18107" CreationDate="2016-12-12T01:14:32.010" Score="1" ViewCount="375" Body="&lt;p&gt;I'm setting up cron jobs from my plugin and I need to format the date in the server's time zone. It looks like Craft is overriding the timezone set in php.ini because PHP's &lt;code&gt;date_default_timezone_get()&lt;/code&gt; always returns UTC. Is there another way to get the actual timezone set on the server?&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2016-12-12T01:14:32.010" Title="How can I get the server's timezone in a Craft plugin?" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18107" PostTypeId="2" ParentId="18106" CreationDate="2016-12-12T01:14:32.010" Score="1" Body="&lt;p&gt;Use &lt;code&gt;ini_get('date.timezone')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://php.net/manual/en/function.ini-get.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://php.net/manual/en/function.ini-get.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2016-12-12T01:14:32.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18108" PostTypeId="2" ParentId="18102" CreationDate="2016-12-12T03:44:12.763" Score="2" Body="&lt;p&gt;This is a known Craft 2 bug in our overridden implementation of PHP's DateTime class and how Twig interacts with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be fixed before the Craft 3 beta launch because it is on our list to stop overriding that class and rely on PHP's native functionality.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-12T03:44:12.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18109" PostTypeId="1" AcceptedAnswerId="18111" CreationDate="2016-12-12T09:17:33.270" Score="3" ViewCount="140" Body="&lt;p&gt;I am currently using &lt;a href=&quot;https://straightupcraft.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;an import plugin&lt;/a&gt; to import csv data into a channel section and it works just fine. Now I want to import the entries in a second language. Does anyone have any experiences with this?&#xA;Since the import works great, I could set up a new channel for the second language, but I wonder if there's a chance to import translations for existing entries.&lt;/p&gt;&#xA;" OwnerUserId="5212" LastActivityDate="2016-12-12T14:59:10.273" Title="Multilinugual Import" Tags="&lt;import&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18110" PostTypeId="2" ParentId="18102" CreationDate="2016-12-12T11:10:21.257" Score="4" Body="&lt;p&gt;It is possible to work around the Craft 2 bug, by converting the Craft DateTime object to a native one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set craftDateTime = entry.postDate %}&#xA;{% set nativeDateTime = date(craftDateTime|date('c')) %}&#xA;&#xA;{{ nativeDateTime|date('n/d/Y g:ia', 'America/Los_Angeles') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-12T11:10:21.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18111" PostTypeId="2" ParentId="18109" CreationDate="2016-12-12T14:59:10.273" Score="3" Body="&lt;p&gt;We recently built our first multi lingual site on craft and used FeedMe to import our entries. What we did was to set up fields such as enDesc, deDesc, svDesc. Then when we imported our entries into craft mapping all of our multi lingual content to be spread across these fields in a single locale. Once this was done we then ran a script across the database to copy the content from deDesc into enDesc on the entry with the locale set to de, and then the same for sv also. Here is the script we built to get this job done. We ran this script from a program called CodeRunner on Mac, but you could equally FTP this up to the server and navigate your browser to it to run the script.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;$servername = &quot;XX.XXX.XXX.XXX&quot;;&#xA;$username = &quot;db_username&quot;;&#xA;$password = &quot;db_password&quot;;&#xA;$dbname = &quot;db_name&quot;;&#xA;date_default_timezone_set('GMT');&#xA;&#xA;// Create connection&#xA;$conn = new mysqli($servername, $username, $password, $dbname);&#xA;&#xA;// Check connection&#xA;if ($conn-&amp;gt;connect_error) {&#xA;    die(&quot;Connection failed: &quot; . $conn-&amp;gt;connect_error);&#xA;}&#xA;echo &quot;Connected successfully&quot;;&#xA;$fieldName = &quot;Desc&quot;;&#xA;$failed = 0;&#xA;$result = $conn-&amp;gt;query(&quot;SELECT * FROM craft_content WHERE field_de&quot;.$fieldName.&quot; &amp;lt;&amp;gt; '' AND locale = 'en';&quot;);&#xA;while($row = $result-&amp;gt;fetch_assoc()) {&#xA;    $elementId = $row['elementId'];&#xA;    $desc = $row['field_de'.$fieldName];&#xA;    if ($conn-&amp;gt;query(&quot;UPDATE craft_content SET field_en&quot;.$fieldName.&quot;='&quot;.$desc.&quot;', field_de&quot;.$fieldName.&quot;=NULL WHERE elementId='&quot;.$elementId.&quot;' AND locale = 'de';&quot;) === TRUE) {&#xA;        echo &quot;Updated &quot;.$row['title'].&quot; - de&quot;;&#xA;    } else {&#xA;        echo &quot;Failed &quot;.$row['title'].&quot; - de&quot;;&#xA;        $failed++;&#xA;    }&#xA;}&#xA;$result = $conn-&amp;gt;query(&quot;SELECT * FROM craft_content WHERE field_swe&quot;.$fieldName.&quot; &amp;lt;&amp;gt; '' AND locale = 'en';&quot;);&#xA;while($row = $result-&amp;gt;fetch_assoc()) {&#xA;    $elementId = $row['elementId'];&#xA;    $desc = $row['field_swe'.$fieldName];&#xA;    if ($conn-&amp;gt;query(&quot;UPDATE craft_content SET field_en&quot;.$fieldName.&quot;='&quot;.$desc.&quot;', field_swe&quot;.$fieldName.&quot;=NULL WHERE elementId='&quot;.$elementId.&quot;' AND locale = 'sv';&quot;) === TRUE) {&#xA;        echo &quot;Updated &quot;.$row['title'].&quot; - swe&quot;;&#xA;    } else {&#xA;        echo &quot;Failed &quot;.$row['title'].&quot; - swe&quot;;&#xA;        $failed++;&#xA;    }&#xA;}&#xA;if ($failed == 0) {&#xA;    if ($conn-&amp;gt;query(&quot;UPDATE craft_content SET field_de&quot;.$fieldName.&quot;=NULL, field_swe&quot;.$fieldName.&quot;=NULL;&quot;) === TRUE) {&#xA;        echo &quot;Cleanup Complete&quot;;&#xA;    } else {&#xA;        echo &quot;Cleanup Failed&quot;;&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once this had completed, the values from deDesc and svDesc should have copied into enDesc on both the German and Swedish locale entries. The values for deDesc and svDesc will also be removed if there were no errors. All you need to do now is rename your field from enDesc to desc and delete the deDesc and svDesc fields from craft. Rinse and repeat this process for each field and cleanup the fields afterwards and that should sort out your multilingual import for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just make sure to take database backups frequently in case there are any errors though.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2016-12-12T14:59:10.273" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18112" PostTypeId="1" CreationDate="2016-12-12T15:52:49.027" Score="1" ViewCount="652" Body="&lt;p&gt;Are there any tax plugins available for some of the major sales tax API services (i.e. TaxJar, Taxamo, Avalara)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any shipping plugins available for some of the major shipping services (i.e. UPS, FedEx)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for my questions is that it would seem that the Craft Commerce plugin is extremely limited in those 2 areas.&lt;/p&gt;&#xA;" OwnerUserId="5997" LastActivityDate="2018-02-21T14:10:05.360" Title="Tax and Shipping API plugins" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18114" PostTypeId="1" AcceptedAnswerId="18115" CreationDate="2016-12-12T22:39:51.397" Score="0" ViewCount="233" Body="&lt;p&gt;If you have a plugin installed with its own tables and you want to add some extra database fields to the table, what is the process for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will create database tables using records on installation of the plugin, but what about after this? If I update the record definitions is there a way to trigger Craft to update the table or do I have to add the fields through MySQL?&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-12-12T22:41:43.240" Title="Update record definition after plugin is already installed" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;records&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18115" PostTypeId="2" ParentId="18114" CreationDate="2016-12-12T22:41:43.240" Score="2" Body="&lt;p&gt;If you want to change database schema after a plugin has already been installed, the way to do it is through &lt;a href=&quot;https://craftcms.com/docs/plugins/migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;migrations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see many examples of this in Craft in the &lt;code&gt;craft/app/migrations&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-12T22:41:43.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18116" PostTypeId="1" AcceptedAnswerId="18117" CreationDate="2016-12-13T00:42:29.090" Score="2" ViewCount="104" Body="&lt;p&gt;I've been designing and building a property developers website for the last 9 months (client delayed building it due to economic reasons), but now we are at the point where it's ready to be built into Craft, as I've finished the HTML/CSS/JS build after the 3 months of hard work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But due to the client budget I'm attempting to do the Craft build myself (I'm a designer with good CSS etc, but this is my first Craft build), so I'd appreciate a bit of advice on the best approach, as I've tried a number of different approaches so far, but am really struggling, as the development section of the site has multiple levels, and I need to set it up in a way that is going to be idiot proof for the client to be able to add new developments, and all the associated properties with each development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Development section structure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;**All Developments** (listing page per development)&#xA;&#xA;--**County** (for example &quot;Berkshire&quot;) - A similar listing page for properties only in Berkshire.&#xA;&#xA;----**Development Overview** - Information about the whole development)&#xA;&#xA;------**Available Properties** - A listing page for all of the individual plots in the development&#xA;&#xA;--------**Plot Page** - individual plot information including floorplans, specifications, images etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are all linked via breadcrumbs as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are around 15 developments currently, and some have 50+ plots in them. So there could be hundreds of plot pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the client is going to need to be able to create the Development Overview page in the CMS each time, and all the individual Plot pages per development, and also add the Available Properties page once there are plots, and each development will need to be related to the county they are in, and pulled into the listing page at the top level too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So would appreciate some experienced advice on the simplest approach that is going to be easy for the client to manage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also any other recommended resources for learning as I've already been through all of the mijingo video courses, and still struggling as this developers site is much more complicated than any of the tutorial sites, which only have basic relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One final thought I had, is would this be easier to do with Craft commerce? As the development section is very much like a ecommerce site in structure, but without the need for the payment stuff. Or can standard Craft handle it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2016-12-13T01:22:42.283" LastActivityDate="2016-12-13T04:56:06.973" Title="How to setup the structure in Craft for a Property Development site I'm building" Tags="&lt;categories&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18117" PostTypeId="2" ParentId="18116" CreationDate="2016-12-13T03:53:19.233" Score="3" Body="&lt;p&gt;I think I follow where you are going. It sounds like you have a few levels so you will indeed be working with a structure (instead of a channel or single).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what &quot;All Developments&quot; means - is that &quot;show me every single entry in this section&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are most likely a handful of ways you could go about doing this, here is one way that I would try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.) I would make your &quot;County&quot; a category. Call the group &quot;Counties&quot; and then create each county you need (ex: Berkshire). By creating your counties as categories, you can assign (relate) anything back to it. This will allow you to do things like: &lt;code&gt;Get all properties from Berkshire Country&lt;/code&gt;. It will be up to you to decide where this relationship lives though. I would put it on the actual property though, that way you have access to it at any level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.) Create a few &lt;a href=&quot;https://craftcms.com/features/entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry types&lt;/a&gt;:&#xA;        1) Development&#xA;        2) Property&#xA;        3) Plot&#xA;     By doing this, we can have a clean authoring experience by having each entry type have it's own fields. Meaning your &lt;code&gt;Properties&lt;/code&gt; entry won't have inputs for the images like your &lt;code&gt;Plots&lt;/code&gt; entry would. It just keeps things a lot cleaner for the author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.) Build out the structure for each Development. This is what that might look like. Let's say you have a section (of type structure) called &quot;Developments&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; - Entry: (Type Development)&#xA;     |- Entry: (Type Property) &amp;lt;-- This is where I would assign County&#xA;         |- Entry: (Type Plot)&#xA;&#xA; - Entry: (Type Development)&#xA;     |- Entry: (Type Property)&#xA;         |- Entry: (Type Plot)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By setting things up this way, now we can &lt;em&gt;easily&lt;/em&gt; do things like, &quot;Get all plots from foo property&quot; or, &quot;get all properties from bar development&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, another completely different way would be create categories for each County, Development and Property. You would then have a single section called &quot;Plots&quot; (of type channel). Each entry would then have category inputs to relate the plot back to the correct County and property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this approach is that it &lt;em&gt;isn't&lt;/em&gt; quite as straight forward to create higher-level things like Properties. I've found that having people go back and forth from categories and entires can be confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps get you going!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2016-12-13T04:56:06.973" LastActivityDate="2016-12-13T04:56:06.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18118" PostTypeId="2" ParentId="17659" CreationDate="2016-12-13T04:02:17.803" Score="1" Body="&lt;p&gt;The issue has to do with another third party plugin (&lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Postmaster&lt;/a&gt;) installed and also using &lt;a href=&quot;http://carbon.nesbot.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Carbon&lt;/a&gt;. The Postmaster plugin appears to be using an older copy of Carbon and Calendar is loading Postmaster's Carbon library, causing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually updating the &lt;strong&gt;vendors&lt;/strong&gt; directory to use latest versions may resolve this issue. We will try to reach out to the developer of Postmaster and see if they can resolve this on their end. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Customers effected with this issue can contact &lt;a href=&quot;https://solspace.com/craft/create-ticket/calendar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace support&lt;/a&gt; for an updated &lt;strong&gt;vendors&lt;/strong&gt; folder for Postmaster that may resolve the issue.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-12-13T04:02:17.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18119" PostTypeId="2" ParentId="18112" CreationDate="2016-12-13T07:36:57.650" Score="1" Body="&lt;p&gt;Craft Commerce is a young product and as such, there are indeed limited options for third party plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good news, though - writing a shipping plugin at least is not difficult (well, the Commerce part isn't - the API of the shipping service is of course, up to that shipping service!). See &lt;a href=&quot;https://craftcommerce.com/docs/shipping-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/shipping-methods&lt;/a&gt; to get started.  I've personally written a live rates plugin (for TNT) and several unique table based ones, and I've found the process easy and clean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is already a ShipStation plugin - &lt;a href=&quot;https://onedesigncompany.com/craft-cms/plugins/oneshipstation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://onedesigncompany.com/craft-cms/plugins/oneshipstation&lt;/a&gt; - and ShipStation handles UPS, FedEx etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On tax, I don't know a lot about that and so far I think Commerce's tax support is a little limited (e.g. no tax on shipping support).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, Craft/Commerce support is excellent and if you do need to integrate a new service, you'll fine Luke Holder and the rest of the Craft team are very helpful with that sort of thing - and of course they're keen to see the Craft/Commerce eco-system grow.  support@craftcommerce.com is the address you need :)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-13T07:36:57.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18120" PostTypeId="2" ParentId="18105" CreationDate="2016-12-13T07:38:26.860" Score="1" Body="&lt;p&gt;This sounds like a bug and I would raise it with support@craftcommerce.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stock part of Craft Commerce is still pretty basic at this point.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-13T07:38:26.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18123" PostTypeId="1" AcceptedAnswerId="18127" CreationDate="2016-12-13T11:23:59.900" Score="2" ViewCount="969" Body="&lt;p&gt;I'd like to output a special link in level 1 upon current top-level entry doesn't have any entries at level 3. If It have move that special link one level above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To picture it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Page 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subpage 1&lt;/li&gt;&#xA;&lt;li&gt;Subpage 2&lt;/li&gt;&#xA;&lt;li&gt;Special link A&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Page 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subpage 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subpage 1.1&lt;/li&gt;&#xA;&lt;li&gt;Special link A&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently I didn't have any difficulties with level 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lvl = entry.level %} &#xA;{% if lvl == 2 and entry.children|length %}&#xA;    A link&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To set that special link at level 1 is.&#xA;Most logical way to me is to use EntryModel's method &lt;code&gt;getDescendants( distance )&lt;/code&gt; as I don't have to set any variable. If I understand it correctly It should get descendant entries at given level? of a current &lt;code&gt;entry&lt;/code&gt;'s variable.  When I set to &lt;code&gt;(distance)&lt;/code&gt; other integer than &lt;code&gt;1&lt;/code&gt; let's say &lt;code&gt;2&lt;/code&gt; It prints out all entries from second level including level 2. So It's unclear to me what &lt;code&gt;distance&lt;/code&gt; does in this case. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if lvl == 1 and entry.getDescendants(2)|length %}&#xA;    A link&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Argument is true even if there are no descendant entries of second level. Because When looping in It prints all entries from second level up including second level as I mentioned before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or I can't use this method?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="57" LastEditDate="2016-12-13T18:49:08.610" LastActivityDate="2016-12-13T18:49:08.610" Title="How do I check if a structure has any entries at level 3 when I'm at level 1?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18124" PostTypeId="1" CreationDate="2016-12-13T13:21:42.270" Score="0" ViewCount="69" Body="&lt;p&gt;Our website was created by someone who is no longer with the business. I can edit existing data, however am trying to access the original templates used when the site was originally built in order to change a few things. Where would I find these?&lt;/p&gt;&#xA;" OwnerUserId="5999" LastActivityDate="2016-12-14T06:55:41.903" Title="I've inherited the Craft website and the developer is long gone. How do I access the templates used to initally build the site?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18125" PostTypeId="2" ParentId="18124" CreationDate="2016-12-13T13:41:19.397" Score="5" Body="&lt;p&gt;I suppose you need access via FTP to the templates directory - which by default is &lt;code&gt;craft/templates&lt;/code&gt;. Once you have access to that, you'll have access to the site templates. Do you have FTP access?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no way in Craft to view your templates through the Control Panel interface.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2016-12-14T06:55:41.903" LastActivityDate="2016-12-14T06:55:41.903" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18126" PostTypeId="2" ParentId="12235" CreationDate="2016-12-13T13:50:09.650" Score="1" Body="&lt;p&gt;The URL you are probably looking for  in this specific case is in here:&#xA;&lt;a href=&quot;https://developers.facebook.com/docs/graph-api/reference/v2.8/page/feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developers.facebook.com/docs/graph-api/reference/v2.8/page/feed&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you want graph.facebook.com/pageid/feed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;If the url of your facebook page is:&#xA;facebook.com/mypage&#xA;&#xA;your graph request for this case is:&#xA;graph.facebook.com/mypage/feed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The graph API is great, but its very extensive.&lt;/p&gt;&#xA;" OwnerUserId="6000" LastEditorUserId="6000" LastEditDate="2016-12-13T14:22:38.937" LastActivityDate="2016-12-13T14:22:38.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18127" PostTypeId="2" ParentId="18123" CreationDate="2016-12-13T15:23:15.843" Score="3" Body="&lt;p&gt;To make it works I had to query in the section for descendant entries at level 3 of a current &lt;code&gt;entry&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.section('products') %}&#xA;&#xA;{% if lvl == 1 and products.descendantOf(entry).level(3).first()|length %}&#xA;    // If the above statment is true we don't want that special link at level 1&#xA;{% elseif lvl == 1 %}&#xA;    // A special link&#xA;{% endif %}&#xA;&#xA;&#xA;{% if lvl == 2 and entry.children|length %}&#xA;    // A special link&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I welcome a smarter solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt; Thanks to @carlcs comment a performance has been enhanced&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if lvl == 1 and products.descendantOf(entry).level(3).total() &amp;gt; 0 %}&#xA;    // If the above statment is true we don't want that special link at level 1&#xA;{% elseif lvl == 1 %}&#xA;    // A special link&#xA;{% endif %}&#xA;&#xA;&#xA;{% if lvl == 2 and entry.children.total() &amp;gt; 0 %}&#xA;    // A special link&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2016-12-13T16:03:45.860" LastActivityDate="2016-12-13T16:03:45.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18129" PostTypeId="1" CreationDate="2016-12-13T16:00:20.517" Score="1" ViewCount="163" Body="&lt;p&gt;I have a custom list of breadcrumbs that two of the levels reference different Category Groups. I'm able to get the correct breadcrumb to display for the page that I'm on using &lt;code&gt;category.title&lt;/code&gt;, but I need to display the correct category for the previous breadcrumb also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made some progress and have managed to get it to display the first category in the group I want by using &lt;code&gt;{% set county = craft.categories.group('counties').first() %}&lt;/code&gt; but I need it to display the category that I've attached to the page with a category field, and not just the first item in the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block breadcrumbs %}&#xA;    &amp;lt;div class=&quot;full-width breadcrumbs nav-breadcrumbs navbar-fixed-top&quot;&amp;gt;&#xA;        &amp;lt;div class='container'&amp;gt;&#xA;            &amp;lt;header class='scroll'&amp;gt;&#xA;                &amp;lt;span class='nav-item'&amp;gt;&amp;lt;a href=&quot;/&quot;&amp;gt;&amp;lt;i class=&quot;icon-home&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class='nav-item'&amp;gt;&amp;lt;a href=&quot;/developments&quot;&amp;gt;All Developments&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;                {% set county = craft.categories.group('counties').first() %}&#xA;                &amp;lt;span class='nav-item'&amp;gt;&amp;lt;a href=&quot;{{ county.url }}&quot;&amp;gt;{{ county.title }}&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class='nav-item active'&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2016-12-14T22:50:22.923" Title="Display different Categories groups in custom breadcrumbs" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18130" PostTypeId="1" CreationDate="2016-12-13T16:15:28.627" Score="2" ViewCount="639" Body="&lt;p&gt;Recently we've had someone/something trying to perform a XSS attack using a form which saves all data into sessionStorage and then sends it to a custom craft plugin to pair it with a user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution to stop these XSS vulnerabilities from craft docs is to &quot;enable all “Purify HTML?” Rich Text field settings&quot; but I've noticed this option only exists for &lt;strong&gt;Rich Text&lt;/strong&gt; fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, is it somehow possible to activate &quot;Purify HTML&quot; on plain text fields (and other types of input like select and checkboxes)? Or do I need to escape/encode these fields on the client side (and how)?&lt;/p&gt;&#xA;" OwnerUserId="5692" LastActivityDate="2017-04-13T00:54:32.280" Title="&quot;Purify HTML&quot; on plain text fields" Tags="&lt;richtext&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18131" PostTypeId="1" CreationDate="2016-12-13T17:10:26.977" Score="2" ViewCount="422" Body="&lt;p&gt;Let's say my seomatic &lt;code&gt;Site SEO Name&lt;/code&gt; = &lt;code&gt;My Site&lt;/code&gt; and my &lt;code&gt;Site SEO Title&lt;/code&gt; = &lt;code&gt;A Wonderful Website&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the default values for seomatic's &lt;code&gt;Site SEO Name Placement&lt;/code&gt; and &lt;code&gt;Site SEO Name Separator&lt;/code&gt;, this will output the following title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;title&amp;gt;A Wonderful Website | My Site&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes sense for the majority of pages on my site, where by setting a custom title for the page I'll get something like &lt;code&gt;About Us | My Site&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on the homepage, I actually want to swap the order of these, so that the title becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;title&amp;gt;My Site | A Wonderful Website&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a fairly common thing to do, but I can't seem to find a way to trick seomatic into allowing this without setting &lt;code&gt;Site SEO Name Placement&lt;/code&gt; to &lt;code&gt;None&lt;/code&gt; (which I don't want to do because the default value works well on all other pages).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even trying to manually set the entire title won't work, because it will insist on adding the &lt;code&gt;Site SEO Name&lt;/code&gt; to the end:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set seomaticMeta = seomaticMeta | merge({ seoTitle: 'My Site | A Wonderful Website' }) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way around this?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2016-12-15T16:41:30.183" Title="Reverse the seomatic title and site name for a specific template" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18132" PostTypeId="2" ParentId="18130" CreationDate="2016-12-13T19:01:10.450" Score="1" Body="&lt;p&gt;The reason there is a &quot;Purify HTML?&quot; setting only for Rich Text fields is that Twig will automatically escape the output of every other field by default, mitigating XSS attack vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rich Text fields, by nature, are designed to store HTML, therefore their output isn't escaped and you have to rely on things like &quot;Purify HTML?&quot; (which uses &lt;a href=&quot;http://htmlpurifier.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://htmlpurifier.org/&lt;/a&gt;) to try and remove anything malicious looking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're plugin needs to output data for a Plain Text field in a way that doesn't get escaped (for whatever reason), you can always &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/fieldtypes/RichTextFieldType.php#L205-L214&quot; rel=&quot;nofollow noreferrer&quot;&gt;run HTMLPurifier on it&lt;/a&gt; manually.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-01-12T22:33:04.147" LastActivityDate="2017-01-12T22:33:04.147" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18133" PostTypeId="2" ParentId="17980" CreationDate="2016-12-13T20:13:12.653" Score="1" Body="&lt;p&gt;The only way I found to accomplish this was with a custom controller that essentially overrode &lt;code&gt;actionVerifyEmail&lt;/code&gt; and &lt;code&gt;_processTokenRequest&lt;/code&gt; from &lt;code&gt;UsersController&lt;/code&gt;. (With a hook into &lt;code&gt;email.onBeforeSendEmail&lt;/code&gt; to rewrite the verification &lt;code&gt;{{link}}&lt;/code&gt; to use the custom controller action). It's fragile, but it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a feature request to smooth out this experience:&#xA;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1228&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1228&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5911" LastEditorUserId="57" LastEditDate="2018-03-28T23:37:28.467" LastActivityDate="2018-03-28T23:37:28.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18134" PostTypeId="1" CreationDate="2016-12-13T21:19:32.573" Score="2" ViewCount="310" Body="&lt;p&gt;Our client would like to accept gift certificates as a form of payment. I've looked into the 2 stripe plugins they offer for gift certs, but neither of them will work for my client -- one is a separate off-site gateway, and the other is $90 a month, which is off the table completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to assign credit to a user's account and allow them to take that amount off before the purchase? So we would sell the gift certificate and enable it on the user account, then they could purchase things online?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other good ideas on how to handle gift certs?&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="57" LastEditDate="2016-12-15T00:42:10.397" LastActivityDate="2018-03-28T23:29:03.960" Title="Is there a way to credit a customer's account in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18136" PostTypeId="1" AcceptedAnswerId="18142" CreationDate="2016-12-13T21:48:24.050" Score="1" ViewCount="107" Body="&lt;p&gt;I have created a section called &quot;Services&quot; and an entry within called &quot;seo&quot;.  When I click to view that entry in the admin area, it takes me to domain.com/services/seo, as expected, but that 404s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else required to use channels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have .htaccess in place working properly and the shipped sections ('News', and the home page) all load fine.&lt;/p&gt;&#xA;" OwnerUserId="6004" LastEditorUserId="22" LastEditDate="2017-05-09T20:40:37.290" LastActivityDate="2017-05-09T20:40:37.290" Title="404s on custom sections and entries" Tags="&lt;url&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18141" PostTypeId="1" CreationDate="2016-12-14T07:26:24.987" Score="2" ViewCount="448" Body="&lt;p&gt;I have built a plugin that, &lt;strong&gt;TL;DR&lt;/strong&gt; subtracts credits. Everything is working great - until I actually need to change the price. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just flat-out don't understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I am looping through to check a user's credits using the &lt;code&gt;commerce_discounts.onBeforeMatchLineItem&lt;/code&gt; event. You can see where I was using the discount &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt; method to stop the discount from being applied. But, I need the ability to split the line items so-to-speak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: qty of 5 of the same product; 3 are free, 2 are full price.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// $entry is the entry that keeps track how many credits are left.&#xA;if ((int)$entry-&amp;gt;events &amp;gt; 0) {&#xA;    $i = (int)$entry-&amp;gt;events;&#xA;&#xA;    while ($i &amp;gt; 0) {&#xA;        error_log('doing stuff...');&#xA;        $entry-&amp;gt;setContentFromPost([&#xA;            'events' =&amp;gt; ((int)$entry-&amp;gt;events &amp;gt; 0) ? ((int)$entry-&amp;gt;events - (int)$i) : 0&#xA;            ]);&#xA;&#xA;        craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        $i--;&#xA;&#xA;        if ($i == 0) {&#xA;            error_log('OUT OF CREDITS');&#xA;            // $event-&amp;gt;performAction = false;&#xA;        }&#xA;    error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'CREDITS LEFT: ' . (int)$i : '');&#xA;    }&#xA;} else {&#xA;    error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'Uh-oh user is out of event credits..' : '');&#xA;   $event-&amp;gt;performAction = false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an adjustor set up...it's basically &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14106/3-for-2-etc-with-craft-commerce&quot;&gt;from this thread&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is where to actually put the adjustor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Adjustor.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myAdjuster-&amp;gt;amount = -5.0;  // How do I make the amount be 100%?&#xA;$myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;    // Is this is where i need to loop through the line items and do the credit deductions?&#xA;&#xA;$myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected' =&amp;gt; null];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do I do all of the looping and such within the adjustor? Instead of a dollar amount, I would like 100% off until my credits are zero. Then the user pays full price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My apologies for such a large question. Any guidance is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-04-05T11:19:48.260" Title="Commerce: How do I use an adjustor for line items?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18142" PostTypeId="2" ParentId="18136" CreationDate="2016-12-14T07:27:37.967" Score="3" Body="&lt;p&gt;You'll need to create a template, and add the path to that template to the &lt;strong&gt;Entry Template&lt;/strong&gt; field in your &quot;Services&quot; section's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you create a template called &lt;code&gt;/craft/templates/services/_entry.html&lt;/code&gt;, you'd use the path &lt;code&gt;services/_entry&lt;/code&gt; for your section's &lt;strong&gt;Entry Template&lt;/strong&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this setup, you could also add an &lt;code&gt;index.html&lt;/code&gt; file to the &lt;code&gt;/craft/templates/services&lt;/code&gt; folder. That template would render when the user visits the URL &lt;code&gt;domain.com/services&lt;/code&gt;, enabling you to create a listing/index view for your &quot;Services&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, I'd suggest looking at &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;the excellent official docs on templating&lt;/a&gt; in Craft.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-14T07:27:37.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18143" PostTypeId="2" ParentId="18134" CreationDate="2016-12-14T07:41:02.420" Score="2" Body="&lt;p&gt;Commerce does not, currently (= Dec 16) have any concept of a customer balance or a gift certificate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do it as a plugin, I would think.  Basically you'd keep a list of emails and credits in a record (i.e. table) and then write a controller that you/the customer could call to apply those credits - the actual application of which you'd probably implement as a Commerce adjuster perhaps (&lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/adjusters&lt;/a&gt;).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &lt;em&gt;would&lt;/em&gt; be a relatively involved plugin at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case we chickened out on this, hoping it will come later to Commerce core - we just ask that the gift certificate customers call through their order.  Definitely not ideal but for the relatively few GC customers it didn't seem worth the development effort.   Gift certificates are an often requested feature for Commerce, though, so you'd expect it to happen at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vote here for the feature - &lt;a href=&quot;https://github.com/craftcms/commerce/issues/253&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/253&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2018-03-28T23:29:03.960" LastActivityDate="2018-03-28T23:29:03.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18144" PostTypeId="1" CreationDate="2016-12-14T11:48:52.820" Score="2" ViewCount="216" Body="&lt;p&gt;I'm trying to do a simple search of all posts, and using this: &lt;a href=&quot;https://craftcms.com/docs/templating/search-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/search-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works but in that example it assumes you display search results on another page. I am trying to build this as a single-pager (it's a really basic site). I've tried reloading the page (i.e. setting url to the current page) and this works . . . however I also want to show/hide elements on search, and this is getting lost with the page reload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a feeling this is going to be something basic, but am stumped . . . have been playing around with it, trying includes and stuff, and getting nowhere. My apologies if it's a noob question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;revealedOnSearch&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;Search Results&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% set query = craft.request.getParam('q') %}&#xA;    {% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;    {% if entries|length %}&#xA;        &amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% for entry in entries %}&#xA;              &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Your search for &quot;{{ query }}&quot; didn’t return any results.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that is the code. I only want the search results appearing when the user searches (obvs) but want them on the main page (i.e the same page as the search form)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the show/hide code if it helps at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var searchForm = document.getElementById(&quot;searchForm&quot;);&#xA;var revealedOnSearch = document.getElementById(&quot;revealedOnSearch&quot;);&#xA;&#xA;searchForm.addEventListener(&quot;submit&quot;, function(){&#xA;    revealedOnSearch.style = &quot;display:block;&quot;;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5727" LastEditorUserId="125" LastEditDate="2016-12-14T12:13:04.897" LastActivityDate="2016-12-14T12:13:04.897" Title="Search without leaving or refreshing page" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18145" PostTypeId="2" ParentId="18144" CreationDate="2016-12-14T12:04:49.417" Score="2" Body="&lt;p&gt;Here is some example code that should probably help you get things set up. The relevant part is the line &lt;code&gt;{% if query|length and query.search %}&lt;/code&gt;, where you’d test if there’s a query string at all and additionally if the search param is set (you can leave out that part if you want).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery() %}&#xA;&#xA;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;    {% set value = query.search is defined ? query.search : '' %}&#xA;    &amp;lt;input type=&quot;search&quot; id=&quot;search&quot; name=&quot;search&quot; value=&quot;{{ value }}&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;search&quot;&amp;gt;Search&amp;lt;/label&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% if query|length and query.search %}&#xA;    {% set entries = craft.entries.search(query.search) %}&#xA;&#xA;    &amp;lt;aside&amp;gt;&#xA;        &amp;lt;h3&amp;gt;Search Results&amp;lt;/h3&amp;gt;&#xA;&#xA;        {% if entries|length %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in entries %}&#xA;                    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;p&amp;gt;No results.&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/aside&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-14T12:04:49.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18146" PostTypeId="1" AcceptedAnswerId="18147" CreationDate="2016-12-14T13:11:04.550" Score="1" ViewCount="83" Body="&lt;p&gt;Instead of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com/en&lt;/li&gt;&#xA;&lt;li&gt;example.com/de&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;example.com&lt;/li&gt;&#xA;&lt;li&gt;example.de&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can I do this with craft? &lt;a href=&quot;https://craftcms.stackexchange.com/questions/916/localization-how-do-we-manage-multilingual-multi-environment-on-multiple-doma?rq=1&quot;&gt;I see this has been discussed&lt;/a&gt;, but a complete solution hasn't been posted.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-12-14T13:23:24.103" Title="Is it possible to have multiple locales that use different domains instead of subfolders?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18147" PostTypeId="2" ParentId="18146" CreationDate="2016-12-14T13:23:24.103" Score="3" Body="&lt;p&gt;It is discussed &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;here in the craft docs&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an example with different toplevel domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;English and German each get their own domain&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public_html/            --&amp;gt; example.com/&#xA;    .htaccess&#xA;    index.php&#xA;public_de/              --&amp;gt; example.de/&#xA;    .htaccess&#xA;    index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-14T13:23:24.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18148" PostTypeId="1" CreationDate="2016-12-14T15:28:24.197" Score="1" ViewCount="1421" Body="&lt;p&gt;I have installed imagick on my amazon lightsail lamp instance like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;apt-get install imagemagick&#xA;apt-get install php5-imagick&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately craft tells me that the &lt;code&gt;ImageMagick extension&lt;/code&gt; has &lt;code&gt;Passed with warnings&lt;/code&gt;. See this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/32mGt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/32mGt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? How do I make sure imagick is working correctly?&lt;/p&gt;&#xA;" OwnerUserId="6009" LastActivityDate="2016-12-15T00:45:01.407" Title="Imagick installation passed with warnings" Tags="&lt;config&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18149" PostTypeId="1" CreationDate="2016-12-14T15:37:30.710" Score="1" ViewCount="87" Body="&lt;p&gt;Is it possible to have a dev version path for the Element API plugin so we can keep live and dev API separated?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2016-12-15T03:21:42.830" LastActivityDate="2016-12-15T03:21:42.830" Title="Separate path for Element API plugin" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18150" PostTypeId="2" ParentId="18149" CreationDate="2016-12-14T15:53:48.040" Score="1" Body="&lt;p&gt;Doh so the answer is PHP constants:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_CONFIG_PATH', '../../craftdev/config/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;useful to know.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-12-14T15:53:48.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18151" PostTypeId="1" AcceptedAnswerId="18158" CreationDate="2016-12-14T16:11:20.357" Score="0" ViewCount="134" Body="&lt;p&gt;My cache won't expire. This is effectively my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $template = (isset($params['template']) ? $params['template'].'?'.$config['pageParam'].'='.$pageParam : null);&#xA;&#xA;    if(craft()-&amp;gt;cache-&amp;gt;get($template))&#xA;    {&#xA;        echo craft()-&amp;gt;cache-&amp;gt;get($template);&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;&#xA;    if(craft()-&amp;gt;config-&amp;gt;get('enableTemplateCaching'))&#xA;    {&#xA;        craft()-&amp;gt;cache-&amp;gt;set($template, $JsonValue, 'P1D');&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The cache saves just fine but when I forward the clock on my server a few days ahead and refresh the page it's still using the cached data. I've also tried actually waiting a few days in case it was using another clock but that didn't help either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing? I figure Craft or the Yii Framework will take care of expiring the cache after the one day period set (P1D). I don't see any methods to check the date of the cache or anything where I could manually intervene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth I'm using &lt;a href=&quot;https://github.com/theolampert/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;theolampert's fork&lt;/a&gt; of the ElementAPI plugin which adds caching.&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2016-12-15T03:20:55.870" Title="Data cached in plugin controller via CacheService won't expire" Tags="&lt;plugin-development&gt;&lt;cache&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18152" PostTypeId="2" ParentId="18149" CreationDate="2016-12-14T16:23:50.137" Score="2" Body="&lt;p&gt;Craft config files usually allow to return environment-specific arrays. So you could just configure different endpoints like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    '*' =&amp;gt; [],&#xA;    '.com' =&amp;gt; [&#xA;        'endpoints' =&amp;gt; [&#xA;            'api/example&amp;lt;ext:(.json)?&amp;gt;' =&amp;gt; function() {&#xA;                // example API config for live environment&#xA;            },&#xA;        ],&#xA;    ],&#xA;    '.dev' =&amp;gt; [&#xA;        'endpoints' =&amp;gt; [&#xA;            'api/example&amp;lt;ext:(.json)?&amp;gt;' =&amp;gt; function() {&#xA;                // example API config for dev environment&#xA;            },&#xA;        ],&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-14T16:23:50.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18153" PostTypeId="1" CreationDate="2016-12-14T20:57:34.337" Score="1" ViewCount="314" Body="&lt;p&gt;When I type mydomain.dev/blahwrongurl - for some reason .htaccess doesn't redirect to the 404.html file, but just write the blahwrong url out on the page and nothing else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the feeling that I messed up routes somewhere, but I deactivated all of my plugins but nothing changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastActivityDate="2017-08-14T01:14:09.453" Title="404 issues and redirect/.htaccess" Tags="&lt;404&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18154" PostTypeId="1" CreationDate="2016-12-14T21:44:52.627" Score="1" ViewCount="27" Body="&lt;p&gt;When checking if a matrix block property is defined, I'm getting an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;contentSource&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The line that is throwing this error is specifically checking if that property is defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.contentSource is defined %}&#xA;    {# Stuff and things #}&#xA;{% endif %}&#xA;&#xA;-- Or --&#xA;&#xA;{% set theThing = block.contentSource ?? &quot;fallback&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I expecting the &quot;is defined&quot; check to be smarter than it actually is? I can't see an example of this in the matrix field or craft twig/templating docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2016-12-14T21:44:52.627" Title="Twig &quot;Is defined&quot; throwing error on matrix row EntryModel property" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;defined&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2016-12-15T18:43:08.207" ContentLicense="CC BY-SA 3.0" />
  <row Id="18155" PostTypeId="2" ParentId="18129" CreationDate="2016-12-14T22:50:22.923" Score="2" Body="&lt;p&gt;I've managed to solve it. &lt;code&gt;&amp;lt;span class='nav-item'&amp;gt;&amp;lt;a href=&quot;{{ category.counties.first().url }}&quot;&amp;gt;{{ category.counties.first().title }}&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; did the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly I just needed to print the category field, although I'm not sure why it needs the &lt;code&gt;.first()&lt;/code&gt; after &lt;code&gt;category.counties&lt;/code&gt; to print it? But it works at least after days of struggling to find an answer.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2016-12-14T22:50:22.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18156" PostTypeId="1" CreationDate="2016-12-15T00:41:59.830" Score="0" ViewCount="69" Body="&lt;p&gt;I have a section (single) that uses a template that shows information from the entry and includes a form (uses entry form) that posts to a different section (event registration info). All is fine as long as the form data is valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the form is submitted such that it throws an error (required field not filled in), the user is redirected back to the original page, but only the form is displayed and there is apparently no entry ID passed when reloading the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas would be appreciated! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the template code for the form - note that the form handles a number of different event registrations, hence the variables for the redirect and the section Id for posting the form contents:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;eventReg&quot; method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;                        {{ getCsrfInput() }}&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;                        &amp;lt;input id=&quot;theRedirect&quot; type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ theRedirect }}&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ section }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="587" LastEditorUserId="587" LastEditDate="2016-12-15T04:30:05.960" LastActivityDate="2016-12-15T04:30:05.960" Title="Form Error Causes Page to Reload Without an Entry ID" Tags="&lt;form&gt;&lt;entry&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18157" PostTypeId="2" ParentId="18148" CreationDate="2016-12-15T00:45:01.407" Score="1" Body="&lt;p&gt;Click on the &quot;i&quot; graphic and it will probably tell you that GD is installed, but Imagick isn't and it is recommended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can verify that Imagick is installed and available to PHP/Craft by going to &lt;code&gt;yoursite.com/admin/utils/phpinfo&lt;/code&gt; and searching for &quot;imagick&quot;.  If it's not there, then it has not been installed properly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-15T00:45:01.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18158" PostTypeId="2" ParentId="18151" CreationDate="2016-12-15T03:20:55.870" Score="1" Body="&lt;p&gt;Looks like a bug in the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3rd &lt;code&gt;$expire&lt;/code&gt; parameter when calling set &lt;a href=&quot;https://craftcms.com/classreference/etc/cache/FileCache#set-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;states&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The number of seconds in which the cached value will expire. 0 means never expire.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But it's passing in the PHP time format notation.  I'd suggest contacting the author of the plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-15T03:20:55.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18159" PostTypeId="2" ParentId="18141" CreationDate="2016-12-15T06:10:48.033" Score="1" Body="&lt;p&gt;I'm finding the question hard to follow, but if I am understanding you, then yes I would do it all in the adjuster - rather than using a discount here... I don't see what using a Commerce discount here offers, as you can't really express your credits system in any way meaningful that relates to a Commerce discount I think.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this indeed looks like a job for an adjuster, which can act at either the lineItem or order level as per the linked example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of where you &lt;em&gt;put&lt;/em&gt; that adjuster, there are basically three steps.  The first two are in your main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;  Craft::import('plugins.yourPluginHandle.adjusters.YourAdjusterClassName');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then later in that file...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function commerce_registerOrderAdjusters(){&#xA;   return [&#xA;     new BusinessLogic_TaxRemover&#xA;   ];&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you have the actual code in your adjuster to do whatever you want to do, which (repeating that example), looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;&#xA;    namespace Craft;&#xA;    use Craft\Commerce_LineItemModel;&#xA;    use Craft\Commerce_OrderAdjustmentModel;&#xA;    use Craft\Commerce_OrderModel;&#xA;&#xA;    class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {&#xA;&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;    $myAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;    $order-&amp;gt;baseDiscount = $order-&amp;gt;baseDiscount - 5;&#xA;&#xA;    $myAdjuster-&amp;gt;type = &quot;Test&quot;;&#xA;    $myAdjuster-&amp;gt;name = &quot;Test Adjuster&quot;;&#xA;    $myAdjuster-&amp;gt;description = &quot;Takes $5 off the order&quot;;&#xA;    $myAdjuster-&amp;gt;amount = -5.0;&#xA;    $myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;    //if your Adjuster affects lineItems rather than the total, you record the ids here&#xA;    $myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt;null];&#xA;    $myAdjuster-&amp;gt;included = false;&#xA;&#xA;    return [$myAdjuster];&#xA;&#xA;   }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...the main thing to note in there is you need to record the ids of any lineitems you're adjusting by changing this - (&lt;code&gt;$myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt;null];&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-04-05T11:19:48.260" LastActivityDate="2017-04-05T11:19:48.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18160" PostTypeId="1" CreationDate="2016-12-15T11:14:42.330" Score="2" ViewCount="481" Body="&lt;p&gt;When submitting a form with required fields and getting an error, the page jumps to the top, where it should jump to the top of the form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the standard Craft contact form I can add &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;#errortag&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To define a div or name anchor where the page should go to. How can I do this in freeform (without having to go completely manual)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm using the standard tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;proefles&quot;, {&#xA;    instructionsBelowField: true,&#xA;}).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="57" LastEditDate="2016-12-15T23:16:44.723" LastActivityDate="2017-01-24T18:26:30.450" Title="Error reporting Freeform submission jumps to top of page" Tags="&lt;error-handling&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18161" PostTypeId="1" CreationDate="2016-12-15T11:29:46.810" Score="1" ViewCount="654" Body="&lt;p&gt;Is there a way to duplicate Entry Types into a new section?  I have a section with many entry types with their fields and handles all named nicely...  I need to create a Section using exactly the same Entry Type setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2016-12-15T12:48:48.353" Title="Duplicate Entry Types into a new section" Tags="&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18162" PostTypeId="2" ParentId="18088" CreationDate="2016-12-15T12:01:02.033" Score="2" Body="&lt;p&gt;I have found the solution within the answered question: &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9330/omitscriptnameinurls-is-not-working?rq=1&quot;&gt;omitScriptNameInUrls is not working&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'sudo a2enmod rewrite' was needed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks all.&lt;/p&gt;&#xA;" OwnerUserId="5989" LastActivityDate="2016-12-15T12:01:02.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18163" PostTypeId="1" AcceptedAnswerId="18164" CreationDate="2016-12-15T12:07:11.167" Score="0" ViewCount="103" Body="&lt;p&gt;I am working on a user registration page with AJAX.&#xA;I noticed that users are able to create accounts which have the same passwords. How do I disable this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If users want to create an account with the same username I do get an error message, why does that not happen for passwords?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2016-12-15T12:26:11.277" Title="Don't allow multiple users with same the password" Tags="&lt;users&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18164" PostTypeId="2" ParentId="18163" CreationDate="2016-12-15T12:26:11.277" Score="2" Body="&lt;p&gt;This is not a common practice out of the box, and not even desirable as you may also imply that other users have the same password creating the possibility for this new user to just try different emails with that password. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do is run via a plugin the user password against a list of weak passwords, and return a message if the password entered is easy to break. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If 2 or more users have the same password and their password is good, there's no reason for letting one of them know about the existence of the others. The same thought does not apply to emails or usernames though, since they are the unique ids within the system.&lt;/p&gt;&#xA;" OwnerUserId="5707" LastActivityDate="2016-12-15T12:26:11.277" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18165" PostTypeId="2" ParentId="18161" CreationDate="2016-12-15T12:48:48.353" Score="3" Body="&lt;p&gt;You need to use a plugin to do this. I've used &lt;a href=&quot;https://github.com/Pennebaker/craftcms-thearchitect&quot; rel=&quot;nofollow noreferrer&quot;&gt;the architect&lt;/a&gt; for doing exactly this in the past. Just export the section and entry types you want to duplicate, rename the section in the json file, delete everything except for the section and entry type definitions, and import.  &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2016-12-15T12:48:48.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18166" PostTypeId="1" AcceptedAnswerId="18169" CreationDate="2016-12-15T14:46:36.617" Score="1" ViewCount="278" Body="&lt;p&gt;I would like to have a custom field on the general settings page where I can enter the meta description for the website. Can this be achieved somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way I could think of is to add such a field to a section, the homepage for example, but this solution wouldn't be elegant.&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2016-12-15T17:26:41.097" Title="Custom Field on Settings page" Tags="&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18167" PostTypeId="1" CreationDate="2016-12-15T14:46:46.787" Score="2" ViewCount="2400" Body="&lt;p&gt;So, I'm kinda new to Craft so there might be a easy trick to do this but I can't seem to get it working (even with some heavy googling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the homepage I've got three entries (from the Projects page) loaded and I'd like to load +3 more entries everytime a 'load more' button is clicked. I've already figured out the best way to do this is using the &lt;code&gt;{% paginate %}&lt;/code&gt; function limited to 3 entries but thats where I'm kinda stuck right now..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to change the limit on click or something better?&lt;/p&gt;&#xA;" OwnerUserId="5155" LastActivityDate="2019-04-17T10:00:44.827" Title="Show more entries on click" Tags="&lt;entries&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18168" PostTypeId="2" ParentId="18131" CreationDate="2016-12-15T16:41:30.183" Score="5" Body="&lt;p&gt;The following works (but is undocumented):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set seomaticSiteMeta = seomaticSiteMeta | merge({'siteSeoTitlePlacement': 'before'}) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2016-12-15T16:41:30.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18169" PostTypeId="2" ParentId="18166" CreationDate="2016-12-15T16:43:22.930" Score="3" Body="&lt;p&gt;You can’t change or add fields to the General Settings page, but for site wide available content Craft has this concept of Globals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the documentation on it:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/globals&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s also very easy to manage user permissions for Globals, so you can allow certain user groups (besides admins) to change the meta data, somthing that (currently) isn’t possible for everything in Settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2016-12-15T17:26:41.097" LastActivityDate="2016-12-15T17:26:41.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18170" PostTypeId="2" ParentId="18167" CreationDate="2016-12-15T21:03:45.783" Score="2" Body="&lt;p&gt;You will have to accomplish this without pagination. This is a non-javascript way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set page = craft.request.getParam('page') ? craft.request.getParam('page')|number_format : 1 %}&#xA;{% set batch = 3 %}&#xA;{% set limit = page * batch %}&#xA;{% set newPage = page + 1 %}&#xA;&#xA;{% set items = craft.entries.section('projects').limit(limit) %}&#xA;&#xA;{% for item in items %}&#xA;    &amp;lt;h2&amp;gt;{{ item.title }}&amp;lt;/h2&amp;gt;&#xA;    {# other markup for each item #}&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;a href=&quot;?page={{ newPage }}&quot;&amp;gt;More&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just increases the limit by the page number and the factor of &lt;em&gt;BATCH&lt;/em&gt; while providing the next page number for the button url.&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-01-03T03:59:46.117" LastActivityDate="2017-01-03T03:59:46.117" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18171" PostTypeId="2" ParentId="2699" CreationDate="2016-12-15T22:26:56.677" Score="2" Body="&lt;p&gt;Take a look at &lt;a href=&quot;https://github.com/rsanchez/craft-cli&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CLI&lt;/a&gt;. It's a command line interface for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It let's you run commands like &lt;code&gt;craft clear:cache&lt;/code&gt; and &lt;code&gt;craft update:assetsindexes&lt;/code&gt; from the command line.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2016-12-15T22:26:56.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18172" PostTypeId="1" AcceptedAnswerId="18176" CreationDate="2016-12-16T10:35:37.393" Score="0" ViewCount="71" Body="&lt;p&gt;I use the following cache system, specified in the header of all pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set expiry = now|date_modify('+1 day') %}&#xA;{% header &quot;Cache-Control: max-age=&quot; ~ expiry.timestamp %}&#xA;{% header &quot;Pragma: cache&quot; %}&#xA;{% header &quot;Expires: &quot; ~ expiry|date('D, d M Y H:i:s', 'GMT') ~ &quot; GMT&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not coexist properly with the variable &lt;code&gt;{{ cart.lineItems|length }}&lt;/code&gt; which displays on each page the number of products currently in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I update the basket and go back to a previously visited pages, the cart is not up to updated and retains the value displayed during the previous visit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more specify: I do not use the &lt;code&gt;{% cache %}&lt;/code&gt; tags on the template part which displays the shopping cart.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2016-12-17T00:13:19.273" Title="How to update cart.lineItems while specifying HTTP cache headers?" Tags="&lt;plugin-craftcommerce&gt;&lt;cache&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18173" PostTypeId="1" CreationDate="2016-12-16T11:54:23.057" Score="0" ViewCount="661" Body="&lt;p&gt;I am using elementAPI to get data from a directory.&#xA;The items listed in the directory have two categories assigned:&#xA;Category level 1 country&#xA;Category level 2 region&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is how I am getting the data in the elementAPI plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v2/country/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;slug = $slug;&#xA;$category = $criteria-&amp;gt;first();&#xA;return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; [&#xA;        'section' =&amp;gt; 'directory',&#xA;        'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;        'limit' =&amp;gt; 1,&#xA;    ],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;        return [&#xA;            'country' =&amp;gt; (string)$entry-&amp;gt;country[0],&#xA;            'port' =&amp;gt; (string)$entry-&amp;gt;country[1],&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'mapinfo' =&amp;gt; $entry-&amp;gt;mapaddress,&#xA;            'url' =&amp;gt; $entry-&amp;gt;url&#xA;        ];&#xA;    },&#xA;];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The addition of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'country' =&amp;gt; (string)$entry-&amp;gt;country[0],&#xA;'port' =&amp;gt; (string)$entry-&amp;gt;country[1],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;adds 1.5 seconds to the request, compared to not putting them in which comes in at .656ms. It seems the category data is already requested outside of the transformer but i cant see how to get the category array into the transformer. I also can't see why the specifying the categories  in the transformer is so 'expensive'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on speeding up would be very welcome.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2016-12-17T00:28:19.647" Title="Getting categories in elementAPI performance issues and help required" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18174" PostTypeId="1" CreationDate="2016-12-16T15:48:47.217" Score="1" ViewCount="591" Body="&lt;p&gt;in my frontend entry form I have a &quot;save as draft&quot; submit button.&#xA;The current action for this form is the following, which saves the entry submitted through the form as a draft (status: disabled):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entryRevisions/saveDraft&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next to the &quot;save as draft&quot; button I would like to have a &quot;publish&quot; button. If the user clicks on it the entry should be submitted as &quot;status: live&quot;. If the user clicks on &quot;save as draft&quot; it should be submitted as &quot;status: disabled&quot;. Any idea how to do this?&lt;/p&gt;&#xA;" OwnerUserId="5991" LastActivityDate="2018-02-21T23:43:58.117" Title="frontend form action: save as draft or publish" Tags="&lt;templating&gt;&lt;form&gt;&lt;entry&gt;&lt;frontend&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18175" PostTypeId="2" ParentId="18174" CreationDate="2016-12-16T19:44:12.067" Score="1" Body="&lt;p&gt;I believe you're looking for &lt;code&gt;entryRevisions/publishDraft&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entryRevisions/publishDraft&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see the specific inputs it is looking for here: &lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/controllers/EntryRevisionsController.php#L188&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/controllers/EntryRevisionsController.php#L188&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-02-21T23:43:58.117" LastActivityDate="2018-02-21T23:43:58.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18176" PostTypeId="2" ParentId="18172" CreationDate="2016-12-17T00:13:19.273" Score="0" Body="&lt;p&gt;I do not think you can achieve this with browser caching - there's no concept of cache 'escaping' with this type of caching.  Indeed, there's currently no concept of cache escaping with Craft's &lt;code&gt;{% cache %}&lt;/code&gt; tag either...which is a shame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;general&lt;/em&gt;, even, caching at the page level when using Commerce carts is tough/impossible - e.g. you'll also need fresh CSRF tokens for cart operations etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently (without plugins anyway) - the best thing is probably to use Craft cache tags for static page elements and simply avoid caching things like your cart count and add to cart forms etc.  And put your site on a nice fast server :)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-17T00:13:19.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18177" PostTypeId="2" ParentId="18173" CreationDate="2016-12-17T00:28:19.647" Score="1" Body="&lt;p&gt;I'm no expert on the elementAPI, and a better answer will most likely come, but the country and port fields are relations to different elements (i.e. categories)....so Craft by default uses lazy loading to load this data only when it is called on by default, as I understand it.  And that would probably be why the execution time jumps up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you really want to do, I think, is eager load this data as part of your initial query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For resource on eager  loading, see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...so the question is, can you eager load in the element API?  I am not sure, but I'd suggest adding the &lt;code&gt;with&lt;/code&gt; part to your criteria and trying it! I'm just guessing on the syntax here, but it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; [&#xA;        'section' =&amp;gt; 'directory',&#xA;        'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;        'limit' =&amp;gt; 1,&#xA;        'with' =&amp;gt; ['country','port'],&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...would be worth trying.  My gut feeling is this &lt;em&gt;will&lt;/em&gt; work and will distinctly lower your execution time over the lazy loading way, but I'd love to get a report back!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-17T00:28:19.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18178" PostTypeId="2" ParentId="17951" CreationDate="2016-12-17T00:47:22.343" Score="3" Body="&lt;p&gt;Since taxes apply currently only at the line item level, the tax is correctly applying to the item+shipping cost of the line item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shipping max cost is making a order level change to the baseShipping after all line items have been adjusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are looking into supporting order level taxes only, to avoid this, and will update this answer soon with a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: This has been fixed, see answer here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15785/craft-commerce-calculating-product-shipping-tax?rq=1&quot;&gt;Craft Commerce: Calculating (Product + Shipping) + Tax?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-07-11T04:44:56.190" LastActivityDate="2017-07-11T04:44:56.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18179" PostTypeId="1" AcceptedAnswerId="18181" CreationDate="2016-12-17T20:39:32.853" Score="1" ViewCount="29" Body="&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;code&gt;entry.dropdownOption.label&lt;/code&gt; = &quot;option with spaces&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entry.dropdown %}&#xA;    {{ entry.dropdownOption.label }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;renders as in my template: &quot;optionwithspaces&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I instead get it to render as &quot;option with spaces&quot;?&lt;/p&gt;&#xA;" OwnerUserId="5808" LastEditorUserId="57" LastEditDate="2016-12-18T00:32:01.343" LastActivityDate="2016-12-18T00:32:01.343" Title="How can I get spaces to render in my dropdown option label template call?" Tags="&lt;matrix&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18181" PostTypeId="2" ParentId="18179" CreationDate="2016-12-17T22:19:23.190" Score="1" Body="&lt;p&gt;It turns out this was happening because i'd set some values for my content and then changed the structure of the field. I just reset the values for my content and all was well.&lt;/p&gt;&#xA;" OwnerUserId="5808" LastActivityDate="2016-12-17T22:19:23.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18182" PostTypeId="1" AcceptedAnswerId="18184" CreationDate="2016-12-17T23:10:21.210" Score="2" ViewCount="1090" Body="&lt;p&gt;I need to make the address fields in craft commerce required, as well as the phone number, etc. I tried to add the 'required' tag to the input element, but it breaks the form so you can't submit it -- at least in chrome. The submit button just stops working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to make these fields required without a plugin? Seems that this should be a feature included (or something optionally set in the code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4554" LastActivityDate="2019-03-05T07:56:43.120" Title="Craft Commerce Required Address fields" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18183" PostTypeId="1" AcceptedAnswerId="18185" CreationDate="2016-12-18T00:05:56.527" Score="1" ViewCount="844" Body="&lt;p&gt;I have two sections:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Games &lt;/li&gt;&#xA;&lt;li&gt;Publishers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Games has a field called &quot;GamesPublisher&quot; that is a relation (field type &quot;Entries&quot;), the Source is &quot;Publishers&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template to show an entry from games, I want to display the default field &quot;title&quot; of a publisher that I assigned to the games entry in the admin CP.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Games&quot; %}&#xA;{% set entries = craft.entries.section('games').limit(10).order('title') %}&#xA;{% block content %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; (***Put Title of Publisher Here***, {{ entry.GamesReleaseYear.format('Y') }})&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The place I want to insert the publisher's title is shown as:&#xA;&lt;strong&gt;&lt;em&gt;Put Title of Publisher Here&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks all. I just started using Craft about 3 hours ago for the first time!&lt;/p&gt;&#xA;" OwnerUserId="6018" LastEditorUserId="340" LastEditDate="2016-12-18T23:25:37.103" LastActivityDate="2016-12-18T23:25:37.103" Title="Display field from one section in another section" Tags="&lt;templating&gt;&lt;sections&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18184" PostTypeId="2" ParentId="18182" CreationDate="2016-12-18T00:06:23.273" Score="3" Body="&lt;p&gt;You can make address fields required in two ways - at the front end using your own js form validation or html techniques (and note that the Commerce example templates are not at all intended  for use with live stores, they're just examples to get you going with your own development).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second approach is in a plugin -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15897/craft-commerce-validation-on-address-fields&quot;&gt;Craft Commerce: Validation on Address Fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...the ideal approach is probably to use both methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently (Dec 16) there isn't another way.  I presume this is to give maximum flexibility with checkout and perhaps (and hopefully) pending the time when addresses become proper element types with custom field support.  That would be nice.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-12-18T00:06:23.273" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18185" PostTypeId="2" ParentId="18183" CreationDate="2016-12-18T07:06:28.633" Score="1" Body="&lt;p&gt;This is untested but, give it a try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Games&quot; %}&#xA;{% set entries = craft.entries.section('games').limit(10).order('title') %}&#xA;{% block content %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            {% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}: &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; {% set publishers = entry.GamesPublisher %}{% for publisher in publishers %}({{ publisher.title }}{% endfor %}, {{ entry.GamesReleaseYear.format('Y') }})&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If need be, have a look at &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;An introduction to relations and reverse relations in Craft CMS, with examples&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12" LastActivityDate="2016-12-18T07:06:28.633" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18186" PostTypeId="2" ParentId="17599" CreationDate="2016-12-18T08:03:08.623" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;There's only one entry named Transforming Work.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That might be true, but you’re telling Craft to store the entry with an URI&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fort-collins/weekly/buddhist-meditation-classes/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Change your entry URI format back to something that’s going to be unique for each entry, probably you’ll want to replace the hardcoded string &lt;code&gt;_entry&lt;/code&gt; with the dynamic variable &lt;code&gt;{slug}&lt;/code&gt; again, or better, do what is actually described in that Stack Exchange answer you linked to and don’t use the default Entry routing at all (disable “Entries in this section have their own URLs”) and rebuild the route with a custom one (see the Craft docs on &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Routes&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-18T08:03:08.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18187" PostTypeId="1" AcceptedAnswerId="18189" CreationDate="2016-12-18T15:44:56.017" Score="0" ViewCount="373" Body="&lt;p&gt;I have two sections:&#xA;games&#xA;publishers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a games entry title would be &quot;Mario Brothers&quot; and a publishers entry title would be &quot;Nintendo&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the entry page for Nintendo, I want to display all games (entries) they published.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;_entry,html&quot; page for publishers right now only has the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;      &#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I know I need to add it after:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the games section, I have a field called &quot;GamePublishers&quot; set to type Entries. So I assign the publisher of a game via the admin cp. Wasn't sure if I need to also setup a field type entries in GamePublishers to reference to Games section. (If that makes sense)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-19T04:07:05.423" Title="Loop through related section's entries" Tags="&lt;entry&gt;&lt;sections&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18188" PostTypeId="1" CreationDate="2016-12-18T16:09:16.883" Score="5" ViewCount="2241" Body="&lt;p&gt;I am just starting out with Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I see right now is a lot of static content in the html templates. Even in the demo.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{{ entry.body }}&#xA;&#xA;&amp;lt;h2&amp;gt;Recent News&amp;lt;/h2&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('news').limit(5).find() %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You see, that is very static. Is there a way to make it all more flexible and dynamic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want my site to be totally flexible so that users can change the outcome completely with dragging and dropping sections in the admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only want to define HTML for a field / section. Then, I would simply need to loop all fields through and load the html template for each section that is being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would allow massive reusability of these 'content boxes' everywhere. Basically, it'll become drag and drop website building to a large extend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have some advice on how to do this best?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Basically this guy is talking about it: &lt;a href=&quot;https://mijingo.com/products/screencasts/reusable-twig-templates-craft/&quot; rel=&quot;noreferrer&quot;&gt;https://mijingo.com/products/screencasts/reusable-twig-templates-craft/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6021" LastEditorUserId="6021" LastEditDate="2016-12-18T17:28:44.907" LastActivityDate="2016-12-21T07:54:51.817" Title="How to: Flexible Twig Templates in Craft" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18189" PostTypeId="2" ParentId="18187" CreationDate="2016-12-18T17:09:07.333" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Wasn't sure if I need to also setup a field type entries in GamePublishers to reference to Games section.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessary if you already have a &quot;GamePublishers&quot; Entry field in the &quot;Games&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set games = craft.entries.section('games').relatedTo(publisher) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's assuming you've already got a variable named &lt;code&gt;publisher&lt;/code&gt; defined that's referencing the current publisher the user is viewing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest reading through the &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; docs as well.  Craft has a pretty powerful relations engine you can do all sorts of crazy stuff with.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-18T17:09:07.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18190" PostTypeId="1" AcceptedAnswerId="18192" CreationDate="2016-12-18T17:55:02.133" Score="2" ViewCount="299" Body="&lt;p&gt;I'm making a portfolio website, where the url's look like &quot;projects/project-name&quot;.&#xA;There is also an overview page with all the projects that is under &quot;projects&quot; on itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a Structure for this, but I go to the 404 page when I'm just trying to go to &quot;projects&quot; without the slugs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of using a structure without a slug? &lt;/p&gt;&#xA;" OwnerUserId="6023" LastActivityDate="2020-08-13T05:53:56.593" Title="Can I use a structure without slugs?" Tags="&lt;structure&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18191" PostTypeId="2" ParentId="18188" CreationDate="2016-12-18T22:08:37.907" Score="11" Body="&lt;p&gt;I'm not sure I understand your question 100%, but I'm assuming you're talking about a thoroughly modular approach to templating, and not about letting your end users/content editors actually edit the &lt;em&gt;content model&lt;/em&gt; (i.e. create/edit Sections, fields, field layouts etc) – because the latter is &lt;strong&gt;not&lt;/strong&gt; a good approach, in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, this is a very open question, so this answer is kind of broad (or in any case, it just outlines one way to do it, focused on entries and fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I haven't seen the Mijingo videos, but I think the answer to your use case is probably to go with a partial-heavy approach. &lt;em&gt;Basically, a &quot;partial&quot; is an incomplete/modular template that you can include in another template.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, you might want to create a &quot;catch-all&quot; template (let's just assume your catch-all template is called &lt;code&gt;templates/index.html&lt;/code&gt;). Be sure to add the path to that template (which would just be &lt;code&gt;index&lt;/code&gt;) to the &lt;em&gt;Entry Template&lt;/em&gt; setting for all relevant Sections, to make sure the same, catch-all template is always loaded for all entry URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, assuming your site has three fields – &lt;code&gt;heading&lt;/code&gt;, &lt;code&gt;image&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt; – you'd create &lt;em&gt;a partial template for each of these fields&lt;/em&gt;. It's a good idea to store your partials in a folder prefixed with an underscore, to make sure Craft doesn't include them whenever it maps URL routes to template paths (these templates aren't standalone and should never be rendered on their own). So for the three fields in our example, you'd create these three templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/templates/_partials/heading.html&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;/templates/_partials/image.html&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;/templates/_partials/body.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how the &lt;code&gt;heading.html&lt;/code&gt; partial could look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if element.heading %}&#xA;    &amp;lt;h1 class=&quot;heading&quot;&amp;gt;{{ element.heading }}&amp;lt;/h1&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside your catch-all template, you'd then need to &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;{% include %}&lt;/code&gt;&lt;/a&gt; these partial templates, following some logic of your choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an approach that basically loops through all fields for the current &lt;code&gt;entry&lt;/code&gt;'s field layout, attempting to include a partial template for each field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}{# Assuming this template extends a basic layout template #}&#xA;{% block content %}&#xA;&#xA;    {# Get all fields, indexed by field ID #}&#xA;    {% set allFields = craft.fields.getAllFields('id') %}&#xA;&#xA;    {# Get the IDs for all fields in this entry's field layout #}&#xA;    {% set fieldIds = entry.getFieldLayout().getFieldIds() %}&#xA;&#xA;    {# Loop through the entry fields' IDs; attempt to include template based on each field's handle #}&#xA;    {% for fieldId in fieldIds %}&#xA;        {% set field = allFields[fieldId] ?? null %}&#xA;        {% if field and entry[field.handle] %}&#xA;            {% include '_partials/'~field.handle ignore missing with { element: entry } %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A couple of things to note:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the above code builds the template path to each partial dynamically, by joining the root path (&lt;code&gt;'_partials/'&lt;/code&gt;) with each field's &lt;code&gt;handle&lt;/code&gt; property (using the tilde operator &lt;code&gt;~&lt;/code&gt;). In other words, this solution hinges upon using the fields' handles for the partial templates' filenames. Note that its also possible to pass an array of template paths to the &lt;code&gt;{% include %}&lt;/code&gt; tag, in which case Craft will attempt to load the next template in that array whenever it fails the load the former. Here's how that could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ['_partials/matrix/'~field.handle, '_partials/fields/'~field.handle] ignore missing with { element: entry } %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, Craft would first look for the template &lt;code&gt;/templates/_partials/matrix/title.html&lt;/code&gt;, and if that file doesn't exist it'd look for &lt;code&gt;/templates/_partials/fields/title.html&lt;/code&gt; (before failing silently due to the &lt;code&gt;ignore missing&lt;/code&gt; directive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, it might seem redundant to pull &lt;em&gt;all fields&lt;/em&gt; from the &lt;a href=&quot;https://craftcms.com/classreference/services/FieldsService&quot; rel=&quot;noreferrer&quot;&gt;FieldsService&lt;/a&gt;, but &lt;a href=&quot;https://craftcms.stackexchange.com/a/2928/1098&quot;&gt;the alternative&lt;/a&gt; is to hit the database for every field in your entry's field layout, so this should actually be the most performant way to pull the current entry's actual &lt;a href=&quot;https://craftcms.com/classreference/models/FieldModel&quot; rel=&quot;noreferrer&quot;&gt;FieldModels&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third – the &lt;code&gt;with&lt;/code&gt; statement for the &lt;code&gt;{% include %}&lt;/code&gt; tag enables you to pass parameters to the included template. In this example, we're actually exposing the current entry to the included template as the more generic &lt;code&gt;element&lt;/code&gt; variable. This is just future proofing in case we want to use the same partials for other element types, e.g. categories (in which case you'd use &lt;code&gt;with { element: category }&lt;/code&gt;) – notice that in the example &lt;code&gt;heading.html&lt;/code&gt; template above, &lt;code&gt;element.heading&lt;/code&gt; is used over &lt;code&gt;entry.heading&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to avoid variable pollution, you might pass the &lt;code&gt;only&lt;/code&gt; directive aswell, in which case &lt;em&gt;only&lt;/em&gt; whatever parameters passed with &lt;code&gt;with&lt;/code&gt; will be made available to the included statement, nothing else:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/'~field.handle with { element: entry } only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, you can include other stuff in the object passed to &lt;code&gt;with&lt;/code&gt;, as well. For instance, you might want to render stuff differently if the current field is either first or last in the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_partials/'~field.handle with { element: entry, isFirst: loop.first, isLast: loop.last } %}&#xA;&#xA;{# In heading.html #}&#xA;&amp;lt;div class=&quot;field{{ isFirst ? ' is-first' }}{{ isLast ? ' is-last' }}&quot;&amp;gt;&#xA;    &amp;lt;h2 class=&quot;heading&quot;&amp;gt;{{ element.heading }}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Going further; talking about Matrix fields and alluding to the fact that putting Matrix field partials in a separate templates folder might be a good idea – if you're going fully modular it might make sense to create separate templates for each Matrix block type, as well. Tons of ways to skin this cat, but one way to do it is to add a sub folder for every Matrix field, containing partials for each of the field's block types. For example, if you've got a Matrix field called &lt;code&gt;contentBlocks&lt;/code&gt; with the block types &lt;code&gt;images&lt;/code&gt; and &lt;code&gt;text&lt;/code&gt; you might structure it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;templates/_partials/contentBlocks.html&lt;/code&gt; (the partial for the Matrix field itself)&lt;br&gt;&#xA;&lt;code&gt;templates/_partials/contentBlocks/images.html&lt;/code&gt; (the partial for the &lt;code&gt;images&lt;/code&gt; block type)&lt;br&gt;&#xA;&lt;code&gt;templates/_partials/contentBlocks/text.html&lt;/code&gt; (the partial for the &lt;code&gt;text&lt;/code&gt; block type)    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, inside the &lt;code&gt;contentBlocks.html&lt;/code&gt; template, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in element.contentBlocks %}&#xA;    {% include '_partials/contentBlocks/'~block.type ignore missing with { block: block } only %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In fact, you might not even need the &lt;code&gt;contentBlocks.html&lt;/code&gt; field template, and just do something like this in &lt;code&gt;index.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if field.type == 'Matrix' %}&#xA;    {# Attempt to include the blocks for this Matrix field #}&#xA;    {% for block in entry.field %}&#xA;        {% include '_partials/'~field.handle~'/'~block.type ignore missing with { block: block } only %}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {# Non-Matrix fields #}&#xA;    {% include '_partials/'~field.handle ignore missing with { element: entry } %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One final thing to note – with the above solution, your entries' fields' partials will be included in the order corresponding to the entry type's field layout (i.e. the first field in the layout will be included first). This may or may not be what you want (the order that makes sense inside the CP may not always correspond to what the design/front end should look like) but if you need more control over your fields' order, you could do something like this inside &lt;code&gt;index.html&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldsToInclude = ['image', 'heading', 'body'] %}&#xA;{% for fieldHandle in fieldsToInclude %}&#xA;    {% if entry['fieldHandle'] %}&#xA;        {% include '_partials/'~fieldHandle ignore missing with { element: entry ) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will actually be slightly more performant than the first example, because it avoids the few database queries involved in pulling the fields dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, for optimal flexibility you'd probably go heavy on the Matrix fields, too – obviously, any Matrix block partials would render in their original order inside the Matrix fields, so with Matrix blocks your content editors will have complete control over where each piece of content actually renders.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-12-21T07:54:51.817" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18192" PostTypeId="2" ParentId="18190" CreationDate="2016-12-18T22:30:01.237" Score="2" Body="&lt;p&gt;You'll need to create a listing template for the base &lt;code&gt;/projects&lt;/code&gt; URL, and make that template render for that URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way is to just add a template called &lt;code&gt;/templates/projects/index.html&lt;/code&gt;, in which case Craft will automatically render that template whenever a user hits &lt;code&gt;example.com/projects&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way is to create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt;, and point it to whatever template you want rendered for the &lt;code&gt;/projects&lt;/code&gt; URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, inside your listing template you'll need to pull the Structure entries manually, i.e. by doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('projects') %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;        ...&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if you don't pass an &lt;code&gt;.order()&lt;/code&gt; parameter to your &lt;code&gt;craft.entries&lt;/code&gt; query, Craft will use the default order, which is the &quot;manual&quot; &lt;code&gt;structure&lt;/code&gt; order for Structure sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if your Structure is multi-level, you'll probably want to use the &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% nav %}&lt;/code&gt;&lt;/a&gt; tag over the basic &lt;code&gt;{% for %}&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in craft.entries.section('projects') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-19T06:55:30.150" LastActivityDate="2016-12-19T06:55:30.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18193" PostTypeId="2" ParentId="18187" CreationDate="2016-12-19T02:44:29.743" Score="0" Body="&lt;p&gt;Think I finally got it. Here is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;      &#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;&#xA;    &amp;lt;h2&amp;gt;Games&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% set entries = craft.entries.section('games').relatedTo(entry) %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries.order('title') %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;{% if entry.GamesGenre is not empty %} ({% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}){% endif %}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastEditorUserId="57" LastEditDate="2016-12-19T04:07:05.423" LastActivityDate="2016-12-19T04:07:05.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18194" PostTypeId="1" CreationDate="2016-12-19T11:28:16.160" Score="1" ViewCount="314" Body="&lt;p&gt;By default the Element API plugin all endpoints in a data object like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ &quot;data&quot;: [ { &quot;key&quot; : &quot;value&quot;, &quot;key2&quot;: &quot;value2&quot; } ]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i don't want to wrap this in the data object but like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ &quot;key&quot; : &quot;value&quot;, &quot;key2&quot;: &quot;value2&quot; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2016-12-19T18:50:25.107" LastActivityDate="2016-12-19T18:50:25.107" Title="How to use the Element API endpoint without wrapping it in data object" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18195" PostTypeId="2" ParentId="17615" CreationDate="2016-12-19T13:25:11.550" Score="1" Body="&lt;p&gt;Heck! I just did it with jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.nav .dropdown-menu li.active').parents('li').addClass('activeParent');​&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that's that.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-19T13:25:11.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18196" PostTypeId="1" AcceptedAnswerId="18599" CreationDate="2016-12-19T13:34:13.000" Score="2" ViewCount="1463" Body="&lt;p&gt;I've a problem with this code. I get the error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;getUrl&quot;) on a null variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if siteBgBlureFallback %}&#xA;    background-image: url({{ siteBgBlure.first().getUrl('bodyBg') }});&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the full code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% set siteBg = entry.siteBg %}&#xA;    {% set siteBgBlure = entry.siteBgBlure %}&#xA;{% endif %}&#xA;&#xA;{% set siteBgFallback = siteBgFallback.siteBg %}&#xA;{% set siteBgBlureFallback = siteBgFallback.siteBgBlure %}&#xA;&#xA;.bg {&#xA;{% if siteBg is defined and siteBg is not empty %}&#xA;    {% if siteBg %}&#xA;        background-image: url({{ siteBg.first().getUrl('bodyBg') }});&#xA;    {% endif %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% if siteBgFallback %}&#xA;        background-image: url({{ siteBgFallback.first().getUrl('bodyBg') }});&#xA;    {% endif %}&#xA;{% endif %}&#xA;}&#xA;&#xA;.bgblure {&#xA;{% if siteBgBlure is defined and siteBgBlure is not empty %}&#xA;    {% if siteBgBlure %}&#xA;        background-image: url({{ siteBgBlure.first().getUrl('bodyBg') }});&#xA;    {% endif %}&#xA;&#xA;{% else %}&#xA;    {% if siteBgBlureFallback %}&#xA;        background-image: url({{ siteBgBlureFallback.first().getUrl('bodyBg') }});&#xA;    {% endif %}&#xA;{% endif %}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't understand why the first three outputs work and the 4th won't work any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The backup fields have some pic in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx for your help :)&lt;/p&gt;&#xA;" OwnerUserId="5577" LastEditorUserId="5577" LastEditDate="2016-12-20T11:23:42.280" LastActivityDate="2017-01-19T18:13:48.207" Title="Impossible to invoke a method (&quot;getUrl&quot;) on a null variable" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18197" PostTypeId="1" CreationDate="2016-12-19T14:06:01.593" Score="1" ViewCount="338" Body="&lt;p&gt;Is it possible without a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our client desperately wants the shipping method to be reset (not selected) after an order has been placed or the empty cart button is clicked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: The shipping method does indeed reset after a completed purchase. Apologies. Regardless, reset on empty cart is still an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2016-12-19T16:09:46.203" LastActivityDate="2016-12-21T04:19:06.757" Title="Reset shipping method on cart empty and order complete" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18198" PostTypeId="1" CreationDate="2016-12-19T14:55:47.610" Score="3" ViewCount="138" Body="&lt;p&gt;I'm working on a custom stock management plugin for a client's Craft Commerce site, and I need to have relations from my custom element type (used to keep a detailed log of stock changes) to the products and variants, and the user or order that modified the stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at the Events plugin, as well as Craft &amp;amp; Commerce's source code, but I'm still struggling to write my &lt;code&gt;modifyElementsQuery&lt;/code&gt; in such a way that allows me to access the content of these other elements without directly joining from the content table (which seems like a terrible way of going about it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the right way of relating two element types together? Is there any example code I can look at (either in Craft core, or an open-source plugin)?&lt;/p&gt;&#xA;" OwnerUserId="3899" LastActivityDate="2017-01-05T04:29:36.807" Title="What's the correct way to relate element types to a custom element type?" Tags="&lt;plugin-craftcommerce&gt;&lt;relations&gt;&lt;database&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18199" PostTypeId="2" ParentId="18194" CreationDate="2016-12-19T15:12:41.807" Score="1" Body="&lt;p&gt;Use the config setting &lt;code&gt;'first' =&amp;gt; true&lt;/code&gt; and wrap the endpoint in a function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/link' =&amp;gt; function() {&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'first' =&amp;gt; true,&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'mysecton'],&#xA;        'paginate' =&amp;gt; false,&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return $something;&#xA;        }&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2016-12-19T18:49:54.323" LastActivityDate="2016-12-19T18:49:54.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18201" PostTypeId="1" AcceptedAnswerId="18205" CreationDate="2016-12-19T16:49:23.957" Score="1" ViewCount="265" Body="&lt;p&gt;I'm trying to make a very basic plugin that will send an email alert to a User if an Admin changes their User Group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could use the onBeforeSaveUser to get the User's current User Group, and then use the onSaveUser event to compare that with the Event's User Group - and then if they differ, do the mail sending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't work, and I don't know why. Both events always get the same value for the User Group. What am I not understanding correctly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private $existingGroups = NULL;&#xA;&#xA;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;        $eventUser = $event-&amp;gt;params['user']; // get the user we are editing&#xA;&#xA;        $user = craft()-&amp;gt;users-&amp;gt;getUserById($eventUser-&amp;gt;id); // get that user's existing information, before we edit it&#xA;&#xA;        $this-&amp;gt;existingGroups = $user-&amp;gt;getGroups(); // store the groups the User belongs to&#xA;        GroupNotificationPlugin::log(&quot;existingGroup: &quot; . $this-&amp;gt;existingGroups[0]-&amp;gt;name, LogLevel::Info);&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;        $user = $event-&amp;gt;params['user']; // get the user we are editing&#xA;&#xA;        GroupNotificationPlugin::log(&quot;Was: &quot; . $this-&amp;gt;existingGroups[0]-&amp;gt;name, LogLevel::Info);&#xA;        GroupNotificationPlugin::log(&quot;Now: &quot; . $user-&amp;gt;getGroups()[0]-&amp;gt;name, LogLevel::Info);&#xA;&#xA;        if($this-&amp;gt;existingGroups[0]-&amp;gt;name != $user-&amp;gt;getGroups()[0]-&amp;gt;name){&#xA;            GroupNotificationPlugin::log(&quot;Changing group&quot;, LogLevel::Info);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Was: XXX and Now: XXX are always reporting the same, even when I know that I have changed the User Group (unchecking the old one, checking a new one, saving).&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-12-19T19:03:06.387" Title="onBeforeSaveUser vs onSaveUser" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18202" PostTypeId="1" CreationDate="2016-12-19T17:20:10.787" Score="2" ViewCount="144" Body="&lt;p&gt;I am trying to load an image transform and continually get a 404 which references an issue with the UserSessionService. I have a attached a screen shot as well as twig template for one of the transform.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set contributor = entry.contributorProfile.first() %}&#xA;{% set headshot = contributor.headshot.first() %}&#xA;&#xA;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 200,&#xA;    height: 200,&#xA;    quality: 80,&#xA;    position: headshot.focusPctX ~ '% ' ~ headshot.focusPctY ~ '%'&#xA;} %}&#xA;&#xA;&amp;lt;aside class=&quot;contributor-excerpt&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{headshot.getUrl(thumb)}}&quot; alt=&quot;&quot;&amp;gt;&#xA;&amp;lt;/aside&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WnTCJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WnTCJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-12-19T17:34:08.750" Title="Image Transform 404 From User Session" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18203" PostTypeId="2" ParentId="18202" CreationDate="2016-12-19T17:34:08.750" Score="2" Body="&lt;p&gt;You can't use FocusPoint like that with the default Craft Transforms, which might be your problem. You'll need to use Imager to get the position as a percentage supported.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image   = entry.listingImage.first() %}&#xA;{% set max479  = craft.imager.transformImage(image, {width: 480, height: 200, mode: 'crop', jpegQuality: 70, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%'   }) %}&#xA;{% set min480  = craft.imager.transformImage(image, {width: 700, height: 250, mode: 'crop', jpegQuality: 70, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%'   }) %}&#xA;{% set min700  = craft.imager.transformImage(image, {width: 960, height: 250, mode: 'crop', jpegQuality: 70, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%'   }) %}&#xA;{% set min960  = craft.imager.transformImage(image, {width: 1280, height: 250, mode: 'crop', jpegQuality: 70, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%'  }) %}&#xA;{% set min1280 = craft.imager.transformImage(image, {width: 1500, height: 250, mode: 'crop', jpegQuality: 70, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%'  }) %}&#xA;&#xA;{# standard Imager image transforms #}&#xA;&amp;lt;picture&amp;gt;&#xA;    &amp;lt;source media=&quot;(max-width: 479px)&quot; srcset=&quot;{{ max479.url }}&quot;&amp;gt;&#xA;    &amp;lt;source media=&quot;(min-width: 1280px)&quot; srcset=&quot;{{ min1280.url }}&quot;&amp;gt;&#xA;    &amp;lt;source media=&quot;(min-width: 960px)&quot; srcset=&quot;{{ min960.url }}&quot;&amp;gt;&#xA;    &amp;lt;source media=&quot;(min-width: 700px)&quot; srcset=&quot;{{ min700.url }}&quot;&amp;gt;&#xA;    &amp;lt;source media=&quot;(min-width: 480px)&quot; srcset=&quot;{{ min480.url }}&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ min1280.url }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;&amp;lt;/picture&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2016-12-19T17:34:08.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18204" PostTypeId="2" ParentId="18196" CreationDate="2016-12-19T18:48:40.970" Score="0" Body="&lt;p&gt;My guess is that you need to change this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if siteBgBlureFallback %}&#xA;    background-image: url({{ siteBgBlure.first().getUrl('bodyBg') }});&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if siteBgBlureFallback %}&#xA;    background-image: url({{ siteBgBlureFallback .first().getUrl('bodyBg') }});&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-19T18:48:40.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18205" PostTypeId="2" ParentId="18201" CreationDate="2016-12-19T19:03:06.387" Score="2" Body="&lt;p&gt;The problem is that both &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onSaveUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveUser&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeSaveUser&lt;/a&gt; get fired from &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersService-&gt;saveUser()&lt;/a&gt; and user group assignment happens in the &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionSaveUser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController-&gt;actionSaveUser()&lt;/a&gt; &lt;em&gt;after&lt;/em&gt; &lt;code&gt;UsersService-&amp;gt;saveUser()&lt;/code&gt; has already been called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably be using &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onBeforeAssignUserToGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeAssignUserToGroups&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;onAssignUserToGroups&lt;/a&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-19T19:03:06.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18206" PostTypeId="1" AcceptedAnswerId="18209" CreationDate="2016-12-19T20:04:49.490" Score="1" ViewCount="207" Body="&lt;p&gt;So, I'm building a portfolio site for a client, and I'd like to know if it's possible to hide fields on a parent entry. Essentially, I've created a structure for portfolio items, and they are all children of the main &quot;Works&quot; page. I've built a set of fields for each portfolio item, but I don't want those fields to show up on the parent entry, as they are unnecessary and therefore distracting. Is there a way I can do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2016-12-20T09:17:07.147" Title="Hiding Field on Parent Entry" Tags="&lt;structure&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18207" PostTypeId="1" CreationDate="2016-12-20T01:04:13.367" Score="0" ViewCount="764" Body="&lt;p&gt;In the backend, I could upload an image. I see it loads fine in the backend admin CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it goes to a 404 error on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File System Path:&#xA;/home/devserv1/colorcomputergames.com/assets/clones/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL to your folder:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/assets/clones/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/assets/clones/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The direct URL to the image is:&#xA;www.colorcomputergames.com/assets/clones/lunar_lander.png&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it brings up a 404 Error. I read here to look into the server settings. I'm running Apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-20T01:08:45.143" Title="404 Error showing for Asset Images" Tags="&lt;assets&gt;&lt;image&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18208" PostTypeId="2" ParentId="18207" CreationDate="2016-12-20T01:08:45.143" Score="4" Body="&lt;p&gt;Figured it out. I assumed that my assets folder needed 744 just as the install instructions mentioned for the Craft CMS folders. But, I need to change the permissions to the standard 755. Once I did, I could view the images.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-20T01:08:45.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18209" PostTypeId="2" ParentId="18206" CreationDate="2016-12-20T08:31:01.803" Score="3" Body="&lt;p&gt;You can create two different &lt;a href=&quot;https://craftcms.com/features/entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Types&lt;/a&gt; for your Structure section, and use one Entry Type for parent entries, and a different entry type for child entries. Entry Types have their own field layout, which makes it possible to have different fields for different kinds of entries, within the same Section. Then, it's simply a matter of selecting the right Entry Type when you create/edit your entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that isn't dynamic enough (it isn't possible to assign entry types automatically based on whether an entry has children or not), you could possibly use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP CSS plugin&lt;/a&gt; (perhaps in combination with the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP JS plugin&lt;/a&gt;) to hide the relevant fields for the parent entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that neither of these solutionals are ideal – however, if you only have a single parent (i.e. &quot;Works&quot;) for all your portfolio entries, I think a better approach would be to create a separate &quot;Portfolio&quot; Structure section limited to a single level, to hold all your portfolio entries. Set the URL format for this section to &lt;code&gt;&quot;works/{slug}&quot;&lt;/code&gt;. Under &lt;code&gt;/templates/works&lt;/code&gt; you can add two templates, &lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;_entry.html&lt;/code&gt;. The former will render for the URL &lt;code&gt;example.com/works&lt;/code&gt; and can be used for your portfolio section's listing page (i.e. it'd replace the current &quot;Works&quot; parent page), and the latter template's path (i.e. &lt;code&gt;works/_entry&lt;/code&gt;) should be added to your portfolio section's Entry Template setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do need some fields for the listing page, you could create a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Single&lt;/a&gt; called &quot;Works&quot; and set its URL Format and Entry Template path to just &lt;code&gt;&quot;works&quot;&lt;/code&gt;. A setup like this would circumvent your issue completely (and also avoid the problem with content editors getting your current solution wrong; adding new portfolio entries to the top level).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-20T08:45:25.527" LastActivityDate="2016-12-20T08:45:25.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18210" PostTypeId="2" ParentId="18206" CreationDate="2016-12-20T09:17:07.147" Score="2" Body="&lt;p&gt;Or in Addition to Mats answer you could use the &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;reasons plugin&lt;/a&gt; to hide and show fields based on a lightswitch button. But when you have lots of different fields, different entry types are the way to go.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2016-12-20T09:17:07.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18211" PostTypeId="1" CreationDate="2016-12-20T11:15:31.503" Score="0" ViewCount="94" Body="&lt;p&gt;I'm working on a Craft Commerce 1.2.1331 site using Worldpay but I'm having problems with Worldpay test transactions not completing the order first-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users are redirected from Worldpay to the Order Thank You template but the order is not being marked as Complete. It remains an active cart. Then, if you checkout again, the order is marked as complete and the cart is emptied. Anyone?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing in the logs. Actually, there isn't a Commerce log.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-12-20T11:15:31.503" Title="Craft Commerce and Worldpay not marking payments as complete" Tags="&lt;plugin-craftcommerce&gt;&lt;worldpay&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18212" PostTypeId="1" AcceptedAnswerId="18216" CreationDate="2016-12-20T12:06:00.313" Score="1" ViewCount="128" Body="&lt;p&gt;I work on a portfolio with a large number of images with very high sizes and a lot of images transforms. The server on which this site is hosted reach these limits (images generations process are generally blocked), so I would like to experiment with &lt;a href=&quot;http://www.imgix.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;imgix&lt;/a&gt; in order to move the transformations of images in the cloud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to tell imgix how to crop images and I prefer to define my transformation types in the Control Panel rather than in the templates. How can I retrieve the mode of an image transformation from its his name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something like &lt;code&gt;{{ craft.assets.getMode('myTransformName') }}&lt;/code&gt; ? I haven't found a method for this in the documentation.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2016-12-20T14:19:32.573" Title="How to retrieve the mode of an image transformation from its name?" Tags="&lt;image-transforms&gt;&lt;image&gt;&lt;assetfilemodel&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18213" PostTypeId="1" AcceptedAnswerId="18220" CreationDate="2016-12-20T13:11:13.923" Score="4" ViewCount="240" Body="&lt;p&gt;I have a Smart Map field in a section and am trying to output multiple results (pins) to a single map.&lt;/p&gt;&#xA;&lt;p&gt;This code will output multiple maps (one map per pin)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for mapEntry in craft.entries.section('markets') %}&#xA;{% set options = {&#xA;    height: 500,&#xA;    zoom: 14,&#xA;    draggable: false,&#xA;    markerInfo: '_includes/mapInfoBubble',&#xA;    markerOptions: {&#xA;        icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;    },&#xA;    infoWindowOptions: {&#xA;        maxWidth: 200&#xA;    }&#xA;} %}&#xA;&#xA;{% set locations = craft.entries.section('markets').marketAddress.find() %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So essentially I am trying to get the &lt;code&gt;{{ craft.smartMap.map(locations, options) }}&lt;/code&gt; outside the for loop.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = '' %}&#xA;{% set options = '' %}&#xA;{% for mapEntry in craft.entries.section('markets') %}&#xA;{% set options = {&#xA;    height: 500,&#xA;    zoom: 14,&#xA;    draggable: false,&#xA;    markerInfo: '_includes/mapInfoBubble',&#xA;    markerOptions: {&#xA;        icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;    },&#xA;    infoWindowOptions: {&#xA;        maxWidth: 200&#xA;    }&#xA;} %}&#xA;{% set locations = craft.entries.section('markets').marketAddress.find() %}&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But this only results in a single pin (most recent entry).&lt;/p&gt;&#xA;&lt;p&gt;Can't get my head around this. Any assistance most welcome.&lt;/p&gt;&#xA;" OwnerUserId="5097" LastEditorUserId="45" LastEditDate="2021-01-01T06:46:33.017" LastActivityDate="2021-01-01T06:47:16.263" Title="Smart Map - Setting single map with multiple pins" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="18214" PostTypeId="1" AcceptedAnswerId="18215" CreationDate="2016-12-20T13:15:50.423" Score="1" ViewCount="1269" Body="&lt;p&gt;I have read docs on Craft CMS site and Googled some related articles but can't seem to get my head around checking for conditions for a field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a 'Fruit' field drop-down:&#xA;Apple&#xA;Banana&#xA;Orange&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I add a 4th value with 'null'? So in my template, I want to display the field if it is Apple, Banana or Orange but not if null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get confused when to to use '|length'  or 'is empty' or 'is not' conditionals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another example, I tried to setup a drop-down for a field called 'Rating'&#xA;The values were 1, 2, 3, 4, 5&#xA;I couldn't get the conditional to work, so I thought to make the field a number type. And then I tried a conditional 'rating &gt; 0' but also didn't succeed.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-20T22:47:23.233" Title="Checking if a field contains information" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18215" PostTypeId="2" ParentId="18214" CreationDate="2016-12-20T14:05:01.460" Score="3" Body="&lt;p&gt;If you want a Dropdown field with the option to &lt;em&gt;not&lt;/em&gt; select a value (or to clear out the current selection), you can just add an option (typically the first) with an empty &lt;code&gt;value&lt;/code&gt; column. If the empty value/option is selected, the following conditional will evaluate to &lt;code&gt;false&lt;/code&gt;, and if any other, non-empty value is selected it will evaluate to &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.dropdownFieldHandle %}&#xA;    I have a value: {{ entry.dropdownFieldHandle }}&#xA;{% else %}&#xA;    I have no value in the dropdown&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for Dropdown fields its also possible to leave the &lt;code&gt;label&lt;/code&gt; column empty, or to use something like &quot;Pick a value...&quot; as a placeholder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use &lt;code&gt;null&lt;/code&gt; instead of an empty value, the above conditional will always evaluate to &lt;code&gt;true&lt;/code&gt;, because Twig will treat the value &lt;code&gt;null&lt;/code&gt; as a string (i.e. &lt;code&gt;&quot;null&quot;&lt;/code&gt;), not an actual &lt;code&gt;NULL&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the &lt;code&gt;|length&lt;/code&gt; filter, since your question brings it up – the only thing &lt;code&gt;|length&lt;/code&gt; does is to return the &lt;em&gt;length&lt;/em&gt; of whatever variable its suffixed to. For an iterable object (like an array or a relational field like Assets or Entries) the length will be the amount of elements in that object (for instance, the number of Assets selected in an Assets field); for strings and numbers it will be the number of characters (meaning &lt;code&gt;&quot;foo&quot;|length&lt;/code&gt; and &lt;code&gt;123|length&lt;/code&gt; will both return &lt;code&gt;3&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason &lt;code&gt;|length&lt;/code&gt; is often used in conditionals, is that &lt;code&gt;0&lt;/code&gt; is considered a &quot;falsey&quot; value, and any length larger than &lt;code&gt;0&lt;/code&gt; is considered a &quot;truthy&quot; value. In other words, a conditional like &lt;code&gt;{% if &quot;&quot;|length %}&lt;/code&gt; will be evaluated to &lt;code&gt;false&lt;/code&gt;, because &lt;code&gt;&quot;&quot;&lt;/code&gt; is an empty string and hence will return &lt;code&gt;0&lt;/code&gt; characters, while a conditional like &lt;code&gt;{% if &quot;foo&quot;|length %}&lt;/code&gt; will evaluate to &lt;code&gt;true&lt;/code&gt; because the &lt;code&gt;length&lt;/code&gt; filter will return &lt;code&gt;3&lt;/code&gt; characters and &lt;code&gt;3&lt;/code&gt; is a &quot;truthy&quot; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, the reason why the &lt;code&gt;|length&lt;/code&gt; filter isn't neccessary in the above example conditional is simply because Twig will automatically evaluate conditionals testing empty strings to &lt;code&gt;false&lt;/code&gt;. So while &lt;code&gt;{% if entry.dropdownFieldHandle|length %}&lt;/code&gt; would also work (i.e. evaluate to &lt;code&gt;false&lt;/code&gt; for empty values), it isn't actually neccessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;code&gt;is not&lt;/code&gt; (or simply &lt;code&gt;not&lt;/code&gt;) is simply Twig-speak for the &lt;code&gt;!=&lt;/code&gt; operator, i.e. &lt;code&gt;is not equal to&lt;/code&gt;. So if you wanted to reverse the conditional above, here's how that would look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.dropdownFieldHandle %}&#xA;    I have no value in the dropdown&#xA;{% else %}&#xA;    I have a value: {{ entry.dropdownFieldHandle }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-20T22:47:23.233" LastActivityDate="2016-12-20T22:47:23.233" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18216" PostTypeId="2" ParentId="18212" CreationDate="2016-12-20T14:19:32.573" Score="1" Body="&lt;p&gt;Not possible out of the box, unfortunately. Asset transforms can be pulled by using the &lt;a href=&quot;https://craftcms.com/classreference/services/AssetTransformsService#getTransformByHandle-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsTransformService&lt;/a&gt;, but Craft doesn't expose that service to Twig (unlike the &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService&lt;/a&gt;, which is what you're working with when you're using &lt;code&gt;craft.assets&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do is to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a simple, custom plugin&lt;/a&gt; exposing the AssetsTransformsService to Twig by adding the following to a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variable&lt;/a&gt; class in your plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function assetTransforms()&#xA;{&#xA;    return craft()-&amp;gt;assetTransforms;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you'd be able to do something like this in your templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = craft.myPluginHandle.assetTransforms.getTransformByHandle('myTransformName') %}&#xA;&amp;lt;p&amp;gt;The mode is {{ transform.mode }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-20T14:19:32.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18217" PostTypeId="1" AcceptedAnswerId="18219" CreationDate="2016-12-20T14:28:01.793" Score="2" ViewCount="313" Body="&lt;p&gt;I would like to create a custom dropdown field with dynamic data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I would get data from one of my services, and then inject it dynamically in the HTML select field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read the plugin documentation on custom field types, but couldn't find anything about this&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="125" LastEditDate="2016-12-20T15:09:19.937" LastActivityDate="2016-12-20T15:14:50.280" Title="Create custom field type with dynamic data" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18218" PostTypeId="1" CreationDate="2016-12-20T15:12:38.587" Score="1" ViewCount="800" Body="&lt;p&gt;After I input my credentials, it just stayed on the login page, and did not go to the dashboard. The password is good, we didn't get invalid username and password error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I opened the trace mode and found this error in the craft.log:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to determine if PATH_INFO is enabled on the server: [curl] 60:&#xA;  Could it cause the error? &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The CSRF token could not be verified&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/12/20 12:52:41 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'The CSRF token could not be verified.' in /var/www/vhosts/xxx.com/master/craft/app/services/HttpRequestService.php:1314 Stack trace:&#xA;    #0 /var/www/vhosts/xxx.com/master/craft/app/framework/base/CComponent.php(561): Craft\HttpRequestService-&amp;gt;validateCsrfToken(Object(CEvent))&#xA;    #1 /var/www/vhosts/xxx.com/master/craft/app/framework/base/CApplication.php(212): CComponent-&amp;gt;raiseEvent('onBeginRequest', Object(CEvent))&#xA;    #2 /var/www/vhosts/xxx.com/master/craft/app/framework/base/CApplication.php(183): CApplication-&amp;gt;onBeginRequest(Object(CEvent))&#xA;    #3 /var/www/vhosts/xxx.com/master/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;    #4 /var/www/vhosts/xxx.com/master/public/index.php(20): require_once('/var/www/vhosts...')&#xA;    #5 {main} REQUEST_URI=/wtuygyq/upuj/duhuhog&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5227" LastEditorUserId="5227" LastEditDate="2017-01-03T17:49:26.667" LastActivityDate="2017-01-03T17:49:26.667" Title="Can’t log in to the Craft control panel" Tags="&lt;admin&gt;&lt;csrf&gt;&lt;environmentvariables&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18219" PostTypeId="2" ParentId="18217" CreationDate="2016-12-20T15:14:50.280" Score="3" Body="&lt;p&gt;You should have a look at the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Dynamic Fields plugin&lt;/a&gt;, it sounds like everything you’re after is already doable with this plugin and if not, you can study the code or build upon it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-20T15:14:50.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18220" PostTypeId="2" ParentId="18213" CreationDate="2016-12-20T15:46:46.477" Score="3" Body="&lt;p&gt;According to &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt;, &lt;code&gt;locations&lt;/code&gt; has to be an array of elements or an ElementCriteriaModel&#xA;if you want to display multiple markers.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set mapEntries = craft.entries.section('markets') %}&#xA;{{ craft.smartMap.map(mapEntries, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="45" LastEditDate="2021-01-01T06:47:16.263" LastActivityDate="2021-01-01T06:47:16.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18222" PostTypeId="1" AcceptedAnswerId="18223" CreationDate="2016-12-20T16:52:48.653" Score="0" ViewCount="103" Body="&lt;p&gt;I'm creating products using a frontend form which submits to &lt;code&gt;commerce/products/saveProduct&lt;/code&gt; but it only works when I'm logged-in. They're really complicated products which need to be created on-the-fly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were my own plugin controller I was using, then I could just add &lt;code&gt;protected $allowAnonymous = true;&lt;/code&gt; but as it isn't, how would I go about this?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2016-12-20T17:35:51.720" Title="Override permissions for Craft Commerce saveProduct controller" Tags="&lt;plugins&gt;&lt;plugin-craftcommerce&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18223" PostTypeId="2" ParentId="18222" CreationDate="2016-12-20T17:35:51.720" Score="2" Body="&lt;p&gt;You'll have to write a custom plugin and point your frontend form to save to its own controller action that allows anonymous access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That action can either 1) duplicate Commerce's &lt;code&gt;saveProduct&lt;/code&gt; method, which can be brittle if it changes or 2) start a session from a generic user account that has the proper permissions and &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CController#forward-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;forward&lt;/a&gt; the request onto Commerce's &lt;code&gt;saveProduct&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-20T17:35:51.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18224" PostTypeId="1" AcceptedAnswerId="18225" CreationDate="2016-12-20T23:49:15.103" Score="1" ViewCount="49" Body="&lt;p&gt;I have a FOR loop that should be displaying all the entry titles on one line. But instead, it is outputting them on separate lines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Developer: Jane Doe, Jim Doe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead, I am getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Developer: Jane Doe&#xA;Developer: Jim Doe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set developers = entry.GamesDeveloper %}&#xA;&#xA;{% for developer in developers %}&#xA;    &amp;lt;li&amp;gt;Developer: &amp;lt;a href=&quot;{{ developer.url }}&quot;&amp;gt;{{ developer.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastEditorUserId="57" LastEditDate="2016-12-21T00:27:11.103" LastActivityDate="2016-12-21T00:27:11.103" Title="Display all entry titles on one line during FOR loop" Tags="&lt;entries&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18225" PostTypeId="2" ParentId="18224" CreationDate="2016-12-21T00:26:28.437" Score="4" Body="&lt;p&gt;This is because you're using an html list &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; element, which by default puts each element on a new line.  You could style away the newline I suppose, but why use it at all...there are a bunch of ways of doing this, but this is one simple one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set developers = entry.GamesDeveloper %}&#xA;{% if developers|length %}&#xA;Developer: &#xA;{% for developer in developers %}           &#xA;    &amp;lt;a href=&quot;{{ developer.url }}&quot;&amp;gt;{{ developer.title }}&amp;lt;/a&amp;gt;{% if not loop.last %}, {% endif %}&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-21T00:26:28.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18226" PostTypeId="2" ParentId="18197" CreationDate="2016-12-21T04:04:30.213" Score="1" Body="&lt;p&gt;You're right, this does not seem to clear automatically when you remove all line items, but you could &lt;em&gt;I think&lt;/em&gt; just set an extra post value in your form that calls &lt;code&gt;removeAllLineItems&lt;/code&gt; to clear the shipping handle at the same time...because in this controller there is a call to &lt;code&gt;$cart-&amp;gt;setContentFromPost('fields');&lt;/code&gt; I presume if you set the shipping handle to &lt;code&gt;&quot;&quot;&lt;/code&gt;, that set content will cause the shipping method to be dropped from the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically add &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingMethod&quot; value=&quot;&quot;&amp;gt;&lt;/code&gt; to your form &amp;amp; it &lt;em&gt;should&lt;/em&gt; work.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2016-12-21T04:19:06.757" LastActivityDate="2016-12-21T04:19:06.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18227" PostTypeId="1" AcceptedAnswerId="18228" CreationDate="2016-12-21T08:26:22.133" Score="3" ViewCount="448" Body="&lt;p&gt;I need to split up a navigaton tree. So I try to exclude certain pages from a structure based navigation tree PLUS their children automatically, but don’t seem to get it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in craft.entries.section('pages').id('and,not 3,not 4,not 5') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Excluding certain entries like this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in craft.entries.section('pages').descendantOf('and,not 3,not 4,not 5') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;… doesn’t return anything of course, because descendantOf needs one exact ID. But how could I manage to exclude entries 3, 4 and 5 AND all their children from the navigation without calling the exact IDs of all the children?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6034" LastActivityDate="2016-12-21T10:18:50.953" Title="Exclude certain entries and its children from navigation" Tags="&lt;entries&gt;&lt;navigation&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18228" PostTypeId="2" ParentId="18227" CreationDate="2016-12-21T10:18:50.953" Score="3" Body="&lt;p&gt;If it’s true that the &lt;code&gt;descendantOf&lt;/code&gt; param doesn’t allow to pass in multiple entries, you probably need to work around that issue and grab the descendants for each parent entry individually.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parentIds = [3, 4, 5] %}&#xA;{% set excludeIds = parentIds %}&#xA;&#xA;{% for parentId in parentIds %}&#xA;    {% set ids = craft.entries.descendantOf(parentId).ids() %}&#xA;    {% set excludeIds = excludeIds|merge(ids) %}&#xA;{% endfor %}&#xA;&#xA;{% set idParam = 'and, not ' ~ excludeIds|join(', not ') %}&#xA;&#xA;{% set entries = craft.entries.section('pages').id(idParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-21T10:18:50.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18229" PostTypeId="1" AcceptedAnswerId="18238" CreationDate="2016-12-21T11:15:57.340" Score="1" ViewCount="1281" Body="&lt;p&gt;I've got an issue that following a server rebuild, I was prompted to update Craft, which I did by moving a brand new craft/app folder into place - then setting relevant permissions. I then tried to browse to the management once again, to be greeted by the 'finish up' button and the fact that Craft had to make a couple of changes to the database to finish the update. This is where I am encountering an error message of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft was unable to install this update :(&#xA;The site has been restored to the state it was in before the attempted update.&#xA;There was a problem updating your database.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My database credentials are correct, and I have had this issue on 2 servers now with different builds (different ubuntu version, php, apache &amp;amp; sql). Could anybody tell me if they have seen this before and how to diagnose this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ubuntu 16.04.1&#xA;PHP7.0&#xA;Mysql 5.7&#xA;Apache 2.4.18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft log of the incident:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/12/21 10:35:49 [info] [application] [Forced] Preparing to update craft.&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Finished preparing to update craft.&#xA;&#xA;******************************************************************************************************&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Finished backing up database.&#xA;&#xA;******************************************************************************************************&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Starting to update the database.&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Craft wants to update the database.&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Running migrations...&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Total 23 new migrations to be applied for Craft:&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m141030_000000_plugin_schema_versions&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m150724_000001_adjust_quality_settings&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m150827_000000_element_index_settings&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m150918_000001_add_colspan_to_widgets&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151007_000000_clear_asset_caches&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151109_000000_text_url_formats&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151110_000000_move_logo&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151117_000000_adjust_image_widthheight&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_clear_license_key_status&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_plugin_license_keys&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m151130_000000_update_pt_widget_feeds&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160114_000000_asset_sources_public_url_default_true&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160223_000000_sortorder_to_smallint&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160229_000000_set_default_entry_statuses&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160304_000000_client_permissions&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160322_000000_asset_filesize&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160503_000000_orphaned_fieldlayouts&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160510_000000_tasksettings&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160829_000000_pending_user_content_cleanup&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160830_000000_asset_index_uri_increase&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m160919_000000_usergroup_handle_title_unique&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m161108_000000_new_version_format&#xA;2016/12/21 10:35:49 [info] [application] [Forced] m161109_000000_index_shuffle&#xA;2016/12/21 10:35:49 [info] [application] [Forced] Applying migration: m141030_000000_plugin_schema_versions&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m141030_000000_plugin_schema_versions (time: 0.121s)&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150724_000001_adjust_quality_settings&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Adjusting Asset transform quality settings&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Done adjusting Asset transform quality settings&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m150724_000001_adjust_quality_settings (time: 0.005s)&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150827_000000_element_index_settings&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Creating the elementindexsettings table&#xA;2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsett$&#xA;        `id` int(11) NOT NULL AUTO_INCREMENT,&#xA;        `type` VARCHAR(150) NOT NULL,&#xA;        `settings` text NULL,&#xA;        `dateCreated` datetime NOT NULL,&#xA;        `dateUpdated` datetime NOT NULL,&#xA;        `uid` CHAR(36) NOT NULL DEFAULT 0,&#xA;        PRIMARY KEY (id)&#xA;) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.&#xA;2016/12/21 10:35:50 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_element$&#xA;2016/12/21 10:35:50 [error] [application] #0 /var/www/craft/app/framework/db/CDbCommand.php(1352): CDbCommand-&amp;gt;execute()&#xA;#1 /var/www/craft/app/etc/db/DbCommand.php(507): CDbCommand-&amp;gt;createTable('Ui28t_elementin...', Array, NULL)&#xA;#2 /var/www/craft/app/migrations/m150827_000000_element_index_settings.php(21): Craft\DbCommand-&amp;gt;createTable('Ui28t_elementin...', Array, NULL, true)&#xA;#3 /var/www/craft/app/etc/db/BaseMigration.php(33): Craft\m150827_000000_element_index_settings-&amp;gt;safeUp()&#xA;#4 /var/www/craft/app/services/MigrationsService.php(149): Craft\BaseMigration-&amp;gt;up()&#xA;#5 /var/www/craft/app/services/MigrationsService.php(91): Craft\MigrationsService-&amp;gt;migrateUp('m150827_000000_...', NULL)&#xA;#6 /var/www/craft/app/etc/updates/Updater.php(180): Craft\MigrationsService-&amp;gt;runToTop(NULL)&#xA;#7 /var/www/craft/app/services/UpdatesService.php(724): Craft\Updater-&amp;gt;updateDatabase()&#xA;#8 /var/www/craft/app/controllers/UpdateController.php(405): Craft\UpdatesService-&amp;gt;updateDatabase('craft')&#xA;#9 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController-&amp;gt;actionUpdateDatabase()&#xA;#10 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#11 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#12 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#13 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('updateDatabase')&#xA;#14 /var/www/craft/app/etc/web/WebApp.php(931): CWebApplication-&amp;gt;runController('update/updateDa...')&#xA;#15 /var/www/craft/app/etc/web/WebApp.php(241): Craft\WebApp-&amp;gt;_processUpdateLogic()&#xA;#16 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#17 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#18 /var/www/public_html/index.php(19): require_once('/var/www/craft/...')&#xA;#19 {main}&#xA;2016/12/21 10:35:50 [error] [application] Failed to apply migration: m150827_000000_element_index_settings (time: 0.001s)&#xA;2016/12/21 10:35:50 [error] [application] Migration failed for Craft. All later Craft migrations are canceled.&#xA;&#xA;******************************************************************************************************&#xA;2016/12/21 10:35:50 [info] [application] [Forced] Rolling back any database changes.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance guys! Let me know if you need any more info.&lt;/p&gt;&#xA;" OwnerUserId="5989" LastActivityDate="2016-12-30T18:31:06.720" Title="Craft cannot finalise update - There was a problem updating your database" Tags="&lt;database&gt;&lt;auto-updates&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18230" PostTypeId="1" AcceptedAnswerId="18237" CreationDate="2016-12-21T12:29:34.933" Score="4" ViewCount="653" Body="&lt;p&gt;I have a fairly large site with the main content on most pages driven by a Matrix field. That Matrix field has 15 or so different Blocks - we are now doing a tidy up on the site and going to try and reduce the number of blocks available - is there any way to tell if a block isn't being used?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2019-09-03T19:41:10.807" Title="Is it possible to find what Matrix Block aren't being used" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18233" PostTypeId="2" ParentId="17945" CreationDate="2016-12-21T14:24:06.017" Score="5" Body="&lt;p&gt;After some mail exchanges with Brad and Andris from Craft CMS, it turned out that there is an edge case where the image rotation on upload will not work if the EXIF extension is not installed (which was our case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two solutions to fix this problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install EXIF extension&lt;/li&gt;&#xA;&lt;li&gt;Install and use Imagick instead of GD.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As Imagick is the recommended image extension for Craft, we ended up installing Imagick on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is already working with Imagick on Craft 3, and will soon be working on Craft 2 with the next update (&gt; v2.6.2954).&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2016-12-21T14:24:06.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18234" PostTypeId="1" AcceptedAnswerId="18278" CreationDate="2016-12-21T16:36:59.327" Score="1" ViewCount="410" Body="&lt;p&gt;this is my first Craft CMS &amp;amp; Commerce build and I need some help with searching products by a tag field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a tag field (&quot;designTag&quot;) for each product and I would like to have a search bar that will only query the tag field for a specific product type (&quot;designMedia&quot;) and return those products with matching or similar tag titles and also account for pagination. I can't seem to get it to work. Any help would be appreciated.&#xA;&lt;br&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SEARCH FORM CODE:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('design/keywords') }}&quot;&amp;gt;&#xA;    &amp;lt;label&amp;gt;Search By Keywords&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;append-icon&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; class=&quot;form-control input-lg&quot; placeholder=&quot;Enter Keyword...&quot;&amp;gt;&#xA;        &amp;lt;button class=&quot;btn&quot; type=&quot;submit&quot;&amp;gt;&amp;lt;i class=&quot;nc-icon-outline ui-1_zoom&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RESULTS CODE:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagTitle = craft.request.getParam('q') %}&#xA;{% set tag = craft.tags.title(tagTitle) %}    &#xA;{% set product = craft.commerce.products.search(query).order('score') %}&#xA;&#xA;{% if product|length %}&#xA;&#xA;{% paginate craft.commerce.products.type('designMedia').limit(48) as mediaProducts %}&#xA;&#xA;{% for product in mediaProducts %}    &#xA;       &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;item-wrapper&quot;&amp;gt;&#xA;            &amp;lt;figure class=&quot;he-3 cyan&quot;&amp;gt;&#xA;              &amp;lt;img src=&quot;{{ product.presentationSlides.first().getUrl('mediaDetail') }}&quot; alt=&quot;{{ product.name }}&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;hover-icons&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;hover-icons-wrapper&quot;&amp;gt;&#xA;                  &amp;lt;a href=&quot;{{ product.presentationSlides.first().getUrl('mediaLightbox') }}&quot; class=&quot;magnific hidden-xs-down&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;nc-icon-outline ui-1_zoom&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                  &amp;lt;/a&amp;gt;&#xA;                  &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;nc-icon-outline ui-2_link-71&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                  &amp;lt;/a&amp;gt;&#xA;                  &amp;lt;a href=&quot;#&quot; class=&quot;hidden-xs-down&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;nc-icon-outline ui-2_favourite-28&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                  &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;              &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/figure&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No Results&amp;lt;/p&amp;gt;  &#xA;{% endif %}&#xA;&#xA;/*pagination code */&#xA;{% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5787" LastEditorUserId="22" LastEditDate="2017-05-09T20:39:59.090" LastActivityDate="2017-05-09T20:39:59.090" Title="Search Commerce Products by Tags" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18236" PostTypeId="1" CreationDate="2016-12-21T16:46:04.303" Score="0" ViewCount="98" Body="&lt;p&gt;When I add an image via a rich text (doing as port of a flexi layout approach) somehow an alt tag gets auto output, e.g:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alt=&quot;sketch2.jpg#asset:308&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wondered if there is a way to over ride or edit the HTML via the rich text field for the auto generated alt tag?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2016-12-21T22:50:31.097" Title="Over ride auto-generated alt tag on image added via Rich Text field" Tags="&lt;richtext&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18237" PostTypeId="2" ParentId="18230" CreationDate="2016-12-21T17:35:25.690" Score="5" Body="&lt;p&gt;Nothing native, but it can easily be done with an SQL query – something like this should work (note that all the queries assume that your &lt;a href=&quot;https://docs.craftcms.com/v3/config/db-settings.html#tableprefix&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;dbPrefix&lt;/code&gt;&lt;/a&gt; setting is set to &lt;code&gt;'craft_'&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT bt.id, bt.handle, f.handle as field &#xA;FROM craft_matrixblocktypes bt &#xA;INNER JOIN craft_fields f ON bt.fieldId = f.id &#xA;LEFT JOIN craft_matrixblocks b ON bt.id = b.typeId &#xA;WHERE b.id IS NULL &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above query would output a table with the &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;handle&lt;/code&gt; for all block types that aren't used, in addition to the handle for the Matrix field they belong to, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id  | handle             | field&#xA;------------------------------------------&#xA;13  | someMatrixBlock    | someMatrixField&#xA;4   | anotherMatrixBlock | someMatrixField&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To actually execute the SQL query, you can use a free tool like &lt;a href=&quot;https://www.sequelpro.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sequel Pro&lt;/a&gt; or &lt;a href=&quot;https://www.phpmyadmin.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;phpMyAdmin&lt;/a&gt; – or &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;write a custom plugin&lt;/a&gt; that uses &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow noreferrer&quot;&gt;the QueryBuilder&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon request in the comments below, here's a query that will list all block types that &lt;em&gt;are&lt;/em&gt; in use (i.e. there are blocks for each particular block type). The number of blocks for each type is listed in a &lt;code&gt;count&lt;/code&gt; column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT COUNT(bt.id) as count, bt.id, bt.handle, f.handle as field &#xA;FROM craft_matrixblocktypes bt &#xA;INNER JOIN craft_fields f ON bt.fieldId = f.id &#xA;LEFT JOIN craft_matrixblocks b ON bt.id = b.typeId &#xA;WHERE b.id IS NOT NULL &#xA;GROUP BY bt.id    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and here's a query that will output a table with all blocks, sorted by block type, with the ID and URI for the entry which &quot;owns&quot; each particular block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT b.id as blockId, bt.handle as blockType, bt.id as blockTypeId, e.id as entryId, i18n.uri as entryUri, f.handle as field&#xA;FROM craft_matrixblocks b&#xA;INNER JOIN craft_entries e on e.id = b.ownerId&#xA;INNER JOIN craft_fields f on f.id = b.fieldId&#xA;INNER JOIN craft_matrixblocktypes bt on bt.id = b.typeId&#xA;LEFT JOIN craft_elements_i18n i18n on i18n.elementId = e.id&#xA;ORDER BY bt.id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for Craft 3, you'll need to replace the &lt;code&gt;craft_elements_i18n&lt;/code&gt; table with &lt;code&gt;craft_elements_sites&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT b.id as blockId, bt.handle as blockType, bt.id as blockTypeId, e.id as entryId, sites.uri as entryUri, f.handle as field&#xA;FROM craft_matrixblocks b&#xA;INNER JOIN craft_entries e on e.id = b.ownerId&#xA;INNER JOIN craft_fields f on f.id = b.fieldId&#xA;INNER JOIN craft_matrixblocktypes bt on bt.id = b.typeId&#xA;LEFT JOIN craft_elements_sites sites on sites.elementId = e.id&#xA;ORDER BY bt.id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to limit that last query to only list the blocks for a particular block type, you can replace the &lt;code&gt;ORDER BY&lt;/code&gt; statement with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WHERE bt.id = 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;2&lt;/code&gt; is the ID for the block type you want to list, obviously.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2019-09-03T19:41:10.807" LastActivityDate="2019-09-03T19:41:10.807" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="18238" PostTypeId="2" ParentId="18229" CreationDate="2016-12-21T19:00:58.320" Score="1" Body="&lt;p&gt;Here's the key part from the logs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsettings'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;elementindexsettings&lt;/code&gt; table was introduced in Craft 2.5.  The fact that is already exists during this update indicates that you've already got some 2.5 database schema changes already in place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely this occurred from a previous 2.5 update attempt that failed (for whatever reason) and the database wasn't restored from a pre-2.5 update attempt backup before another update was applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Restore the database from a pre-update attempt database backup and try the update again.  If it fails that time, you can look in the log files to get the initial error that occurred.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-21T19:00:58.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18239" PostTypeId="1" AcceptedAnswerId="18250" CreationDate="2016-12-21T20:07:10.393" Score="2" ViewCount="807" Body="&lt;p&gt;I've got a project where I'm trying to set up a basic page layout – header, body, footer. But I also want the option for a user to add an image or bit of content (let's call it a &quot;sidebar&quot;) that splits the body section into two columns – one for body copy on the left and one for the new content on the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this, I'm using a Matrix field (for the user to create sidebar content on the fly) and Bootstrap (for the grid). When sidebar content is created for the entry, I'm hoping to be able to add a &quot;col-sm-8&quot; class to the body wrapper, as well as add a div with the &quot;col-sm-4&quot; class for the sidebar column for it to reside in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have experience with creating static layouts in Bootstrap, but I'm woefully inexperienced at dealing with anything related to coding logic that isn't an if/else statement, and I can't seem to work out the code for Matrix in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also need to be able to add different kinds of content (or blocks) in the sidebar, so the logic should also need to check for whether one or more kinds of blocks are populating, but still apply the same effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone provide an example of how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/udvTw.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/udvTw.jpg&quot; alt=&quot;Logic Example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;edit:&lt;/em&gt; BTW, I &lt;em&gt;have&lt;/em&gt; read the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation on templating Matrix fields&lt;/a&gt;. I just don't know how to check for multiple block types in order to print a class name &amp;amp; create a new column.&lt;/p&gt;&#xA;" OwnerUserId="6038" LastEditorUserId="6038" LastEditDate="2016-12-21T21:00:45.273" LastActivityDate="2016-12-22T12:34:17.733" Title="Basic Bootstrap + Matrix Implementation" Tags="&lt;matrix&gt;&lt;bootstrap-craft&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18240" PostTypeId="2" ParentId="18160" CreationDate="2016-12-21T20:09:55.853" Score="1" Body="&lt;p&gt;You can just add the &lt;a href=&quot;https://solspace.com/craft/freeform/docs/freeform.form/#param-action&quot; rel=&quot;nofollow noreferrer&quot;&gt;action&lt;/a&gt; override:&#xA;&lt;code&gt;action: &quot;#errortag&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your template code would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;proefles&quot;, {&#xA;    instructionsBelowField: true,&#xA;    action: &quot;#errortag&quot;&#xA;}).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-12-21T20:09:55.853" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18241" PostTypeId="2" ParentId="18236" CreationDate="2016-12-21T22:20:16.477" Score="1" Body="&lt;p&gt;Assuming you've got the &lt;code&gt;&quot;source&quot;&lt;/code&gt; plugin defined in your &lt;code&gt;craft/config/redactor/myconfig.json&lt;/code&gt; Redactor config for that Rich Text field's settings, you can click on the &quot;HTML&quot; button and edit the alt tag manually to whatever you wish. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-21T22:20:16.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18242" PostTypeId="2" ParentId="18236" CreationDate="2016-12-21T22:50:31.097" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon plugin&lt;/a&gt; works great for DOM manipulation. You can override the attribute with a default value or remove it completely.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconAttr('img', {'alt': entry.title}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|retconAttr('img', {'alt': false}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-21T22:50:31.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18243" PostTypeId="1" AcceptedAnswerId="18245" CreationDate="2016-12-22T02:41:55.663" Score="0" ViewCount="616" Body="&lt;p&gt;I'm tried to following the how-to implement tags but can't see to get it to work.&#xA;The how-to: &lt;a href=&quot;https://craftcms.com/support/tag-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/tag-urls&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a new route, and in the URI field, I entered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tags/( ‘tag’ token )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the template field I entered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tags/_tag&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a folder in my template folder called tags and placed the template html file called:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_tags.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;_tags.html contains the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;    {% set tag = craft.tags.title(tag).first() %}&#xA;&#xA;    &amp;lt;h1&amp;gt;Entries tagged with &quot;{{ tag.title }}&quot;&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set entries = craft.entries.relatedTo(tag).order('title') %}&#xA;&#xA;{% if entries | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No entries could be found with that tag.&amp;lt;/p&amp;gt;&#xA;{% endif %} &#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my entry template, at the bottom, I have this snippet to list all related tags and to hyperlink those tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.tags | length %}&#xA;    &amp;lt;h4&amp;gt;Tags&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for tag in entry.tags %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot; title=&quot;{{ tag.title }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An example of my entry is located below. It correctly shows the tag called 'Platformer'&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/games/donkey-king&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games/donkey-king&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL, looks good.&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/tags/Platformer&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/tags/Platformer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I go to the url, I get a 404&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-22T05:40:01.493" Title="Confused about tags" Tags="&lt;templating&gt;&lt;routes&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18245" PostTypeId="2" ParentId="18243" CreationDate="2016-12-22T02:45:28.797" Score="5" Body="&lt;p&gt;You told Craft to look for &lt;code&gt;tags/_tag&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then you created &lt;code&gt;templates/tags/_tags.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note you have no &lt;code&gt;s&lt;/code&gt; on the end in the route definition, but you do in the template name.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2016-12-22T05:40:01.493" LastActivityDate="2016-12-22T05:40:01.493" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18246" PostTypeId="2" ParentId="18234" CreationDate="2016-12-22T02:57:22.883" Score="2" Body="&lt;p&gt;This should work (set the limit to whatever you want/need):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.title(tagTitle).first() %}    &#xA;&#xA;{% paginate craft.commerce.products.relatedTo(tag).limit(10) as pageInfo, products %}&#xA;&#xA;    {% for product in products %}&#xA;&#xA;        {{ product.title }} etc&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more on the pagination side of things, see: &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/paginate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-22T02:57:22.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18247" PostTypeId="2" ParentId="4205" CreationDate="2016-12-22T07:24:04.090" Score="1" Body="&lt;p&gt;As Brandon mentioned in 2014, this is a good case for &lt;em&gt;Matrix-within-a-Matrix&lt;/em&gt;. Until that functionality gets added into core, the following two plugins are your best bet:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Neo plugin&lt;/strong&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-neo&lt;/a&gt;&lt;br&gt;&#xA;Provides the ability to place &lt;em&gt;existing Craft fields&lt;/em&gt; inside a matrix, group fields into tabs, and also nest blocks as &quot;children&quot; of other blocks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Super Table plugin&lt;/strong&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;br&gt;&#xA;Allows you to create repeatable fields that include almost any field type, including matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This wiki page from the Neo repository also lists a few videos and other resources which delve into this topic:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/benjamminf/craft-neo/wiki/6.-Resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-neo/wiki/6.-Resources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Taken from my previous answer at &lt;a href=&quot;https://craftcms.stackexchange.com/a/16203/5437&quot;&gt;https://craftcms.stackexchange.com/a/16203/5437&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2016-12-22T07:24:04.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18248" PostTypeId="1" CreationDate="2016-12-22T09:24:06.797" Score="1" ViewCount="112" Body="&lt;p&gt;So, I've created a plugin which has to send dynamic data to an entry in the control panel, using a custom field type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get an error in the ajax call, saying that the URL to which I'm posting is not found. I've debugged this and the URL generated is the right one, I've tried posting to it from other places and it works just fine&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The custom field&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($name, $value)&#xA;{&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;includeJsResource('baseinstagram/js/pullajax.js');&#xA;&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('baseinstagram/input/choosetag', array(&#xA;        'name'  =&amp;gt; $name,&#xA;        'value' =&amp;gt; $value&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The ajax call&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function () {&#xA;&#xA;var url = Craft.getActionUrl('baseinstagram/main/testy');&#xA;&#xA;$('.pullme').click(function () {&#xA;    $.ajax({&#xA;        method : 'POST',&#xA;        url : url,&#xA;        success : function () {&#xA;            console.log('ok');&#xA;        },&#xA;        error : function() {&#xA;            console.log('nope');&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;});&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;the controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionTesty() {&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $this-&amp;gt;returnJson('heyeyeye');&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6015" LastActivityDate="2016-12-22T10:17:30.147" Title="Loading data in Ajax in an entry" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18249" PostTypeId="2" ParentId="18248" CreationDate="2016-12-22T10:17:30.147" Score="2" Body="&lt;p&gt;Fixed it, it was just a matter of proper capitalization&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = Craft.getActionUrl('baseinstagram/main/testy');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should have been &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = Craft.getActionUrl('Baseinstagram/Main/Testy');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6015" LastActivityDate="2016-12-22T10:17:30.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18250" PostTypeId="2" ParentId="18239" CreationDate="2016-12-22T11:35:56.410" Score="2" Body="&lt;p&gt;It looks like you can check for the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#getting-the-total-number-of-blocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;total number of blocks within a matrix block&lt;/a&gt;. So if you check that the length is greater than 0, you could then apply the classes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myMatrixField|length &amp;gt; 0 %}&#xA;    &amp;lt;div class=&quot;col-sm-4&quot;&amp;gt;&#xA;        // other code&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4168" LastActivityDate="2016-12-22T11:35:56.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18251" PostTypeId="2" ParentId="18239" CreationDate="2016-12-22T12:34:17.733" Score="3" Body="&lt;p&gt;Why not use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.sidebar|length %}&#xA;    &amp;lt;div class=&quot;col-sm-8&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way the column will automatically be smaller IF the side bar exists.&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-12-22T12:34:17.733" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18252" PostTypeId="1" CreationDate="2016-12-22T14:23:15.347" Score="1" ViewCount="587" Body="&lt;p&gt;When looping through all events in Twig, repeated events will continuously come in. On a weekly event, for instance, it pulls one for this week, one for next week, etc. Lets say I have a meeting event set to repeat weekly, it would come back like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.calendar.events %} ...&#xA;&#xA;Meeting Event&#xA;Meeting Event&#xA;Meeting Event&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm looking to load events asynchronously with the Element API plugin but I'm only able to get back each event once (even the repeated ones). How do I achieve the same behavior? Here is the basic setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'api/events.json' =&amp;gt; function() {&#xA;      return [&#xA;        'elementType' =&amp;gt; 'Calendar_Event'&#xA;      ];&#xA;    }&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it only returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Meeting Event&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4115" LastEditorUserId="4115" LastEditDate="2016-12-22T18:28:59.740" LastActivityDate="2016-12-23T18:50:08.147" Title="Get repeated events with the Solspace Calendar and Element API plugins" Tags="&lt;plugin-elementapi&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18253" PostTypeId="1" CreationDate="2016-12-22T15:20:32.807" Score="1" ViewCount="94" Body="&lt;p&gt;Not sure how to do this. I'm setting up a multi-lingual site with a couple of locales and I have 3 different environments set up. I've set up some &lt;code&gt;environmentVariables&lt;/code&gt; for assets store and assets path these work fine in the templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However how do you deal with background images in the CSS file? Can you include the Twig code? i.e. add &lt;code&gt;{{ craft.config.environmentVariables.sitePath }}&lt;/code&gt; to the image path I'm assuming not as CSS uses the curly braces. I know I can add the full URL to the image but this is no good when trying to work within different environments where the overall domain path will be different each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone come across this problem and have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2016-12-22T19:50:52.213" LastActivityDate="2016-12-22T21:09:31.210" Title="How to set multi-lingual image paths in a css file for different environments?" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18254" PostTypeId="1" AcceptedAnswerId="18258" CreationDate="2016-12-22T15:20:42.320" Score="3" ViewCount="75" Body="&lt;p&gt;So I'm running into an issue where I'm given the users email. From there, I use the following code: &lt;code&gt;Craft::$app-&amp;gt;getUsers()-&amp;gt;getUserByEmail($email);&lt;/code&gt;. This returns a null value, not because the user does not exists, but rather the status is set to suspended. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to retrieve the &lt;code&gt;User&lt;/code&gt; model from the email address, regardless of status? &lt;/p&gt;&#xA;" OwnerUserId="6041" LastEditorUserId="340" LastEditDate="2016-12-22T23:23:32.970" LastActivityDate="2016-12-22T23:23:32.970" Title="Obtain suspended users in Craft3 Dev Preview" Tags="&lt;users&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18255" PostTypeId="1" CreationDate="2016-12-22T16:58:22.937" Score="0" ViewCount="49" Body="&lt;p&gt;I'm not sure what I've done, I had this working at the top of my entry.html template:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('ourWork').relatedTo(category) %}&#xA;&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason I just get:&#xA;Variable &quot;category&quot; does not exist&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section name is correct and this does have a category field assigned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my index template category part is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Projects&#xA;---------------------------------------------------------------------------#}&#xA;&amp;lt;div class=&quot;banner projects&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;        &#xA;  &amp;lt;ul class=&quot;no-bullet small-up-2 medium-up-3 large-up-4 large-centered&quot;&amp;gt; &#xA;  {#&#xA;  Display catgeory nav 'ourWork'&#xA;  #}&#xA;    {% nav category in craft.categories.group('ourWork').level(1) %}         &#xA;      &amp;lt;li class= &quot;column&quot;&amp;gt;                        &#xA;          {# &amp;lt;p&amp;gt;{{ category.WorkCategoryDescription }}&amp;lt;p&amp;gt; #}                 &#xA;          &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ category.categoryImageThumb.first.getUrl('categoryThumbnail') }}&quot;&amp;gt;&amp;lt;/a&amp;gt;             &#xA;          &amp;lt;p&amp;gt; &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }} &amp;lt;/a&amp;gt;&amp;lt;p&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="5654" LastEditDate="2016-12-22T17:25:09.120" LastActivityDate="2016-12-23T18:24:49.683" Title="Previous and next entries nav – within a categeory" Tags="&lt;category&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18256" PostTypeId="1" CreationDate="2016-12-22T18:04:18.490" Score="1" ViewCount="153" Body="&lt;p&gt;So I've actually created a fix for this, but it's a bit complicated. Wanted to share in case anyone else runs into this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working in Craft 2.6.2954 and Charge Pro 2.18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating new subscriptions, the emails were not being sent properly. I checked the charge logs in the charge plugin and it was giving me an error of &quot;Failed to find email with the handle : Welcome Email&quot;. I figured out that &quot;Welcome Email&quot; was the correct name of my email, but it wasn't the handle, which is why it wasn't being found. I created a new function in the Charge_EmailService.php file called _getEmailModelByName, you can see it here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _getEmailModelByName($handle = null)&#xA;{&#xA;    if ($handle) {&#xA;        $emailRecord = Charge_EmailRecord::model()-&amp;gt;findByAttributes(&#xA;            ['name' =&amp;gt; $handle]);&#xA;&#xA;        if (!$emailRecord) {&#xA;            return false;&#xA;        }&#xA;&#xA;        $model = Charge_EmailModel::populateModel($emailRecord);&#xA;&#xA;        return $model;&#xA;    }&#xA;&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then updated the sendByHandle function to do a few checks on the handle and try to find the email a different way. Here's the new sendByEmail function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sendByHandle($handle, ChargeModel $chargeModel, $extra = [])&#xA;{&#xA;&#xA;    if(is_int($handle)){&#xA;        $emailModel = $this-&amp;gt;_getEmailModelById($handle);&#xA;    } else {&#xA;        $emailModel = $this-&amp;gt;_getEmailModelByHandle($handle);&#xA;    }&#xA;&#xA;    if($emailModel == false) {&#xA;        $emailModel = $this-&amp;gt;_getEmailModelByName($handle);&#xA;    }&#xA;&#xA;&#xA;    if($emailModel == false) {&#xA;        craft()-&amp;gt;charge_log-&amp;gt;error('Failed to find email with the handle : '.$handle, ['extra' =&amp;gt; $extra, 'charge' =&amp;gt; $chargeModel]);&#xA;        return false;&#xA;    }&#xA;&#xA;    $data['charge'] = $chargeModel;&#xA;    foreach($extra as $key =&amp;gt; $arr) {&#xA;        $data[$key] = $arr;&#xA;    }&#xA;&#xA;    $emailModel-&amp;gt;send($data);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks like this is now working as it should. Hope it saves someone else some frustration.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastActivityDate="2017-04-10T08:46:41.407" Title="Charge Pro not sending Subscription Emails" Tags="&lt;plugin-charge&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18257" PostTypeId="2" ParentId="18252" CreationDate="2016-12-22T18:10:35.233" Score="0" Body="&lt;p&gt;Looks like you've got the &lt;a href=&quot;https://github.com/theolampert/ElementAPI#setup&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API syntax&lt;/a&gt; wrong.  Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/events.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Calendar_Event',&#xA;            'transformer' =&amp;gt; function(Calendar_EventModel $event) {&#xA;                return [&#xA;                    'title' =&amp;gt; $event-&amp;gt;title,&#xA;                ];&#xA;            },&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I don't have the Calendar plugin, so I can't test this, and I'm guessing that their event model class is called &lt;code&gt;Calendar_EventModel&lt;/code&gt;, so you'll want to verify that.  You can return any of the properties they have listed here: &lt;a href=&quot;https://solspace.com/craft/calendar/docs/event/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/docs/event/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-22T18:10:35.233" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18258" PostTypeId="2" ParentId="18254" CreationDate="2016-12-22T18:15:01.537" Score="2" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = User::find()&#xA;    -&amp;gt;email($email)&#xA;    -&amp;gt;status(null)&#xA;    -&amp;gt;one();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-22T18:15:01.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18259" PostTypeId="1" AcceptedAnswerId="18260" CreationDate="2016-12-22T18:22:10.230" Score="3" ViewCount="57" Body="&lt;p&gt;Here is an example of code I'm trying to use to eliminating have to iterate comparing the current &lt;code&gt;entry.title&lt;/code&gt; to the related to entry.title then omitting it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(context).limit(MAX_FILLERS).id('not' ~ entry.id) %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(context).limit(MAX_FILLERS)|without(entry.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Current code I'm trying to get around with a single relatedTo call.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesUnfiltered = craft.entries.relatedTo(context).limit(MAX_FILLERS).search('-title:'+entry.title) %}&#xA;&#xA;{% set entries = [] %}&#xA;&#xA;{# Removing self entries #}&#xA;{% for e in entriesUnfiltered%}&#xA;    {% if e.title not in entry %}&#xA;        {% set entries = entries|merge([e]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6041" LastEditorUserId="57" LastEditDate="2016-12-22T18:28:32.013" LastActivityDate="2016-12-22T18:34:57.903" Title="Can someone explain to me the difference between 'not' and without?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18260" PostTypeId="2" ParentId="18259" CreationDate="2016-12-22T18:34:57.903" Score="2" Body="&lt;p&gt;Your first example (&lt;code&gt;.id('not' ~ entry.id)&lt;/code&gt;) will exclude that entry ID from the results on in the actual database query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second example will grab all of the entries that satisfy the criteria, then from the PHP/Twig side, then use the &lt;code&gt;|without&lt;/code&gt; filter to loop through the array results and remove the ones that match the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty sure your 2nd one won't work as you're expecting though, since you're telling it to remove an &lt;code&gt;entry.id&lt;/code&gt;, which is an integer, but the results are an array of Entry elements. It &lt;em&gt;might&lt;/em&gt; work just using &lt;code&gt;entry&lt;/code&gt; instead, but I'm guessing the &lt;code&gt;|without&lt;/code&gt; filter isn't smart enough to work on entire objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short, use the 1st example.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-22T18:34:57.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18262" PostTypeId="2" ParentId="18253" CreationDate="2016-12-22T21:09:31.210" Score="1" Body="&lt;p&gt;The easiest option is probably to use inline styles in your markup for the relevant element(s):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sitePath = craft.config.environmentVariables.sitePath %}&#xA;&#xA;&amp;lt;div class=&quot;foo&quot; style=&quot;background-image:url('{{ sitePath }}/assets/bg.jpg');&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ sitePath }}/assets/logo.png&quot; alt=&quot;&quot; /&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-22T21:09:31.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18263" PostTypeId="1" AcceptedAnswerId="18269" CreationDate="2016-12-23T00:37:03.330" Score="1" ViewCount="58" Body="&lt;p&gt;Need a hand on a conditional to see if my table has any data, and if it does, output the table. The second thing I  need help is the code to output the table. When I look at tutorials, they always seem to output the table as an HTML list. Like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% if block.codePoints | length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for row in block.codePoints %}&#xA;         {# Assuming 'text' is the column handle of the text field #}&#xA;        &amp;lt;li&amp;gt;{{ row.text }}&amp;lt;/li&amp;gt; &#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find an example of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-23T15:50:24.070" Title="Conditionals and outputting tables" Tags="&lt;entry&gt;&lt;conditional&gt;&lt;table&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18264" PostTypeId="2" ParentId="6635" CreationDate="2016-12-23T06:15:02.763" Score="0" Body="&lt;p&gt;I had the same issue and after struggling for hours I found out that I had to stop MySQL server from running in System Preferences. After that the insallation was successful &lt;/p&gt;&#xA;" OwnerUserId="6044" LastActivityDate="2016-12-23T06:15:02.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18265" PostTypeId="2" ParentId="1279" CreationDate="2016-12-23T06:17:14.540" Score="-2" Body="&lt;p&gt;Turn off your MySQL server in System Preferences, that worked for me.   &lt;/p&gt;&#xA;" OwnerUserId="6044" LastActivityDate="2016-12-23T06:17:14.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18266" PostTypeId="2" ParentId="18255" CreationDate="2016-12-23T08:10:38.663" Score="1" Body="&lt;p&gt;When you are within your &lt;code&gt;nav&lt;/code&gt; tag context, &lt;code&gt;category&lt;/code&gt; definitely exists, even if you're using &lt;code&gt;include&lt;/code&gt; for the first snippet you posted. If you're talking about the automatically pre-assigned variable for a single category's page, make sure the category group settings are still correct and that you are requesting the right URLs.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2016-12-23T08:10:38.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18267" PostTypeId="2" ParentId="18255" CreationDate="2016-12-23T08:57:52.427" Score="1" Body="&lt;p&gt;I was missing: &lt;code&gt;{% set category = entry.workCategory%}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="57" LastEditDate="2016-12-23T18:24:49.683" LastActivityDate="2016-12-23T18:24:49.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18268" PostTypeId="1" AcceptedAnswerId="18273" CreationDate="2016-12-23T13:22:50.370" Score="1" ViewCount="150" Body="&lt;p&gt;I'm creating a product page for a product with multiple variants. In this case the variant represents a different size (with unique SKU, stock, etc..).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's laid out like so (don't mind the ugly styling):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FEJZI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FEJZI.png&quot; alt=&quot;product box&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to pre-select a size option because I want to avoid people adding the wrong product to their cart. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template there's a hidden field with the &lt;code&gt;purchasableId&lt;/code&gt; of the variant. The value attribute starts empty and when people click one of the options it is set to the corresponding id.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when people click 'Add to cart' right away, without selecting a size the following Craft\Exception is shown:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Not a purchasable ID&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I customize this error message to notify the customer that they have to select a size option?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could of course solve this problem by using javascript but that doesn't seem very solid to me. So is there a way of validating the stuff added to the cart in the back-end and getting something like a JSON response?&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2016-12-24T00:36:55.913" Title="Back-end validation of product variant" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18269" PostTypeId="2" ParentId="18263" CreationDate="2016-12-23T15:50:24.070" Score="2" Body="&lt;p&gt;Assuming your example code, something along these lines will help...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.yourTable | length %}&#xA;    &amp;lt;table&amp;gt;&#xA;    {% for row in entry.yourTable %}&#xA;    &amp;lt;tr&amp;gt;&#xA;       &amp;lt;td&amp;gt;{{ row.column1 }}&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;{{ row.column2 }}&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;{{ row.column3 }}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt; &#xA;    {% endfor %}&#xA;    &amp;lt;/table&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant section in the docs: &lt;a href=&quot;https://craftcms.com/docs/table-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;Table fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2016-12-23T15:50:24.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18270" PostTypeId="2" ParentId="18252" CreationDate="2016-12-23T16:31:45.763" Score="3" Body="&lt;p&gt;Unfortunately this won't be possible with Solspace Calendar since we are extending &lt;code&gt;ElementCriteria&lt;/code&gt; with &lt;code&gt;Calendar_EventCriteriaModel&lt;/code&gt;, which has a layer on top of it allowing us to build recurring events and return a padded list of events. We also return &lt;code&gt;Event&lt;/code&gt; objects instead of &lt;code&gt;EventModel&lt;/code&gt; objects, because working with Craft Dates makes it difficult/impossible for Calendar to have the dates it needs. Sorry :/&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2016-12-23T16:31:45.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18271" PostTypeId="2" ParentId="18252" CreationDate="2016-12-23T18:50:08.147" Score="1" Body="&lt;p&gt;While not the ideal solution, there seems to be enough meta information to build out the recurring events manually.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(Calendar_EventModel $event) {&#xA;  $exceptions = [];&#xA;  foreach($event-&amp;gt;exceptions as $exception) {&#xA;    $exceptions[] = $exception-&amp;gt;date;&#xA;  }&#xA;&#xA;  return [&#xA;    'id' =&amp;gt; $event-&amp;gt;id,&#xA;    'title' =&amp;gt; $event-&amp;gt;title,&#xA;    'calendarId' =&amp;gt; $event-&amp;gt;calendarId,&#xA;    'slug' =&amp;gt; $event-&amp;gt;slug,&#xA;    'startDate' =&amp;gt; $event-&amp;gt;startDate,&#xA;    'endDate' =&amp;gt; $event-&amp;gt;endDate,&#xA;    'freq' =&amp;gt; $event-&amp;gt;$freq,&#xA;    'interval' =&amp;gt; $event-&amp;gt;interval,&#xA;    'exceptions' =&amp;gt; $exceptions,&#xA;    'byMonth' =&amp;gt; $event-&amp;gt;byMonth,&#xA;    'byYearDay' =&amp;gt; $event-&amp;gt;byYearDay,&#xA;    'byMonthDay' =&amp;gt; $event-&amp;gt;byMonthDay,&#xA;    'byDay' =&amp;gt; $event-&amp;gt;byDay&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4115" LastActivityDate="2016-12-23T18:50:08.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18272" PostTypeId="2" ParentId="18256" CreationDate="2016-12-23T19:48:01.487" Score="2" Body="&lt;p&gt;I've actually answered the question in the question. Not sure why it's not showing as is, but the solution is updating the plugin file as mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastActivityDate="2016-12-23T19:48:01.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18273" PostTypeId="2" ParentId="18268" CreationDate="2016-12-24T00:36:55.913" Score="2" Body="&lt;p&gt;Well, if you submit to your add to cart form via ajax, you will already get a json response - with an &lt;code&gt;error&lt;/code&gt; - you can simply grab that error, test for &lt;code&gt;Not a purchasable ID&lt;/code&gt; and then change the text to whatever you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're submitting in a non ajax fashion, you won't get a JSON response no matter what clearly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with the comment above - I'd generally handle this in front end JS, by disabling the add to cart until a size is selected.  And I guess if you're allowing your site to use no-js, then in that case I would probably just pre-select the most popular option (Medium, presumably).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also write a plugin that listens to &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&lt;/a&gt; and does whatever validation you need, and returns a response any way you want, including via JSON (i.e. &lt;code&gt;$this-&amp;gt;returnJson([&quot;success&quot;=&amp;gt;true]);&lt;/code&gt; or e.g. &lt;code&gt;$this-&amp;gt;returnErrorJson($errors);&lt;/code&gt; where $errors holds your validation errors...)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2016-12-24T00:36:55.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18274" PostTypeId="1" AcceptedAnswerId="18275" CreationDate="2016-12-24T02:04:59.100" Score="1" ViewCount="93" Body="&lt;p&gt;I am outputting all my entries and it seems that on the front end, it isn't displaying entries from N to Z. I see those entries in the backend. The entries on the front end:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.colorcomputergames.com/games&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template conditional doesn't have any limits on N to Z or the number of entries to show. The entries are enabled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this due to using the free version of Craft CMS or some other setting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Games&quot; %}&#xA;{% set entries = craft.entries.section('games').order('title') %}&#xA;{% block content %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; ... {% set publishers = entry.GamesPublisher %}{% for publisher in publishers %}&amp;lt;a href=&quot;{{ publisher.url }}&quot;&amp;gt;{{ publisher.title }}&amp;lt;/a&amp;gt; {% endfor %}{% if entry.GamesGenre is not empty %}{% for category in entry.GamesGenre %}{{ category.title }}{% endfor %}{% endif %}{% if entry.GamesReleaseYear is not empty %} {{ entry.GamesReleaseYear.format('Y') }}{% endif %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-24T03:29:18.067" Title="Is there a limit to outputting entries in 'free' version of Craft CMS?" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18275" PostTypeId="2" ParentId="18274" CreationDate="2016-12-24T03:29:18.067" Score="2" Body="&lt;p&gt;Craft will limit the number of elements returned by default to 100, so if you're expecting to get &gt; 100 entries, that's probably what you're running into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To grab all entries, use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('games').order('title').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this default limit of 100 no longer exists in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-24T03:29:18.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18276" PostTypeId="1" CreationDate="2016-12-24T05:50:11.030" Score="1" ViewCount="173" Body="&lt;p&gt;I have two sections: 'reviews' and 'games'.&#xA;Games has an field called 'GamesReviews' which is type entries and points to 'reviews'.&#xA;An example of a games entry is located at:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/games/donkey-king&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games/donkey-king&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Towards the bottom, I link to the related reviews for this entry.&#xA;That sends me to:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/reviews/1983-06-01/donkey-king&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/reviews/1983-06-01/donkey-king&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the bottom of the review, I want to link back to the related entry of that review.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to display the name of the game 'Donkey King', but the URL is not pointing to:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/games/donkey-king&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games/donkey-king&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/reviews/1983-06-01/donkey-king&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/reviews/1983-06-01/donkey-king&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I am usinng in the template (reviews/_entry.html) is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% if entry.ReviewsAuthor|length %}&amp;lt;li&amp;gt;Reviewer: {{ entry.ReviewsAuthor }}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsMedia|length %}&amp;lt;li&amp;gt;Media: {% for category in entry.ReviewsMedia %}&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;{% endfor %}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsDate|length %}&amp;lt;li&amp;gt;Date: {{ entry.ReviewsDate.format('F Y') }}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsRelatedLink|length %}&amp;lt;li&amp;gt;Related Link: {{ entry.ReviewsRelatedLink }}&amp;lt;/li&amp;gt;{% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{{ entry.body }}&#xA;&#xA;{% set entries = craft.entries.section('games').relatedTo(entry) %}&#xA;&amp;lt;h3&amp;gt;Info:&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;      &#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2017-01-26T21:54:30.723" Title="Listing related entries to a section" Tags="&lt;entry&gt;&lt;category&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18277" PostTypeId="1" AcceptedAnswerId="18295" CreationDate="2016-12-24T16:25:53.307" Score="2" ViewCount="155" Body="&lt;p&gt;On my page of all tags, it works great except for tags that have more than one word.&#xA;The URL is replacing the spaces with %20 as one would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.colorcomputergames.com/tags/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/tags/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ siteUrl }}tags/{{ tag.title | kebab }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great in changing the %20 to hyphens.&#xA;However, if I click on a tag with multiple words I go to page not found. Makes sense as the system doesn't see that tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% extends &quot;_layout&quot; %}&#xA;    {% set title = &quot;Tags&quot; %}&#xA;    {% block content %}&#xA;    {% for tag in craft.tags.order('title') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | kebab }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So next I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Tags&quot; %}&#xA;{% block content %}&#xA;{% for tag in craft.tags.order('title') %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that wasn't ideal either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to deal with this issue?&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-29T04:44:43.863" Title="Best method to handle %20 in tag URLs with multiple words" Tags="&lt;tags&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18278" PostTypeId="2" ParentId="18234" CreationDate="2016-12-25T21:44:57.797" Score="1" Body="&lt;p&gt;So I found that using the paginate tag would return all entries regardless of the keyword. I was able to get it to work by using the below results code. &lt;em&gt;(pagination still worked without the use of the pagination tag)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{% set tag = craft.tags.title(query).first() %}&#xA;&#xA;{% set products = craft.commerce.products.search(query).limit(48) %}&#xA;{% if products|length %}&#xA;{% for product in products %}&#xA;   &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;item-wrapper&quot;&amp;gt;&#xA;        &amp;lt;figure class=&quot;he-3 cyan&quot;&amp;gt;&#xA;          &amp;lt;img src=&quot;{{ product.presentationSlides.first().getUrl('mediaDetail') }}&quot; alt=&quot;{{ product.name }}&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;hover-icons&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;hover-icons-wrapper&quot;&amp;gt;&#xA;              &amp;lt;a href=&quot;{{ product.presentationSlides.first().getUrl('mediaLightbox') }}&quot; class=&quot;magnific hidden-xs-down&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;nc-icon-outline ui-1_zoom&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;              &amp;lt;/a&amp;gt;&#xA;              &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;nc-icon-outline ui-2_link-71&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;              &amp;lt;/a&amp;gt;&#xA;              &amp;lt;a href=&quot;#&quot; class=&quot;hidden-xs-down&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;nc-icon-outline ui-2_favourite-28&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;              &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/figure&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% else %}&#xA;   &amp;lt;p&amp;gt;No Results&amp;lt;/p&amp;gt;  &#xA;{% endif %}&#xA;&#xA;/*pagination code */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2016-12-25T21:44:57.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18279" PostTypeId="1" AcceptedAnswerId="18286" CreationDate="2016-12-25T22:08:14.090" Score="1" ViewCount="296" Body="&lt;p&gt;I want to be able to display the number of entries that have a tag. Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fruit (9)&#xA;Vegetables (4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to avoid displaying any tags without any related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code right now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Tags&quot; %}&#xA;{% block content %}&#xA;{% for tag in craft.tags.order('title') %}&#xA;    &amp;lt;li&amp;gt;}&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title}}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-26T16:36:41.640" Title="How to display number of entries for a tag and not display if no entries?" Tags="&lt;tags&gt;&lt;relatedto&gt;&lt;count&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18280" PostTypeId="1" CreationDate="2016-12-26T02:17:02.953" Score="0" ViewCount="192" Body="&lt;p&gt;The examples I have seen to link to previous and next entry all seem to be for sections. I want to get the previous and next category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My category handler is called 'media'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I might have entries in this category such as :&#xA;Time&#xA;Life&#xA;People&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When viewing the entry 'Life', I want to be able to go back to Time (Previous) or to People (Next). Again, these entries are entries in my category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('media').relatedTo(category) %}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;{% endif %}&#xA;{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That didn't work, so I also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.category.first() %}&#xA;{% set params = craft.entries.section('media').order('title asc').relatedTo(category) %}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{% if nextEntry %}&#xA;    {% set nextEntryUrl = nextEntry.url %}&#xA;{% else %}&#xA;    {% set firstEntry = craft.entries.section('media').first() %}&#xA;    {% set nextEntryUrl = firstEntry.url %}&#xA;{% endif %}&#xA;{% if prevEntry %}&#xA;    {% set prevEntryUrl = prevEntry.url %}&#xA;{% else %}&#xA;    {% set lastEntry = craft.entries.section('media').last() %}&#xA;    {% set prevEntryUrl = lastEntry.url %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But also no good.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-27T20:16:35.763" Title="Display the next and previous category" Tags="&lt;category&gt;&lt;params&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18281" PostTypeId="1" AcceptedAnswerId="18283" CreationDate="2016-12-26T02:59:25.393" Score="4" ViewCount="537" Body="&lt;p&gt;I have a list of all my games using pagination. It works great:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/games&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to add links at the top of the page like:&#xA;A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so I want to be able to click on any letter and display only entries starting with that letter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was was going to make a template for every page but that seems inefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I tackle this?&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-26T16:19:12.650" Title="Select entries starting with same letter from alphabet list" Tags="&lt;search&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18282" PostTypeId="1" CreationDate="2016-12-26T04:20:44.437" Score="1" ViewCount="392" Body="&lt;p&gt;Looked at countless examples here but all seem to be more than I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the form to have three drop-downs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Make&lt;/strong&gt;&lt;br&gt;&#xA;-Ford&lt;br&gt;&#xA;-Chevy&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Color&lt;/strong&gt;&lt;br&gt;&#xA;-Red&lt;br&gt;&#xA;-Blue&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Transmission&lt;/strong&gt;&lt;br&gt;&#xA;-Auto&lt;br&gt;&#xA;-Shift&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the search results field would look at the section called 'cars' and return any car with the exact match. One additional point is that 'Transmission' is a category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2017-01-11T23:49:25.840" Title="Simple Search form with a few drop-down choices" Tags="&lt;search&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18283" PostTypeId="2" ParentId="18281" CreationDate="2016-12-26T09:31:01.567" Score="11" Body="&lt;p&gt;First, you should create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;noreferrer&quot;&gt;dynamic route&lt;/a&gt; (something like &lt;code&gt;&quot;games/glossary/&amp;lt;slug&amp;gt;&quot;&lt;/code&gt;) and point it to a template. A dynamic route means you won't have to create a template for every letter. Note the use of the &lt;code&gt;&amp;lt;slug&amp;gt;&lt;/code&gt; token, which – although not entirely semantic – should do nicely in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template, you'll need to pull the letter from the URL. Note that it's also a good idea to test if the variable is a single character, and in the a-z range (i.e. a valid letter, and not some other entity).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set letter = slug is defined and slug|length == 1 and slug matches '/^[a-z]/i' ? slug %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there is no valid letter in the &lt;code&gt;slug&lt;/code&gt; variable, it's a good idea to throw a 404:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not letter %}&#xA;  {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, you can actually use &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;noreferrer&quot;&gt;search syntax&lt;/a&gt; for the &lt;code&gt;title&lt;/code&gt; parameter (specifically, a wildcard &lt;code&gt;*&lt;/code&gt;), in order to pull all entries with a title starting with the relevant letter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('games').title(letter~'*').limit(null).order('title asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to throw a 404 whenever there aren't any entries for any given letter, it's simply a matter of testing the &lt;code&gt;length&lt;/code&gt; property for &lt;code&gt;entries&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entries|length %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;noreferrer&quot;&gt;pagination&lt;/a&gt; in your template, it'll work out of the box as usual:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('games').title(letter~'*').limit(10).order('title asc') as pageInfo, pageEntries %}&#xA;&#xA;{% if not pageEntries|length %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% for entry in pageEntries %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2016-12-26T16:19:12.650" LastActivityDate="2016-12-26T16:19:12.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18284" PostTypeId="1" CreationDate="2016-12-26T12:15:33.797" Score="2" ViewCount="150" Body="&lt;p&gt;I've got a problem where &lt;code&gt;siteURL&lt;/code&gt; wasn't working for a localized version of my site. I have a site in two languages — Russian and English, with Russian exposed under &lt;code&gt;www.mysite.com&lt;/code&gt; and English under &lt;code&gt;www.mysite.com/en/&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem was that &lt;code&gt;siteUrl&lt;/code&gt; variable was always giving me a non localized version of the site URL (&lt;code&gt;www.mysite.com&lt;/code&gt; instead of &lt;code&gt;www.mysite.com/en/&lt;/code&gt;) on the pages in English, even though other localized features were working fine (strings were translated into English, correct entries output etc.). See below for the solution.&lt;/p&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2016-12-26T12:15:33.797" Title="siteUrl in Twig templates not working" Tags="&lt;localization&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18285" PostTypeId="2" ParentId="18284" CreationDate="2016-12-26T12:15:33.797" Score="2" Body="&lt;p&gt;The answer to this is that in the &lt;code&gt;general.php&lt;/code&gt; I had a setup which somehow was giving trouble when setting &lt;code&gt;siteUrl&lt;/code&gt;. Things were like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'ru' =&amp;gt; 'http://www.mysite.com/',&#xA;        'en_us' =&amp;gt; 'http://www.mysite.com/en/'&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While seemingly correct, in this setup &lt;code&gt;siteUrl&lt;/code&gt; should be moved into &lt;code&gt;'*'&lt;/code&gt; block, otherwise there comes the problem that I described earlier. So the correct version is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'siteUrl' =&amp;gt; array(&#xA;            'ru' =&amp;gt; 'http://www.issuesinlinguistics.ru/',&#xA;            'en_us' =&amp;gt; 'http://www.issuesinlinguistics.ru/en/'&#xA;        )&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3838" LastActivityDate="2016-12-26T12:15:33.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18286" PostTypeId="2" ParentId="18279" CreationDate="2016-12-26T16:36:41.640" Score="4" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = craft.tags.limit(null).relatedTo(craft.entries.limit(null)).order('title') %}&#xA;&#xA;{% for tag in tags %}&#xA;    &amp;lt;a href=&quot;/tags/{{ tag.slug }}&quot;&amp;gt;{{ tag.title }} (craft.entries.relatedTo(tag).total())&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if you have a significant amount of tags, the above could be a costly affair, performance wise – &lt;a href=&quot;https://craftcms.stackexchange.com/a/884/1098&quot;&gt;consider alternative approaches&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2016-12-26T16:36:41.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18287" PostTypeId="2" ParentId="18282" CreationDate="2016-12-26T22:09:13.987" Score="1" Body="&lt;p&gt;I would probably create some categories for make,  color and transmission and relate every entry to it. Then you have the ability to use &lt;code&gt;craft.entries...&lt;/code&gt; to fetch the entries as you need them. You can find all specs of the &lt;code&gt;entries&lt;/code&gt; method in Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#relatedTo&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; -  just fetch all entries that are related to the category you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the total number of entries you could just fetch (and cache) all entries every time and use a javascript filter mechanism. I worked with &lt;a href=&quot;http://isotope.metafizzy.co/&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;isotope&quot;&gt;isotope&lt;/a&gt; before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using js you can achieve a smoother UX once all entries are loaded. However, best practice would be to start coding without js and make it work and then enhance the experience with js. Depends on your budget.&lt;/p&gt;&#xA;" OwnerUserId="5851" LastEditorUserId="5851" LastEditDate="2016-12-26T22:15:12.763" LastActivityDate="2016-12-26T22:15:12.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18288" PostTypeId="1" CreationDate="2016-12-27T03:28:46.333" Score="0" ViewCount="149" Body="&lt;p&gt;I have two sections:&lt;br&gt;&#xA;Games&lt;br&gt;&#xA;Publishers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Games has a field called 'GamesPublisher' that is Entries type (set to Publishers)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a publisher called 'Microsoft' with an ID of 49.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to display all Game entries for the Publisher 'Microsoft' (ie ID 49)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to set the order of the displaying in ASC order based on the field 'GamesCatalogNumber' which is in the section Games.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, it looks OK, but I have yet to figure out to limit entries to a specific Publisher.&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/tandy-catalog/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/tandy-catalog/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('games').relatedTo(entry) %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in entries.order('GamesCatalogNumber desc') %}&#xA;     &amp;lt;li&amp;gt;{{ entry.GamesCatalogNumber }}: &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {# Set parameters for prev/next elements list #}&#xA;    {% set params = craft.entries.section('publishers').order('title asc') %}&#xA;&#xA;    {# Get the prev/next elements #}&#xA;    {% set prevEntry = entry.getPrev(params) %}&#xA;    {% set nextEntry = entry.getNext(params) %}&#xA;&#xA;    {# And make sure to only output the links if the element exists #}&#xA;    {% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous Publisher&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next Publisher&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-28T00:28:01.067" Title="Display all entries matching field of a section" Tags="&lt;loop&gt;&lt;set&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18289" PostTypeId="1" CreationDate="2016-12-27T07:40:48.170" Score="0" ViewCount="278" Body="&lt;p&gt;When accessing www.myurl.com/&lt;code&gt;services&lt;/code&gt;, I get this error &lt;strong&gt;below&lt;/strong&gt; the content of my page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The server encountered an internal error or misconfiguration and was unable to complete your request.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get this error if I access www.myurl.com/&lt;code&gt;index.php/services&lt;/code&gt;. I'm new to Craft, but am particularly confused, because nothing else on my site is broken, I just keep getting this error appended to the end of my html. Additionally, I have followed the directions to include an &lt;code&gt;.htaccess&lt;/code&gt; file in the web root. This error does not occur locally. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="6053" LastActivityDate="2016-12-27T13:48:40.863" Title="Misconfiguration error when accessing URL without file name" Tags="&lt;url&gt;&lt;error&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18290" PostTypeId="1" CreationDate="2016-12-27T13:26:33.577" Score="2" ViewCount="254" Body="&lt;p&gt;Is it possible to return an integer in it's text form?  I searched the Twig documentation and Stack Overflow and did not find a solution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could of course just set it up and create it based on the loop index, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index == '1' %}&#xA;{% set place = 'one' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that breaks if the user creates entries above whatever number I set up to so it is not a real solution of any value. I am wondering if someone here might have a solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The return would be &quot;one&quot; in place of '1', &quot;two&quot; in place of '2', etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3817" LastEditorUserId="57" LastEditDate="2016-12-27T20:13:08.960" LastActivityDate="2019-03-14T09:08:55.433" Title="How to return integer in text form" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18291" PostTypeId="2" ParentId="18289" CreationDate="2016-12-27T13:48:40.863" Score="1" Body="&lt;p&gt;On some servers you might need to add in general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2016-12-27T13:48:40.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18292" PostTypeId="2" ParentId="18290" CreationDate="2016-12-27T19:05:24.103" Score="4" Body="&lt;p&gt;As far as I know there is no &lt;code&gt;convertNumberToWords&lt;/code&gt; type method in twig or php. However, you could create your own. This could be done in several ways: twig macro, custom twig filter, or plugin variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of a simple twig macro that uses a lookup table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro numberToWords(integer) %}&#xA;&#xA;    {% digits = {&#xA;        0:  'zero',&#xA;        1:  'one',&#xA;        2:  'two',&#xA;        3:  'three',&#xA;        4:  'four',&#xA;        5:  'five',&#xA;        6:  'six',&#xA;        7:  'seven',&#xA;        8:  'eight',&#xA;        9:  'nine',&#xA;        10: 'ten',&#xA;        11: 'eleven',&#xA;        12: 'twelve',&#xA;        13: 'thirteen',&#xA;        14: 'fourteen',&#xA;        15: 'fifteen',&#xA;        16: 'sixteen',&#xA;        17: 'seventeen',&#xA;        18: 'eighteen',&#xA;        19: 'nineteen',&#xA;    } %}&#xA;&#xA;    {{ digits[integer] }}&#xA;&#xA;{% endmacro %}&#xA;&#xA;{% import _self as macros %}&#xA;&#xA;{% for i in 1..19 %}&#xA;    {{ macros.numberToWords(loop.index) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Creating a custom twig filter or a plugin would of course allow you to use php, which might provide a more robust solution. Doing a quick search I see there are a few examples that people have written, like &lt;a href=&quot;https://pageconfig.com/post/number-to-word-conversion-with-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to do this via a plugin, you might try using lindseydiloreto's excellent &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft-businesslogic&lt;/a&gt; as a starting point. Then just paste the php methods (from the example linked above) into the variables file (along with any dependency methods).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-12-27T19:14:07.070" LastActivityDate="2016-12-27T19:14:07.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18293" PostTypeId="1" CreationDate="2016-12-27T19:08:35.450" Score="1" ViewCount="106" Body="&lt;p&gt;What is the right way to save the entry id of a sprout form submission to a custom field in that form? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been fiddling with the SproutForms_EntriesService, but is that the completely wrong way to go about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17952/write-into-sprout-forms-from-another-plugin&quot;&gt;This post was helpful&lt;/a&gt;, but the setContentFromPost threw errors for me. I've had success with getContent though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;title = yourValue;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still, I'm missing something:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I've played with the saveEntry function, and I can save values before the event is validated (where the title is updated at line 156), but since I need the element ID, the value should be set after the entry has been successfully saved. But, if I move my code inside the successful new entry block at line 176, it's a dud: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Starting @176&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Now that we have an element ID, save it on the other stuff&#xA;if ($isNewEntry)&#xA;{&#xA;$entryRecord-&amp;gt;id = $entry-&amp;gt;id;&#xA;  // my crappy code:&#xA;  $entryId = $entry-&amp;gt;id;&#xA;  $entry-&amp;gt;getContent()-&amp;gt;formEntryId = $entryId;&#xA;  // end crappy code&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could be going about this totally wrong. You'll have to forgive the ignorance; I'm a Front End Dev with general Craft skills who's delving into plugin dev for the first time. So, I'm at the beginning, studying the Craft Plugin Mijingo Course and just straight up reading through plugin files…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;L&lt;/p&gt;&#xA;" OwnerUserId="5401" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-01-31T22:41:04.340" Title="Sprout Forms: Map Element ID to Content Field on Save Entry Event" Tags="&lt;plugins&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18294" PostTypeId="2" ParentId="18280" CreationDate="2016-12-27T20:10:16.863" Score="1" Body="&lt;p&gt;Based on your example and description, it's a bit hard to tell whether you are dealing with a &lt;code&gt;category&lt;/code&gt; template or an &lt;code&gt;entry&lt;/code&gt; template, because in your description you say that the category handle is called 'media', but in the example you are grabbing entries in the section called 'media'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you are on a category template (i.e. trying to create a category index page for example), then you should be able to just grab the current category from the 'category' variable (provided by craft), entries related to that category using &lt;code&gt;relatedTo(category)&lt;/code&gt;, and the next and previous categories from &lt;code&gt;category.nextSibling&lt;/code&gt; and &lt;code&gt;category.previousSibling&lt;/code&gt; (or &lt;code&gt;category.next&lt;/code&gt; and &lt;code&gt;category.previous&lt;/code&gt; depending on whether your categories are hierarchical). If so, then the following should work (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# category template #}&#xA;&#xA;{% set prevCategory = category.prevSibling %}&#xA;{% set nextCategory = category.nextSibling %}&#xA;{% set entries = craft.entries('mySection').relatedTo(category) %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;section class=&quot;category-index&quot;&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;article&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;{% if prevCategory %}&amp;lt;a href=&quot;{{ prevCategory.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt; {% endif %}{% if nextCategory %}&amp;lt;a href=&quot;{{ nextCategory.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are dealing with an entry template (i.e. an entry detail page), then you may need to clarify the question a bit.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-12-27T20:16:35.763" LastActivityDate="2016-12-27T20:16:35.763" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18295" PostTypeId="2" ParentId="18277" CreationDate="2016-12-27T20:58:16.120" Score="3" Body="&lt;p&gt;Update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After looking at the tag model a little more closely, it looks like tags have both a &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;slug&lt;/code&gt; — so if you use the slug to construct your url then you shouldn't have that problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your tag index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for tag in craft.tags.order('title') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.slug }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your tag index page (assuming you are using the &lt;code&gt;tag&lt;/code&gt; token in your custom route): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagEntry = craft.tags.group('myTagGroup').slug(tag).first %}&#xA;{% set entries = craft.entries.relatedTo(tagEntry).order('title').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-12-29T04:44:43.863" LastActivityDate="2016-12-29T04:44:43.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18296" PostTypeId="2" ParentId="18276" CreationDate="2016-12-27T21:27:57.510" Score="1" Body="&lt;p&gt;You are returning an elementCriteriaModel (which always returns an array-like object regardless if there is one or more than one result), which you either need to loop over or just grab the first entry (because in this case there can only be one).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set gameEntries = craft.entries.section('games').relatedTo(entry) %}&#xA;&amp;lt;h3&amp;gt;Info:&amp;lt;/h3&amp;gt;&#xA;{% for gameEntry in gameEntries %}&#xA;    &amp;lt;ul&amp;gt;      &#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ gameEntry.url }}&quot; title=&quot;{{ gameEntry.title }}&quot;&amp;gt;{{ gameEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set gameEntry = craft.entries.section('games').relatedTo(entry).first %}&#xA;&amp;lt;ul&amp;gt;      &#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ gameEntry.url }}&quot; title=&quot;{{ gameEntry.title }}&quot;&amp;gt;{{ gameEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastActivityDate="2016-12-27T21:27:57.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18297" PostTypeId="2" ParentId="18288" CreationDate="2016-12-28T00:11:28.687" Score="1" Body="&lt;p&gt;Looks to me like your solution is mostly correct, except for handling the &lt;code&gt;gamesCatalogNumber&lt;/code&gt;. For that you could either:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;test for specific publisher(s) by id or slug&lt;/li&gt;&#xA;&lt;li&gt;test if gamesCatalogNumber is empty on the first entry (and assume that the publisher doesn't use catalog numbers), or &lt;/li&gt;&#xA;&lt;li&gt;(recommended solution) add a &lt;code&gt;checkbox&lt;/code&gt; or &lt;code&gt;lightSwitch&lt;/code&gt; field to the publisher called 'usesCatalogNumbers' and test for that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# publisher template #}&#xA;&#xA;{% if entry.usesCatalogNumbers %}&#xA;    {% set games = craft.entries.section('games').relatedTo(entry).order('gamesCatalogNumber desc') %}&#xA;{% else %}&#xA;    {% set games = craft.entries.section('games').relatedTo(entry).order('title asc') %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for game in games %}&#xA;        &amp;lt;li&amp;gt;{% if entry.usesCatalogNumbers %}{{ entry.gamesCatalogNumber }}: {% endif %}&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% set params = craft.entries.section('publishers').order('title asc') %}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{% if prevEntry %}&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous Publisher&amp;lt;/a&amp;gt; {% endif %}{% if nextEntry %}&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next Publisher&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I recommend this (instead of the other options) because it's a bit more explicit and extensible (i.e. allows you to add other publishers that use catalog numbers without modifying the templates).&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2016-12-28T00:28:01.067" LastActivityDate="2016-12-28T00:28:01.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18298" PostTypeId="1" AcceptedAnswerId="18299" CreationDate="2016-12-28T02:47:39.337" Score="0" ViewCount="480" Body="&lt;p&gt;I have a section called reviews and a section called games.&#xA;A entry field in games is creating a relationship to reviews.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my _entry.html entry for reviews, I want to link back to the related game.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is below. I understand why it isn't working, but not sure how to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template displays the Review entry title, the body some extra fields in reviews.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then gets to the Game Link, but the link is not to my Games section but to my Reviews section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, on this review:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/reviews/1984-01-01/glaxxons&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/reviews/1984-01-01/glaxxons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The link at the bottom should be to:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/games/glaxxons&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/games/glaxxons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead, goes to:&#xA;&lt;a href=&quot;http://www.colorcomputergames.com/reviews/1984-01-01/glaxxons&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.colorcomputergames.com/reviews/1984-01-01/glaxxons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% if entry.ReviewsAuthor|length %}&amp;lt;li&amp;gt;Reviewer: {{ entry.ReviewsAuthor }}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsMedia|length %}&amp;lt;li&amp;gt;Media: {% for category in entry.ReviewsMedia %}&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;{% endfor %}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsDate|length %}&amp;lt;li&amp;gt;Date: {{ entry.ReviewsDate.format('F Y') }}&amp;lt;/li&amp;gt;{% endif %}&#xA;    {% if entry.ReviewsRelatedLink|length %}&amp;lt;li&amp;gt;Related Link: {{ entry.ReviewsRelatedLink }}&amp;lt;/li&amp;gt;{% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{{ entry.body }}&#xA;&#xA;{% set entries = craft.entries.section('games').relatedTo(entry) %}&#xA;&amp;lt;h3&amp;gt;Game Link:&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;                      &#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As mentioned, in section called Games, I have a field called GamesReview and set it to entries and assign the review entry. Do I need to do the opposite as well t make this work? That is, in my reviews section, create a field called GameReviewed and set it to entries and assign it to Games section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6018" LastActivityDate="2016-12-28T08:50:32.097" Title="Link to an entry to a related section" Tags="&lt;relations&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18299" PostTypeId="2" ParentId="18298" CreationDate="2016-12-28T08:50:32.097" Score="1" Body="&lt;p&gt;Your code isn't working because you set the related game(s) to a variable &lt;code&gt;entries&lt;/code&gt; (i.e. &lt;code&gt;{% set entries = craft.entries...%}&lt;/code&gt;), but you're not actually &lt;em&gt;doing&lt;/em&gt; anything with that variable. Then you try to render the link to the related game(s), but you're simply re-using the &lt;code&gt;entry&lt;/code&gt; variable – which refers to the review entry, not the related game entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('games').relatedTo(entry) %}&#xA;&amp;lt;h3&amp;gt;Game link:&amp;lt;/h3&amp;gt;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedGames = craft.entries.section('games').relatedTo(entry) %}&#xA;{% if relatedGames|length %}&#xA;    &amp;lt;h3&amp;gt;Game Link:&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for game in relatedGames %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ game.url }}&quot; title=&quot;{{ game.title }}&quot;&amp;gt;{{ game.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in some cases, its a good idea to be as specific as possible when you're dealing with &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt;. Simply doing &lt;code&gt;relatedTo(entry)&lt;/code&gt; will work, but you can also let Craft know where the relation was created (i.e. in which field), and whether the related elements you're looking for is the &lt;em&gt;source&lt;/em&gt; or the &lt;em&gt;target&lt;/em&gt; elements for the relation. In this case, then Entries field is on the game entry, which means that the review entry is the &lt;em&gt;target&lt;/em&gt; element (i.e. the entry that has been selected in an Entries field), and the game entry is the &lt;em&gt;source&lt;/em&gt; element (i.e. the entry that actually has the Entries field in its field layout).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your Entries field on the game entry has a handle &lt;code&gt;relatedReviews&lt;/code&gt;, a more specific &lt;code&gt;relatedTo&lt;/code&gt; query for your use case could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedGames = craft.entries.section('games').relatedTo({&#xA;    field: 'relatedReviews',&#xA;    targetElement: entry&#xA;}) %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Being specific about relations can be more performant, and helps avoid issues where you might have multiple relations involving the same elements (e.g. if your review and game entries where also related via a different Entries field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another detail to note is that whenever you're dealing with the &lt;em&gt;source&lt;/em&gt; element (e.g. if this was the template for the game entry, and you wanted to list the related review entries), you rarely need &lt;code&gt;relatedTo&lt;/code&gt; – you can just do this (of course, replace &lt;code&gt;relatedReviews&lt;/code&gt; with the real handle for your Entries field):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedReviews = entry.relatedReviews %}&#xA;{% for review in relatedReviews %}&#xA;    &amp;lt;a href=&quot;{{ review.url }}&quot;&amp;gt;{{ review.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2016-12-28T08:50:32.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18300" PostTypeId="1" AcceptedAnswerId="18315" CreationDate="2016-12-28T15:57:47.320" Score="1" ViewCount="411" Body="&lt;p&gt;I am having the following sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. work (section type: single)&#xA;  fields: &#xA;    - workList (type: entries from section type workArticles)&#xA;&#xA;2. workArticles (section type: channel)&#xA;  fields: &#xA;    - workName (type: plain text)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the first section (&lt;code&gt;work&lt;/code&gt;) is an overview page that links to pages of the second section (&lt;code&gt;workArticles&lt;/code&gt;). Basically a normal portfolio page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my workArticles pages I want to link to the next entry from &lt;code&gt;work.workList&lt;/code&gt;. So imagine: my portfolio overview page shows 8 projects, the user clicks on the third entry, the page for the third entry opens, on the bottom of that page I want to link to the fourth entry of the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that even possible?&lt;/p&gt;&#xA;" OwnerUserId="6009" LastEditorUserId="6009" LastEditDate="2016-12-29T09:58:07.673" LastActivityDate="2016-12-29T18:36:27.823" Title="Get next entry from an entries field" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18301" PostTypeId="1" AcceptedAnswerId="18303" CreationDate="2016-12-28T16:00:15.403" Score="1" ViewCount="457" Body="&lt;p&gt;I was able to install Craft using a Vagrant/Homestead setup, but I can't seem to connect to the database I want. I set up my hosts file to point to a '.dev' address while working locally on my machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;strong&gt;db.php&lt;/strong&gt; file seems to be set up ok:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  '*' =&amp;gt; [&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;  ],&#xA;  '.dev' =&amp;gt; [&#xA;    'database' =&amp;gt; 'dev',&#xA;    'user' =&amp;gt; 'homestead',&#xA;    'password' =&amp;gt; 'secret',&#xA;  ],&#xA;  '.org' =&amp;gt; [&#xA;    'database' =&amp;gt; 'prod',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; '********',&#xA;  ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I ssh into my vagrant box and log into mysql, I can &lt;code&gt;SHOW DATABASES&lt;/code&gt; and see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+--------------------+&#xA;| information_schema |&#xA;| dev                |&#xA;| prod               |&#xA;| homestead          |&#xA;| mysql              |&#xA;| performance_schema |&#xA;+--------------------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm overwriting the dev, prod and homestead databases with a backedup .sql file, however when I visit my local '.dev' address, my Craft site doesn't appear to carrying over any of those changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to see which database Craft is actually connected to?&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2016-12-28T18:47:49.220" Title="How to see which database Craft is currently connected to?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18302" PostTypeId="1" CreationDate="2016-12-28T18:01:35.350" Score="1" ViewCount="2026" Body="&lt;p&gt;I'm getting my nerves on this because I can't find what's stopping from uploading. I simply choose a file, the loading show and get itself complete, but it simply stops at the 100%. I ran into my browser's console and this shows up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Safari:&#xA;&lt;strong&gt;&quot;Failed to load resource: the server responded with a status of 500 (Internal Server Error)&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chrome:&#xA;&quot;Failed to load resource: &lt;strong&gt;&lt;a href=&quot;http://craft.dev/index.php/admin/actions/assets/uploadFile&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craft.dev/index.php/admin/actions/assets/uploadFile&lt;/a&gt;&lt;/strong&gt; the server responded with a status of 500 (Internal Server Error)&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me to figure this out... A huge thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running the website on localhost and using AMPPS and Navicat for the DB.&lt;/p&gt;&#xA;" OwnerUserId="6056" LastActivityDate="2016-12-28T23:34:45.217" Title="Image Upload &quot;Failed to load resource: the server responded with a status of 500 (Internal Server Error)&quot;" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18303" PostTypeId="2" ParentId="18301" CreationDate="2016-12-28T18:47:49.220" Score="1" Body="&lt;p&gt;You could do something like this to at least see which environment from your multi-environment config that Craft is matching:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craft = require 'path/to/craft/app/bootstrap.php';&#xA;echo $craft-&amp;gt;config-&amp;gt;get('server', ConfigFile::Db);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-28T18:47:49.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18305" PostTypeId="1" AcceptedAnswerId="18306" CreationDate="2016-12-28T19:16:58.590" Score="1" ViewCount="738" Body="&lt;p&gt;I'm running into this effectively &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI/issues/4&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/ElementAPI/issues/4&lt;/a&gt; and I'm not quite sure how I'd integrate this change with &lt;a href=&quot;https://gist.github.com/stevieg83/85dd058dc77a3b46764165975b17bb76&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/stevieg83/85dd058dc77a3b46764165975b17bb76&lt;/a&gt; adding it as the first part of my function errors out for me &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;syntax error, unexpected '=&amp;gt;' (T_DOUBLE_ARROW)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's missing?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2016-12-28T19:34:21.353" Title="Element API CORS issue" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18306" PostTypeId="2" ParentId="18305" CreationDate="2016-12-28T19:34:21.353" Score="2" Body="&lt;p&gt;100% untested, but try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/jobs.json' =&amp;gt; function() {&#xA;            HeaderHelper::setHeader([&#xA;                'Access-Control-Allow-Origin' =&amp;gt; 'http://example.com'&#xA;            ]);&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['section' =&amp;gt; 'jobs'],&#xA;                'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                        'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;jobs/{$entry-&amp;gt;id}.json&quot;),&#xA;                    ];&#xA;                },&#xA;            ];&#xA;        },&#xA;        'api/jobs/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;            HeaderHelper::setHeader([&#xA;                'Access-Control-Allow-Origin' =&amp;gt; 'http://example.com'&#xA;            ]);&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; ['id' =&amp;gt; $entryId],&#xA;                'first' =&amp;gt; true,&#xA;                'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                        'entryId' =&amp;gt; $entry-&amp;gt;id,&#xA;                        'postDate' =&amp;gt; $entry-&amp;gt;postDate,&#xA;                    ];&#xA;                },&#xA;            ];&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-28T19:34:21.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18308" PostTypeId="2" ParentId="18302" CreationDate="2016-12-28T23:34:45.217" Score="1" Body="&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Got an answer here. It was me the problem the whole long. I read through my error logs (thanks Brad on that!) and found out that I had that the my php's gd extension wasn't active. I activated and I now have it working! &#xA;Thanks for all the help!&lt;/p&gt;&#xA;" OwnerUserId="6059" LastActivityDate="2016-12-28T23:34:45.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18309" PostTypeId="1" AcceptedAnswerId="18317" CreationDate="2016-12-29T00:58:18.023" Score="1" ViewCount="102" Body="&lt;p&gt;Building a photography website for a client, need a way to bulk upload images, much like using the assets field. I want these to be grouped into different sets by entry or category. So that I can apply whatever fields I need to the set then loop through these images based on set in the Front-End.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I have tried is using entries and having an assets field to upload the images. The problem I am having is I also need to have each image generate it's own seperate URL, meaning a template page for the set of images and then another template for each image in that set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to accomplish this using Craft's core features?&lt;/p&gt;&#xA;" OwnerUserId="6057" LastActivityDate="2016-12-29T23:23:44.093" Title="Bulk upload images, generating a seperate page for each image" Tags="&lt;entries&gt;&lt;assets&gt;&lt;categories&gt;&lt;url&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18311" PostTypeId="2" ParentId="2359" CreationDate="2016-12-29T02:42:13.240" Score="1" Body="&lt;p&gt;I had this problem because my VPN was interfering with local cURL requests. I disabled the VPN and Craft was able to detect updates. I'm working with my VPN provider now to figure out a permanent solution.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2016-12-29T02:42:13.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18312" PostTypeId="1" CreationDate="2016-12-29T10:45:55.897" Score="1" ViewCount="84" Body="&lt;p&gt;How do I set the webhook URL for Charge in the config file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got my /config/charge.php created.&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2016-12-29T10:52:42.723" Title="Setting Charge Webhook in config file" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18313" PostTypeId="2" ParentId="18312" CreationDate="2016-12-29T10:52:42.723" Score="1" Body="&lt;p&gt;Figured it out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'webhook' =&amp;gt; 'http://example.com',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="170" LastActivityDate="2016-12-29T10:52:42.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18315" PostTypeId="2" ParentId="18300" CreationDate="2016-12-29T18:36:27.823" Score="1" Body="&lt;p&gt;There is no inherent order or hierarchy between entries in a Channel section.  You could do some janky things to simulate it, but you're probably much better off converting that &lt;code&gt;workArticles&lt;/code&gt; section to a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Structured section&lt;/a&gt;, which does give its entries both order and hierarchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you might not care about the hierarchy, so you can just keep everything on the first level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very similar to &lt;a href=&quot;https://craftcms.com/support/structure-nav#top-level-only&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/structure-nav#top-level-only&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, if you need to, you can take advantage of all of the structure specific properties of &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt;, (level, parent, nextSibling, etc.)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-29T18:36:27.823" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18316" PostTypeId="1" AcceptedAnswerId="18318" CreationDate="2016-12-29T20:52:58.327" Score="1" ViewCount="224" Body="&lt;p&gt;I have a plugin that creates a local JSON file and uploads it to S3 using &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService#insertFileByLocalPath-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;insertFileByLocalPath&lt;/code&gt;&lt;/a&gt;. The file is created, saved, and uploaded to s3 successfully. However, S3 detects the content-type to be &lt;code&gt;text/plain&lt;/code&gt; and not &lt;code&gt;application/json&lt;/code&gt;. Does anyone know of a way to force the content-type when creating an asset? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $jsonStr = json_encode($arrayToBecomeJson);&#xA;&#xA;    $fileName = $myFileName . '.json';&#xA;&#xA;    $tempPath = AssetsHelper::getTempFilePath('json');&#xA;&#xA;    file_put_contents($tempPath, $jsonStr);&#xA;&#xA;    $assetSaveSuccess = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;        $tempPath,&#xA;        $fileName,&#xA;        $assetFolderId,&#xA;        AssetConflictResolution::Replace&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2016-12-30T09:00:53.313" Title="Asset Upload via Plugin - S3 gets wrong Content-Type" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18317" PostTypeId="2" ParentId="18309" CreationDate="2016-12-29T23:23:44.093" Score="2" Body="&lt;p&gt;In your main image index template, you can iterated through all of the assets and generate URLs yourself like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in assets %}&#xA;    &amp;lt;a href=&quot;/photos/photo-detail/{{ asset.slug }}&quot;&amp;gt;{{ asset.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then set up a custom route for &lt;code&gt;/photos/photo-detail/&lt;/code&gt;(slug) and point it at the &lt;code&gt;photo-detail.twig&lt;/code&gt; template. In that template, you can get the slug for the asset via &lt;code&gt;craft.request.getSegment(3)&lt;/code&gt; and then look up the asset via the slug.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2016-12-29T23:23:44.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18318" PostTypeId="2" ParentId="18316" CreationDate="2016-12-30T09:00:53.313" Score="1" Body="&lt;p&gt;While Craft 3 will be smarter about this, this is not currently possible in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do, though, is modify &lt;code&gt;craft/app/helpers/IOHelper.php::getMimeType()&lt;/code&gt; function so that it always returns the mime type by extension instead by the content, since the core problem is that FileInfo extension cannot detect JSON by looking at the file contents. I'm a bit doubtful of any future releases for Craft 2 that affect this file, but, for posterity, probably better to write down any changes you make somewhere in case they get reverted.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2016-12-30T09:00:53.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18319" PostTypeId="1" AcceptedAnswerId="18321" CreationDate="2016-12-30T09:18:17.947" Score="1" ViewCount="1069" Body="&lt;p&gt;In a Matrix field i want to check if block.logolink (simple text) &lt;strong&gt;OR&lt;/strong&gt; block.logolinkDropdown (dropdown with empty field) are empty or not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.logolink or block.logolinkDropdown %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If i check them with {{ block.fieldHandle }} they're empty. But still it passes the condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where's my mistake in this statement?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.logomatrix %}&#xA;{% switch block.type %}&#xA;&#xA;{% case &quot;logo&quot; %}&#xA;{% if block.logobild %}&#xA;    {% for logo in block.logobild %}&#xA;    {% if block.logolink or block.logolinkDropdown %}&#xA;        {% if block.internerLink %}&#xA;            &amp;lt;a href={{ block.logolink }}{{ block.logolinkDropdown }}&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;a href={{ block.logolink }}{{ block.logolinkDropdown }} TARGET=&quot;_blank&quot;&amp;gt;&#xA;        {% endif %}&#xA;    {% else %}&#xA;        &amp;lt;a href=&quot;{{ logo.getUrl('logogross')}}&quot; data-lightbox=&quot;image&quot; data-title=&quot;{{ block.logobeschreibung }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% case &quot;textbutton&quot; %}     &#xA;...&#xA;&#xA;{% endswitch %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2016-12-30T14:36:12.627" Title="Checking if Matrix fields are empty or not?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18320" PostTypeId="1" AcceptedAnswerId="18336" CreationDate="2016-12-30T13:34:17.970" Score="1" ViewCount="100" Body="&lt;p&gt;I'm trying to output a date like this for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ now|date('l, j-m-Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs the date in my standard language. I need it output on the same page in English too. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2017-01-02T14:38:52.000" Title="Output two date languages on the same page without localization" Tags="&lt;datetime&gt;&lt;language&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18321" PostTypeId="2" ParentId="18319" CreationDate="2016-12-30T14:36:12.627" Score="3" Body="&lt;p&gt;You can get a dropdown field's selected value by using &lt;code&gt;entry.fieldhandle.value&lt;/code&gt;. So &lt;code&gt;if entry.fieldhandle.value|length&lt;/code&gt; should do the trick. I think you can even omit the &lt;code&gt;length&lt;/code&gt; filter in this case, as if you do it with the plain text field. Both an empty string and the length of an empty string resolve to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5851" LastActivityDate="2016-12-30T14:36:12.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18322" PostTypeId="1" AcceptedAnswerId="18325" CreationDate="2016-12-30T16:42:44.170" Score="1" ViewCount="6669" Body="&lt;p&gt;Ok so this is an incredibly wierd one and I have no idea how to explain the problem in just one sentence so I just put the error message as the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am building a site with craft...in fact its basically complete. I was developing it in linux ubuntu but also using the vagrant homestead virtual machine to develop from so OS is kinda irrelevant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway...this is at work and they decided to be nice and get me a mac for work for christmas so I'm just basically trying to set up my working environment on the new computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I set up homestead, pull everything from the git repositories, set up the databases and import everything...go to launch the site and I get the error message that is in the title and it highlights this line: &lt;code&gt;$value=unserialize($value);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ok...interesting...after some googling i read something and decided to try and go into my config file and turn off developer mode...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to a normal page it gives me this error: &lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #25 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db_name.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some research into this and tried to edit my my.cnf file to modify the sql_mode parameter also with no luck although i think the line I was given was not correct for the version of mysql that I have...perhaps this is where the issue is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and when I try to log into the back end aka /panel it gives me this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your server doesn’t meet the following requirements to run Craft CMS:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mcrypt is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please talk to your host/IT department about upgrading your server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok...fair enough...maybe I need this mcrypt thing...the thing is I think it is already installed? It is listed in my phpinfo(); I have gone through the steps to install it (and yes I have restarted nginx and php....and mysql and still nothing...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really have no idea what the problem here is...the only thing that i can think is that my vagrant environment is different to the one I had in linux as I downloaded it more recently but I have no idea what setting/software version number/whatever somewhere is different that might be causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please feel free to ask for more info as I really am not sure what I am looking for here...I know that the vagrant environment is working as well as normal php is running (as I was able to run the phpinfo(); function succesfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vagrant box is running php 7.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt&lt;/p&gt;&#xA;" OwnerUserId="6063" LastActivityDate="2018-03-17T01:18:57.133" Title="PHP notice unserialize(): Unexpected end of serialized data" Tags="&lt;php&gt;&lt;mysql&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18323" PostTypeId="2" ParentId="18320" CreationDate="2016-12-30T18:28:32.893" Score="2" Body="&lt;p&gt;The Craft/Twig &lt;a href=&quot;https://craftcms.com/classreference/etc/templating/twigextensions/CraftTwigExtension#dateFilter-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;dateFilter&lt;/a&gt; that you're using will currently only translate the string into the current locale the site is set to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that added its own Twig Extension that added its own filter... let's call it &lt;code&gt;|translatedDate&lt;/code&gt; and you could pass in the target locale code as a parameter &lt;code&gt;|translatedDate('en_us')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That filter would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentLanguage = craft()-&amp;gt;getLanguage();&#xA;craft()-&amp;gt;setLanguage('en_us');&#xA;...&#xA;// Do logic similar to Craft's existing date filter&#xA;...&#xA;craft()-&amp;gt;setLanguage($currentLanguage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2016-12-30T18:28:32.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18324" PostTypeId="2" ParentId="18229" CreationDate="2016-12-30T18:31:06.720" Score="1" Body="&lt;p&gt;FWIW, I had this same error when updating to 2.6.2956 today. I deleted my old app folder, replaced it with a fresh one, and still got the same error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found the same error in my logfiles, so I looked at the tables and saw that my &lt;code&gt;craft_elementindexsettings&lt;/code&gt; was empty, so I dropped it and tried the manual migration again, and it went through with no problem.&lt;/p&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2016-12-30T18:31:06.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18325" PostTypeId="2" ParentId="18322" CreationDate="2016-12-30T18:40:08.157" Score="8" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/changelog#2-6-2957&quot; rel=&quot;noreferrer&quot;&gt;Craft 2.6.2957&lt;/a&gt; added support for PHP 7.1&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There's a lot going on here, but 1st thing is 1st.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The vagrant box is running PHP 7.1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft 2 (and the current latest version of the Yii framework - 1.1.17) are not yet compatible with PHP 7.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the next Yii 1 release is out that addresses the framework compatibility issues, we'll get Craft 2 up and running on PHP 7.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until then, you'll want to use PHP 7.0.x.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2016-12-30T22:54:07.030" LastActivityDate="2016-12-30T22:54:07.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18326" PostTypeId="5" CreationDate="2016-12-30T19:08:05.853" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; ties a &lt;a href=&quot;https://stripe.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stripe&lt;/a&gt; account into the admin of an installation of the &lt;a href=&quot;https://craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5997" LastEditorUserId="5997" LastEditDate="2016-12-31T06:35:10.380" LastActivityDate="2016-12-31T06:35:10.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18327" PostTypeId="4" CreationDate="2016-12-30T19:08:05.853" Score="0" Body="Questions specific to the Charge plugin for Craft" OwnerUserId="5997" LastEditorUserId="5997" LastEditDate="2016-12-31T06:35:20.080" LastActivityDate="2016-12-31T06:35:20.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18328" PostTypeId="1" CreationDate="2016-12-30T20:19:40.500" Score="2" ViewCount="183" Body="&lt;p&gt;I have setup a barebones install, and authenticated my bucket using the root user S3 credentials (just for now). Assets do not upload. I read a similar question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13885/s3-asset-uploading-hangs&quot;&gt;here&lt;/a&gt; where the answer was that the response was being blocked by a firewall. I have tested on other connections and the issue wasn't resolved. Craft support suggested that I could edit some code on craft/app/lib/S3.PHP around line 771 but I'm not sure how to go about solving.&lt;/p&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-01-02T01:44:34.747" Title="S3 Asset uploading is hanging" Tags="&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18329" PostTypeId="2" ParentId="13279" CreationDate="2016-12-30T21:18:33.160" Score="7" Body="&lt;p&gt;Actually, image resizing and alignment is still available in Redactor II&lt;br&gt;&#xA;&lt;sub&gt;(at least it is by now, might have been different a year ago)&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that in Reactor II both of those have to be enabled explicitly in the config. &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/images/#setting-imageResizable&quot; rel=&quot;noreferrer&quot;&gt;See Redactor docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft CMS you can modify the config in &lt;code&gt;craft/config/redactor&lt;/code&gt;. Or create a new file and select it in the Control Panel. &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;noreferrer&quot;&gt;More details&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;Standard.json&lt;/code&gt; looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [...],&#xA;    &quot;plugins&quot;: [...],&#xA;    &quot;imageResizable&quot;: true,&#xA;    &quot;imagePosition&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3920" LastActivityDate="2016-12-30T21:18:33.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18330" PostTypeId="1" CreationDate="2016-12-30T22:40:57.680" Score="3" ViewCount="351" Body="&lt;p&gt;I've used the front-end entry form in the docs to build a Q&amp;amp;A portal, and it's working great. But I'd like to extend the functionality once the new entry is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the entries up to not be enabled when saved so that a moderation team can later approve them. Is there a way for members of the moderator user group to receive an email every time someone publishes a new question via the front-end form?&lt;/p&gt;&#xA;" OwnerUserId="6066" LastActivityDate="2017-01-02T22:37:19.523" Title="Can I make the front-end entry form send an email to a user group?" Tags="&lt;emails&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18331" PostTypeId="1" AcceptedAnswerId="18334" CreationDate="2016-12-31T22:52:57.033" Score="0" ViewCount="294" Body="&lt;p&gt;I understand there's a lot of work being done on the Update Asset Indexes feature. I believe I've run into another issue related to MySQL, whereas other issues have been related to PHP's memory_limit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would appreciate some feedback on trying to address this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016/12/31 22:45:19 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`homeaidoc`.`craft_assetfolders`, CONSTRAINT `craft_assetfolders_parentId_fk` FOREIGN KEY (`parentId`) REFERENCES `craft_assetfolders` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_assetfolders` (`uid`, `parentId`, `sourceId`, `name`, `path`, `dateUpdated`, `dateCreated`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6).&#xA;2016/12/31 22:45:19 [error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`homeaidoc`.`craft_assetfolders`, CONSTRAINT `craft_assetfolders_parentId_fk` FOREIGN KEY (`parentId`) REFERENCES `craft_assetfolders` (`id`) ON DELETE CASCADE) in /var/www/craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 /var/www/craft/app/framework/db/ar/CActiveRecord.php(1081): CDbCommand-&amp;gt;execute()&#xA;#1 /var/www/craft/app/framework/db/ar/CActiveRecord.php(810): CActiveRecord-&amp;gt;insert(NULL)&#xA;#2 /var/www/craft/app/services/AssetsService.php(263): CActiveRecord-&amp;gt;save()&#xA;#3 /var/www/craft/app/assetsourcetypes/BaseAssetSourceType.php(1022): Craft\AssetsService-&amp;gt;storeFolder(Object(Craft\AssetFolderModel))&#xA;#4 /var/www/craft/app/assetsourcetypes/LocalAssetSourceType.php(121): Craft\BaseAssetSourceType-&amp;gt;ensureFolderByFullPath('development/emm...')&#xA;#5 /var/www/craft/app/services/AssetIndexingService.php(40): Craft\LocalAssetSourceType-&amp;gt;startIndex('cf59adea-fe2b-4...')&#xA;#6 /var/www/craft/app/tools/AssetIndexTool.php(94): Craft\AssetIndexingService-&amp;gt;getIndexListForSource('cf59adea-fe2b-4...', '1')&#xA;#7 /var/www/craft/app/controllers/ToolsController.php(50): Craft\AssetIndexTool-&amp;gt;performAction(Array)&#xA;#8 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ToolsController-&amp;gt;actionPerformAction()&#xA;#9 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#10 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#11 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#12 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('performAction')&#xA;#13 /var/www/craft/app/etc/web/WebApp.php(817): CWebApplication-&amp;gt;runController('tools/performAc...')&#xA;#14 /var/www/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#15 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#16 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#17 /var/www/public/index.php(19): require_once('/var/www/craft/...')&#xA;#18 {main}&#xA;REQUEST_URI=/index.php/admin/actions/tools/performAction&#xA;HTTP_REFERER=http://homeaidoc.craft.dev/admin/settings&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="731" LastActivityDate="2017-01-02T01:43:23.270" Title="Update Asset Index SQL Error" Tags="&lt;assets&gt;&lt;index&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18332" PostTypeId="1" AcceptedAnswerId="18398" CreationDate="2017-01-01T02:58:48.777" Score="2" ViewCount="370" Body="&lt;p&gt;I have a simple nav tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navConfig = {&#xA;    'startwithActive' : true,&#xA;    'maxDepth' : 2,&#xA;    'activeClassOnAncestors' : true,&#xA;    'ancestorActiveClass' : 'active',&#xA;} %}&#xA;    {% nav node in navigation %}&#xA;&#xA;      &amp;lt;li{% if node.class %} class=&quot;{{ node.class }}&quot;{% endif %}&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ node.link }}&quot;&amp;gt;{{ node.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;             &amp;lt;ul class=&quot;dropdown&quot;&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine all but with the News section entries. my-site/news adds the active class to the link, but my-site/news/new-entry doesn't add the class to the ancestor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried most configurations with the available parameters and variables, but I cannot work it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be brilliant!&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2017-01-05T14:27:59.903" Title="Active class on node with NAVEE" Tags="&lt;navigation&gt;&lt;menu&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18333" PostTypeId="2" ParentId="18328" CreationDate="2017-01-01T18:04:36.607" Score="5" Body="&lt;p&gt;The problem was that Frankfurt and London are not currently supported S3 bucket locations in Craft CMS v2.6.2956. Switching to Ireland solved my issue.&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2017-01-01T18:04:36.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18334" PostTypeId="2" ParentId="18331" CreationDate="2017-01-02T01:43:23.270" Score="1" Body="&lt;p&gt;That error indicates a problem with the data in your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft_assetfolders&lt;/code&gt; table has a &lt;code&gt;parentId&lt;/code&gt; column that is a foreign key reference to its own &lt;code&gt;id&lt;/code&gt; column.  For whatever reason, that &lt;code&gt;parentId&lt;/code&gt; column has a value that doesn't exist in any of the &lt;code&gt;id&lt;/code&gt; columns, hence your errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some common causes include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Someone manually editing database values.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A botched import/export script when backing up/restoring databases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Having multiple Craft installs (maybe across environments) pointing to the same cloud based Asset source (S3, Google Cloud, etc.) and someone deletes/moves/etc. an Asset on one environment making the other one out of sync with reality.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-02T01:43:23.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18335" PostTypeId="1" AcceptedAnswerId="18342" CreationDate="2017-01-02T11:18:26.520" Score="1" ViewCount="146" Body="&lt;p&gt;I want an endpoint in the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API plugin&lt;/a&gt; that shows the last event entries from the &lt;a href=&quot;https://venticalendar.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Venti Calendar&lt;/a&gt; plugin. The Element API guide tells that's possible to use the plugin with custom element types. But how? &lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2017-01-02T22:05:44.633" LastActivityDate="2017-01-03T04:33:17.053" Title="How do you use the Venti Calendar plugin with the Element API plugin?" Tags="&lt;plugin-elementapi&gt;&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18336" PostTypeId="2" ParentId="18320" CreationDate="2017-01-02T11:41:16.507" Score="1" Body="&lt;p&gt;I decided to do the translation in the template itself. So if the local is in Dutch but I want to use English:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dag = now|date('l' ) %}    &#xA;{% set maand = now|date('F' ) %}                                  &#xA;{% switch dag %}&#xA;    {% case &quot;maandag&quot; %}&#xA;       {% set EnDag = 'Monday' %}&#xA;    {% case &quot;dinsdag&quot; %}&#xA;        {% set EnDag = 'Tuesday' %}&#xA;    {% case &quot;woensdag&quot; %}&#xA;        {% set EnDag = 'Wednesday' %}&#xA;    {% case &quot;donderdag&quot; %}&#xA;        {% set EnDag = 'Thursday' %}&#xA;    {% case &quot;vrijdag&quot; %}&#xA;        {% set EnDag = 'Friday' %}&#xA;    {% case &quot;zaterdag&quot; %}&#xA;        {% set EnDag = 'Saturday' %}&#xA;    {% case &quot;zondag&quot; %}&#xA;        {% set EnDag = 'Sunday' %}&#xA;{% endswitch %}&#xA; {% switch maand %}&#xA;    {% case &quot;januari&quot; %}&#xA;       {% set EnMaand = 'January' %}&#xA;    {% case &quot;februari&quot; %}&#xA;        {% set EnMaand = 'February' %}&#xA;    {% case &quot;maart&quot; %}&#xA;        {% set EnMaand = 'March' %}&#xA;    {% case &quot;april&quot; %}&#xA;        {% set EnMaand = 'April' %}&#xA;    {% case &quot;mei&quot; %}&#xA;        {% set EnMaand = 'May' %}&#xA;    {% case &quot;juni&quot; %}&#xA;        {% set EnMaand = 'June' %}&#xA;    {% case &quot;juli&quot; %}&#xA;        {% set EnMaand = 'July' %}&#xA;    {% case &quot;augustus&quot; %}&#xA;        {% set EnMaand = 'August' %}&#xA;    {% case &quot;september&quot; %}&#xA;        {% set EnMaand = 'September' %}&#xA;    {% case &quot;oktober&quot; %}&#xA;        {% set EnMaand = 'October' %}&#xA;    {% case &quot;november&quot; %}&#xA;        {% set EnMaand = 'November' %}&#xA;    {% case &quot;december&quot; %}&#xA;        {% set EnMaand = 'December' %}&#xA;{% endswitch %}                                       &#xA;{# output the day #}&#xA;{{EnDag}}, {{EnMaand}} {{day.date.format('j, Y')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2017-01-02T14:38:52.000" LastActivityDate="2017-01-02T14:38:52.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18337" PostTypeId="1" AcceptedAnswerId="18341" CreationDate="2017-01-02T11:41:59.143" Score="1" ViewCount="374" Body="&lt;p&gt;For a Single section's entry type that has the title field hidden, I'd like to translate the generated title, as per the entry's locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've currently got the following in the entry type's &quot;Title Format&quot; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{section.name|t(language=locale)}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't translate the &lt;code&gt;section.name&lt;/code&gt; as per the entry's locale, it appears to use the current CP locale instead (i.e., if the CP is currently rendered in English, it'll use the English translation for entries in all locales). However, if I use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{section.name|t(language=locale)} ({locale})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the latter &lt;code&gt;locale&lt;/code&gt; value (inside the parenthesis) does reflect the entry's locale (it'll print something like &lt;code&gt;Section Name (no)&lt;/code&gt; for the Norwegian version. So that's a bit odd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I've tested with a hard coded string for the &lt;code&gt;t&lt;/code&gt; filter's &lt;code&gt;language&lt;/code&gt; parameter (i.e. &lt;code&gt;{section.name|t(language=&quot;no&quot;)}&lt;/code&gt;), which works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what's going on – though I'm guessing that the &lt;code&gt;locale&lt;/code&gt; variable passed to the translation filter is somehow &lt;code&gt;null&lt;/code&gt; (in which case Craft will use the current locale). How can I translate an entry type's Title Format based on the entry's locale?&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-03-14T12:59:32.370" Title="Translating a section's title field on save" Tags="&lt;localization&gt;&lt;singles&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18338" PostTypeId="1" AcceptedAnswerId="18339" CreationDate="2017-01-02T12:57:54.203" Score="1" ViewCount="67" Body="&lt;p&gt;I want to write an entire loop into a field like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SUZAY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SUZAY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this is not working. What would be the correct syntax when twig is written inside a field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is there a name for the twig tags inside a field? I have a hard time searching the interwebz for this.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-01-02T15:20:18.473" Title="loop trough whole array inside a field" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18339" PostTypeId="2" ParentId="18338" CreationDate="2017-01-02T15:20:18.473" Score="2" Body="&lt;p&gt;You can by using this: &lt;code&gt;{{ include(template_from_string(entry.fieldName)|raw) }}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also try it with just &lt;code&gt;|raw&lt;/code&gt; But that probably only works for just HTML&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works on both a Plain Textfield aswell on a Richtext area. Although I wouldn't recommend putting code in your textfield's like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original answer on a simular question can be found here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/1270/3848&quot;&gt;https://craftcms.stackexchange.com/a/1270/3848&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-01-02T15:20:18.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18340" PostTypeId="1" CreationDate="2017-01-02T16:52:24.980" Score="1" ViewCount="544" Body="&lt;p&gt;I am trying to filter entries based on multiple field value ranges.&#xA;For example: All entries where my &lt;code&gt;customField (type: number) is between 0 and 10 OR 20 and 25&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's straightforward to filter by one range:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;  customField: ['and', '&amp;gt;= 0', '&amp;lt; 10']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I add multiple ranges for the same field to the above query?&lt;/p&gt;&#xA;" OwnerUserId="1060" LastActivityDate="2017-05-04T23:41:49.603" Title="Filter entries by multiple field ranges" Tags="&lt;entries&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18341" PostTypeId="2" ParentId="18337" CreationDate="2017-01-02T19:49:35.960" Score="2" Body="&lt;p&gt;Figured out something that works, though I can't explain why:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.section.name|t(language=object.locale) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to do it for Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.section.name|t('site', language=object.site.language) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-03-14T12:59:32.370" LastActivityDate="2018-03-14T12:59:32.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18342" PostTypeId="2" ParentId="18335" CreationDate="2017-01-02T22:09:47.047" Score="2" Body="&lt;p&gt;I don't have the Venti Calendar plugin, so I can't test this, but it should be as simple as setting the &lt;code&gt;elementType&lt;/code&gt; propety to whatever custom element type the plugin has created and you want to use and (optionally) setting any criteria you want defined by the element type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Venti_Event',&#xA;            'criteria' =&amp;gt; ['key' =&amp;gt; 'value'], &#xA;            'transformer' =&amp;gt; function(Venti_EventModel $eventModel) {&#xA;                return [&#xA;                    'key' =&amp;gt; $eventModel-&amp;gt;property,&#xA;                ];&#xA;            },&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-01-03T04:33:17.053" LastActivityDate="2017-01-03T04:33:17.053" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18343" PostTypeId="2" ParentId="18330" CreationDate="2017-01-02T22:37:19.523" Score="2" Body="&lt;p&gt;You can write a simple &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listens for the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveEntry&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that event fires, you plugin could check the &lt;code&gt;$isNewEntry&lt;/code&gt; param to make sure it's a new entry being saved and also check the entry's section to make sure it's the front-end section you're expecting and might as well check &lt;code&gt;craft()-&amp;gt;request-&amp;gt;isSiteRequest()&lt;/code&gt; to make sure it's a front-end request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all of those match, you would get the users in a group, then loop through all of them sending an email with &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;email-&amp;gt;sendEmail()&lt;/code&gt;&lt;/a&gt; for each user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like (pseudocode):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element = craft()-&amp;gt;elements-&amp;gt;getElementType(ElementType::Users);&#xA;$element-&amp;gt;group = 'groupHandle';&#xA;$users = $element-&amp;gt;find();&#xA;&#xA;foreach ($users as $user)&#xA;{&#xA;    // compose email body, header, etc.&#xA;    $success = craft()-&amp;gt;email-&amp;gt;sendEmail($email, $variables);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-02T22:37:19.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18344" PostTypeId="1" AcceptedAnswerId="18347" CreationDate="2017-01-02T23:01:24.397" Score="1" ViewCount="107" Body="&lt;p&gt;I am building a site for a travel agency. Each agent needs to have his/her own public profile page. I want each agent's profile page to be accessed at &lt;code&gt;agencyname.com/agentname&lt;/code&gt;, with &lt;code&gt;agentname&lt;/code&gt; being the agent's username. This would load an agent profile template populated with the given agent's profile data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still need other non-agent segment-1 pages to continue working also, like &lt;code&gt;agencyname.com/cruises&lt;/code&gt; or &lt;code&gt;agencyname.com/group-travel&lt;/code&gt;. These would be 'normal' template pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to make this work dynamically? Creating a dynamic route with only a token in Segment 1 breaks access to other regular pages. I don't want to have to create a hard route every time we add an agent, and we don't want to add another segment like &lt;code&gt;agencyname.com/agent/agentname&lt;/code&gt;. We want the URL each agent puts on their business card to be as clean and easy to remember as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking something along the lines of this logic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;If Segment 1 matches a username&#xA;   Display the profile template for that user&#xA;Else&#xA;   Continue routing per the normal routing checks&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't have the knowledge to build a plugin, or the budget for someone else to. I'm seeking solutions that could be implemented without a plugin (unless there's already a plugin available).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any constructive thoughts are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="3682" LastEditDate="2017-01-02T23:08:34.210" LastActivityDate="2017-01-03T07:45:54.930" Title="Route to User page from first segment" Tags="&lt;routes&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18346" PostTypeId="2" ParentId="18167" CreationDate="2017-01-03T05:50:33.197" Score="2" Body="&lt;p&gt;This post by Andrew Welch includes a pretty comprehensive example of a &quot;load more&quot; function to dyamically load entries from the Element API: &lt;a href=&quot;https://nystudio107.com/blog/lazy-loading-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/lazy-loading-with-the-element-api-vuejs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2017-01-03T05:50:33.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18347" PostTypeId="2" ParentId="18344" CreationDate="2017-01-03T07:36:23.983" Score="2" Body="&lt;p&gt;You could add a check at the top of all of your templates that tests if the first uri segment matches one the agent names.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstSegment = craft.request.firstSegment %}&#xA;{% set agents = craft.users.group('agents') %}&#xA;{% for agent in agents %}&#xA;    {% set agentName = agent.firstName ~ &quot;-&quot; ~ agent.lastName %}&#xA;    {% if firstSegment == agentName %}&#xA;        {% set requestedAgent = agent %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if requestedAgent is defined %}&#xA;    {% include 'users/_profile' with { user: requestedAgent } only %}&#xA;{% else %}&#xA;    {% extend 'layouts/_main' %}&#xA;&#xA;    ... normal page template goes here&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your profile template you should now have a variable 'user' available with the requested agent.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    &amp;lt;h1&amp;gt;{% user.firstName %} {% user.lastName %}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2017-01-03T07:45:54.930" LastActivityDate="2017-01-03T07:45:54.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18348" PostTypeId="1" AcceptedAnswerId="18364" CreationDate="2017-01-03T08:34:01.917" Score="2" ViewCount="433" Body="&lt;p&gt;I currently have checkboxes in a matrix block that allow a user to select where an image will be placed in the layout (as a featured slider image and/or in an image gallery). I've gotten the slider image to function but if, for some reason, there are no featured images I have a couple of unnecessary &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags. Because I am selecting only featured images from the matrix block I can not use &lt;code&gt;loop.first&lt;/code&gt; and &lt;code&gt;loop.last&lt;/code&gt; to move those divs in my for loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had seen an article that seems close to finding the answer to my problem here : &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8915/only-execute-twig-block-if-a-matrix-radio-has-a-certain-value&quot;&gt;Only execute twig block if a Matrix radio has a certain value&lt;/a&gt; but I haven't been able to make it work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Add Feature Images - Slideshow #}&#xA;    {% set photos = entry.photoGallery.type( 'photos' ) %}&#xA;    {% if photos|length %}&#xA;    &amp;lt;div class=&quot;row&quot; &amp;gt;&#xA;            &amp;lt;div class=&quot;slidr&quot;&amp;gt;&#xA;                {% for block in photos if block.imageLocation.contains('featured')%}&#xA;                    {# Get the photo #}&#xA;                    {% for photo in block.photo %}&#xA;                      &amp;lt;div class=&quot;figure&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ photo.getUrl }}&quot;&amp;gt;&#xA;                          &amp;lt;img src=&quot;{{ photo.getUrl('projectHero') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                        {# Get the caption #}&#xA;                        {% if block.caption|length %}&#xA;                          &amp;lt;div class=&quot;caption&quot;&amp;gt;{{ block.caption }}&amp;lt;/div&amp;gt;&#xA;                        {% endif %}&#xA;                      &amp;lt;/div&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've attached a screen snapshot of my field setup.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hXE8O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hXE8O.png&quot; alt=&quot;screen snapshot of matrix field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6075" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2018-06-06T06:27:13.700" Title="Only executing if a matrix checkbox has a specific value" Tags="&lt;matrix&gt;&lt;checkboxes&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18349" PostTypeId="1" AcceptedAnswerId="18352" CreationDate="2017-01-03T08:38:25.823" Score="2" ViewCount="325" Body="&lt;p&gt;I'm building a shop using Craft Commerce where a single product can be assigned to multiple categories. The url structure I'm using for the product detail page is: &lt;a href=&quot;http://domain.com/category/product-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/category/product-url&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an effort to avoid being penalised for duplicate content I would like to set the canonical URL for my product detail page by always pulling the first category as the canonical URL in the meta. I've tried a few things but keep getting stuck - any tips ? &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-01-03T11:47:41.843" Title="Canonical url for product with multiple categories" Tags="&lt;categories&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18350" PostTypeId="1" AcceptedAnswerId="18697" CreationDate="2017-01-03T09:16:30.500" Score="1" ViewCount="278" Body="&lt;p&gt;I'm trying to implement a sort order in my product listings so that all of the out of stock products are last.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure how or if this is possible because the stock is set on the variants of a product and I'm listing the products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stock level would need to take into account the stock of all the products variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know we have the ability to only fetch products that have stock with the criteria &lt;code&gt;hasVariant: { hasStock: true }&lt;/code&gt;, but is there a way I can sort them using the &lt;code&gt;.order()&lt;/code&gt; criteria?&lt;/p&gt;&#xA;" OwnerUserId="4466" LastEditorUserId="91" LastEditDate="2017-03-14T04:01:48.347" LastActivityDate="2018-03-29T00:01:13.760" Title="Ordering/sorting products by their variant stock level" Tags="&lt;plugin-craftcommerce&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18351" PostTypeId="2" ParentId="18348" CreationDate="2017-01-03T11:37:25.633" Score="2" Body="&lt;p&gt;It looks as though you have the following line wrong:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for block in photos if block.imageLocation.contains('featured') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to use the field name you're using to filter the Matrix block in place of &lt;code&gt;contains&lt;/code&gt;. The following line will only loop through block with the &lt;code&gt;imageLocation&lt;/code&gt; field set to &quot;featured&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for block in photos.imageLocation('featured') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-03T11:37:25.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18352" PostTypeId="2" ParentId="18349" CreationDate="2017-01-03T11:47:41.843" Score="2" Body="&lt;p&gt;You should be able to use &lt;code&gt;{{ entry.categoryFieldHandle[0].slug }}&lt;/code&gt;. The &lt;code&gt;[0]&lt;/code&gt; simply grabs the first category in the field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to make sure there is always at least one category allocated to an entry or you'll get an error.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-03T11:47:41.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18353" PostTypeId="1" CreationDate="2017-01-03T12:11:02.580" Score="2" ViewCount="99" Body="&lt;p&gt;I'm using a form using Sprout Forms plugin. This form is set for &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/submitting-a-form-via-ajax&quot; rel=&quot;nofollow noreferrer&quot;&gt;submitting via AJAX&lt;/a&gt;. The documentation explains &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/translating-error-messages&quot; rel=&quot;nofollow noreferrer&quot;&gt;how to translate error message&lt;/a&gt;, but this is not working via AJAX submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, the primary language of this website is French. While the site is browsed in English or Dutch, it still shows AJAX errors in French.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get Sprout Forms errors in current language using AJAX?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-10-13T08:55:27.220" Title="How can I get Sprout Forms errors in current language using AJAX?" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18354" PostTypeId="1" AcceptedAnswerId="18355" CreationDate="2017-01-03T13:03:41.037" Score="4" ViewCount="401" Body="&lt;p&gt;I've been tasked with adding a column to the Entries screen to show some custom data that gets saved against each new post. To do this, I've edited &lt;code&gt;craft/app/elementtypes/EntryElementType.php&lt;/code&gt; and added a new table attribute, which does what I need and shows the column.*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm wary though that updating Craft involves removing the &lt;code&gt;/app&lt;/code&gt; directory and replacing it with the one from the latest release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an advised way I should make tweaks to core files like the one I mentioned? Or, is the only solution to do something like...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add PHP comments around any core code I tweak&lt;/li&gt;&#xA;&lt;li&gt;When preparing for an update, compare the old &lt;code&gt;/app&lt;/code&gt; against the new one in GitHub&lt;/li&gt;&#xA;&lt;li&gt;From there, search through the changes to find the comments I've added&lt;/li&gt;&#xA;&lt;li&gt;For each comment I find, I should manually recreate the changes in the correct places within the new version of &lt;code&gt;/app&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;* Just to clarify, I was using an older version of Craft when I wrote this post. Having updated to 2.6, I now see that choosing which columns to show on the Entries screen is a baked-in feature. Nice :)&lt;/p&gt;&#xA;" OwnerUserId="6078" LastEditorUserId="45" LastEditDate="2017-01-03T17:47:33.690" LastActivityDate="2017-01-03T21:36:01.933" Title="The safest way to edit core Craft files?" Tags="&lt;extends&gt;&lt;editing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18355" PostTypeId="2" ParentId="18354" CreationDate="2017-01-03T13:40:43.343" Score="11" Body="&lt;p&gt;You should &lt;strong&gt;never&lt;/strong&gt; edit the core files (i.e. anything below /app), because whatever changes you add might be overwritten any time Craft is updated – or even worse, your amendments might conflict with new features added in Craft updates to a different part of the codebase; crashing your entire site. Seriously, don't do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever you need Craft to do something that it doesn't do out of the box, your options are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Installing an off-the-shelf plugin, of which &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;there are many&lt;/a&gt;&lt;br&gt;&#xA;– &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Writing a plugin yourself&lt;/a&gt; (which &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;shouldn't be too hard&lt;/a&gt;, if you have PHP experience)&lt;br&gt;&#xA;– &lt;a href=&quot;https://straightupcraft.com/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Finding&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;someone&lt;/a&gt; &lt;a href=&quot;https://www.workwithcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;else&lt;/a&gt; to build your custom plugin&lt;br&gt;&#xA;– &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adding a feature request&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do need to write a custom plugin, probably the most important thing to know about are &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;hooks and events&lt;/em&gt;&lt;/a&gt;, which offer ways to hook into and act upon various parts of the Craft internals and request lifecycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, &lt;em&gt;I believe your current use case could be easily solved by creating a small custom plugin&lt;/em&gt; with the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#defineAdditionalEntryTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;defineAdditionalEntryTableAttributes&lt;/code&gt;&lt;/a&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how that could look, assuming your custom property is named &lt;code&gt;customProperty&lt;/code&gt; (the following would go into your plugin's primary class, e.g. &lt;code&gt;myplugin/MyPluginPlugin.php&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAdditionalEntryTableAttributes()&#xA;{&#xA;    return array(&#xA;        'customProperty' =&amp;gt; &quot;Custom label&quot;,&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above, you'll be able to simply add your custom property to the relevant element indexes via the little cogwheel below your Sections, under Entries inside the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more control over how the custom property renders (for instance, if the property returns a non-String value, you want to wrap the property value in some HTML, or you need to account for the custom property not being set for all entries, etc), you can use the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getEntryTableAttributeHtml&lt;/code&gt;&lt;/a&gt; hook to refine things:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)&#xA;{&#xA;    if ($attribute == 'customProperty' &amp;amp;&amp;amp; isset($entry-&amp;gt;customProperty))&#xA;    {&#xA;        return '&amp;lt;span class=&quot;some-class-name&quot;&amp;gt;'.$entry-&amp;gt;customProperty[0].'&amp;lt;/span&amp;gt;';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-01-03T21:36:01.933" LastActivityDate="2017-01-03T21:36:01.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18356" PostTypeId="1" CreationDate="2017-01-03T15:00:53.720" Score="1" ViewCount="285" Body="&lt;p&gt;I have a custom fieldtype for Craft which stores its value as an array of Models using AttributeType::Mixed. See below for an example of the FieldType and Model setup &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyCustomFieldType extends BaseFieldType&#xA;{&#xA;    public function defineContentAttribute()&#xA;    {&#xA;        return AttributeType::Mixed;&#xA;    }&#xA;} &#xA;&#xA;class MyCustomModel extends BaseModel&#xA;{&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'url'      =&amp;gt; AttributeType::String,&#xA;            'category' =&amp;gt; AttributeType::String&#xA;        );&#xA;    } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when the value is persisted, it's saved as an array, which Craft natively saves as JSON&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$values = [new MyCustomModel(), new MyCustomModel(), ...];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To display the value in Twig I can do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.myCustomField %}&#xA;    {{ item.category }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, how can I only display the elements in my field which have a specific attribute value? For example, if I wanted to display only those items with a category of main, where 'category' is an attribute on my model?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.myCustomField.category('main') %}&#xA;    {{ item.category }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6077" LastActivityDate="2017-01-25T14:24:27.220" Title="Filtering values from Twig for my custom field type" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18357" PostTypeId="1" CreationDate="2017-01-03T15:48:33.740" Score="1" ViewCount="62" Body="&lt;p&gt;I have a white paper PDF file that I want visitors to be able to download, but only after they've submitted a form with their contact information. How can I do this in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm using the Sprout Forms plugin to build a form, and I've set the redirect for the form to a template containing the download link. This does work, but seems clunky, and any visitor who has the URL for the download page can visit it without submitting the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I require a form submission before displaying the template with the download link to the visitor?&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2017-01-04T20:47:54.717" Title="How to require form submission before template display?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18358" PostTypeId="1" AcceptedAnswerId="18360" CreationDate="2017-01-03T16:02:28.137" Score="1" ViewCount="2227" Body="&lt;p&gt;I'm trying to set up a basic PHP Mail setup with Craft. I really just need it set up to handle new account activation e-mails. I can't seem to find any instructions on the Craft site or elsewhere on how to set this up specifically for Craft. Does Craft require any specific configuration for PHP Mail to work? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2018-07-09T13:37:51.493" Title="Configuring email (PHP Mail) with Craft" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18359" PostTypeId="1" AcceptedAnswerId="18361" CreationDate="2017-01-03T18:21:07.737" Score="1" ViewCount="217" Body="&lt;p&gt;I would like to configure the rich text editor in Entries-&gt;Singles content blocks like I do in my plugins and forms.  I know I can configure Redactor config within the /craft/config/redactor directory, but that does not impact the editor within //admin/entries/.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is the config for the admin entries editor?  &lt;/p&gt;&#xA;" OwnerUserId="3597" LastActivityDate="2017-01-04T19:48:27.530" Title="Configure the &quot;Entries&quot; HTML Editor?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18360" PostTypeId="2" ParentId="18358" CreationDate="2017-01-03T18:35:48.357" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does Craft require any specific configuration for PHP Mail to work?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No.  Craft assumes that &lt;a href=&quot;https://secure.php.net/manual/en/book.mail.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP's mail&lt;/a&gt; function is already working if that's what you've selected under Settings-&gt;Email in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't mention what the actual problem you're having is (i.e. getting an error message or email not being delivered, etc.), but there is a support article here that can help you debug both of those issues: &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-03T18:35:48.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18361" PostTypeId="2" ParentId="18359" CreationDate="2017-01-03T18:45:21.800" Score="1" Body="&lt;p&gt;If I'm understanding you correctly, you've got a Rich Text field you're using in one of your Single's field layouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That Rich Text field will have settings (under Settings-&gt;Fields-&gt;(click on the Rich Text field you're using for that single)).  From there, you can select the specific &lt;code&gt;craft/config/redactor/config.json&lt;/code&gt; config file you'd like that specific Rich Text field to use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-03T18:45:21.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18362" PostTypeId="1" CreationDate="2017-01-03T19:20:29.910" Score="0" ViewCount="46" Body="&lt;p&gt;The client has unfortunately deleted some orders from the Craft Commerce plugin. Does anyone know if it's possible to recreate deleted orders?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2017-01-03T19:21:47.943" LastActivityDate="2017-01-03T19:24:54.757" Title="Recreate deleted orders?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18363" PostTypeId="2" ParentId="18362" CreationDate="2017-01-03T19:24:54.757" Score="1" Body="&lt;p&gt;Your best bet would be to find a database backup that has the order information that was deleted and write a script that re-inserts that order info into your existing database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-03T19:24:54.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18364" PostTypeId="2" ParentId="18348" CreationDate="2017-01-03T19:49:41.103" Score="1" Body="&lt;p&gt;I've managed to get things working but I'm not sure if there is a better way of doing this. Any feedback is welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the new code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# Grab all the photo entries #}&#xA;    {% set photos = entry.photoGallery.type( 'photos' ) %}&#xA;&#xA;    {# create a blank array to merge content #}&#xA;    {% set selectedFeaturedImages = [] %}&#xA;&#xA;    {% for block in photos %}&#xA;        {# Add Featured Images to an array #}&#xA;        {% if block.imageLocation.contains('featured') %}&#xA;            {% set selectedFeaturedImages = selectedFeaturedImages|merge([block]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for block in selectedFeaturedImages %}&#xA;        {% if loop.first %}&#xA;        &amp;lt;div class=&quot;row&quot; &amp;gt;&#xA;            &amp;lt;div class=&quot;columns&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;slidr&quot;&amp;gt;&#xA;        {% endif %}&#xA;&#xA;            {% for photo in block.photo %}&#xA;        &amp;lt;div class=&quot;figure&quot;&amp;gt;&amp;lt;a href=&quot;{{ photo.getUrl }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ photo.getUrl('projectHero') }}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {# Get the caption #}&#xA;            {% if block.caption|length %}&#xA;            &amp;lt;div class=&quot;caption&quot;&amp;gt;{{ block.caption }}&amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        {% if loop.last %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6075" LastActivityDate="2017-01-03T19:49:41.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18365" PostTypeId="1" CreationDate="2017-01-03T21:21:14.777" Score="1" ViewCount="71" Body="&lt;p&gt;I have a custom donation form that I'm using that includes some custom Craft fields. Two of those fields are dropdowns which I populated with options from within my Craft admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is a custom form, it must use Stripe.js, so I have the following lines in my template per the &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/usage/quickstart/using-stripe-js&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial on the SquareBit&lt;/a&gt; site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource('charge/js/stripe_v2.min.js') %}&#xA;{% includeJsResource('charge/js/jquery.charge.js') %}&#xA;{% includejs %}&#xA;    $(this).charge();&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are my Payment options that are set inside the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; declaration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set chargePaymentOptions = { 'allowDynamic' : true, 'planCurrency': 'usd', } %}&#xA;&#xA;{{ craft.charge.setPaymentOptions(chargePaymentOptions) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I borrowed some code from the Charge plugin examples for initializing the select fields like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.selectField({&#xA;     label: 'Donation Recurrence',&#xA;     name: 'donationRecurrence',&#xA;     id: 'donationRecurrence',&#xA;     options: (charge is defined ? charge.donationRecurrence.options),&#xA;     value: (charge is defined ? charge.donationRecurrence),&#xA;     errors: (charge is defined ? charge.getErrors('donationRecurrence'))&#xA;}) }}&#xA;&#xA;{{ forms.selectField({&#xA;     label: 'Would you like to donate to a specific cause?',&#xA;     name: 'donationDesignation',&#xA;     id: 'donationDesignation',&#xA;     options: (charge is defined ? charge.donationDesignation.options),&#xA;     value: (charge is defined ? charge.donationDesignation),&#xA;     errors: (charge is defined ? charge.getErrors('donationDesignation'))&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, the select fields get their options from the aforementioned pre-populated custom Craft fields. Those options do &lt;em&gt;not&lt;/em&gt; show up on &lt;em&gt;first&lt;/em&gt; page load, but if the form is subsequently submitted and comes back with errors, then the select field options appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured out that on the first page load, doing a &lt;code&gt;dump(charge)&lt;/code&gt; shows that the &lt;code&gt;charge&lt;/code&gt; object does not exist until the page has been reloaded after the form was submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="5997" LastEditorUserId="5997" LastEditDate="2017-01-04T14:01:09.317" LastActivityDate="2017-01-04T22:36:50.943" Title="Charge object not available on first page load" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18367" PostTypeId="1" AcceptedAnswerId="18368" CreationDate="2017-01-04T01:56:04.683" Score="1" ViewCount="96" Body="&lt;p&gt;Curious if anyone else has encountered this error with their Sprout Forms; I'm working on some redesigns to a site that uses Sprout Forms for their contact page but whenever I go to add or modify a field the modal window is blank. &lt;a href=&quot;https://i.stack.imgur.com/hUDsE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hUDsE.png&quot; alt=&quot;blank modal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6084" LastActivityDate="2017-01-04T06:31:47.350" Title="Sprout Forms Issue" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2017-01-04T22:49:59.753" ContentLicense="CC BY-SA 3.0" />
  <row Id="18368" PostTypeId="2" ParentId="18367" CreationDate="2017-01-04T06:31:47.350" Score="2" Body="&lt;p&gt;The likely cause of this behavior is a conflict with another plugin you have installed. So far, this has typically been because of a bug in another plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try disabling or uninstalling the other plugins you have installed in a test environment and see if you can track down a specific plugin that causes the issue. It's likely that some code will need to be updated to fix the issue either via a bug report or manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you get stuck or are not comfortable with troubleshooting what might be happening in the code, please reach out to &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/request/support&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout support&lt;/a&gt; and we can help troubleshoot. We'll likely need to know more details about what the other plugin in question is doing and see the code.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-01-04T06:31:47.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18369" PostTypeId="1" AcceptedAnswerId="18370" CreationDate="2017-01-04T07:50:07.913" Score="1" ViewCount="886" Body="&lt;p&gt;I've just launched my &lt;a href=&quot;https://www.madebydusk.com/portfolio/the-norway-collection&quot; rel=&quot;nofollow noreferrer&quot;&gt;new site here&lt;/a&gt; and I'm playing around with the caching options with Craft. I'm hosting my site with Siteground which gives me access to their Supercacher option, it offers Static cache and Memcached, both of which I have enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have configured Craft to use Memcached via the general.php config file &lt;code&gt;'cacheMethod' =&amp;gt; 'memcache'&lt;/code&gt; and placed the memcache.php file into the config directory as well with &lt;code&gt;'useMemcached' =&amp;gt; true,&lt;/code&gt; set to true and my host to &lt;code&gt;'host' =&amp;gt; 127.0.0.1,&lt;/code&gt; plus the correct port that is provided by my host. I've also got Cloudflare CDN running which is taking care of a lot of the heavy lifting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also wrapped &lt;code&gt;{% cache %}&lt;/code&gt; tags around the mainly static content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm still left feeling slightly uneasy about my TTFB and site performance, so I have some questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Should the IP address for &lt;code&gt;'host'&lt;/code&gt; in memcache.php be wrapped with quotes? I saw &lt;code&gt;&quot;localhost&quot;&lt;/code&gt; was in the default file but typically IP addresses are not, so I didn't&lt;/li&gt;&#xA;&lt;li&gt;My TTFB has been wildly inconsistent, ranging anywhere between 200ms up to 2s. What is the best way to troubleshoot such an issue with Craft? Or is this more of a host issue?&lt;/li&gt;&#xA;&lt;li&gt;I'm using AJAX page transitions based off this article: &lt;a href=&quot;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate&lt;/a&gt; - could this be messing things up?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I appreciate any feedback or pointers people may offer because I'm feeling a little lost/overwhelmed at the moment. cheers!&lt;/p&gt;&#xA;" OwnerUserId="6086" LastEditorUserId="22" LastEditDate="2017-05-09T20:39:06.993" LastActivityDate="2017-05-09T20:39:06.993" Title="Caching and TTFB with Craft" Tags="&lt;cache&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18370" PostTypeId="2" ParentId="18369" CreationDate="2017-01-04T08:21:18.753" Score="3" Body="&lt;p&gt;This isn't an issue with Craft, from the POV that the TTFB should be pretty consistent.  How are you testing it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess would be that the issue is with your hosting. These two articles may help you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/a-pretty-website-isnt-enough#objective-testing-is-the-key&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Pretty Website Isn't Enough&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Run some of the diagnostic tests listed in the second article.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-01-04T08:21:18.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18371" PostTypeId="1" AcceptedAnswerId="18460" CreationDate="2017-01-04T08:59:08.350" Score="1" ViewCount="80" Body="&lt;p&gt;If I set an expiry date for an entry I get an error on one of the last lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$timePicker.timepicker('setTime', Name of edit section as shown to the user*3600 + 00*60 + 00);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've traced this back to &lt;code&gt;craft/app/templates/_includes/forms/time.hml:39&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$timePicker.timepicker('setTime', {{ value|date('G') }}*3600 + {{ value|date('i') }}*60 + {{ value|date('s') }});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't understand why &lt;code&gt;value|date('G')&lt;/code&gt; returns &lt;code&gt;Name of edit section as shown to the user&lt;/code&gt; instead of an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might also mention that this site uses Norwegian locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rWhub.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rWhub.png&quot; alt=&quot;Error in console&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KVuFJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVuFJ.png&quot; alt=&quot;Line causing the error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3563" LastEditorUserId="3563" LastEditDate="2017-01-09T22:57:22.883" LastActivityDate="2017-01-10T09:47:00.197" Title="Javascript issue when setting an expiry date for entry" Tags="&lt;javascript&gt;&lt;editing&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18372" PostTypeId="1" AcceptedAnswerId="18373" CreationDate="2017-01-04T11:14:41.550" Score="1" ViewCount="116" Body="&lt;p&gt;I have created a PDF template for orders and this works fine on the front-end. However, when I click to Download  PDF through the admin panel in an order. I get an error that:&#xA;&lt;code&gt;Variable &quot;companyInfo&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;companyInfo is a global field - I am using it to populate the company invoice details like so;&#xA;&lt;code&gt;{{ companyInfo.companyName }}&lt;/code&gt; (there are several of these).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this is an issue on the back-end and not the front-end and how to resolve?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-01-04T12:19:18.957" Title="Order PDF in back-end error with Globals" Tags="&lt;plugin-craftcommerce&gt;&lt;globals&gt;&lt;order&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18373" PostTypeId="2" ParentId="18372" CreationDate="2017-01-04T11:34:01.917" Score="4" Body="&lt;p&gt;Since the templates are rendered on the server and not in a regular http request (in the front end templates), the globals are not loaded automatically, into the global twig namespace. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can still access your global set and use it as you usually would by setting it to a variable. You can do so like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set companyInfo = craft.globals.getSetByHandle('companyInfo') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ companyInfo.fieldNameHere }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-01-04T12:19:18.957" LastActivityDate="2017-01-04T12:19:18.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18374" PostTypeId="1" AcceptedAnswerId="18375" CreationDate="2017-01-04T13:48:13.640" Score="2" ViewCount="5991" Body="&lt;p&gt;I've written a custom plugin that stores data as &lt;code&gt;JSON&lt;/code&gt; in a &lt;code&gt;TEXT&lt;/code&gt; column (&lt;code&gt;field_gridcontrol&lt;/code&gt;) in Craft's content table that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;id&quot;: &quot;35&quot;, // id is an element's id&#xA;    &quot;classes&quot;: &quot;item w1 h2&quot;, // classes to add to the dom element&#xA;    &quot;x&quot;: 0 // x coordinate on where it shows up in a grid&#xA;  },&#xA;  {&#xA;    &quot;id&quot;: &quot;56&quot;,&#xA;    &quot;classes&quot;: &quot;item w2 h2&quot;,&#xA;    &quot;x&quot;: 0.25&#xA;  },&#xA;  {&#xA;    &quot;id&quot;: &quot;24&quot;,&#xA;    &quot;classes&quot;: &quot;item w1 h1&quot;,&#xA;    &quot;x&quot;: 0.75&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can print this as a string &lt;code&gt;{{entry.fieldcontrol}}&lt;/code&gt;, which is all well and good, but I'd like to be able to loop through it as an object like a traditional &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;element criteria model&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for block in entry.gridcontrol %}&#xA;  {% set entry = craft.entries.id(block.id) %}&#xA;  &amp;lt;li class=&quot;{{block.classes}}&quot; style=&quot;left:{{block.x}}%&quot;&amp;gt;&#xA;    {{entry.title}}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when I try this I don't get any errors, just an empty &lt;code&gt;ul&lt;/code&gt;. I guess this is because it's not seeing gridcontrol as an object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Did I go about structuring this the wrong way? I've seen other plugins, like &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;nystudio107's SEOmatic&lt;/a&gt;, &lt;a href=&quot;https://cl.ly/2S2v06332k0n/Screen%20Shot%202017-01-04%20at%208.43.59%20AM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;that store data this way&lt;/a&gt;. Or am I missing something super silly to get this up and running?&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2017-01-05T22:18:28.873" Title="Loop through JSON object in Twig from the database" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18375" PostTypeId="2" ParentId="18374" CreationDate="2017-01-04T13:52:39.313" Score="3" Body="&lt;p&gt;You'll simply need to decode the JSON string. Unfortunately, Twig doesn't ship with a &lt;code&gt;json_decode&lt;/code&gt; filter, but there's &lt;a href=&quot;https://github.com/diit/Json-Decode-Twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;a plugin&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you'd use it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for block in entry.gridcontrol|json_decode %}&#xA;  {% set entry = craft.entries.id(block.id) %}&#xA;  &amp;lt;li class=&quot;{{ block.classes }}&quot; style=&quot;left:{{ block.x }}%&quot;&amp;gt;&#xA;    {{ entry.title }}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-01-05T22:18:28.873" LastActivityDate="2017-01-05T22:18:28.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18376" PostTypeId="1" AcceptedAnswerId="18377" CreationDate="2017-01-04T15:19:02.080" Score="1" ViewCount="401" Body="&lt;p&gt;after searching around for awhile I still cannot find a clear answer to templating Supertables within a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a field called 'about' which is the matrix field, within that there is a block called 'biography' which holds both a Rich Text Field called 'copy', and a SuperTable field called hgroup, within hgroup there is a plain text field called heading. How do I go about outputting these within the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other blocks, similar to 'biography', but I'm encountering the same issue with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still very new to CraftCMS so some of this has me puzzled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;  {% for block in entry.about %}&#xA;    {% switch entry.about %}&#xA;        {% case 'biography' %}&#xA;          &amp;lt;section&amp;gt;&#xA;            &amp;lt;div class=&quot;contain&quot;&amp;gt;&#xA;              &amp;lt;article&amp;gt;&#xA;                {% for row in entry.hgroup %}&#xA;                  &amp;lt;header&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ entry.heading }}&amp;lt;/h3&amp;gt;&#xA;                  &amp;lt;/header&amp;gt;&#xA;                {% endfor %}&#xA;                  {{ entry.copy }}&#xA;              &amp;lt;/article&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/section&amp;gt;&#xA;    {% endswitch %}&#xA;  {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5390" LastActivityDate="2017-01-09T14:56:09.083" Title="Outputting supertables within a matrix" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;craft-features&gt;&lt;plugin-supertable&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18377" PostTypeId="2" ParentId="18376" CreationDate="2017-01-04T16:31:32.487" Score="1" Body="&lt;p&gt;I think your output is wrong. Looking at your code and explanation, &lt;code&gt;{% for row in entry.hgroup %}&lt;/code&gt; should be: &lt;code&gt;{% for row in block.hgroup %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same goes for &lt;code&gt;{{ entry.heading }}&lt;/code&gt; This should be: &lt;code&gt;{{ row.heading }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Copy should be: &lt;code&gt;{{ block.copy }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working with matrixes and Supertable's is hard in the beginning but you'll get the hang of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you loop over you &lt;code&gt;{{ entry.about }}&lt;/code&gt; you loop using a variable named &lt;code&gt;block&lt;/code&gt;. that should be used for every field you want to output that's in the matrix field. Same goes for SuperTable's only just one layer deeper.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-01-04T16:31:32.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18379" PostTypeId="1" AcceptedAnswerId="18385" CreationDate="2017-01-04T17:39:39.313" Score="1" ViewCount="293" Body="&lt;p&gt;I'm not certain if this is possible but what we want to do is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have an admin register a new user in the admin, including a password for them so that they can pass along these credentials along via offline channels - and then that user will log into a front end client area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think it's possible to add a password - which surprises me in terms of use-cases needing to manage new users subscriptions by someone else and wanting disseminate specific credentials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, is it possible to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Register the new member in the admin (without a password)&lt;/li&gt;&#xA;&lt;li&gt;Have a custom Activate Account email confirmation go to them to finish their account signup, prompting them to go to:&lt;/li&gt;&#xA;&lt;li&gt;A page where they can complete this, adding their new password and then logging them into their client account area&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-01-04T19:55:48.470" Title="Register front end member from admin area with password" Tags="&lt;users&gt;&lt;registration&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18380" PostTypeId="1" AcceptedAnswerId="18382" CreationDate="2017-01-04T17:40:17.387" Score="0" ViewCount="354" Body="&lt;p&gt;I want to integrate Waypoints JS's Infinite Scroll instead of using traditional pagination.  I think the Straight Up Craft site uses this approach on its blog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How might you template the following HTML to work with CraftCMS?  I know how to limit or not limit the number of entries, but how do you template to load each successive group of (say) 12 entries as you reach a waypoint - that is the &quot;infinite-more-link&quot;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;infinite-container&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;infinite-item&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;infinite-item&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;infinite-item&quot;&amp;gt;&#xA;...&amp;lt;/div&amp;gt;&#xA;&amp;lt;a class=&quot;infinite-more-link&quot; href=&quot;/next/page&quot;&amp;gt;More&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-01-04T19:14:45.857" Title="How would you template for Infinite Scroll?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18382" PostTypeId="2" ParentId="18380" CreationDate="2017-01-04T19:14:45.857" Score="1" Body="&lt;p&gt;Got it.  Using the CraftCMS paginate example - I just needed to add the pagination url for the next page. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-01-04T19:14:45.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18383" PostTypeId="1" CreationDate="2017-01-04T19:19:16.063" Score="1" ViewCount="89" Body="&lt;p&gt;Is there a way to create conditional validation on 2 fields related to the same desired input using the Charge plugin? The Reason plugin does not work when defining fields in the CP-&gt;Charge-&gt;Settings-&gt;Field view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a set of radio buttons and a text field for the user to input a chosen value. The user can either choose the buttons or type in a numeric value into the text field. However, it's possible that the user can simply &lt;em&gt;not&lt;/em&gt; choose a value from neither the radio buttons nor type in a value into the text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see in the documentation that there is an &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/developer/hooks-and-events#event-onBeforeCharge&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeCharge&lt;/code&gt; event&lt;/a&gt; that can be used, so perhaps I could create a custom validation rule there, but I don't know if that should be defined in a template or in Javascript. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5997" LastActivityDate="2017-01-04T19:19:16.063" Title="Charge form with conditional validation" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18385" PostTypeId="2" ParentId="18379" CreationDate="2017-01-04T19:55:48.470" Score="1" Body="&lt;p&gt;Your best bet here is going to be to create a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way that this could work would be to set up a plugin that defines a &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;record&quot;&gt;record&lt;/a&gt; for the front-end users, and then create one or more Control Panel pages for your Administrator to handle these records. Because the records can be defined any way you'd like, they can exist separately from Craft's baked-in User system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may actually be preferable in your case, since (if I'm understanding correctly) it sounds like you'd like to manage users logging into a separate frontend area, not the Craft admin Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the Admin ability to manage User's passwords from the Control Panel, this feature was removed in build 2.3.2615. However, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10588/set-users-passwords/10591#10591&quot;&gt;this answer&lt;/a&gt; does offer a way around this.&lt;/p&gt;&#xA;" OwnerUserId="4909" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-01-04T19:55:48.470" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18386" PostTypeId="2" ParentId="18357" CreationDate="2017-01-04T20:47:54.717" Score="1" Body="&lt;p&gt;Not terribly familiar with Sprout Forms, but it looks like you could gate the download with a query string parameter, like in Sprout Forms' &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/adding-a-thank-you-page&quot; rel=&quot;nofollow noreferrer&quot;&gt;Thank you Page example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this to your form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/DOWNLOAD_PAGE?submitted=true&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then in your download link template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('submitted') == 'true' %}&#xA;    DOWNLOAD_LINK&#xA;{% else %}&#xA;    Please submit the form here LINK_TO_YOUR_FORM to access this whitepaper.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4909" LastActivityDate="2017-01-04T20:47:54.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18387" PostTypeId="1" AcceptedAnswerId="18392" CreationDate="2017-01-04T21:16:58.150" Score="0" ViewCount="136" Body="&lt;p&gt;I have a layout template, we'll call that &lt;strong&gt;Template A&lt;/strong&gt; that is extended by another template, we'll call that &lt;strong&gt;Template B&lt;/strong&gt; that includes another template, we'll call that &lt;strong&gt;Template C&lt;/strong&gt; that includes another template lets call that &lt;strong&gt;Template D&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the visually it goes like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-Template A&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;--Template B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;---Template C&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;----Template D&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Template C I define some content such as &quot;&lt;strong&gt;Hello World&lt;/strong&gt;&quot; as well as a bunch of other content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not want Template C to output the &quot;&lt;strong&gt;Hello World&lt;/strong&gt;&quot; content but instead want &lt;strong&gt;Template D&lt;/strong&gt; to decide where it is output as defined in &lt;strong&gt;Template C&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking that somewhere i might should use &lt;em&gt;embed&lt;/em&gt; rather than &lt;strong&gt;include&lt;/strong&gt; but i'm a bit hazy on exactly how to achieve this. Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The content defined in &lt;strong&gt;Template C&lt;/strong&gt; is defined &lt;em&gt;after&lt;/em&gt; &lt;strong&gt;Template C&lt;/strong&gt; includes &lt;strong&gt;Template D&lt;/strong&gt; and also the content that is defined is not just a simple string as indicated above &lt;em&gt;&quot;hello world&quot;&lt;/em&gt; but actually much more complex data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; Here is an example of the templates to help better understand the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template C:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.body.level(1) %}&#xA;  {% include 'Template D' %}&#xA;  {% if block.children is not empty %}&#xA;    {% block child %}&#xA;        {% for block in block.children %}&#xA;            {% include 'Template E' %}&#xA;        {% endfor %}&#xA;    {% endblock %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where Template E is the &lt;em&gt;&quot;Hello World&quot;&lt;/em&gt; content mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template D:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if block.slide|length %}&#xA;     &amp;lt;div class=&quot;stuff&quot;&amp;gt;&#xA;         &amp;lt;ul class=&quot;somestuff&quot;&amp;gt;&#xA;             {% for background in block.slide %}&#xA;                 &amp;lt;li style=&quot;background-image:url({{ background.url() }})&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;             {% endfor %}&#xA;         &amp;lt;/ul&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;&#xA;     &amp;lt;section id=&quot;text-slider&quot;&amp;gt;&#xA;         &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;             {% block child %}{% endblock %}&#xA;        &amp;lt;/div&amp;gt;&#xA;     &amp;lt;/section&amp;gt;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And more code also after that endif. Where Block Child (in Template C) is the content to be defined and Block Child (in Template D) is where i want it output.&lt;/p&gt;&#xA;" OwnerUserId="437" LastEditorUserId="437" LastEditDate="2017-01-04T22:16:16.363" LastActivityDate="2017-01-05T01:32:48.783" Title="Set Parent Template Defined Content to Output in Child Template" Tags="&lt;templating&gt;&lt;include&gt;&lt;extends&gt;&lt;embed&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18388" PostTypeId="2" ParentId="18340" CreationDate="2017-01-04T21:23:26.753" Score="1" Body="&lt;p&gt;It's not possible to do both an &quot;and&quot; and an &quot;or&quot; in a single query going though the ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a few other posts that go into more detail and provide some potential workarounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or&quot;&gt;How can I create an ElementCriteriaModel with &amp;#39;and&amp;#39; and &amp;#39;or&amp;#39;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/587/how-to-fetch-specific-users-or-admins-with-the-elementcriteriamodel&quot;&gt;How to fetch specific users OR admins with the ElementCriteriaModel?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-04T21:23:26.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18389" PostTypeId="2" ParentId="18387" CreationDate="2017-01-04T21:24:59.643" Score="1" Body="&lt;p&gt;You could use &lt;code&gt;include...with&lt;/code&gt;, as specified in the Twig Docs &lt;a href=&quot;http://twig.sensiolabs.org/doc/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example for your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# in Template C #}&#xA;{% include 'template-d.twig' with {'foo':'Hello World'} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should give Template D access to &lt;code&gt;foo&lt;/code&gt;. Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="4909" LastActivityDate="2017-01-04T21:24:59.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18390" PostTypeId="2" ParentId="18365" CreationDate="2017-01-04T22:36:50.943" Score="1" Body="&lt;p&gt;My current workaround: Get the select field directly and set its options to the select field options: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set donationRecurrenceOptions = craft.fields.getFieldByHandle('donationRecurrence').settings‌​.options %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5997" LastActivityDate="2017-01-04T22:36:50.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18391" PostTypeId="1" CreationDate="2017-01-05T00:09:07.410" Score="1" ViewCount="43" Body="&lt;p&gt;I'm trying to display and paginate entries by years, that aren't necessarily contiguous. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set limitPerPage = 6 %}&#xA;{% set eagerFields = [&#xA;    'title',&#xA;    'press_release_name',&#xA;    'press_release_date',&#xA;    'press_release_body',&#xA;] %}&#xA;&#xA;{% set pressEntries = craft.entries({&#xA;    section: 'pressReleases',&#xA;    with:    eagerFields,&#xA;}).limit(null) %}&#xA;&#xA;{# I plan on building the query dynamically later, I just want test syntax here #}&#xA;{% set dateQuery = 'and, &amp;gt;= 2012-01-01, &amp;lt; 2013-01-01' %}&#xA;&#xA;{% paginate pressEntries.postDate(dateQuery).limit(limitPerPage) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine, but I'm wondering how to build upon the &lt;code&gt;dateQuery&lt;/code&gt; to return more years with something like:&lt;br&gt;&#xA;&lt;code&gt;'and, &amp;gt;= 2012-01-01, &amp;lt; 2013-01-01, &amp;gt;= 2014-01-01, &amp;lt; 2015-01-01'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="5473" LastActivityDate="2017-01-05T04:08:08.757" Title="Entries by non-contiguous postDate years" Tags="&lt;entries&gt;&lt;postdate&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18392" PostTypeId="2" ParentId="18387" CreationDate="2017-01-05T01:32:48.783" Score="0" Body="&lt;p&gt;The correct way of doing this for anybody interested is as I had guessed, using embed rather than include but also to setup a recursive macro like so in Template C:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro recursiveBlock(block) %}&#xA;  {% import _self as self %}&#xA;  {% embed 'Template D' %}&#xA;      {% if block.children is not empty %}&#xA;          {% block child %}&#xA;              {% for block in block.children %}&#xA;                  {{ self.recursiveBlock(block) }}&#xA;              {% endfor %}&#xA;          {% endblock %}&#xA;      {% endif %}&#xA;  {% endembed %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import recursiveBlock %}&#xA;&#xA;{% for block in entry.body.level(1) %}&#xA;    {{ recursiveBlock(block) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template D remains unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Sam's answer was correct for a much simpler need, this is the way it had to be done (as far as I understand) for something more complex.&lt;/p&gt;&#xA;" OwnerUserId="437" LastActivityDate="2017-01-05T01:32:48.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18393" PostTypeId="2" ParentId="18391" CreationDate="2017-01-05T04:08:08.757" Score="1" Body="&lt;p&gt;You may be able to piggyback off of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4475/merge-two-arrays-of-elementmodels&quot;&gt;this answer&lt;/a&gt; on combining arrays of EntryModels, by providing the template with an array of &lt;code&gt;dateQuery&lt;/code&gt; conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each date condition, you could retrieve the entries as you're doing above, and then combine them with the previous results using the method in that answer. You can then call &lt;code&gt;{% paginate %}&lt;/code&gt; using the final combined array, which should contain results matching all of your conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, this does dump a lot of logic into the template for twig to handle - it may be worth building a small Plugin with a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Variable&lt;/a&gt; that takes in an array of &lt;code&gt;dateQuery&lt;/code&gt; instructions, handles this processing for you, and then returns the final combined set to be used in your &lt;code&gt;{% paginate %}&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4909" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-05T04:08:08.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18394" PostTypeId="2" ParentId="18198" CreationDate="2017-01-05T04:29:36.807" Score="1" Body="&lt;p&gt;One or more &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries Fields&lt;/a&gt; might help you establish the relationship between your custom element and the other elements - after that, you should be able to call &lt;a href=&quot;https://craftcms.com/classreference/models/BaseElementModel#setContentFromPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;setContentFromPost()&lt;/code&gt;&lt;/a&gt; on the Entries in that field to change the content of related elements.&lt;/p&gt;&#xA;" OwnerUserId="4909" LastActivityDate="2017-01-05T04:29:36.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18395" PostTypeId="1" AcceptedAnswerId="18396" CreationDate="2017-01-05T11:42:38.503" Score="0" ViewCount="1153" Body="&lt;p&gt;I have a URL to an external website within one my site's pages.  I want this to open in a new window.  I don't want the viewer to move off our website but will want them to click on the link to our third party.&#xA;How do I get the link to open in a new window?&#xA;thanks&lt;/p&gt;&#xA;" OwnerUserId="6090" LastActivityDate="2017-01-05T11:46:58.983" Title="How do I get a URL link to open in a new window once clicked" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2017-01-05T17:05:47.957" ContentLicense="CC BY-SA 3.0" />
  <row Id="18396" PostTypeId="2" ParentId="18395" CreationDate="2017-01-05T11:46:58.983" Score="1" Body="&lt;p&gt;Add &lt;code&gt;target=&quot;_blank&quot;&lt;/code&gt; to the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so: &lt;code&gt;&amp;lt;a href=&quot;http://google.com&quot; target=&quot;_blank&quot;&amp;gt;Opens in new window&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2017-01-05T11:46:58.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18397" PostTypeId="1" CreationDate="2017-01-05T14:15:10.390" Score="3" ViewCount="1277" Body="&lt;p&gt;When I reset my password with the same password I used before. &#xA;I checked the MySQL database the old encrypted password is different from new encrypted password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you guys know why?&lt;/p&gt;&#xA;" OwnerUserId="5227" LastEditorUserId="57" LastEditDate="2017-01-05T18:38:45.243" LastActivityDate="2017-01-05T18:38:45.243" Title="Craft password encryption" Tags="&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18398" PostTypeId="2" ParentId="18332" CreationDate="2017-01-05T14:27:59.903" Score="2" Body="&lt;p&gt;I think what you want to look at is the Regular Expression option under the advanced tab for your my-site/news node. You could add something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /^my-site\/news/i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way all of the child pages in that section will mark the News page as active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MW&lt;/p&gt;&#xA;" OwnerUserId="4935" LastActivityDate="2017-01-05T14:27:59.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18399" PostTypeId="1" AcceptedAnswerId="18402" CreationDate="2017-01-05T15:26:36.813" Score="2" ViewCount="950" Body="&lt;p&gt;I have a rich text field that needs to have the cite tag within. See here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/udwN1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/udwN1.png&quot; alt=&quot;redactor in Craft cms&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is currently ouputting as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&#xA;    This is the quote.&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas I need to work in an option for the client to create this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&#xA;    This is the quote.&#xA;    &amp;lt;cite&amp;gt;&#xA;        John Doe, Founder&#xA;    &amp;lt;/cite&amp;gt;&#xA;&amp;lt;/blockquote&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What options are there for formatting some copy to be within the blockquote tag, but then formatting some of it to be wrapped in cite tags?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Jay&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2017-03-08T16:13:58.257" LastActivityDate="2017-03-08T16:13:58.257" Title="Adding a cite tag within the blockquote tag using redactor's WYSIWYG?" Tags="&lt;templating&gt;&lt;redactor&gt;&lt;wysiwyg&gt;&lt;markup&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18401" PostTypeId="2" ParentId="18399" CreationDate="2017-01-05T15:37:40.243" Score="1" Body="&lt;p&gt;Craft &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;uses Redactor as its rich text editor&lt;/a&gt; - Redactor has numerous configuration options, one of which is direct html editing. One option would be to create a new Redactor configuration that includes the &lt;code&gt;'html'&lt;/code&gt; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, You could copy Craft's &quot;Standard&quot; Config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;horizontalrule&quot;],&#xA;&quot;plugins&quot;: [&quot;source&quot;,&quot;fullscreen&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Into a new file &lt;code&gt;myCustomConfig.json&lt;/code&gt; at &lt;code&gt;craft/config/redactor&lt;/code&gt;, then add the &lt;code&gt;'html'&lt;/code&gt; button:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;buttons&quot;: [&quot;html&quot;,&quot;format&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;,&quot;horizontalrule&quot;],&#xA;&quot;plugins&quot;: [&quot;source&quot;,&quot;fullscreen&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And select your new config from the Settings page. This should allow you to manually edit the html to include &lt;code&gt;&amp;lt;cite&amp;gt;&lt;/code&gt; tags inside of your &lt;code&gt;&amp;lt;blockquotes&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4909" LastActivityDate="2017-01-05T15:37:40.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18402" PostTypeId="2" ParentId="18399" CreationDate="2017-01-05T15:42:38.860" Score="4" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/carlcs/craft-redactorinlinestyles&quot; rel=&quot;noreferrer&quot;&gt;Redactor Inline Styles&lt;/a&gt; add-on then use the following in your Redactor json config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;plugins&quot;: [&quot;source&quot;,&quot;fullscreen&quot;,&quot;inlinestyles&quot;],&#xA;    &quot;buttonsAddAfter&quot;: &quot;italic&quot;,&#xA;    &quot;buttonsAdd&quot;: {&#xA;        &quot;cite&quot;: {&#xA;            &quot;title&quot;: &quot;Cite&quot;,&#xA;            &quot;args&quot;: [&quot;cite&quot;]&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll then be able to add a &lt;code&gt;cite&lt;/code&gt; element within a blockquote formatted text.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-01-05T15:42:38.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18406" PostTypeId="2" ParentId="18397" CreationDate="2017-01-05T17:25:11.583" Score="7" Body="&lt;p&gt;That's because Craft follows the standard procedure of &lt;a href=&quot;https://en.wikipedia.org/wiki/Salt_(cryptography)&quot;&gt;hashing passwords with what's called a &quot;salt&quot;&lt;/a&gt; as a security measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about it this way - if a password were hashed without a salt, &lt;em&gt;every instance of the same password would result in the same hashed value&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose there are two users, Foo and Bar. They both choose &lt;code&gt;password123&lt;/code&gt; as their password. When hashed without a salt, their passwords would look the same after hashing, which is a security flaw. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see this by testing it with any hash algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm using md5 here for readability because it gives a shorter result - do not actually use md5 for anything secure)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;password123&lt;/code&gt; becomes &lt;code&gt;482c811da5d5b4bc6d497ffa98491e38&lt;/code&gt;, and - without using a salt - would be stored that way for every user with the password &lt;code&gt;password123&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implication here is that the system is now vulnerable to a variety of attacks, like Lookup Tables and Rainbow Tables, which depend upon every instance of a password yielding the same hash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enter Salts. Salts are psuedo-random strings attached to the user's password prior to being hashed and stored. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our Foo and Bar example, that would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Foo chooses &lt;code&gt;password123&lt;/code&gt;. The system generates a psuedo-random &quot;salt&quot; of &lt;code&gt;pg7n6yVBzWJbaxfF&lt;/code&gt;, &lt;em&gt;combines them&lt;/em&gt; into &lt;code&gt;pg7n6yVBzWJbaxfFpassword123&lt;/code&gt;, and then hashes that result to get &lt;code&gt;d026a6847c743e23195cf37db2a66ae9&lt;/code&gt;. In addition, Foo's generated salt is stored in the table, so that it can be used to test login attempts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bar does the same, but the system generates &lt;code&gt;Am6g4n0JEFdE1poH&lt;/code&gt; as his salt. When combined with &lt;code&gt;password123&lt;/code&gt; and hashed, it then yields a different result: &lt;code&gt;5e7b0bb4842ee8315105a62922c32894&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both users have the same password, but the final hashed result now has no traceable relationship to the original password in either case. If a malicious party were to try and search for &lt;code&gt;password123&lt;/code&gt; by scanning the database for its hashed equivalent (in our example &lt;code&gt;482c811da5d5b4bc6d497ffa98491e3&lt;/code&gt;), it wouldn't find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same principle applies to resetting your password - even if you choose the same password, that new instance of the password is re-salted, re-hashed, and stored as something distinct.&lt;/p&gt;&#xA;" OwnerUserId="4909" LastActivityDate="2017-01-05T17:25:11.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18407" PostTypeId="1" AcceptedAnswerId="18799" CreationDate="2017-01-05T18:40:14.170" Score="1" ViewCount="280" Body="&lt;p&gt;I'm working on a site that uses bootstrap so has a very large CSS file with many selectors that are not being used. To reduce the size of the file, I'd like to use the &lt;a href=&quot;https://github.com/addyosmani/grunt-uncss&quot; rel=&quot;nofollow noreferrer&quot;&gt;grunt-uncss task&lt;/a&gt;, but it does not work as well with CMS-based sites, as opposed to static HTML files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen guides for how to &lt;a href=&quot;https://gladdy.uk/blog/2014/04/13/using-uncss-and-grunt-uncss-with-wordpress/&quot; rel=&quot;nofollow noreferrer&quot;&gt;make it work on Wordpress&lt;/a&gt; but the guide includes Wordpress specific plugin-ins that I don't believe are available on Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curious if anyone is using the grunt-uncss with on a Craft site and how it was set-up to make it work effectively? Would like it to run on all pages of the site, ideally. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2017-05-02T00:23:27.550" Title="Possible to Get grunt-uncss Working with Craft?" Tags="&lt;css&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18411" PostTypeId="1" AcceptedAnswerId="18415" CreationDate="2017-01-06T04:45:11.487" Score="2" ViewCount="626" Body="&lt;p&gt;I have built a plugin with some console commands for automating some regular tasks that will be run by a cron job for my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the commands working, I had to replicate my database configuration for the &lt;code&gt;console&lt;/code&gt; environment in &lt;code&gt;db.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All was well until I realized that each of my environments, local, staging and production will have unique database credentials, but there is only one console environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can force the &lt;code&gt;yiic&lt;/code&gt; command to use a specific environment via a command line switch, either passing the domain name of an existing environment or additional additional arbitrarily named console environments? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there another way to accomplish this so that the console environment has a unique configuration for each copy of the site?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the time being I've been able to add an &lt;code&gt;--environment&lt;/code&gt; switch to &lt;code&gt;craft/app/etc/console/yiic.php&lt;/code&gt; which defines the &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; constant ahead of it defaulting to &lt;code&gt;console&lt;/code&gt;, but this seems rather hacky and I'd hope there's a better way to do this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Existing switch check starting on line 18&#xA;if (isset($_SERVER['argv']))&#xA;{&#xA;    foreach ($argv as $key =&amp;gt; $arg)&#xA;    {&#xA;        if (strpos($arg, '--configPath=') !== false)&#xA;        {&#xA;            $parts = explode('=', $arg);&#xA;            $frontConfigPath = rtrim($parts[1], '/').'/';&#xA;            unset($_SERVER['argv'][$key]);&#xA;            break;&#xA;        }&#xA;&#xA;        // New environment switch added here&#xA;        if (strpos($arg, '--environment=') !== false)&#xA;        {&#xA;            $parts = explode('=', $arg);&#xA;            $environment = $parts[1];&#xA;            define('CRAFT_ENVIRONMENT', $environment);&#xA;            unset($_SERVER['argv'][$key]);&#xA;            break;&#xA;        }&#xA;        // end new environment switch&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14" LastEditorUserId="14" LastEditDate="2017-01-06T05:18:21.647" LastActivityDate="2017-01-06T17:52:41.803" Title="How do I configure multiple environments for console commands?" Tags="&lt;multi-environment&gt;&lt;environments&gt;&lt;console&gt;&lt;cli&gt;&lt;yiic&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18413" PostTypeId="1" AcceptedAnswerId="18416" CreationDate="2017-01-06T16:15:15.227" Score="1" ViewCount="155" Body="&lt;p&gt;I want to fetch a specific block from a Matrix global then pass it through a macro which returns a response based on the block type. However, if I try to use &lt;code&gt;slice&lt;/code&gt; the type doesn't appear to be available to the macro. Has anyone experienced something similar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg if I set &lt;code&gt;{% set timelineText = timeline.timeline %}&lt;/code&gt; (where first &lt;code&gt;timeinline&lt;/code&gt; is my global and second &lt;code&gt;timeline&lt;/code&gt; is my Matrix field) then fetch a specific block from the Matrix: &lt;code&gt;{% set period = timelineText|slice(0,1) %}&lt;/code&gt; should return the first instance/block from the field. I can then pass this to my macro: &lt;code&gt;{{ _self.doPeriod(period) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My macro is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro doPeriod(content) %}&#xA;{% switch content.type %}&#xA;{% case 'quote' %}&#xA;    ...&#xA;{% case 'period' %}&#xA;    ...&#xA;{% endswitch %}    &#xA;{% endmacro %}```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this returns the following error: &lt;code&gt;Key &quot;type&quot; for array with keys &quot;0&quot; does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-01-06T19:17:29.997" Title="Passing Matrix block to a macro" Tags="&lt;matrix&gt;&lt;switch&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18414" PostTypeId="2" ParentId="18167" CreationDate="2017-01-06T17:37:48.097" Score="2" Body="&lt;p&gt;An efficient way is the other answer using the element api and vue.js. The element api returns JSON and VUE uses javascript templating to output the markup.  The same can be done in jQuery using a template framework like Mustache. However if you need something less in-depth with jQuery here is a simple way to accomplish it. &#xA;First in your settings go to Routes and create a new route to the template file which will generate your posts.&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PRr1Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PRr1Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the more button you could use a data attribute to capture the current page along with how many you would like to load at a time. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;button id=&quot;more-button&quot; data-page=&quot;0&quot; data-batch=&quot;3&quot;&amp;gt;More&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In jQuery listen for the button click and run your query to the template. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#more-button&quot;).on('click', function () {&#xA;    var btn = $(this),&#xA;        page = btn.data('page'),&#xA;        batch = btn.data('batch'),&#xA;        offset = page * batch,&#xA;        newPage = page + 1;&#xA;&#xA;    loadPosts(offset, batch);&#xA;    // set the buttons page attribute to the new page it is on.&#xA;    btn.data('page',newPage);&#xA;});&#xA;&#xA;function loadPosts (offset, limit) {&#xA;    $.get('/ajax/posts', { offset:offset, limit:limit }, function (data) {&#xA;        var postOutput = $('#post-output');&#xA;        postOutput.html(data);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template you will need to capture the offset &amp;amp; limit params. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set offset = craft.request.getParam('offset') %}&#xA;{% set limit = craft.request.getParam('limit') %}&#xA;{% set items = craft.entries.section('projects').limit(limit).offset(offset) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example we are retrieving the next set and appending them to the rest of the posts.&#xA;Again for a more efficient experience try using element api &amp;amp; javascript templating. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-01-06T17:37:48.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18415" PostTypeId="2" ParentId="18411" CreationDate="2017-01-06T17:52:41.803" Score="3" Body="&lt;p&gt;Alternatively, you could write your own yiic shell wrapper for each environment that defined &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like &lt;code&gt;yiicstaging&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env php&#xA;&amp;lt;?php&#xA;&#xA;define('CRAFT_ENVIRONMENT', 'staging')&#xA;require_once('path/to/craft/app/etc/console/yiic.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-06T17:52:41.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18416" PostTypeId="2" ParentId="18413" CreationDate="2017-01-06T19:17:29.997" Score="2" Body="&lt;p&gt;First, you need to import your macro, and not just call &lt;code&gt;{{ _self.doPeriod() }}&lt;/code&gt;. &lt;a href=&quot;http://twig.sensiolabs.org/doc/1.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;From the documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When you define a macro in the template where you are going to use it, you might be tempted to call the macro directly via _self.input() instead of importing it; even if seems to work, this is just a side-effect of the current implementation and it won't work anymore in Twig 2.x.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I always do: &lt;code&gt;{% import _self as self %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;slice&lt;/a&gt; returns a sequence - in your case an array with one element, and the key is &lt;code&gt;0&lt;/code&gt;. Your macro is expecting a matrix block, not an array, which is why you get that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want the first block, then &lt;code&gt;{% set period = timelineText.first %}&lt;/code&gt; and &lt;code&gt;period&lt;/code&gt; will be a matrix block. &lt;code&gt;{{ self.doPeriod(period) }}&lt;/code&gt; will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to call &lt;code&gt;doPeriod&lt;/code&gt; on all of the matrix blocks, then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for period in timelineText %}&#xA;  ... {{ self.doPeriod(period) }} ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-01-06T19:17:29.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18420" PostTypeId="1" AcceptedAnswerId="18423" CreationDate="2017-01-07T03:35:17.857" Score="1" ViewCount="171" Body="&lt;p&gt;I'm building a plugin that has a column in the DB which is &lt;code&gt;unique&lt;/code&gt; and essentially an &lt;code&gt;AttributeType::Handle&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the piece from the record:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'key' =&amp;gt; array(AttributeType::Handle, 'default' =&amp;gt; '', 'required' =&amp;gt; true),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my service after the &lt;code&gt;$model&lt;/code&gt; has passed validation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($record-&amp;gt;save()) {&#xA;    // update id on model (for new records)&#xA;    $model-&amp;gt;setAttribute('id', $record-&amp;gt;getAttribute('id'));&#xA;    return true;&#xA;} else {&#xA;    $model-&amp;gt;addErrors($record-&amp;gt;getErrors());&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When does that handle validation happen? If I pass something that wouldn't pass handle validation (spaces or a reserved word), it doesn't save the record in the database, but it doesn't throw any errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, is there a way to throw an error when the value isn't unique? Again, the record doesn't save if I use a key that is already in the DB, but there is no error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy to provide more code if necessary, just didn't want to overcomplicate the question. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2017-01-08T01:06:27.943" Title="AttributeType::Handle Validation and Unique" Tags="&lt;validation&gt;&lt;records&gt;&lt;attributetype&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18422" PostTypeId="1" AcceptedAnswerId="18424" CreationDate="2017-01-07T20:20:01.080" Score="1" ViewCount="57" Body="&lt;p&gt;So, I have a loop that populates all the entries related to a given category. See below.  I have multiple categories.  Right now, I use the same code for each category -  swapping only the name of the category out (e.g, category1, category2 ...).  How can I build a loop that avoids this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current template is as follows. I did not include the repetition for each category.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&quot;margin-2&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        {% set category = craft.entries.seciont('posts') %}&#xA;&#xA;&#xA;        &amp;lt;h6&amp;gt;Aircraft&amp;lt;/h6&amp;gt;&#xA;        &amp;lt;div class=&quot;sep red margin-1&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;owl-carousel owl-thumbs&quot;&amp;gt;&#xA;            {% for entry in category.relatedTo(craft.categories.slug('category1')) %}&#xA;            &amp;lt;div class=&quot;thumb dark-overlay&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;photo&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{entry.url}}&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;{{ entry.postImage.first().getURL('thumbImage')}}&quot; alt=&quot;&quot; width=&quot;235&quot; height=&quot;235&quot;&amp;gt;&#xA;                        &amp;lt;span class=&quot;info&quot;&amp;gt;&amp;lt;span class=&quot;big-excerpt&quot;&amp;gt; {{ entry.title }} k&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-01-08T05:13:31.510" Title="How can I create a loop to cycle thru each category and the the entries within each category?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18423" PostTypeId="2" ParentId="18420" CreationDate="2017-01-08T01:06:27.943" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;In addition, is there a way to throw an error when the value isn't unique? Again, the record doesn't save if I use a key that is already in the DB, but there is no error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you use &lt;code&gt;'unique' =&amp;gt; true&lt;/code&gt; in an attribute on your record, Craft will use Yii's &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CUniqueValidator&quot; rel=&quot;nofollow noreferrer&quot;&gt;CUniqueValidator&lt;/a&gt; class to verify the uniqueness of an attribute in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$record-&amp;gt;validate()&lt;/code&gt; will fail and you can use &lt;code&gt;$record-&amp;gt;getErrors()&lt;/code&gt; to get the error message.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'key' =&amp;gt; array(AttributeType::Handle, 'default' =&amp;gt; '', 'required' =&amp;gt; true, 'unique' =&amp;gt; true),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-08T01:06:27.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18424" PostTypeId="2" ParentId="18422" CreationDate="2017-01-08T05:06:19.093" Score="2" Body="&lt;p&gt;First you loop through the categories then use the category to loop through all the entries related to that category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('categoryGroup') %}&#xA;  {% for post in craft.entries.section('posts').relatedTo(category) %}&#xA;    {# your markup #}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-01-08T05:13:31.510" LastActivityDate="2017-01-08T05:13:31.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18425" PostTypeId="2" ParentId="16740" CreationDate="2017-01-08T11:27:26.403" Score="3" Body="&lt;p&gt;It looks like Redactor has a &lt;a href=&quot;https://imperavi.com/redactor/plugins/clips/&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin called “Clips”&lt;/a&gt; that allows you to: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Create a dropdown of frequently used &quot;snippets&quot; of code, text, icons,&#xA;  emoji, you name it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Pixel and Tonic made it into &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips&quot; rel=&quot;nofollow noreferrer&quot;&gt;a plugin for Craft&lt;/a&gt; too.&#xA;&lt;strike&gt;I haven’t tried either but it looks like it should do the trick.&lt;/strike&gt; I just tried the Craft plugin and it worked out pretty good. It doesn't have a preview of the emoji like Slack’s emoji menu though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin has settings where you can define the clips and the following HTML with each clip. Pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1x38v.png&quot; alt=&quot;Clips plugin settings&quot; title=&quot;Clips plugin settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After installing it I edited one of the .json config files in &lt;code&gt;craft/config/redactor/&lt;/code&gt; directory by adding &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;plugins&quot;: [&quot;clips&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It then gives you a button on the tool bar called Clips. &lt;strong&gt;Make sure your Rich Text field is set to use the config that you added this plugin to.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C0VnI.png&quot; alt=&quot;toolbar with Clips plugin installed&quot; title=&quot;toolbar with Clips plugin installed&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking that button gives you the following list. Clicking on a clip will insert the corresponding HTML&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2tLWm.png&quot; alt=&quot;Clips list in Rich Text field&quot; title=&quot;Clips list in Rich Text field&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not as polished as Slack’s emoji menu. Might be a way to edit the plugin to get it to do that though.&lt;/p&gt;&#xA;" OwnerUserId="3951" LastEditorUserId="3951" LastEditDate="2017-01-08T11:53:56.183" LastActivityDate="2017-01-08T11:53:56.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18426" PostTypeId="1" CreationDate="2017-01-08T19:25:15.657" Score="1" ViewCount="314" Body="&lt;p&gt;I have installed CraftCMS on an Arcustech VPS and successfully added a domain name. Using the domain without the shared SSL works without any problems (e.g. www.example.com / example.com). However after adding the Cloudflare shared SSL certificate and using the &quot;Flexible&quot; configuration option, the website returns &lt;code&gt;Error 521 Web server is down&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have configured the domain in the CraftCMS CP to contain &lt;code&gt;https&lt;/code&gt; and added the following to my &lt;code&gt;.htaccess&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# SSL only&#xA;RewriteEngine On&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !^https&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing a crucial step to get the SSL working?&lt;/p&gt;&#xA;" OwnerUserId="6111" LastActivityDate="2017-01-08T19:25:15.657" Title="Configuring CraftCMS on Arcustech with Cloudflare flexible SSL returns 521 error" Tags="&lt;error&gt;&lt;htaccess&gt;&lt;ssl&gt;&lt;cloudflare&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18427" PostTypeId="1" CreationDate="2017-01-08T21:00:09.577" Score="1" ViewCount="643" Body="&lt;p&gt;How can you change from instant search and faceting to a search bar with auto-completion? &lt;a href=&quot;https://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;SearchPlus&lt;/a&gt; comes with an excellent sample template but this is set to instant search, which means all entries in the index are displayed. I want to have a search-bar only and when typing the search query the relevant entries start to appear (auto-completion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if there is no excerpt field available in the indexed entries, would it be possible to create one, with Twig split?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paragraphs = entry.body|split('&amp;lt;/p&amp;gt;') %}&#xA;{% set firstParagraph = paragraphs|first ~ '&amp;lt;/p&amp;gt;' %}&#xA;&#xA;{{ firstParagraph|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="57" LastEditDate="2017-01-09T00:26:13.037" LastActivityDate="2017-02-06T14:35:58.447" Title="SearchPlus plugin configuration" Tags="&lt;search&gt;&lt;javascript&gt;&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18428" PostTypeId="1" CreationDate="2017-01-08T23:09:06.190" Score="2" ViewCount="429" Body="&lt;p&gt;I'm new to Craft and really loving it so far. I'd like to use something like Sprout Forms or Freeform (are there others worth looking at?) but I really need to be able to submit any data to Salesforce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Freeform has a Salesforce integration but from talking with support it sounds like it only works with Leads and I need custom Object support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. we have job application forms and other applications that use custom Objects and from time to time we do add others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Sprout Forms I've been looking into &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/payload-forwarding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Payload Forwarding&lt;/a&gt; and what I could maybe do with that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any experience with this and any recommended approaches? I'm more of a Front-End Dev so looking at something I could sort myself but if not I'll be looking at hiring someone to help me pull a solution together.  &lt;/p&gt;&#xA;" OwnerUserId="6112" LastActivityDate="2017-02-08T19:54:47.767" Title="Recommendations for Form Integrations with Salesforce?" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18429" PostTypeId="1" CreationDate="2017-01-09T00:32:48.307" Score="2" ViewCount="1023" Body="&lt;p&gt;I am using htaccess to rewrite any www url to a non-www version&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTPS} !=on&#xA;RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&#xA;RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I type &lt;code&gt;domain.com/about&lt;/code&gt; it works fine, however when I type &lt;code&gt;www.domain.com/about&lt;/code&gt; it changes the URL to &lt;code&gt;domain.com/index.php?p=about&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&lt;/code&gt; enabled.&#xA;I also have this in my .htaccess file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Here is the the vhost file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;    ServerName domain.com&#xA;    ServerAdmin webmaster@domain.com&#xA;    DocumentRoot /var/www/&#xA;&#xA;    &amp;lt;Directory /var/www/&amp;gt;&#xA;        Options Indexes FollowSymLinks MultiViews&#xA;        AllowOverride All&#xA;        Order allow,deny&#xA;        allow from all&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&#xA;    ErrorLog ${APACHE_LOG_DIR}/error.log&#xA;    CustomLog ${APACHE_LOG_DIR}/access.log combined&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4229" LastEditorUserId="4229" LastEditDate="2017-01-09T23:09:09.387" LastActivityDate="2017-01-10T09:35:20.563" Title="htaccess non-www rewrite showing index.php in URL" Tags="&lt;url&gt;&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18430" PostTypeId="2" ParentId="18429" CreationDate="2017-01-09T01:03:32.350" Score="1" Body="&lt;p&gt;Check out the official Apache documentation on Canonical domain rewrites: &lt;a href=&quot;https://httpd.apache.org/docs/2.4/rewrite/remapping.html#canonicalhost&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://httpd.apache.org/docs/2.4/rewrite/remapping.html#canonicalhost&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-01-09T01:03:32.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18431" PostTypeId="1" AcceptedAnswerId="18432" CreationDate="2017-01-09T03:31:09.757" Score="1" ViewCount="399" Body="&lt;p&gt;I'm stuck with the &lt;code&gt;.first()&lt;/code&gt; element and why the for-loop code won't work. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;header-slider&quot;&amp;gt;&#xA;  &amp;lt;ul&amp;gt;        &#xA;    {% set image = entry.bannerSlider.first() %}&#xA;    {% set transformedImage = craft.imager.transformImage(image, &#xA;      { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}&#xA;    {% for image in entry.bannerSlider %}&#xA;      &amp;lt;li data-transition=&quot;&quot; data-masterspeed=&quot;500&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ transformedImage.url }}&quot;/&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;code&gt;.first()&lt;/code&gt; element the code breaks (&quot;An unknown image object was used&quot;), but, as this code populates a slider, I need all the images loaded, hence my attempt with the for-loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I am mixing up different Models, but need someone to point it out, please...&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="130" LastEditDate="2017-01-10T02:33:02.633" LastActivityDate="2017-01-10T02:33:02.633" Title="Image(r) transform and for loop" Tags="&lt;forloop&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18432" PostTypeId="2" ParentId="18431" CreationDate="2017-01-09T04:03:00.543" Score="4" Body="&lt;p&gt;When using the for loop you don't need to set &lt;code&gt;image&lt;/code&gt; as it is set in the for loop. You will also need to define &lt;code&gt;transformedImage&lt;/code&gt; on every iteration, so move it within the for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give the below a go, it should do what you are after.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;header-slider&quot;&amp;gt;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for image in entry.bannerSlider %}&#xA;      {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}&#xA;      &amp;lt;li data-transition=&quot;&quot; data-masterspeed=&quot;500&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ transformedImage.url }}&quot;/&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastEditorUserId="4078" LastEditDate="2017-01-09T04:26:07.250" LastActivityDate="2017-01-09T04:26:07.250" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18433" PostTypeId="1" AcceptedAnswerId="18454" CreationDate="2017-01-09T05:37:38.027" Score="1" ViewCount="50" Body="&lt;p&gt;I'm trying to show a menu based on what group a user is in once they have logged in.  However, I'm not having any success.  Here is an example (for one of the groups) of what I have in my &lt;code&gt;_base.html&lt;/code&gt; file, which I'm extending in my other pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('advisors') %}&#xA;    &amp;lt;div class=&quot;secondary-navigation&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;small-1 columns group&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;Advisors&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;small-11 columns navigation&quot;&amp;gt;&#xA;                &amp;lt;ul&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;Advisors Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;Education&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;Events&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;&quot;&amp;gt;Nav 5&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be most welcome!&lt;/p&gt;&#xA;" OwnerUserId="5925" LastEditorUserId="344" LastEditDate="2017-01-09T10:07:06.720" LastActivityDate="2017-02-09T03:05:46.510" Title="Trying to Add a Specific Menu Depending on User Group" Tags="&lt;user-groups&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18434" PostTypeId="1" AcceptedAnswerId="18435" CreationDate="2017-01-09T06:55:33.547" Score="0" ViewCount="75" Body="&lt;p&gt;I would like to display images from various sections, in this case the home page. I am still coming to terms with Twig/Craft's criteria models and the transform makes it confusing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.entries.section('news').limit(1) %}&#xA;    {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint }) %}&#xA;&#xA;    &amp;lt;img src=&quot;{{ image.bannerImage.first().getUrl }}&quot; alt=&quot;&quot; /&amp;gt;&#xA;{% endfor %}` &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where do you then define the image? (&lt;code&gt;bannerImage&lt;/code&gt; is a asset field)&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="57" LastEditDate="2017-01-10T00:33:10.313" LastActivityDate="2017-01-10T00:33:10.313" Title="Pulling images from other sections with image transform" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18435" PostTypeId="2" ParentId="18434" CreationDate="2017-01-09T07:07:54.180" Score="2" Body="&lt;p&gt;Try the following, it should do what you are after.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;  Generate array of entries comprised of first&#xA;  entry from each section&#xA;#}&#xA;{% set entries = [&#xA;  craft.entries.section('news').first(),&#xA;  craft.entries.section('other_section').first(),&#xA;  craft.entries.section('yet_another_section').first()&#xA;] %}&#xA;&#xA;{# Loop through entry array #}&#xA;{% for entry in entries %}&#xA;  {% if entry.bannerSlider|length %}&#xA;    {% set image = entry.bannerSlider.first() %}&#xA;    {% set transformedImage = craft.imager.transformImage(image, { width: 1420, height: 550, position: image.focalPoint,  effects: { grayscale: true, gamma: 1.5}, }) %}&#xA;    &amp;lt;li data-transition=&quot;&quot; data-masterspeed=&quot;500&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ transformedImage.url }}&quot;/&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2017-01-09T07:07:54.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18436" PostTypeId="1" AcceptedAnswerId="18451" CreationDate="2017-01-09T07:54:48.773" Score="0" ViewCount="172" Body="&lt;p&gt;The following code doesn't seem to work when called using an Ajax or Task but it does work otherwise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;sendFile($file, IOHelper::getFileContents($file), array('forceDownload' =&amp;gt; true));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was wondering, Is it not possible to force download a file using an Ajax or Task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="5699" LastEditorUserId="57" LastEditDate="2017-01-10T00:06:17.700" LastActivityDate="2017-01-10T00:10:03.783" Title="Force Download a file using an Ajax request or Task" Tags="&lt;plugin-development&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18437" PostTypeId="1" AcceptedAnswerId="22238" CreationDate="2017-01-09T07:59:33.120" Score="1" ViewCount="117" Body="&lt;p&gt;I have a Matrix block &lt;code&gt;weeklyMenuItems&lt;/code&gt;, each item in the block has a dropdown with days of the week (Monday, Tuesday etc). Each entry will have a Matrix block with 7 items, matching the 7 days of the week.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template, I would like to start the loop from todays day &lt;strong&gt;but still include previous days in the loop, at the end&lt;/strong&gt;. So, according to the example, whichever &lt;code&gt;item.dayOfTheWeek&lt;/code&gt; matches &lt;code&gt;{{ now|date('l') }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if today's day is &lt;strong&gt;Wednesday&lt;/strong&gt;, the loop will output...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wednesday&lt;/li&gt;&#xA;&lt;li&gt;Thursday&lt;/li&gt;&#xA;&lt;li&gt;Friday&lt;/li&gt;&#xA;&lt;li&gt;Saturday&lt;/li&gt;&#xA;&lt;li&gt;Sunday&lt;/li&gt;&#xA;&lt;li&gt;Monday&lt;/li&gt;&#xA;&lt;li&gt;Tuesday&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is part of my code, the entries that are being looped are from an entries field of another channel &lt;code&gt;menuSection&lt;/code&gt; but I don't think that matters in this instance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('menuSection').find() %}&#xA;&#xA;    {% for menuItem in entry.menuEntries %}&#xA;&#xA;        &amp;lt;h2&amp;gt;{{ menuItem.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {# Matrix blocks #}&#xA;            {% for item in menuItem.weeklyMenuItems %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ item.dayOfTheWeek }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ item.itemTitle }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any guidance will be welcomed, let me know if I can clarify anything!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="4823" LastEditDate="2017-01-15T07:47:34.393" LastActivityDate="2017-10-04T07:22:47.830" Title="Start Matrix loop from item that contains todays day" Tags="&lt;matrix&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18440" PostTypeId="1" AcceptedAnswerId="18514" CreationDate="2017-01-09T12:44:44.970" Score="1" ViewCount="1533" Body="&lt;p&gt;I am using &lt;a href=&quot;https://stackoverflow.com/questions/18900035/how-to-concatenate-two-twig-variables-in-a-twig-loop&quot;&gt;this SO post&lt;/a&gt; to try to concatenate two variables in twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very close, but can't seem to get over the hump of rendering the correct syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I am currently using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for user in plugin.data.users %}&#xA;     ...  &#xA;     {{ attribute(user, 'foo' ~ loop.index0)|raw|nl2br.bar }}&#xA;     ...&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I am currently getting back:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Key &quot;foo0&quot;... for array with keys &quot;...does not exist.&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am trying to create is &lt;code&gt;foo[0]&lt;/code&gt;, &lt;code&gt;foo[1]&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I couldn't figure it out so this is how I did it. If there is a better way, I'd be happy to update the post.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set i = 0 %}&#xA;    {{ user.foo[i].bar }}&#xA;    ...&#xA;{% set i = i + 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-01-13T18:18:02.083" Title="How can I concatenate 2 variables to access array values?" Tags="&lt;templating&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18441" PostTypeId="1" AcceptedAnswerId="18453" CreationDate="2017-01-09T12:51:45.133" Score="1" ViewCount="346" Body="&lt;p&gt;I have a group website which has a main site and 3 sub sites all within 1 Craft Installation.&#xA;Each sub site has its own Structure Section for Content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am adding a Group Wide Search to the main site and sub sites.&#xA;Sub sites are accessed by subdomain of main site - e.g.  property.domain.com agents.domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a sitewide search if I get results from the subsites the entry.url will just contain the domain from the site it is being searched for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for my search results - I will check the handle of the entry to see if it is from the subsites - and then if possible replace the domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the handle with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handle = entry.section.handle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a handy way to replace the domain?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-01-10T00:31:03.823" Title="Change domain in entry.url" Tags="&lt;entries&gt;&lt;entry&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18442" PostTypeId="2" ParentId="18440" CreationDate="2017-01-09T12:57:38.650" Score="1" Body="&lt;p&gt;I think you need to try and access the array that &lt;code&gt;user.foo&lt;/code&gt; would have.&#xA;So your code would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for user in plugin.data.users %}&#xA;  ...  &#xA;  {{ attribute(user.foo, loop.index0)|raw|nl2br }}&#xA;  ...&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't tested this though, just going by what I'm sure I remember doing once...&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-01-09T12:57:38.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18443" PostTypeId="2" ParentId="18376" CreationDate="2017-01-09T14:56:09.083" Score="1" Body="&lt;p&gt;As an added bonus, this is documented on the Super Table plugin Github page - &lt;a href=&quot;https://github.com/engram-design/SuperTable#documentation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable#documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically the &lt;code&gt;Matrix in Super Table field&lt;/code&gt; - &lt;a href=&quot;https://github.com/engram-design/SuperTable/wiki/Templating-examples#matrix-in-super-table-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable/wiki/Templating-examples#matrix-in-super-table-field&lt;/a&gt; - although I'm aware that the question was for a Super Table in Matrix field - its more than enough to get started. Glad you got it solved!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-01-09T14:56:09.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18444" PostTypeId="1" AcceptedAnswerId="18463" CreationDate="2017-01-09T15:17:24.917" Score="1" ViewCount="218" Body="&lt;p&gt;Working with the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; for the first time and I'm having a bit of a hard time finding any kind of documentation regarding writing more complex conditionals using the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to accomplish, is selecting all entries (they are events with a start/end date as custom fields) from a given section, which overlap in any way with a passed-in query start/end date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is probably easier to simply supply the raw query that works, and perhaps someone could point me in the direction of documentation that could help me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT *&#xA;FROM craft_content&#xA;WHERE&#xA;! ( field_eventStartDate &amp;gt; @queryStartDate AND field_eventStartDate &amp;gt; @queryEndDate)&#xA;AND&#xA;! ( field_eventEndDate &amp;lt; @queryStartDate AND field_eventEndDate &amp;lt; @queryEndDate )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4935" LastActivityDate="2017-01-10T15:21:00.940" Title="Complex Conditionals with ElementCriteriaModel / Element API" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18446" PostTypeId="1" AcceptedAnswerId="18726" CreationDate="2017-01-09T20:21:00.240" Score="2" ViewCount="780" Body="&lt;p&gt;I just installed Craft fresh, there's almost nothing in my DB as I'm just beginning to develop a plugin. All I want is to save a new entry from the frontend of my website. I've done this before in other projects, but now I just can't get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I always receive the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bad Request&#xA;&#xA;POST param “code” doesn’t exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No other errors appear, no php error log. I do not have a param or field &quot;code&quot; anywhere, so I don't understad where that comes from.&#xA;The problem happens before the data is sent to my controller action as I never get into that action (I added a Craft::dd(&quot;Test&quot;) in the function with no results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I browse directly to my action controller, the function does get executed, so the path is correct. My plugin names are all correct also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add CSRF token verification, I get an error that it could not be verified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the method POST to GET for testing purposes only, I get the same error but instead of paaram &quot;code&quot; it's param &quot;id&quot; that doesn't exist. I don't know what ID or CODE it's talking about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked it with the working plugin I wrote for another project and I can't see any difference. I tested it localy with EasyPhP and also on an online devlopment server on Siteground, so two different environments as I thought it was maybe an issue with my local server. However, both had the same issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm at a loss, I have no idea why this will not work. Please help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- UPDATE --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got this stack trace from the craft.log. Is this enough?&#xA;It's talking a lot about users I see... I can't connect the dots yet...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/01/10 19:18:56 [error] [exception.Craft\HttpException.400] Craft\HttpException: POST param “code” doesn’t exist. in C:\gitProjects\BUT\but-project-history\craft\app\services\HttpRequestService.php:509&#xA;Stack trace:&#xA;#0 C:\gitProjects\BUT\but-project-history\craft\app\controllers\UsersController.php(333): Craft\HttpRequestService-&amp;gt;getRequiredPost('code')&#xA;#1 C:\gitProjects\BUT\but-project-history\craft\app\framework\web\actions\CInlineAction.php(49): Craft\UsersController-&amp;gt;actionSetPassword()&#xA;#2 C:\gitProjects\BUT\but-project-history\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#3 C:\gitProjects\BUT\but-project-history\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#4 C:\gitProjects\BUT\but-project-history\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#5 C:\gitProjects\BUT\but-project-history\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('setpassword')&#xA;#6 C:\gitProjects\BUT\but-project-history\craft\app\etc\web\WebApp.php(817): CWebApplication-&amp;gt;runController('users/setpasswo...')&#xA;#7 C:\gitProjects\BUT\but-project-history\craft\app\etc\web\WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#8 C:\gitProjects\BUT\but-project-history\craft\app\framework\base\CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#9 C:\gitProjects\BUT\but-project-history\craft\app\index.php(62): CApplication-&amp;gt;run()&#xA;#10 C:\gitProjects\BUT\but-project-history\public\index.php(19): require_once('C:\\gitProjects\\...')&#xA;#11 {main}&#xA;REQUEST_URI=/&#xA;HTTP_REFERER=http://local.butprojecthistory.dev/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- UPDATE 2 --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.htaccess&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;    # SSL in .htaccess - Redirect to https://&#xA;    # RewriteCond %{SERVER_PORT} 80&#xA;    # RewriteRule ^(.*)$ https://site.com/$1 [R,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- UPDATE 3 --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add the path to my controller in the actions attribute of my form tag (but with the &quot;actions&quot; segment in front of the path) than I also get to the controller, if I leave it blank and use a hidden input field with an action attribute so I would get redirected to the same page, it gives the error. Does that clear something up for anybody?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- UPDATE 4 --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traced it back to my javascript. Started using/learning Typescript recently, so there must be something wrong with that...&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-01-29T15:35:21.510" LastActivityDate="2017-01-29T15:52:35.540" Title="Bad Request with weird params" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;request&gt;&lt;csrf&gt;&lt;post&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18447" PostTypeId="1" AcceptedAnswerId="18506" CreationDate="2017-01-09T21:06:06.660" Score="2" ViewCount="2057" Body="&lt;p&gt;I am working on a site that requires a filter option based on tags.&#xA;Each entry will have two sets of tags (e.g., colors and shapes)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.group('colorTag') %}&#xA;{% for tag in craft.tags.group('shapeTag') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I create a filter that allows you to check boxes for those tags and display the results that match ANY of the selected tags?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sbaag.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sbaag.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results will show entries with the Blue tag, entries with the Yellow tag and entries with the Triangle tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks so much!&lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="979" LastEditDate="2017-01-12T20:35:54.747" LastActivityDate="2017-01-17T22:44:31.963" Title="How to filter entries based on Tags" Tags="&lt;entry&gt;&lt;search&gt;&lt;filter&gt;&lt;tag&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18448" PostTypeId="1" AcceptedAnswerId="18449" CreationDate="2017-01-09T22:06:41.623" Score="5" ViewCount="1715" Body="&lt;p&gt;I have a site with a hundred+ or so entries. I've added a new field to my entry template, but it won't take effect until it's been activated by a &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;noreferrer&quot;&gt;onSaveEntry&lt;/a&gt; event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've gone through maybe 15 entries or so now and resaved them manually, but it's proving to be a long and painstaking process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for me to batch resave all enabled entries in order to trigger this &lt;code&gt;onSaveEntry&lt;/code&gt; event? &lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2021-01-20T17:03:43.877" Title="Bulk resave entries to trigger onSaveEntry event" Tags="&lt;events&gt;&lt;updates&gt;&lt;onsaveentry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18449" PostTypeId="2" ParentId="18448" CreationDate="2017-01-09T22:26:21.650" Score="12" Body="&lt;p&gt;If you re-save the section(s) that your entries are in, it should re-trigger a save of all of the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2017-01-09T22:26:21.650" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18450" PostTypeId="1" CreationDate="2017-01-09T22:28:36.927" Score="2" ViewCount="767" Body="&lt;p&gt;I'm wondering what the best way to export order data from Craft Commerce would be for the client's order and revenue reporting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally they'd like to be able to export a report after filtering by date on the Commerce &gt; Orders screen, which I think would also be a great feature request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now it looks like Sprout Export might be the only/best option. I'm wondering if this has come up for anyone who might have other suggestions?&lt;/p&gt;&#xA;" OwnerUserId="6115" LastActivityDate="2017-01-12T15:23:34.573" Title="How to export order data for reporting" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18451" PostTypeId="2" ParentId="18436" CreationDate="2017-01-10T00:10:03.783" Score="0" Body="&lt;p&gt;I don't think you'll be able to use Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#sendFile-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;HttpRequestService-&amp;gt;sendFile()&lt;/code&gt;&lt;/a&gt; for this.  But there are &lt;a href=&quot;https://stackoverflow.com/questions/16086162/handle-file-download-from-ajax-post&quot;&gt;plenty&lt;/a&gt; of &lt;a href=&quot;https://stackoverflow.com/questions/4545311/download-a-file-by-jquery-ajax&quot;&gt;non-Craft&lt;/a&gt; &lt;a href=&quot;https://stackoverflow.com/questions/3499597/javascript-jquery-to-download-file-via-post-with-json-data&quot;&gt;ways&lt;/a&gt; of &lt;a href=&quot;https://stackoverflow.com/questions/20830309/download-file-using-an-ajax-request&quot;&gt;doing this&lt;/a&gt;, depending on your specific requirements.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-10T00:10:03.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18452" PostTypeId="2" ParentId="18437" CreationDate="2017-01-10T00:24:16.683" Score="1" Body="&lt;p&gt;Do you really want to start the Matrix loop from the week day offset?  Or do you just want to only start printing when that offset matches.  The former seems like a bit of a micro-optimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the latter, something like this completely untested code should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('menuSection').find() %}&#xA;&#xA;    {% for menuItem in entry.menuEntries %}&#xA;&#xA;        &amp;lt;h2&amp;gt;{{ menuItem.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% set offset = false %}&#xA;&#xA;            {# Matrix blocks #}&#xA;            {% for item in menuItem.weeklyMenuItems %}&#xA;&#xA;                {% if item.dayOfTheWeek == now|date('l') or offset &amp;gt; 0 }}&#xA;                    {% set offset = loop.index0 %}&#xA;&#xA;                    &amp;lt;li&amp;gt;&#xA;                        &amp;lt;h3&amp;gt;{{ item.dayOfTheWeek }} - Matched&amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;p&amp;gt;{{ item.itemTitle }} - Matched&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;&#xA;            {% if offset == false %}&#xA;                {% set offset = 0 %}&#xA;            {% endif %}&#xA;&#xA;            {# 2nd pass #}&#xA;            {% for item in menuItem.weeklyMenuItems|slice(0, offset) %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ item.dayOfTheWeek }} - Matched&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ item.itemTitle }} - Matched&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-01-15T18:12:48.093" LastActivityDate="2017-01-15T18:12:48.093" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18453" PostTypeId="2" ParentId="18441" CreationDate="2017-01-10T00:31:03.823" Score="1" Body="&lt;p&gt;You could use the Craft/Twig &lt;code&gt;|replace&lt;/code&gt; filter, which supports &lt;a href=&quot;http://regexr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;regex&lt;/a&gt; replacements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handle = entry.section.handle %}&#xA;&#xA;{% if handle == 'subSiteSectionHandle %}&#xA;    {% set newUrl = entry.url|replace('/regexMatchPattern/', 'replacedWith') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-10T00:31:03.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18454" PostTypeId="2" ParentId="18433" CreationDate="2017-01-10T02:50:27.967" Score="1" Body="&lt;p&gt;OK, so enabling the devMode helped point me in the right direction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I needed to change it to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('advisors') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise I was getting an error message when nobody was logged in (&quot;Impossible to invoke a method (&quot;isInGroup&quot;) on a null variable&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I discovered that the user I was testing wasn't added to any groups!  I could have sworn I set up the user with a group assigned, but apparently not.  :(&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-01-10T02:50:27.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18456" PostTypeId="2" ParentId="12084" CreationDate="2017-01-10T06:37:20.263" Score="11" Body="&lt;p&gt;For UBUNTU 16.04 LTS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /etc/mysql&#xA;&#xA;sudo nano my.cnf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;add these two lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[mysqld]&#xA;sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;save file and reset your computer.&lt;/p&gt;&#xA;" OwnerUserId="6116" LastEditorUserId="480" LastEditDate="2018-01-24T20:13:50.803" LastActivityDate="2018-01-24T20:13:50.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18459" PostTypeId="2" ParentId="18429" CreationDate="2017-01-10T09:35:20.563" Score="1" Body="&lt;p&gt;The answer to this question was the positioning of content in the .htaccess file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Move:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTPS} !=on&#xA;RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&#xA;RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although the L tag was in the previous statement, it should be the last rule applied, it doesn't work (probably because I was activating the RewriteEngine again later so it resets the rules, but if the L flag was active in the first rule, it wouldn't apply the www one anyway).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rule of thumb is: first do your cosmetic changes to the domain, then apply the functional rules.&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2017-01-10T09:35:20.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18460" PostTypeId="2" ParentId="18371" CreationDate="2017-01-10T09:47:00.197" Score="2" Body="&lt;p&gt;The issue here was an error in a translations file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'some key' =&amp;gt; 'some value',&#xA;    'key missing value',   &amp;lt;== no value assigned to this key&#xA;    'other key' =&amp;gt; 'other value value'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3563" LastActivityDate="2017-01-10T09:47:00.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18461" PostTypeId="1" CreationDate="2017-01-10T12:42:24.183" Score="2" ViewCount="388" Body="&lt;p&gt;In the CP, is it possible to assign a user group to selected entries within a section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say I have a section called &lt;code&gt;Events&lt;/code&gt;. Within that section I have a fieldType called &lt;code&gt;company&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I create a user group called &lt;code&gt;Company 1&lt;/code&gt; where users within it can only see/edit entries within &lt;code&gt;Events&lt;/code&gt; section that has its &lt;code&gt;company&lt;/code&gt; field selected as &lt;code&gt;Company 1&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to ascertain if its possible to allow users from multiple companies access to the CP, but heavily restrict what they can access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2017-01-10T20:53:43.167" Title="Assign user group to group of entries" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18462" PostTypeId="2" ParentId="18461" CreationDate="2017-01-10T15:20:17.627" Score="1" Body="&lt;p&gt;Nope. It isn't possible to set permissions for individual entries (based on a field value, entry type or any other criteria).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-01-10T15:20:17.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18463" PostTypeId="2" ParentId="18444" CreationDate="2017-01-10T15:21:00.940" Score="3" Body="&lt;p&gt;After doing a bit more digging, I think the only real option here is run a preliminary query to pull out the ids of the elements I want and then pass that into the ElementCriteriaModel. It's not ideal, but it'll do.&lt;/p&gt;&#xA;" OwnerUserId="4935" LastActivityDate="2017-01-10T15:21:00.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18465" PostTypeId="1" AcceptedAnswerId="18470" CreationDate="2017-01-10T16:25:39.107" Score="1" ViewCount="63" Body="&lt;p&gt;Is it possible to create an entry, and have all the categories added by default ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a category called 'materials', with values like 'gold', 'silver', 'copper'... They should all be added to the entry by default, with the possibility to remove them afterwards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible in Craft ?&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:38:43.327" LastActivityDate="2017-05-09T20:38:43.327" Title="All categories selected by default for an entry" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18466" PostTypeId="1" CreationDate="2017-01-10T16:33:09.367" Score="1" ViewCount="284" Body="&lt;p&gt;So, i'm trying to set a fields content via a plugin on an entry which already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;    'subTitle' =&amp;gt; 'woot'&#xA;));&#xA;&#xA;$success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get no error and the value of &lt;code&gt;$success&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt; but it tells me nothing else.&#xA;If I &lt;code&gt;var_dump($entry)&lt;/code&gt; after the first line, the output shows it has pulled the correct entry.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="4466" LastEditDate="2017-01-11T10:28:46.557" LastActivityDate="2017-01-11T10:28:46.557" Title="Update existing entry from plugin not saving and producing no error" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18467" PostTypeId="2" ParentId="18461" CreationDate="2017-01-10T20:53:43.167" Score="1" Body="&lt;p&gt;Depending on what else you need, you &lt;em&gt;might&lt;/em&gt; be able to do this with locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would have a &lt;code&gt;company1&lt;/code&gt; locale, and a user group that had access to only that locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Abusing locales in this way is the approved way to do a multi-site Craft install: &lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coming to Craft 3: Multi-Site&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-01-10T20:53:43.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18468" PostTypeId="1" CreationDate="2017-01-11T01:11:10.207" Score="13" ViewCount="1440" Body="&lt;p&gt;So Craft's implementation of Twig is already very powerful and suitable to most common tasks. The Craft Docs already provide a great intro into using Twig and the handy extensions provided by Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;noreferrer&quot;&gt;Craft Templating Overview&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/twig-primer&quot; rel=&quot;noreferrer&quot;&gt;Craft Twig Primer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/templating&quot; rel=&quot;noreferrer&quot;&gt;Craft Full Templating Reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But what about when you need to go further and build in some sweet custom functionality?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question serves to be a starting point that summarises all the different ways to extend Twig with custom functionality, including:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Filters, functions, objects, macros and statements – when to use which&lt;/li&gt;&#xA;&lt;li&gt;Creating a custom Twig filter&lt;/li&gt;&#xA;&lt;li&gt;Accessing variables and functions in a plugin&lt;/li&gt;&#xA;&lt;li&gt;Creating a custom global function&lt;/li&gt;&#xA;&lt;li&gt;Creating a custom global object&lt;/li&gt;&#xA;&lt;li&gt;Creating a custom statement (or &quot;logic tag&quot;)&lt;/li&gt;&#xA;&lt;li&gt;Creating a custom operator&lt;/li&gt;&#xA;&lt;li&gt;Calling a plugin service class from Twig &lt;/li&gt;&#xA;&lt;li&gt;Making custom database calls from Twig&lt;/li&gt;&#xA;&lt;li&gt;Post-processing HTML after Twig has finished rendering&lt;/li&gt;&#xA;&lt;li&gt;Changing Twig settings&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="5437" LastEditDate="2017-01-11T01:16:35.747" LastActivityDate="2018-02-22T14:20:34.040" Title="The Definitive Guide to Extending Twig in Craft CMS" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="18469" PostTypeId="2" ParentId="18468" CreationDate="2017-01-11T01:11:10.207" Score="14" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;To encourage input, this is a community wiki post. Any user with at least 100 reputation points may contribute.&lt;/em&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h1&gt;Functions, filters, objects, macros and statements – when to use which&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;function&lt;/strong&gt; is one of the simplest constructs in Twig – it takes one or more inputs and returns a single output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ round(42.9) }} will output 43&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are best used for simple, commonly used operations that generate or transform data, such as a Lorem-Ipsum generator: &lt;code&gt;{{ loremIpsum(50) }}&lt;/code&gt;. But note that functions are often better grouped into an object to prevent name collisions (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;filter&lt;/strong&gt; is almost identical to a function, except that it offers a different syntax, which can be more readable when chaining several filters together (they read in progressive order):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 1000000 | number }} will output 1,000,000&#xA;{{ 1000000 | number(false) }} will output 1000000&#xA;{{ 'ABC' | lower | replace('c', 'd') }} will output abd&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It also provides an easy way to wrap around a larger block of text:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% filter upper %}&#xA;    This text becomes uppercase&#xA;{% endfilter %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you can also do this with a function, but it requires an additional line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myText %}&#xA;    A quick brown fox&#xA;{% endset %}&#xA;{{ filterCurseWords(myText) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use a filter when:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It might be necessary to place it in a chain along with other filters&lt;/li&gt;&#xA;&lt;li&gt;It might be necessary to place around larger blocks of text/content&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;global variable&lt;/strong&gt; is one accessible to all templates in your project automatically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ siteName }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;global object&lt;/strong&gt; is also accessible to all templates in your project, but can contain variables, functions or both:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.friendlyName }}&#xA;{{ currentUser.can('accessCp') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Objects provide a good way to neatly group variables and functions and prevent collisions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Twig &lt;strong&gt;statement&lt;/strong&gt; (sometimes called a &quot;logic tag&quot;) is used to designate the flow of logic and may only execute the content inside based on certain circumstances.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% for block in entry.myMatrixField %}&#xA;        &amp;lt;p&amp;gt;{{ block.text }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that caching would not work as a filter, because the content inside a filter is always executed &lt;em&gt;prior&lt;/em&gt; to being passed into the filter. By implementing the cache tag as a &lt;em&gt;statement&lt;/em&gt;, it is able to only execute the content inside when appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it's worth mentioning &lt;strong&gt;macros&lt;/strong&gt;. They assist with reusing snippets of content or HTML in multiple places. Mijingo has written a &lt;a href=&quot;https://mijingo.com/blog/using-macros-in-twig-and-craft&quot; rel=&quot;noreferrer&quot;&gt;great tutorial&lt;/a&gt; that explains macros in Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;forms.html&quot; as forms %}&#xA;{{ forms.input('username') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note, however, that the functionality of macros can sometimes be replicated via a simple include, with less code and more clarity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'mySnippet' with { enabled: true } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Creating a custom Twig filter&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myVariable | myFilter }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Accessing a plugin's variables and functions&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.myVariable }}&#xA;{{ craft.myPlugin.myFunction() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Creating a custom global function&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ customFunction() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Creating a custom global object&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ browser.version }}&#xA;{{ browser.isMobile() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Creating a custom statement (logic tag)&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% devOnly %}&#xA;    ...output some debugging info here...&#xA;{% endDevOnly %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Refer to &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/advanced.html#tags&quot; rel=&quot;noreferrer&quot;&gt;http://twig.sensiolabs.org/doc/2.x/advanced.html#tags&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that sometimes the functionality can be achieved by creating a filter instead of a statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% filter uppercase %}&#xA;    A quick brown fox&#xA;{% endfilter %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However the benefit of a statement is that the code inside is not run unless the statement permits it, whereas in a filter the code is always run, and then later sent to the filter.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Creating a custom operator&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ ! true }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Refer to &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/advanced.html#operators&quot; rel=&quot;noreferrer&quot;&gt;http://twig.sensiolabs.org/doc/2.x/advanced.html#operators&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Calling a plugin service class from Twig&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Under normal circumstances, Twig templates only have access to a plugins &lt;em&gt;Variable Classes&lt;/em&gt; and not their &lt;em&gt;Service Classes&lt;/em&gt;. But using a simple PHP trick, you can pass all calls on transparently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Twig &gt; Variable Class &gt; Service Class&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// craft/plugins/YourPlugin/variables/YourPluginVariable.php&#xA;class YourPluginVariable&#xA;{&#xA;    /** &#xA;     * If function is not found in this class, go find it in service class&#xA;     */&#xA;    function __call($method, $arguments) {&#xA;        return call_user_func_array(array(craft()-&amp;gt;YourPlugin_YourService, $method), $arguments);&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be sure to rename &lt;code&gt;YourPlugin&lt;/code&gt; and &lt;code&gt;YourService&lt;/code&gt; to reflect the names of your plugin and service class.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Making custom database calls from Twig&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.fetchUserCount() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Firstly this requires a custom plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, database calls need to be made via a service class, however because you can only access &lt;em&gt;variable classes&lt;/em&gt; from Twig, you need to pass one to the other. (See the point above for a clean way to transparently pass calls from a variable class to a service class.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig &gt; Variable Class &gt; Service Class &gt; Database Query&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Post-processing HTML after Twig has finished rendering&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Changing Twig settings&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More content to come here. Feel free to contribute some instructions if you're able.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="8038" LastEditDate="2018-02-22T14:20:34.040" LastActivityDate="2018-02-22T14:20:34.040" CommentCount="0" CommunityOwnedDate="2017-01-11T01:11:10.207" ContentLicense="CC BY-SA 3.0" />
  <row Id="18470" PostTypeId="2" ParentId="18465" CreationDate="2017-01-11T02:19:52.417" Score="2" Body="&lt;p&gt;There's not a native way to do this, but you could probably pull it off in a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that utilized the &lt;code&gt;cp.entries.edit&lt;/code&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/a/1407/57&quot;&gt;template hook&lt;/a&gt; and modified the field data directly (selecting whatever categories you want) before returning it to the template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-11T02:19:52.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18471" PostTypeId="2" ParentId="18466" CreationDate="2017-01-11T04:04:11.090" Score="1" Body="&lt;p&gt;I haven't used &lt;code&gt;getEntryById&lt;/code&gt;, and this isn't exactly an answer, but here is how I am doing pretty much the same thing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'mySection');&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;limit = 1;&#xA;$entry = $criteria-&amp;gt;first();&#xA;&#xA;...&#xA;if ($entry) {&#xA;    $entry-&amp;gt;setContentFromPost([&#xA;        'myFieldHandle' =&amp;gt; 'woot'&#xA;    ]);&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;} else {&#xA;    // Could not find entry.&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unless you are setting the page title, then I think you need to use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$entry-&amp;gt;getContent()-&amp;gt;title = 'woot';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-01-11T04:04:11.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18472" PostTypeId="2" ParentId="18466" CreationDate="2017-01-11T08:57:35.897" Score="1" Body="&lt;p&gt;The problem was that there were validation failures that were silently failing. The mighty Brad's suggestion of &lt;code&gt;$entry-&amp;gt;getErrors() after calling saveEntry()&lt;/code&gt; let me see what the issue was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks Brad!&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2017-01-11T08:57:35.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18474" PostTypeId="1" CreationDate="2017-01-11T13:37:15.093" Score="2" ViewCount="117" Body="&lt;p&gt;Has anyone managed to get reverse relations from a Neo field working? I have a Neo field containing an Entries field which works fine on the page/section entry where I have the Neo field, but I’m trying to get data out on that related entry page. Might just be bad coding on my part!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a simple test using a standard Matrix field and the reverse relation works fine, here's that working code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrixRelatedEvents = craft.entries.section('events').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'matrixField'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my Neo reverse relation code which is currently not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set neoRelatedEvents = craft.entries.section('events').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'neoField'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas or is it not possible?&lt;/p&gt;&#xA;" OwnerUserId="3830" LastEditorUserId="3830" LastEditDate="2017-01-12T16:23:11.007" LastActivityDate="2017-01-12T16:23:11.007" Title="Can't seem to get reverse relational field working from within a Neo field" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;relatedto&gt;&lt;plugin-neo&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18475" PostTypeId="1" AcceptedAnswerId="18482" CreationDate="2017-01-11T15:32:37.943" Score="0" ViewCount="242" Body="&lt;p&gt;Is this deliberate, or a bug? Delete an order and the products within the order don't have their stock updated again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm only running Craft Commerce 1.2.1327 but I don't see any mention of it in the update notes to the current version so I'm not sure updating is the answer. I'm also cautious about updating at the moment in case it breaks my third-party payment gateway plugin.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-01-11T23:29:55.477" Title="Craft Commerce stock not updated when order deleted" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18476" PostTypeId="2" ParentId="8694" CreationDate="2017-01-11T15:51:37.747" Score="2" Body="&lt;p&gt;&lt;code&gt;{% requireLogin %}&lt;/code&gt; is intended for use with your own login form on the frontend rather than the standard /admin one. From the docs for &lt;a href=&quot;https://craftcms.com/docs/config-settings#loginPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;loginPath&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#loginPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;The URI Craft should use for user login on the front-end.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which means you create your own frontend login form, and set that as the &lt;code&gt;loginPath&lt;/code&gt;. As you don't have that, it's defaulting to the default login instead, which redirects users to the admin dashboard instead of the page they were on.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-01-12T14:07:07.350" LastActivityDate="2017-01-12T14:07:07.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18478" PostTypeId="1" AcceptedAnswerId="18481" CreationDate="2017-01-11T19:26:46.973" Score="1" ViewCount="144" Body="&lt;p&gt;I have two equal variables comparing each other which give me false.&#xA;One variable is set out of ancestor entry in structure and another one out of ancestor entry as well.&#xA;Both variables are set a bit differently.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.ancestorOf(entry).order('lft desc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Following variable is set within table field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entryId.table %}&#xA;&#xA;    {% set id = row.entryId %}&#xA;    {% set rowParent = craft.entries.ancestorOf(id).order('lft desc').first() %}&#xA;&#xA;    {% if rowParent == parent %}&#xA;        // Go&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both variables print the same text with case sensitive letters and spaces.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-01-11T23:20:59.277" Title="Why two equal variables give false statement?" Tags="&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18480" PostTypeId="1" AcceptedAnswerId="18483" CreationDate="2017-01-11T20:52:06.850" Score="1" ViewCount="84" Body="&lt;p&gt;Looking to setup a public facing, launchpad page that lists out all of the user accounts with a 1 click login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize the security implications of such a page but we need something like this to rapidly test multiple accounts different sections of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to create something like this?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2017-01-11T23:38:10.810" Title="1 click auto login for user accounts" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18481" PostTypeId="2" ParentId="18478" CreationDate="2017-01-11T23:20:59.277" Score="3" Body="&lt;p&gt;It seems like you're trying to compare two EntryModel objects. Could you just compare their ids?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if rowParent.id == parent.id %}&#xA;    // Go&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, try using &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig's dump() function&lt;/a&gt; to find out exactly what's in those variables/objects.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&#xA;    {{ dump(parent) }}&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe you'll have to have &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; enabled to use &lt;code&gt;dump()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-01-11T23:20:59.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18482" PostTypeId="2" ParentId="18475" CreationDate="2017-01-11T23:29:55.477" Score="0" Body="&lt;p&gt;Definitely deliberate.  Inventory reduction when an order is placed is a &quot;convenience&quot; thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a million reasons why an order might be deleted and only a handful of them would have anything to do with inventory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18475/craft-commerce-stock-not-updated-when-order-deleted#comment25148_18475&quot;&gt;André points&lt;/a&gt; out... you could write a simple plugin to have whatever behavior you wanted around this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-11T23:29:55.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18483" PostTypeId="2" ParentId="18480" CreationDate="2017-01-11T23:38:10.810" Score="2" Body="&lt;p&gt;As long as you're already aware of the security implications. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write a &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt; that exposes a controller action where you pass in the user's ID to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that action does is call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;loginUserById($userId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-11T23:38:10.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18484" PostTypeId="2" ParentId="18282" CreationDate="2017-01-11T23:49:25.840" Score="1" Body="&lt;p&gt;This should get you headed in the right direction: &lt;a href=&quot;https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5920" LastActivityDate="2017-01-11T23:49:25.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18485" PostTypeId="1" AcceptedAnswerId="18486" CreationDate="2017-01-12T02:30:20.440" Score="5" ViewCount="377" Body="&lt;p&gt;I see for users, I can add a hidden field &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; value=&quot;1&quot; /&amp;gt;&lt;/code&gt; to remove the uploaded photo, however I need to allow this functionality for an assets field in an entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried submitting an empty file field, but it just retains the existing uploaded asset after submission. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a trigger similar to &lt;code&gt;deleteUserPhoto&lt;/code&gt; that I can use here?&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2017-01-12T07:47:20.717" Title="How do I allow a user to remove an uploaded asset from a front-end entry form?" Tags="&lt;assets&gt;&lt;entry&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18486" PostTypeId="2" ParentId="18485" CreationDate="2017-01-12T07:47:20.717" Score="8" Body="&lt;p&gt;File fields are used for uploading new images. To delete all the Assets for a field, submit a hidden field with no values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assetsField]&quot; value=&quot;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, you want to retain some of them, then make that hidden field an array with the values you'd like to keep. Like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assetsField][]&quot; value=&quot;someAssetId&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assetsField][]&quot; value=&quot;someOtherAssetId&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;someAssetId&lt;/code&gt; and &lt;code&gt;someOtherAssetId&lt;/code&gt; being the Asset IDs you'd like to keep for that field.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-01-12T07:47:20.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18488" PostTypeId="1" CreationDate="2017-01-12T11:44:08.167" Score="0" ViewCount="145" Body="&lt;p&gt;We've got a HeroSlider on our website, and I no longer wish for the slider to slide (if that makes sense?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the homepage is 3 slides, however when I remove the 2 slides I don't want, the 1st slide still tries to slide, and in doing so disappears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need it to be static.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can see the code for the slider is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        var $heading    = $('.heroslider-text h2');&#xA;        var $para       = $('.heroslider-text p');&#xA;        var $btn        = $('.heroslider-text .btn');&#xA;&#xA;        // Define animation sequence for hero elements.&#xA;        if($para.length){&#xA;            this.seq = [&#xA;                { elements: $heading, properties: { opacity: [1, 0], translateY:[0, 50] }, options: { duration: 250 } },&#xA;                { elements: $para, properties: { opacity: [1, 0], translateY:[0, 50] }, options: { delay:60, duration: 250, sequenceQueue: false } },&#xA;                { elements: $btn, properties: { opacity: [1, 0], translateY:[0, 50] }, options: { delay:60,  duration: 250, sequenceQueue: false } }&#xA;            ];&#xA;        } else {&#xA;            this.seq = [&#xA;                { elements: $heading, properties: { opacity: [1, 0], translateY:[0, 50] }, options: { duration: 250 } },&#xA;                { elements: $btn, properties: { opacity: [1, 0], translateY:[0, 50] }, options: { delay:60,  duration: 250, sequenceQueue: false } }&#xA;            ];&#xA;        }&#xA;&#xA;    };&#xA;&#xA;    this.runSequence = function(){&#xA;        if($('.heroslider-text').hasClass('animated')){&#xA;            $.Velocity.RunSequence(this.seq);&#xA;        }&#xA;    };&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5999" LastEditorUserId="22" LastEditDate="2017-05-09T20:38:15.130" LastActivityDate="2017-05-09T20:38:15.130" Title="How to stop a Slider" Tags="&lt;templating&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2017-01-13T05:52:54.113" ContentLicense="CC BY-SA 3.0" />
  <row Id="18489" PostTypeId="2" ParentId="18488" CreationDate="2017-01-12T11:54:56.517" Score="1" Body="&lt;p&gt;Maybe use a smarter slider? I frequently use &lt;a href=&quot;http://kenwheeler.github.io/slick/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slick&lt;/a&gt;, which will only initialise when the number of items is &gt; 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, within my template code I would only include the markup required only for the slider if the number of slides is &gt; 1, as I like to keep my markup clean. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if entry.hero|length &amp;gt; 1 %}&amp;lt;div class=&quot;hero-slider&quot;&amp;gt;{% endif %}&#xA;    // Hero / Slider markup goes here…&#xA;  {% if entry.hero|length &amp;gt; 1 %}&amp;lt;/div&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-01-12T11:54:56.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18490" PostTypeId="2" ParentId="18488" CreationDate="2017-01-12T11:59:01.663" Score="0" Body="&lt;p&gt;If you no longer want the slider to be a slider, you can remove the relevant javascript and then it should just do nothing.&#xA;It's hard to say exactly what javascript to remove as you haven't provided all of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you may want to alter the asset field settings to only allow 1 image in this field otherwise multiple could be output.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2017-01-12T11:59:01.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18491" PostTypeId="1" AcceptedAnswerId="18497" CreationDate="2017-01-12T13:06:00.973" Score="4" ViewCount="1709" Body="&lt;p&gt;Is possible to dump a query made on a twig template for a statement like this one for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.section('homepage')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we some how see the actual SQL query ?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2017-01-12T22:14:17.133" LastActivityDate="2018-08-28T21:08:49.587" Title="Dump SQL query in Twig template" Tags="&lt;templating&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18493" PostTypeId="1" AcceptedAnswerId="18498" CreationDate="2017-01-12T14:14:44.903" Score="1" ViewCount="291" Body="&lt;p&gt;I'm new to Twig, and I'm struggling to compare a value from a checkbox with a value from a drop-down&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {# sourceCountry - checkbox with a list of countries #}&#xA;   {# currentUser.country - dropdown with a list of countries #}&#xA;&#xA;   {% for sourceCountry in region.targetCountries %}&#xA;      {{ sourceCountry }} = {{ currentUser.country }}   &amp;lt;br&amp;gt;&#xA;      {{ dump(sourceCountry == currentUser.country) }}&#xA;      {% if sourceCountry == currentUser.country %} &#xA;         {% set visibility = true %}&#xA;      {% endif %}&#xA;   {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result I'm getting from this is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;GB = GB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;bool(false)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely something to do with variable types, but no idea how to solve this. I've searched for some Twig 'to string' conversions, but no luck.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2017-01-12T15:07:19.930" Title="Drop-down and checkbox in a condition" Tags="&lt;templating&gt;&lt;drop-down&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18494" PostTypeId="1" AcceptedAnswerId="18539" CreationDate="2017-01-12T14:29:57.177" Score="1" ViewCount="93" Body="&lt;p&gt;I'm trying to alter a products tax category whenever it's saved based on a condition.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_products.onSaveProduct', function(Event $event){&#xA;    $product = $event-&amp;gt;params['product'];&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;id = $product-&amp;gt;productFilterArtist[0]-&amp;gt;id;&#xA;    $artist = $criteria-&amp;gt;first();&#xA;&#xA;    //Craft::dd($product-&amp;gt;taxCategoryId); // 2&#xA;&#xA;    if ($artist-&amp;gt;getContent()-&amp;gt;vatRegistered) {&#xA;        $product-&amp;gt;taxCategoryId = 1;&#xA;        //Craft::dd($product-&amp;gt;taxCategoryId); // 1&#xA;    }&#xA;&#xA;    $success = craft()-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&#xA;    //Craft::dd($product-&amp;gt;taxCategoryId); // 1&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears to work as the output of each &lt;code&gt;Craft::dd&lt;/code&gt; is correct. However the entry still shows the original tax category in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been able to alter the shipping category in the same way without trouble. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-16T12:27:08.753" Title="Changing a product's Tax Category ID onSaveProduct event" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18495" PostTypeId="1" CreationDate="2017-01-12T14:36:50.900" Score="1" ViewCount="861" Body="&lt;p&gt;Recently moved server from Rackspace to AWS. A lot of media in our entries is hosted by rackspace cloud servers. How intensive would it be to move these all to Amazon S3 in regards to linking media to entries?&lt;/p&gt;&#xA;" OwnerUserId="6128" LastActivityDate="2017-01-12T14:56:11.217" Title="Moving from Rackspace cloud files to Amazon S3" Tags="&lt;assets&gt;&lt;amazon&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18496" PostTypeId="2" ParentId="18495" CreationDate="2017-01-12T14:56:11.217" Score="1" Body="&lt;p&gt;I would recommend not drag-n-dropping inside Craft. It might end up being very intense indeed, and break down in multiple ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better way would be to download the media locally, replicating the folder structure and files in the S3 bucket, and then manually changing the source id of the Asset / Folders in question in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For concurrent uploading, take a look at &lt;a href=&quot;https://github.com/bloomreach/s4cmd&quot; rel=&quot;nofollow noreferrer&quot;&gt;s4cmd&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-01-12T14:56:11.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18497" PostTypeId="2" ParentId="18491" CreationDate="2017-01-12T14:58:45.673" Score="3" Body="&lt;p&gt;You can see each SQL query that is run for a page by turning &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; on and opening your console to read the 'Profiling Summary Report'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a total query count and each query beings with &lt;code&gt;system.db.CDbCommand.query&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd advise maybe isolating the twig code on its own template to avoid having to work out which query was a result of the twig code you're after.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-12T14:58:45.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18498" PostTypeId="2" ParentId="18493" CreationDate="2017-01-12T15:07:19.930" Score="2" Body="&lt;p&gt;A checkboxes field returns an array of models, that you can inspect using &lt;code&gt;{{ dump(sourceCountry) }}&lt;/code&gt; in your loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The model has a &lt;code&gt;__toString&lt;/code&gt; method that outputs the checkbox value when you output the model using &lt;code&gt;{{ sourceCountry }}&lt;/code&gt;. This magic method doesn’t do its thing when you use the model in a comparison operator, so you are currently comparing a model to a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Access the value property directly and your conditional should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if sourceCountry.value == 'GB' %} &#xA;    {% set visibility = true %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-01-12T15:07:19.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18499" PostTypeId="2" ParentId="18450" CreationDate="2017-01-12T15:23:34.573" Score="1" Body="&lt;p&gt;You could also export the data to a CSV with your own SQL commands. These commands could be created in a way to take parameter that your client could set through the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a plugin&lt;/a&gt; with a &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; method that runs your SQL query. Take a look at the docs for more info on &lt;a href=&quot;https://craftcms.com/docs/plugins/database&quot; rel=&quot;nofollow noreferrer&quot;&gt;querying the database&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-12T15:23:34.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18500" PostTypeId="1" AcceptedAnswerId="18504" CreationDate="2017-01-12T15:30:42.000" Score="4" ViewCount="413" Body="&lt;p&gt;We're running a craftcms-backed site that uses sessions only for the admin pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a few reasons, we'd like to disable session logic for all other urls:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the &lt;code&gt;Set-Cookie&lt;/code&gt; header that craft uses to initiate a session makes responses uncacheable in our fronting cache layers&lt;/li&gt;&#xA;&lt;li&gt;the code path under &lt;code&gt;Craft\UserSessionService&lt;/code&gt; is unnecessary overhead for most of our logic, and occasionally adds considerable latency&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We've been using &lt;code&gt;HeaderHelper::removeHeader('Set-Cookie');&lt;/code&gt; on a per-controller basis to turn off this behavior, but that only gets us so far - for example, &lt;code&gt;404&lt;/code&gt; responses seem to try to initiate user sessions as well, before any of our custom logic can be used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7azls.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7azls.png&quot; alt=&quot;This is a screenshot of newrelic transaction trace for a 404 response&quot;&gt;&lt;/a&gt;&#xA;(This is a screenshot of newrelic transaction trace for a 404 response)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we get craftcms to stop trying to set these sessions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should note that we're looking into getting session storage out of the filesystem and into redis, which should also help - but most of the sessions we're keeping are meaningless, and I'd rather not keep track of them at all.&lt;/p&gt;&#xA;" OwnerUserId="5547" LastEditorUserId="57" LastEditDate="2017-01-13T19:39:47.197" LastActivityDate="2017-01-13T19:39:47.197" Title="How can I disable sessions for most of my Craft site?" Tags="&lt;config&gt;&lt;session&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18501" PostTypeId="1" CreationDate="2017-01-12T16:29:10.580" Score="0" ViewCount="424" Body="&lt;p&gt;Good afternoon. It would appear that i've lost all my entries! I still have the headings, but where I would have entries added (the pages i would edit on my site), i have nothing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is all still on my site thank goodness. Is there anyway I can recover this, Or revert back to a previous &quot;backup&quot; point as you would in windows?&lt;/p&gt;&#xA;" OwnerUserId="5999" LastEditorUserId="22" LastEditDate="2017-05-09T20:37:13.533" LastActivityDate="2017-05-09T20:37:13.533" Title="How to recover lost entries" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18502" PostTypeId="2" ParentId="18501" CreationDate="2017-01-12T19:48:24.210" Score="1" Body="&lt;p&gt;Any chance you've got xDebug installed on the server?  If so, sounds like you're running into this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1559/why-are-some-entry-detail-views-empty-in-the-control-panel/1560#1560&quot;&gt;Why are some entry detail views empty in the control panel?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, your data isn't missing from the database, so there's no need to revert.  You just need to fix the underlying problem so the edit entry page can display properly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-12T19:48:24.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18503" PostTypeId="1" CreationDate="2017-01-12T20:09:22.620" Score="0" ViewCount="255" Body="&lt;p&gt;I'm building a property developers website and it has a carousel at the bottom of the individual property pages, in which I want to show five other related properties from the same group in the structure and not the entry on the current page also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have currently in the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for nextSibling in craft.entries.section('availablehomes').limit('5') %}&#xA;...content...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I've tried many different ways suggested, but I can only get it to show the current property in a continuous loop. So need some help please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attached a screen shot of the carousel and the structure below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to clarify, when I'm in the page that's in Lockeswood / Plot 1, I'd like to show the other plots that are under it in the structure, and then if that is less than 5, I'd like it to include the next plots from level(2) in the structure to make it 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/inHLo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/inHLo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZPiMk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZPiMk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've now got it to show entries listed after only, but still need it to show the entries within the relevant group in the structure first before showing other groups entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = craft.entries.positionedAfter(entry).level('2') %}&#xA;{% for entry in var.limit('5') %}&#xA;&amp;lt;div class=&quot;related-carousel-cell&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;property&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ entry.plotGallery.first().getUrl('relatedArticlesLarge') }}&quot; class=&quot;property-image img-responsive&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;{{ entry.parent ? entry.parent.title }} - &amp;lt;span style=&quot;white-space: nowrap;&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is outputting the following for Lockeswood / Plot 1, however, the Plot 2 page would not include Plot 1 in it's list as it's now only show entries after the current entry and not the whole group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kts3q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kts3q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-01-12T22:09:49.980" LastActivityDate="2017-01-12T22:09:49.980" Title="Related entries from level 2 in structure" Tags="&lt;structure&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18504" PostTypeId="2" ParentId="18500" CreationDate="2017-01-12T22:31:19.890" Score="3" Body="&lt;p&gt;I'm not sure there is going to be an easy way to do this in Craft 2, unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the upcoming Craft 3, we refactored the session logic so that a session will only get started on requests that actually &lt;em&gt;need&lt;/em&gt; session, which is basically what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-12T22:31:19.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18505" PostTypeId="1" AcceptedAnswerId="18528" CreationDate="2017-01-13T03:11:00.373" Score="0" ViewCount="122" Body="&lt;p&gt;I am using Craft locally, at &lt;code&gt;localhost:8888&lt;/code&gt; with free MAMP. I am unable to upload images using the Assets uploader. The images in Assets were dropped in manually in their directory.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Permissions for Craft are 774 (&lt;code&gt;/app&lt;/code&gt;, &lt;code&gt;/config&lt;/code&gt;, &lt;code&gt;/storage&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;File system path: &lt;code&gt;/Users/myuser/repos/craft-learn/craftapp/public/assets/i/artists/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;URL: &lt;code&gt;http://localhost:8888/assets/i/artists/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;version 2.6.2958&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What should I check?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DwWC2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DwWC2.png&quot; alt=&quot;Asset Upload Spins Endlessly&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6130" LastEditorUserId="22" LastEditDate="2017-05-09T20:34:52.573" LastActivityDate="2017-05-09T20:34:52.573" Title="Assets Uploader Just Spins and Does Nothing Else" Tags="&lt;assets&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18506" PostTypeId="2" ParentId="18447" CreationDate="2017-01-13T09:45:33.873" Score="5" Body="&lt;p&gt;You can combine multiple relationship criteria by passing an array to the &lt;code&gt;relatedTo&lt;/code&gt; parameter with the keyword &lt;code&gt;'and'&lt;/code&gt; or &lt;code&gt;'or'&lt;/code&gt; as the first array element. You want your entries to be related to any of the tags, so this should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery() %}&#xA;&#xA;{# Make sure selectedTagIds is an array #}&#xA;{% set selectedTagIds = query.tags ?? [] %}&#xA;&#xA;&amp;lt;form action=&quot;&quot;&amp;gt;&#xA;    {% for tag in craft.tags.group('colorTag') %}&#xA;        {% set checkedAttr = tag.id in selectedTagIds ? 'checked' : '' %}&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ tag.id }}&quot; {{ checkedAttr }}&amp;gt;{{ tag.name }}&amp;lt;/input&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% for tag in craft.tags.group('shapeTag') %}&#xA;        {% set checkedAttr = tag.id in selectedTagIds ? 'checked' : '' %}&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ tag.id }}&quot; {{ checkedAttr }}&amp;gt;{{ tag.name }}&amp;lt;/input&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{# Prepare our relatedTo parameter #}&#xA;{% set relatedToParam = ['or'] %}&#xA;&#xA;{% for id in selectedTagIds %}&#xA;    {% set relatedToParam = relatedToParam|merge([{&#xA;        targetElement: id&#xA;    }]) %}&#xA;{% endfor %}&#xA;&#xA;{# Make sure to not pass the param with just the 'or' in the array #}&#xA;{% set relatedToParam = relatedToParam|length &amp;gt; 1 ? relatedToParam : null %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'foo',&#xA;    relatedTo: relatedToParam,&#xA;}) %}&#xA;&#xA;{# Query for the entries and return them #}&#xA;{% for entry in entries %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-01-17T22:44:31.963" LastActivityDate="2017-01-17T22:44:31.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18509" PostTypeId="1" AcceptedAnswerId="21882" CreationDate="2017-01-13T13:24:38.350" Score="1" ViewCount="661" Body="&lt;p&gt;We've made a local copy of a site that is working fine in a staging environment but locally is getting the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`Invalid argument supplied for foreach()`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seemingly coming from &lt;code&gt;craft/app/fieldtypes/BaseOptionsFieldtype&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have any thoughts on what is causing this and how to resolve? Is happening both in the front-end and the admin area. &lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-09-08T12:23:44.137" Title="`Invalid argument supplied for foreach()` error" Tags="&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18511" PostTypeId="1" CreationDate="2017-01-13T15:19:46.787" Score="1" ViewCount="392" Body="&lt;p&gt;I have a site made in English and need to add another locale that will be almost identical to the original site. However while adding new locales everything bar the asset entries are being copied. This is a problem as there are already many articles with image asset fields and new articles are not copying assets across locales either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried making the asset field Translatable and Not Translatable. These fields are not in a matrix.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Solved - What was needed was to use the Update Asset Indexes tool in the settings of craft. If I do this just after creating a new Locale, before doing anything else, when my articles are created they know where to look for their assets. So relieved &lt;/p&gt;&#xA;" OwnerUserId="5689" LastEditorUserId="45" LastEditDate="2017-01-16T22:18:29.940" LastActivityDate="2017-01-16T22:18:29.940" Title="Locales - New locales not copying assets across" Tags="&lt;assets&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18512" PostTypeId="1" AcceptedAnswerId="18581" CreationDate="2017-01-13T15:20:31.733" Score="6" ViewCount="1555" Body="&lt;p&gt;What is the preferred method to remove an empty tag from the content of a rich text element?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;  Lorem&amp;lt;a href=&quot;…&quot;&amp;gt;&amp;lt;/a&amp;gt; ipsum&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When editing text in the WYSIWYG editor (Redactor) the result can contain empty anchor tags. This is a problem when navigating the page with the tab key, for instance, because the user can not see the focus anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I automatically remove those artefacts?&lt;/p&gt;&#xA;" OwnerUserId="5261" LastActivityDate="2017-01-18T13:20:24.377" Title="How to remove empty tags in rich text? (Redactor or Twig)" Tags="&lt;templating&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18513" PostTypeId="2" ParentId="18511" CreationDate="2017-01-13T16:08:26.903" Score="1" Body="&lt;p&gt;If the Asset field is set up to be &lt;strong&gt;not translatable&lt;/strong&gt;, the selected assets should actually be the same across all of your locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is set up to be &lt;strong&gt;translatable&lt;/strong&gt;, it doesn’t copy over the selection on the first save (or when a new locale was added) because of a Craft bug. See this question for more info: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1709/how-do-i-get-matrix-elements-to-copy-their-content-across-language-locales&quot;&gt;How do I get Matrix elements to copy their content across language Locales?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-01-13T16:08:26.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18514" PostTypeId="2" ParentId="18440" CreationDate="2017-01-13T18:18:02.083" Score="1" Body="&lt;p&gt;I've gotten a bit further into this that is &lt;em&gt;slightly&lt;/em&gt; beyond the scope of my original question, but I think it's worth bringing up for the benefit of others (like me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer my original question, this is how I was able to make it work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set i = 0 %}&#xA;    {{ user.foo[i].bar }}&#xA;    ...&#xA;{% set i = i + 1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if your templates start to become more complex, and/or need more or different types of looping, you might want to consider looking at a &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#hook-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;template hook&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works pretty slick. Let's say I am getting data from an api or some other service (using a plugin). This is how you would use a hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% hook 'myAwesomeHook' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since it is recommended to place the hook logic in the &lt;code&gt;init&lt;/code&gt; method of your plugin, this is what that would look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;public function init() {&#xA;    craft-&amp;gt;template()-&amp;gt;hook('myAwesomeHook', function(&amp;amp;$context) {&#xA;       foreach($context['user'] as $user) {&#xA;         return $user; // or do whatever you need.&#xA;       }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-01-13T18:18:02.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18515" PostTypeId="1" CreationDate="2017-01-13T19:32:01.747" Score="1" ViewCount="80" Body="&lt;p&gt;&lt;code&gt;tl;dr;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I tell the webhook callback from Stripe to Charge which template to use for e-mailing the donor when a recurring payment is successfully charged when I don't know what &lt;code&gt;planAmount&lt;/code&gt; the user will choose?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have a form that I predefine some donation amounts as radio inputs defined as Craft fields...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set donationAmountOptions = craft.fields.getFieldByHandle('donationAmount').settings.options %}&#xA;&#xA;{% set checkedStandard = (charge is defined and charge.planAmount == amt.value)? 'checked' : '' %}&#xA;&amp;lt;div class=&quot;medium-2 columns float-left&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;planAmount-{{ amt.value }}&quot;&amp;gt;&#xA;        &amp;lt;input id=&quot;planAmount-{{ amt.value }}&quot; type=&quot;radio&quot; value=&quot;{{ amt.value }}&quot; name=&quot;planAmount&quot; {{ checkedStandard }}&amp;gt;&#xA;        &amp;lt;strong&amp;gt;${{ amt.label }}&amp;lt;/strong&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but then I offer the user an &quot;other amount&quot; number type input where they can define their own donation amount...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;planAmount-other-amt&quot;&amp;gt;&#xA;   &amp;lt;input id=&quot;planAmount-other-amt&quot; type=&quot;radio&quot; value=&quot;{{ (charge is defined ? charge.donationOtherAmount) }}&quot; name=&quot;planAmount&quot; {{ (charge is defined and charge.planAmount == charge.donationOtherAmount)? 'checked' }} required class=&quot;float-left small-4&quot;&amp;gt;&#xA;   &amp;lt;span class=&quot;float-left small-4&quot;&amp;gt;Other Amount&amp;lt;/span&amp;gt;&#xA;   &amp;lt;input id=&quot;otherAmtInput&quot; type=&quot;number&quot; value=&quot;{{ (charge is defined ? charge.donationOtherAmount) }}&quot; placeholder=&quot;0.00&quot; name=&quot;fields[donationOtherAmount]&quot; class=&quot;float-left small-4&quot;&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use jQuery to assign the value to the accompanying radio input because the radio inputs all have to be called &lt;code&gt;planAmount&lt;/code&gt; in order for Charge to send the correct amount over to Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I give them the ability to decide if that payment will be one-time or recurring on a monthly or yearly basis. Values must be either &lt;code&gt;&amp;lt;empty&amp;gt;&lt;/code&gt;, &lt;code&gt;month&lt;/code&gt;, or &lt;code&gt;year&lt;/code&gt;, in order for Stripe to know what kind of recurring payment to set up.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set donationRecurrenceOptions = craft.fields.getFieldByHandle('donationRecurrence').settings.options %}&#xA;&#xA;&amp;lt;label for=&quot;donationRecurrence&quot;&amp;gt;&#xA;    Donation Recurrence&#xA;    &amp;lt;select name=&quot;planInterval&quot; id=&quot;donationRecurrence&quot; value=&quot;{{ (charge is defined ? charge.planInterval) }}&quot; &amp;gt;&#xA;    {% for recurrenceOption in donationRecurrenceOptions %}&#xA;        &amp;lt;option value=&quot;{{ recurrenceOption.value }}&quot;&amp;gt;{{ recurrenceOption.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;planIntervalCount&quot; value=&quot;0&quot; id=&quot;planIntervalCount&quot;&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case anyone comes across this in a similar situation, you &lt;strong&gt;must&lt;/strong&gt; have this field above called &lt;code&gt;planIntervalCount&lt;/code&gt; and it must be set to &lt;code&gt;1&lt;/code&gt; if there was a recurring interval chosen. I do this through jQuery based on the dropdown choice above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have everything working and Stripe will create a new &quot;subscription&quot; (if it doesn't exist) based on the &lt;code&gt;planInterval&lt;/code&gt; chosen and the &lt;code&gt;planAmount&lt;/code&gt; that the user either chooses from the radio inputs or the amount that the user inputs in the &quot;other amount&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, here comes the caveat: Since the user can choose their own amount instead of the predefined radio inputs, I don't know how to tell Charge or Stripe which e-mail template to use when a recurring payment gets successfully (or unsuccessfully) charged. I thought I could use this setting below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set chargePaymentOptions = { &#xA;   'allowDynamic' : true, &#xA;   'planCurrency': 'usd',&#xA;   'actions': {&#xA;       'onSuccess':{&#xA;              'email':{ 0: 'donation-successful',&#xA;                        1: 'admin-donation-notification' },&#xA;              'subscription': 'recurring-donation'&#xA;        } &#xA;    }&#xA; } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I realized that this is going to assign &lt;em&gt;everyone&lt;/em&gt; to that subscription. How do I tell the webhook callback from Stripe to Charge which template to use for e-mailing the donor when a recurring payment is successfully charged?&lt;/p&gt;&#xA;" OwnerUserId="5997" LastEditorUserId="5997" LastEditDate="2017-01-16T14:18:41.350" LastActivityDate="2017-01-16T14:18:41.350" Title="Assign an e-mail template to recurring payment with dynamic amounts" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18516" PostTypeId="1" CreationDate="2017-01-13T19:34:02.937" Score="1" ViewCount="578" Body="&lt;p&gt;I have entries in a structure section. I'd like the users to view the list of entries without the entries themselves being assigned URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set a URL for the top level of a Structure section without enabling &quot;Entry URL Format&quot;?&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2017-01-13T22:52:53.977" LastActivityDate="2017-04-14T00:42:20.760" Title="How to set a URL for the top level of a Structure section?" Tags="&lt;structure&gt;&lt;url&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18517" PostTypeId="1" AcceptedAnswerId="18518" CreationDate="2017-01-13T21:20:50.037" Score="0" ViewCount="22" Body="&lt;p&gt;Default Disqus embed code includes the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var disqus_config = function () {&#xA;    this.page.url =   // Replace PAGE_URL with your page's canonical URL variable&#xA;    this.page.identifier = {{ entry.section }}-{{ entry.id }}; // Replace PAGE_IDENTIFIER with your page's unique identifier variable&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to use &lt;code&gt;this.page.url = {{ entry.url }}&lt;/code&gt;.  This prints the url, but it includes the &lt;code&gt;http://&lt;/code&gt; and the &lt;code&gt;:&lt;/code&gt; is throwing an error preventing Disqus from loading.  Is there anyway to template the url without the http://????&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the config I am using is straight from Disqus.  The CraftCMS knowledge base article does not include &lt;code&gt;this-page&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2017-01-13T22:32:17.740" LastActivityDate="2017-01-13T22:32:17.740" Title="Templating - printing entry.url throws js error when trying to embed Disqus?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18518" PostTypeId="2" ParentId="18517" CreationDate="2017-01-13T21:50:44.240" Score="1" Body="&lt;p&gt;Try wrapping your entry.url in quotes so JS reads it as a string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;this.page.url = '{{entry.url}}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2017-01-13T21:50:44.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18519" PostTypeId="2" ParentId="18516" CreationDate="2017-01-13T22:30:37.757" Score="0" Body="&lt;p&gt;A section in Craft (regardless of it is a Single, Channel or Structure section) is defined by a combination of your Craft Site URL (defined under &lt;code&gt;Settings-&amp;gt;General&lt;/code&gt; or overwritten via &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#siteUrl&lt;/a&gt;) and that section's &quot;Entry URL Format&quot; under the section's settings (&lt;code&gt;Settings-&amp;gt;Sections-&amp;gt;(your structure section)-&amp;gt;Entry URL Format&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about them here: &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/sections-and-entries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-13T22:30:37.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18520" PostTypeId="1" CreationDate="2017-01-14T01:00:47.130" Score="2" ViewCount="383" Body="&lt;p&gt;I have a date stored in the database in UTC.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2016-01-13 09:01:16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can query the database and output this date just fine. But it outputs in the date in the wrong timezone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I adjust a date from the database into the current user's locale?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this involves using &lt;code&gt;craft()-&amp;gt;timezone&lt;/code&gt; at some point, with some method, but I have not had any luck. I'm retrieving the date with the query builder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$rows = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;         -&amp;gt;select('dateCreated')&#xA;         -&amp;gt;from('mytable')&#xA;         -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus points&lt;/strong&gt;: sometimes I have multiple dates, so I need to modify all dates I get back into the right timezone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More bonus points&lt;/strong&gt;: at what point in the process is the best point to modify the date into the right timezone? In MySQL query? In PHP? In Twig?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-01-14T05:37:37.657" Title="How do I convert a date stored in UTC to the user's current locale in PHP?" Tags="&lt;localization&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18521" PostTypeId="2" ParentId="18520" CreationDate="2017-01-14T05:37:37.657" Score="1" Body="&lt;p&gt;Here is some code used in the past. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$timezone = new \DateTimeZone(craft()-&amp;gt;getTimeZone());&#xA;$newdate = \DateTime::createFromFormat(DateTime::MYSQL_DATETIME, $mysqlDate, $timezone);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have typically done this before assigning to a model. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-01-14T05:37:37.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18522" PostTypeId="1" CreationDate="2017-01-14T08:43:14.373" Score="1" ViewCount="246" Body="&lt;p&gt;I've just upgraded PHP 7.0 on a standard Ubuntu Server 16.04 LTS distro from non-thread safe to thread safe (using Michel Phillipe Luca's instructions here: &lt;a href=&quot;http://php.net/manual/de/pthreads.installation.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://php.net/manual/de/pthreads.installation.php&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a CLI method set up which was working perfectly fine, but after installing the thread-safe version of PHP (with no changes to the code), when I try to run &lt;code&gt;./craft/app/etc/console/yiic plugin method&lt;/code&gt; I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Uncaught Error: Class 'Craft\ErrorHandler' not found in /var/www/asmar/subdomains/site/craft/app/framework/YiiBase.php:213&#xA;Stack trace:&#xA;#0 /var/www/asmar/subdomains/site/craft/app/framework/base/CModule.php(393): YiiBase::createComponent(Array)&#xA;#1 /var/www/asmar/subdomains/site/craft/app/etc/console/ConsoleApp.php(220): CModule-&amp;gt;getComponent('errorHandler', true)&#xA;#2 /var/www/asmar/subdomains/site/craft/app/framework/base/CApplication.php(468): Craft\ConsoleApp-&amp;gt;getComponent('errorHandler')&#xA;#3 /var/www/asmar/subdomains/site/craft/app/framework/base/CApplication.php(749): CApplication-&amp;gt;getErrorHandler()&#xA;#4 [internal function]: CApplication-&amp;gt;handleException(Object(Error))&#xA;#5 {main}&#xA;  thrown in /var/www/asmar/subdomains/site/craft/app/framework/YiiBase.php on line 213&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas how I may squash this?&lt;/p&gt;&#xA;" OwnerUserId="5364" LastEditorUserId="5364" LastEditDate="2017-01-14T19:28:39.760" LastActivityDate="2017-01-14T19:28:39.760" Title="Class 'Craft\ErrorHandler' not found in YiiBase.php after new Thread-Safe PHP install" Tags="&lt;php&gt;&lt;yiic&gt;&lt;cli&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18523" PostTypeId="1" CreationDate="2017-01-14T15:40:17.760" Score="1" ViewCount="331" Body="&lt;p&gt;I have a page that lists all of the property developments of my client, and am able to show the lists of the categories in the dropdown fields, but I can't work out how to get them to actually change the results below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached is a screenshot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I get the results below the filters to change to only show the selected item in the dropdown? Am completely stuck on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be really helpful is a simple walkthrough of what I need to do to make the selected filter output results on the page, as is a complicated subject. And need it explaining in detail if possible, as am a beginner at this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0JoPT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0JoPT.png&quot; alt=&quot;dropdown filter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;form class=&quot;form-inline&quot; action=&quot;{{ url('developments') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;county1&quot;&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;        &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;          &amp;lt;select id=&quot;county1&quot; class=&quot;form-control&quot; name=&quot;county1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;            &amp;lt;option&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            {% for category in craft.categories.group('counties').order('title asc') %}&#xA;            &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      ........more dropdown code...&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;  &amp;lt;section class=&quot;developments&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;      {% for category in craft.categories.group('developments').order('title asc') %}&#xA;      ......code for block...&#xA;      {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-01-14T21:21:51.753" LastActivityDate="2017-02-14T18:25:53.563" Title="Search entries by location or name" Tags="&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18524" PostTypeId="1" CreationDate="2017-01-15T02:32:22.187" Score="0" ViewCount="389" Body="&lt;p&gt;I am running a site using CraftCMS and have a shared CloudFlare SSL certificate in place. Based on my understanding, the content source (i.e. my website) is not safe, while the content delivered to the user by CloudFlare is secure. While accessing the website works perfectly fine, logging in to the Control Panel is a major issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am assuming that I will need an SSL certificate available on my server to secure the content source and thereby be able to log into the control panel using the &lt;code&gt;https&lt;/code&gt; domain as opposed to the IP address or the &lt;code&gt;http&lt;/code&gt; alternative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I getting this correct or is there some way to log into the control panel using a shared CloudFlare SSL certificate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the console message I am referring to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mixed Content: The page at 'https://www.mysite.com/admin/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.mysite.com/index.php/admin/actions/users/login'. This request has been blocked; the content must be served over HTTPS.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6111" LastActivityDate="2017-02-02T09:40:01.637" Title="CloudFlare Shared SSL certificate forbids CraftCMS control panel sign in" Tags="&lt;request&gt;&lt;https&gt;&lt;ssl&gt;&lt;cloudflare&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18526" PostTypeId="2" ParentId="18511" CreationDate="2017-01-15T15:28:24.100" Score="2" Body="&lt;p&gt;Solved - What was needed was to use the Update Asset Indexes tool in the settings of craft. If I do this just after creating a new Locale, before doing anything else, when my articles are created they know where to look for their assets. So relieved&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also noticed that to get a matrix to copy across locales (as well as setting the matrix field to NOT TRANSLATABLE and the fields within the matrix to TRANSLATABLE) it was necessary to do a slight change to the original matrix after creating a new asset (such as adding a space after the title). This forced the matrix to copy across. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else &lt;/p&gt;&#xA;" OwnerUserId="5689" LastActivityDate="2017-01-15T15:28:24.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18528" PostTypeId="2" ParentId="18505" CreationDate="2017-01-15T17:02:35.147" Score="2" Body="&lt;p&gt;The solution was to use MAMP Pro instead of MAMP free. i cannot answer with complete authority why, but MAMP Pro has abilities that MAMP free doesn't.&lt;/p&gt;&#xA;" OwnerUserId="6130" LastActivityDate="2017-01-15T17:02:35.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18529" PostTypeId="1" CreationDate="2017-01-15T17:10:15.387" Score="3" ViewCount="1289" Body="&lt;p&gt;I have an existing CMS website that seemingly has been working fine for several months.  Just recently we have lost the ability to access the admin portion of the site (the rest of the site works well).  To our knowledge, nothing has changed to make the site behave differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have since set up our own dev box with identical code and it seems to behave the same way.  Works one day, next day we can't log in.  No errors in browser or log files.  Browser cache and cookies cleared.  Different browsers all work the same way.  You log in, it blinks a second, then redirects to login.  If wrong password entered, we get the wrong password error.  Even the database seems to show our login was good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have multiple environments on the original site, only the production environment has this issue.  Our second environment only has the production environment so i don't think they are conflicting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only thing i can think of is nginx cache but we don't cache the admin directories.  I don't see anything different in .htaccess that would do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6137" LastActivityDate="2018-07-26T08:52:31.993" Title="CMS login redirects to back to login" Tags="&lt;login&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18530" PostTypeId="2" ParentId="18523" CreationDate="2017-01-15T17:39:27.170" Score="1" Body="&lt;p&gt;I managed to solve it finally, by starting from what was suggested in the comments. Basically to get the filter to work in Craft I've added &lt;code&gt;action=&quot;{{ url('developments') }}&quot;&lt;/code&gt; to the form class, which keeps the url on the same page, and then on the  tag I added a &lt;code&gt;name=&quot;county1&quot;&lt;/code&gt; and some javascript to get it to reload when it's selected using &lt;code&gt;onchange=&quot;this.form.submit()&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the results below I set a query variable using &lt;code&gt;{% set query = craft.request.getParam('county1') %}&lt;/code&gt; and then created a second variable called queryFilter to search the correct category, based on the selected field &lt;code&gt;{% set queryFilter = craft.categories.group('developments').search(query).order('title asc') %}&lt;/code&gt; which to print out the results is then referenced via a for loop {% for category in queryFilter %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's quite a few steps to get it to work, so it's not something that's obvious from the Craft documentation, which doesn't have hardly anything on this subject that I've found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code as whole so that it help makes sense to someone trying to do the same type of thing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form-inline&quot; action=&quot;{{ url('developments') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;county1&quot;&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;      &amp;lt;select id=&quot;county1&quot; class=&quot;form-control&quot; name=&quot;county1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;all&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;        {% for category in craft.categories.group('counties').order('title asc') %}&#xA;        &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;section class=&quot;developments&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;        {% set query = craft.request.getParam('county1') %}&#xA;        {% set queryFilter = craft.categories.group('developments').search(query).order('title asc') %}&#xA;&#xA;        {% if queryFilter %}&#xA;        {% for category in queryFilter %}&#xA;        &amp;lt;div class=&quot;development-block&quot;&amp;gt;&#xA;&#xA;        ....markup...&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-01-15T17:39:27.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18531" PostTypeId="1" CreationDate="2017-01-15T19:39:29.270" Score="0" ViewCount="126" Body="&lt;p&gt;I keep seeing this deprecation message every time I upgrade Craft and cannot figure out what's going on for the life of me. There is nothing in the stack trace (that I can see) that points to a specific template file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the full stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; Deprecation error: The Tag ‘name’ property has been deprecated. Use ‘title’ instead.&#xA;&#xA;&amp;gt;Called from /Users/Rhys/www/madebydusk.com/live/craft/app/models/TagModel.php (109)&#xA;&#xA;&amp;gt;16 Craft\TagModel::getName() Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/base/CComponent.php (111)&#xA;&#xA;&amp;gt;15 Craft\TagModel::__get(&quot;name&quot;) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/models/BaseModel.php (87)&#xA;&#xA;&amp;gt;14 Craft\TagModel::__get(&quot;name&quot;) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/models/BaseElementModel.php (141)&#xA;&#xA;&amp;gt;13 Craft\TagModel::__get(&quot;name&quot;) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/services/SearchService.php (78)&#xA;&#xA;&amp;gt;12 Craft\SearchService::indexElementAttributes(Craft\TagModel) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/tools/SearchIndexTool.php (99)&#xA;&#xA;&amp;gt;11 Craft\SearchIndexTool::performAction(array(&quot;id&quot; =&amp;gt; &quot;340&quot;, &quot;type&quot; =&amp;gt; &quot;Tag&quot;)) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/controllers/ToolsController.php (50)&#xA;&#xA;&amp;gt;10 Craft\ToolsController::actionPerformAction() Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/web/actions/CInlineAction.php (49)&#xA;&#xA;&amp;gt;9  CInlineAction::runWithParams(array()) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/web/CController.php (308)&#xA;&#xA;&amp;gt;8  Craft\ToolsController::runAction(CInlineAction) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/web/CController.php (286)&#xA;&#xA;&amp;gt;7  Craft\ToolsController::runActionWithFilters(CInlineAction, array()) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/web/CController.php (265)&#xA;&#xA;&amp;gt;6  Craft\ToolsController::run(&quot;performAction&quot;) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/web/CWebApplication.php (282)&#xA;&#xA;&amp;gt;5  Craft\WebApp::runController(&quot;tools/performAction&quot;) Called from /Users/Rhys/www/madebydusk.com/live/craft/app/etc/web/WebApp.php (817)&#xA;&#xA;&amp;gt;4  Craft\WebApp::_processActionRequest() Called from /Users/Rhys/www/madebydusk.com/live/craft/app/etc/web/WebApp.php (287)&#xA;&#xA;&amp;gt;3  Craft\WebApp::processRequest() Called from /Users/Rhys/www/madebydusk.com/live/craft/app/framework/base/CApplication.php (185)&#xA;&#xA;&amp;gt;2  Craft\WebApp::run() Called from /Users/Rhys/www/madebydusk.com/live/craft/app/index.php (62)&#xA;&#xA;&amp;gt;1  require_once(&quot;/Users/Rhys/www/madebydusk.com/live/craft/app/index.php&quot;) Called from /Users/Rhys/www/madebydusk.com/live/public/index.php (19)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-01-16T08:55:14.643" Title="The Tag ‘name’ property has been deprecated. Use ‘title’ instead" Tags="&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2017-01-16T20:59:04.020" ContentLicense="CC BY-SA 3.0" />
  <row Id="18532" PostTypeId="1" CreationDate="2017-01-15T19:41:55.853" Score="1" ViewCount="242" Body="&lt;ol&gt;&#xA;&lt;li&gt;Why he generate the PDF again and again when nothing changes? Is there a hidden option for that?&lt;/li&gt;&#xA;&lt;li&gt;I tried to use it with the Google Font &lt;code&gt;Rubik&lt;/code&gt; but no chance. Any Ideas?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to Save the generated PDF in an Asset field to the Post?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've a preparse Field at the Moment but I've nothing what I can prompt if it's exist or not. He also regenerate the PDF on every Save. No cool :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Preparse Field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;  {% if not entry.preparsePrintmakerCertificate|length %}&#xA;    {% set html %}&#xA;      &amp;lt;html&amp;gt;&#xA;      &amp;lt;head&amp;gt;&#xA;        &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;/&amp;gt;&#xA;        &amp;lt;style&amp;gt;&#xA;          @page {&#xA;            margin: 0in;&#xA;          }&#xA;&#xA;          @font-face {&#xA;            font-family: 'Rubik Webfont';&#xA;            src: url('/assets/fonts/Rubik-Black.ttf') format('truetype');&#xA;            font-weight: 900;&#xA;            font-style: normal;&#xA;          }&#xA;&#xA;          body {&#xA;            font-family: &quot;Rubik Webfont&quot;, sans-serif;&#xA;            font-weight: 900;&#xA;            margin: 0;&#xA;            padding: 0;&#xA;            font-size: 160px;&#xA;            line-height: 1;&#xA;            width: 100%;&#xA;            height: 100%;&#xA;            position: relative;&#xA;            color: #2e3743;&#xA;            text-transform: uppercase;&#xA;            letter-spacing: -6px;&#xA;            background-image: url('/assets/images/bitmap/printmaker/certificate_background.png');&#xA;          }&#xA;&#xA;          .background {&#xA;            position: fixed;&#xA;            width: 100%;&#xA;            height: 100%;&#xA;            left: 0;&#xA;            right: 0;&#xA;            top: 0;&#xA;            bottom: 0;&#xA;          }&#xA;&#xA;          .name {&#xA;            position: fixed;&#xA;            width: 1000px;&#xA;            left: 356px;&#xA;            top: 2764px;&#xA;          }&#xA;&#xA;          .date {&#xA;            position: fixed;&#xA;            width: 900px;&#xA;            left: 356px;&#xA;            top: 4318px;&#xA;          }&#xA;        &amp;lt;/style&amp;gt;&#xA;      &amp;lt;/head&amp;gt;&#xA;      &amp;lt;body&amp;gt;&#xA;      &amp;lt;div class=&quot;background&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;name&quot;&amp;gt;&#xA;          {{ entry.title }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;date&quot;&amp;gt;&#xA;          &amp;lt;span class=&quot;month&quot;&amp;gt;{{ entry.postDate.format('M') }}&amp;lt;/span&amp;gt;&#xA;          &amp;lt;span class=&quot;day&quot;&amp;gt;{{ entry.postDate.format('d') }}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&#xA;          &amp;lt;span class=&quot;year&quot;&amp;gt;{{ entry.postDate.format('Y') }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/body&amp;gt;&#xA;      &amp;lt;/html&amp;gt;&#xA;    {% endset %}&#xA;&#xA;    {% set settings = {&#xA;        filename : 'bestwebsite-gallery_sotd_' ~ entry.postDate.format('Y-m-d') ~ '_' ~ entry.slug|kebab&#xA;    } %}&#xA;    {% set pdfUrl = craft.printmaker.pdfFromHtml(html, settings).url %}&#xA;    {{ pdfUrl }}&#xA;  {% endif %}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="57" LastEditDate="2017-01-15T22:36:12.313" LastActivityDate="2017-01-16T02:32:19.140" Title="Printmaker Plugin — Some Questions" Tags="&lt;pdf&gt;&lt;plugin-printmaker&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18533" PostTypeId="1" AcceptedAnswerId="18542" CreationDate="2017-01-15T19:44:54.860" Score="1" ViewCount="299" Body="&lt;p&gt;I have a multiple dropdown filters that lets users pick the category that they want to display results for below. See my previous question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18523/search-entries-by-location-or-name&quot;&gt;Search entries by location or name&lt;/a&gt; for screenshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have one working, but I need some guidance on how to do the code for the other filters as well, as currently my code for linking up to the second filter is stopping the first filter from working correctly. So clearly I'm doing it wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have four dropdown filters, but I'll simplify it to two filters for this example. The filters are named &lt;code&gt;name=&quot;county1&quot;&lt;/code&gt; and &lt;code&gt;name=&quot;development1&quot;&lt;/code&gt; in their respective  tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then I'm using the following to access them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('county1') %}&#xA;{% set query = craft.request.getParam('development1') %}&#xA;{% set queryFilter = craft.categories.group('developments').search(query).order('title asc') %}&#xA;&#xA;{% for category in queryFilter %}&#xA;&#xA;....markup...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone tell me what i need to do to fix this so that the filters don't interfere with each other?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-16T15:33:29.573" Title="Multiple dropdown filters interfering with each other" Tags="&lt;search&gt;&lt;request&gt;&lt;query&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18534" PostTypeId="1" AcceptedAnswerId="18597" CreationDate="2017-01-15T20:16:55.113" Score="2" ViewCount="414" Body="&lt;p&gt;I'm very new at Craft templating, and I can't seem to get an asset to link correctly in the browser.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        {{ siteUrl }}&#xA;        &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.blog_body }}&#xA;        {% for asset in entry.blog_featured_image %}&#xA;            &amp;lt;img src=&quot;{{asset.url}}&quot; alt=&quot;{{asset.title}}&quot; /&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Becomes this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;article&amp;gt;&#xA;  &amp;lt;h1&amp;gt;New Blog 1&amp;lt;/h1&amp;gt;&#xA;  http://localhost/craftcms/public/&#xA;  &amp;lt;p&amp;gt;Posted on January 15, 2017&amp;lt;/p&amp;gt;&#xA;  &amp;lt;p&amp;gt;&quot;Body Text&quot;&amp;lt;/p&amp;gt;&#xA;  &amp;lt;img src=&quot;{{ siteUrl }}assets/images/image.png&quot; alt=&quot;title&quot;&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when output to a browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ siteUrl }} will display the path just fine, but when I'm using {{asset.url}} and it gets changed to {{siteUrl}} it doesn't create the path, it just stays at siteUrl. This is really confusing me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why doesn't {{ siteUrl }} return the base path when it's used in the asset.url?&lt;/p&gt;&#xA;" OwnerUserId="6138" LastActivityDate="2017-01-19T18:02:59.137" Title="Localhost: Why does {{ asset.url }} return {{siteUrl}}/path in the browser?" Tags="&lt;assets&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18535" PostTypeId="2" ParentId="18532" CreationDate="2017-01-16T02:32:19.140" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Unfortunately, &lt;em&gt;Printmaker&lt;/em&gt; must regenerate the PDF on every save... It can’t simply check to see whether a certain PDF file already exists, because the underlying content or template may have changed that PDF was last generated. You can use Craft's template caching to capture PDF URLs/filenames, to avoid unnecessarily generating the PDF if &lt;em&gt;you&lt;/em&gt; know the underlying content hasn't changed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can use Google Fonts (or any other external web font) by linking an external stylesheet, or by including the &lt;code&gt;@font-face&lt;/code&gt; directive in your inline styles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Printmaker&lt;/em&gt; saves PDF to files in a cache directory that you specify, but it doesn't create or update an Asset element. You could write a custom plugin to do that, leveraging Printmaker's API. Alternatively, you can commission &lt;em&gt;Top Shelf Craft&lt;/em&gt; to develop the functionality you need.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Feel free to write &lt;code&gt;support@topshelfcraft.com&lt;/code&gt; or post additional questions here on SE if I can be of further help!&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2017-01-16T02:32:19.140" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18536" PostTypeId="2" ParentId="18531" CreationDate="2017-01-16T08:55:14.643" Score="2" Body="&lt;p&gt;As mentioned in the comments by Brad, this is a bug and has been fixed in the next release.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-01-16T08:55:14.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18537" PostTypeId="1" CreationDate="2017-01-16T11:55:08.467" Score="1" ViewCount="642" Body="&lt;p&gt;I'd like to use the &lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist/overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortlist&lt;/a&gt; plugin to allow visitors to create product wishlists - using Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have setup the 'add to wishlist' function, but I am not sure how to then display the items that a user has add to their wishlist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below, is the example given on the plugin docs for how to loop through the items a user has added, but this does not produce the required results for commerce products.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if shortlistLists is empty %}&#xA;You have no lists at the moment.&#xA;{% else %}&#xA;    {% for list in lists %}&#xA;    &amp;lt;h3&amp;gt;{{ list.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% if list.items is empty %}&#xA;    No items in this list&#xA;    {% else %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for item in list.items %}&#xA;            &amp;lt;li&amp;gt;{{ item.title }} (&amp;lt;a href=&quot;{{ item.removeActionUrl }}&quot;&amp;gt;Remove&amp;lt;/a&amp;gt;)&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The docs for the plugin are available here - &lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist/usage/quickstart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://squarebit.co.uk/software/craft/shortlist/usage/quickstart&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could point me in the right direction as to how to successfully use the plugin in conjunction with Craft Commerce, that would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2018-05-21T07:44:37.617" Title="Using Shortlist plugin to create product wishlist" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-shortlist&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18539" PostTypeId="2" ParentId="18494" CreationDate="2017-01-16T12:27:08.753" Score="1" Body="&lt;p&gt;Setting the new field value &lt;code&gt;onSaveProduct&lt;/code&gt; meant that the only the general element and its custom field data was being saved and not the tax ID on the product model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve this, the &lt;code&gt;onBeforeSaveProduct&lt;/code&gt; event should be used. This allows modification of the product model before it's saved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_products.onBeforeSaveProduct', function(Event $event){&#xA;    $product = $event-&amp;gt;params['product'];&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;id = $product-&amp;gt;productFilterArtist[0]-&amp;gt;id;&#xA;    $artist = $criteria-&amp;gt;first();&#xA;    if ($artist &amp;amp;&amp;amp; $artist-&amp;gt;getContent()-&amp;gt;vatRegistered) {&#xA;        $product-&amp;gt;taxCategoryId = 1;&#xA;    }&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-01-16T12:27:08.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18540" PostTypeId="1" AcceptedAnswerId="18553" CreationDate="2017-01-16T13:32:43.247" Score="0" ViewCount="86" Body="&lt;p&gt;How do I set the cartCookieDuration and purgeInactiveCartsDuration for only 24 hours?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2017-01-16T23:36:35.327" LastActivityDate="2017-01-16T23:40:59.243" Title="cartCookieDuration and purgeInactiveCartsDuration config settings" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18542" PostTypeId="2" ParentId="18533" CreationDate="2017-01-16T15:19:29.733" Score="1" Body="&lt;p&gt;If your goal is to filter by one drop-down value at a time then you could use an if statement to check if the passed value is set for each drop-down.  This will only work if each drop-down has an option that is blank or it submits on select so that the other drop-down is not set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = &quot;&quot; %}&#xA;{% if craft.request.getParam('country1') and &#xA;      craft.request.getParam('country1') is not empty %}&#xA;    {% set query = craft.request.getParam('country1') %}&#xA;{% elseif craft.request.getParam('development1') and &#xA;          craft.request.getParam('development1') is not empty %}&#xA;    {% set query = craft.request.getParam('development1') %}&#xA;{% endif %}&#xA;&#xA;{% for category in queryFilter %}&#xA;&#xA;....markup...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-01-16T15:33:29.573" LastActivityDate="2017-01-16T15:33:29.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18543" PostTypeId="1" AcceptedAnswerId="18556" CreationDate="2017-01-16T15:37:08.473" Score="1" ViewCount="1617" Body="&lt;p&gt;Recently I've noticed that file uploads through the Craft admin panel have started to fail with the response &quot;Error uploading the file: Uploaded file was empty&quot;. This error occurs when trying to upload a file to the server or to S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, I was able to get around the issue by switching to a different browser or clearing the current browsers history and cookies. For some reason that would consistently alleviate the issue for any user who tried it, but as of last week this no longer appears to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Checking file permissions for the asset folder, they're set to 777&lt;/li&gt;&#xA;&lt;li&gt;Increasing the php memory_limit, post_max_size, and upload_max_filesize&lt;/li&gt;&#xA;&lt;li&gt;Uploading different file types and sizes looking for specific type or size that works, even a 20kb jpg fails.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Has anyone seen this before or have an idea where to look to fix the issue?&lt;/p&gt;&#xA;" OwnerUserId="6142" LastEditorUserId="6142" LastEditDate="2017-01-16T20:43:24.107" LastActivityDate="2017-01-17T00:04:02.373" Title="Why does asset uploading fail with the error &quot;Uploaded file was empty&quot;?" Tags="&lt;upload&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18544" PostTypeId="1" CreationDate="2017-01-16T17:25:35.430" Score="1" ViewCount="227" Body="&lt;p&gt;I currently have a search box which returns results, but only seems to return results if the search term is an exact match. For example, if i search hospital I will get 5 results back with the name hospital in the title, but if i search hospitals i will get no matches found. I would like the search to return results that are close to the search term as well. This is how i have it set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my search box. It returns to the same page as my index page has an &lt;code&gt;{% include &quot;components/search&quot; %}&lt;/code&gt; to display on the homepage.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;form class=&quot;navbar-search&quot; action=&quot;{{ url('') }}&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;input-group add-on&quot;&amp;gt;&#xA;        &amp;lt;input class=&quot;form-control&quot; placeholder=&quot;Search&quot; name=&quot;q&quot; id=&quot;srch-term&quot; type=&quot;search&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;input-group-btn&quot;&amp;gt;&#xA;        &amp;lt;button class=&quot;btn btn-default&quot; type=&quot;submit&quot;&amp;gt;&amp;lt;i class=&quot;glyphicon glyphicon-search&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then my search component is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{% paginate craft.entries.section('Organizations').search('title:' ~ query).order('score').limit(10) as entries %}&#xA;    {% if entries|length &amp;lt; 1 %}&#xA;        {% paginate craft.entries.section('Organizations').search('organizationSummary:' ~ query).order('score').limit(10) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the title returns no search results I wanted it to search through a summary section instead. Currently it works very well except for only returning exact terms. I'm a bit stuck as I'm ordering by score as shown in the Craft documentation so not sure what I am missing here. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5732" LastEditorUserId="57" LastEditDate="2017-01-16T23:45:47.810" LastActivityDate="2017-06-16T03:52:33.013" Title="Search results by closest match to query" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18545" PostTypeId="1" CreationDate="2017-01-16T17:59:26.520" Score="2" ViewCount="574" Body="&lt;p&gt;Im trying to use entry titles as options in a select field, &lt;a href=&quot;https://solspace.com/craft/freeform/docs/formatting-templates/&quot; rel=&quot;nofollow noreferrer&quot;&gt;similar to the last example on this page in the docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Position Applying For&amp;lt;/label&amp;gt;&#xA;&amp;lt;select name=&quot;{{ positionApplyingFor.handle }}&quot;&amp;gt;&#xA;{% for entry in craft.entries.section('careers') %}&#xA;  &amp;lt;option value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;    {{ entry.title }}&#xA;  &amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although the form submits, the fields content is not shown in the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add {% if field.value == entry.handle %} selected{% endif %}, I get the error &quot;Variable &quot;field&quot; does not exist&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="6143" LastActivityDate="2017-01-17T01:35:18.537" Title="Loop through entry titles in a select field" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18546" PostTypeId="1" AcceptedAnswerId="18626" CreationDate="2017-01-16T18:18:22.433" Score="5" ViewCount="303" Body="&lt;p&gt;I'm using the Store Hours plugin to output store hours like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] %}&#xA;{% set daysShort = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] %}&#xA;&#xA;&amp;lt;dl class=&quot;store-details-hours__list&quot;&amp;gt;&#xA;  {% for dayHours in entry.hoursOfOperation %}&#xA;    &amp;lt;dt class=&quot;store-details-hours__day&quot;&amp;gt;{{ days[loop.index0] }}&amp;lt;/dt&amp;gt;&#xA;&#xA;    {% if dayHours.open|length and dayHours.close|length %}&#xA;&#xA;      &amp;lt;dd class=&quot;store-details-hours__hours&quot;&#xA;        itemprop=&quot;openingHours&quot; content=&quot;{{ daysShort[loop.index0] }} {{ dayHours.open|date('h:i') }} - {{ dayHours.close|date('h:i') }}&quot;&amp;gt;{{ dayHours.open|date('h:i a') }} - {{ dayHours.close|date('h:i a') }}&amp;lt;/dd&amp;gt;&#xA;    {% else %}&#xA;    &amp;lt;dd class=&quot;store-details-hours__hours&quot;&#xA;      itemprop=&quot;openingHours&quot; content=&quot;{{ daysShort[loop.index0] }} Closed&quot;&amp;gt;Closed&amp;lt;/dd&amp;gt;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/dl&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works okay and outputs like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3NkS4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3NkS4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I really need is to be able to group the days if the hours are the same so that it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RjYJG.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RjYJG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also important that I can set an attribute tag on the &lt;code&gt;&amp;lt;dd&amp;gt;&lt;/code&gt; of &lt;code&gt;content=&quot;Mo,Tu,We, 10:00-17:00&quot;&lt;/code&gt; So how do I group days of the week and output the hours the way my client wants it to look?&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="3951" LastEditDate="2017-11-16T19:42:27.447" LastActivityDate="2017-11-20T20:42:26.287" Title="Store Hours (group days by hours)" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18547" PostTypeId="1" AcceptedAnswerId="18558" CreationDate="2017-01-16T20:15:47.433" Score="1" ViewCount="356" Body="&lt;p&gt;I have a plugin that includes a &lt;a href=&quot;https://bootstrap-datepicker.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;datepicker&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initialize the datepicker like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;javascript&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.datepicker').datepicker({&#xA;    'format': 'mm/dd/yyyy',&#xA;    'todayHighlight': true&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am saving the date from my plugin like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myDate = craft()-&amp;gt;request-&amp;gt;getPost('myDate');&#xA;if ($myDate) {&#xA;    DateTime::createFromString($myDate, craft()-&amp;gt;timezone);&#xA;}&#xA;&#xA;$fieldsLocation = craft()-&amp;gt;request-&amp;gt;getParam('fieldsLocation', 'fields');&#xA;$entry-&amp;gt;setContentFromPost($fieldsLocation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because I have designated this field to be required, I get an error back saying that the field cannot be blank. Even though I have chosen a date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change my datepicker to use &lt;em&gt;this&lt;/em&gt; format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.datepicker').datepicker({&#xA;    'format': 'yyyy/mm/dd',&#xA;    'todayHighlight': true&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works.&#xA;I like how &quot;human/U.S&quot; friendly the top example is vs. &lt;code&gt;yyyy-mm-dd&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am populating the entry with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContentFromPost($fieldsLocation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to convert what is passed in to the correct format Craft is looking for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$date = date(str_replace('/', '-', craft()-&amp;gt;request-&amp;gt;getPost('myDate')));&#xA;&#xA;$myDate = date('Y-m-d', strtotime($date));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that is getting overwritten by this guy still:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry-&amp;gt;setContentFromPost($fieldsLocation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-01-17T04:21:55.010" LastActivityDate="2017-01-17T04:21:55.010" Title="How can I convert a date format from my plugin so it saves correctly?" Tags="&lt;plugin-development&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18548" PostTypeId="1" AcceptedAnswerId="18590" CreationDate="2017-01-16T20:24:15.003" Score="0" ViewCount="382" Body="&lt;p&gt;I have a search form that contains a dropdown based on categories and a text field to search by title. This works the way it should. Now I need to add an extra text field to search by location as well but when I do that the search form doesn't work anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# defaults #}&#xA;    {% set queryParams = {&#xA;      section: 'klanten',&#xA;      order: 'title asc',&#xA;    } %}&#xA;&#xA;&#xA;    {# Build a category array beginning with 'and' and add targetElement objects with selected categories Ids to it #}&#xA;    {% set categoriesArray = ['and'] %}&#xA;&#xA;    {% set searchCat = craft.request.getParam('cat') %}&#xA;    {% if searchCat is not empty %}&#xA;      {% set searchThemeCat = craft.categories.slug(searchCat).ids() %}&#xA;      {% set categoriesArray = categoriesArray|merge([{&#xA;        targetElement: searchThemeCat,&#xA;      }]) %}&#xA;    {% endif %}&#xA;&#xA;&#xA;    {% if categoriesArray|length &amp;gt; 1 %}&#xA;&#xA;      {% set queryParams = queryParams|merge({&#xA;        relatedTo: categoriesArray&#xA;      }) %}&#xA;&#xA;    {% endif %}&#xA;&#xA;    {# search #}&#xA;    {% set searchQ = craft.request.getParam('q') %}&#xA;    {% if searchQ is not empty %}&#xA;      {% set queryParams = queryParams|merge({&#xA;        search: {&#xA;          query: 'title:' ~ searchQ,&#xA;          subLeft: true,&#xA;          subRight: true,&#xA;        }&#xA;      }) %}&#xA;    {% endif %}&#xA;&#xA;{% set klantEntries = craft.entries(queryParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I thought adding the following would allow me to search by location as well but instead it says 'no results are found for &quot;&quot;' which means that it search query is empty, I guess?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchL = craft.request.getParam('loc') %}&#xA;    {% if searchL is not empty %}&#xA;      {% set queryParams = queryParams|merge({&#xA;        search: {&#xA;          query: 'klantLocation:' ~ searchL,&#xA;          subLeft: true,&#xA;          subRight: true,&#xA;        }&#xA;      }) %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't really know how to fix it, I've been looking through a lot of examples but I can't get it to work, any help would be appreciated&lt;/p&gt;&#xA;" OwnerUserId="5363" LastActivityDate="2017-01-18T20:00:11.410" Title="Search not working with extra field" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18549" PostTypeId="2" ParentId="18545" CreationDate="2017-01-16T20:28:54.593" Score="3" Body="&lt;p&gt;The issue is you don't have a variable named &lt;code&gt;input&lt;/code&gt;. I changed the code a little by included a variable named &lt;code&gt;value&lt;/code&gt;. To make sure the proper option is selected you would need to pass back to the template a url param &lt;code&gt;name&lt;/code&gt; with the currently selected option value.  If there is a param and it has a value it will add that value to the variable &lt;code&gt;value&lt;/code&gt; if not &lt;code&gt;value&lt;/code&gt; will be blank.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Position Applying For&amp;lt;/label&amp;gt;&#xA;{% set value = craft.request.getParam(&quot;name&quot;)?? &quot;&quot; %}&#xA;&amp;lt;select name=&quot;{{ positionApplyingFor.handle }}&quot;&amp;gt;&#xA;    {% for entry in craft.entries.section('careers') %}&#xA;        &amp;lt;option value=&quot;{{ entry.title }}&quot; {% if value == entry.title %}selected{% endif %}&amp;gt;&#xA;            {{ entry.title }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-01-17T01:35:18.537" LastActivityDate="2017-01-17T01:35:18.537" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18550" PostTypeId="1" CreationDate="2017-01-16T20:58:13.470" Score="1" ViewCount="975" Body="&lt;p&gt;I'm having a difficult time with what seems like a fairly straightforward problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm listing businesses and their related hours of operation (days/times). I'd like to set up a conditional statement that checks if a Matrix field has content—if so, display hours. If not, display message. My code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hours.block('days')|length %} &amp;lt;!-- I am trying to check Matrix field &quot;days&quot; is empty (content exists) --&amp;gt;&#xA;&amp;lt;div class=&quot;entry__hours&quot;&amp;gt;&#xA;  &amp;lt;table&amp;gt;&#xA;    &amp;lt;tbody&amp;gt;&#xA;      {% for block in entry.hours %}&amp;lt;!-- Loop through days/times...this part works fine --&amp;gt;&#xA;      &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td class=&quot;entry__days&quot;&amp;gt;{{ block.days }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td class=&quot;entry__times&quot;&amp;gt;{{ block.times }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;/tr&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/tbody&amp;gt;&#xA;  &amp;lt;/table&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% else %} &amp;lt;!-- This part does not show up if Matrix field &quot;days&quot; is empty --&amp;gt;&#xA;  &amp;lt;p&amp;gt;We're still trying to track down hours.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also attached a screenshot of my Matrix setup. Thanks so much in advance&lt;img src=&quot;https://i.stack.imgur.com/2cQ5z.png&quot; alt=&quot;![enter image description here&quot;&gt;]&lt;a href=&quot;https://i.stack.imgur.com/2cQ5z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6144" LastActivityDate="2017-01-16T21:44:54.960" Title="Conditional check if Matrix block field is empty (no content)" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18551" PostTypeId="2" ParentId="18550" CreationDate="2017-01-16T21:44:54.960" Score="3" Body="&lt;p&gt;I'm assuming your matrix field is not called hours? Because in your current code you are handeling it like it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% for block in entry.matrixfieldHandle %}&#xA;       {% if block|length %}&#xA;           {{block.days}} - {{block.time}}&#xA;       {% else %}&#xA;           &amp;lt;p&amp;gt;Do something else&amp;lt;/p&amp;gt;&#xA;       {% endif% }&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your code you want to loop over all the different entries (blocks) within the matrix. If you want to add other types you can easely check for hours like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;hours&quot; %}&#xA;   do stuff&#xA;{% elseif block.type == &quot;anotherblocktype&quot; %}&#xA;   ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However. Since you only use one type of content I'm not sure if a matrix is the best solution. You could easely put this in a table or &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;supertable&lt;/a&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could just do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.tableHandle %}&#xA;   {% if row|length %}&#xA;       {{row.text}}&#xA;   {% else % }&#xA;       &amp;lt;p&amp;gt;Fallback&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option is to check this little plugin: &lt;a href=&quot;https://github.com/pixelandtonic/StoreHours&quot; rel=&quot;nofollow noreferrer&quot;&gt;Store hours&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-16T21:44:54.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18552" PostTypeId="1" CreationDate="2017-01-16T22:30:17.313" Score="1" ViewCount="175" Body="&lt;p&gt;I'm building out a store locator map and everything is going well. All store locations get output on the map and when I search with either a city or a postal code the map filters the results correctly. However if I add in a province, whether the full name or abbreviation) there are no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to resolve this. The form is above the map with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set formPost = craft.request.getPost('query') %}&#xA;{% if formPost %}&#xA;  {#&#xA;    testing what the post variable is equal to&#xA;    will use this to set different options in map&#xA;&#xA;  {{ formPost }} - this is a post variable&#xA;  #}&#xA;{% else %}&#xA;  {% set formPost = &quot;noPost&quot; %}&#xA;{% endif %}&#xA;&#xA;{#&#xA;  // use this post variable and a conditional to  filter the map&#xA;#}&#xA;&#xA;&amp;lt;form action=&quot;/store/find&quot; method=&quot;post&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;query&quot; id=&quot;query&quot; class=&quot;form-control&quot; placeholder=&quot;City, Province or Postal Code&quot; &amp;gt;&#xA;    &amp;lt;button class=&quot;btn btn-primary find-a-store-form__button&quot; type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The map is rendered with the following code using conditionals to check if a post variable exists.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if formPost == &quot;noPost&quot; %}&#xA;  {# no filter find all stores, this is before searching #}&#xA;  {% set allStores = craft.entries.section('stores').limit(1000).find() %}&#xA;&#xA;{% else %}&#xA; {# search filters via post variable #}&#xA;&#xA; {% set target = formPost %}&#xA; {% set params = {&#xA;   target: target,&#xA;   range: 100,&#xA;   units: &quot;kilometers&quot;&#xA; } %}&#xA;  {% set allStores = craft.entries.mapAddress(params).order('distance').find() %}&#xA;{% endif %}&#xA;&#xA;{{ craft.smartMap.map(allStores, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So searching with a city or postal code works, but searching with a province (fullname or abbreviation) does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-------UPDATE----------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was recommended to move the province search to a dropdown. I've since set that up but now results do not work for either the input field or the select. I'm not sure why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryPost = craft.request.getPost('query') %}&#xA;{% set provincePost = craft.request.getPost('province') %}&#xA;&#xA;{# does post data exist? #}&#xA;{% set formPost = craft.request.getPost() | length %}&#xA;&#xA;{% if formPost %}&#xA;  {#&#xA;    testing what the post variable is equal to&#xA;    will use this to set different options in map&#xA;&#xA;  {{ formPost }} - this is a post variable&#xA;  #}&#xA;{% else %}&#xA;  {% set formPost = &quot;noPost&quot; %}&#xA;{% endif %}&#xA;&#xA;{#&#xA;  // use this post variable and a conditional to  filter the map&#xA;#}&#xA;&amp;lt;form action=&quot;/store/find&quot; method=&quot;post&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;query&quot; id=&quot;query&quot; class=&quot;form-control&quot; placeholder=&quot;City, Province or Postal Code&quot; &amp;gt;&#xA;    &amp;lt;select name=&quot;province&quot; id=&quot;province&quot; class=&quot;form-control&quot;&amp;gt;&#xA;        &amp;lt;option selected&amp;gt;--select province--&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Alberta&quot;&amp;gt;Alberta&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;British Columbia&quot;&amp;gt;British Columbia&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Manitoba&quot;&amp;gt;Manitoba&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;New Brunswick&quot;&amp;gt;New Brunswick&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Newfoundland and Labrador&quot;&amp;gt;Newfoundland and Labrador&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Nova Scotia&quot;&amp;gt;Nova Scotia&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Ontario&quot;&amp;gt;Ontario&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Prince Edward Island&quot;&amp;gt;Prince Edward Island&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Quebec&quot;&amp;gt;Quebec&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Saskatchewan&quot;&amp;gt;Saskatchewan&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Northwest Territories&quot;&amp;gt;Northwest Territories&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Nunavut&quot;&amp;gt;Nunavut&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Yukon&quot;&amp;gt;Yukon&amp;lt;/option&amp;gt;&#xA;      &amp;lt;/select&amp;gt;&#xA;    &amp;lt;button class=&quot;btn btn-primary find-a-store-form__button&quot; type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;/header&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;find-a-store-form__map&quot;&amp;gt;&#xA;&#xA;&#xA;{#&#xA;  // default map options - all stores&#xA;  // remove the center option on search results let map decide center&#xA;#}&#xA;&#xA;{% if formPost == &quot;noPost&quot; %}&#xA;  {# options for default map #}&#xA;  {% set options = {&#xA;      id: 'storeLocator',&#xA;      height: 615,&#xA;      width: 1090,&#xA;      zoom: findAStore.zoomLevel,&#xA;      zoomControl: true,&#xA;      draggable: true,&#xA;      center: {&#xA;        'lat':findAStore.mapCenterLatitude,&#xA;        'lng':findAStore.mapCenterLongitude&#xA;      },&#xA;      markerInfo: '_includes/mapInfoBubble',&#xA;      markerOptions: {&#xA;          icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;      },&#xA;      infoWindowOptions: {&#xA;          maxWidth: 200&#xA;      }&#xA;  } %}&#xA;  {# end default map options #}&#xA;&#xA;{% else %}&#xA;&#xA;&#xA;  {# begin filtered map options i.e. no center set #}&#xA;  {% set options = {&#xA;      id: 'storeLocator',&#xA;      height: 615,&#xA;      width: 1090,&#xA;      zoom: 7,&#xA;      zoomControl: true,&#xA;      draggable: true,&#xA;      markerInfo: '_includes/mapInfoBubble',&#xA;      markerOptions: {&#xA;          icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;      },&#xA;      infoWindowOptions: {&#xA;          maxWidth: 200&#xA;      }&#xA;  } %}&#xA;  {# end filtered map otions #}&#xA;{% endif %}&#xA;&#xA;&#xA;&#xA;{% if formPost == &quot;noPost&quot; %}&#xA;  {# no filter find all stores, this is before searching #}&#xA;  {% set allStores = craft.entries.section('stores').limit(1000).find() %}&#xA;&#xA;{% else %}&#xA; {# search filters via post variable #}&#xA;&#xA; {% set target = formPost %}&#xA; {% set params = {&#xA;     target: target,&#xA;     range: 100,&#xA;     units: &quot;kilometers&quot;,&#xA;     'components': {&#xA;          'administrative_area': 'provincePost',&#xA;      },&#xA;    }&#xA;  %}&#xA;&#xA;  {% set allStores = craft.entries.mapAddress(params).order('distance').find() %}&#xA;{% endif %}&#xA;&#xA;{{ craft.smartMap.map(allStores, options) }}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above code this bit, near the bottom &lt;code&gt;'administrative_area': 'provincePost',&lt;/code&gt; I've had provincePost both with and without quotes but that didn't help.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2017-01-17T15:09:16.703" LastActivityDate="2017-01-17T15:09:16.703" Title="Smart Map search not working with Province" Tags="&lt;templating&gt;&lt;plugin-smartmap&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18553" PostTypeId="2" ParentId="18540" CreationDate="2017-01-16T23:40:59.243" Score="0" Body="&lt;p&gt;If you go to the Commerce documentation for each (&lt;a href=&quot;https://craftcommerce.com/docs/configuration#cartcookieduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/configuration#cartcookieduration&lt;/a&gt; and &lt;a href=&quot;https://craftcommerce.com/docs/configuration#purgeinactivecartsduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/configuration#purgeinactivecartsduration&lt;/a&gt;), they both link to the PHP &lt;a href=&quot;http://www.php.net/manual/en/dateinterval.construct.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateInterval&lt;/a&gt; class page that describes the various time formats you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 24 hours, either &lt;code&gt;P24H&lt;/code&gt; or &lt;code&gt;P1D&lt;/code&gt; should do it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-16T23:40:59.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18554" PostTypeId="2" ParentId="15703" CreationDate="2017-01-16T23:51:55.560" Score="2" Body="&lt;p&gt;This has been requested in the Craft feedback forum (vote for it if you like, &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/12473760-ability-to-batch-edit-field-values-on-multiple-ent&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/13003440-ability-to-change-entry-values-from-the-cp-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). But as of Jan 2017, there is no functionality for this in a default Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing I've come across is the &lt;strong&gt;&lt;em&gt;NP Edit Multiple Elements&lt;/em&gt;&lt;/strong&gt; plugin which allows you to edit multiple entries &lt;em&gt;sequentially&lt;/em&gt; meaning that when you hit save it automatically advances to the next entry – faster than the default, but not exactly a bulk edit tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://straightupcraft.com/craft-plugins/np-edit-multiple-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/np-edit-multiple-elements&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to see a bulk-edit plugin at some point, but someone will need to invest the time in building one.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-01-16T23:51:55.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18555" PostTypeId="2" ParentId="18544" CreationDate="2017-01-16T23:52:15.660" Score="1" Body="&lt;p&gt;Lots going on here, but I'll take a stab at it (in the future, it's helpful if you have multiple questions/issues to make separate posts for them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your questions of &quot;why isn't this search term matching&quot; probably comes down to the fact that by default, Craft doesn't do fuzzy matching.  You can use wildcards (*) to change that behavior on a per-search basis.  You can see that syntax here along with all of the other search syntax that Craft supports: &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also of note from that page is the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultSearchTermOptions&quot; rel=&quot;nofollow noreferrer&quot;&gt;defaultSearchTerms&lt;/a&gt; config setting, where you can &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow noreferrer&quot;&gt;change&lt;/a&gt; that behavior.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Then my search component is this:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;&#xA;{% paginate craft.entries.section('Organizations').search('title:' ~ query).order('score').limit(10) as entries %}&#xA;    {% if entries|length &amp;lt; 1 %}&#xA;        {% paginate craft.entries.section('Organizations').search('organizationSummary:' ~ query).order('score').limit(10) as entries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's probably not working as expected because not only can you not nest paginate tags, you can technically only have one paginate tag per &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-16T23:52:15.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18556" PostTypeId="2" ParentId="18543" CreationDate="2017-01-17T00:04:02.373" Score="1" Body="&lt;p&gt;You'll get that message whenever Craft/PHP can't upload the file (for any number of reasons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like you've covered permissions and some common php.ini environmental limitations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's happening of &lt;em&gt;every&lt;/em&gt; file regardless of file type or size, you can probably rule out any GD or Imagick related bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other things to check for:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You're out of disk space on your hosting account.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're out of allocated space for the &lt;code&gt;/tmp&lt;/code&gt; folder on your account.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is some firewall / .htaccess rewrite rule / Suhosin / mod_security blocking the request.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's probably worth checking &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; for any errors as well as your web server's error logs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-17T00:04:02.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18558" PostTypeId="2" ParentId="18547" CreationDate="2017-01-17T03:27:01.843" Score="1" Body="&lt;p&gt;After &lt;code&gt;$entry-&amp;gt;setContentFromPost($fieldsLocation);&lt;/code&gt; you should be able to add another line to explicitly set your calculated date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContent(array('fieldName' =&amp;gt; $myDate));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then just proceed with saving the entry as normal.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2017-01-17T03:27:01.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18559" PostTypeId="1" CreationDate="2017-01-17T09:25:41.260" Score="2" ViewCount="1216" Body="&lt;p&gt;I just updated an &quot;older&quot; Craft site (version 2.4.2702) to the newest update (version 2.6.2958).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now all my image thumbnails in the back-end are missing and if I upload any new assets, the thumbnail is not generated and I get a Internal Server Error 500 on the front-end as the URL it points to is still the &lt;code&gt;cpresources/transforms/283?x=qFc4lFWR5&lt;/code&gt; kind of URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image thumbnail itself is also not generated anymore in the folder it is supposed to go in. I didn't change any folder permissions (only updated the new app folder ofcourse with the correct permissions). I'm able to upload assets so the permissions should be fine I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had issues like this before, but those were resolved, so I don't know what is causing this issue again. Is there anything I forgot about this update that I needed to change? I needed to do a manual update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logs I get are these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017-01-17 10:13:26&#xA;&#xA;Level   info&#xA;Category    application&#xA;Message [Forced] Finished task 14 (GeneratePendingTransforms).&#xA;2017-01-17 10:13:26&#xA;&#xA;Level   info&#xA;Category    application&#xA;Message [Forced] Starting task GeneratePendingTransforms that has a total of 0 steps.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do get a PhP error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[18-Jan-2017 14:04:07 UTC] PHP Fatal error: Call to undefined method Imagine\Imagick\Imagick::getImageAlphaChannel() in MY-BASE-PATH-HERE/craft/app/vendor/pixelandtonic/imagine/lib/Imagine/Imagick/Imagick.php on line 191&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But through the PhPInfo in the Craft CP I can see that Imagick extension 2.2.2 is installed with ImageMagick 6.7.2-7, so according to this page the method should exist: &lt;a href=&quot;http://php.net/manual/en/imagick.getimagealphachannel.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://php.net/manual/en/imagick.getimagealphachannel.php&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I dumbly clicked &quot;rebuild all asset indexes&quot; on the live site (instead of on the local development site in the browser tab next to it &lt;em&gt;aaargh&lt;/em&gt;) I quickly added &lt;code&gt;'imageDriver' =&amp;gt; 'gd',&lt;/code&gt; to the config as a workaround.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-01-18T15:11:32.650" LastActivityDate="2017-01-18T21:17:50.593" Title="Image Transform Internal Server Error (500 code) after Craft CMS update" Tags="&lt;image-transforms&gt;&lt;error&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18560" PostTypeId="1" AcceptedAnswerId="18577" CreationDate="2017-01-17T09:31:47.807" Score="1" ViewCount="265" Body="&lt;p&gt;I would like to add an option to the gear menu seen below in Craft Commerce, is it possible to extend those templates ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to create a plugin to export the selected orders to a CSV file&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NHjhr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHjhr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:33:26.333" LastActivityDate="2017-05-09T20:33:26.333" Title="Extending Craft Commerce admin templates" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18561" PostTypeId="1" CreationDate="2017-01-17T10:23:31.697" Score="1" ViewCount="255" Body="&lt;p&gt;On the following screenshot the image on the right called Crown Wood - Plot 1 is disabled in the CMS, so I'd like it not to show up in the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my code. I added &lt;code&gt;.status('live')&lt;/code&gt; to the for loop as suggested elsewhere in the forum but the disabled posts are still showing up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help, as I only want the section to show live entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vR48M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vR48M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = craft.entries.positionedAfter(entry).level('2') %}&#xA;{% for entry in var.limit('5').status('live') %}&#xA;&amp;lt;div class=&quot;related-carousel-cell&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;property&quot;&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;      {% if entry.plotGallery.first() %}&#xA;        &amp;lt;img src=&quot;{{ entry.plotGallery.first().getUrl('relatedArticlesLarge') }}&quot; class=&quot;property-image img-responsive&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;      {% endif %}&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ entry.parent ? entry.parent.title }} - &amp;lt;span style=&quot;white-space: nowrap;&quot;&amp;gt;{{ entry.title }}&amp;lt;/span&amp;gt;&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-01-17T11:20:47.110" Title="Disabled entries showing up" Tags="&lt;entry&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18562" PostTypeId="2" ParentId="18561" CreationDate="2017-01-17T11:20:47.110" Score="2" Body="&lt;p&gt;The code is correct, it was that I hadn't disabled the individual entries in the CMS, I'd only disabled the parent in the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So adding &lt;code&gt;.status('live')&lt;/code&gt; on the end of the for loop is the solution, and making sure every entry at all levels is disabled.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-01-17T11:20:47.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18563" PostTypeId="1" CreationDate="2017-01-17T13:41:47.207" Score="1" ViewCount="117" Body="&lt;p&gt;A client of mine uploads multiple, complex SVGs (2MB and larger) to an asset field. Unfortunately, Craft CMS isn't able to automatically generate thumbnail images (with a reduced filesize, not just rescaled!). As a result, the control panel pages for entries render unbearably slow or even crash in the browser, as all SVGs are loaded into the same view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set up Craft to display a generic icon for SVGs instead?&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2017-01-17T13:41:47.207" Title="Disable SVG previews for asset field?" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;image-transforms&gt;&lt;bug&gt;&lt;svg&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18564" PostTypeId="1" AcceptedAnswerId="18576" CreationDate="2017-01-17T14:30:21.043" Score="1" ViewCount="96" Body="&lt;p&gt;I'm really struggling with displaying news entry that are only relevant to the users' location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;User&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Country - &gt; is a dropdown with a single value (lets say UK)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regions&lt;/strong&gt; is a category that contains&lt;/p&gt;&#xA;&#xA;&lt;p&gt;name -&gt; string (for example Europe)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;countries -&gt; a checkbox with a list of countries (UK, FR.. etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;News&lt;/strong&gt; which has a Region category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I have now is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news') %}&#xA;{# loop through regions  #}  &#xA;    {% for region in entry.regions %}&#xA;        {# loop region's countries  #}&#xA;        {% for targetCountry in region.countries %}&#xA;            {% if targetCountry == currentUser.country %} &#xA;                {% set visibility = true %}  &#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, however, since the checking occurs after I get all the entries I can't use pagination. Is there a nicer way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2017-01-17T16:13:13.327" LastActivityDate="2017-01-17T23:15:43.477" Title="Display only entries relevant to users' country" Tags="&lt;entries&gt;&lt;relations&gt;&lt;pagination&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18565" PostTypeId="1" CreationDate="2017-01-17T15:23:44.967" Score="1" ViewCount="124" Body="&lt;p&gt;On the property development website I'm building for an agency client it has a section on the individual property page that shows the floorplans for the building. Which has different amounts of levels depending on the property. So for example one property might have a basement, a ground floor, and a first floor. Whereas another might have a Ground, First and Second Floor etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each floor has an image of the floorplan as well as text showing the dimensions on the left of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the design visual the floors are switched between using the dropdown button, which lists the available floors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm not sure how to approach this. Should it be a matrix, or set fields etc, and how will it link up to the dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need some guidance on the best approach that's going to make it as simple as possible for the client?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3k4gv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3k4gv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-01-17T16:40:26.117" Title="How to approach a multi-level floorplan" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18566" PostTypeId="2" ParentId="18565" CreationDate="2017-01-17T16:40:26.117" Score="4" Body="&lt;p&gt;I'd use a Matrix field with a block for each floor. Adding a block provides fields for an Asset for the floorplan and a text box for the dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dropdown is purely javascript based, and I'd suggest you put all the floors in the HTML on page load, then switch between them using the values of the dropdown field.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-01-17T16:40:26.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18567" PostTypeId="1" CreationDate="2017-01-17T18:20:21.547" Score="2" ViewCount="626" Body="&lt;p&gt;I'm seeing a lot of tasks hanging in Craft. Specifically, DeleteStaleTemplateCaches and GeneratePendingTransforms. I've followed the advice and instructions at &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt; to no avail. The article suggests that there may be PHP errors in the PHP error log. However, I'm not seeing anything there at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some digging, I see that during bootstrapping, Craft sets &lt;code&gt;error_reporting(0)&lt;/code&gt; to disable PHP error reporting if the site is not in &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt;. Does craft override the error handling to account for errors that could be lost due to turning off error reporting? I expect there may be some fatal errors happening within my tasks, which is causing them to hang, but they are being lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight or documentation into how Craft handles error logging would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a little more digging, I found that &lt;code&gt;error_reporting(0);&lt;/code&gt; does suppress certain log messages when not in devMode. This is because Craft's error handler respects the error_reporting() setting when filtering log messages. In order to reproduce, do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Turn off devMode in Craft config&lt;/li&gt;&#xA;&lt;li&gt;Set &lt;code&gt;memory_limit=1k&lt;/code&gt; in your php.ini to force a fatal php error&lt;/li&gt;&#xA;&lt;li&gt;Open your site in your browser and see the 500 as expected. At this point you won't see anything in &lt;code&gt;/storage/runtime/logs/phperrors.log&lt;/code&gt; or your web server logs.&lt;/li&gt;&#xA;&lt;li&gt;Edit &lt;code&gt;craft/app/bootstrap.php&lt;/code&gt; and set &lt;code&gt;error_reporting(E_ALL);&lt;/code&gt; around line 150, where you see &lt;code&gt;error_reporting(0);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hit your site again in your browser, and you will see a php fatal error in &lt;code&gt;/storage/runtime/logs/phperrors.log&lt;/code&gt; regarding the out of memory issue.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is this to be expected? Am I missing another configuration option which would not suppress fatal error messages?&lt;/p&gt;&#xA;" OwnerUserId="6149" LastEditorUserId="6149" LastEditDate="2017-01-19T15:11:54.607" LastActivityDate="2017-01-19T15:11:54.607" Title="Does Craft expose PHP errors when not in devMode?" Tags="&lt;error&gt;&lt;error-handling&gt;&lt;logging&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2017-01-19T21:39:14.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="18569" PostTypeId="2" ParentId="18524" CreationDate="2017-01-17T18:30:55.747" Score="1" Body="&lt;p&gt;I'd give &lt;a href=&quot;https://github.com/selvinortiz/craft.patrol&quot; rel=&quot;nofollow noreferrer&quot;&gt;Patrol&lt;/a&gt; plugin a try, just activate secure connections.&lt;/p&gt;&#xA;" OwnerUserId="5873" LastEditorUserId="142" LastEditDate="2017-02-02T09:40:01.637" LastActivityDate="2017-02-02T09:40:01.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18571" PostTypeId="1" AcceptedAnswerId="18573" CreationDate="2017-01-17T19:56:13.850" Score="2" ViewCount="59" Body="&lt;p&gt;I have a page that displays entries based on a specific tag. It works well until I apply the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#kebab&quot; rel=&quot;nofollow noreferrer&quot;&gt;kebab filter.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's my link to the page:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tag %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{ siteUrl }}tags/{{ tag.title | kebab}}&amp;quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and my tags/tag.html page looks like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.name(tag).first() %}&#xA;{% set entries = craft.entries.relatedTo(tag).order('title') %}&#xA;{% if entries | length %}&#xA;   {% for entry in entries %}&#xA;       Code here&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The page populates all entries regardless of the tag once I apply the kebab filter. How can I fix that?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-01-17T21:59:19.620" Title="Populating TAG page when using the kebab filter" Tags="&lt;templating&gt;&lt;entry&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18573" PostTypeId="2" ParentId="18571" CreationDate="2017-01-17T21:59:19.620" Score="2" Body="&lt;p&gt;For your link, change &lt;code&gt;{{ tag.title | kebab}}&lt;/code&gt; to &lt;code&gt;{{ tag.slug }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on your tag.html page change your &lt;code&gt;tag&lt;/code&gt; variable to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set tag = craft.tags.slug( craft.request.segment(2) ).first() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I have it set up and works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Forgot the route needed: Add this to your routes.php: &lt;code&gt;'tags/{slug}' =&amp;gt; 'tags/tag',&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2017-01-17T21:59:19.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18574" PostTypeId="2" ParentId="18447" CreationDate="2017-01-17T22:06:29.827" Score="2" Body="&lt;p&gt;I think what you are trying to achieve here has little to do with the actual templating itself. You can add your tags as data-attributes like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('yoursection') %}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for entry in entries %)&#xA;   &amp;lt;li data-tag={% for tags in entry.tagsFieldHandle %){{tag.title}}{% endfor %}&amp;gt;{{entry.title}}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You set the tags for each entry, so you'll be able to hide/show entries with the right tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can simply use javascript on the checkboxes to match for one of these tags in the data attributes.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-17T22:06:29.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18575" PostTypeId="2" ParentId="18537" CreationDate="2017-01-17T23:07:30.127" Score="2" Body="&lt;p&gt;You can definitely use Shortlist for this.  Here's some code to get you started.  Note in this I allow the favouriting of both products and pages/articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code to let user add the favourites -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set item = craft.shortlist.item(id) %}&#xA;    &amp;lt;span class=&quot;favStar&quot;&amp;gt;&amp;lt;a class=&quot;shortlist_action reset-a&quot; title=&quot;Add To Favourites&quot; href=&quot;{{ item.addActionUrl }}&quot;&amp;gt;&amp;lt;i class=&quot;favStar__icon icon-&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to display the favourites/wishlist - first we prepare by separating products from regular elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {# Prepare the output data #}&#xA;        {% set lists = craft.shortlist.lists %}&#xA;        {% set favouriteArticleIDs = [] %}&#xA;        {% set favouriteProductIDs = [] %}&#xA;&#xA;        {% if lists|length %}&#xA;            {# We just store everything in one list... #}&#xA;            {% for list in lists %}&#xA;                {% for item in list.items %}&#xA;                    {% set favId = item.elementId %}&#xA;                    {% if item.element.elementType == 'Commerce_Product' %}&#xA;                        {% set favouriteProductIDs = favouriteProductIDs|merge([favId]) %}                          &#xA;                    {% else %}&#xA;                        {% set favouriteArticleIDs = favouriteArticleIDs|merge([favId]) %}&#xA;                    {% endif %}                &#xA;                 {% endfor %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...then to actually fetch &amp;amp; display the results we do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% if not favouriteProductIDs|length %}&#xA;&#xA;                &amp;lt;strong&amp;gt;No favourite products?  Why not add some?&amp;lt;/strong&amp;gt;&#xA;&#xA;            {% else %}&#xA;&#xA;                {% set products = craft.commerce.products.id(favouriteProductIDs).order('title').with('variants') %}                    &#xA;&#xA;                {% import &quot;_macros/productPreviewsLib&quot; as productPreviewsLib %}&#xA;&#xA;                {{&#xA;                    productPreviewsLib.productPreviews(products,&#xA;                    {&#xA;                        'display' : 'Table',&#xA;                        'showUnavailables' : true,&#xA;                    })&#xA;                }}&#xA;&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The macro just does &lt;code&gt;{% for product in products %}&lt;/code&gt; etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should get you started!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-01-17T23:07:30.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18576" PostTypeId="2" ParentId="18564" CreationDate="2017-01-17T23:15:43.477" Score="1" Body="&lt;p&gt;One nice way to handle things like this is to collect the ids for all the entries you want, use those ids for the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; you need for the pagination, and then paginate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Collect the ids (use &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; to create an array of the ids):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = [] %}&#xA;&#xA;{% for entry in craft.entries.section('news') %}&#xA;  {# loop through regions  #}  &#xA;  {% for region in entry.regions %}&#xA;    {# loop region's countries  #}&#xA;    {% for targetCountry in region.countries %}&#xA;      {% if targetCountry == currentUser.country %} &#xA;        {% set ids = ids | merge([entry.id]) %}  &#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Get the entries for pagination:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set unpaginated = craft.entries({&#xA;  id: ids,&#xA;  limit: 10&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, the pagination:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate unpaginated as pageInfo, pageEntries %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-01-17T23:15:43.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18577" PostTypeId="2" ParentId="18560" CreationDate="2017-01-18T03:26:59.183" Score="2" Body="&lt;p&gt;It's not documented on the Commerce site (yet), but Commerce does have &lt;code&gt;commerce_addProductActions&lt;/code&gt; and &lt;code&gt;commerce_addOrderActions&lt;/code&gt; hooks that a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; could latch onto to add its own custom actions to the Order and Product index pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Virtually identical to the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#element-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;add(Element)Actions&lt;/a&gt; hooks that Craft provides for its elements.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-18T03:26:59.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18578" PostTypeId="2" ParentId="18512" CreationDate="2017-01-18T10:56:09.527" Score="0" Body="&lt;p&gt;I don't think you can - by hand is the only way I've found!&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-01-18T10:56:09.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18580" PostTypeId="1" AcceptedAnswerId="18589" CreationDate="2017-01-18T12:00:31.107" Score="1" ViewCount="112" Body="&lt;p&gt;I'm building a site for a property developer that has multiple housing developments. And on each development page there is a siteplan image that shows a CGI of the all the houses on the development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement the Donkeytail plugin &lt;a href=&quot;https://straightupcraft.com/craft-plugins/donkeytail-lite&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/donkeytail-lite&lt;/a&gt; which lets you add pinpoints on images and have made some progress and have it working. However, every development page needs it's own siteplan, and so I have to create a field for each one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how do I reference it in the template dynamically? As currently it is being called via &lt;code&gt;variable.fieldname.topLeftStyles&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this only references the exact fieldname of one siteplan. So I need a dynamic way so that it can be different on each development page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sitemap = craft.entries.section('sitePlan') %}&#xA;{% for variable in sitemap.relatedTo(category) %}&#xA;    &amp;lt;span class=&quot;placeinphoto__dot&quot; style=&quot;{{ variable.fieldname.topLeftStyles }}&quot;&amp;gt;{{ variable.title }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-01-18T17:26:15.977" LastActivityDate="2017-01-18T19:34:38.550" Title="Reference a field name relatedTo(category)" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18581" PostTypeId="2" ParentId="18512" CreationDate="2017-01-18T13:12:35.117" Score="4" Body="&lt;p&gt;I ended up using this solution:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Filter empty tags in Craft/Twig template&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.houseDescription|replace('/&amp;lt;[^\\/&amp;gt;][^&amp;gt;]*&amp;gt;&amp;lt;\\/[^&amp;gt;]+&amp;gt;/', '')|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;replace&lt;/code&gt;&lt;/a&gt; filter &lt;code&gt;/&amp;lt;[^\\/&amp;gt;][^&amp;gt;]*&amp;gt;&amp;lt;\\/[^&amp;gt;]+&amp;gt;/&lt;/code&gt; searches for empty tags and removes them.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/raw.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;raw&lt;/code&gt;&lt;/a&gt; filter stops Twig from escaping HTML tags.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://regexr.com/3f3dp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Regular expression test (RegExr)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5261" LastEditorUserId="5261" LastEditDate="2017-01-18T13:20:24.377" LastActivityDate="2017-01-18T13:20:24.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18582" PostTypeId="1" CreationDate="2017-01-18T14:40:57.213" Score="1" ViewCount="227" Body="&lt;p&gt;I'm trying to add custom actions to the order page. Following the documentation on hooks and Element Actions, I did this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my main plugin file (OrderExporterPlugin.php)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function commerce_addOrderActions($source)&#xA;{&#xA;    return array(&#xA;        new OrderExporter_ExportElementAction()&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the folder elementactions (OrderExporter_ExportElementAction.php)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class OrderExporter_ExportElementAction extends BaseElementAction {&#xA;&#xA;   public function getName()&#xA;   {&#xA;    return Craft::t('Export file');&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hook is active, but sends an error with the message &quot;Class 'Craft\OrderExporter_ExportElementAction' not found&quot; when trying to access that class&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My IDE recognizes the class, so I think the namespaces are fine&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:32:58.917" LastActivityDate="2017-05-09T20:32:58.917" Title="Adding custom actions to Craft Commerce orders page" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18584" PostTypeId="1" AcceptedAnswerId="18588" CreationDate="2017-01-18T14:51:12.497" Score="1" ViewCount="200" Body="&lt;p&gt;Now I've run into a really odd issue. I've got a hero include that is working elsewhere on the site, but on this one single it's not working at all. On a working &quot;Single&quot; the code is this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;&#xA;{% include '_includes/hero'&#xA;  with {&#xA;    imageName : 'page-hero-about',&#xA;    className : 'about',&#xA;    imageAlt  : 'Photo of store front',&#xA;    findStore : false,&#xA;    leadCols  : 'col-md-6',&#xA;    leadClass : 'lead'&#xA;  }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And on the other non-working single the code is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;    {#{% set entry = craft.entries.id(72) %} #}&#xA;&#xA;    {% include '_includes/hero'&#xA;      with {&#xA;          imageName : 'page-hero-mission',&#xA;          className : 'mission',&#xA;          imageAlt  : 'Teaching people to read',&#xA;          findStore : false,&#xA;          leadCols  : 'col-md-9',&#xA;          leadClass : ''&#xA;     }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the non working page if I don't set the entry id I get a variable &quot;entry&quot; does not exist (though this is not needed on the working single). However once I do set that I get this error &lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/code&gt; Have googled but can't seem to find anything.  Also the code is pretty much identical so am at a loss&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="1098" LastEditDate="2017-01-18T18:23:19.130" LastActivityDate="2019-04-16T07:21:01.113" Title="Template Errors with Include on Single Entry" Tags="&lt;templating&gt;&lt;error-message&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18585" PostTypeId="2" ParentId="16798" CreationDate="2017-01-18T16:20:51.983" Score="8" Body="&lt;p&gt;I know the problem here is solved, but I thought I'd just leave a link to a pretty decent intro to using Craft and Vue 2.0 for future reference...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-2-0-with-craft-cms&quot;&gt;Using Vue 2.0 with Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And specifically the part addressing the problem above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-2-0-with-craft-cms#its-all-about-the-mustaches&quot;&gt;It’s all about the mustaches&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: I'm not the author of the blog post, just found it useful.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-01-18T16:20:51.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18586" PostTypeId="1" AcceptedAnswerId="18587" CreationDate="2017-01-18T17:35:28.457" Score="3" ViewCount="664" Body="&lt;p&gt;For a project I have, I am unable to use the standard Craft routing for a channel. For example,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/events/{slug}  &amp;lt;- this is how Craft wants to do it&#xA;/{slug}         &amp;lt;- this is how the client wants it done&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried to do this using routes, and can easily route to the correct template, however the &lt;code&gt;entry&lt;/code&gt; is not defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any easy way to not have to use Craft's routing that requires the &lt;code&gt;events&lt;/code&gt; portion of the url? And have the &lt;code&gt;entry&lt;/code&gt; variable available in the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added to this is the fact I need to do URLs like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/{slug}/blog/{article-slug}&#xA;/{slug}/faqs/{question-slug}&#xA;etc etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The homepage is a static template, but as there is no content to exist under &lt;code&gt;/events&lt;/code&gt;, and being that &lt;code&gt;events&lt;/code&gt; is the root of all other content (which is filtered by the event slug) I can't see a way so far to not have to use the full path the 'Craft' way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus Question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to prevent &lt;code&gt;/events/{slug}&lt;/code&gt; from responding to requests also? Is it just using the &lt;code&gt;exit 404&lt;/code&gt; tag in templating?&lt;/p&gt;&#xA;" OwnerUserId="5942" LastEditorUserId="57" LastEditDate="2017-01-18T21:13:41.763" LastActivityDate="2017-01-18T21:54:56.340" Title="How to do advanced routing to a Craft channel" Tags="&lt;templating&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18587" PostTypeId="2" ParentId="18586" CreationDate="2017-01-18T18:11:39.600" Score="5" Body="&lt;p&gt;I'm not sure I understand your question, but to try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There actually isn't a &quot;standard Craft routing&quot;, for channel Sections or anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your channel's Section settings (available via &lt;em&gt;Settings -&gt; Sections -&gt; [your event section]&lt;/em&gt;), there's a field called &lt;strong&gt;Entry URL format&lt;/strong&gt;. Simply add &lt;code&gt;{slug}&lt;/code&gt; to that field (and nothing else), and you should be good to go. You can even use the same URL format for different sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to your &quot;bonus question&quot;, if you set the Entry URL format to simply &lt;code&gt;{slug}&lt;/code&gt; for the events section, Craft will probably throw 404 for any &lt;code&gt;/events/{slug}&lt;/code&gt; URLs, out of the box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic routes&lt;/a&gt;, you're correct that Craft won't populate your template with the &lt;code&gt;entry&lt;/code&gt; variable – it will however, populate the template with variables matching the &lt;em&gt;tokens&lt;/em&gt; that you add to your route. So, if you e.g. create a dynamic route that uses the &lt;code&gt;&amp;lt;slug&amp;gt;&lt;/code&gt; token, you can pull the entry in the template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# At the top of your template: #}&#xA;&#xA;{% set entry = craft.entries.section('events').slug(slug).first() %}&#xA;{% if not entry %}&#xA;   {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{# ...the rest of your template #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Beyond the above – if you're still unsure how to set things up properly, I'd suggest taking a look at &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;the official docs on routing&lt;/a&gt;, which explains in detail how Craft evaluates requests and what your different routing options are. Particularly important if you figure that you &lt;em&gt;do&lt;/em&gt; need to do some custom routing beyond what the URL format setting can do.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-01-18T21:54:56.340" LastActivityDate="2017-01-18T21:54:56.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18588" PostTypeId="2" ParentId="18584" CreationDate="2017-01-18T18:21:45.113" Score="2" Body="&lt;p&gt;In your current code, the &lt;code&gt;entry&lt;/code&gt; variable is actually an instance of &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which is probably the reason you're getting errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to set &lt;code&gt;entry&lt;/code&gt; to an actual &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt;, you'll need to add a call to &lt;code&gt;first()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(72).first() %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-01-18T18:21:45.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18589" PostTypeId="2" ParentId="18580" CreationDate="2017-01-18T19:34:38.550" Score="2" Body="&lt;p&gt;Not sure I totally get your problem, but you can use bracket style notation to use variables for field handles, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ variable[someVariableHandle].topLeftStyles }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ variable[someVariableHandle][someVariableProperty] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for actually outputting the fields in a sane manner, you'll need to map the variable field handles to your entries in some way – one way to do it is to simply use a naming convention for the field handles where you use some unique property on the entries (e.g. the entry ID) as part of the handle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% set fieldHandle = 'fieldname-'~entry.id' %}&#xA;{% if variable[fieldHandle] is defined %}&#xA;    {{ variable[fieldHandle].topLeftStyles }}&#xA;{% endif %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another way is to manually set up a map in your template – here's an example using entry IDs for keys, and the field handles for values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldHandles = {&#xA;    35: 'someFieldHandle',&#xA;    464: 'anotherFieldHandle'&#xA;} %}&#xA;...&#xA;{% for variable in sitemap.relatedTo(category) %}&#xA;    {% set fieldHandle = fieldHandles[variable.id] ?? null %}&#xA;    {% if fieldHandle and variable[fieldHandle] is defined %}&#xA;        &amp;lt;span class=&quot;placeinphoto__dot&quot; style=&quot;{{ variable[fieldHandle].topLeftStyles }}&quot;&amp;gt;{{ variable.title }}&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-01-18T19:34:38.550" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="18590" PostTypeId="2" ParentId="18548" CreationDate="2017-01-18T20:00:11.410" Score="2" Body="&lt;p&gt;I found the problem, which is pretty ridiculous but something that probably happens to other developers who are using multiple languages.. (I hope).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;query: 'klantLocation:' ~ searchL,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had to replace &lt;code&gt;klantLocation&lt;/code&gt; with &lt;code&gt;klantLocatie&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty dumb mistake but hopefully someone else will find some help in my mistake&lt;/p&gt;&#xA;" OwnerUserId="5363" LastActivityDate="2017-01-18T20:00:11.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18591" PostTypeId="2" ParentId="18529" CreationDate="2017-01-18T20:04:44.330" Score="2" Body="&lt;p&gt;Sorry for answering my own question.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon a suggestion from P&amp;amp;T, we found that our Nginx configuration was removing the cookies when it cached the page. When we left the cookies in, we were able to log in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We still don't know what changed to make the site suddenly not work, but at least the control panel is usable.&lt;/p&gt;&#xA;" OwnerUserId="6137" LastActivityDate="2017-01-18T20:04:44.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18592" PostTypeId="2" ParentId="18559" CreationDate="2017-01-18T21:17:50.593" Score="1" Body="&lt;p&gt;More a workaround than a solution but I added &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'imageDriver' =&gt; 'gd'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt; to the config so it didn't use Imagick anymore. Works as supposed to now.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-01-18T21:17:50.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18593" PostTypeId="1" AcceptedAnswerId="18602" CreationDate="2017-01-19T10:56:24.933" Score="2" ViewCount="224" Body="&lt;p&gt;So I noticed that by setting the &lt;code&gt;'cacheDuration' =&amp;gt; false&lt;/code&gt; it seems to set, by default, the expiration date to 1 year from when the cache is saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this in &lt;code&gt;/app/services/TemplateCacheService.php&lt;/code&gt; starting from line 263:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($duration &amp;lt;= 0) &#xA;{&#xA;  $duration = 31536000; // 1 year&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know a longer duration could be achieved by setting the expiration to something like &lt;code&gt;4Y&lt;/code&gt;. But I wanted to raise this and ask if it was an oversight or what the reason was for setting it to a year and overriding the specific value of not setting an expiration at all...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="4466" LastEditDate="2017-01-19T11:15:08.203" LastActivityDate="2017-01-20T02:33:59.397" Title="'cacheDuration' =&gt; false, sets cache file expiration date to 1 year" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18594" PostTypeId="1" AcceptedAnswerId="18595" CreationDate="2017-01-19T12:35:51.913" Score="0" ViewCount="790" Body="&lt;p&gt;Popup Closed Screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Wqch8.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wqch8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Popup Open Screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yAOjJ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yAOjJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have image that has multiple markers on it that can be clicked to bring up different popups. However, I need to some help refining the code to work properly and to link to the correct id tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = craft.entries.section('availablehomes').relatedTo(category).level(2) %}&#xA;{% for entry in var %}&#xA;&amp;lt;!-- Popup Modal --&amp;gt;&#xA;{% set plotPopup = 'plotPopup' ~ entry.title|camel %}&#xA;&amp;lt;div class=&quot;property popup&quot; id=&quot;{{ plotPopup }}&quot;&amp;gt;&#xA;....markup.......&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which outputs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;property popup&quot; id=&quot;plotPopupplot1&quot;&amp;gt;...&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;property popup&quot; id=&quot;plotPopupplot2&quot;&amp;gt;...&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;property popup&quot; id=&quot;plotPopupplot3&quot;&amp;gt;...&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;property popup&quot; id=&quot;plotPopupplot4&quot;&amp;gt;...&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And below is the current script text:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;// When the user clicks on plot number, open the popup&#xA;function openPopup() {&#xA;{% set plottitle = craft.entries.section('availablehomes').relatedTo(category).level(2) %}&#xA;{% for entry in plottitle %}&#xA;    var popup = document.getElementById('plotPopup{{ entry.title|json_encode()|camel }}');&#xA;{% endfor %}&#xA;    popup.classList.toggle('show');&#xA;}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is printing out as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;// When the user clicks on &amp;lt;div&amp;gt;, open the popup&#xA;function openPopup() {&#xA;    var popup = document.getElementById('plotPopupplot1');&#xA;    var popup = document.getElementById('plotPopupplot2');&#xA;    var popup = document.getElementById('plotPopupplot3');&#xA;    var popup = document.getElementById('plotPopupplot4');&#xA;    popup.classList.toggle('show');&#xA;}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-01-19T15:19:52.573" Title="Link Popup Modal to correct script in loop" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18595" PostTypeId="2" ParentId="18594" CreationDate="2017-01-19T15:19:52.573" Score="2" Body="&lt;p&gt;This is just a JavaScript problem. You have to add an event listener to the marker which opens the corresponding popup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put together a little example on JSBin here: &lt;a href=&quot;https://jsbin.com/tigefikalu/edit?html,js,console,output&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://jsbin.com/tigefikalu/edit?html,js,console,output&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps with the logic.&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-01-19T15:19:52.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18597" PostTypeId="2" ParentId="18534" CreationDate="2017-01-19T15:30:53.410" Score="2" Body="&lt;p&gt;What field type is blog_featured_image? Just an image asset?&#xA;Does it work with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; alt=&quot;{{asset.title}}&quot; /&amp;gt;&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-01-19T15:30:53.410" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18598" PostTypeId="2" ParentId="18534" CreationDate="2017-01-19T18:02:59.137" Score="1" Body="&lt;p&gt;You need the &lt;code&gt;.getUrl();&lt;/code&gt; I also suggest that you have a look at the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager plugin&lt;/a&gt; for a more flexible use of images in your site.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-19T18:02:59.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18599" PostTypeId="2" ParentId="18196" CreationDate="2017-01-19T18:13:48.207" Score="3" Body="&lt;p&gt;You can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.bg{&#xA;    background-image: {{ entry.siteBg.first().getUrl('bodyBg')|default(siteBgFallback.siteBg.first().getUrl('bodyBg)}}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the same for the other one. What you are doing is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set an item that can be empty (hence the |default). &lt;/li&gt;&#xA;&lt;li&gt;If the item is empty go to the fallback (the part between the default brackets).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For more info on the default filter check &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/default.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-19T18:13:48.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18600" PostTypeId="1" AcceptedAnswerId="18601" CreationDate="2017-01-19T22:21:04.587" Score="1" ViewCount="286" Body="&lt;p&gt;This question is related to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17707/display-childrens-order-numbers&quot;&gt;thread&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sibling in entry.getSiblings() %}  &#xA;{{ sibling.title }} {{ sibling.orderNumber }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought you could pick this out of the ElementCriteriaModel, but that doesn't seem to be possible/available. Twig's for loop won't work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result I am looking for is to echo the order number of the siblings in a &lt;strong&gt;structure&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parent&#xA;Child order number 1&#xA;Child order number 2&#xA;Child order number 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-01-19T23:44:40.647" Title="How do I output the siblings position number?" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18601" PostTypeId="2" ParentId="18600" CreationDate="2017-01-19T23:44:40.647" Score="1" Body="&lt;p&gt;Building upon the answer I posted to this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13214/how-to-get-the-order-number-of-the-current-entry-in-a-structure&quot;&gt;How to get the order number of the current entry in a structure&lt;/a&gt;, you should be able to get the order number in your for-loop like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = entry.getParent() %}&#xA;{% set childrenIds = parent.getChildren().ids() %}&#xA;&#xA;{% for sibling in entry.getSiblings() %}&#xA;    {% set orderNumber = craft.entries({&#xA;        id: siblingsIds,&#xA;        order: 'lft desc',&#xA;        positionedBefore: sibling,&#xA;    }).total() + 1 %}&#xA;&#xA;    {{ sibling.title }} ({{ orderNumber }})&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-01-19T23:44:40.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18602" PostTypeId="2" ParentId="18593" CreationDate="2017-01-20T02:33:59.397" Score="3" Body="&lt;p&gt;Yeah, it's slightly awkward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off it should be &lt;code&gt;'0'&lt;/code&gt;, instead of &lt;code&gt;false&lt;/code&gt; if you want it to cache indefinitely (documentation bug, just fixed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's slightly awkward because the &lt;code&gt;cacheDuration&lt;/code&gt; config setting is used for multiple things, but when the &lt;code&gt;TemplateCacheService&lt;/code&gt; uses it, it requires an expiration date (not optional).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if it sees &lt;code&gt;0&lt;/code&gt;, it will just pick one reasonably far out (a year), but you can set it to something higher if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should probably happen is everywhere that uses the &lt;code&gt;cacheDuration&lt;/code&gt; config setting should have its own, separate config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not going to happen for Craft 2, but make a note to look at it once Craft 3 launches.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-20T02:33:59.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18603" PostTypeId="1" AcceptedAnswerId="19124" CreationDate="2017-01-20T13:26:19.723" Score="2" ViewCount="172" Body="&lt;p&gt;I'm currently building a site using Craft and Craft Commerce. And when working between the two, I'm looking to make a page that shows all the products from a product-type, and have the header image change to reflect whichever product-type it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is currently possible to make a category, assign an image to the category, and then add a category entry field to a product, allowing to organize products that way, but it seems terribly redundant, having to both put a product in a product-type, and then to also assign a category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to simply assign an image to the product type?&lt;/p&gt;&#xA;" OwnerUserId="6165" LastActivityDate="2017-02-22T02:47:53.943" Title="Can I assign an image for a product type listing page?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18605" PostTypeId="1" CreationDate="2017-01-20T14:36:43.977" Score="2" ViewCount="143" Body="&lt;p&gt;Is there a mechanism for grouping related fields in an entry besides:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;a) putting them in a tab - which I generally reserve to group fields at a higher order (e.g content/data/meta)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;b) putting related fields inside a matrix block with a limit of 1, which feels like I'm adding a level of complexity to my content model.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have various modules in a page, so i've taken to labelling them with a common prefix for each module (as in 'Homepage Hero - Background Image', 'Homepage Hero - Subheading'), but all of the fields visually gel together in the UI in a somewhat indistinguishable list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose changing my use of tabs would serve my purpose, but could look quite unruly on an entry with many elements.&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2017-01-20T15:44:37.797" Title="Grouping related fields together" Tags="&lt;entry&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18606" PostTypeId="1" AcceptedAnswerId="18616" CreationDate="2017-01-20T14:41:35.697" Score="1" ViewCount="33" Body="&lt;p&gt;I have this code to save a new user onto a userfield on another user:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;    $employees   = $currentUser-&amp;gt;employees-&amp;gt;ids();&#xA;    $employees[] = $employee-&amp;gt;id;&#xA;    $currentUser-&amp;gt;getContent()-&amp;gt;setAttributes(['employees' =&amp;gt; $employees]);&#xA;    if (!craft()-&amp;gt;users-&amp;gt;saveUser($currentUser))&#xA;    {&#xA;        Craft::dd($currentUser-&amp;gt;getErrors());&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works fine, however if there's a pending user in the employees field it's not returned in the ids() array. How do I get &lt;em&gt;all&lt;/em&gt; user ids from the employees field, not just active users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; got it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $employees   = $currentUser-&amp;gt;employees-&amp;gt;status('*')-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="365" LastEditorUserId="365" LastEditDate="2017-01-20T15:12:46.210" LastActivityDate="2017-01-21T11:59:57.633" Title="Add a user to a userfield when there's a pending user on there" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18607" PostTypeId="1" AcceptedAnswerId="18614" CreationDate="2017-01-20T14:49:52.783" Score="0" ViewCount="45" Body="&lt;p&gt;A client has a Campaign Monitor email list that he wants his new site to integrate with. We want to have a form that adds new subscribers to the list, and we also need to trigger a mailout to the list when a new blog post is published (not saved, but published on the site). He also wants the text of the blog post in the email that's sent out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are struggling to think of a solution that would work and can't find a plugin that would do the job. Sprout Email almost does it, but the Notifications part of that plugin doesn't hook into Campaign Monitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any ideas for solving this?&lt;/p&gt;&#xA;" OwnerUserId="5639" LastActivityDate="2017-01-20T20:20:58.870" Title="Triggering mailshot when new entry published - solutions?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18608" PostTypeId="1" AcceptedAnswerId="22195" CreationDate="2017-01-20T15:11:29.720" Score="2" ViewCount="377" Body="&lt;p&gt;I'm using eager loading for retrieving some images for my gallery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set employments = craft.entries({ section: 'employments', with: ['photo] }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine and I can see all images on my page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using focuspoint (&lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/smcyr/Craft-FocusPoint&lt;/a&gt;) with imager for resizing the images. I've set a different focuspoint for every image.&#xA;But whenever I try to get the focuspoints of a image:&#xA;&lt;code&gt;photo[0].focusPctX&lt;/code&gt;, all images have the same focuspoints (50).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I try to retrieve the images without the eager loading function, it works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a new issue @focuspoint github.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there someone that had the same problem, or has a solution for this?&lt;/p&gt;&#xA;" OwnerUserId="5271" LastEditorUserId="57" LastEditDate="2017-07-10T23:43:35.613" LastActivityDate="2017-10-01T03:40:20.867" Title="Using Focuspoint with eager loading" Tags="&lt;image-transforms&gt;&lt;image&gt;&lt;eager-loading&gt;&lt;plugin-imager&gt;&lt;plugin-focuspoint&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18609" PostTypeId="2" ParentId="18605" CreationDate="2017-01-20T15:44:37.797" Score="1" Body="&lt;p&gt;You could put them in a supertable which supports nested matrix etc.&#xA;All the info on supertable here: &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-20T15:44:37.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18610" PostTypeId="1" AcceptedAnswerId="18612" CreationDate="2017-01-20T15:50:32.760" Score="2" ViewCount="782" Body="&lt;p&gt;How can I add an anchor element in my content. Both the id tag and name attribute are removed from the a tag by the WYSIWYG editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a name=&quot;my-anchor&quot;&amp;gt;My anchor with a name attribute&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;&amp;lt;a id=&quot;my-anchor&quot;&amp;gt;My anchor with an id attribute&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is replaced by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a&amp;gt;My anchor with a name attribute&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;&amp;lt;a&amp;gt;My anchor with an id attribute&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1005" LastActivityDate="2017-01-20T16:47:03.540" Title="Add Anchor in WYSIWYG editor" Tags="&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18612" PostTypeId="2" ParentId="18610" CreationDate="2017-01-20T16:47:03.540" Score="2" Body="&lt;p&gt;There is a purify and a Clean-up option on a WYSIWYG field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Clean up HTML?&lt;/strong&gt; – Whether Craft should run through some HTML cleanup routines when the field is saved, including removing all  tags, empty tags, and most style attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Purify HTML?&lt;/strong&gt; – Whether the field should run submitted data through HTML Purifier before getting saved to the database, removing any potentially malicious code. Note that this is meant to be be used when accepting input in a Rich Text field from un-trusted sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning the purify off, let's you output HTML. That being said, I'm not sure of what you are trying to achieve but inserting raw HTML into a WYSYWIG field isn't really the way to go about things. Maybe if you share the bigger scope of the issue, we can look into a better approach of your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;source: &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/rich-text-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-20T16:47:03.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18613" PostTypeId="1" CreationDate="2017-01-20T16:47:33.983" Score="0" ViewCount="467" Body="&lt;p&gt;I experiencing some kind of missconfiguration with images - there is no way to get /print URL in output html (on backend is fine): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sfFy8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sfFy8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We´ve tried many ways, but no way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imagenDestacadaNoticia %}&#xA;&#xA;    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot;  alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where could be the problem to look into?&lt;/p&gt;&#xA;" OwnerUserId="6168" LastEditorUserId="45" LastEditDate="2017-01-21T16:43:51.570" LastActivityDate="2017-01-21T16:43:51.570" Title="Image URL problem" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ClosedDate="2017-01-21T16:44:59.423" ContentLicense="CC BY-SA 3.0" />
  <row Id="18614" PostTypeId="2" ParentId="18607" CreationDate="2017-01-20T20:20:58.870" Score="0" Body="&lt;p&gt;If you can't find an existing plugin that has the functionality, you'll have the roll a custom one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But knowing when an entry goes from pending to live is a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17250/fire-event-first-time-future-dated-entry-goes-live-from-pending&quot;&gt;problem in and of itself&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you got that sorted, the plugin would have to integrate with &lt;a href=&quot;https://www.campaignmonitor.com/api/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Campaign Monitor API&lt;/a&gt; and send your email out to your list when the event happens.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-20T20:20:58.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18615" PostTypeId="1" AcceptedAnswerId="21565" CreationDate="2017-01-20T20:21:10.320" Score="2" ViewCount="291" Body="&lt;p&gt;I've stumbled upon a weird thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run browsersync as &lt;code&gt;browser-sync start -p localhost:8000&lt;/code&gt; and try to log into Craft's admin at &lt;code&gt;localhost:3000/admin&lt;/code&gt; I get the message &quot;An unknown error occurred.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I enter the wrong password, nothing at all appears nor happens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be worked around by logging in once at &lt;code&gt;localhost:8000/admin&lt;/code&gt;, and then accessing the proxied version after... But I'd be sweet if I could login through the proxied version :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how this can be resolved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the log generated once I've deleted all the contents of the logs and then press the login button: &lt;a href=&quot;http://pastebin.com/3LjbQLj0&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/3LjbQLj0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3717" LastEditorUserId="57" LastEditDate="2017-08-09T21:00:15.680" LastActivityDate="2017-08-14T11:37:06.717" Title="&quot;An unknown error occurred.&quot; appears when I try to log into Craft's admin using browsersync's proxy mode" Tags="&lt;admin&gt;&lt;login&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18616" PostTypeId="2" ParentId="18606" CreationDate="2017-01-21T11:59:57.633" Score="1" Body="&lt;p&gt;To mark this as answered, my solution was to use this code to get the current employee IDs regardless of status.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$employees   = $currentUser-&amp;gt;employees-&amp;gt;status('*')-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="365" LastActivityDate="2017-01-21T11:59:57.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18617" PostTypeId="2" ParentId="18613" CreationDate="2017-01-21T12:18:14.963" Score="1" Body="&lt;p&gt;Finally found the problem: misscounfiguration of assets (activate public URL). Close the question. &lt;/p&gt;&#xA;" OwnerUserId="6168" LastActivityDate="2017-01-21T12:18:14.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18618" PostTypeId="1" CreationDate="2017-01-21T13:05:09.183" Score="4" ViewCount="10252" Body="&lt;p&gt;I've seen how you can remove html tags with twig in other posts here so I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;slider--text&quot;&amp;gt;{{ product.intro|striptags('&amp;lt;p&amp;gt;')|raw }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To remove the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag that redactor adds automatically. However for some reason it is not removing it. Anyone have any ideas. Have I missed something glaringly obvious?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-01-21T15:28:28.473" Title="striptags not removing &lt;p&gt; tag?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18619" PostTypeId="1" CreationDate="2017-01-21T13:06:55.780" Score="1" ViewCount="686" Body="&lt;p&gt;How do I pass variables to a loop within an include?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my partial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for photo in photos %}&#xA;    &amp;lt;img src=&quot;{{ photo.projectPhotos_photo_image.first().getUrl('projectThumbnail') }}&quot;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm calling it from a template with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set projectEntries = craft.entries({&#xA;    section: 'project'&#xA;}) %}&#xA;{% set vars = {&#xA;    photos: projectEntries&#xA;    } &#xA;%}&#xA;{% include &quot;_partials/photo-tile.html&quot; with vars %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All well and good &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;but&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I want to abstract this from my partial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;src=&quot;{{ photo.projectPhotos_photo_image.first().getUrl('projectThumbnail') }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words, I'd like to pass the src, &lt;code&gt;{{ photo.projectPhotos_photo_image.first().getUrl('projectThumbnail') }}&lt;/code&gt; , into the partial but I don't know how!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to do it from the template like this (through &lt;code&gt;photoSrc&lt;/code&gt;), it fails, saying the 'photo' is undefined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = {&#xA;    section: &quot;category&quot;,&#xA;    category: category,&#xA;    pageOneTitle:  categoryTitle,&#xA;    photos: projectEntries,&#xA;    photoSrc: photo.projectPhotos_photo_image.first().getUrl('projectThumbnail')&#xA;    } &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any tips?&lt;/p&gt;&#xA;" OwnerUserId="6170" LastActivityDate="2017-01-21T14:28:13.410" Title="How do I pass variables to loops within includes?" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18620" PostTypeId="2" ParentId="18618" CreationDate="2017-01-21T14:04:07.080" Score="11" Body="&lt;p&gt;Actually, the &lt;code&gt;striptags&lt;/code&gt; filter (which is just a wrapper for the PHP &lt;a href=&quot;http://php.net/manual/en/function.strip-tags.php&quot; rel=&quot;noreferrer&quot;&gt;strip_tags&lt;/a&gt; function) removes all HTML tags &lt;em&gt;except the ones you pass in&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if you want to remove &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags, just use the &lt;code&gt;striptags&lt;/code&gt; filter without any parameters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Will remove all HTML tags #}&#xA;&amp;lt;p class=&quot;slider--text&quot;&amp;gt;{{ product.intro|striptags|raw }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there are other tags you want to retain, you'll need to pass those in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Will remove all tags except &amp;lt;br&amp;gt; and &amp;lt;img&amp;gt; #}&#xA;&amp;lt;p class=&quot;slider--text&quot;&amp;gt;{{ product.intro|striptags('&amp;lt;br&amp;gt;&amp;lt;img&amp;gt;')|raw }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a different take on stripping tags, you can use &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;noreferrer&quot;&gt;the Retcon plugin&lt;/a&gt; (which I wrote). With Retcon, you can remove all &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags (and only &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags; retaining their contents as well as all other tags) easily by using the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Change&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;retconChange&lt;/code&gt;&lt;/a&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;slider--text&quot;&amp;gt;{{ product.intro|retconChange('&amp;lt;p&amp;gt;', false) }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-01-21T15:28:28.473" LastActivityDate="2017-01-21T15:28:28.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18621" PostTypeId="2" ParentId="18619" CreationDate="2017-01-21T14:28:13.410" Score="1" Body="&lt;p&gt;You can't reference a variable (&lt;code&gt;photo&lt;/code&gt;) created inside the partial loop outside the partial (and loop) – it doesn't exist yet – so what you're trying to achieve isn't possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do, is to abstract the important bits, namely the field and transform handles:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vars = {&#xA;    photos: projectEntries,&#xA;    photoField: 'projectPhotos_photo_image',&#xA;    photoTransform: 'projectThumbnail'&#xA;} %}&#xA;{% include &quot;_partials/photo-tile.html&quot; with vars %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And inside your partial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for photo in photos %}&#xA;   &amp;lt;img src=&quot;{{ photo[photoField].first().getUrl(photoTransform) }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that doesn't cut it, you'll probably want to use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macro&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Your macro file, e.g. /templates/_macros/photoTile.html #}&#xA;{% macro src(photo) %}&#xA;    {{ photo.projectPhotos_photo_image.first().getUrl('projectThumbnail') }}&#xA;{% endmacro %}&#xA;&#xA;{# Inside your partial #}&#xA;{% from '_macros/photoTile' import src %}&#xA;{% for photo in photos %}&#xA;    &amp;lt;img src=&quot;{{- src(photo) -}}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(If you're wondering about the &lt;code&gt;{{- -}}&lt;/code&gt; syntax in the above example, the dashes are just to remove whitespace from the rendered src string – you also wrap the code inside the macro in &lt;code&gt;{% spaceless %}{% endspaceless %}&lt;/code&gt; tags.)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-01-21T14:28:13.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18623" PostTypeId="1" AcceptedAnswerId="18625" CreationDate="2017-01-21T15:01:44.620" Score="1" ViewCount="109" Body="&lt;p&gt;Just a quicky regarding pagination. &#xA;I have a paginated results list with a limit of 20 results in a page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how I owuld go about making a pagination that shows the number of results on the next page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &#xA;If I have 105 results, the pagination link says 'next 20 results', up to the fifth page, which would then say 'next 5 results'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if there is an easier way to do it other than a load of maths to work it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2017-01-21T15:16:19.123" LastActivityDate="2017-01-24T03:29:14.750" Title="Pagination, display 'Next 20 Results' etc" Tags="&lt;entries&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18624" PostTypeId="1" AcceptedAnswerId="18636" CreationDate="2017-01-21T15:13:48.640" Score="1" ViewCount="106" Body="&lt;p&gt;I'm using Michael Rog's &lt;a href=&quot;https://calendars.docs.topshelfcraft.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Craft Calendars&lt;/em&gt;&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if it's possible to limit events to specified owner category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a training entry with &lt;em&gt;trainingType&lt;/em&gt; and &lt;em&gt;trainingLevel&lt;/em&gt; category type fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While listing events is it possible to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    calendar: 'myAwesomeCalendar',&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: now|date_modify(&quot;+1 month&quot;),&#xA;    owner.trainingType = 'webinar',&#xA;    owner.trainingLevel = 'expert' &#xA;} %}&#xA;&#xA;{% for e in craft.calendars.events(params) %}&#xA;    &amp;lt;h1&amp;gt;{{ e.owner.title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;Starts: {{ e.startDate  | date(&quot;Y-m-d&quot;) }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ e.owner.trainingType }} , {{ e.owner.trainingLevel }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If not, how else would you approach this.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="689" LastEditDate="2017-01-23T15:41:48.117" LastActivityDate="2017-01-23T15:41:48.117" Title="Filter events by owner fields - Calendar plugin" Tags="&lt;calendar&gt;&lt;plugin-calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18625" PostTypeId="2" ParentId="18623" CreationDate="2017-01-21T18:58:10.247" Score="1" Body="&lt;p&gt;Not sure about a load of math, but if you've got &lt;code&gt;pageInfo&lt;/code&gt; setup like in the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;, should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalPages = pageInfo.totalPages %}&#xA;{% set itemsPerPage = 20 %}&#xA;{% set currentPage = pageInfo.currentPage %}&#xA;{% set totalItems = pageInfo.total %}&#xA;&#xA;{% set wholeItems = (totalPages - 1) * itemsPerPage %}&#xA;{% set remainderItems = totalItems - wholeItems %}&#xA;&#xA;{% if currentPage == totalPages - 1 %}&#xA;    Next {{ remainderItems }} items.&#xA;{% else %}&#xA;    Next {{ itemsPerPage }} items.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="490" LastEditDate="2017-01-24T03:29:14.750" LastActivityDate="2017-01-24T03:29:14.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18626" PostTypeId="2" ParentId="18546" CreationDate="2017-01-21T22:14:50.790" Score="5" Body="&lt;p&gt;I think I have a solution to this problem, but it's kind of complicated. There may be a way to simplify this more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to loop thru your Store Hours field (&lt;code&gt;entry.hoursOfOperation&lt;/code&gt;) and build a new array (&lt;code&gt;storeHours&lt;/code&gt;) where the days are combined if the current loop's open and close times match the previous loop's.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] %}&#xA;{% set daysShort = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] %}&#xA;&#xA;{# Setup a new array storeHours to hold all you hashes &#xA;   and prev variables to compare things to in the loop &#xA; #}&#xA;{% set storeHours, prevDays, prevDaysShort, prevOpen, prevClose = [],[],[],&quot;&quot;,&quot;&quot; %}&#xA;&#xA;{# Loop thru your Store Hours field and build the storeHours array #}&#xA;{% for item in entry.hoursOfOperation %}&#xA;&#xA;  {# in the first loop, setup the prevOpen and prevClose variables  #}&#xA;  {% if loop.first %}&#xA;    {% set prevOpen, prevClose = item.open, item.close %}&#xA;  {% endif %}&#xA;&#xA;  {# If the prev hours match the current item's hours, &#xA;     add that day's name to the array of prev days, [&quot;Monday&quot;,&quot;Tuesday&quot;] etc.&#xA;   #}&#xA;  {% if prevOpen == item.open and prevClose == item.close %}&#xA;    {% set prevDays = prevDays|merge([days[loop.index0]]) %}&#xA;    {% set prevDaysShort = prevDaysShort|merge([daysShort[loop.index0]]) %}&#xA;&#xA;  {# If it doesn’t match, add prev variables as a hash to the storeHours array,&#xA;     Then set all prev variables with current item&#xA;   #}&#xA;  {% else %}&#xA;&#xA;    {% set storeHours = storeHours|merge([{&#xA;      &quot;days&quot; : prevDays,&#xA;      &quot;daysShort&quot; : prevDaysShort,&#xA;      &quot;open&quot; : prevOpen,&#xA;      &quot;close&quot; : prevClose&#xA;    }]) %}&#xA;&#xA;    {% set prevDays = [days[loop.index0]] %}&#xA;    {% set prevDaysShort = [daysShort[loop.index0]] %}&#xA;    {% set prevOpen = item.open %}&#xA;    {% set prevClose = item.close %}&#xA;&#xA;  {% endif %}&#xA;&#xA;  {# If last loop, add prev variables as a hash to the storeHours array&#xA;     because there won’t be another loop to compare it to.&#xA;   #}&#xA;  {% if loop.last %}&#xA;    {% set storeHours = storeHours|merge([{&#xA;      &quot;days&quot; : prevDays,&#xA;      &quot;daysShort&quot; : prevDaysShort,&#xA;      &quot;open&quot; : prevOpen,&#xA;      &quot;close&quot; : prevClose&#xA;    }]) %}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;storeHours&lt;/code&gt; data format will be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;days&quot; : [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;],&#xA;    &quot;daysShort&quot; : [&quot;Mo&quot;,&quot;Tu&quot;,&quot;We&quot;],&#xA;    &quot;open&quot; : &quot;2017-01-21 09:30:00.000000&quot;,&#xA;    &quot;close&quot; : &quot;2017-01-21 21:00:00.000000&quot;&#xA;  },&#xA;  {&#xA;    &quot;days&quot; : [&quot;Thursday&quot;,&quot;Friday&quot;],&#xA;    &quot;daysShort&quot; : [&quot;Th&quot;,&quot;Fr&quot;],&#xA;    &quot;open&quot; : &quot;2017-01-21 09:00:00.000000&quot;,&#xA;    &quot;close&quot; : &quot;2017-01-21 17:00:00.000000&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you've created your &lt;code&gt;storeHours&lt;/code&gt; array, you can use it to output your HTML code.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;dl class=&quot;store-details-hours__list&quot;&amp;gt;&#xA;  {% for item in storeHours %}&#xA;&#xA;    &amp;lt;dt class=&quot;store-details-hours__day&quot;&amp;gt;&#xA;      {{ item.days|first }}{% if item.days|length &amp;gt; 1 %} - {{ item.days|last }}{% endif %}&#xA;    &amp;lt;/dt&amp;gt;    &#xA;&#xA;    {% if item.open|length and item.close|length %}&#xA;      &amp;lt;dd class=&quot;store-details-hours__hours&quot; itemprop=&quot;openingHours&quot; &#xA;        content=&quot;{{ item.daysShort|join(',') }} {{ item.open|date('h:i') }} - {{ item.close|date('h:i') }}&quot;&amp;gt;&#xA;        {{ item.open|date('h:i a') }} - {{ item.close|date('h:i a') }}&#xA;      &amp;lt;/dd&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;dd class=&quot;store-details-hours__hours&quot; itemprop=&quot;openingHours&quot; &#xA;        content=&quot;{{ item.daysShort|join(',') }} Closed&quot;&amp;gt;&#xA;        Closed&#xA;      &amp;lt;/dd&amp;gt;&#xA;    {% endif %}&#xA;&#xA;  {% endfor %}&#xA;&amp;lt;/dl&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BONUS ROUND:&lt;/strong&gt; if you want to make &lt;strong&gt;Monday the first day of the week&lt;/strong&gt;, reorder the &lt;code&gt;days&lt;/code&gt; and &lt;code&gt;daysShort&lt;/code&gt; arrays at the top like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] %}&#xA;{% set daysShort = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then add this line just below it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set hoursMondayFirst = entry.hoursOfOperation|slice(1,entry.hoursOfOperation|length)|merge(entry.hoursOfOperation|slice(0,1)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That makes a new variable using &lt;a href=&quot;http://twig.sensiolabs.org/doc/1.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig's slice filter&lt;/a&gt; to take Monday - Saturday (&lt;code&gt;slice(1|length)&lt;/code&gt;) and merge Sunday at the end (&lt;code&gt;slice(0,1)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now just use this as the start of your loop:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for item in hoursMondayFirst %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="3951" LastEditDate="2017-11-20T20:42:26.287" LastActivityDate="2017-11-20T20:42:26.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18627" PostTypeId="1" AcceptedAnswerId="18628" CreationDate="2017-01-22T11:00:03.497" Score="2" ViewCount="502" Body="&lt;p&gt;I need to delete the &lt;code&gt;CRAFT_CSRF_TOKEN&lt;/code&gt; cookie when a form submission reaches certain/success page. I'm using &lt;a href=&quot;https://craftcms.com/docs/config-settings#csrfTokenName&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSRF&lt;/a&gt; stripped cookie's value to store entry title like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set token = craft.request.csrfToken[:10]|replace({'~':'P', '_':'B', '|':'T'})|upper %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Upon succesful form submission I'd like to erase cookie name &lt;code&gt;CRAFT_CSRF_TOKEN&lt;/code&gt; and it's value so on next form load there is a new cookie value set for &lt;code&gt;CRAFT_CSRF_TOKEN&lt;/code&gt; name to prevent next entry to be stored/updated in the same entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to achieve this I've failed right after accessing to &lt;code&gt;csrfTokenName&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Neither the property &quot;csrfTokenName&quot; nor one of the methods&#xA;&quot;csrfTokenName()&quot;, &quot;getcsrfTokenName()&quot;/&quot;iscsrfTokenName()&quot; or &quot;__call()&quot; &#xA;exist and have public access in class &quot;Craft\HttpRequestVariable&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-01-22T13:17:57.033" Title="Delete CSRF cookie on submit form success" Tags="&lt;security&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18628" PostTypeId="2" ParentId="18627" CreationDate="2017-01-22T13:17:57.033" Score="2" Body="&lt;p&gt;I guesss this could be accomplished using the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;cookies plugin&lt;/a&gt; or a simple &lt;a href=&quot;https://github.com/js-cookie/js-cookie&quot; rel=&quot;nofollow noreferrer&quot;&gt;jquery cookies&lt;/a&gt; library like js-cookie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you would go about it with the cookies plugin: set the cookies name without any value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ setCookie( NAME ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-22T13:17:57.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18629" PostTypeId="1" CreationDate="2017-01-22T17:05:12.163" Score="0" ViewCount="43" Body="&lt;p&gt;I need to create a popover on words to explain in more detail what that word actually means. It's kind of a dictionary for technical words. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would like to avoid to many queries and use it like Twig's translate filter. But the customer needs to add new descriptions to specific words from CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I please get some advice or pointer for further development?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2017-01-22T20:02:25.657" LastActivityDate="2017-01-23T12:49:25.707" Title="Popover on specific words in entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18630" PostTypeId="1" AcceptedAnswerId="18631" CreationDate="2017-01-22T17:55:03.290" Score="1" ViewCount="246" Body="&lt;p&gt;I'm trying to download a CSV file from a custom created element action&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the performAction function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function performAction(ElementCriteriaModel $criteria) {&#xA;        $contents = 'row1column1,row2column2'.PHP_EOL.'row2column1,row2column2'.PHP_EOL;&#xA;&#xA;        craft()-&amp;gt;request-&amp;gt;sendFile('export.csv', $contents, array('forceDownload' =&amp;gt; true), false);&#xA;&#xA;        return true;  &#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No error is thrown, the code passes right through the function. When I check the craft logs, there's no sign of any error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yet, there's no download occuring. When I try this same code in a controller or a service, it works just fine. But in this element action class, nothing happens&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:32:09.583" LastActivityDate="2020-02-06T08:08:19.223" Title="Downloading file from custom element action" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18631" PostTypeId="2" ParentId="18630" CreationDate="2017-01-22T20:07:54.067" Score="2" Body="&lt;p&gt;It's because those element actions happen over an AJAX and you have to &lt;a href=&quot;https://www.google.com/search?q=download%20a%20file%20to%20browser%20over%20ajax&quot; rel=&quot;nofollow noreferrer&quot;&gt;jump through a few hoops&lt;/a&gt; to send a file to the browser over an AJAX request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-22T20:07:54.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18632" PostTypeId="1" CreationDate="2017-01-23T00:30:03.587" Score="1" ViewCount="464" Body="&lt;p&gt;How can I duplicate an existing multi-language entry with all the translated content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I choose 'Save as new items' when editing an entry, only the content in the language I selected is copied to the new entry. All the translations are lost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or am I doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know much about the inner workings of Craft, but from the http request of the action 'Save as a new entry' I can see that the entryId field is overridden by an empty value. This makes me believe that this action does not really duplicates the entry with all it's translations, but simply add's a new entry with the content of the old entry in the language from which you are viewing the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct? If so, I guess I have to make a special plugin that adds an option to duplicate an entry with all it's translations.&lt;/p&gt;&#xA;" OwnerUserId="1005" LastEditorUserId="1005" LastEditDate="2017-01-25T21:20:16.117" LastActivityDate="2017-01-25T21:20:16.117" Title="Duplicating multi-language entry" Tags="&lt;localization&gt;&lt;entry&gt;&lt;bug&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18633" PostTypeId="1" AcceptedAnswerId="18635" CreationDate="2017-01-23T11:45:25.320" Score="1" ViewCount="1037" Body="&lt;p&gt;I am trying to upload jpg assets to Craft. As long as the files are smaller than &lt;strong&gt;approx. 1MB&lt;/strong&gt; it's working, even in bulk upload. As soon as there's a file bigger than 1MB Craft gets stuck like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pgp6s.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pgp6s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see on the image that files smaller as the 1MB have been uploaded successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file doesn't show up in the assets directory on the server file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I enabled devMode to take a look at the logs but no error level log entry shows up that is related to the upload request. JS console shows no errors as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: What is going on? How can I fix this so I can upload files within the limits I specified in &lt;code&gt;php.ini&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some info:&lt;/strong&gt;&lt;br&gt;&#xA;I am using Laravel Forge + DO&lt;br&gt;&#xA;Web server: nginx/1.11.5&lt;br&gt;&#xA;PHP Ver: 7.1.0&lt;br&gt;&#xA;post_max_size = 14M&lt;br&gt;&#xA;upload_max_filesize = 12M  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I say approx. 1MB because I was able to test with files that are roughly below/above 1MB file size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;I noticed Imagemagick was not installed. After installation: no difference. I even disabled GD: no difference. &lt;/p&gt;&#xA;" OwnerUserId="5851" LastEditorUserId="5851" LastEditDate="2017-01-23T12:07:14.637" LastActivityDate="2017-01-23T12:54:35.680" Title="Upload images bigger than 1MB not working" Tags="&lt;assets&gt;&lt;upload&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18634" PostTypeId="2" ParentId="18629" CreationDate="2017-01-23T12:49:25.707" Score="1" Body="&lt;p&gt;You can use this plugin to make it possible for you customer to add new descriptions to a translation file: &lt;a href=&quot;https://github.com/boboldehampsink/translate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/translate&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1005" LastActivityDate="2017-01-23T12:49:25.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18635" PostTypeId="2" ParentId="18633" CreationDate="2017-01-23T12:54:35.680" Score="2" Body="&lt;p&gt;Nginx's setting &lt;code&gt;client_max_body_size&lt;/code&gt; was set to its default value of &lt;code&gt;1M&lt;/code&gt; because it was not specified after provisioning the DO server with Laravel Forge. Weird thing is just that the user doesn't get any response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Set &lt;code&gt;client_max_body_size&lt;/code&gt; to something higher or 0 in your Nginx config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pvkam.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pvkam.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5851" LastActivityDate="2017-01-23T12:54:35.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18636" PostTypeId="2" ParentId="18624" CreationDate="2017-01-23T15:40:26.830" Score="1" Body="&lt;p&gt;You can find info about how to do this in the docs: &lt;a href=&quot;https://calendars.docs.topshelfcraft.com/guide/events-variable.html#How-it-Works&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://calendars.docs.topshelfcraft.com/guide/events-variable.html#How-it-Works&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;EventCriteriaModel&lt;/em&gt; given by &lt;code&gt;craft.calendars.events&lt;/code&gt; is used to query the owner elements from which the event instances are generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your example above, you can use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    calendar: 'myAwesomeCalendar',&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: now|date_modify(&quot;+1 month&quot;),&#xA;    trainingType: 'webinar',&#xA;    trainingLevel: 'expert' &#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This tells &lt;em&gt;Calendars&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find entries where &lt;code&gt;trainingType&lt;/code&gt; is &quot;webinar&quot; and &lt;code&gt;trainingLevel&lt;/code&gt; is &quot;expert&quot;...&lt;/li&gt;&#xA;&lt;li&gt;...and if those elements have any event rules registered on the Calendar called &lt;em&gt;myAwesomeCalendar&lt;/em&gt;...&lt;/li&gt;&#xA;&lt;li&gt;...return the instances of those events that occur in the next month.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(In this case, &lt;em&gt;Calendars&lt;/em&gt; queries Entry elements, since that is the default. You could specify a different element type, however.)&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2017-01-23T15:40:26.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18639" PostTypeId="1" CreationDate="2017-01-23T18:19:23.217" Score="1" ViewCount="622" Body="&lt;p&gt;I'm trying to set up a Craft based site with ec2 and it won't connect with the info in db.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've reinstalled the Craft files and also run all .phps through &lt;a href=&quot;http://phpcodechecker.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://phpcodechecker.com&lt;/a&gt; to check for errors and nothing. Logs all check out to be in working order. And I've followed every step exactly with this tutorial: &lt;a href=&quot;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what my db.php file looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;    'server' =&amp;gt; 'localhost',&#xA;&#xA;    // The name of the database to select.&#xA;    'database' =&amp;gt; 'Craft',&#xA;&#xA;    // The database username to connect with.&#xA;    'user' =&amp;gt; 'root',&#xA;&#xA;    // The database password to connect with.&#xA;    'password' =&amp;gt; '*******',&#xA;&#xA;    // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;    'tablePrefix' =&amp;gt; &quot;‘craft'&quot;,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also checked .htaccess files.&lt;/p&gt;&#xA;" OwnerUserId="6175" LastEditorUserId="45" LastEditDate="2017-01-23T18:47:58.470" LastActivityDate="2017-09-21T10:55:42.997" Title="Craft can't connect to the database (using ec2)" Tags="&lt;database&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18640" PostTypeId="1" CreationDate="2017-01-23T18:30:24.683" Score="0" ViewCount="165" Body="&lt;p&gt;I would like to know if it is possible to protect some sections of the site with an htpasswd or not?  I know that I could protect it by using user groups in my template, but I'm looking at avoiding the cost simply because the site is very temporary (1 week) and not for external purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/mysection1&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com/mysection1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/mysection2&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com/mysection2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mysite.com/mysection3&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.com/mysection3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those 3 sections would be protected by a different password, but they would also be pages in my site.  Can I just create the real physical folder and create the same page with same url in Craft?  Is there a way to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2017-01-23T20:53:46.327" Title="Protecting paths with htpasswd" Tags="&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18641" PostTypeId="2" ParentId="18639" CreationDate="2017-01-23T18:45:33.103" Score="5" Body="&lt;p&gt;So a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It's probably not a great idea to connect as &lt;code&gt;root&lt;/code&gt; -- it'd be better to create a mysql user that has access only to that db.&lt;/li&gt;&#xA;&lt;li&gt;Make sure that the db you're connecting to is indeed named &lt;code&gt;Craft&lt;/code&gt; (case may count here, I'm not sure)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;table_prefix&lt;/code&gt; looks wrong to me; probably it should be just: &lt;code&gt;'tablePrefix' =&amp;gt; 'craft',&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You also might consider checking out &lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Multi-Environment Config for Craft CMS&lt;/a&gt; for multi-environment configs for Craft.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-01-23T18:45:33.103" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18642" PostTypeId="2" ParentId="18640" CreationDate="2017-01-23T20:53:46.327" Score="1" Body="&lt;p&gt;Using htaccess/htpasswd in each folder does work, but I don't find it really elegant.  Would there be a better way of doing this without Craft's users?&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2017-01-23T20:53:46.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18643" PostTypeId="1" CreationDate="2017-01-23T23:00:00.537" Score="1" ViewCount="85" Body="&lt;p&gt;In Sprout Email is it possible to set a notification trigger to be when an entry goes live?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to create entries ahead of time and post date them so that they go live on the specified date.  I'd like the Sprout Email notification to get triggered when the entry is live (rather than when it is saved).&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2017-01-24T08:11:39.273" Title="Sprout Email trigger when entry goes live" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18644" PostTypeId="1" CreationDate="2017-01-24T06:37:50.627" Score="0" ViewCount="61" Body="&lt;p&gt;we are currently working on a website with an event calendar on it. The events should be filterable by categories and dates of course. Some of these events are repeated on another date. Now we are looking for a strategy to add the same event on another day without duplicating the entry and just modifying it's date. Is there a way to add an entry with it's own date but it inherits the contents and relations of another entry? These &quot;virtual&quot; entries should behave like &quot;real&quot; entries, so if the calendar is being filtered by the category &quot;concerts&quot; for example, all entries/virtual entries related to &quot;concerts&quot; should be listed. Any hint on that matter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your support!&lt;/p&gt;&#xA;" OwnerUserId="5387" LastActivityDate="2017-03-02T14:10:03.770" Title="Kind of virtual entries possible?" Tags="&lt;entries&gt;&lt;relations&gt;&lt;entry&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18645" PostTypeId="2" ParentId="18643" CreationDate="2017-01-24T08:11:39.273" Score="1" Body="&lt;p&gt;The docs state that the following events are available from Sprout Email:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When a new entry is created &lt;/li&gt;&#xA;&lt;li&gt;When an existing entry is updated&lt;/li&gt;&#xA;&lt;li&gt;When a new user is created&lt;/li&gt;&#xA;&lt;li&gt;When a existing user is updated&lt;/li&gt;&#xA;&lt;li&gt;When a user is activated&lt;/li&gt;&#xA;&lt;li&gt;When a user is deleted&lt;/li&gt;&#xA;&lt;li&gt;When a user logs in&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think changing the status of an entry would trigger the &quot;existing entry is updated&quot;. Not tested though.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-24T08:11:39.273" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18646" PostTypeId="1" AcceptedAnswerId="18724" CreationDate="2017-01-24T08:36:20.307" Score="0" ViewCount="191" Body="&lt;p&gt;I have a custom fieldtype (used within Neo block) and I need to know the ID/content of entry it belongs to, when editing the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to both populate field values based on value in other field (if present) and also perform validation on save by comparing with other fields in same entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I need to know the entry content (or at least entry ID so I could fetch those) within &lt;code&gt;getInputHtml&lt;/code&gt; and &lt;code&gt;validate&lt;/code&gt; functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could use &lt;code&gt;$this-&amp;gt;model&lt;/code&gt; and &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; but those don't seem to provide any data related to entry&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-01-29T13:25:41.860" Title="Get owner entry from fieldtype" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18647" PostTypeId="1" AcceptedAnswerId="18658" CreationDate="2017-01-24T09:54:49.643" Score="4" ViewCount="3730" Body="&lt;p&gt;My Craft CMS installation has &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;craft&lt;/code&gt; in the root of the directory, with the domain pointing to the public folder. Where could I put custom PHP scripts that I can run in the browser? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried it in the craft/templates folder (/craft/templates/m53ford). In this folder I can see the &lt;code&gt;HTML&lt;/code&gt; or &lt;code&gt;XML&lt;/code&gt; files by visiting &lt;a href=&quot;http://feeds.rhinodigital.co.uk/m53ford/index.xml&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://feeds.rhinodigital.co.uk/m53ford/index.xml&lt;/a&gt; for example, but a PHP script doesn't run in the same place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried in folders at the same root level (alongside the public and craft folders), and also within the public folder itself. Where in the directory tree could I place a PHP file that I can visit in the browser?&lt;/p&gt;&#xA;" OwnerUserId="4931" LastEditorUserId="22" LastEditDate="2017-05-09T20:29:30.533" LastActivityDate="2018-01-05T16:15:25.627" Title="Where can I run custom PHP scripts?" Tags="&lt;php&gt;&lt;craft-features&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18648" PostTypeId="2" ParentId="18647" CreationDate="2017-01-24T10:11:52.617" Score="2" Body="&lt;p&gt;So, you can't run php directly like that in CraftCMS, they disabled that for security reasons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you will need to create a plugin to run your php code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need the result returned in your template you can setup a twig variable then call it in your template, otherwise you can use other methods to run your code: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can start here: &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2017-01-24T10:11:52.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18649" PostTypeId="1" AcceptedAnswerId="18657" CreationDate="2017-01-24T10:42:51.183" Score="1" ViewCount="225" Body="&lt;p&gt;We are trying to add Craft alongside another CMS. I currently have Craft setup with the Craft app directory above web root and then two web accessible sub-directories as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;blog&lt;/li&gt;&#xA;&lt;li&gt;offer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each subdirectory has a Craft index.php file in it, pointing to the one craft app directory above web root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue now is trying to serve up a different set of pages based on which sub-directory the user accesses (ie. &quot;www.domain.com/offer&quot; or &quot;www.domain.com/blog&quot;). I thought I could add routes to do this but they don't seem to work as I'd hoped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are routes the right way to do this? I thought I could have defined a route of &quot;blog/&quot; to load a specific template but that does not work (I assume that first URL segment isn't available to the route based on having the index.php file in that directory?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way to handle this that I haven't thought of?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Mike&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-01-24T19:29:58.520" Title="Running Craft from two subdirectories" Tags="&lt;routes&gt;&lt;routing&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18651" PostTypeId="2" ParentId="18647" CreationDate="2017-01-24T15:47:49.580" Score="2" Body="&lt;p&gt;You can add some business logic to your site using the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Businesss Logic plugin.&lt;/a&gt; It's pretty straightforward.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-24T15:47:49.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18653" PostTypeId="1" AcceptedAnswerId="19337" CreationDate="2017-01-24T17:24:51.823" Score="1" ViewCount="210" Body="&lt;p&gt;&lt;code&gt;.htaccess&lt;/code&gt; is working fine. If I manually type &lt;code&gt;url.com/about&lt;/code&gt; it shows the page. If I manually type &lt;code&gt;url.com/asdf&lt;/code&gt; it shows 404 template page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;url.com/index.php/testPathInfo&lt;/code&gt; shows &lt;code&gt;success&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;general.php has &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; 'true',&#xA;    ),&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when templates contain &lt;code&gt;{{ url('about') }}&lt;/code&gt; or &lt;code&gt;{{ entry.url }}&lt;/code&gt; I get &lt;code&gt;url.com/index.php?p=whatever-this-is-supposed-to-be&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm probably missing something easy and obvious but I've been staring at it all morning. Could it still be the mod_rewrite enabled thing even though it's rewriting fine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.htaccess content&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;   RewriteEngine On&#xA;   RewriteBase /&#xA;&#xA;   # Send would-be 404 requests to Craft&#xA;   RewriteCond %{REQUEST_FILENAME} !-f&#xA;   RewriteCond %{REQUEST_FILENAME} !-d&#xA;   RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;   RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;AuthType Basic&#xA;AuthName &quot;*DEV*&quot;&#xA;AuthUserFile /home/username/public_html/dev/.htpasswd&#xA;Require valid-user&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="230" LastEditorUserId="230" LastEditDate="2017-01-25T14:35:46.837" LastActivityDate="2017-03-08T20:54:45.410" Title="multi-domain setup: template entry.url includes index.php" Tags="&lt;url&gt;&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18654" PostTypeId="2" ParentId="18160" CreationDate="2017-01-24T18:26:30.450" Score="2" Body="&lt;p&gt;By setting the action: &quot;#errortag&quot; seems to stop the form submitting if there are no errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead I have added the following code and this seems to work;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if form.hasErrors %}&#xA;{% includejs %}&#xA;$(document).ready(function () {&#xA;    $('html, body').animate({&#xA;        scrollTop: $('#formErrors').offset().top-110&#xA;    }, 1000);&#xA;});&#xA;{% endincludejs %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-01-24T18:26:30.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18655" PostTypeId="1" CreationDate="2017-01-24T18:30:54.740" Score="0" ViewCount="29" Body="&lt;p&gt;Do I need to go through and install all the previous updates before installing 2.6.2958 (current 2.6.2779) OR can I simply use the instructions on this page &lt;a href=&quot;https://craftcms.com/docs/updating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/updating&lt;/a&gt; and install version 2.6.2958.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any recommendations would be appreciated since I have never used Craft before and/or done any installations/updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="6181" LastEditorUserId="57" LastEditDate="2017-01-24T19:38:02.680" LastActivityDate="2017-01-24T19:38:02.680" Title="Can I simply update from 2.6.2779 -&gt; 2.6.2958, shared hosting" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18656" PostTypeId="2" ParentId="18655" CreationDate="2017-01-24T18:37:57.457" Score="3" Body="&lt;p&gt;Just make a backup of files and database first then click update (or upload a new /craft/app folder if you've got automatic updates turned off) - there are no breaking changes in Craft 2.6&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-01-24T18:37:57.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18657" PostTypeId="2" ParentId="18649" CreationDate="2017-01-24T19:29:58.520" Score="0" Body="&lt;p&gt;There's a whole slew of &lt;a href=&quot;https://craftcms.com/docs/php-constants&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP constants&lt;/a&gt; you can define in each public &lt;code&gt;index.php&lt;/code&gt; file to separate out the templates, config settings, etc. for each of the sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a very similar method we use for &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com&lt;/a&gt;, too (just based on subdomains instead of subfolders.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-24T19:29:58.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18658" PostTypeId="2" ParentId="18647" CreationDate="2017-01-24T19:43:10.760" Score="6" Body="&lt;p&gt;If you're simply looking to execute some custom scripts that are completely standalone (i.e. they don't interact with the Craft application in any way), those files should live somewhere below your public web root (i.e. the &lt;code&gt;public&lt;/code&gt; folder, or wherever your &lt;code&gt;index.php&lt;/code&gt; file resides). It isn't possible to have Craft route PHP files from the &lt;code&gt;/templates&lt;/code&gt; directory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the problem with reading/executing arbitrary PHP files from the public root, is that Craft basically &quot;hijacks&quot; all requests to anything below that folder, and routes those requests to &lt;code&gt;index.php&lt;/code&gt;. In order to read or execute an arbitrary PHP file below the public root, you'll need to override Craft's URL routing, for example by using &lt;code&gt;RewriteRule&lt;/code&gt; directives in your &lt;code&gt;.htacesss&lt;/code&gt; file if you're using Apache (also see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14561/installing-other-php-app-in-sub-directory&quot;&gt;this related thread&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the contrary, if your custom PHP scripts do need to interact with Craft in any way, you'll need to write a custom plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, Craft plugins are relatively simple to build (as long as you're familiar with PHP, of course). You can use the excellent &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Factory&lt;/a&gt; to quickly scaffold a bare-bones plugin with a thoroughly commented codebase or use &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Business Logic plugin&lt;/a&gt; as a starting point. Downloading &lt;a href=&quot;https://straightupcraft.com/craft-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;other available plugins&lt;/a&gt; and looking at their source code is probably not a bad idea, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, before digging in you should definitely skim through &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;the official docs on plugin development&lt;/a&gt;. By far, the most important thing to know about Craft plugins is how they are structured and what the various moving parts do. That knowledge will also give you a nice overview of what a plugin's capabilities are, and how you'd go about implementing a certain feature in your own plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing that the official docs doesn't really mention, which might be relevant to your use case, is how you make use of third party scripts or libraries. There are &lt;a href=&quot;https://craftcms.stackexchange.com/a/4891/1098&quot;&gt;lots of ways to skin that particular cat&lt;/a&gt;, but the headline is that using &lt;a href=&quot;https://craftcms.stackexchange.com/a/3021/1098&quot;&gt;using Composer&lt;/a&gt; if you can is the best option, though a simple &lt;code&gt;require()&lt;/code&gt; call in your plugin's main class' &lt;code&gt;init&lt;/code&gt; method will of course also work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep in mind that when you're using third party scripts inside a Craft plugin, you will need to &lt;a href=&quot;https://craftcms.stackexchange.com/a/11829/1098&quot;&gt;deal with namespacing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upcoming Craft 3 release adds another option for running PHP business logic – &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii2 Modules&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-01-05T16:15:25.627" LastActivityDate="2018-01-05T16:15:25.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18659" PostTypeId="1" CreationDate="2017-01-25T01:04:30.707" Score="3" ViewCount="319" Body="&lt;p&gt;I'm trying to add a new locale, but the task &quot;Resaving all localizable elements&quot; is stuck and the new locale is not being added to content.&#xA;Even after restarting the task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no errors in the log file.&lt;/p&gt;&#xA;" OwnerUserId="6183" LastActivityDate="2019-12-18T13:26:45.673" Title="Task &quot;Resaving all localizable elements&quot; is stuck when adding new new locale" Tags="&lt;localization&gt;&lt;craft-pro&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18660" PostTypeId="1" AcceptedAnswerId="18662" CreationDate="2017-01-25T01:36:09.440" Score="3" ViewCount="256" Body="&lt;p&gt;I want to restructure the output of the way Sprout Forms generates checkboxes and radio buttons from that of the input.html in templates/_components. I need the label to appear &lt;em&gt;after&lt;/em&gt; the radio/checkbox input for styling/accessibility purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not seeing the documentation to override  without editing the plugin (obviously not a sustainable plan). Can I just put them in the designated &lt;em&gt;Global custom form templates folder&lt;/em&gt; and have SproutForms look for form_overrides/radiobutton/input.html first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example of what I need to do:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;radio&quot;&#xA;  {%- if id %} id=&quot;{{ id }}-{{ loop.index }}&quot;{% endif %}&#xA;  {%- if name %} name=&quot;{{ name }}&quot;{% endif %}&#xA;  {%- if value %} value=&quot;{{ value }}&quot;{% endif %}&#xA;  {%- if checked is defined and checked %} checked{% endif %}&#xA;  {{- required -}}&#xA;  {{- dataAttributes|raw -}}&#xA;&amp;gt;&#xA;    &amp;lt;label {%- if id %} for=&quot;{{ id }}-{{ loop.index }}&quot;{% endif %}&amp;gt;&#xA;        {%- if label is defined %}{{ label|raw }}{% endif -%}&#xA;    &amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5957" LastActivityDate="2017-01-25T04:48:56.757" Title="Global override specific field templates in Sprout Forms Plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18661" PostTypeId="1" AcceptedAnswerId="18666" CreationDate="2017-01-25T03:55:54.327" Score="1" ViewCount="93" Body="&lt;p&gt;I want users to be able to signup to my Craft site, but only if they have a specific email domain. So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*@gmail.com&#xA;*@hotmail.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would be allowed, but anyone with a &lt;em&gt;yahoo.com&lt;/em&gt; email, for example, would not be able to sign up. I can do client-side validation but is there anything I can do in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2017-01-25T09:31:57.960" Title="Only allow signups from people with @___.com emails" Tags="&lt;users&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18662" PostTypeId="2" ParentId="18660" CreationDate="2017-01-25T04:48:56.757" Score="1" Body="&lt;p&gt;The HTML of the &lt;code&gt;input&lt;/code&gt; fields are managed by the Custom Field, not within Sprout Forms, so Sprout Forms does not have easy access to that code to give you control over it. There are a few input types where we have to make assumptions about the HTML and the checkboxes field is one of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're looking into ways to give better control here. Right now, the best option if you want an upgrade-safe way to modify that HTML would be to create a [Custom Front-end Field integration](&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&lt;/a&gt;&#xA;) for the fields you wish to update the &lt;code&gt;input&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this approach, you would create a separate plugin and add front-end support for whatever fields you need to modify the &lt;code&gt;input&lt;/code&gt; HTML for and your new field would display in the field dropdown when creating a form. As a starting point, you could copy just about everything from the Sprout Forms checkboxes integration which is located in &lt;code&gt;sproutforms/integrations/sproutforms/fields/SproutFormsCheckboxesField.php&lt;/code&gt;. Aside from wrapping the Custom Front-end Field in a new plugin, the main things you will need to change is the name of the field so you can identify it in your dropdown and the &lt;code&gt;input&lt;/code&gt; HTML in the front-end field template file.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-01-25T04:48:56.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18663" PostTypeId="1" CreationDate="2017-01-25T08:00:26.183" Score="1" ViewCount="111" Body="&lt;p&gt;I have a great many products which have a date field (they're class dates) and I want to show the next three which have any stock left (available places). The following works fine to display the next three products:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set earliestDate = now %} &#xA;{% set latestDate = now | date_modify('+ 10 days') %}&#xA;&#xA;{% set products = craft.commerce.products({&#xA;  type: 'class',&#xA;  date: 'and, &amp;gt; ' ~ earliestDate ~ ', &amp;lt; ' ~ latestDate,&#xA;  order: 'date',&#xA;  limit: 3&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But of course there's no reference to stock. If I add the hasStock parameter, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;  hasVariant: {&#xA;    hasStock: true&#xA;  },&#xA;  type: 'class',&#xA;  date: 'and, &amp;gt; ' ~ earliestDate ~ ', &amp;lt; ' ~ latestDate,&#xA;  order: 'date',&#xA;  limit: 3&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results are different every time I load the page! Results vary but include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;showing more than three products, e.g. 5 products&lt;/li&gt;&#xA;&lt;li&gt;no products being returned at all&lt;/li&gt;&#xA;&lt;li&gt;three products but products which are an earlier date being skipped&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Has anyone else encountered this? I can understand maybe different results than expected if hasStock items were being fetched before the rest of the query, but not why it would be different on every pageload. If it helps, no products are being returned outside the date range I'm supplying.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-01-25T09:27:23.833" LastActivityDate="2017-01-25T09:27:23.833" Title="Commerce products returning different results on page load" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18664" PostTypeId="1" AcceptedAnswerId="18665" CreationDate="2017-01-25T09:08:06.763" Score="2" ViewCount="979" Body="&lt;p&gt;Is there a way with the request service to read POSTed JSON from &lt;code&gt;php://input&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-01-25T09:08:06.763" Title="Read POSTed JSON data from the request body" Tags="&lt;request&gt;&lt;https&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18665" PostTypeId="2" ParentId="18664" CreationDate="2017-01-25T09:08:06.763" Score="3" Body="&lt;p&gt;Yes, you can use &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHttpRequest#getRestParams-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getRestParams()&lt;/a&gt; like so: &lt;code&gt;$input = craft()-&amp;gt;request-&amp;gt;getRestParams()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit confusing naming there, which is why it's changing to &lt;code&gt;getBodyParams()&lt;/code&gt; in Yii 2.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-01-25T09:08:06.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18666" PostTypeId="2" ParentId="18661" CreationDate="2017-01-25T09:31:57.960" Score="4" Body="&lt;p&gt;One way of doing this is to write a custom plugin that intercepts the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onBeforeSaveUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;users.onBeforeSaveUser&lt;/code&gt; event&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would check that the submitted email address matched your desired pattern and set &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt; if the criteria wasn't met. This would prevent the user from being saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the &lt;code&gt;init()&lt;/code&gt; method of your plugin might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function init()&#xA;    {&#xA;        craft()-&amp;gt;on('users.beforeSaveUser', function(Event $event) {&#xA;&#xA;            // Retrieve the userModel from the event&#xA;            $user = $event-&amp;gt;params['user'];&#xA;            $isNewUser = $event-&amp;gt;params['isNewUser'];&#xA;&#xA;            // Check if this is a front end request and that we are dealing with a new user&#xA;            if (craft()-&amp;gt;request-&amp;gt;isSiteRequest() &amp;amp;&amp;amp; $isNewUser) {&#xA;&#xA;                // Check for valid email address&#xA;                if (email address doesn't match required pattern) {&#xA;                    // Cancel user save&#xA;                    $event-&amp;gt;preformAction = false;&#xA;                }&#xA;            }&#xA;        });&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-01-25T09:31:57.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18668" PostTypeId="1" AcceptedAnswerId="18675" CreationDate="2017-01-25T12:11:56.017" Score="1" ViewCount="48" Body="&lt;p&gt;Is it possible to have a unique cart for different users? If I log in as a user and add items to my cart, and then log in as another user, it shows the same items in my cart. Can this be changed?&lt;/p&gt;&#xA;" OwnerUserId="6185" LastActivityDate="2017-01-25T20:21:14.393" Title="Unique carts for different users" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18669" PostTypeId="2" ParentId="18356" CreationDate="2017-01-25T14:24:27.220" Score="1" Body="&lt;p&gt;Would this help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15251/filter-entries-by-field-value&quot;&gt;Filter Entries by Field Value&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than it would be something like this I suppose (never used it myself):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in entry.myCustomField.search('category':'main') %}&#xA;    {{ item.category }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-01-25T14:24:27.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18670" PostTypeId="1" CreationDate="2017-01-25T15:39:26.080" Score="0" ViewCount="339" Body="&lt;p&gt;I am working on a project and the plug in I installed won't work because I don't know how to add the jquery.css file needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did is to add the file with a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; command but it's still not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% block body %}&#xA;&amp;lt;link type=&quot;text/css&quot;  href=&quot;{{ asset('home/workspace/fermate/src/CtrlBln/HomepageBundle/Resources/public/js/Minimal-jQuery-Image-Viewer-with-Image-Preloading-ABigImage/bigimage.jquery.css')}}&quot; &amp;gt; &#xA;&amp;lt;div class=&quot;page-sidebar&quot;&amp;gt;&#xA;    {% for link in entity.getSidebarImages() %}&#xA;        {% if link.image.isFoto() %}            &#xA;            &amp;lt;a href=&quot;{{ app.request.basepath }}/{{ link.image.getWebPath() }}&quot;&amp;gt;         &#xA;                &amp;lt;img src=&quot;{{ app.request.basepath }}/{{ link.image.getWebPath(&quot;thumbnail_250&quot;) }}&quot; alt=&quot;{{ link.image.title }}&quot;&amp;gt;                        &#xA;                &amp;lt;div class=&quot;sidebar-description&quot;&amp;gt;&#xA;                    {{ link.image.description|raw }}&#xA;                &amp;lt;/div&amp;gt;  &#xA;            &amp;lt;/a&amp;gt;        &#xA;        {% else %}&#xA;            &amp;lt;div class=&quot;sidebar-item sidebar-link-item&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ app.request.basepath }}/{{ link.image.webpath }}&quot;&amp;gt;&#xA;&#xA;                 &amp;lt;img src=&quot;{{ app.request.basepath }}/{{ link.image.getPreview() }}&quot; /&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;                &amp;lt;div class=&quot;sidebar-title&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ app.request.basepath }}/{{ link.image.webpath }}&quot;&amp;gt;&#xA;                      {{ link.image.title|raw }}&#xA;                    &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}    &#xA;&amp;lt;script&amp;gt;&#xA;$(function(){&#xA;    $(this).abigimage();&#xA;});   &#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&#xA;    {% block body_javascripts %}&#xA;        {% javascripts output='aBigImage.js'&#xA;        '@CtrlBlnHomepageBundle/Resources/public/js/Minimal-jQuery-Image-Viewer-with-Image-Preloading-ABigImage/abigimage.jquery.min.js'    &#xA;        %}&#xA;        &amp;lt;script type=&quot;text/javascript&quot; src=&quot;{{ asset_url }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;        {% endjavascripts %}&#xA;    {% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6187" LastEditorUserId="57" LastEditDate="2017-01-25T20:28:40.597" LastActivityDate="2017-01-25T20:28:40.597" Title="How to add jquery.css file in Twig?" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18671" PostTypeId="1" AcceptedAnswerId="18672" CreationDate="2017-01-25T15:57:17.647" Score="1" ViewCount="117" Body="&lt;p&gt;I have Sprout SEO working just great on Channels. However when I go to my channels that are single entries how do I handle custom SEO on a per page basis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my channels I can use this code in my templates and it works great:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({ &#xA;id: entry.id,&#xA;default: 'default'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when on singles the entry.id throws an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Variable &quot;entry&quot; does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do i need to create my own default for each section listed out under Singles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT AFTER MORE TESTING&lt;/strong&gt;&#xA;This seems to be effecting just one or two of my singles. &#xA;I wrote a little more about my issue but as I was typing so was Ben with the answer :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help in advanced,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John &lt;/p&gt;&#xA;" OwnerUserId="3571" LastEditorUserId="3571" LastEditDate="2017-01-25T16:49:52.463" LastActivityDate="2017-01-25T16:49:52.463" Title="Sprout SEO and Single channels" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18672" PostTypeId="2" ParentId="18671" CreationDate="2017-01-25T16:46:59.183" Score="2" Body="&lt;p&gt;The error &lt;code&gt;&quot;Variable &quot;entry&quot; does not exist&lt;/code&gt; means that your current page does not have a variable called &lt;code&gt;entry&lt;/code&gt; available. This probably means the problem lies in how you have your Sections or routing set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you remove Sprout SEO from this page and just try to access &lt;code&gt;entry.title&lt;/code&gt; in your template, you will probably receive the same error. So, it will be best to troubleshoot that and confirm you have the &lt;code&gt;entry&lt;/code&gt; variable available to the page before troubleshooting what might be going on in Sprout SEO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you know the Single is setup correctly and able to display data from the &lt;code&gt;entry&lt;/code&gt; variable, the next question would become why is the &lt;code&gt;entry&lt;/code&gt; variable not available to the particular part of your page where you are trying to hand off information to Sprout SEO. To answer that, it would be helpful if you posted more information on what your template looks like, where outputting the &lt;code&gt;entry&lt;/code&gt; variable to the page directly works, and where trying to pass the &lt;code&gt;entry.id&lt;/code&gt; variable on the page throws an error.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-01-25T16:46:59.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18673" PostTypeId="1" AcceptedAnswerId="18679" CreationDate="2017-01-25T17:31:28.613" Score="1" ViewCount="101" Body="&lt;p&gt;I'm not sure if this is a bug or not, but there is something weird going on if I try to compare an integer form a dropdown field to an integer in the template. In short, it doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with a dropdown level field for users from 1 to 15 and use conditionals for content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set integer = 7 %}&#xA;{% set mylevel = currentUser.level %}&#xA;&#xA;My level: {{mylevel}}&amp;lt;br&amp;gt;&#xA;Number: {{integer}}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% if mylevel &amp;gt;= integer %}&#xA;    {{mylevel}} bigger than or equals {{integer}}&#xA;{% else %}&#xA;    {{mylevel}} smaller than {{integer}}    &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;My level: 8&amp;lt;br&amp;gt;&#xA;Number: 7&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;8 smaller than 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;HOWEVER if I replace the code &quot;currentUser.level&quot; with 8 like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set integer = 7 %}&#xA;{% set mylevel = 8 %}&#xA;&#xA;My level: {{mylevel}}&amp;lt;br&amp;gt;&#xA;Number: {{integer}}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;{% if mylevel &amp;gt;= integer %}&#xA;    {{mylevel}} bigger than or equals {{integer}}&#xA;{% else %}&#xA;    {{mylevel}} smaller than {{integer}}    &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;My level: 8&#xA;Number: 7&#xA;8 bigger than or equals 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I checked the database and reinserted all numbers, but nothing changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database had this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;options&quot;:[{&quot;label&quot;:&quot;SG1&quot;,&quot;value&quot;:&quot;1&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG2&quot;,&quot;value&quot;:&quot;2&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG3&quot;,&quot;value&quot;:&quot;3&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG4&quot;,&quot;value&quot;:&quot;4&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG5&quot;,&quot;value&quot;:&quot;5&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG6&quot;,&quot;value&quot;:&quot;6&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG7&quot;,&quot;value&quot;:&quot;7&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG8&quot;,&quot;value&quot;:&quot;8&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG9&quot;,&quot;value&quot;:&quot;9&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG10&quot;,&quot;value&quot;:&quot;10&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG11&quot;,&quot;value&quot;:&quot;11&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;SG12&quot;,&quot;value&quot;:&quot;12&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;TG01&quot;,&quot;value&quot;:&quot;13&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;TG02&quot;,&quot;value&quot;:&quot;14&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;TG03&quot;,&quot;value&quot;:&quot;15&quot;,&quot;default&quot;:&quot;&quot;},{&quot;label&quot;:&quot;TG04&quot;,&quot;value&quot;:&quot;16&quot;,&quot;default&quot;:&quot;&quot;}]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="45" LastEditDate="2017-05-22T20:45:34.557" LastActivityDate="2017-05-22T20:45:34.557" Title="Comparison with an integer from a dropdown list not working" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;integer&gt;&lt;comparisons&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18675" PostTypeId="2" ParentId="18668" CreationDate="2017-01-25T20:21:14.393" Score="1" Body="&lt;p&gt;As you've found, Commerce carts &lt;a href=&quot;https://craftcommerce.com/docs/configuration#cartcookieduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;exist independently&lt;/a&gt; of a Craft user's session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A workaround would be to write a simple &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listens to something like the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onLogin&quot; rel=&quot;nofollow noreferrer&quot;&gt;onLogin&lt;/a&gt; event and that plugin would check for the &lt;code&gt;commerce_cart&lt;/code&gt; cookie and if it exists, nuke it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would force a new cart for each new login.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-25T20:21:14.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18676" PostTypeId="2" ParentId="18670" CreationDate="2017-01-25T20:28:30.177" Score="1" Body="&lt;p&gt;Is &lt;code&gt;asset()&lt;/code&gt; a Twig &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macro&lt;/a&gt; you've defined?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you sure you're just not looking for the global &lt;a href=&quot;https://craftcms.com/docs/templating/functions#url&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;url()&lt;/code&gt;&lt;/a&gt; method instead?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-25T20:28:30.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18677" PostTypeId="1" AcceptedAnswerId="18678" CreationDate="2017-01-25T20:40:46.233" Score="1" ViewCount="211" Body="&lt;p&gt;I would like to commit my craft project to bitbucket en deploy it with the help of Deploybot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plan is to put the templates (in craft folder) and public assets (public folder) under version control and deploy it with Deploybot. But how do i get the files published into the right directories on the live/staging server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My craft folder is outside the public root and the public files/assets are inside the public root. So i have two source directories and two destination directories, and this isn't an option with Deploybot. Is there someone with the same setup and a solution? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thnx in advance!&lt;/p&gt;&#xA;" OwnerUserId="5686" LastActivityDate="2017-01-25T21:27:38.200" Title="Craft folder deployment outside public folder" Tags="&lt;deployment&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18678" PostTypeId="2" ParentId="18677" CreationDate="2017-01-25T20:57:44.443" Score="3" Body="&lt;p&gt;Dennis,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use deploybot with Craft and easily deploy. So on your server settings you'll have this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;name: your site name&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Host: ip address or domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;port: 22 or similar&lt;/p&gt;&#xA;&#xA;&lt;p&gt;destination path: /path/to/site_username/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the destination path set it to be just above public and then you'll deploy /site_username/craft and site_username/pubic&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2017-01-25T21:27:38.200" LastActivityDate="2017-01-25T21:27:38.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18679" PostTypeId="2" ParentId="18673" CreationDate="2017-01-25T21:26:27.717" Score="1" Body="&lt;p&gt;You'll want to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mylevel = currentUser.level.value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you just use &lt;code&gt;currentUser.level&lt;/code&gt; and assign it to a variable, then what you'll get back is a &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/MultiOptionsFieldData&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiOptionsFieldData&lt;/a&gt; class, instead of the value you are expecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a note on the bottom of the &lt;a href=&quot;https://craftcms.com/docs/dropdown-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;page here&lt;/a&gt; that describes it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-25T21:26:27.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18680" PostTypeId="1" AcceptedAnswerId="18682" CreationDate="2017-01-26T01:50:30.663" Score="2" ViewCount="603" Body="&lt;p&gt;I'm making a plugin where I'd like a user to be able to add values to a list, then have that list saved as an array.  Are there any smart ways of doing this? My current solution is to have a &lt;code&gt;textarea&lt;/code&gt;, then make values out of each line but that's not ideal at all. Does Craft already have a built-in UI pattern for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2017-01-26T09:33:35.760" Title="Plugin Settings UI for saving an array of values" Tags="&lt;plugin-development&gt;&lt;settings&gt;&lt;user-interface&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18682" PostTypeId="2" ParentId="18680" CreationDate="2017-01-26T09:19:09.727" Score="6" Body="&lt;p&gt;You can use the EditableTable template component (i.e. the same UI component that Table fields use).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that this will only work inside the Control Panel – not on the front end. The title of this question says &lt;a href=&quot;https://craftcms.com/docs/plugins/plugin-settings&quot; rel=&quot;noreferrer&quot;&gt;&quot;Plugin settings&quot;&lt;/a&gt;, so I'm assuming that's your actual use case.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.editableTableField({&#xA;    label: 'Some setting',&#xA;    instructions: 'Some instructions here',&#xA;    id: 'someSetting',&#xA;    name: 'someSetting',&#xA;    cols: [&#xA;        {&#xA;            heading : 'Some column',&#xA;            type: 'select',&#xA;            options: [{label: 'Foo', value: 'foo'}, {label: 'Bar', value: 'bar'}]&#xA;        },&#xA;        {&#xA;            heading : 'Some other column',&#xA;            type: 'singleline'&#xA;         },&#xA;    ],&#xA;    rows: settings['someSetting']&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as the setting you use with the table (&lt;code&gt;someSetting&lt;/code&gt; in the example above) has &lt;code&gt;AttributeType::Mixed&lt;/code&gt;, Craft will automatically handle serialization for you (the rows you input in the table will be stored as a simple JSON object in the database, just like Table fields are stored).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that each &lt;code&gt;column&lt;/code&gt; entry can have a type of &lt;code&gt;singleline&lt;/code&gt;, &lt;code&gt;multiline&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;select&lt;/code&gt; or &lt;code&gt;checkbox&lt;/code&gt;. If you don't declare a &lt;code&gt;type&lt;/code&gt;, the column will render as a PlainText field.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the variable &lt;code&gt;settings&lt;/code&gt; (which is passed to the &lt;code&gt;rows&lt;/code&gt; parameter) refers to an array of your plugin's current settings – meaning you'll need to pass those to your &lt;code&gt;settings.html&lt;/code&gt; template like this (the following method should go in your plugin's primary class):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml ()&#xA;{&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('yourpluginhandle/settings', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings(),&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, you can pass additional variables to the settings template – such as a pre-populated array of label/value pairs to use for any dropdown (select) fields inside the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're unfamiliar with Twig macros, I recommend taking a look at &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/tags/macro.html&quot; rel=&quot;noreferrer&quot;&gt;the official docs on the subject&lt;/a&gt; (if only to understand the syntax used, and the &lt;code&gt;import&lt;/code&gt; statement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/templates/_includes/forms/editableTable.html&quot; rel=&quot;noreferrer&quot;&gt;here's the source for the &lt;code&gt;editableTableField&lt;/code&gt; macro&lt;/a&gt;, which could prove useful.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-01-26T09:33:35.760" LastActivityDate="2017-01-26T09:33:35.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18683" PostTypeId="1" AcceptedAnswerId="18989" CreationDate="2017-01-26T12:28:39.993" Score="2" ViewCount="917" Body="&lt;p&gt;We are considering using Commerce for a site where the company sets hard coded prices for the various regions and countries they sell in. I know Commerce has multi-currency support but pricing is in a primary currency and then you set conversion rates. However our client just sets prices - there's not a consistent conversion rate. So, for example, a US product would be $700, it would be $950 in Canada and 14000 pesos in Mexico.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to achieve this with Commerce in a fashion where the client can update these prices in the admin? It's an important requirement for them and we're considering other platforms but thought someone might have some insight specific to Commerce because we do like Craft for other reasons. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- UPDATE ---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying this as per the accepted answer and the lineItem price on the Cart page doesn't seem to reflect what gets set in the plugin. My code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class NewPricingPlugin extends BasePlugin&#xA;{&#xA;    function init(){&#xA;        craft()-&amp;gt;on('commerce_cart.onBeforeAddToCart', function($event){&#xA;​​           $line = $event-&amp;gt;params['lineItem'];&#xA;&#xA;​​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $9.00&#xA;​&#xA;​           // this sets the lineitem price, but when the cart page&#xA;           // loads the price hasn't changed.&#xA;​           ​$line['price'] = 1000;&#xA;&#xA;​ ​          ​NewPricingPlugin::log(​$line['price']​);​ # = $1000.00&#xA;​    ​    });&#xA;​    ​}&#xA;&#xA;    // other plugin methods...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;​Is there a lineItem or cart update method that needs to be called?​&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-02-15T23:08:49.230" LastActivityDate="2017-02-15T23:08:52.817" Title="Craft Commerce: Hard code different product prices based on currency?" Tags="&lt;plugin-craftcommerce&gt;&lt;currency&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18684" PostTypeId="1" CreationDate="2017-01-26T14:21:33.433" Score="1" ViewCount="183" Body="&lt;p&gt;I have a registration form that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;      {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;          &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;              &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;      {% endmacro %}&#xA;&#xA;      {% from _self import errorList %}&#xA;&#xA;      &amp;lt;div class=&quot;top-row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;firstName&quot; name=&quot;fields[firstName]&quot; required {%- if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif %}&quot;&amp;gt;&#xA;          {{ account is defined and account ? errorList(account.getErrors('firstName')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;lastName&quot; name=&quot;fields[lastName]&quot; required {%- if account is defined %} value=&quot;{{ account.lastName }}&quot;{% endif %}&quot;&amp;gt;&#xA;          {{ account is defined and account ? errorList(account.getErrors('lastName')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;top-row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;          {% if account is defined %} {{ errorList(account.getErrors('email')) }}{% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;company&quot;&amp;gt;Company&amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;company&quot; name=&quot;fields[company]&quot; required {%- if account is defined %} value=&quot;{{ account.company }}&quot;{% endif %}&quot;&amp;gt;&#xA;          {{ account is defined and account ? errorList(account.getErrors('company')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;      &amp;lt;div class=&quot;top-row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;country&quot;&amp;gt;Country&amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;country&quot; name=&quot;fields[country]&quot; required {%- if account is defined %} value=&quot;{{ account.country }}&quot;{% endif %}&quot;&amp;gt;&#xA;          {{ account is defined and account ? errorList(account.getErrors('country')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;field-wrap&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;applicationArea&quot;&amp;gt;Application area&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; id=&quot;applicationArea&quot; name=&quot;fields[applicationArea]&quot; {%- if account is defined %} value=&quot;{{ account.applicationArea }}&quot;{% endif %}&quot;&amp;gt;&#xA;          {{ account is defined and account ? errorList(account.getErrors('applicationArea')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;              {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;      {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;      {% if account is defined %} &#xA;        {{ errorList(account.getErrors('password')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;div class=&quot;form-footer&quot;&amp;gt;&#xA;        &amp;lt;input class=&quot;button button-block&quot; type=&quot;submit&quot; value=&quot;Send request&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;back-to-login&quot;&amp;gt;&amp;lt;a href=&quot;#login&quot; class=&quot;switcher&quot;&amp;gt;&amp;lt;svg width=&quot;10&quot; height=&quot;10&quot; role=&quot;img&quot;&amp;gt;&amp;lt;use class=&quot;closebtn__use&quot; xlink:href=&quot;/assets/img/svg_sprite/svg_sprite.svg#arrow-pointer-right&quot;&amp;gt;&amp;lt;/use&amp;gt;&amp;lt;/svg&amp;gt;Go back to login&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I made the custom fields firstName, lastName, company, applicationArea and assigned them as user profile fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is that I don't want the user to enter a password and username on registration but send them an activation mail later. If I register a user in the form above it is added to the user list and everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i however remove to following part (since I don't want the username and password to the registration form):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;              {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;      {% if account is defined %}&#xA;        {{ errorList(account.getErrors('username')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;      &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;      {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;      {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This last snippet comes from the standard Craft demo registration form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions how to make te registration form work without the username and password?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thans in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ps: I use Craft CMS 2.6.2958&lt;/p&gt;&#xA;" OwnerUserId="6191" LastActivityDate="2017-01-26T19:20:56.700" Title="Registration form issue" Tags="&lt;form&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18686" PostTypeId="2" ParentId="17567" CreationDate="2017-01-26T15:59:42.730" Score="-2" Body="&lt;p&gt;In craft-&gt;app-&gt;fieldtypes-&gt;RichTextFieldType.php there is a function called _getLinkOptions. In there if you just return an empty array, there will only be the option to link to a URL.&lt;/p&gt;&#xA;" OwnerUserId="5479" LastActivityDate="2017-01-26T15:59:42.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18687" PostTypeId="1" AcceptedAnswerId="18694" CreationDate="2017-01-26T16:05:08.370" Score="2" ViewCount="242" Body="&lt;p&gt;We have a multi-server Craft setup, for redundancy and scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've been using an shared NFS drive to to host Craft's storage directory, by setting &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt; to a mounted &lt;code&gt;/craft-data/&lt;/code&gt; directory on each machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in &lt;code&gt;public/index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_STORAGE_PATH', '/craft-data/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One reason it was important to do this was to let Craft share sessions across machines, because they were stored on the filesystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, we transitioned from saving our sessions in the filesystem to saving them in redis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can, I'd like to abandon the NFS drive altogether and let each machine have its own &lt;code&gt;/craft-data/&lt;/code&gt; directory, since we no longer need to maintain this shared filesystem for session sharing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the contents of the craft &lt;code&gt;/runtime/&lt;/code&gt; directory, we see several subdirectories that seem like they could contain important shared state, such as &lt;code&gt;cache&lt;/code&gt; and &lt;code&gt;state&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;$ pwd &amp;amp;&amp;amp; ls -l&#xA;/craft-data/runtime&#xA;total 16&#xA;drwxrwxr-x   5 craft_user users   45 Jan 19 16:12 assets&#xA;drwxrwxr-x   2 craft_user users   49 Jan 26 09:34 cache&#xA;drwxrwxr-x 100 craft_user users 4096 Jan 26 09:37 compiled_templates&#xA;drwxr-xr-x   2 craft_user users   65 Jan 25 12:12 CSS&#xA;drwxr-xr-x   2 craft_user users   65 Jan 25 12:00 HTML&#xA;drwxrwxr-x   2 craft_user users 4096 Jan 19 16:12 logs&#xA;drwxrwxr-x   2 craft_user users 4096 Jan 26 08:52 sessions&#xA;drwxrwxr-x   2 craft_user users   22 Nov 16 14:55 state&#xA;drwxrwxr-x   2 craft_user users 4096 Jan 25 15:17 temp&#xA;drwxr-xr-x   2 craft_user users   65 Dec 14 11:27 URI&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do any of these directories need to be shared, in a multi-server setup? Is it safe for us to stop using a networked filesystem, for the &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5547" LastActivityDate="2017-01-26T19:31:17.627" Title="Do servers in a multi-server Craft setup need to share a storage directory?" Tags="&lt;config&gt;&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18689" PostTypeId="1" AcceptedAnswerId="18690" CreationDate="2017-01-26T17:10:48.977" Score="2" ViewCount="183" Body="&lt;p&gt;I'm looking to only return entries that were published in the last 90 days.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-01-26T17:10:48.977" Title="Limit the entries element API will return based on the post date" Tags="&lt;php&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18690" PostTypeId="2" ParentId="18689" CreationDate="2017-01-26T17:10:48.977" Score="2" Body="&lt;p&gt;Within the criteria for the endpoint, set &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'postDate' =&amp;gt; '&amp;gt;=' . date('Y-m-d', strtotime(&quot;-90 days&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you can adjust the date to suit your needs.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-01-26T17:10:48.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18691" PostTypeId="2" ParentId="4553" CreationDate="2017-01-26T18:22:28.743" Score="11" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/4554/689&quot;&gt;Brad's answer&lt;/a&gt; suggests, you can conditionally &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#enableCsrfProtection&quot; rel=&quot;noreferrer&quot;&gt;enable or disable CSRF production&lt;/a&gt; via the General Config, based on any criteria you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some use cases might be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;match a &lt;code&gt;SERVER['REQUEST_URI']&lt;/code&gt; string or substring, to open up a particular set of controllers or actions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;check the &lt;code&gt;$_SERVER['REMOTE_ADDR']&lt;/code&gt;, to allow token-less requests from a particular IP or IP range&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;validate 'safe' requests based on a key or encrypted timestamp from some &lt;code&gt;$_POST[]&lt;/code&gt; or &lt;code&gt;$_GET[]&lt;/code&gt; variable&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For cleanliness, I typically try to tuck the checking/validation logic away into its own &quot;handler&quot; class. Then, in the &lt;code&gt;general.php&lt;/code&gt;, I set the &lt;code&gt;enableCsrfProduction&lt;/code&gt; item based on the result of the check...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(In MyRequestHelper.php, something like...)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyRequestHelper&#xA;{&#xA;&#xA;    public static function isApiRequest()&#xA;    {&#xA;        $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);&#xA;        return strpos($path, 'actions/my-api') == 1;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(In craft/config/general.php, something like...)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require_once (..path/to/MyRequestHelper.php');&#xA;$isApiRequest = \Craft\MyRequestHelper::isApiRequest();&#xA;&#xA;return [&#xA;&#xA;    // ...other configs...&#xA;&#xA;    'enableCsrfProtection' =&amp;gt; !$isApiRequest,&#xA;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="689" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-26T18:22:28.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18692" PostTypeId="1" CreationDate="2017-01-26T18:55:37.310" Score="1" ViewCount="161" Body="&lt;p&gt;I'm trying to create a dynamic form that loops through all the form fields and dynamically applies the HTML that matches the field type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find what to use to output: Placeholder, Max Length, Line Breaks, Initial Rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other values like &lt;code&gt;field.type&lt;/code&gt;, &lt;code&gt;field.required&lt;/code&gt;, &lt;code&gt;field.handle&lt;/code&gt; work fine. But trying &lt;code&gt;field.placeholder&lt;/code&gt; or &lt;code&gt;field.settings.placeholder&lt;/code&gt; does not work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = tab.getFields() %}&#xA;&#xA;{% for field in fields %}&#xA;&#xA;    {% set required = field.required %}&#xA;    {% set field = field.getField() %}&#xA;&#xA;    {% if field.type == &quot;PlainText&quot; %}&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ field.handle }}]&quot; value=&quot;{{ attribute(submittedEntry, field.handle) }}&quot; placeholder=&quot;&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="107" LastActivityDate="2017-02-08T20:14:24.810" Title="Output Placeholder, Max Length, Line Breaks, Initial Rows values for Fields in Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18693" PostTypeId="2" ParentId="18684" CreationDate="2017-01-26T19:20:56.700" Score="1" Body="&lt;p&gt;You don't mention what errors you're getting, but if you leave username blank, it will be set to whatever the email address is by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Password for new user registration is a required field by default, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to alter this behavior, you'd have to write your own custom &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; and have your form post to your plugin's controller action that enforced whatever custom user registration business logic your needs require.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-26T19:20:56.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18694" PostTypeId="2" ParentId="18687" CreationDate="2017-01-26T19:31:17.627" Score="3" Body="&lt;p&gt;Personally, I'd &lt;a href=&quot;https://craftcms.stackexchange.com/a/4729/57&quot;&gt;lean towards&lt;/a&gt; keeping the shared NFS volume.  It's not just the runtime folder, but things like backups, site logos, user avatars, etc. and anything else plugins might be storing in storage that you'd want to consider as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-01-26T19:31:17.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18696" PostTypeId="1" AcceptedAnswerId="18708" CreationDate="2017-01-27T04:07:17.847" Score="2" ViewCount="33" Body="&lt;p&gt;I have an extended profile that users can purchase. When purchased, an entry is created, and tied back to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user can then log in and access the entry with the extended profile fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have a page that pulls every extended profile entry. This could be in the hundreds. I know Craft will limit the number it returns by default. I also know that I can pass &lt;code&gt;null&lt;/code&gt; into the limit. &lt;code&gt;limit(null)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That seems pretty risky and expensive to run. Is there a better solution? I only need the page title of each entry, so I don't need the entire entry model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a place to use elementAPI and make ajax call(s) to get all of the entries so I'm only returning the page titles?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-01-27T17:44:33.347" Title="How can I pull every entry (large number) in a section?" Tags="&lt;entries&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18697" PostTypeId="2" ParentId="18350" CreationDate="2017-01-27T09:12:50.077" Score="2" Body="&lt;p&gt;Not possible at the moment, Craft would need to add better support for custom element sorting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please submit the request here so we can track it: &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer will be updated if there is a change.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2018-03-29T00:01:13.760" LastActivityDate="2018-03-29T00:01:13.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18698" PostTypeId="1" AcceptedAnswerId="18699" CreationDate="2017-01-27T10:52:56.563" Score="1" ViewCount="517" Body="&lt;p&gt;Apologies if this has been asked before, I can only find questions dealing with the reverse scenario (i.e. replacing special characters with html entities)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to output special characters as part of a JavaScript array using Craft. Currently the values are output with all special characters replaced by their html equivalent. (e.g.: ampersands are replaced by &amp;amp;amp )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried restoring the special characters using craft replace but without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code works to replace text, but does not, for example, replace &amp;amp;amp with &amp;amp;, or rather perhaps it does not distinguish these values as distinct.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;&#xA;    var myVariable = [{% for value in myArray %}&quot;{{ value|replace('raw-html-entity', 'special-character') }}&quot;{%- if not loop.last -%},{% endif %}{% endfor %}];&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is being used for an array which is used for jQuery autocomplete values, so raw html is not appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6197" LastEditorUserId="57" LastEditDate="2017-01-27T18:17:27.033" LastActivityDate="2017-01-27T18:17:27.033" Title="How to replace a html entity within script tags using Craft replace" Tags="&lt;templating&gt;&lt;javascript&gt;&lt;array&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18699" PostTypeId="2" ParentId="18698" CreationDate="2017-01-27T12:16:45.870" Score="2" Body="&lt;p&gt;I have a &lt;a href=&quot;https://github.com/carlcs/craft-helpers&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Helpers&lt;/a&gt; plugin on GitHub, which has a &lt;code&gt;htmlEntityDecode&lt;/code&gt; Twig filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ value|htmlEntityDecode}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-01-27T17:42:40.153" LastActivityDate="2017-01-27T17:42:40.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18700" PostTypeId="1" AcceptedAnswerId="18707" CreationDate="2017-01-27T13:00:38.617" Score="1" ViewCount="99" Body="&lt;p&gt;I have lots of products and I want to filter them a certain way.&#xA;I want to retrieve all products that have stock = 1 or where product.myField = checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to do this exactly. This is what I have for now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for prod in craft.commerce.products({&#xA;    search: 'myField:0 or hasVariant:{hasStock:true}'   &#xA;}).type(myType).order(sort ~ ' ' ~ order).limit(35) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="91" LastEditDate="2017-03-14T03:56:32.220" LastActivityDate="2017-03-14T03:56:32.220" Title="Loading specific products" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18701" PostTypeId="1" AcceptedAnswerId="18706" CreationDate="2017-01-27T14:05:31.787" Score="1" ViewCount="1645" Body="&lt;p&gt;This seems random to me, as it was not a problem until today...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the template error &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt; with a reference to line&lt;code&gt;06&lt;/code&gt; below.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a template for social icons that I &lt;code&gt;include&lt;/code&gt; on each page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code template below is included in my site template.  It works on the index page, but it works no where else other than an actual entry (post) page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;https://twitter.com/intent/tweet?url={{ entry.url }}&quot; class=&quot;social-link&quot;&amp;gt; &amp;lt;i class=&quot;fa fa-twitter&quot;&amp;gt;&amp;lt;/i&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2017-01-27T20:49:36.420" LastActivityDate="2017-01-29T00:58:40.507" Title="Why am I getting &quot;Variable &quot;entry&quot; does not exist&quot;" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18702" PostTypeId="1" CreationDate="2017-01-27T15:03:57.770" Score="1" ViewCount="107" Body="&lt;p&gt;I upgraded a website from a single to multi-locale site and found out that the images (generated with the Imager plug-in) won't load in the new locale; I get a 404 for every image that the browser tries to load. However, the images do load in the new locale when the entry has been loaded in the original locale first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that Imager only generates the images when they're requested in the websites original locale; does anyone have an idea how to solve this? Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="6198" LastActivityDate="2017-02-01T14:11:54.430" Title="Imager plugin doesn't generate images in multi-language website" Tags="&lt;localization&gt;&lt;plugin-imager&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18703" PostTypeId="2" ParentId="18702" CreationDate="2017-01-27T15:19:46.607" Score="1" Body="&lt;p&gt;You might get more help creating an issue on the plugin Author's GitHub Repo here: &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-01-27T15:19:46.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18704" PostTypeId="1" AcceptedAnswerId="18705" CreationDate="2017-01-27T15:27:35.027" Score="1" ViewCount="685" Body="&lt;p&gt;I would like to know, how many values are saved in the table field called &quot;artikelnummer&quot; with the field name &quot;artikel&quot;. The section is called &quot;bikes&quot;. I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('bikes') %}&#xA;&#xA;{% for entry in entries %}&#xA;  {% for row in entry.artikelnummer %}&#xA;    {{ row.artikel|length }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2017-01-27T23:25:35.713" Title="Count table field values in certain section" Tags="&lt;sections&gt;&lt;table-field&gt;&lt;count&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18705" PostTypeId="2" ParentId="18704" CreationDate="2017-01-27T16:09:30.953" Score="2" Body="&lt;p&gt;You can get the total amount of rows like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalcount = 0 %}&#xA;{% for entry in entries %}&#xA;    {% set totalcount = totalcount + entry.artikelnummer|length %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the loop you add the length to the totalCount.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2017-01-27T23:25:35.713" LastActivityDate="2017-01-27T23:25:35.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18706" PostTypeId="2" ParentId="18701" CreationDate="2017-01-27T16:37:41.263" Score="1" Body="&lt;p&gt;You can provide some fallbacks for pages that don't have en entry like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{entry.title|default('here is your fallback')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do this multiple times, chaining fallbacks. Inside the fallback you can provide a global or maybe set a page at the top of your template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryFallback = craft.entries.id(1).first() %}&#xA;{{entryFallback.title}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific case where you just want to return the url from the page you are on to create a twitter share button, you can just get the current Url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;https://twitter.com/intent/tweet?url={{craft.request.url}}&quot; class=&quot;social-link&quot;&amp;gt; &amp;lt;i class=&quot;fa fa-twitter&quot;&amp;gt;&amp;lt;/i&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2017-01-29T00:58:40.507" LastActivityDate="2017-01-29T00:58:40.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18707" PostTypeId="2" ParentId="18700" CreationDate="2017-01-27T16:47:34.120" Score="2" Body="&lt;p&gt;I haven't tried Commerce myself but I think something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.type(yourType) %}&#xA;&#xA;//make an empty array&#xA;{% set filteredProducts = [] %}&#xA;&#xA;{% for entry in products %}&#xA;    //check for your conditions&#xA;    {% if (entry.checkboxFieldhandle) or (entry.hasStock) %}&#xA;        //add each entry to your products array&#xA;        {% set filteredProducts = filteredProducts|merge([entry]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2017-01-27T23:24:42.790" LastActivityDate="2017-01-27T23:24:42.790" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18708" PostTypeId="2" ParentId="18696" CreationDate="2017-01-27T17:44:33.347" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% paginate %}&lt;/code&gt;&lt;/a&gt; tag with ajax to limit the number of entries that are pulled at a time.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-01-27T17:44:33.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18709" PostTypeId="1" AcceptedAnswerId="18733" CreationDate="2017-01-27T17:49:42.927" Score="3" ViewCount="87" Body="&lt;p&gt;I’m trying to use Craft Commerce with the Digital Products plugin for a site where users can pay for being listed on that site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I need to query for all users with certain criterias plus a valid license.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m not sure how to tackle this. I tried something like this, but it doesn’t work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for user in craft.users({&#xA;    group: 'profiles',&#xA;    relatedTo: craft.digitalProducts.products({type: 'access'})&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to list all licenses, collect the related users and then list them. But that doesn’t seem like a good idea either, in terms of performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint is much appreciated. &lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-01-30T10:25:55.987" Title="How do I query for all users that bought a license?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18710" PostTypeId="1" CreationDate="2017-01-27T18:38:01.723" Score="1" ViewCount="145" Body="&lt;p&gt;I want to render a (non-CP) template from an action method in my plugin controller over a route I defined in the plugin base class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function registerSiteRoutes() {&#xA;  return array(&#xA;    'myservice' =&amp;gt; array('action' =&amp;gt; 'pluginhandle/controller/method')&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The action itself basically just sets some things up and renders the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMethod()&#xA;{&#xA;    // irrelevant code here...&#xA;&#xA;    $variables = array('info' =&amp;gt; 'success');&#xA;    $this-&amp;gt;renderTemplate('pluginhandle/template', $variables);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when trying to access the rendered template via it's routed url '/myservice', an error message is shown telling &lt;em&gt;the template can't be found&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strangely, it seems to work if I use the &lt;strong&gt;full action url&lt;/strong&gt; &lt;code&gt;actions/pluginhandle/controller/method&lt;/code&gt; instead. But, I want to have &lt;em&gt;nice&lt;/em&gt; URLs if I can have them, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried it using &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render('pluginhandle/template')&lt;/code&gt; and &lt;code&gt;$this-&amp;gt;renderPluginTemplate('pluginhandle/template')&lt;/code&gt; even temporarily setting a new templates path but none of them seems to change that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please help me out?&lt;/p&gt;&#xA;" OwnerUserId="6062" LastEditorUserId="6062" LastEditDate="2017-01-30T00:43:50.230" LastActivityDate="2017-01-30T01:13:08.947" Title="No template found when accessing action method per route" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;url&gt;&lt;routing&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18711" PostTypeId="1" CreationDate="2017-01-27T20:09:14.960" Score="1" ViewCount="500" Body="&lt;p&gt;Noticing these errors a lot it my logs. Any idea why, or how to stop it from happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Jan 27 15:02:58 myapp.com ool: myapp: [craft] [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'b790ee3c633c1693d2140bfae35b65fe' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO craft_cache (id,expire,value) VALUES ('b790ee3c633c1693d2140bfae35b65fe',1485633775,:value).&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update - also seeing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Jan 27 15:49:58 myapp.com ool: myapp: [craft] [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction. The SQL statement executed was: DELETE FROM craft_cache WHERE expire&amp;gt;0 AND expire&amp;lt;1485550196.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm not using any template level caching (site is Varnished)&lt;/li&gt;&#xA;&lt;li&gt;My &lt;code&gt;cacheMethod&lt;/code&gt; is 'db'&lt;/li&gt;&#xA;&lt;li&gt;Load balanced setup (1 LB, 2 web heads, 1 LB, 1 DB)&lt;/li&gt;&#xA;&lt;li&gt;Looking up the key in the latter example, it is a serialized object of &lt;code&gt;Craft\SearchPlus_AlgoliaMapModel&lt;/code&gt; (plugin). However, looking at the SearchPlus code I'm pretty it the plugin itself isn't storing this. It has one call to &lt;code&gt;craft()-&amp;gt;cache-&amp;gt;set&lt;/code&gt; and it just stores a string.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2017-01-30T15:58:14.437" LastActivityDate="2017-01-30T15:58:14.437" Title="craft_cache / Integrity constraint violation: 1062 Duplicate entry, Serialization failure: 1213 Deadlock" Tags="&lt;cache&gt;&lt;error-message&gt;&lt;logs&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18712" PostTypeId="1" AcceptedAnswerId="18713" CreationDate="2017-01-27T21:18:16.707" Score="1" ViewCount="679" Body="&lt;p&gt;I'm running a query in which I need to join two tables &lt;strong&gt;table_views&lt;/strong&gt; and &lt;strong&gt;table_clicks&lt;/strong&gt;. Both tables share several column names (mainly refId, month, year and total).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I try and join these tables together, instead of returning ~18 or 20 rows/records. It repeats the join for every single row, producing 360 records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I query and combine both tables by their reference Id?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $records = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('*')&#xA;        -&amp;gt;from('table_views table_views')&#xA;        -&amp;gt;leftJoin('table_clicks table_clicks', 'table_views.refId=table_clicks.refId')&#xA;        -&amp;gt;where('table_views.refId = :refId', array(':refId' =&amp;gt; $id))&#xA;        -&amp;gt;query();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="67" LastActivityDate="2017-01-27T21:30:15.353" Title="Joining two plugin tables by reference Id causes duplicates" Tags="&lt;plugin-development&gt;&lt;yii&gt;&lt;join&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18713" PostTypeId="2" ParentId="18712" CreationDate="2017-01-27T21:20:32.513" Score="3" Body="&lt;p&gt;You're probably looking for an &lt;code&gt;inner join&lt;/code&gt; (which Yii just calls a &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#join()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;join&lt;/a&gt;)instead of a &lt;code&gt;leftJoin&lt;/code&gt;: &lt;a href=&quot;https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-01-27T21:30:15.353" LastActivityDate="2017-01-27T21:30:15.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18715" PostTypeId="1" CreationDate="2017-01-28T12:52:03.063" Score="2" ViewCount="94" Body="&lt;p&gt;I am new to  Craft CMS and am testing it. I encountered a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a matrix field, containing an asset field. When I add this matrix field to the page field layout, then visit single entry, put something inside this asset field of the matrix field and save - things break, I can't access this entry in backend later, all that shows is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nAA0o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nAA0o.png&quot; alt=&quot;blank page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have local assets source set up, and images do upload there, I can see them in assets explorer later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I just fill in other fields of matrix field, omitting asset field or don't use matrix field at all, things are ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I work on Windows, on XAMPP server.&lt;/p&gt;&#xA;" OwnerUserId="5887" LastEditorUserId="340" LastEditDate="2017-06-02T06:41:02.100" LastActivityDate="2017-06-02T06:41:02.100" Title="Matrix field containing asset field blocks entry editing" Tags="&lt;matrix&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18716" PostTypeId="2" ParentId="18715" CreationDate="2017-01-28T13:19:57.913" Score="2" Body="&lt;p&gt;Well, i found an answer. It seems it was caused by xdebug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/3076/all-fields-disappearing-except-title-after-saving&quot;&gt;All fields disappearing except &amp;#39;Title&amp;#39; after saving&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding this to php.ini helped:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xdebug.max_nesting_level=200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5887" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-28T13:19:57.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18717" PostTypeId="1" AcceptedAnswerId="18718" CreationDate="2017-01-28T14:01:55.513" Score="1" ViewCount="131" Body="&lt;p&gt;I'm trying to add some custom routes for my plugin, but it's throwing a 400 CHttpException for &lt;code&gt;invalidActionParams&lt;/code&gt; when accessing &lt;code&gt;largeupload/folders/2&lt;/code&gt; as an example.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function registerCpRoutes ()&#xA;{&#xA;return array(&#xA;    'largeupload'                           =&amp;gt; array( 'action' =&amp;gt; 'largeUpload/index' ),&#xA;    'largeupload/folders'                   =&amp;gt; array( 'action' =&amp;gt; 'largeUpload/folder/index' ),&#xA;    'largeupload/folders/new'               =&amp;gt; array( 'action' =&amp;gt; 'largeUpload/folder/edit' ),&#xA;    'largeupload/folders/(?P&amp;lt;folderId&amp;gt;\d+)' =&amp;gt; array( 'action' =&amp;gt; 'largeUpload/folder/edit' ),&#xA;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My controller is called &lt;code&gt;LargeUpload_Folder&lt;/code&gt;, and my action &lt;code&gt;actionEdit()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionEdit ($variables = [ ])&#xA;{&#xA;    /* Simplified */&#xA;    if ( isset($variables['folderId']) ) {&#xA;    }&#xA;    else {&#xA;    }&#xA;&#xA;    $this-&amp;gt;renderTemplate('largeupload/LargeUpload_Edit', [&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove &lt;code&gt;$variables = [ ]&lt;/code&gt; from the action parameters, it doesn't return an error anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2017-01-28T14:19:38.133" LastActivityDate="2017-01-28T20:09:07.260" Title="Trouble with registerCpRoutes()" Tags="&lt;plugin-development&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18718" PostTypeId="2" ParentId="18717" CreationDate="2017-01-28T14:26:34.530" Score="2" Body="&lt;p&gt;I believe this is caused by not including &lt;code&gt;array&lt;/code&gt; in the function parameter, preceding the variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing to &lt;code&gt;public function actionEdit (array $variables = [ ])&lt;/code&gt; should do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a bonus - can anyone explain why? Seems like the $variables variable needs to be cast as an array?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-01-28T14:26:34.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18720" PostTypeId="2" ParentId="18717" CreationDate="2017-01-28T20:09:07.260" Score="2" Body="&lt;p&gt;Another option is to retrieve the route variables inside your controller action and not pass anything into the function as a parameter :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionEdit() &#xA;{&#xA;    $routeParams = craft()-&amp;gt;urlManager-&amp;gt;getRouteParams();&#xA;    $folderId = $routeParams['variables']['folderId'];&#xA;&#xA;    //Do stuff with $folderId&#xA;&#xA;    $this-&amp;gt;renderTemplate('largeupload/LargeUpload_Edit', []);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2017-01-28T20:09:07.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18721" PostTypeId="1" AcceptedAnswerId="18737" CreationDate="2017-01-28T21:31:38.243" Score="2" ViewCount="1044" Body="&lt;p&gt;I have a bit complex filtering system that I try to replicate using Element API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have this which works to a degree:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Example url: training.json?reg=124&amp;amp;cat=99&amp;amp;prod=129&amp;amp;erp=&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'resources',&#xA;            'search' =&amp;gt; (craft()-&amp;gt;request-&amp;gt;getParam('q') ? craft()-&amp;gt;request-&amp;gt;getParam('q').&quot;*&quot; : ''),&#xA;            'relatedTo' =&amp;gt; [&#xA;                'and', &#xA;                craft()-&amp;gt;request-&amp;gt;getParam('reg'),&#xA;                (craft()-&amp;gt;request-&amp;gt;getParam('cat') ? craft()-&amp;gt;request-&amp;gt;getParam('cat') : craft()-&amp;gt;request-&amp;gt;getParam('reg')),&#xA;                (craft()-&amp;gt;request-&amp;gt;getParam('prod') ? craft()-&amp;gt;request-&amp;gt;getParam('prod') : craft()-&amp;gt;request-&amp;gt;getParam('reg')),&#xA;                (craft()-&amp;gt;request-&amp;gt;getParam('erp') ? craft()-&amp;gt;request-&amp;gt;getParam('erp') : craft()-&amp;gt;request-&amp;gt;getParam('reg')),&#xA;            ],&#xA;  ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First of all, I don't know how to deal with optional parameters, I've solved this by re-using the only required parameter - &lt;strong&gt;reg&lt;/strong&gt;. It works, but it's not nice, any help here would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real issue though is that I need the &lt;strong&gt;reg&lt;/strong&gt; parameter to be an array with all the elements in the array having OR operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Example url: training.json?reg[]=124&amp;amp;reg=[]=123&amp;amp;cat=99&amp;amp;prod=129&amp;amp;erp=&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(reg[0] OR reg[1]) AND cat AND prod AND erp&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can achieve this in element API? I've tried something in the lines of the following, but with no luck.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'relatedTo' =&amp;gt; [&#xA;     'and', &#xA;      ['targetRegions' =&amp;gt; ['or', 124, 99]], &#xA;      105, &#xA;      231,&#xA; ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2017-01-30T14:38:00.243" LastActivityDate="2017-01-30T16:20:58.307" Title="Mixed relation criteria operator in Element API" Tags="&lt;relations&gt;&lt;plugin-elementapi&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18722" PostTypeId="1" AcceptedAnswerId="18958" CreationDate="2017-01-28T22:12:39.963" Score="1" ViewCount="481" Body="&lt;p&gt;It seems that when calling a CSS or JS file include, if the path contains {{ siteUrl }} it outputs {{ siteUrl }} in the html that is generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so;&#xA;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ siteUrl }}css/styles.css&quot;/&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which should be (for example);&#xA;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://site.url/dev/css/styles.css&quot;/&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2017-02-13T15:37:31.553" Title="includeCssFile and includeJsFile doesn't output {{ siteUrl }}" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18723" PostTypeId="1" CreationDate="2017-01-29T01:50:28.567" Score="1" ViewCount="60" Body="&lt;p&gt;I am grouping entries that have the same date together so that I only get a single date. Works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to loop through each entry that has that date and I'm not having much luck. I want to show &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for date, attempt in attempts|group('attemptDate') %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ date|date('M j, Y') }}&amp;lt;/td&amp;gt;&#xA;        {% if type == 'My Type' %}&#xA;            {# Get all entries where type = My Type &amp;amp; entry.attemptDate = date. #}&#xA;            {% set total = 0 %}&#xA;            {% count = 0 %}&#xA;            {% for ?? in ?? %} {# &#xA;                {% total = loop.index %}&#xA;                {% count = {# if value in myField is true #} %}&#xA;                &amp;lt;td&amp;gt;{{ count }}/{{ total }}&amp;lt;/td&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-03-03T01:26:53.853" Title="How can I use a where statement with grouped results?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18724" PostTypeId="2" ParentId="18646" CreationDate="2017-01-29T13:25:41.860" Score="0" Body="&lt;p&gt;Found out that entry can be accessed with &lt;code&gt;$this-&amp;gt;element-&amp;gt;owner&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-01-29T13:25:41.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18725" PostTypeId="2" ParentId="18723" CreationDate="2017-01-29T14:28:32.957" Score="1" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for date, attempt in attempts|group('attemptDate') %}&#xA;    &amp;lt;tr&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ date|date('M j, Y') }}&amp;lt;/td&amp;gt;&#xA;      {% for entry in attempt %}&#xA;        {% if entry.type == 'My Type' %}&#xA;          &amp;lt;td&amp;gt;{{ entry.title }}&amp;lt;/td&amp;gt;&#xA;        {% endif %}&#xA;      {% endfor %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know what you want to do with the 'type' of the entries?&#xA;But if you want to limit the amount of entries according to type, you could fill &quot;attempts&quot; with all entries of a certain type first and then loop through them. Than you could remove the if statement which would be cleaner and faster I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set attempts = craft.entries.section(&quot;something&quot;).type(&quot;My Type&quot;).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-01-29T14:35:11.823" LastActivityDate="2017-01-29T14:35:11.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18726" PostTypeId="2" ParentId="18446" CreationDate="2017-01-29T15:52:35.540" Score="1" Body="&lt;p&gt;Allright, after a lot of digging into my code I finally found out what went wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used this code to clear the placeholder in my input when clicking inside them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;.some-class input&quot;).val(&quot;&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But .&lt;code&gt;some-class&lt;/code&gt; was the parent class of my form, which means I probably erased all values of hidden fields that Craft adds on runtime too. Fields such as &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;CRAFT_CSRF_TOKEN&quot; value=&quot;&quot;&amp;gt;&lt;/code&gt; on which I also got an error. Still don't know about the &quot;code param&quot; but probably it was added somewhere later on runtime too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I made the selector a bit more specific, so it only selects all input elements that can be edited on the front-end, it works!&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-01-29T15:52:35.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18727" PostTypeId="1" AcceptedAnswerId="18728" CreationDate="2017-01-29T17:22:37.133" Score="3" ViewCount="1508" Body="&lt;p&gt;I am having trouble getting a freeform success message to display. I am posting back to the same template. What is the proper way to check if the form was posted? I see in the freeform render template there is a freeform.hasErrors, is there something for success perhaps?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% if craft.request.getPost('firstName')|length %}&#xA;&#xA;                &amp;lt;div class=&quot;callout success&quot;&amp;gt;Your message has been sent.&amp;lt;/div&amp;gt;&#xA;&#xA;            {% else %}&#xA;&#xA;                {{ craft.freeform.form(&quot;contactForm&quot;, {&#xA;                        formAttributes: { &quot;data-abide&quot;: true }, &#xA;                        instructionsBelowField: true, &#xA;                        submitClass: &quot;button&quot;, &#xA;                        returnUrl: &quot;/contact&quot;, &#xA;                        useRequiredAttribute: true&#xA;                    }&#xA;                ).render() }}&#xA;&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://solspace.com/craft/freeform/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Working code using query param instead. Thanks @Jan_dh.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% if craft.request.getQuery('success') == 1 %}&#xA;&#xA;                &amp;lt;div class=&quot;callout success&quot;&amp;gt;Your message has been sent.&amp;lt;/div&amp;gt;&#xA;&#xA;            {% endif %}&#xA;&#xA;            {{ craft.freeform.form(&quot;contactForm&quot;, {&#xA;                    formAttributes: { &quot;data-abide&quot;: true }, &#xA;                    instructionsBelowField: true, &#xA;                    submitClass: &quot;button&quot;, &#xA;                    returnUrl: &quot;/contact?success=1&quot;, &#xA;                    useRequiredAttribute: true&#xA;                }&#xA;            ).render() }}&#xA;&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="3362" LastEditDate="2017-01-29T19:24:55.003" LastActivityDate="2019-11-25T14:42:15.187" Title="Freeform Success Notice in Template" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18728" PostTypeId="2" ParentId="18727" CreationDate="2017-01-29T18:54:08.997" Score="5" Body="&lt;p&gt;You can add a param to your &lt;code&gt;returnUrl&lt;/code&gt; in the form composer then check the template for the param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You redirect to &lt;code&gt;/contact?success&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set successParam = craft.request.getParam('success') %}&#xA;{% if successParam is not null %} &#xA;  &amp;lt;p&amp;gt;Hooray! Success!!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option is to Ajax submit your form and just have a modal or something on a succes submit. An example of an Ajax submit can be found in the official freeform docs &lt;a href=&quot;https://solspace.com/craft/freeform/docs/ajax-forms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5845" LastEditDate="2019-11-25T14:42:15.187" LastActivityDate="2019-11-25T14:42:15.187" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="18730" PostTypeId="2" ParentId="18710" CreationDate="2017-01-30T01:13:08.947" Score="1" Body="&lt;p&gt;I ended up using Jon's function renderPluginTemplate I found at &lt;a href=&quot;https://craftcms.stackexchange.com/a/7132/6062&quot;&gt;https://craftcms.stackexchange.com/a/7132/6062&lt;/a&gt; which basically implements what's written here: &lt;a href=&quot;https://craftcms.com/docs/plugins/templates#plugin-template-paths-explained&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/templates#plugin-template-paths-explained&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder why there is no easier function included into craft by default.&lt;/p&gt;&#xA;" OwnerUserId="6062" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-01-30T01:13:08.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18731" PostTypeId="2" ParentId="18709" CreationDate="2017-01-30T07:25:59.287" Score="4" Body="&lt;p&gt;I don't think it's currently possible in as clean as manner as you'd like. I'd tackle the problem by writing a small plugin that queries the database and returns a list of user ids that match the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember, though, is that a license does not necessarily have a user id attached to it - a license must have either a user id or an email assigned to, so you might want to keep that in mind.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-01-30T07:25:59.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18732" PostTypeId="1" AcceptedAnswerId="18749" CreationDate="2017-01-30T08:00:13.797" Score="1" ViewCount="282" Body="&lt;p&gt;I already learned how to create a task from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14530/tasks-and-steps&quot;&gt;this page&lt;/a&gt; but I would like to know how to run this task?&#xA;I'm creating a portal where users are allowed to give their votes and discuss several projects. Backend users can create different phases and declare a start and an end date and a few days before these phases end all members/participants of this phase should receive an email.&lt;/p&gt;&#xA;&lt;p&gt;I know how to send the mail, I know how to create the task but I don't know how to start the task 1, 3 and 7 days before a specific date.&lt;/p&gt;&#xA;&lt;p&gt;Do those steps run every single second?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function runStep($step)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;    $criteria-&amp;gt;group = 'phase';&#xA;    if($criteria-&amp;gt;count()){&#xA;        $phases =  $criteria-&amp;gt;find();&#xA;        foreach ($phases as $phase){&#xA;            $now = time();&#xA;            $threeDaysBefore = $now - (60 * 60 * 24 * 3); //Seconds * Minutes * Hours * Days&#xA;            $OneDaysBefore   = $now - (60 * 60 * 24 * 1); //Seconds * Minutes * Hours * Days&#xA;            $endTime = $phase-&amp;gt;phaseEndDate-&amp;gt;getTimestamp();&#xA;            if($endTime == $OneDaysBefore || $endTime == $threeDaysBefore){&#xA;                 craft()-&amp;gt;myplugin-&amp;gt;sendMailToUser();&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where do I activate the task? Do I run &lt;code&gt;craft()-&amp;gt;tasks-&amp;gt;createTask(/*parameter*/)&lt;/code&gt; in my plugin init() function?&lt;/p&gt;&#xA;&lt;p&gt;And my last question: how can I debug my function? In my chrome network tap I receive a taskInfo every second but I can't &lt;code&gt;var_dump()&lt;/code&gt; something from my &lt;code&gt;runstep&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-01-31T04:54:03.653" Title="Craft task send mails at specific date" Tags="&lt;plugin-development&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18733" PostTypeId="2" ParentId="18709" CreationDate="2017-01-30T10:25:55.987" Score="2" Body="&lt;p&gt;Just realized that there is another way. No need for a custom plugin and shouldn’t be too heavy on the performance side of things.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Query for licenses, eager-load owner #}&#xA;{% set licenses = craft.digitalProducts.licenses.with(['owner']) %}&#xA;&#xA;{# Collect owner ids #}&#xA;{% set licensedUserIds = [] %}&#xA;&#xA;{% if licenses %}&#xA;    {% for license in licenses if license.userId %}&#xA;        {% set licensedUserIds = licensedUserIds|merge([license.userId]) %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{# Query for licensed users #}&#xA;{% set licensedUsers = craft.users({&#xA;    group: 'profiles',&#xA;    id: licensedUserIds&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-01-30T10:25:55.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18734" PostTypeId="1" CreationDate="2017-01-30T11:09:18.973" Score="1" ViewCount="39" Body="&lt;p&gt;I create a code for TV show database, but I have a big problem.&#xA;Please see the image&#xA;I want to access one entry(post) with some data from some templates.&#xA;But I don't know how to create any code or settings in the sections area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice or give me the url if there is another topic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;image&#xA;&lt;a href=&quot;https://i.stack.imgur.com/oKNtu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oKNtu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5003" LastEditorUserId="5003" LastEditDate="2017-02-06T12:16:46.437" LastActivityDate="2017-02-08T14:59:32.517" Title="How to make a code/settings for accessing the one database from 2 different html files with {slug}" Tags="&lt;url&gt;&lt;sections&gt;&lt;slug&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18735" PostTypeId="1" AcceptedAnswerId="18750" CreationDate="2017-01-30T11:11:17.697" Score="1" ViewCount="250" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft CMS Pricing FAQ&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/pricing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/pricing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FAQ mentions discounts when cost is an issue, presumably non-profit sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But… is there a discount for bulk purchasing? Example. 10, 50, 100 licenses?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see an 'official' tier for multiple purchase, is it best to ask?&lt;/p&gt;&#xA;" OwnerUserId="1069" LastActivityDate="2017-01-31T04:59:24.607" Title="Bulk / Multiple License purchase" Tags="&lt;license&gt;&lt;pricing&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18736" PostTypeId="1" AcceptedAnswerId="18739" CreationDate="2017-01-30T14:27:13.143" Score="1" ViewCount="355" Body="&lt;p&gt;In the webshop we're building we're outputting the price like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cart.itemSubtotal|commerceCurrency(cart.paymentCurrency, convert=true) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which displays for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;€1,680.00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We will be using multiple currencies in the webshop. Is it possible to set the thousands/decimals signs? Or does the CMS take these settings from the locale? We can't find the settings for this anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2017-01-30T15:11:08.990" Title="Price formatting thousands/decimal signs" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18737" PostTypeId="2" ParentId="18721" CreationDate="2017-01-30T14:43:57.560" Score="2" Body="&lt;p&gt;Something like this should work to combine &lt;code&gt;'and'&lt;/code&gt; and &lt;code&gt;'or'&lt;/code&gt; conditions.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'relatedTo' =&amp;gt; [&#xA;    'and',&#xA;    ['element' =&amp;gt; [124, 99]],&#xA;    ['element' =&amp;gt; 105],&#xA;    ['element' =&amp;gt; 231],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the pattern I’m usually using to build the &lt;code&gt;relatedTo&lt;/code&gt; param dynamically. I also try to be explicit about the direction (&lt;code&gt;sourceElement&lt;/code&gt; / &lt;code&gt;targetElement&lt;/code&gt;) and the relation’s field.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$query = craft()-&amp;gt;request-&amp;gt;getQuery();&#xA;&#xA;$relatedToParam = ['and'];&#xA;&#xA;if ($query['reg']) {&#xA;    $relatedToParam[] = [&#xA;        'targetElement' =&amp;gt; $query['reg'],&#xA;        'field' =&amp;gt; 'myRegFieldHandle',&#xA;    ];&#xA;}&#xA;&#xA;// repeat for all our other relatedTo conditions&#xA;&#xA;$relatedToParam = count($relatedToParam) &amp;gt; 1 ? $relatedToParam : null,&#xA;&#xA;return [&#xA;    'criteria' =&amp;gt; [&#xA;        'section' =&amp;gt; 'resources',&#xA;        'relatedTo' =&amp;gt; $relatedToParam,&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-01-30T16:20:58.307" LastActivityDate="2017-01-30T16:20:58.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18738" PostTypeId="1" CreationDate="2017-01-30T15:04:08.497" Score="1" ViewCount="1294" Body="&lt;p&gt;I have completed a website for a school who can't upload files when in school.&#xA;When they upload a file the status bar loads the full way across the screen but at the top right it just keeps spinning. Nothing more happens - the files doesn't become available.&#xA;I can upload fine from home and the staff can upload fine at home as well.&#xA;What is the likely cause of this issue - I have log files to check if need be - I deleted the log files then asked them to try and upload a file - then I took a copy of the log files with Dev Mode on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this likely to be a Firewall Issue in the school? I did a website for another local school who would have the same IT provider but have no issues there.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2019-04-19T19:52:35.317" Title="Issue uploading files" Tags="&lt;assets&gt;&lt;upload&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18739" PostTypeId="2" ParentId="18736" CreationDate="2017-01-30T15:11:08.990" Score="3" Body="&lt;p&gt;The thousands/decimals signs are based on the current users locale and can not be configure at the moment. The number is formatted based on the currency and locale. You would need to make your own currency formatter as a twig extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set &lt;code&gt;format=false&lt;/code&gt; in the craftCommerce filter, then pass the value to your own number formatter filter.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-01-30T15:11:08.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18740" PostTypeId="1" CreationDate="2017-01-30T16:03:43.957" Score="1" ViewCount="727" Body="&lt;p&gt;I'm coming from a WordPress background and use Pantheon for all my client websites. I love the service they provide, especially easy migrations and multi-environments (Multi-dev feature branches, Dev, Test, Live) they provide out of the box. It helps a small company off load all the dev ops work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also love Craft CMS, and would like to start using it more, but are struggling to find a host that provides the same/similar amount of features and support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked out &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9400/recommended-hosting-company-for-a-craft-site&quot;&gt;Recommended hosting company for a Craft site?&lt;/a&gt; but none of the recommendations include features that I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the main features I'm looking for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dev, Test, &amp;amp; Live&lt;/strong&gt;&#xA;- Run a continuous integration workflow out of the box. Every site you create includes a Dev, Test, and Live environment connected by version control. Each has its own database, file system connection, and URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/negUa.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/negUa.gif&quot; alt=&quot;Pantheon Dev&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cloud development environments&lt;/strong&gt;&#xA;- Multidev allows you to fork your entire stack (code and content), work independently, then merge changes back into the master. Each branch is an entire development environment with the same configuration as the live site. Spin up cloud environments for feature branching, per-dev sandboxes, QA environments, and more. Multidev makes it easy to manage your development workflow and keep your team’s work in sync.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TbaF1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TbaF1.png&quot; alt=&quot;envs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2020-05-12T12:58:12.823" Title="Pantheon hosting alternative for Craft CMS" Tags="&lt;hosting&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18742" PostTypeId="1" CreationDate="2017-01-30T18:49:02.517" Score="1" ViewCount="319" Body="&lt;p&gt;I need a little bit of assitance. I have a matrix block that outputs floorplans diagrams and it's specification per floor in a property (see screenshot attached below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the matrix fields outputting correctly on the page, but I need to get it to only output a single floor at a time, and not all floors, and then let the user click on a select dropdown to change to the floor level that they want to view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the current markup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can help to get it working?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form&quot; action=&quot;{{ entry.url }}&quot; method=&quot;get&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;      &amp;lt;select id=&quot;development1&quot; class=&quot;form-control&quot; name=&quot;floor&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;Select Floor&amp;lt;/option&amp;gt;&#xA;        {% for block in entry.floorplans %}&#xA;        &amp;lt;option value=&quot;{{ block.floorplanlevel }}&quot;&amp;gt;{{ block.floorplanlevel.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&#xA;{# Start Matrix Block #}&#xA;{% for block in entry.floorplans %} {# Main Field Handle #}&#xA;{% switch block.type %}&#xA;&#xA;{% case &quot;floorplan&quot; %} {# Matrix Block Type Handle #}&#xA;......&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S5QJ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S5QJ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-02-07T15:37:27.280" Title="Select dropdown linking to Matrix blocks" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18743" PostTypeId="1" AcceptedAnswerId="18751" CreationDate="2017-01-30T19:03:58.123" Score="2" ViewCount="534" Body="&lt;p&gt;How should I retrieve a purchasable element criteria in Craft Commerce ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get entries, I just do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried the following without any success to get purchasables&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Purchasable);&#xA;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Purchasables);&#xA;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:28:02.127" LastActivityDate="2017-05-09T20:28:02.127" Title="Fetch Craft Commerce purchasable element type" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18745" PostTypeId="1" AcceptedAnswerId="18769" CreationDate="2017-01-30T22:13:41.143" Score="1" ViewCount="222" Body="&lt;p&gt;everybody!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;setRouteVariables()&lt;/code&gt; doesn't appear to be working for me.  If I boil my controller function down to just this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSubmitForm() {&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables([&#xA;        'foo' =&amp;gt; 'bar'&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my &lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&lt;/code&gt; contains the following (among other inputs):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;directoryForms/submitForm&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it hits the correct endpoint and then reloads the appropriate template, but it doesn't give me access to the &lt;code&gt;{{ foo }}&lt;/code&gt; variable in that template.  It just tells me &lt;code&gt;Variable &quot;foo&quot; does not exist&lt;/code&gt;.  I know it's hitting the right controller endpoint because if I &lt;code&gt;die()&lt;/code&gt; there it dies as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?  I've really boiled this one down as far as I can.  I must be missing something obvious.  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5684" LastActivityDate="2017-01-31T19:22:28.653" Title="craft()-&gt;urlManager-&gt;setRouteVariables() loads the correct template but does not pass in the variables" Tags="&lt;templating&gt;&lt;routes&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18746" PostTypeId="1" CreationDate="2017-01-30T22:35:38.413" Score="0" ViewCount="131" Body="&lt;p&gt;is there are anything to do to delete index.php from output html? This is not very &quot;clear&quot;... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case its channel array and I call {{entry.url}}...&#xA;Any idea how could be this fixed / avoid?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Big TNX for any idea!&lt;/p&gt;&#xA;" OwnerUserId="6168" LastEditorUserId="22" LastEditDate="2017-05-09T20:27:35.320" LastActivityDate="2017-05-09T20:27:35.320" Title="index.php in output HTML - channel pages" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="3" ClosedDate="2017-02-14T08:29:14.217" ContentLicense="CC BY-SA 3.0" />
  <row Id="18748" PostTypeId="1" CreationDate="2017-01-31T02:59:14.483" Score="1" ViewCount="539" Body="&lt;p&gt;I created a plugin to schedule some custom email notifications. The action URL is working perfectly on localhost but isn't working on stagings server. Is it related to any server stuff.&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2017-01-31T05:23:03.410" Title="Plugin's action URL not working and showing 404 error" Tags="&lt;plugin-development&gt;&lt;controller&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18749" PostTypeId="2" ParentId="18732" CreationDate="2017-01-31T04:54:03.653" Score="3" Body="&lt;p&gt;Might I suggest that a Craft task might not be the best way to pull off what you're trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, they will be triggered by the next control panel request, no matter when that occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure you could build in some timing logic in your plugin, or set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow noreferrer&quot;&gt;runTasksAutomatically&lt;/a&gt; config setting to false and have a cron job hit the task at your set schedule, but that all seems overly complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just setup an independent cron job to fire when you need your logic to run and have it hit a custom &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller's action&lt;/a&gt; and run your logic directly outside of Craft's task implementation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T04:54:03.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18750" PostTypeId="2" ParentId="18735" CreationDate="2017-01-31T04:59:24.607" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The question is, is there a multiple license discount?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We currently don't have an official policy, but to-date we've handled bulk discount requests on a case-by-case basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the FAQ suggests, contact support@craftcms.com :).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T04:59:24.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18751" PostTypeId="2" ParentId="18743" CreationDate="2017-01-31T05:11:31.597" Score="3" Body="&lt;p&gt;By default, Commerce only provides 3 custom element types to Craft... products, orders and variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you're looking for products, in which case the syntax you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$productsCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Product');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T05:11:31.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18752" PostTypeId="2" ParentId="18746" CreationDate="2017-01-31T05:19:14.383" Score="1" Body="&lt;p&gt;I'd suggest starting with the official docs on removing index.php from your URLS:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/why-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/why-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if that doesn't help, there are lots more &lt;a href=&quot;https://craftcms.stackexchange.com/search?q=index.php&quot;&gt;environment-specific things&lt;/a&gt; here on Craft SE, you can check.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-01-31T05:19:14.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18753" PostTypeId="2" ParentId="18748" CreationDate="2017-01-31T05:23:03.410" Score="1" Body="&lt;p&gt;There's a 99% chance you're running into a case-sensitivity issue on your file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check your plugin's name, the handle and the action URL for the controller you're trying to hit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely locally, you've got a case insensitive file system, so it doesn't matter that &lt;code&gt;pluGiNHanDlE&lt;/code&gt; is not equal to &lt;code&gt;pluginHandle&lt;/code&gt;, but on staging it's case sensitive so it does.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T05:23:03.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18754" PostTypeId="1" AcceptedAnswerId="18801" CreationDate="2017-01-31T06:47:02.690" Score="2" ViewCount="415" Body="&lt;p&gt;I’m using the Digital Products plugin to sell licenses so that users are listed on the site for a certain amount of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The options are something like &quot;buy 3 month&quot;, &quot;buy 6 month&quot; etc. You see, the concept of the cart doesn’t really apply here. There would be no point in buying &quot;3 month&quot; twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That’s why I’d like to set the items in the cart always to the quantity of 1. Even better would be if I could empty the cart each time a product is added to the cart. That’s because people are supposed to select between the given options, not buying several options at once or multiple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints?&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-02-02T22:24:40.050" Title="Set a maximum quantity for cart items" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18755" PostTypeId="1" AcceptedAnswerId="18756" CreationDate="2017-01-31T07:50:16.730" Score="2" ViewCount="629" Body="&lt;p&gt;I was wondering if there 's a quick way to just set a locale in your template for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = 'en' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then use that locale to get the correct content. I know that Craft automaticly uses the right locale based on the url, but I'm importing some templates from Craft with curl into another site and so the Craft template is unaware of the locale. That's why I would like to set it, if possible without the use of an extra plugin.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-01-31T09:27:03.790" Title="Set Locale in template" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18756" PostTypeId="2" ParentId="18755" CreationDate="2017-01-31T09:27:03.790" Score="4" Body="&lt;p&gt;You can’t set the &lt;code&gt;craft.locale&lt;/code&gt; from the template. You can set the locale for your Element Criteria though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(14).locale('en').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-01-31T09:27:03.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18757" PostTypeId="1" CreationDate="2017-01-31T10:23:08.253" Score="1" ViewCount="764" Body="&lt;p&gt;just a short question - what is &quot;Assets in this source have public URLs&quot; good for? Oh course, I can't use getUrl() in the templates, yes, but I can still get the filename etc. So I don't see the use of this parameter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question: when I upload assets to craft, sometimes they are put in the folder I expect, sometimes craft creates a subfolder (named like the asset-id I guess) and puts the file inside that folder. In which case a subfolder is created?&lt;/p&gt;&#xA;" OwnerUserId="4633" LastEditorUserId="4633" LastEditDate="2017-01-31T10:29:50.080" LastActivityDate="2017-01-31T18:37:05.513" Title="What it &quot;Assets in this source have public URLs&quot; good for?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18758" PostTypeId="1" CreationDate="2017-01-31T10:39:49.933" Score="2" ViewCount="274" Body="&lt;p&gt;I'm setting up a Craft site on a Linode server has anyone had any experience with this? I'm struggling with which owner and user to set the &lt;code&gt;var/www/html&lt;/code&gt; folder to with &lt;code&gt;chown&lt;/code&gt; and what &lt;code&gt;chmod&lt;/code&gt; settings to use on the craft folders. Currently Craft does not show the index page and can't find the admin folder which are all where they are supposed to be so it seems to be something to do with apache permissions. Just wondered if anyone could advise what these should be?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2017-01-31T18:37:47.753" LastActivityDate="2017-04-01T19:13:33.447" Title="Setting up Craft on Linode Using Ubuntu" Tags="&lt;server&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18759" PostTypeId="1" AcceptedAnswerId="18768" CreationDate="2017-01-31T11:08:34.180" Score="1" ViewCount="528" Body="&lt;p&gt;I'm working on a Craft CMS plugin. I'm making a form that consists of multiple themes and questions. The structure is supposed to be as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;• Form&#xA;  • Theme&#xA;    • Question&#xA;    • Question&#xA;    • Question&#xA;  • Theme&#xA;    • Question&#xA;    • Question&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Questions should be “attached” to the form with the formId, but also to their respective themeId. This kinda works when there’s just one theme, but as soon as I save a question in a second or third theme, all questions get the last theme id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve added a hidden field to each question which looks like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; class=&quot;questionThemeId&quot; name=&quot;questionThemeId&quot; value=&quot;{{ themeId }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in my Service I do the following request and add the themeId to the question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$themeIdForQuestion = craft()-&amp;gt;request-&amp;gt;getPost(&quot;questionThemeId&quot;);&#xA;$question-&amp;gt;themeId = $themeIdForQuestion;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does add the themeId to the question, but once there is a question in the second theme, all questions get the themeId of the last theme. That makes sense, because getPost always gets the last post (I think). How would I get post of the questionThemeId depending on the question?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm open to other solutions too, because this does feel slightly hacky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2017-01-31T19:07:55.207" Title="How to get corresponding Post in Craft request?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;php&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18760" PostTypeId="1" AcceptedAnswerId="18762" CreationDate="2017-01-31T11:10:17.673" Score="1" ViewCount="785" Body="&lt;p&gt;I'm working on improving the performance of my website, and for some areas, I believe eager-loading will help. On each page of the site it's possible to bring out related entries at the bottom, but these can appear in different formats: some as just titles with links, others with images, titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the twig code for bringing out one of the more complex formats:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;                section: 'block.entryTypes',&#xA;                relatedTo: 'relatedTo',&#xA;                limit: 'limit',&#xA;                id: 'notValue',&#xA;                order: 'block.order',&#xA;                postDate: '&quot;&amp;gt;= &quot; ~ now|date_modify{block.until)',&#xA;                with: [&#xA;                    'leadImage',&#xA;                    'type',&#xA;                    'indexHeading',&#xA;                    'externalRedirect',&#xA;                    'posterColor',&#xA;                    'noLink',&#xA;                    'articleCategory',&#xA;                    'price',&#xA;                    'addressTable',&#xA;                    'brief'&#xA;                ]&#xA;            }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set the &quot;with:&quot; section depending on the format of the list I choose? So it's something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if displayType == &quot;teaser&quot; %}&#xA;{% set params = &quot;'leadImage', 'type', 'indexHeading', ... 'brief'&quot; %}&#xA;{% endif %}&#xA;...&#xA;with: [ params ]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5717" LastEditorUserId="5717" LastEditDate="2017-01-31T11:17:55.657" LastActivityDate="2017-11-20T00:56:37.853" Title="Eager loading with conditions" Tags="&lt;entries&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18761" PostTypeId="1" CreationDate="2017-01-31T11:23:36.480" Score="1" ViewCount="137" Body="&lt;p&gt;I am trying to output a news section, where I want to display the news categories as classes of the article. That works fine. But I also want to change the markup for a certain category out of the group mainly for responsive layout issues as I use Bootstrap as framework. How would I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(5).find() %}&#xA;{% set categories = craft.categories.relatedTo(entry) %}&#xA;&#xA;    {% if category.slug == 'media' %} {# ------- I MEAN THIS LINE, slug or ID would be perfect #}&#xA;&#xA;    &amp;lt;article class=&quot;col-xs-12 col-sm-6 news {% for category in categories %}{{ category.slug }}{% endfor %}&quot; id=&quot;{{ entry.slug }}&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        {% set info = entry.info|nl2br %}&#xA;        &amp;lt;p class=&quot;info&quot;&amp;gt;{{ info|raw }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.body }}&#xA;    &amp;lt;/article&amp;gt;&#xA;&#xA;    {% else %}&#xA;&#xA;    &amp;lt;article class=&quot;col-xs-12 news {% for category in categories %}{{ category.slug }}{% endfor %}&quot; id=&quot;{{ entry.slug }}&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;        {% set info = entry.info|nl2br %}&#xA;        &amp;lt;p class=&quot;info&quot;&amp;gt;{{ info|raw }}&amp;lt;/p&amp;gt;&#xA;        {{ entry.body }}&#xA;        &amp;lt;aside class=&quot;newsimages col-xs-12 col-md-6&quot;&amp;gt;&#xA;            {% for image in entry.images %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('medium') }}&quot; alt=&quot;{{ entry.title }}&quot; class=&quot;col-xs-12{% if loop.first %}{% else %} col-sm-6{% endif %}&quot; /&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/aside&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6034" LastActivityDate="2017-01-31T17:42:16.733" Title="Change markup depending on category of an entry" Tags="&lt;categories&gt;&lt;category&gt;&lt;markup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18762" PostTypeId="2" ParentId="18760" CreationDate="2017-01-31T12:00:55.443" Score="2" Body="&lt;p&gt;Yeah, but you need to make sure you pass an array to the &lt;code&gt;with&lt;/code&gt; param and you can’t compose an array by injecting a string into the &lt;code&gt;[ ]&lt;/code&gt; like you did in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set withParam = [] %}&#xA;&#xA;{% if displayType == 'teaser' %}&#xA;    {% set withParam = ['leadImage', 'type', 'indexHeading', 'brief'] %}&#xA;{% endif %}&#xA;&#xA;{% if someCondition %}&#xA;    {% set withParam = withParam|merge(['anotherField', 'andOneMore']) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    with: withParam&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-01-31T12:06:42.410" LastActivityDate="2017-01-31T12:06:42.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18763" PostTypeId="2" ParentId="18644" CreationDate="2017-01-31T13:25:38.173" Score="2" Body="&lt;p&gt;Thanks for your reply! We'll look into Solspace Calendar which appears to be very powerful and should fulfil our requirements. &lt;/p&gt;&#xA;" OwnerUserId="4020" LastActivityDate="2017-01-31T13:25:38.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18765" PostTypeId="2" ParentId="18761" CreationDate="2017-01-31T17:42:16.733" Score="2" Body="&lt;p&gt;You're currently fetching an array of categories even if there's only one it, I think. You either need to loop through the array or try replacing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.relatedTo(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.relatedTo(entry).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could scrap the category conditional altogether and use entry types, with different entry types set up for different layouts (that's my preferred method). You could also try testing for the presence of images as well (because that seems to be the only difference in the markup):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.images | length %}&#xA;    &amp;lt;aside class=&quot;newsimages col-xs-12 col-md-6&quot;&amp;gt;&#xA;        {% for image in entry.images %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('medium') }}&quot; alt=&quot;{{ entry.title }}&quot; class=&quot;col-xs-12{% if loop.first %}{% else %} col-sm-6{% endif %}&quot; /&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/aside&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or have I misunderstood and it's the conditional you're having problems with?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-01-31T17:42:16.733" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18766" PostTypeId="2" ParentId="18757" CreationDate="2017-01-31T18:37:05.513" Score="1" Body="&lt;p&gt;It let's you define &quot;private&quot; asset sources that you don't want publicly exposed on the web.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Another question: when I upload assets to craft, sometimes they are put in the folder I expect, sometimes craft creates a subfolder (named like the asset-id I guess) and puts the file inside that folder.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you're uploading these files through an &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets field&lt;/a&gt;, then that field's setting can define a &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic subfolder path&lt;/a&gt; where the upload will be saved based on the contents of the entry/user/tag/category/etc. that it is being saved in.  Sounds like that's what you've got defined.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T18:37:05.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18767" PostTypeId="2" ParentId="18758" CreationDate="2017-01-31T18:46:59.557" Score="1" Body="&lt;p&gt;I assume you've seen &lt;a href=&quot;https://www.linode.com/docs/websites/apache/apache-web-server-on-ubuntu-14-04&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.linode.com/docs/websites/apache/apache-web-server-on-ubuntu-14-04&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft really isn't any different than any other PHP application in the way it needs to be setup to execute.  The only extra thing that other apps might not require (because most PHP apps don't auto-update) is that Craft needs to be able to recursively write to its &lt;code&gt;craft/app&lt;/code&gt; folder in order for that to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a handy script here: &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt; that can help automate the necessary permissions for your box, but you'll need still need to know what user:group Apache is running as for it to set things up properly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T18:46:59.557" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18768" PostTypeId="2" ParentId="18759" CreationDate="2017-01-31T19:07:55.207" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;That makes sense, because getPost always gets the last post (I think).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you've got multiple form inputs with the same name, then the last one in is probably the value that will get sent over POST to the controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could make sure your themeId name inputs are unique by appending a unique string or some such to them, then parsing through all of the submitted values on the PHP side, perhaps?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T19:07:55.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18769" PostTypeId="2" ParentId="18745" CreationDate="2017-01-31T19:22:28.653" Score="1" Body="&lt;p&gt;My solution was to load the template directly rather than routing to the controller first.  Essentially, in my &lt;code&gt;registerSiteRoutes()&lt;/code&gt; function I replaced this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;payment&quot; =&amp;gt; ['action' =&amp;gt; 'someController/doPayment']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;payment&quot; =&amp;gt; 'templateDir/core/payment'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I didn't even realize you could do this in &lt;code&gt;registerSiteRoutes()&lt;/code&gt;!&lt;/p&gt;&#xA;" OwnerUserId="5684" LastActivityDate="2017-01-31T19:22:28.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18770" PostTypeId="1" AcceptedAnswerId="18771" CreationDate="2017-01-31T20:19:10.160" Score="2" ViewCount="250" Body="&lt;p&gt;I have a section with 2 entry types. Logged in users need to be able to submit to each type. I had planned on having 2 different entry forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I tell the form which entry type to save to? I assume it's a hidden field but what's the field name and where do I find the value?&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2017-01-31T20:34:15.797" Title="how to specify entry type on front end entry form?" Tags="&lt;entry-type&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18771" PostTypeId="2" ParentId="18770" CreationDate="2017-01-31T20:34:15.797" Score="3" Body="&lt;p&gt;You just need to specify a hidden input with the &lt;code&gt;typeId&lt;/code&gt; set correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;typeId&quot; value=&quot;{{ entry.typeId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-01-31T20:34:15.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18772" PostTypeId="2" ParentId="18293" CreationDate="2017-01-31T22:15:57.733" Score="1" Body="&lt;p&gt;You're almost there, as you can see on the &lt;strong&gt;&lt;em&gt;SproutForms_EntriesService&lt;/em&gt;&lt;/strong&gt; Class at line 197 we add a &lt;strong&gt;&lt;em&gt;SproutForms_OnSaveEntryEvent&lt;/em&gt;&lt;/strong&gt;. When this event is fired you can get the form entry submitted within the param 'entry'. All you need to do is add a listener to catch this event, please go ahead and add the following code to the init() function of the plugin of your custom field type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('sproutForms.onSaveEntry', function (Event $event)&#xA;    {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // Let's assume that your field handle is &quot;custom&quot;&#xA;        $entry-&amp;gt;setContentFromPost(array(&#xA;            'custom' =&amp;gt; $entry-&amp;gt;id,&#xA;            )&#xA;        );&#xA;        // save it again. (avoid an infinite loop using sproutForms()-&amp;gt;entries-&amp;gt;saveEntry)&#xA;        craft()-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="115" LastEditDate="2017-01-31T22:39:55.157" LastActivityDate="2017-01-31T22:39:55.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18773" PostTypeId="2" ParentId="1733" CreationDate="2017-02-01T09:14:34.990" Score="3" Body="&lt;p&gt;Input:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/w56Oc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w56Oc.png&quot; alt=&quot;creating categories in craft&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav category in craft.categories.group('mainMenu').level(1) %}&#xA;&#xA;{% if category.hasDescendants() %}&#xA;&amp;lt;li&amp;gt;1 Level | {{ category.title }}&amp;lt;ul&amp;gt;&#xA;  {% set subCategories = craft.categories.descendantOf(category).level(2) %}&#xA;&#xA;  {% for category in subCategories %}&#xA;    {% if category.hasDescendants() %}&#xA;    &amp;lt;li&amp;gt;2 Level | {{ category.title }}&amp;lt;ul&amp;gt;&#xA;      {% set subCategories = craft.categories.descendantOf(category).level(3) %}&#xA;&#xA;      {% for category in subCategories %}&#xA;      &amp;lt;li&amp;gt;3 Level | {{ category.title }}&amp;lt;/li&amp;gt;&#xA;      {% if loop.last %}&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;      {% endfor %}&#xA;&#xA;    {% else %}&#xA;    &amp;lt;li&amp;gt;2 Level | {{ category.title }}&amp;lt;/li&amp;gt;&#xA;&#xA;    {% endif %}&#xA;  {% if loop.last %}&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;  {% endfor %}&#xA;&#xA;{% else %}&#xA;&amp;lt;li&amp;gt;1 Level | {{ category.title }}&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q4NMt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q4NMt.png&quot; alt=&quot;output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5587" LastActivityDate="2017-02-01T09:14:34.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18774" PostTypeId="1" CreationDate="2017-02-01T11:50:06.147" Score="2" ViewCount="49" Body="&lt;p&gt;I've been going through the Craft EntryCount plugin on Mijingo and I've hit a bit of a problem, the way the tutorial shows how to modify the entries table to include the pageviews count doesn't seem to work, I've got the below code in my main plugin file. Does anyone know what the problem is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyEntryTableAttributes(&amp;amp;$attributes, $source) &#xA;{&#xA;    if($this-&amp;gt;getSettings()-&amp;gt;showCountOnEntryIndex)&#xA;    {&#xA;        $attributes['count'] = 'Count';&#xA;    }&#xA;}&#xA;&#xA;public function getEntryTableAttributeHtml(EntryModel $entry, $attribute) &#xA;{&#xA;    if($this-&amp;gt;getSettings()-&amp;gt;showCountOnEntryIndex AND $attribute == 'count')&#xA;    {&#xA;        return craft()-&amp;gt;entryCount-&amp;gt;getCount($entry-&amp;gt;id)-&amp;gt;count;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4931" LastActivityDate="2017-02-01T11:50:06.147" Title="How do I modify the entries table to add a new column?" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18775" PostTypeId="2" ParentId="120" CreationDate="2017-02-01T13:18:08.203" Score="1" Body="&lt;p&gt;Its not a full-blown guide yet, but the &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/guides/migrating-from-wordpress&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me Guide&lt;/a&gt; will get you off to a good start. That really deals with getting the data out of Wordpress. Handles Advanced Custom Fields, WooCommerce, Custom Taxonomies and Custom Post Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've got out export file, you can following the &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/guides/importing-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Importing Entries&lt;/a&gt; guide for Feed Me.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-01T13:18:08.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18777" PostTypeId="2" ParentId="18702" CreationDate="2017-02-01T14:11:54.430" Score="2" Body="&lt;p&gt;Problem solved: &lt;code&gt;imagerSystemPath&lt;/code&gt; was set relatively&lt;/p&gt;&#xA;" OwnerUserId="6198" LastActivityDate="2017-02-01T14:11:54.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18778" PostTypeId="1" CreationDate="2017-02-01T15:13:39.010" Score="0" ViewCount="87" Body="&lt;p&gt;Is there a way to do this? Emails are pretty ugly when selecting people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing it would be a quick plugin to write, if I wrote plugins. Anyone done this before?&lt;/p&gt;&#xA;" OwnerUserId="5520" LastActivityDate="2017-05-03T07:35:23.377" Title="Display User Name in Users Field in CP" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18779" PostTypeId="1" AcceptedAnswerId="18780" CreationDate="2017-02-01T15:25:04.127" Score="1" ViewCount="1097" Body="&lt;p&gt;Accessing my /admin of a craft site and i get this error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Use of undefined constant CRAFT_BUILD - assumed 'CRAFT_BUILD'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Never happened before today, I'm running PHP v5.6.30.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4628" LastEditorUserId="57" LastEditDate="2017-02-02T06:51:19.510" LastActivityDate="2017-04-16T09:30:18.317" Title="What does the error &quot;Use of undefined constant CRAFT_BUILD - assumed 'CRAFT_BUILD'?&quot; mean?" Tags="&lt;admin&gt;&lt;error&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18780" PostTypeId="2" ParentId="18779" CreationDate="2017-02-01T15:59:47.227" Score="2" Body="&lt;p&gt;Had a plugin installed which had been using CRAFT_BUILD and as its been deprecated it was throwing the error, problem was could access admin to update plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually, entered CRAFT_BUILD and other deprecated info into &lt;code&gt;craft/app/Info.php&lt;/code&gt; and it let me login to fix.&lt;/p&gt;&#xA;" OwnerUserId="4628" LastEditorUserId="57" LastEditDate="2017-02-02T06:50:51.847" LastActivityDate="2017-02-02T06:50:51.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18781" PostTypeId="2" ParentId="64" CreationDate="2017-02-01T17:32:50.130" Score="14" Body="&lt;p&gt;I pulled together this brain-dump of 8 different ways of doing navigation. There's probably more. With any method make sure you keep a close eye on the query count and load speed, as some of these methods are very resource-intensive. You can mitigate with the &lt;code&gt;cache&lt;/code&gt; tag, but ideally should strive for simplicity where possible...&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;nav approaches&lt;/h1&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Completely hardcoded&lt;br&gt;&#xA;Pros: Pure awesome&lt;br&gt;&#xA;Cons: Not translatable, no client access&lt;/li&gt;&#xA;&lt;li&gt;A global table with plain text columns for URI and label&#xA;&lt;br&gt;Pros: Light (zero extra queries), flexibility to add any URI&#xA;&lt;br&gt;    Cons: No entry selector possible - need to find (and update) URIs manually. No child items (update: actually, you &lt;em&gt;can&lt;/em&gt; add a column to mark items as 'level-2'... the template coding to gather them up and build nested lists under the previous parent item is a little complex, but it works well... if you only need 2 levels!).&lt;/li&gt;&#xA;&lt;li&gt;Hardcoded but with static translations&#xA;&lt;br&gt;Pros: Fairly awesome&#xA;&lt;br&gt;Cons: A bit fiddly, and need to translate URIs manually. No client access.&lt;/li&gt;&#xA;&lt;li&gt;A structure with fields for entry select and arbitrary URL override&#xA;&lt;br&gt;Pros: Can accommodate child items easily using craft's &lt;code&gt;nav&lt;/code&gt; tag. Intuitive UI.&#xA;&lt;br&gt;Cons: Heavy query count, hard to administer all nav items in one go as they're separate entries. Nav management really belongs in Globals IMO, not Entries.&lt;/li&gt;&#xA;&lt;li&gt;A global matrix with fields for entry select, label override, and arbitrary URL override&#xA;&lt;br&gt;Pros: Very flexible&#xA;&lt;br&gt;Cons: Heavy query count (8 with eager loading, 10 without). Matrix interface is a bit unwieldy just for a list of links. Can't handle child items without adding a table or supertable block.&lt;/li&gt;&#xA;&lt;li&gt;A global entries selector&#xA;&lt;br&gt;Pros: Nice simple interface. Automatically updating URIs and labels&#xA;&lt;br&gt;Cons: Fairly heavy query count. No flexibility to override (unless you put extra fields against the entries). No child items (without adding fields to each entry). No arbitrary items (everything must be an entry).&lt;/li&gt;&#xA;&lt;li&gt;Hybrid. Depending on the nature of the site, some parts of the nav could be pulled from section entries or category groups while others parts are hardcoded.&#xA;&lt;br&gt;Pros: Lots of client control. Changeable dynamic nav.&#xA;&lt;br&gt;Cons: Fairly heavy query count (use cache tag). Nav is not fully administered in one single place.&lt;/li&gt;&#xA;&lt;li&gt;A plugin (ugh)&#xA;&lt;br&gt;Cons: it's an unecessary plugin, just don't do it!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Just in case anyone else likes the idea of #2 above (I think it's becoming my favourite approach personally), here's how you can use that and also cater for a second level of child items. Probably pushes Twig into overly-complex territory, but I'd still rather do this than install a plugin. This approach uses a global table field with 3 columns: Label (text), Link (text), Level2 (checkbox).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# ======================================&#xA;FIRST, LET's MAKE A HASH MAP to match up &#xA;parents with their children based on their&#xA;position in the list&#xA;========================================= #}&#xA;&#xA;{% set primaryNav = navigation.primaryNavigation %}&#xA;{% set children = {} %}&#xA;&#xA;{% for item in primaryNav %}&#xA;    {% set targetArray = {} %}&#xA;&#xA;    {% if item.level2 %}&#xA;        {% if attribute(children, lastKnownTopLevelItem) is not defined %}&#xA;            {% set children = children|merge({(lastKnownTopLevelItem): [item]}) %}&#xA;        {% else %}&#xA;            {% set targetArray = attribute(children, lastKnownTopLevelItem) %}&#xA;            {% set targetArray = targetArray|merge([item]) %}&#xA;            {% set children = children|merge({(lastKnownTopLevelItem): targetArray}) %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;    {# make a note of the loop index of the last known top level item... #}&#xA;    {% if not item.level2 %}&#xA;        {% set lastKnownTopLevelItem = 'children-of-' ~ loop.index %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# ======================================&#xA;NOW OUTPUT...&#xA;========================================= #}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {# just loop through top level, as we will fetch child items from the hash map... beware, don't combine the 'not level2' conditional into the for loop as otherwise the loop indices won't match up! #}&#xA;    {% for item in primaryNav %}&#xA;        {% if not item.level2 %}&#xA;&#xA;            {% set childrenOfThisItem = attribute(children,'children-of-' ~ loop.index) ?? {} %}&#xA;&#xA;            {% if childrenOfThisItem|length %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ item.link }}&quot;&amp;gt;{{ item.label }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% for child in childrenOfThisItem %}&#xA;                            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ child.link }}&quot;&amp;gt;{{ child.label }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ item.link }}&quot;&amp;gt;{{ item.label }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="271" LastEditorUserId="271" LastEditDate="2018-05-02T13:56:53.603" LastActivityDate="2018-05-02T13:56:53.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18782" PostTypeId="2" ParentId="10326" CreationDate="2017-02-01T17:43:25.307" Score="7" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Craft 3 was officially released (4/4/18), all plugins can be found in the &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Plugin Store&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that the &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 Beta&lt;/a&gt; is out and we’re done making breaking changes to plugin APIs, we’re keeping a master list of Craft 3-compatible plugins at &lt;strong&gt;&lt;a href=&quot;https://github.com/craftcms/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;github.com/craftcms/plugins&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="45" LastEditDate="2019-05-31T18:05:57.930" LastActivityDate="2019-05-31T18:05:57.930" CommentCount="0" CommunityOwnedDate="2017-02-01T17:43:25.307" ContentLicense="CC BY-SA 4.0" />
  <row Id="18783" PostTypeId="1" CreationDate="2017-02-01T18:16:07.757" Score="2" ViewCount="156" Body="&lt;p&gt;I am working on a Craft plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a main entities are 'Courses' and 'Entries'. If I click on an Entries in the CMS there is an option to select and associated 'Course'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my controller I can get a Course as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$course = craft()-&amp;gt;entries-&amp;gt;getEntryById($variables['pathId']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far so good, but now I want to get all related 'Entries', so I do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries=$course-&amp;gt;entries-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Property &quot;Craft\EntryModel.entries&quot; is not defined.  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Clearly the two are related so why isn't this method working?&lt;/p&gt;&#xA;" OwnerUserId="6140" LastEditorUserId="45" LastEditDate="2017-02-01T19:06:58.427" LastActivityDate="2017-02-01T19:11:28.727" Title="Plugin development - Querying related data" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;models&gt;&lt;query&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18784" PostTypeId="2" ParentId="18783" CreationDate="2017-02-01T18:40:58.447" Score="1" Body="&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; this works but is it an acceptable solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'checkin';&#xA;&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;     'targetElement' =&amp;gt; $entry,&#xA;     'field' =&amp;gt; $field&#xA;);&#xA;&#xA;$checkin = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6140" LastActivityDate="2017-02-01T18:40:58.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18785" PostTypeId="2" ParentId="18783" CreationDate="2017-02-01T19:03:18.277" Score="1" Body="&lt;p&gt;I think you're looking for &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;with = array('fieldHandle');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6026" LastEditorUserId="6026" LastEditDate="2017-02-01T19:11:28.727" LastActivityDate="2017-02-01T19:11:28.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18788" PostTypeId="2" ParentId="18778" CreationDate="2017-02-02T06:50:11.133" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/users-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Users field&lt;/a&gt; uses the username for the display label by default when showing what users have been selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you've got the &lt;a href=&quot;https://craftcms.com/docs/config-settings#useEmailAsUsername&quot; rel=&quot;nofollow noreferrer&quot;&gt;useEmailAsUsername&lt;/a&gt; config setting set to &lt;code&gt;true&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-02T06:50:11.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18789" PostTypeId="1" AcceptedAnswerId="18791" CreationDate="2017-02-02T07:11:44.137" Score="2" ViewCount="28" Body="&lt;p&gt;I want to make it so that each user can only be assigned once to a specific field across all entries. For instance, let's say we have a bunch of teams. A user can only be on one team at a time. Once assigned to a team roster, they should not be available to assign to another team. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="6188" LastActivityDate="2017-02-02T09:35:59.430" Title="Is it possible to limit the number of times a user can be added to the same field across different entries?" Tags="&lt;entries&gt;&lt;users&gt;&lt;structure&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18790" PostTypeId="1" CreationDate="2017-02-02T08:15:02.580" Score="2" ViewCount="510" Body="&lt;p&gt;I have a fully static website. All images and videos are currently delivered via aws cloudfront. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am thinking of delivering the HTML via cloudfront as well. My concern is that craftCMS routing will always point to the CDN domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you preview your content without invalidating the cache? I want my clients to immediately see the changes they made without waiting for 30 minutes (cdn cache expiration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit #1: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if relative urls for linking between pages has any pit falls. &lt;/p&gt;&#xA;" OwnerUserId="6009" LastEditorUserId="6009" LastEditDate="2017-02-02T18:09:24.987" LastActivityDate="2017-02-02T23:38:08.473" Title="CraftCMS with Cloudfront Full Page Delivery" Tags="&lt;routing&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18791" PostTypeId="2" ParentId="18789" CreationDate="2017-02-02T09:35:59.430" Score="2" Body="&lt;p&gt;Could you not come at it from a different angle and instead choose your team by editing the user? That way you can assign a team field to the user and restrict that field so that you can only pick the one team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your templates you can use &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; to link them all up.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-02-02T09:35:59.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18792" PostTypeId="1" AcceptedAnswerId="18797" CreationDate="2017-02-02T12:34:34.883" Score="2" ViewCount="464" Body="&lt;p&gt;I'm trying to get &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse Field for Craft&lt;/a&gt; to work on some responsive images set up with &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager for Craft&lt;/a&gt;, but I'm not having much luck, as it's still only generating the cached images on page load and not when the client saves the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my image code in the twig template. Can someone explain how to setup the preparse plugin with it as the explanation on the plugin page is a bit too brief?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = category.countyHero.first() %}&#xA;{% set transformedImages = craft.imager.transformImage(image,&#xA;    [&#xA;            { width: 1920, ratio: 3/1, jpegQuality: 75 },&#xA;            { width: 1366, ratio: 3/1 },&#xA;            { width: 1024, ratio: 3/1.5 },&#xA;            { width: 750, ratio: 4/3, jpegQuality: 60 },&#xA;    ],&#xA;    {&#xA;            format: 'jpg',&#xA;            allowUpscale: false,&#xA;            mode: 'crop',&#xA;            jpegQuality: 80,&#xA;            position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%',&#xA;            interlace: true&#xA;    }&#xA;) %}&#xA;{% if image | length %}&#xA;&amp;lt;img class=&quot;img-responsive&quot;&#xA;     src=&quot;{{ transformedImages[1].url }}&quot;&#xA;     sizes=&quot;100vw&quot;&#xA;     srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;     alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-02-02T13:03:19.283" LastActivityDate="2017-02-02T16:03:58.230" Title="Preparse responsive images" Tags="&lt;templating&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18793" PostTypeId="1" AcceptedAnswerId="18794" CreationDate="2017-02-02T14:58:33.963" Score="2" ViewCount="1135" Body="&lt;p&gt;Please excuse this newbie question (newbie to Git that is). I'm trying to set up my CraftCMS environments with Git and wonder about best practices and how others configure your repositories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In specific, do you have separate Git repos for separate sites, or is it all in one big repo? Do you have separate repos for the outward-facing portion of a single Craft site and its application files or is that all in one repo? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2017-02-03T10:27:11.297" Title="Git configuration for CraftCMS" Tags="&lt;craft3&gt;&lt;git&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18794" PostTypeId="2" ParentId="18793" CreationDate="2017-02-02T15:05:11.107" Score="5" Body="&lt;p&gt;Each project should be a separate repository, definitely. After that - feel free to include what you like. Personally I follow something like this and ignore my /app folder: &lt;a href=&quot;https://deploybot.com/guides/deploy-craft-cms-to-digitalocean&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://deploybot.com/guides/deploy-craft-cms-to-digitalocean&lt;/a&gt;. But you could also include the &lt;code&gt;/app&lt;/code&gt; directory and plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/55/git-workflow-and-multi-environment-how-to-approach&quot;&gt;Git Workflow and Multi Environment - how to approach&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And: &lt;a href=&quot;https://craftcms.com/support/craft-storage-gitignore&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/craft-storage-gitignore&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-03T10:27:11.297" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18795" PostTypeId="1" CreationDate="2017-02-02T15:29:31.807" Score="1" ViewCount="118" Body="&lt;p&gt;I'm making a plugin that stores elements in fields and fieldGroups. When deleting one the elements with  the fields/field groups are being removed too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when deleting the whole plugin, those fields are still in the database. When reinstalling the plugin this makes it impossible to add the field with the same title again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already added 'onDelete' things in all the records like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineRelations()&#xA;{&#xA;  return array(&#xA;    'form'        =&amp;gt; array(static::BELONGS_TO, 'PluginHandle_FormRecord', 'onDelete' =&amp;gt; static::CASCADE),&#xA;    'fieldGroup'  =&amp;gt; array(static::BELONGS_TO, 'FieldGroupRecord', 'onDelete' =&amp;gt; static::CASCADE),&#xA;    'field'       =&amp;gt; array(static::BELONGS_TO, 'FieldRecord', 'onDelete' =&amp;gt; static::CASCADE)&#xA;  );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been searching the docs to see what actually happens when a plugin is being deleted, but can't find anything. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2017-03-05T01:23:06.530" Title="Delete fieldgroup when deleting plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18796" PostTypeId="1" CreationDate="2017-02-02T16:02:30.527" Score="3" ViewCount="93" Body="&lt;p&gt;I keep getting the 404 after successful payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pretty sure I have everything set up correctly, the thanks template is there, but it seems like Craft won't respond to the request, so the routing is not trigged, Apache is still trying to serve that file directly, it won’t recognize the {hash} part in the URL, so keep return the 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I find to make this work is manually add another redirect in the Route section (last screenshot), but it's not a nature way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PXpJV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PXpJV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6214" LastActivityDate="2017-03-30T11:08:04.850" Title="Charge plugin thanks page 404" Tags="&lt;redirect&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18797" PostTypeId="2" ParentId="18792" CreationDate="2017-02-02T16:03:58.230" Score="2" Body="&lt;p&gt;I've managed to get it working via the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new field and give it the preparse field type&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Duplicate only the twig variable code from the template into the input box in the field page.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Craft Settings, go to the page template, and add the new preparse field to the available fields (this doesn't show up in the content editor).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The twig template stayed the same.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The responsive images are then generated when the user saves the entry in Craft instead of when the page is loaded by the end user. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-02-02T16:03:58.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18798" PostTypeId="1" CreationDate="2017-02-02T16:53:23.567" Score="2" ViewCount="417" Body="&lt;p&gt;I'm trying to make specific subjects and submission titles so that it's easier to understand what kind of email we just received or what kind of submission it is in the Freeform Submissions page. I'm trying to access form values and entry variables to be used in these subjects and titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just tried to use &lt;code&gt;form.fullName&lt;/code&gt; (&lt;code&gt;fullName&lt;/code&gt; being a form field) into my auto-generated Submission Title (under Form Settings tab in composer), but received this error after hitting submit on the front-end:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Neither the property &quot;fullName&quot; nor one of the methods &quot;fullName()&quot;,&#xA;  &quot;getfullName()&quot;/&quot;isfullName()&quot; or &quot;__call()&quot; exist and have public&#xA;  access in class &quot;Solspace\Freeform\Library\Composer\Components\Form&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While we're at it, is it also possible to get the entry title that the form has been injected into as a value to be used as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I'm looking for the naming convention: [&lt;code&gt;form.name&lt;/code&gt;] &lt;code&gt;entry.title&lt;/code&gt; - &lt;code&gt;form.fullName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If perhaps an entry variable is not present, then it should gracefully degrade. &lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2017-02-02T17:45:26.777" LastActivityDate="2017-02-02T17:45:26.777" Title="Freeform: Accessing form values to create subject" Tags="&lt;plugin-freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18799" PostTypeId="2" ParentId="18407" CreationDate="2017-02-02T18:51:03.267" Score="3" Body="&lt;p&gt;So to close the loop on this one, I actually ended up using a different grunt tool that essentially accomplishes the same goal called &lt;a href=&quot;https://github.com/purifycss/grunt-purifycss&quot; rel=&quot;nofollow noreferrer&quot;&gt;purifycss&lt;/a&gt;. I was able to target purifycss at the craft template folder, get it to look at bootstrap css selectors actually in use in the templates, compare it to the full bootstrap css files, and then have it output only the css that was being utilized in a final minified css file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It ended up being that I was only using about half of the available bootstrap css selectors so it cut a bunch of unused css out of a very large file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I believe I could have taken the same or similar approach with &lt;a href=&quot;https://github.com/addyosmani/grunt-uncss&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncss&lt;/a&gt; so if you prefer that tool, I believe you can use it in the same way (though I did not personally so can't speak in detail to it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the excerpt from my gruntfile.js:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;purifycss: {&#xA;  options: {&#xA;    minify: true,&#xA;  },&#xA;  target: {&#xA;      src: ['./craft/templates/*.{html,twig}','./craft/templates/**/*.{html,twig}','./craft/templates/**/**/*.{html,twig}','./craft/templates/**/**/**/.{html,twig}'],&#xA;      css: ['./public/lib/css/dev/vendor/_bootstrap-theme.min.scss','./public/lib/css/dev/vendor/_bootstrap.min.scss'],&#xA;      dest: './public/lib/css/dev/vendor/_bootstrap-purified.min.scss'&#xA;  }&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2017-05-02T00:23:27.550" LastActivityDate="2017-05-02T00:23:27.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18800" PostTypeId="1" AcceptedAnswerId="18802" CreationDate="2017-02-02T20:42:50.843" Score="2" ViewCount="101" Body="&lt;p&gt;I'm trying to dump a list of available template tokens, and their contents. There's a command that's available in dev mode, but I haven't found it's documentation.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastActivityDate="2017-02-02T22:42:15.840" Title="What's the template command to print available tokens?" Tags="&lt;templating&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18801" PostTypeId="2" ParentId="18754" CreationDate="2017-02-02T22:24:40.050" Score="2" Body="&lt;p&gt;You should be able to handle this with some logic in a plugin listening to events like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters for this include both the &lt;code&gt;order&lt;/code&gt; as it stands, and the &lt;code&gt;lineItem&lt;/code&gt; being added to the cart, which gives you the opportunity to manipulate both.  You could clear the order, and chec the qty of the lineitem being added is 1 at this point (and change it if needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously it would be good to have some front end stuff in place limiting the quantity to 1 as well.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-02T22:24:40.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18802" PostTypeId="2" ParentId="18800" CreationDate="2017-02-02T22:42:15.840" Score="3" Body="&lt;p&gt;Stick &lt;code&gt;{{ dump(_context) }}&lt;/code&gt; in a template file to print out all the available values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ dump(_context|keys) }}&lt;/code&gt; Outputs the keys of the array without going through it recursively.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastActivityDate="2017-02-02T22:42:15.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18803" PostTypeId="2" ParentId="18790" CreationDate="2017-02-02T23:38:08.473" Score="3" Body="&lt;p&gt;That's the dream, isn't it? CDN everywhere, no database hits, etc. How &quot;static&quot; is your site? Unlike other CMS, the great thing about Craft is that you can store information everywhere and pull it out anywhere. That gets to be dynamic content problem nightmare unless you're very diligent about knowing what will happen, for example:  &quot;updating this page will also update content on the home page, the blog index, related white papers section, author archives, etc&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let' say you update the title of one of your main areas that's also part of your navigation: &lt;code&gt;Services&lt;/code&gt; becomes &lt;code&gt;Products&lt;/code&gt; for example. Now you have to invalidate every single page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it can get complex quickly but if you have a very simple site, obviously, the above doesn't apply. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to pull this off would be to create a subdomain, like &lt;code&gt;admin.whatever.com&lt;/code&gt;. Your admins would login to this URL. As far as Craft is concerned, it'll serve up on whatever domain you need, you just need multiple environment &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;config.php&lt;/code&gt;&lt;/a&gt; and template trickery. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your template files, check for the server name. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.serverName is not &quot;domain.com&quot; %} {% reqireLogin %} {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will prevent non-logged in users from trying to accesses the admin pages, otherwise Craft will serve up your non-CDN on that domain to anyone who hits it (which is not something you want to have happen generally).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike something like WordPress where it actually stores URLs in the database, Craft uses reference tags and builds up the URL on the fly so you generally don't have to worry about relative vs absolute URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hardest part of this is going to be the cache invalidation. Unlike static files, where you can just upload a new file with a different filename on the CDN to invalidate them, pages are much different. To make matters worse, it can &lt;a href=&quot;http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#InvalidationLimits&quot; rel=&quot;nofollow noreferrer&quot;&gt;take up to 10-15 minutes&lt;/a&gt; for that invalidation to happen on Cloudfront. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use nginx here for static/microcaching and it works pretty well but the idea is the same. I can share some code I use to invalidate its cache but basically you want to create a plugin that listens on &lt;code&gt;entries.SaveEntry&lt;/code&gt; and then tell CloudFront to invalidate the cache after it's saved. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('entries.saveEntry', function (Event $event) {&#xA;&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entry-&amp;gt;url &amp;amp;&amp;amp; $entry-&amp;gt;enabled) {            &#xA;&#xA;        $url = $entry-&amp;gt;url;&#xA;&#xA;            try {&#xA;&#xA;                 // do CloudFront stuff here&#xA;                if (!$response-&amp;gt;isSuccessful()) {&#xA;                    return;&#xA;                }               &#xA;&#xA;&#xA;&#xA;&#xA;            } catch (Exception $e) {&#xA;                // something happened.                  &#xA;            }&#xA;&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-02-02T23:38:08.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18804" PostTypeId="2" ParentId="18795" CreationDate="2017-02-03T00:48:02.990" Score="1" Body="&lt;p&gt;You can see what Craft does when uninstalling a plugin by looking at &lt;code&gt;craft/app/services/PluginsService&lt;/code&gt;'s &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/PluginsService.php#L442&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;uninstallPlugin&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will delete any custom elements the plugin has defined from &lt;code&gt;craft_elements&lt;/code&gt; and the cascading deletes across foreign keys to that table will trigger.  It will drop any tables defined by any plugin records. It will remove the plugin row from the &lt;code&gt;craft_plugins&lt;/code&gt; table and any migrations from the &lt;code&gt;craft_migrations&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft_field&lt;/code&gt; and &lt;code&gt;craft_fieldgroups&lt;/code&gt; won't get picked up because they don't have any indirect FK connection to &lt;code&gt;craft_elements&lt;/code&gt;, but you can add an &lt;code&gt;onBeforeUninstall&lt;/code&gt; method in your base plugin class and do any custom cleanup you want there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-03T00:48:02.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18806" PostTypeId="1" AcceptedAnswerId="18807" CreationDate="2017-02-03T10:16:13.127" Score="2" ViewCount="1262" Body="&lt;p&gt;I have 2 basic JSON files, the only difference between the files is the &lt;code&gt;product.type('')&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php I have turned on &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first JSON file (200 products ) loads within 2 second and the image is like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http:\/\/mysite.dev\/files\/coins\/_transform\/1763-myImage.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second file (30 products) takes 10+ seconds to load, and displays the image like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http:\/\/mysite.dev\/cpresources\/404?x=CjvOQxsnA&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using the same image transform for both files.&#xA;Why is it that the image in the second file isn't saved, because of this it takes 10+ seconds for the file to load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the same exact code for generating the transforms so I don't know why this is happening.&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2017-02-03T10:33:38.660" Title="Image transforms not working properly" Tags="&lt;image-transforms&gt;&lt;image&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18807" PostTypeId="2" ParentId="18806" CreationDate="2017-02-03T10:33:38.660" Score="3" Body="&lt;p&gt;If I remember correctly, you will see urls similar to this &lt;code&gt;http:\/\/mysite.dev\/cpresources\/404?x=CjvOQxsnA&lt;/code&gt; if you have &lt;code&gt;generateTransformsBeforePageLoad&lt;/code&gt; as &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could genuinely be the case that the original file is not there so it's 404ing (as the link suggests it is).&#xA;If you are running multi-environments, have you got all the assets on your locale env?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe try clear your cache, or, your &lt;code&gt;storage/runtime&lt;/code&gt; folder if you have all the assets and try again?&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2017-02-03T10:33:38.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18808" PostTypeId="1" AcceptedAnswerId="18809" CreationDate="2017-02-03T12:21:37.763" Score="1" ViewCount="339" Body="&lt;p&gt;How can I auto-generate the product titles in Craft Commerce? I'd like to auto-generate it from the post date and a custom field value. I can see how to auto-generate the SKU, but can't see how to do this for the product titles in the same way (like you can do for normal Craft entry titles).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I asked about this in the Craft Commerce Slack but didn't get a response, so just asking the question here instead. Thanks in advance for any help or possible workarounds.&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2019-07-22T08:40:09.513" Title="How to Auto-Generate a Craft Commerce Product Title" Tags="&lt;plugin-craftcommerce&gt;&lt;titles&gt;&lt;auto-generate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18809" PostTypeId="2" ParentId="18808" CreationDate="2017-02-03T13:02:18.213" Score="3" Body="&lt;p&gt;You can generate the Variant titles automatically, but not for top level Product Types:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9k2IK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9k2IK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-02-03T13:02:18.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18810" PostTypeId="2" ParentId="17379" CreationDate="2017-02-03T17:15:16.407" Score="1" Body="&lt;p&gt;Answering my own question:&#xA;We ended up configuring MySQL as Routh suggests here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12084/getting-this-sql-error-group-by-incompatible-with-sql-mode-only-full-group-by/12106#&quot;&gt;Getting this SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem solved.&lt;/p&gt;&#xA;" OwnerUserId="5264" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-02-03T17:15:16.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18811" PostTypeId="2" ParentId="16122" CreationDate="2017-02-03T17:32:52.413" Score="1" Body="&lt;p&gt;I ran into this as well. I only wanted to client to view the submissions but not edit the actual forms. I don't believe it's a bug they just didn't give it a separate permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my workaround:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I edited all three sproutform templates in the _layouts folder.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;base.html&lt;/li&gt;&#xA;&lt;li&gt;elementindex.html&lt;/li&gt;&#xA;&lt;li&gt;settings.html&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I moved &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;forms: {&#xA;  label: &quot;Forms&quot;|t,&#xA;  url: url('sproutforms/forms')&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if currentUser.can('editSproutFormsSettings')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the &quot;Edit Form Settings&quot; permission includes the actual forms.&lt;/p&gt;&#xA;" OwnerUserId="6216" LastEditorUserId="45" LastEditDate="2017-02-03T21:30:20.203" LastActivityDate="2017-02-03T21:30:20.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18812" PostTypeId="2" ParentId="18746" CreationDate="2017-02-03T19:26:10.013" Score="1" Body="&lt;p&gt;I had a case of this awhile back too. Craft will listen on whatever domain you point it to. If your site url (eg in Settings) doesn't actually resolve on the internet yet—or you have it pointed wrong—Craft will assume it doesn't actually work unless you tell otherwise. Drove me nuts for a couple hours one day until I retraced everything and realized I had the testing server URL still stuck in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to what everyone else has written,  I don't try to troubleshoot these kinds of issues using your regular web browser, use &lt;code&gt;curl -I http://whatever&lt;/code&gt; to see what's happening. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-02-03T19:26:10.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18813" PostTypeId="1" AcceptedAnswerId="18830" CreationDate="2017-02-03T20:51:39.323" Score="6" ViewCount="3315" Body="&lt;p&gt;We have 2 clients that want to have an online shop website. One with 100 products, with 10,000 products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've built 100's of websites, but no e-commerce sites yet. We're in the stage of writing the proposals/estimates, but because the clients have been long-time clients, they have confidence that we propose them the right platform. Or, read: they will go with our proposals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: why would anyone choose Craft Commerce over Magento? &#xA;(I'm not even considering any WP based solutions).&lt;/p&gt;&#xA;" OwnerUserId="185" LastEditorUserId="57" LastEditDate="2017-02-04T06:42:05.783" LastActivityDate="2017-06-14T01:14:47.303" Title="Why choose Craft Commerce over Magento" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18814" PostTypeId="1" AcceptedAnswerId="18838" CreationDate="2017-02-03T21:16:57.577" Score="0" ViewCount="104" Body="&lt;p&gt;&lt;strong&gt;How do I print the field ID of a category field in place of its title?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('posts').relatedTo(category) %}&#xA;    some html...&#xA;    {% for category in entry.market.level(2).find() %}&#xA;        {{ category.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want to print the field ID of &lt;code&gt;category.title&lt;/code&gt; instead.&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason = I am using the printed output as a class to filter against.  Some of the category titles contain more than one word and I do not want to add a hyphen to each instance.   So, using the field ID in place of category.title  would solve this problem.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2017-02-03T21:37:51.977" LastActivityDate="2017-02-06T09:48:12.373" Title="How do I print the field ID of a category field in place of its title?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18815" PostTypeId="1" AcceptedAnswerId="18889" CreationDate="2017-02-03T21:35:34.510" Score="1" ViewCount="155" Body="&lt;p&gt;I know this is partly a Twig question, but I've poked around quite a bit here, in Twig docs, Craft docs, and cannot find the right syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bunch of entries with titles like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hotel A&lt;/li&gt;&#xA;&lt;li&gt;Grand Hotel B&lt;/li&gt;&#xA;&lt;li&gt;Zither Hotel Grand Plaza&lt;/li&gt;&#xA;&lt;li&gt;The Top Hotel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to order by title, alphabetical, but I need to exclude leading 'The ' from the order. I've tried this, but it barfs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in craft.entries.section('hotels').order('(CASE when title LIKE &#xA;'%The ' THEN LTRIM(title, 4) ELSE title END )') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-02-08T15:57:27.630" Title="Order entries, exclude 'the' from order criteria" Tags="&lt;templating&gt;&lt;ordering&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18816" PostTypeId="1" CreationDate="2017-02-04T03:12:03.360" Score="1" ViewCount="82" Body="&lt;p&gt;I have a section called &quot;lunchMenu&quot; that contains an entries field (&quot;menuItems&quot;).  Each entry in &quot;menuItems&quot; is related to a category in the category group (&quot;foodCategory&quot;).  I would like to loop through each of the entries only in &quot;lunchMenu&quot; and output them within their respective categories.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I loop through the entries field alone, everything works just fine.  However, when I add the relatedTo parameter to sort by category, I get entries that are not present in this section's entry field.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm using - any help would be appreciated.  I think I'm not understanding the use of the relatedTo correctly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set food = craft.categories.group('foodCategory') %}&#xA;{% set entries = craft.entries.section('lunchMenu') %}&#xA;&#xA;    {% for entry in entries %}&#xA;        {% for category in food %}&#xA;        {{ category.title }}&#xA;            {% for item in entry.menuItems.relatedTo(category) %}&#xA;                    {{ item.title }}&#xA;            {% endfor %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6217" LastActivityDate="2017-02-04T03:12:03.360" Title="Output Only Entries from Entry Field Related to a Category" Tags="&lt;relations&gt;&lt;category&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18817" PostTypeId="1" AcceptedAnswerId="18866" CreationDate="2017-02-04T10:12:47.387" Score="1" ViewCount="2344" Body="&lt;p&gt;I'm pulling in entries which are the descendant of the current entry id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of my structure: Your Adventure &gt; Honeymoon &gt; A trip entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below code is being used on the Honeymoon entry to list any trip entries that are children of the current page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below code is working fine apart from the if statement I'm wrapping it all in as I don't want any of the wrapping divs if there are no child pages within 'Honeymoon Trips'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry in craft.entries.section('yourAdventures').descendantOf(entry.id)  %}&#xA;&amp;lt;!-- This is wrong --&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;section bg-pattern&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;         &amp;lt;div class=&quot;col-24 gutter-bottom--half &quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;Available {{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;            {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}&#xA;&#xA;            ...&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2017-02-06T11:42:43.897" LastActivityDate="2017-02-08T00:42:50.180" Title="Check if child entries exists" Tags="&lt;entries&gt;&lt;children&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18819" PostTypeId="2" ParentId="18813" CreationDate="2017-02-04T15:25:41.950" Score="2" Body="&lt;p&gt;In our experience we feel Magento has a little &quot;extra&quot; that is lacking in Craft Commerce atm. For example, integration with shipping API's, one step checkout plugins etc. Most companies also have somewhat of an internal IT crowd. Magento does ring a bell a bit more often and therefor makes them feel a bit more &quot;safe&quot; with their choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, learning Magento is a big investment, especially time-wise. I personally love the Craft/Commerce templating and the speed of developing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you decide to go with Craft, just make sure you're aware of the limitations, plugin and API -wise, or prepare to make a couple of them yourself.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2017-02-04T15:47:09.503" LastActivityDate="2017-02-04T15:47:09.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18820" PostTypeId="1" CreationDate="2017-02-04T15:57:10.590" Score="1" ViewCount="881" Body="&lt;p&gt;I'm creating a website that has a contact form on two different pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the Pixel &amp;amp; Tonic &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;ContactForm plugin&lt;/a&gt; and currently have a working contact form on one page - This one requires the user to provide their name, email, telephone, company name and message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other page, the contact form is different as the user needs to select which department they would like their message to be sent to. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;div class=&quot;select-wrapper&quot;&amp;gt;&#xA;   &amp;lt;select name=&quot;department&quot; id=&quot;department&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;- Please Select -&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;one&quot;&amp;gt;Business One&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;two&quot;&amp;gt;Business Two&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;three&quot;&amp;gt;Business Three&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;four&quot;&amp;gt;Business Four&amp;lt;/option&amp;gt;&#xA;   &amp;lt;/select&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the README document for this plugin, I can see that it is possible to programatically add email recipients by adding a hidden input field named “toEmail” and changing the craft/config/contactform.php config file&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, is it possible to do this when there is another contact form on the site?&#xA;If so, what do I need to add to the department dropdown code?&lt;/p&gt;&#xA;" OwnerUserId="6224" LastEditorUserId="57" LastEditDate="2017-02-05T00:26:50.993" LastActivityDate="2017-05-06T02:05:15.043" Title="Multiple contact forms - Different recipients" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18822" PostTypeId="1" CreationDate="2017-02-04T20:28:25.310" Score="1" ViewCount="50" Body="&lt;p&gt;I'm using Neo to allow my client to be able to create a content grid with child blocks. Now I'm wondering, is there a way that I can change the class of the output based on the number of items?  For example, if there are two items I'd like to have the class &lt;code&gt;grid-one-half&lt;/code&gt; and if there are three &lt;code&gt;grid-one-third&lt;/code&gt; etc. to give my client more flexibility in making grids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2017-02-04T21:00:55.413" Title="Adding class based on length" Tags="&lt;templating&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18823" PostTypeId="1" AcceptedAnswerId="18825" CreationDate="2017-02-04T20:54:07.237" Score="1" ViewCount="407" Body="&lt;p&gt;I know there are ways to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1682/get-the-current-section-handle&quot;&gt;check current section&lt;/a&gt;. I would like to check if I am on a specific product (commerce) page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to do this in a plugin by checking line item(s) and the product type. Is there a similar way to do the same at the twig level?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-02-04T21:01:00.187" Title="Commerce: How can I check if I am on a specific product page?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18824" PostTypeId="2" ParentId="18822" CreationDate="2017-02-04T21:00:55.413" Score="1" Body="&lt;p&gt;I figured it out by modifying the code from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8630/transform-different-image-if-specific-id-or-order&quot;&gt;this answer&lt;/a&gt; on image transforms. Here's the basics of my markup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;{% if loop.length == 2 %}grid-one-half{% elseif loop.length == 3 %}grid-one-third{% elseif loop.length == 4 %}grid-one-quarter{% endif %} grid-item&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-04T21:00:55.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18825" PostTypeId="2" ParentId="18823" CreationDate="2017-02-04T21:01:00.187" Score="2" Body="&lt;p&gt;You can use the same approach as the link provided in your question. Only, instead of an entry, you're working with a &lt;em&gt;product&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the current section - set fallback(s) for entries or products or ?? #}&#xA;{% set section = entry.getSection() | default(entry.getSection() ?? product.getType() ?? null) %}&#xA;{% if section %}&#xA;    {% set handle = section.handle %}&#xA;    {{ handle }} {# myProductType #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we are checking if we're on an entry. If not, we've set a fallback to check if we're on a product page. If nothing, the we return null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we've got our section, we can check the handle. Then it's a matter of checking for the type you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% if handle == 'myHandle' %}&#xA;    &amp;lt;p&amp;gt;We've got a winner!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-02-04T21:01:00.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18826" PostTypeId="2" ParentId="18817" CreationDate="2017-02-04T21:37:54.303" Score="4" Body="&lt;p&gt;If I figured out correctly what you want to do - this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.children | length  %}&#xA;&#xA;    &amp;lt;div class=&quot;section bg-pattern&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;             &amp;lt;div class=&quot;col-24 gutter-bottom--half&quot;&amp;gt;&#xA;&#xA;                &amp;lt;h3&amp;gt;Available {{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                {% for child in entry.children %}&#xA;                    &amp;lt;p&amp;gt;{{ child.title }}&amp;lt;/p&amp;gt;&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#children&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;entry.children&lt;/code&gt;&lt;/a&gt; is an alias for &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getDescendants&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;entry.getDescendants(1)&lt;/code&gt;&lt;/a&gt; which returns &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ElementCriteriaModel&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2017-02-04T21:37:54.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18827" PostTypeId="2" ParentId="18820" CreationDate="2017-02-05T00:28:18.080" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But, is it possible to do this when there is another contact form on the site? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If so, what do I need to add to the department dropdown code?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The dropdown code shouldn't have anything to do with it, if I'm following you correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both forms just need to have a &lt;code&gt;toEmail&lt;/code&gt; hidden input as specified in the docs: &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-05T00:28:18.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18828" PostTypeId="1" CreationDate="2017-02-05T02:29:16.927" Score="1" ViewCount="83" Body="&lt;p&gt;So I have a plugin with a service. Part of the service function is to grab a field (body) from an entry object that has been passed into the function. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin_ExampleService extends BaseApplicationComponent {&#xA;&#xA;    public function example($entry) {&#xA;        return $entry-&amp;gt;body;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The function will be called via Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin.example(entry) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I go about getting the field data for the users current locale?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2017-02-05T12:04:12.047" LastActivityDate="2017-02-05T12:04:12.047" Title="How can I get field data for the current locale in a plugin?" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18829" PostTypeId="2" ParentId="18828" CreationDate="2017-02-05T05:13:35.327" Score="1" Body="&lt;p&gt;You're pretty close... You'll need to do this in a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variable&lt;/a&gt;, not a Service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your method already exists in a Service, or if you'll need to access it via PHP as well, then you can keep it in the Service. In that case, you'll still need a Variable method, but it can simply be a wrapper for your existing Service method.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-02-05T05:13:35.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18830" PostTypeId="2" ParentId="18813" CreationDate="2017-02-05T06:03:11.357" Score="22" Body="&lt;p&gt;Obviously it's going to depend on each specific project, and I can only talk from my own (store owning) perspective, but over the years I have evaluated and installed and played with just about every ecommerce system of significance on the planet today.  The ones I've spent most time with are BigCommerce (in it's self hosted form before it went SAAS), EE &amp;amp; CartThrob, and Craft Commerce.  I'm not going to slag off Magento as such or very specifically - although as I go through my points it should be clear I though about all of these with Magento, and found them lacking or painful...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the reasons I chose Commerce, roughly in order of importance:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Pixel and Tonic - more than anything else, I think it was the considered, open and &lt;em&gt;intelligent&lt;/em&gt; approach of Pixel and Tonic - that I carefully observed from 2012 to 2015 - that convinced me it was a solid, well thought our platform backed by some exceptional people.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Content driven ecommerce - basically, there are two types of systems in the world - either commerce systems that have a little CMS bolted on, or content systems with a little shop thingy bolted on.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me it's essential that content, and absolutely great management of it, be the main thing.  BUT, I also do want a great shop on top of that - with integration between the two that feels completely transparent and natural.  This means, in essence, that a first party solution to both problems is ideal.  When you have separation between the two, it always feels bolted on and shoe-horned in (see CartThrob or WooCommerce as prime examples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact is pretty much anyone can set up an online shop right now and if all you want are product grids with pretty pictures, and lots of discount options, and simple (but simplistic) integrations to popular shipping services, then Shopify or similar is your obvious option.  But if you want substantial, useful content (and anyone that wants to compete with Amazon etc really should!) - then you need a content driven approach.  Expertise &amp;amp; Service are the keys to successful long term commerce in a world of box moving mega-discounters.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The ExpressionEngine (i.e. Content Modelling) foundations  - before coming to Craft/Commerce, I was considering (and implementing) CartThrob with ExpressionEngine.  And if I am truthful it's the fact that Craft grew from this approach - but then vastly improved on it - that gave me the motivation to spend serious time evaluating it (credit where it's due - Craft, like everything else, stands on the shoulders of giants).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fundamentally think structured content modelling is the key to excellent content management, which is fundamental to 'more-than-average' shops....see above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matrix - the problem with structured content is that it can be TOO structured for long form content - you simply can't have a dedicated field for absolutely everything - and so where you DO want to write longer form content, it tends (on lesser systems) to be that everything just gets dumped in a WYSIWYG.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix (and Supertable/Neo/etc :) ) - is the (so far) best solution to this problem.  It gives you a structured-within-longform-content approach that is second to none.  You can build very flexible page assembly systems using structure where you really need it and freedom where you don't.  Which means you can build some wonderful content driven ecommerce stuff very quickly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cost &amp;amp; support.  Magento - while open source and sort of free in a community supported sense/version, superficially looks good value.  But if you add real support - the kind you need if livelihoods depend on things - it becomes &lt;strong&gt;fiercely&lt;/strong&gt; expensive.  P &amp;amp; T support is fast, unlimited, generous and easy to access.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ease of implementation.  Craft &amp;amp; Commerce, with Twig, is &lt;strong&gt;easy&lt;/strong&gt;.  It's really, really simple and logical to write your templates, and Craft always seems to behave in natural, expected ways.  The more time you spend with it, the &lt;em&gt;less&lt;/em&gt; gotchas you need to worry about.  It's that rare system that gets better with familiarity.  Magento has a reputation for being absolutely &lt;em&gt;labyrinthe&lt;/em&gt; in scope and difficulty in terms of template implementation.  I've heard the term 'horror show' used more than once.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Flexibility - Whilst Commerce doesn't support a lot packaging, shipping stuff etc out of the box, and where it does the implementation can feel a bit basic, the inherent simplicity of Craft plugins (and V3 looks to improve on this further a lot!) - means you can implement just about anything you need easily.  In my experience for complex stores off the shelf things rarely meet real needs anyway - so what you really need is a well though out architecture for extension.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In terms of product &amp;amp; variation management, Commerce, like Craft itself, is wonderfully flexible and yet simple.  You can create elegant, responsive content entry systems for your editors with ease, and separate your data concerns in sensible, long term maintainable ways.  It nails content management as well as anything I've been able to find.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Personally, I think neither of them are good solutions for very simple stores - there are simply cheaper, polished, off the shelf things that do that well.  No - these systems are for complex, bespoke e-commerce, where a substantial investment of time and money is used, to make something a bit special.  For my money, Commerce is the flexible, powerful content driven approach that nails this problem.  And Magento (in my limited experience of it) is an over complex, over priced, frustrating to work with alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies, this is a bit of a ramble.  Someone should come along and write a 'The Commerce Advantage' to match the Craft one...but hopefully this helps a bit!&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-14T01:14:47.303" LastActivityDate="2017-06-14T01:14:47.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18832" PostTypeId="1" CreationDate="2017-02-05T13:42:09.597" Score="1" ViewCount="465" Body="&lt;p&gt;I just playing first time with Matrix and can't figure whats wrong with this code, here's error code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;naglowekPowitanie&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Matrix field config:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/muClf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/muClf.png&quot; alt=&quot;config&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.homepage %}&#xA;        {% if block.type == &quot;powitanie&quot; %}&#xA;            &amp;lt;article id=&quot;main&quot;&amp;gt;&#xA;&#xA;                &amp;lt;header class=&quot;special container&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;icon fa-truck&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ block.naglowekPowitanie }}&amp;lt;/h2&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ block.trescPowitanie }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/header&amp;gt;&#xA;&#xA;        {% elseif block.type == &quot;wstep&quot; %}&#xA;                    &amp;lt;section class=&quot;wrapper style2 container special-alt&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row 50%&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;8u 12u(narrower)&quot;&amp;gt;&#xA;&#xA;                                &amp;lt;header&amp;gt;&#xA;                                    &amp;lt;h2&amp;gt;{{ block.wstepNaglowek }}&amp;lt;/h2&amp;gt;&#xA;                                &amp;lt;/header&amp;gt;&#xA;                                &amp;lt;p&amp;gt;{{ block.wstepTresc }}&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;footer&amp;gt;&#xA;                                    &amp;lt;ul class=&quot;buttons&quot;&amp;gt;&#xA;                                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;button&quot;&amp;gt;{{ block.wstepPrzycisk }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                    &amp;lt;/ul&amp;gt;&#xA;                                &amp;lt;/footer&amp;gt;&#xA;        {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="6229" LastEditDate="2017-02-05T14:24:25.430" LastActivityDate="2017-02-05T15:31:06.677" Title="Getting error: &quot;Matrix do not have a method or closure named...&quot;" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18833" PostTypeId="2" ParentId="18832" CreationDate="2017-02-05T15:31:06.677" Score="2" Body="&lt;p&gt;On your screenshot of the block type powitanie you see two fields: &lt;code&gt;powitanieNaglowek&lt;/code&gt; and &lt;code&gt;powitanieTresc&lt;/code&gt;. Yet, in your code you try to use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;h2&amp;gt;{{ block.naglowekPowitanie }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error simply says: in the block type you are using there is no field called &lt;code&gt;naglowekPowitanie&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing that H2 to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;h2&amp;gt;{{ block.powitanieNaglowek }}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should do the trick.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-02-05T15:31:06.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18835" PostTypeId="1" CreationDate="2017-02-05T22:31:43.030" Score="3" ViewCount="745" Body="&lt;p&gt;Have used the pretty neat &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt; and &lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow noreferrer&quot;&gt;Export&lt;/a&gt; plugins from Bob Olde Hamsink. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, those two do not handle Matrix data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is basically: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the 'most common way' to import and export data to/from Matrix fields in Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="5186" LastEditorUserId="142" LastEditDate="2017-02-06T08:14:20.907" LastActivityDate="2017-02-06T08:14:20.907" Title="Import-Export Matrixfield data" Tags="&lt;matrix&gt;&lt;migration&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18836" PostTypeId="2" ParentId="18835" CreationDate="2017-02-05T22:39:11.943" Score="2" Body="&lt;p&gt;Doesn't handle exporting data, but &lt;a href=&quot;https://sgroup.com.au/plugins/feedme&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; can handle importing XML or JSON content for most element types.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-05T22:39:11.943" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18837" PostTypeId="1" AcceptedAnswerId="18854" CreationDate="2017-02-06T05:03:59.040" Score="1" ViewCount="105" Body="&lt;p&gt;Is it possible to somehow (plugin or otherwise) modify the price of a lineItem/variant based on variables like material or any other additional modifier (basically affecting the same stock of items).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;Pillow (with variants being color)&#xA;— Stuffing material&#xA;— Print yes/no&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pillow base product itself is a finite number of items for each color, but the stuffing isn't fixed in that sense, effectively being infinite in terms of stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be possible to create separate products and use the Multi Add plugin for this, rather than doing some form of (preferably simpler) custom approach?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2017-02-07T00:00:04.747" Title="Add variable to purchasable variant to modify price?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18838" PostTypeId="2" ParentId="18814" CreationDate="2017-02-06T09:48:12.373" Score="2" Body="&lt;p&gt;Would using &lt;code&gt;{{ category.id }}&lt;/code&gt; work?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-02-06T09:48:12.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18839" PostTypeId="2" ParentId="18742" CreationDate="2017-02-06T09:52:59.490" Score="4" Body="&lt;p&gt;Two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Physically output all the floorplans in the markup &lt;code&gt;{% for block in entry.matrixHandle%}&lt;/code&gt; then hide them using CSS, and only display the one from the dropdown using JavaScript. Something like &lt;code&gt;$('#dropdown-id).on('change', function(){});&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Change the field from a Matrix so that each floorplan is a separate Entry and you visit each one with an &lt;code&gt;href=&quot;{{ entry.url }}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2017-02-07T15:37:27.280" LastActivityDate="2017-02-07T15:37:27.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18840" PostTypeId="1" AcceptedAnswerId="18841" CreationDate="2017-02-06T10:39:08.413" Score="2" ViewCount="395" Body="&lt;p&gt;I did at some point believe that the CSRF token my plugin requests was using expired in the middle of a request, but it turns out that they were never included in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still curious, I wonder how long a CSRF token lasts?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-02-06T10:39:08.413" Title="How long does a CSRF token lasts?" Tags="&lt;plugin-development&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18841" PostTypeId="2" ParentId="18840" CreationDate="2017-02-06T10:39:08.413" Score="3" Body="&lt;p&gt;Each session gets it's own CSRF token, so technically it will be valid as long as a session is valid.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-02-06T10:39:08.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18842" PostTypeId="1" CreationDate="2017-02-06T10:50:24.817" Score="1" ViewCount="48" Body="&lt;p&gt;I fell like I'm missing an obvious thing, how to end block before I will start the new one?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&#xA;{% if block.type == &quot;heading&quot; %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;h1&amp;gt;I don't want this text to be part of heading block&amp;lt;/h1&amp;gt;&#xA;&#xA;{% elseif block.type == &quot;text&quot; %}&#xA;&#xA;    {{ block.text|markdown }}&#xA;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;edit: here is my real code:&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# &quot;Check&quot; section #}&#xA;                    &amp;lt;section class=&quot;wrapper style1 container special&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;{# &quot;Check&quot; block #}&#xA;            {% elseif block.type == &quot;check&quot; %}&#xA;                            &amp;lt;div class=&quot;4u 12u(narrower)&quot;&amp;gt;&#xA;                                &amp;lt;section&amp;gt;&#xA;                                    &amp;lt;span class=&quot;icon featured fa-check&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;                                    &amp;lt;header&amp;gt;&#xA;                                        &amp;lt;h3&amp;gt;{{ block.checkHeader }}&amp;lt;/h3&amp;gt;&#xA;                                    &amp;lt;/header&amp;gt;&#xA;                                    &amp;lt;p&amp;gt;{{ block.checkText }}&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;/section&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;{# In this place block &quot;check&quot; should end #}&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/section&amp;gt;&#xA;{# end of &quot;check&quot; section#}&#xA;&#xA;{#beginning of &quot;gallery section&quot; #}&#xA;                        &amp;lt;section class=&quot;wrapper style3 container special&quot;&amp;gt;&#xA;                        &amp;lt;header class=&quot;major&quot;&amp;gt;&#xA;                            &amp;lt;h2&amp;gt;Next look at this &amp;lt;strong&amp;gt;cool stuff&amp;lt;/strong&amp;gt;&amp;lt;/h2&amp;gt;&#xA;                        &amp;lt;/header&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;{# &quot;gallery&quot; block #}&#xA;            {% elseif block.type == &quot;gallery&quot; %}&#xA;                            &amp;lt;div class=&quot;6u 12u(narrower)&quot;&amp;gt;&#xA;&#xA;                                &amp;lt;section&amp;gt;&#xA;                                    &amp;lt;a href=&quot;#&quot; class=&quot;image featured&quot;&amp;gt;&amp;lt;img src=&quot;someimagesoon.jpg&quot; alt=&quot;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;header&amp;gt;&#xA;                                        &amp;lt;h3&amp;gt;{{ block.imageHeader }}&amp;lt;/h3&amp;gt;&#xA;                                    &amp;lt;/header&amp;gt;&#xA;                                    &amp;lt;p&amp;gt;{{ block.imageText }}&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;/section&amp;gt;&#xA;{# In this place block &quot;gallery&quot; should end #}&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                        &amp;lt;footer class=&quot;major&quot;&amp;gt;&#xA;                            &amp;lt;ul class=&quot;buttons&quot;&amp;gt;&#xA;                                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;button&quot;&amp;gt;See More&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                            &amp;lt;/ul&amp;gt;&#xA;                        &amp;lt;/footer&amp;gt;&#xA;&#xA;                    &amp;lt;/section&amp;gt;&#xA;&#xA;            &amp;lt;/article&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="6229" LastEditDate="2017-02-06T12:50:37.083" LastActivityDate="2017-02-06T12:50:37.083" Title="How to skip fragments of code in Matrix?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18843" PostTypeId="2" ParentId="18842" CreationDate="2017-02-06T11:03:35.317" Score="1" Body="&lt;p&gt;Your question is rather vaguely but if I'm right:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could put an &quot;if&quot; statement around your &quot;h1&quot; element like,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.first %}&amp;lt;h1&amp;gt;This text will only be used if the lightswitch is active&amp;lt;/h1&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or add a field to the block. Preferably a lightswitch. Which if enabled will show the H1 tag and wont if you dont activate it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.lightSwitch %}&amp;lt;h1&amp;gt;This text will only be used in the first loop&amp;lt;/h1&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-06T11:03:35.317" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18844" PostTypeId="1" AcceptedAnswerId="18848" CreationDate="2017-02-06T13:03:01.853" Score="1" ViewCount="437" Body="&lt;p&gt;I run into the same error on each project setup with CraftCMS. So did I this time… again…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all: Yes, I seem to be a slow learner. And therefore I can't memorize to rename the htaccess file before calling the Craft installer page. ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When downloading CraftCMS the &lt;code&gt;.htaccess&lt;/code&gt; file is called &lt;code&gt;htaccess&lt;/code&gt; (without leading dot).&#xA;So, whenever I setup my Craft projects I have to rename the file that is located in /public.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I always forget about that. I always run into the problem that I get a &quot;503 Service Unavailable&quot; on requesting my new website using Craft. On requesting the admin panel (to start the installer) I get a &quot;404 Not Found&quot;. Then I only wonder and ask myself if I have made something terribly wrong…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only after some hard thinking about what's going on there I come accross the solution:&#xA;&lt;strong&gt;Rename &lt;code&gt;htaccess&lt;/code&gt; to &lt;code&gt;.htaccess&lt;/code&gt;.&lt;/strong&gt; Apache is not recognizing the one without dot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is happening always (and by &quot;always&quot; I mean each and every single time I start working on a new Craft project) to me and it's totally bothering me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why can't Craft jsut come with a correctly named &lt;code&gt;.htaccess&lt;/code&gt; file?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the public &lt;code&gt;htaccess&lt;/code&gt; file maybe named without the leading dot to not be hidden on operating systems like MacOSX? So you can copy files from folder to folder without missing hidden ones?&#xA;I mean, Craft is made for developers. Come on, guys. Developers should know to have in mind hidden files when copying them to a new project's destination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, why just not delivering Craft with &lt;code&gt;.htaccess&lt;/code&gt; in /public folder instead of &lt;code&gt;htaccess&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guarantee you guys that I will forget about the renaming again before calling the URL of my next Craft project.&lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2017-02-06T15:31:05.830" Title="Why is htaccess file not named &quot;.htaccess&quot; on fresh install?" Tags="&lt;install&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18845" PostTypeId="2" ParentId="18844" CreationDate="2017-02-06T13:28:19.353" Score="2" Body="&lt;p&gt;It depends on how you run Craft.&#xA;I use Valet which doesn't work with Apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's basically there if you need it, but it's not mandatory.&lt;/p&gt;&#xA;" OwnerUserId="6155" LastActivityDate="2017-02-06T13:28:19.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18846" PostTypeId="2" ParentId="18427" CreationDate="2017-02-06T14:35:58.447" Score="2" Body="&lt;p&gt;See this tutorial by Algolia for autocomplete search: &lt;a href=&quot;https://www.algolia.com/doc/guides/search/auto-complete/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.algolia.com/doc/guides/search/auto-complete/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would use Search Plus only to keep your index in sync with your sections&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-02-06T14:35:58.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18847" PostTypeId="1" CreationDate="2017-02-06T14:47:53.567" Score="0" ViewCount="222" Body="&lt;p&gt;I'm currently working with a client who has several hundred photos in a gallery. The gallery consists of albums within albums. The link to their current gallery is here: &lt;a href=&quot;http://www.fmquizzing.net/gallery2/main.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.fmquizzing.net/gallery2/main.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on an entire site update and would like to update their photo gallery to integrate directly with Craft if possible. They currently have the photos in folders on their server pulled in dynamically with a PHP script. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good way to go about creating a gallery like this with Craft, or is it going to be just as good to attempt updating the styles and script on what they already have going? Trying to think both about short term and long term development and maintainability costs.&lt;/p&gt;&#xA;" OwnerUserId="6235" LastActivityDate="2017-04-08T04:18:36.260" Title="Creating a multi-dimensional Photo Gallery on Craft CMS" Tags="&lt;templating&gt;&lt;gallery&gt;&lt;integration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18848" PostTypeId="2" ParentId="18844" CreationDate="2017-02-06T15:31:05.830" Score="9" Body="&lt;p&gt;Because files that start with a &lt;code&gt;.&lt;/code&gt; are considered &quot;hidden&quot; by many file systems (specifically OSX default).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the file is hidden, then there's a good chance that the user won't know about it, and won't be able to FTP it to the server. It's better for the file to be intentionally misnamed, rather than accidentally hidden. &lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-02-06T15:31:05.830" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18849" PostTypeId="2" ParentId="18815" CreationDate="2017-02-06T19:54:53.793" Score="2" Body="&lt;p&gt;Completely untested, but try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('hotels').order('(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 4) ELSE title END )') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MySQL's &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_ltrim&quot; rel=&quot;nofollow noreferrer&quot;&gt;LTRIM&lt;/a&gt; isn't what you want because that just removes leading spaces.  &lt;code&gt;SUBSTRING&lt;/code&gt; should do it, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep in mind this is a MySQL specific query.  If you ever planning on running on PostgreSQL (that the Craft 3 beta supports), it would have to be adjusted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-06T19:54:53.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18850" PostTypeId="1" CreationDate="2017-02-06T21:59:32.390" Score="6" ViewCount="251" Body="&lt;p&gt;I'm looking to reorder my selected categories within a category field. I'm hoping this is possible because the order an editor selects these categories is important, primarily for the &lt;code&gt;.first()&lt;/code&gt; category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This functionality is currently possible using the entries fieldtype:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://cl.ly/0x0i3z2E0Z2d/Screen%20Recording%202017-02-06%20at%2004.15%20PM.gif&quot; alt=&quot;reorder entries&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But not for the categories fieldtype: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://cl.ly/1Y1q3X3k2g12/Screen%20Recording%202017-02-06%20at%2004.55%20PM.gif&quot; alt=&quot;reorder categories&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; The order is important here because this field determines where a given piece of content shows up on the site. Our main navigation is defined by these categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if a piece of content is tagged with &quot;Lifelong Health&quot; and &quot;Health Conditions&quot;, but the content editor only wants it to show up on the &quot;Lifelong Health&quot; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want an editor to be able to specify multiple categories however, because we have some robust related category action going on, and we have plans on adding in some personalization in a later phase. Having these robust relationships is vital.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the interim, we've created a second field &quot;Secondary Categories&quot; that an editor can select, and limited the &quot;Category&quot; field to only one selection; but ultimately we'd like to be able to reorder the categories in one field.&lt;/p&gt;&#xA;" OwnerUserId="218" LastEditorUserId="218" LastEditDate="2017-02-08T13:32:23.047" LastActivityDate="2018-12-12T15:59:56.597" Title="Reorder selection of categories in category fieldtype" Tags="&lt;categories&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18852" PostTypeId="2" ParentId="1268" CreationDate="2017-02-06T23:02:54.313" Score="5" Body="&lt;p&gt;For those bumping into this &lt;code&gt;old-ish&lt;/code&gt; question and looking for a similar solution: Andrew Welch has recently released a plugin that allows you to pull field values from a globalset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/richvariables&quot;&gt;https://github.com/nystudio107/richvariables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not letting you write Twig templates, but it allows you do achieve what is described in the OP, namely output a custom field value inside the Rich Text Editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="4130" LastActivityDate="2017-02-06T23:02:54.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18853" PostTypeId="1" AcceptedAnswerId="18855" CreationDate="2017-02-06T23:22:17.030" Score="0" ViewCount="1746" Body="&lt;p&gt;I have a dropdown field with X options.  I want to print each option as a button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for option in entry.isotope.options %}&#xA;        &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;isotope = dropdownFieldHandle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I get the error &lt;code&gt;Variable &quot;entry&quot; does not work'&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2017-02-07T00:19:16.237" LastActivityDate="2017-02-07T00:31:54.123" Title="How do I print the options in a dropdown field?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18854" PostTypeId="2" ParentId="18837" CreationDate="2017-02-07T00:00:04.747" Score="2" Body="&lt;p&gt;I think Multi Add will be the simplest approach here - it really won't be hard with that, and Luke repeated recently that multi-add will become core, so apart from some possible minor template modification later, it seems a sensible way to build this - and will be simpler (going forward as  well) than writing a new plugin for it, where you'll have to take a lot more care with your extra logic for shipping/tax etc.  Multi add just adds multiple products, but leverages core ine very other way, so it's a very robust solution.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-07T00:00:04.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18855" PostTypeId="2" ParentId="18853" CreationDate="2017-02-07T00:22:52.157" Score="4" Body="&lt;p&gt;There's not an &quot;elegant&quot; way to do this but you can access the dropdown field by its handle using &lt;code&gt;getFieldByHandle&lt;/code&gt;. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdownField = craft.fields.getFieldbyHandle('isotope') %}&#xA;&#xA;  {% for option in dropdownField.settings.options %}&#xA;    &amp;lt;li&amp;gt;{{ option.value }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need the label instead, just use &lt;code&gt;{{ option.label }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also grab a dropdown's options from any entry you know has the field already attached, such as the first entry from your &lt;code&gt;news&lt;/code&gt; section for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').limit(1)[0] %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for option in  entry.isotope.options %}&#xA;    &amp;lt;li&amp;gt;{{ option.value }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2205/how-do-i-output-a-dropdowns-values-if-im-on-a-registration-form-not-tied-to-an&quot;&gt;this&lt;/a&gt; question.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-07T00:31:54.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18856" PostTypeId="2" ParentId="18847" CreationDate="2017-02-07T03:40:33.673" Score="1" Body="&lt;p&gt;Ah yes, &lt;a href=&quot;http://galleryproject.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;gallery2&lt;/a&gt;. Used that quite extensively a few years ago. Have a client with an old gallery2 project as well, we might be doing something with it, so we're probably in the same boat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can tell you the last time I looked into the gallery project, they were shutting it down. I have no idea where the project stands now, the original authors wanted someone to take it over if possible. The website is still active but when a project is in limbo, it's never a good sign. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrating it with Craft is going to be an exercise in futility and it's going to be just as easy to get the original photos working inside Craft &quot;natively&quot;. Craft can really do everything Gallery can do... and better because now you can do things  like relate photos back to actual content entries and more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a quick glance at a lot of the site's galleries and it looks like they're not really doing anything special, hardly using any of the gallery features (like tags, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gallery stores all of its photos in a folder called &lt;code&gt;g2_data&lt;/code&gt;. You could grab that folder,  throw it up in a Craft asset source, have Craft index that folder, and everything will be neatly organized by folder ready to roll. Make some Entries that correspond to albums and sub albums and then go to town adding them to each entry/album. Telling Craft about which photos live in which album is going to be the most time consuming but since Gallery 2 stores them hierarchically, at least you have a visual reference vs something simply stored in a flat database structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as maintainability, Craft is the easiest CMS I've ever had the privilege of using. A lot of my clients figure out most of the control panel before we even have the training session. I remember Gallery2 being very finicky about clearing caches, generating thumbnails, etc. All of this will be handled mostly automatically by Craft.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-02-07T03:46:25.177" LastActivityDate="2017-02-07T03:46:25.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18857" PostTypeId="1" CreationDate="2017-02-07T07:30:10.470" Score="1" ViewCount="34" Body="&lt;p&gt;Is it correct to assume that if I set up a Sale with some Specific Products in the Condition, it will not have any effect to also select Product Types in the Conditions of that sale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. If I select both Product Types and Specific Products, does the sale apply to all the products in the selected types, and &lt;em&gt;also&lt;/em&gt; to the selected specific products, or (my current understanding of the &quot;correct behavior&quot;) would that sale apply to only the selected specific products?&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2017-02-07T07:45:05.893" Title="Sales that select both Product Types and Specific Products in the Conditions" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18858" PostTypeId="2" ParentId="18857" CreationDate="2017-02-07T07:45:05.893" Score="1" Body="&lt;p&gt;A blank selection of products or product types will match all products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both 'product type' and 'product' conditions need to match for the sale to match the product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you selected product type A and a single product from product type B in your conditions, then the sale would not apply to the single product from type B even if added to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore the condition could be thought of as an AND, meaning that all conditions need to match for the sale to apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need further clarification.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-07T07:45:05.893" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18859" PostTypeId="1" AcceptedAnswerId="18879" CreationDate="2017-02-07T10:25:40.530" Score="1" ViewCount="88" Body="&lt;p&gt;I'm trying to loop on locales to get the path to the current entry, but for the other locales (for a language switcher).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = craft.i18n.getSiteLocales() %}&#xA;{% for locale in locales %}&#xA;&#xA;    {% set localeEntry = craft.entries.id(entry.id).locale(locale.id).first %}&#xA;&#xA;        {{dump(localeEntry.locale)}}&#xA;        {{dump(localeEntry.getUrl()) }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;en&quot;&#xA;&quot;http://website.dev/en/page&quot;&#xA;&#xA;&quot;en_gb&quot;&#xA;&quot;http://website.dev/en/page&quot;&#xA;&#xA;&quot;en_us&quot;&#xA;&quot;http://website.dev/en/page&quot;&#xA;&#xA;&quot;de&quot;&#xA;&quot;http://website.dev/de/page&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The language only versions are fine &lt;code&gt;en&lt;/code&gt; and &lt;code&gt;de&lt;/code&gt;, though the language-location versions are incorrect. These are all set correctly in my config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here?&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-02-08T09:48:44.297" Title="locale loop doesn't get correct path" Tags="&lt;templating&gt;&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18862" PostTypeId="1" AcceptedAnswerId="18873" CreationDate="2017-02-07T14:45:53.460" Score="2" ViewCount="860" Body="&lt;p&gt;I'm working on getting charge to take donations and have set up my Expiration date field the same as in the demos.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;col-6&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;cardExpiry&quot; class=&quot;form-label&quot;&amp;gt;Expiration Date&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; data-stripe=&quot;exp&quot;  id=&quot;cardExpiry&quot; placeholder=&quot;mm / yy&quot; required&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However on form submission (in test mode) I see this error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Missing required param: exp_month.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not sure how to resolve this. Please advise&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-02-07T20:35:22.313" Title="Charge/Stripe and &quot;Missing required param: exp_month.&quot;" Tags="&lt;templating&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18864" PostTypeId="1" CreationDate="2017-02-07T15:11:07.323" Score="3" ViewCount="1010" Body="&lt;p&gt;Site construct question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have categories.   Craft knows where to find the template for a category - i.e. &lt;code&gt;markets/{slug}&lt;/code&gt;.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I also have a Market&lt;strong&gt;s&lt;/strong&gt; (categories) page with the first 6 entries for each category (market).  The template is &lt;code&gt;markets/index.html&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same holds true for and index page with all my entries.  Craft knows where to find an entry &lt;code&gt;posts/_entry&lt;/code&gt; - but what about the &lt;code&gt;posts/index&lt;/code&gt; page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How should these pages be setup/defined in Craft - should they be a single page or something else?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Background - Right now, they aren't defined in Craft - but I realize that I probably need to add them to work with an SEO plugin.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="642" LastEditDate="2018-06-01T09:02:48.460" LastActivityDate="2018-06-01T09:02:48.460" Title="How should an index page be setup/defined in Craft?" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18865" PostTypeId="2" ParentId="18864" CreationDate="2017-02-07T15:33:25.110" Score="4" Body="&lt;p&gt;Depending on the rest of your site structure, yes you can set these up as Singles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your other option is to use an Entry Type inside a 'pages' Structure, and in that template you list the first 6 categories in a defined Category Group (possibly selected in a dropdown, or through &lt;code&gt;craft.request.segment()&lt;/code&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation link on how Craft looks for index templates in case it's useful: &lt;a href=&quot;https://docs.craftcms.com/v3/templates.html#index-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/templates.html#index-templates&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="642" LastEditorUserId="-1" LastEditDate="2018-05-30T23:39:51.013" LastActivityDate="2018-05-30T23:39:51.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="18866" PostTypeId="2" ParentId="18817" CreationDate="2017-02-07T16:36:00.923" Score="1" Body="&lt;p&gt;Found a solution, I needed: &lt;code&gt;{% if entry.hasDescendants() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hasDescendants() %}&#xA;&#xA;    &amp;lt;div class=&quot;section bg-pattern&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;col-24 gutter-bottom--half &quot;&amp;gt;&#xA;                &amp;lt;h3&amp;gt;Available {{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                {% for entry in craft.entries.section('yourAdventures').descendantOf( entry.id).find() %}&#xA;&#xA;                    ...&#xA;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2017-02-08T00:42:50.180" LastActivityDate="2017-02-08T00:42:50.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18867" PostTypeId="1" CreationDate="2017-02-07T17:05:21.220" Score="1" ViewCount="427" Body="&lt;p&gt;I'm trying to retrieve the settings that a user sets in a Craft 3 plugin. The method I used in Craft 2 plugins doesn't seem to work anymore. To demonstrate the problem, I'd made a plugin and uploaded it to GitHub to demonstrate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically though, when I trace out my plugin's settings, I can see the value that is custom set in the trace readout. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::trace($this-&amp;gt;settings, __METHOD__);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{s:9:&quot;someField&quot;;s:17:&quot;MY CUSTOM MESSAGE&quot;;s:14:&quot;' . &quot;\0&quot; . '*' . &quot;\0&quot;&#xA;  . 'classSuffix&quot;;s:5:&quot;Model&quot;;s:23:&quot;' . &quot;\0&quot; . 'yii\base\Model' . &quot;\0&quot;&#xA;  . '_errors&quot;;N;s:27:&quot;' . &quot;\0&quot; . 'yii\base\Model' . &quot;\0&quot; .&#xA;  '_validators&quot;;N;s:25:&quot;' . &quot;\0&quot; . 'yii\base\Model' . &quot;\0&quot; .&#xA;  '_scenario&quot;;s:7:&quot;default&quot;;s:27:&quot;' . &quot;\0&quot; . 'yii\base\Component' .&#xA;  &quot;\0&quot; . '_events&quot;;a:0:{}s:30:&quot;' . &quot;\0&quot; . 'yii\base\Component' . &quot;\0&quot;&#xA;  . '_behaviors&quot;;N;}')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I try to access this value directly though, I'm only ever able to get the default value. I had expected to return the user customize value instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::trace($this-&amp;gt;settings-&amp;gt;someField, __METHOD__);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Some Default&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's a link to the full 'non-working' version of the plugin that demonstrates the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/johnfmorton/craft3settingsTestPlugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/johnfmorton/craft3settingsTestPlugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is how can I retrieve the individual settings for my Craft 3 plugin?&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2017-02-07T17:05:21.220" Title="Retrieving custom settings in Craft 3 plugin" Tags="&lt;plugin-development&gt;&lt;settings&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2017-02-08T19:19:26.977" ContentLicense="CC BY-SA 3.0" />
  <row Id="18868" PostTypeId="1" AcceptedAnswerId="18870" CreationDate="2017-02-07T17:40:56.053" Score="1" ViewCount="122" Body="&lt;p&gt;I have some entries that have more than one category assigned to them (under the same category group).  For example, Entry X might be assigned to Category A and Category D.   How do I get it to print &lt;code&gt;&quot;Category A **and** Category B&quot;&lt;/code&gt; instead of &lt;code&gt;Category A Category B&quot;&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-02-08T17:22:01.180" Title="How can I add &quot;and&quot; between multiple categories assigned to an entry?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18869" PostTypeId="1" CreationDate="2017-02-07T17:46:52.367" Score="1" ViewCount="267" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace Freeform&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone submits a form on &lt;code&gt;/de/contact&lt;/code&gt; I want it to go to a German admin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone submits a form on &lt;code&gt;/en/contact&lt;/code&gt; I would like it to go to an English admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Expression Engine, you used to be able to set recipients in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the best way to deal with this to setup a &quot;Dynamic Recipient&quot; field, then hide it in the markup and somehow deal with this on a locale conditional?&lt;/p&gt;&#xA;" OwnerUserId="585" LastEditorUserId="57" LastEditDate="2017-02-08T00:47:46.117" LastActivityDate="2017-02-08T00:47:46.117" Title="Possible to get the Freeform plugin to send to different admins based on locale" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18870" PostTypeId="2" ParentId="18868" CreationDate="2017-02-07T17:53:38.347" Score="3" Body="&lt;p&gt;Loop through the categories of the entry, add and if it's not the last loop index, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in  entry.categoryFieldHandle %}&#xA; {{category.title}} {{ loop.last ? '': 'and '}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-02-07T17:53:38.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18871" PostTypeId="1" CreationDate="2017-02-07T18:39:14.387" Score="0" ViewCount="346" Body="&lt;p&gt;Some categories have 2 levels, some only have 1 level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I print the &quot;last&quot; level of an entry if for some it is level(2) and others it is level(1)?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-02-07T23:29:01.383" Title="How do I print the last level of a category?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18872" PostTypeId="1" AcceptedAnswerId="18878" CreationDate="2017-02-07T19:30:20.927" Score="1" ViewCount="503" Body="&lt;p&gt;I want to add a checkbox field to all my entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the key factor being that if 3 entries from 100 have this checkbox enabled, the 3 entries will show in the list of 100+ entries with a specific colour/sign/ anything really that makes it stand out and shows that this entry has this field checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im hoping I made sense!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5435" LastActivityDate="2017-02-07T23:47:27.487" Title="Is it possible to view entries in admin panel list view with specific field?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18873" PostTypeId="2" ParentId="18862" CreationDate="2017-02-07T20:35:22.313" Score="3" Body="&lt;p&gt;I got this resolved by official support.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;When using the combined date input you'll need to include the exp_month and exp_year inputs as hidden fields in the form. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's the working hidden fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpMonth&quot; value=&quot;&quot; data-stripe=&quot;exp_month&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpYear&quot; value=&quot;&quot;data-stripe=&quot;exp_year&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-02-07T20:35:22.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18875" PostTypeId="1" AcceptedAnswerId="18876" CreationDate="2017-02-07T22:18:57.480" Score="1" ViewCount="147" Body="&lt;p&gt;Prev and Next stop working after 100 entries..  There are no template errors.  I can access the pages for the individual entries - but Next and Previous are blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my set up...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set criteria = {section: 'posts'} %}&#xA;{% set prev = entry.getPrev(criteria) %}&#xA;{% set next = entry.getNext(criteria) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if prev %}&lt;/code&gt;&#xA;&lt;strong&gt;&lt;code&gt;my html ...{{ prev.url }} ...my html&lt;/code&gt;&lt;/strong&gt;&#xA;&lt;code&gt;{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same holds true for next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once there was a template error referencing a null value on prev.url - and referencing an entry ID that no longer appears to exists.  However, I discovered that I had had &lt;code&gt;prev&lt;/code&gt; under &lt;code&gt;if next&lt;/code&gt;.  That is the only time I was able to produce a template error.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-02-07T23:09:10.407" Title="getPrev and getNext stop working after 100+ entries" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18876" PostTypeId="2" ParentId="18875" CreationDate="2017-02-07T23:09:10.407" Score="4" Body="&lt;p&gt;In your criteria, you need to set the &lt;code&gt;limit&lt;/code&gt; to &lt;code&gt;null&lt;/code&gt; as by default Craft only returns up to 100 entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14453/default-craft-entry-limit&quot;&gt;Default Craft entry limit&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-07T23:09:10.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18877" PostTypeId="2" ParentId="18871" CreationDate="2017-02-07T23:29:01.383" Score="1" Body="&lt;p&gt;I've not actually done this, but I'm guessing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set category = entry.categoriesFieldHandle.last() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(...then &lt;code&gt;.level&lt;/code&gt; on that to get the level if that's what you want).  &lt;code&gt;.last()&lt;/code&gt; is the opposite of &lt;code&gt;first()&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Make sure you check &lt;code&gt;category|length&lt;/code&gt; as it might be that no categories are assigned...)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-07T23:29:01.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18878" PostTypeId="2" ParentId="18872" CreationDate="2017-02-07T23:47:27.487" Score="1" Body="&lt;p&gt;You can use the cog at the bottom of the panel to choose which columns to show in the entries table&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/08yC5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/08yC5.png&quot; alt=&quot;Cog to change which columns are shown&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then highlights which entries have the checkbox enabled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oYjsx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oYjsx.png&quot; alt=&quot;Shows which entries have the the checbox selected&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I don't think you can sort on this sort of column with core.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some plugins may help here, if you want more control, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/mmikkel/CpSortableCustomColumns-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mmikkel/CpSortableCustomColumns-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or for a lot more options/control in this area:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://zenbustudio.com/software/zenbu-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://zenbustudio.com/software/zenbu-craftcms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-07T23:47:27.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18879" PostTypeId="2" ParentId="18859" CreationDate="2017-02-08T09:48:44.297" Score="2" Body="&lt;p&gt;Turns out the issue was my config set incorrectly. I was doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://website.dev/en',&#xA;    'en-gb' =&amp;gt; 'http://website.dev/en-gb',&#xA;    'en-us' =&amp;gt; 'http://website.dev/en-us',&#xA;    'en-au' =&amp;gt; 'http://website.dev/en-au',&#xA;    'en-nz' =&amp;gt; 'http://website.dev/en-nz'&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the array keys need to match the way they are set in craft with underscores (and your public/locale/index.php file)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://website.dev/en',&#xA;    'en_gb' =&amp;gt; 'http://website.dev/en-gb',&#xA;    'en_us' =&amp;gt; 'http://website.dev/en-us',&#xA;    'en_au' =&amp;gt; 'http://website.dev/en-au',&#xA;    'en_nz' =&amp;gt; 'http://website.dev/en-nz'&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-02-08T09:48:44.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18880" PostTypeId="2" ParentId="18864" CreationDate="2017-02-08T11:32:17.430" Score="2" Body="&lt;p&gt;Unless taking the structure route because there's a need for multiple index pages, I generally create a Single for each index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case I'd probably create two singles called 'Markets / Overview' and 'Pages / Overview'. I wouldn't display those titles necessarily in the template but I've found displaying 'Name of section / Overview' within the control panel helps the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes the index page needs to be editable at all, but normally I find I need a couple of meta fields on every page on the site.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-02-09T09:01:17.777" LastActivityDate="2017-02-09T09:01:17.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18882" PostTypeId="1" AcceptedAnswerId="18883" CreationDate="2017-02-08T13:07:21.060" Score="1" ViewCount="107" Body="&lt;p&gt;Would it be possible that when you create a new entry, it's not activated by default?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is a &quot;Draft&quot; option...  But is there an option for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best,&#xA;Marcel&lt;/p&gt;&#xA;" OwnerUserId="5847" LastActivityDate="2017-02-08T14:29:53.453" Title="Entry should not activated by default" Tags="&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18883" PostTypeId="2" ParentId="18882" CreationDate="2017-02-08T14:29:53.453" Score="2" Body="&lt;p&gt;You can change the default entry status in your section settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: If I would set the German toggle to disabled, all entries added to German local will be disabled by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q0Hm4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q0Hm4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-08T14:29:53.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18884" PostTypeId="1" AcceptedAnswerId="18895" CreationDate="2017-02-08T14:39:05.120" Score="1" ViewCount="1066" Body="&lt;p&gt;I'm trying to limit the amount of entries on my page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I want 1 news entry (based on if the checkbox is ticked, there could be 10 entries with the checkbox ticked but I only want to show 1 (the latest)) The issue is that the &lt;code&gt;limit()&lt;/code&gt; twig function doesn't work with my &lt;code&gt;elementCriteriaModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Checking if any news entries have the FeaturedEntry field completed #}&#xA;{% for entry in craft.entries.section('news').level(2) %}&#xA;&#xA;    {% if entry.featured.contains('isFeatured') %}&#xA;&#xA;        {% set news = craft.entries.section('news') %}&#xA;&#xA;            &amp;lt;div class=&quot;insight orange&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                    &amp;lt;h4&amp;gt;News *Chosen*&amp;lt;/h4&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;div class=&quot;details&quot;&amp;gt;&#xA;                        &amp;lt;span class=&quot;author&quot;&amp;gt;{{entry.author}}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;    {% else %}&#xA;            Do Something Else Here&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I attach the limit function to &lt;code&gt;{% for entry in craft.entries.section('news').level(2).limit(1) %}&lt;/code&gt;, this only limits the amount of entries my selector can check for the featured field. If i put &lt;code&gt;limit(1)&lt;/code&gt; it only checks the first news entry for the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know i can use the slice function but I'm having some trouble inserting it into the right place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5435" LastEditorUserId="57" LastEditDate="2017-02-08T19:09:04.417" LastActivityDate="2017-02-08T19:09:04.417" Title="How to limit the amount of entries that is output when limit doesn't work" Tags="&lt;entry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18885" PostTypeId="1" AcceptedAnswerId="18897" CreationDate="2017-02-08T14:46:57.500" Score="1" ViewCount="283" Body="&lt;p&gt;I'm having a strange issue where pages aren't loading on the staging site that were all working fine on the local.dev site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Section called &lt;strong&gt;Available Homes&lt;/strong&gt; and in that section it has two Entry types called &lt;strong&gt;Available Homes&lt;/strong&gt; and &lt;strong&gt;Plot&lt;/strong&gt; which link to two entry templates, that are dynamically called from the main entry.html.twig template, which then links to the sub folder &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/entry&#xA;  /availablehomes&#xA;    availablehomes.html.twig&#xA;    plot.html.twig&#xA;  default.html.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sections Entry URL Format is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;developments/{counties.first.slug}/{developments.first.slug}/available-homes&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and nested entries get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the template from entry in the control panel to different template then it loads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the entry template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include [&#xA;  &quot;entry/&quot; ~ entry.section.handle ~ &quot;/&quot; ~ entry.type,&#xA;  &quot;entry/default&quot;&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone help please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CuQ7a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CuQ7a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-02-08T15:55:19.630" LastActivityDate="2017-02-08T18:55:04.243" Title="Dynamic entry template not loading on staging site but works on local.dev" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18886" PostTypeId="2" ParentId="18884" CreationDate="2017-02-08T14:48:22.560" Score="1" Body="&lt;p&gt;What you probably want is to order them by date and than select the first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries.section('news').order('postDate desc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you want to use limit somewhere (but I don't think this is what you are trying to get here) you should add limit(1) to this &lt;code&gt;{% set news = craft.entries.section('news').limit(1) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-08T14:48:22.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18887" PostTypeId="1" AcceptedAnswerId="18904" CreationDate="2017-02-08T14:52:43.787" Score="0" ViewCount="98" Body="&lt;p&gt;I use Matrix to select products through a &quot;Commerce Products&quot; field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template, the following code displays nothing (not even an error in devMode.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixHandle %}&#xA;    {% set relatedProducts = craft.commerce.products.relatedTo({&#xA;        targetElement: entry, field: 'BlockTypeHandle.FieldHandle'&#xA;    }) %}&#xA;&#xA;    {% for entry in relatedProducts %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastEditorUserId="57" LastEditDate="2017-02-08T18:49:24.900" LastActivityDate="2017-02-08T23:03:50.940" Title="Commerce products in Matrix" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18888" PostTypeId="2" ParentId="18734" CreationDate="2017-02-08T14:59:32.517" Score="2" Body="&lt;p&gt;This makes more sense :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically, you want to have info from one entry on multiple pages and your problem is that in the section settings, you can only define 1 template for an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to go about this is to create your own urls when clicking on an entry where you add the {slug} of your entry to the url, something like this: &lt;code&gt;{siteUrl}/episode-guide/recap/{entry.slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; for this url that takes you to (for example) the recap.html template. Here you just get the last segment (being the slug) and retrieve the correct entry from your database and show only the recap info.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entrySlug = craft.request.lastSegment() %}&#xA;{% set entry = craft.entries.section(&quot;sectionName&quot;).slug(entrySlug) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-08T14:59:32.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18889" PostTypeId="2" ParentId="18815" CreationDate="2017-02-08T15:57:27.630" Score="1" Body="&lt;p&gt;Just a little tweak, and double quotes needed around the thing it is LIKE.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('hotels').order('(CASE WHEN title LIKE &quot;The %&quot; THEN SUBSTRING(title, 3) ELSE title END ) asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-02-08T15:57:27.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18890" PostTypeId="1" CreationDate="2017-02-08T16:35:32.407" Score="0" ViewCount="79" Body="&lt;p&gt;We are encountering an issue where some/most of our blog pages are not indexing with Google. Some random blog pages are indexed but most are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pages are being rendered correctly by the google bot but are not being indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is our _entry.html that pulls in the craft blog and renders the individual blog view:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = entry.title ~ &quot; | Blog&quot; %}&#xA;&#xA;{% if entry.metaDescription | length &amp;gt; 0 %}&#xA;    {% set description = entry.metaDescription  %}&#xA;{%else%}&#xA;    {% set description = entry.body|split('&amp;lt;/p&amp;gt;') [0] | striptags | slice(0, 144)  %}&#xA;{%endif%}&#xA;&#xA;{% block meta_tags %}&#xA;    {{ siteMacros.returnMetaTags({&#xA;            'description' : description,&#xA;            'og:title' : entry.title ~ ' | Default Titlge Here',&#xA;            'og:image' : siteUrl ~ 'assets/favicons/favicon-196x196.png'&#xA;        }) &#xA;    }}&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;&#xA;    &amp;lt;h1 class=&quot;main-page-title&quot;&amp;gt;{{entry.title}}&amp;lt;/h1&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;entry-container&quot;&amp;gt;&#xA;        &amp;lt;article&amp;gt;&#xA;            {% include 'content_blocks/_entryBody.html' %}&#xA;        &amp;lt;/article&amp;gt;&#xA;&#xA;        &amp;lt;aside&amp;gt;&#xA;            {% include 'content_blocks/_blogCategoryList.html' %}&#xA;        &amp;lt;/aside&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just filters everything through the _entrybody.html which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros' as siteMacros %}&#xA;&#xA;{%if entry.subHead | length %}&#xA;    &amp;lt;h2&amp;gt;{{entry.subHead}}&amp;lt;/h2&amp;gt;&#xA;{%endif%}&#xA;    {% if entry.image | length %}&#xA;        {% set image = entry.image.first() %}&#xA;    {% elseif entry.curataImage | length %}&#xA;        {% set image = entry.curataImage %}&#xA;    {%endif%}&#xA;&#xA;    {% if image | length %}&#xA;        {{ siteMacros.responsiveImage(image) }}&#xA;    {%endif%}&#xA;&#xA;    {%if entry.video | length %}&#xA;    &amp;lt;iframe src=&quot;{{ craft.videoEmbed.getEmbedUrl(entry.video) }}&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;    {%endif%}&#xA;&#xA;    &amp;lt;div class=&quot;content-body&quot;&amp;gt;&#xA;        {% set paragraphs = entry.body|split('&amp;lt;/p&amp;gt;') %}&#xA;        {% set pfirstBreak = (paragraphs | length / 2 ) | round - 1 %}&#xA;        {% set firstParagraphs = paragraphs | slice (0, pfirstBreak) %}&#xA;        {% set lastParagraphs = paragraphs | slice (pfirstBreak, paragraphs | length ) %}&#xA;&#xA;        {% for p in firstParagraphs %}&#xA;            {{p|raw}}&#xA;        {%endfor%}&#xA;&#xA;        {%if entry.pullQuote | length %}&#xA;            &amp;lt;blockquote&amp;gt;&#xA;                {{entry.pullQuote}}&#xA;            &amp;lt;/blockquote&amp;gt;&#xA;        {%endif%}&#xA;&#xA;        {% for p in lastParagraphs %}&#xA;            {{p|raw}}&#xA;        {%endfor%}&#xA;&#xA;        {% if entry.pdf | length %}&#xA;            &amp;lt;div class=&quot;documents&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;&amp;lt;small&amp;gt;Related Documents:&amp;lt;/small&amp;gt;&amp;lt;/span&amp;gt;&#xA;                {%for pdf in entry.pdf %}&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{pdf.url}}&quot;&amp;gt;{{pdf.title}} [pdf]&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                {%endfor%}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {%endif%}&#xA;&#xA;&#xA;        {% if entry.referringSite | length  and  entry.readMoreLink | length %}&#xA;            &amp;lt;p&amp;gt;Read the full article at &amp;lt;a target=&quot;_blank&quot; href=&quot;{{entry.readMoreLink}}&quot;&amp;gt;{{entry.referringSite}}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% if not hidePostDate %}&#xA;        {% set category = entry.category.first %}&#xA;        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Posted {{ entry.postDate.format('F j, Y') }}{% if category | length %} in {{category.link}}{%endif%}.&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm unsure why any of this would cause the pages not to be indexed by google. Some pages are indexed that go through this same code but others are not.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2017-02-08T16:49:40.427" Title="Blog pages not indexing SEO" Tags="&lt;index&gt;&lt;seo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18891" PostTypeId="2" ParentId="18890" CreationDate="2017-02-08T16:42:03.967" Score="1" Body="&lt;p&gt;Just because Google has not indexed your pages doesn't mean there isn't necessarily anything wrong. Have you gone into the group Google search console to see what pages it has actually consumed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you might consider trying SEOmatic to handle your SEO:  &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-08T16:42:03.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18892" PostTypeId="2" ParentId="18890" CreationDate="2017-02-08T16:49:40.427" Score="1" Body="&lt;p&gt;Well, this isn't a Craft issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can submit a URL to be indexed via the &quot;render&quot; tab in Google Search Console. IIRC not all will necessarily be indexed straight away, even if submitted by itself, it may take time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might find more info on this on the Webmasters Forum: &lt;a href=&quot;https://productforums.google.com/forum/#!forum/webmasters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://productforums.google.com/forum/#!forum/webmasters&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-02-08T16:49:40.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18893" PostTypeId="2" ParentId="18868" CreationDate="2017-02-08T17:22:01.180" Score="2" Body="&lt;p&gt;The accepted answer will work, certainly, but thanks to the way Craft works behind the scenes there is a more compact and elegant solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.categoryFieldHandle|join(' and ') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Why this works&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The Entry's category field (accessed via &lt;code&gt;entry.categoryFieldHandle&lt;/code&gt;) returns an &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, which implements &lt;a href=&quot;http://php.net/manual/en/class.arrayaccess.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP's ArrayAccess interface&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In plain English, this means that we can treat the ElementCriteriaModel as an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ElementCriteriaModel returns a collection of &lt;a href=&quot;https://craftcms.com/classreference/models/CategoryModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;CategoryModel&lt;/a&gt; objects, each of which implements &lt;a href=&quot;http://php.net/manual/en/language.oop5.magic.php#object.tostring&quot; rel=&quot;nofollow noreferrer&quot;&gt;a &lt;code&gt;__toString&lt;/code&gt; method&lt;/a&gt; (returning the Category title). This effectively means we can treat the object as a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above features mean that we can pass our ElementCriteriaModel directly to &lt;a href=&quot;http://twig.sensiolabs.org/doc/1.x/filters/join.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Twig &lt;code&gt;join&lt;/code&gt; filter&lt;/a&gt;, and it will concatenate the Category titles using the &quot;glue&quot; string &quot; and &quot;.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-02-08T17:22:01.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18895" PostTypeId="2" ParentId="18884" CreationDate="2017-02-08T17:46:39.270" Score="1" Body="&lt;p&gt;I was able to limit my entries by using the loop.index function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('insight')  %}&#xA;&#xA;        {# Limit output to the first 2 #}   &#xA;        {% if loop.index &amp;lt;= 2 %}  &#xA;&#xA;            &amp;lt;div class=&quot;insight&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                    &amp;lt;h4&amp;gt;Global Insights *latest random insight* &amp;lt;/h4&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;div class=&quot;details&quot;&amp;gt;&#xA;                        &amp;lt;span class=&quot;author&quot;&amp;gt;{{entry.writer}}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5435" LastActivityDate="2017-02-08T17:46:39.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18897" PostTypeId="2" ParentId="18885" CreationDate="2017-02-08T18:55:04.243" Score="1" Body="&lt;p&gt;I'm guessing staging has a case sensitive file system and your local dev site doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. the section handle in your screenshot is called &lt;code&gt;availableHomes&lt;/code&gt;, but the template folder you're referencing is &lt;code&gt;availablehomes&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-08T18:55:04.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18898" PostTypeId="2" ParentId="9171" CreationDate="2017-02-08T19:05:34.593" Score="2" Body="&lt;p&gt;The most reliable method i've found to test if a matrix field is defined is using the &lt;code&gt;length&lt;/code&gt; twig filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myMatrixField | length %}&#xA;  {% for block in entry.myMatrixField %}&#xA;    &amp;lt;p&amp;gt;Matrix blocks here.&amp;lt;/p&amp;gt;&#xA;  {% endfor %}&#xA;{% else %}&#xA;  &amp;lt;p&amp;gt;Matrix not defined.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on this in the Craft CMS docs &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#getting-the-total-number-of-blocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3986" LastEditorUserId="3986" LastEditDate="2017-02-09T21:56:56.160" LastActivityDate="2017-02-09T21:56:56.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18899" PostTypeId="1" CreationDate="2017-02-08T19:12:39.207" Score="0" ViewCount="72" Body="&lt;p&gt;I have a model where there will be many users. Each user has dashboard access and can add there products.. this all is done, but what I want is one user doesn't see other user products. Right now a user can see all products uploaded by all users. Currently Craft CMS doesn't have permission settings to hide entries of other user as they have for channel entries.. but I need that. Can anyone help me how can I achieve that. Any ideas would be helpful. Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="45" LastEditDate="2017-02-21T01:22:16.970" LastActivityDate="2017-02-21T01:22:16.970" Title="Setting User Permission to hide products of other user" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18900" PostTypeId="1" CreationDate="2017-02-08T19:38:22.087" Score="1" ViewCount="498" Body="&lt;p&gt;How can I change fields/sections structure locally while having a live site and then upload the new structure, without wiping the production site?&#xA;In Wordpress ACF you can just Sync the fields structure, here it seems I need to close down the website for development?!&lt;/p&gt;&#xA;" OwnerUserId="6250" LastEditorUserId="6250" LastEditDate="2017-02-09T15:59:24.903" LastActivityDate="2017-02-13T16:04:04.047" Title="Update fields structure from local to production" Tags="&lt;field&gt;&lt;sections&gt;&lt;deployment&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18901" PostTypeId="2" ParentId="18428" CreationDate="2017-02-08T19:54:47.767" Score="1" Body="&lt;p&gt;Sprout Forms it's a good option for your requirements, using the Payload Forwarding you'll be able to send the data to an endpoint on salesforce, you can also use the Hidden Field or the Invisible Field from the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Fields&lt;/a&gt; plugin to setup any pre-filled API-keys if required.&lt;/p&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2017-02-08T19:54:47.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18902" PostTypeId="2" ParentId="18692" CreationDate="2017-02-08T20:14:24.810" Score="1" Body="&lt;p&gt;The problem is due you're trying to get a property from the &lt;a href=&quot;https://craftcms.com/classreference/models/FieldLayoutModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;FieldLayoutModel&lt;/a&gt; instead of &lt;a href=&quot;https://craftcms.com/classreference/models/FieldLayoutFieldModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;FieldLayoutFieldModel&lt;/a&gt; please see the code bellow to fix the error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set layoutFields = tab.getFields() %}&#xA;&#xA;    {% for layoutField in layoutFields -%}&#xA;&#xA;        {%- set field     = layoutField.getField() -%}&#xA;        {{ field.settings.placeholder }}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2017-02-08T20:14:24.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18904" PostTypeId="2" ParentId="18887" CreationDate="2017-02-08T23:03:50.940" Score="2" Body="&lt;p&gt;If you actually have products selected in that entry's matrix products field, then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.MatrixHandle %}&#xA;  {% if block.type.handle == &quot;matrixProductsBlockTypeHandle&quot;%}&#xA;    {% for product in block.productsFieldHandle %}&#xA;        {{ product.title }}&#xA;    {% endfor%}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is the simplest approach really.  So if that doesn't work, triple confirm the &lt;code&gt;entry&lt;/code&gt; vairable is the one you think it s and that you do indeed have chosen products in that field.  If still nothing, check the &lt;code&gt;craft.log&lt;/code&gt; I guess!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-08T23:03:50.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18905" PostTypeId="2" ParentId="18899" CreationDate="2017-02-08T23:06:07.337" Score="2" Body="&lt;p&gt;This sounds like a feature request really.  And/or possible a use case for Craft 3s forthcoming multi-site features.  Although C3 + Commerce for it is a ways off yet (6 to 9 months apparently)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could perhaps use something like a custom field for the 'owner' of each product, and Zenbu to set up filtered views for each of the editors (just guessing, I've not used Zenbu personally)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://zenbustudio.com/software/zenbu-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://zenbustudio.com/software/zenbu-craftcms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-08T23:06:07.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18906" PostTypeId="1" AcceptedAnswerId="18908" CreationDate="2017-02-09T02:18:22.903" Score="1" ViewCount="139" Body="&lt;p&gt;So this may be a stupid question, but I've sort of never wrapped my head around it. When fetching an image from an entry -- even if there's only one associated with the field -- you can't just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.image %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have to say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.image.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which implies that the returned data are an object or array, and that the actual desired image is the &quot;first&quot; item in it. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is it structured this way?&lt;/li&gt;&#xA;&lt;li&gt;Which other properties are in the &lt;code&gt;entry.image&lt;/code&gt; apart from the actual resource itself? What would you use those for?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I realize this may be obvious to pro Craft developers, but I remember the first Craft site I ever built, I had a devil of a time trying to remember that!&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2017-02-09T05:27:47.017" Title="What other properties are in the &quot;entry.image&quot; object?" Tags="&lt;templating&gt;&lt;entry&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18907" PostTypeId="2" ParentId="11113" CreationDate="2017-02-09T02:22:17.183" Score="1" Body="&lt;p&gt;Great question. I'd been wrestling with this, with varying degrees of success, and am super pleased with &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout's &amp;quot;Import&amp;quot;&lt;/a&gt; plugin:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Create reusable import patterns for common content architecture problems and kick start all of your projects.&lt;/p&gt;&#xA;&lt;p&gt;Prepare your patterns using a familiar Craft Import JSON Format and you'll be up and running with your Structure Navigation, Blog, or favorite Matrix Field Layout Builder in no time!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Not just for importing standard project schemas, it'll also seed your site with dummy content. Really handy.&lt;/p&gt;&#xA;" OwnerUserId="286" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-02-09T02:22:17.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18908" PostTypeId="2" ParentId="18906" CreationDate="2017-02-09T05:27:47.017" Score="1" Body="&lt;p&gt;When you reference a relationship field (ie: Entries field, Assets field, etc), you will automatically get an &lt;strong&gt;ElementCriteriaModel&lt;/strong&gt; to represent the &quot;value&quot; of that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;entry.image&lt;/code&gt; is giving you an ElementCriteriaModel, you need to specify exactly what you want that ECM to do. If you try to use the ECM without specifying &lt;code&gt;.first&lt;/code&gt; (or &lt;code&gt;.last&lt;/code&gt;, or &lt;code&gt;.total&lt;/code&gt;), then by default it will &lt;em&gt;assume&lt;/em&gt; you meant &lt;code&gt;.find&lt;/code&gt;. Which is obviously not what you're trying to do in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I highly recommend reading my answer on &lt;a href=&quot;https://craftcms.stackexchange.com/a/16070/45&quot;&gt;this other thread...&lt;/a&gt; It's not quite a duplicate of your question, but it covers a lot of the same ground.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-09T05:27:47.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18911" PostTypeId="1" AcceptedAnswerId="18912" CreationDate="2017-02-09T09:47:58.303" Score="1" ViewCount="207" Body="&lt;p&gt;I'm trying to create a template route that allows me to get all of the attorneys that I've related to a specified practice area. I can get the slug easily, as my route looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'attorneys/legal-services/(?P&amp;lt;slug&amp;gt;[^/]+)' =&amp;gt; 'attorneys/legal-services'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And sure enough, when I go to &lt;code&gt;/attorneys/legal-services/construction-law&lt;/code&gt;, I can access the &lt;code&gt;{{ slug }}&lt;/code&gt; variable and grab &lt;code&gt;construction-law&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is that everything else in the object I request with &lt;code&gt;craft.entries.slug(slug)&lt;/code&gt; ends up being &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple code sample like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layouts/two-column' %}&#xA;{% set practice = craft.entries.slug(slug) %}&#xA;&#xA;{% block main %}&#xA;  &amp;lt;main class=&quot;page-body&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Attorneys&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;h2&amp;gt;in {{ practice.title }}&amp;lt;/h2&amp;gt;&#xA;    {% for entry in craft.entries.section('people').relatedTo(practice) %}&#xA;      &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/main&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will output all the content I request in my &lt;code&gt;for&lt;/code&gt; loop, but &lt;code&gt;practice.title&lt;/code&gt; is left empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I &lt;code&gt;dump&lt;/code&gt; the contents of the &lt;code&gt;practice&lt;/code&gt; object out, I see this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(Craft\ElementCriteriaModel)[749]&#xA;  protected 'strictAttributes' =&amp;gt; boolean false&#xA;  private '_elementType' =&amp;gt; &#xA;    object(Craft\EntryElementType)[742]&#xA;      protected 'componentType' =&amp;gt; string 'ElementType' (length=11)&#xA;      private '_sourcesByContext' (Craft\BaseElementType) =&amp;gt; null&#xA;      private '_classHandle' (Craft\BaseComponentType) =&amp;gt; null&#xA;      public 'behaviors' =&amp;gt; &#xA;        array (size=0)&#xA;          empty&#xA;      private '_initialized' (CApplicationComponent) =&amp;gt; boolean true&#xA;      private '_e' (CComponent) =&amp;gt; null&#xA;      private '_m' (CComponent) =&amp;gt; null&#xA;  private '_supportedFieldHandles' =&amp;gt; null&#xA;  private '_matchedElements' =&amp;gt; null&#xA;  private '_matchedElementsAtOffsets' =&amp;gt; null&#xA;  private '_cachedIds' =&amp;gt; null&#xA;  private '_cachedTotal' =&amp;gt; null&#xA;  protected 'classSuffix' =&amp;gt; string 'Model' (length=5)&#xA;  private '_classHandle' (Craft\BaseModel) =&amp;gt; null&#xA;  private '_attributeConfigs' (Craft\BaseModel) =&amp;gt; &#xA;    array (size=45)&#xA;      'ancestorDist' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'ancestorOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'archived' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 1&#xA;          'default' =&amp;gt; boolean false&#xA;          'required' =&amp;gt; boolean true&#xA;          'column' =&amp;gt; string 'tinyint' (length=7)&#xA;          'unsigned' =&amp;gt; boolean true&#xA;          'type' =&amp;gt; string 'bool' (length=4)&#xA;          'min' =&amp;gt; int 0&#xA;          'max' =&amp;gt; int 255&#xA;      'dateCreated' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'dateUpdated' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'descendantDist' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'descendantOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'fixedOrder' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 1&#xA;          'default' =&amp;gt; boolean false&#xA;          'required' =&amp;gt; boolean true&#xA;          'column' =&amp;gt; string 'tinyint' (length=7)&#xA;          'unsigned' =&amp;gt; boolean true&#xA;          'type' =&amp;gt; string 'bool' (length=4)&#xA;          'min' =&amp;gt; int 0&#xA;          'max' =&amp;gt; int 255&#xA;      'id' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'indexBy' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'level' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'limit' =&amp;gt; &#xA;        array (size=9)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'default' =&amp;gt; int 100&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'locale' =&amp;gt; &#xA;        array (size=2)&#xA;          'column' =&amp;gt; string 'locale' (length=6)&#xA;          'type' =&amp;gt; string 'locale' (length=6)&#xA;      'localeEnabled' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 1&#xA;          'default' =&amp;gt; boolean true&#xA;          'required' =&amp;gt; boolean true&#xA;          'column' =&amp;gt; string 'tinyint' (length=7)&#xA;          'unsigned' =&amp;gt; boolean true&#xA;          'type' =&amp;gt; string 'bool' (length=4)&#xA;          'min' =&amp;gt; int 0&#xA;          'max' =&amp;gt; int 255&#xA;      'nextSiblingOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'offset' =&amp;gt; &#xA;        array (size=9)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'default' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'order' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; string 'lft, postDate desc' (length=18)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'positionedAfter' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'positionedBefore' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'prevSiblingOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'relatedTo' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'ref' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'search' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'siblingOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'slug' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'status' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; string 'live' (length=4)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'title' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'uri' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'with' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'childField' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'childOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'depth' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'parentField' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'parentOf' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'after' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'authorGroup' =&amp;gt; &#xA;        array (size=1)&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'authorGroupId' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'authorId' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'before' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'editable' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 1&#xA;          'default' =&amp;gt; boolean false&#xA;          'required' =&amp;gt; boolean true&#xA;          'column' =&amp;gt; string 'tinyint' (length=7)&#xA;          'unsigned' =&amp;gt; boolean true&#xA;          'type' =&amp;gt; string 'bool' (length=4)&#xA;          'min' =&amp;gt; int 0&#xA;          'max' =&amp;gt; int 255&#xA;      'expiryDate' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'postDate' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'section' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;      'sectionId' =&amp;gt; &#xA;        array (size=8)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; int -2147483648&#xA;          'max' =&amp;gt; int 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 10&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'type' =&amp;gt; &#xA;        array (size=3)&#xA;          'model' =&amp;gt; null&#xA;          'column' =&amp;gt; string 'text' (length=4)&#xA;          'type' =&amp;gt; string 'mixed' (length=5)&#xA;  private '_attributes' (Craft\BaseModel) =&amp;gt; &#xA;    array (size=9)&#xA;      'archived' =&amp;gt; boolean false&#xA;      'fixedOrder' =&amp;gt; boolean false&#xA;      'limit' =&amp;gt; int 100&#xA;      'localeEnabled' =&amp;gt; boolean true&#xA;      'offset' =&amp;gt; int 0&#xA;      'order' =&amp;gt; string 'lft, postDate desc' (length=18)&#xA;      'status' =&amp;gt; string 'live' (length=4)&#xA;      'editable' =&amp;gt; boolean false&#xA;      'slug' =&amp;gt; string 'construction-law' (length=16)&#xA;  private '_extraAttributeNames' (Craft\BaseModel) =&amp;gt; &#xA;    array (size=0)&#xA;      empty&#xA;  private '_errors' (CModel) =&amp;gt; &#xA;    array (size=0)&#xA;      empty&#xA;  private '_validators' (CModel) =&amp;gt; null&#xA;  private '_scenario' (CModel) =&amp;gt; string '' (length=0)&#xA;  private '_e' (CComponent) =&amp;gt; null&#xA;  private '_m' (CComponent) =&amp;gt; null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a result, I'm getting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Attorneys&amp;lt;/h1&amp;gt;&#xA;&amp;lt;h2&amp;gt;in &amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;even though I'm expecting to see the title of the practice area.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2017-02-09T10:11:24.000" Title="Getting only slug in otherwise null object on routed template" Tags="&lt;routing&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18912" PostTypeId="2" ParentId="18911" CreationDate="2017-02-09T10:11:24.000" Score="4" Body="&lt;p&gt;You will need to use &lt;code&gt;{% set practice = craft.entries.slug(slug).first() %}&lt;/code&gt; to fetch the real &lt;code&gt;EntryModel&lt;/code&gt;, and not just an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the &lt;code&gt;relatedTo&lt;/code&gt; criteria still works without it because that calls &lt;code&gt;.find()&lt;/code&gt; implicitly when passed an &lt;code&gt;ElementCriteriaModel&lt;/code&gt;, but that doesn't actually change what the &lt;code&gt;practice&lt;/code&gt; variable references in the rest of the template.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2017-02-09T10:11:24.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18913" PostTypeId="2" ParentId="5230" CreationDate="2017-02-09T10:51:36.923" Score="1" Body="&lt;p&gt;This is a bug in Redactor. There has been an &lt;a href=&quot;https://craftcms.uservoice.com/forums/285224-bugs/suggestions/11027331-redactor-2-adds-extra-non-breaking-spaces&quot; rel=&quot;nofollow noreferrer&quot;&gt;ongoing bug report about it here&lt;/a&gt;.&#xA;But I found that if you use Firefox it doesn't add the non-breaking spaces when editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;onebrightlight (on Slack) suggested a temporary fix to replace them with spaces in your template code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.fieldname | replace({'&amp;amp;nbsp;' : ''})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2017-02-09T10:51:36.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18914" PostTypeId="1" CreationDate="2017-02-09T12:33:26.823" Score="2" ViewCount="1108" Body="&lt;p&gt;You can add a note field for a product on the 'Add to Basket' form in Craft Commerce, and output this on the basket page using {{ item.note }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm using the note field field to record the page URL for the product, so I can link back to the product page for each line item in the basket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd rather use a custom field or a dynamic field to do this instead. Is this possible? If so, how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried creating a dynamic field named 'test-page-url', but that didn't work when trying to output {{ item.testPageUrl }} on the basket page. I got this error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\Commerce_LineItemModel and its behaviors do not have a method or&#xA;  closure named &quot;testPageUrl&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I also tried creating a new product field (productPageUrl) and using this name, but that didn't work either. I got this error when trying to use {{ item.productPageUrl }} on the basket page: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\Commerce_LineItemModel and its behaviors do not have a method or&#xA;  closure named &quot;productPageUrl&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help in advance.&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-02-10T00:26:23.027" Title="How to add custom fields for products in Craft Commerce and output them in the cart" Tags="&lt;plugin-craftcommerce&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18915" PostTypeId="1" AcceptedAnswerId="18927" CreationDate="2017-02-09T13:17:14.383" Score="3" ViewCount="492" Body="&lt;p&gt;More of a general question rather than a specific issue I have right now. I want to migrate a site from a bespoke CMS, which relies heavily on CKEditor for embedding inline images into HTML content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously I'd like to import the html content, but somehow translate the embedded images into proper Craft asset uploads, embedded into a Redactor field (obviously I know that keeping images separate from text is fine, but that is a bigger issue than I'm prepared to deal with!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would love to know if anyone has done this before, and how they approached it. Extra points for doing it with FeedMe, which works very well for me.&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2017-02-09T21:52:13.657" Title="How would you import content with embedded images, ideally using FeedMe?" Tags="&lt;redactor&gt;&lt;import&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18917" PostTypeId="1" AcceptedAnswerId="18918" CreationDate="2017-02-09T15:26:08.737" Score="1" ViewCount="49" Body="&lt;p&gt;I'm just looking for a little guidance here. I have a decent grasp of the matrix field but the functionality I want exactly is causing me some issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to setup a matrix field with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category name: Football (need the ability to set the category is in panel)&#xA;&#xA; -&amp;gt; PDFs &#xA;&#xA;  -&amp;gt; PDF Title (Title of PDF)&#xA;  -&amp;gt; PDF Asset (Upload PDF Here)&#xA;&#xA;  -&amp;gt; PDF Title (Title of PDF)&#xA;  -&amp;gt; PDF Asset (Upload PDF Here)&#xA;&#xA;&#xA;Category name: Rugby (need the ability to set the category is in panel)&#xA;&#xA; -&amp;gt; PDFs &#xA;&#xA;  -&amp;gt; PDF Title (Title of PDF)&#xA;  -&amp;gt; PDF Asset (Upload PDF Here)&#xA;&#xA;  -&amp;gt; PDF Title (Title of PDF)&#xA;  -&amp;gt; PDF Asset (Upload PDF Here)&#xA;&#xA;&#xA;&#xA;  etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So looking at the matrix field it look like I need someway to create a matrix field within a matrixfield? I see i can use some plugins for this, But i want to make sure im not missing something first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;UPDATE&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I've setup my matrix field like this, is this correct for what I want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2EGzR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2EGzR.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5435" LastEditorUserId="5435" LastEditDate="2017-02-09T15:33:50.210" LastActivityDate="2017-02-09T15:54:42.473" Title="Matrix Field Integration" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18918" PostTypeId="2" ParentId="18917" CreationDate="2017-02-09T15:54:42.473" Score="2" Body="&lt;p&gt;For a Matrix field inside a matrix field I recommend using Supertables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't look exactly the same as a matrix block but works the exact same way. With supertables you can go as deep as you want.&#xA;Super table is a field you can add into your matrix block which is able to use all the fields you want so you dont have any limitations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first impression on your Matrix field looks alright to me but, I might misunderstand it.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-09T15:54:42.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18919" PostTypeId="1" CreationDate="2017-02-09T16:29:41.847" Score="2" ViewCount="302" Body="&lt;p&gt;I had this issue on two different sites on two different occasions and hosts.&#xA;When creating a database back-up through the Craft CMS admin and importing that SQL file into a new database through PhP MyAdmin I get syntax errors and import stops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried backing up the database on both sites through the hosting company itself, which resulted in one backup working and one also giving the syntax error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just updated the sites to Craft 2.6.x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what goes wrong or how I can solve this? Do I need to manually go through the whole SQL file and fix the syntax errors manually? :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I open the SQL file in PhPStorm, it looks like the character where the error happens, all the SQL statements coming behind it are escaped wrong, they are shown as normal text. Maybe an encoding issue?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-10T12:59:33.407" Title="DB back-up gives syntax errors on import in new DB" Tags="&lt;database&gt;&lt;mysql&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18920" PostTypeId="1" AcceptedAnswerId="18939" CreationDate="2017-02-09T17:02:37.053" Score="1" ViewCount="200" Body="&lt;p&gt;I have trouble installing the demo site 'happylager'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windows 8.1 &#xA;WAMP 3.0.4 - MySQL 5.7.11 - PHP 5.6.19 - Apache 2.4.18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I follow the instructions from &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/HappyLager&lt;/a&gt; and when I import the .sql file I get this error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zTv5f.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zTv5f.jpg&quot; alt=&quot;error message after .sql import&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I head back to happylager.dev/admin I get the installation screen, not the login screen as it is described in the repo. What do you think is the problem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="6259" LastEditorUserId="22" LastEditDate="2017-05-09T20:26:08.657" LastActivityDate="2017-05-09T20:26:08.657" Title="Cannot install demo site happylager" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18921" PostTypeId="2" ParentId="1436" CreationDate="2017-02-09T18:05:42.723" Score="3" Body="&lt;p&gt;Here's a slight revision that checks widths and heights and ensures that the output has no white space:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- macro imageURL(image, transform) -%}&#xA;    {% spaceless %}&#xA;        {% if image.getWidth &amp;gt; image.getWidth(transform) or image.getHeight &amp;gt; image.getHeight(transform) %}&#xA;            {{ image.getUrl(transform) }}&#xA;        {% else %}&#xA;            {{ image.getUrl }}&#xA;        {% endif %}&#xA;    {% endspaceless %}&#xA;{%- endmacro -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_macros&quot; as utils %}&#xA;&#xA;&amp;lt;img src=&quot;{{ utils.imageURL(asset, 'medium') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3327" LastActivityDate="2017-02-09T18:05:42.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18922" PostTypeId="1" CreationDate="2017-02-09T18:15:54.553" Score="2" ViewCount="176" Body="&lt;p&gt;I saw a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17756/search-entries-by-matrix-field&quot;&gt;potentially similar question&lt;/a&gt;, but I'm wondering if mine is simpler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to search for entries based on a match of a Multi-Select field. So, say if a user has a Tier of &quot;TB&quot; and an entry has a Muli-Select value of the options TB,B,P then the entry should be found. Likewise for an entry with the options G,A,P should not be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my query at the moment&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = 'eventRegion::&quot;' ~ currentUser.userPabRegion ~ '&quot; eventTier:&quot;' ~ currentUser.userPabTier ~ '&quot;' %}&#xA;&#xA;{% paginate craft.entries.search( query ).sectionId( module.eventsModuleChannel ) as events %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5114" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-09T18:15:54.553" Title="Search on entries by Multi-Select field" Tags="&lt;search&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18923" PostTypeId="1" AcceptedAnswerId="18933" CreationDate="2017-02-09T19:55:24.833" Score="3" ViewCount="351" Body="&lt;p&gt;These keeps erroring out if any of the entries' do not have any assets in the 'listingPhotos' field. However, IF all entries have at least 1 photo in the 'listingsPhotos' field, it works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Error Message: Trying to get property of non-object &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'trucks.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'trucks'],&#xA;            'paginate' =&amp;gt; false,&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'ID' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'Year' =&amp;gt; $entry-&amp;gt;year,&#xA;                    'Manufacturer' =&amp;gt; $entry-&amp;gt;manufacturer,&#xA;                    'Model' =&amp;gt; $entry-&amp;gt;model,&#xA;                    'Category' =&amp;gt; (string)$entry-&amp;gt;category[0],&#xA;                    'Pics' =&amp;gt; $entry-&amp;gt;listingPhotos[0]-&amp;gt;url,&#xA;                ];&#xA;            },&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastEditorUserId="5938" LastEditDate="2017-02-09T23:21:57.150" LastActivityDate="2017-02-10T09:51:11.640" Title="ElementAPI: Error's out if entry doesn't have assets" Tags="&lt;entries&gt;&lt;assets&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18926" PostTypeId="1" CreationDate="2017-02-09T21:20:56.743" Score="1" ViewCount="1145" Body="&lt;p&gt;I am locked out of my site (a new project still on my local MAMP server) and can't log back in. I have tried to rest my password but I haven't received any emails. I also tried to go through MYSQL and reset it through the craft_user file, but this didn't work either. Any advice would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;" OwnerUserId="6264" LastActivityDate="2017-04-11T07:46:53.387" Title="Unable to Log in" Tags="&lt;login&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18927" PostTypeId="2" ParentId="18915" CreationDate="2017-02-09T21:52:13.657" Score="2" Body="&lt;p&gt;There's nothing through Feed Me that handles this elegantly at the moment, and you'd need to either parse your html data before or after the import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've done this a few times on an import, where we've created a trivial PHP script which extracts images out of HTML content. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = '&amp;lt;p&amp;gt;Some text&amp;lt;/p&amp;gt;&amp;lt;img src=&quot;http://example.com/my-image.jpg&quot;&amp;gt;&amp;lt;p&amp;gt;More text&amp;lt;/p&amp;gt;&amp;lt;img src=&quot;http://example.com/my-other-image.jpg&quot;&amp;gt;.';&#xA;&#xA;// Start scraping!&#xA;$doc = new DOMDocument();&#xA;$doc-&amp;gt;loadHTML($html);&#xA;$xpath = new DOMXPath($doc);&#xA;&#xA;// Extract all &amp;lt;img&amp;gt; tags from our HTML content&#xA;foreach ($xpath-&amp;gt;query('//img') as $key =&amp;gt; $node) {&#xA;&#xA;    // Save the image for later - just get the filename though&#xA;    $contentImages[] = $node-&amp;gt;getAttribute('src');&#xA;&#xA;    // Remove the 'img' tag from the content node&#xA;    $node-&amp;gt;parentNode-&amp;gt;removeChild($node);&#xA;}&#xA;&#xA;// Store our parse HTML content (without img tags)&#xA;$content = $doc-&amp;gt;saveHTML();&#xA;&#xA;$json[] = array(&#xA;    'contentImages' =&amp;gt; $contentImages,&#xA;    'content' =&amp;gt; $content,&#xA;);&#xA;&#xA;echo json_encode($json);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Normally this is because most scenarios go from a single WYSIWYG content block (looking at your Wordpress), to a Matrix content-builder field. In our cases, we like to create a Rich Text 'Content' block, and an 'Image' content block. As such, they're two different bits of data, and extracted out as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wanting to keep your images in your Redactor fields, but have them hooked up to Craft's Assets - thats much more complicated. You'd need to upload the asset to Craft, get the ID from the uploaded asset, and replace the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags in your content with a Redactor Asset placeholder.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-09T21:52:13.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18929" PostTypeId="2" ParentId="18914" CreationDate="2017-02-10T00:26:23.027" Score="4" Body="&lt;p&gt;Ok, I think your thinking on this stuff is a little wrong at the moment.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way Commerce works is that when you add to a cart, it creates a &lt;code&gt;lineItem&lt;/code&gt;.  That data model holds basic stuff like &lt;code&gt;qty&lt;/code&gt; and a &lt;code&gt;description&lt;/code&gt; and so on, enough to just manage and print out the basics of the cart.  However, it also  (for each lineItem) maintains a reference to the &lt;code&gt;purchasable&lt;/code&gt; itself - with this purchasable being a purchasable variant (either a products defaultVariant if it is a non-variant product, or the actual variant chosen if it is a variant product).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this purchasable, you can get back to the full product and/or variant model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you don't actually need &lt;em&gt;any&lt;/em&gt; custom fields to get the product's url.  You can print it simply  by working back from the lineitem to the product or variant as you need, using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;lineItem.purchasable.product.url&lt;/code&gt; - for the product url&#xA;&lt;code&gt;lineItem.purchasable.url&lt;/code&gt; - for a specific variant url&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more general terms, in Commerce settings, you can add as many fields to products as you like, and indeed you can also add custom fields to variants.  It's hugely powerful.  And from then on you can get to those fields using the same approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;lineItem.purchasable.product.fieldHandle&lt;/code&gt; - for product fields&#xA;&lt;code&gt;lineItem.purchasable.fieldHandle&lt;/code&gt; - for variant fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Commerce example templates are very handy for figuring this stuff out, and it's well worth spending a couple hours with the default Commerce install and those templates to see how it all hangs together.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-10T00:26:23.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18930" PostTypeId="1" AcceptedAnswerId="18964" CreationDate="2017-02-10T00:36:44.707" Score="1" ViewCount="249" Body="&lt;p&gt;I'm at the data entry stage of development and I've got a slew of entries with images to create. I'm stepping through the process manually and I'd like to use the URL of the image in the Upload files dialog instead of doing the download/upload rigamarole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images are on a server I don't have access to outside of their website. Ideally I would use the image URL in the Upload files dialog box instead of a local path and the image would be fetched and saved as an asset associated with the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this workflow seems parochial alternative solutions are welcome!&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2017-02-10T16:30:45.977" LastActivityDate="2017-02-13T17:11:03.007" Title="Is there a way to upload an asset with a URL?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18931" PostTypeId="2" ParentId="18930" CreationDate="2017-02-10T01:29:11.180" Score="2" Body="&lt;p&gt;Firstly, you could manually copy/paste all your images into your Asset Source folders, then hit &quot;Update Asset Indexes&quot; from the settings. What this does is scan the directories for files, and creates them in the database if they don't exist. Once thats done, in your entries, you simply need to enter the filename in the search field (once you click &quot;Add an Asset&quot; on your asset field), and you're done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more automated solution, you could look at &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/getting-started/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt; to update your entries, along with automatically uploading your assets from a provided URL. Your feed could be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{&#xA;  title: &quot;Entry Title 1&quot;&#xA;  images: [&#xA;    &quot;http://my.website/my-image-1.jpg&quot;,&#xA;    &quot;http://my.website/my-image-2.jpg&quot;&#xA;  ]&#xA;}, {&#xA;  title: &quot;Entry Title 2&quot;&#xA;  images: [&#xA;    &quot;http://my.website/my-image-3.jpg&quot;,&#xA;    &quot;http://my.website/my-image-4.jpg&quot;&#xA;  ]&#xA;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-10T01:29:11.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18932" PostTypeId="2" ParentId="18926" CreationDate="2017-02-10T06:54:53.033" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I also tried to go through MySQL and reset it through the &lt;code&gt;craft_user&lt;/code&gt; file, but this didn't work either.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You don't mention what you tried, but this method will work: &lt;a href=&quot;https://craftcms.stackexchange.com/a/13966/57&quot;&gt;https://craftcms.stackexchange.com/a/13966/57&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-02-10T06:54:53.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18933" PostTypeId="2" ParentId="18923" CreationDate="2017-02-10T09:51:11.640" Score="3" Body="&lt;p&gt;Why don't you just check if there is at least one photo? Something along the lines of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    return [&#xA;        'ID' =&amp;gt; $entry-&amp;gt;id,&#xA;        'Year' =&amp;gt; $entry-&amp;gt;year,&#xA;        'Manufacturer' =&amp;gt; $entry-&amp;gt;manufacturer,&#xA;        'Model' =&amp;gt; $entry-&amp;gt;model,&#xA;        'Category' =&amp;gt; (string)$entry-&amp;gt;category[0],&#xA;        'Pics' =&amp;gt; !empty($entry-&amp;gt;listingPhotos) ? $entry-&amp;gt;listingPhotos[0]-&amp;gt;url : null,&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-02-10T09:51:11.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18935" PostTypeId="2" ParentId="18919" CreationDate="2017-02-10T12:59:33.407" Score="1" Body="&lt;p&gt;As Brad replied as a comment, the issue was indeed PhPMyAdmin. Using NaviCat or updating my PhPMyAdmin resolved the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer points go to Brad!&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-10T12:59:33.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18936" PostTypeId="1" AcceptedAnswerId="18937" CreationDate="2017-02-10T13:54:12.640" Score="1" ViewCount="137" Body="&lt;p&gt;In Craft Commerce, when adding a tax rate to a type of product and selecting &quot;this tax is already included in the entered price of all products&quot;, I cannot see the tax details for an order. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it is not selected, the &lt;code&gt;cart.totalTax&lt;/code&gt; contains the amount of tax due. Once it is selected, that variable always shows zero&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to include that tax by default, but still see the tax details for the order ?&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="22" LastEditDate="2017-05-09T20:25:38.147" LastActivityDate="2017-05-09T20:25:38.147" Title="Tax price detail" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18937" PostTypeId="2" ParentId="18936" CreationDate="2017-02-10T14:02:54.613" Score="2" Body="&lt;p&gt;Nevermind, found the solution, everything can be found in the variable &lt;code&gt;cart.adjustments&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6015" LastActivityDate="2017-02-10T14:02:54.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18938" PostTypeId="1" CreationDate="2017-02-10T14:52:15.130" Score="0" ViewCount="49" Body="&lt;p&gt;We recently moved the site from one domain to another domain (development to staging). I am able to login to control panel and see the fields and sections but when I go to entries, i dont see any entry in there. Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6270" LastActivityDate="2017-02-13T15:38:54.703" Title="Not seeing the entries in control panel" Tags="&lt;entries&gt;&lt;migration&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18939" PostTypeId="2" ParentId="18920" CreationDate="2017-02-10T16:42:49.430" Score="2" Body="&lt;p&gt;I updated phpMyAdmin to the latest stable version and it worked!&lt;/p&gt;&#xA;" OwnerUserId="6259" LastActivityDate="2017-02-10T16:42:49.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18941" PostTypeId="1" CreationDate="2017-02-10T20:06:06.183" Score="1" ViewCount="131" Body="&lt;p&gt;I'm building a project with a lot of photo assets organized into sub directories of the main photos asset source. I'm trying to add tags to these assets so they are searchable when I try to use them in my entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With native features of Craft, this process seems to be very manual, I just have to click on each of these asset files and add the tags that I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way, either using a plugin or make a MySQL query, to bulk add tags to all the asset files under a certain sub directory?&lt;/p&gt;&#xA;" OwnerUserId="5286" LastEditorUserId="57" LastEditDate="2017-02-14T20:05:55.727" LastActivityDate="2017-02-14T20:10:41.417" Title="Tagging all assets in a sub directory" Tags="&lt;assets&gt;&lt;plugins&gt;&lt;tags&gt;&lt;mysql&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18942" PostTypeId="2" ParentId="18900" CreationDate="2017-02-10T22:05:21.007" Score="1" Body="&lt;p&gt;There are lots of similar questions with good discussion on this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev/16&quot;&gt;What&amp;#39;s the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16380/recommended-workflow-when-developing-new-websites/16388&quot;&gt;Recommended workflow when developing new websites&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13/whats-the-best-practice-for-upgrading-a-versioned-craft-site&quot;&gt;What&amp;#39;s the best practice for upgrading a versioned Craft site?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, we want to building something in core to help manage this and the upcoming Craft 3 has taken a step in that direction with &lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content Migrations&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-10T22:05:21.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18943" PostTypeId="1" AcceptedAnswerId="18951" CreationDate="2017-02-11T01:01:54.833" Score="1" ViewCount="238" Body="&lt;p&gt;How do I publish a list of three most recent entries within a 'blog' section that feature the category id '42'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presently have this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').limit(3).find() %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I am having trouble properly implementing the .relatedTo() filter within this snippet, and all of the examples that I have read reference a category title rather than id.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2017-02-12T04:45:13.600" Title="How do I publish entries with a specific category id?" Tags="&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18944" PostTypeId="1" AcceptedAnswerId="18950" CreationDate="2017-02-11T01:21:36.240" Score="1" ViewCount="175" Body="&lt;p&gt;I need to pull X entries with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randEntries = craft.entries.section('presenters').order('RAND()').limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then sort them alphabetically on entry.lastName.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supersort&lt;/a&gt; for this, and if so, how do I apply it? Do I need to pull the entries first, and then run the sort?&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-02-12T04:38:55.320" Title="Retrieve entries by random sort, then resort alphabetically" Tags="&lt;entries&gt;&lt;random&gt;&lt;plugin-supersort&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18945" PostTypeId="1" CreationDate="2017-02-11T19:44:03.213" Score="1" ViewCount="62" Body="&lt;p&gt;I looking for suggestions for customer account pages.Something like; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;account&#xA; account/addresses&#xA; account/my-orders&#xA;    account/orders/order-5566&#xA;    account/orders/order-5567&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which section type should i use Structure, Channels or Singles? Or just use folder/file templating structure? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Stackexchange is not a place for open ended questions but couldn't find any good example on this.&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2017-02-12T02:59:48.470" Title="Which section type for Craft Commerce customer account pages" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18947" PostTypeId="2" ParentId="12472" CreationDate="2017-02-11T21:33:59.113" Score="1" Body="&lt;p&gt;I had this same issue with an image-heavy site hosted on WebFaction w/ PHP5.6, using latest Craft 2.6.x version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the fix Brad mentions + another config line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// From http://stackoverflow.com/a/12835966&#xA;// Pixel cache max size&#xA;$this-&amp;gt;setResourceLimit(\Imagick::RESOURCETYPE_MEMORY, 256);&#xA;// Maximum amount of memory map to allocate for the pixel cache&#xA;$this-&amp;gt;setResourceLimit(\Imagick::RESOURCETYPE_MAP, 256);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in &lt;code&gt;craft/app/vendor/pixelandtonic/imagine/lib/Imagine/Imagick/Imagick.php&lt;/code&gt; at line 33, at top of &lt;code&gt;smartResize()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was before adding the &lt;code&gt;'generateTransformsBeforePageLoad' =&amp;gt; true,&lt;/code&gt; line to our config, I haven't tested removing this setting after adding that to our config. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When still in heavy development, we'd clear image asset caches and the transform queue would grow like crazy, and PHP processes would grow past 1.5gb until our host killed all of our processes. I haven't seen this issue since adding those Imagick settings.&lt;/p&gt;&#xA;" OwnerUserId="6275" LastActivityDate="2017-02-11T21:33:59.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18948" PostTypeId="2" ParentId="16354" CreationDate="2017-02-11T23:54:35.627" Score="2" Body="&lt;p&gt;I was having this issue (w/ PHP 5.6, Craft 2.6.x, on WebFaction hosting) because it seemed like PHP had no memory limit and single processes were handling huge image transform queues, bombing when it got over 1.5gb or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making sure Imagick has a memory cap seems to do the trick to avoid the queue getting stuck as PHP runs out of memory, which is discussed here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12472/possible-memory-leak-generatependingtransforms-imagemagick/18947#18947&quot;&gt;Possible memory leak - GeneratePendingTransforms/ImageMagick&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// From http://stackoverflow.com/a/12835966&#xA;// Pixel cache max size&#xA;$this-&amp;gt;setResourceLimit(\Imagick::RESOURCETYPE_MEMORY, 256);&#xA;// Maximum amount of memory map to allocate for the pixel cache&#xA;$this-&amp;gt;setResourceLimit(\Imagick::RESOURCETYPE_MAP, 256);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in &lt;code&gt;craft/app/vendor/pixelandtonic/imagine/lib/Imagine/Imagick/Imagick.php&lt;/code&gt; at line 33, at top of smartResize() function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not on shared hosting but on a VPS (or otherwise have sudo access on your server, OR are able install ImageMagick + php-imagick from source), you can set memory caps for ImageMagick directly using a &lt;a href=&quot;https://www.imagemagick.org/script/security-policy.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;policy.xml&lt;/a&gt; file, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;policy domain=&quot;resource&quot; name=&quot;memory&quot; value=&quot;1GiB&quot;/&amp;gt;&#xA;&amp;lt;policy domain=&quot;resource&quot; name=&quot;map&quot; value=&quot;1GiB&quot;/&amp;gt;&#xA;&amp;lt;policy domain=&quot;resource&quot; name=&quot;area&quot; value=&quot;1GB&quot;/&amp;gt;&#xA;&amp;lt;policy domain=&quot;resource&quot; name=&quot;file&quot; value=&quot;768&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6275" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-02-22T17:04:57.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18949" PostTypeId="2" ParentId="18945" CreationDate="2017-02-12T02:59:48.470" Score="1" Body="&lt;p&gt;If you need user profile data, the obvious place to store that is in Craft Users.  Add the fields you need etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce has a field you can add to a User to show that user's addresses and orders on the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the front end, you then just make user profile page templates as you need them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see no good reason to use Structures,Channels or Singles here really, although I guess it depends on what other content you might want to have on those pages.  For the most part you're probably either just looping over the addresses and orders, or showing a single entry page for one of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course Craft is so flexible, you could use a structure for some of it, if you have fuller content needs, and then dynamic templates for those more transactional pages...there's an almost limiteless variety of ways you could do it, but user fields plus some templates for those sorts of pages would be the 'most standard' approach.....certainly it's what we're using.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-12T02:59:48.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18950" PostTypeId="2" ParentId="18944" CreationDate="2017-02-12T04:38:55.320" Score="2" Body="&lt;p&gt;I recon Supersort is they way to go, as its got some really handy functions to make this sort of thing a breeze. Try with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('presenters').order('RAND()').limit(10) %}&#xA;{% set sortedEntries = entries | supersort('sortAs', '{lastName}') %}&#xA;&#xA;{% for item in sortedEntries %}&#xA;    {{ item.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-12T04:38:55.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18951" PostTypeId="2" ParentId="18943" CreationDate="2017-02-12T04:45:13.600" Score="2" Body="&lt;p&gt;You can pass in a CategoryModel to the &lt;code&gt;relatedTo&lt;/code&gt; parameter, so its just a matter of getting the CategoryModel you're after. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.id(42).first %}&#xA;{% set entries = craft.entries.section('blog').limit(3).relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-12T04:45:13.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18952" PostTypeId="2" ParentId="117" CreationDate="2017-02-12T06:49:21.703" Score="3" Body="&lt;p&gt;I found that a really easy way to rebuild transitions is to simply change the transform settings in the craft admin interface. For example maybe your transform is to 400 pixels, change it to 200 pixels and the cms should regenerate the images for you. &lt;/p&gt;&#xA;" OwnerUserId="6277" LastActivityDate="2017-02-12T06:49:21.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18953" PostTypeId="2" ParentId="18900" CreationDate="2017-02-13T04:35:25.723" Score="1" Body="&lt;p&gt;You may find Sprout's &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import plugin&lt;/a&gt; useful in this regard.&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2017-02-13T04:35:25.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18956" PostTypeId="1" AcceptedAnswerId="18960" CreationDate="2017-02-13T15:30:05.767" Score="1" ViewCount="582" Body="&lt;p&gt;We have a website that allows users to register themselves with a front-end registration form, and are automatically logged-in once they're done (thanks to &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we also need to create users directly from the Control Panel on a regular basis. &#xA;Since autoLogin doesn't work with the &quot;Verify email addresses?&quot; user setting, I'm looking for a way to send the activation email only to the users that we have manually created over the Control Panel, so they're able to set a password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to send the verification email only to users created over the Control Panel?&lt;/p&gt;&#xA;" OwnerUserId="4638" LastActivityDate="2017-02-14T10:14:28.297" Title="Send activation email only for users created over the Control Panel" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;emails&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18958" PostTypeId="2" ParentId="18722" CreationDate="2017-02-13T15:37:31.553" Score="3" Body="&lt;p&gt;When you want to output Twig variables inside another Twig tag, you shouldn't include the braces around the variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile &quot;{{ siteUrl }}css/modul.min.css&quot; %}&#xA;{% includeJsFile &quot;{{ siteUrl }}js/ui.min.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile siteUrl ~ &quot;css/modul.min.css&quot; %}&#xA;{% includeJsFile siteUrl ~ &quot;js/ui.min.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These examples use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;concatenation operator&lt;/a&gt; (&lt;code&gt;~&lt;/code&gt;) to join the value held in the &lt;code&gt;siteUrl&lt;/code&gt; variable to the string holding the path to the CSS or JS file to be included.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-02-13T15:37:31.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18959" PostTypeId="2" ParentId="18938" CreationDate="2017-02-13T15:38:54.703" Score="1" Body="&lt;p&gt;Do you have multiple language set? If yes, check that you're selecting the right language on the entries drop-down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3lfQB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3lfQB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4638" LastActivityDate="2017-02-13T15:38:54.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18960" PostTypeId="2" ParentId="18956" CreationDate="2017-02-13T15:50:01.300" Score="1" Body="&lt;p&gt;You'll need to create a small custom plugin to do this. You can create the scaffolding for a plugin using the excellent &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Factory&lt;/a&gt; site. You'll just need to create a basic plugin, with none of the component options selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is to use &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's events&lt;/a&gt; to detect when a new user is created using the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific event you need to listen for is the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#users-onActivateUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;users.onActivateUser&lt;/code&gt; event&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need something like this in your plugin's &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @return mixed&#xA; */&#xA;public function init()&#xA;{&#xA;    // When creating new users through the control panel, send them a password reset email.&#xA;    craft()-&amp;gt;on('users.activateUser', function(Event $event) {&#xA;&#xA;        // only fire if this is a CP request&#xA;        if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;&#xA;            // retrieve the userModel from the event&#xA;            $user = $event-&amp;gt;params['user'];&#xA;&#xA;            // send password reset email&#xA;            craft()-&amp;gt;users-&amp;gt;sendPasswordResetEmail($user);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2017-02-14T10:14:28.297" LastActivityDate="2017-02-14T10:14:28.297" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18961" PostTypeId="2" ParentId="18900" CreationDate="2017-02-13T16:04:04.047" Score="1" Body="&lt;p&gt;Take a look at &lt;a href=&quot;https://github.com/Pennebaker/craftcms-thearchitect&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Architect plugin&lt;/a&gt;. This allows you to export selected attributes (e.g. fields, field layouts, sections, entry types, asset sources, transforms, globals, users and user groups) as a JSON file and import them into another site/environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works very well for exactly the use case you describe: migrating the changes in content structure, not content, between environments.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-02-13T16:04:04.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18962" PostTypeId="1" AcceptedAnswerId="19111" CreationDate="2017-02-13T16:06:37.560" Score="2" ViewCount="380" Body="&lt;p&gt;I'm proposing to use Craft for a company that runs multiple golf courses. Along with some general pages for the company as a whole, each location (course) is to have it's own microsite, for want of a better phrase. At the moment each location will have the same pages (but that could change in the future), along with a news section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I can achieve this with a combination of categories and structures, but I'd be keen to know if anyone has any other ideas. (Possibly &quot;multisite&quot; with locals?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thoughts are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Homepage - Single&lt;/li&gt;&#xA;&lt;li&gt;Global About - Single&lt;/li&gt;&#xA;&lt;li&gt;Global Golf Pros - Channel&lt;/li&gt;&#xA;&lt;li&gt;Locations - Structure with individual entry types for each sub page&lt;/li&gt;&#xA;&lt;li&gt;Global Contact Us - Single&lt;/li&gt;&#xA;&lt;li&gt;News (there's no requirement for this to be global at the moment, but creating multiple news channels seems a little painful) - Channel (with category filed to scope to each location)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Within the Location's channel I can then use relationships for each location's Golf Pros (from the Global Golf Pros channel) and list news articles via twig &lt;code&gt;craft.entries.section('news').categories('location-x')&lt;/code&gt; and a slightly elongated Entry URL Format &quot;locations/{location.first.slug}/news/{slug}&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes a picture is worth a 1,000 words, so here goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zRRnJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zRRnJ.png&quot; alt=&quot;Sitemap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel a little like I'm mixing the use of categories and structures though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thought would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tom&lt;/p&gt;&#xA;" OwnerUserId="6284" LastActivityDate="2017-03-23T16:41:40.970" Title="Structure a site with multiple locations with categories, structure or &quot;multisite&quot;?" Tags="&lt;categories&gt;&lt;structure&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18963" PostTypeId="1" AcceptedAnswerId="18965" CreationDate="2017-02-13T16:30:06.130" Score="1" ViewCount="720" Body="&lt;p&gt;I have a Matrix field setup. I want to be able to pull in the first Matrix block used to print a snippet, but only out of the blocks 'text' or 'textImage'. So the first one used, out of those two only.&lt;a href=&quot;https://i.stack.imgur.com/3rc47.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3rc47.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have but it's pulling in the textContent block regardless, even if the text block is first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set textBlock = entry.body.type('text').first() %}&#xA;    {% set textBlock2 = entry.body.type('textImage').first() %}&#xA;&#xA;&#xA;    {% if textBlock %}&#xA;        &amp;lt;p&amp;gt;{{ textBlock.textContent|hacksaw(chars='100', append='...') }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;        {% if textBlock2 %}&#xA;&#xA;        &amp;lt;p&amp;gt;{{ textBlock2.text|hacksaw(chars='100', append='...') }}&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2017-02-13T19:52:16.893" LastActivityDate="2017-02-13T19:52:16.893" Title="How would I pull in the first Matrix block including certain blocks only" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18964" PostTypeId="2" ParentId="18930" CreationDate="2017-02-13T17:11:03.007" Score="1" Body="&lt;p&gt;I found a comment from 2015 saying that it wasn't possible at that time so I'm going to tentatively accept a 'no' answer on this. Technically however, I don't understand if it's not possible, or if it just hasn't been built yet. I think information pertaining to that would be relevant.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastActivityDate="2017-02-13T17:11:03.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18965" PostTypeId="2" ParentId="18963" CreationDate="2017-02-13T17:12:41.983" Score="2" Body="&lt;p&gt;Give this ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will grab the first block that is either &quot;Text&quot; or &quot;Text Image&quot; and then you can use a switch statement to output your template depending on the block type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstTextBlock = entry.body.type(['text', 'textImage']).first() %}&#xA;&#xA;{% switch firstTextBlock.type %}&#xA;&#xA;    {% case 'text' %}&#xA;        &amp;lt;p&amp;gt;{{ firstTextBlock.textContent|hacksaw(chars='100', append='...') }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% case 'textImage' %}&#xA;        &amp;lt;p&amp;gt;{{ firstTextBlock.text|hacksaw(chars='100', append='...') }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6284" LastActivityDate="2017-02-13T17:12:41.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18966" PostTypeId="1" CreationDate="2017-02-13T17:35:43.547" Score="0" ViewCount="337" Body="&lt;p&gt;I already had this question posted but I didn't include enough relevant information so I deleted it and here I go again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a weird issue currently on my Craft setup. I have removed index.php from my URLs, so all my single-page links are loading via www.siteurl.com/about-us etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I'm having now is that when I created a new single page section, index.php isn't being removed from the URL. It's the only section doing this on the entire site, and everything is perfectly the same as the other sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to run through my setup in case anyone can spot what the issue is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a &lt;code&gt;.htaccess&lt;/code&gt; file within my project foot folder. The contents of that are here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteBase /&#xA;RewriteRule ^(.*)$ /public/$1 [L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then inside my public folder, (which is the same level as the Craft folder) I have another .htaccess, with the contents from &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This setup works perfectly for the entire site, except the new section I created. Does anyone know what the issue could or might be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've went into my Apache &lt;code&gt;http.conf&lt;/code&gt; file and made sure the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; LoadModule rewrite_module modules/mod_rewrite.so&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is enabled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AllowOverride All&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also inside my general.php file I have added, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I push this up to my staging server, the same issue is there. So I assume the default Apache configuration is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The really weird issue is why it works across the entire site except the one new section.&lt;/p&gt;&#xA;" OwnerUserId="5435" LastEditorUserId="340" LastEditDate="2017-05-11T05:19:58.353" LastActivityDate="2017-05-11T05:19:58.353" Title="Removing index.php strange issue" Tags="&lt;url&gt;&lt;sections&gt;&lt;index&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18967" PostTypeId="1" CreationDate="2017-02-13T21:33:54.533" Score="1" ViewCount="394" Body="&lt;p&gt;I have 2 issues that I need help with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I want to load ENTRIES from any section where the first URL segment of the entry matches jobs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am using the code below to load any SECTION where the first URL segment matches jobs.  This code works to load the sections. I'm just wondering if there's a more efficient way to write this to load the sections.  This is separate from loading the entries.  I need to do both.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSections = craft.sections.getAllSections() %}&#xA;&#xA;{% for section in allSections %}&#xA;&#xA;{% set sectionURL = section.getUrlFormat()|split('/')[0] %}&#xA;&#xA;{% if sectionURL == &quot;jobs&quot; %}&#xA;    {{ section.name }}&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="3723" LastEditDate="2017-02-16T18:52:31.330" LastActivityDate="2017-02-16T18:52:31.330" Title="Get Entries From Any Section Matching a URL segment" Tags="&lt;entries&gt;&lt;sections&gt;&lt;getsegment&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18968" PostTypeId="1" AcceptedAnswerId="18972" CreationDate="2017-02-13T21:34:54.327" Score="1" ViewCount="1228" Body="&lt;p&gt;I'm super new to both Craft and Twig so, apologies in advance!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to determine if the current entry I'm on is in a loop being called on that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have loop that goes through the entries of a category and displays them. If I'm currently viewing an entry that also appears in the loop, I would like to add an &quot;active&quot; class to the matching entry in the loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to possibly match the URL segment with an answer like the one found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/554/how-can-i-add-a-dynamic-active-css-class-to-the-navigation-on-any-given-page/572#572&quot;&gt;here&lt;/a&gt; but I need to the segment name to by dynamic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('category_name').limit(4) %}&#xA;      &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And would like it to be like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for entry in craft.entries.section('category_name').limit(4) %}&#xA;    IF ENTRY IN LOOP MATCHES CURRENT ENTRY PAGE I'M ON.. ADD CLASS&#xA;      &amp;lt;p class=&quot;active&quot;&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    ELSE&#xA;      &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    END IF&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6287" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-14T19:52:37.777" Title="Check if current entry is in loop and add class" Tags="&lt;entries&gt;&lt;conditional&gt;&lt;loop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18969" PostTypeId="1" CreationDate="2017-02-13T23:22:05.817" Score="1" ViewCount="2180" Body="&lt;p&gt;I am using a template which has a 'LOAD MORE' button beneath a grid of entries (entries 1-10). Click this link loads addition content to the grid via AJAX from another page (which contains entries 11-20). There is also a second page which has entries 21-30. The code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;load-isotope align-center&quot;&amp;gt;&#xA;  &amp;lt;a  href=&quot;p2.html&quot; class=&quot;sr-button&quot; &#xA;    data-related-grid=&quot;artefact-grid&quot; &#xA;    data-method=&quot;loadonclick&quot;&amp;gt;Load More&amp;lt;/a&amp;gt;&#xA;  &amp;lt;span class=&quot;load-message&quot;&amp;gt;No more items to show&amp;lt;/span&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is JS that will change the p2.html to p3.html when it is clicked, so the second time the button is click the 3rd set of entries is added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like some help as to how to change the JS to make this work with craft pagination. I can add&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ paginate.nextUrl ~ queryString }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as the target URL which works for the first click (the link is rendering out as URL/section/p2 and the content is added via AJAX in the correct place) but I need this to change to /p3 etc with each click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems as though the LOAD MORE function in the JS is mentioned in 2 places:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* isotope load more function&#xA;------------------------------------------------*/&#xA;function isotopeLoadMore(grid,el,url,datas) {&#xA;&#xA;  el.parent(&quot;.load-isotope&quot;).addClass('loading');&#xA;&#xA;  if (url === '#' || !url) { url = srvars.ajaxurl }&#xA;  var addData = ''; if (datas) { addData = { action:'sr_load_more', o:datas }; }&#xA;  jQuery.ajax({&#xA;    type:'POST',      // this might lead to issues for html template&#xA;    url:url,&#xA;    data: addData,&#xA;    dataType:&quot;html&quot;,&#xA;    error: function () {&#xA;      el.parent(&quot;.load-isotope&quot;).addClass(&quot;disabled&quot;);  &#xA;    },&#xA;    success: function(response) { &#xA;      //console.log(response);&#xA;      if (response) {&#xA;        setTimeout(function(){ &#xA;          var items = jQuery( jQuery(response).find('#'+grid.attr('id')).html());&#xA;          items.imagesLoaded(function(){&#xA;            grid.append( items ).isotope( 'appended', items);&#xA;            animateOnScroll(false);&#xA;            // init video bg for appended items&#xA;            if(jQuery().phatVideoBg) { grid.find('.videobg-section').phatVideoBg(); }&#xA;          });&#xA;          el.parent(&quot;.load-isotope&quot;).removeClass('loading');&#xA;        },500);&#xA;      } else {&#xA;        el.parent(&quot;.load-isotope&quot;).addClass(&quot;disabled&quot;);  &#xA;      }&#xA;    }&#xA;  });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;AND:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* Load More isotope&#xA;------------------------------------------------*/&#xA;var loadMore = jQuery('.load-isotope:not(.disabled) a');&#xA;&#xA;loadMore.click(function(){      &#xA;  var el = jQuery(this);&#xA;  if(el.data(&quot;loadpage&quot;) === undefined) { el.data(&quot;loadpage&quot;,&quot;2&quot;); }&#xA;  else { el.data(&quot;loadpage&quot;, parseInt(el.data(&quot;loadpage&quot;),10)+1); }&#xA;  var   related = el.data('related-grid');&#xA;  var   href = el.attr('href').replace(&quot;/2&quot;, '/'+el.data(&quot;loadpage&quot;));&#xA;  href = href.replace(&quot;2&quot;, el.data(&quot;loadpage&quot;));&#xA;  var datas = '';&#xA;  if(el.data(&quot;options&quot;) !== undefined &amp;amp;&amp;amp; el.data(&quot;options&quot;)) { datas = el.data('options').replace(&quot;paged=2&quot;, &quot;paged=&quot;+el.data(&quot;loadpage&quot;)); }&#xA;  isotopeLoadMore(jQuery('#'+related),el,href,datas);&#xA;  return false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help with this would be massively appreciated&lt;/p&gt;&#xA;" OwnerUserId="5195" LastEditorUserId="130" LastEditDate="2017-02-14T00:10:34.970" LastActivityDate="2017-02-17T18:19:09.017" Title="Using pagination with Ajax load.. help need on JS" Tags="&lt;ajax&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18972" PostTypeId="2" ParentId="18968" CreationDate="2017-02-14T08:51:19.417" Score="2" Body="&lt;p&gt;Firstly, &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;from the Craft docs on routing&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the URI matches an entry’s or category’s URI, the&#xA;  section’s/category group’s template will get loaded, and the matched&#xA;  element will be made available to the template via a pre-populated&#xA;  &lt;code&gt;entry&lt;/code&gt; or &lt;code&gt;category&lt;/code&gt; variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means if the page you are viewing relates to an entry, Craft will have already created a variable called &lt;code&gt;entry&lt;/code&gt;, which will contain the &lt;code&gt;EntryModel&lt;/code&gt; for that entry, so it’s best to avoid re-assigning the &lt;code&gt;entry&lt;/code&gt; variable in a template used for an entry to avoid confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To address your question, you need to check if the current URL matches the URL of an entry in the loop, which you can do by checking against &lt;code&gt;[craft.request.url][2]&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for catEntry in craft.entries.section('category_name').limit(4) %}&#xA;    {% if craft.request.url == catEntry.url %}&#xA;      &amp;lt;p class=&quot;active&quot;&amp;gt;{{ catEntry.title }}&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;p&amp;gt;{{ catEntry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-02-14T08:51:19.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18973" PostTypeId="1" AcceptedAnswerId="18992" CreationDate="2017-02-14T14:28:09.917" Score="1" ViewCount="298" Body="&lt;p&gt;The provided addresses template for the Craft Commerce checkout only shows the email to logged-out users. We need logged-in admin staff to be able to put orders through on behalf of a customer, over the phone. So, I'm showing the email input to logged-in users as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the admin person arrives at the addresses template, the email field is pre-populated with the admin person's address. They replace their email with the customer's email. They submit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cart email remains the admin person's email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone think of a workaround for this?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-10-13T22:09:49.690" Title="Cannot change cart email within Craft Commerce while logged-in" Tags="&lt;users&gt;&lt;plugin-craftcommerce&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18974" PostTypeId="1" AcceptedAnswerId="18976" CreationDate="2017-02-14T14:32:04.087" Score="3" ViewCount="1218" Body="&lt;p&gt;Is it possible to register a user for a Craft user account as part of a Craft Commerce checkout flow? Ideally something where you can ask if the user wants to create an account and save their details as part of the checkout flow. Is this doable? (I'm surprised this isn't somehow in Commerce, given how incredibly prevalent such a UX flow is.)&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-02-15T04:25:17.477" Title="Register a user as part of a Commerce checkout?" Tags="&lt;plugin-craftcommerce&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18976" PostTypeId="2" ParentId="18974" CreationDate="2017-02-14T15:08:51.277" Score="2" Body="&lt;p&gt;To create an account for a Commerce customer you'd use the exact same method as registering a Craft user via the front-end. The only difference would be that you may already have some of their details. You could use their name and email address to autofill these fields, meaning they'd only need to enter a password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code to do this can be found in the docs on the &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Registration Form&lt;/a&gt; page.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-02-14T15:08:51.277" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18977" PostTypeId="1" AcceptedAnswerId="18979" CreationDate="2017-02-14T15:34:59.127" Score="2" ViewCount="628" Body="&lt;p&gt;I've been looking at the following resources:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-profile-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1011/allow-user-to-change-or-delete-their-photo-for-their-profile-from-the-front-end&quot;&gt;Allow user to change or delete their photo for their profile from the front end&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2813/front-end-edit-entry-doesn-t-get-saved&quot;&gt;Front end edit: entry doesn’t get saved&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12200/front-end-registration-form-no-errors&quot;&gt;Front end registration form, no errors&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To try and put together a profile editing page that returns errors once submitted, but can't seem to get it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;user&lt;/code&gt; is equal to either the &lt;code&gt;currentUser&lt;/code&gt; or &lt;code&gt;craft.users.id(craft.request.getSegment(3)).first()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;partners/view/{{ user.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;{{ dump(user.getErrors) }}&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12 col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name:&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; name=&quot;firstName&quot; autocomplete=&quot;off&quot; type=&quot;text&quot; data-parsley-required=&quot;true&quot; value=&quot;{{ user.firstName }}&quot;&amp;gt;&#xA;        {{ errorList(user.getErrors('firstName')) }}&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12 col-sm-6&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name:&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;lastName&quot; name=&quot;lastName&quot; autocomplete=&quot;off&quot; type=&quot;text&quot; data-parsley-required=&quot;true&quot; value=&quot;{{ user.lastName }}&quot;&amp;gt;&#xA;        {{ errorList(user.getErrors('lastName')) }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;email&quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; name=&quot;email&quot; autocomplete=&quot;off&quot; type=&quot;email&quot; data-parsley-required=&quot;true&quot; data-parsley-type=&quot;email&quot; value=&quot;{{ user.email }}&quot;&amp;gt;&#xA;        {{ errorList(user.getErrors('email')) }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;userPhoto&quot;&amp;gt;User Photo:&amp;lt;/label&amp;gt;&#xA;        {% if user.photoUrl %}&#xA;            &amp;lt;img src=&quot;{{ user.photoUrl }}&quot; id=&quot;userPhoto&quot; width=&quot;100&quot; height=&quot;100&quot; /&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;img src=&quot;{{ currentUserPhotoUrl }}&quot; width=&quot;100&quot; height=&quot;100&quot;  alt=&quot;No User Photo&quot; /&amp;gt;&#xA;        {% endif %}&#xA;            &amp;lt;input id=&quot;profilePhoto&quot; type=&quot;file&quot; accept=&quot;image/*&quot; capture=&quot;camera&quot; name=&quot;userPhoto&quot; value=&quot;{{ (user.photoUrl ? 'Change Photo' : 'Upload') }}&quot;&amp;gt;&#xA;        {% if user.photoUrl %}&#xA;            &amp;lt;a id=&quot;btn-delete-user-photo&quot; class=&quot;btn btn-solid btn-xs&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;userDescription&quot;&amp;gt;User Description&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;userDescription&quot; name=&quot;fields[userDescription]&quot; autocomplete=&quot;off&quot; data-parsley-required=&quot;true&quot; value=&quot;{{ user.userDescription }}&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-solid&quot;&amp;gt;Save&amp;lt;/button&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could anyone point out where I'm going wrong, or provide a working example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5114" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-14T19:31:48.927" Title="Correct way of showing errors when editing profile via front-end form?" Tags="&lt;form&gt;&lt;frontend&gt;&lt;user-profile&gt;&lt;usermodel&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18978" PostTypeId="1" AcceptedAnswerId="18980" CreationDate="2017-02-14T17:27:19.837" Score="2" ViewCount="702" Body="&lt;p&gt;So we're trying to set-up a site to run both HTTP &amp;amp; HTTPs version in parallel for SEO auditing before making the full switch to HTTPs. We followed Ben's answer on this SE question to make it work: &lt;a href=&quot;https://craftcms.stackexchange.com/a/4734/57&quot;&gt;https://craftcms.stackexchange.com/a/4734/57&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behavior we're seeing after implementing Ben's recommendation are that we can access both the http and https version of each page but a click on any link in the site populated by Craft templates (nav, blog overview page linking to other entries, etc.) takes us to the HTTP version of the page. So for example, if you're on &lt;a href=&quot;https://example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://example.com&lt;/a&gt;, a click on a nav link takes you to &lt;a href=&quot;http://example.com/click&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/click&lt;/a&gt; rather than &lt;a href=&quot;https://example.com/click&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://example.com/click&lt;/a&gt;. However, if we have a root relative link that was added manually through the control panel, that takes you to a version of the page consistent with the protocol of the current page. Basically, Craft is treating all links as if they're HTTP, even if you're on the secure version of the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like the site to function where if you're on the HTTPs version, a click on any link keeps you on the HTTPs version. Same goes for if you're on the HTTP version, any link click takes you to another HTTP page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to configure Craft to make that happen?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the contents of our craft/config/general.php file: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * General Configuration&#xA; *&#xA; * All of your system's general configuration settings go in here.&#xA; * You can see a list of the default settings in craft/app/etc/config/defaults/general.php&#xA; */&#xA;&#xA;// SEE http://buildwithcraft.com/docs/multi-environment-configs for info&#xA;&#xA;&#xA;// Ensure our urls have the right scheme&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) &amp;amp;&amp;amp; $_SERVER['HTTPS'] == &quot;on&quot; ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&#xA;// The site url&#xA;define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;&#xA;// The site basepath&#xA;define('BASEPATH',    realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;&#xA;  // DEFAULT&#xA;  '*' =&amp;gt; array(&#xA;    //'isSystemOn' =&amp;gt; false,&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'cpTrigger' =&amp;gt; 'discover',&#xA;    'addTrailingSlashesToUrls' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; SITE_URL,&#xA;    //'devMode' =&amp;gt; (preg_match('/dev|xip|staging/', $_SERVER['HTTP_HOST']) ? true : false),&#xA;    'devMode' =&amp;gt; false,&#xA;    'pardotUserName' =&amp;gt; &quot;FILLER TEXT&quot;,&#xA;    'pardotPassword' =&amp;gt; &quot;FILLER TEXT&quot;,&#xA;    'pardotUserKey' =&amp;gt; &quot;FILLER TEXT&quot;,&#xA;    //'backupDbOnUpdate' =&amp;gt; false,&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;    // 'cacheDuration' =&amp;gt; false,&#xA;    'defaultImageQuality' =&amp;gt; 90,&#xA;    'caseListPagination' =&amp;gt; 6,&#xA;  ),&#xA;  // Example dev&#xA;  'example.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'caseListPagination' =&amp;gt; 2,&#xA;  ),&#xA;&#xA;  'example.svn.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true&#xA;  ),&#xA;&#xA;  'local.example.com' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    // 'enableTemplateCaching' =&amp;gt; false // Only work on Craft 2.4 and later&#xA;  ),&#xA;  'environmentVariables' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; SITE_URL,&#xA;    'basePath' =&amp;gt; BASEPATH&#xA;  ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2020-02-05T07:53:21.777" Title="Problem with Site Running Both HTTP &amp; HTTPs" Tags="&lt;users&gt;&lt;url&gt;&lt;config&gt;&lt;siteurl&gt;&lt;https&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18979" PostTypeId="2" ParentId="18977" CreationDate="2017-02-14T19:31:48.927" Score="1" Body="&lt;p&gt;Not sure what validation error you're expecting from the template code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;code&gt;firstName&lt;/code&gt; and &lt;code&gt;lastName&lt;/code&gt; are non-required fields that will basically accept any input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;photoUrl&lt;/code&gt; could return a validation error if, for example, you tried to upload a &lt;code&gt;.txt&lt;/code&gt; file to but you're not calling the &lt;code&gt;errorList()&lt;/code&gt; macro on that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if &lt;code&gt;userDescription&lt;/code&gt; is required or not, but the &lt;code&gt;errorList()&lt;/code&gt; macro isn't being called there, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the variable that Craft returns back to the template when there are validation errors is called &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/UsersController.php#L1105&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;account&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd want to do something similar to what the &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Registration Form&lt;/a&gt; example doc does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if account is defined %}&#xA;    {{ errorList(account.getErrors('userDescription')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-14T19:31:48.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18980" PostTypeId="2" ParentId="18978" CreationDate="2017-02-14T19:39:30.687" Score="3" Body="&lt;p&gt;What web server are you running? I ask because IIS will define the &lt;code&gt;$_SERVER['https']&lt;/code&gt; variable &lt;a href=&quot;http://php.net/manual/en/reserved.variables.server.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;even if the site is being accessed via HTTP&lt;/a&gt; (it's value will be 'off') and Ben's answer is only checking if the &lt;code&gt;$_SERVER['https']&lt;/code&gt; variable is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution is to add a further check that &lt;code&gt;$_SERVER['https'] == 'on'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try updating this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Ensure our urls have the right scheme&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Ensure our urls have the right scheme&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) &amp;amp;&amp;amp; $_SERVER['HTTPS'] == &quot;on&quot; ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6284" LastActivityDate="2017-02-14T19:39:30.687" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="18981" PostTypeId="2" ParentId="18968" CreationDate="2017-02-14T19:52:37.777" Score="1" Body="&lt;p&gt;As Steve mentioned in Craft's docs, if the current page URI matches an entry's URI (defined in Settings &gt; Sections), you'll have an &lt;code&gt;entry&lt;/code&gt; variable available to use in your template. It's an &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; of the current entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of testing against a URL segment, I would test your list loop against this entry variable, preferably it's &lt;code&gt;id&lt;/code&gt; since that will always available and unique. Call you loop entries something else like &lt;code&gt;item&lt;/code&gt; so you can test the current loop's &lt;code&gt;item.id&lt;/code&gt; to the current page's &lt;code&gt;entry.id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the entries related to this category #}&#xA;{% set categoryEntries = craft.entries.relatedTo(category) %}&#xA;&#xA;{% for item in categoryEntries %}&#xA;  {% if item.id == entry.id %}&#xA;    &amp;lt;p class=&quot;active&quot;&amp;gt;{{ item.title }}&amp;lt;/p&amp;gt;&#xA;  {% else %}&#xA;    &amp;lt;p&amp;gt;{{ item.title }}&amp;lt;/p&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you want to get fancier, you can use Twig's conditional shorthand (&lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;ternary operator&lt;/a&gt;) inside a Twig output tag to simplify your code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in categoryEntries %}&#xA;  &amp;lt;p {{- item.id == entry.id ? ' class=&quot;active&quot;&quot;' }}&amp;gt;{{ item.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's similar to this answer on the question: &lt;a href=&quot;https://craftcms.stackexchange.com/a/561/273&quot;&gt;How can I add a dynamic “active” CSS class to the navigation on any given page?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-02-14T19:52:37.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18982" PostTypeId="2" ParentId="18941" CreationDate="2017-02-14T20:10:41.417" Score="1" Body="&lt;p&gt;Seems doable with a custom &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pseudo-code would be something like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetsService&lt;/a&gt; to grab all of the files for the source.&lt;/li&gt;&#xA;&lt;li&gt;Loop through the files and parse the parent folder paths.&lt;/li&gt;&#xA;&lt;li&gt;Based on the subfolder for the asset, check if an existing tag already exists with the &lt;a href=&quot;https://craftcms.com/classreference/services/TagsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;TagsService&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If 3 is true, assign that tag's value to a tag field on the Asset.&lt;/li&gt;&#xA;&lt;li&gt;If 3 is false, create the tag using the TagsService, then assign that tag's value to a tag field on the Asset.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-14T20:10:41.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18983" PostTypeId="2" ParentId="18969" CreationDate="2017-02-14T20:12:00.637" Score="1" Body="&lt;p&gt;Could you just append a new &quot;load more&quot; button to the page as part of the requested AJAX template and remove the old one when it's successfully loaded?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each load more button might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if paginate.nextUrl %}&#xA;  &amp;lt;a href=&quot;{{ paginate.nextUrl ~ queryString }}&quot; class=&quot;sr-button&quot; &#xA;     data-related-grid=&quot;artefact-grid&quot; &#xA;     data-method=&quot;loadonclick&quot;&amp;gt;Load More&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your &lt;code&gt;isotopeLoadMore()&lt;/code&gt; function, you can remove the load more button that was clicked on if you get a successful response and replace it with a button from the AJAX response. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* isotope load more function&#xA;------------------------------------------------*/&#xA;function isotopeLoadMore(grid,el,url,datas) {&#xA;&#xA;  // create a var for the button's parent so we can reuse it&#xA;  var loadIsotope = el.parent(&quot;.load-isotope&quot;)&#xA;  loadIsotope.addClass('loading');&#xA;&#xA;  if (url === '#' || !url) { url = srvars.ajaxurl }&#xA;  var addData = ''; if (datas) { addData = { action:'sr_load_more', o:datas }; }&#xA;  jQuery.ajax({&#xA;    type:'POST',      // this might lead to issues for html template&#xA;    url:url,&#xA;    data: addData,&#xA;    dataType:&quot;html&quot;,&#xA;    error: function () {&#xA;      loadIsotope.addClass(&quot;disabled&quot;);  &#xA;    },&#xA;    success: function(response) { &#xA;      //console.log(response);&#xA;      if (response) {&#xA;        setTimeout(function(){ &#xA;          var items = jQuery( jQuery(response).find('#'+grid.attr('id')).html());&#xA;          // Find the new Load More button in the response&#xA;          var loadMode = jQuery( jQuery(response).find('.load-isotope').html());&#xA;          items.imagesLoaded(function(){&#xA;            grid.append( items ).isotope( 'appended', items);&#xA;            // add the new Load More button&#xA;            loadIsotope.append( loadMode );&#xA;            // remove the original Load More button&#xA;            el.remove();&#xA;            animateOnScroll(false);&#xA;            // init video bg for appended items&#xA;            if(jQuery().phatVideoBg) { grid.find('.videobg-section').phatVideoBg(); }&#xA;          });&#xA;          loadIsotope.removeClass('loading');&#xA;        },500);&#xA;      } else {&#xA;        loadIsotope.addClass(&quot;disabled&quot;);  &#xA;      }&#xA;    }&#xA;  });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you'll have to attach your 'click' handler a little differently to make sure the dynamically loaded buttons will fire the same click function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of using...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var loadMore = jQuery('.load-isotope:not(.disabled) a');&#xA;&#xA;loadMore.click(function(){ ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That code will only attach the click function once when the page loads to the first button, but not any buttons that are dynamically added to the page thru your AJAX call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example JSFiddle of a script that creates buttons and an alert. Only the original button works. New buttons don't do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/alexroper/0aup8e5d/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://jsfiddle.net/alexroper/0aup8e5d/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this JSFiddle uses &lt;a href=&quot;http://api.jquery.com/on/#direct-and-delegated-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;delegated events&lt;/a&gt; like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.load-isotope').on('click', '.sr-button' ,function(event){ ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... to attached click events to any &lt;code&gt;$('.sr-button')&lt;/code&gt; element that's a child of &lt;code&gt;$('.load-isotope')&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/alexroper/uq613627/1/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://jsfiddle.net/alexroper/uq613627/1/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a similar problem to this Stack Overflow question:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/15090942/jquery-event-handler-not-working-on-dynamic-content&quot;&gt;Jquery event handler not working on dynamic content&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's a stab at what that might look like in your code. I'm not totally sure what everything in your code does, so you still may have to tweak it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.load-isotope').on('click', '.sr-button' ,function(event){&#xA;  event.preventDefault();&#xA;  var el = $(this);&#xA;  var related = $('#' + el.data('related-grid'));&#xA;  var href = el.attr('href')&#xA;  var datas = '';&#xA;  if ( ! el.parents('.load-isotope').hasClass('disabled') ) {&#xA;    isotopeLoadMore(related,el,href,datas);&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-02-17T18:19:09.017" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18984" PostTypeId="1" AcceptedAnswerId="18991" CreationDate="2017-02-14T21:19:07.783" Score="1" ViewCount="146" Body="&lt;p&gt;I'm trying out Craft Commerce for a jewellery website and I'm stuck between creating different products for each material (silver, gold and platinum) or using variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take rings for example. They're available in all three materials and a number of sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By creating a separate product for each material:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Plain band (Silver)&lt;/li&gt;&#xA;&lt;li&gt;Plain band (Gold)&lt;/li&gt;&#xA;&lt;li&gt;Plain band (Platinum)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;this gives me the advantage of a unique URL for each colour, and I only have to manage one variant (the size) for each product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would also make it easier to implement an &quot;Also available in&quot; where the site admin can link to the other colour products in a relationship field (as I understand it it's not possible to link to variants yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing an advantage of having only one product (Plain band) and variants for both the colour and the size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tom&lt;/p&gt;&#xA;" OwnerUserId="6284" LastActivityDate="2017-02-15T04:11:45.217" Title="Deciding between multiple products and variants" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18985" PostTypeId="1" AcceptedAnswerId="18986" CreationDate="2017-02-15T00:38:54.203" Score="1" ViewCount="361" Body="&lt;p&gt;Long story short, a client had 300,000+ entries come in through a form, which caused the database size to swell, exceeding the storage capacity of the VPS and causing the site to crash. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to manually delete all the entries from that channel from the craft_entries table, which got them back within storage limits and got the site back online. Rebuilding the search index got that table back down to a normal size. However, both the craft_content and craft_entryversions tables are still measured in GB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know much about the database architecture in Craft, and raw MySQL is not my strong suit. Is there anyway to cleanup those tables based on a channel? As in, I need to remove any stored content that's related to a specific channel and leave the rest of it in tact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5137" LastEditorUserId="5137" LastEditDate="2017-02-15T01:29:37.413" LastActivityDate="2017-02-15T02:47:21.880" Title="Looking for tips on cleaning up craft_content and craft_entryversions tables after spam attack" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18986" PostTypeId="2" ParentId="18985" CreationDate="2017-02-15T00:51:34.597" Score="0" Body="&lt;p&gt;Assuming the SPAM posts came through in a contiguous block, one semi-easy way would be to restore the 300k entry database locally on a Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could do a SQL query like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DELETE FROM `craft_elements` WHERE `id` IN (&#xA;    SELECT `id` FROM `craft_entries` WHERE`dateCreated` BETWEEN '2017-02-01 00:00:00' AND '2017-02-02 00:00:00'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adjusting the &lt;code&gt;dateCreated&lt;/code&gt; values for the beginning and ending of the SPAM posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cascading deletes on the foreign keys that Craft use will kick in and clean up all of the content in the related tables like &lt;code&gt;craft_content&lt;/code&gt; and &lt;code&gt;craft_entryrevisions&lt;/code&gt; (as well as others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could restore that cleaned-up database back to production.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-15T00:51:34.597" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18987" PostTypeId="1" AcceptedAnswerId="18988" CreationDate="2017-02-15T02:16:07.677" Score="1" ViewCount="243" Body="&lt;p&gt;I've got News Archive pages that display all entries posted in a certain month/year. For example June 2016 shows all entries created in June of 2016!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fetching the entries based on &lt;code&gt;craft.request.segment&lt;/code&gt; (as the URL ends in /june/2016 etc). This works great for all English months, but when my URL says /juni/2016 (the German month name) it can't find any entries??&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.segment(2) %}&#xA;{% set year = craft.request.segment(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's defintely a translation thing. Anyone know how &lt;code&gt;craft.request.segment&lt;/code&gt; can work with locales (German and simplified Chinese) too?&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-02-15T02:39:40.207" Title="Archive pages with full month names?" Tags="&lt;templating&gt;&lt;localization&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18988" PostTypeId="2" ParentId="18987" CreationDate="2017-02-15T02:20:19.960" Score="1" Body="&lt;p&gt;Twig’s &lt;code&gt;date&lt;/code&gt; filter is aware of the current Craft locale, so you should be able to create a DateTime after composing a string that the filter accepts (see PHP &lt;a href=&quot;http://www.php.net/en/strtotime&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;strtotime&lt;/code&gt; function&lt;/a&gt; docs, which the filter uses behind the scenes).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set day = 1 %}&#xA;{% set month = 'juni' %}&#xA;{% set year = 2016 %}&#xA;&#xA;{% set dateString = [day, month, year]|join(' ') %}&#xA;{% set date = dateString|date %}&#xA;&#xA;{{ date }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-02-15T02:39:40.207" LastActivityDate="2017-02-15T02:39:40.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18989" PostTypeId="2" ParentId="18683" CreationDate="2017-02-15T02:23:03.420" Score="5" Body="&lt;p&gt;You can add custom fields to store the 'other' price for your products (and/or variants), like, as you say, a matrix, or probably even a table would do.  The fields can then be edited by admins in the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your templates, you'd selectively display whichever price the particular market needs - this would just be basic template logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you'll also need a simple custom plugin that listens to &lt;code&gt;onPopulateLineItem&lt;/code&gt; and checks which market the customer is in, and modifies the lineItem price accordingly (by retrieving the correct price form the appropriate field).  Once the lineItem prices are modified as appropriate, they'll be used for the payments and stored with the order, factored into totals etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an example of modifying a lineItem in the docs here:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you have other requirements not mentioned, for someone with Commerce experience, that would be really be quite simple to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Based on ~ a years work with Commerce and related plugin writing).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-02-15T23:08:52.817" LastActivityDate="2017-02-15T23:08:52.817" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18990" PostTypeId="2" ParentId="18985" CreationDate="2017-02-15T02:47:21.880" Score="0" Body="&lt;p&gt;Put this: &lt;a href=&quot;https://github.com/aberkie/craft-recaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aberkie/craft-recaptcha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(or something) on your forms going forward.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-15T02:47:21.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18991" PostTypeId="2" ParentId="18984" CreationDate="2017-02-15T04:11:45.217" Score="2" Body="&lt;p&gt;Really it largely comes down to data/content concerns.  E.g. using one &lt;code&gt;product&lt;/code&gt; allows you to keep all the data that is shared by those products together, and is very DRY...and changes (be it to content, pricing, shipping etc) - only need to me made in one place, versus say 3 in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the lack of linking to variants is a definite disadvantage (one expects that will come in due course, but for now..)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the cost of the gain (one place to edit) is too high, or there isn't much data to worry about, then by all means use 3 products and one level of variants.  It's precisely this flexibility that makes Commerce so....flexible!  (And useful :) )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no real right or wrong, and it would be easy to test both approaches - and even put them in front of the final editors for their view.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-15T04:11:45.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18992" PostTypeId="2" ParentId="18973" CreationDate="2017-02-15T04:16:58.667" Score="2" Body="&lt;p&gt;I don't think there is an easy workaround here as you're dealing with logged in user functionality, and by definition that's not really designed to be easy to workaround.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the easiest thing is for the admin to use the 'log in as XXX' functionality, and then complete the order for the customer (assuming the customer had a Craft account which is not, per se, a given with Commerce).  If they're guest customers, the admin should probably jsut log out, complete the order as a guest, and then log back in, basically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Order entry for admins (via the backend) is on the Commerce plans, though, so a better solution may well appear.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-15T04:16:58.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18993" PostTypeId="2" ParentId="18974" CreationDate="2017-02-15T04:25:17.477" Score="3" Body="&lt;p&gt;Luke's answer above is absolutely right and the simplest approach, but as I commented above, I wrote a plugin for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/bossanova808/CommerceRegisterOnCheckout&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bossanova808/CommerceRegisterOnCheckout&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..the reason being that I wanted to integrate registration &lt;em&gt;during&lt;/em&gt; the checkout, not after as Luke has done above.  And the motivation for this is that site registration rates plummet (like, by 80%+ in my totally anecdotal data/experience) - if the registration comes AFTER checkout.  We get a MUCH higher rate of people joining (which has all sorts of business benefits for us) - if we integrate it right IN to the checkout flow.  I can't say why that is precisely, but it seems like most folks mentally check out (excuse the pun) the moment they hit 'Submit Order'....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wrote the above to allow a more integrated approach, which does much as what you describe - there's an ajax POST but it's during the payment part of the process (i.e. the actual checkout but), and the user is then registered &amp;amp; logged in (and can e.g. be taken then automatically to their orders summary page).  If there is any failure in registration (e.g. they've forgotten they registered before) - we handle that and present whatever we need to (including possibly a pre-filled registration form for them to have another go with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(BTW I agree - this should definitely be supported by Commerce in core).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-15T04:25:17.477" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18994" PostTypeId="1" CreationDate="2017-02-15T10:15:03.280" Score="1" ViewCount="229" Body="&lt;p&gt;We had a Stripe order go through recently, where the order value was zero and there were no line items. The client has called the customer to figure out what happened:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The customer added a product to the cart as normal.&lt;/li&gt;&#xA;&lt;li&gt;They entered their address details.&lt;/li&gt;&#xA;&lt;li&gt;They reached the payment page and left it there for over an hour.&lt;/li&gt;&#xA;&lt;li&gt;They returned and went to pay with Stripe, entering their card details and the payment seemingly going through but with a value of £0.00.&lt;/li&gt;&#xA;&lt;li&gt;They were redirected to the order thank you page and received their order email detailing their purchase of nothing for £0.00.&lt;/li&gt;&#xA;&lt;li&gt;They then completed the purchase afresh and it went through fine.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's presumably an issue with the cart timing out. Does anyone know if there is anything I can do about this?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-15T10:52:40.540" Title="Craft Commerce cart timing out but allowing order to be processed" Tags="&lt;plugin-craftcommerce&gt;&lt;cookies&gt;&lt;timeout&gt;&lt;omnipay-stripe&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18995" PostTypeId="2" ParentId="18994" CreationDate="2017-02-15T10:52:40.540" Score="1" Body="&lt;p&gt;This is likely due to the item going out of stock while they were away from the cart, then when they went to pay, the item had to be removed from the cart, but they should have seen an error message when they tried to pay:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Something changed with the order before payment, please review your order and submit payment again.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The secondary issue is allowing zero value orders. At the moment, zero value orders are allowed and payment gateways are not even called due to the payment due being zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the client side, you could hide the payment buttons if the order value is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We should introduce an &lt;code&gt;allowPaymentOnZeroValueCarts&lt;/code&gt; type config option that stops these orders from coming through if dezired. I will add that to the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I might also be a good idea to put some javascript on the page, that forces a refresh after a timeout.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-15T10:52:40.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18996" PostTypeId="1" AcceptedAnswerId="18998" CreationDate="2017-02-15T11:41:44.657" Score="1" ViewCount="525" Body="&lt;p&gt;I'm setting up a website using Craft Cms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything was working fine on local dev, but now I moved it to a development server, I'm getting an error every time I try to create a new entry (or section).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When devMode == false I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]:&#xA;  General error: 1785 Statement violates GTID consistency: Updates to&#xA;  non-transactional tables can only be done in either autocommitted&#xA;  statements or single-statement transactions, and never in the same&#xA;  statement as updates to transactional tables.. The SQL statement&#xA;  executed was: INSERT INTO &lt;code&gt;craft_searchindex&lt;/code&gt; (&lt;code&gt;elementId&lt;/code&gt;,&#xA;  &lt;code&gt;attribute&lt;/code&gt;, &lt;code&gt;fieldId&lt;/code&gt;, &lt;code&gt;locale&lt;/code&gt;, &lt;code&gt;keywords&lt;/code&gt;) VALUES (:elementId,&#xA;  :attribute, :fieldId, :locale, :keywords) ON DUPLICATE KEY UPDATE&#xA;  &lt;code&gt;keywords&lt;/code&gt; = :keywords. Bound with :elementId='61',&#xA;  :attribute='field', :fieldId='1', :locale='en', :keywords=''&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6263" LastActivityDate="2017-02-15T15:18:05.170" Title="Internal server error in Admin after migration" Tags="&lt;error-message&gt;&lt;admin&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18997" PostTypeId="1" CreationDate="2017-02-15T13:31:42.463" Score="1" ViewCount="430" Body="&lt;p&gt;Is there a way to disable the general entry enable/disable toggle button for some users and let them have only the localised enable/disable button.&#xA;Because I had the problem that a user disabled an entry with the general button and he disabled the entry for all locales. So I want to make it easier for them and remove that general button that affects others. &lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2017-02-15T19:16:28.677" LastActivityDate="2017-03-21T05:43:58.980" Title="Remove entry enable/disable for user" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18998" PostTypeId="2" ParentId="18996" CreationDate="2017-02-15T15:18:05.170" Score="1" Body="&lt;p&gt;After some debugging I found the answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is caused by craft_searchindex using MyISAM as the table engine, while the rest are using InnoDB, and the server having &lt;code&gt;enforce_gtid_consistency&lt;/code&gt; ON. This caused issues on transactions that included queries to MyISAM tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems that the reason for this is supporting full text searchess in old MySQL versions (as InnoDB gained full text search support around 5.6.4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now experimenting on switching the engine for that table and seems to work nicely. &lt;/p&gt;&#xA;" OwnerUserId="6263" LastActivityDate="2017-02-15T15:18:05.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18999" PostTypeId="1" CreationDate="2017-02-15T15:28:10.233" Score="0" ViewCount="162" Body="&lt;p&gt;How can I set a controller for the homepage? I can't seem to find any way to override the default route to the homepage. I need to call an action from the homepage and can't find any examples of this can be done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a matrixfield with entries in them and want to filter out the matrix blocks that have expired entries on the homepage.&lt;/p&gt;&#xA;" OwnerUserId="6293" LastActivityDate="2017-02-15T16:20:32.033" Title="How do I set a controller for my homepage" Tags="&lt;routes&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19000" PostTypeId="2" ParentId="18997" CreationDate="2017-02-15T15:35:39.593" Score="1" Body="&lt;p&gt;One way to do it would be to use the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS plugin&lt;/a&gt; and hide the button with CSS. But I guess that would hide it for all users, including admins.&#xA;Maybe you could write a little plugin for it that checks who logs into the CP and hide it if it's a certain user(group).&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-15T15:35:39.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19002" PostTypeId="2" ParentId="18999" CreationDate="2017-02-15T16:20:32.033" Score="1" Body="&lt;p&gt;Ok, maybe you can check if the entry in the matrix block is still valid (non-expired) and if that's not the case, just don't render the matrix block? Put everything in a simple if statement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this (hasn't been tested, use it as an example of what the actual code would be):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {% if block.type == &quot;something&quot; %}&#xA;        {% if block.entry.status != 'expired' %}&#xA;            {{ block.entry.title}}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-02-15T16:20:32.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19003" PostTypeId="1" AcceptedAnswerId="19027" CreationDate="2017-02-15T17:25:21.547" Score="1" ViewCount="235" Body="&lt;p&gt;I have two channel sections, each with only their own entry types. I've added the same category group field to both. I'd like to filter each channel's list of entries by the same category group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you're on Channel Steve (for example) you could hit the Category B link and see all the entries in the channel tagged with Category B. Then the same for Channel Bob. The same Category B link would be there, but when clicked it would show only the entries in Channel Bob tagged with Category B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm running into is that each category group uses only one path and template, and I need n of them. It seems like it'd be easy enough to associate one path/categories with one template multiple times for each category group so the category variable would be available on each channel's template. I think this is the optimal solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm making it work with URL segment sniffing, but that feels hacky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how can you set up category filtering on multiple channels with the same category group?&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2017-02-16T20:41:54.420" LastActivityDate="2017-02-17T17:02:37.773" Title="How to use the same category group as a filter on multiple channel sections?" Tags="&lt;categories&gt;&lt;sections&gt;&lt;navigation&gt;&lt;filter&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19004" PostTypeId="1" AcceptedAnswerId="19006" CreationDate="2017-02-15T18:21:34.807" Score="2" ViewCount="340" Body="&lt;p&gt;I would like to reduce the size of a site's database. The reasons are as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To speed up the syncing process from live to local&lt;/li&gt;&#xA;&lt;li&gt;To hopefully speed up sql query execution time (an experiment)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have many sections and hundreds upon hundreds of entries, all with versioning enabled. My question is, is there a way to 'trim the fat', or to put it better perhaps remove stale old version types (perhaps just keep the 5 most revisions for each entry)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for you help! &lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2017-02-15T19:23:10.020" Title="Reduce Database size" Tags="&lt;database&gt;&lt;entry-versions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19005" PostTypeId="1" AcceptedAnswerId="19007" CreationDate="2017-02-15T18:39:22.247" Score="1" ViewCount="123" Body="&lt;p&gt;Trying to get this json api to work for us and keep running into issues. Here, when trying to list all items, it throws the following PHP error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 65552 bytes) in /home/accesstrucks/craft/app/framework/YiiBase.php on line 618&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are only 100 listings currently, but this is just for testing. Which is nothing compared to how many listings there will be when live. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'alltrucks.json' =&amp;gt; [&#xA;      'elementType' =&amp;gt; 'Entry',&#xA;      'criteria' =&amp;gt; ['section' =&amp;gt; 'trucks'],&#xA;      'paginate' =&amp;gt; false,&#xA;      'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        return [&#xA;          $entry-&amp;gt;year.' '.$entry-&amp;gt;manufacturer.' '.$entry-&amp;gt;model,&#xA;          (string)$entry-&amp;gt;author,&#xA;          !empty((string)$entry-&amp;gt;category[0]) ? (string)$entry-&amp;gt;category[0] : null, &#xA;          !empty($entry-&amp;gt;listingPhotos[0]-&amp;gt;url) ? str_replace('/images/uploads/listings/', '', $entry-&amp;gt;listingPhotos[0]-&amp;gt;url) : null,&#xA;          ($entry-&amp;gt;saleType=='new') ? '0' : '1',&#xA;          (string)$entry-&amp;gt;featured,&#xA;          ($entry-&amp;gt;saleType-&amp;gt;label=='new') ? '0' : '1',&#xA;          $entry-&amp;gt;transmission,&#xA;          (string)$entry-&amp;gt;dateUpdated,&#xA;          $entry-&amp;gt;mileage,&#xA;          $entry-&amp;gt;price&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastEditorUserId="57" LastEditDate="2017-02-15T19:24:56.677" LastActivityDate="2017-02-15T19:24:56.677" Title="Element API: PHP Error: Fatal error: Allowed memory size of 33554432 bytes exhausted" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19006" PostTypeId="2" ParentId="19004" CreationDate="2017-02-15T19:23:10.020" Score="2" Body="&lt;p&gt;If you're specifically looking to trim the &lt;code&gt;entryversions&lt;/code&gt; table, there is a &lt;a href=&quot;https://craftcms.stackexchange.com/a/10675/57&quot;&gt;plugin&lt;/a&gt; that can automate the process for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, you can safely truncate these tables as well when moving between environments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;assetindexdata&#xA;assettransformindex&#xA;sessions&#xA;templatecaches&#xA;templatecachecriteria&#xA;templatecacheelements &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-02-15T19:23:10.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19007" PostTypeId="2" ParentId="19005" CreationDate="2017-02-15T19:24:42.153" Score="0" Body="&lt;p&gt;Your &lt;code&gt;php.ini&lt;/code&gt; file's &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;memory_limit&lt;/code&gt;&lt;/a&gt; setting is set to &lt;code&gt;32M&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to bump that up to something higher like &lt;code&gt;256M&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-15T19:24:42.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19008" PostTypeId="1" CreationDate="2017-02-15T20:08:26.077" Score="0" ViewCount="388" Body="&lt;p&gt;Anyone ever experience getting this after an update through the admin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Internal Server Error&#xA;mb_strpos(): empty delimiter&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And know of a solution?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2017-02-15T20:35:44.157" LastActivityDate="2017-02-15T20:35:44.157" Title="Internal Server Error after Craft update through admin" Tags="&lt;updating&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19009" PostTypeId="1" AcceptedAnswerId="19011" CreationDate="2017-02-15T20:37:57.787" Score="3" ViewCount="469" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the products in the store I am working have only one shipping method (ground). It seems redundant to have people go through the shipping screen since there is only one shipping option. Is there a way to just apply the default shipping for the product(s) based on the address they enter rather than going through the shipping screen?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-02-15T22:28:29.563" Title="Apply shipping without the shipping screen" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19010" PostTypeId="1" AcceptedAnswerId="19025" CreationDate="2017-02-15T20:49:22.827" Score="1" ViewCount="451" Body="&lt;p&gt;I am looking to have two separate front end registration forms for adding users to either the partners user group or the members user group. These have been created in the back end with the following user group handles: members and partners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added the following hidden field to the partners registration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userGroup&quot; value=&quot;partners&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the following hidden field to the members registration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;userGroup&quot; value=&quot;members&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have then created a plugin with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;   parent::init();&#xA;&#xA;     craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;      // only fire if new user&#xA;      if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;          // retrieve the userModel from the event&#xA;          $user = $event-&amp;gt;params['user'];&#xA;&#xA;          // check for presence of 'type' POST field&#xA;          $userGroup = craft()-&amp;gt;request-&amp;gt;getPost('userGroup');&#xA;&#xA;          $userGroups = array();&#xA;&#xA;          if ($userGroup == 'partners') {&#xA;              $userGroups[] = craft()-&amp;gt;userGroups-&amp;gt;getGroupByHandle('partners')-&amp;gt;id;&#xA;          }&#xA;&#xA;          if ($userGroup == 'members') {&#xA;              $userGroups[] = craft()-&amp;gt;userGroups-&amp;gt;getGroupByHandle('members')-&amp;gt;id;&#xA;          }&#xA;&#xA;          if (count($userGroups))&#xA;          {&#xA;              // assign the user to the groups&#xA;              craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $userGroups);&#xA;          }&#xA;      }&#xA;  });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is not adding the user to either of the groups but the user is created with no problem.&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2017-02-16T06:19:03.767" LastActivityDate="2018-10-03T16:35:53.183" Title="Set a user's group on a registration form using a hidden field" Tags="&lt;plugin-development&gt;&lt;user-groups&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19011" PostTypeId="2" ParentId="19009" CreationDate="2017-02-15T22:28:29.563" Score="3" Body="&lt;p&gt;You can automatically set the shipping method on a cart (e.g. by an ajax call) at any point by POSTing to &lt;code&gt;commerce/cart/updateCart&lt;/code&gt; - You just use an input with name &lt;code&gt;shippingMethod&lt;/code&gt; and and the value you supply is the handle of your shipping method, e.g. `ground'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you do this is entirely up to you, but note depending how you handle/implement this, changes in the cart contents &amp;amp; addresses can invalidate shipping methods, so you'd typically do this at some point after your cart index page...&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-15T22:28:29.563" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19012" PostTypeId="1" AcceptedAnswerId="19016" CreationDate="2017-02-16T04:02:28.377" Score="1" ViewCount="214" Body="&lt;p&gt;I would like group entries first by what category they are in, than group by month based on a Date/Time field like this for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;February 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;February 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 2&lt;/li&gt;&#xA;&lt;li&gt;Event 5&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is what I'm currently using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventCategories = craft.categories.group('events').find() %}&#xA;{% set eventEntries = craft.entries.section('event').order('dayStart asc').limit(null) %}&#xA;{% for category in eventCategories %}&#xA;    &amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;        {% for eventDate, entries in eventEntries | group(&quot;dayStart|date('F Y')&quot;) %}&#xA;            &amp;lt;h2&amp;gt;{{ eventDate }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in eventEntries.relatedTo(category).find() %}&#xA;                    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead the output I'm getting is this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category 1&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;February 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 1&lt;/li&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 1&lt;/li&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category 2&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;February 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 2&lt;/li&gt;&#xA;&lt;li&gt;Event 5&lt;/li&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 2&lt;/li&gt;&#xA;&lt;li&gt;Event 5&lt;/li&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Category 3&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;February 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;March 2017&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event 4 (in all categories)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to stop the duplicates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="6297" LastActivityDate="2017-02-16T13:18:21.757" Title="Group entries by category than by month based on Date/Time field" Tags="&lt;templating&gt;&lt;categories&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19013" PostTypeId="2" ParentId="18967" CreationDate="2017-02-16T07:49:54.227" Score="2" Body="&lt;p&gt;To check if the word &lt;code&gt;jobs&lt;/code&gt; is in the &lt;code&gt;sectionUrl&lt;/code&gt; you can use twig's &lt;code&gt;matches&lt;/code&gt; to create a regular expression that looks for &lt;code&gt;jobs&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSections = craft.sections.getAllSections() %}&#xA;{% for section in allSections %}&#xA;    {% set sectionURL = section.getUrlFormat()|split('/')[0] %}&#xA;&#xA;    {% if sectionURL matches &quot;/jobs/&quot; %}&#xA;        {{ section.name }}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4179" LastActivityDate="2017-02-16T07:49:54.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19014" PostTypeId="1" CreationDate="2017-02-16T09:43:16.153" Score="1" ViewCount="463" Body="&lt;p&gt;For a current project, I am attempting to automate the creation of a section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a default_section as the base of all the others. This section will contain a couple of entries, and a couple of entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal right now is to copy over the Entry Types in its totality. Right now, I'm struggling with the field layout that I have set for the Entry Type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that the first Entry Type has the following field layout:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IPxX8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IPxX8.png&quot; alt=&quot;image of the layout i&amp;#39;m trying to replicate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the code that I am using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function copyEntryTypes($savedSection, $entryTypes)&#xA;{&#xA;    foreach ($entryTypes as $entryType) {&#xA;        $copiedEntryType = $entryType;&#xA;&#xA;        $newEntryType = new EntryTypeModel();&#xA;        $copiedEntryType-&amp;gt;id = null;&#xA;        $copiedEntryType-&amp;gt;sectionId = $savedSection-&amp;gt;id;&#xA;        $values = $copiedEntryType-&amp;gt;attributes;&#xA;        $newEntryType-&amp;gt;setAttributes($values);&#xA;&#xA;        $currentLayout = $copiedEntryType-&amp;gt;getFieldLayout();&#xA;        $currentTabs = $currentLayout-&amp;gt;getTabs();&#xA;        $postedFieldLayout = array();&#xA;&#xA;        foreach ($currentTabs as $tab) {&#xA;            $fields = $tab-&amp;gt;getFields();&#xA;&#xA;            foreach ($fields as $field) {&#xA;                echo '&amp;lt;pre&amp;gt;' . var_export($field-&amp;gt;attributes) . '&amp;lt;/pre&amp;gt;';&#xA;                $postedFieldLayout[$tab-&amp;gt;name][] = $field-&amp;gt;fieldId;&#xA;            }&#xA;        }&#xA;&#xA;        $requiredFields = array();&#xA;&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout($postedFieldLayout, $requiredFields);&#xA;        $fieldLayout-&amp;gt;type = ElementType::Entry;&#xA;        $newEntryType-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;        //TODO: New Entry Types are succesfully being copied. Now all I need is to move over the fieldset&#xA;&#xA;        if (craft()-&amp;gt;sections-&amp;gt;saveEntryType($entryType))&#xA;        {&#xA;            var_dump('Successfully appended fields.');&#xA;        }&#xA;        else&#xA;        {&#xA;            var_dump('Could not append the fields.');&#xA;        }&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;//note: this code is WIP, so it's not super clean, sorry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is that the fields are being looped through correctly, I can var_dump them and find the correct ID's. The problem is that the resulting EntryType I have made does not contain the layout I am trying to copy over. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's looking like this: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/A9Mxa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A9Mxa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6155" LastEditorUserId="57" LastEditDate="2017-02-16T18:20:05.763" LastActivityDate="2017-03-21T09:06:50.387" Title="Copy the Entry Type along with its field layout" Tags="&lt;plugin-development&gt;&lt;entry-type&gt;&lt;layout&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19015" PostTypeId="2" ParentId="18967" CreationDate="2017-02-16T11:12:08.647" Score="1" Body="&lt;p&gt;If I understand you right all you need is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in allSections if craft.request.getFirstSegment() == 'jobs' %}&#xA;&#xA; {# other code here #}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can give conditions to your for loop which saves you another if statement. You also dont need to split any url because craft already got Segment selection which is found here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-16T11:12:08.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19016" PostTypeId="2" ParentId="19012" CreationDate="2017-02-16T11:39:48.320" Score="2" Body="&lt;p&gt;In your code, within the &lt;code&gt;{% for eventDate, entries in eventEntries | group(&quot;dayStart|date('F Y')&quot;) %}&lt;/code&gt; loop, in the sub-loop, you are looping over &lt;code&gt;eventEntries.relatedTo(category).find()&lt;/code&gt; rather than restricting the entries in that loop to the ones you have already grouped to the date, i.e. in the &lt;code&gt;entries&lt;/code&gt; array. That is why you are getting all the entries related to the category under each date heading, instead of just the ones falling under that date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventCategories = craft.categories.group('events').find() %}&#xA;{% set eventEntries = craft.entries.section('event').order('dayStart asc').limit(null) %}&#xA;{% for category in eventCategories %}&#xA;    &amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&#xA;        {% for eventDate, entries in eventEntries | group(&quot;dayStart|date('F Y')&quot;) %}&#xA;            &amp;lt;h2&amp;gt;{{ eventDate }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in entries if (category.id in entry.categoriesField.ids()) %}&#xA;                    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2017-02-16T13:18:21.757" LastActivityDate="2017-02-16T13:18:21.757" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19017" PostTypeId="2" ParentId="2813" CreationDate="2017-02-16T13:36:53.787" Score="5" Body="&lt;p&gt;The possible reason for no errors being shown is that you re-define your &lt;code&gt;entry&lt;/code&gt; variable before displaying the errors. Make sure you have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is not defined %}&#xA;    {% set entry = craft.entries.id(craft.request.segment(4)).first() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and not just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(craft.request.segment(4)).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-02-16T13:36:53.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19018" PostTypeId="1" CreationDate="2017-02-16T15:21:34.323" Score="2" ViewCount="319" Body="&lt;p&gt;I would like to retrieve related entries that have the same tags, not just one similar tag, but all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.tagActualite %}&#xA;{% set relatedEntries = craft.entries.relatedTo(tags).id('not ' ~ entry.id).limit(5).find() %}&#xA;&#xA;{% if relatedEntries | length %}&#xA;    {% for entry in relatedEntries %}&#xA;        do stuff&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it retrieves any entry with at least one similar tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would i check against ALL tags ? &lt;/p&gt;&#xA;" OwnerUserId="6295" LastEditorUserId="57" LastEditDate="2017-02-16T18:23:40.800" LastActivityDate="2017-02-17T12:02:24.140" Title="Find related entries with the same tags" Tags="&lt;relations&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19019" PostTypeId="1" CreationDate="2017-02-16T15:28:55.043" Score="1" ViewCount="91" Body="&lt;p&gt;I'm creating a plugin called &quot;Membership&quot; to handle user subscriptions through Stripe. I want to use SproutEmail to handle notification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a custom event as per the Sprout instructions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class SproutEmail_SubscribeEvent extends SproutEmailBaseEvent&#xA;{&#xA;    /**&#xA;     * Returns the qualified event name to use when registering with craft()-&amp;gt;on&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return 'membership.onSubscribe';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the event title to use when displaying a label or similar use case&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getTitle()&#xA;    {&#xA;        return Craft::t('When a user subscribes to a membership plan.');&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns a short description of this event&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getDescription()&#xA;    {&#xA;        return Craft::t('Triggers after a user has subscribed.');&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the data passed in by the triggered event&#xA;     *&#xA;     * @param Event $event&#xA;     *&#xA;     * @return mixed&#xA;     */&#xA;    public function prepareParams(Event $event)&#xA;    {&#xA;        return [&#xA;            'value' =&amp;gt; $event-&amp;gt;params['user']&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;SproutEmail is picking this up and I can select it as a rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M2iPh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M2iPh.png&quot; alt=&quot;SproutEmail Rule&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a listener to my plugin for &lt;code&gt;membership.onSubscribe&lt;/code&gt; to ensure it's working properly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('membership.onSubscribe', function(Event $event) {&#xA;    MembershipPlugin::log('membership.onSubscribe was triggered.');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it appears to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/02/16 15:07:33 [info] [plugin] membership.onSubscribe was triggered.&#xA;in /home/vagrant/Code/sbl.loc/craft/app/etc/plugins/BasePlugin.php (65)&#xA;in /home/vagrant/Code/sbl.loc/craft/plugins/membership/MembershipPlugin.php (56)&#xA;in /home/vagrant/Code/sbl.loc/craft/plugins/membership/services/MembershipService.php (15)&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However SproutEmail doesn't sent out any notification email and when I check the logs for the plugin there is no mention that my custom event was triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea what the issue might be?&lt;/p&gt;&#xA;" OwnerUserId="6299" LastActivityDate="2017-02-16T19:36:37.833" Title="Custom event not sending notification email" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19020" PostTypeId="2" ParentId="19010" CreationDate="2017-02-16T18:19:07.667" Score="2" Body="&lt;p&gt;There's a couple of problems you're probably running into.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;By default, assigning user permissions (either directly or via groups) requires the the currently logged in user to have the &lt;code&gt;assignUserPermissions&lt;/code&gt; permission. It sounds like you're doing this from a front-end request, where I'm guessing there is no authenticated session in place.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;User groups and permissions are applied in Craft &lt;em&gt;after&lt;/em&gt; the user has already been saved, so even if you got by #1, your changes would probably be overwritten.  The events you should be listening for are probably &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onBeforeAssignUserToGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeAssignUserToGroups&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;onAssignUserToGroups&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, you can always write a custom plugin that has a controller action, point your form to it, and do whatever custom user saving logic your situation requires as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-16T18:19:07.667" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19021" PostTypeId="2" ParentId="19019" CreationDate="2017-02-16T19:36:37.833" Score="1" Body="&lt;p&gt;We got to the bottom of this issue and it turned out to be that the &lt;code&gt;SproutEmail_SubscribeEvent::validateOptions()&lt;/code&gt; method was returning &lt;code&gt;false&lt;/code&gt;. Updating this to ensure the options were being validated properly fixed the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validateOptions()&#xA;{&#xA;  return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've updated the docs and will also more clearly document this in the &lt;code&gt;SproutEmailBaseEvent&lt;/code&gt; class in the next release.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-02-16T19:36:37.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19022" PostTypeId="1" AcceptedAnswerId="19029" CreationDate="2017-02-16T19:43:02.233" Score="2" ViewCount="232" Body="&lt;p&gt;I have a main product image and 4 thumbnails. Main product image is a lightswitch which is named &lt;code&gt;productMainImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here below i first iterate for the main image (which lightswitch is on) and than i make a second for loop for 4 thumbnails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is i don't like this code and it seems inefficient. I have to go out and go in for the loop because of my html stucture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to write this better?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Product Image --&amp;gt;&#xA;&amp;lt;div class=&quot;small-12 medium-5 column&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for image in product.productImages %}&#xA;      {% if image.productMainImage %}&#xA;        &amp;lt;div class=&quot;small-12 column&quot;&amp;gt;&#xA;          &amp;lt;a class=&quot;fancybox&quot; rel=&quot;gallery1&quot; href=&quot;{{image.getUrl()}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image.getUrl('productPageMainImage')}}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    &amp;lt;div class=&quot;small-12 column&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;row small-collapse medium-uncollapse&quot;&amp;gt;&#xA;        {% for image in product.productImages %}&#xA;        &amp;lt;div class=&quot;small-3 column&quot;&amp;gt;&#xA;          &amp;lt;a class=&quot;fancybox&quot; rel=&quot;gallery1&quot; href=&quot;{{image.getUrl()}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image.getUrl('productPageThumbnail')}}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- Product Image END --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="656" LastEditorUserId="22" LastEditDate="2017-05-09T20:25:12.203" LastActivityDate="2017-05-09T20:25:12.203" Title="How to use better loop for my product images" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19023" PostTypeId="1" AcceptedAnswerId="19024" CreationDate="2017-02-16T22:27:37.297" Score="4" ViewCount="457" Body="&lt;p&gt;I want to build an archive template where only entries older than 12 months show up.&#xA;Is there an clean and easy way to do so? I only have strange calculations in mind.&#xA;Something like this would be nice :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news') if entry.postDate &amp;gt; 12monthsago %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5954" LastEditorUserId="57" LastEditDate="2017-02-16T22:39:15.987" LastActivityDate="2017-02-16T22:41:41.947" Title="How to only show entries older than 12 months" Tags="&lt;templating&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19024" PostTypeId="2" ParentId="19023" CreationDate="2017-02-16T22:34:57.490" Score="7" Body="&lt;p&gt;You were close, you can set a &lt;code&gt;postDate&lt;/code&gt; param on your &lt;code&gt;craft.entries&lt;/code&gt; criteria model. And the Twig filter &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/date_modify.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;date_modify&lt;/code&gt;&lt;/a&gt; helps you to get the DateTime from 12 months ago.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timeAgo = now|date_modify('5:00 -12 months') %}&#xA;{% set postDateParam = '&amp;lt; ' ~ timeAgo|date('U') %}&#xA;&#xA;{% set entries = craft.entries.section('news').postDate(postDateParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-02-16T22:41:41.947" LastActivityDate="2017-02-16T22:41:41.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19025" PostTypeId="2" ParentId="19010" CreationDate="2017-02-16T23:13:54.833" Score="0" Body="&lt;p&gt;The code I have in my original question works well for me, you can use it for as many forms/usergroups as you needed just keep adding them as conditionals. I will be sticking with what I wrote. Anyone reading this please look at the comments as I found them very useful in better understanding other ways of solving the problem.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2017-02-16T23:13:54.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19026" PostTypeId="1" CreationDate="2017-02-16T23:25:18.813" Score="1" ViewCount="100" Body="&lt;p&gt;I am creating a website for not-for-profit organization that help victum of domestic violence. I have a page called Event which display all fund raising events under each month. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have setup Date/Time field and 12 months tabs and want to know how to display the entries for each month. For example I assign two entries for Feb and when I click on Feb tab, the entries will display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the sample code I wrote and copied Marion Newlevant's suggestion but when I tested it does not work. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what my html structure to display the entries for each month. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;recent-events2&quot;&amp;gt;&#xA;  &amp;lt;ul class=&quot;month-tabs&quot;&amp;gt;&#xA;    &amp;lt;li{% set startDate = year~'-'~month~'-01' %}&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;events&quot;&amp;gt;&#xA;&#xA;    {% set monthEvents = craft.entries&#xA;      .section('events')&#xA;      .dateField(['and', '&amp;gt;= '~startDate, '&amp;lt; '~endDate])&#xA;    %}&#xA;    &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;      &amp;lt;div&amp;gt;&#xA;&#xA;        {% for asset in entry.eventThumbnail %}&#xA;          {% if asset in entry.eventThumbnail %}&#xA;            &amp;lt;img src=&quot;{{ asset.getUrl('eventThumbnail') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;          {% else %}&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}public/assets/img/grey_image_placeholder.jpg&quot; alt=&quot;Skyfoundation&quot;&amp;gt;&#xA;          {% endif %}              &#xA;        {% endfor %} &#xA;&#xA;        &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;span&amp;gt;{{ entry.subtitle }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.eventBlurp}}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% for block in entry.eventOrganiser %}&#xA;          {% if block.type == &quot;eventDate&quot; %}&#xA;            &amp;lt;div class=&quot;ticket-cart&quot;&amp;gt; &#xA;              &amp;lt;a href=&quot;{{ block.ticketLink }}&quot; class=&quot;ticket-btn&quot;&amp;gt;Buy Ticket&amp;lt;/a&amp;gt;&#xA;              &amp;lt;div&amp;gt;{{ block.ticketLeftover }} / &amp;lt;i&amp;gt;{{ block.ticketAvail }}&amp;lt;/i&amp;gt; tickets left&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="130" LastEditDate="2017-02-17T03:45:53.563" LastActivityDate="2017-03-19T04:30:22.587" Title="How to display entries relevent to date assigned" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19027" PostTypeId="2" ParentId="19003" CreationDate="2017-02-16T23:35:19.913" Score="2" Body="&lt;p&gt;I would use a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; instead of the path and template assigned in the category group. If you want the urls to be &lt;code&gt;/Steve/B&lt;/code&gt; and &lt;code&gt;/Bob/B&lt;/code&gt;, the route would look like &lt;code&gt;{tag}/{slug}&lt;/code&gt;. Then in the template, fetch the channel using &lt;code&gt;tag&lt;/code&gt;, and the category handle using &lt;code&gt;slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fetching the category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('categoryGroup').slug(slug).first %}&#xA;{% if not category %}{% exit 404 %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetching the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntries = craft.entries.section(tag).relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2017-02-17T17:02:37.773" LastActivityDate="2017-02-17T17:02:37.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19028" PostTypeId="2" ParentId="19026" CreationDate="2017-02-17T01:53:51.110" Score="1" Body="&lt;p&gt;Assuming your date/time field is called &lt;code&gt;dateField&lt;/code&gt;, and your entries channel is &lt;code&gt;events&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to fetch just the entries that have dates in that month. You can do that like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the year and the month, the start of the month is (&lt;code&gt;~&lt;/code&gt; is the twig string concatination operator):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = year~'-'~month~'-01' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the start of the next month is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set endDate = startDate|date_modify('+1 month')|date('Y-m-d') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We use twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/date_modify.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;date_modify&lt;/a&gt; filter to get the start of the next month, and then twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/date.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;date&lt;/a&gt; filter to convert that to a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can fetch the entries for the month. You want ones where the &lt;code&gt;dateField&lt;/code&gt; is on or after &lt;code&gt;startDate&lt;/code&gt; and before &lt;code&gt;endDate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthEvents = craft.entries&#xA;  .section('events')&#xA;  .dateField(['and', '&amp;gt;= '~startDate, '&amp;lt; '~endDate])&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-02-17T01:53:51.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19029" PostTypeId="2" ParentId="19022" CreationDate="2017-02-17T02:02:47.273" Score="3" Body="&lt;p&gt;One way to do this is to query for the images once, and sort them into two different arrays. This uses twig's &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; filter, which is the way to add things to an array in twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainImages = [] %}&#xA;{% set otherImages = [] %}&#xA;&#xA;{% for image in product.productImages %}&#xA;  {% if image.productMainImage %}&#xA;    {% set mainImages = mainImages | merge([image]) %}&#xA;  {% else %}&#xA;    {% set otherImages = otherImages | merge([image]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can loop over the &lt;code&gt;mainImages&lt;/code&gt; array to get the images with the lightswitch on, and the &lt;code&gt;otherImages&lt;/code&gt; array to get the other images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have three for loops, but only one database query.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-02-17T02:02:47.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19030" PostTypeId="2" ParentId="503" CreationDate="2017-02-17T03:39:18.953" Score="3" Body="&lt;p&gt;Since Craft 2.6 you can do this cleanly with the &lt;code&gt;??&lt;/code&gt; null-coalescing operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not (entry.title ?? false) %}&#xA;  ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-02-17T03:39:18.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19031" PostTypeId="1" AcceptedAnswerId="19140" CreationDate="2017-02-17T07:14:56.617" Score="3" ViewCount="1280" Body="&lt;p&gt;I have many of the templates organized into sub-folders. E.g. &lt;code&gt;/manager/entries/edit.html&lt;/code&gt;, &lt;code&gt;/manager/users/edit.html&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is using 4-segment URLs to access code in those templates, e.g. &lt;code&gt;http://site.com/manager/entries/edit/{slug}&lt;/code&gt;, &lt;code&gt;http://site.com/manager/users/edit/{id}&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have to set up custom route for every template, e.g.     &lt;code&gt;'manager/users/edit/(.*)'        =&amp;gt; 'manager/users/edit',&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I could set up a &quot;generic&quot; route which would first check for existing templates in a subfolder (whether globally or on per-folder basis) and try to use that first? So I would not need to create route for each individual template.&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-02-24T07:23:11.883" Title="Catch-all routes based on template structure" Tags="&lt;url&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19032" PostTypeId="2" ParentId="19014" CreationDate="2017-02-17T10:17:34.183" Score="1" Body="&lt;p&gt;After hours I managed to fix it. I'm assuming I made an error where I was trying to copy the Fields in the Entry Type I literally just created. So it was copying over 0 fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I built the functions from scratch again and finally found the working code. For future reference or to help others, here is the snippet in question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function CopyEntryTypes($savedSection, $baseSection)&#xA;{&#xA;    $baseSectionEntryTypes = $baseSection-&amp;gt;getEntryTypes();&#xA;&#xA;    foreach ($baseSectionEntryTypes as $baseSectionEntryType) {&#xA;        $newEntryType = $this-&amp;gt;createNewEntryType($baseSectionEntryType, $savedSection-&amp;gt;id);&#xA;        //oke so the New Entry Type is saved, we should get a return statement from the function&#xA;        //now loop through the tabs/fields of the baseSection Entry Type.&#xA;&#xA;&#xA;        $currentLayout = $baseSectionEntryType-&amp;gt;getFieldLayout();&#xA;        $currentTabs = $currentLayout-&amp;gt;getTabs();&#xA;&#xA;        // This will the array passed to assembleLayout&#xA;        $postedFieldLayout = array();&#xA;&#xA;        // Loop through each tab and build our array&#xA;        foreach ($currentTabs as $tab) {&#xA;            $fields = $tab-&amp;gt;getFields();&#xA;            foreach ($fields as $field) {&#xA;                $postedFieldLayout[$tab-&amp;gt;name][] = $field-&amp;gt;fieldId;&#xA;            }&#xA;        }&#xA;&#xA;        //so now we have a collection of entry types, each of them have a tab-name which we can use to identify&#xA;        //the goal is to get 'all' the tabs into the new entry type.&#xA;        $requiredFields = array();&#xA;&#xA;        // Assemble the layout&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout($postedFieldLayout, $requiredFields);&#xA;        $fieldLayout-&amp;gt;type = ElementType::Entry;&#xA;        $newEntryType-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;        // Save it&#xA;        if (craft()-&amp;gt;sections-&amp;gt;saveEntryType($newEntryType))&#xA;        {&#xA;            Craft::log('Successfully appended fields.');&#xA;        }&#xA;        else&#xA;        {&#xA;            Craft::log('Could not append the fields.', LogLevel::Warning);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;private function createNewEntryType($baseSectionEntryType, $savedSectionId)&#xA;{&#xA;    $newEntryType = new EntryTypeModel();&#xA;    $baseSectionEntryType-&amp;gt;id = null;&#xA;    $baseSectionEntryType-&amp;gt;sectionId = $savedSectionId;&#xA;    $values = $baseSectionEntryType-&amp;gt;attributes;&#xA;    $newEntryType-&amp;gt;setAttributes($values);&#xA;&#xA;    if (craft()-&amp;gt;sections-&amp;gt;saveEntryType($newEntryType))&#xA;    {&#xA;        var_dump('Successfully saved Entry Type.');&#xA;    }&#xA;    else&#xA;    {&#xA;        var_dump('Could not save the Entry Type.');&#xA;    }&#xA;&#xA;    return $newEntryType;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm also using code that I modified from: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11644/how-can-i-programmatically-add-a-tab-to-entry-type&quot;&gt;How can I programmatically add a tab to entry type?&lt;/a&gt; so this guy deserves the credit.&lt;/p&gt;&#xA;" OwnerUserId="6155" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-02-17T10:17:34.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19033" PostTypeId="1" CreationDate="2017-02-17T10:39:28.627" Score="3" ViewCount="3233" Body="&lt;p&gt;I'm a newbie to Craft so apologies if this has been answered or is too simplistic for the forum but how do I change my site's favicon? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6305" LastEditorUserId="57" LastEditDate="2017-02-17T16:39:24.013" LastActivityDate="2019-07-17T06:33:22.930" Title="How do I add a favicon" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19034" PostTypeId="2" ParentId="19033" CreationDate="2017-02-17T10:49:06.850" Score="5" Body="&lt;p&gt;Just like you would add a regular favicon just in your head.&#xA;If you want it to be an uploaded picture I would say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a global and add a field like &quot;favicon&quot; to it and upload your image there and display it like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in favicon.fav %}&#xA;&amp;lt;link rel=&quot;icon&quot; type=&quot;image/png&quot; sizes=&quot;16x16&quot; href=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what I always do is just go to a favicon generator like:&#xA;&lt;a href=&quot;http://www.favicon-generator.org/&quot; rel=&quot;noreferrer&quot;&gt;http://www.favicon-generator.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And upload your logo and copy paste that code in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; tags in your &lt;code&gt;_layout.html&lt;/code&gt; file&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-17T10:49:06.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19035" PostTypeId="2" ParentId="19031" CreationDate="2017-02-17T11:54:29.927" Score="2" Body="&lt;p&gt;What we often do for a section (lets call it Pages) is actually not use any custom routing, and control things in the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by setting the section template to &lt;code&gt;pages/index&lt;/code&gt;. In your &lt;code&gt;index.html&lt;/code&gt; file, we usually have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Look for a template for this entry type (if any), then look for a template matching #}&#xA;{# the entry's slug, and fallback to the default '_entry' template #}&#xA;&#xA;{% include [&#xA;    'pages/' ~ entry.type,&#xA;    'pages/' ~ entry.slug,&#xA;    'pages/_entry'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using Twig's array-style include means it'll look for templates, and if one doesn't exist, move onto the next. In this scenario, we can simply create a file for an entry type, or even for a specific slug, with a fallback to a default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your case might be different of course, but might be a step in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-17T11:54:29.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19036" PostTypeId="2" ParentId="19018" CreationDate="2017-02-17T12:02:24.140" Score="2" Body="&lt;p&gt;I believe you'll need to look at using the following syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.relatedTo('and', { targetElement: tags })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might have some luck using the &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Similar&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-02-17T12:02:24.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19037" PostTypeId="2" ParentId="1458" CreationDate="2017-02-17T12:34:04.980" Score="9" Body="&lt;p&gt;You can now set &lt;code&gt;allowedFileExtensions&lt;/code&gt; and &lt;code&gt;extraAllowedFileExtensions&lt;/code&gt; in your config file. The first will re-define the list of allowed files, where the latter will allow you to add additional file types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I needed to add 3 additional formats:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'extraAllowedFileExtensions' =&amp;gt; 'bim, dwg, rvt'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://craftcms.com/docs/config-settings#allowedFileExtensions&quot; rel=&quot;noreferrer&quot;&gt;documentation here&lt;/a&gt; for details.&lt;/p&gt;&#xA;" OwnerUserId="4965" LastEditorUserId="344" LastEditDate="2017-07-11T13:25:04.337" LastActivityDate="2017-07-11T13:25:04.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19038" PostTypeId="1" CreationDate="2017-02-17T12:42:27.360" Score="1" ViewCount="63" Body="&lt;p&gt;I've created a new section, with one entry. When I want to live preview the entry, the live preview button isn't there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read this is because my new section doesn't have an active template? How do I resolve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very new to this!&lt;/p&gt;&#xA;" OwnerUserId="6306" LastActivityDate="2017-02-17T12:46:51.113" Title="New section/entry can't go live" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19039" PostTypeId="1" CreationDate="2017-02-17T12:44:01.713" Score="1" ViewCount="124" Body="&lt;p&gt;I have updated my &lt;code&gt;craft/config/general.php&lt;/code&gt; file to allow some new file types to be uploaded to my site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'extraAllowedFileExtensions' =&amp;gt; 'bim, dwg, rvt'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I output these file assets in the template, I would like to be able to use the {{ asset.kind }} property to output &quot;PDF&quot; or whatever name for my additional types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I see &lt;code&gt;unknown&lt;/code&gt; for each of my new types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look in the &lt;a href=&quot;https://craftcms.com/classreference/helpers/IOHelper#getFileKinds-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; for the IOHelper Class but could not see a way to add additional definitions.&lt;/p&gt;&#xA;" OwnerUserId="4965" LastEditorUserId="4965" LastEditDate="2017-03-19T18:35:54.820" LastActivityDate="2017-03-19T18:44:55.303" Title="Create new Asset Kinds" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19040" PostTypeId="2" ParentId="19038" CreationDate="2017-02-17T12:46:51.113" Score="2" Body="&lt;p&gt;Have you already made up an html template for this section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so you should check if you assigned it right.&#xA;Go to: Settings&gt;Sections&gt;(your new section you want to assign) and check the entry template. It should be something like (folder you made the html template in if there is any)/(name of file)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any written HTML its not possible to have a live preview as it doesn't output anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If thats alright could you post some pictures of your Folders and your back office?&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-17T12:46:51.113" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19041" PostTypeId="1" AcceptedAnswerId="19091" CreationDate="2017-02-17T14:30:51.243" Score="1" ViewCount="129" Body="&lt;p&gt;What am I doing wrong in the 'andWhere' part of this query? I've tried a variety of different ways of doing it but nothing seems to work... It just seems to be ignored. Does anyone know the proper way I should be doing it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($entryIds as $entryId) {&#xA;    $data[] = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('*')&#xA;    -&amp;gt;from('amforms_content')       &#xA;    -&amp;gt;where(array(&#xA;            'elementId' =&amp;gt; $entryId&#xA;    ))&#xA;    -&amp;gt;andWhere('dateCreated &amp;gt; 2017-02-11')&#xA;    -&amp;gt;queryAll();&#xA;}&#xA;&#xA;return array($data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4931" LastEditorUserId="4931" LastEditDate="2017-02-17T16:26:21.500" LastActivityDate="2017-02-20T18:10:46.330" Title="Can anyone tell me what's wrong with the 'andWhere' part of this query?" Tags="&lt;plugin-development&gt;&lt;query&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19043" PostTypeId="1" CreationDate="2017-02-17T16:53:56.687" Score="0" ViewCount="181" Body="&lt;p&gt;I have a potential client (car dealership) where in their existing 12 year old site they daily upload an Excel file to add/update/delete vehicles in stock. One file for new vehicles and one for used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the excel file does not have a column for images and they are unwilling/unable to add one. Instead they want images to be added in the same way they currently are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All images are ftp'd up to the server and are named ##_stocknumber so 01_12345, 02_12345, 03_12345 would be attached to the same entry but 01_4455, 02_4455, 03_4455, 04_4455 would be attached to a different entry. After upload the go to a link that processes the images and then emails any stock numbers that are missing images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way that this can be achieved in Craft?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-02-17T17:45:35.637" Title="Auto add Images to entry after ftp to server" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19044" PostTypeId="2" ParentId="19039" CreationDate="2017-02-17T17:13:18.493" Score="2" Body="&lt;p&gt;Currently, the &quot;file kinds&quot; list is &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/IOHelper.php#L1907-L1932&quot; rel=&quot;nofollow noreferrer&quot;&gt;hard-coded&lt;/a&gt; and doesn't expose itself to a config setting or plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can definitely make a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; to open it up, though!&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-03-19T18:44:55.303" LastActivityDate="2017-03-19T18:44:55.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19045" PostTypeId="2" ParentId="19043" CreationDate="2017-02-17T17:45:35.637" Score="2" Body="&lt;p&gt;Since it sounds like you are using a third-party plugin for the initial import, you'll need a new plugin to handle the ftp uploads.&#xA;This new plugin would need to perform the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Basic control panel page, or Controller action for firing off the processing&lt;/li&gt;&#xA;&lt;li&gt;Get the list of new images files from the FTP directory&lt;/li&gt;&#xA;&lt;li&gt;For each file:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parse the file name to get the associated vehicle stocknumber &lt;/li&gt;&#xA;&lt;li&gt;Query your vehicle entries based on the stock&lt;/li&gt;&#xA;&lt;li&gt;Use the Assets Service  (&lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/AssetsService&lt;/a&gt;) to&#xA;create and store the asset appropriately&lt;/li&gt;&#xA;&lt;li&gt;Save the associated asset to the Vehicle Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;At the end of the run, archive/remove the original uploaded files&lt;/li&gt;&#xA;&lt;li&gt;Email the list of stocknumbers you have image files for but not existing entries (using EmailService)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To further optimize the process/queries you could query all vehicles first and pull them out of an array by the stocknumber (instead of querying the DB each file).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to automate the process you could even build a task-listener to fire off your image-association plugin when it sees new images have been FTP'd to the vehicle image upload directory.&lt;/p&gt;&#xA;" OwnerUserId="5126" LastActivityDate="2017-02-17T17:45:35.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19046" PostTypeId="1" AcceptedAnswerId="19058" CreationDate="2017-02-17T20:10:14.730" Score="3" ViewCount="1713" Body="&lt;p&gt;How do I group entries by section? I have search results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = allowedSearchableEntries.search(query).order('score').limit(100) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SECTION NAME&lt;/strong&gt;&#xA;entry 1&#xA;entry 4&#xA;entry 6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SECTION NAME&lt;/strong&gt;&#xA;entry 3&#xA;entry 12&lt;/p&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-02-18T21:43:44.950" Title="Group entries by section" Tags="&lt;entries&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19047" PostTypeId="5" CreationDate="2017-02-17T20:55:24.310" Score="0" Body="&lt;p&gt;&lt;strong&gt;Craft CMS Support Topic:&lt;/strong&gt; &lt;a href=&quot;https://craftcms.com/support/topic/deploying&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deploying Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related CraftCMS Documentation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS Requirements&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Environment Configs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6047" LastEditorUserId="45" LastEditDate="2017-02-17T21:45:24.497" LastActivityDate="2017-02-17T21:45:24.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19048" PostTypeId="4" CreationDate="2017-02-17T20:55:24.310" Score="0" Body="Questions regarding the deployment of Craft CMS sites. " OwnerUserId="6047" LastEditorUserId="45" LastEditDate="2017-02-17T21:45:34.550" LastActivityDate="2017-02-17T21:45:34.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19049" PostTypeId="5" CreationDate="2017-02-17T21:03:39.160" Score="0" Body="&lt;p&gt;CraftCMS Documentation: &lt;a href=&quot;https://craftcms.com/docs/updating&quot; rel=&quot;nofollow noreferrer&quot;&gt;Updating&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6047" LastEditorUserId="6047" LastEditDate="2017-02-17T21:44:42.977" LastActivityDate="2017-02-17T21:44:42.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19050" PostTypeId="4" CreationDate="2017-02-17T21:03:39.160" Score="0" Body="Questions regarding updating Craft CMS or its plugins." OwnerUserId="6047" LastEditorUserId="45" LastEditDate="2017-02-17T21:45:44.927" LastActivityDate="2017-02-17T21:45:44.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19051" PostTypeId="1" CreationDate="2017-02-17T21:47:26.497" Score="1" ViewCount="135" Body="&lt;p&gt;I am looking to make use of the users first name as well as their email address on setpassword page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not seeing any way to grab those fields unless I am missing something?&lt;/p&gt;&#xA;" OwnerUserId="977" LastActivityDate="2017-04-19T03:09:57.760" Title="Get username and email on setpassword form" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19052" PostTypeId="2" ParentId="19051" CreationDate="2017-02-18T01:46:50.027" Score="1" Body="&lt;p&gt;Craft currently doesn't expose that user info to the setpassword template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a plugin that mimicked that portion of Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController&lt;/a&gt; except returns the &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;UserModel&lt;/a&gt; (or part of it) to the template and/or make a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; to expose more of info to that template.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-18T01:46:50.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19053" PostTypeId="1" AcceptedAnswerId="19054" CreationDate="2017-02-18T07:10:14.930" Score="1" ViewCount="222" Body="&lt;p&gt;Like all other CMS's Craft Commerce doesn't have a Cash On Delivery payment method by default. How can we add or create a COD method ?&lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-02-18T12:07:52.003" Title="Cash On Delivery for Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19054" PostTypeId="2" ParentId="19053" CreationDate="2017-02-18T12:07:52.003" Score="2" Body="&lt;p&gt;Craft Commerce has a COD method called the 'manual' gateway. Make sure you set it to authorize only and it will allow a customer to check out without submitting payment. When cash or cheque is presented you can 'capture' the manual transaction payment on the order edit screen. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-18T12:07:52.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19055" PostTypeId="1" CreationDate="2017-02-18T12:15:51.200" Score="2" ViewCount="727" Body="&lt;p&gt;What’s the best way to check if an assets field contains a file of a certain type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something to the effect of: &lt;code&gt;if assetsField.contains.file-of-type('image')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5520" LastActivityDate="2017-02-18T13:03:25.370" Title="Check if Assets Field Contains File of Type" Tags="&lt;templating&gt;&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19056" PostTypeId="2" ParentId="19055" CreationDate="2017-02-18T12:26:38.497" Score="2" Body="&lt;p&gt;See &lt;code&gt;kind&lt;/code&gt; in the docs: &lt;a href=&quot;https://craftcms.com/docs/templating/assetfilemodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/assetfilemodel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't tried it but I suspect it's something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set file = assetsField.first %}&#xA;{% if file.kind == 'image' %}&#xA;  // blah blah&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's also &lt;code&gt;extension&lt;/code&gt; but kind is probably better here.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-18T12:26:38.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19057" PostTypeId="2" ParentId="19055" CreationDate="2017-02-18T13:03:25.370" Score="1" Body="&lt;p&gt;In addition to the model’s &lt;code&gt;kind&lt;/code&gt; property mentioned in the other answer, there is also a &lt;code&gt;kind&lt;/code&gt; parameter for asset criteria models.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set containsVid = assetsField.kind('video').total() &amp;gt; 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-02-18T13:03:25.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19058" PostTypeId="2" ParentId="19046" CreationDate="2017-02-18T21:43:44.950" Score="5" Body="&lt;p&gt;You can use the Twig &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;noreferrer&quot;&gt;group filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = allowedSearchableEntries.search(query).order('score').limit(100) %}&#xA;&#xA;{% set entriesBySection = entries|group('section') %}&#xA;&#xA;{% for section, entriesInSection in entriesBySection %}&#xA;    &amp;lt;h2&amp;gt;{{ section }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entriesInSection %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="831" LastActivityDate="2017-02-18T21:43:44.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19059" PostTypeId="2" ParentId="1011" CreationDate="2017-02-18T23:32:24.453" Score="4" Body="&lt;p&gt;FWIW, Niall, I've always just created an additional Profile field for people's images. The weird &quot;not really an asset&quot; aspect of the profile pictures is gone in Craft 3, but I found enough annoyances in Craft 2.x that I just started using a custom field instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the downside is you don't get a nice picture of them in the backend, but the cases where I've done this, the person doesn't have access to the Craft backend at all anyway.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-18T23:32:24.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19060" PostTypeId="1" CreationDate="2017-02-19T01:32:16.103" Score="1" ViewCount="5558" Body="&lt;p&gt;It's the first time I'm using Wamp for local hosting my Craft website.&#xA;I've changed my Windows and Wamp apache host file for accessing my domainname instead of localhost. (&lt;em&gt;ronvanderwerf.loc&lt;/em&gt; instead of &lt;em&gt;localhost&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front-end of the website looks fine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ft2I1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ft2I1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;(I'm getting a error because I still need to setup Craft)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, I can't access the admin panel. I get a 404 Not Found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've changed the directory order of my project for some hosting reasons:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gy5zX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gy5zX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My apache host file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;ServerName ronvanderwerf.loc&#xA;DocumentRoot c:/wamp64/www&#xA;&amp;lt;Directory  &quot;c:/wamp64/www/&quot;&amp;gt;&#xA;    Options +Indexes +Includes +FollowSymLinks +MultiViews&#xA;    AllowOverride All&#xA;    Require local&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My root htaccess file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteBase /&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can help me.&lt;/p&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2019-07-11T09:23:23.270" Title="Can't access admin panel" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;404&gt;&lt;apache&gt;&lt;hosting&gt;" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19061" PostTypeId="1" AcceptedAnswerId="19066" CreationDate="2017-02-19T09:16:54.307" Score="10" ViewCount="15682" Body="&lt;p&gt;I currently have a working profile update form using purely craft but I would like to now enhance that using Vue and Axios to update via Ajax. I may well submit a couple of questions rather than put them all in one to try and help others. For now my main two issues are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft doesn't seem to like how I am supplying the CSRF so I have set it to false for now to test but I need that working.&lt;/li&gt;&#xA;&lt;li&gt;When I submit the form with with CSRF set to false in my config I get a 200 success response but the user is not updated.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I suspect in both cases I am just misunderstanding how Craft expects to see the data sent, here is my code (simplified to one form field for now).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; @submit.prevent=&quot;submitForm&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;members/profile/{% include '_includes/helpers/user_profile_link' %}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;control&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;first-name&quot; class=&quot;label&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;first-name&quot; class=&quot;input&quot; type=&quot;text&quot; name=&quot;firstName&quot; value=&quot;&quot; v-model=&quot;user.firstName&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot; class=&quot;button is-primary&quot;&amp;gt;Save Profile&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my Vue.js code, I have a div with an id of &lt;code&gt;app&lt;/code&gt; around the whole form and Vue is working as it should with the model binding:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var app = new Vue({&#xA;  delimiters: ['@{', '}'],&#xA;  el: '#app',&#xA;  data: {&#xA;    user: {&#xA;      firstName: '{{ currentUser.firstName }}'&#xA;    }&#xA;  },&#xA;  methods: {&#xA;    submitForm: function () {&#xA;&#xA;      var config = {&#xA;        responseType: 'json'&#xA;      };&#xA;&#xA;      var data = this.user;&#xA;&#xA;      data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;      axios.post('/', data, config)&#xA;           .then(function(response) {&#xA;             console.log('saved', response, data)&#xA;           });&#xA;    }&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my response from the console:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3CWEh.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3CWEh.png&quot; alt=&quot;Network headers in console&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my console log from the submitForm method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9Vpzp.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Vpzp.png&quot; alt=&quot;Console log from submitForm method&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally here is my craft log for the form post:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_SERVER=array (&#xA;  'HTTP_HOST' =&amp;gt; 'tfa.dev',&#xA;  'HTTP_CONNECTION' =&amp;gt; 'keep-alive',&#xA;  'CONTENT_LENGTH' =&amp;gt; '125',&#xA;  'HTTP_ACCEPT' =&amp;gt; 'application/json, text/plain, */*',&#xA;  'HTTP_ORIGIN' =&amp;gt; 'http://tfa.dev',&#xA;  'HTTP_USER_AGENT' =&amp;gt; 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',&#xA;  'CONTENT_TYPE' =&amp;gt; 'application/json;charset=UTF-8',&#xA;  'HTTP_REFERER' =&amp;gt; 'http://tfa.dev/members/profile/edit/gareth',&#xA;  'HTTP_ACCEPT_ENCODING' =&amp;gt; 'gzip, deflate',&#xA;  'HTTP_ACCEPT_LANGUAGE' =&amp;gt; 'en-US,en;q=0.8',&#xA;  'HTTP_COOKIE' =&amp;gt; '40e5c202a55b621f12b3289f66fe4061username=0298fcd1dea0b36e656a86a889e064baf094d01cs%3A84%3A%2290509830d9f39442177d77334e3cfc3eebb72a07czoyNDoiZ2FyZXRoQGdhcmV0aHJlZGZlcm4uY29tIjs%3D%22%3B; 00b542cb70dd8d427c43ee85c4523092username=0e93371fd3c232c26316e28b35a48feadfae92b5s%3A92%3A%22d736848c422c74ac22e0fba4ab7cec817bfa3da8czoyOToidGVzdG1lbWJlcjNAZ2FyZXRocmVkZmVybi5jb20iOw%3D%3D%22%3B; CraftSessionId=f0e0cea11a268bef98340313df175698; YII_CSRF_TOKEN=c447a0d39e762b38c2e68f6aee96339a633cd654s%3A81%3A%225DGNNDo2iYd6E0FBYBehrXDGn4Ns9uMpQDE3ICPk%7C65cf935623e7404164bc9dce5ae11221666cbe32%22%3B; 00b542cb70dd8d427c43ee85c4523092=77140dec55873e6c5621e2bfb211d3fbe977eae6s%3A428%3A%2214c20ffabe93387c4b6fc93f8c7d497848337bb6YTo2OntpOjA7czoyOToidGVzdG1lbWJlcjNAZ2FyZXRocmVkZmVybi5jb20iO2k6MTtzOjMyOiI1ck50REhyMEltR2RNRDNRYkJpRnR%2BQW4xNzNuTnBmbCI7aToyO3M6MzY6ImUzOGQyNTJiLTgyYzAtNDBiZi1hYTY3LTFjY2FmMjYzN2QxYSI7aTozO2k6MDtpOjQ7czoxMjA6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IEludGVsIE1hYyBPUyBYIDEwXzEyXzMpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS81Ni4wLjI5MjQuODcgU2FmYXJpLzUzNy4zNiI7aTo1O2E6MDp7fX0%3D%22%3B',&#xA;  'PATH' =&amp;gt; '/usr/bin:/bin:/usr/sbin:/sbin',&#xA;  'SERVER_SIGNATURE' =&amp;gt; '',&#xA;  'SERVER_SOFTWARE' =&amp;gt; 'Apache',&#xA;  'SERVER_NAME' =&amp;gt; 'tfa.dev',&#xA;  'SERVER_ADDR' =&amp;gt; '::1',&#xA;  'SERVER_PORT' =&amp;gt; '80',&#xA;  'REMOTE_ADDR' =&amp;gt; '::1',&#xA;  'DOCUMENT_ROOT' =&amp;gt; '/Users/garethredfern/Code/tfa/public',&#xA;  'SERVER_ADMIN' =&amp;gt; 'you@example.com',&#xA;  'SCRIPT_FILENAME' =&amp;gt; '/Users/garethredfern/Code/tfa/public/index.php',&#xA;  'REMOTE_PORT' =&amp;gt; '49557',&#xA;  'GATEWAY_INTERFACE' =&amp;gt; 'CGI/1.1',&#xA;  'SERVER_PROTOCOL' =&amp;gt; 'HTTP/1.1',&#xA;  'REQUEST_METHOD' =&amp;gt; 'POST',&#xA;  'QUERY_STRING' =&amp;gt; '',&#xA;  'REQUEST_URI' =&amp;gt; '/',&#xA;  'SCRIPT_NAME' =&amp;gt; '/index.php',&#xA;  'PHP_SELF' =&amp;gt; '/index.php',&#xA;  'REQUEST_TIME_FLOAT' =&amp;gt; 1487494935.3640000820159912109375,&#xA;  'REQUEST_TIME' =&amp;gt; 1487494935,&#xA;  'argv' =&amp;gt; &#xA;  array (&#xA;  ),&#xA;  'argc' =&amp;gt; 0,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From what I can see the data is not actually going through to Craft but I am getting a success response.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My Working Code&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Selvin jumped on a hangout with me to help out, the easiest solution was to work with Vue resource as Selvin has answered below but I had another couple of issues. Mainly that I wasn't passing the &lt;code&gt;userId&lt;/code&gt; or the &lt;code&gt;action&lt;/code&gt; which are both hidden fields in my form via ajax. So here is my final JS code which worked with the form above. I have switched to using &lt;a href=&quot;https://github.com/pagekit/vue-resource&quot; rel=&quot;noreferrer&quot;&gt;vue-resource&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;Vue.http.options.emulateJSON = true;&#xA;Vue.http.options.emulateHTTP = true;&#xA;&#xA;var app = new Vue({&#xA;  delimiters: ['@{', '}'],&#xA;  el: '#app',&#xA;  data: {&#xA;    user: {&#xA;      firstName: '',&#xA;      userId: '{{ currentUser.id }}',&#xA;      action: 'users/saveUser'&#xA;    }&#xA;  },&#xA;  methods: {&#xA;    submitForm: function () {&#xA;&#xA;      var data = this.user;&#xA;&#xA;      data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;      this.$http.post('/', data)&#xA;        .then(function(response) {&#xA;          console.log('saved', response);&#xA;        });&#xA;    }&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2017-02-20T21:14:31.130" LastActivityDate="2019-09-03T20:38:35.713" Title="Updating a user on the front end with Vue.js and Axios" Tags="&lt;ajax&gt;&lt;frontend&gt;&lt;user-profile&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19062" PostTypeId="1" CreationDate="2017-02-19T10:22:56.917" Score="2" ViewCount="405" Body="&lt;p&gt;I'm trying to figure out how searching for Commerce Orders in the CP works. I've run some tests searching against the following fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shipping Business Name&lt;/li&gt;&#xA;&lt;li&gt;Billing Business Name&lt;/li&gt;&#xA;&lt;li&gt;Shipping Method&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In all cases, searches seem to match nothing in these columns. For example, if the Shipping Business Name was &quot;Acme&quot; and I enter that in the CP search bar, I get no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behaviour? That seems hard to believe if it is. How would a user filter down the list of Orders for a particular company or shipping method... or whatever?&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2018-03-28T23:54:47.257" Title="Commerce Orders Search Bug in CP?" Tags="&lt;plugin-craftcommerce&gt;&lt;control-panel&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19063" PostTypeId="1" AcceptedAnswerId="19068" CreationDate="2017-02-19T11:03:40.210" Score="1" ViewCount="160" Body="&lt;p&gt;I have a user I am running some Commerce order tests with. I have 6 orders they have placed. If I add a Commerce Customer Info field to their profile, I can see all their past orders on their Profile in the Users area (left side of screen below). However, if I view one of their orders in the Commerce Orders section, the Order History section only ever shows the current order (right side of screen below). Shouldn't it show all their orders like on their profile?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6FHtb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6FHtb.png&quot; alt=&quot;Profile and Order History&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2018-03-28T23:57:35.640" Title="User Order History Not showing Up in CP" Tags="&lt;plugin-craftcommerce&gt;&lt;user-profile&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19064" PostTypeId="2" ParentId="19060" CreationDate="2017-02-19T11:51:41.323" Score="0" Body="&lt;p&gt;Try instead&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = 'craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5552" LastActivityDate="2017-02-19T11:51:41.323" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19065" PostTypeId="2" ParentId="19061" CreationDate="2017-02-19T14:12:47.577" Score="1" Body="&lt;p&gt;Perhaps it could be a issue with twig also uses the mustaches {{}} &lt;br /&gt;&lt;br /&gt;&#xA;Have a look at this blog post by Andrew Welch. &lt;br /&gt;&#xA;(he is setting up different delimiters for Vue) &lt;br /&gt;&#xA;&lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-2-0-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/using-vuejs-2-0-with-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="721" LastActivityDate="2017-02-19T14:12:47.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19066" PostTypeId="2" ParentId="19061" CreationDate="2017-02-19T14:23:50.030" Score="9" Body="&lt;p&gt;Unlike Vue Resourse (if you've used it), Axios does not have a good way to &lt;strong&gt;emulateJSON&lt;/strong&gt; on legacy servers or frameworks that do not understand submissions sent as &lt;strong&gt;application/json&lt;/strong&gt;. Your data gets to Craft but it is not understood, leaving &lt;strong&gt;POST&lt;/strong&gt; empty. You would need to have Axios submit to your own controller, where you can read the raw data, JSON decode it, and update the user profile with that data. Alternatively, you can tell Axios to send the data as &lt;strong&gt;application/x-www-form-urlencoded&lt;/strong&gt; (&lt;a href=&quot;https://www.npmjs.com/package/axios#using-applicationx-www-form-urlencoded-format&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.npmjs.com/package/axios#using-applicationx-www-form-urlencoded-format&lt;/a&gt;) data. However, you'll still need to read the data and decode it yourself because Axios still sends the data as a JSON string rather than form fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CSRF token validation fails for the same reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a quick solution, I'd use vue resource with &lt;code&gt;emulateJSON&lt;/code&gt; and &lt;code&gt;emulateHTTP&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt;. Integrates well with Vue and its API is very similar to Axios. Of course, once you figure out Axios, you can easily swap it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you implement your own controller action to update the user, I believe you should access the data sent by Axios with &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getRawBody()&lt;/code&gt; and then decode it into an array with &lt;code&gt;JsonHelper::decode()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; As of Craft 3.3 you can submit JSON requests to any Craft controllers, as long as they contain a &lt;code&gt;Content-Type: application/json&lt;/code&gt; header.&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="9" LastEditDate="2019-09-03T20:38:35.713" LastActivityDate="2019-09-03T20:38:35.713" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19067" PostTypeId="2" ParentId="19062" CreationDate="2017-02-19T23:17:12.597" Score="1" Body="&lt;p&gt;Right now (Feb 2017), there are indeed a distinct lack of order searching options for orders with Commerce.  I don't know if you'd call it 'intended behaviour' so much as an oversight or at least lower priority at the moment....(my suspicion is that because P &amp;amp; T themselves sell only virtual products, it's not quite as obvious to them how necessary this is for non-virtual goods sellers - but it may be I'm being totally unfair there!).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a frustration for our staff that I have mentioned along the way a few times.  There's a related feature request here:&#xA;&lt;a href=&quot;https://github.com/craftcms/commerce/issues/186&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/186&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2018-03-28T23:54:47.257" LastActivityDate="2018-03-28T23:54:47.257" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19068" PostTypeId="2" ParentId="19063" CreationDate="2017-02-19T23:20:51.060" Score="2" Body="&lt;p&gt;The Order History is the history of &lt;em&gt;that particular order&lt;/em&gt; and not designed to pull in other prior orders from that customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to make a feature request if you want to be able to see customer histories in the order view:&#xA;&lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....if they're a registered Craft user you can use the email at the top to get to their profile (and thus to that field) of course, but that doesn't not help for guest users.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2018-03-28T23:57:35.640" LastActivityDate="2018-03-28T23:57:35.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19069" PostTypeId="1" AcceptedAnswerId="19073" CreationDate="2017-02-19T23:55:14.193" Score="1" ViewCount="243" Body="&lt;p&gt;I'm building a website for a restaurant and I wanted to make the back-end as easy to use as possible. So I thought of a system like this.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Allergens - Contains name and icon&lt;/li&gt;&#xA;&lt;li&gt;Ingredients - Contains allergens&lt;/li&gt;&#xA;&lt;li&gt;Recipes - Contains ingredients and text about the dish&lt;/li&gt;&#xA;&lt;li&gt;Menu - Contains recipes&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So the concept is that they can just add as many recipes as they want. And just drag and drop/select the ingredients. And never ever worry about which allergens is present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thing is, I'm not sure what's the best way of achieving this. Would allergens, ingredients and recipes need to be separate entries in separate channels? Since I want to be able to attach an icon to an allergen, I guess that needs to be a channel?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastActivityDate="2017-02-20T10:10:46.657" Title="Creating a smart restaurant menu" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;categories&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19070" PostTypeId="1" AcceptedAnswerId="19071" CreationDate="2017-02-20T00:47:19.757" Score="2" ViewCount="269" Body="&lt;p&gt;I created html template using radio buttons as tabs as you can see in the picture. When user click on any of the tabs the relevant entries for that month display and the rest hidden. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created matrix field to group the calendar field and other text fields but my question is how to dynamic display all entries for each month? So that I can use CSS to hide other entries and show entries when tab are selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jn1wy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jn1wy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9U22c.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9U22c.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5087" LastActivityDate="2017-02-20T05:37:57.750" Title="Display entries for each month" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19071" PostTypeId="2" ParentId="19070" CreationDate="2017-02-20T01:49:28.690" Score="3" Body="&lt;p&gt;You could do this multiple ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One you could create a category with each month and an input for your entries and assign that month to each category.  Then it would be a matter of calling that categories &lt;code&gt;relatedTo&lt;/code&gt; param using each Month Category ID.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set monthIds = craft.categories.group('months').ids() %}&#xA;&#xA;{% for monthId in monthIds %}&#xA;    &amp;lt;div&amp;gt;&#xA;        {# group each months entries #}&#xA;        {% for item in craft.entries.section('sectionName').relatedTo({targetElement:monthId}) %}&#xA;            {# content for each entry. #}&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two you could use your &lt;code&gt;eventStart&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# 1 == January #}&#xA;{% set months  = [&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;,&quot;Oct&quot;,&quot;Nov&quot;,&quot;Dec&quot;] %}&#xA;{% for month in 1..12 %}&#xA;    &amp;lt;div&amp;gt;&#xA;        {# group each months entries #}&#xA;        {% set idx = month - 1%}&#xA;        &amp;lt;h3&amp;gt;{{ months[idx] }}&amp;lt;/h3&amp;gt;&#xA;        {% for item in craft.entries.section('blog') if item.eventStart|date(&quot;n&quot;) == month %}&#xA;            {# content for each entry. #}&#xA;            &amp;lt;h3&amp;gt;{{item.title}}&amp;lt;/h3&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-02-20T05:37:57.750" LastActivityDate="2017-02-20T05:37:57.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19072" PostTypeId="1" AcceptedAnswerId="19074" CreationDate="2017-02-20T07:53:21.093" Score="1" ViewCount="351" Body="&lt;p&gt;I need a function to logout a craft user and delete the session of that user. This must take place in the &lt;a href=&quot;https://github.com/pixelandtonic/ElementAPI&quot; rel=&quot;nofollow noreferrer&quot;&gt;element API plugin&lt;/a&gt; as an endpoint. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function userLogout(){&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;isLoggedIn()){&#xA;        // if user loggedin&#xA;        // how to logout?&#xA;    }&#xA;}&#xA;&#xA;'api/logout' =&amp;gt; array(&#xA;    'elementType' =&amp;gt; 'User',&#xA;    'criteria' =&amp;gt; ['id' =&amp;gt; craft()-&amp;gt;userSession-&amp;gt;user-&amp;gt;id, 'limit' =&amp;gt; 1 ],&#xA;    'paginate' =&amp;gt; false,&#xA;    'transformer' =&amp;gt; function(\Craft\UserModel $user) {&#xA;        userLogout();&#xA;    }&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="505" LastEditDate="2017-02-20T14:33:51.400" LastActivityDate="2017-02-20T14:33:51.400" Title="How delete a user session with the element api?" Tags="&lt;plugin-elementapi&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19073" PostTypeId="2" ParentId="19069" CreationDate="2017-02-20T10:10:46.657" Score="2" Body="&lt;p&gt;Here's how I'd do it...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a channel called Allergens with a custom field for the icon. If the icon is an image, make it an assets field.    &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a channel called Ingredients with a custom field for the allergens. It will be of the Entries field-type and only allow the user to select Allergens entries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a channel called Recipes with a custom field for the Ingredients and another custom field for the description of the dish. The Ingredients field will be of the Entries field-type and only allow the user to select Ingredients entries. The description field would probably be a simple Rich Text field.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a channel called Menu. If there is only one menu needed, I'd probably make it a Single. If more are needed, make it a standard channel. It'll need a custom field for the Recipes, which would be an Entries field where the user can only select Recipe entries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are other ways of doing it, but this would probably give you the most flexibility in the long run, and keep things simple for the users.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-20T10:10:46.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19074" PostTypeId="2" ParentId="19072" CreationDate="2017-02-20T11:05:31.460" Score="2" Body="&lt;p&gt;You can end a user's session with the &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;logout()&lt;/code&gt;, method, which the &lt;code&gt;UserSessionService&lt;/code&gt; class &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CWebUser#logout-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;inherits from the &lt;code&gt;CWebUser&lt;/code&gt; class&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your &lt;code&gt;userLogout&lt;/code&gt; function would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function userLogout(){&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;isLoggedIn()){&#xA;        craft()-&amp;gt;userSession-&amp;gt;logout(false);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Additional information&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Passing &lt;code&gt;false&lt;/code&gt; to the &lt;code&gt;logout&lt;/code&gt; method tells Yii not to &quot;destroy&quot; the session, and mimics the call in Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionLogout-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;UsersController::logout&lt;/code&gt; method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CHttpSession#destroy-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Yii documentation&lt;/a&gt;, &lt;code&gt;destroy&lt;/code&gt; &quot;frees all session variables and destroys all data registered to a session.&quot; I'm unclear why Craft chooses not to destroy the session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;UsersController::logout&lt;/code&gt; method also includes a few cleanup tasks, but those seem to be duplicates of the tasks performed in the &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionLogout-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;UserSessionService::afterLogout&lt;/code&gt;&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;afterLogout&lt;/code&gt; method is called from the &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;logout()&lt;/code&gt; method, so you shouldn't have to worry about this manual cleanup.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-02-20T11:05:31.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19076" PostTypeId="1" AcceptedAnswerId="19084" CreationDate="2017-02-20T12:28:15.860" Score="1" ViewCount="732" Body="&lt;p&gt;I want to install Craft in home directory in mac. I don't like to use MAMP as local server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is to possible to install without using MAMP? I use gulp and webpack in home directory.&lt;/p&gt;&#xA;" OwnerUserId="6169" LastEditorUserId="57" LastEditDate="2017-02-20T18:09:36.343" LastActivityDate="2017-02-21T22:55:27.897" Title="Installing Craft without MAMP" Tags="&lt;php&gt;&lt;installation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19077" PostTypeId="1" CreationDate="2017-02-20T12:33:13.697" Score="0" ViewCount="403" Body="&lt;p&gt;There is a guide on GitHub page how to add additional fields, but how to add recipient selection?&lt;/p&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="57" LastEditDate="2017-02-20T18:01:16.327" LastActivityDate="2017-02-20T18:01:16.327" Title="How to add recipient drop-down selection field with the Contact Form plugin?" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19078" PostTypeId="1" CreationDate="2017-02-20T13:36:53.050" Score="2" ViewCount="102" Body="&lt;p&gt;What is the best way to define different sendto emails addresses for the ContactForm plugin, depending on the locale the site is currently viewed in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am setting up a multilanguage site, and the clients want to have different emails for each language version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I figure a possible way would be to have separate, localized contactform templates, and in each of them define a dynamically-added recipient. But I wondered if there's a better option, e.g. locale-specific options in craft/config/contactform.php?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="6314" LastEditorUserId="6314" LastEditDate="2017-02-20T13:45:02.013" LastActivityDate="2017-03-09T16:01:01.783" Title="Contact Form plugin - different recipients per locale" Tags="&lt;localization&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19079" PostTypeId="2" ParentId="5498" CreationDate="2017-02-20T14:25:49.907" Score="1" Body="&lt;p&gt;It is very likely that your &quot;File System Path&quot; on the asset source is unsuitable for a local environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set the fileSystemPath in your config like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;    'fileSystemPath' =&amp;gt; '../../public'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can change your asset source settings to something like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aREKd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aREKd.png&quot; alt=&quot;craftcms asset source settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2017-02-20T14:25:49.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19080" PostTypeId="1" CreationDate="2017-02-20T14:33:48.493" Score="1" ViewCount="275" Body="&lt;p&gt;I have a custom field enabled on a product - it is a user field that associates a product with a user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would the correct setup be to only display products that pertain to the currentUser - as this would match the custom user field?&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2017-02-20T15:09:03.453" Title="Show products based on custom field" Tags="&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19081" PostTypeId="2" ParentId="19080" CreationDate="2017-02-20T15:09:03.453" Score="1" Body="&lt;p&gt;Depends on whether the user field is on the product or a variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the custom field is on the product:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo({&#xA;    sourceElement: currentUser,&#xA;    field: 'userFieldName'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the custom field is on the variant:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variantCriteria = craft.commerce.variants.relatedTo({&#xA;    sourceElement: currentUser,&#xA;    field: 'userFieldName'&#xA;}) %}&#xA;&#xA;{% set products = craft.commerce.products.hasVariant(variantCriteria) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-20T15:09:03.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19082" PostTypeId="2" ParentId="19077" CreationDate="2017-02-20T15:24:24.260" Score="1" Body="&lt;p&gt;There's no way to do this by default as far as I know so you'd need to create a small plugin to &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamically add the recipient email&lt;/a&gt; to the form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be able to shortcut that a little by changing that hidden input value using JavaScript alone depending on what was selected in the dropdown but the &lt;code&gt;toEmail&lt;/code&gt; param is &lt;em&gt;meant&lt;/em&gt; to be hashed. &lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2017-02-20T15:24:24.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19083" PostTypeId="1" AcceptedAnswerId="19088" CreationDate="2017-02-20T15:38:32.783" Score="2" ViewCount="1016" Body="&lt;p&gt;I am having entries in a Craft channel-section. Each entry has the field &quot;type&quot; with one category filled. I need to iterate through the entries and count the amount of each category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry 1, Category: One&#xA;Entry 2, Category: One&#xA;Entry 3, Category: Two&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Produces something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;One: 2, Two: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I know which category is used how often. In any language I would use a key/value set and just increment the amount each time I find the specific category, but that seems to be impossible with Twig in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I achieve that?&lt;/p&gt;&#xA;" OwnerUserId="5325" LastActivityDate="2017-02-20T17:04:02.170" Title="Iterate through all entries and count a specific value" Tags="&lt;templating&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19084" PostTypeId="2" ParentId="19076" CreationDate="2017-02-20T15:40:09.683" Score="4" Body="&lt;p&gt;It depends what you are most comfortable with. PHP and Apache are shipped with macOS by standard but you'd still need to install and configure MySQL (or MariaDB etc), along with manual virtual host configuration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MAMP makes it much easier but sandboxing it all in one easy to install package with a GUI so if you're not comfortable with the command line and the manual configuration then it's a good option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are a little comfortable with the command line and want a minimalist setup then &lt;a href=&quot;https://laravel.com/docs/5.4/valet&quot; rel=&quot;noreferrer&quot;&gt;Laravel Valet&lt;/a&gt; could be worth a try. It is a wrapper which orchestrates installing the required components via &lt;a href=&quot;https://brew.sh/&quot; rel=&quot;noreferrer&quot;&gt;Homebrew&lt;/a&gt; which enables you to just create a new folder in your web root folder with a &lt;code&gt;.dev&lt;/code&gt; extension and then be able to view it in the browser. This can be a nice in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more of an isolation you can opt for virtual machines and Vagrant images for example which run a virtual OS with all pre-requisites installed. It can be a little resource hungry however. Alternatively there is docker which provides a containerised environment (much the same but without the full OS layer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It really goes down to what you're more comfortable with but any of the above will get you up and running with Craft.&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2017-02-20T15:40:09.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19085" PostTypeId="2" ParentId="19077" CreationDate="2017-02-20T16:05:16.143" Score="1" Body="&lt;p&gt;First create a new config file in your craft &gt; config folder and name it &lt;code&gt;contactform.php&lt;/code&gt;. This is a config for the Contact Form plugin.  Next add this bit of code to it. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;$toEmail = craft()-&amp;gt;request-&amp;gt;getPost('toEmail');&#xA;$toEmail = craft()-&amp;gt;security-&amp;gt;validateData($toEmail);&#xA;&#xA;return array(&#xA;    'toEmail' =&amp;gt; ($toEmail ?: null),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your html create a SELECT input and give it the name &lt;code&gt;name=toEmail&lt;/code&gt;. You could create a dynamic list with a table input.  Make sure to use the &lt;code&gt;hash&lt;/code&gt; filter when outputting your email address into value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;toEmail&quot;&amp;gt;&#xA;    {# emailList is handle of custom table input. #}&#xA;   {% for item in entry.emailList %}&#xA;        {# email &amp;amp; subject are custom table input column handles #}&#xA;       &amp;lt;option value=&quot;{{ item.email|hash }}&quot;&amp;gt;{{ item.subject }}&amp;lt;/option&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-02-20T16:05:16.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19086" PostTypeId="1" CreationDate="2017-02-20T16:31:54.427" Score="0" ViewCount="45" Body="&lt;p&gt;I have a simple caching setup on this site. I have a layout template that extends it has this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    {% cache %}&#xA;      &amp;lt;p&amp;gt;my content&amp;lt;/p&amp;gt;&#xA;    {% endcache %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And i have &lt;code&gt;'enableTemplateCaching' =&amp;gt; true&lt;/code&gt; set to on for the production site in my config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since upgrading Craft from quite a old version to the latest as of a few weeks ago, the cache seems to have gone a bit haywire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i clear the cache and then load the pages, all seems well, but then if i edit a template for example, elements on some pages don't output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example is a map block, if i edit the latitude for the js in that block and then save that template, it doesn't output the js from that block which btw uses &lt;code&gt;{% includeJs myJs %}&lt;/code&gt;. Other template elements seem to be missing also in other places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all worked before, but doesn't now, no idea why!&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2017-02-20T16:31:54.427" Title="Cache not outputting chunks of content" Tags="&lt;cache&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19088" PostTypeId="2" ParentId="19083" CreationDate="2017-02-20T17:04:02.170" Score="3" Body="&lt;p&gt;Before we proceed, let me say that whilst the following will work, I personally think this is a poor use of Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's far better to collate this information in a simple plugin, rather than jumping through such hoops in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveats dispensed with, here you go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = {&#xA;    section: 'exampleSection',&#xA;    limit: 20,&#xA;    with: ['categoryFieldHandle']&#xA;} %}&#xA;&#xA;{% set categories = {} %}&#xA;{% set entries = craft.entries(criteria).find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% set entryCategories = entry.categoryFieldHandle %}&#xA;    {% if entryCategories|length %}&#xA;        {% for entryCategory in entryCategories %}&#xA;            {% set categorySlug = entryCategory.slug %}&#xA;&#xA;            {% if categories[categorySlug] is not defined %}&#xA;                {% set categories = categories|merge({&#xA;                    (categorySlug): {&#xA;                        count: 0,&#xA;                        category: entryCategory&#xA;                    }&#xA;                }) %}&#xA;            {% endif %}&#xA;&#xA;            {% set categoryCount = attribute(categories, categorySlug)['count'] + 1 %}&#xA;&#xA;            {% set categories = categories|merge({&#xA;                (categorySlug): {&#xA;                    count: categoryCount,&#xA;                    category: entryCategory&#xA;                }&#xA;            }) %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if categories|length %}&#xA;    &amp;lt;h2&amp;gt;Category Counts&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for categoryKey, categoryInfo in categories %}&#xA;            &amp;lt;li&amp;gt;{{ categoryInfo.category.title }}: {{ categoryInfo.count }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that we're &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; the categories. Otherwise, we'll end up with N+1 queries.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-02-20T17:04:02.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19089" PostTypeId="2" ParentId="19078" CreationDate="2017-02-20T17:22:43.040" Score="1" Body="&lt;p&gt;You could write a plugin, which hooks in the contact form's &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L86-L89&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeSend&lt;/code&gt; event&lt;/a&gt;, and modifies the recipients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an absolute bare-bones solution which does exactly that (not tested in any way whatsoever):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class ExamplePlugin extends BasePlugin&#xA;{&#xA;    // Standard plugin methods omitted for brevity...&#xA;&#xA;    public function init()&#xA;    {&#xA;        craft()-&amp;gt;on('contactform.beforeSend', function (Event &amp;amp;$event) {&#xA;            $event-&amp;gt;toEmail = 'john@doe.com';&#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whether or not this is &quot;officially&quot; supported is unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact it's an event (as opposed to a hook) might suggest not, &lt;em&gt;but&lt;/em&gt; the contact form does check whether any listeners modified the event data, as evidenced by its &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L30&quot; rel=&quot;nofollow noreferrer&quot;&gt;check of the &lt;code&gt;isValid&lt;/code&gt; property&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-02-20T17:22:43.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19090" PostTypeId="1" AcceptedAnswerId="19095" CreationDate="2017-02-20T17:55:55.353" Score="1" ViewCount="438" Body="&lt;p&gt;I'm running into issues handing off a cart transaction to Paypal Express. I've set the &lt;code&gt;paymentMethodId&lt;/code&gt; correctly on the cart, but when I submit to &lt;code&gt;commerce/payments/pay&lt;/code&gt; I am only getting redirected to my cart page and nothing is showing in the Commerce debug logs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from having cart items and a paymentMethodId, is there anything else required for the Paypal handoff? How can I further debug this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;paypal_checkout_form&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;/&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/thank-you?oid={{ cart.number }}&quot;/&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/shop/cancel&quot;/&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;orderNumber&quot; value=&quot;{{ cart.number }}&quot;/&amp;gt;&#xA;&#xA;  {{ getCsrfInput() }}&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5126" LastActivityDate="2017-02-20T22:59:12.287" Title="Handoff to Paypal Express with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;&lt;omnipay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19091" PostTypeId="2" ParentId="19041" CreationDate="2017-02-20T18:10:46.330" Score="2" Body="&lt;p&gt;The syntax for comparing a date should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;andWhere('dateCreated &amp;gt; &quot;2017-02-11&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-20T18:10:46.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19092" PostTypeId="1" AcceptedAnswerId="19096" CreationDate="2017-02-20T19:44:29.150" Score="1" ViewCount="145" Body="&lt;p&gt;Using the &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiAdd&lt;/a&gt; plugin, I'm trying to add a related product using a simple checkbox. It's an add on to the existing product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of what it looks like on the page…&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MM4s8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MM4s8.png&quot; alt=&quot;variant of product + related product&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the related product to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;be added when the checkbox is ticked and vice versa when not ticked&lt;/li&gt;&#xA;&lt;li&gt;have the same quantity as the parent product&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's is the relevant code inside my variant loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;addToCart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;multiAdd/multiAdd&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/cart&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&#xA;{# Code For Related Product #}&#xA;{% if relatedProduct | length %}&#xA;    &amp;lt;div class=&quot;related-product&quot;&amp;gt;&#xA;        {% for product in relatedProduct %}&#xA;            {% set variant = product.defaultVariant %}&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; name=&quot;items[addon][purchasableId]&quot; value=&quot;{{ variant.id }}&quot; checked=&quot;checked&quot;&amp;gt;&#xA;                {{ variant.title }}&#xA;                &amp;lt;span class=&quot;price-color&quot;&amp;gt;+{{ variant.salePrice | commerceCurrency(cart.currency) }}&amp;lt;/span&amp;gt;&#xA;                {% if variant.onSale %} &amp;lt;strike&amp;gt;{{ variant.price | commerceCurrency(cart.currency) }}&amp;lt;/strike&amp;gt;{% endif %}&#xA;            &amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;items[addon][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Code For Product #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[product][purchasableId]&quot; value=&quot;{{ purchasable.id }}&quot;&amp;gt;&#xA;&amp;lt;select id=&quot;quantity-standard&quot; name=&quot;items[product][qty]&quot; class=&quot;quantity&quot;&amp;gt;&#xA;    {% for i in 1..50 %}&#xA;        &amp;lt;option value=&quot;{{ i }}&quot;{% if loop.first %} selected{% endif %}&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; class=&quot;buy-now&quot; value=&quot;{{ &quot;Add to cart&quot;|t }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The challenges I'm facing are…&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I don't know how to set the related product's quantity to zero when the checkbox isn't checked&lt;/li&gt;&#xA;&lt;li&gt;I don't know how to set the related product's quantity to match the parent product when the related product is checked&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6317" LastEditorUserId="57" LastEditDate="2017-02-20T19:56:10.423" LastActivityDate="2017-02-21T17:56:30.570" Title="MultiAdd - Add a related product by checkbox" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19094" PostTypeId="1" AcceptedAnswerId="19099" CreationDate="2017-02-20T22:25:36.880" Score="0" ViewCount="345" Body="&lt;p&gt;I have a landing page on my site where I want to list a group of sections that have entries. I also need to access the section handle of that same group of sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having problems getting the section handle for the sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I get an error back that says impossible to access attribute (&quot;handle&quot;) on a string variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set specialEntries = craft.entries.section(['sec1','sec2','sec3']) %}&#xA;&#xA;        {% set grouped = specialEntries|group('section') %}&#xA;        {% for section, specialEntries in grouped %}&#xA;            &amp;lt;h1&amp;gt;{{ section }} - {{ section.handle }}&amp;lt;/h1&amp;gt;&#xA;        {% endfor %}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2017-02-21T00:07:21.950" Title="Get Section Handle From Group" Tags="&lt;entries&gt;&lt;sections&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19095" PostTypeId="2" ParentId="19090" CreationDate="2017-02-20T22:59:12.287" Score="2" Body="&lt;p&gt;There is most likely some error in your configuration, or what you're sending to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code (when in devMode) will show you any errors that are coming back from Commerce/Paypal when you're redirected back to the cart:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {# SHOW ANY ERRORS IF THERE ARE ANY! #}&#xA;&#xA;{% if craft.config.devMode and (craft.session.hasFlash('commerce') or craft.session.hasFlash('notice') or craft.session.hasFlash('error')) %}&#xA;&#xA;    {% set isErrors = true %}&#xA;    {% set commerceFlash = craft.session.getFlash('commerce')|join('|') %}&#xA;    {% set noticeFlash = craft.session.getFlash('notice')|join('|') %}&#xA;    {% set errorFlash = craft.session.getFlash('error')|join('|') %}&#xA;&#xA;    Commerce: [{{  commerceFlash }}]&#xA;    Notice: [{{  noticeFlash }}]&#xA;    Error: [{{  errorFlash }}]&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-20T22:59:12.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19096" PostTypeId="2" ParentId="19092" CreationDate="2017-02-20T23:09:01.960" Score="1" Body="&lt;p&gt;From the multiAdd perspective, it only cares that each item you're adding to the cart has some qty - if &lt;code&gt;0&lt;/code&gt; it will ignore it, if anything positive, it will add that many to the cart, i.e. you only need to see things up such that for each product the minimum info required (for each product that's part of this multiadd process) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;items[someKey][qty]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;items[someKey][purchasableId]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....where of course &lt;code&gt;someKey&lt;/code&gt; is the same value for both those inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of how you achieve what you want, that's more of an html form/JS question.  The most obvious approach would be to use some simple JS to listen on the submit event.  If at &lt;code&gt;submit&lt;/code&gt; the checkbox is unchecked, you just poke a 0 into the &lt;code&gt;val&lt;/code&gt; for that input.  If it is checked, you take the main product's &lt;code&gt;qty&lt;/code&gt; valuie and poke that into the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To debug this, make sure you check your POST values after the JS is run to check you're submitting what you think you are...in the end what needs to be submitted is super simple as per the above - the only tricky part is the JS to hook it up really.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-20T23:09:01.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19097" PostTypeId="1" CreationDate="2017-02-20T23:32:02.123" Score="0" ViewCount="892" Body="&lt;p&gt;What is the best method to render Javascript on specific page using name instead of id. This is what I found but not sure how to use name instead. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id == 2 %}&#xA;{% endif %}&#xA;&#xA;{% if entry.section == homepage %}&#xA;    //Content goes here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2017-02-21T00:50:53.343" LastActivityDate="2017-02-21T00:50:53.343" Title="Display JavaScript only on the homepage" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19098" PostTypeId="2" ParentId="19097" CreationDate="2017-02-20T23:53:22.817" Score="2" Body="&lt;p&gt;You'd typically use the &lt;a href=&quot;https://craftcms.com/docs/templating/includejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% includeJs %}&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% includeJsFile %}&lt;/code&gt;&lt;/a&gt; tags within your page template, to specify your page-specific JavaScript, and then output everything in your layout template by calling &lt;a href=&quot;https://craftcms.com/docs/templating/functions#getFootHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{{ getFootHtml() }}&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how your (very basic) page template might look in practice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# mypage.twig #}&#xA;{% extends '_layout' %}&#xA;{% includeJsFile &quot;/assets/js/mypage.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's how your (equally basic) layout template might look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# _layout.twig #}&#xA;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;&#xA;{# This outputs the JavaScript from mypage.twig #}&#xA;{{ getFootHtml() }}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-02-21T00:08:56.387" LastActivityDate="2017-02-21T00:08:56.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19099" PostTypeId="2" ParentId="19094" CreationDate="2017-02-21T00:07:21.950" Score="1" Body="&lt;p&gt;In your example, you're attempting to use a &lt;code&gt;SectionModel&lt;/code&gt; instance as the key for your grouped entries. This is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What actually happens behind the scenes is the &lt;code&gt;group&lt;/code&gt; filter generates an object where the keys are the string value of the &lt;code&gt;SectionModel&lt;/code&gt; instance [1], and the values are the &lt;code&gt;EntryModels&lt;/code&gt; associated with that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few ways of achieving your desired outcome. Here's one possibility (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getAllSections() %}&#xA;{% set entries = craft.entries.section(['first', 'second', 'third']) %}&#xA;{% set grouped = entries|group('section') %}&#xA;&#xA;{% for sectionHandle, sectionEntries in grouped %}&#xA;    {% set groupSection = false %}&#xA;    {% for section in sections %}&#xA;        {% if section.name == sectionHandle %}&#xA;            {% set groupSection = section %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if groupSection %}&#xA;        &amp;lt;h1&amp;gt;{{ groupSection.name }} - {{ groupSection.handle }}&amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1]: The &lt;a href=&quot;https://craftcms.com/classreference/models/SectionModel#__toString-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;SectionModel::__toString&lt;/code&gt; method&lt;/a&gt; returns the &lt;code&gt;name&lt;/code&gt; attribute.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-02-21T00:07:21.950" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19100" PostTypeId="1" CreationDate="2017-02-21T00:08:26.323" Score="1" ViewCount="186" Body="&lt;p&gt;I am using the guestentries plugin to create two different section entries. I have two similar html forms on the same front end page. They both use the jquery validate plugin before submiting via ajax. The first form for sectionId(3) does some stripe token generation before submitting to the plugin to submit the payment and create the entry. This is working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second form doesn't do any stripe calls and is using very much the same jquery ajax call to submit to a sectionId(4). This ajax submission is always returning a 404 and doesn't get to the guestEntries plugin so it seems craft isn't handling this submission like it should?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Succesful request/response&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Code]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    var formData = $(&quot;form[name='playerForm']&quot;).serialize();&#xA;    $.post('/', formData , function(response) {&#xA;      if (response.success) {&#xA;      //On Submit Success&#xA;      $(&quot;form[name='playerForm'] input[type='text'],select&quot;).val(&quot;&quot;);&#xA;&#xA;      $('#playerForm').slideUp();&#xA;&#xA;      $('#registered_user_name').text(response.title);&#xA;      $('#myModal').modal('show');&#xA;      $('#submitLoader').replaceWith('&amp;lt;input type=&quot;submit&quot; class=&quot;submit&quot; id=&quot;playerSubmit&quot; value=&quot;Continue&quot; /&amp;gt;');&#xA;&#xA;    }else{&#xA;      console.log(response);&#xA;    }&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[Form Data]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CRAFT_CSRF_TOKEN:kv8AfC8Odbhq7OFX6eUhJEi~lm2LqTgmubFer48b|4af89cb67bc43b2efb63a00273e638708f85f5ab&#xA;action:guestEntries/saveEntry&#xA;sectionId:3&#xA;fields[firstName]:Test&#xA;fields[lastName]:Guy&#xA;fields[homeTown]:Town&#xA;fields[phoneNumber]:234 342 2343&#xA;fields[companyEducationalInstitution]:Test Company&#xA;fields[averageScore]:81-90&#xA;fields[yearsInTheTournament]:1&#xA;token:tok_19pQkWKdnBUCmelLfVYMRhaF&#xA;fields[email]:test@test.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Failed request/response&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Code]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = $(&quot;form[name='sponsorForm']&quot;).serialize();&#xA;&#xA;$.post('/', data, function (response) {&#xA;  if (response &amp;amp;&amp;amp; response.success) {&#xA;    console.log(response);&#xA;  } else {&#xA;    console.log(response);&#xA;  }&#xA;  $('#submitLoader').replaceWith('&amp;lt;input type=&quot;submit&quot; class=&quot;submit&quot; id=&quot;sponsorSubmit&quot; value=&quot;Submit&quot; /&amp;gt;');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[Form Data]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CRAFT_CSRF_TOKEN:kv8AfC8Odbhq7OFX6eUhJEi~lm2LqTgmubFer48b|4af89cb67bc43b2efb63a00273e638708f85f5ab&#xA;action:guestEntries/saveEntry&#xA;sectionId:4&#xA;fields[sponsorFirstName]:Test&#xA;fields[sponsorLastName]:Guy&#xA;fields[sponsorPhoneNumber]:252 356 5626&#xA;fields[company]:Test Company&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've compared the request headers and they are identical so I don't think it's an ajax header problem. Not sure why first form would work and second would fail. Any help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6319" LastActivityDate="2017-02-22T22:20:18.657" Title="Guest Entries - Two ajax forms for different section entries. Receiving 404 only on second form?" Tags="&lt;ajax&gt;&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19101" PostTypeId="2" ParentId="19097" CreationDate="2017-02-21T00:31:34.763" Score="2" Body="&lt;p&gt;If you want something to only appear on the homepage you could use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.lastSegment == &quot;&quot; %}&#xA;  {# do something #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6320" LastActivityDate="2017-02-21T00:31:34.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19102" PostTypeId="2" ParentId="19097" CreationDate="2017-02-21T00:38:21.737" Score="2" Body="&lt;p&gt;So the most reliable way to check to see if you're on the Craft-designated homepage (which can be either a Single, or a Structure, or what have you) would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.slug == '__home__' %}&#xA;    //Content goes here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As per: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1467/add-home-page-to-a-structure&quot;&gt;Add home page to a structure?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than using &lt;code&gt;{% includeJs %}&lt;/code&gt; or &lt;code&gt;{% includeJsFile %}&lt;/code&gt; I would recommend that you use some kind of a JavaScript loader with dependency management:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/using-systemjs-as-javascript-loader&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using SystemJS as a JavaScript Loader&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/loadjs-as-a-lightweight-javascript-loader&quot; rel=&quot;nofollow noreferrer&quot;&gt;LoadJS as a Lightweight JavaScript Loader&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-02-21T00:38:21.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19103" PostTypeId="1" AcceptedAnswerId="19321" CreationDate="2017-02-21T02:59:54.180" Score="0" ViewCount="477" Body="&lt;p&gt;Thank you to anyone that can provide real assistance to my problem with Craft and installing it on a local server. Your help and assistance are truly appreciated!! :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need 100% confirmation that Craft can be installed on a server that is NOT a hosted server!! Everything I read for assistance with my problem all talk about their instance of Craft that is on a hosted server....not a single person (so far) has installed and configured Craft on their local server, only on a hosted server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SO.....does Craft need be installed on a hosted server or can it actually be installed on a local server inside my network?&#xA;If Craft can be installed locally, someone who has installed Craft on a local server, please tell me why I get the following when trying to access 192.168.10.101/admin (example IP address, though here locally I am using my IP address before making the DNS change over to point to my domain):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Not Found&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The requested URL /admin was not found on this server.&#xA;  Apache/2.4.18 (Ubuntu) Server at 192.168.10.11 Port 80&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, I have updated the virtual host within the sites-available folder in apache, error still the same.&#xA;Now before anyone says anything about if I have done the following, Yes, I have, error is still present:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Did you rename htaccess to .htaccess? &amp;lt;-- Yes&#xA;----------------------------------------------&#xA;http://192.168.10.11/index.php?p=admin  &amp;lt;--Nothing happens;same error&#xA;http://192.168.10.11/index.php/admin    &amp;lt;--Nothing happens;same error&#xA;----------------------------------------------&#xA;'craft' folder is sitting in at 'var/www' and index.php at /var/www/html&#xA;&#xA;Question: Do I need to create new folder(s) called 'public_html'? &#xA;If so, only under /html?&#xA;&#xA;OR does /var/www/html/AllCraftPublicFilesLivesUnderHTML work for apache?&#xA;-----------------------------------------------&#xA;$craftPath = './craft'; AS WELL AS $craftPath = '../craft'; &amp;lt;-- No Change&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is now my third build for this program and I am getting sick of hearing &quot;It should just work&quot; as it clearly does not 'just work'. I am more than happy to show you anything you may want to view, though this is my thrid build, so I might not have it right away, but will!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updated 03/02/2017:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Followed the answer suggested below and started completely fresh. This time I decided to follow the suggestion of Craft, and went with a LEMP configuration -- see below for all environment details, everything should be included for your review, so a smarter Admin should be able to see what I am doing wrong or forgot; let me know if I did miss something and I will get it up here. This is a brand new VM and only myself has access to this VM...never been introduced to my network yet.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;OracleBox Virtualization software&lt;br&gt;&#xA;  Ubuntu 16.10 server iso&lt;br&gt;&#xA;     'PlymouthWeb' is the name of the VM&lt;br&gt;&#xA;     Standard install&lt;br&gt;&#xA;          openssh server installed&lt;br&gt;&#xA;          manage package selection&lt;br&gt;&#xA;      ssh root login enabled&lt;br&gt;&#xA;      Ran apt-get update&lt;br&gt;&#xA;      Ran apt-get upgrade - 16.10 ‘yakkety’&lt;br&gt;&#xA;      Ran apt-get dist-upgrade&lt;br&gt;&#xA;      Ran apt-get auto remove &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nginx install (mediatemple.net/community/products/developer/204405534/install-nginx-on-ubuntu; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MariaDB install (websiteforstudents.com/students-tutorial-install-mariadb-ubuntu-16-10/; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP (tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;db.php&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    ' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'plymouth1',&#xA;        'database' =&amp;gt; 'plymouth',&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    ),&#xA;    '192.168.10.19' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; 'root',&#xA;        'database' =&amp;gt; 'plymouth',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    ' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/var/www/www.plymouthinc.com/public',&#xA;            'baseUrl'  =&amp;gt; 'http://plymouthinc.com/',&#xA;        )&#xA;    ),&#xA;    '.local' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; 'true',&#xA;        'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/var/www/www.plymouthinc.com/public',&#xA;            'baseUrl'  =&amp;gt; 'http://plymouth.local/',&#xA;        )&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Virtual Host - /etc/nginx/sites-available/www.plymouthinc.com   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;&#xA;listen   80;&#xA;server_name  www.plymouthinc.com;&#xA;rewrite ^/(. http://plymouthinc.com/$1 permanent;&#xA;}&#xA;&#xA;server {&#xA;&#xA;listen   80;&#xA;server_name www.plymouthinc.com;&#xA;&#xA;access_log /var/www/www.plymouthinc.com/logs/access.log;&#xA;error_log /var/www/www.plymouthinc.com/logs/error.log;&#xA;&#xA;location / {&#xA;&#xA;root   /var/www/www.plymouthinc.com/public/;&#xA;index  index.html;&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;index.php - &#xA;    /var/www/www.plymouthinc.com/public&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;if (function_exists('http_response_code'))&#xA;{&#xA;    http_response_code(503);&#xA;}&#xA;&#xA;exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I go to 192.168.10.19/admin, I get a &lt;em&gt;404 Not Found&lt;/em&gt;; please review my notes here and let me know what I missed to get this to work for me locally. At this point in time, I need very specific examples in any answers provided please (like the answer below, he provided excellent details in his reply). I ask for specifics as all documentation I have read in the wilds of the internet, everyone provides &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, I am using the VM's ip address on my mac when attempting to access my Craft site in a browser; all the server name locations where the IP address (nothing worked), changed to the soon to be domain name, and still nothing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been working on this project for three weeks and have been stuck trying to get the Craft Installer to run so I can finish building this website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you truly have been successful in the past with Craft, please help me out..to include sending emails/screenshots back and forth, to possibly even jump on a screen share if you can confirm you have been successful with installing and configuring craft...I really don't need another person to respond with &quot;It should just work, especially if you follow the install guide&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;br&gt;&#xA;Frustrated System Administrator&lt;/p&gt;&#xA;" OwnerUserId="6286" LastEditorUserId="6286" LastEditDate="2017-03-03T01:32:08.553" LastActivityDate="2017-03-08T01:10:52.520" Title="Can I use an IP address instead of a FQDN?" Tags="&lt;installation&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19104" PostTypeId="2" ParentId="19103" CreationDate="2017-02-21T04:34:32.490" Score="4" Body="&lt;p&gt;First, I can positively confirm I have Craft running on two not hosted, local servers - one a Ubuntu 14.04 (well, Mint) installation, and one a Windows box using Uniserver.  Not sure quite what you're reading - and I think you might be misinterpreting what you're reading - but just about every dev around here will have a local install they work on, one way another - e.g. using MAMP, or something like Laravel Valet, Homestead, Vagrant etc.  (I'd be willing to bet MAMP is the most popular way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases I followed: &lt;a href=&quot;https://craftcms.com/docs/installing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/installing&lt;/a&gt; - if you follow that &lt;em&gt;precisely&lt;/em&gt;, it will help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apache is a relatively finicky little beast to configure, particularly with respect to Virtual Hosts...but as to why you're getting that particular Not Found error, that's hard to say without seeing your installation layout, and your virtual host definition at the minimum.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start by looking in your apache logs (immediately after a restart and one attempt to access the adming at &lt;code&gt;/admin&lt;/code&gt;) to make sure your virtual host definition is correct at least, and not raising errors.  Check both the &lt;code&gt;access.log&lt;/code&gt; and &lt;code&gt;error.log&lt;/code&gt; for clues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some basic stuff:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sites live at &lt;code&gt;/var/www/vhosts/sitename/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;under this folder I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft&lt;/code&gt; - where the Craft install lives (so under this you have &lt;code&gt;app&lt;/code&gt;,&lt;code&gt;config&lt;/code&gt; etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public_html&lt;/code&gt; - under this is where index.php lives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very basic vhost setup might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;&#xA;    ServerName dev.whatever.net.au&#xA;    ServerAlias whatever&#xA;    ServerAdmin user@whatever.com.au&#xA;&#xA;    DocumentRoot /var/www/vhosts/whatever/public_html&#xA;&#xA;    ErrorLog ${APACHE_LOG_DIR}/whatever.error.log&#xA;    CustomLog ${APACHE_LOG_DIR}/whatever.access.log combined&#xA;&#xA;    &amp;lt;Directory &quot;/var/www/vhosts/whatever&quot;&amp;gt;&#xA;&#xA;        Options Indexes Includes FollowSymLinks&#xA;&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-21T04:34:32.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19105" PostTypeId="1" CreationDate="2017-02-21T06:09:54.310" Score="1" ViewCount="45" Body="&lt;p&gt;So I am using the matrix field to enable uploading of images onto a slideshow for the homepage section. My goal is to have one of the images link to another URL when you click on it. Basic stuff when using plain HTML, but I have it setup like this in Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.information %}&#xA;{% if block.type == &quot;images&quot; %}&#xA;   {% set image = block.image.first() %}&#xA;       {% if image %}&#xA;            &amp;lt;a href={{ block.anchor | cacheBuster }} target=&quot;_blank&quot;&amp;gt;&#xA;                &amp;lt;img class=&quot;slideshow&quot; src={{ image.url | cacheBuster }} alt={{ image.title }}&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code runs fine and my slideshow images are all displayed using just one loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, all my slides are having an anchor field activated. I only want one of the slides to have a link to a URL, however, in the future I may want to add links to other slides so I need something that is also dynamic enough to support this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My whole entire approach may be wrong and I might need to use a completely different approach... assistance is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6321" LastEditorUserId="57" LastEditDate="2017-02-21T17:57:29.787" LastActivityDate="2017-02-21T17:57:29.787" Title="How to assign a URL to only one slide in a template using Matrix?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19106" PostTypeId="2" ParentId="19105" CreationDate="2017-02-21T06:57:57.060" Score="3" Body="&lt;p&gt;Try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.information %}&#xA;{% if block.type == &quot;images&quot; %}&#xA;    {% set image = block.image.first() %}&#xA;        {% if image %}&#xA;            {% if block.anchor |length %}&#xA;            &amp;lt;a href={{ block.anchor | cacheBuster }} target=&quot;_blank&quot;&amp;gt;&#xA;                &amp;lt;img class=&quot;slideshow&quot; src={{ image.url | cacheBuster }} alt={{ image.title }}&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            {% else %}&#xA;            &amp;lt;img class=&quot;slideshow&quot; src={{ image.url | cacheBuster }} alt={{ image.title }}&amp;gt;&#xA;            {% endif %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that only if the &lt;code&gt;block.anchor&lt;/code&gt; field has something in it do you generate the link &amp;amp; the image. Otherwise, you just generate the image.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-21T06:57:57.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19107" PostTypeId="1" AcceptedAnswerId="19127" CreationDate="2017-02-21T10:45:33.280" Score="2" ViewCount="95" Body="&lt;p&gt;We are using Craft on Heroku and wants to use S3. The problem is that we want to use a Heroku element (buckateer) as a middleman. Buckateer only gives you an IAM user without listbuckets permissions. So you get &quot;S3::listBuckets(): [AccessDenied] Access Denied&quot;. Is there a smart and easy way to set the bucket manually without going into the core files?&lt;/p&gt;&#xA;" OwnerUserId="5613" LastEditorUserId="57" LastEditDate="2017-02-21T17:58:56.960" LastActivityDate="2017-02-22T17:29:19.807" Title="Craft on Heroku with buckateer as a middleman for Amazon S3" Tags="&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19108" PostTypeId="1" AcceptedAnswerId="19151" CreationDate="2017-02-21T14:08:32.487" Score="1" ViewCount="93" Body="&lt;p&gt;How can a user create an entry that is only enabled for 1 locale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like a German user to only be able to publish an entry in the &lt;code&gt;de&lt;/code&gt; locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the permissions for the user to only publish in the &lt;code&gt;de&lt;/code&gt; locale, but, when this user saves a new entry, the locale is then enabled for every locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried disabling each locale in the channel settings, but, then the user is required to enable it for their own locale when publishing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14660/only-publish-user-generated-entries-in-current-locale&quot;&gt;Similar question here&lt;/a&gt;, but no answer yet.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-02-24T00:28:01.970" Title="How can a user create an entry that is only enabled for 1 locale?" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19109" PostTypeId="2" ParentId="19092" CreationDate="2017-02-21T15:19:50.850" Score="1" Body="&lt;p&gt;I can solve one of the issues by assigning the quantity to the checkbox instead of the purchasableId (checked = 1, unchecked = 0). The purchasableId can be assigned to hidden input. That fixes one bug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;addToCart&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;multiAdd/multiAdd&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/cart&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&#xA;{# Code For Related Product #}&#xA;{% if relatedProduct | length %}&#xA;    &amp;lt;div class=&quot;related-product&quot;&amp;gt;&#xA;        {% for product in relatedProduct %}&#xA;            {% set variant = product.defaultVariant %}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;items[addon][purchasableId]&quot; value=&quot;{{ variant.id }}&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; name=&quot;items[addon][qty]&quot; value=&quot;1&quot; checked=&quot;checked&quot; class=&quot;addon-checkbox&quot;&amp;gt;&#xA;                {{ variant.title }}&#xA;                &amp;lt;span class=&quot;price-color&quot;&amp;gt;+{{ variant.salePrice | commerceCurrency(cart.currency) }}&amp;lt;/span&amp;gt;&#xA;                {% if variant.onSale %} &amp;lt;strike&amp;gt;{{ variant.price | commerceCurrency(cart.currency) }}&amp;lt;/strike&amp;gt;{% endif %}&#xA;            &amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;items[addon][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Code For Product #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[product][purchasableId]&quot; value=&quot;{{ purchasable.id }}&quot;&amp;gt;&#xA;&amp;lt;select id=&quot;quantity-standard&quot; name=&quot;items[product][qty]&quot; class=&quot;quantity&quot;&amp;gt;&#xA;    {% for i in 1..50 %}&#xA;        &amp;lt;option value=&quot;{{ i }}&quot;{% if loop.first %} selected{% endif %}&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; class=&quot;buy-now&quot; value=&quot;{{ &quot;Add to cart&quot;|t }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And as Jeremy identified, Javascript is the way forward to assign a quantity that matches another field. I did that with jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('input.buy-now').click(function() {&#xA;    if ($('.addon-checkbox').is(':checked')) {&#xA;        var qty = $('.quantity').val();&#xA;        $('.addon-checkbox').val(qty);&#xA;    } else {&#xA;        $('.addon-checkbox').val(0);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6317" LastEditorUserId="6317" LastEditDate="2017-02-21T17:56:30.570" LastActivityDate="2017-02-21T17:56:30.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19110" PostTypeId="1" AcceptedAnswerId="19118" CreationDate="2017-02-21T15:32:02.610" Score="1" ViewCount="600" Body="&lt;p&gt;In my rich text field I want to add images to the toolbar. &#xA;I have done everything that has to be done: I've added &quot;image&quot; to the Standar.json file and selected the Standard.json to be used for the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is, the 'image upload' is not added to the toolbar.&#xA;If I add &quot;list&quot; to the Standard.json the list does get added into the toolbar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why this happens and how I can fix this?&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2018-11-29T23:42:56.020" Title="Redactor can't add image into toolbar" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19111" PostTypeId="2" ParentId="18962" CreationDate="2017-02-21T15:57:25.330" Score="1" Body="&lt;p&gt;Another idea (since that's what you asked for) might be to leverage Relationships more than Entry Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find that those administering the content have a better time with relationships than Entry Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that your &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. if Golf Pros' was a Structure (instead), which contained a &lt;strong&gt;required&lt;/strong&gt; field called 'Related Location' your content admin person could logically click &lt;strong&gt;Entries&lt;/strong&gt; &gt; &lt;strong&gt;New Entry&lt;/strong&gt; &gt; &lt;strong&gt;Golf Pro&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One area this could really help would be News. If a News article (Entry) contained the same 'Related Location' field, I think you'd have a better time templating and also provide a more logical publishing experience for your client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same could apply to the other Entry Types you have beneath your Locations; About, How to find us, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said - it's only another approach - happy to discuss, Tom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2017-02-21T15:57:25.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19112" PostTypeId="2" ParentId="18966" CreationDate="2017-02-21T16:21:11.057" Score="1" Body="&lt;p&gt;Could you double check your General Settings (&lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;General&lt;/strong&gt;) to make sure there's no &quot;/index.php&quot; in the Site URL field?&lt;/p&gt;&#xA;" OwnerUserId="4215" LastEditorUserId="57" LastEditDate="2017-02-21T18:02:19.607" LastActivityDate="2017-02-21T18:02:19.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19113" PostTypeId="1" AcceptedAnswerId="19117" CreationDate="2017-02-21T16:56:39.830" Score="4" ViewCount="486" Body="&lt;p&gt;I'm creating a new lightswitch field and adding it to an entry type in a section which already has dozens of entries. I want the lightswitch to be default set to 'on'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I save the entry type with the lightswitch field added to a tab, then inspect an entry in that section, the new lightswitch field is set to 'off'. Is this a bug?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2019-03-08T16:40:26.103" Title="Can the Lightswitch field have a default 'on' setting?" Tags="&lt;lightswitch&gt;&lt;default&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19114" PostTypeId="1" AcceptedAnswerId="19137" CreationDate="2017-02-21T17:16:39.743" Score="2" ViewCount="620" Body="&lt;p&gt;I'm trying to use Craft's native datepicker with a plugin I've made for the admin section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got some code that works;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% from &quot;_includes/forms&quot; import date %}&#xA;&#xA;&amp;lt;h3&amp;gt;Start Date&amp;lt;/h3&amp;gt;&#xA;&#xA;{{ date({&#xA;    id: 'startDate',&#xA;    name: 'startDate',&#xA;    value: now&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I can't seem to get it to work with any other date, no matter what I do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my URL I have;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;startDate=09/02/2017&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in my twig template I have;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = craft.request.getParam('startDate') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do I need to do to &lt;code&gt;startDate&lt;/code&gt; in order to get the date picker to read that date?&lt;/p&gt;&#xA;" OwnerUserId="4931" LastActivityDate="2017-02-23T10:17:46.373" Title="Making Craft\DateTime Object from string in Twig" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;datetime&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19116" PostTypeId="1" CreationDate="2017-02-21T17:36:46.263" Score="1" ViewCount="146" Body="&lt;p&gt;I haves dev setup of a site that i want separate craft config, db and plugin folders for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_CONFIG_PATH', '../../../craftdevconfig/');&#xA;define('CRAFT_PLUGINS_PATH', '../../../craftdevplugins/');&#xA;define('CRAFT_STORAGE_PATH', '../../../craftdevstorage/'); //'../storage/');&#xA;define('CRAFT_TEMPLATES_PATH', '../craft/templates/');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to debug a plugin in craftdevconfig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am having a nightmare knowing where craft is looking.&#xA;For my plugin it seems to get its default configuration from the live craft/plugins folder. But for code changes, seems to change its mind about where the plugin service calls should be found. I can debug it locally as it has IP based service calls to third parties. Slowly going bald.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to clarify where craft thinks stuff is would be great&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-05-19T03:36:06.517" Title="CRAFT_CONFIG_PATH not picked up" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19117" PostTypeId="2" ParentId="19113" CreationDate="2017-02-21T17:55:36.713" Score="7" Body="&lt;p&gt;For entries previously created, the lightswitch field will not be &lt;em&gt;on&lt;/em&gt; even if you specified that as a field option. However, new entries should respect that field setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are new entries not honoring your field settings?&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2017-02-21T17:55:36.713" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19118" PostTypeId="2" ParentId="19110" CreationDate="2017-02-21T18:01:44.160" Score="3" Body="&lt;p&gt;You probably don't have an &lt;em&gt;Asset Volume&lt;/em&gt; defined yet. The button won't show up if there are no Asset Volumes, regardless of what your Redactor config specifies.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To add an &lt;a href=&quot;https://docs.craftcms.com/v3/assets.html#volumes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Volume&lt;/a&gt;, visit the Settings section of the admin, click &quot;Assets,&quot; and then &quot;Volumes.&quot; By default, only the &quot;Local&quot; Volume type is available, but you can install additional Volume types through the Plugin Store.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4169" LastEditDate="2018-11-29T23:42:56.020" LastActivityDate="2018-11-29T23:42:56.020" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19119" PostTypeId="2" ParentId="19114" CreationDate="2017-02-21T18:50:35.770" Score="2" Body="&lt;p&gt;Unfortunately, what you're trying to do, is not possible without writing a simple plugin to return a &lt;code&gt;Craft\DateTime&lt;/code&gt; object that the day picker can work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The global variable &lt;code&gt;now&lt;/code&gt;, is a &lt;code&gt;Craft\DateTime&lt;/code&gt; object, which the date picker is happy to work with because it can call &lt;code&gt;localeDate()&lt;/code&gt; on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, anything returned by &lt;code&gt;date&lt;/code&gt; or &lt;code&gt;date_modify&lt;/code&gt; twig filters, will be a &lt;code&gt;\DateTime&lt;/code&gt; object, which lacks functionality that the date picker relies on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your only option would be, to create a simple plugin that can take your date parameter, and return a &lt;code&gt;Craft\DateTime&lt;/code&gt; object, which you can pass as a &lt;code&gt;value&lt;/code&gt; to the date picker/date macro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of those things that you think, &lt;em&gt;&quot;this should be easy or at least possible&quot;&lt;/em&gt;, but I haven't found a &lt;em&gt;twig-only&lt;/em&gt; solution yet.&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2017-02-21T18:50:35.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19120" PostTypeId="2" ParentId="19022" CreationDate="2017-02-21T22:01:00.517" Score="2" Body="&lt;p&gt;Actually, your code doesn't look inefficient to me. While Marion's solution is cool, I don't think it'll impact your performance. Craft is pretty smart about caching the results of database queries as it goes. So you could call 100 different loops thru product.productImages and not incur a performance penalty. Yay Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try it yourself in a test template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 1..100 %}&#xA;  {% for image in product.productImages %}&#xA;    &amp;lt;div class=&quot;small-3 column&quot;&amp;gt;&#xA;      &amp;lt;a class=&quot;fancybox&quot; rel=&quot;gallery1&quot; href=&quot;{{image.getUrl()}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image.getUrl('productPageThumbnail')}}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only thing I see that would simplify your code a bit would be to include your conditional statement in the first &lt;code&gt;for&lt;/code&gt; loop statement as a filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in product.productImages if image.productMainImage %}&#xA;  &amp;lt;div class=&quot;small-12 column&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;fancybox&quot; rel=&quot;gallery1&quot; href=&quot;{{image.getUrl()}}&quot;&amp;gt;&amp;lt;img src=&quot;{{image.getUrl('productPageMainImage')}}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-02-21T22:01:00.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19121" PostTypeId="2" ParentId="19076" CreationDate="2017-02-21T22:55:27.897" Score="3" Body="&lt;p&gt;Out of the box, macOS comes with tools to run a website locally. But depending on your needs, you may find it limiting or daunting to get started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can Google pretty good guides for how to &lt;a href=&quot;https://www.google.com/search?q=run+a+website+locally+with+macOS&quot; rel=&quot;nofollow noreferrer&quot;&gt;run a website locally with macOS&lt;/a&gt;. But they differ depending on your OS version. Here's a guide to setting up on macOS Sierra: &lt;a href=&quot;https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Get Apache, MySQL, PHP and phpMyAdmin working on macOS Sierra&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://clickontyler.com/virtualhostx/&quot; rel=&quot;nofollow noreferrer&quot;&gt;VirtualHostX 7&lt;/a&gt; is a relatively simple alternative to MAMP for running multiple local websites. It's not free, but it wraps up Vagrant, VirtualBox, Apache server, PHP and I think MySQL in one package. It's separate from the macOS built-in Apache server so your setup won't change with future macOS updates and potentially break how your local website runs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe VirtualHostX 7 creates one Vagrant box to host all of your websites. I don't think it's possible to use multiple versions of PHP tho like &lt;a href=&quot;https://www.mamp.info/en/mamp-pro/#multiphp&quot; rel=&quot;nofollow noreferrer&quot;&gt;MAMP Pro&lt;/a&gt; allows you to do. This can be helpful if you're working on Site A with PHP 7, but Site B is still running on an older web server with PHP 5.6 so you'll want to match your local environment to that for testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another alternative is &lt;a href=&quot;https://www.vagrantup.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vagrant&lt;/a&gt;. If you go the route of creating individual Vagrant boxes for each website, the advantage is that you can create a virtual machine that exactly replicates the conditions of your remote web server. That can help eliminate the troubleshooting you might have to do when deploying code to a server environment that doesn't exactly match yours (like &quot;why isn't imagemagick working?&quot;). But like Ian said, it's resource intensive so you'll likely be constantly booting up and shutting down different Vagrant boxes that are using a bunch of your CPU and RAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same software maker as VirtualHostX makes a Vagrant box manager also called &lt;a href=&quot;https://clickontyler.com/hobo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hobo&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would prefer Docker, &lt;a href=&quot;https://github.com/gabrielmoreira/craftman&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craftman&lt;/a&gt; is a project to automate the setup Craft installs in Docker containers. But unless you have a good reason to use Docker, like you want to use it in production, I might stay away from it. It adds another layer of complexity.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-02-21T22:55:27.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19123" PostTypeId="1" CreationDate="2017-02-22T00:22:22.373" Score="0" ViewCount="853" Body="&lt;p&gt;So in my general config file I've defined an environmental variable called basePath (as per the &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Environment-Specific Variables documentation&lt;/a&gt;). I'm using the &lt;a href=&quot;http://php.net/manual/en/function.getcwd.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;getcwd()&lt;/a&gt; function to get the working directory.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; getcwd(),&#xA;        )&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using this for a few reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I work in an environment where many people can be working on the same project at the same time. So their local basePath is always different.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My different &lt;a href=&quot;https://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;siteUrls&lt;/a&gt; for my setup use trailing locales in the url: &lt;code&gt;'siteUrl' =&amp;gt; array( 'en' =&amp;gt; 'http://www.website.com/', 'fi' =&amp;gt; 'http://www.website.com/fi/' )&lt;/code&gt;. So when it comes to targeting environment-specific locales, things get messy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;$_SERVER['DOCUMENT_ROOT']&lt;/code&gt; is ok locally, but fails on a live server.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my problem is&lt;/strong&gt; when using &lt;code&gt;getcwd()&lt;/code&gt;, the locale is included in path. Is there a way to trim this out dynamically? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a way to strip out the current locale from this path on-the-fly? &lt;code&gt;rtrim(getcwd(),&quot;fi&quot;)&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there is a more reliable way to get the working directory?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2017-02-22T09:39:30.753" LastActivityDate="2017-02-22T09:39:30.753" Title="Define a dynamic 'basePath' environmental variable without the locale" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19124" PostTypeId="2" ParentId="18603" CreationDate="2017-02-22T02:47:53.943" Score="1" Body="&lt;p&gt;I would say it's intended that you use Craft's in-built system for product classification/hierachy/taxonomy - i.e. Categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories have support for custom fields of course, thus you can add backend manageable category images easily using an assets field, and you can also leverage all the things categories can offer without requiring anything extra from Commerce.  And any plugins etc. that work with Categories then work out of the box with your products, too.  Indeed, with Craft's neat separation of Category Groups, this still allows for good separation of your products from the rest of your data (whatever that might be, blogs etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend Product Types instead for managing &lt;strong&gt;separation of data concerns&lt;/strong&gt; more so than product classification.  That is to say, if you have products requiring clearly different data (e.g. your sell monitors, and printers - these clearly require different lists of specifications) - that's a good use of Product Types allowing you to have the specific fields you need for these things nicely separated.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to specific product types where your data determines you need them, we find it handy to have generic &lt;code&gt;product&lt;/code&gt; and &lt;code&gt;product with variant&lt;/code&gt; types to cover those sundry things that don't fit neatly into the various data separations we've made - with these things having just the core fields that all your products share.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-02-22T02:47:53.943" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19125" PostTypeId="2" ParentId="19123" CreationDate="2017-02-22T06:55:08.700" Score="1" Body="&lt;p&gt;Check out &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft-multi-environment&lt;/a&gt;; even if you don't use it, you might crib some of the ideas from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, how the &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment/blob/master/example.env.php#L49&quot; rel=&quot;nofollow noreferrer&quot;&gt;basePath is determined&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-22T06:55:08.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19126" PostTypeId="1" CreationDate="2017-02-22T10:11:26.197" Score="1" ViewCount="546" Body="&lt;p&gt;For the &lt;code&gt;robot.txt&lt;/code&gt; file, I want to get every URI from the entries for every language. Right now it just gets the URI from one language.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set crawledEntries = craft.entries({&#xA;    relatedTo: { sourceElement: crawlSites, field: &quot;entryCrawler&quot; },&#xA;    order: &quot;sortOrder&quot;&#xA;}) %}&#xA;&#xA;{% for entry in crawledEntries %}&#xA;    Disallow: /{{ entry.uri }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This now loops just through one locale.&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="57" LastEditDate="2017-02-22T17:30:22.557" LastActivityDate="2017-02-22T17:31:11.643" Title="Get every slug from entry for each language" Tags="&lt;url&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19127" PostTypeId="2" ParentId="19107" CreationDate="2017-02-22T11:00:35.993" Score="2" Body="&lt;p&gt;I found a solution that lets you overwrites the core file S3.php without touching the core files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adding this snippet to config/general.php  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// S3 override  &#xA;const BUCKET_NAME = 'YOUR BUCKET NAME';  &#xA;require_once('../craft/plugins/gm/S3.php');  &#xA;&#xA;return array(  &#xA;   ...  &#xA;);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And duplicate the S3.php file and add it to the plugins folder you can make the needed changes.&lt;/p&gt;&#xA;" OwnerUserId="5613" LastEditorUserId="57" LastEditDate="2017-02-22T17:29:19.807" LastActivityDate="2017-02-22T17:29:19.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19128" PostTypeId="2" ParentId="19107" CreationDate="2017-02-22T11:11:42.680" Score="2" Body="&lt;p&gt;Sorry, there's not a clean way of doing that in Craft 2. What you can do, though, is manually create an entry for the Asset Source in the &lt;code&gt;craft_assetsources&lt;/code&gt; table in database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/configuration.md#overriding-volume-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;improved&lt;/a&gt; in Craft 3, so, yay!&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-02-22T11:11:42.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19129" PostTypeId="2" ParentId="19062" CreationDate="2017-02-22T12:06:13.387" Score="3" Body="&lt;p&gt;We are working on providing better search for entries, products, orders,  and all other custom elements in Craft within Craft 3. For example we recently added the search keywords method to the element interface to allow searching on non core attributes or custom fields: &lt;a href=&quot;https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above additions like above will help us provide searching on attributes that aren't actual properties/getter methods on the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This of course doesn't help you in the short term when searching for orders on the attributes you listed. I have added it as a priority to see if we can somehow make searching on those attributes easier in Commerce 1.x&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A temporary work around would be adding the information to the search index by creating some pre-parse custom fields: &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you could create a pre-parse field called &quot;businessShippingName&quot; and add it to the order field layout. In the settings for that field, you could use the template: &lt;code&gt;{{ commerce_order.shippingAddress.businessName }}&lt;/code&gt;. This would allow you to search based on the business shipping name, as well as list it more easily in the order index screen.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-22T12:06:13.387" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19130" PostTypeId="2" ParentId="19126" CreationDate="2017-02-22T13:41:45.883" Score="1" Body="&lt;p&gt;Got it...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set crawledEntries = craft.entries({&#xA;    relatedTo: { sourceElement: crawlSites, field: &quot;entryCrawler&quot; },&#xA;    order: &quot;sortOrder&quot;&#xA;}) %}&#xA;&#xA;{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}&#xA;&#xA;{% for entry in crawledEntries %}&#xA;    Disallow: /{{ entry.uri }}&#xA;    {% for locale in otherLocales %}&#xA;        {% set entryL = craft.entries.id(entry.id).locale(locale).first() %}&#xA;&#xA;        {% if entryL %}&#xA;            Disallow: /{{locale}}/{{ entryL.uri }}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="57" LastEditDate="2017-02-22T17:31:11.643" LastActivityDate="2017-02-22T17:31:11.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19131" PostTypeId="2" ParentId="19116" CreationDate="2017-02-22T18:47:33.237" Score="1" Body="&lt;p&gt;A plugin that has config settings can provide the default values for those settings in &lt;code&gt;plugins/pluginHandle/config.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you've defined &lt;code&gt;CRAFT_PLUGINS_PATH&lt;/code&gt; as &lt;code&gt;craftdevplugins&lt;/code&gt;, that would be &lt;code&gt;craftdevplugins\pluginHandle\config.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;End users can set can set custom values in &lt;code&gt;config/pluginHandle.php&lt;/code&gt;.  Since you've defined &lt;code&gt;CRAFT_CONFIG_PATH&lt;/code&gt; as &lt;code&gt;craftdevconfig&lt;/code&gt;, that would be &lt;code&gt;craftdevconfig\pluginHandle.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-22T18:47:33.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19132" PostTypeId="1" AcceptedAnswerId="19152" CreationDate="2017-02-22T19:15:15.830" Score="0" ViewCount="1867" Body="&lt;p&gt;Following on from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19061/updating-a-user-on-the-front-end-with-vue-js-and-axios&quot;&gt;this question&lt;/a&gt; I am now looking at adding, deleting and updating a user's image on the front end using Vue.js and vue-resource. I have the delete functionality working no problem but I am having an issue with how I add and upddate a users' image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my test form code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot; @submit.prevent=&quot;submitForm&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;control&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;avatar&quot; class=&quot;label&quot;&amp;gt;Member Image&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;avatar&quot; type=&quot;file&quot; name=&quot;userPhoto&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot; class=&quot;button is-primary&quot;&amp;gt;Save Profile&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the Craft log when you submit the form without Ajax it works successfully and this is the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_POST=array (&#xA;  'CRAFT_CSRF_TOKEN' =&amp;gt; 'Vq_qS8xUX_Z0d09MHA_n3lFLCse3hLuc5Vx0sREE|b95a7c106acaa1e421d409d2eb708ac2beb18b96',&#xA;  'action' =&amp;gt; 'users/saveUser',&#xA;  'redirect' =&amp;gt; 'members/profile/gareth&#xA;',&#xA;  'userId' =&amp;gt; '39',&#xA;)&#xA;&#xA;$_FILES=array (&#xA;  'userPhoto' =&amp;gt; &#xA;  array (&#xA;    'name' =&amp;gt; 'new-me.jpg',&#xA;    'type' =&amp;gt; 'image/jpeg',&#xA;    'tmp_name' =&amp;gt; '/Applications/MAMP/tmp/php/phpfDqUNQ',&#xA;    'error' =&amp;gt; 0,&#xA;    'size' =&amp;gt; 395885,&#xA;  ),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My main question is how do I submit to the &lt;code&gt;$_FILES&lt;/code&gt; array using ajax? When I post my form using ajax I get the following Craft log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_POST=array (&#xA;  'userPhoto' =&amp;gt; &#xA;  array (&#xA;    'name' =&amp;gt; 'me.jpg',&#xA;    'type' =&amp;gt; 'image/jpeg',&#xA;    'tmp_name' =&amp;gt; '/Applications/MAMP/tmp/php/phpLha7Uh',&#xA;    'error' =&amp;gt; '0',&#xA;    'size' =&amp;gt; '117463',&#xA;  ),&#xA;  'deleteUserPhoto' =&amp;gt; '',&#xA;  'userId' =&amp;gt; '39',&#xA;  'action' =&amp;gt; 'users/saveUser',&#xA;  'CRAFT_CSRF_TOKEN' =&amp;gt; 'Vq_qS8xUX_Z0d09MHA_n3lFLCse3hLuc5Vx0sREE|b95a7c106acaa1e421d409d2eb708ac2beb18b96',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the only way to handle file uploads on the front end to create your own controller and work things out through that or can I set something within my ajax post that will add to the &lt;code&gt;$_FILES&lt;/code&gt; array?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Vue.js code for review:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;Vue.http.options.emulateJSON = true;&#xA;Vue.http.options.emulateHTTP = true;&#xA;&#xA;var app = new Vue({&#xA;  delimiters: ['@{', '}'],&#xA;  el: '#app',&#xA;  data: {&#xA;    user: {&#xA;      userPhoto: {&#xA;        'name': 'me.jpg',&#xA;        'type': 'image/jpeg',&#xA;        'tmp_name': '/Applications/MAMP/tmp/php/phpLha7Uh',&#xA;        'error': 0,&#xA;        'size': 117463&#xA;      },&#xA;      userId: '{{ currentUser.id }}',&#xA;      action: 'users/saveUser'&#xA;    },&#xA;  },&#xA;  methods: {&#xA;    submitForm: function() {&#xA;&#xA;      var data = this.user;&#xA;&#xA;      data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;      this.$http.post('/', data)&#xA;        .then(function(response) {&#xA;          // success stuff here&#xA;        });&#xA;    }&#xA;&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-24T06:33:35.030" Title="Update a user image on the front end using Vue.js and Ajax" Tags="&lt;ajax&gt;&lt;frontend&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19133" PostTypeId="2" ParentId="19100" CreationDate="2017-02-22T22:20:18.657" Score="1" Body="&lt;p&gt;I shall answer my own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue was because I was logged in as admin in another browser tab. I was not receiving the &quot;Unauthorized&quot; response from craft. Just the 404. By testing in an incognito window I was able to see I was receiving an unauthorized response from craft which led me to the problem. Which was the sectionId for that particular form was incorrect. SectionId on second form should have been 2 not 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps anyone else having a similar problem.&lt;/p&gt;&#xA;" OwnerUserId="6319" LastActivityDate="2017-02-22T22:20:18.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19134" PostTypeId="2" ParentId="382" CreationDate="2017-02-22T23:42:44.053" Score="1" Body="&lt;p&gt;I like &lt;strong&gt;conditionals&lt;/strong&gt; approach by Victor. Here's the slightly modified version for Craft 2.6:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog') %}&#xA;{% set last_date = '' %}&#xA;&#xA;{% for entry in allEntries %}&#xA;    {% if last_date != entry.postDate|date('Ymd') %}&#xA;&#xA;        This entry is the first of a new day&#xA;    {% endif %}&#xA;&#xA;    {% set last_date = entry.postDate|date('Ymd') %}&#xA;&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key (apart from .date being .postDate) is that entry.postDate will render a &lt;em&gt;formatted&lt;/em&gt; value like 2017-02-23, however the &lt;em&gt;evaluated&lt;/em&gt; value of entry.postDate will be the underlying timestamp, which includes hours/minutes/seconds. This means two entries from the same day may have a postDate that outputs 2017-02-23, but their underlying timestamps will likely have different h/m/s, making comparisons unreliable. Being explicit with postDate output (e.g. 'Ymd', or 20170223) solves the issue. &lt;/p&gt;&#xA;" OwnerUserId="6039" LastActivityDate="2017-02-22T23:42:44.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19135" PostTypeId="2" ParentId="19114" CreationDate="2017-02-23T06:42:43.743" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Perversion&lt;/a&gt; plugin has a &lt;code&gt;date_from_string&lt;/code&gt; filter that turns a string into a &lt;code&gt;Craft\DateTime&lt;/code&gt; object.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-02-23T06:42:43.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19137" PostTypeId="2" ParentId="19114" CreationDate="2017-02-23T10:17:46.373" Score="2" Body="&lt;p&gt;I achieved this by putting this into my variables file;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function craftDate($date) {&#xA;&#xA;     $dateObject = DateTime::createFromString($date,craft()-&amp;gt;timezone);&#xA;&#xA;     return $dateObject;&#xA;&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then calling this in my template by using;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date({&#xA;    id: 'startDate',&#xA;    name: 'startDate',&#xA;    value: craft.formExport.craftDate(reconfiguredStartDate)&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The date had been reconfigured from 01/02/2017 to 2017-02-01)&lt;/p&gt;&#xA;" OwnerUserId="4931" LastActivityDate="2017-02-23T10:17:46.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19138" PostTypeId="1" AcceptedAnswerId="19150" CreationDate="2017-02-23T12:41:09.867" Score="2" ViewCount="112" Body="&lt;p&gt;I am creating a &lt;a href=&quot;https://www.foodpanda.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Foodpanda&lt;/a&gt; type website through Craft Commerce where I want any logged user to be able to add any restaurant in his favourite list. And which will also show in User-&gt;Accounts-&gt;Favourite.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="340" LastEditDate="2017-02-23T23:57:14.637" LastActivityDate="2017-02-24T00:53:52.840" Title="Add to Favourite?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19139" PostTypeId="1" AcceptedAnswerId="19201" CreationDate="2017-02-23T15:26:41.567" Score="1" ViewCount="35" Body="&lt;p&gt;Not sure whether this is a Craft thing or a Yii thing, but I have this exact same code running on two servers that I've freshly updated Apache, PHP, etc. On the one server it runs fine but on the other the page never loads and I have to do a server reboot to clear it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone think of any reason this might happen?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = 'https://domain.com/jsonfeed'&#xA;try {&#xA;    $client = new \Guzzle\Http\Client();&#xA;    $request = $client-&amp;gt;get($url);&#xA;&#xA;    // BREAK NOW AND ALL IS FINE&#xA;&#xA;    $response = $request-&amp;gt;send();&#xA;&#xA;    // BREAK NOW AND PAGE NEVER LOADS SO IT MUST BE&#xA;    // $request-&amp;gt;send(); THAT IS FAILING&#xA;&#xA;    if (!$response-&amp;gt;isSuccessful()) {&#xA;        return;&#xA;    }&#xA;&#xA;    $items = $response-&amp;gt;json();&#xA;&#xA;    reset($items);&#xA;    $key = key($items);&#xA;    return $items[$key][$id];&#xA;&#xA;} catch(\Exception $e) {&#xA;    return;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-28T12:57:39.027" Title="$request-&gt;send fails on one server but not the other" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19140" PostTypeId="2" ParentId="19031" CreationDate="2017-02-23T15:38:12.723" Score="1" Body="&lt;p&gt;Ultimately I had to take approach similar to recommended by @crawf (though I don't completely like it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I added &quot;generic&quot; route&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'reports/csv/(.*)'         =&amp;gt; 'reports/csv',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in my &lt;code&gt;reports/csv/index.html&lt;/code&gt; template I have this code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% include &quot;reports/csv/&quot;~craft.request.segment(3) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then I created other templates in the folder (to be included into the main one), with names matching 3rd URL segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, there is only 1 check and include, and it's kinda 'dynamic'. I would still prefer avoiding this include for performance sake, but it's still better then having to add route for each new template.&lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="1104" LastEditDate="2017-02-24T07:23:11.883" LastActivityDate="2017-02-24T07:23:11.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19141" PostTypeId="1" CreationDate="2017-02-23T15:43:46.623" Score="1" ViewCount="318" Body="&lt;p&gt;I've been able to successfully filter a set of entries by category, and also include pagination for the complete set of entries (in this case so 6 are displayed per page).  But once a category filter is applied the pagination does not affect the filtered output, so for example, if a filter is applied that results in only 1 entry being displayed the pagination controls still show 2 pages (for 12 entries in total).  Then clicking on previous/next page (which of course users are bound to do!) re-sets the filter to show all results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't work out a solution....  :( &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could please have a look and suggest a solution I would be very grateful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('category') is not null %}&#xA;&#xA;  {% set category = craft.categories.slug(craft.request.getParam('category')) %}&#xA;  {% paginate craft.entries.section('caseStudies').relatedTo(category).limit(6) as pageInfo, casestudies %}&#xA;&#xA;{% else %}&#xA;&#xA;  {% set casestudies = craft.entries.section('caseStudies').find() %}&#xA;  {% paginate craft.entries.section('caseStudies').limit(6) as pageInfo, casestudies %}&#xA;&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul class=&quot;features&quot;&amp;gt;&#xA;  {% for category in craft.categories.group('industriesAndSectors').find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{craft.request.url}}/?category={{ category.slug }}&quot; title=&quot;{{ category.title}}&quot;&amp;gt;{{ category.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/case-studies/&quot; title=&quot;All Types&quot;&amp;gt;All Types&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;{% for casestudy in casestudies %}&#xA;  &amp;lt;div class=&quot;col-1-4&quot;&amp;gt;&#xA;    {% set photo = casestudy.caseStudyImage.first() %}&#xA;    {% if photo %}&#xA;      &amp;lt;a href=&quot;{{ casestudy.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ photo.url('thumbnail334x334') }}&quot; alt=&quot;{{ casestudy.title}}&quot; &amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;    &amp;lt;div class=&quot;white padded&quot;&amp;gt;&#xA;      &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;{{ casestudy.url }}&quot;&amp;gt;{{ casestudy.title}}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;      {# {{ entry.body.getPage(1) }} #}&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;!-- pagination --&amp;gt;&#xA;&#xA;&amp;lt;ul class=&quot;inline-list clear-both&quot;&amp;gt;&#xA;  {% if pageInfo.prevUrl %} &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;&amp;lt;i class=&quot;icon-chevron-left&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;&#xA;  {% for page, url in pageInfo.getPrevUrls() %}&amp;lt;li&amp;gt;&amp;lt;a class=&quot;pagination_pageno&quot; href=&quot;{{ url }}&quot; title=&quot;{{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endfor %}&#xA;&#xA;  &amp;lt;li class=&quot;pagination_pageno&quot;&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/li&amp;gt;&#xA;&#xA;  {% for page, url in pageInfo.getNextUrls() %}&amp;lt;li&amp;gt;&amp;lt;a class=&quot;pagination_pageno&quot; href=&quot;{{ url }}&quot; title=&quot;{{ page }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endfor %}&#xA;&#xA;  {% if pageInfo.nextUrl %} &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;&amp;lt;i class=&quot;icon-chevron-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;!-- / pagination --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5872" LastEditorUserId="130" LastEditDate="2017-02-23T18:28:41.700" LastActivityDate="2017-02-23T18:28:41.700" Title="How to add pagination to a filtered category output?" Tags="&lt;pagination&gt;&lt;category&gt;&lt;filtering&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19145" PostTypeId="2" ParentId="19138" CreationDate="2017-02-23T20:51:03.387" Score="1" Body="&lt;p&gt;Your question is pretty broad, so I'll try to hone in on the core of it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few plugins which can help you get the &quot;favorite&quot; mechanics working. Regardless of which one you choose, you'll probably need to customize your specific implementation to fit the needs of your site.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/lorigoldberg/curate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Curate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://squarebit.co.uk/software/craft/shortlist&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortlist&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftpl.us/plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upvote&lt;/a&gt; &lt;em&gt;(disclaimer: I wrote it)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/dukt/craft-like&quot; rel=&quot;nofollow noreferrer&quot;&gt;Like&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-02-23T20:51:03.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19146" PostTypeId="1" AcceptedAnswerId="19147" CreationDate="2017-02-23T20:57:49.153" Score="1" ViewCount="753" Body="&lt;p&gt;Whew, complicated thing to described in a short subject line! :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, so I have a structure like this:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asia&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peking  &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;weekend ( field &lt;code&gt;howLongWillYouBeGoing&lt;/code&gt; == 'shortStay' )&lt;/li&gt;&#xA;&lt;li&gt;long weekend ( field &lt;code&gt;howLongWillYouBeGoing&lt;/code&gt; == 'mediumStay' )&lt;/li&gt;&#xA;&lt;li&gt;week ( field &lt;code&gt;howLongWillYouBeGoing&lt;/code&gt; == 'longStay' )&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Europe&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peking  &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;weekend ( field &lt;code&gt;howLongWillYouBeGoing&lt;/code&gt; == 'shortStay' )&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;South America&#xA;(no subpages)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have a navigation bar that just lists the continents and turns them into a link as soon as it has descendants. When it doesn't have descendants, it just shows the continent name as a non-clickable text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this is the thing. I have used the following code, but it doesn't work. It still shows Europe in this example as a link, even though I believe the conditions are not met. I would LOVE love love any input because I've been staring myself blind on this the last few hours :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# loop through continents #}&#xA;{% for entry in craft.entries.section('destinations').type('continent').find() %}&#xA;    {# only show links to continent pages if it has any travelguides #}&#xA;    {% if entry.hasDescendants(3) %}&#xA;&#xA;        {% set mediumStay = 0 %}&#xA;        {% for subPage in entry.getDescendants(2) %}&#xA;            {% if subPage.howLongWillYouBeGoing == 'mediumStay' %}&#xA;                {% set mediumStay = 1 %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        {% if mediumStay == 1 %}&#xA;            {# if subpage is marked as mediumstay, show a link to it #}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; {% if craft.request.firstSegment == entry.slug %}class=&quot;is-active&quot;{% endif %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% else %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6332" LastEditorUserId="45" LastEditDate="2017-02-23T23:41:47.680" LastActivityDate="2017-02-23T23:41:47.680" Title="Check if entry has a descendant with a certain field enabled" Tags="&lt;templating&gt;&lt;entries&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19147" PostTypeId="2" ParentId="19146" CreationDate="2017-02-23T21:17:33.497" Score="1" Body="&lt;p&gt;Wow - thanks for listening ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# loop through continents #}&#xA;{% for entry in craft.entries.section('destinations').type('continent').find() %}   &#xA;    {# only show links to continent pages if it has any travelguides #}&#xA;    {% if entry.hasDescendants() %}&#xA;        {% set continentID = entry.id %}&#xA;        {% if entry.howLongWillYouBeGoing == 'mediumStay' in craft.entries.section('destinations').descendantOf(continentID) %}&#xA;            {# if subpage is marked as mediumstay, show a link to it #}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; {% if craft.request.firstSegment == entry.slug %}class=&quot;is-active&quot;{% endif %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;  &#xA;        {% else %} &#xA;            {# if it's not a mediumStay, just show the text #}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endif %} &#xA;    {% else %} &#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="6332" LastActivityDate="2017-02-23T21:17:33.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19148" PostTypeId="1" AcceptedAnswerId="19706" CreationDate="2017-02-23T21:50:02.660" Score="1" ViewCount="436" Body="&lt;p&gt;I would like to choose entry values from a frontend dropdown and reuse the chosen value directly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('mountainbikes') %}&#xA;&#xA;&amp;lt;select name=&quot;year&quot;&amp;gt;&#xA;{% for entry in entries %}&#xA;  &amp;lt;option value={{ entry.year }}&amp;gt;{{ entry.year }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i get the chosen value and reuse it in the same template?&#xA;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;  {% if entry.year == '2015' %} /* chosen value in dropdown field */&#xA;    {{ entry.title }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastEditorUserId="6061" LastEditDate="2017-03-31T06:18:01.057" LastActivityDate="2017-03-31T10:55:46.633" Title="Reuse chosen dropdown field value on frontend" Tags="&lt;variable&gt;&lt;frontend&gt;&lt;drop-down&gt;&lt;set&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19150" PostTypeId="2" ParentId="19138" CreationDate="2017-02-23T23:54:38.270" Score="2" Body="&lt;p&gt;I have very similar functionality working with Commerce on &lt;a href=&quot;https://imagescience.com.au/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imagescience.com.au/&lt;/a&gt; using the Shortlist plugin - any product or article can be favourited by logged in users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's really just two simple parts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;a single macro for anywhere I want to add the option (adds a&#xA;clickable star icon that add that uses an ajax call to add that entry&#xA;to their shortlist)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a &lt;code&gt;dashboard/favourites&lt;/code&gt; template that iterates through the shortlist&#xA;and separates out products and articles into two groups, then prints&#xA;pretty lists of those things (with a remove button for each).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Shortlist&quot;&gt;Shortlist&lt;/a&gt; works well in practise for precisely this functionality and it is simple to implement exactly what you're looking for with it.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-02-24T00:53:52.840" LastActivityDate="2017-02-24T00:53:52.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19151" PostTypeId="2" ParentId="19108" CreationDate="2017-02-24T00:28:01.970" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I have tried disabling each locale in the channel settings, but, then the user is required to enable it for their own locale when publishing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's the only way to pull off what you're looking for in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the upcoming Craft 3 refactoring, it would be much easier to pull of with a new event that a plugin could listen to and alter the behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to make a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-24T00:28:01.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19152" PostTypeId="2" ParentId="19132" CreationDate="2017-02-24T06:33:35.030" Score="0" Body="&lt;p&gt;In the end I found a solution which doesn't require creating my own controller. I am not sure it is possible to post directly to the &lt;code&gt;$_FILES&lt;/code&gt; array in Craft but by using the native &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData&quot; rel=&quot;nofollow noreferrer&quot;&gt;FormData&lt;/a&gt; object in Javascript you can basically pass all the form fields in the correct format to the vue-resource post method. I found &lt;a href=&quot;http://losstopschade.de/post/144063268923&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; useful on my search for solving what I needed. In doing this it kind of bypasses the Vue data model which is not exactly what I was after but it works well and keeps things simple. One caveat is that support for the FileData object is only on modern browsers but you can polyfill for older browsers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my final test form code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot; @submit.prevent=&quot;submitForm&quot; id=&quot;imageForm&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;members/profile/{% include '_includes/helpers/user_profile_link' %}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;  {% if currentUser.photoUrl %}&#xA;    &amp;lt;transition name=&quot;fade&quot;&amp;gt;&#xA;      &amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot; alt=&quot;{{ currentUser.fullName }}&quot; v-if=&quot;showImage&quot;&amp;gt;&#xA;    &amp;lt;/transition&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;#&quot; id=&quot;userPhoto&quot; v-on:click.prevent=&quot;deletePhoto&quot; v-if=&quot;showImage&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot; v-model=&quot;user.deleteUserPhoto&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;control&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;avatar&quot; class=&quot;label&quot;&amp;gt;Member Image&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;avatar&quot; type=&quot;file&quot; name=&quot;userPhoto&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% else %}&#xA;    &amp;lt;div class=&quot;control&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;avatar&quot; class=&quot;label&quot;&amp;gt;Member Image&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;avatar&quot; type=&quot;file&quot; name=&quot;userPhoto&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot; class=&quot;button is-primary&quot;&amp;gt;Save Profile&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my final Vue.js code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;Vue.http.options.emulateJSON = true;&#xA;Vue.http.options.emulateHTTP = true;&#xA;&#xA;var app = new Vue({&#xA;  delimiters: ['@{', '}'],&#xA;  el: '#app',&#xA;  data: {&#xA;    user: {&#xA;      deleteUserPhoto: '',&#xA;      userId: '{{ currentUser.id }}',&#xA;      action: 'users/saveUser'&#xA;    },&#xA;    showImage: true&#xA;  },&#xA;  methods: {&#xA;    submitForm: function() {&#xA;      var form = document.getElementById('imageForm');&#xA;      var formData = new FormData(form);&#xA;&#xA;      this.$http.post('/', formData)&#xA;        .then(function(response) {&#xA;          //this.updated = true;&#xA;        });&#xA;    },&#xA;    deletePhoto: function () {&#xA;      this.user.deleteUserPhoto = 'noMorePhoto';&#xA;&#xA;      var data = this.user;&#xA;&#xA;      data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;      this.$http.post('/', data)&#xA;        .then(function(response) {&#xA;          this.showImage = false;&#xA;        });&#xA;    }&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastActivityDate="2017-02-24T06:33:35.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19153" PostTypeId="1" AcceptedAnswerId="19200" CreationDate="2017-02-24T10:31:01.533" Score="4" ViewCount="383" Body="&lt;p&gt;Is it possible to search only in entries that have the own URLs option checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i've this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set queryWords = query|split(' ') %}&#xA;&#xA;{% paginate craft.entries({&#xA;    search: queryWords|join(' OR '),&#xA;    subLeft: true,&#xA;    subRight: true,&#xA;    order: 'score'&#xA;}).id('not ' ~ entry.id).limit(10) as pageInfo, items %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6335" LastActivityDate="2019-08-26T18:27:30.687" Title="Search only in entries with own urls checked" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19154" PostTypeId="1" AcceptedAnswerId="19162" CreationDate="2017-02-24T13:45:04.117" Score="2" ViewCount="267" Body="&lt;p&gt;When an order is submitted on the Craft Commerce website I'm currently building, an email is automatically sent to the customer. Inside this email is a link to download an invoice for that specific order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had accomplished this by putting the following link into my emails&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}index.php/admin/actions/commerce/downloads/pdf?number={{ order.number }}&quot;&amp;gt;Download your invoice&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not ideal as you could actually download any invoice by changing the order.number, but we fixed that by using a url proxy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I realised a few minutes ago that this link is not public and requires a login. Which I don't want.&#xA;Is there any way to generate a public link for the invoice?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastActivityDate="2017-03-26T18:37:12.347" Title="Public link for an invoice" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19155" PostTypeId="1" CreationDate="2017-02-24T14:42:41.667" Score="2" ViewCount="277" Body="&lt;p&gt;Clearly Craft CMS is not a thing for non-developers (like WordPress or Drupal is). Despite the option to create fields, sections, etc. in the administration panel, we still need to code templates (twig, html, CSS, etc.). So for me it's kind of a weird relationship where we define those things in administration with ease and luxury (no programming at all), and then still need to code standard way upon it in templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, this relationship creates a bunch of issues: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Let's say we work in team and some other dev decides to remove some fields (or change handle names), because he/she does not know my part in templates. The page is screwed! And it's hard to rollback, because, well it's database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Content replication problem! Thanks god there is something upcoming in this area &lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-content-migrations&lt;/a&gt;, but still this is fishy - read on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Request to DB are made for content definitions, that mostly stay the same all the time. No need for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution I see, in my opinion, is very simple. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let programmers to define fields, sections, globals, etc. (most of the settings contents) programmatically. If we know how to code with Twig, it shouldn't be so hard to edit some Yaml or PHP array. There is nothing to lose! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) No request to DB for code defined stuff. Huge performance gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) There is no content replication problem for programmatically defined settings. It is just delivered via version control!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) We can create unit tests, do code reviews, etc. for those content parts. Even extend to more functionality ... and always refer to version control (revert/analyze bad changes etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I talking bananas? &#xA;BR, J&lt;/p&gt;&#xA;" OwnerUserId="6336" LastEditorUserId="144" LastEditDate="2017-02-24T15:07:41.317" LastActivityDate="2017-02-26T09:51:03.197" Title="Problems with Craft CMS development strategy" Tags="&lt;field&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2017-02-28T21:34:36.313" ContentLicense="CC BY-SA 3.0" />
  <row Id="19157" PostTypeId="2" ParentId="19155" CreationDate="2017-02-24T16:23:38.100" Score="0" Body="&lt;p&gt;You might have more luck over at the &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft GitHub Issues&lt;/a&gt; site. Generally it's the place to go if you've got suggestions / feedback. This Stack Exchange site is used more for specific questions that need answers.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATED: Added link to the GitHub Issues site as per Brandon's comment below.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-02-24T18:17:05.963" LastActivityDate="2017-02-24T18:17:05.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19158" PostTypeId="1" AcceptedAnswerId="19159" CreationDate="2017-02-24T16:43:44.940" Score="3" ViewCount="378" Body="&lt;p&gt;Background info: trying to install Craft CMS on a Vm running on Xubuntu&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I was &lt;em&gt;finally&lt;/em&gt; able to see the glorious monkey screen to signify that I'd made it to the installer successfully, when disaster struck soon afterward... I began the installation, enter my info, and ended up waiting on a very, very long &quot;Oops&quot; screen that just seemed to keep going and going. I looked up some resources about the install process while I waited and thought I'd done something wrong, so I exited the window to try again, because no &quot;back&quot; option was available. When I went to the URL again to reenter my info, I got a screen saying &quot;Page Not Found: The requested URL was not found on this server.&quot; I did absolutely nothing after exiting the installer, checked to see that the file I was using in the URL is still where it should be, and restarting Apache (and then my VM) didn't help either, so now I'm stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I do? Any and all advice will be very greatly appreciated. I can't find the answer anywhere I've looked!&lt;/p&gt;&#xA;" OwnerUserId="6337" LastEditorUserId="22" LastEditDate="2017-05-09T20:23:34.597" LastActivityDate="2017-05-09T20:23:34.597" Title="Got an &quot;Oops&quot; Screen While in Installer, Exited to Try Again, and Now I Can't Get Back to Installer" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19159" PostTypeId="2" ParentId="19158" CreationDate="2017-02-24T16:51:01.267" Score="3" Body="&lt;p&gt;I feel silly posting an answer to my own question, but I wanted to post the solution in case anyone else ran across this, instead of just deleting the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was using the URL http: //localhost/public/index.php/admin/install to get to the installer, and I think it wouldn't let me go back because the installation-- somehow-- was actually successful. I started playing around with the URL and found that http: //localhost/public/index.php/admin brought me to the admin dashboard. Trying to put in the address I gave the site is still throwing a Page Not Found at me, but I'm hoping that's because everything is there but not quite wired-up correctly yet; I'll try to come back and edit this if I find that there is more that should be included here to remedy this.&lt;/p&gt;&#xA;" OwnerUserId="6337" LastActivityDate="2017-02-24T16:51:01.267" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19160" PostTypeId="2" ParentId="19153" CreationDate="2017-02-24T17:02:12.630" Score="0" Body="&lt;p&gt;At the risk of oversimplifying your problem... just hard-code the sections with the &quot;own URL&quot; option checked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;    section: ['sectionA', 'sectionB'],&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;own URL&quot; checkbox happens at the section level, and section configurations rarely change (once the site is fully developed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vo2x1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vo2x1.png&quot; alt=&quot;Entries in this section have their own URLs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, you already know which sections allow URLs, and can simply hard-code the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#section&quot; rel=&quot;nofollow noreferrer&quot;&gt;section handles&lt;/a&gt; into your code.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Accepted values include a section handle, &lt;strong&gt;an array of section handles&lt;/strong&gt;, or a SectionModel object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-02-24T17:02:12.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19161" PostTypeId="2" ParentId="17051" CreationDate="2017-02-24T18:16:05.670" Score="1" Body="&lt;p&gt;The right thing to do is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var that = this;&#xA;var id = $(that.$editor).attr('id')&#xA;$('#'+id).parent('.redactor-box').find('.CodeMirrorscroll').on('hover',function(){&#xA;var idnumber = id.replace('redactor-uuid-','')&#xA;$('#redactor-air-'+idnumber).css('display','block');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;on &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init: function()&#xA;                {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now its ok, its only opens one if you have more than one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;THanks&#xA;Carlos Vieira&lt;/p&gt;&#xA;" OwnerUserId="5646" LastActivityDate="2017-02-24T18:16:05.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19162" PostTypeId="2" ParentId="19154" CreationDate="2017-02-24T18:29:01.653" Score="1" Body="&lt;p&gt;You could write a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt;, that exposed an &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;anonymous controller action&lt;/a&gt; that mimicked Commerce's &lt;code&gt;Commerce_DownloadsController&lt;/code&gt;'s &lt;code&gt;actionPdf()&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-24T18:29:01.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19163" PostTypeId="2" ParentId="16939" CreationDate="2017-02-24T19:36:17.057" Score="1" Body="&lt;p&gt;I had trouble fetching the versions entry data. Things like &lt;code&gt;version.dateUpdated&lt;/code&gt; worked, but as soon as I tried to get the data of my custom fields, it would only return the latest data, not the one from the version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what made it work: fetch the version, get the entries version using &lt;code&gt;getVersionById()&lt;/code&gt; (&lt;a href=&quot;https://craftcms.com/classreference/services/EntryRevisionsService#getVersionById-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get versions of an entry #}&#xA;{% set lastVersions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}&#xA;&#xA;{# Get the version id and fetch the entire entry #}&#xA;{% set lastVersionId = lastVersions[0].versionId %}&#xA;{% set lastVersionEntry = craft.entryRevisions.getVersionById(lastVersionId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-02-24T19:36:17.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19164" PostTypeId="1" AcceptedAnswerId="19212" CreationDate="2017-02-24T20:16:52.810" Score="2" ViewCount="558" Body="&lt;p&gt;I have a bunch of entries with field eventStartDate and eventEndDate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I set the date&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I output the value of fwd, it is &lt;strong&gt;2017-04-21T08:30:00-05:00&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's 4/21/2017 at 8:30 AM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I query the channel to get events after that date/time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upcomingEvents = craft.entries&#xA;  .section('schedule')&#xA;  .order('eventStartDate asc')&#xA;  .eventStartDate('&amp;gt; ' ~ fwd )&#xA;  .limit(5)&#xA;  .status('live, pending')&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get events on 4/21/17 starting at 8:00AM, not what I intended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my syntax wrong?&lt;/p&gt;&#xA;" OwnerUserId="4992" LastEditorUserId="130" LastEditDate="2017-02-26T01:31:54.117" LastActivityDate="2017-02-28T21:19:26.597" Title="Trouble getting entries after a certain date" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19166" PostTypeId="1" AcceptedAnswerId="19168" CreationDate="2017-02-25T01:56:19.583" Score="1" ViewCount="321" Body="&lt;p&gt;I am brand new to Craft and can't find much support on this problem online. I have my entry pages and at the bottom of them, I have a div with the code below in it which randomly links to any entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now would like this to disallow the entry that I am on from that randomization. I assume from other threads it would be something to do with finding the ID of the entry the user is on and not allowing it in the randomize?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in randomEntry.projectFeaturedImage %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ randomEntry.url }}&quot;&amp;gt;{{ randomEntry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ randomEntry.url }}&quot;&amp;gt;See Project&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6338" LastEditorUserId="57" LastEditDate="2017-02-26T02:33:46.807" LastActivityDate="2017-02-26T02:33:46.807" Title="Random posts displayed but exclude current entry ID" Tags="&lt;entry&gt;&lt;random&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19168" PostTypeId="2" ParentId="19166" CreationDate="2017-02-26T01:28:42.080" Score="2" Body="&lt;p&gt;Here are a couple of useful stackexchange questions&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Getting a random entry: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2675/section-entries-order-by-random&quot;&gt;Section entries - order by random&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Excluding the current entry: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1275/exclude-current-entry/&quot;&gt;Exclude Current Entry&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Putting that together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomEntry = craft.entries({&#xA;  id: 'not '~entry.id,&#xA;  order: 'RAND()'&#xA;}).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will fetch entries whose id is not &lt;code&gt;entry.id&lt;/code&gt; (&lt;code&gt;entry&lt;/code&gt; is the current entry), ordered randomly, and then give you the first of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably you want to specify the section or sections to fetch your entries from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomEntry = craft.entries({&#xA;  section: ['thisSection', 'thatSection', 'theOtherSection'],&#xA;  id: 'not '~entry.id,&#xA;  order: 'RAND()'&#xA;}).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will do the same thing, but only fetch entries from those 3 sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all of that, you should also be sure to test that there actually is an entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if randomEntry %}&#xA;  ... do your thing ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-02-26T01:28:42.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19169" PostTypeId="1" AcceptedAnswerId="19170" CreationDate="2017-02-26T06:27:54.103" Score="3" ViewCount="235" Body="&lt;p&gt;When you use a form macro to generate an input in the CP, you'll end up with something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;fields-myField&quot; name=&quot;fields[myField]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Oddly, it looks like &quot;myField&quot; is generally passed around the code as a single &lt;code&gt;name&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What code in Craft core is responsible for automatically appending the &lt;code&gt;fields-&lt;/code&gt; to the id attribute, and wrapping &lt;code&gt;fields[]&lt;/code&gt; around the name attribute?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've scoured the Craft core code and just can't find it. That magic doesn't seem to be happening in a Twig macro or JavaScript.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-02-27T06:46:17.857" Title="How does Craft automatically wrap `fields[]` around name attributes?" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;field&gt;&lt;app&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19170" PostTypeId="2" ParentId="19169" CreationDate="2017-02-26T07:51:26.913" Score="6" Body="&lt;p&gt;I believe its the &lt;code&gt;namespace&lt;/code&gt; twig template function - and fields typically use the default namespace as &lt;code&gt;fields&lt;/code&gt;. This is defined under &lt;code&gt;templates/_includes/fields.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at that file (below), you'll notice that if you don't provide a &lt;code&gt;namespace&lt;/code&gt; variable to the include, it'll use &lt;code&gt;fields&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if element is not defined %}{% set element = null %}{% endif %}&#xA;{% if namespace is not defined %}{% set namespace = 'fields' %}{% endif %}&#xA;&#xA;{% namespace namespace %}&#xA;    {% for field in fields %}&#xA;        {% include &quot;_includes/field&quot; with {&#xA;            field:    field.getField(),&#xA;            required: field.required,&#xA;            element:  element,&#xA;            static:   (static is defined ? static : null)&#xA;        } only %}&#xA;    {% endfor %}&#xA;{% endnamespace %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In another scenario, you might have the following in your regular templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% namespace 'myNamespace' %}&#xA;  &amp;lt;input id=&quot;test&quot; name=&quot;test&quot;&amp;gt;&#xA;  &amp;lt;input id=&quot;another-test&quot; name=&quot;another-test&quot;&amp;gt;&#xA;{% endnamespace %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which would produce the equivalent, rendered HTML of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;myNamespace-test&quot; name=&quot;myNamespace[test]&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;myNamespace-another-test&quot; name=&quot;myNamespace[another-test]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its particularly useful in plugins or other complicated field handling where you don't have to worry about settings up name attributes (heaven forbid you have to change all your field name attributes with lots of fields!). This way, you can easily provide a wrap of context to your fields, while keeping the form elements pretty lean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important factor is the ID generation, which also flows onto labels for field - useful for accessibility.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In PHP, this is done with the &lt;code&gt;TemplatesService::namespaceInputs&lt;/code&gt; method...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;namespaceInputs($element, $namespace);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read a detailed breakdown of how this method works &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#namespaceInputs-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the class reference docs...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="45" LastEditDate="2017-02-27T06:46:17.857" LastActivityDate="2017-02-27T06:46:17.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19171" PostTypeId="2" ParentId="19155" CreationDate="2017-02-26T09:51:03.197" Score="1" Body="&lt;p&gt;I do not know where your problem is? In Wordpress, you can build pages with CustomFields, and I think the same with Drupal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you will have the same problem when Devs delete fields and play on the live system, the content is missing or the frontend error generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, it is simply forbidden to simply delete fields, they do the same nevertheless is not the CMS to blame, then that is Human Failure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are familiar with the principle of the ContentBuilders (no static backend masks), then you would not get far with field configurations with YAML or JSON, then the editor determines which fields he needs for each article individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if it's so much performance gain when you put the fields into the filesystem, because Craft has to double into the filesystem for the representation of a field in the backend (general fieldstyle, the field configuration) and then into the database To pick up the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 is fast, Craft 3 is even faster. Anyone who builds fixed fields does not have to worry about the backend performance.&lt;/p&gt;&#xA;" OwnerUserId="4800" LastActivityDate="2017-02-26T09:51:03.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19172" PostTypeId="2" ParentId="19164" CreationDate="2017-02-26T20:27:46.700" Score="0" Body="&lt;p&gt;Include an &lt;code&gt;and&lt;/code&gt; in the date filter with a comma. When boiled down this is treaded as an array then converted to a SQL statement. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upcomingEvents = craft.entries&#xA;  .section('schedule')&#xA;  .order('eventStartDate asc')&#xA;  .eventStartDate('and', '&amp;gt; ' ~ fwd )&#xA;  .limit(5)&#xA;  .status('live, pending')&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-02-26T20:27:46.700" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19173" PostTypeId="2" ParentId="14696" CreationDate="2017-02-26T22:33:10.770" Score="11" Body="&lt;p&gt;No need for a plugin.&#xA;Just add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &quot;imageResizable&quot;: true,&#xA; &quot;imagePosition&quot;: true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to your chosen redactor config file i.e. (/craft/config/redactor/standard.json)&lt;/p&gt;&#xA;" OwnerUserId="5954" LastEditorUserId="5954" LastEditDate="2017-02-27T00:06:16.490" LastActivityDate="2017-02-27T00:06:16.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19174" PostTypeId="2" ParentId="18740" CreationDate="2017-02-27T07:34:37.127" Score="1" Body="&lt;p&gt;From what I understand it is possible to host a Craft site on Pantheon but they will not offer the same level of support that you would get using WordPress or Drupal. This is what I've been told by Pantheon technical support, at least. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workflow you're looking for could be mostly set up on Heroku using &lt;a href=&quot;https://devcenter.heroku.com/articles/github-integration-review-apps&quot; rel=&quot;nofollow noreferrer&quot;&gt;review apps&lt;/a&gt;, however, to my knowledge they don't have the same workflow where new branches can be created with cloned content from whichever environment or branch you'd like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that this would be possible by running &lt;a href=&quot;https://devcenter.heroku.com/articles/app-json-schema&quot; rel=&quot;nofollow noreferrer&quot;&gt;postdeploy script&lt;/a&gt; from app.json, which fires once when the review app is created. You could write a script that pulls production content and clones an S3 bucket into a new one, giving you a Pantheon-esque workflow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're going to go down this route you might want the AWS CLI Buildpack, the ability to use environment variables in Craft (see Matt Stauffer's site for this) and you'll probably want to use Jaws for MySQL since, in my experience, it's much faster than ClearDB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm in the same boat as you, coming from a WP heavy background and very reliant on Pantheon, so currently looking into a similar set up myself. Hope this provides some direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be amazing if Pantheon just offered Craft support out of the box.&lt;/p&gt;&#xA;" OwnerUserId="6342" LastActivityDate="2017-02-27T07:34:37.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19175" PostTypeId="1" CreationDate="2017-02-27T08:31:12.100" Score="0" ViewCount="758" Body="&lt;p&gt;I have created a site for searching nearby restaurants and order items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After ordering I wanna send a mail &quot;Order received&quot; with receipt attached in mail (if possible) to the customer + a mail to the respective restaurant which is in Craft-&gt;User &quot;New Order&quot; + a mail to site admin contains customer info and restaurants info + what I code in email template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All these function will be done in single click. I mean when customer click on Order Now. These all mail will sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am try to search email template and tutorial but I haven't found anything.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T20:22:00.860" LastActivityDate="2017-05-09T20:22:00.860" Title="Email Template in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19176" PostTypeId="2" ParentId="18740" CreationDate="2017-02-27T09:44:50.583" Score="1" Body="&lt;p&gt;AFAIK there is no hosting for Craft with a Multidev toolset similar to Pantheon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At &lt;a href=&quot;https://www.fortrabbit.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;fortrabbit.com&lt;/a&gt; (full disclosure: I'm one of the partners) you use multiple &lt;em&gt;Apps&lt;/em&gt; to model a multi-stage setup for your project. You basically control the entire &lt;a href=&quot;https://help.fortrabbit.com/multi-staging-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;flow with git branches&lt;/a&gt;, but it's not a one-click solution like with Pantheon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this does solve the biggest pain point with CMS multi-stage-development: Content Migrations. Craft 3 has a solution for that. For Craft 2, there is the nerds-and-company/schematic plugin to export/import structures. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 3: &lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-content-migrations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Craft 2: &lt;a href=&quot;https://github.com/nerds-and-company/schematic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nerds-and-company/schematic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Further, I suggest having a look at the Andrew Welch's craft-scripts &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4538" LastActivityDate="2017-02-27T09:44:50.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19178" PostTypeId="1" CreationDate="2017-02-27T10:51:04.087" Score="0" ViewCount="1432" Body="&lt;p&gt;I'm using the auto generate entry titles from custom fields option, eg&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{eventVenue}-{seriesName}-{eventDate}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But sometimes the eventVenue isn't known at the time of creating the entry, so you can end up with a slug of tba-winter-2017-04-15. But when they later update the eventVenue the slug is not right. It's not very easy to explain to users that they can/should change the slug and for them to remember to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fully understand the thinking that in many cases the slug shouldn't change due to existing links that may exist and will now break, but is there a way to override the default?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ExpressionEngine I used an addon, &quot;Title Master&quot; that had the option to update url on edit or not.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2017-04-28T19:11:22.217" Title="How can I force a slug to update on save" Tags="&lt;control-panel&gt;&lt;config&gt;&lt;entry-slug&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19179" PostTypeId="1" AcceptedAnswerId="19184" CreationDate="2017-02-27T11:14:02.237" Score="2" ViewCount="738" Body="&lt;p&gt;I'm trying to make a News item grid. I'm looking for a solution to output 2 type of &quot;rows&quot;. One that shows 2 entries and the other shows 3 entries.&#xA;I tried playing around with batches already but can't really manage to get it working alright. Is batch the right filter to use? If not what should I try using?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ETj3I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ETj3I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twigless code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Begin row type 1 --&amp;gt;&#xA;    &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-8&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item big-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- End row type 1 --&amp;gt;&#xA;    &amp;lt;!-- Begin row type 2 --&amp;gt;&#xA;    &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- End row type 2 --&amp;gt;&#xA;    &amp;lt;!-- Begin row type 1 --&amp;gt;&#xA;    &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-8&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item big-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- End row type 1 --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2018-03-02T15:41:44.017" Title="Making an entry grid with Batch 2,3 (2 in row then 3 in row)" Tags="&lt;entries&gt;&lt;forloop&gt;&lt;bootstrap-craft&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19180" PostTypeId="1" CreationDate="2017-02-27T11:59:01.757" Score="1" ViewCount="268" Body="&lt;p&gt;I have redactor with plugin code mirror installed&#xA;however i want to put code mirror read only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i do that the read only?&#xA;Thanks in advance.&#xA;Carlos Vieira&lt;/p&gt;&#xA;" OwnerUserId="5646" LastActivityDate="2017-02-27T12:32:46.657" Title="Redactor plugin Code Mirror read only" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19181" PostTypeId="2" ParentId="19179" CreationDate="2017-02-27T12:25:53.077" Score="1" Body="&lt;p&gt;I think a way to achieve this, is to use a loop. &#xA;If the pattern repeats after the third row, you could use odd or even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there might be a better way, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mijingo.com/blog/where-am-i-in-the-twig-loop&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mijingo.com/blog/where-am-i-in-the-twig-loop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE i tested it, it kinda works but unfortunately it skips the 3rd item like that, as well as there still needs to be a solution for changing the first row layout every second loop  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in items|batch(3) %}&#xA; &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;   {% if loop.index is odd %}&#xA;     {% for batch in entry[0:2]   %}&#xA;       {% if loop.index == 1 %}&#xA;         &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;       {% else %}&#xA;         &amp;lt;div class=&quot;col-md-8&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;       {% endif %}&#xA;     {% endfor %}&#xA;   {% else %}&#xA;     {% for batch in entry %}&#xA;         &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;4 item&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;     {% endfor %}&#xA;   {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;playground for testing : &#xA;&lt;a href=&quot;http://twig.stapps.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://twig.stapps.io/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;json i used : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [&quot;1&quot; , &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot; , &quot;6&quot;, &quot;7&quot;, &quot;8&quot;,&quot;9&quot; , &quot;10&quot;, &quot;11&quot;, &quot;12&quot; ] }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2017-02-27T14:43:38.530" LastActivityDate="2017-02-27T14:43:38.530" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19182" PostTypeId="2" ParentId="19180" CreationDate="2017-02-27T12:32:46.657" Score="1" Body="&lt;p&gt;This is the solution&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.CodeMirror &amp;gt; div &amp;gt; textarea').attr('readonly','readonly');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in init{} redactor calback&lt;/p&gt;&#xA;" OwnerUserId="5646" LastActivityDate="2017-02-27T12:32:46.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19183" PostTypeId="1" AcceptedAnswerId="19191" CreationDate="2017-02-27T13:37:11.850" Score="0" ViewCount="372" Body="&lt;p&gt;Under SEO Entry Meta...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you set SEO Description and SEO Keywords?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that they can pull from Text, Rich Text, Tags and Matrix fields, can they pull from a Category field?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-02-27T18:27:31.903" Title="Can SEOmatic pull from a Category Field to fill Entry - SEO Keywords or SEO Description?" Tags="&lt;plugins&gt;&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19184" PostTypeId="2" ParentId="19179" CreationDate="2017-02-27T14:04:54.837" Score="2" Body="&lt;p&gt;With some help from HendrikEng's answer I figured out something that does work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had to make the batch bigger to an amount of 5 making the &quot;row's&quot; bigger. Also I had to set the position of the bigger block which always is the first or second of this batch so I could set this witha variable which changes if a new batch started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the finalcode which works perfect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('cases')|batch(5) %}&#xA;    &amp;lt;!-- Set position for the bigger block --&amp;gt;&#xA;    {% set bigBatchNr = 2 %}&#xA;    &amp;lt;!-- Change position for the bigger block if the batch loop is even --&amp;gt;&#xA;    {% if loop.index is even %}&#xA;        {% set bigBatchNr = 1 %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;        {% for batch in entry %}&#xA;            {% if loop.index == bigBatchNr %}&#xA;                &amp;lt;div class=&quot;col-md-8&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;caseGrid-item big-item&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;caseGrid-item&quot;&amp;gt;&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}            &#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-27T14:04:54.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19185" PostTypeId="2" ParentId="19175" CreationDate="2017-02-27T14:39:55.167" Score="2" Body="&lt;p&gt;Let me know if anything in this help document needs clarifying: &lt;a href=&quot;https://craftcommerce.com/support/sending-an-order-confirmation-email&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/support/sending-an-order-confirmation-email&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-02-27T14:39:55.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19186" PostTypeId="2" ParentId="19183" CreationDate="2017-02-27T16:15:06.970" Score="1" Body="&lt;p&gt;Have you made a field that uses SEOmatic? If not you should make one and put it on the page you would like to use it (best would be all pages).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've done that make sure you dont have any other SEO related elements in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; tag to ensure the SEOmatic once are used. &#xA;Also make sure you put &lt;code&gt;{% hook 'seomaticRender' %}&lt;/code&gt; in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there on the SEO would render and you can check per page where you have the field active. Per type of SEO feature you have a option to use &quot;custom text&quot; or &quot;From Field&quot; If you select &quot;From Field&quot; You see a dropdown which gives you the option to select which field you want to use.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-27T16:15:06.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19187" PostTypeId="1" CreationDate="2017-02-27T16:45:54.650" Score="1" ViewCount="73" Body="&lt;p&gt;I have created a global menu for my website and there I have a label and an entry section selection that I use for directing when clicking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I just need the URL of that section and loading the whole section data is way too much overhead that its not needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 4-5 menu items so I am loading 4-5 sections for no reason.  Imagine the overhead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I somehow use the section selector in CMS but get only the section URL without loading all the section data?&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="57" LastEditDate="2017-02-27T18:03:24.193" LastActivityDate="2017-03-31T10:38:36.500" Title="Optimizing website menu" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19188" PostTypeId="2" ParentId="19178" CreationDate="2017-02-27T18:00:05.817" Score="1" Body="&lt;p&gt;You could write a simple plugin that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onSaveEntry&lt;/code&gt;&lt;/a&gt; and perform whatever custom business logic you require for slugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't re-save that entry going through &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt;, though, or else you'll create an infinite loop by firing the &lt;code&gt;onSaveEntry&lt;/code&gt; event again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could either call &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement()&lt;/code&gt; directly or use use &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow noreferrer&quot;&gt;QueryBuilder&lt;/a&gt; to directly update the database with the slug.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-27T18:00:05.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19189" PostTypeId="1" AcceptedAnswerId="19193" CreationDate="2017-02-27T18:10:47.717" Score="4" ViewCount="918" Body="&lt;p&gt;I'd like to control where a user gets re-directed after login based on the user group. That is, userGroupA logs in and is sent to /templateA/_entry, while userGroupB logs in and is sent to /templateB/_entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that &lt;code&gt;postLoginRedirect&lt;/code&gt; can be used dynamically. Are there any examples of this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2020-04-01T16:52:50.213" Title="Redirecting after login based on user group" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19190" PostTypeId="2" ParentId="19189" CreationDate="2017-02-27T18:23:55.363" Score="2" Body="&lt;p&gt;You could set the template they get redirected to after successfully logged in, then in there, redirect them based on the user group they belong to.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if currentUser.isInGroup('userGroupA') %}&#xA;    {% redirect 'path/a' %}&#xA;{% elseif currentUser.isInGroup('userGroupB') %}&#xA;    {% redirect 'path/b' %}&#xA;{% else %}&#xA;    {% redirect 'path/c' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="9" LastEditDate="2017-02-27T18:58:54.207" LastActivityDate="2017-02-27T18:58:54.207" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19191" PostTypeId="2" ParentId="19183" CreationDate="2017-02-27T18:27:31.903" Score="3" Body="&lt;p&gt;Currently, no, SEOmatic cannot pull from a category field. You have two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use the Preparse Field, and have that set to be whatever you want it to be (pull output from a Category, whatever): &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Do it manually via Twig in your templates: &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-02-27T18:27:31.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19192" PostTypeId="2" ParentId="19153" CreationDate="2017-02-27T18:49:52.350" Score="0" Body="&lt;p&gt;If at all possible, I'd probably try and use &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19153/search-only-in-entries-with-own-urls-checked/19160#comment25944_19160&quot;&gt;Lindsey's answer&lt;/a&gt; in his follow-up comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative is, you'd have to create a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that grabbed every section and looped through them, checks their settings and see if they have the &quot;Entries in the section have their own URLs&quot; set. If so, collect an array of them and pass them back to the template via a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Variable&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't want to do that on every request, though, since it's overhead and you'll probably end up caching the data, which at that point, you might as well have went with Lindsey's solution.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-27T18:49:52.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19193" PostTypeId="2" ParentId="19189" CreationDate="2017-02-27T18:51:12.683" Score="6" Body="&lt;p&gt;To set the setting dynamically, you’ll need to create a new plugin, which just has an &lt;code&gt;init()&lt;/code&gt; method with this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    // Is this a login request?&#xA;    if (&#xA;        craft()-&amp;gt;request-&amp;gt;getActionSegments() === array('users', 'login') &amp;amp;&amp;amp;&#xA;        ($loginName = craft()-&amp;gt;request-&amp;gt;getPost('loginName')) !== null &amp;amp;&amp;amp;&#xA;        ($user = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($loginName)) !== null&#xA;    )&#xA;    {&#xA;        if ($user-&amp;gt;isInGroup('userGroupA'))&#xA;        {&#xA;            craft()-&amp;gt;config-&amp;gt;set('postLoginRedirect', 'path/a');&#xA;        }&#xA;        else if ($user-&amp;gt;isInGroup('userGroupB'))&#xA;        {&#xA;            craft()-&amp;gt;config-&amp;gt;set('postLoginRedirect', 'path/b');&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If none of the conditions match, then Craft will stick with whatever’s in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-02-27T18:51:12.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19194" PostTypeId="1" AcceptedAnswerId="19224" CreationDate="2017-02-27T20:23:42.777" Score="0" ViewCount="315" Body="&lt;p&gt;`I will try this again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an index page for each category within category group 1 (&lt;code&gt;markets&lt;/code&gt;).   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I loop through the descendants of the given category to create filter buttons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do i pull all the categories from a 2nd category group (&lt;code&gt;country&lt;/code&gt;) assigned to each &lt;code&gt;market&lt;/code&gt; from &lt;code&gt;markets&lt;/code&gt;  - listing them only once &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;code&gt;market&lt;/code&gt; from category group-1 (&lt;code&gt;markets&lt;/code&gt;), I am using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set segments = craft.categories.descendantOf(category) %}&lt;/code&gt;&#xA;&lt;code&gt;{% for category in segments %}&lt;/code&gt;&#xA;&lt;code&gt;button html using {{ category.title }}&#xA;``{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;code&gt;countries&lt;/code&gt; from category group-2 (&lt;code&gt;country&lt;/code&gt;), I tried using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set name = craft.categories.group('country').relatedTo(category) %}&lt;/code&gt;&#xA;&lt;code&gt;{% for nation in name %}&lt;/code&gt; &lt;code&gt;button html with {{ nation.countryName }}&lt;/code&gt;&#xA;&lt;code&gt;{% endear %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;countryName&lt;/code&gt; is the field name for the &lt;code&gt;country&lt;/code&gt; group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not get a template error.  But nothing printed.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2017-02-27T20:29:31.273" LastActivityDate="2017-03-01T14:44:44.333" Title="How do I pull categories from another category group for members of another category?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19195" PostTypeId="1" AcceptedAnswerId="19197" CreationDate="2017-02-27T20:39:11.507" Score="0" ViewCount="65" Body="&lt;p&gt;I know that out of the box one cannot use Live Preview with Global Settings.  I am wondering if it is possible to write a plugin or in some other manner get Live Preview to work with Global Settings.  &lt;/p&gt;&#xA;" OwnerUserId="6344" LastActivityDate="2017-02-28T00:11:31.340" Title="Is it Possible to Use Live Preview with Global Settings" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;globals&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19196" PostTypeId="2" ParentId="19194" CreationDate="2017-02-27T20:40:43.850" Score="0" Body="&lt;p&gt;Try changing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set name = craft.categories.group('country').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set name = craft.categories.group('country').relatedTo(category.slug) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use the slug parameter to target a specific category in the category group. More parameters can be found here: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.categories&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories&#xA;    .group('nameOfCategoryGroup')&#xA;    .slug('specificCategoryInGroup')&#xA;    .limit(1)&#xA;    .first()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="3618" LastEditDate="2017-02-28T03:24:42.370" LastActivityDate="2017-02-28T03:24:42.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19197" PostTypeId="2" ParentId="19195" CreationDate="2017-02-28T00:11:31.340" Score="2" Body="&lt;p&gt;Anything's possible, but not without hacking core files, which isn't recommended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, global settings don't even have the concept of a &quot;template&quot;, which is a fundamental part of getting a Live Preview request to work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-02-28T00:11:31.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19198" PostTypeId="1" CreationDate="2017-02-28T07:58:53.597" Score="2" ViewCount="194" Body="&lt;p&gt;I see that it is not possible to add tabs to Global fields (unlike, say, with entries, where one can organize one's fields into different tab groups).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way (without editing the core files) to change this so that I can organize my global settings fields into tabbed sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6344" LastActivityDate="2017-02-28T08:13:39.653" Title="Is There a Way to Add Tabs in Global Fields?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;field&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19199" PostTypeId="2" ParentId="19198" CreationDate="2017-02-28T08:13:39.653" Score="3" Body="&lt;p&gt;As far as my knowledge goes there is not a way to do this without some though changes.&lt;br&gt;&#xA;Wouldn't it just be better to add another global and just name it settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;globalSettings(option1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;globalSettings(option2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;globalSettings(option3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that you organize them like that? Only thing you have to keep in mind then is when you use it in your template you have to keep track of which setting is used for what but if you name them right that wouldn't be an issue.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-28T08:13:39.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19200" PostTypeId="2" ParentId="19153" CreationDate="2017-02-28T09:30:21.917" Score="0" Body="&lt;p&gt;I've found a solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;    search: queryWords|join(' OR '),&#xA;    subLeft: true,&#xA;    subRight: true,&#xA;    order: 'score'&#xA;}).section('and, not sectionName').id('not ' ~ entry.id).limit(10) as pageInfo, items %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When i add this .section('and, not sectionName') a section without urls is not included in the search.&lt;/p&gt;&#xA;" OwnerUserId="6335" LastActivityDate="2017-02-28T09:30:21.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19201" PostTypeId="2" ParentId="19139" CreationDate="2017-02-28T12:57:39.027" Score="1" Body="&lt;p&gt;The problem was the service that was supposed to return the JSON feed was not returning &lt;em&gt;anything&lt;/em&gt;. Meaning our server was simply waiting for a response that never arrived and eventually timing out a minute later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only discovered this by writing my own script to test for a response from two different servers, discovering the IP address of the server experiencing the problem was being blocked from accessing the JSON feed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, if you're supplying data and decide to block someone's IP, at least tell them you're doing so. An error response would have saved me a lot of work.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-28T12:57:39.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19202" PostTypeId="2" ParentId="19187" CreationDate="2017-02-28T13:28:39.603" Score="1" Body="&lt;p&gt;Are you experiencing performance issues? If not, is this overhead really an issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is, how about caching the global menu for a really long time? &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-28T13:28:39.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19203" PostTypeId="2" ParentId="19175" CreationDate="2017-02-28T13:37:34.620" Score="1" Body="&lt;p&gt;It sounds to me like you need a plugin which listens for &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt;, fetches the restaurant in the order and sends the email to the restaurant owner. See &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-28T13:37:34.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19204" PostTypeId="1" AcceptedAnswerId="19206" CreationDate="2017-02-28T14:06:34.680" Score="1" ViewCount="269" Body="&lt;p&gt;I'm trying to create dynamic urls for a channel or structure section that depend upon the url structure of a different structure (or the first entry in that structure). For example, if the main structure has &quot;foo.com/news/&quot; I want the 'news' channel entries to have urls of &quot;foo.com/news/{slug}&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came across this question/answer which seems like a great solution: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1516/dynamically-setting-a-channels-entry-url-format-with-craft-tags&quot;&gt;Dynamically setting a channel&amp;#39;s Entry URL Format with Craft tags&lt;/a&gt;  However, like mentioned it's not really dynamic as you need to go back and resave if the parent slug changes. I started doing this and it's turning into a disaster. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone found a way to do this completely dynamically? Would routing be the right way and how would it be done (I have not used routing)? Or backwards relational entries from the channel to main structure (which seems much less intuitive from CP UI perspective)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and if you don't have any ideas, HOW do you deal with urls when you have a 'pages' structure and linking from that to a channel? Based on extensive research, this seems to be the best way of blending structures and channels but my site is too large and complex to hard-code the url structures for the outlying channels/structures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have the rep to comment on the post above, hence the new question. Thanks much in advance! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;****See my comment below gioppe's answer. I have decided against using this dynamic url approach, as explained in my comment.&lt;/p&gt;&#xA;" OwnerUserId="5264" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-03-02T17:51:07.917" Title="dynamic urls for channel/structure that's linked to the main structure" Tags="&lt;url&gt;&lt;structure&gt;&lt;channels&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19205" PostTypeId="1" AcceptedAnswerId="19218" CreationDate="2017-02-28T14:22:02.247" Score="1" ViewCount="98" Body="&lt;p&gt;Let's say we have products, and some of these products have a Firmware Update file (or several firmware update files) that may be associated with the product entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Firmware file assets will have associated &quot;metadata&quot; for each, including:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Version&lt;/li&gt;&#xA;&lt;li&gt;Region&lt;/li&gt;&#xA;&lt;li&gt;Release Date&lt;/li&gt;&#xA;&lt;li&gt;Notes&lt;/li&gt;&#xA;&lt;li&gt;Install Instructions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is would it be better to add a new section for Firmware, with separate fields for the above (plus associated Product and Firmware Asset Entry), or just have the Asset contain all those fields as metadata on the asset entry itself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this might be a philosophical question. Maybe it will be flagged as too subjective, but I thought I'd ask.&lt;/p&gt;&#xA;" OwnerUserId="2243" LastActivityDate="2017-03-01T09:16:30.893" Title="Asset Meta Fields vs Section with Asset field + the other fields?" Tags="&lt;assets&gt;&lt;sections&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19206" PostTypeId="2" ParentId="19204" CreationDate="2017-02-28T14:35:35.513" Score="1" Body="&lt;p&gt;I'm not sure to understand what you're trying to solve but... have you tried using the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getElementRoute&quot; rel=&quot;nofollow noreferrer&quot;&gt;getElementRoute&lt;/a&gt; hook to bypass the default Craft routing and apply any custom processing/routing you need?&lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2017-02-28T14:35:35.513" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19207" PostTypeId="2" ParentId="19205" CreationDate="2017-02-28T15:16:45.730" Score="2" Body="&lt;p&gt;Personally I would add the fields to the asset. Totally depends on what order you prefer to fill in the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you going to fill in all the data yourself or a client? If so, ask them what they prefer.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-02-28T15:16:45.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19208" PostTypeId="2" ParentId="19205" CreationDate="2017-02-28T16:08:39.957" Score="1" Body="&lt;p&gt;Because the asset fields rely on a double-click to access a modal containing the fields, I don't normally use a lot of them because I find clients prefer having more space to work. Especially so when the fields include Rich Text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you could first try taking the asset fields route and see how easy it is to complete the fields. But, I'd probably create a section for Firmware with an Entries field linking it to the Product. The client would have more room to work for, say, the notes and firmware instructions. And you could quite easily list older versions of the firmware on the product page (I know you could do that if they were assets but I think this would be easier to manage if there were regular firmware updates being made).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*By the way, designing the control panel is an essential skill for getting the most out of Craft CMS so I'd say this isn't subjective at all. I don't think it matters that there is no one definitive answer.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-02-28T16:08:39.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19209" PostTypeId="1" AcceptedAnswerId="19210" CreationDate="2017-02-28T16:40:22.343" Score="1" ViewCount="333" Body="&lt;p&gt;I am junior web developer I am setting up my first website with Craft CMS. I have been getting the &quot;Service Unavailable&quot; error message on my site every time I try to enter not logged in as admin. I've done some searches on this StackExchange site and tried setting again the permissions for &lt;code&gt;craft/app/&lt;/code&gt;, &lt;code&gt;craft/config/&lt;/code&gt;, and &lt;code&gt;craft/storage/&lt;/code&gt; as told in the installation docs, but didn't work. I've also tried modifying the &lt;code&gt;.htaccess&lt;/code&gt; as told in other thread, but still didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be very appreciated. And forgive my ignorance since I'm very new to this CMS :D.&lt;/p&gt;&#xA;" OwnerUserId="6352" LastEditorUserId="57" LastEditDate="2017-02-28T19:10:20.407" LastActivityDate="2017-02-28T19:10:20.407" Title="“Service Unavailable” message when not logged as admin" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19210" PostTypeId="2" ParentId="19209" CreationDate="2017-02-28T16:52:01.337" Score="2" Body="&lt;p&gt;Make sure your site is enabled under Settings ➞ General ➞ System Status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, check your craft.log files under &lt;code&gt;/craft/storage/runtime/logs/craft.log&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1150" LastActivityDate="2017-02-28T16:52:01.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19212" PostTypeId="2" ParentId="19164" CreationDate="2017-02-28T21:19:26.597" Score="2" Body="&lt;p&gt;This code works - I double checked. I had a bug further down in my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}&#xA;&#xA;{% set upcomingEvents = craft.entries&#xA;  .section('schedule')&#xA;  .order('eventStartDate asc')&#xA;  .eventStartDate('&amp;gt; ' ~ fwd )&#xA;  .limit(5)&#xA;  .status('live, pending')&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-02-28T21:19:26.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19213" PostTypeId="1" AcceptedAnswerId="19230" CreationDate="2017-03-01T01:50:12.033" Score="1" ViewCount="272" Body="&lt;p&gt;So I've got a Matrix block that is pulling in some entries and I'm looping through the entries in that block in a template. I'm then pulling a text field from each entry and putting it onto a page. Currently, there are three total entries in that block (though that will likely expand over time). Once I hit the third and final entry, I would like the loop to start over again at the first, loop through the entries again until it gets to the last entry and start over again. I'd like to do that continuously up to a point - say 15 loops. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling with how to get the entry loop to start over once it reaches the last entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the current basic code that loops through the entries and then loops through the matrix blocks within the entries to output the text to pull into the page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in block.homeClientQuote %}                                &#xA;    &amp;lt;div&amp;gt;&#xA;        {% for block in entry.clientQuote %}&#xA;            {{ block.actualClientQuote }}&#xA;        {% endfor %} &#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="57" LastEditDate="2017-03-01T20:26:10.830" LastActivityDate="2017-03-01T20:26:10.830" Title="How Do I Restart an Entries Loop Once It Hits the Last Entry" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19215" PostTypeId="1" AcceptedAnswerId="19247" CreationDate="2017-03-01T03:19:41.510" Score="4" ViewCount="3811" Body="&lt;p&gt;This seems like an odd question, but I've looked through the documentation, Slack, and the StackExchange and it's weird that I'm not seeing anything... so I feel like I'm overcomplicating it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you set a Single (or anything for that matter) to be the homepage of a Craft 3 site? In Craft 2 there was the &quot;This is for the homepage&quot; option, but I don't see that in Craft 3. Is that because it hasn't been implemented yet or is there a new best practice for doing this? Is this going to be something added into &lt;code&gt;Setting &amp;gt; Sites&lt;/code&gt; section?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2017-06-12T06:01:23.310" Title="Setting the Homepage URL in Craft 3" Tags="&lt;siteurl&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19216" PostTypeId="2" ParentId="8283" CreationDate="2017-03-01T05:34:26.587" Score="0" Body="&lt;p&gt;You can also use a front-end form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;globals/saveContent&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;setId&quot; value=&quot;123&quot;&amp;gt; &#xA;  &amp;lt;input type=&quot;text&quot; name=&quot;fields[fieldname]&quot; value=&quot;{{globalsetslug.fieldname}}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;text&quot; name=&quot;fields[anotherfieldname]&quot; value=&quot;{{globalsetslug.anotherfieldname}}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Save globals&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you need to replace &lt;code&gt;123&lt;/code&gt; by your globals set id and &lt;code&gt;globalsetslug&lt;/code&gt; by your globals set slug. You are not required to include all globals set fields in your form, Craft will save only those inside the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's an old post, but perhaps this will help others!&lt;/p&gt;&#xA;" OwnerUserId="3499" LastActivityDate="2017-03-01T05:34:26.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19218" PostTypeId="2" ParentId="19205" CreationDate="2017-03-01T09:16:30.893" Score="2" Body="&lt;p&gt;Other that the actual usability considerations for admins, the other advantage of creating a separate section for Firmware would be that your Firmware entries, unlike assets, come with all the extra properties of entries like Author, Slug, Post Date, Expiration Date, and status. If entries have their own URLs, you can also use the live preview feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you're relating file assets to Firmware entries, you would be able to swap out assets easily if you needed to replace one. Otherwise, if all the metadata was contained in just asset fields, you would have to copy and paste or re-enter all that info from the old asset into the new one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to connect only some of the metadata to an asset tho, like say the version or region. That might make actually make it easier for admins to find the right asset in a sea of files names.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-03-01T09:16:30.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19219" PostTypeId="2" ParentId="19187" CreationDate="2017-03-01T09:52:58.160" Score="1" Body="&lt;p&gt;I'm not sure this would create much overhead, but everyone's setup is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this test. Enable &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dev Mode&lt;/a&gt;, and create a test template with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in craft.sections.getAllSections() %}&#xA;    {{ section.name }}: {{ section.getUrlFormat() }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then load this up in a browser and look at the &lt;a href=&quot;https://developers.google.com/web/tools/chrome-devtools/console/&quot; rel=&quot;nofollow noreferrer&quot;&gt;JavaScript console&lt;/a&gt;. You should see entries starting with &quot;Profiling Summary Report&quot; that will list execution time, memory and total queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running this code locally on the &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager demo site&lt;/a&gt;, I get these results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Profiling Summary Report&#xA;  Time:   0.30656s&#xA;  Memory: 10,799Kb&#xA;  Total Queries: 19&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-03-01T09:52:58.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19220" PostTypeId="1" CreationDate="2017-03-01T10:01:45.347" Score="1" ViewCount="234" Body="&lt;p&gt;Given an image uploaded to Craft, I am wondering if there is a plug-in or a native method to detect the dominant color of said image.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2017-03-01T12:48:01.990" Title="Is there a way to calculate the dominant color from an asset available in Craft?" Tags="&lt;assets&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19221" PostTypeId="1" CreationDate="2017-03-01T11:28:24.437" Score="2" ViewCount="718" Body="&lt;p&gt;Some similar posts on here already but I'm still struggling. My code looks fine as far as I can tell? Page just reloads with no changes to the email (other fields change fine). I'm missing something right?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; class=&quot;js-validate&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.url ~ '/saved' }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;password&quot; value=&quot;{{ currentUser.password }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;h1&amp;gt;{{ &quot;My Profile&quot;|translate }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;ol&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;label for=&quot;firstName&quot; class=&quot;hidden&quot;&amp;gt;{{ &quot;First Name&quot;|translate }}&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;firstName&quot; id=&quot;firstName&quot; placeholder=&quot;{{ &quot;First Name&quot;|translate }}&quot; value=&quot;{{ currentUser.firstName }}&quot; required&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;label for=&quot;lastName&quot; class=&quot;hidden&quot;&amp;gt;{{ &quot;Last Name&quot;|translate }}&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;lastName&quot; id=&quot;lastName&quot; placeholder=&quot;{{ &quot;Last Name&quot;|translate }}&quot; value=&quot;{{ currentUser.lastName }}&quot; required&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        {% if currentUser.unverifiedEmail %}&#xA;            &amp;lt;div class=&quot;well&quot;&amp;gt;&#xA;                &amp;lt;h5&amp;gt;{{ &quot;Email verification pending&quot;|translate }}&amp;lt;/h5&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ &quot;We sent a verification email to&quot;|translate }} &amp;lt;a href=&quot;{{ currentUser.unverifiedEmail }}&quot;&amp;gt;{{ currentUser.unverifiedEmail }}&amp;lt;/a&amp;gt;. {{ &quot;Until this email is verified, we’ll continue to use your previous email&quot;|translate }} (&amp;lt;a href=&quot;{{ currentUser.email }}&quot;&amp;gt;{{ currentUser.email }}&amp;lt;/a&amp;gt;).&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;label for=&quot;email&quot; class=&quot;hidden&quot;&amp;gt;Email&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;email&quot; name=&quot;email&quot; id=&quot;email&quot; placeholder=&quot;{{ &quot;Email&quot;|translate }}&quot; value=&quot;{{ currentUser.email }}&quot; required&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;label for=&quot;userTownCity&quot; class=&quot;hidden&quot;&amp;gt;{{ &quot;Town/City&quot;|translate }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[userTownCity]&quot; id=&quot;userTownCity&quot; placeholder=&quot;{{ &quot;Town/City&quot;|translate }}&quot; value=&quot;{{ currentUser.userTownCity }}&quot;&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;label for=&quot;userPhoneNumber&quot; class=&quot;hidden&quot;&amp;gt;{{ &quot;Phone Number&quot;|translate }}&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[userPhoneNumber]&quot; id=&quot;userPhoneNumber&quot; placeholder=&quot;{{ &quot;Phone Number&quot;|translate }}&quot; value=&quot;{{ currentUser.userPhoneNumber }}&quot;&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/ol&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Save Changes&quot; class=&quot;button button--fw&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-01T14:21:30.287" Title="Change email address on front end" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19222" PostTypeId="2" ParentId="19220" CreationDate="2017-03-01T12:48:01.990" Score="1" Body="&lt;p&gt;Apparently there's a pretty good plugin that does the trick:&#xA;&quot;Image Color&quot; by Keith Mancuso&#xA;&lt;a href=&quot;https://github.com/familiar-studio/Craft-Image-Color&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/familiar-studio/Craft-Image-Color&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2017-03-01T12:48:01.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19223" PostTypeId="2" ParentId="19221" CreationDate="2017-03-01T14:21:30.287" Score="4" Body="&lt;p&gt;Thanks to billythekid's suggestion, adding a password field creates an elevated session, and solves my problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;Password&quot; required&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually I don't think it's that intrusive, and it's a good security step that should generally be encouraged when making any profile edits.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-01T14:21:30.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19224" PostTypeId="2" ParentId="19194" CreationDate="2017-03-01T14:44:44.333" Score="1" Body="&lt;p&gt;I forgot about the related entries.  So, I actually want to pull the related &lt;code&gt;countries&lt;/code&gt; from the &lt;code&gt;**entries**&lt;/code&gt; related to the &lt;code&gt;market&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the solution.  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15257/show-all-tags-related-to-a-category&quot;&gt;The key was the answer to this related question about related tags.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).find() %}&lt;/code&gt;&#xA;&lt;code&gt;{% set nation = craft.categories.group('country').relatedTo(entries).find()%}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-03-01T14:44:44.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19225" PostTypeId="1" CreationDate="2017-03-01T16:06:05.930" Score="1" ViewCount="92" Body="&lt;p&gt;I wish to have a custom fieldtype which contains the standard datetime field abilities along with storing an extra piece of data. I have created a custom fieldtype for this with a mixed attributetype to store the data as JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am having problems when I try to query some of the data from the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example to pull out a specific piece of data I am currently doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;variableName.date&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This correctly pulls out the date I have stored. However when using this in the example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({ type: 'sectionName', customFieldtype.date: '&amp;gt;=' ~ now|date(c) }).order('customFieldtype.date asc').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get errors as when Craft converts this to SQL it's converting these to column names and customFieldtype.date doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way around this bar having to re-create the built in craft entries calls in pure SQL?&lt;/p&gt;&#xA;" OwnerUserId="6356" LastEditorUserId="57" LastEditDate="2017-05-02T21:16:01.653" LastActivityDate="2017-05-02T21:16:01.653" Title="Using data within a mixed attribute type to query Craft entries dates" Tags="&lt;datetime&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19226" PostTypeId="1" AcceptedAnswerId="19234" CreationDate="2017-03-01T16:34:30.850" Score="2" ViewCount="509" Body="&lt;p&gt;I have a plain text field that encourages content editors to write a more detailed description of a piece of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on the front-end the template will use the post title by default if this is not supplied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the placeholder text for this optional plain text field to represent the reality of this in the Dashboard - i.e. to display the title field as the placeholder if the field has not otherwise been used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When editing the field, I have tried setting the 'Placeholder Text' as &lt;code&gt;{title}&lt;/code&gt;, but this does not work - it displays &quot;{title}&quot;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I don't want to create a new custom type of field as it seems a little heavy handed for this use case.&lt;/p&gt;&#xA;" OwnerUserId="4208" LastActivityDate="2017-03-01T20:21:19.780" Title="Dynamic placeholder text in 'Plain text' field type" Tags="&lt;fieldtypes&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19227" PostTypeId="1" CreationDate="2017-03-01T17:39:40.147" Score="1" ViewCount="90" Body="&lt;p&gt;I have some user groups with different permission and I need to notify them by email when i switch them to another group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make it automatic by a plugin or via the code directly?&lt;/p&gt;&#xA;" OwnerUserId="6357" LastActivityDate="2017-03-01T18:11:04.043" Title="How to send email to user when we change his group?" Tags="&lt;emails&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19228" PostTypeId="2" ParentId="19227" CreationDate="2017-03-01T17:59:49.583" Score="1" Body="&lt;p&gt;With a plugin, you can tie into the &lt;code&gt;userGroups.onAssignUserToGroups&lt;/code&gt; event and send your update email directly with the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToGroups&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5126" LastEditorUserId="5126" LastEditDate="2017-03-01T18:11:04.043" LastActivityDate="2017-03-01T18:11:04.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19229" PostTypeId="2" ParentId="18017" CreationDate="2017-03-01T19:25:10.123" Score="2" Body="&lt;p&gt;Doesn't the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/expanded-singles&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expanded Singles&lt;/a&gt; plugin do what you're looking for? Best of luck.&lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2017-03-01T19:25:10.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19230" PostTypeId="2" ParentId="19213" CreationDate="2017-03-01T19:55:21.450" Score="2" Body="&lt;p&gt;You can repeat a loop with another &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here's a loop that repeats 15 times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in 1..15 %}&#xA;    Loop: {{ i }}&amp;lt;br&amp;gt;&#xA;    {% for entry in block.homeClientQuote %}&#xA;      ...&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use the &lt;code&gt;i&lt;/code&gt; variable if you need to change the output depending on the loop number.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if i &amp;gt; 10 %}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2017-03-01T20:01:10.307" LastActivityDate="2017-03-01T20:01:10.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19231" PostTypeId="1" CreationDate="2017-03-01T20:03:14.727" Score="0" ViewCount="67" Body="&lt;p&gt;This allows me to pull the related categories from a second category group for a given category.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).find() %}&#xA;{% set tags = craft.tags.relatedTo(entries).find() %}   &#xA;{% set markets = craft.categories.group('markets').relatedTo(entries).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BUT&lt;/strong&gt;, it pulls both the parent and descendant categories from markets.  And, some markets do not have descendants - so adding `.level(2) would not capture those that only have a level(1) assigned.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want to list only the last level assigned whether it is level(1) or level(2).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding &lt;code&gt;.last()&lt;/code&gt; but that generates a &lt;code&gt;CException&lt;/code&gt; error.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markets = craft.categories.group('markets').last().relatedTo(entries).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2017-03-01T20:14:26.877" LastActivityDate="2017-03-01T20:14:26.877" Title="How do I pull the last level of a category?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19232" PostTypeId="2" ParentId="19231" CreationDate="2017-03-01T20:13:34.050" Score="1" Body="&lt;p&gt;&lt;code&gt;.last&lt;/code&gt; is the opposite of &lt;code&gt;.first&lt;/code&gt;, meaning that you can only apply it at the &lt;em&gt;end&lt;/em&gt; of your query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markets = craft.categories.group('markets').relatedTo(entries).last() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And similar to &lt;code&gt;.first&lt;/code&gt;, the &lt;code&gt;.last&lt;/code&gt; method will only return a single Entry.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-01T20:13:34.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19233" PostTypeId="1" AcceptedAnswerId="19239" CreationDate="2017-03-01T20:16:37.183" Score="2" ViewCount="1302" Body="&lt;p&gt;I have a section called &quot;Events&quot; and an Entries field, we'll call &lt;code&gt;myEntriesField&lt;/code&gt; to select related entries from another channel called &quot;Exhibitors&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Events page, I need to display the related Exhibitors grouped by their categories. And if there are no related Exhibitors in said Event, I need to hide the surrounding html that displays the category title etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set theListings = entry.myEntriesField %}&#xA;&#xA;&#xA;&#xA;        {% set thisCategory = &#xA;             theListings.relatedTo(craft.categories.slug('the-category-i-need')) &#xA;        %}&#xA;&#xA;        {% if thisCategory | length %}&#xA;        &amp;lt;div class=&quot;section listings&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;Category Title&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;the-listings&quot;&amp;gt;&#xA;            {% for theEntry in thisCategory %}&#xA;                &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ theEntry.title }}&amp;lt;/h3&amp;gt;&#xA;                    ...more entry data stuff...&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&#xA;&#xA;&#xA;        {% set thisOtherCategory = &#xA;             theListings.relatedTo(craft.categories.slug('the-next-category-i-need')) &#xA;        %}&#xA;&#xA;        {% if thisOtherCategory | length %}&#xA;        &amp;lt;div class=&quot;section listings&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;Category Title&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;the-listings&quot;&amp;gt;&#xA;            {% for otherEntry in thisOtherCategory %}&#xA;                &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ otherEntry.title }}&amp;lt;/h3&amp;gt;&#xA;                    ...more entry data stuff...&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this displaying ALL Exhibitors, grouped by their categories, rather than just the related Exhibitors selected in the Event entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I am missing here?&lt;/p&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="2201" LastEditDate="2017-03-02T16:25:17.997" LastActivityDate="2017-03-03T00:08:29.030" Title="How can I filter selected/related entries by their categories?" Tags="&lt;categories&gt;&lt;conditional&gt;&lt;set&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19234" PostTypeId="2" ParentId="19226" CreationDate="2017-03-01T20:21:19.780" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;When editing the field, I have tried setting the 'Placeholder Text' as {title}, but this does not work - it displays &quot;{title}&quot;!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yeah, those placeholder text fields aren't dynamically parsed as Twig templates like others (Entry URL Format, etc.).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't want to create a new custom type of field as it seems a little heavy handed for this use case.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that's all that is coming to mind for me for this use-case.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-01T20:21:19.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19235" PostTypeId="1" AcceptedAnswerId="19237" CreationDate="2017-03-02T04:56:04.173" Score="2" ViewCount="1856" Body="&lt;p&gt;I discovered search engines found duplicate content on my domain due to URLs being output with &lt;code&gt;index.php?p=&lt;/code&gt; and &lt;code&gt;index.php&lt;/code&gt; in ADDITION to the clean URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/index.php?p=about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/index.php/about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And the first two requests with &lt;code&gt;index.php?p=&lt;/code&gt; and &lt;code&gt;index.php&lt;/code&gt; shouldn't exist. Only the last request with &lt;code&gt;domain.com/about&lt;/code&gt; should exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I found help removing &lt;code&gt;index.php&lt;/code&gt;, some URLs continue to include &lt;code&gt;?p=&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now I still have:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/?p=about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While all I want is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;domain.com/about&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note: This is happening to several pages and blog entries throughout the site. Not only URLs directed to &lt;code&gt;about&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How may I remove &lt;code&gt;?p=&lt;/code&gt; permanently from the remaining URLs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within .htaccess, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Remove index.php&#xA;    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC] # Don't mess with admin requests&#xA;    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within craft/config/general.php, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3735" LastActivityDate="2017-08-31T08:57:57.627" Title="How to remove index.php?p= permanently?" Tags="&lt;url&gt;&lt;config&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19236" PostTypeId="2" ParentId="18723" CreationDate="2017-03-02T05:32:52.097" Score="1" Body="&lt;p&gt;If I understand correctly, you want to show a list of entries that only match the entry type of &quot;My Type&quot; and group them together by date. A simplified list might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Jan 1, 2017&#xA;  entry 1&#xA;  entry 5&#xA;  entry 8&#xA;&#xA;Jan 4, 2017&#xA;  entry 2&#xA;  entry 4&#xA;  entry 11&#xA;&#xA;Jan 11, 2017&#xA;  entry 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, you'll have to specify the entry type with it's handle (camel case) like &quot;myType&quot; not &quot;My Type.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the example from Craft's docs on the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group filter&lt;/a&gt;, you would probably do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Get attempts entries matching entry type 'myType' #}&#xA;{% set attempts = craft.entries.section('attempts').type('myType').find() %}&#xA;&#xA;{# Group attempts by date #}&#xA;{% for date, attemptsByDate in attempts|group('attemptDate.day') %}&#xA;&#xA;  &amp;lt;h2&amp;gt;{{ date|date('M j, Y') }}&amp;lt;/h2&amp;gt;&#xA;&#xA;  {# loop thru the attempts grouped by date  #}&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for entry in attemptsByDate %}&#xA;      &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there were other entries that didn't match type 'myType' on another day, say Jan 3rd, you won't see Jan 3rd in the list at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not totally sure what you need to do with &lt;code&gt;{{ count }}&lt;/code&gt; and &lt;code&gt;{{ total }}&lt;/code&gt;, but hopefully this gets you on the right track.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2017-03-03T01:26:53.853" LastActivityDate="2017-03-03T01:26:53.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19237" PostTypeId="2" ParentId="19235" CreationDate="2017-03-02T05:53:58.257" Score="7" Body="&lt;p&gt;Taken from this answer on Stack Overflow: &#xA;&lt;a href=&quot;https://stackoverflow.com/a/1219119/1013978&quot;&gt;.htaccess mod_rewrite: rewriting querystring to path&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Remove index.php&#xA;    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC] # Don't mess with admin requests&#xA;    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]&#xA;&#xA;    # Remove ?p=&#xA;    RewriteCond %{THE_REQUEST} ^GET\ /\?(([^&amp;amp;\s]*&amp;amp;)*)p=([^&amp;amp;\s]+)&amp;amp;?([^\s]*)&#xA;    RewriteRule ^(.*)$ /%3?%1%4 [L,R=301]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This not only reformats &lt;code&gt;/?p=about&lt;/code&gt; as &lt;code&gt;/about&lt;/code&gt;, but it also preserves other parts of the query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;code&gt;/?p=about&amp;amp;tag=stuff&lt;/code&gt; and even &lt;code&gt;/?tag=stuff&amp;amp;p=about&lt;/code&gt; both redirect to &lt;code&gt;/about?tag=stuff&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-03-02T05:53:58.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19238" PostTypeId="1" AcceptedAnswerId="19249" CreationDate="2017-03-02T06:17:21.547" Score="2" ViewCount="885" Body="&lt;p&gt;I'm trying to build a &quot;send this page to a friend&quot; form in Freeform. My code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.freeform.form(&quot;emailToAFriend&quot;) %}&#xA;&#xA;{{ form.renderTag({returnUrl: &quot;contact/success&quot;}) }}&#xA;&#xA;    {% if form.hasErrors %}&#xA;        &amp;lt;div class=&quot;freeform-form-has-errors&quot;&amp;gt;&#xA;            {{ &quot;There was an error submitting this form&quot;|t }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% set recipientsName = form.get(&quot;recipientsName&quot;) %}&#xA;    {% set recipientsEmail = form.get(&quot;recipientsEmail&quot;) %}&#xA;    {% set yourName = form.get(&quot;yourName&quot;) %}&#xA;    {% set yourEmail = form.get(&quot;yourEmail&quot;) %}&#xA;    {% set sharedUrl = form.get(&quot;sharedUrl&quot;) %}&#xA;    {% set message = form.get(&quot;message&quot;) %}&#xA;&#xA;    &amp;lt;label&amp;gt;{{ yourName.label }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;{{ yourName.handle }}&quot; value=&quot;{{ yourName.value }}&quot; /&amp;gt;&#xA;    {{ yourName.renderErrors() }}&#xA;&#xA;    &amp;lt;label&amp;gt;Your Email Address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;yourEmail&quot; /&amp;gt;&#xA;    {{ form.get(&quot;yourEmail&quot;).renderErrors() }}&#xA;&#xA;    &amp;lt;label&amp;gt;{{ recipientsName.label }}&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;{{ recipientsName.handle }}&quot; value=&quot;{{ recipientsName.value }}&quot; /&amp;gt;&#xA;    {{ recipientsName.renderErrors() }}&#xA;&#xA;    &amp;lt;label&amp;gt;Their Email Address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input name=&quot;recipientsEmail&quot; /&amp;gt;&#xA;    {{ form.get(&quot;recipientsEmail&quot;).renderErrors() }}&#xA;&#xA;    {{ message.renderLabel() }}&#xA;    {{ message.renderInput() }}&#xA;    {{ message.renderErrors() }}&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&#xA;{{ form.renderClosingTag }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How could I get the field in &lt;code&gt;recipientsEmail&lt;/code&gt; to pass to that recipient and choose the template?&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="57" LastEditDate="2017-03-02T06:27:41.920" LastActivityDate="2017-03-02T20:36:29.387" Title="Send freeform email notification to manually entered recipient address" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19239" PostTypeId="2" ParentId="19233" CreationDate="2017-03-02T06:22:04.080" Score="3" Body="&lt;p&gt;Start by looping thru each category. Say, all categories in a category group called &quot;eventsCategories.&quot; Then find entries related to each category (if any).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# loop through each of the categories #}&#xA;{% for category in craft.categories.group('eventsCategories') %}&#xA;&#xA;  {# find the exhibitor entries that are related to both the Event entry and category #}&#xA;  {% set categoryListings = craft.entries({&#xA;    section: 'exhibitors',&#xA;    relatedTo: ['and',&#xA;      { sourceElement: entry, field: 'myEntriesField' },&#xA;      { targetElement: category, field: 'myCategoriesField' }&#xA;    ]&#xA;  }) %}&#xA;&#xA;  {# Only show this category if there were any related exhibitors #}&#xA;  {% if categoryListings|length %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for listing in categoryListings %}&#xA;      &amp;lt;h3&amp;gt;{{ listing.title}}&amp;lt;/h3&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="9" LastEditDate="2017-03-03T00:08:29.030" LastActivityDate="2017-03-03T00:08:29.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19240" PostTypeId="1" CreationDate="2017-03-02T07:45:08.920" Score="2" ViewCount="539" Body="&lt;p&gt;When there's two forms on a single page. (E.g Newsletter Sign up and Book a Tour) The submit button obviously validates both forms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I differentiate between them both and make them independent?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;newsletter&quot;, {&#xA;    id: &quot;form-newsletter&quot;&#xA;    }&#xA;}).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The other form is loaded into the page through a template via a custom field.&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-03-07T16:58:16.797" Title="Multiple forms on same page.. Solspace Freeform" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19241" PostTypeId="2" ParentId="19215" CreationDate="2017-03-02T09:05:58.383" Score="3" Body="&lt;p&gt;Have you tried changing the slug of the page to &quot;__home__&quot; (without quotes)?&lt;/p&gt;&#xA;" OwnerUserId="6363" LastActivityDate="2017-03-02T09:05:58.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19242" PostTypeId="1" AcceptedAnswerId="19243" CreationDate="2017-03-02T09:07:39.910" Score="1" ViewCount="126" Body="&lt;p&gt;I'm making my first Craft plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added custom fields to the right of an entry form with the &lt;code&gt;cp.entries.edit.right-pane&lt;/code&gt; hook (&quot;Share on..&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NTOY0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NTOY0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't seem to find how to 'transfer' these values to my own plugin and to save them in my own table. The return value of several events I tried (ex. entries.saveEntry) are most of the time an EntryModel which do not include my custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I guess making a custom fieldtype is a little overkill?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="6098" LastEditorUserId="57" LastEditDate="2017-03-02T18:48:43.953" LastActivityDate="2017-03-02T18:48:43.953" Title="How to submit custom fields that are added in the right pane to your plugin?" Tags="&lt;control-panel&gt;&lt;saveentry&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19243" PostTypeId="2" ParentId="19242" CreationDate="2017-03-02T09:39:51.947" Score="2" Body="&lt;p&gt;I think I found the answer, correct me if I'm wrong but you can access your post data in your plugin with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('fields')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is the recommended way.&lt;/p&gt;&#xA;" OwnerUserId="6098" LastActivityDate="2017-03-02T09:39:51.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19244" PostTypeId="1" CreationDate="2017-03-02T13:04:14.720" Score="0" ViewCount="69" Body="&lt;p&gt;I can't seem to update my local dev site Craft version (2.6.2789) to the latest 2.6.2964. I've followed the steps to update manually but it has no effect and still shows the v2.6.2789 in the footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to update?&lt;/p&gt;&#xA;" OwnerUserId="6364" LastActivityDate="2017-03-02T13:16:50.350" Title="Can't update from v2.6.2789 via manual update" Tags="&lt;updating&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19245" PostTypeId="2" ParentId="19244" CreationDate="2017-03-02T13:11:29.527" Score="2" Body="&lt;p&gt;Are you 100% sure you are updating the right website/folder and not looking at the wrong one? Are you sure you are using the newest version of craft to install and not your old download?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not the case. You could save your &lt;strong&gt;templates&lt;/strong&gt; folder, &lt;strong&gt;All the folders you made yourself in the public folder&lt;/strong&gt; and the &lt;strong&gt;plugins&lt;/strong&gt; folder if you have any installed and make a backup of your current database and install a new fresh version of craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then implement your saved files / database. Your database should be imported via the program or client you made your database in as this is not possible yet to do via the Craft admin panel. This is basically the same as a manual update.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-03-02T13:16:50.350" LastActivityDate="2017-03-02T13:16:50.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19247" PostTypeId="2" ParentId="19215" CreationDate="2017-03-02T13:26:11.137" Score="5" Body="&lt;p&gt;So it seems the way to do this is actually by leaving the slug blank. If you happen to look down on the section setup screen prior to naming your section you'll see it clearly: &lt;code&gt;Leave blank if this is the homepage.&lt;/code&gt; However since that field is automatically filled in with details from the Name/Handle fields I never actually saw the text by the time I was down there unless I completely cleared the field out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both fields need to remain empty from what I can tell, not just the slug.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2017-03-02T14:26:52.163" LastActivityDate="2017-03-02T14:26:52.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19248" PostTypeId="1" CreationDate="2017-03-02T14:27:42.350" Score="2" ViewCount="743" Body="&lt;p&gt;I created a plugin for Craft 3 at &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to call it in my template variable &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function exampleVariable()&#xA;{&#xA;&#xA;    // hint   AdminBar::$plugin-&amp;gt;editLinks-&amp;gt;exampleService()&#xA;    //$result = FacebookPageConnector::$plugin-&amp;gt;eventsService-&amp;gt;fetchEvents();&#xA;      $result =  FacebookPageConnector::$plugin-&amp;gt;facebookPageConnectorEventsService-&amp;gt;exampleService();&#xA;&#xA;    //$result = FacebookPageConnector::$plugin-&amp;gt;eventsService-&amp;gt;fetchEvents();&#xA;    return $result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But whatever I try to name my service, I get an exception like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Getting unknown property: boscho87fbconnector\facebookpageconnector\FacebookPageConnector::facebookPageConnectorEventsService&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What are the correct naming conventions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw an example here: &lt;a href=&quot;https://github.com/wbrowar/craft-3-adminbar/blob/master/src/services/EditLinks.php#L48&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/wbrowar/craft-3-adminbar/blob/master/src/services/EditLinks.php#L48&lt;/a&gt;,  but this did not work for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I call the predefined service from the pluginfactory: &lt;code&gt;FacebookPageConnector::$plugin-&amp;gt;facebookPageConnectorService-&amp;gt;exampleService()&lt;/code&gt;,  it works fine .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here images with my code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jgDFn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jgDFn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Du5xC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Du5xC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5735" LastEditorUserId="5735" LastEditDate="2017-03-04T08:17:54.300" LastActivityDate="2018-07-02T11:38:05.057" Title="Craft 3 Call Own Service" Tags="&lt;craft3&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19249" PostTypeId="2" ParentId="19238" CreationDate="2017-03-02T16:41:22.367" Score="2" Body="&lt;p&gt;The &lt;code&gt;recipientsEmail&lt;/code&gt; field should be an &lt;code&gt;Email&lt;/code&gt; fieldtype, and in Composer you need to set the notification template in the &lt;strong&gt;Field Property Editor&lt;/strong&gt; column (on right) for that field and it'll send an email to the email that is entered in that field when the form is submitted. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;View the documentation page here for more information about email notification options:&#xA;&lt;a href=&quot;https://solspace.com/craft/freeform/docs/email-notifications/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/email-notifications/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="4496" LastEditDate="2017-03-02T20:36:29.387" LastActivityDate="2017-03-02T20:36:29.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19250" PostTypeId="2" ParentId="19233" CreationDate="2017-03-02T18:58:32.990" Score="2" Body="&lt;p&gt;Craft’s &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;|group&lt;/code&gt;&lt;/a&gt; filter can be used here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m going to assume that the Categories custom field on your Exhibitor entries is called &lt;code&gt;myCategoriesField&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set groupedListings = entry.myEntriesField.find()|group('myCategoriesField.first.title')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will give you an array of grouped Exhibitor entries, grouped by their related category titles. For example, it might look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;[&#xA;    'Category A Title' =&amp;gt; [&#xA;        ExhibitorEntry1,&#xA;        ExhibitorEntry2&#xA;    'Category B Title' =&amp;gt; [&#xA;        ExhibitorEntry3,&#xA;        ExhibitorEntry4&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can loop through the grouped entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for categoryTitle, listings in groupedListings %}&#xA;    &amp;lt;div class=&quot;section listings&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ categoryTitle }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;div class=&quot;the-listings&quot;&amp;gt;&#xA;            {% for listing in listings %}&#xA;                &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ listing.title }}&amp;lt;/h3&amp;gt;&#xA;                    ...more entry data stuff...&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to sort the category titles alphabetically, it gets slightly more complicated, but still doable:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Get the list of category titles from the groupedListings keys, and sort them #}&#xA;{% set sortedCategoryTitles = groupedListings|keys|sort %}&#xA;&#xA;{# Loop through the sorted category titles #}&#xA;{% for categoryTitle in sortedCategoryTitles %}&#xA;&#xA;    {# Now get the listings for this category title from the groupedListings array #}&#xA;    {% set listings = groupedListings[categoryTitle] %}&#xA;&#xA;    {# Now display the category and its listings like normal... #}&#xA;    &amp;lt;div class=&quot;section listings&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ categoryTitle }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;div class=&quot;the-listings&quot;&amp;gt;&#xA;            {% for listing in listings %}&#xA;                &amp;lt;div class=&quot;item&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ listing.title }}&amp;lt;/h3&amp;gt;&#xA;                    ...more entry data stuff...&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-02T18:58:32.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19251" PostTypeId="2" ParentId="19248" CreationDate="2017-03-02T19:02:30.623" Score="1" Body="&lt;p&gt;It's hard to say for sure without seeing your plugin code, but my guess is you have a &lt;code&gt;myplugin\serivces\FacebookPageConnectorService.php&lt;/code&gt; file/class defined, but not a &lt;code&gt;myplugin\services\FacebookPageConnectorEventsService.php&lt;/code&gt; file/class defined.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-02T19:02:30.623" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19252" PostTypeId="1" AcceptedAnswerId="19264" CreationDate="2017-03-03T10:21:55.083" Score="1" ViewCount="468" Body="&lt;p&gt;When users upload assets to a Craft CMS site setup to use AWS, do the assets go directly to AWS or are they uploaded to the Craft server first? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I ask is I'm building an area where users upload potentially large files from the frontend, and it's quite likely a lot of users will choose to do it at the same time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the files are uploaded to the Craft server first, I might have to spec-up the server a bit more and would welcome any tips for helping Craft handle the multiple large uploads as efficiently as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the files are simply uploaded to AWS, I take it that means there will be little impact on the Craft server and I won't need to worry about any of this. Is that right?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2021-05-07T19:34:41.563" Title="How does Craft handle uploading assets to AWS?" Tags="&lt;upload&gt;&lt;aws&gt;&lt;amazon&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19253" PostTypeId="1" AcceptedAnswerId="19259" CreationDate="2017-03-03T10:27:55.267" Score="1" ViewCount="131" Body="&lt;p&gt;How can I be able to have a single section page (so that clients can't create another one of this) that only needs 1 index.html template across different languages AND be accessible through following different slugs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;x.dev/muziektoerisme&lt;/li&gt;&#xA;&lt;li&gt;x.dev/fr/tourisme-musical/&lt;/li&gt;&#xA;&lt;li&gt;x.dev/en/music-tourism/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I currently have a setup similar to this one: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1467/add-home-page-to-a-structure&quot;&gt;Add home page to a structure?&lt;/a&gt;, which is a structure section 'Pages' with my custom page entry type 'musictourism' under 'craft/templates/_pages/_types/' (so 'musictourism.html' sits in this folder)&#xA;This works great, except for the fact that users are able to recreate a page of this entry type, which I don't want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does my question make any sense? Or am I missing something fundamental here? :) I'm new to Craft by the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6360" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-03-03T12:53:23.783" Title="Possible to have a single entry page with multilingual slugs and only one index.html?" Tags="&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19254" PostTypeId="1" AcceptedAnswerId="19257" CreationDate="2017-03-03T10:57:47.880" Score="1" ViewCount="174" Body="&lt;p&gt;So I'm not sure this is possible with the entries search param but I'm trying to return entries where a field (rich text) has fewer than 200 characters. This is obviously horribly wrong but something like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    limit: 3, order: 'RAND()', search: 'quote:|length &amp;lt; 200', section: 'quotes'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-03T12:39:16.520" Title="Search/return entries with custom field length less than 200" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19255" PostTypeId="2" ParentId="19254" CreationDate="2017-03-03T11:31:03.643" Score="1" Body="&lt;p&gt;I'm not 100% sure what you are trying to achieve but If its because all the others would be to big for whatever you're building. You could use Hacksaw to fit all your text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ryanshrum/hacksaw&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ryanshrum/hacksaw&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-03T11:31:03.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19256" PostTypeId="1" AcceptedAnswerId="19258" CreationDate="2017-03-03T11:54:04.570" Score="2" ViewCount="1108" Body="&lt;p&gt;Been scratching my head for the past day on how to implement search with multiple categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I have product categories as a select dropdown which only allows to search in one category at a time. This is passing the value as a parameter. How do I go about searching with multiple categories (checkboxes) at once? Here's what I have so far. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;search.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('food-suppliers/results') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;query&quot; placeholder=&quot;What are you looking for?&quot; style=&quot;width: 100%;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;select name=&quot;supplier&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;&quot;&amp;gt;All Markets&amp;lt;/option&amp;gt;&#xA;      {% set suppliers = craft.categories.group('suppliers') %}&#xA;      {% for supplier in suppliers %}&#xA;      &amp;lt;option value=&quot;{{ supplier.slug }}&quot;&amp;gt;{{ supplier.title }}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;select name=&quot;product&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;&quot;&amp;gt;All Products&amp;lt;/option&amp;gt;&#xA;      {% set products = craft.categories.group('product') %}&#xA;      {% for product in products %}&#xA;      &amp;lt;option value=&quot;{{ product.slug }}&quot;&amp;gt;{{ product.title }}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;select name=&quot;delivery&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;&quot;&amp;gt;All Delivery&amp;lt;/option&amp;gt;&#xA;      {% set deliveries = craft.categories.group('delivery') %}&#xA;      {% for delivery in deliveries %}&#xA;      &amp;lt;option value=&quot;{{ delivery.slug }}&quot;&amp;gt;{{ delivery.title }}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;checkbox&quot; name=&quot;homeGrown&quot; value=&quot;true&quot;&amp;gt;Home Grown&amp;lt;br/&amp;gt;&#xA;      &amp;lt;input type=&quot;checkbox&quot; name=&quot;preparedProduce&quot; value=&quot;true&quot;&amp;gt;Prepared Produce&amp;lt;br/&amp;gt;&#xA;      &amp;lt;input type=&quot;checkbox&quot; name=&quot;redTractor&quot; value=&quot;true&quot;&amp;gt;Red Tractor&amp;lt;br/&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;results.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set supplier = craft.request.getParam('supplier') %}&#xA;{% set product = craft.request.getParam('product') %}&#xA;{% set delivery = craft.request.getParam('delivery') %}&#xA;&#xA;{% set homeGrownParam = craft.request.getParam('homeGrown') %}&#xA;{% set preparedProduceParam = craft.request.getParam('preparedProduce') %}&#xA;{% set redTractorParam = craft.request.getParam('redTractor') %}&#xA;&#xA;&#xA;{% set supplierCat = craft.categories.group('supplier').slug(supplier).first %}&#xA;{% set productCat = craft.categories.group('product').slug(product).first %}&#xA;{% set deliveryCat = craft.categories.group('delivery').slug(delivery).first %}&#xA;&#xA;&#xA;{% set supplierParam = supplier ? {targetElement: supplierCat} : '' %}&#xA;{% set productParam = product ? {targetElement: productCat} : '' %}&#xA;{% set deliveryParam = delivery ? {targetElement: deliveryCat} : '' %}&#xA;&#xA;&#xA;{% set entries = craft.entries.section('suppliers').relatedTo(productParam).relatedTo(deliveryParam).search(query).homeGrown(homeGrownParam).preparedProduce(preparedProduceParam).redTractor(redTractorParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4803" LastActivityDate="2018-11-06T00:56:26.063" Title="Advanced Search with tags and categories" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19257" PostTypeId="2" ParentId="19254" CreationDate="2017-03-03T12:39:16.520" Score="1" Body="&lt;p&gt;You should be able to do this by adding an additional &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse&lt;/a&gt; field to the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set the value of the field (call it &lt;code&gt;quoteLength&lt;/code&gt;) to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.quote | length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then search for all entries with a quote less than 200 characters using this search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    limit: 3, order: 'RAND()', quoteLength: '&amp;lt; 200', section: 'quotes'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-03-03T12:39:16.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19258" PostTypeId="2" ParentId="19256" CreationDate="2017-03-03T12:43:24.003" Score="3" Body="&lt;p&gt;Before I answer your main question, I'm seeing a couple issues with what you’re currently doing that are worth correcting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set supplierCat = craft.categories.group('supplier').slug(supplier).first %}&#xA;{% set productCat = craft.categories.group('product').slug(product).first %}&#xA;{% set deliveryCat = craft.categories.group('delivery').slug(delivery).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be replaced with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set supplierCat = supplier ? craft.categories.group('supplier').slug(supplier).first %}&#xA;{% set productCat = product ? craft.categories.group('product').slug(product).first %}&#xA;{% set deliveryCat = delivery ? craft.categories.group('delivery').slug(delivery).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in case any of the &lt;code&gt;supplier&lt;/code&gt;/&lt;code&gt;product&lt;/code&gt;/&lt;code&gt;delivery&lt;/code&gt; params are blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set supplierParam = supplier ? {targetElement: supplierCat} : '' %}&#xA;{% set productParam = product ? {targetElement: productCat} : '' %}&#xA;{% set deliveryParam = delivery ? {targetElement: deliveryCat} : '' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be replaced with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set supplierParam = supplierCat ? {targetElement: supplierCat} %}&#xA;{% set productParam = productCat ? {targetElement: productCat} %}&#xA;{% set deliveryParam = deliveryCat ? {targetElement: deliveryCat} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way you will avoid unexpected behavior if a supplier/product/delivery was &lt;em&gt;posted&lt;/em&gt;, but it had an invalid slug, and yielded no results. Also, the &lt;code&gt;: ''&lt;/code&gt;s at the end are just not really necessary unless your &lt;em&gt;really&lt;/em&gt; wanted them to be strings by default (no reason in this case though), as Twig will default the values to &lt;code&gt;null&lt;/code&gt;, which is just as good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can’t chain multiple &lt;code&gt;relatedTo&lt;/code&gt; params together like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;.relatedTo(productParam).relatedTo(deliveryParam)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you do that, the second &lt;code&gt;relatedTo&lt;/code&gt; param will just override the 1st one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you’d need to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set relationParams = [supplierParam, productParam, deliveryParam]|filter %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'suppliers',&#xA;    relatedTo: relationParams ? ['and']|merge(relationParams) : null,&#xA;    search: query,&#xA;    homeGrown: homeGrownParam,&#xA;    preparedProduce: preparedProduceParam,&#xA;    redTractor: redTractorParam&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(I’m using the &lt;code&gt;{p1: v1, p2: v2}&lt;/code&gt; syntax for setting the criteria params here for clarity, but you can use the &lt;code&gt;p1(v1).p2(v2)&lt;/code&gt; chaining syntax instead if you prefer it.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With that out of the way…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To support searching for entries that are related to &lt;em&gt;multiple&lt;/em&gt; suppliers/products/deliveries at the same time, the first thing you’ll need to do is update your search form. I know you said you want to go with checkboxes, but for simplicity’s sake I’ll demonstrate with multi-select boxes, since that’s closer to your original code and produces the same request param data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each of your &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt;s, just append a &lt;code&gt;[]&lt;/code&gt; to the input name and add the &lt;code&gt;multiple&lt;/code&gt; attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;select name=&quot;supplier[]&quot; multiple&amp;gt;&#xA;...&#xA;&amp;lt;select name=&quot;product[]&quot; multiple&amp;gt;&#xA;...&#xA;&amp;lt;select name=&quot;delivery[]&quot; multiple&amp;gt;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your search results template, change &lt;code&gt;.first&lt;/code&gt; to &lt;code&gt;.find()&lt;/code&gt; when fetching the categories:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set supplierCat = supplier ? craft.categories.group('supplier').slug(supplier).find() %}&#xA;{% set productCat = product ? craft.categories.group('product').slug(product).find() %}&#xA;{% set deliveryCat = delivery ? craft.categories.group('delivery').slug(delivery).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And assuming you want this to be an &lt;em&gt;inclusive&lt;/em&gt; search (where only results with &lt;em&gt;all&lt;/em&gt; of the selected suppliers should be included, etc.), you’ll need to prepend &lt;code&gt;'and'&lt;/code&gt; to each of the &lt;code&gt;targetElement&lt;/code&gt; arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set supplierParam = supplierCat ? {targetElement: ['and']|merge(supplierCat)}l %}&#xA;{% set productParam = productCat ? {targetElement: ['and']|merge(productCat)} %}&#xA;{% set deliveryParam = deliveryCat ? {targetElement: ['and']|merge(deliveryCat)} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That’s it. The rest can stay the same.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-03-03T17:30:32.170" LastActivityDate="2017-03-03T17:30:32.170" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19259" PostTypeId="2" ParentId="19253" CreationDate="2017-03-03T12:53:23.783" Score="1" Body="&lt;p&gt;What you're asking for is fine. Create a subfolder within your public directory for each locale with it's own index.php and define the new path to craft/ and the locale. For example, within public_html/fr/index.php you might have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the FRENCH content&#xA;define('CRAFT_LOCALE', 'fr');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the single, you set the slug yourself within the section's settings (one slug for each locale that section is available to).&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-03-03T12:53:23.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19260" PostTypeId="2" ParentId="19225" CreationDate="2017-03-03T14:01:41.197" Score="2" Body="&lt;p&gt;Just in case anyone else comes across this problem in the future I actually managed to figure it out myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created kept the fieldtype as a DateTime field and grabbed the date/time and the extra value within the prepValueFromPost function then pushed the extra data into a custom table and post just the datetime to the craft_contents table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then within the getInputHtml function I grabbed the extra data from the custom table to display along with the date/time.&lt;/p&gt;&#xA;" OwnerUserId="6356" LastActivityDate="2017-03-03T14:01:41.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19261" PostTypeId="1" AcceptedAnswerId="19262" CreationDate="2017-03-03T16:07:10.000" Score="1" ViewCount="52" Body="&lt;p&gt;There are a few hundred form entries and manually going into each one and deleting sounds like far too much work!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guess i could delete each form (there are 5) which would delete each form submisson. Then recreate the form again. Any other ideas? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3489" LastActivityDate="2017-03-03T16:23:39.890" Title="Best way to delete submitted data in Sprout Forms?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19262" PostTypeId="2" ParentId="19261" CreationDate="2017-03-03T16:23:39.890" Score="3" Body="&lt;p&gt;Click the checkbox at the top to select all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h2SFB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h2SFB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-03-03T16:23:39.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19263" PostTypeId="1" AcceptedAnswerId="19269" CreationDate="2017-03-03T17:39:50.107" Score="0" ViewCount="116" Body="&lt;p&gt;So I have the switch for &lt;em&gt;Enable entries by Default&lt;/em&gt; set to OFF for &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries&lt;/a&gt; and a channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this &lt;code&gt;value=&quot;1&quot;&lt;/code&gt; for input field &lt;code&gt;name=&quot;enabled&quot;&lt;/code&gt; on Guest Entry submission I always get entry &lt;strong&gt;not updated&lt;/strong&gt; in corresponding field with desired value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Enable entry #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think the channel switch for &lt;em&gt;Enable entries by default&lt;/em&gt; should be on as guest entries doesn't have control over that?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="57" LastEditDate="2017-03-03T18:07:11.500" LastActivityDate="2017-03-04T00:00:11.920" Title="Can entries disabled by default in Guest Entries plugin and in section be enabled from the front-end?" Tags="&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19264" PostTypeId="2" ParentId="19252" CreationDate="2017-03-03T18:04:29.443" Score="3" Body="&lt;p&gt;They are uploaded to Craft first to a temporary file, then Assets uses the Asset Source to work out where to send them next - either the local file system or a remote one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For handling large uploads in general you could look at this plugin: &lt;a href=&quot;https://superbig.co/plugins/large-upload&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/large-upload&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="57" LastEditDate="2017-03-03T18:07:55.587" LastActivityDate="2017-03-03T18:07:55.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19265" PostTypeId="1" CreationDate="2017-03-03T19:44:30.560" Score="1" ViewCount="94" Body="&lt;p&gt;I've coded up conditional for categories. I'm still new to Twig and curious if there is a simpler way of coding the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for feedItems in craft.entries.section('news').limit(null).offset(1).find() %}&#xA;&#xA;{% set parent = craft.categories.slug('parent-category').first() %}&#xA;{% set child = feedItems.generalCats.descendantOf(parent).level(2) %}&#xA;&#xA;{% set parentLvl = feedItems.generalCats.level(1).find() %}&#xA;{% set childLvl = feedItems.generalCats.level(2) %}&#xA;&#xA;{% if childLvl | length %}&#xA;    {% for category in child.limit(1) %}&#xA;        {% if child.count() &amp;gt; 1 %}&#xA;            &amp;lt;a href=&quot;{{ parent.url }}&quot;&amp;gt;{{ parent.title }}&amp;lt;/a&amp;gt;&#xA;        {% else %}&#xA;            &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ parent.title }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    {% else %}&#xA;    {% for category in parentLvl %}&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.url }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is currently outputting the child category if there isn’t more than one child cat selected. &#xA;If there is more than 1 child cat selected it outputs the parent category. &#xA;If any of the former is false (no children or parent) it outputs one of the other 1st lvl cats (doesn’t have children)&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2017-03-03T19:44:30.560" Title="Simpler way to code up a category conditional?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;conditional&gt;&lt;category&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19266" PostTypeId="1" AcceptedAnswerId="19270" CreationDate="2017-03-03T20:35:31.727" Score="1" ViewCount="299" Body="&lt;p&gt;I am coming from a .NET/C# authentication and session environment.  I have used &lt;code&gt;{% requireLogin %}&lt;/code&gt; to create a secure area on the front-end of my website, but it seems that the login credential (or cookie) stays persistent after the browser is closed.  There does seem to be time factor as the next day a login is required, but the same day after a somewhat short period with the browser being closed I can relaunch the browser and I have full access to the secure areas and the system knows my user account, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for some direction to explain the Craft security and cookie lifespan in more detail.&lt;/p&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="57" LastEditDate="2017-03-04T00:01:28.323" LastActivityDate="2017-03-04T00:09:20.280" Title="Looking for a good explanation on Craft login and if it is using persistent cookies or session cookies, etc...?" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19267" PostTypeId="1" AcceptedAnswerId="19268" CreationDate="2017-03-03T20:50:40.220" Score="1" ViewCount="97" Body="&lt;p&gt;So I just installed the GuestEntries Plugin. &#xA;Whenever I submit the form, I get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;POST param “sectionId” doesn’t exist&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;opiniones&quot; value=&quot;3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;body&quot;&amp;gt;Body&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;body&quot; name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-opiniones is the section id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Have the section allowed for guest posts, with a user selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Only other plugin Im using is the contact form 1.81&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-running Craft CMS 2.6.2964 Personal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any one can give me hand.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="4929" LastActivityDate="2017-03-04T05:04:37.127" Title="GuestEntries plugin problem." Tags="&lt;plugins&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19268" PostTypeId="2" ParentId="19267" CreationDate="2017-03-03T23:34:27.737" Score="2" Body="&lt;p&gt;The plugin is expecting the POST parameter to be &lt;code&gt;sectionId&lt;/code&gt; rather than &lt;code&gt;opiniones&lt;/code&gt;. Changing the &lt;code&gt;name&lt;/code&gt; attribute on that hidden input to &lt;code&gt;sectionId&lt;/code&gt; should fix your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other requirements when creating entries from front-end template using &lt;em&gt;Guest Entries&lt;/em&gt; are outlined below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure &lt;em&gt;Allow guest submissions?&lt;/em&gt; is checked in the plugin’s settings (example.com/admin/settings/plugins/guestentries) and set a default author for the section entries will be saved to.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value for &lt;code&gt;sectionId&lt;/code&gt; can be determined by going to section settings in the control panel (example.com/admin/settings/sections) and clicking the name of the section you want to use &lt;em&gt;Guest Entries&lt;/em&gt; with. The section’s ID is the last segment of the URL (e.g example.com/admin/settings/sections/3)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value for &lt;code&gt;redirect&lt;/code&gt; is where a visitor will be redirected upon a successful submission and should be a valid path or URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A form field should be added for each field you want to save content to. Be sure to include any fields marked required on the entry type’s settings page (example.com/admin/settings/sections/3/entrytypes/3).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;title&lt;/code&gt; will always be the value for the name attribute for the entry’s title regardless of what &lt;em&gt;Title Field Label&lt;/em&gt; is set to for the entry type in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Custom fields will use &lt;code&gt;fields[customFieldHandle]&lt;/code&gt; as the value for the name attribute.&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="93" LastEditDate="2017-03-04T05:04:37.127" LastActivityDate="2017-03-04T05:04:37.127" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19269" PostTypeId="2" ParentId="19263" CreationDate="2017-03-04T00:00:11.920" Score="1" Body="&lt;p&gt;Currently, that won't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Guest Entries plugin looks at the plugin's setting for whether that entry should be enabled for the given section or not, not anything from $_POST.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/guestentries/controllers/GuestEntriesController.php#L227&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/GuestEntries/blob/master/guestentries/controllers/GuestEntriesController.php#L227&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-04T00:00:11.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19270" PostTypeId="2" ParentId="19266" CreationDate="2017-03-04T00:09:20.280" Score="0" Body="&lt;p&gt;You're probably looking for the &lt;a href=&quot;https://craftcms.com/docs/config-settings#userSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;userSessionDuration&lt;/code&gt;&lt;/a&gt; config setting where you can adjust the length of time an authenticated Craft session should have (or just have it session/browser based).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other related session config settings you might be interested in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#elevatedSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#elevatedSessionDuration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#rememberedUserSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#rememberedUserSessionDuration&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-04T00:09:20.280" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19271" PostTypeId="1" CreationDate="2017-03-04T03:28:45.767" Score="0" ViewCount="43" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this scenario, a main product has multiple accessories (which are, of course, related to the main product through relationships). Only certain accessories are related to the main product. The user can place main products and unrelated accessories into the cart. I'd like to display a warning that they are ordering incompatible items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that you can use &lt;code&gt;empty&lt;/code&gt; or &lt;code&gt;relatedTo&lt;/code&gt; to find out if a relationship exists between entries but in this case, I need to know if accessories unrelated to the main product are in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-03-09T23:41:37.843" Title="Verify if unrelated items are in the cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19272" PostTypeId="1" AcceptedAnswerId="19285" CreationDate="2017-03-04T16:17:51.683" Score="1" ViewCount="1114" Body="&lt;p&gt;This is probably a very naive question but I am brand new to Craft and as such, have no idea what to research and where...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a static website that is built with my own bespoke framework. We have recently decided to add a 'blog' page to this website and resultantly, I am exploring using Craft in order to save me time writing a bespoke solution from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can see, Craft is extremely flexible and brilliant for professional developers like myself who refuse to work with the likes of WordPress. However, implementing into my framework may just be a step too far in regards to flexibility. Quite simply, I would like to know the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does craft allow me to make calls to get the stored data and then I manually handle the inserting of this data? e.g. Something like: &lt;code&gt;$blog_posts = $craft-&amp;gt;getBlogPosts()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;If not, is there a way to include certain files at the beginning and end of templates that are outside the craft directory?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Basically, one of the key features of my framework is to handle the generation of all of the JavaScript and CSS links, along with the &lt;code&gt;head&lt;/code&gt; section of each of the pages throughout my site. Based on what I have tested, I have managed to get the header working by just adding a PHP 'include' above the craft code in my file, however, the footer (including javascript) does not work because the Craft obviously has some sort of 'exit' call to prevent the code from executing further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Define any custom javascript files and css files to be included in the cache&#xA;//...&#xA;&#xA;// Generate the document header&#xA;include($_PATHS['CURRENT'].'/_includes/_content/header.php');&#xA;&#xA;/*&#xA; * Craft CMS Code to load the blog template&#xA; */&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = './_craft/';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&#xA;/*&#xA; * End of Craft CMS Code&#xA; */&#xA;&#xA;// THIS DOES NOT WORK&#xA;// Generate the document footer&#xA;include($_PATHS['CURRENT'].'/_includes/_content/footer.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6372" LastEditorUserId="142" LastEditDate="2017-03-06T12:18:39.100" LastActivityDate="2017-03-06T12:20:12.523" Title="Use pure PHP and HTML instead of Templates" Tags="&lt;templating&gt;&lt;php&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19273" PostTypeId="1" AcceptedAnswerId="19276" CreationDate="2017-03-04T19:23:58.270" Score="3" ViewCount="1358" Body="&lt;p&gt;I'm using Craft as the backend for an app and VueJS along with Element API to deliver the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything so far is working sweet, except when I try to pull up the detail page for an entry because in Craft, the route doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, my main listing page and links work but if I try to visit &lt;code&gt;http://localhost/slug/id&lt;/code&gt; directly, I get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know within the context of something like Laravel, I could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Route::any('{all}', function () {&#xA;    return view('index');&#xA;})&#xA;-&amp;gt;where(['all' =&amp;gt; '.*']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something similar I could do with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add I have user registration and aspects that vue can't handle because Craft doesn't have a full crud api.&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2017-03-04T19:45:33.600" LastActivityDate="2019-08-12T07:21:45.717" Title="Routing within a single page app integration" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19274" PostTypeId="1" AcceptedAnswerId="19349" CreationDate="2017-03-04T20:23:11.780" Score="0" ViewCount="799" Body="&lt;p&gt;I've tried to apply eager loading per Craft's docs, but it doesn't seem to work. When I do this, will I have access to all the entry fields? If not, do I have to include all the fields I want in the with attribute?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').with['image'] %}&#xA;  {% set image = entry.image[0] ?? null %}&#xA;  {% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;  {% endif %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I tried it, the code barfed when trying to output {{ entry.title }}.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2017-10-02T04:35:35.473" Title="Trouble understanding eager loading" Tags="&lt;entries&gt;&lt;assets&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19275" PostTypeId="1" CreationDate="2017-03-05T09:20:21.627" Score="2" ViewCount="2335" Body="&lt;p&gt;I'm getting this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined index: releaseDate in craft/app/etc/behaviors/AppBehavior.php(500)&#xA;&#xA;Line 500: $row['releaseDate'] = DateTime::createFromString($row['releaseDate'], null, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to fix this?&lt;/p&gt;&#xA;" OwnerUserId="6364" LastEditorUserId="57" LastEditDate="2018-02-12T21:49:15.090" LastActivityDate="2018-02-12T21:49:15.090" Title="How do I fix PHP Notice - Undefined index: releaseDate?" Tags="&lt;php&gt;&lt;admin&gt;&lt;updating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19276" PostTypeId="2" ParentId="19273" CreationDate="2017-03-05T14:04:47.043" Score="7" Body="&lt;p&gt;To pull this off, first you’ll have to make sure all of your Element API endpoints begin with something consistent, like &lt;code&gt;api/&lt;/code&gt; or &lt;code&gt;data/&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a route in &lt;code&gt;craft/config/routes.php&lt;/code&gt; that will match everything besides those Element API endpoints:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    '(?!api\/).*' =&amp;gt; 'index'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'index&lt;/code&gt;' is the template path the requests should be routed to, so tweak that if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any other routes defined in there, make sure they go before this one.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I should add I have user registration and aspects that vue can't handle because Craft doesn't have a full crud api.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can use the same controller actions the Control Panel uses. There are a few examples, including &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;user registration&lt;/a&gt; at the bottom of the templating docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to keep these handled by custom pages, you’ll need to add routes for them in &lt;code&gt;routes.php&lt;/code&gt;, or else they will stop working due to that new catchall route. Craft only attempts its default behavior of matching the URI to a public template as a last resort; if a route matches the URI, that route will take precedence.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-04-14T13:11:26.540" LastActivityDate="2017-04-14T13:11:26.540" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="19277" PostTypeId="1" AcceptedAnswerId="19290" CreationDate="2017-03-05T15:38:13.963" Score="1" ViewCount="250" Body="&lt;p&gt;I am trying to create a site that offers courses.  Each course will be broken up into sections with each sections containing a number of lessons.  Viewers will then be able to progress through the course one lesson at a time - at their own pace (like Lynda.com).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the sections are merely there for organizational purposes - they don't actually house any content.  All the actual content is&#xA;  limited to the Course page and the individual Lessons.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am trying to figure out the best way to organize this. This is my current thinking (but I'm not sure this is the best way to do it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Section &amp;amp; Entry Types&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a Structure Section called Courses with two Entry Types:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Course&lt;/li&gt;&#xA;&lt;li&gt;Lesson&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have then set up a matrix field for the Course entry type with two field types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Section Name:&lt;/strong&gt;  Plain Text field type for the name of the section&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Section Lessons:&lt;/strong&gt; Entries field type set to Courses (for the list of lessons  in each section)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The idea being that on the course page I could quickly and easily create a number of sections and then add the relevant lessons to each section.  I can then set up the template to progress through each section and it's lessons in order.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, I had two other ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set up three entry types - Course, Section &amp;amp; Lesson&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would then have the Course be the parents of the various Sections and the Sections be the parents of the various Lessons.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also seems fairly easy to do (the only problem is creating an entry for each section given that the Sections don't actually house any content).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set up categories for each course&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could then assign each lesson to a category (I would then have to figure out how to order the content).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions as to which is the best way to proceed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6344" LastActivityDate="2017-03-06T16:13:16.643" Title="How to Organize a Courses Site" Tags="&lt;entries&gt;&lt;structure&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19278" PostTypeId="1" AcceptedAnswerId="19304" CreationDate="2017-03-05T20:26:36.510" Score="1" ViewCount="167" Body="&lt;p&gt;In the grand scheme, I am trying to get all products that are &lt;em&gt;not&lt;/em&gt; related to specific categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since any product can belong to any given number of categories, I am trying to loop through all categories and then only query against the categories that I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludeCategoryIds = [36, 44] %}&#xA;{% set allProducts = craft.commerce.products.type('myType').order('title asc') %}&#xA;{% set products = [] %}&#xA;&#xA;{% for category in craft.categories.group('myCategories').relatedTo(allProducts) %}&#xA;    {% if category.id not in excludeCategoryIds %}&#xA;        {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;        {# push entires into products?? #}&#xA;        {% set products = products|merge([entries]) %} {# doesn't work #}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once all products are found, then I'll loop through them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if products|length %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could also loop through each of the entires as &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;described in the docs&lt;/a&gt; but it's starting to feel like this is getting out of control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to only show products that are not related to specific categories?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-03-06T23:59:57.367" Title="How can I push a result of entries/products from a loop into an array?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19281" PostTypeId="2" ParentId="12310" CreationDate="2017-03-06T02:36:01.773" Score="1" Body="&lt;p&gt;A similar question regarding images was answered in this ticket I believe: &lt;a href=&quot;https://craftcms.stackexchange.com/a/13236/4433&quot;&gt;https://craftcms.stackexchange.com/a/13236/4433&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-03-06T02:36:01.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19282" PostTypeId="1" AcceptedAnswerId="19301" CreationDate="2017-03-06T03:20:04.890" Score="1" ViewCount="628" Body="&lt;p&gt;I'm producing a list of entries that each use an image asset from a related entry.  I see &lt;a href=&quot;https://craftcms.stackexchange.com/a/13236/4433&quot;&gt;in this ticket&lt;/a&gt; how to get an asset's data, and I've combined that with how I learned to output an object's data from a &lt;a href=&quot;https://mijingo.com/lessons/creating-an-element-api-in-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo video&lt;/a&gt; (via the &lt;code&gt;array_map&lt;/code&gt; function).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach works, but seeing how there are about 130 entries in the section, the load time is a whopping 2.31s versus when I take out the related entry's asset code, which then results in a much smaller 500ms load time.  Is there a better way to access this data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/pressEntries.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'pressEntries'],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;                return [&#xA;                    'id'                =&amp;gt; $entry-&amp;gt;id,&#xA;                    'title'             =&amp;gt; $entry-&amp;gt;title,&#xA;                    'slug'              =&amp;gt; $entry-&amp;gt;slug,&#xA;                    'postDate'          =&amp;gt; $entry-&amp;gt;postDate,&#xA;                    'type'              =&amp;gt; $entry-&amp;gt;type-&amp;gt;name,&#xA;                    'url'               =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl'           =&amp;gt; UrlHelper::getUrl(&quot;api/press/{$entry-&amp;gt;id}.json&quot;),&#xA;                    'relatedRecording'  =&amp;gt; array_map(function(EntryModel $album) {&#xA;                        $data = [&#xA;                            'id'    =&amp;gt; $album-&amp;gt;id,&#xA;                            'title' =&amp;gt; $album-&amp;gt;title,&#xA;                        ];&#xA;&#xA;                        $artwork = $album-&amp;gt;recordingArtwork-&amp;gt;first();&#xA;                        if ($artwork) {&#xA;                            $data['artwork'] = $artwork-&amp;gt;url;&#xA;                        }&#xA;                        return $data;&#xA;&#xA;                    }, $entry-&amp;gt;relatedRecording-&amp;gt;find()),&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-03-06T23:27:07.740" Title="Element API: return a related entry's asset data with entry data" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19284" PostTypeId="1" CreationDate="2017-03-06T10:03:11.680" Score="1" ViewCount="176" Body="&lt;p&gt;Wonder if you can help? Got a booking form on a multi-locale site and I need to include the user's country in the form. I'm using Craft's LocaleData class to output locale-specific locales (e.g. Angleterre for England)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;country&quot; required&amp;gt;&#xA;{% for country in craft.i18n.getLocaleData().getAllTerritories() %}&#xA;    &amp;lt;option&amp;gt;{{ country }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works great except it outputs stuff I don't need like &quot;World&quot;, &quot;Oceana&quot;, &quot;Ascension Island&quot; etc... Is there any way to control the output, like maybe show countries only and not regions?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-06T16:23:26.253" Title="Locale-specific country select menu" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19285" PostTypeId="2" ParentId="19272" CreationDate="2017-03-06T12:14:31.527" Score="4" Body="&lt;p&gt;You're really fighting against the way Craft CMS does things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start by having a good read through the &lt;a href=&quot;https://craftcms.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Docs&lt;/a&gt; first, there really isn't a shortcut. The docs are really great though, and contain everything you're likely to need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I'd set up a copy of Craft in isolation of your site/framework and just get a feel for how you do things the &quot;Craft way&quot;. It is different to just doing HTML &amp;amp; PHP, but not so different that's it going to take you too long to figure it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft actually uses the &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/intro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt; tempting language, which is really easy to get going with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In answer to your specific question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Does craft allow me to make calls to get the stored data and then I manually handle the inserting of this data?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes it does. To output your data, you'd likely use sections/entries in your Twig template. So take a look at the example at the top of &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; to see how you'd go about it. You'd input your data via the Control Panel, so have a read &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for that.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-03-06T12:20:12.523" LastActivityDate="2017-03-06T12:20:12.523" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19286" PostTypeId="2" ParentId="19284" CreationDate="2017-03-06T13:33:30.343" Score="1" Body="&lt;p&gt;If you look at &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/framework/i18n/data/en_gb.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;the data file for a locale in Yii&lt;/a&gt; you can see that the territories property includes regions and continents as you've found. These all have keys with numeric values, whereas countries have two character keys. Using this knowledge, you can loop over the keys and values of the territories array as you are doing, but only output those with two character keys. You'll also probably want to omit the &lt;code&gt;Unknown Region&lt;/code&gt; value which has a key of &lt;code&gt;zz&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Untested, but this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;country&quot; required&amp;gt;&#xA;    {% for key, value in craft.i18n.getLocaleData().getAllTerritories() %}&#xA;        {% if (key matches '/[a-z][a-z]/') and (key != 'zz') %}&#xA;            &amp;lt;option&amp;gt;{{ value }}&amp;lt;/option&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, so my original idea doesn't work as &lt;code&gt;craft.i18n.getLocaleData().getAllTerritories()&lt;/code&gt; doesn't preserve the territory array keys from the Yii i18n data files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure you can do what you want to do natively in Craft, but it looks like &lt;a href=&quot;https://github.com/johndwells/craft.territories&quot; rel=&quot;nofollow noreferrer&quot;&gt;John D. Wells' Territories fieldtype plugin&lt;/a&gt; may provide what you need. You don't need to use the fieldtype as there is an undocumented Twig variable provided that gives you an array of localised territory names, excluding the regions. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;country&quot; required&amp;gt;&#xA;    {% for country in craft.territories.getTerritories() %}&#xA;        &amp;lt;option&amp;gt;{{ country }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2017-03-06T16:23:26.253" LastActivityDate="2017-03-06T16:23:26.253" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19287" PostTypeId="1" CreationDate="2017-03-06T14:37:32.983" Score="1" ViewCount="30" Body="&lt;p&gt;I've set up new tag groups to help organise the c300b tags we have set up. How do I move the existing tags, which are already in use, to the new tag groups?&lt;/p&gt;&#xA;" OwnerUserId="6376" LastActivityDate="2017-05-06T00:03:07.370" Title="Can I move existing tags, which are currently in a global tag group, to new the new tag groups I've set up?" Tags="&lt;tags&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19288" PostTypeId="1" AcceptedAnswerId="19289" CreationDate="2017-03-06T15:35:13.980" Score="1" ViewCount="43" Body="&lt;p&gt;I'm trying to create a Matrix field containing plain text blocks of two kinds, one for providing Youtube video embed codes, and one for providing a description. What I want to know is, is there a way to make it so users can add another field of either kind if they want to embed another video and/or provide another description, or do I have to &quot;build&quot; each field option in manually?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the less elegant way I tried to solved this problem involved creating multiple fields, but since the handles all have to be different, I tacked a number onto each (mainYoutubeEmbed, youtubeEmbed2, youtubeEmbed3, and etc.) This just seems so clumsy and is completely non-DRY. The other option I considered to make it slightly better was to create a bunch of generic fields all with the same title and handle (so I could just loop through them), but Craft says that the handles must be unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way around this or a way to make it at least a little better, or is the best approach really to just create a bunch of fields and hope that my users don't need more in the future? Maybe a plug-in or magic incantation of some kind?? :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. I know the titles can be the same, but I changed them to match the handles because if I find that I'm stuck with this janky method, I want it to be as easy as possible to &quot;see&quot; how it's laid-out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for all constructive advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6AVT4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6AVT4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6337" LastEditorUserId="6337" LastEditDate="2017-03-06T15:51:05.490" LastActivityDate="2017-03-06T15:51:05.490" Title="Can I Create a Way for Users to Add Fields from the Dashboard and/or create Fields with Same Handle?" Tags="&lt;matrix&gt;&lt;users&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19289" PostTypeId="2" ParentId="19288" CreationDate="2017-03-06T15:49:56.053" Score="2" Body="&lt;p&gt;I might get you wrong but they must have the option to add as many youtube embed videos as they want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't it an option to let your client make a new block for every embed and just loop over the blocks they made? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your block would look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Youtube Video (block)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Youtube embed link&lt;/li&gt;&#xA;&lt;li&gt;Youtube Description&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So they just have to add a block when they want a new one and you can just loop over them like you would with any matrixblock?&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-06T15:49:56.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19290" PostTypeId="2" ParentId="19277" CreationDate="2017-03-06T16:13:16.643" Score="1" Body="&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; I'd lean towards a structure section. Matrix is a close second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long answer:&lt;/strong&gt;&#xA;When I'm faced with this an information architecture decision, I look at a couple things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How &quot;reusable&quot; is the solution? (is content only stored in one place?)&lt;/li&gt;&#xA;&lt;li&gt;Is it easy for the content author?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What's great about Craft is it generally makes both relatively easy.  What you don't want is to duplicate content in more than one section because it creates multiple sources of truth. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I typically reach for Matrix fields when I need to mix/match content on a single page. &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Entries/Structures are better when you need to build content that could potentially be brought in from any area of the site.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Categories are usually &quot;global&quot; in scope. They also wouldn't be the right choice here. You'd end up creating too many of them and you'd eventually want to create a category set for each course to keep everything straight.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;Matrix&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Let's look at the workflow for doing it the Matrix way. If you want to create a new lesson, you need to define it in two places: the Lesson entry itself and the Section/divider entry (and then tell Craft which section the Lesson entry goes). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also going to be harder to see from the CP how many lessons are in the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find Matrix fields tougher to template as well. If you use Matrix for navigation, you're going to have to iterate over all of them to see which one you're currently on. Because you're relating the entry, you're also going to have to do a &quot;reverse&quot; lookup.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Structures&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;That said, Structures bring their own set of problems and solutions. I like structures because you can easily move them up and down in the hierarchy. If a content author messed up and put a lesson in the wrong section, it's an easy drag/drop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also find templating a bit easier too. Want to get your current section you're in? Just get its parent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set courseSection = entry.parent %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can spit out its children:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% nav %}&#xA;  &amp;lt;li&amp;gt; &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;URLs&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;When you create a parent/child relationship in a structure section, the parent is going to create a new URL as well. That might not be ideal if you have thin content in the divider like you mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your URL might look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Course / Section / Lesson&#xA; url.com/craft-cms/twig/intro-to-twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a Matrix field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Course / Lesson&#xA; url.com/craft-cms/intro-to-twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That &quot;thin&quot; content is going to live at &lt;code&gt;twig&lt;/code&gt; for example. I don't necessarily see that as  bad thing but keep that in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although you might not use the section/divider for much content now, you may end up needing it in the future. Every slug in that course has to be unique now as well because you're not dividing it up. You wouldn't be able to do this with a matrix field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Course / Section / Lesson&#xA; url.com/craft-cms/twig/intro&#xA; url.com/craft-cms/twig/filters&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a Matrix field, it would have to be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Course / Lesson&#xA; url.com/craft-cms/intro-to-twig&#xA; url.com/craft-cms/twig-filters&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a little harder to keep consistent from a content authoring perspective as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see it as a &quot;table of contents&quot; for the section. In a traditional book, it might be an introduction to what you're about to learn in each section. Otherwise you'd need to create another lesson called &quot;Introduction&quot; for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to sum it up, a structure with 3 entry types is what I'd use followed by Matrix.  I don't think could go wrong with either solution though. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-03-06T16:13:16.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19291" PostTypeId="1" AcceptedAnswerId="19303" CreationDate="2017-03-06T16:35:01.363" Score="1" ViewCount="95" Body="&lt;p&gt;Is there a simple / best practice way for creating new users programatically? My specific use case involves capturing user data for online sales using a 3rd-party form with Stripe integration. When a user checks out and makes the purchase (not on the Craft site), I'd like to capture the data and generate a user account automatically &lt;em&gt;on&lt;/em&gt; the Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current idea, which should work, is to trigger Zapier to write a custom record (containing the user fields) to the MySQL database directly. I've done it before in other contexts but am curious if there's a better way?&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2017-03-06T23:43:44.657" Title="Adding users outside of CP or front-end registration form" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19292" PostTypeId="1" CreationDate="2017-03-06T18:01:26.917" Score="1" ViewCount="232" Body="&lt;p&gt;Help, I forgot how to do something basic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I pull all the entries in &lt;code&gt;posts&lt;/code&gt; for a specific category value (field name = &lt;code&gt;countryName&lt;/code&gt;) within the category group called &lt;code&gt;country&lt;/code&gt;?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I am &lt;strong&gt;&lt;em&gt;NOT&lt;/em&gt;&lt;/strong&gt; using the template for posts or the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can pull all the entries using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for doc in craft.entries.section('posts') %}&lt;/code&gt;&lt;br&gt;&#xA;--&lt;em&gt;OR&lt;/em&gt;-- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('posts') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I forgot how to now add a second condition to pull up only those entries with the &lt;code&gt;countryName&lt;/code&gt; (say) &quot;United Kingdom&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-05-17T14:22:15.883" Title="How do you pull entries with a specific category value?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19293" PostTypeId="2" ParentId="19292" CreationDate="2017-03-06T18:30:13.113" Score="0" Body="&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('posts').countryName('United Kingdom') %}&lt;/code&gt; should do the trick&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &#xA;&lt;code&gt;{% set results = craft.entries.section('posts').relatedTo('United Kingdom').find() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3351" LastEditorUserId="3351" LastEditDate="2017-05-17T14:22:15.883" LastActivityDate="2017-05-17T14:22:15.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19294" PostTypeId="1" CreationDate="2017-03-06T18:46:49.433" Score="1" ViewCount="481" Body="&lt;p&gt;I've just updated my site with setting my Content-Security-Policy Header and after fixing the slew of errors which popped up in the console, I am now down to one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant part of my .htaccess file is &lt;code&gt;script-src 'self'&lt;/code&gt;. Here I do not set &lt;code&gt;'unsafe-inline'&lt;/code&gt; as that kind of goes against the point of setting the CSP in the first place - at least in my reading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Craft setting a CSRF token and my site doing POST requests over AJAX, I set the token name and value as recommended here: &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection&lt;/a&gt; - which is inline and above in my CSP I do not allow inline scripts. So as you can see it falls apart and Craft spits out a 400 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can get around this? I'd like to keep my CSP and with CSRF being enabled by default in Craft 3, I'd like this ironed out before then.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-03-06T18:46:49.433" Title="CSRF token creation and Content-Security-Policy header" Tags="&lt;javascript&gt;&lt;security&gt;&lt;csrf&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19295" PostTypeId="2" ParentId="19292" CreationDate="2017-03-06T19:03:48.377" Score="1" Body="&lt;p&gt;Is this the best way to do it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`{% set results = craft.entries.section(posts).search('countryName:&quot;United Kingdom&quot;') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears to work.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-03-06T19:03:48.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19296" PostTypeId="1" AcceptedAnswerId="19315" CreationDate="2017-03-06T19:47:54.247" Score="1" ViewCount="255" Body="&lt;p&gt;This might be a stretch.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I (literally) modify the (Tableau API) javascript function below to print a specific fieldName (&quot;Country&quot;) so that it can place the &quot;Country&quot; into the CraftCMS/Twig request below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set results = craft.entries.section('posts').search('countryName:&quot;&lt;strong&gt;Value Goes Here&lt;/strong&gt;&quot;') %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l3ONW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l3ONW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-03-07T18:59:40.380" Title="How do I add input a value to a Craft/Twig request?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19297" PostTypeId="2" ParentId="19275" CreationDate="2017-03-06T22:00:28.657" Score="3" Body="&lt;p&gt;I've run into this issue myself with Craft version: 2.6.2962.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The line in question is expecting a column from the database called &quot;releaseDate&quot;.&#xA;In my case, that column no longer exists. It might have gotten dropped or lost with one of the updates, I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A short-term solution would be to edit that line of code and pass in some different value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I changed the line to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$row['releaseDate'] = DateTime::createFromString($row['dateUpdated'], null, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to clarify, looking at the changelog, it seems they are in the process of tweaking the craft()-&gt;releaseDate() function call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update 03/06/2017:&#xA;It appears that my code-base was outdated with the version in my database. I updated to the latest version of craft and that line that I edited above is now gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question to you: Is your craft version up to date?&lt;/p&gt;&#xA;" OwnerUserId="6378" LastEditorUserId="6378" LastEditDate="2017-03-06T22:16:17.797" LastActivityDate="2017-03-06T22:16:17.797" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="19298" PostTypeId="1" AcceptedAnswerId="19300" CreationDate="2017-03-06T22:19:12.733" Score="3" ViewCount="1173" Body="&lt;p&gt;I have a category listing template where I'm having trouble passing in some variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;top of the template I have this snippet where I'll set the channel and category field name based on the segment&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment = craft.request.segment(1) %}&#xA;&#xA;{# set channel based on segment_1 #}&#xA;{% if segment == &quot;business-intel&quot; %}&#xA;    {% set channelName = &quot;businessIntel&quot; %}&#xA;    {% set categoryName = &quot;businessIntelCategories&quot; %}&#xA;{% elseif segment == &quot;foo&quot; %}&#xA;    {# do nothing #}&#xA;{% endif %}&#xA;{# end set channel #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then further down the template I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include ('_includes/cat_sub_with_article') with { 'categoryName' : categoryName } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then the included template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for category, catEntries in entries | group('categoryName.first().title') %}&#xA;    &amp;lt;h2&amp;gt;{{ category }}&amp;lt;/h2&amp;gt;&#xA;&#xA;&#xA;    {% set featuredThumb = {&#xA;        mode: 'crop',&#xA;        width: 370,&#xA;        height: 168,&#xA;        quality: 90,&#xA;        position: 'top-center'&#xA;      } %}&#xA;&#xA;    &amp;lt;div class=&quot;article-cards&quot;&amp;gt;&#xA;        {% for entry in catEntries %}&#xA;        &amp;lt;div class=&quot;article-card__wrapper&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;article-card&quot;&amp;gt;&#xA;&#xA;                {% set image = entry.featuredImage.first() %}&#xA;&#xA;                &amp;lt;span class=&quot;article-card__image&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;{{ image.url(featuredThumb) }}&quot; /&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;                &amp;lt;span class=&quot;article-card__text&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;article-card__category&quot;&amp;gt;{{ entry.postDate.format('M d, Y') }}&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;article-card__title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ entry.featuredSummary }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;span class=&quot;link--green&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;Learn More&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- /.article-cards --&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I hardcode the category field name into line 1 of the above block everything works. However if I try to use the passed varialbe. I get this error, which I don't know how to fix:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\EntryModel and its behaviors do not have a method or closure&#xA;  named &quot;categoryName&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="193" LastEditorUserId="125" LastEditDate="2017-03-07T15:21:57.593" LastActivityDate="2017-03-07T15:21:57.593" Title="Passing a variable to an include" Tags="&lt;templating&gt;&lt;group&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19299" PostTypeId="1" CreationDate="2017-03-06T22:49:26.540" Score="2" ViewCount="735" Body="&lt;p&gt;I'm trying to use the &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Embedded Assets&quot; Craft plug-in&lt;/a&gt; to embed Youtube videos in my content, but I can't figure it out. I've read through the instructions on the Github page, and I've looked at other resources online, but it's not working and I can't make sense of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have successfully installed the plug-in, and it seems to be &quot;grabbing&quot; the videos correctly because a thumbnail for the video appears when I enter the URL for it in the &quot;Embed link&quot; Asset selection. These are also saving in their respective fields when I enter them into an Entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I'm having trouble is understanding how to integrate them into my templates; the only configuration I changed was the 'extraAllowedFileExtensions' =&gt; 'json' setting in the general.php file. It said something else about configurations in the documentation, but it was very vague and said their should already be defaults in place. I tried dropping the code in that they suggested, as well, and played with the values a bit, but it's just empty space when I preview the page (or it breaks the page altogether). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I tried to put into my template in different forms (tried the given loop, not looping, and etc.):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in assets %}&#xA;    {% set embed = craft.embeddedAssets.fromAsset(asset) %}&#xA;    {% if embed %}&#xA;        {{ embed.safeHtml|raw }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you care to write an example, the handle for the field I'm using is &lt;strong&gt;embeddedMediaUrl&lt;/strong&gt; and the embed links are stored in assets/&lt;strong&gt;mediaEmbeds&lt;/strong&gt; (not sure if this info is needed or not.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help with this will be greatly appreciated. I apologize if this is vague, but I've been messing around with it long enough that it seemed time to reach out to the community to see if someone could give me some help. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6337" LastActivityDate="2017-12-30T06:28:19.913" Title="Instructions for Using Craft &quot;Embedded Assets&quot; Plug-in?" Tags="&lt;plugins&gt;&lt;embed&gt;&lt;plugin-embeddedassets&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19300" PostTypeId="2" ParentId="19298" CreationDate="2017-03-06T22:50:16.817" Score="3" Body="&lt;p&gt;You set the variable that your are passing in to your include to a string. And in your include you try to access it like an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variable which you’re passing in to your include is set to a string &lt;code&gt;'businessIntelCategories'&lt;/code&gt;. And in your include you try access a object property dynamically using that string which doesn’t work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use this code instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesGrouped = entries|group('{ object[categoryName].first().title }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here’s an attempt to explain the syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you should have a look at the Craft documentation for &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Entry Titles&lt;/a&gt;. You see that you can dynamically generate titles with a normal Twig template &lt;code&gt;{{ object.property }}&lt;/code&gt; or a special shortcut syntax &lt;code&gt;{property}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;group&lt;/code&gt; filter uses the same internal functionality to render the string that you pass in as a filter argument &lt;code&gt;group('my twig template string')&lt;/code&gt;. The syntax has to be a bit different though, because &lt;code&gt;group&lt;/code&gt; already adds one pair of curly braces for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So usually you echo the title property like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in the context of the &lt;code&gt;group&lt;/code&gt; filter you can do both of the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesGrouped = entries|group('title') %}&#xA;&#xA;{% set entriesGrouped = entries|group('{ object.title }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first syntax, which uses the shortcut syntax, is documented and fine for most cases. But you can’t use it if you need to do something a bit more advanced, like using a ternary operator or in your case access the &lt;code&gt;object&lt;/code&gt; object differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to wrap this up, the syntax for &lt;code&gt;group('{ object[categoryName].first().title }')&lt;/code&gt; is confusing. But what it does is to render the following Twig code for each element of your array of entries (each entry is passed in as the variable &lt;code&gt;object&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object[categoryName].first().title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don’t like the &lt;code&gt;object['propertyName']&lt;/code&gt; syntax, you can use the &lt;a href=&quot;http://twig.sensiolabs.org/doc/1.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; function instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(object, categoryName).first().title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-03-07T15:20:56.327" LastActivityDate="2017-03-07T15:20:56.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19301" PostTypeId="2" ParentId="19282" CreationDate="2017-03-06T23:27:07.740" Score="1" Body="&lt;p&gt;Sounds like you need to do some &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; of your assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some examples of how to do that in the Element API plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15220/elementapi-handling-categorymodel-and-returning-a-heirachical-object/15228#15228&quot;&gt;ElementAPI handling CategoryModel and returning a heirachical object&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/18173/getting-categories-in-elementapi-performance-issues-and-help-required/18177#18177&quot;&gt;Getting categories in elementAPI performance issues and help required&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-06T23:27:07.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19302" PostTypeId="2" ParentId="19287" CreationDate="2017-03-06T23:34:46.860" Score="1" Body="&lt;p&gt;There is no way to do this natively in Craft through the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could either write quick &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that programmatically moved the existing tags to new tag groups or write some custom SQL that did it directly against the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the latter, it should be as simple as updating the &lt;code&gt;groupId&lt;/code&gt; column of the &lt;code&gt;craft_tags&lt;/code&gt; table with the new &lt;code&gt;groupId&lt;/code&gt; for the tags you want to move.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-06T23:34:46.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19303" PostTypeId="2" ParentId="19291" CreationDate="2017-03-06T23:43:44.657" Score="2" Body="&lt;p&gt;You could write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that exposed a &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;anonymous controller&lt;/a&gt; endpoint that accepted to the user info you want to save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there the controller endpoint could create a new UserModel, populate necessary fields/properties you want to save, then call &lt;a href=&quot;https://craftcms.com/classreference/services/UsersService#saveUser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser()&lt;/code&gt;&lt;/a&gt; and let Craft do the database populating.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-06T23:43:44.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19304" PostTypeId="2" ParentId="19278" CreationDate="2017-03-06T23:59:57.367" Score="1" Body="&lt;p&gt;This line doesn't return an array of items; it returns an ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's probably why you're having problems with the &lt;code&gt;|merge&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing it to the following should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-06T23:59:57.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19306" PostTypeId="1" AcceptedAnswerId="19309" CreationDate="2017-03-07T08:15:09.983" Score="7" ViewCount="593" Body="&lt;p&gt;I see Craft &lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;noreferrer&quot;&gt;does support regex in replace search.&lt;/a&gt; But there is no info on using regex groups, ie &lt;code&gt;string | replace('/this is a (string)/', 'This is another $1')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this feature implemented? If so - how?&lt;/p&gt;&#xA;" OwnerUserId="6380" LastActivityDate="2020-08-15T12:21:51.047" Title="Does Craft / Twig support regex groups?" Tags="&lt;replace&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19308" PostTypeId="1" AcceptedAnswerId="19310" CreationDate="2017-03-07T10:10:45.783" Score="6" ViewCount="863" Body="&lt;p&gt;I have a load of projects, each of which can have zero or more categories which indicate the particular type(s) of work involved. As well as using these categories to produce a 'category page' of filtered entries, they are also pulled through to each index page listing, to show the types of work involved in that particular project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, these ideally should be ordered by priority, so one project may feature more use of category 1 so that would want to come first, whereas one project may feature more use of category 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Assets Fields (and I &lt;em&gt;think&lt;/em&gt; also Entries Fields), I seem to be able to order the respective elements by dragging and dropping them in the field, but for Categories Fields, the order seems to be determined by the order of the Structure in the Categories page in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of allowing the user to customise the order the Categories in a Categories field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2017-03-07T13:14:39.767" Title="Custom Category order in a Categories Field" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19309" PostTypeId="2" ParentId="19306" CreationDate="2017-03-07T12:35:49.167" Score="7" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ 'this is a string'|replace('/this is a (string)/', 'This is another $1') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is another string&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you pass something that looks like a regex into the &lt;code&gt;|replace&lt;/code&gt; filter,  &lt;a href=&quot;http://php.net/manual/en/function.preg-replace.php&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;preg_replace()&lt;/code&gt;&lt;/a&gt; is called behind the scenes, so &lt;code&gt;|replace&lt;/code&gt; can do anything &lt;code&gt;preg_replace()&lt;/code&gt; can do.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-07T12:35:49.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19310" PostTypeId="2" ParentId="19308" CreationDate="2017-03-07T13:14:39.767" Score="7" Body="&lt;p&gt;No, it’s not possible to change the order of related categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Think of the field as a big checkbox list; you can change which checkboxes are checked, but you can’t change their order. The only reason it’s not a simple checkbox list is to save visual space.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to be able to set the order, you can put the Categories field inside a Matrix field, where each block selects a single category, and then you can reorder the blocks.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-07T13:14:39.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19311" PostTypeId="1" AcceptedAnswerId="19316" CreationDate="2017-03-07T13:16:43.823" Score="2" ViewCount="491" Body="&lt;p&gt;Is it possible to modify an field of an entry within the front-end? Something like this with an action URL:&#xA;&lt;code&gt;&amp;lt;a href=&quot;{{actionUrl('save/entry', {userfield:user.id}) }}&quot;&amp;gt;add user to userfield of current entry&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="57" LastEditDate="2017-03-07T19:41:29.923" LastActivityDate="2017-03-07T19:41:29.923" Title="How to modify entry with a users field in the front-end?" Tags="&lt;form&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19313" PostTypeId="2" ParentId="19240" CreationDate="2017-03-07T16:58:16.797" Score="1" Body="&lt;p&gt;Thanks for reporting this issue. We'll have a fix available for this in the next release of Freeform. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, affected customers can &lt;a href=&quot;https://solspace.com/craft/create-ticket/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;contact us for a patched copy&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-03-07T16:58:16.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19314" PostTypeId="1" AcceptedAnswerId="19336" CreationDate="2017-03-07T18:50:42.503" Score="1" ViewCount="110" Body="&lt;p&gt;I have a category group called &lt;code&gt;country&lt;/code&gt;, with each category being the name of a country.  I used the full name of the country.&lt;br&gt;&#xA;I realize I might want to use each country's 2-digit code.  For example, AU for Australia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How might I implement the abbreviations to associate with the category?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way, how can I use the 2-digit code as an alias for the full country name?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-03-08T18:07:01.443" Title="How can I use an alias for a category?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19315" PostTypeId="2" ParentId="19296" CreationDate="2017-03-07T18:59:40.380" Score="1" Body="&lt;p&gt;You can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft / Twig code runs server-side, before the page is delivered to the browser. The JavaScript runs client side, after the page is delivered to the browser.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-07T18:59:40.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19316" PostTypeId="2" ParentId="19311" CreationDate="2017-03-07T19:40:53.300" Score="1" Body="&lt;p&gt;Sure... you'd just do it through whatever input tag you want using the &lt;code&gt;name=&quot;fields[fieldHandle][]&quot;&lt;/code&gt; syntax passing in the user's ID as the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are examples of that here, under the &quot;Relations&quot; header:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't be able to do that should an anchor link GET request though... &lt;code&gt;EntriesController::saveEntry()&lt;/code&gt; is explicitly checking for a POST request, so you'll want to do it though a proper form: &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-07T19:40:53.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19317" PostTypeId="1" AcceptedAnswerId="19323" CreationDate="2017-03-07T20:15:09.477" Score="2" ViewCount="211" Body="&lt;p&gt;I am going to try this again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page for a category (&lt;code&gt;country&lt;/code&gt;) with all the entries that match that country.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have buttons that allow you to filter the entries using categories from a second category group ('market').  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All, I want to do is list the markets to make the filter buttons.&lt;br&gt;&#xA;BUT, I don't want to list the parent if their is a child.  And, there is not always a child.&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qIn1O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qIn1O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I have things setup.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category).find() %}&#xA;{% set markets = craft.categories.group('markets').relatedTo(entries).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, this prints both the parent and child of a market. I don't want to print the parent if there is a child.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addling &lt;code&gt;level(x)&lt;/code&gt; does not work because then it leaves out those markets that might be x+1 or x-1.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And adding &lt;code&gt;last()&lt;/code&gt; did not work.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has to be possible.  It's killing me. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2017-03-08T02:48:15.663" LastActivityDate="2017-03-09T12:49:52.087" Title="Categories in a RelatedTo - How do I not list the parent if there is a child?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19318" PostTypeId="1" CreationDate="2017-03-07T20:19:27.863" Score="1" ViewCount="148" Body="&lt;p&gt;My client has requested to be able to filter the results page by price via a dropdown, which you can see in the attached screenshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the results page shows a list of around 15 property developments, and is ordered alphabetically currently. I've setup two other dropdown filters to sort the categories by Location and by individual Development. And these work well. However, I'm stuck on how to actually implement this for price, and I can't find anything on the boards or documentation that have helped. So am hoping someone can give me some guidance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client wants the price dropdown to have the following options:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;£0 - £999,999&#xA;£1,000,000 - £1,999,999&#xA;£2,000,000 - £2,999,999&#xA;£3,000,000 - £3,999,999&#xA;£4,000,000 - £4,999,999&#xA;£5,000,000+`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My initial approach is to create a tag group called priceRange and a tag field also called priceRange and I've entered the options above as tags and got them to show in the dropdown with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form-inline&quot; action=&quot;{{ url('developments') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;price1&quot;&amp;gt;Price&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;      &amp;lt;select id=&quot;price1&quot; class=&quot;form-control&quot; name=&quot;price1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;        {% for category in craft.tags.group('priceRange').order('title asc') %}&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% set query = &quot;&quot; %}&#xA;{% if craft.request.getParam('price1') and&#xA;craft.request.getParam('price1') is not empty %}&#xA;{% set query = craft.request.getParam('price1') %}&#xA;{% endif %}&#xA;&#xA;{% set queryFilter = craft.categories.group('developments').search(query).order('title asc') %}&#xA;&#xA;{% if queryFilter|length %}&#xA;{% for category in queryFilter %}&#xA;&amp;lt;div class=&quot;development-block&quot;&amp;gt;&#xA;..the content..&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I have them showing in the dropdown, but any help on how to actually get it filter the results by by the selected price range would be very appreciated, and then sort those results by highest price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or a better approach even, as I am wary with the tags approach that the client might add extra tags with different prices for the same ranges. So I would ideally like to give them a defined list of options in CMS to select from that they can't then edit if possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jqifR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jqifR.jpg&quot; alt=&quot;price filter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-03-07T21:15:22.887" LastActivityDate="2017-03-07T21:15:22.887" Title="Query category by price" Tags="&lt;categories&gt;&lt;sorting&gt;&lt;queries&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19319" PostTypeId="1" AcceptedAnswerId="19320" CreationDate="2017-03-07T21:23:31.187" Score="2" ViewCount="444" Body="&lt;p&gt;I am unable to pay $99 for &lt;a href=&quot;https://dukt.net/analytics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt Analytics&lt;/a&gt;. Does anyone know of a free alternative that gives me google analytics stats for the dashboard?&lt;/p&gt;&#xA;" OwnerUserId="6384" LastActivityDate="2017-03-07T21:48:05.503" Title="Any alternative to Dukt Analytics?" Tags="&lt;dashboard&gt;&lt;dashboard-widgets&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19320" PostTypeId="2" ParentId="19319" CreationDate="2017-03-07T21:48:05.503" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/?q=analytics&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/?q=analytics&amp;amp;&lt;/a&gt; shows some possible analytics candidates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/instant-analytics&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/instant-analytics&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/piwik-analytics&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/piwik-analytics&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/3redkites-piwik-analytics-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/3redkites-piwik-analytics-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/tracker&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/tracker&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-07T21:48:05.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19321" PostTypeId="2" ParentId="19103" CreationDate="2017-03-08T01:10:52.520" Score="1" Body="&lt;p&gt;Craft install (LAMP)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;LAMP Install&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1: Install Apache and Allow in Firewall&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;apt-get update&lt;br&gt;&#xA;apt-get install apache2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set Global ServerName to Suppress Syntax Warnings&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;apache2ctl configtest&lt;br&gt;&#xA;nano /etc/apache2/apache2.conf&lt;br&gt;&#xA;&lt;strong&gt;&lt;em&gt;ADD:&lt;/em&gt;&lt;/strong&gt; ServerName 'server_domain_or_IP'&lt;br&gt;&#xA;apache2ctl configtest&lt;br&gt;&#xA;systemctl restart apache2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Adjust the Firewall to Allow Web Traffic&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ufw app list&lt;br&gt;&#xA;ufw app info &quot;Apache Full&quot;&lt;br&gt;&#xA;ufw allow in &quot;Apache Full&quot;&lt;br&gt;&#xA;&lt;strong&gt;&lt;em&gt;Test:&lt;/em&gt;&lt;/strong&gt; &lt;a href=&quot;http://your_server_IP_address&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://your_server_IP_address&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2: Install MySQL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;apt-get install mysql-server&lt;br&gt;&#xA;mysql_secure_installation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3: Install PHP&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;apt-get install php libapache2-mod-php php-mcrypt php-mysql&lt;br&gt;&#xA;nano /etc/apache2/mods-enabled/dir.conf&lt;br&gt;&#xA;Move the index.php file to the first position after the &quot;DirectoryIndex&quot; specification&lt;br&gt;&#xA;systemctl restart apache2&lt;br&gt;&#xA;systemctl status apache2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Install PHP Modules&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0&lt;br&gt;&#xA;phpenmod mcrypt&lt;br&gt;&#xA;phpenmod mbstring&lt;br&gt;&#xA;systemctl restart apache2&lt;br&gt;&#xA;apt-get install curl&lt;br&gt;&#xA;apt-get install imagemagick&lt;br&gt;&#xA;apt-get install&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4: Test PHP Processing on your Web Server&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nano /var/www/html/info.php&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;strong&gt;&lt;em&gt;Test:&lt;/em&gt;&lt;/strong&gt; &lt;a href=&quot;http://your_server_IP_address/info.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://your_server_IP_address/info.php&lt;/a&gt;&lt;br&gt;&#xA;rm /var/www/html/info.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Craft Install&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/.htaccess root@192.168.10.39:/var/www/html/public&lt;br&gt;&#xA;scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/index.php root@192.168.10.39:/var/www/html/public&lt;br&gt;&#xA;scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/robots.txt root@192.168.10.39:/var/www/html/public&lt;br&gt;&#xA;scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/craft root@192.168.10.39:/var/www/html/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mv htaccess .htaccess&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysql -uroot -p&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CREATE DATABASE craftdb;&lt;br&gt;&#xA;CREATE USER 'craftdba'@'localhost' IDENTIFIED BY 'your_password';&lt;br&gt;&#xA;GRANT ALL PRIVILEGES ON 'craftdb'.* TO 'craftdba'@'localhost';&lt;br&gt;&#xA;FLUSH PRIVILEGES;&lt;br&gt;&#xA;exit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nano /var/www/html/craft/config/db.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database Details&lt;br&gt;&#xA;Database Name: craftdb&lt;br&gt;&#xA;DataBase Username: craftdba&lt;br&gt;&#xA;Database Password: your_password&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chown -R www-data:www-data /var/www/html/craft&lt;br&gt;&#xA;chmod -R 775 /var/www/html/*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;service apache2 restart&lt;br&gt;&#xA;192.168.10.39/public/index.php/admin/install&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was what was needed to finally get Craft to work!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastActivityDate="2017-03-08T01:10:52.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19322" PostTypeId="1" AcceptedAnswerId="19324" CreationDate="2017-03-08T01:33:56.077" Score="1" ViewCount="202" Body="&lt;p&gt;Finally after almost three weeks of trial and error, I have reached the promised land. Now that I am here, I notice that my site loads funny. By that I mean the following:&lt;/p&gt;&#xA;&lt;p&gt;When going to my sites IP address (test environment currently) I get a very generic looking page that states &amp;quot;Index of /&amp;quot; and below that is the craft and public directories.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XvXLf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XvXLf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I must add that the Dashboard loads fine: &lt;a href=&quot;http://192.168.10.39/public/index.php/admin/dashboard&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://192.168.10.39/public/index.php/admin/dashboard&lt;/a&gt;&#xA;Just when going to the main IP as shown in the picture.&lt;br /&gt;&#xA;Anyone else encounter this issue?&lt;/p&gt;&#xA;&lt;p&gt;Have craft installed on a LAMP server, and can provide details if needed.&lt;/p&gt;&#xA;&lt;p&gt;Thank you and I look forward to hearing back from you all soon. :-)&lt;/p&gt;&#xA;&lt;p&gt;Thoughts? Thank you for all assistance here!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-03-10T19:30:40.967" Title="Site loads funny" Tags="&lt;apache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19323" PostTypeId="2" ParentId="19317" CreationDate="2017-03-08T01:38:37.050" Score="3" Body="&lt;p&gt;You could just use what you got, loop through the categories and try to grab the descendants for each of them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% set allMarkets = craft.categories.group('markets').level(1).relatedTo(entries) %}&#xA;&#xA;{% for market in allMarkets %}&#xA;    {% set descMarkets = market.getDescendants() %}&#xA;&#xA;    {% if descMarkets %}&#xA;        {% for market in descMarkets %}&#xA;            {% include '_includes/partial' %}&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        {% include '_includes/partial' %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another good approach is to &quot;collect&quot; element IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would basically do the same as in the output loop of the above example, but instead of having the conditionals and extra queries in the output loop, you’d work with element IDs that you merge into an array. You can then query for the categories nicely using the &lt;code&gt;id&lt;/code&gt; param in a &lt;code&gt;craft.categories&lt;/code&gt; criteria model.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% set topMarkets = craft.categories.group('markets').level(1).relatedTo(entries) %}&#xA;&#xA;{% set allMarketIds = [] %}&#xA;&#xA;{% for market in topMarkets %}&#xA;    {% set descMarketIds = craft.categories.descendantOf(market).ids() %}&#xA;&#xA;    {% if descMarketIds %}&#xA;        {% set allMarketIds = allMarketIds|merge(descMarketIds) %}&#xA;    {% else %}&#xA;        {% set allMarketIds = allMarketIds|merge([market.id]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% set allMarkets = craft.categories.id(allMarketIds) %}&#xA;&#xA;{% for market in allMarkets %}&#xA;    {% include '_includes/partial' %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more approach! I just noticed, that you can simply test whether a category has descendants or not. This should probably be best from a performance point of view.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% set allMarkets = craft.categories.group('markets').relatedTo(entries) %}&#xA;&#xA;{% for market in allMarkets %}&#xA;    {% if market.getDescendants().total() == 0 %}&#xA;        {% include '_includes/partial' %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-03-09T12:49:52.087" LastActivityDate="2017-03-09T12:49:52.087" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19324" PostTypeId="2" ParentId="19322" CreationDate="2017-03-08T01:50:55.277" Score="6" Body="&lt;p&gt;This looks like a problem with your &lt;code&gt;DocumentRoot&lt;/code&gt; config option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to your Apache VirtualHost configuration, you should append &lt;code&gt;/public&lt;/code&gt; to your &lt;code&gt;DocumentRoot&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're configuring the host via some kind of control panel (i.e. via your web host), look for an option like &quot;Web Root,&quot; and add the same &lt;code&gt;/public&lt;/code&gt; path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if your current &lt;code&gt;DocumentRoot&lt;/code&gt; was &lt;code&gt;/home/username/website.com&lt;/code&gt;, you'd change it to &lt;code&gt;/home/username/website.com/public&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many hosts will have a &lt;code&gt;DocumentRoot&lt;/code&gt; like &lt;code&gt;/var/www/website.com&lt;/code&gt;—same deal! Just add &lt;code&gt;/public&lt;/code&gt; so it looks like &lt;code&gt;/var/www/website.com/public&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just about as good a start as we can get without knowing more about your setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;em&gt;The page you're seeing is what's called an &quot;index,&quot; and it's dynamically generated by Apache for folders that don't contain an appropriate script or static file (typically, &lt;code&gt;index.html&lt;/code&gt; or &lt;code&gt;index.php&lt;/code&gt;)—you'll notice that the &lt;code&gt;public&lt;/code&gt; folder of your Craft installation has this file—and that's where all the magic begins!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2017-03-08T01:50:55.277" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19325" PostTypeId="1" CreationDate="2017-03-08T07:17:03.390" Score="1" ViewCount="43" Body="&lt;p&gt;I need a simple plugin for approve access to an entry for specific users. Like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;array with approved entries ids for the currentUser&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;GetApprovedEntries(currentUser.id)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Approve entry for a user (from pending entry ids array)  and add to approvedEntries array and remove from pending array&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ApproveUserForEntry(user.id, entry.id)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;get all approved users for a specific entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;getApprovedUsers(entry.id)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ask for entry access and add to pending array of the user&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;AskEntryAccess(currentUser.id, entry.id)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How I do this (add an array to a user), i am not a plugin developer.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2017-03-08T09:12:20.757" LastActivityDate="2017-03-08T09:12:20.757" Title="How make a simple approve entry plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19327" PostTypeId="1" CreationDate="2017-03-08T09:45:45.007" Score="1" ViewCount="108" Body="&lt;p&gt;Solspace Calendar is a great calendar add-on, and the templates are great - as long as you are using Bootstrap.  However, we mainly use Zurb Foundation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just staring to dive in, but I'm curious if anyone has reconfigured for Foundation?&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2019-05-22T09:26:49.823" Title="Solspace Calendar Minus Bootstrap" Tags="&lt;calendar&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19328" PostTypeId="1" CreationDate="2017-03-08T09:48:41.177" Score="1" ViewCount="96" Body="&lt;p&gt;I'm working at a large organization, where the servers are managed by an IT department. I want to migrate some websites to Craft and asked the IT department to install Craft on a server. The IT department tells me that Mcrypt is not supported by RedHat Enterprise/PHP5.6, so Craft can't be installed &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with server software, are they right? And is it easy to add Mcrypt?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for helping!&lt;/p&gt;&#xA;" OwnerUserId="6388" LastEditorUserId="57" LastEditDate="2017-03-10T01:12:03.450" LastActivityDate="2017-04-09T01:39:23.107" Title="Mcrypt in Red Hat Enterprise" Tags="&lt;mcrypt&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19329" PostTypeId="1" AcceptedAnswerId="19330" CreationDate="2017-03-08T10:10:37.247" Score="2" ViewCount="386" Body="&lt;p&gt;Is there any method to differentiate between a shipping and billing address in Commerce once a customer has gone through a checkout? I ask because if they come back to their account and want to review their attached addresses and edit them, we want to be able to display them as a Shipping Address and a Billing Address. But from the docs, it appears you can only loop through all addresses with no way to really differentiate them beyond their ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a pretty common scenario in B2B stores where there may be different shipping addresses for different outlets but one billing address for the head office.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-03-09T01:14:52.417" Title="Craft Commerce - How To differentiate between Shipping and Billing Addresses?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19330" PostTypeId="2" ParentId="19329" CreationDate="2017-03-08T10:26:52.250" Score="1" Body="&lt;p&gt;Not simple at the moment. This is because a single address could be used for both shipping and billing on an order during checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could subvert an existing address field you don't utilize (like &lt;code&gt;attention&lt;/code&gt; or &lt;code&gt;title&lt;/code&gt;) to store their preference, but that's pretty hacky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user is logged in you have access to their last used shipping and billing addresses with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.commerce.customer.lastUsedBillingAddress ?? '' }}&#xA;{{ craft.commerce.customer.lastUsedshippingAddress ?? '' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you think an &lt;code&gt;address.usedAs&lt;/code&gt; field would be useful? It would likely store something like: &lt;code&gt;billing&lt;/code&gt;, &lt;code&gt;shipping&lt;/code&gt;, or &lt;code&gt;both&lt;/code&gt;. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2017-03-09T01:14:52.417" LastActivityDate="2017-03-09T01:14:52.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19331" PostTypeId="1" CreationDate="2017-03-08T11:28:59.323" Score="1" ViewCount="113" Body="&lt;p&gt;I really like grabcad's 3D viewer feature where the user can rotate, zoom, explode the 3d model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering about adding similar feature to showcase my 3d models on my website and use asset field for project entry to load store file address on the html and have the js framework that is capable to rendering interactive primitive 3D model to hook up the file to the engine to display 3d model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question for folks out there, is there js framework similiar to grabcad's viewer feature? &lt;/p&gt;&#xA;" OwnerUserId="5087" LastActivityDate="2017-03-08T16:57:50.813" Title="3D viewer for Craft CMS" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19332" PostTypeId="1" AcceptedAnswerId="19338" CreationDate="2017-03-08T13:51:45.420" Score="3" ViewCount="539" Body="&lt;p&gt;I'm trying to migrate my site from a PHP5.6 host to a PHP 7 host in preparation for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've copied everything across and am trying to load an exact copy of the production site on a different domain to see if it's all working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I don't make it far.&#xA;On hitting the site I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Uncaught Error: Call to a member function run() on integer in /blah.com.au/htdocs/craft/app/index.php:62&#xA;&#xA;Stack trace:&#xA;#0 /blah.com.au/htdocs/public/index.php(19): require_once()&#xA;#1 {main}&#xA;thrown in /blah.com.au/htdocs/craft/app/index.php on line 62&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are no other details anywhere.&#xA;To avoid cache issues I've also done a fresh upload of Craft and then copied across my config, templates, plugins, public directories etc.&#xA;Exact same error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've updated the config files (db/general) to have the correct paths for this new domain. The database is the same as production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my .htaccess shouldn't be causing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas peoples?&lt;/p&gt;&#xA;" OwnerUserId="6390" LastEditorUserId="22" LastEditDate="2017-05-09T20:20:13.820" LastActivityDate="2017-05-09T20:20:13.820" Title="500 Error with no details on site migration" Tags="&lt;error-message&gt;&lt;craft3&gt;&lt;environments&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19334" PostTypeId="1" CreationDate="2017-03-08T15:10:40.367" Score="1" ViewCount="219" Body="&lt;p&gt;I created my own &lt;code&gt;actionEntrySave&lt;/code&gt; for my frontend form. and I'm using the&lt;br&gt; &lt;code&gt;$entryService-&amp;gt;saveEntry($entry);&lt;/code&gt; method to store my entries into the database.&lt;br&gt;&lt;br&gt;The problem is this does not fire&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event) {&#xA;    die(var_dump(&quot;fired&quot;));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I save/edit the same entry in the backend or create a new one I see an empty page with &quot;fired&quot; there.. (just for testing) and I can manipulate the entry the way I want without any problems. If I do the same in the frontend (saving/editing an entry) the event does not trigger but the entry saves. Can someone explain why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: I already tried onBeforeSaveEntry with the same result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2 Solved&lt;/strong&gt;&#xA;&lt;br&gt;I solved it now.. my error was I did this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryService = new EntriesService();&#xA;$dbInsert = $entryService-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it has to look like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryService = craft()-&amp;gt;entries;&#xA;$dbInsert = $entryService-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought all services were singletons. My mistake&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-03-09T07:58:33.547" LastActivityDate="2017-03-09T07:58:33.547" Title="entries.onSaveEntry does not fire from frontend" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19335" PostTypeId="2" ParentId="19331" CreationDate="2017-03-08T16:57:50.813" Score="1" Body="&lt;p&gt;I know a lot of 3D programs are going to use different file formats. And the viewers tend to vary quite a bit. What are you using?  If you can export to obj format, &lt;a href=&quot;https://manu.ninja/webgl-3d-model-viewer-using-three-js&quot; rel=&quot;nofollow noreferrer&quot;&gt;three.js&lt;/a&gt; seems popular. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also services that do the heavy lifting of embedding as well. (Kind of like Vimeo for models). Just did a little bit of searching, &lt;a href=&quot;https://sketchfab.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;SketchFab&lt;/a&gt; seems interesting and they also offer a free plan. They accept a bunch of file formats plus an API which you could tap in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They also do &lt;a href=&quot;http://oembed.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;oEmbeds&lt;/a&gt; so you could use something like &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embed Assets&lt;/a&gt; to hook into it.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-03-08T16:57:50.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19336" PostTypeId="2" ParentId="19314" CreationDate="2017-03-08T18:07:01.443" Score="1" Body="&lt;p&gt;You could use the category handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't suit your requirements, you can associate custom fields with categories, same as you can with entries.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-08T18:07:01.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19337" PostTypeId="2" ParentId="18653" CreationDate="2017-03-08T20:54:45.410" Score="3" Body="&lt;p&gt;OMG I'm so angry at myself!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; 'true',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2017-03-08T20:54:45.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19338" PostTypeId="2" ParentId="19332" CreationDate="2017-03-08T22:08:26.303" Score="1" Body="&lt;p&gt;It turns out my MySQL wasn't installed correctly.&#xA;I'm using RDS but my setup didn't meet the basic requirements to connect to it from PHP.&lt;/p&gt;&#xA;" OwnerUserId="6390" LastActivityDate="2017-03-08T22:08:26.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19339" PostTypeId="2" ParentId="1748" CreationDate="2017-03-08T23:00:47.427" Score="1" Body="&lt;p&gt;I realize this question is old, but wanted to post this for anyone that runs into the same problem I did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My permissions and system path were correct; however, I was able to get it working by using an &quot;ending forward slash&quot; where I defined the subfolder path:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additionally, you will also want to run a &quot;Reindex Assets&quot; operation located in the Admin Settings.&lt;/p&gt;&#xA;" OwnerUserId="270" LastEditorUserId="270" LastEditDate="2017-03-09T06:32:34.617" LastActivityDate="2017-03-09T06:32:34.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19340" PostTypeId="2" ParentId="19334" CreationDate="2017-03-09T06:35:29.517" Score="2" Body="&lt;p&gt;Where is your &quot;craft()-on()&quot; code located?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per the documentation, the best place is in your primary plugin file in a method named &quot;init()&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here's mine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    // event triggers&#xA;    craft()-&amp;gt;on('charge.onValidate', array($this, '_validateRegistrationForm'));&#xA;    craft()-&amp;gt;on('entries.saveEntry', array($this, '_processEditPricelistLocationForm'));&#xA;    craft()-&amp;gt;on('entries.saveEntry', array($this, '_processEditGuestUsersForm'));&#xA;    craft()-&amp;gt;on('entries.saveEntry', array($this, '_processGuestUserAccessForm'));&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', array($this, '_processEditGuestRemoveUsersForm'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here's just showing that I do in fact handle the Event $event in the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Charge onValidate&#xA; *&#xA; * @param Event $event&#xA; */&#xA;public function _validateRegistrationForm(Event $event)&#xA;{&#xA;    // do stuff&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="270" LastActivityDate="2017-03-09T06:35:29.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19341" PostTypeId="1" CreationDate="2017-03-09T08:16:07.730" Score="2" ViewCount="136" Body="&lt;p&gt;I am new to craftcms, and have installed a fresh copy. I am trying to create a lab version of our company's website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I installed the fresh install, then I imported the database from sql_dump file, and copied over public folder and templates. The site looks the way its supposed to but I cannot login with any of the users in the database. It just accept it without any errors, but nothing happens. The little loading icon shows up for about 1sec and then just nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can still stay in the dashboard with the user I created when installing the fresh copy tho, even tho the user no longer exist. and when I go to users, I get unknown error message and non of the users from the database is there, but the admin section works fine, and I can see my admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to the &quot;craft/storage/runtime/logs/craft.log&quot; I get this message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/03/09 07:49:55 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '-0001-11-30 00:00:00' for column 'dateCreated' at row 1. The SQL statement executed was: UPDATE `craft_users` SET `weekStartDay`=:yp0, `admin`=:yp1, `client`=:yp2, `locked`=:yp3, `suspended`=:yp4, `pending`=:yp5, `archived`=:yp6, `passwordResetRequired`=:yp7, `id`=:yp8, `username`=:yp9, `photo`=:yp10, `firstName`=:yp11, `lastName`=:yp12, `email`=:yp13, `password`=:yp14, `preferredLocale`=:yp15, `lastLoginDate`=:yp16, `lastLoginAttemptIPAddress`=:yp17, `invalidLoginWindowStart`=:yp18, `invalidLoginCount`=:yp19, `lastInvalidLoginDate`=:yp20, `lockoutDate`=:yp21, `verificationCode`=:yp22, `verificationCodeIssuedDate`=:yp23, `unverifiedEmail`=:yp24, `lastPasswordChangeDate`=:yp25, `dateCreated`=:yp26, `dateUpdated`=:yp27, `uid`=:yp28 WHERE `craft_users`.`id`=4.&#xA;2017/03/09 07:49:55 [error] [exception.CDbException] CDbException: CDbCommand klarte ikke å eksekvere SQL uttrykk: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '-0001-11-30 00:00:00' for column 'dateCreated' at row 1 in /home/vagrant/Code/Gantictest/craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 /home/vagrant/Code/Gantictest/craft/app/framework/db/ar/CActiveRecord.php(1754): CDbCommand-&amp;gt;execute()&#xA;#1 /home/vagrant/Code/Gantictest/craft/app/framework/db/ar/CActiveRecord.php(1128): CActiveRecord-&amp;gt;updateByPk('4', Array)&#xA;#2 /home/vagrant/Code/Gantictest/craft/app/framework/db/ar/CActiveRecord.php(810): CActiveRecord-&amp;gt;update(NULL)&#xA;#3 /home/vagrant/Code/Gantictest/craft/app/services/UsersService.php(887): CActiveRecord-&amp;gt;save()&#xA;#4 /home/vagrant/Code/Gantictest/craft/app/models/UserModel.php(436): Craft\UsersService-&amp;gt;unlockUser(Object(Craft\UserModel))&#xA;#5 /home/vagrant/Code/Gantictest/craft/app/elementtypes/UserElementType.php(557): Craft\UserModel::populateModel(Array)&#xA;#6 /home/vagrant/Code/Gantictest/craft/app/services/ElementsService.php(300): Craft\UserElementType-&amp;gt;populateElementModel(Array)&#xA;#7 /home/vagrant/Code/Gantictest/craft/app/services/ElementsService.php(226): Craft\ElementsService-&amp;gt;populateElements(Array, Object(Craft\ElementCriteriaModel), 'content', Array)&#xA;#8 /home/vagrant/Code/Gantictest/craft/app/models/ElementCriteriaModel.php(277): Craft\ElementsService-&amp;gt;findElements(Object(Craft\ElementCriteriaModel))&#xA;#9 /home/vagrant/Code/Gantictest/craft/app/elementtypes/BaseElementType.php(237): Craft\ElementCriteriaModel-&amp;gt;find()&#xA;#10 /home/vagrant/Code/Gantictest/craft/app/controllers/ElementIndexController.php(371): Craft\BaseElementType-&amp;gt;getIndexHtml(Object(Craft\ElementCriteriaModel), Array, Array, '*', 'index', true, true)&#xA;#11 /home/vagrant/Code/Gantictest/craft/app/controllers/ElementIndexController.php(105): Craft\ElementIndexController-&amp;gt;_getElementResponseData(true, true)&#xA;#12 /home/vagrant/Code/Gantictest/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ElementIndexController-&amp;gt;actionGetElements()&#xA;#13 /home/vagrant/Code/Gantictest/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#14 /home/vagrant/Code/Gantictest/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#15 /home/vagrant/Code/Gantictest/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#16 /home/vagrant/Code/Gantictest/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('getElements')&#xA;#17 /home/vagrant/Code/Gantictest/craft/app/etc/web/WebApp.php(817): CWebApplication-&amp;gt;runController('elementIndex/ge...')&#xA;#18 /home/vagrant/Code/Gantictest/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#19 /home/vagrant/Code/Gantictest/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#20 /home/vagrant/Code/Gantictest/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#21 /home/vagrant/Code/Gantictest/public/index.php(19): require_once('/home/vagrant/C...')&#xA;#22 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/elementIndex/getElements&#xA;HTTP_REFERER=http://gantictemp.dev/index.php?p=admin/users&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;any help in pointing me in the right direction will be much appriciated :)&lt;/p&gt;&#xA;" OwnerUserId="6394" LastActivityDate="2017-03-09T12:09:48.503" Title="Unknown error in users section, after importing sql dump. Need help understanding logs" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;database&gt;&lt;error-message&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19343" PostTypeId="2" ParentId="19341" CreationDate="2017-03-09T12:09:48.503" Score="2" Body="&lt;p&gt;It seems to be failing because of the date time &lt;code&gt;'-0001-11-30 00:00:00'&lt;/code&gt;, which doesn't look like a proper date to me.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did you do the database dump via the Craft CMS control Panel (CP), or did you use something else like PhpMyAdmin or Sequel Pro or something? There might be something in the way you made the export that is incompatible with your lab database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I always use the &lt;code&gt;Backup Database&lt;/code&gt; button in the &lt;code&gt;Tools&lt;/code&gt; section of the &lt;code&gt;Settings&lt;/code&gt; when copying the database from one server to another.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-03-09T12:09:48.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19344" PostTypeId="1" CreationDate="2017-03-09T13:40:06.550" Score="1" ViewCount="712" Body="&lt;p&gt;New to Craft CMS. Our corporate website has been built using Craft. When using the site search, it is not finding all pages within the site. Wondering what the search engine technology is and how to re-index or broaden. Also, not crazy about the search results (SERP) display. What customizations are available?&lt;/p&gt;&#xA;" OwnerUserId="6397" LastEditorUserId="57" LastEditDate="2017-03-10T00:48:27.143" LastActivityDate="2017-03-10T00:48:27.143" Title="What search engine does Craft CMS come with?" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19345" PostTypeId="2" ParentId="19344" CreationDate="2017-03-09T14:18:44.607" Score="2" Body="&lt;p&gt;There isn't a built in search for the front end - you have to make the search system yourself, so you have full control over the display of results because you build the whole thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the sound of it you're expecting some sort of search module you can play with in the CMS - that's not likely to be how your site was built. This means that it depends on how your developer has implemented the search template your website is using. You'll need to either learn the template language and play yourself, or else go to a Craft developer who can help you.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-03-09T14:18:44.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19346" PostTypeId="2" ParentId="19344" CreationDate="2017-03-09T14:41:08.587" Score="3" Body="&lt;p&gt;The Craft CMS documentation has &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;some technical information&lt;/a&gt; about how searching works with the various Craft ElementTypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also documentation on &lt;a href=&quot;https://craftcms.com/docs/templating/search-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;setting up a search form&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for a more complete and full-featured search solution, &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;SquareBit's Search Plus&lt;/a&gt; is an excellent option.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-09T14:41:08.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19347" PostTypeId="1" AcceptedAnswerId="19350" CreationDate="2017-03-09T15:16:00.253" Score="2" ViewCount="42" Body="&lt;p&gt;Having a weird issue here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure field inside my section on my panel which is divided up by headings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I'm having is that when I try to collapse a heading via the panel, it doesn't have any effect. It doesn't collapse and sometimes it makes a duplicate of itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its a hard issue to explain over text so I've created a small video to show the issue in action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=vv8vToRCUUw&amp;amp;feature=youtu.be&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=vv8vToRCUUw&amp;amp;feature=youtu.be&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="5435" LastEditorUserId="22" LastEditDate="2017-05-09T20:17:58.960" LastActivityDate="2017-05-09T20:17:58.960" Title="Craft Panel Structure Duplication Issue" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19348" PostTypeId="2" ParentId="19078" CreationDate="2017-03-09T16:01:01.783" Score="0" Body="&lt;p&gt;I ended up with a simple piece of code in /craft/config/contactform.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;switch (CRAFT_LOCALE) {&#xA;    case 'en': $cf_toEmail = 'english@domain.co.uk'; break;&#xA;    case 'de': $cf_toEmail = 'german@domain.de'; break;&#xA;    // .....&#xA;    default:   $cf_toEmail = null;&#xA;}&#xA;&#xA;return array(&#xA;    'toEmail' =&gt; $cf_toEmail,&#xA;    'prependSender' =&gt; '('.craft()-&gt;request-&gt;getPost('fromEmail').')',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;prependSender&lt;/code&gt; in the return array was to troubleshoot another shortcoming that my clients do not like in the emails the CF plugin sends - that there is nowhere to see the &lt;code&gt;fromEmail&lt;/code&gt; in the received email - it is only in the Reply-To header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I chose the config file over the plugin, as it's simpler and less code.&lt;/p&gt;&#xA;" OwnerUserId="6314" LastActivityDate="2017-03-09T16:01:01.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19349" PostTypeId="2" ParentId="19274" CreationDate="2017-03-09T17:20:15.300" Score="1" Body="&lt;p&gt;there is no &lt;code&gt;.with()&lt;/code&gt; method for the ElementCriteriaModel nor is it supported by &lt;code&gt;craft.entries&lt;/code&gt; as a chainable method, meaning that it can't be chained to &lt;code&gt;craft.entries&lt;/code&gt; query like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').with['image'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Especially as an array (hint: you were probably intending to use &lt;code&gt;.with(['image'])&lt;/code&gt; instead of &lt;code&gt;.with['image']&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct syntax for eager loading elements is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'news',&#xA;    with: ['image']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in your case it can be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries({ section: 'news', with:['image'] }) %}&#xA;  {% set image = entry.image[0] ?? null %}&#xA;  {% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;  {% endif %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I remember also being frustrated by eager loading in craft (for some reason I also had problems using it at first), but then it turned to be quite useful. It's especially powerful if you'd like to show more then one image per entry, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i in entry.image %}&#xA;    &amp;lt;img src=&quot;{{ i.url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Take care&lt;/p&gt;&#xA;" OwnerUserId="4035" LastActivityDate="2017-03-09T17:20:15.300" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19350" PostTypeId="2" ParentId="19347" CreationDate="2017-03-09T17:28:18.300" Score="2" Body="&lt;p&gt;That's just a quirky byproduct of two subtle features colliding...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lazy-loading index&lt;/strong&gt; - You don't immediately see the full list of elements. You'll need to keep scrolling down to reveal them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;JS-based collapsing&lt;/strong&gt; - Collapsing/expanding the tree is a client-side behavior. It uses JS to collapse/expand, then stores the current view in a session cookie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behavior is simply a minor local issue... it doesn't affect any actual data in your system. The only real solution is to &lt;strong&gt;refresh the page&lt;/strong&gt; when you start seeing the weirdness. Your collapse/expand choices will be remembered, and the items will be reloaded as expected. &lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-09T17:28:18.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19351" PostTypeId="1" AcceptedAnswerId="19372" CreationDate="2017-03-09T17:46:56.913" Score="1" ViewCount="70" Body="&lt;p&gt;Anyone able to direct me on this?&#xA;I have a page that allows you to pick related entries (cables) within the page I want to output the related entries (cables) but group them by their category. I have the following code by this is adding each cable into each category and not just the cable within the right category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container // island-bottom&quot;&amp;gt;&#xA;    {% set categories = craft.categories.group('cables') %}&#xA;&#xA;    {# {% set cables = craft.entries.section('cables').order('title').limit(null) %} #}&#xA;&#xA;    {% set cables = entry.cables %}&#xA;&#xA;    {% for entry in cables %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;&#xA;    {% for category in categories.relatedTo(cables) %}&#xA;        &amp;lt;div class=&quot;cableGroup&quot;&amp;gt;&#xA;            &amp;lt;h2 class=&quot;panel__title&quot;&amp;gt;{{ category }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;cableGroup__description content // margin-bottomX2&quot;&amp;gt;&#xA;                {{ category.description }}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for entry in cables %}&#xA;                    &amp;lt;li class=&quot;cable&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;#{{ entry.title|camel|upper }}&quot; data-title=&quot;{{ entry.title }} &amp;amp;#xa;&quot;&amp;gt;&#xA;                            &amp;lt;img src=&quot;/assets/img/tmp/cable.jpg&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;                            &amp;lt;h3 class=&quot;cable__tag&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;&#xA;            {% for entry in cables.relatedTo(category) %}&#xA;                &amp;lt;div id=&quot;{{ entry.title|camel|upper }}&quot; class=&quot;modal&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;modal__close&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;#close&quot; title=&quot;Close&quot; class=&quot;modal__closeBtn&quot;&amp;gt;&#xA;                            &amp;lt;span class=&quot;label close&quot;&amp;gt;&amp;lt;span class=&quot;icon-close heavy&quot;&amp;gt;&amp;lt;/span&amp;gt;Close&amp;lt;/span&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;modal__content // cable__modal&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;cable__img&quot;&amp;gt;&#xA;                            &amp;lt;img src=&quot;/assets/img/tmp/cable.jpg&quot; alt=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;cable__content&quot;&amp;gt;&#xA;                            &amp;lt;h3 class=&quot;cable__title&quot;&amp;gt;&#xA;                                {{ entry.title }}&#xA;                            &amp;lt;/h3&amp;gt;&#xA;                            &amp;lt;p&amp;gt;{{ entry.cableDescription }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2017-03-10T00:52:20.387" LastActivityDate="2017-03-10T14:27:34.693" Title="Show related entries grouped by category with category title and description" Tags="&lt;categories&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19352" PostTypeId="1" AcceptedAnswerId="19367" CreationDate="2017-03-09T18:05:52.030" Score="1" ViewCount="709" Body="&lt;p&gt;I've set up a dropdown field for the client to choose from a list of pre-defined addresses.  In my template, I want to determine whether the field has a value or not.  When I look in the database, Entry A has a value of 'NULL', while Entry B has a value of 'address1'.  So the field is working properly in those regards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in my template it's all or nothing.  Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.includeMap|length %}&#xA;&amp;lt;tr&amp;gt;&#xA;    &amp;lt;th class=&quot;small&quot;&amp;gt;&#xA;        Defined? {{ event.includeMap is defined }}&amp;lt;br&amp;gt;&#xA;        Not Null? {{ event.includeMap is not null }}&amp;lt;br&amp;gt;&#xA;        Null: {{ event.includeMap is null }}&amp;lt;br&amp;gt;&#xA;        Value: {{ event.includeMap }}&#xA;    &amp;lt;/th&amp;gt;&#xA;    &amp;lt;td align=&quot;center&quot;&amp;gt;&#xA;        {% include 'partials/_inc-map' %}&#xA;    &amp;lt;/td&amp;gt;&#xA;&amp;lt;/tr&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've added the options in the left column to see what the database returns.  In both cases, they return the same values.  However, with Entry A, nothing is returned as a value, and in Entry B, the correct value appears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.includeMap is defined %}&#xA;{% if event.includeMap is not null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any other thoughts?&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-03-10T06:32:12.943" Title="Testing for Dropdown Value" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19353" PostTypeId="2" ParentId="16331" CreationDate="2017-03-09T19:51:15.283" Score="1" Body="&lt;p&gt;Just to record for others getting this error when adding Locales, I ran into this on Step 1 when ResaveElements for Assets. Seems that there were some entries in craft_assetfiles that no longer existed and caused the task to halt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Managed to debug by checking the step number in craft_tasks, then looking for a row at that position in assetfiles that equated to a missing file. Removed a couple of these rows and the task completed fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had Cleared Caches and Updated Indexes before starting, but seems there are still a few bad entries in the files table&lt;/p&gt;&#xA;" OwnerUserId="536" LastActivityDate="2017-03-09T19:51:15.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19354" PostTypeId="1" CreationDate="2017-03-09T20:04:34.013" Score="1" ViewCount="54" Body="&lt;p&gt;Scenario 1: A language other than English is selected.&#xA;New website.com visits will be in that language.&#xA;Even after switching back to English, websites will continue to load in the previous language. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scenario 2: Website sticks to English on new visits regardless of which language is picked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scenario 3: A different language is selected. &#xA;New website visits will remain on that language until another one is chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to disable saving of language cookies so as to always reproduce scenario 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="6400" LastActivityDate="2017-03-09T20:04:34.013" Title="Language Cookies Issues" Tags="&lt;error&gt;&lt;language&gt;&lt;cookies&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19355" PostTypeId="1" AcceptedAnswerId="19356" CreationDate="2017-03-09T21:06:52.747" Score="1" ViewCount="209" Body="&lt;p&gt;I'm creating a careers page on a site I'm working on and the design is for the jobs to go in an accordian that will slide open on click. So I'm thinking that this would need to be a matrix block as the client will need to be able to add as many jobs to the accordian as they want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is built with bootstrap, so I'm using the &lt;a href=&quot;http://getbootstrap.com/javascript/#collapse-example-accordion&quot; rel=&quot;nofollow noreferrer&quot;&gt;bootstrap accordian&lt;/a&gt; to build it. And for it to work each accordian item needs to have a unique ID, i.e. &lt;code&gt;id=&quot;collapseOne&quot;&lt;/code&gt; which links to href with the same name in the button in order to get it to expand and close. Here's an example of the code for one accordian line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- accordian --&amp;gt;&#xA;  &amp;lt;div class=&quot;panel-group contact-accordian&quot; id=&quot;accordion&quot; role=&quot;tablist&quot; aria-multiselectable=&quot;true&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;panel-heading&quot; role=&quot;tab&quot; id=&quot;headingOne&quot;&amp;gt;&#xA;        &amp;lt;h4 class=&quot;panel-title&quot;&amp;gt;&#xA;          &amp;lt;a role=&quot;button&quot; data-toggle=&quot;collapse&quot; href=&quot;#collapseOne&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapseOne&quot; class=&quot;accordian-toggle&quot;&amp;gt;Senior Construction Planner&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h4&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div id=&quot;collapseOne&quot; class=&quot;panel-collapse collapse&quot; role=&quot;tabpanel&quot; aria-labelledby=&quot;headingOne&quot;&amp;gt;&#xA;&#xA;    ..variable content.. &#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /accordian --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I need to work out a way to get this to work as a matrix field so that the client can add as many jobs as they need in Craft, and for it to function correctly as an accordian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-03-09T21:26:43.510" Title="Use Matrix to let client add Bootstrap Accordian Items" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19356" PostTypeId="2" ParentId="19355" CreationDate="2017-03-09T21:26:43.510" Score="3" Body="&lt;p&gt;Yes, you can make use of the matrix loop index to create unique ID's.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- accordian --&amp;gt;&#xA;  &amp;lt;div class=&quot;panel-group contact-accordian&quot; id=&quot;accordion&quot; role=&quot;tablist&quot; aria-multiselectable=&quot;true&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;panel-heading&quot; role=&quot;tab&quot; id=&quot;headingOne&quot;&amp;gt;&#xA;        &amp;lt;h4 class=&quot;panel-title&quot;&amp;gt;&#xA;          &amp;lt;a role=&quot;button&quot; data-toggle=&quot;collapse&quot; href=&quot;#collapse{{ loop.index }}&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapseOne&quot; class=&quot;accordian-toggle&quot;&amp;gt;Senior Construction Planner&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h4&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div id=&quot;collapse{{ loop.index }}&quot; class=&quot;panel-collapse collapse&quot; role=&quot;tabpanel&quot; aria-labelledby=&quot;headingOne&quot;&amp;gt;&#xA;&#xA;    ..variable content.. &#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /accordian --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="977" LastActivityDate="2017-03-09T21:26:43.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19357" PostTypeId="1" CreationDate="2017-03-09T22:36:06.267" Score="2" ViewCount="1271" Body="&lt;p&gt;I'm using Craft Commerce and every time I click the Add to Cart button for a product, I'm redirected to the Cart page. This works okay, but I'd like to use AJAX (with jQuery v1.12.4) for this to save being redirected to the Cart page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not great with JS though, so I was trying to find a complete working example for this in the demo templates get me started but I couldn't find one. I did find a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17347/update-commerce-cart-using-ajax&quot;&gt;similar question&lt;/a&gt; on here, but I don't think that's a complete working example as when I tried putting the JS from that example in my own functions.js file, I was getting a syntax error, so this is why I'm asking my own question. Thanks in advance for any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'm using to show how many items have been added to the cart in the header:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.cart %}&#xA;&amp;lt;a href=&quot;/basket&quot;&amp;gt;({{ cart.lineItems|length }}) Items&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the markup I'm using for the current non-AJAX add to cart form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for product in products %}&#xA;&#xA;  {% for purchasable in product.variants %}&#xA;&#xA;    &amp;lt;form method=&quot;POST&quot; id=&quot;addToCartForm&quot;&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;basket&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;&#xA;      &amp;lt;h2&amp;gt;{{ product.title }}&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ purchasable.price|commerceCurrency(cart.currency) }}&amp;lt;/p&amp;gt;&#xA;      &amp;lt;input name=&quot;qty&quot; type=&quot;number&quot; min=&quot;1&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;Add to Cart&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my functions.JS file (i.e. empty after getting nowhere with other examples that I was trying to cobble together):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function() {&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-03-22T18:41:56.553" Title="Complete working example for adding Craft Commerce items to the cart using AJAX and jQuery?" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19358" PostTypeId="2" ParentId="19357" CreationDate="2017-03-09T23:22:32.773" Score="2" Body="&lt;p&gt;The question you link to - that is a working example really except you a) might not need the CSRF stuff if you haven't turned on CSRF protection (you should, though) - and of course the &lt;code&gt;...&lt;/code&gt; at the end means you should at least finish off the function and do some error handling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, in this specific case, you should just in essence need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function() {&#xA;&#xA;    $form = $(&quot;#addToCartForm&quot;);&#xA;&#xA;    // handle submits via ajax&#xA;&#xA;    $form.on('submit', function(e) {&#xA;&#xA;        //Prevent the default submission&#xA;        e.preventDefault();&#xA;&#xA;        //Get the form data&#xA;        var form_data = $form.serializeArray();&#xA;&#xA;        // ajax it over to the server&#xA;        $.ajax({&#xA;            type: 'post',&#xA;            url: '/',&#xA;            data: form_data,&#xA;            success: function(response) {&#xA;                if (response.success) {&#xA;                    alert(response.cart);&#xA;                }&#xA;                else {&#xA;                    alert(&quot;Failure!&quot;);&#xA;                }&#xA;            }&#xA;        });        &#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;..although I am doing this on my phone.  So if you get syntax errors let me know!&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2017-03-22T18:41:56.553" LastActivityDate="2017-03-22T18:41:56.553" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19359" PostTypeId="2" ParentId="19299" CreationDate="2017-03-09T23:28:10.557" Score="1" Body="&lt;p&gt;Author of EA here. Adding in that &lt;code&gt;extraAllowedFileExtensions&lt;/code&gt; config setting is about all you need to do. Any other configuration is just for &quot;power&quot; users (for lack of a better term) and you shouldn't need to worry about them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's many reasons why you might not be seeing anything show up in your templates. You also said it sometimes breaks the page altogether? Can you please elaborate on this? Are you running in dev mode? If there are any errors, what are they?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be better for you to post this as an &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue on the Github page&lt;/a&gt;, so it can be more of a discussion. I don't really have an answer for you as I don't yet know what the cause of the problem is.&lt;/p&gt;&#xA;" OwnerUserId="3811" LastActivityDate="2017-03-09T23:28:10.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19360" PostTypeId="2" ParentId="19271" CreationDate="2017-03-09T23:41:37.843" Score="1" Body="&lt;p&gt;In essence, if I am reading that right, can you reverse the question?  I.e. it seems that what you want to know is, for each accessory in the cart, is there a reverse relation back to at least one product in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is definitely possible - you can read about reverse relations here: &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&lt;/a&gt; and of course at &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..basically just loop through each accessory and check the &lt;code&gt;|length&lt;/code&gt; of the result of a &lt;code&gt;relatedTo&lt;/code&gt; that specifies what you want it to be related to (.e.g a product category).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-09T23:41:37.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19362" PostTypeId="2" ParentId="19328" CreationDate="2017-03-10T01:15:35.780" Score="1" Body="&lt;p&gt;I don't know what version of RHEL they're running, but it could certainly be added.  Whether your IT department will support it or if that breaks some support contract your company has with RH is another question all-together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, Craft 3/Yii 2 has done away with mcrypt in favor of OpenSSL, so it's not an issue there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-10T01:15:35.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19363" PostTypeId="1" CreationDate="2017-03-10T05:23:41.423" Score="2" ViewCount="1330" Body="&lt;p&gt;&lt;strong&gt;*Update: Installed MAMP Pro, reinstalled Craft, asset upload is working now. Not exactly a fix, but seemed like the simplest route of action due to my unfamiliarity with PHP. Thanks to those who responded to my question.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a newcomer to web development and Craft CMS. I've downloaded and installed Craft CMS locally and I'm following along with an &quot;Up and Running With Craft CMS&quot; tutorial to get my bearings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to upload assets via an asset field. The upload box appears and after selecting a file to upload the progress bar fills and freezes and the loading wheel spins on forever. Due to this I can't upload any images and therefore can't create my site properly. Please help!&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PpOGa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PpOGa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6407" LastEditorUserId="6407" LastEditDate="2017-03-11T01:04:14.417" LastActivityDate="2017-03-11T01:04:14.417" Title="Asset Uploading via Assets Field Broken, please help" Tags="&lt;assets&gt;&lt;image&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19364" PostTypeId="1" AcceptedAnswerId="19365" CreationDate="2017-03-10T06:11:09.073" Score="4" ViewCount="545" Body="&lt;p&gt;I'm trying to use global variables in Entry URLs generated by Craft, but they seem to be empty. Not getting any errors as such, just null. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Entry URL format looks like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{siteDefaults.artworksList.first.uri|default}}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where artworkList is an entry with a URI/URL but I'm getting &quot;/some-entry-slug&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, &lt;code&gt;{{siteDefaults.artworksList.length}}&lt;/code&gt; returns 0 even though there is an entry there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone tried to use globals before in entry URLs? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2017-03-10T06:29:40.337" LastActivityDate="2017-03-10T06:29:40.337" Title="Use global values in the Entry URL Format field" Tags="&lt;entry&gt;&lt;url&gt;&lt;sections&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19365" PostTypeId="2" ParentId="19364" CreationDate="2017-03-10T06:15:16.413" Score="5" Body="&lt;p&gt;Your CraftCMS global can be accessed using the code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{craft.globals.getSetByHandle('siteDefaults').artworksList.first.uri|default}}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe the issue is that the Entry URL field requires you to use &lt;code&gt;craft.globals&lt;/code&gt; to prevent issues with the routing custom variables.&lt;/p&gt;&#xA;" OwnerUserId="3522" LastActivityDate="2017-03-10T06:15:16.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19366" PostTypeId="2" ParentId="19363" CreationDate="2017-03-10T06:31:29.370" Score="2" Body="&lt;p&gt;Checking the logs is of course recommended:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/storage/runtime/logs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I have personally found that failed uploads are related to &quot;write&quot; issues where either the directory permissions are invalid or the actual upload path doesn't exist (aka invalid).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One simple way to potentially obtain more information is to look at the actual HTTP response for the &quot;upload file&quot; AJAX request. I often do this via Chrome's Developer Tools' Network tab.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open Chrome Developer Tools&lt;/li&gt;&#xA;&lt;li&gt;Click the &quot;Network&quot; tab.&lt;/li&gt;&#xA;&lt;li&gt;Perform the file upload.&lt;/li&gt;&#xA;&lt;li&gt;Click on the &quot;uploadFile&quot; request that was generated&lt;/li&gt;&#xA;&lt;li&gt;Click the &quot;Response&quot; tab to view the completed response (which will appear once the response is returned).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bvknc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bvknc.png&quot; alt=&quot;Chrome Developer Tools Network Tab&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="270" LastEditorUserId="270" LastEditDate="2017-03-10T18:04:46.977" LastActivityDate="2017-03-10T18:04:46.977" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19367" PostTypeId="2" ParentId="19352" CreationDate="2017-03-10T06:32:12.943" Score="4" Body="&lt;p&gt;If you've got a dropdown field defined with no value as one of the options, it should be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.dropdownFieldHandle %}&#xA;    {{ entry.dropdownFieldHandle }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-10T06:32:12.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19368" PostTypeId="2" ParentId="19363" CreationDate="2017-03-10T06:38:55.040" Score="2" Body="&lt;p&gt;This is normally caused due to a 500 error and monitoring the AJAX request using your browser's dev toolbar or using the log file &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; should give you a clearer picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible your missing a PHP module called GD or if you have used the CraftCMS auto-update feature sometimes it misses files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are missing the GD PHP module you can install it using your prefer package manager (yum, apt-get, brew, etc) or if installed or your using XAMPP/ MAMP you can add it to your PHP.ini and it should resolve your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's missing PHP files from an auto-update you can override/ replace the &lt;code&gt;craft/app&lt;/code&gt; folder using the original from Github or the CraftCMS website. This option would update your CMS in the process and shouldn't be needed if its a new install/ downloaded build.&lt;/p&gt;&#xA;" OwnerUserId="3522" LastActivityDate="2017-03-10T06:38:55.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19369" PostTypeId="2" ParentId="19351" CreationDate="2017-03-10T09:32:24.837" Score="2" Body="&lt;p&gt;Your example is a trifle confusing, but in answer to your general question about grouping entries by a category field, &lt;a href=&quot;https://github.com/timkelty/craft-groupby/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tim Kelty's groupBy plugin&lt;/a&gt; may help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEntries = allEntries|groupBy('myCategoryField.title', 'Oddments') %}&#xA;{% for categoryTitle, categoryEntries in groupedEntries %}&#xA;    &amp;lt;h2&amp;gt;{{ categoryTitle }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for categoryEntry in categoryEntries %}&#xA;        {{ categoryEntry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-10T09:32:24.837" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19370" PostTypeId="1" AcceptedAnswerId="19420" CreationDate="2017-03-10T11:18:11.853" Score="0" ViewCount="327" Body="&lt;p&gt;I'm trying to query for certain products but only ones that have stock (the products just have defaultVariants):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set earliestDate = now | date_modify('- 1 days') %} &#xA;{% set latestDate = now | date_modify('+ 10 days') %}&#xA;{% set products = craft.commerce.products({&#xA;    hasVariants: {&#xA;        hasStock: true&#xA;    },&#xA;    type: 'class',&#xA;    date: 'and, &amp;gt; ' ~ earliestDate ~ ', &amp;lt; ' ~ latestDate,&#xA;    order: 'date',&#xA;    limit: 5&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above returns 5 products, all of which happen to have no stock left as identified by them not showing when I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.defaultVariant.stock &amp;gt; 0 %}&#xA;    {{ product.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm currently getting products to show by setting the limit to 25 and then it only shows 1 product in stock. Meaning the query is returning 25 products, of which 24 have no stock so shouldn't be returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running Craft Commerce 1.2.1337 so am up-to-date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could be related to: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18663/commerce-products-returning-different-results-on-page-load&quot;&gt;Commerce products returning different results on page load&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone else mentioning it in comment to answer of this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17160/how-do-i-check-if-a-product-has-stock-in-any-of-its-variants/17168#17168&quot;&gt;How do I check if a product has stock in any of it&amp;#39;s variants?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.160" LastActivityDate="2017-03-14T03:54:47.903" Title="Craft Commerce hasStock not working?" Tags="&lt;plugin-craftcommerce&gt;&lt;stock&gt;&lt;products&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19371" PostTypeId="1" AcceptedAnswerId="23711" CreationDate="2017-03-10T14:25:43.000" Score="3" ViewCount="565" Body="&lt;p&gt;Any idea why the following would be ignored following a frontend new password form? The user group does not have access to the control panel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'setPasswordPath' =&amp;gt; 'account/login/password/new',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following success path on the next line works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'setPasswordSuccessPath' =&amp;gt; 'account/login/password/done',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The user workflow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start on frontend Register form with firstname, lastname, email and password.&lt;/li&gt;&#xA;&lt;li&gt;Account created and user is logged-in. No email confirmation needed.&lt;/li&gt;&#xA;&lt;li&gt;User logs out.&lt;/li&gt;&#xA;&lt;li&gt;User completes Forgotten Password form and email is sent.&lt;/li&gt;&#xA;&lt;li&gt;User clicks password link in email and sees the Craft CMS password form.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've tried this with and without the email address having a pre-existing Craft Commerce order associated with it. The result is the same.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-03-13T09:33:55.447" LastActivityDate="2019-11-28T00:26:48.303" Title="setPasswordPath being ignored" Tags="&lt;config&gt;&lt;login&gt;&lt;password&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19372" PostTypeId="2" ParentId="19351" CreationDate="2017-03-10T14:27:34.693" Score="1" Body="&lt;p&gt;With the use of &lt;a href=&quot;https://github.com/timkelty/craft-groupby/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tim Kelty's groupBy plugin&lt;/a&gt; and some initial direction from @stephenlewis (thanks). The following code seems to have resolved my issue. I am little surprised this couldn't be achieved natively though. Unless there is a native solution, but I tried various approaches.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container // island-bottom&quot;&amp;gt;&#xA;&#xA;{% set cables       = entry.cables.find() %}&#xA;{% set cableCats    = craft.categories.group('cables') %}&#xA;&#xA;{% set groupedEntries = cables|groupBy('cableCategory.title') %}&#xA;{% for cableGroups in groupedEntries %}&#xA;&amp;lt;div class=&quot;cableGroup&quot;&amp;gt;&#xA;    {% for category in cableCats.relatedTo(cableGroups) %}&#xA;    &amp;lt;h2 class=&quot;panel__title&quot;&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;div class=&quot;cableGroup__description content // margin-bottomX2&quot;&amp;gt;&#xA;        {{ category.description }}&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% for cable in cableGroups %}&#xA;        {% if loop.first %}&amp;lt;ul&amp;gt;{% endif -%}&#xA;            &amp;lt;li class=&quot;cable&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;#{{ cable.title|camel|upper }}&quot; data-title=&quot;{{ cable.title }} &amp;amp;#xa;&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;/assets/img/tmp/cable.jpg&quot; alt=&quot;{{ cable.title }}&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;cable__tag&quot;&amp;gt;{{ cable.title }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for cable in cableGroups %}&#xA;        &amp;lt;div id=&quot;{{ cable.title|camel|upper }}&quot; class=&quot;modal&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;modal__close&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;#close&quot; title=&quot;Close&quot; class=&quot;modal__closeBtn&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;label close&quot;&amp;gt;&amp;lt;span class=&quot;icon-close heavy&quot;&amp;gt;&amp;lt;/span&amp;gt;Close&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;modal__content // cable__modal&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;cable__img&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;/assets/img/tmp/cable.jpg&quot; alt=&quot;{{ cable.title }}&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;cable__content&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;cable__title&quot;&amp;gt;&#xA;                        {{ cable.title }}&#xA;                    &amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ cable.cableDescription }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-03-10T14:27:34.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19373" PostTypeId="1" AcceptedAnswerId="19378" CreationDate="2017-03-10T14:47:00.540" Score="6" ViewCount="830" Body="&lt;p&gt;How do I change the default font (Trebuchet) of Redactor II to Arial, for instance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to override the default CSS of Redactor. Please help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tnx in advance!&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2017-03-15T14:08:13.853" Title="Change font of Redactor II" Tags="&lt;redactor&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19374" PostTypeId="1" AcceptedAnswerId="19377" CreationDate="2017-03-10T15:08:37.227" Score="2" ViewCount="344" Body="&lt;p&gt;I am trying query against URL segments. Where I am hung up is how to pass those arguments to a related field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is my current query:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profiles = craft.entries({&#xA;    section: 'profiles',&#xA;    with: ['userAccount']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;userAccount&lt;/code&gt; is a user field that is related back to the user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get all entries along with the user account information &amp;amp; all is well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to query &lt;em&gt;against&lt;/em&gt; the &lt;code&gt;userAcount&lt;/code&gt; field to only return the appropriate entries in the &lt;code&gt;profile&lt;/code&gt; section given url segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;www.mysite.com/profiles/foo/2017&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the &lt;code&gt;userAccount&lt;/code&gt; field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;foo&lt;/code&gt; is a checkbox field (name is &lt;code&gt;userOptions&lt;/code&gt;. Options are: &lt;code&gt;foo&lt;/code&gt;, &lt;code&gt;bar&lt;/code&gt;, &lt;code&gt;baz&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;`2017 is a plain text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I am trying to accomplish (obviously is not correct)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profiles = craft.entries({&#xA;    section: 'profiles',&#xA;    with: ['userAccount'],&#xA;    where: ['userAccount[0].year', '=', craft.request.segment('3')],&#xA;    where: ['userAccount[0].userOptions', '=', craft.request.segment('2')],&#xA;   limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting entries bak when I only query against the year. I haven't checked if they are &lt;em&gt;correct&lt;/em&gt; but at least I get something. Where I'm thrown is since &lt;code&gt;userOptions&lt;/code&gt; could be any value, how can I check that field if a selected option matches the url segment? Any user could have &lt;code&gt;foo&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;bar&lt;/code&gt; selected. I think I need something like a &lt;code&gt;WHERE IN&lt;/code&gt; or something...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="57" LastEditDate="2017-03-10T18:59:51.533" LastActivityDate="2017-03-10T18:59:51.533" Title="How can I use a WHERE statement in my template?" Tags="&lt;templating&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19375" PostTypeId="1" CreationDate="2017-03-10T15:17:09.860" Score="2" ViewCount="69" Body="&lt;p&gt;When a user is created with the same email as a customer, the orders are attached to that user account. I have a Customer Info custom field attached to the Users, and that is updated to include the order, which is great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible for the addresses within that order to be carried over to that same Customer Info field as well? I know that if a new address is added now they're a user then that would be saved. But what about carrying over addresses from the pre-existing order?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-03-11T00:24:33.383" Title="Carry address over with customer's order when creating user" Tags="&lt;plugin-craftcommerce&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19377" PostTypeId="2" ParentId="19374" CreationDate="2017-03-10T15:30:57.840" Score="4" Body="&lt;p&gt;You would first need to query for the users that match your criteria and than query for the profile entries which are related to one of these users.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userIds = craft.users({&#xA;    year: craft.request.getSegment(3),&#xA;    userOptions: craft.request.getSegment(2),&#xA;}).ids() %}&#xA;&#xA;{% set profiles = craft.entries({&#xA;    section: 'profiles',&#xA;    relatedTo: {&#xA;        targetElement: userIds,&#xA;        field: 'userAccount',&#xA;    },&#xA;    with: ['userAccount'],&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-03-10T15:30:57.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19378" PostTypeId="2" ParentId="19373" CreationDate="2017-03-10T15:39:30.080" Score="9" Body="&lt;p&gt;You could use &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;the Control Panel CSS plugin&lt;/a&gt; that lets you add arbitrary css to the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could target all redactor fields like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor-layer * {&#xA;    font-family: 'Arial';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;&lt;strong&gt;EDIT&lt;/strong&gt; slightly more troubling is that you are getting Trebuchet in the first place, it should be Arial anyway.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; it turns out this change came about in a recent Craft update (&lt;a href=&quot;https://craftcms.com/changelog#2-6-2963&quot; rel=&quot;noreferrer&quot;&gt;2.6.2963&lt;/a&gt;) that updated Redactor II from 1.3.2 to 2.2. My best guess is that it crept in to the Redactor II 2.0 release, which also included the change to the toolbar icons.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2017-03-13T13:45:46.700" LastActivityDate="2017-03-13T13:45:46.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19379" PostTypeId="1" CreationDate="2017-03-10T16:06:35.613" Score="0" ViewCount="2033" Body="&lt;p&gt;How can I embed an iframe on my site? I tried pasting the iframe code in the HTML section and it didn't appear. &lt;/p&gt;&#xA;" OwnerUserId="6410" LastActivityDate="2019-07-24T15:49:36.300" Title="How can I embed an iframe on my site?" Tags="&lt;embed&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19380" PostTypeId="2" ParentId="17250" CreationDate="2017-03-10T17:41:13.650" Score="3" Body="&lt;p&gt;I've created a plugin called &lt;a href=&quot;https://superbig.co/plugins/published-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;Published Event&lt;/a&gt; does exactly what Brad suggests in his answer. It fires off an event when a entry moves from pending to live.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-03-10T17:41:13.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19381" PostTypeId="2" ParentId="17746" CreationDate="2017-03-10T17:44:32.987" Score="1" Body="&lt;p&gt;I've created a plugin called &lt;a href=&quot;https://superbig.co/plugins/published-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;Published Event&lt;/a&gt; does exactly what Brad suggests in his answer. It fires off an event when a entry moves from pending to live.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-03-10T17:44:32.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19382" PostTypeId="2" ParentId="16748" CreationDate="2017-03-10T18:06:16.150" Score="1" Body="&lt;p&gt;I think that the official Craft CMS documentation provides an answer to your question really clearly: &lt;a href=&quot;https://craftcms.com/support/entry-archive&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entry-archive&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set childEntires = craft.entries({&#xA;    'section': 'mySection',&#xA;    'level': 2,&#xA;    'descendantOf': author.id&#xA;})%}&#xA;&#xA;{% for date, entries in childEntires | group(&quot;myDate|date('Y')&quot;) %}&#xA;    &amp;lt;h2&amp;gt;{{ date }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.myDate | Y }} &amp;gt; {{ entry.type.name }} - {{ entry.foo }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4208" LastEditorUserId="4208" LastEditDate="2017-03-10T19:01:24.007" LastActivityDate="2017-03-10T19:01:24.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19383" PostTypeId="1" AcceptedAnswerId="19414" CreationDate="2017-03-10T19:36:27.107" Score="4" ViewCount="1672" Body="&lt;p&gt;staging.website.com loads perfectly over https. However, https admin pages immediately break because the assets are trying to load over http. If I navigate to the https asset directly, it loads fine. It would seem that Craft is failing to recognize the https request and kick over to the https url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server Setup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cloudflare DNS / SSL&lt;/li&gt;&#xA;&lt;li&gt;Arcustech VPS with Ubuntu &amp;amp; Apache&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How I am enforcing HTTPS currently:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cloudflare Page Rule (Always Use HTTPS)&lt;/li&gt;&#xA;&lt;li&gt;Craft config: general.php &gt; environmentVariables (siteUrl, baseCpUrl, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I do not have any https redirects going in my .htaccess - just the standard craft index.php logic. Adding https rules in the .htaccess will cause infinite loop redirects.&lt;/p&gt;&#xA;" OwnerUserId="3987" LastEditorUserId="3987" LastEditDate="2017-03-13T15:36:51.080" LastActivityDate="2020-03-26T20:15:39.533" Title="Craft Admin assets do not load over https (Apache &amp; Cloudflare)" Tags="&lt;apache&gt;&lt;https&gt;&lt;cloudflare&gt;" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19384" PostTypeId="1" CreationDate="2017-03-10T20:31:22.193" Score="1" ViewCount="288" Body="&lt;p&gt;I am working on extending the &lt;a href=&quot;https://github.com/roundhouse/FormBuilder-2-Craft-CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;formbuilder2&lt;/a&gt; plugin to call and pass the $event variable to a custom Controller after FormBuilder2 has initialized the &quot;onBeforeSave&quot; event within the FormBuilder2 Entry_Controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background Info&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Trying to extend the Formbuilder2 plugin&lt;/li&gt;&#xA;&lt;li&gt;My plugin is called FormBuilder2ExtensionPlugin&lt;/li&gt;&#xA;&lt;li&gt;Trying to call a Controller Function from within my FormBuilder2Extension_NotifyController and pass $event variables.&lt;/li&gt;&#xA;&lt;li&gt;Within my FormBuilder2Extension_NotifyController, I am calling the actionNotifyAdmin($event) function.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Plugin Logic:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;FormBuilder2 Plugin saves entry and initializes the &quot;onBeforeSave&quot;&#xA;event.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FormBuilder2Extension Plugin listens for &quot;onBeforeSave&quot;&#xA;event, and triggers a custom controller function to run. &lt;em&gt;Note: Must be&#xA;able to pass the $event variables to the new FormBuilder2Extension&#xA;controller function as well.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FormBuilder2Extension Controller will then parse $event data, and&#xA;run other FormBuilder2 Controller &amp;amp; Service functions using the $data, so I will need to link from FormBuilder2Extension Controller functions to Formuilder2 Controller functions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cannot figure out how to run a Controller Function from within the init() event listener and pass the $event variables as well.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Current Code: (within main plugin file)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function init()&#xA;   {&#xA;       parent::init();&#xA;&#xA;       craft()-&amp;gt;on('formBuilder2_entry.beforeSave', function(Event $event)&#xA;       {&#xA;&#xA;         $url = UrlHelper::getActionUrl('formBuilder2Extension/notify/notifyAdmin', array('event' =&amp;gt; $event));&#xA;&#xA;         return;&#xA;       });&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Closing Remarks:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works if I use a service function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &lt;code&gt;craft()-&amp;gt;formBuilder2Extension_notify-&amp;gt;notifySubmitterOfSubmission($event);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would rather not rewrite the same Controller &amp;amp; Service functions that formbuilder2 has already written and place it within my service folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts…? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6411" LastEditorUserId="22" LastEditDate="2017-05-09T20:16:09.483" LastActivityDate="2017-05-09T20:16:09.483" Title="Trouble calling a plugin's controller function from within an event listener function" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19385" PostTypeId="2" ParentId="19375" CreationDate="2017-03-11T00:24:33.383" Score="1" Body="&lt;p&gt;It's not implemented, but possible.  I think it should be part of Commerce core really, and done when the user is created by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, my Register On Checkout plugin does this - &lt;a href=&quot;https://github.com/bossanova808/CommerceRegisterOnCheckout&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bossanova808/CommerceRegisterOnCheckout&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could adapt this more generally I guess to listen to all user registrations and see if there are addresses to move over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual code that updates the addresses is here: &lt;a href=&quot;https://github.com/bossanova808/CommerceRegisterOnCheckout/blob/master/commerceregisteroncheckout/CommerceRegisterOnCheckoutPlugin.php#L312&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bossanova808/CommerceRegisterOnCheckout/blob/master/commerceregisteroncheckout/CommerceRegisterOnCheckoutPlugin.php#L312&lt;/a&gt; ... but most of the init method would be relevant I guess.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-11T00:24:33.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19386" PostTypeId="1" AcceptedAnswerId="19393" CreationDate="2017-03-11T02:41:05.803" Score="2" ViewCount="490" Body="&lt;p&gt;I ran into an issue updating Craft and Craft Commerce in my development environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Laravel Valet. As soon as I want to update (tried manual as well) Craft will throw the error :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to determine URL path info. Please make sure $_SERVER[&quot;PATH_INFO&quot;] (or $_SERVER[&quot;PHP_SELF&quot;] and $_SERVER[&quot;SCRIPT_NAME&quot;]) contains proper value.&#xA;Please talk to your host/IT department about upgrading your server.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Error in the logs is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/03/09 16:11:10 [error] [exception.Craft\HttpException.400] Craft\HttpException in /Users/hendrik/Documents/Github/Projects/app/dist/craft/app/controllers/BaseController.php:217&#xA;    Stack trace: -0 /Users/hendrik/Documents/Github/Projects/app/dist/craft/app/controllers/UpdateController.php(192): Craft\BaseController-&amp;gt;requireAjaxRequest() -1 /Users/hendrik/Documents/Github/Projects/app/dist/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController-&amp;gt;actionPrepare()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I already figured that setting &lt;code&gt;$_SERVER['PHP_SELF']&lt;/code&gt; to the same value as &lt;code&gt;$_SERVER['SCRIPT_NAME']&lt;/code&gt; would solve the issue, but I cant make it work somehowe... I am sure I am missing something, my project folder structure is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;App&#xA;|-- dist&#xA;|   |-- craft&#xA;|   `-- public&#xA;`-- src&#xA;    `-- index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the Valet CraftMultiLocaleValetDriver.php I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;class CraftMultiLocaleValetDriver extends ValetDriver&#xA;{&#xA;    /**&#xA;     * Determine if the driver serves the request.&#xA;     *&#xA;     * @param  string  $sitePath&#xA;     * @param  string  $siteName&#xA;     * @param  string  $uri&#xA;     * @return bool&#xA;     */&#xA;    public function serves($sitePath, $siteName, $uri)&#xA;    {&#xA;        return is_dir($sitePath.'/craft');&#xA;    }&#xA;&#xA;    /**&#xA;     * Determine if the incoming request is for a static file.&#xA;     *&#xA;     * @param  string  $sitePath&#xA;     * @param  string  $siteName&#xA;     * @param  string  $uri&#xA;     * @return string|false&#xA;     */&#xA;    public function isStaticFile($sitePath, $siteName, $uri)&#xA;    {&#xA;        if ($this-&amp;gt;isActualFile($staticFilePath = $sitePath.'/public'.$uri)) {&#xA;            return $staticFilePath;&#xA;        }&#xA;&#xA;        return false;&#xA;    }&#xA;&#xA;    /**&#xA;     * Get the fully resolved path to the application's front controller.&#xA;     *&#xA;     * @param  string  $sitePath&#xA;     * @param  string  $siteName&#xA;     * @param  string  $uri&#xA;     * @return string&#xA;     */&#xA;    public function frontControllerPath($sitePath, $siteName, $uri)&#xA;    {&#xA;        // Default index path&#xA;        $indexPath = $sitePath.'/src/index.php';&#xA;        $scriptName = '/index.php';&#xA;&#xA;        // Check if the first URL segment matches any of the defined locales&#xA;        $locales = [&#xA;            'ar',&#xA;            'ar_sa',&#xA;            'bg',&#xA;            'bg_bg',&#xA;            'ca_es',&#xA;            'cs',&#xA;            'cy_gb',&#xA;            'da',&#xA;            'da_dk',&#xA;            'de',&#xA;            'de_at',&#xA;            'de_ch',&#xA;            'de_de',&#xA;            'el',&#xA;            'el_gr',&#xA;            'en',&#xA;            'en_as',&#xA;            'en_au',&#xA;            'en_bb',&#xA;            'en_be',&#xA;            'en_bm',&#xA;            'en_bw',&#xA;            'en_bz',&#xA;            'en_ca',&#xA;            'en_dsrt',&#xA;            'en_dsrt_us',&#xA;            'en_gb',&#xA;            'en_gu',&#xA;            'en_gy',&#xA;            'en_hk',&#xA;            'en_ie',&#xA;            'en_in',&#xA;            'en_jm',&#xA;            'en_mh',&#xA;            'en_mp',&#xA;            'en_mt',&#xA;            'en_mu',&#xA;            'en_na',&#xA;            'en_nz',&#xA;            'en_ph',&#xA;            'en_pk',&#xA;            'en_sg',&#xA;            'en_shaw',&#xA;            'en_tt',&#xA;            'en_um',&#xA;            'en_us',&#xA;            'en_us_posix',&#xA;            'en_vi',&#xA;            'en_za',&#xA;            'en_zw',&#xA;            'en_zz',&#xA;            'es',&#xA;            'es_cl',&#xA;            'es_es',&#xA;            'es_mx',&#xA;            'es_us',&#xA;            'es_ve',&#xA;            'et',&#xA;            'fi',&#xA;            'fi_fi',&#xA;            'fil',&#xA;            'fr',&#xA;            'fr_be',&#xA;            'fr_ca',&#xA;            'fr_ch',&#xA;            'fr_fr',&#xA;            'fr_ma',&#xA;            'he',&#xA;            'hr',&#xA;            'hr_hr',&#xA;            'hu',&#xA;            'hu_hu',&#xA;            'id',&#xA;            'id_id',&#xA;            'it',&#xA;            'it_ch',&#xA;            'it_it',&#xA;            'ja',&#xA;            'ja_jp',&#xA;            'ko',&#xA;            'ko_kr',&#xA;            'lt',&#xA;            'lv',&#xA;            'ms',&#xA;            'ms_my',&#xA;            'nb',&#xA;            'nb_no',&#xA;            'nl',&#xA;            'nl_be',&#xA;            'nl_nl',&#xA;            'nn',&#xA;            'nn_no',&#xA;            'no',&#xA;            'pl',&#xA;            'pl_pl',&#xA;            'pt',&#xA;            'pt_br',&#xA;            'pt_pt',&#xA;            'ro',&#xA;            'ro_ro',&#xA;            'ru',&#xA;            'ru_ru',&#xA;            'sk',&#xA;            'sl',&#xA;            'sr',&#xA;            'sv',&#xA;            'sv_se',&#xA;            'th',&#xA;            'th_th',&#xA;            'tr',&#xA;            'tr_tr',&#xA;            'uk',&#xA;            'vi',&#xA;            'zh',&#xA;            'zh_cn',&#xA;            'zh_tw',&#xA;        ];&#xA;        $parts = explode('/', $uri);&#xA;&#xA;        if (count($parts) &amp;gt; 1 &amp;amp;&amp;amp; in_array($parts[1], $locales)) {&#xA;            $indexPath = $sitePath.'/src/'. $parts[1] .'/index.php';&#xA;            $scriptName = '/' . $parts[1] . '/index.php';&#xA;        }&#xA;&#xA;        $_SERVER['SCRIPT_FILENAME'] = $indexPath;&#xA;        $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];&#xA;        $_SERVER['SCRIPT_NAME'] = $scriptName;&#xA;&#xA;        return $indexPath;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just put it in the .Valet/drivers/ folder and restarted Valet, what am i missing, how can i check of the path is set right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot. &lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2017-03-11T05:06:50.803" LastActivityDate="2017-03-11T22:29:38.883" Title="Updating Craft in Laravel Valet dev enviornment" Tags="&lt;control-panel&gt;&lt;database&gt;&lt;updates&gt;&lt;valet&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19387" PostTypeId="2" ParentId="19384" CreationDate="2017-03-11T08:37:16.480" Score="2" Body="&lt;p&gt;You really, really shouldn't do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with FormBuilder, but if it is well-built, its controllers will comprise thin methods calling services to do the grunt work; services which you can also call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there isn't a service method which does what you want (still assuming everything is well-architected), that means the author chose not to make that functionality part of FormBuilder's API, presumably for a good reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If FormBuilder isn't well-built, and instead shoves a load of code in its controllers, well, that's still not a reason for you to do something similarly ill-considered.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-11T08:37:16.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19389" PostTypeId="2" ParentId="11887" CreationDate="2017-03-11T15:10:25.833" Score="1" Body="&lt;p&gt;I realise this is an old post, but it's something we've tackled recently and wanted to put out our solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using CloudFlare you could use our &lt;a href=&quot;https://github.com/madebymutual/Country-Detect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Country Detect&lt;/a&gt; plugin, otherwise as John Moylan mentioned &lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Luke Holder's Geo Plugin&lt;/a&gt; can achieve the same thing. The only advantage of our plugin is that it saves a bit of processing if you're already using CloudFlare.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then conditionally show content to US folks only at by something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.countryDetect.country == &quot;US&quot; %}&#xA;    {# Put your FAQs for USA here #}&#xA;{% elseif %}&#xA;    {# Content or redirect() goes here #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2017-03-11T15:10:25.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19390" PostTypeId="2" ParentId="9932" CreationDate="2017-03-11T15:12:49.027" Score="3" Body="&lt;p&gt;Old post, I know, but we've recently published a plugin to achieve this for a similar problem we were facing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/madebymutual/SessionExposer&quot; rel=&quot;nofollow noreferrer&quot;&gt;SessionExposer plugin&lt;/a&gt; can help you achieve this. To get the Session ID in the template you use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sessionExposer.sessionId }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2017-03-11T15:12:49.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19391" PostTypeId="2" ParentId="19383" CreationDate="2017-03-11T15:19:28.963" Score="1" Body="&lt;p&gt;It's probable that your Site URL in your website's config is using &lt;code&gt;http&lt;/code&gt; rather than &lt;code&gt;https&lt;/code&gt;. Setting it to &lt;code&gt;https&lt;/code&gt; should force the control panel assets to load appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can change this in Craft's &lt;code&gt;Settings &amp;gt; System  &amp;gt; General&lt;/code&gt; screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've overriden this in your website's config setting you'll instead need to update the &lt;code&gt;siteUrl&lt;/code&gt; setting in that file. Documentation for this can be &lt;a href=&quot;http://craftcms.com/docs/config-settings#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;found here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2017-03-11T15:19:28.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19392" PostTypeId="2" ParentId="19373" CreationDate="2017-03-11T17:22:09.670" Score="3" Body="&lt;p&gt;I have &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS plugin&lt;/a&gt; too and changed Trebuchet in Redactor's rich text fields with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;. redactor-styles &amp;gt; * { font-family: 'Arial'; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Trebuchet just showed up recently, I'm pretty sure wasn't there before.&lt;/p&gt;&#xA;" OwnerUserId="4939" LastActivityDate="2017-03-11T17:22:09.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19393" PostTypeId="2" ParentId="19386" CreationDate="2017-03-11T21:43:33.193" Score="1" Body="&lt;p&gt;I forgot to add that i use &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-multi-environment&lt;/a&gt; as a flexible multi-environment config for Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to fix the issue setting two variables to the linked valet url in the public/index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_SERVER['PHP_SELF'] = 'valeturl.dev';&#xA;$_SERVER['SCRIPT_NAME'] = 'valeturl.dev';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now all the updates etc work as expected. &lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2017-03-11T22:29:38.883" LastActivityDate="2017-03-11T22:29:38.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19394" PostTypeId="1" CreationDate="2017-03-11T23:49:20.437" Score="1" ViewCount="79" Body="&lt;p&gt;We are in talks with a client about developing a database that currently has about ~7000 items in it, each with at least one photo so thats likely almost 20,000 with ambitions to grow it to be at least twice that size.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I be concerned about scaling a Craft to that size?&lt;/li&gt;&#xA;&lt;li&gt;What's the largest craft database any of you are running?&lt;/li&gt;&#xA;&lt;li&gt;Has anyone had any issues with large number of elements slowing down the system to unusable levels?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="183" LastActivityDate="2017-08-06T07:59:58.883" Title="What's the largest number of elements Craft can handle well?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19396" PostTypeId="1" AcceptedAnswerId="19400" CreationDate="2017-03-12T02:58:06.220" Score="1" ViewCount="50" Body="&lt;p&gt;I'm currently unable to access my 'Email' control panel settings page. When the page loads it's completely blank, and the body of the response is simply the scripts that log the Application Log and Profiling Summary Report to the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every other settings page works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried disabling all plugins (currently just one), but this did not have any affect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is up-to-date as of today at 2.6.2967.&lt;/p&gt;&#xA;" OwnerUserId="6416" LastActivityDate="2017-03-13T11:15:17.850" Title="&quot;Email&quot; Control Panel Settings page is blank" Tags="&lt;emails&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19397" PostTypeId="2" ParentId="19394" CreationDate="2017-03-12T10:28:10.903" Score="3" Body="&lt;p&gt;We have a site with (as of right now) 77,613 elements. 9,954 of which are entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We found that we had to be careful about using Craft's &lt;code&gt;{% cache %}&lt;/code&gt; functionality because clearing the element cache criteria took a long time. Instead we use a Varnish cache and it all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are times when it's not as fast as it should be, particular templates that pull in a lot of data from different places struggle if there's a bit of traffic to it at any one time - but Varnish resolves that. There's probably lots in those templates that we could be doing to make them more efficient too, it's just not been a high priority because it works &lt;em&gt;okay&lt;/em&gt;.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just make sure your hosting is reasonably beefy. Depending on your traffic &lt;code&gt;mysqld&lt;/code&gt; might get called upon a lot and that can be a resource hog. I recommend using something like DigitalOcean where you can simply increase the VPS specs if things are struggling and tweaking Craft settings or templates isn't helping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And with Craft 3's performance boosts coming this year, I think you'll be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2017-03-12T10:28:10.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19398" PostTypeId="1" AcceptedAnswerId="19399" CreationDate="2017-03-12T16:39:18.037" Score="2" ViewCount="272" Body="&lt;p&gt;&lt;strong&gt;Background &amp;amp; Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've taken over our company website which was created using Craft. I've never worked with Craft and I'm beginning to like it, but the higher-ups want it done ASAP and I'm struggling understanding some things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been tasked to add a page for our clients (AKA Client Portal). Each one of these pages will look and feel exactly the same with the exception of three areas (Discovery, Website, Assets) where the project manager will need to add tasks. These tasks will be a brief description and will be a link to some outside page (Dropbox or something else...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Progress&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a Channel and called it Client Portal which works great! I can create a portal for each client and so far so good. The problem is I need to add these sections (not sure the proper Craft term) where they can add a Discovery task, Website task, Assets task. These are unique to the client, but will be styled exactly the same, but the content (text) will be different for each task/card. I'm not sure where to start with these sections (or whatever Craft calls them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction on how I would create these sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a JSFIDDLE to give someone a visual on what I'm trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/9goqgabp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://jsfiddle.net/9goqgabp/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6417" LastActivityDate="2017-03-13T08:40:56.223" Title="Creating Task Manager for Client Portal" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19399" PostTypeId="2" ParentId="19398" CreationDate="2017-03-13T08:40:56.223" Score="4" Body="&lt;p&gt;You could create a &quot;Matrix Block&quot; and make 3 type of blocks in there:&#xA;Discovery task, Website task and Assets task. If you give these blocks the fields they should need they just add whatever block they need and fill it in the way they like. You can loop over these blocks so they get displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They can be filled in differently for every &quot;Client Portal&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find more info about matrix blocks here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/matrix-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft CMS Documentation is really good especially if you are just starting its really helpfull as it got all the basics and even more you need to build a website with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a &quot;Craft CMS Slack&quot; where alot of developers discuss craft and ask questions daily so you can have a more direct explanation and probably a faster response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/community#slack&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-13T08:40:56.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19400" PostTypeId="2" ParentId="19396" CreationDate="2017-03-13T11:15:17.850" Score="1" Body="&lt;p&gt;I was able to resolve the issue by downloading the latest version of Craft CMS and replacing my existing &lt;code&gt;/craft/app&lt;/code&gt; directory with that latest version (as outlined in the &lt;a href=&quot;https://craftcms.com/docs/updating#manually-updating&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Manually Updating&quot;&gt;Manually Updating&lt;/a&gt; section of their documentation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was previously using the &lt;a href=&quot;https://craftcms.com/docs/updating#one-click-updating&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;One-click Updating&quot;&gt;One-click Updating&lt;/a&gt; method in the control panel, so I'm not exactly sure of the original cause of the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to Brad Bell for the help!&lt;/p&gt;&#xA;" OwnerUserId="6416" LastActivityDate="2017-03-13T11:15:17.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19401" PostTypeId="1" CreationDate="2017-03-13T11:50:55.820" Score="2" ViewCount="573" Body="&lt;p&gt;I am able to upload images to an S3 bucket successfully, but I am really stumped as to how it's working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;file&lt;/code&gt; input in my template, and in my controller I am doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = craft()-&amp;gt;config-&amp;gt;get('section', 'mySection');&#xA;$criteria-&amp;gt;limit = 1;&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;authorId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;// have also tried getting the user like this for sanity:&#xA;// get the same id either way&#xA;//$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;//$criteria-&amp;gt;authorId = $user-&amp;gt;id; &#xA;&#xA;$entry = $criteria-&amp;gt;first();&#xA;&#xA;if ($entry) {&#xA;    ...&#xA;    $folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;        'sourceId' =&amp;gt; $this-&amp;gt;assetSourceId,&#xA;    ));&#xA;    error_log($folder-&amp;gt;id) // 207&#xA;&#xA;    $upload = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;        $tempFilePath,&#xA;        $photo-&amp;gt;getName(),&#xA;        $folder-&amp;gt;id,&#xA;        AssetConflictResolution::KeepBoth&#xA;     );&#xA;     if ($upload-&amp;gt;isSuccess()) {&#xA;         ...&#xA;     }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works great. The image is uploaded to the correct S3 bucket.&#xA;But when doing the same in the CP the folder ID is actually different. It looks like it should be 27?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vKzXc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vKzXc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also trying to upload another file &lt;code&gt;my-file.json&lt;/code&gt; from the same front-end form. I am using the same technique above to get the folder ID, and it is returning the same number (207). However the asset is getting uploaded to the &lt;em&gt;correct&lt;/em&gt; folder (207). But in my case that is actually the &lt;em&gt;incorrect&lt;/em&gt; folder. It should be uploading to 27.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more effective way to get the correct folder Id? Thank you for any suggestions! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, folder 207 is the first folder in my asset list...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just going to keep updating this as I fumble through it and revise it to an answer when I figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;findFolder()&lt;/code&gt; will &lt;a href=&quot;https://craftcms.com/classreference/services/AssetsService#findFolder-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;find the first folder that matches a given criteria.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since in my above example, I am only passing in the source Id, that means that I'm only going to get back the first folder for that resource. (In my case that would be folder 207).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By changing the &lt;code&gt;findFolder()&lt;/code&gt; params to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;...&#xA;$folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'sourceId' =&amp;gt; $this-&amp;gt;assetSourceId,&#xA;    'name' =&amp;gt; $user-&amp;gt;username&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am now getting the correct folder Id back. How I was able to upload images successfully prior to this is still a mystery.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-03-13T15:32:37.393" LastActivityDate="2017-10-18T11:16:16.383" Title="How can I get the correct folder ID when uploading assets from a front-end form/plugin?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19402" PostTypeId="1" CreationDate="2017-03-13T13:06:35.717" Score="2" ViewCount="40" Body="&lt;p&gt;I'm trying to create a post where in the entry loop I can also post tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;URL&quot;&amp;gt;TITLE&amp;lt;/a&amp;gt;&#xA;   TAGS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in my current understanding there's no way to get the post's tags where I'd assume it would be something like &lt;code&gt;entry.tags&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6421" LastEditorUserId="57" LastEditDate="2017-03-13T17:47:31.597" LastActivityDate="2017-03-13T17:47:31.597" Title="When posting entries, how do I post tags as well as the title and url?" Tags="&lt;entry&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19403" PostTypeId="1" AcceptedAnswerId="19404" CreationDate="2017-03-13T13:07:45.517" Score="2" ViewCount="471" Body="&lt;p&gt;The issue arises from inline three buttons (Viewer, Video, Photo) via CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea was to make the buttons more responsive for example if I want to display just one button than stretch to 100% width within the parent. Two buttons (50% each) and three buttons (33.33% each).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess if I setup radio field and the values are &lt;code&gt;displayOne&lt;/code&gt;, &lt;code&gt;displayTwo&lt;/code&gt; and &lt;code&gt;displayThree&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.viewerOption %}&#xA;&#xA;{% if option in entry.viewerOption.value.selected(displayOne) %}&#xA;&amp;lt;a class=”single” href=&quot;#&quot;&amp;gt;Viewer&amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;&amp;lt;a class=”single” href=&quot;#&quot;&amp;gt;Photo&amp;lt;/a&amp;gt;&#xA;{% else %}&#xA;&amp;lt;a class=”single” href=&quot;#&quot;&amp;gt;Video&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% else %}&#xA;&#xA;{% if option in entry.viewerOption.value.selected(displayTwo) %}&#xA;&amp;lt;a class=”duel” href=&quot;#&quot;&amp;gt;Viewer&amp;lt;/a&amp;gt;&#xA;&amp;lt;a class=”duel” href=&quot;#&quot;&amp;gt;Photo&amp;lt;/a&amp;gt;&#xA;&amp;lt;a class=”duel” href=&quot;#&quot;&amp;gt;Video&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% else %}&#xA;&#xA;{% if option in entry.viewerOption.value.selected(displayThree) %}&#xA;&amp;lt;a class=”triple” href=&quot;#&quot;&amp;gt;Viewer&amp;lt;/a&amp;gt;&#xA;&amp;lt;a class=”triple” href=&quot;#&quot;&amp;gt;Photo&amp;lt;/a&amp;gt;&#xA;&amp;lt;a class=”triple” href=&quot;#&quot;&amp;gt;Video&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure what is the best method to dynamically single, duel or triple buttons base on selected radio value.&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="142" LastEditDate="2017-03-13T13:16:26.853" LastActivityDate="2017-03-14T08:55:39.743" Title="Display selected radio's value" Tags="&lt;templating&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19404" PostTypeId="2" ParentId="19403" CreationDate="2017-03-13T13:27:11.397" Score="1" Body="&lt;p&gt;I'm not sure I totally get what you're trying to do, but if you want to cut down a bit of the code duplication in here a good start would be to use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig macro&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd set up your macro like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro input(cssClass) %}&#xA;    &amp;lt;a class=”{{ cssClass }}” href=&quot;#&quot;&amp;gt;Viewer&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=”{{ cssClass }}” href=&quot;#&quot;&amp;gt;Photo&amp;lt;/a&amp;gt;&#xA;    &amp;lt;a class=”{{ cssClass }}” href=&quot;#&quot;&amp;gt;Video&amp;lt;/a&amp;gt;&#xA;{% endmacro %}&#xA;&#xA;{% from _self import input %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'd call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ input('dual') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't need the value of the radio buttons for anything else, you could always give them the value of your CSS class; that way you don't need to convert them from one thing to another. If you did it this way then you could just call your macro like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cssClass = entry.viewerOption %}&#xA;{{ input(cssClass) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure you've set a default option for your radio button when you've added it in the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="505" LastEditDate="2017-03-14T08:55:39.743" LastActivityDate="2017-03-14T08:55:39.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19405" PostTypeId="2" ParentId="19402" CreationDate="2017-03-13T13:46:12.933" Score="2" Body="&lt;p&gt;In the Control Panel you'd need to create a &lt;a href=&quot;https://craftcms.com/docs/tags#tag-groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tag Group&lt;/a&gt; first, which would hold all of you created tags. You then need to create a &lt;a href=&quot;https://craftcms.com/docs/tags-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tags field&lt;/a&gt; where you'd select the Tag Group created above as the &lt;code&gt;source&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've done all that, you can now add it to the fields of the &lt;code&gt;entry&lt;/code&gt; type in question. If you gave the Tags field the name &lt;code&gt;tags&lt;/code&gt; when you create it, you could then refer to it in your template as &lt;code&gt;entry.tags&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In you template, you'd then loop through you tags and output them like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in entry.tags %}&#xA;    {{ tag.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-03-13T13:54:58.793" LastActivityDate="2017-03-13T13:54:58.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19406" PostTypeId="1" AcceptedAnswerId="19413" CreationDate="2017-03-13T14:24:59.897" Score="2" ViewCount="605" Body="&lt;p&gt;I have a front end form for entries. All other fields are working fine however my assets keep throwing errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My assets location is set to 'Images/{slug}' in the CP. Server info tells my Imagemagick is installed, on both local and staging environments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I submit an entry form with a file chosen for the assets field I get an error&#xA;'The file XXX does not appear to be an image.'&#xA;The odd thing is that the image does actually get uploaded and it's in the expected assets location, but the entry does not get created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add that I can view it within the file directory, but the asset is not indexed into the Assets CP view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2017-03-13T14:37:21.517" LastActivityDate="2017-03-13T18:47:43.963" Title="Front end assets uploading, does not appear to be a an image error" Tags="&lt;assets&gt;&lt;frontend&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19407" PostTypeId="1" CreationDate="2017-03-13T15:49:02.643" Score="2" ViewCount="200" Body="&lt;p&gt;When trying to upgrade Craft CMS automatically we get a message relative to the SSL certificate of the CDN being incorrect, though it works fine on a local machine. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft was unable to install this update :(&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[curl] 51: SSL: no alternative certificate subject name matches target&#xA;  host name 'download.craftcdn.com' [url]&#xA;  &lt;a href=&quot;https://download.craftcdn.com/craft/2.6/2.6.2967/Patch/2.6.2962/41d682834df8c739ead7a1abab6a4571.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://download.craftcdn.com/craft/2.6/2.6.2967/Patch/2.6.2962/41d682834df8c739ead7a1abab6a4571.zip&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anybody else getting this? &lt;/p&gt;&#xA;" OwnerUserId="5050" LastActivityDate="2017-03-13T22:37:17.720" Title="Problem upgrading Craft CMS?" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19408" PostTypeId="2" ParentId="6808" CreationDate="2017-03-13T16:06:44.323" Score="0" Body="&lt;p&gt;Try using .level(1)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for eventsEntry in craft.entries.section('events').level(1) %}&#xA;    &amp;lt;div&amp;gt;&#xA;        {% set image = eventsEntry.pic.first() %}&#xA;&#xA;        {% if image %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{image.title}}&quot;/&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;h4 class=&quot;center&quot;&amp;gt;{{ eventsEntry.title }}&amp;lt;/h4&amp;gt;&#xA;&#xA;        {{ eventsEntry.shortDescription }}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6425" LastEditorUserId="57" LastEditDate="2017-03-13T17:45:30.583" LastActivityDate="2017-03-13T17:45:30.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19409" PostTypeId="1" CreationDate="2017-03-13T16:38:22.113" Score="3" ViewCount="164" Body="&lt;p&gt;I'm trying to extend the ElementCriteriaModel using the guide here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blog.tighten.co/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blog.tighten.co/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I need to re-implement &lt;code&gt;relatedTo&lt;/code&gt; keyword somehow. This is what I have so far but doesn't seem to work at all&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;    $criteria-&amp;gt;slug = 'seasonal-event';&#xA;    $criteria-&amp;gt;limit = 1;&#xA;&#xA;    $category = $criteria-&amp;gt;find();&#xA;&#xA;    $this-&amp;gt;criteria-&amp;gt;relatedTo = array(&#xA;        'targetElement' =&amp;gt; $category&#xA;    );&#xA;&#xA;    return $this;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6424" LastEditorUserId="45" LastEditDate="2017-03-13T18:35:11.693" LastActivityDate="2017-04-12T23:54:32.417" Title="Using relatedTo programatically?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;elementtype&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19410" PostTypeId="1" CreationDate="2017-03-13T16:50:53.983" Score="4" ViewCount="155" Body="&lt;p&gt;I'm trying to eager-load a Matrix field with it's blocktype and related field types. For some reason the _eagerLoadedBlockTypeElements are empty arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get rid of the &lt;code&gt;with&lt;/code&gt; clause on ElementCriteria and iterate through the items it does work, which is not surprising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I have right now (including dumping the results) are below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::GlobalSet, [&#xA;        'handle' =&amp;gt; 'footer',&#xA;        'with'   =&amp;gt; ['column1Items.item:itemSection', 'column1Items.item:itemTitle']&#xA;    ]);&#xA;&#xA;$found = $criteria-&amp;gt;first();&#xA;dump($found-&amp;gt;getEagerLoadedElements('column1Items'));&#xA;exit();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to Craft and working with Yii hopefully someone can help me out with this one!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I can dump the query logs if necessary, just shoot!&lt;/p&gt;&#xA;" OwnerUserId="6427" LastEditorUserId="57" LastEditDate="2017-03-13T17:46:52.390" LastActivityDate="2017-03-13T17:46:52.390" Title="Eagerloading Matrix fields resulting in empty array" Tags="&lt;matrix&gt;&lt;globals&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19411" PostTypeId="1" AcceptedAnswerId="19439" CreationDate="2017-03-13T16:55:10.793" Score="3" ViewCount="2355" Body="&lt;p&gt;I need to be able to display the Category Title of a single category (as a h1 tag for a page displaying a list of the entries for that category).  I can successfully display the relevant entries for the category on the page, but when I have tried to display the category title it displays all of the categories titles (in a loop), not just the single category title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('category') is not null %}    &#xA;&#xA;        {% set category = craft.categories.slug(craft.request.getParam('category')) %}&#xA;&#xA;        {% set products =  craft.entries.section('products').relatedTo(category).find() %}&#xA;&#xA;&#xA;        {% else %}&#xA;               {% set products = craft.entries.section('products').find() %}&#xA;        {% endif %}&#xA;&#xA;&#xA;&#xA;&amp;lt;div class=&quot;top-title&quot;&amp;gt; &#xA;&#xA;     {% for category in craft.categories.group('productType').find() %}       &#xA;        &amp;lt;header class=&quot;flush&quot;&amp;gt;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt; &#xA;     {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be very much appreciated!&#xA;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastEditorUserId="5872" LastEditDate="2017-03-14T09:57:59.463" LastActivityDate="2017-03-15T22:07:33.620" Title="How do I display the Category Title?" Tags="&lt;category&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19412" PostTypeId="2" ParentId="19411" CreationDate="2017-03-13T17:46:53.963" Score="4" Body="&lt;p&gt;It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, you were getting the category via a slug in the URL, you would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}&#xA;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// THIS IS YOUR LOOP, BTW&#xA;{% for category in craft.categories.group('productType').find() %}       &#xA;    &amp;lt;header class=&quot;flush&quot;&amp;gt;&amp;lt;h1&amp;gt;{{ category.title }}&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you might need to add a conditional in case the page is loaded without a category. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category | length %}&#xA;    {{ category.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-03-14T14:36:55.473" LastActivityDate="2017-03-14T14:36:55.473" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19413" PostTypeId="2" ParentId="19406" CreationDate="2017-03-13T18:47:43.963" Score="3" Body="&lt;p&gt;The issue lies if you have a Preparse field in that field layout, see details here: &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft/issues/23&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft/issues/23&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2017-03-13T18:47:43.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19414" PostTypeId="2" ParentId="19383" CreationDate="2017-03-13T20:56:06.597" Score="5" Body="&lt;p&gt;The solution I came to was creating an Origin Certificate on Cloudflare, installing on it on my VPS, and setting the SSL setting to Full Strict. Now admin assets are loading perfectly over https. No .htaccess or Patrol plugin required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone knows more about why this worked and the previous approach didn't I would love to hear your thoughts. Thanks @MattStein for clueing me towards this approach.&lt;/p&gt;&#xA;" OwnerUserId="3987" LastActivityDate="2017-03-13T20:56:06.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19415" PostTypeId="2" ParentId="19407" CreationDate="2017-03-13T22:37:17.720" Score="1" Body="&lt;p&gt;That &lt;code&gt;cURL 51&lt;/code&gt; error usually means that your server doesn't understand the &lt;a href=&quot;https://en.wikipedia.org/wiki/Server_Name_Indication&quot; rel=&quot;nofollow noreferrer&quot;&gt;SNI SSL&lt;/a&gt; certificate we have installed at &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com&lt;/a&gt; and &lt;a href=&quot;https://craftcdn.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcdn.com&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically there are 3 things a server needs to recognize SNI SSL certs:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a version of cURL that supports it, at least 7.18.1 (8 years old: &lt;a href=&quot;https://curl.haxx.se/changes.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://curl.haxx.se/changes.html&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a version of cURL compiled against a library that supports SNI, e.g. OpenSSL 0.9.8j (depending on the compilation options some older versions. 7 years old: &lt;a href=&quot;https://www.openssl.org/news/changelog.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.openssl.org/news/changelog.html&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using TLS 1.0 at least (not SSLv3)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Once the box Craft is on meets those requirements, it should start working.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-13T22:37:17.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19416" PostTypeId="1" CreationDate="2017-03-13T23:00:05.817" Score="1" ViewCount="1664" Body="&lt;p&gt;OK, I have encountered the following issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue:&lt;/strong&gt;&lt;br&gt;&#xA; Admin page gets a Craft 404 page error; home page loads fine though.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home page: &lt;code&gt;192.168.10.95&lt;/code&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RW8Wa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RW8Wa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Admin page: &lt;code&gt;http://192.168.10.95/public/index.php/admin/dashboard&lt;/code&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aaw63.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aaw63.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Clearly Craft is working, though I am not sure what is causing this to break for me. Any suggestions?  I can provide any information you may want to see, just let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you Craft friends!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 03/14/2017 @08:24 PST&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the contents of my &lt;code&gt;/etc/apache2/sites-availavble/000-default.conf&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;&#xA;ServerAdmin webmaster@localhost&#xA;DocumentRoot /var/www/html/public&#xA;&#xA;ErrorLog ${APACHE_LOG_DIR}/error.log&#xA;CustomLog ${APACHE_LOG_DIR}/access.log combined&#xA;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have pointed my DocumentRoot to &lt;code&gt;/var/www/html/public&lt;/code&gt;, though did I miss something in my configuration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again Craft friends!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastEditorUserId="6286" LastEditDate="2017-03-14T16:01:04.227" LastActivityDate="2017-03-14T16:06:21.837" Title="Craft 404 for admin dashboard" Tags="&lt;404&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19417" PostTypeId="2" ParentId="19409" CreationDate="2017-03-13T23:37:45.110" Score="3" Body="&lt;p&gt;You're using &lt;code&gt;$criteria&lt;/code&gt;, but attempting to set the &lt;code&gt;relatedTo&lt;/code&gt; property on &lt;code&gt;$this-&amp;gt;criteria&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that's not the issue, have you tried using &lt;code&gt;$criteria-&amp;gt;setAttribute('relatedTo', ['targetElement' =&amp;gt; $category])&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found &lt;code&gt;setAttribute&lt;/code&gt; to be more reliable than the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; magic methods.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-13T23:37:45.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19418" PostTypeId="1" CreationDate="2017-03-14T01:20:55.090" Score="2" ViewCount="85" Body="&lt;p&gt;I have looked around but cant find an answer to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a structure for my gallery page, in-which there are three separate entries called A, B and C. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different images within these entries. But how would I go about showing all the images within these entries in a random order? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I went to the gallery page and they all showed up randomly, then theres a sub navigation to the separate entries on there own?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably a simple solution but templating it has me really confused. &#xA;Thank you &lt;/p&gt;&#xA;" OwnerUserId="5390" LastEditorUserId="22" LastEditDate="2017-05-09T20:11:43.253" LastActivityDate="2017-06-08T23:39:34.327" Title="Another gallery question" Tags="&lt;templating&gt;&lt;ordering&gt;&lt;responsive-images&gt;&lt;gallery&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19420" PostTypeId="2" ParentId="19370" CreationDate="2017-03-14T03:54:47.903" Score="4" Body="&lt;p&gt;Your product element criteria is using a condition param: &lt;code&gt;hasVariants&lt;/code&gt;, but it should be &lt;code&gt;hasVariant&lt;/code&gt; as per the docs: &lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That correctly only returns products (where a variant that belongs to that product) is in stock.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-03-14T03:54:47.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19421" PostTypeId="1" CreationDate="2017-03-14T06:21:17.443" Score="4" ViewCount="1556" Body="&lt;p&gt;I'm using MAMP to setup a local environment for CraftCMS on Windows 10. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have followed all necessary procedures and have my local host and my database setup but I'm still receiving the error mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My db.php is shown as this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; return array(&#xA;&#xA;        // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.&#xA;       'server' =&amp;gt; 'localhost',&#xA;&#xA;        // The name of the database to select.&#xA;        'database' =&amp;gt; 'mycraft',&#xA;&#xA;       // The database username to connect with.&#xA;       'user' =&amp;gt; 'root',&#xA;&#xA;       // The database password to connect with.&#xA;      'password' =&amp;gt; 'root',&#xA;&#xA;       // The prefix to use when naming tables. This can be no more than 5 characters.&#xA;      'tablePrefix' =&amp;gt; 'craft',&#xA;&#xA; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even if i make a custom user or password I still get the error above when I try to connect to &lt;a href=&quot;http://localhost:8888/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888/admin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked many times and all my credentials as well as my local host port is correct. Craft can clearly connect to host which is why I'm getting the error from craft but for some reason, despite the details in db.php being correct it cant connect to the database...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what's going on?&lt;/p&gt;&#xA;" OwnerUserId="6326" LastEditorUserId="22" LastEditDate="2017-05-09T20:11:07.567" LastActivityDate="2021-02-23T16:04:50.213" Title="MAMP: Craft can’t connect to the database with the credentials in craft/config/db.php" Tags="&lt;error-message&gt;&lt;environments&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19422" PostTypeId="2" ParentId="19418" CreationDate="2017-03-14T07:55:19.780" Score="1" Body="&lt;p&gt;You can set an array and order them by random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set gallery = craft.entries.section(['galleryA','galleryB','galleryC']) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have to display them by random using &lt;code&gt;.order('RAND()')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your &lt;code&gt;for loop&lt;/code&gt; looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section(gallery).order('RAND()') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-14T07:55:19.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19423" PostTypeId="2" ParentId="19418" CreationDate="2017-03-14T07:56:12.653" Score="1" Body="&lt;p&gt;Rather than having separate entries, have you considered having one type of image but assigning &lt;a href=&quot;https://craftcms.com/docs/categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;categories&lt;/a&gt; or &lt;a href=&quot;https://craftcms.com/docs/tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;tags&lt;/a&gt; to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you could output your images in a random order using &lt;code&gt;.order('RAND()')&lt;/code&gt; on the end of your &lt;code&gt;for&lt;/code&gt; loop. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('yourImageEntries').order('RAND()') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if you want to output your images by specific category you can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the entries related to this category #}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{# Output them #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example taken from the official docs &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-03-14T08:03:29.757" LastActivityDate="2017-03-14T08:03:29.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19424" PostTypeId="1" CreationDate="2017-03-14T10:25:41.043" Score="2" ViewCount="493" Body="&lt;p&gt;I created grouped category name projectCategory and assigned projects as the parent of design, 3d and art. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In project section (Channel) I have wrote &lt;code&gt;{projectCategory.first().slug}/{slug}&lt;/code&gt;  and in categories (projectCategory) the top level is &lt;code&gt;{slug}&lt;/code&gt; and nested categories &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setup the field (projectCategory) so that I can assigned entry to selected category. So far &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is not what I am hoping for at the moment sample.com/projects/mer-car-model is what generated. I was hoping that it should read sample.com/projects/3d/mer-car-model. I would appreciate some guidance how to achieve the result.&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2017-03-14T19:10:53.733" LastActivityDate="2017-03-14T19:10:53.733" Title="Entry URL Format - Parent + Children" Tags="&lt;templating&gt;&lt;url&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19425" PostTypeId="1" CreationDate="2017-03-14T10:59:56.697" Score="2" ViewCount="170" Body="&lt;p&gt;I'm using Matrix and Neo to build out quite large, complex entries.&#xA;On larger pages (70+ blocks each with one-multiple sub-blocks) the performance is taking a bit of a hit taking upwards of 40 seconds to load (locally running PHP7).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on speeding this up at all, eg selectively loading/collapsing blocks as required rather than load in everything onto the page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts/suggestions appreciated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-03-14T10:59:56.697" Title="Neo performance (large page)" Tags="&lt;matrix&gt;&lt;performance&gt;&lt;plugin-neo&gt;&lt;speed&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19426" PostTypeId="2" ParentId="19424" CreationDate="2017-03-14T11:39:18.443" Score="1" Body="&lt;p&gt;The above setting that I wrote is good until I forgot to change the limit number of selectable categories from 1 to 2 which solve my problem.  I think that was the problem for not showing the children due to limit to one select category. Now I can add two categories (The parent and child).&lt;/p&gt;&#xA;" OwnerUserId="5087" LastActivityDate="2017-03-14T11:39:18.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19427" PostTypeId="1" CreationDate="2017-03-14T12:38:52.357" Score="2" ViewCount="191" Body="&lt;p&gt;I am currently using spoeken's gulp workflow (&lt;a href=&quot;https://github.com/spoeken/gulp-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/spoeken/gulp-craftcms&lt;/a&gt;). Everything works well in development, however, when it comes to production, I can't seem to concat/minify my &lt;code&gt;bower_components&lt;/code&gt; dependencies, into one file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a &lt;code&gt;public/resources/js/app.min.js&lt;/code&gt;, however, my &lt;code&gt;bower_component&lt;/code&gt; dependencies are sitting in &lt;code&gt;app/resources/bower_components&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you go about minifying my dependencies into one file? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have in my &lt;code&gt;package.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftgulp&quot;,&#xA;  &quot;version&quot;: &quot;0.0.0&quot;,&#xA;  &quot;authors&quot;: [&#xA;    &quot;&quot;&#xA;  ],&#xA;  &quot;license&quot;: &quot;MIT&quot;,&#xA;  &quot;private&quot;: true,&#xA;  &quot;dependencies&quot;: {&#xA;    &quot;jquery&quot;: &quot;~2.2.0&quot;,&#xA;    &quot;tether&quot;: &quot;^1.4.0&quot;,&#xA;    &quot;bootstrap&quot;: &quot;v4.0.0-alpha.2&quot;,&#xA;    &quot;gsap&quot;: &quot;^1.19.1&quot;,&#xA;    &quot;scrollmagic&quot;: &quot;^2.0.5&quot;,&#xA;    &quot;slick-carousel&quot;: &quot;^1.6.0&quot;,&#xA;    &quot;waypoints&quot;: &quot;^4.0.1&quot;&#xA;  },&#xA;  &quot;overrides&quot;: {&#xA;    &quot;bootstrap-sass&quot;: {&#xA;      &quot;main&quot;: [&#xA;        &quot;assets/stylesheets/_bootstrap.scss&quot;,&#xA;        &quot;assets/fonts/bootstrap/*&quot;,&#xA;        &quot;assets/javascripts/bootstrap.js&quot;&#xA;      ]&#xA;    },&#xA;    &quot;scrollmagic&quot;: {&#xA;      &quot;main&quot;: [&#xA;        &quot;./scrollmagic/uncompressed/ScrollMagic.js&quot;,&#xA;        &quot;./scrollmagic/uncompressed/plugins/animation.gsap.js&quot;,&#xA;        &quot;./scrollmagic/uncompressed/plugins/debug.addIndicators.js&quot;,&#xA;        &quot;./scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js&quot;&#xA;      ]&#xA;    },&#xA;    &quot;gsap&quot;: {&#xA;      &quot;main&quot;: [&#xA;        &quot;./src/uncompressed/TweenMax.js&quot;,&#xA;        &quot;./src/uncompressed/TimelineLite.js&quot;,&#xA;        &quot;./src/uncompressed/jquery.gsap.js&quot;&#xA;      ]&#xA;    },&#xA;    &quot;slick-carousel&quot;: {&#xA;      &quot;main&quot;: [&#xA;        &quot;./slick/slick.min.js&quot;,&#xA;        &quot;./slick/slick.css&quot;,&#xA;        &quot;./slick/slick-theme.css&quot;&#xA;      ]&#xA;    },&#xA;    &quot;waypoints&quot;: {&#xA;      &quot;main&quot;: [&#xA;        &quot;./lib/jquery.waypoints.min.js&quot;&#xA;      ]&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4803" LastEditorUserId="45" LastEditDate="2017-07-10T16:24:10.657" LastActivityDate="2017-07-10T16:24:10.657" Title="Minifying bower_components js files" Tags="&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19428" PostTypeId="1" AcceptedAnswerId="19432" CreationDate="2017-03-14T14:39:10.020" Score="2" ViewCount="219" Body="&lt;p&gt;I am trying to output a list of entries from a channel section that DO NOT have a certain tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to output the entries that have the tag assigned by setting the tag as a variable and using &lt;code&gt;relatedTo&lt;/code&gt; to filter the entries out. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search('All-Stars').first() %}&#xA;&#xA;{% if tag %}&#xA;{% set relatedEntries = craft.entries.section('news').relatedTo(tag) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the best approach to output entries without the tag?&#xA;I've tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search('All-Stars').first() %}&#xA;{% set allEntries = craft.entries.section('news') %}&#xA;{% set taggedEntries = craft.entries.section('news').relatedTo(tag) %}&#xA;{% set untaggedEntries = allEntries|without(taggedEntries) %}&#xA;{% for feedItems in untaggedEntries.limit(5).offset(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This however doesn't work and throws out some errors, the first being:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;array to string conversion&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/app/vendor/twig/twig/lib/Twig/Template.php(525)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$message = sprintf('Impossible to invoke a method (&quot;%s&quot;) on a %s variable (&quot;%s&quot;)', $item, gettype($object), $object);&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried many other ideas like &lt;code&gt;.relatedTo('not' ~ tag)&lt;/code&gt; and &lt;code&gt;|without&lt;/code&gt; with no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it something obvious I am missing or more advance than that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2017-03-14T16:42:06.927" Title="List entries without specific tag" Tags="&lt;tags&gt;&lt;channels&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19429" PostTypeId="2" ParentId="19416" CreationDate="2017-03-14T16:06:21.837" Score="1" Body="&lt;p&gt;Apparently I am &quot;&lt;em&gt;to close to the painting&lt;/em&gt;&quot; here and completely missed a simple answer. In my case, I was going to the wrong URL completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad: &lt;code&gt;http://192.168.10.95/public/index.php/admin/dashboard&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good: &lt;code&gt;http://192.168.10.95/admin&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, &lt;strong&gt;&lt;em&gt;USER&lt;/em&gt;&lt;/strong&gt; error here. Thank you for the assistance everyone!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastActivityDate="2017-03-14T16:06:21.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19430" PostTypeId="1" AcceptedAnswerId="19433" CreationDate="2017-03-14T16:34:55.517" Score="2" ViewCount="135" Body="&lt;p&gt;I've got a 'media' channel that has two entry types: Film and Report.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the listing of entries to have the entry type column, but it doesn't seem to have any options for making it clickable to sort by entry type. Is this a current feature?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n7iZF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n7iZF.png&quot; alt=&quot;Entry listing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2017-03-14T19:14:23.110" Title="How to list/filter by the entry type column in the entries listing" Tags="&lt;entries&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19431" PostTypeId="2" ParentId="14267" CreationDate="2017-03-14T16:40:30.573" Score="2" Body="&lt;p&gt;It is now available as of Commerce 1.2.1323&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/changelog#build1323&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/changelog#build1323&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/payment-currencies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-currencies&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="107" LastActivityDate="2017-03-14T16:40:30.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19432" PostTypeId="2" ParentId="19428" CreationDate="2017-03-14T16:42:06.927" Score="3" Body="&lt;p&gt;You could try something like following reducing the tagged entries into IDs that you then filter against (see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10456/get-entries-not-related-to-categories/10479#10479&quot;&gt;this thread&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.search('All-Stars').first() %}&#xA;{% set allEntries = craft.entries.section('news') %}&#xA;{% set taggedEntries = craft.entries.section('news').relatedTo(tag).ids %}&#xA;{% set omitIds = 'and, not ' ~ taggedEntries|join(', not ') %}&#xA;{% set untaggedEntries = craft.entries.section('news').id(omitIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-03-14T16:42:06.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19433" PostTypeId="2" ParentId="19430" CreationDate="2017-03-14T19:14:23.110" Score="1" Body="&lt;p&gt;Currently it's not possible to sort by custom fields on element index pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to add a thumbs-up/comment on this feature request, though: &lt;a href=&quot;https://github.com/craftcms/cms/issues/987&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/987&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-14T19:14:23.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19434" PostTypeId="1" AcceptedAnswerId="19436" CreationDate="2017-03-14T19:25:24.217" Score="2" ViewCount="718" Body="&lt;p&gt;I'm getting a 500 error when trying to visit my page. Was able to track it down to this error in the logs, but can't seem to get it fixed. Updated the craft/app folder with the latest Craft version, but still no luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my phperrors.log&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[14-Mar-2017 17:56:34 UTC] PHP Fatal error:  Uncaught Error: Class 'Craft\DbConnection' not found in /var/www/site/craft/app/etc/behaviors/AppBehavior.php:849&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2017-03-14T21:50:22.307" Title="PHP Fatal error: Uncaught Error: Class 'Craft\DbConnection' not found" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19435" PostTypeId="1" CreationDate="2017-03-14T21:47:28.297" Score="1" ViewCount="623" Body="&lt;p&gt;In the browser, I'm getting a page that says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Service Unavailable&#xA;Our site is temporarily unavailable. Please try again later.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my craft.log, I'm getting a 503 error that says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2017/03/14 21:31:04 [error] [exception.Craft\HttpException.503] Craft\HttpException in /var/www/site/craft/app/etc/web/WebApp.php:800&#xA;Stack trace:&#xA;#0 /var/www/site/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /var/www/site/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /var/www/site/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /var/www/site/public/index.php(22): require_once('/var/www/site...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like it's an error when trying to run the installation for Craft. When I visit the server's /admin, I get a 404 page from nginx. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help is greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4872" LastEditorUserId="4872" LastEditDate="2017-03-14T22:19:37.087" LastActivityDate="2017-03-14T22:19:37.087" Title="Getting a 503 Error before Craft installs - [error] [exception.Craft\HttpException.503] Craft\HttpException" Tags="&lt;error-message&gt;&lt;install&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19436" PostTypeId="2" ParentId="19434" CreationDate="2017-03-14T21:50:22.307" Score="3" Body="&lt;p&gt;This project was missing the &lt;code&gt;craft/app/etc/db/&lt;/code&gt;directory and all files within that directory (my .gitignore file had meant to ignore the project root db directory, but caught all directories named 'db'). Removing 'db' from my .gitignore and re-pushing to my server solved this error.&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2017-03-14T21:50:22.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19438" PostTypeId="1" CreationDate="2017-03-15T08:37:32.483" Score="1" ViewCount="513" Body="&lt;p&gt;I want to add a question to a frontend registration form.&#xA;The radiobuttons are just 'Yes' or 'No'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a radiobutton field and added that to users &gt; fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add this option to the form, new registrations are not submitted.&#xA;The page reloads and doesn't redirect to the confirmation page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what's wrong with my form?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;legend&amp;gt;Are you a Beekeeper?&amp;lt;/legend&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[areYouBeekeeper]&quot; value=&quot;&quot;&amp;gt;&#xA;{% for option in entry.areYouBeekeeper.options %}&#xA;    &amp;lt;input id=&quot;isBeekeeper{{ option.label }}&quot; type=&quot;radio&quot; name=&quot;fields[areYouBeekeeper][]&quot; &#xA;    {%- if account is defined %}value=&quot;{{ option.label }}&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;label for=&quot;isBeekeeper{{ option.label }}&quot;&amp;gt;{{ option.value }}&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the complete form template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ siteUrl }}registration/confirmation&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot; style=&quot;list-style: none;&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li style=&quot;color:red;&quot;&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;label&amp;gt;Username&#xA;        &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; placeholder=&quot;gebruikersnaam&quot; name=&quot;username&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    {% if account is defined %}{{ errorList(account.getErrors('username')) }}{% endif %}&#xA;&#xA;    &amp;lt;label&amp;gt;Email&#xA;        &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; placeholder=&quot;somebody@example.com&quot; name=&quot;email&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    {% if account is defined %}{{ errorList(account.getErrors('email')) }}{% endif %}&#xA;&#xA;    &amp;lt;label&amp;gt;Password&#xA;        &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    {% if account is defined %}{{ errorList(account.getErrors('password')) }}{% endif %}&#xA;&#xA;    &amp;lt;label&amp;gt;First name&#xA;        &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; placeholder=&quot;First name&quot; name=&quot;firstName&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    {% if account is defined %}{{ errorList(account.getErrors('firstName')) }}{% endif %}&#xA;&#xA;    &amp;lt;label&amp;gt;Last name&#xA;        &amp;lt;input id=&quot;lastName&quot; type=&quot;text&quot; placeholder=&quot;Last name&quot; name=&quot;lastName&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.lastName }}&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    {% if account is defined %}{{ errorList(account.getErrors('lastName')) }}{% endif %}&#xA;&#xA;    &amp;lt;legend&amp;gt;Are you a Beekeeper?&amp;lt;/legend&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[areYouBeekeeper]&quot; value=&quot;&quot;&amp;gt;&#xA;    {% for option in entry.areYouBeekeeper.options %}&#xA;        &amp;lt;input id=&quot;isBeekeeper{{ option.label }}&quot; type=&quot;radio&quot; name=&quot;fields[areYouBeekeeper][]&quot; &#xA;        {%- if account is defined %}value=&quot;{{ option.label }}&quot;{% endif -%}&amp;gt;&#xA;        &amp;lt;label for=&quot;isBeekeeper{{ option.label }}&quot;&amp;gt;{{ option.value }}&amp;lt;/label&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button expanded&quot; value=&quot;Registreer&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think the problem is with the for loop. I'm trying to output the radio options with a for loop on an entry, but it's actually not an entry. No idea why I do get the options anyway.&#xA;I've managed to get this working with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[areYouBeekeeper]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; value=&quot;yes&quot; name=&quot;fields[areYouBeekeeper]&quot; {%- if account is defined %}value=&quot;{{ account.areYouBeekeeper }}&quot;{% endif -%}&amp;gt;Yes&amp;lt;/label&amp;gt;&#xA;&amp;lt;label&amp;gt;&amp;lt;input type=&quot;radio&quot; value=&quot;no&quot; name=&quot;fields[areYouBeekeeper]&quot; {%- if account is defined %}value=&quot;{{ account.areYouBeekeeper }}&quot;{% endif -%}&amp;gt;No&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6433" LastEditorUserId="6433" LastEditDate="2017-03-16T09:23:25.127" LastActivityDate="2017-09-12T22:54:56.210" Title="How to implement radiobuttons field on frontend registration form?" Tags="&lt;form&gt;&lt;frontend&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19439" PostTypeId="2" ParentId="19411" CreationDate="2017-03-15T09:48:57.800" Score="3" Body="&lt;p&gt;This is the solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(craft.request.getParam('category')).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5872" LastEditorUserId="57" LastEditDate="2017-03-15T22:07:33.620" LastActivityDate="2017-03-15T22:07:33.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19440" PostTypeId="1" AcceptedAnswerId="19454" CreationDate="2017-03-15T10:12:41.840" Score="2" ViewCount="90" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/bjerenec/craftcms-multidatefield&quot; rel=&quot;nofollow noreferrer&quot;&gt;multidate field&lt;/a&gt; plugin, which is excellent at presenting dates but I need to return entries based on testing the first date in there. I typically test with the entries loop, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.dates.dates[0] | date('U') &amp;gt; now | date ('U') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but would prefer to only get entries fitting that criteria in the first place. Is there any way to fetch entries according to the first value in a an array like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.dates(somehow only test the first value in the dates array here) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dates [ // this is the custom field name&#xA;    dates [ // this is the dates array within the custom field&#xA;        [0] // this is the date object I want to test against&#xA;        [1]&#xA;        [2]&#xA;    ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="57" LastEditDate="2017-03-15T21:47:59.153" LastActivityDate="2017-03-15T22:06:41.280" Title="Fetch entries filtered by array within custom field" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19441" PostTypeId="1" CreationDate="2017-03-15T11:25:23.467" Score="1" ViewCount="62" Body="&lt;p&gt;Sometimes I need to reorder or drop certain entry to different ancestor entry in control panel. By doing that I &quot;lose&quot; some entries on front end using &lt;code&gt;{% nav %}&lt;/code&gt; tag. A behaviour is depended on how I reorder entries. Why?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# We excluded the entry id which is ancestor of all entries in structure #}&#xA;{% set shop = craft.entries.section('shop').id('not 96') %}&#xA;&#xA;{% nav page in shop %}&#xA;{% set slug = page.slug %}&#xA;&#xA;   &amp;lt;li&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;&#xA;      &amp;lt;span&amp;gt;&#xA;        {{ page.title }}&#xA;      &amp;lt;/span&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;    {# Link description #}&#xA;    {% if lastSeg == page.slug %}&#xA;      &amp;lt;span&amp;gt;{{ description|ucfirst }}&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% ifchildren %}&#xA;      &amp;lt;ul class=&quot;hide{% if slug == secondSeg or slug == thirdSeg or slug == lastSeg %} show{% endif %}&quot;&amp;gt;&#xA;        {% children %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endifchildren %}&#xA;&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The structure section in control panel&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KKgJb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KKgJb.jpg&quot; alt=&quot;The structure section in control panel&quot;&gt;&lt;/a&gt;&#xA;&lt;strong&gt;Not complete entries in front end&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eM1FB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eM1FB.jpg&quot; alt=&quot;Entries in front end&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2017-04-19T07:00:20.797" LastActivityDate="2017-04-19T07:00:20.797" Title="By reordering entries in structure Craft doesn't show up some entries on front-end using {% nav %} tag" Tags="&lt;structure&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19442" PostTypeId="1" CreationDate="2017-03-15T11:46:26.747" Score="2" ViewCount="138" Body="&lt;p&gt;This is my first multi locale Craft setup and everything is cool on my local/dev environment. However running into difficulty on the production server (Digital Ocean/ServerPilot). My default (EN) version plays nice but my German locale returns a 500 when isSystemOn =&gt; 'true'. When set to false it displays the appropriate 'Unavailable' (503) template. So it looks like everything is setup fine as far as Digital Ocean, ServerPilot, domain, etc... so I'm wondering if there's something amiss in my config?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 &quot;apps&quot; setup in ServerPilot for my default (EN) and German sites. My German app contains a public folder with an index.php that contains the server path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../../sitenamecom/craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried a full server path but the above seems to work fine anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in my config/general.php I've got all the usual stuff, plus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// production (DE)&#xA;'sitename.de' =&amp;gt; array(&#xA;    'backupDbOnUpdate'                  =&amp;gt; true,&#xA;    'devMode'                           =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'baseUrl'                       =&amp;gt; 'https://sitename.de',&#xA;        'basePath'                      =&amp;gt; realpath(dirname(__FILE__)) . '/../../public',&#xA;    ),&#xA;    'isSystemOn'                        =&amp;gt; false,&#xA;    'siteUrl'                           =&amp;gt; 'https://sitename.de/',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So as I say, everything working fine on my local server but with isSystemOn set to true on production I get an Internal Server Error. Anyone got any suggestions on how best to debug this?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-15T13:44:18.537" Title="Internal Server Error on Locale" Tags="&lt;localization&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19443" PostTypeId="2" ParentId="19442" CreationDate="2017-03-15T13:44:18.537" Score="1" Body="&lt;p&gt;Okay I'm all set now. Turns out it was a production environment/MySQL issue, and it's cropped up before on Digital Ocean. See Brad's fix &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12084/getting-this-sql-error-group-by-incompatible-with-sql-mode-only-full-group-by/12106#&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just added&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to my config/db.php and good to go.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-03-15T13:44:18.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19444" PostTypeId="2" ParentId="19373" CreationDate="2017-03-15T14:08:13.853" Score="3" Body="&lt;p&gt;The font stack for Craft Admin &lt;em&gt;doesn't specify Arial&lt;/em&gt;, that's the sans-serif fallback shown on &lt;em&gt;your&lt;/em&gt; system as your machine doesn't have the only specified font Helvetica Neue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;font-family: HelveticaNeue, sans-serif;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given this it's probably better to let the system sans serif cascade down to Redactor, as it may not be either Helvetica Neue or Arial. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have Helvetica Neue in your system font book then you would get the &lt;a href=&quot;https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/#details-of-approach-b&quot; rel=&quot;nofollow noreferrer&quot;&gt;default system sans&lt;/a&gt;; Oxygen on KDE, Ubuntu on Ubuntu, Cantarell on Gnome, Fira Sans on Firefox OS, Roboto on Android, Droid Sans on older Android devices or Segoe UI for Windows machines with OS Vista or newer. Therefore I'd suggest inheriting whichever font Craft Admin is using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor-layer * {&#xA;  font-family: inherit;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-15T14:08:13.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19445" PostTypeId="1" AcceptedAnswerId="19446" CreationDate="2017-03-15T15:10:46.083" Score="2" ViewCount="447" Body="&lt;p&gt;I have some Featured news entries which appear at the top of the rest of the news entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I set this so they are only on page 1 (before any pagination pages)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Only show on page 1 of pagination #}&#xA;&#xA;   {% for entry in craft.entries.section('newsEvents').highlightNews('1').limit(2) %}&#xA;&#xA;   &amp;lt;div class=&quot;col-12 {% if loop.index is divisibleby(2) %}last{% endif %} panel &quot;&amp;gt;&#xA;&#xA;     {% if entry.listingImage|length %}&#xA;    {% for image in entry.listingImage %}&#xA;      &amp;lt;div class=&quot;panel__img&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('listingMedium')}}&quot; alt=&quot;{{ image.title }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;{# End only show on page 1 of pagination #}&#xA;&#xA;&#xA;&#xA;{% paginate craft.entries.section('newsEvents').limit(12) as entriesOnPage %}&#xA;&#xA;  {% for entry in entriesOnPage %}&#xA;&#xA;    ...&#xA;&#xA;  {% endfor %} &#xA;&#xA;&#xA;{% if paginate.totalPages &amp;gt; 1 %}&#xA;&#xA;{% set pagination = true %}&#xA;&#xA;  &amp;lt;ul class=&quot;pagination&quot;&amp;gt;&#xA;    {% if paginate.prevUrl %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.prevUrl }}&quot;&amp;gt;&amp;amp;#171;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;&#xA;    {% for page, url in paginate.getPrevUrls(5) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;li class=&quot;current&quot;&amp;gt;{{ paginate.currentPage }}&amp;lt;/li&amp;gt;&#xA;&#xA;&#xA;    {% for page, url in paginate.getNextUrls(5) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if paginate.nextUrl %}&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ paginate.nextUrl }}&quot;&amp;gt;&amp;amp;#187;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;&#xA; &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2017-03-15T16:09:29.553" LastActivityDate="2017-03-16T15:58:16.520" Title="Check which pagination page to display code outside of pagination loop" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19446" PostTypeId="2" ParentId="19445" CreationDate="2017-03-15T15:41:19.503" Score="3" Body="&lt;p&gt;&lt;strong&gt;UPDATED/EDIT ANSWER:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to show the entries on the first page you should make an if statement to check if you are on the first page for your Featured Items by requesting the page number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPageNum() == 1 %} &#xA;&#xA;// Featured content here&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getLastSegment() == 'p1' %} &#xA;&#xA;// Featured content here&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first option is the best / cleanest solution even though they give the same outcome. Option 2 is a nice work around but might be more usefull in other ways then this one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More about craft requests can be found in the docs:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-03-16T15:58:16.520" LastActivityDate="2017-03-16T15:58:16.520" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19447" PostTypeId="1" CreationDate="2017-03-15T16:56:07.170" Score="2" ViewCount="33" Body="&lt;p&gt;There is a &lt;code&gt;publishMonth&lt;/code&gt; (multiselect) and &lt;code&gt;publishYear&lt;/code&gt; (radio buttons) field in each article. They do not correspond to an actual date. Each article is is associated with one year, or one or more months. I'd like my editor to be able to change two global variables. &lt;code&gt;currentMonth&lt;/code&gt; (radio button), and &lt;code&gt;currentYear&lt;/code&gt; (radio button) to change all the articles display on the webpage at once at any time she pleases. Some articles may be associated with one or more months. Articles do not get changed over at the same date and time each month, which is why it's not associated with a real month or year. The code below returns nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to make it as easy as possible for my editor to &quot;flick the switch&quot; to the next month.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dogs = craft.entries.section('news').order('articleOrder desc').limit(5) %}&#xA;{% for entry in dogs %}&#xA;&#xA;    {% if entry.publishYear in currentEdition.currentYear %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% for image in entry.images.limit(1) %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl('frontPageThumbnail') }}&quot; class=&quot;main-image&quot;&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;p&amp;gt;{{ entry.body|striptags|slice(0,300) }}... &amp;lt;a href=&quot;{{ entry.URL }}&quot; class=&quot;readmore&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ entry.publishYear }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for option in entry.publishMonth %}&#xA;            &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6441" LastEditorUserId="45" LastEditDate="2017-03-15T18:51:04.513" LastActivityDate="2017-03-15T18:51:04.513" Title="I want to display entries that have a field that is the same as a field in a global variable" Tags="&lt;forloop&gt;&lt;entries-field&gt;&lt;globals&gt;&lt;comparisons&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19448" PostTypeId="2" ParentId="19447" CreationDate="2017-03-15T17:18:27.073" Score="1" Body="&lt;p&gt;Since you've confirmed that the issue is in the &lt;code&gt;if&lt;/code&gt; statement and I can see your &lt;em&gt;comparison&lt;/em&gt;, I'll clarify usage and propose a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;in&lt;/code&gt; operator, is a &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/templates.html#containment-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;containment operator&lt;/a&gt; and it expects a &lt;code&gt;scalar|primitive&lt;/code&gt; value on the left and an &lt;code&gt;array|iterable&lt;/code&gt; on the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming that &lt;code&gt;entry.publishYear&lt;/code&gt; is an &lt;code&gt;int&lt;/code&gt; or a &lt;code&gt;string&lt;/code&gt;: &lt;code&gt;2017&lt;/code&gt;. However, I'm not sure about &lt;code&gt;currentEdition.currentYear&lt;/code&gt;. It seems like it's also an &lt;code&gt;int&lt;/code&gt; or &lt;code&gt;string&lt;/code&gt;: &lt;code&gt;2017&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;currentEdition.currentYear&lt;/code&gt; is not an &lt;code&gt;array&lt;/code&gt; or an &lt;code&gt;iterable&lt;/code&gt; item, you should use &lt;code&gt;==&lt;/code&gt; instead of &lt;code&gt;in&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.publishYear == currentEdition.currentYear %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you tried that? Or can you try it and let me know?&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2017-03-15T17:18:27.073" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19449" PostTypeId="1" AcceptedAnswerId="19450" CreationDate="2017-03-15T18:16:15.423" Score="3" ViewCount="234" Body="&lt;p&gt;I want to remain on the page I just saved so I can view it in the browser and return to continue editing, without having to find the page again in the all pages/entries area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to change the Craft CMS defaults on this?&lt;/p&gt;&#xA;" OwnerUserId="6443" LastActivityDate="2017-03-15T18:41:55.217" Title="Is there a way to change what happens after you save a new entry?" Tags="&lt;entries&gt;&lt;admin&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19450" PostTypeId="2" ParentId="19449" CreationDate="2017-03-15T18:41:55.217" Score="3" Body="&lt;p&gt;You can, and it's easy!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Save&quot; button contains a dropdown arrow, with alternative options for saving:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IzSEw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IzSEw.png&quot; alt=&quot;Save options&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll notice that &quot;Save and continue editing&quot; is the top option. You may also notice that there's a keyboard shortcut for it... &lt;code&gt;cmd + s&lt;/code&gt; on Mac, &lt;code&gt;ctrl + s&lt;/code&gt; on PC.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-15T18:41:55.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19451" PostTypeId="1" CreationDate="2017-03-15T19:30:50.690" Score="1" ViewCount="411" Body="&lt;p&gt;I'm creating a simple site where the user can buy exactly 1 product for exactly 1 price. My client wants to offer PayPal to the users for paying this product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which solution/plugin/whatever do you propose? Commerce seems to be a bit too big for this, I don't have lots of products with specifications, etc. But I didn't find any other plugin that can handle PayPal. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4633" LastEditorUserId="45" LastEditDate="2017-03-15T20:39:07.460" LastActivityDate="2017-03-15T22:14:54.573" Title="Simple PayPal connection with Craft?" Tags="&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19452" PostTypeId="1" AcceptedAnswerId="19457" CreationDate="2017-03-15T19:57:06.060" Score="4" ViewCount="695" Body="&lt;p&gt;For news entries I want both URL's www.example.com/news/678 (where 678 stands for the entry id) and www.example.com/news/some-slug to load the same entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.example.com/news/some-slug works fine because 'Entry URL Format' is used for this so the news entry contains a readable slug for SEO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to generate www.example.com/news/678 (with entry id) for the same entry, to display the same news entry? Is it possible to handle this with Dynamic Routing? Or generate multiple URL Formats?&lt;/p&gt;&#xA;" OwnerUserId="6444" LastActivityDate="2017-03-16T00:48:48.093" Title="Multiple URL's for news entry?" Tags="&lt;entry&gt;&lt;url&gt;&lt;routing&gt;&lt;format&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19454" PostTypeId="2" ParentId="19440" CreationDate="2017-03-15T22:06:41.280" Score="1" Body="&lt;p&gt;That plugin doesn't provide a custom element type, so there's no way for it to have a chance to modify the main elements query when fetching the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its existing form, you'll have to do the filtering on the Twig side like you're doing to grab the one you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-15T22:06:41.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19455" PostTypeId="2" ParentId="19451" CreationDate="2017-03-15T22:14:54.573" Score="2" Body="&lt;p&gt;Depends on your requirements, but seems like you'd just be able to use the standard PayPal checkout button for this, no?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.paypal.com/us/webapps/mpp/paypal-payments-standard&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.paypal.com/us/webapps/mpp/paypal-payments-standard&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-15T22:14:54.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19456" PostTypeId="2" ParentId="19452" CreationDate="2017-03-15T22:27:20.953" Score="0" Body="&lt;p&gt;I'm not seeing how this could be done through routes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could do it with a custom plugin that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getElementRoute&quot; rel=&quot;nofollow noreferrer&quot;&gt;getElementRoute&lt;/a&gt; hook, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a feature request here you might want to thumb-up/comment on that would seem to do what you're looking for: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1189&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1189&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-15T22:27:20.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19457" PostTypeId="2" ParentId="19452" CreationDate="2017-03-16T00:38:03.037" Score="1" Body="&lt;p&gt;Setup a dynamic route that points to the same template that you have set up in the section settings for your &quot;slug URLs&quot;. Use a pattern like so: &lt;code&gt;news/&amp;lt;id&amp;gt;&lt;/code&gt;, which passes the 2rd URL segment as a variable named &lt;code&gt;id&lt;/code&gt; to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this snippet to the top of your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry and id %}&#xA;    {% set entry = craft.entries.id(id).first() %}&#xA;{% endif %}&#xA;&#xA;{% if not entry %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If Craft finds a route for your entry slug (&lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;routing case 3&lt;/a&gt;), that code does nothing at all, because the entry model is already set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When no route was found that matches an entry slug, your dynamic route comes into play (&lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;routing case 4&lt;/a&gt;), which routes the request to the same template.&#xA;But now there is no entry variable set and we can go ahead and try to grab it manually using the &lt;code&gt;id&lt;/code&gt; variable passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br&gt;&#xA;as already mentioned in the comments, &lt;strong&gt;don’t forget&lt;/strong&gt; to setup canonical meta tags to avoid duplicate content penalties.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ entry.getUrl() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-03-16T00:48:48.093" LastActivityDate="2017-03-16T00:48:48.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19458" PostTypeId="1" CreationDate="2017-03-16T04:46:14.637" Score="2" ViewCount="44" Body="&lt;p&gt;I'm in the process of building a plugin that'll have extensible 'Providers' to allow developers to build connections to other services. These 'Providers' will just be classes that are built to an interface I've included in the plugin. (It's currently in an 'interfaces' directory of my plugin; I'm not sure about the best-practice for where interfaces should be stored.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; What I'm having trouble with is how to include the developer's Provider class when I don't know what the name will be. Here's what I'm doing now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require_once(CRAFT_PLUGINS_PATH . 'location/providers/' . $this-&amp;gt;settings-&amp;gt;provider . 'Provider.php');&#xA;&#xA;$provider = '\Craft\\' . $this-&amp;gt;settings-&amp;gt;provider . 'Provider';&#xA;&#xA;return new $provider();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$this-&amp;gt;settings-&amp;gt;provider&lt;/code&gt; just returns the 'handle' of their Provider, like &lt;code&gt;sampleService&lt;/code&gt;. The file they place in the &lt;code&gt;providers&lt;/code&gt; directory would be &lt;code&gt;sampleServiceProvider.php&lt;/code&gt;, in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If something doesn't make sense, I'll gladly clarify. Any help is &lt;em&gt;greatly&lt;/em&gt; appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2017-03-17T08:35:26.027" Title="Loading dynamically-named classes in a plugin's service" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19459" PostTypeId="1" AcceptedAnswerId="19460" CreationDate="2017-03-16T06:49:20.790" Score="2" ViewCount="515" Body="&lt;p&gt;I am creating a custom dashboard for delivery guys where I want to show the order list in two divs. One is Pending Orders and second is History.&#xA;Basically I want to filter my order list by order status.&#xA;Here is code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastOrders = craft.commerce.orders.relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}&#xA;{% for order in pastOrders %}&#xA;   {{order.id}}&#xA;   {{order.orderStatus.name}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="125" LastEditDate="2017-03-16T07:30:53.773" LastActivityDate="2017-09-12T13:45:24.423" Title="Filter order by order status" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19460" PostTypeId="2" ParentId="19459" CreationDate="2017-03-16T08:13:29.613" Score="4" Body="&lt;p&gt;I would run two queries and then you could utilise the &lt;code&gt;completed()&lt;/code&gt; parameter:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-orders#completed&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/craft-commerce-orders#completed&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastOrders = craft.commerce.orders.completed(true).relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}&#xA;{% for order in pastOrders %}&#xA;   {{order.id}}&#xA;   {{order.orderStatus.name}}&#xA;{% endfor %}&#xA;&#xA;{% set pendingOrders = craft.commerce.orders.completed(false).relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}&#xA;{% for order in pendingOrders %}&#xA;   {{order.id}}&#xA;   {{order.orderStatus.name}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5740" LastActivityDate="2017-03-16T08:13:29.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19461" PostTypeId="1" CreationDate="2017-03-16T08:38:31.727" Score="2" ViewCount="1168" Body="&lt;p&gt;I add items to my cart using ajax, following the code from this post&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17347/update-commerce-cart-using-ajax&quot;&gt;Update Commerce Cart using Ajax&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are some things missing in the cart object returned on success, they are :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The URL of the page of the product added &lt;/li&gt;&#xA;&lt;li&gt;The images, and all the fields from the product added&lt;/li&gt;&#xA;&lt;li&gt;The name of the variant of the product added&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Are these somewhere in the object returned ? Otherwise, how could I retrieve them ?&lt;/p&gt;&#xA;" OwnerUserId="6015" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-03-17T00:22:28.937" Title="Craft Commerce ajax add to cart, missing information" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19462" PostTypeId="1" AcceptedAnswerId="19467" CreationDate="2017-03-16T09:19:25.930" Score="2" ViewCount="456" Body="&lt;p&gt;Well, to be honest i am completely new, not only to Craft but to most PHP stuff as well.&#xA;I am currently trying to setup a search for my page but i seem to miss a crucial step and can not find any tutorials on what to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my front/ index page i included&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as stated in the Craft Documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also set up a single page for my search results with the code from the Documentation as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Search Results&amp;lt;/h1&amp;gt;&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score') %}&#xA;{% if entries|length %}&#xA;&amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;&amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, now if i try to search at the index page and hit enter, it just reloads the index page with the search term&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;site.url/index.php?q=test&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So for sure i am missing a step here and am not loading the right page. I guess it should be stated in {{ url('search/results') }}, but i have no idea what to put there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be great if anybody could help me or at least point me to a tutorial that focuses on setting up a site search in Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="6432" LastEditorUserId="57" LastEditDate="2017-03-16T17:52:43.997" LastActivityDate="2017-03-16T17:52:43.997" Title="Can't get Frontend Search to work" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19463" PostTypeId="1" AcceptedAnswerId="19464" CreationDate="2017-03-16T10:20:45.193" Score="2" ViewCount="89" Body="&lt;p&gt;On a complex page, where there are different sections that need to be present in the template, but may not all have content added via Craft entries I need to stop the empty areas from being output (e.g. a set of div's that will create an ugly empty space in the page).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can successfully do this for empty simple entries - like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.modelTitleType %}&#xA;    &amp;lt;div class=&quot;col-1-1&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ entry.modelTitleType }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.modelIntroType }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the div enclosed by the 'if' statement is only output if there's an entry added for 'modelTitleType'.  But I cannot get this to work for a Matrix entry!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I wrap an 'if' statement around a Matrix block like this, so it is only output if there's data added?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;selector padded-top inline-list&quot;&amp;gt;&#xA;    {% for block in entry.modelDataType1 %}&#xA;        {% if block.type == &quot;type&quot; %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a class=&quot;button-list selected&quot; id=&quot;show-type1&quot; title=&quot;{{ block.typeName }}&quot;&amp;gt;{{ block.typeName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    {% for block in entry.modelDataType2 %}&#xA;        {% if block.type == &quot;type&quot; %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a class=&quot;button-list&quot; id=&quot;show-type2&quot; title=&quot;{{ block.typeName }}&quot;&amp;gt;{{ block.typeName }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.modelDataType1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be very much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="5872" LastEditorUserId="3848" LastEditDate="2017-03-16T17:43:10.987" LastActivityDate="2017-03-16T17:43:10.987" Title="How do you use 'if' to stop an empty Matrix block from displaying?" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19464" PostTypeId="2" ParentId="19463" CreationDate="2017-03-16T10:29:01.697" Score="1" Body="&lt;p&gt;If a Matrix field / block is empty it won't output at all but you can try checking the length in an if statement like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.modelDataType1 | length %}&#xA;    // matrix content here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="57" LastEditDate="2017-03-16T17:42:50.307" LastActivityDate="2017-03-16T17:42:50.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19465" PostTypeId="1" CreationDate="2017-03-16T11:42:23.430" Score="2" ViewCount="669" Body="&lt;p&gt;I have a service which am passing a model and an identifier (optional) to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The model contains new data and the aim is that if an existing record exists then we merge the two responses into a json_encoded string for storage. There is some jiggery pokery going on within the service to check against existing records before merging the results and then saving to either 1) a new record (if no id) or 2) update the existing record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All well so far until it comes to saving the record. This returns true within my code but existing records within the database are not saved/updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on why this might be happening appreciated? Service code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function saveReport(MS_ReportModel $model,$id = null) {&#xA;  if ($id &amp;gt; 0) {&#xA;    $tmp = [];&#xA;    $record = MS_ReportRecord::model()-&amp;gt;findByAttributes(array('id' =&amp;gt; $id));&#xA;    $fields = json_decode($record-&amp;gt;report);&#xA;    // merge jiggery pokerey here //&#xA;    $record-&amp;gt;setAttribute('report',json_encode($merge));&#xA;  } else {&#xA;    $record = new MS_ReportRecord;&#xA;  }&#xA;  // add other attributes here //&#xA;  if ($record-&amp;gt;save()) {&#xA;    return $record-&amp;gt;id;&#xA;  } else {&#xA;    return false;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've found a similar thread at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10984/craft-cms-plugin-save-record-to-db-from-variable&quot;&gt;Craft CMS Plugin Save Record to DB from Variable&lt;/a&gt; but cannot reproduce the solution discussed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cannot see for the life of me why the record is saving (i.e. returning a true response) but the relevant values are not being reflected in the database. If I output the &lt;code&gt;$record&lt;/code&gt; object at any stage after the merge has taken place it contains the values I expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ta, Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-03-16T11:42:23.430" Title="Custom plugin - cannot save record" Tags="&lt;plugin-development&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19467" PostTypeId="2" ParentId="19462" CreationDate="2017-03-16T12:44:01.760" Score="1" Body="&lt;p&gt;Inside of the &lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&lt;/code&gt; You define which page should be redirected to when the search form is submitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;search/results&quot; would go to the search folder looking for the results.(html / twig). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to redirect to another page you should name the folder (which is &quot;search&quot; now) then the template name. This can be static without creating a &quot;Single&quot; for that page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you did create a single that uses that template and you want to go through your single you can just put the slug of the created Single inside your form action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You made a folder in craft/templates/ named: search, inside that folder you make a file named: results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the file structure would be craft/templates/search/results.twig and the form action would be: &lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can just use the preset search template the craft docs offer you. You could also change &quot;results.twig/html&quot; to index.html and then your form action wouldn't need the /results so your action would look like:&#xA;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search') }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I see you get redirect to /index.php/ aswell so I should try rmeoving that by changing your &lt;code&gt;.htaccess&lt;/code&gt; file and maybe your general.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find instructions on how to do that here:&#xA;&lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-16T12:44:01.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19468" PostTypeId="2" ParentId="19421" CreationDate="2017-03-16T12:58:55.500" Score="2" Body="&lt;p&gt;The default MAMP DB credentials are indeed root:root, as you have already, so you should check that you did indeed create a database (set up as &lt;a href=&quot;https://craftcms.com/docs/installing#step-3-create-your-database&quot; rel=&quot;nofollow noreferrer&quot;&gt;detailed here&lt;/a&gt;) and that it is indeed called ‘mycraft’.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also check in your MAMP control panel that the MySQL is actually running:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jTMBU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jTMBU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-16T12:58:55.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19469" PostTypeId="2" ParentId="19427" CreationDate="2017-03-16T13:04:59.437" Score="2" Body="&lt;p&gt;You would need to define them in &lt;a href=&quot;https://github.com/spoeken/gulp-craftcms/blob/master/gulpfile.js#L97&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Gulp file build uglify task&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-16T13:04:59.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19470" PostTypeId="1" AcceptedAnswerId="19565" CreationDate="2017-03-16T14:22:59.467" Score="1" ViewCount="125" Body="&lt;p&gt;I've got a weird problem; I've set up a site in different languages, and everything is working a-ok, except for the homepage; when I try to acces it I get a PHP warning - you can find the full stack trace at the end of my post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other pages work, they show me the language I want and all. Just the homepage only works in my default language...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated :-), thanks!!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Stack Trace&#xA;#0  &#xA;–  /data/sites/web/e-c-sbe/craft/app/etc/web/WebApp.php(687): CApplication-&amp;gt;handleError(2, &quot;array_chunk() expects parameter 1 to be array, null given&quot;, &quot;/    data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Exte...&quot;, 1535)&#xA;682         if (version_compare(PHP_VERSION, '7', '&amp;gt;=') &amp;amp;&amp;amp; $code === 2 &amp;amp;&amp;amp; strpos($message, 'should be compatible with') !== false)&#xA;683         {&#xA;684             return;&#xA;685         }&#xA;686 &#xA;687         parent::handleError($code, $message, $file, $line);&#xA;688     }&#xA;689 &#xA;690     // Private Methods&#xA;691     // =========================================================================&#xA;692 &#xA;#1  &#xA; unknown(0): Craft\WebApp-&amp;gt;handleError(2, &quot;array_chunk() expects parameter 1 to be array, null given&quot;, &quot;/data/sites/web/e-c-sbe/craft/app/vendor/twig/twig    /lib/Twig/Exte...&quot;, 1535, ...)&#xA;#2  &#xA;–  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Extension/Core.php(1535): array_chunk(null, 2, true)&#xA;1530         $items = iterator_to_array($items, false);&#xA;1531     }&#xA;1532 &#xA;1533     $size = ceil($size);&#xA;1534 &#xA;1535     $result = array_chunk($items, $size, true);&#xA;1536 &#xA;1537     if (null !== $fill &amp;amp;&amp;amp; !empty($result)) {&#xA;1538         $last = count($result) - 1;&#xA;1539         if ($fillCount = $size - count($result[$last])) {&#xA;1540             $result[$last] = array_merge(&#xA;#3  &#xA;–  /data/sites/web/e-c-sbe/craft/storage/runtime/compiled_templates/ef/ef68483640021c461c9f0d53587a31241b074af4e80159c50a1cf3a4565420d1.php(430):     twig_array_batch(null, 2)&#xA;425                 &amp;lt;div class=\&quot;w-slider-mask\&quot;&amp;gt;&#xA;426 &#xA;427                     &quot;;&#xA;428         // line 162&#xA;429         $context['_parent'] = $context;&#xA;430         $context['_seq'] = twig_ensure_traversable(twig_array_batch($this-&amp;gt;getAttribute((isset($context[&quot;entry&quot;]) ? $context[&quot;entry&quot;] : $this-&amp;gt;    getContext($context, &quot;entry&quot;)), &quot;klantenQuotes&quot;, array()), 2));&#xA;431         foreach ($context['_seq'] as $context[&quot;_key&quot;] =&amp;gt; $context[&quot;slides&quot;]) {&#xA;432             // line 163&#xA;433             echo &quot;                        &amp;lt;div class=\&quot;slide1 w-slide\&quot;&amp;gt;&#xA;434                             &amp;lt;div class=\&quot;slide-1-content\&quot;&amp;gt;&#xA;435                                 &quot;;&#xA;#4  &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(167):     __TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d-&amp;gt;block_content(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt;     Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;bottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#5  &#xA;+  /data/sites/web/e-c-sbe/craft/storage/runtime/compiled_templates/76/76fb570d339de61001353339d594478c1219a1ef8f5ce7d5541281bfea844196.php(208):     Twig_Template-&amp;gt;displayBlock(&quot;content&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt;     Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt; array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;),     &quot;bottomJs&quot; =&amp;gt; array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#6  &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(167):     __TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8-&amp;gt;block_body(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel,     &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;bottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#7  &#xA;+  /data/sites/web/e-c-sbe/craft/storage/runtime/compiled_templates/80/80a604e9c0f9191d0882f12592d428315276bc5139a7eb60d5a0471c28224baa.php(102):     Twig_Template-&amp;gt;displayBlock(&quot;body&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt;     Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt; array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;),     &quot;bottomJs&quot; =&amp;gt; array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#8  &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(387):     __TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da-&amp;gt;doDisplay(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel,     &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;bottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#9  &#xA;+  /data/sites/web/e-c-sbe/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel,     &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;bottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#10 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(355): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt;     Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;bottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_bottomJs&quot;), &quot;extraBottomJs&quot; =&amp;gt;     array(__TwigTemplate_4efd4701086b5bbbfbba3e63e2148b044c01a352aa2bed5255469320f17ec1da, &quot;block_extraBottomJs&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#11 &#xA;+  /data/sites/web/e-c-sbe/craft/storage/runtime/compiled_templates/76/76fb570d339de61001353339d594478c1219a1ef8f5ce7d5541281bfea844196.php(35):     Twig_Template-&amp;gt;display(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable,     ...), array(&quot;body&quot; =&amp;gt; array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#12 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(387):     __TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8-&amp;gt;doDisplay(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel,     &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#13 &#xA;+  /data/sites/web/e-c-sbe/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel,     &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#14 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(355): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt;     Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;body&quot; =&amp;gt;     array(__TwigTemplate_1684515eed9a6cf9ffb79b59311c6f12e864fc567eac8ab3dbfb422ccadd74f8, &quot;block_body&quot;), &quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#15 &#xA;+  /data/sites/web/e-c-sbe/craft/storage/runtime/compiled_templates/ef/ef68483640021c461c9f0d53587a31241b074af4e80159c50a1cf3a4565420d1.php(47):     Twig_Template-&amp;gt;display(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable,     ...), array(&quot;content&quot; =&amp;gt; array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#16 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(387):     __TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d-&amp;gt;doDisplay(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel,     &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#17 &#xA;+  /data/sites/web/e-c-sbe/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel,     &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#18 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(355): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;entry&quot; =&amp;gt;     Craft\EntryModel, &quot;user&quot; =&amp;gt; Craft\UserModel, &quot;currentUser&quot; =&amp;gt; Craft\UserModel, &quot;craft&quot; =&amp;gt; Craft\CraftVariable, ...), array(&quot;content&quot; =&amp;gt;     array(__TwigTemplate_7683c934653be972173cc399f892a6300d56680399943fc28a98036775c6f34d, &quot;block_content&quot;)))&#xA;#19 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Template.php(366): Twig_Template-&amp;gt;display(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#20 &#xA;+  /data/sites/web/e-c-sbe/craft/app/vendor/twig/twig/lib/Twig/Environment.php(347): Twig_Template-&amp;gt;render(array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#21 &#xA;+  /data/sites/web/e-c-sbe/craft/app/services/TemplatesService.php(256): Twig_Environment-&amp;gt;render(&quot;index&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#22 &#xA;+  /data/sites/web/e-c-sbe/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render(&quot;index&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#23 &#xA;+  /data/sites/web/e-c-sbe/craft/app/controllers/TemplatesController.php(55): Craft\BaseController-&amp;gt;renderTemplate(&quot;index&quot;, array(&quot;entry&quot; =&amp;gt;     Craft\EntryModel))&#xA;#24 &#xA; unknown(0): Craft\TemplatesController-&amp;gt;actionRender(&quot;index&quot;, array(&quot;entry&quot; =&amp;gt; Craft\EntryModel))&#xA;#25 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Craft\TemplatesController, array(&quot;index&quot;,     array(&quot;entry&quot; =&amp;gt; Craft\EntryModel)))&#xA;#26 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Craft\TemplatesController,     ReflectionMethod, array(&quot;variables&quot; =&amp;gt; array(&quot;entry&quot; =&amp;gt; Craft\EntryModel), &quot;template&quot; =&amp;gt; &quot;index&quot;))&#xA;#27 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;variables&quot; =&amp;gt; array(&quot;entry&quot; =&amp;gt;     Craft\EntryModel), &quot;template&quot; =&amp;gt; &quot;index&quot;))&#xA;#28 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(CInlineAction)&#xA;#29 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(CInlineAction, array())&#xA;#30 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run(&quot;render&quot;)&#xA;#31 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController(&quot;templates/render&quot;)&#xA;#32 &#xA;+  /data/sites/web/e-c-sbe/craft/app/etc/web/WebApp.php(290): CWebApplication-&amp;gt;processRequest()&#xA;#33 &#xA;+  /data/sites/web/e-c-sbe/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#34 &#xA;+  /data/sites/web/e-c-sbe/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#35 &#xA;+  /data/sites/web/e-c-sbe/www/en/index.php(22): require_once(&quot;/data/sites/web/e-c-sbe/craft/app/index.php&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="4934" LastEditDate="2017-03-17T07:57:13.230" LastActivityDate="2017-03-22T08:16:00.877" Title="Can't access my homepage in different locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19471" PostTypeId="1" AcceptedAnswerId="19479" CreationDate="2017-03-16T14:40:43.053" Score="2" ViewCount="54" Body="&lt;p&gt;I have additional fields I check for in the &lt;code&gt;onBeforeSaveUser&lt;/code&gt; event and add the errors to the errors array. The problem is my code doesnt even run if they miss the main fields or if the email is already in use or something like that... I would like to return ALL validation errors, not just the default field errors first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to my form and just press submit without filling anything it out it only complains about the username, email address and password. If I just fill those fields out, then it comes back and complains about all my other fields (a la my event handler). This is unexpected behavior. Am I doing something wrong or is there a way to address this?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="57" LastEditDate="2017-03-16T18:53:45.477" LastActivityDate="2017-03-16T18:55:04.560" Title="onBeforeSaveUser event does not fire if basic user fields do not validate" Tags="&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19472" PostTypeId="1" AcceptedAnswerId="19489" CreationDate="2017-03-16T15:51:20.683" Score="2" ViewCount="1018" Body="&lt;p&gt;I have a pop up box on a siteplan image that includes a select dropdown to let people select the apartment that they want. However, I can't get the it to go to the url when it's selected. So need some help please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently when you select Plot 18 from the dropdown options it goes to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;websitename/developments/surrey/knowle-hill-park?sitemap=%2Fplot-18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however it needs to go to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;websitename/developments/surrey/knowle-hill-park/available-homes/plot-18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help show what i'm doing wrong in the form below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ category.url }}&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;      &amp;lt;select id=&quot;sitemap&quot; class=&quot;form-control&quot; name=&quot;sitemap&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;Select Plot No&amp;lt;/option&amp;gt;&#xA;          {% for entry in craft.entries.section('availablehomes').relatedTo(category).level(2).order('plotPrice desc') %}&#xA;          {% if entry.plotType == 'apartment' %}&#xA;          &amp;lt;option value=&quot;/{{ entry.slug }}&quot;&amp;gt;{{ entry.title }} - {{ entry.floor.label }} - {% if entry.plotAvailability == 'available' %}{{ entry.plotPrice|currency('GBP', true) }}{% else %}{{ entry.plotAvailability.label }}{% endif %}&amp;lt;/option&amp;gt;&#xA;          {% endif %}&#xA;          {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iStVh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iStVh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-03-16T17:55:26.307" LastActivityDate="2017-03-17T08:19:39.510" Title="Select dropdown not going to option url" Tags="&lt;form&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19473" PostTypeId="1" AcceptedAnswerId="19520" CreationDate="2017-03-16T17:38:06.257" Score="2" ViewCount="1313" Body="&lt;p&gt;How does one get the sale price of a product in Craft Commerce on a product page? I'm new to Craft and Twig and the &lt;code&gt;sale&lt;/code&gt; section of the Commerce docs is.. well, not really there (page under construction). I have a product that has a sale set on it. I pull the single product without problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set product = craft.commerce.products({&#xA;    relatedTo: category,&#xA;    slug: craft.request.getSegment(3),&#xA;    status: 'live',&#xA;}).first() %}&#xA;&#xA;Product Title - {{ product.title }}&#xA;Product Price - {{ product.defaultPrice|commerceCurrency(cart.currency) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But a &lt;code&gt;{{ dump(product) }}&lt;/code&gt; doesn't show any discount or sale values at all. I know the sale exists and is up; this returns my sale name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for sale in craft.commerce.sales %}&#xA;    {{ sale.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I know my product is a part of that sale, it shows it as a related sale on the product entry page. The sale is wide open (no expiry or start, just one product picked (the one that populates the page I'm testing)). All attempts at sales price result in a templating error: &lt;code&gt;{{ product.price }},{{ product.salePrice }},etc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can think is a nested loop and then conditionals... something like (pseudo code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&quot;price&quot;&amp;gt;&#xA;{% for sale in sales %}&#xA;    {% for sale_product in sale.products %}&#xA;        {% if sale_product.sku == product.sku %}&#xA;            ... do some weird math?&#xA;            Check if % off or $ off and math it up with&#xA;            {{ product.defaultPrice }}?&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that is clearly not how this is supposed to be done. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for that matter, how do I check if it is on sale at all, regardless of the sale value? The client design involves slightly different coloring/styles for a sale price versus a default price.&lt;/p&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="5422" LastEditDate="2017-03-16T17:58:11.537" LastActivityDate="2018-11-04T11:04:51.997" Title="Get sale price in Commerce" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19474" PostTypeId="2" ParentId="8480" CreationDate="2017-03-16T17:39:28.150" Score="9" Body="&lt;p&gt;A better/easier route would be to just create custom Date/Time fields that store the event start and end dates. Entries’ Post and Expiry dates are meant to define when the entry should be visible on the front end; they are not meant to be part of the entry’s content.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-16T17:39:28.150" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19475" PostTypeId="2" ParentId="19461" CreationDate="2017-03-16T17:42:18.557" Score="0" Body="&lt;p&gt;A &lt;a href=&quot;https://craftcommerce.com/docs/order-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce_OrderModel&lt;/a&gt; is returned in the response of a successful call to &lt;code&gt;Commerce_CartController-&amp;gt;actionUpdateCart()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product info you're looking for, you'd get through the &lt;a href=&quot;https://craftcommerce.com/docs/order-model#lineitems&quot; rel=&quot;nofollow noreferrer&quot;&gt;lineItems&lt;/a&gt; property, which would be an array of &lt;a href=&quot;https://craftcommerce.com/docs/line-item-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce_LineItemModel&lt;/a&gt;s.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-16T17:42:18.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19476" PostTypeId="1" CreationDate="2017-03-16T17:47:48.950" Score="1" ViewCount="42" Body="&lt;p&gt;I am setting three variables like so ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featureEntryIds = craft.entries({ section: 'blog', featurePost: 1, limit: 1 }).ids() %}&#xA;&#xA;{% set articleClass = entry.id in featureEntryIds ? 'featured' %}`&#xA;&#xA;{% set featuredPostLayout = entry.featuredPostLayout == 'subtleBar' or 'largeFeature' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I am trying to use a conditional to display posts where the &lt;code&gt;featurePost&lt;/code&gt; lightswitch field is true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AND&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;featuredPostLayout&lt;/code&gt; radio field is either &lt;code&gt;subtleBar&lt;/code&gt; or &lt;code&gt;largeFeature&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if articleClass and featuredPostLayout %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastEditorUserId="57" LastEditDate="2017-03-16T18:57:56.350" LastActivityDate="2017-03-16T18:57:56.350" Title="Trying to display post based on two variables" Tags="&lt;conditional&gt;&lt;variable&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19477" PostTypeId="1" AcceptedAnswerId="19482" CreationDate="2017-03-16T17:58:58.820" Score="0" ViewCount="124" Body="&lt;p&gt;So I have created an Assets field and am using it in one of my Entries. However, when I try to upload an image, it just keeps loading. I am getting the following console error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bQDqt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bQDqt.png&quot; alt=&quot;console error when trying to upload asset&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6440" LastEditorUserId="22" LastEditDate="2017-05-09T20:09:27.373" LastActivityDate="2017-05-09T20:09:27.373" Title="Uploading local asset hangs and produces jQuery console error" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;image&gt;&lt;upload&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19478" PostTypeId="1" CreationDate="2017-03-16T18:21:04.327" Score="1" ViewCount="490" Body="&lt;p&gt;I'm currently trying to cache css and js files with the widely known config as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(png|jpg|css|js|jpeg|gif|ico|xls|doc|zip|exe|mp3|mp4|pdf|ai|psd|eps|ppt|dmg|csv|key|numbers|cur|gz|pages)$ {&#xA;        expires 7d;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried the following config from &lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/nginx-partials/expires.conf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft/blob/master/nginx-partials/expires.conf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~* \.(?:css|js)$ {&#xA;expires 1y;&#xA;access_log off;&#xA;add_header Cache-Control &quot;public&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However with both of these configs I get 404 (not found) when trying to load css and js everything else works fine jpeg, png, ...etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I remove js and css from the config it works perfectly, however its not being cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts are much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Adam&lt;/p&gt;&#xA;" OwnerUserId="6447" LastActivityDate="2017-03-16T18:21:04.327" Title="Craft Nginx Cache Static Resources - Css, JS Errors" Tags="&lt;cache&gt;&lt;javascript&gt;&lt;css&gt;&lt;nginx&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19479" PostTypeId="2" ParentId="19471" CreationDate="2017-03-16T18:55:04.560" Score="1" Body="&lt;p&gt;I agree it's unexpected behavior, but for Craft 2 it won't change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3&lt;/a&gt; had a major overhaul of its event system and validation workflow where it works as you'd expect, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-16T18:55:04.560" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19482" PostTypeId="2" ParentId="19477" CreationDate="2017-03-16T20:53:07.707" Score="2" Body="&lt;p&gt;You can use this support article to help debug failed uploads: &lt;a href=&quot;https://craftcms.com/support/upload-troubleshooting&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/upload-troubleshooting&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-16T20:53:07.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19483" PostTypeId="1" AcceptedAnswerId="19484" CreationDate="2017-03-16T23:24:37.847" Score="2" ViewCount="97" Body="&lt;p&gt;I'd like to add admin privileges to a user I'm creating like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  if($user == null)&#xA;  {&#xA;    $firstName = $_GET['firstName'];&#xA;&#xA;    $lastName = $_GET['lastName'];&#xA;    $userName = $firstName . $lastName;&#xA;    $user = new UserModel();&#xA;&#xA;    $user-&amp;gt;username   = $userName;&#xA;    $user-&amp;gt;email      = $email;&#xA;    $user-&amp;gt;firstName  = $firstName;&#xA;    $user-&amp;gt;lastName   = $lastName;&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;    $permissions = [HOW DO I SET ADMIN PERMS?]&#xA;    craft()-&amp;gt;userPermissions-&amp;gt;saveUserPermissions($user['id'], $permissions)&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6449" LastEditorUserId="57" LastEditDate="2017-03-17T00:04:37.960" LastActivityDate="2017-03-17T00:04:37.960" Title="Is it possible to grant admin permissions via plugins through userPermissions-&gt;saveUserPermissions?" Tags="&lt;plugins&gt;&lt;admin&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19484" PostTypeId="2" ParentId="19483" CreationDate="2017-03-16T23:36:07.900" Score="2" Body="&lt;p&gt;This should do the trick...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;admin = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That data is part of the UserModel, so be sure to add it before the &lt;code&gt;saveUser&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being a full-blown admin not technically part of setting permissions. If the user is an admin, that supersedes all other permissions settings.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-16T23:36:07.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19485" PostTypeId="2" ParentId="19461" CreationDate="2017-03-17T00:22:28.937" Score="1" Body="&lt;p&gt;As Brad said in his answer, what you get back is the lineItem details - enough to update e.g. your totals, shipping quote etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL of the product, and the product fields etc, are not available in the JSON.  But it's hard to see why they would need to be - you're sending this ajax call from somewhere you already have a reference to the product/variant in your twig templates - why would you need this info repeated in the return object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really need that stuff at that point, you're probably better off ajax loading in a twig template to get at the full product stuff.  If you could clraify what you're actually trying to do I can probably help better/describe what we've done.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-17T00:22:28.937" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19486" PostTypeId="2" ParentId="1643" CreationDate="2017-03-17T00:36:16.997" Score="1" Body="&lt;p&gt;Brad &amp;amp; Matt provided good suggestions, but we just found another case where this can happen – when &lt;strong&gt;using matrix blocks with special filters or conditions&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.6 I found that this line does &lt;em&gt;not&lt;/em&gt; update during Live Preview, but instead uses the last saved revision:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.banner.type('bannerContent').first().bannerTitle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas this line works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.banner.first().bannerTitle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="5437" LastEditDate="2017-03-17T02:26:13.333" LastActivityDate="2017-03-17T02:26:13.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19489" PostTypeId="2" ParentId="19472" CreationDate="2017-03-17T08:19:39.510" Score="2" Body="&lt;p&gt;What you're currently seeing is the correct URL for a &lt;code&gt;GET&lt;/code&gt; form submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to update the &lt;code&gt;onsubmit&lt;/code&gt; handler to construct the URL you wish to visit, based on the selected option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to do that, using the omnipresent jQuery. You could probably do the same in plain JS, but I have no idea which browsers you're targeting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function ($) {&#xA;    $('#sitemap').on('change', function (event) {&#xA;        var $select = $(this);&#xA;        var $form = $select.closest('form');&#xA;        var url = '/desired/path/to/development' + $select.val();&#xA;&#xA;        window.location.href = url;&#xA;    });&#xA;}(jQuery));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget to remove the current handler from the markup.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-17T08:19:39.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19490" PostTypeId="2" ParentId="19458" CreationDate="2017-03-17T08:35:26.027" Score="1" Body="&lt;p&gt;Rather than assuming that the providers will live in a specific location, I'd be inclined to implement a &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events#creating-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom hook&lt;/a&gt;, which allows third party plugins to register a new provider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also allows third parties to do any initialisation of their provider, prior to handing it to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, your plugin could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$providers = craft()-&amp;gt;plugins-&amp;gt;call('registerProviders');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a third party could then do something like this, in its main plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerProviders()&#xA;{&#xA;    $instance = new MyProvider('custom', 'dependencies');&#xA;&#xA;    return ['myProvider' =&amp;gt; $instance];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Greatly simplified, but hopefully you get the idea.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-17T08:35:26.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19491" PostTypeId="1" CreationDate="2017-03-17T10:31:28.877" Score="2" ViewCount="372" Body="&lt;p&gt;We built a multicurrency website on Craft Commerce that uses both Euros and Dollars. The base currency is EUR. We use Mollie as payment gateway. However, Mollie only supports Euros on their platform and does not convert other currencies to euros. The conversion has to take place on the website before the user arrives on their platform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is: when a user checks out on our website with dollars, say 100USD, the amount will show up on Mollie as 100EUR. Obviously this is a big issue as the amounts will be off by several percents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we properly fix this?&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2017-06-22T03:46:37.680" Title="How to handle payments on a multicurrency website using Mollie gateway?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19492" PostTypeId="2" ParentId="19491" CreationDate="2017-03-17T10:36:33.203" Score="1" Body="&lt;p&gt;We found a quickfix by editing the &lt;code&gt;Commerce_PaymentsService.php&lt;/code&gt; file in &lt;code&gt;craft/plugins/services/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We changed to following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = [&#xA;    'amount'               =&amp;gt; $transaction-&amp;gt;paymentAmount,&#xA;    'currency'             =&amp;gt; $transaction-&amp;gt;paymentCurrency,&#xA;    'transactionId'        =&amp;gt; $transaction-&amp;gt;id,&#xA;    'description'          =&amp;gt; Craft::t('Order').' #'.$transaction-&amp;gt;orderId,&#xA;    'clientIp'             =&amp;gt; craft()-&amp;gt;request-&amp;gt;getIpAddress(),&#xA;    'transactionReference' =&amp;gt; $transaction-&amp;gt;hash,&#xA;    'returnUrl'            =&amp;gt; UrlHelper::getActionUrl('commerce/payments/completePayment', ['commerceTransactionId' =&amp;gt; $transaction-&amp;gt;id, 'commerceTransactionHash' =&amp;gt; $transaction-&amp;gt;hash]),&#xA;    'cancelUrl'            =&amp;gt; UrlHelper::getSiteUrl($transaction-&amp;gt;order-&amp;gt;cancelUrl),&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = [&#xA;    'amount'               =&amp;gt; $transaction-&amp;gt;amount,&#xA;    'currency'             =&amp;gt; $transaction-&amp;gt;currency,&#xA;    'transactionId'        =&amp;gt; $transaction-&amp;gt;id,&#xA;    'description'          =&amp;gt; Craft::t('Order').' #'.$transaction-&amp;gt;orderId,&#xA;    'clientIp'             =&amp;gt; craft()-&amp;gt;request-&amp;gt;getIpAddress(),&#xA;    'transactionReference' =&amp;gt; $transaction-&amp;gt;hash,&#xA;    'returnUrl'            =&amp;gt; UrlHelper::getActionUrl('commerce/payments/completePayment', ['commerceTransactionId' =&amp;gt; $transaction-&amp;gt;id, 'commerceTransactionHash' =&amp;gt; $transaction-&amp;gt;hash]),&#xA;    'cancelUrl'            =&amp;gt; UrlHelper::getSiteUrl($transaction-&amp;gt;order-&amp;gt;cancelUrl),&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way the request sends the amount based on the base currency (in our case EUR) to Mollie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems a bit hacky to us so maybe an exception for the Mollie gateway can be added to future updates to Craft Commerce.&lt;/p&gt;&#xA;" OwnerUserId="5906" LastActivityDate="2017-03-17T10:36:33.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19493" PostTypeId="1" CreationDate="2017-03-17T12:18:24.033" Score="2" ViewCount="143" Body="&lt;p&gt;I have form created with &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;A&amp;amp;M Forms plugin&lt;/a&gt; where the user can upload a file.&#xA;I would like to attach the file to the notification email itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? How?&lt;/p&gt;&#xA;" OwnerUserId="4863" LastEditorUserId="142" LastEditDate="2017-03-17T12:26:36.630" LastActivityDate="2017-03-17T13:18:16.947" Title="Can I atttach uploaded file in A&amp;M Forms to notification email" Tags="&lt;form&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19494" PostTypeId="2" ParentId="19493" CreationDate="2017-03-17T13:18:16.947" Score="1" Body="&lt;p&gt;There is a switch in notification tab for doing that -&#xA;Add attachments with notifications / Whether to add possible attachments to the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feeling stupid now :)&lt;/p&gt;&#xA;" OwnerUserId="4863" LastActivityDate="2017-03-17T13:18:16.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19495" PostTypeId="1" CreationDate="2017-03-17T13:22:25.380" Score="2" ViewCount="67" Body="&lt;p&gt;Hello I am building a system in craft cms using the getharvest api. I have 'translated' the php api to support twig. The problem is the getharvest api is really slow (10+ seconds loading time)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have solved this problem by using the &lt;code&gt;{% cache %}&lt;/code&gt; tag&#xA;But now my problem is whenever content changes inside the &lt;code&gt;{% cache %}&lt;/code&gt; you don't see the updated content but you see the same content as before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can tell craft to update the cache whenever content changes inside the cache tag?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% cache globally using key craft.request.getParam('id') %}&#xA;            {% set range = craft.harvestapi.setRange %}&#xA;            {% set results = craft.harvestapi.getProjectEntries(id, range) %}&#xA;&#xA;            Budget: {{ result.get(&quot;data&quot;).budget }}&amp;lt;br /&amp;gt;&#xA;            Uurprijs: {{ result.get(&quot;data&quot;).get(&quot;hourly-rate&quot;) }}&amp;lt;br /&amp;gt;&#xA;            &amp;lt;table&amp;gt;&#xA;                &amp;lt;tr&amp;gt;&#xA;                    &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Werkzaamheden&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Omschrijving&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Uren&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&#xA;                &amp;lt;/tr&amp;gt;&#xA;                {% for project in results.get(&quot;data&quot;) %}&#xA;                    {% set taskId = project.get(&quot;task-id&quot;) %}&#xA;&#xA;                    &amp;lt;tr&amp;gt;&#xA;                        &amp;lt;td&amp;gt;{{ craft.harvestapi.getTask(taskId).get(&quot;data&quot;).get(&quot;name&quot;) }}&amp;lt;/td&amp;gt;&#xA;                        &amp;lt;td&amp;gt;{{ project.notes }}&amp;lt;/td&amp;gt;&#xA;                        &amp;lt;td&amp;gt;{{ project.hours }}&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;/tr&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/table&amp;gt;&#xA;        {% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2017-03-17T13:29:48.247" Title="Update content inside cache tag" Tags="&lt;cache&gt;&lt;plugin-elementapi&gt;&lt;speed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19496" PostTypeId="2" ParentId="19495" CreationDate="2017-03-17T13:29:48.247" Score="1" Body="&lt;p&gt;Because your content is cached it &quot;downloads&quot; your website so it loads quick. &#xA;This can be fixed by disabling cache to users that are logged in or maybe even certain users. This way you &quot;bypass&quot; the cache so you see the changes as soon as your page is loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;unless #&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prevents the {% cache %} tag from activating if a certain condition is met.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Don't cache if someone is logged in #}&#xA;{% cache unless currentUser %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find the cache options in the docs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-17T13:29:48.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19497" PostTypeId="1" AcceptedAnswerId="19503" CreationDate="2017-03-17T15:02:43.573" Score="3" ViewCount="111" Body="&lt;p&gt;We are building a Commercial Real Estate site for a fairly large commercial real estate company and we're coming from an older custom-built site and there is a work flow and associated data logic we're having trouble figuring out how to best replicate in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they list properties for sale or lease, they have a set of common fields for a given building (ex. address, photos, city, etc) and then sometimes need to add Units within that building, each with its own set of fields (ex. size, unit number, price, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes these Unit(s) get listed all together on the one listing (or in the Craft sense, entry) on the front end. However, sometimes they need to be listed separately on the front end (ie. individual Units can be chosen to show up as their own listing (or separate entry)). This is in varying combinations (ie. any Unit could be flagged to show as separate - but not all Units need to). In this case, those separate Units still share (and display) the common building fields (ex. address, photos, city, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this means from an entry point of view, is we potentially need multiple URL slugs to get to each listing when some Units are flagged to show separately (for example: sale/building1, sale/building1-unit200, sale/building1-unit303 ...or whatever).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what we're trying to solve us how to handle this. We are trying to preserve an intuitive and easy workflow for the editor, where they go add a new listing on one entry page, and via a Matrix field could add multiple Units - and within each Matrix Unit block, could have a toggle field that says &quot;Show this unit as a separate listing&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question then is how to access those &quot;show as separate&quot; units on the front end as they technically all share the same URL slug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We briefly considered using related fields (separating out units as entries and the common building data as entries) but that would become incredibly difficult to remember, maintain and organize for which units belonged to what buildings across many hundreds of listings and thousands of units. As well, many buildings do not even have units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also considered a custom plugin that would create a duplicate entry for each flagged Unit when the entry is saved (and conversely remove duplicated entries when a Unit is unflagged). That seems kludgy and possibly complicated but maybe we're wrong on that? Also, not certain if there'd be a way to hide those duplicate entries from users in the CP so they're not confused by those (as they're always thinking that they work on one single entry for each building with its units).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to tackle this would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-03-18T08:55:40.640" Title="How to show variations of a single entry? Even possible?" Tags="&lt;entry&gt;&lt;url&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19498" PostTypeId="1" CreationDate="2017-03-17T16:54:32.493" Score="2" ViewCount="49" Body="&lt;p&gt;Am suddenly finding lots of core..xxx files dumped in the root of my site.&#xA;In devMode cant see any issues. Assume this is serious issue and memory dump?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where to start? Logs have loads of stuff but nothing that gives me a clue to this.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2017-03-17T18:07:07.010" LastActivityDate="2017-04-16T18:50:22.243" Title="finding core dumps in public root" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19499" PostTypeId="1" CreationDate="2017-03-17T17:13:55.203" Score="1" ViewCount="520" Body="&lt;p&gt;I'm building something with Craft and Vue.js and realized that I could view my page with or without a trailing slash, but when it had a trailing slash, my ajax calls to the Element API endpoint failed, thus the content wouldn't load.  So I've changed all my endpoints to not include the &lt;code&gt;.json&lt;/code&gt; like in the plugin's docs examples and just end in a &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if it's better or worse to force a trailing slash (I've read arguments for either way online), but I figure it's best to just choose one and go with it, so I've chosen to force it, but then I can't log into my admin control panel anymore, and I get some javascript errors elsewhere on front-end pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Redirect non www to www&#xA;    RewriteCond %{HTTP_HOST} ^website.com&#xA;    RewriteRule (.*) http://www.website.com/$1 [R=301,L]&#xA;&#xA;    # 301 redirect with trailing slash&#xA;    RewriteCond %{REQUEST_URI} /+[^\.]+$&#xA;    RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm also adding &lt;code&gt;'addTrailingSlashesToUrls' =&amp;gt; true,&lt;/code&gt; in my config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this to have trailing slashes, ensure that ajax calls don't fail, and still log into the cms?  Or should I just force no trailing slash?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-03-17T17:13:55.203" Title=".htaccess trailing slashes and ajax calls" Tags="&lt;htaccess&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19500" PostTypeId="2" ParentId="19498" CreationDate="2017-03-17T18:08:08.623" Score="1" Body="&lt;p&gt;Those aren't Craft log files.  I'd suggest contact your host and give them the files so they can look and see what's dumping them and what the root problem is.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-17T18:08:08.623" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19501" PostTypeId="2" ParentId="19497" CreationDate="2017-03-17T21:52:53.103" Score="1" Body="&lt;p&gt;One option to consider would be to use a &lt;code&gt;structure&lt;/code&gt;, with the 'building' as a parent entry and the 'units' as children entries (with corresponding &lt;code&gt;entryType&lt;/code&gt; of 'building' or 'unit' to set a unique field layout if needed). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on whatever logic makes most sense you could then display the building, the building with some subset of data from the units (children), or just the unit. The logic could be either an explicit checkbox or switch on the building or unit entries, or just the mere presence of unit entries (children). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the structure's settings you can also set whether the 'unit' (child) URI pattern is &lt;code&gt;building/unit&lt;/code&gt; (i.e. &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;) or &lt;code&gt;building-unit&lt;/code&gt; (i.e. &lt;code&gt;{slug}&lt;/code&gt; or &lt;code&gt;{parent.uri}-{slug}&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should keep everything organized in the CMS and give you a lot of flexibility in terms of what to display where. The building can access the unit data and the unit can access the building data as needed.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2017-03-17T22:21:03.040" LastActivityDate="2017-03-17T22:21:03.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19502" PostTypeId="1" AcceptedAnswerId="19511" CreationDate="2017-03-18T01:37:07.163" Score="1" ViewCount="850" Body="&lt;p&gt;I'm gonna probably find another way around this, but I'm still very new to Craft and want to ask if I'm missing something obvious. This is a commerce site that needs a front-end login. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an &lt;code&gt;account&lt;/code&gt; template folder with some templating that looks like this (it's an extended layout, leaving out unnecessary lines): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# account/index.html #}&#xA;{% block main %}&#xA;    {% if craft.session.isLoggedIn %}&#xA;        {% include 'account/account.html' %}&#xA;    {% else %}&#xA;        {% include 'account/login_signup.html' %}&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And an excerpt from my &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# excerpt from my general.php file #}&#xA;&#xA;'loginPath' =&amp;gt; 'account',&#xA;&#xA;'postLoginRedirect' =&amp;gt; 'account',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When a logged-out user goes to &lt;code&gt;website.com/account&lt;/code&gt; the &lt;code&gt;login_signup.html&lt;/code&gt; page is spit out and a user can sign in (ignore the sign-up part). If they type in their info correctly, it leads to an &lt;code&gt;ERR_TOO_MANY_REDIRECTS&lt;/code&gt; of &lt;code&gt;account&lt;/code&gt; redirecting to &lt;code&gt;account&lt;/code&gt;. This doesn't make sense to me, as both the login url and the post-login url point at the same path and load the same template, but the template should obviously handle the two situations differently. It should spit out the &lt;code&gt;account.html&lt;/code&gt; template if the user is logged in, and if not, the &lt;code&gt;login_signup.html&lt;/code&gt; template. These two template files have &lt;strong&gt;nothing&lt;/strong&gt; in them right now, so it's not some other templating mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove either of the two config variables I presented in my &lt;code&gt;general.php&lt;/code&gt; file, everything works but the routes I want aren't there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a logged out user to visit &lt;code&gt;account&lt;/code&gt;, get a sign in (&lt;code&gt;login_signup.html&lt;/code&gt;) form they then use, and get redirected to &lt;code&gt;account&lt;/code&gt; and the template will spit out the &lt;code&gt;account.html&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; Basically, if a user is logged in with my &lt;code&gt;general.php&lt;/code&gt; having those two configs set to the same path (&lt;code&gt;account&lt;/code&gt;), this always results in too many redirects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block main %}&#xA;    {% if craft.session.isLoggedIn %}&#xA;        I'm logged in!&#xA;    {% else %}&#xA;        I should log in!&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="5422" LastEditDate="2017-03-18T01:59:42.887" LastActivityDate="2017-03-19T19:55:42.003" Title="Redirect issue with login and paths" Tags="&lt;redirect&gt;&lt;login&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19503" PostTypeId="2" ParentId="19497" CreationDate="2017-03-18T08:55:40.640" Score="1" Body="&lt;p&gt;After looking at this more, we realized the answer wasn't all that complex. We just needed a way to differentiate the context in order to write out the correct data from the single entry. In our case, we're having to build a map-based search engine for the site (think something similar to Zillow) and what we'll do there is simply check against each entry result and whether is has any Units flagged as &quot;show separate&quot; (the flag field will be one field in a Matrix block holding all relevant Unit data fields). If it does, we'll simply use the data from the single entry to return the appropriate number of results with the different Unit data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of those results will then have a URL to go to a details view that includes a URL segment if the listing is a &quot;separate unit&quot; version. Something like: &lt;code&gt;sale/entry-id-or-slug/matrix-block-id&lt;/code&gt;. (That Matrix block ID could also be another field in the corresponding Matrix block if we wanted to use the actual Unit number (ie. 203)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the detail template will check for that last URL segment parameter and if it exists, it will use the corresponding Matrix data for that Unit and ignore the other Unit(s). And if it does not find that last URL segment, then it just returns a normal entry with all Units data not set to &quot;show as separate listing&quot;.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-03-18T08:55:40.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19505" PostTypeId="1" AcceptedAnswerId="19521" CreationDate="2017-03-18T12:19:38.093" Score="3" ViewCount="325" Body="&lt;p&gt;I have a front end form for logged in users to submit new entries. I want that user to receive a notification (via Sprout Email) that there entry has been received (it's pending/disabled on submission).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling with what my recipient variable should be!? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add, it's the logged in user that added the entry that I want to receive the notification.&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2017-03-18T14:44:31.673" LastActivityDate="2017-03-20T15:04:30.497" Title="Sprout email notifications - setting the recipient?" Tags="&lt;emails&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19506" PostTypeId="1" CreationDate="2017-03-18T22:26:32.767" Score="1" ViewCount="273" Body="&lt;p&gt;I'm just trying out the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#usage&quot; rel=&quot;nofollow noreferrer&quot;&gt;imager plugin&lt;/a&gt;. It looks promising!&#xA;I've set up the first usage example but I don't see any image on my site in the browser. The image is uploaded properly to the asset source but it seems that Imager is placing its transforms in a subfolder (in this case: '7' -&gt;  &lt;a href=&quot;http://craft-imager.dev/imager/images/7/nature-13_d4e4e04a52bfbdbeab5ba4d2cf1d1390.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craft-imager.dev/imager/images/7/nature-13_d4e4e04a52bfbdbeab5ba4d2cf1d1390.jpg&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The subfolder '7' doesn't exists on my machine.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some digging around, but I can't figure out what's wrong. The directory 'imager/images' exists and is writable by PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6453" LastEditorUserId="45" LastEditDate="2017-04-11T22:50:15.257" LastActivityDate="2017-04-17T13:54:12.573" Title="Imager resized image not shown (404)" Tags="&lt;image-transforms&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19507" PostTypeId="1" CreationDate="2017-03-19T15:23:12.660" Score="3" ViewCount="62" Body="&lt;p&gt;I'm currently developing a blueprint for all my Craft websites. It contains a set of sections, fields, plugins etc. All configured the way I need for my websites. The websites itself are basically a fork of this blueprint and only has to have a custom template and content and we're good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of features in my blueprint will be growing as time passes along. What would be the best approach of updating all Craft installs so that each website (build upon previous blueprint versions) can benefit from the newly developed features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could just backup the DB and code from the blueprint and import them into the website, but then I will be losing all content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea? &#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6453" LastActivityDate="2017-03-19T23:54:48.270" Title="What is the best approach of updating existing Craft installs with new features?" Tags="&lt;updating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19508" PostTypeId="1" CreationDate="2017-03-19T15:47:24.287" Score="2" ViewCount="1526" Body="&lt;p&gt;I've got a for loop working perfect with a limit of 5. Then I throw in the if statement to filter those entries that correspond with a global variable I have set. The problem is the if statement is after the for loop with the limit and only doing it's thing to the 5 entries and not all of the entries.\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the if statement on all the entries to return the ones I want, then limit it to 5. In another DIV I have and offset(5), so the rest go there. I hope that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').order('articleOrder desc').limit(5).find() %}&#xA;&#xA;    {% if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 %}&#xA;&#xA;        &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6441" LastEditorUserId="6441" LastEditDate="2017-03-31T11:51:43.747" LastActivityDate="2017-03-31T11:51:43.747" Title="Limit the for loop returns with an if statement" Tags="&lt;conditional&gt;&lt;forloop&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19509" PostTypeId="2" ParentId="19507" CreationDate="2017-03-19T16:03:29.370" Score="5" Body="&lt;p&gt;This approach assumes that the individual websites won't diverge from the original blueprint by, for example, modifying sections and fields to suit their specific requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That seems pretty unlikely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be inclined to stick with the idea of creating a &quot;blueprint&quot; site, to get new websites up-and-running quickly, but ditch the idea of updating previously-created sites whenever the blueprint is updated.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-19T16:03:29.370" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19510" PostTypeId="2" ParentId="19508" CreationDate="2017-03-19T16:19:05.107" Score="1" Body="&lt;p&gt;If I'm following you correct, you can use a &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/tags/for.html#adding-a-condition&quot; rel=&quot;nofollow noreferrer&quot;&gt;conditional in a for loop&lt;/a&gt; to do what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, it would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').order('articleOrder desc').limit(5).find() if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 %}&#xA;   ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-19T16:19:05.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19511" PostTypeId="2" ParentId="19502" CreationDate="2017-03-19T19:55:42.003" Score="0" Body="&lt;p&gt;Yeah... that won't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft currently uses the URI segments to determine special path like logging in, out, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when Craft sees &lt;code&gt;account&lt;/code&gt; as the first segment in the URI, its going to treat that as a login request and execute what's in &lt;code&gt;UsersController-&amp;gt;actionLogin()&lt;/code&gt;, which will see that you're already logged in, and will eventually hit this if the user doesn't have CP access permissions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Otherwise send them wherever postLoginRedirect tells us&#xA;$postLoginRedirect = craft()-&amp;gt;config-&amp;gt;get('postLoginRedirect');&#xA;$returnUrl = UrlHelper::getSiteUrl($postLoginRedirect);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which, you've got set to &lt;code&gt;account&lt;/code&gt;, then it rinses and repeats given you the infinite redirect loop.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-19T19:55:42.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19512" PostTypeId="1" CreationDate="2017-03-19T23:13:22.973" Score="1" ViewCount="48" Body="&lt;p&gt;I made a custom field type (two datetime fields for starting / ending time). They have the good value when I loop in value in an entry, but have null value in Live Preview. Do you have an idea of what can cause that?&lt;/p&gt;&#xA;" OwnerUserId="4447" LastActivityDate="2017-03-19T23:13:22.973" Title="DateTime is null in Live Preview" Tags="&lt;datetime&gt;&lt;live-preview&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19513" PostTypeId="1" CreationDate="2017-03-19T23:45:09.980" Score="3" ViewCount="273" Body="&lt;p&gt;I am trying to print if statement for x time or x day ago for each published entries. For example the entry is posted x minutes ago should display x minutes ago or x hours ago. Same for days and months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have used but not what I am after. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ date(category.dateCreated|date('c')).diff(now).format('%a') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the code I have written does not work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entries %}&#xA;&#xA;{% for time in category %}&#xA;&amp;lt;span&amp;gt;{{ date(time.dateCreated|date('c')).diff(now).format('%i') }} minutes ago&amp;lt;/span&amp;gt;&#xA;&#xA;{% else %}&#xA;&amp;lt;span&amp;gt;{{ date(time.dateCreated|date('c')).diff(now).format('%h') }} hours ago&amp;lt;/span&amp;gt;&#xA;&#xA;{% else %}&#xA;&amp;lt;span&amp;gt;{{ date(time.dateCreated|date('c')).diff(now).format('%d') }} days  agos&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code is too long or is there a better way to check whether the entry is posted min, hours, or days ago.&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="142" LastEditDate="2017-03-20T11:06:16.067" LastActivityDate="2017-03-20T23:34:04.583" Title="Display X minute / hours / days in entries" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19514" PostTypeId="2" ParentId="19507" CreationDate="2017-03-19T23:54:48.270" Score="0" Body="&lt;p&gt;&lt;strong&gt;Patches&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a patch and distribute it among your customers. It can be as simple as a diff. &#xA;If a core file is overwritten for some reason, the patch might fail.&lt;/p&gt;&#xA;" OwnerUserId="435" LastActivityDate="2017-03-19T23:54:48.270" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19515" PostTypeId="1" CreationDate="2017-03-20T03:02:20.530" Score="1" ViewCount="53" Body="&lt;p&gt;I'm giving Sprout SEO a try specifically for the Facebook OG and Twitter card handling - however specifically in these two cases, when I choose an image, it gets wiped. No messages or errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried both already uploaded images and newly uploaded images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only the case when editing an Element, not a Section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else had this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2903 | Sprout SEO 3.2.0&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2017-03-22T02:02:33.697" LastActivityDate="2017-03-22T02:02:33.697" Title="Element Meta Image (OG/Twitter) Wiped On Save" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19516" PostTypeId="2" ParentId="19379" CreationDate="2017-03-20T03:37:06.350" Score="4" Body="&lt;p&gt;Use a text field (not rich text).  Then in the output, add &quot;raw&quot; to avoid it stripping any HTML tags.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.field | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-03-20T03:37:06.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19517" PostTypeId="2" ParentId="15403" CreationDate="2017-03-20T09:06:09.773" Score="1" Body="&lt;p&gt;The error points to a missing corresponding field with handle 'something' in the entry model. &lt;/p&gt;&#xA;" OwnerUserId="4042" LastActivityDate="2017-03-20T09:06:09.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19520" PostTypeId="2" ParentId="19473" CreationDate="2017-03-20T14:14:00.227" Score="2" Body="&lt;p&gt;I think you would probably also need to check the default variant of the product, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.defaultVariant.onSale %}&#xA;  {% set price = product.defaultVariant.salePrice %}&#xA;{% else %}&#xA;  {% set price = product.defaultVariant.price %}&#xA;{% endif %}&#xA;&#xA;Product Price - {{ product.price }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-20T14:14:00.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19521" PostTypeId="2" ParentId="19505" CreationDate="2017-03-20T15:04:30.497" Score="2" Body="&lt;p&gt;Sprout Email allows Craft Object Syntax for the object that is available when an event is triggered, in the same way you would use the Sections Title Format field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your form is submitting an Entry the dynamic object being submitted is an &lt;code&gt;EntryModel&lt;/code&gt; and all values from that &lt;code&gt;EntryModel&lt;/code&gt; will be available to several of your fields in Sprout Email. To access those values you can use one of two syntaxes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Shorthand Object Syntax&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{title}&lt;/code&gt; or &lt;code&gt;{customFieldHandle}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Object Syntax&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ object.title }}&lt;/code&gt; or &lt;code&gt;{{ object.customFieldHandle }}&lt;/code&gt; - this longer form can also be used in more advanced twig constructs like &lt;code&gt;{% if object.title %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these syntaxes are comparable to how you would use &lt;code&gt;{{ entry.title }}&lt;/code&gt; or &lt;code&gt;{{ entry.customFieldHandle }}&lt;/code&gt; in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is described with a few more examples on the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/dynamic-values#using-dynamic-values-in-your-notification-entry-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Values page of the docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-03-20T15:04:30.497" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19522" PostTypeId="1" CreationDate="2017-03-20T15:23:05.100" Score="3" ViewCount="812" Body="&lt;p&gt;Does somebody know if it's possible with &lt;a href=&quot;https://printmaker.docs.topshelfcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Printmaker&lt;/a&gt; to provide each page, of the PDF you generate, with a static footer and/or header?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Printmaker makes use of the dompdf library. In the documentation of this library I found that &lt;a href=&quot;https://dompdf.net/examples.php#print_header_footer.html,pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; is supported by the library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot find in the Printmaker documentation that you can also use this option with the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope somebody can answer this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or does somebody know a plugin that I can use as an alternative, that does support this?&lt;/p&gt;&#xA;" OwnerUserId="6457" LastActivityDate="2019-11-05T21:55:56.820" Title="Generate PDF's (Printmaker plugin) with a static header and footer" Tags="&lt;pdf&gt;&lt;plugin-printmaker&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19523" PostTypeId="1" AcceptedAnswerId="20115" CreationDate="2017-03-20T15:55:54.190" Score="2" ViewCount="384" Body="&lt;p&gt;Trying to figure out the best way of handling this scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a data field for a entry type that should allow an editor in the CP to select one option from many (ie. a dropdown). However, we want to give the editors the ability to modify the options for this select list - and can't let them into a superadmin mode in the CP where they'd edit the original field parameters (if this were a dropdown field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, we're considering using categories. That presents easy UI in the CP to allow them to manage the list of options as needed, from which they'll select one when creating a new entry in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this piece of data isn't a category (as far as a user would think of it) so I am not certain if there is a more elegant way to handle this and avoid using categories? I looked for a field type that might do something like that but couldn't find one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-03-21T09:05:58.490" LastActivityDate="2017-04-21T05:22:57.943" Title="How to create a user editable dropdown field?" Tags="&lt;categories&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19524" PostTypeId="1" CreationDate="2017-03-20T17:03:26.163" Score="1" ViewCount="42" Body="&lt;p&gt;Anyone had problems with &lt;a href=&quot;https://gomasuga.com/software/link-vault-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;LinkVault&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m storing downloads above the web root and using LinkVault to generate links to them. This works locally but on the staging server I get a PHP notice for an undefined variable in &lt;code&gt;LinkVault_DownloadController.php&lt;/code&gt; on line 26.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it’s getting a 404 because it can’t find the file and that line is trying to log the error message but throwing the notice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don’t understand is that it’s working fine locally and I’ve done exactly the same thing on another site with no issues at all. Same hosting set up too.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2019-01-28T08:41:03.203" LastActivityDate="2019-01-28T08:41:03.203" Title="Problem with the LinkVault plugin not finding file above root" Tags="&lt;plugins&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19525" PostTypeId="1" AcceptedAnswerId="19526" CreationDate="2017-03-20T18:32:30.663" Score="3" ViewCount="232" Body="&lt;p&gt;I've came to a cache problem/question on one of my sites when I run a speed test and I failed caching test. I have very little knowledge in this area and I'd like to enhance it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation for &lt;a href=&quot;https://craftcms.com/docs/templating/header&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% header %}&lt;/a&gt; tag says that it set a new HTTP header in response and you can tell browser what to do &lt;em&gt;(for example caching a page)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation for &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% cache %}&lt;/a&gt; tag say that it will cache a portion of your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's the difference in setting cache in HTTP header using &lt;code&gt;{% header %}&lt;/code&gt; tag and &lt;code&gt;{% cache %}&lt;/code&gt; tag?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-03-20T18:48:21.050" Title="What's the difference between setting cache with {% header %} tag and {% cache %} tag?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19526" PostTypeId="2" ParentId="19525" CreationDate="2017-03-20T18:48:21.050" Score="4" Body="&lt;p&gt;The &lt;code&gt;header&lt;/code&gt; tag sets an HTTP response header, which may be used to (among other things) tell the &lt;em&gt;browser&lt;/em&gt; that the response content is &quot;cacheable&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;cache&lt;/code&gt; tag tells Craft to cache the generated HTML on the &lt;em&gt;server&lt;/em&gt; side (as a file).&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-20T18:48:21.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19527" PostTypeId="1" AcceptedAnswerId="19543" CreationDate="2017-03-20T22:58:13.670" Score="2" ViewCount="133" Body="&lt;p&gt;If I'm adding events for course that is run Wed 8-5, Thurs 8-5, and Fri 8-12, how would I do that? It's not technically a recurring event, I don't think, but at the same time, it's not individual instances either. This event (or course) runs multiple times a year, to complicate things a bit more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone done anything similar?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2017-03-21T15:01:40.847" Title="How to do multi-day events in Solspace Calendar?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19528" PostTypeId="2" ParentId="19513" CreationDate="2017-03-20T23:34:04.583" Score="4" Body="&lt;p&gt;Check out the &lt;code&gt;DateTimeHelper&lt;/code&gt; method &lt;code&gt;timeAgoInWords&lt;/code&gt;. It will do what you are after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/helpers/DateTimeHelper#timeAgoInWords-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/helpers/DateTimeHelper#timeAgoInWords-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is even a handy twig filter available for use in your templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.dateCreated|timeAgoInWords }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4078" LastActivityDate="2017-03-20T23:34:04.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19529" PostTypeId="1" AcceptedAnswerId="19530" CreationDate="2017-03-21T00:20:41.927" Score="2" ViewCount="104" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm/blob/master/README.md#adding-additional-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;additional fields&lt;/a&gt; on my contact form. I want to re-populate the additional fields if/when the form fails validation, but it's not working so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To re-populate a &lt;strong&gt;standard&lt;/strong&gt; field, the code uses an attribute of message using dot syntax…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;fromName&quot; id=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot; type=&quot;text&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But for &lt;strong&gt;additional fields&lt;/strong&gt; the value is stored as an attribute of message.message using &lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/templates.html#variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;the subscript syntax&lt;/a&gt; (the use of square brackets below)…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;message[Phone]&quot; id=&quot;phone&quot; type=&quot;text&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble accessing the substring value on message.message. In my specific example, I have several radio buttons that need their selections remembered in case anything goes wrong. Here's what I expected to work…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for course in courses %}&#xA;    &amp;lt;input id={{ course.slug }}&quot; name=&quot;message[Course]&quot; type=&quot;radio&quot; value=&quot;{{ course }}&quot;&#xA;         {% if message is defined and message.message[Course] == course %}&#xA;             checked=&quot;checked&quot;&#xA;         {% endif%}&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this code outputs the template error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Variable &quot;Course&quot; does not exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I re-populate the additional fields for the contact form plugin?&lt;/p&gt;&#xA;" OwnerUserId="6317" LastActivityDate="2017-03-21T00:53:00.110" Title="Re-populate additional fields on Contact Form on failure of form validation" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19530" PostTypeId="2" ParentId="19529" CreationDate="2017-03-21T00:53:00.110" Score="3" Body="&lt;p&gt;From the changelog:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1.7.0&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Added the ability to access individual message fields values via &lt;code&gt;message.messageFields&lt;/code&gt; when a validation error occurred. For example, the value of the input &lt;code&gt;message[Phone]&lt;/code&gt; can now be accessed via &lt;code&gt;message.messageFields['Phone']&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I think you should be using &lt;code&gt;message.messageFields[Course]&lt;/code&gt; rather than &lt;code&gt;message.message[Course]&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6459" LastActivityDate="2017-03-21T00:53:00.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19531" PostTypeId="2" ParentId="19523" CreationDate="2017-03-21T04:08:02.470" Score="0" Body="&lt;p&gt;I'm not 100% I follow, so I apologize if this isn't what you are looking for. Are these values being managed/edited within the CP? Or are the editors adding these values from a front-end form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A project I worked on needed a base set of values in a drop-down field for each entry. But each entry that was created by the author could have additional values (or less). The way I did this was to create a &lt;code&gt;table&lt;/code&gt; field in the CP. It consisted of two columns &lt;code&gt;label&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way I could have a &quot;default&quot; set of values that each entry would inherit. The author could then add additional rows (or remove) as they needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template, I just treated the table as a drop-down (in your case it will be a multi-select).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;    {% for option in entry.myField %}&#xA;        &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit/Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still think if you don't want to go the category route, you could do this within a field. I've attached a screenshot of what this looked like on a similar project. The label is the left column, and the value is the right. Each row is a new value in my drop-down field that is created on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default all of these values are in the dropdown for each entry. The author can add/remove whatever they want in addition to the default data. But, whenever &quot;New Entry&quot; is pressed, each entry starts with the same data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where it might get tricky is if you want these added/removed values to persist from entry to entry. You'd probably have to write some sort of plugin that saved the new values back to the original field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1kWau.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1kWau.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-03-21T17:03:07.410" LastActivityDate="2017-03-21T17:03:07.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19532" PostTypeId="1" CreationDate="2017-03-21T05:25:16.273" Score="2" ViewCount="160" Body="&lt;p&gt;I'd like to be able to have multiple (2) Mailchimp subscribe forms on the same web site. Each would target different mail lists so I can use one on a landing page for example. I've noticed that the target mail list is set in the List ID field in the plugin settings. Can I simply add another installation of the plugin at this level to accomplish my goal?&lt;/p&gt;&#xA;" OwnerUserId="4962" LastActivityDate="2017-03-21T09:18:10.597" Title="How to implement mailchimp plugin to target different mailists?" Tags="&lt;plugin-mailchimpsubscribe&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19533" PostTypeId="2" ParentId="18997" CreationDate="2017-03-21T05:43:58.980" Score="1" Body="&lt;p&gt;As Tom mentioned, you can use the Control Panel CSS plugin alongside &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpbodyclasses&quot; rel=&quot;nofollow noreferrer&quot;&gt;this CP Body Classes plugin&lt;/a&gt;, also by the same great dev. Basically it will add user group classes to the &lt;code&gt;body&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2017-03-21T05:43:58.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19534" PostTypeId="1" AcceptedAnswerId="19545" CreationDate="2017-03-21T07:47:55.817" Score="2" ViewCount="69" Body="&lt;p&gt;I am building an API that returns instances of an entry type. Only authenticated users can access the API. There are different tiers of user - paid and free. Free users can access the API, but the content should only be updated weekly. I have a scheduled task that regularly updates my entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I query the database for a particular entry type, but only retrieve versions of entries that are at least 7 days old?&lt;/p&gt;&#xA;" OwnerUserId="6460" LastActivityDate="2017-03-21T17:33:10.400" Title="How can I retrieve older versions of a custom entry type in bulk?" Tags="&lt;query&gt;&lt;entry-versions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19535" PostTypeId="2" ParentId="19014" CreationDate="2017-03-21T09:06:50.387" Score="1" Body="&lt;p&gt;I've had this issue previously before when working on a larger website, when you want to copy an entry type and all its field layouts, or even copy a section all its entry types and all their field layouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written a plugin that tackles this, check it out here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/kymar/craft_cloner&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Cloner&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6431" LastActivityDate="2017-03-21T09:06:50.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19536" PostTypeId="2" ParentId="19532" CreationDate="2017-03-21T09:18:10.597" Score="1" Body="&lt;p&gt;If the plugin in question is my &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;MailChimp Subscribe plugin&lt;/a&gt;, you can easily target different lists by adding a hidden field called &lt;code&gt;lid&lt;/code&gt; to your form with your list ID:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;lid&quot; value=&quot;2fd6ec09cf&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will override the config setting (see the examples under configuration in the repo for more information on this).&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-03-21T09:18:10.597" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19538" PostTypeId="1" CreationDate="2017-03-21T12:10:44.817" Score="2" ViewCount="58" Body="&lt;p&gt;Let's say I have an auction website:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;'Ads' would be a section -&gt; channel &lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;The ads in it would be entries in the channel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's say guest users can make an offer on the action/ad. I would like to save all the offers in the entry, so I could read them out front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to save these entries? I'm having difficulty understanding this structure-wise.&lt;/p&gt;&#xA;" OwnerUserId="6462" LastEditorDisplayName="user4694" LastEditDate="2018-10-09T23:52:35.080" LastActivityDate="2018-10-09T23:52:35.080" Title="Structure question (entry in entry?)" Tags="&lt;entries&gt;&lt;entry&gt;&lt;structure&gt;&lt;guest&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19539" PostTypeId="2" ParentId="19060" CreationDate="2017-03-21T12:59:27.740" Score="2" Body="&lt;p&gt;As Brad Bell pointed out in a comment that you should use index.php, it might have something to do with your .htaccess and general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your .htaccess File should look something similair to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doens't do the trick yet though.&#xA;In your &lt;code&gt;craft/config/general.php&lt;/code&gt; you have to add:&#xA;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&lt;/code&gt; Now you should be able to access your admin panel with: ronvanderwerf.loc/admin/ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a more indept explanation in the docs here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-21T12:59:27.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19540" PostTypeId="1" AcceptedAnswerId="19541" CreationDate="2017-03-21T13:51:09.940" Score="3" ViewCount="618" Body="&lt;p&gt;How get the custom user fields in a plugin? I can get the normal fields like firstName like this &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;user-&amp;gt;firstName&lt;/code&gt; but how i can get a custom field i tried &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;user-&amp;gt;customfieldname&lt;/code&gt; but that doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2017-03-21T16:07:04.783" Title="How get custom user fields in a plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19541" PostTypeId="2" ParentId="19540" CreationDate="2017-03-21T14:03:24.907" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#getUser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;UserSessionService::getUser&lt;/code&gt; method&lt;/a&gt; returns &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;a &lt;code&gt;UserModel&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can retrieve the custom fields from a &lt;code&gt;UserModel&lt;/code&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userModel-&amp;gt;getContent()-&amp;gt;getAttribute('fieldName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, following on from your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;getContent()-&amp;gt;getAttribute('fieldName');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-03-21T16:07:04.783" LastActivityDate="2017-03-21T16:07:04.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19542" PostTypeId="1" AcceptedAnswerId="19561" CreationDate="2017-03-21T14:54:35.780" Score="2" ViewCount="149" Body="&lt;p&gt;I have a homepage single section has a field for entries (only 1 can be selected).&#xA;This field is called featuredEntry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my homepage template (index.html) I set a variable &lt;code&gt;{% set featured = entry.featuredEntry %}&lt;/code&gt; for the field&#xA;I then loop thru that to pull in that entries content &lt;code&gt;{% for mainEntry in featured %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a listing of entries below it that pull from the same News channel as the featured entry above.&#xA;I don't want the featured entry to show in that list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed the answer here (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13821/exclude-featured-entries-from-a-recent-entries-for-loop&quot;&gt;Exclude &amp;quot;featured&amp;quot; entries from a &amp;quot;recent&amp;quot; entries {% for %} loop&lt;/a&gt;) with slight changes to try and omit that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, setting a variable &lt;code&gt;{% set featuredIds = featured.ids() %}&lt;/code&gt; for the above featured entry doesn't seem to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am omitting additional entries that are marked with a certain tag as explained here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19428/list-entries-without-specific-tag&quot;&gt;List entries without specific tag&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here or what is wrong for my code to not pull in that id of the featured entry?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredIds = featured.ids() %}&#xA;&#xA;{% set mainTag = craft.tags.search('All-Stars').first() %}&#xA;{% set allEntries = craft.entries.section('news') %}&#xA;{% set taggedEntries = craft.entries.section('news').relatedTo(mainTag).ids %}&#xA;&#xA;{% set omitIds = 'and, not ' ~ taggedEntries|join(', not ') ~ allEntries|join(', not featuredIds') %}&#xA;{% set untaggedEntries = craft.entries.section('news').id(omitIds) %}&#xA;&#xA;{% for feedItems in untaggedEntries.limit(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In that code above in the omitIds variable, if I do this:&#xA;&lt;code&gt;{% set omitIds = 'and, not ' ~ taggedEntries|join(', not ') ~ allEntries|join(', not SPECIFIC ID') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="6371" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-03-22T02:56:20.373" Title="Omit Featured Entry from loop of entries with additional omissions" Tags="&lt;entries-field&gt;&lt;id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19543" PostTypeId="2" ParentId="19527" CreationDate="2017-03-21T15:01:40.847" Score="1" Body="&lt;p&gt;The only way to handle this would be to create 2 (or 3) separate events. The limitation here is the start and end times not being the same for all 3. If they were all the same, you could have done it as an individual event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two are the same time, so those could be paired together, but the Friday one would have to be separate. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-03-21T15:01:40.847" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19544" PostTypeId="1" AcceptedAnswerId="19547" CreationDate="2017-03-21T15:52:27.017" Score="2" ViewCount="254" Body="&lt;p&gt;Anyone able to assist me with removing duplicates in this example?&#xA;So I have a related entries (cables) setup in a SuperTable. Some of these entries are duplicated across different rows. So a cable might be related to the first row in the SuperTable and also row3 and row4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to run through all these cables in any SuperTable row and output the entries just once not duplicated.&#xA;So as an example a basic SuperTable setup like this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.tests %}&#xA;    {% for cable in row.cables %}&#xA;        {{ cable.title }}&amp;lt;br /&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would output this;&lt;br&gt;&#xA;BS 7211&lt;br&gt;&#xA;BS EN 50525&lt;br&gt;&#xA;BS 6724&lt;br&gt;&#xA;BS 8573&lt;br&gt;&#xA;BS 7835&lt;br&gt;&#xA;BS 7629-1&lt;br&gt;&#xA;BS 8436&lt;br&gt;&#xA;BS 5467&lt;br&gt;&#xA;BS 6724&lt;br&gt;&#xA;BS 7846&lt;br&gt;&#xA;BS 6622&lt;br&gt;&#xA;BS 7835  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to essentially loop through and only display the related entry once. As you can see from the example some entries are duplicated (e.g BS 6724)&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2017-03-21T18:48:03.880" LastActivityDate="2017-03-21T18:48:03.880" Title="Remove duplicated entries from SuperTable related entries" Tags="&lt;relations&gt;&lt;array&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19545" PostTypeId="2" ParentId="19534" CreationDate="2017-03-21T16:02:59.010" Score="1" Body="&lt;p&gt;Okay, here's my stab at this. No doubt Brad will swagger in at some point, and declare that this can all be done with one line of trivial PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever, Brad. Moving on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't use the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to retrieve specific entry versions. This leaves you with two options:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Option 1: Use the Entry Revisions service&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;EntryRevisionsService&lt;/code&gt; has &lt;a href=&quot;https://craftcms.com/classreference/services/EntryRevisionsService#getVersionsByEntryId-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;a &lt;code&gt;getVersionsByEntryId&lt;/code&gt; method&lt;/a&gt;, which does precisely what it says. If you're only dealing with a small number of Entries, this may suffice.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Option 2: Go old(ish) school&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If the first option doesn't suit, you'll need to get your hands dirty querying the database, and populating &lt;code&gt;EntryModel&lt;/code&gt; instances from the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example, to get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$versionIds = [];&#xA;&#xA;// Retrieve all the versions created before your &quot;threshold&quot; date.&#xA;$versions = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select(['ev.entryId as entryId', 'ev.id as versionId'])&#xA;    -&amp;gt;from('entryversions ev')&#xA;    -&amp;gt;where('ev.dateCreated &amp;lt; :date', [':date' =&amp;gt; '2017-03-20'])&#xA;    -&amp;gt;order('ev.dateCreated desc')&#xA;    -&amp;gt;queryAll();&#xA;&#xA;/**&#xA; * Construct an associative array where the key is the entry ID,&#xA; * and the value is the most recent entry version ID created _before_&#xA; * your date threshold.&#xA; */&#xA;foreach ($versions as $version) {&#xA;    if (!array_key_exists($version['entryId'], $versionIds)) {&#xA;        $versionIds[$version['entryId']] = $version['versionId'];&#xA;    }&#xA;}&#xA;&#xA;/**&#xA; * Finally, we can do something useful with our lives.&#xA; * Retrieve the desired version of the entries.&#xA; *&#xA; * Note: you'll need to retrieve all of the required entry&#xA; * columns, in order to populate your EntryModel. I've just&#xA; * done a wildcard, you may wish to be more specific.&#xA; */&#xA;$results = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('e.*, ev.*')&#xA;    -&amp;gt;from('entries e')&#xA;    -&amp;gt;join('entrytypes et', 'et.id = e.typeId')&#xA;    -&amp;gt;join('entryversions ev', 'ev.entryId = e.id')&#xA;    -&amp;gt;where('et.handle = :handle', [':handle' =&amp;gt; 'entryTypeHandle'])&#xA;    -&amp;gt;andWhere(['in', 'ev.id', array_values($versionIds)])&#xA;    -&amp;gt;group('e.id')&#xA;    -&amp;gt;order('ev.dateCreated desc')&#xA;    -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now that you've retrieved the results, you'll need to convert each row to an &lt;code&gt;EntryModel&lt;/code&gt;. This could be fairly trivial, or a living hell, depending on whether your Entries contains Matrix fields, Relationships, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note: I don't &lt;em&gt;think&lt;/em&gt; it's possible to do this in a single query, but your &lt;code&gt;GROUP BY&lt;/code&gt; fu may be better than mine.&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-03-21T17:33:10.400" LastActivityDate="2017-03-21T17:33:10.400" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19546" PostTypeId="1" CreationDate="2017-03-21T16:08:46.893" Score="4" ViewCount="819" Body="&lt;p&gt;I was wondering if it is possible to have users update their own entry on the front end with the &lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace Freeform&lt;/a&gt; plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get as far as getting all the necessary data of the user (&lt;code&gt;freeform.submission&lt;/code&gt;) in a form (&lt;code&gt;freeform.form&lt;/code&gt;) and I have added an &lt;code&gt;input&lt;/code&gt; with the &lt;code&gt;id&lt;/code&gt; of the entry to the form:&lt;br /&gt; &#xA;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;{{submission.id}}&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When submitting this form it will save the data, but as a new entry instead of updating the existing one. So is there a way to update the existing &lt;code&gt;id&lt;/code&gt;, similar as to what is happening in the cp?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6464" LastEditorUserId="57" LastEditDate="2017-03-21T18:44:02.827" LastActivityDate="2017-03-23T14:41:44.950" Title="Q: Freeform - have users update form on the frontend" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19547" PostTypeId="2" ParentId="19544" CreationDate="2017-03-21T16:26:49.293" Score="2" Body="&lt;p&gt;The simplest way is to create a &quot;filtered&quot; array, containing the unique cables, and then loop through that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Build the &quot;filtered&quot; array of cables #}&#xA;{% set filteredCables = [] %}&#xA;&#xA;{% for row in entry.tests %}&#xA;    {% for cable in row.cables %}&#xA;        {% if cable.title not in filteredCables %}&#xA;            {% set filteredCables = filteredCables|merge([cable.title]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{# Output the unique cables #}&#xA;{% for cable in filteredCables %}&#xA;    {{ cable }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-03-21T17:30:55.120" LastActivityDate="2017-03-21T17:30:55.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19548" PostTypeId="1" CreationDate="2017-03-21T16:29:42.587" Score="2" ViewCount="86" Body="&lt;p&gt;In my plugin I need to create a fieldtype of a dropdown, radiobutton or checkbox combined with a textfield.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've gone ahead and created a custom field type using the description here &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/field-types#modifying-your-fieldtypes-stored-data-for-use&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to save the field to the database using the saveField function, but it gives me the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Call to a member function prepSettings() on null in dev/craft/app/services/FieldsService.php on line 503&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to fail because &lt;code&gt;$field-&amp;gt;getFieldType()&lt;/code&gt; returns null, which is weird because &lt;code&gt;$field-&amp;gt;type&lt;/code&gt; returns the name of my custom fieldtype.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went deep into Craft code and ended in &lt;code&gt;getComponentByTypeAndClass&lt;/code&gt;, where &lt;code&gt;$pluginHandle&lt;/code&gt; is the name of my custom field type, instead of the name of my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could that be the issue? If not, what could?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot&lt;/p&gt;&#xA;" OwnerUserId="4017" LastActivityDate="2017-03-21T16:29:42.587" Title="Custom fieldtype to add text field to dropdown, radiobuttons and checkboxes" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19549" PostTypeId="1" CreationDate="2017-03-21T16:40:33.060" Score="2" ViewCount="366" Body="&lt;p&gt;I am trying to create a custom payment gateway by extending / adding it to Omnipay which is already implemented in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the Ogone and other plugins as base, but I cant seem to get it working properly, probably because Klarna Checkout has quite a different flow than the ones I have tried to copy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The flow I am trying to create:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The user have a cart with items, he press pay / checkout&lt;/li&gt;&#xA;&lt;li&gt;On the payment page, he selects &quot;Klarna Checkout&quot; as payment option&lt;/li&gt;&#xA;&lt;li&gt;At this point, we need to give Klarna some information about the customer and the items / price he is going to pay for along with some credentials. If all information is correct, Klarna returns a snippet (payment form) as HTML.&lt;/li&gt;&#xA;&lt;li&gt;This snipped then needs to be embedded into the payment page (or redirected to a page that displays it).&lt;/li&gt;&#xA;&lt;li&gt;When the user has payed using this payment form, klarna will redirect the user to a predefined endpoint, where we need to tell him, and Craft that the order is payed for.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I am having problems with is the plugin itself, I have done the initial setup, I can choose it as a payment option and the code runs, but we are having problems with the sendData() function in purchaseRequest.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function seems to send data to an endpoint, and get some response, but exactly what that response should be, I cant seem to find out. Since Klarna Checkout do not have an endpoint, but is a PHP class / a set of functions we have imported with Composer, we cant just send data directly to Klarna, but need to create a order request using this class, and that class will then contact Klarna to get the snippet (payment form).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am having trouble with is figuring out what this function needs, if we need to use it at all, and how to work around it to display the payment form to the end user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any nudge in the right direction would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mathias&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="22" LastEditDate="2017-05-09T20:07:29.090" LastActivityDate="2017-05-09T20:07:29.090" Title="Klarna Checkout - Omnipay" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;php&gt;&lt;craft-features&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19550" PostTypeId="1" CreationDate="2017-03-21T17:00:33.610" Score="3" ViewCount="104" Body="&lt;p&gt;Have a bit of an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, a site I work had its asset index rebuilt upon finishing for some reason all images associated to entries are now no longer attached. They are still on the server and in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one go about linking these back-up as I don't fancy going through every entry to reassociate the image manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="665" LastActivityDate="2017-03-22T14:03:26.857" Title="Images missing from Entries, but still on server" Tags="&lt;entries&gt;&lt;assets&gt;&lt;database&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19551" PostTypeId="1" CreationDate="2017-03-21T17:47:14.373" Score="1" ViewCount="559" Body="&lt;p&gt;I'm running a craft project (ver. 2.4.2684). When I try to upload assets, the progress bar fills and the spinner continues to spin. It looks like it just stalls out and doesn't go beyond that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go into my settings and into my AWS setup, I get this image when I try to refresh my bucket:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S3::listBuckets(): [6] Could not resolve host: s3.amazonaws.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what the issue is since I did not have issues uploading assets before (they still appear loaded into the CMS and are still displaying when I visit the page). For some reason it just won't allow me to upload more assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help is greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2017-03-21T17:47:14.373" Title="Configuring assets error - Could not resolve host: s3.amazonaws.com" Tags="&lt;assets&gt;&lt;aws&gt;&lt;amazon&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19552" PostTypeId="1" CreationDate="2017-03-21T18:28:53.667" Score="1" ViewCount="500" Body="&lt;p&gt;I am having trouble pinpointing the issue but I am struggling with some of my pages taking an absolute age to load. For example;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hcnGJ.png&quot; alt=&quot;Slow loading example&quot;&gt; &#xA;&lt;img src=&quot;https://i.stack.imgur.com/SNvC3.png&quot; alt=&quot;Slow loading example&quot;&gt; &#xA;It might be a local MAMP issue, but some pages load fine and I would say these pages seem to load very slowly each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it could be related to the imager plugin (generating lots of images (srcset and sizes) but I expect this only to run in the first instance not each time. When I look in my folders (in dropbox) I can see the folders get updated by not each image file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or it could be my code and queries and setup, in particular Eager-loading.&#xA;I am struggling to get my head around this and I have so far been unable to reduce the amount of queries, this also varies on each load from between 107ish to 115ish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code for this particular section. I do have related categories and images for each entry which I believe would benefit from Eager Loading, but I cannot establish if my code is correct for the eager loading?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    {% set categories = craft.categories.group('cables') %}&#xA;    {% set cables = craft.entries({&#xA;            section: 'cables',&#xA;            with: [&#xA;                'cableCategory',&#xA;                'cableImage',&#xA;            ],&#xA;            order:  'title'&#xA;    }) %}&#xA;&#xA;    {% for category in categories.relatedTo(cables) %}&#xA;    &amp;lt;div class=&quot;cableGroup&quot;&amp;gt;&#xA;        &amp;lt;h2 class=&quot;panel__title&quot;&amp;gt;{{ category }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;div class=&quot;cableGroup__description content // margin-bottomX2&quot;&amp;gt;&#xA;            {{ category.description }}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for cable in cables.relatedTo(category) %}&#xA;            {% set image = cable.cableImage[0] ?? null %}&#xA;            &amp;lt;li class=&quot;cable&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;#{{ cable.title|camel|upper }}&quot; data-title=&quot;{{ cable.title }} &amp;amp;#xa;&quot;&amp;gt;&#xA;                    {% if image|length %}&#xA;                    {{ img.imagerSrcsetSizes(image, cable.title, '', 'thumb') }}&#xA;                    {% else %}&#xA;                        &amp;lt;img src=&quot;/assets/img/fallback-cable-thumb.jpg&quot; alt=&quot;No Image Available&quot;&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;h3 class=&quot;cable__tag&quot;&amp;gt;{{ cable.title }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;        {% for cable in cables.relatedTo(category) %}&#xA;            {% include '_includes/cables/cableModal' %}&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-03-21T18:28:53.667" Title="Superslow loading of pages in Craft locally" Tags="&lt;performance&gt;&lt;eager-loading&gt;&lt;mamp&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19553" PostTypeId="2" ParentId="19538" CreationDate="2017-03-21T18:41:22.160" Score="1" Body="&lt;p&gt;Craft has a pretty extensive &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relationship&lt;/a&gt; system, which is what you'd probably want to take advantage of here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could make another channel called &quot;Offers&quot; and each offer would be an entry in that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could create an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries field&lt;/a&gt; called &quot;Ad&quot; and save it in your &quot;Offers&quot; section's field layout and have its source set to &quot;Ad&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when saving an offer, you'd select the ad(s) in the ad field the offer belongs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd be able to query those relationships from the template side like so: &lt;a href=&quot;https://craftcms.com/docs/entries-fields#examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/entries-fields#examples&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-21T18:41:22.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19554" PostTypeId="1" CreationDate="2017-03-21T19:35:28.433" Score="4" ViewCount="226" Body="&lt;p&gt;Is the pricing listed on the site for the Pro &amp;amp; Commerce versions of CraftCMS a one time, per-site charge or a reoccurring charge (i.e. monthly, yearly)?&lt;/p&gt;&#xA;" OwnerUserId="6465" LastActivityDate="2017-03-21T19:52:38.997" Title="What is the Pricing Structure for CraftCMS?" Tags="&lt;pricing&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19555" PostTypeId="1" AcceptedAnswerId="19559" CreationDate="2017-03-21T19:50:51.020" Score="2" ViewCount="479" Body="&lt;p&gt;I am editing an already existing field in Craft. When I go to save, I get an error message that says &quot;Couldn't Save Field&quot;, and the block type is highlighted in red. The field type is a Matrix that contains a rich text field, a Link It field, and an image field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am on Craft CMS 2.6.2949.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what could be causing this error? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: Additional Info&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a screenshot of my Matrix field + child fields. I get the error only when I use one of our entry types as the Link Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RT3tN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RT3tN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6466" LastEditorUserId="6466" LastEditDate="2017-03-21T21:47:27.430" LastActivityDate="2017-03-21T22:17:36.170" Title="Couldn't Save Field" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="19556" PostTypeId="2" ParentId="19554" CreationDate="2017-03-21T19:52:38.997" Score="8" Body="&lt;p&gt;One license per site, not a renewal (one time purchase)&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2017-03-21T19:52:38.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19557" PostTypeId="1" CreationDate="2017-03-21T21:08:03.870" Score="2" ViewCount="971" Body="&lt;p&gt;In a plugin, I am trying to redirect to a url, and set some values on the template. It's not working. Here is a simplified (not working) test case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template lives at templates/test.twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;someVar is defined? {{ someVar is defined ? 'yes' : 'no' }}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;site/test&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/test&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Controller code (which does get called):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionTest() {&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'someVar' =&amp;gt; 23&#xA;    ));&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I expect, is that when I first visit the page, &lt;code&gt;someVar&lt;/code&gt; isn't defined, but when I submit the form and revist the page, &lt;code&gt;someVar&lt;/code&gt; will be defined (and equal 23). But it is not defined.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-03-21T23:50:23.970" Title="redirect to url and set variable in template" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19558" PostTypeId="2" ParentId="19522" CreationDate="2017-03-21T22:06:59.810" Score="2" Body="&lt;p&gt;I've not yet tested specifically with Printmaker (only Laravel + Dompdf), but you should be able to add page numbers by using a special &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; block in the template you use for PDF rendering. This block's PHP instructions will be interpreted by Dompdf as it renders your document, so you can position additional elements like page numbers, headers/footers, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of what you'd include &lt;em&gt;in your Twig template&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type='text/php'&amp;gt;&#xA;if ( isset($pdf) ) {&#xA;    $font = $fontMetrics-&amp;gt;get_font('Proxima Nova', 'normal');&#xA;    $size = 9;&#xA;    $y = $pdf-&amp;gt;get_height() - 32;&#xA;    $x = ($pdf-&amp;gt;get_width() / 2) - ($fontMetrics-&amp;gt;get_text_width('1 of 1', $font, $size) / 2);&#xA;    $pdf-&amp;gt;page_text($x, $y, '{PAGE_NUM} of {PAGE_COUNT}', $font, $size);&#xA;}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on the subject where I first learned about it: &lt;a href=&quot;https://stackoverflow.com/a/13184208/897279&quot;&gt;https://stackoverflow.com/a/13184208/897279&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CRITICAL POINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ensure PHP is enabled in &lt;code&gt;config/printmaker.php&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'isPhpEnabled' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastEditorUserId="45" LastEditDate="2019-11-05T21:55:56.820" LastActivityDate="2019-11-05T21:55:56.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19559" PostTypeId="2" ParentId="19555" CreationDate="2017-03-21T22:17:36.170" Score="1" Body="&lt;p&gt;It's entirely possible it's a &lt;a href=&quot;https://github.com/fruitstudios/LinkIt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link It&lt;/a&gt; bug. There is a vaguely similar sounding issue already created here: &lt;a href=&quot;https://github.com/fruitstudios/LinkIt/issues/35&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/fruitstudios/LinkIt/issues/35&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-21T22:17:36.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19560" PostTypeId="2" ParentId="19557" CreationDate="2017-03-21T23:50:23.970" Score="1" Body="&lt;p&gt;If you want to reload the form, you don't need to (indeed, shouldn't) redirect to the posted URL. That's why the form's &lt;code&gt;action&lt;/code&gt; attribute is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionTest() {&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;        'someVar' =&amp;gt; 23&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-21T23:50:23.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19561" PostTypeId="2" ParentId="19542" CreationDate="2017-03-22T02:56:20.373" Score="1" Body="&lt;p&gt;My variable wasn't outputting the id and it wasn't being pulled into my omitIds variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredIds = entry.featuredEntry.first.id %}&#xA;&#xA;{% set omitIds = 'and, not ' ~ taggedEntries|join(', not ') ~ allEntries|join(', not ' ~ featuredIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding &lt;code&gt;.first.id&lt;/code&gt; to my &lt;code&gt;entry.featuredEntry&lt;/code&gt; outputs the correct id.&#xA;Then removed &lt;code&gt;featuredIds&lt;/code&gt; from the &lt;code&gt;', not '&lt;/code&gt; in omitIds and added &lt;code&gt;~ featuredIds&lt;/code&gt; pulls in the correct id and omits it from the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to edit as I'm sure I'm not explaining this correctly.&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2017-03-22T02:56:20.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19563" PostTypeId="1" CreationDate="2017-03-22T06:03:32.180" Score="1" ViewCount="156" Body="&lt;p&gt;I have installed the &lt;a href=&quot;https://dukt.net/oauth/&quot; rel=&quot;nofollow noreferrer&quot;&gt;oAuth&lt;/a&gt; and &lt;a href=&quot;https://github.com/engram-design/SocialPoster&quot; rel=&quot;nofollow noreferrer&quot;&gt;Social Poster&lt;/a&gt; plugins. Created OAuth 2 app via Twitter API Manager. Went to Keys and Access Token and copied Consumer API Key and API Secret and pasted into Client Id and Client Secret (OAuth). When I went to Social Poster plugin / Accounts / Twitter and hit the Connect button. It redirects  &lt;code&gt;/sample.com.au/index.php/admin/actions/socialPoster/accounts/connect?handle=twitter&lt;/code&gt; to &lt;code&gt;sample.com.au/index.php/admin/actions/oauth/connect?provider=twitter&lt;/code&gt;. It appear to be blank and no warning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed the guidelines from two plugin's homegpage and no success getting it to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if my other plugins are interfering with the process or because I moved Craft outside of domain for security measure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone advice me how to setup the plugin properly so I can start sending entries to Twitter. &lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2017-03-22T18:19:24.707" LastActivityDate="2018-03-19T05:33:55.497" Title="oAuth blank page" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19565" PostTypeId="2" ParentId="19470" CreationDate="2017-03-22T08:16:00.877" Score="1" Body="&lt;p&gt;Problem solved; I had a buggy code with batching rows in a table which caused this error. And since I'm not really familiar with PHP I kinda didn't know what to do :-)&#xA;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2017-03-22T08:16:00.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19566" PostTypeId="1" AcceptedAnswerId="19567" CreationDate="2017-03-22T08:59:44.007" Score="2" ViewCount="162" Body="&lt;p&gt;When i use lastUsedShippingAddress it populates the last customer order address. However when the order is complete, database create new customer address (same info but with different ids). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this how it suppose to work?&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2017-03-24T04:58:43.913" Title="About customer address" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19567" PostTypeId="2" ParentId="19566" CreationDate="2017-03-22T09:15:58.663" Score="2" Body="&lt;p&gt;When the order is completed, duplicates of the the shipping and billing addresses that were used during checkout are created, and then related only to the Order. This means that editing the address from the order edit screen does not edit the address in the customer address book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The address IDs that the customer selected (before address duplication) when checking out are the ones saved as the &lt;code&gt;lastBillingAddress&lt;/code&gt; and &lt;code&gt;lastShippingAddress&lt;/code&gt; on the customer. This enables you to set them as defaults for the next time the user checks out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;lastBillingAddress&lt;/code&gt; and &lt;code&gt;lastShippingAddress&lt;/code&gt; have no use for guest checkouts as a new customer will be created for the guest.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-03-24T04:58:43.913" LastActivityDate="2017-03-24T04:58:43.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19568" PostTypeId="1" AcceptedAnswerId="19605" CreationDate="2017-03-22T12:10:24.073" Score="2" ViewCount="438" Body="&lt;p&gt;First of all, I'm starting in Craft in general so I'm having a hard time with things that might be basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a editable table with a Element Select in a column. Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RGXjP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RGXjP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have the possibility to add custom fields, but I don't now how to set up the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.editableTable({&#xA;    id: 'timetable',&#xA;    name: 'timetable',&#xA;    required: false,&#xA;    cols: {&#xA;        name: {&#xA;            heading: &quot;Name&quot; |t,&#xA;            type: &quot;select&quot; |t,&#xA;            options: {&#xA;                'area-x' : 'Area X',&#xA;                'area-y' : 'Area Y',&#xA;                'area-z' : 'Area Z',&#xA;            }&#xA;        },&#xA;        artists: {&#xA;            heading: &quot;Artists&quot; |t,&#xA;            type: &quot;elementSelect&quot; |t,&#xA;        }&#xA;    },&#xA;    rows: ///&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But of course that doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone light up the way?&lt;/p&gt;&#xA;" OwnerUserId="6398" LastEditorUserId="57" LastEditDate="2017-03-22T18:22:43.037" LastActivityDate="2017-04-23T09:25:09.090" Title="Creating a editable table with Element Select in column" Tags="&lt;plugin-development&gt;&lt;form&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19569" PostTypeId="1" AcceptedAnswerId="19603" CreationDate="2017-03-22T12:23:39.967" Score="0" ViewCount="319" Body="&lt;pre&gt;&lt;code&gt;1.{% set totalDeliveryTime = 0 %}&#xA;2.{% set countDeliveries = 0 %}&#xA;3.{% set averageDeliveryTime = 0 %}    &#xA;4.{% for order in pastOrders %}&#xA;5. to--{{order.orderDeliveryTime}}--&#xA;6.{% set totalDeliveryTime = totalDeliveryTime + order.orderDeliveryTime %}&#xA;7.  td--{{totalDeliveryTime}}&#xA;8.{% set countDeliveries = countDeliveries + 1 %}&#xA;9.  tc--{{countDeliveries}}&#xA;10.{% endfor %}&#xA;11.  result--{{ totalDeliveryTime / countDeliveries }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&#xA;to--15--&#xA;td--1&#xA;tc--1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to--30--&#xA;td--2&#xA;tc--2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to--60--&#xA;td--3&#xA;tc--3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to--60--&#xA;td--4&#xA;tc--4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;result--1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its a simple average calculating formula. I want to add my all 'orderDeliveryTime' in 'totalDeliveryTime' through line 6. As in line 5, it returns correct values of orderDeliveryTime which is in 'to' you can see in Result but when we add in totalDeliveryTime through line 6 it return 'td' values (please look 'td' in Result). I think it should 15+30+60+60 (addition of all orderDeliveryTime).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beside this I also used &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ratingsSum = 0 %}&#xA;{% if pastOrders | length %}&#xA;{% for order in pastOrders %}&#xA;{% set ratingsSum = ratingsSum + order.orderDeliveryTime %}&#xA;{% endfor %}&#xA;{% set ratingAverage = ratingsSum / pastOrders | length %}&#xA;AverageTime:{{ratingAverage}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://cliveportman.co.uk/code/calculate-average-of-numbers-in-craft-cms-using-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cliveportman.co.uk/code/calculate-average-of-numbers-in-craft-cms-using-twig&lt;/a&gt;&#xA;But it also returns the same result which is 1.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T20:04:57.877" LastActivityDate="2017-05-09T20:04:57.877" Title="Simple average calculating formula" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19571" PostTypeId="1" CreationDate="2017-03-22T13:42:55.903" Score="1" ViewCount="36" Body="&lt;p&gt;The login page logo does not resize on Craft V3 Beta, but the site icon does, using the identical image. The images are resized to 500 x 500 when uploaded to the cp settings page, but the logo width is cropped to 300 X 412 approximately&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is a bug - is anyone else seeing this?&lt;/p&gt;&#xA;" OwnerUserId="106" LastActivityDate="2017-03-22T13:42:55.903" Title="Version 3 Beta Login Logo Not Resizing" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;settings&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2017-03-22T19:36:47.080" ContentLicense="CC BY-SA 3.0" />
  <row Id="19572" PostTypeId="1" CreationDate="2017-03-22T13:53:49.110" Score="2" ViewCount="195" Body="&lt;p&gt;I have two sections: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Drinks&lt;/li&gt;&#xA;&lt;li&gt;Ingredients&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have a relation/entry field set on the drinks. So for example, two entries in the ingredients section are related to a specific drink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a guest entries form, which submits new ingredients and I want to relate this (or these..) ingredient(s) to the current drink. How would I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating the ingredient itself is not the problem. The problem is relating it to the drink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, is there a hidden input where I can pass along a new array?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steve&lt;/p&gt;&#xA;" OwnerUserId="6468" LastEditorUserId="57" LastEditDate="2017-03-22T18:37:19.413" LastActivityDate="2017-05-18T20:36:56.550" Title="Basic Relation save" Tags="&lt;relations&gt;&lt;relatedto&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19573" PostTypeId="2" ParentId="14804" CreationDate="2017-03-22T13:56:38.860" Score="1" Body="&lt;p&gt;There is a &lt;a href=&quot;https://imperavi.com/redactor/plugins/table/&quot; rel=&quot;nofollow noreferrer&quot;&gt;tables plugin for Redactor&lt;/a&gt;, to easily create tables direct in the editor. On top of that, I think I'd approach this using the &lt;a href=&quot;https://github.com/pixelandtonic/RedactorClips&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Clips plugin&lt;/a&gt; to pre-create a number of tables that cover the client requirement, as that will also allow you to better control the way tables are created and also set up some client-friendly table styles.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-22T13:56:38.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19574" PostTypeId="2" ParentId="19550" CreationDate="2017-03-22T14:03:26.857" Score="1" Body="&lt;p&gt;Clear the caches after updating the assets index, asset indexing data at the very least, though I'd normally clear everything to be sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KVrpa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVrpa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-03-22T14:03:26.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19575" PostTypeId="1" AcceptedAnswerId="19590" CreationDate="2017-03-22T16:44:06.187" Score="2" ViewCount="271" Body="&lt;p&gt;We started a new project, a website that lists products based on regions (for example US and Europe). We have all products in 1 channel (to make it dynamic to add more regions later on) and have a region field added to those entries (a checkbox field). We now want to hide products for specific users in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14627/restrict-entry-editing-to-category-topic/14632#14632&quot;&gt;thread&lt;/a&gt; I was able to add custom permissions via my plugin and it pointed me towards this event &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeBuildElementsQuery&lt;/a&gt; that I could use to add my custom filtering.&#xA;I think I may need to add a custom param with the value of what the regio field needs to be to the ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have no idea how to build the next steps. I don't really understand what that ElementCriteriaModel returns. It's just a model with all basic attributes, no custom fields or anything. No clear section it targets...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next steps should be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is the event triggered by the CP?&lt;/li&gt;&#xA;&lt;li&gt;If so, check the logged in user's permissions and decide what regio should be filtered&lt;/li&gt;&#xA;&lt;li&gt;Add an extra param to the criteria that filters to correct region&lt;/li&gt;&#xA;&lt;li&gt;Send the changed ElementCriterioModel (or Query) to wherever it needs to go&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, how do I insert a custom parameter into that ElementCriteriaModel and will it alter the entries that are visible in the CP? Am I on the right track here?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-03-23T13:26:05.163" Title="Filter entries in the CP based on custom permission" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19577" PostTypeId="1" CreationDate="2017-03-22T17:25:31.283" Score="2" ViewCount="483" Body="&lt;p&gt;I’m trying to insert a programmatically generated &lt;code&gt;id&lt;/code&gt; attribute into child elements of parsedown processed text. I'm aware that Craft’s twig replace filter incorporates &lt;a href=&quot;http://php.net/manual/en/function.preg-replace.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;preg_replace&lt;/a&gt;, so…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a regex search string that finds an HTML tag and its contents. It includes an inner back reference to make sure that the closing tag matches the opening tag (as opposed to some nested closing tag)…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(&amp;lt;([a-z][a-z0-9]*)\b[^&amp;gt;]*&amp;gt;(.*?)&amp;lt;/\2&amp;gt;)\s+&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use &lt;code&gt;$1&lt;/code&gt; inside &lt;code&gt;|replace&lt;/code&gt; to refer to the entire tag found by the outer parentheses…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;elems|replace('/(&amp;lt;([a-z][a-z0-9]*)\\b[^&amp;gt;]*&amp;gt;(.*?)&amp;lt;/\\2&amp;gt;)\s/', '$1&amp;gt;,')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…and then work with the results, but the problem (I think) is the syntax for the back reference inside the search string itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following without success…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;elems|replace('/(&amp;lt;([a-z][a-z0-9]*)\\b[^&amp;gt;]*&amp;gt;(.*?)&amp;lt;/$2&amp;gt;)\s/', '$1&amp;gt;,')&lt;/code&gt;&#xA;&lt;code&gt;elems|replace('/(&amp;lt;([a-z][a-z0-9]*)\\b[^&amp;gt;]*&amp;gt;(.*?)&amp;lt;/\\$2&amp;gt;)\s/', '$1&amp;gt;,')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong? Is this even possible with &lt;strong&gt;preg_replace&lt;/strong&gt;? Or is there a better way to go about injecting attributes into parsedown processed text?&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2017-03-22T17:39:13.727" LastActivityDate="2017-03-22T18:48:53.217" Title="Using a back reference inside a regex search string within replace filter" Tags="&lt;replace&gt;&lt;regex&gt;&lt;markdown&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19578" PostTypeId="2" ParentId="19577" CreationDate="2017-03-22T17:58:55.787" Score="1" Body="&lt;p&gt;Backreferences within the regex are normally defined as &lt;code&gt;\1&lt;/code&gt;, &lt;code&gt;\2&lt;/code&gt;, etc. In the &lt;code&gt;|replace&lt;/code&gt; filter you need to escape all backslashes, so it’ll be &lt;code&gt;\\1&lt;/code&gt;, &lt;code&gt;\\2&lt;/code&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-22T17:58:55.787" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19579" PostTypeId="2" ParentId="19577" CreationDate="2017-03-22T18:13:33.147" Score="1" Body="&lt;p&gt;A workaround in light of my comments on Brandon’s reply…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I ignore the attempt to act on child tags only, I can search for opening tags of all generated elements (regardless of whether they are nested) with…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set elems = elems|replace('/(&amp;lt;[a-z][a-z0-9]*\\b[^&amp;gt;]*&amp;gt;)/', '$1&amp;gt;,') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Convert elems to an array #}&#xA;    {% set elems = elems|split('&amp;gt;,') %}&#xA;&#xA;{% for el in elems %}&#xA;    {# Add an id attribute to each opening tag -- eg: id=&quot;el123-1&quot; #}&#xA;    {{ el|replace('/(&amp;lt;[a-z][a-z0-9]*)/', '$1 id=&quot;el' ~ blockId ~ '-' ~ loop.index ~ '&quot;')|raw }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2017-03-22T18:48:53.217" LastActivityDate="2017-03-22T18:48:53.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19580" PostTypeId="2" ParentId="19572" CreationDate="2017-03-22T18:37:00.223" Score="1" Body="&lt;p&gt;You'd use this syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle][]&quot; value=&quot;123&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the value should be the ID of the entry you want related. There's a handy guide here for the front-end syntax for all of Craft's field types: &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="167" LastEditDate="2017-05-18T20:36:56.550" LastActivityDate="2017-05-18T20:36:56.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19581" PostTypeId="1" AcceptedAnswerId="19582" CreationDate="2017-03-22T23:56:51.087" Score="3" ViewCount="288" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/craftcms/element-api/tree/v1#elementtype-required&quot; rel=&quot;nofollow noreferrer&quot;&gt;elementApi&lt;/a&gt; docs state you can use custom elementTypes via plugins.  I am using craft commerce which states it creates the custom elementType '&lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;purchasable&lt;/a&gt;'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'endpoints' =&amp;gt; [&#xA;    'category.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'purchasable',&#xA;        'criteria' =&amp;gt; [&#xA;            // 'category' =&amp;gt; 'products', // randomly trying stuff here!&#xA;            // 'section' =&amp;gt; 'products',&#xA;            // 'type' =&amp;gt; 'products',&#xA;        ],&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            ];&#xA;        },&#xA;    ]&#xA;]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried many variations on the word purchasable, as we as random guesses like 'product', 'item' etc etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention I am able to JSON back with all categories, Entries etc etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure this is possible, as craft, craftcommerce and elementApi are all made by the same guys!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be amazing&lt;/p&gt;&#xA;" OwnerUserId="6472" LastActivityDate="2018-10-08T02:59:08.923" Title="Get 'purchasable' from ElementAPI" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19582" PostTypeId="2" ParentId="19581" CreationDate="2017-03-23T00:07:59.520" Score="3" Body="&lt;p&gt;Try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'endpoints' =&amp;gt; [&#xA;    'products.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; 'Commerce_Product',&#xA;        'criteria' =&amp;gt; [&#xA;            // 'category' =&amp;gt; 'products', // randomly trying stuff here!&#xA;            // 'section' =&amp;gt; 'products',&#xA;            // 'type' =&amp;gt; 'products',&#xA;        ],&#xA;        'transformer' =&amp;gt; function(Commerce_ProductModel $product) {&#xA;            return [&#xA;                'title' =&amp;gt; $product-&amp;gt;title,&#xA;                'url' =&amp;gt; $product-&amp;gt;url,&#xA;            ];&#xA;        },&#xA;    ]&#xA;]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2017-03-23T04:49:07.210" LastActivityDate="2017-03-23T04:49:07.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19583" PostTypeId="1" CreationDate="2017-03-23T00:30:18.917" Score="1" ViewCount="183" Body="&lt;p&gt;Is it possible to perform a search and have the results grouped/prioritized by sections?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(['sec3', 'sec5', 'sec1']).search(...).limit(6) as page_info, page_entries&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want &lt;code&gt;sec3&lt;/code&gt; entries first, followed by &lt;code&gt;sec5&lt;/code&gt; and &lt;code&gt;sec1&lt;/code&gt; entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I want to use the built-in pagination mechanism and would not like to use hacks such as searching tons of entries and manually group the results by sections.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2017-04-23T11:25:12.463" Title="Search entries ordered by sections" Tags="&lt;entries&gt;&lt;search&gt;&lt;sections&gt;&lt;order&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19584" PostTypeId="1" AcceptedAnswerId="19588" CreationDate="2017-03-23T02:34:18.167" Score="3" ViewCount="59" Body="&lt;p&gt;The performance of the ElementCriteriaModel for lookups is killing me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 300 or so &quot;People&quot; entries in a craft site and trying to load them just for a basic listing page takes forever. There's just so much overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case of i.e. a listing page, I need the &lt;strong&gt;entry title&lt;/strong&gt;, &lt;strong&gt;slug&lt;/strong&gt; and an &lt;strong&gt;image&lt;/strong&gt; field (which I'm eager loading). I don't need all of the other fields and overhead it loads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get more acceptable performance for cases like this specific one (listing page with large number of entries and limited data needed)? Or am I going to have to bypass the element criterea stuff and do the lookups myself in SQL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-03-23T12:58:13.877" Title="Performance when loading lots of Elements but only need limited data" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19585" PostTypeId="1" AcceptedAnswerId="19591" CreationDate="2017-03-23T08:33:02.567" Score="2" ViewCount="166" Body="&lt;p&gt;I have set up the Craft Shopify plugin on a new build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also created a 'Shopify Product' field in the CMS on my entry within my Products channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, whenever I try to view the product in the back end I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zcLsb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zcLsb.png&quot; alt=&quot;Shopify error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TxZmc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxZmc.png&quot; alt=&quot;Shopify error 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be massively appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Jay&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2017-03-23T14:35:14.787" Title="'Invalid argument supplied for foreach()' using Shopfiy Craft Plugin" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19586" PostTypeId="1" CreationDate="2017-03-23T10:43:14.043" Score="2" ViewCount="380" Body="&lt;p&gt;I'm pretty new to Craft, and a noob when it comes to build tools. Coming from WordPress I've been using Roots/Sage which is a starter theme with liveReload(browserSync), Bootstrap 4, SASS and JS compiling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been googling for a long time now, and I haven't been able to find a good boilerplate for me to start doing development on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What build tool isn't really important to me(WebPack, Gulp, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm looking for is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;liveReload, CSS-injection or simple browserSync. So when I'm updating my SASS styles and Craft templates the site automatically updates.&lt;/li&gt;&#xA;&lt;li&gt;Bootstrap 4&lt;/li&gt;&#xA;&lt;li&gt;JS concatenation and uglyfing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there anything out there that fits my(and I know a lot of other developers) needs?&lt;/p&gt;&#xA;" OwnerUserId="6473" LastActivityDate="2017-03-23T12:50:26.323" Title="Does a up to date boilerplate for Bootstrap 4 with live reload, sass and js build exist?" Tags="&lt;assets&gt;&lt;frontend&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19587" PostTypeId="2" ParentId="19586" CreationDate="2017-03-23T12:50:26.323" Score="1" Body="&lt;p&gt;Craft doesn't use themes, in the way WordPress does, so you won't find a direct equivalent to Roots / Sage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, none of what you listed is CMS-specific, so there's nothing stopping you setting up a generic development / build workflow which matches your stated requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack Overflow is a better place to ask about general tooling, though.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-23T12:50:26.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19588" PostTypeId="2" ParentId="19584" CreationDate="2017-03-23T12:58:13.877" Score="5" Body="&lt;p&gt;Not in Craft 2 without completely bypassing ElementCriteriaModel and building your own SQL query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 (&lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;noreferrer&quot;&gt;currently in beta&lt;/a&gt;) you can, though – you can override which columns get selected in your element queries, and you can choose whether you want the data returned as element models or just plain arrays.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section('news')&#xA;    .select('elements.id', 'content.title')&#xA;    .asArray()&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-23T12:58:13.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19589" PostTypeId="1" AcceptedAnswerId="19597" CreationDate="2017-03-23T13:19:06.550" Score="2" ViewCount="67" Body="&lt;p&gt;I hooked up into the &lt;code&gt;content.saveContent&lt;/code&gt; event. I want to save the entry content into a different application. Is there a way to retrieve the content as a Json (Or something more friendly). I think do &lt;code&gt;$event-&amp;gt;params['content']-&amp;gt;title&lt;/code&gt; is now the best option.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-03-23T21:27:41.200" Title="Get saved content of entry" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19590" PostTypeId="2" ParentId="19575" CreationDate="2017-03-23T13:26:05.163" Score="4" Body="&lt;p&gt;After some digging I came up with some answers myself. For future reference, here they are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the event triggered by the CP: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if(craft()-&amp;gt;request-&amp;gt;isCpRequest()){}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the logged in user's permissions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userPermissions = craft()-&amp;gt;userPermissions-&amp;gt;getPermissionsByUserId($user-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or use a permission directly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($user-&amp;gt;can('permissionName')){}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add an extra param to the criteria that filters to correct region:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = $event-&amp;gt;params['query'];&#xA;$params = array( ':regio' =&amp;gt; '[&quot;us&quot;,&quot;eu&quot;]' );&#xA;$query-&amp;gt;andWhere('content.field_regio LIKE :regio', $params);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Send the changed ElementCriterioModel (or query) to wherever it needs to go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;After setting that query, the function just executes and filters the list.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use something like this, make sure you filter out the correct section to check on (because the &lt;code&gt;onBuildElementsQuery&lt;/code&gt; is fired on almost everything in the CP). But that's where I stopped my search as eventually, we will not be needing it in this project.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-03-23T13:26:05.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19591" PostTypeId="2" ParentId="19585" CreationDate="2017-03-23T14:35:14.787" Score="1" Body="&lt;p&gt;Turns out this was an issue with 'https://' being in the store's URL in the CMS.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2017-03-23T14:35:14.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19592" PostTypeId="2" ParentId="19546" CreationDate="2017-03-23T14:41:44.950" Score="2" Body="&lt;p&gt;I was able to find a solution. It's probably not the best way to go, but it works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the form add a new action: &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;freeform/submissions/save&quot;&amp;gt;&lt;/code&gt; which will override the standard action. It's the same form action Freeform uses to save entries in the CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then add the &lt;code&gt;id&lt;/code&gt; you want to update as &lt;code&gt;value=&lt;/code&gt;. &#xA;For example:&#xA;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;submissionId&quot; value=&quot;{{submission.id}}&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One disadvantage is, is that this POST does not support the handle, values,.. &lt;code&gt;input&lt;/code&gt; data for the fields - you need to use the fields &lt;code&gt;id&lt;/code&gt;. &lt;br /&gt;So &lt;br /&gt;&#xA;&lt;code&gt;&amp;lt;input name=&quot;{{ firstName.handle }}&quot; value=&quot;{{ firstName.value }}&quot; &amp;gt;&lt;/code&gt; &lt;br /&gt;&#xA;becomes &lt;br /&gt;&#xA;&lt;code&gt;&amp;lt;input name=&quot;field_1&quot; value=&quot;{{submission.FirstName}}&quot; /&amp;gt;&lt;/code&gt; &lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the field &lt;code&gt;id&lt;/code&gt; in the CP. Some fields might need a bit more info, like email is &lt;code&gt;field_3[]&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6464" LastActivityDate="2017-03-23T14:41:44.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19593" PostTypeId="1" CreationDate="2017-03-23T18:06:42.217" Score="3" ViewCount="676" Body="&lt;p&gt;For a client I need to export websites as static html (/w images, CSS, JS etc.), which I have created in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I cannot find a plugin for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give me a hint, how do I start with this?&lt;/p&gt;&#xA;" OwnerUserId="6477" LastEditorUserId="-1" LastEditDate="2017-03-23T20:49:31.197" LastActivityDate="2017-03-23T20:49:31.197" Title="Export static html including images, CSS, JS etc" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19594" PostTypeId="2" ParentId="19593" CreationDate="2017-03-23T18:55:52.630" Score="4" Body="&lt;p&gt;I see 3 options, none of which warrant the creation of a plug-in:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Get &lt;em&gt;Craft&lt;/em&gt; to output all your URLs as a simple, unformatted list. Easy enough to do this with Twig templates, right (ask if not!)? Save this as &lt;code&gt;pages.txt&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Install &lt;code&gt;wget&lt;/code&gt;. Simple to do on Linux (&lt;code&gt;apt-get install wget&lt;/code&gt; probably), if you're on a Mac you can install it using &lt;code&gt;brew install wget&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;wget -i pages.txt&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;You should now have all the pages as lovely static &lt;code&gt;.html&lt;/code&gt; files.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Get &lt;em&gt;Craft&lt;/em&gt; to output pages as a big &lt;code&gt;.json&lt;/code&gt; data file. Again, easy enough to do with Twig templates.&lt;/li&gt;&#xA;&lt;li&gt;Use a 'Static CMS' to read in this JSON and use it to build out a reproduction as a static website. Personally, I'd use &lt;em&gt;Middleman&lt;/em&gt; or &lt;em&gt;Assemble.io&lt;/em&gt; if I was doing this - but I guess it depends if you're more comfortable with Ruby or Node.js respectively.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ask yourself why you're doing this? Is it performance? Security? Maybe if you get up to date with use of the &lt;code&gt;{% cache %}&lt;/code&gt; tags you'll have a much easier time!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4208" LastEditorUserId="4208" LastEditDate="2017-03-23T19:15:16.020" LastActivityDate="2017-03-23T19:15:16.020" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19595" PostTypeId="2" ParentId="11068" CreationDate="2017-03-23T20:06:14.930" Score="1" Body="&lt;p&gt;You can use the same syntax on the Matrix block that you're using on the Entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldLayoutField in entry.getFieldLayout().getFields() %}&#xA;  {% set field = craft.fields.getFieldById(fieldLayoutField.fieldId) %}&#xA;&#xA;  {% if field.type == 'Matrix' %}&#xA;&#xA;    {% for block in entry[field.handle] %}&#xA;      &amp;lt;tr&amp;gt;&#xA;&#xA;        {# output the name of the matrix field #}&#xA;        &amp;lt;td&amp;gt;{{field.name}}&amp;lt;/td&amp;gt;&#xA;&#xA;        &amp;lt;td&amp;gt;&#xA;          {% for fieldId in block.fieldLayout.fieldIds %}&#xA;&#xA;            {% set field = craft.fields.getFieldById(fieldId) %}&#xA;&#xA;            {# output the name of the nested field and its value #}&#xA;            {{field.name}}: {{block[field.handle]}}&amp;lt;br/&amp;gt;&#xA;&#xA;          {% endfor %}&#xA;        &amp;lt;/td&amp;gt;&#xA;      &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6478" LastActivityDate="2017-03-23T20:06:14.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19596" PostTypeId="1" CreationDate="2017-03-23T20:08:44.340" Score="2" ViewCount="61" Body="&lt;p&gt;I am using the Solspace Calendar plugin for Craft CMS. I need to construct a URL for the Events listing template for a specific calendar group. For example, I want to use the Events template, but only for the Academic calendar, so that I exclude events in the athletics or faculty calendars.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of these work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://localhost/calendar/events/academics&lt;/code&gt; or &lt;code&gt;http://localhost/calendar/events/calendar/academics&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help, please?&lt;/p&gt;&#xA;" OwnerUserId="6130" LastEditorUserId="57" LastEditDate="2017-03-23T21:32:39.227" LastActivityDate="2017-03-23T21:32:39.227" Title="How might a construct a URL for an Event List of a specific calendar using the Solspace Calendar plugin?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19597" PostTypeId="2" ParentId="19589" CreationDate="2017-03-23T21:27:41.200" Score="0" Body="&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['content]&lt;/code&gt; will return a &lt;a href=&quot;https://craftcms.com/classreference/models/ContentModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ContentModel&lt;/a&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either access specific fields directly, like you found, or loop through them all with &lt;code&gt;-&amp;gt;getAttributes()&lt;/code&gt; grabbing the ones you want to save externally.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-23T21:27:41.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19598" PostTypeId="1" AcceptedAnswerId="19600" CreationDate="2017-03-23T21:45:13.300" Score="2" ViewCount="73" Body="&lt;p&gt;Searched around online and couldn't find an answer to this question. I want to be able to include some data from the author/user account associated with an entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the basic working version of an individual entry, which does display the 'author' name, but no idea how to display that user's data, such as; profile photo, first name, last name, and custom member fields. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'listings/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function($entryId) {&#xA;  return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; ['id' =&amp;gt; $entryId],&#xA;    'first' =&amp;gt; true,&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;      return [&#xA;        (int)$entry-&amp;gt;id,&#xA;        (int)$entry-&amp;gt;year,&#xA;        $entry-&amp;gt;manufacturer,&#xA;        $entry-&amp;gt;model,&#xA;        $entry-&amp;gt;author&#xA;      ];&#xA;    },&#xA;  ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastActivityDate="2017-03-23T22:09:10.017" Title="ElementAPI: Include author/user data with entry?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19599" PostTypeId="2" ParentId="19563" CreationDate="2017-03-23T22:02:01.490" Score="1" Body="&lt;p&gt;Based on the error you're getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in /home/.../public_html/craft/plugins/oauth/vendor/guzzle‌​http/guzzle/src/Hand‌​ler/CurlFactory.php on line 78&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd guess that your cURL installation goes have &lt;a href=&quot;https://secure.php.net/manual/en/function.curl-reset.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;curl_reset&lt;/a&gt; available to it, for whatever reason.  Maybe your host has it in your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.disable-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;disable_functions&lt;/a&gt; setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-23T22:02:01.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19600" PostTypeId="2" ParentId="19598" CreationDate="2017-03-23T22:09:10.017" Score="1" Body="&lt;p&gt;&lt;code&gt;$entry-&amp;gt;author&lt;/code&gt; is going to be a &lt;a href=&quot;https://craftcms.com/classreference/models/UserModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;UserModel&lt;/a&gt; object, so you've got access to all of its properties and methods depending on what you need to return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;code&gt;$entry-&amp;gt;author-&amp;gt;firstName&lt;/code&gt;, &lt;code&gt;$entry-&amp;gt;author-&amp;gt;lastName&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a list of them from a Twig perspective, but the same things are available to PHP. &lt;a href=&quot;https://craftcms.com/docs/templating/usermodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/usermodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-23T22:09:10.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19601" PostTypeId="1" AcceptedAnswerId="19609" CreationDate="2017-03-24T03:55:03.907" Score="7" ViewCount="4267" Body="&lt;p&gt;Hi guys are the any more detailed tutorials on how to setup a multi site on Craft3 BETA? I created two sites now, a Danish and English through the admin (Settings → Sites). The domain is the same but the Danish version will have the path &lt;code&gt;http://localhost:8888/dk&lt;/code&gt; whereas the English version will be everything that does not have the first path of &lt;code&gt;/dk&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set in the &lt;code&gt;general.php&lt;/code&gt; the following:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    '*' =&amp;gt; [&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'usePathInfo' =&amp;gt; true,&#xA;        'generateTransformsBeforePageLoad' =&amp;gt; true&#xA;    ],&#xA;   'SITEHANDLE_NAME_ENGLISH' =&amp;gt; [&#xA;       'siteUrl' =&amp;gt; 'http://localhost:8888/&#xA;   ],&#xA;   'SITEHANDLE_NAME_DANISH’ =&amp;gt; [&#xA;       'siteUrl' =&amp;gt; 'http://localhost:8888/dk'&#xA;   ],&#xA;    'defaultWeekStartDay' =&amp;gt; 1,&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;    'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;    'cpTrigger' =&amp;gt; 'admin',&#xA;    'devMode' =&amp;gt; false,&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the Danish folder &lt;code&gt;/dk&lt;/code&gt;, I created a new &lt;code&gt;index.php&lt;/code&gt;, and the site correctly direct to this file from the URL, BUT, it does not change the site to the the Danish site, even though I have defined my &lt;code&gt;index.php&lt;/code&gt; with the new php constant:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;// Project root path&#xA;$root = dirname('../');&#xA;define('CRAFT_SITE', &quot;SITEHANDLE_NAME_DANISH&quot;);&#xA;// Composer autoloader&#xA;require_once '../craft_folder/vendor/autoload.php';&#xA;&#xA;// dotenv?&#xA;if (file_exists(&quot;../craft_folder/.env&quot;)) {&#xA;    $dotenv = new Dotenv\Dotenv(&quot;../craft_folder/&quot;);&#xA;    $dotenv-&amp;gt;load();   &#xA;}&#xA;&#xA;// Craft&#xA;define('CRAFT_BASE_PATH', &quot;../craft_folder/&quot;);&#xA;&#xA;$app = require '../craft_folder/vendor/craftcms/cms/bootstrap/web.php';&#xA;&#xA;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I tell Craft to load the Danish site from the &lt;code&gt;index.php&lt;/code&gt;? Right now it will only load the primary site not matter what I try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6480" LastEditorUserId="3951" LastEditDate="2018-03-02T15:41:52.737" LastActivityDate="2018-08-15T14:58:50.487" Title="Multi-site setup in Craft3" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19602" PostTypeId="2" ParentId="16601" CreationDate="2017-03-24T06:23:30.440" Score="1" Body="&lt;p&gt;Thanks for these examples above. To handle an early event start (i.e. 9am) then the time format works only if you have a leading 0 so &lt;strong&gt;H&lt;/strong&gt; instead of &lt;strong&gt;G&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;date(“Hi&quot;, “UTC&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="264" LastActivityDate="2017-03-24T06:23:30.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19603" PostTypeId="2" ParentId="19569" CreationDate="2017-03-24T08:00:42.913" Score="1" Body="&lt;p&gt;You can try the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ratingsSum = 0 %}&#xA;{% for order in pastOrders %}&#xA;    {% set ratingsSum = ratingsSum + order.orderDeliveryTime.value %}&#xA;{% endfor %}&#xA;&#xA;{% set ratingAverage = ratingsSum / pastOrders | length %}&#xA;AverageTime:{{ratingAverage}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Difference between yours and my code is i have added &lt;strong&gt;.value&lt;/strong&gt; with &lt;strong&gt;order.orderDeliveryTime&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-03-24T08:00:42.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19604" PostTypeId="1" AcceptedAnswerId="19618" CreationDate="2017-03-24T09:00:44.487" Score="2" ViewCount="122" Body="&lt;p&gt;When you delete/remove a plugin all the database tables related to it will be deleted and I would like to know if there is a way to keep them or store them into a file and force the user to download it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some kind of forum and saved many relevant information in a custom table but if someone deletes/removes the plugin accidentally or to include another row nothing will work anymore. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there I function I can use in &lt;code&gt;public function onBeforeUninstall()&lt;/code&gt; to save my table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can go to phpmyadmin/adminer an use the export function by hand but we are all people and we can forget that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-03-24T18:22:57.160" Title="Export database table as .sql before deleting/removing a plugin" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19605" PostTypeId="2" ParentId="19568" CreationDate="2017-03-24T09:04:42.313" Score="2" Body="&lt;p&gt;For my specific case, &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt; was the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-03-24T09:04:42.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19606" PostTypeId="1" CreationDate="2017-03-24T09:15:54.183" Score="2" ViewCount="613" Body="&lt;p&gt;I'm creating a pretty specific entry with some fields. And I want to create the from a third party app. For that, I'd like to see the SQL query that get executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried it with events, &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt;and &lt;code&gt;content.saveContent&lt;/code&gt; but I cannot get the query itself.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-03-24T18:26:59.700" Title="See the SQL query that gets executed when saving entry" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19607" PostTypeId="1" CreationDate="2017-03-24T09:44:44.340" Score="2" ViewCount="99" Body="&lt;p&gt;I have a complex template which uses various modules and sub-components for which I opted for handling all the logic and rendering directly in PHP, as it felt like it was too complex a job for twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, when I change a field (e.g. swap out an image) inside one of the modules, the surrounding cache isn't busted, so the site doesn't update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How can I make Craft aware of fields used inside a plugin within a &lt;code&gt;{% cache %}&lt;/code&gt; tag, so that when a field is changed, the surrounding cache is busted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService&quot; rel=&quot;nofollow noreferrer&quot;&gt;TemplateCacheService&lt;/a&gt;, but unsure if / how I can use that in this case (I had a bit of an experiment with no success).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;modules&lt;/code&gt; represent a Neo field, but my assumption is that this would work very similarly if not identically to if this was a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A super-reduced test case looks something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for module in modules %}&#xA;    {% cache using key module.id %}&#xA;        {{ craft.control.renderModule(module) }}&#xA;    {% endcache %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;_modules.twig&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class ControlVariable&#xA;{&#xA;&#xA;    public function renderModule($module)&#xA;    {&#xA;        return craft()-&amp;gt;control_modules-&amp;gt;renderModule($module);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;ControlVariable.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Control_ModulesService extends BaseApplicationComponent&#xA;{&#xA;&#xA;public function __construct()&#xA;{}&#xA;&#xA;public function renderModule($module)&#xA;{&#xA;    ?&amp;gt;&#xA;&#xA;    &amp;lt;!-- How can Craft know when this image changes? --&amp;gt;&#xA;    &amp;lt;img src=&quot;&amp;lt;?= $module-&amp;gt;myImageField-&amp;gt;first()-&amp;gt;getUrl(); ?&amp;gt;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;?php&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Control_ModulesService.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, in the following setup, the cache is successfully busted when changing the image field in the CMS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for module in modules %}&#xA;    {% cache using key module.id %}&#xA;        &amp;lt;img src=&quot;{{ module.myImageField.first().getUrl() }}&quot;&amp;gt;      &#xA;    {% endcache %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;_modules.twig&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2017-03-31T23:32:10.307" Title="How can I make Craft's caching aware of fields used inside a plugin?" Tags="&lt;plugins&gt;&lt;cache&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19608" PostTypeId="2" ParentId="2830" CreationDate="2017-03-24T10:16:55.273" Score="2" Body="&lt;p&gt;Just using &lt;code&gt;|nl2br&lt;/code&gt; inside a &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag (or whatever you choose) worked for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;p&amp;gt;{{ contact.address|nl2br }}&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2017-03-24T10:16:55.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19609" PostTypeId="2" ParentId="19601" CreationDate="2017-03-24T10:18:50.177" Score="4" Body="&lt;p&gt;Have you watched the Craft Hangout?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/events/managing-multiple-sites-in-craft-3-sites-and-localization&quot; rel=&quot;noreferrer&quot;&gt;Managing Multiple Sites in Craft 3 – Sites and Localization&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might be of use if you haven't. You'll need about an hour free to view it.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-03-24T10:18:50.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19610" PostTypeId="2" ParentId="19606" CreationDate="2017-03-24T10:27:01.473" Score="3" Body="&lt;p&gt;If you add the &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; setting to your config, you should then be able to view the Javascript Console in your browser to see the SQL Queries being run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular you're looking for the &lt;code&gt;Profiling Summary Report&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can view the Craft Logs at &lt;code&gt;/admin/utils/logs&lt;/code&gt;, when you are logged into the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-03-24T10:27:01.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19611" PostTypeId="1" AcceptedAnswerId="19643" CreationDate="2017-03-24T10:50:35.700" Score="2" ViewCount="160" Body="&lt;p&gt;It's probably a syntax issue, but how do I add this Google Map styling code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    [&#xA;  {&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#f5f5f5&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.icon&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;visibility&amp;quot;: &amp;quot;off&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#616161&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.stroke&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#f5f5f5&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;administrative.land_parcel&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#bdbdbd&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#eeeeee&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;visibility&amp;quot;: &amp;quot;off&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#757575&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi.business&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;visibility&amp;quot;: &amp;quot;off&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi.park&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#e5e5e5&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;poi.park&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#9e9e9e&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#ffffff&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.icon&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;visibility&amp;quot;: &amp;quot;off&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road.arterial&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#757575&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road.highway&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#dadada&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road.highway&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#616161&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;road.local&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#9e9e9e&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;transit&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;visibility&amp;quot;: &amp;quot;off&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;transit.line&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#e5e5e5&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;transit.station&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#eeeeee&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;water&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;geometry&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#c9c9c9&amp;quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &amp;quot;featureType&amp;quot;: &amp;quot;water&amp;quot;,&#xA;    &amp;quot;elementType&amp;quot;: &amp;quot;labels.text.fill&amp;quot;,&#xA;    &amp;quot;stylers&amp;quot;: [&#xA;      {&#xA;        &amp;quot;color&amp;quot;: &amp;quot;#9e9e9e&amp;quot;&#xA;      }&#xA;    ]&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to the actual &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; code? e.g.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    height: 300,&#xA;    zoom: 4,&#xA;    draggable: false,&#xA;    markerInfo: '_includes/mapInfoBubble',&#xA;    markerOptions: {&#xA;        icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'&#xA;    },&#xA;    infoWindowOptions: {&#xA;        maxWidth: 200&#xA;    }&#xA;} %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I drop the json code into options I just get errors. Any pointers?&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="45" LastEditDate="2021-01-01T06:49:50.310" LastActivityDate="2021-01-01T06:50:22.533" Title="How do I add styles or a theme to a Smart Map map?" Tags="&lt;plugins&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19612" PostTypeId="1" CreationDate="2017-03-24T11:00:37.783" Score="2" ViewCount="350" Body="&lt;p&gt;I have created about 30 sites using Perch but find it somewhat frustrating, especially the support. Considering using Craft for my next project but can it handle:&#xA;Membership/user registration. Ie can i restrict certain sections of the iste to registered individuals or members?&#xA;Document management. The prospective client I am tinhking of using for my first Craft site also holds lots (~100) of mainly PDFs some for public use and others for members only. They need a fairly simnple way for the end usuer to be able to upload an keep them oraganised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would Craft satisfy these criteria?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers - Mark&lt;/p&gt;&#xA;" OwnerUserId="6481" LastActivityDate="2017-03-24T11:17:28.837" Title="Craft - suitability for membership/user registration and document upload/management" Tags="&lt;users&gt;&lt;login&gt;&lt;registration&gt;&lt;pdf&gt;&lt;member&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19613" PostTypeId="2" ParentId="19583" CreationDate="2017-03-24T11:08:58.803" Score="1" Body="&lt;p&gt;Something like this should get you started, q is the querystring in your results url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).level(1).order('score') %}&#xA;{% set grouped = entries|group('section') %}&#xA;&#xA;        &amp;lt;h1&amp;gt;Results for &amp;lt;em&amp;gt;&amp;amp;ldquo;{{ query }}&amp;amp;rdquo;&amp;lt;/em&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&#xA;        {% if entries|length %}&#xA;        {% for section, entriesInGroup in grouped %}&#xA;        &amp;lt;h3&amp;gt;{{ section }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;            {% for entry in entriesInGroup %}&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endfor %}&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure how pagination fits in here but I'm sure others will chime in.&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2017-03-24T11:08:58.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19614" PostTypeId="2" ParentId="19612" CreationDate="2017-03-24T11:17:28.837" Score="2" Body="&lt;p&gt;Should be no problem, Craft has extensive user management capabilities, check &lt;a href=&quot;https://craftcms.com/features/users&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/features/users&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://craftcms.com/docs/users&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/users&lt;/a&gt; as well as solid asset management &lt;a href=&quot;https://craftcms.com/features/assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/features/assets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log in to the demo &lt;a href=&quot;https://demo.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://demo.craftcms.com/&lt;/a&gt; or do a local install, as long as your test domain has .dev in the url you can fully test Craft with purchasing a license.&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2017-03-24T11:17:28.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19615" PostTypeId="1" AcceptedAnswerId="19642" CreationDate="2017-03-24T11:20:56.377" Score="2" ViewCount="511" Body="&lt;p&gt;when setting a Default Upload Location for a field that’s attached to a User, what’s the variable to use that would ensure the file is uploaded to the User I’m editing’s account in the back end, and not &lt;em&gt;my admin&lt;/em&gt; user account - which is what {{currentUser.username}} does?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't been able to find out and everything I've tried hasn't worked. e.g., Could not resolve the subpath “{user.username}”. And {{ user.username }} uploads to a folder for my admin account.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2017-03-24T11:31:55.510" LastActivityDate="2021-03-31T14:50:31.047" Title="Default Upload Location for asset fields on a User...?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19617" PostTypeId="1" AcceptedAnswerId="20153" CreationDate="2017-03-24T18:14:39.870" Score="2" ViewCount="288" Body="&lt;p&gt;I am trying to use Twig methods/loops while working on a design/template. To avoid touching the CP or the DB i did set variables directly in the template, like : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set service = &#xA;  { &#xA;    'titel': &#xA;      [&#xA;        'Titel1', &#xA;        'Titel2'&#xA;      ],&#xA;  }&#xA;%}&#xA;&#xA;{% for i in 0..1 %}&#xA;  &amp;lt;p&amp;gt;{{ service.headerQuote }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be much better to be able to use the standard Craft methods, so if I move from templating/designing towards the DB i wouldn't have to touch the methods in my markup.  Unfortunately, I can't make it work... I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set service = { titel: &#xA;                   [ &#xA;                     'hallo',&#xA;                     'hallo2' &#xA;                    ]&#xA;                  } &#xA;                %}&#xA;&#xA;{% for entry in craft.entries&#xA;      .section('service') %}&#xA;&#xA;      &amp;lt;p&amp;gt;{{ entry.titel }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to set the service entry to craft.entries.section('service') but that doesn't work as well... what am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it even possible to overwrite Craft variables in the markup?&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2017-03-24T18:38:02.667" LastActivityDate="2017-04-24T10:02:15.010" Title="Set Craft variables in the markup" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19618" PostTypeId="2" ParentId="19604" CreationDate="2017-03-24T18:22:57.160" Score="1" Body="&lt;p&gt;If your plugin overrides &lt;code&gt;onBeforeUninstall()&lt;/code&gt;, then you could call &lt;code&gt;craft()-&amp;gt;db-&amp;gt;backup();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that will backup the whole database via PHP code, which might not be what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're in a plugin, I'd probably make sure &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;mysqldump&lt;/a&gt; is available to PHP via the command line and use that to execute it and that way you can also specify the exact tables you'd like to dump.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-24T18:22:57.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19619" PostTypeId="2" ParentId="19606" CreationDate="2017-03-24T18:26:59.700" Score="0" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/a/19610/57&quot;&gt;Steve's answer&lt;/a&gt;, if you install &lt;a href=&quot;https://xdebug.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;xDebug&lt;/a&gt;, you can put a breakpoint in &lt;code&gt;craft/app/EntriesService()-&amp;gt;saveEntry()&lt;/code&gt; and step through/into and watch the SQL query be built and executed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-03-24T18:26:59.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19620" PostTypeId="2" ParentId="19617" CreationDate="2017-03-24T18:45:47.193" Score="1" Body="&lt;p&gt;I'm not 100% sure I'm following what you're going for, if you want to access the array values of the &lt;code&gt;titel&lt;/code&gt; property in the &lt;code&gt;service&lt;/code&gt; variable, you'd do so like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;service.title[0]&lt;/code&gt;, which would equal &lt;code&gt;hallo&lt;/code&gt; and &lt;code&gt;service.title[1]&lt;/code&gt;, which would equal &lt;code&gt;hallo2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section(service.title[0]) %}&#xA;&#xA;  &amp;lt;p&amp;gt;{{ entry.titel }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-04-23T23:07:25.870" LastActivityDate="2017-04-23T23:07:25.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19621" PostTypeId="1" AcceptedAnswerId="19622" CreationDate="2017-03-24T18:58:57.890" Score="3" ViewCount="976" Body="&lt;p&gt;I have a page, almost exactly the default Commerce &lt;code&gt;shipping.html&lt;/code&gt; template and flow. With just the default shipping method (Free), the user can simply click through without being required to select a shipping method. I've found how to use a Business Logic plugin to address required fields for the address/billing section, but there doesn't seem to be an &lt;code&gt;event&lt;/code&gt; I can hook to so I can yell and provide a flash error message if the user clicks &quot;Select Shipping Method&quot; without actually selecting one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can redirect back to the shipping method page on the payment page by checking the cart (ex: &lt;code&gt;{% if not cart.shippingMethod %}...&lt;/code&gt;) but this doesn't provide a flash error unless I use some hacky method like a GET string error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an event I can hook to I'm not finding in the docs that will let me force the choice of a shipping method? Or a setting in the plugin I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm close, here's my event code that isn't working as I expect it to (did I tell you I'm new to Craft yet?):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on( 'commerce_orders.onSaveOrder', function ( Event $event ) {&#xA;&#xA;        $order = $event-&amp;gt;params['order'];&#xA;&#xA;        if(craft()-&amp;gt;request-&amp;gt;getPost('validateShipping')){&#xA;&#xA;            // add error to shippingMethod and see if we can get it&#xA;            $order-&amp;gt;addError('shippingMethod',Craft::t('Please select a shipping option.'));&#xA;            $event-&amp;gt;performAction = false;&#xA;&#xA;            // pass a flash for testing &#xA;            craft()-&amp;gt;userSession-&amp;gt;setFlash('error', 'No shipping elected');&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this moves on to the payment page and doesn't return to the shipping page with the added error. However, I am able to retrieve the set flash message on the payment page but &lt;code&gt;{{ dump(cart.getErrors()) }}&lt;/code&gt; results in an empty array, so either the error is not attached to the cart properly in my event, or it is lost for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see I'm getting some up views; If anyone can still help I'd appreciate it. I have yet to get this working as per the only answer, and would love to know what I'm doing wrong in my Craft Commerce event.&lt;/p&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="5422" LastEditDate="2017-03-29T16:15:40.257" LastActivityDate="2017-03-29T16:15:40.257" Title="Require shipping method in Commerce order flow" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19622" PostTypeId="2" ParentId="19621" CreationDate="2017-03-25T01:00:23.927" Score="3" Body="&lt;p&gt;Ok, so shipping is not a necessity for a Commerce site (e.g. think about  e.g. digital downloads - shipping is not relevant here) - so Commerce does not force you to set a shipping method on an order.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's up to you to work out how and where you need to do this, if you do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot (most,even) of it is often best tackled at the front end via your flow and some JS and/or general form validation stuff - you don't allow the user to proceed/submit if they have not chosen a method when you need them to.  We actually do it all, pretty much, in this end of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, you CAN use any Commerce event you choose:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...to add some extra validation (as you have with the address fields).  But it really depends on your precise checkout flow as to how you'd implement this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your shipping page is POSTing to the Commerce controller &lt;code&gt;updateCart&lt;/code&gt; when it submits, you could perhaps listen to:&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onsaveorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onsaveorder&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and in that validate a shipping method is set (of course your order is saved many times during a commerce process so you should e.g. POST some other variable to check in there if you should actually trigger this validation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;validateShipping&quot; value=&quot;true&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then in your event handler&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if(craft()-&amp;gt;request-&amp;gt;getPost('validateShipping')){ ... validation here }&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is an error, then to add the error you'd add it to the model you retrieved as an event parameter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$order-&amp;gt;addError('shippingMethod','No shipping method supplied!');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..and to set a flash message&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash('error', 'No shipping selected');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....but there are MANY possible ways you can implement this (e.g. no server side validation at all, if you can handle it all at the front end) -&gt; the key thing is to really understand your checkout flow (and all the many ways users can travel through it) - quite thoroughly BEFORE you start implement the actual validation you need.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-25T01:00:23.927" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19623" PostTypeId="1" CreationDate="2017-03-25T06:27:57.093" Score="1" ViewCount="109" Body="&lt;p&gt;How can I display category name on template used in user-&gt;group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for restaurant in craft.users.username(userId) %}&#xA;    {{ restaurant.name }}&#xA;    {{ restaurant.addressLine1 }} {{ restaurant.addressLine2 }}&#xA;    --&#xA;    // display the category name which has been added in restaurant-&amp;gt;Group under Users&#xA;    --&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T19:55:36.077" LastActivityDate="2018-02-04T03:39:32.453" Title="Fetch category name" Tags="&lt;templating&gt;&lt;users&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19624" PostTypeId="1" AcceptedAnswerId="19633" CreationDate="2017-03-25T07:45:43.490" Score="1" ViewCount="604" Body="&lt;p&gt;I am currently trying to make it so when I have logged in on my website as a user it redirects to a certain page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However it is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried adding the following redirect in the configuration file however no luck: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'postLoginRedirect' =&amp;gt; 'profile/test'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any tips or suggestions will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6482" LastEditorUserId="505" LastEditDate="2017-03-25T14:54:07.320" LastActivityDate="2017-03-27T18:57:06.327" Title="Login redirect is not working" Tags="&lt;redirect&gt;&lt;login&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19625" PostTypeId="1" AcceptedAnswerId="19631" CreationDate="2017-03-25T07:58:57.687" Score="1" ViewCount="106" Body="&lt;p&gt;OK, setting up a production server (not live yet) and I am encountering a strange issue that I have not seen previously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue:&lt;/strong&gt;&#xA;Installed Craft on an Ubuntu 16.10 LAMP server. When all commands for installing were completed, I tested my site with its IP address to make sure everything worked and I got the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MNtEg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MNtEg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then when I got to &lt;code&gt;192.168.5.254/public/index.php/admin/install&lt;/code&gt; -- which has worked on the two test servers I have built previously -- I get this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sWLKV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sWLKV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An to make sure that I have tried another method of gaining access to the installer, I went here &lt;code&gt;192.168.5.254/admin&lt;/code&gt; which redirected to &lt;code&gt;192.168.5.254/admin/login&lt;/code&gt;, I get this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9EMiK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9EMiK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly Craft is working as these are not Apache 404's; however I never got the install screen at all. Just the homepage and login screen. Did I miss or mess something up during this specific install? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As usual, if you need additional information, let me know I will post it in here for visual use. Thank you very much for your assistance!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastActivityDate="2017-03-26T22:41:52.870" Title="No installer, but site is there?" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19626" PostTypeId="1" CreationDate="2017-03-25T11:05:35.113" Score="2" ViewCount="93" Body="&lt;p&gt;Even though I repeatedly downloaded the current Craft release, created a new host with a new root folder and a new database, installing Craft runs into the error &lt;code&gt;Could not find your craft/ folder etc ...&lt;/code&gt; when I try launch whateverdomain.dev/admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Followed the instructions step by step each and every time, applied the right permissions to each folder (and its contents).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of the earlier posts come up with a fix to this issue. Could this be a MAMP issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Richard&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qOQ7Y.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qOQ7Y.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6483" LastActivityDate="2017-03-25T11:05:35.113" Title="Another 'Could not find your craft/ folder' on fresh install" Tags="&lt;installation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19627" PostTypeId="1" CreationDate="2017-03-25T23:26:16.550" Score="2" ViewCount="112" Body="&lt;p&gt;I am trying to submit a guest entry it keeps returning a fatal error. This is my code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;success&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;profile&quot; value=&quot;3&quot;&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;&amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;&#xA;&amp;lt;label for=&quot;body&quot;&amp;gt;Body&amp;lt;/label&amp;gt;&#xA;&amp;lt;textarea id=&quot;body&quot; name=&quot;fields[body]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6482" LastActivityDate="2017-03-26T16:08:50.400" Title="I am unable to successfully submit guest entries" Tags="&lt;entries&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19628" PostTypeId="2" ParentId="19627" CreationDate="2017-03-26T16:08:50.400" Score="1" Body="&lt;p&gt;As per &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;the documentation&lt;/a&gt;, you need to include a hidden &lt;code&gt;sectionId&lt;/code&gt; field. This specifies the section to which the entry will be submitted.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-26T16:08:50.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19630" PostTypeId="2" ParentId="19623" CreationDate="2017-03-26T22:37:16.747" Score="1" Body="&lt;p&gt;If I'm following you, you've got restaurants set up as user accounts in Craft and you've got a category field assigned to the Users field layout and you're trying to access those categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, it's as simple as it is in the docs: &lt;a href=&quot;https://craftcms.com/docs/categories-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/categories-fields#templating&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = restaurant.categoryFieldHandle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will assign all of the categories to a variable named &lt;code&gt;category&lt;/code&gt;.  If you know there will only ever be one, then you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = restaurant.categoryFieldHandle.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-26T22:37:16.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19631" PostTypeId="2" ParentId="19625" CreationDate="2017-03-26T22:41:52.870" Score="1" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19625/no-installer-but-site-is-there#comment26508_19625&quot;&gt;André&lt;/a&gt; pointed out, you only need to run the installer if you need Craft to create all of the necessary tables in a blank database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've dumped your database from dev/staging and imported it into production, there is no need to run the installer, because the tables are already there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Craft sees someone try to load the installer on a site that already has a populated database like you have, it will return a 404.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-26T22:41:52.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19632" PostTypeId="1" CreationDate="2017-03-26T23:00:33.043" Score="2" ViewCount="101" Body="&lt;p&gt;I'm using the calendar demo templates that came with Solspace Calendar (&lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.month/&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation here&lt;/a&gt;). I've got a couple repeating events and I want to output the occurrence index (&lt;code&gt;Day 1&lt;/code&gt;, &lt;code&gt;Day 2&lt;/code&gt;, &lt;code&gt;Day 3&lt;/code&gt;, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code for the specific day:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in day.events %}&#xA;  &amp;lt;a href=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the docs, I'd think &lt;code&gt;occurrenceCount&lt;/code&gt; to work, but it returns &lt;code&gt;0&lt;/code&gt; for each event vs the index of the occurrence.&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2017-04-13T04:25:28.073" Title="How can I get the index of an occurrence in a repeating event on the calendar month view?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19633" PostTypeId="2" ParentId="19624" CreationDate="2017-03-27T00:16:51.470" Score="1" Body="&lt;p&gt;You can always set a path in the actual form as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/some/url&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just drop this field in the login form, assuming this is what you're using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/login-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2017-03-27T00:16:51.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19635" PostTypeId="1" CreationDate="2017-03-27T07:44:59.677" Score="1" ViewCount="159" Body="&lt;p&gt;I am trying to make my image grid form out dynamically. I got it kinda working, But I need to figure out how to make my grid rows dynamic. I am kinda forcing it to start a new row at every 4th item right now, but dossent feel like the right way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&quot;widewrapper weak-highlight&quot;&amp;gt; &amp;lt;!-- knappebilde start --&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;container content col-lg-12&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA; {% for entry in craft.entries.section('knapperForside').limit(50).find() %}        &#xA;            &amp;lt;div class=&quot;showroom-item col-md-3&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                    {{ entry.bilde }}&#xA;                    &amp;lt;!-- overlay start --&amp;gt;&#xA;                    &amp;lt;a class=&quot;overlay&quot; href=&quot;{{ entry.knappUrl }}&quot;&amp;gt;&#xA;                         &amp;lt;i class=&quot;glyphicons search&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                         &amp;lt;div class=&quot;name&quot;&amp;gt;{{ entry.title }}&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;!-- overlay stop --&amp;gt;&#xA;                &amp;lt;/div&amp;gt;  &amp;lt;!-- Image Stop --&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.title }}&quot;&amp;gt;&amp;lt;h4&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;  {% endfor %}           &#xA;         &amp;lt;/div&amp;gt;      &amp;lt;!--  row stop  --&amp;gt;&#xA;    &amp;lt;/div&amp;gt;          &amp;lt;!-- Container Stop --&amp;gt;        &#xA;&#xA;        &amp;lt;div class=&quot;clearfix&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;     &amp;lt;!-- knappebilde stop --&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6394" LastActivityDate="2017-03-28T08:36:11.033" Title="Need help with dynamic image grid" Tags="&lt;assets&gt;&lt;entry&gt;&lt;structure&gt;&lt;bootstrap-craft&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19636" PostTypeId="1" CreationDate="2017-03-27T09:55:54.237" Score="2" ViewCount="145" Body="&lt;p&gt;I've just rolled out some changes to a site that's now seeing a big increase in (front end) user sign ups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have activation by email on and I'm tracking in analytics the number of hits to the activation success and activation failed pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look at yesterday as an example, 168 Success and 15 Failed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to start working on bringing this down, but it would be useful to know the scenarios that would cause a user to hit the failed page. I believe they'll get this if they, for example, click the activation email twice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other obvious causes that I use as a starting point?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2017-03-27T10:25:38.933" LastActivityDate="2017-03-27T12:35:55.527" Title="What would cause a user's activation link to fail?" Tags="&lt;users&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19637" PostTypeId="1" AcceptedAnswerId="19641" CreationDate="2017-03-27T10:17:42.190" Score="2" ViewCount="607" Body="&lt;p&gt;I have a navigation structure as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set page = entry ?? category ?? null %}&#xA;&#xA;&amp;lt;ul class=&quot;nav menu--main&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;&#xA;        &amp;lt;li class=&quot;menu__item{% if page and page.id == entry.id %} is-current{% endif %}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;a {% if entry.type == 'noLink' %}href=&quot;&quot;{% else %}href=&quot;{{ entry.url }}&quot;{% endif %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul class=&quot;nav menu--submenu__wrapper&quot;&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I have an &lt;code&gt;entry.type&lt;/code&gt; called &quot;No link&quot; which means that the user doesn't want the parent page to have a page of it's own, yet it still needs to appear in the nav to give context to the children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is; how can I get the first child's URL within the &lt;code&gt;ifchildren&lt;/code&gt; tags so I can make the parent automatically redirect to the first child's page in the navigation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to do this in regular forloops, but it would be nice to do this within Craft's &lt;code&gt;nav&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Jay&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2017-03-27T14:28:13.027" Title="How to get first child URL within Craft/Twig Nav tags" Tags="&lt;navigation&gt;&lt;forloop&gt;&lt;loop&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19638" PostTypeId="1" CreationDate="2017-03-27T10:39:47.803" Score="4" ViewCount="259" Body="&lt;p&gt;I'm working on a plugin called &lt;code&gt;modelselector&lt;/code&gt; and I want to use a template stored in the plugin &lt;code&gt;templates&lt;/code&gt; folder but it should be shown on the front-end of the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the following direct URL works for me:&#xA;&lt;code&gt;actions/modelSelector/showSelection/40c86a9b-53ec-43f4-8e8b-7c77ee0a13f5&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also set up a site route like so:&#xA;&lt;code&gt;'modelselector/(?P&amp;lt;selectionUid&amp;gt;[^\/]+)' =&amp;gt; array('action' =&amp;gt; 'modelSelector/showSelection')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I go to: &lt;code&gt;modelselector/40c86a9b-53ec-43f4-8e8b-7c77ee0a13f5&lt;/code&gt; I get the error: &lt;code&gt;Unable to find the template “modelselector/show”.&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some research and found that I need to set the template mode using: &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;setTemplateMode(TemplateMode::CP);&lt;/code&gt;. But this doesn't seem to work for me. It still can't find the template when the TemplateMode is on &lt;code&gt;CP&lt;/code&gt; or &lt;code&gt;Site&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5906" LastEditorUserId="57" LastEditDate="2017-03-27T16:55:58.533" LastActivityDate="2017-03-27T16:55:58.533" Title="Using plugin template on front end" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19639" PostTypeId="2" ParentId="19636" CreationDate="2017-03-27T12:35:55.527" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;They could already be active Users&lt;/li&gt;&#xA;&lt;li&gt;Their activation link could have timed out&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;1) happens more often than I'd think, people try using it as a way of &quot;getting to the site again&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Can be controlled in /config/general.php - &lt;a href=&quot;https://craftcms.com/docs/config-settings#verificationCodeDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#verificationCodeDuration&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-03-27T12:35:55.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19640" PostTypeId="2" ParentId="19635" CreationDate="2017-03-27T13:35:31.640" Score="1" Body="&lt;p&gt;To add a row at every 4th item, you can use twig's batch filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/2.x/filters/batch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Batch&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively(a little more hacky) you can do &lt;code&gt;{% if loop.index is divisible by(4) %} stuff {% endif %}&lt;/code&gt;. But batch is probably better.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-03-27T13:35:31.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19641" PostTypeId="2" ParentId="19637" CreationDate="2017-03-27T14:28:13.027" Score="2" Body="&lt;p&gt;In that case you can put this in the &lt;code&gt;href&lt;/code&gt; value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.descendants.type('page').first.url ?? '' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Replace &lt;code&gt;page&lt;/code&gt; with the other entry type handle(s).)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-27T14:28:13.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19642" PostTypeId="2" ParentId="19615" CreationDate="2017-03-27T14:31:58.617" Score="2" Body="&lt;p&gt;Assuming you want the folders to be named after the users' IDs (since they won't change), the subpath should be &lt;code&gt;{id}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-03-27T14:31:58.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19643" PostTypeId="2" ParentId="19611" CreationDate="2017-03-27T16:20:49.600" Score="2" Body="&lt;p&gt;You'll need to add the styling via &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/manipulating-the-map-in-javascript/&quot; rel=&quot;nofollow noreferrer&quot;&gt;JavaScript...&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;smartMap.map['smartmap-mapcanvas-1'].setOptions({styles: styles});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This can't currently be done in Twig, although I may explore that option in the future.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:50:22.533" LastActivityDate="2021-01-01T06:50:22.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19644" PostTypeId="1" CreationDate="2017-03-27T16:46:27.813" Score="2" ViewCount="63" Body="&lt;p&gt;I am not sure what I have done wrong, I am working with a fresh install of &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I create a new form and then click &quot;Add Field&quot; in the layout designer, this is what I am seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0npZd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0npZd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-03-28T05:01:04.733" Title="How can I add fields to my Sprout Form plugin?" Tags="&lt;plugin-development&gt;&lt;plugin-sproutforms&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19645" PostTypeId="1" CreationDate="2017-03-27T17:09:00.930" Score="1" ViewCount="35" Body="&lt;p&gt;We're developing a new site using Craft. When I'm at work I can save all the work I have done on the site fine. But when I'm at home (using BT broadband), my ability to save any edits I make to the site is very patchy - sometimes it works O.K., more often than not I get the following error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The site can't be reached; The connection was re-set&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've tried using Chrome and Firefox - but same thing happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?  I'm not a web-expert so answers in layman's terms much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6492" LastEditorUserId="22" LastEditDate="2017-05-09T19:55:05.453" LastActivityDate="2017-05-09T19:55:05.453" Title="Can't save work/edits to Craft," Tags="&lt;error-message&gt;&lt;error&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19646" PostTypeId="1" CreationDate="2017-03-27T17:50:00.003" Score="2" ViewCount="112" Body="&lt;p&gt;Is there a way to assign category permissions to users so that they can only view/edit those categories? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently looking at the following &lt;code&gt;getEditableSections()&lt;/code&gt;, however, it's displaying all categories despite only assigning the user to a specific section. I have provided an example below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Section Alpha&lt;/strong&gt;&#xA;- Category A&#xA;- Category B&#xA;- Category C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Section November&lt;/strong&gt;&#xA;- Category 1&#xA;- Category 2&#xA;- Category 3 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: User John needs to access (view and edit) only Category B in Section Alpha. &lt;/p&gt;&#xA;" OwnerUserId="4803" LastActivityDate="2017-03-27T17:50:00.003" Title="Assigning category permissions to users" Tags="&lt;users&gt;&lt;category&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19647" PostTypeId="2" ParentId="19624" CreationDate="2017-03-27T18:57:06.327" Score="2" Body="&lt;p&gt;Thanks guys. I solved it.&#xA;The issue was that I was logging in as the admin not an ordinary user.&lt;/p&gt;&#xA;" OwnerUserId="6482" LastActivityDate="2017-03-27T18:57:06.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19648" PostTypeId="1" CreationDate="2017-03-27T21:37:38.243" Score="1" ViewCount="97" Body="&lt;p&gt;I am building a baseball standings table.&#xA;I currently have a Single section setup in Craft to handle some basic info.&#xA;It contains a table field with 3 rows: Team, Wins and Losses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to output this info via the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for records in standings %}&#xA;    {% for row in records.southStandings %}&#xA;        &amp;lt;tr&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.team }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.wins }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.losses }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.wins + row.losses }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ (row.wins / (row.wins + row.losses))|round(3, 'common') }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E4Hjo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E4Hjo.png&quot; alt=&quot;standings table&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am needing to do a few things for these standings.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Needing to sort the teams via their winning percentage (W%), if W% is same then alphabetically.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The W% is calculated this way:&#xA;&lt;code&gt;{% set wP = (team.wins / (team.wins + team.losses))|round(3, 'common') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Calculate the games behind (GB).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Games behind is another equation, like so:&#xA;&lt;code&gt;{% set gamesBackA = ((teamA.wins - teamB.wins) + (teamB.losses - teamA.losses)) / 2 %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GB is how far back teams are from the leading team (1st place).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not even sure how I would set this and output the correct number at all, so any guidance on this would be wonderful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried setting an new empty array before my for loop and setting it within the loop. But the only way it outputs more than won W% number in that array is another for loop, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set standings = craft.entries.section('standings') %}&#xA;{% set wPArray = [] %}&#xA;&#xA;{% for teams in standings %}&#xA;    {% for team in teams.southStandings %}&#xA;        {% set wP = (team.wins / (team.wins + team.losses))|round(3, 'common') %}&#xA;        {% set wPArray = wPArray|merge([wP]) %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{% for t in wPArray %}&#xA;    {{ t }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can then sort using SuperSort but that doesn't allow me to output the Team, Wins, Losses, Games Played (GP), and Games Back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing with the arrays?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best approach to output the table, sort them by W%/alphabetically and calculate Games Back as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have the SuperSort plugin installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help with this would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6371" LastEditorUserId="57" LastEditDate="2017-03-27T21:58:41.483" LastActivityDate="2017-03-27T21:58:41.483" Title="Create a baseball standings table" Tags="&lt;array&gt;&lt;plugin-supersort&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19649" PostTypeId="1" CreationDate="2017-03-27T22:31:39.843" Score="1" ViewCount="27" Body="&lt;p&gt;I found this useful search, sort and filter script &lt;a href=&quot;http://jplist.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jplist.com&lt;/a&gt;, which I have added to my website. It works perfectly until I realize that when my database grow to the point it slow the page down. I am on the fence whether use Craft's &lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&lt;/code&gt; or jplist's data source to fetch the entries from the database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion what the best safest approach?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastEditorUserId="57" LastEditDate="2017-03-27T23:01:33.330" LastActivityDate="2017-03-27T23:01:33.330" Title="Add jplist script to Craft CMS" Tags="&lt;templating&gt;&lt;jquery&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19651" PostTypeId="1" AcceptedAnswerId="19733" CreationDate="2017-03-28T01:40:05.767" Score="3" ViewCount="183" Body="&lt;p&gt;I'm using Solspace Calendar for Craft CMS for an upcoming project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client has asked if they can initially import all of their events from an .ics file from Outlook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see anything in the docs. It doesn't appear to be a feature, however has anyone else come up with a solution to this? I'm sure it's not the first time it's been asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-04-20T21:15:17.710" Title="Solspace Calendar For Craft CMS - Importing ICS Files" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19654" PostTypeId="1" CreationDate="2017-03-28T07:30:18.443" Score="3" ViewCount="1520" Body="&lt;p&gt;I am trying to migrate blog posts from WordPress to Craft CMS through the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I export posts in .xml file from Wordpress. Then, I import in Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All things are good except the category and tags. It imports the category and tags from .xml file but it is not able to separate the category and tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the few code of category and tags means how it look in .xml &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;computer&quot;&amp;gt;&amp;lt;![CDATA[computer]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;corporate&quot;&amp;gt;&amp;lt;![CDATA[corporate]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;employee&quot;&amp;gt;&amp;lt;![CDATA[employee]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;expert&quot;&amp;gt;&amp;lt;![CDATA[expert]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;forensics&quot;&amp;gt;&amp;lt;![CDATA[Forensics]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;category domain=&quot;category&quot; nicename=&quot;forensics&quot;&amp;gt;&amp;lt;![CDATA[Forensics]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;category&quot; nicename=&quot;infosec-training&quot;&amp;gt;&amp;lt;![CDATA[InfoSec Training]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;warlock&quot;&amp;gt;&amp;lt;![CDATA[warlock]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&amp;lt;category domain=&quot;post_tag&quot; nicename=&quot;witness&quot;&amp;gt;&amp;lt;![CDATA[witness]]&amp;gt;&amp;lt;/category&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also the screen shot of mapping and and how it looks in section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mapping&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kLm1U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kLm1U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section View&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Idr7y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Idr7y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I separate these?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6497" LastEditorUserId="22" LastEditDate="2017-05-09T19:54:11.480" LastActivityDate="2017-05-09T19:54:11.480" Title="Migrating from WordPress to Craft CMS" Tags="&lt;craft-pro&gt;&lt;import&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19655" PostTypeId="2" ParentId="19635" CreationDate="2017-03-28T08:36:11.033" Score="0" Body="&lt;p&gt;Thanks for the replys! after doing some reading on bootstrap docs, it seems it was somewhat the right way to do it. But I had to do some changes in the way I refered to the images&lt;/p&gt;&#xA;" OwnerUserId="6394" LastActivityDate="2017-03-28T08:36:11.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19656" PostTypeId="1" CreationDate="2017-03-28T12:07:43.327" Score="2" ViewCount="109" Body="&lt;p&gt;I just noticed that none of my recent changes in an entry don't show up in the entry-versions button in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible that these entry versions are triggered by the task runner? Because I lately disabled it &lt;code&gt;'runTasksAutomatically' =&amp;gt; false,&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a second locale to the entries and since then, the versions don't show up anymore?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2017-03-28T12:16:29.457" LastActivityDate="2017-11-24T00:47:35.280" Title="Entry Versions not showing up" Tags="&lt;entry-versions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19657" PostTypeId="1" CreationDate="2017-03-28T13:46:29.413" Score="3" ViewCount="249" Body="&lt;p&gt;I have a matrix field with a category field. I need to group these matrix items by category and give them headings which I'll use for tabs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I'd do it for entries but is it possible for matrix?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;tabs&quot;&amp;gt;&#xA;    {% nav category in craft.categories.group('otherAppliances') %}&#xA;&#xA;    {% set itemCount = craft.entries.relatedTo(category).total() %}&#xA;        {% if itemCount %}&#xA;&#xA;            &amp;lt;li rel=&quot;&quot;&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;&#xA;        {% endif %}&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think my question may be similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2524/how-to-query-with-relatedto-of-a-relationship-field-in-a-matrix-field-block&quot;&gt;How to query with relatedTo of a Relationship Field in a Matrix Field block&lt;/a&gt; but I can't get my head around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matrix setup:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iNUGO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iNUGO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="5845" LastEditDate="2018-08-20T16:09:02.260" LastActivityDate="2018-08-20T16:09:02.260" Title="Categories within matrix for relatedTo" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19658" PostTypeId="1" AcceptedAnswerId="22436" CreationDate="2017-03-28T15:59:34.080" Score="3" ViewCount="172" Body="&lt;p&gt;Is there any way to make the Assets folder also show the first sub folder level by default, like in the attached screenshot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/taDuA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/taDuA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-10-18T11:11:06.067" Title="Assets folder first level open by default" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19659" PostTypeId="1" CreationDate="2017-03-28T16:28:06.750" Score="3" ViewCount="223" Body="&lt;p&gt;Finally making progress into a production environment (&lt;strong&gt;Pro license installed&lt;/strong&gt;) and I see that the SEOMATIC has an update - 1.1.45 - I followed the &lt;a href=&quot;https://github.com/nystudio107/seomatic/blob/master/DOCS.md#installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;instructions&lt;/a&gt; but am lost, as SEOMATIC is already installed in my instance of Craft; instructions want me to install it...is there a step I am missing to get this update complete?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know what I am I missing here -- thank you a ton! =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit @10:00 03/29/2017&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you everyone for your answers! =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am reading all the comments/answers correctly, I should do the following:&lt;br&gt;&#xA;&lt;code&gt;rm -R /var/www/html/craft/plugins/seomatic&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;cp -rv /home/psa/Zips/seomatic /var/www/html/craft/plugins&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;service apache2 restart&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct? Thanks again for the assistance here!&lt;/p&gt;&#xA;" OwnerUserId="6286" LastEditorUserId="6286" LastEditDate="2017-03-29T17:02:34.923" LastActivityDate="2017-03-29T17:02:34.923" Title="SEOMATIC v1.1.45 install" Tags="&lt;plugins&gt;&lt;upgrades&gt;&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19660" PostTypeId="2" ParentId="19659" CreationDate="2017-03-28T17:46:04.673" Score="5" Body="&lt;p&gt;To update plugins like SeoMatic, just download the latest (either clicking on the direct download link from the /admin/updates/ page in your admin area or from github).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you just then need to upload the new folder, overwriting the old one, to your server in the /craft/plugins directory (make sure you rename the download to seomatic as before, removing the '-master' that github adds).&lt;/p&gt;&#xA;" OwnerUserId="3941" LastActivityDate="2017-03-28T17:46:04.673" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19661" PostTypeId="2" ParentId="19659" CreationDate="2017-03-28T17:52:57.750" Score="2" Body="&lt;p&gt;Craft is going to have a better update system in a version 3. With Seomatic you can also be able to update via composer. As far as I know.&lt;/p&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="6229" LastEditDate="2017-03-28T21:31:34.660" LastActivityDate="2017-03-28T21:31:34.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19664" PostTypeId="2" ParentId="19656" CreationDate="2017-03-28T20:39:26.983" Score="2" Body="&lt;p&gt;Entry versions aren't managed by tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you've got &quot;Enable versioning for entries in this section?&quot; unchecked for that section's settings in the control panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-28T20:39:26.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19665" PostTypeId="2" ParentId="19654" CreationDate="2017-03-28T23:06:12.897" Score="2" Body="&lt;p&gt;Feed Me currently doesn't support this, as sometimes your data is contained in attributes, so it needs to be able to access that. Crucially, the tags are the same value, which is what trips things up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you looked at the Wordpress to Craft guide? &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/guides/migrating-from-wordpress&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sgroup.com.au/plugins/feedme/guides/migrating-from-wordpress&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-03-28T23:06:12.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19666" PostTypeId="1" CreationDate="2017-03-29T04:57:43.467" Score="1" ViewCount="81" Body="&lt;p&gt;I'm trying to access the value set for my optimized title within Sprout SEO. I've had a read through this page: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/custom-metadata-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/custom-metadata-variable&lt;/a&gt; - but have had no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I want to do this is because I'm loading my pages via AJAX and need to set the title once the content is loaded. I've tried various iterations of &lt;code&gt;{{ entry.metadata.metadata.optimizedTitle }}&lt;/code&gt; but to no avail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternately, do you know how to set the metadata to update upon each AJAX page load?&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-04-03T18:55:28.927" Title="Access optimizedTitle field within Twig template" Tags="&lt;ajax&gt;&lt;plugin-sproutseo&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19667" PostTypeId="2" ParentId="5032" CreationDate="2017-03-29T05:18:42.693" Score="2" Body="&lt;p&gt;Drafts store rows in the &lt;code&gt;craft_entrydrafts&lt;/code&gt; table, relating to an entry, providing some context (author, date, notes), and serializing all the pending content into a data column. Craft normally gets drafts only as they relate to a specific entry, so you'll need to provide your own method of retrieving them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EntryRevisionsService class has a method called getDraftsByEntryId(), which can be modified slightly to return all those draft records rather than ones limited specifically to a given entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntryDrafts($localeId = null)&#xA;{&#xA;    if (!$localeId)&#xA;    {&#xA;        $localeId = craft()-&amp;gt;i18n-&amp;gt;getPrimarySiteLocale();&#xA;    }&#xA;&#xA;    $drafts = array();&#xA;&#xA;    $results = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('*')&#xA;        -&amp;gt;from('entrydrafts')&#xA;        -&amp;gt;where(array('locale = :locale'), array(':locale' =&amp;gt; $localeId))&#xA;        -&amp;gt;order('dateUpdated desc')&#xA;        -&amp;gt;queryAll();&#xA;&#xA;    foreach ($results as $result)&#xA;    {&#xA;        $result['data'] = JsonHelper::decode($result['data']);&#xA;&#xA;        // Don't initialize the content&#xA;        unset($result['data']['fields']);&#xA;&#xA;        $drafts[] = EntryDraftModel::populateModel($result);&#xA;    }&#xA;&#xA;    return $drafts;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each result will be an EntryDraftModel, so use the &lt;code&gt;draftId&lt;/code&gt; parameter if you'd like to link directly to that draft as you'd normally see it in the control panel. In a Twig template, for example, that'd look like &lt;code&gt;{{ draft.cpEditUrl ~ &quot;/drafts/&quot; ~ draft.draftId }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-03-29T05:32:51.137" LastActivityDate="2017-03-29T05:32:51.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19668" PostTypeId="1" CreationDate="2017-03-29T07:07:19.757" Score="2" ViewCount="72" Body="&lt;p&gt;I am including a sprout form on my template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{{ craft.sproutForms.displayForm('myForm') }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am submitting the form via ajax, and when the form is submitted I am trying to set the recipient in Sprout Email to the form's container author.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{author.email}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's not the author of the submitted form/entry, it's the author of the entry that the form is sitting on that I'm trying to access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd really like to avoid passing in an email from a hidden input if at all possible. Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I am on the page &lt;code&gt;a.html&lt;/code&gt; which  has an author of &lt;code&gt;damon@email.com&lt;/code&gt;. On &lt;code&gt;a.html&lt;/code&gt; there is a contact form. When a user submits the contact form, I want a confirmation email sent tothem, and then an email sent to the author of the entry that the contact form is on. The same contact form can live on any page, and each page could have different authors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;a.html&lt;/code&gt; has an author of &lt;code&gt;damon@email.com&lt;/code&gt;&#xA;&lt;code&gt;b.html&lt;/code&gt; has an author of &lt;code&gt;foo@email.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above case, a confirmation email needs to go whomever filled out the form, and then a notification email to each of the entries respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting closer I think, but struggling to dynamically set the recipient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% set form = craft.sproutForms.form('myForm') %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entry&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;author&quot; value=&quot;{{ entry.author.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my plugin I am doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('sproutForms.onBeforeSaveEntry', function (Event $event) {&#xA;    if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {&#xA;        if (craft()-&amp;gt;request-&amp;gt;getPost('author') != '') {&#xA;            $owner = craft()-&amp;gt;users-&amp;gt;getUserById(craft()-&amp;gt;request-&amp;gt;getPost('author'));&#xA;&#xA;            if ($owner) {&#xA;                if ($event-&amp;gt;params['isNewEntry']) {&#xA;                    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;                    $entry-&amp;gt;setContentFromPost(array(&#xA;                        'ownerEmail' =&amp;gt; $owner-&amp;gt;email, // damon@email.com&#xA;                    ));&#xA;&#xA;                   // Set {ownerEmail} as recipient in notification?&#xA;                }&#xA;            }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my ajax response I am seeing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&quot;errors&quot;:[]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;sproutemail.log&lt;/code&gt; I am seeing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [plugin] No recipients found.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the recipient field I have tried &lt;code&gt;{ownerEmail}&lt;/code&gt; and &lt;code&gt;{object.ownerEmail}&lt;/code&gt; both having no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried setting field values just in the off chance...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutForms.addFieldVariables({ entry: entry }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The whole purpose of this is that I am trying to avoid putting a person's email in a hidden input. Just so that if a user of the site viewed the source the author's email wasn't right out in the open.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-03-30T11:12:04.860" LastActivityDate="2019-02-19T14:45:29.590" Title="How can I get the parent author from sprout forms to send to sprout mail?" Tags="&lt;plugin-development&gt;&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19670" PostTypeId="1" AcceptedAnswerId="19906" CreationDate="2017-03-29T10:05:19.480" Score="2" ViewCount="1508" Body="&lt;p&gt;I'm trying to set Mailgun up on Craft (Like we've done plenty of times before) but each time it keeps saying that the connection to SMTP is failing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I'm getting is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2017/03/29 09:54:13 [error] [application] Email error: SMTP Error: Could not authenticate.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've checked &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-errors&lt;/a&gt; and error description is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“Use SMTP authentication” was checked, but the credentials were incorrect.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I've double checked these details over 10x now and they are 100% correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other reason this could fail? We're using port &lt;code&gt;587&lt;/code&gt; and tried other ports but no success. Even opening these ports on the server doesn't connect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where would the problem be... Craft, Mailgun or Server?&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-04-29T14:24:39.533" Title="Mailgun (SMTP) + Craft" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19672" PostTypeId="2" ParentId="14990" CreationDate="2017-03-29T11:54:39.893" Score="1" Body="&lt;p&gt;If someone still is looking for an answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block locale__switch %}&#xA;    {# Loop through all of the site locales #}&#xA;    {% set otherLocales = craft.i18n.getSiteLocaleIds() %}&#xA;&#xA;    {% for locale in otherLocales %}&#xA;&#xA;        {# Check if site is category or Entry #}&#xA;        {% if category is defined %}&#xA;            {% set siteLocale = category.locale(locale) %}&#xA;        {% elseif entry is defined %}&#xA;            {% set siteLocale = craft.entries.id(entry.id).locale(locale).first %}&#xA;        {% endif %}&#xA;&#xA;        {# Make sure that it's actually localized to this locale #}&#xA;        {% if siteLocale.locale == locale %}&#xA;&#xA;            {# Output a link to it #}&#xA;            &amp;lt;a href=&quot;{{ siteLocale.getUrl() }}&quot; class=&quot;text-uppercase {% if craft.locale == siteLocale.locale %}active{% endif %}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;{% if not loop.last %} |{% endif %}&#xA;        {% else %}&#xA;&#xA;            {# Output a link to the hompage #}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot;&amp;gt;{{ locale }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6507" LastEditorUserId="57" LastEditDate="2017-03-29T15:16:04.543" LastActivityDate="2017-03-29T15:16:04.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19673" PostTypeId="1" AcceptedAnswerId="20207" CreationDate="2017-03-29T12:45:13.177" Score="1" ViewCount="242" Body="&lt;p&gt;I tried to build JSON-API which returns all categories, whose result will be cascaded like &quot;nav&quot; tag with craft twig templating (see: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.categories&lt;/a&gt; ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to get all root categories (which has no parent category, and which can have child categories), I've tried to filter giving within &quot;criteria&quot; something like that, but the result was just returned all categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/categories' =&amp;gt; [&#xA;        'elementType' =&amp;gt; ElementType::Category,&#xA;        'criteria' =&amp;gt; [ 'descendantOf' =&amp;gt; null ],&#xA;        'transformer' =&amp;gt; function($entry) {&#xA;            return [&#xA;                'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'parent' =&amp;gt; ($entry-&amp;gt;parent) ? $entry-&amp;gt;parent-&amp;gt;id : null,&#xA;                'children' =&amp;gt; ($entry-&amp;gt;children) ?&#xA;                    children_in_array($entry-&amp;gt;children) : null,&#xA;            ];&#xA;        },&#xA;    ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;function &lt;strong&gt;children_in_array()&lt;/strong&gt; returns same structure like result of 'transformer' function (id, title, parent, children).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get only root categories in this way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or is there other solution all cascaded category list in JSON format?&lt;/p&gt;&#xA;" OwnerUserId="6508" LastActivityDate="2017-04-26T12:34:32.740" Title="how can I filter to get only root categories in elementapi.php" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19674" PostTypeId="1" CreationDate="2017-03-29T13:18:24.510" Score="1" ViewCount="84" Body="&lt;p&gt;I installed the plugin for Apple News (&lt;a href=&quot;https://github.com/pixelandtonic/AppleNews&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/AppleNews&lt;/a&gt;) but did not understand the configuration instructions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a file at &lt;code&gt;craft/config/applenews.php&lt;/code&gt; with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;'channels' =&amp;gt; [&#xA;    [&#xA;        'class'     =&amp;gt; 'applenewschannels.MyNewsChannel',&#xA;        'channelId' =&amp;gt; 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',&#xA;        'apiKeyId'  =&amp;gt; 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',&#xA;        'apiSecret' =&amp;gt; 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',&#xA;    ],&#xA;  ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a &lt;code&gt;craft/applenewschannels&lt;/code&gt; folder and added &lt;code&gt;MyNewsChannel.php&lt;/code&gt; and &lt;code&gt;MyNewsArticle.php&lt;/code&gt; but the “Apple News Channels” pane has not appeared on the edit entry page. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="6509" LastEditorUserId="57" LastEditDate="2017-03-29T15:17:10.007" LastActivityDate="2017-11-20T20:03:44.537" Title="Configuring Apple News" Tags="&lt;plugin-applenews&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19676" PostTypeId="1" AcceptedAnswerId="20719" CreationDate="2017-03-29T13:40:07.383" Score="3" ViewCount="503" Body="&lt;p&gt;Our site makes use of gifs to enable the client to upload basic animating images. Any asset field on the site can be jpg, png or gif, and the site makes significant use of transforms for responsive imagery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforms for jpgs and pngs are working fine, but the gif transforms are coming out &lt;em&gt;huge&lt;/em&gt; (significantly bigger than the original file size), and at the point of transform generation, the server is grinding almost to a halt, with most of the &lt;code&gt;Generating pending image transforms&lt;/code&gt; tasks eventually stalling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Natural: 2.4MB&lt;/li&gt;&#xA;&lt;li&gt;400px Constrain: 4.3MB&lt;/li&gt;&#xA;&lt;li&gt;800px Constrain: 19.2MB&lt;/li&gt;&#xA;&lt;li&gt;1200px / 1600px / 2400px Constrain: Failed &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Natural: 5.4MB&lt;/li&gt;&#xA;&lt;li&gt;None of the transforms for this seem to be being created now (I previously had to remove it because of the detrimental effect of the transform process on the server but have just tried re-uploading and visiting the page), but one of these was something like 37MB!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Technical Details:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 2.6.2967&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;imageDriver&lt;/code&gt; is set to &lt;code&gt;imagick&lt;/code&gt; (which is reported to be available under Utilities / Server Info)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;defaultImageQuality&lt;/code&gt; is set to &lt;code&gt;70&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;PHP Memory Limit is set to 256MB (had previously been 512MB, which may explain why none of the transforms for Image 2 are being created any more)&lt;/li&gt;&#xA;&lt;li&gt;PHP Max Execution Time is set to 90 seconds&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2314" LastEditorUserId="2314" LastEditDate="2017-03-29T13:51:13.947" LastActivityDate="2017-06-06T09:43:41.820" Title="Why are gif transform file sizes very large?" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;gif&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19677" PostTypeId="2" ParentId="19670" CreationDate="2017-03-29T15:08:30.907" Score="5" Body="&lt;p&gt;Craft is just passing on the error message it gets back when trying to connect with whatever settings it was given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And we're using Mailgun ourselves (port 587) for sending emails on &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com&lt;/a&gt;, which is a Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you're using &lt;code&gt;smtp.mailgun.org&lt;/code&gt; as the host and that you've got the transport type set to &lt;code&gt;TLS&lt;/code&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-29T15:08:30.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19678" PostTypeId="1" AcceptedAnswerId="19679" CreationDate="2017-03-29T15:10:56.623" Score="1" ViewCount="709" Body="&lt;p&gt;Just adding hreflang tags to the head on all pages of my multi-locale site...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in craft.i18n.getSiteLocales() %}&#xA;    &amp;lt;link rel=&quot;alternate&quot; href=&quot;{{ entry.url }}&quot; hreflang=&quot;{{ locale }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nearly there, but obviously this outputs my list of locales with the entry url for the &lt;em&gt;current locale&lt;/em&gt; only. What I need is to output the entry url for &lt;em&gt;each locale&lt;/em&gt;. Anyone done this before?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2017-03-29T15:49:49.640" Title="Output Locale URLs in hreflang" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19679" PostTypeId="2" ParentId="19678" CreationDate="2017-03-29T15:49:49.640" Score="2" Body="&lt;p&gt;Have you tried using &lt;code&gt;{{ craft.entries.id(entry.id).locale(locale.id).first().url }}&lt;/code&gt; inside the for loop you have made?&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-03-29T15:49:49.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19680" PostTypeId="2" ParentId="17803" CreationDate="2017-03-29T18:46:55.783" Score="1" Body="&lt;p&gt;You have to unset the &lt;code&gt;receipt_email&lt;/code&gt; value when sending the request to Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I packaged the solution up as a small plugin: &lt;a href=&quot;https://superbig.co/plugins/disable-stripe-receipts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/disable-stripe-receipts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-03-29T18:46:55.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19681" PostTypeId="1" AcceptedAnswerId="19682" CreationDate="2017-03-29T20:06:21.650" Score="4" ViewCount="1101" Body="&lt;p&gt;How do I update the lineItems after I submit the form through ajax? right now it adds the item, but it doesn't show up in the cart, it only shows up when I reload the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am adding an item to the cart through ajax with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.form-products').on('submit', function(e) {&#xA;&#xA;    e.preventDefault();&#xA;&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.ajax({&#xA;        type: 'POST',&#xA;        data: data,&#xA;        url: '/',&#xA;        success: function(response) {&#xA;            var cartCount = '(' + response.cart.totalQty + ')';&#xA;            $('.cart-count').text(cartCount);&#xA;&#xA;            $('#cart').removeClass('close');&#xA;        },&#xA;        error: function(response) {&#xA;            console.log(response);&#xA;        }&#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then under the  &lt;code&gt;div#cart&lt;/code&gt; I have this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in cart.lineItems %}&#xA;   &amp;lt;li&amp;gt;&#xA;     cart information goes here&#xA;     this shows the product images, price and other info.&#xA;   &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6510" LastActivityDate="2017-03-30T00:02:13.300" Title="Update cart lineItems through ajax" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19682" PostTypeId="2" ParentId="19681" CreationDate="2017-03-30T00:02:13.300" Score="4" Body="&lt;p&gt;There are two major approaches.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The easier approach is to create a partial template that displays the cart lineItems, and simply ajax &lt;code&gt;load&lt;/code&gt; that template in to a div that is your cart display after you've done the lineItem update.  However, this has the disadvantage of making the whole cart section update in a visible way, which look a lot less finessed than the second approach.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In  short, you'll need to use the cart object in the json response to re-draw just the appropriate parts of your cart display.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's an example of approach 2, (don't focus on the specifics below which are from a live site - but rather this should be enough to give you the idea) - if the user e.g. adjusts line item quantities, we grab the appropriate parts of &lt;code&gt;response.cart&lt;/code&gt; and then do some local calculations and update the appropriate parts of the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            $.post('/actions/' + $('input[name=action]').val(), form.serialize(), function(response) {&#xA;&#xA;            // Change in qty successful&#xA;            if (response.success) {&#xA;                if (response.cart.lineItems[id]) {&#xA;                    var subtotalNew = parseFloat(response.cart.lineItems[id].price * response.cart.lineItems[id].qty);&#xA;                    utilities.replacePrice($subtotal, subtotalNew);&#xA;                }&#xA;&#xA;                navCart.update(response.cart);&#xA;                cart.update(response.cart, true);&#xA;            }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...where, for example, &lt;code&gt;utilities.replacePrice&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;replacePrice: function($obj, price, discount) {&#xA;    var text = module.exports.currency(price);&#xA;&#xA;    // Handle discounts&#xA;    if (discount) {&#xA;        // Supplied as negative number - because we want it formatted differently, we make it positive&#xA;        var discountPrice = module.exports.currency(price * -1);&#xA;        text = '- (' + discountPrice + ')';&#xA;    }&#xA;&#xA;    $obj.fadeOut(&quot;fast&quot;, function(){&#xA;        $obj.text( text );&#xA;        $obj.fadeIn(&quot;fast&quot;);&#xA;    });&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and the &lt;code&gt;cart.update&lt;/code&gt; functions are similar and take care of updating the nav bar cart and the totals and shipping sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will warn you that implementing in full a completley ajax updating cart page is a fair bit of work and complexity to get right, and the actual implementation will depend greatly on your checkout flow, which you should have thoroughly worked out BEFORE you implement this, or you can quickly tie yourself in JS knots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see a fairly completely ajaxed Commerce cart in action, add this to your cart and then visit your cart and muck about changing quantities and removing things etc:&#xA;&lt;a href=&quot;https://imagescience.com.au/products/inkjet-print-retouching-kit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imagescience.com.au/products/inkjet-print-retouching-kit&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-30T00:02:13.300" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19683" PostTypeId="1" CreationDate="2017-03-30T00:57:48.013" Score="1" ViewCount="60" Body="&lt;p&gt;I'm try to use related entries from different channels to display content on a home page. Using the code following with &quot;selectNews&quot; as a entries fieldHandle in the Home Page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set entry = entry.selectNews.first() %}&#xA;  {% if entry %}   &#xA;     ...&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This places field entries from craft section &quot;news&quot;, the first &amp;amp; only entry. Following that is a div with the same code, but with a new entries field and fieldHandle, &quot;messageBanner&quot;, relating to an channel named &quot;Banners&quot;. This second set of code fails to display anything. I see that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;... {{ entry }}...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tested in the failed div, outside of &lt;code&gt;{%set entry =... endif %}&lt;/code&gt;, prints to screen the related entry title from the previous code. How can I get this fixed and what am I missing. Pretty confused.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry.selectNews.first() %}&#xA;  {% if entry %}&#xA;...&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt; &#xA;   {% set asset = entry.newsImage.first() %}&#xA;      {% if asset %}&#xA;       &amp;lt;img class=&quot;col-xs-12&quot; src=&quot; {{ asset.url }} &quot; alt=&quot; News image &quot;/&amp;gt; &#xA;      {% endif %}      &#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;  &#xA;...&#xA;{% endif %} &#xA;&#xA;&#xA;{% set entry = entry.messageBanner.first() %}&#xA;  {% if entry %}&#xA;&#xA;&amp;lt;section class=&quot;offer-stripe center&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;container-fluid&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-xs-12&quot;&amp;gt; &#xA;        &amp;lt;a href=&quot;{{ entry.bannerLink }}&quot;&amp;gt;&#xA;          &amp;lt;h5&amp;gt;&amp;lt;span class=&quot;red&quot;&amp;gt; some text &amp;lt;/span&amp;gt;&amp;lt;small&amp;gt;&amp;lt;em&amp;gt; {{entry.bannerText}} &amp;lt;/em&amp;gt;&amp;lt;/small&amp;gt;&amp;lt;/h5&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6511" LastEditorUserId="6511" LastEditDate="2017-03-30T01:36:48.420" LastActivityDate="2017-03-30T11:33:49.637" Title="Craft entries statements failing" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19684" PostTypeId="1" AcceptedAnswerId="19685" CreationDate="2017-03-30T01:52:44.160" Score="2" ViewCount="183" Body="&lt;p&gt;I'm trying to include the videojs.thumbnails.js file in my layout.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;./videojs.thumbnails.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's located at the same level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/csbK8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/csbK8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the following error: &lt;a href=&quot;http://localhost:3000/videojs.thumbnails.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:3000/videojs.thumbnails.js&lt;/a&gt; 404 (Not Found)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I am missing?&lt;/p&gt;&#xA;" OwnerUserId="6512" LastEditorUserId="22" LastEditDate="2017-03-30T02:11:40.843" LastActivityDate="2017-03-30T02:32:33.447" Title="Can't include relative JS file from layout" Tags="&lt;templating&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19685" PostTypeId="2" ParentId="19684" CreationDate="2017-03-30T02:09:07.573" Score="3" Body="&lt;p&gt;It looks like this is all happening in Craft's template folder, where anything with an underscore—like your _layout directory and its contents—won't be accessible via URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll definitely want to adjust your project layout to keep Craft's templates together in /craft/templates, and any front-end resources (like your videojs.thumbnails.js, thumbnails.png, etc.) in the /public folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Routing documentation&lt;/a&gt; fully explains what Craft does with any front-end URL it gets—it's a tad intense but should fully explain what happens with a request.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-03-30T02:32:33.447" LastActivityDate="2017-03-30T02:32:33.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19686" PostTypeId="2" ParentId="19683" CreationDate="2017-03-30T04:09:43.127" Score="2" Body="&lt;p&gt;I'm not 100% following your question, but it's likely a variable re-use issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you're setting the variable once, and if it exists, do blah....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you're attempting to re-set that variable below.  Something goes wrong with that, but &lt;code&gt;entry&lt;/code&gt; still exists at that point, so it passes the seconds test but in that second block  entry is still pointing to the data it retrieved in the first use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You might find it useful to check out:&#xA;&lt;a href=&quot;https://straightupcraft.com/articles/testing-if-something-exists-is-defined-length-is-not-null-is-not-empty&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/testing-if-something-exists-is-defined-length-is-not-null-is-not-empty&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...which has a whole lot of stuff about testing variables too)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-03-30T04:09:43.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19687" PostTypeId="1" CreationDate="2017-03-30T04:12:45.583" Score="2" ViewCount="179" Body="&lt;p&gt;I have a news page (/news). You can open an article (i.e. /news/test-article) which uses the same listing template, but has an accordion open with content for that article (javascript/push state magic).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the event someone goes directly to /news/{slug} I want to make sure that article is the top one in the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to go i.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criterea-&amp;gt;section = 'news';&#xA;$criterea-&amp;gt;order = 'postDate desc';&#xA;$criterea-&amp;gt;ids = [$startArticle-&amp;gt;id, {magically fall back to default sorting!}];&#xA;$criterea-&amp;gt;fixedOrder = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or am I going to have to futz with the array manually after the search?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-04-24T11:38:53.960" Title="Fixed order with limited set, then resume normal order" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19688" PostTypeId="1" CreationDate="2017-03-30T08:26:50.187" Score="1" ViewCount="100" Body="&lt;p&gt;I have a range of products on a product collection page. Each product has a matrix block (ageRange) with a group of checkboxes (values 1-10). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently trying to get loop through all products, get the matrix block values and push them into a new array, with the amount of times the value appears!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myArray2 = [] %}&#xA;{% for product in craft.commerce.products({relatedTo: category}) %}&#xA;  {% for block in product.ageRange %}&#xA;    {% for option in block.options %}&#xA;      {% set myArray2 = myArray2|merge({ ('key'): option }) %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{{dump(myArray2)}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems like a very bad approach. Even if I can get this working, it is clunky and no doubt un-performant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially I am looking for a way to attached fields to products, and easily get the total amount of times that that field is used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I overlooked something simpler?&#xA;if not, is twig the right place to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Desired output would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 (6)&lt;/li&gt;&#xA;&lt;li&gt;2 (3) &lt;/li&gt;&#xA;&lt;li&gt;3 (3)&lt;/li&gt;&#xA;&lt;li&gt;4 (6)&lt;/li&gt;&#xA;&lt;li&gt;5 (0) // i'd hide this&lt;/li&gt;&#xA;&lt;li&gt;6 (1)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6472" LastEditorUserId="6472" LastEditDate="2017-03-31T06:52:03.060" LastActivityDate="2017-03-31T06:52:03.060" Title="Create filters from Matrix Blocks on entries or products" Tags="&lt;matrix&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19690" PostTypeId="2" ParentId="18796" CreationDate="2017-03-30T11:08:04.850" Score="1" Body="&lt;p&gt;Instead of &lt;code&gt;slug&lt;/code&gt; try using &lt;code&gt;*&lt;/code&gt; in your route definition&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2017-03-30T11:08:04.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19693" PostTypeId="1" CreationDate="2017-03-30T12:14:35.233" Score="2" ViewCount="572" Body="&lt;p&gt;I'm creating a website where I want users to be able to login. I'm using &lt;a href=&quot;https://craftcms.com/docs/templating/login-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/login-form&lt;/a&gt; to achieve this. No problem so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a user is logged in, I want the user to be able to reach the asset folder (depending on what the rights are for his user-group). When not logged in, I want the asset url to be private.&#xA;For this to work I've placed the asset folder outside the webroot, so you can't access the asset folder by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to achieve this with this plugin: &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/tikiatua/internal-assets-plugin&lt;/a&gt;&#xA;But without any success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My general config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'enableTemplateCaching' =&amp;gt; false,&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://website.loc/',&#xA;    'loginPath' =&amp;gt; 'http://website.loc/',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'internalAssetsPath' =&amp;gt; CRAFT_BASE_PATH . &quot;../media/&quot;,&#xA;        'internalAssetsUrl' =&amp;gt; &quot;http://website.loc/media/&quot;&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can upload a image in my internalAssetsPath, but when I try to show this in front-end, I get a 404.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.kind('image') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A solution for the 404 problem would be nice, but a solution for reaching the asset folder when logged in would be great.&lt;/p&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2017-07-13T07:42:17.753" Title="Public url for assets when logged-in" Tags="&lt;assets&gt;&lt;login&gt;&lt;user-groups&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19694" PostTypeId="1" CreationDate="2017-03-30T13:26:09.597" Score="1" ViewCount="289" Body="&lt;p&gt;I would like to do two things in my Craft commerce templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In my product template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check if there are any discounts available to a specific product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a way to output discounts but need to be able to check if there are any at all because the pricing table would look entirely different for either one of the two cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In my shopping cart template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to check (1) if there are any discounts applied to a line item in the shopping cart and, if there are, (2) I would like to display the discount amount for that line item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, I can avoid showing a zero discount like this:&#xA;&quot;Your discount: $0.00&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Thank you for your help.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5199" LastActivityDate="2017-08-17T09:44:01.197" Title="Check if there is a discount and, is yes, how much" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19696" PostTypeId="1" AcceptedAnswerId="19698" CreationDate="2017-03-30T13:29:23.847" Score="0" ViewCount="51" Body="&lt;p&gt;Is there a way to show if a user is currently logged in to the control panel? As I need a way to see if the client is working in the CMS.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-03-30T14:07:42.873" Title="How to show if a user is logged in to control panel" Tags="&lt;users&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19697" PostTypeId="2" ParentId="19693" CreationDate="2017-03-30T14:03:04.227" Score="2" Body="&lt;p&gt;Give &lt;a href=&quot;https://craftpl.us/plugins/digital-download&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Download&lt;/a&gt; a try... it generates a masked URL for downloadable assets. You can restrict the download to a specific user or user group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I'm the plugin author.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-30T14:03:04.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19698" PostTypeId="2" ParentId="19696" CreationDate="2017-03-30T14:07:42.873" Score="3" Body="&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/marionnewlevant/craft-snitch&quot; rel=&quot;nofollow noreferrer&quot;&gt;MN Snitch&lt;/a&gt; plugin. It probably comes the closest to what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-30T14:07:42.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19700" PostTypeId="1" AcceptedAnswerId="19701" CreationDate="2017-03-30T15:52:04.027" Score="1" ViewCount="105" Body="&lt;p&gt;I'm struggling to combine two almost identical sidebar templates.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m working on a site that has:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a blog channel section with an index template that ‘includes’ a ‘sidebar-main.html’ template&lt;/li&gt;&#xA;&lt;li&gt;a structure section with a page template that ‘includes’ the same ‘sidebar-main.html’ template&lt;/li&gt;&#xA;&lt;li&gt;a category template that lists blog posts for a single category, but which ‘includes’ a different ‘sidebar-category.html’ template&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The ‘sidebar-main.html’ and ‘sidebar-category.html’ templates are almost identical. Their main function is to offer the user a choice of an 'All categories' menu sorted by category, or a 'Top categories' menu sorted by number of posts, selectable in the entry control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'sidebar-main.html template starts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;sidebar column&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div  class=&quot;sticky-container&quot; data-sticky-container&amp;gt;&#xA;        &amp;lt;div class=&quot;sticky&quot; data-sticky data-anchor=&quot;stickyAnchor&quot; data-sticky-on=&quot;large&quot; style=&quot;width:100%&quot;&amp;gt;&#xA;&#xA;    {% if entry.sidebarContent is defined %}&#xA;&#xA;        {% for block in entry.sidebarContent %}&#xA;&#xA;            {% if block.type == &quot;sidebarWidget&quot; %}&#xA;                {% if block.widget.contains('topCategories') %}&#xA;&#xA;                &amp;lt;h4 class=&quot;section-title&quot;&amp;gt;Top categories&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;card-section&quot;&amp;gt;&#xA;&#xA;                    {% set entryIds = craft.entries.section('blog').ids() %}&#xA;                    {% set allCats = craft.categories.relatedTo(entryIds).level(1).find() %}&#xA;                    {% set catArray = {} %} &#xA;&#xA;                    {% for category in allCats %}&#xA;                      {% set catArray = catArray | merge({(category.slug):craft.entries.relatedTo(category).total() }) %}&#xA;                    {% endfor %}&#xA;&#xA;                    {% set catArray = catArray|sort|reverse %}&#xA;&#xA;                    {% for catSlug, entryCount in catArray | slice(0,3) %}&#xA;                    {% set category = craft.categories.slug(catSlug).first() %}&#xA;&#xA;                    {% if loop.first %}&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;first-column small-6 large-12 columns&quot;&amp;gt;&#xA;                                &amp;lt;ul&amp;gt;&#xA;                    {% endif %} &#xA;&#xA;                                    &amp;lt;li class=&quot;clearfix&quot;&amp;gt;&#xA;                                        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;amp;nbsp;&amp;lt;/a&amp;gt;&#xA;                                        &amp;lt;div class=&quot;count&quot;&amp;gt;{{ entryCount }}{% if entryCount == 1 %}&amp;amp;nbsp;post{% else %}&amp;amp;nbsp;posts{% endif %}&amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the 'sidebar-category.html' template is identical to this, except that &lt;code&gt;entry.sidebarContent&lt;/code&gt; is replaced by &lt;code&gt;category.sidebarContent&lt;/code&gt;. This works fine, with no errors or problems (except it's not DRY). However, if I can eliminate the use of 'category.sidebarContent', then I can split up the combined template to enable its use in 404 and search etc pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope all that makes some sort of sense, and thanks for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="3695" LastEditorUserId="3695" LastEditDate="2017-03-30T16:00:12.547" LastActivityDate="2017-03-30T16:42:44.960" Title="Combine two almost identical sidebar templates, used for blog index and category index pages" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19701" PostTypeId="2" ParentId="19700" CreationDate="2017-03-30T16:42:44.960" Score="2" Body="&lt;p&gt;You could pass the content to the sidebar include, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'sidebar-template' with {&#xA;    content: entry.sidebarContent&#xA;} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sidebar template would then use &lt;code&gt;content&lt;/code&gt;, rather than &lt;code&gt;entry.sidebarContent&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth taking a look at &lt;a href=&quot;http://twig.sensiolabs.org/doc/1.x/tags/embed.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig embeds&lt;/a&gt;, which can be very useful in situations such as this.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-03-30T16:42:44.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19702" PostTypeId="1" AcceptedAnswerId="19703" CreationDate="2017-03-30T19:39:25.027" Score="1" ViewCount="172" Body="&lt;p&gt;Possibly a very easy question. Let me explain my flow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I created an asset folder (images)&lt;/li&gt;&#xA;&lt;li&gt;I added the folder in the assets&lt;/li&gt;&#xA;&lt;li&gt;I created in image transforms 'square' which is an image of 500 by 500px. &lt;/li&gt;&#xA;&lt;li&gt;I added a custom field to my homepage called 'hoofdafbeelding' and added an image to it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I call the image like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.hoofdafbeelding.getUrl('square') }}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?! How can it be so hard to show an image?&lt;/p&gt;&#xA;" OwnerUserId="6502" LastActivityDate="2017-03-30T20:04:46.470" Title="Figuring out why my image is not working in the template" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19703" PostTypeId="2" ParentId="19702" CreationDate="2017-03-30T20:04:46.470" Score="4" Body="&lt;p&gt;You can have more than one Asset in any Assets field, so it always returns to you an &lt;em&gt;array&lt;/em&gt; of assets. So you just need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.hoofdafbeelding.first().getUrl('square') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...assuming you want the first asset.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-03-30T20:04:46.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19704" PostTypeId="1" AcceptedAnswerId="19770" CreationDate="2017-03-30T21:36:46.500" Score="3" ViewCount="4514" Body="&lt;p&gt;I'm creating a multilingual site and I'm looking to pass some additional configuration data to Twig so I can use it in my template. For example, suppose I have a configuration like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;serviceName&quot;:        &quot;arabic&quot;,&#xA;  &quot;language&quot;:           &quot;ar&quot;,&#xA;  &quot;textDirection&quot;:      &quot;rtl&quot;,&#xA;  &quot;socialMediaButtons&quot;: [&quot;twitter&quot;, &quot;facebook&quot;],&#xA;  ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to use this data to set the &lt;code&gt;dir&lt;/code&gt; attribute in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;{{ craft.locale }}&quot; dir=&quot;{{ config.textDirection }}&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  ...&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My project structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/zILW8g3.jpg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where each locale directory has a config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6518" LastActivityDate="2017-04-04T14:37:49.620" Title="Passing JSON to Twig" Tags="&lt;templating&gt;&lt;localization&gt;&lt;config&gt;&lt;craft-pro&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19705" PostTypeId="2" ParentId="19688" CreationDate="2017-03-30T22:46:03.663" Score="1" Body="&lt;p&gt;Ok, so It's totally possible to do this utilising the array|merge feature of twig. &#xA;Firstly, we do a for loop over all our products (or whatever), loop over our matrix block(s), loop of the fields(s) and spit those values into a new array. We should end up with every value applied to every product in a big array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ageArray = [] %} // array for all your values&#xA;{% for product in craft.commerce.products.relatedTo(category) %}&#xA;  {% for block in product.ageRange %}  &#xA;    {% for option in block.options %} &#xA;      {% set ageArray = ageArray|merge({ (loop.index): option.value }) %} &#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for me, I had multiple values set from 1-10 on all products, so ended up with something like: [2,3,4,5,6,3,4,5,6,7,1,2,3,4] etc etc&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now we sort and loop over this new array, counting how many times we come across the same number. The original value, as well as the amount of times we count it, gets spat into another array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set counter = 1 %}&#xA;{% set ageArray = [] %}&#xA;{% for age in ageArray|sort %}&#xA;  {% if currentAge is defined and currentAge != age %}&#xA;    {% set counter = 1 %}&#xA;  {% endif %}&#xA;  {% if currentAge is defined and currentAge == age %}&#xA;    {% set counter = counter + 1 %}&#xA;  {% endif %}&#xA;  {% set newArray = newArray|merge({ ('age'~age): {'age': age, 'counter': counter} }) %} &#xA;  // ('age'~age) has to be string key, integer wont overwrite&#xA;  {% set currentAge = age %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;CurrentAge is basically the last iteration's value, so we do some checks against the current value and either reset the counter or increment. If it is the first time we see this number - the counter should be 1. If it matches, we add 1 on!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then merge these values into the final array, overwriting any with the same key. Finally, we update currentAge with the actual new value, ready for the next iteration.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;finally, you can just use this new array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for reducedAge in newArray %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ craft.request.getUrl()}}?ageRange={{reducedAge.age}}&quot;&amp;gt;&#xA;         {{ reducedAge.age }} ({{reducedAge.counter}})&#xA;      &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Twig really does not seem like a clever place for this logic. However, this will provide a nice fallback for an ElementApi / JS solution. I'm surprised it wasn't easier, I'd have though &lt;em&gt;alot&lt;/em&gt; of people need this sort of functionality!&lt;/p&gt;&#xA;" OwnerUserId="6472" LastEditorUserId="6472" LastEditDate="2017-03-30T22:52:51.270" LastActivityDate="2017-03-30T22:52:51.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19706" PostTypeId="2" ParentId="19148" CreationDate="2017-03-31T06:18:56.370" Score="1" Body="&lt;p&gt;i've got now a working approach to my question above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('jahrgang') %}&#xA;&#xA;&amp;lt;form action=&quot;tourdefrance.html&quot; method=&quot;post&quot;&amp;gt;&#xA;   &amp;lt;select class=&quot;dropdown&quot; name=&quot;modelljahr&quot; size=&quot;1&quot; onchange=&quot;this.form.submit();&quot;&amp;gt;&#xA;     {% for opt in field.settings.options %}&#xA;        &amp;lt;option name=&quot;fields[myFieldHandle][]&quot; value=&quot;{{ opt.value }}&quot;&amp;gt;{{ opt.value }}&amp;lt;/option&amp;gt;&#xA;     {% endfor %}&#xA;   &amp;lt;/select&amp;gt;&#xA;&#xA;{% set entries = craft.entries.section('mountainbikes') %}&#xA;&#xA;{% set modelljahr = craft.request.getParam('modelljahr') %}&#xA;&#xA;&amp;lt;form action=&quot;tourdefrance.html&quot; method=&quot;post&quot;&amp;gt;&#xA;  &amp;lt;select class=&quot;dropdown&quot; name=&quot;modell&quot; size=&quot;1&quot; onchange=&quot;this.form.submit();&quot;&amp;gt;&#xA;    {% for entry in entries %}&#xA;      {% if entry.jahrgang == modelljahr %}&#xA;        &amp;lt;option value=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;{{ craft.request.getParam('modell') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6061" LastEditorUserId="6061" LastEditDate="2017-03-31T10:55:46.633" LastActivityDate="2017-03-31T10:55:46.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19707" PostTypeId="1" AcceptedAnswerId="19713" CreationDate="2017-03-31T08:37:02.960" Score="2" ViewCount="448" Body="&lt;p&gt;I have a user registration form on my Front-end which is submitted with Ajax which works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem is that if I have any errors, like an already in use username they wont be displayed. The still function but just wont be displayed. Same goes for empty required fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without using AJAX the errors are displayed as they should though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is my Ajax:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#registrationForm').submit(function(ev) {&#xA;    ev.preventDefault();&#xA;&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.post('/', data, function(response) {&#xA;&#xA;    console.log(response);&#xA;&#xA;    if (response.success) {&#xA;        console.log(&quot;success&quot;)&#xA;    } else {&#xA;        console.log(response.error);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is my form:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;registrationForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/succes&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;    &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; placeholder=&quot;Naam&quot;&amp;gt;&#xA;    &amp;lt;input id=&quot;username&quot; class=&quot;hidden&quot; type=&quot;text&quot; name=&quot;username&quot;&#xA;        {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%}&amp;gt;&#xA;    &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; placeholder=&quot;E-mailadres&quot; &#xA;        {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('email')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input id=&quot;wachtwoord&quot; type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;Wachtwoord&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input id=&quot;leeftijd&quot; type=&quot;text&quot; name=&quot;leeftijd&quot; placeholder=&quot;Wat is je leeftijd?&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(account.getErrors('password')) }}&#xA;    {% endif %}&#xA;    &amp;lt;input id=&quot;userPhoto&quot; class=&quot;button sec hover-btn blue-btn&quot; type=&quot;file&quot; name=&quot;userPhoto&quot; value=&quot;{{ acc.uploadProfielButton }}&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;button hover-btn orange-btn&quot; type=&quot;submit&quot; value=&quot;{{ acc.aanmeldenButton }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-31T10:20:47.540" Title="AJAX Front-end User Registration Form not displaying macro errorList" Tags="&lt;form&gt;&lt;ajax&gt;&lt;registration&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19708" PostTypeId="5" CreationDate="2017-03-31T08:39:19.073" Score="0" Body="&lt;p&gt;The docs are pretty straightforward for the frontend forms but also really limited to the basic stuff. This tag could make it easier for people to find more about them via stackexchange&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-03-31T15:27:15.770" LastActivityDate="2017-03-31T15:27:15.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19709" PostTypeId="4" CreationDate="2017-03-31T08:39:19.073" Score="0" Body="The frontend-form tag should be used for any question related to forms build on the front-end." OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-03-31T15:26:59.117" LastActivityDate="2017-03-31T15:26:59.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19710" PostTypeId="1" CreationDate="2017-03-31T09:00:34.070" Score="1" ViewCount="388" Body="&lt;p&gt;I have an asset source with url &quot;/guides/&quot;.&#xA;When I put a file to this folder, a file gets an url:&#xA;domain.com/guides/myfile.pdf&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to &quot;domain.com/guides&quot;, it shows me the file directory. &#xA;I prevent access to this by creating .htaccess file and now I see a Forbidden page (You don't have permission to access /guides/ on this server).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Guides entry page: domain.com/guides/my-guides-main-page&#xA;Is it possible to make a redirection like this:&#xA;domain.com/guides -&gt; domain.com/guides/my-guides-main-page&lt;/p&gt;&#xA;" OwnerUserId="6290" LastActivityDate="2017-03-31T09:37:49.423" Title="How to prevent access to asset folder (and redirect to other page)?" Tags="&lt;assets&gt;&lt;url&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19711" PostTypeId="1" CreationDate="2017-03-31T09:09:16.527" Score="1" ViewCount="120" Body="&lt;p&gt;I'm using formattingAdd in a JSON config file for redactor. The items do not appear in the menu in the order I define them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some searching I realise the format for formattingAdd is an object and each format is a property of that object. Javascript does not guarantee the order of properties returned from an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The redactor source code uses jQuery $.each which cannot 'fix' the issue with javascript not ordering the properties of an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a workaround for this? I could change the code in craft/app/resources/lib/redactor/redactor.js to accept an array of objects for formattingAdd but I guess it would be overwritten everytime I upgrade craft.&lt;/p&gt;&#xA;" OwnerUserId="6519" LastActivityDate="2017-03-31T09:09:16.527" Title="Order of Redactor format options using formattingAdd" Tags="&lt;redactor&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19712" PostTypeId="2" ParentId="19710" CreationDate="2017-03-31T09:37:49.423" Score="1" Body="&lt;p&gt;It would be much safer and easier to work with if you put all assets folders into domain.com/assets/ as it can cause such conflicts.&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-03-31T09:37:49.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19713" PostTypeId="2" ParentId="19707" CreationDate="2017-03-31T10:20:47.540" Score="3" Body="&lt;p&gt;No errors are displayed because you are using AJAX to post your data. The &lt;code&gt;errorList&lt;/code&gt; function works only with &quot;regular&quot; POST flow. When ajax response is available you need to grab it and append errors yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#registrationForm').submit(function(ev) {&#xA;    ev.preventDefault();&#xA;&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.post('/', data, function(response) {&#xA;&#xA;        if (response.success) {&#xA;            console.log(&quot;success&quot;)&#xA;        } else {&#xA;            console.log(response.errors);&#xA;            appendErrors(response.errors);&#xA;        }&#xA;&#xA;    });&#xA;});&#xA;&#xA;function appendErrors(errors) {&#xA;    $.each(errors, function(field, errors) {&#xA;        appendError(field, errors);&#xA;    });&#xA;}&#xA;&#xA;function appendError(field, errors) {&#xA;    var $errorList = $('&amp;lt;ul&amp;gt;');&#xA;&#xA;    $.each(errors, function(index, error) {&#xA;        $errorList.append($('&amp;lt;li&amp;gt;').html(error));&#xA;    });&#xA;&#xA;    $(&quot;input[name=&quot; + field + &quot;]&quot;).after($errorList);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2017-03-31T10:20:47.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19714" PostTypeId="1" CreationDate="2017-03-31T10:34:01.310" Score="0" ViewCount="65" Body="&lt;p&gt;I have a structure section with entry url format: &quot;products/{slug}&quot;. &#xA;All entries have they urls like &quot;/products/category1/subcategory1/product1&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have a header navigation which opens product category pages like &quot;products/category1&quot;.What is the preferred way to define &quot;/product&quot; page? &lt;/p&gt;&#xA;" OwnerUserId="6290" LastActivityDate="2017-03-31T11:24:32.917" Title="How to define section parent page?" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19715" PostTypeId="1" AcceptedAnswerId="19718" CreationDate="2017-03-31T10:46:53.160" Score="1" ViewCount="186" Body="&lt;p&gt;I have a section (or structure, works both) for &quot;events&quot;. On the archive template (see image below) I want to add a custom image in the header. The administrator needs to be able to upload the header image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AjpTw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AjpTw.png&quot; alt=&quot;Events page&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a section/structure there is no dedicated page, so I cannot assign custom fields to it. How do I tackle this problem?&lt;/p&gt;&#xA;" OwnerUserId="6502" LastActivityDate="2017-04-07T02:49:39.993" Title="Custom fields on a structure or section archive page" Tags="&lt;structure&gt;&lt;sections&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19716" PostTypeId="1" CreationDate="2017-03-31T10:54:06.470" Score="1" ViewCount="163" Body="&lt;p&gt;This works for me, but i would like to solve this with ajax without reloading the page. Choosing the values from the Dropdowns and submit the data per POST Method, so i can return the value with &quot;getParam( name )&quot;. This question is related to my own question &lt;a href=&quot;https://craftcms.stackexchange.com/q/19148/6061&quot;&gt;Reuse chosen dropdown field value on frontend&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('jahrgang') %}&#xA;&#xA;&amp;lt;form action=&quot;tourdefrance.html&quot; method=&quot;post&quot;&amp;gt;&#xA;   &amp;lt;select class=&quot;dropdown&quot; name=&quot;modelljahr&quot; size=&quot;1&quot; onchange=&quot;this.form.submit();&quot;&amp;gt;&#xA;     {% for opt in field.settings.options %}&#xA;        &amp;lt;option name=&quot;fields[myFieldHandle][]&quot; value=&quot;{{ opt.value }}&quot;&amp;gt;{{ opt.value }}&amp;lt;/option&amp;gt;&#xA;     {% endfor %}&#xA;   &amp;lt;/select&amp;gt;&#xA;&#xA;{% set modelljahr = craft.request.getParam('modelljahr') %}&#xA;{% set entries = craft.entries.section('mountainbikes') %}&#xA;&#xA;&amp;lt;form action=&quot;tourdefrance.html&quot; method=&quot;post&quot;&amp;gt;&#xA;  &amp;lt;select class=&quot;dropdown&quot; name=&quot;modell&quot; size=&quot;1&quot; onchange=&quot;this.form.submit();&quot;&amp;gt;&#xA;    {% for entry in entries %}&#xA;      {% if entry.jahrgang == modelljahr %}&#xA;        &amp;lt;option value=&quot;{{ entry.title }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;{{ craft.request.getParam('modell') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-03-31T10:54:06.470" Title="Submit Dropdown with ajax" Tags="&lt;ajax&gt;&lt;postdate&gt;&lt;drop-down&gt;&lt;request&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19717" PostTypeId="2" ParentId="19714" CreationDate="2017-03-31T11:24:32.917" Score="1" Body="&lt;p&gt;You have to select the &quot;level&quot; in the structure. Im guessing the products are always on level 4? If so you could try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('yourSectionHandle').level(4) %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-31T11:24:32.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19718" PostTypeId="2" ParentId="19715" CreationDate="2017-03-31T11:27:13.650" Score="2" Body="&lt;p&gt;What you could do is make a &quot;Global&quot; Which sets the header image. You could name the global something like &quot;Event Page Fields&quot; or something like that so its clear for your administrator where to look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is creating a Single page and load all the structure items via the template there. This way you can add the image field to that single.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-03-31T11:27:13.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19719" PostTypeId="1" AcceptedAnswerId="19720" CreationDate="2017-03-31T15:00:12.220" Score="2" ViewCount="240" Body="&lt;p&gt;is there a simple way to exclude an 'include' for specific pages? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance I have an include &lt;strong&gt;{% include &quot;_globals/_footer&quot; %}&lt;/strong&gt; but I don't want it to appear on my contact and 404 pages. &#xA;How would I exclude it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;" OwnerUserId="5390" LastEditorUserId="22" LastEditDate="2017-05-09T19:53:38.520" LastActivityDate="2018-10-03T22:43:42.083" Title="Excluding an include template" Tags="&lt;templating&gt;&lt;craft-pro&gt;&lt;craft-features&gt;&lt;craft3&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19720" PostTypeId="2" ParentId="19719" CreationDate="2017-03-31T16:17:45.850" Score="4" Body="&lt;p&gt;There may be a better way, including adding exclusions as an array and checking if the segment exists in the array, but what about wrapping it in an if tag? This seems to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.firstSegment != 'contact' and craft.request.firstSegment != '404'  %}&#xA;    {% include 'layouts/partials/my-template'%}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quick update:&lt;/strong&gt; This is very rough but an example with exclusions array (doesnt account for other segments, just an example...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exclusions = ['contact','404'] %}&#xA;{% if craft.request.firstSegment not in exclusions  %}&#xA;    {% include 'layouts/partials/my-template'%}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="3362" LastEditDate="2017-03-31T16:23:05.943" LastActivityDate="2017-03-31T16:23:05.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19721" PostTypeId="2" ParentId="19719" CreationDate="2017-03-31T16:17:53.360" Score="1" Body="&lt;p&gt;You can use &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13491/can-you-get-the-http-status-code-in-twig-templates&quot;&gt;this&lt;/a&gt; answer to create &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Variable&lt;/a&gt;.&#xA;Then use it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- if craft.myPlugin.getHttpStatus() != 404 -%}&#xA;    {%- include &quot;_globals/_footer&quot; -%}&#xA;{%- endif -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-03-31T16:17:53.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19722" PostTypeId="1" CreationDate="2017-03-31T16:18:20.583" Score="3" ViewCount="415" Body="&lt;p&gt;The sale and discount menus only discount at the product level. However, I need the ability to apply discounts and sales at the variant level. How would I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;I sell a piece of software (the product). There are new licences and upgrade licences (the variants). I want to apply a discount to only the new licences.&lt;/p&gt;&#xA;" OwnerUserId="6317" LastActivityDate="2017-05-31T14:49:00.187" Title="How to apply a discount or sale to a variant?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19723" PostTypeId="1" CreationDate="2017-03-31T16:25:17.083" Score="3" ViewCount="512" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm setting up a multi-currency site (CAD, USD, EUR). I'd like the user to be able to select their currency &lt;strong&gt;before&lt;/strong&gt; they actually put anything in the cart. And once selected, prices throughout the site display prices in that currency AND the cart carries that currency to the end of the transaction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the docs (&lt;a href=&quot;https://craftcommerce.com/docs/payment-currencies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-currencies&lt;/a&gt;), I have tried option 2 but it does not appear to work. I can only speculate that because there is nothing in the cart, the currency can't be updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only option to use option 1 and set up multiple locales to set the PHP constant to the appropriate currency? Multiple locales seems to be overkill for just a currency conversion but if that's what's needed then I'll do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the form I'm using to attempt to change the currency after there's something in the cart. But it doesn't change the currency for some reason:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;paymentCurrency&quot; value=&quot;USD&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;commerce/cart&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Convert to USD&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea what I'm missing here? This is following option #2 I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This turned out to be an issue with my version of PHP (5.5.38) and CraftCommerce. It should not be a problem for others (hopefully).&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2017-04-19T12:42:55.447" LastActivityDate="2019-04-24T04:04:30.653" Title="Currency switcher" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19726" PostTypeId="1" AcceptedAnswerId="19727" CreationDate="2017-03-31T19:05:20.027" Score="1" ViewCount="258" Body="&lt;p&gt;I need to pass an entire Craft object into a JavaScript function. I followed the instructions in this &lt;a href=&quot;https://craftcms.stackexchange.com/a/17136/6512&quot;&gt;post&lt;/a&gt;, however this only covers passing in a string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/js/homepage.js&quot; %}&#xA;{% set myJs %}&#xA;   playlistData('{{myObject}}');&#xA;{% endset %}   &#xA;{% includeJs myJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6512" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.303" LastActivityDate="2017-03-31T20:34:16.127" Title="Pass Craft field object to JavaScript function" Tags="&lt;includejs&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19727" PostTypeId="2" ParentId="19726" CreationDate="2017-03-31T20:34:16.127" Score="4" Body="&lt;p&gt;You have to break it up into individual values before you can pass it through to JS...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsFile &quot;/js/homepage.js&quot; %}&#xA;{% set myJs %}&#xA;   playlistData({&#xA;      field1: '{{ myObject.field1 }}',&#xA;      field2: '{{ myObject.field2 }}',&#xA;      field3: '{{ myObject.field3 }}'&#xA;   });&#xA;{% endset %}   &#xA;{% includeJs myJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-03-31T20:34:16.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19728" PostTypeId="1" CreationDate="2017-03-31T20:35:32.810" Score="2" ViewCount="145" Body="&lt;p&gt;I have a standard user profile form. But now I would like that the user can upload images in new subfolder and make own subfolder. &#xA;Is there any solution or a plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="6521" LastActivityDate="2018-05-26T05:35:48.277" Title="User make assets subfolder in the frontend" Tags="&lt;assets&gt;&lt;form&gt;&lt;upload&gt;&lt;profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19729" PostTypeId="1" AcceptedAnswerId="19947" CreationDate="2017-03-31T21:51:35.457" Score="0" ViewCount="148" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured this would be simple but apparently not (for me, anyway).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have a product with two variants (orange and yellow).&lt;/li&gt;&#xA;&lt;li&gt;I have a page that lists all the available products.&lt;/li&gt;&#xA;&lt;li&gt;On that page, both variants appear. I really just need one and users&#xA;can select their variant from a drop-down on the checkout page.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get the products from the categories #}&#xA;{% set products = craft.commerce.products.type('shirts,shorts') %}&#xA;&#xA;{# show the product main image and link to the product page #}&#xA;&amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;    {% if product|length %}&#xA;        {% set asset = product.productHeroImage.first() %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;{% endif %}&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did try &lt;code&gt;{% set products = craft.commerce.products.defaultVariant.type('shirts,shorts') %}&lt;/code&gt; but get the same results.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2017-04-03T10:22:01.903" LastActivityDate="2017-04-13T14:48:18.997" Title="Listing all available default variants" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19730" PostTypeId="1" AcceptedAnswerId="19837" CreationDate="2017-03-31T22:43:09.450" Score="0" ViewCount="274" Body="&lt;p&gt;I've got a for loop that is returning the first letter of the entry title. I have a number of entries so I almost get a complete alphabet except that there are too many of many letters. I only want one 'a', one 'b', one 'c' and so &#xA;forth. And no letter if there is no entry to correspond to it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for alpha in craft.entries.section('advertisers').order('title asc') %}&#xA;    &amp;lt;a href=&quot;{{ siteUrl }}{{ alpha.title|first }}&quot;&amp;gt;{{ alpha.title|first }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code returns:&#xA;A A A B B B B B C C E E E E G G H H K M M M M P P R R S S S T T U U U W W&#xA;but I want it to return A B C E G H K M P R S T U W&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any solutions to this?&lt;/p&gt;&#xA;" OwnerUserId="6441" LastEditorUserId="6441" LastEditDate="2017-03-31T23:20:39.567" LastActivityDate="2017-04-06T20:28:54.000" Title="How do I omit similar content in a for loop based on the first letter in title?" Tags="&lt;forloop&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19731" PostTypeId="2" ParentId="19728" CreationDate="2017-03-31T23:03:47.190" Score="1" Body="&lt;p&gt;No idea if it lets users create subfolders on the front-end, but this is the closest plugin I could find: &lt;a href=&quot;https://straightupcraft.com/craft-plugins/assets-browser&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/assets-browser&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't do it, most likely you'd need to do some custom plugin work to do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-31T23:03:47.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19732" PostTypeId="2" ParentId="19607" CreationDate="2017-03-31T23:32:10.307" Score="1" Body="&lt;p&gt;The &lt;code&gt;{% cache %}&lt;/code&gt; tag tracks &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elements&lt;/a&gt; (Users, Entries, Categories, Tags, etc.), so if you're want to do this using a plugin, then the plugin's field type needs to inherit from &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/BaseElementFieldType&quot; rel=&quot;nofollow noreferrer&quot;&gt;BaseElementFieldType&lt;/a&gt; and needs to implement its own element type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, it's just a matter of calling &lt;a href=&quot;https://craftcms.com/classreference/services/TemplateCacheService#includeElementInTemplateCaches-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;templateCache-&amp;gt;includeElementInTemplateCaches()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-03-31T23:32:10.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19733" PostTypeId="2" ParentId="19651" CreationDate="2017-04-01T07:39:16.047" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Sorry, Calendar currently does not allow for importing of any events via ICS or other means.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;source: Kelsey Martens, Director of Software Operations&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-01T07:39:16.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19734" PostTypeId="1" AcceptedAnswerId="19789" CreationDate="2017-04-01T10:59:23.613" Score="0" ViewCount="175" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; and would like to return content based on it's handle. The two handles I am trying to return are called appLogo and appVideo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/featured-apps.json' =&amp;gt; [&#xA;  'elementType' =&amp;gt; 'Entry',&#xA;  'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'apps',&#xA;    'appFeatured' =&amp;gt; '1',&#xA;  ],&#xA;  'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;    return [&#xA;      'title' =&amp;gt; $entry-&amp;gt;title,&#xA;      'logo' =&amp;gt; $entry-&amp;gt;appLogo,&#xA;      'video' =&amp;gt; $entry-&amp;gt;appVideo,&#xA;    ];&#xA;  }&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not work, do I need to access images/videos in a different way? Ideally, I'd like the relative path returned for both logo and video.&lt;/p&gt;&#xA;" OwnerUserId="6512" LastEditorUserId="6512" LastEditDate="2017-04-01T11:07:27.350" LastActivityDate="2017-04-04T17:01:04.177" Title="Access handle value using element API" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19736" PostTypeId="1" CreationDate="2017-04-01T13:41:17.230" Score="0" ViewCount="444" Body="&lt;p&gt;I am trying to have a dynamic uri segment for a single. I have this uri in the CP settings: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;offers/listing/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;{slug}&lt;/code&gt; is the entryId. For example, &lt;code&gt;offers/listing/1234&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a template at &lt;code&gt;templates/listing/make-offer.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the template path i have: &lt;code&gt;listing/make-offer&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I navigate to &lt;code&gt;site.com/offers/listing/1234&lt;/code&gt; I get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I make a custom route: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;URI looks like: offers/listing/(slug)&#xA;Loads template: listing/make-offer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works. The downside is I would like to control the content on the top of the page through the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize, this is something more of a channel (which I still get a 404), but this page will never go anywhere. It's a content page at the top with a contact form at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-04-01T14:45:32.867" LastActivityDate="2017-04-01T16:02:42.753" Title="How can I have a dynamic uri segment for a single?" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19737" PostTypeId="2" ParentId="8480" CreationDate="2017-04-01T14:18:34.473" Score="4" Body="&lt;p&gt;As Brandon wrote, I just created a date field {{eventDate}} and then just search based on if the eventDate was later than NOW in the section named Events.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.find({section:'events', eventDate : &quot;&amp;gt;= &quot; ~ now.w3cDate() , order:'eventDate'}) %}&#xA;    {% for entry in events %}&#xA;        &amp;lt;p&amp;gt;{{ entry.eventDate.format('D j M') }}, {{ entry.eventName }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or use this format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.find({&#xA;    section: 'events',&#xA;    eventDate: '&amp;gt;= ' ~ now.w3cDate(),&#xA;    order: 'eventDate asc'&#xA;}) %}&#xA;    {% for entry in events %}&#xA;        &amp;lt;p&amp;gt;{{ entry.eventDate.format('D j M') }}, {{ entry.eventName }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2017-04-01T14:18:34.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19738" PostTypeId="2" ParentId="19736" CreationDate="2017-04-01T16:02:42.753" Score="2" Body="&lt;p&gt;Assuming that a &lt;strong&gt;Single&lt;/strong&gt; is the right thing to use here (&lt;em&gt;and I'm not sold on that but I trust your judment&lt;/em&gt;) the following is what I would do to accomplish what you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// config/routes.php&#xA;'offers/listing/(?P&amp;lt;entryId&amp;gt;\d)' =&amp;gt; 'listing/make-offer'&#xA;&#xA;// templates/listing/make-offer.twig&#xA;{% set entry = entry is defined ? entry : craft.entries.id(entryId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we create an &lt;a href=&quot;https://craftcms.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Advanced Route&quot;&gt;Advanced Route&lt;/a&gt; to make the (single) &lt;code&gt;entryId&lt;/code&gt; available to the template that will be loaded when the route matches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in the template, we set the &lt;code&gt;entry&lt;/code&gt; variable to either the &lt;code&gt;entry&lt;/code&gt; that Craft makes available to the template via its own routing or we fetch one explicitly by using the &lt;code&gt;entryId&lt;/code&gt; passed to the template from the custom route. &lt;em&gt;Our route may take precedence over default routing, so the &lt;code&gt;entry is defined&lt;/code&gt; check may be removed and rely instead on &lt;code&gt;craft.entries.id(entryId)&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;End Result&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to navigate to &lt;code&gt;/offers/listing/1234&lt;/code&gt;, which will load the &lt;code&gt;templates/listing/make-offer.twig&lt;/code&gt; template with the &lt;code&gt;entryId&lt;/code&gt; set to &lt;code&gt;1234&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, feel free to follow up if something isn't clear.&lt;/p&gt;&#xA;" OwnerUserId="65" LastActivityDate="2017-04-01T16:02:42.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19740" PostTypeId="1" CreationDate="2017-04-01T20:27:00.207" Score="1" ViewCount="558" Body="&lt;p&gt;I'm in the process of moving a site from one domain to another, so I'm setting up 301 redirects on the old domain. Everything goes well, except when the 301 redirect happens, &quot;index.php&quot; is inserted into the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant code in my &quot;.htaccess&quot; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;    RewriteCond %{HTTP_HOST} ^www\.newdomain\.com [NC]&#xA;    RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]&#xA;&#xA;    RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]&#xA;    RewriteRule ^(.*)$ http://newdomain.com%{REQUEST_URI} [R=301,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FWIW, I've verified that &quot;omitScriptNameInUrls&quot; is set to &quot;true&quot; and my server does support PATH_INFO.&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2017-04-01T20:27:00.207" Title="301 redirects are inserting &quot;index.php&quot; into URLs" Tags="&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19741" PostTypeId="2" ParentId="19734" CreationDate="2017-04-02T03:42:47.457" Score="0" Body="&lt;p&gt;Assuming both &lt;code&gt;appLogo&lt;/code&gt; and &lt;code&gt;appVideo&lt;/code&gt; are Asset fields, they will always return an array, even if there is only one asset selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'logo' =&amp;gt; $entry-&amp;gt;appLogo-&amp;gt;first(),&#xA;'video' =&amp;gt; $entry-&amp;gt;appVideo-&amp;gt;first(),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-02T03:42:47.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19742" PostTypeId="1" AcceptedAnswerId="19743" CreationDate="2017-04-02T15:30:30.823" Score="2" ViewCount="211" Body="&lt;p&gt;I have a very basic macro for a lazyloading responsive image tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro isotopeItem(imgParam) %}&#xA;&#xA;  {% set thumb = { mode: 'fit', width: 100, quality: 60, } %}&#xA;  {% set tSM = { mode: 'fit', width: 1536, quality: 80, } %}&#xA;  {% set tMD = { mode: 'fit', width: 340, quality: 80, } %}&#xA;  {% set tXL = { mode: 'fit', width: 1536, quality: 80, } %}&#xA;&#xA;    &amp;lt;img&#xA;    src=&quot;data:image/gif;base64,{# yadayada #}&quot;&#xA;    data-sizes=&quot;auto&quot;&#xA;    data-src=&quot;{{ imgParam.url(thumb) }}&quot;&#xA;    alt=&quot;{{ imgParam.title }}&quot;&#xA;    data-srcset=&quot;&#xA;      {{ imgParam.url(tSM) }} {{ imgParam.getWidth(tSM) }}w,&#xA;      {{ imgParam.url(tMD) }} {{ imgParam.getWidth(tMD) }}w,&#xA;      {{ imgParam.url(tXL) }} {{ imgParam.getWidth(tXL) }}w&quot;&#xA;    class=&quot;lazyload&quot; /&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see the image transformations are inside the macro which is not very nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I write the transformations outside the macro and then pass it into it? I tried tried to write one param for each transformation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = { mode: 'fit', width: 100, quality: 60, } %}&#xA;{% set tSM = { mode: 'fit', width: 1536, quality: 80, } %}&#xA;{% set tMD = { mode: 'fit', width: 340, quality: 80, } %}&#xA;{% set tXL = { mode: 'fit', width: 1536, quality: 80, } %}&#xA;&#xA;{% macro isotopeItem(imgParam, transformParam1, transformParam2 {# and so on #}) %}&#xA;   {# responive image srcset code like the above example #}&#xA;{% endmacro %}&#xA;&#xA;{# I then would have to call the macro like this: #}&#xA;&#xA;{{ _self.isotopeItem(asset, thumb, tSM, tMD, tXL) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but I have to pass all the transforms everytime I use the macro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There must be a better way right?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2017-04-04T09:40:08.780" LastActivityDate="2017-04-04T09:40:08.780" Title="Pass image transformations into macro" Tags="&lt;image-transforms&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19743" PostTypeId="2" ParentId="19742" CreationDate="2017-04-02T16:46:22.223" Score="3" Body="&lt;p&gt;Edit: I changed it to your variables, not sure if I set the array brackets 100% correct but the idea should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set the defaults in the macro as you already did, &#xA;then in your template call the macro and pass the options e.g. :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.slide.first() %}&#xA;{# macro #}&#xA;  {% set imgParam = [&#xA;    thumb: { quality: 60, },&#xA;    tSM: { mode: 'crop', width: 1536 },&#xA;%}&#xA;&#xA;{% macro isotopeItem(imgParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and merge the passed options in the macro with your macros defaults e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set defaults = [&#xA;    thumb: { mode: 'fit', width: 100, quality: 60, },&#xA;    tSM: { mode: 'fit', width: 1536, quality: 80, },&#xA;    tMD: { mode: 'fit', width: 340, quality: 80, },&#xA;    tXL: { mode: 'fit', width: 1536, quality: 80, }&#xA;  ]&#xA;%}&#xA;&#xA;{% set imgParam = imgParam ? defaults|merge(imgParam) : defaults %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so you will only need to pass explicit changes.&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="258" LastEditDate="2017-04-03T11:42:57.673" LastActivityDate="2017-04-03T11:42:57.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19744" PostTypeId="1" CreationDate="2017-04-03T02:32:32.747" Score="1" ViewCount="136" Body="&lt;p&gt;This would seem straightfoward but I can't figure it out. The situation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have a product with two colour variants (yellow, orange).&lt;/li&gt;&#xA;&lt;li&gt;On the product page, the customer adds the default variant (yellow)&#xA;to the cart.&lt;/li&gt;&#xA;&lt;li&gt;On the cart page, the customer should have the option of changing the&#xA;colour. But if I select a new colour from the drop-down and update&#xA;the cart, a new item is placed in the cart rather than the existing&#xA;item being replaced.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I could have them select the colour before they add it to the cart but that seems a little messy since I'd be bringing part of the transaction onto the product page. And they would not be able to update the colour if they changed their mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that I need to use an event to somehow delete the existing item and replace it with the new one. But I have no idea how to accomplish that.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2017-04-03T10:20:04.733" LastActivityDate="2017-07-11T05:06:11.220" Title="Updating the cart with a different variant after a variant is in the cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19745" PostTypeId="2" ParentId="19730" CreationDate="2017-04-03T02:57:08.077" Score="1" Body="&lt;p&gt;Completely untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set letterArray = [] %}&#xA;&#xA;{% for alpha in craft.entries.section('advertisers').order('title asc') %}&#xA;    {% set letterArray = letterArray|merge([alpha.title|first]) %}&#xA;{% endfor %}&#xA;&#xA;{% for letter in letterArray %}&#xA;    &amp;lt;a href=&quot;{{ siteUrl }}{{ letter }}&quot;&amp;gt;{{ letter }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-04-06T02:50:46.600" LastActivityDate="2017-04-06T02:50:46.600" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19746" PostTypeId="2" ParentId="19722" CreationDate="2017-04-03T05:02:52.027" Score="4" Body="&lt;p&gt;Variants can not be selected when setting up discounts in the UI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have variant-based sales/discounts high on the list for the next version of Craft Commerce, but nothing planned to make available in the short term. It will also allow sales and discounts to work with any custom purchasable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to think of a way around it, and the one way I can came up with in the short term is a little hack:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the description field to limit the discount to specific variant SKU's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all discounts would work and be set up as they normally would, but with a condition on the product, but if you got them to put the keyword &quot;ONLY&quot; into the description and then got them to paste the variant SKU into the description. i.e:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ONLY the red tubs (SKU162839) are on discount.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Discount ONLY applies to SKU78439 and SKU94300&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could then add the following event listener into a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// So far this would only be called when the discount has&#xA;matched with everything else about the product.&#xA;craft()-&amp;gt;on('commerce_discounts.onBeforeMatchLineItem',&#xA;function($event){&#xA;   $lineItem = $event-&amp;gt;params['lineItem'];&#xA;   $discount = $event-&amp;gt;params['discount'];&#xA;&#xA;    if (stripos($discount-&amp;gt;description, 'only') === false) {&#xA;        return; // do nothing, and let the discount match as it normally would, because the discount does not have 'only' in the description.&#xA;    }else{&#xA;        if (stripos($discount-&amp;gt;description, $lineItem-&amp;gt;sku) === false) {&#xA;            $event-&amp;gt;performAction = false; // since this SKU is not in the description string, then don't apply this discount &#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wrote the above code without testing, but something along those should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could place a custom field on the product which list the variants on discount, and have the above event listener check use that information on the product (instead of matching the SKU on the discount description).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry it's a bit of a hack for now, we will get discounts on variants in the next version of Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-04-03T05:02:52.027" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19747" PostTypeId="1" AcceptedAnswerId="21788" CreationDate="2017-04-03T07:12:24.550" Score="7" ViewCount="2762" Body="&lt;p&gt;One of the big features for craft 3 is content migrations. Migrating fields and sections between environments (like deploying code to test or production).&#xA;I'm just having a hard time figuring out what options there are. I did find some simple examples, but they are a little limited...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-content-migrations&lt;/a&gt;&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/content-migrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/content-migrations.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there is a separate documentation page which seems incomplete i created an &lt;a href=&quot;https://github.com/craftcms/docs/issues/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt;. If anyone has some additional info i would like to make a pull-request to complete the docs.&lt;/p&gt;&#xA;" OwnerUserId="4222" LastEditorUserId="9" LastEditDate="2018-11-02T17:04:47.967" LastActivityDate="2018-11-02T17:04:47.967" Title="Has someone figured out Craft 3 content migrations?" Tags="&lt;migration&gt;&lt;content&gt;&lt;craft3&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="19748" PostTypeId="1" AcceptedAnswerId="19749" CreationDate="2017-04-03T08:56:45.403" Score="3" ViewCount="251" Body="&lt;p&gt;Just wondering if theres anyway to force some validation on the username?&#xA;I have usernames being displayed locally, and therefore I'm trying to prevent email addresses being used. I have my client side validation set up with regex to prevent an email being used, but some users still seem to have been able to register with the email as there username (presumably they have JS disabled). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be nice to enforce that validation server side.&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2018-10-06T10:55:47.980" Title="Validation on username?" Tags="&lt;users&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19749" PostTypeId="2" ParentId="19748" CreationDate="2017-04-03T09:34:40.563" Score="4" Body="&lt;p&gt;I don't know if there is anything natively in Craft to do this, but you could achieve it quite easily with a single file plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;        // Only do anything if it is a front end submission&#xA;        if(craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;        {&#xA;            $username = craft()-&amp;gt;request-&amp;gt;getPost('username', null);&#xA;            if($this-&amp;gt;isEmail($username))&#xA;            {&#xA;                $event-&amp;gt;params['user']-&amp;gt;addErrors(array('username' =&amp;gt; Craft::t('You cannot use an email')));&#xA;                $event-&amp;gt;performAction = false;&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-04-03T09:34:40.563" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19750" PostTypeId="2" ParentId="15290" CreationDate="2017-04-03T09:54:09.280" Score="1" Body="&lt;p&gt;This issue has been solved. Craft Commerce discounts now have both a &quot;minimum order qty&quot; as well as a &quot;maximum order qty&quot; field. Discounts are no longer mixed up.&lt;/p&gt;&#xA;" OwnerUserId="5199" LastActivityDate="2017-04-03T09:54:09.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19751" PostTypeId="1" CreationDate="2017-04-03T10:00:46.067" Score="0" ViewCount="1159" Body="&lt;p&gt;I am developing my Craft site locally with MAMP. Today when starting my site on localhost, I got this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'craft_mysite.craft_info' doesn't exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have replaced the /app folder with a fresh copy, but it didn't help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I can no longer log into my site: When navigating to my login page, I get the same error as mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a recent database backup in /craft/storage/backups. Is there a way to get my site up and running again?&lt;/p&gt;&#xA;" OwnerUserId="5199" LastActivityDate="2017-04-04T07:31:42.897" Title="SQLSTATE[42S02]: Base table or view not found" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19752" PostTypeId="1" AcceptedAnswerId="19753" CreationDate="2017-04-03T12:22:52.693" Score="1" ViewCount="61" Body="&lt;p&gt;I have a section &lt;code&gt;Posts&lt;/code&gt; that has an Entries-type field called &lt;code&gt;Authors&lt;/code&gt; that can be linked to one or more entries in section called &lt;code&gt;People&lt;/code&gt;. To make a filter for my posts index, I need to fetch all the &lt;code&gt;People&lt;/code&gt; entries that have been linked to any post via the Authors field, but I can't wrap my head around how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas appreciated!&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2017-04-03T15:03:58.527" Title="Fetch target entries that have been linked through an Entries field" Tags="&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19753" PostTypeId="2" ParentId="19752" CreationDate="2017-04-03T12:37:33.893" Score="4" Body="&lt;p&gt;You first need to query for all post entries and then query for the authors that are related to a post. You can use the &lt;code&gt;ids()&lt;/code&gt; method to get just the author’s element IDs, which is a lot quicker than &lt;code&gt;find()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allPostIds = craft.entries({&#xA;    section: 'posts',&#xA;    limit: null,&#xA;}).ids() %}&#xA;&#xA;{% set people = craft.entries({&#xA;    section: 'people',&#xA;    relatedTo: {&#xA;        sourceElement: allPostIds,&#xA;        field: 'people',&#xA;    },&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-04-03T15:03:58.527" LastActivityDate="2017-04-03T15:03:58.527" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19754" PostTypeId="1" AcceptedAnswerId="19755" CreationDate="2017-04-03T13:23:19.653" Score="3" ViewCount="755" Body="&lt;p&gt;Starting with the Business Logic plugin from &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-businesslogic&lt;/a&gt; I'm following &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14106/3-for-2-etc-with-craft-commerce&quot;&gt;3 for 2 etc with Craft Commerce&lt;/a&gt; to get started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my main plugin file containing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;require_once('Adjusters/BusinessLogic_TaxRemover.php');&#xA;&#xA;class BusinessLogicPlugin extends BasePlugin&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        return 'BusinessLogic';&#xA;    }&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return '';&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '1.0.0';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return craft()-&amp;gt;getSiteName();&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return '';&#xA;    }&#xA;&#xA;    public function init()&#xA;    {&#xA;    }&#xA;&#xA;    public function commerce_registerOrderAdjusters(){&#xA;&#xA;        return [&#xA;&#xA;            new Commerce_TaxAdjuster&#xA;&#xA;        ];&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And within &lt;code&gt;Adjusters/BusinessLogic_TaxRemover.php&lt;/code&gt; I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {&#xA;&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;        $myAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;        $order-&amp;gt;baseDiscount = $order-&amp;gt;baseDiscount - 5;&#xA;&#xA;        $myAdjuster-&amp;gt;type = &quot;Test&quot;;&#xA;        $myAdjuster-&amp;gt;name = &quot;Test Adjuster&quot;;&#xA;        $myAdjuster-&amp;gt;description = &quot;Takes $5 off the order&quot;;&#xA;        $myAdjuster-&amp;gt;amount = -5.0;&#xA;        $myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;&#xA;        //if your Adjuster affects lineItems rather than the total, you record the ids here&#xA;        $myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt;null];&#xA;        $myAdjuster-&amp;gt;included = false;&#xA;&#xA;        return [$myAdjuster];&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But whenever doing anything to the cart, I just get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error&#xA;&#xA;Class 'Craft\BusinessLogic_TaxRemover' not found&#xA;&#xA;C:\Users\clive\Desktop\repos\_craft\craft\plugins\businesslogic\BusinessLogicPlugin.php(38)&#xA;&#xA;26     }&#xA;27 &#xA;28     public function getDeveloperUrl()&#xA;29     {&#xA;30         return '';&#xA;31     }&#xA;32 &#xA;33     public function init()&#xA;34     {&#xA;35     }&#xA;36     public function commerce_registerOrderAdjusters(){&#xA;37            return [&#xA;38             new BusinessLogic_TaxRemover&#xA;39             &#xA;40            ];&#xA;41     }&#xA;42 &#xA;43 }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.253" LastActivityDate="2017-04-05T11:21:05.677" Title="Getting started with Order Adjuster plugin" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;adjusters&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19755" PostTypeId="2" ParentId="19754" CreationDate="2017-04-03T13:33:46.727" Score="4" Body="&lt;p&gt;To get an adjuster working, it's really all about consistent naming and making sure PHP can find the class.  Here are the main things to address:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your adjuster should be defined in a file that matches it's classname&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case a folder off the main plugin folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /craft/plugins/businesslogic/Adjusters/BusinessLogic_TaxRemover.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Include the Adjuster class file.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this (at least) two ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;include&lt;/code&gt; or &lt;code&gt;require&lt;/code&gt; the adjuster file in your main plugin class&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;require_once('Adjusters/BusinessLogic_TaxRemover.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR you can use Craft::import (which is probably the better way I guess?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::import('plugins.businesslogic.adjusters.BusinessLogic_TaxRemover');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;** The Classname must match the filename **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So e.g. in this case&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {&#xA;&#xA;   etc&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You must also finally register your Adjuster with commerce&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And again you must use the same classname (and be mindful of namespaces!)&lt;br&gt;&#xA;So in this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function commerce_registerOrderAdjusters(){&#xA;    return [&#xA;        new \Commerce\Adjusters\BusinessLogic_TaxRemover&#xA;&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-04-05T11:21:05.677" LastActivityDate="2017-04-05T11:21:05.677" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="19756" PostTypeId="1" CreationDate="2017-04-03T14:24:32.303" Score="4" ViewCount="281" Body="&lt;p&gt;I am using the normal relatedTo property to find related articles, but I have an issue which is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('section').relatedTo(&quot;tags&quot;).id('not ' ~ entry.id).limit(3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lets say THIS article has 2 tags: &quot;cat&quot; and &quot;animal&quot;, &#xA;then I use the normal relatedTo property to get related articles. &#xA;Lets say i want three articles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes I get these three:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;article 1 (tags: &quot;dog&quot; and &quot;animal&quot;)&lt;/li&gt;&#xA;&lt;li&gt;article 2 (tags: &quot;cat&quot; and &quot;food&quot;)&lt;/li&gt;&#xA;&lt;li&gt;article 3 (tags: &quot;mouse&quot; and &quot;animal&quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But not this one:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;article 4 (tags: &quot;cat&quot; and &quot;animal&quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can i get the MOST related articles always? I want the one that has the most matching tags, not just random ones that has at least 1 tag.&lt;/p&gt;&#xA;" OwnerUserId="874" LastActivityDate="2017-04-03T19:03:20.500" Title="Most related articles" Tags="&lt;tags&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19757" PostTypeId="1" AcceptedAnswerId="19763" CreationDate="2017-04-03T14:55:47.063" Score="1" ViewCount="26" Body="&lt;p&gt;I am not sure if i need a plugin to accomplish a specific task or if Craft CMS can natively handle this task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created bios for people in a channel of bios. Each entry has a Job Title text field to store a single job title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I want to store a list or array of multiple job titles for each person/entry. Then, I want to choose which job title is rendered when I use the entries field to select a bio to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6130" LastEditorUserId="57" LastEditDate="2017-04-03T18:16:16.243" LastActivityDate="2017-04-03T18:25:04.053" Title="How might I select specific data in an entry to be displayed when selecting an entry?" Tags="&lt;plugins&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19758" PostTypeId="1" AcceptedAnswerId="19759" CreationDate="2017-04-03T15:30:02.493" Score="6" ViewCount="442" Body="&lt;p&gt;How can I omit a certain tag from being cached?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a large page with a fair few queries but halfway down I am loading in a Freeform Form field which cannot be cached. But I'd like all of the content below it to be..&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-08-23T20:33:28.647" Title="How to omit certain tag from (% cache %)" Tags="&lt;templating&gt;&lt;cache&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19759" PostTypeId="2" ParentId="19758" CreationDate="2017-04-03T16:40:13.437" Score="5" Body="&lt;p&gt;Unfortunately, the vanilla &lt;code&gt;{% cache %}&lt;/code&gt; tag doesn't have a way to escape or ignore certain content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious workaround is to have more than one &lt;code&gt;{% cache %}&lt;/code&gt; tag, where the content that &lt;em&gt;shouldn't&lt;/em&gt; be cached sits between/outside those tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't do that, another option is to use &lt;em&gt;output buffering&lt;/em&gt; and injection. Basically, you cache whatever you need to cache, but &lt;code&gt;{% set %}&lt;/code&gt; the output to a variable, rather than rendering it immediately. The important bit: Inside the content that you cache, you put some sort of placeholder value where you want the un-cached content to render. This placeholder can be whatever you want, but make it something that isn't likely to also appear in the actual content (e.g. &lt;code&gt;&quot;%%%foobarbaz%%%&quot;&lt;/code&gt;). &#xA;Then, &lt;code&gt;{% set %}&lt;/code&gt; the un-cached content to a variable also – and finally, when you print the cached content, you use the &lt;code&gt;|replace&lt;/code&gt; filter to replace the placeholder value in the &lt;em&gt;cached&lt;/em&gt; content with the variable containing the &lt;em&gt;un-cached&lt;/em&gt; content. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set the cached content to a variable #}&#xA;{% set cachedContent %}&#xA;    {% cache globally using key craft.request.path %}&#xA;&#xA;        {# A bunch of taxing queries here #}&#xA;        &amp;lt;p&amp;gt;I am content.&amp;lt;/p&amp;gt;&#xA;&#xA;        {# Injection point for un-cached data #}&#xA;        %%%foobarbaz%%%&#xA;&#xA;        &amp;lt;p&amp;gt;I am more content.&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&#xA;{# Set the uncached content to a variable #}&#xA;{% set uncachedContent %}&#xA;    &amp;lt;p&amp;gt;I am some content that never is cached wooooo&amp;lt;/p&amp;gt;&#xA;{% endset %}&#xA;&#xA;{# Print the whole thing #}&#xA;{{ cachedContent|replace('%%%foobarbaz%%%', uncachedContent)|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;a href=&quot;https://github.com/benjamminf/craft-nocache&quot; rel=&quot;nofollow noreferrer&quot;&gt;there's a plugin&lt;/a&gt; which may work for you.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-08-23T20:33:28.647" LastActivityDate="2017-08-23T20:33:28.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19760" PostTypeId="2" ParentId="13852" CreationDate="2017-04-03T16:55:34.933" Score="2" Body="&lt;p&gt;I was just looking for a way to do something similar without Javascript. Someone has released a cache escaping extension giving you the ability to wrap content you want esacped with a &lt;code&gt;{% nocache %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    This will be cached&#xA;    {% nocache %}&#xA;        This won't be&#xA;    {% endnocache %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Extension: &lt;a href=&quot;https://github.com/benjamminf/craft-nocache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-nocache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="335" LastActivityDate="2017-04-03T16:55:34.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19761" PostTypeId="2" ParentId="19754" CreationDate="2017-04-03T18:11:29.857" Score="1" Body="&lt;p&gt;From your code examples, I believe the issue if you have a file named  &lt;code&gt;adjusters/BusinessLogicAdjusters.php&lt;/code&gt;, but the class name for that file is &lt;code&gt;BusinessLogic_TaxRemover&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-03T18:11:29.857" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19762" PostTypeId="2" ParentId="19756" CreationDate="2017-04-03T18:15:22.473" Score="1" Body="&lt;p&gt;One way to do this would be to use &lt;a href=&quot;https://craftcms.com/docs/templating/craft.tags#search&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;search&lt;/code&gt;&lt;/a&gt; instead of &lt;code&gt;relatedTo()&lt;/code&gt;, which will return a &lt;code&gt;searchScore&lt;/code&gt; attribute an all of the resulting elements that is a measure of how well the search match was.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-03T18:15:22.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19763" PostTypeId="2" ParentId="19757" CreationDate="2017-04-03T18:25:04.053" Score="0" Body="&lt;p&gt;Probably a dozen different ways to tackle this, but I'd probably use Craft's flexible &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relationship&lt;/a&gt; engine by creating a &lt;code&gt;Bios&lt;/code&gt; channel and a &lt;code&gt;Jobs&lt;/code&gt; channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Bios&lt;/code&gt; channel would have an &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries field&lt;/a&gt; assigned to its field layout with its source set to &lt;code&gt;Jobs&lt;/code&gt; and it would allow for multiple selections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when creating a new &lt;code&gt;Bios&lt;/code&gt; entry, you'd select the &lt;code&gt;Job&lt;/code&gt;(s) for that person.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could pull them out into the front-end however you'd like at that point.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-03T18:25:04.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19764" PostTypeId="2" ParentId="19666" CreationDate="2017-04-03T18:55:28.927" Score="1" Body="&lt;p&gt;So to update this question incase someone happens to stumble across it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Sprout SEO you need to enable the &lt;code&gt;Enable custom metadata variable&lt;/code&gt; option under 'Advanced' in the settings menu. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there I set a twig variable with the value of my metadata title, in this case &lt;code&gt;{%- set metaTitle = entry.metadata.title -%}&lt;/code&gt; and attach it to my AJAX wrapper element with something like &lt;code&gt;data-title=&quot;{{ metaTitle }}&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I load each page via javascript I just do a little something like this &lt;code&gt;document.title = $('&amp;lt;div /&amp;gt;').append(html).children('.js-ajax-wrapper').data('title');&lt;/code&gt; once the content is loaded in and my page title is updated.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-04-03T18:55:28.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19765" PostTypeId="2" ParentId="19756" CreationDate="2017-04-03T19:03:20.500" Score="3" Body="&lt;p&gt;If you're only trying to find related articles based on elements (ie tags, categories, entries, etc), you can use my &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Similar&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a basic example, more info in the repo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for similarEntry in similarEntriesByTags %}&#xA;        &amp;lt;li&amp;gt;{{ similarEntry.title }} ({{ similarEntry.count }} tags in common)&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-04-03T19:03:20.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19766" PostTypeId="2" ParentId="19747" CreationDate="2017-04-03T19:21:36.930" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;I'm just having a hard time figuring out what options there are.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The options are virtually limitless. You can put almost anything you want into a &lt;code&gt;safeUp&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 is still in beta, and probably will be for another six months or so. They are likely to expand on the current docs for migrations, but I wouldn't expect to see that until much closer to the official release.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-04-03T19:21:36.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19767" PostTypeId="1" CreationDate="2017-04-03T19:39:25.560" Score="1" ViewCount="722" Body="&lt;p&gt;Because Commerce doesn't support &lt;a href=&quot;https://craftcms.uservoice.com/forums/295386-commerce/suggestions/17939776-product-title-format&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig product title formatting&lt;/a&gt; right now, I built a custom plugin to automatically update the title field upon save of a product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the part from the plugin where I am hooking into the &lt;code&gt;commerce_products.onBeforeSaveProduct&lt;/code&gt; event:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_products.onBeforeSaveProduct', function(Event $event) {&#xA;    $product = $event-&amp;gt;params['product'];&#xA;&#xA;    if (count($product-&amp;gt;collection))&#xA;    {&#xA;        $collection = $product-&amp;gt;collection[0]-&amp;gt;title;&#xA;        $titlePieces[] = $collection;&#xA;    }&#xA;&#xA;    $modelNumber = $product-&amp;gt;modelNumber;&#xA;    $titlePieces[] = $modelNumber;&#xA;&#xA;    $titleSuffix = $product-&amp;gt;titleSuffix;&#xA;    $titlePieces[] = $titleSuffix;&#xA;&#xA;    $product-&amp;gt;getContent()-&amp;gt;title = implode(' ', $titlePieces);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All that works great when I manually edit a product, but we have about 500 products in the system right now, and nobody really wants to open up every entry and manually save it. The hope was that we could do something in the CP to trigger an event to re-save all product entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went into the Commerce settings for each Product Type and re-saved the settings, which did trigger a &quot;Resaving Furniture products&quot; task. But, that didn't appear to update the title field for all the products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ideas on how I could avoid manually re-saving all entries?&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2017-04-04T01:28:32.100" Title="Craft Commerce Trigger Event to Re-save All Products" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19768" PostTypeId="2" ParentId="14061" CreationDate="2017-04-03T19:47:29.933" Score="2" Body="&lt;p&gt;I finally released a first version of the plugin: &lt;a href=&quot;https://superbig.co/plugins/imgix&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/imgix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-04-03T19:47:29.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19769" PostTypeId="1" CreationDate="2017-04-03T22:31:59.633" Score="2" ViewCount="274" Body="&lt;p&gt;I am writing a plugin and want to unit test my services.  I am following the example given here: &lt;a href=&quot;https://github.com/amacneil/cocktailrecipes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/amacneil/cocktailrecipes&lt;/a&gt;. The problem is when I run my application, I get a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal Error: Class 'TournamentData_IndividualService' not found.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the problem portion of the test code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;use \Mockery as m;&#xA;use PHPUnit_Framework_TestCase;&#xA;&#xA;class TournamentData_IndividualServiceTest extends PHPUnit_Framework_TestCase&#xA;{&#xA;    public function setUp()&#xA;    {&#xA;        $this-&amp;gt;ingredientRecord = m::mock('Craft\TournamentData_IndividualRecord');&#xA;        $this-&amp;gt;service = new TournamentData_IndividualService($this-&amp;gt;ingredientRecord);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my service code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TournamentData_IndividualService extends BaseApplicationComponent&#xA;{&#xA;    protected $individualRecord;&#xA;&#xA;    public function __construct($individualRecord = null)&#xA;    {&#xA;        $this-&amp;gt;individualRecord = $individualRecord;&#xA;        if(is_null($this-&amp;gt;individualRecord)) {&#xA;            $this-&amp;gt;individualRecord = TournamentData_IndividualRecord::model();&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One more note, just in case this has the answer to what I'm looking for, I have taken a look at &lt;a href=&quot;https://github.com/selvinortiz/craft.loath&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/selvinortiz/craft.loath&lt;/a&gt;, but I wasn't able to follow what its setup code was accomplishing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6529" LastEditorUserId="4466" LastEditDate="2017-04-04T09:42:01.367" LastActivityDate="2017-04-04T09:42:01.367" Title="Class not found error when running unit test on a plugin service" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19770" PostTypeId="2" ParentId="19704" CreationDate="2017-04-03T22:37:02.403" Score="5" Body="&lt;p&gt;The answer is to create a custom plugin that will read the json files from the folders in the public directory, parse the json, and pull them into the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative solution is to use Craft custom config files. (Not the answer you're looking for but would work very well.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;craft/config&lt;/code&gt; create a file like &lt;code&gt;localedata.php&lt;/code&gt; and make it something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * Return an array indexed by locale code&#xA; */&#xA;return [&#xA;    'ar' =&amp;gt; [&#xA;        'serviceName' =&amp;gt; 'arabic',&#xA;        'language' =&amp;gt; 'ar',&#xA;        'textDirection' =&amp;gt; 'rtl',&#xA;        'socialMediaButtons' =&amp;gt; ['twitter', 'facebook'],&#xA;    ],&#xA;    'en' =&amp;gt; [&#xA;        //...&#xA;    ],&#xA;    // etc&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;    If the current locale is `ar` (Arabic) then this will set `localeData`&#xA;    from the array index &quot;ar&quot; in the config file&#xA;#}&#xA;{% set localeData = craft.config.get(craft.locale, 'localedata') %}&#xA;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;{{ craft.locale }}&quot; dir=&quot;{{ localeData.textDirection }}&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  ...&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="593" LastActivityDate="2017-04-03T22:37:02.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19771" PostTypeId="2" ParentId="19769" CreationDate="2017-04-03T22:50:21.723" Score="2" Body="&lt;p&gt;I figured out the problem, I needed to load in the service, and then my service needed to load in the model and record. So for the test code, I added the function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function loadServices()&#xA;{&#xA;    require_once __DIR__ . '/../services/TournamentData_IndividualService.php';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for my setUp function, it became:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;use \Mockery as m;&#xA;use PHPUnit_Framework_TestCase;&#xA;class TournamentData_IndividualServiceTest extends PHPUnit_Framework_TestCase&#xA;{&#xA;    public function setUp()&#xA;    {&#xA;        $this-&amp;gt;loadServices();&#xA;        $this-&amp;gt;ingredientRecord = m::mock('Craft\TournamentData_IndividualRecord');&#xA;        $this-&amp;gt;service = new TournamentData_IndividualService($this-&amp;gt;ingredientRecord);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my service method, I added require statements for the model and record like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;require_once __DIR__ . '/../models/TournamentData_IndividualModel.php';&#xA;require_once __DIR__ . '/../records/TournamentData_IndividualRecord.php';&#xA;&#xA;namespace Craft;&#xA;&#xA;class TournamentData_IndividualService extends BaseApplicationComponent&#xA;{&#xA;    protected $individualRecord;&#xA;&#xA;    public function __construct($individualRecord = null)&#xA;    {&#xA;        $this-&amp;gt;individualRecord = $individualRecord;&#xA;        if(is_null($this-&amp;gt;individualRecord)) {&#xA;            $this-&amp;gt;individualRecord = TournamentData_IndividualRecord::model();&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ironically, I managed to find the answer to my problem almost immediately after deciding to ask the community, but hopefully this helps somebody else in the future!&lt;/p&gt;&#xA;" OwnerUserId="6529" LastActivityDate="2017-04-03T22:50:21.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19772" PostTypeId="1" AcceptedAnswerId="19773" CreationDate="2017-04-04T00:07:13.220" Score="4" ViewCount="502" Body="&lt;p&gt;Pretty straight forward here, I'd like to use MailTrap for &lt;code&gt;devMode&lt;/code&gt; and then use an SMTP service (Mandrill or like) for production. I looked through the &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;noreferrer&quot;&gt;General Config Settings&lt;/a&gt; docs but didn't see anything that lent itself to being SMTP related. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="205" LastActivityDate="2017-08-02T20:35:44.900" Title="Can I set an environment var for SMTP mail servers?" Tags="&lt;config&gt;&lt;emails&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19773" PostTypeId="2" ParentId="19772" CreationDate="2017-04-04T00:13:06.527" Score="4" Body="&lt;p&gt;Not an easy way to do this in Craft 2, but this is possible in the upcomgin Craft 3 (currently in beta) using &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/configuration.md#application-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft/config/app.php&lt;/code&gt;&lt;/a&gt;, which is multi-environment aware. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-04T00:13:06.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19774" PostTypeId="1" AcceptedAnswerId="19801" CreationDate="2017-04-04T00:34:05.677" Score="1" ViewCount="220" Body="&lt;p&gt;I have a client with several retail locations. They would like a single unified website for the chain, and many of the products will be the same at each location, but each location will need to handle its own orders, including fulfillment and inventory. Users should only have access to orders that pertain to their location (similar to how sections can be limited to certain users). Is there a native way to do this with Craft Commerce, or a plugin that would achieve the same thing?&lt;/p&gt;&#xA;" OwnerUserId="6527" LastActivityDate="2017-04-05T05:10:06.740" Title="Does Craft Commerce support multi-channel fulfillment and inventory?" Tags="&lt;plugin-craftcommerce&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19775" PostTypeId="2" ParentId="19767" CreationDate="2017-04-04T01:19:44.013" Score="1" Body="&lt;p&gt;There are probably many approaches, but you could write a simple console command (great guide here: &lt;a href=&quot;https://spin.atomicobject.com/2015/06/16/craft-console-plugin/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://spin.atomicobject.com/2015/06/16/craft-console-plugin/&lt;/a&gt;) in a plugin to do this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's one I prepared earlier to use as an example...in my case I am doing this because I am using a pre-parse field that pulls in some external markdown content, but the principle is the same (assuming re-saving the entries updates the title field as you hope - but should take only a few mins to try!) - you'll need to adapt for commerce (Commerce_Product I think):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class BusinessLogicCommand extends BaseCommand&#xA;{&#xA;public function actionResaveFODEntries()&#xA;{&#xA;    print(&quot;### Resaving entries for Fundamentals Of Digital\n(So search indexes are updated by causing PreParse to re-pull in the generated content).\n\n&quot;);&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'fundamentalsOfDigital';&#xA;&#xA;&#xA;    foreach ($criteria as $entry)&#xA;    {&#xA;        $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;        if (!$success)&#xA;        {&#xA;            print(&quot;Failed to save entry $entry-&amp;gt;title\n&quot;);&#xA;        }        &#xA;        else&#xA;        {&#xA;            print(&quot;Saved $entry-&amp;gt;title\n&quot;);&#xA;        }&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually run the command I do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;php yiic-env.php --env=&quot;console&quot; businesslogic resaveFODEntries&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...note the use of a specific environment, &lt;code&gt;console&lt;/code&gt; in there - this is defined in my config/general.php with appropriate settings&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-04-04T01:28:32.100" LastActivityDate="2017-04-04T01:28:32.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19776" PostTypeId="2" ParentId="19751" CreationDate="2017-04-04T07:31:42.897" Score="1" Body="&lt;p&gt;I solved the problem by setting up a new installation and then importing my backup database into that new installation. Now everything is there again and works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must admit I haven't found the reason why this problem occurred. But the solution was ultimately quick and easy.&lt;/p&gt;&#xA;" OwnerUserId="5199" LastActivityDate="2017-04-04T07:31:42.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19777" PostTypeId="1" AcceptedAnswerId="19781" CreationDate="2017-04-04T08:58:07.193" Score="3" ViewCount="74" Body="&lt;p&gt;I am new at Craft CMS so have patience with me (and my English).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if I am doing this right, but I have a link (URL) from my index.html, and I want to display the specific content on the _entry.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Index.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news') %}&#xA;    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when I click on that link I want only to display the content related to that &lt;code&gt;entry.url&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I click the link now, all my entries will show in _entry.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_entry.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').type('news') %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just want to show the specific content for that section.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested this and it worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').type('news').slug(craft.request.getSegment(2)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't know why?&lt;/p&gt;&#xA;" OwnerUserId="6532" LastEditorUserId="153" LastEditDate="2017-04-04T10:24:35.927" LastActivityDate="2017-05-04T19:41:40.010" Title="Find one section in a for loop based on url" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19779" PostTypeId="1" AcceptedAnswerId="19795" CreationDate="2017-04-04T10:59:50.320" Score="2" ViewCount="170" Body="&lt;p&gt;&lt;code&gt;localeEnabled(false)&lt;/code&gt; does not seem to do anything or I'm misunderstanding its use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm on Craft 2.6 and have this code: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for region in Craft.entries.section('handle').level(1).localeEnabled(false) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This section is a structure with 3 top level categories which are enabled or disabled for certain languages.&lt;br&gt;&#xA;If I'm viewing the site in the Spanish locale for example, I'm only seeing the entries that have Spanish enabled, because they're automatically filtered by Craft to my current Locale as is how Craft works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought, &lt;code&gt;localeEnabled(false)&lt;/code&gt; would get all of the entries in all locales.&lt;br&gt;&#xA;But unfortunately, it doesn't work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or do I misunderstand the function of that command? The explanation in the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#localeEnabled&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; really read as if my understanding of the function is correct.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-06-29T16:03:58.967" Title="Use of localeEnabled(): bug or misunderstanding?" Tags="&lt;entries&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19780" PostTypeId="1" CreationDate="2017-04-04T11:04:02.427" Score="3" ViewCount="91" Body="&lt;p&gt;Okay so I have &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; setup with Stripe. I have entered in the connection details and selected the currency to pounds in the Stripe credentials in the plugin settings. However when I view the charges the money is correct in pounds but the symbol is a dollar sign... I need to change it to the pound symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across with this issue and have I missed something of.. EG. Config file needs currency symbol override etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this makes sense.&lt;/p&gt;&#xA;" OwnerUserId="6533" LastEditorUserId="57" LastEditDate="2017-04-04T18:34:32.763" LastActivityDate="2017-04-24T10:51:21.420" Title="Change currency in Craft CMS using the Charge plugin" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19781" PostTypeId="2" ParentId="19777" CreationDate="2017-04-04T11:12:21.687" Score="3" Body="&lt;p&gt;Just use &lt;code&gt;{{ entry.title }}&lt;/code&gt; on your dynamic _entry template to output that specific title. You were looping through all the news entries again on the dynamic _entry template and listing each one. Any other custom fields on that page/section can be accessed simply by &lt;code&gt;{{ entry.myCustomFieldName }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="57" LastEditDate="2017-04-04T18:45:28.673" LastActivityDate="2017-04-04T18:45:28.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19782" PostTypeId="1" AcceptedAnswerId="19968" CreationDate="2017-04-04T11:26:57.487" Score="2" ViewCount="83" Body="&lt;p&gt;The docs of the &lt;a href=&quot;https://github.com/ethercreative/simplemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;SimpleMap&lt;/a&gt; plugin mention it's possible to output only part of the full location, e.g. just the country by using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myMapField.country_short }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but in my project I get this error when I try doing so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;&#xA;Craft\SimpleMap_MapModel and its behaviors do not have a method or closure named &quot;country&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same result without the _short suffix.&#xA;The plugin is set up properly as I can correctly output full address, lat, lng, zoom values like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myMapField.address }}&#xA;{{ myMapField.lat }}&#xA;{{ myMapField.lng }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just splitting up the full address results in the above error. What's going wrong?&lt;/p&gt;&#xA;" OwnerUserId="6534" LastEditorUserId="57" LastEditDate="2017-04-04T18:40:26.390" LastActivityDate="2017-04-14T12:05:34.020" Title="How do I output only country part of location field using the SimpleMap plugin?" Tags="&lt;plugin-simplemap&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19783" PostTypeId="1" AcceptedAnswerId="19785" CreationDate="2017-04-04T14:34:35.053" Score="2" ViewCount="192" Body="&lt;p&gt;I'm submitting a payment form via standard POST submission (not AJAX) to the current page URL, with an action value of &lt;code&gt;commerce/payments/pay&lt;/code&gt;. To double-check my work, I've also copy + pasted their &lt;a href=&quot;https://craftcommerce.com/docs/payment-form-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;example form&lt;/a&gt;, and I'm still getting the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done this a thousand times before, so I'm going a bit crazy trying to figure out what's different in this project. Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2017-04-05T14:15:39.433" Title="Payment form submission is returning a curl error! ([curl] 3: &lt;url&gt; malformed [url])" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19784" PostTypeId="2" ParentId="19704" CreationDate="2017-04-04T14:37:49.620" Score="1" Body="&lt;p&gt;After a bit more research, I found that there is additional data associated with the locales. &lt;a href=&quot;https://craftcms.com/support/locale-data-from-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; article was of help. I was able to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;{{ craft.locale }}&quot; dir=&quot;{{ craft.i18n.getLocaleData().orientation }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to set the &lt;code&gt;dir&lt;/code&gt; attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all other configuration data, Sam's answer works well.&lt;/p&gt;&#xA;" OwnerUserId="6518" LastActivityDate="2017-04-04T14:37:49.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19785" PostTypeId="2" ParentId="19783" CreationDate="2017-04-04T15:06:33.537" Score="1" Body="&lt;p&gt;For those interested, here was the solution: The payment method for Authorize.net wasn't completely filled in; there was no endpoint set. Thus, it was of course failing when it sent the curl request, because there was no protocol, domain, or anything else other than the query string for the payment form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Providing the payment method with an endpoint in the CP resolved this issue.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastEditorUserId="4086" LastEditDate="2017-04-05T14:15:39.433" LastActivityDate="2017-04-05T14:15:39.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19786" PostTypeId="1" CreationDate="2017-04-04T15:14:37.500" Score="2" ViewCount="139" Body="&lt;p&gt;Bit of a generalist question but in case someone has anything to share... I am thinking of building a campaign site in Craft that will register 15,000+ users. Is there anything I should be aware of or pay particular attention to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The users will have a front end registration and a dozen custom fields.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2017-04-04T18:52:10.117" LastActivityDate="2017-04-05T00:56:03.893" Title="Thousands of user registrations advice" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19788" PostTypeId="1" AcceptedAnswerId="19800" CreationDate="2017-04-04T16:35:22.717" Score="2" ViewCount="857" Body="&lt;p&gt;I'm working on getting our site set up with Craft Commerce, and I am currently working on a sidebar cart for the site. I've found examples on how to add products to the cart using AJAX and jQuery and have gotten that working successfully. However, I'm struggling to understand how to update the cart listing after a successful response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the sidebar cart template set up as an include. Is it possible to use AJAX and jQuery to reload just the sidebar cart include after the successful response? Or is there a better way to show the updated contents?&lt;/p&gt;&#xA;" OwnerUserId="4468" LastActivityDate="2017-04-05T01:07:36.107" Title="AJAX reload include template" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19789" PostTypeId="2" ParentId="19734" CreationDate="2017-04-04T17:01:04.177" Score="1" Body="&lt;p&gt;I ended up doing it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/featured-apps.json' =&amp;gt; [&#xA;  'elementType' =&amp;gt; 'Entry',&#xA;  'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'apps',&#xA;    'appFeatured' =&amp;gt; '1',&#xA;  ],&#xA;  'transformer' =&amp;gt; function (EntryModel $entry) { &#xA;    $logos = [];&#xA;    foreach ($entry-&amp;gt;appLogo as $image) {&#xA;      $logos[] = $image-&amp;gt;url;&#xA;    }&#xA;&#xA;    $videos = [];&#xA;    foreach ($entry-&amp;gt;appVideo as $video) {&#xA;      $videos[] = $video-&amp;gt;url;&#xA;    }&#xA;&#xA;    return [&#xA;      'title' =&amp;gt; $entry-&amp;gt;title,&#xA;      'logo' =&amp;gt; $logos,&#xA;      'video' =&amp;gt; $videos,&#xA;    ];&#xA;  }&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6512" LastActivityDate="2017-04-04T17:01:04.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19790" PostTypeId="1" CreationDate="2017-04-04T17:20:22.603" Score="3" ViewCount="298" Body="&lt;p&gt;I have an entry with one asset field and i need to determine if the 'kind' of asset is either 'json' file or 'video' file. Basically I swap my HTML based on the return 'kind'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated. Craft CMS beginner.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set videoEntries =  craft.entries({ section: 'mediaRoomVideos' }).find %}&#xA;{% if videoEntries is not empty %}&#xA;&#xA;    {% for entry in videoEntries %}&#xA;        {% set asset = entry.mediaVideo.first() %}&#xA;&#xA;        {% if asset %}&#xA;&#xA;            {% set json = asset.kind('json') %}&#xA;                {% if json %}&#xA;                    Do Embedded Video&#xA;                {% else %}&#xA;&#xA;                    &amp;lt;video width=&quot;320&quot; height=&quot;240&quot; controls&amp;gt;&#xA;                        &amp;lt;source src=&quot;{{ entry.mediaVideo.first.getUrl() }}&quot;&amp;gt;&#xA;                    &amp;lt;/video&amp;gt;&#xA;&#xA;                {% endif %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6536" LastEditorUserId="45" LastEditDate="2017-04-04T20:04:14.507" LastActivityDate="2017-04-04T20:04:14.507" Title="Get Kind of Asset Field" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19791" PostTypeId="1" CreationDate="2017-04-04T17:30:08.500" Score="2" ViewCount="37" Body="&lt;p&gt;Hello I haven't touched my clients webpage for some time and a week ago a problem started happening when it called the item description and size from the POST. It started displaying &amp;quot; instead of the regular quotations. Does anyone have any experience with this?&lt;a href=&quot;https://i.stack.imgur.com/OdDVS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdDVS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5246" LastActivityDate="2017-04-04T17:30:08.500" Title="HTML renders &amp;quot;" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19794" PostTypeId="2" ParentId="19790" CreationDate="2017-04-04T18:25:24.767" Score="4" Body="&lt;pre&gt;&lt;code&gt;{% if json %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replaced with. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if asset.kind == 'json' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6536" LastEditorUserId="57" LastEditDate="2017-04-04T19:03:17.230" LastActivityDate="2017-04-04T19:03:17.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19795" PostTypeId="2" ParentId="19779" CreationDate="2017-04-04T18:31:55.713" Score="1" Body="&lt;p&gt;It's a bit awkward, but you're understanding is correct.  My guess is you probably need to add a &lt;code&gt;.status(null)&lt;/code&gt; to take into account the elements global status as well.  &lt;code&gt;localeEnabled&lt;/code&gt;, by itself, just checks the element's locale status.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-04T18:31:55.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19796" PostTypeId="2" ParentId="19782" CreationDate="2017-04-04T18:44:25.963" Score="1" Body="&lt;p&gt;Never used the plugin, but from the docs:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;parts&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This contains the locations address, broken down into its constituent parts. All values are optional so you'll need to have checks on any you use to make sure they exist.&#xA;A list of the available values can be found here.&#xA;To access the short version of any part, append _short to the end of its name. E.g. {{ myMapField.country_short }}.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Sounds like the country info is optional and may not exist on the model, hence the note to check if it exists or not first.&lt;/p&gt;&#xA;&lt;p&gt;i.e.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if myMapField.country_short is defined %}&#xA;    {{ myMapField.country_short }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-04-04T18:44:25.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19797" PostTypeId="2" ParentId="19786" CreationDate="2017-04-04T18:58:27.497" Score="0" Body="&lt;p&gt;Should be easily doable, with the usual caveats of make sure you've planned hardware/resources wise.  i.e. if you expect 15k users to all register over a 3 hour period, you'll want to make sure you're able to scale to meet those resources requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CP in Craft 2 will start to show some performance/scaling issues on things like the Users index page once you start to reach the several hundred thousand user mark (again depending on hardware and resources depends on exactly how many).  That's one of the big areas we've addressed in Craft 3 as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-04T18:58:27.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19799" PostTypeId="2" ParentId="19786" CreationDate="2017-04-05T00:56:03.893" Score="1" Body="&lt;p&gt;I would also think about spam bot registrations, which can be a big problem, and the more popular your site, the more attempts you're likely to see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd add something like Google recaptcha to avoid that...we use this: &lt;a href=&quot;https://github.com/aberkie/craft-recaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aberkie/craft-recaptcha&lt;/a&gt; - and have had zero spam registrations since launch.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With our old site we used to get them all the time (not Craft but a form is a form, so that doesn't really matter I think!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-05T00:56:03.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19800" PostTypeId="2" ParentId="19788" CreationDate="2017-04-05T01:07:36.107" Score="2" Body="&lt;p&gt;There are two main approaches in general to updating your page in response to changes in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The first is just an ajax load in of a partial template.&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really just as simple as something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$cart.load(&quot;/_ajax-injects/cart.html&quot;).fadeIn('fast');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....which (assuming &lt;code&gt;$cart&lt;/code&gt; points at a div holding your displayed cart) - would load in over the old cart a new cart (assuming &lt;code&gt;templates/_ajax-injects/cart.html&lt;/code&gt; has such a partial template in it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is very easy to implement, but does not look wonderfully finessed as there will be a visible result of replacing a large section of the page at one go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The second approach is using the json &lt;code&gt;response.cart&lt;/code&gt; object to update just the appropriate fields within your already displayed cart.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is considerably trickier.  Each of the fields, such as your item quantities, subtotals, tax, shipping etc must have an identifying class or id on them, and then you parse through the &lt;code&gt;response.cart&lt;/code&gt; object grabbing the appropriate values from that and inserting them into those fields.  You also need to deal with e.g. removing &lt;code&gt;lineItem&lt;/code&gt; rows if the &lt;code&gt;qty&lt;/code&gt; is zero and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot more work, however once implemented this is a visually much more finessed approach as just the fields that need updating get updated.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-05T01:07:36.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19801" PostTypeId="2" ParentId="19774" CreationDate="2017-04-05T05:10:06.740" Score="2" Body="&lt;p&gt;The short answer is, out of the box, no it does not, currently.  Inventory handling is quite basic at the moment, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably deal with a lot of the access stuff via Craft users &amp;amp; permissions, but there's no doubt in my mind this would involve a very substantial amount of custom plugin development work, and I'm reasonable sure no such plugin currently exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce is still a relatively young product, so who knows about the future, but right now it would not personally be my first choice for this sort of project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You could perhaps tackle them as separate installations and use things like the ElementAPI to push product content between the systems, though, if the key issue is content sharing as opposed to one unified back end).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-05T05:10:06.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19802" PostTypeId="1" AcceptedAnswerId="19812" CreationDate="2017-04-05T07:20:11.750" Score="2" ViewCount="25" Body="&lt;p&gt;I've created an asset source: 'restricted uploads' and a user: 'Jim', who is a member of the 'staff' User Group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither 'Jim' or the 'staff' group have any privileges for the 'restricted uploads' source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Jim logs into the admin panel and goes to 'Assets' in the sidebar, he can't see the &quot;restricted uploads&quot; source (as expected). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if Jim opens a file selection modal which includes access to the &quot;restricted upload&quot; source he can see &quot;restricted uploads&quot; listed in the modal source sidebar, and can select files from that folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't Jim's missing asset &quot;View source&quot; privilege prevent him from being able to see the files in the &quot;restricted upload&quot; folder?&lt;/p&gt;&#xA;" OwnerUserId="6541" LastActivityDate="2017-04-05T17:55:56.383" Title="Shouldn't the asset &quot;View source&quot; privilege limit access to an asset source in the selection modal?" Tags="&lt;assets&gt;&lt;users&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19803" PostTypeId="1" CreationDate="2017-04-05T09:02:00.170" Score="2" ViewCount="212" Body="&lt;p&gt;I have several png images that when transformed from png to jpg, the alpha layer is transformed to an horizontally lined pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I have to keep them as png, wich is in my case unnecessary and a drastic data load issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem appears in production, wich is an ArcusTech server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone knows what it could be ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="5263" LastActivityDate="2017-04-05T17:58:07.780" Title="When image transforming png to jpg, alpha layer become lined" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19804" PostTypeId="1" AcceptedAnswerId="19806" CreationDate="2017-04-05T09:19:32.077" Score="3" ViewCount="122" Body="&lt;p&gt;And why clearing cache is not enough?&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-05T11:49:12.813" Title="Why if I change ie. drop down value, all entries needs to be resaved to take changes? How can I prevent it?" Tags="&lt;entries&gt;&lt;cache&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19805" PostTypeId="1" AcceptedAnswerId="19918" CreationDate="2017-04-05T10:36:42.877" Score="2" ViewCount="95" Body="&lt;p&gt;Our Shop-Customers should upload an image per Item they add to the basket. I managed to upload the image and insert it to an asset folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i assign the image to the lineItem (maybe as an option)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This didn't work, as options is not writable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onBeforeSaveLineItem', function($event){&#xA;    $imageId = craft()-&amp;gt;ultraschall-&amp;gt;uploadCustomerImage(); // add image to asset folder&#xA;    if(isset($imageId) &amp;amp;&amp;amp; is_numeric($imageId)){&#xA;        $lineItem = $event-&amp;gt;params['lineItem'];&#xA;        $lineItem-&amp;gt;options['imageId'] = $imageId;&#xA;    } &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2017-04-12T08:08:50.993" Title="Assigning Image to lineItem?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19806" PostTypeId="2" ParentId="19804" CreationDate="2017-04-05T11:49:12.813" Score="3" Body="&lt;p&gt;Dropdown fields (and other simple option-based fieldtypes such as Radio Buttons, Checkboxes and Multi Select) are pretty dumb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By design, whenever an Entry with a Dropdown field is saved, Craft simply grabs the selected value for that Dropdown field and stores it in the database for that Entry. Unlike relational fields such as Assets or Categories, &lt;em&gt;there's no &quot;connection&quot; (i.e. relation) between the selected value being stored, and the Dropdown fields' option where the value was pulled from&lt;/em&gt; – this means that if you later decide to rename a Dropdown fields' option value from e.g. &lt;code&gt;&quot;foo&quot;&lt;/code&gt; to &lt;code&gt;&quot;bar&quot;&lt;/code&gt;, the selected value for any existing entries will &lt;em&gt;not&lt;/em&gt; change/update. In other words, any entries that had &lt;code&gt;&quot;foo&quot;&lt;/code&gt; selected, will still have &lt;code&gt;&quot;foo&quot;&lt;/code&gt; stored as their value for that particular field, even if that option doesn't exist anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The easiest way to bulk update entries' selected Dropdown values is probably to execute an SQL query.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like the below should work (the following example would update the selected value for a field with the handle &lt;code&gt;myDropdownField&lt;/code&gt; from &lt;code&gt;&quot;foo&quot;&lt;/code&gt; to &lt;code&gt;&quot;bar&quot;&lt;/code&gt;, for &lt;em&gt;all&lt;/em&gt; entries that have &lt;code&gt;&quot;foo&quot;&lt;/code&gt; selected):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UPDATE craft_content SET field_myDropdownField = 'bar' WHERE field_myDropdownField = 'foo';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To run this query, you'll need some sort of SQL client – for Mac, &lt;a href=&quot;https://www.sequelpro.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sequel Pro&lt;/a&gt; is very decent, and free. You can also use something like &lt;a href=&quot;https://www.adminer.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adminer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and don't forget to back up your database before running any manual SQL query, and to clear out your caches after you're done.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-04-05T11:49:12.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19807" PostTypeId="1" CreationDate="2017-04-05T12:13:20.693" Score="1" ViewCount="61" Body="&lt;p&gt;Is there any plugin for Tag that will be like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Text field in a front-end entry form where user can add multiple tags.&lt;/li&gt;&#xA;&lt;li&gt;After pressing the save button, the plugin should:&#xA;check for every tag, whether it exists already (and create the tag if not).&lt;/li&gt;&#xA;&lt;li&gt;If tags exists it will act like autocomplete.&lt;/li&gt;&#xA;&lt;li&gt;save the tags together with the rest of the entry form (including the text field with the user defined tags)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T19:52:49.780" LastActivityDate="2017-05-09T19:52:49.780" Title="Plugins for Tags" Tags="&lt;plugins&gt;&lt;tags&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19808" PostTypeId="1" AcceptedAnswerId="19814" CreationDate="2017-04-05T12:37:36.207" Score="3" ViewCount="560" Body="&lt;p&gt;I am working on an intranet in Craft CMS.&#xA;Front-end editing is a very important part of this, and I want to get it perfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it is now, the live preview is perfect for what I want, it provides markup and styling for all field types. If I where to make a custom front-end form for each entry type, including advanced matrix / neo fields etc. the workload would be huge, and I would probably end up doing something similar to what live preview already do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I am trying to get live edit to work in front-end, or make it look like it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I just have a link to the CP when pressing &quot;edit&quot; on an entry. And have made use of a hook on afterSave to pick up the front-end url and send the user back to front-end when the entry is saved. This works semi seamless, but I cant figure out a way to trigger the live preview from php, or maybe how to inject some JS when editing an entry after pressing the link in front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the main question;&#xA;Should I keep going with the &quot;trick&quot; to just send the user back and forth between front-end and CP, or should I get the live preview to work front-end? If so, what is the best approach here, I could expose the CP recourses to the front-end, but that sounds like a horrible idea with many concerns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Mathias&lt;/p&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="22" LastEditDate="2017-05-09T19:50:19.857" LastActivityDate="2017-05-09T19:50:19.857" Title="Front-end Editing, with Live Preview" Tags="&lt;live-preview&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19809" PostTypeId="1" AcceptedAnswerId="21265" CreationDate="2017-04-05T13:36:30.867" Score="4" ViewCount="696" Body="&lt;p&gt;How would I go about to get the author from the current version / revision of the entry I'm on? Im trying to get &quot;last updated by&quot; in frontend, but authorId on the entry seems to be the original author, not the last that edited it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-21T21:29:48.410" Title="Get the author of current entry version?" Tags="&lt;entries&gt;&lt;author&gt;&lt;entry-versions&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19810" PostTypeId="2" ParentId="19809" CreationDate="2017-04-05T13:36:30.867" Score="4" Body="&lt;p&gt;You have to write a template variable that makes &lt;code&gt;getVersionsByEntryId()&lt;/code&gt; available in Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getVersionsByEntryId($entryId, $localeId, $limit = 1, $includeCurrent = true)&#xA;{&#xA;    return craft()-&amp;gt;entryRevisions-&amp;gt;getVersionsByEntryId($entryId, $localeId, $limit, $includeCurrent);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now access an entry’s versions and get the current version’s creator like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set versions = craft.businessLogic.getVersionsByEntryId(entry.id, entry.locale) %}&#xA;{% set author = versions|length ? versions[0].creator : entry.author %}&#xA;&#xA;{{ author.fullName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-05T20:58:20.000" LastActivityDate="2017-07-05T20:58:20.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19811" PostTypeId="2" ParentId="928" CreationDate="2017-04-05T16:19:41.267" Score="3" Body="&lt;p&gt;This question is from a long time ago, but nowadays there's a great 3rd-party plugin that lets you do this: &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-05T16:19:41.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19812" PostTypeId="2" ParentId="19802" CreationDate="2017-04-05T17:55:56.383" Score="0" Body="&lt;p&gt;There is an issue filed for this here &lt;a href=&quot;https://github.com/craftcms/cms/issues/887&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/887&lt;/a&gt; that you might want to consider thumbs-upping or commenting on.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-05T17:55:56.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19813" PostTypeId="2" ParentId="19803" CreationDate="2017-04-05T17:58:07.780" Score="1" Body="&lt;p&gt;You'll need to have &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagick&lt;/a&gt; installed on your box if you want to preserve alpha channels in a PNG during transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Craft sees it is installed, it will use it by default.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-05T17:58:07.780" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19814" PostTypeId="2" ParentId="19808" CreationDate="2017-04-05T18:08:12.833" Score="1" Body="&lt;p&gt;Right now the CP Live Preview implementation is very heavily tied to the control panel.  I can't see a easy or clean way to get it to work on a front-end request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to make a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; for it, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-05T18:08:12.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19815" PostTypeId="1" CreationDate="2017-04-05T18:18:51.763" Score="1" ViewCount="210" Body="&lt;p&gt;I'm trying to set up a local dev environment for Craft. I've been following &lt;a href=&quot;https://www.youtube.com/watch?v=DfUqciZ91oU&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video&lt;/a&gt; So far, I've installed Composer, Vagrant, and Virtual Box. I have my &lt;code&gt;Homestead.yaml&lt;/code&gt; file set up and going to &lt;code&gt;homestead.dev&lt;/code&gt; is loading craft, but now I'm getting the following message about not meeting the server requirements and a blank list of requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UbM4j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UbM4j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on what I'm missing, or where I could look? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4333" LastActivityDate="2017-04-05T18:23:31.193" Title="Issue with Vagrant/Homestead setup (server requirements message)" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2017-04-05T22:04:57.130" ContentLicense="CC BY-SA 3.0" />
  <row Id="19816" PostTypeId="2" ParentId="19815" CreationDate="2017-04-05T18:23:31.193" Score="0" Body="&lt;p&gt;You can look at server logs and craft logs to begin with. You can also check the browser console.&lt;/p&gt;&#xA;" OwnerUserId="903" LastActivityDate="2017-04-05T18:23:31.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19817" PostTypeId="2" ParentId="13894" CreationDate="2017-04-05T21:16:45.250" Score="1" Body="&lt;p&gt;Ultimately Craft 2 and S3 end up using Yii's &lt;a href=&quot;https://github.com/yiisoft/yii/blob/1.1.17/framework/utils/CFileHelper.php#L280&quot; rel=&quot;nofollow noreferrer&quot;&gt;CFileHelper::getMimeType()&lt;/a&gt; to determine what to set the Content-Type header to when saving a file to S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the link, if &lt;a href=&quot;https://secure.php.net/manual/en/ref.fileinfo.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;finfo&lt;/a&gt; is installed, it will call &lt;code&gt;finfo_open&lt;/code&gt; with the &lt;code&gt;FILEINFO_MIME_TYP&lt;/code&gt; flag to get the mime type back from the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it just so happens that finfo is really bad at guessing the mime type for a CSS file: &lt;a href=&quot;https://bugs.php.net/bug.php?id=53035&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://bugs.php.net/bug.php?id=53035&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are the usual headers and markers it can use like in other file formats, since it's basically just another text file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good news is that this works as expected on the upcoming Craft 3 and it's not an issue, probably because we've swapped everything over to use &lt;a href=&quot;https://flysystem.thephpleague.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Flysystem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-05T21:16:45.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19818" PostTypeId="1" AcceptedAnswerId="19819" CreationDate="2017-04-05T22:12:06.517" Score="3" ViewCount="574" Body="&lt;p&gt;When looking up a specific product by ID, you'd do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set product = craft.commerce.products.id(productId).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you instead have a &lt;strong&gt;variant ID&lt;/strong&gt; and want to find a specific &lt;strong&gt;variant&lt;/strong&gt;, &lt;em&gt;what is the Variant equivalent of that code?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-04-06T00:02:51.420" Title="Look up a specific Variant, using the variant's ID?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19819" PostTypeId="2" ParentId="19818" CreationDate="2017-04-05T22:25:30.140" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-variants&quot; rel=&quot;nofollow noreferrer&quot;&gt;recently documented&lt;/a&gt; template variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.variants.id(yourVariantId).first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to get a variant's product from the variant ID, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.products.hasVariant({id: yourVariantId}).first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="379" LastEditorUserId="45" LastEditDate="2017-04-06T00:02:51.420" LastActivityDate="2017-04-06T00:02:51.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19820" PostTypeId="1" CreationDate="2017-04-05T22:30:19.623" Score="2" ViewCount="284" Body="&lt;p&gt;I have an event section with custom fields for eventDate and eventEndDate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm listing upcoming events in my template using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.entries.section('events').eventDate('&amp;gt;='~now).limit(3).order('eventDate ASC') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine for single day events. But multi-day events disappear after the first day, when I want them to be listed until the event is over. I can't do .eventEndDate('&gt;='~now) because the Event End Date field is left blank for single day events. Is there a way to add an OR to my query to get events with future eventDates OR events with future eventEndDates?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-04-06T00:34:57.120" Title="Get future multi-day event entries with custom date field" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;forloop&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19821" PostTypeId="1" AcceptedAnswerId="19855" CreationDate="2017-04-05T23:50:49.030" Score="2" ViewCount="422" Body="&lt;p&gt;The craft docs on eager loading show you how to &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements#eager-loading-image-transform-indexes&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager load image transforms&lt;/a&gt; in twig. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    with: [&#xA;        ['coolImage', { withTransforms: ['transform'] }]&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it doesn't show you how to actually USE them once they're eager loaded. &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements#accessing-eager-loaded-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Accessing the eager loaded element&lt;/a&gt; itself is easy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teaserImage = entry.coolImage[0] ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how to access the transform from there. Using getUrl('transform') appears to still result in an extra query per element loaded (compared with .url() and no transform).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ teaserImage.getUrl(&quot;transform&quot;) }} {# Boo - extra queries #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-04-08T23:42:07.787" Title="Accessing Eager Loaded Transforms" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19822" PostTypeId="1" CreationDate="2017-04-06T00:02:50.403" Score="1" ViewCount="212" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft docs on eager loading&lt;/a&gt; show you how to eager load image transforms in twig. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;   with: [&#xA;        ['coolImage', { withTransforms: ['transform'] }]&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I can't figure out the syntax for achieving the same functionality within a plugin using the ElementCritereaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made various attempts but they've all resulted in HUGE EXPLOSIONS of the php error variety.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criterea-&amp;gt;with = [&#xA;    &quot;coolImage&quot; =&amp;gt; [&#xA;        &quot;withTransforms&quot; =&amp;gt; [&quot;transform&quot;]&#xA;    ],&#xA;    &quot;otherAssetField&quot;,&#xA;    &quot;someCategoryField&quot;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course above wouldn't work because you're switching between field slugs being keys/values in the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a similar syntax to the docs in twig would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criterea-&amp;gt;with = [&#xA;    &quot;teaserImage&quot;,&#xA;    [&quot;withTransforms&quot; =&amp;gt; [&quot;peopleListing&quot;]],&#xA;    &quot;peoplePffice&quot;,&#xA;    &quot;peopleCategories&quot;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that also results in explosions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help!!! (thanks)&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2019-02-12T15:58:43.730" Title="Eager Loading Image Transforms In Plugin" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;&lt;eager-loading&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19823" PostTypeId="2" ParentId="19820" CreationDate="2017-04-06T00:26:23.390" Score="2" Body="&lt;p&gt;I think the simplest solution would be to make the &lt;code&gt;eventEndDate&lt;/code&gt; field required even for single day events. Then you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in craft.entries({&#xA;  section:'events', &#xA;  eventEndDate:'&amp;gt;= '~now,&#xA;  limit: 3, &#xA;  order:'startDate'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given you have 3 events:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Starts Monday, ends Friday.&lt;/li&gt;&#xA;&lt;li&gt;Starts Wednesday, ends Thursday.&lt;/li&gt;&#xA;&lt;li&gt;Starts Thursday, ends Thursday.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;On Wednesday, you'll still see those events in order (1,2,3).&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2017-04-06T00:34:57.120" LastActivityDate="2017-04-06T00:34:57.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19824" PostTypeId="1" CreationDate="2017-04-06T02:48:01.727" Score="3" ViewCount="651" Body="&lt;p&gt;We're selling a mix of both tangible and digital products with Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an order doesn't require shipping, I'd rather just take them to directly to the final one page checkout/payment form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to determine this natively or do I need to add a &quot;RequireShipping&quot; field and loop through the line items to see if one exists in the user's cart?&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-14T15:46:20.637" Title="Is there a way to determine if an order requires shipping?" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19825" PostTypeId="2" ParentId="15383" CreationDate="2017-04-06T03:19:02.077" Score="2" Body="&lt;p&gt;You can send an email via your plugin's &lt;code&gt;init()&lt;/code&gt; function like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on( 'email.onBeforeSendEmail', function( Event $event ){&#xA;    $email = $event-&amp;gt;params['emailModel'];&#xA;    $attachment = array(&#xA;        'path'     =&amp;gt; '/var/www/public/assets/downloads/filename.pdf',&#xA;        'name'     =&amp;gt; 'File Title',&#xA;        'encoding' =&amp;gt; 'base64',&#xA;        'type'     =&amp;gt; 'application/pdf'&#xA;    );&#xA;    $email-&amp;gt;addAttachment($attachment['path'], $attachment['name'], $attachment['encoding'], $attachment['type']);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, you'll want to do some checks on the &lt;code&gt;Event&lt;/code&gt; and pass that off to a service to determine the logic for what should actually be attached.&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-06T03:19:02.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19826" PostTypeId="2" ParentId="10597" CreationDate="2017-04-06T04:12:30.597" Score="1" Body="&lt;p&gt;I don't know enough about your end goal, but it almost sounds like what you're trying to do is what Craft already does very well. If you're just trying to save some time on Assets custom field creation, you might consider checking out &lt;a href=&quot;https://github.com/engram-design/FieldManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;FieldManager&lt;/a&gt; which lets you import/export fields across projects.&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-06T04:12:30.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19828" PostTypeId="1" CreationDate="2017-04-06T11:10:55.133" Score="2" ViewCount="386" Body="&lt;p&gt;I've setup a custom element type for badges for a system I'm building, but I've run into some trouble trying to query for badges using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Badges_Badge);&lt;/code&gt;, however I'm getting an error saying 'Undefined class constant 'Badges_Badge', but when I loop through all element types using getAllElementTypes() I see an entry for 'Badges_Badges', and I'm able to add and edit badges in the cms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it impossible to query for custom elements using getCriteria, or am I missing something more fundamental?&lt;/p&gt;&#xA;" OwnerUserId="6456" LastActivityDate="2017-04-06T17:01:25.117" Title="Using getCriteria with a custom element type" Tags="&lt;elementcriteriamodel&gt;&lt;elementtype&gt;&lt;custom&gt;&lt;element&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19829" PostTypeId="2" ParentId="19719" CreationDate="2017-04-06T11:32:45.027" Score="3" Body="&lt;p&gt;Another way would be to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include [&#xA;    '_globals/footer-' ~ craft.request.lastSegment,&#xA;    '_globals/footer'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd then have your regular &lt;code&gt;footer.twig&lt;/code&gt; for all pages, but you could have a &lt;code&gt;footer-404.twig&lt;/code&gt; that would just render on the 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I think the previous solutions are better, but variety of solutions is always good, right?&lt;/p&gt;&#xA;" OwnerUserId="4208" LastActivityDate="2017-04-06T11:32:45.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19830" PostTypeId="2" ParentId="19828" CreationDate="2017-04-06T11:36:09.050" Score="1" Body="&lt;p&gt;Fixed it for now by including a custom enum class in the base plugin file:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;abstract class CustomElementType extends BaseEnum&#xA;{&#xA;    const Badges_Badge = 'Badges_Badge';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then querying for the custom element in the plugin using &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(CustomElementType::Badges_Badge);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6456" LastActivityDate="2017-04-06T11:36:09.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19831" PostTypeId="1" CreationDate="2017-04-06T14:07:05.500" Score="1" ViewCount="1531" Body="&lt;p&gt;I have got a problem with an asset field in a Matrix in an _entry template.&#xA;The Matrix is for a step-by-step feature. Each step has his own image.&#xA;So the asset field in my Matrix calls: &lt;code&gt;stepImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in my &lt;code&gt;_entry&lt;/code&gt; template I loop over the step Matrix like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.steps %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this loop I try to get the asset URL like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set image = row.stepImage.first() %}&#xA;  {% if image %}&#xA;      {{image.url}}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it does not work. If i dump it, it returns &lt;code&gt;bool(false)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6550" LastEditorUserId="57" LastEditDate="2017-04-06T17:08:16.107" LastActivityDate="2020-12-30T19:08:55.667" Title="How to get Image/Asset URL in Matrix?" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19832" PostTypeId="1" AcceptedAnswerId="19833" CreationDate="2017-04-06T15:49:19.200" Score="3" ViewCount="77" Body="&lt;p&gt;Is there any way of adding a class onto a page body when it is viewed within the 'live preview' pane?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can then use this to make things either show or not show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to do this to highlight specific things to content editors that I don't feel are worth highlighting to regular users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I can only do this by hanging rules off a special 'preview only' class.&lt;/p&gt;&#xA;" OwnerUserId="4208" LastActivityDate="2017-04-06T16:19:45.607" Title="Apply different classes and styles when in 'live preview' pane" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19833" PostTypeId="2" ParentId="19832" CreationDate="2017-04-06T16:19:45.607" Score="5" Body="&lt;p&gt;Craft's Request service has a built-in method for this, &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#isLivePreview&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;isLivePreview&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to only display content in the live preview view:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isLivePreview %}&#xA;    &amp;lt;p&amp;gt;Only appears in live preview.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-06T16:19:45.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19834" PostTypeId="2" ParentId="19824" CreationDate="2017-04-06T16:56:00.843" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/order-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce_OrderModel&lt;/a&gt; has a &lt;a href=&quot;https://craftcommerce.com/docs/order-model#getshippingmethod&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getShippingMethod()&lt;/code&gt;&lt;/a&gt; that will return a &lt;code&gt;Commerce_ShippingMethodModel&lt;/code&gt; class of the current shipping method, or null if nothing has been set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've already got the order in the template is should be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if order.getShippingMethod() %}&#xA;    Shipping.&#xA;{% else %}&#xA;    No shipping.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-06T16:56:00.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19835" PostTypeId="2" ParentId="19828" CreationDate="2017-04-06T17:01:25.117" Score="0" Body="&lt;p&gt;&lt;code&gt;ElementType&lt;/code&gt; is a native Craft class, so it doesn't know about the &lt;code&gt;Badges_Badge&lt;/code&gt; const you're trying to access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either do it by adding your own class that adds a &lt;code&gt;Badges_Badge&lt;/code&gt; const, &lt;a href=&quot;https://craftcms.stackexchange.com/a/19830/57&quot;&gt;like you discovered&lt;/a&gt;, or simply use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria('Badges_Badge');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:51:00.200" LastActivityDate="2017-04-06T17:01:25.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19836" PostTypeId="2" ParentId="19831" CreationDate="2017-04-06T17:07:02.093" Score="1" Body="&lt;p&gt;I'd suggest giving the Matrix &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;templating&lt;/a&gt; docs a once-over.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;code&gt;steps&lt;/code&gt; is the name of your Matrix field, then &lt;code&gt;{% for row in entry.steps %}&lt;/code&gt; is going to be looping over each of the Matrix blocks you've defined.&lt;/p&gt;&#xA;&lt;p&gt;Then you'd want to check for the stepImage asset field in the correct block. i.e.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.steps %}&#xA;    {% if block.type == 'myBlock' %}&#xA;         {% set image = block.stepImage.one() %}&#xA;       &#xA;         {% if image %}&#xA;             {{image.url}}&#xA;         {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4893" LastEditDate="2020-12-30T19:08:55.667" LastActivityDate="2020-12-30T19:08:55.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19837" PostTypeId="2" ParentId="19730" CreationDate="2017-04-06T20:28:54.000" Score="2" Body="&lt;p&gt;If you need only unique letters, you can build a new array and only merge first letters that are not already in the array like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set letterArray = [] %}&#xA;&#xA;{% for alpha in craft.entries.section('advertisers').order('title asc') %}&#xA;  {% if alpha.title|first not in letterArray %}&#xA;    {% set letterArray = letterArray|merge([alpha.title|first]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for letter in letterArray %}&#xA;  &amp;lt;a href=&quot;{{ siteUrl }}{{ letter }}&quot;&amp;gt;{{ letter }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-04-06T20:28:54.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19838" PostTypeId="2" ParentId="19715" CreationDate="2017-04-07T02:49:39.993" Score="1" Body="&lt;p&gt;There are three ways you can make that page editable:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create &lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Global&quot; custom fields&lt;/a&gt; which are then pulled into that specific template. This may not be overly intuitive for the administrator, however, and clutters up the Global settings pages.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make the page a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Single&quot;&lt;/a&gt; which has the custom fields applied there&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make the page an additional &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Page Type&quot;&lt;/a&gt; within your structure (or channel) – so your structure might be made up of &quot;Event List Pages&quot; and &quot;Event Pages&quot;. This new page type can have a different set of fields to the other page types. You can place the &quot;Event List&quot; at the root of the structure and individual events underneath – this has the added benefit of fitting in nicely with breadcrumbs and menu navigation, and it also easy for administrators to find where to edit the page.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-04-07T02:49:39.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19839" PostTypeId="1" CreationDate="2017-04-07T03:50:57.560" Score="2" ViewCount="80" Body="&lt;p&gt;When using the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import plugin&lt;/a&gt;, how do you place an imported entry underneath a specific parent entry in a structure section?&lt;/p&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="57" LastEditDate="2017-04-07T19:46:57.810" LastActivityDate="2017-05-04T20:10:51.187" Title="Sprout Import: Place entries under a parent in structure section?" Tags="&lt;plugin-sproutimport&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19842" PostTypeId="1" CreationDate="2017-04-07T10:19:49.170" Score="3" ViewCount="257" Body="&lt;p&gt;I have created a controller called myPlugin_Controller.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the following code inside it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;?php&#xA;class myPluginController extends BaseController&#xA;{&#xA;    public function actionSave()&#xA;    {&#xA;&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // get all the post variables&#xA;        $elementId = craft()-&amp;gt;request-&amp;gt;getPost('elementId');&#xA;        $userId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;&#xA;        // set the name of the field you want to update&#xA;        $fieldHandle = 'friends';&#xA;&#xA;        // based on the element and field vars, get the models for each&#xA;        // using the elements and fields services&#xA;        $element = craft()-&amp;gt;elements-&amp;gt;getElementById($elementId);&#xA;        $field = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($fieldHandle);&#xA;&#xA;        // store the current ids into a variable&#xA;        $currentIds = $element-&amp;gt;{$field-&amp;gt;handle}-&amp;gt;ids();&#xA;&#xA;        // merge the new id into the current ids&#xA;        $newIds = array_merge($currentIds, (array) $userId); &#xA;&#xA;        // save the new array of ids, using the relations service&#xA;        craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $element, $newIds);&#xA;&#xA;        // redirect to the redirect url&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my code in an html file, it is submitting some data however it returns a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt; &#xA;                  {{ getCsrfInput() }}&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myPlugin/Save&quot;&amp;gt;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/success&quot;&amp;gt;&#xA;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;elementId&quot; value=&quot;{{ user.id }}&quot;&amp;gt;&#xA;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;              &amp;lt;button type=&quot;submit&quot; &amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;          &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i'm not too sure where its going wrong now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if your wondering why its called user this is why&#xA;        {% set user = craft.users.username( craft.request.segment(2) ).first() %}&#xA;Do you know where I am going wrong now any tips or help is all appreciated! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not working I have looked at craft cms documentation online i've followed your steps and there steps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything you can still see that is wrong?&lt;/p&gt;&#xA;" OwnerUserId="6482" LastEditorUserId="6482" LastEditDate="2017-04-13T23:56:03.390" LastActivityDate="2017-04-13T23:56:03.390" Title="How do you programatically add a user to a user entry field" Tags="&lt;plugin-development&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19843" PostTypeId="1" AcceptedAnswerId="19971" CreationDate="2017-04-07T10:46:46.030" Score="2" ViewCount="400" Body="&lt;p&gt;I'm trying to integrate Charge with Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I need to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) use Stripe to set up subscription for the amount based on what's in the cart (this seems to be possible out-of-the-box)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) on successful charge - mark order as complete (I think I can use &lt;code&gt;'charge.onCharge'&lt;/code&gt; event here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) listen to webhooks - when the next recurring payment succeeds or fails, make change to order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to write custom action for (c) without hacking into Charge core? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is &lt;code&gt;Charge_Actions&lt;/code&gt; service fireing some events, but how do I reference/listen to those actions in a custom plugin that I create?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="1104" LastEditDate="2017-04-13T14:38:17.007" LastActivityDate="2017-04-14T13:59:36.790" Title="Charge plugin: custom actions on webhooks" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;plugin-charge&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19844" PostTypeId="1" CreationDate="2017-04-07T11:01:37.417" Score="2" ViewCount="241" Body="&lt;p&gt;I am using the code below to output a group of sections that have entries along with their section handle. How would I order the sections (ideally by structureId)? I'm not opposed to using supersort but I haven't been able to achieve the desired result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = craft.sections.getAllSections() %}&#xA;{% set entries = craft.entries.section(['first', 'second', 'third']) %}&#xA;{% set grouped = entries|group('section') %}&#xA;&#xA;{% for sectionHandle, sectionEntries in grouped %}&#xA;    {% set groupSection = false %}&#xA;    {% for section in sections %}&#xA;        {% if section.name == sectionHandle %}&#xA;            {% set groupSection = section %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% if groupSection %}&#xA;        &amp;lt;h1&amp;gt;{{ groupSection.name }} - {{ groupSection.handle }}&amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2017-04-11T07:37:32.910" Title="Ordering Structure Sections with Structure Handles" Tags="&lt;structure&gt;&lt;sections&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19845" PostTypeId="2" ParentId="19842" CreationDate="2017-04-07T11:15:32.733" Score="3" Body="&lt;p&gt;You will need a custom plugin to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll assume that you're familiar with that process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can build a form in your template like this, passing in the entry ID you want to add the user to and the user ID you want to add.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt; &#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myPlugin/save&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/success&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;elementId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot; &amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you'll need a controller action in your plugin to which you submit a POST request from a form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSave()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    // get all the post variables&#xA;    $elementId = craft()-&amp;gt;request-&amp;gt;getPost('elementId');&#xA;    $userId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;&#xA;    // set the name of the field you want to update&#xA;    $fieldHandle = 'myUserField';&#xA;&#xA;    // based on the element and field vars, get the models for each&#xA;    // using the elements and fields services&#xA;    $element = craft()-&amp;gt;elements-&amp;gt;getElementById($elementId);&#xA;    $field = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($fieldHandle);&#xA;&#xA;    // store the current ids into a variable&#xA;    $currentIds = $element-&amp;gt;{$field-&amp;gt;handle}-&amp;gt;ids();&#xA;&#xA;    // merge the new id into the current ids&#xA;    $newIds = array_merge($currentIds, (array) $userId); &#xA;&#xA;    // save the new array of ids, using the relations service&#xA;    craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $element, $newIds);&#xA;&#xA;    // redirect to the redirect url&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's very important that you follow the naming conventions in the docs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You controller class should be named MyPluginController, which would then make the action in the form myPlugin/save (controller and action get removed from the exposed plugin and action names). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the redirect should be a page on the side where you want the user to go after being added, not pointing to your plugin.&lt;/p&gt;&#xA;" OwnerUserId="14" LastEditorUserId="14" LastEditDate="2017-04-12T12:52:32.967" LastActivityDate="2017-04-12T12:52:32.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19847" PostTypeId="1" CreationDate="2017-04-08T05:34:22.030" Score="1" ViewCount="54" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://www.putyourlightson.net/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryCount&lt;/a&gt; which count the entry and total view of an entry and I want to show total view of entries of a particular user.&#xA;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;User XYZ:&#xA;Entries: ABC(10 View) + DEF(20 View) + GHI(10 View) = 40 View (Total).&#xA;&#xA;User MNO:&#xA;Entries: ABC(10 View) + DEF(10 View) + GHI(10 View) = 30 View (Total).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just want to show this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'XYZ':40(View) and 'MNO': 30(View).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T19:49:25.317" LastActivityDate="2017-05-09T19:49:25.317" Title="Show total viewed" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19848" PostTypeId="1" AcceptedAnswerId="19851" CreationDate="2017-04-08T06:49:39.187" Score="2" ViewCount="200" Body="&lt;p&gt;I updated a very old Craft installation (v2.6.2794 to v2.6.2971) and now I'm locked out off the admin area. I can get to the login panel and log in but once in I just get 500 errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After turning on devMode, I found this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /mysite.com/craft/app/helpers/ModelHelper.php on line 102&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I already have my &lt;code&gt;phpMaxMemoryLimit&lt;/code&gt; at &lt;code&gt;512M&lt;/code&gt; (checked). Could my installation really be using that much memory?&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="47" LastEditDate="2017-04-08T13:59:53.573" LastActivityDate="2017-04-08T14:04:31.000" Title="Locked out of admin panel after update" Tags="&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19849" PostTypeId="1" CreationDate="2017-04-08T07:26:18.787" Score="2" ViewCount="40" Body="&lt;p&gt;I am planning to build a searchable database of statutory text, and am wondering what would be the best way to model my data for ease of linking spot citations and related text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The statutes are generally divided into articles (Art. 1, Art. 2, Art 2-1, Art. 3, et seq.), and within a given article there may be cross-references to other articles of the same statute, or to other articles of different statutes. In other words, Sample Act Art. 99 could contain a reference to Sample Act Arts. 120 and 121, or sometimes an even more detailed cross-reference such as to Sample Act Art. 122, paragraph 1; additionally, Sample Act Art. 99 might also reference Example Law Art. 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to pull all cross-references and present the resultant content in a tooltip for the convenience of the reader.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like the easiest way to handle the cross-references would be an Entries field (or perhaps a custom plugin to find the relevant linked content, if we're ambitious). Each individual statute would be a Channel, and then each article of the statute would be an entry in the Channel — perhaps to be organized as a Structure to accommodate the weird sort order that gets created when using article numbering like 1, 2, 2-1, 3.... That seems workable from a Twig templating perspective, but the profusion of 100-150 Channels that would follow from this sort of data model is daunting. I think it would be tough to try to manage so many Channels within the parameters of the CraftCMS UI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="6393" LastEditorUserId="6393" LastEditDate="2017-04-08T13:08:39.263" LastActivityDate="2017-04-08T13:08:39.263" Title="Data Model to Accommodate Statutory Text?" Tags="&lt;database&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19850" PostTypeId="2" ParentId="19842" CreationDate="2017-04-08T08:15:09.580" Score="0" Body="&lt;p&gt;Hi Jeremy thanks for the help it is getting me on the right track what you have given me thanks :), However I still haven't quite solved it, I found documentation on how to use custom controllers. This is where I am at now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a controller under the controllers folder in the plugins directory with the file name of myPlugin_myController.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the following code inside it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;class myPlugin_myController extends BaseController&#xA;{&#xA;    public function actionSave()&#xA;    {&#xA;&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        // get all the post variables&#xA;        $elementId = craft()-&amp;gt;request-&amp;gt;getPost('elementId');&#xA;        $userId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;&#xA;        // set the name of the field you want to update&#xA;        $fieldHandle = 'friends';&#xA;&#xA;       // based on the element and field vars, get the models for each&#xA;       // using the elements and fields services&#xA;       $element = craft()-&amp;gt;elements-&amp;gt;getElementById($elementId);&#xA;       $field = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle($fieldHandle);&#xA;&#xA;       // store the current ids into a variable&#xA;       $currentIds = $element-&amp;gt;{$field-&amp;gt;handle}-&amp;gt;ids();&#xA;&#xA;       // merge the new id into the current ids&#xA;       $newIds = array_merge($currentIds, (array) $userId); &#xA;&#xA;       // save the new array of ids, using the relations service&#xA;       craft()-&amp;gt;relations-&amp;gt;saveRelations($field, $element, $newIds);&#xA;&#xA;       // redirect to the redirect url&#xA;       $this-&amp;gt;redirectToPostedUrl();&#xA;&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my code in an html file, it is submitting some data however it returns a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt; &#xA;              {{ getCsrfInput() }}&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myPlugin/myController/actionSave&quot;&amp;gt;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;myPlugin/myController&quot;&amp;gt;&#xA;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;elementId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;              &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;              &amp;lt;button type=&quot;submit&quot; &amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;          &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you know where I am going wrong now any tips or help is all appreciated! :)&lt;/p&gt;&#xA;" OwnerUserId="6482" LastActivityDate="2017-04-08T08:15:09.580" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19851" PostTypeId="2" ParentId="19848" CreationDate="2017-04-08T14:04:31.000" Score="1" Body="&lt;p&gt;I'd initially forgotten to turn on devMode to find out what the 500 error was. Once I did that I found out it was exhausting the memory. I had to raise it up to 1024M!&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2017-04-08T14:04:31.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19852" PostTypeId="1" CreationDate="2017-04-08T14:20:37.257" Score="1" ViewCount="971" Body="&lt;p&gt;I just had some problems with an &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19848/locked-out-of-admin-panel-after-update/19851#19851&quot;&gt;update exhausting my memory&lt;/a&gt;. But I already had the PHP memory limit at 512 MB, and I had to take it up to 1024 MB! I know this is relative but, &lt;strong&gt;is this too much?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I know if this is within normal range or if I should be working to improve it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the site for a newspaper in a small province (~10 posts/day). After the latest update, the database is at ~600mb.&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-04-08T14:57:19.790" Title="PHP memory limit, is 1024 MB too much?" Tags="&lt;performance&gt;&lt;memory&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19853" PostTypeId="1" CreationDate="2017-04-08T17:28:48.913" Score="4" ViewCount="112" Body="&lt;p&gt;How can I listen in my plugin to see if&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;onsaveUser came from front end creation or control panel ?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-04-08T18:03:48.297" Title="User registration plugin listening" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19854" PostTypeId="2" ParentId="19853" CreationDate="2017-04-08T17:55:06.147" Score="3" Body="&lt;p&gt;You can use the request service. &lt;em&gt;craft()-&gt;request-&gt;isCpRequest()&lt;/em&gt; or &lt;em&gt;craft()-&gt;request -&gt;isSiteRequest()&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#isCpRequest-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/HttpRequestService#isCpRequest-detail&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2017-04-08T18:03:48.297" LastActivityDate="2017-04-08T18:03:48.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19855" PostTypeId="2" ParentId="19821" CreationDate="2017-04-08T23:42:07.787" Score="1" Body="&lt;p&gt;It appears that the correct way to do it is using the url() method. I couldn't replicate the extra queries I mentioned in the question, and can confirm with some more testing that it doesn't cause any extra queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ teaserImage.url(&quot;transform&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ teaserImage.getUrl(&quot;transform&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-04-08T23:42:07.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19856" PostTypeId="2" ParentId="19847" CreationDate="2017-04-09T04:38:09.620" Score="2" Body="&lt;p&gt;Never used the plugin, but after glancing thought the source code, I don't think it's possible given its current implementation without modifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently it's tracking entry counts on a global basis and not a per-user basis.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-09T04:38:09.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19857" PostTypeId="1" AcceptedAnswerId="19863" CreationDate="2017-04-09T11:39:34.783" Score="2" ViewCount="267" Body="&lt;p&gt;This is probably a newby question, but, I am just trying to add a basic email send test and my twig page does not like the dollar signs.  Is EmailModel built-in to craft or is there a plugin I need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just trying to add this code to a basically empty twig page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = new EmailModel();&#xA;$email-&amp;gt;subject = &quot;Thanks!&quot;;&#xA;$email-&amp;gt;htmlBody = &quot;&amp;lt;h1&amp;gt;Congratulations!&amp;lt;/h1&quot;;&#xA;$email-&amp;gt;htmlBody .= &quot;&amp;lt;p&amp;gt;Hello World&amp;lt;/p&amp;gt;&quot;;&#xA;$email-&amp;gt;fromEmail = &quot;email@domain.com&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thanks for the help...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chip&lt;/p&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="1016" LastEditDate="2017-04-09T16:15:58.413" LastActivityDate="2017-04-09T23:12:59.683" Title="EmailModel - Unexpected character &quot;$&quot;?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19858" PostTypeId="1" AcceptedAnswerId="19864" CreationDate="2017-04-09T16:53:56.940" Score="2" ViewCount="282" Body="&lt;p&gt;is there a way to add a field to a global set by code ? I figured out how to create a global:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$global = new GlobalSetModel();&#xA;$global-&amp;gt;name = 'GlobalName';&#xA;$global-&amp;gt;handle = 'globalHandle';&#xA;craft()-&amp;gt;globals-&amp;gt;saveSet($global)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to add a field to this newly create global.&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2017-04-09T23:19:17.387" Title="Add a field to a global set" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19859" PostTypeId="1" AcceptedAnswerId="19866" CreationDate="2017-04-09T16:56:44.550" Score="3" ViewCount="112" Body="&lt;p&gt;Here are my settings for user registration:&#xA;\ &#xA;&lt;a href=&quot;https://i.stack.imgur.com/BcaHA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BcaHA.jpg&quot; alt=&quot;User settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When front end registration completes the users are added fine but not into the default user group as expected. They are just in the system with no group.&#xA;I was expecting them to be registered into the default group - am i missing something?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-04-10T02:10:59.897" Title="Registration into default group is not working as expected" Tags="&lt;registration&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19860" PostTypeId="1" CreationDate="2017-04-09T17:30:36.210" Score="1" ViewCount="312" Body="&lt;p&gt;Using Redactor in CraftCMS I've added the following to the redactor/Standard.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;pre-php&quot;: {&#xA;            &quot;title&quot;: &quot;PHP Code&quot;,&#xA;            &quot;args&quot;: [&quot;pre&quot;, &quot;class&quot;, &quot;language-php&quot;, &quot;add&quot;]&#xA;        }&#xA;    }&#xA;}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The option appears in the &lt;code&gt;format&lt;/code&gt; menu as expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: When applying this new format, multiple &amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt; tags are created (one set per block of code), where-as the default Format-&gt;Code option properly creates a single &amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt; around the selected blocks of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get redactor to properly add &amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt; tags with a custom class name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formatted with built-in Format-&gt;Code option:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nbCE8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nbCE8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formatted with custom format option:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AP2Lv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AP2Lv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6562" LastActivityDate="2017-04-09T17:30:36.210" Title="Using formattingAdd for custom &lt;pre&gt; adding multiple &lt;pre&gt; tags" Tags="&lt;redactor&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19861" PostTypeId="1" AcceptedAnswerId="19862" CreationDate="2017-04-09T20:29:31.623" Score="2" ViewCount="188" Body="&lt;p&gt;I am coming from a .net/C# background and we have recently moved to a Craft/Twig platform.  What is the best way to do this: Have a visitor come to a Craft webpage (Twig file), enter their email address in a text box, hit a button, and have an email message sent to them containing a PDF attachment that they selected from that page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this functionality built-in to Craft or do I need a plugin?&lt;/p&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="45" LastEditDate="2017-04-09T23:15:13.887" LastActivityDate="2017-04-09T23:15:13.887" Title="What is the best way to generate email messages with attachments from Twig files?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19862" PostTypeId="2" ParentId="19861" CreationDate="2017-04-09T23:09:19.543" Score="2" Body="&lt;p&gt;You can do this with a simple &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt;.  You can generate the boilerplate plugin code &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your form on the front-end will set its hidden action input to your plugin's &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller's&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;action&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you can use Craft's &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailModel&lt;/a&gt; (along with &lt;a href=&quot;https://craftcms.com/classreference/models/EmailModel#addAttachment-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;addAttachment()&lt;/code&gt;&lt;/a&gt;) and &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService&lt;/a&gt;'s &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;sendEmail()&lt;/code&gt;&lt;/a&gt; to send whatever email contents you wish.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="45" LastEditDate="2017-04-09T23:12:51.343" LastActivityDate="2017-04-09T23:12:51.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19863" PostTypeId="2" ParentId="19857" CreationDate="2017-04-09T23:12:59.683" Score="2" Body="&lt;p&gt;You can't use &lt;a href=&quot;https://craftcms.stackexchange.com/questions/722/can-we-use-php-in-our-templates-instead-of-twig&quot;&gt;PHP in a Twig template&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plugin Craft plugin would be the easiest way to pull off what you're looking for.  I've added an answer to your other &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19861/what-is-the-best-way-to-generate-email-messages-with-attachments-from-twig-files&quot;&gt;related question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-09T23:12:59.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19864" PostTypeId="2" ParentId="19858" CreationDate="2017-04-09T23:19:17.387" Score="1" Body="&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/a/764/57&quot;&gt;here&lt;/a&gt; for how to add a field to a user's field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users, Globals, Tags, Categories, etc. are all &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;elements&lt;/a&gt; in Craft so they behave very similarly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check out Craft's own &lt;a href=&quot;http://buildwithcraft.com/classreference/services/InstallService&quot; rel=&quot;nofollow noreferrer&quot;&gt;InstallService&lt;/a&gt;'s private &lt;code&gt;_createDefaultContent()&lt;/code&gt; method for examples on how Craft creates the default content on a fresh install of Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-04-13T12:50:59.930" LastActivityDate="2017-04-09T23:19:17.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19865" PostTypeId="2" ParentId="19824" CreationDate="2017-04-10T02:09:18.210" Score="1" Body="&lt;p&gt;Well, I think somewhere in-between Brad's answer and this is the solution...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I too have a mix of tangible and tangible products on my site. In the CP I have checked the &quot;Free Shipping&quot; checkbox for all non-tangible products when I create them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I eventually &lt;em&gt;will&lt;/em&gt; have products that require shipping, I didn't want to completely do away with the shipping screen. Here is what I came up with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT/UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After working through this more, I wanted to provide more insight for others who might come across this thread. As always if there is room for improvement, please let me know so it can be updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/shop/checkout/addresses/&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set freeShipping  = false %}&#xA;&#xA;{% for item in cart.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;&#xA;    {% if product.freeShipping %}&#xA;        {% set freeShipping = true %}&#xA;    {% else %}&#xA;        {% set freeShipping = false %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;...&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&#xA;{% if freeShipping %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/checkout/payment&quot;/&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/checkout/shipping&quot;/&amp;gt;&#xA;{% endif %}&#xA;&#xA;&#xA;...&#xA;&#xA;{% if freeShipping %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;1&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;0&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;sameAddress&quot; id=&quot;sameAddress&quot;&#xA;                                               checked=&quot;checked&quot;&amp;gt;Use same address for shipping&#xA;{% endif %}&#xA;&#xA;&#xA;...&#xA;&#xA;{% if freeShipping %}&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;Continue To Payment&amp;lt;/button&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;Continue To Shipping&amp;lt;/button&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;span&amp;gt;or &amp;lt;a href=&quot;{{ url('/shop/cart') }}&quot;&amp;gt;Return to cart&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm doing here is looping through my cart to see if &lt;code&gt;freeShipping&lt;/code&gt; has been selected for every product (see above). Later I check the same var and handle the form redirect appropriately. If all products in my cart are set to &lt;code&gt;freeShipping&lt;/code&gt; I don't really want to make the user have to enter a shipping address. So I will set the &lt;code&gt;sameAddress&lt;/code&gt; for them. This way we still have a shipping address should we need it in the future. Then at the end changing the next button accordingly as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/shop/checkout/payment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set freeShipping  = false %}&#xA;{% for item in cart.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;&#xA;    {% if product.freeShipping %}&#xA;        {% set freeShipping = true %}&#xA;    {% else %}&#xA;        {% set freeShipping = false %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&#xA;...&#xA;&#xA;{% for adjustment in cart.adjustments %}&#xA;    &amp;lt;div class=&quot;adjustment&quot;&amp;gt;&#xA;        {% if adjustment.name == &quot;Free Shipping&quot; %}&#xA;            {% if not freeShipping %}&#xA;                &amp;lt;h4&amp;gt;{{ adjustment.name }}&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ adjustment.amount|commerceCurrency(cart.currency) }}&#xA;                                    ({{ adjustment.description }})&amp;lt;/p&amp;gt;&#xA;            {% endif %}&#xA;        {% else %}&#xA;            &amp;lt;h4&amp;gt;{{ adjustment.name }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ adjustment.amount|commerceCurrency(cart.currency) }}&#xA;            ({{ adjustment.description }})&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA;...&#xA;&#xA;&#xA;{% if not cart.shippingMethod %}&#xA;    {#&#xA;    If the order requires a shipping method be selected, you could redirect back to the shipping page until one is applied to the order.&#xA;    {% redirect &quot;shop/checkout/shipping&quot; %}&#xA;    You might also want to add a php plugin hook to require&#xA;    #}&#xA;    {% if freeShipping %}&#xA;        {# Shipping not applicable. #}&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Shipping&amp;lt;/strong&amp;gt; None selected. &amp;lt;a href=&quot;{{ url('shop/checkout/shipping') }}&quot;&amp;gt;&#xA;        Choose a shipping method.&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same thing here, checking for &lt;code&gt;freeShipping&lt;/code&gt; on all items. The biggest change here is (purely cosmetic) I didn't want to show &quot;Free Shipping&quot; since we aren't shipping anything. The last part is just updating existing shipping logic to accommodate the free shipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/shop/checkout/shipping&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set freeShipping  = false %}&#xA;&#xA;{% for item in cart.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;&#xA;    {% if product.freeShipping %}&#xA;        {% set freeShipping = true %}&#xA;    {% else %}&#xA;        {% set freeShipping = false %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;...&#xA;&#xA;{% if freeShipping %}&#xA;    &amp;lt;p&amp;gt;None of the items in your cart require shipping.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/checkout/payment&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;shippingMethod&quot; value=&quot;freeShipping&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&amp;gt;Continue to payment&amp;lt;/button&amp;gt;         &#xA;    &amp;lt;/form&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h3&amp;gt;Shipping Method&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p&amp;gt;Select a shipping method below.&amp;lt;/p&amp;gt;&#xA;&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All we are doing here is checking (again) for &lt;code&gt;freeShipping&lt;/code&gt;. If everything qualifies, I only show a button that tells the customer they don't have anything to ship and I send them to the &lt;code&gt;/payment&lt;/code&gt; screen. I suppose you &lt;em&gt;could&lt;/em&gt; just set a &lt;code&gt;{% redirect %}&lt;/code&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-04-14T15:46:20.637" LastActivityDate="2017-04-14T15:46:20.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19866" PostTypeId="2" ParentId="19859" CreationDate="2017-04-10T02:10:59.897" Score="3" Body="&lt;p&gt;I get bit by this a &lt;em&gt;lot&lt;/em&gt;.&#xA;Just like @Stephen Lewis suggested - make sure you are not logged into the same browser. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, log into the CP with Safari (or whatever) and then use Chrome to actually register an account via your front-end form.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-04-10T02:10:59.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19867" PostTypeId="2" ParentId="10752" CreationDate="2017-04-10T03:49:53.843" Score="0" Body="&lt;p&gt;This is an old question, but in case it helps anyone else there's a plugin that alleviates some of the limitations of Redactor's absurdly simplistic table button: &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/table-maker&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://plugins.supercooldesign.co.uk/plugin/table-maker&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a separate fieldtype so you can have a separate Matrix block for it. It allows the user to set relative column widths and left/center/right alignment. And because it's a fieldtype, you have total control over the markup structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not as robust as TinyMCE or CKEditor's inline table maker thing, but might help in some situations.&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-10T03:49:53.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19868" PostTypeId="1" AcceptedAnswerId="19870" CreationDate="2017-04-10T06:11:38.603" Score="3" ViewCount="1335" Body="&lt;pre&gt;&lt;code&gt;1.{% set workTitle = craft.request.getLastSegment()  %}&#xA;2.{% if currentUser %}&#xA;3.     {{workTitle}}&#xA;4.{% else %}&#xA;5.  {% redirect &quot;/visit/index?artwork=workTitle&quot; %}&#xA;6.{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each line of code are working fine except the line 5. I set a value on line 1. Line 3 returns the set value but on line 5 when am trying to redirect it doesn't return correct path.&#xA;Redirect returns the below path instead of the returning the set value of workTitle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://abc.dev/visit/index?artwork=workTitle&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://abc.dev/visit/index?artwork=workTitle&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="22" LastEditDate="2017-05-09T19:48:18.027" LastActivityDate="2017-05-09T19:48:18.027" Title="how can pass a variable in redirect?" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19869" PostTypeId="2" ParentId="19868" CreationDate="2017-04-10T06:22:30.010" Score="5" Body="&lt;p&gt;Update line 5 to &lt;strong&gt;concatenate&lt;/strong&gt; the path/URL with the variable &lt;strong&gt;workTitle&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% redirect &quot;/visit/index?artwork=&quot; ~ workTitle %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2017-04-10T06:32:58.020" LastActivityDate="2017-04-10T06:32:58.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19870" PostTypeId="2" ParentId="19868" CreationDate="2017-04-10T06:22:42.777" Score="6" Body="&lt;p&gt;I think:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect &quot;/visit/index?artwork=&quot;~workTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-04-10T06:22:42.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19871" PostTypeId="1" AcceptedAnswerId="19873" CreationDate="2017-04-10T06:37:20.387" Score="2" ViewCount="369" Body="&lt;p&gt;I have a 'details' rich text field in my User section. How can i get it in my plugin controller in an array.&#xA;I tried getting it by &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $userInfo[] = array(&#xA;  'username' =&amp;gt; $user-&amp;gt;name,&#xA;  'details' =&amp;gt; $user-&amp;gt;details,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an array like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        Array&#xA;        (&#xA;        [0] =&amp;gt; Array&#xA;            (&#xA;                [username] =&amp;gt; Username&#xA;                [details] =&amp;gt; Craft\RichTextData Object&#xA;                    (&#xA;                        [_pages:Craft\RichTextData:private] =&amp;gt; &#xA;                        [_rawContent:Craft\RichTextData:private] =&amp;gt; Lorem Ipsum is a dummy text&#xA;                        [content:protected] =&amp;gt; Lorem Ipsum is a dummy text&#xA;                        [charset:protected] =&amp;gt; UTF-8&#xA;                    )&#xA;                )&#xA;            )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2018-06-16T08:53:05.483" LastActivityDate="2018-06-16T08:53:05.483" Title="How to Get Rich Text field in Plugin?" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19872" PostTypeId="2" ParentId="18256" CreationDate="2017-04-10T08:46:41.407" Score="2" Body="&lt;p&gt;I'm the developer of Charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above issue is caused because you're passing in the &lt;strong&gt;title&lt;/strong&gt; of the email, not the &lt;strong&gt;handle&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;We explicitly require the handle to be passed to ensure uniqueness.&lt;/strong&gt; While the above patch would bypass the issue and let you define it by title, it's not ideal, and the proper fix is to the simply pass it by the handle in your templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the above example, the handle would be &lt;code&gt;welcome_email&lt;/code&gt;. It's directly shown in the email table in your Charge &gt; Settings &gt; Emails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help other's who might end up mistakenly passing the title instead of the handle, I've added a patch to the 2.2.1 release which explicitly watches for instances of a passed title instead of a handle, and throws a new message in the logging to notify the developer. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2017-04-10T08:46:41.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19873" PostTypeId="2" ParentId="19871" CreationDate="2017-04-10T08:50:04.000" Score="1" Body="&lt;p&gt;Got It through -&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userInfo[] = array(&#xA;  'username' =&amp;gt; $user-&amp;gt;name,&#xA;  'details' =&amp;gt;  (string) $user-&amp;gt;details,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-04-10T08:50:04.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19875" PostTypeId="1" CreationDate="2017-04-10T11:26:49.333" Score="2" ViewCount="600" Body="&lt;p&gt;My client prefers to use a Microsoft IIS hosting environment he already has. After some gnashing of teeth I have managed to get it working there, but it is painfully slow (unlike my local LAMP version).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was inclined to assume some sort of shared server MySQL bottleneck but the host's response to this thought has been…&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't see any bottlenecks on the server itself, mysql connections to the server and queries on it are running very quickly so I would be looking at the code itself. I've done some tests with simple php + mysql connections on the server and these run very fast, so this is pointing at the CMS doing something slowly, but I'm not familiar with the CMS to know what this is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does anyone have experience of Craft running &lt;strong&gt;well&lt;/strong&gt; in IIS on a shared server? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any particular config that is worth trying to get it to do so?&lt;/p&gt;&#xA;" OwnerUserId="3507" LastActivityDate="2017-06-09T21:52:05.323" Title="Tips for running Craft in Microsoft IIS" Tags="&lt;config&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19876" PostTypeId="1" CreationDate="2017-04-10T12:20:40.007" Score="2" ViewCount="232" Body="&lt;p&gt;How would I get a status notification to send when setting the status of an order dynamically via a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a few different order 'types' that need a different default status (for different notifications), so I created a plugin that sets the status at onBeforeOrderComplete, which sets the status for the order just as expected, but no notifications are sent. There are no issues with the notification emails sending (when changing the status via the cp, they send out as normal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event)&#xA;{&#xA;    $order = $event-&amp;gt;params['order'];    &#xA;    if ($order-&amp;gt;orderType == 'blah') {&#xA;        $order-&amp;gt;orderStatusId = 1;&#xA;    } else {&#xA;        $order-&amp;gt;orderStatusId = 3;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6404" LastEditorUserId="6404" LastEditDate="2017-04-11T08:04:07.367" LastActivityDate="2017-04-11T08:04:07.367" Title="Craft Commerce: send notification emails when setting status dynamically?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19877" PostTypeId="1" AcceptedAnswerId="19885" CreationDate="2017-04-10T16:44:59.977" Score="1" ViewCount="637" Body="&lt;p&gt;I'm working with a client to resolve an issue that has appeared recently with a Craft site. Up until recently there were no issues with the site for my client, but she is now getting a 500 Error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;site.com is currently unable to handle this request. HTTP ERROR 500&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This happens whenever my client tried to create a new entry post. Uploading an image is okay, but posting is not. We're running Craft 1.3.2487.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or direction on this would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6565" LastEditorUserId="57" LastEditDate="2017-04-10T21:07:30.343" LastActivityDate="2017-04-10T21:07:30.343" Title="Returning a &quot;is currently unable to handle this request. 500 Error&quot; when client posts" Tags="&lt;entries&gt;&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19878" PostTypeId="1" CreationDate="2017-04-10T17:58:15.677" Score="2" ViewCount="67" Body="&lt;p&gt;I have a couple different user groups that access the front end of our site and I would like to send them to different paths depending on their user group after setting their password. Is it possible to access a user's group in general config for this purpose?&lt;/p&gt;&#xA;" OwnerUserId="4468" LastActivityDate="2017-04-10T20:52:39.993" Title="Different setPasswordSuccessPath for different user groups" Tags="&lt;config&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19879" PostTypeId="1" AcceptedAnswerId="19964" CreationDate="2017-04-10T18:41:34.910" Score="2" ViewCount="366" Body="&lt;p&gt;I'm trying to achieve the following (without much luck), using Solspace Calendar plugin:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All events (no calendar specified)&lt;/li&gt;&#xA;&lt;li&gt;A defined timeframe (one week)&lt;/li&gt;&#xA;&lt;li&gt;Only unique events, that have at least 1 occurrence in that week, so no reoccurrences&lt;/li&gt;&#xA;&lt;li&gt;In a random order&lt;/li&gt;&#xA;&lt;li&gt;Limited to a specified number&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tried, without satisfying result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.calendar.events({&#xA;    dateRangeStart: now |date('Y-m-d'),&#xA;    dateRangeEnd: now |date_modify('+7 days') |date('Y-m-d'),&#xA;    order: 'RAND()',&#xA;    loadOccurrences: false,&#xA;    limit: 3,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any Calendar experts out there?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2017-04-21T04:49:34.923" Title="Using Solspace Craft Calendar plugin, how can I get random events within a defined timeframe?" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19881" PostTypeId="1" AcceptedAnswerId="19975" CreationDate="2017-04-10T20:18:31.807" Score="1" ViewCount="36" Body="&lt;p&gt;my client sees the attached screen in the editing window. it seems that Redactor is cutting off headings after Heading 2. They are using Chrome.&#xA;ideas?&lt;a href=&quot;https://i.stack.imgur.com/LXqwD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LXqwD.png&quot; alt=&quot;Redactor truncating heading list&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6130" LastActivityDate="2017-04-14T15:21:31.033" Title="Why is Redactor cutting off Headings after Heading 2?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19882" PostTypeId="1" CreationDate="2017-04-10T20:37:22.770" Score="1" ViewCount="147" Body="&lt;p&gt;I'd like to 'darken' an image using the Imager plugin. How would I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll explain the exact effect I'm after in Photoshop terms: I have an image on one layer, then I create a new layer above it and fill it with black. I then change the opacity of the black layer to 40%. This is the end result that I'm trying to achieve with the Imager plugin (ImageMagick is available too).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise I could add a div with a black background over the images and change the opacity of this div, but I think it would be nicer if I could do this with the Imager plugin instead if this is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the closest I've managed to get so far, but it doesn't quite match what I'm seeing in Photoshop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.image.first() %}&#xA;{% set transformedImage = craft.imager.transformImage(image, { &#xA;  width: 1500,&#xA;  height: 700,&#xA;  effects: {&#xA;    vignette: ['none', 'black', 3],&#xA;    modulate: [100, 80, 100],&#xA;    gamma: 0.7 }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help with this.&lt;/p&gt;&#xA;" OwnerUserId="179" LastEditorUserId="45" LastEditDate="2017-04-11T22:50:28.650" LastActivityDate="2017-04-11T22:50:28.650" Title="How to darken an image using the Imager plugin" Tags="&lt;image&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19883" PostTypeId="2" ParentId="19878" CreationDate="2017-04-10T20:52:39.993" Score="1" Body="&lt;p&gt;A bit heavy handed, but the only way I can think of do pull this off, would be to write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; with it's own controller action that you change the link in the email to point to instead of Craft's &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController#actionSetPassword-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;UsersController-&amp;gt;actionSetPassword()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That method would be nearly identical to Craft's except at the end, you'd redirect based on the user groups (if any) the &lt;code&gt;$userToProcess&lt;/code&gt; is a member of, instead of just the &lt;code&gt;setPasswordSuccessPath&lt;/code&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-10T20:52:39.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19884" PostTypeId="2" ParentId="19875" CreationDate="2017-04-10T21:01:19.633" Score="2" Body="&lt;p&gt;I run Craft on IIS/Win 10 on my main development box and don't have issues with it.  Don't recall having to jump through hoops to get it working, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect it's more of the &quot;shared server&quot; that's the issue, but you can start by enabling &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; in Craft and check the timestamped profiling output (code and database) in the browser's console and &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; to try and narrow down where the time is going.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-10T21:01:19.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19885" PostTypeId="2" ParentId="19877" CreationDate="2017-04-10T21:06:56.013" Score="1" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19877/returning-a-is-currently-unable-to-handle-this-request-500-error-when-client#comment26718_19877&quot;&gt;Lindsey pointed out&lt;/a&gt;, I'd also highly recommend taking some time to update to the latest Craft release. Craft 1.3 is over &lt;a href=&quot;https://craftcms.com/changelog#1-3-2507&quot; rel=&quot;nofollow noreferrer&quot;&gt;3 years old&lt;/a&gt; now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're getting a 500 Internal Server Error, then it's either being generated by Craft or by your web server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's generated by Craft, it will be Craft styled and the underlying error message will be in your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's generated by your web server, the underlying error message should be in your web server's error logs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-10T21:06:56.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19886" PostTypeId="1" CreationDate="2017-04-10T23:53:38.883" Score="1" ViewCount="124" Body="&lt;p&gt;I'm just trying out the &lt;a href=&quot;https://dukt.net/twitter/docs/installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt Twitter plugin&lt;/a&gt;. Is it possible to output a link to a tweet within a timeline? I've tried guessing {{ tweet.url }}, but that doesn't work. I don't want to auto-link the tweet itself using {{ tweet.text|autoLinkTweet) }}, as I'm wanting to output the entire tweet as plain text. I've included my code below and thanks for any help in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('statuses/user_timeline', { screen_name:'craftcms', count: 3, trim_user: false }) %}&#xA;&#xA;{% if tweets %}&#xA;&#xA;  &amp;lt;h2&amp;gt;Recent Tweets&amp;lt;/h2&amp;gt;&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for tweet in tweets %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ tweet.url }}&quot;&amp;gt;{{ tweet.text }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-04-10T23:53:38.883" Title="How to output a tweet URL in a user timeline using the Dukt Twitter plugin" Tags="&lt;plugins&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19887" PostTypeId="1" AcceptedAnswerId="19888" CreationDate="2017-04-11T06:33:11.410" Score="0" ViewCount="489" Body="&lt;p&gt;Please excuse me for the title.. I have no idea how to describe my problem better - if someone knows a better description for this question feel free to edit it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a screenshot to clarify what I want to know.. Is it somehow possible to hook a custom option there?&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pbCFP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pbCFP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made an excel export for our customer and I would like to add an &quot;export to excel&quot; button there that sends an ajax request to my controller. Could you please explain me in detail how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&#xA;&lt;br&gt;&lt;br&gt;&#xA;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;So thanks to your answers I created this test (just to see if I can add something)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class SRExcelExport_ExportElementAction extends BaseElementAction&#xA;{&#xA;    /**&#xA;     * Get element action name.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Export Files');&#xA;    }&#xA;&#xA;    public function isDestructive()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;    public function performAction(ElementCriteriaModel $criteria)&#xA;    {&#xA;        // Remove all the ingredients from the selected elements&#xA;        $elements = $criteria-&amp;gt;find();&#xA;&#xA;        foreach ($elements as $element)&#xA;        {&#xA;            //do something&#xA;        }&#xA;&#xA;        // Success!&#xA;        $this-&amp;gt;setMessage(Craft::t('success'));&#xA;        return true;&#xA;    }&#xA;&#xA;    public function getTriggerHtml()&#xA;    {&#xA;        $js = 'new Craft.ElementActionTrigger({' .&#xA;            'handle: '.JsonHelper::encode($this-&amp;gt;getClassHandle()).', ' .&#xA;            'batch: true, ' .&#xA;            'validateSelection: function($selectedElements){ return true; }, ' .&#xA;            'activate: function($selectedElements){ alert(&quot;Made you click&quot;); }' .&#xA;            '});';&#xA;&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs($js);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the Plugin Handle SRExcelExport with the folder structure&lt;br&gt;&#xA;srexcelexport&lt;br&gt;&#xA;--elementactions&lt;br&gt;&#xA;-----SRExcelExport_ExportElementAction.php&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But nothing happens, the file is ignored, even a &lt;code&gt;die()&lt;/code&gt; in the constructor does nothing. Do I need to do something to &quot;call&quot; the class myself or is there just a stupid error I made? I bet its just an obvious minor error I can't see right now&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-04-11T07:37:43.530" LastActivityDate="2017-04-11T07:37:43.530" Title="How to create custom option/action for backend entry lists" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19888" PostTypeId="2" ParentId="19887" CreationDate="2017-04-11T06:50:41.270" Score="3" Body="&lt;p&gt;Indeed there is! You're looking for &lt;a href=&quot;https://craftcms.com/docs/plugins/element-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Element Actions&lt;/strong&gt;...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When you select elements on their index pages, the regular toolbar options get replaced with new ones that will trigger various actions, like batch-deleting all of the selected elements.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;That functionality is provided by Element Action classes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-04-11T07:10:58.703" LastActivityDate="2017-04-11T07:10:58.703" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19890" PostTypeId="2" ParentId="19844" CreationDate="2017-04-11T07:22:41.710" Score="1" Body="&lt;p&gt;Use SuperSort or write your own Twig filter for it. Craft/Twig don't come with a sort filter to sort by key and replicating the functionality  (storing array keys, nested loops) is possible but kind of messy and also not performing as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can understand the desire to not be reliant on too many plugin, but the functionality you need from SuperSort is simply a wrapper for a PHP function, so you can easily swap it out for another plugin if ever necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also a great opportunity to start looking into plugin dev, write your first Twig extension or a simple Template Variable might just do it.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-04-11T07:37:32.910" LastActivityDate="2017-04-11T07:37:32.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19891" PostTypeId="2" ParentId="19694" CreationDate="2017-04-11T08:30:20.390" Score="2" Body="&lt;p&gt;Something like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if item.discount %}&#xA;  &amp;lt;tr&amp;gt;&#xA;    &amp;lt;td&amp;gt;Your discount is {{ item.discount|commerceCurrency( currency ) }}&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-04-11T08:30:20.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19892" PostTypeId="2" ParentId="19882" CreationDate="2017-04-11T08:37:11.237" Score="1" Body="&lt;p&gt;Seems like you might be better using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#colorblend-array&quot; rel=&quot;nofollow noreferrer&quot;&gt;colorBlend&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.image.first() %}&#xA;{% set transformedImage = craft.imager.transformImage(image, { &#xA;  width: 1500,&#xA;  height: 700,&#xA;  effects: {&#xA;    colorBlend: ['rgb(0, 0, 0)', 0.4] }&#xA;  }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-04-11T08:37:11.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19893" PostTypeId="2" ParentId="15785" CreationDate="2017-04-11T10:33:43.723" Score="2" Body="&lt;p&gt;A tax rate set to 'price + shipping' only places tax on the line items, and does not take into account the &lt;code&gt;baseShippingCost&lt;/code&gt;, this includes the changes to the &lt;code&gt;baseShippingCost&lt;/code&gt; caused by the minimum and maximum shipping cost rules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have gone ahead and added 2 new taxable subjects to shipping rates in order to fix this limitation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Order total shipping cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Order total price. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WOByW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WOByW.png&quot; alt=&quot;screenshot of new options&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These shipping rates are order level taxes, so the tax category can not be taken into account (it is a line item/product level attribute), but this should allow you to set taxes on shipping on the order as a whole and avoid using the 'item + shipping'  line item option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be in the next release, due out in a couple of days.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-04-11T10:39:38.667" LastActivityDate="2017-04-11T10:39:38.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19894" PostTypeId="1" AcceptedAnswerId="19895" CreationDate="2017-04-11T12:14:10.947" Score="1" ViewCount="99" Body="&lt;p&gt;I am getting this error when trying to send a confirmation email to the user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template error: “Variable &quot;option&quot; does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove every bit of markup from my email template, and literally only have &lt;code&gt;&amp;lt;p&amp;gt;Hello World&amp;lt;/p&amp;gt;&lt;/code&gt; I get an email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to click the &quot;Download Receipt&quot; link, and everything works great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I output the &lt;code&gt;option&lt;/code&gt; variable: &lt;code&gt;{{ option }}&lt;/code&gt;:&#xA;When I click on the &quot;Download&quot; link, I see &lt;code&gt;receipt&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the default template that ships with commerce, with the addition of a jpg header image. At the bottom of the template is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;{% endset %}&#xA;&#xA;{# Use the option param passed into the pdf template to show different &#xA;   order pdf's depending on the context #}&#xA;&#xA; {% switch option %}&#xA; {% case &quot;receipt&quot; %}&#xA;    &amp;lt;h1&amp;gt;Receipt for Order #{{ order.number[:7] }}&amp;lt;/h1&amp;gt;&#xA;    {{ orderTable }}&#xA;{% case &quot;ajax&quot; %}&#xA;    &amp;lt;h1&amp;gt;NA&amp;lt;/h1&amp;gt;&#xA;{% default %}&#xA;    {{ orderTable }}&#xA;{% endswitch %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So clearly it has something to do with &lt;code&gt;option&lt;/code&gt; not getting set. I'm not sure where I might have un-done setting that variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-04-11T13:49:41.703" LastActivityDate="2017-04-11T13:49:41.703" Title="Commerce: Template error: “Variable &quot;option&quot; does not exist" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19895" PostTypeId="2" ParentId="19894" CreationDate="2017-04-11T12:24:07.827" Score="3" Body="&lt;p&gt;The &lt;code&gt;option&lt;/code&gt; variable is only available in the pdf template, it is not available in the email template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;order&lt;/code&gt; variable available in both.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-04-11T12:24:07.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19896" PostTypeId="1" CreationDate="2017-04-11T12:42:10.037" Score="1" ViewCount="116" Body="&lt;p&gt;I’m trying to add tags to my blog posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve created a tags group with the handle ‘default’.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Setting/Fields I’ve got a field called bodyElements which is setup as a matrix, and within bodyElements I’ve added to the Configuration a block type called Tags with a handle of ‘tags’, and then within that there’s a field called Tags with a handle of ‘blogTags’ and this is set as the Field Type of “Tags” and the Source is set as “Tags”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I go to a blog post, I can type in my content and click the button to add a Tag. I can then type in a tag and it attaches to that particular entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I’m having is that when I view the blog posts on the front end, the tags are showing up on every single post, even though they don’t have those tags attached to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;a href=&quot;https://craftcms.com/support/active-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/active-tags&lt;/a&gt; it says to insert the following code to display only the tags that are in use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').limit(null) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for tag in craft.tags.relatedTo(entries) %}&#xA;        &amp;lt;li&amp;gt;{{ tag.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that doesn’t display the tags at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My blog section has a handle of ‘blog’, so in the above code I tried replacing ‘news’ with ‘blog’ and still no tags appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can get tags to appear on my posts is by using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.group(‘default’) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('blog/tags/'~tag.id) }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the above code caused the tags to appear on every single blog post, even if they’re not tagged with anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the tags to only appear on the posts the tags are attached to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6569" LastActivityDate="2017-04-11T23:47:46.007" Title="How do I get tags to only display on posts that have that tag?" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19897" PostTypeId="1" AcceptedAnswerId="19902" CreationDate="2017-04-11T12:48:55.880" Score="1" ViewCount="464" Body="&lt;p&gt;I've got a working sort dropdown on my front end, but I'm after the dropdown keeping the chosen sort method option instead of resetting to the default top of the dropdown option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;e.g. User clicks sort by Name A - Z &gt; Sorted by name &gt; Dropdown option stays as 'Name A-Z' instead of 'default'.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;select class=&quot;sort-web w-select&quot; data-name=&quot;Sort&quot; id=&quot;sortQuery&quot; name=&quot;Sort&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;postDate asc&quot;&amp;gt;New - Old&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;title desc&quot;&amp;gt;Name Z - A&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;title asc&quot;&amp;gt;Name A - Z&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft Code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Either get the order from the query or use a default #}&#xA;{% set order = craft.request.getParam('order', 'title asc')  %}&#xA;&#xA;{% for category in craft.categories.group('university').order(order) %}&#xA;  {{ category.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderJs %}&#xA;  $(function(){&#xA;&#xA;    $('#sortQuery').on(&quot;change&quot;, function(e){&#xA;&#xA;     // Get the value from the select&#xA;     var filter = $(this).val();&#xA;     document.location.href = '{{ craft.request.getUrl() }}?order=' + filter;&#xA;&#xA;   });&#xA;&#xA;  });&#xA;{% endset %}&#xA;{% includeJs orderJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-11T14:14:20.617" Title="Make sort dropdown keep property" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19898" PostTypeId="2" ParentId="19896" CreationDate="2017-04-11T12:50:19.090" Score="2" Body="&lt;p&gt;The code you're using at the moment is trying to output the tags that are in use on &lt;em&gt;any/all&lt;/em&gt; entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I understand you correctly, you want to output the tags only for the &lt;em&gt;current&lt;/em&gt; entry, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This is explained with very useful examples in the &lt;a href=&quot;https://craftcms.com/docs/tags-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you already have the &lt;code&gt;entry&lt;/code&gt; variable set, you could do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for tag in craft.tags.relatedTo(entry) %}&#xA;        &amp;lt;li&amp;gt;{{ tag.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another example adapted from the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tags = entry.tagsFieldHandle %}&#xA;&#xA;{% if tags | length %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for tag in tags %}&#xA;            &amp;lt;li&amp;gt;{{ tag.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You first set the variable &lt;code&gt;tags&lt;/code&gt; to the tags related to your &lt;code&gt;entry&lt;/code&gt;. Then, you check if there are tags related to the entry. If there are, you iterate over them.&lt;/p&gt;&#xA;" OwnerUserId="6303" LastEditorUserId="6303" LastEditDate="2017-04-11T23:47:46.007" LastActivityDate="2017-04-11T23:47:46.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19899" PostTypeId="1" CreationDate="2017-04-11T12:57:40.750" Score="1" ViewCount="118" Body="&lt;p&gt;How can I alter the routing in Craft? I need to add a (variable) segment to every possible URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is we have a multi lingual site with multiple regions. We need to know the correct region in every template to know which data to load. There are many &quot;multi site/multi region hacks&quot; to find on SE to achieve this, but we don't really like any of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to add the region segment to the URL after the language segment: eg. &lt;a href=&quot;https://myurl.com/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://myurl.com/en/&lt;/a&gt;&lt;strong&gt;region&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is of course re-routing that URL.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;One option would be to add &lt;strong&gt;dynamic routing&lt;/strong&gt;, but than I need to do this for every template in every language (for translation purposes) and that seems a lot of work. Also, when a new language or template is added later on, all routes must be set anew.&lt;/li&gt;&#xA;&lt;li&gt;I came upon the &lt;code&gt;getElementRoute&lt;/code&gt; &lt;strong&gt;hook&lt;/strong&gt;. That allows me to change the URL as I would change it in my Twig template but nothing more it seems.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;strong&gt;query string&lt;/strong&gt; is also an option but that's just not pretty.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would need something like a &lt;em&gt;global dynamic route without a specified template&lt;/em&gt; to tell Craft: &lt;em&gt;whatever route you get, just disregard segment 2&lt;/em&gt; (region) and do the routing as you would otherwise do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, is there a way to add a segment to Craft without messing up all the routing? Maybe some very base level function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about using the &lt;code&gt;getElementRoute()&lt;/code&gt; hook to alter the URL by adding the region segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And than somehow create a route dynamicaly in the &lt;code&gt;registerSiteRoutes()&lt;/code&gt; hook that corresponds to the URL I retrieved in &lt;code&gt;getElementRoute()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do the first part, but not the second.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-04-11T13:42:51.170" LastActivityDate="2018-06-26T08:24:01.840" Title="Alter the routing in Craft for every URL independent of language" Tags="&lt;routes&gt;&lt;routing&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19900" PostTypeId="1" AcceptedAnswerId="19908" CreationDate="2017-04-11T13:06:48.587" Score="1" ViewCount="70" Body="&lt;p&gt;I have 4 main template folders, under the /craft folder (each template folder works for another subdomain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I do have per template folder, a few variables that I like to have shared amongst all templates underneath it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set projectsGroup = &quot;projectsWeather&quot; %}&#xA;{% set sliderGroup = &quot;sliderWeather&quot; %}&#xA;{% set faqGroup = &quot;faqWeather&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which are different, per template folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when I put these variables at the top of my master _layout file, this gets shared nicely amongst all templates -- that is, for those that use this _layout file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do however also have a few json generation template files, that can not use the _layout file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question now is how to elegantly assign these variables, and do this only once. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can not stick them in a separate file and just use &quot;include&quot; or &quot;extend&quot;, because then _layout either ignores or complains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2017-04-11T16:32:48.567" Title="Globally share variables" Tags="&lt;templating&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19902" PostTypeId="2" ParentId="19897" CreationDate="2017-04-11T13:46:09.193" Score="3" Body="&lt;p&gt;In short, you need to set the &lt;em&gt;selected&lt;/em&gt; attribute on the &lt;em&gt;option&lt;/em&gt; element based on the &lt;em&gt;sort order&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the sort order is &lt;code&gt;title asc&lt;/code&gt;, then that &lt;code&gt;option&lt;/code&gt; would have the &lt;code&gt;selected&lt;/code&gt; (&lt;code&gt;selected=&quot;selected&quot;&lt;/code&gt;) attribute set on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took the liberty to refactor your code to render sort options dynamically and make the selected sort order sticky by comparing the current option being iterated over, against the selected sort option.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set sortOptions = [&#xA;    {&#xA;        label: 'New - Old',&#xA;        value: 'postDate asc'&#xA;    },&#xA;    {&#xA;        label: 'Name Z - A',&#xA;        value: 'title desc'&#xA;    },&#xA;    {&#xA;        label: 'Name A - Z',&#xA;        value: 'title asc'&#xA;    },&#xA;] %}&#xA;&#xA;{% set selectedSortOption = craft.request.getParam('order', 'title asc') %}&#xA;&#xA;{% for category in craft.categories.group('university').order(selectedSortOption) %}&#xA;    {{ category.title }}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;select class=&quot;sort-web w-select&quot; data-name=&quot;Sort&quot; id=&quot;sortQuery&quot; name=&quot;Sort&quot;&amp;gt;&#xA;    {% for sortOption in sortOptions %}&#xA;        &amp;lt;option value=&quot;{{ sortOption.value }}&quot; {{ sortOption.value == selectedSortOption ? 'selected' }}&amp;gt;&#xA;            {{ sortOption.label }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Feel free to follow up if you have any questions.&lt;/p&gt;&#xA;" OwnerUserId="65" LastEditorUserId="65" LastEditDate="2017-04-11T14:14:20.617" LastActivityDate="2017-04-11T14:14:20.617" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19903" PostTypeId="1" AcceptedAnswerId="19904" CreationDate="2017-04-11T13:55:02.800" Score="3" ViewCount="253" Body="&lt;p&gt;Not so much a technical question as a how-to/best practice one, here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm building out a site that has 3 content-types (channels), a structure and a bunch of singles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site has &lt;strong&gt;35 locales&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pages &amp;amp; singles consist of normal translated content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the channels should be separate in each locale. Meaning, for example, that news items from &lt;code&gt;en_UK&lt;/code&gt; should not be translatable to &lt;code&gt;jp_JA&lt;/code&gt;. Content will be managed by a different user/group per locale and they should only see content published in their locale, not translatable entries from others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;best&quot; solution we've come up with so far is to create a channel per locale. But that adds up quickly (3 x 35...), not to mention managing fields and permissions for each channel separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to simplify this or are we going to have to bite the bullet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft 3 and multisite sounds like a dream for this but sadly we can't wait for that&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-07-03T16:15:43.667" Title="Scaling channels with 35 locales" Tags="&lt;localization&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19904" PostTypeId="2" ParentId="19903" CreationDate="2017-04-11T14:10:21.097" Score="6" Body="&lt;p&gt;You could have a single News section that is enabled for each of the locales, and choose which locale each entry should target from their Edit pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it easer on the authors, you can set the default status to Disabled for each of the locales, from the section’s settings. Then when creating a new entry, the authors only have to enable the one locale that they actually want the entry to be published for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#2-6-2972&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.2972&lt;/a&gt;, you can configure the Entries index to only show entries that are enabled for the selected locale by installing the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP JS&lt;/a&gt; plugin, and pasting this code into its “Additional JavaScript” setting:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;Craft.defaultIndexCriteria.localeEnabled = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also may want to add this bit, to ensure that entries’ locale statuses are switched on by default from the Edit Entry page, so they don’t get lost in the entry index, which is now configured to only show locale-enabled entries:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$(document).ready(function() {&#xA;    var ls = $('#locales .lightswitch').data('lightswitch');&#xA;    if (ls) {&#xA;        ls.turnOn();&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-07-03T16:15:43.667" LastActivityDate="2017-07-03T16:15:43.667" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19905" PostTypeId="1" AcceptedAnswerId="19907" CreationDate="2017-04-11T14:24:25.650" Score="1" ViewCount="252" Body="&lt;p&gt;Currently I have infinite scroll setup as below, but when changing the ordering of the entries, then loading more through the infinite scroll it's not loading in the order of the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set Sort Options&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set sortOptions = [&#xA;        {&#xA;            label: 'Name Z - A',&#xA;            value: 'title desc'&#xA;        },&#xA;        {&#xA;            label: 'Name A - Z',&#xA;            value: 'title asc'&#xA;        },&#xA;    ] %}&#xA;&#xA;{% set selectedSortOption = craft.request.getParam('order', 'title asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pagination Loop&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.categories.group('university').order(selectedSortOption).limit(1) as pageEntries %}&#xA;    &amp;lt;div id=&quot;university-widget-wrapper&quot;&amp;gt;&#xA;&#xA;    {% for category in pageEntries %}&#xA;      &amp;lt;a class=&quot;university-widget w-inline-block&quot; href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;university-widget-image&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;university-widget-content&quot;&amp;gt;&#xA;          {% for asset in category.universityLogo %}&#xA;            &amp;lt;img class=&quot;university-widget-logo&quot; src=&quot;{{ asset.url }}&quot; height=&quot;40&quot;&amp;gt;&#xA;          {% endfor %}&#xA;          &amp;lt;p class=&quot;small-paragraph&quot;&amp;gt;{{ category.description }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;div id=&quot;pagination&quot;&amp;gt;&#xA;      {% if paginate.prevUrl %}&#xA;          &amp;lt;a class=&quot;button left previous&quot; href=&quot;{{ paginate.prevUrl }}?q={{ selectedSortOption }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;      {% if paginate.nextUrl %}&#xA;          &amp;lt;a class=&quot;button right next&quot; href=&quot;{{ paginate.nextUrl }}?q={{ selectedSortOption }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endpaginate %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Javascript Adding Query&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderJs %}&#xA;  $(function(){&#xA;&#xA;    $('#sortQuery').on(&quot;change&quot;, function(e){&#xA;&#xA;     // Get the value from the select&#xA;     var filter = $(this).val();&#xA;     document.location.href = '{{ craft.request.getUrl() }}?order=' + filter;&#xA;&#xA;   });&#xA;&#xA;  });&#xA;{% endset %}&#xA;{% includeJs orderJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Endless Scroll jQuery&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;  var ias = jQuery.ias({&#xA;    container:  '#university-widget-wrapper',&#xA;    item:       '.university-widget',&#xA;    pagination: '#pagination',&#xA;    next:       '.next'&#xA;  });&#xA;&#xA;  ias.extension(new IASSpinnerExtension());            // shows a spinner (a.k.a. loader)&#xA;  ias.extension(new IASTriggerExtension({&#xA;    offset: 1,&#xA;    text: '&amp;lt;a class=&quot;button-positive w-button&quot; href=&quot;#&quot;&amp;gt;Load More Results&amp;lt;/a&amp;gt;'&#xA;  })); // shows a trigger after page 3&#xA;  ias.extension(new IASNoneLeftExtension({&#xA;    text: 'There are no more pages left to load.'      // override text when no pages left&#xA;  }));&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-11T15:08:51.273" Title="Endless Scroll + Ordering" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19906" PostTypeId="2" ParentId="19670" CreationDate="2017-04-11T14:43:01.993" Score="4" Body="&lt;p&gt;So it turns out this was a server issue due to cPanel... A few solutions for people may run in to this in future...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set email settings to remote on server&lt;/li&gt;&#xA;&lt;li&gt;Update MX entries on server&lt;/li&gt;&#xA;&lt;li&gt;Add postmaster@ and site@ mailboxes via cPanel&lt;/li&gt;&#xA;&lt;li&gt;Added this to EXIM config - &lt;a href=&quot;https://grepitout.com/configure-mailgun-cpanel-exim/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://grepitout.com/configure-mailgun-cpanel-exim/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As well as this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This will likely be being caused by a cPanel configuration item which redirects outbound traffic on SMTP ports from&#xA;  non-root users back to localhost.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;So, when attempting to connect to smtp.mailgun.org, you are silently redirected to 127.0.0.1, which then fails to&#xA;  authenticate.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This is uaually used in shared hosting environment to limit the impact of compromised scripts sending out SPAM on the&#xA;  server.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I've disabled this in WHM &gt; Server Configuration &gt; Tweak Settings &gt; Mail &gt; &quot;Restrict outgoing SMTP to&#xA;  root, exim, and mailman (FKA SMTP Tweak)&quot; and setting this to &quot;Off&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Fixed! :)&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-04-11T14:43:01.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19907" PostTypeId="2" ParentId="19905" CreationDate="2017-04-11T15:08:51.273" Score="2" Body="&lt;p&gt;You use &lt;code&gt;q&lt;/code&gt; instead of &lt;code&gt;order&lt;/code&gt; for the query param in the pagination URLs.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-04-11T15:08:51.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19908" PostTypeId="2" ParentId="19900" CreationDate="2017-04-11T16:32:48.567" Score="1" Body="&lt;p&gt;Add them to &lt;a href=&quot;https://craftcms.com/docs/config-settings#environmentVariables&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;environmentVariables&lt;/code&gt; section&lt;/a&gt; of your config file, and retrieve them using &lt;a href=&quot;https://craftcms.com/docs/templating/craft.config&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;craft.config&lt;/code&gt; template tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Config &#xA;&quot;environmentVariables&quot; =&amp;gt; [&#xA;    &quot;color&quot; =&amp;gt; &quot;blue&quot;,&#xA;]&#xA;&#xA;// Template&#xA;{{ craft.config.environmentVariables.color }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-11T16:32:48.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19909" PostTypeId="1" CreationDate="2017-04-11T17:14:03.223" Score="3" ViewCount="551" Body="&lt;p&gt;I'm running a mid sized website (couple hundred articles, between 30-50k visits per day) on a Digital Ocean 16GB / 8 Cores web server and I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the time the website runs smoothly, however, several times per day MySQL starts using all of the CPU and I see a spike on disk IO. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running show process list on MySQL shows that most queries are &quot;Copying to tmp table&quot;  and look like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new using Craft and I want to know is this queries are normal and if there's a way to optimize them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    EXPLAIN SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_airingDate`, `content`.`field_airingFrom`, `content`.`field_airingTo`, `content`.`field_awsPath`, `content`.`field_descripcion`, `content`.`field_descripcionSocialMedia`, `content`.`field_subtitulo`, `content`.`field_texto`, `content`.`field_titulo`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;    FROM `elements` `elements`&#xA;    JOIN `elements_i18n` `elements_i18n` ON elements_i18n.elementId =         elements.id&#xA;    JOIN `content` `content` ON content.elementId = elements.id&#xA;    JOIN `entries` `entries` ON entries.id = elements.id&#xA;    JOIN `sections` `sections` ON sections.id = entries.sectionId&#xA;    LEFT JOIN `structures` `structures` ON structures.id = sections.structureId&#xA;    LEFT JOIN `structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;    WHERE (((((elements_i18n.locale = 'es') AND (content.locale = 'es')) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2017-04-11 16:56:24') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2017-04-11 16:56:24')))) AND (elements_i18n.enabled = 1)) AND (sections.handle='articulos')&#xA;    GROUP BY `elements`.`id`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    SELECT count(`derivedElementsTable`.`elementsId`)&#xA;    FROM (SELECT `elements`.`id` AS `elementsId`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`&#xA;    FROM `elements` `elements`&#xA;    JOIN `elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;    JOIN `content` `content` ON content.elementId = elements.id&#xA;    LEFT JOIN `relations` `sources1` ON (sources1.targetId = elements.id)&#xA;    LEFT JOIN `relations` `targets1` ON (targets1.sourceId = elements.id)&#xA;    JOIN `entries` `entries` ON entries.id = elements.id&#xA;    JOIN `sections` `sections` ON sections.id = entries.sectionId&#xA;    LEFT JOIN `structures` `structures` ON structures.id = sections.structureId&#xA;    LEFT JOIN `structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;    WHERE (((((elements_i18n.locale = 'es') AND (content.locale = 'es')) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2017-04-11 16:56:33') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2017-04-11 16:56:33')))) AND (elements_i18n.enabled = 1)) AND ((sources1.sourceId='175') OR (targets1.targetId='175'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand that the i18n tables are where the locales data is stored. Is there a way to disable a locale without losing any data?&lt;/p&gt;&#xA;" OwnerUserId="6573" LastEditorUserId="57" LastEditDate="2017-04-11T22:58:31.340" LastActivityDate="2017-05-12T05:24:07.617" Title="Poor performance on midsized site / Queries without index?" Tags="&lt;database&gt;&lt;performance&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19910" PostTypeId="1" CreationDate="2017-04-11T18:45:21.110" Score="0" ViewCount="223" Body="&lt;p&gt;I have a site setup using a single article detail page for multiple channels. Each channel has a different category group and I need to output the categories as breadcrumbs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so it would ideally look something like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;category 1 &gt; sub category (if exists) &gt; entry title&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different category fields include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;businessIntelCategories&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;learnCategories&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;trainingCategories&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;savingsCategories&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Not sure how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="273" LastEditDate="2017-04-12T02:05:41.613" LastActivityDate="2017-04-12T02:05:41.613" Title="Categories as Breadcrumbs" Tags="&lt;categories&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19911" PostTypeId="1" CreationDate="2017-04-11T18:59:25.760" Score="1" ViewCount="186" Body="&lt;p&gt;I've got a channel with over 1,000 pages, and the entries for this channel have an asset field (for images). I set the asset field to use &lt;code&gt;{slug}&lt;/code&gt; as the folder name (because otherwise the content author would have to wade through thousands of photos to find the ones for a certain entry), and so now I have thousands of folders in the asset source's folder in the filesystem. (Just using the server filesystem here, not S3/rackspace/etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is, now when you try to expand that asset source in the asset manager sidebar, the page just crashes. Running latest version of Craft (2.6.something), PHP 7, on a beefy VPS server... client is most recent version of Chrome on a modern MacBook with plenty of RAM, etc... so this is not a problem of too few server or browser resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: assuming there is some practical limit to the number of folders that the asset manager UI can deal with (which is what, by the way?)... what's a good strategy for me to handle this situation? Each of these thousand+entries will have at least one image, some up to a dozen (this is a fairly large product catalog site). Is there a better way to organize the folder structure, or perhaps a better way to dynamically generate the sub-folders (as opposed to &lt;code&gt;{slug}&lt;/code&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="3931" LastEditDate="2017-04-11T19:48:23.967" LastActivityDate="2017-04-12T12:19:03.460" Title="How to deal with too many folders in asset source?" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19912" PostTypeId="1" AcceptedAnswerId="19913" CreationDate="2017-04-11T22:14:31.447" Score="1" ViewCount="231" Body="&lt;p&gt;I've setup a global asset field so that a client can change a placeholder image that gets used throughout their website. I'm using the Imager plugin for my image transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following image code works fine when using a hard-coded image URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = 'http://placehold.it/450x225/eee/eee' %}&#xA;{% set transformedImage = craft.imager.transformImage(image, { width: 450, height: 225, }) %}&#xA;&amp;lt;img src=&quot;{{ transformedImage.url }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I replace the hard-coded image URL with the global asset field, it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = '{{ websitePreferences.placeholderImage.first.url }}' %}&#xA;{% set transformedImage = craft.imager.transformImage(image, { width: 450, height: 225, }) %}&#xA;&amp;lt;img src=&quot;{{ transformedImage.url }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this error message (Craft/Exception):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Source folder “/Users/stephen/Repositories/repo-name-here/public_html./” does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I output the global asset field elsewhere in the template, I get this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://my-locl-url.dev/uploads/images/Placeholders/placeholder-image.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://my-locl-url.dev/uploads/images/Placeholders/placeholder-image.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I hard-code this URL into my image code, the image works fine. So does anyone have any idea why using a global for the placeholder image in this way isn't working? Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="179" LastEditorUserId="45" LastEditDate="2017-04-11T22:50:43.060" LastActivityDate="2021-02-26T03:06:09.350" Title="Trying to set an image URL using a global asset field" Tags="&lt;globals&gt;&lt;plugin-imager&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19913" PostTypeId="2" ParentId="19912" CreationDate="2017-04-11T23:05:25.370" Score="3" Body="&lt;p&gt;I don't know if it's the cause of the error you're receiving or not, but this is incorrect Twig syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = '{{ websitePreferences.placeholderImage.first.url }}' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll never need to nest &lt;code&gt;{{ }}&lt;/code&gt; inside of &lt;code&gt;{% %}&lt;/code&gt; or visa versa in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is correct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = websitePreferences.placeholderImage.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-11T23:05:25.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19914" PostTypeId="2" ParentId="19909" CreationDate="2017-04-11T23:36:31.123" Score="2" Body="&lt;p&gt;I can tell you that both of those are the semi-dynamic element queries that Craft uses to grab elements from the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2nd one is likely the result of someone calling a &lt;code&gt;.total()&lt;/code&gt; or &lt;code&gt;.count()&lt;/code&gt; on &lt;code&gt;ElementCriteriaModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see you ran &lt;code&gt;EXPLAIN&lt;/code&gt;, but don't see the results from it.  You can use that as a starting point to see what index MySQL chose to execute that query and if it's not ideal.  Craft can't add an index to every &lt;code&gt;content&lt;/code&gt; column (for obvious reasons), so if something in your templates is generating a SQL query frequently that causes MySQL to chose an index that isn't ideal and adding an index to content column would solve that for you, then that's something you can certainly do.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I understand that the i18n tables are where the locales data is stored. Is there a way to disable a locale without losing any data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. It either exists or it doesn't.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-05-12T05:24:07.617" LastActivityDate="2017-05-12T05:24:07.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19918" PostTypeId="2" ParentId="19805" CreationDate="2017-04-12T08:08:50.993" Score="1" Body="&lt;p&gt;I got a solution. &#xA;You can't overwrite array elements at this point, but the whole array. I also found it better to use the event &quot;commerce_cart.onBeforeAddToCart&quot;.&#xA;My working code is now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_cart.onBeforeAddToCart', function($event) {&#xA;    $imageId = craft()-&amp;gt;ultraschall-&amp;gt;uploadCustomerImage(); // add image to asset folder&#xA;    if(isset($imageId) &amp;amp;&amp;amp; is_numeric($imageId)){&#xA;        $lineItem = $event-&amp;gt;params['lineItem'];&#xA;        $options = $lineItem-&amp;gt;options;&#xA;        $options['image'] = $imageId;&#xA;        $lineItem-&amp;gt;options = $options;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2017-04-12T08:08:50.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19919" PostTypeId="1" AcceptedAnswerId="19921" CreationDate="2017-04-12T08:50:26.453" Score="1" ViewCount="206" Body="&lt;p&gt;I'm just a beginner in Craft CMS but i'm wondering why there's no Add New Entry button in my dashboard. What should be the problem with it?&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="125" LastEditDate="2017-04-12T09:24:29.193" LastActivityDate="2019-09-17T01:01:06.567" Title="No Add New Entry button" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19920" PostTypeId="1" CreationDate="2017-04-12T08:57:51.813" Score="1" ViewCount="630" Body="&lt;p&gt;I'm just wondering is it possible to have nested Fields inside of a Custom Field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I create a custom Field type. I wish for it to contain all of the following. So it will contain multiple fields inside of it.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset   &lt;/li&gt;&#xA;&lt;li&gt;Matrix   &lt;/li&gt;&#xA;&lt;li&gt;Entry   &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this something that can be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate any pointers.&lt;/p&gt;&#xA;" OwnerUserId="5438" LastEditorUserId="5438" LastEditDate="2017-04-12T10:17:10.173" LastActivityDate="2017-04-12T17:54:45.080" Title="Creating a Custom Field Type with nested Fields" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2017-04-27T02:41:16.080" ContentLicense="CC BY-SA 3.0" />
  <row Id="19921" PostTypeId="2" ParentId="19919" CreationDate="2017-04-12T09:17:42.793" Score="4" Body="&lt;p&gt;There is a &lt;strong&gt;Quick Post&lt;/strong&gt; widget that allows you to create entries from the Dashboard page of the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;New Entry&lt;/strong&gt; button is available from the entries index pages located at the top right, e.g. http://&#xA;example.com/admin/entries/news&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="3905" LastEditDate="2019-09-17T01:01:06.567" LastActivityDate="2019-09-17T01:01:06.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19922" PostTypeId="1" AcceptedAnswerId="19986" CreationDate="2017-04-12T10:35:01.780" Score="1" ViewCount="162" Body="&lt;p&gt;I have a front end reg form saving profiles via ajax. All user and profile data is getting stored ok.&#xA;The problem comes with validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems Craft likes to load the errors for certain fields first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the above fills the error array with username, title and email before processing the others. In ajax am getting the errors like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function appendErrors(errors) {&#xA;&#xA;$.each(errors, function(field, errors) {&#xA;    appendError(field, errors);&#xA;});&#xA;}&#xA;&#xA;function appendError(field, errors) {&#xA;var $errorList = $( '&amp;lt;ul class=&quot;errors&quot; /&amp;gt;' );&#xA;&#xA;$.each(errors, function(index, error) {&#xA;    $errorList.append($('&amp;lt;li&amp;gt;').html(error));&#xA;    console.log(error);&#xA;});&#xA;&#xA;$(&quot;input[name=&quot; + field + &quot;]&quot;).after($errorList);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to show all the errors to the user at once on page for sensible UX reasons. So quick brain check - is Craft really doing this? If so, then I see my options like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Could switch to a pure jQuery/js validation &lt;/li&gt;&#xA;&lt;li&gt;Could try and manipulate the error array and reindex based on tabindex?&lt;/li&gt;&#xA;&lt;li&gt;Could try overriding Craft's validation thru plugin&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Has anyone else come at this in earnest?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2017-04-12T18:10:26.403" LastActivityDate="2017-04-15T10:16:34.717" Title="User profile validation control" Tags="&lt;registration&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19923" PostTypeId="2" ParentId="19911" CreationDate="2017-04-12T12:19:03.460" Score="1" Body="&lt;p&gt;As you have deduced, Assets have a fair amount of javascript attached to each folder and file to deal with all the dragging and dropping. To save resources, a folder gets initialized only when it becomes visible. So, if you're exposing a thousand of those folders at the same time, the JS engine will take quite a hit and consume huge amounts of resources. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience, a good way of mitigating is dividing the subfolders by years and months. Since an entry might not have a post date yet when it's being edited and the post date might change over the course of an entry's lifetime, the path I've come to rely on is &lt;code&gt;{dateCreated|date('Y')}/{dateCreated|date('m')}/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if this is being used in a Matrix block, you'll have to prefix all those variables with &lt;code&gt;owner.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-04-12T12:19:03.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19924" PostTypeId="1" AcceptedAnswerId="31122" CreationDate="2017-04-12T14:24:29.887" Score="3" ViewCount="434" Body="&lt;p&gt;I'm looking how to use the &lt;code&gt;.offset(x)&lt;/code&gt; parameters of craft.entries inside the ElementAPI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to add &lt;code&gt;'offset' =&amp;gt;&lt;/code&gt; 1 before, after and inside the &lt;code&gt;criteria&lt;/code&gt; array, but the x first entries are still added to the JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I skip the first X entries of ElementAPI?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2019-08-01T22:52:55.523" Title="How to skip the first X entries using ElementAPI" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19925" PostTypeId="1" AcceptedAnswerId="19926" CreationDate="2017-04-12T14:47:17.263" Score="1" ViewCount="424" Body="&lt;p&gt;How do I go about using a dynamic value to access a user field value? I have created a form builder for users and dynamically populate the user field based on the question's associated field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input name=&quot;fields[{{ question.fieldName }}]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works nicely but I am looking to pre-populate this input with a value if the user has previously provided and saved this info but I'm having trouble figuring out how to combine the field name with currentUser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first try was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldName = question.fieldName %}&#xA;{{ currentUser.fieldName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that returns the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft\UserModel and its behaviors do not have a method or closure named &quot;fieldName&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="5581" LastEditorUserId="5581" LastEditDate="2017-04-12T15:02:05.377" LastActivityDate="2017-04-12T15:08:54.387" Title="Variable for User Field" Tags="&lt;variable&gt;&lt;user-profile&gt;&lt;usermodel&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19926" PostTypeId="2" ParentId="19925" CreationDate="2017-04-12T15:08:54.387" Score="2" Body="&lt;p&gt;You could try using the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; function in twig, this should let you call dynamic properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ attribute(currentUser, question.fieldName) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-04-12T15:08:54.387" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19929" PostTypeId="1" CreationDate="2017-04-12T16:25:38.417" Score="2" ViewCount="325" Body="&lt;p&gt;I have a few 1000 existing entries and just introduced a new Category type. And I would need to assign all existing entries, to a certain category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been looking in the MySQL databases what exactly is going on, so I could reproduce it with a query directly in there, but can't seem to pinpoint exactly what I would need to update. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2017-07-28T22:18:46.817" Title="Batch assigning a certain category to existing entries" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19930" PostTypeId="2" ParentId="19929" CreationDate="2017-04-12T17:04:24.273" Score="1" Body="&lt;p&gt;You could build a plugin to grab all the entries and then assign that new category to it that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This bit of code is untested but this should do it, since this is a one off thing, you can get away with just doing it in chunks by setting the limit and offset, otherwise I'd recommend creating this as a Task:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get all the entries&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = &quot;news&quot;; // just using news as an example, be sure to set the appropriate section handle&#xA;$criteria-&amp;gt;limit = null;&#xA;// $criteria-&amp;gt;offset = null; // you could use the limit and offset field to do this 200 at a time, to avoid it timing out on you&#xA;$criteria-&amp;gt;status = null;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;$categoryIds = array(222); // this would be the new category (its ID) that you want to assign to the entry, be sure to set the correct ID here&#xA;&#xA;for($i=0; $i&amp;lt;count($entries); $i++)&#xA;{&#xA;    $entry = $entries[$i]; // for easier reference&#xA;&#xA;    // lets get the existing categories that are assigned to this entry and add it to the new category ID you set a few lines above, if there are no existing categories for this, then you can remove this for loop entirely&#xA;    for($c=0; $c&amp;lt;count($entry-&amp;gt;categoryFieldHandle); $c++)&#xA;    {&#xA;        $categoryIds[] = $entry-&amp;gt;categoryFieldHandle[$c]-&amp;gt;id; // be sure to replace categoryFieldHandle with the category field handle for the category field&#xA;    }&#xA;&#xA;    // setting the categories to this field, be sure to replace categoryFieldHandle here too&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;        'categoryFieldHandle' =&amp;gt; $categoryIds,&#xA;    ));&#xA;&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry); // save the entry&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-12T17:04:24.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19931" PostTypeId="1" CreationDate="2017-04-12T17:46:12.947" Score="4" ViewCount="687" Body="&lt;p&gt;Is there any reason the mySQL, CraftCMS, and assets/images/content can't all live on the same server, assuming the server is appropriately sized and backed up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any sizing/scaling guidelines?&lt;/p&gt;&#xA;" OwnerUserId="6579" LastActivityDate="2017-04-12T23:06:43.873" Title="Self-hosting requirements/scaling" Tags="&lt;assets&gt;&lt;database&gt;&lt;server&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19932" PostTypeId="2" ParentId="19920" CreationDate="2017-04-12T17:54:45.080" Score="1" Body="&lt;p&gt;I don't believe you need a new custom field type for this. What your describing has been accomplished quite well already by the &lt;strong&gt;Neo&lt;/strong&gt; plugin...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-neo&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additionally, the &lt;strong&gt;Super Table&lt;/strong&gt; plugin has similar capabilities...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/SuperTable&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-04-12T17:54:45.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19933" PostTypeId="2" ParentId="19931" CreationDate="2017-04-12T17:59:09.873" Score="5" Body="&lt;p&gt;&lt;strong&gt;No reason at all, that should work perfectly fine.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, at least 90% of my projects keep files, database, and assets all on the same server. For the remaining 10%, I'm usually only moving the assets to Amazon S3. Everything else continues to live on the same server.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-04-12T17:59:09.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19934" PostTypeId="2" ParentId="19931" CreationDate="2017-04-12T23:06:43.873" Score="3" Body="&lt;p&gt;Not to stray too far off the Craft beaten path here but any scaling guidelines you see on other sites usually will apply to Craft as well. You'll know when you need to start scaling... might you have a ton of entries and the database is starting to slow down. Or you've outgrown your small VPS. It happens. Or least that's what you hope to have happen!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you get a ton of traffic or are doing some crazy database calls, even a single, small VPS with everything you've described properly setup should be able to handle a good amount of visits per month (at least 1 million, if you can cache, you can easily do more than that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have to scale, you've probably either run out of disk space/your site otherwise grows or you get website traffic (visitors) and your server simply can't keep up any more. Knowing which boat you're in will help you figure out what to do next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep 20-30% of your disk space available. When you hit that limit, think about scaling. At least on a VPS, you can usually &quot;resize&quot; your limits fairly easily or attach more storage with some providers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as Craft is concerned, if you have plenty of space left, but you're getting more visitors, it's super easy to start serving your static files from a CDN and/or S3 just by changing some settings inside Craft. That'll cut your load on your server too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not strapped for disk space, most people spin off their database to another server first for performance reasons.  When MySQL gets a lot of room to play around in, it tends to run faster. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's some schools of thought that if you want to be truly be PCI Compliant (for doing e-commerce), your database should live on a separate server as well. (That's really up your QSA.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you outgrow that, you might run a load balanced server setup (meaning 2 or more web servers), you usually have those servers each hit that one database.  Or you can duplicate the whole server to increase redundancy (since if your single db goes down, you're SOL.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's pros and cons to all approaches but if you know you're going to get big eventually, it helps to have a little overview.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-04-12T23:06:43.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19935" PostTypeId="2" ParentId="19632" CreationDate="2017-04-13T04:25:28.073" Score="1" Body="&lt;p&gt;If you're referring to the position of the event inside the loop, so you can just use this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ loop.index }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're referring to which occurrence the event is (of the full series of recurrences of that event), then I don't think that is currently possible.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-04-13T04:25:28.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19936" PostTypeId="1" CreationDate="2017-04-13T09:12:18.483" Score="1" ViewCount="112" Body="&lt;p&gt;I want to have a button on order information page when clicked the same order should be repeated. How can I put the same products again in the cart or simply re-order again?&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="57" LastEditDate="2017-04-13T15:25:24.393" LastActivityDate="2017-11-18T22:36:46.137" Title="How can I re-order the same order?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19937" PostTypeId="2" ParentId="19936" CreationDate="2017-04-13T09:41:15.477" Score="1" Body="&lt;p&gt;This would probably require a plugin with a controller which you could post the order id to when clicking the button. Within the controller you could then query the database to get each line item and add it to the cart within a service if it is in stock and still enabled. The final step would then be to redirect to the basket or posted url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs here should help you get started: &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/controllers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-04-13T09:41:15.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19938" PostTypeId="1" CreationDate="2017-04-13T11:43:06.333" Score="1" ViewCount="354" Body="&lt;p&gt;I'm currently trying to implement a simple file-upload form with CraftCMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even though there are no errors on submitting the form, no file actually seems to get uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;29&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;file&quot; name=&quot;useruploads&quot; style=&quot;margin-bottom: 30px&quot;/&amp;gt;&#xA;&#xA;        &amp;lt;select class=&quot;form-control&quot; id=&quot;sel1&quot; style=&quot;margin-bottom: 30px&quot;&amp;gt;&#xA;            &amp;lt;option&amp;gt;x-challenge auswählen&amp;lt;/option&amp;gt;&#xA;            {% for entry in craft.entries.section('challenges') %}&#xA;                {% for ch in entry.allOverChallenge %} %}&#xA;                    &amp;lt;option&amp;gt;( Tirol ) {{ch.allOverName}}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;            {% endfor %}&#xA;&#xA;            {% for entry in craft.entries.section('xSpots') %}&#xA;                {% for ch in entry.standaloneChallenges %} %}&#xA;                &amp;lt;option&amp;gt;( {{entry.title}} ) {{ch.standaloneName}}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;challenge_select&quot; placeholder=&quot;Titel eingeben&quot; style=&quot;margin-bottom: 30px&quot;&amp;gt;&#xA;&#xA;        &amp;lt;textarea class=&quot;form-control&quot; rows=&quot;5&quot; id=&quot;challenge_description&quot; placeholder=&quot;Beschreibung eingeben&quot; style=&quot;margin-bottom: 30px&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;challenge_customtags&quot; placeholder=&quot;Hashtags ( max. 3 )&quot; style=&quot;margin-bottom: 30px&quot;&amp;gt;&#xA;        &amp;lt;div style=&quot;margin-bottom: 30px&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;reset&quot; value=&quot;abbrechen&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;hochladen&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attaching two screenshots that show both the actual field and the section:&#xA;&lt;br/&gt;&lt;br/&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/awKln.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/awKln.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/YMpZz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YMpZz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;br/&gt;&lt;br/&gt;&#xA;When submitting the form in it's current state, no entries actually get added to the field as shown in the image below. Am I doing something wrong here? I'd appreciate some help on the topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bojKe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bojKe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5798" LastActivityDate="2017-04-13T12:09:47.530" Title="Issue with uploading files from frontend" Tags="&lt;frontend&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19939" PostTypeId="1" AcceptedAnswerId="19940" CreationDate="2017-04-13T11:43:11.090" Score="3" ViewCount="1023" Body="&lt;p&gt;I'd like my form to return to the same page with a param ?success. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page slug is dynamic though so will change depending on what form you are on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/dynamic-url?success&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entrySlug = craft.request.lastSegment %}                         &#xA;&#xA;&#xA;                                    {{ craft.freeform.form(&quot;landingPage&quot;, {&#xA;                                        id: &quot;form-landing&quot;,&#xA;                                        useRequiredAttribute: true,&#xA;                                        returnUrl: &quot;{{ entrySlug }}?success&quot;&#xA;                                    }).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously if i just use &lt;code&gt;returnUrl: &quot;?success&quot;&lt;/code&gt; it takes me back to the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of this is so I can trigger facebook events upon form completion, so open to any better approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-04-13T11:59:26.620" Title="Freeform ReturnURL to same page" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19940" PostTypeId="2" ParentId="19939" CreationDate="2017-04-13T11:59:26.620" Score="5" Body="&lt;p&gt;Have you tried using the &lt;code&gt;{{ craft.request.url }}&lt;/code&gt; variable in your returnUrl setting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you should be able to format it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;returnUrl: craft.request.url ~ &quot;?success&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details about the craft.request model can be found here: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-04-13T11:59:26.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19941" PostTypeId="2" ParentId="19938" CreationDate="2017-04-13T12:06:20.390" Score="2" Body="&lt;p&gt;Have you tried enabling devMode in the craft/config/general.php file? You can do this by adding &lt;code&gt;'devMode' =&amp;gt; true&lt;/code&gt; to the array. You should then be able to see an error on submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this fails to output anything then it could be that your input requires square brackets adding to the name, e.g. &lt;code&gt;name=&quot;useruploads[]&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though you have limited the field to 1 upload, it may still be expecting an array to be posted to it.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-04-13T12:06:20.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19942" PostTypeId="2" ParentId="19938" CreationDate="2017-04-13T12:09:47.530" Score="1" Body="&lt;p&gt;Doesn't look like the field name is correct - you should be using the &lt;code&gt;fields&lt;/code&gt; namespace for all the actual Entry fields. For the upload, for example, you should be using &lt;code&gt;fields[useruploads]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find more information about Asset uploads specifically &lt;a href=&quot;https://craftcms.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-04-13T12:09:47.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19943" PostTypeId="1" AcceptedAnswerId="19993" CreationDate="2017-04-13T13:08:00.980" Score="1" ViewCount="100" Body="&lt;p&gt;How can I use a request variable used in an upload form like this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;29&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;file&quot; name=&quot;fields[useruploads]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;challenge_id&quot;&amp;gt;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea is to use the field &quot;challenge_id&quot; as dynamic upload location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2oQYf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2oQYf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get this?&lt;/p&gt;&#xA;" OwnerUserId="6585" LastActivityDate="2017-04-17T18:48:40.417" Title="Use REQUEST variable as dynamic upload location" Tags="&lt;upload&gt;&lt;request&gt;&lt;files&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19944" PostTypeId="1" AcceptedAnswerId="19945" CreationDate="2017-04-13T14:01:34.430" Score="1" ViewCount="76" Body="&lt;p&gt;Has anyone got any experience working with iCal feeds - I have written a plugin utilising the &lt;a href=&quot;https://github.com/controlz/CalFileParser&quot; rel=&quot;nofollow noreferrer&quot;&gt;CalFileParser library&lt;/a&gt; but the UK clock changes have thrown all the items out, so eg an all day event is now showing up as at 11pm the day before. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;BEGIN:VEVENT&#xA;DTEND:20170418T230000Z&#xA;DTSTAMP:20170412T114209Z&#xA;DTSTART:20170418T230000Z&#xA;SEQUENCE:0&#xA;SUMMARY:F4 Careers Day&#xA;UID:65d28288-9ba7-404c-85fe-b66682e2f605&#xA;END:VEVENT&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is importing as 23:00 on 18/04/2017. However importing the feed into Calendar (Mac) is reporting the event as expected at 00:00 on 19/04/2017.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I update my site settings to BST (UTC+1) and parse the value into a DateTime object then it outputs to screen correctly, eg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$tmp = DateTime::createFromString($item['dtstart']-&amp;gt;date);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft\DateTime Object ( [date] =&amp;gt; 2017-04-19 00:00:00.000000 [timezone_type] =&amp;gt; 3 [timezone] =&amp;gt; Europe/London )&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on saving to my database record (to a column with AttributeType::DateTime) this date value is saved as &lt;code&gt;2017-04-18 23:00:00&lt;/code&gt;. This means that any attempt to retrieve and show this on my site outputs the wrong date/time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to get my script to acknowledge the time difference and save this to the relevant record without having to tinker with the code every 6 months?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-04-13T14:21:01.610" Title="iCal feed import - Timezone query" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;import&gt;&lt;timezone&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19945" PostTypeId="2" ParentId="19944" CreationDate="2017-04-13T14:21:01.610" Score="2" Body="&lt;p&gt;This sounds like that CalFileParser library you are using has some issues with timezones. There is a pull-request that supposedly fixes these, but I would rather exchange it for another library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/u01jmg3/ics-parser&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/u01jmg3/ics-parser&lt;/a&gt; has the more modern codebase, seems to be actively maintained, more used, and can be installed using composer.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-04-13T14:21:01.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19946" PostTypeId="1" CreationDate="2017-04-13T14:25:46.937" Score="2" ViewCount="494" Body="&lt;p&gt;I know I can set errors and notices in the CP with &lt;code&gt;setError()&lt;/code&gt; and &lt;code&gt;setNotice()&lt;/code&gt;.&#xA;But it gets overruled by the default error message in my event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;beforeDeleteEntry&lt;/code&gt; event which stops the deleting of an entry by using &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt;. This makes Craft display a default error &quot;can't delete entry&quot;. I'd like to add more to that error or show another one, but using &lt;code&gt;setError()&lt;/code&gt; does not work. A &lt;code&gt;setNotice()&lt;/code&gt; is shown however so I suppose the error gets replaced by the default Craft error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do something about that?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-04-18T23:30:43.457" Title="How to overrule Craft error messages with custom setError()?" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19947" PostTypeId="2" ParentId="19729" CreationDate="2017-04-13T14:48:18.997" Score="0" Body="&lt;p&gt;OK, so this did have a really simple solution. Just use isDefault.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if variant.isDefault %}Show the product{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works like a charm.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-04-13T14:48:18.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19948" PostTypeId="1" CreationDate="2017-04-13T15:28:10.793" Score="0" ViewCount="64" Body="&lt;p&gt;For some reason, when outputting 'featured' tagged items, It's ordering them I presume by alphabetical values which is breaking the nth-child CSS set on every 3rd element? Is there anyway to stop this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Getting Tagged Categories&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set tag = craft.tags.slug('featured').first() %}&#xA;  {% set categories = craft.categories.relatedTo(tag) %}&#xA;&#xA;  {% if categories|length %}&#xA;    {% for category in categories.limit(3) %}&#xA;&#xA;      &amp;lt;a class=&quot;university-widget w-inline-block&quot; href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;&#xA;        {% for asset in category.universityImage %}&#xA;          &amp;lt;div class=&quot;university-widget-image&quot; style=&quot;background-image:url({{ asset.url }})&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;div class=&quot;university-widget-content&quot;&amp;gt;&#xA;          {% for asset in category.universityLogo %}&#xA;            &amp;lt;img class=&quot;university-widget-logo&quot; src=&quot;{{asset.url}}&quot; height=&quot;40&quot;&amp;gt;&#xA;          {% endfor %}&#xA;          &amp;lt;p class=&quot;small-paragraph university-widget-description-test&quot; id=&quot;university-widget-description&quot;&amp;gt;{{ category.description }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CSS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.university-widget:nth-child(3n)&#xA;{&#xA;  margin-right:0px;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Picture Evidence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gh7c8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gh7c8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-13T18:09:12.360" Title="Craft Ordering breaking nth child?" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19949" PostTypeId="1" AcceptedAnswerId="20033" CreationDate="2017-04-13T15:38:00.227" Score="1" ViewCount="377" Body="&lt;p&gt;Under Sprout SEO 2 I am able to obtain the SEO metadata for a specific &lt;code&gt;entry&lt;/code&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({&#xA;    id: entry.id,&#xA;    title: entry.title,&#xA;    description: entry.body|striptags|slice(0, 160)&#xA;}) %}&#xA;{{ craft.sproutSeo.getOptimizedMeta().basic.title }}&#xA;{{ craft.sproutSeo.getOptimizedMeta().basic.description }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I am using the entry's &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt; fields as fallback SEO metadata if none is specified on the entry. This is all &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/sprout-seo-2/introduction#managing-your-seo-metadata-in-your-template&quot; rel=&quot;nofollow noreferrer&quot;&gt;documented for Sprout SEO 2&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I achieve this under Sprout SEO 3? The closest I can get is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({&#xA;    id: entry.id&#xA;}) %}&#xA;{% sproutseo 'optimize' %}&#xA;{{ metadata.meta.search.title }}&#xA;{{ metadata.meta.search.description }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although this requires &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/custom-metadata-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;disabling automatic metadata rendering&lt;/a&gt;, which I require elsewhere, and enabling the custom &lt;code&gt;metadata&lt;/code&gt; variable. It also omits the fallback SEO metadata as this now overrides the entry's metadata.&lt;/p&gt;&#xA;" OwnerUserId="6576" LastActivityDate="2017-09-15T21:00:38.717" Title="Obtaining SEO metadata for a specific entry under Sprout SEO 3" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19950" PostTypeId="2" ParentId="19843" CreationDate="2017-04-13T15:38:42.190" Score="1" Body="&lt;p&gt;I don't see events being triggered in the Actions Service (in my version of Charge anyway), so you won't be able to listen for those. You'll most likely have to modify the core, if you do, document that and when you update charge, you can easily put your modifications back into place or do a pull request to charge in hopes that event gets added to the core.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-13T15:38:42.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19951" PostTypeId="2" ParentId="19948" CreationDate="2017-04-13T15:44:46.200" Score="1" Body="&lt;p&gt;I can't see why Craft would be breaking a CSS rule, you're outputting three items and is it outputting the 3 items on the page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, then the CSS rule might need to be fixed. If not, then I don't understand your problem.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="57" LastEditDate="2017-04-13T18:09:12.360" LastActivityDate="2017-04-13T18:09:12.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19952" PostTypeId="1" CreationDate="2017-04-13T15:49:39.987" Score="1" ViewCount="131" Body="&lt;p&gt;Is there a booking plugin available for Craft Commerce that would let you arrange a delivery via a calendar interface with AM and PM timeslots? Or would it need to be custom developed for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client's shop already has this functionality via it's current custom CMS, but we'd like to move it over to Craft Commerce if possible. And this looks like one of the sticking points as there doesn't seem to be anything like it currently.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="57" LastEditDate="2017-04-13T18:10:01.623" LastActivityDate="2017-04-13T18:11:07.953" Title="Craft Commerce Arrange a delivery booking plugin?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19953" PostTypeId="1" AcceptedAnswerId="19954" CreationDate="2017-04-13T16:13:44.023" Score="3" ViewCount="4211" Body="&lt;p&gt;As I understand, craft overrides Twig's &lt;code&gt;replace&lt;/code&gt; filter to allow for the use of regex; which is just running &lt;code&gt;preg_replace&lt;/code&gt; under the hood&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When running the following regex through &lt;code&gt;preg_replace&lt;/code&gt; in a php page (outside of craft) in order to match non-ASCII characters; it works as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/([^ !&quot;#$%&amp;amp;\'\(\)*\+,-\.\/0123456789:;&amp;lt;=&amp;gt;\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]\^\\\_`abcdefghijklmnopqrstuvwxyz{\|}~\n]+)/u&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when running it through &lt;code&gt;replace&lt;/code&gt; in a template in craft; nothing is matched&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas as to why this is happening and possible solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6588" LastActivityDate="2017-04-13T16:21:25.163" Title="Twig replace regex" Tags="&lt;templating&gt;&lt;replace&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19954" PostTypeId="2" ParentId="19953" CreationDate="2017-04-13T16:21:25.163" Score="4" Body="&lt;p&gt;Try doubling-up your backslashes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/filters#replace&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/filters#replace&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-13T16:21:25.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19955" PostTypeId="1" AcceptedAnswerId="19956" CreationDate="2017-04-13T17:13:51.650" Score="1" ViewCount="64" Body="&lt;p&gt;When a user registers on my site, I am asking for their first, last, email and address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to pass the data I already have along to commerce. So when I get to the &lt;code&gt;/address&lt;/code&gt; screen, as much of that form is already pre-populated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set modelName = modelName is defined ? modelName : 'address' %}&#xA;{% set model = address is defined ? address : null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I (think) the ideal solution is to set the model to the user model. I will never allow guest checkout on this site, yet I want to keep as much flexibility as possible (not delete a bunch of stuff). So I gave this a shot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% set modelName = modelName is defined ? modelName : 'user' %}&#xA;    {% set model = user is defined ? user : null %}&#xA;{% else %}&#xA;    {% set modelName = modelName is defined ? modelName : 'address' %}&#xA;    {% set model = address is defined ? address : null %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\UserModel and its behaviors do not have a method or closure named &quot;businessName&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which makes perfect sense - that's not in the user model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could go into the form filed and just set the values like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-firstName&quot; class=&quot;form-control&quot;&#xA;                   name=&quot;{{ modelName }}[firstName]&quot;&#xA;                   value=&quot;{{ currentUser.firstName }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But is that going to lead to disaster? Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-04-13T17:41:03.550" Title="How can I pre-populate my billing/shipping information within Commerce?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19956" PostTypeId="2" ParentId="19955" CreationDate="2017-04-13T17:41:03.550" Score="1" Body="&lt;p&gt;What I gathered from the documentation, you could try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set customer = craft.commerce.getCustomer() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ customer.address.businessName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or it might be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ customer.addresses.businessName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/customer-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/customer-model&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-13T17:41:03.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19959" PostTypeId="2" ParentId="19952" CreationDate="2017-04-13T18:11:07.953" Score="1" Body="&lt;p&gt;I'm not aware of an existing plugin for Craft/Commerce that would do this and a search through &lt;a href=&quot;https://straightupcraft.com/craft-plugins/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/&lt;/a&gt; doesn't reveal much more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds like it would need to be custom plugin development.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-13T18:11:07.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19960" PostTypeId="1" CreationDate="2017-04-13T23:12:25.333" Score="1" ViewCount="1593" Body="&lt;p&gt;I would like to load some javascript on specific pages only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set a block in my parent template, then test a variable and include the javascript in the child template only when necessary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I thought I could do this by declaring the variable beforehand, to make it  accessible outside it's scope&lt;/strong&gt;, but this is not working (nothing is returned):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parent '_layout' template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;    &amp;lt;head&amp;gt;...&amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;&#xA;        {% block content %}&#xA;        {% endblock %}&#xA;&#xA;        ...&#xA;&#xA;        {# site-wide script #}&#xA;        &amp;lt;script src=&quot;global.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;        {# page-specific script #}&#xA;        {% block script %}&#xA;        {% endblock %}&#xA;&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Child template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% set page_assets = '' %}&#xA;&#xA;{% block content %}&#xA;...&#xA;{% set page_assets = 'true' %}&#xA;...&#xA;{% endblock %}&#xA;&#xA;{% block script %}&#xA;    {% if page_assets is defined and page_assets is not empty %}&#xA;      &amp;lt;script src=&quot;page-specific.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="567" LastEditorUserId="567" LastEditDate="2017-04-14T08:58:48.743" LastActivityDate="2017-04-14T14:18:42.323" Title="How to set and test a variable in child template to modify a block in parent template" Tags="&lt;scope&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19961" PostTypeId="2" ParentId="18516" CreationDate="2017-04-14T00:42:20.760" Score="2" Body="&lt;p&gt;If I understand what you're asking—it sounds like you can just disable URLs for that section, and create a template that will get loaded at the URL you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you had a &lt;em&gt;Section&lt;/em&gt; called “Plants,” and you wanted to list all plants at mywebsite.com/plants, you could just create &lt;code&gt;craft/templates/plants.twig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set plants = craft.entries({ section: 'plants', limit: null }).find %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for plant in plants %}&#xA;    &amp;lt;li&amp;gt;{{ plant.title }}&amp;lt;/li&amp;gt;&#xA;  {% endear %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to edit anything on that page, you'll need to create another entry (probably a &lt;em&gt;Single&lt;/em&gt;) to manage that content.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2017-04-14T00:42:20.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19962" PostTypeId="1" CreationDate="2017-04-14T01:05:55.963" Score="1" ViewCount="497" Body="&lt;p&gt;I am running Amazon Ec2 instance and tried updating the PHP on the site using this guide: &lt;a href=&quot;http://brianshim.com/webtricks/update-amazon-ami-php5-3-to-php5-4/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://brianshim.com/webtricks/update-amazon-ami-php5-3-to-php5-4/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now this is the error I am receiving:&#xA;Please ensure that $craftPath is set correctly in /var/www/html/staging/public/index.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried resetting the permissions, and restored the old http config files, to no avail. I have no idea what it could be. I checked php.ini for open_basedir and did not find it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could it be the permissions? &lt;/p&gt;&#xA;" OwnerUserId="6590" LastActivityDate="2017-05-14T19:12:09.867" Title="Updated the PHP on server. Getting this error: Please ensure that $craftPath is set correctly" Tags="&lt;error-message&gt;&lt;server&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19963" PostTypeId="2" ParentId="2576" CreationDate="2017-04-14T01:50:40.570" Score="1" Body="&lt;p&gt;You can set the proper permissions for the Craft install via:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-04-14T01:50:40.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19964" PostTypeId="2" ParentId="19879" CreationDate="2017-04-14T02:22:31.270" Score="2" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;UPDATE: This issue has been fixed as of Calendar 1.8.4 on April 21, 2017.&lt;/em&gt;&lt;/strong&gt;&#xA;&lt;a href=&quot;https://solspace.com/craft/calendar&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your above code should work. I think there might be a bug with the &lt;code&gt;loadOccurrences: false&lt;/code&gt; parameter used in conjunction with the &lt;code&gt;limit: 3&lt;/code&gt; parameter. Try increasing the limit to something higher and see if you get results. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, I've logged this bug and we'll have a bug fix for this in the near future. Sorry for the inconvenience.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="4496" LastEditDate="2017-04-21T04:49:34.923" LastActivityDate="2017-04-21T04:49:34.923" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19966" PostTypeId="1" AcceptedAnswerId="19967" CreationDate="2017-04-14T10:58:45.190" Score="1" ViewCount="46" Body="&lt;p&gt;My navigation looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url('http://www.mysite.com/') }}&quot; {% if craft.request.firstSegment == 'home' %}class=&quot;active&quot;{% endif %}&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl('services') }}&quot; {% if craft.request.firstSegment == 'service' %}class=&quot;active&quot;{% endif %}&amp;gt;Services&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I click on &quot;services&quot;, I get 404 not found.  What I'm trying to understand is where is my URL? I thought it would be something like &lt;code&gt;www.mysite.com/index.php/services&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried laying this out in both public HTML part of my server and the Craft folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My folder structure is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Route/&#xA;    css/&#xA;    img/&#xA;    index.php&#xA;    _layout.html&#xA;    _services.html; this is the file i need to navigate to&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6592" LastEditorUserId="57" LastEditDate="2017-04-14T18:58:19.863" LastActivityDate="2017-04-14T18:58:19.863" Title="Navigation to URL" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19967" PostTypeId="2" ParentId="19966" CreationDate="2017-04-14T11:25:38.640" Score="1" Body="&lt;p&gt;Your syntax is wrong. &#xA;You don't need to put &quot;('service')&quot; inside your twig code plus you don't need to enter your siteUrl.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you fill the href with &lt;code&gt;/services&lt;/code&gt; it should work like supposed to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are having trouble with &lt;code&gt;index.php&lt;/code&gt; being in your URL you should check this guide out in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing,&#xA;You shouldn't put any HTML / Template files inside your public_html folder. They should all be in the &lt;code&gt;craft/templates&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More in the docs here: &lt;a href=&quot;https://craftcms.com/docs/folder-structure&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/folder-structure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also make sure you made a entry for the page you want in this case &quot;services&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you keep finding problems like this you should try the Craft CMS Slack channel. Over 4000 developers joined already and are able to help you in a more direct way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/community#slack&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-04-14T11:25:38.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19968" PostTypeId="2" ParentId="19782" CreationDate="2017-04-14T12:05:34.020" Score="1" Body="&lt;p&gt;Found the solution, posting answer for future reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the official docs provide a wrong example for outputting the parts. Instead of using &lt;code&gt;{{ myMapField.country_short }}&lt;/code&gt; as mentioned in the docs, you have to use &lt;code&gt;{{ myMapField.parts.country_short }}&lt;/code&gt; (or without the _short suffix). This will correctly output just the country part of the full address.&lt;/p&gt;&#xA;" OwnerUserId="6534" LastActivityDate="2017-04-14T12:05:34.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19969" PostTypeId="1" AcceptedAnswerId="19982" CreationDate="2017-04-14T12:15:54.067" Score="1" ViewCount="387" Body="&lt;p&gt;Craft 2.6.2972&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a new redactor config called &lt;strong&gt;Basic Config&lt;/strong&gt; and saved the json in craft/config/redactor based on this &lt;a href=&quot;https://straightupcraft.com/articles/how-to-add-custom-redactor-toolbars-to-the-default-rich-text-field-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strait Up Craft post&lt;/a&gt;. I then created a field and selected the correct config setting and added it to a channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I go to edit the entry it's not using my config setting as all the formatting options including code etc are there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MJXRk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MJXRk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the json is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],&#xA;    plugins: ['fullscreen'],&#xA;    formattingTags: ['p', 'blockquote', 'h3', 'h4', 'h5']&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure why code, h1, and h2 tags are available when clearly they are not in the above formatting options&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-04-14T19:06:34.747" Title="Custom Redactor Setting not Working" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19971" PostTypeId="2" ParentId="19843" CreationDate="2017-04-14T13:59:36.790" Score="1" Body="&lt;p&gt;So, in order to achieve this I had to make a couple of small hacks to the module core, namely in &lt;code&gt;Charge_ActionsService.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I added &lt;code&gt;default&lt;/code&gt; case to &lt;code&gt;triggerActionByType&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;default : {&#xA;    $processor = explode(&quot;_&quot;, $type);&#xA;    $class = $processor[0];&#xA;    $function = $processor[1];&#xA;    craft()-&amp;gt;$class-&amp;gt;$function($details, $chargeModel);&#xA;    break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This allows me to call actions from external files. &lt;code&gt;$processor&lt;/code&gt; will be class of service file in my plugin, &lt;code&gt;$function&lt;/code&gt; would be name of function to be called. There are separated by &lt;code&gt;_&lt;/code&gt; in config (I'll explain this later on)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I had to comment out &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//if (!in_array($type, $this-&amp;gt;baseActions)) continue;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to allow any actions, not just base ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in my templates, I based off example provided in &lt;code&gt;charge/actions&lt;/code&gt; example template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Options used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    'planAmount' : cart.totalPrice,&#xA;    'planInterval' : 'month',&#xA;    'planIntervalCount' : '1',&#xA;    'actions' : {&#xA;        'onSuccess': {&#xA;            'chargeCommerce_updateOrder' : { 'orderId': cart.id, 'status': 'subscriptionActive', 'complete': true }&#xA;        },&#xA;        'onFailure': {&#xA;            'chargeCommerce_updateOrder' : { 'orderId': cart.id, 'status': 'subscriptionCancelled' },&#xA;            'email' : { 0: 'payment-failed-customer', 1: 'payment-failed-admin'  }&#xA;        },&#xA;    }} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;chargeCommerce_updateOrder&lt;/code&gt; is the reference to function &lt;code&gt;updateOrder&lt;/code&gt; in &lt;code&gt;ChargeCommerceService.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-04-14T13:59:36.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19972" PostTypeId="2" ParentId="19960" CreationDate="2017-04-14T14:18:42.323" Score="1" Body="&lt;p&gt;Nope, that's not going to work unfortunately, due to the way scoping works in Twig. Check out the explanation in the &lt;a href=&quot;https://nystudio107.com/blog/twig-processing-order-and-scope&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Processing Order &amp;amp; Scope&lt;/a&gt; article&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-04-14T14:18:42.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19973" PostTypeId="1" CreationDate="2017-04-14T14:29:47.507" Score="1" ViewCount="259" Body="&lt;p&gt;As part of my checkout process, I have a list of five optional, add-on services shown as checkbox inputs. The list resides on a standalone page and each service can either be included in the purchase or not (i.e. quantity 1 or 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've considered using the Multi-Add plugin, but I would like any checked services to remain in the cart if the user goes &quot;Back&quot; instead of submitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I add these services to the cart with AJAX when clicked, and remove when unclicked? I'm very new to Commerce so any and all references, suggestions, and hand-holding here is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4438" LastActivityDate="2017-04-14T19:39:35.170" Title="Add product to cart using checkbox and AJAX" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19974" PostTypeId="1" AcceptedAnswerId="20464" CreationDate="2017-04-14T15:19:06.910" Score="2" ViewCount="234" Body="&lt;p&gt;Is it possible to show the complete products list, but indicate which products are already in the cart? What's the conditional?&lt;/p&gt;&#xA;" OwnerUserId="4438" LastActivityDate="2017-05-15T03:04:35.583" Title="How do I check and indicate that a product is already in the cart?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19975" PostTypeId="2" ParentId="19881" CreationDate="2017-04-14T15:21:31.033" Score="1" Body="&lt;p&gt;The client was using a Mac and the trackpad scrollbars are set to only show when over scrollable content. This is embarrassing, but the issue is resolved.&lt;/p&gt;&#xA;" OwnerUserId="6130" LastActivityDate="2017-04-14T15:21:31.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19976" PostTypeId="2" ParentId="19973" CreationDate="2017-04-14T16:28:49.830" Score="1" Body="&lt;p&gt;You are going down the right path with &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiAdd&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an application that on a single product page, I am also selling additional products that are an add-on of the parent. They are separate products, but they exist together. As in, the parent product is the only place the additional products are sold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the administrator is creating the parent product, I give them the option (mainly checkboxes) &quot;Include option B&quot;. When checked, the additional product will show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is kind-of how it works...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;multiAdd/multiAdd&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/cart&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;&#xA;...&#xA;&#xA;{# This is the primary/parent product. #}&#xA;&amp;lt;select id=&quot;myVariant&quot; name=&quot;items[1][purchasableId]&quot; class=&quot;form-control required&quot; required&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Select Option&amp;lt;/option&amp;gt;&#xA;   {% for purchasable in product.variants %}&#xA;       &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %}&#xA;           value=&quot;{{ purchasable.purchasableId }}&quot;&#xA;           data-position=&quot;{{ purchasable.myVariant }}&quot;&#xA;           data-price=&quot;{% if purchasable.price == 0 %}Free{% else %}&#xA;          {{ purchasable.price|currency(cart.currency) }}{% endif %}&quot;&amp;gt;&#xA;              {{ purchasable.myVariant.label }} &amp;amp;ndash; {% if purchasable.price == 0 %}Free{% else %}{{ purchasable.price|currency(cart.currency) }}{% endif %}                                                                       &#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}                                                                &#xA;&amp;lt;/select&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[1][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;...&#xA;&#xA;{# This is the additional product. #}&#xA;{% if product.myOption|length %}&#xA;&amp;lt;fieldset&amp;gt;&#xA;    {% set options = product.myFirstOption %}&#xA;    {% if options|length %}&#xA;        &amp;lt;legend&amp;gt;Some Optional Thing&amp;lt;/legend&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group form-group--select&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;option&quot; class=&quot;select-label&quot;&amp;gt;Option&amp;lt;/label&amp;gt;&#xA;            &amp;lt;select id=&quot;option&quot; name=&quot;items[2][purchasableId]&quot; class=&quot;form-control required&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;Select Option&amp;lt;/option&amp;gt;&#xA;                    {% for option in options %}&#xA;                        &amp;lt;option value=&quot;{{ option.defaultVariant.purchasableId }}&quot; data-price=&quot;{{ option.defaultVariant.price|currency(cart.currency) }}&quot;&amp;gt;&#xA;                            {{ option.title }} &amp;amp;ndash; {% if option.defaultVariant.price == 0 %} Included with registration {% else %} {{ option.defaultVariant.price|currency(cart.currency) }}{% endif %}&#xA;                        &amp;lt;/option&amp;gt;&#xA;                   {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; id=&quot;optionQty&quot; name=&quot;items[2][qty]&quot; value=&quot;0&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/fieldset&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is important to note is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[1][qty]&quot; value=&quot;1&quot;&amp;gt;&#xA;...&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;items[2][qty]&quot; value=&quot;0&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's how MultiAdd knows what to add to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I choose my options and click &quot;buy&quot; any option(s) are added to my cart until I go into my cart and remove them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an example for ajax in on the MultiAdd page. Instead of a traditional post, you are sending the same information to a url via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-04-14T19:39:35.170" LastActivityDate="2017-04-14T19:39:35.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19977" PostTypeId="1" AcceptedAnswerId="19978" CreationDate="2017-04-14T16:46:32.867" Score="1" ViewCount="260" Body="&lt;p&gt;In a plugin I am writing, I am importing data from a older system and part of it is latitude and longitude data.  One of the fields in Craft is a &lt;a href=&quot;https://github.com/ethercreative/simplemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;simpleMap&lt;/a&gt; field where that data will go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to create a new entry that has a simpleMap field as one of the fields.  The github page doesn't have any documentation on how to do this, it mostly covers how to read data and display it in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have latitude and longitude data and I would like to add it to the simpleMap field.  This code doesn't work but its what I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContent([&#xA;    'simplemap_field' =&amp;gt; [$lat, $long],&#xA;    'some_other_field' =&amp;gt; 'some text',&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I probably have to create a simpleMap object first and pass it to the entry field, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$smap = New SimpleMap([$lat, $long]);&#xA;...&#xA;    'simplemap_field' =&amp;gt; $smap,&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6296" LastActivityDate="2017-04-14T17:31:25.850" Title="Programaticaly create entry with simpleMaps field" Tags="&lt;plugin-development&gt;&lt;plugin-simplemap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19978" PostTypeId="2" ParentId="19977" CreationDate="2017-04-14T17:25:19.917" Score="1" Body="&lt;p&gt;I actually just had to do this for a project, so I hope this will shed some light on how to set the props:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by looking at &lt;code&gt;SimpleMap_MapModel.php&lt;/code&gt; and its attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The available properties are: &lt;code&gt;ownerId&lt;/code&gt;, &lt;code&gt;fieldId&lt;/code&gt;, &lt;code&gt;ownerLocale&lt;/code&gt;, &lt;code&gt;lat&lt;/code&gt;, &lt;code&gt;lng&lt;/code&gt;, &lt;code&gt;zoom&lt;/code&gt;, &lt;code&gt;address&lt;/code&gt;, and &lt;code&gt;parts&lt;/code&gt;. (Don't touch &lt;code&gt;ownerId&lt;/code&gt;, &lt;code&gt;fieldId&lt;/code&gt;, and &lt;code&gt;ownerLocale&lt;/code&gt;—they'll get set automatically when saved!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this means you can set any of the above by simply assigning an associative array to your EntryModel, before saving:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContent([&#xA;  'simplemap_field' =&amp;gt; [&#xA;    'lat' =&amp;gt; $lat,&#xA;    'lng' =&amp;gt; $long&#xA;  ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have the data already, and want to populate the address &quot;parts&quot;, you can &lt;code&gt;json_encode&lt;/code&gt; those into the &lt;code&gt;parts&lt;/code&gt; attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setContent([&#xA;  'simplemap_field' =&amp;gt; [&#xA;    'lat' =&amp;gt; $lat,&#xA;    'lng' =&amp;gt; $long,&#xA;    'parts' =&amp;gt; json_encode([&#xA;      'street1' =&amp;gt; $address,&#xA;      'locality' =&amp;gt; $city,&#xA;      'administrative_area_level_1' =&amp;gt; $state,&#xA;      'country' =&amp;gt; $country&#xA;    ])&#xA;  ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not a huge fan of the way those &quot;parts&quot; are saved, but it's basically the serialized/cached response from Google.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;address&lt;/code&gt; attribute, as far as I could tell, is basically the value that ends up in the search bar, when you're using the field in the front-end. During our import, we were able to build a meaningful string here, from other data (i.e. a venue name and city), so if any records didn't have a complete set of information, admin didn't have to reconstruct the search, manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, SimpleMap will not geocode (or reverse-geocode) your information to fill in gaps… you'll need to manually save each entry. This was something we struggled with when building out import scripts, but fortunately only the more recent location-sensitive content really needed to be updated.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2017-04-14T17:31:25.850" LastActivityDate="2017-04-14T17:31:25.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19979" PostTypeId="1" AcceptedAnswerId="19981" CreationDate="2017-04-14T18:10:43.437" Score="1" ViewCount="191" Body="&lt;p&gt;I have an entry which has a category field. I want an auto-generated title for this entry that uses the assigned category title (first category title in case of multiple categories). I am not sure what to insert in the &quot;Title Format&quot; field.&lt;/p&gt;&#xA;" OwnerUserId="4815" LastActivityDate="2017-04-14T18:58:06.077" Title="How to use category in auto generated title?" Tags="&lt;entries&gt;&lt;categories&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19980" PostTypeId="2" ParentId="19962" CreationDate="2017-04-14T18:44:17.940" Score="1" Body="&lt;p&gt;All Craft is doing is using PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.is-file.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;is_file()&lt;/a&gt; method to check if the supplied path to &lt;code&gt;craft/app/index.php&lt;/code&gt; returns true or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take Craft out of the picture and setup a simple PHP script that does &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;if (is_file('path/to/craft/app/index.php')) {&#xA;    echo &quot;found it&quot;;&#xA;} else {&#xA;    echo &quot;oops&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you get an &quot;oops&quot;, then there is some environmental issue (PHP permissions, open_basedir restrictions, Suhosin, mod_security, etc.) that is preventing PHP from finding that file that will need to be addressed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is permissions related (the most common cause), there is a handy script here that will properly set the permissions for a Craft install: &lt;a href=&quot;https://github.com/nystudio107/craft-scripts/tree/master/scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts/tree/master/scripts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-14T18:44:17.940" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19981" PostTypeId="2" ParentId="19979" CreationDate="2017-04-14T18:58:06.077" Score="4" Body="&lt;p&gt;In the Title Format field, try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{categoryFieldHandle[0].title}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2017-04-14T18:58:06.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19982" PostTypeId="2" ParentId="19969" CreationDate="2017-04-14T19:06:34.747" Score="1" Body="&lt;p&gt;That Straight Up Craft article is pretty old and based on the Redactor I API, I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty sure in Redactor II, &lt;code&gt;formattingTags&lt;/code&gt; got replaced with either &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#setting-formatting&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;formatting&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://imperavi.com/redactor/examples/formatting-add/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;formattingAdd&lt;/code&gt;&lt;/a&gt;, depending on your needs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-14T19:06:34.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19984" PostTypeId="1" AcceptedAnswerId="19992" CreationDate="2017-04-15T08:13:07.253" Score="1" ViewCount="52" Body="&lt;p&gt;Is there a way to print all of the available parameters/handles when I set a variable? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I put &lt;code&gt;{% set orders = craft.commerce.orders.find() %}&lt;/code&gt; is there a way to list out the available parameters/handles depending on what I set, without having to go to the docs? So a way of checking that my code is right from the templates.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-04-15T17:14:42.413" Title="list available parameters of variable" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19986" PostTypeId="2" ParentId="19922" CreationDate="2017-04-15T10:16:34.717" Score="0" Body="&lt;p&gt;So the solution for me in the end was to add the profile field name as a class name eg 'address1';&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;input id=&quot;address1&quot; name=&quot;fields[address1]&quot; type=&quot;text&quot; &#xA;placeholder=&quot;address line 1&quot; class=&quot;form-control input-md address1&quot; req=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my ajax post when looping through the errors looking for the element class name&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;.&quot; + field).after($errorList);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as opposed to the input field name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.post('/', data, function(response) {&#xA;&#xA;    //reset error messages&#xA;    $(this).find( '.errors' ).remove();&#xA;&#xA;    if (response.success) {&#xA;        console.log(&quot;success&quot;)&#xA;    } else {&#xA;        event.preventDefault();&#xA;        console.log(response.errors);&#xA;        //reset errors&#xA;        $('.submit').append('&amp;lt;span class=&quot;err&quot;&amp;gt;Please check the form for errors&amp;lt;/span&amp;gt;');&#xA;        appendErrors(response.errors);&#xA;    }&#xA;&#xA;});&#xA;&#xA;function appendErrors(errors) {&#xA;&#xA;$.each(errors, function(field, errors) {&#xA;    appendError(field, errors);&#xA;});&#xA;}&#xA;&#xA;function appendError(field, errors) {&#xA;   var $errorList = $( '&amp;lt;ul class=&quot;errors&quot;&amp;gt;' );&#xA;   $.each(errors, function(index, error) {&#xA;     $errorList.append($('&amp;lt;li&amp;gt;').html(error));&#xA;   });&#xA;   $(&quot;.&quot; + field).after($errorList);&#xA;   // $('input[name='+ field +']').after($errorList);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-04-15T10:16:34.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19987" PostTypeId="1" AcceptedAnswerId="19989" CreationDate="2017-04-15T10:40:04.197" Score="4" ViewCount="1442" Body="&lt;p&gt;Currently I'm having an issue deploying to Digital Ocean and would love some advice, i've followed numerous tutorials but they seem to just drop off half way through the process so just need some clarity on this. I've broke down what I've done below:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Developed my CraftCMS site in localhost using MAMP.&lt;/li&gt;&#xA;&lt;li&gt;Committed everything to Github apart from &lt;strong&gt;db.php&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Created a droplet with LAMP&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Setup my database names so it corresponds with my localhost&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Setup my database user   &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Created a deploybot setup which contains my     db.php file&lt;/li&gt;&#xA;&lt;li&gt;Deployed the application using deploy bot which deploys my latest&lt;br&gt;&#xA;push in the git repo.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Am I supposed to be reinstalling CraftCMS on the droplet and upload my localhost database after these steps? &lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2020-03-27T16:18:51.140" Title="Deploying CraftCMS to Digital Ocean" Tags="&lt;entries&gt;&lt;database&gt;&lt;deployment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19988" PostTypeId="2" ParentId="4980" CreationDate="2017-04-15T12:48:32.310" Score="4" Body="&lt;p&gt;Good starting point: &lt;a href=&quot;https://craftcms.com/docs/templating/paginate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/paginate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you also want display '...' instead of the whole list of page numbers, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.totalPages &amp;gt; 1 %}&#xA;&amp;lt;div class='blogPostList__pagination'&amp;gt;&#xA;&#xA;    {% if pageInfo.prevUrl %}&amp;lt;a href='{{ pageInfo.prevUrl }}' class='blogPostList__pagination__prev'&amp;gt;&amp;amp;lt;&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;    {% if pageInfo.currentPage &amp;gt; 2 %}&#xA;        &amp;lt;a class='blogPostList__pagination__pageNumber' href='{{ pageInfo.firstUrl }}'&amp;gt;{{ 1 }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if pageInfo.currentPage &amp;gt; 3 %}&#xA;        &amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% for page, url in pageInfo.getPrevUrls(1) %}&#xA;        &amp;lt;a class='blogPostList__pagination__pageNumber' href='{{ url }}'&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;span class='blogPostList__pagination__pageNumber pageNumberIsActive'&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;    {% for page, url in pageInfo.getNextUrls(1) %}&#xA;        &amp;lt;a class='blogPostList__pagination__pageNumber' href='{{ url }}'&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&#xA;    {% if pageInfo.currentPage &amp;lt; pageInfo.totalPages-2 %}&#xA;        &amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if pageInfo.currentPage &amp;lt; pageInfo.totalPages-1 %}&#xA;        &amp;lt;a class='blogPostList__pagination__pageNumber' href='{{ pageInfo.lastUrl }}'&amp;gt;{{ pageInfo.totalPages }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if pageInfo.nextUrl %}&amp;lt;a href='{{ pageInfo.nextUrl }}' class='blogPostList__pagination__next'&amp;gt;&amp;amp;gt;&amp;lt;/a&amp;gt;{% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(PS: We put this part in its own twig file to reuse it on the site)&lt;/p&gt;&#xA;" OwnerUserId="6225" LastEditorUserId="340" LastEditDate="2017-04-18T04:29:34.793" LastActivityDate="2017-04-18T04:29:34.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19989" PostTypeId="2" ParentId="19987" CreationDate="2017-04-15T13:19:36.887" Score="6" Body="&lt;p&gt;I would suggest to read through the following articles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About reinstalling craft on your droplet and uploading the local database:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the craft install i used in my local dev environment will be pushed onto the droplet, like this i can assure that it doesn't differ in any of the enviornments. About syncing the database read through the articles it will clear things up. In general all of the articles in nystudios blog are more than helpful. i hope it helped at least a bit. &lt;/p&gt;&#xA;" OwnerUserId="5012" LastActivityDate="2017-04-15T13:19:36.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19990" PostTypeId="1" AcceptedAnswerId="19991" CreationDate="2017-04-15T13:23:44.233" Score="1" ViewCount="133" Body="&lt;p&gt;Currently trying to load an asset located in the following branch of my install:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;html&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;uploads&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unfortunately when I try to head directly to a specific asset I get the following error message from Craft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;You don't have permission to access /uploads/students/universities/giphy.gif on this server.&#xA;Server unable to read htaccess file, denying access to be safe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've set the following on the uploads folder&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chmod 774 /var/www/html/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My site is on DigitalOcean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be brilliant &lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-15T13:49:02.727" Title="Can't load assets or upload assets" Tags="&lt;assets&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19991" PostTypeId="2" ParentId="19990" CreationDate="2017-04-15T13:49:02.727" Score="1" Body="&lt;p&gt;Fixed by doing the following commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chown -R www-data:www-data /var/www&#xA;service apache2 restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-15T13:49:02.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19992" PostTypeId="2" ParentId="19984" CreationDate="2017-04-15T17:14:42.413" Score="1" Body="&lt;p&gt;If you're looking for a purely Twig/template solution, then your best bet would be to either enable devMode and use Twig's &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;dump()&lt;/code&gt;&lt;/a&gt; method or install something like the Craft &lt;a href=&quot;https://github.com/mildlygeeky/craft_kint&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kint&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that both of them are going to give you much more information than just attributes available on a model (like the array of &lt;a href=&quot;https://craftcommerce.com/docs/order-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;OrderModel&lt;/a&gt;'s your example is going to return), but that info will be included.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-15T17:14:42.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19993" PostTypeId="2" ParentId="19943" CreationDate="2017-04-15T17:17:17.157" Score="1" Body="&lt;p&gt;That field accepts any valid Twig code, so something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;challenges/{{ craft.request.getPost('challenge_id') }}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fair warning, though... I'd also be wary of accepting untrusted front-end input like this that ends up on the file system.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-04-17T18:48:40.417" LastActivityDate="2017-04-17T18:48:40.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19994" PostTypeId="1" AcceptedAnswerId="19995" CreationDate="2017-04-15T17:31:36.943" Score="1" ViewCount="465" Body="&lt;p&gt;I'm trying to get some info from entry like entry ID that the Guest plugin sent it via Ajax. &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries#submitting-via-ajax&quot; rel=&quot;nofollow noreferrer&quot;&gt;There are the keys&lt;/a&gt; that the plugin responds back with. How can I work out to those keys respectively call them? &lt;code&gt;(response.id)&lt;/code&gt; for example?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-04-15T18:54:04.897" Title="How do you get entry's data from Ajax form submission with Guest plugin?" Tags="&lt;guest-entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19995" PostTypeId="2" ParentId="19994" CreationDate="2017-04-15T18:54:04.897" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;the README&lt;/a&gt;, the Guest Entries plugin accepts an AJAX request, and returns an object containing the entry ID, title, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, if you're &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;using jQuery&lt;/a&gt;, you should be able to do something like this (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    data: $('#theform').serialize(),&#xA;    method: 'POST',&#xA;    done: function (data) {&#xA;        // The entry title.&#xA;        console.log(data.title);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how Guest Entries handles errors, so you'll probably want to check the &lt;code&gt;data.success&lt;/code&gt; property, before proceeding.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-15T18:54:04.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19996" PostTypeId="1" CreationDate="2017-04-16T00:40:03.967" Score="1" ViewCount="72" Body="&lt;p&gt;In a channel (market), I have a Matrix field (market_products) with a Stucture-based Entries field (products) and a Lightswitch field (active/inactive). For each market, I need to create an ordered list of products, following the Structure hierarchy of the original products channel, and including a link according to the active/inactive light switch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create a list of products styled according the the lightswitch, but ordered by the order in the Matrix field: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProducts in entry.market_products %}&#xA;&#xA;{% for each in allProducts.theProduct %}&#xA;    {% set theSwitch = allProducts.active %}&#xA;&#xA;    {% if theSwitch == &quot;1&quot; %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/search/{{each.slug}}&quot;&amp;gt;{{ each.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;li&amp;gt;{{ each.title }}&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or a list of related products ordered by the product structure, but not styled according to the lightswitch: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProducts = craft.entries.section('products').relatedTo({&#xA;    sourceElement: entry.id,&#xA;    field: 'market_products.theProduct'&#xA;}) %}&#xA;&#xA;{% nav productList in allProducts %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;/search/{{ productList.slug }}&quot; title=&quot;{{ productList.title }}&quot;&amp;gt;{{ productList.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I create an array of products, ordered by the products' structure AND filtered according to the lightswitch? &lt;/p&gt;&#xA;" OwnerUserId="79" LastEditorUserId="57" LastEditDate="2017-04-16T03:43:36.120" LastActivityDate="2017-04-16T03:43:36.120" Title="Display entries linked from Matrix field according to the entries' structure and a light switch in the Matrix" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;relations&gt;&lt;structure&gt;&lt;lightswitch&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19997" PostTypeId="2" ParentId="18779" CreationDate="2017-04-16T07:45:32.143" Score="1" Body="&lt;p&gt;I ran into this error when updating a live Craft site. My local update had gone fine. So I ended up editing my &lt;code&gt;craft/app/Info.php&lt;/code&gt; file (live) from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_VERSION', '2.6');&#xA;define('CRAFT_BUILD', '2949');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_VERSION', '2.6.2949');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then ran into the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error Use of undefined constant CRAFT_MIN_VERSION_REQUIRED&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So again, I updated my &lt;code&gt;craft/app/Info.php&lt;/code&gt; to add the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_MIN_VERSION_REQUIRED', '2.1.2570');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It then logged me in and and asked me to finish updating SEOmatic, so I clicked &lt;code&gt;Update&lt;/code&gt; and it was running fine again but showing the following depreciation errors:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft()-&gt;getBuild() has been deprecated. As of Craft 2.6.2951,&#xA;  craft()-&gt;getVersion() returns the complete version number&#xA;  (X.Y.Z).  /var/www/craft/app/etc/behaviors/AppBehavior.php (149)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="914" LastEditorUserId="914" LastEditDate="2017-04-16T09:30:18.317" LastActivityDate="2017-04-16T09:30:18.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19999" PostTypeId="1" AcceptedAnswerId="20000" CreationDate="2017-04-16T12:39:37.817" Score="1" ViewCount="1854" Body="&lt;p&gt;I've came to the situation where I need to use JS variable string and use it in Twig's variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plan is built on the &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest entries&lt;/a&gt; and Ajax form submission. On successful Ajax form submission I'm calling for entry's keys (especially &lt;code&gt;id&lt;/code&gt; key) and using these keys to set a cookie names. Those cookie names should be used on next page to get into the entry that just got submitted. Can it be achieved?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-04-16T18:34:12.397" Title="Can a JS string variable be used in Twig?" Tags="&lt;javascript&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20000" PostTypeId="2" ParentId="19999" CreationDate="2017-04-16T14:08:15.410" Score="1" Body="&lt;p&gt;As Twig is rendered server side before passed to a browser for JS execution I found out that it can't be done except &lt;a href=&quot;https://github.com/FriendsOfSymfony/FOSJsRoutingBundle&quot; rel=&quot;nofollow noreferrer&quot;&gt;FOSsRoutingBundle&lt;/a&gt; which allows you to expose your routing in your JavaScript code. I don't know if that would be a great idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway. I found workaround solution that seems to be working for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is the Ajax post action with simple window redirection.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Send it to the server&#xA;$.post('/', data, function(response, textStatus, jqXHR) {&#xA;&#xA;  if (response.success) {&#xA;&#xA;    // Request for entry ID key string to be used in HTTP redirect link&#xA;    var entryId = response.id&#xA;&#xA;    // HTTP redirect&#xA;    window.location.replace(&quot;{{ siteUrl }}&quot; + entryId + &quot;/someUri&quot;);&#xA;&#xA;    } else {&#xA;    // response.error&#xA;  }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget Craft's routing!&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2017-04-16T18:34:12.397" LastActivityDate="2017-04-16T18:34:12.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20002" PostTypeId="1" AcceptedAnswerId="20004" CreationDate="2017-04-16T15:10:16.330" Score="2" ViewCount="378" Body="&lt;p&gt;I think this is normally done with .htaccess or httpd.conf, but it's a bit cumbersome on shared hosting, and it seems like a simple trick for a CMS...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can Craft convert requested URLs to lowercase? So if the slug for the page is /meditate, but someone types in /Meditate that Craft delivers /meditate page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand how one uses customAsciiCharMappings -- it seems unrelated to this.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="57" LastEditDate="2017-04-17T02:55:31.020" LastActivityDate="2017-04-17T04:02:01.250" Title="Can Craft convert requested url to lowercase?" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20004" PostTypeId="2" ParentId="20002" CreationDate="2017-04-16T17:58:26.820" Score="3" Body="&lt;p&gt;Depending on how your server is configured, this may be a non-issue. I just checked several sites, and they all work fine with mixed-case URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not the case with your site, you'll need to implement a simple plugin, which checks the URL, converts it to lowercase, and redirects the visitor (if required).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully it goes without saying that it would be &lt;em&gt;much&lt;/em&gt; better to do this in your &lt;code&gt;.htaccess&lt;/code&gt; or &lt;code&gt;httpd.conf&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveats dispensed with, here's an example plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php namespace Craft;&#xA;&#xA;class PoorMansRedirectPlugin extends BasePlugin&#xA;{&#xA;    // Standard plugin methods omitted for brevity.&#xA;&#xA;&#xA;    /**&#xA;     * Runs before *every* request.&#xA;     */&#xA;    public function init()&#xA;    {&#xA;        $path = craft()-&amp;gt;request-&amp;gt;getPath();&#xA;        $lowerPath = strtolower($path);&#xA;&#xA;        // If the current path is not lowercased, redirect.&#xA;        if ($path !== $lowerPath) {&#xA;            $url = UrlHelper::getUrl($lowerPath);&#xA;            craft()-&amp;gt;request-&amp;gt;redirect($url);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just to be clear, this is a really bare-bones solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't make any distinction between site URLs and admin URLs, doesn't account for query strings, will break POST requests, and a lot more besides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such it is in no way production ready, and would require quite a bit of additional work to account for all of these edge (and not so edge) cases. See my previous note regarding &lt;code&gt;.htaccess&lt;/code&gt; being vastly preferable.&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-04-17T04:02:01.250" LastActivityDate="2017-04-17T04:02:01.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20005" PostTypeId="2" ParentId="20002" CreationDate="2017-04-17T00:44:02.687" Score="1" Body="&lt;p&gt;This is the .htaccess which is working for me now. From this &lt;a href=&quot;http://www.askapache.com/htaccess/rewrite-uppercase-lowercase/&quot; rel=&quot;nofollow noreferrer&quot;&gt;site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Htaccess to Redirect Uppercase to Lowercase&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should go at the very top of your .htaccess file. At least it should go above ANY other RewriteRules. That is because this uses a loop, until there are no more uppercase characters to convert, it will keep starting at the first HASCAPS:TRUE RewriteRule. Oh, and this is actually really quick and isn't gonna slow down anything.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteBase /&#xA;&#xA;# If there are caps, set HASCAPS to true and skip next rule&#xA;RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1]&#xA;&#xA;# Skip this entire section if no uppercase letters in requested URL&#xA;RewriteRule ![A-Z] - [S=28]&#xA;&#xA;# Replace single occurance of CAP with cap, then process next Rule.&#xA;RewriteRule ^([^A]*)A(.*)$ $1a$2&#xA;RewriteRule ^([^B]*)B(.*)$ $1b$2&#xA;RewriteRule ^([^C]*)C(.*)$ $1c$2&#xA;RewriteRule ^([^D]*)D(.*)$ $1d$2&#xA;RewriteRule ^([^E]*)E(.*)$ $1e$2&#xA;RewriteRule ^([^F]*)F(.*)$ $1f$2&#xA;RewriteRule ^([^G]*)G(.*)$ $1g$2&#xA;RewriteRule ^([^H]*)H(.*)$ $1h$2&#xA;RewriteRule ^([^I]*)I(.*)$ $1i$2&#xA;RewriteRule ^([^J]*)J(.*)$ $1j$2&#xA;RewriteRule ^([^K]*)K(.*)$ $1k$2&#xA;RewriteRule ^([^L]*)L(.*)$ $1l$2&#xA;RewriteRule ^([^M]*)M(.*)$ $1m$2&#xA;RewriteRule ^([^N]*)N(.*)$ $1n$2&#xA;RewriteRule ^([^O]*)O(.*)$ $1o$2&#xA;RewriteRule ^([^P]*)P(.*)$ $1p$2&#xA;RewriteRule ^([^Q]*)Q(.*)$ $1q$2&#xA;RewriteRule ^([^R]*)R(.*)$ $1r$2&#xA;RewriteRule ^([^S]*)S(.*)$ $1s$2&#xA;RewriteRule ^([^T]*)T(.*)$ $1t$2&#xA;RewriteRule ^([^U]*)U(.*)$ $1u$2&#xA;RewriteRule ^([^V]*)V(.*)$ $1v$2&#xA;RewriteRule ^([^W]*)W(.*)$ $1w$2&#xA;RewriteRule ^([^X]*)X(.*)$ $1x$2&#xA;RewriteRule ^([^Y]*)Y(.*)$ $1y$2&#xA;RewriteRule ^([^Z]*)Z(.*)$ $1z$2&#xA;&#xA;# If there are any uppercase letters, restart at very first RewriteRule in file.&#xA;RewriteRule [A-Z] - [N]&#xA;&#xA;RewriteCond %{ENV:HASCAPS} TRUE&#xA;RewriteRule ^/?(.*) /$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2017-04-17T00:44:02.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20006" PostTypeId="1" CreationDate="2017-04-17T02:59:59.683" Score="2" ViewCount="391" Body="&lt;p&gt;By default all users fill out shipping information first, and then can select &quot;Use same address for billing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because 95% of items I am selling are digital, 9 out of 10 sales will be digital and have no shipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is ask for a billing address, and then user the &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;1&quot;&amp;gt;&lt;/code&gt; to set the shipping address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have now which works...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;shop/checkout/addresses&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;col-xs-12 col-sm-6&quot;&amp;gt;&#xA;    {% include 'shop/_includes/addresses/fieldset' with {&#xA;        title: &quot;Billing Information&quot;|t,&#xA;        class: 'ShippingAddress',&#xA;        name: 'shippingAddress'&#xA;    } %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;col-xs-12 col-sm-6&quot;&amp;gt;&#xA;    {% include 'shop/_includes/addresses/fieldset' with {&#xA;        title: &quot;Shipping Information&quot;|t,&#xA;        class: 'BillingAddress hidden',&#xA;        name: 'billingAddress'&#xA;    } %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;...&#xA;&#xA;&#xA;{% if freeShipping %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;1&quot;&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;0&quot;&amp;gt;&#xA;    &amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;sameAddress&quot; id=&quot;sameAddress&quot; checked=&quot;checked&quot;&amp;gt; Use same address for shipping&#xA;    &amp;lt;/label&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I'm still setting the shipping first, To the user it just looks like I am asking for billing first. This works until I have something that requires shipping. If a user un-checks &quot;Use same address&quot;, then I show what looks like the Shipping Address. But in reality, it's the billing address they are changing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, shipping drives billing. I would like billing to drive shipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-06-22T17:11:16.400" LastActivityDate="2017-07-22T19:39:55.060" Title="How can I set shipping address same as billing?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20007" PostTypeId="1" AcceptedAnswerId="20025" CreationDate="2017-04-17T05:45:54.137" Score="1" ViewCount="176" Body="&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.getParam('s') %}&#xA;&#xA;{% if slug | length %}&#xA;    {% set category = craft.categories.slug(slug) %}&#xA;    {% set faqs = craft.entries.section('faq').order('title').limit(null) %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ category.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;no-bullet&quot;&amp;gt;&#xA;        {% for entry in faqs.relatedTo(category) %}&#xA;            {% if entry.level &amp;gt;1 %} &#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endif %}  &#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h3&amp;gt; No matching results found &amp;lt;/h3&amp;gt;&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the code above, I cannot get &lt;code&gt;{{ category.title }}&lt;/code&gt; to display. It is empty. If I put &lt;code&gt;{{ category.slug }}&lt;/code&gt; instead, it shows the correct value. The other items in unordered list are displaying perfectly. I am confused as to why the title is not showing    &lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="57" LastEditDate="2017-04-17T18:43:50.033" LastActivityDate="2017-04-17T18:45:58.613" Title="Cannot get category.title to show up" Tags="&lt;entries&gt;&lt;category&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20008" PostTypeId="1" AcceptedAnswerId="20009" CreationDate="2017-04-17T09:17:15.427" Score="3" ViewCount="158" Body="&lt;p&gt;Sorry if my question seems incomprehensible, it's my first question here so please go easy on me :) !!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to group the fields in the image in one drop-down menu where, if possible, I can add some description to each block.  So is it possible or do I need to learn plugin dev and create one of my own?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8xbiO.png&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;image&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8xbiO.png&quot; alt=&quot;talking about grouping those field into one dropdown menu&quot; title=&quot;image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6603" LastEditorUserId="57" LastEditDate="2017-04-17T21:07:28.370" LastActivityDate="2017-04-17T21:07:28.370" Title="Is there any way to group Matrix blocks in the control panel (see image)?" Tags="&lt;matrix&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20009" PostTypeId="2" ParentId="20008" CreationDate="2017-04-17T09:42:06.873" Score="3" Body="&lt;p&gt;There is a plugin that allows you to organize matrix blocks into groups, perhaps that is worth taking a look at. &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/pimp-my-matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;pimp my matrix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2017-04-17T09:42:06.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20010" PostTypeId="1" AcceptedAnswerId="20027" CreationDate="2017-04-17T11:56:12.317" Score="1" ViewCount="228" Body="&lt;p&gt;I want to create an array of all SKUs on Craft Commerce. The end goal is to create a plugin that only applies Sales to certain variants. It does this by  checking the Sale's description for any mention of SKUs and comparing this against the list of all available SKUs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this would do the trick…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allvariants = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Variant');&#xA;$allskus = $allvariants -&amp;gt; sku;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't appear to work. The full code of the plugin is…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_sales.onBeforeMatchProductAndSale', function($event){&#xA;    $sale = $event-&amp;gt;params['sale'];&#xA;&#xA;    $allvariants = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Variant');&#xA;    $allskus = $allvariants -&amp;gt; sku;&#xA;&#xA;    if (stripos($sale-&amp;gt;description, 'only') === false) {&#xA;       return; /* do nothing, and let the sale match as it normally would, because the sale does not have 'only' in the description. */&#xA;    } else {&#xA;        if (stripos($sale-&amp;gt;description, $allskus) === false) {&#xA;            $event-&amp;gt;performAction = false; /* since this SKU is not in the description string, then don't apply this discount */&#xA;        }&#xA;    }&#xA;});`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Full credit to @luke-holder who wrote the plugin to do this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19722/how-to-apply-a-discount-or-sale-to-a-variant&quot;&gt;for Discounts&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="6317" LastEditorUserId="57" LastEditDate="2017-04-17T20:31:03.223" LastActivityDate="2017-04-17T20:31:03.223" Title="Get all Variant SKUs using getCriteria" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20011" PostTypeId="1" AcceptedAnswerId="20014" CreationDate="2017-04-17T12:20:09.613" Score="1" ViewCount="118" Body="&lt;p&gt;I've pushed my site to Digital Ocean from Localhost, the site is all up and running - URL's are all working. But when I try and search the site it seems to be heading to &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://123.456.789/index.php?q=test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://123.456.789/index.php?q=test&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Instead of &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://123.456.789/search/results?q=ariz&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://123.456.789/search/results?q=ariz&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have manually entered the second page in and I get to the search results page, so it does exist but Craft's routes seem to be breaking? Any help would be brilliant!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;          &amp;lt;input class=&quot;text-field w-input&quot; type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search for any University...&quot;&amp;gt;&#xA;          &amp;lt;input type=&quot;submit&quot; style=&quot;position: absolute; left: -9999px; width: 1px; height: 1px;&quot; tabindex=&quot;-1&quot; /&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2017-04-17T12:35:33.783" LastActivityDate="2017-04-17T13:48:37.127" Title="Search going to /index.php?q= instead of results" Tags="&lt;entries&gt;&lt;search&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20013" PostTypeId="1" CreationDate="2017-04-17T12:55:21.243" Score="1" ViewCount="95" Body="&lt;p&gt;I’m setting up a Craft Commerce website, and at the end of the product pages, I’d like to add a link to the next product in the same product type as the current product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For regular entries, I used &lt;code&gt;{{ entry.getNextSibling().url }}&lt;/code&gt; to get the next entry in the current section, but I can’t figure out how to get the same result for the products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6605" LastActivityDate="2017-11-18T07:31:57.643" Title="getNextSibling for next product in product type" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20014" PostTypeId="2" ParentId="20011" CreationDate="2017-04-17T13:48:37.127" Score="1" Body="&lt;p&gt;I was missing the typical '/' within the URL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct URL for this path should be:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{{ url('/search/results') }}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-17T13:48:37.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20015" PostTypeId="2" ParentId="19506" CreationDate="2017-04-17T13:54:12.573" Score="1" Body="&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this line inside my config.&#xA;&lt;code&gt;define('BASEPATH', realpath(dirname(__FILE__) . '/../') . '/');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And inside the imager config file &lt;code&gt;imager.php&lt;/code&gt; I have: &#xA;&lt;code&gt;'.dev' =&amp;gt; array('imagerSystemPath' =&amp;gt; str_replace('craft/','images/', BASEPATH),&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, make sure the paths are all set according to your environment / directory structure.&lt;/p&gt;&#xA;" OwnerUserId="6453" LastActivityDate="2017-04-17T13:54:12.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20016" PostTypeId="1" CreationDate="2017-04-17T14:58:45.223" Score="0" ViewCount="208" Body="&lt;p&gt;Done this a couple of times before so not sure what's going on, but I'm trying to hook up S3. I have the bucket/group/policy/user all setup. But when I enter Access key ID and Secret access key in Craft and refresh, no buckets show up. No errors, just no bucket. My policy looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;Version&quot;: &quot;2012-10-17&quot;,&#xA;&quot;Statement&quot;: [&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:ListAllMyBuckets&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: &quot;arn:aws:s3:::&quot;&#xA;    },&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:*&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: [&#xA;            &quot;arn:aws:s3:::bucketname/*&quot;&#xA;        ]&#xA;    },&#xA;    {&#xA;        &quot;Effect&quot;: &quot;Allow&quot;,&#xA;        &quot;Action&quot;: [&#xA;            &quot;s3:GetBucketLocation&quot;,&#xA;            &quot;s3:ListBucket&quot;&#xA;        ],&#xA;        &quot;Resource&quot;: [&#xA;            &quot;arn:aws:s3:::bucketname&quot;&#xA;        ]&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it matters, my bucket resides in London. Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-01-08T12:22:39.333" Title="S3/No buckets showing" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20017" PostTypeId="1" AcceptedAnswerId="20099" CreationDate="2017-04-17T15:12:33.183" Score="2" ViewCount="808" Body="&lt;p&gt;I know many other folks have posted this question over the years, but unfortunately none of the answers given so far are fixing this for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: after logging-in on my staging server (this does not happen locally with MAMP), after a minute the &quot;Your session has ended&quot; modal comes up. Entering my password dismisses the modal for a second then it comes right back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I simply reload the page, I am still logged-in, but the modal will come back after another minute. Also, reloading causes my Craft identity cookie to keep its name but change its value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look in /craft/storage/runtime/sessions, I can see that when the modal comes up, a new session file has been created, but is a 0 length file. All the session files have 600 permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've tried/checked with no success:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;session.auto_start = 0&lt;/code&gt; is already set in the php.ini&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;session.save_path&lt;/code&gt; shows up correctly as &#xA;&lt;code&gt;/home/&amp;lt;user&amp;gt;/craft/storage/runtime/sessions/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;have tried both the &lt;code&gt;overridePhpSessionLocation&lt;/code&gt; and &lt;code&gt;requireUserAgentAndIpForSession&lt;/code&gt; config variables set to &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;have deleted and recreated the &lt;strong&gt;sessions&lt;/strong&gt; folder manually with 777 permissions&lt;/li&gt;&#xA;&lt;li&gt;have deleted the &lt;strong&gt;sessions&lt;/strong&gt; folder and let it be recreated by Craft (was created with 775 permissions)&lt;/li&gt;&#xA;&lt;li&gt;I am not using any CDN/caching, or running this on Vagrant.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The server is running Apache/2.2.3 (Unix) and PHP 7.1.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I can try?&lt;/p&gt;&#xA;" OwnerUserId="63" LastEditorUserId="63" LastEditDate="2017-04-17T20:45:27.290" LastActivityDate="2017-11-01T20:16:31.420" Title="&quot;Your session has ended&quot; modal popping up constantly" Tags="&lt;config&gt;&lt;session&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20018" PostTypeId="1" CreationDate="2017-04-17T15:55:39.477" Score="2" ViewCount="2007" Body="&lt;ol&gt;&#xA;&lt;li&gt;I have &quot;manage&quot; link that redirects to domain.com/login.&lt;/li&gt;&#xA;&lt;li&gt;&quot;login&quot; is custom front-end page that after logging in redirects to homepage.&lt;/li&gt;&#xA;&lt;li&gt;After logging in when I click &quot;manage&quot; again the domain.com/login redirects me to CP dashboard.&lt;/li&gt;&#xA;&lt;li&gt;Signing out from CP redirects me to default Craft login page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to redirect directly to dashboard after logging in?&lt;/li&gt;&#xA;&lt;li&gt;How to redirect directly to domain.com/login or homepage after signing out?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm also using &lt;code&gt;manager&lt;/code&gt; as cpTrigger, and this is my config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'postLoginRedirect' =&amp;gt; 'manager',&#xA;'logoutPath' =&amp;gt; 'login',&#xA;'cpTrigger' =&amp;gt; 'manager',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason according to #1 postLoginRedirect doesn't take effect&#xA;same for #2 and logoutPath, maybe I'm using them in the wrong way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;login/index.html code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;login/_layout&quot; %}&#xA;{% set title = &quot;Welcome back, friend :)&quot; %}&#xA;{% block content %}&#xA;          &amp;lt;div class=&quot;box&quot;&amp;gt;&#xA;&#xA;          &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;          {{ getCsrfInput() }}&#xA;          &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;&#xA;            {% if errorMessage is defined %}&#xA;             &amp;lt;article class=&quot;message is-danger&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;message-body&quot;&amp;gt;   &#xA;               {{ errorMessage }}&#xA;              &amp;lt;/div&amp;gt;&#xA;             &amp;lt;/article&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;              &amp;lt;p class=&quot;control has-icon&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;input&quot; id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot; placeholder=&quot;Email&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;icon&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;fa fa-envelope&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;              &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;              &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;              &amp;lt;p class=&quot;control has-icon&quot;&amp;gt;&#xA;                &amp;lt;input class=&quot;input&quot; id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;Password&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;icon&quot;&amp;gt;&#xA;                &amp;lt;i class=&quot;fa fa-lock&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/span&amp;gt;&#xA;              &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;              &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;              &amp;lt;p class=&quot;control&quot;&amp;gt;&#xA;              &amp;lt;label class=&quot;checkbox&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; name=&quot;rememberMe&quot; value=&quot;1&quot;&amp;gt;&#xA;                Keep me logged in&#xA;              &amp;lt;/label&amp;gt;&#xA;              &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;              &amp;lt;hr&amp;gt;&#xA;&#xA;              &amp;lt;p class=&quot;control&quot;&amp;gt;&#xA;                &amp;lt;button class=&quot;button is-primary&quot; type=&quot;submit&quot;&amp;gt;Login&amp;lt;/button&amp;gt;&#xA;                &amp;lt;a class=&quot;button is-default&quot; href=&quot;{{ siteUrl }}&quot;&amp;gt;Cancel&amp;lt;/a&amp;gt;&#xA;&#xA;              &amp;lt;/p&amp;gt;&#xA;          &amp;lt;/form&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;            &amp;lt;p class=&quot;has-text-centered&quot;&amp;gt;&#xA;              &amp;lt;a href=&quot;{{ url('login/register') }}&quot;&amp;gt;Register an Account&amp;lt;/a&amp;gt;&#xA;              | &#xA;              &amp;lt;a href=&quot;{{ url('login/forgotpassword') }}&quot;&amp;gt;Forgot password&amp;lt;/a&amp;gt;&#xA;              | &#xA;              &amp;lt;a href=&quot;{{ url('contact') }}&quot;&amp;gt;Need help?&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="6229" LastEditDate="2017-04-18T14:11:36.470" LastActivityDate="2018-02-21T23:45:37.083" Title="Customizing front-end login/logout redirects" Tags="&lt;control-panel&gt;&lt;form&gt;&lt;config&gt;&lt;login&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20019" PostTypeId="1" AcceptedAnswerId="20026" CreationDate="2017-04-17T16:04:06.513" Score="1" ViewCount="248" Body="&lt;p&gt;Currently I'm trying to push my deployed website to the actual domain name it needs to be under using DigitalOcean. The website works perfectly when accessing it directly from the droplets ip address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the name servers on GoDaddy to be Digital Ocean's, but when trying to access the Craft site at the domain name URL it throws a craft error saying &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Service Unavailable,Our site is temporarily unavailable. Please try&#xA;  again later.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there something I need to do in Craft to make sure it knows about the domain name change?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2017-04-17T17:05:16.383" LastActivityDate="2017-04-17T18:48:42.260" Title="Getting Service Unavailable when setting up domain name" Tags="&lt;entries&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20020" PostTypeId="1" AcceptedAnswerId="20024" CreationDate="2017-04-17T17:51:01.540" Score="1" ViewCount="230" Body="&lt;p&gt;When calling my links, they're appearing and trying to link like so:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;testurl.com/university/testurl.com/university/arizona-state/&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Really it should just be &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;testurl.com/university/arizona-state/&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The line that is generating a category URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;a class=&quot;university-widget w-inline-block&quot; href=&quot;{{ category.url }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;  '*' =&amp;gt; array(&#xA;  ),&#xA;&#xA;  'localhost' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; 'http://localhost:8888/',&#xA;    'server' =&amp;gt; 'localhost',&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        'defaultWeekStartDay' =&amp;gt; 0,&#xA;        'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;        'defaultSearchTermOptions' =&amp;gt; array(&#xA;            'subLeft' =&amp;gt; true,&#xA;            'subRight' =&amp;gt; true,&#xA;        ),&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'baseUrl'  =&amp;gt; 'http://localhost:8888/',&#xA;    ),&#xA;    'testToEmailAddress' =&amp;gt; 'dev@email.com',&#xA;  ),&#xA;&#xA;  'testurl.com' =&amp;gt; array(&#xA;    'siteUrl' =&amp;gt; 'testurl.com',&#xA;    'server' =&amp;gt; 'localhost',&#xA;&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        'defaultWeekStartDay' =&amp;gt; 0,&#xA;        'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;        'defaultSearchTermOptions' =&amp;gt; array(&#xA;            'subLeft' =&amp;gt; true,&#xA;            'subRight' =&amp;gt; true,&#xA;        ),&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;    'environmentVariables' =&amp;gt; array(&#xA;      'basePath' =&amp;gt; '/var/www/html/',&#xA;      'baseUrl' =&amp;gt; 'http://testurl.com/',&#xA;    )&#xA;  )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2021-04-18T09:23:25.397" Title="Links breaking with double domain" Tags="&lt;config&gt;&lt;deployment&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20021" PostTypeId="1" CreationDate="2017-04-17T17:54:14.087" Score="1" ViewCount="138" Body="&lt;p&gt;I've installed CraftCMS on my localhost in a subfolder called blog, when creating a new blogpost and clicking on the link it redirects me to my localhost instead of the blogpost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This video should show what happens.&#xA;&lt;a href=&quot;https://gfycat.com/DemandingBitterGoldenmantledgroundsquirrel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gfycat.com/DemandingBitterGoldenmantledgroundsquirrel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My index php looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&#xA;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could someone please advise me on how I can get the posts to upload correctly?&lt;/p&gt;&#xA;" OwnerUserId="6606" LastActivityDate="2017-05-17T21:32:13.647" Title="When clicking blogposts it redirects me to localhost" Tags="&lt;entries&gt;&lt;url&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20022" PostTypeId="2" ParentId="20021" CreationDate="2017-04-17T18:14:03.673" Score="1" Body="&lt;p&gt;You need to create an 'entry.html' file which lists the title, description etc.. within it. The link to the post should then direct you to the entry.html file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/blog/entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-17T18:14:03.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20023" PostTypeId="2" ParentId="20020" CreationDate="2017-04-17T18:30:18.040" Score="3" Body="&lt;p&gt;Fixed by changing the following line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; 'http://testurl.com',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-04-17T18:30:18.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20024" PostTypeId="2" ParentId="20020" CreationDate="2017-04-17T18:43:13.070" Score="2" Body="&lt;p&gt;I generally find this snippet to be useful&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Especially if you set up a virtual host locally in most situations you can define this in your * and it will work across local/staging/production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a basic example config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;    'environmentVariables' =&amp;gt; [&#xA;        'basePath' =&amp;gt; '/Users/your/path/to/site/',&#xA;        'baseUrl' =&amp;gt; (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']&#xA;    ],&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;    'devMode' =&amp;gt; true,      &#xA;],&#xA;&#xA;'live' =&amp;gt; [&#xA;     'environmentVariables' =&amp;gt; [&#xA;        'basePath' =&amp;gt; '/srv/different/path/to/site/',&#xA;     ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6302" LastEditorUserId="6302" LastEditDate="2017-08-15T21:51:32.353" LastActivityDate="2017-08-15T21:51:32.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20025" PostTypeId="2" ParentId="20007" CreationDate="2017-04-17T18:45:58.613" Score="1" Body="&lt;p&gt;Try changing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(slug) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(slug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-17T18:45:58.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20026" PostTypeId="2" ParentId="20019" CreationDate="2017-04-17T18:48:42.260" Score="2" Body="&lt;p&gt;Have a look at this document: &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can configure it differently for local, staging, production, etc, by the name of the domain name&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-17T18:48:42.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20027" PostTypeId="2" ParentId="20010" CreationDate="2017-04-17T20:30:42.080" Score="1" Body="&lt;p&gt;This should grab all of the variant's SKUs like you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Variant');&#xA;$allVariants = $criteria-&amp;gt;find();&#xA;$allSkus = array();&#xA;&#xA;foreach ($allVariants as $variant)&#xA;{&#xA;    $allSkus[] = $variant-&amp;gt;sku;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-17T20:30:42.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20028" PostTypeId="2" ParentId="20013" CreationDate="2017-04-17T20:59:17.010" Score="1" Body="&lt;p&gt;&lt;code&gt;getNextSibling&lt;/code&gt; works in the context of a Structured Section for &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNextSibling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries&lt;/a&gt; and for &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel#getNextSibling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Categories&lt;/a&gt; because both of them have the concept of a &lt;em&gt;hierarchy&lt;/em&gt;.  i.e. in a Structured Section and a Category Group, each element can have parents and children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce Products don't have hierarchy natively.  Could be a bit of a pain to maintain, but you could simulate it by adding an &quot;Order&quot; number field to your product field layout and manually enter the order for each product in a product type, grabbing all of them in Twig and doing the sorting there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-17T20:59:17.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20029" PostTypeId="2" ParentId="20021" CreationDate="2017-04-17T21:09:24.680" Score="0" Body="&lt;p&gt;Make sure your &quot;Site URL&quot; setting in the control panel under Settings-&gt;General is set to &quot;&lt;a href=&quot;http://localhost/blog/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/blog/&lt;/a&gt;&quot; instead of just &quot;&lt;a href=&quot;http://localhost&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-17T21:09:24.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20031" PostTypeId="1" AcceptedAnswerId="20032" CreationDate="2017-04-18T03:26:47.823" Score="2" ViewCount="119" Body="&lt;p&gt;I want to list the orders with &lt;code&gt;datePaid&lt;/code&gt; is within last 14 days. But I cannot workout the correct criteria, and I don't know if &lt;code&gt;isPaid&lt;/code&gt; works correctly as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'dateUpdated' =&amp;gt; '&amp;gt;=' . date('Y-m-d'.' 00:00:00', strtotime(&quot;-14 days&quot;)),&#xA;    'isPaid' =&amp;gt; '1',&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5009" LastEditorUserId="57" LastEditDate="2017-04-18T03:32:50.740" LastActivityDate="2017-04-18T04:26:24.003" Title="List Orders with datePaid is within last 14 days using the Element API plugin" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20032" PostTypeId="2" ParentId="20031" CreationDate="2017-04-18T04:26:24.003" Score="4" Body="&lt;p&gt;Here's an example &lt;code&gt;elementapi.php&lt;/code&gt; that should get you going...this is returning shipping details but you can modify the transformer for whatever data you need of course...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'endpoints' =&amp;gt; [&#xA;    'api/json/orders/whatever.json' =&amp;gt;  [&#xA;        'paginate' =&amp;gt; false,&#xA;        'elementType' =&amp;gt; 'Commerce_Order',&#xA;        'criteria' =&amp;gt;   ['dateOrdered' =&amp;gt; '&amp;gt;'. date('Y-m-d', strtotime(&quot;-2 weeks&quot;)),&#xA;                         'isPaid' =&amp;gt; true,&#xA;                        ],&#xA;&#xA;        'transformer' =&amp;gt; function(Commerce_OrderModel $order) {&#xA;            return [&#xA;            &quot;id&quot; =&amp;gt; $order-&amp;gt;ISOrderNumber,   &#xA;            &quot;fullname&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;firstName ?? '' . &quot; &quot; . $order-&amp;gt;shippingAddress-&amp;gt;lastName ?? '',&#xA;            &quot;firstname&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;firstName ?? '',&#xA;            &quot;lastname&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;lastName ?? '',    &#xA;            &quot;company&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;businessName ?? '',&#xA;            &quot;street1&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;address1 ?? '',&#xA;            &quot;street2&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;address2 ?? '',&#xA;            &quot;suburb&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;city ?? '',&#xA;            &quot;state&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;stateName ?? '',&#xA;            &quot;postcode&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;zipCode ?? '',&#xA;            &quot;phone&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;phone ?? '',&#xA;            &quot;mobile&quot; =&amp;gt; $order-&amp;gt;shippingAddress-&amp;gt;phone ?? '',&#xA;            &quot;email&quot; =&amp;gt; $order-&amp;gt;email ?? '', &#xA;            ];&#xA;        },&#xA;    ], &#xA;&#xA;    // Next api thing to go here...&#xA;&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;];&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-18T04:26:24.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20033" PostTypeId="2" ParentId="19949" CreationDate="2017-04-18T05:29:52.277" Score="0" Body="&lt;p&gt;Sprout SEO 3 allows this same functionality but takes a different approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Sprout SEO 3, in most cases, you can replace all of the template code that was required in Sprout SEO 2 with the single tag: &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt; and the new &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/core-concepts/element-metadata-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Metadata&lt;/a&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Element Metadata field allows you to map the fields you wish to have as fallbacks. So, where you previously may have done this in Sprout SEO 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({&#xA;    id: entry.id,&#xA;    title: entry.title,&#xA;    description: entry.body|striptags|slice(0, 160)&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now just set up an Element Metadata field and map the Title to the Entry Title and so on. The Element Metadata field supports one to one mappings or Custom Patterns where you can use twig code to define the metadata you wish to map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to get more specific with the Element Metadata and have both the ability to do a fallback mapping and allow the user to override the metadata values, you can enable the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/meta-details-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Meta Details Fields&lt;/a&gt; in the Advanced settings area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to setup more than one Element Metadata field if you have more than one type of mapping you wish to do across various sections of your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;entry.id&lt;/code&gt; variable no longer needs to get used in your template in Sprout SEO 3. Sprout SEO 3 now identifies the entry that is being loaded on the page dynamically, just as Craft knows what &lt;code&gt;entry&lt;/code&gt; variable to make available to the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the above should address the fallback issue you describe and is the recommended approach to preparing your fallbacks in the most manageable and maintainable way. I've yet to have someone give me a scenario that doesn't fit in the above model, but if you feel like you have one, feel free to reach out to us via support and I'd be happy to chat it through.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To address your final comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Although this requires disabling automatic metadata rendering, which I&#xA;  require elsewhere, and enabling the custom metadata variable. It also&#xA;  omits the fallback SEO metadata as this now overrides the entry's&#xA;  metadata.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If it's really necessary to override the default metadata, Sprout SEO gives you control over two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To make the prioritized metadata available to the page as a variable&lt;/li&gt;&#xA;&lt;li&gt;To disable the default rendering of the metadata&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These two settings should give you control over a scenario where you want to both control how some metadata is output on your own and output some metadata in the same way that we do. For more advanced use cases, you just get to manage how the logic works around that on your own. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very general example of how this could be done would be by making the &lt;code&gt;metadata&lt;/code&gt; variable available to the page and copying over the default Sprout SEO metadata.html and wrapping a conditional around it. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if somethingIsTrue %}&#xA;    {# Do something special #}&#xA;{% else %}&#xA;    {# Output the default metadata template found in:&#xA;       sproutseo/templates/_special/metadata.html #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-04-18T05:29:52.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20034" PostTypeId="1" CreationDate="2017-04-18T11:51:22.500" Score="1" ViewCount="411" Body="&lt;p&gt;I have a question about adjusters: I am working on a shop which has two tax zones (Switzerland and EU) and two tax rates (8% and 19%). The tax should always be included in the item price. From my understanding that is not possible for both tax zones at the same time. So I am having my eye on the adjusters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would use an adjuster to do the following: &#xA;The client facing cart on the front end gets no adjustments. Only after the shipping address has been confirmed I would apply either one or the other adjustment (8% or 19% included) conditionally via the plugin to the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that make sense? Is that possible and if so is this even the best way to go or am I missing something which is more awesome?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &lt;strong&gt;&lt;em&gt;yes&lt;/em&gt;&lt;/strong&gt; then I would invest more time and just dig into it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2017-04-18T12:19:27.113" LastActivityDate="2017-08-01T18:34:47.010" Title="Adjusters: Conditionally include tax in price" Tags="&lt;plugin-craftcommerce&gt;&lt;adjusters&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20035" PostTypeId="1" AcceptedAnswerId="20046" CreationDate="2017-04-18T12:20:17.717" Score="1" ViewCount="387" Body="&lt;p&gt;I have a set of FAQ entries. Each entry has one or more categories attached. To be able to filter entries related to a category I need a list with unique categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using my solution I'm getting all (some double) categories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set entries = craft.entries.section('faqs') %}&#xA;   {% for entry in entries %}&#xA;        {% for category in entry.faqCategory %}&#xA;             &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ category.title }}&quot; class=&quot;filter&quot; data-filter=&quot;.{{ category.title }}&quot;&amp;gt;{{ category.title }}&amp;lt;ins&amp;gt;&amp;amp;nbsp;&amp;lt;/ins&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2017-04-18T19:18:03.473" Title="How to get the unique categories from a list" Tags="&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20036" PostTypeId="1" CreationDate="2017-04-18T13:08:40.400" Score="1" ViewCount="544" Body="&lt;p&gt;I have two product types, 1) Materials and 2) Services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way on the order summary page to list out the &quot;materials&quot; line items first, followed by the &quot;services&quot; line items below? I can't seem to figure out how to access the product type from &lt;code&gt;cart.lineItems&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I'm currently using but it seems a little clunky:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Products&amp;lt;/h2&amp;gt;&#xA;&#xA;{% for item in cart.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;    {% if product.type == 'materials' %}&#xA;        &amp;lt;li&amp;gt;{{ product.title }} - {{ variant.sku }} ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;h2&amp;gt;Services&amp;lt;/h2&amp;gt;&#xA;&#xA;{% for item in cart.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;    {% if product.type == 'services' %}&#xA;        &amp;lt;li&amp;gt;{{ product.title }} - {{ variant.sku }} ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4438" LastEditorUserId="4438" LastEditDate="2017-04-18T13:17:38.083" LastActivityDate="2017-04-20T00:39:45.670" Title="How to list different product types separately in order summary?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20037" PostTypeId="2" ParentId="1022" CreationDate="2017-04-18T13:19:24.480" Score="4" Body="&lt;p&gt;I recently released Country Redirect, a plugin that handles this smoothly: &lt;a href=&quot;https://superbig.co/plugins/country-redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/country-redirect&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It lets you map which countries get redirected to which locales, let visitors override the country, and easily let you create a locale nav based on the country mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin uses the same database as the accepted answer, but actually allows the user to override it, which makes for a better UX than forcing everyone into a locale.&lt;/p&gt;&#xA;" OwnerUserId="480" LastEditorUserId="480" LastEditDate="2017-04-26T19:23:55.457" LastActivityDate="2017-04-26T19:23:55.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20038" PostTypeId="1" CreationDate="2017-04-18T13:27:33.487" Score="0" ViewCount="189" Body="&lt;p&gt;I have 4 fields in my section:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Videos&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-GIFs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-PNGs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my homepage, I have a section where I have to show 5 latest entries of Images, Videos, GIFs &amp;amp; PNGs. How can I do that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {{set entries = craft.entries.section('works').order('fieldname desc').limit(5) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that didn't work. Please Help. Thanks in advance !!&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="57" LastEditDate="2017-04-18T19:19:32.377" LastActivityDate="2017-04-18T19:19:32.377" Title="How to get latest entries by particular field?" Tags="&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20039" PostTypeId="2" ParentId="20038" CreationDate="2017-04-18T13:34:27.733" Score="2" Body="&lt;p&gt;Looks like you're trying to echo out the results using &lt;code&gt;{{&lt;/code&gt; instead of actually setting it using &lt;code&gt;%}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('works').order('fieldname desc').limit(5) %}&#xA;&#xA;{% for entry in entries %}&#xA;   {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should fix your problem.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-04-18T13:34:27.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20040" PostTypeId="1" AcceptedAnswerId="21013" CreationDate="2017-04-18T14:17:48.507" Score="2" ViewCount="378" Body="&lt;p&gt;We're working on our first Craft Commerce site and are in need of your good advice. This might be related to a similar question (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19876/craft-commerce-send-notification-emails-when-setting-status-dynamically&quot;&gt;Craft Commerce: send notification emails when setting status dynamically?&lt;/a&gt;) but I can't comment there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a Craft Commerce setup with two payment gateways for credit card and bank transfer (Manual payment). We'd like to achieve the following scenario:&#xA;1) If the customer pays with Credit Card, the order status is &quot;Approved&quot;. They receive an email with the invoice and confirmation.&#xA;2) If the customer pays via bank transfer, the order status is &quot;Pending&quot; and they receive a different email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can't find any clues on the docs on how to pass a specific status on checkout. Is there anything obvious we might be missing? I appreciate any input. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5706" LastEditorUserId="22" LastEditDate="2017-05-09T19:45:01.557" LastActivityDate="2017-06-29T10:23:12.007" Title="Custom status based on chosen payment gateway" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20041" PostTypeId="1" CreationDate="2017-04-18T15:15:57.317" Score="1" ViewCount="422" Body="&lt;p&gt;Is it possible to use PayPal Standard with Craft Commerce? The docs are saying that Paypal is &quot;fully supported&quot;, but I only see PayPal Express and PayPal Pro in gateways dropdown in conrol panel.&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-04-18T20:51:43.917" Title="Using PayPal Standard with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20042" PostTypeId="1" AcceptedAnswerId="27252" CreationDate="2017-04-18T15:48:18.770" Score="3" ViewCount="399" Body="&lt;p&gt;I know Commerce allows you to just authorize and pay later but the 'pay later' scenario requires re-entering the credit card details. We have a flow that requires the admin to be able to charge a user later without having the credit card details. As such, we would use Stripe's API to create a customer to save the token for future use, as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;User places order, providing credit card info to Stripe.&lt;/li&gt;&#xA;&lt;li&gt;Authorize with Stripe and create a customer in Stripe so as to save the token for later use (ie. do not charge the card right away).&lt;/li&gt;&#xA;&lt;li&gt;Allow the admin to go into the Craft CP at a later point and charge the customer's card (by making use of the token saved at Stripe). Do this via a status change perhaps?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We're a little lost conceptually how to proceed with this with Craft Commerce. Do we need to write our own custom gateway to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We considered using the built-in Stripe gateway and setting it to &quot;Credit Card Payment Type: Authorize Only&quot; but that means we get the &quot;Make Payment&quot; button on the Order Detail screen and it also isn't doing anything to create the customer on the Stripe end with a saved token. &lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2018-08-11T00:50:13.767" Title="Authorize and charge later with Stripe" Tags="&lt;plugin-craftcommerce&gt;&lt;omnipay-stripe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20043" PostTypeId="1" AcceptedAnswerId="20050" CreationDate="2017-04-18T17:08:43.530" Score="3" ViewCount="754" Body="&lt;p&gt;After updating to 2.6.2973, saving any entry fails, resulting in an Internal Server Error: &quot;Could not resolve the subpath '{slug}'&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read the similar errors on here which trace back to Matrix Asset objects and dynamically-named folders, though I'm not using any dynamically-named folders, and I can't tell where it's pulling {slug} from, and/or what's causes the issue. I've gone through and double-checked and resaved both asset directory and field configurations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log again points in the direction of the Matrix Asset, and refers to the folder id &quot;1&quot; -- a Local Source which has both the System Path and URL completely hardcoded. The top of the trace looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#0 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(707): Craft\AssetsFieldType-&amp;gt;_resolveSourcePathToFolderId('1', '{slug}', true)&#xA;#1 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(327): Craft\AssetsFieldType-&amp;gt;_determineUploadFolderId(Object(Craft\Model))&#xA;#2 /[directory-path]/craft/app/services/ElementsService.php(1618): Craft\AssetsFieldType-&amp;gt;onAfterElementSave()&#xA;#3 /[directory-path]/craft/app/services/MatrixService.php(778): Craft\ElementsService-&amp;gt;saveElement(Object(Craft\MatrixBlockModel), false)&#xA;#4 /[directory-path]/craft/app/services/MatrixService.php(882): Craft\MatrixService-&amp;gt;saveBlock(Object(Craft\MatrixBlockModel), false)&#xA;#5 /[directory-path]/craft/app/fieldtypes/MatrixFieldType.php(533): Craft\MatrixService-&amp;gt;saveField(Object(Craft\MatrixFieldType))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This error stalls all the client's content entry, so I hoping for any additional insights or tips. Thanks so much.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-01-10T17:22:43.957" Title="After updating, getting &quot;Could not resolve the subpath&quot; error" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;error-message&gt;&lt;updating&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20044" PostTypeId="2" ParentId="20036" CreationDate="2017-04-18T17:14:26.893" Score="3" Body="&lt;p&gt;You'll need to query the &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Purchasable&lt;/a&gt; in order to sort by Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. Let me know if you find a better way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;Products&amp;lt;/h2&amp;gt;&#xA;{% for item in order.lineItems %}&#xA;    {% if item.purchasable.product.getType().name == 'Products' %}&#xA;        {% set variant = item.purchasable %}&#xA;        {% set product = variant.product %}&#xA;        &amp;lt;li&amp;gt;{{ product.title }} - ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;h2&amp;gt;Services&amp;lt;/h2&amp;gt;&#xA;{% for item in order.lineItems %}&#xA;    {% if item.purchasable.product.getType().name == 'Services' %}&#xA;        {% set variant = item.purchasable %}&#xA;        {% set product = variant.product %}&#xA;        &amp;lt;li&amp;gt;{{ product.title }} - ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;h2&amp;gt;Others&amp;lt;/h2&amp;gt;&#xA;{% for item in order.lineItems %}&#xA;    {% if item.purchasable.product.getType().name not in ['Products','Services'] %}&#xA;        {% set variant = item.purchasable %}&#xA;        {% set product = variant.product %}&#xA;        &amp;lt;li&amp;gt;{{ product.title }} - ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-18T17:14:26.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20045" PostTypeId="1" AcceptedAnswerId="20055" CreationDate="2017-04-18T18:10:48.340" Score="3" ViewCount="768" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; for some reason isn't picking up any 'Title' fields from the entries, which leaves it displaying '| SiteName' within the browser tab. Currently my 'Site SEO Title' is empty, but can this accept Craft variables to inject the page title?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="142" LastEditDate="2017-04-19T07:59:03.937" LastActivityDate="2017-04-19T07:59:03.937" Title="SEOMatic using the pages title" Tags="&lt;entries&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20046" PostTypeId="2" ParentId="20035" CreationDate="2017-04-18T19:18:03.473" Score="1" Body="&lt;p&gt;Maybe not the most elegant, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('faqs') %}&#xA;{% set usedCategoryIds = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% for category in entry.faqCategory %}&#xA;        {% if category.id not in usedCategoryIds %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ category.title }}&quot; class=&quot;filter&quot; data-filter=&quot;.{{ category.title }}&quot;&amp;gt;{{ category.title }}&amp;lt;ins&amp;gt;&amp;amp;nbsp;&amp;lt;/ins&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;            {% set usedCategoryIds = usedCategoryIds|merge([category.id]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-18T19:18:03.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20047" PostTypeId="2" ParentId="20041" CreationDate="2017-04-18T20:51:43.917" Score="1" Body="&lt;p&gt;Craft Commerce uses &lt;a href=&quot;https://github.com/thephpleague/omnipay&quot; rel=&quot;nofollow noreferrer&quot;&gt;Omnipay&lt;/a&gt; for its payment processing library.  Here's a list of the Omnipay officially supported 1st party gateways: &lt;a href=&quot;https://github.com/thephpleague/omnipay#payment-gateways&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thephpleague/omnipay#payment-gateways&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/thephpleague/omnipay-paypal&quot; rel=&quot;nofollow noreferrer&quot;&gt;Omnipay: Paypal&lt;/a&gt; says it &lt;a href=&quot;https://github.com/thephpleague/omnipay-paypal#basic-usage&quot; rel=&quot;nofollow noreferrer&quot;&gt;supports&lt;/a&gt; these Paypal services:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PayPal_Express (PayPal Express Checkout)&lt;/li&gt;&#xA;&lt;li&gt;PayPal_ExpressInContext (PayPal Express In-Context Checkout)&lt;/li&gt;&#xA;&lt;li&gt;PayPal_Pro (PayPal Website Payments Pro)&lt;/li&gt;&#xA;&lt;li&gt;PayPal_Rest (Paypal Rest API)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Didn't have much Googling luck trying to find a 3rd party Omnipay plugins that support Paypal Standard, but there's always the option of writing an &lt;a href=&quot;http://omnipay.thephpleague.com/gateways/build-your-own/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Omnipay compatible one&lt;/a&gt; that wraps the Paypal Standard API, then a &lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#adding-additional-gateways&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt; to bring that into Commerce.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-18T20:51:43.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20049" PostTypeId="1" CreationDate="2017-04-18T21:13:00.390" Score="1" ViewCount="159" Body="&lt;p&gt;I need to have delayed credit card charges for my client.  From&#xA;Stripe's end it looks fairly straightforward by creating a customer and&#xA;saving their information for a later charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stripe.com/docs/charges#saving-credit-card-details-for-later&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://stripe.com/docs/charges#saving-credit-card-details-for-later&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, it looks like Omnipay doesn't support Stripe's Customers.&#xA;&lt;a href=&quot;https://stackoverflow.com/a/29862591/2177602&quot;&gt;https://stackoverflow.com/a/29862591/2177602&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution might be to create my own payment gateway plugin for Craft commerce&#xA;that doesn't use Omnipay but it's implied that Omnipay is required according to&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#adding-additional-gateways&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-gateways#adding-additional-gateways&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like I need to use Stripe's &lt;code&gt;stripe-php&lt;/code&gt; library directly.  How&#xA;would I do that and integrate with Craft commerce?&lt;/p&gt;&#xA;" OwnerUserId="6296" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-04-18T21:13:00.390" Title="How to create delayed charges with Craft Commerce or use Stripe's stripe-php library directly" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20050" PostTypeId="2" ParentId="20043" CreationDate="2017-04-18T21:45:35.893" Score="4" Body="&lt;p&gt;If you're setting an dynamic upload folder location for an Assets field inside of a Matrix field, you need to preface things like &lt;code&gt;{slug}&lt;/code&gt; with &lt;code&gt;{owner.slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the note about dynamic subfolders on an Assets field inside of Matrix here: &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-18T21:45:35.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20051" PostTypeId="2" ParentId="20018" CreationDate="2017-04-18T22:20:00.587" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;How to redirect directly to dashboard after logging in?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since your login form is on the front-end of the site, the &lt;a href=&quot;https://craftcms.com/docs/config-settings#postLoginRedirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;postLoginRedirect&lt;/a&gt; should do what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the logic Craft uses to determine where to send a user after a successful login here: &lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1599-L1614&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1599-L1614&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How to redirect directly to domain.com/login or homepage after signing out?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You've got the &lt;a href=&quot;https://craftcms.com/docs/config-settings#logoutPath&quot; rel=&quot;nofollow noreferrer&quot;&gt;logoutPath&lt;/a&gt; config setting set &lt;code&gt;'login'&lt;/code&gt;, which is going to log a user out as soon as they hit the &lt;code&gt;/login&lt;/code&gt; URI, which probably isn't what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There currently isn't a config setting to decide where to send a user after they've been logged out, but you could write a very simple &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onLogout&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onLogout&lt;/code&gt;&lt;/a&gt; event and redirected to wherever you wished.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-02-21T23:45:37.083" LastActivityDate="2018-02-21T23:45:37.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20052" PostTypeId="2" ParentId="19946" CreationDate="2017-04-18T23:30:43.457" Score="1" Body="&lt;p&gt;I recently asked P&amp;amp;T about a similar issue, although it was for the &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; event (not &lt;code&gt;onBeforeDeleteEntry&lt;/code&gt;) -- it turns out that you need to set the error on a specific field, not the entry as a whole. I don't know if this is the case for your problem, but perhaps worth trying something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;addError('title', 'Cannot delete because blah blah blah');&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-18T23:30:43.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20053" PostTypeId="1" AcceptedAnswerId="20054" CreationDate="2017-04-19T07:02:20.350" Score="1" ViewCount="1802" Body="&lt;p&gt;How am I able to use bootstrap in Craft? I created a folder in a templates directory named &lt;code&gt;_layouts&lt;/code&gt; and inside of that I have &lt;code&gt;base.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;&amp;lt;meta charset=&quot;UTF-8&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css&quot;&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this is where i want to include the bootstrap (contact.html)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/base&quot; %}&#xA;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;&amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;{% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;{% endmacro %}&#xA;{% from _self import errorList %}&#xA;&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;../public/index.php/contact.html&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromName&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; class = &quot;btn btn-submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having an error =&gt; &quot;A template that extends another one cannot have a body.&quot;&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:44:25.977" LastActivityDate="2017-05-09T19:44:25.977" Title="Template error: A template that extends another one cannot have a body" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20054" PostTypeId="2" ParentId="20053" CreationDate="2017-04-19T07:20:12.017" Score="2" Body="&lt;p&gt;In your &lt;code&gt;base.html&lt;/code&gt; you need to include a &lt;code&gt;block&lt;/code&gt; section, so something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;&amp;lt;meta charset=&quot;UTF-8&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css&quot;&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;{% block content %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your &lt;code&gt;contact.html&lt;/code&gt; you need to wrap your main markup in the same &lt;code&gt;block&lt;/code&gt;, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/base&quot; %}&#xA;{% macro errorList(errors) %}&#xA;{% if errors %}&#xA;&amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;{% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;{% endmacro %}&#xA;{% from _self import errorList %}&#xA;&#xA;{% block content %}&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;../public/index.php/contact.html&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromName&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; class = &quot;btn btn-submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you are basically saying create an area called &lt;code&gt;content&lt;/code&gt; in your &lt;code&gt;base.html&lt;/code&gt; and you want to fill this area with the markup wrapped in the &lt;code&gt;content&lt;/code&gt; block inside your &lt;code&gt;contact.html&lt;/code&gt;. You can call the &lt;code&gt;block&lt;/code&gt; whatever you want, so here we've called it &lt;code&gt;content&lt;/code&gt;, it doesn't have to be that, but it seems a fairly logical name for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have more than one block in your &lt;code&gt;base.html&lt;/code&gt;, if you want. For instance you could have a &lt;code&gt;header&lt;/code&gt;, &lt;code&gt;content&lt;/code&gt; and &lt;code&gt;footer&lt;/code&gt; blocks. All you need to remember is to use the same names inside the template file you are extending the &lt;code&gt;base.html&lt;/code&gt; from. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information can be found in the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/tags/extends.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-04-19T07:29:28.437" LastActivityDate="2017-04-19T07:29:28.437" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="20055" PostTypeId="2" ParentId="20045" CreationDate="2017-04-19T07:58:18.290" Score="4" Body="&lt;p&gt;Have you created a new &lt;code&gt;SEOMatic Meta&lt;/code&gt; fieldType? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know whether there is another/better way of doing it, but what I do is create a new field of type &lt;code&gt;SEOMatic Meta&lt;/code&gt;, then assign this field to the entry types of the pages you want the title to be made available to SEOMatic. There are all sorts of options within this field, but one of them allows you to select which field the title is pulled from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info on the &lt;code&gt;SEOMatic Meta&lt;/code&gt; field can be found in the &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/04.-SEO-Template-Meta&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-04-19T07:58:18.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20056" PostTypeId="2" ParentId="13277" CreationDate="2017-04-19T08:16:13.633" Score="2" Body="&lt;p&gt;On the frontend, you can use &lt;a href=&quot;https://github.com/intoeetive/Diff-for-Craft-CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Diff plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this code to fetch versions for entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set versions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get specific version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set version = craft.entryRevisions.getVersionById(versionId) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to compare a specific field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.diff.html(entry.title, version.title) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1104" LastEditorUserId="5437" LastEditDate="2017-05-01T05:44:19.077" LastActivityDate="2017-05-01T05:44:19.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20057" PostTypeId="1" AcceptedAnswerId="20077" CreationDate="2017-04-19T08:23:20.227" Score="1" ViewCount="1211" Body="&lt;p&gt;I have Craft on local (Pro edition) that was installed with French as the system language.  Is there a way to change to another language (English for example) for the control panel? I want to change &lt;strong&gt;the system language&lt;/strong&gt;, not the content of my entries (localisation).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/YWSxA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YWSxA.png&quot; alt=&quot;image of cp&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6603" LastEditorUserId="57" LastEditDate="2017-04-19T18:09:13.127" LastActivityDate="2018-10-02T09:16:58.860" Title="System language, can I change it after installation?" Tags="&lt;control-panel&gt;&lt;language&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20058" PostTypeId="2" ParentId="20057" CreationDate="2017-04-19T10:01:39.243" Score="1" Body="&lt;p&gt;You have to set &lt;code&gt;'defaultCpLanguage' =&amp;gt; 'en',&lt;/code&gt; in &lt;code&gt;craft/config/general.php&lt;/code&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultCpLanguage&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#defaultCpLanguage&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-19T10:01:39.243" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20060" PostTypeId="1" AcceptedAnswerId="20062" CreationDate="2017-04-19T10:21:46.613" Score="1" ViewCount="606" Body="&lt;p&gt;I have a homepage carousel using &lt;a href=&quot;http://flickity.metafizzy.co/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://flickity.metafizzy.co/&lt;/a&gt; and the images are set as background images and lazyload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need to do is to make them into responsive images, so that different images are served up for mobile, tablet and retina screens. But am struggling on how to do it in the code. Can anyone help?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Flickity carousel images --&amp;gt;&#xA;&amp;lt;div id=&quot;carousel-a&quot; class=&quot;carousel&quot;&amp;gt;&#xA;&#xA;{% if entry.carouselImage1.first() %}&#xA;  &amp;lt;div class=&quot;carousel-cell&quot; data-flickity-bg-lazyload=&quot;{{ entry.carouselImage1.first().url('homeCarouselLarge') }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if entry.carouselImage2.first() %}&#xA;  &amp;lt;div class=&quot;carousel-cell&quot; data-flickity-bg-lazyload=&quot;{{ entry.carouselImage2.first().url('homeCarouselLarge') }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if entry.carouselImage3.first() %}&#xA;  &amp;lt;div class=&quot;carousel-cell&quot; data-flickity-bg-lazyload=&quot;{{ entry.carouselImage3.first().url('homeCarouselLarge') }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="57" LastEditDate="2017-04-19T18:24:11.790" LastActivityDate="2017-04-20T08:29:53.767" Title="Responsive background images in carousel" Tags="&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20061" PostTypeId="1" AcceptedAnswerId="20078" CreationDate="2017-04-19T10:38:42.050" Score="1" ViewCount="138" Body="&lt;p&gt;So, as an Admin, I can copy either the password reset URL or the activation URL. But giving another user group all of the Users permissions (e.g. using &lt;code&gt;select all&lt;/code&gt; in the permissions tab when editing the group) does not give them the same functionality. Is this a config setting or just not possible?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-04-19T10:53:54.150" LastActivityDate="2017-04-19T18:23:31.403" Title="How to allow non-admin user group to copy password reset URL and activation URL?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20062" PostTypeId="2" ParentId="20060" CreationDate="2017-04-19T11:06:11.753" Score="2" Body="&lt;p&gt;It's not really a Craft CMS question, but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't remember Flickity supporting what you describe. You could try listening for screen size on pageload (and resize), assigning the correct image to the cell, and then creating the slideshow (destroying it first if it's a resize).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But half the point of lazy loading is to avoid loading images until they're needed anyway, so I'd question whether serving different images for different sizes is the right approach. Probably the easiest method would be to forget lazy loading and use an inline &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; element with media queries targeting each cell.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-04-20T08:29:53.767" LastActivityDate="2017-04-20T08:29:53.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20063" PostTypeId="2" ParentId="20040" CreationDate="2017-04-19T11:16:37.837" Score="2" Body="&lt;p&gt;You probably need a small plugin listening for &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt; which checks the payment method and re-saves the order with the required status.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-04-19T11:16:37.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20064" PostTypeId="1" CreationDate="2017-04-19T12:48:52.327" Score="0" ViewCount="46" Body="&lt;p&gt;I'm developing a plugin that works with Spotify's API. I'm wondering if can I add elements to a ElementSelect field. I do have the IDs of the elements I want to add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-04-19T13:42:15.270" Title="Add elements to ElementSelect via Javascript" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20066" PostTypeId="2" ParentId="9592" CreationDate="2017-04-19T13:34:25.140" Score="3" Body="&lt;p&gt;This article will help you set permissions properly for Craft CMS installs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/hardening-craft-cms-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hardening Craft CMS Permissions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It leverages &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt; to do the heavy lifting.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-04-19T13:34:25.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20067" PostTypeId="1" CreationDate="2017-04-19T13:36:14.080" Score="1" ViewCount="98" Body="&lt;p&gt;I added a field called &quot;phonenumber&quot; to the user profile fields which I want to use for login purposes, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually Craft allows an authentication by username or email-address. Is there a way to add another field for authentication, e.g. the custom field phonenumber? The goal is to expand Craft to accept logins via username and email-address as well as the phonenumber.&lt;/p&gt;&#xA;" OwnerUserId="6585" LastEditorUserId="57" LastEditDate="2017-04-19T18:36:33.980" LastActivityDate="2017-04-19T18:39:37.637" Title="Authentication by a custom field" Tags="&lt;users&gt;&lt;login&gt;&lt;user-profile&gt;&lt;custom-field&gt;&lt;authentication&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20068" PostTypeId="2" ParentId="20064" CreationDate="2017-04-19T13:42:15.270" Score="1" Body="&lt;p&gt;Do you need something like this (using jQuery): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#yourID').append( '&amp;lt;option value=&quot;value&quot;&amp;gt;text&amp;lt;/option&amp;gt;' );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6585" LastActivityDate="2017-04-19T13:42:15.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20069" PostTypeId="2" ParentId="20067" CreationDate="2017-04-19T14:21:27.847" Score="1" Body="&lt;p&gt;The short answer is no. Craft does not natively support this, and there's no way to implement it via a hook (or event).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick browse through the code shows that &lt;a href=&quot;https://craftcms.com/classreference/etc/users/UserIdentity#authenticate-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;UserIdentity::authenticate&lt;/code&gt; method&lt;/a&gt; is where most of the action takes place (called from &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#login-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;UserSessionService::login&lt;/code&gt; method&lt;/a&gt;), and that's very much tied to using either a username or an email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your only option is to implement a custom plugin, with its own controller endpoints, which handles login requests. You would then submit the login form to your plugin, rather than to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a plugin will, of course, need to follow all of the same security best practises as the current Craft &quot;login&quot; implementation, and be actively maintained in case any vulnerabilities come to light.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-19T14:21:27.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20070" PostTypeId="1" CreationDate="2017-04-19T15:31:00.017" Score="3" ViewCount="2702" Body="&lt;p&gt;So I just recently plugged in &lt;a href=&quot;https://github.com/pixelandtonic/ContactForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;pixelandtonic/ContactForm plugin&lt;/a&gt; into my website and I realized I got about 3 spam emails straight into my inbox on the first day it was up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to integrate the simple &quot;one click&quot; google Recaptcha into this form? Or is there any other/better solution than the Honeypot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---- &lt;strong&gt;EDIT&lt;/strong&gt; -----&lt;br&gt;&#xA;Ever since I've installed the &lt;a href=&quot;https://github.com/selvinortiz/craft.spamguard&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spam Guard&lt;/a&gt; Plugin, I haven't received anymore spam! This is a must with Pixel's Contact form plugin. &lt;/p&gt;&#xA;" OwnerUserId="6586" LastEditorUserId="6586" LastEditDate="2017-05-07T04:35:55.853" LastActivityDate="2018-08-01T19:22:06.783" Title="Integrate Google reCAPTCHA into Contact Form plugin" Tags="&lt;form&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20071" PostTypeId="1" CreationDate="2017-04-19T15:34:25.437" Score="1" ViewCount="100" Body="&lt;p&gt;I am trying to build a sitemap and need to loop through all entries in Craft in order to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am building a multi language site which has entries that can be enabled in a single locale but not in others. Because my default language (English) doesn't have a language code in it's site url (i.e. mysite.com is the English index and mysite.com/ja is the Japanese index), the sitemap template I am using automatically assumes the current locale to be English and &lt;strong&gt;any entry that is not enabled in English (but is enabled in another locale) does not get included in the sitemap loop&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can still include entries that are not enabled in the current locale (English) but are enabled in an alternate locale? Or is there some better way I should be doing this?&lt;/p&gt;&#xA;" OwnerUserId="6616" LastEditorUserId="57" LastEditDate="2017-04-19T18:44:01.540" LastActivityDate="2017-04-19T18:44:01.540" Title="How can I loop through all entries that are enabled in at least one locale (not necessarily my current locale)?" Tags="&lt;localization&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20072" PostTypeId="2" ParentId="20071" CreationDate="2017-04-19T16:05:59.527" Score="1" Body="&lt;p&gt;Just add the locale criteria to your entries call and specify the locale(s) you need to query. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.entries({&#xA;    section: 'sectionHandle',&#xA;    limit: null,&#xA;    locale:&quot;es_us&quot;&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-04-19T16:05:59.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20073" PostTypeId="1" CreationDate="2017-04-19T16:28:03.910" Score="2" ViewCount="66" Body="&lt;p&gt;I can do &lt;code&gt;craft.entries.section('mySection').relatedTo(item.id)&lt;/code&gt; and it will return the result, so i assumed i could do &lt;code&gt;craft.entries.section(['mySection','mySection2','mySection3']).relatedTo(item.id)&lt;/code&gt; but, the latter seems to return no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any input would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2017-04-19T16:28:03.910" Title="relatedTo doesn't seem to work when using multiple sections in a craft.entries call" Tags="&lt;entries&gt;&lt;relatedto&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20074" PostTypeId="1" AcceptedAnswerId="20076" CreationDate="2017-04-19T16:33:57.440" Score="1" ViewCount="1323" Body="&lt;p&gt;Currently collaborating on a site with another developer, which is using ElementAPI pretty heavily for content delivery. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to limit the number of returns on any given json feed? Say; only return the 10 most recent entries in any given channel? Or order the returned data by a specified field asc/desc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'trucks.json' =&amp;gt; [&#xA;  'elementType' =&amp;gt; 'Entry',&#xA;  'criteria' =&amp;gt; ['section' =&amp;gt; 'trucks'],&#xA;  'paginate' =&amp;gt; false,&#xA;  'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    return [&#xA;      (int)$entry-&amp;gt;id,&#xA;      $entry-&amp;gt;manufacturer,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastActivityDate="2019-11-27T21:15:38.617" Title="ElementAPI: How to order and/or limit results?" Tags="&lt;plugin-elementapi&gt;&lt;order&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20076" PostTypeId="2" ParentId="20074" CreationDate="2017-04-19T17:20:10.823" Score="2" Body="&lt;p&gt;This should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'trucks',&#xA;    'limit'   =&amp;gt; 10,&#xA;    'order'   =&amp;gt; 'title asc',&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Criteria Model documentation&lt;/a&gt; has more information about setting criteria.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update for Craft 3.x*&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The “order” element query param has been deprecated. Use “orderBy” instead.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;* Craft v3.0.11 reports this in the &lt;code&gt;/admin&lt;/code&gt; under &lt;code&gt;deprecation errors&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="-1" LastEditDate="2018-06-16T17:47:12.507" LastActivityDate="2018-06-16T17:47:12.507" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="20077" PostTypeId="2" ParentId="20057" CreationDate="2017-04-19T18:16:50.107" Score="2" Body="&lt;p&gt;If you go to Settings-&gt;Locales in the control panel, you can add &quot;English - en&quot; as a new locale/language to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you can can what language the Control Panel will display on a &lt;em&gt;per user&lt;/em&gt; basis by going to the user's account and setting the &quot;Preferring Language&quot; setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/20058/57&quot;&gt;J. Baptiste&lt;/a&gt; pointed out, you can also set what the default Control Panel language should be for all users by setting the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultCpLanguage&quot; rel=&quot;nofollow noreferrer&quot;&gt;defaultCpLanguage&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-19T18:16:50.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20078" PostTypeId="2" ParentId="20061" CreationDate="2017-04-19T18:23:31.403" Score="0" Body="&lt;p&gt;Currently that's the expected behavior.  Feel free to add your voice to this feature request, though: &lt;a href=&quot;https://github.com/craftcms/cms/issues/942&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/942&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you could always write a plugin that exposed whatever features you wanted to whomever you wanted bypassing Craft's logic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-19T18:23:31.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20079" PostTypeId="2" ParentId="20067" CreationDate="2017-04-19T18:39:37.637" Score="1" Body="&lt;p&gt;A possible workaround would be to use the phone numbers &lt;em&gt;as&lt;/em&gt; the username.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onBeforeLogin&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeLogin&lt;/a&gt; event and validated the entered phonenumber against your custom field and proceeded accordingly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-19T18:39:37.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20080" PostTypeId="2" ParentId="20070" CreationDate="2017-04-19T18:42:55.610" Score="3" Body="&lt;p&gt;There are several &lt;a href=&quot;https://straightupcraft.com/craft-plugins/?q=spam&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;anti-SPAM&lt;/a&gt; form plugins available for Craft that should work for you (including a Google reCAPTCHA one).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-19T18:42:55.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20082" PostTypeId="1" AcceptedAnswerId="20083" CreationDate="2017-04-19T23:18:44.917" Score="2" ViewCount="114" Body="&lt;p&gt;Setting up a plugin using Pocket API and I'm currently in a authorization loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Index template calls the init function. Init function gets requestToken (successfully) and then redirects to Pocket for app authorization (authorizeToken function). After authorization, redirected to callback. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, I need to convert the token to a 'Pocket access token', but when the controlller fires it seems to call the init function before the accessToken function and I end up in an endless loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain why this is happening? Am I going about this the right way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Index template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = &quot;Pocket Articles&quot;|t %}&#xA;&#xA;{% set offset = craft.request.getParam('offset') %}&#xA;{% set start = craft.pocket.init() %}&#xA;&#xA;{% set content %}&#xA;    {{ start }}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Service:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    $token  = $this-&amp;gt;requestToken();&#xA;    $auth   = $this-&amp;gt;authorizeToken($token);&#xA;    return;&#xA;}&#xA;&#xA;public function accessToken($code){&#xA;    $url                    = $this-&amp;gt;getSetting('access_path'); //https://getpocket.com/v3/oauth/authorize&#xA;    $requirements['code']   = $code;&#xA;    $requirements['key']    = $this-&amp;gt;getSetting('consumer_key');&#xA;&#xA;    $curl = $this-&amp;gt;initCurl($url, $requirements);&#xA;    $results = curl_exec($curl);&#xA;&#xA;    echo &quot;&amp;lt;pre&amp;gt;&quot;;&#xA;    print_r($results);&#xA;    echo &quot;&amp;lt;/pre&amp;gt;&quot;;&#xA;&#xA;    curl_close($curl);&#xA;&#xA;    return $results;&#xA;}&#xA;&#xA;private function authorizeToken($token){&#xA;    $auth_path      =$this-&amp;gt;getSetting('auth_path'); //https://getpocket.com/auth/authorize?&#xA;    $redirect_path  =$this-&amp;gt;getSetting('callback_path');&#xA;    $actionUrl = UrlHelper::getActionUrl('pocket/callback');&#xA;&#xA;&#xA;    $url = $auth_path.'request_token='.$token.'&amp;amp;redirect_uri='.$actionUrl;&#xA;&#xA;    header(&quot;Location:&quot;.$url);&#xA;&#xA;    return $url;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCallback(){&#xA;&#xA;    //call pocket server for acccess token&#xA;    if(craft()-&amp;gt;httpSession-&amp;gt;get('code')){&#xA;        $code   = craft()-&amp;gt;httpSession-&amp;gt;get('code');&#xA;    }else{&#xA;        $code   = &quot;no code&quot;;&#xA;    }&#xA;&#xA;    $access_connection = craft()-&amp;gt;pocket-&amp;gt;accessToken($code);&#xA;    $variables['access_token'] = $access_connection;&#xA;&#xA;    $this-&amp;gt;renderTemplate('pocket/control_panel', $variables);&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Callback template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = &quot;Pocket Articles&quot;|t %}&#xA;&#xA;{% set offset = craft.request.getParam('offset') %}&#xA;&#xA;{% set content %}&#xA;    {{ dump(access_token) }}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="353" LastActivityDate="2017-04-19T23:35:59.537" Title="Pocket API authorization loop" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20083" PostTypeId="2" ParentId="20082" CreationDate="2017-04-19T23:35:59.537" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CApplicationComponent#init-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;The &lt;code&gt;init&lt;/code&gt; method&lt;/a&gt; is automatically called whenever a service class is instantiated. Think of it as akin to a constructor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not want you want, just rename the method (to &lt;code&gt;initialize&lt;/code&gt;, for example).&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-19T23:35:59.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20084" PostTypeId="1" AcceptedAnswerId="20085" CreationDate="2017-04-20T00:37:19.250" Score="2" ViewCount="395" Body="&lt;p&gt;I'm editing an entry in the CP...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/admin/entries/mySection/33-my-awesome-entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I &lt;strong&gt;save&lt;/strong&gt; this entry, it will redirect me back to the entry index page. However, I'd like to override this behavior, and get redirected to a &lt;em&gt;different&lt;/em&gt; page upon saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to override the redirect target when saving an entry?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-04-20T05:23:05.787" Title="Possible to redirect elsewhere after saving an entry?" Tags="&lt;control-panel&gt;&lt;entry&gt;&lt;redirect&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20085" PostTypeId="2" ParentId="20084" CreationDate="2017-04-20T00:37:19.250" Score="3" Body="&lt;p&gt;&lt;strong&gt;Yes!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you're using some sort of business logic plugin (if you don't have one, &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;get one&lt;/a&gt;), then simply put this code in your main &lt;code&gt;*Plugin.php&lt;/code&gt; file...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;&#xA;    // Trigger template hook&#xA;    craft()-&amp;gt;templates-&amp;gt;hook('cp.entries.edit', function(&amp;amp;$context)&#xA;    {&#xA;&#xA;        // Check to ensure that you're in the right section&#xA;        if ('mySection' == $context['sectionHandle'])&#xA;        {&#xA;&#xA;            // Specify the preferred URI&#xA;            $uri = 'special-page/'.$context['entry']-&amp;gt;uri;&#xA;&#xA;            // Set the &quot;Save&quot; button redirect&#xA;            craft()-&amp;gt;templates-&amp;gt;includeJs(&quot;&#xA;                $(function () {&#xA;                    $('input[name=\&quot;redirect\&quot;]').val('{$uri}');&#xA;                });&#xA;            &quot;);&#xA;&#xA;            // Set the `cmd + s` shortcut redirect&#xA;            $context['saveShortcutRedirect'] = $uri;&#xA;&#xA;        }&#xA;&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-04-20T05:23:05.787" LastActivityDate="2017-04-20T05:23:05.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20086" PostTypeId="2" ParentId="20036" CreationDate="2017-04-20T00:39:45.670" Score="2" Body="&lt;p&gt;I actually needed to do this today for similar reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a plugin that reduces it to a single loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/simplethemes/sortcart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/simplethemes/sortcart&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-20T00:39:45.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20090" PostTypeId="1" CreationDate="2017-04-20T04:51:43.970" Score="1" ViewCount="170" Body="&lt;p&gt;I'm new at Craft and I want to add new Entry into a jobs section. But I'm always receiving en error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OQoAA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OQoAA.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layouts/site' %}&#xA;&#xA;{% block body %}&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    {% set company = entry.company %}&#xA;    {% set jobDescription = entry.jobdescription %}&#xA;    {% set jobRequirements = entry.jobrequirements %}&#xA;    {% set location = entry.location %}&#xA;    {% set salary = entry.salary %}&#xA;    {% set email = entry.email %}&#xA;    &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;{{ company }}&amp;lt;/strong&amp;gt; &amp;amp;nbsp; - &amp;amp;nbsp;{{ entry.postDate.rfc1123 }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;br/&amp;gt;&#xA;    &amp;lt;br/&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Description&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt;{{ jobDescription }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Requirements&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt;{{ jobRequirements }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Location&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt;{{ location }}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&#xA;    &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Contact us at&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt; {{ email }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;br/&amp;gt;&amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Salary&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt;{{ salary }}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:40:09.443" LastActivityDate="2018-02-04T01:37:14.877" Title="When adding a new Entry, I'm having an error" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20091" PostTypeId="2" ParentId="20090" CreationDate="2017-04-20T05:57:59.693" Score="1" Body="&lt;p&gt;Just based on your screenshot, my guess is the settings for your entry type for your &quot;Jobs&quot; section has &quot;Show the Title field&quot; unchecked and you've set the &quot;Title Format&quot; setting to be &quot;jobs&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if you unchecked that box on purpose, but if you re-check it, you can manually set the Title (which the slug is auto-generated from on new entries) on a per-entry basis.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-20T05:57:59.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20092" PostTypeId="1" AcceptedAnswerId="20103" CreationDate="2017-04-20T07:48:48.537" Score="0" ViewCount="167" Body="&lt;p&gt;How can I display all entries in one page? I have a jobs Channel and inside of it there are 5 entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Title | Company  | Email&#xA;-------------------------&#xA;title1  company1   email1&#xA;title2  company2   email2&#xA;title3  company3   email3&#xA;title4  company4   email4&#xA;title5  company5   email5 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want it to be display in one page&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:36:27.310" LastActivityDate="2017-05-09T19:36:27.310" Title="Display all the data in one entry" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20093" PostTypeId="1" AcceptedAnswerId="20105" CreationDate="2017-04-20T11:22:43.837" Score="1" ViewCount="706" Body="&lt;p&gt;I'm trying to use price as a parameter for filtering my Craft Commerce products, but I cannot get it to work. I think the problem is with the way that I'm referring to the product price, but at the same time I'm not sure how to change it so that it will work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to filter by product price as I'm trying to do here ? &#xA;Does anyone know what exactly I need to change to get my query to work ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers in the right direction would be most appreciated.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;    relatedTo: category,&#xA;      price: [&#xA;       'and',&#xA;       '&amp;gt;= ' ~ 200,&#xA;       '&amp;lt;= ' ~ 500,&#xA;      ]&#xA; } %}&#xA;&#xA;{% set products = craft.commerce.products(queryParams) %}&#xA;&#xA;{% for product in products %}&#xA;    ....output product data&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5417" LastEditorUserId="57" LastEditDate="2017-04-20T16:57:05.090" LastActivityDate="2017-04-20T17:07:06.277" Title="How can I filter Craft Commerce products by price" Tags="&lt;plugin-craftcommerce&gt;&lt;elementcriteriamodel&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20095" PostTypeId="1" CreationDate="2017-04-20T12:25:21.660" Score="1" ViewCount="393" Body="&lt;p&gt;I want to use all of the Craft features to render a page from template, but instead of serving it to the front-end visitors I want to send it to an external mail delivery service (something like MailChimp) using cURL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I need to get the rendered HTML into a string and then pass it to my cURL function. How can I achieve this, any tips?&lt;/p&gt;&#xA;" OwnerUserId="6620" LastEditorUserId="57" LastEditDate="2017-04-20T17:07:58.867" LastActivityDate="2017-04-20T17:07:58.867" Title="Pass the rendered template HTML string to an external function" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20096" PostTypeId="1" CreationDate="2017-04-20T12:28:00.397" Score="-1" ViewCount="427" Body="&lt;p&gt;What would happen if I never buy Craft license and continue working in Craft CMS Pro trial ? Would the CMS be locked after some day or a error will show up on my website frontend ?&lt;/p&gt;&#xA;" OwnerUserId="6621" LastEditorUserId="57" LastEditDate="2017-04-20T17:09:25.260" LastActivityDate="2017-04-20T22:09:02.157" Title="What if I continue my website using Craft CMS Pro trial?" Tags="&lt;craft-pro&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20098" PostTypeId="2" ParentId="20095" CreationDate="2017-04-20T12:49:42.987" Score="1" Body="&lt;p&gt;You would need to build a plugin that fetches the HTML string and then passes it on to cURL or whatever you choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a specific solution on how to get a template HTML string with all the parameters you need &lt;a href=&quot;https://craftcms.stackexchange.com/a/2688/258&quot;&gt;check out this answer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-04-20T12:49:42.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20099" PostTypeId="2" ParentId="20017" CreationDate="2017-04-20T13:16:55.417" Score="3" Body="&lt;p&gt;Thanks to Brad's help, we discovered that the server was misconfigured with an incorrect value for &lt;code&gt;session.cookie_domain&lt;/code&gt;. Fixing that resolved the issue in this case.&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2017-04-20T13:16:55.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20100" PostTypeId="2" ParentId="20096" CreationDate="2017-04-20T13:52:54.080" Score="6" Body="&lt;p&gt;They have answered this on the CraftCMS site: &lt;a href=&quot;https://craftcms.com/support/license-enforcement&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/support/license-enforcement&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Edition Enforcement&lt;/p&gt;&#xA;&lt;p&gt;Each time Craft phones home to check for updates, we check the incoming license to see which edition it should be running. That “licensed edition” is included in the response, which Craft compares against what is actually installed. If there’s a discrepancy, the Control Panel will display a modal window that provides options for correcting the situation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="585" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-04-20T13:52:54.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20101" PostTypeId="1" AcceptedAnswerId="20102" CreationDate="2017-04-20T14:52:32.800" Score="2" ViewCount="92" Body="&lt;p&gt;Not sure if what I am looking is possible, but basically I have a section ('portfolio').  At the bottom of each entry I have links to the previous and next entry. Simple.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My trouble is that the body field in my entries is not always populated, and because of this I would like to by-pass these ones in my nav at the bottom of an entry page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See my code below which is not working, I have a feeling that my logic is not going in the right direction at all with this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('portfolio') %}&#xA;&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&#xA;{% if prevEntry and prevEntry.body | length %}&#xA;    {% set image = prevEntry.portfolioImages.first() %}&#xA;    &amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextEntry and nextEntry.body | length %}&#xA;    {% set image = nextEntry.portfolioImages.first() %}&#xA;    &amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4783" LastEditorUserId="57" LastEditDate="2017-04-20T17:12:32.717" LastActivityDate="2017-04-20T17:12:32.717" Title="Next and Previous Entries that match condition?" Tags="&lt;entries&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20102" PostTypeId="2" ParentId="20101" CreationDate="2017-04-20T15:12:13.663" Score="2" Body="&lt;p&gt;You can add the &quot;non-empty body&quot; conditional to your parameters, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('portfolio').body(':notempty:') %}&#xA;{% set previousEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{# …and so forth #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-20T15:12:13.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20103" PostTypeId="2" ParentId="20092" CreationDate="2017-04-20T16:11:32.743" Score="1" Body="&lt;p&gt;Use &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.entries&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for job in craft.entries.section('jobs') %}&#xA;  &amp;lt;div&amp;gt;&#xA;    Title: {{ job.title }}&amp;lt;br&amp;gt;&#xA;    Company: {{ job.company }}&amp;lt;br&amp;gt;&#xA;    Email: &amp;lt;a href=&quot;mailto:{{ job.email }}&quot;&amp;gt;{{ job.email }}&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3931" LastEditorUserId="3931" LastEditDate="2017-04-21T19:49:31.120" LastActivityDate="2017-04-21T19:49:31.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20104" PostTypeId="1" CreationDate="2017-04-20T17:02:19.910" Score="1" ViewCount="162" Body="&lt;p&gt;I would like to access and modify certain entries using asynchronous calls from a custom made webapp using React which is complementary to the main website. Is there any way to achieve this in Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="6622" LastEditorUserId="22" LastEditDate="2017-05-09T19:33:03.947" LastActivityDate="2017-05-09T19:33:03.947" Title="API endpoint to show/add/modify/delete content" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20105" PostTypeId="2" ParentId="20093" CreationDate="2017-04-20T17:07:06.277" Score="1" Body="&lt;p&gt;Looks like &lt;code&gt;defaultPrice&lt;/code&gt; is the property on the &lt;code&gt;Commerce_ProductElementType&lt;/code&gt; class you can use for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;    relatedTo: category,&#xA;        defaultPrice: [&#xA;            'and',&#xA;            '&amp;gt;= ' ~ 200,&#xA;            '&amp;lt;= ' ~ 500,&#xA;        ]&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-20T17:07:06.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20106" PostTypeId="2" ParentId="20104" CreationDate="2017-04-20T17:19:36.563" Score="1" Body="&lt;p&gt;I've got 0 experience with React, but you can write a Craft &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; (generate boilerplate code at &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt;), that has a &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#posting-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;action(s)&lt;/a&gt; your webapp can post to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you can use &lt;a href=&quot;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;EntriesService-&amp;gt;saveEntry&lt;/code&gt;&lt;/a&gt; (&lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt;) to update/create entries just like Craft/any other plugin does.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-20T17:19:36.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20107" PostTypeId="2" ParentId="8414" CreationDate="2017-04-20T18:17:45.423" Score="7" Body="&lt;p&gt;&lt;em&gt;EDIT: When I wrote this answer (in April 2017), I didn't realize this question was asked 2 years ago (I saw it at the top of the list of new questions on the stackexchange site and assumed it was just asked). Leaving it here for future reference though. (Hopefully a lot of it becomes a moot point after Craft 3 is released)...&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think technically Craft is capable of handling large sites, and it's probably a good choice (as good as any PHP CMS out there). But you will run into some problems due to the limited customizability of Craft's CP (back-end dashboard interface) and how it stores field/entrytype schema in the database. I'm building a fairly large site now (thousands of product pages for a catalog, each of which has between 1 and a dozen photos and additional support files). The big challenges I've run into so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Asset manager chokes when there are too many folders. I originally set the product page assets to have a separate folder based on their slug, but then my CP kept crashing because it was trying to list 1,000+ folders when you expand the asset source in the left sidebar. So instead I need to figure out some code that creates sub-folders based on the first letter or few letters of the slug (just breaking it up into more of a hierarchy than a flat list).&lt;/li&gt;&#xA;&lt;li&gt;Asset manager doesn't search through all the assets... I think it only searches the folder that you're currently viewing. If your client isn't very well organized with where they place uploaded assets, it could become difficult to locate them.&lt;/li&gt;&#xA;&lt;li&gt;Craft has no functionality for setting up restrictions on your page hierarchies. For example, we have product categories and underneath the categories are product detail pages. But the products within a category need to be manually sorted (they are not necessarily displayed in alphabetical order)... and craft provides no way to achieve this. You can have 1 big &quot;Structure&quot; section of the site which does allow manual sorting of things, but you cannot impose any kind of restrictions such as &quot;product pages can only live underneath categories&quot;.&lt;/li&gt;&#xA;&lt;li&gt;All field/entrytype schema information is stored within the database, which makes working on the site with a team (and with multiple servers e.g. local dev, staging, test, production) a total pain. You either need to write down your own notes of how to recreate certain changes to fields/entrytypes, or send database backups all over the place (which is impossible if 2 people are making their own structural changes). On top of the pain of collaboration and deployment, there's also the fact that you cannot put your schema changes into version control. And once the site goes live these problems are further compounded because you're basically having to do a portion of your development on the live site (for future feature requests where you need to add/change fields or entry types).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hopefully the forthcoming Craft 3 will address a lot of these issues (I know they're revamping a lot of the asset management stuff, and adding in a way to migrate your schema in code, and I have a &lt;a href=&quot;https://github.com/craftcms/cms/issues/1628&quot; rel=&quot;noreferrer&quot;&gt;feature request out to address the hierarchy restrictions&lt;/a&gt; so hopefully that gets added someday).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But despite these limitations, overall I think Craft is capable of the large sites. (It seems to have good solutions for optimizing page queries via &quot;eager loading&quot; and good fine-grained caching mechanisms with its &lt;code&gt;{% cache %}&lt;/code&gt; twig tag)... and I think we're figuring out ways to hackily work around the limitations for this project. Every CMS has its limitations, it's just a question of which flavor of hassle do you want to deal with :)&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-20T18:17:45.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20109" PostTypeId="2" ParentId="20096" CreationDate="2017-04-20T22:09:02.157" Score="3" Body="&lt;p&gt;You can locally, but launching the project into the wild, you will need a pro license.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-20T22:09:02.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20110" PostTypeId="1" AcceptedAnswerId="20118" CreationDate="2017-04-20T23:08:29.270" Score="2" ViewCount="78" Body="&lt;p&gt;I'm using cycle to open and close a div for a row of content. It works great when there are more than a certain number of entries - in this case 4, but doesn't work when there are fewer than that. Is there a way to make this work so it always closes the div even if there are fewer entries than specified in the code? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cycle(['&amp;lt;div class=&quot;row&quot;&amp;gt;', '', '', ''], loop.index0) | raw }}&#xA;... stuff....&#xA;{{ cycle(['', '', '', '&amp;lt;/div&amp;gt;'], loop.index0) | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="1016" LastEditDate="2017-04-20T23:13:39.840" LastActivityDate="2017-04-21T07:22:23.543" Title="using cycle with unknown number of entries" Tags="&lt;cycle&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20111" PostTypeId="2" ParentId="20110" CreationDate="2017-04-20T23:31:24.440" Score="5" Body="&lt;p&gt;Maybe you can use Twig's batch for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/filters/batch.html&quot; rel=&quot;noreferrer&quot;&gt;Twig Batch&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}&#xA;{% for row in items|batch(3, '') %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% for column in row %}&#xA;        &amp;lt;p&amp;gt;{{ column }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Batch lets you have something to fall back on when you have less items. In this case there are 3 items within my row and if there will be 2, it will output what I have in the '', in this case nothing. (but I can put what I want in that '').&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-04-20T23:44:34.313" LastActivityDate="2017-04-20T23:44:34.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20115" PostTypeId="2" ParentId="19523" CreationDate="2017-04-21T05:22:57.943" Score="0" Body="&lt;p&gt;It sounds to me like a category is what you want - you just need to expand the user's concept of what categories are for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the choices to appear more like a drop down, you could use &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields/&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Dynamic Fields&lt;/a&gt;, but you would still probably want to use categories for the underlying choices.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-04-21T05:22:57.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20116" PostTypeId="1" AcceptedAnswerId="20122" CreationDate="2017-04-21T05:33:36.020" Score="1" ViewCount="111" Body="&lt;p&gt;I have created an Adjuster which is attached to &lt;code&gt;commerce_lineItems.onPopulateLineItem&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discount criteria is based on validation of a completely separate coupon API, so I created a permission-less user group in order to allow my client to continue using the Commerce Discounts UI. In my adjuster, I had to override the the &lt;code&gt;matchLineItem()&lt;/code&gt; method in order to bypass the &lt;code&gt;$discount-&amp;gt;allGroups&lt;/code&gt; check. I'm using Craft's &lt;code&gt;httpSession&lt;/code&gt; to persist the criteria through the checkout process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works fine, however if the user adds a product to the cart and THEN authenticates, the discount doesn't get applied until they either a.) update the cart or b.) raise the &lt;code&gt;commerce_lineItems.onPopulateLineItem&lt;/code&gt; event again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding &lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($cart)&lt;/code&gt; at the end of a successful API call, however that doesn't seem to trigger the event.&#xA;Is there another event I can use that will also update the cart or can I somehow raise an already declared &lt;code&gt;CEvent&lt;/code&gt;? I've tried everything I know including hitting &lt;code&gt;actionUpdateCart()&lt;/code&gt; with Guzzle!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a very edge case situation, so just to (briefly) illustrate I've added a portion of my base plugin below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    require_once __DIR__ .'/vendor/autoload.php';&#xA;    $this-&amp;gt;check_membership();&#xA;    /*&#xA;     Load Premium Member Adjusters if $is_premium_member is true&#xA;    */&#xA;    craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;        $lineItem    = $event-&amp;gt;params['lineItem'];&#xA;&#xA;        if ($lineItem-&amp;gt;purchasable instanceof Commerce_VariantModel){&#xA;            if ($this-&amp;gt;is_premium_member) {&#xA;                $this-&amp;gt;adjusters = [&#xA;                  599 =&amp;gt; new WorkshopAdjuster&#xA;                ];&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-04-21T15:38:15.810" Title="Can a plugin manually raise another plugin's Event?" Tags="&lt;plugin-craftcommerce&gt;&lt;events&gt;&lt;hook&gt;&lt;extends&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20117" PostTypeId="1" CreationDate="2017-04-21T06:35:12.953" Score="2" ViewCount="88" Body="&lt;p&gt;I am looking at purchasing Venti 2 for events and also what it takes to build my own plugin.  Does anyone know what kind of time it takes to build a plugin that does reoccurring dates, categories and such.  Would I need to put the entries into a separate database table?  Getting back to Venti, has anyone used it and does it have enough custom functionality compared to creating my own?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-21T22:19:03.820" Title="What is the benefit of using a calendar event plugin or building your own?" Tags="&lt;events&gt;&lt;plugin-ventievents&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20118" PostTypeId="2" ParentId="20110" CreationDate="2017-04-21T07:22:23.543" Score="3" Body="&lt;p&gt;This is how I usually solve this problem, notice the explicit check for the last element in the list. You can set &lt;code&gt;cols&lt;/code&gt; to whatever number of columns you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cols = 4 %}&#xA;{% for thing in things %}&#xA;  {% if loop.index0 % cols == 0 %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;  {% endif %}&#xA;  {# other stuff #}&#xA;  {% if (loop.index0 % cols == cols - 1 or loop.last) %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="981" LastActivityDate="2017-04-21T07:22:23.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20119" PostTypeId="1" CreationDate="2017-04-21T11:54:34.053" Score="1" ViewCount="376" Body="&lt;p&gt;I need a function to duplicate an (published) entry as a draft entry. Now if I duplicate an entry it will immediately publics that entry an that fires some plugin events (sends mails) I didn't want.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2017-04-25T10:25:54.773" LastActivityDate="2017-04-25T10:25:54.773" Title="Is it possible to duplicate a entry as a draft entry?" Tags="&lt;plugin-development&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20120" PostTypeId="1" CreationDate="2017-04-21T12:11:26.107" Score="1" ViewCount="78" Body="&lt;p&gt;Well, I need to add options to a select field with Javascript. I do that with &lt;code&gt;$(...).append(...)&lt;/code&gt;, the problem is that I get a &quot;Invalid&quot; message. I think it's because the new option's value is not in the available options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is then: Can I add a wildcard to the options? or bypass the validation for this field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any better idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-04-21T16:19:29.210" Title="Add options to multi-select with Javascript" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20121" PostTypeId="2" ParentId="20117" CreationDate="2017-04-21T14:39:16.183" Score="5" Body="&lt;p&gt;Depending on your sites' actual event handling needs, building your own plugin similar to &lt;a href=&quot;https://solspace.com/craft/calendar&quot; rel=&quot;noreferrer&quot;&gt;Solspace Calendar&lt;/a&gt; or &lt;a href=&quot;https://venticalendar.io&quot; rel=&quot;noreferrer&quot;&gt;Venti&lt;/a&gt; to handle this (specifically features like recurrences - the CP UI as well as rendering in front end) could easily take you hundreds of hours to build properly. Unless you need something very different or custom from what either of these plugins offer out of the box, I would imagine the $99 or $49 would pay off real fast if you calculated the time it'd take you, even if you were the most seasoned of developers. :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Solspace Calendar and Venti offer 30 day satisfaction guarantees, so it might be worth it to consider buying one or both and trying them out to see if they fit your needs. If not, you can always ask for a refund within 30 days, or consider modifying the plugin (rather than completely rebuilding the functionality).&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-04-21T14:39:16.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20122" PostTypeId="2" ParentId="20116" CreationDate="2017-04-21T15:38:15.810" Score="1" Body="&lt;p&gt;I've built a plugin which uses it's own events before, I guess the way to do it would be the same for separate plugins, however this is untested for your use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This should go in your plugin service&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Import the event from the other plugin&#xA;Craft::import('plugins.otherPluginHandle.events.OtherPluginEvent');&#xA;&#xA;/Initialise the plugins event and pass whatever is required to it.&#xA;$event = new OtherPluginEvent($this, array('request' =&amp;gt; $request));&#xA;&#xA;// Raise it.&#xA;$this-&amp;gt;raiseEvent('OtherPluginEvent', $event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again I haven't tried this from the context of calling another plugins event, but that is what I do from a plugins own event...&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-04-21T15:38:15.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20123" PostTypeId="1" AcceptedAnswerId="20131" CreationDate="2017-04-21T16:06:12.820" Score="5" ViewCount="876" Body="&lt;p&gt;what is the best way to install private plugin in Craft CMS 3? The private plugin is installed in private GitHub repo, but we don't have a custom packagist that we would use, therefore I wonder if there is any option to enable private plugins via composer/plugin-installer?&lt;/p&gt;&#xA;" OwnerUserId="6345" LastActivityDate="2018-07-23T21:18:13.733" Title="Private plugin distribution in Craft CMS 3" Tags="&lt;craft3&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20124" PostTypeId="2" ParentId="20120" CreationDate="2017-04-21T16:19:29.210" Score="1" Body="&lt;p&gt;Your best option would be to create a custom field type. That's quite a bit of work, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failing that, you could add an extra &quot;Other&quot; option to the select field, and create a separate text field to hold the &quot;free form&quot; option.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Caveats&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Craft isn't able to automatically validate the association between two fields. In other words, there's no such thing as &quot;if the user selects the 'other' option, then she must also complete the 'Other' field&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a must-have, you could implement some front-end validation, by injecting custom JavaScript into the Control Panel. Once again, a plugin is the best way to go here, but you may also be able to piggy-back on something like &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft-cpjs&lt;/a&gt;, by Lindsey Diloreto.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-21T16:19:29.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20125" PostTypeId="2" ParentId="20123" CreationDate="2017-04-21T17:34:42.980" Score="1" Body="&lt;p&gt;In addition to the &lt;a href=&quot;https://craftcms.stackexchange.com/a/20131/57&quot;&gt;git&lt;/a&gt; repository type, &quot;private&quot; plugins can also use Composer's path repository feature to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html#loading-your-plugin-into-a-craft-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/plugin-guide.html#loading-your-plugin-into-a-craft-project&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://getcomposer.org/doc/05-repositories.md#path&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/doc/05-repositories.md#path&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-07-23T19:41:45.670" LastActivityDate="2018-07-23T19:41:45.670" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="20126" PostTypeId="1" CreationDate="2017-04-21T19:06:25.353" Score="3" ViewCount="1094" Body="&lt;p&gt;My client wants to look through very old versions of a certain page entry, but the Recent Versions drop-down is only showing a max of 10 entries. I know that older versions of the page exist because if I change the last number in the URL (of a more recent version) and I can access much older entries. Unfortunately, the are organized numerically by date (and not by page) so it makes them almost impossible to sift through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="6627" LastActivityDate="2017-04-22T02:21:10.363" Title="Entry versioning history only shows last 10 versions" Tags="&lt;entry-versions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20127" PostTypeId="1" CreationDate="2017-04-21T19:14:17.660" Score="1" ViewCount="92" Body="&lt;p&gt;I'm have group called &quot;Editors&quot; that can create entries with the text fields but I would like to &quot;Admin&quot; group have lightswitch called &quot;promoted&quot; in same entries or maybe even text field for notes that would be not visible for &quot;Editors&quot; group (and entry owner if he is in &quot;Editors&quot; group) it is possible?&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-22T04:13:13.930" Title="Admin-only editable field of entry?" Tags="&lt;entries&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20128" PostTypeId="1" AcceptedAnswerId="20130" CreationDate="2017-04-21T19:21:03.343" Score="1" ViewCount="56" Body="&lt;p&gt;I have seen a number of different paths, but, it is a bit confusing to me. What should be in my value in the HIDDEN input action below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a twig page at my root:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;psychEmail/pubRequest&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- ...--&amp;gt;&#xA;&#xA;    &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Submit'|t }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then I have a plugin &lt;code&gt;PsychEmailPlugin.php&lt;/code&gt; class file with &#xA;&lt;code&gt;class PsychEmailPlugin extends BasePlugin&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I have a controllers subdirectory with a &lt;code&gt;PsychEmailController.php&lt;/code&gt; file that contains an action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PsychEmailController extends BaseController&#xA;{&#xA;    public function actionPubRequest($emailAddress)&#xA;    {&#xA;        $email = new EmailModel();&#xA;        $email-&amp;gt;fromEmail = $emailAddress;&#xA;        $email-&amp;gt;toEmail = 'myemail@gmail.com';&#xA;        $email-&amp;gt;subject = 'Publication Request';&#xA;        $email-&amp;gt;body    = 'Your requested publication is attached.';&#xA;&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="57" LastEditDate="2017-04-21T20:32:03.743" LastActivityDate="2017-04-21T20:32:03.743" Title="How to reference controller action from hidden action? Correct path?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20129" PostTypeId="2" ParentId="20126" CreationDate="2017-04-21T19:58:18.943" Score="4" Body="&lt;p&gt;I don't think Craft has any other place for viewing old entry versions. You can browse the entire set by examining a table in the database, or write a plugin to display all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quick and Dirty&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just digging into this specific entry, you can pop into the &lt;code&gt;craft_entryversions&lt;/code&gt; table and search for the &lt;code&gt;entryId&lt;/code&gt; matching the one in question. You'll see all versions past and present, each with a bunch of JSON in the &lt;code&gt;data&lt;/code&gt; column with that version's content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you fancy one of those entries and its &lt;code&gt;id&lt;/code&gt; column is &lt;code&gt;346&lt;/code&gt; in the database. As you've already discovered, you can modify the entry's edit URL from...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/admin/entries/projects/1234-gobias-industries-about-page&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...to...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/admin/entries/projects/1234-gobias-industries-about-page/versions/346&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and view it from the Craft control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a bit uncomfortable of course, but you can quickly share a bunch of URLs with your client that'd make it easy to visit and inspect each version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Slower and Cleaner&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise you'd have to whip up a plugin to display additional version details in the control panel, probably linking to each version for further examination. If you're comfortable taking a stab at the plugin, it'd be fairly quick work displaying the results of &lt;a href=&quot;https://craftcms.com/classreference/services/EntryRevisionsService#getVersionsByEntryId-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;entryRevisions-&amp;gt;getVersionsByEntryId()&lt;/code&gt;&lt;/a&gt; however you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Versioneer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just made a quick Field Type plugin for this. It's v0.0.1, but it may be worth checking out!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/workingconcept/versioneer-craft-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/workingconcept/versioneer-craft-plugin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-04-22T02:21:10.363" LastActivityDate="2017-04-22T02:21:10.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20130" PostTypeId="2" ParentId="20128" CreationDate="2017-04-21T20:00:27.523" Score="1" Body="&lt;p&gt;After my changes, this worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;psychEmail/publication/pubRequest&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="57" LastEditDate="2017-04-21T20:30:56.380" LastActivityDate="2017-04-21T20:30:56.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20131" PostTypeId="2" ParentId="20123" CreationDate="2017-04-21T20:05:25.117" Score="6" Body="&lt;p&gt;I haven't done this with Craft, but with another Laravel project I was able to add a package from a private repo as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) In composer.json, after the &lt;code&gt;require&lt;/code&gt; array, add a new &lt;code&gt;repositories&lt;/code&gt; array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: [&#xA;  ...&#xA;],&#xA;&quot;repositories&quot;: [&#xA;  {&#xA;   &quot;type&quot;: &quot;git&quot;,&#xA;    &quot;url&quot;: &quot;https://github.com/YOURGITHUBNAME/your-repo.git&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) In the &quot;require&quot; array, add your package:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: [&#xA;  &quot;YOURGITHUBNAME/your-repo&quot;: &quot;*&quot;,&#xA;  ...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3) Here's the under-documented trick you need to do to get it all working: you must create a &quot;release&quot; in github, and the release name must be the letter &quot;v&quot; followed by the version number (e.g. &lt;code&gt;v1.0.0&lt;/code&gt;). So go to your repo, click the &quot;Releases&quot; link, then click the &quot;Draft a new release&quot; button. It asks for a tag version and a Release title... I can't remember which of these is the critical one, so just put &lt;code&gt;v1.0.0&lt;/code&gt; into both of these fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Now if you run &lt;code&gt;composer install&lt;/code&gt; it should (hopefully) bring in your private repo package. Might need to provide some kind of authorization / API key to access it if it's a private repo (I'm not sure how exactly this works, but should be fairly easy to find documentation on).&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-04-21T20:05:25.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20132" PostTypeId="1" AcceptedAnswerId="20135" CreationDate="2017-04-21T20:43:44.503" Score="1" ViewCount="59" Body="&lt;p&gt;I have a search form where a user can enter width, height and depth and the search results will return any item that will &quot;fit&quot; into those dimensions. It works, but for some reason only if the depth is not set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;search&quot; name=&quot;q&quot; value=&quot;{{ craft.request.getParam('q') }}&quot;&amp;gt;&#xA;&amp;lt;label&amp;gt;Width&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;number&quot; name=&quot;w&quot; value=&quot;{{ searchWidth }}&quot;&amp;gt;&#xA;&amp;lt;label&amp;gt;Height&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;number&quot; name=&quot;h&quot; value=&quot;{{ searchHeight }}&quot;&amp;gt;&#xA;&amp;lt;label&amp;gt;Depth&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input type=&quot;number&quot; name=&quot;d&quot; value=&quot;{{ searchDepth }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting query looks like this &lt;code&gt;search3?q=&amp;amp;w=43&amp;amp;h=44&amp;amp;d=1000&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Results&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;  section: 'products',&#xA;  order: 'postDate desc',&#xA;  limit: 15&#xA;  } %}&#xA;&#xA;{% set searchWidth = craft.request.getParam('w') %}&#xA;{% set searchHeight = craft.request.getParam('h') %}&#xA;{% set searchDepth = craft.request.getParam('d') %}&#xA;&#xA;{% if searchWidth &amp;gt; 0 %}&#xA;  {% set finalWidth = searchWidth + 1 %}&#xA;  {% set queryParams = queryParams | merge({&#xA;    width: '&amp;lt;= ' ~ finalWidth&#xA;    }) %}&#xA;{% endif %}&#xA;&#xA;{% if searchHeight &amp;gt; 0 %}&#xA;  {% set finalHeight = searchHeight + 1 %}&#xA;  {% set queryParams = queryParams | merge({&#xA;    height: '&amp;lt;= ' ~ finalHeight&#xA;    }) %}&#xA;{% endif %}&#xA;&#xA;{% if searchDepth &amp;gt; 0 %}&#xA;  {% set finalDepth = searchDepth + 1 %}&#xA;  {% set queryParams = queryParams | merge({&#xA;    depth: '&amp;lt;= ' ~ finalDepth&#xA;    }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which I merge with my original search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchQ = craft.request.getParam('q') %}&#xA;{% if searchQ is not empty %}&#xA;{% set queryParams = queryParams | merge({&#xA;  search: {&#xA;  query: searchQ,&#xA;  subLeft: true,&#xA;  subRight: true&#xA;   }&#xA; }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works fine. If I enter 44 for &lt;code&gt;h&lt;/code&gt; and 43 for &lt;code&gt;w&lt;/code&gt; it does what it should, if finds all items smaller than the width and height. If I add something in the &lt;code&gt;d&lt;/code&gt;, even 1,000 I get 0 results. If I output &lt;code&gt;{{ finalDepth }}&lt;/code&gt; somewhere in the template it outputs without issue, but it finds 0 results when something is entered in the &lt;code&gt;d&lt;/code&gt; search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All three fields are number fields named width, height and depth. I have checked and rechecked and I am at a loss.&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-04-21T21:22:06.633" LastActivityDate="2017-04-21T22:23:35.273" Title="Trouble with merging Numbers in an Advanced Search" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20133" PostTypeId="1" AcceptedAnswerId="20140" CreationDate="2017-04-21T21:33:55.517" Score="6" ViewCount="2453" Body="&lt;p&gt;I noticed the following new feature in Craft CMS &lt;a href=&quot;https://craftcms.com/changelog#2-6-2973&quot; rel=&quot;noreferrer&quot;&gt;2.6.2973&lt;/a&gt;: &lt;em&gt;Added the “HTML Purifier Config” setting to Rich Text fields&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see any mention or any example of config files in the Craft CMS &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;noreferrer&quot;&gt;docs for Rich Text fields&lt;/a&gt; though, and the only thing I can see in the Rich Text Field settings in the control panel is this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can save custom HTML Purifier configs as .json files in craft/config/htmlpurifier/. &lt;a href=&quot;http://htmlpurifier.org/live/configdoc/plain.html&quot; rel=&quot;noreferrer&quot;&gt;View available settings&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can someone help me with a custom HTML Purifier config .json file that I can use with Craft that would allow me to start using YouTube video embed code like this in Rich Text fields?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/HdYfAmrzVlc&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the moment, the above code will disappear when saving an entry unless I disable the &lt;em&gt;Purify HTML?&lt;/em&gt; option in the Rich Text field settings. Thanks in advance for any help with this.&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2020-06-26T13:03:35.000" Title="HTML Purifier Config File" Tags="&lt;config&gt;&lt;json&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20134" PostTypeId="2" ParentId="20117" CreationDate="2017-04-21T22:12:45.403" Score="2" Body="&lt;p&gt;Even if you're comfortable writing Craft plugins, which can be fun and easy to work with at some point, writing &lt;em&gt;any&lt;/em&gt; software that manages time, the complexity of recurring events, and human expectations can be an endless source of &lt;s&gt;suffering&lt;/s&gt; challenge. Even if you're totally comfortable with both dynamics, you'd be wise to carefully evaluate what Tipping Media and Solspace have built. It sounds like either plugin could be a sensible choice, and if you wind up with requirements that neither solves you might be able to submit a feature request or write your own plugin for the far more limited scope of what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd learn a whole lot and feel hugely accomplished if you spent a few months or years hammering out a great calendar plugin to solve your needs and do precisely what you want. Or you could pay $49-$99, use that time for something else, and appreciate the support you'll get if you ever bump into a problem!&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-04-21T22:19:03.820" LastActivityDate="2017-04-21T22:19:03.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20135" PostTypeId="2" ParentId="20132" CreationDate="2017-04-21T22:23:35.273" Score="2" Body="&lt;p&gt;Rename the field handle to something else, &lt;code&gt;depth&lt;/code&gt; is a deprecated attribute for ElementCriteriaModel.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-04-21T22:23:35.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20136" PostTypeId="1" AcceptedAnswerId="20143" CreationDate="2017-04-22T01:47:05.663" Score="1" ViewCount="121" Body="&lt;p&gt;I have contacted support and looked in the usual places, it's the weekend so might not be till Monday that I hear back from support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue is that I cannot seem to get the URL right when displaying a summary of events page. I am using {{ event.url }}. I want it to go to &lt;a href=&quot;http://domain.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/&lt;/a&gt;&lt;strong&gt;events&lt;/strong&gt;/name-of-event/2017-04-27 but instead it is &lt;a href=&quot;http://domain.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/&lt;/a&gt;&lt;strong&gt;event&lt;/strong&gt;/name-of-event/2017-04-27.  How can I get it to be /events/ not /event/?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone uses Venti and knows why this is please let me know.  I am going to keep on digging in the meantime. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-22T16:12:00.733" Title="Venti Calendar URL" Tags="&lt;events&gt;&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20137" PostTypeId="1" AcceptedAnswerId="20138" CreationDate="2017-04-22T02:33:45.933" Score="2" ViewCount="362" Body="&lt;p&gt;I have a form and a hidden action that successfully runs the controller action.  I now want to include 2 variables (form input values) and then use those values while I am in the controller action.  How do I grab the value (theemailaddress) that was in the form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig template file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;psychEmail/publication/pubRequest&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;theemailaddress&quot; value=&quot;&quot; size=&quot;100&quot;&amp;gt;&#xA;&#xA;        &amp;lt;!-- ...--&amp;gt;&#xA;&#xA;        &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Submit'|t }}&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;function IN controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPubRequest()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $email = new EmailModel();&#xA;    $email-&amp;gt;fromEmail = 'email@school.edu';&#xA;    $email-&amp;gt;toEmail = 'myemail@gmail.com';&#xA;    $email-&amp;gt;subject = 'Publication Request';&#xA;    $email-&amp;gt;body    = 'Your requested publication is attached.';&#xA;&#xA;    craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1006" LastEditorUserId="57" LastEditDate="2017-04-22T04:10:35.380" LastActivityDate="2017-04-22T04:10:35.380" Title="How to reference Twig form values from within controller action?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20138" PostTypeId="2" ParentId="20137" CreationDate="2017-04-22T04:09:57.233" Score="1" Body="&lt;p&gt;You can use &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getPost-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;getPost('name')&lt;/code&gt;&lt;/a&gt; to grab any posted values from your form submission.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-22T04:09:57.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20139" PostTypeId="2" ParentId="20127" CreationDate="2017-04-22T04:13:13.930" Score="1" Body="&lt;p&gt;I can't think of a non-terribly hacky way to pull this off in the current version of Craft, unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to consider adding a thumbs-up/comment to this feature request that would allow for what you're looking for: &lt;a href=&quot;https://github.com/craftcms/cms/issues/947&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/947&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-22T04:13:13.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20140" PostTypeId="2" ParentId="20133" CreationDate="2017-04-22T04:43:53.863" Score="9" Body="&lt;p&gt;Something like this in a &lt;code&gt;.json&lt;/code&gt; file should work:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &amp;quot;HTML.SafeIframe&amp;quot;: true,&#xA;  &amp;quot;URI.SafeIframeRegexp&amp;quot;: &amp;quot;%^(https?:)?//(www\\.youtube(?:-nocookie)?\\.com/embed/)%&amp;quot;,&#xA;  &amp;quot;Attr.AllowedFrameTargets&amp;quot;: [&amp;quot;_blank&amp;quot;],&#xA;  &amp;quot;HTML.AllowedComments&amp;quot;: [&amp;quot;pagebreak&amp;quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that the first two lines were adapted from &lt;a href=&quot;https://stackoverflow.com/a/12784081/684&quot;&gt;https://stackoverflow.com/a/12784081/684&lt;/a&gt; and the last two are the default options that Craft uses if no custom config is set.&lt;/p&gt;&#xA;&lt;p&gt;Probably also worth giving this a read: &lt;a href=&quot;http://htmlpurifier.org/docs/enduser-youtube.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://htmlpurifier.org/docs/enduser-youtube.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2020-06-26T13:03:35.000" LastActivityDate="2020-06-26T13:03:35.000" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="20142" PostTypeId="1" CreationDate="2017-04-22T13:42:16.310" Score="4" ViewCount="815" Body="&lt;p&gt;The below refers to Craft 3 and the Element API plugin for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to do something when the Element API plugin fires its &lt;code&gt;onBeforeSendData&lt;/code&gt; event, I can see in the controller for element there is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;trigger(self::EVENT_BEFORE_SEND_DATA, new DataEvent([&#xA;    'data' =&amp;gt; $data,&#xA;]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And based on Craft 3 docs and Yii 2 docs I think I would use the following in my plugins init function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(ElementController::class, ElementController::EVENT_BEFORE_SEND_DATA, function(DataEvent $event) {&#xA;    var_dump($event-&amp;gt;data);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would have expected that to return a &lt;code&gt;League\Fractal\Scope&lt;/code&gt; object but instead I am just getting &lt;code&gt;null&lt;/code&gt;. Have I implemented this correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly while trying to work out where I went wrong, if I modify the Element API DefaultController class and change the &lt;code&gt;data&lt;/code&gt; property in the trigger to &lt;code&gt;eventData&lt;/code&gt; and add the new public property to the &lt;code&gt;DataEvent&lt;/code&gt; class then it all works and I am able to see the data in my plugin.&lt;/p&gt;&#xA;" OwnerUserId="5606" LastEditorUserId="1016" LastEditDate="2017-04-22T14:39:14.643" LastActivityDate="2017-04-22T14:39:14.643" Title="How to handle Craft 3 events in a plugin? Element API is returning null data" Tags="&lt;plugin-elementapi&gt;&lt;events&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20143" PostTypeId="2" ParentId="20136" CreationDate="2017-04-22T16:12:00.733" Score="2" Body="&lt;p&gt;After speaking with support, it's hardwired that way to have /event so I changed my structure to event, not the end of the world.  I do want to say I am actively evaluating this plugin and support was emailing me back and forth on Friday night.  So I appreciated their after hours response.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-22T16:12:00.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20144" PostTypeId="1" AcceptedAnswerId="20145" CreationDate="2017-04-22T18:02:19.223" Score="0" ViewCount="221" Body="&lt;p&gt;I've added a field called &lt;strong&gt;icons&lt;/strong&gt; of type &lt;a href=&quot;https://github.com/fyrebase/svg-icons&quot; rel=&quot;nofollow noreferrer&quot;&gt;svg-icons&lt;/a&gt; and am able to select icons I've added without an issue. I am having trouble outputting them on the front end however. I get twig errors no matter what I try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have done &lt;code&gt;{{ dump(entry.icons) }}&lt;/code&gt; and get the following output where you can see 11 lines from the bottom the path and name of the select svg icon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I output that to the template?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D:\path\to\craft\app\vendor\twig\twig\lib\Twig\Extension\Debug.php:56:&#xA;object(Craft\SvgIconsModel)[700]&#xA;  protected 'classSuffix' =&amp;gt; string 'Model' (length=5)&#xA;  protected 'strictAttributes' =&amp;gt; boolean true&#xA;  private '_classHandle' (Craft\BaseModel) =&amp;gt; null&#xA;  private '_attributeConfigs' (Craft\BaseModel) =&amp;gt; &#xA;    array (size=6)&#xA;      'icon' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'sprite' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'type' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'resource' =&amp;gt; &#xA;        array (size=2)&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'string' (length=6)&#xA;      'width' =&amp;gt; &#xA;        array (size=9)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; float -2147483648&#xA;          'max' =&amp;gt; float 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 11&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;      'height' =&amp;gt; &#xA;        array (size=9)&#xA;          'maxLength' =&amp;gt; int 11&#xA;          'min' =&amp;gt; float -2147483648&#xA;          'max' =&amp;gt; float 2147483647&#xA;          'decimals' =&amp;gt; int 0&#xA;          'default' =&amp;gt; null&#xA;          'type' =&amp;gt; string 'number' (length=6)&#xA;          'unsigned' =&amp;gt; boolean false&#xA;          'length' =&amp;gt; int 11&#xA;          'column' =&amp;gt; string 'integer' (length=7)&#xA;  private '_attributes' (Craft\BaseModel) =&amp;gt; &#xA;    array (size=3)&#xA;      'icon' =&amp;gt; string 'general\design.svg' (length=18)&#xA;      'width' =&amp;gt; float 512&#xA;      'height' =&amp;gt; float 512&#xA;  private '_extraAttributeNames' (Craft\BaseModel) =&amp;gt; null&#xA;  private '_errors' (CModel) =&amp;gt; &#xA;    array (size=0)&#xA;      empty&#xA;  private '_validators' (CModel) =&amp;gt; null&#xA;  private '_scenario' (CModel) =&amp;gt; string '' (length=0)&#xA;  private '_e' (CComponent) =&amp;gt; null&#xA;  private '_m' (CComponent) =&amp;gt; null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-04-22T23:39:09.200" Title="svgicons fieldtype - how to output in template?" Tags="&lt;templating&gt;&lt;error&gt;&lt;svg&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20145" PostTypeId="2" ParentId="20144" CreationDate="2017-04-22T23:39:09.200" Score="1" Body="&lt;p&gt;Never used the plugin before, but from glancing at their docs, it looks like &lt;code&gt;entry.icons.icon&lt;/code&gt; is what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other properties on their &lt;a href=&quot;https://github.com/fyrebase/svg-icons#svgiconsmodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;SvgIconsModel&lt;/a&gt; should work as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-22T23:39:09.200" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20146" PostTypeId="1" CreationDate="2017-04-23T12:33:53.290" Score="2" ViewCount="42" Body="&lt;p&gt;does anyone know what I am doing wrong here? I am trying to create profile pages for each user, but when I click the submit button, it doesn't take me to the user's page.              &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;get&quot; accept-charset=&quot;UTF-8&quot; class=&quot;form&quot;    action=&quot;/profile/{{ user }}&quot;&amp;gt; &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;&#xA;&amp;lt;input id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot; placeholder=&quot;username&quot;&#xA;    value=&quot;{{ craft.session.rememberedUsername }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;secret password&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Login&quot; class=&quot;login_enter&quot;&amp;gt;&#xA;&#xA;&amp;lt;label class=&quot;remember&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;rememberMe&quot; value=&quot;1&quot; checked&amp;gt;&#xA;    Remember me&#xA;&amp;lt;/label&amp;gt;&#xA;&#xA;&#xA;{% if errorMessage is defined %}&#xA;    &amp;lt;p class=&quot;remember&quot;&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a profile folder and an _profile template. I also added a custom route in the admin panel with the following URI&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    profile/*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a link to the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    profile/_profile&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The profile index file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users %}&#xA;{% for user in users %}&#xA;&amp;lt;a href=&quot;/profile/{{ user }}&quot;&amp;gt;{{ user }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the _profile file looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_account_register_layout&quot; %}&#xA;{% set title = &quot;account&quot; %}&#xA;{% set user = craft.users.username( craft.request.segment(2) ).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user6630" LastEditorDisplayName="user6630" LastEditDate="2017-04-23T12:45:12.903" LastActivityDate="2017-04-23T15:18:09.817" Title="Why are my profile pages not generating which I click on 'submit'?" Tags="&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20147" PostTypeId="2" ParentId="20146" CreationDate="2017-04-23T14:51:59.183" Score="2" Body="&lt;p&gt;Try setting the action and redirect as hidden inputs, see below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/profile/{{ currentUser.username }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-23T14:51:59.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20149" PostTypeId="2" ParentId="20119" CreationDate="2017-04-23T15:25:40.940" Score="1" Body="&lt;p&gt;You can refer to this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11969/how-can-i-copy-an-entry&quot;&gt;How can I copy an entry?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newEntry-&amp;gt;enabled = $oldEntry-&amp;gt;enabled;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newEntry-&amp;gt;enabled = false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To start out building your own plugin: &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;, be sure to select the Services lightswitch.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-23T15:25:40.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20152" PostTypeId="1" AcceptedAnswerId="20179" CreationDate="2017-04-24T09:08:58.123" Score="1" ViewCount="67" Body="&lt;p&gt;I'm getting this error when I try create a new list: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'userSlug' doesn't have a default value. The SQL statement executed was: INSERT INTO `craft_shortlist_list` (`default`, `public`, `type`, `ownerType`, `uid`, `ownerId`, `id`, `dateUpdated`, `dateCreated`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8). Bound with :yp0=0, :yp1=1, :yp2='manual', :yp3='member', :yp4='8fb7840a-a399-4eb3-bdf7-c59cb656bbff', :yp5='1', :yp6=1698, :yp7='2017-04-24 09:11:47', :yp8='2017-04-24 09:11:47'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6185" LastEditorUserId="57" LastEditDate="2017-04-24T23:12:24.810" LastActivityDate="2017-04-25T09:36:10.523" Title="Shortlist plugin error when creating a new list" Tags="&lt;plugin-shortlist&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20153" PostTypeId="2" ParentId="19617" CreationDate="2017-04-24T10:02:15.010" Score="2" Body="&lt;p&gt;Just use a variable that has the same keys as the entry model will have.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = [{title: 'hello', ...}, {title: 'hello2', ...}] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {# stuff #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, when you want to move to using the database, just switch what  &lt;code&gt;entries&lt;/code&gt; is set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('service') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way the template will still look exactly the same.&lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2017-04-24T10:02:15.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20154" PostTypeId="2" ParentId="19780" CreationDate="2017-04-24T10:51:21.420" Score="1" Body="&lt;p&gt;Developer of &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you could be running an older version of the Charge.  There was a &lt;em&gt;display&lt;/em&gt; bug on the overview page that would set the currency symbol incorrectly for some setups. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is fixed in the latest versions, so make sure you're running 2.2.0 or above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - this fix won't affect any previously recorded payments that were in a non-default currency, but this is purely a display bug on the &lt;em&gt;overview&lt;/em&gt; page - if you go into the detail view for the specific Charges, they'll be correctly showing the relevant currency, and all the details visible to the end-customers and on Stripe will also be correct. &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2017-04-24T10:51:21.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20155" PostTypeId="1" CreationDate="2017-04-24T10:57:27.623" Score="1" ViewCount="417" Body="&lt;p&gt;What are the options for creating advanced product options with pricing.&#xA;I see there are way to create variants ok - but can this be linked to advanced pricing, e.g. for printing products.&#xA;the abaility to select different sizes, material, finish etc all which affect the price and then the quantity which also affects the price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar options which you can see here - &lt;a href=&quot;https://www.gogetprint.com/business-cards&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.gogetprint.com/business-cards&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-04-24T23:35:31.850" Title="Craft Commerce - Advanced Product Options &amp; Pricing" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;products&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20156" PostTypeId="2" ParentId="19687" CreationDate="2017-04-24T11:38:53.960" Score="1" Body="&lt;p&gt;Isn't &lt;code&gt;news/test-article&lt;/code&gt; just an example of &lt;code&gt;news/{slug}&lt;/code&gt;? And is this for a plugin (hence the PHP) or a template (hence the templating tag for your question)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps what you want to do is start by grabbing the slug from the URL and getting the entry you're after:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').slug(craft.request.lastSegment).first %}&#xA;// output&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use that to display the first entry, then get the rest of the news entries but filter out the active:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set otherEntries = craft.entries.section('news').id('not ' ~ entry.id) %}&#xA;{% for otherEntry in otherEntries %}&#xA;    // output&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-04-24T11:38:53.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20157" PostTypeId="1" CreationDate="2017-04-24T12:15:20.050" Score="2" ViewCount="96" Body="&lt;p&gt;I am trying to load user profile pictures (the Craft ones), but they don't load. The &lt;code&gt;getPhotoUrl()&lt;/code&gt; seems to point to the wrong folder(?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The profile images seem to be stored in the userprofiles folder by default&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users %}&#xA;&#xA;{% for user in users %}&#xA;    &amp;lt;div class=&quot;searchresults&quot;&amp;gt;&amp;lt;a href=&quot;/profile/{{ user }}&quot;&amp;gt;{{ user }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% if user.getPhotoUrl %}&#xA;        &amp;lt;img src=&quot;{{ user.getPhotoUrl(64) }}&quot; class=&quot;profile_search_picture&quot; alt=&quot;{{ entry.user.getFullName }}&quot;/&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;img src=&quot;/img/fallback.png&quot; class=&quot;profile_search_picture&quot; alt=&quot;{{ entry.user.getFullName }}&quot;/&amp;gt; &#xA;    {% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/assets/sources/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/assets/tempuploads/field_3/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/assets/tempuploads/field_4/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/assets/tempuploads/user_1/field_3/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/assets/tempuploads/user_1/field_4/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/temp/uploads/userphotos/harry/, but could not.&#xA;  2017/04/24 11:24:10 [error] [application] Tried to read the folder contents of /Applications/MAMP/htdocs/craft/storage/runtime/temp/uploads/userphotos/remco/, but could not.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;the console gives this error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;GET http://localhost/cpresources/userphotos/remco/64/17492405_10212330524487585_7776812525773615973_o.jpg?x=UoEZXg1dH net::ERR_CONNECTION_REFUSED&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6631" LastEditorUserId="57" LastEditDate="2017-04-24T23:43:39.960" LastActivityDate="2017-04-25T13:16:45.913" Title="Why does {{ user.getPhotoUrl(64) }} point towards storage/runtime and not to storage/userprofiles?" Tags="&lt;redirect&gt;&lt;user-profile&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20158" PostTypeId="1" AcceptedAnswerId="20186" CreationDate="2017-04-24T13:11:46.533" Score="1" ViewCount="216" Body="&lt;p&gt;I'm trying to figure what would be the simplest way to do such filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to make it in that way that selecting one of &quot;Specialities&quot; category would limit results from the selected &quot;Plant&quot; category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I want a selection of the second category to be optional, so everyone can browse live and dried i.e. Mint plants or only herbs from all plants if they want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would like to implement shipping to/from drop-downs with the same functionality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expected result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c6UKR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c6UKR.jpg&quot; alt=&quot;![enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I start? Any help would be greatly appreciated :-) Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="22" LastEditDate="2017-05-09T19:30:37.503" LastActivityDate="2017-05-09T19:30:37.503" Title="Simple category-entry search filter" Tags="&lt;entries&gt;&lt;categories&gt;&lt;frontend&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20159" PostTypeId="1" AcceptedAnswerId="20166" CreationDate="2017-04-24T13:39:09.177" Score="1" ViewCount="224" Body="&lt;p&gt;We are looking to use Craft CMS for an upcoming web project, are there any documented architectures or topologies for deploying into a production setup. This would be for high availablity across multiple regions including both front end assets and databases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are likely to consider AWS or Azure for hosting. If there is nothing specific about Craft architectures then would a standard PHP site topology be appropriate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luke &lt;/p&gt;&#xA;" OwnerDisplayName="user6612" LastActivityDate="2017-04-24T23:23:16.920" Title="Recommended High Availablity Architecture" Tags="&lt;deployment&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20160" PostTypeId="1" AcceptedAnswerId="20168" CreationDate="2017-04-24T14:19:29.667" Score="1" ViewCount="204" Body="&lt;p&gt;I have external library handling connection to mail delivery system. Its just php class. How do i include and use this class inside craft plugin controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;library.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class mail_delivery{&#xA;    //code&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;plugin/controllers/controller.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class controller extends BaseController&#xA;{&#xA;&#xA;    public function init()&#xA;    {&#xA;        require_once 'library.php';&#xA;    }&#xA;&#xA;    public function method(){&#xA;        $object = $rest = new mail_delivery();&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get PHP error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;( ! ) Fatal error: Class 'Craft\FmRestAPI' not found in&#xA;  C:\xampp\htdocs\mmimport\craft\plugins\freshmailintegration\controllers\FreshmailIntegration_EmailController.php&#xA;  on line 27&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this some kind of namespace issue?&lt;/p&gt;&#xA;" OwnerUserId="6620" LastEditorUserId="57" LastEditDate="2017-04-24T23:36:03.460" LastActivityDate="2017-04-24T23:36:03.460" Title="External liblary class inside plugin controller" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20161" PostTypeId="2" ParentId="20155" CreationDate="2017-04-24T14:49:13.777" Score="1" Body="&lt;p&gt;I can't see this being a problem. All variants can have their own pricing. You can also use relations to mix and match different things if you'd like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;https://imagescience.com.au/services/fine-art-printing/order-fine-art-printing&quot; rel=&quot;nofollow noreferrer&quot;&gt;fine art printing section&lt;/a&gt; on the Image Science web site that may be an example of what you are thinking. There is a full write up of what it took to create the web site here: &lt;a href=&quot;https://imagescience.com.au/blog/the-epic-journey-to-the-new-image-science-website&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Epic Journey to the New Image Science Website&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-04-24T14:49:13.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20162" PostTypeId="1" AcceptedAnswerId="20169" CreationDate="2017-04-24T14:53:07.973" Score="1" ViewCount="418" Body="&lt;p&gt;I'm creating a FieldType plugin, but I need the entry's ID in the front-end, I suppose I can get it within the controller, something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft()-&gt;entryId&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryId = IN HERE;&#xA;&#xA;$options = array(&#xA;    'coreUrl' =&amp;gt; getenv('ENV_CORE_HOST'),&#xA;    'newEntry' =&amp;gt; false,&#xA;    'entryId' =&amp;gt; $entryId&#xA;);&#xA;&#xA;craft()-&amp;gt;templates-&amp;gt;includeJs(&quot;$('#{$namespacedId}-field').whatever('&quot; . json_encode($options) . &quot;');&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get the ID in the URL with Regex and stuff, but I wouldn't like to rely on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And suggestion? &lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2017-04-24T23:40:26.560" Title="Get entry ID within plugin controller" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20163" PostTypeId="1" CreationDate="2017-04-24T15:15:17.987" Score="2" ViewCount="315" Body="&lt;p&gt;Hope somebody can help us with this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Objective: loop through a given Entry's &quot;Related Entries&quot; entry field and output the results - but group the results by the category to which they belong - not just a straight splurge of related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where we are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;&amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;{# spit out the Category #}&#xA;&#xA;{% for relatedEntry in entry.relatedEntries %}&#xA;    {{ relatedEntry.title }}{# this spits out all entries, but ignores whether the entry is related to the current category #}&#xA;&#xA;    {# So, try and check if it's related to the current category... #}&#xA;    {% if relatedEntry.relatedTo(category) %}{# Trying to use this throws &quot;Craft\EntryModel and its behaviors do not have a method or closure named &quot;relatedTo&quot;.&quot; #}&#xA;        &amp;lt;p&amp;gt;{{ relatedEntry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5639" LastActivityDate="2017-04-24T21:56:25.983" Title="loop through an entry's &quot;related entries&quot;, grouped by category" Tags="&lt;entries&gt;&lt;category&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20164" PostTypeId="1" AcceptedAnswerId="20254" CreationDate="2017-04-24T15:35:40.737" Score="2" ViewCount="260" Body="&lt;p&gt;Craft 2.6.2963&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a password reset form on the front end which works correctly sending the email. However it doesn't redirect on submit, unless you are loggedin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;redirect works if logged in, but if I'm logged in I wouldn't be resetting my password. How to get the redirect working correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my entire form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/sendPasswordResetEmail&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/password-reset-notice&quot;&amp;gt;&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;loginName&quot;&amp;gt;Username or email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;    &amp;lt;li class=&quot;form__form-group form-group&quot;&amp;gt;&#xA;        &amp;lt;label class=&quot;form__label&quot; for=&quot;email&quot;&amp;gt;Email Address&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input class=&quot;form__field form-control&quot; type=&quot;text&quot; name=&quot;loginName&quot; id=&quot;loginName&quot; placeholder=&quot;Email Address&quot; value=&quot;{% if loginName is defined %}{{ loginName }}{% else %}{{ craft.session.rememberedUsername }}{% endif %}&quot;/&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;    {% if errors is defined %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;li class=&quot;form__form-group form-group&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;comment&quot; tabindex=&quot;-1&quot; class=&quot;form__field form__field--comment&quot; /&amp;gt;&#xA;        &amp;lt;button class=&quot;form__submit button button--lg&quot; type=&quot;submit&quot;&amp;gt;Submit ›&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-04-28T14:31:32.870" Title="Redirect on front end Password Redirect not working" Tags="&lt;form&gt;&lt;redirect&gt;&lt;password&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20165" PostTypeId="2" ParentId="20163" CreationDate="2017-04-24T16:08:56.657" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;    &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;{# spit out the Category #}&#xA;&#xA;    {% set entries = craft.entries.section('news').relatedTo(category) %}&#xA;    {% for relatedEntry in entries %}&#xA;        {{ relatedEntry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the set entries = ... line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am retrieving the entries that are related to each category as it loops thru each category.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="3618" LastEditDate="2017-04-24T21:56:25.983" LastActivityDate="2017-04-24T21:56:25.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20166" PostTypeId="2" ParentId="20159" CreationDate="2017-04-24T23:23:16.920" Score="0" Body="&lt;p&gt;There's nothing particularly necessary for Craft here, other than what would be needed for a standard PHP application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-ha-tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-ha-tutorial.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And some potentially useful Craft related information around this topic here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4719/load-balancing-nodes-configuration-3-craft-nodes-behind-f5-big-ip&quot;&gt;Load balancing nodes configuration (3 Craft nodes behind F5 Big-IP)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12276/craft-admin-login-infinite-redirect-in-cluster&quot;&gt;Craft admin login infinite redirect in cluster&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-24T23:23:16.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20167" PostTypeId="2" ParentId="20155" CreationDate="2017-04-24T23:35:31.850" Score="1" Body="&lt;p&gt;As Wonko said above, our &lt;a href=&quot;https://imagescience.com.au/services/fine-art-printing/order-fine-art-printing&quot; rel=&quot;nofollow noreferrer&quot;&gt;fine art printing&lt;/a&gt; section (actually all our service sections) - are examples of the sort of thing you can do.  The article mentioned is more of a Monkey Magic like epic quest to peace and redemption that an How-To though ;) !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems quite complicated but usually if you break it down you will find a lot of the data in forms like that is endlessly repeated stuff - so storing that in channels and bringing it in through relations is Craft bread and butter stuff really.  This makes building out your variants much quicker and less error prone as you're keeping the data DRY.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, this is how it is done:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We created a channel full of the various repeated options&lt;/li&gt;&#xA;&lt;li&gt;We relate these to variants using entries fields&lt;/li&gt;&#xA;&lt;li&gt;In some cases we use multiple entries fields, this will depend on how the services are structured of course&lt;/li&gt;&#xA;&lt;li&gt;Combined, this ends up creating a unique variant that is one of the available chose options&lt;/li&gt;&#xA;&lt;li&gt;Each variant also has it's own field for things like 'available for sale' 'visibility' 'note' 'show discount' 'standard price' 'rrp' etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, from those variants, we build the form.  We do this by grabbing all the appropriate variant data into an array, then json encode that, and that is then grabbed by a React form builder we wrote, which unpacks that data and builds the actual form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each line on the form represents the adding of one lineItem, so each line is actually added to the cart using &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiAdd&lt;/a&gt; - all that stuff boils back down to a chosen particular variant id and qty in the end!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course each one of these is really a unique thing, so will need a unique approach, but that's one way of doing a more complex form like that.  It's certainly possible, and easier than it looks once you get going. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(An alternate approach could be to use &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;MultiAdd&lt;/a&gt; to just build a form where all the little addons are added as extra costs to the main product, but that probably has its limits for more complex scenarios like the example you link to).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-24T23:35:31.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20168" PostTypeId="2" ParentId="20160" CreationDate="2017-04-24T23:35:36.197" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this some kind of namespace issue?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.  If the class you're trying to instantiate is in a namespace, you'd need to indicate that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$object = $rest = new \the\library\class\namespace\mail_delivery();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it does not use namespaces, it's probably in the global namespace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$object = $rest = new \mail_delivery();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do it like in your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$object = $rest = new mail_delivery();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then PHP will assuming it's in the current file's namespace (Craft) and you'll get the error that you see.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-24T23:35:36.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20169" PostTypeId="2" ParentId="20162" CreationDate="2017-04-24T23:40:26.560" Score="1" Body="&lt;p&gt;A field in Craft can belong to any element (entry, tag, category, user, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get the ID of the element the field may or may not be currently attached to, you can do this from your Field Type class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$elementId = isset($this-&amp;gt;element) ? $this-&amp;gt;element-&amp;gt;id : null;&#xA;&#xA;if ($elementId)&#xA;{&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-24T23:40:26.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20170" PostTypeId="2" ParentId="20152" CreationDate="2017-04-24T23:42:22.150" Score="1" Body="&lt;p&gt;I think you're using an older version of the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That bug was definitely fixed in the current version - which is actually 1.0.4 - although oddly that is not available as a 'public release' it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd contact Joel and get him to update his version page! &lt;a href=&quot;http://squarebit.co.uk/contact&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://squarebit.co.uk/contact&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-24T23:42:22.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20171" PostTypeId="2" ParentId="20157" CreationDate="2017-04-24T23:50:32.833" Score="1" Body="&lt;p&gt;I don't think the &lt;code&gt;/Applications/MAMP/htdocs/craft/storage/runtime/assets/sources/&lt;/code&gt; log entries are related to the request when &lt;code&gt;getResourceUrl()&lt;/code&gt; is called.  Of if they are, they are elsewhere in the request and not as a direct result of calling &lt;code&gt;getResourceUrl&lt;/code&gt;()`.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error in the console seems like the one to investigate.  Based on &lt;code&gt;net::ERR_CONNECTION_REFUSED&lt;/code&gt;, I'd check to make sure that &lt;code&gt;craft/storage&lt;/code&gt; is recursively writable by PHP as a starting point.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-24T23:50:32.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20172" PostTypeId="1" AcceptedAnswerId="20173" CreationDate="2017-04-25T02:24:42.093" Score="1" ViewCount="42" Body="&lt;p&gt;I'm constructing a plug-in and I'm new to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to print to the screen in my template the name of the developer, by accessing the &lt;code&gt;getDeveloper()&lt;/code&gt; method in my &lt;code&gt;Plugin.php&lt;/code&gt;. The problem is instead of showing the name of the developer, it throws an error saying &lt;code&gt;Class Craft\CrmPortalVariable&lt;/code&gt; not found.&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:28:34.537" LastActivityDate="2017-05-09T19:28:34.537" Title="How to make plugin developer name available in templates?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20173" PostTypeId="2" ParentId="20172" CreationDate="2017-04-25T05:10:32.287" Score="4" Body="&lt;p&gt;Data in plugins is not automatically made available to twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make something available, you need to create a folder in your plugin master folder called &lt;code&gt;variables&lt;/code&gt; and in that folder create a class &lt;code&gt;PluginNameVariable.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of what you might put in that file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class YourPluginNameVariable&#xA;{&#xA;&#xA;    public function developerName()&#xA;    {&#xA;        return craft()-&amp;gt;yourPluginsName-&amp;gt;someServiceMethodThatReturnsTheDeveloperName();&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would make a template variable available in your templates via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.yourPluginName.developerName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are the Craft Docs for this - &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/variables&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-25T05:10:32.287" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20174" PostTypeId="1" AcceptedAnswerId="20192" CreationDate="2017-04-25T08:02:40.250" Score="0" ViewCount="133" Body="&lt;p&gt;I want to get the developer name from Plugin.php using the getDeveloper() method so I created a function devName() in Variable.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function devName() {&#xA;    return craft()-&amp;gt;crmPortal-&amp;gt;getDeveloper();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when i want it to print it in my template, using this &lt;code&gt;{{craft.crmPortal.devName}}&lt;/code&gt; I'm having this Error. Property &quot;Craft\WebApp.crmPortal&quot; is not defined.&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="45" LastEditDate="2017-04-25T15:56:17.210" LastActivityDate="2017-04-26T00:09:48.233" Title="Plugin Variable.php Problem" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20175" PostTypeId="1" CreationDate="2017-04-25T08:47:43.300" Score="1" ViewCount="223" Body="&lt;p&gt;Is it possible to change the store currency from a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about &lt;code&gt;COMMERCE_PAYMENT_CURRENCY&lt;/code&gt;, but I'm not sure how to set that one early enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also seems like it doesn't affect the displayed price. Do I need to use the &lt;code&gt;commerceCurrency&lt;/code&gt; in combination with the &lt;code&gt;cart.paymentCurrency&lt;/code&gt; everywhere I display a price?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-05-01T16:24:17.433" Title="Changing store currency from a plugin" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20176" PostTypeId="2" ParentId="20175" CreationDate="2017-04-25T09:13:49.673" Score="1" Body="&lt;p&gt;In your plugin have you tried updating the currency and paymentCurrency fields in the craft_commerce_orders database table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on when you want to set the currency and how you are determining it, you could either do this by a direct database query, or modify the values in the order model before it is saved using this hook: &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-04-25T09:13:49.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20177" PostTypeId="1" AcceptedAnswerId="20196" CreationDate="2017-04-25T09:29:35.500" Score="3" ViewCount="435" Body="&lt;p&gt;How would I add more information (custom fields) to a variant's snapshot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The custom field I'm adding will change over time, but I need it to stay consistent on invoices etc. &lt;/p&gt;&#xA;" OwnerUserId="6317" LastActivityDate="2021-01-06T12:36:42.333" Title="Add custom fields to variant snapshot" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20179" PostTypeId="2" ParentId="20152" CreationDate="2017-04-25T09:36:10.523" Score="1" Body="&lt;p&gt;I changed the 'userSlug' field in 'shortlist_list' table to allow null and it seems to be working fine now. &lt;/p&gt;&#xA;" OwnerUserId="6185" LastActivityDate="2017-04-25T09:36:10.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20181" PostTypeId="1" AcceptedAnswerId="20185" CreationDate="2017-04-25T10:04:01.803" Score="2" ViewCount="651" Body="&lt;p&gt;I'm confused about what to pass as a parameter in the descendantOf() function.&#xA;I'm developing a website and passing an entry ID as a string (I also tested it as an integer) and everything went fine, untill now. Suddenly, when I try to use it with new template code, that doesn't work anymore. It does however still work in my template I wrote last week.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#descendantOf&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs say&lt;/a&gt; that the parameter has to be an EntryModel:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;descendantOf #&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Only fetch categories that are a descendant of a given category.&#xA;  Accepts a CategoryModel object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1298/how-can-i-get-the-count-of-entries-in-a-structure&quot;&gt;this thread&lt;/a&gt; on SE, someone says it can be an Entry ID.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;descendantOf accepts either an EntryModel object or an entry’s ID.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, if I use the next code (category is not a category group, I'm using a structure for it) where &lt;code&gt;currentRegionId&lt;/code&gt; is an entryId as a string or integer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productCategory in product.productCategory.descendantOf(currentRegionId).order(&quot;title asc&quot;).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works. But according to the docs, it shouldn't work, because I'm passing an ID and not an EntryModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also works when I pass that ID while using eager loading:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainCategories = craft.entries({&#xA;    section:            'productCategories',&#xA;    level:              2,&#xA;    descendantOf:       currentRegionId,&#xA;    limit:              null,&#xA;    with:               ['productCategoryIcon']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I try the next piece of code in another template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.applyToCategories if category.descendantOf(currentRegionId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to Craft\BaseElementModel::isDescendantOf() must be&#xA;  an instance of Craft\BaseElementModel, integer given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I pass an EntryModel it does work as expected and according with the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.applyToCategories if category.descendantOf(craft.entries.id(currentRegionId).first()) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what's going on? Is it something with the way I fetch my entries?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-04-25T14:07:52.903" Title="descendantOf() parameter, entryModel or ID?" Tags="&lt;entries&gt;&lt;structure&gt;&lt;descendantof&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20183" PostTypeId="2" ParentId="20157" CreationDate="2017-04-25T13:16:45.913" Score="1" Body="&lt;p&gt;@cole sorted it! I am hosting craft locally and my localhost used the port number as part of it's URL. I switched the ports to &lt;code&gt;80/81/3306&lt;/code&gt; which took the &lt;code&gt;8888&lt;/code&gt; port out of the url and also loaded all images.&lt;/p&gt;&#xA;" OwnerUserId="6631" LastActivityDate="2017-04-25T13:16:45.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20184" PostTypeId="2" ParentId="1359" CreationDate="2017-04-25T13:56:29.693" Score="1" Body="&lt;p&gt;You may also want to register your route in your YourPlugin.php file, using the registerSiteRoutes method, example below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'myroute' =&amp;gt; array('action' =&amp;gt; 'myPlugin/myAction')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-25T13:56:29.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20185" PostTypeId="2" ParentId="20181" CreationDate="2017-04-25T14:07:52.903" Score="2" Body="&lt;p&gt;These are two different things.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = myEntryModel.myEntriesField.descendantOf(var) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case the Entries field returns an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; object and you are setting the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#descendantOf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;descendantOf&lt;/code&gt;&lt;/a&gt; parameter, which does in fact accept &lt;code&gt;EntryModel&lt;/code&gt; objects or an Entry ID as an integer value. The Craft documentation is incomplete in this regard.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bool = myEntryModel.isDescendantOf(var) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you are using the method &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#isDescendantOf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;isDescendantOf&lt;/code&gt;&lt;/a&gt; that is available for an &lt;code&gt;EntryModel&lt;/code&gt; and returns whether the entry is a descendant of another entry. This method apparently only accepts an &lt;code&gt;EntryModel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-04-25T14:07:52.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20186" PostTypeId="2" ParentId="20158" CreationDate="2017-04-25T14:09:45.867" Score="2" Body="&lt;p&gt;This article was helpful getting us started when we tackled an advanced search. Though their example uses dropdowns, you'll probably want to use checkboxes for your &quot;Herbs&quot; and &quot;Live Plants&quot; categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Combined searches and filters&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-04-25T14:09:45.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20187" PostTypeId="2" ParentId="11307" CreationDate="2017-04-25T14:25:39.997" Score="1" Body="&lt;p&gt;I was struggling with the same issue. Using your code I was able to get the select box to update by removing the &lt;code&gt;[]&lt;/code&gt; at the end of your &lt;code&gt;select&lt;/code&gt; &lt;code&gt;name&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this code wasn't working&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;select class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][fields][certificateType][]&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but changing to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;select class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[userDivingCertification][ {{ block.id }}][fields][certificateType]&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;got it submitting correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other issue I was having with the data being wiped completely was due to the hidden &lt;code&gt;type&lt;/code&gt; field not having the correct value. I had copied some code from elsewhere and forgot to change the value. Once I got it matching my Matrix Block Type handle it worked fine.&lt;/p&gt;&#xA;" OwnerUserId="5883" LastActivityDate="2017-04-25T14:25:39.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20191" PostTypeId="1" CreationDate="2017-04-25T16:36:53.640" Score="1" ViewCount="377" Body="&lt;p&gt;I am using business logic plugin to tap into save user event and create some profile field values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On save user returns a success object.&#xA;I want to return more user profile data to the page on success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the save User function I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest())&#xA; {&#xA;     $return = array(&#xA;         'success' =&amp;gt; true,&#xA;         'errorCode' =&amp;gt; 1,&#xA;         'uid' =&amp;gt; $user-&amp;gt;id,&#xA;         'urn' =&amp;gt; $URN&#xA;     );&#xA;&#xA;     return json_encode($return);&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I still get the usual response of success and user id.&#xA;How do i get a thank you 'page' into the process so I can feedback to the user?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2017-04-26T18:43:38.053" LastActivityDate="2017-04-26T18:47:46.593" Title="AJAX user registration and JSON returned" Tags="&lt;ajax&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20192" PostTypeId="2" ParentId="20174" CreationDate="2017-04-25T17:52:20.613" Score="3" Body="&lt;p&gt;It sounds like you're attempting to access the &lt;code&gt;getDeveloper&lt;/code&gt; method on your plugin's main &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;service class&lt;/a&gt;, but the class doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create the service class, and implement a &lt;code&gt;getDeveloper&lt;/code&gt; method.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;getDeveloper&lt;/code&gt; method on your main plugin class (which I suspect is what you're really trying to do).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Option One: Service&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Your minimal service class will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class CrmPortalService extends BaseApplicationComponent&#xA;{&#xA;    /**&#xA;     * Returns the developer name.&#xA;     *&#xA;     * You could either hard-code the developer name, or you could&#xA;     * retrieve it from the main plugin class, as described in&#xA;     * option two.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'John Doe';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Option Two: Plugin&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Craft uses Services to expose functionality, in exactly the same way that plugins do. If you're trying to figure out how to do something, just look for a Craft Service with a similar name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you want to retrieve your main plugin file, so &lt;a href=&quot;https://craftcms.com/classreference/services/PluginsService&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;PluginsService&lt;/code&gt;&lt;/a&gt; is a good place to start. We're in luck, it has &lt;a href=&quot;https://craftcms.com/classreference/services/PluginsService#getPlugin-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;a &lt;code&gt;getPlugin&lt;/code&gt; method&lt;/a&gt;, which accepts a plugin handle, and returns the plugin class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you might use that, to call the &lt;code&gt;getDeveloper&lt;/code&gt; method in your main plugin class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugins-&amp;gt;getPlugin('crmPortal')-&amp;gt;getDeveloper();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-04-26T00:09:48.233" LastActivityDate="2017-04-26T00:09:48.233" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20193" PostTypeId="1" AcceptedAnswerId="20194" CreationDate="2017-04-25T18:01:36.267" Score="1" ViewCount="249" Body="&lt;p&gt;This is my code I am using, but want to limit it to just one and possibly randomize it also.  Is it possible with Table, I looked at the example on Craft's site but did not see that option.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in block.example %}&#xA;    {{ row.examplerow }}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="57" LastEditDate="2017-04-26T18:48:08.223" LastActivityDate="2017-04-26T18:48:22.060" Title="Limit rows using Table" Tags="&lt;table-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20194" PostTypeId="2" ParentId="20193" CreationDate="2017-04-25T19:08:08.903" Score="3" Body="&lt;p&gt;I have never tried it on a table field, but you could try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in block.example.limit('1').order('RAND()') %}&#xA;    {{ row.examplerow }}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;OK, above will not work&lt;/strong&gt;. I went back on my theory and actually tried it on a table field I had laying around. This worked for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set rows = shuffle(block.example) %}&#xA;&#xA;{% for row in rows | slice(0, 1) %}&#xA;   {{ row.examplerow }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="57" LastEditDate="2017-04-26T18:48:22.060" LastActivityDate="2017-04-26T18:48:22.060" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20195" PostTypeId="1" AcceptedAnswerId="20208" CreationDate="2017-04-25T19:39:35.730" Score="1" ViewCount="115" Body="&lt;p&gt;I could not find it in the docs and hope someone that has used it before can answer it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does Solspace Calendar handle location data.  I did not see a way to add a location like Venti 2 has.  Right now I am using VZ Address in conjunction with Calendar. Is that the best way to go about achieving an address for an event with Solspace Calendar?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-26T14:31:32.253" Title="Solspace Calendar Locations" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20196" PostTypeId="2" ParentId="20177" CreationDate="2017-04-25T21:31:38.997" Score="5" Body="&lt;p&gt;Yes using the onPopulateLineItem event. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;    $purchasable = $event-&amp;gt;params['purchasable'];&#xA;    $lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;    $lineItem-&amp;gt;options = array_merge(&#xA;      $lineItem-&amp;gt;options,&#xA;      ['customFieldLabel'=&amp;gt;$purchasable-&amp;gt;customField]&#xA;    );&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-04-25T21:31:38.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20197" PostTypeId="1" CreationDate="2017-04-25T22:16:04.573" Score="1" ViewCount="175" Body="&lt;p&gt;I am loading an email template for custom registration via a plugin.&#xA;I reset the template path and load my template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;    $newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath().'businesslogic/templates';&#xA;    craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;    $bodyhtml = craft()-&amp;gt;templates-&amp;gt;render('emailreg.html', array(&#xA;        'user' =&amp;gt; $user&#xA;    ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my html template ( an evil abomination of tables etc ) I am accessing the user variable {{user.firstname}} just fine. But the other variable $user-&gt;mycustomfield will not render - even though I can send it in the subject line, e.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email-&amp;gt;subject = 'New User Registration: ' . $user-&amp;gt;firstName . ' ' . $user-&amp;gt;registrationNumber;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So whats up here?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-04-26T12:29:49.260" Title="Email template variables not rendering from plugin" Tags="&lt;plugin-development&gt;&lt;emails&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20198" PostTypeId="1" CreationDate="2017-04-25T23:53:31.837" Score="1" ViewCount="48" Body="&lt;p&gt;I have tried to follow this guide: &lt;a href=&quot;https://github.com/pixelandtonic/AppleNews&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/AppleNews&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The API's and keys I provided appear to be valid as I double-checked with my iCloud News Partner account several times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I follow the link inside the plugin (&lt;a href=&quot;https://news-api.apple.com/sections/2c427e7c-fbc0-31a8-ba00-b563dad6f998&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://news-api.apple.com/sections/2c427e7c-fbc0-31a8-ba00-b563dad6f998&lt;/a&gt;) I receive the : {&quot;errors&quot;:[{&quot;code&quot;:&quot;UNAUTHORIZED&quot;}]} response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what it could be. Any advice? &lt;/p&gt;&#xA;" OwnerUserId="6590" LastActivityDate="2017-04-25T23:53:31.837" Title="Apple News: {&quot;errors&quot;:[{&quot;code&quot;:&quot;UNAUTHORIZED&quot;}]}" Tags="&lt;plugins&gt;&lt;plugin-applenews&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20199" PostTypeId="2" ParentId="2533" CreationDate="2017-04-26T01:20:06.107" Score="1" Body="&lt;p&gt;As MISC has mentioned, Craft has a great permissions system built-in, which allows you to assign users the ability to either &lt;em&gt;publish&lt;/em&gt; content live, or instead only &lt;em&gt;create&lt;/em&gt; it and have others publish it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of a typical permissions screen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/editor-permissions.png&quot; alt=&quot;Craft CMS Permissions Screen&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To take this to the next level, Josh Crawford has developed a great free plugin called &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;Workflow&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; which enhances this with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User interface improvements, including a button to &quot;Submit for Review&quot;&lt;/li&gt;&#xA;&lt;li&gt;Email notifications to notify publishers that an entry is ready for review&lt;/li&gt;&#xA;&lt;li&gt;Entries become locked while they are awaiting review&lt;/li&gt;&#xA;&lt;li&gt;Extra events for hooking into the submission/publishing process with additional custom functionality&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Some screenshots:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane.png&quot; alt=&quot;Craft Workflow Plugin&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane2.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane3.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane4.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/Workflow&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-04-26T01:20:06.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20200" PostTypeId="2" ParentId="7044" CreationDate="2017-04-26T01:32:47.093" Score="4" Body="&lt;p&gt;Douglas has posted a great suggestion about creating an additional custom field for &quot;Status&quot;. But I think it's also worth mentioning Josh Crawford's great free plugin called &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;Workflow&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; which takes Craft's built-in permissions a step further with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User interface improvements, including a button to &quot;Submit for Review&quot;&lt;/li&gt;&#xA;&lt;li&gt;Email notifications to notify publishers that an entry is ready for review&lt;/li&gt;&#xA;&lt;li&gt;Entries become locked while they are awaiting review&lt;/li&gt;&#xA;&lt;li&gt;Extra events for hooking into the submission/publishing process with additional custom functionality&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some screenshots:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane.png&quot; alt=&quot;Craft Workflow Plugin&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane2.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane3.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/engram-design/Workflow/master/screenshots/review-pane4.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/engram-design/Workflow&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/Workflow&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-04-26T01:32:47.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20201" PostTypeId="1" AcceptedAnswerId="20204" CreationDate="2017-04-26T03:41:42.723" Score="0" ViewCount="354" Body="&lt;p&gt;I'm new to the Craft and I just want to ask if how am I able to perform an HTTP request in Craft just like AJAX. Where should I perform it? What should be the flow?&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:28:07.113" LastActivityDate="2017-05-09T19:28:07.113" Title="How can I perform an HTTP Request?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20202" PostTypeId="1" AcceptedAnswerId="20205" CreationDate="2017-04-26T05:07:25.267" Score="0" ViewCount="102" Body="&lt;p&gt;Where should I put my ajax call if I want to get some data from an external link or website? Should I put it in the controller, or in the service?&lt;/p&gt;&#xA;" OwnerUserId="6574" LastEditorUserId="22" LastEditDate="2017-05-09T19:27:14.073" LastActivityDate="2017-05-09T19:27:14.073" Title="Where should I make an HTTP REQUEST using AJAX?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20204" PostTypeId="2" ParentId="20201" CreationDate="2017-04-26T05:16:45.860" Score="2" Body="&lt;p&gt;I have used the placid plugin to achieve this in the past. &#xA;Is this what you are looking for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/olivierbon/Placid/wiki/Making-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/olivierbon/Placid/wiki/Making-requests&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5204" LastActivityDate="2017-04-26T05:16:45.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20205" PostTypeId="2" ParentId="20202" CreationDate="2017-04-26T06:02:21.433" Score="4" Body="&lt;p&gt;You should try to keep your controllers as &quot;thin&quot; as possible. That is, they should call other classes, which do the actual work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft approach is to keep most of your code in service classes, and if you're just starting out with plugin development, I recommend you follow this pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bear in mind, though, that your service classes define your plugin's API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if you add a public method to one of your plugin service classes, you're essentially telling everyone &quot;hey, you can use this method if you like&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested, I wrote &lt;a href=&quot;https://experiencehq.net/blog/the-hidden-perils-of-craft-plugin-service-classes&quot; rel=&quot;nofollow noreferrer&quot;&gt;a blog post&lt;/a&gt; about this a while back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, keeping your code in services is much better than keeping it in controllers, but don't treat your service classes as a dumping ground for everything.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-26T06:02:21.433" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20206" PostTypeId="2" ParentId="20197" CreationDate="2017-04-26T12:29:49.260" Score="1" Body="&lt;p&gt;The above template path code works fine. I was just looking for a user variable that hadn't yet been set&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-04-26T12:29:49.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20207" PostTypeId="2" ParentId="19673" CreationDate="2017-04-26T12:34:32.740" Score="2" Body="&lt;p&gt;To get all root categories you can use: 'criteria' =&gt; ['level' =&gt; 1]&lt;/p&gt;&#xA;" OwnerUserId="6642" LastActivityDate="2017-04-26T12:34:32.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20208" PostTypeId="2" ParentId="20195" CreationDate="2017-04-26T14:31:32.253" Score="2" Body="&lt;p&gt;There currently isn't any built in Location field for Calendar. We made add something like that in the future, but for now you can definitely use other third party field types such as &lt;a href=&quot;https://github.com/elivz/VzAddress-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;VZ Address&lt;/a&gt; to handle this. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-04-26T14:31:32.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20209" PostTypeId="1" AcceptedAnswerId="20341" CreationDate="2017-04-26T15:12:26.080" Score="1" ViewCount="2975" Body="&lt;p&gt;I'm using a third-party email service called SendGrid to send email but am coming up with what I think is a server issue with the SSL. A temporary fix is to edit a line similar to this in a PHPMailer example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mail-&amp;gt;SMTPOptions = array(&#xA;    'ssl' =&amp;gt; array(&#xA;        'verify_peer' =&amp;gt; false,&#xA;        'verify_peer_name' =&amp;gt; false,&#xA;        'allow_self_signed' =&amp;gt; true&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But Craft doesn't use anything that resembles that to me.I want to try hacking the core to see if I can get a temporary fix up but can't find where to put it, despite scouring &lt;code&gt;EmailService.php&lt;/code&gt;. Can anyone point me to the function where I'd add these details? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the error,  by the way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stream_socket_enable_crypto(): Peer certificate CN=`#################' did not match expected CN=`smtp.sendgrid.net' (/home/################/craft/app/vendor/phpmailer/phpmailer/class.smtp.php:367&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-05-08T08:59:47.060" LastActivityDate="2017-05-08T08:59:47.060" Title="stream_socket_enable_crypto() error when sending email via SMTP" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20210" PostTypeId="1" CreationDate="2017-04-26T15:21:20.617" Score="1" ViewCount="114" Body="&lt;p&gt;I am working on LivePreview and the window it's get loaded at every change. It is possible to do that only when I will click the Save button?&lt;/p&gt;&#xA;" OwnerUserId="6644" LastEditorUserId="125" LastEditDate="2017-04-26T16:05:04.233" LastActivityDate="2017-04-26T16:05:04.233" Title="Stop window refreshing in Live Preview?" Tags="&lt;plugin-development&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20211" PostTypeId="1" CreationDate="2017-04-26T15:59:39.537" Score="2" ViewCount="489" Body="&lt;p&gt;I am building a bilingual website using Craft CMS. The english entries are completed and I am now in the process of doing translating the content to french. I would like to know if there is a way clone the english entries to the french entries so I can just change fields that are different?&lt;/p&gt;&#xA;" OwnerUserId="5389" LastActivityDate="2017-04-26T21:20:55.263" Title="Cloning content between locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20212" PostTypeId="2" ParentId="20210" CreationDate="2017-04-26T16:02:03.977" Score="2" Body="&lt;p&gt;No, that’s the whole point of Live Preview, to update and preview the changes “live”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that’s not what you want you can save the entry via “Save an continue editing” (keyboard shortcut &lt;kbd&gt;CMD&lt;/kbd&gt;+&lt;kbd&gt;S&lt;/kbd&gt;) and then view the changes by clicking the “Entry link” button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YYxCS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YYxCS.png&quot; alt=&quot;Share entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-04-26T16:02:03.977" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20213" PostTypeId="2" ParentId="2086" CreationDate="2017-04-26T16:03:37.527" Score="3" Body="&lt;p&gt;I came across a similar issue today where I was creating a search form that included checkboxes. I did it as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I checked if the URL had the query string I was looking for and joined the query string since it's an array. I used &lt;code&gt;OR&lt;/code&gt; because I want it to search for any of the checked options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if craft.request.getParam('services') %}&#xA;    {% set services = craft.request.getParam('services') %}&#xA;    {% set services = services|join(' OR ') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The query string in &lt;code&gt;getParam('services')&lt;/code&gt; is the same as the &lt;code&gt;name&lt;/code&gt; field of the checkbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I listed out my options &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for option in craft.fields.getFieldByHandle('memberServices').settings.options %}&#xA;&amp;lt;li&amp;gt;&#xA;    &amp;lt;label class=&quot;form__label&quot; for=&quot;{{ option.value }}&quot;&amp;gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;services[]&quot; id=&quot;{{ option.value }}&quot; {% if services is defined and option.value in services %}checked{% endif %} value=&quot;{{ option.value }}&quot; &amp;gt;{{ option.label }}&amp;lt;/label&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conditional that gives the checkbox the checked attribute is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if services is defined and option.value in services %}checked{% endif %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if services is defined (is in the URL) and the option value is contained within the services variable, apply the checked attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also works with multiple checkboxes, IE the URL &lt;code&gt;search?q=&amp;amp;services%5B%5D=counselling&amp;amp;services%5B%5D=supervision&amp;amp;sessions=individual&lt;/code&gt; will check the &quot;Counselling&quot; and &quot;Supervision&quot; &quot;services&quot; checkboxes, and the &quot;Individual&quot; &quot;sessions&quot; checkbox.&lt;/p&gt;&#xA;" OwnerUserId="5883" LastEditorUserId="5883" LastEditDate="2017-04-26T16:21:18.930" LastActivityDate="2017-04-26T16:21:18.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20214" PostTypeId="2" ParentId="20191" CreationDate="2017-04-26T18:47:46.593" Score="1" Body="&lt;p&gt;Instead of listening to the &lt;code&gt;onSaveUser&lt;/code&gt; event, I'd update my user save form on the front-end to point to a controller's action in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can run similar logic to what Craft's &lt;code&gt;UsersController-&amp;gt;actionSaveUser()&lt;/code&gt; is doing and return any custom JSON encoded data you want back to your template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-26T18:47:46.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20215" PostTypeId="2" ParentId="9395" CreationDate="2017-04-26T19:21:37.903" Score="2" Body="&lt;p&gt;I recently released Country Redirect, a plugin that handles this smoothly: &lt;a href=&quot;https://superbig.co/plugins/country-redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/country-redirect&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It lets you map which countries get redirected to which locales, let visitors override the country, and easily let you create a locale nav based on the country mapping.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-04-26T19:21:37.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20217" PostTypeId="1" AcceptedAnswerId="20219" CreationDate="2017-04-26T20:53:00.720" Score="1" ViewCount="231" Body="&lt;p&gt;I am fairly new to Craft and I am hoping someone can help point me in the right direction so I am not having to do double the work or have to learn the hard way that there is an easier way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to get my head around how I can tie pages together. I am creating a page for videos from speakers but I want the speakers names to be linked back to their staff page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create an entry that will allow users to select a staff member?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already created a staff entry page, that allows all the information to be populated for the staff member. Should that be a categories page instead to allow me to have a the user select the staff member (category) that did the talk for the video? Or is there another way to allow the user to select a field of staff members?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="6645" LastEditorUserId="57" LastEditDate="2017-04-26T21:36:29.757" LastActivityDate="2017-04-27T20:18:49.443" Title="linking to staff page, how to setup entry" Tags="&lt;entries&gt;&lt;categories&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20218" PostTypeId="1" AcceptedAnswerId="20227" CreationDate="2017-04-26T21:05:08.777" Score="2" ViewCount="595" Body="&lt;p&gt;I am trying to get a query to work using the &lt;code&gt;id()&lt;/code&gt; param on a &lt;code&gt;craft.entries.find()&lt;/code&gt; call and am stuck getting nothing back from Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are getting an array of entry IDs from a CRM to personalize the content on the page which we then are fetching from Craft. At the same time we want to also omit certain IDs so we do not have duplicate entries on the same page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryQuery = 'and, ' ~ topViewedArticlesIds|join(',') ~ ',' ~ presentArticles|join(',not ') %}&#xA;&#xA;{% set topViewed = craft.entries.find({&#xA;       section: 'articles',&#xA;       id: entryQuery&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have used the id field before to omit certain entries but I have not combined them before so this may not even be possible in this via the &lt;code&gt;id&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2017-04-27T07:38:36.833" Title="ID query format" Tags="&lt;entries&gt;&lt;id&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20219" PostTypeId="2" ParentId="20217" CreationDate="2017-04-26T21:14:34.147" Score="1" Body="&lt;p&gt;You could have two sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Staff&#xA;Videos&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the videos channel, create a Staff entries field type, select the Staff channel in that field's options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you create a new video, you can relate that video to a staff entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When displaying a video entry, you could reference that staff that is tied to that video entry like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.staff }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to be more specific, you would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.staff.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and to get a link to the staff entry that is related to the video entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.staff.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an article explaining relationships further: &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&lt;/a&gt; and documentation on the Entries field type: &lt;a href=&quot;https://craftcms.com/docs/entries-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/entries-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-26T21:14:34.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20220" PostTypeId="2" ParentId="20211" CreationDate="2017-04-26T21:20:55.263" Score="2" Body="&lt;p&gt;You could build a plugin that loops thru all the entries and creates a new entry programmatically, the only difference in the new entry would be the locale. Look at this: &lt;a href=&quot;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/EntriesService#saveEntry-detail&lt;/a&gt;, you would include $entry-&gt;locale = 'fr_us'; or whatever the shortname/handle of that locale is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or export the entries and import them, and setting the locale to french using something like: &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/FeedMe&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2017-04-26T21:20:55.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20221" PostTypeId="1" CreationDate="2017-04-26T22:12:55.957" Score="1" ViewCount="759" Body="&lt;p&gt;I currently have a website that's been built using a static site generator (SSG; in this case, &lt;a href=&quot;https://gohugo.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hugo&lt;/a&gt;). The site has about 10 sections, each with 40-50 markdown files. As is the case with most content built out using an SSG, the content files are all well structured and include embedded metadata (via YAML front matter) at the top of each content &lt;code&gt;.md&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front matter is very well structured and includes the following fields across all article files:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;title:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;subtitle:&lt;/code&gt;  &lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;description:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;tags:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;categories:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There is also a staff/person content type with the usual fields:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;name_first:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;name_last:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;job_title:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reports_to:&lt;/code&gt;&#xA;Etc...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With Hugo (or just some clever BASH scripting), I can easily template these into a CSV (or multiple CSVs), JSON, etc. I know there are obvious differences between flat files/serialized data and an RDBMS, but I'm wondering if there is a clever way for me to make all of this content easily importable for Craft CMS 3, which our company is hoping to use for a major replatforming in about 3-4 months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire site actually has close to 650 pages, but I figure I can start structuring them in markdown with YAML first to avoid a prolonged copy-and-paste nightmare. (Our current &quot;CMS&quot; is &lt;em&gt;not&lt;/em&gt; a CMS by any means and doesn't contains any metadata.) I can parse the content out as very clean HTML, plain text, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts, first steps, suggestions, etc would be &lt;em&gt;extremely&lt;/em&gt; appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6647" LastActivityDate="2017-04-26T23:35:41.947" Title="Going from a static site generator (Jekyll or Hugo) to Craft CMS; Export/migrations options?" Tags="&lt;database&gt;&lt;migration&gt;&lt;import&gt;&lt;conversion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20222" PostTypeId="2" ParentId="20221" CreationDate="2017-04-26T23:35:41.947" Score="3" Body="&lt;p&gt;There is a good plugin called FeedMe that can help with imports. We used it migrating a pretty large EE site without issue. If you can spit out a XML, RSS, ATOM or JSON feed, it should be able to import it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe Plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if it is Craft 3 ready yet, though.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-04-26T23:35:41.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20223" PostTypeId="2" ParentId="12939" CreationDate="2017-04-27T01:53:42.763" Score="2" Body="&lt;p&gt;Had similar issues. Found the problem was in the .htaccess file. &#xA;Without code fixes, visit &lt;a href=&quot;http://example.com/index.php/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/index.php/admin&lt;/a&gt;&#xA;instead of &lt;a href=&quot;http://example.com/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/admin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then fix your htaccess file later. &lt;/p&gt;&#xA;" OwnerUserId="6648" LastActivityDate="2017-04-27T01:53:42.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20224" PostTypeId="1" AcceptedAnswerId="20225" CreationDate="2017-04-27T04:56:00.327" Score="0" ViewCount="255" Body="&lt;p&gt;I get this on the admin panel:&#xA;CDbException&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #18 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'craftcms.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. The SQL statement executed was: SELECT &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;type&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;archived&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;dateUpdated&lt;/code&gt;, &#xA;.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a long trail in the apache error log. here's a snippet.&#xA;2017/04/27 04:46:46 [trace] [system.db.CDbConnection] Opening DB connection&#xA;in /var/www/craft/app/etc/behaviors/AppBehavior.php (871)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Env details:&#xA;Ubuntu 1.04 (fresh digital ocean vps)&#xA;php - PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )&#xA;mysql - 5.7.17-0ubuntu0.16.04.2&lt;/p&gt;&#xA;" OwnerUserId="6648" LastActivityDate="2017-04-27T05:32:55.483" Title="Help with admin panel errors. Fresh install. Mysql version issue?" Tags="&lt;installation&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2017-04-27T06:46:41.283" ContentLicense="CC BY-SA 3.0" />
  <row Id="20225" PostTypeId="2" ParentId="20224" CreationDate="2017-04-27T05:32:55.483" Score="3" Body="&lt;p&gt;You need to tweak your MySQL 5.7.5+ config for it to play nicely with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MySQL 5.7.5 changed the behaviour of the &lt;code&gt;GROUP_BY&lt;/code&gt; statement, affecting some of the core Craft queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The preferred solution is to add the following to your &lt;code&gt;/etc/mysql/conf.d/sql_mode.cnf&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[mysqld]&#xA;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcookbook.net/recipes/making-craft-play-nicely-with-mysql-5-7-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;This Craft Cookbook recipe&lt;/a&gt; provides additional information about the problem, and the possible solutions.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-27T05:32:55.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20226" PostTypeId="2" ParentId="16093" CreationDate="2017-04-27T06:31:24.007" Score="1" Body="&lt;p&gt;I was having a similar issue. Combining your use of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule (.+) index.php [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but with the following for the non-www redirect&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} =www.domain.com&#xA;RewriteRule (.*) http://domain.com/$1 [R=302,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;worked for me. &lt;/p&gt;&#xA;" OwnerUserId="6112" LastActivityDate="2017-04-27T06:31:24.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20227" PostTypeId="2" ParentId="20218" CreationDate="2017-04-27T07:38:36.833" Score="2" Body="&lt;p&gt;When you use the &lt;code&gt;id&lt;/code&gt; parameter (without the &lt;code&gt;not&lt;/code&gt; directive), Craft will actually only return entries matching the IDs you pass in and nothing else, which means that both including and excluding a list of IDs in the same query is redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you already have an array of IDs you want (&lt;code&gt;topViewedArticlesIds&lt;/code&gt;) and an array of IDs you &lt;em&gt;don't&lt;/em&gt; want (&lt;code&gt;presentArticles&lt;/code&gt;), it's simply a matter of creating a third array of entry IDs that includes all the IDs in the former, without any of the IDs in the latter, and pass that in to &lt;code&gt;craft.entries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#without&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;without&lt;/code&gt;&lt;/a&gt; filter makes this super-easy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = topViewedArticlesIds|without(presentArticles) %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'articles',&#xA;    id: entryIds&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: If you want to make sure that the order of the returned entries is in the same order as the IDs in the &lt;code&gt;topViewedArticlesIds&lt;/code&gt; array, you can pass in the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#fixedOrder&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;fixedOrder&lt;/code&gt;&lt;/a&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'articles',&#xA;    id: entryIds,&#xA;    fixedOrder: true&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-04-27T07:38:36.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20228" PostTypeId="1" CreationDate="2017-04-27T10:29:08.953" Score="1" ViewCount="161" Body="&lt;p&gt;How can I output all translation strings to a javascript object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I could do it one by one like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;translations.string = {{ &quot;string&quot; | t }};&#xA;&#xA;...&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to just loop through all translation strings. Is there some kind of twig object containing all these strings?&lt;/p&gt;&#xA;" OwnerUserId="6620" LastEditorUserId="359" LastEditDate="2017-04-27T18:57:50.180" LastActivityDate="2017-04-27T18:57:50.180" Title="Output all translation strings to javascript object" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20229" PostTypeId="1" AcceptedAnswerId="20235" CreationDate="2017-04-27T12:39:59.823" Score="1" ViewCount="351" Body="&lt;p&gt;Here is my scenario;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a successful transaction occur, payment form page redirects to customer order page which have the orderId in url like &lt;code&gt;/orders?number=1234&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this page i send ecommerce tag into Google Analytics.However this should be send only once, in first visit. So when the customer returns order page and look again, this code should not be fired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of ways should i follow? Can i do this from server, Craft side?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2017-04-29T13:13:20.737" Title="How to trigger code once in a thank you page?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20230" PostTypeId="1" AcceptedAnswerId="20233" CreationDate="2017-04-27T12:56:41.857" Score="2" ViewCount="519" Body="&lt;p&gt;For example, I have channel entry &lt;a href=&quot;https://site.dev/news/2017/test&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://site.dev/news/2017/test&lt;/a&gt; and I would like to output &quot;News&quot; section name on entry page. &lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-27T13:24:13.577" Title="How to output first segment title/channel name of entry?" Tags="&lt;templating&gt;&lt;frontend&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20231" PostTypeId="1" AcceptedAnswerId="20268" CreationDate="2017-04-27T13:03:57.337" Score="0" ViewCount="302" Body="&lt;p&gt;It is easy to set in the text field, but I don't see such option in RTF. How can I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, I can use a text field, though it doesn't output new lines as paragraphs - it is possible?&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-29T09:23:48.470" Title="How to limit RTF field word count?" Tags="&lt;templating&gt;&lt;field&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20232" PostTypeId="2" ParentId="20229" CreationDate="2017-04-27T13:20:40.560" Score="2" Body="&lt;p&gt;If the user is logged in, you could store some sort of value in the user account to a field (lightswitch, perhaps?) you define that the order has been completed, so you could then insert the tracking code only if that field has not been already turned on. But this would require having to submit some sort of form in the background with AJAX to toggle the switch in their account, and might be tricky to handle if there are multiple orders etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a better, or at least alternate option is to set a cookie once the analytics code has been called once, and then check for the cookie on future page loads, hiding the analytics if it exists. You could do this pretty easily with this plugin: &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/cookies&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2017-04-27T13:20:40.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20233" PostTypeId="2" ParentId="20230" CreationDate="2017-04-27T13:24:13.577" Score="5" Body="&lt;p&gt;Unless I'm misunderstanding, it should be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.section.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="359" LastActivityDate="2017-04-27T13:24:13.577" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20234" PostTypeId="2" ParentId="20228" CreationDate="2017-04-27T13:31:06.347" Score="1" Body="&lt;p&gt;Not that I'm aware of. You would have to create a plugin that scrapes all of your template files for translatable strings, that then also makes those strings available to twig templates.&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2017-04-27T13:31:06.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20235" PostTypeId="2" ParentId="20229" CreationDate="2017-04-27T14:21:11.833" Score="3" Body="&lt;p&gt;We do this by setting a flash message server side and then checking for this in the template. Flash messages are only shown once so no need to manually delete/unset. The best way to do this would be using a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that listens for the &lt;code&gt;commerce_orders.onOrderComplete&lt;/code&gt; &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow noreferrer&quot;&gt;event&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class FireAnalyticsPlugin extends BasePlugin&#xA;{&#xA;    function init()&#xA;    {&#xA;        craft()-&amp;gt;on('commerce_orders.onOrderComplete', function($event) &#xA;        {&#xA;            craft()-&amp;gt;userSession-&amp;gt;setFlash('successfulOrderPlaced', true);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Customer order page template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('successfulOrderPlaced') %}&#xA;// Add Google Analytics here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4840" LastEditorUserId="4840" LastEditDate="2017-04-29T13:13:20.737" LastActivityDate="2017-04-29T13:13:20.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20236" PostTypeId="1" CreationDate="2017-04-27T14:23:49.780" Score="1" ViewCount="388" Body="&lt;p&gt;I have a plugin that checks for the current user on login and should redirect the user if they are part of a particular user group. When I do this I get the following &quot;An unknown error occurred.&quot; and the redirect doesn't work. See init function below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function init()&#xA;{&#xA;    craft()-&amp;gt;on( 'userSession.onLogin', function( Event $event ){&#xA;        $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;        if ($user &amp;amp;&amp;amp; $user-&amp;gt;isInGroup('sales')){&#xA;          $url = &quot;new.url&quot;;&#xA;          craft()-&amp;gt;request-&amp;gt;redirect($url);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="6649" LastActivityDate="2017-04-27T15:24:31.363" Title="Redirect user based on group after Craft login" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20237" PostTypeId="1" CreationDate="2017-04-27T14:27:08.580" Score="6" ViewCount="274" Body="&lt;p&gt;Using Freeform for forms which have multiple file upload fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have a unique asset directory for each submission? For example: uploads/maindirectory/&lt;em&gt;submission.id&lt;/em&gt;/ I'm trying to make it easier for the website admins to see all of the uploaded files in one location, &lt;strong&gt;but mainly&lt;/strong&gt; to prevent multiple users uploading files of the same filename.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Users are requested to upload scanned documents, so file names such as &quot;scan1.jpg&quot;, &quot;scan2.jpg&quot; could be a common theme and would not work in this case as craft natively doesn't allow the same file uploaded twice meaning freeform throws a validation error.&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-04-27T14:27:08.580" Title="Solspace Freeform Upload file dynamic location and duplicate file avoidance" Tags="&lt;assets&gt;&lt;upload&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20238" PostTypeId="2" ParentId="20236" CreationDate="2017-04-27T14:59:45.827" Score="1" Body="&lt;p&gt;This is an alternate solution to what you're trying to do, and only applies if the login is coming and being directed to front end templates, but you could do something similar directly in your twig template, rather than having to use a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could put something like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.isInGroup('sales') %}&#xA;{% redirect &quot;new.url&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...somewhere on the page that logged in users will land on by default.&lt;/p&gt;&#xA;" OwnerUserId="359" LastEditorUserId="359" LastEditDate="2017-04-27T15:24:31.363" LastActivityDate="2017-04-27T15:24:31.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20239" PostTypeId="1" AcceptedAnswerId="20240" CreationDate="2017-04-27T15:19:40.170" Score="1" ViewCount="143" Body="&lt;p&gt;I have built a few fields with the Table field.  I noticed an odd behavior maybe it's normal, but want to check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use a Table field with defaults entered, the defaults do not show up.  Now for the odd, if I put the Table field in a Matrix field, the defaults show up.  Is that normal Table field behavior?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-27T15:28:25.790" Title="Table field type defaults" Tags="&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20240" PostTypeId="2" ParentId="20239" CreationDate="2017-04-27T15:28:25.790" Score="1" Body="&lt;p&gt;I just did some testing of this. I thought I noticed the same thing, but then realised that I created and added the field to my section (a single) only after it already existed. In that case the defaults didn't show. But then I added the field to a channel section and created a new entry and the defaults show in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think the reasoning is that it won't populate defaults on an already existing entry as these could easily go unnoticed by someone editing and end up being saved to the entry when unintended.&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2017-04-27T15:28:25.790" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20243" PostTypeId="1" AcceptedAnswerId="20248" CreationDate="2017-04-27T19:59:04.053" Score="0" ViewCount="357" Body="&lt;p&gt;I have four category groups (Position, State, Status, Denomination). I am trying to create a search form so all four categories can be utilized together or individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have for my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('ministry-jobs/results') }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;search&quot; name=&quot;query&quot; placeholder=&quot;What are you looking for?&quot; style=&quot;width: 100%;&quot;&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;position[]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot; selected&amp;gt;-- Select Position --&amp;lt;/option&amp;gt;&#xA;  {% set positions = craft.categories.group('position') %}&#xA;  {% for position in positions %}&#xA;  &amp;lt;option value=&quot;{{ position.slug }}&quot;&amp;gt;{{ position.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;state[]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot; selected&amp;gt;-- Select State --&amp;lt;/option&amp;gt;&#xA;  {% set states = craft.categories.group('state') %}&#xA;  {% for state in states %}&#xA;  &amp;lt;option value=&quot;{{ state.slug }}&quot;&amp;gt;{{ state.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;status[]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot; selected&amp;gt;-- Select Status --&amp;lt;/option&amp;gt;&#xA;  {% set statuses = craft.categories.group('status') %}&#xA;  {% for status in statuses %}&#xA;  &amp;lt;option value=&quot;{{ status.slug }}&quot;&amp;gt;{{ status.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;denomination[]&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;&quot; selected&amp;gt;-- Select Denomination --&amp;lt;/option&amp;gt;&#xA;  {% set denominations = craft.categories.group('denomination') %}&#xA;  {% for denomination in denominations %}&#xA;  &amp;lt;option value=&quot;{{ denomination.slug }}&quot;&amp;gt;{{ denomination.title }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is what I have on Results Page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set position = craft.request.getParam('position') %}&#xA;{% set state = craft.request.getParam('state') %}&#xA;{% set status = craft.request.getParam('status') %}&#xA;&#xA;{% set homeGrownParam = craft.request.getParam('homeGrown') %}&#xA;{% set preparedProduceParam = craft.request.getParam('preparedProduce') %}&#xA;{% set redTractorParam = craft.request.getParam('redTractor') %}&#xA;&#xA;{% set positionCat = position ? craft.categories.group('position').slug(position).find() %}&#xA;{% set stateCat = state ? craft.categories.group('state').slug(state).find() %}&#xA;{% set statusCat = status ? craft.categories.group('status').slug(status).find() %}&#xA;&#xA;{% set positionParam = positionCat ? {targetElement: ['and']|merge(positionCat)} %}&#xA;{% set stateParam = stateCat ? {targetElement: ['and']|merge(stateCat)} %}&#xA;{% set statusParam = statusCat ? {targetElement: ['and']|merge(statusCat)} %}&#xA;&#xA;{% set relationParams = [positionParam, stateParam, statusParam]|filter %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'ministryJobs',&#xA;    relatedTo: relationParams ? ['and']|merge(relationParams) : null,&#xA;    search: query,&#xA;    homeGrown: homeGrownParam,&#xA;    preparedProduce: preparedProduceParam,&#xA;    redTractor: redTractorParam&#xA;}) %}&#xA;&#xA;&amp;lt;div class=&quot;{{ cycle(['job-display-white', 'job-display-grey'], loop.index0) }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-1 post-data&quot;&amp;gt;{{ entry.postDate.format(&quot;m/d/y&quot;) }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-2 post-data job-position&quot;&amp;gt;{{ entry.position }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-3 post-data&quot;&amp;gt;{{ entry.church }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-4 post-data&quot;&amp;gt;{{ entry.city }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-5 post-data&quot;&amp;gt;{{ entry.state }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div style=&quot;clear: both;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting no results. I am not sure what I am doing wrong. Any help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="22" LastEditDate="2017-05-09T19:24:59.983" LastActivityDate="2017-05-09T19:24:59.983" Title="Searching Multiple Categories in Craft CMS" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20244" PostTypeId="2" ParentId="20217" CreationDate="2017-04-27T20:18:49.443" Score="0" Body="&lt;pre&gt;&lt;code&gt;{% for staff in entry.speaker %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ staff.url }}&quot; class=&quot;note&quot;&amp;gt;&amp;lt;span class=&quot;icon down-2 left-2&quot; data-icon=&quot;t&quot;&amp;gt;&amp;lt;/span&amp;gt;{{ staff.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tanks for the help and resources!&lt;/p&gt;&#xA;" OwnerUserId="6645" LastActivityDate="2017-04-27T20:18:49.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20245" PostTypeId="1" AcceptedAnswerId="20380" CreationDate="2017-04-28T02:53:58.153" Score="1" ViewCount="591" Body="&lt;p&gt;Is there anything in Sprout Forms or Craft that prevents an email being sent to any registered Craft user email address but not other email addresses not in the Craft user list? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a really simple one field form that sends a notification to two email addresses: the one in the submitted form field, as well as the one in the CP Sprout Forms notifications field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A weird thing is happening. If I use an email address that is not belonging to a Craft user (either as the typed in notification address or the {email} one) the email is sent (according the server logs) and received. If I use an email address belonging to a  Craft user the email is not sent from Craft (doesn't even register in the server logs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The simple form is trying to distil the problem down - it is occurring on all my forms, and was working before but has stopped, possibly the same time as a server change. The PHP mail() function works to said email addresses. I am using latest versions of Craft and Sprout Forms on PHP 7.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I can swap email addresses in and out of the user list so when they belong to a user no email is sent, and when they are removed from the user list, the email is sent. This suggests there is nothing wrong with the email address per se or the route through the system, but purely the fact that it is a Craft user email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2: When sending to a craft user email address the following craft.log error is made:&#xA;Email error: Could not execute: /bin/mini_sendmail (etc)&#xA;This doesn't happen when a non-craft user email is used. So suggests to me Sendmail is not properly set up (but why then do other emails get through fine).&lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="695" LastEditDate="2017-04-28T05:24:19.973" LastActivityDate="2017-05-06T16:24:27.207" Title="Sprout Forms or Craft not sending email to Craft user email addresses" Tags="&lt;emails&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20246" PostTypeId="1" CreationDate="2017-04-28T03:16:09.333" Score="1" ViewCount="422" Body="&lt;p&gt;We've been looking around to get some info for this feature but didn't find anything yet and wanted to ask here in case we are missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to create an order from the Control Panel? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are working on a project that needs to track orders not done via the website and will need the ability to create manual orders from the CP but this feature doesn't seem to exist in Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if there is a 3rd party plugin that we might have missed that allows this functionality? Or if this is a feature that might be considered in the future scope of Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks heaps,&#xA;Alby&lt;/p&gt;&#xA;" OwnerUserId="6653" LastActivityDate="2017-04-28T05:11:35.570" Title="Craft Commerce - Create Order from Control Panel" Tags="&lt;plugin-craftcommerce&gt;&lt;control-panel&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20247" PostTypeId="2" ParentId="20246" CreationDate="2017-04-28T05:11:35.570" Score="1" Body="&lt;p&gt;There is currently no way to do this from the control panel unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been said a bunch of times it's on the roadmap, and it's an oft requested feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is a generalised plugin for this yet.  I doubt there will be as it's coming to core.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's certainly possible to write one, but it would be a fair bit of work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You could quickly hack something together in the form of a form that lists all your products and uses MultiAdd to add them to a cart in one go...but you'd still have to go through checkout to complete the order.  &lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/MultiAdd&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-04-28T05:11:35.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20248" PostTypeId="2" ParentId="20243" CreationDate="2017-04-28T08:52:39.780" Score="0" Body="&lt;p&gt;I might be missing something, but your code is missing a &lt;code&gt;{% for entry in entries %}&lt;/code&gt; loop wrapped around your &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="359" LastActivityDate="2017-04-28T08:52:39.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20249" PostTypeId="1" AcceptedAnswerId="20250" CreationDate="2017-04-28T09:26:57.863" Score="1" ViewCount="192" Body="&lt;p&gt;I have a DIV wrapping a Rich Text field.  I would like to add a class name to the DIV only if an image is present in the text field.  Is there a way to check for an image?&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2017-04-28T19:27:12.963" LastActivityDate="2017-04-28T19:27:12.963" Title="Check for an image in Rich Text Field" Tags="&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20250" PostTypeId="2" ParentId="20249" CreationDate="2017-04-28T09:58:57.123" Score="3" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/templates.html#containment-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;in&lt;/code&gt; operator&lt;/a&gt; to search for a substring in your markup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageExists = '&amp;lt;img' in entry.body.getRawContent() %}&#xA;{% set classAttr = imageExists ? 'with-image' : '' %}&#xA;&#xA;&amp;lt;div class=&quot;{{ classAttr }}&quot;&amp;gt;&#xA;    {{ entry.body }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another, probably bit more reliable way to test for &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; elements is to use the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon&lt;/a&gt; plugin, which uses DOMdocument to parse the markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A combination of &lt;code&gt;retconOnly&lt;/code&gt; and &lt;code&gt;length&lt;/code&gt; filters should get you there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageExists = entry.body|retconOnly('img')|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-04-28T10:06:03.407" LastActivityDate="2017-04-28T10:06:03.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20251" PostTypeId="1" CreationDate="2017-04-28T10:49:24.543" Score="1" ViewCount="168" Body="&lt;p&gt;I have some custom profile fields saved on registration in the front end.&#xA;They are checkboxes and only submit on front end reg when they are set as an array. eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[phoneOptIn]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;        {% set chbox = craft.fields.getFieldByHandle('phoneOptIn').getFieldType.options %}&#xA;&#xA;        {% for option in chbox %}&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[phoneOptIn][]&quot; value=&quot;{{ option.value }}&quot;  tabindex=&quot;29&quot;&amp;gt;&#xA;            {{ option.label }}&#xA;        {% endfor %}&#xA;    &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;fields[phoneOptIn][]&quot; only works to save with &quot;[]&quot; in name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem in the CP user display is that when configuring to show the check box fields in the CP, the values of the checkboxes are not shown. What is displayed instead is the labels. eg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k2FL3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k2FL3.jpg&quot; alt=&quot;labels not values shown in user profile fields in craftcms cp&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug? Really want to see values in backend not labels.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2017-04-28T22:10:58.273" LastActivityDate="2017-05-08T22:17:18.500" Title="Checkbox profile fields front end show labels in cp" Tags="&lt;control-panel&gt;&lt;user-profile&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20252" PostTypeId="1" AcceptedAnswerId="20261" CreationDate="2017-04-28T13:04:17.353" Score="2" ViewCount="287" Body="&lt;p&gt;I have a 3 language website that I made for a client.&#xA;The website is in Dutch, Japanese and English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When my clients creates a new entry, most of the time they want to have the Japanese and English version disabled and only show the Dutch version. After they have created the entry they have to manually disable the Japanese and English version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have the Japanese and English version disabled by default?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2017-04-28T19:53:00.997" Title="Can entries be disabled by default for 2/3 of the languages on my website" Tags="&lt;multi-environment&gt;&lt;language&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20253" PostTypeId="1" CreationDate="2017-04-28T13:10:16.720" Score="1" ViewCount="165" Body="&lt;p&gt;I would like to import data for fields with multiple locales with the &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; plugin. I have to create the JSON feed, so how can I do that? Thanks for your help!&lt;/p&gt;&#xA;" OwnerDisplayName="user5718" LastEditorUserId="57" LastEditDate="2017-04-28T22:15:50.560" LastActivityDate="2019-05-16T12:43:23.273" Title="FeedMe plugin multi language import" Tags="&lt;plugin-feedme&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20254" PostTypeId="2" ParentId="20164" CreationDate="2017-04-28T14:31:32.870" Score="0" Body="&lt;p&gt;This issue is caused by the presence of the &lt;code&gt;{% requireLogin %}&lt;/code&gt; tag in one of your Craft templates. Remove the tag from the template in question, and the redirect should work as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Docs: &lt;a href=&quot;https://craftcms.com/docs/templating/requirelogin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/requirelogin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2017-04-28T14:31:32.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20255" PostTypeId="1" AcceptedAnswerId="20262" CreationDate="2017-04-28T16:42:55.787" Score="4" ViewCount="316" Body="&lt;p&gt;I've written a custom plugin and added a custom button to the right panel of an entry page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WWGfM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WWGfM.png&quot; alt=&quot;Click on the red button should trigger a Garnish Hud&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to show a Garnish Hud if I click the red button (like the one when you re-index assets) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cTOdc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cTOdc.png&quot; alt=&quot;I want to re-create this tooltip hud&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The content of the hud would be two radio buttons and a button which triggers a controller function. It should also show the progress bar and the success icon after the button was clicked (so basically the same behaviour as the assets indexing thing)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put this code in my plugin specific js file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var hud = new Garnish.HUD($('#generate-pdf'), 'test', {&#xA;        orientations: ['top', 'bottom', 'right', 'left'],&#xA;        hudClass: 'hud toolhud',&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this shows the hud after page load and the trigger (that's the button with the id #generate-pdf) doesn't work at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction? &lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-04-28T20:45:02.830" Title="How do I show a Garnish hud in the CP" Tags="&lt;plugin-development&gt;&lt;garnish&gt;&lt;hud&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20256" PostTypeId="1" AcceptedAnswerId="20311" CreationDate="2017-04-28T17:09:08.507" Score="0" ViewCount="785" Body="&lt;p&gt;The website ist working, but I can not login in the control panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the console: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;500 Internal Server Error - .../resources/lib/jquery-2.2.4.min.js?d=1493300895&#xA;setcookie() expects parameter 3 to be integer, float given (/html/alte gerberei/craft/app/framework/web/CHttpRequest.php:1514)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody an idea? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5274" LastEditorUserId="1016" LastEditDate="2017-04-29T17:19:03.577" LastActivityDate="2017-05-03T07:59:21.500" Title="Can not login in the control panel: Internal Server Error 500" Tags="&lt;control-panel&gt;&lt;login&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20258" PostTypeId="1" CreationDate="2017-04-24T08:03:16.320" Score="1" ViewCount="763" Body="&lt;p&gt;I am looking at Craft Commerce (&lt;a href=&quot;https://craftcommerce.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/&lt;/a&gt;) and I am wondering if anyone has any experience using this in Craft 3? Seems like it is only for 2.x for now.  I am struggling to find any information on a Craft 3 release for Commerce. &lt;/p&gt;&#xA;" OwnerUserId="6394" OwnerDisplayName="laden" LastEditorUserId="57" LastEditDate="2017-04-28T19:24:20.800" LastActivityDate="2017-04-28T19:25:26.627" Title="Commerce plugin in Craft 3?" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20259" PostTypeId="2" ParentId="19178" CreationDate="2017-04-28T19:11:22.217" Score="1" Body="&lt;p&gt;It could be as easy as training your users to delete the slug. If you delete the slug and save the entry will update it.&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-04-28T19:11:22.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20260" PostTypeId="2" ParentId="20258" CreationDate="2017-04-28T19:25:26.627" Score="4" Body="&lt;p&gt;We haven't given a hard date for the official release of Craft other than before the end of the year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Craft 3 compatible version of Commerce (Commerce 2.0) will be released at the same time Craft 3 is officially released.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-04-28T19:25:26.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20261" PostTypeId="2" ParentId="20252" CreationDate="2017-04-28T19:53:00.997" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to have the Japanese and English version disabled by default?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. Visit &lt;em&gt;Settings -&gt; Sections -&gt; [Your Section Name]&lt;/em&gt; inside the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under the heading &lt;code&gt;Which locales should entries in this section target?&lt;/code&gt; there's a &lt;code&gt;Default Entry Status&lt;/code&gt; Lightswitch for each locale. Make sure the Lightswitches are &lt;em&gt;off&lt;/em&gt; (i.e., not green) for the English and Japanese locales, and you're all set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, you'll need to do this for any and all sections targeting the 3 locales – there's no &quot;global&quot; setting for it.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-04-28T19:53:00.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20262" PostTypeId="2" ParentId="20255" CreationDate="2017-04-28T20:45:02.830" Score="3" Body="&lt;p&gt;I finally figured this out. I was actually close. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the HTML that I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;hud-wrapper hidden&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;generate-pdf-form&quot; class=&quot;form meta&quot;&amp;gt;&#xA;        &amp;lt;form&amp;gt;&#xA;&#xA;            {% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;            {{ forms.lightswitchField({&#xA;                 class: 'docraptorize-prod-lightswitch',&#xA;                 name: 'prod-pdf',&#xA;                 on: true&#xA;            }) }}   &#xA;&#xA;            &amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;{{ &quot;Go!&quot;|t }}&quot;&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this is the corresponding JS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var $btn = $('#generate-pdf-hud'),&#xA;$form = $('#generate-pdf-form');&#xA;&#xA;$btn.on('click',function(){&#xA;    var hud = new Garnish.HUD($btn, $form, {&#xA;        orientations: ['top', 'bottom', 'right', 'left']&#xA;    });&#xA;   return false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="779" LastActivityDate="2017-04-28T20:45:02.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20263" PostTypeId="2" ParentId="20253" CreationDate="2017-04-28T22:16:48.103" Score="1" Body="&lt;p&gt;Never used the plugin, but it seems like they cover this topic in their &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/v2/docs/support/faqs#can-i-import-content-into-a-specific-locale&quot; rel=&quot;nofollow noreferrer&quot;&gt;FAQ&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I import content into a specific Locale?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastEditorUserId="37" LastEditDate="2018-11-22T00:07:05.943" LastActivityDate="2018-11-22T00:07:05.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20264" PostTypeId="1" CreationDate="2017-04-29T00:21:30.350" Score="0" ViewCount="45" Body="&lt;p&gt;I just built a membership site and created a Member Directory template which includes all users and then a Board Members Directory template which only lists users who have a &quot;Board Member Title&quot; custom user field filled out in their user profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I sort the Member Directory page by last name, but my client would like to be able to &lt;strong&gt;manually&lt;/strong&gt; sort the board members on the Board Members Directory page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In trying to keep things DRY, I like that in order to turn somebody into a board member, as an admin, I simply add content to the Board Member Title field and I'm done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Originally I was thinking of something like the old Low Reeorder used to be for EE, but haven't come across anything like that for Craft yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hoping there's an elegant solution I'm just not thinking of. Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="472" LastActivityDate="2017-04-29T00:21:30.350" Title="Manually Sorting Sub-Group of Users?" Tags="&lt;users&gt;&lt;sorting&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20265" PostTypeId="1" AcceptedAnswerId="20276" CreationDate="2017-04-29T00:27:09.023" Score="1" ViewCount="458" Body="&lt;p&gt;I downloaded and installed Craft Personal on my computer and choose /&lt;strong&gt;websitetest&lt;/strong&gt;/ as my website name. I used MAMP and phpMyAdmin to create a database.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Still to access my website the url is &lt;a href=&quot;http://localhost:8888/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888/&lt;/a&gt; and when I try to access &lt;a href=&quot;http://localhost/websitetest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/websitetest/&lt;/a&gt; I get the following error message: &lt;strong&gt;Forbidden&#xA;You don't have permission to access /websitetest/ on this server.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Moreover in my index.html file, when I call for an URL entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;href=&quot;{{ entry.url }}&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by default it redirects towards &lt;strong&gt;/websitetest/_entry&lt;/strong&gt; , which displays me the same error message, while &lt;strong&gt;localhost:8888/_entry&lt;/strong&gt; works when I test it manually!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Some ideas where can this come from?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6659" LastActivityDate="2017-04-29T18:43:00.193" Title="How do I set my siteURL instead of having http://localhost:8888/?" Tags="&lt;entry&gt;&lt;database&gt;&lt;url&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20266" PostTypeId="1" AcceptedAnswerId="20272" CreationDate="2017-04-29T03:46:32.133" Score="1" ViewCount="92" Body="&lt;p&gt;I'm setting up landing pages in Craft where someone can fill out a very basic form and get an eBook.  My idea was to have the form &lt;code&gt;/info/landing-page-title&lt;/code&gt; submit to &lt;code&gt;/info/landing-page-title/thank-you&lt;/code&gt;, where they will be given a link to download their document.  My plan was to use an if-then or switch statement in the template to check if segment(3) was populated or not.  However, I'm having a difficult time getting it to redirect to the &quot;thank-you&quot; for the same landing page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm trying to use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/{{ craft.request.getSegment(1) }}/{{ craft.request.getSegment(2) }}/thank-you&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While that will output fine on the page, the form is ignoring it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on why, or a better way to do it?&lt;/p&gt;&#xA;" OwnerUserId="5925" LastEditorUserId="1016" LastEditDate="2017-04-29T17:36:25.913" LastActivityDate="2017-04-29T18:04:36.543" Title="AMForms Action URL" Tags="&lt;plugin-amforms&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20267" PostTypeId="1" AcceptedAnswerId="20273" CreationDate="2017-04-29T08:30:45.183" Score="1" ViewCount="223" Body="&lt;p&gt;I want to glue entries together across multiple sections.  My first thought is to use fields that are entry related, like blog would have the fields news, tutorials.  The tutorials section would contain the fields news and blogs.  &lt;strong&gt;Is that the best way to glue the related entries together?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I have looked and start messing with the &lt;strong&gt;Reverse Relations Plugin&lt;/strong&gt; but I thought of something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Would it be more efficient if I used Tags instead?&lt;/strong&gt; Just not sure what the best method is.  Has anyone come up with a better solution?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-04-29T18:07:27.640" Title="Related Entries" Tags="&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20268" PostTypeId="2" ParentId="20231" CreationDate="2017-04-29T09:23:48.470" Score="0" Body="&lt;p&gt;It can be done manually with &lt;a href=&quot;https://imperavi.com/redactor/plugins/limiter/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Limiter&lt;/a&gt; javascript plugin that would be side-loaded to CP with, i.e., &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel JS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Extras&lt;/a&gt; plugin for Craft can be used, that contains and loads Redactor plugins itself.&lt;/p&gt;&#xA;" OwnerUserId="6229" LastActivityDate="2017-04-29T09:23:48.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20269" PostTypeId="1" AcceptedAnswerId="20281" CreationDate="2017-04-29T09:33:54.407" Score="0" ViewCount="160" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt; plugin to handle my Stripe payments. How could I submit this form via Ajax Post and get the response? I have tried using the following code but it tells me it's a bad request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.ajaxReq = $.ajax({&#xA;   url: 'charge/charge',&#xA;   data: $('#charge-form').serialize()&#xA;}) .done(function(data) {&#xA;   console.log('success!');&#xA;   console.log(data);&#xA;}) .fail(function(data){&#xA;   console.log(data);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="57" LastEditDate="2017-04-29T14:28:44.150" LastActivityDate="2017-04-30T22:36:08.660" Title="How could I submit the Charge plugin using Ajax?" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20272" PostTypeId="2" ParentId="20266" CreationDate="2017-04-29T14:04:39.443" Score="3" Body="&lt;p&gt;I am not a big fan of using segments for form submission pages. It's an oldschool EE habit and these are pages you don't want listed anyway so query away. Maybe just have your form success page set to &lt;code&gt;?m=thankyou&lt;/code&gt; so it appends to the current url and retains the previous segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;?m=thankyou&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your submission url's should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/info/landing-page-title?m=thankyou&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('m') == 'thankyou' %}&#xA;  do stuff, make sure this page is nofollow, check other segments etc.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-04-29T18:04:36.543" LastActivityDate="2017-04-29T18:04:36.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20273" PostTypeId="2" ParentId="20267" CreationDate="2017-04-29T14:21:40.373" Score="2" Body="&lt;p&gt;You could consider using Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries Fields(relations) are great, but sometimes not the best organizing solution depending on the project. As you can see from your original post, you're already asking the question &quot;Do I relate this to that or that to this?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd stay away from tags as they are hard to manage, prone to error, and always end up a bit of a mess.&lt;/p&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-04-29T18:07:27.640" LastActivityDate="2017-04-29T18:07:27.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20276" PostTypeId="2" ParentId="20265" CreationDate="2017-04-29T18:43:00.193" Score="2" Body="&lt;p&gt;Unless instructed otherwise, MAMP uses port 8888. You can tell it to use the &quot;default&quot; ports, which will mean the site gets served over port 80, and your URLs no longer contain &lt;code&gt;:8888&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the other issue, it sounds like you haven't set up your site's document root correctly. Either way, it's a MAMP configuration issue, not a Craft issue.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-29T18:43:00.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20278" PostTypeId="1" AcceptedAnswerId="20284" CreationDate="2017-04-30T17:12:59.020" Score="1" ViewCount="64" Body="&lt;p&gt;Okay. &lt;s&gt;I've figured it out but it left me with the question&lt;/s&gt;. After some page refreshes It's got stack back at empty output again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bad:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% for item in orders %}&#xA;    {# Following variable was the problem #}&#xA;    {% set cart = item.cart %}&#xA;    {# Loop in cart's table fields: title and quantity #}&#xA;    {% for row in cart %}&#xA;      {% set data = data|merge([{ title: row.title, quantity: row.quantity }]) %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On second page load it outputs nothing. So I simply call for a check like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in data %}&#xA;  {# for example #}{{ item.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;s&gt;Good:&lt;/s&gt;&lt;/strong&gt;&#xA;This is my current state of the code design. It's a bit extended to the original post. But a problem may be in data merging into an array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Prep array #}&#xA;{% set data = [] %}&#xA;&#xA;{% cache %}&#xA;  {% for item in orders %}&#xA;    {# Loop in cart's table fields: title and quantity #}&#xA;    {% for row in item.cart %}&#xA;      {% set data = data|merge([{ title: row.title, quantity: row.quantity }]) %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&#xA;{% set someProduct = 'someProduct' %}&#xA;{% set someOrderQuantity = 0 %}&#xA;{# Count order's quantity #}&#xA;{% for item in data %}&#xA;  {% if someProduct = item.title %}&#xA;    {% set someOrderQuantity = someOrderQuantity + item.quantity %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;Setting variable &lt;code&gt;cart&lt;/code&gt; to reuse in &lt;code&gt;orders&lt;/code&gt; loop and wrap  in &lt;code&gt;cache&lt;/code&gt; tags wasn't good idea because it outputted nothing. So I had to take &lt;code&gt;cart&lt;/code&gt; variable out. It worked out but&lt;/s&gt; I don't know why was setting variable in entries loop for another loop causing that empty output?&#xA;I properly don't know how &lt;code&gt;cache&lt;/code&gt; tags works?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2017-05-01T07:44:25.697" LastActivityDate="2017-05-01T10:08:42.163" Title="Using cache tag on array outputs nothing" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20279" PostTypeId="1" AcceptedAnswerId="20280" CreationDate="2017-04-30T20:46:43.147" Score="4" ViewCount="469" Body="&lt;p&gt;Redactor II uses Trebuchet as font, has ugly paddings, giant font sizes and other things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This must be fixed...&lt;/p&gt;&#xA;" OwnerUserId="623" LastActivityDate="2017-05-04T20:21:24.370" Title="Ugly Redactor II and how to fix it with some CSS" Tags="&lt;redactor&gt;&lt;css&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20280" PostTypeId="2" ParentId="20279" CreationDate="2017-04-30T20:46:43.147" Score="4" Body="&lt;p&gt;&lt;strong&gt;Here is my eye-friendly code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* Redactor|Fonts */&#xA;[class^=&quot;redactor-&quot;], [id^=&quot;redactor-&quot;] {&#xA;    font-family: inherit !important;&#xA;}&#xA;&#xA;/* Redactor|Toolbar */&#xA;ul.redactor-toolbar a {&#xA;    padding: 12px 13px !important;&#xA;    height: auto !important;&#xA;}&#xA;div.redactor-dropdown, ul.redactor-dropdown {&#xA;    font-size: 13px !important;&#xA;}&#xA;a.redactor-dropdown-h3 {&#xA;    font-size: 18px !important;&#xA;}&#xA;&#xA;/* Redactor|Tooltip */&#xA;span.re-button-tooltip {&#xA;    z-index: 1 !important;&#xA;    bottom: -18px !important;&#xA;    background: none !important;&#xA;    color: #333f4d !important;&#xA;    font-size: 10px !important;&#xA;}&#xA;&#xA;/* Redactor|WYSIWYG-Editor */&#xA;div.redactor-layer {&#xA;    padding: 20px !important;&#xA;    font-size: 15px !important;&#xA;    line-height: 22px !important;&#xA;}&#xA;div.redactor-layer h3 {&#xA;    font-size: 20px !important;&#xA;}&#xA;&#xA;/* Redactor|HTML-Editor */&#xA;div.redactor-box textarea.open {&#xA;    padding: 20px !important;&#xA;    border-top: 1px solid #e3e5e8 !important;&#xA;    border-left: none !important;&#xA;    border-right: none !important;&#xA;    border-bottom: none !important;&#xA;    background-color: #333f4d !important;&#xA;    color: #fff !important;&#xA;    font-size: 12px !important;&#xA;    line-height: 18px !important;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just paste it into the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel CSS&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="623" LastEditorUserId="623" LastEditDate="2017-05-01T17:32:05.073" LastActivityDate="2017-05-01T17:32:05.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20281" PostTypeId="2" ParentId="20269" CreationDate="2017-04-30T22:36:08.660" Score="1" Body="&lt;p&gt;You need to specify the HTTP method used by &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;$.ajax&lt;/code&gt; method&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, it uses &lt;code&gt;GET&lt;/code&gt;, but you need to submit the form using &lt;code&gt;POST&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-04-30T22:36:08.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20282" PostTypeId="1" AcceptedAnswerId="20296" CreationDate="2017-05-01T05:41:25.410" Score="1" ViewCount="267" Body="&lt;p&gt;I have a multi-site setup on two different domains (actually subdomains) with a single Craft install. I have modified &lt;code&gt;config/general.php&lt;/code&gt; file to make it work on both the subdomains. Each domain has different template set completely independent of each other. However, Live Preview will work on entries created for only one sub-domain (one that is specified in the control panel). The option is not available for the other subdomain. This is because the public link for the entries corresponding to second subdomain is being parsed as those belonging to the first subdomain. Obviously those links are giving 404 error and hence the Live Preview button is not active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to tell craft that certain entries belong to a specific subdomain?&lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="57" LastEditDate="2017-05-01T17:44:12.380" LastActivityDate="2017-05-01T17:44:12.380" Title="Two domains - single install - Live Preview works only on one" Tags="&lt;live-preview&gt;&lt;multi-domain&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20283" PostTypeId="2" ParentId="20253" CreationDate="2017-05-01T06:14:24.270" Score="2" Body="&lt;p&gt;I found out, what my mistake was: If you import only one locale the fields must not be mandatory, otherwise you get an error about fields (the ones in the other locale) being empty.&lt;/p&gt;&#xA;" OwnerDisplayName="user5718" LastActivityDate="2017-05-01T06:14:24.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20284" PostTypeId="2" ParentId="20278" CreationDate="2017-05-01T09:16:53.903" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag is only designed to do one thing – to capture &lt;em&gt;output&lt;/em&gt; (e.g. HTML) and store that output to the database, so that the next time Craft encounters that particular cache tag, it can serve up the cached output from the database, instead of having to run whatever code is contained inside the &lt;code&gt;{% cache %}&lt;/code&gt; tag pair, on every pageload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your code, you're attempting to cache a &lt;em&gt;variable&lt;/em&gt; (&lt;code&gt;data&lt;/code&gt;). That won't work. Essentially, you're just feeding the &lt;code&gt;{% cache %}&lt;/code&gt; tag empty output, and the code that actually sets the &lt;code&gt;data&lt;/code&gt; variable will only run on the first pageload (or whenever the cache has been cleared out). On subsequent pageloads, Craft won't bother to actually run the code inside the &lt;code&gt;{% cache %}&lt;/code&gt; tag, it'll simply print whatever output was stored for that particular cache (which, in this case, is empty). Hence your code breaking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do, is to revise your caching strategy so that your business logic (i.e. the part of your code that pulls and operates on data – which is usually the expensive part, resource-wise) and the part that actually &lt;em&gt;prints&lt;/em&gt; your data is contained within the same &lt;code&gt;{% cache %}&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a small example to illustrate good vs. bad use of the &lt;code&gt;{% cache %}&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bad&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% set entries = craft.entries.section('news') %}&#xA;{% endcache %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;^ Ouch. The variable &lt;code&gt;entries&lt;/code&gt; will only be set whenever the cache is empty; on subsequent pageloads, Craft will serve up an empty, cached string instead of actually running the &lt;code&gt;craft.entries&lt;/code&gt; query and the &lt;code&gt;for&lt;/code&gt; loop will fail because it'll operate on a variable that isn't set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;&#xA;    {% set entries = craft.entries.section('news') %}&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;^ Awesome. The page will probably be served a bit faster because Craft doesn't have to pull the entries and compile the HTML for every pageload – it'll just spit out the output resulting from the code within the &lt;code&gt;{% cache %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-05-01T10:08:42.163" LastActivityDate="2017-05-01T10:08:42.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20285" PostTypeId="1" CreationDate="2017-05-01T09:38:46.287" Score="1" ViewCount="70" Body="&lt;p&gt;The system I'm building requires a flexible taxonomy, where users should be able to add new taxonomy stuff to entries really easy and freely as soon as the need arises. So tags seem to work best for this situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there's a usability issue I'm concerned about. And that's a lot of typing, potential typos, and general &quot;closeness&quot; of what's already available to users (existing tags already added by users)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would ideally like is a tag field, which would still allow standard entry, but which also has a checkbox list of all existing tags as well - so users could just quick check tags they want to add to an entry - without typing anything - and add any extra tags manually only when these are needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would something like that be possible to implement in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The system will be an internal one, so there's no worry about too many users adding too many tags. Eventually, every single required tag will be created at some point, and users will be able to just choose from checkboxes - that's the ideal vision of how things would work on the data entry side)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;" OwnerUserId="6662" LastActivityDate="2017-05-01T16:48:52.250" Title="Is it possible to allow a user choose tags in admin panel using checkboxes?" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;tags&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20286" PostTypeId="1" CreationDate="2017-05-01T13:47:48.313" Score="1" ViewCount="119" Body="&lt;p&gt;I set up my first Craft site on my shared hosting and I can't get it to work for the life of me. Whatever I do, I run into a 404 error. .htaccess is there and named correctly, craft folder is one level up as it should be. &#xA;What I noticed is that it briefly works after setting the correct permissions on the craft files and folders. A couple of clicks later the permissions seem to reset again back to 755. &#xA;I haven't had this problem with my hosting before, so I am unsure if this is a craft problem? Or if the permissions even are the cause?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: It doesn't appear to be a permission problem after all. Filezilla shows 755, although the permissions are set to 744. So now I'm at a total loss what the issue could be.... I can't even complete the installation because it stops working beforehand.&#xA;Tried several times more and got it installed. Just before it goes wrong again, I can see that it doesn't load the site properly, e.g. the login screen looks weird. Has anyone seen this before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gZcnz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gZcnz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6663" LastEditorUserId="6663" LastEditDate="2017-05-01T15:27:56.553" LastActivityDate="2017-05-01T15:46:34.240" Title="Can't get rid of 404 error" Tags="&lt;404&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20287" PostTypeId="1" AcceptedAnswerId="20290" CreationDate="2017-05-01T14:25:35.813" Score="2" ViewCount="980" Body="&lt;p&gt;I'm working on a site with a structure containing products that are nested within &quot;category&quot;(not actually using craft's categories, just an entry type) pages. On each category or sub-category page I display each product within as a card with an image and title. The image is selected/uploaded from an asset field on the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the interest of making the image folders as clean as possible I'm trying to set the asset upload locations based on the path of the entry it is uploaded from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: I have a product at the following location: &lt;code&gt;mysite.dev/products/doors/wood&lt;/code&gt;. When I upload the image to be used in the product list view I'd like the path to be &lt;code&gt;mysite.dev/assets/img/products/doors/wood/imagefilename.jpg&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My default image upload location is set to &lt;code&gt;mysite.dev/assets/img/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple method I have missed in the documentation to pull the path of the entry as the asset field upload location? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it necessary to make a loop to go through the parent entries' slugs one by one, and if so what is my point of reference when creating the loop? Am I acting on the asset or the entry when I use a variable like &lt;code&gt;{slug}&lt;/code&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm tinkering with it and testing, but it is tedious since I must upload the image each time I try something new, and I feel like I might have missed something in the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a bit more tinkering I was able to get something that almost works. By setting upload location with the Images location in the dropdown and then &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt; I get something like &lt;code&gt;mysite.dev/assets/img/doors/wood/imagefilename.jpg&lt;/code&gt;. This is missing the structure slug &lt;code&gt;products&lt;/code&gt; at the beginning. &lt;/p&gt;&#xA;" OwnerUserId="6047" LastEditorUserId="6047" LastEditDate="2017-05-01T14:49:17.583" LastActivityDate="2017-05-01T15:07:19.687" Title="What is the proper way to set an asset's upload location using the slugs/ structure path of the entry it is selected from?" Tags="&lt;assets&gt;&lt;variable&gt;&lt;assetfilemodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20289" PostTypeId="2" ParentId="20286" CreationDate="2017-05-01T15:05:38.103" Score="1" Body="&lt;p&gt;Do you happen to be on Dreamhost? I had a site there recently where they changed my permissions &quot;for my own good&quot;. &lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2017-05-01T15:05:38.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20290" PostTypeId="2" ParentId="20287" CreationDate="2017-05-01T15:05:55.370" Score="3" Body="&lt;p&gt;To include the handle of the slug, and the path within the structure based on the entry uploaded from in the upload location field I've found the following to work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{section.handle}/{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are any gotchas on this let me know and I'll edit this answer to include them.&lt;/p&gt;&#xA;" OwnerUserId="6047" LastActivityDate="2017-05-01T15:05:55.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20291" PostTypeId="2" ParentId="20287" CreationDate="2017-05-01T15:07:19.687" Score="2" Body="&lt;p&gt;Assuming your Structure section is named Products with a handle of &lt;code&gt;products&lt;/code&gt; you could try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{section.handle}/{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you would have to restructure your entries to have a parent entry of Products.&lt;/p&gt;&#xA;" OwnerUserId="3951" LastActivityDate="2017-05-01T15:07:19.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20292" PostTypeId="2" ParentId="20286" CreationDate="2017-05-01T15:46:34.240" Score="1" Body="&lt;p&gt;Could be Apache's &lt;code&gt;mod_security&lt;/code&gt; module being overzealous. &lt;code&gt;mod_security&lt;/code&gt; tends to throw down its gauntlet especially when it sees lots of files being created or thrown around (for example when installing something). The module is commonly used on shared providers to mitigate common hacking attempts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want throw this in your &lt;code&gt;.htaccesss&lt;/code&gt; file and see what happens. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_security.c&amp;gt;&#xA;  SecFilterEngine Off&#xA;  SecFilterScanPOST Off&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This effectively turns off &lt;code&gt;mod_security&lt;/code&gt;. You may also have to ping your host and ask them if it's on and to turn it off manually for you since some hosts don't allow it to be disabled in &lt;code&gt;.htaccess&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd hazard a guess and say Craft may not be completely installed either, especially if it is &lt;code&gt;mod_security&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-05-01T15:46:34.240" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20293" PostTypeId="1" AcceptedAnswerId="20304" CreationDate="2017-05-01T15:48:41.587" Score="2" ViewCount="192" Body="&lt;p&gt;I just moved a site over to a Windows server, and my homepage loads fine, but sub pages are not loading. I just get an error message that the connection was reset. Adding index.php to the url doesn't do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My control panel is also loading fine, it's just the sub-pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really have any experience with Windows servers, so I'm not sure how to go about troubleshooting this. I'm using the standard craft web.config file. Is there a config setting I need to add?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="57" LastEditDate="2017-05-01T19:31:53.467" LastActivityDate="2017-05-02T14:19:06.857" Title="Sub-pages not loading on Windows server" Tags="&lt;server&gt;&lt;installation&gt;&lt;windows&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20294" PostTypeId="2" ParentId="20175" CreationDate="2017-05-01T16:24:17.433" Score="1" Body="&lt;p&gt;You can set the &lt;code&gt;COMMERCE_PAYMENT_CURRENCY&lt;/code&gt; in your index.php file. This defaults the &lt;code&gt;order.paymentCurrency&lt;/code&gt;. The price attributes on the order are still stored in the primary store currency so you will still need to convert to the current payment currency with the &lt;code&gt;commerceCurrency&lt;/code&gt; filter: &lt;a href=&quot;https://craftcommerce.com/docs/twig-filters#commercecurrency&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/twig-filters#commercecurrency&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-05-01T16:24:17.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20295" PostTypeId="2" ParentId="20285" CreationDate="2017-05-01T16:26:32.343" Score="1" Body="&lt;p&gt;Any reason why you'd choose &lt;a href=&quot;https://craftcms.com/features/categories-and-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;tags over categories&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories seem to be more of what you're describing:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Eventually, every single required tag will be created at some point.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And since Craft 2.5, authors can easily create categories right in the Entry screen as well as pick the category they want if it's already created. No manual typing required if it already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tags are usually &lt;em&gt;looser&lt;/em&gt; approximations of the content and are considered by content strategists to be more of a &quot;folksonomy&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to push forward with checkboxes as tags, you could probably create a custom field that spits out all the tags as checkboxes, along with a way to add new ones. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-05-01T16:48:52.250" LastActivityDate="2017-05-01T16:48:52.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20296" PostTypeId="2" ParentId="20282" CreationDate="2017-05-01T17:43:46.440" Score="3" Body="&lt;p&gt;In order to get Live Preview to work across different subdomains on a single install, you'll need to setup a few extra things as outlined in this support article: &lt;a href=&quot;https://craftcms.com/support/cross-domain-live-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/cross-domain-live-preview&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-01T17:43:46.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20297" PostTypeId="1" CreationDate="2017-05-02T00:33:24.650" Score="1" ViewCount="124" Body="&lt;p&gt;How do I create a dropdown menu that filters all the posts into month and year, and then link to a template that has the entries of that month and year displayed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as far as I've gotten:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;fieldset&amp;gt;&#xA;    {# Use the `group` filter to get the years, entries were posted in #}&#xA;    {% set entries = craft.entries.section('blog') %}&#xA;    {% set entriesByYear = entries|group('postDate|date(&quot;F Y&quot;)') %}&#xA;    &amp;lt;select name=&quot;year&quot;&amp;gt;&#xA;        {# Go through the `year` groups #}&#xA;        {% for year, entries in entriesByYear %}&#xA;            &amp;lt;option value=&quot;{{ year }}&quot;&amp;gt;{{ year }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get the month and year to display in a dropdown using the code I found above, now I just need to get those elements to link to the corresponding template file. I have my Route setup as 'blog/year/month' and a template setup as well.&lt;/p&gt;&#xA;" OwnerUserId="6665" LastEditorUserId="45" LastEditDate="2017-05-02T05:13:24.277" LastActivityDate="2017-05-02T05:13:24.277" Title="How to create an archive dropdown menu" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;archives&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20298" PostTypeId="1" CreationDate="2017-05-02T02:20:19.680" Score="1" ViewCount="96" Body="&lt;p&gt;Let's say I have a bunch of &lt;strong&gt;Craft entries&lt;/strong&gt; and &lt;strong&gt;Craft users&lt;/strong&gt; that I need to relate to &lt;strong&gt;another custom database table&lt;/strong&gt;. How would one approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I be correct in thinking that my plugin will need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom element type which ties back to this custom database table&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom field type, based on an existing field type such as &lt;code&gt;EntriesFieldType.php&lt;/code&gt; and is able to handle the GUI actions for creating the relationship&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply that field type to any edit forms which need to relate to my custom table&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there anything I'm missing, or any gotchas in implementing the above?&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-05-02T02:20:19.680" Title="Relating entries/users with a custom element (or custom database table)" Tags="&lt;relations&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20300" PostTypeId="1" CreationDate="2017-05-02T06:30:08.473" Score="2" ViewCount="49" Body="&lt;p&gt;Can profile fields be limited to user groups in backend? It seems that if you want required front end fields for users registering then admins in backend have to have these as compulsory when creating admin accounts.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="22" LastEditDate="2017-05-09T22:33:03.833" LastActivityDate="2017-06-09T00:39:41.223" Title="limiting profiles to user groups" Tags="&lt;control-panel&gt;&lt;user-profile&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20301" PostTypeId="2" ParentId="4553" CreationDate="2017-05-02T09:01:50.617" Score="10" Body="&lt;p&gt;&lt;strong&gt;UPDATE: This is not necessary to do when using Commerce 2.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I modified Michael's answer to add support for query strings + make it nicer to check for multiple routes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( !function_exists('isApiRequest') ) {&#xA;    function isApiRequest ()&#xA;    {&#xA;        $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);&#xA;        $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);&#xA;&#xA;        $actions = [&#xA;            'actions/charge/webhook/callback',&#xA;            'actions/commerce/payments/completePayment',&#xA;            'actions/some/other/action',&#xA;            'actions/commerce/webhooks/process-webhook'&#xA;&#xA;    ];&#xA;&#xA;    foreach ($actions as $action) {&#xA;            if ( strpos($path, $action) || strpos($query, $action) ) {&#xA;                return true;&#xA;            }&#xA;        }&#xA;&#xA;    return false;&#xA;    }&#xA;}&#xA;&#xA;return [&#xA;&#xA;    // ...other configs...&#xA;&#xA;    'enableCsrfProtection' =&amp;gt; !isApiRequest(),&#xA;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastEditorUserId="9" LastEditDate="2019-05-02T11:30:26.027" LastActivityDate="2019-05-02T11:30:26.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20302" PostTypeId="1" CreationDate="2017-05-02T11:41:35.717" Score="0" ViewCount="98" Body="&lt;p&gt;so I am using trying to use the Imager plugin to compress my images. It works fine this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set imagePath = &quot;/path/to/img.jpg&quot; %}&#xA;    {% set compressed = craft.imager.transformImage(imagePath, { pngCompressionLevel: 9, webpQuality: 10, jpegQuality: 50 }) %}&#xA;    &amp;lt;img src=&quot;{{ compressed }}&quot; alt=&quot;Foto-kantoor&quot; class=&quot;img-max img-responsive wow fadeIn&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I try to use it inside a &lt;code&gt;{% for %}&lt;/code&gt; loop it doesn't work and I get an error. Here's the code Im trying to use:      &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in logos %}&#xA;    {% if image %}&#xA;        &amp;lt;div class=&quot;img-frame&quot;&amp;gt;&#xA;            {% set compressed = craft.imager.transformImage(image, { pngCompressionLevel: 9, webpQuality: 10, jpegQuality: 50 }) %}&#xA;            &amp;lt;img src=&quot;{{ compressed.url }}&quot; alt=&quot;Logo-{{ loop.index0 }}&quot; class=&quot;img-responsive logo-img&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to open image /Applications/MAMP/htdocs/project/files/logos/my-logo.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what Im doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2017-05-02T11:41:35.717" Title="Imager plugin not working inside the loop" Tags="&lt;plugins&gt;&lt;forloop&gt;&lt;plugin-imager&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20303" PostTypeId="1" CreationDate="2017-05-02T14:01:51.987" Score="1" ViewCount="278" Body="&lt;p&gt;Does anyone know how to output a checkbox or Radio Button Group with A+M Forms using the custom HTML option?  I'm assuming it's some kind of loop through the available options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My static HTML looks like below and i'd like to retain the structure if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row checkboxes&quot;&amp;gt;&#xA; &amp;lt;label for=&quot;sector&quot;&amp;gt;&#xA;  &amp;lt;span class=&quot;label&quot;&amp;gt;Choose your class type&amp;lt;/span&amp;gt;&#xA;  &amp;lt;div class=&quot;floatCheck&quot;&amp;gt;&#xA;   &amp;lt;div&amp;gt;&amp;lt;input type=&quot;checkbox&quot; value=&quot;personal&quot; tabindex=&quot;4&quot;&amp;gt;&amp;lt;span&amp;gt;One to One Class&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;   &amp;lt;div&amp;gt;&amp;lt;input type=&quot;checkbox&quot; value=&quot;business&quot; tabindex=&quot;5&quot;&amp;gt;&amp;lt;span&amp;gt;Business Class&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;   &amp;lt;div&amp;gt;&amp;lt;input type=&quot;checkbox&quot; value=&quot;smallgroup&quot; tabindex=&quot;6&quot;&amp;gt;&amp;lt;span&amp;gt;Small Group&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA; &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="189" LastActivityDate="2017-09-12T22:03:05.540" Title="Output Radio or Checkboxes with A+M Forms" Tags="&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20304" PostTypeId="2" ParentId="20293" CreationDate="2017-05-02T14:19:06.857" Score="2" Body="&lt;p&gt;Figured it out. Config was set to force https, but the new server didn't have an ssl certificate set up. Fixing that cleared up the issue.&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-05-02T14:19:06.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20305" PostTypeId="1" CreationDate="2017-05-02T17:02:54.873" Score="3" ViewCount="84" Body="&lt;p&gt;I have an event that runs from Monday to Sunday from 9am to 6am but on Thursday the time is from 9m to 8pm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add repeat dates with diffrent time for Thursday?&lt;/p&gt;&#xA;" OwnerUserId="6669" LastActivityDate="2017-07-31T12:16:02.890" Title="Is it possible to create event with multiple date/time (out of box)" Tags="&lt;datetime&gt;&lt;events&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20306" PostTypeId="2" ParentId="20300" CreationDate="2017-05-02T21:13:11.887" Score="1" Body="&lt;p&gt;Custom fields are attached to Users, not User Groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like you'd be able to do what you want on the template side, though.  i.e. something like &quot;if user is in group A, show field B, otherwise hide it&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or perhaps something like the &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reasons plugin&lt;/a&gt; is the way to go, which adds conditionals to fields/field layouts.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-02T21:13:11.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20307" PostTypeId="1" AcceptedAnswerId="20314" CreationDate="2017-05-03T03:02:00.750" Score="2" ViewCount="232" Body="&lt;p&gt;Notification emails keep failing to send if I have multiple addresses set. I've tried comma separated with and without a space after, both fail the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error in the craft.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Email error: Invalid address: (addAnAddress to): blah@stuff.com,things@stuff.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error in the commerce.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Forced] Email “New Order - Admin” could not be sent for order “a713f1d”. Errors:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6404" LastActivityDate="2017-05-03T11:18:54.153" Title="Commerce: notification emails to multiple custom recipients fails" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20308" PostTypeId="1" AcceptedAnswerId="20321" CreationDate="2017-05-03T05:16:24.423" Score="1" ViewCount="154" Body="&lt;p&gt;Things were fine (no session logout for admin from CP) when there was only one EC2 instance for our website.&#xA;I created a replica of the existing EC2 instance and now when I go to Control Panel, session keeps getting expired every 30 seconds.&#xA;Please help me out in order to resolve the issue.&#xA;Also, what are the things I should keep in mind when I'm using multiple EC2 instances for Craft website.&lt;/p&gt;&#xA;" OwnerUserId="6672" LastEditorUserId="57" LastEditDate="2017-05-03T17:58:56.997" LastActivityDate="2017-07-24T16:40:08.347" Title="With two EC2 Craft instances, the Control Panel session keeps expiring" Tags="&lt;control-panel&gt;&lt;multi-environment&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20309" PostTypeId="1" CreationDate="2017-05-03T06:43:45.593" Score="0" ViewCount="159" Body="&lt;p&gt;I have an image grid for my articles, and its sorted by the type of articles. So all the articles of a certain type is all put in the same item grid, but I want to sort it after the brand aswell by having my image grid sort under a logo of the brand. So if I have 2 different brands of 1 type of article, I want 2 image grids on the same page, neatly sorted under their respective logo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;widewrapper weak-highlight&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;container content&quot;&amp;gt;       &#xA;    {% for entry in entry.children %}&#xA;    {% if entry.type==&quot;lift&quot; and entry.liftMerke==&quot;nifty&quot; %}&#xA;    &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;        &amp;lt;img class=&quot;img-responsive&quot; src=&quot;/uploads/images/logo-brand1&quot; alt=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        {% for entry in entry.children %}&#xA;        {% if entry.type==&quot;lift&quot; and entry.liftMerke==&quot;nifty&quot; %}               &#xA;        &amp;lt;div class=&quot;showroom-item col-sm-4 col-md-3 col-lg-3&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                {% set bilde = entry.bilde.one() %}&#xA;                {% if bilde %}&#xA;                &amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ bilde.geturl('fremsideKnapper') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;                {% endif %}&#xA;                &amp;lt;a class=&quot;overlay&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                     &amp;lt;i class=&quot;glyphicons search&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                     &amp;lt;div class=&quot;name&quot;&amp;gt;&amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Arbeidshøyde: {{ entry.arbeidshoyde }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;                &amp;lt;a &#xA;                    href=&quot;{{ entry.url }}&quot; &#xA;                    class=&quot;btn btn-default btn-gantic btn-xs btn-block&quot;&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ entry.title }} | {{ entry.arbeidshoyde }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;                    &#xA;       {% endif %}&#xA;       {% endfor %}            &#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;    {% endfor %}  &#xA;    &amp;lt;div class=&quot;clearfix&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this gives me just a whole bunch of logos whitch is not what I want. Is there something I can do to make it search through the entry.children articles, and do something only once(print logo) if something is true for either one of the articles? Really appreciate any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have been playing around with this abit now, but I cant really get it to work. I forgott to mention something inportant in my post aswell, I am using craft3 beta. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am abit unsure if the errors I am encountering are me not really understanding what I am doing or if it is related to differences between craft 2 and 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a catogory group(liftmerker) and two catogories(denka, nifty). I added a image field(image field is called &quot;bilde&quot;) to the catogories where I uploaded the logos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the code looks like at the monent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;widewrapper weak-highlight&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;container content&quot;&amp;gt;       &#xA;    {% set entries = entry.children | group( 'entryCategory.one().title' ) %}&#xA;    {% set brands = craft.categories.group( 'liftmerker' ).titles %}&#xA;    {% for brand in brands %}&#xA;        {% set brandEntries = entries[ '' ~ category ] | default( [] ) %}&#xA;        {% if brandEntries | length %}&#xA;        &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ brand.bilde.first.url }}&quot; alt=&quot;{{ brand.first.title }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            {% for entry in brandEntries %}&#xA;                ...&#xA;            {% endfor %}        &#xA;    &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    &amp;lt;div class=&quot;clearfix&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me an error that I dont really understand:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TypeError&#xA;Argument 1 passed to craft\web\twig\Extension::groupFilter() must be of the type array, object given, called in /home/vagrant/Code/Gantic/Gantic3/storage/runtime/compiled_templates/c3/c383e9d48f1c478076ea5c1b97037f5aa9b4242fb3b6dcb877a0488b0b8b32b7.php on line 114&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions for what I can do different or what line in the code is causing the error?&lt;/p&gt;&#xA;" OwnerUserId="6394" LastEditorUserId="6394" LastEditDate="2017-05-03T10:43:02.287" LastActivityDate="2017-05-03T10:43:02.287" Title="is it posible to have dynamic Title for my article image grid?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2017-05-03T19:18:07.683" ContentLicense="CC BY-SA 3.0" />
  <row Id="20310" PostTypeId="2" ParentId="20309" CreationDate="2017-05-03T07:36:20.387" Score="2" Body="&lt;p&gt;I hope I got your issue right. For the brand I'd use a category. So each article can be assigned to a category brand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then group your entries by category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Save entries, group by category #}&#xA;{% set entries = entry.children | group( 'entryCategory.first().title' ) %}&#xA;&#xA;{# Get all category logos for the category group &quot;yourEntryCategoryHandle&quot; #}&#xA;{% set brands = craft.categories.group( 'yourBrandCategoryHandle' ).titles %}&#xA;&#xA;{# Loop through the category title array #}&#xA;{% for brand in brands %}&#xA;&#xA;    {# Get the entries grouped under the current brand title #}&#xA;    {% set brandEntries = entries[ '' ~ category ] | default( [] ) %}&#xA;&#xA;    {# Print the category title and entries #}&#xA;    {% if brandEntries | length %}&#xA;    &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;        &amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ brand.image.first.url }}&quot; alt=&quot;{{ brand.image.first.title }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        {% for entry in brandEntries %}&#xA;            ...&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a modification from this issue: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9212/how-do-i-group-entries-by-category-and-retain-fixed-category-order&quot;&gt;How Do I group entries by Category and retain fixed Category Order?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6673" LastActivityDate="2017-05-03T07:36:20.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20311" PostTypeId="2" ParentId="20256" CreationDate="2017-05-03T07:59:21.500" Score="1" Body="&lt;p&gt;The error was caused by the configuration in general.php, which works fine local and on three other websites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For production environment, I added &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'userSessionDuration' =&amp;gt; 'P101Y',&#xA;'rememberedUserSessionDuration' =&amp;gt; 'P101Y',&#xA;'rememberUsernameDuration' =&amp;gt; 'P101Y',&#xA;'invalidLoginWindowDuration' =&amp;gt; 'P101Y',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I removed it and can login in the cp - no idea why.&lt;/p&gt;&#xA;" OwnerUserId="5274" LastActivityDate="2017-05-03T07:59:21.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20312" PostTypeId="1" CreationDate="2017-05-03T09:51:27.243" Score="1" ViewCount="42" Body="&lt;p&gt;Is it possible to output whole playlists in the videos plugin by Dukt?&#xA;I have looked through the docs, but cannot see any examples or mention of this. But in the back-end system there are playlists.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-05-03T18:48:17.257" Title="Output play lists in Videos by Dukt" Tags="&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20313" PostTypeId="1" CreationDate="2017-05-03T10:11:56.540" Score="1" ViewCount="550" Body="&lt;p&gt;I'm uploading a site to a new environment and getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LGAYO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LGAYO.png&quot; alt=&quot;error message&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The assetfiles table structure:&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vrlLo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vrlLo.png&quot; alt=&quot;The assetfiles table structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2017-05-03T11:23:07.363" LastActivityDate="2017-05-03T18:05:24.653" Title="SQL Error - cannot add foreign key constraints" Tags="&lt;error-message&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20314" PostTypeId="2" ParentId="20307" CreationDate="2017-05-03T11:18:54.153" Score="3" Body="&lt;p&gt;I've run into the same issue and reported it to Craft Commerce support at the beginning of April. It was acknowledged to be a bug: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;At the moment we are only able to support a single email address in&#xA;  the custom 'TO' field.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and improving it was added to their TODO list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use BCC field (with email addresses separated by comma or semicolon) to send notification email to multiple recipients or you can create multiple emails (hooked up to the same template and status) - one for each custom email address.&lt;/p&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2017-05-03T11:18:54.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20315" PostTypeId="1" AcceptedAnswerId="20317" CreationDate="2017-05-03T13:36:10.620" Score="0" ViewCount="340" Body="&lt;p&gt;I am evaluating different CMS. I need to know if Craft CMS supports these features:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Preview function for different devices, screen sizes and screen configurations(portrait/landscape)&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to publish only a subset of my website?&lt;/li&gt;&#xA;&lt;li&gt;Is lazy loading supported? E.g. loading images on scrollto?&lt;/li&gt;&#xA;&lt;li&gt;Does a frontend created with Craft CMS use much .js code? Can I minimize the amount of .js code (for performance reasons)?&lt;/li&gt;&#xA;&lt;li&gt;Is mobile first approach supported?&lt;/li&gt;&#xA;&lt;li&gt;Are URLs SEO-friendly?&lt;/li&gt;&#xA;&lt;li&gt;Can I integrate Onsite-Banners from external Ad servers?&lt;/li&gt;&#xA;&lt;li&gt;Does the cms contain Digital Asset Management?&lt;/li&gt;&#xA;&lt;li&gt;Which media file types are supported?&lt;/li&gt;&#xA;&lt;li&gt;Is there any REST API provided?&lt;/li&gt;&#xA;&lt;li&gt;Does the CMS internal search engine support synonyms and how about the error tolerance?&lt;/li&gt;&#xA;&lt;li&gt;Can I login to the CMS on mobile devices? Do I have good usability when doing so?&lt;/li&gt;&#xA;&lt;li&gt;Do I upload high resolution images and later on these are generated and maybe compressed for target devices?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6674" LastActivityDate="2017-05-03T13:57:04.970" Title="Does Craft CMS support these features?" Tags="&lt;performance&gt;&lt;craft-features&gt;&lt;responsive-images&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2017-05-03T19:22:30.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="20316" PostTypeId="2" ParentId="20245" CreationDate="2017-05-03T13:51:35.027" Score="1" Body="&lt;p&gt;Are the craft users' e-mail addresses on the same domain as the hosting is running? I've ran into the issue before that the server just &quot;delivers&quot; the e-mail to the local hosting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if your site is running on example.com:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;user1@example2.com - goes through&lt;br&gt;&#xA;user2@example.com - doesn't go through - gets &quot;delivered&quot; to local server's inbox&lt;/p&gt;&#xA;" OwnerUserId="6675" LastActivityDate="2017-05-03T13:51:35.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20317" PostTypeId="2" ParentId="20315" CreationDate="2017-05-03T13:57:04.970" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Preview function for different devices, screen sizes and screen&#xA;  configurations(portrait/landscape)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes it has live preview. However this isn't per device. You can open the entry with a secret url and then user your browser tools to check different devices&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to publish only a subset of my website?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, each entry can be turned on or off&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is lazy loading supported? E.g. loading images on scrollto? Does a&#xA;  frontend created with Craft CMS use much .js code? Can I minimize the&#xA;  amount of .js code (for performance reasons)? Is mobile first approach&#xA;  supported? Are URLs SEO-friendly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, it's all how you code it. You can do whatever you want. Craft makes no assumptions or requirements&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I integrate Onsite-Banners from external Ad servers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes code as you want&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does the cms contain Digital Asset Management? Which media file types&#xA;  are supported?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, full list &lt;a href=&quot;https://craftcms.com/docs/assets-fields#restricting-allowed-file-types&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any REST API provided? Does the CMS internal search engine&#xA;  support synonyms and how about the error tolerance?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I login to the CMS on mobile devices? Do I have good usability&#xA;  when doing so?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes you do. I've done this myself and it was easy to move around&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do I upload high resolution images and later on these are generated&#xA;  and maybe compressed for target devices?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes you can and then you can set transforms to crop/resize/compress as you want. Targetting per device that all depends on your html.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-05-03T13:57:04.970" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20318" PostTypeId="1" CreationDate="2017-05-03T15:04:04.033" Score="2" ViewCount="83" Body="&lt;p&gt;We're having trouble uploading PNG-8s. PNG-24s and JPGs work fine, but after selecting a PNG-8 to upload, the progress bar appears and fills to max in a couple of seconds, but then hangs indefinitely. Sometimes a message appears saying &quot;Upload failed for 'filename.jpg'&quot;, sometimes it just hangs with no error message. If we then refresh the page, the image is in the assets list but no thumbnail has been created for it. The PHP error log gets this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[03-May-2017 14:03:48 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home/sitename/webapps/sitename/craft/app/vendor/pixelandtonic/imagine/lib/Imagine/Imagick/Image.php on line 313&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We could of course make them all PNG-24s but the file size is often way higher. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're on Craft 2.6.2958, and the assets are on Amazon S3. Any advice on how to diagnose this would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2017-08-01T20:52:15.713" Title="PNG-8 upload to S3 hangs" Tags="&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20319" PostTypeId="1" AcceptedAnswerId="20538" CreationDate="2017-05-03T16:25:12.377" Score="2" ViewCount="352" Body="&lt;p&gt;I have a template element that is used on almost every page of the site. I would like to cache that element globally, except on one particular page I would like it to just be a normal cache based on the page URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current code I'm using is below, which is not working as intended. The global cache is still working on entry id 126.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key 'entry_' ~ entry.id ~ '_elements' unless entry is not defined or entry.id == '126' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to make that functionality work without slowing down any other pages? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2017-05-19T18:08:42.630" Title="How to Cache Globally Except for One Page" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20320" PostTypeId="1" AcceptedAnswerId="20328" CreationDate="2017-05-03T16:44:03.220" Score="1" ViewCount="724" Body="&lt;p&gt;I'm working for the first time with Craft Commerce and trying to create product types. So far so good, now I have three product types: &quot;Inspiration&quot;, &quot;Gift&quot; and &quot;New&quot;. I need the URL of these three product types and don't know how to create it... actually the URL is &lt;code&gt;shop/products&lt;/code&gt; with all products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need &lt;code&gt;shop/inspiration&lt;/code&gt; with the inspiration products, &lt;code&gt;shop/gift&lt;/code&gt; with the gift products and shop/new with the new products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;{{ productType.name }}&lt;/code&gt; I can show all my product types, but how can I show the URL of product types?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;  {{ productType.name }}&amp;lt;br&amp;gt;&#xA;    {% for product in craft.commerce.products.type(productType.handle).find() %}&#xA;      {{ product.url }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or do I need to create these product types as categories?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope you guys can help me!&lt;/p&gt;&#xA;" OwnerUserId="6204" LastEditorUserId="57" LastEditDate="2017-05-03T19:20:40.647" LastActivityDate="2017-05-03T23:44:25.217" Title="Craft Commerce - Product Types URL" Tags="&lt;plugin-craftcommerce&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20321" PostTypeId="2" ParentId="20308" CreationDate="2017-05-03T17:56:00.407" Score="1" Body="&lt;p&gt;Easiest solution: if AWS supports &quot;sticky sessions&quot; at the load balancer level, then you should enable to to ensure that the user gets sent back to the same EC2 instance that their session was created on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next easiest: create an NFS share and use &lt;a href=&quot;https://secure.php.net/manual/en/function.session-save-path.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://secure.php.net/manual/en/function.session-save-path.php&lt;/a&gt; on all EC2 shares so all EC2 instances read/write to the same place.  You'd also want to set the Craft &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow noreferrer&quot;&gt;appId&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;nofollow noreferrer&quot;&gt;validationKey&lt;/a&gt; config settings to be consistent across all of the EC2 instances.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-05-05T21:30:46.233" LastActivityDate="2017-05-05T21:30:46.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20322" PostTypeId="2" ParentId="20313" CreationDate="2017-05-03T18:05:24.653" Score="1" Body="&lt;p&gt;Based on that description, my guess is you're running into #2 here (&lt;a href=&quot;https://stackoverflow.com/a/16969176/684&quot;&gt;https://stackoverflow.com/a/16969176/684&lt;/a&gt;) and you've got some inconsistent data in one of the three foreign key constraints that the SQL is trying to add.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-05-03T18:05:24.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20323" PostTypeId="2" ParentId="20312" CreationDate="2017-05-03T18:48:17.257" Score="2" Body="&lt;p&gt;The plugin is only showing the playlists in the CP, in the Videos explorer, to help you pick a video to be used in a video field. It is not currently possible to list playlists and their videos from the templates, but it’s on our list of things to explore for Videos 2.0.&lt;/p&gt;&#xA;" OwnerUserId="164" LastActivityDate="2017-05-03T18:48:17.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20324" PostTypeId="2" ParentId="20318" CreationDate="2017-05-03T19:15:13.267" Score="1" Body="&lt;p&gt;To fix that particular error, you'd need to bump your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;nofollow noreferrer&quot;&gt;max_execution_time&lt;/a&gt; setting to something higher than 30 seconds to allow more time for the request to complete.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-03T19:15:13.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20325" PostTypeId="1" CreationDate="2017-05-03T19:17:40.457" Score="1" ViewCount="1116" Body="&lt;p&gt;I'll start with I know very little about CraftCMS...inherited this project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems to run well except recently I started getting these types of errors (see below). Secondly the CP assets and users template is failing to load as well. This site runs fine on my local so to me this seems like a server-side config/permission/phpversion change, or other unknown. Looking for some advice on the next dart to throw in the dark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I know that the twig template is where it suppose to be so HIGH LEVEL I'm wondering if this might be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A: a server permission error&#xA;B: an issue related to not being able to delete template caches, ongoing issue...not new.&#xA;C: A configuration/pathing error&#xA;D: PHP version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/05/03 15:55:11 [error] [exception.Craft\TemplateLoaderException] Craft\TemplateLoaderException: Unable to find the template “includes/form.twig” in &quot;_includes/contentForm&quot; at line 4. in /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/twigextensions/TemplateLoader.php:124&#xA;Stack trace:&#xA;#0 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/twigextensions/TemplateLoader.php(71): Craft\TemplateLoader-&amp;gt;_findTemplate('includes/form.t...')&#xA;#1 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Environment.php(329): Craft\TemplateLoader-&amp;gt;getCacheKey('includes/form.t...')&#xA;#2 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Environment.php(419): Twig_Environment-&amp;gt;getTemplateClass('includes/form.t...')&#xA;#3 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/TwigEnvironment.php(61): Twig_Environment-&amp;gt;loadTemplate('includes/form.t...', NULL)&#xA;#4 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(366): Craft\TwigEnvironment-&amp;gt;loadTemplate('includes/form.t...', NULL)&#xA;#5 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/cc/cc123f4b69c51ba3fb7d9a9861bd34437019eacc365672a70bf4ea69a27b24b1.php(25): Twig_Template-&amp;gt;loadTemplate('includes/form.t...', '_includes/conte...', 4)&#xA;#6 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_01e2c4fb75ed16e13ebab562be51ae878262c1c316da8ebac5ab1cf5c1b1c5d5-&amp;gt;doDisplay(Array, Array)&#xA;#7 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#8 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#9 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/04/04571408200886c7c8a1ae5274dc8ada4f8868211b12b92f88f7abc22b0c6b58.php(77): Twig_Template-&amp;gt;display(Array)&#xA;#10 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_2850f15379d843d4d4159e608a63b953c20aba41a24472fc1c618f9f4afc8207-&amp;gt;doDisplay(Array, Array)&#xA;#11 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#12 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#13 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/d0/d006f55a12c6c25b1df60cf1a426983bb01fefee03ba3a0e705203ec06f38c1d.php(81): Twig_Template-&amp;gt;display(Array)&#xA;#14 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_21662d3a280988e89b845244e1f7457af5d47e90ea3a8f22303bb25043233eb7-&amp;gt;doDisplay(Array, Array)&#xA;#15 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#16 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#17 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/d9/d9c3c424852ea1ab2234ec77778ef25c91518f55e4515e1fd41c204af998bdbf.php(45): Twig_Template-&amp;gt;display(Array)&#xA;#18 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_bdc32da372629fcf2061f0342a9ac87c3e2b31dbcd154cf621cdf95f11fe451a-&amp;gt;block_content(Array, Array)&#xA;#19 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/7b/7b10b73c0ddd653bd4e5e10f379a8c5efeda3cdaae3c26cee53bdf82a5e6e2e9.php(144): Twig_Template-&amp;gt;displayBlock('content', Array, Array)&#xA;#20 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_a17739a24f825c66b435cebb05405edfb372b8288d9ac218a4ae3563234ad0cb-&amp;gt;doDisplay(Array, Array)&#xA;#21 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#22 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#23 /srv/users/serverpilot/apps/boisedotorg/craft/storage/runtime/compiled_templates/d9/d9c3c424852ea1ab2234ec77778ef25c91518f55e4515e1fd41c204af998bdbf.php(24): Twig_Template-&amp;gt;display(Array, Array)&#xA;#24 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_bdc32da372629fcf2061f0342a9ac87c3e2b31dbcd154cf621cdf95f11fe451a-&amp;gt;doDisplay(Array, Array)&#xA;#25 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#26 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#27 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template-&amp;gt;display(Array)&#xA;#28 /srv/users/serverpilot/apps/boisedotorg/craft/app/vendor/twig/twig/lib/Twig/Environment.php(362): Twig_Template-&amp;gt;render(Array)&#xA;#29 /srv/users/serverpilot/apps/boisedotorg/craft/app/services/TemplatesService.php(256): Twig_Environment-&amp;gt;render('pages/index', Array)&#xA;#30 /srv/users/serverpilot/apps/boisedotorg/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('pages/index', Array)&#xA;#31 /srv/users/serverpilot/apps/boisedotorg/craft/app/controllers/TemplatesController.php(68): Craft\BaseController-&amp;gt;renderTemplate('pages/index', Array)&#xA;#32 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('pages/index', Array)&#xA;#33 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#34 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#35 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#36 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#37 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#38 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#39 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#40 /srv/users/serverpilot/apps/boisedotorg/craft/app/etc/web/WebApp.php(290): CWebApplication-&amp;gt;processRequest()&#xA;#41 /srv/users/serverpilot/apps/boisedotorg/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#42 /srv/users/serverpilot/apps/boisedotorg/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#43 /srv/users/serverpilot/apps/boisedotorg/public/index.php(19): require_once('/srv/users/serv...')&#xA;#44 {main}&#xA;REQUEST_URI=/media-room&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6676" LastActivityDate="2017-10-01T05:09:01.037" Title="Cant Find Template Error" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20326" PostTypeId="2" ParentId="11350" CreationDate="2017-05-03T19:40:23.330" Score="2" Body="&lt;p&gt;For very simple use cases, I've created a plugin that adds some validation to enforce this type of hierarchy: &lt;a href=&quot;https://github.com/jordanlev/craft-EnforceDualHierarchy&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/jordanlev/craft-EnforceDualHierarchy&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to see better / more robust functionality added to the Craft system in the future, please upvote this feature request: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1628&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1628&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-05-03T19:40:23.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20327" PostTypeId="1" AcceptedAnswerId="20404" CreationDate="2017-05-03T20:02:47.293" Score="1" ViewCount="694" Body="&lt;p&gt;What I would like is for a 10% discount to be applied to non sale items after the total cart quantity reaches 10 total items. I would ONLY like this discount on non sale items. Is that possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, say I have 2 Products in my cart:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Item A - $20 on sale for $10, qty 9&lt;/li&gt;&#xA;&lt;li&gt;Item B - $20, qty 1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This makes my total in cart quantity 10 line items even though 9 of them are sale items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like is for &lt;code&gt;Item B&lt;/code&gt; to be discounted 10% making my cart total &lt;code&gt;$108&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;( (10*9) + (20 * .9) ) = 108&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As it currently stands, if I toggle &lt;code&gt;Exclude this discount for products that are already on sale&lt;/code&gt; it doesn't count the sales items towards the total.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2018-03-23T21:13:15.190" Title="Craft Commerce - For a discount, can we include all products in the product count but not include the sale items that receive the discount?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20328" PostTypeId="2" ParentId="20320" CreationDate="2017-05-03T23:44:25.217" Score="1" Body="&lt;p&gt;Probably the most Craft-y way would be to use categories for classification and set your categories to have URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could do this with a route that points &lt;code&gt;shop/*&lt;/code&gt; (ie. &lt;code&gt;shop/{some token}&lt;/code&gt; - at a template, say &lt;code&gt;shop/product_type&lt;/code&gt; and in that template use the second segment of the url in retrieving products of the appropriate type (or, of course, create 3 routes and 3 templates if they way you're handling those index pages differs a lot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general how Craft deals with routes/urls is documented here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt;&#xA;And some more info on routes is here:&#xA;&lt;a href=&quot;https://straightupcraft.com/events/routes-and-patterns&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/events/routes-and-patterns&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to create your menu/list or whatever, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for productType in craft.commerce.productTypes %}&#xA;  &amp;lt;a href=&quot;/shop/{{ productType.handle }}&quot;{{ productType.name }}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(on phone so excuse any syntax errors)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-03T23:44:25.217" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20329" PostTypeId="1" AcceptedAnswerId="20331" CreationDate="2017-05-04T01:42:33.463" Score="2" ViewCount="109" Body="&lt;p&gt;I'm trying to streamline my deployments for local, staging and production and would like to know if it's possible to invoke the Find and Replace method via Console. I have a multi-config in place, but I'd like to ensure that any hardcoded urls are replaced in the database.&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-05-04T02:49:30.213" Title="Run Craft Find and Replace via Console" Tags="&lt;craft-features&gt;&lt;console&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20330" PostTypeId="2" ParentId="20325" CreationDate="2017-05-04T01:57:55.633" Score="2" Body="&lt;p&gt;To followup and close. It was a 'typo' or rewrite of the include path for this issue. Forms work fine now.&lt;/p&gt;&#xA;" OwnerUserId="6676" LastActivityDate="2017-05-04T01:57:55.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20331" PostTypeId="2" ParentId="20329" CreationDate="2017-05-04T02:49:30.213" Score="2" Body="&lt;p&gt;You can write a plugin that does this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and check the &quot;Console Command&quot; checkbox and it will generate the boilerplate for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &quot;Find and Replace&quot; command would follow similar logic to what the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/tasks/FindAndReplaceTask.php#L108&quot; rel=&quot;nofollow noreferrer&quot;&gt;FindAndReplaceTask&lt;/a&gt;'s &lt;code&gt;runStep()&lt;/code&gt; method does.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-04T02:49:30.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20332" PostTypeId="1" CreationDate="2017-05-04T03:16:17.190" Score="2" ViewCount="526" Body="&lt;p&gt;I'm working on a typical craft blog with articles. I know there is a plugin that was used to teach craft plugin development that tracks entry visit counts here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/entry-count&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is there anyway to distinguish the visits made in the last 24 hours? The docs on this simple plugin doesn't talk about it. The logic would probably be take the view count now and subtract by the count from 24 hours ago. I'm guessing the view count might be a value in the mysql table that keeps getting updated. If each count is a row in the table then perhaps there are ways to just query the db for counts associated with an entry filtered by the time stamp. But I highly doubt thats how the plugin is implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also could use help tracking the posts with the highest upvotes using the upvote plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/upvote&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing this to work out a trending logic. Trending posts are posts that have a combination of highest view count and upvotes in the last 24 hours.&lt;/p&gt;&#xA;" OwnerUserId="5286" LastActivityDate="2017-05-04T03:43:14.817" Title="Entry view count in the last 24 hours" Tags="&lt;plugins&gt;&lt;datetime&gt;&lt;php&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20333" PostTypeId="2" ParentId="20332" CreationDate="2017-05-04T03:43:14.817" Score="2" Body="&lt;p&gt;It looks like the Entry Count plugin could potentially serve your needs, though you'd need to make a few changes for it to behave the way you want. Natively, it looks like the counts are just lumped together for each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftpl.us/plugins/upvote&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upvote&lt;/a&gt; is perfect for checking recent votes! &lt;em&gt;(Disclaimer: I'm the author of Upvote.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Upvote, you can see if an entry was voted on in the past 24 hours, simply by checking the &lt;code&gt;craft_upvote_elementtallies.dateUpdated&lt;/code&gt; value in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dbgjZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dbgjZ.png&quot; alt=&quot;craft_upvote_elementtallies&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not detailed enough, you can enable the option to &lt;strong&gt;&quot;Keep a detailed record of all votes&quot;&lt;/strong&gt;. This gives you a vote-by-vote report of every single upvote/downvote ever cast. The detailed log is stored separately in the &lt;code&gt;craft_upvote_votelog&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rNpRk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rNpRk.png&quot; alt=&quot;craft_upvote_votelog&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; An unchecked &lt;code&gt;craft_upvote_votelog&lt;/code&gt; table can grow rapidly, and quickly swell the size of your database. If you only need it to check up on &lt;em&gt;recent&lt;/em&gt; votes, feel free to set a cron job to frequently delete old rows.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft_upvote_votelog&lt;/code&gt; table is not critical for the day-to-day operations of Upvote. It's more of a &quot;nice to have&quot; for rare situations which could benefit from it (like in your scenario).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-05-04T03:43:14.817" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20334" PostTypeId="1" CreationDate="2017-05-04T05:23:22.053" Score="2" ViewCount="754" Body="&lt;p&gt;I've successfully added a favicon to the site template through the _layout.html template. So the question is, how do I add the favicon code to the admin/backend of the website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6678" LastActivityDate="2020-09-24T22:55:12.643" Title="How can I add a favicon to the admin part of Craft?" Tags="&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20335" PostTypeId="2" ParentId="20334" CreationDate="2017-05-04T05:38:47.923" Score="4" Body="&lt;p&gt;If you go to Craft Settings &gt; General you can add a site icon in there plus a logo for the login page.&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-05-04T05:38:47.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20336" PostTypeId="2" ParentId="20279" CreationDate="2017-05-04T08:20:40.653" Score="0" Body="&lt;p&gt;As already mentioned in &lt;a href=&quot;https://craftcms.stackexchange.com/a/19444/3679&quot;&gt;this post&lt;/a&gt; Redactor doesn't set Trebuchet as the font, your OS does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want Redactor to inherit all the styles from the control panel in Craft, to blend in seamlessly, you can do that with just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.redactor-layer,&#xA;.redactor-layer &amp;gt; * {&#xA;  font: inherit !important;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-05-04T08:20:40.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20337" PostTypeId="1" CreationDate="2017-05-04T08:27:13.893" Score="0" ViewCount="90" Body="&lt;p&gt;I want same template which is used in &lt;a href=&quot;http://www.rideicon.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.rideicon.com/&lt;/a&gt; this website...is there any way to find which template is used in given website?&lt;/p&gt;&#xA;" OwnerUserId="6679" LastActivityDate="2017-05-04T09:10:07.470" Title="find which template is used in given website?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20338" PostTypeId="2" ParentId="20337" CreationDate="2017-05-04T09:10:07.470" Score="4" Body="&lt;p&gt;Craft CMS does not really have ready to use templates. This is why you should not be able to find any references to that. In difference to Wordpress, etc. – usually these are hand-crafted. Is this what you were asking?&lt;/p&gt;&#xA;" OwnerUserId="6673" LastActivityDate="2017-05-04T09:10:07.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20340" PostTypeId="2" ParentId="20319" CreationDate="2017-05-04T09:45:39.853" Score="3" Body="&lt;p&gt;You could add a variable like &lt;code&gt;globalCacheDisabled&lt;/code&gt; and &lt;code&gt;{% cache globally using key 'entry_' ~ entry.id ~ '_elements' unless globalCacheDisabled %}&lt;/code&gt; and use a &lt;code&gt;{% set globalCacheDisabled = entry.disableGlobalCache %}&lt;/code&gt; on the given page template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Craft's side I'd use a Lightswitch field on the entry with handle &lt;code&gt;disableGlobalCache&lt;/code&gt;, which is disabled by default which you can then activate on the given entry/ies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes you prone to changing id's and differences across environments. (While testing make sure to purge the cache)&lt;/p&gt;&#xA;" OwnerUserId="6673" LastActivityDate="2017-05-04T09:45:39.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20341" PostTypeId="2" ParentId="20209" CreationDate="2017-05-04T09:56:24.157" Score="2" Body="&lt;p&gt;The fix for the specific error was to switch the port number within email settings to 2525 - that took a lot of finding out, but crucially avoids hacking PHPMailer.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-05-04T09:56:24.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20342" PostTypeId="1" CreationDate="2017-05-04T11:46:53.433" Score="2" ViewCount="123" Body="&lt;p&gt;I'm currently working on a page that should allow registered users to upload an image and save it as an entry in a section called &quot;bildupload&quot;, together with some additional fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating/saving the entry works just fine as long as I am logged in as an administrator, however, when logging in as a regular user, Craft throws an error telling me that I am not authorized and lack rights to access the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8V1nq.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8V1nq.jpg&quot; alt=&quot;Those are the permissions assigned to the default-usergroup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above image shows what permissions the default-user currently has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding some permissions, however I does not make a difference, the error still appears on submitting the form to upload/create an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="14" LastEditDate="2017-05-04T17:36:42.710" LastActivityDate="2018-07-03T18:06:30.110" Title="Non-admins not authorized to create entry via frontend" Tags="&lt;upload&gt;&lt;permissions&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20343" PostTypeId="1" CreationDate="2017-05-04T16:44:58.087" Score="1" ViewCount="1899" Body="&lt;p&gt;I transferred a website using Craft CMS and now when I want login to admin the console return me &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jquery-2.2.1.min.js?d=1493126871:4 POST http://website.com/index.php/admin/actions/users/login 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I put app to debug mode and I have very more error like to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[14:44:38.309][trace][system.CModule] Loading &quot;cache&quot; application component in /home/domains/website.ca/public_html/craft/app/etc/web/WebApp.php (593)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I try put &lt;code&gt;RewriteBase /&lt;/code&gt; and ma .htaccess my site is multilang so i put this and the .htaccess of each file /en and /fr&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website is at a hosting company and a not access to ssh . The PHP version is 7 and a have activate all module &lt;/p&gt;&#xA;" OwnerUserId="6681" LastEditorUserId="57" LastEditDate="2017-05-05T20:59:30.873" LastActivityDate="2019-07-23T13:03:30.433" Title="Craft CMS login 500 (Internal Server Error)" Tags="&lt;php&gt;&lt;login&gt;&lt;htaccess&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20344" PostTypeId="2" ParentId="20343" CreationDate="2017-05-04T16:54:44.813" Score="2" Body="&lt;p&gt;remove /craft/storage/runtime and remove all craft_session and database&lt;/p&gt;&#xA;" OwnerUserId="6682" LastActivityDate="2017-05-04T16:54:44.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20346" PostTypeId="1" AcceptedAnswerId="20349" CreationDate="2017-05-04T18:06:52.467" Score="1" ViewCount="108" Body="&lt;p&gt;I have a custom content table for an elementType. I have a few fields set up in my &lt;code&gt;Record&lt;/code&gt; as boolean. The two fields are &lt;code&gt;approved&lt;/code&gt; and &lt;code&gt;denied&lt;/code&gt; I have to search the database where both fields are set to zero/false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only get the values to show up in &lt;code&gt;$query-&amp;gt;params&lt;/code&gt; inside my &lt;code&gt;modifyElementsQuery()&lt;/code&gt; method when I set &lt;code&gt;$criteria-&amp;gt;approved/denied&lt;/code&gt; to (string)&quot;1&quot;. Setting these to true, false, or (string)&quot;0&quot; cause them to not show up in the &lt;code&gt;$query-&amp;gt;params&lt;/code&gt; list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I work with a boolean field in this manner? I need &lt;code&gt;Where denied = '0'&lt;/code&gt; to show up in the query when i set &lt;code&gt;$criteria-&amp;gt;denied = false&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-05-04T21:20:34.073" Title="getCriteria not working as expected with boolean field types" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20347" PostTypeId="2" ParentId="19839" CreationDate="2017-05-04T20:10:51.187" Score="2" Body="&lt;p&gt;Turns out you can set the &lt;code&gt;&quot;parentId&quot;&lt;/code&gt; field under the &lt;code&gt;&quot;attributes&quot;&lt;/code&gt; list in the import JSON data to set a structure parent (to the entry id of the parent entry). This probably means you need to chunk your import into separate steps, for example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Import only the top-level entries.&lt;/li&gt;&#xA;&lt;li&gt;Run a query on the CMS to retrieve entry id's for those just-imported top-level entries.&lt;/li&gt;&#xA;&lt;li&gt;Using the list from step 2, assign the proper entry id to the 2nd-level children and import those.&lt;/li&gt;&#xA;&lt;li&gt;Run a query to get the 2nd-level entries you just imported.&lt;/li&gt;&#xA;&lt;li&gt;etc. etc. for each level of your hierarchy&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Would be awesome if you could just nest the JSON structures and the import plugin magically figured out how to set parent ids, but that sounds like a lot of work to implement for a free plugin :)&lt;/p&gt;&#xA;" OwnerUserId="3931" LastActivityDate="2017-05-04T20:10:51.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20348" PostTypeId="2" ParentId="20279" CreationDate="2017-05-04T20:21:24.370" Score="0" Body="&lt;p&gt;I was commiserating with some colleagues about this the other day, so I bundled up a stylesheet into its own angsty little plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/AugustMiller/craft-redactor-helvetica&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/AugustMiller/craft-redactor-helvetica&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively similar to the Control Panel CSS plugin, except that self-container and not extensible.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2017-05-04T20:21:24.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20349" PostTypeId="2" ParentId="20346" CreationDate="2017-05-04T21:07:41.353" Score="1" Body="&lt;p&gt;I believe this should work (not tested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;setAttribute('denied', 'not 1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As when &lt;a href=&quot;https://craftcms.stackexchange.com/questions/237/how-do-i-check-if-a-lightswitch-field-is-false/239#239&quot;&gt;using the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; in Twig&lt;/a&gt;, you can't directly check for &quot;falsey&quot; values.&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-05-04T21:20:34.073" LastActivityDate="2017-05-04T21:20:34.073" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20350" PostTypeId="1" CreationDate="2017-05-04T22:00:46.483" Score="2" ViewCount="952" Body="&lt;p&gt;Is there a way to create a front-end form that would allow a user with appropriate privileges (Register users) to register new users?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2017-11-24T13:04:35.677" Title="Form for admins to register users from the front end" Tags="&lt;users&gt;&lt;admin&gt;&lt;frontend-form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20351" PostTypeId="1" CreationDate="2017-05-04T22:54:46.203" Score="1" ViewCount="501" Body="&lt;p&gt;I've built a site using Craft, and now, I'd like to be able to create a mirrored development environment. With that, I'd like to be able to make changes and edits to the website that can then be pushed to the main site. I know that craft has these features built in, but I have not been able to understand exactly how to get it to work. Is there someone wonderful on here that can explain how to get it done, or could include a link to another thread that explains?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2017-05-04T22:54:46.203" Title="Creating a Dev Environment" Tags="&lt;multi-environment&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20352" PostTypeId="1" CreationDate="2017-05-05T08:08:33.607" Score="1" ViewCount="91" Body="&lt;p&gt;I'm using the import plugin from Bob Olde Hampsink and I've got a exported .csv file. There's nothing special in it but I can't seem to import. I know there's an error log somewhere, but I can't seem to find it. Does anyone know where it's situated? I've found it once but now I'm totally lost and can't seem to find an answer somewhere...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2017-05-05T08:21:07.010" Title="Import plugin error logs" Tags="&lt;plugins&gt;&lt;import&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20353" PostTypeId="2" ParentId="20352" CreationDate="2017-05-05T08:21:07.010" Score="1" Body="&lt;p&gt;In Craft 2 the log files are usually stored in craft/storage/runtime/logs/ and named after the plugin handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Import plugin does nothing special, you should find its logs in craft/storage/runtime/logs/import.log&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-05-05T08:21:07.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20354" PostTypeId="1" AcceptedAnswerId="20357" CreationDate="2017-05-05T09:40:59.623" Score="1" ViewCount="408" Body="&lt;p&gt;I have a vacancy's website which has a couple of search forms spread around the website. The craft standard search form works great, the only problem is I need to search only by the &lt;strong&gt;title field&lt;/strong&gt; instead of all the content in the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to search only by title field?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-05-05T11:00:02.180" Title="Search only by Field instead of entire content" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20355" PostTypeId="1" AcceptedAnswerId="20862" CreationDate="2017-05-05T09:44:17.727" Score="2" ViewCount="840" Body="&lt;p&gt;I've got categories setup like this (Parent &amp;amp; Children):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Type&#xA;    Tops&#xA;    Dresses&#xA;    Pants&#xA;&#xA;Colour&#xA;    Black&#xA;    Red&#xA;    Yellow&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use this in a category filter and choose Dresses and Black, it works fine in terms that it will return entries that are in Dresses and entries that are in Black.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I edit my code so that it returns entries that are ONLY in Dresses and Black (Black Dresses only!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productSegmentCategory = craft.categories.slug(craft.request.lastSegment()).first() %}&#xA;{% set productCategoriesArray = ['and'] %}&#xA;&#xA;{% set productValues = {&#xA;    keywords: craft.request.getParam('keywords'),&#xA;    category: craft.request.getParam('category') ? craft.categories.slug(craft.request.getParam('category')) : null,&#xA;    order: craft.request.getParam('order') ? craft.request.getParam('order') : 'title asc',&#xA;    limit: craft.request.getParam('limit') ? craft.request.getParam('limit') : entryLimit,&#xA;} %}&#xA;&#xA;{% set productParameters = {&#xA;    search: productValues.keywords,&#xA;    order: productValues.order,&#xA;    limit: null,&#xA;}%}&#xA;&#xA;{% if productSegmentCategory|length %}&#xA;    {% set productCategoriesArray = productCategoriesArray|merge([{ targetElement: productSegmentCategory, field: 'productCategories' }]) %}&#xA;{% endif %}&#xA;&#xA;{% if productValues.category|length %}&#xA;    {% set productCategoriesArray = productCategoriesArray|merge([{ targetElement: productValues.category, field: 'productCategories' }]) %}&#xA;{% endif %}&#xA;&#xA;{% if productCategoriesArray|length &amp;gt; 1 %}&#xA;  {% set productParameters = productParameters|merge({ relatedTo: productCategoriesArray }) %}&#xA;{% endif %}&#xA;&#xA;{% set productEntries = craft.commerce.products(productParameters) %}&#xA;&#xA;{% if productSegmentCategory|length %}&#xA;    {% set entry = productSegmentCategory %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-06-15T22:18:43.527" Title="Entries related to BOTH categories" Tags="&lt;categories&gt;&lt;search&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20356" PostTypeId="2" ParentId="17256" CreationDate="2017-05-05T10:54:30.237" Score="2" Body="&lt;p&gt;I know this is a little late, but i've just build a plugin for TOTP. It is in beta, so beware before using it in a production environment.&#xA;&lt;a href=&quot;https://github.com/born05/craft-twofactorauthentication&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/born05/craft-twofactorauthentication&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2017-05-05T10:54:30.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20357" PostTypeId="2" ParentId="20354" CreationDate="2017-05-05T11:00:02.180" Score="3" Body="&lt;p&gt;Give this a go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchTerm = craft.request.getParam('q') %}    &#xA;{% set query = craft.entries({&#xA;        search: 'title:*' ~ searchTerm ~ '*',&#xA;        limit: 5,&#xA;        locale: craft.locale,&#xA;        order: 'score'&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can leave out the &lt;code&gt;*&lt;/code&gt; on both sides if you only want to search for full word matches. Also, this might help you take it further: &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/searching&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2017-05-05T11:00:02.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20358" PostTypeId="1" CreationDate="2017-05-05T11:22:41.950" Score="1" ViewCount="106" Body="&lt;p&gt;I would like to edit custom Lightswitch field value to true inside of event on order save&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          $order = $event-&amp;gt;params[&quot;order&quot;];&#xA;          $order-&amp;gt;setContentFromPost(array(&#xA;              'ediCheck' =&amp;gt; true,&#xA;          ));&#xA;&#xA;          $order-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;              'ediCheck' =&amp;gt; true,&#xA;          ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tried following but the value still stays the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also If there is an documentation file on following that I maybe missed would also be helpful.&lt;/p&gt;&#xA;" OwnerUserId="6686" LastActivityDate="2017-06-05T00:28:56.023" Title="Edit custom field value inside &quot;commerce_orders.onBeforeSaveOrder&quot; event" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20359" PostTypeId="1" CreationDate="2017-05-05T12:19:07.137" Score="1" ViewCount="222" Body="&lt;p&gt;I have Matrix field containing block with various fields. How can I output into template label of single field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I get type of that field? (for example - textfield, dropdown field, etc.)&lt;/p&gt;&#xA;" OwnerUserId="6620" LastEditorUserId="57" LastEditDate="2017-05-05T21:13:39.373" LastActivityDate="2017-05-08T22:56:22.397" Title="Get field Matrix field label inside template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20360" PostTypeId="1" AcceptedAnswerId="20390" CreationDate="2017-05-05T12:34:08.770" Score="1" ViewCount="535" Body="&lt;p&gt;We have an install of the latest Craft on a Nexcess shared account. By default, the account runs PHP 5.4.x. We were working on and configuring the site for about a week - no issues of any kind until today. We used the Nexcess control panel to update the PHP version to 5.6.3 (for a plugin we were going to use). After doing so, we found that saving entries or certain configuration elements in settings would take 5+ minutes to complete. We downgraded back to 5.4.x and still the behaviour persists. Unfortunately, it does not seem to be 100% consistent. I would say it happens about 90% of the time and cannot find any common thread as to when it happens and when it does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saving one entry is generating about 1.4 MB of Craft log files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cadex-dev.ca/shop/logs/craft.log&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Log 1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cadex-dev.ca/shop/logs/craft.log.1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Log 2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond the Craft logs, I don't see a php error in the PHP logs but there are these Apache errors when saving the entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[Fri May 05 07:28:46 2017] [error] [client xx.xx.xx.xx] FastCGI: incomplete headers (0 bytes) received from server &quot;/dev/shm/cadexdev-php.fcgi&quot;, referer: http://www.cadex-dev.ca/shop/admin/entries/multiUse/new&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is host-related. I do have a ticket open with Nexcess but am not certain if this is something specific to Craft instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Also, a curious behaviour around this issue. If I save an entry and only wait, say, 20 seconds, quit my browser and then re-open and go to the entries page, the entry is there with the saved changes. No 5+ minute wait.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-05-05T12:49:16.710" LastActivityDate="2017-05-08T16:02:07.573" Title="Help! Craft issues after changing PHP version" Tags="&lt;php&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20361" PostTypeId="1" CreationDate="2017-05-05T13:34:33.183" Score="1" ViewCount="422" Body="&lt;p&gt;What are I doing wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm setting block types 'stripCustom' and 'stripShowroom' to 'stripBlock'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set stripBlock = entry.contentImage.type(['stripCustom', 'stripShowroom']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in a loop checking if 'stripBlock' is last and the current block is last but one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;section {% if loop.last == stripBlock and loop.revindex0 == 1 %}gutter-bottom--double{% endif %}&quot;&amp;gt;&#xA;....&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2017-05-06T15:17:03.793" Title="loop.last of a certain block type" Tags="&lt;matrix&gt;&lt;loop&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20362" PostTypeId="1" CreationDate="2017-05-05T13:38:07.133" Score="0" ViewCount="257" Body="&lt;p&gt;I have had Craft CMS installed for a while. then today, I created some new pages, and pushed them with git to the templates folder, added them in sections etc, then, when I go to edit the entry, it comes out like this..?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GZl8L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZl8L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is my main sites styling/CSS, but craft shouldn't be using it...should it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every other admin page shows okay, and the frontend is fine... just when I edit the entries.&lt;/p&gt;&#xA;" OwnerUserId="6687" LastActivityDate="2017-05-05T15:39:10.700" Title="Craft Admin CSS Broken..?" Tags="&lt;admin&gt;&lt;css&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20363" PostTypeId="1" AcceptedAnswerId="20364" CreationDate="2017-05-05T13:40:57.390" Score="1" ViewCount="48" Body="&lt;p&gt;I'm attempting to output a list of entries using slug names. When I do the following, the entries are automatically reordered in alphabetical (title) order. Same thing happens if I target the ID's instead of the slugs. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set menu = craft.entries.slug(['home', 'about', 'services', 'news', 'contact']).order(null).find() %}&#xA;{% for entry in menu %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to output the list the same way I put it in?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-05-05T14:23:45.103" Title="Disable ordering" Tags="&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20364" PostTypeId="2" ParentId="20363" CreationDate="2017-05-05T13:46:40.170" Score="2" Body="&lt;p&gt;I think you can try .fixedOrder(), but you might have to query by ID and not slug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.fixedOrder(true)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-05-05T14:23:45.103" LastActivityDate="2017-05-05T14:23:45.103" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20365" PostTypeId="1" CreationDate="2017-05-05T15:16:56.803" Score="1" ViewCount="290" Body="&lt;p&gt;Craft: 2.6.2976&#xA;Commerce: 1.2.1341&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to force currency depending on language (en_us and no). The user should not be allowed to choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added two currencies 1) EUR - base, 2) NOK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting &lt;code&gt;define('COMMERCE_PAYMENT_CURRENCY', 'EUR');&lt;/code&gt; in the index.php for the english site, and &lt;code&gt;define('COMMERCE_PAYMENT_CURRENCY', 'NOK');&lt;/code&gt;in the index.php file for the norwegian site does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The currency is always EUR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear: Using &lt;code&gt;{{constant('COMMERCE_PAYMENT_CURRENCY')}}&lt;/code&gt; does output the correct currency as set in index.php, however the cart is what always remains in EUR (base).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug in Commerce?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2018-09-13T11:29:52.323" Title="Unable to set cart currency in index.php" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20366" PostTypeId="1" CreationDate="2017-05-05T15:30:30.740" Score="2" ViewCount="511" Body="&lt;p&gt;I created a user profile page with Matrix field with assets, I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1318/how-to-get-matrix-editor-into-frontend/1322#1322&quot;&gt;this thread&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6551/how-to-update-matrix-field-on-frontend-for-user-profile&quot;&gt;this thread&lt;/a&gt; about adding and updating Matrix field in the frontend. Does anyone know how to delete the Matrix field? Moreover, I found that if I update Matrix field through the front end, it doesn't update the S3 bucket. Files are still stored in S3. Does anyone has a solution or give me a hint on delete/modify Matrix asset field? Thanks &lt;/p&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2017-05-05T21:20:56.270" LastActivityDate="2020-04-18T13:13:27.193" Title="How to delete Matrix fields in front end" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20367" PostTypeId="2" ParentId="20362" CreationDate="2017-05-05T15:39:10.700" Score="1" Body="&lt;p&gt;Are you sure you didn't push something to &lt;code&gt;craft/app/templates&lt;/code&gt; if you did go check out the folder and remove anything that shouldn't belong there. You can check side by side which files shouldnt be in there with a fresh craft environment. Or just replace the &lt;code&gt;app&lt;/code&gt; folder with a fresh one.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-05-05T15:39:10.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20368" PostTypeId="1" CreationDate="2017-05-05T16:15:47.183" Score="4" ViewCount="188" Body="&lt;p&gt;Is it possible to have an &quot;entries&quot; field but only allow selection to entries of a specific &quot;entry type&quot; within craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to use entry types as a sort of way to enable interfaces with chunks of content. Requiring specific fields for one type of content and different fields for another type of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize I could create many channels and accomplish the same thing, but these data structures are similar in a lot of respects with only minor differences (which are important depending on the context they are going to be rendered). So I would prefer to have an overarching channel with several types.&lt;/p&gt;&#xA;" OwnerUserId="727" LastActivityDate="2019-09-04T13:52:36.680" Title="Limit a field to entries by entry type" Tags="&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20369" PostTypeId="1" CreationDate="2017-05-05T18:45:56.057" Score="1" ViewCount="459" Body="&lt;p&gt;I'm trying to embed the sidebar and define which blocks to display.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% embed &quot;_partials/sidebar&quot; %}&#xA;    {% block instagram %}{% endblock %}&#xA;    {% block subscribe %}{% endblock %}&#xA;{% endembed %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sidebar.html is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block subscribe %}&#xA;    block content&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't show anything and no errors as well (dev mode enabled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is make a dynamic sidebar and define which widgets I'd like to see in each template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I use right now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set widgets = {&#xA;            'about'     : true,&#xA;            'instagram' : true,&#xA;            'menu'      : false,&#xA;            'recipes'   : true,&#xA;            'subscribe' : true&#xA;        } %}&#xA;&#xA;        {% include &quot;_partials/sidebar&quot; with {&#xA;            widgets: widgets&#xA;        } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sidebar.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       {% if widgets.menu == 'true' %}&#xA;           content&#xA;       {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is there any other more flexible approaches for this?&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="720" LastEditDate="2017-05-06T14:17:45.297" LastActivityDate="2017-05-06T14:17:45.297" Title="Trouble with Twig `embed` tag" Tags="&lt;embed&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20370" PostTypeId="2" ParentId="20369" CreationDate="2017-05-05T19:12:15.257" Score="2" Body="&lt;p&gt;I'm going to assume that, as per the use cases &lt;a href=&quot;https://twig.sensiolabs.org/doc/1.x/tags/embed.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the documentation&lt;/a&gt;, &lt;code&gt;embed&lt;/code&gt; is a good fit for your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not sure, &lt;code&gt;extends&lt;/code&gt; and &lt;code&gt;include&lt;/code&gt; are probably a better choice, as they're much easier to understand and work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving on, in your example you appear to have confused the roles of the template being embedded, and the template doing the embedding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how it should look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Page (doing the embedding) #}&#xA;{% embed &quot;_partials/sidebar&quot; %}&#xA;    {% block subscribe %}&#xA;        The custom subscribe block content.&#xA;    {% endblock %}&#xA;{% endembed %}&#xA;&#xA;{# Embed (being embedded) #}&#xA;&amp;lt;div class=&quot;sidebar&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;sidebar__subscribe&quot;&amp;gt;&#xA;        {% block subscribe %}&#xA;            The (optional) default subscribe block content.&#xA;        {% endblock %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-05-05T20:22:13.210" LastActivityDate="2017-05-05T20:22:13.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20371" PostTypeId="1" AcceptedAnswerId="20375" CreationDate="2017-05-05T20:44:43.657" Score="0" ViewCount="121" Body="&lt;p&gt;Whenever a customer puts items into their cart and logs out their email disappears until they log back in. Is there a way to view the email and info in commerce of the person when they log out?   &lt;/p&gt;&#xA;" OwnerUserId="5246" LastEditorUserId="22" LastEditDate="2017-05-09T19:22:33.060" LastActivityDate="2017-05-09T19:22:33.060" Title="Craft Commerce Cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20372" PostTypeId="2" ParentId="20350" CreationDate="2017-05-05T21:06:32.007" Score="1" Body="&lt;p&gt;Definitely doable with a custom &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your front-end form could be similar to the standard front-end user registration form (&lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/user-registration-form&lt;/a&gt;), but instead you'd point the form action to your plugin's controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that point, you can do pretty much whatever you want with the POST'd data using Craft's service layer API.  i.e. check existing user's permissions, save user, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-05T21:06:32.007" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20373" PostTypeId="2" ParentId="20359" CreationDate="2017-05-05T21:13:13.993" Score="2" Body="&lt;p&gt;Something like this should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.body %}&#xA;&#xA;    {% set fields = block.getFieldLayout().getFields() %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;{{ block.getType().name }}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for field in fields %}&#xA;                &amp;lt;li&amp;gt;{{ field.getField().name }}&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-05-08T22:56:22.397" LastActivityDate="2017-05-08T22:56:22.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20374" PostTypeId="2" ParentId="20360" CreationDate="2017-05-05T21:22:19.473" Score="1" Body="&lt;p&gt;Well, it seems this was related to devMode. I have had no further issues with it off.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-05-05T21:22:19.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20375" PostTypeId="2" ParentId="20371" CreationDate="2017-05-06T00:03:03.850" Score="1" Body="&lt;p&gt;You mean on the front end?   User data is cleared when a person logs out....that would be the expected behaviour surely?  And for privacy reasons, the info for that customer should not be available until they log back in (think about e.g. use of a shared computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I must be misunderstanding the question, but as I understand it, the answer is no, and the behaviour of the data being clear is expected (and correct).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note the cart itself is not cleared on log out with Commerce as it is with most other systems.  Took me a little while to get used to that but it doesn't really seem to cause issues...it would be quite easy to write plugin that clears the cart on logout if you would prefer that).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-06T00:03:03.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20376" PostTypeId="2" ParentId="20358" CreationDate="2017-05-06T00:08:58.703" Score="2" Body="&lt;p&gt;That looks right, but I think you may need to set the value of that field to '1' - looking in the &lt;code&gt;craft_content&lt;/code&gt; table, it seems switches are stored as &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      $order = $event-&amp;gt;params[&quot;order&quot;];&#xA;      $order-&amp;gt;setContentFromPost(array(&#xA;          'ediCheck' =&amp;gt; 1,&#xA;      ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that still doesn't work, try throwing in a &lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);&lt;/code&gt; at the end of your function.  It shouldn't be needed though as it should fall through to the &lt;code&gt;saveOrder&lt;/code&gt; it's going to do anyway....&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-06T00:08:58.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20377" PostTypeId="2" ParentId="15853" CreationDate="2017-05-06T00:23:43.910" Score="0" Body="&lt;p&gt;Now that I have tested both, not an exhaustive test by any means.  But, overall both are very similar.  It really comes down to how much power you need in an event app.  If you need front end posting, Solspace.  If you need to have a robust location piece to the event plugin, Venti does that very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Venti 2:&lt;/strong&gt;&#xA;Nice Crafty UI feel.  You get a location finder and map for a built in address field, basic calendar view (you cannot input events straight into the calendar), solid sample templates, events field type. Oh and each location has to be saved before it can be used on an event.  You can also have a global template that can apply all your custom fields without having to go back and add them each time you make a new calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure about the custom field search piece on the frontend, I have not gotten that far.  Overall it's a legit app for events.  The support is amazing too!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solspace Calendar:&lt;/strong&gt;&#xA;Beautiful UI. No built in location fields, calendar view gives you 3 distinct views and you can add events right from that screen, frontend event posting, demo templates - a lot of them, amazing support.  Searching custom fields is not easy from what I have gathered. No custom field global template functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of these plugins have reoccurring event capability, which is always a bit complex to figure out on the fly.  It has to come down to do you need frontend event posting, backend functionality UI preference.  Also it's a matter of what plugin is going to be code quick.  I am not sure which plugin shines there, I have no benchmarks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need location and mapping so I like Venti for that but I have overcome that by using other plugins to accomplish that, not sure how much overhead it added.  For me, I don't need reoccurring events right now.  My question that no one is talking about, is performance.  Which of the 3 does that the best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are fast setups, but before you dive in, know what custom fields you want and work that out to save yourself sometime.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-05-06T00:23:43.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20378" PostTypeId="2" ParentId="20251" CreationDate="2017-05-06T00:57:42.747" Score="1" Body="&lt;p&gt;This is the expected behaviour. It makes perfect sense to display the human-friendly checkbox label on an admin screen, rather than the (potentially obtuse) checkbox value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To confirm that this isn't simply an issue with your form, I did the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Created a test checkbox field with three options.&lt;/li&gt;&#xA;&lt;li&gt;Added the test checkbox field to the custom user fields.&lt;/li&gt;&#xA;&lt;li&gt;Set the checkbox field to display on the users list page.&lt;/li&gt;&#xA;&lt;li&gt;Edited a user via the control panel, and selected some of the checkbox items.&lt;/li&gt;&#xA;&lt;li&gt;Returned to the users list page to view the results.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As expected, the users list page displayed the labels of the selected items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference appears to be that in my installation the selected items are displayed in a single column, as a comma-delimited list, whereas in your example each checkbox item receives its own column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rU7Ix.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rU7Ix.png&quot; alt=&quot;Screenshot of the users list&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth mentioning that you are correct in stating that the checkbox option fields need to include the &lt;code&gt;[]&lt;/code&gt; in the name. That's exactly how the admin forms work too.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-05-06T00:57:42.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20379" PostTypeId="2" ParentId="20361" CreationDate="2017-05-06T14:31:52.033" Score="2" Body="&lt;p&gt;To test if the current block is the last in the loop and of a certain type, you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.last and block.type == &quot;yourBlockType&quot; %}yes{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or shorthand&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ loop.last and block.type == &quot;yourBlockType&quot; ? 'yes' : 'no' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above example replace &lt;code&gt;'no'&lt;/code&gt; with &lt;code&gt;''&lt;/code&gt; to output nothing. It's  just there if you want to output something in case of false&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or even shorter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ loop.last and block.type == &quot;yourBlockType&quot; ? 'yes' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="268" LastEditorUserId="268" LastEditDate="2017-05-06T15:17:03.793" LastActivityDate="2017-05-06T15:17:03.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20380" PostTypeId="2" ParentId="20245" CreationDate="2017-05-06T16:24:27.207" Score="2" Body="&lt;p&gt;As mentioned in the comments, this is likely an email configuration issue and Brad's comment should be taken to heart:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;both sendmail and PHP's mail are notoriously unreliable and shouldn't be used in production environments&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft should not be treating user emails differently than non-user emails and Sprout Forms isn't doing anything unique when it sends notification emails, it's just piggybacking on what Craft is doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sending your email through a service like Mailgun (or any similar service) will give you more visibility into what's happening and what you may need to troubleshoot. &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt; has a Sent Email Element Type that you can enable to help troubleshoot some email deliverability issues on the Craft side of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For two good overviews on troubleshooting email errors in Craft, see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors&lt;/a&gt; - &lt;em&gt;Craft Docs&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/events/troubleshooting-and-debugging-errors-in-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Troubleshooting and debugging errors in PHP&lt;/a&gt; - &lt;em&gt;Straight Up Craft&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another direction to consider when troubleshooting an error like this may be to look closer at the &lt;code&gt;From&lt;/code&gt; headers and what emails you are sending to. Is it really just Craft Emails vs non-Craft Emails or could there be other patterns? For example, maybe the emails that aren't being received are all &lt;code&gt;gmail&lt;/code&gt; addresses. In some cases, if you are sending to a &lt;code&gt;gmail&lt;/code&gt; address you own from a &lt;code&gt;gmail&lt;/code&gt; address you own, Google may suppress the email from appearing in your inbox.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-05-06T16:24:27.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20381" PostTypeId="1" CreationDate="2017-05-06T16:57:22.630" Score="1" ViewCount="127" Body="&lt;p&gt;I'm trying to make a plugin in Craft 3 but want it to be possible to set different settings for each separate site or locale. How would I go about doing this?&lt;/p&gt;&#xA;" OwnerUserId="6675" LastEditorUserId="6675" LastEditDate="2017-05-08T08:21:58.147" LastActivityDate="2017-05-08T15:53:50.117" Title="Plugin settings per site/locale" Tags="&lt;plugin-development&gt;&lt;settings&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20382" PostTypeId="2" ParentId="20381" CreationDate="2017-05-06T19:20:57.923" Score="1" Body="&lt;h3&gt;Edit&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;OP updated the question to specify Craft &lt;em&gt;3&lt;/em&gt;, so this is no longer relevant.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can define a separate value for each locale, as described in &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-4-define-your-site-uRLs&quot; rel=&quot;nofollow noreferrer&quot;&gt;the localisation documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'flagName' =&amp;gt; [&#xA;        'de' =&amp;gt; 'Bundesflagge',&#xA;        'fr' =&amp;gt; 'Tricolore',&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-05-08T15:53:50.117" LastActivityDate="2017-05-08T15:53:50.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20383" PostTypeId="1" CreationDate="2017-05-07T03:52:19.063" Score="5" ViewCount="667" Body="&lt;p&gt;Within my Craft plugin code, how do I find the path to Craft's &lt;code&gt;public/&lt;/code&gt; folder? There doesn't seem to be a constant listed in &lt;a href=&quot;https://craftcms.com/docs/php-constants&quot; rel=&quot;noreferrer&quot;&gt;Craft Docs: PHP Constants&lt;/a&gt; like there is for all the other key folders.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-05-08T02:52:09.937" Title="How do I find the path to the public folder?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20386" PostTypeId="2" ParentId="20383" CreationDate="2017-05-07T23:26:41.857" Score="6" Body="&lt;p&gt;Lots of good discussion on how to do this and the pros/cons of each here: &lt;a href=&quot;https://stackoverflow.com/questions/4645082/get-absolute-path-of-current-script&quot;&gt;https://stackoverflow.com/questions/4645082/get-absolute-path-of-current-script&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the most reliable way is to use PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.debug-backtrace.php&quot; rel=&quot;noreferrer&quot;&gt;debug_backtrace&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$debugTrace = debug_backtrace();&#xA;$initialCalledFile = count($debugTrace) ? $debugTrace[count($debugTrace) - 1]['file'] : __FILE__;&#xA;$publicFolderPath = dirname($initialCalledFile);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-05-08T02:52:09.937" LastActivityDate="2017-05-08T02:52:09.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20388" PostTypeId="1" AcceptedAnswerId="20392" CreationDate="2017-05-08T15:19:20.320" Score="1" ViewCount="139" Body="&lt;p&gt;Is it possible to include plural variations? For example if I search for 'apple' but the entry includes 'apples' it appears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or would this need to be approached by getting these variations into the entries via tags or similar?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score').section('newsEvents') %}&#xA;&#xA;&#xA;{% if entries|length %}&#xA;&amp;lt;h3&amp;gt;{{ entries|length }} result(s):&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for entry in entries %}&#xA;         ...&#xA;    {% endfor %}&#xA;&#xA;    {% else %}&#xA;     &amp;lt;p&amp;gt;Your search for &quot;{{ query }}&quot; didn't return any results.&amp;lt;/p&amp;gt;&#xA;&#xA;{% endif %}             &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2017-05-08T16:13:11.997" Title="Search forms handling of plurals" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20389" PostTypeId="2" ParentId="20388" CreationDate="2017-05-08T15:38:23.163" Score="2" Body="&lt;p&gt;You'll want to enable fuzzy search as explained here in Craft Docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enable Fuzzy Search&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there's a little caveat you'll run into when you search for &quot;apples&quot; and expect to return &quot;apple&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15933/fuzzy-search-and-plurals&quot;&gt;Fuzzy Search and Plurals&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="268" LastActivityDate="2017-05-08T15:38:23.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20390" PostTypeId="2" ParentId="20360" CreationDate="2017-05-08T16:02:07.573" Score="2" Body="&lt;p&gt;Had this happen. I believe the cause is twofold:&lt;/p&gt;&#xA;&lt;h2&gt;FastCGI's &lt;code&gt;-idle-timeout&lt;/code&gt; is set too low.&lt;/h2&gt;&#xA;&lt;p&gt;Craft is still writing to the log but Apache cuts it off since it hasn't sent the actual data yet. That's what the &lt;code&gt;incomplete headers&lt;/code&gt; means.&lt;/p&gt;&#xA;&lt;p&gt;You'll might find a line like this in your config:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FastCgiServer /dev/shm/cadexdev-php.fcgi -idle-timeout 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Some hosts might set it low, like 10 seconds. That could be fine for production to make sure scripts don't take a super long time, but as you've discovered &lt;code&gt;devMode&lt;/code&gt; could take a little longer to run, depending on the case.&lt;/p&gt;&#xA;&lt;h2&gt;RunTasksAutomatically&lt;/h2&gt;&#xA;&lt;p&gt;The other piece is Craft does things in the background. Craft's documentation on &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;runTasksAutomatically&lt;/code&gt;&lt;/a&gt; says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This setting should be disabled for servers running Win32, or with Apache’s mod_deflate/mod_gzip installed, where PHP’s flush() method won’t work.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Some of those tasks clear caches and stuff. If they don't run, you'll get weird intermittent performance issues. Turn it off and run a &lt;code&gt;cron&lt;/code&gt; job on your server periodically. We run php-fpm on both Apache and nginx and FWIW, we don't have this issue on nginx.&lt;/p&gt;&#xA;&lt;h2&gt;Increase PHP's memory&lt;/h2&gt;&#xA;&lt;p&gt;You'll also get a 500 / incomplete headers error if PHP dies because of lack of memory.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-05-08T16:02:07.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20392" PostTypeId="2" ParentId="20388" CreationDate="2017-05-08T16:13:11.997" Score="3" Body="&lt;p&gt;You can certainly achieve a very rudimentary form of plural search by following the recommendations in &lt;a href=&quot;https://craftcms.stackexchange.com/a/20389/505&quot;&gt;AbbeyDesign's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it comes with an important caveat: &lt;strong&gt;it won't work for plurals which do not include the singular form&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, baby / babies, knife / knives, or tooth / teeth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to accommodate this requirement, Craft's built-in search probably isn't going to cut it, and you'll need to go with something a bit more sophisticated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't personally tried it, but I think &lt;a href=&quot;https://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search Plus&lt;/a&gt; can handle this. It's basically a convenient wrapper around &lt;a href=&quot;https://www.algolia.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algolia&lt;/a&gt;, a very sophisticated search tool, which automatically handles pluralisation.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-05-08T16:13:11.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20393" PostTypeId="2" ParentId="8689" CreationDate="2017-05-08T19:56:28.633" Score="4" Body="&lt;p&gt;I can't comment yet to reply directly to Mats Mikkel Rummelhoff's comment above, but just in case someone comes across this and is looking to alternate styles instead of basing it on the loop.index count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would do so using the Twig odd or even tests&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ loop.index is odd ? 'odd' : 'even' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ loop.index is even ? 'even' : 'odd' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no loop.odd key&lt;/p&gt;&#xA;" OwnerUserId="6654" LastActivityDate="2017-05-08T19:56:28.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20394" PostTypeId="2" ParentId="20251" CreationDate="2017-05-08T22:17:18.500" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/20378/57&quot;&gt;Stephen's answer&lt;/a&gt; is correct in that it's the default behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also write a simple &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that supplied it's own Checkbox field type that extended Craft's default implementation. It could override the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/fieldtypes/BaseOptionsFieldType.php#L209&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getTableAttributeHtml()&lt;/code&gt;&lt;/a&gt; method to return the values instead of the labels for element index pages.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-08T22:17:18.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20396" PostTypeId="1" AcceptedAnswerId="20397" CreationDate="2017-05-09T01:24:31.577" Score="1" ViewCount="157" Body="&lt;p&gt;I am getting this error in the commerce.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/05/08 23:18:49 [error] [plugin] [Forced] Epostmal analysefeil for epost “Behandles”. Bestilling: “097793b”. Malfeil: “An error occurred when rendering a template.”&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find what's making the template error, as my other templates works as normal and I receive these emails (so the email system and templates work when changing status for orders, just this template that does not send out the email).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template is the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set order = craft.commerce.orders.number(order.number).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;    * {&#xA;      font-family: 'Helvetica', 'Arial', sans-serif;&#xA;    }&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;body {&#xA;  margin: 0;&#xA;  padding: 0;&#xA;  min-width: 100%;&#xA;}&#xA;&#xA;#container{&#xA;  max-width: 700px;&#xA;  margin-top: auto;&#xA;  margin-right: auto;&#xA;  margin-bottom: auto;&#xA;  margin-left: auto;&#xA;}&#xA;&#xA;h1{&#xA;  font-size: 28px;&#xA;}&#xA;&#xA;h2{&#xA;  font-size: 22px;&#xA;}&#xA;&#xA;p{&#xA;  font-size: 16px;&#xA;}&#xA;&#xA;table {&#xA;  border-collapse: collapse;&#xA;  border-spacing: 0;&#xA;  width: 100%;&#xA;  margin-bottom: 30px;&#xA;}&#xA;&#xA;td,&#xA;th {&#xA;  padding: 5px;&#xA;  border: none;&#xA;  vertical-align: top;&#xA;  text-align: left;&#xA;}&#xA;&#xA;table#order-summary td{&#xA;  border-bottom: 1px solid #ccc;&#xA;}&#xA;&#xA;table#customer td{&#xA;  width: 50%;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;  &#xA;    {{&quot;Ordrebekreftelse&quot;|t}}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Hei!&quot;t}}&amp;lt;br style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;{{&quot;tusen takk for at du valgte å handle hos Vask&amp;amp;amp;sol!&quot;|t}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Nedenfor finner du en oppsummering av din ordre. Vennligst kontakt oss umiddelbart dersom noe ikke stemmer.&quot;|t}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Referanse:&quot;|t}} #{{order.id}}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Dato:&quot;|t}} {{order.dateOrdered}}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Status:&quot;|t}} {{order.orderStatus}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Oppsummering&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;table id=&quot;order-summary&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;&quot;&amp;gt;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Produkt&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Pris&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Antall&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Totalt&quot;|t}}&amp;lt;/th&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  {% for item in order.lineItems %}&#xA;    &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.description}}&#xA;        &amp;lt;!-- SKU: {{item.sku}} --&amp;gt;&#xA;      &amp;lt;/td&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;&#xA;        {% if item.onSale %}&#xA;          &amp;lt;strike style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;{{item.price + formatNOK}} &amp;lt;/strike&amp;gt; {{item.salePrice + formatNOK}} kr&#xA;        {% else %}&#xA;          {{item.price + formatNOK}} kr&#xA;        {% endif %}&#xA;      &amp;lt;/td&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.qty}}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td class=&quot;text-right&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.total + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Frakt:&quot;|t}} {% if order.shippingMethod.getName() == &quot;&quot; %}{{&quot;Ikke valgt enda&quot;|t}}{% else %}{{order.shippingMethod.getName()}}{% endif %}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalShippingCost + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  {% if order.totalDiscount != &quot;&quot; %}&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Rabatt&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalDiscount + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Totalt&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalPrice + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Herav MVA (25%)&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% set total_vat = order.totalTaxIncluded %}&#xA;{% for adjustment in order.adjustments %}&#xA;  {% if adjustment.name == 'Shipping VAT' and adjustment.amount &gt; 0 %}&#xA;    {% set total_vat = total_vat + adjustment.amount %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;{{total_vat + formatNOK}} kr&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;table id=&quot;customer&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;&quot;&amp;gt;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;&quot;&amp;gt;&#xA;      &amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Leveringsadresse&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;      {% if order.shippingAddress %}&#xA;        {% include '_includes/addresses/address' with { address: order.shippingAddress } %}&#xA;      {% endif %}&#xA;    &amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;&quot;&amp;gt;&#xA;      &amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Fakturaadresse&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;      {% if order.billingAddress %}&#xA;        {% include '_includes/addresses/address' with { address: order.billingAddress } %}&#xA;      {% endif %}&#xA;    &amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;Vask og sol AS&amp;lt;br style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;Org. nr. 987654321&amp;lt;br&amp;gt;&#xA;&amp;lt;a href=&quot;http://vaskogsol.no&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;vaskogsol.no&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;  &#xA;&#xA;&lt;/p&gt;&#xA;" OwnerUserId="6678" LastActivityDate="2017-05-09T06:38:57.970" Title="Error rendering email template" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20397" PostTypeId="2" ParentId="20396" CreationDate="2017-05-09T06:38:57.970" Score="1" Body="&lt;p&gt;I don't know exactly why, but I copied the template from the other status and just changed the text differences, and it worked. There was minor differences as I put them side by side in &lt;a href=&quot;https://www.diffchecker.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.diffchecker.com/&lt;/a&gt; , so I assume it was some error in spacing or a missing comma somewhere (it works, so I'm happy), here is the new code that worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set order = craft.commerce.orders.number(order.number).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;    * {&#xA;      font-family: 'Helvetica', 'Arial', sans-serif;&#xA;    }&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;body {&#xA;  margin: 0;&#xA;  padding: 0;&#xA;  min-width: 100%;&#xA;}&#xA;&#xA;#container{&#xA;  max-width: 700px;&#xA;  margin-top: auto;&#xA;  margin-right: auto;&#xA;  margin-bottom: auto;&#xA;  margin-left: auto;&#xA;}&#xA;&#xA;h1{&#xA;  font-size: 28px;&#xA;}&#xA;&#xA;h2{&#xA;  font-size: 22px;&#xA;}&#xA;&#xA;p{&#xA;  font-size: 16px;&#xA;}&#xA;&#xA;table {&#xA;  border-collapse: collapse;&#xA;  border-spacing: 0;&#xA;  width: 100%;&#xA;  margin-bottom: 30px;&#xA;}&#xA;&#xA;td,&#xA;th {&#xA;  padding: 5px;&#xA;  border: none;&#xA;  vertical-align: top;&#xA;  text-align: left;&#xA;}&#xA;&#xA;table#order-summary td{&#xA;  border-bottom: 1px solid #ccc;&#xA;}&#xA;&#xA;table#customer td{&#xA;  width: 50%;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;  &#xA;    {{&quot;Ordrebekreftelse&quot;|t}}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Hei!&quot;}}&amp;lt;br style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;{{&quot;tusen takk for at du valgte å handle hos Vaskogsol!&quot;|t}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Nedenfor finner du en oppsummering av din ordre. Vennligst kontakt oss umiddelbart dersom noe ikke stemmer.&quot;|t}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Referanse:&quot;|t}} #{{order.id}}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Dato:&quot;|t}} {{order.dateOrdered}}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;{{&quot;Status:&quot;|t}} {{order.orderStatus}}&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Oppsummering&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;table id=&quot;order-summary&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;&quot;&amp;gt;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Produkt&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Pris&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Antall&quot;|t}}&amp;lt;/th&amp;gt;&#xA;    &amp;lt;th style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;&quot;&amp;gt;{{&quot;Totalt&quot;|t}}&amp;lt;/th&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  {% for item in order.lineItems %}&#xA;    &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.description}}&#xA;        &amp;lt;!-- SKU: {{item.sku}} --&amp;gt;&#xA;      &amp;lt;/td&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;&#xA;        {% if item.onSale %}&#xA;          &amp;lt;strike style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;{{item.price + formatNOK}} &amp;lt;/strike&amp;gt; {{item.salePrice + formatNOK}} kr&#xA;        {% else %}&#xA;          {{item.price + formatNOK}} kr&#xA;        {% endif %}&#xA;      &amp;lt;/td&amp;gt;&#xA;      &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.qty}}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td class=&quot;text-right&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{item.total + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Frakt:&quot;|t}} {% if order.shippingMethod.getName() == &quot;&quot; %}{{&quot;Ikke valgt enda&quot;|t}}{% else %}{{order.shippingMethod.getName()}}{% endif %}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalShippingCost + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  {% if order.totalDiscount != &quot;&quot; %}&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Rabatt&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalDiscount + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Totalt&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{order.totalPrice + formatNOK}} kr&amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td colspan=&quot;3&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;{{&quot;Herav MVA (25%)&quot;|t}}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% set total_vat = order.totalTaxIncluded %}&#xA;{% for adjustment in order.adjustments %}&#xA;  {% if adjustment.name == 'Shipping VAT' and adjustment.amount &gt; 0 %}&#xA;    {% set total_vat = total_vat + adjustment.amount %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;{{total_vat + formatNOK}} kr&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;table id=&quot;customer&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;&quot;&amp;gt;&#xA;  &amp;lt;tr style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;&quot;&amp;gt;&#xA;      &amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Leveringsadresse&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;      {% if order.shippingAddress %}&#xA;        {% include '_includes/addresses/address' with { address: order.shippingAddress } %}&#xA;      {% endif %}&#xA;    &amp;lt;/td&amp;gt;&#xA;    &amp;lt;td style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;&quot;&amp;gt;&#xA;      &amp;lt;h2 style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;&quot;&amp;gt;{{&quot;Fakturaadresse&quot;|t}}&amp;lt;/h2&amp;gt;&#xA;      {% if order.billingAddress %}&#xA;        {% include '_includes/addresses/address' with { address: order.billingAddress } %}&#xA;      {% endif %}&#xA;    &amp;lt;/td&amp;gt;&#xA;  &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&#xA;&amp;lt;p style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;Vask og Sol AS&amp;lt;br style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;&quot;&amp;gt;&#xA;Org. nr. 876543219&amp;lt;br&amp;gt;&#xA;&amp;lt;a href=&quot;http://vaskogsol.no&quot; style=&quot;font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;&quot;&amp;gt;vaskogsol.no&amp;lt;/a&amp;gt;&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;/p&gt;&#xA;" OwnerUserId="6678" LastActivityDate="2017-05-09T06:38:57.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20398" PostTypeId="1" AcceptedAnswerId="20402" CreationDate="2017-05-09T08:08:41.673" Score="1" ViewCount="1512" Body="&lt;p&gt;I have a channel, where entries do NOT have their own URLs. But a slug is created automatically every time I save an entry. And I have auto-generated titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often I save an existing entry as a new entry and just change something which changes then my auto-generated titles also. But the slug does not change (only a number is added).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my problem: The search function also searches the slug what then results in wrong search results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: The only solution I've found is to manually delete the existing slug and to save the entry again. Is the a better solution for my problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2017-05-09T17:46:29.110" Title="How to change the Slug in case of copied entries?" Tags="&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20400" PostTypeId="1" AcceptedAnswerId="20489" CreationDate="2017-05-09T14:29:31.243" Score="3" ViewCount="474" Body="&lt;p&gt;I have a calendar for a location that combines recurring events with individual events. I'm trying to list out the upcoming events for the next 90 days, but I'm running into issues with the repeating events. I'd like to list the individual events by dates, and then have the repeating events listed once, with their rule (i.e. Every Monday: Event Title).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventOptions = {&#xA;    calendar: 'otherEvents',&#xA;    dateRangeStart: 'today',&#xA;    dateRangeEnd: '+90 days',&#xA;} %}&#xA;{% set otherEvents = craft.calendar.events(eventOptions) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me a list of all events, but it is overwhelmed by recurring events. I can turn them off by adding loadOccurrences:false, but I'm having trouble loading them on their own.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set eventOptions = {&#xA;    calendar: 'otherEvents',&#xA;    loadOccurrences: false,&#xA;} %}&#xA;{% set otherEvents = craft.calendar.events(eventOptions) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me a list of individual events and a single instance of each repeating event, but it also shows expired events. As soon as I add a date range, the recurring events go away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to get JUST the recurring events, listed once, with their repeat rule? Essentially, i need a loadOnlyOccurrences option.&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-05-16T20:16:57.823" Title="Solspace Calendar: List only recurring events" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20401" PostTypeId="1" CreationDate="2017-05-09T15:51:42.617" Score="1" ViewCount="222" Body="&lt;p&gt;I'm updating a custom field within a product to contain a discount code. The code is generated and the custom field updated using the &lt;code&gt;onBeforeOrderComplete&lt;/code&gt; event. All works well, apart from the order email:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The order email &lt;em&gt;doesn't&lt;/em&gt; contain the discount code (the field is just blank).&lt;/li&gt;&#xA;&lt;li&gt;Checking the product immediately after in the backend, the code is in the field.&lt;/li&gt;&#xA;&lt;li&gt;Switching the order status back to &lt;code&gt;processing&lt;/code&gt; sends the email with the code in it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Which makes me think the email is going out before &lt;code&gt;onBeforeOrderComplete&lt;/code&gt; is triggered. Is this right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I set the custom field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function updateProductWithDiscountCode($productId, $discountCode) &#xA;{&#xA;&#xA;    // GET THE PRODUCT, UPDATE IT AND SAVE&#xA;    $product = craft()-&amp;gt;commerce_products-&amp;gt;getProductById($productId);&#xA;    $product-&amp;gt;setContentFromPost(array('discountCode' =&amp;gt; $discountCode ));&#xA;    if (craft()-&amp;gt;commerce_products-&amp;gt;saveProduct($product)) {&#xA;        GiftVouchersPlugin::log(&quot;Product #$product-&amp;gt;id updated with coupon code $discountCode&quot;, LogLevel::Info);&#xA;    }&#xA;    return TRUE;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin work in progress is here: &lt;a href=&quot;https://github.com/cliveportman/giftVouchers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/cliveportman/giftVouchers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should be happening:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;gift voucher product is created and added to the cart&lt;/li&gt;&#xA;&lt;li&gt;payment takes place&lt;/li&gt;&#xA;&lt;li&gt;when onBeforeOrderComplete is called, if the order contains a gift voucher product, we create a promo and add the discount code to a field within the product&lt;/li&gt;&#xA;&lt;li&gt;the order email is sent, containing the discount code&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I think is happening:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;gift voucher product is created and added to the cart&lt;/li&gt;&#xA;&lt;li&gt;payment takes place&lt;/li&gt;&#xA;&lt;li&gt;the order email is sent, without the discount code&lt;/li&gt;&#xA;&lt;li&gt;when onBeforeOrderComplete is called, if the order contains a gift voucher product, we create a promo and add the discount code to a field within the product&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is a sample of the email template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for item in order.lineItems %}&#xA;    {% if item.purchasable | length %}&#xA;      {% set product = item.purchasable.product %}&#xA;        &amp;lt;div class=&quot;cartitem&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;{{ item.price | currency(order.currency) }} {{ product.title }}&amp;lt;/strong&amp;gt;&#xA;              &amp;lt;br&amp;gt;&#xA;&#xA;              // THIS IS POPULATED WHEN THE PRODUCT IS CREATED SO DISPLAYS FINE&#xA;              {% if product.recipientName | length %}for {{ product.recipientName }}&amp;lt;br&amp;gt;{% endif %}&#xA;&#xA;              // THIS IS EMPTY WHEN THE ORDER EMAIL IS SENT OUT THE FIRST TIME&#xA;              // BUT IS POPULATED IF SENT OUT THROUGH A LATER STATUS CHANGE&#xA;              {% if product.discountCode | length %}code {{ product.discountCode }}&amp;lt;br&amp;gt;{% else %}&#xA;&#xA;                // THIS IS EMPTY AS WELL&#xA;                {{ product.content.discountCode }}&#xA;&#xA;              // THIS IS MY FALLBACK AT THE MOMENT - SENDING PEOPLE TO THE VIEW ORDER PAGE WHERE I CAN SHOW THEM THE DISCOUNT CODE USING {{ product.discountCode }}&#xA;              {#&amp;lt;a href=&quot;{{ siteUrl }}orders/{{ order.number }}&quot;&amp;gt;Click here to view your gift voucher code&amp;lt;/a&amp;gt;#}&amp;lt;br&amp;gt;{% endif %}&#xA;&#xA;            &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-05-18T09:42:10.640" LastActivityDate="2017-05-18T09:42:10.640" Title="When is the order email sent out in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="20402" PostTypeId="2" ParentId="20398" CreationDate="2017-05-09T17:46:29.110" Score="1" Body="&lt;p&gt;Seems like a good case for a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin could verify the entry is in the section you're looking for, compare the existing slug against any saved in the database and do whatever you want to do from there (set it null, etc.).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-09T17:46:29.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20403" PostTypeId="1" CreationDate="2017-05-09T18:54:08.077" Score="1" ViewCount="970" Body="&lt;p&gt;I have a field called &quot;assetId&quot; from Entry &quot;A&quot; with Field Type &quot;Entries&quot; and Source &quot;B&quot;. How can I build a form so that a relation between these two entries will be established.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the craft backend I can add a new entry in Entry &quot;A&quot; and can use the Button &quot;Add an entry&quot; to select the suitable Entry from &quot;B&quot;. This works fine. A record is written in the Table craft_relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I build a user form in the frontend to get this. I tried following form with a hidden field &quot;fields[assetId]&quot; which is set to the id of the suitable content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; class=&quot;send-form&quot; id=&quot;send-form&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;34&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assetId]&quot; value=&quot;1478&quot; id=&quot;hidden-assetID&quot;&amp;gt;&#xA;    [... some more fields ...]&#xA;     &amp;lt;input class=&quot;btn-vote&quot; type=&quot;submit&quot; value=&quot;send&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The entry is saved correctly, but without the assetId. There is no relation between targetId 1478 and the new entry in the Table craft_relations established. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="6585" LastActivityDate="2017-05-10T07:26:35.647" Title="Frontend form with relation to an entry" Tags="&lt;entries&gt;&lt;relations&gt;&lt;form&gt;&lt;entry&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20404" PostTypeId="2" ParentId="20327" CreationDate="2017-05-09T19:02:03.390" Score="3" Body="&lt;p&gt;Based on some research, I believe a custom &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adjuster&lt;/a&gt; is the way to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an adjuster with the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/myplugin/MypluginPlugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function commerce_registerOrderAdjusters()&#xA;{&#xA;  return [&#xA;    401 =&amp;gt; new \Commerce\Adjusters\Myplugin_TenpercentDiscount&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/myplugin/Adjusters/Myplugin_TenPercentDiscount.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class Myplugin_TenPercentDiscount implements Commerce_AdjusterInterface {&#xA;&#xA;public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;    if (empty($lineItems))&#xA;    {&#xA;        return [];&#xA;    }&#xA;&#xA;    if ($order-&amp;gt;totalQty &amp;gt;= 10)&#xA;    {&#xA;        $adjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;        $adjuster-&amp;gt;type        = 'Item Discount';&#xA;        $adjuster-&amp;gt;name        = '10% Off Items';&#xA;        $adjuster-&amp;gt;description = 'Your order qualifies for a 10% discount on all non sale items because you are purchasing at least 10 products.';&#xA;        $adjuster-&amp;gt;orderId     = $order-&amp;gt;id;&#xA;&#xA;        $amountOff = 0;&#xA;        foreach ($lineItems as $item)&#xA;        {&#xA;            if (empty($item-&amp;gt;onSale))&#xA;            {&#xA;                $amountOff += ($item-&amp;gt;subtotal + $item-&amp;gt;discount) * .1;&#xA;            }&#xA;        }&#xA;        $amountOff = $amountOff * -1;&#xA;&#xA;        $adjuster-&amp;gt;amount      = $amountOff;&#xA;        $adjuster-&amp;gt;optionsJson = ['lineItemsAffected' =&amp;gt; null];&#xA;        $order-&amp;gt;baseDiscount  += $amountOff;&#xA;&#xA;        $adjuster-&amp;gt;included = false;&#xA;&#xA;        return [$adjuster];&#xA;    }&#xA;    return[];&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone see any flaws with this approach?&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2018-03-23T21:13:15.190" LastActivityDate="2018-03-23T21:13:15.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20405" PostTypeId="1" CreationDate="2017-05-09T19:14:03.007" Score="1" ViewCount="56" Body="&lt;p&gt;We're trying to use Solspace Freeform with a third party CRM and it (the CRM) has a field name convention that uses underscores (x_firstName, etc). We're trying to set up corresponding forms in Freeform and want to map fields using the same field names as the CRM but it appears that it (Freeform) will not let you use underscores when typing out the handle for a field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any knowledge of this? It seems an odd convention in Freeform to disallow underscore in its field handles.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-05-09T20:57:12.317" LastActivityDate="2017-05-10T14:01:25.827" Title="No Underscores Allowed in Freeform Field Handles?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20407" PostTypeId="5" CreationDate="2017-05-09T23:01:16.233" Score="0" Body="&lt;p&gt;There's a fair amount of space between the documentation and a successful, healthy Craft project. You're probably here on the Stack Exchange site to learn, but you may be looking for help in the right direction. This is your tag, as long as you've still got a focused, specific question.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-09T23:06:35.020" LastActivityDate="2017-05-09T23:06:35.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20408" PostTypeId="4" CreationDate="2017-05-09T23:01:16.233" Score="0" Body="Questions relating to learning materials, professionals, and helpful guides in the Craft CMS universe." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-09T23:01:16.233" LastActivityDate="2017-05-09T23:01:16.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20409" PostTypeId="5" CreationDate="2017-05-10T00:00:52.307" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T00:00:52.307" LastActivityDate="2017-05-10T00:00:52.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20410" PostTypeId="4" CreationDate="2017-05-10T00:00:52.307" Score="0" Body="Questions related to checking things: unit tests, performance tests, A/B testing, etc." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T00:00:52.307" LastActivityDate="2017-05-10T00:00:52.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20411" PostTypeId="5" CreationDate="2017-05-10T01:58:10.807" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T01:58:10.807" LastActivityDate="2017-05-10T01:58:10.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20412" PostTypeId="4" CreationDate="2017-05-10T01:58:10.807" Score="0" Body="Tools and methodology for efficient Craft work, whether it's quick project starts, working in teams, managing deployments, or some other carefully-tuned process." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T01:58:10.807" LastActivityDate="2017-05-10T01:58:10.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20413" PostTypeId="5" CreationDate="2017-05-10T02:11:36.720" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:11:36.720" LastActivityDate="2017-05-10T02:11:36.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20414" PostTypeId="4" CreationDate="2017-05-10T02:11:36.720" Score="0" Body=" Questions about how Craft handles a request." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:11:36.720" LastActivityDate="2017-05-10T02:11:36.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20415" PostTypeId="5" CreationDate="2017-05-10T02:12:48.763" Score="0" Body="" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:12:48.763" LastActivityDate="2017-05-10T02:12:48.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20416" PostTypeId="4" CreationDate="2017-05-10T02:12:48.763" Score="0" Body="Questions around Craft's relational field types." OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-10T02:12:48.763" LastActivityDate="2017-05-10T02:12:48.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20417" PostTypeId="1" AcceptedAnswerId="20418" CreationDate="2017-05-10T03:22:22.483" Score="1" ViewCount="230" Body="&lt;p&gt;I'm building a site that is driven by Craft Commerce but does not take payment online. Rather, the customer adds what they need to a cart and submits to the company for a quote. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to build a contact form that allows the customer to submit their name, email, phone, and company name. When submitted, the form should also turn the cart into an order. I've tried setting 'isCompleted' to 'true' and setting the 'dateOrdered' but cannot seem to get the cart to transition into an order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code I've been testing to try to get the cart to convert into an order. I feel like I'm missing something obvious. Any advice is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;isCompleted&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;dateOrdered&quot; value=&quot;{{ now.format('Y-m-d H:i:s')}}&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Here's the working code as suggested below, where &quot;2&quot; is the ID of the manual payment method I created.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;paymentMethodId&quot; value=&quot;2&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4438" LastEditorUserId="4438" LastEditDate="2017-05-10T14:08:16.957" LastActivityDate="2017-05-11T05:15:45.133" Title="How do I change a cart into an order?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20418" PostTypeId="2" ParentId="20417" CreationDate="2017-05-10T05:04:48.010" Score="2" Body="&lt;p&gt;I don't think you can do it like that - in Commerce, the order gets completed when a payment is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, you can use the manual payment mechanism, which automatically completes the order, as the fake 'payment' type to get this to occur.  Just go in to Commerce settings and create a new payment type of 'manual' set to 'authorize only', and give it a name like 'Get Quote'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually complete the order, you'll need to post the manual &lt;code&gt;paymentMethodId&lt;/code&gt; to a call to &lt;code&gt;commerce/payments/pay&lt;/code&gt;.  If you're doing this in a contact form, you'll have to intercept the form submit and post this via AJAX I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could write your own controller to complete the order with some plugin code, but the above solution is essentially built in an intended for this sort of thing.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-11T05:15:45.133" LastActivityDate="2017-05-11T05:15:45.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20420" PostTypeId="1" AcceptedAnswerId="20423" CreationDate="2017-05-10T07:02:03.313" Score="2" ViewCount="212" Body="&lt;p&gt;I’m creating a multi language site (Arabic/English) with Craft Commerce. On the Arabic cart page I output &lt;code&gt;item.total&lt;/code&gt; with the help of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.total|commerceCurrency(cart.paymentCurrency, convert=true, format=true) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The price is output like so: &quot;دولار أمريكي 5.00&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It translates $ to دولار أمريكي) دولار أمريكي = American dollar) and I want it to be output like so: &quot;$5.00&quot;.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="125" LastEditDate="2017-05-10T09:05:35.813" LastActivityDate="2017-05-10T10:27:02.093" Title="Stop currency translation in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;currency&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20421" PostTypeId="2" ParentId="20403" CreationDate="2017-05-10T07:26:35.647" Score="3" Body="&lt;p&gt;After research with lots of trail &amp;amp; error I found the solution. I just had to add [] to my hidden field to establish the relation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[assetId][]&quot; value=&quot;1478&quot; id=&quot;hidden-assetID&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The leading hint was here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8536/setting-user-field-type-from-a-front-end-form&quot;&gt;Setting User field type from a front end form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6585" LastActivityDate="2017-05-10T07:26:35.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20422" PostTypeId="2" ParentId="16798" CreationDate="2017-05-10T07:47:00.853" Score="2" Body="&lt;p&gt;I found out that vue 2.0 is the problem. It's no longer possible to change the delimiter like that &lt;code&gt;Vue.config.delimiters = ['${', '}'];&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found out on &lt;a href=&quot;https://github.com/vuejs/vue/issues/2873&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt; that it got reworked as a component-level option. So I downloaded the standalone version and changed the delimiter in the code there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is the correct/best way to do this. But it works for now.&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2017-05-10T07:47:00.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20423" PostTypeId="2" ParentId="20420" CreationDate="2017-05-10T09:29:19.007" Score="1" Body="&lt;p&gt;I don’t think it is possible to stop the filter to translate the $ symbol. I don’t know Arabic, but it seems weird to me that the filter does that. If you agree you could consider sending a feature request to Pixel and Tonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around the issue now you could set the format option to false and only use the &lt;code&gt;commerceCurrency&lt;/code&gt; filter to convert the value. Then format it for the output manually with help of the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/filters/number_format.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;number_format&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set total = item.total|commerceCurrency(cart.paymentCurrency, convert=true, format=false) %}&#xA;&#xA;{% if cart.paymentCurrency.iso == 'usd' %}&#xA;    ${{ total|number_format(2, '.', ',') }}&#xA;{% elseif cart.paymentCurrency.iso == 'eur' %}&#xA;    {{ total|number_format(2, '.', ',') }} EUR&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how you can apply the manual formatting to select currencies only.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.paymentCurrency.iso == 'usd' %}&#xA;    {% set total = item.total|commerceCurrency(cart.paymentCurrency, convert=true, format=false) %}&#xA;    ${{ total|number_format(2, '.', ',') }}&#xA;{% elseif cart.paymentCurrency.iso == 'eur' %}&#xA;    {% set total = item.total|commerceCurrency(cart.paymentCurrency, convert=true, format=false) %}&#xA;    {{ total|number_format(2, '.', ',') }} EUR&#xA;{% else %}&#xA;    {{ item.total|commerceCurrency(cart.paymentCurrency, convert=true, format=true) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It’s probably a good idea to use a &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig macro&lt;/a&gt; for this snippet.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-05-10T10:27:02.093" LastActivityDate="2017-05-10T10:27:02.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20424" PostTypeId="1" AcceptedAnswerId="20425" CreationDate="2017-05-10T10:26:59.540" Score="2" ViewCount="326" Body="&lt;p&gt;This might sound counter-intuitive, but I'm trying to set a specific limit; if the &lt;code&gt;currentPage&lt;/code&gt; is the first paginated entry. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set limit = paginate.currentPage == 1 ? 5 : 8 %}&#xA;{% paginate craft.entries.section('news').limit(limit) as articles %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know this isn't going to work because I'm querying the &lt;code&gt;paginate&lt;/code&gt; tag before I've set it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a way to set a custom limit for the first page only?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-05-10T11:17:34.310" Title="Check paginated currentPage before setting the paginate tag" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20425" PostTypeId="2" ParentId="20424" CreationDate="2017-05-10T11:17:34.310" Score="4" Body="&lt;p&gt;Ok, so after discovering the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getPageNum&quot; rel=&quot;nofollow noreferrer&quot;&gt;getPageNum&lt;/a&gt; request, I found the following solution: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageNumber = craft.request.getPageNum %}&#xA;{% set firstPageLimit = 5 %}&#xA;{% set defaultLimit = 8 %}&#xA;{% set limit = pageNumber == 1 ? firstPageLimit : defaultLimit %}&#xA;{% set offset = pageNumber == 1 ? 0 : firstPageLimit - defaultLimit %}&#xA;{% paginate craft.entries.section('news').limit(limit).offset(offset) as articles %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-05-10T11:17:34.310" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20426" PostTypeId="1" CreationDate="2017-05-10T11:28:16.673" Score="1" ViewCount="93" Body="&lt;p&gt;I have a site which has another group site - both use same templates but I want to include different phone number in the header of each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wanting to use Global Set Variables to pull this information in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works fine in the execute delimiters but not in the print delimeters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;includes/#{ craft.config.siteCode }/head-constants&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to include it within another variable like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ #{ craft.config.siteCode }Defaults.defaultTelephoneLink }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives the Template Error: Unexpected character &quot;#&quot;. &lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-05-10T17:48:25.260" Title="Include Global Set Variable in Print Delimiters" Tags="&lt;templating&gt;&lt;variable&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20428" PostTypeId="2" ParentId="20405" CreationDate="2017-05-10T14:01:25.827" Score="2" Body="&lt;p&gt;Not likely to be an issue for anyone in the future but just incase someone is looking at this... Turns out Freeform should be able to handle underscores in field handles. Just an oversight on the Solspace side and they're going to be patching in support for underscores shortly.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-05-10T14:01:25.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20429" PostTypeId="2" ParentId="20426" CreationDate="2017-05-10T17:48:25.260" Score="1" Body="&lt;p&gt;You'd want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;#&quot; ~ craft.config.siteCode ~&quot;Defaults.defaultTelephoneLink&quot; }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-10T17:48:25.260" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20430" PostTypeId="1" AcceptedAnswerId="20457" CreationDate="2017-05-10T18:32:18.363" Score="1" ViewCount="129" Body="&lt;p&gt;I am fairly new to Craft but like it's potential but I am not sure the best way to architect a site I am building.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a high level picture of the site.  It is a learning site that will have multiple user groups.  The portion I am having difficulty with is I have a variety of events.  Each event is an event type (type A, type B, etc.)  Each one can only be one type of event.  The event would have some basic info such as title, description, date, etc.  Where it gets difficult is each event will have groups.  Within each group there will be sessions.  So it could be Group 1, Group 2, Group 3 for groups and then within each Group there would be Session A, Session B, etc.  Lastly within each Session there will be items or tasks.  Mainly it will be just a description and then an asset to view (pdf, video, doc, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is a deeply nested relationship within each event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure the best way to structure this.  I think I can create separate sections for event, event group, group session and session item and then just try to relate them all to each other. I also think I could use a plugin such as NEO and just use nested matrix to contain everything.  Or potentially there is a much better way to do it that I do not see since I am new to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the other smaller roadblocks.  I want to keep track if a user completes a task.  I am guessing I will have to build a plugin to do this.  I also want to items/tasks to be based on user group level.  So maybe there are 10 items/task in a session but only 7 of them are for user group 1 so they would not see the other 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas, tips or advice is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6703" LastActivityDate="2017-05-12T17:37:12.773" Title="Architecture advice" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20431" PostTypeId="1" CreationDate="2017-05-10T18:56:30.340" Score="1" ViewCount="51" Body="&lt;p&gt;My section has two numeric fields, &lt;code&gt;lorem&lt;/code&gt; and &lt;code&gt;ipsum&lt;/code&gt;. It's possible for users to enter any integer they want into these two fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want to grab all results where &lt;code&gt;lorem&lt;/code&gt; is greater than &lt;code&gt;ipsum&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my starting point...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.section('foo').limit(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I alter the above Element Criteria Model to only retrieve entries where the value of &lt;code&gt;lorem&lt;/code&gt; is greater than the value of &lt;code&gt;ipsum&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-05-10T18:56:30.340" Title="When constructing an ECM, is it possible to compare two values?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;comparisons&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20433" PostTypeId="1" CreationDate="2017-05-11T05:32:42.147" Score="2" ViewCount="119" Body="&lt;p&gt;Entries in a particular section have expiration dates of up to one year away. The client would like to receive a notification email two weeks before this expiration date is reached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a bonus question: These entries are connected to another section of vets. Each vet entry will have an email field. Whatever vet is connected to the original entry in question (the one with the expiration field) also needs to receive this notification email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any existing plugins that allow this? I haven't found any yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-09-09T00:16:20.993" Title="Sending an email before entry expires" Tags="&lt;entries&gt;&lt;emails&gt;&lt;expiration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20434" PostTypeId="2" ParentId="15401" CreationDate="2017-05-11T12:32:15.160" Score="1" Body="&lt;p&gt;It was an issue with the /tmp folder filling up. Have to regularly make sure it's emptied. If the /tmp folder has proper permissions this should happen automatically.&lt;/p&gt;&#xA;" OwnerUserId="5256" LastActivityDate="2017-05-11T12:32:15.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20435" PostTypeId="1" AcceptedAnswerId="20437" CreationDate="2017-05-11T13:16:31.020" Score="1" ViewCount="163" Body="&lt;p&gt;I'm using Charge to collect donations toward individual projects for a charity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the frontend, I want to display how much has been raised for an individual project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a list of charges for a project, I'm doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set charges = craft.charge.charges({  &#xA;      search : { query : 'projectDonateTo:' ~ entry.id }}&#xA;   )%}&#xA;&#xA;{% for charge in charges %}&#xA;    {{ charge.amount }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which obviously loops through all charges but I can't fathom how to total these together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-05-11T16:23:25.980" Title="Collecting total charge value where custom field is X" Tags="&lt;templating&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20436" PostTypeId="1" AcceptedAnswerId="20445" CreationDate="2017-05-11T14:44:40.220" Score="3" ViewCount="200" Body="&lt;p&gt;There is a 'Use shipping for billing' field in the Craft Commerce sample templates but it is unclear to me how to use that in the CP or for an account user in their account or for a future checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot find any documentation regarding this field in the Commerce documents. Is this only being used on the sample templates to handle front end display logic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to be able to save this field so that when an account holder logs into their account, we can show their Shipping and Billing address in the correct state (ie. Billing address fields hidden and 'use shipping' checked). This would also apply to future checkouts too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this with the Commerce address fields? Or would we have to add a non-Commerce custom field to Users to save this and then add logic accordingly based on that field? And if yes, would that mean a separate ajax post to save that non-Commerce field during a checkout - or would it get saved to the User profile along with everything else?&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-05-12T06:32:16.203" Title="Commerce: How to implement/save 'Use shipping for billing' field for future orders" Tags="&lt;plugin-craftcommerce&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20437" PostTypeId="2" ParentId="20435" CreationDate="2017-05-11T15:28:45.797" Score="1" Body="&lt;p&gt;Can you not do:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set total = 0 %}&#xA;&#xA;{% for charge in charges %}&#xA;    {% set total = total + charge.amount %}&#xA;{% endfor %}&#xA;&#xA;{{ total|number_format(2, '.', ',') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2017-05-11T16:23:25.980" LastActivityDate="2017-05-11T16:23:25.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20438" PostTypeId="1" CreationDate="2017-05-11T15:50:10.380" Score="1" ViewCount="101" Body="&lt;p&gt;I've got a potential client I'd like to build a Craft site for, but they have some specific features I'm not quite sure how to handle. Could someone tell me if Craft can handle the following features?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Frontend ability for users to create and join &quot;groups&quot;.&lt;/strong&gt; &quot;Groups&quot; is in quotation marks since I don't think they need to be actual Craft User Groups; they don't need differing permissions, just segregation—so Categories, perhaps, or Tags?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Frontend ability for users to invite others to specific &quot;groups&quot;&lt;/strong&gt;—basically an email-a-friend a link with a signup/login token that will add them to the specified group.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The ability for users to have their own blog on the site, where other users can comment.&lt;/strong&gt; I'm fairly certain Craft can do separate author-specific blogs natively, as it's essentially just a listing page of a specific author's entries. I also know comments are either Disqus or the Comments plugin by Engram Design. I'm leaving this point in here though because I haven't &lt;em&gt;done&lt;/em&gt; this in Craft yet, so I'm blissfully unaware of any gotchas there may be... ;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2017-05-11T18:27:30.337" Title="Can Craft handle social-esque frontend user interactions?" Tags="&lt;users&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20439" PostTypeId="2" ParentId="20438" CreationDate="2017-05-11T18:15:15.600" Score="2" Body="&lt;p&gt;What kind of social interactions are you asking for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can probably make most of this work in Craft but a lot of what you're asking for isn't really &quot;built in.&quot; It's going to take a fair amount of effort on your part via some business logic to assign users to groups (or categories), etc. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frontend ability for users to create and join &quot;groups&quot;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How much security do you want? Just as a high level overview, users in Craft have &lt;a href=&quot;https://craftcms.com/docs/users#permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;various permissions&lt;/a&gt; depending on where (which section) they can &quot;post&quot; entries into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the system allows users to submit content on a section-by-section basis. It's up to the permissions you have set if other users are allowed to &quot;see&quot; such entries or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any additional checks, an enterprising user could theoretically mess with some of the front end forms and post to other &quot;groups&quot; if they have permission to do so. It'd be up to your code to make sure the user is part of such &quot;group&quot; (or category) first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were me, depending on what you're trying to achieve, I might programmatically create new sections when a user creates a new &quot;group&quot; and only members of that group when invited are allowed to see / post in it. Craft would help you take care of the heavy lifting too; you would basically assign the permission of viewing/writing of that section to that user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins can also create their own permissions depending on what you need to do.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frontend ability for users to invite others to specific &quot;groups&quot;—basically an email-a-friend a link with a signup/login token that will add them to the specified group.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This wouldn't be native to Craft. You'd have to build the token generation and e-mailing process here, along with doing the business logic of figuring out who was invited by whom, if said token is valid, etc.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The ability for users to have their own blog on the site, where other users can comment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, as you mentioned, this is relatively straightforward, as Craft is basically a CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A hybrid approach might be to use a bulletin board/forum style software (xenforo, vbulletin, buddypress, etc.) to handle the discussions / social groups functionality then let Craft handle the blogging part. There is various authentication bridges you could use to handle user login between the two systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there's a few other ways to pull this off as well.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-05-11T18:27:30.337" LastActivityDate="2017-05-11T18:27:30.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20440" PostTypeId="1" AcceptedAnswerId="20444" CreationDate="2017-05-11T20:02:42.520" Score="4" ViewCount="347" Body="&lt;p&gt;I can not for the life of me figure out why my cp page will not generate the elements table. On other elementtype pages in the cp there is an XHR request made to a controller called &quot;getElements&quot; and that returns the html for the elements table. On my elementtype page there is no XHR call and the page just sits there with no table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my template twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;Pending Account Requests&quot;|t %}&#xA;{% set elementType = 'GrnPlatform_AccountRequest' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my class for my element&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class GrnPlatform_AccountRequestElementType extends BaseElementType&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('GRN Account Request');&#xA;    }&#xA;&#xA;    public function defineTableAttributes()&#xA;    {&#xA;        return array(&#xA;            'firstName'         =&amp;gt; Craft::t('First Name'),&#xA;            'lastName'          =&amp;gt; Craft::t('Last Name'),&#xA;            'email'             =&amp;gt; Craft::t('Email Address'),&#xA;            'roleRequested'     =&amp;gt; Craft::t('Request For'),&#xA;            'dateCreated'       =&amp;gt; Craft::t('Requested On')&#xA;        );&#xA;    }&#xA;&#xA;    public function getTableAttributeHtml(BaseElementModel $element, $attribute)&#xA;    {&#xA;        switch ($attribute)&#xA;        {&#xA;            case 'dateCreated':&#xA;            {&#xA;                $date = $element-&amp;gt;$attribute;&#xA;&#xA;                if ($date)&#xA;                {&#xA;                    return $date-&amp;gt;localeDate();&#xA;                }&#xA;                else&#xA;                {&#xA;                    return '';&#xA;                }&#xA;            }&#xA;&#xA;            default:&#xA;            {&#xA;                return parent::getTableAttributeHtml($element, $attribute);&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    public function defineCriteriaAttributes()&#xA;    {&#xA;        return array(&#xA;            'userId'            =&amp;gt; AttributeType::Number,&#xA;            'approved'          =&amp;gt; AttributeType::Number,&#xA;            'denied'            =&amp;gt; AttributeType::Number,&#xA;            'roleRequested'     =&amp;gt; AttributeType::Mixed,&#xA;            'dateCreated'       =&amp;gt; AttributeType::Mixed,&#xA;            'order'             =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; 'requests.dateCreated asc')&#xA;        );&#xA;    }&#xA;&#xA;    public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)&#xA;    {&#xA;        $query&#xA;            -&amp;gt;addSelect('users.firstName, users.lastName, users.email, requests.roleRequested, requests.approved, requests.denied, requests.dateCreated')&#xA;            -&amp;gt;Join('grnplatform_account_requests requests', 'requests.id = elements.id')&#xA;            -&amp;gt;leftJoin('users users', 'users.id = requests.userId');&#xA;        if(isset($criteria-&amp;gt;userId)) {&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('requests.userId', $criteria-&amp;gt;userId, $query-&amp;gt;params));&#xA;        }&#xA;        if(isset($criteria-&amp;gt;roleRequested)) {&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('requests.roleRequested', $criteria-&amp;gt;roleRequested, $query-&amp;gt;params));&#xA;        }&#xA;        if(isset($criteria-&amp;gt;dateCreated)) {&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('requests.dateCreated', $criteria-&amp;gt;dateCreated, $query-&amp;gt;params));&#xA;        }&#xA;        if(isset($criteria-&amp;gt;approved)) {&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('requests.approved', $criteria-&amp;gt;approved, $query-&amp;gt;params));&#xA;        }&#xA;        if(isset($criteria-&amp;gt;denied)) {&#xA;            $query-&amp;gt;andWhere(DbHelper::parseParam('requests.denied', $criteria-&amp;gt;denied, $query-&amp;gt;params));&#xA;        }&#xA;    }&#xA;&#xA;    public function populateElementModel($row)&#xA;    {&#xA;        return GrnPlatform_AccountRequestModel::populateModel($row);&#xA;    }&#xA;&#xA;    public function getEditorHtml(BaseElementModel $element)&#xA;    {&#xA;        return parent::getEditorHtml($element);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my plugin code for the route to the page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'grnplatform'                   =&amp;gt; array('action' =&amp;gt; 'GrnPlatform/mainIndex'),&#xA;        'grnplatform/AccountRequests'   =&amp;gt; array('action' =&amp;gt; 'GrnPlatform/AccountRequest/mainIndex')&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the controller that gets routed and renders the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;class GrnPlatform_AccountRequestController extends BaseController&#xA;{&#xA;    public function actionMainIndex()&#xA;    {&#xA;&#xA;        $this-&amp;gt;renderTemplate('grnplatform/cp/account_requests');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the ElementModel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class GrnPlatform_AccountRequestModel extends BaseElementModel&#xA;{&#xA;    protected $elementType = 'GrnPlatform_AccountRequest';&#xA;&#xA;    public function __toString()&#xA;    {&#xA;        return ucfirst($this-&amp;gt;getAttribute('roleRequested')) . &quot; Request&quot;;&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array_merge(parent::defineAttributes(), array(&#xA;            'userId'            =&amp;gt; array(&quot;type&quot; =&amp;gt; AttributeType::Number, &quot;required&quot; =&amp;gt; true),&#xA;            'roleRequested'     =&amp;gt; array(&quot;type&quot; =&amp;gt; AttributeType::Enum, &quot;values&quot; =&amp;gt; array(&quot;vendor&quot;, &quot;facilitator&quot;), &quot;required&quot; =&amp;gt; true),&#xA;            'message'           =&amp;gt; array(&quot;type&quot; =&amp;gt; AttributeType::String, 'required' =&amp;gt; true),&#xA;            'completed'         =&amp;gt; AttributeType::Bool,&#xA;            'approved'          =&amp;gt; AttributeType::Bool,&#xA;            'denied'            =&amp;gt; AttributeType::Bool&#xA;        ));&#xA;    }&#xA;&#xA;    public function isEditable()&#xA;    {&#xA;        return true;&#xA;    }&#xA;&#xA;    public function getCpEditUrl()&#xA;    {&#xA;    }&#xA;&#xA;    public function getFieldLayout()&#xA;    {&#xA;        return null;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the Record for the element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class GrnPlatform_AccountRequestRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'grnplatform_account_requests';&#xA;    }&#xA;&#xA;   protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'userId'        =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true),&#xA;            'roleRequested' =&amp;gt; array(AttributeType::Enum, 'values' =&amp;gt; array('vendor','facilitator'), 'required' =&amp;gt; true),&#xA;            'message'       =&amp;gt; array(AttributeType::String, 'column' =&amp;gt; ColumnType::Text, 'required' =&amp;gt; true),&#xA;            'denied'        =&amp;gt; AttributeType::Bool,&#xA;            'approved'      =&amp;gt; AttributeType::Bool&#xA;        );&#xA;    }&#xA;&#xA;    public function defineRelations()&#xA;    {&#xA;        return array(&#xA;            'element'  =&amp;gt; array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' =&amp;gt; true, 'onDelete' =&amp;gt; static::CASCADE),&#xA;            'user' =&amp;gt; array(static::BELONGS_TO, 'UserRecord', 'userId', 'onDelete' =&amp;gt; static::CASCADE)&#xA;        );&#xA;    }&#xA;&#xA;    public function defineIndexes()&#xA;    {&#xA;        return array(&#xA;            array('columns'=&amp;gt;array('roleRequested'), 'unique' =&amp;gt; false),&#xA;            array('columns'=&amp;gt;array('denied'), 'unique' =&amp;gt; false),&#xA;            array('columns'=&amp;gt;array('approved'), 'unique' =&amp;gt; false),&#xA;            array('columns'=&amp;gt;array('userId'), 'unique' =&amp;gt; false)&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT 1&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some manual debugging through the JS on the page and I found this inside the &lt;code&gt;Craft.baseElementIndex:init()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// No source, no party.&#xA;if ($sources.length == 0)&#xA;{&#xA;    return;&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code is hitting this because I dont have any sources... Honestly I'm not even sure what my sources would be in this instance...&lt;/p&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="6309" LastEditDate="2017-05-11T21:12:47.227" LastActivityDate="2017-05-11T21:52:59.883" Title="ElementType CP section does not display table" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20443" PostTypeId="2" ParentId="20433" CreationDate="2017-05-11T21:34:53.217" Score="2" Body="&lt;p&gt;I'm not aware of any existing plugins that would do this, and it seems pretty use-case specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this with a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom&lt;/a&gt; &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; and a cron job, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cron job would run every 1/5/x minutes, hit an action in your plugin's controller and that action could get the entries in the section you're interested in, check the post date and decide what to do from there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-11T21:34:53.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20444" PostTypeId="2" ParentId="20440" CreationDate="2017-05-11T21:52:59.883" Score="5" Body="&lt;p&gt;You haven't defined any sources for your ElementType.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;public function getSources($context = null)&#xA;{&#xA;    $sources = [&#xA;        '*' =&amp;gt; [&#xA;            'label' =&amp;gt; Craft::t('All entries'),&#xA;            'criteria' =&amp;gt; [],&#xA;            'defaultSort' =&amp;gt; ['dateUpdated', 'desc']&#xA;        ]&#xA;    ];&#xA;&#xA;    return $sources;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-05-11T21:52:59.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20445" PostTypeId="2" ParentId="20436" CreationDate="2017-05-12T06:32:16.203" Score="4" Body="&lt;p&gt;We achieve this by simply checking the ids of the addresses set on the cart.  Commerce saves the last used shipping and billing address for customers, so you can just use some simple template logic to achieve what you want I think:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set sameAddress = true %}&#xA;        {% if cart.shippingAddress and cart.billingAddress %}&#xA;            {% if cart.shippingAddress.id != cart.billingAddress.id %}&#xA;                {% set sameAddress = false %}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;same-address-checkbox&quot;&amp;gt;&#xA;            {{ forms.inputCheckbox({&#xA;                type: 'checkbox',&#xA;                id: 'sameAddress',&#xA;                name: 'sameAddress',&#xA;                checked: sameAddress,&#xA;                value: '1',&#xA;                label: 'Use same address for billing address?',&#xA;            }) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One caveat here, if you offer a checkout during registration, you'llw ant to use my plugin for this as otherwise these last used addresses are not copied to the newly created Craft user - &lt;a href=&quot;https://github.com/bossanova808/CommerceRegisterOnCheckout&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bossanova808/CommerceRegisterOnCheckout&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-12T06:32:16.203" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20446" PostTypeId="1" AcceptedAnswerId="20447" CreationDate="2017-05-12T08:16:58.177" Score="3" ViewCount="759" Body="&lt;p&gt;Just wondering what the most efficient way to check whether a section has any entries or not. Based on this, I'm showing some content. The content doesn't take any information from the entries in the section, so it'll be a superfluous query no matter what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For context, this is basically what it'll look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('whatever') | length &amp;gt; 0 %}&#xA;    &amp;lt;a href=&quot;www.com&quot;&amp;gt;Go here&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="968" LastEditorUserId="57" LastEditDate="2017-05-12T20:58:25.567" LastActivityDate="2017-05-12T20:58:25.567" Title="Most efficient way to check if a section has any active entries" Tags="&lt;entries&gt;&lt;sections&gt;&lt;query&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20447" PostTypeId="2" ParentId="20446" CreationDate="2017-05-12T08:21:44.457" Score="4" Body="&lt;p&gt;Not a definitive answer at all, but you could at least add a &lt;code&gt;.ids()&lt;/code&gt; on that so it only retrieves the entry ids and not all the entry data...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('whatever').ids() | length &amp;gt; 0 %}&#xA;&amp;lt;a href=&quot;www.com&quot;&amp;gt;Go here&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-12T08:21:44.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20448" PostTypeId="2" ParentId="20446" CreationDate="2017-05-12T09:12:40.023" Score="6" Body="&lt;p&gt;You can use &lt;code&gt;{{ craft.entries.section('whatever').total() }}&lt;/code&gt; for that.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-05-12T09:12:40.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20449" PostTypeId="1" AcceptedAnswerId="20469" CreationDate="2017-05-12T09:35:31.153" Score="2" ViewCount="269" Body="&lt;p&gt;Is it possible to have multiple local database configurations? I have just setup homestead but I work in a team who use MAMP, and MAMP username password is &lt;strong&gt;root&lt;/strong&gt; whereas homestead uses &lt;strong&gt;homestead&lt;/strong&gt; and &lt;strong&gt;secret&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I change the details it works fine for homestead but then breaks for MAMP users.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'local' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'database' =&amp;gt; 'craft',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'root'&#xA;)&#xA;&#xA;'local' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'database' =&amp;gt; 'craft',&#xA;    'user' =&amp;gt; 'homestead',&#xA;    'password' =&amp;gt; 'secret'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to have local set both to be compatible with homestead and MAMP at the same time?&lt;/p&gt;&#xA;" OwnerUserId="6706" LastActivityDate="2017-05-15T13:29:48.527" Title="Homestead DB config" Tags="&lt;database&gt;&lt;config&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20450" PostTypeId="1" AcceptedAnswerId="20453" CreationDate="2017-05-12T09:54:32.967" Score="2" ViewCount="315" Body="&lt;p&gt;I have come up against an issue, and I want to check the best way to resolve this; here is a brief explanation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by default I have setup the craft assets folder to be called 'resources' and this lives in the top level of the website (although I think location is irrelevant). The client has now introduced a section called resources that has several child pages and a top level page. Which is accessed at /resources/ - I think the most sensible change is to rename my resources folder that holds all the uploaded assets. I will probably rename it uploads. However, what is the best approach to rename this without upsetting the system or having big issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention my resources folder also contains several sub folders for assets too.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-05-13T20:35:47.623" Title="Conflict with assets folder and section URL" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20451" PostTypeId="1" AcceptedAnswerId="20455" CreationDate="2017-05-12T14:04:38.387" Score="2" ViewCount="41" Body="&lt;p&gt;I am trying to figure out how I can put categories to use, and I need some help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a category group called &quot;group1&quot;, and 2 catogories inside called &quot;cat1&quot; and &quot;cat2&quot;. and I have added the catogorie field to some articles in a structure so that I have a few linked to both cat1 and cat2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal simply to make a forloop listing the catogorie title of both cat1 and cat2, and create an UL with the entry.title of the entries in each catogorie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cat in craft.categories.group('group1') %}&#xA;    &amp;lt;p&amp;gt;{{ cat.title }}&amp;lt;/p&amp;gt;&#xA;    {% for entry in craft.entries.section('structure').level(3).relatedTo(cat) %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me the two catogorie titles, but no entry titles. I dont think I understand how to use the related to group part. Would really appreaciate some help figuring this one out.&lt;/p&gt;&#xA;" OwnerUserId="6394" LastActivityDate="2017-05-12T17:13:46.873" Title="Need a little help with basic understanding of how categories work" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20452" PostTypeId="2" ParentId="20451" CreationDate="2017-05-12T14:15:22.223" Score="3" Body="&lt;p&gt;Your code is only listing entries in the structure that are nested inside 2 parent entries. Try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('structure').relatedTo(cat) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, your &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; is inside your for loop, it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for entry in craft.entries.section('structure').relatedTo(cat) %}`&#xA;    &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor%}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-05-12T14:15:22.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20453" PostTypeId="2" ParentId="20450" CreationDate="2017-05-12T15:20:30.203" Score="4" Body="&lt;p&gt;You should be able to rename the directory on the server and then update the Asset Source settings changing the URL and system path. It should take care of it as Asset folders are stored relative to the top folder.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-05-12T15:20:30.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20454" PostTypeId="2" ParentId="20450" CreationDate="2017-05-12T15:24:23.320" Score="3" Body="&lt;p&gt;I usually use environment variables in the config.php to define paths to folders.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_PUBLIC_PATH', realpath(dirname(__FILE__) . '/../') . '/public/');&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;        // ...&#xA;    ),&#xA;&#xA;    'example.dev' =&amp;gt; array(&#xA;        // ...&#xA;&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '...',&#xA;            'baseUrl'  =&amp;gt; '...',&#xA;            'assetsPath'  =&amp;gt; CRAFT_PUBLIC_PATH . 'assets',&#xA;            'assetsUrl'  =&amp;gt; '/assets',&#xA;        )&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use the path in your twig templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.environmentVariables.assetsUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And, if you define paths for Asset Sources, simply add the variable like this to the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{assetsPath}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way, you can change the path easily at one place, after you had to rename a folder. The config is taken from: &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/multi-environment-configs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to dig in deeper and make it completely right, I recommend following this advice (advanced): &lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6673" LastEditorUserId="6673" LastEditDate="2017-05-13T20:35:47.623" LastActivityDate="2017-05-13T20:35:47.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20455" PostTypeId="2" ParentId="20451" CreationDate="2017-05-12T17:13:46.873" Score="3" Body="&lt;p&gt;You're being a little too specific in your entries call. Chances are you don't have any entries at level 3. And, what happens if you have entries in a channel that might be related to those categories?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for cat in craft.categories.group('group1') %}&#xA;  &amp;lt;p&amp;gt;{{ cat.title }}&amp;lt;/p&amp;gt;&#xA;  {# You can just query all the entries in the system. Or you can provide other criteria. #}&#xA;  {% set relatedEntries = craft.entries.relatedTo(cat) %}&#xA;  {# Why the variable above? Well we can check the length and see if we have responses and avoid injecting empty HTML tags into our code #}&#xA;  {% if relatedEntries|length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in relatedEntries %}&#xA;      &amp;lt;li&amp;gt;{{ entry.title}}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can provide additional criteria to the query for entries too. The above searches the whole system for any related entries.&#xA;This would just query any items in the 'structure' section for related entries to the category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = craft.entries.section('structure').relatedTo(cat) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="222" LastActivityDate="2017-05-12T17:13:46.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20456" PostTypeId="1" AcceptedAnswerId="20474" CreationDate="2017-05-12T17:34:56.950" Score="1" ViewCount="189" Body="&lt;p&gt;I'm running Craft CMS 2.6.2972 so I had to use &lt;a href=&quot;https://github.com/craftcms/element-api/tree/1.2.1&quot; rel=&quot;nofollow noreferrer&quot;&gt;the older Element API plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have downloaded the zip and then copied just the &quot;elementapi&quot; file in the zip to the plugin's folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I installed the plugin in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I made a file craft/config/elementapi.php with the contents&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I hit the URL &lt;code&gt;&amp;lt;myserver&amp;gt;/api/news.json&lt;/code&gt; then I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/05/12 17:31:47 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in C:\inetpub\wwwroot\craft\app\controllers\TemplatesController.php:59 Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('api/news.json', Array)&#xA;#1 C:\inetpub\wwwroot\craft\app\framework\web\actions\CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 C:\inetpub\wwwroot\craft\app\framework\web\actions\CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 C:\inetpub\wwwroot\craft\app\etc\web\WebApp.php(290): CWebApplication-&amp;gt;processRequest()&#xA;#9 C:\inetpub\wwwroot\craft\app\framework\base\CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 C:\inetpub\wwwroot\craft\app\index.php(62): CApplication-&amp;gt;run()&#xA;#11 C:\inetpub\wwwroot\public\index.php(14): require_once('C:\\inetpub\\wwwr...')&#xA;#12 {main} REQUEST_URI=/api/news.json&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What might be wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is running on IIS and I've added .json to the mime types for the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This error is the same error as an unhandled link/route. So seems like it's not picking up the config or I have the wrong URL. The plugin did install ok.&lt;/p&gt;&#xA;" OwnerUserId="774" LastEditorDisplayName="user1080" LastEditDate="2017-05-23T23:07:22.950" LastActivityDate="2017-05-23T23:07:22.950" Title="Configuring Element API 1.2.1 Plugin" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20457" PostTypeId="2" ParentId="20430" CreationDate="2017-05-12T17:37:12.773" Score="1" Body="&lt;p&gt;I've built something similar before. I found when I thought about the flow from bottom up, it becomes a little clearer. From your description:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tasks get related to Sessions&lt;/li&gt;&#xA;&lt;li&gt;Sessions get related to Groups&lt;/li&gt;&#xA;&lt;li&gt;Groups are related to Events&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For user tracking you may have to write something custom, but it becomes a little more clear if you know that Task A, Task B and Task C was completed by User 12345, and Group &lt;em&gt;Foo&lt;/em&gt; contains those tasks. So, now &lt;em&gt;Foo&lt;/em&gt; is complete and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A con to this is that you end up having components of your site/app spread out over channels/categories/structures etc. It can be really confusing for a client if having them curate content is the intention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Matrix: If you're storing lots of these items within matrices and setup a bunch of relations, it probably adds a layer of complexity to implement user tracking. Additionally with a lot of related/nested/matrix items you run into massive queries that can bog down or cause a system to run out of memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach might be to write your own plugin that could maintain all this information for you. Craft is really great at providing a super solid foundation for tons of regular website and web app things. But the real &lt;strong&gt;power&lt;/strong&gt; comes from the extensibility you can add.&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2017-05-12T17:37:12.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20458" PostTypeId="1" AcceptedAnswerId="20460" CreationDate="2017-05-12T20:55:30.497" Score="3" ViewCount="567" Body="&lt;p&gt;I'm having some trouble getting Craft to install with Laravel Valet. All I'm getting on the .dev, .dev/admin, .dev/index.php/admin? is the 'service unavailable'. Not sure if it's just new to Craft or something very unique to me. Thanks in advance for any help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;return array(&#xA;&#xA;    'server' =&amp;gt; '127.0.0.1',&#xA;&#xA;    'database' =&amp;gt; 'activeendurance',&#xA;&#xA;    'user' =&amp;gt; 'root',&#xA;&#xA;    'password' =&amp;gt; '',&#xA;&#xA;    'tablePrefix' =&amp;gt; 'craft',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft.log&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    2017/05/12 20:32:46 [trace] [system.CModule] Loading &quot;cache&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (137)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/bootstrap.php (190)&#xA;2017/05/12 20:32:46 [trace] [system.CModule] Loading &quot;path&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/cache/FileCache.php (41)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/CacheService.php (114)&#xA;2017/05/12 20:32:46 [trace] [system.CModule] Loading &quot;request&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (138)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/bootstrap.php (190)&#xA;2017/05/12 20:32:46 [trace] [system.caching.Craft\FileCache] Serving &quot;usePathInfo&quot; from cache&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/CacheService.php (180)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/ConfigService.php (392)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/HttpRequestService.php (1158)&#xA;2017/05/12 20:32:46 [trace] [system.CModule] Loading &quot;urlManager&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/HttpRequestService.php (1498)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/HttpRequestService.php (1165)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;log&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (139)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/bootstrap.php (190)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;coreMessages&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (142)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/bootstrap.php (190)&#xA;2017/05/12 20:32:47 [trace] [system.db.CDbConnection] Opening DB connection&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/behaviors/AppBehavior.php (871)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (591)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/behaviors/AppBehavior.php (80)&#xA;2017/05/12 20:32:47 [trace] [system.db.CDbCommand] Querying SQL: SHOW TABLES LIKE 'craft_%'&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/db/schemas/MysqlSchema.php (312)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/db/DbConnection.php (90)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/behaviors/AppBehavior.php (98)&#xA;2017/05/12 20:32:47 [profile] [system.db.CDbCommand.query] begin:system.db.CDbCommand.query(SHOW TABLES LIKE 'craft_%')&#xA;2017/05/12 20:32:47 [profile] [system.db.CDbCommand.query] end:system.db.CDbCommand.query(SHOW TABLES LIKE 'craft_%')&#xA;2017/05/12 20:32:47 [error] [exception.Craft\HttpException.503] Craft\HttpException in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php:800&#xA;Stack trace:&#xA;#0 /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /Users/jfrank/activeSites/activeendurance/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /Users/jfrank/activeSites/activeendurance/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /Users/jfrank/activeSites/activeendurance/public/index.php(19): require_once('/Users/jfrank/a...')&#xA;#4 /Users/jfrank/.composer/vendor/laravel/valet/server.php(133): require('/Users/jfrank/a...')&#xA;#5 {main}&#xA;REQUEST_URI=/&#xA;---&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;templates&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/controllers/TemplatesController.php (170)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/errors/ErrorHandler.php (281)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;i18n&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (639)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/behaviors/AppBehavior.php (959)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;plugins&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/TemplatesService.php (1444)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/TemplatesService.php (192)&#xA;2017/05/12 20:32:47 [trace] [system.caching.Craft\FileCache] Serving &quot;omitScriptNameInUrls&quot; from cache&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/CacheService.php (180)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/ConfigService.php (303)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/helpers/UrlHelper.php (411)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;messages&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/Craft.php (385)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/storage/runtime/compiled_templates/cf/cf8c6e6b352d46fe66a7bf9ae1be09d65a54a3f0149bcb6418616181581f6d54.php (26)&#xA;2017/05/12 20:32:47 [trace] [system.CModule] Loading &quot;resources&quot; application component&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/etc/web/WebApp.php (595)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/helpers/UrlHelper.php (273)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/TemplatesService.php (518)&#xA;2017/05/12 20:32:47 [trace] [system.caching.Craft\FileCache] Serving &quot;resourcePath:css/craft.css&quot; from cache&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/CacheService.php (180)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/services/ResourcesService.php (36)&#xA;in /Users/jfrank/activeSites/activeendurance/craft/app/helpers/UrlHelper.php (277)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6361" LastActivityDate="2017-05-12T22:23:24.033" Title="Having issues with Craft install on Laravel Valet." Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20459" PostTypeId="1" AcceptedAnswerId="20506" CreationDate="2017-05-12T22:15:04.903" Score="1" ViewCount="214" Body="&lt;p&gt;I tried to add a Category Select field into a Neoblock but when i first saved the entry I received the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Could not resolve the subpath “{slug}”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I removed the Neo Block with the Category Select but the error persists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6130" LastEditorUserId="57" LastEditDate="2017-05-12T23:00:45.000" LastActivityDate="2017-05-17T14:51:04.140" Title="Why do I get 'Could not resolve the subpath “{slug}” after trying to add a category select to a Neo field?" Tags="&lt;categories&gt;&lt;craft-pro&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20460" PostTypeId="2" ParentId="20458" CreationDate="2017-05-12T22:23:24.033" Score="4" Body="&lt;p&gt;&lt;em&gt;Talked with Justin via DM on the Craft Slack. As per that discussion, here was the solution:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Valet docs are extremely misleading. When detailing how to use the &lt;code&gt;park&lt;/code&gt; command, they list running &lt;code&gt;laravel new blog&lt;/code&gt; as one of the steps. This command has to do with creating a Laravel site and is not necessary at all (and in fact, as seen in this instance, sometimes destructive) for running Craft sites or even for sites using other CMSs like Wordpress etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix it, remove the &lt;code&gt;activeendurance&lt;/code&gt; folder, recreate it, and put the Craft folders/files back in there.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2017-05-12T22:23:24.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20461" PostTypeId="1" AcceptedAnswerId="21157" CreationDate="2017-05-13T09:17:08.157" Score="3" ViewCount="183" Body="&lt;p&gt;I'm having some issues with the tax in the Craft Commerce plugin. All prices typed in the CP are without tax and I need to show the price in the front-end with a 25% tax included. If a product cost 5000 it has to show 6250. The same goes for the cart lineitem. But I can't make it work. What's the correct way for this approach?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2017-05-13T22:47:14.357" LastActivityDate="2017-07-11T04:49:45.037" Title="Tax and Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20462" PostTypeId="1" AcceptedAnswerId="20463" CreationDate="2017-05-14T20:53:21.160" Score="2" ViewCount="494" Body="&lt;p&gt;I a musing a front-end form to create an entry in the CP. In my form I am using a &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt; that contains two fields/blocks.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Size - [text input]&lt;/li&gt;&#xA;&lt;li&gt;Measurement - [dropdown]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is what my template looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[lotSize]&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[lotSize][new1][type]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;col-xs-6&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;lotSize&quot;&amp;gt;Lot Size&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;fields[lotSize][new1][fields][size]&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-6&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;measurement&quot;&amp;gt;Measurement&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[lotSize][new1][fields][measurement]&quot;&amp;gt;&#xA;            {# Loop through the values instead of hard-coding #}&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;Select&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;squareFeet&quot;&amp;gt;Square Feet&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;acres&quot;&amp;gt;Acres&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been reading through &lt;a href=&quot;https://github.com/engram-design/SuperTable/wiki/Updating-a-Super-Table-field-from-a-front-end-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;Updating a Super Table field from a front end form&lt;/a&gt; and have tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldHandle = 'lotSize' %}&#xA;{% set field = craft.fields.getFieldByHandle(fieldHandle) %}&#xA;{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...But I'm not sure where to go next to get to the &lt;code&gt;measurement&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached a screenshot of my CP page to help show what I am trying to accomplish. Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ly6DZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ly6DZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-05-14T21:52:19.813" Title="How can I loop through the values of a drop down within a SuperTable?" Tags="&lt;templating&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20463" PostTypeId="2" ParentId="20462" CreationDate="2017-05-14T21:52:19.813" Score="3" Body="&lt;p&gt;You'll likely want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldtype in blocktype.getFieldLayout.fields %}&#xA;    {% set field = fieldtype.field %}&#xA;&#xA;    Handle: {{ field.handle }}&#xA;&#xA;    {% if field.type == 'Dropdown' %}&#xA;        {% for option in field.settings.options %}&#xA;            Label: {{ option.label }}&#xA;            Value: {{ option.value }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, this loops through all the sub-fields in your Super Table field, and for each field, you can make any sort of conditional you like in order to handle each fields content.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-05-14T21:52:19.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20464" PostTypeId="2" ParentId="19974" CreationDate="2017-05-15T03:04:35.583" Score="2" Body="&lt;p&gt;This StackExchange question explains how to set an array of IDs for items in your cart, and then compare those IDs against the IDs of a list of products: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17005/check-if-cart-contains-valid-products-for-discount-code&quot;&gt;Check if cart contains valid products for discount code&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4438" LastActivityDate="2017-05-15T03:04:35.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20466" PostTypeId="1" AcceptedAnswerId="20467" CreationDate="2017-05-15T09:24:20.247" Score="8" ViewCount="3875" Body="&lt;p&gt;I cannot find any documentation that specifies how to link to controller actions which return a rendered template in CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a plugin called &lt;code&gt;waffles&lt;/code&gt; and my namespace is &lt;code&gt;Very\Waffles&lt;/code&gt;. I have a controller named &lt;code&gt;SyrupController&lt;/code&gt; and it's residing in &lt;code&gt;Controllers&lt;/code&gt; directory (note the capitalized directory name). So the namespace for it would be &lt;code&gt;Very\Waffles\Controllers&lt;/code&gt;.&lt;br&gt;&#xA;An action &lt;code&gt;actionPour()&lt;/code&gt; - how can I register a route that would call this action if I land on the &lt;code&gt;/admin/waffles&lt;/code&gt; URL?&lt;br&gt;&#xA;I've walked through the steps with a debugger and It's trying to check if a &lt;code&gt;SyrupController&lt;/code&gt; exists but how can it, if only &lt;code&gt;Very\Waffles\Controllers\SyrupController&lt;/code&gt; exists? Thus it fails to register that route and fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated!&lt;br&gt;&#xA;Here's some code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        UrlManager::class,&#xA;        UrlManager::EVENT_REGISTER_CP_URL_RULES,&#xA;        function (RegisterUrlRulesEvent $event) {&#xA;            $event-&amp;gt;rules['waffles'] = 'waffles/syrup/pour';&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It shouldn't be possible to link to a controller by using this string, so I'm guessing an array that specifies the &lt;code&gt;SyrupController::class&lt;/code&gt;, but there's no documentation about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2018-09-22T14:42:15.527" Title="How to link to controller actions in a Craft 3 plugin?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20467" PostTypeId="2" ParentId="20466" CreationDate="2017-05-15T11:16:25.837" Score="8" Body="&lt;p&gt;Apparently I figured it out. Would still like a better way of doing this, but here's the solution I found to be working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;Plugin&lt;/code&gt; class, you have to add a &lt;code&gt;public $controllerMap&lt;/code&gt; array. For my example plugin above, here's what I would have to add to that &lt;code&gt;$controllerMap&lt;/code&gt; array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Very\Waffle\Controllers\SyrupController;&#xA;&#xA;class Plugin extends \craft\base\Plugin&#xA;{&#xA;&#xA;    /** @var array */&#xA;    public $controllerMap = [&#xA;        'syrup' =&amp;gt; SyrupController::class,&#xA;    ];&#xA;&#xA;    // other code here, obviously&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4387" LastActivityDate="2017-05-15T11:16:25.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20468" PostTypeId="1" AcceptedAnswerId="20475" CreationDate="2017-05-15T12:19:22.730" Score="2" ViewCount="57" Body="&lt;p&gt;I have a multi-language site. So I need to show slightly different address data, depending on the current locale. Especially regarding the city and country field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Venloer Str. 200&#xA;Köln&#xA;Deutschland&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EN&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Venloer Str. 200&#xA;Cologne&#xA;Germany&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried marking the field as translatable, but it hasn’t worked out of the box and I couldn’t find any documentation on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-05-15T20:40:52.223" Title="Making the Smart Map field translatable" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20469" PostTypeId="2" ParentId="20449" CreationDate="2017-05-15T13:29:48.527" Score="2" Body="&lt;p&gt;Include this if statement at the bottom of your &lt;strong&gt;config/db.php&lt;/strong&gt; file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// If a local config file exists, merge&#xA;if (is_array($localConfig = @include(CRAFT_CONFIG_PATH . 'local/db.php')))&#xA;{&#xA;    // does our default config already have a local key?&#xA;    if(array_key_exists('local', $config))&#xA;    {&#xA;        // If so, merge what's in our local/db.php&#xA;        $config['local'] = array_merge($config['local'], $localConfig);&#xA;    }&#xA;    else&#xA;    {&#xA;        // Otherwise, just set as our 'local' key&#xA;        $config['local'] = $localConfig;&#xA;    }&#xA;}&#xA;&#xA;// return our $config back to craft&#xA;return $config;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then create a &lt;strong&gt;config/local/db.php&lt;/strong&gt; with your homestead configuration&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;/**&#xA; * Local-only Database Configuration&#xA; *&#xA; * The returned array will be merged ONLY with the in-built 'local' array in config/db.php,&#xA; *&#xA; * Usage: duplicate file as `config/local/db.php` and cutomise values below.&#xA; */&#xA;&#xA;return array(&#xA;    'server'    =&amp;gt; 'localhost',&#xA;    'user'      =&amp;gt; 'homestead',&#xA;    'password'  =&amp;gt; 'secret',&#xA;    'database'  =&amp;gt; 'example'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6706" LastActivityDate="2017-05-15T13:29:48.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20470" PostTypeId="1" AcceptedAnswerId="20482" CreationDate="2017-05-15T16:03:34.090" Score="1" ViewCount="138" Body="&lt;p&gt;I want to assign a new user to a user group using a variable passed in the frontend registration form. I was going to listen for the OnSaveUser event but I don't think there's a way to get the usergroup from the original post that way(?) so I've instead created a controller that forwards to &lt;code&gt;users/onSaveUser&lt;/code&gt; using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$forward = $this-&amp;gt;forward('users/saveUser', false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea being I'll then have access to the post after the user has been created. The problem is everything ends here and doesn't reach the rest of my function. Here's my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class UserGroupController extends BaseController&#xA;{&#xA;&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionSaveUser()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;&#xA;        $forward = $this-&amp;gt;forward('users/saveUser', false);&#xA;        throw new Exception('Made It back!'); // never reached &#xA;        return TRUE;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CController#forward-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;According to the Yii docs&lt;/a&gt;, &lt;code&gt;false&lt;/code&gt; should stop the things ending, right?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2019-04-19T20:31:06.337" Title="Getting back after forwarding to another controller function" Tags="&lt;users&gt;&lt;plugins&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20471" PostTypeId="1" CreationDate="2017-05-15T16:34:55.203" Score="0" ViewCount="85" Body="&lt;p&gt;Every time I set up a new user user and send the activation link. The user gets the following error when trying to activate their account:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Undefined Index: action&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The only way to fix it has been to turn on and off the permissions multiple times until it works. Can anyone help fix this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;htaccess file&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;## BEGIN Enable GZIP Compression ##&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA;AddOutputFilterByType DEFLATE text/plain&#xA;AddOutputFilterByType DEFLATE text/html&#xA;AddOutputFilterByType DEFLATE text/xml&#xA;AddOutputFilterByType DEFLATE text/css&#xA;AddOutputFilterByType DEFLATE application/xml&#xA;AddOutputFilterByType DEFLATE application/xhtml+xml&#xA;AddOutputFilterByType DEFLATE application/rss+xml&#xA;AddOutputFilterByType DEFLATE application/javascript&#xA;AddOutputFilterByType DEFLATE application/x-javascript&#xA;AddOutputFilterByType DEFLATE application/x-httpd-php&#xA;AddOutputFilterByType DEFLATE application/x-httpd-fastphp&#xA;AddOutputFilterByType DEFLATE image/svg+xml&#xA;SetOutputFilter DEFLATE&#xA;&amp;lt;/IfModule&amp;gt;&#xA;## END Enable GZIP Compression ##&#xA;&#xA;&#xA;## BEGIN Vary: Accept-Encoding Header ##&#xA;&amp;lt;IfModule mod_headers.c&amp;gt;&#xA;&amp;lt;FilesMatch &quot;\.(js|css|xml|gz)$&quot;&amp;gt;&#xA;Header append Vary: Accept-Encoding&#xA;&amp;lt;/FilesMatch&amp;gt;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;## END Vary: Accept-Encoding Header ##&#xA;&#xA;&#xA;# 1 Month for most static assets&#xA;&amp;lt;filesMatch &quot;.(css|jpg|jpeg|png|gif|js|ico|svg)$&quot;&amp;gt;&#xA;Header set Cache-Control &quot;max-age=2592000, public&quot;&#xA;&amp;lt;/filesMatch&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP notice&#xA;&#xA;Undefined index: action&#xA;&#xA;/var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/plugins/limitblocktype/LimitBlockTypePlugin.php(50)&#xA;&#xA;38         }&#xA;39 &#xA;40         $isAjaxRequest = craft()-&amp;gt;request-&amp;gt;isAjaxRequest();&#xA;41         $segments = craft()-&amp;gt;request-&amp;gt;segments;&#xA;42         $actionSegment = array_pop($segments) ?: '';&#xA;43 &#xA;44         if (!$isAjaxRequest) {&#xA;45             &#xA;46             craft()-&amp;gt;templates-&amp;gt;includeJsResource('limitblocktype/js/limitblocktype.js');&#xA;47             &#xA;48             // Check request parameters&#xA;49             $vars = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;50             if (!empty($vars) &amp;amp;&amp;amp; $vars['action'] === 'fields/saveField' &amp;amp;&amp;amp; $vars['type'] === 'Matrix') {&#xA;51                 // This is so hacky I don't even&#xA;52                 craft()-&amp;gt;runController('limitBlockType/saveField');&#xA;53             }&#xA;54 &#xA;55         }&#xA;56 &#xA;57         if (!$isAjaxRequest || $actionSegment === 'getEditorHtml') {&#xA;58             $data = JsonHelper::encode(craft()-&amp;gt;limitBlockType-&amp;gt;getData());&#xA;59             craft()-&amp;gt;templates-&amp;gt;includeJs('if (Craft &amp;amp;&amp;amp; Craft.LimitBlockTypePlugin) { new Craft.LimitBlockTypePlugin('.$data.', '.($isAjaxRequest ? '1' : '0').'); }');&#xA;60         }&#xA;61 &#xA;62     }&#xA;Stack Trace&#xA;#0  &#xA;–  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/etc/web/WebApp.php(687): CApplication-&amp;gt;handleError(8, &quot;Undefined index: action&quot;, &quot;/var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/plugins/limit...&quot;, 50)&#xA;682         if (version_compare(PHP_VERSION, '7', '&amp;gt;=') &amp;amp;&amp;amp; $code === 2 &amp;amp;&amp;amp; strpos($message, 'should be compatible with') !== false)&#xA;683         {&#xA;684             return;&#xA;685         }&#xA;686 &#xA;687         parent::handleError($code, $message, $file, $line);&#xA;688     }&#xA;689 &#xA;690     // Private Methods&#xA;691     // =========================================================================&#xA;692 &#xA;#1  &#xA;–  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/plugins/limitblocktype/LimitBlockTypePlugin.php(50): Craft\WebApp-&amp;gt;handleError(8, &quot;Undefined index: action&quot;, &quot;/var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/plugins/limit...&quot;, 50, ...)&#xA;45             &#xA;46             craft()-&amp;gt;templates-&amp;gt;includeJsResource('limitblocktype/js/limitblocktype.js');&#xA;47             &#xA;48             // Check request parameters&#xA;49             $vars = craft()-&amp;gt;request-&amp;gt;getPost();&#xA;50             if (!empty($vars) &amp;amp;&amp;amp; $vars['action'] === 'fields/saveField' &amp;amp;&amp;amp; $vars['type'] === 'Matrix') {&#xA;51                 // This is so hacky I don't even&#xA;52                 craft()-&amp;gt;runController('limitBlockType/saveField');&#xA;53             }&#xA;54 &#xA;55         }&#xA;#2  &#xA;–  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/services/PluginsService.php(150): Craft\LimitBlockTypePlugin-&amp;gt;init()&#xA;145                     $this-&amp;gt;_enabledPlugins[$row['lcHandle']]-&amp;gt;setSettings($row['settings']);&#xA;146                 }&#xA;147 &#xA;148                 foreach ($this-&amp;gt;_enabledPlugins as $plugin)&#xA;149                 {&#xA;150                     $plugin-&amp;gt;init();&#xA;151                 }&#xA;152 &#xA;153                 $this-&amp;gt;_loadingPlugins = false;&#xA;154             }&#xA;155 &#xA;#3  &#xA;+  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/etc/web/WebApp.php(257): Craft\PluginsService-&amp;gt;loadPlugins()&#xA;#4  &#xA;+  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#5  &#xA;+  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#6  &#xA;+  /var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/public/index.php(26): require_once(&quot;/var/www/vhosts/aura.ecwebhub.co.uk/httpdocs/craft/app/index.php&quot;)&#xA;2017-08-08 21:13:32 Apache / Craft CMS 2.6.2988&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-08-08T21:16:27.033" LastActivityDate="2017-08-08T21:16:27.033" Title="New users all get error on activation attempt" Tags="&lt;activation&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20472" PostTypeId="1" CreationDate="2017-05-15T18:58:44.987" Score="1" ViewCount="426" Body="&lt;p&gt;I'm trying to pull all events where the event's year from &lt;code&gt;endDate&lt;/code&gt; matches the queried year (&lt;code&gt;yearParam&lt;/code&gt;). When I have this, it's pulling in all events before the &lt;code&gt;yearParam&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastEntries = craft.entries({endDate: '&amp;lt;' ~ yearParam}).section('events').order('endDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, what I'd really like is to get entries that match the &lt;code&gt;yearParam&lt;/code&gt; (so if the yearParam is 2017, then any events from 2017 should be pulled in). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help is greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2019-06-28T14:06:53.377" Title="Query entries based on date's year" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20473" PostTypeId="1" CreationDate="2017-05-15T19:22:11.050" Score="1" ViewCount="176" Body="&lt;p&gt;I'm looking for a solution that will allow me to turn a CSV or JSON data file into a table on the front-end of a website. Ideally the data would be imported into the database and then output into a table on the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've dabbled with the plugin FeedMe, but the issue is that it has to fit into a pre-defined table. Is there any way to import this data into a table that creates columns based on the data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact scenario I have is that I'm uploading a sheet of points standings that include each weekend's points accumulation and the final column is the total season points. As each weekend is finished, that new weekend is inserted as a column, thus growing the table's columns which Craft's table field can't do dynamically.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2017-05-15T19:22:11.050" Title="CSV/JSON data imported to dynamic table" Tags="&lt;json&gt;&lt;import&gt;&lt;table&gt;&lt;csv&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20474" PostTypeId="2" ParentId="20456" CreationDate="2017-05-15T20:06:46.107" Score="1" Body="&lt;p&gt;If you're hitting &lt;code&gt;/api/news.json&lt;/code&gt; in the browser, you'd want to define the endpoint as &lt;code&gt;'api/news.json'&lt;/code&gt; as well.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/news.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-15T20:06:46.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20475" PostTypeId="2" ParentId="20468" CreationDate="2017-05-15T20:40:52.223" Score="2" Body="&lt;p&gt;&lt;strong&gt;Smart Map doesn't currently support the ability to make an Address translatable.&lt;/strong&gt; It's on the feature request list, and will be implemented at some point in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you can use &lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;static translations&lt;/a&gt; to handle names of common cities &amp;amp; countries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;City: {{ entry.location.city | t }}&#xA;Country: {{ entry.location.country | t }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* The &lt;code&gt;t&lt;/code&gt; filter is an alias for &lt;a href=&quot;https://craftcms.com/docs/templating/filters#translate-or-t&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;translate&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-05-15T20:40:52.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20476" PostTypeId="1" AcceptedAnswerId="20477" CreationDate="2017-05-15T21:56:39.183" Score="2" ViewCount="461" Body="&lt;p&gt;I want to import a bunch of &lt;strong&gt;films&lt;/strong&gt;, which all have certain &lt;strong&gt;genres&lt;/strong&gt;. The genres have already been set up as Categories in Craft, so each genre already has an Element ID (if that's relevant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a glance at my JSON feed...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;    'title': &quot;Epic Film&quot;,&#xA;    'genre': &quot;action adventure&quot;&#xA;},&#xA;{&#xA;    'title': &quot;Sappy Love Story&quot;,&#xA;    'genre': &quot;romance&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, that doesn't seem to work. I keep getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Genre cannot be blank.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I format data in a JSON field, to ensure that it's treated as a relationship between two elements?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-05-15T22:05:31.667" Title="Feed Me: Importing a relationship between elements" Tags="&lt;json&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20477" PostTypeId="2" ParentId="20476" CreationDate="2017-05-15T22:05:31.667" Score="3" Body="&lt;p&gt;Have you set the type of data you're providing for the category field? Each element field allows you to state what attribute the data you're trying to import. Title, ID or slug, which are shown in a small dropdown field on the feed mapping page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yk63L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yk63L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you check this?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-05-15T22:05:31.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20478" PostTypeId="1" AcceptedAnswerId="20488" CreationDate="2017-05-16T08:24:30.687" Score="1" ViewCount="967" Body="&lt;p&gt;I need to get the current entry ID in plugin's variable file without submitting any form. I tried this but it gave an error &lt;strong&gt;Undefined property: Craft\PluginNameVariable::$element&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class PluginNameVariable&#xA;{&#xA;/**&#xA; */&#xA;public function totalitemsForElements($elements = array())&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('MyElementType');&#xA;&#xA;    $criteria-&amp;gt;elementId = $this-&amp;gt;element-&amp;gt;id;&#xA;&#xA;    $items = $criteria-&amp;gt;find();&#xA;&#xA;    return $criteria-&amp;gt;find();&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was accessing this variable through&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set itemElementType =  craft.pluginName.totalitemsForElements %}&#xA;{{ itemElementType|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please Help. Thanks in advance !!&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-06-29T06:02:20.580" LastActivityDate="2017-06-29T06:02:20.580" Title="How to get Current Entry ID in Plugin Variable?" Tags="&lt;plugin-development&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20479" PostTypeId="2" ParentId="2576" CreationDate="2017-05-16T08:35:01.767" Score="1" Body="&lt;p&gt;Then, set the correct permissions on the document root and Craft files and directories within:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chown -R www-data:www-data /var/www&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod -R 770 /var/www&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod -R 775 /var/www/craft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod -R 775 /var/www/html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod 774 /var/www/craft/app&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod 774 /var/www/craft/config&lt;/p&gt;&#xA;&#xA;&lt;p&gt;chmod 774 /var/www/craft/storage&lt;/p&gt;&#xA;" OwnerUserId="6718" LastActivityDate="2017-05-16T08:35:01.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20480" PostTypeId="1" AcceptedAnswerId="20490" CreationDate="2017-05-16T09:01:23.847" Score="1" ViewCount="285" Body="&lt;p&gt;Although I don't like this for some reasons, my client wants Craft Commerce to directly send specific formatted CSV file to their CRM system for each order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to write a Craft Commerce plugin to allow such a feature ?&lt;/p&gt;&#xA;" OwnerUserId="5263" LastEditorUserId="57" LastEditDate="2017-05-16T21:46:05.990" LastActivityDate="2017-05-16T21:51:59.273" Title="Craft Commerce: Export each order to a specific CSV file and send it throught email" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20482" PostTypeId="2" ParentId="20470" CreationDate="2017-05-16T10:00:59.520" Score="1" Body="&lt;p&gt;I have this working in another plugin calling another function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$forward = $this-&amp;gt;forward('commerce/products/saveProduct', false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it returns to the original controller fine. So, as Brad comments, the forward is actually working as expected but that particular &lt;code&gt;UsersController-&amp;gt;saveUser()&lt;/code&gt; function prevents it happening internally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within my particular example, I &lt;em&gt;was&lt;/em&gt; able to access the original &lt;code&gt;post&lt;/code&gt; request and access a &lt;code&gt;userGroupId&lt;/code&gt; from the user registration form like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('users.onSaveUser', function (Event $event) {&#xA;        if ($event-&amp;gt;params['isNewUser']) {&#xA;            if (isset($_POST['userGroup'])) {&#xA;&#xA;                $userGroupId = $_POST['userGroup'];&#xA;                $user = $event-&amp;gt;params['user'];&#xA;&#xA;                craft()-&amp;gt;userGroup-&amp;gt;setUserGroup($user, $userGroupId);&#xA;&#xA;            }               &#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-05-16T10:00:59.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20484" PostTypeId="2" ParentId="17089" CreationDate="2017-05-16T14:23:38.893" Score="2" Body="&lt;p&gt;I know it's been a minute since you asked this question, but just in case - I encountered this same issue - the correct credentials but still not able to connect with the db.php config file. I changed &quot;localhost&quot; to &quot;127.0.0.1&quot; and that seemed to work, or at least get me to the next snag that I hit. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="6721" LastActivityDate="2017-05-16T14:23:38.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20485" PostTypeId="1" CreationDate="2017-05-16T14:50:21.563" Score="1" ViewCount="44" Body="&lt;p&gt;I'm trying to process multiple elements in a custom element action, and then redirect the CP user to a url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that?&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-05-16T14:50:21.563" Title="Redirect from element action" Tags="&lt;elementtype&gt;&lt;elementaction&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20486" PostTypeId="1" AcceptedAnswerId="20491" CreationDate="2017-05-16T16:49:09.460" Score="1" ViewCount="134" Body="&lt;p&gt;I've created a database table that I am trying to add information too with a &lt;code&gt;onBeforeSaveElement()&lt;/code&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, although it is telling me that the rows have been added in the &lt;code&gt;$result&lt;/code&gt;, there is no records being added. Interestingly, if I run the page an then manually add a record to the database table, the &lt;code&gt;id&lt;/code&gt; has been incremented by the amount of rows &lt;code&gt;$result&lt;/code&gt; says it has added.. so it seems that the rows are being added then instantly deleted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE `craft_lsclearance` (&#xA;  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,&#xA;  `path` text,&#xA;  `cleared` int(11) DEFAULT '0',&#xA;  `dateCreated` datetime DEFAULT NULL,&#xA;  `dateUpdated` datetime DEFAULT NULL,&#xA;  `uid` char(36) DEFAULT '',&#xA;  PRIMARY KEY (`id`)&#xA;) ENGINE=InnoDB AUTO_INCREMENT=229 DEFAULT CHARSET=latin1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeSaveElement', function(Event $event)&#xA;    {&#xA;        $element = $event-&amp;gt;params['element'];&#xA;        $paths = craft()-&amp;gt;plugin-&amp;gt;getPaths($element);&#xA;&#xA;        foreach ($paths as $path) {&#xA;            $newPath = preg_replace('/site:/', '', $path['path'], 1);&#xA;&#xA;            if ($path['locale'] != 'en') {&#xA;                $newPath = $path['locale'] . '/' . $newPath;&#xA;            }&#xA;&#xA;            $model[] = array(UrlHelper::getSiteUrl($newPath));&#xA;        }&#xA;&#xA;        $result = craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;insertAll('lsclearance', array('path'), $model);&#xA;&#xA;        print_r($model);&#xA;        echo '&amp;lt;br /&amp;gt; Inserted: ' . $result . 'row(s)';&#xA;&#xA;        exit;&#xA;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array ( &#xA;  [0] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/ ) &#xA;  [1] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/ ) &#xA;  [2] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/results?q=regatta+ac ) &#xA;  [3] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/watch/regatta-ac-titanium/19225 ) &#xA;  [4] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/mens-watches ) &#xA;  [5] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/mens-watches/p2 ) &#xA;  [6] =&amp;gt; Array ( [0] =&amp;gt; http://mydomain.com/watch/ac-ii/19282 ) &#xA;) &#xA;Inserted: 7 rows&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6147" LastActivityDate="2017-05-16T22:01:54.420" Title="insertAll() not inserting entries into database" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20487" PostTypeId="2" ParentId="5" CreationDate="2017-05-16T18:25:24.457" Score="5" Body="&lt;p&gt;It's not mentioned above, but in my experience the &lt;a href=&quot;https://github.com/verbb/feed-me&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; plugin is by far the best way to import content.&lt;/p&gt;&#xA;" OwnerUserId="286" LastEditorUserId="3951" LastEditDate="2017-10-24T14:06:50.853" LastActivityDate="2017-10-24T14:06:50.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20488" PostTypeId="2" ParentId="20478" CreationDate="2017-05-16T19:24:43.407" Score="2" Body="&lt;p&gt;It seems like what you want is to get elements related to an entry that is pre-loaded in a template, and that &lt;code&gt;elementId&lt;/code&gt; is a custom field for &lt;code&gt;MyElementType&lt;/code&gt;. If that's the case, this should work out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function totalitemsForElements($elementID)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('MyElementType');&#xA;&#xA;    $criteria-&amp;gt;elementId = $elementID;&#xA;&#xA;    return $criteria-&amp;gt;find();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We'll pass the entry id to the variable function. Here's the template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set itemElementType =  craft.pluginName.totalitemsForElements(entry.id) %}&#xA;{{ itemElementType|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="251" LastActivityDate="2017-05-16T19:24:43.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20489" PostTypeId="2" ParentId="20400" CreationDate="2017-05-16T20:16:57.823" Score="1" Body="&lt;p&gt;The limitation here is that the &lt;code&gt;loadOccurrences: false&lt;/code&gt; parameter only checks for &quot;Primary&quot; events (first occurrence) within the specified timeframe. So if the first occurrence is outside of the specified timeframe, the event won't show at all.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-05-16T20:16:57.823" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20490" PostTypeId="2" ParentId="20480" CreationDate="2017-05-16T21:51:59.273" Score="1" Body="&lt;p&gt;You could write a custom &lt;a href=&quot;http://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt; (generate the boilerplate for it at &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt;) that listened to one of Craft Commerce's order events.  Likely &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onsaveorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveOrder&lt;/a&gt; or &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow noreferrer&quot;&gt;onOrderComplete&lt;/a&gt; depending on your specific requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, your plugin could build the CSV the old fashioned way in PHP, or use something like the &lt;a href=&quot;https://github.com/thephpleague/csv&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSV library&lt;/a&gt; to do the heavy lifting for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've built the CSV, you can use Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService-&gt;sendEmail()&lt;/a&gt; (accessible through &lt;code&gt;craft()-&amp;gt;email-&amp;gt;sendEmail()&lt;/code&gt; to add the attachment and shoot the email off.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-16T21:51:59.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20491" PostTypeId="2" ParentId="20486" CreationDate="2017-05-16T22:01:54.420" Score="1" Body="&lt;p&gt;All of the element saving events (like &lt;code&gt;onBeforeElementSave()&lt;/code&gt;, &lt;code&gt;onElementSave()&lt;/code&gt;, &lt;code&gt;onBeforeSaveEntry()&lt;/code&gt;..., etc. are all wrapped in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Database_transaction&quot; rel=&quot;nofollow noreferrer&quot;&gt;database transaction&lt;/a&gt; (specifically encapsulated in the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbTransaction&quot; rel=&quot;nofollow noreferrer&quot;&gt;CDbTransaction&lt;/a&gt; class).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you call &lt;code&gt;exit&lt;/code&gt;, you're killing the request and never giving a chance for the transaction to commit to the database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-16T22:01:54.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20492" PostTypeId="1" AcceptedAnswerId="20493" CreationDate="2017-05-16T22:13:18.057" Score="1" ViewCount="359" Body="&lt;p&gt;Wondering if it's possible to change the output that I'm getting from ElementAPI. I'm using the API to preload assets, and this is the output I'm getting.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;data&quot;: [&#xA;        {&#xA;            &quot;title&quot;: &quot;Hero&quot;,&#xA;            &quot;url&quot;: &quot;assets/hero.jpg&quot;&#xA;        },&#xA;        {&#xA;            &quot;title&quot;: &quot;Profile&quot;,&#xA;            &quot;url&quot;: &quot;assets/profile.jpg&quot;&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is great, and pretty much exactly what I need, but I'm wondering if there is a way to change the output so that, rather than using &lt;code&gt;&quot;data&quot;:&lt;/code&gt; I can use &lt;code&gt;&quot;manifest&quot;:&lt;/code&gt; which is what my preloader needs. Ideally, my code should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    manifest: [&#xA;        {&#xA;            &quot;title&quot;: &quot;Hero&quot;,&#xA;            &quot;url&quot;: &quot;assets/hero.jpg&quot;&#xA;        },&#xA;        {&#xA;            &quot;title&quot;: &quot;Profile&quot;,&#xA;            &quot;url&quot;: &quot;assets/profile.jpg&quot;&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here also is my &lt;code&gt;elementapi.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft; &#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'assets/data/assets.json' =&amp;gt; [&#xA;            'paginate' =&amp;gt; false,&#xA;            'elementType' =&amp;gt; ElementType::Asset,&#xA;            'criteria' =&amp;gt; [&#xA;                'limit' =&amp;gt; null,&#xA;            ],&#xA;            'transformer' =&amp;gt; function(AssetFileModel $asset) {&#xA;                return [&#xA;                    'id' =&amp;gt; $asset-&amp;gt;title,&#xA;                    'url' =&amp;gt; $asset-&amp;gt;url,&#xA;                ];&#xA;            },&#xA;       ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there isn't a way to do this in the plugin, is there a way to get the endpoint file and change it some other way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="5370" LastEditDate="2017-05-16T23:14:37.967" LastActivityDate="2020-07-04T11:19:25.777" Title="Changing the output of ElementAPI" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20493" PostTypeId="2" ParentId="20492" CreationDate="2017-05-16T22:33:54.500" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like changing the &lt;code&gt;'data'&lt;/code&gt; key is a bit more difficult I suspected.  We just released &lt;a href=&quot;https://github.com/craftcms/element-api/releases/tag/1.3.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API 1.3.0&lt;/a&gt; that exposes the internal &lt;code&gt;$resourceKey&lt;/code&gt; necessary to change that value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;elementapi.php&lt;/code&gt; config file, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; This is the final code that I used, and it works perfectly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'defaults' =&amp;gt; [&#xA;        'resourceKey' =&amp;gt; 'manifest'&#xA;    ],&#xA;&#xA;    'endpoints' =&amp;gt; [&#xA;        'assets/data/assets.json' =&amp;gt; [&#xA;            'paginate' =&amp;gt; false,&#xA;            'elementType' =&amp;gt; ElementType::Asset,&#xA;&#xA;            'transformer' =&amp;gt; function(AssetFileModel $asset) {&#xA;                return [&#xA;                    'id' =&amp;gt; $asset-&amp;gt;title,&#xA;                    'src' =&amp;gt; $asset-&amp;gt;url,&#xA;                ];&#xA;            },&#xA;       ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The output you're seeing is defined by your &lt;code&gt;craft/config/elementapi.php&lt;/code&gt; config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read about that configuration file and all of the available settings in the Element API documentation at: &lt;a href=&quot;https://github.com/craftcms/element-api/tree/v1#setup&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/element-api/tree/v1#setup&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="5370" LastEditDate="2017-05-17T19:44:08.203" LastActivityDate="2017-05-17T19:44:08.203" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20494" PostTypeId="1" CreationDate="2017-05-17T03:01:18.403" Score="3" ViewCount="352" Body="&lt;p&gt;I need every control panel user to have a single assets folder that is private to them. Is there any way of achieving this in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using the &quot;Restrict uploads to a single folder?&quot; option and then used the {author.username} for the subfolder. This works as expected for uploading inside an entry form (although the entry must be saved before existing files can be added to the field, which isn't a great experience), but in the Assets area of the control panel, where users would need to go to be able to delete/manage their assets, the user then has access to ever other user's subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any ideas for how I can achieve what I need, I'd greatly appreciate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a plugin called Asset Subfolder Access (By P&amp;amp;T) which allows me to achieve what I want. Although, it's based on User Groups so I'll have to make a group for every user, which isn't ideal. I've also found that the &quot;restrict to single folder&quot; option on Asset fields doesn't allow the user to access subfolders of that location, which isn't great.&lt;/p&gt;&#xA;" OwnerUserId="6404" LastEditorUserId="6404" LastEditDate="2017-05-18T00:13:41.643" LastActivityDate="2017-05-18T00:13:41.643" Title="Restrict each user to a single Assets folder" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20495" PostTypeId="1" CreationDate="2017-05-17T06:09:48.300" Score="2" ViewCount="1182" Body="&lt;p&gt;Is there any &quot;simple&quot; way of migrating fields and layouts from one setup to another?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example;&#xA;Two identical installations/setups have diverged, where some information on certain fields have changed (like descriptive texts and so forth), perhaps there's a SuperTable or Craft Neo field with added blocks, or even a matrix field where there's been blocks added on the one setup, that need to update exactly on the other setup. Perhaps there's been some additions to a structure's field layout. Perhaps something has been removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize this could possibly be done with some sort of plugin/migration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of my question is basically to figure out a) if there's a simple and straight-forward way of doing so programmatically/automated, or b) if there are any plans on, or capability of setting up fields similarly to ACF for WordPress in the theme's function.php—where it can be done programmatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A real world usage would be; &#xA;You build a set of templates (a theme, essentially), and when you update the templates (theme) and you want to apply those updates to a separate install/setup, what is the most efficient and &quot;simple&quot; way of doing so in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked into the architect plugin, which is great for clean installs, but alas my limited php, or rather sql, knowledge makes it hard to expand into querying for field names rather than ID's. Of course there's the caveat that if you change a field's name, you probably need the ID, but if we forget that rabbit hole for a bit, is anyone sitting on any smart and simple tips for this type of approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone had any success with FeedMe or the CraftImport plugins?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2017-05-17T06:15:27.357" LastActivityDate="2018-06-26T19:43:40.247" Title="How would one go about migrating fields?" Tags="&lt;templating&gt;&lt;database&gt;&lt;field&gt;&lt;craft-features&gt;&lt;migration&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20496" PostTypeId="1" AcceptedAnswerId="20497" CreationDate="2017-05-17T07:18:44.580" Score="2" ViewCount="101" Body="&lt;p&gt;What would be the best way to automatically add a product when another product is added to the cart?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I where to add a TV to the cart, I would like to automatically add a HDMI cable as well. &lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="57" LastEditDate="2017-05-17T19:45:52.217" LastActivityDate="2017-05-17T19:45:52.217" Title="Automatically add an insurrance for a product" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20497" PostTypeId="2" ParentId="20496" CreationDate="2017-05-17T08:23:13.633" Score="2" Body="&lt;p&gt;You &lt;em&gt;could&lt;/em&gt; write a custom Craft plugin (generate the boilerplate for it at &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt;) - and in that listen to the &lt;code&gt;onPopulateLineItem&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, check the &lt;code&gt;purchasableId&lt;/code&gt; of the item being added to the cart - if it is the TV, then add the cable to the cart at the same time.  Something like this (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;    $purchasable= $event-&amp;gt;params['purchasable'];&#xA;    $cart =  craft()-&amp;gt;commerce_cart-&amp;gt;getCart();&#xA;&#xA;    if($purchasable-&amp;gt;getPurchasableId() == 123){&#xA;        craft()-&amp;gt;commerce_cart-&amp;gt;addToCart($cart, 456);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(See &lt;code&gt;addToCart()&lt;/code&gt; in plugins/commerce/services/Commerce_CartService.php for the full function definition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the bigger question is &lt;em&gt;should&lt;/em&gt; you do this....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that customers don't &lt;em&gt;generally&lt;/em&gt; like this sort of behaviour in cart systems, and you should make sure that if you do do this, you at least take care to remove the accessories when they remove the main item from the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that it soon gets complex, because can you be sure the accessory was added this way etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advice is to instead use MultiAdd (&lt;a href=&quot;https://github.com/engram-design/MultiAdd&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/MultiAdd&lt;/a&gt;) to build a form that gives them the &lt;em&gt;option&lt;/em&gt; of adding the accessories at the same time as the main product.  Like we do here for example:&#xA;&lt;a href=&quot;https://imagescience.com.au/products/monitors/eizo-coloredge-cs2730&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imagescience.com.au/products/monitors/eizo-coloredge-cs2730&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-17T08:23:13.633" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20501" PostTypeId="2" ParentId="20495" CreationDate="2017-05-17T11:14:53.767" Score="1" Body="&lt;h2&gt;The Migrations&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is an ongoing issue. My best call is currently, to do the changes on production and to sync the DB locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a lot of folks, using plugins to &quot;lock&quot; the editing for the time, changes are being made. Sync to local, edit, resync to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this is not satisfying, there was discussion with the Craft Team and the result is, for now, migrations coming to Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-content-migrations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you basically can create your own migrations from the command line. This should solve your problem, BUT: you should not use Craft 3 in production, yet.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Theming (off topic)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Something like theming is not possible and I think also won't be really in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solve this by having a Craft CMS dummy on github, which has most setup stuff I usually need (gruntfile, basic partials for matrices I use often). This dummy evolves over time and only includes some dummy files and folders like db.sample.php, general.sample.php and for the app a app.sample folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For basic content stuff I also use plugins like architect or the import/export plugin, to set up basic SEO fields and globals I usually use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But most are missing a way to export groups etc. perfectly, but they do their job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="6673" LastActivityDate="2017-05-17T11:14:53.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20502" PostTypeId="1" CreationDate="2017-05-17T11:18:32.497" Score="0" ViewCount="79" Body="&lt;p&gt;I'm trying to redirect at the end of the saveasset function in init().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.saveAsset', function (Event $event) {&#xA;&#xA;     // a lot of code here ##########################&#xA;&#xA;     //#############################################&#xA;&#xA;     //at the end:&#xA;&#xA;     craft()-&amp;gt;request-&amp;gt;redirect('myurl.com'); &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I save an asset with the redirect function at the end I get the following alert:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upload failed for filename.csv.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upload works when I leave the redirect out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="57" LastEditDate="2017-05-17T19:51:07.703" LastActivityDate="2017-05-17T19:51:07.703" Title="Redirect after saveAsset in plugin" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20503" PostTypeId="2" ParentId="20502" CreationDate="2017-05-17T11:25:50.630" Score="1" Body="&lt;p&gt;You could try to use a task, to make sure the upload is completed before redirecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a good starting point on how to use a task:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8399/documentation-on-creating-tasks&quot;&gt;Documentation on creating tasks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you define the steps of a task, in you case I guess 2. The next step of a task is started when the last step returned true.&lt;/p&gt;&#xA;" OwnerUserId="6673" LastActivityDate="2017-05-17T11:25:50.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20505" PostTypeId="1" CreationDate="2017-05-17T14:47:23.210" Score="1" ViewCount="139" Body="&lt;p&gt;Im trying to get started using the Feedme plugin to import data from EE. Im working with the json template provided here: &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/guides/migrating-from-expressionengine&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sgroup.com.au/plugins/feedme/guides/migrating-from-expressionengine&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ive been able to import data but when I include a rich text field Im getting errors – eg.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IGS Updates Test: Unexpected token &quot;punctuation&quot; of value &quot;:&quot; (&quot;end of print statement&quot; expected) in &quot;&amp;lt;p&amp;gt;On Thursday the 1st of December last, the Limerick Chapter of the Irish Georgian Society opened the Christmas season with a fundraising Christmas party. The event was held in The Georgian House, No. 2 Pery Square, in Limerick. This historic house was built between 1835 and 1838 by Pery Tontine Company, forming part of a terrace known collectively as the Tontine Building. It was the last Georgian terrace built in Limerick. The building was restored by Limerick Civic Trust, with the support of the Irish Georgian Society and opened in 1999. We were delighted to give our guests an opportunity to enjoy an evening in the magnificent first floor rooms of the house and we thank Limerick City and County Council for use the venue.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some of the entries are importing, but the majority are not. Any help / pointers appreciated...&lt;/p&gt;&#xA;" OwnerUserId="6725" LastActivityDate="2017-07-26T16:31:46.567" Title="Using Feedme to import data from ExpressionEngine 2" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20506" PostTypeId="2" ParentId="20459" CreationDate="2017-05-17T14:51:04.140" Score="1" Body="&lt;p&gt;i removed &lt;code&gt;{slug}&lt;/code&gt; altogether from an Asset field definition.&lt;/p&gt;&#xA;" OwnerUserId="6130" LastActivityDate="2017-05-17T14:51:04.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20507" PostTypeId="1" AcceptedAnswerId="20510" CreationDate="2017-05-17T15:51:14.587" Score="1" ViewCount="117" Body="&lt;p&gt;I would like &quot;buy&quot; product without the use of a gateway. The reason for this is that the customer will have the option to apply for a loan at the bank and when the loan it approved we'll get a callback and then the order will be executed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a good idea for this solution?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastActivityDate="2017-05-17T19:56:56.903" Title="Order product without gateway" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20508" PostTypeId="1" AcceptedAnswerId="20623" CreationDate="2017-05-17T16:12:01.860" Score="1" ViewCount="492" Body="&lt;p&gt;I have a category group (CG).&#xA;I have a channel of entries with a matrix field (MF).&#xA;Every block in that matrix field has a category field linked to the CG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to list all the MF blocks in an ordered list grouped by their category.&#xA;So for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category A&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MF block 1&lt;/li&gt;&#xA;&lt;li&gt;MF block 2&lt;/li&gt;&#xA;&lt;li&gt;Category AB&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MF block 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm looping over all categories within CG (with a recursive macro) and for each category I show a MF block that has that category related.&#xA;The problem is that when a block is related to Category AB, it is also related to its parent Category A, so the block is shown in Category A as well as in Category AB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want it to be only shown in the lowest level category, being AB in this case.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets even trickier because I cannot limit the amount of categories selected to just 1, because than Craft automatically selects only the top parent. So now (even if I don't need it) I have to take care of the possibility that the matrix block has multiple categories selected (and their children).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about grouping the matrix blocks by their category with the &lt;a href=&quot;https://github.com/timkelty/craft-groupby&quot; rel=&quot;nofollow noreferrer&quot;&gt;groupBy filter plugin&lt;/a&gt; but I haven't found the time yet to try this out. And I'm afraid I might loose the hierarchy of the CG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use a section for the categories (where you can limit it to a single item and it'll select the correct child) but than the client has a hard time to see what the parent category is in the CP. So that's a downer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why I need this:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client needs to be able to upload a ton of files related to an entry or add links related to an entry. That's why I created a matrix with 3 block types: external link, internal link and file.&#xA;The file block has a table field where they can upload an asset and select a locale. Because all files can have multiple translations. But the locales these files can be translated in do not match the locales that the site is available in. So that's why I can't just use a translatable asset field. That also why I can't use a front-end asset browser (because of the links and the translated files and because I have no control over the created folder structure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could live without them being able to add links if that would make it simpler. Alternative solutions are more than welcome!&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-05-29T05:25:53.210" Title="Only show items related to the lowest category level" Tags="&lt;assets&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20509" PostTypeId="1" AcceptedAnswerId="20642" CreationDate="2017-05-17T18:03:01.850" Score="1" ViewCount="180" Body="&lt;p&gt;When I checkout via Paypal express if I don't already have an address added to the cart model, when the paypal checkout process returns back there will be no address attached to the order. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I want the address to be sent back afterwards is that i want to send customers to paypal from the cart page so there is no address form prior to leaving to paypal. This flow is something possible on say, woocommerce.&lt;/p&gt;&#xA;" OwnerUserId="6691" LastActivityDate="2017-05-30T18:42:58.297" Title="Can Craft Commerce receive back the address used in paypal express checkout?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20510" PostTypeId="2" ParentId="20507" CreationDate="2017-05-17T19:56:56.903" Score="0" Body="&lt;p&gt;Seems like what you're looking for is under Commerce Settings-&gt;Payment Methods, set the &quot;Credit Card Payement Type&quot; to &quot;Authorize Only (Manual Capture)&quot;, then set the &quot;Payment Gateway&quot; to &quot;Dummy&quot;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-17T19:56:56.903" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20512" PostTypeId="2" ParentId="20505" CreationDate="2017-05-17T21:07:38.750" Score="1" Body="&lt;p&gt;I had a similar error when I was doing an import; some entries made it and others didn't. It ended up I had an error in my JSON file so be sure to &lt;a href=&quot;http://jsonlint.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;lint it first&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2017-05-17T21:07:38.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20514" PostTypeId="1" AcceptedAnswerId="20528" CreationDate="2017-05-18T08:28:00.020" Score="3" ViewCount="167" Body="&lt;p&gt;I'm looking for a way to get search results, even if people make typos, so apple as a result when looking for aple. Not fuzzy search, but some implementation of, for example, a Levenshtein function. I know I could go the Algolia way and that there's even a &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; for that, but before I pay Algolia for it, I would like to know:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there an easy/quick way to do this without using an external service?&lt;/li&gt;&#xA;&lt;li&gt;If so, would you be willing to share your thoughts on the subject?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="110" LastActivityDate="2017-05-18T21:29:46.887" Title="Search by close match" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20515" PostTypeId="1" CreationDate="2017-05-18T08:49:25.463" Score="1" ViewCount="588" Body="&lt;p&gt;I am having trouble getting a payment completed (SaferPay, offsite gateway). After coming back from the payment provider I get redirected to the unchanged payment page again with the following error message: &lt;em&gt;Payment Error: ,&lt;/em&gt; the error code (?) is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found this in the logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_GET=array (&#xA;'commerceTransactionId' =&amp;gt; '87'&#xA;'commerceTransactionHash' =&amp;gt; 'f4dcff157345d68b54934791fe7b0522'&#xA;)&#xA;$_POST=array (&#xA;'DATA' =&amp;gt; '&amp;lt;IDP MSGTYPE=&quot;PayConfirm&quot; TOKEN=&quot;(unused)&quot; VTVERIFY=&quot;(obsolete)&quot; KEYID=&quot;1-0&quot; ID=&quot;Oh7p4zbhSnWOUAzjGE5bAS4rSnAb&quot; ACCOUNTID=&quot;401860-17795278&quot; PROVIDERID=&quot;1395&quot; PROVIDERNAME=&quot;PayPal Saferpay Test&quot; PAYMENTMETHOD=&quot;16&quot; ORDERID=&quot;2435&quot; AMOUNT=&quot;3071&quot; CURRENCY=&quot;EUR&quot; IP=&quot;84.141.245.197&quot; IPCOUNTRY=&quot;DE&quot; /&amp;gt;'&#xA;'SIGNATURE' =&amp;gt; '3eec17d64cd2f4e9e57402e3efb1d91d79af35cf462f1f971ad2aa79ceda5e6814d7fb4d82cf2bfe044c791cbc38ea3007598d4d0ac6ba16db08e1abb2dc0b61'&#xA;)&#xA;$_SESSION=array (&#xA;'1c4d338641dbdf309e6ed655daae834eYii.CWebUser.flash.error' =&amp;gt; 'Payment Error: '&#xA;'1c4d338641dbdf309e6ed655daae834eYii.CWebUser.flashcounters' =&amp;gt;&#xA;array (&#xA;'error' =&amp;gt; 0&#xA;)&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;QUERY_STRING&lt;/strong&gt; cuts after the transaction hash:   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'commerceTransactionId=87&amp;amp;commerceTransactionHash=f4dcff157345d68b54934791fe7b0522'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Strangeley enough it is working locally, where the log says the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_GET=array (&#xA;'commerceTransactionId' =&amp;gt; '56'&#xA;'commerceTransactionHash' =&amp;gt; '2db11e4c56020b3adad7565478f2bc56'&#xA;'DATA' =&amp;gt; '&amp;lt;IDP MSGTYPE=&quot;PayConfirm&quot; TOKEN=&quot;(unused)&quot; VTVERIFY=&quot;(obsolete)&quot; KEYID=&quot;1-0&quot; ID=&quot;GCzE6MbphEYrSAUYhlA9bnvY6Y7b&quot; ACCOUNTID=&quot;401860-17795278&quot; PROVIDERID=&quot;1395&quot; PROVIDERNAME=&quot;PayPal Saferpay Test&quot; PAYMENTMETHOD=&quot;16&quot; ORDERID=&quot;2435&quot; AMOUNT=&quot;20430&quot; CURRENCY=&quot;EUR&quot; IP=&quot;84.141.245.197&quot; IPCOUNTRY=&quot;DE&quot; /&amp;gt;'&#xA;'SIGNATURE' =&amp;gt; '0378583461a09e40efe22a39cc5c7ca4c3bbe4e7f89c041154b00bcd1b65604309d219bad395ee2fefabc8726e9afd2364b769baa08ac927317698a9ab795e8b'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remotely it lives on a sub domain. What could be the problem?&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2017-05-19T07:43:08.893" LastActivityDate="2017-05-19T07:45:50.760" Title="Commerce: Payment does not get completed" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20517" PostTypeId="1" AcceptedAnswerId="20526" CreationDate="2017-05-18T10:37:56.233" Score="1" ViewCount="47" Body="&lt;p&gt;I have four select drop downs which let the user filter the results by county, development, price and development status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm getting results showing in the wrong/multiple categories for some items once selected. For example there is a development called Lockeswood, but when Lockeswood is selected from development dropdown. The results show Lockeswood and and another development called Highfield.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example: The county dropdown lets the user filter the results by county. i.e. Berkshire, Buckinghamshire, Hampshire etc. So when the user selects Berkshire, I only want results from the Berkshire category. However, when selecting Berkshire I'm getting results for Berkshire and Buckinghamshire?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the select drop downs all show the correct options, but the results are incorrect in some cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help fix the query below to only output the correct results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have attached a screenshot highlighting the issue in red.&lt;a href=&quot;https://i.stack.imgur.com/M4b5c.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M4b5c.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;main secondary&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;h1 class=&quot;&quot;&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p class=&quot;intro&quot;&amp;gt;{{ entry.introduction }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;filter-heading clearfix&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;filter-block&quot;&amp;gt;&#xA;          &amp;lt;span&amp;gt;Refine your search&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;ld_triangle t-right&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;form class=&quot;form-inline&quot; action=&quot;{{ url('developments') }}&quot; method=&quot;get&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;          &amp;lt;label for=&quot;county1&quot;&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;          &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;            &amp;lt;select id=&quot;county1&quot; class=&quot;form-control&quot; name=&quot;county1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;          &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            {% for category in craft.categories.group('counties').order('title asc') %}&#xA;            &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;development1&quot;&amp;gt;Development&amp;lt;/label&amp;gt;&#xA;      &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;        &amp;lt;select id=&quot;development1&quot; class=&quot;form-control&quot; name=&quot;development1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;          &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;          {% for category in craft.categories.group('developments').order('title asc') %}&#xA;          &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;price1&quot;&amp;gt;Price&amp;lt;/label&amp;gt;&#xA;        &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;            &amp;lt;select id=&quot;price1&quot; class=&quot;form-control&quot; name=&quot;price1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            {% for category in craft.categories.group('priceRange').order('title asc') %}&#xA;            &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;status1&quot;&amp;gt;Development Status&amp;lt;/label&amp;gt;&#xA;    &amp;lt;div class=&quot;selectwrap&quot;&amp;gt;&#xA;    &amp;lt;select id=&quot;status1&quot; class=&quot;form-control&quot; name=&quot;status1&quot; onchange=&quot;this.form.submit()&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;        {% for category in craft.categories.group('status').order('title asc') %}&#xA;        &amp;lt;option value=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;&amp;lt;section class=&quot;developments tab-content&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;    {# Start For loop #}&#xA;    {% set query = &quot;&quot; %}&#xA;    {% if craft.request.getParam('county1') and&#xA;      craft.request.getParam('county1') is not empty %}&#xA;    {% set query = craft.request.getParam('county1') %}&#xA;    {% elseif craft.request.getParam('development1') and&#xA;      craft.request.getParam('development1') is not empty %}&#xA;    {% set query = craft.request.getParam('development1') %}&#xA;    {% elseif craft.request.getParam('price1') and&#xA;      craft.request.getParam('price1') is not empty %}&#xA;    {% set query = craft.request.getParam('price1') %}&#xA;    {% elseif craft.request.getParam('status1') and&#xA;      craft.request.getParam('status1') is not empty %}&#xA;    {% set query = craft.request.getParam('status1') %}&#xA;    {% endif %}&#xA;&#xA;    {% set queryFilter = craft.categories.group('developments').search(query).order('title asc') %}&#xA;&#xA;    {% if queryFilter|length %}&#xA;    {% for category in queryFilter %}&#xA;&amp;lt;div class=&quot;development-block&quot;&amp;gt;&#xA;  &amp;lt;a class=&quot;grid one&quot; href=&quot;{{ category.url }}&quot; role=&quot;button&quot;&amp;gt;&#xA;    {% set image = category.insetImage.first() %}&#xA;    {% for image in category.insetImage %}&#xA;    &amp;lt;div class=&quot;grid__item&quot; style=&quot;background-image:url({{ image.url('devListMainLarge') }})&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;    {% set imagesecondary = category.insetImageSecondary.first() %}&#xA;    {% for imagesecondary in category.insetImageSecondary %}&#xA;    &amp;lt;div class=&quot;grid__item&quot; style=&quot;background-image:url({{ imagesecondary.url('devListSecondaryLarge') }})&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/a&amp;gt;&#xA;  &amp;lt;div class=&quot;grid two&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;h4 class=&quot;&quot;&amp;gt;{{ category.town }}, {{ category.county }}&amp;lt;/h4&amp;gt;&#xA;      &amp;lt;p class=&quot;standfirst&quot;&amp;gt;{{ category.developmentIntroduction}}&amp;lt;/p&amp;gt;&#xA;      &amp;lt;p class=&quot;indicative&quot;&amp;gt;{{ category.fapCaption}}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;a class=&quot;btn development hidden-xs hidden-sm&quot; href=&quot;{{ category.url }}&quot; role=&quot;button&quot;&amp;gt;View development&amp;lt;i class=&quot;icon-caret-right btn-after&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;divider&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;  &amp;lt;aside class=&quot;grid three&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;div class=&quot;price&quot;&amp;gt;{{ category.price }}&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;cta-info&quot;&amp;gt;{{ category.callToAction }}&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;h5 class=&quot;agent&quot;&amp;gt;Selling agent:&amp;lt;/h5&amp;gt;&#xA;      {% for option in category.agentName %}&#xA;      &amp;lt;div&amp;gt;{{ option }}&amp;lt;/div&amp;gt;&#xA;      {% else %}&#xA;      &amp;lt;div&amp;gt;{{ category.agentNotListed }}&amp;lt;/div&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;a class=&quot;register&quot; data-toggle=&quot;modal&quot; href=&quot;{{ category.url }}?message=register&quot;&amp;gt;REGISTER YOUR INTEREST&amp;lt;/a&amp;gt;&#xA;      &amp;lt;a class=&quot;btn development hidden-md hidden-lg&quot; href=&quot;{{ category.url }}&quot; role=&quot;button&quot;&amp;gt;View development&amp;lt;i class=&quot;icon-caret-right btn-after&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/aside&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;    {% endfor %} {# End For loop #}&#xA;    {% else %}&#xA;    &amp;lt;p class=&quot;intro&quot;&amp;gt;&#xA;      There are currently no developments in {{ query|capitalize }}. &amp;lt;a data-toggle=&quot;modal&quot; href=&quot;#priorityModal&quot;&amp;gt;&amp;lt;strong&amp;gt;Register you interest&amp;lt;/strong&amp;gt;&amp;lt;/a&amp;gt; to receive priority information when a development becomes available in the area.&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-05-18T21:54:23.360" Title="Query is outputting additional results" Tags="&lt;queries&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20518" PostTypeId="1" CreationDate="2017-05-18T11:00:18.740" Score="0" ViewCount="105" Body="&lt;p&gt;Uploading PDFs to Craft3 with Imagick extension enabled seems to rasterize and compress the PDFs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if I manually swap out the files after upload, it works fine until I have to edit something in an article with a pdf uploaded. Then the behavior is repeated when I press save. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on where to disable this behavior?&lt;/p&gt;&#xA;" OwnerUserId="6394" LastActivityDate="2017-06-14T12:30:05.670" Title="Uploading PDFs with Imagick extension enabled seems to rasterize and compress the PDFs" Tags="&lt;assets&gt;&lt;upload&gt;&lt;pdf&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20520" PostTypeId="1" CreationDate="2017-05-18T13:10:02.360" Score="2" ViewCount="129" Body="&lt;p&gt;So I have what &lt;em&gt;seems&lt;/em&gt; like a simple problem but can't quite find a solution. On my entry template I'm trying to override the image fields as we're using the imager plugin for transforms. However, it doesn't seem to be working at all. No matter what I put inside the &lt;code&gt;craft.sproutSeo.meta&lt;/code&gt; do loop, nothing happens. Even if I hardcode a value in there. It seems simple, but is there something I'm missing here? My code is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}&#xA;{% do craft.sproutSeo.meta({&#xA;    ogImage: siteUrl ~ cardEntryImage.getUrl(),&#xA;    ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),&#xA;    ogImageHeight: cardEntryImage.getHeight(),&#xA;    ogImageWidth: cardEntryImage.getWidth(),&#xA;    ogImageType: cardEntryImage.getMimeType(),&#xA;    twitterImage: siteUrl ~ cardEntryImage.getUrl()&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6733" LastActivityDate="2018-03-28T07:21:27.727" Title="Sprout SEO 3 Image Override Not Working" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20521" PostTypeId="1" AcceptedAnswerId="20525" CreationDate="2017-05-18T15:42:15.600" Score="2" ViewCount="63" Body="&lt;p&gt;Is it possible to save the same Entry (red arrow) twice/more than once in one custom relations field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Test Playlist&quot; is a entry in a channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up a playlist, where an entry should be saved more than once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jQI7N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jQI7N.png&quot; alt=&quot;Save Entry in Playlist&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6734" LastEditorUserId="57" LastEditDate="2017-05-18T22:26:51.720" LastActivityDate="2017-05-18T22:26:51.720" Title="Save same Entry more than once with help of custom relations field" Tags="&lt;entry&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20522" PostTypeId="1" CreationDate="2017-05-18T15:51:46.737" Score="1" ViewCount="305" Body="&lt;p&gt;At the moment there seems to be no UI / function for changing the product type for an existing product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see theres a typeId column in the products table. Would it be as simply to change this? Would this cause any issues elsewhere?&lt;/p&gt;&#xA;" OwnerUserId="5740" LastActivityDate="2017-05-18T23:55:25.517" Title="Changing product type for products in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20525" PostTypeId="2" ParentId="20521" CreationDate="2017-05-18T16:28:36.357" Score="1" Body="&lt;p&gt;No, but you could use &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;a Matrix field&lt;/a&gt; containing a Entries field.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-05-18T16:28:36.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20526" PostTypeId="2" ParentId="20517" CreationDate="2017-05-18T17:32:31.230" Score="2" Body="&lt;p&gt;Let's get the caveats dispensed with. I &lt;em&gt;think&lt;/em&gt; the approach detailed in this answer should work, but I've never tried relating categories to categories in this way before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking of which, I have some misgivings regarding the way you've organised everything. However, let's assume for the time being that you have good reasons for doing it this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're currently attempting to search for entries (note the lowercase &quot;e&quot;) which contain a given string, such as the county name. That's a scattershot approach, so it's not surprising that you're getting some unwanted results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to specify the relationships between you property types and the counties, developments, etc., &lt;strong&gt;you'll need to use the category ID as the drop down value, not the category slug&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that you only want to filter by one criterion at a time, the easiest solution is to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countyId = craft.request.getParam('countyId')|default('') %}&#xA;{# And so forth, for each filter #}&#xA;&#xA;{% if countyId %}&#xA;    {% set relatedCriteria = {&#xA;        targetElement: countyId,&#xA;        field: 'countyFieldHandle'&#xA;    } %}&#xA;{% endif %}&#xA;&#xA;{# And so forth, for each filter, in order of preference #}&#xA;&#xA;{% set propertyTypes = relatedCriteria|default(false)&#xA;? craft.categories.group('developments').relatedTo(relatedCriteria)&#xA;: craft.categories.group('developments') %}&#xA;&#xA;{% for propertyType in propertyTypes %}&#xA;    {# Do your thing #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-05-18T21:54:23.360" LastActivityDate="2017-05-18T21:54:23.360" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20528" PostTypeId="2" ParentId="20514" CreationDate="2017-05-18T21:29:46.887" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there an easy/quick way to do this without using an external service?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nothing easy I can think of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 2 (which only supports MySQL), Craft turns those search queries into a MySQL query that can take advantage of MySQL's Full Text Search indexes on the &lt;code&gt;craft_searchindex&lt;/code&gt; table, using full text wildcards as necessary for fuzzy searching the beginning and ending of a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the closest thing that MySQL has that might do what you're looking for is &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_soundex&quot; rel=&quot;nofollow noreferrer&quot;&gt;SOUNDEX()&lt;/a&gt;, but 1) Craft doesn't use that and 2) it doesn't appear that SOUNDEX can be used against full text indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind (just like &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search Plus&lt;/a&gt;) any solution you find is only going to affect front-end searches (not in the CP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should add a thumbs-up/comment to this feature request if you'd like to see that change: &lt;a href=&quot;https://github.com/craftcms/cms/issues/833&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/833&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-18T21:29:46.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20529" PostTypeId="2" ParentId="20495" CreationDate="2017-05-18T21:33:04.287" Score="1" Body="&lt;p&gt;I hear ya. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tricky thing is when it's templates distributed to people/setups for use as a platform for whatever they want to build, without them having the know-how in terms of programming or databases other than HTML/CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pushing updates in a simple way would be fantastic... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main thing missing is essentially; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;find field, global, structure, user or group or whatever is selected when exporting&lt;/code&gt; &gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if not exist, create&lt;/code&gt; &gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if exist compare field settings&lt;/code&gt; &gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if name, description or type different, change one or all of the above&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy and straightforward way of doing that...&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2017-05-18T21:33:04.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20530" PostTypeId="2" ParentId="20522" CreationDate="2017-05-18T22:14:28.083" Score="0" Body="&lt;p&gt;Assuming this is because you've got a ton of products already setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;code&gt;productTypeId&lt;/code&gt; columns in other tables you'd want to consider as well. &lt;code&gt;craft_commerce_discount_producttypes&lt;/code&gt;, &lt;code&gt;craft_commerce_producttypes_i18n&lt;/code&gt;, &lt;code&gt;craft_commerce_producttypes_shippingcategories&lt;/code&gt;, &lt;code&gt;craft_commerce_producttypes_taxcategories&lt;/code&gt;, &lt;code&gt;craft_commerce_sale_producttypes&lt;/code&gt; just from a quick scan of the schema.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, make sure you backup your database first and test thoroughly afterwards.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-18T22:14:28.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20531" PostTypeId="2" ParentId="20522" CreationDate="2017-05-18T23:55:25.517" Score="1" Body="&lt;p&gt;I personally think mucking with the schema here is bound to get you in trouble.  Very easy to miss something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have much data in yet, simply start again, and chalk it down to learning/experience.  (Personally I think there should be a 'Start This Way' page in the Commerce docs that  emphasises Data Modelling for product types is where you should begin!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do have a lot of data in, best to export &amp;amp; then re-import your data using e.g. FeedMe - &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/getting-started/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sgroup.com.au/plugins/feedme/getting-started/introduction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You will need the Pro version which support Products)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-18T23:55:25.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20532" PostTypeId="2" ParentId="20515" CreationDate="2017-05-19T00:11:40.880" Score="2" Body="&lt;p&gt;Not an answer to the specific issue as such, but perhaps handy for future folks looking to debug issues in this area - you can dump the gateway request data with something like this in your business logic plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see hook docs here: &lt;a href=&quot;https://craftcommerce.com/docs/hooks-reference#commerce_modifygatewayrequestdata&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/hooks-reference#commerce_modifygatewayrequestdata&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function commerce_modifyGatewayRequestData($data,$type,$transaction)&#xA;{&#xA;&#xA;        BusinessLogicPlugin::log(&quot;commerce_modifyGatewayRequestData&quot;); &#xA;        BusinessLogicPlugin::log(&quot;data&quot;);&#xA;        BusinessLogicPlugin::log($data);&#xA;        BusinessLogicPlugin::log(&quot;type&quot;);&#xA;        BusinessLogicPlugin::log($type);&#xA;        BusinessLogicPlugin::log(&quot;transaction&quot;);&#xA;        BusinessLogicPlugin::log($transaction);&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(assuming you have a &lt;code&gt;log&lt;/code&gt; function in there that accepts strings and if not a string does a &lt;code&gt;var_dump&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That at least gives you a full look at the data you're sending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also modify the &lt;code&gt;$data&lt;/code&gt; in there, and &lt;code&gt;return $data&lt;/code&gt; at the end if you need to massage any of the data before submissin.  E.g. with &lt;code&gt;eWay&lt;/code&gt; you should truncate some fields if they are too long or you will get errors...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        if(isset($data['Customer']['Street1']))&#xA;        $data['Customer']['Street1'] = substr($data['Customer']['Street1'], 0, 49);&#xA;&#xA;        ...etc&#xA;&#xA;        return $data;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Similarly, after a transaction, you can log the response etc using this event: &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(See what you can log at &lt;a href=&quot;https://craftcommerce.com/docs/transaction-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/transaction-model&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_transactions.onSaveTransaction', function ($event){&#xA;&#xA;    $transaction = $event-&amp;gt;params['transaction'];&#xA;    BusinessLogicPlugin::log($transaction-&amp;gt;response);&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-19T00:11:40.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20533" PostTypeId="2" ParentId="20509" CreationDate="2017-05-19T00:23:27.550" Score="1" Body="&lt;p&gt;Well, after a transaction, you can log the full gateway response etc using this event: &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_transactions.onsavetransaction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(See what you can get at/log at &lt;a href=&quot;https://craftcommerce.com/docs/transaction-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/transaction-model&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_transactions.onSaveTransaction', function ($event){&#xA;&#xA;      $transaction = $event-&amp;gt;params['transaction'];&#xA;      BusinessLogicPlugin::log($transaction-&amp;gt;response);&#xA;&#xA; });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...that should hopefully get you started on grabbing the data you need (I presume PayPal returns the address) - and then adding that to the cart at that point.  &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-23T06:11:08.787" LastActivityDate="2017-05-23T06:11:08.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20534" PostTypeId="2" ParentId="20515" CreationDate="2017-05-19T07:32:39.873" Score="1" Body="&lt;p&gt;The &lt;em&gt;Complete Function&lt;/em&gt; of the SaferPay gateway had the wrong arguments which I didn’t catch first thus creating a malformed request, I guess. Fixing that solved the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the second issue (&lt;code&gt;Missing DATA attribute&lt;/code&gt;): turned out that I didn’t have CSRF protection enabled which I was sure that I had. But this Craft installation is from around 2014 and I only picked up working on it again this month. So I missed that also. Enabling it (&lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#csrf-protection-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;as suggested in the docs&lt;/a&gt;) resolved that too so everything is working as expected now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea about the inner workings of this so if anyone could enlighten me on that I would be very grateful. My knowledge of PHP is pretty much non existing and I am merely glueing stuff together and see what works.&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2017-05-19T07:45:50.760" LastActivityDate="2017-05-19T07:45:50.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20536" PostTypeId="1" CreationDate="2017-05-19T14:04:30.447" Score="2" ViewCount="374" Body="&lt;p&gt;I have an entries field that lives on a user's profile. I am using ajax to add entries to this field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &quot;Click to add to favorites&quot;. Everything works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am trying to delete an entry from the entires field, and I'm not quite sure how to pass the right data back to my controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what my js looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = [];&#xA;$('.remove').click(function (event) {&#xA;    var clicked = $(this).data('id');&#xA;&#xA;    $('input[name=&quot;fields[myEntriesField][]&quot;]').each(function (key, val) {&#xA;        var value = $(val).val();&#xA;&#xA;    if (clicked != value) {&#xA;        data.push(value);&#xA;    }});&#xA;});&#xA;&#xA;    ...&#xA;&#xA;onRemove(data, function (response) {&#xA;    // response&#xA;});&#xA;&#xA;function onRemove(data, callback) {&#xA;    data[window.csrfTokenName] = window.csrfTokenValue;&#xA;    ...&#xA;    // ajax&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am doing here is adding all of the entry id's to my &lt;code&gt;data&lt;/code&gt; array &lt;em&gt;EXCEPT&lt;/em&gt; the one that I clicked on. I was going to pass that array to my controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have 3 entries in my entries field. This is what is returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;1131&quot;, &quot;1363&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's every entry &lt;em&gt;except&lt;/em&gt; the one I clicked on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my controller I was going to loop through the array (of entry ID's) and re-populate the entries field - save the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting stuck trying to add the CSRF token - since I am passing in an array I guess I can't seem to append the CSRF token.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is currently getting me this far:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The CSRF token could not be verified&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I log out all of the data just after I append the CSRF token, I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;1131&quot;, &quot;1363&quot;, _token: &quot;TOKEN_NAME|TOKEN_VALUE&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've read through &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2013/how-do-you-delete-assets-from-a-frontend-form/2029#2029&quot;&gt;this SO thread&lt;/a&gt;. Which works - but I don't want to actually delete the entry - in essence I just need to re-populate the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've ben able to pass the value(s) to my controller, but now just struggling how to actually re-populate the entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I'm passing into my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data: Array(2)&#xA;    0:&quot;1131&quot;&#xA;    1:&quot;1363&quot;&#xA;_token:&quot;TOKEN_NAME|TOKEN_VALUE&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my controller, I can access the values like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error_log(print_r(craft()-&amp;gt;request-&amp;gt;getPost('myField'), true));&#xA;&#xA;Array(&#xA;    [0] =&amp;gt; 1131&#xA;    [1] =&amp;gt; 1363&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now just to repopulate the entries field?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// fields[myEntriesField] is an entries field type.&#xA;$userModel-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'fields[myEntriesField]' =&amp;gt; , ??? &#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-05-20T19:04:31.900" LastActivityDate="2017-05-20T19:04:31.900" Title="How can I delete entries from an entries field from a front-end from?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20537" PostTypeId="1" CreationDate="2017-05-19T16:30:55.300" Score="1" ViewCount="533" Body="&lt;p&gt;Struggling to get this feed work with Element API. I'm trying to return all entries created by a specific username. I've tried several different methods, but none of them work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the latest version of what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dealers/&amp;lt;username:{username}&amp;gt;.json' =&amp;gt; function($username) {&#xA;  return [&#xA;    'elementType' =&amp;gt; 'Entry',&#xA;    'criteria' =&amp;gt; [&#xA;      'section' =&amp;gt; 'listings',&#xA;      'username' =&amp;gt; $username&#xA;    ],&#xA;    'paginate' =&amp;gt; false,&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;      ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5938" LastEditorUserId="22" LastEditDate="2017-05-19T18:29:31.010" LastActivityDate="2018-03-17T07:21:34.700" Title="Element API: how can I return entries via username?" Tags="&lt;entries&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20538" PostTypeId="2" ParentId="20319" CreationDate="2017-05-19T18:08:42.630" Score="2" Body="&lt;p&gt;So the caching issue I was having was on our blog overview page - a page on which you can do filtering to show entries of a certain category. Whenever someone would do a filter - the header would remain cached, when it should have updated to reflect the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I think in most cases @lazy pirate's solution would have worked but it wasn't working for me - possibly because the filtering was making it so Craft wasn't viewing the page as one single entry when a filter was run?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution I came to that worked for me was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key 'entry_' ~ entry.id ~ '_elements' unless entry is not defined or craft.request.segment(1) == 'blog' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That worked because 'blog' is always in the same position in the URL, even when filtered. Hope that helps someone! &lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2017-05-19T18:08:42.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20539" PostTypeId="1" CreationDate="2017-05-19T19:25:17.390" Score="2" ViewCount="161" Body="&lt;p&gt;I am currently writing a simple Redactor plugin which adds a button to the WYSIWYG editor in Craft 2. This one just formats the selected text like the existing bold button does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my problem is that whenever some text is marked as &lt;strong&gt;bold&lt;/strong&gt; and the text cursor is placed onto that text then the bold button's state is changed to active – as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jWVVs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jWVVs.png&quot; alt=&quot;bold button gets active on placing text cursor onto bold text&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the same thing with my custom button that is added by my plugin won't work. The button's state is still inactive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look on the official docs of Redactor about how to &lt;a href=&quot;https://imperavi.com/redactor/examples/buttons-sup-and-sub/&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Add Sup and Sub Buttons&quot;&gt;Add Sup and Sub Buttons&lt;/a&gt; which comes with an example plugin (including the plugin code and the resulting WYSIWYG). There a superscript (x²) button is added. Even that one doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XVIX4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XVIX4.png&quot; alt=&quot;superscript button stays inactive on placing text cursor onto superscripted text&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the screenshot the superscript button (x²) doesn't change its state to active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is:&lt;br&gt;&#xA;How can I achieve that the superscript button (x²) gets active when placing the text cursor onto superscripted text within the WYSIWYG editor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This superscript button is just an example. Of course, the solution should work for all other custom buttons as well.&#xA;Also, I assume that my code base is the same that you can find on the how-to page I linked above.&lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2018-02-09T14:52:42.257" Title="How to set a button's active state in WYSIWG (Redactor plugin)?" Tags="&lt;plugin-development&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20540" PostTypeId="1" AcceptedAnswerId="20543" CreationDate="2017-05-19T19:46:00.700" Score="1" ViewCount="87" Body="&lt;p&gt;I see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7039/whats-the-simplest-way-of-automatically-activating-verifying-user-accounts#&quot;&gt;this thread&lt;/a&gt; about automatically activating/verify user accounts. However, I have 2 group of users, 1 group is open public which would like to have automatically activating/verify. The 2nd group is private, need activate email and verify. Should I write a plugin or just modify UsersService.php to split 2 directions on saveUser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Angela&lt;/p&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-05-21T21:02:04.993" Title="Need difference sign up path for 2 groups" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20541" PostTypeId="2" ParentId="17089" CreationDate="2017-05-19T20:59:07.223" Score="1" Body="&lt;p&gt;It's likely one of two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;'localhost' won't work because you may need to specific a the specific server. Sometimes this is just the IP address of the hosting server. Other times it's a hostname. Search HostGator's site or control panel for anything that specifies a mysql hostname. Or you can reach out to their support to see if they can provide it to you.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's also possible that you have not been given mysql db connection privileges. This is an odd one because it's unique circumstances that warrant this. But reaching out to HostGator support will determine whether or not this is the case. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5938" LastActivityDate="2017-05-19T20:59:07.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20542" PostTypeId="1" AcceptedAnswerId="20559" CreationDate="2017-05-19T21:34:03.510" Score="1" ViewCount="253" Body="&lt;p&gt;I can load the s3 image fine using the s3 base path and the craft cms filename that is saved in the craft cms database:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;{{cdnUrl}}/filepath/{{entry.Image.first().filename }}&quot; /&amp;gt;&lt;/code&gt;&lt;br&gt;&#xA;renders&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;img src=&quot;cdn.imageurl.com/filepath/filename.jpg&quot; /&amp;gt;&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if I want to access the same image without the s3 base path (e.g. in order to use an image transform), I get a null. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;{{entry.Image.first().getUrl('transform')}}&quot; /&amp;gt;&lt;/code&gt;&lt;br&gt;&#xA;renders&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;img src=&quot;&quot; /&amp;gt;&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6742" LastEditorUserId="6742" LastEditDate="2017-05-19T22:18:02.877" LastActivityDate="2017-05-22T18:18:42.723" Title="asset.first().getUrl('transform') not working for s3 asset - Craft CMS 2.6.2980" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20543" PostTypeId="2" ParentId="20540" CreationDate="2017-05-19T22:22:21.220" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I write a plugin or just modify UsersService.php to split 2 directions on saveUser?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first one.  The second one has many drawbacks:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Any changes you make in &lt;code&gt;craft/app&lt;/code&gt; can (and probably will) get overwritten during an update.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which means you'll have to reapply them after updating.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not supported.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Craft has a bunch of &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;events&lt;/a&gt; that plugins can listen to and run logic when they fire without hacking core Craft files.  In your case, it sounds like &lt;code&gt;onBeforeSaveUser&lt;/code&gt; or &lt;code&gt;onSaveUser&lt;/code&gt; might be what you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-19T22:22:21.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20544" PostTypeId="2" ParentId="20537" CreationDate="2017-05-19T22:47:51.900" Score="1" Body="&lt;p&gt;Completely untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dealers/&amp;lt;username:(.*)&amp;gt;.json' =&amp;gt; function($username) {&#xA;    $author = craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($username);&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; 'Entry',&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'listings',&#xA;            'authorId' =&amp;gt; $author-&amp;gt;id&#xA;        ],&#xA;        'paginate' =&amp;gt; false,&#xA;        'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;            ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-09-18T03:34:43.343" LastActivityDate="2017-09-18T03:34:43.343" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20545" PostTypeId="1" AcceptedAnswerId="20546" CreationDate="2017-05-20T06:38:58.270" Score="2" ViewCount="91" Body="&lt;p&gt;My issue is that for security I don’t have the s3:ListAllMyBuckets permission (as I can only see one bucket), but not list them. Craft needs this to function, so I need to manually force the list of one bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to override the output of class S3AssetSourceType-&gt;getBucketList from a plugin (in Craft 2) to return my own list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 I’d create my own AssetSource. I guess I’m going to need to amend the core (I know very bad), but I think its the only option I have at this stage (unless anyone has a bright idea). We won’t allow updates via the CMS, so I could write a unit test to check the output is as I have amended it after any core updates. Also, I’d assume that S3AssetSourceType won’t be edited much in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not an ideal solution, but its the only way I can think of doing it. I have tried every other workaround I can think about (before editing the core code). I looked at mounting the filesystem using s3fs-fuse on Ubuntu, but Docker won’t allow it in our setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, any help would be much appreciated before I start hacking away… thanks.&lt;/p&gt;&#xA;" OwnerUserId="6743" LastEditorUserId="6743" LastEditDate="2017-05-20T14:21:10.713" LastActivityDate="2017-05-20T14:21:10.713" Title="Override the output of class S3AssetSourceType-&gt;getBucketList from a plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20546" PostTypeId="2" ParentId="20545" CreationDate="2017-05-20T14:20:53.740" Score="2" Body="&lt;p&gt;OK, this doesn't completely answer my question, but I think this is the more elegant solution to the problem I was trying to solve. If you don't have the all s3:ListAllMyBuckets permission available in AWS then the following plugin code will allow you to pass in a static bucket list. This meant I didn't have to start hacking the core code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        if(isset($_GET['p']) &amp;amp;&amp;amp; $_GET['p'] == &quot;admin/actions/assetSources/getS3Buckets&quot;)&#xA;        {&#xA;            // Requires an admin&#xA;            craft()-&amp;gt;userSession-&amp;gt;requireAdmin();&#xA;&#xA;            // Making the money&#xA;            craft()-&amp;gt;requireEdition(Craft::Pro); &#xA;&#xA;            $bucketList = array();&#xA;&#xA;            $bucketList[] = array(&#xA;                'bucket' =&amp;gt; 'my-bucket-name',&#xA;                'location' =&amp;gt; 'EU',&#xA;                'urlPrefix' =&amp;gt; 'http://s3-eu-west-1.amazonaws.com/my-bucket-name/'&#xA;            );&#xA;&#xA;            $this-&amp;gt;returnJson($bucketList);&#xA;        }&#xA;    }&#xA;&#xA;&#xA;    private function returnJson($var = array(), $options = array())&#xA;    {&#xA;        // Set the 'application/json' Content-Type header&#xA;        JsonHelper::setJsonContentTypeHeader();&#xA;&#xA;        $options = array_merge(array(&#xA;            'expires' =&amp;gt; false,&#xA;        ), $options);&#xA;&#xA;        // Set the Expires header&#xA;        if ($options['expires'] === false)&#xA;        {&#xA;            HeaderHelper::setNoCache();&#xA;        }&#xA;        else if ($options['expires'])&#xA;        {&#xA;            HeaderHelper::setExpires($options['expires']);&#xA;        }&#xA;&#xA;        // Output it into a buffer, in case TasksService wants to close the connection prematurely&#xA;        ob_start();&#xA;        echo JsonHelper::encode($var);&#xA;&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6743" LastActivityDate="2017-05-20T14:20:53.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20547" PostTypeId="2" ParentId="20536" CreationDate="2017-05-20T19:03:57.957" Score="2" Body="&lt;p&gt;Here is what I came up with that seems to be working well. Please let me know where there is room for improvement so others (including myself) can benefit!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;JS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var arr = [];&#xA;var data = {};&#xA;$('.remove').click(function (event) {&#xA;    var clicked = $(this).data('id');&#xA;&#xA;    $('input[name=&quot;fields[myEntriesField][]&quot;]').each(function (key, val) {&#xA;        var value = $(val).val();&#xA;        arr.push(value);&#xA;    });&#xA;&#xA;    // Check if we are sending anything.&#xA;    if (arr.length == 0) {&#xA;        data.arr = null;&#xA;    } else {&#xA;        data.arr = arr;&#xA;    }&#xA;&#xA;onRemove(data, function (response) {&#xA;    // response&#xA;});&#xA;&#xA;function onRemove(data, callback) {&#xA;    data[window.csrfTokenName] = window.csrfTokenValue;&#xA;    ...&#xA;    // ajax&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $userModel-&amp;gt;getContent()-&amp;gt;setAttributes([&#xA;     ...&#xA;     'myEntriesField' =&amp;gt; craft()-&amp;gt;request-&amp;gt;getPost('fieldHandle'),&#xA; ]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if I click the &quot;Delete&quot; button, each entry is removed from the user's profile. If I delete the last entry, I pass &lt;code&gt;null&lt;/code&gt; to the controller. This tells Craft that there are no entires to save in the entries field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-05-20T19:03:57.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20548" PostTypeId="1" AcceptedAnswerId="20550" CreationDate="2017-05-21T15:49:48.073" Score="0" ViewCount="797" Body="&lt;p&gt;Struggling to find any documentation on how to override Craft's HTML for the forgotten password email.&lt;/p&gt;&#xA;" OwnerUserId="6746" LastEditorUserId="57" LastEditDate="2017-05-22T06:38:09.630" LastActivityDate="2017-05-22T07:36:25.707" Title="How to override the Craft forgot password email" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20550" PostTypeId="2" ParentId="20548" CreationDate="2017-05-22T00:44:14.540" Score="2" Body="&lt;p&gt;The documentation can be found here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/forgot-password-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/forgot-password-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the full templating documentation that starts here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/global-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/global-variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual HTML side of things is determined by the template you're using, which you can specify in the control panel -&gt; settings -&gt; emails.  I believe these settings are considered 'self documenting' in that there are explanations on that page as to what they do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing worth noting is that IIRC you can't extend a layout template with that template, which is a little unfortunate.  So I have one general layout for all my general emails and duplicate that fully into the system email template.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-22T07:36:25.707" LastActivityDate="2017-05-22T07:36:25.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20551" PostTypeId="2" ParentId="29" CreationDate="2017-05-22T09:02:06.720" Score="3" Body="&lt;p&gt;Great answer above: &lt;a href=&quot;https://craftcms.stackexchange.com/a/30/1056&quot;&gt;https://craftcms.stackexchange.com/a/30/1056&lt;/a&gt; Works like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for multiple environments it can get pretty nasty to set up the file system for each environment individually. This is what I did to figure out the correct file system path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        ...&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'assetsPath' =&amp;gt; realpath(__DIR__ . '/../../public/assets')&#xA;        ),&#xA;    ),&#xA;    ...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The config path never changes, so it’s a good way to use it to figure out the assets path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Watch out:&lt;/strong&gt; For PHP &amp;lt; 5.3 it &lt;a href=&quot;https://stackoverflow.com/a/11094813/2342963&quot;&gt;has to be&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'assetsPath' =&amp;gt; realpath(dirname(__FILE__) . '/../../public/assets')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1056" LastEditorUserId="-1" LastEditDate="2017-05-23T12:38:53.957" LastActivityDate="2017-05-22T09:12:00.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20552" PostTypeId="1" AcceptedAnswerId="20556" CreationDate="2017-05-22T09:06:09.527" Score="2" ViewCount="106" Body="&lt;p&gt;I'm currently working on our new Docs website. This site should hold the documentation for all our projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could structurize the content like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Project 1 (&amp;lt;-- Section)&#xA;    Project section header 1 (&amp;lt;-- Structure)&#xA;        Menu item 1.1&#xA;        Menu item 1.2&#xA;        Menu item 1.3&#xA;        Menu item 1.4&#xA;        Menu item 1.5&#xA;    Project section header 2&#xA;        Menu item 2.1&#xA;        Menu item 2.2&#xA;        Menu item 2.3&#xA;&#xA;Project 2 (&amp;lt;-- Section)&#xA;    Project section header 1 (&amp;lt;-- Structure for Project 2)&#xA;        Menu item 1.1&#xA;        Menu item 1.2&#xA;        Menu item 1.3&#xA;        Menu item 1.4&#xA;        Menu item 1.5&#xA;    Project section header 2&#xA;        Menu item 2.1&#xA;        Menu item 2.2&#xA;        Menu item 2.3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd also like to have a dropdown which should list all available projects (Project 1, Project 2, ... from the above sample). If the visitor selects his desired project, a menu tree should be rendered in the sidebar with the corresponding structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the right way?&lt;/p&gt;&#xA;" OwnerUserId="6747" LastActivityDate="2017-05-24T07:25:31.220" Title="How to structurize a multi-project documentation site?" Tags="&lt;structure&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20553" PostTypeId="1" CreationDate="2017-05-22T11:53:13.267" Score="1" ViewCount="664" Body="&lt;p&gt;Not sure what is going on but my website is not getting indexed by google (went live last week). Robots is correct. What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the plugin seomatic for the SEO, Site robots meta tag has index, follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site is: &lt;a href=&quot;http://gastro-on-fire.be&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://gastro-on-fire.be&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6502" LastActivityDate="2017-05-24T10:49:56.190" Title="Website not indexing" Tags="&lt;craft-pro&gt;&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20554" PostTypeId="2" ParentId="20553" CreationDate="2017-05-22T12:59:10.517" Score="3" Body="&lt;p&gt;You need to tell Google that you have a new site or the best SEO in the world won't matter a jot; Google has no idea your site exists until you tell it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 4 essential steps to getting your site indexed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add your URL – Submit your website for inclusion in Google's index.&lt;/li&gt;&#xA;&lt;li&gt;App crawling – Get your app indexed by Google.&lt;/li&gt;&#xA;&lt;li&gt;Search Console – Submit a Sitemap of your website to Google.&lt;/li&gt;&#xA;&lt;li&gt;Structured data – Label your structured content to help users find pages relevant to their search.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These steps, and more, &lt;a href=&quot;https://support.google.com/webmasters/answer/6259634?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;are detailed here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I've taken another quick look at your site and I think you may be sending Google mixed signals about what to index.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You said your site is &lt;a href=&quot;http://gastro-on-fire.be&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://gastro-on-fire.be&lt;/a&gt; but that re-directs to &lt;a href=&quot;https://gastro-on-fire.be&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gastro-on-fire.be&lt;/a&gt; -- These are two different sites.&lt;/li&gt;&#xA;&lt;li&gt;Both sites are accessible also at the www subdomain, so you have actually 4 sites, which one do you want to index? Pick one, and follow Google's advice for that one. Add the others in Webmaster tools but set tell Google which is your preferred one, which one it should index.&lt;/li&gt;&#xA;&lt;li&gt;Ensure your seo strategy is inline, and remains in line with that choice. Currently, the sitemap at &lt;a href=&quot;https://gastro-on-fire.be/sitemap.xml&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gastro-on-fire.be/sitemap.xml&lt;/a&gt; gives all the site links as the www version; so you're telling Google to crawl the www site instead!!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Which one do you want to be indexed? Pick one, and ensure everything you tell Google backs up that choice.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastEditorUserId="3679" LastEditDate="2017-05-24T10:49:56.190" LastActivityDate="2017-05-24T10:49:56.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20555" PostTypeId="2" ParentId="745" CreationDate="2017-05-22T14:46:59.307" Score="1" Body="&lt;p&gt;I believe there are ways to marry them and I've been exploring just that with Vue. I'm not an expert in plugin development but I believe it involves POSTing the AJAX to a custom controller that you write, which can then save entries to the database via the service layer. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19061/updating-a-user-on-the-front-end-with-vue-js-and-axios&quot;&gt;This post&lt;/a&gt; I found useful as a place to start and has some good introductory information. This developer writes about his experience using Vue and Craft &lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-2-0-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://nystudio107.com/blog/autocomplete-search-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, I haven't seen a lot! But I'm curious to know the same thing. Indeed I would happily pay for a course if somebody were to make one. (Mijingo, I'm looking at you (Also at Udemy).)&lt;/p&gt;&#xA;" OwnerUserId="286" LastEditorUserId="286" LastEditDate="2017-07-27T18:47:47.943" LastActivityDate="2017-07-27T18:47:47.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20556" PostTypeId="2" ParentId="20552" CreationDate="2017-05-22T16:58:12.130" Score="2" Body="&lt;p&gt;Welcome to the Craft community. You try to create a new section for each project - right? In my opinion this is only necessary if you need different view and edit rights on each project. If you'r creating a &quot;open for all&quot; project documentation tool (open means for only one user group), than i would go with a single section. It's much easier to manage and starting with a new project. I would use two entry types in the section (&lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/sections-and-entries#entry-types&lt;/a&gt;). One entry type is for the project and one is for your chapters and the content.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Example:&#xA;    1x Section called &quot;projects&quot;&#xA;        1x entry type called &quot;project&quot; with following fields (example)&#xA;            - name &#xA;            - project description (rich text field)&#xA;            - project team (user field)&#xA;            - release date (table field with date and description)&#xA;            - ...&#xA;&#xA;        1x entry type called &quot;chapter&quot; with following fields (example)&#xA;            - name/title&#xA;            - content (richt text field)&#xA;            - images (file field)&#xA;            - documents (file field)&#xA;            - ...&#xA;&#xA;    Finaly you &quot;project&quot; section would be like this:&#xA;    Project 1 (entry type &quot;project&quot;)&#xA;        - Chapter 1 (entry type &quot;chapter&quot;)&#xA;           - Chapter 1.1 (entry type &quot;chapter&quot;)&#xA;           - Chapter 1.2 (entry type &quot;chapter&quot;)&#xA;        - Chapter 2 (entry type &quot;chapter&quot;)&#xA;           - Chapter 2.1 (entry type &quot;chapter&quot;)&#xA;           - ...&#xA;        - Chapter ...    &#xA;&#xA;    Project 2 (entry type &quot;project&quot;)&#xA;        - Chapter 1 (entry type &quot;chapter&quot;)&#xA;           - ...      &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For creating the dropdown-navigation, you can simple use the nav tag (&lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/nav&lt;/a&gt;). Instead of a use option tags for output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('projects').level(1) %}&#xA;&#xA;&amp;lt;select id=&quot;nav&quot; onchange=&quot;if (this.value) window.location.href=this.value&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;option value=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the subnavigation you could take a look on this Craft recipe -&gt; &lt;a href=&quot;https://craftcookbook.net/recipes/fully-dynamic-hierarchical-nav-menu-template&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcookbook.net/recipes/fully-dynamic-hierarchical-nav-menu-template&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other solutions:&#xA;Depending on how many content is used in each chapter, you could also make use of a matrix fields for your content...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doe's this make sense for you?&lt;/p&gt;&#xA;" OwnerUserId="3535" LastEditorUserId="57" LastEditDate="2017-05-24T07:25:31.220" LastActivityDate="2017-05-24T07:25:31.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20558" PostTypeId="1" CreationDate="2017-05-22T17:40:36.083" Score="2" ViewCount="2159" Body="&lt;p&gt;I've done a few installs of Craft and never had a problem. I'm currently trying to do an install on a new server under a subdmomain and getting the following results…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This results in 404&#xA;&lt;a href=&quot;http://staging.example.com/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://staging.example.com/admin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using /index.php/admin or /index.php?p=admin results in Internal Server Error 500.&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2017-11-28T22:30:53.640" Title="Internal Server error during install" Tags="&lt;error&gt;&lt;server&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20559" PostTypeId="2" ParentId="20542" CreationDate="2017-05-22T18:18:42.723" Score="1" Body="&lt;p&gt;Turns out you need to have the URL prefix set under the Asset Settings in order to call .getUrl()&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bchmZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bchmZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I added this, my transforms began working.&lt;/p&gt;&#xA;" OwnerUserId="6742" LastActivityDate="2017-05-22T18:18:42.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20561" PostTypeId="1" AcceptedAnswerId="20563" CreationDate="2017-05-22T20:03:54.963" Score="0" ViewCount="1068" Body="&lt;p&gt;How do I find documentation explaining how to build a theme in Craft CMS? Where do I put my theme's assets, like my CSS and JS files, and how do I reference those assets in my Twig templates?&lt;/p&gt;&#xA;" OwnerUserId="6751" LastEditorUserId="45" LastEditDate="2017-05-22T20:44:06.517" LastActivityDate="2017-05-23T15:32:03.197" Title="Where is the documentation for creating templates/themes?" Tags="&lt;theme&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20562" PostTypeId="2" ParentId="20561" CreationDate="2017-05-22T20:33:26.313" Score="5" Body="&lt;p&gt;Each Craft install is typically considered a discrete site, with its own design, information architecture, assets, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why you might not be seeing information about &quot;theming,&quot; per se.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However! Everything you need to start will be in &lt;code&gt;craft/templates&lt;/code&gt; and &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/templates&lt;/code&gt; is how you generate HTML. Files in here often correspond to your sections and routes, but can also get rendered statically, just based on where you put them and what they're named. &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;noreferrer&quot;&gt;Check out the Routing documentation&lt;/a&gt; to decide how you want to set up your basic templates.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;public&lt;/code&gt; is the only folder in the installation that is accessible to the web, directly. All your CSS, JS, fonts, static images (i.e. a logo, icons), etc. will go. You can reference those files the same way you would a regular HTML file. Craft &lt;a href=&quot;https://craftcms.com/docs/templating/tags&quot; rel=&quot;noreferrer&quot;&gt;has some tags to help you&lt;/a&gt; with generating the proper URLs.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These are two of the primary concepts that you'll need to grasp to get started displaying your content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be sure to check out the &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;noreferrer&quot;&gt;Templating Overview&lt;/a&gt; and click through the next few Docs pages. Once you understand &lt;em&gt;where&lt;/em&gt; a template needs to be (and why), you can dig in to &lt;a href=&quot;https://craftcms.com/docs/templating&quot; rel=&quot;noreferrer&quot;&gt;the expanded templating docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last (rather granular) note: Each type of content you define (&lt;code&gt;Section&lt;/code&gt;s) that has a URL will ask you for an &lt;em&gt;Entry Template&lt;/em&gt;. That path is within your &lt;code&gt;craft/templates&lt;/code&gt; folder, and it'll automatically load the file when you visit that Entry's URL. (i.e. my &quot;News&quot; section might have &lt;code&gt;_news/post&lt;/code&gt; as its &lt;em&gt;Entry Template&lt;/em&gt;, which corresponds to &lt;code&gt;craft/templates/_news/post.twig&lt;/code&gt;. The underscore prevents it from being directly accessed/rendered via &lt;code&gt;mydomain.com/news/post&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2017-05-22T20:33:26.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20563" PostTypeId="2" ParentId="20561" CreationDate="2017-05-22T20:42:04.350" Score="2" Body="&lt;p&gt;Generally speaking, Craft doesn't care where those files live, but I generally put all assets like CSS/SCSS, JS, etc in my &lt;code&gt;craft/templates&lt;/code&gt; folder. If you're using &lt;code&gt;gulp&lt;/code&gt; then you would compile your files out to the &lt;code&gt;public&lt;/code&gt; folder and link to them appropriately. If you're not compiling those, then they would need to live in the &lt;code&gt;public&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about templating here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating-overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://withchief.com/blog/craft-cms-the-very-basics-of-templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://withchief.com/blog/craft-cms-the-very-basics-of-templating&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as how I organize my &lt;code&gt;scss&lt;/code&gt; and &lt;code&gt;js&lt;/code&gt; I just drop those into an assets folder like so:&lt;a href=&quot;https://i.stack.imgur.com/B8rBo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B8rBo.png&quot; alt=&quot;JS setup[![][1]][1]&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps! Craft is extremely flexible with almost no restrictions on what it can do.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="101" LastEditDate="2017-05-23T15:32:03.197" LastActivityDate="2017-05-23T15:32:03.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20564" PostTypeId="1" CreationDate="2017-05-22T21:48:15.313" Score="1" ViewCount="40" Body="&lt;p&gt;We are currently working on using Craft to build out new versions of our site (in-house) and we have multiple sites that will share a global nav. Is there a way for one site to access the data in another site to update the global nav dynamically? I'm not sure if it's possible but I also know Craft is pretty magical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parent domain link and child domain link will hardly never change so that can stay static content; more so wondering about accessing the data in the child domain from parent/sibling sites. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;example structure&#xA;&#xA;parent domain link&#xA;  |-- child domain link&#xA;  |   |_&#xA;  |     |-- dynamic links&#xA;  |     |-- dynamic links&#xA;  |     |-- dynamic links&#xA;  |&#xA;  |-- child domainlink&#xA;  |   |_&#xA;  |     |-- dynamic links&#xA;  |     |-- dynamic links&#xA;  |     |-- dynamic links&#xA;  |&#xA;  |-- child domain link&#xA;     |_&#xA;       |-- dynamic links&#xA;       |-- dynamic links&#xA;       |-- dynamic links&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6361" LastActivityDate="2017-06-05T16:20:51.530" Title="Global nav with dynamic links across multiple sites" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20566" PostTypeId="1" CreationDate="2017-05-22T23:21:46.987" Score="2" ViewCount="389" Body="&lt;p&gt;I have a section with an text field and an image field. the asset field may sometimes be left blank. in this case, in my template, i want to grab the image from another random entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I'm trying to use, but when the image field is blank in my initial entry, I'm getting an error that Variable &quot;image&quot; doesn't exist.&#xA;Am I calling the random image incorrectly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for stat in craft.entries.section('statistics').limit(1).order('RAND()') %}&#xA;{% if stat.image|length %}&#xA;    {% set image = stat.image.first() %}&#xA;{% else %}  &#xA;    {% for random in craft.entries.section('statistics').limit(1).image(':notempty:').order('RAND()') %}&#xA;        {% set image = random.image.first() %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{{ image.url('medium') }}')&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-06-07T00:51:44.500" Title="Get an image from a random entry" Tags="&lt;entries&gt;&lt;image&gt;&lt;forloop&gt;&lt;random&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20567" PostTypeId="1" CreationDate="2017-05-23T06:28:59.440" Score="1" ViewCount="102" Body="&lt;p&gt;In order to create a cross region setup for my craft website, I've created a &lt;strong&gt;read-only replica&lt;/strong&gt; of my RDS DB from North Virginia region to Canada Central region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm facing the internal server error every time Craft is trying to update the session related info in the read-only database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could have used the same DB of N.Virginia but, if the N.Virginia region is down, then there will be no DB to support the server in the Canada region.So for this reason I've created a read only replica of the RDS at N.Virginia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I'm choosing read-replica? Because AWS updates it automatically if we update the master DB. So I'll have to update in only one place and the slave RDS across regions will be updated as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I resolve this?&#xA;Or, what is the best approach to AWS cross region setup for Craft website?&lt;/p&gt;&#xA;" OwnerUserId="6672" LastEditorUserId="6672" LastEditDate="2017-05-23T10:12:55.840" LastActivityDate="2017-05-23T10:12:55.840" Title="Problems while setting up a cross region Craft website in AWS" Tags="&lt;database&gt;&lt;session&gt;&lt;mysql&gt;&lt;aws&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20568" PostTypeId="2" ParentId="14901" CreationDate="2017-05-23T07:50:30.613" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update to carlcs answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new MailChimp Subscribe plugin sends an array as result instead of an object. So I had to go this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onActivateUser', function(Event $event) {&#xA;    $user = $event-&amp;gt;params['user'];&#xA;&#xA;    if (!$user-&amp;gt;admin) {&#xA;        $result = craft()-&amp;gt;mailchimpSubscribe-&amp;gt;subscribe($user-&amp;gt;email, '');&#xA;&#xA;        if (!$result[&quot;success&quot;]) {&#xA;            Craft::log('Couldn’d subscribe to MailChimp list: '.print_r([&#xA;                'errorCode' =&amp;gt; $result[&quot;errorCode&quot;],&#xA;                'message' =&amp;gt; $result[&quot;message&quot;],&#xA;            ], true), LogLevel::Error);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6585" LastActivityDate="2017-05-23T07:50:30.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20569" PostTypeId="1" CreationDate="2017-05-23T08:17:05.587" Score="3" ViewCount="96" Body="&lt;p&gt;we are a small team in Berlin, Germany, developing editorial websites based on craft cms. A major publishing house is interested in our services. A condition to get contracted is us to provide a certain (t.b.d.) level of tech support – a requirement that we can´t match since we are just a small company. Now my question: does anybody know a tech support-provider in germany to whom we could &quot;outsource&quot; this service? &lt;/p&gt;&#xA;" OwnerUserId="5082" LastActivityDate="2017-05-23T17:23:35.310" Title="Tech Support-Provider for Craft CMS" Tags="&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20571" PostTypeId="1" CreationDate="2017-05-23T15:52:18.813" Score="1" ViewCount="338" Body="&lt;p&gt;Has anyone had any luck trying to save a variant via a plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to integrate with a 3rd party inventory system and want to grab the current stock information and update my variants. Currently I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Variant');&#xA;$criteria-&amp;gt;sku = $sku;&#xA;$variant = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works just fine to grab the variant i need, but...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$variant-&amp;gt;stock = 99;&#xA;craft()-&amp;gt;commerce_variants-&amp;gt;saveVariant($variant);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me no error, but does not update the variant in the database. What is the method I should be using to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="6691" LastActivityDate="2017-05-24T01:37:14.357" Title="Saving a variant with new stock from plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;stock&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20573" PostTypeId="1" AcceptedAnswerId="20597" CreationDate="2017-05-23T16:31:01.587" Score="2" ViewCount="127" Body="&lt;p&gt;I'm trying to setup a sitemap using the &lt;a href=&quot;https://github.com/joshuabaker/craft-sitemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft-sitemap plugin&lt;/a&gt;, however it only covers sections by default and I need to add category groups into it, as half of the URLs are in categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the Service Methods section in the docs that says that &quot;There’s several service methods made available to add items to the sitemap.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hooks&lt;/strong&gt;&#xA;&lt;code&gt;renderSitemap&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a renderSitemap method to your plugin to add items via the various service methods listed below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s an example plugin hook method with comments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;addCategoryGroup(CategoryGroupModel $categoryGroup, [$changefreq, [$priority]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adds all categories in the group to the sitemap.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$group = craft()-&amp;gt;categories-&amp;gt;getGroupByHandle('news');&#xA;craft()-&amp;gt;sitemap-&amp;gt;addCategoryGroup($group);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure where to start. Where does the hook code go? As I'm assuming I'd have to create a new file, as it will need to be separate from the sitemap plugin as that will be overwritten if there are any updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate some advice on this please?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="57" LastEditDate="2017-05-26T05:04:04.957" LastActivityDate="2017-05-26T10:55:58.097" Title="add categories to sitemap plugin through the renderSitemap hook" Tags="&lt;plugins&gt;&lt;plugin-sitemap&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20574" PostTypeId="2" ParentId="20569" CreationDate="2017-05-23T17:23:35.310" Score="8" Body="&lt;p&gt;This is Leslie, I'm the Chief Customer Officer for Craft CMS. I'm not sure I can help, but I'd like to know more. Specifically I'm not sure I can source a dev shop in Germany, but I may be able to get close. We do have Service Partners and we are privately testing a couple of service plans both directly from us and from contracting 3rd party shops that specialize in this type of support. Knowing more details will help us figure out how to develop this type of support from the community and directly from us. Please email me directly at Leslie@Craftcms.com. &lt;/p&gt;&#xA;" OwnerUserId="4117" LastActivityDate="2017-05-23T17:23:35.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20575" PostTypeId="1" AcceptedAnswerId="20595" CreationDate="2017-05-23T19:54:51.360" Score="3" ViewCount="1166" Body="&lt;p&gt;I'm nearly there on this one but could use some help. I want to list all User Groups, with all Users listed under each group. For bonus points, this all needs to be alphabetical (Group, then Users). Something like...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;User Group A&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User Name A&lt;/li&gt;&#xA;&lt;li&gt;User Name B&lt;/li&gt;&#xA;&lt;li&gt;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;User Group B&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User Name A&lt;/li&gt;&#xA;&lt;li&gt;User Name B&lt;/li&gt;&#xA;&lt;li&gt;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userGroups = craft.userGroups.getAllGroups() %}&#xA;&#xA;{% if userGroups|length %}&#xA;    {% for userGroup in userGroups %}&#xA;        &amp;lt;h2&amp;gt;{{ userGroup.name }}&amp;lt;/h2&amp;gt;&#xA;        {# list all users for this group #}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just can't figure out how to loop through users for a userGroup.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="57" LastEditDate="2017-05-26T03:49:27.563" LastActivityDate="2018-08-13T22:29:46.843" Title="How to list all User Groups and Users" Tags="&lt;users&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20576" PostTypeId="2" ParentId="20575" CreationDate="2017-05-23T22:33:09.287" Score="1" Body="&lt;p&gt;Is this what you're going for?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userGroups = craft.users.getAllGroups().order('firstName ASC') %}&#xA;&#xA;{% if userGroups|length %}&#xA;    {{ userGroups.group }}&#xA;&#xA;    {% for userGroup in userGroups %}&#xA;        &amp;lt;h2&amp;gt;{{ userGroup.name }}&amp;lt;/h2&amp;gt;&#xA;        {# list all users for this group #}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output all of the Users in ABC order based on the &lt;code&gt;firstName&lt;/code&gt; field.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="57" LastEditDate="2017-05-24T07:35:16.830" LastActivityDate="2017-05-24T07:35:16.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20577" PostTypeId="1" CreationDate="2017-05-23T23:12:54.480" Score="1" ViewCount="99" Body="&lt;p&gt;This is my basic entry layout and I just want to display the linked category and tag names as indicated…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;posts sidemeta&quot;&amp;gt;&#xA;{% for entry in craft.entries.section('news').find() %}&#xA;&amp;lt;div class=&quot;post format-standard&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;date-wrapper&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;date&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;day&quot;&amp;gt;{{ entry.postDate | date(&quot;d&quot;) }}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;month&quot;&amp;gt;{{ entry.postDate | date(&quot;M&quot;) }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- /.date --&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- /.date-wrapper --&amp;gt;&#xA;    &amp;lt;div class=&quot;post-content&quot;&amp;gt;&#xA;        &amp;lt;h2 class=&quot;post-title&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h2&amp;gt;&#xA;        &amp;lt;ul class=&quot;meta&quot;&amp;gt;&#xA;            &amp;lt;li class=&quot;categories&quot;&amp;gt;Category: &amp;lt;a href=&quot;#&quot;&amp;gt;Category Name&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li class=&quot;tags&quot;&amp;gt;Tags: &amp;lt;a href=&quot;#&quot;&amp;gt;Tag 1&amp;lt;/a&amp;gt;, &amp;lt;a href=&quot;#&quot;&amp;gt;Tag 2&amp;lt;/a&amp;gt;, &amp;lt;a href=&quot;#&quot;&amp;gt;Tag 3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            &amp;lt;li class=&quot;share&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Share&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&amp;lt;!-- /.meta --&amp;gt;&#xA;        {{ entry.body.getPage(1) }}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- /.post-content --&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.post --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2017-06-23T17:12:21.807" Title="How do I add the Categories and tags related to each entry?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20578" PostTypeId="2" ParentId="20571" CreationDate="2017-05-24T01:37:14.357" Score="1" Body="&lt;p&gt;I haven't done this, but as a rule I try an mimic what Commerce actually does itself.  In this area I would be inclined to follow the code Commerce uses in it's own completed order handling, found in &lt;code&gt;public function orderCompleteHandler&lt;/code&gt; in &lt;code&gt;commerce/services/Commerce_VariantsService.php&lt;/code&gt; around line 290:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $purchasable = $lineItem-&amp;gt;getPurchasable();&#xA;&#xA;        // Only reduce variant stock if the variant exists in db&#xA;        if (!$purchasable)&#xA;        {&#xA;            continue;&#xA;        }&#xA;&#xA;        $clearCacheOfElementIds = [];&#xA;        if ($purchasable instanceof Commerce_VariantModel &amp;amp;&amp;amp; !$purchasable-&amp;gt;unlimitedStock)&#xA;        {&#xA;&#xA;            // Update the qty in the db&#xA;            craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update('commerce_variants',&#xA;                ['stock' =&amp;gt; new \CDbExpression('stock - :qty', [':qty' =&amp;gt; $lineItem-&amp;gt;qty])],&#xA;                'id = :variantId',&#xA;                [':variantId' =&amp;gt; $purchasable-&amp;gt;id]);&#xA;&#xA;            // Update the stock&#xA;            $purchasable-&amp;gt;stock = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;                -&amp;gt;select('stock')&#xA;                -&amp;gt;from('commerce_variants')&#xA;                -&amp;gt;where('id = :variantId', [':variantId' =&amp;gt; $purchasable-&amp;gt;id])&#xA;                -&amp;gt;queryScalar();&#xA;&#xA;            // Clear the cache since the stock changed&#xA;            $clearCacheOfElementIds[] = $purchasable-&amp;gt;id;&#xA;            $clearCacheOfElementIds[] = $purchasable-&amp;gt;product-&amp;gt;id;&#xA;        }&#xA;&#xA;        $clearCacheOfElementIds = array_unique($clearCacheOfElementIds);&#xA;        craft()-&amp;gt;templateCache-&amp;gt;deleteCachesByElementId($clearCacheOfElementIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-24T01:37:14.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20579" PostTypeId="2" ParentId="1711" CreationDate="2017-05-24T11:16:34.537" Score="0" Body="&lt;p&gt;&lt;strong&gt;You don't have to escape the ampersand for it to be valid html5&lt;/strong&gt;, and if it's appearing in content, not in a URL for example, then you really have nothing to worry about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This validates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;  &amp;lt;title&amp;gt;E&amp;amp;K&amp;lt;/title&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA; &amp;lt;h1&amp;gt;E&amp;amp;K&amp;lt;/h1&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FbyLA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FbyLA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-05-24T11:16:34.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20580" PostTypeId="1" CreationDate="2017-05-24T12:08:30.120" Score="1" ViewCount="112" Body="&lt;p&gt;I have a strange issue, I can't upload files to the server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error message is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error uploading the file: The folder craft/storage/runtime/assets/tempuploads/user_7/field_101 does not exist&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stranger thing is that another person working on the same project, with the same rights as me (admin) can perfectly upload files. &#xA;Once he does that, I can upload files to that same location too&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no folder called &quot;user_7&quot; in tempuploads. Just field_52, field_54, etc.&lt;/p&gt;&#xA;" OwnerUserId="6015" LastActivityDate="2017-05-24T12:08:30.120" Title="Cannot upload files to server" Tags="&lt;craft-pro&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20581" PostTypeId="1" CreationDate="2017-05-24T15:58:21.927" Score="3" ViewCount="642" Body="&lt;p&gt;I am currently setting up routes for a one-page application. As soon as a Query Parameter is introduced, the route fails. The route &quot;test&quot; replaces &quot;my-av1&quot; in the following photos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation in Craft does not describe how Query Parameters are handled. How do I proceed from here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k7whh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k7whh.png&quot; alt=&quot;Routes should work as described – but as soon a Query Parameter is introduced in the url, the route stops working.&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c61G1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c61G1.png&quot; alt=&quot;The route &amp;quot;test&amp;quot; replaces my-av1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6761" LastEditorUserId="6761" LastEditDate="2017-05-24T16:21:40.693" LastActivityDate="2017-05-26T10:27:45.633" Title="How do you handle routes in CP with Query Parameters?" Tags="&lt;control-panel&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20582" PostTypeId="2" ParentId="20577" CreationDate="2017-05-24T16:13:13.377" Score="1" Body="&lt;p&gt;Supposing your categories and tags fields are named, respectively, &lt;code&gt;newsCategories&lt;/code&gt; and &lt;code&gt;newsTags&lt;/code&gt;, you could do the following for the categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.newsCategories %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for the tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in entry.newsTags %}&#xA;    &amp;lt;a href=&quot;{{ tag.url }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;    {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is untested, but I think this should more or less do what you want to achieve.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2017-05-24T16:13:13.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20583" PostTypeId="2" ParentId="20581" CreationDate="2017-05-24T17:31:51.840" Score="2" Body="&lt;p&gt;Routes can't include query strings. A route is a path to a template file (or a controller action, if you've written a custom plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can retrieve a query string value from within a template using the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getParam&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.request.getParam&lt;/code&gt; method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set token = craft.request.getParam('token') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Following the conversation in the comments, here is an example of this working with a standard Craft route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My example route &lt;code&gt;/querystring/test&lt;/code&gt; points to the template &lt;code&gt;_views/querystring-test.twig&lt;/code&gt;, which contains the following example code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Query String Test&amp;lt;/h1&amp;gt;&#xA;&#xA;{% if craft.request.getParam('example') %}&#xA;    &amp;lt;p&amp;gt;The query string value for &amp;lt;code&amp;gt;example&amp;lt;/code&amp;gt; is &quot;{{ craft.request.getParam('example') }}&quot;,&amp;lt;/p&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;There is no query string parameter.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of the page &lt;em&gt;without&lt;/em&gt; a query string:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JLS2Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JLS2Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is a screenshot of the page &lt;em&gt;with&lt;/em&gt; a query string:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PjFZB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PjFZB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2017-05-26T10:27:45.633" LastActivityDate="2017-05-26T10:27:45.633" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20584" PostTypeId="1" AcceptedAnswerId="20613" CreationDate="2017-05-24T19:04:19.503" Score="0" ViewCount="181" Body="&lt;p&gt;I have matrix field set up, is that possible to output Name in Field Settings (refer to the handle: aggressiveBehavior)? Thanks&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0GWyg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0GWyg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-05-27T21:32:32.063" Title="How to output Name in Matrix entries" Tags="&lt;matrix&gt;&lt;output&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20585" PostTypeId="2" ParentId="20584" CreationDate="2017-05-24T19:28:38.680" Score="1" Body="&lt;p&gt;I believe that it is not possible looking at the &lt;a href=&quot;https://craftcms.com/docs/templating/matrixblockmodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix Block Model Docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would usually do, instead of having the front end facing title as the Field Name, is keep the Field name solely for the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example be (for a front end form)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;{{ 'Is your pet ever aggressive to strangers?' | t }}&amp;lt;/label&amp;gt;&#xA;{% for option in matrixBlock.aggressiveBehavior.options %}&#xA;&amp;lt;input type=&quot;radio&quot; name=&quot;aggressiveBehavior&quot; value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6755" LastEditorUserId="6755" LastEditDate="2017-05-24T19:41:16.257" LastActivityDate="2017-05-24T19:41:16.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20586" PostTypeId="1" AcceptedAnswerId="20590" CreationDate="2017-05-24T22:51:37.417" Score="1" ViewCount="492" Body="&lt;p&gt;Is there a Craft equivalent of this type of marketing automation?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;lead scoring &lt;/li&gt;&#xA;&lt;li&gt;personalisation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For example (4 min): &lt;a href=&quot;https://www.youtube.com/watch?v=Ck9ywjBTEGM&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=Ck9ywjBTEGM&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any plugin or external service that can be used with Craft to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="567" LastActivityDate="2017-05-25T14:03:12.027" Title="Is it possible to achieve lead scoring, personalisation / marketing automation using Craft?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20587" PostTypeId="1" AcceptedAnswerId="20835" CreationDate="2017-05-25T04:09:32.090" Score="2" ViewCount="173" Body="&lt;p&gt;I'm wanting to do two things &lt;a href=&quot;https://github.com/craftcms/store-hours&quot; rel=&quot;nofollow noreferrer&quot;&gt;with this great plugin&lt;/a&gt;, but am having a bit of a mind-melt...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I'd like to show the current state; e.g. Closing soon; Open now; Closed; Opening Soon&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I'd like to show the current day highlight:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sunday:    11:00 AM - 05:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Monday:    10:00 AM - 08:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tuesday:   10:00 AM - 08:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wednesday: 10:00 AM - 08:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thursday:  10:00 AM - 08:00 PM&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Friday:    10:00 AM - 08:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saturday:  10:00 AM - 07:00 PM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5215" LastEditorUserId="5215" LastEditDate="2017-05-26T00:16:50.077" LastActivityDate="2017-06-14T04:44:36.443" Title="Store Hours: show current open/closed state" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20590" PostTypeId="2" ParentId="20586" CreationDate="2017-05-25T14:03:12.027" Score="2" Body="&lt;p&gt;There are several ways to do this. The best way will likely depend on your situation. This type of functionality will also require some amount of custom development and implementation time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Services like &lt;a href=&quot;https://www.intercom.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Intercom&lt;/a&gt; can be integrated into Craft. You would manage marketing automation via Intercom and the custom development necessary would be to tie in the actions of your users on your Craft site with Intercom so you had the data you need to communicate how you wish. Intercom can be integrated into login processes, track user actions, and capture data when users submit Forms (plugins like &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt; and Solspace &lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform&lt;/a&gt; are both capable of being customized to integrate with third-party services).&lt;/li&gt;&#xA;&lt;li&gt;For more generic data capture, &lt;a href=&quot;https://mixpanel.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mixpanel&lt;/a&gt; can capture a lot of data about your customers. Mixpanel is more of a data analytics platform, so using a service like this will require that you have a larger budget to build out your own marketing automation processes around the data you gather.&lt;/li&gt;&#xA;&lt;li&gt;For additional control over your transactional email in Craft, &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt; can help with dynamic personalization of your email notifications, integration with custom events, and targeting specific lists of users.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In all of these cases, you will want to develop a clear plan around your requirements and budget time for customization to integrate the plugins and services into your sites workflows.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-05-25T14:03:12.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20591" PostTypeId="2" ParentId="20566" CreationDate="2017-05-25T14:31:28.473" Score="2" Body="&lt;p&gt;I think something like this should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# First get all the stats #}&#xA;{% set stats = craft.entries.section('statistics') %}&#xA;&#xA;{# iterate over those stat in a random order %}&#xA;{% for stat in stats.order('RAND()') %}&#xA;&#xA;    {% if stat.image | length %}&#xA;&#xA;        {% set image = stat.image.first %}&#xA;&#xA;    {% else %}&#xA;&#xA;        {# If there's no image, query for a random stat, excluding those without images #}&#xA;        {% set randomStat = stats.image(':notempty:').limit(1).order('RAND()') %}&#xA;        {% set image = randomStat.first.image.first %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2307" LastEditorUserId="2307" LastEditDate="2017-06-07T00:51:44.500" LastActivityDate="2017-06-07T00:51:44.500" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20592" PostTypeId="1" AcceptedAnswerId="20609" CreationDate="2017-05-25T16:00:16.570" Score="1" ViewCount="36" Body="&lt;p&gt;I have created a contact form inside a single entry type 'contact' for front end submissions.&#xA;This lets me display editing options for title and body and display the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When submitting the form, the entry object ( eg entry.title ) disappears and no title or body  content is shown - just the form with its corresponding errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So submitting it seems to lose the entry - is this because it is returning the saved entry model and not the single that it is on? &lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-05-27T05:25:45.173" Title="Single type for entry submission on error loses entry object" Tags="&lt;saveentry&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20594" PostTypeId="1" AcceptedAnswerId="20604" CreationDate="2017-05-26T03:05:57.680" Score="4" ViewCount="187" Body="&lt;p&gt;I'm working on a Dashboard widget from which users can submit entries for review from a Garnish HUD, like so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/seifg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/seifg.png&quot; alt=&quot;Garnish HUD without a footer.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've started by placing a hidden form next to each little &lt;em&gt;Submit&lt;/em&gt; button... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; class=&quot;approval-request-form hidden&quot; action=&quot;/actions/plugin/submitPost&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ element.id }}&quot;&amp;gt;&#xA;    {{ forms.textareaField({&#xA;        name: 'notes',&#xA;        label: 'Review Note',&#xA;        instructions: 'Add a note for the person reviewing your work.',&#xA;        maxlength: 140&#xA;    }) }}&#xA;&#xA;    &amp;lt;div class=&quot;buttons right&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;btn cancel&quot;&amp;gt;Cancel&amp;lt;/div&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;Submit for Review&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once that little button is clicked, I clone the form into a new Garnish HUD with delightful ease:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(function(){&#xA;    $('.request-approval').click(function(e){&#xA;        e.preventDefault();&#xA;        var $form = $(e.target).siblings('.approval-request-form').first().clone().removeClass('hidden');&#xA;        var hud = new Garnish.HUD(e.target, $form);&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great! I can post to my controller and all is well. Moments later, it occurs to me that I need some field validation and that it'd be nice to use a HUD footer (with its gray backdrop) and hook up my cancel button...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6BMKR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6BMKR.png&quot; alt=&quot;The new goal: Garnish HUD with footer.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrap my form's buttons in &lt;code&gt;class=&quot;hud-footer&quot;&lt;/code&gt;, which applies exactly the style I want...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; class=&quot;approval-request-form hidden&quot; action=&quot;/actions/plugin/submitPost&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ element.id }}&quot;&amp;gt;&#xA;    {{ forms.textareaField({&#xA;        name: 'notes',&#xA;        label: 'Review Note',&#xA;        instructions: 'Add a note for the person reviewing your work.',&#xA;        maxlength: 140&#xA;    }) }}&#xA;    &amp;lt;div class=&quot;hud-footer&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;buttons right&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;btn cancel&quot;&amp;gt;Cancel&amp;lt;/div&amp;gt;&#xA;            &amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;Submit for Review&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is where the pain starts, because my submit button looks fantastic yet does nothing. After a while I realize it's because &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/develop/src/HUD.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;HUD.js&lt;/a&gt; redraws things and pulls the action buttons out of my &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element where they &lt;em&gt;would have&lt;/em&gt; known what to do...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;hud has-footer&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;tip tip-top&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;form class=&quot;body&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;main-container&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;main&quot;&amp;gt;&#xA;                &amp;lt;form method=&quot;post&quot; class=&quot;approval-request-form last&quot; action=&quot;/actions/plugin/submitPost&quot;&amp;gt;&#xA;                ... my form elements without .buttons ...&#xA;                &amp;lt;/form&amp;gt;&#xA;                &amp;lt;object tabindex=&quot;-1&quot; type=&quot;text/html&quot; data=&quot;about:blank&quot; style=&quot;display: block; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border: none; padding: 0px; margin: 0px; opacity: 0; z-index: -1000; pointer-events: none;&quot;&amp;gt;&amp;lt;/object&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;    &amp;lt;div class=&quot;hud-footer&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;buttons right last&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;btn cancel&quot; tabindex=&quot;0&quot;&amp;gt;Cancel&amp;lt;/div&amp;gt;&#xA;            &amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;Submit for Review&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After some trial and error, I wind up sneaking a hidden submit button into my form and &quot;clicking&quot; it with JavaScript via the HUD's &lt;code&gt;onSubmit&lt;/code&gt; property...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(function(){&#xA;    $('.request-approval').click(function(e){&#xA;        e.preventDefault();&#xA;        var $form = $(e.target).siblings('.approval-request-form').first().clone().removeClass('hidden');&#xA;        var hud = new Garnish.HUD(e.target, $form, { closeBtn: $form.find('.cancel'), onSubmit: submitForm });&#xA;&#xA;        function checkForm() {&#xA;            $form.find('.submit').trigger('click');&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That successfully reaches into my form and submits it (and allows me to add some validation logic later), but &lt;strong&gt;how can I use the HUD's footer button to submit the form in &lt;code&gt;.main&lt;/code&gt; without the questionable hackery of triggering a click on a hidden button?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect I'm either missing something or not thinking quite like the Garnish HUD wants me to. The closest example I've found is the element editor you'd see working with Assets, which serializes and posts its form data via AJAX. I could mimic that instead, but I'd rob myself and our fair Stack Exchange of a learning opportunity.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-26T06:12:21.823" LastActivityDate="2017-05-26T22:18:04.797" Title="How can I submit a form from a Garnish HUD footer?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;garnish&gt;&lt;dashboard-widgets&gt;&lt;hud&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20595" PostTypeId="2" ParentId="20575" CreationDate="2017-05-26T04:12:52.460" Score="5" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userGroups = craft.userGroups.getAllGroups() %}&#xA;&#xA;{% if userGroups|length %}&#xA;    {% for userGroup in userGroups %}&#xA;        &amp;lt;h2&amp;gt;&#xA;            {{ userGroup.name }}&#xA;        &amp;lt;/h2&amp;gt;&#xA;&#xA;        {% set users = craft.users.group(userGroup.handle) %}&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;        {% for user in users %}&#xA;            &amp;lt;li&amp;gt;&#xA;                {{ user.username }}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="5072" LastEditDate="2018-08-13T22:29:46.843" LastActivityDate="2018-08-13T22:29:46.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20596" PostTypeId="1" CreationDate="2017-05-26T08:48:11.053" Score="1" ViewCount="294" Body="&lt;p&gt;I've created a form using amforms to ask some info about the visitor when he request a document.&lt;br&gt;&#xA;I want to pass the name of the requested document in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I created the field &lt;code&gt;nomDocumentEfficy&lt;/code&gt; and attached it to my form but I cannot get the value in my submitted forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my form :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-askemail contact&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    {# This should always be here! #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;/amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;&#xA;    {# Insert your form's handle. #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&#xA;    {# This will namespace your inputs (for IDs and such), but it's not required though #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;namespace&quot; value=&quot;{{ form.getNamespace() }}&quot;&amp;gt;&#xA;&#xA;    {# Optional: Redirect URL. Will redirect to current page by default. #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.getParam('redirect') }}&quot;&amp;gt;&#xA;&#xA;    {# Optional: Anti-spam protection. #}&#xA;    {{ craft.amForms.displayAntispam() }}&#xA;&#xA;    {# Optional: Google reCAPTCHA protection. #}&#xA;    {{ craft.amForms.displayRecaptcha() }}&#xA;&#xA;    {# Place the HTML of your fields here #}&#xA;    {{ form.displayField('email') }}&#xA;    {{ form.displayField('societe') }}&#xA;    {{ form.displayField('typeEtablissementAskEmailForm') }}&#xA;    {{ form.displayField('numeroDepartement') }}&#xA;&#xA;    {# Hidden input field with my value #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;nomDocumentEfficy&quot; value=&quot;my_value&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3383" LastActivityDate="2017-09-12T21:21:54.957" Title="Passing value in form with amforms plugin" Tags="&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20597" PostTypeId="2" ParentId="20573" CreationDate="2017-05-26T10:55:58.097" Score="4" Body="&lt;p&gt;You'll need to create a separate plugin, which adds the categories to the sitemap in response to the &lt;code&gt;renderSitemap&lt;/code&gt; hook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what &lt;a href=&quot;https://craftcms.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;noreferrer&quot;&gt;your main plugin file&lt;/a&gt; will look like. This should get you 90% of the way there; the rest is just organising a few files and folders, which is well-covered by &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;noreferrer&quot;&gt;the official documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * SitemapCategories&#xA; *&#xA; * @package Craft&#xA; */&#xA;&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * The main SitemapCategories plugin file.&#xA; */&#xA;class SitemapCategoriesPlugin extends BasePlugin&#xA;{&#xA;    /**&#xA;     * Returns the plugin name.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Sitemap Categories');&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the plugin description.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getDescription()&#xA;    {&#xA;        return Craft::t('Adds categories to the sitemap.');&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the plugin’s version number.&#xA;     *&#xA;     * @return string The plugin’s version number.&#xA;     */&#xA;    public function getVersion()&#xA;    {&#xA;        return '0.1.0';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the plugin developer’s name.&#xA;     *&#xA;     * @return string The plugin developer’s name.&#xA;     */&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'Your name here';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns the plugin developer’s URL.&#xA;     *&#xA;     * @return string The plugin developer’s URL.&#xA;     */&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'https://yourwebsite.com';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns a faux schema version, so Craft doesn't attempt to run database&#xA;     * updates when the plugin version changes.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getSchemaVersion()&#xA;    {&#xA;        return '0.0.0';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns a boolean indicating whether the plugin has settings.&#xA;     *&#xA;     * @return bool&#xA;     */&#xA;    public function hasSettings()&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns a boolean indicating whether the plugin has it's own control&#xA;     * panel section.&#xA;     *&#xA;     * @return bool&#xA;     */&#xA;    public function hasCpSection()&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    /**&#xA;     * Adds all categories to the sitemap.&#xA;     */&#xA;    public function renderSitemap()&#xA;    {&#xA;        $groups = craft()-&amp;gt;categories-&amp;gt;getAllGroups();&#xA;&#xA;        foreach ($groups as $group) {&#xA;            craft()-&amp;gt;sitemap-&amp;gt;addCategoryGroup($group);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-05-26T10:55:58.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20598" PostTypeId="1" AcceptedAnswerId="20605" CreationDate="2017-05-26T16:45:41.227" Score="2" ViewCount="484" Body="&lt;p&gt;I need to import some data into a &lt;strong&gt;table&lt;/strong&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to format the data in my original JSON feed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    &quot;first value&quot;,&#xA;    &quot;second value&quot;,&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    {&quot;col1&quot;: &quot;first value&quot;},&#xA;    {&quot;col2&quot;: &quot;second value&quot;},&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But neither of those JSON formats seems to be importing the data properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How should I format my data in JSON, so that it may be imported into a table field?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MORE INFORMATION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/content-mapping/field-types#table&quot; rel=&quot;nofollow noreferrer&quot;&gt;these docs&lt;/a&gt;, but apparently I'm still doing something wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current JSON looks like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;altTitles&quot;: [&#xA;    {&#xA;        &quot;title&quot;: &quot;Morke&quot;&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;altTitles&lt;/code&gt; is my table field, and &lt;code&gt;title&lt;/code&gt; is the only column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I've properly mapped the field...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xvm8u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xvm8u.png&quot; alt=&quot;mapping&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet for whatever reason, the table fields are not populating...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HGrH9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HGrH9.png&quot; alt=&quot;empty table&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-05-26T20:47:18.093" LastActivityDate="2017-05-26T23:22:33.743" Title="Feed Me: How to format JSON for a table field?" Tags="&lt;json&gt;&lt;table-field&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20599" PostTypeId="1" CreationDate="2017-05-26T16:51:13.633" Score="1" ViewCount="190" Body="&lt;p&gt;I created a matrix with 1 type, 3 fields for user profile. I use front-end to upload file to documentUpload field. But I got PHP warning: &lt;code&gt;array_merge(): Argument #1 is not an array message&lt;/code&gt;. I Google it and see &lt;a href=&quot;https://github.com/am-impact/amforms/issues/29&quot; rel=&quot;nofollow noreferrer&quot;&gt;this issue&lt;/a&gt;. I did try adding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (empty($value)) {&#xA;    $value = array();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I still got the same issue. Not sure how I could resolve the issue. I see my file is uploaded to AWS S3. Looks it has issue to save it in Craft. Does anyone know how to solve it? Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code to upload file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA; {{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[petRecords][new{{ next }}][type]&quot; value=&quot;records&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[petRecords][new{{ next }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;file&quot; name=&quot;fields[petRecords][new{{ next }}][fields][documentUpload]&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[petRecords][new{{ next }}][fields][description]&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[petRecords][new{{ next }}][fields][petIdNumber]&quot; /&amp;gt;&#xA;&amp;lt;input class=&quot;btn btn-primary btn-block btn-social&quot; type=&quot;submit&quot; value=&quot;continue&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SACb5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SACb5.png&quot; alt=&quot;configuration&quot;&gt;&lt;/a&gt;&#xA;My Craft CMS version is 2.6.2980&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c7QwI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c7QwI.png&quot; alt=&quot;Error message&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2017-05-26T17:25:43.343" LastActivityDate="2017-05-26T17:25:43.343" Title="Frontend upload asset to Matrix" Tags="&lt;matrix&gt;&lt;php&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20600" PostTypeId="1" CreationDate="2017-05-26T17:29:08.410" Score="4" ViewCount="1550" Body="&lt;p&gt;Is there a suitable way to use renderTemplate or another method to output a twig template that is plain text?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with a plugin that has an email template for both HTML and plain text, previewing the HTML version is simple, doing the same with the plain text works but the visual preview within Craft shows the content without any of the spacing or line breaks because its rendering as HTML, viewing the source the correct output with the line breaks and spacing etc is shown. I was wondering if there was a way to output the plain text template in a similar way.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2017-05-26T20:39:27.583" LastActivityDate="2017-05-27T20:34:19.083" Title="Using renderTemplate for a plain text twig template" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20601" PostTypeId="1" AcceptedAnswerId="20602" CreationDate="2017-05-26T18:59:40.003" Score="0" ViewCount="145" Body="&lt;p&gt;I have two modals with embedded video on this page…&#xA;&lt;a href=&quot;http://staging.wenzelspine.com/products&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://staging.wenzelspine.com/products&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything was working fine until I started converting the HTML to Craft templates, but now they are not playing the correct videos… depending on which you click first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you load the page and click Play Video under VariLift-LX it is correct, but if you then click Play Video under VariLift-C it plays the VariLift-LX video. If you reload the page and click for VariLift-C first, it plays the correct video.&lt;/p&gt;&#xA;" OwnerUserId="3793" LastEditorUserId="22" LastEditDate="2017-05-26T19:46:12.380" LastActivityDate="2017-05-26T20:12:45.700" Title="YouTube embeds playing wrong videos" Tags="&lt;templating&gt;&lt;embed&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20602" PostTypeId="2" ParentId="20601" CreationDate="2017-05-26T19:28:38.190" Score="2" Body="&lt;p&gt;Don't have enough reps to comment - but it does not seem to be a Craft issue - but rather a Bootstrap modal issue. It seems like when you open the video, it updates the id of the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on past experiences - I would look into destroying the modal instance and reloading new content in one modal, as opposed to having multiple modal for multiple content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Just looked a little more into your code and how it's reacting - it seems like on modal close (of either modals), it updates the value of the video embed code to the varilift-lx video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;^ Caused by scripts.js - Line 2172 - 2174&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.modal').on('hidden.bs.modal', function () {&#xA;    $('.video-container iframe').attr(&quot;src&quot;, $(&quot;.video-container iframe&quot;).attr(&quot;src&quot;));&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is grabing the first video container and updating it to that value.&lt;/p&gt;&#xA;" OwnerUserId="6755" LastEditorUserId="6755" LastEditDate="2017-05-26T20:12:45.700" LastActivityDate="2017-05-26T20:12:45.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20604" PostTypeId="2" ParentId="20594" CreationDate="2017-05-26T22:12:21.000" Score="3" Body="&lt;p&gt;Since the shuffled markup is the root of the problem, one might follow examples from the Craft control panel source that serialize the form's data and submit via AJAX (and often &lt;code&gt;$.proxy()&lt;/code&gt; to help with scope).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a lot of work, however, for minor stylistic gain. &lt;strong&gt;If the problem is limited to presentation, the solution should be too.&lt;/strong&gt; @narration_sd helped me see how fragile the jQuery hack is compared to a CSS hack, and so in lieu of The Perfect Answer I've created a &lt;code&gt;pseudo-hud-footer&lt;/code&gt; class to wrap my action buttons. It's inelegant, looks identical, and it's less risky than my previous workaround:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.approval-request-form .field { margin-top: 0; margin-bottom: 0; }&#xA;.pseudo-hud-footer {&#xA;    position: relative;&#xA;    left: -24px;&#xA;    bottom: -24px;&#xA;    border-radius: 0 0 4px 4px;&#xA;    padding: 6px 24px 10px 24px;&#xA;    width: 100%;&#xA;    height: 35px;&#xA;    background-image: -webkit-linear-gradient(#ecedef, #e9eaec);&#xA;    background-image: -moz-linear-gradient(#ecedef, #e9eaec);&#xA;    background-image: -ms-linear-gradient(#ecedef, #e9eaec);&#xA;    background-image: -o-linear-gradient(#ecedef, #e9eaec);&#xA;    background-image: linear-gradient(#ecedef, #e9eaec);&#xA;    -webkit-box-shadow: inset 0 2px 1px -2px rgba(0, 0, 0, 0.2);&#xA;    -moz-box-shadow: inset 0 2px 1px -2px rgba(0, 0, 0, 0.2);&#xA;    box-shadow: inset 0 2px 1px -2px rgba(0, 0, 0, 0.2);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-05-26T22:18:04.797" LastActivityDate="2017-05-26T22:18:04.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20605" PostTypeId="2" ParentId="20598" CreationDate="2017-05-26T23:22:33.743" Score="3" Body="&lt;p&gt;You can do this a number of ways, and essentially just need an array-like structure to represent the rows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;Table&quot;: [&#xA;  {&#xA;    &quot;one&quot;: &quot;Option1&quot;,&#xA;    &quot;two&quot;: &quot;Option2&quot;&#xA;  },&#xA;  {&#xA;    &quot;one&quot;: &quot;Option3&quot;,&#xA;    &quot;two&quot;: &quot;Option4&quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This issue might be related to your feed however. In the dropdown, you have &lt;code&gt;&amp;lt;altTitles&amp;gt; eg:&lt;/code&gt; - there should be a value from your feed in there. According to your example, you should also be mapping to &lt;code&gt;altTitles/title&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My example above shows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uWF10.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uWF10.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-05-26T23:22:33.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20606" PostTypeId="1" CreationDate="2017-05-27T02:39:11.510" Score="2" ViewCount="2277" Body="&lt;p&gt;I moved a site from staging to live. Prior to moving, I logged in to the Craft admin and cleared the caches. I copied the db to the new one and moved the folders like so… &lt;/p&gt;&#xA;&#xA;&lt;p&gt;from…&lt;br&gt;&#xA;&lt;code&gt;home/subdomains/craft&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;home/subdomains/staging&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to…&lt;br&gt;&#xA;&lt;code&gt;home/craft&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;home/public_html&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m getting this in the server log…&lt;br&gt;&#xA;&lt;code&gt;[28-May-2017 20:01:30 UTC] PHP Fatal error:  Class 'Craft\DbCommand' not found in /home/wenzelspine/craft/app/etc/db/DbConnection.php on line 28&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this in storage/runtime/logs…&lt;br&gt;&#xA;&lt;code&gt;2017/05/28 21:33:05 [error] [php] Declaration of Craft\DbCommand::addForeignKey() should be compatible with CDbCommand::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = NULL, $update = NULL) (/home/wenzelspine/craft/app/etc/db/DbCommand.php:15)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2017/05/28 21:33:05 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3793" LastEditorUserId="3793" LastEditDate="2017-05-28T23:23:57.367" LastActivityDate="2017-05-29T01:12:10.713" Title="HTTP ERROR 500 after move to live" Tags="&lt;error&gt;&lt;server&gt;&lt;migration&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20607" PostTypeId="2" ParentId="20606" CreationDate="2017-05-27T03:14:22.483" Score="2" Body="&lt;p&gt;Howard, craft itself doesn't break like that, in my experience.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;set devMode true in config/general.php&lt;/li&gt;&#xA;&lt;li&gt;try the url again, then look at the logs for craft and php, in craft/storage/runtime/logs&lt;/li&gt;&#xA;&lt;li&gt;if you don't see anything, look at the php log on the server..&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The clue should be there.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2017-05-27T03:24:47.900" LastActivityDate="2017-05-27T03:24:47.900" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20608" PostTypeId="2" ParentId="20600" CreationDate="2017-05-27T05:03:56.483" Score="2" Body="&lt;p&gt;This is isn't an elegant way of doing it, but essentially as per Stephen's suggestion, if you can wrap the plain text output in a &lt;code&gt;pre&lt;/code&gt; block, the preview will visually render the spacing and line breaks in HTML mode in the same way it would be received via email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do this in the actionPreview function itself, or alternatively in the template use a condition that would only be true when the email template is being accessed in Craft for this purpose. I chose to use &lt;code&gt;craft.request&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getLastSegment == 'emailPreviewPlain' %}&#xA;    {{ '&amp;lt;pre&amp;gt;' | raw }}&#xA;{% endif %}&#xA;&#xA;{# Plain text template content goes here #}&#xA;&#xA;{% if craft.request.getLastSegment == 'emailPreviewPlain' %}&#xA;    {{ '&amp;lt;/pre&amp;gt;' | raw }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This then wraps the entire twig template in &lt;code&gt;pre&lt;/code&gt; tags when being previewed in Craft, but otherwise should not render when sent as an email.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2017-05-27T05:03:56.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20609" PostTypeId="2" ParentId="20592" CreationDate="2017-05-27T05:25:45.173" Score="2" Body="&lt;p&gt;From &lt;a href=&quot;https://github.com/pixelandtonic/GuestEntries/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;the README&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If there is a validation error on the entry, then the page will be reloaded with an &lt;code&gt;entry&lt;/code&gt; variable available to it...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can override the variable name by setting the &lt;code&gt;entryVariable&lt;/code&gt; config setting, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// File: craft/config/guestentries.php&#xA;&#xA;return [&#xA;    'entryVariable' =&amp;gt; 'guestEntry',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you've done that, the page entry model will be available as &lt;code&gt;entry&lt;/code&gt;, and the &quot;guest entries&quot; entry model (containing any validation errors) will be available as &lt;code&gt;guestEntry&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2017-05-27T05:25:45.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20610" PostTypeId="2" ParentId="20365" CreationDate="2017-05-27T13:50:23.187" Score="1" Body="&lt;p&gt;How do you render the cart? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;{{ item.price|commerceCurrency(cart.paymentCurrency,convert=true) }}&lt;/code&gt; instead of &lt;code&gt;{{ item.price|commerceCurrency(cart.currency) }}&lt;/code&gt; works for me.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2017-05-27T13:50:23.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20611" PostTypeId="2" ParentId="3000" CreationDate="2017-05-27T20:19:16.857" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://www.putyourlightson.net/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Count&lt;/a&gt; plugin will do this for you (previously the Counter plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can loop through the most read articles as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countedEntries = craft.entryCount.entries %}&#xA;&#xA;{% for entry in countedEntries %}&#xA;    {% set count = craft.entryCount.count(entry.id) %}&#xA;    {{ entry.title }} ({{ count }} views)&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2017-05-27T20:19:16.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20612" PostTypeId="2" ParentId="20600" CreationDate="2017-05-27T20:34:19.083" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#render-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;TemplatesService render() method&lt;/a&gt; to fetch the template and then wrap it in &lt;code&gt;pre&lt;/code&gt; tags before outputting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Wrap in pre tags&#xA;$output = '&amp;lt;pre&amp;gt;' . craft()-&amp;gt;templates('emailPreviewPlain') .'&amp;lt;/pre&amp;gt;';&#xA;&#xA;// Output it into a buffer       &#xA;ob_start();&#xA;echo $output;&#xA;&#xA;// End the request&#xA;craft()-&amp;gt;end();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2017-05-27T20:34:19.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20613" PostTypeId="2" ParentId="20584" CreationDate="2017-05-27T21:32:32.063" Score="1" Body="&lt;p&gt;If you must insist on using such a long field name rather than putting it in your twig template, then this code should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.fields.getFieldByHandle('fieldName') %}&#xA;&#xA;{% for blockType in field.getFieldType.getSettings.blockTypes %}&#xA;    {% if blockType == 'pet' %}&#xA;        {% for field in blockType.fields %}&#xA;            {% if field.handle == 'aggressiveBehavior' %}&#xA;                {{ field.name }}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2017-05-27T21:32:32.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20614" PostTypeId="1" AcceptedAnswerId="20615" CreationDate="2017-05-27T22:32:29.227" Score="1" ViewCount="384" Body="&lt;p&gt;How can I trigger an image transform in a Craft plugin?&lt;/p&gt;&#xA;" OwnerUserId="3383" LastEditorUserId="340" LastEditDate="2017-05-27T23:39:14.493" LastActivityDate="2017-05-27T23:39:14.493" Title="Image transform in a plugin" Tags="&lt;plugin-development&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20615" PostTypeId="2" ParentId="20614" CreationDate="2017-05-27T23:36:24.417" Score="3" Body="&lt;p&gt;Yes, it's possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It essentially works just like it does in twig...you just call &lt;code&gt;getURL&lt;/code&gt; with the valid name of a transform&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$criteria-&amp;gt;id = 1;&#xA;$asset = $criteria-&amp;gt;first();&#xA;&#xA;if ($asset)&#xA;{&#xA;    $url = $asset-&amp;gt;getUrl('myTransform');&#xA;}&#xA;&#xA;$imgUrl = $image-&amp;gt;getUrl('tranformHandle);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...as I understand it that triggers the  image to be transformed on-demand if the transform does not already exist.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-05-27T23:36:24.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20616" PostTypeId="1" CreationDate="2017-05-28T12:07:18.223" Score="2" ViewCount="869" Body="&lt;p&gt;Is there any way to include the JSON response from element API in a template. Let's take the following example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;/case-studies.json&lt;/em&gt; returns:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;    data: [&#xA;        {&#xA;            title: &quot;American Express&quot;,&#xA;            color: &quot;#0000ff&quot;,&#xA;            url: &quot;http://localhost:3340/index.php?p=case-studies/american-express&quot;&#xA;        },&#xA;        {&#xA;            title: &quot;Bosch&quot;,&#xA;            color: &quot;#ffffff&quot;,&#xA;            url: &quot;http://localhost:3340/index.php?p=case-studies/bosch&quot;&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to known if I can include this JSON object into my template &lt;em&gt;case-studies/index.html&lt;/em&gt;, so it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;        &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&#xA;    &amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;        &amp;lt;...&amp;gt;            &#xA;&#xA;        &amp;lt;script&amp;gt;&#xA;            window.data = [&#xA;                {&#xA;                    title: &quot;American Express&quot;,&#xA;                    color: &quot;#0000ff&quot;,&#xA;                    url: &quot;http://localhost:3340/index.php?p=case-studies/american-express&quot;&#xA;                }, {...}&#xA;            ];&#xA;        &amp;lt;/script&amp;gt;&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just wanna avoid the first ajax call when I load the page for the first time by including the data in the HTML body. Further on, I will use Ajax calls instead.&lt;/p&gt;&#xA;" OwnerUserId="6779" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:45.793" LastActivityDate="2018-05-08T22:48:35.903" Title="Element API + JSON data in template" Tags="&lt;templating&gt;&lt;plugin-elementapi&gt;&lt;ajax&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20617" PostTypeId="2" ParentId="20606" CreationDate="2017-05-28T20:06:38.123" Score="1" Body="&lt;p&gt;Howard, I'm posting another possibility here to be sure you'll be notified -- can edit it back into original answer or a comment later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It kind of dawned on me that when you produced the second installation, quite possibly you simply copied &lt;em&gt;everything&lt;/em&gt; over from the original. If so, you would have copied the cache content, as well as the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could account for what your logs say -- parts being missing apparently, as addressed still on the subdomain code tree -- as well as Craft mysteriously just not working. That's because the pre-complied php holds the old paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fix for this would be straightforward&#xA;- first, cp or sftp out any logs you think you'd want to keep:&#xA;- then, if on Craft 2, cd to craft/storage/runtime, then run rm -rf *&#xA;- similarly, if on Craft 3, cd to storage/runtime, then run rm -rf *&#xA;- pro tip: do be sure where you are carefully, before doing the rm -rf *&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this diagnosis is correct, and your config is ok, then Craft should just start up properly once this clearing is done.  Let us know...&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2017-05-28T20:06:38.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20618" PostTypeId="1" CreationDate="2017-05-28T22:51:33.570" Score="1" ViewCount="641" Body="&lt;p&gt;When you remove a field from Craft, the data itself doesn’t disappear. So removing i.e. an intro field from a section, if that intro field is still used in the template, that content will be output still on an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably this is intentional more than a bug so that Craft doesn’t have to go and re-save all of the entries in that section, which would probably cause the webserver to catch on fire (therefore I’m not going to write a plugin to hook into the save entry hook to clear it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to check in twig if a field is on a given section?&lt;/strong&gt; The “if x defined and x|length” check passes because this data exists against the entry, even if the fields isn’t on the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using a template for multiple sections that share a similar set of fields for a preview, and don’t want to replicate 99% identical templates.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-05-29T05:42:01.257" Title="How to check if a field exists on a section" Tags="&lt;templating&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20619" PostTypeId="2" ParentId="20618" CreationDate="2017-05-29T00:46:10.617" Score="1" Body="&lt;p&gt;I think you're running in to a caching issues here or you're not testing with &lt;code&gt;devMode&lt;/code&gt; turned on perhaps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just tested here and if I remove a field and reload an entry in devMode I immediately get an exception e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft\Commerce_ProductModel and its behaviors do not have a method or closure named &quot;unimformityMeasurement&quot;.&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, even with &lt;code&gt;devMode&lt;/code&gt; off I get a 500 server error with the same information, so I am thinking that you're very likely hitting a cached result that is preventing you from  seeing these errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In my experience you are correct the data is still in the database though).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-05-29T05:42:01.257" LastActivityDate="2017-05-29T05:42:01.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20620" PostTypeId="2" ParentId="20606" CreationDate="2017-05-29T01:12:10.713" Score="2" Body="&lt;p&gt;Solution: I'm still having trouble getting help from my host, but after trying a clean install of Craft at public_html and getting the same error, I went elsewhere and it worked flawlessly. Thanks for all your help. Sorry it was such a wild goose chase.&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2017-05-29T01:12:10.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20621" PostTypeId="2" ParentId="20616" CreationDate="2017-05-29T02:51:25.283" Score="2" Body="&lt;p&gt;I can't think of a clean way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Element API plugin currently will set JSON headers on the response and return the data JSON encoded, so it's not easy to directly embed in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few options I can think of would be to fork the plugin and add the ability to return JSON in the format a template can directly utilize.  Or you could have a wrapper plugin that made an AJAX call to the Element API endpoint, grabbed the response and massaged the data into a format your template could directly utilize.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-29T02:51:25.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20622" PostTypeId="1" CreationDate="2017-05-29T05:03:43.370" Score="1" ViewCount="452" Body="&lt;p&gt;I have a &lt;code&gt;superTable&lt;/code&gt; field that I am trying to re-populate on my front-end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working great, I am able to populate a drop-down, but can't seem to find the magic numbers to re-populate a textfield.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;{{ field.name }}&amp;lt;/label&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myField][fields][{{ field.handle }}]&quot; class=&quot;form-control&quot; value=&quot;{{ entry.myField[0].??? }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[myField][fields][{{ field.handle }}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, whatever I enter after that &lt;code&gt;.&lt;/code&gt; Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;{{ entry.myField[0].field.handle }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error that the model &quot;field doesn't exist&quot;. If could make &lt;code&gt;field.handle&lt;/code&gt; just be &quot;myField&quot; everything would be great. I can hard-code the field name and it works great. But, I need to be able to access the values within a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value=&quot;{{ entry.myField[0].field.handle }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is a plainTex field. This is the output I am trying to accomplish.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myField][fields][{{ field.handle }}]&quot; value=&quot;{{ entry.myField[0].field.handle }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-05-29T13:35:14.790" LastActivityDate="2017-05-29T21:04:54.363" Title="How can I output the value of a superTable field within a loop?" Tags="&lt;templating&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20623" PostTypeId="2" ParentId="20508" CreationDate="2017-05-29T05:25:53.210" Score="0" Body="&lt;p&gt;This is a truly tricky one. Let's restate the problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For each category in a tree list of categories: We want to display content from an element if the element is related to the category but not related to any of the category's children.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head, I can't think of a really performant way to do this... So, hopefully there aren't too many categories in your setup, and caching is key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we need to generate a recursive structure of categories:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group(...) %}&#xA;&#xA;{% nav category in categories %}&#xA;&#xA;    {% include '_elementsForThisCategory' with {category: category} only %}&#xA;&#xA;    {% ifchildren %}&#xA;        {% children %}&#xA;    {% endifchildren %}&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(You could easily use a macro in place of that &lt;code&gt;include&lt;/code&gt;. These days I prefer includes over macros for anything other than the very simplest use cases.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next (in the included template/macro), we need to create a list of elements that are related to the present category but not related to any of its children:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Query entries that are related to this category's children. #}&#xA;&#xA;{% set relatedToChildCats = craft.entries.relatedTo({&#xA;    targetElement: category.getChildren()&#xA;    field: 'yourMatrixField.yourCategoriesField'&#xA;}) %}&#xA;&#xA;{# Query entries that are related to this category,&#xA;   and exclude the entries that are related to this category's children. #}&#xA;&#xA;{% set theBuckStopsHere = craft.entries.relatedTo({&#xA;    targetElement: category&#xA;    field: 'yourMatrixField.yourCategoriesField'&#xA;}).id('not', relatedToChildCats.ids) %}&#xA;&#xA;{# Display the content however you want. #}&#xA;&#xA;{% for entry in theBuckStopsHere %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&amp;rarr; You probably noticed that my example uses &lt;em&gt;Entry&lt;/em&gt; elements, and your stated use case deals with &lt;em&gt;MatrixBlock&lt;/em&gt; elements. I wanted to give the example using purely out-of-the-box-friendly code, and unfortunately Craft 2 doesn't provide a template method for querying Matrix blocks... But luckily, our good friend &lt;a href=&quot;http://gotolow.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Low&lt;/a&gt; wrote a nice plugin (&lt;a href=&quot;https://github.com/low/lowblocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Low Blocks&lt;/a&gt;), which adds a handy &lt;code&gt;craft.lowBlocks&lt;/code&gt; template variable.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2017-05-29T05:25:53.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20625" PostTypeId="1" CreationDate="2017-05-29T09:48:13.980" Score="1" ViewCount="1078" Body="&lt;p&gt;Why do I get the error when I try to install Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer create-project craftcms/craft Documents/Development/Project -s beta&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[InvalidArgumentException]                                                                                           &#xA;Could not find package craftcms/craft with stability stable &#xA;in a version installable using your PHP version 5.6.30.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am running PHP 7.1.&lt;/p&gt;&#xA;" OwnerUserId="6781" LastEditorUserId="125" LastEditDate="2017-05-31T09:45:39.577" LastActivityDate="2017-05-31T09:45:39.577" Title="PHP version issue when installing Craft 3 using Composer" Tags="&lt;installation&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20626" PostTypeId="2" ParentId="20625" CreationDate="2017-05-29T11:18:25.873" Score="3" Body="&lt;p&gt;You are running PHP 5.6.30 on the command line (read the error message), which you can also verify with &lt;code&gt;php -v&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To swap the PHP, you should add the path to your preferred PHP executable to your shell’s configuration file (e.g. ~/.bash_profile, ~/.bashrc, ~/.zshrc).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;export PATH=&quot;/Applications/MAMP/bin/php/php7.1.1/bin:$PATH&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option is to ignore the PHP requirement using &lt;a href=&quot;https://getcomposer.org/doc/03-cli.md#create-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;--ignore-platform-reqs&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer create-project craftcms/craft . -s beta --ignore-platform-reqs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then &lt;a href=&quot;https://getcomposer.org/doc/06-config.md#platform&quot; rel=&quot;nofollow noreferrer&quot;&gt;fake the PHP version&lt;/a&gt; in the project’s composer.json for later updates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;config&quot;: {&#xA;  &quot;optimize-autoloader&quot;: true,&#xA;  &quot;platform&quot;: {&quot;php&quot;: &quot;7.0&quot;}&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-05-31T09:36:28.433" LastActivityDate="2017-05-31T09:36:28.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20627" PostTypeId="1" CreationDate="2017-05-29T11:23:38.440" Score="1" ViewCount="108" Body="&lt;p&gt;I'm building a language switcher for a clients website. The website consists of multiple regions which can have multiple locales. As regions aren't supported yet in Craft 2, I've worked my way around that in a variety of ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my products section, I have a category group of product categories. The top level of each tree within that group is the region a product belongs to. So you can have something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;US&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category US A&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category US A 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Europe&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Europe A&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category Europe A 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So when selecting category 'US A 1' I know the region this product needs to be shown in is US and I have the correct category too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when switching languages, I check if the region also changes. If so, I have the ID of the new region (which is the first level category of a tree within that group). So, I check if this entry exists related to that category ID. &#xA;If so &lt;strong&gt;I need to find the exact same subcategory in the Europe tree as was selected in the US tree&lt;/strong&gt; (so find 'Europe A 1') and check if the entry is also related to that category. If so, send the user to that URL. &lt;strong&gt;Problem is I don't know how to do that last step as all I'm getting is an array of categories without any hierachy.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important: I need this in a plugin in PhP so no Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only link between for example: 'US A 1' and 'Europe A 1' will be the slug. I'll have to enforce the client to make sure similar categories share the same slug. (Thanks to carlcs to ask this important info I forgot to mention :)&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-05-29T11:43:02.610" LastActivityDate="2017-05-29T13:04:20.677" Title="Finding corresponding category in different subtrees of a category group" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;php&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20628" PostTypeId="2" ParentId="20627" CreationDate="2017-05-29T12:03:28.623" Score="1" Body="&lt;p&gt;I would just split that category group, if possible, and offer one group for the region and one for the “A1” type of categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is out of question, you need to find a way to link your categories. Give them the same slug or use another field to make the connection (e.g. a Categories field) and use the corresponding criteria param to filter for the entry in the new locale.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$currentLocaleCategory = $entry-&amp;gt;myCategoriesField-&amp;gt;last();&#xA;&#xA;if ($currentLocaleCategory) {&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;    $criteria-&amp;gt;locale = $locale;&#xA;    $criteria-&amp;gt;descendantOf = $descendantOfParam;&#xA;    $criteria-&amp;gt;slug = $currentLocaleCategory-&amp;gt;slug;&#xA;&#xA;    $newLocaleCategory = $criteria-&amp;gt;first();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-05-29T13:04:20.677" LastActivityDate="2017-05-29T13:04:20.677" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20629" PostTypeId="2" ParentId="1086" CreationDate="2017-05-29T13:51:13.847" Score="2" Body="&lt;p&gt;I couldn't quite get Carls answer to work (the &quot;weightedTags&quot;-array wasn't properly sorted), so I went and wrote a quick variable and service for achieving what I was after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, the super-simple variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getPopularTags($limit = NULL, $tagGroup = 'tags') {&#xA;    return craft()-&amp;gt;PLUGIN_SERVICENAME-&amp;gt;getPopularTags($limit, $tagGroup);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simply replace &quot;PLUGIN_SERVICENAME&quot; with whatever your plugin and service is called, per example &quot;myPlugin_tagFinder&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the service is almost as simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;class PLUGIN_SERVICENAMEService extends BaseApplicationComponent&#xA;{&#xA;  public function getPopularTags($limit, $tagGroup = 'tags')&#xA;  {&#xA;    $sql = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;    $sql-&amp;gt;select('tags.*, i18n.slug');&#xA;    $sql-&amp;gt;from(['taggroups tagGroups', 'tags tags', 'relations relations', 'elements elements', 'elements_i18n i18n']);&#xA;    $sql-&amp;gt;where(['AND',&#xA;                 &quot;tagGroups.handle = '$tagGroup'&quot;,&#xA;                 'tags.groupId = tagGroups.id',&#xA;                 'relations.targetId = tags.id',&#xA;                 'elements.id = relations.sourceId',&#xA;                 &quot;elements.enabled = '1'&quot;,&#xA;                 'i18n.elementId = tags.id']);&#xA;    $sql-&amp;gt;group('relations.targetId');&#xA;    $sql-&amp;gt;order('COUNT(elements.id) DESC');&#xA;    if (!is_null($limit) &amp;amp;&amp;amp; is_numeric($limit)) {&#xA;      $sql-&amp;gt;limit($limit);&#xA;    }&#xA;&#xA;    return TagModel::populateModels($sql-&amp;gt;queryAll());&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, replace &quot;PLUGIN_SERVICENAME&quot; with whatever your plugin and service is called, per example &quot;MyPlugin_tagFinderService&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once that is done (caveat: And your plugin is, naturally, installed/activated) you can get the tags you require from your template simply by calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%set tags = craft.myPlugin.getPopularTags() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there on you'll loop through them just as if you fetched them through the &lt;code&gt;craft.tags.find()&lt;/code&gt;-methodology.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4465" LastEditDate="2017-06-16T07:45:10.207" LastActivityDate="2017-06-16T07:45:10.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20630" PostTypeId="1" AcceptedAnswerId="20631" CreationDate="2017-05-29T17:52:45.807" Score="2" ViewCount="270" Body="&lt;p&gt;I can’t for the life of me get images to upload. Neither on my local server or on the live server. The progress bar goes to the end, and then … nothing. From what I can see online, I’m not the only one, but I can’t find any remedy.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I’ve gotten Imagemagick installed (locally, at least), but no change (GD is installed in both environments)&lt;/li&gt;&#xA;&lt;li&gt;I’ve tried several types of image formats (seems some people have problems with JPEG)&lt;/li&gt;&#xA;&lt;li&gt;I’ve tried relative asset paths and set through environmental variables&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Nothing seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the error logs, the only error I can find is:&#xA;&lt;code&gt;Undefined index: singleUploadLocationSource ([correct path]/craft/app/models/AssetFileModel.php:171)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just realised that the files &lt;em&gt;do&lt;/em&gt; get uploaded to the storage/runtime/assets/tempUploads folder. So seems it fails to completing the copy to the final assets folder. Permissions &lt;em&gt;should&lt;/em&gt; be correct, from what I can understand (I'm no expert on these things).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas what can be the cause? I’ve been scratching my head here for weeks, and it still itches like crazy.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-05-29T18:13:30.637" Title="Asset upload fails with progress bar at full, but images in tempuploads folder" Tags="&lt;assets&gt;&lt;image&gt;&lt;error&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20631" PostTypeId="2" ParentId="20630" CreationDate="2017-05-29T18:13:30.637" Score="2" Body="&lt;p&gt;My own fault – I had set a subpath in the field type, so it tried to save to a folder that didn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had first thought it was here the asset path was set, and when I figured out I needed asset types, I forgot to delete the subpath.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now it works! Both with Imagemagick (local) and GD (live server).&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-05-29T18:13:30.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20632" PostTypeId="2" ParentId="20622" CreationDate="2017-05-29T21:04:54.363" Score="1" Body="&lt;p&gt;The correct markup is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block[field.handle] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The final looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myField][fields][{{ field.handle }}]&quot; value=&quot;{{ block[field.handle] }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-05-29T21:04:54.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20633" PostTypeId="1" CreationDate="2017-05-30T01:32:22.243" Score="2" ViewCount="739" Body="&lt;p&gt;I am getting an error when trying to generate a PDF in Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Undefined index: (/srv/data/web/vhosts/www.nihonshu-sake.lu/craft/plugins/commerce/vendor/dompdf/dompdf/lib/Cpdf.php:3855)&#xA;  $font = $this-&gt;fonts[$this-&gt;currentFont];&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2017-05-30T02:33:42.350" LastActivityDate="2017-05-30T02:34:15.703" Title="Error when trying to generate a PDF in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20634" PostTypeId="2" ParentId="20633" CreationDate="2017-05-30T01:32:22.243" Score="2" Body="&lt;p&gt;Craft Commerce 1.x uses the Dompdf package to generate PDFs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is likely a font cache issue, Dompdf caches an index about all fonts. Removing the cache indexes should fix the issue. Remove:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/commerce/vendor/dompdf/dompdf/lib/fonts/dompdf_font_family_cache.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as mentioned in the migration guide and occurs because Craft Commerce has gone from Dompdf 0.6 to 0.8:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/dompdf/dompdf/wiki/Migration-Guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dompdf/dompdf/wiki/Migration-Guide&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The class naming conventions required a change to the dompdf_font_family_cache.php file. Though we have attempted to accommodate this change your first step when encountering bugs (if you don't know where to start) might be to reset your font directory (i.e. remove custom font files and the related font metrics files, and remove the non-dist, generated, font family cache file).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First try removing the &lt;code&gt;dompdf_font_family_cache.php&lt;/code&gt; as mentioned above. If that doesn't work try removing all files they list above from the same folder. I think that includes all &lt;code&gt;.afm&lt;/code&gt;. The directory should end up looking something like the original: &lt;a href=&quot;https://github.com/dompdf/dompdf/tree/master/lib/fonts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dompdf/dompdf/tree/master/lib/fonts&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2017-05-30T02:34:15.703" LastActivityDate="2017-05-30T02:34:15.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20636" PostTypeId="1" CreationDate="2017-05-30T09:05:03.377" Score="1" ViewCount="2181" Body="&lt;p&gt;After setting up a template file &lt;code&gt;article.html&lt;/code&gt; in &lt;code&gt;craft/templates&lt;/code&gt; folder, and creating the &lt;code&gt;section article&lt;/code&gt; with the &lt;code&gt;uri article&lt;/code&gt; and setting the entry template as &lt;code&gt;article&lt;/code&gt; in the admin, on trying to see the Live Preview of the page when I go to it in the entries list I get a Craft page with the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Page not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I thought it might have something with cache maybe, so I cleared that, but I still got the same error. Why I am getting this error, and how can I fix that?&lt;/p&gt;&#xA;" OwnerUserId="6735" LastEditorUserId="57" LastEditDate="2017-05-30T17:18:00.077" LastActivityDate="2017-05-30T17:22:12.353" Title="Page not found error" Tags="&lt;templating&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20637" PostTypeId="1" CreationDate="2017-05-30T10:33:00.810" Score="0" ViewCount="82" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Multi-Environment&lt;/a&gt; on a clients site and have it all working happily with standard http. However, we want the site to run on https to be more secure, but the server company can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the same Craft-Multi-Environment working fine with https on a personal site on a cloud server that I setup myself via Plesk. However, the clients site is being administed purely via the command line by the server company. So I wanted to know if there's any know issues that might be able to help to get it to work?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-05-30T10:33:00.810" Title="https problem with multi environment config" Tags="&lt;multi-environment&gt;&lt;https&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20638" PostTypeId="1" AcceptedAnswerId="20799" CreationDate="2017-05-30T10:44:32.907" Score="1" ViewCount="121" Body="&lt;p&gt;I have a field named &lt;code&gt;image&lt;/code&gt; that is assigned to an entry as well as a category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a user edits an entry, I would like the subfolder to be named after the section.handle property. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a user edits a category, I would like the subfolder to be named after the group.handle property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to achieve this? I've tried something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ section.handle ?? group.handle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but unfortunately it does not seem to work.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastEditorUserId="57" LastEditDate="2017-05-30T18:21:42.067" LastActivityDate="2017-06-12T13:51:07.280" Title="In an Asset field, how to use a dynamic subfolder field value that is dependent on the element type?" Tags="&lt;assets&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20640" PostTypeId="2" ParentId="20636" CreationDate="2017-05-30T17:22:12.353" Score="2" Body="&lt;p&gt;I restored the database backup that came with your ticket locally and created an &lt;code&gt;article.html&lt;/code&gt; template in &lt;code&gt;craft/templates&lt;/code&gt; and was able to load the route on the front-end of the site as well as get it to display in Live Preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that either 1) there's something wacky with the permissions on that file that Craft/PHP can't read it or 2) there's a &lt;code&gt;.htaccess&lt;/code&gt; rewrite rule in your setup that's interfering with that request.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-05-30T17:22:12.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20642" PostTypeId="2" ParentId="20509" CreationDate="2017-05-30T18:42:58.297" Score="1" Body="&lt;p&gt;I ended up developing a real quick plugin to make an additional call to Paypal to get and store the address to the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/wojodesign/paypaladdresser&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/wojodesign/paypaladdresser&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6691" LastActivityDate="2017-05-30T18:42:58.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20643" PostTypeId="1" CreationDate="2017-05-31T00:05:28.740" Score="2" ViewCount="91" Body="&lt;p&gt;I have structure entries that needs to be in a very specific order, following a pattern of horizontal and vertical images to create the right affect on the front-end. I would love a way that I could remind my client of the instructions for the right order of these entries directly on the entries index screen in the CP, sort of like how you can provide instructions for each field. Are there any plugins that would allow the injection of some instructions into the CP page like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen option to that allow you to create entire users manuals or help sections in the CP, but that's not what I'm after. I want something that could go inline on just a single CP page.&lt;/p&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2018-03-02T18:29:59.733" Title="Is there a way to add instructions directly on a entry index screen in the CP?" Tags="&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20646" PostTypeId="1" AcceptedAnswerId="20651" CreationDate="2017-05-31T10:49:26.870" Score="6" ViewCount="1389" Body="&lt;p&gt;I’m currently considering options for a project that will require a standard sales site, commerce features and a user database. The user database will require a web frontend and an API for communication with a mobile app (read and write).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My dilemma is whether it makes sense to consider Craft for all three components, which will give us all the benefits of a unified system, or to split the user database into a separate project where we could take advantage of something like Laravel Passport, which seems like the obvious option for efficiently building a secure API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/airtype/craft-httpmessages&quot; rel=&quot;noreferrer&quot;&gt;HTTP Messages&lt;/a&gt; plugin looks useful but doesn’t appear to deal with authentication at all and preexisting options for Yii/Craft OAuth appear limited to nonexistent. I get the sense that Craft 3/Yii 2 would make life easier, but waiting for a stable Craft 3 release isn’t possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone had any experience developing a secured API on top of Craft? If so, what route did you take and would you do it again?&lt;/p&gt;&#xA;" OwnerUserId="3327" LastActivityDate="2017-05-31T15:01:09.800" Title="Adding a RESTful, OAuth API on top of Craft" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20648" PostTypeId="1" CreationDate="2017-05-31T11:18:08.383" Score="1" ViewCount="46" Body="&lt;p&gt;I'm trying to run a controller action with ajax in a new plugin I'm making. &#xA;The action needs to return all categories from a group, so nothing impossible here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the actionUrl in the browser I get the wanted result: an array with the titles of all categories in a group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I call this action while using ajax it results in an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Ajax call&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $.ajax({&#xA;        url: Craft.getActionUrl('AddEntriesFilter/Index/GetCategories'),&#xA;        context: document.body,&#xA;        success: function(response) {&#xA;            console.log(response);&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Action in controller&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionGetCategories()&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;    $criteria-&amp;gt;group = 'myCategoryHandle';&#xA;&#xA;    $cats = $criteria-&amp;gt;find();&#xA;&#xA;    $regions = array();&#xA;    foreach ($cats as $cat)&#xA;    {&#xA;        $regions[] = $cat-&amp;gt;title;&#xA;    }&#xA;&#xA;     $this-&amp;gt;returnJson($regions);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To test this, I tried to &lt;code&gt;Craft::dd($cats);&lt;/code&gt; and this is already empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to &lt;code&gt;Craft::dd($criteria-&amp;gt;count());&lt;/code&gt; and this also gives different results in the ajax call and in the browser. The ajax call returns 0 and the browser returns the wanted result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After logging the attributes of $criteria I discovered &lt;code&gt;$criteria-&amp;gt;find()&lt;/code&gt;is adding a relatedTo attribute. It only does this when running it through Ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="6720" LastEditDate="2017-05-31T12:21:47.693" LastActivityDate="2017-05-31T12:21:47.693" Title="Find category through ajax using ElementCriteriaModel" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;elementcriteriamodel&gt;&lt;ajax&gt;&lt;controller&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20649" PostTypeId="1" AcceptedAnswerId="20661" CreationDate="2017-05-31T14:35:00.260" Score="4" ViewCount="428" Body="&lt;p&gt;I'm using &lt;strong&gt;onPopulateLineItem&lt;/strong&gt; in my plugin to dynamically set the price of products added to the cart based on user input on the front-end -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lineItem = $event-&amp;gt;params['lineItem'];&#xA;&#xA;$size = craft()-&amp;gt;request-&amp;gt;getPost('size');&#xA;$colour = craft()-&amp;gt;request-&amp;gt;getPost('colour');&#xA;$finish = craft()-&amp;gt;request-&amp;gt;getPost('finish');&#xA;&#xA;$options = array(&#xA;  'size' =&amp;gt; $size,&#xA;  'colour' =&amp;gt; $colour,&#xA;  'finish' =&amp;gt; $finish&#xA;);&#xA;&#xA;$lineItem-&amp;gt;options = $options;&#xA;$lineItem-&amp;gt;price = $dynamicPrice;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working fine, however, if the same product item is added to the cart but with different options (and therefor a different price) the existing line item is overwritten with the new values/price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can create a new line item each time, rather than overwrite the existing one? Do I need to use a different event or create some kind of custom controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6791" LastActivityDate="2017-06-01T05:43:34.350" Title="(Commerce) Multiple line items with the same purchasable ID?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20651" PostTypeId="2" ParentId="20646" CreationDate="2017-05-31T15:01:09.800" Score="8" Body="&lt;p&gt;Short answer: yes I have, I used OAuth 2 and I would absolutely do it again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote up my experience in general terms &lt;a href=&quot;https://angell.io/blog/what-i-learned-creating-an-api-in-craft&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; but essentially it boiled down to two plugins, one on each site: one acting as the server and another as the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;a href=&quot;http://oauth2.thephpleague.com/&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;league/oauth2-server&lt;/code&gt;&lt;/a&gt; for the server and then tied in directly to the &lt;a href=&quot;https://dukt.net/oauth&quot; rel=&quot;noreferrer&quot;&gt;Dukt OAuth plugin&lt;/a&gt; for the client, but in retrospect it would’ve been simpler just using &lt;a href=&quot;https://github.com/thephpleague/oauth2-client&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;league/oauth2-client&lt;/code&gt;&lt;/a&gt; for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For transforming data like the Element API does I used &lt;a href=&quot;http://fractal.thephpleague.com/&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;league/fractal&lt;/code&gt;&lt;/a&gt; and then to get proper request behaviour I used &lt;a href=&quot;https://github.com/zendframework/zend-diactoros&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;zendframework/zend-diactoros&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially I think this sort of thing is perfectly feasible in Craft, due to plugins being so flexible you can load whatever libraries you need and go nuts. Craft 3 could simplified things somewhat with &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-structure-modules.html&quot; rel=&quot;noreferrer&quot;&gt;Yii Modules&lt;/a&gt; as I’m guessing you could package up the whole API code as a module, but it shouldn’t be necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2017-05-31T15:01:09.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20652" PostTypeId="1" AcceptedAnswerId="20657" CreationDate="2017-05-31T15:07:16.747" Score="1" ViewCount="82" Body="&lt;p&gt;I'm trying to bring back a list of entries from a section. Currently I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'airports';&#xA;$criteria-&amp;gt;airportcode = 'BCN';&#xA;$airportPrefHotels = craft()-&amp;gt;elements-&amp;gt;findElements($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The airport section has a multiple entries field. I want to loop over them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="6793" LastEditorUserId="57" LastEditDate="2017-05-31T18:22:08.233" LastActivityDate="2017-05-31T18:51:31.773" Title="Entries inside controller" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20653" PostTypeId="1" AcceptedAnswerId="20655" CreationDate="2017-05-31T16:28:32.403" Score="1" ViewCount="44" Body="&lt;p&gt;I'm trying to set up a site for clients that have locations in multiple cities and who want to be able to display something specific to that location on certain pages. I would like to set up routes using the city name as a variable, followed by the page (i.e. &lt;code&gt;mysite.com/chicago/pricing&lt;/code&gt;, &lt;code&gt;mysite.com/boston/pricing&lt;/code&gt;, etc.), and have it route to the same section and template with all of that section's corresponding entry fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was planning to grab the URL parameter as a variable that enables me to dynamically load content based on a simple string match for that variable. I want to do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = matches[1] %}&#xA;&#xA;{% if not location %}&#xA;  {% set selectedLocation = locations.defaultLocation %}&#xA;{% else %}&#xA;  {% set selectedLocation = location %}&#xA;{% endif %}&#xA;&#xA;....&#xA;&#xA;{% for plan in entry.pricingPlans %}&#xA;    {% if plan.location == selectedLocation %}&#xA;      ...&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can route to the template itself just fine, but I don't get the data. Any suggestions on how best to achieve this? I'm not very PHP savvy and have only recently started getting to more advanced tasks in Craft.&lt;/p&gt;&#xA;" OwnerUserId="5979" LastActivityDate="2017-05-31T16:50:14.697" Title="How do I do routing for something like {city}/pricing, {city}/how-it-works, etc. while loading the same template and dataset?" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20654" PostTypeId="1" CreationDate="2017-05-31T16:36:15.877" Score="1" ViewCount="52" Body="&lt;p&gt;Is this possible? At the point of upload, the entry field isn't checked so anything can be uploaded, which is a bit worrying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then again, if it's an Amazon S3 bucket, does it even matter? It won't be sitting on the server.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-05-31T17:04:25.720" Title="How to prevent non-image files being uploaded through frontend form?" Tags="&lt;assets&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20655" PostTypeId="2" ParentId="20653" CreationDate="2017-05-31T16:44:47.767" Score="1" Body="&lt;p&gt;Is the problem you're not getting the segment from the URL?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set locationSlugInUrl = craft.request.getSegment(1) %}&lt;/code&gt; or &lt;code&gt;{% set locationSlugInUrl = craft.request.firstSegment %}&lt;/code&gt; should do that for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you're not getting the entry? In which case you need to either specify the template in that section's settings or do something like &lt;code&gt;{% set entry = craft.entries.section('pricing').first %}&lt;/code&gt; or whatever the section slug is (assuming it's a single).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what kind of field is &lt;code&gt;entry.pricingPlans&lt;/code&gt;? If it is a matrix field, what type of field is &lt;code&gt;plan.location&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-05-31T16:50:14.697" LastActivityDate="2017-05-31T16:50:14.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20656" PostTypeId="2" ParentId="20654" CreationDate="2017-05-31T17:04:25.720" Score="1" Body="&lt;p&gt;There is a checkbox when creating/editing the field labeled &quot;Restrict allowed file types?&quot; Checking it will reveal file type options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/assets-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2017-05-31T17:04:25.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20657" PostTypeId="2" ParentId="20652" CreationDate="2017-05-31T18:51:31.773" Score="1" Body="&lt;p&gt;You first need to query for the “airport” entry by using the &lt;code&gt;first()&lt;/code&gt; method. &lt;code&gt;$airport-&amp;gt;myEntriedFieldHandle&lt;/code&gt; then returns an ElementCriteriaModel prepared to get all the entries selected in the Entries field.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'airports';&#xA;$criteria-&amp;gt;airportcode = 'BCN';&#xA;$airport = $criteria-&amp;gt;first();&#xA;&#xA;if ($airport) {&#xA;    $criteria = $airport-&amp;gt;prefHotels;&#xA;    $airportPrefHotels = $criteria-&amp;gt;find();&#xA;&#xA;    if ($airportPrefHotels) {&#xA;        // do useful things with $airportPrefHotels&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-05-31T18:51:31.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20658" PostTypeId="1" AcceptedAnswerId="20758" CreationDate="2017-05-31T21:40:04.703" Score="1" ViewCount="763" Body="&lt;p&gt;I am trying to get the value of a field from a freeform event.  Specifically I'm trying to see if a particular checkbox is in a form submission.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on(&#xA;    &quot;freeform_submissions.onBeforeSave&quot;,&#xA;    function (Event $event) {&#xA;        $submission = $event-&amp;gt;params[&quot;model&quot;];&#xA;        $field = $submission['fieldMetadata']['checkbox_handle'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works to this point.  I see if I do &lt;code&gt;Craft:dd($field);&lt;/code&gt; I have a checkboxField object. But from here on I can't get any info about that field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $id = $field-&amp;gt;id; // or:&#xA;        $handle = $field-&amp;gt;handle; // and any other properties&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws: &lt;code&gt;Fatal error: Cannot access protected property Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField::$id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $id = $field['id'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get: &lt;code&gt;Fatal error: Cannot use object of type Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField as array&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The properties and methods are listed at: &lt;a href=&quot;https://solspace.com/craft/freeform/docs/field/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/field/&lt;/a&gt;, but I can't access the properties.  I can call the &lt;code&gt;render()&lt;/code&gt; method which works and that outputs html.  I'm sure its something obvious, but I'm missing it.&lt;/p&gt;&#xA;" OwnerUserId="6296" LastEditorUserId="6296" LastEditDate="2017-06-01T13:43:53.850" LastActivityDate="2017-06-08T19:07:59.243" Title="How to access a freeform field object's properties from an event" Tags="&lt;plugin-development&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20659" PostTypeId="1" AcceptedAnswerId="20660" CreationDate="2017-06-01T00:32:47.493" Score="1" ViewCount="303" Body="&lt;p&gt;I've got a plugin that does a thing when an entry is resaved. It works great. However I need it to fire for every single entry to build some data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    // Do the thing&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why does running a &lt;strong&gt;ResaveElements&lt;/strong&gt; task not fire this yet saving an entry does? Updating a section to cause all of the entries in that section to update doesn't either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can bulk trigger this to fire outside of me having to write my own script to manually do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2017-06-01T01:44:23.813" Title="entries.saveEntry not triggered by ResaveElements task" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;performance&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20660" PostTypeId="2" ParentId="20659" CreationDate="2017-06-01T01:44:23.813" Score="2" Body="&lt;p&gt;It's because the ResaveElements task calls &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement()&lt;/code&gt; directly, instead of going through the element specific save method (like &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to listen to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onSaveElement&quot; rel=&quot;nofollow noreferrer&quot;&gt;onSaveElement&lt;/a&gt; event, check that it's an Entry you're looking at, then perform any specific business logic that you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T01:44:23.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20661" PostTypeId="2" ParentId="20649" CreationDate="2017-06-01T04:16:59.267" Score="4" Body="&lt;p&gt;Commerce will by default combine line items that have the same hash value for the options (that is, the values of the items chosen options are run through &lt;code&gt;md5&lt;/code&gt; to get a hash - if the hash matches, the lineItems quantity is increased as the item is seen as the same item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want line items with the same options to remain as separate line items, then you can simply add another unique option to the product as you add it to the cart (you don't need to display this of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;options['whatevs']&quot; value=&quot;somethingRandom&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig isn't actually ideal at generating random things I believe, I'd personally create a template variable in my Business Logic plugin that returns a random value, e.g. something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function random(){&#xA;    srand(time());&#xA;    return rand(1,time()); &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can e.g. call the current timestamp in twig but there's always a chance that might not end up as random I suppose?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;options['time']&quot; value=&quot;{{ date().timestamp }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Calling twigs own random (&lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/functions/random.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.sensiolabs.org/doc/2.x/functions/random.html&lt;/a&gt;) - doesn't seem ideal as that's inclusive so you might see the edge values returned more than you'd like).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-01T05:43:34.350" LastActivityDate="2017-06-01T05:43:34.350" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20662" PostTypeId="1" AcceptedAnswerId="20690" CreationDate="2017-06-01T04:21:03.840" Score="1" ViewCount="253" Body="&lt;p&gt;So I've updated the site URL in my general.php as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'siteUrl' =&amp;gt; &quot;https://&quot; . $_SERVER['HTTP_HOST'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also have our web server making sure everything goes to &lt;a href=&quot;https://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.example.com&lt;/a&gt;. Our IT person set this up but as I understand it it's done through vhosts in Apache. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is our .htaccess file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_expires.c&amp;gt;&#xA; ExpiresActive on&#xA; # Perhaps better to whitelist expires rules? Perhaps.&#xA; ExpiresDefault &quot;access plus 1 month&quot;&#xA; # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)&#xA; ExpiresByType text/cache-manifest &quot;access plus 0 seconds&quot;&#xA; # Your document html&#xA; ExpiresByType text/html &quot;access plus 0 seconds&quot;&#xA; # Data&#xA; ExpiresByType text/xml &quot;access plus 0 seconds&quot;&#xA; ExpiresByType application/xml &quot;access plus 0 seconds&quot;&#xA; ExpiresByType application/json &quot;access plus 0 seconds&quot;&#xA; # Feed&#xA; ExpiresByType application/rss+xml &quot;access plus 1 hour&quot;&#xA; ExpiresByType application/atom+xml &quot;access plus 1 hour&quot;&#xA; # Favicon (cannot be renamed)&#xA; ExpiresByType image/x-icon &quot;access plus 1 week&quot;&#xA; # Media: images, video, audio&#xA; ExpiresByType image/gif &quot;access plus 1 month&quot;&#xA; ExpiresByType image/png &quot;access plus 1 month&quot;&#xA; ExpiresByType image/jpeg &quot;access plus 1 month&quot;&#xA; ExpiresByType video/ogg &quot;access plus 1 month&quot;&#xA; ExpiresByType audio/ogg &quot;access plus 1 month&quot;&#xA; ExpiresByType video/mp4 &quot;access plus 1 month&quot;&#xA; ExpiresByType video/webm &quot;access plus 1 month&quot;&#xA; # Webfonts&#xA; ExpiresByType application/x-font-ttf &quot;access plus 1 month&quot;&#xA; ExpiresByType font/opentype &quot;access plus 1 month&quot;&#xA; ExpiresByType application/x-font-woff &quot;access plus 1 month&quot;&#xA; ExpiresByType image/svg+xml &quot;access plus 1 month&quot;&#xA; ExpiresByType application/vnd.ms-fontobject &quot;access plus 1 month&quot;&#xA; ExpiresByType text/css &quot;access plus 1 year&quot;&#xA; ExpiresByType application/javascript &quot;access plus 1 year&quot;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA; AddOutputFilterByType DEFLATE text/html text/plain text/css application/json&#xA; AddOutputFilterByType DEFLATE application/javascript&#xA; AddOutputFilterByType DEFLATE text/xml application/xml text/x-component&#xA; AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml&#xA; Addtype font/opentype .otf&#xA; Addtype font/truetype .ttf&#xA; AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.msfontobject application/x-font-ttf font/opentype font/truetype&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;     RewriteEngine On&#xA;&#xA;    #301 redirect with trailing slash&#xA;        RewriteCond %{REQUEST_URI} /+[^\.]+$&#xA;        RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]&#xA;&#xA;    #Send would-be 404 requests to Craft&#xA;        RewriteCond %{REQUEST_FILENAME} !-f&#xA;        RewriteCond %{REQUEST_FILENAME} !-d&#xA;        RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;        RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;  AddType text/x-component .htc&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in tracking how redirects are working, it looks like most redirects, including adding an extra / to the end of a URL via the .htaccess, those done in Craft templates themselves and those done through the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/redirect-manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;redirect manager plugin&lt;/a&gt; 301 to &lt;a href=&quot;http://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.com&lt;/a&gt; and then 301 again to &lt;a href=&quot;https://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.example.com&lt;/a&gt;. Visits to &lt;a href=&quot;http://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.com&lt;/a&gt; redirect straight to &lt;a href=&quot;https://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.example.com&lt;/a&gt; and visits to https pages directly return a 200.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I configure Craft to out the first redirect to http and just go straight to https? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2017-06-01T22:12:40.943" LastActivityDate="2017-06-02T19:14:34.130" Title="HTTPs Site - Redirects Go to HTTP First &amp; Then HTTPs" Tags="&lt;templating&gt;&lt;redirect&gt;&lt;htaccess&gt;&lt;apache&gt;&lt;https&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20663" PostTypeId="1" AcceptedAnswerId="21260" CreationDate="2017-06-01T05:24:32.357" Score="2" ViewCount="256" Body="&lt;p&gt;I'm using the Search Plus plugin with Craft, it's been a great help! &#xA;I have 2 questions I need help with, as the Search Plus docs are not too clear so far:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have a search page with filters (facets) in place, however these&#xA;facets are arranged according to search count by default. I want to&#xA;sort them by alphabetical order instead, and I've seen that it is&#xA;possible with Algolia, but I need help to do that with Search Plus.&lt;/li&gt;&#xA;&lt;li&gt;Upon clicking on a filter checkbox, the other filters disappear. How&#xA;do I trigger them to still appear but with a different CSS class&#xA;applied?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6736" LastActivityDate="2017-07-18T19:57:18.783" Title="Search Plus Plugin: How to sort facets?" Tags="&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20665" PostTypeId="1" AcceptedAnswerId="20667" CreationDate="2017-06-01T07:24:41.443" Score="2" ViewCount="63" Body="&lt;p&gt;We just found out that in the database birthday field, all dates has 1-day difference than what is shown on the front-end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end, it is the correct date by the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Is it a bug and if not, why is this?&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2017-06-01T22:26:35.393" Title="date in database -1 day as on frond-end" Tags="&lt;database&gt;&lt;datetime&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20666" PostTypeId="1" AcceptedAnswerId="20682" CreationDate="2017-06-01T09:38:46.743" Score="1" ViewCount="134" Body="&lt;p&gt;I need to add a value to my plugin database for an ENUM field but I am struggling to find the correct syntax for the alterColumn method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to do this but with alterColumn if possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ALTER TABLE tableName CHANGE columnName columnName ENUM('existingOption1', 'existingOption2', 'newOption') DEFAULT NULL;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-06-01T21:00:12.027" Title="How to use alterColumn to change the values of an ENUM field in a DB Migration" Tags="&lt;plugin-development&gt;&lt;migration&gt;&lt;createcommand&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20667" PostTypeId="2" ParentId="20665" CreationDate="2017-06-01T10:50:22.747" Score="4" Body="&lt;p&gt;The database will be storing the date as seconds since 1970 (epoch) and your view on that is not localised. However, the front end date is localised for your time zone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of this I am more sure than that the sun will rise tomorrow (thanks to a recent rise in right wing politicians).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-01T22:26:35.393" LastActivityDate="2017-06-01T22:26:35.393" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20668" PostTypeId="1" AcceptedAnswerId="20674" CreationDate="2017-06-01T11:25:47.017" Score="0" ViewCount="69" Body="&lt;p&gt;I have a bunch of categories within a section on my website, but I want each category item within that section to be able to have an additional slug. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mywebsite.com/categories/category/information (information being the additional slug)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Craft?&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2017-06-02T14:16:53.243" LastActivityDate="2017-06-02T15:52:18.733" Title="Can structure entries have their own entries?" Tags="&lt;sections&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20669" PostTypeId="1" CreationDate="2017-06-01T12:57:51.040" Score="1" ViewCount="120" Body="&lt;p&gt;I've extended all my &quot;translations/[locale_id].php&quot; to refer to this  function which enables us to put all our translations under a global in the control-panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when this is done – we lose data attached to our assets. We currently use a Focal Point plugin attached to our assets. It describes with a field how images are to be cropped. This particular plugin stops working when the line highlighted below is executed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function get_dynamic_translations() {&#xA;    $translations = array();&#xA;&#xA;    if (!craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        // the following line makes the plugin &quot;FocalPointField&quot; stop loading its data&#xA;        $i18n = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('i18n');&#xA;&#xA;        foreach ($i18n-&amp;gt;getFieldValue('translations') as $current_block) {&#xA;            $translations[$current_block-&amp;gt;content-&amp;gt;key] = $current_block-&amp;gt;content-&amp;gt;value;&#xA;        }&#xA;    }&#xA;&#xA;    return $translations;&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would love for these two solutions to work together in perfect harmony – but I can't seem to figure out why this is not working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea how I can go forth?&lt;/p&gt;&#xA;" OwnerUserId="6761" LastEditorUserId="6761" LastEditDate="2017-06-07T09:28:58.430" LastActivityDate="2017-06-14T20:26:33.737" Title="Fetching a Localized Global as a Static Translation Causes Error in How Plugins Load" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20671" PostTypeId="1" AcceptedAnswerId="20683" CreationDate="2017-06-01T14:20:39.633" Score="1" ViewCount="153" Body="&lt;p&gt;At the moment I'm working on my first Craft CMS project. There I have two different locales that share the same assets folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The assets can be seen and used between the different locales but when I try to search I only get results in one locale. This is strange because they show up in the full list when selecting that locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips? Did I miss a certain setting?&lt;/p&gt;&#xA;" OwnerUserId="6796" LastActivityDate="2017-06-01T21:14:22.337" Title="No assets found when searching in different locale" Tags="&lt;assets&gt;&lt;localization&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20672" PostTypeId="1" AcceptedAnswerId="20677" CreationDate="2017-06-01T15:08:56.117" Score="1" ViewCount="363" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/benjamminf/craft-neo/wiki&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo&lt;/a&gt; plugin in my project. I have made a Neofield &lt;code&gt;article content&lt;/code&gt; with several block types in it. Amongst the block types that I have in it, is a &lt;code&gt;gallery&lt;/code&gt; as well. Gallery block type has a&lt;code&gt;matrix&lt;/code&gt; field &lt;code&gt;imageWithCaption&lt;/code&gt;, and the field &lt;code&gt;imageWithCaption&lt;/code&gt; has fields &lt;code&gt;file&lt;/code&gt; which is the assets field, and fields &lt;code&gt;imageTitle&lt;/code&gt; and &lt;code&gt;caption&lt;/code&gt; which are plain text fields. I am able to display &lt;code&gt;imageTitle&lt;/code&gt; and &lt;code&gt;caption&lt;/code&gt; in my template but not a file, or the image itself. This is my template:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     {% for image in block.imageWithCaption %}&#xA;        &amp;lt;div class=&amp;quot;large-4 columns&amp;quot;&amp;gt;&#xA;          &amp;lt;div class=&amp;quot;media-object stack-for-small&amp;quot;&amp;gt;&#xA;            &amp;lt;div class=&amp;quot;media-object-section&amp;quot;&amp;gt;&#xA;              &amp;lt;div&amp;gt;&#xA;                &amp;lt;img src=&amp;quot;{{ image.file }}&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;&#xA;              &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&amp;quot;media-object-section&amp;quot;&amp;gt;&#xA;              &amp;lt;h6&amp;gt;{{ image.title }}&amp;lt;/h6&amp;gt;&#xA;              &amp;lt;p&amp;gt;{{ image.caption }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get an error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to&#xA;string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What I am doing wrong and how can I display the image?&lt;/p&gt;&#xA;" OwnerUserId="6735" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-06-01T21:47:13.217" Title="Neo plugin - Displaying an image from a Matrix field" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20673" PostTypeId="1" CreationDate="2017-06-01T15:15:39.993" Score="2" ViewCount="132" Body="&lt;p&gt;I have a section named Contest.&#xA;In there, you can choose a Solspace Freeform using its fieldtype.&#xA;I am using the &lt;code&gt;cp.entries.right-pane&lt;/code&gt; hook to show the editor the number of submission directly in the Contest edit view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to put a link : &quot;Show submissions&quot;&#xA;How can I (pre) filter the submissions for a given form knowing that Solspace  dosen't have a route for this and uses only JS ?&lt;/p&gt;&#xA;" OwnerUserId="6797" LastEditorUserId="57" LastEditDate="2017-06-01T21:17:09.053" LastActivityDate="2017-06-01T21:17:09.053" Title="Link to form submissions" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20674" PostTypeId="2" ParentId="20668" CreationDate="2017-06-01T15:30:45.660" Score="2" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following your comment, and if I understand well, you already are using a URL for the categories, but want to create kind of a subpage &quot;information&quot; for them. It is a bit more complicated but it can be achieved. What you can do is create a route, either from the control panel or the &lt;code&gt;config/routes.php&lt;/code&gt; file in &lt;code&gt;craft/config&lt;/code&gt;. It may be easier to do it from the control panel first. If you go to Settings &gt; Routes and click on &quot;New route&quot; you can enter the following information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f57Po.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f57Po.png&quot; alt=&quot;New route popup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will create a new URI endpoint for the &quot;information&quot; pages that you want and map them to a &lt;code&gt;_information.html&lt;/code&gt; template in the &quot;categories&quot; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then create &lt;code&gt;_information.html&lt;/code&gt; template and retrieve your category using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories({ group: 'categoryName', slug: craft.request.segments[1] }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming the handle of your category is &lt;code&gt;categoryName&lt;/code&gt; of course.&#xA;&lt;code&gt;craft.request.segments&lt;/code&gt; is an array containing all parts of your URI, starting from 0. Thus, the second part of the URI, which is the selected category's slug, is stored in &lt;code&gt;craft.request.segments[1]&lt;/code&gt;.&#xA;The variable &lt;code&gt;category&lt;/code&gt; will then contain all the fields assigned to the category that you want to display in the information page.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It is possible and quite easy to do in Craft.&#xA;You can create a new text field named &quot;External link&quot; for example, and assign it to the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, go to Settings &gt; Categories &gt; {Name of your category} and select the &quot;Field layout&quot; tab. You can then assign the &quot;External link&quot; field to the category like you would for a section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now edit your categories and add the external link for each one of them.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastEditorUserId="3570" LastEditDate="2017-06-02T15:52:18.733" LastActivityDate="2017-06-02T15:52:18.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20675" PostTypeId="1" AcceptedAnswerId="20684" CreationDate="2017-06-01T15:38:49.527" Score="1" ViewCount="301" Body="&lt;p&gt;I have entry titles that contain dashes (i.e. ABC-123). When I search for 'ABC', 'ABC-123', 'ABC 123', '123' etc the entry is shown in the results (I have fuzzy search enabled). However, when I search for 'ABC123' or anything with the dash omitted from the query the entry does not appear in the results. The same goes for misspellings (i.e. 'ABB-123').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for search to return a result that is only a partial match to the query to take into account slight differences between the query and a page title?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I have the following fuzzy search config settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'defaultSearchTermOptions' =&amp;gt; array(&#xA;    'subLeft' =&amp;gt; true,&#xA;    'subRight' =&amp;gt; true,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I have the following search query template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q')|replace('/(( )+|(\\n)+)/', ' ')|split(' ')|join(' OR ') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4095" LastActivityDate="2017-06-01T21:38:59.830" Title="Search results with partial match to query" Tags="&lt;search&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20676" PostTypeId="1" CreationDate="2017-06-01T15:43:38.727" Score="1" ViewCount="132" Body="&lt;p&gt;I have a multi-select field that I need to test for any 'selected values'...the below always has a return even when no values are selected. How do I check this multi-select to ensure there are selected values to output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myMultiSelect|length %}&#xA;    &amp;lt;!-- Output HTML + option values --&amp;gt;&#xA;    {% for option in entry.myMultiSelect%}&#xA;        {{ option }}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;!--Do something else --&amp;gt;               &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6798" LastEditorUserId="57" LastEditDate="2017-06-01T21:39:35.300" LastActivityDate="2017-06-05T14:45:33.967" Title="Multi-Select Tests" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20677" PostTypeId="2" ParentId="20672" CreationDate="2017-06-01T15:48:44.703" Score="3" Body="&lt;p&gt;It's tough to see the full context, just based on what you have here. From what I can tell, it seems like you might need to change &lt;code&gt;&amp;lt;img src=&quot;{{ image.file }}&quot; alt=&quot;&quot;&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;img src=&quot;{{ image.file.first().url }}&quot; alt=&quot;&quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the asset field can hold many assets, you have to declare &lt;code&gt;.first()&lt;/code&gt; to grab the first one -- even if there's only one image. Then you have to grab the &lt;code&gt;url&lt;/code&gt; property from the image, in order to get the correct &lt;code&gt;src&lt;/code&gt; value.&lt;/p&gt;&#xA;" OwnerUserId="6710" LastActivityDate="2017-06-01T15:48:44.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20680" PostTypeId="2" ParentId="20669" CreationDate="2017-06-01T20:48:36.340" Score="2" Body="&lt;p&gt;This line:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$current_criteria-&amp;gt;fieldId = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('translations');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should probably have a &lt;code&gt;-&amp;gt;id&lt;/code&gt; at the end?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$current_criteria-&amp;gt;fieldId = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('translations')-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the whole code could probably be replaced with:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;function get_dynamic_translations() {&#xA;    $translations = array();&#xA;&#xA;    if (!craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;&#xA;        $i18n = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('i18n');&#xA;&#xA;        foreach ($i18n-&amp;gt;getFieldValue('translations') as $current_block) {&#xA;            $translations[$current_block-&amp;gt;content-&amp;gt;key] = $current_block-&amp;gt;content-&amp;gt;value;&#xA;        }&#xA;    }&#xA;&#xA;    return $translations;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-06-14T20:26:33.737" LastActivityDate="2017-06-14T20:26:33.737" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20681" PostTypeId="1" AcceptedAnswerId="20685" CreationDate="2017-06-01T20:58:38.333" Score="1" ViewCount="339" Body="&lt;p&gt;I'm trying to add Heap Analytics as a tracking tool to my Craft site. From Heap's installation docs, I need to add this code snippet before the closing  tag. I'm pretty new to using Craft, can someone please explain how to go about doing this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code snippet: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||&quot;https:&quot;===document.location.protocol,a=document.createElement(&quot;script&quot;);a.type=&quot;text/javascript&quot;,a.async=!0,a.src=(r?&quot;https:&quot;:&quot;http:&quot;)+&quot;//cdn.heapanalytics.com/js/heap-&quot;+e+&quot;.js&quot;;var n=document.getElementsByTagName(&quot;script&quot;)[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=[&quot;addEventProperties&quot;,&quot;addUserProperties&quot;,&quot;clearEventProperties&quot;,&quot;identify&quot;,&quot;removeEventProperty&quot;,&quot;setEventProperties&quot;,&quot;track&quot;,&quot;unsetEventProperty&quot;],c=0;c&amp;lt;p.length;c++)heap[p[c]]=o(p[c])};&#xA;    heap.load(&quot;YOUR_APP_ID&quot;);&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Heap installation instructions: &lt;a href=&quot;https://docs.heapanalytics.com/docs/installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.heapanalytics.com/docs/installation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6801" LastEditorUserId="57" LastEditDate="2017-06-01T21:49:02.223" LastActivityDate="2017-06-01T21:51:19.897" Title="Add Heap Analytics code to HTML" Tags="&lt;templating&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20682" PostTypeId="2" ParentId="20666" CreationDate="2017-06-01T21:00:12.027" Score="0" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;alterColumn('tableName', 'columnName', &quot;enum('existingOption1','existingOption2','newOption') NULL&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T21:00:12.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20683" PostTypeId="2" ParentId="20671" CreationDate="2017-06-01T21:14:22.337" Score="1" Body="&lt;p&gt;This is a known bug on Craft 2 that has been resolved in the upcoming Craft 3 release.  Here's the original Github issue: &lt;a href=&quot;https://github.com/craftcms/cms/issues/17&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/17&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T21:14:22.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20684" PostTypeId="2" ParentId="20675" CreationDate="2017-06-01T21:38:59.830" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way for search to return a result that is only a partial match to the query to take into account slight differences between the query and a page title?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you put a title of &quot;ABC-123&quot; into a title in Craft, it will normalize it down to &quot; abc 123 &quot; when putting it into the &lt;code&gt;craft_searchindex&lt;/code&gt; table (lowercasing all letter and removing punctuation).  And Craft does a similar thing for searches (lowercases them and removes punctuation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;subLeft&lt;/code&gt; and &lt;code&gt;subRight&lt;/code&gt; enabled, searching for &lt;code&gt;ABC&lt;/code&gt; turns it into a MySQL fulltext search with wildcards on the left and right... i.e. &lt;code&gt;LIKE '%abc%'&lt;/code&gt; so it will match what's in the &lt;code&gt;search_index&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise &lt;code&gt;ABC-123&lt;/code&gt; gets converted to &lt;code&gt;%abc 123%&lt;/code&gt;, which will match, &lt;code&gt;ABC 123&lt;/code&gt; also gets converted to &lt;code&gt;%abc 123%&lt;/code&gt;, which will match and &lt;code&gt;123&lt;/code&gt; into &lt;code&gt;%123%&lt;/code&gt; which will match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ABC123&lt;/code&gt; would get converted to &lt;code&gt;%abc123%&lt;/code&gt; which wouldn't match (nor would &lt;code&gt;ABB-123&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MySQL does have a &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_soundex&quot; rel=&quot;nofollow noreferrer&quot;&gt;SOUNDEX()&lt;/a&gt; method, which might do what you're looking for, but it does have enough drawbacks that Craft wouldn't use it natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. it won't work against full text indexes, inconsistent results in non-English languages and inconsistent results with multi-byte characters (even if they are UTF-8).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other search services might offer more robust solutions (Algolia, Apache Lucere, etc.) that you could wrap with a plugin for searches on the front-end of a Craft site, but you should add a thumbs-up comment to this &lt;a href=&quot;https://github.com/craftcms/cms/issues/833&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github issue&lt;/a&gt; if you'd like the ability for plugins to swap out the core search provider that Craft uses wholesale (including for the Control Panel).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T21:38:59.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20685" PostTypeId="2" ParentId="20681" CreationDate="2017-06-01T21:51:19.897" Score="0" Body="&lt;p&gt;All of the HTML that Craft uses to render your site lives in your &lt;code&gt;craft/templates&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one of the files in that folder, you're presumably defining your &lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd want to find where that is and insert your JavaScript analytics tracking code before the closing head as per the Head Analytics installation docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably worth a read through the &lt;a href=&quot;https://craftcms.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft does&lt;/a&gt; to familiarize yourself with Craft concepts as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T21:51:19.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20686" PostTypeId="1" AcceptedAnswerId="20687" CreationDate="2017-06-01T21:55:15.850" Score="-1" ViewCount="1087" Body="&lt;p&gt;I come from a Node/React/Angular background and am entirely new to CMSs and for the life of me can't figure out how to post an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm on the Entries page, and have one that I can edit, but how do I add more?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YwCFh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YwCFh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added sections with field, as you can see below, but where do I get to the point where I can actually add the things in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this question is super-beginner and probably entirely obvious, but Craft's documentation is pretty horrible and I'm not going to pay the $40 for instructions that should be free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c4Qby.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4Qby.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6802" LastActivityDate="2017-06-01T22:19:55.570" Title="How to create an entry" Tags="&lt;entries&gt;&lt;entry&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20687" PostTypeId="2" ParentId="20686" CreationDate="2017-06-01T22:19:55.570" Score="5" Body="&lt;p&gt;From your screenshot, it looks like you've added a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#section-types&quot; rel=&quot;noreferrer&quot;&gt;Single section&lt;/a&gt;, which by definition, there will only be one &quot;entry&quot; in.  Since there aren't any other types of sections, you don't have a &quot;New Entry&quot; button in the upper right of the entry index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to create sections that you can create multiple entries in, you'll need to create either a Channel or Structured Section (under Settings-&gt;Sections in the Control Panel).  The difference between those is that the latter allows you to assign order and and hierarchy to the entries in them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-01T22:19:55.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20690" PostTypeId="2" ParentId="20662" CreationDate="2017-06-02T19:14:34.130" Score="1" Body="&lt;p&gt;Think we figured out the root cause of this - we have a load balancer in front of our origin server and, long story short, that load balancer was communicating with our origin server via HTTP, causing the extra http redirect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixing that issue would be a long and arduous process so, through some infrastructure updates, we'll be moving away from using the load balancer entirely. &lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2017-06-02T19:14:34.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20691" PostTypeId="1" CreationDate="2017-06-02T22:48:42.973" Score="1" ViewCount="48" Body="&lt;p&gt;I'm supposed to display the most recent 6 items from a Matrix field but provide a slider so that the user can navigate through them (hiding the ones on the left, displaying new ones on the right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of how to do this in JavaScript, but I'm new to Twig and templating in general. How should I approach this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating to show how I would in Javascript using the &lt;a href=&quot;https://kenwheeler.github.io/slick/&quot; rel=&quot;nofollow noreferrer&quot;&gt;slick&lt;/a&gt; library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;pictures&quot;&amp;gt;&#xA;  &amp;lt;img src=&quot;example1.png&quot; /&amp;gt;&#xA;  &amp;lt;img src=&quot;example2.png&quot; /&amp;gt;&#xA;  &amp;lt;img src=&quot;example2.png&quot; /&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;js&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.pictures').slick({&#xA;  infinite: true,&#xA;  slidesToShow: 6,&#xA;  slidesToScroll: 6&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and how I'm trying to with Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;.pictures&quot;&amp;gt;&#xA;  {% for block in entry.recentWorkExamples %}&#xA;     &amp;lt;div class=&quot;col-md-4 example-container&quot;&amp;gt;&#xA;       &amp;lt;div class=&quot;example&quot;&amp;gt;&#xA;         {% set rw_image = block.recentWorkImage.first() %}&#xA;           &amp;lt;img src=&quot;{{ rw_image.url }}&quot; /&amp;gt;&#xA;       &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problems is, it doesn't swipe but all of the pictures pile up.&lt;/p&gt;&#xA;" OwnerUserId="6802" LastEditorUserId="6802" LastEditDate="2017-06-04T15:09:44.330" LastActivityDate="2017-06-08T03:01:06.787" Title="Change which Matrix items displayed" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20692" PostTypeId="1" CreationDate="2017-06-03T05:51:12.827" Score="1" ViewCount="72" Body="&lt;p&gt;I'm creating a site which has a products section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created an entries section called 'Products'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up some categories, i.e. 'Category One, 'Category Two', 'Category Three'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also created a related entries field so I can related products to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the client adds a new product in 'Category One', they should only be able to relate entries that are in 'Category Two' or 'Category Three'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I can restrict the results returned in an entries field in the Control Panel to a specific category?&lt;/p&gt;&#xA;" OwnerUserId="6806" LastEditorUserId="57" LastEditDate="2017-06-04T03:32:01.687" LastActivityDate="2017-06-04T04:33:03.677" Title="Select Related Entries from a specific category in CP" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20693" PostTypeId="1" CreationDate="2017-06-03T17:47:07.730" Score="1" ViewCount="1120" Body="&lt;p&gt;This is very basic as I am new to Craft CMS, but I created a Plain Text field in the Homepage section labeled &quot;Tagline&quot;. When I enter the Twig code &lt;code&gt;{{ entry.tagline }}&lt;/code&gt; into the index.html template, I get the error that the variable &quot;entry&quot; does not exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My index.html is at the root of the public folder.&lt;/p&gt;&#xA;" OwnerUserId="4969" LastEditorUserId="57" LastEditDate="2017-06-04T03:28:18.703" LastActivityDate="2017-06-04T03:28:18.703" Title="Variable &quot;entry&quot; does not exist" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20694" PostTypeId="1" AcceptedAnswerId="20701" CreationDate="2017-06-03T19:38:25.953" Score="1" ViewCount="363" Body="&lt;p&gt;I am using &lt;a href=&quot;https://github.com/jonthornton/jquery-timepicker&quot; rel=&quot;nofollow noreferrer&quot;&gt;jQuery-timepicker&lt;/a&gt; to give the user an option to pick a starting time and ending time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My init looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.timepicker').timepicker({&#xA;    scrollDefault: 'now'&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I save the entry as attached (screen below) it is displaying the time + 6 minutes.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QtsiI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QtsiI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ujqhz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ujqhz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myTimes][{{ block.id }}][fields][startDateTime][date]&quot; class=&quot;form-control datepicker&quot; value=&quot;{{ block.startDateTime|date('m/d/Y') }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myTimes][{{ block.id }}][fields][startDateTime][time]&quot; class=&quot;form-control timepicker&quot; value=&quot;{{ block.startDateTime|date('h:m') }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;fields[myTimes][{{ block.id }}][fields][endDateTime][time]&quot; class=&quot;form-control timepicker&quot; value=&quot;{{ block.endDateTime|date('h:m') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I save my form, everything looks like it is saving correctly, its always +6 min. I'm not sure what I am doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another example. I have saved for 9:00PM - 10:00PM&#xA;It saves correctly, but the template shows +6 still. :)&lt;a href=&quot;https://i.stack.imgur.com/Q396d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q396d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/qOS9r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qOS9r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/obz5y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/obz5y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-06-04T02:32:04.570" LastActivityDate="2017-06-04T15:01:29.467" Title="How can I correctly set the time of a dateTime field from a front-end form?" Tags="&lt;templating&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20695" PostTypeId="1" CreationDate="2017-06-03T20:10:25.937" Score="2" ViewCount="228" Body="&lt;p&gt;I have a site with three broad sections of content:  Humanities, Business, and Music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within each of these are sub-sections. Under &quot;Humanities&quot;, for example, is Politics, History, Economics, etc. Within these are more sections as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the correct way to organize such a hierarchy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each index page, I want all of the posts for the entire hierarchy below it. So going to &lt;code&gt;/humanities&lt;/code&gt; would have a feed of all of the latest entries for every section below it. Navigating to &lt;code&gt;/humanities/politics/&lt;/code&gt; would show just politics and its subsections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at using categories, but want the url structure to reflect all the way down the chain. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="6764" LastEditorUserId="6764" LastEditDate="2017-06-03T20:22:45.760" LastActivityDate="2019-02-15T19:32:03.063" Title="Organizing Entry, Section, and Category hierarchies" Tags="&lt;entries&gt;&lt;categories&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20696" PostTypeId="2" ParentId="20693" CreationDate="2017-06-03T21:48:20.817" Score="1" Body="&lt;p&gt;I would say that the index.html should be within your templates folder. Is it? &#xA;And make sure that you Homepage section is actually pointing to that template. Look at your sections part within Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="6807" LastActivityDate="2017-06-03T21:48:20.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20697" PostTypeId="1" CreationDate="2017-06-03T22:23:11.197" Score="1" ViewCount="553" Body="&lt;p&gt;Our checkout is only for registered users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally you'd just provide a checkbox that says: Subscribe to Mailchimp? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="57" LastEditDate="2017-06-04T03:30:14.470" LastActivityDate="2017-10-16T21:08:16.477" Title="Is it possible to subscribe a user to Mailchimp during checkout in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20699" PostTypeId="2" ParentId="20697" CreationDate="2017-06-03T23:56:23.173" Score="2" Body="&lt;p&gt;We offer this during checkout.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use André Elvan's: &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/mailchimp-subscribe-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We implement it simply as an ajax call that happens in the background as the order is submitted for payment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if ($('#subscribeMC').prop('checked')) {&#xA;        // Fire this off asynchronously and with any luck it just works...&#xA;        $.ajax({&#xA;            type: 'POST',&#xA;            url: '/actions/mailchimpSubscribe/list/Subscribe',&#xA;            data: {&#xA;                CRAFT_CSRF_TOKEN: window.csrfTokenValue,&#xA;                email: email,&#xA;                mcvars: {&#xA;                    FNAME: firstName,&#xA;                    LNAME: lastName,&#xA;                }&#xA;            }&#xA;        });&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing I like about our implementation is that I added a 'check if subscribed' function to the above plugin and we only show the checkbox if they're not already on the list - it's one of my pet hates when I keep seeing a newsletter box for a list I know I am already on.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    type: 'POST',&#xA;    url: '/actions/mailchimpSubscribe/list/checkIfSubscribed',&#xA;    data: {&#xA;        'CRAFT_CSRF_TOKEN': window.csrfTokenValue,&#xA;        'email': email&#xA;    },&#xA;    success: function(response) {&#xA;        //They're on the newsletter - hide the subscription form&#xA;        if (response.success) {&#xA;            $container.hide();&#xA;            $heading.hide();&#xA;        }&#xA;        //They're not on the list, bait the hook&#xA;        else {&#xA;            $container.fadeIn('fast');&#xA;            $heading.fadeIn('fast');&#xA;        }&#xA;    },&#xA;    //something went wrong, might as well show the form&#xA;    error: function(response) {&#xA;        $container.fadeIn('fast');&#xA;        $heading.fadeIn('fast');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to avoid JS/ajax, then I guess you could implement your own controller that you submit to at any point (e.g. intercept the commerce pay controller) - that first does your Mailchimp stuff and then calls the native controller using Craft's &lt;code&gt;runController&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the above JS works well and we get a bunch of newsletter subs with it every day...during subscribe checkout is by far the most effective way of increasing your mailing list we've found.  (And, please, whatever else you may do, &lt;strong&gt;do not&lt;/strong&gt; implement a page covering newsletter signup popover!!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-04T05:17:44.820" LastActivityDate="2017-06-04T05:17:44.820" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20700" PostTypeId="2" ParentId="20692" CreationDate="2017-06-04T00:01:39.387" Score="1" Body="&lt;p&gt;There is no native functionality for this at the current time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a plugin to extend the Products field-type (which itself extends the base entries field-type) - to provide this filter functionality.  That is you'd add a categories chooser to the field type and then filter the available products using that category in your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; would get you started on the plugin scaffolding, and I'd look at &lt;code&gt;/craft/plugins/commerce/fieldtypes/Commerce_ProductsFieldType.php&lt;/code&gt; and the native Craft categories field type to get started.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-04T04:33:03.677" LastActivityDate="2017-06-04T04:33:03.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20701" PostTypeId="2" ParentId="20694" CreationDate="2017-06-04T15:01:29.467" Score="1" Body="&lt;p&gt;Thank you everyone for your suggestions - I need to keep reading/digging more to fully understand, but it seems that it was just a formatting issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.startDateTime|date('H:i:s') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Renders the correct time on the template.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-06-04T15:01:29.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20702" PostTypeId="1" AcceptedAnswerId="20717" CreationDate="2017-06-04T19:10:33.130" Score="1" ViewCount="232" Body="&lt;p&gt;UPDATE: Question edited to be clearer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had an issue where it seems calling a plugin’s controller via an URL caused the site itself to throw a 500 error (i.e. not being accessible at all).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin loads external cinema events (as an XML) and creates entries for films and shows. I’ve made it accessible in the CP, where I hit a button to update, and it will return a log which gets printed out in the CP. Triggering it from the plugins page in the CP works perfectly. Now I wanted to create a cronjob that loads the external data on regular intervals – basically calling the plugin. After some trail and error, I managed to make the plugin’s controller callable from the outside.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is – is there anything special to be aware of when calling plugins from the outside? Is there a difference if it’s called as a cronjob or if it’s done manually through the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code of the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class UpdateProgram_ProgramController extends BaseController&#xA;{&#xA;  // Allowing to be called without being logged in&#xA;  protected $allowAnonymous = true;&#xA;&#xA;  public function actionUpdate()&#xA;  {&#xA;  // Disabling having to call the plugin by POST, to access directly by URL&#xA;  // this-&amp;gt;requirePostRequest();&#xA;&#xA;    $log = craft()-&amp;gt;updateProgram_program-&amp;gt;update();&#xA;&#xA;    // If there are entries in the log, changes have happened&#xA;    if ( count($log) ) {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Program updated.'));&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;           'log' =&amp;gt; $log&#xA;        ));&#xA;    }&#xA;    // Otherwise, give an error message&#xA;    else {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Nothing to update!'));&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is how I'm calling it from the cronjob:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MAILTO=[my.email@address]&#xA;# Run updateProgram every night at 3am&#xA;0 3 * * * wget http://[my.site]/actions/updateProgram/program/update &amp;gt; /dev/null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When trying it from the browser, I used the same URL&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="5771" LastEditDate="2017-06-06T08:18:39.713" LastActivityDate="2017-06-06T08:26:08.900" Title="Calling plugin controller externally fails with 500 error" Tags="&lt;plugin-development&gt;&lt;error&gt;&lt;cron&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20703" PostTypeId="1" AcceptedAnswerId="20714" CreationDate="2017-06-05T07:15:36.280" Score="2" ViewCount="131" Body="&lt;p&gt;How can I check if today is the second or last sunday of this month?&#xA;My effort:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set now = now|date('U') %}&#xA;{% set monthyear = now|date('F Y') %}&#xA;{% set secondSunday = now|date_modify(&quot;#{monthyear} second sunday&quot;)|date('U') %}&#xA;{% set lastSunday = now|date_modify(&quot;#{monthyear} last sunday&quot;)|date('U') %}&#xA;&#xA;{# check if now is second or last sunday #}                    &#xA;{% if now == secondSunday or now == lastSunday %}&#xA;   {# YES, today is the second or the last sunday #}&#xA;{% else %}&#xA;   {# NOPE #}&#xA;{% endif %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I keep getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DateTime::modify(): Failed to parse time string (juni 2017 second sunday) at position 0 (j): The timezone could not be found in the database&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Maybe it doesn't work because the monthyear variable is formed in dutch and not english? (juni = june) If this is the case, how can I modify this to english in order to get it to work?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, my timezone is correctly set to UTC+2 (CEST) - Europe/Brussels via Settings &gt; General&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2017-06-05T21:05:52.400" Title="Check if we're the second or last sunday of the month today" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20704" PostTypeId="1" CreationDate="2017-06-05T08:39:54.080" Score="2" ViewCount="246" Body="&lt;p&gt;I was wondering if someone could help me with the following issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm saving assets on Amazon S3 and as per Craft's documentation Craft is keeping a copy of remote assets in &lt;code&gt;storage/runtime/assets/sources&lt;/code&gt; folder. The issue is that this website has a lot of images and &lt;code&gt;sources&lt;/code&gt; folder in storage is taking up a lot of space. It can go up to 5GB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can tell Craft to not keep a copy of remote assets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="6810" LastActivityDate="2020-03-06T09:33:04.410" Title="Remote assets space issue storage/runtime/assets/sources" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20705" PostTypeId="2" ParentId="11070" CreationDate="2017-06-05T11:47:27.610" Score="1" Body="&lt;p&gt;Change the preferred locale to the new locale where you want to transfer your content. Settings - &gt; My account -&gt; Preferred Locale.&lt;/p&gt;&#xA;" OwnerUserId="6811" LastActivityDate="2017-06-05T11:47:27.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20706" PostTypeId="2" ParentId="20676" CreationDate="2017-06-05T14:45:33.967" Score="1" Body="&lt;p&gt;Issue was not related to the above code but more due to other loops in template. thanks for comments.&lt;/p&gt;&#xA;" OwnerUserId="6798" LastActivityDate="2017-06-05T14:45:33.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20708" PostTypeId="2" ParentId="20704" CreationDate="2017-06-05T15:11:55.460" Score="3" Body="&lt;p&gt;You can instruct Craft not to keep a local copy of remote assets by setting the &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#maxcachedcloudimagesize&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;maxCachedCloudImage&lt;/code&gt; config variable&lt;/a&gt; to &lt;code&gt;0&lt;/code&gt; (zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be worth experimenting with that setting, to find a balance between caching some smaller images locally (thereby speeding up transformations), and preserving disk space.&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="975" LastEditDate="2020-03-06T09:33:04.410" LastActivityDate="2020-03-06T09:33:04.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20709" PostTypeId="2" ParentId="20564" CreationDate="2017-06-05T16:20:51.530" Score="1" Body="&lt;p&gt;At the moment, that's not possible with Craft itself. That might be possible in Craft 3, as cloning sites will be an option -- though all of your sites would also have to be in Craft. Not sure if sharing information between sites will exist in C3 or not though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You COULD use Craft to create the navigation fairly easily. Then you could create a blank template (not extending your base layout) that only contains the navigation, and then loading that via AJAX on the other sites into a nav container div.&lt;/p&gt;&#xA;" OwnerUserId="6710" LastActivityDate="2017-06-05T16:20:51.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20710" PostTypeId="1" AcceptedAnswerId="20712" CreationDate="2017-06-05T20:27:06.457" Score="2" ViewCount="98" Body="&lt;p&gt;In a template, I want to show only enabled categories. I can't figure out how to filter the returned categories by only enabled ones, without doing it in the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.level(1) if category.enabled %}&#xA;  # only enabled categories&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but instantiates the disabled categories, even though they won't be used.&lt;/p&gt;&#xA;" OwnerUserId="6764" LastActivityDate="2017-06-05T20:56:18.803" Title="Query for enabled categories" Tags="&lt;templating&gt;&lt;categories&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20711" PostTypeId="1" AcceptedAnswerId="20713" CreationDate="2017-06-05T20:50:55.663" Score="2" ViewCount="413" Body="&lt;p&gt;Working on a SPA with Vue and Craft and looking to check if a user is logged in to run some Vue conditional logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine that will then enable me to check if the logged in user owns content to return as well?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="57" LastEditDate="2017-06-05T20:57:54.337" LastActivityDate="2017-06-05T21:02:13.717" Title="Check for logged in user with the Element API plugin" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20712" PostTypeId="2" ParentId="20710" CreationDate="2017-06-05T20:56:18.803" Score="2" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% for category in craft.categories.level(1).enabled(true) %}&#xA;    # only enabled categories&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-05T20:56:18.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20713" PostTypeId="2" ParentId="20711" CreationDate="2017-06-05T21:02:13.717" Score="2" Body="&lt;p&gt;Assuming you want to do this from your transformer, then something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function($entry) {&#xA;&#xA;    $isLoggedIn = craft()-&amp;gt;userSession-&amp;gt;isLoggedIn(); &#xA;&#xA;    if ($isLoggedIn) {&#xA;        // Do your custom logic.&#xA;    }&#xA;&#xA;    return array(&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'description' =&amp;gt; (string) $entry-&amp;gt;description,&#xA;        'photos' =&amp;gt; $photos&#xA;    );&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-05T21:02:13.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20714" PostTypeId="2" ParentId="20703" CreationDate="2017-06-05T21:05:52.400" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Maybe it doesn't work because the monthyear variable is formed in dutch and not english? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes that's part of the problem. Have a look at PHP's &lt;a href=&quot;http://php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;relative formats&lt;/a&gt; page to see what it supports. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can actually pull off what you're doing with the &lt;code&gt;this&lt;/code&gt; keyword.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set secondSunday = now|date_modify(&quot;second sunday of this month&quot;)%}&#xA;{% set lastSunday = now|date_modify(&quot;last sunday of this month&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also don't need to define (or override) &lt;a href=&quot;https://craftcms.com/docs/templating/global-variables#now&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;now&lt;/code&gt;&lt;/a&gt; since Craft will always set that to a DateTime object for you. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-06-05T21:05:52.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20715" PostTypeId="2" ParentId="20702" CreationDate="2017-06-05T21:14:38.563" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So my question is – is there anything special to be aware of when calling plugins from the outside? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not particularly.  They're both hitting the same controller endpoint in your plugin, but there are about a million &lt;a href=&quot;https://www.gnu.org/software/wget/manual/wget.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;flags/options&lt;/a&gt; you can pass into wget to change it's runtime behaviors you might want to play with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I stick with using &lt;a href=&quot;https://curl.haxx.se/&quot; rel=&quot;nofollow noreferrer&quot;&gt;cURL&lt;/a&gt; for cronjobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, the behavior you describe sounds like a webserver/Apache crash or segfault.  If they are long-running scripts and you inadvertently triggered them multiple times, maybe you hit some hard resource limits. If that's the case, the underlying error message would be in your web server's error logs for the 500 Internal Server Error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were Craft generated 500 ISEs, then the underlying error message would be in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-05T21:14:38.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20717" PostTypeId="2" ParentId="20702" CreationDate="2017-06-06T08:26:08.900" Score="2" Body="&lt;p&gt;It turned out that the problem was not in the &lt;code&gt;Controller&lt;/code&gt;but inthe &lt;code&gt;Service&lt;/code&gt; it was calling. There I load external data, and save any updates. The problem was when I was trying to save entries with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create new entry to save&#xA;$entry = new EntryModel();&#xA;// Set generic parameters&#xA;$entry-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('shows')-&amp;gt;id;&#xA;$entry-&amp;gt;typeId    = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('shows')-&amp;gt;type('show')-&amp;gt;id;&#xA;$entry-&amp;gt;authorId  = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;$entry-&amp;gt;enabled   = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key here is the phrase &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id&lt;/code&gt; which fails, as the user it not logged in when triggering from the &lt;code&gt;cronjob&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the line to test if there is a user made the plugin work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// If logged in, set author (as apposed to running from cron)&#xA;if ( craft()-&amp;gt;userSession-&amp;gt;getUser() ) {&#xA;  $entry-&amp;gt;authorId  = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-06-06T08:26:08.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20718" PostTypeId="2" ParentId="17417" CreationDate="2017-06-06T08:46:51.877" Score="2" Body="&lt;p&gt;Seems that you simply have to set all entries of a &lt;code&gt;related&lt;/code&gt; field at once, and as I tried to add them one by one, it only kept the last.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-06-06T08:46:51.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20719" PostTypeId="2" ParentId="19676" CreationDate="2017-06-06T09:43:41.820" Score="4" Body="&lt;h1&gt;No Current Good Solution&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Having liaised directly with Craft Support on this issue, the outcome after a bit of research was that there is not currently any good solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently, Imagick is really, really bad at animated GIFs, but there's no other option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My workaround was to edit the templating for gif images, so a super-simplified version would look something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set src = image.getUrl('someTransform') %}&#xA;&#xA;{# No transform used for gifs #}&#xA;{% if image.getMimeType() == 'image/gif' %}&#xA;    {% set src = image.getUrl() %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;img src=&quot;{{ src }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whilst this did result in larger than ideal file sizes for gifs (because the original file was being used rather than smaller transforms), it prevents the issues detailed above. Not great, but better than the enormous file sizes we were seeing and the tasks getting stuck!&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Possibilities in Craft 3&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Apparently, Craft 3 allows for further image optimisation after transforms, and there's a &lt;a href=&quot;https://github.com/nystudio107/craft3-imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that capitalises on this already, so hopefully, we'll see some improvement in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="2314" LastActivityDate="2017-06-06T09:43:41.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20720" PostTypeId="1" CreationDate="2017-06-06T12:33:18.953" Score="2" ViewCount="361" Body="&lt;p&gt;I'm trying to use supersort to sort my entries based on date values in a supertable field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far but it's not working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('artists') %}&#xA;{% set entries = artists | supersort('sortAs', '{{ tourDates.tourDate }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;tourDates is the supertable handle tourDate is the date field in the table. There can be multiple date entries in one table so it would need to bring them out in order as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure this is even possible.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-06-06T13:19:15.457" Title="Sorting SuperTable Field with SuperSort?" Tags="&lt;plugin-supertable&gt;&lt;plugin-supersort&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20721" PostTypeId="2" ParentId="20720" CreationDate="2017-06-06T13:19:15.457" Score="2" Body="&lt;p&gt;I think you need to add 'object' to your syntax if you're using {{ }}:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.tourDates.tourDate }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Else it's &lt;code&gt;{ tourDates.tourDate }&lt;/code&gt; I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the plugins &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; under Advanced sorting.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-06-06T13:19:15.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20722" PostTypeId="1" CreationDate="2017-06-06T13:39:26.580" Score="1" ViewCount="547" Body="&lt;p&gt;I have a Craft project set up locally, and I have installed a &lt;a href=&quot;https://github.com/OliveStudio/olivemenus/wiki/01.-Introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; for menus. I have set up the menu with the plugin in the administration, and I have managed to output the menu in the template by using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.olivemenus.getMenuHTML('topBar')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, I would like to use my own HTML, and only use the links from the created plugin. This is the template that I would like to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;div class=&quot;top-bar&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;top-bar-title&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;/&quot;&amp;gt;&#xA;              &amp;lt;span class=&quot;first&quot;&amp;gt;Forandrings&amp;lt;/span&amp;gt;&amp;lt;span class=&quot;second&quot;&amp;gt;fabrikken&amp;lt;/span&amp;gt;&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div&amp;gt;&#xA;          &amp;lt;div class=&quot;top-bar-left&quot;&amp;gt;&#xA;            &amp;lt;ul class=&quot;dropdown menu js-topbar-menu&quot;&amp;gt;&#xA;              &amp;lt;li&amp;gt;&#xA;                &amp;lt;!--&#xA;                &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-menu-link&quot;&amp;gt;&amp;lt;i class=&quot;ion-android-menu&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;span&amp;gt;Meny&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;                --&amp;gt;&#xA;                &amp;lt;a href=&quot;#&quot; class=&quot;dropdown-menu-link&quot;&amp;gt;&#xA;                  &amp;lt;div id=&quot;nav-icon1&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&#xA;                  &amp;lt;/div&amp;gt;&#xA;                  &amp;lt;span class=&quot;menu-text&quot;&amp;gt;Meny&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div class=&quot;top-bar-right&quot;&amp;gt;&#xA;            &amp;lt;ul class=&quot;menu&quot;&amp;gt;&#xA;              &amp;lt;li class=&quot;menu-search-bar show-for-large&quot;&amp;gt;&#xA;                &amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;                  &amp;lt;div class=&quot;search&quot;&amp;gt;&#xA;                    &amp;lt;button type=&quot;submit&quot; class=&quot;search-submit-button&quot;&amp;gt;&#xA;                      &amp;lt;i class=&quot;search-icon ion-android-search&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                    &amp;lt;/button&amp;gt;&#xA;                    &amp;lt;input name=&quot;q&quot;&amp;gt;&#xA;                  &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/form&amp;gt;&#xA;              &amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  &amp;lt;div class=&quot;dropdown-content&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;small-12 columns hide-for-large&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li class=&quot;menu-search-bar search-bar-small-screen&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;search&quot;&amp;gt;&#xA;              &amp;lt;i class=&quot;search-icon ion-android-search&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;              &amp;lt;input name=&quot;search&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;row small-up-1 medium-up-3 large-up-5&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;/page.html&quot;&amp;gt;Ideen&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/page.html&quot;&amp;gt;Innholdsside&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/news/artikkel&quot;&amp;gt;Artikkel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;/page.html&quot;&amp;gt;Hva gjør vi?&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/page.html&quot;&amp;gt;Innholdsside&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/news/artikkel&quot;&amp;gt;Artikkel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;/page.html&quot;&amp;gt;Proff&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/article-list&quot;&amp;gt;Innholdsside&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/news/artikkel&quot;&amp;gt;Artikkel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;/page.html&quot;&amp;gt;Kunnskapsenter&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/page.html&quot;&amp;gt;Innholdsside med lengre tittel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/news/artikkel&quot;&amp;gt;Artikkel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;/page.html&quot;&amp;gt;Om oss&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/page.html&quot;&amp;gt;Innholdsside&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;/news/artikkel&quot;&amp;gt;Artikkel&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do that?&#xA;I have tried with using the function that I saw in the plugin file &lt;code&gt;olivemenus/services/OlivemenusService.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.olivemenus.getMenuByHandle('topBar')}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because I thought that function would just return the items of the menu, but I got an error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Neither the property &quot;getMenuByHandle&quot; nor one of the methods&#xA;  &quot;getMenuByHandle()&quot;, &quot;getgetMenuByHandle()&quot;/&quot;isgetMenuByHandle()&quot; or&#xA;  &quot;__call()&quot; exist and have public access in class&#xA;  &quot;Craft\OlivemenusVariable&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6735" LastEditorUserId="57" LastEditDate="2017-06-06T16:49:02.960" LastActivityDate="2021-03-17T21:14:03.497" Title="Customizing template of the Olive Menus plugin" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;menu&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20723" PostTypeId="1" CreationDate="2017-06-06T14:24:45.940" Score="4" ViewCount="94" Body="&lt;p&gt;I'm making a plugin and I need to get an array from a certain category group where the levels of the array are the same as the level of the categories in the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I used the following code to get all categories in a group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'groupHandle';&#xA;$array = $criteria-&amp;gt;find();`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine but I want to create something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$array[&#xA;    level1:[ &#xA;        level2[&#xA;            level3,&#xA;            level3,&#xA;        ],&#xA;        level2[], &#xA;        level2[]&#xA;    ],&#xA;    level1:[ &#xA;        level2[],&#xA;        level2[], &#xA;        level2[]&#xA;    ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope you get the idea...&#xA;I could make a foreach in a foreach in a foreach but that's not very classy.&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="22" LastEditDate="2017-06-06T22:58:39.940" LastActivityDate="2018-01-15T10:35:37.040" Title="Store categories in array by level in controller" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;elementcriteriamodel&gt;&lt;controller&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20724" PostTypeId="1" AcceptedAnswerId="20726" CreationDate="2017-06-06T15:26:58.137" Score="1" ViewCount="79" Body="&lt;p&gt;I'm trying to access the &lt;code&gt;order&lt;/code&gt; and &lt;code&gt;orderHistory&lt;/code&gt; model via &lt;code&gt;onBeforeSendEmail&lt;/code&gt; event. I can see that in &lt;code&gt;Commerce_EmailsService.php&lt;/code&gt; file on line 311 the event is created with those params and passed to &lt;code&gt;onBeforeSendEmail&lt;/code&gt;, but when I try to access them from my plugin, they are not there. I thought they would be available in the &lt;code&gt;variables&lt;/code&gt; param, but they are not (or I'm doing something wrong here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if/how I can access those models from &lt;code&gt;onBeforeSendEmail&lt;/code&gt; event?&lt;/p&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2017-06-06T17:21:31.923" Title="onBeforeSendEmail event triggered from Commerce_EmailsService" Tags="&lt;plugin-craftcommerce&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20725" PostTypeId="2" ParentId="9400" CreationDate="2017-06-06T16:58:57.450" Score="1" Body="&lt;p&gt;For websites in Switzerland i recommend to use Cyon (&lt;a href=&quot;https://www.cyon.ch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cyon.ch/&lt;/a&gt;). It runs on  LiteSpeed Webserver and offers a easy to integrate fullpage cache solution comparable to Varnish cache without any extra cost (more information on LIghtSpeed Cache in German: &lt;a href=&quot;https://www.cyon.ch/blog/LiteSpeed-Cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cyon.ch/blog/LiteSpeed-Cache&lt;/a&gt;).&#xA;It speeds up the craft installation to a maximum. The LiteSpeed Cache function is already available on the smallest hosting package for only CHF 9.90.&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2017-06-06T16:58:57.450" CommentCount="0" CommunityOwnedDate="2017-06-06T16:58:57.450" ContentLicense="CC BY-SA 3.0" />
  <row Id="20726" PostTypeId="2" ParentId="20724" CreationDate="2017-06-06T17:21:31.923" Score="2" Body="&lt;p&gt;You don't show what code you're trying to use to access the parameters, but something like this should work from your main plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('commerce_emails.beforeSendEmail', function($event) {&#xA;        $params = $event-&amp;gt;params;&#xA;&#xA;        $craftEmail = $params['craftEmail'];&#xA;        $commerceEmail = $params['commerceEmail'];&#xA;        $order = $params['order'];&#xA;        $orderHistory = $params['orderHistory'];&#xA;&#xA;        ...&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-06T17:21:31.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20727" PostTypeId="1" AcceptedAnswerId="20744" CreationDate="2017-06-06T17:53:11.200" Score="1" ViewCount="1158" Body="&lt;p&gt;My client needs to input apostrophes in text fields for staff names, such as &amp;rsquo; or just the plain ' and as you can imagine, it is causing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this &lt;code&gt;replace({'\'',''})&lt;/code&gt; and this &lt;code&gt;replace({'\&amp;amp;rsquo;',''})&lt;/code&gt; but to no success. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="6130" LastActivityDate="2017-06-08T00:05:00.330" Title="Remove Quotes from Text Fields" Tags="&lt;templating&gt;&lt;replace&gt;&lt;escaping&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20728" PostTypeId="2" ParentId="20722" CreationDate="2017-06-06T23:22:18.960" Score="1" Body="&lt;p&gt;I wrote up a blog post on how to do Client &lt;a href=&quot;https://caffeinecreations.ca/blog/client-controlled-site-navigation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controlled Navigation&lt;/a&gt;. It's actually quite simple. All you need to do is create a structure for your nav, a couple of fields and then output the structure using any HTML you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final code from the blog post is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation %}&#xA;&#xA; {% set pages = craft.entries.section('navigation').level('&amp;lt;='~2) %}&#xA;&#xA; &amp;lt;ul&amp;gt;&#xA;   {% nav page in pages %}&#xA;     &amp;lt;li&amp;gt;&#xA;       {# Check for entry type / get related entry #}&#xA;       {% if page.type == 'internalLink' %}&#xA;           {% set linkedEntry = page.sitePageLink.limit(1).first() %}&#xA;           &amp;lt;a href=&quot;{{ linkedEntry.url }}&quot;  data-url=&quot;{{ linkedEntry.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;       {% endif %}&#xA;&#xA;       {# Check for entry type / get offsiteLinks #}&#xA;       {% if page.type == 'offsiteLink' %}&#xA;           &amp;lt;a href=&quot;{{ page.offSiteLink }}&quot;  data-url=&quot;{{ page.offSiteLink }}&quot; {% if page.openInNewTab == '1' %}target=&quot;_blank&quot;{% endif %}&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;       {% endif %}&#xA;&#xA;       {% ifchildren %}&#xA;          &amp;lt;ul class=&quot;dropdown&quot; style=&quot;background:pink&quot;&amp;gt;&#xA;              {% children %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;&#xA;     &amp;lt;/li&amp;gt;&#xA;   {% endnav %}&#xA; &amp;lt;/ul&amp;gt;&#xA;&#xA; {% endset %}&#xA;&#xA; {# replace data-uri with active class #}&#xA; {{ navigation|replace({('data-url=&quot;' ~ craft.request.getUrl() ~ '&quot;'): 'class=&quot;active&quot;'})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-06-06T23:22:18.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20729" PostTypeId="1" CreationDate="2017-06-07T08:19:10.780" Score="2" ViewCount="53" Body="&lt;p&gt;I want to create a Excel file with all used slugs in my Craft website.&#xA;I've searched for a plugin but without succes. I also tried to find a useful table in the Craft database, also without succes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2017-06-07T09:12:17.727" Title="Receive all used slugs" Tags="&lt;plugins&gt;&lt;slug&gt;&lt;entry-slug&gt;&lt;plugin-sitemap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20730" PostTypeId="2" ParentId="20729" CreationDate="2017-06-07T09:12:17.727" Score="2" Body="&lt;p&gt;I already found a solution. I just created a simple query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT content.elementId entryId, title, uri&#xA;FROM `craft_content` content&#xA;JOIN craft_elements elements ON elements.id = content.elementId&#xA;JOIN `craft_entries` entries ON entries.`id` = content.`elementId`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = &#xA;elements.id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2017-06-07T09:12:17.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20731" PostTypeId="1" CreationDate="2017-06-07T09:12:58.680" Score="2" ViewCount="382" Body="&lt;p&gt;Working on a site that has a bunch of different locales, I'm bumping into the following issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On an entry in locale X, I have an image that is displayed with a transform applied to it. However, &lt;code&gt;getUrl()&lt;/code&gt;on the asset returns the following url: &lt;code&gt;/benl/cpresources/404?x=6obDEISgU&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, when I add that exact same image to an entry in the site's main locale and view it on the front-end, the transform is generated and the image is displayed correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I then go back to the other entry in locale X (that has that same image), it uses the generated transform (from the entry in the main locale) and the page works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks like the transformed images can't be generated on the entry in the none-standard locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some settings/parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;locales live in their own subfolder as per &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;basePath&lt;/code&gt; is set to the main site's document root, without the locale folder&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;baseUrl&lt;/code&gt; is set the main site url, without the locale segment&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any pointers as to how to troubleshoot and/or fix this would be appreciate :)&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-06-07T19:36:39.193" Title="Image transform not working with different locales" Tags="&lt;localization&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20732" PostTypeId="1" CreationDate="2017-06-07T11:59:26.727" Score="1" ViewCount="127" Body="&lt;p&gt;I am working on a plugin using the getCriteria function, but for every Element Type I put, I always get an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;No element type exists by the type “Comerce_Group”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(&quot;Comerce_Group&quot;);&#xA;$criteria-&amp;gt;number = $number;&#xA;return $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the Comerce_Group code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Comerce_GroupModel extends BaseModel&#xA;{  &#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array (&#xA;            'id' =&amp;gt; AttributeType::Number,&#xA;            'number' =&amp;gt; AttributeType::String,&#xA;            'itemTotal' =&amp;gt; AttributeType::Number,&#xA;        );&#xA;    }    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6822" LastEditorUserId="22" LastEditDate="2017-06-07T17:11:45.297" LastActivityDate="2018-07-03T04:26:34.157" Title="no element type exists with getCriteria and custom element type" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;elementcriteriamodel&gt;&lt;models&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20733" PostTypeId="1" CreationDate="2017-06-07T12:09:00.733" Score="1" ViewCount="186" Body="&lt;p&gt;After updating from Craft CMS 2.6.2973 to Craft CMS 2.6.2981 I get the following error message:&#xA;&lt;em&gt;&quot;Unable to load the &quot;Craft\xyz&quot; runtime after Craft update&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Craft\xyz&quot; is a Twig extension&lt;/li&gt;&#xA;&lt;li&gt;Fails in [install folder]\craft\app\vendor\twig\twig\lib\Twig\Environment.php line 900 (Twig_Environment::getRuntime())&lt;/li&gt;&#xA;&lt;li&gt;Twig_Environment::runtimes is an empty array&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anyone else experienced this problem, and know what is causing it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6823" LastEditorUserId="22" LastEditDate="2017-06-07T17:15:00.857" LastActivityDate="2017-06-10T16:11:16.173" Title="Unable to load the &quot;Craft\xyz&quot; runtime after Craft update" Tags="&lt;templating&gt;&lt;updating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20734" PostTypeId="1" CreationDate="2017-06-07T16:56:39.793" Score="3" ViewCount="330" Body="&lt;p&gt;I have a Freeform form where the user selects their area of interest from a dropdown. I need the email to be sent to different email addresses, based on the area of interest (some will have multiple addresses). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could do it with the dynamic recipients field, but that doesn't let me customize the label (it needs to be the area of interest, not the email address).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried setting the values of a regular dropdown field as the email address, with the areas of interest as the label, and then setting setting the admin recipients of the email to [[ interestedIn }} (the dropdown field name), and I can submit the form, but the email is not sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-06-07T16:56:39.793" Title="Select Freeform email recipients from dropdown (not dynamic recipients field)" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20735" PostTypeId="2" ParentId="20731" CreationDate="2017-06-07T19:36:39.193" Score="2" Body="&lt;p&gt;Ran into a similar problem on a past project, it could be your .htaccess acting up and redirecting the call to &lt;code&gt;cpresources&lt;/code&gt; to &lt;code&gt;/benl/cpresources&lt;/code&gt; as opposed to &lt;code&gt;/cpresources/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at your console on the page that the image is broken - you might be getting a 404 error. If that is the case...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding this rewrite rule helped my project and may help yours as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteRule ^cpresources/transforms/(.*)  /cpresources/transforms/$1 [L,R,NE,QSA]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add this rule to your .htaccess in your &lt;code&gt;/benl/&lt;/code&gt; directory before the default index.php rewrite.&lt;/p&gt;&#xA;" OwnerUserId="6755" LastActivityDate="2017-06-07T19:36:39.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20736" PostTypeId="1" AcceptedAnswerId="20741" CreationDate="2017-06-07T21:54:38.563" Score="1" ViewCount="365" Body="&lt;p&gt;I've got a user profile field named Books. This is an Entries field that contains entries from the Books channel. The idea is that users will save books to their their profile to show they have read them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also got a listing page which outputs all the books that are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to add a conditional that checks to see if the entry ID for a book is contained within the Books entries field in the current user's profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following but it doesn't work. It outputs as true for every entry, even those that aren't saved to the user's profile. Any help would be appreciated, thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&#xA;&#xA;{% if currentUser.booksField.contains(&quot;entry.id&quot;) %}&#xA;  I have read this book&#xA;{% else %}&#xA;  I haven't read this book&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-06-08T15:27:33.227" Title="Conditional to see if an Entries field in a user profile contains a certain entry ID" Tags="&lt;conditional&gt;&lt;user-profile&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20737" PostTypeId="2" ParentId="20736" CreationDate="2017-06-07T21:57:10.130" Score="1" Body="&lt;p&gt;My initial though was that you do not need to not put the &quot;entry.id&quot; in quotes because it's a variable reference, but the &lt;code&gt;contains()&lt;/code&gt; method appear to not work as expected here even when this was corrected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The booksField returns an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, so you should be able to fetch the list of IDs as a plain array and then use Twig's &lt;code&gt;in&lt;/code&gt; &quot;&lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/templates.html#containment-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;containment operator&lt;/a&gt;&quot; to search it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&#xA;&#xA;{% if entry.id in currentUser.booksField.ids() %}&#xA;  I have read this book&#xA;{% else %}&#xA;  I haven't read this book&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6825" LastEditorUserId="6825" LastEditDate="2017-06-08T15:27:33.227" LastActivityDate="2017-06-08T15:27:33.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20738" PostTypeId="1" AcceptedAnswerId="20739" CreationDate="2017-06-07T22:27:50.650" Score="2" ViewCount="148" Body="&lt;p&gt;I created a section with the wrong slug. I am now trying to delete the section to start over, or supply a new slug, but I can't do neither. How can I delete this section, or supply a new slug?&lt;/p&gt;&#xA;" OwnerUserId="6751" LastActivityDate="2017-06-07T23:38:05.010" Title="How do I delete a Section?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20739" PostTypeId="2" ParentId="20738" CreationDate="2017-06-07T22:36:01.413" Score="2" Body="&lt;p&gt;To delete an Section, go to Settings -&gt; Sections, then click the fain't, almost invisible icon to the right of the offending Section name.&lt;/p&gt;&#xA;" OwnerUserId="6751" LastEditorUserId="6751" LastEditDate="2017-06-07T23:38:05.010" LastActivityDate="2017-06-07T23:38:05.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20740" PostTypeId="2" ParentId="20732" CreationDate="2017-06-07T22:50:15.650" Score="1" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20732/no-element-type-exists-with-getcriteria-and-custom-element-type/20740#comment27848_20732&quot;&gt;Stephen&lt;/a&gt; pointed out, you're getting that error because your &lt;code&gt;Commerce_GroupModel&lt;/code&gt; class is a &lt;a href=&quot;https://craftcms.com/docs/plugins/models&quot; rel=&quot;nofollow noreferrer&quot;&gt;Model&lt;/a&gt; that extends &lt;code&gt;BaseModel&lt;/code&gt;, not an &lt;a href=&quot;https://pixelandtonic.com/blog/craft-element-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element&lt;/a&gt; &lt;a href=&quot;https://straightupcraft.com/events/introduction-to-element-types-in-craft-cms-part-1-of-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Type&lt;/a&gt;, which is what &lt;code&gt;ElementsService-&amp;gt;getCriteria()&lt;/code&gt; is looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you sure you actually need a custom element type here?  Depending on what you're going for, Models might be enough.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-07T22:50:15.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20741" PostTypeId="2" ParentId="20736" CreationDate="2017-06-07T23:04:39.640" Score="1" Body="&lt;p&gt;I don't think contains will behave like you expect (since &lt;code&gt;booksField&lt;/code&gt; will return an array of objects and your checking that against an integer &lt;code&gt;id&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not the prettiest, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}&#xA;&#xA;{% set read = false %}&#xA;{% for book in currentUser.booksField %}&#xA;    {% if book.id == entry.id %}&#xA;        {% set read = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if read %}&#xA;    I have read this book&#xA;{% else %}&#xA;    I haven't read this book&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you could make it more performant (especially if you have large numbers of books) by using &lt;a href=&quot;https://github.com/marionnewlevant/craft-mnbreakandcontinue&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marionnewlevant/craft-mnbreakandcontinue&lt;/a&gt;, which adds a &lt;code&gt;{% break %}&lt;/code&gt; Twig tag.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-07T23:04:39.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20743" PostTypeId="1" AcceptedAnswerId="20788" CreationDate="2017-06-07T23:36:56.300" Score="1" ViewCount="82" Body="&lt;p&gt;I noticed that when performing an image transition on an image, the resulting image name is computer gibberish. How can I maintain the original name of the image? Keeping the original name is important for SEO value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;When viewing a transformed image for first time, the url shows as  &lt;a href=&quot;http://aed.dev/cpresources/transforms/3?x=pEYIdgIMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://aed.dev/cpresources/transforms/3?x=pEYIdgIMS&lt;/a&gt; ... but! I have discovered that this url only appears the first time I view the page. every other page view will display the image with original file name&lt;/p&gt;&#xA;" OwnerUserId="6751" LastEditorUserId="6751" LastEditDate="2017-06-09T17:30:00.947" LastActivityDate="2017-06-10T19:57:43.127" Title="Why do Image transformations rename the image?" Tags="&lt;image-transforms&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20744" PostTypeId="2" ParentId="20727" CreationDate="2017-06-07T23:43:58.353" Score="1" Body="&lt;p&gt;As it happens, this solved my issue: &lt;code&gt;{{ personfirstandlastname|replace({'\'':''}) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, this isn't a valid Twig object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'\'',''}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... while this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'\'':''}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6130" LastEditorUserId="45" LastEditDate="2017-06-08T00:05:00.330" LastActivityDate="2017-06-08T00:05:00.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20745" PostTypeId="1" CreationDate="2017-06-08T01:22:07.780" Score="1" ViewCount="672" Body="&lt;p&gt;I am migrating an old EE site to Craft. The EE site has a filter feature for certain weblogs. It outputs a list of entries for a weblog filtering on year, program, etc... which are passed as URL parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to continue doing the same on the Craft site. I've setup custom routes to handle the url parameters. The following for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8tqFW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8tqFW.png&quot; alt=&quot;custom route examples with and without pagination url segment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With {% paginate %} using something that looks like this (a bit simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('videos').limit(10).order(fSort).date(fYear).relatedTo(fCategory).relatedTo(fProgram) as pageInfo, pageEntries %}&#xA;&#xA;&amp;lt;div class=&quot;pagination&quot;&amp;gt;&#xA;  {{...various pagination links using pageInfo...}}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;ul class=&quot;videolist&quot;&amp;gt;&#xA;  {% for entry in pageEntries %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The initial page of entries and pagination links outputs fine. But when going to subsequent pages via a pagination link (e.g., adding &quot;p2&quot; at the end of the URL), it can't find the route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does native pagination not work with custom routes? I tried different tokens for the pagination segment, but nothing seems to work.&lt;/p&gt;&#xA;" OwnerUserId="6628" LastActivityDate="2017-06-08T01:22:07.780" Title="Custom Routes with URL Parameters and Pagination" Tags="&lt;url&gt;&lt;routing&gt;&lt;pagination&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20746" PostTypeId="2" ParentId="20691" CreationDate="2017-06-08T03:01:06.787" Score="1" Body="&lt;p&gt;In your Twig example your '.picutures' class name includes a leading dot. Maybe not what you want there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in your slick configuration 'slidesToShow' should be 1 if you only want to show one slide at at time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And slick is going to operate on the direct descendants of the selector class identified in the configuration so the intervening divs may be causing a problem depending on the associated CSS.&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2017-06-08T03:01:06.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20747" PostTypeId="1" CreationDate="2017-06-08T09:22:55.890" Score="1" ViewCount="126" Body="&lt;p&gt;I have a simple nav set up using Globals in a table, but I'm struggling to get it to add an active class to only the active page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below code adds the nav links, but I need to know what to add to it to get the active class on only the current page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need a little help please?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if mainNav.navitems|length %}&#xA;    {% for row in mainNav.navitems %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ row.url }}&quot;&amp;gt;{{ row.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N46Pm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N46Pm.png&quot; alt=&quot;Main Nav&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="57" LastEditDate="2017-06-08T22:00:48.827" LastActivityDate="2017-06-08T22:00:48.827" Title="Add active class to nav created from globals" Tags="&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20748" PostTypeId="2" ParentId="20747" CreationDate="2017-06-08T09:42:39.680" Score="1" Body="&lt;p&gt;I have solved it &lt;code&gt;{% if row.url == craft.request.firstSegment %}class=&quot;active&quot; {% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the full code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if mainNav.navitems|length %}&#xA;{% for row in mainNav.navitems %}&#xA;  &amp;lt;li {% if row.url == craft.request.firstSegment %}class=&quot;active&quot; {% endif %}&amp;gt;&amp;lt;a href=&quot;{{ row.url }}&quot;&amp;gt;{{ row.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-06-08T09:42:39.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20749" PostTypeId="2" ParentId="20747" CreationDate="2017-06-08T09:43:48.230" Score="2" Body="&lt;p&gt;Depends on your URL structure ultimately and whether you have sub pages, but I think the easiest way to do it would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if mainNav.navitems|length %}&#xA; {% for row in mainNav.navitems %}&#xA;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ url(row.url) }}&quot;&#xA;     {%- if craft.request.segment(1) == row.url %}class=&quot;active&quot;{%- endif %}&amp;gt;&#xA;     {{ row.name }}&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA; {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't have to use the &lt;code&gt;segment(1)&lt;/code&gt; method if it doesn't suit, take a look at &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;the request docs&lt;/a&gt; to find something that suits your URLs&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2017-06-08T09:43:48.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20750" PostTypeId="1" AcceptedAnswerId="20753" CreationDate="2017-06-08T12:19:40.317" Score="1" ViewCount="349" Body="&lt;p&gt;I'm trying to bring in all images from a matrix field but I can only get it to work with first() or last() but obviously it only shows 1 image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found a few article explaining it but I can't seem to get it working. &lt;/p&gt;&#xA;" OwnerUserId="6829" LastEditorUserId="6829" LastEditDate="2017-06-14T08:13:31.583" LastActivityDate="2017-06-14T08:13:31.583" Title="Show all images from Matrix Block" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20751" PostTypeId="1" AcceptedAnswerId="20771" CreationDate="2017-06-08T12:28:08.733" Score="2" ViewCount="770" Body="&lt;p&gt;I currently have numerous Super Tables with date fields inside and I am trying to get all table items to list themselves together in date order depending on what the user inputs. I have tried using the Super Sort plugin but haven't had any luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if there is somewhere below where I have gone wrong or misunderstood the documentation. The plugin I am trying to use can be found &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if this is possible with Super Tables or Matrix fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I'm currently getting is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function doDisplay(array $context, array $blocks = array())   &#xA;{&#xA;  echo $this-&amp;gt;getAttribute($this-&amp;gt;getAttribute(($context[&quot;object&quot;] ?? $this-&amp;gt;getContext($context, &quot;object&quot;)), &quot;tourDates&quot;, array()), &quot;tourDate&quot;, array());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (version_compare(PHP_VERSION, '7', '&amp;gt;=') &amp;amp;&amp;amp; $code === 2 &amp;amp;&amp;amp; &#xA;strpos($message, 'should be compatible with') !== false)&#xA;{&#xA;    return;&#xA;}&#xA;parent::handleError($code, $message, $file, $line);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function displayWithErrorHandling(array $context, array &#xA;$blocks = array())&#xA;{&#xA;    try {&#xA;        $this-&amp;gt;doDisplay($context, $blocks);&#xA;    } catch (Twig_Error $e) {&#xA;        if (!$e-&amp;gt;getSourceContext()) {&#xA;            $e-&amp;gt;setSourceContext($this-&amp;gt;getSourceContext());&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the code I current have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artists = craft.entries.section('artists') %}&#xA;{% set entries = artists | supersort('sortAs', '{ tourDates.tourDate }') %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    {% if entry.tourDates %}&#xA;        {% for row in entry.tourDates %}&#xA;            {{ row.tourDate|date(&quot;d/m/Y&quot;) }}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = artists | supersort('sortAs', '{ tourDate }') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = artists | supersort('sortAs', '{{ artists.tourDates.tourDate }}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2017-06-09T07:52:29.800" LastActivityDate="2018-12-25T14:34:37.200" Title="Sort entries by custom date in Matrix field / Super Table" Tags="&lt;matrix&gt;&lt;order&gt;&lt;plugin-supertable&gt;&lt;plugin-supersort&gt;&lt;sort&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20752" PostTypeId="1" CreationDate="2017-06-08T12:28:29.687" Score="2" ViewCount="357" Body="&lt;p&gt;I'm grouping search results by section, based on Aaron Berkowitz's answer to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19046/group-entries-by-section&quot;&gt;this question&lt;/a&gt;. My code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({search: {query: keywords} }) %}&#xA;{% set entriesBySection = entries | group('section') %}&#xA;&#xA;{% for section, entries in entriesBySection %}&#xA;    &amp;lt;h2&amp;gt;{{ section }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works great but I need to show the sections in a specific order, and merge some sections into one. So I'd end up with, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;li&gt;Products&lt;/li&gt;&#xA;&lt;li&gt;Reports&lt;/li&gt;&#xA;&lt;li&gt;Other (everything else combined)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any idea how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks loads for any help!&lt;/p&gt;&#xA;" OwnerUserId="5765" LastEditorUserId="57" LastEditDate="2017-06-08T22:01:29.000" LastActivityDate="2017-06-09T07:20:34.130" Title="Group entries by section, then order and combine sections" Tags="&lt;entries&gt;&lt;search&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20753" PostTypeId="2" ParentId="20750" CreationDate="2017-06-08T13:02:51.037" Score="3" Body="&lt;p&gt;Because logoSlider.image is an array of images (even if there's only one image in the array) you need an additional 'for' loop to catch all of the images (not just the first or last). Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for logoSlider in entry.logoSlider %} &#xA;   {% if logoSlider.type == 'logo' %} &#xA;     {% for image in logoSlider.image %}&#xA;       &amp;lt;div class=&quot;column column-block&quot;&amp;gt;&#xA;         &amp;lt;img src=&quot;{{image.url}}&quot; alt=&quot;{{image.title}}&quot; /&amp;gt;&#xA;       &amp;lt;/div&amp;gt;&#xA;     {% endfor %}&#xA;   {% endif %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2017-06-08T13:02:51.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20755" PostTypeId="1" CreationDate="2017-06-08T16:11:02.770" Score="3" ViewCount="408" Body="&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;      section : 'events',&#xA;      order : 'eventStartDate asc',&#xA;      eventStartDate : '&amp;gt;=' ~ now,&#xA;      limit : row.itemsPerPage.value&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to pull a set of event entries for a basic event calendar and I'm trying to figure out the syntax for the eventStartDate parameter to have it pull starting with the current date and ending with a value of the current date + 1 month, 3 months, or 6 months depending on the value set in another field named eventDateRange. I need help with how to write that as a command like the one listed above. &lt;/p&gt;&#xA;" OwnerUserId="2265" LastEditorUserId="125" LastEditDate="2017-06-08T16:57:40.363" LastActivityDate="2017-06-08T16:57:40.363" Title="How can I get entries where a date is within a dynamic date range?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20756" PostTypeId="2" ParentId="20755" CreationDate="2017-06-08T16:21:05.580" Score="2" Body="&lt;p&gt;Ok, so in the end you’d want your “startDate” custom field parameter to be a string in this format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'and, &amp;gt;= 2017-08-04T05:00:00+08:00, &amp;lt; 2017-08-11T04:59:59+08:00'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m outputting a format for the dates that includes the time and timezone, so that we are able to define when exactly events are being refreshed. To do that I’m using the &lt;code&gt;date&lt;/code&gt; filter (otherwise Twig outputs dates in &lt;code&gt;Y-m-d&lt;/code&gt; format).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s how you compose the final string including the value from the Global Set, that I am simply concatenating to a string that I pass into the &lt;code&gt;date_modify&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set var = myGlobalSet.myNumbersField %}&#xA;&#xA;{% set rangeStart = now|date_modify('5:00')|date('c') %}&#xA;{% set rangeEnd = now|date_modify('5:00 +' ~ var ~ ' weeks')|date('c') %}&#xA;&#xA;{% set startDateParam = 'and, &amp;gt;=' ~ rangeStart ~ ', &amp;lt;' ~ rangeEnd %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-06-08T16:31:29.907" LastActivityDate="2017-06-08T16:31:29.907" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20758" PostTypeId="2" ParentId="20658" CreationDate="2017-06-08T19:07:59.243" Score="1" Body="&lt;p&gt;To answer my own question, this is what I found.&#xA;The answer is to use &lt;code&gt;get...&lt;/code&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on(&#xA;    &quot;freeform_submissions.onBeforeSave&quot;,&#xA;    function (Event $event) {&#xA;        $submission = $event-&amp;gt;params[&quot;model&quot;];&#xA;        $field_item = $submission-&amp;gt;fieldMetadata['field_handle'];&#xA;        $field_value = $field_item-&amp;gt;getValue();&#xA;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;$field_item-&amp;gt;getValue()&lt;/code&gt; can be &lt;code&gt;$field_item-&amp;gt;getId()&lt;/code&gt; or &lt;code&gt;$field_item-&amp;gt;getHandle()&lt;/code&gt; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The properties listed here: &lt;a href=&quot;https://solspace.com/craft/freeform/docs/field/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/field/&lt;/a&gt; can be used by turning the property into a method and prepending &lt;code&gt;get&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6296" LastActivityDate="2017-06-08T19:07:59.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20759" PostTypeId="1" CreationDate="2017-06-08T20:10:32.863" Score="2" ViewCount="1854" Body="&lt;p&gt;Here is my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in post.get_field('timeline_event') %}&#xA;{% set items = [odd, even]%}&#xA;{{ cycle (items, loop.index0) }}&#xA;&#xA;{% if cycle == odd %}&#xA;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if cycle == even %}&#xA;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working for the most part, the issue is the code I have is being duplicated twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an image: &lt;a href=&quot;https://i.stack.imgur.com/8UQgU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8UQgU.jpg&quot; alt=&quot;twig-cycle issue&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to do this in jekyll liquid using capture, hit a roadblock using twig for php&lt;/p&gt;&#xA;" OwnerUserId="6833" LastActivityDate="2017-06-08T20:47:00.290" Title="Twig Cycle - how to show different html based on cycle" Tags="&lt;templating&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20760" PostTypeId="2" ParentId="20759" CreationDate="2017-06-08T20:32:05.593" Score="3" Body="&lt;p&gt;Based on the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/functions/cycle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in events %}&#xA;    {{ cycle(['odd', 'even'], loop.index0) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or (achieves the same thing):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in events %}&#xA;    {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}&#xA;    {{ oddOrEven }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, for different HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in events %}&#xA;    {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}&#xA;    {% if oddOrEven == 'odd' %}&#xA;        &amp;lt;div class=&quot;Odd&quot;&amp;gt;Odd&amp;lt;/div&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;div class=&quot;Even&quot;&amp;gt;Even&amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-06-08T20:38:42.710" LastActivityDate="2017-06-08T20:38:42.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20761" PostTypeId="2" ParentId="20759" CreationDate="2017-06-08T20:47:00.290" Score="3" Body="&lt;p&gt;I tried this and this worked out also:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index is even %}&#xA;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if loop.index is odd %}&#xA;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6833" LastActivityDate="2017-06-08T20:47:00.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20762" PostTypeId="2" ParentId="17471" CreationDate="2017-06-08T21:48:41.063" Score="2" Body="&lt;p&gt;For some reason the above answers aren't working for me, so I've done it the mathematical way...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formula: ((newprice-oldprice)/oldprice)*100&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In craft/twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.defaultVariant.onSale %}&#xA;  &amp;lt;span class=&quot;badge&quot;&amp;gt;&#xA;    {% set procent = ((product.defaultVariant.salePrice-product.defaultPrice)/product.defaultPrice)*100 %}&#xA;    {{procent}}%&#xA;  &amp;lt;/span&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope it helps for those who where struggling also... :)&lt;/p&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2017-06-08T21:48:41.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20763" PostTypeId="1" CreationDate="2017-06-08T22:49:21.637" Score="1" ViewCount="97" Body="&lt;p&gt;This is a continuation of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20269/how-could-i-submit-the-charge-plugin-using-ajax&quot;&gt;How could I submit the Charge plugin using Ajax?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the Charge plugin to handle my Stripe payments. I'm having to use ajax to submit the charge form before submitting a second form that is on the page. The problem is when the ajax call fails, I can't seem to get the error messages that are causing the failed attempt. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure part of the reason is because I get a 404 every time it fails, because &lt;code&gt;'url: charge/charge'&lt;/code&gt; path doesn't actually exist on my server. So, &lt;code&gt;console.log(data)&lt;/code&gt; is basically useless to try and find how to access the error(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code that I currently have: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.ajaxReq = $.ajax({&#xA;  method: &quot;post&quot;,&#xA;  url: 'charge/charge',&#xA;  data: $('#charge-form').serialize()&#xA;}) .done(function(data) {&#xA;    console.log('success');&#xA;}) .fail(function(data){&#xA;    console.log('failed');&#xA;    // Need to get error messages from Stripe/Charge?&#xA;}); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6832" LastEditorUserId="6832" LastEditDate="2017-06-09T13:15:25.560" LastActivityDate="2017-06-09T13:15:25.560" Title="SquareBit Charge Plugin: How to retrieve error messages from failed ajax call?" Tags="&lt;plugins&gt;&lt;error-message&gt;&lt;ajax&gt;&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20764" PostTypeId="1" AcceptedAnswerId="20784" CreationDate="2017-06-08T23:11:44.543" Score="1" ViewCount="181" Body="&lt;p&gt;I am running into an odd issue where creating new child entries does not bust the cache of the parent page(s) that lists them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the structure I am working with:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5EBy1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5EBy1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am displaying the &lt;code&gt;Course&lt;/code&gt; entries on the &lt;code&gt;Course Landing Pages&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache using key craft.request.path %}&#xA;&#xA;  {% set currentPage = craft.entries.id(entry.id).first() %}&#xA;&#xA;  {% set entries = craft.entries({&#xA;    type: 'course',&#xA;    descendantOf: currentPage,&#xA;    with: [&#xA;      ['courseThumbnail', {&#xA;        withTransforms: [&#xA;          { mode: 'crop', width: 800, height: 800, position: 'center-center', format: 'jpg' }&#xA;        ]&#xA;      }]&#xA;    ]&#xA;  }) %}&#xA;&#xA;  {% for entry in entries %}&#xA;      {% include '_includes/_listing-item-course' with { featured : true } %}&#xA;  {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I publish a new &lt;code&gt;Course&lt;/code&gt; entry, the cache for the parent page(s) is not busted and the new entry will not show unless I move/drag into a new position. This seems to clear the cache and the new entry shows on the parent page(s).&lt;a href=&quot;https://i.stack.imgur.com/99PFY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/99PFY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the &lt;code&gt;craft.entries&lt;/code&gt; call to &lt;strong&gt;not include&lt;/strong&gt; the &lt;code&gt;descendantOf&lt;/code&gt; part, so it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entries = craft.entries({&#xA;    type: 'course',&#xA;    with: [&#xA;      ['courseThumbnail', {&#xA;        withTransforms: [&#xA;          { mode: 'crop', width: 800, height: 800, position: 'center-center', format: 'jpg' }&#xA;        ]&#xA;      }]&#xA;    ]&#xA;  }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then newly added &lt;code&gt;Course&lt;/code&gt; entries will show up straight away on all the &lt;code&gt;Course Landing Pages&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that?&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2017-07-04T12:09:16.180" Title="Newly added child entries not showing on listing/parent page straight away" Tags="&lt;structure&gt;&lt;cache&gt;&lt;children&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20765" PostTypeId="1" CreationDate="2017-06-09T05:03:04.420" Score="1" ViewCount="541" Body="&lt;p&gt;I have created a page where user creates an entry but its &lt;strong&gt;status&lt;/strong&gt; is &lt;strong&gt;disabled&lt;/strong&gt;. This page then redirects to a page where the user gets to see a preview of his entry. On this preview page there are two publish button when clicked the status of the entry has to be &lt;strong&gt;enabled&lt;/strong&gt;. The code I have used is:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/user/thanks/{{slug}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;4&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{entry.id}}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;btn-save&quot;&amp;gt;Publish&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But after submitting the form it reloads the same page. I checked the craft.log, it has the following errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/06/08 13:17:53 [warning] [application] Craft\ContentModel-&amp;gt;dailyPlan failed validation: Daily Plans cannot be blank. ( a matrix field )&#xA;2017/06/08 13:17:53 [warning] [application] Craft\ContentModel-&amp;gt;banner failed validation: Banner cannot be blank. ( an asset field )&#xA;2017/06/08 13:17:53 [warning] [application] Craft\ContentModel-&amp;gt;Included failed validation: Included cannot be blank. ( a table field )&#xA;2017/06/08 13:17:53 [warning] [application] Craft\ContentModel-&amp;gt;Excluded failed validation: Excluded cannot be blank. ( a table field )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can't I change the status of entry simply with the above form? Do I have to load all the required fields with its value? Well I don't want to do that as it would take lot of extra lines of code and also the execution time will be longer, as there are two publish button on the page.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="45" LastEditDate="2017-06-09T06:46:39.010" LastActivityDate="2017-06-09T06:53:19.180" Title="How to change the Entry status to enabled from Disabled" Tags="&lt;entry&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20766" PostTypeId="1" CreationDate="2017-06-09T06:15:19.370" Score="1" ViewCount="414" Body="&lt;p&gt;I copied my entire existing install on a new staging server for some developmental work. Right now the &lt;code&gt;craft/config/db.php&lt;/code&gt; file has not been changed and it is still connected to the production database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website loads fine on the dev server but I cannot login to the Craft admin. When I enter my login credentials, I get the following error in my chrome web console&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Failed to load resource: the server responded with a status of 400 (Bad Request) /index.php?p=admin/actions/users/login&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I try to load the above URL (mydomain.com/index.php?p=admin/actions/users/login), I get a 404 page not found error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft/config/general.php&lt;/code&gt; config file has the correct config for the dev server as far as I can tell. What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="57" LastEditDate="2017-06-09T18:10:52.393" LastActivityDate="2017-06-09T18:10:52.393" Title="Problem cloning existing Craft instance on staging" Tags="&lt;error-message&gt;&lt;admin&gt;&lt;login&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20767" PostTypeId="2" ParentId="20765" CreationDate="2017-06-09T06:53:19.180" Score="1" Body="&lt;p&gt;I think so, if they are required fields. You'd just add them as hidden fields and there wouldn't be any additional database queries because it's already fetched the entry anyway.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-06-09T06:53:19.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20768" PostTypeId="2" ParentId="20752" CreationDate="2017-06-09T07:20:34.130" Score="2" Body="&lt;p&gt;You could do this in a few steps (&lt;em&gt;warning: this is untested code&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; Define an array of the sections you cited, in the correct order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Define a list of the sections you want to display in the correct order #}&#xA;{% set sections = ['news', 'products', 'reports'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Identify the entries that do not belong in any of these sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Create an array of entries that do not belong to any of the sections above #}&#xA;{% set otherEntries = [] %}&#xA;&#xA;{# We first loop on the entries by section to identify the &quot;other&quot; entries #}&#xA;{% for section, entries in entriesBySection %}&#xA;    {% if section in sections %}&#xA;        {% for entry in entries %}&#xA;            {% set otherEntries = otherEntries|merge([entry])}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; Display all the entries of each section in the correct order&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop on the sections in the right order #}&#xA;{% for section in sections %}&#xA;    {# Obtain all the entries for the current section #}&#xA;    {% set entries = entriesBySection[section] %}&#xA;    {% for entry in entries %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; Display the rest of the entries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Finally display the &quot;other&quot; entries #}&#xA;{% for entry in otherEntries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2017-06-09T07:20:34.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20769" PostTypeId="1" AcceptedAnswerId="20770" CreationDate="2017-06-09T09:30:48.423" Score="1" ViewCount="427" Body="&lt;p&gt;I have a portfolio page for a client that has a simple two column grid of images. However, I'd like to set it up so that it creates responsive images via the excellent &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code below so far. However, it's only outputting the first image from the Matrix. So I need it to output all the images the client drops in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So need a little bit of help to tweak the code to output all images please?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.portfolio %}&#xA;    {% switch block.type %}&#xA;&#xA;    {% case &quot;images&quot; %}&#xA;    {% set image = block.portfolioImage.first() %}&#xA;    {% set transformedImages = craft.imager.transformImage(image,&#xA;      [&#xA;          { width: 1200, ratio: 4/3 },&#xA;          { width: 992, ratio: 4/3 },&#xA;          { width: 768, ratio: 4/3, jpegQuality: 60 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          jpegQuality: 80,&#xA;&#xA;          interlace: true&#xA;      }&#xA;    ) %}&#xA;    {% if image | length %}&#xA;    &amp;lt;img class=&quot;img-responsive&quot;&#xA;         src=&quot;{{ transformedImages[1].url }}&quot;&#xA;         sizes=&quot;50vw&quot;&#xA;         srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;         alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="57" LastEditDate="2017-06-09T18:17:28.817" LastActivityDate="2017-06-09T18:17:28.817" Title="Matrix gallery with Imager plugin" Tags="&lt;matrix&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20770" PostTypeId="2" ParentId="20769" CreationDate="2017-06-09T10:59:35.367" Score="2" Body="&lt;p&gt;Assuming it's the field portfolioImage that can have multiple assets, try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.portfolio %}&#xA;    {% switch block.type %}&#xA;&#xA;    {% case &quot;images&quot; %}&#xA;&#xA;    {% for image in block.portfolioImage %}&#xA;        {% set transformedImages = craft.imager.transformImage(image,&#xA;            [&#xA;                { width: 1200, ratio: 4/3 },&#xA;                { width: 992, ratio: 4/3 },&#xA;                { width: 768, ratio: 4/3, jpegQuality: 60 },&#xA;            ],&#xA;            {&#xA;                format: 'jpg',&#xA;                allowUpscale: false,&#xA;                mode: 'crop',&#xA;                jpegQuality: 80,&#xA;                interlace: true&#xA;            }&#xA;        ) %}&#xA;        &amp;lt;img class=&quot;img-responsive&quot;&#xA;             src=&quot;{{ transformedImages[1].url }}&quot;&#xA;             sizes=&quot;50vw&quot;&#xA;             srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;             alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-06-09T10:59:35.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20771" PostTypeId="2" ParentId="20751" CreationDate="2017-06-09T12:33:55.707" Score="2" Body="&lt;p&gt;I did something like this as a workaround:&#xA;Loop over entries, fetching all data you need and adding it to an array. Sorting that array with SuperSort and than displaying all info by looping over the array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tourDates = [] %}&#xA;{% set artists = craft.entries.section('artists') %}&#xA;{% for artist in artists %}&#xA;&#xA;    {% if artist.tourDates %}&#xA;        {% for row in artist.tourDates %}&#xA;            {% set tourDates = tourDates|merge([ {&#xA;                'tourDate' : row.tourDate|date(&quot;d/m/Y&quot;)&#xA;            } ]) %}&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% set tourDates = tourDates | supersort('sortAs', '{{ object.tourDate }}') %}&#xA;&#xA;{% for tourDate in tourDates %}&#xA;    {{ tourDate.tourDate }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-06-09T12:33:55.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20772" PostTypeId="1" CreationDate="2017-06-09T12:38:05.570" Score="2" ViewCount="447" Body="&lt;p&gt;I need to make a database on a remote server, and since I have been using &lt;a href=&quot;https://github.com/gabrielmoreira/craftman&quot; rel=&quot;nofollow noreferrer&quot;&gt;craftman&lt;/a&gt; installer which uses Docker to install Craft CMS and DB locally I have no idea how does the DB actually looks like. How can I check and see what is DB like, and export the sql file so that I can import it on the remote server?&#xA;I have tried to connect to it using these settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Host: 127.0.0.1&#xA;Username: root&#xA;Password: &#xA;Database: craft&#xA;Port: 3306&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried with changing the Db name from craft to the name of my project, but that didn't work either, not sure where I can find the right settings and how to connect to DB?&lt;/p&gt;&#xA;" OwnerUserId="6735" LastEditorUserId="6735" LastEditDate="2017-06-12T08:40:07.830" LastActivityDate="2018-05-08T14:48:31.167" Title="Making a DB on a remote server" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20773" PostTypeId="1" CreationDate="2017-06-09T12:45:05.543" Score="2" ViewCount="424" Body="&lt;p&gt;I want to import users from WordPress to Craft CMS. How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="22" LastEditDate="2017-06-09T17:33:34.507" LastActivityDate="2017-06-09T17:33:34.507" Title="How can I import users from WordPress to Craft CMS?" Tags="&lt;users&gt;&lt;craft-pro&gt;&lt;import&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20774" PostTypeId="2" ParentId="20773" CreationDate="2017-06-09T12:47:48.830" Score="3" Body="&lt;p&gt;I don't know how to export users from WordPress, but importing them in Craft can be done with a plugin like &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt;. There are other plugins out there too depending on the export file you can get out of WordPress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know how to export users from WordPress, you'd need to ask that on the WordPress SE if that exists :)&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-06-09T12:47:48.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20775" PostTypeId="1" AcceptedAnswerId="20782" CreationDate="2017-06-09T13:41:22.287" Score="4" ViewCount="631" Body="&lt;p&gt;I have a client that wants to get notified whenever someone registers on their website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this, is there some kind of plugin? If not how would I go about doing this?&lt;/p&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="57" LastEditDate="2017-06-09T18:26:58.480" LastActivityDate="2017-06-10T05:23:29.930" Title="Send email to website owner after user registration" Tags="&lt;plugins&gt;&lt;emails&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20776" PostTypeId="2" ParentId="20775" CreationDate="2017-06-09T14:01:13.280" Score="2" Body="&lt;p&gt;I don't think a plugin is available to do this specifically but you could write your own plugin and listen to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToDefaultGroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;onAssignUserToDefaultGroup&lt;/a&gt; event and send an e-mail from there in your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sending an e-mail can be done through the &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6675" LastActivityDate="2017-06-09T14:01:13.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20777" PostTypeId="2" ParentId="20773" CreationDate="2017-06-09T14:26:38.890" Score="1" Body="&lt;p&gt;I have had pretty good luck importing things into Craft using the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt; plugin.  If you can export your Wordpress users into a .csv file you should be able to use that to import them into Craft.  It looks like there are several ways to &lt;a href=&quot;https://www.google.com/search?q=export%20wordpress%20users%20to%20a%20.csv%20file&amp;amp;ie=utf-8&amp;amp;oe=utf-8&quot; rel=&quot;nofollow noreferrer&quot;&gt;export users from Wordpress to a CSV file&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2017-06-09T14:26:38.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20778" PostTypeId="1" AcceptedAnswerId="20779" CreationDate="2017-06-09T15:30:56.930" Score="2" ViewCount="364" Body="&lt;p&gt;I'm trying to get static assets set up to be served by CloudFront. I know how to get the S3 bucket working, and have CloudFront serving from that bucket, but what I can't wrap my head around is how to handle the invalidation. In non-Craft instances I know about hashing to trigger the invalidation, but not sure how to do that in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, if an editor uploads a photo named &quot;photo.jpg&quot;, and then publishes, and decides to make a change and uploads the revised photo with the same name, how does CloudFront know that it has changed since the editors don't know about content hashing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this makes sense. While not at all new to Craft, I'm very new to running it with performance in mind and even newer to using a CDN. Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3587" LastActivityDate="2017-06-09T15:55:08.330" Title="Using Craft with CloudFront, and handling invalidation" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20779" PostTypeId="2" ParentId="20778" CreationDate="2017-06-09T15:55:08.330" Score="2" Body="&lt;p&gt;One way would be to manually clear it with &lt;a href=&quot;https://superbig.co/plugins/cloudfront-invalidation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cloudfront Invalidation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-06-09T15:55:08.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20780" PostTypeId="2" ParentId="20772" CreationDate="2017-06-09T18:26:06.707" Score="1" Body="&lt;p&gt;Never used craftman before, but it &lt;a href=&quot;https://github.com/gabrielmoreira/craftman/blob/master/craftman#L99&quot; rel=&quot;nofollow noreferrer&quot;&gt;looks like&lt;/a&gt; the database name it creates is called &lt;code&gt;craft&lt;/code&gt; and it's pulling the database &lt;a href=&quot;https://github.com/gabrielmoreira/craftman/blob/master/craftman#L504-L505&quot; rel=&quot;nofollow noreferrer&quot;&gt;user and password&lt;/a&gt; from some environment variables named &lt;code&gt;CRAFT_DB_USER&lt;/code&gt; and &lt;code&gt;CRAFT_DB_PASSWORD&lt;/code&gt; you could check for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-09T18:26:06.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20781" PostTypeId="1" AcceptedAnswerId="20847" CreationDate="2017-06-09T18:35:24.087" Score="1" ViewCount="354" Body="&lt;p&gt;So I started building this plugin to add a twig extension to escape but leave &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt; intact. For some reason when I try install it or use it without the force argument on the import command in the plugin file set to true it does not work. If i set it to true, though, it installs fine and works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin Directory Structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA; - plugins&#xA;   - nbsp&#xA;     NbspPlugin.php&#xA;     - twigextensions&#xA;       NbspTwigExtension.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my NbspPlugin.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace craft;&#xA;&#xA;class NbspPlugin extends BasePlugin {&#xA;&#xA;    function getName()&#xA;    {&#xA;        return Craft::t('&amp;amp;nbsp Twig Filter');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    function getDeveloper()&#xA;    {&#xA;        return 'Rick';&#xA;    }&#xA;&#xA;    function getDeveloperUrl()&#xA;    {&#xA;        return '';&#xA;    }&#xA;&#xA;&#xA;    public function addTwigExtension()&#xA;    {&#xA;        Craft::import('plugins.nbsp.twigextensions.NbspTwigExtension');&#xA;&#xA;        return new NbspTwigExtension();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my NbspTwigExtension.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class NbspTwigExtension extends \Twig_Extension&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        return '&amp;amp;nbsp; filter';&#xA;    }&#xA;&#xA;    public function getFilters()&#xA;    {&#xA;        $returnArray = array();&#xA;        $methods = array(&#xA;            'escapeNonNbsp',&#xA;        );&#xA;&#xA;        foreach ($methods as $methodName) {&#xA;            $returnArray[$methodName] = new \Twig_Filter_Method($this, $methodName, ['pre_escape' =&amp;gt; 'html', 'is_safe' =&amp;gt; array('html')]);&#xA;        }&#xA;&#xA;        return $returnArray;&#xA;    }&#xA;&#xA;    public function escapeNonNbsp($content)&#xA;    {&#xA;        // perform filter operations&#xA;        return str_replace('&amp;amp;amp;nbsp;', '&amp;amp;nbsp;', $content);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I cannot install the plugin. I get an exception &#xA;&lt;code&gt;Can't find Craft\NbspTwigExtension&lt;/code&gt; referencing the return line of the &lt;code&gt;addTwigExtension()&lt;/code&gt; Method. If I add the &lt;code&gt;force = true&lt;/code&gt; argument to the import above it, it installs it, but then upon attempting to use the filter in the twig template it fails even with the import being forced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT - I found one bug in my set up where the name of my method in the extension class needs to match how I call the filter from twig. I changed it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class NbspTwigExtension extends \Twig_Extension&#xA;{&#xA;&#xA;    public function getName()&#xA;    {&#xA;        return '&amp;amp;nbsp; filter';&#xA;    }&#xA;&#xA;    public function getFilters()&#xA;    {&#xA;        $returnArray = array();&#xA;        $methods = array(&#xA;            'nbsp',&#xA;        );&#xA;&#xA;        foreach ($methods as $methodName) {&#xA;            $returnArray[$methodName] = new \Twig_Filter_Method($this, $methodName, ['pre_escape' =&amp;gt; 'html', 'is_safe' =&amp;gt; array('html')]);&#xA;        }&#xA;&#xA;        return $returnArray;&#xA;    }&#xA;&#xA;    public function nbsp($content)&#xA;    {&#xA;        // perform filter operations&#xA;        return str_replace('&amp;amp;amp;nbsp;', '&amp;amp;nbsp;', $content);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it still requires &quot;force&quot; true on the import command to work or install. Why!!?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="57" LastEditDate="2017-06-12T23:34:24.193" LastActivityDate="2017-06-14T23:29:49.193" Title="Cannot install custom Twig extension plugin" Tags="&lt;plugin-development&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20782" PostTypeId="2" ParentId="20775" CreationDate="2017-06-09T20:00:23.667" Score="4" Body="&lt;p&gt;I have done something very similar. You'll want to create a plugin for this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I am validating email addresses so I was checking against the &lt;code&gt;onBeforeActivateUser&lt;/code&gt; event. If you are not validating email addresses, @Lindsey D' answer is where you want to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, they will look about like this:&#xA;I created a plugin called &lt;code&gt;accounts&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPlugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    /**&#xA;     * Event listener for activating a user.&#xA;     *&#xA;     * @param Event $event&#xA;     */&#xA;    craft()-&amp;gt;on('users.onBeforeActivateUser', function (Event $event) {&#xA;        $user = $event-&amp;gt;params['user'];&#xA;&#xA;        craft()-&amp;gt;accounts-&amp;gt;onSendNotificationEmail($user);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Sends a notification email.&#xA; *&#xA; * @param $user&#xA; * @return bool&#xA; */&#xA;public function onSendNotificationEmail($user)&#xA;{&#xA;    $recipient = $user-&amp;gt;email; // get the email address passed in&#xA;&#xA;    $email = new EmailModel();&#xA;&#xA;    $message = '&amp;lt;!DOCTYPE html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;title&amp;gt;My Title&amp;lt;/title&amp;gt;&amp;lt;head&amp;gt;';&#xA;    $message .= '&amp;lt;body&amp;gt;';&#xA;    $message .= '&amp;lt;table width=&quot;800&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&amp;gt;';&#xA;    $message .= '&amp;lt;tr&amp;gt;&amp;lt;td style=&quot;text-align: center;&quot;&amp;gt;LOGO/BRANDING &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;';&#xA;    $message .= '&amp;lt;/table&amp;gt;';&#xA;    $message .= '&amp;lt;p&amp;gt;Hello,&amp;lt;br&amp;gt;There has been a new account created on the website.&amp;lt;/p&amp;gt;';&#xA;    $message .= '&amp;lt;p&amp;gt;...your message here...&amp;lt;/p&amp;gt;';&#xA;    $message .= '&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;';&#xA;&#xA;    $email-&amp;gt;subject = 'New Account Created';&#xA;    $email-&amp;gt;body = $message;&#xA;&#xA;    try {&#xA;        $email-&amp;gt;toEmail = $recipient;&#xA;&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;    } catch (\Exception $e) {&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure there is a cleaner way to get your email body into the CP itself and allow the admin to change the message easily, but this works quick/well.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-06-10T05:23:29.930" LastActivityDate="2017-06-10T05:23:29.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20784" PostTypeId="2" ParentId="20764" CreationDate="2017-06-10T12:55:51.957" Score="2" Body="&lt;p&gt;This is a &lt;a href=&quot;https://github.com/craftcms/cms/issues/1667&quot; rel=&quot;nofollow noreferrer&quot;&gt;known issue&lt;/a&gt; – automatic cache busting currently doesn’t work when the &lt;code&gt;descendantOf&lt;/code&gt; param is set to an actual element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately there’s no easy fix on Craft’s end, without a pretty drastic change to how cache busting works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you can change your &lt;code&gt;descendantOf&lt;/code&gt; param value to &lt;code&gt;currentPage.id&lt;/code&gt; rather than just &lt;code&gt;currentPage&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-06-10T12:55:51.957" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20785" PostTypeId="2" ParentId="20733" CreationDate="2017-06-10T16:11:16.173" Score="2" Body="&lt;p&gt;&lt;strong&gt;Fixed by changing:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class xyz extends \Twig_Extension&#xA;{&#xA;    //...&#xA;    public function getFunctions()&#xA;    {&#xA;        return array(&#xA;            new \Twig_SimpleFunction('kex_cache_breaker', array(__CLASS__, 'cacheBreaker'))&#xA;        );&#xA;    }&#xA;    //...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class xyz extends \Twig_Extension&#xA;{&#xA;    //...&#xA;    public function getFunctions()&#xA;    {&#xA;        return array(&#xA;            new \Twig_SimpleFunction('kex_cache_breaker', array($this, 'cacheBreaker'))&#xA;        );&#xA;    }&#xA;    //...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6824" LastActivityDate="2017-06-10T16:11:16.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20786" PostTypeId="2" ParentId="20764" CreationDate="2017-06-10T16:23:33.440" Score="1" Body="&lt;p&gt;Since using &lt;code&gt;descendantOf(currentPage.id)&lt;/code&gt;, as Brandon suggested, didn't work, I have come up with this workaround solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentPageID = entry.id %}&#xA;&#xA;{% set entries = craft.entries.type('course') %}&#xA;&#xA;{# only display entries that have currentPage as an ancestor #}&#xA;{% for entry in entries if currentPageID in entry.getAncestors().ids() %}&#xA;  {% include '_includes/_listing-item-course' with { featured : true } %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="176" LastActivityDate="2017-06-10T16:23:33.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20787" PostTypeId="1" AcceptedAnswerId="20848" CreationDate="2017-06-10T18:39:50.687" Score="1" ViewCount="50" Body="&lt;p&gt;We are setting up shipping methods and rules as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Methods: FedEx Standard, FedEx Priority, FedEx Overnight&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each method we wanted to add the following rules: US, Canada, International&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when trying to add another rule for another Shipping Method, we get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Canada' for key 'craft_commerce_shippingrules_name_unq_idx'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume we cannot have duplicate rule names across different methods? If so, this seems odd. Of course we can make each rule have a unique name (ex. US Standard, US Prioriy, etc) but it seems like unnecessary complication. Is that our only option?&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-06-15T03:40:00.590" Title="Same shipping rule name in different methods not allowed?" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20788" PostTypeId="2" ParentId="20743" CreationDate="2017-06-10T19:57:43.127" Score="1" Body="&lt;p&gt;Craft will use the original file name of the asset after the first request. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first time an asset is requested, the url for the asset will not include the original file name&lt;/p&gt;&#xA;" OwnerUserId="6751" LastActivityDate="2017-06-10T19:57:43.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20790" PostTypeId="1" CreationDate="2017-06-11T14:19:25.743" Score="2" ViewCount="1926" Body="&lt;p&gt;How is the easiest way to include bootstrap to Craft? I've seen there's already a &lt;code&gt;bootstrap.php&lt;/code&gt; in the &quot;app&quot; folder... what can I do with this guy?&lt;/p&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-06-11T21:41:21.253" LastActivityDate="2021-04-16T16:40:42.943" Title="What is the easiest way to include bootstrap in Craft?" Tags="&lt;bootstrap-craft&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20791" PostTypeId="2" ParentId="20790" CreationDate="2017-06-11T14:59:33.020" Score="7" Body="&lt;p&gt;There are other ways, but since you've asked for the easiest, that's how I'd do it...&lt;/p&gt;&#xA;&lt;p&gt;Just add it to &lt;code&gt;/templates/_layout.twig&lt;/code&gt; and extend it to other templates: like &lt;code&gt;/templates/index.twig&lt;/code&gt; starts with &lt;code&gt;{% extends &amp;quot;_layout&amp;quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    ...&#xA;    &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;/css/bootstrap.css&amp;quot;&amp;gt;&#xA;    ...&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;&amp;lt;div class=&amp;quot;container&amp;quot;&amp;gt;&#xA;    &amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt;&#xA;        &amp;lt;div class=&amp;quot;col&amp;quot;&amp;gt;&#xA;            {% block content %}{% endblock %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;// don't forget jquery/popper here&#xA;&amp;lt;script src=&amp;quot;/js/jquery-3.3.1.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&amp;quot;/js/popper.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script src=&amp;quot;/js/bootstrap.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&#xA;PS. Make sure `bootstrap.css` and `bootstrap.js` are placed in `/web/css` and `/web/js`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5873" LastEditorUserId="5873" LastEditDate="2021-04-16T16:40:42.943" LastActivityDate="2021-04-16T16:40:42.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20792" PostTypeId="2" ParentId="19215" CreationDate="2017-06-12T06:01:23.310" Score="1" Body="&lt;p&gt;A little more useful detail possibly, is here:  &lt;a href=&quot;https://github.com/craftcms/cms/issues/1502&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1502&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="85" LastActivityDate="2017-06-12T06:01:23.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20793" PostTypeId="1" CreationDate="2017-06-12T09:36:51.467" Score="1" ViewCount="339" Body="&lt;p&gt;I have a custom element type with 2 custom fields, 'name' and 'email'.&#xA;I can't seem to get the index search working for this element type.&#xA;I defined defineSearchableAttributes and returned an array with these 2 attributes.&#xA;Searching on the title field works though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Newsletter_SubscriptionElementType extends BaseElementType {&#xA;&#xA;public function getName() {&#xA;    return Craft::t('Subscriptions');&#xA;}&#xA;&#xA;public function hasContent() {&#xA;    return true;&#xA;}&#xA;&#xA;public function hasTitles() {&#xA;    return true;&#xA;}&#xA;&#xA;public function populateElementModel($row) {&#xA;    return Newsletter_SubscriptionModel::populateModel($row);&#xA;}&#xA;&#xA;public function defineCriteriaAttributes() {&#xA;    return array(&#xA;        'name'      =&amp;gt; AttributeType::String,&#xA;        'email'     =&amp;gt; AttributeType::Email&#xA;    );&#xA;}&#xA;&#xA;public function defineSearchableAttributes() {&#xA;    return array('name','email');&#xA;}&#xA;&#xA;public function defineTableAttributes() {&#xA;    $attributes = array(&#xA;        'title'         =&amp;gt; Craft::t('Title'),&#xA;        'name'          =&amp;gt; Craft::t('Name'),&#xA;        'email'         =&amp;gt; Craft::t('Email'),&#xA;        'dateCreated'   =&amp;gt; Craft::t('Date Created')&#xA;    );&#xA;&#xA;    return $attributes;&#xA;}&#xA;&#xA;public function getTableAttributeHtml(BaseElementModel $element, $attribute) {&#xA;    return parent::getTableAttributeHtml($element, $attribute);&#xA;}&#xA;&#xA;public function getSources($context = null) {&#xA;    $sources = array(&#xA;        '*' =&amp;gt; array(&#xA;            'label'    =&amp;gt; Craft::t('All subscriptions'),&#xA;        )&#xA;    );&#xA;&#xA;    return $sources;&#xA;}&#xA;&#xA;public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria) {&#xA;    $query &#xA;        -&amp;gt;addSelect('newsletter_subscriptions.name, newsletter_subscriptions.email')&#xA;        -&amp;gt;join('newsletter_subscriptions newsletter_subscriptions', 'newsletter_subscriptions.id = elements.id');&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6842" LastActivityDate="2018-05-10T22:50:16.900" Title="Custom element type defineSearchableAttributes" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20795" PostTypeId="1" AcceptedAnswerId="20796" CreationDate="2017-06-12T11:48:53.247" Score="1" ViewCount="47" Body="&lt;p&gt;I have a checkbox field which I want the sum of a certain checkbox:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countPremiere = 1 %}&#xA;{% set iterationPremiere = 0 %}&#xA;{% set premiereTotal = 0 %}&#xA;&#xA;{% for entry in allEntries %} // the normal loop starts&#xA;&#xA;  {% for premiereItem in entry.kompositonsart %} //the checkbox loop starts&#xA;    {%- if premiereItem.value == 'ua' -%} // only return checked value with 'ua'&#xA;      {{ countPremiere }}&#xA;    {% endif %}&#xA;  {%- endfor -%}&#xA;&#xA;  {% set premiereTotal = iterationPremiere +  premiereTotal %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{{ premiereTotal }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's basically the same as I did &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16412/total-sum-within-loop&quot;&gt;here&lt;/a&gt;. This doesn't work however. I suspect it is not working because the way checkboxes are looped. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-06-12T11:55:01.477" Title="Sum of one checkbox field" Tags="&lt;templating&gt;&lt;checkboxes&gt;&lt;math&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20796" PostTypeId="2" ParentId="20795" CreationDate="2017-06-12T11:55:01.477" Score="2" Body="&lt;p&gt;What you could try is putting the &quot;if statement&quot; as a condition in the for loop like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for premiereItem in entry.kompositonsart if premiereItem.value == 'ua' %} //the checkbox loop starts&#xA;    // only return checked value with 'ua'&#xA;    {{ countPremiere }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure what you are asking but if my thoughts are right this should do the trick. This way it wont effect any other regular loop functions like a &lt;code&gt;loop.index&lt;/code&gt; if you are going to use it.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-06-12T11:55:01.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20798" PostTypeId="1" AcceptedAnswerId="20812" CreationDate="2017-06-12T13:40:56.867" Score="2" ViewCount="358" Body="&lt;p&gt;I have a front-end profile form that is using a Super Table field to populate a user's phone number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the user has not populated the field before, everything works great. I am able to use &lt;code&gt;new1&lt;/code&gt; to collect the user's information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is when I am trying to display existing data that I am getting the error&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;id&quot;) on a string variable (&quot;92&quot;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am following &lt;a href=&quot;https://github.com/engram-design/SuperTable/wiki/Updating-a-Super-Table-field-from-a-front-end-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide&lt;/a&gt; to help show existing data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what my template looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldHandle = 'phoneNumber' %}&#xA;{% set field = craft.fields.getFieldByHandle(fieldHandle) %}&#xA;{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;&#xA;&amp;lt;label for=&quot;phoneNumber&quot;&amp;gt;Phone Number&amp;lt;/label&amp;gt;&#xA;&#xA;{% if currentUser.phoneNumber.phoneNumber|length %}&#xA;    {% for block in currentUser[fieldHandle] %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ block.id }}][type]&quot; value=&quot;{{ blocktype }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ fieldHandle }}][{{ block.id }}][fields][phoneNumber]&quot; value=&quot;{{ block.phoneNumber.phoneNumber }}&quot;&amp;gt;    &#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][type]&quot; value=&quot;{{ blocktype }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ fieldHandle }}][new1][fields][phoneNumber]&quot;&#xA;    {%- if currentUser is defined and currentUser.phoneNumber.phoneNumber|length -%}value=&quot;{{ currentUser.phoneNumber.phoneNumber }}&quot;{%- endif -%}&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While trying to debug myself, this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser[fieldHandle] }} // 92&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in currentUser[fieldHandle] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...is really saying &quot;for block in 92&quot;. So, that is why I am &lt;em&gt;getting&lt;/em&gt; the error, I'm not sure what the correct syntax is to resolve the error though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My super table is set to have a max rows of 1 and static field is selected.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-06-13T19:44:07.323" LastActivityDate="2017-06-13T19:44:07.323" Title="Why is my Super Table field returning the ID for existing blocks?" Tags="&lt;templating&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20799" PostTypeId="2" ParentId="20638" CreationDate="2017-06-12T13:51:07.280" Score="1" Body="&lt;p&gt;It seems that the &lt;code&gt;??&lt;/code&gt; operator or the &lt;code&gt;is defined&lt;/code&gt; operator do not work at that level, for a reason unkown to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a workaround: testing against a property which I know will always be there. In our case, we know that the field will only be assigned to a category or an entry. Thus, we can check if the element type is a category and use the group handle as subfolder or the entry's section handle if it is an entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.elementType == 'Category' %}{group.handle}{% else %}{section.handle}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know if it is the best solution, but it works.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2017-06-12T13:51:07.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20800" PostTypeId="1" AcceptedAnswerId="20805" CreationDate="2017-06-12T14:43:41.907" Score="1" ViewCount="665" Body="&lt;p&gt;I'm new to Craft and exploring whether it's worth my team moving our existing, deeply-structured content site onto Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a heavily nested sitemap at the moment with 6 top-level categories and up to 5 nested levels of subcategory, eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Cat 1&#xA;    - Sub Cat 1A &#xA;    - Sub Cat 1B &#xA;        - Sub Sub Cat 1Ba &#xA;        - Sub Sub Cat 1Bb &#xA;    - Sub Cat 1C &#xA;- Cat 2&#xA;    - Sub Cat 2A &#xA;    - Sub Cat 2B &#xA;- Cat 3&#xA;    - Sub Cat 3A &#xA;        - Sub Sub Cat 3Aa &#xA;    - Sub Cat 3B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like these categories reflected in URL slugs for entries, eg. &lt;code&gt;/cat-1/sub-cat-1-a/&lt;/code&gt; and &lt;code&gt;/cat-3/sub-cat-3-a/sub-sub-cat-3-a-a&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a Category Group called &quot;Navigation&quot; then made a bunch of categories and nested sub-categories. I added a section and made sure it had a Category field in its Entry Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can't do, though, is get those URLs to work. I've tried following the instructions from Brandon Kelly &lt;a href=&quot;https://craftcms.stackexchange.com/questions/353/how-do-i-add-a-subcategory-to-the-url-slug-for-a-channel-entry&quot;&gt;here&lt;/a&gt; but I only ever get URLs generated with the top-level category slug (eg. &lt;code&gt;/cat-3/{entry.slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oddly, when I select a category for an entry, no matter how many levels deep I select from, the category shown when I edit the post is always the top-level one, not the one I actually selected. Could this have something to do with it? I've ticked the &quot;Categories in this group have their own URLs&quot; option when editing my &lt;code&gt;navigation&lt;/code&gt; Category Group.&lt;/p&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2017-06-12T18:24:33.997" Title="Nested categories in URL slug" Tags="&lt;categories&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20801" PostTypeId="1" CreationDate="2017-06-12T14:51:32.820" Score="1" ViewCount="58" Body="&lt;p&gt;I have a form that uses an email select form, where the label of each option is a department, and the value is the email or emails associated with that department.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's working fine, but the notification email just lists the selected email address, and not the department selected. Because some emails are associated with multiple departments, I need to be able to show what department was selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be a way to customize the notification, so I'd like to add a hidden field, and assign the label of the selected email option as its value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried doing it with javascript, using the code below, but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;fields-selectedInterest&quot; class=&quot;selectedInterest&quot; name=&quot;fields[selectedInterest]&quot;&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;fields[imInterestedIn]&quot; id=&quot;fields[imInterestedIn]&quot; required&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;I'm Interested In:&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;0&quot; &amp;gt;Service 1&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;1&quot; &amp;gt;Service 2&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    jQuery(document).ready(function($){&#xA;        $(document).on('change', 'select[name=&quot;fields[imInterestedIn]&quot;]', function(){&#xA;            var val1 = $(&quot;select[name='fields[imInterestedIn]']&quot;).children(&quot;option&quot;).filter(&quot;:selected&quot;).text();&#xA;&#xA;            $(&quot;#fields-selectedInterest&quot;).val(val1);&#xA;            $(&quot;#fields-selectedInterest&quot;).change();&#xA;        });&#xA;    });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="323" LastEditorUserId="115" LastEditDate="2017-08-31T14:13:37.863" LastActivityDate="2017-08-31T14:13:37.863" Title="Sprout Forms -- Assign email selects LABEL to hidden field (jquery?)" Tags="&lt;emails&gt;&lt;plugin-sproutforms&gt;&lt;jquery&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20802" PostTypeId="1" AcceptedAnswerId="20807" CreationDate="2017-06-12T17:06:39.703" Score="2" ViewCount="1766" Body="&lt;p&gt;I currently have a Craft 2 site deployment with a translations folder and a &lt;code&gt;en_gb.php&lt;/code&gt; translations file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be able to use expressions like this: &lt;code&gt;{{&quot;visualization&quot;|t}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this does not work in Craft 3. What is the new format for translation in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="6649" LastEditorUserId="57" LastEditDate="2017-06-12T23:39:58.680" LastActivityDate="2018-06-21T18:57:50.120" Title="How do translations work in Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20803" PostTypeId="1" CreationDate="2017-06-12T17:50:10.677" Score="14" ViewCount="1339" Body="&lt;p&gt;We've just completed our first Craft Commerce website at &lt;a href=&quot;https://basedesign.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Base Design&lt;/a&gt;. Overall everything went well but we encountered issues with taxes and the way VAT works on online sales in the EU. Craft Commerce didn't seem to integrate as well as expected with those taxes and we eventually had to use a few tricks we're not proud of to make it work as expected (or so we thought).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we are about to start a new e-commerce project in a few months I took a bit of time to see what changed in Craft Commerce since then and what we could have done better... but stumbled on more issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: it's a long one, sorry about that.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;A bit of context&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;As you know, the EU is made of a bunch of different countries. Every country has its own laws and, for this reason, taxes vary from country to country in the EU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the standard VAT rate (VAT is for &quot;Value-Added Tax&quot;, the most &lt;em&gt;popular&lt;/em&gt; tax in the EU) is 20% in France and the Netherlands, 21% in Belgium and Latvia, 27% in Hungary and 17% in Luxembourg. But of course lots of exceptions exist and these exceptions are country-based.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that to help you understand that when talking about VAT in the EU, we're actually talking about different VATs in every country. Luckily for us, the VAT that needs to be used on an e-commerce website is the one of the country where the company selling the products is established, not the one of the country where the goods are being bought from. It means that the same VAT can be applied to all sales on a website... where VAT is relevant (actually this &lt;a href=&quot;http://www.vatlive.com/eu-vat-rules/distance-selling/distance-selling-eu-vat-thresholds/&quot; rel=&quot;nofollow noreferrer&quot;&gt;isn't always true&lt;/a&gt; but let's ignore that for now). Good!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where it gets complex is that VAT is not always due. For example, if a French company buys from an company established in a &lt;strong&gt;different&lt;/strong&gt; EU country they won't be asked to pay any VAT. This rule only applies to companies; individuals can't benefit from this tax exemption. Be careful though: if a company is buying from another company in the same country this exemption won't apply and the VAT will still need to be paid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when some goods are being sold to individuals or companies outside of the EU, VAT shouldn't be applied either.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I recently created this list that sums up most cases. The assumption made is that the subject company is Belgium-based and selling a 100€-worth product.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If customer is a BE  citizen&lt;br&gt;&#xA;&amp;rArr; 121€ with 21% VAT line&lt;/li&gt;&#xA;&lt;li&gt;If customer is a BE  company&lt;br&gt;&#xA;&amp;rArr; 121€ with 21% VAT line&lt;/li&gt;&#xA;&lt;li&gt;If customer is a EU  (not BE) citizen&lt;br&gt;&#xA;&amp;rArr; 121€ with 21% VAT&#xA;line&lt;/li&gt;&#xA;&lt;li&gt;If customer is a EU  (not BE) company&lt;br&gt;&#xA;&amp;rArr; 100€ with &quot;Intra-EU&#xA;VAT&quot; VAT line&lt;/li&gt;&#xA;&lt;li&gt;If customer is a ROW*  citizen&lt;br&gt;&#xA;&amp;rArr; 100€ with no mention of VAT&lt;/li&gt;&#xA;&lt;li&gt;If customer is a ROW*  company&lt;br&gt;&#xA;&amp;rArr; 100€ with no mention of VAT&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;ROW&lt;/strong&gt; means Rest of the World.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How we applied this logic to Craft Commerce&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In our minds, there were two different ways we could apply this logic to Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Deduce VAT when not needed&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first way to make this work would have been to input all product prices with a VAT-included price. If we use the above example, the product price would have been 121€.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The price displayed on the website by default would have been that price and we could have remove the VAT taxes when the customer was either a EU company (not BE) or a ROW citizen or company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this work, we created the following Tax Rate: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1CTyR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1CTyR.png&quot; alt=&quot;tax rule for BE&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Up until then, everything worked as expected on orders that would be shipped to Belgium. Company or individual will always be billed 121€.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we needed to take care of the rest of the EU and created the following Tax Rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HrU2n.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HrU2n.png&quot; alt=&quot;tax rule for EU&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing this, when an order from a EU citizen (not BE) was created, we were asking Craft Commerce to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;remove the original BE Tax Rate and condition&lt;/li&gt;&#xA;&lt;li&gt;apply the EU Tax Rate and condition&lt;/li&gt;&#xA;&lt;li&gt;if it's a EU company, don't add the tax&lt;/li&gt;&#xA;&lt;li&gt;output the total&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But this is where we had to stop. Indeed, the taxes calculation there wasn't correct. This is what we got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SlpCy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SlpCy.png&quot; alt=&quot;resulting math&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the two &quot;Tax&quot; lines. They both have a value of 21% but only the first one is calculated the way we expect it to be (121€ &amp;divide; 1.21). The second one should equal to 121€ &amp;divide; 1.21 &amp;times; 0.21 = 21€ but it is actually equal to 25.41€ (121€ &amp;times; 0.21). Basically it just doesn't take into account the previous tax adjustments when calculating the new adjustment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We realised that this way of calculating taxes might be relevant in some regions and contexts and Craft Commerce was probably developed in that optic. So at this point we were only bummed that there wasn't any option to make it possible for a tax adjustment to be aware of all previous tax adjustments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we still had another option in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Add VAT when needed&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative we thought of was to input all product prices without VAT. If we use the example above, the product price would have been 100€.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To display the default price on the website, we would create a helper that would show that default price &amp;times; 1.21 =&gt; 121€. It made us work way more than  expected but still, it worked quite well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating the different tax rules for Belgium, the EU and the ROW was then easier and we didn't expect any issue anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But an annoying one eventually appeared: rounding errors. Let's take the example of a product that must appear at 55€ on the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the previous logic, this product should be added to Craft at a price of 45.4545€ (55€ &amp;divide; 1.21). When we show the price on the website, we use the helper and the resulting price is 45.4545€ &amp;times; 1.21 = 54,9999€ which we round to 55€. All good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when we enter the checkout process it was too dangerous to use our helper. So we started relying on the Craft Commerce engine. But that engine calculates prices in another way as what we had anticipated. Basically, it will only use the first 2 decimals. So 45.45€ (our base price with 2 decimals) &amp;times; 1.21 is now worth 54.99€. It looks inconsistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll say we could just adapt our base price but that's actually not a good idea. First, 45.46€ &amp;times; 1.21 will amount to 55.01€, not 55€.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On top of that, when we add the same product multiple times in our basket, the price becomes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;45.45€ &amp;times; 1.21 &amp;times; &lt;strong&gt;2&lt;/strong&gt;: 109.99€&lt;/li&gt;&#xA;&lt;li&gt;45.45€ &amp;times; 1.21 &amp;times; &lt;strong&gt;3&lt;/strong&gt;: 164.98€&lt;/li&gt;&#xA;&lt;li&gt;45.45€ &amp;times; 1.21 &amp;times; &lt;strong&gt;4&lt;/strong&gt;: 219.98€&lt;/li&gt;&#xA;&lt;li&gt;45.45€ &amp;times; 1.21 &amp;times; &lt;strong&gt;5&lt;/strong&gt;: 274.97€&lt;/li&gt;&#xA;&lt;li&gt;45.45€ &amp;times; 1.21 &amp;times; &lt;strong&gt;6&lt;/strong&gt;: 329.97€&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So what the customer would actually see now looks like this: 54,99€ &amp;times; 6 equals to 329,97€. &lt;strong&gt;Remember, what we wanted was: 55€ &amp;times; 6 equals to 330€&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not professional.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Well, this is where we need help. As you can see, none of these options are viable: the first one outputs wrong totals and the second one doesn't output nicely-rounded numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To us, the solution to the first option could be that we would be allowed to check the &quot;The tax is already included in the taxable subject&quot; in multiple Tax rates. I understand that this would change a few things in the way Craft Commerce works but it is how I expected it to work from the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to the second option would be that Craft Commerce doesn't round numbers to 2 decimals when processing them. It might be simpler but that option still looks a bit dirty in my opinion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're probably not the first ones encountering this issue so we were wondering how others handled the situation. Maybe another solution exists? In any case, I'd be very interested to discuss it with anyone who is developing a Craft Commerce website for a EU-based company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4689" LastEditorUserId="3951" LastEditDate="2017-11-09T19:37:58.593" LastActivityDate="2019-03-26T06:09:59.007" Title="Issues with Craft Commerce and VAT taxes" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20805" PostTypeId="2" ParentId="20800" CreationDate="2017-06-12T18:24:33.997" Score="1" Body="&lt;p&gt;The reason why you only see the top level category in your category field and why your URL's only use the top level category is probably because you set the &quot;limit (number of selectable categories)&quot; to 1 in your category field settings.&#xA;That way you can only choose one category but it also &lt;strong&gt;only&lt;/strong&gt; selects the top category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty irritating, I know. I had some issues with it too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So clear that limit and it should work.&#xA;I don't have a solution to limit the amount of categories selected without that option being checked. I guess you can adopt your templates for multiple categories or write a plugin to do some extra checking when selecting categories.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2017-06-12T18:24:33.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20807" PostTypeId="2" ParentId="20802" CreationDate="2017-06-12T23:42:36.687" Score="6" Body="&lt;p&gt;You can see the changes made to static translations in Craft 3 in the Craft 3 upgrade docs here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#static-translation-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#static-translation-files&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, &lt;code&gt;craft/translations/en_gb.php&lt;/code&gt; would need to change to &lt;code&gt;craft/translations/en-GB/site.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="4966" LastEditDate="2018-06-21T18:57:50.120" LastActivityDate="2018-06-21T18:57:50.120" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="20808" PostTypeId="1" AcceptedAnswerId="21278" CreationDate="2017-06-13T00:08:55.710" Score="2" ViewCount="277" Body="&lt;p&gt;With the Search Plus plugin, it's possible to define a &lt;a href=&quot;https://squarebit.co.uk/software/craft/searchplus/usage/hooks-events#addAlgoliaMapping&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom mapping&lt;/a&gt; of your Entries for your Algolia index. This is basically a two-part process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;searchPlus_addAlgoliaMapping&lt;/code&gt; to declare &lt;em&gt;which&lt;/em&gt; function controls the mapping.&lt;/li&gt;&#xA;&lt;li&gt;Write the function which controls the mapping.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've done both of these, and it's working very well. Here's an example of my mapping function...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    'objectID' =&amp;gt; $entry-&amp;gt;id,&#xA;    'uri'      =&amp;gt; $entry-&amp;gt;uri,&#xA;    'title'    =&amp;gt; $entry-&amp;gt;title,&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, there are certain entries which should be &lt;strong&gt;excluded&lt;/strong&gt; from the search index. My instinct tells me to simply wrap a conditional around that mapping, and return &lt;code&gt;false&lt;/code&gt; (or &lt;code&gt;null&lt;/code&gt;) for entries which should be excluded...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if ($entry-&amp;gt;includeInSearch) {&#xA;    return [&#xA;        'objectID' =&amp;gt; $entry-&amp;gt;id,&#xA;        'uri'      =&amp;gt; $entry-&amp;gt;uri,&#xA;        'title'    =&amp;gt; $entry-&amp;gt;title,&#xA;    ];&#xA;} else {&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, this seems to cause an error when Search Plus tries to export to Algolia...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5Xvh0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Xvh0.png&quot; alt=&quot;craft_searchplus_indexitem&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which leads to the question: &lt;strong&gt;What is the proper way to omit an entry from an Algolia index?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-30T19:59:00.393" Title="Search Plus - How to skip an entry in mapping?" Tags="&lt;entries&gt;&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20809" PostTypeId="1" CreationDate="2017-06-13T03:29:48.850" Score="1" ViewCount="177" Body="&lt;p&gt;I've been using Craft for a couple of years now and I do love it, however I consistently run into massive performance issues with it. I heavily rely on caching and eager loading - however this doesn't help when building filters that &lt;strong&gt;query against relationships (i.e. 'categories' and 'entries' fields)&lt;/strong&gt; as the number of combinations of returned content is too high to think about caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt; has been made &lt;strong&gt;significantly faster&lt;/strong&gt; than Craft 2 according to &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;the website&lt;/a&gt;, however that's ideal conditions presumably loading entries with no fields on them - because even with Craft 2 I've never got close to the numbers quoted in real world applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Have any improvements been made to the performance and overhead of searching related fields and categories?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people have suggested using &lt;a href=&quot;http://algolia.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algolia&lt;/a&gt;, but I've built a solution that's worked around the issue. I'd just rather not have to go to such extremes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! (and thanks in advance for your time - presumably Brad :P).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An example of the type of scenario I'm referencing is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Get element criterea for searching projects&#xA;$projectCriterea = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$projectCriterea-&amp;gt;section = 'projects';&#xA;$projectCriterea-&amp;gt;order = $orderBy;&#xA;$projectCriterea-&amp;gt;limit = $limit;&#xA;$projectCriterea-&amp;gt;offset = $offset;&#xA;&#xA;... etc ...&#xA;&#xA;# Project categories i.e. bridges&#xA;$relatedProjectTypes = [&#xA;    'targetElement' =&amp;gt; $projectCategories,&#xA;    'field' =&amp;gt; 'portfolioCategories',&#xA;];            &#xA;&#xA;# Location (New Zealand, Australia etc).&#xA;$relatedToLocations = [&#xA;    'targetElement' =&amp;gt; $locationCategories,&#xA;    'field' =&amp;gt; 'portfolioLocationCategories',&#xA;];  &#xA;&#xA;... etc ...&#xA;&#xA;$projectCriterea-&amp;gt;relatedTo = ['and', $relatedToLocations, $relatedProjectTypes];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2017-06-13T03:35:02.897" LastActivityDate="2017-06-13T03:35:02.897" Title="Craft 3 improvements to relationship querying?" Tags="&lt;elementcriteriamodel&gt;&lt;performance&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20812" PostTypeId="2" ParentId="20798" CreationDate="2017-06-13T08:00:09.100" Score="3" Body="&lt;p&gt;I think the key thing here is that its a static Super Table field, which is treated differently to a repeatable one. Instead of looping through each block, there's only one. Fortunately, you have all the required information, as this is in fact the &lt;code&gt;blocktype&lt;/code&gt; variable.    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fieldHandle = 'mySuperTableField' %}&#xA;{% set field = craft.fields.getFieldByHandle(fieldHandle) %}&#xA;{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    {# Start with the top-level Super Table field #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}]&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    {# Ensure any existing rows in your Super Table field are saved #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ blocktype }}][type]&quot; value=&quot;{{ blocktype }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[{{ fieldHandle }}][{{ blocktype }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ fieldHandle }}][{{ blocktype }}][fields][customField1]&quot; value=&quot;Value 1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ fieldHandle }}][{{ blocktype }}][fields][customField2]&quot; value=&quot;Value 2&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[{{ fieldHandle }}][{{ blocktype }}][fields][customField3]&quot; value=&quot;Value 3&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-06-13T08:00:09.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20814" PostTypeId="1" AcceptedAnswerId="20815" CreationDate="2017-06-13T09:56:14.777" Score="1" ViewCount="243" Body="&lt;p&gt;I've got SearchPlus working great on my Craft localhost. But what I'm trying to achieve is making it so that when you type in the navigation bar (_layout) from any page it'll jump onto a search results page and display the results there. I've not got a clue how to go about achieving this, any direction or help would be great. My current setup is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;templates/search/index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;    &amp;lt;h3&amp;gt;Basic Search&amp;lt;/h3&amp;gt;&#xA;&#xA;            &amp;lt;form class=&quot;form-inline&quot;&#xA;                  id=&quot;searchform&quot;&#xA;                  data-applicationId=&quot;{{ craft.searchPlus.getAlgoliaApplicationId }}&quot;&#xA;                  data-searchApiKey=&quot;{{ craft.searchPlus.getAlgoliaSearchApiKey }}&quot;&#xA;                  data-index=&quot;products&quot;&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;searchinput&quot;&amp;gt;Search&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;search&quot; class=&quot;form-control&quot; id=&quot;searchinput&quot; placeholder=&quot;Search..&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;&#xA;            &amp;lt;div id=&quot;results&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div id=&quot;pagination&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;    {% raw %}&#xA;        &amp;lt;!-- Hit template --&amp;gt;&#xA;        &amp;lt;script type=&quot;text/template&quot; id=&quot;hit-template&quot;&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {{#hits}}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;h4&amp;gt;&amp;lt;a href=&quot;{{ uri }}&quot;&amp;gt;{{{ _highlightResult.name.value }}}&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&#xA;                    {{{ description }}}&#xA;                &amp;lt;/li&amp;gt;&#xA;                {{/hits}}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/script&amp;gt;&#xA;&#xA;        &amp;lt;!-- No-Results template --&amp;gt;&#xA;        &amp;lt;script type=&quot;text/template&quot; id=&quot;no-results-template&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;no-results-message&quot; class=&quot;well&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;Sorry, We didn't find any results for the search &amp;lt;em&amp;gt;&quot;{{ query }}&quot;&amp;lt;/em&amp;gt;.&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/script&amp;gt;&#xA;&#xA;        &amp;lt;!-- Pagination template --&amp;gt;&#xA;        &amp;lt;script type=&quot;text/template&quot; id=&quot;pagination-template&quot;&amp;gt;&#xA;            &amp;lt;nav&amp;gt;&#xA;                &amp;lt;ul class=&quot;pagination&quot;&amp;gt;&#xA;                    &amp;lt;li {{^prev_page}}class=&quot;disabled&quot; {{/prev_page}}&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; {{#prev_page}}class=&quot;go-to-page&quot; data-page=&quot;{{ prev_page }}&quot; {{/prev_page}}&amp;gt;&amp;lt;&#xA;                    &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {{#pages}}&#xA;                    &amp;lt;li class=&quot;{{#current}}active{{/current}} {{#disabled}}disabled{{/disabled}}&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;#&quot; {{^disabled}} class=&quot;go-to-page&quot; data-page=&quot;{{ number }}&quot; {{/disabled}}&amp;gt;{{ number }}&#xA;                        &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {{/pages}}&#xA;                    &amp;lt;li {{^next_page}}class=&quot;disabled&quot; {{/next_page}}&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; {{#next_page}}class=&quot;go-to-page&quot; data-page=&quot;{{ next_page }}&quot; {{/next_page}}&amp;gt;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/nav&amp;gt;&#xA;&#xA;&#xA;        &amp;lt;/script&amp;gt;&#xA;    {% endraw %}&#xA;{% endblock %}&#xA;&#xA;{% set searchPlusJs %}&#xA;    (function() {&#xA;        $(this).searchplus();&#xA;    })();&#xA;{% endset %}&#xA;&#xA;{% includeJsFile url('//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js') %}&#xA;{% includeJsFile resourceUrl('searchplus/js/searchplus-combined.min.js') %}&#xA;{% includeJs searchPlusJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="57" LastEditDate="2017-06-13T20:55:30.373" LastActivityDate="2017-06-13T20:55:30.373" Title="Search Page with Search Plus" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20815" PostTypeId="2" ParentId="20814" CreationDate="2017-06-13T11:32:34.210" Score="3" Body="&lt;p&gt;This sounds possibly a little awkward, depending on what you may mean by 'jumps onto a search results page'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some thoughts towards an answer, as you asked: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;actually opening a second page is going to remove you from present context, and raise also the question of getting back if the search results aren't used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you could arrange something happening on typing in the search box by a javascript event on the typing, likely. Probably some issue with transferring what's already typed into such a page, especially with not missing anything being typed while it happens.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a better plan would likely be a Garnish (Craft's ui framework) or other Javascript scrolling modal coming from the original page, no change in url. This might possibly be arranged so that the typing box stays the same, while Algolia results appear in the modal.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Vuejs might be of use in this modal idea, as it handles events and transfer of watched information (the typing) in its framework.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="85" LastActivityDate="2017-06-13T11:32:34.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20816" PostTypeId="1" CreationDate="2017-06-13T12:33:10.597" Score="1" ViewCount="161" Body="&lt;p&gt;Right now my homepage title looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home page - SiteName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i want it to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SiteName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do i do this?&lt;/p&gt;&#xA;" OwnerUserId="6620" LastActivityDate="2021-04-09T04:02:38.203" Title="Seomatic - show only global site title" Tags="&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20817" PostTypeId="1" AcceptedAnswerId="20830" CreationDate="2017-06-13T12:34:53.347" Score="0" ViewCount="77" Body="&lt;p&gt;I assign users to specific user groups and then I created discounts that are applied to orders based on the user groups that the users are in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a scenario where users add items to their cart while they are not logged in. Then when they are ready to do the checkout I show a login or registration page. The user then logs in and is then redirected to the view-cart page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they get to the view cart page there are no discounts applied. Discounts are only applied when an item is added or removed from the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I reevaluate and recalculate any applicable discounts based on the user groups the user is in when the user logs in?&lt;/p&gt;&#xA;" OwnerUserId="6847" LastActivityDate="2017-06-14T06:56:17.927" Title="Apply discount on login during commerce checkout process" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20818" PostTypeId="1" AcceptedAnswerId="20820" CreationDate="2017-06-13T12:44:40.543" Score="2" ViewCount="585" Body="&lt;p&gt;I am trying to create a category template that shows all entries to show relating to the categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the minute the cats are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Industry &lt;/li&gt;&#xA;&lt;li&gt;Chemical&lt;/li&gt;&#xA;&lt;li&gt;Medical&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6829" LastEditorUserId="6829" LastEditDate="2017-06-14T08:13:50.617" LastActivityDate="2017-06-14T08:13:50.617" Title="Only show entries related to category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;category&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20819" PostTypeId="2" ParentId="20816" CreationDate="2017-06-13T12:53:57.983" Score="1" Body="&lt;p&gt;Did you remove the standard title tag placed in the &lt;code&gt;_layout.html&lt;/code&gt; file by craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This line is probably breaking your SEO title: &lt;code&gt;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&lt;/code&gt; This is found inside the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; tags&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not you should navigate to SEO &gt; Site Meta and take a look in the settings there. The only problem then is that you could only disable the site name being placed not the title. But I guess its the line of code you still have in your _layout&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-06-13T12:53:57.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20820" PostTypeId="2" ParentId="20818" CreationDate="2017-06-13T13:02:26.910" Score="3" Body="&lt;p&gt;Personally I would set the category select field outside of the matrix block but that's up to you. &#xA;The problem you are running in to at the moment is you are not looping over the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('job') %}&#xA;    {% for block in entry.matrixFieldName if block.type == 'job' %}&#xA;        {% for category in block.category %}&#xA;            &amp;lt;h2&amp;gt;{{category.title}}&amp;lt;/h2&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ block.title }}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what we are doing here in the first loop we dive into the jobs section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('job') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once we are inside a job entry we loop over the matrix field containing the &quot;job&quot; block. We only want to display the &quot;job&quot; block (security for when you add more blocks in the future). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldName if block.type == 'job' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once we get into the matrix field we loop over the selected category field. This way you get access to all the fields inside that category (including the title).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in block.category %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have access to all the fields. &#xA;All the fields you want to use from the jobs entry you can grab by {{ entry.field }}. All the fields inside the matrix block by {{ block.field }}. And everything inside the category by {{ category.field }}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;OLD ANSWER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correct me if I get you wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess you have a field that connects an entry to a category but what you could try is something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('jobs') %}&#xA;    {% for category in entry.CATEGORYFIELD %}&#xA;         &amp;lt;h2&amp;gt;{{category.title}}&amp;lt;/h2&amp;gt;&#xA;    {% endfor %}&#xA;     &amp;lt;a href=&quot;{{entry.url}}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is if the order doesn't matter.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-06-13T15:05:21.393" LastActivityDate="2017-06-13T15:05:21.393" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20821" PostTypeId="1" CreationDate="2017-06-13T14:24:49.133" Score="3" ViewCount="326" Body="&lt;p&gt;Have a site registering users.&#xA;The user record in the CP says they registered at 11:39 June 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database 'dateCreated' says 10:39.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site settings timezone are UTC+1 BST.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP config date.timezone is Europe/London (actual location)&#xA;and Default timezone is UTC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I turn off UTC +1 in Craft timezone settings to UTC then front end user record matches database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can't figure out for sure is what time did they really register? :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="125" LastEditDate="2017-06-14T07:12:50.723" LastActivityDate="2017-06-14T07:12:50.723" Title="Date value different in CP and database" Tags="&lt;database&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20823" PostTypeId="1" AcceptedAnswerId="20828" CreationDate="2017-06-13T15:50:00.990" Score="0" ViewCount="337" Body="&lt;p&gt;I'm building out multi-page forms using composer. And having a submit button at the bottom of page 1 (of 5) is weird. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I change the text for the next/previous buttons on pages using the freeform render tag?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer that only the last page of the form have the submit button, and all the other pages have buttons that say &quot;Previous&quot; and/or &quot;Next.&quot; &lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-06-13T19:09:44.537" Title="Solspace Freeform - Change &quot;submit&quot; button to &quot;next&quot;" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20824" PostTypeId="1" AcceptedAnswerId="20831" CreationDate="2017-06-13T16:48:55.037" Score="1" ViewCount="75" Body="&lt;p&gt;I've run accross an issue that seems like a bug to me and I'm desperately looking for some help to solve it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created user groups in Craft &amp;amp; Discounts applicable to those user groups in Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a user lands on the site and adds items to his cart &amp;amp; proceeds to checkout&lt;/li&gt;&#xA;&lt;li&gt;the user is prompted to login or register &lt;/li&gt;&#xA;&lt;li&gt;the user logs in OR registers &#xA;3a. upon registration the user is activated &amp;amp; auto logged in with the 'autoLoginAfterAccountActivation' =&gt; true config option&lt;/li&gt;&#xA;&lt;li&gt;the user is redirected back to his cart - at this point in time I'm expecting to see a discount adjustment on the cart&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The problem is that there is no discount adjustment on the cart - the only way the discount adjustment kicks in is if the cart is updated, by adding or removing an item ie: updateCart is fired. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've double checked my discount rules &amp;amp; they are definitely setup correctly - the problem is that the users cart is &quot;remembered&quot; from before he was registered ie: before he was part of a user group that is eligible for a discount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to &quot;force&quot; a cart refresh of some sorts. &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-06-14T06:55:47.933" Title="User group discount not applied when user has existing cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20825" PostTypeId="2" ParentId="20821" CreationDate="2017-06-13T17:28:43.743" Score="4" Body="&lt;p&gt;Craft stores all dates in UTC to the database, no matter what timezone you configure in settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When (user) models are populated, e.g. for use in the CP, &lt;code&gt;DateTime&lt;/code&gt; objects are created from these values and the objects’ timezones are set to the one you configured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to output a user’s &lt;code&gt;dateCreated&lt;/code&gt; attribute in a date format that includes the timezone you can easily do that in a template using the &lt;code&gt;date&lt;/code&gt; Twig filter. This will return the date in ISO 8601 format using your configured default timezone.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ user.dateCreated|date('c') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also output the date formatted for a diffenent timezone.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ user.dateCreated|date('c', 'Europe/Paris') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-06-14T07:06:49.783" LastActivityDate="2017-06-14T07:06:49.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20826" PostTypeId="2" ParentId="15769" CreationDate="2017-06-13T17:55:18.137" Score="2" Body="&lt;p&gt;As noted in the comments above, eager-loading is not yet compatible with Live Preview. A clean workaround is to disable eager-loading in the template when the page is being viewed in Live Preview:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isLivePreview %}&#xA;    {% set images = entry.gallery %}&#xA;{% else %}&#xA;    {% set images = craft.assets({&#xA;        relatedTo: {sourceElement: entry.id, field: 'gallery'}&#xA;    }) %}&#xA;{% endif %}&#xA;&#xA;{% for image in images %}&#xA;    {{ image.url }}&amp;lt;br /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5071" LastActivityDate="2017-06-13T17:55:18.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20828" PostTypeId="2" ParentId="20823" CreationDate="2017-06-13T19:09:44.537" Score="1" Body="&lt;p&gt;If you click on the button that you are adding while making the form, it allows you to change the text to whatever you want it to say. Is that not what you are wanting to do?&lt;/p&gt;&#xA;" OwnerUserId="6832" LastActivityDate="2017-06-13T19:09:44.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20829" PostTypeId="1" AcceptedAnswerId="20833" CreationDate="2017-06-14T00:35:07.607" Score="2" ViewCount="248" Body="&lt;p&gt;I have Craft Commerce installed, and I wanted to search title against both product title and variant title. I looked up in the database, I noticed that products and variants are of two element types, &lt;code&gt;Commerce_Product&lt;/code&gt; and &lt;code&gt;Commerce_Variant&lt;/code&gt;. As far as I know, with &lt;code&gt;ElementCriteriaModel&lt;/code&gt; you can only query against one element type, like what I have now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Product');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to query against multiple element types in one db call?&lt;/p&gt;&#xA;" OwnerUserId="6848" LastActivityDate="2017-06-14T04:21:13.077" Title="How do I query multiple element types in one query" Tags="&lt;plugin-craftcommerce&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20830" PostTypeId="2" ParentId="20817" CreationDate="2017-06-14T00:43:09.673" Score="0" Body="&lt;p&gt;I have confirmed this would indeed appear to be a bug in Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick workaround would be to listen to login events and call some sort of update cart hack, but this is really a fix that should happen at the Commerce end of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll report it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Luke Holder comfirms he's found the bug and it will be fixed in the next point release coming soon.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-14T06:56:17.927" LastActivityDate="2017-06-14T06:56:17.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20831" PostTypeId="2" ParentId="20824" CreationDate="2017-06-14T00:46:53.173" Score="1" Body="&lt;p&gt;I have confirmed this would indeed appear to be a bug in Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick workaround would be to listen to login events and call some sort of update cart hack, but this is really a fix that should happen at the Commerce end of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll report it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Luke Holder comfirms he's found the bug and it will be fixed in the next point release coming soon.&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-06-14T06:55:47.933" LastActivityDate="2017-06-14T06:55:47.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20833" PostTypeId="2" ParentId="20829" CreationDate="2017-06-14T04:21:13.077" Score="0" Body="&lt;p&gt;This is more of a limitation of Craft than Commerce, but it's currently not possible in one query... you'd need to do two and perform some merging/filtering logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider thumbs-upping/commenting on &lt;a href=&quot;https://github.com/craftcms/cms/issues/878&quot; rel=&quot;nofollow noreferrer&quot;&gt;this feature request&lt;/a&gt; which would enable what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-14T04:21:13.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20835" PostTypeId="2" ParentId="20587" CreationDate="2017-06-14T04:44:36.443" Score="2" Body="&lt;p&gt;An answer to point 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ location.hours[now|date('w')].open &amp;lt; now and location.hours[now|date('w')].close &amp;gt; now ? 'Open now' : 'Closed' }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that same logic can be used to resolve issue 2)&lt;/p&gt;&#xA;" OwnerUserId="5215" LastActivityDate="2017-06-14T04:44:36.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20836" PostTypeId="1" CreationDate="2017-06-14T08:37:24.667" Score="3" ViewCount="559" Body="&lt;p&gt;I have problem whereby I can't override a single page's SEO by using a field, because the page has too many table rows in the database, due to being very field heavy. Don't ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'd like to manually override the global &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; that &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; produces in the individual template page. But haven't been able to get it to work from the docs, as I'm just producing a second title tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help please?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-06-14T19:06:08.893" LastActivityDate="2017-06-14T19:06:08.893" Title="SEOmatic plugin override global title in individual template" Tags="&lt;templating&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20838" PostTypeId="1" CreationDate="2017-06-14T11:34:34.887" Score="1" ViewCount="156" Body="&lt;p&gt;Currently using Algolia with SearchPlus on my setup. Unfortunately some data is quite clunky e.g. Prices with 23.93 48.12 etc. What I'm wanting to do is have range pricing/grouping where by I can define 20-50 as a facet and all prices within those ranges appear?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Facet template --&amp;gt;&#xA;&amp;lt;script type=&quot;text/template&quot; id=&quot;facet-template&quot;&amp;gt;&#xA;    &amp;lt;h4&amp;gt;{{ title }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;div class=&quot;product-search-facet-row&quot;&amp;gt;&#xA;        {{#values}}&#xA;        &amp;lt;div class=&quot;checkbox toggle-refine {{#isRefined}}facet-refined{{/isRefined}}&quot;  data-facet=&quot;{{ facet }}&quot; data-value=&quot;{{ name }}&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; {{#isRefined}} checked{{/isRefined}}&amp;gt;&#xA;                {{ name }}&#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {{/values}}&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;hr/&amp;gt;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is an Alogia side or SearchPlus JS.&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-06-14T11:34:34.887" Title="Range Facets with SearchPlus and Algolia" Tags="&lt;entries&gt;&lt;search&gt;&lt;plugin-searchplus&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20839" PostTypeId="2" ParentId="20836" CreationDate="2017-06-14T11:52:30.180" Score="4" Body="&lt;p&gt;Are you using the &lt;code&gt;SEOMatic Meta&lt;/code&gt; fieldType? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do is create a field of this field type and assign it to the entry type you're dealing with. Within this field, there are all sorts of values you can override. For instance, you can point the SEO title field to one of your other fields via a dropdown, or you can manually type in a new SEO title just for this particular entry.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-06-14T11:52:30.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20840" PostTypeId="2" ParentId="20518" CreationDate="2017-06-14T12:30:05.670" Score="1" Body="&lt;p&gt;Got the same problem with Craft3 (3.0.0-beta.19). Had to change the imageDriver to GD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &lt;code&gt;'imageDriver' =&amp;gt; 'gd',&lt;/code&gt; to &lt;code&gt;config/general.php&lt;/code&gt; and replace/reupload the files in Craft.&lt;/p&gt;&#xA;" OwnerUserId="6854" LastActivityDate="2017-06-14T12:30:05.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20841" PostTypeId="1" CreationDate="2017-06-14T15:35:00.957" Score="1" ViewCount="42" Body="&lt;p&gt;I’m having a problem modifying an ElementCriteria with buildElementsQuery.&#xA;The results elements totally mixes locale results. I can only get english URL for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a gist of my code.&#xA;&lt;a href=&quot;https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is there something particular to do when using buildElementQuery ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nicolas&lt;/p&gt;&#xA;" OwnerUserId="2178" LastActivityDate="2017-06-14T21:14:55.317" Title="Trouble with buildElementQuery customization" Tags="&lt;elementcriteriamodel&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20843" PostTypeId="2" ParentId="20793" CreationDate="2017-06-14T18:09:17.230" Score="2" Body="&lt;p&gt;Craft will only extract the search keywords for an element during the element saving process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have existing custom elements already saved, then you go in and add the &lt;code&gt;defineSearchableAttributes()&lt;/code&gt; to your element type, you'll need to re-save the existing elements in order for their search keywords to be indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or now that I think about it... the easier way would probably be to just run the &quot;Update Search Indexes&quot; tool in the Control Panel under Settings-&gt;Tools. It will do the same thing for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-14T18:09:17.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20844" PostTypeId="1" CreationDate="2017-06-14T19:21:33.010" Score="5" ViewCount="860" Body="&lt;p&gt;I've migrated my Craft project from CentOS/PHP5 to Ubuntu/PHP7 ---  since then I'm seeing this message in /craft/storage/runtime/logs/phperrors.log&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[14-Jun-2017 14:40:49 UTC] PHP Warning:  Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;[14-Jun-2017 14:40:49 UTC] PHP Warning:  Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;[14-Jun-2017 15:50:53 UTC] PHP Warning:  Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;[14-Jun-2017 15:50:53 UTC] PHP Warning:  Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;[14-Jun-2017 16:03:04 UTC] PHP Warning:  Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;[14-Jun-2017 16:03:04 UTC] PHP Warning:  Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /home/hidden/craft/app/services/UserSessionService.php on line 17&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any Help?&lt;/p&gt;&#xA;" OwnerUserId="5873" LastActivityDate="2017-06-14T21:14:19.213" Title="CraftCMS &gt; UserSessionService should be compatible with CWebUser" Tags="&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20845" PostTypeId="2" ParentId="20841" CreationDate="2017-06-14T19:45:30.253" Score="1" Body="&lt;p&gt;I finally found that my problem was a SQL one not a CMS one. The where conditions grouping were the source of the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the final code I used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2178" LastEditorUserId="57" LastEditDate="2017-06-14T21:14:55.317" LastActivityDate="2017-06-14T21:14:55.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20846" PostTypeId="2" ParentId="20844" CreationDate="2017-06-14T21:14:19.213" Score="6" Body="&lt;p&gt;It's a known issue you can safely ignore on Craft 2, that's been resolved for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP 7.0 (or maybe it was 7.1) changed the way that particular error was reported from &lt;code&gt;E_STRICT&lt;/code&gt; (which Craft 2 is suppressing) to &lt;code&gt;E_WARNING&lt;/code&gt;, which Craft 2 isn't suppressing, so now it pops up on latter versions of PHP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-14T21:14:19.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20847" PostTypeId="2" ParentId="20781" CreationDate="2017-06-14T23:29:49.193" Score="1" Body="&lt;p&gt;My guess is it's because your &lt;code&gt;NbspPlugin&lt;/code&gt; class has the namespace of &lt;code&gt;craft&lt;/code&gt;, when it should be namespace &lt;code&gt;Craft&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, generating Craft plugin boilerplate code through something like &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; is a great way to save sanity and avoid things like this. :)&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-14T23:29:49.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20848" PostTypeId="2" ParentId="20787" CreationDate="2017-06-15T03:40:00.590" Score="1" Body="&lt;p&gt;Confirmed by Luke this was due to a bug to be fixed in the next release of Commerce.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-06-15T03:40:00.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20849" PostTypeId="1" AcceptedAnswerId="20850" CreationDate="2017-06-15T07:48:50.220" Score="1" ViewCount="376" Body="&lt;p&gt;All of my products have a category field called stateCat. These state categories have a field called stateImportance. This is because some states are more important than others and I want to sort the products based on that stateImportance number. I have no idea how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.order('stateCat.stateImportance asc').type('coins').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to work, how can I accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2017-06-15T09:35:01.363" Title="Sort products by category field value" Tags="&lt;ordering&gt;&lt;queries&gt;&lt;order&gt;&lt;products&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20850" PostTypeId="2" ParentId="20849" CreationDate="2017-06-15T09:35:01.363" Score="2" Body="&lt;p&gt;This doesn't work out of the box with Craft as the category field is a relation field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However you should be able to use &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperSort&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.type('coins').limit(null) %}&#xA;{% set orderedProducts = products | supersort('sortAs', '{stateCat.first.stateImportance}' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4183" LastActivityDate="2017-06-15T09:35:01.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20851" PostTypeId="2" ParentId="9680" CreationDate="2017-06-15T13:18:07.773" Score="1" Body="&lt;p&gt;Thx, this is how I used it to get the titles of all events in the current language:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;{% set events = craft.entries.section('events').level(1).locale(locale) %}&#xA;{% for event in events %}&#xA;    &amp;lt;p&amp;gt;{{ event.title }}&amp;lt;/p&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6857" LastActivityDate="2017-06-15T13:18:07.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20853" PostTypeId="1" CreationDate="2017-06-15T15:06:41.973" Score="1" ViewCount="212" Body="&lt;h1&gt;Question 1&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I have a Node/Express application where the users are registered and are using some kind of service. I want to have a list of the registered users and their info inside Craft CMS admin panel.  Node/Express may use MongoDB or MySQL. This kind of hybrid to work, I assume that Node/Express and Craft CMS should be using the same MySQL database? Is this possible at all to integrate them?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Question 2&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Can you generally review what the architecture of the application would be in the scenario below?&#xA;Lets say we want a web application where the users are registering, uploading their pictures in members area, writing some logs about themselves, but on the other hand, inside the members area they are able to see content from Craft CMS.  Lets say frontend is done via REACT, and the frontend team just sends us request calls and we should just answer. What technology would you use and how to accomplish this? Must it be done in php?&lt;/p&gt;&#xA;" OwnerUserId="6858" LastActivityDate="2017-06-15T15:06:41.973" Title="Craft CMS Integration with Node" Tags="&lt;plugin-elementapi&gt;&lt;craft-features&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20854" PostTypeId="1" AcceptedAnswerId="20855" CreationDate="2017-06-15T15:13:28.230" Score="3" ViewCount="275" Body="&lt;p&gt;All I'm trying to do is put the category title on a category listing page into the title tag.&#xA;So I've got the variable set up, but if I add the category title tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = &quot;{{ category.title }}&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The end result is this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ category.title}}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So do I need to escape the quotes?&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2017-06-15T15:27:58.457" Title="Category name in page title" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20855" PostTypeId="2" ParentId="20854" CreationDate="2017-06-15T15:27:58.457" Score="2" Body="&lt;p&gt;You don't have to fill in the quote's or the curly brackets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could just put it down like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = category.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You already &quot;called&quot; twig so you dont need to do that again.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-06-15T15:27:58.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20857" PostTypeId="1" CreationDate="2017-06-15T18:42:40.980" Score="2" ViewCount="949" Body="&lt;p&gt;I'm not sure I've seen this exact question, but I'm curious how I can include custom and/or auto-generated parts of a slug. It's not the URI creation, but the slug itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Instance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{slug}-{id}&lt;/code&gt; would turn into &lt;code&gt;lorem-ipsum-dolor-sit-amet-123456&lt;/code&gt; on submit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and from there on the variable &lt;code&gt;{{entry.url}}&lt;/code&gt; would be &lt;code&gt;example.com/lorem-ipsum-dolor-sit-amet-123456&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know ExpressionEngine had an option in the Channel preferences called URL Title Prefix, so this would go along those lines, but more auto-generated than a predefined set of words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it changes things, this is specifically for Commerce and Digital Products at the moment.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2017-06-15T22:56:16.517" Title="Auto generating slug with custom fields or ID" Tags="&lt;slug&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20858" PostTypeId="1" AcceptedAnswerId="20914" CreationDate="2017-06-15T20:24:40.037" Score="1" ViewCount="394" Body="&lt;p&gt;On the form I'm building, I've got a question with radio buttons. And the answers have custom values. e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: What is your favorite color?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;red (value: 10)&lt;/li&gt;&#xA;&lt;li&gt;blue (value: 20)&lt;/li&gt;&#xA;&lt;li&gt;yellow (value: 30) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On my submissions page, I have the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in submission.fieldMetadata %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-3&quot;&amp;gt;&#xA;        &amp;lt;b&amp;gt;{{ field.label }}/b&amp;gt;:&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col-xs-9&quot;&amp;gt;&#xA;        {% set fieldValue = attribute(submission, field.handle).value %}&#xA;        {% if fieldValue is iterable %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for value in FieldValue %}&#xA;            &amp;lt;li&amp;gt;{{ value }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        {% else %}&#xA;        {{ fieldValue }}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this returns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What is your favorite color: 10&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the values to do some funny math - so it's necessary (but unimportant to the issue at hand).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to do I get the value &quot;red&quot; to show, instead of the 10?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;attribute(submission, field.handle).value - shows the selected option's value (10)&#xA;&lt;br&gt;attribute(submission, field.handle).label - shows the question (What is your favorite Color?)&#xA;&lt;br&gt;attribute(submission, field.handle).handle - shows the question handle (whatIsYourFavoriteColor)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There should be another function to get the option's value, but I can't find what it is.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2017-06-15T20:31:22.260" LastActivityDate="2017-06-21T17:20:17.230" Title="Freeform - get option label &amp; value on submissions page" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20860" PostTypeId="1" AcceptedAnswerId="20864" CreationDate="2017-06-15T21:41:16.277" Score="1" ViewCount="1013" Body="&lt;p&gt;I have a section for Businesses. I also have categories that these businesses can belong to. On each category page I want to list all the businesses that belong to that category. So far so good, but here's the rub: Each business also has an entry field that relates the business to a Town entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Businesses belong both to a category and a town entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the category page I want to list the businesses by towns. So instead of having a laundry list of businesses, the businesses would be broken up by the different towns they belong to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Town A&#xA;    - Business 1&#xA;    - Business 2&#xA;Town B&#xA;    - Business 3&#xA;Town C&#xA;    - Business 4&#xA;    - Business 5&#xA;    - Business 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am grabbing my businesses like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set businesses = craft.entries.relatedTo(category) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen other answers to different questions suggest GROUP, but I'm not sure how to correctly go about using the group method on an array when I am trying to group via another array (entry field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this, but it results in &quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set businessesByTown = businesses|group('bizTown') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that's fishy and incorrect, but I don't know how to accomplish it the right way. &lt;code&gt;bizTown&lt;/code&gt; is the entry field I want to sort by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could help, that'd be wonderful! Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="57" LastEditDate="2017-06-15T22:57:26.593" LastActivityDate="2017-06-16T15:29:38.947" Title="Sort entries in a category via entry field" Tags="&lt;entries&gt;&lt;categories&gt;&lt;sorting&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20861" PostTypeId="1" CreationDate="2017-06-15T22:11:42.637" Score="1" ViewCount="411" Body="&lt;p&gt;We have a front end form for a logged in user to change their Username (email). In our testing, it does not appear to check against and prevent selecting an email address that's already taken (like happens on a login form). However, our Create Account from - which is almost identical - works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Form (our create account form) works and catches duplicate emails and returns an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;createForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ siteUrl }}account/signup-sent&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Email &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;signupEmail&quot; name=&quot;email&quot; placeholder=&quot;Email&quot; value=&quot;&quot; data-parsley-type=&quot;email&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Confirm Email &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;confirmEmail&quot; placeholder=&quot;Confirm Email&quot; value=&quot;&quot; data-parsley-type=&quot;email&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input name=&quot;password&quot; id=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;Password&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Confirm Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input name=&quot;confirmPassword&quot; id=&quot;confirmPassword&quot; type=&quot;password&quot; placeholder=&quot;Confirm Password&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[accountReceiveEmails]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[accountReceiveEmails][]&quot; value=&quot;yes&quot; id=&quot;emailOptin&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;emailOptin&quot;&amp;gt;&amp;lt;span class=&quot;checkbox&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;Yes, I would also like to receive offers, discounts and news for Cadex products by email.&amp;lt;/label&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;footer&amp;gt;&#xA;        &amp;lt;button&amp;gt;Create Account&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/footer&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is our form for users logged into their account. It does not return an error when a user tries changing their email to one that already exists in another account:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;profileCredsForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/profile/saved&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Current Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;currentPassword&quot; name=&quot;password&quot; placeholder=&quot;Current Password&quot; value=&quot;&quot; data-parsley-required=&quot;true&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;New Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input name=&quot;newPassword&quot; id=&quot;newPassword&quot; type=&quot;password&quot; placeholder=&quot;New Password&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Confirm New Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input name=&quot;confirmNewPassword&quot; id=&quot;confirmNewPassword&quot; type=&quot;password&quot; placeholder=&quot;Confirm New Password&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;New Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;New Email&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Confirm New Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;confirmNewEmail&quot; placeholder=&quot;Confirm New Email&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Update&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've tested this repeatedly, changing an email to one for another existing account and no error is returned, the form submits and the email is sent to confirm the new email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as an aside, the confirm link in the follow up email seens to ignore the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; set in our config. Is that expected behaviour?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-06-15T23:18:59.717" LastActivityDate="2017-07-21T22:15:47.293" Title="Changing Username On Front End To Another Account Email" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20862" PostTypeId="2" ParentId="20355" CreationDate="2017-06-15T22:18:43.527" Score="2" Body="&lt;p&gt;You can limit to only products that have multiple related categories like so:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dressesCat = craft.categories...first() %}&#xA;{% set blackCat = craft.categories...first() %}&#xA;&#xA;{% set products = craft.commerce.products({&#xA;    relatedTo: {&#xA;        targetElement: ['and', dressesCat, blackCat],&#xA;        field: 'productCategories'&#xA;    }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-06-15T22:18:43.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20863" PostTypeId="2" ParentId="20857" CreationDate="2017-06-15T22:56:16.517" Score="1" Body="&lt;p&gt;I think for this you'd want to write a &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onSaveEntry&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin would check that the given entry is in the correct section/entry type you're interested in, pull any data from custom fields set on the entry update the slug for that entry accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd probably look at updating the slug directly in the database and avoid going back through &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;saveEntry()&lt;/code&gt; to avoid getting into an infinite save entry loop.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-15T22:56:16.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20864" PostTypeId="2" ParentId="20860" CreationDate="2017-06-16T07:54:43.237" Score="3" Body="&lt;p&gt;You are getting this error because the &quot;entries&quot; fields are always considered to be a query (ElementCriteriaModel) that can return more than one element. Therefore, if you know for sure that you will always have one and only one town linked to a business, you could do something like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set businessesByTown = businesses|group('bizTown[0].title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the title field is the name of the town you should get an associative array with the town names as keys and the businesses entries as values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Additional info about sorting, following swthate's comment below:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to sort the businesses, I think it can be done in the original query, so it would become:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set businesses = craft.entries.relatedTo(category).order('title') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the towns cannot be sorted directly since Twig's sort filter uses asort which sorts the array based on values. What you can do then is extract the &lt;code&gt;businessesByTown&lt;/code&gt; array's keys in another array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set towns = businessesByTown|keys|sort %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You now have a sorted list of towns. Using this list, you can loop on all towns and businesses like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for town in towns %}&#xA;    {{ town }}&#xA;    {% set townBusinesses = businessesByTown[town] %}&#xA;    {% for business in townBusinesses %}&#xA;        {{ business.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3570" LastEditorUserId="3570" LastEditDate="2017-06-16T15:29:38.947" LastActivityDate="2017-06-16T15:29:38.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20865" PostTypeId="1" AcceptedAnswerId="20868" CreationDate="2017-06-16T11:40:03.500" Score="2" ViewCount="335" Body="&lt;p&gt;I have a content block in a matrix field where I'm trying to output a loop of three sub images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Zm08k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zm08k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get it to work using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;secondaryImage&quot; %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% set image = block.image.first() %}&#xA;    {% if image | length %}&#xA;    &amp;lt;ul class=&quot;clearfix&quot;&amp;gt;&#xA;    {% for image in block.image %}&#xA;      &amp;lt;li&amp;gt;&#xA;        &amp;lt;img class=&quot;img-responsive&quot; src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to output responsive sizes and like to use the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager-Craft&lt;/a&gt; plugin with the &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-FocusPoint&lt;/a&gt; plugin for this on my other images which works really well. But, I'm running into an issue whereby it's only outputting the first image three times with the following code: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tFk15.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tFk15.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;secondaryImage&quot; %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% set image = block.image.first() %}&#xA;    {% set transformedImages = craft.imager.transformImage(image,&#xA;      [&#xA;          { width: 1440, ratio: 6/4 },&#xA;          { width: 1024, ratio: 6/4 },&#xA;          { width: 750, ratio: 4/3, jpegQuality: 60 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          jpegQuality: 100,&#xA;          position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%',&#xA;          interlace: true&#xA;      }&#xA;    ) %}&#xA;    {% if image | length %}&#xA;    &amp;lt;ul class=&quot;clearfix&quot;&amp;gt;&#xA;    {% for image in block.image %}&#xA;      &amp;lt;li&amp;gt;&#xA;        &amp;lt;img class=&quot;img-responsive&quot;&#xA;             src=&quot;{{ transformedImages[1].url }}&quot;&#xA;             sizes=&quot;33vw&quot;&#xA;             srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;             alt=&quot;{{ image.title }}&quot;&#xA;             width=&quot;100%&quot;&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think the issue is on the line &lt;code&gt;src=&quot;{{ transformedImages[1].url }}&quot;&lt;/code&gt; but I can't find what to change it to, to output the different images. The first thing I tried was removing the &lt;code&gt;[1]&lt;/code&gt;, but that doesn't work and gives an error of Key &quot;url&quot; for array with keys &quot;0, 1, 2&quot; does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can help, otherwise I'll have to take it out of the matrix field and create a field for each image. But would prefer to keep it in the matrix if possible?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-06-16T12:28:26.210" Title="loop through responsive images in matrix with imager plugin" Tags="&lt;responsive-images&gt;&lt;plugin-imager&gt;&lt;plugin-focuspoint&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20866" PostTypeId="1" CreationDate="2017-06-16T11:54:01.937" Score="1" ViewCount="43" Body="&lt;p&gt;Is there a way to override the Craft Commerce config files ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm specifically talking about this one, deep inside the plugin &lt;code&gt;craft/plugins/commerce/etc/currencies.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to change the default amount of decimals for Euros&lt;/p&gt;&#xA;" OwnerUserId="6015" LastActivityDate="2017-06-16T15:31:01.220" Title="Overriding Craft Commerce config files" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20868" PostTypeId="2" ParentId="20865" CreationDate="2017-06-16T12:28:26.210" Score="3" Body="&lt;p&gt;You’re currently passing in the image model you queried for using &lt;code&gt;first()&lt;/code&gt; into the &lt;code&gt;craft.imager.transformImage&lt;/code&gt; function, but you actually need to pass in the models that you get when looping through all images added to your block’s field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s no reason to do the &lt;code&gt;first()&lt;/code&gt; at all, and it would add additional queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.image|lenght %}&#xA;    {% for image in block.image %}&#xA;        {% set transformedImages = craft.imager.transformImage(image, transforms, options) %}&#xA;&#xA;        &amp;lt;img src=&quot;{{ transformedImages[1].url }}&quot;&#xA;            sizes=&quot;33vw&quot;&#xA;            srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-06-16T12:28:26.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20869" PostTypeId="1" AcceptedAnswerId="20901" CreationDate="2017-06-16T12:42:43.417" Score="1" ViewCount="298" Body="&lt;p&gt;I have a website where my client can create entries in a couple of different channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets take a &quot;news&quot; channel. The url would be: &quot;example.com/news/nameofpage&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever a wrong url is entered manually behind &quot;example.com/news/&quot; (or maybe a wrong filled in link) it won't go to the 404 page but just enters the channel's template and display's an empty page. For everything else the 404 error works but whenever a channels slug is in the url as a first segment it only gives an empty template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured out it happens all the time whenever there is a second segment in the url&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-06-16T14:25:12.973" LastActivityDate="2017-06-20T07:17:59.280" Title="Empty page instead of 404 error when url contains channel slug" Tags="&lt;templating&gt;&lt;error&gt;&lt;redirect&gt;&lt;404&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20870" PostTypeId="1" AcceptedAnswerId="20884" CreationDate="2017-06-16T13:03:20.527" Score="2" ViewCount="326" Body="&lt;p&gt;I am facing an issue with file uploads. I installed a new installation of Craft CMS on Microsoft Azure server. MS Azure assigns a default domain to your webapp like example.azurewebsites.net. &#xA;So while the default domain was assigned, I uploaded few asset files (images) successfully. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later we had a custom domain added to Azure like mydomain.org&#xA;Once the custom domain was mapped, I edited the SiteURL (in Settings -&gt; General -&gt; mydomain.org) to the custom domain.&#xA;Now I am unable to upload asset files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error log shown in the Craft CMS craft.log (from Server Info) is move_uploaded_file(): Filename cannot be empty (D:\serverpath\craft\app\assetsourcetypes\BaseAssetSourceType.php:170)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please help. &lt;/p&gt;&#xA;" OwnerUserId="6864" LastActivityDate="2017-06-19T05:59:57.410" Title="File upload error in MS Azure after custom domain was pointed to Azure server" Tags="&lt;assets&gt;&lt;craft-pro&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20871" PostTypeId="1" AcceptedAnswerId="20874" CreationDate="2017-06-16T15:21:19.950" Score="0" ViewCount="397" Body="&lt;p&gt;I've recently setup a new cloud server for a client with a Craft Multi Environment setup. And I also would like to to be able to do the &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt; as in the excellent &lt;a href=&quot;https://nystudio107.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;nystudio107&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have it setup at my work and it works really well as you just have to navigate to &lt;strong&gt;/scripts&lt;/strong&gt; folder via the terminal, and then type &lt;code&gt;./pull_db.sh&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like I said I have this setup at my office and it works really well. But on this new server I've setup I'm having an issue in that I get the following when I do the &lt;code&gt;./pull_db.sh&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;-bash: ./pull_db.sh: Permission denied&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've checked the setting in the &lt;code&gt;.env.sh&lt;/code&gt; that I've created and match what I have in the office setup. So need to work out why I'm getting the permission denied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-06-16T18:45:15.223" Title="Database &amp; Asset Syncing Between Environments" Tags="&lt;assets&gt;&lt;database&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20872" PostTypeId="2" ParentId="20866" CreationDate="2017-06-16T15:31:01.220" Score="1" Body="&lt;p&gt;For that particular file, the answer is no... not without hacking the core Commerce plugin file, which we don't recommend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think there's a bug in the file, send an email to support@craftcommerce.com.  If you'd like to create a feature request to open up that file so it is configurable, you can do that &lt;a href=&quot;https://craftcms.uservoice.com/forums/295386-commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-16T15:31:01.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20873" PostTypeId="1" CreationDate="2017-06-16T18:00:44.243" Score="1" ViewCount="149" Body="&lt;p&gt;I've set up four custom image transforms on the page and would like the content editor to be able to select which size they want the image to be from a drodown field preconfigured with the transformation names. This is all within a Matrix field, btw. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14679/using-image-transform-as-another-custom-field/14682&quot;&gt;This answer was close&lt;/a&gt;, and helped me put &lt;code&gt;.value&lt;/code&gt; on the end of my dropdown field variable, but it must only work with pre configured image transforms in Craft's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# medium 16:9 #}&#xA;{% set landscapeMd = {&#xA;  width: 439,&#xA;  height: 247,&#xA;  quality: 80,&#xA;} %}&#xA;&#xA;{# medium 9:16 #}&#xA;{% set portraitMd = {&#xA;  width: 278,&#xA;  height: 494,&#xA;  quality: 80,&#xA;} %}&#xA;&#xA;{% for block in entry.productCollage %}&#xA;  {% switch block.type %}&#xA;    {% case &quot;digitalProduct&quot; %}&#xA;      // selected via dropdown field&#xA;      {% set transformType = block.imageAspectRatio.value %}&#xA;&#xA;      &amp;lt;figure&amp;gt;&#xA;        {% for image in block.image %}&#xA;          &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.url(transformType) }}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/figure&amp;gt;&#xA;  {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I get with this code is an error that says the selected image transform is not available. However, if I type in that image transform verbatim, it works fine.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2017-06-16T20:00:44.037" LastActivityDate="2017-06-16T20:38:26.177" Title="User-selected Image Transform" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20874" PostTypeId="2" ParentId="20871" CreationDate="2017-06-16T18:45:15.223" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;-bash: ./pull_db.sh: Permission denied&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The error indicates that the shell script doesn't have execute permissions.  Running this command should make it executable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chmod +x pull_db.sh&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-16T18:45:15.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20875" PostTypeId="1" CreationDate="2017-06-16T19:32:53.090" Score="1" ViewCount="1063" Body="&lt;p&gt;I am having issues running CraftCMS in a vagrant environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference:&lt;br&gt;&#xA;    I am using ubuntu 17.04&lt;br&gt;&#xA;    Vagrant version 1.9.5&lt;br&gt;&#xA;    ubuntu/xenial64 (virtualbox, 20170525.0.0)&lt;br&gt;&#xA;    Relevant initial provisioning &lt;a href=&quot;http://paste.ubuntu.com/24874509/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the vagrant box is booted up I wget the lastest CraftCMS files.&lt;br&gt;&#xA;I then run &lt;code&gt;chmod -R 777 /craft/app/ (+/config/ /storage/)&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that point on I would normally be able to complete the installation but instead I am met with a RuntimeException (paste &lt;a href=&quot;http://paste.ubuntu.com/24874558/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, screenshot &lt;a href=&quot;https://www.dropbox.com/s/j1aq4qd6lvocujf/Screenshot%20from%202017-06-16%2012-28-04.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried setting the permissions inside and outside of the environment. I have also tried changing ownership to www-data. And even put the user in the www-data group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty baffled, as I have no problems running my craft install on my production servers. Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerDisplayName="user6867" LastActivityDate="2017-06-16T19:48:04.060" Title="Running into permission issues using Vagrant on Ubuntu" Tags="&lt;php&gt;&lt;install&gt;&lt;craft-pro&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20876" PostTypeId="2" ParentId="20875" CreationDate="2017-06-16T19:48:04.060" Score="1" Body="&lt;p&gt;The article &lt;a href=&quot;https://nystudio107.com/blog/local-development-with-vagrant-homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Local Development with Vagrant / Homestead&lt;/a&gt; I wrote is about Homestead (which is great), but much of it applies to Vagrant in general as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Included in it are some performance tips, as well as how to solve the filesystem permissions with &lt;code&gt;vagrant-bindfs&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-06-16T19:48:04.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20877" PostTypeId="2" ParentId="20873" CreationDate="2017-06-16T20:38:26.177" Score="1" Body="&lt;p&gt;&lt;code&gt;landscapeMd&lt;/code&gt; and &lt;code&gt;portraitMd&lt;/code&gt; are &lt;em&gt;variables&lt;/em&gt;... they would need to be &lt;strong&gt;strings&lt;/strong&gt; (or array keys) for this to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# medium 16:9 #}&#xA;{% set landscapeMd = {&#xA;  width: 439,&#xA;  height: 247,&#xA;  quality: 80,&#xA;} %}&#xA;&#xA;{# medium 9:16 #}&#xA;{% set portraitMd = {&#xA;  width: 278,&#xA;  height: 494,&#xA;  quality: 80,&#xA;} %}&#xA;&#xA;{% set transforms = {&#xA;  'landscapeMd': landscapeMd,&#xA;  'portraitMd': portraitMd&#xA;} %}&#xA;&#xA;{% for block in entry.productCollage %}&#xA;  {% switch block.type %}&#xA;    {% case &quot;digitalProduct&quot; %}&#xA;      // selected via dropdown field&#xA;      {% set transformType = transforms[block.imageAspectRatio.value] %}&#xA;&#xA;      &amp;lt;figure&amp;gt;&#xA;        {% for image in block.image %}&#xA;          &amp;lt;a href=&quot;&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.url(transformType) }}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/figure&amp;gt;&#xA;  {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This maps the transforms with the &lt;code&gt;transforms&lt;/code&gt; object, then references the key in &lt;code&gt;transforms[block.imageAspectRatio.value]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-06-16T20:38:26.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20878" PostTypeId="2" ParentId="1086" CreationDate="2017-06-17T03:41:14.947" Score="2" Body="&lt;p&gt;Have had success using this plugin: &lt;a href=&quot;https://github.com/philbirnie/CraftPopularTags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/philbirnie/CraftPopularTags&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2017-06-17T03:41:14.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20879" PostTypeId="2" ParentId="1359" CreationDate="2017-06-17T16:17:08.843" Score="1" Body="&lt;p&gt;I made a free plugin that may help. I had trouble running through http when there were many tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin executes tasks purely as cron (i.e. does not internally issue a curl or wget request).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made the plugin available at:&#xA;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/taskrunner&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/taskrunner&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or you can view the code at:&#xA;&lt;a href=&quot;https://gitlab.com/24hoursmedia/craft2-plugins/craft2-taskrunner&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gitlab.com/24hoursmedia/craft2-plugins/craft2-taskrunner&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6868" LastActivityDate="2017-06-17T16:17:08.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20880" PostTypeId="1" CreationDate="2017-06-17T19:05:07.513" Score="1" ViewCount="338" Body="&lt;p&gt;In Element API v1, I am setting up an endpoint that is trying to expose a news entry including the tags (title, id, slug) associated with it. Thought it could be set up similarly to how you can retrieve categories using an array_map. But my code doesn't seem to work for tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/news.json' =&amp;gt; [&#xA;  'elementType' =&amp;gt; ElementType::Entry,&#xA;  'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;  'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;    return [&#xA;&#xA;      'id' =&amp;gt; $entry-&amp;gt;id,&#xA;      'title' =&amp;gt; $entry-&amp;gt;title,&#xA;      'slug' =&amp;gt; $entry-&amp;gt;slug,&#xA;      'postDate' =&amp;gt; $entry-&amp;gt;postDate,&#xA;      'url' =&amp;gt; $entry-&amp;gt;url,&#xA;      'jsonUrl' =&amp;gt; UrlHelper::getUrl(&quot;api/news/{$entry-&amp;gt;id}.json&quot;),&#xA;      'description' =&amp;gt; (string) $entry-&amp;gt;newsDescription,&#xA;      'tags' =&amp;gt; array_map( function(TagModel $tag) {&#xA;        return [&#xA;          'id' =&amp;gt; $tag-&amp;gt;id,&#xA;          'title' =&amp;gt; $tag-&amp;gt;title,&#xA;          'slug' =&amp;gt; $tag-&amp;gt;slug,&#xA;        ];&#xA;      }, $entry-&amp;gt;newsTags-&amp;gt;find()),&#xA;      'type' =&amp;gt; array_map( function(CategoryModel $category) {&#xA;        return [&#xA;          'id' =&amp;gt; $category-&amp;gt;id,&#xA;          'title' =&amp;gt; $category-&amp;gt;title,&#xA;          'slug' =&amp;gt; $category-&amp;gt;slug,&#xA;        ];&#xA;      }, $entry-&amp;gt;newsType-&amp;gt;find()),&#xA;&#xA;    ];&#xA;  },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6628" LastEditorUserId="6628" LastEditDate="2017-06-20T03:59:17.863" LastActivityDate="2017-06-20T04:16:45.810" Title="How do I retrieve tags and tag data for an entry in Element API?" Tags="&lt;plugin-elementapi&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20881" PostTypeId="1" AcceptedAnswerId="20888" CreationDate="2017-06-17T23:49:48.193" Score="2" ViewCount="400" Body="&lt;p&gt;I've setup multi domains with a single Craft 2 core folder using the &lt;a href=&quot;https://craftcms.com/docs/php-constants&quot; rel=&quot;nofollow noreferrer&quot;&gt;Path Constants&lt;/a&gt; methods in the docs. It's seems like a nice setup as I only have to update the core Craft files once when there's an update for all the domains. But under this setup all the domains have their own separate control panel and plugins but share the core Craft app folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V0Zfg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V0Zfg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I've done this is that my client wants to be able to add micro sites in the same install as their main company site for specific marketing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the &lt;a href=&quot;https://craftcms.com/support/license-enforcement&quot; rel=&quot;nofollow noreferrer&quot;&gt;licensing&lt;/a&gt; of Craft says that: &lt;code&gt;You’re allowed to run a single Craft license on multiple domains (e.g. example.com and example.fr), so long as they’re all a part of the same website. In order to enforce that, Craft does have one technical limitation: you may only access Craft’s control panel from one public domain per Craft license.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So am I right in assuming that my setup will be ok for example.com, example.co.uk, subdomain1.example.com, subdomain2.example.com, example.fr etc, but if the client wants to use a completely different domain name for the micro site like brilliantmarketingurl.com then the license won't be valid? As each site has it's own control panel and database with this setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the case and is this still applicable with Craft 3 introducing multi-sites support?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would appreciate some advice on this, as I need to discuss the potential implications with my client. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5975" LastEditDate="2017-06-19T08:43:00.967" LastActivityDate="2017-06-19T15:59:12.167" Title="Multi domains in Craft 2 licensing" Tags="&lt;multi-domain&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20882" PostTypeId="2" ParentId="348" CreationDate="2017-06-18T22:23:15.573" Score="2" Body="&lt;p&gt;There's also another great plugin I came across recently called &lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://github.com/jamiepittock/craft-typogrify&quot; rel=&quot;nofollow noreferrer&quot;&gt;Typogrify&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also supports SmartyPants (as mentioned in another answer) along with several other nice typography improvements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Uses SmartyPants library to convert:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Both single and double quotes to their curly versions.&lt;/li&gt;&#xA;&lt;li&gt;Dashes (-- and ---) into en- and em-dash entities&lt;/li&gt;&#xA;&lt;li&gt;Three consecutive dots (...) into an ellipsis entity&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Prevents &quot;widows&quot; (having only a single word on the last line of a paragraph) by replacing the space between the last two words in a string with &lt;code&gt;&amp;amp;nbsp;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Wraps ampersands with &lt;code&gt;&amp;lt;span class=&quot;amp&quot;&amp;gt;&lt;/code&gt; so they can be styled with CSS.&lt;/li&gt;&#xA;&lt;li&gt;Wraps multiple capital letters in &lt;code&gt;&amp;lt;span class=&quot;caps&quot;&amp;gt;&lt;/code&gt; so they can be styled with CSS.&lt;/li&gt;&#xA;&lt;li&gt;Puts a &lt;code&gt;&amp;amp;thinsp;&lt;/code&gt; before and after an &lt;code&gt;&amp;amp;ndash&lt;/code&gt; or &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Wraps initial quotes in &lt;code&gt;class=&quot;dquo&quot;&lt;/code&gt; for double quotes or &lt;code&gt;class=&quot;quo&quot;&lt;/code&gt; for single quotes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It does all this during template rendering via filters, not during save, if that matters to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/jamiepittock/craft-typogrify&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/jamiepittock/craft-typogrify&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-06-18T22:23:15.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20883" PostTypeId="1" AcceptedAnswerId="20897" CreationDate="2017-06-19T04:58:33.813" Score="2" ViewCount="265" Body="&lt;p&gt;I understand this isn't possible from the Control Panel, I'm developing a custom plugin for this specific client project. Essentially these user groups won't need access to the Control Panelat all, but will have unique permissions within the site and will have a few custom fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I create custom fields per user group? Or do I just need to create relationships between these fields and the users when they create their profile? Trying to figure out the proper way to go about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;After watching the Element Type hangout as suggested, they explain why this isn't possible with the current implementation of User Groups, if you are curious.&#xA;&lt;a href=&quot;https://youtu.be/hU_wduMEimY?t=27m44s&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/hU_wduMEimY?t=27m44s&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6514" LastEditorUserId="57" LastEditDate="2017-06-19T22:50:30.033" LastActivityDate="2017-06-19T22:50:30.033" Title="How would I create unique fields for different user groups programmatically?" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-profile&gt;&lt;craft-pro&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20884" PostTypeId="2" ParentId="20870" CreationDate="2017-06-19T05:59:57.410" Score="2" Body="&lt;p&gt;MS support team helped to resolve the issue. I will post the steps to be followed. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In your CMS Admin, Under Assets source -&gt; &#xA;File system path: images/&#xA;URL: &lt;a href=&quot;http://example.azurewebsites.net/images&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.azurewebsites.net/images&lt;/a&gt;&#xA;(Here the images directory is under public directory)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Azure portal, Add the following App settings in Application setting of your App service:&#xA;key: WEBSITE_DYNAMIC_CACHE &#xA;value: 0&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Restart the Azure App service.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6864" LastActivityDate="2017-06-19T05:59:57.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20885" PostTypeId="1" AcceptedAnswerId="20949" CreationDate="2017-06-19T09:54:25.373" Score="2" ViewCount="419" Body="&lt;p&gt;I've got an issue when cards are declined and only a white screen is shown to the user without any feedback. The url has not changed at all either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is happening on the live Stripe account so I set up a dev site and used the test account and saw the same when using the&#xA;4000000000000002 card number, devMode is enabled but no errors were returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the relevant bits of my JS code which handle the creating of the card token and showing any errors encountered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function stripeResponseHandler(status, response) {&#xA;    // Grab the form:&#xA;    var $form = $('#payment-information');&#xA;    if (response.error) { // Problem!&#xA;        if ($('#stripeToken').length) {&#xA;            $('#stripeToken').remove();&#xA;        }&#xA;        // Show the errors on the form&#xA;        $('#payment-information').find('.payment-errors').show().find(&quot;p&quot;).text(response.error.message);&#xA;        return false;&#xA;    } else { // Token was created!&#xA;        // Get the token ID:&#xA;        var token = response.id;&#xA;        // Insert the token into the form so it gets submitted to the server:&#xA;        if ($('#stripeToken').length) {&#xA;            $('#stripeToken').val(token);&#xA;        } else {&#xA;            $('#payment-information').append($('&amp;lt;input type=&quot;hidden&quot; id=&quot;stripeToken&quot; /&amp;gt;').val(token));&#xA;        }&#xA;        $('#payment-information').find('.payment-errors').hide();&#xA;        $(&quot;#payment-information&quot;).submit();&#xA;        return true;&#xA;    }&#xA;}&#xA;&#xA;Stripe.card.createToken({&#xA;    name: $('input[name=&quot;firstName&quot;]').val()+&quot; &quot;+$('input[name=&quot;lastName&quot;]').val(),&#xA;    number: $('#payment-card-number').val(),&#xA;    cvc: $('#payment-cvt-code').val(),&#xA;    exp_month: $('select[name=&quot;month&quot;]').val(),&#xA;    exp_year: $('select[name=&quot;year&quot;]').val(),&#xA;    address_zip: $('#shippingAddress-zipCode').val() &#xA;}, stripeResponseHandler);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Payments are going through fine on the live site and errors such as invalid card numbers are being shown correctly. However, 4000000000000002 is a valid card number and therefore the token is being created successfully without any errors. This is what is happening on the live site when payments are being declined for customers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this is then submitted through the commerce/cartPayment/pay form, no errors are shown, just a white page. Has anyone else encountered this and found a way around it? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-06-23T10:48:54.540" Title="Commerce Stripe Card Declined shows white screen with no error" Tags="&lt;plugin-craftcommerce&gt;&lt;stripe&gt;&lt;payment&gt;&lt;white-screen&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20886" PostTypeId="1" CreationDate="2017-06-19T14:40:05.187" Score="1" ViewCount="55" Body="&lt;p&gt;When saving a newly added block type with subfields to an existing Matrix, the subfields of the new block type are gone and also are the subfields of 6 of the last block types. The whole Matrix contains 29 block types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft CMS 2.6.2982.&lt;/p&gt;&#xA;" OwnerUserId="5692" LastEditorUserId="57" LastEditDate="2017-06-19T22:34:17.217" LastActivityDate="2017-06-19T22:34:17.217" Title="Adding a new block type to Matrix causes subfields and subfields of other block types to disappear" Tags="&lt;matrix&gt;&lt;field&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20887" PostTypeId="1" AcceptedAnswerId="20911" CreationDate="2017-06-19T14:44:05.773" Score="1" ViewCount="49" Body="&lt;p&gt;I'm trying to do something I'm used to in Wordpress, but can't really find a right way, or 'correct' way. What I was used to do in Wordpress; every page had a few options, like center content, background image, etc. In page.php (if you know Wordpses this'll make sense) I called a function pageDetails() (defined in functions.php) which returned me some variables for centering content, if it had a background image, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to do the same in Craft, so I created a section for the pages, added some custom fields to the pages, and now I'm trying to create a likewise method for defining a function once and use that for different 'entry types' to avoid repeating myself for each entry type template. For this, I keep coming back to creating a macro, that I define in _macros/macro.twig (for example). But, I can't get it to return variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short; is there a way to use 'variables' from entry template, to the macro, and have the macro return vars (or array) to the entry template so I can use them in there? Or should I completely rethink this way of doing it?&lt;/p&gt;&#xA;" OwnerUserId="6873" LastActivityDate="2017-06-21T12:32:11.567" Title="How do I set this up the right way, transferring from Wordpress as CMS?" Tags="&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20888" PostTypeId="2" ParentId="20881" CreationDate="2017-06-19T15:17:17.147" Score="4" Body="&lt;p&gt;Using this technique to share the Craft &lt;code&gt;app&lt;/code&gt; folder across different sites, results in each site having their own &lt;code&gt;config&lt;/code&gt; folder. Since the &lt;code&gt;license.key&lt;/code&gt; file that determines the licensing status of Craft lives in the &lt;code&gt;config&lt;/code&gt; folder, setting up your sites like this will require a separate license for each site, as the &lt;code&gt;domain2&lt;/code&gt; site won't have access to the &lt;code&gt;license.key&lt;/code&gt; file in &lt;code&gt;domain1/config&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-06-19T15:17:17.147" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20889" PostTypeId="2" ParentId="20886" CreationDate="2017-06-19T15:17:27.667" Score="2" Body="&lt;p&gt;Bumping php.ini's &lt;code&gt;max_input_vars&lt;/code&gt; to a higher value as described in the answer &lt;a href=&quot;https://craftcms.stackexchange.com/a/2777/5692&quot;&gt;here&lt;/a&gt; fixed it.&lt;/p&gt;&#xA;" OwnerUserId="5692" LastActivityDate="2017-06-19T15:17:27.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20890" PostTypeId="2" ParentId="20887" CreationDate="2017-06-19T15:30:49.563" Score="1" Body="&lt;p&gt;Macros are intended to output to the page, rather than return data to the caller. If you must return the data, I'd suggest writing a custom plugin (although that's where my knowledge stops!).&lt;/p&gt;&#xA;" OwnerUserId="6731" LastActivityDate="2017-06-19T15:30:49.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20891" PostTypeId="2" ParentId="20881" CreationDate="2017-06-19T15:59:12.167" Score="2" Body="&lt;p&gt;As long as the control panel is only accessible from one domain, I'd say you're within the license requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;example.com and example.fr are different domains, and really no less different than example.com and myawesomesite.com. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably get confirmation from the Craft guys to be 100% sure though, you can contact them on support@craftcms.com if I'm not completely mistaken. &lt;/p&gt;&#xA;" OwnerUserId="981" LastActivityDate="2017-06-19T15:59:12.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20892" PostTypeId="1" AcceptedAnswerId="20947" CreationDate="2017-06-19T16:34:51.237" Score="1" ViewCount="1224" Body="&lt;p&gt;I have the same error in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16681/the-file-does-not-appear-to-be-an-image-bug&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft info says i have installed the ImageMagick extension successfully  and even use &lt;code&gt;‘imageDriver’ =&amp;gt; ‘imagick’&lt;/code&gt; in config file. But still cant upload GIF files.&lt;/p&gt;&#xA;" OwnerUserId="656" LastEditorUserId="57" LastEditDate="2017-06-19T22:37:39.357" LastActivityDate="2017-06-23T06:31:28.910" Title="Can't upload GIF files" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20894" PostTypeId="2" ParentId="20790" CreationDate="2017-06-19T19:25:27.747" Score="1" Body="&lt;p&gt;Leowebguy pretty much nailed it. I made a scaffold for setting up craft with Foundation 6 if you want to peek through it. Its the same idea, but I've done all the set up for your gulpfile and such if you want to use SASS or any preprocessing. It's a bit different that Bootstrap, as they use grunt by default if I'm not mistaken, but figured I would throw in my two cents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/prkirby/craft-foundation-scaffold&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/prkirby/craft-foundation-scaffold&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6514" LastActivityDate="2017-06-19T19:25:27.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20895" PostTypeId="2" ParentId="20790" CreationDate="2017-06-19T20:00:06.507" Score="1" Body="&lt;p&gt;I do things mostly the same way leowebguy does. I'd just add a comment on his, but I don't have enough points yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a _layout/base.html file which has some basic structure, and it calls  header &amp;amp; footer files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But intead of calling my scripts this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/css/bootstrap.css&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do it with the twig include function, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeCssFile &quot;/css/bootstrap.min.css&quot; %}&#xA;&#xA;{% includeJsFile &quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js&quot; %}&#xA;{% includeJsFile &quot;/js/bootstrap.min.js&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-06-19T20:00:06.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20896" PostTypeId="1" AcceptedAnswerId="20899" CreationDate="2017-06-19T20:17:50.043" Score="1" ViewCount="45" Body="&lt;p&gt;I need to run checks before allowing a user to delete a category. I have added the following code to my main plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('categories.onBeforeDeleteCategory', function(Event $event) {&#xA;    $event-&amp;gt;performAction = false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just to test it. I expect this to cause any category delete functions to fail because I'm explicitly setting the event perform action property to false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No. 1 - This code only runs when I click into the category and then press the delete button. If you do it from the action menu in the category list this event is not even fired. This seems like a bug to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No. 2 - This code, even when executed, does not prevent the category from being deleted. Even though I set &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt; it still just deletes the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some sleuthing regarding #1 and I found out that I have to call the event like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeDeleteElements', function(Event $event) {&#xA;    $event-&amp;gt;performAction = false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I'm still running into #2 on both instances where setting performAction to false does not prevent the action from completing... :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2&#xA;It looks like there is no condition for performAction after the event is fired so there appears to be no way to stop a delete event via an event. Is this the case?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="6309" LastEditDate="2017-06-19T20:41:53.043" LastActivityDate="2017-06-19T22:49:15.317" Title="onBeforeDeleteCategory not working / inconsistent" Tags="&lt;categories&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20897" PostTypeId="2" ParentId="20883" CreationDate="2017-06-19T20:35:07.620" Score="1" Body="&lt;p&gt;You could control which fields a user has access to based on their group from a front end edit profile page, but there is no way to do this in the admin outside of creating a plugin with a custom table and screens.&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-06-19T20:35:07.620" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20898" PostTypeId="2" ParentId="20896" CreationDate="2017-06-19T20:56:34.703" Score="0" Body="&lt;p&gt;Honestly I'm not sure if this is the best way but I found a work-around that seems to do the job. I have to explicitly send the failed response and exit the execution from within my event. My test case now works from both screens using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('elements.onBeforeDeleteElements', function(Event $event) {&#xA;    if(craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;        craft()-&amp;gt;controller-&amp;gt;returnJson(['success' =&amp;gt; false, 'message' =&amp;gt; &quot;unable to delete&quot;]);&#xA;    } else {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(&quot;Unable to delete&quot;);&#xA;        craft()-&amp;gt;controller-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;    exit;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-06-19T20:56:34.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20899" PostTypeId="2" ParentId="20896" CreationDate="2017-06-19T22:49:15.317" Score="1" Body="&lt;p&gt;Neither &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#categories-onBeforeDeleteCategory&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeDeleteCategory&lt;/code&gt;&lt;/a&gt; nor &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBeforeDeleteElements&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeDeleteElements&lt;/code&gt;&lt;/a&gt; has a &lt;code&gt;$performAction&lt;/code&gt; parameter that you can set to cancel the event, which would behavior #2 you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first behavior you're seeing can be explained by &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8460/delete-change-status-from-cp-via-ajax-trigger-event/&quot;&gt;this&lt;/a&gt;, which you've already found the workaround for.  FWIW, that's changed for the upcoming Craft which, which behaves more as you'd expect now.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-19T22:49:15.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20900" PostTypeId="2" ParentId="20880" CreationDate="2017-06-20T04:05:24.583" Score="1" Body="&lt;p&gt;I took a break from this project. Came back, looked at the code, and saw a simple overlooked error - had a &quot;)&quot; instead if &quot;}&quot;.  Grrr.  Starring too much at pixels lately. Fixed the code. So it's all working now. The array_map with the Tag Model does work.&lt;/p&gt;&#xA;" OwnerUserId="6628" LastEditorUserId="6628" LastEditDate="2017-06-20T04:16:45.810" LastActivityDate="2017-06-20T04:16:45.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20901" PostTypeId="2" ParentId="20869" CreationDate="2017-06-20T07:17:59.280" Score="1" Body="&lt;p&gt;As Brad pointed out in the comments on my question I had to take a look in the custom route's defined in the Craft CP. My client tried to make a custom route which looked like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X1DcO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X1DcO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This caused for every url containing one &quot;/&quot; to use that template that unfortunately actually was a template that's why it wouldn't give a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Comment:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe an .htaccess rewrite rule interfering? Do you have any custom routes defined (in the Craft CP or in config/routes.php)? – Brad Bell&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-06-20T07:17:59.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20902" PostTypeId="1" AcceptedAnswerId="20905" CreationDate="2017-06-20T08:18:47.620" Score="1" ViewCount="599" Body="&lt;p&gt;I'm rebuilding a website which needs to run Craft CMS as the main frontend and a bespoke CRM system at the same domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file setup is basically&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;public_html&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;cms&lt;/li&gt;&#xA;&lt;li&gt;crm&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To make things a bit more complicated, certain parts of the CRM have to be publically accessible, so there are a few different URL structures that need to run from the CRM, and the rest from Craft. Also, the images/scripts are in the cms folder, so I need to get those to work without cms in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the most part this is working lovely, but I can't get force /cms/ to be removed from the URL, so whilst the site works fine without it, it's live on 2 different URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the  with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;&#xA;    # Force the root to match slug of home page&#xA;    # This is the only way I can get the home page to&#xA;    # show on the root, as it's within a structure&#xA;    RewriteRule ^$ /__home__&#xA;&#xA;    # Get rid of /cms (this doesn't work)&#xA;    RewriteRule ^cms/?(.+)$ /$1 [R=301]&#xA;&#xA;    # Sort out frontend files&#xA;    RewriteCond %{REQUEST_URI} /assets/.*&#xA;    RewriteCond %{REQUEST_URI} !/assets/admin/.*&#xA;    RewriteCond %{REQUEST_URI} !/cms/.*&#xA;    RewriteCond %{REQUEST_URI} !/crm/web/.*&#xA;    RewriteRule ^(.*\.(gif|jpg|jpeg|bmp|svg|png|css|js|json|pdf|eot|woff|woff2|ttf|otf))$ /cms/$1 [QSA,L]&#xA;&#xA;    # Sort out admin files&#xA;    RewriteCond %{REQUEST_URI} /assets/admin/.*&#xA;    RewriteCond %{REQUEST_URI} !/cms/.*&#xA;    RewriteCond %{REQUEST_URI} !/crm/web/.*&#xA;    RewriteRule ^(.*\.(gif|jpg|jpeg|bmp|svg|png|css|js|json|pdf|eot|woff|woff2|ttf|otf))$ /crm/web/$1 [QSA,L]&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    # Need to exclude any that should route to the CRM&#xA;    # Any that we exclude, we then need to route below&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/manager/?(.*)$ [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/forms/(.+)$ [NC]&#xA;    RewriteCond %{REQUEST_URI} !^/partners/?(.*)$ [NC]&#xA;    RewriteCond %{REQUEST_URI} !^$ [NC]&#xA;    RewriteRule (.+) /cms/index.php/$1 [QSA,L]&#xA;&#xA;    # CRM Admin&#xA;    RewriteCond %{REQUEST_URI} ^/manager/?(.*)$ [NC]&#xA;    RewriteRule ^manager/?(.*) /crm/web/app.php [QSA,L]&#xA;&#xA;    # Quote Forms&#xA;    RewriteCond %{REQUEST_URI} ^/forms/(.+)$ [NC]&#xA;    RewriteRule ^forms/(.+) /crm/web/app.php [QSA,L]&#xA;&#xA;    # Signup Forms&#xA;    RewriteCond %{REQUEST_URI} ^/partners/?(.*)$ [NC]&#xA;    RewriteRule ^partners/?(.*) /crm/web/app.php [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I'm fairly sure that the line &lt;code&gt;RewriteRule ^cms/?(.+)$ /$1 [R=301]&lt;/code&gt; would work, but the default Craft logic is somehow preventing it - if I comment out the default craft section, then it removes cms from the URLs, but obviously nothing is routed through Craft, so 404s all round.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm completely stumped at this point, so any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3912" LastEditorUserId="57" LastEditDate="2017-06-20T17:14:49.367" LastActivityDate="2017-06-20T17:14:49.367" Title=".htaccess for Craft CMS - removing segment from URL" Tags="&lt;redirect&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20903" PostTypeId="1" AcceptedAnswerId="20904" CreationDate="2017-06-20T09:54:51.160" Score="1" ViewCount="48" Body="&lt;p&gt;I've got a problem with some tasks. Craft tells me 'Deleting Stale Template Caches Failed' multiple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look in the Deprecated Warnings, it tells me two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ordering tags by ‘name’ has been deprecated. Order by ‘title’ instead.&lt;/li&gt;&#xA;&lt;li&gt;The Tag ‘name’ property has been deprecated. Use ‘title’ instead.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't know if this will fix my task errors, but it would be nice to solve this problem as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This warning is strange to me because I don't ordering my tags by name, I order them by title:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;section class=&quot;overview-search__filter&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;overview-search__filter-item activity&quot;&amp;gt;&#xA;        &amp;lt;select class=&quot;multiselect multiselect-activitytype&quot; multiple=&quot;multiple&quot; data-search-filter=&quot;activityType&quot; name=&quot;activityType&quot;&amp;gt;&#xA;            {% for tag in tags.order('title') %}&#xA;                {% set selected = (filters['activityType'] is defined and tag.title in filters['activityType']) ? 'selected': ''  %}&#xA;                &amp;lt;option value=&quot;{{ tag.title }}&quot; {{ selected }}&amp;gt;{{ tag.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;overview-search__filter-item activity&quot;&amp;gt;&#xA;        &amp;lt;select class=&quot;multiselect multiselect-place&quot; multiple=&quot;multiple&quot; data-search-filter=&quot;activityLocation&quot; name=&quot;activityLocation&quot;&amp;gt;&#xA;            {% for location in locations.order('title') %}&#xA;                {% set selected = (filters['activityLocation'] is defined and location.title in filters['activityLocation']) ? 'selected': '' %}&#xA;                &amp;lt;option value=&quot;{{ location.title }}&quot; {{ selected }}&amp;gt;{{ location.title }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5271" LastEditorUserId="142" LastEditDate="2017-06-20T12:24:00.657" LastActivityDate="2017-06-20T12:30:29.403" Title="Craft ordering tags by 'name'" Tags="&lt;cache&gt;&lt;tags&gt;&lt;error&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20904" PostTypeId="2" ParentId="20903" CreationDate="2017-06-20T12:30:29.403" Score="1" Body="&lt;p&gt;First problem sounds like it might be a permissions issue. Have you made sure you've got the right permissions on the &lt;code&gt;/craft/storage&lt;/code&gt; folder? More details can be found here in the docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Step 2: Set the permissions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly related to the above, did you originally use &lt;code&gt;name&lt;/code&gt; and then updated it to &lt;code&gt;title&lt;/code&gt; at a later time? One possible reason for your deprecated messages might be the template is cached with the old &lt;code&gt;name&lt;/code&gt; value. Sorting out the above should at least enable you to clear the cache, using the &lt;code&gt;Clear caches&lt;/code&gt; button in the &lt;code&gt;Settings&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-06-20T12:30:29.403" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20905" PostTypeId="2" ParentId="20902" CreationDate="2017-06-20T12:39:57.233" Score="1" Body="&lt;p&gt;I might be way off here, but if you are wanting to run Craft as your main front-end, could you not place the Craft &lt;code&gt;index.php&lt;/code&gt; in the root of the site and then you CRM in a sub-folder of its own?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have all you CRM stuff in its own sub-folder, Craft should just ignore that folder as it physically exists. If you've got specific things you need to have in your &lt;code&gt;.htaccess&lt;/code&gt; file for you CRM, you could have that &lt;code&gt;.htaccess&lt;/code&gt; in the sub-folder, rather than the root. That way you can just have the standard Craft &lt;code&gt;.htaccess&lt;/code&gt; file in the root of the site.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-06-20T12:39:57.233" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20906" PostTypeId="1" AcceptedAnswerId="20909" CreationDate="2017-06-20T16:36:46.227" Score="1" ViewCount="374" Body="&lt;p&gt;I'm trying to display a saved date from a json file.&#xA;I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set batchRowStats = craft.analytics.loadSavedBatch() %}&#xA;&#xA;{% for stat in batchRowStats %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ stat['senddate'].date }}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the information in the JSON file is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{&quot;batchid&quot;:368,&quot;total&quot;:1111,&quot;opened&quot;:0,&quot;clicked&quot;:0,&quot;optout&quot;:0,&quot;bounced&quot;:0,&quot;subject&quot;:&quot;subject line&quot;,&quot;senddate&quot;:{&quot;date&quot;:&quot;2017-06-02 06:00:22.000000&quot;,&quot;timezone_type&quot;:3,&quot;timezone&quot;:&quot;UTC&quot;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impossible to access an attribute (&quot;date&quot;) on a string variable (&quot;&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I am assuming it's because this information may be in a DateTime or object of sorts. I really need to just display &quot;June 2, 2017&quot; with a date_format but I'm not even sure how to get the string to display.&lt;/p&gt;&#xA;" OwnerUserId="6859" LastEditorUserId="57" LastEditDate="2017-06-20T17:21:30.043" LastActivityDate="2017-06-21T00:48:47.997" Title="Displaying variable in array in array = Impossible to access an attribute (&quot;date&quot;) on a string variable (&quot;&quot;)" Tags="&lt;datetime&gt;&lt;php&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20907" PostTypeId="1" CreationDate="2017-06-20T16:46:49.740" Score="0" ViewCount="1061" Body="&lt;p&gt;I have tried to configure email as an SMTP client for a Google Mail server. When I click test I get a generic &quot;There was an error testing your email settings&quot;, but no further info in Craft log files. The error displays almost instantly, so it does not seem like a connection issue, e.g. password / username error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is latest version and site is hosted with Arcustech. &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-08-20T21:38:49.707" Title="Error Configuring Email for SMTP" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20909" PostTypeId="2" ParentId="20906" CreationDate="2017-06-21T00:48:47.997" Score="1" Body="&lt;p&gt;I attempted to get senate directly and output one element of it but no matter what index/key I set it would give me an error. Also, trying to change the object (or whatever it happened to be) in the PHP caused errors as well. I needed up just doing |first and |date to grab the date I needed and format it. The timezone_type and timezone were being converted into dates (December 1969 and current date) for some reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set batchRowStats = craft.analytics.loadSavedBatch() %}&#xA;{% for stat in batchRowStats %}&#xA;    {{ stat['senddate']|first|date(&quot;F j, Y&quot;) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did change on thing in the PHP. I added (array) before the object inside of the array it's in. There are more complications to this scenario but I was assigning it to another variable and adding it to a different array. No matter what way I tried to extract the variable it would give me errors. String conversion gave me array error and array conversion usually gave me a string error and several others along the way. After placing (array) in front of it while assigning it to a variable it seemed to behave a bit better.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$emptyDateArray = (array) $innerResults['BatchStartDate'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6859" LastActivityDate="2017-06-21T00:48:47.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20911" PostTypeId="2" ParentId="20887" CreationDate="2017-06-21T12:32:11.567" Score="0" Body="&lt;p&gt;Assuming that your variables are coming from the entry, you want to look into the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/tags/embed.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig {% embed %} docs&lt;/a&gt;. I generally do something along these lines:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your main page template&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_inc/_layout&quot; %}&#xA;{% block content %}&#xA;&#xA;    {% include '_inc/_title' %}&#xA;    {% embed &quot;_inc/_body_field&quot; %}&#xA;        {% block body_field %}{% endblock %}&#xA;    {% endembed %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your body field&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_inc/_macros' as macros %}&#xA;&#xA;{% block body_content %}&#xA;&#xA;    {% for brick in entry.body %}&#xA;&#xA;        {% if brick.type == &quot;heading&quot; %}&#xA;&#xA;            &amp;lt;{{ brick.headingWeight }} class=&quot;wrap&quot;&amp;gt;{{ brick.heading }}&amp;lt;/{{ brick.headingWeight }}&amp;gt;&#xA;&#xA;        {% elseif brick.type == &quot;wysiwyg&quot; %}&#xA;&#xA;            &amp;lt;div class=&quot;wrap&quot;&amp;gt;&#xA;                {% if brick.cappedWidth %}&#xA;                    &amp;lt;div class=&quot;capped&quot;&amp;gt;{{ brick.copy }}&amp;lt;/div&amp;gt;&#xA;                {% else %}&#xA;                    {{ brick.copy }}&#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% elseif brick.type == &quot;inlineImage&quot; %}&#xA;&#xA;            {% set img = brick.image.first() %}&#xA;            &amp;lt;div class=&quot;wrap img-container&quot;&amp;gt;&#xA;                {{ macros.img(img, 990, {alt: brick.imageAlt}) }}&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually, now that I've stripped that down to some generic stuff, you'd be able to achieve the same with a simple &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% include %}&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using structures, you could also take this further and look into having a single file that includes a different file depending on the page type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_inc/_layout&quot; %}&#xA;&#xA;{% block main %}&#xA;&#xA;    {# Call on the entry type file #}&#xA;    {% include '_types/_' ~ entry.type %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3912" LastActivityDate="2017-06-21T12:32:11.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20913" PostTypeId="1" CreationDate="2017-06-21T14:13:23.153" Score="2" ViewCount="1463" Body="&lt;p&gt;I've been following the Craft Commerce tutorials at Mijingo, (running on CraftPro 2.6.2983) all good so far, except when I go add a product to my cart. I'm getting a &quot;CSRF token could not be found&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The debug message with dev mode on reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Warning: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Warning: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a step or setup option I'm missing? Atm, it's running on Mamp, but I want to make sure it's workable before I license up and go live. &lt;/p&gt;&#xA;" OwnerUserId="6882" LastEditorUserId="6882" LastEditDate="2017-06-23T09:52:36.070" LastActivityDate="2017-06-23T09:52:36.070" Title="Craft Commerce - Bad Request The CSRF token could not be verified" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20914" PostTypeId="2" ParentId="20858" CreationDate="2017-06-21T17:20:17.230" Score="1" Body="&lt;p&gt;The code above is correct, but it turns out there was an actual bug in the code if you had a number as the option value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This affects Freeform 1.5.1 and earlier. The next version (1.5.2) of Freeform will include a fix for this. If anyone needs a patched copy of Freeform before 1.5.2 is available, just contact us via our &lt;a href=&quot;https://solspace.com/craft/create-ticket/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;support form&lt;/a&gt;. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-06-21T17:20:17.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20915" PostTypeId="1" CreationDate="2017-06-21T19:06:30.067" Score="1" ViewCount="928" Body="&lt;p&gt;Anyone have experience updating a CraftCMS site from 2.* to the 3-beta? I'm not in dire need of this at the moment, but can't seem to find it in the developer resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Found the upgrade guide &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="845" LastEditorUserId="9" LastEditDate="2018-11-02T14:32:30.107" LastActivityDate="2018-11-02T14:33:24.130" Title="Migrate path from 2 to 3?" Tags="&lt;migration&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20916" PostTypeId="1" CreationDate="2017-06-21T20:11:55.670" Score="1" ViewCount="468" Body="&lt;p&gt;I'm working with a carousel that has two rows. Each item in the carousel displays an icon for a &quot;media partner&quot;. This works all fine and dandy until there's an odd number of media partners, because then there is an extra unnecessary space in the carousel. I have the issue solved logically, but I can't figure out how to implement it into Craft. I need a way to access a certain entry plainly by its number, i.e. the fifth entry, seventh entry, ninth entry, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 11 entries that I am working with, however that number may change in the future. So, first, I grab how many current entries there are in the particular field that I am looking for: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryNum = craft.entries.section('partners').featuredMediaPartner('1') | length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns 11.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, this number gets divided by two, because I want to display the middle partner in the empty space that the carousel creates if there's an odd number (I already have coded to determine what to do if there's an odd number). So 11/2 = 5. How would I access the fifth entry? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6884" LastEditorUserId="45" LastEditDate="2017-06-22T17:35:28.713" LastActivityDate="2017-06-22T17:35:28.713" Title="Get a specific entry by its index or number?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;assets&gt;&lt;entry&gt;&lt;index&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20917" PostTypeId="2" ParentId="20907" CreationDate="2017-06-21T20:21:52.173" Score="2" Body="&lt;p&gt;Google considers SMTP to be an &quot;insecure&quot; protocol when connecting to their servers.  You have to explicitly go into your account settings as described &lt;a href=&quot;https://support.google.com/accounts/answer/6010255?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and enable access for these &quot;insecure&quot; requests.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-21T20:21:52.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20918" PostTypeId="2" ParentId="20916" CreationDate="2017-06-21T20:47:21.177" Score="0" Body="&lt;p&gt;If you have a array of entries like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entires.find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you wanted to access the fifth item in the array (which is 0-indexed), you would do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fifthEntry = entries[4] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-21T20:47:21.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20919" PostTypeId="1" AcceptedAnswerId="20920" CreationDate="2017-06-21T21:38:55.763" Score="3" ViewCount="561" Body="&lt;p&gt;Running 2.6.2983 on OS Sierra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm noticing that some of my SVG files when uploading are going from 50kb to 1kb and then appear completely blank when trying to view them. Does anyone have a clue why this would be happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="6327" LastActivityDate="2017-06-21T22:06:22.133" Title="Odd behaviour when uploading .svg Assets" Tags="&lt;assets&gt;&lt;svg&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20920" PostTypeId="2" ParentId="20919" CreationDate="2017-06-21T22:06:22.133" Score="4" Body="&lt;p&gt;Half-bug, half side-effect/undesired behavior for SVG sanitization that got added in &lt;a href=&quot;https://craftcms.com/changelog#2-6-2982&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.2982&lt;/a&gt; for SVGs that use embedded data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next release of Craft (post 2.6.2983) adds a &lt;code&gt;sanitizeSvgUploads&lt;/code&gt; config setting (&lt;code&gt;true&lt;/code&gt; by default) that you will be able to set to false to disable SVG sanitization.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-21T22:06:22.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20921" PostTypeId="2" ParentId="19491" CreationDate="2017-06-22T02:08:27.587" Score="1" Body="&lt;p&gt;If you can't charge someone in a certain currency with your gateway, then it shouldn't be selectable as a payment currency option for the order. The feature is called 'multi currencies payments' - it allows your customer to optionally pay the total of the order in a different currency at the conversion rate you specify. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The change you made to charge in the primary currency defeats the purpose of the feature. Set the payment currency to Euros before charging the user.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-06-22T03:46:37.680" LastActivityDate="2017-06-22T03:46:37.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20923" PostTypeId="2" ParentId="20916" CreationDate="2017-06-22T07:02:22.690" Score="1" Body="&lt;p&gt;I don't know whether you've seen the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/filters/batch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;batch&lt;/code&gt;&lt;/a&gt; Twig filter? You may find if useful to accomplish exactly what you are trying to do, but with a little bit less hassle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the example in the link above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;{% for row in items|batch(3, 'No item') %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        {% for column in row %}&#xA;            &amp;lt;td&amp;gt;{{ column }}&amp;lt;/td&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's what it outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;a&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;b&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;c&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;d&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;e&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;f&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;g&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;No item&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;No item&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially you're grouping your values into rows of a specific number (in this example it's 5). Then you can specify what to put in any empty spaces. So here it's the words 'No Item', but in your case it could be the middle partner entry.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-06-22T07:02:22.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20924" PostTypeId="1" AcceptedAnswerId="20993" CreationDate="2017-06-22T07:56:08.020" Score="1" ViewCount="164" Body="&lt;p&gt;I have a website with 4 locales enabled (en, jp, zh, th). For some reasons I can not access some entries (channel) for the Chinese (zh) locale. The page is well displayed in the front end but I can not edit the entry in the back end, I get this error:&#xA;&lt;code&gt;&#xA;Internal Server Error&#xA;Undefined index: title&#xA;&lt;/code&gt;&#xA;Looking at the DB, the entries are there and they all have a title set in Chinese.&#xA;Do you have any idea what the problem is?&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;Below, the stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP notice&#xA;&#xA;Undefined index: title&#xA;&#xA;/Users/romain/Desktop/matsuri/matsuri/craft/app/models/EntryVersionModel.php(39)&#xA;&#xA;27     {&#xA;28         if ($attributes instanceof \CModel)&#xA;29         {&#xA;30             $attributes = $attributes-&amp;gt;getAttributes();&#xA;31         }&#xA;32 &#xA;33         // Merge the version and entry data&#xA;34         $entryData = $attributes['data'];&#xA;35         $fieldContent = isset($entryData['fields']) ? $entryData['fields'] : null;&#xA;36         $attributes['versionId'] = $attributes['id'];&#xA;37         $attributes['id'] = $attributes['entryId'];&#xA;38         $attributes['revisionNotes'] = $attributes['notes'];&#xA;39         $title = $entryData['title'];&#xA;40         unset($attributes['data'], $entryData['fields'], $attributes['entryId'], $attributes['notes'], $entryData['title']);&#xA;41 &#xA;42         $attributes = array_merge($attributes, $entryData);&#xA;43 &#xA;44         // Initialize the version&#xA;45         $version = parent::populateModel($attributes);&#xA;46         $version-&amp;gt;getContent()-&amp;gt;title = $title;&#xA;47 &#xA;48         if ($fieldContent)&#xA;49         {&#xA;50             $version-&amp;gt;setContentFromRevision($fieldContent);&#xA;51         }&#xA;Stack Trace&#xA;#0  &#xA;–  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/web/WebApp.php(687): CApplication-&amp;gt;handleError(8, &quot;Undefined index: title&quot;, &quot;/Users/romain/Desktop/matsuri/matsuri/craft/app/models/EntryVers...&quot;, 39)&#xA;682         if (version_compare(PHP_VERSION, '7', '&amp;gt;=') &amp;amp;&amp;amp; $code === 2 &amp;amp;&amp;amp; strpos($message, 'should be compatible with') !== false)&#xA;683         {&#xA;684             return;&#xA;685         }&#xA;686 &#xA;687         parent::handleError($code, $message, $file, $line);&#xA;688     }&#xA;689 &#xA;690     // Private Methods&#xA;691     // =========================================================================&#xA;692 &#xA;#1  &#xA;–  /Users/romain/Desktop/matsuri/matsuri/craft/app/models/EntryVersionModel.php(39): Craft\WebApp-&amp;gt;handleError(8, &quot;Undefined index: title&quot;, &quot;/Users/romain/Desktop/matsuri/matsuri/craft/app/models/EntryVers...&quot;, 39, ...)&#xA;34         $entryData = $attributes['data'];&#xA;35         $fieldContent = isset($entryData['fields']) ? $entryData['fields'] : null;&#xA;36         $attributes['versionId'] = $attributes['id'];&#xA;37         $attributes['id'] = $attributes['entryId'];&#xA;38         $attributes['revisionNotes'] = $attributes['notes'];&#xA;39         $title = $entryData['title'];&#xA;40         unset($attributes['data'], $entryData['fields'], $attributes['entryId'], $attributes['notes'], $entryData['title']);&#xA;41 &#xA;42         $attributes = array_merge($attributes, $entryData);&#xA;43 &#xA;44         // Initialize the version&#xA;#2  &#xA;–  /Users/romain/Desktop/matsuri/matsuri/craft/app/services/EntryRevisionsService.php(373): Craft\EntryVersionModel::populateModel(array(&quot;id&quot; =&amp;gt; &quot;21738&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;sectionId&quot; =&amp;gt; &quot;5&quot;, &quot;creatorId&quot; =&amp;gt; &quot;260&quot;, ...))&#xA;368             $result['data'] = JsonHelper::decode($result['data']);&#xA;369 &#xA;370             // Don't initialize the content&#xA;371             unset($result['data']['fields']);&#xA;372 &#xA;373             $versions[] = EntryVersionModel::populateModel($result);&#xA;374         }&#xA;375 &#xA;376         return $versions;&#xA;377     }&#xA;378 &#xA;#3  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/variables/EntryRevisionsVariable.php(86): Craft\EntryRevisionsService-&amp;gt;getVersionsByEntryId(&quot;8090&quot;, &quot;zh&quot;, 10)&#xA;#4  &#xA; unknown(0): Craft\EntryRevisionsVariable-&amp;gt;getVersionsByEntryId(&quot;8090&quot;, &quot;zh&quot;)&#xA;#5  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(688): call_user_func_array(array(Craft\EntryRevisionsVariable, &quot;getVersionsByEntryId&quot;), array(&quot;8090&quot;, &quot;zh&quot;))&#xA;#6  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(64): Twig_Template-&amp;gt;getAttribute(Craft\EntryRevisionsVariable, &quot;getVersionsByEntryId&quot;, array(&quot;8090&quot;, &quot;zh&quot;), &quot;method&quot;, ...)&#xA;#7  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/d9/d9be2a6a0ed6d275eb077a791e70d5e4652cbcd3eb25e34da6578923225bfafe.php(104): Craft\BaseTemplate-&amp;gt;getAttribute(Craft\EntryRevisionsVariable, &quot;getVersionsByEntryId&quot;, array(&quot;8090&quot;, &quot;zh&quot;), &quot;method&quot;)&#xA;#8  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_36c428e0e064fa5cf2103ac0505dde32a4b866389b95b5b0643bd11134e0fca5-&amp;gt;doDisplay(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array())&#xA;#9  &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array())&#xA;#10 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array())&#xA;#11 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/3d/3de5b5cd9108c8dcc80b8726941bb48f2ec5837fba9b56f724c0ebeeff7f2f6c.php(68): Twig_Template-&amp;gt;display(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#12 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb-&amp;gt;block_pageTitle(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#13 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/02/02b83c11d5755246fe66a5d66d39b49cdeecf2ff0bb146e307380ce6b0b66f04.php(872): Twig_Template-&amp;gt;displayBlock(&quot;pageTitle&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#14 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065-&amp;gt;block_pageHeader(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#15 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/02/02b83c11d5755246fe66a5d66d39b49cdeecf2ff0bb146e307380ce6b0b66f04.php(668): Twig_Template-&amp;gt;displayBlock(&quot;pageHeader&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#16 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065-&amp;gt;block_body(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#17 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/e2/e214d71cd9be8c9f7e84e32ee4a027a2857d3baa0c663997875ef429ae28f48c.php(45): Twig_Template-&amp;gt;displayBlock(&quot;body&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#18 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1-&amp;gt;doDisplay(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#19 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#20 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;head&quot; =&amp;gt; array(__TwigTemplate_c54f60077735addcf30be6f2be3e0d0ef68dfd293da2c31c649ad159a98ea7d1, &quot;block_head&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), ...))&#xA;#21 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/2f/2fd2b813b122bdc2d5da0e30d9cae2fe97d13e8c3e73a47e1cb132d0558ff3e7.php(131): Twig_Template-&amp;gt;display(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), ...))&#xA;#22 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e-&amp;gt;doDisplay(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), ...))&#xA;#23 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), ...))&#xA;#24 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;foot&quot; =&amp;gt; array(__TwigTemplate_07f1ed1ad1b01b621d194464a3a48f3c95689b7413936dac9ab37f6eab989f4e, &quot;block_foot&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), ...))&#xA;#25 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/02/02b83c11d5755246fe66a5d66d39b49cdeecf2ff0bb146e307380ce6b0b66f04.php(169): Twig_Template-&amp;gt;display(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;pageHeader&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_pageHeader&quot;), ...))&#xA;#26 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065-&amp;gt;doDisplay(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;pageHeader&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_pageHeader&quot;), ...))&#xA;#27 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;pageHeader&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_pageHeader&quot;), ...))&#xA;#28 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;containerAttributes&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_containerAttributes&quot;), &quot;body&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_body&quot;), &quot;pageHeader&quot; =&amp;gt; array(__TwigTemplate_573c28a777a5dbdb7b6c97825293c782778f8ae77dca884c1018a5906d345065, &quot;block_pageHeader&quot;), ...))&#xA;#29 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/storage/runtime/compiled_templates/3d/3de5b5cd9108c8dcc80b8726941bb48f2ec5837fba9b56f724c0ebeeff7f2f6c.php(53): Twig_Template-&amp;gt;display(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;pageTitle&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_pageTitle&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;main&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_main&quot;)))&#xA;#30 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb-&amp;gt;doDisplay(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;pageTitle&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_pageTitle&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;main&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_main&quot;)))&#xA;#31 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;pageTitle&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_pageTitle&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;main&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_main&quot;)))&#xA;#32 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...), array(&quot;pageTitle&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_pageTitle&quot;), &quot;saveButton&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_saveButton&quot;), &quot;main&quot; =&amp;gt; array(__TwigTemplate_ddfe54aed58b8e0a698cbb4e30ad20c1917cb4cb5d89cb094b63bcadc80bd9eb, &quot;block_main&quot;)))&#xA;#33 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template-&amp;gt;display(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#34 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/vendor/twig/twig/lib/Twig/Environment.php(362): Twig_Template-&amp;gt;render(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#35 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/services/TemplatesService.php(256): Twig_Environment-&amp;gt;render(&quot;entries/_edit&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#36 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render(&quot;entries/_edit&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#37 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/controllers/EntriesController.php(342): Craft\BaseController-&amp;gt;renderTemplate(&quot;entries/_edit&quot;, array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;, ...))&#xA;#38 &#xA; unknown(0): Craft\EntriesController-&amp;gt;actionEditEntry(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;))&#xA;#39 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Craft\EntriesController, array(array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;)))&#xA;#40 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Craft\EntriesController, ReflectionMethod, array(&quot;p&quot; =&amp;gt; &quot;admin/entries/reportsArticle/8090-shibukawa_bellybutton_festival...&quot;, &quot;variables&quot; =&amp;gt; array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;), &quot;template&quot; =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;))&#xA;#41 &#xA;+  /Users/romain/Desktop/matsuri/matsuri/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;p&quot; =&amp;gt; &quot;admin/entries/reportsArticle/8090-shibukawa_bellybutton_festival...&quot;, &quot;variables&quot; =&amp;gt; array(&quot;matches&quot; =&amp;gt; array(0 =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;, &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, 1 =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, ...), &quot;sectionHandle&quot; =&amp;gt; &quot;reportsArticle&quot;, &quot;entryId&quot; =&amp;gt; &quot;8090&quot;, &quot;localeId&quot; =&amp;gt; &quot;zh&quot;), &quot;template&quot; =&amp;gt; &quot;entries/reportsArticle/8090-shibukawa_bellybutton_festival/zh&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4759" LastEditorUserId="4759" LastEditDate="2017-06-23T06:47:30.383" LastActivityDate="2017-06-28T00:55:07.900" Title="Localization error: Undefined index: title" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20925" PostTypeId="1" AcceptedAnswerId="21282" CreationDate="2017-06-22T08:38:38.210" Score="1" ViewCount="92" Body="&lt;p&gt;I'm using Craft Pro 3.0.0-beta.19 and I try to query matrix blocks with craft.matrixBlocks(). Background: I have event series (=structure) with a matrix block containing 1:n dates for each series. My block type in the &quot;dates&quot; matrix block is &quot;eventDate&quot; and looks like this: &lt;a href=&quot;https://i.stack.imgur.com/ror05.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ror05.png&quot; alt=&quot;Block Definition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.matrixBlocks() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is the first matrix block I have I get all the entries I have (2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entries | length }}&lt;/code&gt; will output: 2&#xA;&lt;code&gt;{{ entries.one().type }}&lt;/code&gt; will output: eventDate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to limit the blocks to eventDate only&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.matrixBlocks.type('eventDate') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the first glance this seems to work, I get the same results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I change this to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.matrixBlocks.type('WhateverGoesHere') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still get the same results. Am i not understanding this or is it a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Matthias&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-20T06:37:51.750" Title="craft.matrixBlocks element queries with .type()" Tags="&lt;elementcriteriamodel&gt;&lt;query&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20926" PostTypeId="1" AcceptedAnswerId="20946" CreationDate="2017-06-22T08:44:21.167" Score="1" ViewCount="67" Body="&lt;p&gt;We have a client website using Sprout Forms for a contact form. The client has queried a number of security topics with us, one of which is about Mail Header Injection attack protection (&lt;a href=&quot;https://www.acunetix.com/blog/articles/email-header-injection/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.acunetix.com/blog/articles/email-header-injection/&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've reached out to Ben at Barrel Strength and his response was that Sprout Forms uses the default Craft email service so any security steps Craft is taking they're piggybacking on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is currently using the PHP Mail email setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the Craft email service have any protection / validation in place to mitigate against potential Mail Header Injection attacks or would we need to implement any updates to protect against this?&lt;/p&gt;&#xA;" OwnerUserId="4095" LastActivityDate="2017-06-23T05:16:54.550" Title="Is Craft's Email Service Protected Against Mail Header Injection Attacks?" Tags="&lt;emails&gt;&lt;plugin-sproutforms&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20927" PostTypeId="1" CreationDate="2017-06-22T08:46:56.013" Score="2" ViewCount="782" Body="&lt;p&gt;Is there a way to make fields conditionally required? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bJEp7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bJEp7.png&quot; alt=&quot;Example of fields&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a toggle field that is used to hide or show a section (see screenshot: &quot;Section 3 enabled&quot;). If the section is shown (toggle: on), the fields need to be filled. If the section is hidden (toggle: off), the  fields can be left empty.&#xA;Note that the section's fields can be of any type (text, matrix, entry, assets, ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried the plugin &lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reasons&lt;/a&gt;, and unfortunately it's not what I need because it will still return a validation error for the hidden but required fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Craft CMS version is 2.6.2983.&lt;/p&gt;&#xA;" OwnerUserId="6887" LastEditorUserId="57" LastEditDate="2017-06-23T03:55:16.887" LastActivityDate="2017-08-22T04:59:33.690" Title="Make fields conditionally required" Tags="&lt;conditional&gt;&lt;custom-field&gt;&lt;required&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20928" PostTypeId="2" ParentId="2978" CreationDate="2017-06-22T11:25:36.853" Score="1" Body="&lt;p&gt;I just created this simple function in my custom extensions service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public function getTimeByZone(\DateTime $time, $zone)&#xA;{&#xA;&#xA;    $timeZ = new \DateTime($time-&amp;gt;format('H:i:s'), new \DateTimeZone('UTC)'));&#xA;    $timeZ-&amp;gt;setTimezone(new \DateTimeZone($zone));&#xA;    return $timeZ;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-$time is the UTC stored datetime object&#xA;-$zone is the user's time zone, for instance, CET&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To call it from twig, in my case would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{  getTimeByZone(dateObject, app.request.headers.get('timezone')) | date( 'H:i') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6889" LastActivityDate="2017-06-22T11:25:36.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20929" PostTypeId="1" AcceptedAnswerId="20930" CreationDate="2017-06-22T12:06:22.207" Score="1" ViewCount="45" Body="&lt;p&gt;I'm using the following code on a category listing page to list the sub-categories that contain products:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.commerce.products.ids() %}&#xA;{% if category is defined %}&#xA;    {% set currentCategory = craft.request.getSegment(2) %}&#xA;    {% set categories = craft.categories.descendantOf(category).relatedTo({ sourceElement: entryIds }).groupId(1).order('title asc').find() %}&#xA;{% else %}&#xA;    {% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).groupId(1).level(1).order('title asc').find() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm experiencing is that craft.commerce.products.ids() only returns the ids for products that have a Post Date in the current month. This is not ideal since some products might've been added months ago but still remain active on the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal behaviour for craft.commerce.products.ids() or is this a possible bug ? Any ideas on a workaround ? &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-06-22T12:36:24.060" Title="craft.commerce.products.ids() possible bug?" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20930" PostTypeId="2" ParentId="20929" CreationDate="2017-06-22T12:36:24.060" Score="3" Body="&lt;p&gt;Are you sure you're not simply hitting the default limit which is 100?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.commerce.products({limit: null}).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2017-06-22T12:36:24.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20931" PostTypeId="1" CreationDate="2017-06-22T12:45:53.327" Score="1" ViewCount="1034" Body="&lt;p&gt;I have some pages that I want to exclude from search results. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="6669" LastActivityDate="2017-06-22T19:24:09.817" Title="Is it possible to exclude entry from search index?" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20933" PostTypeId="2" ParentId="20931" CreationDate="2017-06-22T14:42:05.910" Score="1" Body="&lt;p&gt;If you mean entire sections you could define which sections you want to display like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.craft.entries.section('section1, section2, section3').search(query).order('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-06-22T14:42:05.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20934" PostTypeId="2" ParentId="20006" CreationDate="2017-06-22T15:42:04.127" Score="2" Body="&lt;p&gt;Unfortunately, I found myself in the exact same situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I ended up doing was including both the billing and shipping form on the same page but the billing form hidden. I used &lt;a href=&quot;https://vuejs.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;vue.js&lt;/a&gt; form/model binding to ensure the values were copied to the billing form. This way it captures two identical addresses, but at least they have the opportunity to edit the information separately at final checkout if shipping is required.&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2017-06-22T15:42:04.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20937" PostTypeId="2" ParentId="20931" CreationDate="2017-06-22T19:24:09.817" Score="1" Body="&lt;p&gt;One way would be to create an array of ids to exclude and then use the &lt;code&gt;not&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set idsToExclude = [14,15] %}&#xA;{% set idsToExcludeString = idsToExclude|join(', not ') %}&#xA;{% set entries = craft.entries.search(query).order('score').id('and, not ' ~ idsToExcludeString) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2017-06-22T19:24:09.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20938" PostTypeId="1" CreationDate="2017-06-22T23:13:32.257" Score="1" ViewCount="822" Body="&lt;p&gt;What is the best way of creating a custom field for each page whereby the user can input a URL into a field, which then gets input into a rel=canonical element like the example below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;canonical&quot; href=&quot;{{URL_FROM_CUSTOM_FIELD}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I already have an SEO tab like in the image below, however I am unsure of how to create a custom field inside this tab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oCrRi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oCrRi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could point me in the right direction, that would be great, as I am very new to the CMS.&lt;/p&gt;&#xA;" OwnerUserId="6892" LastEditorUserId="6892" LastEditDate="2017-06-23T06:21:02.770" LastActivityDate="2021-05-26T02:23:56.710" Title="Create custom field to input canonical url in a page" Tags="&lt;templating&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20939" PostTypeId="1" AcceptedAnswerId="20941" CreationDate="2017-06-22T23:43:34.090" Score="1" ViewCount="135" Body="&lt;p&gt;I'm unable to upload any jpg/jpeg files to the server, it just comes up with an alert saying &quot;upload failed&quot;. After checking the PHP error logs for Craft I found this error message is being created every time I try.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Class 'lsolesen\pel\PelConvert' not found in .../craft/app/vendor/lsolesen/pel/src/PelDataWindow.php on line 96&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any advice on how to fix this error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Uploading different files to make sure it wasn't an issue with the one jpg&lt;/li&gt;&#xA;&lt;li&gt;Uploading different file types (no errors occurred with other image file types)&lt;/li&gt;&#xA;&lt;li&gt;Several local server fixes I found&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6893" LastActivityDate="2017-06-23T00:16:43.097" Title="Can't Upload JPEGs to live site (PEL error)" Tags="&lt;error-message&gt;&lt;php&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20940" PostTypeId="2" ParentId="20938" CreationDate="2017-06-22T23:43:54.173" Score="0" Body="&lt;p&gt;First, I would recommend looking at the SEOmatic plugin - it does all of this for you, and a whole lot more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to go it on your own, though, I would just use &lt;code&gt;{{ craft.request.url }}&lt;/code&gt; rather than adding your own field. Craft already knows what the URL is.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2017-06-22T23:43:54.173" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20941" PostTypeId="2" ParentId="20939" CreationDate="2017-06-23T00:16:43.097" Score="2" Body="&lt;p&gt;@lindseydiloreto in the Craft Slack gave me the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, the craft/app folder got messed up in the last update. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re-downloading and replacing the /app folder fixed the problem&lt;/p&gt;&#xA;" OwnerUserId="6893" LastActivityDate="2017-06-23T00:16:43.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20942" PostTypeId="1" AcceptedAnswerId="20943" CreationDate="2017-06-23T01:01:52.293" Score="1" ViewCount="168" Body="&lt;p&gt;Is it possible to sell products using Craft Commerce, where the product may have digital AND non-digital variants?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a greeting card, might be available as a printed card but also as a digital download.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is a &lt;a href=&quot;https://craftcms.com/news/digital-products&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Products&lt;/a&gt; plugin - however, this seems to require that the product is either digital OR not (it can't be both):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Digital products are similar to Commerce’s core products, except that&#xA;  they don’t have variants&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="567" LastActivityDate="2017-06-23T02:15:10.247" Title="Selling products with a digital variant using Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20943" PostTypeId="2" ParentId="20942" CreationDate="2017-06-23T02:15:10.247" Score="2" Body="&lt;p&gt;You could definitely use standard products/variants to sell something that is digitally delivered. The Digital Products plugin just provides a nicer way to verify the ownership of a purchase, but you can see if someone has purchased a particular variant with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orders = craft.commerce.orders.user(currentUser).hasPurchasables(product.defaultVariant).find() %}&#xA;{% if orders|length %}&#xA; You already purchased this item in &amp;lt;/strong&amp;gt; &amp;lt;a href=&quot;customer/order?orderNumber={{ orders[0].number }}&quot;&amp;gt;Order #{{ orders[0].shortNumber }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-06-23T02:15:10.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20944" PostTypeId="2" ParentId="20927" CreationDate="2017-06-23T03:56:02.580" Score="1" Body="&lt;p&gt;There is currently not a native way to do this in Craft. You should consider adding a thumbs-up/comment to &lt;a href=&quot;https://github.com/craftcms/cms/issues/805&quot; rel=&quot;nofollow noreferrer&quot;&gt;this feature request&lt;/a&gt; if you'd like to see it, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-23T03:56:02.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20945" PostTypeId="1" AcceptedAnswerId="21001" CreationDate="2017-06-23T04:18:45.790" Score="3" ViewCount="333" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://straightupcraft.com/craft-plugins/printmaker&quot; rel=&quot;nofollow noreferrer&quot;&gt;Printmaker&lt;/a&gt; plugin to print a pdf. Everything seems to be working well when the site is not being forced to use SSL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the message &quot;Failed to load PDF document.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the SSL, the pdf renders correctly. I would really like to have my site be under https - is there any way to help printmaker work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see anything obvious in the &lt;code&gt;craft.log&lt;/code&gt; that would indicate an error, is there a configuration setting I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is the actual image(s) in the pdf that are causing the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full path to the S3 bucket is https, and I'm able to access the image just straight through the browser. I've copied/paste into the url bar and the image will render.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If I set the S3 path to http, and set the browser to http - all is well. &lt;/li&gt;&#xA;&lt;li&gt;If I set the S3 path to https, and the browser to http - all is well.&lt;/li&gt;&#xA;&lt;li&gt;If I set the S3 path to https and the browser to https - pdf fails to render.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To further test and and attempt to get some kind of error message/log to help trouble shoot, I've moved my image directory to a local path. I now the error &quot;Image not found or type unknown&quot;. It looks like this could be a &lt;a href=&quot;https://github.com/dompdf/dompdf/issues/1118&quot; rel=&quot;nofollow noreferrer&quot;&gt;DOMPDF issue&lt;/a&gt;. I will continue to update this thread as I uncover more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &lt;em&gt;does&lt;/em&gt; seem to be something related to forcing requests to SSL. If I remove https, the pdf renders every single time, every browser. If the request is made to the pdf using https, it fails every time.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-06-28T15:19:22.727" LastActivityDate="2017-06-28T15:20:04.177" Title="Printmaker fails to render images under SSL" Tags="&lt;htaccess&gt;&lt;plugin-printmaker&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20946" PostTypeId="2" ParentId="20926" CreationDate="2017-06-23T05:16:54.550" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does the Craft email service have any protection / validation in place to mitigate against potential Mail Header Injection attacks&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attacks like this, for the most part, are really only a concern for PHP apps that roll with their own custom email logic instead of using a widely used/tested email library.  Craft 2 uses &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHPMailer&lt;/a&gt; and Craft 3 uses &lt;a href=&quot;http://swiftmailer.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SwiftMailer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And they &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php#L3711-L3714&quot; rel=&quot;nofollow noreferrer&quot;&gt;both&lt;/a&gt; provide &lt;a href=&quot;http://swiftmailer.org/docs/headers.html#text-headers&quot; rel=&quot;nofollow noreferrer&quot;&gt;methods&lt;/a&gt; for stripping out newlines to prevent header injection attacks.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-23T05:16:54.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20947" PostTypeId="2" ParentId="20892" CreationDate="2017-06-23T06:31:28.910" Score="0" Body="&lt;p&gt;Issue is resolved, as @bradbell said the version for ImageMagick module and library was old and need to be update. You can check the latest relase from here: &lt;a href=&quot;https://www.imagemagick.org/script/changelog.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.imagemagick.org/script/changelog.php&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From some servers apt-get update won't really update the package. So you need yo install manually. There is a great &lt;a href=&quot;https://www.enovate.co.uk/blog/2015/12/16/how-to-install-imagemagick-from-source-on-ubuntu-14.04&quot; rel=&quot;nofollow noreferrer&quot;&gt;how to article&lt;/a&gt; regarding this &lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2017-06-23T06:31:28.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20948" PostTypeId="2" ParentId="20913" CreationDate="2017-06-23T09:52:23.790" Score="4" Body="&lt;p&gt;My bad - sorted it out by adding {{ getCsrfInput() }} - as per &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6882" LastActivityDate="2017-06-23T09:52:23.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20949" PostTypeId="2" ParentId="20885" CreationDate="2017-06-23T10:48:54.540" Score="1" Body="&lt;p&gt;Couldn't get past the white page issue so I made a simple plugin which does the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_transactions.onSaveTransaction', function($event) {&#xA;    $transaction = $event-&amp;gt;params[&quot;transaction&quot;];&#xA;    if ($transaction-&amp;gt;status == &quot;failed&quot;) {&#xA;        $message = $transaction-&amp;gt;response[&quot;error&quot;][&quot;message&quot;];&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice($message);&#xA;        craft()-&amp;gt;request-&amp;gt;redirect('/order');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help Luke Holder. Strange that I couldn't get rid of the white page but at least we found a solution in the end to stop the issue on the live site whilst customers are making payments.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-06-23T10:48:54.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20950" PostTypeId="1" CreationDate="2017-06-23T14:04:43.540" Score="1" ViewCount="34" Body="&lt;p&gt;I am trying to figure out if there is a way to require additional fields be filled out while uploading an asset (mainly pdf's) in the admin control panel.  I know I can add meta data fields to an asset but the process seems to be upload the asset and then edit the assets to fill out those fields.  I could easily see a user uploading and not filling out the fields and for my requirements I need those fields to be filled out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing I will have to create a plugin to handle this functionality but wanted to check if I am heading down the right path and if it is even possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6703" LastEditorUserId="6703" LastEditDate="2017-06-23T14:16:17.037" LastActivityDate="2017-06-23T14:16:17.037" Title="Can I force extra fields to be required on asset upload" Tags="&lt;assets&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20951" PostTypeId="2" ParentId="20945" CreationDate="2017-06-23T14:13:47.083" Score="1" Body="&lt;p&gt;Check your urls in your admin panel - e.g. the site url under the &quot;General&quot; panel, and then also anything under Assets. Is that set to be https? Or just http? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for example, your asset folder is set to be &lt;em&gt;http&lt;/em&gt;://www.mysite.com/images/ and you load &lt;em&gt;https&lt;/em&gt;://www.mysite.com/page.html - images on that page will try to load from &lt;em&gt;http&lt;/em&gt;://www.mysite.com/image.jpg&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: Chrome will block http items from loading on an https page, and firefox will not. (at least by default)&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2017-06-23T18:54:03.680" LastActivityDate="2017-06-23T18:54:03.680" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20952" PostTypeId="1" AcceptedAnswerId="20953" CreationDate="2017-06-23T17:25:39.363" Score="2" ViewCount="240" Body="&lt;p&gt;I am attempting to get orders that were completed between two dates and the &quot;before&quot; and &quot;after&quot; criteria parameters don't seem to work. Perhaps I am using the wrong syntax? Example of how I am using them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.after('2017-06-02 00:00:00')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4474" LastActivityDate="2017-06-23T17:38:43.607" Title="How do I query for orders that were completed between two dates?" Tags="&lt;plugin-craftcommerce&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20953" PostTypeId="2" ParentId="20952" CreationDate="2017-06-23T17:38:43.607" Score="2" Body="&lt;p&gt;It looks like I figured it out by doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.dateOrdered('and', '&amp;gt;=' ~ startDate, '&amp;lt;=' ~ endDate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4474" LastActivityDate="2017-06-23T17:38:43.607" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20954" PostTypeId="2" ParentId="4278" CreationDate="2017-06-23T18:21:37.467" Score="4" Body="&lt;p&gt;I realise this is an old post but I wrote a plugin to handle exactly this, putting this as an answer instead of a comment since OP asks if there's an override: &lt;a href=&quot;https://github.com/billythekid/activateusers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/billythekid/activateusers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2017-06-23T18:21:37.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20956" PostTypeId="2" ParentId="742" CreationDate="2017-06-24T17:01:15.707" Score="2" Body="&lt;p&gt;Let me add, for those like me who just moved to a different server, before you dump the table, make sure your assets directory is writable by Craft. I did what Lindsey D suggested, and it recreated the table nicely (with no errors noted) but didn't actually create the images, because I didn't have the directory writable.&lt;/p&gt;&#xA;" OwnerUserId="5200" LastActivityDate="2017-06-24T17:01:15.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20957" PostTypeId="2" ParentId="19747" CreationDate="2017-06-25T01:01:58.463" Score="5" Body="&lt;p&gt;This is a plugin I'm working on to do exactly what you are after. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://m.youtube.com/watch?v=n6ko2PKUqAo&amp;amp;feature=youtu.be&quot; rel=&quot;noreferrer&quot;&gt;https://m.youtube.com/watch?v=n6ko2PKUqAo&amp;amp;feature=youtu.be&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The syntax to figure out how to create sections, elements etc is determined by reading through the craft service and model classes. &lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2017-06-25T01:01:58.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20960" PostTypeId="1" AcceptedAnswerId="20961" CreationDate="2017-06-25T13:40:23.993" Score="2" ViewCount="158" Body="&lt;p&gt;I'm using the Smart Map plugin, and I can't seem to figure out how to output all the locations of my entries from a single section onto one single map.&lt;/p&gt;&#xA;&lt;p&gt;I think the issue I'm having is trying to get the information out from a Matrix block within each entry or knowing where to start!&lt;/p&gt;&#xA;&lt;p&gt;The section is 'buildings' which contains all the building entries. For each entry, there is a matrix block called 'buildingContent' which has 5 matrix blocks, and the one I want to pull information from is 'howToGetThere' (last block out of the matrix array). In this block, I have a field 'smartMap' which contains the location of the building.&lt;/p&gt;&#xA;&lt;p&gt;How would I extract the location from the 'smartMap' field for all my entries and output them onto one single map?&lt;/p&gt;&#xA;&lt;p&gt;I know the code below outputs the location of one entry (St Bartholomew The Great), but thought it might be useful to include what I've tried so far. I adapted it from the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/how-to-use-with-a-matrix-field/&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug('st-bartholomew-the-great').first %}&#xA;&#xA;{% set locations = entry.buildingContent %}&#xA;&#xA;{% set options = {&#xA;     height: 600,&#xA;     zoom: 13,&#xA;     draggable: true,&#xA;     markerInfo: '_includes/mapInfoBubble',&#xA;     markerOptions: {&#xA;        icon: 'images/map-marker2.svg',&#xA;     }&#xA; } %}&#xA;&#xA;{{ craft.smartMap.map(locations[4], options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any help much appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="6837" LastEditorUserId="45" LastEditDate="2021-01-01T06:51:44.123" LastActivityDate="2021-01-01T06:52:31.433" Title="Smart Map - Outputting locations from a Matrix field for all entries within a single section" Tags="&lt;matrix&gt;&lt;plugin-smartmap&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20961" PostTypeId="2" ParentId="20960" CreationDate="2017-06-25T15:27:39.683" Score="2" Body="&lt;p&gt;Great question! While seemingly tricky, the solution to this should be relatively simple...&lt;/p&gt;&#xA;&lt;p&gt;Per the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, the &lt;code&gt;locations&lt;/code&gt; parameter can come in a variety of different forms. But the one we're looking for here is this one...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;As an array of elements&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Collecting Matrix blocks from across different entries can be complicated, but I think you have (fortunately) described a fairly straightforward use-case. We'll need to do the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Loop through relevant entries.&lt;/li&gt;&#xA;&lt;li&gt;Build &lt;em&gt;an array of Matrix blocks&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use that array to render a map.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;pre&gt;&lt;code&gt;{# Initialize locations array #}&#xA;{% set locationsArray = [] %}&#xA;&#xA;{# Loop through all relevant entries #}&#xA;{% for entry in craft.entries.section('buildings').find() %}&#xA;&#xA;    {# Get all relevant Matrix blocks #}&#xA;    {% set matrixBlocks = entry.buildingContent.type('howToGetThere').find() %}&#xA;&#xA;    {# Append blocks to locations array #}&#xA;    {% set locationsArray = locationsArray|merge(matrixBlocks) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Render map #}&#xA;{{ craft.smartMap.map(locationsArray, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:52:31.433" LastActivityDate="2021-01-01T06:52:31.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20962" PostTypeId="1" CreationDate="2017-06-25T18:06:02.790" Score="1" ViewCount="2197" Body="&lt;p&gt;I'm trying to create a new Entry via PHP, with custom fields (Craft 3). I can save it, however my custom fields don't appear. I've tried using &lt;code&gt;setFieldValue&lt;/code&gt;, as well as &lt;code&gt;$entry-&amp;gt;excerpt = 'Lorem...';&lt;/code&gt;, however neither work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is below, using &lt;code&gt;craft\elements\Entry&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new Entry();&#xA;$entry-&amp;gt;sectionId = 4;&#xA;$entry-&amp;gt;typeId = 4;&#xA;$entry-&amp;gt;authorId = 1;&#xA;$id = uniqid('product_');&#xA;$entry-&amp;gt;title = $id;&#xA;$entry-&amp;gt;slug = $id;&#xA;&#xA;$entry-&amp;gt;setFieldValue('excerpt', 'Lorem...');&#xA;&#xA;if(Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry)) {&#xA;    return $entry;&#xA;} else {&#xA;    throw new \Exception(&quot;Couldn't save new bespoke product: &quot; . print_r($entry-&amp;gt;getErrors(), true));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6875" LastActivityDate="2017-06-26T22:20:29.230" Title="How to save a new entry with custom fields - Craft 3" Tags="&lt;entry&gt;&lt;custom-field&gt;&lt;craft3&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20963" PostTypeId="1" CreationDate="2017-06-26T08:54:24.120" Score="1" ViewCount="445" Body="&lt;p&gt;Has anyone set up the Charge plugin with Stripe Connect? I've followed the docs and things look good in the Craft back-end but the payments don't look to be routed to the correct Stripe accounts on the Stripe end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Squarebit docs refer to a config setting which I need but I haven't been able to track this down. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/usage/controllers/connect-controller&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://squarebit.co.uk/software/craft/charge/usage/controllers/connect-controller&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6725" LastEditorUserId="57" LastEditDate="2017-06-26T20:33:29.110" LastActivityDate="2017-07-04T17:45:42.493" Title="Using Charge plugin with Stripe Connect" Tags="&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20964" PostTypeId="1" CreationDate="2017-06-26T09:52:11.380" Score="1" ViewCount="131" Body="&lt;p&gt;Is there a way to copy an uploaded image in the assets.onSaveAsset event?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make a copy of the original uploaded image (for internal purposes) and after that I want to add a copyright text on the uploaded image (for displaying on webpage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&#xA;Some more info, to prevent missunderstandings: I use the BusinessLogicPlugin. Users can upload a picture which should be stored in S3. First I want to make a copy of this picture and after that to the picture should be added a small text. The copy works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I want to modify the uploaded image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.onSaveAsset', function(Event $event) {&#xA;&#xA;  static $recursionLevel = 0; // is set only once&#xA;&#xA;  if ($recursionLevel == 0 ) {&#xA;&#xA;    if ($event-&amp;gt;params[&quot;isNewAsset&quot;]) {&#xA;      $recursionLevel++;&#xA;&#xA;      $asset = $event-&amp;gt;params['asset'];&#xA;      $remoteFile = $asset-&amp;gt;getUrl();&#xA;&#xA;      // get remote image and store in temp path&#xA;      $imageInfo = pathinfo($remoteFile);&#xA;      $tempPath  = CRAFT_STORAGE_PATH . 'runtime/temp/' . $imageInfo['basename'];&#xA;      file_put_contents($tempPath, fopen($remoteFile, 'r'));&#xA;&#xA;      // only JPEG allowed&#xA;      $im = @ImageCreateFromJPEG ($tempPath);&#xA;      $textcolor = imagecolorallocate($im, 0, 0, 255);&#xA;      // add text and save to original path&#xA;      imagestring($im, 5, 0, 0, 'Hello world!', $textcolor);&#xA;      imagejpeg($im, $tempPath);&#xA;&#xA;      // update the image, but how?!&#xA;&#xA;    }&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I update the asset with the new generated file in $tempPath?&lt;/p&gt;&#xA;" OwnerUserId="6585" LastEditorUserId="6585" LastEditDate="2017-06-28T13:09:41.503" LastActivityDate="2017-11-26T00:03:48.127" Title="Copy uploaded image in event assets.onSaveAsset" Tags="&lt;assets&gt;&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20965" PostTypeId="1" CreationDate="2017-06-26T13:35:17.090" Score="6" ViewCount="1957" Body="&lt;p&gt;I've found various answers on how to upload assets via PHP for Craft 2, however nothing for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All answers use the method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;E.g: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5104/how-to-upload-an-asset-from-a-front-end-form&quot;&gt;How to upload an asset from a front-end form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what the equivalent is for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6875" LastActivityDate="2017-06-28T08:30:47.653" Title="How do I upload an asset in Craft 3, via PHP" Tags="&lt;assets&gt;&lt;php&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20968" PostTypeId="1" AcceptedAnswerId="20969" CreationDate="2017-06-26T15:54:21.740" Score="2" ViewCount="72" Body="&lt;p&gt;Trying to list all the entries which belong to an entry. Currently I have the following field format:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Has an 'retailer' entries field.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Retailer&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Normal entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the retailers _entry.html page I'm trying to display all the products which belong to said retailer. But the code I'm producing is running into trouble:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;retailers/_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set relatedProducts = craft.entries.section('products').relatedTo(entry) %}&#xA;&#xA;    {% for entry in relatedProducts %}&#xA;        &amp;lt;h3&amp;gt;Some great entries&amp;lt;/h3&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code seems to be showing the title but not actually looping over the length of the array?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-06-26T16:42:37.577" Title="Listing all entries which belong to an entry" Tags="&lt;entries&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20969" PostTypeId="2" ParentId="20968" CreationDate="2017-06-26T16:42:37.577" Score="3" Body="&lt;p&gt;I had a similar problem to yours, and here's what I ran into. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be that you're using &lt;em&gt;entry&lt;/em&gt; for your main info on the retailer entry page? Because &lt;code&gt;{{ for entry in relatedProducts }}&lt;/code&gt; would return one result (the retailer entry). So instead, use a different variable for the loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something more along the lines of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;div&amp;gt;{{ entry.body }}&amp;lt;/div&amp;gt;&#xA;&#xA;{% if craft.entries.section('products').relatedTo(entry)|length %}&#xA;  {% set relatedProducts = craft.entries.section('products').relatedTo(entry) %}&#xA;  &amp;lt;h3&amp;gt;Some great entries&amp;lt;/h3&amp;gt;&#xA;&#xA;  {% for relatedEntry in relatedProducts %}&#xA;   {{ relatedEntry.title }}&#xA;   {{ relatedEntry.body }}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, note that I wrapped the whole thing in an if-check. It checks to see if there are related products first, and then, if there are, sets the variable and runs the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And your H3 should be outside the loop, otherwise it'll show up on every pass around.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-06-26T16:42:37.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20970" PostTypeId="1" CreationDate="2017-06-26T17:39:21.390" Score="1" ViewCount="160" Body="&lt;p&gt;So I'm trying to build a query based on events and their start &lt;strong&gt;and&lt;/strong&gt; end dates. Once a user selects a year, I want to display all events that took place in that year, but also display events that might have spanned across multiple years and include that selected year. For example, if a user selects 2012. I should display all events starting in 2012, but also events that might have lasted from say 2010-2013.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is query all event entries and return only events whose startDate is less than or equal to the select year &lt;strong&gt;AND&lt;/strong&gt; whose end date is greater than or equal to the selected year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDateParam = '&amp;lt;=' ~ yearParam ~ '-01-01' %}&#xA;{% set endDateParam =  '&amp;gt;=' ~ yearParam ~ '-01-01' %}&#xA;&#xA;{% set pastEntries = craft.entries({ &#xA;   startDate: startDateParam,&#xA;   endDate: endDateParam&#xA;}).section('events').order('endDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't seem to work. What is the correct way to query for entries that satisfy both the startDate &lt;strong&gt;AND&lt;/strong&gt; endDate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any and all help is greatly appreciated. Thanks. &lt;/p&gt;&#xA;" OwnerUserId="4872" LastActivityDate="2017-06-26T18:30:33.037" Title="Query multiple fields with dates" Tags="&lt;datetime&gt;&lt;queries&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20971" PostTypeId="1" CreationDate="2017-06-26T18:28:51.237" Score="1" ViewCount="62" Body="&lt;p&gt;I have a dropdown search query I have implemented using this blog (&lt;a href=&quot;https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works excellent for searching my three categories and it's very fast.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{% set searchContactFor = craft.request.getParam('contactFor') %}&#xA;&#xA;{% if searchContactFor is not empty %}&#xA;    {% set searchContactForCat = craft.categories.slug(searchContactFor).ids() %}&#xA;    {% set categoriesArray = categoriesArray|merge([{&#xA;        targetElement: searchContactForCat,&#xA;    }]) %}&#xA;{% endif %}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I have a category I need to search call 'institution', which is nested inside a MatrixBlock 'position'. When I attempted to use the same code for searching my other categories it is unable to retrieve the slug.ids(). I've been using the Kint debugger and I'm still unable to crack this one. I am assuming I need to reached into the Matrix block 'position' prior to grabbing the 'institution' slug.ids(). I have several hacks that work but are really terrible on query performance. Does anyone have a simple solution for this that I am missing? Here is an example of an expensive query. As you can see it's pulling back all the member.ids and then matching them to the intuition. Very Slow! &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchInstitution = craft.request.getParam('institution')|lower %}&#xA;{% set searchInstitution = searchInstitution|split(',') %}&#xA;{% set memberIds = [] %}&#xA;&#xA;{% if searchInstitution is not empty %}&#xA;    {% for entry in craft.entries.section('member').limit(null) %}&#xA;&#xA;        {% set found = false %}&#xA;&#xA;        {% for block in entry.position %}&#xA;            {% if block.institution.first()|lower in searchInstitution %}&#xA;                {% set found = true %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        {% if found %}&#xA;            {% set memberIds = memberIds|merge([entry.id]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% if memberIds|length %}&#xA;    {% set queryParams = queryParams|merge({&#xA;        id: memberIds&#xA;    })%}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5751" LastEditorUserId="57" LastEditDate="2017-06-26T21:40:09.887" LastActivityDate="2017-07-26T23:56:02.770" Title="Accesing craft.categories.slug ids within a MatrixBlock for search query" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20972" PostTypeId="2" ParentId="20970" CreationDate="2017-06-26T18:30:33.037" Score="1" Body="&lt;p&gt;craft.entries isn't going to like a variable in the start or end dates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. your startDateParam should just be &lt;code&gt;{% set startDateParam = yearParam ~ '-01-01' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then your craft.entries is going to grab everything between the two dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to grab everything that overlaps the year ends... I suspect you're going to have to do a little bit of funny business...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. start date = a month before the year end, and end date is a month after the end date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then when you do the loop, have it check both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If start date is before the end of the year OR the end date is after the beginning of the year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then show all the items that meet that criteria. So if there's an event dec 12-13, 2015, the loop picks it up, but your if-check hides it. If it runs dec 30, 2015 to jan 2, 2016, the if-check shows it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDataParam = date_modify('November 1, ' ~ year-1 ~ ' 00:00:00') %}&#xA;{% set endDateParam = date_modify('February 28, ' ~ year+1 ~ ' 23:59:59') %}&#xA;&#xA;{% set pastEntries = craft.entries({ &#xA; startDate: startDateParam,&#xA; endDate: endDateParam&#xA;}).section('events').order('endDate desc') %}&#xA;&#xA;{% for pastEntry in pastEntries %}&#xA;{% if pastEntry.startDate =&amp;gt; date_modify('January 1,' ~ yearParam ~ ' 00:00:00') or pastEntry.endDate &amp;lt;= date_modify('December 31,' ~ yearParam ~ ' 00:00:00')}&#xA;  {{ all your event details here }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That make sense?&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-06-26T18:30:33.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20973" PostTypeId="2" ParentId="20964" CreationDate="2017-06-26T21:24:40.127" Score="2" Body="&lt;p&gt;I'm thinking you should use the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#assets-onBeforeUploadAsset&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeUploadAsset&lt;/a&gt; event for this instead.  You can get the path to the temporary location on disk via the &lt;code&gt;path&lt;/code&gt; parameter like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$path = $event-&amp;gt;params['path'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there, you can make a copy of the file and save to whatever location you want.  You can also watermark the original and save it back to the same temporary location and let the request continue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-06-28T22:11:00.523" LastActivityDate="2017-06-28T22:11:00.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20974" PostTypeId="2" ParentId="20962" CreationDate="2017-06-26T22:20:29.230" Score="4" Body="&lt;p&gt;It turns out the data wasn't being saved as I hadn't set a &lt;code&gt;fieldLayoutId&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I've figured this out, I've written a helper method to make saving any entry type much easier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function saveNewEntry(string $handle, array $fields) {&#xA;&#xA;    $entryType = EntryType::find()-&amp;gt;where(['handle' =&amp;gt; $handle])-&amp;gt;one();&#xA;&#xA;    $entry = new Entry();    &#xA;    $entry-&amp;gt;sectionId = $entryType-&amp;gt;getAttribute('sectionId');         &#xA;    $entry-&amp;gt;typeId = $entryType-&amp;gt;getAttribute('id');      &#xA;    $entry-&amp;gt;fieldLayoutId = $entryType-&amp;gt;getAttribute('fieldLayoutId');     &#xA;    $entry-&amp;gt;authorId = 1; &#xA;&#xA;    if(isset($fields['title'])) { &#xA;        $entry-&amp;gt;title = $fields['title'];     &#xA;        unset($fields['title']); &#xA;    }&#xA;&#xA;    if(isset($fields['slug'])) {&#xA;        $entry-&amp;gt;slug = $fields['slug'];     &#xA;        unset($fields['slug']);&#xA;    }&#xA;&#xA;    $entry-&amp;gt;setFieldValues($fields);&#xA;&#xA;    if(Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry)) {&#xA;        return $entry;&#xA;    } else {&#xA;        throw new \Exception(&quot;Couldn't save new bespoke product: &quot; . print_r($entry-&amp;gt;getErrors(), true)); &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can be used like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return self::saveNewEntry('article', [&#xA;    'title' =&amp;gt; $id,&#xA;    'slug' =&amp;gt; $id,&#xA;    'excerpt' =&amp;gt; $excerpt,&#xA;    'body' =&amp;gt; $body&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6875" LastActivityDate="2017-06-26T22:20:29.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20975" PostTypeId="2" ParentId="20971" CreationDate="2017-06-26T23:12:38.443" Score="1" Body="&lt;p&gt;I wanted to post this in case someone can use a portion of it to help with their search queries. This is what we came up with, works in combination with our three other category dropdowns (all four can be multiple selections), plus some custom Javascript. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoriesArray = ['and'] %}&#xA;&#xA;{# Institution #}&#xA;{% set searchInstitution = craft.request.getParam('institution') | replace({'|' : '\''}) %}&#xA;{% if searchInstitution is not empty %}&#xA;{% set institutions = craft.categories.search( searchInstitution ) %}&#xA;{% set categoriesArray = categoriesArray|merge([{targetElement: institutions, field: 'position.institution'}]) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var institutionNames = cbxInstitution.toArray()&#xA;      .reduce(function (p, c) {&#xA;        if (c.checked) p.push(c.value);&#xA;        return p;&#xA;      }, []);&#xA;    inInstitution.val(institutionNames.map(function(v){ return &quot;|&quot;+v.trim()+&quot;|&quot;; }).join(&quot; OR &quot;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2017-06-26T23:12:38.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20976" PostTypeId="2" ParentId="10241" CreationDate="2017-06-27T05:45:25.177" Score="3" Body="&lt;p&gt;You can also implement FastCGI Cache for static page caching pretty easily; check out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Static Page Caching with Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-06-27T05:45:25.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20977" PostTypeId="1" AcceptedAnswerId="20999" CreationDate="2017-06-27T08:42:06.147" Score="1" ViewCount="580" Body="&lt;p&gt;I am trying to get results from a relatedTo query, but only if there are more than say 1 results. Right now I am using two queries to achieve this, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set authors = craft.entries({&#xA;    section: 'authors',&#xA;    with: [&#xA;        'authorImage',&#xA;    ],&#xA;    limit: 18,&#xA;    order: 'authorSurname asc'&#xA;}) %}&#xA;{% for author in authors %}&#xA;    {% set relatedEntries = craft.entries.section('articles').sponsoredAuthor('= 0').relatedTo(author) %}&#xA;    {% if relatedEntries|length &amp;gt; 1 %} ... {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this messes up pagination (amongst other things) because the loop will iterate no mater if the related entries have more than 1 result. So I was wondering if it is possible (without using a custom query) to have the same result as a single query, so that the results match the number of the items in the loop and pagination does not break. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;authors = craft.entries.section('authors').relatedTo('articles where articles results &amp;gt; 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or something like that. Is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4941" LastActivityDate="2017-06-28T13:48:09.727" Title="RelatedTo query with length criteria" Tags="&lt;relations&gt;&lt;queries&gt;&lt;relatedto&gt;&lt;query&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20978" PostTypeId="1" AcceptedAnswerId="20979" CreationDate="2017-06-27T10:02:30.720" Score="1" ViewCount="268" Body="&lt;p&gt;Looking to get a random entry from my database which is tagged with 'featured', is this possible at all? I've seen randomised by just the entry loop but nothing else.&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-06-28T00:38:09.863" Title="Get random entry tagged with" Tags="&lt;entries&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20979" PostTypeId="2" ParentId="20978" CreationDate="2017-06-27T10:59:53.923" Score="3" Body="&lt;p&gt;You could try customizing the order parameter. MySQL allows ordering randomly by using &lt;code&gt;.. ORDER BY rand()&lt;/code&gt;. So you could try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('featured').order('rand()').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4183" LastEditorUserId="57" LastEditDate="2017-06-28T00:38:09.863" LastActivityDate="2017-06-28T00:38:09.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20980" PostTypeId="1" CreationDate="2017-06-27T11:11:33.880" Score="1" ViewCount="126" Body="&lt;p&gt;I'd like to create a discount that is applied based on the weight of a cart. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with bottles &amp;amp; boxes of wine, so a bottle of wine has a weight of 1kg &amp;amp; a box of wine can have a weight of 6kg (6 bottles) or 12kg (12 bottles).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the discount to only apply when a customer from a certain customer group purchases 12 or more bottles of wine, but can't work with quantity because a quantity of 1 could be 1 bottle of wine or 1 box of wine (which could contain 6 or 12 bottles), hence my desire to apply the discount by weight of the entire cart instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the best way to do this would be to set up a rule for the customer group, apply it to all products &amp;amp; set a minimum of 1 to ensure that the rule always runs &amp;amp; then add logic in a plugin that fires on some or other discount event that then checks the weight and applies or doesn't apply the discount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_discounts.onBeforeMatchLineItem',&#xA;  function($event){&#xA;    if( cartWeight &amp;gt;= 12){&#xA;       return;&#xA;    }else{&#xA;       $event-&amp;gt;performAction = false;&#xA;    } &#xA; });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm having trouble figuring out which event to use &amp;amp; how to put all the pieces together to achieve my desired result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers in the right direction would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-06-29T01:55:00.777" Title="How to apply a discount on cart weight ?" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20981" PostTypeId="1" AcceptedAnswerId="20994" CreationDate="2017-06-27T11:14:07.800" Score="2" ViewCount="318" Body="&lt;p&gt;I have an existing database full of users with their addresses. I'd like to import this into Craft (Commerce), and have their addresses saved as their billing address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user import part is fine, I can use &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;boboldehampsinks plugin&lt;/a&gt; to get the users in, and I can add custom fields to temporarily hold the address information until I can add it as their billing address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a good way to go about this? The documentation for Craft Commerce doesn't seem to be as complete as for Craft, and I can't see a way to set a users billing address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastEditorUserId="57" LastEditDate="2017-06-28T00:39:23.790" LastActivityDate="2017-06-28T01:27:57.330" Title="How to import user addresses?" Tags="&lt;plugin-craftcommerce&gt;&lt;users&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20982" PostTypeId="2" ParentId="20965" CreationDate="2017-06-27T14:30:33.257" Score="1" Body="&lt;p&gt;Not an actual answer to your question, but more of a pointer in the general direction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Docs for Craft 3 can be found &lt;a href=&quot;https://github.com/craftcms/docs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;on Github&lt;/a&gt;, they are a work in progress by the looks of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular you'll probably want to look at the &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/services.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Development - Services&lt;/a&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now together with the above docs, and a fresh install of Craft 3 itself, you should be able to find what you are looking for in the &lt;code&gt;Assets&lt;/code&gt; Service. Which you'll find in the following location of you install:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/vendor/craftcms/cms/src/services/Assets.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;saveAsset&lt;/code&gt; method looks like it might be a good candidate for what you are doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that should help a little bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just so you know, I'm not being deliberately vague. I'm only just starting to look into Craft 3 and was having a browse around the source code myself and it looked like it might help :) &lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2017-06-27T14:37:01.483" LastActivityDate="2017-06-27T14:37:01.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20983" PostTypeId="1" AcceptedAnswerId="21008" CreationDate="2017-06-27T17:18:21.520" Score="2" ViewCount="1752" Body="&lt;p&gt;The title pretty much says it all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to connect to a RESTful API within Craft templates to pull various showtimes, prices, availability, etc. of a theater. I have my URL endpoints and username &amp;amp; password but have no idea where they need to go in the templates. The API uses Basic Authentication. Everything I'm reading is PHP specific and I'm not quite sure how that translates to Craft/Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like the Rest plugin by Dukt (&lt;a href=&quot;https://dukt.net/rest&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net/rest&lt;/a&gt;) but it uses OAuth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help/direction would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6216" LastActivityDate="2017-06-28T22:12:41.683" Title="Connecting to REST API using Basic Auth" Tags="&lt;authentication&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20984" PostTypeId="2" ParentId="20983" CreationDate="2017-06-27T18:50:32.800" Score="3" Body="&lt;p&gt;I have built something &lt;em&gt;similar&lt;/em&gt; so hopefully this will help get you rolling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are going to need to (or at least I would) &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a plugin&lt;/a&gt; that you can call in your twig template. Pay special attention about creating a variable and services.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say your plugin is called &lt;code&gt;theater&lt;/code&gt;.&#xA;Let's also pretend you have a url &quot;mysite.com/showtimes&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;showtimes&lt;/code&gt; template, you would make a call to your theater plugin to get showtimes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;showtimes.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all upcoming showtimes from the api. #}&#xA;{% set showtimes = craft.theater.showtimes %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I won't get into the specifics of building an entire plugin, but here are the main players you'll need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you'll need a file called &lt;code&gt;TheaterVariable.php&lt;/code&gt; that has this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TheaterVariable.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TheaterVariable&#xA;{&#xA;    /**&#xA;     * Get all upcoming showtimes from the api.&#xA;     *&#xA;     * @return mixed&#xA;     */&#xA;    public function showtimes()&#xA;    {&#xA;        $showtimes = craft()-&amp;gt;theater-&amp;gt;getShowTimes();&#xA;&#xA;        return $results['data'];&#xA;    }&#xA;...&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you'll need a file called &lt;code&gt;TheaterService.php&lt;/code&gt; to do the real work of getting your showtimes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TheaterService.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class TheaterService extends BaseApplicationComponent&#xA;{&#xA;    /**&#xA;     * Get all upcoming showtimes from the api.&#xA;     *&#xA;     * @return \Guzzle\Http\EntityBodyInterface|string&#xA;     */&#xA;    public function getShowTimes()&#xA;    {&#xA;        try {&#xA;            error_log((craft()-&amp;gt;config-&amp;gt;get('devMode')) ? 'Getting all upcoming showtimes.' . '' : '');&#xA;&#xA;            $client = new \Guzzle\Http\Client('http://your-api-domain.com/);&#xA;            $uri = 'api/api-endpoint';&#xA;&#xA;            $request = $client-&amp;gt;get($uri, array(&#xA;                'content-type' =&amp;gt; 'application/json'&#xA;            ));&#xA;&#xA;            $request-&amp;gt;addHeader('Accept', 'application/json');&#xA;            $request-&amp;gt;addHeader('Authorization', 'YOUR CREDS');&#xA;&#xA;            $response = $request-&amp;gt;send();&#xA;&#xA;            return $response-&amp;gt;json();&#xA;        } catch&#xA;        (\Exception $e) {&#xA;            if (craft()-&amp;gt;config-&amp;gt;get('devMode')) {&#xA;                error_log('Error: Could not get upcoming showtimes.');&#xA;                error_log($e-&amp;gt;getResponse()-&amp;gt;getBody());&#xA;            }&#xA;        }&#xA;&#xA;    ...&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, back to your &lt;code&gt;showtimes&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;showtimes.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if showtimes|length %}&#xA;    {% for showtime in showtimes %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {# Could not find any upcoming showtimes for some reason. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using oAuth to handle my authorization, so that part might be a bit different for you. But in the big picture this &lt;em&gt;should&lt;/em&gt; be pretty close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-06-27T18:50:32.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20985" PostTypeId="1" CreationDate="2017-06-27T18:51:05.207" Score="2" ViewCount="116" Body="&lt;p&gt;We just moved an installation of one of our sites to a new server. Previously, it was on a machine where the versions of Ubuntu / PHP prevented us from upgrading the Craft core version from 2.3.x to 2.6.x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few days ago, our client ran one of their security penetration tests that result in a large number of 404 HTTP requests against our site. This test generated enough unique cached templates in &lt;code&gt;/craft/storage/runtime/compiled_templates&lt;/code&gt; to fill up the remaining disk space on the server - which appeared to take MySQL service down and serve 500 template errors afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since bringing the site back up, we've been trying to identify and resolve the root issue behind the template caching that took the site offline. We've read &lt;a href=&quot;https://craftcms.stackexchange.com/a/15925/6917&quot;&gt;this thread&lt;/a&gt; and are trying to formulate the right questions to prevent this from happening to this site the next time the client runs their tests.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Were there any significant changes in how Craft was handling template caching between versions 2.3 and 2.6 that would've allowed the old site to handle a spike in traffic without this issue?&lt;/li&gt;&#xA;&lt;li&gt;Is there a configuration setting we missed to either avoid caching 404 pages, or reference the same cached template for all 404 requests?&lt;/li&gt;&#xA;&lt;li&gt;Are there any special directory or file permission considerations to take into account that would prevent Craft from periodically clearing disk space here? Are there any automated cleanup tasks that should have run before the directory filled up?&lt;/li&gt;&#xA;&lt;li&gt;Are there any OS, PHP or Apache settings that we should compare between the old server and new server that would help clarify the issue?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6917" LastActivityDate="2017-06-28T10:59:37.633" Title="Security test generated large compiled_templates directory, site outage" Tags="&lt;cache&gt;&lt;php&gt;&lt;error&gt;&lt;404&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20986" PostTypeId="1" CreationDate="2017-06-27T19:49:53.507" Score="1" ViewCount="75" Body="&lt;p&gt;We are experiencing very unexpected behaviour with a very simple plugin we wrote and are stymied as to whether this is revealing a bug in Commerce or whether we have completed missed something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what we're doing in conceptual terms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to offer different prices for users based on their country (just US and CAD right now). The Commerce base currency has been set to CAD and we have added a custom field for products to hold a US price. So each product has a CAD price using Commerce's base currency and a US price using a custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We check the user's country and based on whether it is Canada or the US, our plugin uses &lt;code&gt;onPopulateLineItem&lt;/code&gt; and &lt;code&gt;onBeforeSaveOrder&lt;/code&gt; to update the price and currency appropriately:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class FlatPricingPlugin extends BasePlugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        // If there is no log here, cp login will fail.  This line is&#xA;        // not nessesary if dev mode is turned on.  This is probably a&#xA;        // server specific issue.&#xA;        FlatPricingPlugin::log(&#xA;            'This is a required log line. See FlatPricingPlugin.php',&#xA;            LogLevel::Info, true);&#xA;&#xA;&#xA;        // Use the american price if currency is set to USD&#xA;        craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;            $line = $event-&amp;gt;params['lineItem'];&#xA;            $currency_key = 'currencyAbbreviation';&#xA;            $currency = craft()-&amp;gt;httpSession-&amp;gt;get($currency_key);&#xA;            if($currency == 'USD'){&#xA;                $price = $line-&amp;gt;purchasable-&amp;gt;product-&amp;gt;productPriceUSD;&#xA;                $line['price'] = $price;&#xA;            }&#xA;        });&#xA;&#xA;        // Set the currency and payment currency to the chosen currency&#xA;        craft()-&amp;gt;on('commerce_orders.onBeforeSaveOrder', function($event){&#xA;            $order = $event-&amp;gt;params['order'];&#xA;            $currency_key = 'currencyAbbreviation';&#xA;            $currency = craft()-&amp;gt;httpSession-&amp;gt;get($currency_key);&#xA;            FlatPricingPlugin::log(&quot;$currency -- {$order-&amp;gt;itemSubtotal}, {$order-&amp;gt;itemTotal}, {$order-&amp;gt;totalPrice}, {$order-&amp;gt;totalPaid}&quot;);&#xA;            if ($currency == 'USD'){&#xA;                $order-&amp;gt;paymentMethodId = 2;&#xA;                $order-&amp;gt;currency = $currency;&#xA;                $order-&amp;gt;paymentCurrency = $currency;&#xA;            }else{&#xA;                $order-&amp;gt;paymentMethodId = 1;&#xA;                $order-&amp;gt;currency = $currency;&#xA;                $order-&amp;gt;paymentCurrency = $currency;&#xA;            }&#xA;        });&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but we have run into a reproducible scenario where placing an order overwrites the currency of previous orders. The scenario involves placing an order from one country and then, for the same user, placing an order when they are in the other country. In this case, the old order (or orders) have their currencies changed to match the new country.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have tested this on a vanilla install of Craft and Commerce with only this one plugin. Here is a &lt;a href=&quot;http://dev.coalescentdesign.com/flat-pricing-issue.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; to a ZIP with a DB dump, our plugin and a readme with full setup and reproduce instructions.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-06-27T20:42:17.813" LastActivityDate="2017-06-27T20:42:17.813" Title="Commerce Plugin Unintentionally Rewriting Past Orders - Commerce Bug or Something Else?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20987" PostTypeId="1" CreationDate="2017-06-27T20:11:00.073" Score="3" ViewCount="267" Body="&lt;p&gt;I need to sort the entries for an Element API endpoint by a value calculated in a custom transformer. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case is this: We're dealing with Events/Courses that have multiple instances (sessions) that each may contain multiple dates. I have a Neo field called &lt;code&gt;sessions&lt;/code&gt; with &lt;code&gt;session&lt;/code&gt; blocks that contain &lt;code&gt;date&lt;/code&gt; sub-blocks. The &lt;code&gt;session&lt;/code&gt; block contains &lt;code&gt;registrationLink&lt;/code&gt; and &lt;code&gt;location&lt;/code&gt;, and each &lt;code&gt;date&lt;/code&gt; block contains the fields &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;startTime&lt;/code&gt;, and &lt;code&gt;endTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these need to be sorted by nearest session date (the user could input the sessions/dates in any order), so I need to determine the nearest upcoming session by looking through all the sessions and finding the first date for that session. We also don't want to show sessions that have already passed. I wasn't able to figure out how to do this in Twig, so I thought it might be easier in Element API. I've got the transformer working, so I can get output like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;entries&quot;: [&#xA;    {&#xA;      &quot;title&quot;: &quot;TITLE REMOVED&quot;,&#xA;      &quot;url&quot;: &quot;URL REMOVED&quot;,&#xA;      &quot;nextSessionStart&quot;: &quot;2017-08-09&quot;,&#xA;      &quot;sessions&quot;: [&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-08-09&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            },&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-08-10&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        },&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-11-02&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            },&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-11-03&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        },&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2018-02-06&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            },&#xA;            {&#xA;              &quot;date&quot;: &quot;2018-02-07&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        }&#xA;      ]&#xA;    },&#xA;    {&#xA;      &quot;title&quot;: &quot;TITLE REMOVED&quot;,&#xA;      &quot;url&quot;: &quot;URL REMOVED&quot;,&#xA;      &quot;nextSessionStart&quot;: &quot;2018-07-07&quot;,&#xA;      &quot;sessions&quot;: [&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2018-07-07&quot;,&#xA;              &quot;startTime&quot;: &quot;5:30PM&quot;,&#xA;              &quot;endTime&quot;: &quot;8:30PM&quot;&#xA;            },&#xA;            {&#xA;              &quot;date&quot;: &quot;2018-08-07&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        }&#xA;      ]&#xA;    },&#xA;    {&#xA;      &quot;title&quot;: &quot;TITLE REMOVED&quot;,&#xA;      &quot;url&quot;: &quot;URL REMOVED&quot;,&#xA;      &quot;nextSessionStart&quot;: &quot;2017-07-11&quot;,&#xA;      &quot;sessions&quot;: [&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-12-05&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        },&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-07-11&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        },&#xA;        {&#xA;          &quot;location&quot;: &quot;LOCATION REMOVED&quot;,&#xA;          &quot;registrationLink&quot;: &quot;URL REMOVED&quot;,&#xA;          &quot;dates&quot;: [&#xA;            {&#xA;              &quot;date&quot;: &quot;2017-10-25&quot;,&#xA;              &quot;startTime&quot;: &quot;8:30AM&quot;,&#xA;              &quot;endTime&quot;: &quot;4:30PM&quot;&#xA;            }&#xA;          ]&#xA;        }&#xA;      ]&#xA;    }&#xA;  ],&#xA;  &quot;meta&quot;: {&#xA;    &quot;pagination&quot;: {&#xA;      &quot;total&quot;: 3,&#xA;      &quot;count&quot;: 3,&#xA;      &quot;per_page&quot;: 10,&#xA;      &quot;current_page&quot;: 1,&#xA;      &quot;total_pages&quot;: 1,&#xA;      &quot;links&quot;: [&#xA;&#xA;      ]&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need to sort and paginate the results based on that nextSessionStart key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the elementapi.php config file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    return [&#xA;        'defaults' =&amp;gt; [&#xA;            'elementType' =&amp;gt; ElementType::Entry,&#xA;            'elementsPerPage' =&amp;gt; 10,&#xA;            'pageParam' =&amp;gt; 'pg',&#xA;            'resourceKey' =&amp;gt; 'entries'&#xA;        ],&#xA;&#xA;        'endpoints' =&amp;gt; [&#xA;            'courses.json' =&amp;gt; function() {&#xA;&#xA;                require craft()-&amp;gt;path-&amp;gt;getConfigPath().'elementapi/CoursesTransformer.php';&#xA;&#xA;                return [&#xA;                    'criteria' =&amp;gt; [&#xA;                        'section' =&amp;gt; ['courses'],&#xA;                        'order' =&amp;gt; 'nextSessionStart asc' //NOTE: this doesn't work and needs to be removed to get the above output&#xA;                    ],&#xA;                    'transformer' =&amp;gt; new CoursesTransformer()&#xA;                ];&#xA;            }&#xA;        ]&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The transformer looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    class CoursesTransformer extends TransformerAbstract {&#xA;&#xA;        public function transform (EntryModel $entry) {&#xA;&#xA;            $next_session_start = null;&#xA;            $sessions = array();&#xA;            $now = date('Y-m-d');&#xA;&#xA;            foreach ($entry-&amp;gt;sessions as $session) {&#xA;                if ($session-&amp;gt;level == 1) {&#xA;                    $this_session = array(&#xA;                        'location' =&amp;gt; $session-&amp;gt;location,&#xA;                        'registrationLink' =&amp;gt; $session-&amp;gt;registrationLink,&#xA;                        'dates' =&amp;gt; array()&#xA;                    );&#xA;                    foreach ($session-&amp;gt;children as $date) {&#xA;                        $this_date = $date-&amp;gt;date;&#xA;&#xA;                        array_push($this_session['dates'], array(&#xA;                            'date' =&amp;gt; date_format($this_date, 'Y-m-d'),&#xA;                            'startTime' =&amp;gt; date_format($date-&amp;gt;startTime, 'g:iA'),&#xA;                            'endTime' =&amp;gt; date_format($date-&amp;gt;endTime, 'g:iA')&#xA;                        ));&#xA;&#xA;                        if ($this_date &amp;gt; $now &amp;amp;&amp;amp; (is_null($next_session_start) || $this_date &amp;lt; $next_session_start)) {&#xA;                            $next_session_start = $this_date;&#xA;                        }&#xA;                    }&#xA;                    array_push($sessions, $this_session);&#xA;                }&#xA;            }&#xA;&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                'nextSessionStart' =&amp;gt; date_format(new DateTime($next_session_start), 'Y-m-d'),&#xA;                'sessions' =&amp;gt; $sessions&#xA;            ];&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any information about how I can resort based on the transformer output would be really appreciated. This project is sort of at a standstill until I can figure out how to sort these courses and events based on their next upcoming date.&lt;/p&gt;&#xA;" OwnerUserId="4819" LastActivityDate="2020-08-04T13:05:55.270" Title="How do I sort and paginate a JSON feed by a key from a transformer?" Tags="&lt;plugin-elementapi&gt;&lt;sorting&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20989" PostTypeId="1" CreationDate="2017-06-27T22:24:01.903" Score="1" ViewCount="795" Body="&lt;p&gt;Is it possible to list subfolders from a specific folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Context: &#xA;I'm printing out hundreds of icons which are maintained by moving a directory structure directly over to my public assets folder. Currently, I grab and list all icons by looking at the parent folder for icons:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in craft.assets.source('iconLibrary').limit(null) %}&#xA;   &amp;lt;li&amp;gt;...&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to call and list them by their individual folder names though. Is there a way to take a specific folder and return a list of subfolders?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;Brad's solution works! Though it's somewhat awkward having to call an image first to start at AssetFileModel. Hopefully this can be optimized as I'm running through a loop like&#xA; the one above for each child folder now— &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!--find image in parent icon folder to access folder via AssetFileModel.--&amp;gt;&#xA;{% for image in craft.assets.id('9328') %} &#xA;   &amp;lt;!-- get children of that asset's folder --&amp;gt;&#xA;   {% for subfolder in image.folder.getChildren() %} //&#xA;      {{ subfolder }}   //prints each child folder name&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6919" LastEditorUserId="6919" LastEditDate="2017-06-30T05:38:59.397" LastActivityDate="2017-06-30T05:38:59.397" Title="List subfolders of a specific asset folder" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20991" PostTypeId="2" ParentId="20985" CreationDate="2017-06-28T00:13:07.730" Score="3" Body="&lt;p&gt;I don't have specific answers to your questions, but that's mainly because I feel there are some clarifications and observations that I think might be more helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thread you linked to is referring to template caching using the Craft &lt;code&gt;{% cache %}&lt;/code&gt; tag in a template.  All of its cached data is stored in the database in the &lt;code&gt;craft_templatecache*&lt;/code&gt; tables, not on the file system.  See &lt;a href=&quot;https://craftcms.stackexchange.com/a/13383/57&quot;&gt;here&lt;/a&gt; for an explanation of the different caching methods Craft uses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The compiled files in &lt;code&gt;craft/storage/runtime/compiled_templates&lt;/code&gt; are what happens when Twig needs to render a template in the &lt;code&gt;craft/templates&lt;/code&gt; folder. The first time a template is requested, Twig will take that uncompiled template and compile it down to PHP and save it in the &lt;code&gt;compiled_templates&lt;/code&gt; folder.  If another request comes in for that same template, it will check the  file's last modified date and if it hasn't changed, it will execute the compiled template directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that an actual 404 request wouldn't create new files in the &lt;code&gt;compiled_templates&lt;/code&gt; folder (other than the 404 template that it might need to render), I'd guess that the assumption that the 404 requests caused the &lt;code&gt;compiled_templates&lt;/code&gt; folder to fill up enough to run out of disk space is incorrect.  It could be that enough log files or some other by-product of the testing caused more disk space to be used, but it's hard to tell without looking at the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also mentioned that the database went down.  Given that the &lt;code&gt;{% cache %}&lt;/code&gt; tag stores its data in the database, my first hunch would be to look at the strategy for using the template cache tag on your templates.  Here is a good article that weighs the in-and-outs of using it: &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two other things worth thinking about. A responsible security pen-tester is going to know better than to test on a live site by hammering it to the ground. But it's possible that maybe they were being responsible and the server is under-powered to handle any spike in load.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="85" LastEditDate="2017-06-28T10:59:37.633" LastActivityDate="2017-06-28T10:59:37.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20992" PostTypeId="2" ParentId="20989" CreationDate="2017-06-28T00:49:37.623" Score="1" Body="&lt;p&gt;Not a complete answer, but in your example &lt;code&gt;image&lt;/code&gt; if going to be an instance of &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetFileModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;AssetFileModel&lt;/code&gt; has a &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFileModel#getFolder-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getFolder&lt;/a&gt; method that returns an instance of &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFolderModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssetFolderModel&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;AssetFolderModel&lt;/code&gt; has a &lt;a href=&quot;https://craftcms.com/classreference/models/AssetFolderModel#getChildren-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getChildren&lt;/a&gt; method you could loop through to get all of the subfolders for the given folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how numerous your file/folder structure is, though, it might be more efficient to do this from PHP in a custom plugin rather than to do it from Twig.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="142" LastEditDate="2017-06-28T06:53:26.163" LastActivityDate="2017-06-28T06:53:26.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20993" PostTypeId="2" ParentId="20924" CreationDate="2017-06-28T00:55:07.900" Score="0" Body="&lt;p&gt;From your stack trace and description, it looks like some of the entry versions in the zh (Chinese) locale are missing their &lt;code&gt;title&lt;/code&gt; field.  No idea how that happened (every entry and version should always have a title), but that's the cause of the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The particular entry that's causing the error you're getting has an ID of &lt;code&gt;8090&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the revisions aren't particularly important, you can delete them from the &lt;code&gt;craft_entryversions&lt;/code&gt; table where &lt;code&gt;entryId&lt;/code&gt; = 8090 for this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are, you can edit the JSON encoded &lt;code&gt;data&lt;/code&gt; column in that table to include a &lt;code&gt;&quot;title&quot;&lt;/code&gt; attribute.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-28T00:55:07.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20994" PostTypeId="2" ParentId="20981" CreationDate="2017-06-28T01:27:57.330" Score="4" Body="&lt;p&gt;Addresses are not Elements, so most import plugins will no support them as an import type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to create a plugin or script that imports the addresses into the commerce_addresses table. You could do this with a SQL query, but you could also use the Commerce address service like the example below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply create an import.php file and place it in your public directory:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;$craft = require '../craft/app/bootstrap.php';&#xA;&#xA;$craft-&amp;gt;plugins-&amp;gt;loadPlugins();&#xA;&#xA;$addressModel = new Commerce_AddressModel();&#xA;&#xA;$addressModel-&amp;gt;attention = '';&#xA;$addressModel-&amp;gt;title = '';&#xA;$addressModel-&amp;gt;firstName = 'John';&#xA;$addressModel-&amp;gt;lastName = 'Doe';&#xA;$addressModel-&amp;gt;address1 = '';&#xA;$addressModel-&amp;gt;address2 = '';&#xA;$addressModel-&amp;gt;city = '';&#xA;$addressModel-&amp;gt;zipCode = '';&#xA;$addressModel-&amp;gt;phone = '';&#xA;$addressModel-&amp;gt;alternativePhone = '';&#xA;$addressModel-&amp;gt;businessName = '';&#xA;$addressModel-&amp;gt;businessTaxId = '';&#xA;$addressModel-&amp;gt;businessId = '';&#xA;$addressModel-&amp;gt;countryId = 1;&#xA;$addressModel-&amp;gt;stateValue = 1; // can be (int) stateId or (string) state name&#xA;&#xA;if(craft()-&amp;gt;commerce_addresses-&amp;gt;saveAddress($addressModel)){&#xA;    echo &quot;Address Saved&quot;;&#xA;}else{&#xA;    $errors = $addressModel-&amp;gt;getAllErrors();&#xA;    echo '&amp;lt;b&amp;gt;Errors&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;';&#xA;    foreach ($errors as $error) {&#xA;        echo 'Error: '.$error;&#xA;        echo '&amp;lt;br&amp;gt;';&#xA;    }&#xA;};&#xA;&#xA;$craft-&amp;gt;end();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code will insert one Address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will then want to assign this address to a customer/user, so you will need to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Create a customer record in the &lt;code&gt;commerce_customers&lt;/code&gt; table with the &lt;code&gt;userId&lt;/code&gt; and &lt;code&gt;email&lt;/code&gt; values set to that of the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Insert a record into the &lt;code&gt;commerce_customers_addresses&lt;/code&gt; table with the &lt;code&gt;customerId&lt;/code&gt; and &lt;code&gt;addressId&lt;/code&gt; for each of the addresses belonging to that customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps above can be done directly as SQL inserts into the tables mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will make the address available for selection on checkout.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-06-28T01:27:57.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20995" PostTypeId="1" AcceptedAnswerId="21007" CreationDate="2017-06-28T07:16:32.360" Score="1" ViewCount="931" Body="&lt;p&gt;Let's say I have a section 'foo', with following fields and slug:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Name (name)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last Name (lname)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plan (plan)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cost (cost)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field cost is dynamically created by a function already present in controller. I tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionGetCost()&#xA;{&#xA;    $fname = craft()-&amp;gt;request-&amp;gt;getParam('name');&#xA;    $lname = craft()-&amp;gt;request-&amp;gt;getParam('lname');&#xA;    $plan = craft()-&amp;gt;request-&amp;gt;getParam('plan');&#xA;&#xA;    ...&#xA;&#xA;    $entry = new EntryModel();&#xA;    $entry-&amp;gt;sectionId = 16;&#xA;    date_default_timezone_set('America/New_York');&#xA;    $date = date('n-j-Y') ;&#xA;    $entry-&amp;gt;postDate = $date;&#xA;    $entry-&amp;gt;authorId = 1;&#xA;    $entry-&amp;gt;enabled = true;&#xA;    $entry-&amp;gt;setContentFromPost([&#xA;       'name' =&amp;gt; $fname,&#xA;       'lname' =&amp;gt; $lname,&#xA;       'plan' =&amp;gt; $plan,       &#xA;       'cost' =&amp;gt; $cost-&amp;gt;id,&#xA;    ]);&#xA;&#xA;    $save = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    if ($save){&#xA;      echo &quot;saved&quot; !&#xA;    }else{&#xA;      echo &quot;&amp;lt;pre&amp;gt;&quot;;&#xA;      print_r($entry()-&amp;gt;getAllErrors());&#xA;      echo &quot;&amp;lt;/pre&amp;gt;&quot;;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's wrong in the code? How can I do it?&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-06-29T05:09:04.347" LastActivityDate="2017-06-29T05:09:04.347" Title="How to create an entry from plugin controller?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20997" PostTypeId="2" ParentId="20965" CreationDate="2017-06-28T08:30:47.653" Score="12" Body="&lt;p&gt;I finally figured out how to upload an asset, however I still don't understand why the &lt;code&gt;insertFileByLocalPath&lt;/code&gt; has been removed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @param UploadedFile $uploadedFile&#xA; * @param int $folderId&#xA; * @return Asset&#xA; * @throws BadRequestHttpException&#xA; * @throws UploadFailedException&#xA; */&#xA;protected static function uploadNewAsset(UploadedFile $uploadedFile, $folderId) {&#xA;&#xA;&#xA;    if (empty($folderId)) {&#xA;        throw new BadRequestHttpException('No target destination provided for uploading');&#xA;    }&#xA;&#xA;    if ($uploadedFile === null) {&#xA;        throw new BadRequestHttpException('No file was uploaded');&#xA;    }&#xA;&#xA;    $assets = Craft::$app-&amp;gt;getAssets();&#xA;&#xA;    if ($uploadedFile-&amp;gt;getHasError()) {&#xA;        throw new UploadFailedException($uploadedFile-&amp;gt;error);&#xA;    }&#xA;&#xA;    // Move the uploaded file to the temp folder&#xA;    if (($tempPath = $uploadedFile-&amp;gt;saveAsTempFile()) === false) {&#xA;        throw new UploadFailedException(UPLOAD_ERR_CANT_WRITE);&#xA;    }&#xA;&#xA;    if (empty($folderId)) {&#xA;        throw new BadRequestHttpException('The target destination provided for uploading is not valid');&#xA;    }&#xA;&#xA;    $folder = $assets-&amp;gt;findFolder(['id' =&amp;gt; $folderId]);&#xA;&#xA;    if (!$folder) {&#xA;        throw new BadRequestHttpException('The target folder provided for uploading is not valid');&#xA;    }&#xA;&#xA;    // Check the permissions to upload in the resolved folder.&#xA;    $filename = Assets::prepareAssetName($uploadedFile-&amp;gt;name);&#xA;&#xA;    $asset = new Asset();&#xA;    $asset-&amp;gt;tempFilePath = $tempPath;&#xA;    $asset-&amp;gt;filename = $filename;&#xA;    $asset-&amp;gt;newFolderId = $folder-&amp;gt;id;&#xA;    $asset-&amp;gt;volumeId = $folder-&amp;gt;volumeId;&#xA;    $asset-&amp;gt;avoidFilenameConflicts = true;&#xA;    $asset-&amp;gt;setScenario(Asset::SCENARIO_CREATE);&#xA;&#xA;    $result = Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($asset);&#xA;&#xA;    return $asset;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in my controller I can simply use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$service-&amp;gt;uploadImage(UploadedFile::getInstanceByName('photo'), 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6875" LastActivityDate="2017-06-28T08:30:47.653" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20998" PostTypeId="1" AcceptedAnswerId="21000" CreationDate="2017-06-28T13:38:56.063" Score="1" ViewCount="36" Body="&lt;p&gt;I'm quite new to Craft. I was working on templates, then I logged in to create a new section and now any frontend route is returning a blank page.&#xA;500 Internal Server Error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I restarted, Nginx, reboot Ubuntu server, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Control Panel is working fine, I haven't touched any configuration file that I'm aware of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what I did wrong?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="6817" LastEditDate="2017-06-28T13:47:42.947" LastActivityDate="2017-06-28T22:12:24.350" Title="White pages on Frontend" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20999" PostTypeId="2" ParentId="20977" CreationDate="2017-06-28T13:48:09.727" Score="1" Body="&lt;p&gt;The only way I can think to do this is with a plugin that tracks the relation count, storing it as a custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First create a new Number custom field called “Total Articles” (handle: &lt;code&gt;totalArticles&lt;/code&gt;). Assign it to your Authors field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then create a new &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;. Put this in the primary plugin class’ &lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;    /** @var EntryModel $entry */&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if ($entry-&amp;gt;getSection()-&amp;gt;handle === 'articles') {&#xA;        // Update author relation counts&#xA;        foreach ($entry-&amp;gt;relatedAuthor as $author) {&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;            $criteria-&amp;gt;section = 'articles';&#xA;            $criteria-&amp;gt;relatedTo(array(&#xA;                'targetElement' =&amp;gt; $author,&#xA;                'field' =&amp;gt; 'relatedAuthor'&#xA;            ));&#xA;            $totalArticles = $criteria-&amp;gt;total();&#xA;&#xA;            craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update('content',&#xA;                array('field_totalArticles' =&amp;gt; $totalArticles),&#xA;                array('elementId' =&amp;gt; $author-&amp;gt;id));&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, from your template, you can fetch only the authors that have at least 2 articles like so:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set authors = craft.entries({&#xA;    section: 'authors',&#xA;    totalArticles: '&amp;gt;= 2',&#xA;    with: [&#xA;        'authorImage',&#xA;    ],&#xA;    limit: 18,&#xA;    order: 'authorSurname asc'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-06-28T13:48:09.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21000" PostTypeId="2" ParentId="20998" CreationDate="2017-06-28T13:51:33.577" Score="1" Body="&lt;p&gt;Error with Twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case anyone is interested, I was using &lt;code&gt;extends&lt;/code&gt; in a template that was &lt;code&gt;include&lt;/code&gt; by a index template. Generating a sort of bad recursion that emptied memory ( PHP Error ).&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="57" LastEditDate="2017-06-28T22:12:24.350" LastActivityDate="2017-06-28T22:12:24.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21001" PostTypeId="2" ParentId="20945" CreationDate="2017-06-28T15:20:04.177" Score="3" Body="&lt;p&gt;&lt;strong&gt;UPDATE 2/Resolution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really have an explanation for what was happening. Hopefully this will help others if they experience the same. I'm happy to update the answer however if anyone has suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am forcing &lt;code&gt;https&lt;/code&gt; on my site via &lt;code&gt;.htaccess&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pdf would render 100% of the time in every browser when the request was made using &lt;code&gt;http&lt;/code&gt;. When the pdf was requested using &lt;code&gt;https&lt;/code&gt; In Chrome I would always get &quot;Failed to load PDF document&quot;. Firefox would always work and Safari would give me a grey screen. For others, it would work sporadically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of my images are being served from an S3 source (all https) so all of my assets were secure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up making my &lt;code&gt;.htaccess&lt;/code&gt; file force https for everything &lt;em&gt;except&lt;/em&gt; the request to the pdf.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTP:X-Forwarded-Proto} !^https&#xA;RewriteCond %{QUERY_STRING} !(^|&amp;amp;)entryId=(.*?)(&amp;amp;|$) [NC]&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]&#xA;&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} ^https&#xA;RewriteCond %{QUERY_STRING} entryId=(.*?)(&amp;amp;|$) [NC]&#xA;RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url to my pdf looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://mysite.com/entry/pdf?entryId=123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When a user makes a request to that url, they are redirected (301) to a non-https version.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://mysite.com/entry/pdf?entryId=123&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-06-28T15:20:04.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21004" PostTypeId="2" ParentId="5155" CreationDate="2017-06-28T18:52:55.953" Score="1" Body="&lt;p&gt;You can also do a simple if/else to hide the href link using a lightswitch toggle. Using Jamie's hideFromNavigation lightswitch from above, you could do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages') %}&#xA;&amp;lt;ul id=&quot;nav&quot;&amp;gt;&#xA;    {% nav entry in entries %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a  {% if entry.hideFromNavigation %} href=&quot;#&quot; {% else %} href=&quot;{{ entry.url }}&quot; {% endif %}&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;            {% ifchildren %}&#xA;                &amp;lt;ul&amp;gt;&#xA;                    {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6923" LastActivityDate="2017-06-28T18:52:55.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21005" PostTypeId="1" CreationDate="2017-06-28T20:44:24.357" Score="1" ViewCount="162" Body="&lt;p&gt;I have looked through every resource I can find for this question and haven't had any luck.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;OS: Ubuntu 16.04&lt;/li&gt;&#xA;&lt;li&gt;localhost successfully shows Ubuntu landing page  &lt;/li&gt;&#xA;&lt;li&gt;localhost/info.php successfully shows PHP page and extensions&lt;/li&gt;&#xA;&lt;li&gt;ctype is NOT listed on the info.php page&lt;/li&gt;&#xA;&lt;li&gt;Wordpress functions properly&lt;/li&gt;&#xA;&lt;li&gt;I am using the LAMP stack&lt;/li&gt;&#xA;&lt;li&gt;I created a database for craft, renamed htaccess to .htaccess in public, altered db.php in the craft/ directory, ensured there are no&#xA;syntax errors, etc, etc.&lt;/li&gt;&#xA;&lt;li&gt;Essentially, any of the go to responses I have already tried. I've been dealing with this for 3 days now.&lt;/li&gt;&#xA;&lt;li&gt;localhost/craftCMS/public/index.php/admin sends me to a blank white page&lt;/li&gt;&#xA;&lt;li&gt;phperrors.log file shows &quot;called to undefined function ctype_alpha()&quot;&lt;/li&gt;&#xA;&lt;li&gt;When I try to install php7.0-ctype it installs php7.0-common, but ctype doesn't seem to be there&lt;/li&gt;&#xA;&lt;li&gt;This might be a dumb question, but am I actually supposed to go to &quot;example.com/admin&quot;? If so, I receive an &quot;XML parsing error: not well&#xA;formed&quot; when I try that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I probably missed some details that would be helpful to know, so please let me know if you need any further info. Help on this would be greatly appreciated... I want to compare Craft and WordPress but that's difficult when I can't get Craft running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Brad's comment about multiple PHP installations prompted me to uninstall and reinstall PHP alone. I had uninstalled and reinstalled everything at some point, but not just PHP. After a purge and fresh installation, and remembering to install libapache2-mod-php7.0, I FINALLY see the craft installation page. Thank you guys for your help!&lt;/p&gt;&#xA;" OwnerUserId="6926" LastEditorUserId="6926" LastEditDate="2017-06-29T15:56:10.943" LastActivityDate="2017-06-29T15:56:10.943" Title="White screen trying to install, log shows call to undefined function ctype_alpha()" Tags="&lt;php&gt;&lt;install&gt;&lt;white-screen&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21006" PostTypeId="1" AcceptedAnswerId="22132" CreationDate="2017-06-28T21:15:38.280" Score="1" ViewCount="223" Body="&lt;p&gt;I've not managed to find any complete example of a custom mapping plugin for Search Plus—I'm wondering if anyone could steer me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a nutshell what I'm wanting to do is to modify the standard Search Plus mapping to include the &lt;code&gt;section handle&lt;/code&gt;. I think this is the function I need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function searchPlus_alterBasicItemMapping($mappedData, $orginalElement)&#xA;{&#xA;    $mappedData[&quot;sectionHandle&quot;] = $section-&amp;gt;handle;&#xA;    return $mappedData;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I have no idea where to put it and how to get it to talk to the plugin...&lt;/p&gt;&#xA;" OwnerUserId="5215" LastActivityDate="2017-09-27T10:00:53.140" Title="Search Plus Custom Mapping" Tags="&lt;plugin-development&gt;&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21007" PostTypeId="2" ParentId="20995" CreationDate="2017-06-28T22:08:06.163" Score="0" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20995/how-to-create-an-entry-from-plugin-controller#comment28156_20995&quot;&gt;Damon mentions&lt;/a&gt;, I'd highly recommend checking out the Guest Entries plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically the private &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20995/how-to-create-an-entry-from-plugin-controller#comment28156_20995&quot;&gt;&lt;code&gt;_populateEntryModel()&lt;/code&gt;&lt;/a&gt; method which creates the &lt;code&gt;EntryModel&lt;/code&gt; class and gives a good example of the properties that are necessary to set to before calling &lt;code&gt;EntriesService-&amp;gt;saveEntry()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-28T22:08:06.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21008" PostTypeId="2" ParentId="20983" CreationDate="2017-06-28T22:12:41.683" Score="2" Body="&lt;p&gt;Thank you for pointing me in the right direction! That was super helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I ended with so far. Things may change depending on what I need down the road. It uses &lt;code&gt;Basic Auth&lt;/code&gt; like I mentioned in the original post. The main thing I wanted was to be able to pass the URL as a parameter so I could use the same function to get various &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a plugin, like you mentioned. I ended up putting my code in the Variable.php file...not sure if that's how you're supposed to do it or not.&#xA;I found a plugin called Guzzle (&lt;a href=&quot;https://github.com/davist11/craft-guzzle&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/davist11/craft-guzzle&lt;/a&gt;) and most of it was taken from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TheaterVariable.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class TheaterVariable {&#xA;&#xA;    public function get($options){&#xA;&#xA;        $url = $options['url'];&#xA;        $limit = array_key_exists('limit', $options) ? NumberHelper::makeNumeric($options['limit']) : null;&#xA;        $offset = array_key_exists('offset', $options) ? NumberHelper::makeNumeric($options['offset']) : 0;&#xA;&#xA;        try {&#xA;&#xA;            //API Credentials&#xA;            $login = 'USERNAME';&#xA;            $password = 'PASSWORD';&#xA;&#xA;            $client = new \Guzzle\Http\Client();&#xA;            $request = $client-&amp;gt;get($url);&#xA;&#xA;            //cURL Options for Basic Authentication&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_RETURNTRANSFER, true);&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_USERPWD, &quot;$login:$password&quot;);&#xA;&#xA;            $response = $request-&amp;gt;send();&#xA;&#xA;            if (!$response-&amp;gt;isSuccessful()) {&#xA;                return;&#xA;            }&#xA;&#xA;            $items = $response-&amp;gt;json();&#xA;&#xA;            $items = array_slice($items, $offset, $limit);&#xA;&#xA;            return $items;&#xA;&#xA;        } catch (Exception $e) {&#xA;&#xA;            return;&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my template I am able to set the URL to whatever I need it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_entry.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set showtimes = craft.theater.get({ url: 'http://api-domain.com/showtimes.json' }) %}&#xA;{% for show in showtimes.data %}&#xA;    &amp;lt;h1&amp;gt;{{ show.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6216" LastActivityDate="2017-06-28T22:12:41.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21009" PostTypeId="2" ParentId="20980" CreationDate="2017-06-29T01:28:20.100" Score="1" Body="&lt;p&gt;It would probably be best to make your own shipping adjuster. I have attached an example plugin here: &lt;a href=&quot;http://jmp.sh/wC95ZPj&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jmp.sh/wC95ZPj&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adjuster plugin I have linked can look at the weight of the cart, it's line item contents, and then reduce (or add to) the shipping costs after the regular shipping calculations are run.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-06-29T01:55:00.777" LastActivityDate="2017-06-29T01:55:00.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21010" PostTypeId="1" CreationDate="2017-06-29T08:26:16.803" Score="1" ViewCount="256" Body="&lt;p&gt;I am running Craft 2 under MAMP (PHP 7.0.9) on windows and have a site that works under it. However if I use GIT to cd to the yiic console folder...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/c/mamp/htdocs/website/craft/app/etc/console&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... and type ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;php yiic help&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... I get an error message ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Uncaught Error: Class 'Craft\ErrorHandler' not found in C:\MAMP\htdocs\website\craft\app\framework\YiiBase.php:213&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... However, if I use PHP 5.6 (the one that I use to run the site - and which therefore has a different php.ini) I get a different message ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... even though the database settings must be OK as Craft works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get yiic to work?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS: I have put some debugging into &lt;code&gt;console\yiic.php&lt;/code&gt; and the paths that are getting returned match what I would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also looked at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12557/error-connecting-to-mamp-pro-database-in-console-command&quot;&gt;Error Connecting To (MAMP Pro) Database in Console Command&lt;/a&gt; but the modification it suggests to &lt;code&gt;craft/config/db.php&lt;/code&gt; refers to a file that does not exist: mysql.sock&lt;/p&gt;&#xA;" OwnerUserId="6929" LastEditorUserId="57" LastEditDate="2017-06-29T20:38:01.520" LastActivityDate="2017-06-29T20:38:01.520" Title="Running console (yiic) under MAMP (Windows)" Tags="&lt;yiic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21011" PostTypeId="1" AcceptedAnswerId="21014" CreationDate="2017-06-29T08:28:25.400" Score="2" ViewCount="1010" Body="&lt;p&gt;I'd like to add my site's favicon to the admin part of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to do this using the &quot;Site icon&quot; option under general settings. That adds the icon to the sidebar but not as a favicon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I've found that works so far is by editing the CP's base layout template and adding it there, but that's obviously a bad idea, as that will get overwritten on update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone found another way to fix this?&lt;/p&gt;&#xA;" OwnerUserId="5206" LastEditorUserId="57" LastEditDate="2017-06-29T17:47:07.503" LastActivityDate="2020-09-24T22:56:54.627" Title="Favicon in Control Panel" Tags="&lt;control-panel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21012" PostTypeId="1" CreationDate="2017-06-29T08:54:38.813" Score="1" ViewCount="517" Body="&lt;p&gt;I'm a bit confused by the notifications set-up in Freeform. The instructions state 'The notification template used to send an email to the email value entered into this field (optional).' I selected the template and entered an email address in the field below, but an email notification is sent to the user of the form as well as the administrator following a submission. So how do I set up a notification to send to admin only? And if I wanted to create a separate notification for the user, how do I do that?&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="6614" LastEditDate="2017-06-30T13:38:43.597" LastActivityDate="2019-01-21T05:44:48.453" Title="Solspace FreeForm notifications" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21013" PostTypeId="2" ParentId="20040" CreationDate="2017-06-29T10:23:12.007" Score="6" Body="&lt;p&gt;Listen for the &lt;code&gt;onBeforeOrderComplete&lt;/code&gt; event and do something like this (replacing values to match your setup).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event){&#xA;    $order = $event-&amp;gt;params['order'];&#xA;    if ($order-&amp;gt;paymentMethodId == 2)&#xA;    {&#xA;        $order-&amp;gt;orderStatusId = 3;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="379" LastActivityDate="2017-06-29T10:23:12.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21014" PostTypeId="2" ParentId="21011" CreationDate="2017-06-29T12:53:37.820" Score="2" Body="&lt;p&gt;If you have a favicon.ico at the base level of your public site I think that should do it. All I can tell you is that this is what works for me.&lt;/p&gt;&#xA;" OwnerUserId="349" LastEditorUserId="57" LastEditDate="2017-06-29T17:47:17.850" LastActivityDate="2017-06-29T17:47:17.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21015" PostTypeId="2" ParentId="21010" CreationDate="2017-06-29T15:14:59.997" Score="1" Body="&lt;p&gt;I may have found my own solution. It looks as if Yiic was not picking up the .env file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file ... craft\app\etc\console\yiic .. must therefore be changed from ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env php&#xA;&amp;lt;?php&#xA;require_once(dirname(__FILE__).'/yiic.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... to ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env php&#xA;&amp;lt;?php&#xA;require_once('../../../../vendor/autoload.php');&#xA;try {&#xA;    $dotenv = new Dotenv\Dotenv('../../../../');&#xA;    $dotenv-&amp;gt;load();&#xA;    $dotenv-&amp;gt;required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS']);&#xA;} catch (Exception $e) {&#xA;    exit('Could not find a .env file.' . $e);&#xA;}&#xA;require_once(dirname(__FILE__).'/yiic.php');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this is of use to other people.&lt;/p&gt;&#xA;" OwnerUserId="6929" LastActivityDate="2017-06-29T15:14:59.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21017" PostTypeId="1" AcceptedAnswerId="21026" CreationDate="2017-06-29T17:06:06.230" Score="1" ViewCount="184" Body="&lt;p&gt;I've got a plugin where I've written a simple recursive array search to find an array within a nested/multidimensional array which contains a certain value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function arraySearch($haystack,$needle,$depth = 1)&#xA;{&#xA;    foreach($haystack AS $key =&amp;gt; $value) {&#xA;        if (is_array($value) &amp;amp;&amp;amp; array_key_exists('title',$value) &amp;amp;&amp;amp; strtolower($value['title']) == strtolower($needle)) {&#xA;            return $value;&#xA;        } elseif(is_array($value)) {&#xA;            $depth++;&#xA;            $this-&amp;gt;arraySearch($value,$needle,$depth);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With some logging within this function I can see that it works and returns at the correct time but when I call it in my plugin methods the response is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I wanted to get an array which contains a &lt;code&gt;title&lt;/code&gt; key and the value for this is &lt;code&gt;venue&lt;/code&gt;, I'd type: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$result = $this-&amp;gt;arraySearch($array,'Venue');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Applied to the following array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array&#xA;(&#xA;    [pages] =&amp;gt; Array&#xA;        (&#xA;            [0] =&amp;gt; Array&#xA;                (&#xA;                    [elements] =&amp;gt; Array&#xA;                        (&#xA;                            [0] =&amp;gt; Array&#xA;                                (&#xA;                                    [type] =&amp;gt; text&#xA;                                    [isRequired] =&amp;gt; 1&#xA;                                    [name] =&amp;gt; question1&#xA;                                    [title] =&amp;gt; Venue&#xA;                                )&#xA;&#xA;                            [1] =&amp;gt; Array&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this should return the array &lt;code&gt;$array['pages'][0]['elements][0]&lt;/code&gt; but $result` seems to be empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2017-06-29T20:40:14.700" LastActivityDate="2017-06-30T12:20:51.330" Title="Recursive array search" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;array&gt;&lt;function&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21019" PostTypeId="1" AcceptedAnswerId="21037" CreationDate="2017-06-30T01:27:14.453" Score="1" ViewCount="181" Body="&lt;p&gt;I am attempting to make one of my sections use auto-generated titles. I am making my first entry with a title like &lt;code&gt;8000&lt;/code&gt;. What I need is the second entry to be titled &lt;code&gt;8001&lt;/code&gt;, the third &lt;code&gt;8002&lt;/code&gt;, etc. &lt;strong&gt;Each entry must have a unique title in sequence.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is the Title Format I tried using:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.entries.section('scripts').last().title + 1 }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a test entry after that and it successfully generated a title similar to the last entry plus one. &lt;strong&gt;However&lt;/strong&gt;, when I created a second test entry, the title remained the same as the first test entry, but the slug was &lt;code&gt;titlexx-1&lt;/code&gt;. I made another test entry, same thing, with the slug &lt;code&gt;titlexx-2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing in my Title Format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-07-08T02:35:56.060" Title="Auto-generated title based on last entry" Tags="&lt;titles&gt;&lt;auto-generate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21020" PostTypeId="1" CreationDate="2017-06-30T07:08:09.280" Score="1" ViewCount="60" Body="&lt;p&gt;I have two locales (de, en) and a set of entries. Some have only the german locale enabled, some only the english one. Some have both enabled. Those entries have a status of &quot;live&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to achieve: When I’m on the english locale for example, all entries should be listed. If an entry is not available in the english locale, show the german one instead (or the disabled english one, if that would be possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'mySection',&#xA;    localeEnabled: false&#xA;}) %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this list only shows the entries for the current locale, but not for other locales. I can’t set &lt;code&gt;status: null&lt;/code&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/a/19795/1056&quot;&gt;like mentioned in this thread&lt;/a&gt;, because I only want entries to show up that are set to &quot;live&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints? Or is it just not possible without setting &lt;code&gt;status: null&lt;/code&gt;? I’m on Craft 2.6.2985.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively I could query for one locale first, then for the other one and merge the results. But that seems not very desirable for this rather simple need.&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-06-30T07:08:09.280" Title="List entries from different locales using localeEnabled" Tags="&lt;localization&gt;&lt;entry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21021" PostTypeId="1" AcceptedAnswerId="21038" CreationDate="2017-06-30T07:53:15.930" Score="2" ViewCount="43" Body="&lt;p&gt;First time here so excuse me if I get the etiquette and protocols wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to pull eight featured stories into a page, the first two into a large two column grid and the rest into a three column grid.  Try as I may I can not get this to work... I have searched around here for various solutions but none seem to be exactly what I am trying to achieve, or I have the know how to adapt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to exclude the first two entries from the second section but want the whole display to be random. I am guessing the array string of ids() is not being parsed or set up correctly but frankly I am a bit lost so any help would be very much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I think this is the closest I have come.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row small-up-1 medium-up-2&quot;&amp;gt;&#xA;    {% set featuredStories = craft.entries.section('work').type('projects') %}&#xA;    {% set big = featuredStories.order('RAND()').limit(2) %}&#xA;&#xA;    {% for entry in big %}&#xA;        &amp;lt;— stuff —&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% set bigIds = big.ids() %}&#xA;{% set bigIdsString = bigIds | join(', not ') %}&#xA;&#xA;{% set allEntries = featuredStories.id('and, not '~bigIdsString) %}&#xA;&#xA;&amp;lt;div class=&quot;row small-up-2 medium-up-3&quot;&amp;gt;&#xA;    {% for entry in allEntries %}&#xA;        &amp;lt;— stuff —&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6910" LastEditorUserId="57" LastEditDate="2017-06-30T19:33:30.693" LastActivityDate="2017-06-30T19:53:21.537" Title="Excluding previous entries" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21022" PostTypeId="2" ParentId="21017" CreationDate="2017-06-30T10:37:11.130" Score="0" Body="&lt;p&gt;Check out the ArrayHelper class that comes with Yii and is extended by Craft. It may very well do all that you need&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hmmmm never mind that might be Craft 3&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2017-06-30T10:44:53.267" LastActivityDate="2017-06-30T10:44:53.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21024" PostTypeId="1" AcceptedAnswerId="21027" CreationDate="2017-06-30T11:14:21.503" Score="1" ViewCount="237" Body="&lt;p&gt;I have a Structure Section called 'products' which uses two EntryTypes, one for 'Product Type Overview' and one for 'Individual Products', where 'Individual Products' are the children of 'Product Type Overview'.  Some 'products' have children and some do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a menu which then lists the top level entries, so in most cases the user selects 'Product A' they see a list of items (variations) belonging to 'Product A', they then click on an item to see more information about that particular product variation. -  This I have done without a problem using &lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;this method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my problem...  If the user selects a product that DOES NOT have variations (children) I need them to go straight to the child template and miss the parent 'Overview' template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2017-07-03T08:53:03.167" Title="Redirect to another EntryType template if no Children exist" Tags="&lt;templating&gt;&lt;structure&gt;&lt;redirect&gt;&lt;entry-type&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21025" PostTypeId="2" ParentId="21024" CreationDate="2017-06-30T11:52:15.923" Score="2" Body="&lt;p&gt;It might be easier to have the products point to the same template, then create two sub-templates that you include depending on the entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a template called &lt;code&gt;landing/pages/_entry.html&lt;/code&gt; that contains the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;landing-pages/_entryTypes/_&quot; ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with several sub-templates named after the respective entry types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could probably use &lt;code&gt;hasDescendants&lt;/code&gt; (&lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#hasDescendants&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;) but in my experience it's more forgiving when go by entry type.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-06-30T11:52:15.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21026" PostTypeId="2" ParentId="21017" CreationDate="2017-06-30T12:20:51.330" Score="2" Body="&#xA;&#xA;&lt;p&gt;This line:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;arraySearch($value,$needle,$depth);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return $this-&amp;gt;arraySearch($value,$needle,$depth);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-06-30T12:20:51.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21027" PostTypeId="2" ParentId="21024" CreationDate="2017-06-30T14:14:16.040" Score="3" Body="&lt;p&gt;Fixed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;So bearing in mind i'm using this method to load templates according to entry type&lt;/a&gt;, Clive Portman's answer got me thinking about hasDescendants.  In my _entry.html I now have something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hasDescendants() %}&#xA;  {% include &quot;products/_types/secType_categoryGroupOverview.html&quot; %}&#xA;{% else %}&#xA;  {% include &quot;products/_types/secType_productSpecification.html&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and it seems to work as required :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously happy to hear of any more elegant solutions.&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="167" LastEditDate="2017-07-03T08:53:03.167" LastActivityDate="2017-07-03T08:53:03.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21028" PostTypeId="2" ParentId="21024" CreationDate="2017-06-30T14:42:33.617" Score="2" Body="&lt;p&gt;I agree with the other answers that your best solution is to just render a different template and don't do a redirect. But, if you do find a more applicable use later, you can do in-template redirects like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.hasDescendants() %}&#xA;  {% redirect '/your/product/url' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do this, it's recommended that you do it as high in the template as possible, so you hit the redirect before the server does more work than it has to.&lt;/p&gt;&#xA;" OwnerUserId="6934" LastActivityDate="2017-06-30T14:42:33.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21029" PostTypeId="1" CreationDate="2017-06-30T14:56:25.177" Score="3" ViewCount="3000" Body="&lt;p&gt;I have run into a problem of file sizes maxing out on 256MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On PHP side I have&lt;/strong&gt;&lt;br&gt;&#xA;&lt;code&gt;upload_max_filesize&lt;/code&gt; &amp;amp; &lt;code&gt;post_max_size&lt;/code&gt; set to &lt;code&gt;1GB&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a simple PHP script to test upload size and managed to upload 800MB file. So everything points to Craft having some limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft CMS config file I have:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'maxUploadFileSize'     =&amp;gt; 1073741824&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yet if I try to upload files larger than 256MB I get a modal message saying file size exceeds 256MB.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="57" LastEditDate="2017-06-30T21:16:26.320" LastActivityDate="2017-06-30T21:16:26.320" Title="Upload file size limits to 256MB" Tags="&lt;assets&gt;&lt;config&gt;&lt;php&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21030" PostTypeId="1" CreationDate="2017-06-30T16:18:00.513" Score="2" ViewCount="187" Body="&lt;p&gt;So I'm trying to loop through some entries and order them by in a specific way. For an example let's say I have the following entires:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Example01&lt;/li&gt;&#xA;&lt;li&gt;Example02&lt;/li&gt;&#xA;&lt;li&gt;Example03&lt;/li&gt;&#xA;&lt;li&gt;Example04&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I now want to loop through these entries and order them in an order such as: Example03, Example01, Example04 and Example2. The order has to be custom where I can change it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible and if so how can I achieve this? Thanks&lt;/p&gt;&#xA;" OwnerUserId="6935" LastActivityDate="2017-06-30T18:12:49.357" Title="For loop with custom order" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21032" PostTypeId="1" AcceptedAnswerId="21040" CreationDate="2017-06-30T16:41:16.250" Score="1" ViewCount="62" Body="&lt;p&gt;I have a Craft plugin that works fine on a live site and on Macs. I have recently installed MAMP (Windows) on my development machine and now, when I try to run one of the plugins commands by using GIT to CD to the Yiic console ... /c/mamp/htdocs/websitename/craft/app/etc/console ... and run the command ... php yiic pluginname commandname ... I get the error message ... Encountered an error running task 700 (plugin_task): Could not find the task component type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am pretty sure that the problem is that the task file is not being found, but I think I have the upper/lower case elements correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\pluginname\consolecommands\PluginnameCommand.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class PluginnameCommand extends BaseCommand&#xA;{&#xA;  public function actionUpdate($testError = false)&#xA;  {&#xA;      $task = craft()-&amp;gt;tasks-&amp;gt;createTask('pluginname_event', 'Updating data', [&#xA;            'testError' =&amp;gt; $testError,&#xA;      ]);&#xA;      craft()-&amp;gt;tasks-&amp;gt;runTask($task);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;\pluginname\tasks\Pluginname_EventTask.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Pluginname_EventTask extends BaseTask&#xA;{&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have I the cases wrong, or am I missing something in setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is a followup to ... &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21010/running-console-yiic-under-mamp-windows&quot;&gt;Running console (yiic) under MAMP (Windows)&lt;/a&gt; ... which was a path problem solved by modifying the yiic file.&lt;/p&gt;&#xA;" OwnerUserId="6929" LastEditorUserId="57" LastEditDate="2017-06-30T21:05:03.480" LastActivityDate="2017-06-30T21:07:34.797" Title="Plugin - Possible path problem in MAMP - Could not find the task component type" Tags="&lt;yiic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21034" PostTypeId="2" ParentId="21030" CreationDate="2017-06-30T18:12:49.357" Score="2" Body="&lt;p&gt;You have a few options here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use an Entries field (as a Global or as a fields on a Single maybe?) to chose the entries and order them&lt;/li&gt;&#xA;&lt;li&gt;Make the Entries a Structure section, so you can set the order&lt;/li&gt;&#xA;&lt;li&gt;use &lt;code&gt;craft.entries({ ids: [3, 1, 2], fixedOrder: true })&lt;/code&gt; and query the Entries by ID (if they'll never be deleted and you're cool with hard-coding the order)&lt;/li&gt;&#xA;&lt;li&gt;create an &lt;code&gt;order&lt;/code&gt; field on that entry type to query them by, also with &lt;code&gt;craft.entries()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's up to you what the best solution would be, given your set-up, but you have plenty of options.&lt;/p&gt;&#xA;" OwnerUserId="6934" LastActivityDate="2017-06-30T18:12:49.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21035" PostTypeId="1" CreationDate="2017-06-30T18:26:34.757" Score="1" ViewCount="103" Body="&lt;p&gt;I am developing the plugin to send user difference confirmation email which more than 20. I put those fields in templates/settings.html so that the admin could change and update the message content. However, after I put more 3 textareaFields, I only able to see 3 Textarea display on the setting page. The 4th one does not show up. Does anyone know how to solve that issue? Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0xoq8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0xoq8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textareaField({&#xA;    label: &quot;Customer Account Creation Confirmation Message&quot;|t,&#xA;    instructions: &quot;Customer email message when customer register&quot; |t,&#xA;    name: 'custAccountCreation',&#xA;    value: settings.custAccountCreation,&#xA;    rows:5,&#xA;})}}&#xA;&#xA;{{ forms.textareaField({&#xA;label: &quot;Customer Account Appointment Confirmation Message&quot;|t,&#xA;instructions: &quot;Customer email message when customer appointment confirmed&quot; |t,&#xA;name: 'custApptConfirmed',&#xA;value: settings.custApptConfirmed,&#xA;rows:5,&#xA;})}}&#xA;&#xA;{{ forms.textareaField({&#xA;label: &quot;Customer Appointment Reminder with Vet Identification&quot;|t,&#xA;instructions: &quot;Customer Appointment Reminder with Vet Identification&quot; |t,&#xA;name: 'custApptReminder',&#xA;value: settings.custApptReminder,&#xA;rows:5,&#xA;})}}&#xA;&#xA;{{ forms.textareaField({&#xA;label: &quot;Customer Appointment Reminder with Vet Identification1&quot;|t,&#xA;instructions: &quot;Customer Appointment Reminder with Vet Identification1&quot; |t,&#xA;name: 'custApptReminder1',&#xA;value: settings.custApptReminder1,&#xA;rows:5,&#xA;})}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-07-02T11:53:59.873" Title="Only see 3 textarea field on Plugin Setting Page" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21036" PostTypeId="2" ParentId="21029" CreationDate="2017-06-30T19:10:40.980" Score="2" Body="&lt;p&gt;Apparently, Craft requires &lt;code&gt;memory_limit&lt;/code&gt; to also be set to max value, so setting &lt;code&gt;memory_limit&lt;/code&gt; in &lt;code&gt;php.ini&lt;/code&gt; did solve my problem.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="57" LastEditDate="2017-06-30T21:11:44.607" LastActivityDate="2017-06-30T21:11:44.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21037" PostTypeId="2" ParentId="21019" CreationDate="2017-06-30T19:31:02.330" Score="1" Body="&lt;p&gt;Something like this should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not object.id %}{{ craft.entries.section('scripts').order('postDate DESC').first().title + 1 }}{% else %}{{ object.title }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-07-08T02:35:56.060" LastActivityDate="2017-07-08T02:35:56.060" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21038" PostTypeId="2" ParentId="21021" CreationDate="2017-06-30T19:53:21.537" Score="1" Body="&lt;p&gt;I'd probably try is something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row small-up-1 medium-up-2&quot;&amp;gt;&#xA;    {# Grab all (8) stories in a random order #}&#xA;    {% set allStories = craft.entries.section('work').type('projects').order('RAND()').find() %}&#xA;&#xA;    {# Now loop through only the first two items in the array #}&#xA;    {% for entry in allStories|slice(0, 2) %}&#xA;        &amp;lt;— stuff —&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;row small-up-2 medium-up-3&quot;&amp;gt;&#xA;    {# Now loop through items 3-8 in the array. #}&#xA;    {% for entry in allStories|slice(2, 6) %}&#xA;        &amp;lt;— stuff —&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Documentation for the Twig &lt;code&gt;slice()&lt;/code&gt; method can be found here: &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.sensiolabs.org/doc/2.x/filters/slice.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-30T19:53:21.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21039" PostTypeId="1" AcceptedAnswerId="21043" CreationDate="2017-06-30T20:17:06.740" Score="1" ViewCount="105" Body="&lt;p&gt;I'm trying to return entries based on some criteria. I exclude entries with a given value like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set someEntries = craft.entries({&#xA;    level: 1,&#xA;    id: '1,2,3,4,5',&#xA;    myOtherField: 'not blue'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't work if I try to exclude by multiple values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set someEntries = craft.entries({&#xA;    level: 1,&#xA;    id: '1,2,3,4,5',&#xA;    myOtherField: 'not blue and not green'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not in &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt; and I've tried a few different syntax but had no luck.&lt;/p&gt;&#xA;" OwnerUserId="6936" LastEditorUserId="6936" LastEditDate="2017-06-30T21:02:24.763" LastActivityDate="2017-06-30T21:33:47.200" Title="Using AND with craft.entries()" Tags="&lt;entries&gt;&lt;conditional&gt;&lt;params&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21040" PostTypeId="2" ParentId="21032" CreationDate="2017-06-30T21:07:34.797" Score="0" Body="&lt;p&gt;My guess is it's a case sensitivity issue between your plugin class names and the names of those files on the file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on an NTFS filesystem on Windows, it is case sensitive.  I recommend generating boilerplate plugin code from something like &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; (they even have a tasks checkbox) to help avoid issues like this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-30T21:07:34.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21041" PostTypeId="1" AcceptedAnswerId="21108" CreationDate="2017-06-30T21:08:50.283" Score="1" ViewCount="387" Body="&lt;p&gt;I have an entries field 'physicians'. I want to output the selections from that field and sort them by category (also named 'physicians') - with the category heading above each category group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out if I should just output the category list and filter the result by the field or if I should output the entries field and then sort them by category. I'm trying the latter right now but not sure of how to get the categories to work. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set phyGroup = craft.categories.group('physicians') %}&#xA;{% set phyList = craft.entries.relatedTo('physicians').order('lastName asc') %}&#xA;&#xA;{% for physicians in phyGroup %}&#xA;   &amp;lt;h3&amp;gt;{{ category }}&amp;lt;/h3&amp;gt;&#xA;   {% for entry in phyList %}&#xA;      {{ entry.lastName }} ...&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastActivityDate="2017-07-07T14:01:58.027" Title="Sorting Entries field results by category" Tags="&lt;categories&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21042" PostTypeId="2" ParentId="21029" CreationDate="2017-06-30T21:16:12.947" Score="4" Body="&lt;p&gt;When determining the maximum upload file size, Craft &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/AppVariable.php#L209-L230&quot; rel=&quot;nofollow noreferrer&quot;&gt;first takes&lt;/a&gt; the php.ini file &lt;code&gt;upload_max_filesize&lt;/code&gt;, &lt;code&gt;post_max_size&lt;/code&gt; and &lt;code&gt;memory_limit&lt;/code&gt; into account by getting the minimum value and only then applying the Craft &lt;a href=&quot;https://craftcms.com/docs/config-settings#maxUploadFileSize&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;maxUploadFileSize&lt;/code&gt;&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-30T21:16:12.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21043" PostTypeId="2" ParentId="21039" CreationDate="2017-06-30T21:33:47.200" Score="1" Body="&lt;p&gt;This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set someEntries = craft.entries({&#xA;    level: 1,&#xA;    id: '1,2,3,4,5',&#xA;    myOtherField: 'and, not blue, not green'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-06-30T21:33:47.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21045" PostTypeId="1" AcceptedAnswerId="21118" CreationDate="2017-07-01T10:03:21.797" Score="1" ViewCount="1336" Body="&lt;p&gt;I'm accessing my site through a local IP address (192.168.1.128:3000 that mirrors xxx.dev)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php I have these settings which work fine when accessed through IP =&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vcQtQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vcQtQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then request for 2 image transforms (one non-retina, the other retina):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LkPCf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LkPCf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I check the rendered source code in the browser, I notice that only my retina (big format) doesn't have the IP address in it's path, how is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AGWAQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AGWAQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't that big of an issue on my desktop because it will always find the xxx.dev, but when I try to test the site on my iPhone - through the IP address - it doesn't render the retina image because it can't find the xxx.dev&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on this one? Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2017-07-06T21:41:51.500" Title="Access site via local dev IP address =&gt; certain image path (xxx.dev) isn't replaced with IP address" Tags="&lt;ip-address&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21046" PostTypeId="1" AcceptedAnswerId="21047" CreationDate="2017-07-01T20:56:36.200" Score="1" ViewCount="791" Body="&lt;p&gt;I've created two global variables which my content creator is going to use to turn off a bunch of articles and turn on a bunch more which a slight change in the Global.  I have a page where there is a limit of 5 of these articles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').order('articleOrder desc').limit(5).find() %}&#xA;&#xA;{% for entry in entries if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 %}&#xA;    &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;          &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with this is that the conditional only gets 5 entries to compare, and not the entire bunch. I want to first run an if statement on all the entries, then let me do a for loop with a .limit(5). I am not sure how to go about this. A conditional combined with a for loop in the same statement did not work either.&lt;/p&gt;&#xA;" OwnerUserId="6441" LastEditorUserId="57" LastEditDate="2017-07-02T00:20:31.593" LastActivityDate="2017-07-02T00:28:06.813" Title="For loop, if statement, then limit" Tags="&lt;conditional&gt;&lt;forloop&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21047" PostTypeId="2" ParentId="21046" CreationDate="2017-07-02T00:28:06.813" Score="0" Body="&lt;p&gt;Entirely possible I'm misunderstanding what you're looking for, but I think something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('news').order('articleOrder desc').find() %}&#xA;{% set matchCount = 0 %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 and matchCount &amp;lt;= 5 %}&#xA;        {% set matchCount = matchCount + 1 %}&#xA;        &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;    {% endif %}          &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-02T00:28:06.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21049" PostTypeId="1" CreationDate="2017-07-02T07:41:43.293" Score="1" ViewCount="45" Body="&lt;p&gt;I'm displaying list of fields on frontend (using &lt;code&gt;craft.fields.getFieldsByGroupId&lt;/code&gt;) and for that purpose I need the fields in group to be in particular order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to add 'order' property to fields model and make them sortable in CP? I can't find appropriate hook (if it exists)&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2017-07-02T07:41:43.293" Title="Make fields sortable in CP" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;hook&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21050" PostTypeId="2" ParentId="21035" CreationDate="2017-07-02T11:53:59.873" Score="2" Body="&lt;p&gt;After shuffle all textareaField, I found the 4th one custApptReminder1 misspell in function defineSettings() at my plugin.php. After corrected it, the field is show up.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function defineSettings()&#xA;    {&#xA;        return array(&#xA;            'custAccountCreation' =&amp;gt; array(AttributeType::String),&#xA;            'custAccountCreationSubject' =&amp;gt; array(AttributeType::String),&#xA;            'custApptReminder'=&amp;gt; array(AttributeType::String),&#xA;            'custApptReminder1'=&amp;gt; array(AttributeType::String),&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-07-02T11:53:59.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21053" PostTypeId="1" CreationDate="2017-07-03T01:18:04.220" Score="1" ViewCount="189" Body="&lt;p&gt;I'm attempting to migrate customer orders from a Wordpress website using Woocommerce to an out-of-the-box install of Craft Pro + Craft Commerce. I've been able to export the user orders as a CSV file, so I'm in the process of converting them to JSON and using &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/getting-started/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; to get them into Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a slightly modified version of the example order template provided by the plugin. The purchaseableId values are set to products within the default Craft Commerce install (A New Toga and Romper for a Red Eye respectively.)  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    {&#xA;        &quot;@model&quot;: &quot;Commerce_OrderModel&quot;,&#xA;        &quot;attributes&quot;: {&#xA;            &quot;currency&quot;: &quot;USD&quot;,&#xA;            &quot;billingAddressId&quot;: &quot;6&quot;,&#xA;            &quot;shippingAddressId&quot;: &quot;7&quot;,&#xA;            &quot;shippingMethod&quot;: &quot;freeShipping&quot;,&#xA;            &quot;paymentMethodId&quot;: 1,&#xA;            &quot;customerId&quot;: 1,&#xA;            &quot;orderStatusId&quot;: 1,&#xA;            &quot;isCompleted&quot;: 1,&#xA;            &quot;dateOrdered&quot;: &quot;2017-07-02 01:08:38&quot;,&#xA;            &quot;datePaid&quot;: &quot;2017-07-02 01:09:38&quot;,&#xA;            &quot;returnUrl&quot;: &quot;/commerce/customer/order?number={number}&quot;,&#xA;            &quot;cancelUrl&quot;: &quot;/commerce/checkout/payment&quot;&#xA;        },&#xA;        &quot;content&quot;: {&#xA;            &quot;title&quot;: &quot;Test Order&quot;,&#xA;            &quot;fields&quot;: []&#xA;        },&#xA;        &quot;lineItems&quot;: [&#xA;            {&#xA;                &quot;purchasableId&quot;: &quot;5&quot;,&#xA;                &quot;qty&quot;: &quot;3&quot;,&#xA;                &quot;options&quot;: []&#xA;            },&#xA;            {&#xA;                &quot;purchasableId&quot;: &quot;9&quot;,&#xA;                &quot;qty&quot;: &quot;1&quot;,&#xA;                &quot;options&quot;: []&#xA;            }&#xA;        ],&#xA;        &quot;payments&quot;: {&#xA;            &quot;firstName&quot;: &quot;John&quot;,&#xA;            &quot;lastName&quot;: &quot;Doe&quot;,&#xA;            &quot;number&quot;: &quot;4929000000006&quot;,&#xA;            &quot;month&quot;: &quot;5&quot;,&#xA;            &quot;year&quot;: &quot;2017&quot;,&#xA;            &quot;cvv&quot;: &quot;123&quot;&#xA;        }&#xA;    }&#xA;] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to import the above JSON, Sprout Import seems to stall out indefinitely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I get some insight on what I'm doing wrong? Additionally, could someone provide a simple example of importing orders into Craft Commerce with Sprout Import?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastActivityDate="2017-11-13T20:18:10.623" Title="Importing User Orders into Craft Commerce with Sprout Import?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-sproutimport&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21054" PostTypeId="1" AcceptedAnswerId="21063" CreationDate="2017-07-03T04:51:32.680" Score="1" ViewCount="195" Body="&lt;p&gt;So I have a model attribute &lt;code&gt;attributeName&lt;/code&gt; with an &lt;code&gt;AttributeType::Number&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't implemented any personal validation rules yet, however when I run:&#xA;&lt;code&gt;model-&amp;gt;validate()&lt;/code&gt;, &#xA;its giving me a &lt;code&gt;&quot;attributeName must be an integer&quot;&lt;/code&gt; error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this just the default validation rule of the &lt;code&gt;AttributeType::Number&lt;/code&gt;?  and if so, is there anything I can do to make it accept floats?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to use this attribute for a price, I should note.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CNumberValidator&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNumberValidator&lt;/a&gt; has an &lt;code&gt;integerOnly&lt;/code&gt; attribute, so I tried setting &lt;code&gt;'integerOnly'=&amp;gt;false&lt;/code&gt; in the attribute declaration, to no avail. Not sure if its relevant, I think I might be grasping at straws. Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6514" LastActivityDate="2017-07-04T02:45:27.350" Title="AttributeType::Number giving validation error &quot;Must be an integer&quot;" Tags="&lt;validation&gt;&lt;models&gt;&lt;attributetype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21055" PostTypeId="1" CreationDate="2017-07-03T06:52:26.127" Score="2" ViewCount="138" Body="&lt;p&gt;I'm using the following multi-env config. My dev config works as expected. However, when I visit my staging site, it is setting the siteUrl to the production Url&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;&#xA;    // Dev URL&#xA;    $devUrl_au  = &quot;au-site.dev&quot;;&#xA;    $devUrl_nz  = &quot;nz-site.dev&quot;;&#xA;    $devUrl_us  = &quot;us-site.dev&quot;;&#xA;&#xA;    // Testing URL&#xA;    $testUrl_au = &quot;test.site.com.au&quot;;&#xA;    $testUrl_nz = &quot;test.site.nz&quot;;&#xA;    $testUrl_us = &quot;test.site.co&quot;;&#xA;&#xA;    // Production URL&#xA;    $liveUrl_au  = &quot;site.com.au&quot;;&#xA;    $liveUrl_nz  = &quot;site.nz&quot;;&#xA;    $liveUrl_us = &quot;site.co&quot;;&#xA;&#xA;    return [&#xA;        /***************************&#xA;        GLOBAL CONFIGURATION&#xA;        ***************************/&#xA;        '*' =&amp;gt; [&#xA;            'environmentVariables' =&amp;gt; [&#xA;                'assetUrl'  =&amp;gt; '/',&#xA;            ],&#xA;            'doAnalytics' =&amp;gt; false,&#xA;            'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;            'enableCsrfProtection' =&amp;gt; true,&#xA;        'siteRoutesSource' =&amp;gt; 'file',&#xA;        ],&#xA;        /***************************&#xA;        DEVELOPMENT&#xA;        ***************************/&#xA;        '.dev' =&amp;gt; [&#xA;            'devMode' =&amp;gt; true,&#xA;            'enableTemplateCaching' =&amp;gt; false,&#xA;        ],&#xA;        $devUrl_au =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_au'  =&amp;gt; 'http://' . $devUrl_au . '/',],&#xA;        ],&#xA;        $devUrl_nz =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_nz'  =&amp;gt; 'http://' . $devUrl_nz . '/', ],&#xA;        ],&#xA;        $devUrl_us =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_us'  =&amp;gt; 'http://' . $devUrl_us . '/', ],&#xA;        ],&#xA;        /***************************&#xA;        STAGING&#xA;        ***************************/&#xA;        $testUrl_au =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_au'  =&amp;gt; 'http://' . $testUrl_au . '/', ],&#xA;        ],&#xA;        $testUrl_nz =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_nz'  =&amp;gt; 'http://' . $testUrl_nz . '/', ],&#xA;        ],&#xA;        $testUrl_us =&amp;gt; [&#xA;            'siteUrl' =&amp;gt; [ 'en_us'  =&amp;gt; 'http://' . $testUrl_us . '/', ],&#xA;        ],&#xA;        /***************************&#xA;        PRODUCTION&#xA;        ***************************/&#xA;        $liveUrl_au =&amp;gt; [&#xA;            'doAnalytics' =&amp;gt; true,&#xA;            'siteUrl' =&amp;gt; [ 'en_au'  =&amp;gt; 'http://' . $liveUrl_au . '/', ],&#xA;        ],&#xA;        $liveUrl_nz =&amp;gt; [&#xA;            'doAnalytics' =&amp;gt; true,&#xA;            'siteUrl' =&amp;gt; [ 'en_nz'  =&amp;gt; 'http://' . $liveUrl_nz . '/', ],&#xA;        ],&#xA;        $liveUrl_us =&amp;gt; [&#xA;            'doAnalytics' =&amp;gt; true,&#xA;            'siteUrl' =&amp;gt; [ 'en_us'  =&amp;gt; 'http://' . $liveUrl_us . '/', ],&#xA;        ],&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="594" LastActivityDate="2017-07-03T07:22:09.223" Title="Production siteUrl being used in staging environment" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21056" PostTypeId="2" ParentId="21055" CreationDate="2017-07-03T07:22:09.223" Score="2" Body="&lt;p&gt;I found an existing solution to this. It turns out the order of the file matters and due to the &quot;partial-match&quot;, my siteUrl was being set to the staging url and then overriden with the production url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4535/proper-order-of-multi-environment-config&quot;&gt;Proper order of multi-environment config&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to use the solution outlined here&#xA;&lt;a href=&quot;https://craftcookbook.net/recipes/foolproof-multi-environment-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcookbook.net/recipes/foolproof-multi-environment-config&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="594" LastActivityDate="2017-07-03T07:22:09.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21057" PostTypeId="1" CreationDate="2017-07-03T10:09:29.820" Score="2" ViewCount="510" Body="&lt;p&gt;I've been trying to search for some instructions on how to build a multipage form using Freeform in Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The official documentation is very light on the subject; &lt;a href=&quot;https://solspace.com/craft/freeform/docs/multi-page-forms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/multi-page-forms/&lt;/a&gt; and there seems to be a general lack of information on the subject elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain the steps I need to take in order to create a multipage form? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form I'm creating is 2 pages in total. I need it to validate page 1 when the 'Next' button on page 1 is clicked, and then validate page 2 and submit the entire form when the 'Submit' button on page 2 is clicked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help or point me in the right direction to some information on the subject?&lt;/p&gt;&#xA;" OwnerUserId="4931" LastActivityDate="2017-10-01T14:15:50.270" Title="How to build a multipage form using Freeform?" Tags="&lt;form&gt;&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21058" PostTypeId="2" ParentId="20764" CreationDate="2017-07-03T13:49:21.837" Score="1" Body="&lt;p&gt;I found a better solution. I'm using the &lt;a href=&quot;https://github.com/mmikkel/CacheFlag-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;CacheFlag&lt;/a&gt; plugin which solves this problem. And it's very easy to add to existing code.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-07-04T12:09:16.180" LastActivityDate="2017-07-04T12:09:16.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21059" PostTypeId="1" CreationDate="2017-07-03T16:39:06.893" Score="1" ViewCount="145" Body="&lt;p&gt;I'm fairly new to CraftCMS and am stuck with a little filtering issue. I'm trying to filter a page of entries by a custom field. I'd like to use Ajax so there is no page reload. Here's how I have the filtering links setup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;#&quot; title=&quot;Entry Date&quot;&amp;gt;Entry Date&amp;lt;/a&amp;gt; //postDate asc&#xA;&amp;lt;a href=&quot;#&quot; title=&quot;Source Date&quot;&amp;gt;Source Date&amp;lt;/a&amp;gt; //sourceDate asc&#xA;&amp;lt;a href=&quot;#&quot; title=&quot;Scenario Date&quot;&amp;gt;Scenario Date&amp;lt;/a&amp;gt; //scenarioDate asc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both sourceDate and scenarioDate are text custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current template is setup like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;&#xA;{% paginate craft.entries.section('research').limit(12).order('sourceDate asc') as pageInfo, pageEntries %}&#xA;{% for entry in pageEntries %}&#xA;&#xA;// post entry code&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my thinking is that when a user clicks on one of the filtering links, the order would change, and reload the paginated entries based off the new order (postDate asc, sourceDate asc, scenarioDate asc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I'm really new to CraftCMS, I don't really know where to begin tackling this task. Any help is very appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6942" LastActivityDate="2017-07-03T16:39:06.893" Title="Need help with filtering entries by a custom field using ajax with pagination" Tags="&lt;categories&gt;&lt;filter&gt;&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21060" PostTypeId="1" AcceptedAnswerId="21061" CreationDate="2017-07-03T17:54:25.393" Score="1" ViewCount="22" Body="&lt;p&gt;I'm making some modifications to a custom plugin. I added a new attribute to one of the models and created a migration to add a new database column to hold that attribute. I updated the version number in my main plugin file and everything ran smoothly in my local environment. However in production I get &quot;an unknown error occured&quot; with no actual PHP errors or Craft errors being logged. This is after Craft tries to perform it's database updates (and tells me it went successfully).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running Craft 2.6.2982&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2017-07-03T17:54:25.393" Title="Site is inaccessible after updating plugin with new attribute/db column" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21061" PostTypeId="2" ParentId="21060" CreationDate="2017-07-03T17:54:25.393" Score="1" Body="&lt;p&gt;Adding &lt;code&gt;getSchemaVersion()&lt;/code&gt; to my main plugin file and returning a schema version did the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSchemaVersion()&#xA;{&#xA;    return '0.0.4';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2017-07-03T17:54:25.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21063" PostTypeId="2" ParentId="21054" CreationDate="2017-07-04T02:45:27.350" Score="1" Body="&lt;p&gt;Not really documented anywhere, but &lt;code&gt;AttributeType::Number&lt;/code&gt; can accept an array of options, including &lt;code&gt;min&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt; and &lt;code&gt;decimal&lt;/code&gt;.  You're looking for the last one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AttributeType::Number =&amp;gt; array('min' =&amp;gt; 0, 'max' =&amp;gt; 10, 'decimals' =&amp;gt; 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-04T02:45:27.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21064" PostTypeId="1" AcceptedAnswerId="21069" CreationDate="2017-07-04T03:11:55.607" Score="1" ViewCount="1004" Body="&lt;p&gt;I'm testing out the Craft 3 beta's multi-site capability at the moment to see if it's suitable for an upcoming project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sample scenario is a school that runs out of multiple countries. They offer the same courses, but may want to tailor the content for different countries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want different tutors assigned per site (country) to this course, we can't as an entries field (pulling from teachers section) is not translatable/multi site capable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We run into the same problem with using matrix fields for content. We generally have a general content matrix field that allows the client to build their content with different pre-defined blocks (side by side images, text with image, full width text, video etc. etc.). But matrix fields aren't translatable either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for images etc. There are a few other scenarios where this would raise its head just in this one example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this feature to be usable for how we use Craft, we'd need multi site support on those field types. Is this something that's coming or should I start thinking of another solution?&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="57" LastEditDate="2017-07-04T05:45:24.323" LastActivityDate="2017-07-04T13:35:57.550" Title="Craft 3 Multi Site - Entries/categories/assets fields aren't translatable?" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21066" PostTypeId="2" ParentId="952" CreationDate="2017-07-04T05:31:08.833" Score="4" Body="&lt;p&gt;For me the solution required was&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false&lt;/code&gt; in my &lt;code&gt;config/general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was debugging the site in Chrome and it was changing my user agent, which was instantly logging me out.&lt;/p&gt;&#xA;" OwnerUserId="6869" LastActivityDate="2017-07-04T05:31:08.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21067" PostTypeId="2" ParentId="952" CreationDate="2017-07-04T06:38:54.727" Score="2" Body="&lt;p&gt;Here's more on PHP sessions &amp;amp; Craft if it helps: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/the-case-of-the-missing-php-session&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Case of the Missing PHP Session&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-04T06:38:54.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21069" PostTypeId="2" ParentId="21064" CreationDate="2017-07-04T13:35:57.550" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If we want different tutors assigned per site (country) to this course, we can't as an entries field (pulling from teachers section) is not translatable/multi site capable.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;…&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Same for images etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All relational field types (Assets, Categories, Entries, Tags, and Users) have a “Manage relations on a per-site basis” setting (under Advanced). If you check it, each site will get its own set of relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iTPYM.png&quot; width=&quot;272&quot; height=&quot;118&quot; alt=&quot;The advanced settings for Entries fields&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But matrix fields aren't translatable either.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Same - Matrix fields have a “Manage blocks on a per-site basis” setting, right below the big Configuration setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nMwUq.png&quot; width=&quot;260&quot; height=&quot;47&quot; alt=&quot;Matrix setting&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-07-04T13:35:57.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21070" PostTypeId="1" AcceptedAnswerId="21076" CreationDate="2017-07-04T15:24:17.597" Score="1" ViewCount="533" Body="&lt;p&gt;I know Craft appends slugs with -1 if they already exist but I'm working on an app where the addition makes things awkward for us (we have to match the slug to a third-party service). I was under the impression they had to be unique but it seems you can edit an entry and change the slug to be the same as one that already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could be a good workaround for us, but I want to check whether it's a bug that's likely to get squashed or deliberate behaviour.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-07-05T00:30:18.857" Title="Do slugs absolutely have to be unique?" Tags="&lt;entrymodel&gt;&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21072" PostTypeId="1" AcceptedAnswerId="21077" CreationDate="2017-07-04T17:14:24.500" Score="1" ViewCount="84" Body="&lt;p&gt;When setting User Group permissions for users for Craft Commerce, there are explicit options for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Manage Orders&lt;/li&gt;&#xA;&lt;li&gt;Manage Products&lt;/li&gt;&#xA;&lt;li&gt;Manage Promotions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But nothing is listed for &lt;strong&gt;Manage Settings&lt;/strong&gt;. Is this not controllable for User Groups? Seems like it definitely should be... some users would be allowed to manage product info but not Settings, while some users would need access to Settings for updating Tax or Shipping options.&lt;/p&gt;&#xA;" OwnerUserId="781" LastActivityDate="2017-07-05T02:48:18.073" Title="Commerce Manage Settings for User Groups" Tags="&lt;plugin-craftcommerce&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21073" PostTypeId="2" ParentId="20963" CreationDate="2017-07-04T17:45:42.493" Score="1" Body="&lt;p&gt;Developer of Charge here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full details on the setup for Connect are detailed here : &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge/usage/reference/connect-setup&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://squarebit.co.uk/software/craft/charge/usage/reference/connect-setup&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting up a Charge to use Connect takes 4 broad steps - &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Configuring your Stripe Account, and Charge settings - this involves putting your platform keys into Charge, and the callback url(s) in to the Stripe settings &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adding the Charge Connect field to the elements you want to use as the parent elements for the connected accounts. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Updating your templates to reference these connected fields. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Actually connecting accounts to use - using the field you created in step 2. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From the sounds of it - the issue you're having is in either step 3, or 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing to look in is the Charge &gt; Logs - which will detail exactly what's happening, and why things aren't going to the connected accounts. It's almost certainly due to either the proper information isn't being passed through on the request (ie. a template issue) or an account issue (ie. the connected accounts aren't in the appropriate mode to accept payments) &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2017-07-04T17:45:42.493" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21074" PostTypeId="1" AcceptedAnswerId="21542" CreationDate="2017-07-04T21:45:37.367" Score="2" ViewCount="820" Body="&lt;p&gt;I would like to add tabs in setting page in my plugin. I have the following code in &lt;code&gt;/[myplugin]/templates/_setting.html&lt;/code&gt;. However, the tabs do not show up, does anyone have any sample code to set up the tabs? Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set tabs = {&#xA;customer: { label: &quot;Customer&quot;|t, url: url('emailUser/_settings') },&#xA;veterinarian:    { label: &quot;Veterinarian&quot;|t, url: url('emailUser/_vetSettings') }&#xA;} %}&#xA;&#xA;{{ forms.textField({&#xA;label: &quot;Customer Account Creation Confirmation Subject&quot;|t,&#xA;instructions: &quot;Customer Account Creation Confirmation Subject&quot; |t,&#xA;name: 'custAccountCreationSubject',&#xA;value: settings.custAccountCreationSubject,&#xA;})}}&#xA;&#xA;{{ forms.textareaField({&#xA;label: &quot;Customer Account Creation Confirmation Message&quot;|t,&#xA;instructions: &quot;Customer email message when customer register&quot; |t,&#xA;name: 'custAccountCreation',&#xA;value: settings.custAccountCreation,&#xA;rows:10,&#xA;})}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;myplugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('emailuser/_settings',array(&#xA;                'settings'=&amp;gt;$this-&amp;gt;getSettings()&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="3951" LastEditDate="2017-08-10T22:15:03.220" LastActivityDate="2017-11-26T14:23:15.593" Title="Set tabs in settings on Plugin" Tags="&lt;plugin-development&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21075" PostTypeId="1" AcceptedAnswerId="21078" CreationDate="2017-07-04T23:39:36.257" Score="1" ViewCount="67" Body="&lt;p&gt;I managed to make an entry type that won't let me create any entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is for a rock band, and the entry type in question is called &quot;Shows&quot;. It contains five fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Venue&lt;/li&gt;&#xA;&lt;li&gt;Lineup&lt;/li&gt;&#xA;&lt;li&gt;Date&lt;/li&gt;&#xA;&lt;li&gt;Time&lt;/li&gt;&#xA;&lt;li&gt;Body&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Date and Time are Date/Time fields, Lineup and Body are standard text fields. Venue is the field that I think is causing the trouble.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Venue is an Entries field that lets you select one from several venues, which are entries in a separate section (a Structure) called Venues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I enter data for a show, I'm able to select from the list of venues. When I try to save the Show, however, I get an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Recoverable error: Object of class Craft\ElementCriteriaModel could not be converted to string.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The most meaningful looking highlighted line in the debug output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo $this-&amp;gt;getAttribute((isset($context[&quot;object&quot;]) ? $context[&quot;object&quot;] : $this-&amp;gt;getContext($context, &quot;object&quot;)), &quot;venue&quot;, array());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All these pages are in the admin section, not in my templates, thus they are pages I can't edit, so I don't know what I can do to fix this error. Is it possible that I have created an entry type that Craft can't handle? There doesn't seem to be anything that unusual about the Venue entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I done something obviously wrong? If not, how do I debug this?&lt;/p&gt;&#xA;" OwnerUserId="5200" LastEditorUserId="45" LastEditDate="2017-07-05T03:03:13.333" LastActivityDate="2017-07-05T03:28:27.893" Title="I managed to make an entry type that won't let me create any entries. How can I fix it?" Tags="&lt;entries&gt;&lt;admin&gt;&lt;entry-type&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="21076" PostTypeId="2" ParentId="21070" CreationDate="2017-07-05T00:30:18.857" Score="1" Body="&lt;p&gt;Technically it's a combination of the element's slug plus URI that is required to be unique (on a per-locale basis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the logic used and where it's enforced at the code level in &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/ElementHelper.php#L74&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ElementHelper::setUniqueURI()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-05T00:30:18.857" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21077" PostTypeId="2" ParentId="21072" CreationDate="2017-07-05T02:48:18.073" Score="0" Body="&lt;p&gt;This is currently not a native Commerce feature, but feel free to add a thumbs-up/comment to this feature request, which is what you're asking for: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1082&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1082&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-05T02:48:18.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21078" PostTypeId="2" ParentId="21075" CreationDate="2017-07-05T03:28:27.893" Score="2" Body="&lt;p&gt;It sounds like you're trying to have a &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#dynamic-entry-titles&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic title&lt;/a&gt; for that section, based on an Entries field (Venue). Working out the nuances in this situation can be a little tricky, but I think this would do the trick for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.venue.first().title ?? '(no venue)' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's break down what's happening here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this use-case, &lt;code&gt;object&lt;/code&gt; is your Entry. Which means that &lt;code&gt;object.venue&lt;/code&gt; is your Venue field (which happens to be an Entries field type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Venue is an Entries field type, that means it's going to return an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Criteria Model&lt;/a&gt;. When dealing with an ECM, you need to append something like &lt;code&gt;find()&lt;/code&gt; (get all) or &lt;code&gt;first()&lt;/code&gt; (get one) to end up with an actual, useful result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we've established that you only need a single Entry (&lt;code&gt;object.venue.first()&lt;/code&gt;), let's go ahead and grab the title of that Entry (&lt;code&gt;object.venue.first().title&lt;/code&gt;). The good news... that can all be chained together! The bad news... it'll throw an error if the Venue field is left empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is where &lt;code&gt;?? '(no venue)'&lt;/code&gt; comes in. The double question mark is called a &lt;a href=&quot;https://straightupcraft.com/events/twigs-null-coalescing-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;null-coalescing operator&lt;/a&gt;. It provides a graceful fallback, suppressing error messages and allowing you to provide a safe alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put it all together, and you'll have a nice, &lt;em&gt;safe&lt;/em&gt; dynamic title.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-07-05T03:28:27.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21079" PostTypeId="1" AcceptedAnswerId="21155" CreationDate="2017-07-05T06:54:20.393" Score="1" ViewCount="856" Body="&lt;p&gt;We are trying to give our clients the ability to update an order's shipping address before the order has been actually shipped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've created a members area where they can list their orders and access them individually. When in an order, we have a link that loads a specific address form template &lt;code&gt;e.g. /addresses/edit/{{order.shippingAddress.id}}&lt;/code&gt; but the address form doesn't load throwing the error &lt;code&gt;Impossible to access an attribute (&quot;id&quot;) on a null variable.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This exact same address edit form works fine when loading the address from the &lt;code&gt;craft.commerce.customer.addresses&lt;/code&gt; model &lt;code&gt;e.g. addresses/edit/{{ address.id }}&lt;/code&gt;. Having a look at the DB, we've found that the address if from the order model doesn't actually exists in the &lt;code&gt;craft_commerce_customers_addresses&lt;/code&gt; table which would explain it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything we've missed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Alberto&lt;/p&gt;&#xA;" OwnerUserId="6653" LastActivityDate="2017-07-11T04:38:47.060" Title="Craft Commerce - Edit Complete Order Address from frontend" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;addresses&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21080" PostTypeId="1" CreationDate="2017-07-05T08:10:20.280" Score="1" ViewCount="43" Body="&lt;p&gt;I have an issue with attaching a file to a Matrix field and then saving the entry takes up to 2 minutes. If I open up another tab with the Craft CMS admin interface I can see that Craft is performing the task: &quot;Delete Stale Template Caches&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not happen in DevMode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read: &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt; but none of our templates are using the {% cache %} tag. Also there is nothing logged in: craft/storage/runtime/logs/phperrors.log I also tried clearing the caches to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also found:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15850/saving-some-entries-and-a-matrix-field-settings-takes-a-very-long-time&quot;&gt;Saving some entries and a matrix field settings takes a very long time&lt;/a&gt;&#xA;but this does not provide any real answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server is running PHP 7.0.20 and running Nginx as a reverse proxy in front of Apache via ServerPilot.&lt;/p&gt;&#xA;" OwnerUserId="6952" LastEditorUserId="57" LastEditDate="2017-07-05T18:10:45.317" LastActivityDate="2017-07-05T18:10:45.317" Title="Attaching a file to a Matrix field and then saving the entry takes up to 2 minutes" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="21081" PostTypeId="1" AcceptedAnswerId="21086" CreationDate="2017-07-05T08:51:59.440" Score="2" ViewCount="570" Body="&lt;p&gt;Is there a way to output the currency symbols for each accepted payment currency in a Craft Commerce site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following simplified example;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currencies = craft.commerce.paymentCurrencies %}&#xA;{% if currencies|length &amp;gt; 1 %}&#xA;&amp;lt;select name=&quot;paymentCurrency&quot;&amp;gt;&#xA;    {% for currency in currencies %}&#xA;        &amp;lt;option&amp;gt;{{ currency.iso }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of the currency ISO code being output in the option, I also want to show the symbol. I can't find a method for doing so.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-07-05T13:12:27.410" Title="Output currency symbols" Tags="&lt;plugin-craftcommerce&gt;&lt;currency&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21082" PostTypeId="2" ParentId="21081" CreationDate="2017-07-05T08:57:54.637" Score="2" Body="&lt;p&gt;I couldn't find a way to do this (So hopefully someone can come back on this, or it will be part of Commerce in future!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I did was to create an array matching the ISO's to the symbol then checked the array if the symbol existed. Luckily we only offered a few currencies so it wasn't so much of a pain.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-07-05T08:57:54.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21083" PostTypeId="1" AcceptedAnswerId="21084" CreationDate="2017-07-05T09:24:29.013" Score="2" ViewCount="144" Body="&lt;p&gt;I'm building a calendar functionality and I need to get entries by month, but they cannot restricted by year (as, for example, the calendar might have entries that fall on both Jan 2017 and Jan 2018).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I'm doing a for loop and incrementing to get the next 5 years:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryParam = craft.request.getParam('month') %}&#xA;&#xA;{% if categoryParam %}&#xA;  {% set allDates = [] %}&#xA;&#xA;  {% for i in 0..5 %}&#xA;    {% set year = now|date('Y') + loop.index0 %}&#xA;    {% set combinedDate = '1970-' ~ categoryParam ~ '-01' %}&#xA;&#xA;    {% set startDate = year ~ '-' ~ combinedDate|date('m') ~ '-01' %}&#xA;    {% set dayCount = startDate|date('t') %}&#xA;    {% set endDate  = year ~ '-' ~ combinedDate|date('m') ~ '-' ~ dayCount %}&#xA;&#xA;    {% set courseDates = craft.entries({ section: 'courseDates', limit: null }).order('courseStartDate').courseStartDate('and','&amp;gt;= ' ~ startDate, '&amp;lt;=' ~ endDate) %}&#xA;&#xA;    {% for courseDate in courseDates %}&#xA;      {% if courseDate not in allDates %}&#xA;        {% set allDates = allDates|merge([courseDate]) %}&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;&#xA;{% else %}&#xA;  {% set allDates = craft.entries({ section: 'courseDates', limit: null }).order('courseStartDate').courseStartDate('and','&amp;gt;= ' ~ now) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm just wondering if there is a better way of doing this that doesn't rely on the year?&lt;/p&gt;&#xA;" OwnerUserId="6147" LastActivityDate="2017-07-05T12:18:09.107" Title="Get entries by month, but not restricted by year" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21084" PostTypeId="2" ParentId="21083" CreationDate="2017-07-05T10:10:17.493" Score="3" Body="&lt;p&gt;I think a better way would be to add a Preparse field to your Course Dates’ field layout that stores only the month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for the &lt;code&gt;preparsedMonth&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.courseStartDate|date('m') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place you can drastically simplify your template code and reduce database queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryParam = craft.request.getParam('month') %}&#xA;&#xA;{% set allDates = craft.entries({&#xA;    section: 'courseDates',&#xA;    courseStartDate: '&amp;gt;= ' ~ now|date('c'),&#xA;    preparsedMonth: categoryParam ? '%02d'|format(categoryParam) : null,&#xA;    order: 'courseStartDate',&#xA;    limit: null,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-05T12:18:09.107" LastActivityDate="2017-07-05T12:18:09.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21085" PostTypeId="1" AcceptedAnswerId="21098" CreationDate="2017-07-05T12:33:42.077" Score="1" ViewCount="513" Body="&lt;p&gt;I'm beginning to work on my first Craft CMS website. (I'm really excited!) I've read a ton of documentation and am getting my head around setting up a structure within the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website will be fairly large, and the site structure a few levels deep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the IA, say I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/ (Home)&#xA;/about  (About Overview Page, contains information from all subpages)&#xA;/about/team (bios of team members)&#xA;/about/history (content page)&#xA;/about/contact (contact form)&#xA;/industries (overview of all industries, contains content from subpages)&#xA;/industries/medical (industry overview page, contains contact from about, featured documents, featured case study, etc)&#xA;/industries/medical/about (content)&#xA;/industries/medical/history (content)&#xA;/industries/medical/documents (content + documents)&#xA;/industries/medical/case-studies (content + case studies)&#xA;/industries/medical/portfolio&#xA;/industries/financial&#xA;/industries/financial/about&#xA;/industries/financial/history&#xA;/industries/financial/documents&#xA;/industries/financial/case-studies&#xA;/industries/financial/portfolio&#xA;...(etc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You get the point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I believe that for the majority of the data (documents, case studies, portfolio items) I will set up channels to house that data. (Is that the way it should be done? Set up channels and then have a &quot;Industry&quot; select field where the admin can choose what industry the entry belongs to?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get this structure set up? Is it just a matter of adding templates into the corresponding &lt;code&gt;/templates/&lt;/code&gt; folders in the system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've gone into &lt;code&gt;Admin &amp;gt; Sections&lt;/code&gt; and created an &quot;Industries&quot; section, and then I created entry types for: Content, Documents, Case Studies, Portfolio Items, Forms, etc.  Will I basically use that &lt;code&gt;index.html&lt;/code&gt; template in &lt;code&gt;/templates/industries/index&lt;/code&gt; to route ALL of the requests across all subpages in that section? i.e. get the one part of the slug to determine the active industry, and then the second segment to determine what page and what template to show? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then what role would the &lt;code&gt;Entry Template&lt;/code&gt; have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I going about this all wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think once I understand this piece of it, everything is going to click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your help! Happy to clarify anything to help me get clarity ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE: Upon further reading, I think I'm getting it. The entries are really just containers for the data, the sections are a way of organizing that data. I just use routes to handle the site structure. Is that correct?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6954" LastEditorUserId="6954" LastEditDate="2017-07-05T18:00:48.527" LastActivityDate="2017-07-06T15:14:54.827" Title="Nested IA Structure - What's the best way to get it set up?" Tags="&lt;templating&gt;&lt;sections&gt;&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21086" PostTypeId="2" ParentId="21081" CreationDate="2017-07-05T13:12:27.410" Score="4" Body="&lt;p&gt;You don't need to create your own symbol map - it exists as a yii translation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set localeData = craft.i18n.getLocaleData() %}&#xA;{% set currencyIso = 'USD' %}&#xA;&#xA;{{ localeData.getCurrencySymbol(currencyIso)  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4538" LastActivityDate="2017-07-05T13:12:27.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21087" PostTypeId="2" ParentId="21012" CreationDate="2017-07-05T13:40:40.403" Score="1" Body="&lt;p&gt;It's not obvious, but you need to select the email field in the form settings, then select a notification from the pane on the right to send to the value in the field.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2017-07-05T13:40:40.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21088" PostTypeId="1" CreationDate="2017-07-05T15:02:42.790" Score="1" ViewCount="364" Body="&lt;p&gt;&lt;strong&gt;Building on from this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20093/how-can-i-filter-craft-commerce-products-by-price&quot;&gt;How can I filter Craft Commerce products by price&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a price filter in the store&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this code works fine for the normal price&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;        relatedTo: category,&#xA;        defaultPrice: [&#xA;            'and',&#xA;            '&amp;gt;= ' ~ 0,&#xA;            '&amp;lt;= ' ~ 90,&#xA;        ]&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but defaultPrice does not consider sale prices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if a product is normally $99 but it is reduced to $89, it won't be returned&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would have expected defaultPrice to store the &lt;em&gt;current price being charged&lt;/em&gt;. So the sale price if it was on sale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to filter by price and include sale prices?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spent hours now on something I thought would be simple. It seems the only way to get this information is to get the products and loop through them. Checking for sale prices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to create a plugin to make a usable price filter?&lt;/p&gt;&#xA;" OwnerUserId="6654" LastActivityDate="2017-07-05T19:46:52.030" Title="How can I filter Craft Commerce products by the current price" Tags="&lt;plugin-craftcommerce&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21089" PostTypeId="1" AcceptedAnswerId="21331" CreationDate="2017-07-05T17:46:10.800" Score="1" ViewCount="194" Body="&lt;p&gt;I've got a form that redirects to a results page on submission. Results page currently lives at &lt;code&gt;/form/results/[submission.id]/success/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results page shows the user's answers, and a bunch of other results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a 'best' way to make it so that this results page is only accessible for the current user/session? I don't want to have it be available for any random joe to just try IDs and see someone else's results. &lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2017-07-06T16:31:28.760" LastActivityDate="2017-07-25T19:19:43.687" Title="Freeform - limit who can view 'results' page" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21090" PostTypeId="2" ParentId="21088" CreationDate="2017-07-05T19:46:52.030" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/variant-model#saleprice&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/variant-model#saleprice&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The comment on the documentation leads me to believe you can just use &lt;code&gt;salePrice&lt;/code&gt; for your filtering as it will be equal to the &lt;code&gt;defaultPrice&lt;/code&gt; if there is no sale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;        relatedTo: category,&#xA;        salePrice: [&#xA;            'and',&#xA;            '&amp;gt;= ' ~ 0,&#xA;            '&amp;lt;= ' ~ 90,&#xA;        ]&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2017-07-05T19:46:52.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21091" PostTypeId="1" CreationDate="2017-07-06T03:05:32.573" Score="2" ViewCount="360" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U1eYf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U1eYf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get the last item that don't have a child. So in this case I need &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mobiltelefoner&lt;br&gt;&#xA;Ipad&lt;br&gt;&#xA;Køleskab&lt;br&gt;&#xA;Vaskemaskine&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to I get the last item that don't have a child without knowing the amount of levels?&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="125" LastEditDate="2017-07-06T09:56:17.653" LastActivityDate="2017-07-06T09:56:17.653" Title="Loop through categories and get bottom-most category for each tree" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21092" PostTypeId="2" ParentId="21079" CreationDate="2017-07-06T04:13:12.400" Score="1" Body="&lt;p&gt;When the order is completed a copy of the address is made which is created for that specific order, that explains why it doesn't show up in the customers_addresses table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is so that the address is unique to that order and can be edited by an admin without affecting the customers address book. Are you wanting customers to be able to edit that address after the order is complete?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-06T04:13:12.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21093" PostTypeId="1" AcceptedAnswerId="21112" CreationDate="2017-07-06T06:29:31.137" Score="2" ViewCount="333" Body="&lt;p&gt;Disabling a product variant doesn't remove it from a &lt;code&gt;{% for purchasable in product.variants %}&lt;/code&gt; loop I have set up. It still renders an image associated with it, as well as a color swatch. Essentially not disabling it at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for purchasable in product.variants if purchasable.status('live') %}&lt;/code&gt; isn't working either, which I assume is only applicable to the product model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2017-07-06T08:02:50.727" LastActivityDate="2017-07-06T19:20:46.633" Title="Disabled product variant still shows in {% for %} loop" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21095" PostTypeId="1" CreationDate="2017-07-06T07:45:58.470" Score="2" ViewCount="258" Body="&lt;p&gt;The official example ( &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt; ) seems to assume that the form itself is not already on a page which is an Entry. Dropping this form into a template that has an entry loaded already spits out that entry's entry.title or entry.body.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should this work? We want the &quot;new entry form&quot; to live on a page that the client controls the content for.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-07-06T08:38:26.383" Title="Front end Entry form with validation error support?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21096" PostTypeId="2" ParentId="21095" CreationDate="2017-07-06T08:38:26.383" Score="2" Body="&lt;p&gt;The &lt;code&gt;saveEntry&lt;/code&gt; controller used by the default example returns an &lt;code&gt;entry&lt;/code&gt; variable with the newly created item and the applicable error messages. This could be a potential cause of conflict if you have another variable called &lt;code&gt;entry&lt;/code&gt;, which is by default pre-loaded in entry templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you could create a (for example) &lt;code&gt;product.twig&lt;/code&gt; template and manually set an entry variable (via ID or slug) called anything else than &lt;code&gt;entry&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2017-07-06T08:38:26.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21097" PostTypeId="2" ParentId="21085" CreationDate="2017-07-06T09:05:11.470" Score="2" Body="&lt;p&gt;I would avoid setting up custom Routes whenever possible, since Craft already has a pretty sensible default routing behaviour: in my experience, just by using the standard &lt;code&gt;folder/template&lt;/code&gt; structure you can do a lot of work. Problems arise when you need a custom template for a particular entry: in these cases you may have to add conditionals in your template or some system (maybe a 'customTemplate` field in your entry) to manage that.  &lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2017-07-06T09:05:11.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21098" PostTypeId="2" ParentId="21085" CreationDate="2017-07-06T09:31:22.897" Score="4" Body="&lt;p&gt;Lots of question so I'll describe how I would do it more or less. Ask if you want more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/&lt;/code&gt; - single page type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/about&lt;/code&gt; - single page type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/industries&lt;/code&gt; - single page type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/about/{slug}&lt;/code&gt; - structure page type (structure offers nested entries)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/industries/{slug}&lt;/code&gt; - structure page type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot create &lt;code&gt;/about&lt;/code&gt; entry within structure with slug like &lt;code&gt;/about/{slug}&lt;/code&gt; - thats why &lt;code&gt;/about&lt;/code&gt; is a seperate single page type page.&#xA;Of course you can create single structure with {slug} as url - then &lt;code&gt;/about&lt;/code&gt; and &lt;code&gt;/industries&lt;/code&gt; could be created within structure section. Note: with many entries it is harder to handle in CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About structure would have following entry types:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;bios&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;contentPage&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;contactForm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;CP Section edit screen&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sXfCZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sXfCZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CP Entries:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Q75pU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q75pU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;code&gt;about/_entry&lt;/code&gt; template would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;base_template&quot; %}&#xA;{% block body %}&#xA;    {% switch entry.type %}&#xA;        {% case &quot;bios&quot; %}&#xA;            {% include &quot;about/bios&quot; %}&#xA;        {% case &quot;contentPage&quot; %}&#xA;            {% include &quot;about/content_page&quot; %}&#xA;        {% case &quot;contactForm&quot; %}&#xA;            {% include &quot;about/contact_form&quot; %}&#xA;    {% endswitch %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or it could be (but I prefer first approach)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;base_template&quot; %}&#xA;{% block body %}&#xA;    {% include &quot;about/&quot; ~ entry.type %} (filename == entry type)&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Channel/structure sections can have multiple entry types. All of them use template defined by Entry Template - thats why we include other templates based on entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/about&lt;/code&gt;, &lt;code&gt;/industries&lt;/code&gt; single page template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fetch data from all subpages you can either hardcode it to fetch entries from section like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set entries = craft.entries({&#xA;    section: 'aboutSection',&#xA;    order: 'postDate desc',&#xA;    limit: 20&#xA;}) -%}&#xA;&#xA;{%- for entry in entries -%}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    //use switch to display data specific to entry type&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can add entry field (lets call it subpages) to the page and display it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- for entry in entry.subpages -%}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    //use switch to display data specific to entry type&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With field approach you can change content without changing the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is hybrid - use query when no entries assigned to entry field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set entries = entry.subpages %}&#xA;&#xA;{% if entries.total() &amp;lt; 1 %}&#xA;    {%- set entries = craft.entries({&#xA;        section: 'aboutSection',&#xA;        order: 'postDate desc',&#xA;        limit: 20&#xA;    }) -%}&#xA;{% endif %}&#xA;&#xA;{%- for entry in entries -%}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    //use switch to display data specific to entry type&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Similar industries section:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CP Section create page&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Lz9re.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lz9re.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CP Entries:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0i0e5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0i0e5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Industries Overview entry type template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you could query items like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set entries = entry.chrildren -%}&#xA;{%- set entries = entry.chrildren.descendantDist(n) -%} n levels below entry&#xA;{%- set entries = entry.chrildren.type('content') -%} specific type of children&#xA;{%- set entries = entry.chrildren.type('content').with(['field', 'field']) -%} .with() helps reduce SQL queries&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.children&lt;/code&gt; returns &lt;code&gt;ElementCriteriaModel&lt;/code&gt; same as &lt;code&gt;craft.entries&lt;/code&gt; so all methods &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or again you can add entry field and display specific children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: In the case of the Medical &gt; Portfolio being a single entry type WITHIN a structure, I'm assuming individual Portfolio Items would be housed within a Channel of their own?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Yes, that is one approach. To achieve this you would create a new section with URLs disabled (unless you want portfolio items to be accessible via URL - ex. separate page) like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VyLcu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VyLcu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you just query those items. Oh, I used Stucture instead of Channel - in addition to nested entries, Structure allows to reorder entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.type %}&#xA;    {% case &quot;medicalPortfolio&quot; %}&#xA;        {%- set entries = craft.entries.section('medicalPortfolioItemsSection') -%}&#xA;        {% include &quot;industries/portfolio&quot; with {&quot;entries&quot;: entries} %}&#xA;        ...&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Important thing here is to create additional entry type per industry so you can query proper portfolio items. Also new section per industry. It is not good solution here because we duplicate things.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another way is to use &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix field&lt;/a&gt; to define portfolio item. This way you just use Portfolio entry type with Matrix field within Industries structure.&lt;/p&gt;&#xA;" OwnerUserId="5818" LastEditorUserId="5818" LastEditDate="2017-07-06T15:14:54.827" LastActivityDate="2017-07-06T15:14:54.827" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21099" PostTypeId="2" ParentId="21091" CreationDate="2017-07-06T09:55:04.373" Score="1" Body="&lt;p&gt;Have a look at Craft’s &lt;a href=&quot;https://craftcms.com/docs/templating/nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;nav&lt;/code&gt;&lt;/a&gt; tag, which allows to recursively iterate through&#xA;an array of element models. Only output the category title if the category has no descendants.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav category in categories %}&#xA;    {% if not category.getDescendants().total() %}&#xA;        &amp;lt;span&amp;gt;{{ category.title }}&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% ifchildren %}&#xA;        {% children %}&#xA;    {% endifchildren %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another option would be to write a self-calling &lt;a href=&quot;https://twig.sensiolabs.org/doc/1.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;macro&lt;/code&gt;&lt;/a&gt; to recursively traverse the tree.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro getBottomMostElements(elements) %}&#xA;    {% import _self as self %}&#xA;&#xA;    {% for element in elements %}&#xA;        {% if element.getDescendants().total() %}&#xA;            {{ self.getBottomMostElements(element.getDescendants(1)) }}&#xA;        {% else %}&#xA;            &amp;lt;span&amp;gt;{{ element.title }}&amp;lt;/span&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{% import _self as macros %}&#xA;{{ macros.getBottomMostElements(categories.level(1)) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-07-06T09:55:04.373" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21100" PostTypeId="1" AcceptedAnswerId="21101" CreationDate="2017-07-06T09:56:01.697" Score="1" ViewCount="183" Body="&lt;p&gt;for anyone experiencing dirty transparent backgrounds when you transform transparent PNG images with Craft like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hn3Pg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hn3Pg.png&quot; alt=&quot;Src Image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resized, dirty:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft Command: craft.assets.id(2).first().getUrl({width: 300})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3uLD8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3uLD8.png&quot; alt=&quot;dirty image, 300px width&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't see the dirt, watch screen from the side!&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-06T09:57:42.107" Title="Craft creating dirty transparent background on image transformations / resizing" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21101" PostTypeId="2" ParentId="21100" CreationDate="2017-07-06T09:57:42.107" Score="3" Body="&lt;p&gt;The reason is the GD image library. If you switch to imagick, the transparent background will be clean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resized, clean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9EGyB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9EGyB.png&quot; alt=&quot;clean resize&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-06T09:57:42.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21102" PostTypeId="1" CreationDate="2017-07-06T10:05:39.267" Score="1" ViewCount="219" Body="&lt;p&gt;I've got an &quot;escapeshellcmd() has been disabled for security reasons&quot; warning whenever I try to send an email using Craft (user activation email), is there a way around it?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2017-07-06T10:18:00.663" Title="Can't send emails" Tags="&lt;config&gt;&lt;emails&gt;&lt;install&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21103" PostTypeId="2" ParentId="21102" CreationDate="2017-07-06T10:18:00.663" Score="2" Body="&lt;p&gt;Oh, just use settings-&gt;email and setup SMTP or POP3 account duh. I'll leave it here just in case someone is as forgetful as me.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2017-07-06T10:18:00.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21104" PostTypeId="1" AcceptedAnswerId="21158" CreationDate="2017-07-06T11:54:04.137" Score="1" ViewCount="102" Body="&lt;p&gt;I need to add an adjuster after the order is completed, but can't get it working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that the customer can order a individual picture, after that he get's a preview of the picture where he can proof the image and only when he confirms the preview he has to make the payment. In case of payment by bill, there is a payment fee about 5 EUR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adjuster I made works, but only if the order is not completed. Is there any way to implement this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or can i add a payment fee via a custom payment gateway, that adds to the bill at the end?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2017-07-10T12:51:11.477" LastActivityDate="2017-07-11T04:55:39.913" Title="Add Adjuster after Order is completed?" Tags="&lt;plugin-craftcommerce&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21105" PostTypeId="1" CreationDate="2017-07-06T13:05:07.770" Score="2" ViewCount="651" Body="&lt;p&gt;We're looking for a way to integrate Craft Commerce with Salesforce. What are the options there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a Craft API to talk to? (I can't seem to be able to find it...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the other option is to write a plugin in Craft that communicates outwards to Salesforce, I suppose?&lt;/p&gt;&#xA;" OwnerUserId="6957" LastActivityDate="2018-08-31T05:01:20.900" Title="How to integrate Craft Commerce with Salesforce?" Tags="&lt;plugin-craftcommerce&gt;&lt;integration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21106" PostTypeId="1" CreationDate="2017-07-06T13:24:14.143" Score="1" ViewCount="296" Body="&lt;p&gt;There are a number of answers on this forum for getting a front-end form to have a DateTime field that splits date and time into separate fields; It's not working for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I strip back to absolute basics - hardcoded, as a test:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;endDate&quot; name=&quot;fields[endDate]&quot; value=&quot;2017-12-30 02:15:00&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works, and a date &amp;amp; time is stored in the back-end field, displaying correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if I try to split it so the date and time fields are separate (so that I can use a date picker on one and a select drop down on the other) - it doesn't save a value into the field. Even stripped back to hard-coded hidden fields...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;endDate&quot; name=&quot;fields[endDate][date]&quot; value=&quot;2017-12-30&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;endTime&quot; name=&quot;fields[endDate][time]&quot; value=&quot;02:15:00&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? The is the same format that works in the Craft back-end...&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-10-05T02:41:43.967" Title="front end date field format doesn't work? fields[dateField][date]" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21107" PostTypeId="2" ParentId="21106" CreationDate="2017-07-06T13:58:06.713" Score="0" Body="&lt;p&gt;I recently did this using a field called &lt;code&gt;expirDate&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;date&quot; name=&quot;expiryDate&quot; id=&quot;expiryDate&quot; class=&quot;form-control&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you give that a try?&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-07-06T13:58:06.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21108" PostTypeId="2" ParentId="21041" CreationDate="2017-07-06T14:03:46.567" Score="4" Body="&lt;p&gt;It’s not totally clear from your question where you’re building the relation to the categories,&#xA;but I have a feeling that this is the solution you’re looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupParam = '{ object.categoriesFieldHandle.first() ? object.categoriesFieldHandle.first().title : &quot;No categories&quot; }' %}&#xA;{% for groupTitle, entriesInGroup in entry.entriesFieldHandle|group(groupParam) %}&#xA;    {{ groupTitle }}&#xA;&#xA;    {% for entry in entriesInGroup %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-07T14:01:58.027" LastActivityDate="2017-07-07T14:01:58.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21109" PostTypeId="1" AcceptedAnswerId="21110" CreationDate="2017-07-06T14:25:33.773" Score="1" ViewCount="221" Body="&lt;p&gt;I actually found this code on here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14914/search-form-with-craft-commerce&quot;&gt;Search Form with Craft Commerce&lt;/a&gt;. I had a problem with this code pulling up products that didn't match, and then after creating a new product it worked for a bit and then broke and continued to only pull up the same ones, even if I got rid the values inside with[].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So two questions, how do I enforce that the product has to match BOTH criteria in the with[] and does anyone have any clue about why it would stop refreshing products? I've tried clearing cache in both browser and craftcms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize if this has been asked before, I've been through multiple previously asked questions with little luck.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set spec = craft.request.getParam('a') %}&#xA;{% set spec2 = craft.request.getParam('b') %}&#xA;{% set category = craft.categories.group('productSpecs') %}&#xA;{% set products = craft.commerce.products({&#xA;            relatedTo: category,&#xA;             with: [&#xA;                spec,&#xA;                spec2,&#xA;            ], &#xA;            order: &quot;title asc&quot;,&#xA;        }) %}&#xA;{% for product in products %}&#xA;    {{ product.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-07-06T19:26:42.437" Title="Enforce search match multiple parameters" Tags="&lt;categories&gt;&lt;search&gt;&lt;eager-loading&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21110" PostTypeId="2" ParentId="21109" CreationDate="2017-07-06T14:48:46.197" Score="3" Body="&lt;p&gt;I think you're misunderstanding what &lt;code&gt;with&lt;/code&gt; does. Or I am. Ha!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand &lt;code&gt;with&lt;/code&gt; is for eager loading, but doesn't control anything in the relation itself. I don't think your relation makes any sense either because all you'll do is substitute a string into your spec variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something more like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;    relatedTo: [&#xA;        'and',&#xA;        CONDITION1,&#xA;        CONDITION2&#xA;    ],&#xA;    with: [&#xA;        fieldYouWantToShow,&#xA;        otherFieldYouWantToShow,&#xA;    ], &#xA;    order: &quot;title asc&quot;,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your conditionals should be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ targetElement: category },&#xA;{ sourceElement: craft.entries.section('reviews').status(null) }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bottom example here is what you're needing: &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2017-07-06T19:26:42.437" LastActivityDate="2017-07-06T19:26:42.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21111" PostTypeId="1" AcceptedAnswerId="21121" CreationDate="2017-07-06T15:58:47.933" Score="1" ViewCount="186" Body="&lt;p&gt;I've been trying to find an approach where one could import product listings from Salesforce directly into one of my product types in Craft Commerce. It seems like my only option at this point is to write a plugin that can accomplish this. I recently found a post that mentioned that I would need to use the &lt;a href=&quot;https://developer.salesforce.com/page/PHP_Toolkit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Salesforce PHP Toolkit&lt;/a&gt; to effectively make REST API calls from my platform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only issue is I don't know exactly where to start.  Can anyone provide some suggestions or advice on how to handle this problem?&lt;/p&gt;&#xA;" OwnerUserId="6958" LastEditorUserId="57" LastEditDate="2017-07-06T23:33:13.183" LastActivityDate="2017-07-06T23:43:17.407" Title="Looking to export product listings from Salesforce and importing into Craft Commerce?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21112" PostTypeId="2" ParentId="21093" CreationDate="2017-07-06T19:20:46.633" Score="2" Body="&lt;p&gt;This should filter the variants by their enabled status:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set product = craft.commerce.products.id(productId).first() %}&#xA;&#xA;{% for variant in product.variants if variant.enabled %}&#xA;    {{ variant.id }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-06T19:20:46.633" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21113" PostTypeId="1" AcceptedAnswerId="21217" CreationDate="2017-07-06T20:22:18.493" Score="1" ViewCount="500" Body="&lt;p&gt;SEOMatic automatically adds the siteName after your title tag, which seems smart, but I don't think it's necessary for social sharing. Is it possible to tweak the og:title and twitter:title tag output in SEOmatic to remove the siteName?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current seomaticMeta array looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seomaticMeta = { &#xA;  seoTitle: entry.title,&#xA;  seoDescription: entry.shortDescription,&#xA;  seoImage: entry.thumbnailImage.first(),&#xA;  seoKeywords: '',&#xA;  canonicalUrl: entry.url,&#xA;  twitter: { &#xA;      card: seomaticMeta.twitter.card,&#xA;      site: seomaticMeta.twitter.site,&#xA;      creator: seomaticMeta.twitter.creator,&#xA;      title: entry.title,&#xA;      description: entry.shortDescription,&#xA;      image: entry.thumbnailImage.first(),&#xA;  },&#xA;  og: { &#xA;      type: seomaticMeta.og.type,&#xA;      locale: seomaticMeta.og.locale,&#xA;      url: entry.url,&#xA;      title: entry.title,&#xA;      description: entry.shortDescription,&#xA;      image: entry.thumbnailImage.first(),&#xA;      site_name: seomaticMeta.og.site_name,&#xA;      see_also: seomaticMeta.og.see_also&#xA;  }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the entry.title tag returns the title with the siteName appended.&lt;/p&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="5589" LastEditDate="2017-07-17T23:04:49.203" LastActivityDate="2017-07-17T23:04:49.203" Title="How to remove siteName from the og:title tag with SEOMatic" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21114" PostTypeId="1" AcceptedAnswerId="21117" CreationDate="2017-07-06T20:33:47.490" Score="1" ViewCount="926" Body="&lt;p&gt;I'm currently adapting a shipping plugin that has a form for people to submit their tracking number and shipping company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template checks the variable, and if it exists, it generates the proper information for the tracking number and company. If the variable doesn't exist, it shows the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;basically this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($ttr&amp;lt;&amp;gt;&quot;&quot;) {&#xA;      All the business logic&#xA;} else {&#xA;    &amp;lt;form method=&quot;get&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;tracknum&quot; /&amp;gt;&#xA;        &amp;lt;select name=&quot;company&quot; class=&quot;smallForm&quot; id=&quot;company&quot;&amp;gt;&#xA;                (...options...)&#xA;        &amp;lt;/select&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;orderAction&quot; value=&quot;track&quot;/&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The original check for this this variable looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (isset($_POST['tracknum'])) &#xA;$ttr = $_POST['tracknum']; &#xA;else $ttr = $_GET['tracknum'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So for I put each check in its own variable function, as so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function ttr()&#xA;{&#xA;   if (isset($_POST['tracknum'])) &#xA;       $ttr = $_POST['tracknum']; &#xA;   else $ttr = $_GET['tracknum'];&#xA;   return $ttr;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and call it thusly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.PluginName.ttr|length %}&#xA;    All the business Logic&#xA;{% else %}&#xA;    &amp;lt;form method=&quot;get&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;tracknum&quot; /&amp;gt;&#xA;        &amp;lt;select name=&quot;company&quot; class=&quot;smallForm&quot; id=&quot;company&quot;&amp;gt;&#xA;                (...options...)&#xA;        &amp;lt;/select&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;orderAction&quot; value=&quot;track&quot;/&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This currently returns&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined index: tracknum&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Specifically on the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;else $ttr = $_GET['tracknum'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this makes sense to me, as the form hasn't been submitted, so There should be nothing in the $_POST or $_GET. But if that's the case, why does it work on the original website, but not here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6165" LastActivityDate="2017-07-06T21:25:53.383" Title="Craft Plugin Variable 'Undefined Index'" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21115" PostTypeId="1" CreationDate="2017-07-06T20:36:23.983" Score="1" ViewCount="37" Body="&lt;p&gt;I'm building a gallery system and on the entry page I have fields for gallery category (category field) as well as gallery photos (assets field). When creating this entry, I would like to upload the assets field to something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;images/galleries/category/slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, because the category is still being defined in the same entry as the assets are being uploaded, my images aren't put into a folder based on the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is what I'm trying to do possible? What's the best way to approach it? I'm currently using this for my assets file path:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;images/galleries/{galleryCategory.first.slug}/{slug}&lt;/p&gt;&#xA;" OwnerUserId="6961" LastActivityDate="2017-07-07T16:26:36.873" Title="Upload assets to location based on category if entry isn't saved yet?" Tags="&lt;assets&gt;&lt;categories&gt;&lt;entry&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21116" PostTypeId="2" ParentId="21114" CreationDate="2017-07-06T21:01:28.993" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;... why does it work on the original website, but not here?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Undefined index&lt;/code&gt; is a &lt;strong&gt;notice&lt;/strong&gt; level PHP error. Which means it's barely important, and can generally be ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably a result of either:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your PHP error level settings are more strict on this machine, and/or&lt;/li&gt;&#xA;&lt;li&gt;Craft is in &lt;code&gt;devMode&lt;/code&gt; on this machine.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-07-06T21:01:28.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21117" PostTypeId="2" ParentId="21114" CreationDate="2017-07-06T21:25:53.383" Score="1" Body="&lt;p&gt;You could do something like this to guard against it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function ttr()&#xA;{&#xA;    $ttr = null;&#xA;&#xA;    if (isset($_POST['tracknum'])) &#xA;        $ttr = $_POST['tracknum']; &#xA;    else if (isset($_GET['tracknum'])&#xA;        $ttr = $_GET['tracknum'];&#xA;&#xA;    return $ttr;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-06T21:25:53.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21118" PostTypeId="2" ParentId="21045" CreationDate="2017-07-06T21:41:51.500" Score="1" Body="&lt;p&gt;This issue suddenly fixed itself without any changes that I'm aware of... Thanks anyway!&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2017-07-06T21:41:51.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21119" PostTypeId="1" AcceptedAnswerId="21138" CreationDate="2017-07-06T22:01:17.483" Score="1" ViewCount="66" Body="&lt;p&gt;Is it possible to search a server folder containing image and video files that were previously uploaded via ftp and then loop through those files in the entry template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each entry has a unique Log ID number field which is also part of the image or video filename.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Log ID: &lt;strong&gt;12345&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Image filename: &lt;strong&gt;12345&lt;/strong&gt;-[8374]-img-01.jpg&lt;/li&gt;&#xA;&lt;li&gt;Image filename: &lt;strong&gt;12345&lt;/strong&gt;-[8374]-img-02.jpg&lt;/li&gt;&#xA;&lt;li&gt;Video filename: &lt;strong&gt;12345&lt;/strong&gt;-[8374]-vid-01.mp4&lt;/li&gt;&#xA;&lt;li&gt;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Conceptually on the template page...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Grab the entry LogID field (ex. &quot;12345&quot;)&lt;/li&gt;&#xA;&lt;li&gt;Search the media server folder for all filenames that begin with the LogID&lt;/li&gt;&#xA;&lt;li&gt;Display all of the found images and videos&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19043/auto-add-images-to-entry-after-ftp-to-server&quot;&gt;this question&lt;/a&gt; which is very similar but I don't have the skills to write a plugin. &lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2017-07-09T00:29:59.940" Title="Search then loop through files that were uploaded via FTP" Tags="&lt;templating&gt;&lt;assets&gt;&lt;search&gt;&lt;forloop&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21120" PostTypeId="2" ParentId="21105" CreationDate="2017-07-06T23:32:41.287" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a Craft API to talk to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, but it depends on what sort of API you're talking about and you'll need a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft&lt;/a&gt; &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; no matter what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the PHP level, Craft has a &lt;a href=&quot;https://craftcms.com/classreference#craft.app.services&quot; rel=&quot;nofollow noreferrer&quot;&gt;service layer API&lt;/a&gt; that plugins can utilize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for a web service API where you can configure what gets exposed so that 3rd party apps can consume Craft data, there is the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; plugin that works with any Craft elements (including plugin elements, like Orders, Products and Variants like in Commerce).  Note that this is read-only and is not a REST API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There currently isn't a native REST API in Craft, but feel free to add your comments to &lt;a href=&quot;https://github.com/craftcms/cms/issues/815&quot; rel=&quot;nofollow noreferrer&quot;&gt;this feature request&lt;/a&gt;.  It's also possible for a plugin to implement its own REST API using its own controller endpoints and authentication/authorization methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as consuming 3rd party web endpoints, Craft ships with Guzzle that a plugin can utilize, or it can use any other library it desires (or straight up cURL).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-06T23:32:41.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21121" PostTypeId="2" ParentId="21111" CreationDate="2017-07-06T23:43:17.407" Score="1" Body="&lt;p&gt;Generally speaking, it looks like you'd need to create a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft&lt;/a&gt; &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that imported the &lt;a href=&quot;https://developer.salesforce.com/page/PHP_Toolkit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Salesforce PHP Tookit&lt;/a&gt; library/classes.  From there you'd &lt;a href=&quot;https://developer.salesforce.com/page/PHP_Toolkit_20.0_Query_Sample_(Enterprise)&quot; rel=&quot;nofollow noreferrer&quot;&gt;query&lt;/a&gt; your Salesforce web endpoint for the data you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the data gets back, you'd programatically create the products using Commerce's service layer API.  You can see any example of that Commerce uses itself to populate default content on a fresh installation in the &lt;code&gt;Commerce_InstallSeeder&lt;/code&gt; class in &lt;code&gt;commerce/Commerce/Seed&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-06T23:43:17.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21122" PostTypeId="1" CreationDate="2017-07-07T01:44:05.280" Score="1" ViewCount="465" Body="&lt;p&gt;Is it possible to include category or tag slug in the entry URL format?&#xA;Would you please let me know the tags that make it, if possible?&lt;/p&gt;&#xA;" OwnerUserId="6963" LastEditorUserId="45" LastEditDate="2018-05-03T17:45:25.510" LastActivityDate="2018-05-03T17:45:25.510" Title="Is it possible to include category slugs in the entry URL format?" Tags="&lt;entry&gt;&lt;url&gt;&lt;format&gt;&lt;tag&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21123" PostTypeId="2" ParentId="21122" CreationDate="2017-07-07T03:56:24.000" Score="2" Body="&lt;p&gt;Assuming you want the first category that's selected in the field, you'd set your &quot;Entry URL Format&quot; setting to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{categoryFieldHandle.first().slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can access any of your custom fields by their handle in a similar way.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-07T03:56:24.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21124" PostTypeId="1" AcceptedAnswerId="21126" CreationDate="2017-07-07T11:45:55.807" Score="2" ViewCount="467" Body="&lt;p&gt;Does anybody know if it's possible to load matrixBlock and eager load the entries (=owner) the matrixBlocks belong to in Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = craft.matrixBlocks.type('eventDate').fieldId(4).with('owner') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this does not work. Leaving out the &lt;code&gt;.with('owner')&lt;/code&gt; works perfectly and then access its owner by &lt;code&gt;block.owner.&amp;lt;fieldname&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="57" LastEditDate="2017-07-07T17:20:43.433" LastActivityDate="2017-07-07T17:20:43.433" Title="Craft 3: query matrixBlocks and eager load its owner?" Tags="&lt;craft3&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21125" PostTypeId="1" CreationDate="2017-07-07T12:28:26.573" Score="1" ViewCount="45" Body="&lt;p&gt;I have a plugin that uses its init function to save custom user data from front end registrations. It uses:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if ($event-&amp;gt;params['isNewUser']) {}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To perform front end save routines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add a small  custom user save rule for admin usage outside of the IsNewUser logic in order to preserve like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;   $user = craft()-&amp;gt;users-&amp;gt;getUserById($uidfromURL);&#xA;   $user-&amp;gt;getContent()-&amp;gt;URN = 'my custom value';&#xA;   $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that this code just loops thru the plugin. I need the custom field to be manually editable, but i also need to create a default value too on initial user creation in admin.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2017-07-07T15:05:54.577" Title="How to prevent user save loop in CP?" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21126" PostTypeId="2" ParentId="21124" CreationDate="2017-07-07T12:42:38.130" Score="3" Body="&lt;p&gt;Currently no, but I suppose since Craft 3 added the &lt;code&gt;craft.matrixBlocks()&lt;/code&gt; template function, it would make sense to make this possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just created a FR about this: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1820&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1820&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-07-07T12:42:38.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21127" PostTypeId="1" AcceptedAnswerId="21216" CreationDate="2017-07-07T13:26:26.113" Score="1" ViewCount="588" Body="&lt;p&gt;I’m trying to setup responsive images with the imager plugin, that has 100% width on mobile sizes and then the images are in a 3 column grid on tablet and desktop. But although I’ve got the code outputting the three sizes, the browser is only showing the largest one at all sizes. So can someone see what I’ve done wrong in the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% set image = row.image.first() %}&#xA;      {% set transformedImages = craft.imager.transformImage(image,&#xA;          [&#xA;              { width: 360, ratio: 4/3 },&#xA;              { width: 294, ratio: 4/3 },&#xA;              { width: 720, ratio: 4/3, jpegQuality: 60 },&#xA;          ],&#xA;          {&#xA;              format: 'jpg',&#xA;              allowUpscale: false,&#xA;              mode: 'crop',&#xA;              jpegQuality: 80,&#xA;&#xA;              interlace: true&#xA;          }&#xA;      ) %}&#xA;      {% if image | length %}&#xA;      &amp;lt;img class=&quot;img-responsive&quot;&#xA;           src=&quot;{{ transformedImages[1].url }}&quot;&#xA;           sizes=&quot;(min-width: 768px) 33vw, 100vw&quot;&#xA;           srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&#xA;           alt=&quot;{{ image.title }}&quot;&#xA;           width=&quot;100%&quot;&amp;gt;&#xA;      {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m assuming it’s to do with the &lt;code&gt;sizes=&quot;(min-width: 768px) 33vw, 100vw&quot;&lt;/code&gt; So the 360 width is desktop, and the 294 width is tablet, and the largest size of 720 width is mobile to account for the 2x density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f4yFf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f4yFf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-07-16T20:37:23.597" Title="responsive sizes with imager plugin" Tags="&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21128" PostTypeId="2" ParentId="15522" CreationDate="2017-07-07T14:42:05.887" Score="1" Body="&lt;p&gt;Knowing that &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;s are imploded with &lt;a href=&quot;https://github.com/craftcms/cms/blob/2.6.2986/src/services/TemplatesService.php#L760&quot; rel=&quot;nofollow noreferrer&quot;&gt;\n&lt;/a&gt; char. You can add async defer this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set scripts = getFootHtml() | split(&quot;\n&quot;)  -%}&#xA;{%- for script in scripts -%}&#xA;    {%- if script matches &quot;%\/assets\/js\/main\.js%&quot; or ' src=' not in script -%}&#xA;        {{- script | raw -}}&#xA;    {%- else -%}&#xA;        {{- script | replace('script type', 'script async defer type') | raw -}}&#xA;    {%- endif -%}&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2017-07-07T14:42:05.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21129" PostTypeId="1" CreationDate="2017-07-07T14:53:11.337" Score="1" ViewCount="63" Body="&lt;p&gt;I'm struggling to output images and other fields that are related to the current category page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;{{ entry.title }}&lt;/code&gt; is outputting as expected, and displays the title of the related items to that category. But any other fields do not output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shopEntries = craft.entries.section(shop).relatedTo(category) %}&#xA;{% for entry in shopEntries.limit(16) %}&#xA;&#xA;    {% set image = entry.shopImage.first() %}&#xA;&#xA;    {% set shopImageTransform = craft.imager.transformImage(image, &#xA;    { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 } &#xA;    ) %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.shopUrl }}&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.url('shopImageTransform') }}&quot; alt=&quot;{{ entry.title }}&quot;/&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This snippet is appearing on a category page, e.g domain.com/category/fashion.&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="4990" LastEditDate="2017-07-11T16:59:27.910" LastActivityDate="2017-07-14T11:35:47.093" Title="Can't seem to output fields related to the current category page" Tags="&lt;assets&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21130" PostTypeId="1" CreationDate="2017-07-07T14:59:15.360" Score="2" ViewCount="231" Body="&lt;p&gt;On my cart page I have the coupon code form to apply discounts to the order. Underneath the form I want to list all the coupons applied to the cart with an button to remove each discount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As in the example template I can access the latest coupon applied to the cart, but am no sure how to list all that have been applied to the cart and how to remove a coupon if a customer wanted to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6740" LastActivityDate="2017-11-12T23:15:34.430" Title="View all discounts applied to a cart and remove discounts from cart" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21131" PostTypeId="2" ParentId="21125" CreationDate="2017-07-07T15:05:54.577" Score="1" Body="&lt;p&gt;I had a similar problem a while ago when a plugin listened for &lt;code&gt;onSaveUser&lt;/code&gt; and then saved the user itself, causing an infinite loop. Someone provided me something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onSaveUser', function(Event $event) {&#xA;    static $recursionLevel = 0;&#xA;    if ($recursionLevel == 0) {&#xA;        $recursionLevel++;&#xA;        // do your stuff&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-07-07T15:05:54.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21132" PostTypeId="2" ParentId="21115" CreationDate="2017-07-07T16:26:36.873" Score="2" Body="&lt;p&gt;I've ran into something similar, although it was using the entry ID. If you set the category and save the entry, and then upload an asset to that field on the entry does it save into the location you have set? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if the assets field is within a matrix you'll need to use &lt;em&gt;owner&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{owner.galleryCategory.first.slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2277" LastActivityDate="2017-07-07T16:26:36.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21134" PostTypeId="1" CreationDate="2017-07-07T20:02:22.690" Score="1" ViewCount="115" Body="&lt;p&gt;When adding &lt;code&gt;'extraAllowedFileExtensions' =&amp;gt; 'css'&lt;/code&gt; to &lt;code&gt;/craft/config/general.php&lt;/code&gt; it doesn't show up in the list below &lt;code&gt;Restrict allowed file types?&lt;/code&gt;. Am I missing something? Is it just not &quot;restrictable&quot; to an added filetype?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2017-07-07T20:45:19.977" Title="Additions to extraAllowedFileExtensions not showing up in the checkbox list" Tags="&lt;templating&gt;&lt;assets&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21136" PostTypeId="2" ParentId="21134" CreationDate="2017-07-07T20:45:19.977" Score="1" Body="&lt;p&gt;It's not &quot;restrictable&quot;, because you just added it. Why would you then go back and restrict it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;extraAllowedFileExtensions&lt;/code&gt; doesn't change the checkbox list at all. It simply allows you to upload files &lt;em&gt;in addition&lt;/em&gt; to what is available on that list.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-07-07T20:45:19.977" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21138" PostTypeId="2" ParentId="21119" CreationDate="2017-07-09T00:29:59.940" Score="1" Body="&lt;p&gt;I figure out a solution thanks to Brad's suggestion to update the asset indexes. That allowed me to find all assets on the server that contained a partial match to my LogID number which I am passing in a URL string. &lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2017-07-09T00:29:59.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21140" PostTypeId="1" AcceptedAnswerId="21141" CreationDate="2017-07-09T18:07:57.013" Score="2" ViewCount="523" Body="&lt;h2&gt;Scenario&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'm using the &lt;a href=&quot;http://vee-validate.logaretm.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;VeeValidate&lt;/a&gt; &lt;a href=&quot;https://vuejs.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vue.js&lt;/a&gt; plugin to validate a Craft front-end form that contains a &lt;a href=&quot;https://imperavi.com/redactor/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor&lt;/a&gt; rich text field. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Validation of the rich text field fails because Redactor adds &lt;code&gt;style=&quot;display: none;&quot;&lt;/code&gt; to &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2017-07-09T18:07:57.013" Title="How can I validate a Redactor rich text field in a front-end form using the VeeValidate Vue.js plugin?" Tags="&lt;redactor&gt;&lt;javascript&gt;&lt;validation&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21141" PostTypeId="2" ParentId="21140" CreationDate="2017-07-09T18:07:57.013" Score="2" Body="&lt;h2&gt;Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Add the &lt;a href=&quot;https://imperavi.com/redactor/docs/callbacks/sync/#callback-sync&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor &lt;code&gt;Sync&lt;/code&gt; callback function&lt;/a&gt; to the Vue.js instance to synchronize code/data between Redactor’s visual layer (UI) and the form’s &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the Redactor documentation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Visual layer contains multiple temporary tags that allow visual editing. Synchronization with textarea inserts clean code to the textarea, removing all temporary tags, styles and attributes. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Solution source: &lt;a href=&quot;https://github.com/baianat/vee-validate/issues/603&quot; rel=&quot;nofollow noreferrer&quot;&gt;Validate Redactor WYSIWYG Textarea Field #603&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Vue.js/VeeValidate Component&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;// in your component.&#xA;export default {&#xA;    mounted() {&#xA;        var vm = this;&#xA;        $('#redactor').redactor({&#xA;            callbacks: {&#xA;                sync: function () {&#xA;                    vm.$validator.validate('fieldName',  this.code.get());&#xA;                }&#xA;            }   &#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Vue.js/VeeValidate CDN&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    Vue.use(VeeValidate);&#xA;&#xA;    new Vue({&#xA;        el: '#app',&#xA;        delimiters: ['${', '}'],&#xA;&#xA;        mounted: function() {&#xA;            var vm = this;&#xA;            $('#redactor').redactor({&#xA;                callbacks: {&#xA;                    sync: function () {&#xA;                        vm.$validator.validate('fieldName',  this.code.get());&#xA;                    }&#xA;                }   &#xA;            });&#xA;        }&#xA;    });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="298" LastActivityDate="2017-07-09T18:07:57.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21142" PostTypeId="1" AcceptedAnswerId="21143" CreationDate="2017-07-10T06:49:08.730" Score="2" ViewCount="816" Body="&lt;p&gt;I've got a Matrix block in my Latest News/Index template and I can't figure out how to only output the first instance of a block type field.&#xA;Here is my code, working great except it outputs the first 250 characters from ALL &lt;code&gt;{{block.newsContent}}&lt;/code&gt; content block fields not just the first. I know this is what my code is actually set up to do, but I can't figure out how to only output the first one!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.newsBlock %}&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'nbTitle' %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt; &amp;lt;h2&amp;gt; {{ block.newsTitle }} &amp;lt;/h2&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;            &amp;lt;h3&amp;gt;{{ entry.postDate | date(&quot;d-M-Y&quot;) }}&amp;lt;/h3&amp;gt;&#xA;&#xA;&#xA;        {% case 'nbContent' %}&#xA;&#xA;            &amp;lt;div class=&quot;news-content-index&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.newsContent | striptags | slice(0, 250) ~ '...' }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{{block.newsContent}}&lt;/code&gt; part outputs every instance of that field, but I only need the first, as it's the 'excerpt' intro to the complete article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the front end:&#xA;&lt;a href=&quot;https://www.ancamotion.com/latest-news&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ancamotion.com/latest-news&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="6288" LastEditorUserId="57" LastEditDate="2017-07-10T23:42:03.113" LastActivityDate="2017-07-10T23:42:03.113" Title="How to output only the first instance of a Matrix block type field" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21143" PostTypeId="2" ParentId="21142" CreationDate="2017-07-10T07:40:48.183" Score="3" Body="&lt;p&gt;You can either use external bool variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstNbContentDisplayed = false %}&#xA;{% for block in entry.newsBlock %}&#xA;    {% switch block.type %}&#xA;        {% case 'nbTitle' %}&#xA;            ...&#xA;        {% case 'nbContent' %}&#xA;            {% if not firstNbContentDisplayed %} &#xA;                {% set firstNbContentDisplayed = true %}&#xA;                ...&#xA;            {% endif %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or if possible in your case separate nbContent and limit it to 1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.newsBlock %}&#xA;    {% switch block.type %}&#xA;        {% case 'nbTitle' %}&#xA;            ...&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&#xA;{% for block in entry.newsBlock.type('nbContent').limit(1) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5818" LastActivityDate="2017-07-10T07:40:48.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21144" PostTypeId="2" ParentId="21142" CreationDate="2017-07-10T07:42:44.627" Score="2" Body="&lt;p&gt;I haven't tested this, but I think &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.newsBlock.type('blockType').limit(1) %}&#xA;    {{ block.title }}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ought to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not you could simply do what you're currently doing but also use a &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.first %}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;inside it to only spit out content from the first loop iteration.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2017-07-10T12:56:29.460" LastActivityDate="2017-07-10T12:56:29.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21145" PostTypeId="1" CreationDate="2017-07-10T11:34:28.513" Score="1" ViewCount="196" Body="&lt;p&gt;I'm fairly new to Craft so I could be missing out on some basics.&lt;/p&gt;&#xA;&lt;p&gt;I need to import an events feed (xml) using the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; plugin. The feed has some Link tags.&#xA;Ex.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;link rel=&amp;quot;sales&amp;quot; type=&amp;quot;text/html&amp;quot; href=&amp;quot;[LINK TO TICKETSHOP]&amp;quot; /&amp;gt;&#xA;&amp;lt;link rel=&amp;quot;image&amp;quot; href=&amp;quot;[LINK TO IMAGE]&amp;quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've got an Asset field but I can't properly set the Feed Element. It only shows &lt;code&gt;&amp;lt;link/@href&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;link/@type&amp;gt;&lt;/code&gt;. If I select @href then it goes though all the elements with @href and generates a lot of errors because some aren't assets.&lt;/p&gt;&#xA;&lt;p&gt;I've tried &lt;code&gt;&amp;lt;link/@rel=&amp;quot;image&amp;quot;&amp;gt;&lt;/code&gt; in the default value field but then it imports the same value for all the Events. So all the Entries end up with the same image.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to manually define the Feed Element?&lt;/p&gt;&#xA;" OwnerUserId="6970" LastEditorUserId="22" LastEditDate="2021-01-08T14:01:32.573" LastActivityDate="2021-01-08T14:01:32.573" Title="Manually override feed element in settings using the FeedMe plugin" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21146" PostTypeId="1" CreationDate="2017-07-10T12:56:26.573" Score="2" ViewCount="188" Body="&lt;p&gt;I’m trying to cut down the amount of database queries on the homepage of a site I’m working on, and am attempting to do some eager loading of an asset set in a supertable field. However, although the queries drop, the focus point no longer works when I do, so I think it’s not setup right. Can anyone explain what I’m doing wrong please?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set mainCarousel = entry.mainCarousel.find({&#xA; with: [&#xA; 'carouselImage'&#xA; ]&#xA;}) %}&#xA;{% for row in mainCarousel %}&#xA;{% set image = row.carouselImage[0] ?? null %}&#xA;{% set transformedImages = craft.imager.transformImage(image,&#xA;  [&#xA;      { width: 1920, ratio: 3/1, jpegQuality: 60 },&#xA;      { width: 1440, ratio: 3/1 },&#xA;      { width: 1024, ratio: 3/1 },&#xA;      { width: 750, ratio: 4/3, jpegQuality: 60 },&#xA;  ],&#xA;  {&#xA;      format: 'jpg',&#xA;      allowUpscale: false,&#xA;      mode: 'crop',&#xA;      jpegQuality: 80,&#xA;      position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%',&#xA;      interlace: true&#xA;  }&#xA;) %}&#xA;&amp;lt;div&amp;gt;&#xA; {% if image | length %}&#xA; &amp;lt;picture&amp;gt;&#xA;   &amp;lt;source srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot;&amp;gt;&#xA;   &amp;lt;img class=&quot;&quot;&#xA;        data-lazy=&quot;{{ siteUrl }}assets/placeholder.png&quot;&#xA;        src=&quot;{{ transformedImages[1].url }}&quot;&#xA;        sizes=&quot;100vw&quot;&#xA;        alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA; &amp;lt;/picture&amp;gt;&#xA; {% endif %}&#xA; &amp;lt;div class=&quot;overlay-box&quot;&amp;gt;&#xA;   &amp;lt;h2&amp;gt;{{ row.heading }}&amp;lt;/h2&amp;gt;&#xA;   &amp;lt;p&amp;gt;{{ row.text }}&amp;lt;/p&amp;gt;&#xA;   {% set button = row.button %}&#xA;   {% if button|length %}&amp;lt;a class=&quot;readmore&quot; href=&quot;{{ button.getUrl() }}&quot;&amp;gt;View Project&amp;lt;/a&amp;gt;{% endif %}&#xA; &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="3951" LastEditDate="2018-03-05T21:40:54.967" LastActivityDate="2018-03-05T21:40:54.967" Title="Eager Loading breaking focus point" Tags="&lt;eager-loading&gt;&lt;plugin-focuspoint&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21147" PostTypeId="1" AcceptedAnswerId="21154" CreationDate="2017-07-10T13:44:37.660" Score="1" ViewCount="679" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; plugin and Craft for image compression. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imagerConfig = { jpegQuality: 80, pngCompressionLevel: 4 } %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In another part of my code, I want to do something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set largeLogo = craft.imager.transformImage((logo.getUrl('LargeLogo')), imagerConfig) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I want to do something like this to &lt;code&gt;imagerConfig&lt;/code&gt; above: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set width = {width: 1000} %} or {%set widthRatio = {width: 1000, ratio: 4/2} %}&#xA;imagerConfig.Add(width) //what's the proper syntax for adding an item or even another object(like widthRatio above) to imagerConfig here? &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6969" LastEditorUserId="57" LastEditDate="2017-07-11T00:09:00.883" LastActivityDate="2017-07-11T00:16:46.597" Title="How do I add a new item or object to an existing object?" Tags="&lt;templating&gt;&lt;plugin-imager&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21148" PostTypeId="2" ParentId="18608" CreationDate="2017-07-10T13:49:18.420" Score="4" Body="&lt;p&gt;After some research I found out that this problem has no simple solution (unfortunately). Check &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint/issues/10&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/smcyr/Craft-FocusPoint/issues/10&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution would be not to use eager loading (obvious). Another solution could be using Craft3 (no plugin needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution I used was Focal Point (&lt;a href=&quot;https://github.com/aelvan/FocalPointField-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/FocalPointField-Craft&lt;/a&gt;). Focal Point is a tool that can be used with Eager Loading. Focal Point creates a focus point on every asset, that means not on every asset field.&lt;/p&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2017-07-10T13:49:18.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21150" PostTypeId="2" ParentId="21146" CreationDate="2017-07-10T14:44:40.637" Score="1" Body="&lt;p&gt;It has been answered in another thread here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18608/using-focuspoint-with-eager-loading?noredirect=1#comment29323_18608&quot;&gt;enter link description here&lt;/a&gt;, but basically you have to use another focal point plugin called &lt;a href=&quot;https://github.com/aelvan/FocalPointField-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;FocalPointField-Craft&lt;/a&gt; which then works with eager loading. And I've found also uses a lot less database queries than the other plugin too.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-07-10T14:44:40.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21151" PostTypeId="1" AcceptedAnswerId="21153" CreationDate="2017-07-10T16:02:20.190" Score="5" ViewCount="632" Body="&lt;p&gt;When Craft tries to apply an update, it tries to back up the database. Although that's great in general, backing up a large database using PHP requires a lot of memory and resources that might not be available in the hosting environment or the client does not have enough access to make any related adjustments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a setting of some kind that would prevent Craft CMS from backing up the database when updating? I already use a command line script to backup the database before applying an update.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastEditorUserId="5881" LastEditDate="2017-07-11T09:12:04.250" LastActivityDate="2017-07-11T09:12:04.250" Title="Is there a way to prevent Craft from backing up the database before updating?" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21152" PostTypeId="1" CreationDate="2017-07-10T16:06:54.733" Score="2" ViewCount="99" Body="&lt;p&gt;I'm currently looking to implement the One ShipStation plugin for my Craft Commerce site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went through the Custom store settings on Shipstation.com, making sure they matched the settings in the Plugin settings page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shipstation requires a XML page to work, and the One Shipstation provides the URL &quot;&lt;a href=&quot;https://www.mywebsite.com/actions/oneShipStation/orders/process&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mywebsite.com/actions/oneShipStation/orders/process&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Testing the Connection from Shipstation's side is unsuccessful, and returns a &lt;del&gt;404 error, saying that the URL cannot be found.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a few changes, and no longer receive a 404 error. This change came from changing some of the NGINX configurations for my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I changed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;        try_files $uri $uri/ /index.php?$args;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I made sure that all url inquiries were being redirected to https, which cleared up some other issues I was having.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now receiving a 500 error, and this is what the log spits out&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/07/11 15:21:53 [error] [php] Trying to get property of non-object (/var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php:108)&#xA;Stack trace:&#xA;#0 /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php(266): Craft\OneShipStation_XmlService-&amp;gt;valueFromMappingAndModel()&#xA;#1 /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php(117): Craft\OneShipStation_XmlService-&amp;gt;mapCraftModel()&#xA;#2 /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php(91): Craft\OneShipStation_XmlService-&amp;gt;item()&#xA;#3 /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php(66): Craft\OneShipStation_XmlService-&amp;gt;items()&#xA;#4 /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php(22): Craft\OneShipStation_XmlService-&amp;gt;order()&#xA;#5 /var/www/mywebsite.com/craft/plugins/oneshipstation/controllers/OneShipStation_OrdersController.php(65): Craft\OneShipStation_XmlService-&amp;gt;orders()&#xA;#6 /var/www/mywebsite.com/craft/plugins/oneshipstation/controllers/OneShipStation_OrdersController.php(22): Craft\Oneshipstation_OrdersController-&amp;gt;getOrders()&#xA;#7 unknown(0): Craft\Oneshipstation_OrdersController-&amp;gt;actionProcess()&#xA;#8 /var/www/mywebsite.com/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs()&#xA;#9 /var/www/mywebsite.com/craft/app/framework/web/actions/CInlineAction.php(47): CInlineAction-&amp;gt;runWithParamsInternal()&#xA;#10 /var/www/mywebsite.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#11 /var/www/mywebsite.com/craft/app/framework/web/CController.php(286): Craft\Oneshipstation_OrdersController-&amp;gt;runAction()&#xA;#12 /var/www/mywebsite.com/craft/app/framework/web/CController.php(265): Craft\Oneshipstation_OrdersController-&amp;gt;runActionWithFilters()&#xA;#13 /var/www/mywebsite.com/craft/app/framework/web/CWebApplication.php(282): Craft\Oneshipstation_OrdersController-&amp;gt;run()&#xA;#14 /var/www/mywebsite.com/craft/app/etc/web/WebApp.php(817): Craft\WebApp-&amp;gt;runController()&#xA;#15 /var/www/mywebsite.com/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#16 /var/www/mywebsite.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#17 /var/www/mywebsite.com/craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#18 /var/www/mywebsite.com/public/index.php(19): require_once()&#xA;REQUEST_URI=/actions/oneShipStation/orders/process?SS-UserName=username&amp;amp;SS-Password=p@$$w0rd&amp;amp;action=export&amp;amp;start_date=07%2f11%2f2017+15%3a16&amp;amp;end_date=07%2f11%2f2017+15%3a21&amp;amp;page=1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which points to this portion of the plugin's services, specifically the line that starts &quot;$item_mapping = ...&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function item(\SimpleXMLElement $xml, Commerce_LineItemModel $item, $name='Item') {&#xA;        $item_xml = $xml-&amp;gt;getName() == $name ? $xml : $xml-&amp;gt;addChild($name);&#xA;&#xA;        $item_mapping = ['SKU'              =&amp;gt; ['callback' =&amp;gt; function($item) { return $item-&amp;gt;getPurchasable()-&amp;gt;sku; }],&#xA;                         'Name'             =&amp;gt; 'description',&#xA;                         'Weight'           =&amp;gt; ['callback' =&amp;gt; function($item) { return round($item-&amp;gt;weight, 2); },&#xA;                                                'cdata' =&amp;gt; false],&#xA;                         'Quantity'         =&amp;gt; ['field' =&amp;gt; 'qty',&#xA;                                                'cdata' =&amp;gt; false],&#xA;                         'UnitPrice'        =&amp;gt; ['callback' =&amp;gt; function($item) { return round($item-&amp;gt;salePrice, 2); },&#xA;                                                'cdata' =&amp;gt; false]&#xA;        ];&#xA;        $this-&amp;gt;mapCraftModel($item_xml, $item_mapping, $item);&#xA;&#xA;        $item_xml-&amp;gt;addChild('WeightUnits', 'Grams');&#xA;&#xA;        if (isset($item-&amp;gt;snapshot['options'])) {&#xA;            $option_xml = $this-&amp;gt;options($item_xml, $item-&amp;gt;snapshot['options']);&#xA;        }&#xA;&#xA;        return $item_xml;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe the previous error may have resulted from an incomplete order model, which may have been resolved by a colleague working on another portion of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 14-07-17:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 500 error I now receive is the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Call to undefined function Craft\dom_import_simplexml() in /var/www/mywebsite.com/craft/plugins/oneshipstation/services/OneShipStation_XmlService.php:404&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6165" LastEditorUserId="6165" LastEditDate="2017-07-14T14:57:49.140" LastActivityDate="2017-07-14T14:57:49.140" Title="One ShipStation Plugin - 404 Error - UPDATED 14-07-17" Tags="&lt;plugins&gt;&lt;url&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21153" PostTypeId="2" ParentId="21151" CreationDate="2017-07-10T16:16:16.933" Score="4" Body="&lt;p&gt;Yes you can use the &lt;code&gt;backupDbOnUpdate&lt;/code&gt; config setting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings#backupDbOnUpdate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-10T16:16:16.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21154" PostTypeId="2" ParentId="21147" CreationDate="2017-07-11T00:16:46.597" Score="1" Body="&lt;p&gt;When you use the Twig curly brace &lt;code&gt;{}&lt;/code&gt;, key/value pair syntax like you've got &lt;code&gt;imagerConfig&lt;/code&gt; set to, you're using the Twig &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/templates.html#literals&quot; rel=&quot;nofollow noreferrer&quot;&gt;hash&lt;/a&gt; literal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Twig, if you want to add to an array or hash after it has already been created, you can use the &lt;a href=&quot;https://twig.sensiolabs.org/doc/2.x/filters/merge.html#merge&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imagerConfig = { jpegQuality: 80, pngCompressionLevel: 4 } %}&#xA;&#xA;{% set width = { width: 1000 } %}&#xA;&#xA;{% set imagerConfig = imagerConfig|merge(width) %}&#xA;&#xA;{% set largeLogo = craft.imager.transformImage((logo.getUrl('LargeLogo')), imagerConfig) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-11T00:16:46.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21155" PostTypeId="2" ParentId="21079" CreationDate="2017-07-11T04:38:47.060" Score="1" Body="&lt;p&gt;As mentioned previously, addresses can not be edited on the order once the order is complete (from the front-end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now completed order's addresses can only be edited by admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way around that at the moment would be to create your own plugin controller action that your form would post to. The controller action would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSave()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $this-&amp;gt;requireLogin();&#xA;    $id = craft()-&amp;gt;request-&amp;gt;getRequiredPost('id');&#xA;    // IMPORTANT - Validate the current user is allowed to update the address $id&#xA;&#xA;    $address = craft()-&amp;gt;commerce_addresses-&amp;gt;getAddressById($id);&#xA;&#xA;    if (!$address)&#xA;    {&#xA;        $address = new Commerce_AddressModel();&#xA;    }&#xA;&#xA;    // Shared attributes&#xA;    $attrs = [&#xA;        'attention',&#xA;        'title',&#xA;        'firstName',&#xA;        'lastName',&#xA;        'address1',&#xA;        'address2',&#xA;        'city',&#xA;        'zipCode',&#xA;        'phone',&#xA;        'alternativePhone',&#xA;        'businessName',&#xA;        'businessTaxId',&#xA;        'businessId',&#xA;        'countryId',&#xA;        'stateValue'&#xA;    ];&#xA;    foreach ($attrs as $attr)&#xA;    {&#xA;        $address-&amp;gt;$attr = craft()-&amp;gt;request-&amp;gt;getPost($attr);&#xA;    }&#xA;&#xA;    // Save it&#xA;    if (craft()-&amp;gt;commerce_addresses-&amp;gt;saveAddress($address))&#xA;    {&#xA;&#xA;        if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest)&#xA;        {&#xA;            $this-&amp;gt;returnJson(['success' =&amp;gt; true, 'address' =&amp;gt; $address]);&#xA;        }&#xA;&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Address saved.'));&#xA;&#xA;        // save address ID to the order (shipping or billing)&#xA;&#xA;        $this-&amp;gt;redirectToPostedUrl();&#xA;    }&#xA;    else&#xA;    {&#xA;        if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest)&#xA;        {&#xA;            $this-&amp;gt;returnJson([&#xA;                'error'  =&amp;gt; Craft::t(&quot;Couldn’t save address.&quot;),&#xA;                'errors' =&amp;gt; $address-&amp;gt;errors&#xA;            ]);&#xA;        }&#xA;&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('Couldn’t save address.'));&#xA;    }&#xA;&#xA;    // Send the model back to the template&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(['address' =&amp;gt; $address]);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T04:38:47.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21156" PostTypeId="2" ParentId="16146" CreationDate="2017-07-11T04:40:10.913" Score="1" Body="&lt;p&gt;Its likely that the order was made while a guest user, then signed up, so the guest order was then associated with the new user - but the addresses used in that guest order don't get copied to the address book of the new user.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T04:40:10.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21157" PostTypeId="2" ParentId="20461" CreationDate="2017-07-11T04:49:45.037" Score="1" Body="&lt;p&gt;A part from the 'tax included in price' option within a tax rate, there is no option to include taxes in the price of the item on the front-end. Tax is calculated in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to add the tax to the product's price before the cart, you would need to do so in twig/plugin yourself.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T04:49:45.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21158" PostTypeId="2" ParentId="21104" CreationDate="2017-07-11T04:55:39.913" Score="1" Body="&lt;p&gt;At the moment, both are not possible. The order is locked from recalculation when the order is marked as completed - the final price being locked in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a future release we will introduce the concept of order editing after order completion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, you could manually insert an adjustment row into the database, along with the changes to the order's &lt;code&gt;order.baseShippingCost&lt;/code&gt; but you would need to make sure the &lt;code&gt;order.totalPrice&lt;/code&gt; and other calculated fields would also be updated in the database to make the order internally consistent.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T04:55:39.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21159" PostTypeId="2" ParentId="20034" CreationDate="2017-07-11T04:59:23.060" Score="2" Body="&lt;p&gt;Answer is yes, you could use an adjuster to try and make the price &quot;even&quot; while in the cart.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T04:59:23.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21160" PostTypeId="2" ParentId="19744" CreationDate="2017-07-11T05:06:11.220" Score="1" Body="&lt;p&gt;Probably easiest to show all the other variants available on the cart page next to the line item, then use ajax to remove the current line item, and add the new variant (with same line item options like qty, notes and options).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that makes sense.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-11T05:06:11.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21161" PostTypeId="1" CreationDate="2017-07-11T05:49:57.077" Score="0" ViewCount="946" Body="&lt;p&gt;I'm running Vagrant/Virtual Box on a Windows 10 host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I originally installed Craft on a Vagrant Scotch Box (&lt;a href=&quot;https://box.scotch.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://box.scotch.io/&lt;/a&gt;). The admin panel was running a little slow so I tried installing in on a Laravel Homestead box after reading that many developers were using this solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had many problems getting this to work, and when I did get it working the performance problems were worse than with my original installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First problem was the missing mcrypt extension in PHP 7. If you Google for a solution, you will see this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php7.1-mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This command, although it runs ok does not result in the extension actually being installed. phpinfo shows that the extension is still not available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried enabling Apache using the Homestead Yaml settings to see if that made any difference. It did not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing an update and an upgrade in the Ubuntu shell, I was finally able to get the mcrypt extension running with a slightly different command: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php-mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After this I was able to run the Craft installer, but the site was running even slower, CSS files for the admin panel were intermittently failing to load, and database requests were extremely slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started seeing weird MySQL errors, which were apparently a result of an incompatibility with the latest version of MySQL. This problem was resolved by adding the following to the my.cnf file in Ubuntu:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This change did not improve the performance issues however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I reverted back to Nginx to see if that would fix the problem. It did not. I then destroyed the vagrant box and started again with a brand new box. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time I was not able to get the mcrpyt extension running at all, using either form of the Ubuntu package installer commands. It kept hanging at one of the &quot;processing triggers&quot; steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Homestead works great for Laravel and the performance is snappy, but for me getting it to play nice with Craft has been a disaster. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to stay with Scotch Box for now, which runs on PHP 5.6 &amp;amp; MySQL 5.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The &quot;nfs&quot; setting is enabled for both of these vagrant boxes, and vagrant-winnfsd (1.3.1) is installed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be interested to know if anybody else had a similar experience and managed to get everything working?&lt;/p&gt;&#xA;" OwnerUserId="6975" LastEditorUserId="6975" LastEditDate="2017-07-11T11:44:25.077" LastActivityDate="2017-07-16T20:25:38.767" Title="Laravel Homestead installation nightmare" Tags="&lt;performance&gt;&lt;mcrypt&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21162" PostTypeId="1" AcceptedAnswerId="21163" CreationDate="2017-07-11T11:46:22.190" Score="1" ViewCount="146" Body="&lt;p&gt;I have a plugin that saves users into a registration group like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {&#xA;  //etc &#xA;  $groupId = '1';&#xA;  craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However if i listen for the user save event for the control panel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;  //etc &#xA;  $groupId = '1';&#xA;  craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesnt work. I also tried passing an array as groupId(s) but the group permission never gets ticked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way of assigning a new user saved in the back end to a specific permission group?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-02-21T23:45:13.543" Title="Save user group event in Control panel" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21163" PostTypeId="2" ParentId="21162" CreationDate="2017-07-11T15:14:01.023" Score="2" Body="&lt;p&gt;It happens here (maybe intended, maybe a bug):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1757&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1757&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For news users &lt;code&gt;$groupIds&lt;/code&gt; is an empty string, which means the expression &lt;code&gt;($groupIds !== null)&lt;/code&gt; becomes true. At line 1780 &lt;code&gt;$groupIds&lt;/code&gt; get passed to userGroups-&gt;assignUserToGroups() ... inside this method the &lt;code&gt;$groupIds&lt;/code&gt; variable is casted to an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually this overwrites the groups you've set by your onSaveUser event.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is a (dirty) hack that works&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;onSaveUser = function ($event) {&#xA;&#xA;   craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&#xA;   craft()-&amp;gt;params['noGroupReset'] = true;           &#xA;&#xA;};&#xA;&#xA;&#xA;&#xA;craft()-&amp;gt;userGroups-&amp;gt;onBeforeAssignUserToGroups = function ($event) {&#xA;&#xA;   $noGroupReset = (isset(craft()-&amp;gt;params['noGroupReset']) &amp;amp;&amp;amp; craft()-&amp;gt;params['noGroupReset'] === true);&#xA;&#xA;&#xA;   if (count($event-&amp;gt;params['groupIds']) == 0 &amp;amp;&amp;amp; $noGroupReset) {&#xA;      $event-&amp;gt;performAction = false; &#xA;   } &#xA;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4538" LastEditorUserId="57" LastEditDate="2018-02-21T23:45:13.543" LastActivityDate="2018-02-21T23:45:13.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21164" PostTypeId="2" ParentId="21152" CreationDate="2017-07-11T18:26:55.553" Score="1" Body="&lt;p&gt;It looks like you may be using an out of date version of the plugin. Can you try updating to the latest and see if you're still getting this error? &lt;a href=&quot;https://github.com/onedesign/oneshipstation/archive/master.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/onedesign/oneshipstation/archive/master.zip&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6979" LastActivityDate="2017-07-11T18:26:55.553" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21165" PostTypeId="1" CreationDate="2017-07-11T18:42:24.873" Score="1" ViewCount="261" Body="&lt;p&gt;I'm working on a site that was partially built by another dev and am having some trouble with Sprout Forms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's partially working but when I add a new field (sailSeries) to the template (it exists in the sprout forms control panel) I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named &quot;sailSeries&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Expanding on what the original dev has I added the sails series inside this for loop at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tab in form.getFieldLayout().getTabs() %}&#xA;    {% set fields = tab.getFields() %}&#xA;&#xA;    {% for field in fields %}&#xA;&#xA;      {% set required = field.required %}&#xA;      {% set tabId = field.tabId %}&#xA;&#xA;      {% set field = field.getField() %}&#xA;&#xA;      {% if field.handle == 'contactType' %}&#xA;       {% set dropdownField = field %}&#xA;      {% endif %}&#xA;&#xA;      various more fields&#xA;&#xA;&#xA;      {% if field.handle == 'sailSeries' %}&#xA;        {% set  sailSeries = field %}&#xA;      {% endif %}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The the code later in the template to have the field display:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;frm-row&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;section colm colm6&quot;&amp;gt;&#xA;&#xA;    {% set submittedDropdownValue = attribute(submittedEntry, sailSeries.handle) %}&#xA;&#xA;    &amp;lt;label class=&quot;field select&quot;&amp;gt;&#xA;      {{ sailSeries.name }}&#xA;        &amp;lt;select id=&quot;sailSeries&quot; name=&quot;sailSeries&quot;&amp;gt;&#xA;        {% for option in sailSeries.settings.options %}&#xA;            {% set defaultValue = option.default ? option.value : null %}&#xA;            {% set selectedDropdownValue = submittedDropdownValue != '' ? submittedDropdownValue : defaultValue %}&#xA;&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot; {% if selectedDropdownValue == option.value %}selected=&quot;selected&quot;{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;        &amp;lt;i class=&quot;arrow&quot;&amp;gt;&amp;lt;/i&amp;gt;                    &#xA;    &amp;lt;/label&amp;gt;  &#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- end section --&amp;gt; &#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.frm-row --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As soon as I add this in I get errors. Not sure why or how to troubleshoot. Please advise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Revised code and now I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;sailSeries&quot; does not exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;no clue why this is happening.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-09-25T21:46:48.203" Title="Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named" Tags="&lt;error-message&gt;&lt;plugin-sproutforms&gt;&lt;entrymodel&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21166" PostTypeId="1" CreationDate="2017-07-11T19:42:24.620" Score="1" ViewCount="60" Body="&lt;p&gt;I've used the contact form plugin many times with no issues. However I have a site set up on a Linode server and for some reason the from address that I have added in the contact form settings e.g. contactus@mydomain.com is being changed to contactus@localhost.localdomain when the email comes through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone any ideas what is causing this. I'm thinking it's a server setting but wanted to check the plugin wasn't causing anything weird to happen as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-07-11T20:13:41.880" Title="Contact Form email address set in the plugin's setting being changed by Linode server?" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21167" PostTypeId="2" ParentId="21166" CreationDate="2017-07-11T20:13:41.880" Score="1" Body="&lt;p&gt;Generally I've been dissatisfied with the craft cms contact form plugin. Fortunately, this doesn't &lt;em&gt;need&lt;/em&gt; to be handled with the CMS. I've been using third party tools such as &lt;a href=&quot;https://www.formbucket.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Formbucket&lt;/a&gt; to handle form submissions for several reasons.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Reliability is extremely important. Most clients will not tolerate any mistakes regarding lead generation in contact forms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Feature rich. Craft's contact form plugin is very barebones and ugly. With formbucket and other form submission collection tools, you can add as many fields as you want instead of segmenting &lt;code&gt;message&lt;/code&gt;. There is also honeypot and recaptcha fields to keep out spam.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know this is probably not the answer you were looking for, and I wish you the best with getting it to work, just wanted to let you know how i've been doing it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I don't work for Formbucket. &lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2017-07-11T20:13:41.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21168" PostTypeId="1" CreationDate="2017-07-11T21:13:48.763" Score="1" ViewCount="99" Body="&lt;p&gt;I've seen a number of answers prescribing how to sort across different sections...but I'm not seeing it work. Here's what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profileIds = craft.entries.section('profiles').order('profileBorn asc').ids() %}&#xA;{% set eventIds = craft.entries.section('events').order('eventDate asc').ids() %}&#xA;{% set timelineIds = profileIds|merge(eventIds) %}&#xA;{% set timeline = craft.entries.id(timelineIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set timeline = craft.entries.section(['profiles','events']).order('GREATEST(eventDate, profileBorn) desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for either, I'm doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in timeline %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In both cases, I get entries in the following order, with their &lt;code&gt;{{ entry.profileBorn }}&lt;/code&gt; or &lt;code&gt;{{ entry.eventDate }}&lt;/code&gt; shown here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1832-02-01 / events entry&lt;/li&gt;&#xA;&lt;li&gt;1830-01-01 / profiles entry&lt;/li&gt;&#xA;&lt;li&gt;1840-01-01 / profiles entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks like the SQL being generated by the first answer's suggestion, which is still outputting the event entry first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_profileBio`, `content`.`field_body`, `content`.`field_profileBorn`, `content`.`field_copyright`, `content`.`field_datePrecision`, `content`.`field_datePrecisionBorn`, `content`.`field_datePrecisionDied`, `content`.`field_profileDied`, `content`.`field_eventDate`, `content`.`field_mediaCaption`, `content`.`field_mediaPublicationDate`, `content`.`field_mediaSource`, `content`.`field_mediaTitle`, `content`.`field_siteTitle`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE (((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND ((elements.id=:elementsid1) OR (elements.id=:elementsid2) OR (elements.id=:elementsid3))) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2017-07-12 12:47:25') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2017-07-12 12:47:25')))) AND (elements_i18n.enabled = 1)&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY GREATEST(field_eventDate, field_profileBorn) asc LIMIT 100&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="187" LastEditDate="2017-07-12T12:49:22.627" LastActivityDate="2017-07-12T12:49:22.627" Title="Sorting by date field across sections not working" Tags="&lt;templating&gt;&lt;entries&gt;&lt;datetime&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21169" PostTypeId="2" ParentId="21168" CreationDate="2017-07-11T22:42:54.287" Score="1" Body="&lt;p&gt;Your second attempt is sound. I don’t really have an idea why it doesn’t work, but I bet it has to do with the SQL that is caused by setting the &lt;code&gt;section&lt;/code&gt; param to an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would try next is the following, kind of a merge of your ideas.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profileIds = craft.entries.section('profiles').limit(null).ids() %}&#xA;{% set eventIds = craft.entries.section('events').limit(null).ids() %}&#xA;&#xA;{% set idParam = profileIds|merge(eventIds) %}&#xA;&#xA;{% set timeline = craft.entries({&#xA;    id: idParam,&#xA;    order: 'GREATEST(eventDate, profileBorn) desc',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-07-11T22:42:54.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21170" PostTypeId="1" CreationDate="2017-07-12T03:11:00.013" Score="2" ViewCount="85" Body="&lt;p&gt;Working on site where there is events calendar of conferences and webinars. Users are (literally) all over the world. Trying to figure out how I am going to handle time zones. Factors:&#xA;- Fields I am using are two Date/time fields for start and end time + one lightswitch for all day events&#xA;- Content editors will inevitably want to input dates for where they are happening. If the conference is in Paris at 9am they want it to show Paris 9am no mater where website user is in world&#xA;- For webinars, they have opposite issue. They want the time shown to be relative to user's timezone.&#xA;- Users can download ICS link&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone developed a solution to this that works for users and content editors? &lt;/p&gt;&#xA;" OwnerUserId="6830" LastActivityDate="2017-07-12T03:11:00.013" Title="Timezone drama for events calendar" Tags="&lt;datetime&gt;&lt;events&gt;&lt;timezone&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21171" PostTypeId="1" AcceptedAnswerId="21181" CreationDate="2017-07-12T03:39:55.100" Score="4" ViewCount="845" Body="&lt;p&gt;This isn't Craft issue per se. But I was wondering if anyone can help me out. I’m trying to enable FastCGI Cache in my server. My nginx server block is coming from this helpful article: &lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/static-caching-with-craft-cms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The caching works because the site is now considerably faster. The issue is when I try to login in Craft's login page: &lt;code&gt;/admin/login&lt;/code&gt;, it goes to &lt;code&gt;/admin&lt;/code&gt; but it goes back to &lt;code&gt;/admin/login/&lt;/code&gt; not to the dashboard page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have reached out to the article's author and he responded that,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;it isn't properly &lt;em&gt;not&lt;/em&gt; stripping cookies off of the admin cp requests.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's my server block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fastcgi_cache_path /etc/nginx/cache/site levels=1:2 keys_zone=SITE:100m inactive=30m;&#xA;&#xA;server {&#xA;    listen 80;&#xA;    access_log /var/log/nginx/site.access.log;&#xA;    error_log  /var/log/nginx/site.error.log;&#xA;    root /var/www/site/public;&#xA;    index index.html index.htm index.php;&#xA;    charset utf-8;&#xA;    ssi on;&#xA;    server_name site.ac;&#xA;    #404 error handler&#xA;    error_page 404 /404.html;&#xA;    error_page 500 502 503 504 /50x.html;&#xA;    location = /50x.html {&#xA;        root /usr/share/nginx/html;&#xA;    }&#xA;    #Cache everything by default&#xA;    fastcgi_cache_key &quot;$scheme$request_method$host$request_uri&quot;;&#xA;    add_header X-Cache $upstream_cache_status;&#xA;    set $no_cache 0;&#xA;    if ($request_method = POST)&#xA;    {&#xA;        set $no_cache 1;&#xA;    }&#xA;    if ($request_uri ~* &quot;/admin/|eecms/|actions/|cpresources/&quot;)&#xA;    {&#xA;        set $no_cache 1;&#xA;    }&#xA;    location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;    # Craft-specific location handlers to ensure AdminCP requests route through index.php&#xA;    # If you change your `cpTrigger`, change it here as well&#xA;    location ^~ /admin {&#xA;        try_files $uri $uri/ @phpfpm_nocache;&#xA;    }&#xA;    location ^~ /index.php/admin {&#xA;        try_files $uri $uri/ @phpfpm_nocache;&#xA;    }&#xA;    location ^~ /cpresources {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;    location ^~ /eecms {&#xA;        try_files $uri $uri/ @phpfpm_nocache;&#xA;    }&#xA;    location ^~ /index.php/eecms {&#xA;        try_files $uri $uri/ @phpfpm_nocache;&#xA;    }&#xA;    #php-fpm configuration&#xA;    location ~ [^/]\.php(/|$) {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;        fastcgi_param PATH_INFO $fastcgi_path_info;&#xA;        # php-fpm parameters&#xA;        fastcgi_param HTTP_PROXY &quot;&quot;;&#xA;        fastcgi_param CRAFTENV_CRAFT_ENVIRONMENT &quot;&quot;;&#xA;        fastcgi_param CRAFTENV_DB_HOST &quot;127.0.0.1&quot;;&#xA;        fastcgi_param CRAFTENV_DB_NAME &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_DB_USER &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_DB_PASS &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_SITE_URL &quot;http://site.ac/&quot;;&#xA;        fastcgi_param CRAFTENV_BASE_URL &quot;http://site.ac/&quot;;&#xA;        fastcgi_param CRAFTENV_BASE_PATH &quot;/var/www/site/public/&quot;;&#xA;        # shared php-fpm configuration&#xA;        fastcgi_intercept_errors off;&#xA;        fastcgi_buffer_size 16k;&#xA;        fastcgi_buffers 4 16k;&#xA;        fastcgi_connect_timeout 300;&#xA;        fastcgi_send_timeout 300;&#xA;        fastcgi_read_timeout 300;&#xA;        # FastCGI Cache settings&#xA;        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;&#xA;        fastcgi_cache SITE;&#xA;        fastcgi_hide_header Set-Cookie;&#xA;        fastcgi_cache_valid 200 30m;&#xA;        fastcgi_cache_use_stale updating error timeout invalid_header http_500;&#xA;        fastcgi_cache_bypass $no_cache;&#xA;        fastcgi_no_cache $no_cache;&#xA;    }&#xA;    # php-fpm configuration for non-cached content&#xA;    location @phpfpm_nocache {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;        fastcgi_param SCRIPT_FILENAME $document_root/index.php;&#xA;        fastcgi_param PATH_INFO $query_string;&#xA;        # php-fpm parameters&#xA;        fastcgi_param HTTP_PROXY &quot;&quot;;&#xA;        fastcgi_param CRAFTENV_CRAFT_ENVIRONMENT &quot;&quot;;&#xA;        fastcgi_param CRAFTENV_DB_HOST &quot;127.0.0.1&quot;;&#xA;        fastcgi_param CRAFTENV_DB_NAME &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_DB_USER &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_DB_PASS &quot;x&quot;;&#xA;        fastcgi_param CRAFTENV_SITE_URL &quot;http://site.ac/&quot;;&#xA;        fastcgi_param CRAFTENV_BASE_URL &quot;http://site.ac/&quot;;&#xA;        fastcgi_param CRAFTENV_BASE_PATH &quot;/var/www/site/public/&quot;;&#xA;        # shared php-fpm configuration&#xA;        fastcgi_intercept_errors off;&#xA;        fastcgi_buffer_size 16k;&#xA;        fastcgi_buffers 4 16k;&#xA;        fastcgi_connect_timeout 300;&#xA;        fastcgi_send_timeout 300;&#xA;        fastcgi_read_timeout 300;&#xA;        # No FastCGI Cache&#xA;        fastcgi_cache_bypass 1;&#xA;        fastcgi_no_cache 1;&#xA;    }&#xA;    location ~ /\.ht {&#xA;        deny all;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope someone can shed some light on this issue I'm having. Any suggestions or comments is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2018-11-03T23:04:39.480" Title="Static page caching using Nginx FastCGI Cache with CraftCMS" Tags="&lt;cache&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21174" PostTypeId="1" AcceptedAnswerId="21178" CreationDate="2017-07-12T11:53:03.490" Score="2" ViewCount="57" Body="&lt;p&gt;My customer wants a videoplaylist for users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Idealy I'd like to have a assets relation field for the playlist and relate all the videos in said playlist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is if a user wants the same video several times in the playlist. &#xA;( like in a loop ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know it's only possible to relate an entry/asset once in the same relation field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution for me would be to add a matrix-block for each video in the playlist, but since there are thousands of playlists the db grows way more than expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without matrix field: around 30MB&#xA;With matrix blocks: around 200MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site slowed down quite a bit and the searchindex table grew to about 80MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way to implement this or a ideally a way to relate an entry several time in one field?&lt;/p&gt;&#xA;" OwnerUserId="4603" LastActivityDate="2017-07-12T17:00:52.137" Title="Can I set the same relation in a field multiple times?" Tags="&lt;relations&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21177" PostTypeId="1" CreationDate="2017-07-12T15:39:03.740" Score="1" ViewCount="203" Body="&lt;p&gt;I have found the section in settings where I can set the URL Prefix for an asset source using a CNAME and pointing to the relative S3 bucket where the file actually lives but I am using a multi site environment so I need the value of the URL Prefix to be dynamic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried setting it to &lt;code&gt;assets.{{ craft()-&amp;gt;request-&amp;gt;getServerName() }}&lt;/code&gt;, also have tried &lt;code&gt;assets.{% craft()-&amp;gt;request-&amp;gt;getServerName() %}&lt;/code&gt;but that is what's getting spit out on the page (asset url as rendered on page looks like &lt;code&gt;assets.{% craft()-&amp;gt;request-&amp;gt;getServerName() %}images/home-banner.jpg&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make Craft parse this field's dynamic value? The statement isn't parsed as it would be if it was in a Twig template.&lt;/p&gt;&#xA;" OwnerUserId="6978" LastEditorUserId="57" LastEditDate="2017-07-12T18:31:26.627" LastActivityDate="2017-08-11T20:02:02.973" Title="Use subdomain for S3 assets in multi-site Craft installation" Tags="&lt;templating&gt;&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21178" PostTypeId="2" ParentId="21174" CreationDate="2017-07-12T17:00:52.137" Score="2" Body="&lt;p&gt;You're right, this can only be accomplished with a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, you could probably accomplish what you need via a &lt;strong&gt;custom field type&lt;/strong&gt;. You'd need to create a custom plugin (obviously), but you could probably build something that simply stores an &lt;em&gt;array of asset IDs&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[12,33,42,10,10,10]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I won't diver deeper into what the mechanics of that plugin &amp;amp; field type should be... that's a bit beyond the scope of this question.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-07-12T17:00:52.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21179" PostTypeId="2" ParentId="21177" CreationDate="2017-07-12T18:44:56.573" Score="1" Body="&lt;p&gt;Your example of setting the S3 &quot;URL Prefix&quot; setting to something dynamic won't work because there are only a few settings in the Control Panel that Craft parses for dynamic Twig content and that isn't one of them.  i.e. in an Asset Field's &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upload Location&lt;/a&gt;, Section Title/URL Formats, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly, I don't think there currently is a way to do that in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be possible in the upcoming &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3&lt;/a&gt; by &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/configuration.md#overriding-volume-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;overriding the setting&lt;/a&gt; in &lt;code&gt;config/volumes.php&lt;/code&gt; and doing your dynamic logic from PHP.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-12T18:44:56.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21181" PostTypeId="2" ParentId="21171" CreationDate="2017-07-13T03:58:38.510" Score="4" Body="&lt;p&gt;The issue had something to do with &lt;strong&gt;PATH_INFO&lt;/strong&gt;. Adding '&lt;strong&gt;usePathInfo =&gt; true&lt;/strong&gt;' in &lt;strong&gt;general.php&lt;/strong&gt; fixed the issue. Here's the detailed explanation from Craft docs: &lt;a href=&quot;https://craftcms.com/support/enable-path-info&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/enable-path-info&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2017-07-13T03:58:38.510" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21182" PostTypeId="1" AcceptedAnswerId="21185" CreationDate="2017-07-13T05:20:27.430" Score="1" ViewCount="92" Body="&lt;p&gt;I would like to display a list of category.&#xA;I can display the information inside a category like slug or title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I dont know how to display a category field inside a category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for category in craft.categories.group('handle') %}&#xA;       &amp;lt;p&amp;gt; {{category.title}} &amp;lt;/p&amp;gt;&#xA;       &amp;lt;p&amp;gt; {{category.title}} &amp;lt;/p&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IsaSx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IsaSx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6990" LastActivityDate="2017-07-13T10:19:31.730" Title="How can I display category title inside another category" Tags="&lt;category&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21183" PostTypeId="1" AcceptedAnswerId="21205" CreationDate="2017-07-13T07:15:02.490" Score="2" ViewCount="942" Body="&lt;p&gt;EDIT 3: Started using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;imager&lt;/a&gt; and no longer have the problem. It's not a real answer to the problem but solves the problem.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is the situation that has me pulling my hairs... I've looked at other related Q&amp;amp;A's but can't seem to distill a solution for the issue I'm facing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to apply an image transform but I get a link like &lt;code&gt;/cpresources/404?x=TBKkjeyyP&lt;/code&gt; returned. Also, no image is being generated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Files can be uploaded trough the backend just fine, can be linked to an entry and can be shown without applying the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers as to what is going wrong? I'll gladly provide additional information if/when needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My setup is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Using Craft CMS 2.6.2986 on apache&lt;/li&gt;&#xA;&lt;li&gt;3 locales configured (nl, en, fr)&lt;/li&gt;&#xA;&lt;li&gt;local storage (File System Path: &lt;code&gt;uploads/&lt;/code&gt;&amp;amp; url:  &lt;code&gt;{baseUrl}uploads/&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;relevant config below (using process described &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;General config: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// All environments&#xA;'*' =&amp;gt; array(&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'overridePhpSessionLocation' =&amp;gt; true,&#xA;    'usePathInfo' =&amp;gt; true,&#xA;    'cacheDuration' =&amp;gt; false,&#xA;    'useEmailAsUsername' =&amp;gt; true,&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'nl' =&amp;gt; getenv('CRAFTENV_SITE_URL').'nl/',&#xA;        'fr' =&amp;gt; getenv('CRAFTENV_SITE_URL').'fr/',&#xA;        'en' =&amp;gt; getenv('CRAFTENV_SITE_URL').'en/',&#xA;    ),&#xA;    'craftEnv' =&amp;gt; CRAFT_ENVIRONMENT,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'baseUrl'  =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;        'basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH'),&#xA;    ),&#xA;    // development environment&#xA;    'development'  =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'enableTemplateCaching' =&amp;gt; false,&#xA;        'allowAutoUpdates' =&amp;gt; true,&#xA;    );&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Relevant CRAFT_ENV settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'SITE_URL' =&amp;gt; $protocol . $_SERVER['HTTP_HOST'] . '/',&#xA;&#xA;'BASE_URL' =&amp;gt; $protocol . $_SERVER['HTTP_HOST'] . '/',&#xA;&#xA;'BASE_PATH' =&amp;gt; realpath(dirname(__FILE__)) . '/www/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Part of the code applying the transform:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = blog.previewImage.first() %}&#xA;{% if thumb %}&#xA;    &amp;lt;img src=&quot;{{ thumb.getUrl(&quot;blogPreview&quot;) }}&quot; width=&quot;{{ thumb.getWidth(&quot;blogPreview&quot;) }}&quot; height=&quot;{{ thumb.getHeight(&quot;blogPreview&quot;) }}&quot;&amp;gt;                     &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: relevant log entries&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Level warning&#xA;  Category    application&#xA;  Message [Forced] Image “gasmeters.png” could not be found.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Level trace&#xA;  Category    system.db.CDbCommand&#xA;  Message Executing SQL: DELETE FROM &lt;code&gt;craft_assettransformindex&lt;/code&gt; WHERE id = :id. Bound with :id='70'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-07-14T08:44:19.720" LastActivityDate="2017-07-27T15:53:33.207" Title="Applying an image transform returns a 404 cpresources URL" Tags="&lt;templating&gt;&lt;image-transforms&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21184" PostTypeId="2" ParentId="19693" CreationDate="2017-07-13T07:42:17.753" Score="1" Body="&lt;p&gt;Make sure that your /craft/config/general.php has the right reference to the plugin. If you have 'internalAssetsUrl' =&gt; &quot;&lt;a href=&quot;http://website.loc/media/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website.loc/media/&lt;/a&gt;&quot;, then you need to change the InternalAssetsPlugin.php-file from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'internal/(?P&amp;lt;id&amp;gt;.\d*)' =&amp;gt; array('action' =&amp;gt; &#xA;'InternalAssets/Assets/download'),&#xA;'internal/(?P&amp;lt;directory&amp;gt;.*)/(?P&amp;lt;name&amp;gt;.*)' =&amp;gt; array('action' =&amp;gt; &#xA;'InternalAssets/Assets/view')&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;'media/(?P&amp;lt;id&amp;gt;.\d*)' =&amp;gt; array('action' =&amp;gt; 'InternalAssets/Assets/download'),&#xA;'media/(?P&amp;lt;directory&amp;gt;.*)/(?P&amp;lt;name&amp;gt;.*)' =&amp;gt; array('action' =&amp;gt; &#xA;'InternalAssets/Assets/view')&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in other words, just change 'internal' to 'media'.&lt;/p&gt;&#xA;" OwnerUserId="5129" LastActivityDate="2017-07-13T07:42:17.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21185" PostTypeId="2" ParentId="21182" CreationDate="2017-07-13T10:19:31.730" Score="1" Body="&lt;p&gt;If I get you right you have a category select field inside a category. If you want to grab any field values from a category you can do it the same way as with entries. Code works almost the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('handle') %}&#xA;    &amp;lt;p&amp;gt; {{category.title}} &amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt; {{category.title}} &amp;lt;/p&amp;gt;&#xA;&#xA;    {# You can access any field like you normally do inside your category #}&#xA;    {{ category.categoryField }}&#xA;&#xA;&#xA;    {# &#xA;       If you want to access another loop-able&#xA;       field inside your category you can just make another loop.&#xA;       Like you're looping over entries&#xA;    #}&#xA;    {% for block in category.categoryFieldName %}&#xA;        {{ block.fieldName }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-07-13T10:19:31.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21186" PostTypeId="1" CreationDate="2017-07-13T11:37:50.847" Score="1" ViewCount="218" Body="&lt;p&gt;We started getting this error inconsistently on our site, and now it's constant unless we turn devMode off. We have no idea what may be causing it, but it only happens on one page. With devMode turned off, this page loads as intended with no issues. Here's a stack trace of what's coming through:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Class 'Exception\RuntimeException' not found&#xA;/craft/app/framework/vendors/zend-escaper/Escaper.php(321)&#xA;/craft/app/framework/vendors/zend-escaper/Escaper.php(182): Escaper-&amp;gt;toUtf8(&quot;[11:24:06.471][trace][system.db.CDbCommand] Executing SQL: UPDAT...&quot;)&#xA;/craft/app/framework/web/helpers/CJavaScript.php(35): Escaper-&amp;gt;escapeJs(&quot;[11:24:06.471][trace][system.db.CDbCommand] Executing SQL: UPDAT...&quot;)&#xA;/craft/app/helpers/LoggingHelper.php(51): CJavaScript::quote(&quot;[11:24:06.471][trace][system.db.CDbCommand] Executing SQL: UPDAT...&quot;)&#xA;/craft/app/templates/logging/log-firebug.php(46): Craft\LoggingHelper::processFireBugLogEntry(&quot;trace&quot;, &quot;11:24:06.471&quot;, &quot;system.db.CDbCommand&quot;, &quot;Executing SQL: UPDATE `craft_budhub_spend_analytics` SET `id`=:y...&quot;, ...)&#xA;/craft/app/framework/logging/CWebLogRoute.php(52): Craft\WebLogRoute-&amp;gt;render(&quot;log&quot;, array(array(&quot;Loading &quot;cache&quot; application component in /var/www/thisisbud.dev/...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3493, ...), array(&quot;Loading &quot;path&quot; application component in /var/www/thisisbud.dev/c...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3495, ...), array(&quot;Loading &quot;request&quot; application component in /var/www/thisisbud.de...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3497, ...), array(&quot;Serving &quot;usePathInfo&quot; from cache in /var/www/thisisbud.dev/craft...&quot;, &quot;trace&quot;, &quot;system.caching.Craft\FileCache&quot;, 1499945046.3501, ...), ...))&#xA;/craft/app/framework/logging/CLogRoute.php(104): CWebLogRoute-&amp;gt;processLogs(array(array(&quot;$_COOKIE=array ( 'ccc7c40e11a9bcf94cb9cc672f7748a0username' =&amp;gt;...&quot;, &quot;info&quot;, &quot;application&quot;, 1499945046.3467), array(&quot;Loading &quot;cache&quot; application component in /var/www/thisisbud.dev/...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3493, ...), array(&quot;Loading &quot;path&quot; application component in /var/www/thisisbud.dev/c...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3495, ...), array(&quot;Loading &quot;request&quot; application component in /var/www/thisisbud.de...&quot;, &quot;trace&quot;, &quot;system.CModule&quot;, 1499945046.3497, ...), ...))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A few points that may help:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We are accessing and saving (encrypted) binary data to the DB, though we do this elsewhere on the site without issue.&lt;/li&gt;&#xA;&lt;li&gt;The twig being loaded loads other pages too, which all run fine seperately&lt;/li&gt;&#xA;&lt;li&gt;DevMode turned off, we can't see anything that's not working, but with devMode on, it's impossible to get past said error.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We've been wrestling with this for a while without any luck. Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4390" LastActivityDate="2017-11-20T19:42:49.433" Title="DevMode Class 'Exception\RuntimeException' not found" Tags="&lt;error&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21187" PostTypeId="1" CreationDate="2017-07-13T13:30:55.637" Score="1" ViewCount="56" Body="&lt;p&gt;I'm new to both Craft and Venti so apologies if this is quite basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got multiple groups setup using Venti and multiple events within these groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the client side I just want to display the 5 upcoming events from a specific group. Anyone know the best way to go about this? &lt;/p&gt;&#xA;" OwnerUserId="6994" LastActivityDate="2017-07-13T13:34:01.080" Title="Upcoming events from specific groups using Venti" Tags="&lt;plugin-ventievents&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21188" PostTypeId="2" ParentId="21187" CreationDate="2017-07-13T13:34:01.080" Score="3" Body="&lt;p&gt;After looking at this for over an hour I've literally figured it out. Just in case others need it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.venti.events.group('handle').limit(5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So easy! &lt;/p&gt;&#xA;" OwnerUserId="6994" LastActivityDate="2017-07-13T13:34:01.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21189" PostTypeId="1" AcceptedAnswerId="21202" CreationDate="2017-07-13T16:41:39.347" Score="1" ViewCount="219" Body="&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{box.learnMoreLink}}&quot;&amp;gt; {{ box.learnMoreText }} &amp;lt;/a&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently I have a Matrix field that has two plain-text fields. I want to change the href (&lt;code&gt;{{box.learnMoreLink}}&lt;/code&gt;) from plain-text to an entry. I am trying to figure out how to render the entry field. Just changing the field type in the CMS is resulting in content loss. Anyone know the best way to go about this?&lt;/p&gt;&#xA;" OwnerUserId="6995" LastEditorUserId="57" LastEditDate="2017-07-13T22:52:05.153" LastActivityDate="2017-07-14T06:54:27.313" Title="How to render an entry type of a Matrix in HTML?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;entry&gt;&lt;entry-type&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21190" PostTypeId="1" CreationDate="2017-07-13T17:47:07.323" Score="1" ViewCount="128" Body="&lt;p&gt;I would assign the password and send it to the user in an email when I create that user from Backend Control Panel.  I have the following code, but I got False return on &lt;code&gt;craft()-&amp;gt;users-&amp;gt;saveUser($user)&lt;/code&gt;. I also try to use &lt;code&gt;users.onSaveUser&lt;/code&gt; trigger, still no luck. Does anyone know how to save the random password to the user? Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('userGroups.onAssignUserToGroups',function(Event $event) {&#xA;    $user_id = $event-&amp;gt;params['userId'];&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($user_id);&#xA;    $userId = craft()-&amp;gt;request-&amp;gt;getPost('userId');&#xA;    $isNewUser = !$userId;&#xA;&#xA;    $email = new EmailModel();&#xA;    $emailSettings = craft()-&amp;gt;email-&amp;gt;getSettings();&#xA;    $email-&amp;gt;fromEmail = $emailSettings['emailAddress'];&#xA;    $email-&amp;gt;sender = $emailSettings['emailAddress'];&#xA;&#xA;    if ($isNewUser) {&#xA;        /* generate random password */&#xA;        $randomPassword = $this-&amp;gt;getRandomString(8,false);&#xA;&#xA;        /* set random password to user */&#xA;        $user-&amp;gt;newPassword = $randomPassword;&#xA;&#xA;        if (craft()-&amp;gt;users-&amp;gt;saveUser($user)) {&#xA;            $result = &quot;success&quot;;&#xA;        } else {&#xA;            $result = &quot;fail&quot;;&#xA;        }&#xA;&#xA;        $email-&amp;gt;subject = 'confirm created email'&#xA;        $email-&amp;gt;body = &quot;Text to user&quot;.$result;&#xA;        $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;&#xA;        craft()-&amp;gt;email-&amp;gt;sendEmail($email);  &#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2017-07-13T22:55:35.793" LastActivityDate="2017-07-13T22:55:35.793" Title="Set password for user when create from CP" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;password&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21191" PostTypeId="1" CreationDate="2017-07-13T18:34:39.490" Score="1" ViewCount="815" Body="&lt;p&gt;I'm unable to find much documentation nor examples for how to actually utilize Craft Commerce and successfully convert a cart to a completed order.  Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6996" LastEditorUserId="57" LastEditDate="2017-07-13T22:58:46.667" LastActivityDate="2018-08-16T13:32:40.107" Title="Any examples of Craft Commerce checkout process for PayPal or any other gateway?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21192" PostTypeId="1" AcceptedAnswerId="21196" CreationDate="2017-07-13T20:13:06.407" Score="1" ViewCount="47" Body="&lt;p&gt;I'm trying to create a way to create a list of items, similar in appearance to a cart. You have products, you add them to a list and can adjust quantity. The list will follow you throughout the site. However, price is not a factor, there's no payment processing. You're essentially creating a list of products that you want, where then you can submit them to the company. You'll then get a call from them. The products are bespoke so a standard x = $4 situation won't work here. I think something like the Commerce plugin seems like overkill and not sure it can do this (without payments anyway). Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2209" LastEditorUserId="57" LastEditDate="2017-07-13T23:04:55.967" LastActivityDate="2017-07-13T23:04:55.967" Title="How to create a simple shopping list (but not ecommerce)" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21193" PostTypeId="1" AcceptedAnswerId="21197" CreationDate="2017-07-13T20:36:59.873" Score="2" ViewCount="43" Body="&lt;p&gt;I'm trying to figure out the best way to create an entry that is live but &quot;unlisted&quot;. I know wordpress has the option, and the same thing you can do when uploading videos to youtube.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to have a post be live but not included into the regular posts returned when listing items?&lt;/p&gt;&#xA;" OwnerUserId="11" LastActivityDate="2017-07-16T20:19:10.117" Title="Creating &quot;unlisted&quot; entry" Tags="&lt;entries&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21194" PostTypeId="1" AcceptedAnswerId="21230" CreationDate="2017-07-13T21:24:51.867" Score="0" ViewCount="237" Body="&lt;p&gt;So I've been building my plugin to import product listings directly from Salesforce. So far I've been making progress. However, I've approached another roadblock and I was wondering how I would approach this issue. I want to write some code to add default fields into my product layout (e.g.- Body richtext, Image Asset field), &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone showed me an example of this function that adds default content for a ProductType&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @throws \Craft\Exception&#xA; * @throws \Exception&#xA; */&#xA;private function defaultProductTypes()&#xA;{&#xA;    $productType = new Commerce_ProductTypeModel;&#xA;    $productType-&amp;gt;name = 'Clothing';&#xA;    $productType-&amp;gt;handle = 'clothing';&#xA;    $productType-&amp;gt;hasDimensions = true;&#xA;    $productType-&amp;gt;hasUrls = true;&#xA;    $productType-&amp;gt;hasVariants = false;&#xA;    $productType-&amp;gt;hasVariantTitleField = false;&#xA;    $productType-&amp;gt;titleFormat = &quot;{product.title}&quot;;&#xA;    $productType-&amp;gt;template = 'shop/products/_product';&#xA;&#xA;    $fieldLayout = FieldLayoutModel::populateModel(['type' =&amp;gt; 'Commerce_Product']);&#xA;    \Craft\craft()-&amp;gt;fields-&amp;gt;saveLayout($fieldLayout);&#xA;    $productType-&amp;gt;asa('productFieldLayout')-&amp;gt;setFieldLayout($fieldLayout);&#xA;&#xA;    $variantFieldLayout = FieldLayoutModel::populateModel(['type' =&amp;gt; 'Commerce_Variant']);&#xA;    \Craft\craft()-&amp;gt;fields-&amp;gt;saveLayout($variantFieldLayout);&#xA;    $productType-&amp;gt;asa('variantFieldLayout')-&amp;gt;setFieldLayout($variantFieldLayout);&#xA;&#xA;    \Craft\craft()-&amp;gt;commerce_productTypes-&amp;gt;saveProductType($productType);&#xA;&#xA;    $productTypeLocales = \Craft\craft()-&amp;gt;i18n-&amp;gt;getSiteLocaleIds();&#xA;&#xA;    foreach ($productTypeLocales as $locale) {&#xA;        \Craft\craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;insert('commerce_producttypes_i18n', [&#xA;            'productTypeId' =&amp;gt; $productType-&amp;gt;id,&#xA;            'locale' =&amp;gt; $locale,&#xA;            'urlFormat' =&amp;gt; 'shop/products/{slug}'&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried to read through to see where I could include extra fields, but I'm a bit lost on where to start. Can anyone provide some insight or approach to this? &lt;/p&gt;&#xA;" OwnerUserId="6958" LastEditorUserId="57" LastEditDate="2017-07-13T23:11:30.273" LastActivityDate="2017-07-17T17:47:05.533" Title="Anyway to programmatically add default fields to a layout?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21195" PostTypeId="2" ParentId="21191" CreationDate="2017-07-13T23:01:14.840" Score="1" Body="&lt;p&gt;Craft Commerce ships with a &lt;code&gt;templates/shop&lt;/code&gt; folder that has a working check-out processes using the Dummy gateway adapter and some default products that get populated during installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After installing it, you'd access it by going to &lt;code&gt;yoursite.com/shop&lt;/code&gt;.  You can use a test credit card number like &lt;code&gt;4222222222222&lt;/code&gt; to complete checkout and convert a cart to a completed order.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-13T23:01:14.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21196" PostTypeId="2" ParentId="21192" CreationDate="2017-07-13T23:03:32.487" Score="0" Body="&lt;p&gt;Never used it before, but it sounds like maybe the &lt;a href=&quot;https://squarebit.co.uk/software/craft/shortlist&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortlist&lt;/a&gt; plugin might do what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside of that, sounds like it'd be a fairly simple &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; to &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom develop&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-13T23:03:32.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21197" PostTypeId="2" ParentId="21193" CreationDate="2017-07-13T23:10:30.010" Score="3" Body="&lt;p&gt;If you create a &lt;a href=&quot;https://craftcms.com/docs/lightswitch-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lightswitch field&lt;/a&gt; and add it to the section's field layout (let's call it &lt;code&gt;unlisted&lt;/code&gt;), then you can query for live entries that have &lt;code&gt;unlisted&lt;/code&gt; not checked with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionHandle').unlisted('not 1').find() %}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-13T23:10:30.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21198" PostTypeId="2" ParentId="21191" CreationDate="2017-07-14T01:45:00.947" Score="1" Body="&lt;p&gt;Just extending on Brad's answer a bit more so, everything he said plus...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to create a product type (or use the default products to get started).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then pull them in on your template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products.type('myType') %}&#xA;&#xA;{% if products|length %}&#xA;    {% for product in products %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {# Could not find any products. #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll be able to see all of this when you download and install commerce just by looking at the templates that it ships with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as checkout, here is a quick overview to use with PayPal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get &lt;a href=&quot;https://www.paypal.com/gb/smarthelp/article/where-can-i-find-test-credit-card-numbers-ts2157&quot; rel=&quot;nofollow noreferrer&quot;&gt;details of credit card numbers to test with&lt;/a&gt; for PayPal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that any number ending in an even number will return a success message and anything ending with an odd number will return false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on what you use for the gateway, you will want to make sure you remove the &lt;code&gt;paymentMethodId&lt;/code&gt; drop down and handle it accordingly. This &lt;em&gt;could&lt;/em&gt; be as simple as making it a hidden input with a value of the &lt;code&gt;id&lt;/code&gt; of the gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What makes commerce so great - and also difficult at the same time is the flexibility it provides. You can do just about anything you want, in any way you want to do it. You aren't bound by any strict templates.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="142" LastEditDate="2018-08-16T13:32:40.107" LastActivityDate="2018-08-16T13:32:40.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21199" PostTypeId="1" CreationDate="2017-07-14T03:36:14.850" Score="2" ViewCount="270" Body="&lt;p&gt;I'm really surprised to see there's no blog subscription plugin for Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking to take an email address and send email updates when new entries are created within a specified channel. Subscribers could opt-out via a link appended to each update email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could have a section within the CP to view current subscribers, and have an export option to export to CSV etc. Could also have a checkbox when creating a new entry to announce to subscribers or not&lt;/p&gt;&#xA;" OwnerUserId="6869" LastActivityDate="2017-10-18T22:30:34.367" Title="Blog Subscriptions" Tags="&lt;entries&gt;&lt;users&gt;&lt;emails&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21200" PostTypeId="1" AcceptedAnswerId="21201" CreationDate="2017-07-14T03:38:24.590" Score="1" ViewCount="1153" Body="&lt;p&gt;I'm moving a site from EE to Craft. All is well but the redirects from the old URLs to the new do not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SproutSEO Redirects&#xA;(&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/getting-started/redirects&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/getting-started/redirects&lt;/a&gt;) - Results in a Craft 404&lt;/li&gt;&#xA;&lt;li&gt;Retour (&lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/retour&lt;/a&gt;) - Results in a Craft&#xA;404&lt;/li&gt;&#xA;&lt;li&gt;Reroute (&lt;a href=&quot;https://github.com/davist11/craft-reroute&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/davist11/craft-reroute&lt;/a&gt;) - Results in a&#xA;Craft 404&lt;/li&gt;&#xA;&lt;li&gt;.htaccess redirect - Results in Craft 404&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The only thing I can think of is that Craft is somehow getting ahead of these solutions and running with the 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-07-14T17:44:46.470" Title="301 redirects not working" Tags="&lt;seo&gt;&lt;plugin-sproutseo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21201" PostTypeId="2" ParentId="21200" CreationDate="2017-07-14T03:51:11.620" Score="2" Body="&lt;p&gt;I wrote the Retour plugin; it will definitely work. However it only kicks in after 404 error is thrown by Craft. So if some route resolves to the URL in question, it won't kick in (because, by definition, it is then not a 404)&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-14T03:51:11.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21202" PostTypeId="2" ParentId="21189" CreationDate="2017-07-14T06:54:27.313" Score="1" Body="&lt;p&gt;If you change the entry type then you're going to lose content for sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If changing that field type to an entry is really what you want, great. You could do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# grab the first entry that we've selected #}&#xA;{% set learnMoreLink = box.learnMoreLink.first() %}&#xA;{# spit out the url for the first entry #}&#xA;&amp;lt;a href=&quot;{{ learnMoreLink.url }}&quot;&amp;gt;{{ box.learnMoreText }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-07-14T06:54:27.313" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21203" PostTypeId="2" ParentId="21200" CreationDate="2017-07-14T07:57:23.843" Score="0" Body="&lt;p&gt;I would put your redirects at server level if you can (.htaccess),  because you don't necessarily want Craft processing all that traffic when it doesn't need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you put your rule after the Craft rule in your .htaccess it will never fire as everything is routed through index.php before that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another potential issue is that Craft inconveniently rename the &lt;code&gt;.htaccess&lt;/code&gt; to be &lt;code&gt;htaccess&lt;/code&gt; so I would check that too just in case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to add what you're trying to do in your .htaccess in your answer that would help.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastEditorUserId="57" LastEditDate="2017-07-14T17:44:46.470" LastActivityDate="2017-07-14T17:44:46.470" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21204" PostTypeId="1" CreationDate="2017-07-14T08:00:17.847" Score="1" ViewCount="217" Body="&lt;p&gt;My company website is built on Craft CMS. We have a technical department publishing documentation for our products, so that our customer can download them without login. The department is editing and adding new documents weekly, and upload changes and new documents every week manually on our website will be a struggle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Down to the point. We use Sharepoint in office 365 today. It's quite easy to updated documentation and keep track of revision history. Is it possible to create a page in our website where the latest update of these PDF/Documents in the library in Sharepoint is available for open download? &lt;/p&gt;&#xA;" OwnerUserId="7000" LastEditorUserId="57" LastEditDate="2017-07-14T18:51:24.080" LastActivityDate="2017-09-12T20:06:50.340" Title="Sharepoint sync" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21205" PostTypeId="2" ParentId="21183" CreationDate="2017-07-14T09:00:08.087" Score="1" Body="&lt;p&gt;Started using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;imager&lt;/a&gt; and no longer have the problem. It's not a real answer to the question but it solves the problem.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-14T09:00:08.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21206" PostTypeId="1" AcceptedAnswerId="21225" CreationDate="2017-07-14T11:15:50.273" Score="1" ViewCount="66" Body="&lt;p&gt;I'm trying to add an asset to an entry's assetfield when the entry is saved by using the &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; service provided by Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) use ($fileIds)&#xA;  {&#xA;      $entry = $event-&amp;gt;params['entry'];&#xA;      if ($entry-&amp;gt;section['handle'] == &quot;bildupload&quot; &amp;amp;&amp;amp; $event-&amp;gt;params[&quot;isNewEntry&quot;]){&#xA;        $entry-&amp;gt;getContent()-&amp;gt;useruploads = $fileIds;&#xA;      }&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Contents of the &lt;code&gt;$fileIds&lt;/code&gt;-array are created like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$copyrightedImage = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;      $tempPath,&#xA;      $originalFile,&#xA;      $myAssetFolderId,&#xA;      AssetConflictResolution::KeepBoth&#xA;);&#xA;&#xA;if ($copyrightedImage-&amp;gt;isSuccess()){&#xA;      $fileIds[] = $copyrightedImage-&amp;gt;getDataItem('fileId');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works pretty well for fields such as a formatted text field or the title, but I cant figure out how to change the asset inside an asset field. &#xA;The assetfield of the entries in the section &lt;code&gt;bildupload&lt;/code&gt; goes by the handle &lt;code&gt;useruploads&lt;/code&gt;. How would I go about fetching the assetId, the full Url to the photo or whatever is used here and add the desired photo into the assetfield as an additional used asset?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help or hints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I tried following what Brandon described &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4175/create-entry-with-newly-uploaded-asset-programatically&quot;&gt;here&lt;/a&gt;, but to no avail.&#xA;There are no errors thrown, however the assetfield of the entry remains completely empty and does not have any image assigned to it. I'm using closures to use the array &lt;code&gt;$fileIds&lt;/code&gt; in the functions shown below.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-07-17T06:47:33.087" LastActivityDate="2017-07-17T12:35:13.000" Title="Changing asset of entry's assetfield via entries.onBeforeSaveEntry" Tags="&lt;assets&gt;&lt;services&gt;&lt;onsaveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21208" PostTypeId="2" ParentId="21129" CreationDate="2017-07-14T11:35:47.093" Score="1" Body="&lt;p&gt;Specifically for the image, if I'm correct, you're trying to use imager the wrong way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set image = entry.shopImage.first() %}&#xA;   {% set shopImageTransform = craft.imager.transformImage(image, { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 }) %}&#xA;&#xA;   &amp;lt;a href=&quot;{{ entry.shopUrl }}&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&amp;gt;&#xA;      &amp;lt;img src=&quot;{{ shopImageTransform.url}}&quot; alt=&quot;{{ entry.title }}&quot;/&amp;gt;&#xA;   &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, 'shopImageTransform' becomes the new 'image' so you have to call &lt;code&gt;.url&lt;/code&gt; on shopImageTransform instead of on image. You can see an example &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#usage&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; , in the Imager readme. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As for the problem with the shopUrl, if you just dump it out, what do you receive? Is it holding any value? &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-14T11:35:47.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21209" PostTypeId="1" CreationDate="2017-07-14T15:33:53.137" Score="1" ViewCount="109" Body="&lt;p&gt;I am fleshing out all the main parts of my commerce site and going through all the requirements needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have installed the Craft Commerce plugin and set it up with required shipping, delivery, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I am trying to fathom and work out now is the ability to customise the variant selector. I want to use images from the fields in the product editor so you can select the variant colour/material/size as a different dropdown so we may have all three in one product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When they are selected it would:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change the image to the selected one&lt;/li&gt;&#xA;&lt;li&gt;Also change price&lt;/li&gt;&#xA;&lt;li&gt;Remember when added to cart that the selected items are the correct ones for the basket&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Can this be done in Craft Commerce?&lt;/p&gt;&#xA;" OwnerUserId="5033" LastEditorUserId="57" LastEditDate="2017-07-14T18:57:56.137" LastActivityDate="2017-11-14T00:05:51.283" Title="Is it possible to use images as variant selectors when choosing products?" Tags="&lt;plugin-craftcommerce&gt;&lt;craft-features&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21211" PostTypeId="2" ParentId="21204" CreationDate="2017-07-14T18:50:51.357" Score="1" Body="&lt;p&gt;Should be doable with a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several &lt;a href=&quot;https://packagist.org/search/?q=sharepoint&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP Sharepoint&lt;/a&gt; libraries already available, but &lt;a href=&quot;https://packagist.org/packages/vgrem/php-spo&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; looks promising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But essentially your plugin would import the Sharepoint library, you'd point it to your Sharepoint web service endpoints and query for the docs that you're interested in, building URL endpoints where end-users could be able to download them from a Craft template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-14T18:50:51.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21212" PostTypeId="1" AcceptedAnswerId="21243" CreationDate="2017-07-16T19:15:30.983" Score="1" ViewCount="305" Body="&lt;p&gt;I have a form that is set up to include multiple values with checkboxes. I pass all those values into an array &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set specsQuery = craft.request.getParam('specs') %}&#xA;{% set productSpecsCategory = craft.categories.group('productSpecs').slug(specsQuery) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is the code below is seeing those values as OR instead of AND. I'm assuming it's because it's all put on the one targetElement line. The amount of criteria a user can select is essentially infinite (as in the max right now is 5 but more categories can be added in craftcms admin area and are created dynamically on the site as more options.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.commerce.products('footwear').relatedTo('and',&#xA;      { targetElement: productSpecsCategory, field: 'productSpecs' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit: I have tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.commerce.products('footwear').relatedTo(['and',&#xA;  { targetElement: productSpecsCategory, field: 'productSpecs' }&#xA;]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit: This works with 2 criteria, but no more or less (obviously). Is there a way to loop the targetElement?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.commerce.products('footwear').relatedTo([ 'and',&#xA;  {targetElement: productSpecsCategory[0], field: 'productSpecs'},&#xA;  {targetElement: productSpecsCategory[1], field: 'productSpecs'}&#xA;]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2017-07-16T19:44:27.670" LastActivityDate="2017-07-18T08:42:40.640" Title="Filtering dynamic criteria with AND" Tags="&lt;categories&gt;&lt;search&gt;&lt;filter&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21213" PostTypeId="2" ParentId="21193" CreationDate="2017-07-16T20:19:10.117" Score="1" Body="&lt;p&gt;You could add a lightswitch field as mentioned above, but it seems to me you could just use Craft's built-in Enabled status, no?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IdmZe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IdmZe.png&quot; alt=&quot;Enabled&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do this all the time for blog entries while I'm working on them, so that they are there, but they don't appear in the listings. The bonus is that you don't have to change anything from a templating POV, entries that aren't enabled don't show up by default in &lt;code&gt;craft.entries&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second bonus is that you can use the Share link (the arrow next to Live Preview) so share a tokenized URL with others that they can view before the entry is live on the website.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-16T20:19:10.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21214" PostTypeId="2" ParentId="21161" CreationDate="2017-07-16T20:25:38.767" Score="1" Body="&lt;p&gt;If you follow the instructions here: &lt;a href=&quot;https://nystudio107.com/blog/local-development-with-vagrant-homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Local Development with Vagrant / Homestead&lt;/a&gt; and can't get it working, let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the exact procedure I use whenever I set it up; I just did it 3 weeks ago to set up a new machine running Homestead without incident.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-16T20:25:38.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21215" PostTypeId="2" ParentId="21212" CreationDate="2017-07-16T20:28:56.857" Score="1" Body="&lt;p&gt;I am still waiting on a better solution, but this is how I've solved this so far. My query will likely never go over 10, but for multiple reasons a dynamic solution would be much better if there is an answer out there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryLength = productSpecsCategory|length %}&#xA;{% switch queryLength %}&#xA;    {% case 1 %}&#xA;        {% set entries = craft.commerce.products('footwear').relatedTo([ 'and',&#xA;            {targetElement: productSpecsCategory, field: 'productSpecs'}&#xA;        ]) %}&#xA;&#xA;    {% case 2 %}&#xA;        {% set entries = craft.commerce.products('footwear').relatedTo([ 'and',&#xA;            {targetElement: productSpecsCategory[0], field: 'productSpecs'},&#xA;            {targetElement: productSpecsCategory[1], field: 'productSpecs'}&#xA;        ]) %}&#xA;    {% case 3 %}&#xA;        {% set entries = craft.commerce.products('footwear').relatedTo([ 'and',&#xA;            {targetElement: productSpecsCategory[0], field: 'productSpecs'},&#xA;            {targetElement: productSpecsCategory[1], field: 'productSpecs'},&#xA;            {targetElement: productSpecsCategory[2], field: 'productSpecs'}&#xA;        ]) %}&#xA;    {% default %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-07-16T20:28:56.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21216" PostTypeId="2" ParentId="21127" CreationDate="2017-07-16T20:37:23.597" Score="2" Body="&lt;p&gt;This is all pretty well documented here: &lt;a href=&quot;https://nystudio107.com/blog/creating-optimized-images-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating Optimized Images in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you need general help on &lt;code&gt;srcset&lt;/code&gt; and &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; elements check out &lt;a href=&quot;https://www.smashingmagazine.com/2014/05/responsive-images-done-right-guide-picture-srcset/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Responsive Images Done Right: A Guide To  And srcset&lt;/a&gt; and &lt;a href=&quot;https://cloudfour.com/thinks/dont-use-picture-most-of-the-time/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Don’t use  (most of the time)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-16T20:37:23.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21217" PostTypeId="2" ParentId="21113" CreationDate="2017-07-16T20:48:26.463" Score="2" Body="&lt;p&gt;Yes, it's definitely possible to do that, but you'll need to use Twig as per: &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you might not want to do that. Sometimes it's nice to have the site name show up in the title that's shared via social media, to tie in the branding. Your call tho!&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-16T20:48:26.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21218" PostTypeId="1" AcceptedAnswerId="21219" CreationDate="2017-07-16T22:24:00.953" Score="3" ViewCount="131" Body="&lt;p&gt;I go a simple question. I wanted to start with building my craft template from html and changed all css  and  tags to to equivalent &lt;code&gt;{% includeCssFile %}&lt;/code&gt; or &lt;code&gt;{% includeJsFile %}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page was working but my live preview was broken. It could not load the CSS, JS and other files. So I searched this forum and found out i should use &lt;code&gt;{{ siteUrl }}&lt;/code&gt; on my links. I changed all back to   and now live preview is working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering: why or when should we use this kind of include file tags?&lt;/p&gt;&#xA;" OwnerUserId="6737" LastEditorUserId="57" LastEditDate="2017-07-17T00:46:06.893" LastActivityDate="2017-07-17T06:27:41.520" Title="Difference between {% includeCssFile %} or including it with &lt;link&gt;" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21219" PostTypeId="2" ParentId="21218" CreationDate="2017-07-17T05:54:38.937" Score="3" Body="&lt;p&gt;The difference is that &lt;code&gt;{% includeJsFile %}&lt;/code&gt; can be called in any template or template part and will add the script to the bottom of the page (&lt;a href=&quot;https://craftcms.com/docs/templating/includejsfile&quot; rel=&quot;nofollow noreferrer&quot;&gt;as explained here&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could, for example, have a field that requires some JavaScript, say an image slider. You'll only need the JavaScript for that slider, not for the rest of the website, so in the template part where you set up the HTML for the slider, you also include the needed JS with &lt;code&gt;{% includeJsFile %}&lt;/code&gt; and it will get added to the bottom of the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where as with just including it in the head will load it on all pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the same for &lt;code&gt;{% includeCss %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="45" LastEditDate="2017-07-17T06:27:41.520" LastActivityDate="2017-07-17T06:27:41.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21221" PostTypeId="2" ParentId="9784" CreationDate="2017-07-17T07:26:51.607" Score="1" Body="&lt;p&gt;I've modified the snippet a bit. For me as Admin and Developer it's urgent to have it in English. But we figured out that clients want rather the native language. I think it's fine in this way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;if (craft()-&amp;gt;request-&amp;gt;isCpRequest())&#xA;{&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;isAdmin())&#xA;    {&#xA;        return (include '../craft/app/translations/en_gb.php');&#xA;    }&#xA;    else&#xA;    {&#xA;        $de = (include '../craft/app/translations/de.php');&#xA;        $custom = array(&#xA;            //'Globals' =&amp;gt; 'I freak out!',&#xA;        );&#xA;&#xA;        return array_merge($de, $custom);&#xA;    }&#xA;}&#xA;&#xA;return [];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="57" LastEditDate="2017-07-17T16:53:26.173" LastActivityDate="2017-07-17T16:53:26.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21222" PostTypeId="1" CreationDate="2017-07-17T08:33:30.383" Score="1" ViewCount="1326" Body="&lt;p&gt;We have an issue on our server when our Security Headers are not working. We added the following to our htaccess file after installing Craft CMS: -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_headers.c&amp;gt;&#xA;    Header always set X-Xss-Protection &quot;1; mode=block&quot;&#xA;    Header always set X-Content-Type-Options &quot;nosniff&quot;&#xA;    Header always append X-Frame-Options ALLOWALL&#xA;    Header always set Strict-Transport-Security &quot;max-age=31536000&quot;&#xA;    Header always set Referrer-Policy no-referrer&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These settings worked on our previous CMS which was completely developed in house. We have recently upgraded our server to PHP 7 and Apache 2.4. We have been using &lt;a href=&quot;https://securityheaders.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://securityheaders.io&lt;/a&gt; to check our results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help trying to get this to work would be really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7007" LastActivityDate="2020-02-07T10:56:26.543" Title="Security Headers in htaccess Don't Work" Tags="&lt;php&gt;&lt;htaccess&gt;&lt;security&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21223" PostTypeId="2" ParentId="21222" CreationDate="2017-07-17T09:31:44.453" Score="2" Body="&lt;p&gt;I'm assuming mod_headers is installed &amp;amp; active? Otherwhise I can't say why the .htaccess rules are not applied (devOps is not my forte) but you could set them through the twig template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.com/docs/templating/header&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for the tag to use. Basically it comes down to something like this (untested): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% header 'X-Xss-Protection &quot;1; mode=block&quot;' %}&#xA;{% header 'X-Content-Type-Options &quot;nosniff' %}&#xA;{% header 'X-Frame-Options ALLOWALL' %}&#xA;{% header 'Strict-Transport-Security &quot;max-age=31536000&quot;' %}&#xA;{% header 'Referrer-Policy no-referrer' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can make those in a block and just include the block on all the relevant pages. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-17T09:31:44.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21224" PostTypeId="1" CreationDate="2017-07-17T10:46:07.043" Score="1" ViewCount="136" Body="&lt;p&gt;I successfully imported my tumblr blog with the amazing Feedme plugin over the rss feed of the blog. The plugin creates posts and feeds the &quot;title&quot;, &quot;date&quot;, &quot;tag&quot; and of course the &quot;content&quot; inside my craft and I can assign a field to each of those elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the thing: The images in tumblr are included in the content. Feedme isnt able to crawl for img tags and make an asset out of it in craft. So the images are still on tumblr and are just linked in the html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;für Hotels und Gastronomie.&amp;lt;/p&amp;gt;&#xA;&amp;lt;figure data-orig-width=&quot;1080&quot; data-orig-height=&quot;568&quot; class=&quot;tmblr-full&quot;&amp;gt;&amp;lt;img src=&quot;http://68.media.tumblr.com/09fe97556d12eb488c91da31c71f44d5/tumblr_inline_ot0whuvZ6y1rft7f2_540.png&quot; title=&quot;Online-to-offline Kundenreise&quot; alt=&quot;blog bild lokale customer journey&quot; data-orig-width=&quot;1080&quot; data-orig-height=&quot;568&quot;&amp;gt;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea how I can get the first image in my template? the prettiest solution would be of course if I find a way to make it an asset. But if not, it would be nice if I could crawl the html content for img tags and get the link to the image on the tumblr server......&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-07-24T19:51:18.983" Title="Images from tumblr post" Tags="&lt;image&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21225" PostTypeId="2" ParentId="21206" CreationDate="2017-07-17T12:28:41.473" Score="1" Body="&lt;p&gt;After taking a look again, it turned out to simply be an issue with the scope of the array and a therefore empty array as a result. Works as expected now.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-07-17T12:35:13.000" LastActivityDate="2017-07-17T12:35:13.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21226" PostTypeId="1" CreationDate="2017-07-17T14:01:51.813" Score="2" ViewCount="3953" Body="&lt;p&gt;I have just deployed an existing site to a new server. As the DNS is not pointing there yet, I have simply edited my &lt;code&gt;/etc/hosts&lt;/code&gt; file on my Mac to point to the IP address for testing. Whilst checking through everything, it seems the site is functioning well, assets have been copied over etc. The only problem is that I am getting an error when trying to log in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the front end I get the message: Bad Request: The CSRF token could not be verified.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    2017/07/17 13:52:33 [error] [exception.Craft\HttpException.400] Craft\HttpException: The CSRF token could not be verified. in /home/forge/www.domain.co.uk/craft/app/services/HttpRequestService.php:1337&#xA;Stack trace:&#xA;#0 /home/forge/www.domain.co.uk/craft/app/framework/base/CComponent.php(561): Craft\HttpRequestService-&amp;gt;validateCsrfToken(Object(CEvent))&#xA;#1 /home/forge/www.domain.co.uk/craft/app/framework/base/CApplication.php(212): CComponent-&amp;gt;raiseEvent('onbeginrequest', Object(CEvent))&#xA;#2 /home/forge/www.domain.co.uk/craft/app/framework/base/CApplication.php(183): CApplication-&amp;gt;onBeginRequest(Object(CEvent))&#xA;#3 /home/forge/www.domain.co.uk/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#4 /home/forge/www.domain.co.uk/public/index.php(19): require_once('/home/forge/www...')&#xA;#5 {main}&#xA;REQUEST_URI=/members/login&#xA;HTTP_REFERER=http://www.domain.co.uk/members/login&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And from the craft admin login form, this comes up on the console after clicking Login&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;VM43:1 POST http://www.domain.co.uk/index.php?p=admin/actions/users/login 400 (Bad Request)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One point to note is that the original website was SSL encrypted but the new server hasn't had an SSL cert installed yet, because DNS is not pointing to it yet. However I have altered the &lt;code&gt;/craft/config/general.php&lt;/code&gt; config file to reflect the &lt;code&gt;http://&lt;/code&gt; domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&#xA;Running latest craft &lt;code&gt;2.6.2987&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2020-07-28T10:27:44.637" Title="Login - Bad Request: The CSRF token could not be verified" Tags="&lt;login&gt;&lt;server&gt;&lt;csrf&gt;&lt;https&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21227" PostTypeId="1" AcceptedAnswerId="21228" CreationDate="2017-07-17T14:30:49.707" Score="1" ViewCount="380" Body="&lt;p&gt;Has anyone ever tried using Structures instead of Singles? I'm developing something that's kind of like multiple sites in one, they share the same central design, just with content differences and a few colour changes. I thought if I could use a Structure instead of Singles, I could contain each section to a specific area (making it easy to maintain), and use Entry Types to decide on the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with using a Structure is I keep getting &lt;code&gt;Variable &quot;entry&quot; does not exist.&lt;/code&gt; errors. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can suggest a fix, or a better way of handling something like this, I'd love to hear it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5481" LastActivityDate="2017-07-17T15:13:25.017" Title="Using Structures instead of Singles" Tags="&lt;structure&gt;&lt;content&gt;&lt;singles&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21228" PostTypeId="2" ParentId="21227" CreationDate="2017-07-17T15:13:25.017" Score="2" Body="&lt;p&gt;I'm doing this at the moment. It's not a perfect solution, but nor is it terrible. In a lot of ways, I'd quite like Craft to just burn Singles and Channels and use nothing but Structures. You can do everything with Structures that you can with the other two, and you get better flexibility and much nicer groupings in the CMS that make more sense to clients (the one confusing bit of Craft clients seem to have is why editing pages is spread out over three areas they don't see any real logic behind). But, that's not how things are. Anyway...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're getting &quot;entry does not exist&quot; then you've got something broken in your routing. Every page inside a Structure is an Entry, and if you've got URLs resolving to entries in your Structure then you've got access to the entry variable in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check your Structure and see what template it's actually loading. The only thing I can think of at the moment with the little detail you've given is that you've got templates in a path that match the Structure, and instead of routing theough the database it's routing theough the files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., if you've got templates/my-structure/my-entry.twig and also an Entry with a URI of /my-structure/my-entry then you might be skipping the database because your filesystem is matching first.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-07-17T15:13:25.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21229" PostTypeId="2" ParentId="21222" CreationDate="2017-07-17T17:21:01.623" Score="1" Body="&lt;p&gt;This is more of a server config issue than a Craft one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does set a &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/web/WebApp.php#L181-L186&quot; rel=&quot;nofollow noreferrer&quot;&gt;few of those headers from PHP&lt;/a&gt;, but only for Control Panel requests.  It's completely hands-off on the front-end of your site assuming that you'll set whatever headers you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/a/21223/57&quot;&gt;Michael said&lt;/a&gt;, make sure that mod_headers is installed and make sure that nothing else in your &lt;code&gt;.htaccess&lt;/code&gt; or any other &lt;code&gt;.htaccess&lt;/code&gt; files are interfering. I'd also make sure that something like mod_security or Suhosin is also not interfering.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-17T17:21:01.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21230" PostTypeId="2" ParentId="21194" CreationDate="2017-07-17T17:47:05.533" Score="0" Body="&lt;p&gt;After hours of perusing, I managed to find a working solution to this issue.  I threw this implementation from InstallService located in &lt;code&gt;craft/app/services&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realized that CommerceProduct and Variant Field Layouts were set into the Commerce Product Type Model via &lt;code&gt;setFieldLayout()&lt;/code&gt; function, therefore all I would need to do is create a new Field Layout with the fields that I required and set them into &lt;code&gt;defaultProductTypes()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    //Write this code in between CommerceProductFieldLayout and Variant type field Layout&#xA;&#xA;    //Any custom fields for your products go here.&#xA;    //Format: $yourFieldName = FieldsVariable::getFieldByHandle(&quot;Your field's &#xA;handle&quot;);&#xA;    $bodyField = FieldsVariable::getFieldByHandle('body');&#xA;    $tagsField= FieldsVariable::getFieldByHandle('tags');&#xA;&#xA;    //Assemble a new layout that contains the fields you need.&#xA;    $infoLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout(&#xA;        array(&#xA;            'Content' =&amp;gt; array($bodyField-&amp;gt;id, $tagsField-&amp;gt;id) //Add fields into this array to display your plugins. (e.g. - $YourFieldVariable-&amp;gt;id)&#xA;        ),&#xA;        array($bodyField-&amp;gt;id) //Add any required fields here.&#xA;    );&#xA;&#xA;    // Save Layout into specified product type.&#xA;    $productType-&amp;gt;setFieldLayout($infoLayout); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6958" LastActivityDate="2017-07-17T17:47:05.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21231" PostTypeId="1" CreationDate="2017-07-17T19:23:17.970" Score="2" ViewCount="104" Body="&lt;p&gt;This is my old URL. No entry exists here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/post/234234234234/happy-fourth-of-july&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This entry exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/news/happy-fourth-of-july&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the Redirect Manager plugin setup as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dCQkf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dCQkf.png&quot; alt=&quot;Redirect Manager Configuration&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I visit the old URL (above) the URL remains unchanged and I receive a &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt; template error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must be missing something really obvious, so if I can provide more infomation, let me know.&lt;/p&gt;&#xA;" OwnerUserId="7009" LastEditorUserId="57" LastEditDate="2017-07-17T19:44:46.250" LastActivityDate="2017-07-17T20:19:04.493" Title="Redirect Manager 301 results in &quot;Entry DNE&quot; error" Tags="&lt;plugins&gt;&lt;redirect&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21232" PostTypeId="2" ParentId="21231" CreationDate="2017-07-17T20:19:04.493" Score="3" Body="&lt;p&gt;Turns out that I was right on the money with my plugin configurations, however earlier I had incorrectly tried to solve the problem using the route below, which was still in place and scuppering my subsequent good work!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cResh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cResh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7009" LastActivityDate="2017-07-17T20:19:04.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21233" PostTypeId="1" AcceptedAnswerId="21235" CreationDate="2017-07-17T20:36:47.323" Score="1" ViewCount="40" Body="&lt;p&gt;I have 2 subsites on the same apache server both pointing to the same craft database.  The original subsite has the normal links, but, the subsite copy has index.php in all of the links.  Can someone point me in the right direction to remove the index.php references? NOTE: .htaccess is correct and the same on both sites.&lt;/p&gt;&#xA;" OwnerUserId="1006" LastActivityDate="2017-07-17T21:48:49.490" Title="Copy of subsite is still serving index.php in the links?" Tags="&lt;index&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21234" PostTypeId="1" CreationDate="2017-07-17T20:54:57.503" Score="1" ViewCount="324" Body="&lt;p&gt;I need to list the names of all of my entries in alphabetical order excluding 'the' (which could only be at the beginning). I've looked around online, but I was only able to find a code segment (which I've modified to fit my needs). However, it's still incorrectly sorting them as you can see in the attached image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('partners').featuredMediaPartner('1').order('(CASE WHEN title LIKE &quot;The %&quot; THEN SUBSTRING(title, 3) ELSE title END ) asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please help me fix this issue, thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/29mC9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/29mC9.png&quot; alt=&quot;Entries not being correctly sorted&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6884" LastEditorUserId="57" LastEditDate="2017-07-17T22:08:48.917" LastActivityDate="2017-07-17T22:52:45.950" Title="Sort entry titles alphabetically excluding 'The'?" Tags="&lt;entries&gt;&lt;forloop&gt;&lt;ordering&gt;&lt;sorting&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21235" PostTypeId="2" ParentId="21233" CreationDate="2017-07-17T21:48:49.490" Score="2" Body="&lt;p&gt;You should have the setting &lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true&lt;/code&gt; on either both sites, or in the wildcard config. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    '*' =&amp;gt; [&#xA;        // ...&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        // ...&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more about it here:&#xA;&lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7010" LastActivityDate="2017-07-17T21:48:49.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21236" PostTypeId="2" ParentId="21234" CreationDate="2017-07-17T22:52:45.950" Score="3" Body="&lt;p&gt;According to &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_substr&quot; rel=&quot;nofollow noreferrer&quot;&gt;SUBSTRING&lt;/a&gt;, the first character starts at 1.  So if you wanted to start at the position immediate after &lt;code&gt;The&lt;/code&gt; (with one space), you'd need to start at position 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just did a test locally and it works as expected for me if I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.order('(CASE WHEN title LIKE &quot;The %&quot; THEN SUBSTRING(title, 5) ELSE title END ) asc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-17T22:52:45.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21237" PostTypeId="1" CreationDate="2017-07-18T00:11:00.840" Score="2" ViewCount="130" Body="&lt;p&gt;My server has gone down twice in the last 3 weeks because of an excessive number of files being created in the compiled_templates folder. This causes all of the inodes on our server to be used up causing the site to crash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We previously thought this may have been because of a security test that hit multiple URLs on the site and generated too many templates. The original question can be seen here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20985/security-test-generated-large-compiled-templates-directory-site-outage&quot;&gt;Security test generated large compiled_templates directory, site outage&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time there was no unusual traffic spike, so I can't assume it was because of the security testing. The only common thread seems to be that garbage collection is either not deleting the old compiled templates or craft is mis-configured. Any insights into this issue would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Looking in the &lt;code&gt;compiled_templates&lt;/code&gt; folder it seems there are a few hundred different folders with names like 00 a9 b3 ... and inside those folders are sometimes hundreds of PHP files. I can't track down what templates some of them go to. For example one of the comments up to reads: &lt;code&gt;/* __string_template__cc8a06d92434271d04fe341ad237b568da4c65f004cfec4d1fc576ee4e9b6c4a */&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have functions that echo out single lines of text, these functions are called doDisplay. I am not the original author of this site and am not an expert at Craft. I appreciate the help.&lt;/p&gt;&#xA;" OwnerUserId="6330" LastEditorUserId="57" LastEditDate="2017-07-18T18:50:40.917" LastActivityDate="2017-07-18T18:57:15.340" Title="compiled_templates folder using up inodes on Ubuntu 14.04 Server" Tags="&lt;database&gt;&lt;config&gt;&lt;php&gt;&lt;server&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21238" PostTypeId="2" ParentId="21237" CreationDate="2017-07-18T01:51:57.763" Score="1" Body="&lt;p&gt;How many files are in the &lt;code&gt;compiled_templates&lt;/code&gt; directory? There should be a 1:1 correlation between the number of actual templates you have, and the number of cached &lt;code&gt;.php&lt;/code&gt; compiled templates in the &lt;code&gt;compiled_templates&lt;/code&gt;folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shouldn't have anything to do with 404 errors, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never seen nor heard of the situation that you've described.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-18T01:51:57.763" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21239" PostTypeId="1" AcceptedAnswerId="21240" CreationDate="2017-07-18T02:29:11.490" Score="1" ViewCount="893" Body="&lt;p&gt;I'm sorry If this has been answered before, but I couldn't find any answer that would work for me. Maybe I'm just treating category fields the wrong way and I should be trying to do this with tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I created a category group called &lt;strong&gt;colors&lt;/strong&gt;. I also have several categories like &lt;strong&gt;green&lt;/strong&gt;, &lt;strong&gt;blue&lt;/strong&gt;, &lt;strong&gt;red&lt;/strong&gt;...&#xA;I assigned URLs that look like &lt;code&gt;mysite/colors/red&lt;/code&gt;, &lt;code&gt;mysite/colors/blue&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the colors point to the same template &lt;code&gt;colors/index.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I display only the entries in &lt;code&gt;craft.entries.section('news')&lt;/code&gt; that are in the &quot;red&quot; color category when I visit &lt;code&gt;mysite/colors/red&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2017-07-18T02:46:08.903" Title="Display entries related to Category Field" Tags="&lt;templating&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21240" PostTypeId="2" ParentId="21239" CreationDate="2017-07-18T02:40:42.223" Score="3" Body="&lt;p&gt;You want to use the &lt;code&gt;relatedTo&lt;/code&gt; filter. See the docs here: &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt; where &lt;code&gt;category&lt;/code&gt; is your last URL segment (eg red).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a quick addition... if your category URL for the category group matches what you've used above &lt;code&gt;mysite/colors/red&lt;/code&gt; and you are using the category template for that group then you will have a &lt;code&gt;category&lt;/code&gt; variable already to use in the &lt;code&gt;relatedTo&lt;/code&gt; filter.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2017-07-18T02:46:08.903" LastActivityDate="2017-07-18T02:46:08.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21241" PostTypeId="1" AcceptedAnswerId="21807" CreationDate="2017-07-18T07:00:46.253" Score="2" ViewCount="191" Body="&lt;p&gt;I have this form (&lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;am forms plugin&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;  {% if errors %}&#xA;      &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;          {% for error in errors %}&#xA;              &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;{% set form = craft.amForms.getForm('contactForm') %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&#xA;&#xA;&#xA;   &amp;lt;label for=&quot;frm_message&quot;&amp;gt;{{ 'Nachricht' | t }}*&amp;lt;/label&amp;gt;&#xA;   &amp;lt;textarea id=&quot;frm_message&quot; name=&quot;fields[message]&quot; value=&quot;{% if formHandle.message is defined %}{{ formHandle.message }}{% endif %}&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;    {% if form is defined %}&#xA;        {{ errorList(form.getErrors('message')) }}&#xA;    {% endif %}&#xA;&#xA;&#xA;  &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not displaying any errors if the field is empty. What do I miss? I made the field required in the CP but the macro is not showing when hitting &quot;submit&quot; with the field empty.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2017-07-18T18:39:04.560" LastActivityDate="2017-09-03T00:48:30.790" Title="amforms no error handling" Tags="&lt;error-handling&gt;&lt;plugin-amforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21242" PostTypeId="1" CreationDate="2017-07-18T08:39:16.940" Score="2" ViewCount="174" Body="&lt;p&gt;I'm trying to add an file upload/attachment to my Sprout Form submission, but even though all the other fields are saved &amp;amp; the Sprout Email notification is sent - the file field remains empty - no file is uploaded &amp;amp; so no attachment is sent. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've checked that my form contains enctype=&quot;multipart/form-data&quot; &lt;/li&gt;&#xA;&lt;li&gt;I've checked that the file type I'm trying to upload is an allowed file&#xA;type for the Asset folder ie: PDF &lt;/li&gt;&#xA;&lt;li&gt;I've checked that the file is a reasonable size - in this case 3KB &lt;/li&gt;&#xA;&lt;li&gt;I've checked the craft log, sprout forms log &amp;amp; sprout email log &amp;amp; there are no errors.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas ? Below is my form code - what am I missing ? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;careerApplication&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; &#xA;enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;careerApplication&quot;&amp;gt;      &#xA;&amp;lt;fieldset&amp;gt;&#xA;    {{ craft.sproutForms.displayField('careerApplication.fullName') }}&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;label for=&quot;fields[refNo]&quot;&amp;gt;Reference #&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[refNo]&quot; id=&quot;fields-refNo&quot; readonly value=&quot;{{ craft.request.getParam('ref') }}&quot; /&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    {{ craft.sproutForms.displayField('careerApplication.email') }}&#xA;&amp;lt;/fieldset&amp;gt;&#xA;&amp;lt;fieldset&amp;gt;&#xA;    {{ craft.sproutForms.displayField('careerApplication.telephone') }}&#xA;&amp;lt;/fieldset&amp;gt; &#xA;&amp;lt;fieldset&amp;gt;         &#xA;    &amp;lt;label for=&quot;motivation&quot;&amp;gt;Motivation&amp;lt;/label&amp;gt;&#xA;    &amp;lt;textarea name=&quot;fields[motivation]&quot; id=&quot;fields-motivation&quot; placeholder=&quot;Motivation&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;/fieldset&amp;gt; &#xA;&amp;lt;fieldset&amp;gt;&#xA;    &amp;lt;label for=&quot;cvUpload&quot;&amp;gt;Submit your CV:&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;fields[cvUpload]&quot; id=&quot;fields-cvUpload&quot; /&amp;gt;    &#xA;&amp;lt;/fieldset&amp;gt;                   &#xA;{{ craft.sproutInvisibleCaptcha.protect() }}&#xA;&amp;lt;input id=&quot;submit_application&quot; name=&quot;submit_application&quot; type=&quot;button&quot; value=&quot;Submit Application&quot; class=&quot;red-btn&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-07-19T09:14:50.627" Title="Cannot get file upload/attachment with Sprout Forms working" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21243" PostTypeId="2" ParentId="21212" CreationDate="2017-07-18T08:42:40.640" Score="2" Body="&lt;p&gt;This is untested as I dont have anything set that meets these conditions to try it out in, but I think you can use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetElements = ['and'] %}&#xA;{% for category in productSpecsCategory %}&#xA;    {% set targetElements = targetElements|merge([{ targetElement: category }]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.commerce.products('footwear').relatedTo(targetElements) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inspired by this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5107/users-relatedto-multiple-categories&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-18T08:42:40.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21244" PostTypeId="2" ParentId="21241" CreationDate="2017-07-18T08:45:31.517" Score="0" Body="&lt;p&gt;I had the same issue this morning, after trial and error I got it working with the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.amForms.getForm('contactForm') %}&#xA;{% from _self import errorList %}&#xA;&#xA;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;               &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% if craft.request.getParam('submitted') == form.handle %}&#xA;    &amp;lt;p class=&quot;submit-notification&quot;&amp;gt;{{ form.afterSubmitText|default('Thanks for your submission.'|t) }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% else %}&#xA;    {%- set submitValue = (form.submitButton ? form.submitButton : 'Submit'|t) -%}&#xA;&#xA;    &amp;lt;form class=&quot;contact-form&quot; method=&quot;post&quot; action=&quot;#form&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        {# This should always be here! #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;&#xA;        {# Insert your form's handle. #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&#xA;        {# Optional: Anti-spam protection. #}&#xA;        {{ craft.amForms.displayAntispam() }}&#xA;&#xA;&#xA;        {# Place the HTML of your fields here #}&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; id=&quot;frm_fullName&quot; name=&quot;fields[fullName]&quot; placeholder=&quot;Uw naam&quot; value=&quot;{% if formHandle.fullName is defined %}{{ formHandle.fullName }}{% endif %}&quot;&amp;gt;&#xA;        {% if contactForm is defined %}&#xA;            {{ errorList(contactForm.getErrors('fullName')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;input type=&quot;text&quot; id=&quot;frm_telephoneNumber&quot; name=&quot;fields[telephoneNumber]&quot; placeholder=&quot;Telefoonnummer&quot; value=&quot;{% if formHandle.telephoneNumber is defined %}{{ formHandle.telephoneNumber }}{% endif %}&quot;&amp;gt;&#xA;        {% if contactForm is defined %}&#xA;            {{ errorList(contactForm.getErrors('telephoneNumber')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;textarea id=&quot;form_comment&quot; name=&quot;fields[comment]&quot; value=&quot;{% if formHandle.comment is defined %}{{ formHandle.comment }}{% endif %}&quot; placeholder=&quot;Uw vraag&quot; rows=&quot;4&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;        {% if contactForm is defined %}&#xA;            {{ errorList(contactForm.getErrors('comment')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;submit-button&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;{{ submitValue }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try to change your markup from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if form is defined %}&#xA;    {{ errorList(form.getErrors('message')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if contactForm is defined %}&#xA;    {{ errorList(form.getErrors('message')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps&lt;/p&gt;&#xA;" OwnerUserId="7011" LastActivityDate="2017-07-18T08:45:31.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21245" PostTypeId="1" CreationDate="2017-07-18T09:19:00.257" Score="1" ViewCount="49" Body="&lt;p&gt;I have the Craft Commerce based webshop and need a developer to create plugin for Klarna Checkout (&lt;a href=&quot;https://knowledge.klarna.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://knowledge.klarna.com&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="6891" LastActivityDate="2017-07-18T12:09:56.547" Title="What is the best to find a developer to create a Craft plugin?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21246" PostTypeId="2" ParentId="21245" CreationDate="2017-07-18T09:23:05.507" Score="2" Body="&lt;p&gt;There are a couple of options, as far as I know:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/professionals&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft&lt;/a&gt; community site&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Slack&lt;/a&gt; has a jobs channel&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.workwithcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Work With Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="115" LastEditDate="2017-07-18T12:09:56.547" LastActivityDate="2017-07-18T12:09:56.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21248" PostTypeId="1" AcceptedAnswerId="21283" CreationDate="2017-07-18T10:59:58.470" Score="2" ViewCount="413" Body="&lt;p&gt;This is the situation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've got 3 locales (en, nl, fr)&lt;/li&gt;&#xA;&lt;li&gt;I've got an XML file with content in those 3 locales&lt;/li&gt;&#xA;&lt;li&gt;I've set up the field mapping in feedme&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But what I can't seem to figure out is how to import the entries from the XML file into combined entries in Craft, meaning, I want elements from my XML file (the same content in 3 locales) to be 1 craft entry in those 3 locales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each time I do the import, I'm stuck with all of them being in the same locale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if any additional information is needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers as to what I'm doing wrong would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-07-18T11:34:18.300" LastActivityDate="2017-07-20T09:43:19.050" Title="Importing content with feedme to single entry in 3 locales" Tags="&lt;localization&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21249" PostTypeId="1" AcceptedAnswerId="21287" CreationDate="2017-07-18T11:20:14.270" Score="2" ViewCount="3101" Body="&lt;p&gt;On Craft 3 I am iterating over matrix elements and I need to check if a certain property &quot;videoPoster&quot; exists. It's an asset field, so I actually want to check its length, but I'am already failing to check if it's available...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;ce&quot; is one block of my matrix, this is what I'm doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ ce.videoPoster is defined ? 'yes' : 'no' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works, gives me a nice &quot;Yes&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything else does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ ce.videoPoster is defined and ce.videoPoster ? 'yes' : 'no' }}&#xA;{{ ce.videoPoster is defined and ce.videoPoster is not null ? 'yes' : 'no' }}&#xA;{{ ce.videoPoster is defined and ce.videoPoster | length ? 'yes' : 'no' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Exception: Calling unknown method: craft\elements\MatrixBlock::videoPoster()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct check? I just want to know if I can call &lt;code&gt;ce.videoPost.one()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-20T14:22:14.757" Title="How to check if object property exists" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21250" PostTypeId="1" CreationDate="2017-07-18T14:34:50.113" Score="2" ViewCount="812" Body="&lt;p&gt;Hope this kind of question (a pointer request, actually) is alright with StackExchange guidelines. We're looking to store all our data in ES. Is this possible at the moment? Any plugin to do so? We're happy to explore Enterprise pricing if needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="6159" LastActivityDate="2017-07-23T01:48:05.907" Title="Craft with ElasticSearch as a backend" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21251" PostTypeId="2" ParentId="13227" CreationDate="2017-07-18T14:52:19.180" Score="3" Body="&lt;p&gt;Just had a similar issue with a colleague. &lt;strong&gt;Double check your folder permissions&lt;/strong&gt;. It might be the case that Craft isn’t allowed to write the transformed files to your assets folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like &lt;code&gt;chmod -R 777 public/assets&lt;/code&gt; might do the trick. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You might want set this to something other than &lt;code&gt;777&lt;/code&gt; if it worked out. Look at &lt;a href=&quot;https://craftcms.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt; for details.)&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-07-18T14:52:19.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21252" PostTypeId="1" CreationDate="2017-07-18T15:35:55.403" Score="1" ViewCount="283" Body="&lt;p&gt;I have a section that has multiple entry types. I would like to use kebab-style url segments in the URL format. I can get the articles to serve kebab URIs using this for the section's Entry URL Format: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;our-firm/{type.name|kebab}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this will not call the template when making the page call — needs to be: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;our-firm/{type}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, how do you set things up to have the best of both worlds: kebab'd url segments and working templates?&lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2017-07-19T06:56:17.043" Title="Custom routes using kebab {type} in URL segment" Tags="&lt;routes&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21253" PostTypeId="2" ParentId="13227" CreationDate="2017-07-18T16:12:36.657" Score="1" Body="&lt;p&gt;Not a direct answer to your question, but I keep a pretty up to date Nginx config for Craft here: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt; that may be useful to you at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Glad you got it sorted.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-18T16:12:36.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21254" PostTypeId="1" AcceptedAnswerId="21267" CreationDate="2017-07-18T16:18:31.333" Score="1" ViewCount="119" Body="&lt;p&gt;How can I get a specific value from the submitted form? E.g. the fullName field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default template loops through all the fields with a switch but I just want to output one specific field. Can't get it to work.&lt;/p&gt;&#xA;" OwnerUserId="7011" LastEditorUserId="7011" LastEditDate="2017-07-18T16:33:22.277" LastActivityDate="2017-07-20T08:08:59.110" Title="amforms - Specific entry in the notification template" Tags="&lt;plugin-amforms&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21255" PostTypeId="2" ParentId="21249" CreationDate="2017-07-18T16:19:47.107" Score="1" Body="&lt;p&gt;So in general, for things like this, I think the null coalescing operator in Twig is really useful. Something like &lt;code&gt;{% set myImage = entry.someImage ?? entry.someOtherImage ?? null %}&lt;/code&gt; will set &lt;code&gt;myImage&lt;/code&gt; to the first thing that is defined and is not null, from left to right.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-18T16:19:47.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21257" PostTypeId="2" ParentId="21237" CreationDate="2017-07-18T18:57:15.340" Score="1" Body="&lt;p&gt;If the compiled template class names start with &lt;code&gt;__string_template&lt;/code&gt;, then that means the source template doesn't live in the &lt;code&gt;craft/templates&lt;/code&gt; folder, but it was rendered at runtime by calling Twig's &lt;code&gt;Environment-&amp;gt;createTemplate()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft does this for rendering Twig strings to a template for things like a Section's Entry URL Format settings, which can be any valid Twig code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins can also do this as well.  Do you happen to have the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse&lt;/a&gt; plugin installed?  Seems like a potential candidate if so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit of a hacky workaround, but you could always setup a cron-job to delete the contents of that folder either full-on or based on some other logic (how old they are, number of files, etc.).  They'll get re-generated as needed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-18T18:57:15.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21258" PostTypeId="2" ParentId="21254" CreationDate="2017-07-18T19:01:31.053" Score="0" Body="&lt;p&gt;Have never used the plugin before, but according to their &lt;a href=&quot;https://github.com/am-impact/amforms#simple-field-tag&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, it should just be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.amForms.getForm('yourFormHandle') %}&#xA;&#xA;{{ form.displayField('fullName') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-18T19:01:31.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21259" PostTypeId="1" AcceptedAnswerId="21277" CreationDate="2017-07-18T19:34:44.357" Score="1" ViewCount="240" Body="&lt;p&gt;I am new to Craft plugin development, so I apologize ahead of time for my lack of understanding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a plugin that allows the user to &quot;upload&quot; Excel/csv files via the control panel that then get sent to an API via Javascript. I then want to save the returned data to my plugin's record. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I have a JSON object with all the necessary data and a record set up as such:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;class GeocodeFile_LocationsRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'geocodefile_locations';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'id'       =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true),&#xA;            'type'    =&amp;gt; array(AttributeType::Bool, 'default' =&amp;gt; false),&#xA;            'name'       =&amp;gt; array(AttributeType::Name, 'default' =&amp;gt; null),&#xA;            'address'        =&amp;gt; array(AttributeType::Name, 'default' =&amp;gt; null),&#xA;            'city'         =&amp;gt; array(AttributeType::Name, 'default' =&amp;gt; null),&#xA;            'state'   =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; null),&#xA;            'zip'       =&amp;gt; array(AttributeType::Number, 'default' =&amp;gt; false),&#xA;            'url'     =&amp;gt; array(AttributeType::Name, 'default' =&amp;gt; true),&#xA;            'lat'   =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; null),&#xA;            'lng' =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; null)&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to save this JSON data to the record directly, or is there a way to create a model in Javascript that could then be saved to the table? Perhaps I can send the data to a service that would handle it instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, I don't know how this is supposed to be handled. Any help with the matter would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry again for my naiveté on this subject! &lt;/p&gt;&#xA;" OwnerUserId="7014" LastActivityDate="2017-07-19T21:01:01.193" Title="Saving Form Data to Plugin Record via Javascript" Tags="&lt;database&gt;&lt;javascript&gt;&lt;json&gt;&lt;models&gt;&lt;records&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21260" PostTypeId="2" ParentId="20663" CreationDate="2017-07-18T19:57:18.783" Score="1" Body="&lt;p&gt;I ran into the same problems as you and I believe I've solved it, but it may be different for your specific use case.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There may be a way to control this with the &lt;code&gt;init&lt;/code&gt; options but I wasn't able to find a way to do it, so I just edited the &lt;code&gt;searchplus.js&lt;/code&gt; code directly in the &lt;code&gt;searchplus&lt;/code&gt; folder. Look for something like &lt;code&gt;e.getFacetValues(i,{sortBy:[&quot;isRefined:desc&quot;,&quot;count:desc&quot;]})&lt;/code&gt; and change it to &lt;code&gt;e.getFacetValues(i,{sortBy:[&quot;name:asc&quot;]})&lt;/code&gt; instead (you can leave the &lt;code&gt;isRefined:desc&lt;/code&gt; part at the front as well if you would like the filtered options to automatically populate to the top of the list). Keep in mind that changing the &lt;code&gt;js&lt;/code&gt; file is a global change which would affect other faceted forms if you have more than one on your site.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you define the facets in your &lt;code&gt;init&lt;/code&gt; code: &lt;code&gt;$(this).searchplus({facets: ['facet1', 'facet2'],});&lt;/code&gt;, replace &lt;code&gt;facets&lt;/code&gt; with &lt;code&gt;disjunctiveFacets&lt;/code&gt; and you should stop seeing filters disappear from the facet you're selecting (see faceting options on &lt;a href=&quot;http://squarebit.co.uk/software/craft/searchplus/usage/javascript-setup/helper-reference#facet-parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Search Plus docs&lt;/a&gt;. The other facet's filters &lt;em&gt;will&lt;/em&gt; disappear though depending on if there are valid matches or not, but it will at least prevent the other filters from your &lt;em&gt;selected&lt;/em&gt; facet from disappearing immediately.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5531" LastActivityDate="2017-07-18T19:57:18.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21261" PostTypeId="1" CreationDate="2017-07-18T19:57:32.513" Score="2" ViewCount="226" Body="&lt;p&gt;I love the notion of tasks, especially for large processes, but I've found that their isn't a lot of documentation around it which makes trouble shooting them via an authoritative source difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things I've found out that I had misconceptions on:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A task is &lt;em&gt;one&lt;/em&gt; request, no matter how many steps it has, that runs in the background.&lt;/li&gt;&#xA;&lt;li&gt;Sub tasks are all part of that initial task's one request&lt;/li&gt;&#xA;&lt;li&gt;Since a task is a single request it is subjected to the same PHP Limitations that a normal request would be (i.e., memory limit) (this really comes into play when important large amounts of data in a dev environment because there's a lot of information that's being logged via a single request -- could be 100s of MB of log files in request&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some things I'm still confused about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Does a task run with a separate session ID and thread than the browser that initiated the task via the CP request? I've noticed using the Power Nap plugin that if I initiate the running of task via a CP request I can navigate to other pages while the task is still running, but with other plugins that import Commerce data, I have to wait until the entire import is done before I can navigate to another page.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do multiple queued tasks all get a single request or are they lumped into a single request?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I need to insert thousands of entries is it more performant / desirable to place all entries in a single task or queue a task for each entry?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm sure their will be more, but I definitely think a single location for figuring out the benefits / use cases / pitfalls of Craft Tasks will be hugely beneficial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the discussion.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2017-08-11T05:37:37.227" Title="Can someone demystify tasks with a little more detail?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21262" PostTypeId="1" CreationDate="2017-07-18T20:50:32.013" Score="1" ViewCount="87" Body="&lt;p&gt;Is there a straightforward way of saving the input of two form fields when a form is submitted from the front end and reusing it in another form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One field is a select2 field (Users) which can contain multiple users and the other is a number field (Log ID).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current workflow is that a user fills out a form and it's submitted to the database.  It's very likely that he will need to fill out additional forms immediately afterwards and two of the fields he inputed (Users and Log ID Number) in the first form are the same in the second form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workflow that came to mind was whether after first form submission, I could append the Users and Log ID into the url query string and then have them available to prepopulate in the additional forms.  Perhaps on a successful form submission page, I could have a button to allow the user to submit another form and if clicked, it goes to the new form page and grabs the url query string values and enters the info in the two fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Totally open to other ways of seeing this too so feel free to throw your thoughts out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;Lori&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2017-07-19T07:12:17.957" Title="Save field inputs upon submission of front end form for reuse in new form?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21263" PostTypeId="2" ParentId="21252" CreationDate="2017-07-19T06:56:17.043" Score="1" Body="&lt;p&gt;You could have a try with &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic routing&lt;/a&gt;, where you map a URL (or a url pattern) to a specific template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dynamic routes take priority over template paths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I misunderstood you, can you give an example as to what the URL is for a specific entry compared to what you need it to be?&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-19T06:56:17.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21264" PostTypeId="2" ParentId="21262" CreationDate="2017-07-19T07:12:17.957" Score="1" Body="&lt;p&gt;I don't know if we can compare the problem I usually have but here is my way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I build a website where users can login and save &quot;entries&quot; they also need to stay connected to it off course.&#xA;I make sure the title of the new made entry got the users ID in it. So if someone makes a new entry they go to a succes page after the form is submitted. This success page is actually the entry they created. The moment they land on that page the &quot;second&quot; form will be automatically filled in with the details I need and then save/update whatever needs to be updated (most of the times for me that would be saving the entry to a user profile). After the second form submit's I redirect them to the page I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would include some javascript.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-07-19T07:12:17.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21265" PostTypeId="2" ParentId="19809" CreationDate="2017-07-19T08:27:12.820" Score="2" Body="&lt;p&gt;Craft includes a function called &lt;code&gt;getVersionsByEntryId&lt;/code&gt;, but its full functionality isn't exposed by default. You have to create a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;template variable&lt;/a&gt; to get the most recent version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only need the most recent version, you can add the following to your plugin's variables: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @param  EntryModel $entry The entry to search for.&#xA; * @return EntryVersionModel&#xA; */&#xA;public function getCurrentVersion($entry)&#xA;{&#xA;  $versions = craft()-&amp;gt;entryRevisions-&amp;gt;getVersionsByEntryId($entry-&amp;gt;id, $entry-&amp;gt;locale, 1, true);&#xA;  return reset($versions);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can grab the author within your templates with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.pluginName.getCurrentVersion(entry).creator }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;" OwnerUserId="6709" LastEditorUserId="-1" LastEditDate="2018-02-21T21:29:48.410" LastActivityDate="2018-02-21T21:29:48.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21266" PostTypeId="2" ParentId="21242" CreationDate="2017-07-19T09:14:50.627" Score="2" Body="&lt;p&gt;Figured out what my problem was: I was trying to submit the form via Ajax, that's why the submit button is set to input type=&quot;button&quot; &#xA;I changed the submit button to input type=&quot;submit&quot; &amp;amp; it worked.&#xA;Not 100% sure how to make it work with Ajax but pretty sure it has something to do with the way the data is serialized. I don't really need Ajax submission in this instance, so not bothering with it anymore. &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2017-07-19T09:14:50.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21267" PostTypeId="2" ParentId="21254" CreationDate="2017-07-19T09:44:33.130" Score="1" Body="&lt;p&gt;You can get the value of a specific field by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ submission.fieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ submission.fullName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7011" LastEditorUserId="7011" LastEditDate="2017-07-20T08:08:59.110" LastActivityDate="2017-07-20T08:08:59.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21269" PostTypeId="1" AcceptedAnswerId="21284" CreationDate="2017-07-19T13:43:19.317" Score="2" ViewCount="1105" Body="&lt;p&gt;I've got some static text that is dynamically being displayed on the frontend with JavaScript. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now considering the site has 3 locales, how do I best translate those static texts? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could put the JavaScript code in my twig files and use the translate filter, but that is what I'm trying to avoid as I like to keep the HTML &amp;amp; JavaScript separated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to pass on certain messages to a script? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://craftcms.stackexchange.com/a/986/6991&quot;&gt;this answer&lt;/a&gt;, I learned there's such a thing as &lt;code&gt;Craft.t&lt;/code&gt; but I can't seem to access it from the frontend. Can it be included? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT - To clarify what I'm looking for, it's something in the likes off &lt;a href=&quot;https://codex.wordpress.org/Function_Reference/wp_localize_script&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Wordpress concept&lt;/a&gt;, where you can pass some variables from the server to a javascript script. It would allow me to make some global fields to store the translations in, and make those translations editable from the backend.  But I'm guessing that's not possible? &lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-07-20T05:43:52.870" LastActivityDate="2017-07-20T13:27:02.763" Title="Translating static text in JavaScript files" Tags="&lt;localization&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21270" PostTypeId="2" ParentId="21269" CreationDate="2017-07-19T14:31:55.670" Score="1" Body="&lt;p&gt;I had a similar problem with a non craft project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our solution was to create a lang.js which only contained a lang object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const lang = {&#xA;  'de': {&#xA;    'greeting': 'Hallo'&#xA;  },&#xA;  'fr': {&#xA;    'greeting': 'Bonjour'&#xA;  },&#xA;  'en': {&#xA;    'greeting': 'Hello'&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We include said lang.js and and I've we ever used text in javascript we got our text from the lang.js.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lang['fr'].greeting&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We stored the current language in a variable to access the text dynamically.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2017-07-19T18:27:17.623" LastActivityDate="2017-07-19T18:27:17.623" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21271" PostTypeId="1" CreationDate="2017-07-19T15:13:46.877" Score="1" ViewCount="755" Body="&lt;p&gt;I am an in-house graphic designer with virtually no experience with building websites.&#xA;My company has a website built with Craft for which we have an admin to change some content like images and tables. &#xA;Some pages are not customizable at all. It seems they might have been constructed only with CSS and HTML. I don't know.&#xA;Now, we need to change these pages and build new ones using the same structure.&#xA;The agency that built the website seems to be ghosting on us so we have to find a solution to make the changes ourselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I access the code with my admin? &#xA;Is is possible that the guy who built the site restricted our access to the code?&lt;/p&gt;&#xA;" OwnerUserId="7018" LastEditorUserId="57" LastEditDate="2017-07-19T18:29:14.040" LastActivityDate="2017-07-19T18:29:14.040" Title="Can I access the code with my admin" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21272" PostTypeId="2" ParentId="21271" CreationDate="2017-07-19T15:20:49.847" Score="2" Body="&lt;p&gt;The template and CSS code cannot be accessed from the admin. You'll need to gain access to the git repository that (hopefully) exists with your site's code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or in a less-preferable scenario, you could access the server via FTP and modify the templates and CSS there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to take a read through the &lt;a href=&quot;https://craftcms.com/docs/folder-structure&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS docs&lt;/a&gt; as a starting point to get a little better idea of how the files are structured.&lt;/p&gt;&#xA;" OwnerUserId="14" LastEditorUserId="57" LastEditDate="2017-07-19T18:28:30.280" LastActivityDate="2017-07-19T18:28:30.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21273" PostTypeId="2" ParentId="21271" CreationDate="2017-07-19T16:13:00.547" Score="2" Body="&lt;p&gt;Snide remarks about the &quot;agency&quot; who left you high and dry aside, who is currently hosting the website? Start there and gain access to the actual website files. Whether you have another agency help you clean this up or you do it yourself, you'll need to have a login and password of some sort. The most common access is FTP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of moving parts here but here's a quick 10,000 foot overview. Like most content management systems (CMS), Craft has 2 components: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the database (that holds your content)&lt;/li&gt;&#xA;&lt;li&gt;the programming &quot;code&quot; (in this case PHP, the software that runs behind the scenes that allows you to make changes and updates using the web based interface)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Craft websites sites are also built using &lt;a href=&quot;https://craftcms.com/docs/twig-primer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig&lt;/a&gt; &lt;em&gt;templates&lt;/em&gt;, which are, as you presumed, essentially HTML and CSS. You can think of templates as &lt;em&gt;containers&lt;/em&gt; for content.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's probably multiple templates: one for the home page, another for the blog, etc.  Depending on what you need to edit, you'll need to find where that content is actually saved. The content that you can edit is stored in the admin section using &lt;a href=&quot;https://craftcms.com/features/custom-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;fields&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much like Photoshop has multiple layers that store individual pieces of content, fields do much the same way in Craft. Instead of storing a bunch of content in one layer, you break it up so can manipulate it easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you add content in the &quot;admin&quot; area, the template decides &lt;em&gt;where&lt;/em&gt; in the template to spit that content out and also how it's presented.   If you can't access the content in the admin, it means it's in a template somewhere that you can't edit through the admin screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we build websites for clients, we try to avoid doing that and allow the user to edit the website's content using the admin panel but depending on how they set things up, it sounds like they took some shortcuts.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-07-19T16:13:00.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21275" PostTypeId="1" AcceptedAnswerId="21276" CreationDate="2017-07-19T17:53:52.117" Score="2" ViewCount="205" Body="&lt;p&gt;In a customized Sprout Form field, is it possible to have radio buttons and checkboxes with a &lt;code&gt;value&lt;/code&gt; of &lt;code&gt;other&lt;/code&gt; have an additional text input in the &lt;code&gt;label&lt;/code&gt;? This text input would presumably need to be tied to a separate text field in Sprout Forms which would not render with the other normal plaintext fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way to create a custom field that would make it possible to add the boolean radio/checkbox and input together with something like a matrix? We have multiple &quot;other&quot; + text input fields on the page we're trying to create. No set of &lt;code&gt;options&lt;/code&gt; will ever have more than one &lt;code&gt;other&lt;/code&gt; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting markup might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if type == 'radiobuttons' %} {# Or 'mycustomradiobuttontype' #}&#xA;  &amp;lt;ol&amp;gt;&#xA;    {%- for key, option in options %}&#xA;      {%- set label = (option.label is defined ? option.label : option) %}&#xA;      {%- set value = (option.value is defined ? option.value : key) %}&#xA;      {%- set checked = (value == selectedValue) %}&#xA;&#xA;      &amp;lt;li class=&quot;radio&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;radio&quot;&#xA;          {%- if id %} id=&quot;{{ id }}-{{ loop.index }}&quot;{% endif %}&#xA;          {%- if name %} name=&quot;{{ name }}&quot;{% endif %}&#xA;          {%- if value %} value=&quot;{{ value }}&quot;{% endif %}&#xA;          {%- if checked is defined and checked %} checked{% endif %}&#xA;          {{- dataAttributes -}}&amp;gt;&#xA;        &amp;lt;label {%- if id %} for=&quot;{{ id }}-{{ loop.index }}&quot;{% endif %}&amp;gt;&#xA;          {%- if label is defined %}{{ label|raw }}{% endif -%}&#xA;          {% if value == 'other' %}&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;TODO&quot; value=&quot;TODO&quot;&amp;gt;&#xA;          {% endif %}&#xA;        &amp;lt;/label&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ol&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7020" LastEditorUserId="115" LastEditDate="2017-07-19T19:18:50.977" LastActivityDate="2017-07-19T19:18:50.977" Title="Sprout Forms: creating additional text inputs in radio and checkbox labels" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21276" PostTypeId="2" ParentId="21275" CreationDate="2017-07-19T19:18:35.900" Score="1" Body="&lt;p&gt;The best approach for Radio Button and Checkbox Fields with a Select Other option would be to create a custom field (or fields) using Sprout Forms &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Front-end Field API&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the existing Radio Button and Checkbox Fields as a starting point and adapt their UI's to present your users with the Select Other option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can review the front-end field classes in the Sprout Forms plugin here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sproutforms/integrations/sproutforms/fields/SproutFormsCheckboxesField.php&lt;/li&gt;&#xA;&lt;li&gt;sproutforms/integrations/sproutforms/fields/SproutFormsRadioButtonsField.php&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's on our list to add support for front-end fields with this behavior, but it will likely happen after Craft 3 is released. Please reach out if we can help with answering any questions regarding how to implement custom Front-end Fields or custom development support.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-07-19T19:18:35.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21277" PostTypeId="2" ParentId="21259" CreationDate="2017-07-19T21:01:01.193" Score="0" Body="&lt;p&gt;Assuming you've got a controller endpoint in your plugin that has an action, the pseudocode for a simple solution could be something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Grab the JSON data from post.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://php.net/manual/en/function.json-decode.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;json_decode&lt;/code&gt;&lt;/a&gt; it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Loop through the JSON data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Instantiate a new record and assign the properties to it inside the loop.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = new GeocodeFile_LocationsRecord();&#xA;$record-&amp;gt;id = $jsonData['id];&#xA;$record-&amp;gt;type = $jsonData['type'];&#xA;...&#xA;$record-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-19T21:01:01.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21278" PostTypeId="2" ParentId="20808" CreationDate="2017-07-19T22:34:56.277" Score="4" Body="&lt;p&gt;I've done this, and I believe the trick was to return &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Looks like this was fixed in version 1.5.2, returning false will skip the entry as expected.&lt;/p&gt;&#xA;" OwnerUserId="824" LastEditorUserId="824" LastEditDate="2018-01-30T19:59:00.393" LastActivityDate="2018-01-30T19:59:00.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21279" PostTypeId="1" AcceptedAnswerId="21281" CreationDate="2017-07-20T01:10:18.350" Score="2" ViewCount="243" Body="&lt;p&gt;I have one site on my server that's currently using Craft, and I'd like to setup a second one to use Craft as well. Can I rename the craft folder, and then set the $craftPath variable to point to it? &lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2017-07-20T04:23:05.647" Title="Can I rename my craft/ folder?" Tags="&lt;admin&gt;&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21280" PostTypeId="1" AcceptedAnswerId="21288" CreationDate="2017-07-20T03:09:04.900" Score="1" ViewCount="891" Body="&lt;p&gt;Before I dive into my problem, I do want to mention that I &lt;strong&gt;did&lt;/strong&gt; do my due diligence and spent the last two days researching this problem, to no avail, so here it goes: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm getting the following error when trying to load an action method from the controller: &lt;code&gt;Unable to resolve the request &quot;ecaApi/main/doGeocodeRequest&quot;.&lt;/code&gt; I get this error if I try and navigate directly to it, e.g. domain.com/actions/ecaApi/main/doGeocodeRequest&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The AJAX request below also generates a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;File Structure:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- craft/plugins&#xA;  - ecaapi&#xA;    - controllers&#xA;      --EcaApi_MainController.php&#xA;    --EcaApiPlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EcaApi_MainController.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; namespace Craft;&#xA;&#xA;    class EcaApi_MainController extends BaseController&#xA;    {&#xA;        protected $allowAnonymous = true;&#xA;&#xA;        public function actionDoGeocodeRequest() {&#xA;            //.....&#xA;            $this-&amp;gt;returnJson($result);&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;JS ajax call to the action method&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    var data = {&#xA;        address: &quot;{{ event.event_location }}&quot;&#xA;    };&#xA;    data[csrfTokenName] = csrfTokenValue;&#xA;    data['action'] = 'ecaApi/main/doGeocodeRequest';&#xA;    $.ajax({&#xA;        method: &quot;POST&quot;,&#xA;        url: &quot;/&quot;,&#xA;        data: data&#xA;    })&#xA;        .done(function (data) {&#xA;            console.log(data);&#xA;            markers[{{ event.id }}] = new google.maps.Marker({&#xA;                position: new google.maps.LatLng(data.results[0].geometry.location.lat, data.results[0].geometry.location.lng),&#xA;                map: map,&#xA;                {% if mapSettings.mapIcon %}&#xA;                icon: mapMarkerIcon,&#xA;                {% endif %}&#xA;                title: &quot;{{ event.title }}&quot;&#xA;            });&#xA;            var content = '&amp;lt;a href=&quot;{{ event.url|replace({'http://': 'https://'}) }}&quot;&amp;gt;{{ event.title }}&amp;lt;/a&amp;gt;';&#xA;            var window = new google.maps.InfoWindow({&#xA;                content: content&#xA;            });&#xA;            markers[{{ event.id }}].addListener('click', function () {&#xA;                window.open(map, markers[{{ event.id }}]);&#xA;            });&#xA;&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated, I've been pulling out my hair for days over this.&lt;/p&gt;&#xA;" OwnerUserId="7004" LastEditorUserId="7004" LastEditDate="2017-07-20T03:26:46.117" LastActivityDate="2017-07-20T23:17:06.590" Title="Error 404 When trying to POST to plugin Controller action" Tags="&lt;ajax&gt;&lt;controller&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21281" PostTypeId="2" ParentId="21279" CreationDate="2017-07-20T04:23:05.647" Score="4" Body="&lt;p&gt;Absolutely! In fact, you've outlined the steps needed to do so...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Rename &lt;code&gt;craft&lt;/code&gt; folder&lt;/li&gt;&#xA;&lt;li&gt;Change &lt;code&gt;$craftPath&lt;/code&gt; value in &lt;code&gt;index.php&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-07-20T04:23:05.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21282" PostTypeId="2" ParentId="20925" CreationDate="2017-07-20T06:37:51.750" Score="1" Body="&lt;p&gt;This was a bug in a beta version of Craft 3 (fixed here: &lt;a href=&quot;https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/9b6dad7385c5a82d1c83d230fe6ce0cfe940675b&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-20T06:37:51.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21283" PostTypeId="2" ParentId="21248" CreationDate="2017-07-20T09:43:19.050" Score="1" Body="&lt;p&gt;This is how I managed to do the import&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create extra field on entry to save common ID (will be used to link 3 locales together)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up feed for each locale with following settings:&#xA;- import strategy: create &amp;amp; update&#xA;- newly created field as unique identifier&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Run each import separately&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feedme will than for the first locale create the entries, and for following locales, update the first one if the id field matches &amp;amp; add the translation to the entry.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-20T09:43:19.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21284" PostTypeId="2" ParentId="21269" CreationDate="2017-07-20T13:27:02.763" Score="2" Body="&lt;p&gt;For now I'm going with this solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;&#xA;    var translatedLabels = {&#xA;        'name' : {{'Uw naam'|translate}},&#xA;        'email' : {{'Uw e-mail adres'|translate}},&#xA;        'email_receiver' : {{'E-mail adres van de ontvanger'|translate}},&#xA;    }&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above is in a template file that gets included on the relevant pages, if it turns out I'll need those or other translated texts in multiple parts of the website, I might just include it in the basic layout directly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It allows me to keep doing the translations from the backend with that translation plugin and I can now use the translated messages in my Javascript generated HTML. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-20T13:27:02.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21285" PostTypeId="1" AcceptedAnswerId="21286" CreationDate="2017-07-20T13:45:56.323" Score="2" ViewCount="76" Body="&lt;p&gt;Me and my coworker work on the same Craft project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We work locally with MAMP but access the database online, which works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the assets I'd like to define separate localhost basepaths, since we don't have the same folder structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make this work or do I need to work with IP's instead of localhost?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also be open to set the assets relative instead of absolute to make this work.&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2017-07-20T17:03:18.357" LastActivityDate="2017-07-20T17:03:42.860" Title="Multiple localhost config settings" Tags="&lt;assets&gt;&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21286" PostTypeId="2" ParentId="21285" CreationDate="2017-07-20T14:04:40.707" Score="3" Body="&lt;p&gt;Here's a &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi environment config&lt;/a&gt; guide that I think will accomplish all you need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It allows for environment specific DB connection parameters, but can also set filepaths, that why you can keep your assets path relative in regards to the path set in the environment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's an extension to the multi-environment setup as discussed &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any questions after reading that, feel free to ask. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="57" LastEditDate="2017-07-20T17:03:42.860" LastActivityDate="2017-07-20T17:03:42.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21287" PostTypeId="2" ParentId="21249" CreationDate="2017-07-20T14:22:14.757" Score="7" Body="&lt;p&gt;Just found the trick: When you access an object in array style, you can test via &lt;code&gt;is defined&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object['property'] is defined ? 'defined' : 'not defined' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you will get reliable results.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-07-20T14:22:14.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21288" PostTypeId="2" ParentId="21280" CreationDate="2017-07-20T23:17:06.590" Score="1" Body="&lt;p&gt;Ok so thanks to @BradBell's suggestion, I regenerated the skeleton of my plugin and it's controller using &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; and it now magically works! Still not sure exactly what the difference was, but it does its job now!&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2017-07-20T23:17:06.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21289" PostTypeId="1" CreationDate="2017-07-21T07:36:01.430" Score="1" ViewCount="39" Body="&lt;p&gt;I'm new to Craft.  I've the following questions about locales for a international company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Configuration could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'domain.com/en',&#xA;    'en_us' =&amp;gt; 'domain.com/us'&#xA;    'it' =&amp;gt; 'domain.com/it',&#xA;    'de' =&amp;gt; 'domain.com/de',&#xA;    'es_es' =&amp;gt; 'domain.com/es',&#xA;    'es' =&amp;gt; 'domain.com/es'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I want to have a generic international version, without any slug, in English. How am I supposed to configure that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I want the same contents for Spain and other Latin countries but I want to distinguish locales, to target at least Spain specifically. Do I need to create a locale or just use the correct &lt;code&gt;hreflang&lt;/code&gt; in HTML?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="57" LastEditDate="2017-07-21T18:12:03.760" LastActivityDate="2017-07-21T18:12:03.760" Title="Targeting multiple countries with one locale" Tags="&lt;craft-features&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21290" PostTypeId="1" AcceptedAnswerId="21296" CreationDate="2017-07-21T08:04:58.727" Score="2" ViewCount="629" Body="&lt;p&gt;I have a really big / flexible Matrix field for one of my websites. It works great and is easy to handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need to add another block containing some fields.&#xA;I already extenended the &lt;code&gt;php_value max_input_vars&lt;/code&gt; to &lt;code&gt;9000&lt;/code&gt;. This worked for a while but I guess I need even more now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matrix field contains &lt;strong&gt;25 blocks&lt;/strong&gt; with an average of 5 fields per block as of now but, I need to build another one. If I add another block right now the block will stay but If I add a field to the block and save it, it won't appear when reloading the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's alot of blocks inside a matrix field but, it actually is really easy to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is. &lt;strong&gt;Is there another way to extend the limit or maybe a better solution?&lt;/strong&gt;  &lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-07-21T17:25:16.477" Title="Can't add anymore fields / blocks to Matrix Field" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;database&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21291" PostTypeId="1" CreationDate="2017-07-21T09:40:31.590" Score="1" ViewCount="51" Body="&lt;p&gt;I represent a leading online music tuition platform. We are considering using Craft to develop our new platform. We have a couple of questions about the capabilities of the platform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Can we build an &lt;a href=&quot;https://imagenevp.com/video-on-demand/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVOD and TVOD&lt;/a&gt; platform on Craft? The video would be pulled from our CDN and displayed via JW player.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Can we build a social side to our site, where members can share content to a centralized social dashboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or advice would be greatly received.&lt;/p&gt;&#xA;" OwnerUserId="7029" LastEditorUserId="57" LastEditDate="2017-07-21T17:58:30.947" LastActivityDate="2017-11-19T07:04:59.163" Title="SVOD and Social capabilities" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21292" PostTypeId="2" ParentId="16752" CreationDate="2017-07-21T15:01:22.030" Score="2" Body="&lt;p&gt;I made a plugin to do this thanks to Jeremy's above answer. It's my first Craft plugin BTW.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/n-dw/inStockNotifier-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/n-dw/inStockNotifier-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6740" LastActivityDate="2017-07-21T15:01:22.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21294" PostTypeId="1" AcceptedAnswerId="21552" CreationDate="2017-07-21T16:02:33.357" Score="1" ViewCount="152" Body="&lt;p&gt;In particular, I'm trying to render the text in markdown preserving the original line breaks, like in the GitHub Flavored Markdown specifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;{{ something | md }}&lt;/code&gt; in a template the output contains a line break only if a line ends with two spaces, like in the original markdown implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some markdown processors (ie Blackfriday, written in Go) call this feature &quot;hardLineBreak&quot;.&lt;/p&gt;&#xA;" OwnerUserId="7031" LastEditorUserId="57" LastEditDate="2017-07-21T17:28:02.377" LastActivityDate="2017-08-11T22:23:44.447" Title="Render markdown as GFM (GitHub Flavored Markdown), therefore preserving line breaks?" Tags="&lt;markdown&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21295" PostTypeId="1" CreationDate="2017-07-21T17:09:59.660" Score="1" ViewCount="222" Body="&lt;p&gt;Stripe is throwing a server error when trying to access a webhook to the Charge plugin. Some investigation revealed the error is triggered by an 'invalid or missing CSRF token.&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="587" LastEditDate="2017-07-23T23:42:38.950" LastActivityDate="2017-07-23T23:43:56.113" Title="Webhook Error with Charge plugin" Tags="&lt;plugin-charge&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21296" PostTypeId="2" ParentId="21290" CreationDate="2017-07-21T17:25:16.477" Score="3" Body="&lt;p&gt;There's nothing in Craft limiting the amount of Matrix Blocks and fields you can add, it's purely environmental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common values to increase are &lt;code&gt;max_input_vars&lt;/code&gt;, &lt;code&gt;post_max_size&lt;/code&gt; and &lt;code&gt;memory_limit&lt;/code&gt;, so you'd need to bump one or more of those to higher values to be able to add more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're running things like &lt;a href=&quot;https://suhosin.org/stories/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Suhosin&lt;/a&gt; or &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;mod_security&lt;/a&gt;, they provide their own additional settings that sit on top of php.ini settings that you might need to adjust as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-21T17:25:16.477" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21297" PostTypeId="2" ParentId="21294" CreationDate="2017-07-21T17:27:44.757" Score="1" Body="&lt;p&gt;There is a Craft &lt;a href=&quot;https://github.com/pixelandtonic/Parsedown&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parsedown&lt;/a&gt; plugin for Craft which supports Github Flavored Markdown you can use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-21T17:27:44.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21298" PostTypeId="2" ParentId="21291" CreationDate="2017-07-21T18:10:30.920" Score="0" Body="&lt;p&gt;Kind of some broad questions, but given enough time, talent and money, you can build virtually anything you want in Craft. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front-end of a Craft site is 100% up to you, so you can use whatever video player you want pulling from whatever sources you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce doesn't have native &lt;a href=&quot;https://craftcms.uservoice.com/forums/295386-commerce/suggestions/7814868-subscriptions&quot; rel=&quot;nofollow noreferrer&quot;&gt;subscription support&lt;/a&gt;, yet, but it is high on the to-do list.  You can use an existing plugin like &lt;a href=&quot;https://squarebit.co.uk/software/craft/charge&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge&lt;/a&gt;, which supports Stripe subscriptions, or you can roll your own &lt;a href=&quot;https://pluginsfactori.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that has its own business logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Craft and Commerce have tons of &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;hooks&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;events&lt;/a&gt; allowing you to &lt;a href=&quot;https://craftcommerce.com/docs/extendability&quot; rel=&quot;nofollow noreferrer&quot;&gt;extend&lt;/a&gt; functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft has support for &lt;a href=&quot;https://craftcms.com/docs/users&quot; rel=&quot;nofollow noreferrer&quot;&gt;users, users groups and permissions&lt;/a&gt; so you can setup your templates and plugins to allow them to share and decide who gets access to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, yes... doable, but it will take some not-insignificant development effort.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-21T18:10:30.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21300" PostTypeId="2" ParentId="20861" CreationDate="2017-07-21T22:05:29.553" Score="1" Body="&lt;p&gt;Just answering this for anyone else who sees this. The case above was confirmed by Brad Bell and was fixed in &lt;a href=&quot;https://craftcms.com/changelog#2-6-2984&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.2984&lt;/a&gt;. So, going forward, the scenario described above should return an error to handle.&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="57" LastEditDate="2017-07-21T22:15:47.293" LastActivityDate="2017-07-21T22:15:47.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21301" PostTypeId="2" ParentId="1115" CreationDate="2017-07-22T01:29:22.363" Score="3" Body="&lt;p&gt;There is a third-party plugin called &lt;a href=&quot;https://github.com/boboldehampsink/tagmanager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tag Manager&lt;/a&gt; that let's you delete tags.&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2017-07-22T01:29:22.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21302" PostTypeId="1" AcceptedAnswerId="21305" CreationDate="2017-07-22T15:36:18.793" Score="1" ViewCount="51" Body="&lt;p&gt;So in the &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor config file&lt;/a&gt;, I have the standard &quot;&lt;a href=&quot;https://imperavi.com/redactor/plugins/source/&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;&quot; plugin enabled:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;plugins&quot;: [&quot;source&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is great for the admins who want to go in a play with around with the markup. However, I'd like to avoid certain user types from having that level of control. Essentially I want to stop clients messing with stuff they shouldn't. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-07-24T04:23:23.253" Title="Is it possible to adjust Redactor config on a per-user basis?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21303" PostTypeId="2" ParentId="21250" CreationDate="2017-07-23T01:48:05.907" Score="1" Body="&lt;p&gt;Although not related specifically to Craft, we built &lt;a href=&quot;https://www.jelliscraig.com.au&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.jelliscraig.com.au&lt;/a&gt; website using CraftCMS with all property listing data is stored in ElasticSearch. We use a simple plugin for the ElasticSearch PHP client but the integration is front-end only, for the most part. &#xA;We have been testing pushing Craft generated content into ElasticSearch via the element API and in theory its a workable solution however for our specific situation we see no huge benefit in storing all general content externally.&lt;/p&gt;&#xA;" OwnerUserId="7035" LastActivityDate="2017-07-23T01:48:05.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21304" PostTypeId="2" ParentId="21295" CreationDate="2017-07-23T23:43:56.113" Score="3" Body="&lt;p&gt;If CSRF protection is enabled (and it is by default for the latest versions of Craft), Stripe was getting a server error when using the Charge webhook url. The solution is to disable CSRF for the webhook URI - you can read more about it &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4553/whats-the-best-way-to-skip-csrf-for-plugin-controllers&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or simply add this to your &lt;code&gt;config/general.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'enableCsrfProtection' =&amp;gt; (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] != '/actions/charge/webhook/callback'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-07-23T23:43:56.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21305" PostTypeId="2" ParentId="21302" CreationDate="2017-07-24T04:23:23.253" Score="2" Body="&lt;p&gt;Not possible with the native Rich Text field in Craft (or any field in Craft since the settings aren't defined on a per-user basis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably pull this off with a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that added a field type that extended Craft's Rich Text field and overwrote (at least) the &lt;code&gt;getIntputHtml()&lt;/code&gt; and &lt;code&gt;getSettingsHtml()&lt;/code&gt; methods to add per-user settings support.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-24T04:23:23.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21306" PostTypeId="1" CreationDate="2017-07-24T11:18:47.580" Score="1" ViewCount="99" Body="&lt;p&gt;I want to get entries randomly every minutes like setTimeout in javascript. Like below If possible. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            setTimeout({ {% for entry in craft.entries.section('alumni').order('RAND()').limit(6).find() %}&#xA;            &amp;lt;a class=&quot;main-home-list-item&quot; href=&quot;#&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;main-home-list-item__body&quot;&amp;gt;&#xA;                    {% set asset = entry.profileImage.first() %} {% if asset | length %}&#xA;                    &amp;lt;div class=&quot;img-container&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;{{asset.getUrl()}}&quot; alt=&quot;{{asset.title}}&quot; /&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% else %}&#xA;                    &amp;lt;div class=&quot;img-container&quot;&amp;gt;&#xA;                        &amp;lt;img src=&quot;assets/avatar.png&quot; /&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;h4&amp;gt;&#xA;                                {{ entry.title }} {{ entry.lastName }}&#xA;                            &amp;lt;/h4&amp;gt;&#xA;                    &amp;lt;p class=&quot;small&quot;&amp;gt;&#xA;                        {{entry.graduateYear}}&#xA;                    &amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;            {% endfor %} }, 1000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6169" LastActivityDate="2017-07-24T12:55:20.383" Title="get entries randomly every minutes?" Tags="&lt;entries&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21307" PostTypeId="2" ParentId="21306" CreationDate="2017-07-24T12:55:20.383" Score="1" Body="&lt;p&gt;See below for some twig code to get you started, I omitted the actual HTML output for the individual items to better keep the overview. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats happening is, you get all (or a reasonable big amount amount) of your entries, and start looping over them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first time, you open a div that will contain 6 items. Afterwards, each time the loop index can be divised by 6 (aka, 6 more items have been looped over) you close the container div &amp;amp; open a new one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than finally after the last iteration, you close the container div again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making the 6 items hide or display you can do with Javascript. Let me know if you need extra pointers on that. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('alumni').order('RAND()')}&#xA;    {% if loop.first %}&#xA;        &amp;lt;div class=&quot;container-for-6-items&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {# Build item output here #}&#xA;&#xA;    {% if loop.index is divisible by(6) %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;container-for-6-items&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if loop.last %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Info on &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tests/divisibleby.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;divisible by&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-24T12:55:20.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21308" PostTypeId="1" AcceptedAnswerId="21310" CreationDate="2017-07-24T14:45:11.820" Score="1" ViewCount="67" Body="&lt;p&gt;I am working on a calendar, and so far I know how to get the number of days in the current month.&#xA;&lt;code&gt;{% set daysInMonth = time|date('t') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I get the number of days in the previous month? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2017-07-24T14:58:26.397" Title="How do I get the number of days in the previous month?" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21309" PostTypeId="1" AcceptedAnswerId="21313" CreationDate="2017-07-24T14:52:10.367" Score="1" ViewCount="719" Body="&lt;p&gt;I guess this is no big issue, but I'm pretty new to Craft Commerce :)&#xA;I'm trying to code a dynamic template for the product variants page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the scenario: In the shop overview you see every product and all there variants. If you click on a variant image a detail page opens, showing you detailed information about this variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I access data of the variant (like title, description, asset) dynamically? Based on what the user clicked on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried these two answers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12708/how-do-i-select-a-specific-product-variant-by-element-field-entry&quot;&gt;How do I select a specific product variant by element/field/entry?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17263/display-image-asset-of-a-variant&quot;&gt;Display image asset of a variant&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is, I can't use lineItem because the variant is not added to the cart yet. And I didn't manage to get the specific variant over getSegment and the url.&lt;/p&gt;&#xA;" OwnerUserId="7037" LastEditorUserId="57" LastEditDate="2017-07-24T17:57:06.983" LastActivityDate="2017-07-25T08:20:37.043" Title="Product Variant Detail Page" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21310" PostTypeId="2" ParentId="21308" CreationDate="2017-07-24T14:58:26.397" Score="2" Body="&lt;p&gt;I believe: &lt;code&gt;{{ now | date_modify('-1 month') | date('t') }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-07-24T14:58:26.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21313" PostTypeId="2" ParentId="21309" CreationDate="2017-07-24T15:39:17.560" Score="1" Body="&lt;p&gt;If I understand correctly you can check for available variants, then output whatever detail you need for the items. Something like this should get you started:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Check there are variants #}&#xA;{% if product.variants|length %}&#xA;&#xA;  {# Loop through the variants #}&#xA;  {%- for purchasable in product.variants -%}&#xA;&#xA;    {# Check the variant is available #}&#xA;    {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}&#xA;&#xA;      {{ purchasable.description }}&#xA;      {{ purchasable.salePrice|commerceCurrency(cart.currency) }}&#xA;&#xA;    {% endif %}&#xA;  {%- endfor -%}&#xA;&#xA;  {% else %}&#xA;    {{ &quot;Out of Stock&quot;|t }}&#xA;  {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to target only a specific variant you can refer to it directly using either its title (slug) or its variant ID, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variants = craft.commerce.variants.id(8376).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find more detail in &lt;a href=&quot;https://craftcommerce.com/docs/variant-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs for the Variant Model&lt;/a&gt; and &lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-variants&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs for Craft Commerce Variants&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastEditorUserId="3679" LastEditDate="2017-07-25T08:20:37.043" LastActivityDate="2017-07-25T08:20:37.043" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21314" PostTypeId="2" ParentId="14876" CreationDate="2017-07-24T16:22:28.687" Score="1" Body="&lt;p&gt;Using MediaTemple, I have this working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#FORCE HTTPS&#xA;RewriteCond %{HTTPS} !=on&#xA;RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;&#xA;    # REMOVE INDEX.PHP&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2017-07-24T16:22:28.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21316" PostTypeId="1" CreationDate="2017-07-24T17:13:53.187" Score="1" ViewCount="296" Body="&lt;p&gt;I use the code &quot;Link to the Tag URLs&quot; from the following article:&#xA;&lt;a href=&quot;https://craftcms.com/support/tag-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/tag-urls&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.tags | length %}&#xA;&amp;lt;h3&amp;gt;This entry is tagged with:&amp;lt;/h3&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for tag in entry.tags %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}tags/{{ tag.title | url_encode }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing is that the &quot;url_encode&quot; doesnt really apply as if I expected. The URL looks like this:&#xA;&lt;a href=&quot;http://domain.dev/tags/My%20Tag%20Name&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.dev/tags/My%20Tag%20Name&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I click on it, there are still spaces in the address line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: is that ok like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was also thinking about using the kebab filter. There I receive this url:&#xA;&lt;a href=&quot;http://domain.dev/tags/my-tag-name&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.dev/tags/my-tag-name&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which looks prettier. But I now I get an error with the routing when I want fetch the tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.title(tag).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-07-24T17:58:44.423" LastActivityDate="2017-10-30T09:20:47.467" Title="How to get a proper tag Url" Tags="&lt;routes&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21317" PostTypeId="2" ParentId="21224" CreationDate="2017-07-24T19:51:18.983" Score="1" Body="&lt;p&gt;I know this is of course not an elegant solution, but it works for now. I used twig filters to extract url and alt tag of the image. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;blog-post-featured-image&quot;&amp;gt;&#xA;            {% if entry.featuredImage|length %}&#xA;                {{ snippets.image( entry.featuredImage.first(),entry.url )}}&#xA;            {% else %} {# For the tumblr imports, extract first image #}&#xA;                {# Extract the src #}&#xA;                {% set spliter = entry.articleBody.type('text').first().text|split('src=&quot;') %}&#xA;                {% set spliter = spliter[1]|split('&quot;') %}&#xA;                {% set firstTumblrImage = spliter[0] %}&#xA;&#xA;                {# Extract the alt-Tag of the Featured Image#}&#xA;                {% set spliter = entry.articleBody.type('text').first().text|split('alt=&quot;') %}&#xA;                {% set spliter = spliter[1]|split('&quot;') %}&#xA;                {% set imageAltTag = spliter[0] %}&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ firstTumblrImage }}&quot; alt=&quot;{{ imageAltTag }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-07-24T19:51:18.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21319" PostTypeId="1" CreationDate="2017-07-24T21:51:34.783" Score="0" ViewCount="112" Body="&lt;p&gt;This question is related to a previous question I asked: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20860/sort-entries-in-a-category-via-entry-field&quot;&gt;Sort entries in a category via entry field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a page that is running the same query from the previous question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set businesses = craft.entries.relatedTo(category) %}&#xA;{% set state  = entry.bizTown.first.townCounty.first.countyRegion.first.regionState.first ?? 'N/A' %}&#xA;{% set businessesByTown = businesses|group('bizTown.first.townCounty.first.countyRegion.first.regionState[0].title') %}&#xA;&#xA;{% if businesses|length %}&#xA;    {% for town, businessesInTown in businessesByTown %}&#xA;        &amp;lt;ul class=&quot;three-col-list&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{town}}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for business in businessesInTown %}&#xA;                &amp;lt;li class=&quot;business-cat__item&quot;&amp;gt;&#xA;                    {% if business.ytVideoId|length %}&#xA;                        &amp;lt;i class=&quot;fa fa-video-camera&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;strong&amp;gt;{{ business.link }}&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;                    {% set twn = business.bizTown.first %}&#xA;                    &amp;lt;a class=&quot;business-cat__item--town&quot; href=&quot;{{twn.url}}&quot;&amp;gt;{{twn.title}}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;{% else %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is on a template which is displaying entries of a given sub-category. It separates the entires (the businesses) according to its state. It also displays what town each business belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Unforunately this takes the page ~20 seconds to render!&lt;/strong&gt; I've tried looking into using plugins for custom SQL queries, and using eager loading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read through &lt;a href=&quot;https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; a lot and have poked around inside their plugin, but I still don't know where/how to start! Likewise with eager loading, with all the crap I have going on in this/these queries, I'm not sure where to start with that, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I feel like this is abstracting beyond my comfort level, and I'd love some expert input. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-07-24T21:51:34.783" Title="Best way to improve complex query?" Tags="&lt;performance&gt;&lt;queries&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21321" PostTypeId="1" CreationDate="2017-07-25T07:26:58.043" Score="1" ViewCount="202" Body="&lt;p&gt;EDIT: Updated code (issue remains)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement functionality in a plugin that, when saving an entry with a lightswitch enabled, takes the asset at &lt;code&gt;index 0&lt;/code&gt; from an assetfield called &lt;code&gt;useruploads&lt;/code&gt;, copies that asset, applies some watermark to it via php and finally saves that new copied asset back to the assetfield. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all seems to work except when I get to the part where the new copied image is actually saved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$originalFile = &quot;naja&quot;.&quot;-copyright.&quot;.$asset-&amp;gt;extension;&#xA;&#xA;$copyrightedImage = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;     $tempPath,&#xA;     $originalFile,&#xA;     $myAssetFolderId,&#xA;     AssetConflictResolution::KeepBoth&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When saving an entry, craft throws the following error at me:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;fopen(&lt;a href=&quot;https://s3-eu-west-1.amazonaws.com/irl.x-challenge.info/challenges/naja-copyright170725090818.JPG&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3-eu-west-1.amazonaws.com/irl.x-challenge.info/challenges/naja-copyright170725090818.JPG&lt;/a&gt;): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I doubt it actually is a directory-permission thing, since I write to CRAFT_STORAGE_PATH which works just fine with another function without giving me any permission related error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am fairly new to writing any sort of plugin for any CMS, so I'd appreciate the help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full code is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $fileIds = array();&#xA;&#xA;    $event = $myEvent;&#xA;    static $recursionLevel = 0; // is set only once&#xA;&#xA;    if ($recursionLevel == 0 ) {&#xA;&#xA;            $recursionLevel++;&#xA;&#xA;            $entry = $event-&amp;gt;params['entry'];&#xA;            $asset = $entry-&amp;gt;useruploads[0];&#xA;&#xA;            $imageInfo = pathinfo($asset-&amp;gt;url);&#xA;            $tempPath = CRAFT_STORAGE_PATH.'runtime/temp/'.$imageInfo['basename'];&#xA;            file_put_contents($tempPath, fopen($asset-&amp;gt;url, 'r'));&#xA;&#xA;&#xA;            $myAssetFolderId = 27;&#xA;&#xA;            $currentUser = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;            // insert the file into assets&#xA;            array_push($fileIds, $asset-&amp;gt;id);&#xA;&#xA;            // switchcase for different file formats&#xA;            switch(strtolower($asset-&amp;gt;extension)){&#xA;                case 'jpg':&#xA;                case 'jpeg':&#xA;                    $im = @ImageCreateFromJPEG ($tempPath);&#xA;                    break;&#xA;                case 'png':&#xA;                    $im = @ImageCreateFromPNG ($tempPath);&#xA;                    break;&#xA;                default:&#xA;                    break;&#xA;            }&#xA;&#xA;&#xA;            $text = chr(169).&quot; x-challenge backstage | &quot;.$currentUser-&amp;gt;getFriendlyName().$asset-&amp;gt;id;&#xA;            // Prepare font size and colors&#xA;            $text_color = imagecolorallocatealpha($im, 0, 0, 0, 65);&#xA;            $bg_color = imagecolorallocatealpha($im, 255, 255, 255, 80);&#xA;            $font = CRAFT_BASE_PATH. &quot;../public/fonts/RobotoCondensed-Regular.ttf&quot;;&#xA;            $font_size = 10;&#xA;            $assetHeight = craft()-&amp;gt;assets-&amp;gt;getFileById($fileIds[0]);&#xA;            $scaleFactor = ($assetHeight-&amp;gt;getWidth()/1000);&#xA;            $font_size = $font_size*$scaleFactor;&#xA;&#xA;            // Set the offset x and y for the text position&#xA;            $offset_x = 0;&#xA;            $offset_y = 20;&#xA;&#xA;            // Get the size of the text area&#xA;            $dims = imagettfbbox($font_size, 0, $font, $text);&#xA;            $text_width = $dims[4] - $dims[6] + $offset_x;&#xA;            $text_height = $dims[3] - $dims[5] + $offset_y;&#xA;&#xA;            $text_pos_y = imagesy($im) - $font_size;&#xA;            imagefilledrectangle($im, 0, $text_pos_y+($font_size/2), $text_width+$font_size, $text_pos_y-($font_size+($font_size/2)), $bg_color);&#xA;&#xA;            // Add text&#xA;            imagettftext($im, $font_size, 0, $offset_x+5, $text_pos_y, $text_color, $font, $text);&#xA;&#xA;            switch(strtolower($asset-&amp;gt;extension)){&#xA;                case 'jpg':&#xA;                case 'jpeg':&#xA;                    imagejpeg($im, $tempPath);&#xA;                    break;&#xA;                case 'png':&#xA;                    imagepng($im, $tempPath);&#xA;                    break;&#xA;                default:&#xA;                    break;&#xA;            }&#xA;&#xA;            // save back to S3&#xA;            //$originalFile = $imageInfo[&quot;filename&quot;].&quot;-&quot;.md5($currentUser-&amp;gt;id).&quot;-copyright.&quot;.$asset-&amp;gt;extension;&#xA;            $originalFile = &quot;naja&quot;.&quot;-copyright.&quot;.$asset-&amp;gt;extension;&#xA;&#xA;            $copyrightedImage = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;                $tempPath,&#xA;                $originalFile,&#xA;                $myAssetFolderId, // notice, this is the id of the folder you want to upload to&#xA;                AssetConflictResolution::KeepBoth&#xA;            );&#xA;&#xA;            if ($copyrightedImage-&amp;gt;isSuccess()){&#xA;                //$fileIds[] = $copyrightedImage-&amp;gt;getDataItem('fileId');&#xA;                array_push($fileIds, $copyrightedImage-&amp;gt;getDataItem('fileId'));&#xA;            }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-08-01T07:46:07.427" LastActivityDate="2017-08-01T07:46:07.427" Title="Copying asset by insertFileByLocalPath() results in fopen:()failed to open stream error" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;error&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21322" PostTypeId="1" CreationDate="2017-07-25T13:28:09.690" Score="0" ViewCount="42" Body="&lt;p&gt;There are folders in my images asset folder &lt;code&gt;craft/public_html/images/&lt;/code&gt; named for individual entries (posts).  But, the folders are empty.  This is something new.  Only recent posts are represented.  The actual images for these and all posts are still there, the settings have not changed and everything seems okay. And, it appears I can delete one of these empty folders without negatively impacting the actual post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a quirk or associated with a recent update and therefore has some purpose?  Should I delete them or leave them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-07-25T13:31:14.227" Title="Why are there now blank entry folders in my image assets folder?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21323" PostTypeId="2" ParentId="21322" CreationDate="2017-07-25T13:31:14.227" Score="1" Body="&lt;p&gt;I guess you or someone else made a subfolder in your upload folder. You can do this through Craft itself. This creates a folder you which might be happening in your case. Try adding a new one and see if it happens again. Go to assets and right click a folder to make a sub folder.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-07-25T13:31:14.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21324" PostTypeId="1" CreationDate="2017-07-25T14:26:19.430" Score="2" ViewCount="537" Body="&lt;p&gt;We are load balancing 2 servers hosting an identical Craft environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When clicking around in the admin a user will get logged out after 30 seconds and sometimes even faster when browsing in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to set the load balancer to sticky sessions due to the load balancer sitting behind a Firewall which NAT's inbound traffic. So the load balancer see's all inbound traffic as a single IP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else that can be done to resolve this issue?&lt;/p&gt;&#xA;" OwnerUserId="7041" LastEditorUserId="57" LastEditDate="2017-07-25T18:15:49.770" LastActivityDate="2017-10-23T19:32:19.093" Title="Load Balancing Craft CMS - Admin gets logged out instantly" Tags="&lt;nginx&gt;&lt;load-balancer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21325" PostTypeId="1" AcceptedAnswerId="21335" CreationDate="2017-07-25T15:45:18.223" Score="1" ViewCount="189" Body="&lt;p&gt;I have been trying to set up a Charge 2 payment form and have it all working except for giving the user 3 different plan amounts at the end of the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I need to offer the following in a select box or radio buttons at the bottom:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Plan A at $10.00&lt;/li&gt;&#xA;&lt;li&gt;Plan B at $20.00&lt;/li&gt;&#xA;&lt;li&gt;Plan C at $30.00&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is relatively simple using subscription modal, but I only want it to be a one off payment rather than daily, weekly, monthly or yearly.  Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4783" LastEditorUserId="4783" LastEditDate="2017-07-25T19:15:26.060" LastActivityDate="2017-07-26T08:38:55.933" Title="Charge 2 form that has multiple one of plan amounts?" Tags="&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21326" PostTypeId="1" CreationDate="2017-07-25T16:41:49.613" Score="3" ViewCount="1017" Body="&lt;p&gt;I have a map generated in JS.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to set the &lt;code&gt;country-id&lt;/code&gt; and &lt;code&gt;url&lt;/code&gt; for each country.  Both 'country-id&lt;code&gt;and&lt;/code&gt;url&lt;code&gt;are fields in my Craft categories group&lt;/code&gt;countries`.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;country-id&quot;: &quot;FR&quot;,&#xA;  &quot;url&quot;: &quot;http://mysite/country/france&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know (basically) how to output to JS for use in my templates.  &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17122/how-can-i-pass-a-craft-field-into-a-javascript-function&quot;&gt;Here is a link to an earlier question I asked on how to output to JS.&lt;/a&gt; This time my question is not how to include JS, but how do I generate a specific output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I incorporate a &lt;code&gt;for loop&lt;/code&gt; that produces the desired output for each member of the category &lt;code&gt;country&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nations = craft.categories.group('country') %}&#xA;{for country in nations %}&#xA;{&#xA;&quot;country-id&quot;: &quot;{{country.CountryCode}}&quot;,&#xA;&quot;url&quot;: &quot;{{country.url}}&quot;,&#xA;},&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Part of the problem is how to I get the loop to also output the script brackets, quotes, commas and attributes that surround the data for each country?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE -- MORE INFO --- This is the full JS that the above is taken.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;var map = AmCharts.makeChart( &quot;chartdiv&quot;, {&#xA;  &quot;type&quot;: &quot;map&quot;,&#xA;    &quot;theme&quot;: &quot;light&quot;,&#xA;    &quot;dataProvider&quot;: {&#xA;    &quot;map&quot;: &quot;worldLow&quot;,&#xA;    &quot;areas&quot;: [ &#xA;&#xA;              {&#xA;                &quot;id&quot;: &quot;FR&quot;,&#xA;                &quot;url&quot;: &quot;http://fmysite.dev/country/france&quot;&#xA;              },&#xA;              {&#xA;                &quot;id&quot;: &quot;JP&quot;,&#xA;                &quot;url&quot;: &quot;http://mysite.dev/country/japan&quot;&#xA;              },&#xA;               {&#xA;                &quot;id&quot;: &quot;SA&quot;,&#xA;                &quot;url&quot;: &quot;http://mysite.dev/country/saudi-arabia&quot;&#xA;              },&#xA;               {&#xA;                &quot;id&quot;: &quot;GB&quot;,&#xA;                &quot;url&quot;: &quot;http://mysite.dev/country/united-kingdom&quot;&#xA;              },&#xA;              ]&#xA;  },&#xA;   &quot;smallMap&quot;:{},&#xA;  &quot;areasSettings&quot;: {&#xA;    // color of areas listed&#xA;    &quot;color&quot;: &quot;#71d1d7&quot;,&#xA;    // color of area's outline&#xA;    &quot;outlineColor&quot;: &quot;#4e93aa&quot;,&#xA;    // Color of area's outline when user rolls-over it.&#xA;    &quot;rollOverOutlineColor&quot;: &quot;#000&quot;,&#xA;    // Color of all areas which are in the map svg file, but not listed as areas in DataSet&#xA;    &quot;unlistedAreasColor&quot;: &quot;#c7ecf4&quot;,&#xA;    // Color of all areas' outline which are in the map svg file, but not listed as areas in DataSet &#xA;    &quot;unlistedAreasOutlineColor&quot;: &quot;#c7ecf4&quot;&#xA;  },&#xA;&#xA;  &quot;listeners&quot;: [ {&#xA;    &quot;event&quot;: &quot;clickMapObject&quot;,&#xA;    &quot;method&quot;: function( e ) {&#xA;      // check if clicked map object contains &quot;ajaxUrl&quot; parameter&#xA;      if ( e.mapObject.ajaxUrl !== undefined ) {&#xA;        // add &quot;description&quot; if it was empty&#xA;        if ( e.mapObject.description === undefined )&#xA;          e.mapObject.description = &quot;&amp;lt;div id='mapcontent'&amp;gt;Loading...&amp;lt;/div&amp;gt;&quot;;&#xA;&#xA;        // delay loading by a bit so that map can finish displaying description box and zoom&#xA;        setTimeout( function() {&#xA;          $( &quot;#mapcontent&quot; ).load( e.mapObject.ajaxUrl );&#xA;        }, 1000 );&#xA;      }&#xA;    }&#xA;  } ]&#xA;&#xA;&#xA;} );&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2017-07-25T19:49:31.087" LastActivityDate="2017-07-26T01:11:19.983" Title="How do you use a for loop to output to JS?" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21327" PostTypeId="2" ParentId="21326" CreationDate="2017-07-25T17:13:10.333" Score="2" Body="&lt;p&gt;It'd probably be easier to assemble the items the way you need them in Twig, and then JSON encode them. Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nations = craft.categories.group('country') %}&#xA;{% set countries = [] %}&#xA;{% for country in nations %}&#xA;    {% set thisCountry = {&#xA;        'country-id' : country.countryCode,&#xA;        'url' : country.url&#xA;    } %}&#xA;    {% set countries = countries|merge([thisCountry]) %}&#xA;{% endfor %}&#xA;&#xA;{% set countryJs %}         &#xA;var countries = {{ countries|json_encode(constant('JSON_PRETTY_PRINT'))|raw }}&#xA;{% endset %}&#xA;&#xA;{% includeJs countryJs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4819" LastActivityDate="2017-07-25T17:13:10.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21328" PostTypeId="1" AcceptedAnswerId="21334" CreationDate="2017-07-25T17:14:47.820" Score="2" ViewCount="3433" Body="&lt;p&gt;I'm setting up a site for a brewery that requires age verification.  When a user visits the site, I check for the presence of a cookie (I'm using nystudio107's &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;cookie plugin&lt;/a&gt;) and if it hasn't been set, it should redirect them to a verification page, which will then take them back to the page they were originally trying to view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just send the user back to the homepage after verification, it works fine. But when I try to pass a variable to get them back to the page they were originally trying to view, things break. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code to check for the cookie and redirect to the verification page (it works as intended):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if getCookie('age') %}&#xA;    Page Content&#xA;{% else %}&#xA;    {% redirect &quot;age&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the verification page code (setting the redirect variable isn't working).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Are you 21 or older?&amp;lt;/h1&amp;gt;&#xA;&#xA;{% set redirect = craft.request.getUrlReferrer() %}&#xA;&amp;lt;a href=&quot;http://google.com&quot;&amp;gt;No&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;verified?age={{redirect}}&quot;&amp;gt;Yes&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From here they go to the template that actually sets the cookie (again, issues with the query string):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ setCookie('age', '21', now | date_modify(&quot;+365 days&quot;).timestamp ) }}&#xA;{% redirect siteUrl ~ craft.request.getQuery('age') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I take out the redirect variable and query string, and just redirect to siteUrl, it all works fine. I'm having trouble passing the original URL along to get the user back to the page they're actually trying to go to.&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="323" LastEditDate="2017-07-25T23:38:09.793" LastActivityDate="2017-07-26T05:47:41.760" Title="Set cookie and redirect back to referral URL" Tags="&lt;redirect&gt;&lt;request&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21329" PostTypeId="2" ParentId="21326" CreationDate="2017-07-25T17:16:40.033" Score="2" Body="&lt;p&gt;There is a much better way to compose a JSON string from Twig templates: the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/json_encode.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;json_encode&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To build the data array from your array of category models, you need to loop over them and merge to an empty array row by row.&#xA;When you are ready with your Twig array, you pipe it through &lt;code&gt;json_encode&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set data = {} %}&#xA;{% for country in craft.categories.group('country') %}&#xA;    {% set data = data|merge([{&#xA;        'country-id': country.CountryCode,&#xA;        'url': country.url,&#xA;    }]) %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.countryData = {{ data|json_encode|raw }};&#xA;&amp;lt;/script&amp;gt;&#xA;&#xA;&amp;lt;script src=&quot;/js/app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-07-26T01:11:19.983" LastActivityDate="2017-07-26T01:11:19.983" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21330" PostTypeId="2" ParentId="21324" CreationDate="2017-07-25T18:22:05.473" Score="1" Body="&lt;p&gt;If you can't enforce sticky sessions, then you'll need to provide a common place for all load balanced web server to save their PHP session files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default PHP session files are file based and saved to whatever path the php.ini &lt;a href=&quot;http://php.net/manual/en/function.session-save-path.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;session_save_path&lt;/a&gt; is set to.  You could change that to an NFS share path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had an in-memory key=&gt;value store (like Redis, Memcached, etc.) you could configure PHP to save its sessions there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted something more persistent, you could configure PHP to save sessions in a database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On top of that, if you're not using stick sessions, you'd want to set a consistent &lt;a href=&quot;https://craftcms.com/docs/config-settings#appId&quot; rel=&quot;nofollow noreferrer&quot;&gt;appId&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;nofollow noreferrer&quot;&gt;validationKey&lt;/a&gt; across every web server so they can decrypt Craft/PHP cookies using the same tokens.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-25T18:22:05.473" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21331" PostTypeId="2" ParentId="21089" CreationDate="2017-07-25T19:19:43.687" Score="1" Body="&lt;p&gt;The short answer is that freeform doesn't do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The longer answer is that you can cheat with a cookie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used a cookie. Used this plugin: &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Freeform's admin, I created a hidden field called &quot;cookie validator&quot; and added it to my form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the page that my form lives on /form/, I added a cookie that sets a value of a large random number.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set randomNumber = random(9999999999) %}&#xA;{{ setCookie('formcookie', randomNumber, now | date_modify(&quot;+1 hour&quot;).timestamp ) }}&#xA;&#xA;{{ form.render }}&#xA;&#xA;{% set cookievalueJS %}&#xA;  $(document).ready(function() {&#xA;    $('#form-input-cookievalidator').val(&quot;{{ randomNumber }}&quot;);&#xA; });&#xA;{% endset %}&#xA;{% includeJs cookievalueJS %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This creates a random number first. Then sets a cookie with that number as a value. And then sets the input field to have that same number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, on my form results page /form/results/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using an 'isSuccess' check, I check for the cookie &amp;amp; field value...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submissionId = segment2 %}&#xA;{% set form = craft.freeform.form('myForm') %}&#xA;{% set submission = craft.freeform.submissions({&#xA;    id: submissionId,&#xA;    form: formHandle,&#xA;}).first() %}&#xA;&#xA;{% if myCookie  ==  submission.cookievalidator %}&#xA;  {# render all the submission data here #}&#xA;{% else %}&#xA;  {# show the &quot;nothing to show here&quot; page #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTE: I'm going to move this to an all https site eventually, and will probably have to swap the cookie to be a securecookie. But that's pretty straightforward with the cookie plugin.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-07-25T19:19:43.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21332" PostTypeId="1" AcceptedAnswerId="21787" CreationDate="2017-07-25T21:25:28.090" Score="1" ViewCount="1513" Body="&lt;p&gt;I've got a frontend form which queries the openstates.org API to return a given set of data objects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those objects also exist in Craft as entries, and the API data includes a field that serves as a unique ID for the Craft entries - how can I pass those unique IDs back to the Craft template to retrieve the corresponding entries?&lt;/p&gt;&#xA;" OwnerUserId="5026" LastEditorUserId="5026" LastEditDate="2017-07-26T13:25:22.407" LastActivityDate="2017-08-31T19:44:46.977" Title="How can I pass a JS result into a Twig template?" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21333" PostTypeId="1" CreationDate="2017-07-26T05:32:23.480" Score="1" ViewCount="80" Body="&lt;p&gt;I need to tune performance on a Craft 2 build. We are quite new to Craft CMS, so please bear with me if the question sounds silly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to render a page that needs to display information from 4 sections, A-&gt;B-&gt;C-&gt;D, with the latter having a reference to the former, i.e. B has a field linking to A, C has a field linking to B, and D has a field linking to C. The page needs to list A entries with information gathered from B, C, D. We ended up using &lt;code&gt;relatedTo&lt;/code&gt; in three foreach lookup until D, which turned out to be super inefficient. I managed to find out that using eager-loading of elements can greatly reduce the number of queries, which in my case, I've got 400+ queries down to about 40. The page load time is roughly 2s (from previous 30+ seconds!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think there might be an even better way to query the db. Currently, I am querying all elements of A, taking this array to query all related entries of B, which again is taken to query all entries of C. On querying entries of C, this is where eager-loading happens. The query on C section looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'Section A';&#xA;$criteria-&amp;gt;with = array(&#xA;    'b',&#xA;    'b.field_a',&#xA;    'd',&#xA;);&#xA;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $obj,&#xA;    'field' =&amp;gt; 'field_d'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am wondering if there's a way to query related entries based on a field from an ancestor, like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $obj,&#xA;    'field' =&amp;gt; 'field_d.c.b.a.field'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would save me from querying B and C entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="6848" LastEditorUserId="57" LastEditDate="2017-07-26T18:11:46.827" LastActivityDate="2017-07-26T18:11:46.827" Title="Entry reverse lookup on ancestor's field" Tags="&lt;craft-features&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21334" PostTypeId="2" ParentId="21328" CreationDate="2017-07-26T05:47:41.760" Score="0" Body="&lt;p&gt;Instead of relying on &lt;code&gt;craft.request.getUrlReferrer()&lt;/code&gt; you could set a cookie containing the original URL before you redirect them to age verification page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if getCookie('age') %}&#xA;    Page Content&#xA;{% else %}&#xA;    {{ setCookie('originalUrl', craft.request.url ) }}&#xA;    {% redirect &quot;age&quot; %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can than use that cookie to redirect to the original link &amp;amp; destroy it again once you verified their age. Destroying it might not be entirely necessary as there's not duration specified so the cookie only lives for the current session. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ setCookie('age', '21', now | date_modify(&quot;+365 days&quot;).timestamp ) }}&#xA;{% set redirectUrl = getCookie('originalUrl') %}&#xA;{{ setCookie( 'originalUrl' ) }}&#xA;{% redirect redirectUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-26T05:47:41.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21335" PostTypeId="2" ParentId="21325" CreationDate="2017-07-26T08:38:55.933" Score="0" Body="&lt;p&gt;check out the docs here - &lt;a href=&quot;http://squarebit.co.uk/software/craft/charge/usage/reference/payment-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://squarebit.co.uk/software/craft/charge/usage/reference/payment-options&lt;/a&gt; and note this bit:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;planIntervalCount accepts int The number of periods for a recurring&#xA;  plan. If you're creating recurring charge, this is required, and must&#xA;  be 1 or higher. Not including, or passing a 0 value will create a&#xA;  one-time charge.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;planIntervalCount&quot; id=&quot;planIntervalCount&quot; value=&quot;0&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for a one off payment.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2017-07-26T08:38:55.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21337" PostTypeId="1" CreationDate="2017-07-26T12:38:13.407" Score="1" ViewCount="191" Body="&lt;p&gt;I'm stucked with a 404 error on all my localized sub-directories.&#xA;It works fine for the homepage ( es. &lt;code&gt;domain.com/e&lt;/code&gt;s, &lt;code&gt;domain.com/it&lt;/code&gt; ). Also urls in the main directory are behaving correctly. Example:&#xA;&lt;code&gt;domain.com/products&lt;/code&gt; is fine &lt;code&gt;domain.com/es/products&lt;/code&gt; is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft Pro on Nginx. Here is my &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://129.0.1.67/',&#xA;        'en_us' =&amp;gt; 'http://129.0.1.67/us/',&#xA;        'de' =&amp;gt; 'http://129.0.1.67/de/',&#xA;        'fr' =&amp;gt; 'http://129.0.1.67/fr/',&#xA;        'it' =&amp;gt; 'http://129.0.1.67/it/',&#xA;        'es' =&amp;gt; 'http://129.0.1.67/es/',&#xA;        'tr' =&amp;gt; 'http://129.0.1.67/tr/',&#xA;        'ru' =&amp;gt; 'http://129.0.1.67/ru/',&#xA;        'zh' =&amp;gt; 'http://129.0.1.67/zh/'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my index.php file for subfloders&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Path to your craft/ folder&#xA; */&#xA;$craftPath = '../../craft';&#xA;&#xA;/**&#xA; * Define Craft locales&#xA; */&#xA;define('CRAFT_LOCALE', 'es');&#xA;&#xA;/**&#xA; * Define Craft Templates Path&#xA; */&#xA; $templatePath = '../../craft/templates';&#xA;define('CRAFT_TEMPLATES_PATH', $templatePath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that my problem is with my NGINX configuration but I'm not confident with it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    root /var/www/app;&#xA;&#xA;&#xA;    location / {&#xA;            try_files $uri $uri/ @rewrites;&#xA;    }&#xA;&#xA;    location @rewrites {&#xA;            rewrite ^(.*) /index.php?p=$1 last;&#xA;    }&#xA;&#xA;&#xA;    location ~ \.php$ {&#xA;            include snippets/fastcgi-php.conf;&#xA;            fastcgi_pass unix:/run/php/php7.0-fpm.sock;&#xA;            fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a Craft log in the browser console:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[12:46:33.764][error][exception.Craft\HttpException.404]&#xA;Craft\HttpException in /var/www/craft/app/controllers/TemplatesController.php:72&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('es/oil-news/pro...', Array)&#xA;#1 /var/www/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /var/www/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /var/www/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /var/www/craft/app/etc/web/WebApp.php(290): CWebApplication-&amp;gt;processRequest()&#xA;#9 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /var/www/app/index.php(67): require_once('/var/www/craft/...')&#xA;#12 {main}&#xA;REQUEST_URI=/es/oil-news/prova&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="6817" LastEditDate="2017-07-26T12:51:33.423" LastActivityDate="2017-07-26T13:09:47.827" Title="404 on localized entries - Nginx" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21338" PostTypeId="2" ParentId="21337" CreationDate="2017-07-26T13:09:47.827" Score="1" Body="&lt;p&gt;Seems like I needed a bit more configurations for NGINX, something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location /es/ {&#xA;    try_files $uri $uri/ @esrewrites;&#xA;}&#xA;&#xA;location @esrewrites {&#xA;    rewrite ^/es/(.*)$ /es/index.php?p=$1? last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for each locale. &#xA;Source: &lt;a href=&quot;https://gist.github.com/cmalven/5cc95cce4e495d3a11df&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/cmalven/5cc95cce4e495d3a11df&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not sure if there is a better option that avoids hard coding locales in NGINX config file.&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-07-26T13:09:47.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21339" PostTypeId="1" CreationDate="2017-07-26T14:27:14.230" Score="1" ViewCount="57" Body="&lt;p&gt;I created a section on a site that shows a two-month calendar. The calendar has links to entries based on a release date. The release dates are created using a date/time filed. (Dates are different than the entry release date) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very happy with the results so far. I took some ideas from &lt;a href=&quot;https://craftcms.stackexchange.com/a/1849/979&quot;&gt;this answer&lt;/a&gt; and a little &lt;a href=&quot;http://turpialcreative.com/notebook/making-a-responsive-calendar-for-dynamic-dates-using-flexbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;flexbox magic&lt;/a&gt;. Everything is working great for the current/next month to show. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm looking for is some ideas on how to display past dates. I want to create an &quot;archive&quot; section of the calendar where people can navigate to a month in the past to see the events that took place in that specific month. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I create a category group called &quot;months&quot; and then manually add months as they pass, changing the DateTime object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on the best way to display months in the past would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2017-07-27T05:58:23.380" Title="Calendar archives architecture" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;queries&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21341" PostTypeId="2" ParentId="21339" CreationDate="2017-07-27T05:58:23.380" Score="1" Body="&lt;p&gt;You can get your past entries by month as explained &lt;a href=&quot;https://craftcms.stackexchange.com/a/6549/6991&quot;&gt;here&lt;/a&gt;. Than it's just a matter of displaying them they way you want to.  &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-07-27T05:58:23.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21342" PostTypeId="1" CreationDate="2017-07-27T06:37:41.787" Score="1" ViewCount="610" Body="&lt;p&gt;I'm new at using Craft. A friend had some problem with her website and I'm trying to help as much as I can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I have a problem with email sending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The domain is on a server and email exchange is on another server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, the current protocol is PHP Mail. I tried to change to SMTP. I've talked with hosting for email, and they said that they don't provide this service, and that I need to setup my own SMTP server. How do I do that? :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you have any tips/tricks on how to make the email sending work, I truly appreciate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7045" LastActivityDate="2017-07-27T08:20:07.203" Title="Email setup problem" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21343" PostTypeId="2" ParentId="21342" CreationDate="2017-07-27T08:20:07.203" Score="2" Body="&lt;p&gt;What's the issue you are having with sending mail from Craft using PHP Mail? You really don't want to set up your own smtp server if you can avoid it. Here's some &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;guidelines on troubleshooting email errors in Craft&lt;/a&gt; on the support pages.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2017-07-27T08:20:07.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21348" PostTypeId="2" ParentId="10655" CreationDate="2017-07-27T14:37:20.820" Score="1" Body="&lt;p&gt;Might be better to just adjust the matrix field itself (upload a video or an image and make an if statement depending on file type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also is easier if you wouldnt put the image field inside the &quot;hero&quot; block. This way you won't have the issue regarding turning off the other block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would adjust your matrix to one of the mentioned methods above. If you do that you can easily access the light switch and make a if statement like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for block in entry.hero %}&#xA;&#xA;        {% if block.type == &quot;heroBlock&quot; %}&#xA;&#xA;            {% if block.displayHeroVideo %}&#xA;                &amp;lt;h1&amp;gt;Hero Video Markup&amp;lt;/h1&amp;gt;&#xA;            {% else %}&#xA;                 &amp;lt;h1&amp;gt;Hero Image Markup&amp;lt;/h1&amp;gt;&#xA;            {% endif %}&#xA;&#xA;        {% endif %}&#xA;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works if you merge the 2 blocks into one (named Hero Block here). It will save you alot of time writing complicated code and also keeps your code clean.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-07-27T14:37:20.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21349" PostTypeId="1" AcceptedAnswerId="21351" CreationDate="2017-07-27T14:55:29.843" Score="2" ViewCount="529" Body="&lt;p&gt;Every now and then I work in developer teams where we all use our local development environment to work on the code, but share the same database on a remote server (like discussed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16380/recommended-workflow-when-developing-new-websites&quot;&gt;here&lt;/a&gt; etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the time this will kill Crafts performance big time on our local machines. Requests take up to 30 seconds in the Control Panel and in the front-end as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone else encounter the same behavior and/or has an idea how to improve that? The logs don’t explain much.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Time:   25.85331s&#xA;(index):3505 Memory: 25,723Kb&#xA;(index):3506 Total Queries: 287&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The site on the remote server is snappy like you would expect it.&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2017-07-27T15:03:04.547" Title="Why is Craft extremely slow when using a shared, external database?" Tags="&lt;performance&gt;&lt;multi-environment&gt;&lt;workflow&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21350" PostTypeId="2" ParentId="16380" CreationDate="2017-07-27T15:00:39.103" Score="1" Body="&lt;p&gt;My suggestion would be to do what is outlined in &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a little bit of logistical organization coupled with some scripts to do the asset/db synchronization.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-27T15:00:39.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21351" PostTypeId="2" ParentId="21349" CreationDate="2017-07-27T15:03:04.547" Score="4" Body="&lt;p&gt;My suggestion would be to do what is outlined in &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a little bit of logistical organization coupled with some scripts to do the asset/db synchronization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's going to be much, much faster than working with a remote db... and safer, too.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-27T15:03:04.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21352" PostTypeId="1" CreationDate="2017-07-27T15:26:49.727" Score="2" ViewCount="590" Body="&lt;p&gt;I am sending the set Password URL to a user to set their password after ADMIN create a user in CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;code&gt;craft()-&amp;gt;users-&amp;gt;getPasswordResetUrl($user)&lt;/code&gt; to generate the URL for set password which is look like &lt;code&gt;https://&amp;lt;my domain&amp;gt;/actions/users/setpassword?code=8MHKqfmt6Te%5C_dyuCouL4PMaT%7EE%7EV9jNO&amp;amp;id=8bf376ca-e260-44b9-9ad2-0cc623fe4c4c&lt;/code&gt; However, I got intermittent user report they get &lt;strong&gt;&quot;Oops! Invalid verification code. Please login or reset your password.&quot;&lt;/strong&gt; message pop up after click the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general.php, I have &lt;code&gt;'verificationCodeDuration' =&amp;gt; 'P7D'&lt;/code&gt; to make sure the code could last for 7 days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone has idea how to verify the code in DB? Looks the verficationCode column in DB is encrypted. Does anyone know how to solve that issue? Thanks&lt;/p&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-11-24T19:55:48.053" Title="Invalid verification code. Please login or reset your password" Tags="&lt;plugin-development&gt;&lt;url&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21353" PostTypeId="2" ParentId="21183" CreationDate="2017-07-27T15:53:33.207" Score="4" Body="&lt;p&gt;For what it's worth, I also had his issue, turned to imager, which gave me some more useful error messages as to my root cause of the issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to make sure that the path to the asset file is complete, not just relative to the site base. So for instance, a base path of &lt;code&gt;./assets&lt;/code&gt; works fine for standard purposes, but appears no use for transforming images, you would need &lt;code&gt;http://site/assets&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your setting a base path in config, you can use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'environmentVariables' =&amp;gt; array(&#xA;    'assetsBaseUrl' =&amp;gt; '/assets',&#xA;    'assetsBasePath' =&amp;gt; &quot;{$_SERVER['DOCUMENT_ROOT']}/assets&quot;,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7048" LastActivityDate="2017-07-27T15:53:33.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21354" PostTypeId="1" CreationDate="2017-07-27T17:08:04.447" Score="1" ViewCount="58" Body="&lt;p&gt;We have 8000 products imported in the database, with a few 100 categories, sometimes up to 4 levels deep. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we try to do is that when a user clicks a main category, we show 4 random products of each subcategory (but only for it's direct children). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is about 10 subcategories, that are directly under each main category. Though I imagine the &lt;code&gt;relatedTo&lt;/code&gt; digs as many levels deep as it can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code works, but it takes 15 seconds before the page is loaded, so this is not workable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm quite sure it might be the &lt;code&gt;relatedTo&lt;/code&gt; tag that slows it down. &#xA;Plus it also seems that when using &lt;code&gt;relatedTo&lt;/code&gt; and a &lt;code&gt;limit&lt;/code&gt; parameter together, that limit just gets ignored, and it seems he's grabbing all records?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('pharmacyCategories').descendantOf(category.id).level(2).order('catDisplayName') %}&#xA;&#xA;{% for subcat in categories %}&#xA;&#xA;    {% set productsSubCategory = craft.commerce.products.relatedTo(subcat)  %}&#xA;&#xA;    &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;/producten/{{ category.slug }}/{{ subcat.slug }}&quot;&amp;gt;{{ subcat.catDisplayName }} ({{ productsSubCategory.total }})&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for product in productsSubCategory.limit(4).order('RAND()') %}&#xA;        {% if product.variants|length %}&#xA;              &amp;lt;a class=&quot;title&quot; href=&quot;/product/{{ product.slug }}&quot;&amp;gt;{{ product.title }}&amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="185" LastEditorUserId="185" LastEditDate="2017-07-27T17:33:37.917" LastActivityDate="2017-07-27T17:33:37.917" Title="Showing products from many categories becomes very slow" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21355" PostTypeId="2" ParentId="21352" CreationDate="2017-07-27T18:09:55.800" Score="1" Body="&lt;p&gt;If it's just some users, I've seen some email clients split the link with a newline and when users click it, they don't get the full token in the URL producing an invalid one when Craft tries to verify it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In those cases, it's recommended that the user manually copy and paste the full URL instead of clicking on it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-07-27T18:09:55.800" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21356" PostTypeId="1" CreationDate="2017-07-27T18:45:49.740" Score="2" ViewCount="110" Body="&lt;p&gt;Strange bug: I'm creating tabs in a new form, but they're not saving. Goes like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new tab&lt;/li&gt;&#xA;&lt;li&gt;Re-name tab&lt;/li&gt;&#xA;&lt;li&gt;Save form (to add / create a field)&lt;/li&gt;&#xA;&lt;li&gt;Newly created tab is gone&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Same thing happens whether it's my form or one of the default example ones (&quot;basic&quot; and &quot;contact&quot;). The &quot;basic&quot; form has two tabs; I checked the db to see if the tab data (names, number, etc.) is saved anywhere there but I can't see any table that contains it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So maybe it's stored in a file somewhere? Which means maybe some kind of permissions issue? Much obliged for any guidance.&lt;/p&gt;&#xA;" OwnerUserId="286" LastEditorUserId="57" LastEditDate="2017-07-27T19:37:06.307" LastActivityDate="2017-07-28T14:34:13.003" Title="Form tabs aren't saving in the Sprout Forms plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21357" PostTypeId="2" ParentId="9400" CreationDate="2017-07-27T19:34:00.440" Score="1" Body="&lt;p&gt;AWS is good but it's quite expensive. I would suggest to to go for &lt;a href=&quot;https://fxdata.cloud&quot; rel=&quot;nofollow noreferrer&quot;&gt;F(x) Data Cloud&lt;/a&gt; or &lt;a href=&quot;https://digitalocean.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Ocean&lt;/a&gt;.  They have the quality Service and both of them are highly reliable and appreciable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both will satisfy your requirements and are cost-efficient.&lt;/p&gt;&#xA;" OwnerUserId="7049" LastEditorUserId="340" LastEditDate="2017-07-30T00:54:15.107" LastActivityDate="2017-07-30T00:54:15.107" CommentCount="0" CommunityOwnedDate="2017-07-27T19:34:00.440" ContentLicense="CC BY-SA 3.0" />
  <row Id="21358" PostTypeId="1" CreationDate="2017-07-27T23:12:25.153" Score="1" ViewCount="132" Body="&lt;p&gt;I am a Wordpress guy, and I've been given the task of handling my companies Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been at this for hours, and can't seem to figure out how to get the damn form to appear on the page I created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one line of code thing does not work when I copy paste it.&#xA;I have no website data on my local device, so this is all browser-based.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really have no clue where to go from here, and the boss expects results. &#xA;I have the form created in Craft, it is only a matter of figuring out how to make it appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help a major n00b. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: My form is named stlForm&#xA;When I say it's all browser based, I mean I can only edit as much as I can by logging in as an admin. I have no Local data, FTP to access that I know of (our web people are MIA).&lt;/p&gt;&#xA;" OwnerUserId="7051" LastEditorUserId="7052" LastEditDate="2017-07-29T04:20:59.083" LastActivityDate="2017-07-29T04:20:59.083" Title="How to insert a Sprout Form into a new page in Craft CMS" Tags="&lt;plugin-sproutforms&gt;&lt;craft-features&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21359" PostTypeId="2" ParentId="12084" CreationDate="2017-07-28T02:18:32.523" Score="4" Body="&lt;p&gt;The proper fixes have already been answered here; but I'd like to note that another fix is to use MariaDB instead of MySQL. It's a drop-in replacement for it, it's more performant for a number of metrics, and it's created by the original author of MySQL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give it a go; you won't regret it.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-28T02:18:32.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21360" PostTypeId="2" ParentId="44" CreationDate="2017-07-28T02:21:39.237" Score="3" Body="&lt;p&gt;If you happen to be using the &lt;a href=&quot;https://github.com/nystudio107/seomatic/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin for Craft 2.x, it comes with a &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#getlocalizedurls&quot; rel=&quot;nofollow noreferrer&quot;&gt;getLocalizedUrls()&lt;/a&gt; function that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Returns an array of localized URLs for the current page request. This handles elements with localized slugs, etc. This function returns the unique URLs for each language for the current page request, not just the localized site URLs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic for Craft CMS 3&lt;/a&gt;,there's a similarly the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&quot; rel=&quot;nofollow noreferrer&quot;&gt;seomatic.helper.getLocalizedUrls(URI, SITE_ID)&lt;/a&gt; helper function:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Return a list of localized URLs for a given URI that are in the SITE_ID site's group. Both URI and SITE_ID are optional, and will use the current request's URI and the current site's SITE_ID if omitted.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This makes building a language switcher trivial.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-07-23T17:46:56.583" LastActivityDate="2018-07-23T17:46:56.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21362" PostTypeId="1" AcceptedAnswerId="21363" CreationDate="2017-07-28T11:48:52.107" Score="3" ViewCount="290" Body="&lt;p&gt;I’ve set up a few email notifications to be sent to customers, and in the corresponding email templates I’d like to use content from Global fields I’ve created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I use the regular variable &lt;code&gt;{{ globalSetHandle.fieldHandle }}&lt;/code&gt; nothing is outputted in the emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that means that we can’t use Globals inside email templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6605" LastEditorUserId="57" LastEditDate="2017-07-28T18:45:28.700" LastActivityDate="2017-07-28T18:45:28.700" Title="Use Globals in email templates" Tags="&lt;emails&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21363" PostTypeId="2" ParentId="21362" CreationDate="2017-07-28T11:53:06.700" Score="3" Body="&lt;p&gt;They aren't loaded into the twig template global scope but you can access them with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.globals#getSetByHandle&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.globals#getSetByHandle&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-07-28T11:53:06.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21364" PostTypeId="2" ParentId="21358" CreationDate="2017-07-28T13:40:45.737" Score="3" Body="&lt;p&gt;If you don't have a local development environment setup, you will need FTP access to the server where Craft is installed to edit templates. The one line of code cannot be copied and pasted into a field in the control panel like one might do with WP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all you will need to &lt;strong&gt;make or edit&lt;/strong&gt; a template to show this form. The &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/getting-started/introduction#output-your-forms-with-one-line-of-code&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;one line of code&quot;&lt;/a&gt; needs to be placed in the template where you want to show the form.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;For Example&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;If you are adding a “Contact Us” form that you want to appear at &lt;code&gt;https://[YOUR-DOMAIN-HERE]/contact-us&lt;/code&gt; then you would do the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Login to your company’s server via FTP with and FTP client like &lt;a href=&quot;https://filezilla-project.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Filezilla&lt;/a&gt;, &lt;a href=&quot;https://panic.com/transmit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transmit&lt;/a&gt;, or &lt;a href=&quot;https://cyberduck.io/?l=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cyberduck&lt;/a&gt;. You’ll need to get the FTP login credentials from your company.&lt;/li&gt;&#xA;&lt;li&gt;Find the location where Craft is installed. If it has not be placed above the webroot then you could probably find it under &lt;code&gt;public_html/craft&lt;/code&gt; or &lt;code&gt;www/craft&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Find the &lt;code&gt;templates&lt;/code&gt; folder inside the &lt;code&gt;craft&lt;/code&gt; folder.&lt;/li&gt;&#xA;&lt;li&gt;You have a few options at this point:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Make a new file and name it &lt;code&gt;contact-us.html&lt;/code&gt; or &lt;code&gt;contact-us.twig&lt;/code&gt; depending on your preference. You can probably just make a new file with the &lt;code&gt;.html&lt;/code&gt; extension if you don’t have a local development environment set up. I don’t know if there is any performance gains using &lt;code&gt;.twig&lt;/code&gt; over &lt;code&gt;.html&lt;/code&gt;. You can make a new file usually by right-clicking in the folder where you want it created and there is a context menu to make a new file.&lt;/li&gt;&#xA;&lt;li&gt;OR you can make a new folder under &lt;code&gt;templates&lt;/code&gt; and name it &lt;code&gt;contact-us&lt;/code&gt;. Then under that folder you can make a new template named &lt;code&gt;index.html&lt;/code&gt;. Your folder structure will then look like &lt;code&gt;craft/templates/contact-us/index.html&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Open the new file that you created in the previous step.&lt;/li&gt;&#xA;&lt;li&gt;Add the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/getting-started/introduction#output-your-forms-with-one-line-of-code&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;one line of code&quot;&lt;/a&gt; referring to your form.&lt;/li&gt;&#xA;&lt;li&gt;Save the template.&lt;/li&gt;&#xA;&lt;li&gt;Go to your browser and type in &lt;code&gt;httpS://[YOUR-DOMAIN-HERE]/contact-us&lt;/code&gt; and you should see the form there.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is probably the simplest way to get your form to show up on your site. There are more advanced and client-friendly ways to do this but this should hopefully get you started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’ll need to check the other templates to see how they are created if you want to include the same style as the rest of your site. There is usually a line of code at the top of the template that says something like &lt;code&gt;{% extends '_layout.html'%}&lt;/code&gt; or similar.&lt;/p&gt;&#xA;" OwnerUserId="3951" LastActivityDate="2017-07-28T13:40:45.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21365" PostTypeId="2" ParentId="21356" CreationDate="2017-07-28T14:34:13.003" Score="1" Body="&lt;p&gt;OK, heard from Barrel Strength / Sprout support. His reply:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Please create any fields that you need before adding the tab, then&#xA;  please go ahead and add the tab(s) then drag and drop the fields that&#xA;  you need into the new tab (rename the new tab in this step if you&#xA;  want) and finally save the form. The new tabs need to have at least&#xA;  one field to be saved with the form.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since you can't create an empty tab, the trick is to create all your fields &lt;em&gt;first&lt;/em&gt; -- or at least, one field per tab. Then, after you create the tabs, you can drag a single field to each tab and save the form. That will keep the tabs. After that, when you create a new field, you can select the tab it belongs to in the dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; that's how it also works in the native Craft field manager? So hopefully this helps somebody even if you're not using Sprout Forms (which is &lt;strong&gt;awesome&lt;/strong&gt;, by the way.)&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2017-07-28T14:34:13.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21366" PostTypeId="1" AcceptedAnswerId="21467" CreationDate="2017-07-28T19:05:39.297" Score="2" ViewCount="887" Body="&lt;p&gt;I'm experiencing a problem where none of the plugins (2 captchas, and a random bookworm plugin) are showing up in my admin panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folders are lowercase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also checked permissions; folders are at 755. The corresponding file is at 644.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the Pixel &amp;amp; Tonic &lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form&lt;/a&gt; plus the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;RetconHTML&lt;/a&gt; plugins currently in there, so I know I've successfully uploaded plugins before. Just not sure what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-edit-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two plugins I'm currently having problems with are &lt;a href=&quot;https://github.com/mrnebbi/bookworm&quot; rel=&quot;nofollow noreferrer&quot;&gt;bookworm&lt;/a&gt; and &lt;a href=&quot;https://github.com/aberkie/craft-recaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;recaptcha&lt;/a&gt;, not anything I've specifically developed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of my plugins directory:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/366yS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/366yS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="895" LastEditorUserId="895" LastEditDate="2017-07-30T15:06:45.487" LastActivityDate="2017-08-07T15:21:11.207" Title="Plugins not showing in Admin" Tags="&lt;plugins&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21367" PostTypeId="1" CreationDate="2017-07-28T19:07:17.283" Score="1" ViewCount="390" Body="&lt;p&gt;I've written a simple plugin that attaches to the onSaveEntry event. I'd like to access the image, extract the colours from the image using &lt;a href=&quot;https://github.com/brianmcdo/ImagePalette&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/brianmcdo/ImagePalette&lt;/a&gt; and then save these colours to a field. I've managed to access the entry, but can't seem to find how to get the path and filename of the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7055" LastActivityDate="2017-07-29T16:40:10.137" Title="How do I get the full path of an asset?" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2017-07-31T20:02:34.540" ContentLicense="CC BY-SA 3.0" />
  <row Id="21368" PostTypeId="2" ParentId="19929" CreationDate="2017-07-28T22:18:46.817" Score="1" Body="&lt;p&gt;I just found myself doing this exact thing. The trick is to use &lt;code&gt;saveRelations&lt;/code&gt; to set the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my example, my category id is &lt;code&gt;18840&lt;/code&gt;, my field is &lt;code&gt;market&lt;/code&gt;, and my section is &lt;code&gt;events&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a throwaway action in my exiting &lt;code&gt;site&lt;/code&gt; plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSetmarket()&#xA;{&#xA;  $catIds = array(18840);&#xA;  $fieldModel = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('market');&#xA;  $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;  $criteria-&amp;gt;section = 'events';&#xA;  $criteria-&amp;gt;limit = null;&#xA;  foreach ($criteria as $entry) {&#xA;    craft()-&amp;gt;relations-&amp;gt;saveRelations($fieldModel, $entry, $catIds);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which can be run from &lt;code&gt;/actions/site/setmarket&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-07-28T22:18:46.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21369" PostTypeId="1" AcceptedAnswerId="21379" CreationDate="2017-07-29T01:15:02.057" Score="1" ViewCount="266" Body="&lt;p&gt;So on a cart page, I need to list out the discounts that have been applied to a cart. I need to list them one by one, but only discounts that are applied with a code. I'm having trouble figuring out how to get the discount code, and I need to output the code. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Item Total: $200.00&#xA;Promotional (25OFF): -$25.00&#xA;Promotional (FATHERSDAY): -$10.00&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm looking over the discount info like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for discount in cart.adjustments %}&#xA;    {{ dump(discount) }}&#xA;    &amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't see an accessible code variable jumping out at me. The only places I can see pulling it is from the &lt;code&gt;optionsJson&lt;/code&gt; string, but that is not practical as Twig doesn't have a default JSON filter to decode. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I can get the discount ID easily enough from that loop; but I'm not sure how to pull a Discount model based on ID. I'm not super versed with Craft and Twig, so I'm hoping there is a simple solution to look up Discounts based on discount ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for discounts in cart.adjustments %}&#xA;    {# look up discount based on discount.id #}&#xA;        {% if discount.code | length %}&#xA;            Promotional ({{ discount.code }}): {# discount amount, probably have to do math here if it is a percentage #}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I imagine I'm going about this wrong.&lt;/p&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="6955" LastEditDate="2017-10-04T17:04:01.617" LastActivityDate="2017-10-04T17:04:01.617" Title="List applied discounts that have codes" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21370" PostTypeId="1" AcceptedAnswerId="21375" CreationDate="2017-07-29T03:13:11.440" Score="1" ViewCount="129" Body="&lt;p&gt;I have set up a structure that allows me to display events with some information.  I'd like to know if there's a way that I can set a date that will automatically change certain  it's a text from being future tense to be in present tense during the event and past tense after the event i.e.  I'll be, I am, I was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to everyone in advance! &lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2017-07-29T16:31:18.370" Title="Text that is conditional on date" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21371" PostTypeId="1" AcceptedAnswerId="21374" CreationDate="2017-07-29T11:42:38.880" Score="1" ViewCount="155" Body="&lt;p&gt;I am trying to create a functionality in Craft where the user enter an email and the system is able to tell the user if the user exists or not similar to the attached screen:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WWeK4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WWeK4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very new to plugin development, and I am not even sure if I need one, I found this post, which looks very helpful, only thing is I really don't know how to implement it.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8395/how-to-tell-if-user-exists?newreg=7abceb6cd96146b394914ac0ddd2fba0&quot;&gt;How to tell if user exists&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I develop a plugin? And I don't understand the information on plugin website and I can't find an example where there is an input field on the front end.&lt;/p&gt;&#xA;" OwnerUserId="7057" LastEditorUserId="57" LastEditDate="2017-07-29T15:48:58.020" LastActivityDate="2017-07-29T16:08:36.167" Title="Craft plugin for input fields on the front end to check existing user" Tags="&lt;plugin-development&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21372" PostTypeId="2" ParentId="21366" CreationDate="2017-07-29T13:24:28.463" Score="5" Body="&lt;p&gt;Probably the name of the folder isn't the plugin handle. Check inside the plugin's folder to see if the actual plugin folder is inside there. For instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;forge@nys-production ~/nystudio107.com/craft/plugins (master) $ tree -L 1 craft-typogrify/&#xA;craft-typogrify/&#xA;├── readme.md&#xA;└── typogrify&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, when the plugin is downloaded or cloned, the name of the folder is &lt;code&gt;craft-typogrify&lt;/code&gt; but the actual plugin folder is &lt;em&gt;inside&lt;/em&gt; of this folder, and is named as a lowercase version of the plugin handle: &lt;code&gt;typogrify&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what needs to be directly in the &lt;code&gt;craft/plugins&lt;/code&gt; folder for Craft to see it.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-07-29T13:24:28.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21373" PostTypeId="1" CreationDate="2017-07-29T14:17:49.127" Score="3" ViewCount="302" Body="&lt;p&gt;I have a query that loads a set of &lt;code&gt;movies&lt;/code&gt;, and eager-loads corresponding &lt;code&gt;shows&lt;/code&gt;, which are related elements. For now, the movies are sorted by &lt;code&gt;startingDate&lt;/code&gt;, which is a custom field in the &lt;code&gt;movie&lt;/code&gt; entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentMovies = craft.entries({&#xA;        section: 'movies',&#xA;        type:    'movie',&#xA;        order:   'startingDate asc',&#xA;        limit:   null,&#xA;        with: [&#xA;            'shows',&#xA;            'poster',&#xA;            'stills'&#xA;        ]&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I actually want is to sort the movies by whichever film has the first upcoming screening. That basically means I would like to order the set by something to the effect of &lt;code&gt;order: shows.showTime&lt;/code&gt; or &lt;code&gt;order: shows[0].showTime&lt;/code&gt;, but that doesn't seem to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to order by a field on a related entry, or is that variable simply not yet accessible at the point of ordering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to eager-load the &lt;code&gt;shows.showtime&lt;/code&gt; field, but realised that doesn't work either, as eager-loading only makes sense for relations, not fields themselves.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="57" LastEditDate="2017-07-29T19:28:10.603" LastActivityDate="2019-08-08T12:33:42.957" Title="Ordering entries based on an eager-loaded element's custom field" Tags="&lt;entries&gt;&lt;ordering&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21374" PostTypeId="2" ParentId="21371" CreationDate="2017-07-29T16:08:36.167" Score="3" Body="&lt;p&gt;If you are creating these as actual users in Craft, it should be possible to do it straight from the template without the need for a plugin, as long as you have Craft PRO (without PRO you anyways wouldn't be able to create more than one &quot;admin&quot; user, and one &quot;client&quot; user anyways):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the documentation here:&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.users#email&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.users#email&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you should be able to call &lt;code&gt;craft.users.email('your.email@address.com')&lt;/code&gt; to check if it exists. Again, I haven't tested this myself, but it will then return the user if it exists, and otherwise I assume it will return &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-07-29T16:08:36.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21375" PostTypeId="2" ParentId="21370" CreationDate="2017-07-29T16:31:18.370" Score="2" Body="&lt;p&gt;I guess you could do something like this. I'm assuming the events have &lt;code&gt;eventStart&lt;/code&gt; and &lt;code&gt;eventEnd&lt;/code&gt; date variables, and I'm here comparing the dates with the built in &lt;code&gt;now&lt;/code&gt; variable on the format year-month-hour-minute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# When eventStart is bigger than &quot;now&quot;, the event is in the future #}&#xA;{% if event.eventStart|date('YmdHi') &amp;gt; now|date('YmdHi') %}&#xA;  I will attend this event!&#xA;&#xA;{# When eventStart is in the past, and eventEnd is in the future, the event is ongoing #}&#xA;{% elseif event.eventStart|date('YmdHi') &amp;lt;= now|date('YmdHi') and event.eventEnd|date('YmdHi') &amp;gt; now|date('YmdHi') %}&#xA;  I am at this event RIGHT NOW!&#xA;&#xA;{# When none of the above, the event is in the past #}&#xA;{% else %}&#xA;  I was at this event&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on your use, you could build on this to create a variable for &quot;past/present/future&quot; or similiar. To be even more sure on your validation, the last &lt;code&gt;endif&lt;/code&gt; could also specifically test that the &lt;code&gt;endDate&lt;/code&gt; is in the past, instead of just being a catch-all &lt;code&gt;else&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-07-29T16:31:18.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21376" PostTypeId="2" ParentId="21367" CreationDate="2017-07-29T16:40:10.137" Score="0" Body="&lt;p&gt;You should be able to get it with the &lt;code&gt;getURL()&lt;/code&gt; method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should work (NB! have not tested the code myself):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$image = $entry-&amp;gt;image-&amp;gt;first();&#xA;if ($image) {&#xA;    $url = $image-&amp;gt;getUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-07-29T16:40:10.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21377" PostTypeId="1" CreationDate="2017-07-29T17:27:28.023" Score="2" ViewCount="115" Body="&lt;p&gt;We are about to start on a project that will include a complex product catalogue, with multiple product categories and loads of relationships. The client has stated that they may want to create an online store to sell catalogue items at some point in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thought at this point is to create the product catalogue using standard Craft CMS features like Structures and Categories. Anyone have any experience or guidance on adding Craft Commerce to an existing Craft site? Will I have to recreate product structures or can build the initial version in a manner that allows Craft Commerce to work with an existing product schema? &lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="45" LastEditDate="2017-08-01T17:53:58.343" LastActivityDate="2017-08-01T17:53:58.343" Title="What are the issues with adding Craft Commerce to an existing Craft CMS site?" Tags="&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21378" PostTypeId="2" ParentId="21377" CreationDate="2017-07-29T18:00:43.810" Score="5" Body="&lt;p&gt;You should absolutely use Craft Commerce to store the products, as there is no migration from Entries -&gt; Craft Commerce products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don’t need to pay for a Craft Commerce license if you are not utilizing a payment gateway, so there is really no downside to getting things into Commerce in the first place, and plenty of downside to needing it and not having it already in Commerce down the road.&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2017-07-29T18:00:43.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21379" PostTypeId="2" ParentId="21369" CreationDate="2017-07-30T00:50:19.267" Score="2" Body="&lt;p&gt;(There can be only one code on a cart at any one time)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some example code that does the sort of thing you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.couponCode %}&#xA;    {% set coupon = craft.commerce.getDiscountByCode(cart.couponCode) %}&#xA;{% endif %}&#xA;&#xA;{% if cart.totalDiscount or coupon is not null %}&#xA;&#xA;    {% for adjustment in cart.adjustments if adjustment.type == &quot;Discount&quot; %}&#xA;        {% set isCoupon = adjustment.optionsJson.code ? true : false %}                &#xA;&#xA;    &amp;lt;strong&amp;gt;Applied: &amp;lt;/strong&amp;gt;&#xA;&#xA;        {% if isCoupon %}                &#xA;            &amp;lt;div class=&quot;coupon-item&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;clear&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;cartSection__text&quot;&amp;gt;&#xA;&#xA;                        Coupon: &amp;lt;strong&amp;gt;{{ adjustment.optionsJson.code }}&amp;lt;/strong&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;cartSection__description&quot;&amp;gt;&#xA;                    {{ adjustment.description }}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% set couponPrinted = true %}&#xA;        {% else % }&#xA;            etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-07-30T00:50:19.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21380" PostTypeId="1" CreationDate="2017-07-30T07:18:11.703" Score="1" ViewCount="225" Body="&lt;p&gt;Trying to sort products by price. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;  type:  'footwear',&#xA;  limit: shopSettings.productsPerPage,&#xA;  order: 'defaultPrice asc',&#xA;}) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please tell me how to sort products by &lt;strong&gt;Sale&lt;/strong&gt; price?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6238" LastEditorUserId="45" LastEditDate="2017-08-01T17:54:16.560" LastActivityDate="2017-08-01T17:54:16.560" Title="Craft Commerce: Sort products by Sale price" Tags="&lt;plugin-craftcommerce&gt;&lt;ordering&gt;&lt;order&gt;&lt;sort&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21381" PostTypeId="1" CreationDate="2017-07-30T11:20:25.653" Score="1" ViewCount="174" Body="&lt;p&gt;I have the following menu structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UQjwI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UQjwI.png&quot; alt=&quot;menustructure&quot;&gt;&lt;/a&gt;&#xA;as you can see, the Item &quot;Clients&quot; points to the same Url as its Child &quot;Client Portfolio&quot; does. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this is not working for my submenu that should consist of the active menuitems childs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set activeNodeId = craft.amNav.getActiveNodeIdForLevel('mainmenu','1') %}&#xA;&#xA;{% if activeNodeId %}&#xA;   {{ craft.amNav.getNav('mainmenu', {&#xA;    class: 'subnav-inner',&#xA;    startFromId: activeNodeId&#xA;                }) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable &quot;activeNodeId&quot; is always the deepest level child (with that url). So in my case, clicking on &quot;Clients&quot; would result in an activeNodeId = 66. Of course fetching the subitems of this makes no sense because &quot;Client Portfolio&quot; has no children. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to force the plugin to take always the correct (parents) id? Or any other way to get the submenu items of the active menu?&lt;/p&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-07-31T00:43:54.227" LastActivityDate="2017-09-01T18:24:34.210" Title="a&amp;m nav - activeNodeId" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21383" PostTypeId="2" ParentId="20305" CreationDate="2017-07-31T12:16:02.890" Score="1" Body="&lt;p&gt;I know this is a while ago, however you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Default Times: 09:00-18:00 &lt;br&gt;&lt;br&gt;&#xA;Monday Time: &lt;br&gt;&#xA;Tuesday Time:&lt;br&gt;&#xA;Wedneday Time:&lt;br&gt;&#xA;Thursday Time: 09:00-20:00 &lt;br&gt;&#xA;Friday Time: &lt;br&gt;&#xA;Saturday Time:&lt;br&gt;&#xA;Sunday Time:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When listing times check if that day has a specific time, otherwise use the default time. Will save you changing 6 times anytime there is a change in opening times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not a complex solution but one that can be easily understood by a content manager.&lt;/p&gt;&#xA;" OwnerUserId="5689" LastActivityDate="2017-07-31T12:16:02.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21384" PostTypeId="1" AcceptedAnswerId="21429" CreationDate="2017-07-31T15:18:53.167" Score="1" ViewCount="922" Body="&lt;p&gt;I'm trying to write my own Craft 3 TWIG filter / functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this purpose I created a scaffolding using pluginfactory.io. I did a &lt;code&gt;composer require&lt;/code&gt; and composer correctly symlinks the plugin to the Craft project's vendor directory. When I click &quot;Plugins&quot; in the CP it shows my plugin, but when I click &quot;Install&quot; I get the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Call to a member function getVersion() on null&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;caused in /var/www/html/vendor/craftcms/cms/src/services/Plugins.php on line 328 which is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$info = [&#xA;  'handle' =&amp;gt; $handle,&#xA;  'version' =&amp;gt; $plugin-&amp;gt;getVersion(), // &amp;lt;== Line 328&#xA;  'schemaVersion' =&amp;gt; $plugin-&amp;gt;schemaVersion,&#xA;  'installDate' =&amp;gt; Db::prepareDateForDb(new \DateTime()),&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why? I compared my composer.json with e.g. nystudio107/craft3-pathtools and it's almost identical and I definitely have a version defined in my composer.json.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is $plugin null?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-02T16:08:54.910" Title="Create Craft 3 Plugin - Call to a member function getVersion() on null" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21386" PostTypeId="2" ParentId="16747" CreationDate="2017-07-31T16:51:36.057" Score="3" Body="&lt;p&gt;I have it working now using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#Form').submit(function(ev) {&#xA;// Prevent the form from actually submitting&#xA;ev.preventDefault();&#xA;&#xA;var formData = new FormData($(this)[0]);&#xA;&#xA;// Send it to the server&#xA;$.ajax('/', {    &#xA;  url:  '/',&#xA;  data: formData,&#xA;  type: 'POST',&#xA;  async: false,&#xA;  cache: false,&#xA;  contentType: false,&#xA;  processData: false,&#xA;  success: function(response) {&#xA;    if (response.success) {&#xA;      alert('Thank You. Your message has been sent');&#xA;    } else {&#xA;            // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;            // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;            alert('An error occurred. Please try again.');&#xA;          }&#xA;        }&#xA;      });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3812" LastActivityDate="2017-07-31T16:51:36.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21387" PostTypeId="1" AcceptedAnswerId="21410" CreationDate="2017-07-31T18:28:35.303" Score="1" ViewCount="95" Body="&lt;p&gt;As you can see, I would like to see what challenge the submission is linked to, even though that Challenge might now be turned off (expired or disabled).  Is this a bug or intended behaviour.  Is there an easy way to get this up and running?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's intended, I'm not sure why there's a green &quot;enabled&quot; dot on it, there's no way they can be anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my screenshot, the field Challenge is an entry field and the entry &quot;Challenge #1&quot; is assigned to, but is now expired and not showing in the table.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qhIHs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qhIHs.png&quot; alt=&quot;Example of what&amp;#39;s happening&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7065" LastEditorUserId="7065" LastEditDate="2017-08-01T13:19:55.813" LastActivityDate="2017-08-01T18:13:14.717" Title="Disabled entries don't show up in the Linked entries field when displayed in the CP entry list" Tags="&lt;control-panel&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21388" PostTypeId="1" AcceptedAnswerId="21391" CreationDate="2017-07-31T20:01:05.577" Score="5" ViewCount="385" Body="&lt;p&gt;I've got a plugin which is defaulting to English during AJAX calls, but I need it to stick to whatever the current language is. I can send the current locale through via AJAX data, but I'm not sure how to change the locale in PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible to get the current locale like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;getLanguage()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to &lt;strong&gt;set&lt;/strong&gt; the current locale in PHP?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-09-21T17:06:22.430" Title="Possible to change locale in PHP?" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21389" PostTypeId="2" ParentId="21388" CreationDate="2017-07-31T20:22:50.397" Score="2" Body="&lt;p&gt;In a project I'm currently using &lt;code&gt;define('CRAFT_LOCALE', 'nl_be');&lt;/code&gt; inside index.php to set it based on the request URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine this should also work by getting a parameter from the request and setting it based on that.&lt;/p&gt;&#xA;" OwnerUserId="6675" LastActivityDate="2017-07-31T20:22:50.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21391" PostTypeId="2" ParentId="21388" CreationDate="2017-07-31T20:57:35.603" Score="5" Body="&lt;p&gt;I think I got this resolved the &lt;em&gt;proper&lt;/em&gt; way... looks like you just need to &lt;strong&gt;make sure that your AJAX calls are localized.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my main &lt;code&gt;_layout&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;window.siteUrl = &quot;{{ siteUrl }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my JS, I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;$.post(&#xA;    siteUrl + 'actions/myPlugin/myAction',&#xA;    ...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as your &lt;code&gt;siteUrl&lt;/code&gt; is being localized properly, it should trickle down into the JS... and the localized AJAX path can then load a properly localized template.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-09-21T17:06:22.430" LastActivityDate="2017-09-21T17:06:22.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21393" PostTypeId="1" CreationDate="2017-07-31T21:26:20.733" Score="1" ViewCount="586" Body="&lt;p&gt;I have created a small craft cms plugin to pull some information from the DB, and everytime I execute the plugin I get a 404.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class UserExists_UserControllerController extends BaseController&#xA;{&#xA;    public function actionGetUser()&#xA;    {&#xA;        $this-&amp;gt;returnJson($response);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the jquery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    url: &quot;{{ url(&quot;actions/userexists/usercontroller/getUser&quot;) }}&quot;,&#xA;    dataType: &quot;json&quot;,&#xA;    success: function(data){&#xA;        console.log(data)&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7057" LastEditorUserId="45" LastEditDate="2017-08-01T17:57:10.230" LastActivityDate="2017-08-01T17:57:10.230" Title="Craft CMS plugin with AJAX gives 404 error" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;controller&gt;" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21394" PostTypeId="2" ParentId="21393" CreationDate="2017-07-31T21:47:18.573" Score="4" Body="&lt;p&gt;If you aren't currently logged in, you're apt to be running up against the &quot;anonymous access&quot; limitation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#allowing-anonymous-access-to-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;This section of the Controller documentation&lt;/a&gt; should help:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;By default, controller actions are only accessible to logged-in users. You can override that by changing the protected &lt;code&gt;$allowAnonymous&lt;/code&gt; property on your controller class. To allow anonymous access to all of your controller’s actions, set it to &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class CocktailRecipes_IngredientsController extends BaseController&#xA;{&#xA;  protected $allowAnonymous = true;&#xA;&#xA;  // Your action methods&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2017-07-31T21:47:18.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21395" PostTypeId="1" CreationDate="2017-08-01T02:18:29.483" Score="1" ViewCount="128" Body="&lt;p&gt;Basically, a client needs to provide a discount that offers free shipping over a certain item total. Easy enough. But the discount needs to only apply to one shipping method, not all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can easily display no shipping charge, but if a customer chooses a shipping method that they should still be charged for, I am unable to remove the free shipping discount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's this issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/commerce/issues/181&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/181&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a work around?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like is there a quick and dirty business logic few lines of code to remove a discount programmatically?&lt;/p&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="57" LastEditDate="2018-03-29T03:43:42.920" LastActivityDate="2018-03-29T03:43:42.920" Title="Remove discount from Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21396" PostTypeId="2" ParentId="824" CreationDate="2017-08-01T04:56:22.320" Score="1" Body="&lt;p&gt;Well this documentation helped me a lot to check any conditions. It might help others too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/articles/how-to-check-if-a-variable-or-value-exists-using-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/how-to-check-if-a-variable-or-value-exists-using-twig&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-08-01T04:56:22.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21397" PostTypeId="1" CreationDate="2017-08-01T05:05:03.737" Score="1" ViewCount="247" Body="&lt;p&gt;I'm trying to create the following layout using batch, but I can't quite get it right...&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;https://i.stack.imgur.com/FOSGC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FOSGC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is how far I've gotten:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in items|batch(3) %}&#xA;   &amp;lt;div class=&quot;row rowDivider&quot;&amp;gt;&#xA;     {% if loop.index is divisible by(5) or loop.index == 1 %}&#xA;&#xA;        {% for batch in entry[0:3]   %}&#xA;          {% if loop.index == 1 %}&#xA;              &amp;lt;div class=&quot;big&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% elseif loop.index == 2 %}&#xA;              &amp;lt;div class=&quot;big-top&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% else %}&#xA;              &amp;lt;div class=&quot;big-bottom&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;&#xA;      {% elseif loop.index is divisible by(2) %}&#xA;&#xA;        {% for batch in entry[0:2] %}&#xA;          {% if loop.index == 1 %}&#xA;             &amp;lt;div class=&quot;big-left&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% else %}&#xA;             &amp;lt;div class=&quot;small-right&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;&#xA;      {% elseif loop.index is divisible by(3) %}&#xA;&#xA;        {% for batch in entry[0:3] %}&#xA;          {% if loop.index == 1 %}&#xA;             &amp;lt;div class=&quot;small-left&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% elseif loop.index == 2 %}&#xA;             &amp;lt;div class=&quot;small-middle&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% else %}&#xA;             &amp;lt;div class=&quot;small-right&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Json used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [&quot;1&quot; , &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot; , &quot;6&quot;, &quot;7&quot;, &quot;8&quot;,&quot;9&quot; , &quot;10&quot;, &quot;11&quot;, &quot;12&quot;, &quot;13&quot;, &quot;14&quot;, &quot;15&quot;, &quot;16&quot;, &quot;17&quot;, &quot;18&quot;, &quot;19&quot;, &quot;20&quot;, &quot;21&quot;, &quot;22&quot; ] }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help will be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3468" LastEditorUserId="3468" LastEditDate="2017-08-01T05:54:17.357" LastActivityDate="2017-08-31T07:20:15.807" Title="Attempting to create a complicated grid layout with batch" Tags="&lt;loop&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21398" PostTypeId="2" ParentId="21397" CreationDate="2017-08-01T06:35:26.377" Score="1" Body="&lt;p&gt;I think I got it. Here's what I did:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in items|batch(10) %}&#xA;&amp;lt;div class=&quot;set&quot;&amp;gt;&#xA;&#xA;    {% for batch in entry[0:3] %}&#xA;        {% if loop.index == 1 %}&#xA;        &amp;lt;div class=&quot;rowOne&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;big&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;        {% elseif loop.index == 2 %}&#xA;          &amp;lt;div class=&quot;big-top&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;        {% elseif loop.index == 3 %}&#xA;          &amp;lt;div class=&quot;big-bottom&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for batch in entry[3:2] %}&#xA;      {% if loop.index == 1 %}&#xA;        &amp;lt;div class=&quot;rowTwo&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;big-left&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;      {% elseif loop.index == 2 %}&#xA;          &amp;lt;div class=&quot;small-right&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for batch in entry[5:3] %}&#xA;      {% if loop.index == 1 %}&#xA;        &amp;lt;div class=&quot;rowThree&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;small-left&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;      {% elseif loop.index == 2 %}&#xA;          &amp;lt;div class=&quot;small-middle&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;      {% elseif loop.index == 3 %}&#xA;          &amp;lt;div class=&quot;small-right&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for batch in entry[8:2] %}&#xA;      {% if loop.index == 1 %}&#xA;      &amp;lt;div class=&quot;rowFour&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;small-left&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;      {% elseif loop.index == 2 %}&#xA;        &amp;lt;div class=&quot;big-right&quot;&amp;gt;{{batch}}&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3468" LastActivityDate="2017-08-01T06:35:26.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21399" PostTypeId="2" ParentId="21316" CreationDate="2017-08-01T06:51:16.547" Score="1" Body="&lt;p&gt;This post helped me with my issue with a different approach (except of using the kebab filter the slug of the tag is used for the route)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-route&quot;&gt;Use of tag.slug instead of tag.title in a custom route&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as I think that makes lot more sense then using the title, maybe it would be a good idea to update the article in the support section of the craftcms website.&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-08-01T06:51:16.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21401" PostTypeId="1" CreationDate="2017-08-01T13:04:26.907" Score="1" ViewCount="171" Body="&lt;p&gt;How to add Image or any field on Calendars section for Solspace Calendar?&lt;/p&gt;&#xA;" OwnerUserId="7073" LastEditorUserId="45" LastEditDate="2017-08-25T21:03:41.030" LastActivityDate="2017-08-25T21:03:41.030" Title="How to add Image or any field on Calendars section for Solspace Calendar?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21402" PostTypeId="2" ParentId="21393" CreationDate="2017-08-01T13:34:06.327" Score="2" Body="&lt;p&gt;Two things to try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Try to use the Craft.getActionUrl() to get the URL of the action, as per the documentation for &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers#linking-directly-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linking Directly to Controller Actions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Make sure there is no &lt;code&gt;$this-&amp;gt;requireLogin()&lt;/code&gt; or &lt;code&gt;$this-&amp;gt;requirePostRequest()&lt;/code&gt; in your controller&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically there could be something wrong in the routing as well, as I have also experienced that a plugin runs perfectly, but because the response was not set to reply or re-route to somewhere meaningful, I got a 404 when accessing the controller via URL, and not from the control panel. In that case, this answered question could be helpful: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5401/controller-action-works-but-still-gives-404&quot;&gt;Controller action works but still gives 404&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-08-01T13:34:06.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21403" PostTypeId="2" ParentId="21393" CreationDate="2017-08-01T13:40:20.047" Score="1" Body="&lt;p&gt;If you are still not having any luck, If none of the above work, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12736/how-can-i-call-a-controller-method-from-the-front-end-using-ajax&quot;&gt;check out this thread&lt;/a&gt; that shows how to call an ajax function from a controller.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-08-01T13:40:20.047" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21404" PostTypeId="1" AcceptedAnswerId="21409" CreationDate="2017-08-01T15:36:56.303" Score="3" ViewCount="2313" Body="&lt;p&gt;I have set up a Matrix field that contains a block type that contains among other things, an asset field. &#xA;Trying to iterate through the contents of that matrix field works just fine for all other field types but produces the following error when it comes across the asset field type.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the part of the template that produces the error. &quot;icon&quot; is the asset field type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.visitorContentBuilder %}&#xA;&#xA;    {% if block.type == &quot;listItemWithIcon&quot; %}&#xA;&#xA;        {{ block.icon }}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5881" LastEditorUserId="57" LastEditDate="2017-08-01T17:24:00.540" LastActivityDate="2017-08-01T17:30:27.023" Title="Object of class Craft\ElementCriteriaModel could not be converted to string" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;assetfilemodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21405" PostTypeId="1" AcceptedAnswerId="21412" CreationDate="2017-08-01T15:40:29.120" Score="2" ViewCount="208" Body="&lt;p&gt;I am trying to build a leaderboard page, and I'm having difficulties finding a way to group the entries by Author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to create a plugin to get the sql sum function in there, but I now need to add a group by Author and order by Score DESC to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First steps were taken from here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1687/ability-to-sum-or-group-by-from-the-template-or-elementcriteriamodel&quot;&gt;Ability to SUM() or GROUP BY from the template or ElementCriteriaModel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I ultimately want is a query that would look like this (very simplified of course):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT author, SUM(content.score) as score FROM content Group By Author Order By score DESC&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this &quot;natively&quot; or do I need to write my own query?&lt;/p&gt;&#xA;" OwnerUserId="7065" LastEditorUserId="7065" LastEditDate="2017-08-01T18:32:32.703" LastActivityDate="2017-08-01T19:28:06.637" Title="Sum with a group by Author" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21406" PostTypeId="1" CreationDate="2017-08-01T16:40:31.333" Score="0" ViewCount="68" Body="&lt;p&gt;Below is the full block of code I am working with. This is part of a template for showing all businesses that belong to a sub-category. I need to load all businesses related to the current category, but in addition to that I need to group the businesses by state and list the town each business belongs to. I've asked other questions related to this before. This time I am actively trying to use Eager Loading to load each related town for each business. From there I'm hoping to pull out the state each business belongs to (this needs to be daisy chained, however, from business-&gt;town-&gt;county-&gt;region-&gt;state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below results in the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CException&lt;/strong&gt;&lt;br&gt;&#xA;&lt;em&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;N&quot;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% block entry_content %}&#xA;        {%&#xA;            set businesses = craft.entries.section('businesses').relatedTo(category).find({&#xA;                with: ['bizTown']&#xA;            })&#xA;        %}&#xA;&#xA;        {% set state = entry.bizTown.first.townCounty.first.countyRegion.first.regionState.first ?? 'N/A' %}&#xA;&#xA;        {% set businessesByState = businesses|group(state) %}&#xA;&#xA;        &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;&#xA;                &amp;lt;p&amp;gt;Businesses with video stories will have the video icon &amp;lt;i class=&quot;fa fa-video-camera&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt; in front of their names.&amp;lt;/p&amp;gt;&#xA;&#xA;                {% if businesses|length %}&#xA;                    {% for state, businessesInState in businessesByState %}&#xA;                        &amp;lt;ul class=&quot;three-col-list&quot;&amp;gt;&#xA;                            &amp;lt;h3&amp;gt;{{state}}&amp;lt;/h3&amp;gt;&#xA;                            &amp;lt;ul&amp;gt;&#xA;                                {% for business in businessesInState %}&#xA;                                    &amp;lt;li class=&quot;business-cat__item&quot;&amp;gt;&#xA;                                        {% if business.ytVideoId|length %}&#xA;                                            &amp;lt;i class=&quot;fa fa-video-camera&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                                        {% endif %}&#xA;                                        &amp;lt;strong&amp;gt;{{ business.link }}&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&#xA;                                        {% set twn = business.bizTown.first %}&#xA;                                        &amp;lt;a class=&quot;business-cat__item--town&quot; href=&quot;{{twn.url}}&quot;&amp;gt;{{twn.title}}&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;/li&amp;gt;&#xA;                                {% endfor %}&#xA;                            &amp;lt;/ul&amp;gt;&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    {% endfor %}&#xA;                {% else %}&#xA;&#xA;                    &amp;lt;p&amp;gt;We apologize, we appear to be experiencing some technical difficulties…&amp;lt;/p&amp;gt;&#xA;&#xA;                {% endif %}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    {% endblock entry_content %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's got to be something simple I'm overlooking, or I could be approaching my problem all wrong. I feel out of my element and could use some advice/wisdom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="5471" LastEditDate="2017-08-01T18:40:42.683" LastActivityDate="2017-08-01T18:40:42.683" Title="Getting &quot;do not have method or closure named&quot; error when trying to eager load" Tags="&lt;entrymodel&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21407" PostTypeId="2" ParentId="2753" CreationDate="2017-08-01T16:50:05.520" Score="1" Body="&lt;p&gt;You can simply just add the google analytics script that it gives you in the _layout.html base file or the google tag manager scripts if you want to add other tracking code as well as google analytics.&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-08-01T16:50:05.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21408" PostTypeId="2" ParentId="21401" CreationDate="2017-08-01T17:23:21.857" Score="1" Body="&lt;p&gt;You'd do it from the Calendar's field layout page (&lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendars/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/docs/calendars/&lt;/a&gt;), just like Craft entries, users, categories, etc.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-01T17:23:21.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21409" PostTypeId="2" ParentId="21404" CreationDate="2017-08-01T17:30:27.023" Score="2" Body="&lt;p&gt;You'll want to use &lt;code&gt;block.icon.first()&lt;/code&gt; if you just want the first Asset, or you could loop through all Assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.visitorContentBuilder %}&#xA;&#xA;    {% if block.type == &quot;listItemWithIcon&quot; %}&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for icon in block.icon %}&#xA;                &amp;lt;li&amp;gt;{{ icon }}&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements&quot;&gt;here&lt;/a&gt; for a description of the difference between an ElementCriteriaModel and actual fetched elements in Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-01T17:30:27.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21410" PostTypeId="2" ParentId="21387" CreationDate="2017-08-01T18:13:14.717" Score="0" Body="&lt;p&gt;Yeah, I agree it's a bit awkward UI-wise in this scenario, but that's currently expected behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd probably be able to pull off what you're looking for with a custom plugin by listening to the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getEntryTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;getEntryTableAttributeHtml&lt;/a&gt; hook, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In there, you'd check if the passed in attribute is the one for your entries field type, grab the current status and modify the HTML that gets returned based on the status.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-01T18:13:14.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21411" PostTypeId="2" ParentId="20034" CreationDate="2017-08-01T18:34:47.010" Score="1" Body="&lt;p&gt;I put together an example adjuster that checks for a shipping address in Switzerland or the EU, and then applies the 8% or 19% adjustment to the order's item subtotal. It does not include shipping in the tax amount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would still need to register this via a plugin, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19754/getting-started-with-order-adjuster-plugin&quot;&gt;see this thread for an example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;&#xA;    namespace Commerce\Adjusters;&#xA;&#xA;    use Craft\Commerce_OrderAdjustmentModel;&#xA;    use Craft\Commerce_OrderModel;&#xA;&#xA;    class MyAdjuster implements Commerce_AdjusterInterface {&#xA;&#xA;      public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;        $euCountries = array(&#xA;        'AT', 'BE', 'HR', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE',&#xA;        'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB'&#xA;        );&#xA;&#xA;        if($order-&amp;gt;shippingMethodHandle !== NULL &amp;amp;&amp;amp; sizeof($order-&amp;gt;lineItems) &amp;gt; 0)&#xA;        {&#xA;&#xA;          $countryCode = $order-&amp;gt;shippingAddress-&amp;gt;getCountry()-&amp;gt;iso;&#xA;&#xA;          if(in_array($countryCode, $euCountries))&#xA;          {&#xA;            // Country is in EU&#xA;            $salesTax = $order-&amp;gt;itemSubtotal * 0.19;&#xA;          }&#xA;          else if ( $countryCode == &quot;CH&quot; )&#xA;          {&#xA;            // Country is Switzerland&#xA;            $salesTax = $order-&amp;gt;itemSubtotal * 0.08;&#xA;          }&#xA;          else&#xA;          {&#xA;            return [];&#xA;          }&#xA;&#xA;          $order-&amp;gt;baseTax = $order-&amp;gt;baseTax + $salesTax;&#xA;&#xA;          $taxAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;          $taxAdjuster-&amp;gt;type = &quot;Tax&quot;;&#xA;          $taxAdjuster-&amp;gt;name = &quot;Sales Tax&quot;;&#xA;          $taxAdjuster-&amp;gt;description = &quot;Adds &quot;+$salesTax+&quot; of tax to the order&quot;;&#xA;          $taxAdjuster-&amp;gt;amount = +$salesTax;&#xA;          $taxAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;          // If your Adjuster affects lineItems rather than the total, you record the ids here&#xA;          $taxAdjuster-&amp;gt;optionsJson = [ 'lineItemsAffected' =&amp;gt; null ];&#xA;          $taxAdjuster-&amp;gt;included = false;&#xA;&#xA;          return [$taxAdjuster];&#xA;        } else {&#xA;          return [];&#xA;        };&#xA;      }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7074" LastActivityDate="2017-08-01T18:34:47.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21412" PostTypeId="2" ParentId="21405" CreationDate="2017-08-01T19:28:06.637" Score="2" Body="&lt;p&gt;Not sure if this is the best way to do it, but I created this little function in a Variable class.  I get all the necessary info (username and score) in an array.  Works fine for what I needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function leaderboard(ElementCriteriaModel $criteria)&#xA;   {&#xA;       $query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&#xA;   if ($query)&#xA;   {&#xA;      $query&#xA;          -&amp;gt;select(&quot;authorId, SUM(field_score) as score, users.username as username&quot;)&#xA;          -&amp;gt;join(&quot;users&quot;, &quot;users.id = authorId&quot; )&#xA;          -&amp;gt;group(&quot;authorId&quot;)&#xA;          -&amp;gt;order(&quot;score DESC&quot;);&#xA;&#xA;               return $query-&amp;gt;queryAll();&#xA;       }&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7065" LastActivityDate="2017-08-01T19:28:06.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21413" PostTypeId="1" CreationDate="2017-08-01T20:39:53.797" Score="0" ViewCount="164" Body="&lt;p&gt;I've just upgraded to the latest version of Craft on a site that uses the Guest Entries plugin. While it was fine before hand, I'm now running into the titled issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone run into this before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the entry form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;hard&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.url }}?registrationSuccess&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;16&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;postDate&quot; value=&quot;{{ now|date(&quot;Y-m-j H:i:s&quot;) }}&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[event][]&quot; value=&quot;{{ relatedEvent.first.id }}&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; value=&quot;Registration for {{ relatedEvent.first.title }} | Event ID {{ relatedEvent.first.id }} on {{ now|date(&quot;Y-m-j H:i:s&quot;) }}&quot;&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;firstName&quot;&amp;gt;Parent first name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; required placeholder=&quot;John&quot; type=&quot;text&quot; name=&quot;fields[firstName]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;lastName&quot;&amp;gt;Parent last name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;lastName&quot; required placeholder=&quot;Doe&quot; type=&quot;text&quot; name=&quot;fields[lastName]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Your email &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; required placeholder=&quot;me@harvestglasgow.org&quot; type=&quot;email&quot; name=&quot;fields[email]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;streetAddress&quot;&amp;gt;Street address &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;streetAddress&quot; required placeholder=&quot;29 Acacia Road&quot; type=&quot;text&quot; name=&quot;fields[streetAddress]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;town&quot;&amp;gt;Town &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;town&quot; required placeholder=&quot;Glasgow&quot; type=&quot;text&quot; name=&quot;fields[town]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;postcode&quot;&amp;gt;Postcode &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;postcode&quot; required placeholder=&quot;G72 1JP&quot; type=&quot;text&quot; name=&quot;fields[postcode]&quot;&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;phone&quot;&amp;gt;Your phone &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;phone&quot; placeholder=&quot;07766123456&quot; type=&quot;tel&quot; name=&quot;fields[phone]&quot; required&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;emergencyContactName&quot;&amp;gt;First emergency contact name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;emergencyContactName&quot; placeholder=&quot;&quot; type=&quot;text&quot; name=&quot;fields[emergencyContactName]&quot; required&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;emergencyContactNumber&quot;&amp;gt;First emergency contact phone &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;emergencyContactNumber&quot; placeholder=&quot;07766505050&quot; type=&quot;tel&quot; name=&quot;fields[emergencyContactNumber]&quot; required&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;emergencyContactName2&quot;&amp;gt;Second emergency contact name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;emergencyContactName2&quot; placeholder=&quot;&quot; type=&quot;text&quot; name=&quot;fields[emergencyContactName2]&quot; required&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;emergencyContactNumber2&quot;&amp;gt;Second emergency contact phone &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;emergencyContactNumber2&quot; placeholder=&quot;07766505050&quot; type=&quot;tel&quot; name=&quot;fields[emergencyContactNumber2]&quot; required&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;eventKids&quot;&amp;gt;How many kids are you registering? &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;number&quot; placeholder=&quot;1&quot; id=&quot;eventKids&quot; name=&quot;fields[eventKids]&quot; required&amp;gt;&amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;friends&quot;&amp;gt;Other friends attending&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea name=&quot;fields[friends]&quot; placeholder=&quot;if your kid has any friends attending holiday club, let us know and we'll try group them together&quot; id=&quot;friends&quot; cols=&quot;30&quot; rows=&quot;10&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;specialRequirements&quot;&amp;gt;Any special requirements?&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea name=&quot;fields[specialRequirements]&quot; placeholder=&quot;if there's any dietary requirements or other needs that we should know about, please let us know&quot; id=&quot;specialRequirements&quot; cols=&quot;30&quot; rows=&quot;10&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;p&amp;gt;&amp;lt;label&amp;gt;Add your kid's information&amp;lt;/label&amp;gt;&#xA;      &amp;lt;/p&amp;gt;&#xA;      &amp;lt;table class=&quot;table table-bordered table-hover&quot; id=&quot;tab_logic&quot;&amp;gt;&#xA;        &amp;lt;thead&amp;gt;&#xA;          &amp;lt;tr&amp;gt;&#xA;            &amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&#xA;            &amp;lt;th&amp;gt;Age&amp;lt;/th&amp;gt;&#xA;            &amp;lt;th&amp;gt;DoB&amp;lt;/th&amp;gt;&#xA;            &amp;lt;th&amp;gt;School Year @ May 2017&amp;lt;/th&amp;gt;&#xA;          &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;/thead&amp;gt;&#xA;        &amp;lt;tbody&amp;gt;&#xA;        &amp;lt;tr id='addr0'&amp;gt;&#xA;          &amp;lt;td width=&quot;30%&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[kidsInformation][0][col1]&quot; placeholder=&quot;Name&quot;&amp;gt;&#xA;          &amp;lt;/td&amp;gt;&#xA;          &amp;lt;td width=&quot;13%&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;number&quot; min=&quot;4&quot; max=&quot;12&quot; name=&quot;fields[kidsInformation][0][col2]&quot; placeholder=&quot;7&quot;&amp;gt;&#xA;          &amp;lt;/td&amp;gt;&#xA;          &amp;lt;td width=&quot;20%&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;date&quot; name=&quot;fields[kidsInformation][0][col3]&quot; placeholder=&quot;22/03/2008&quot;&amp;gt;&#xA;          &amp;lt;/td&amp;gt;&#xA;          &amp;lt;td width=&quot;25%&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;fields[kidsInformation][0][col4]&quot; placeholder=&quot;P4&quot;&amp;gt;&#xA;          &amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;&#xA;        &amp;lt;tr id='addr1'&amp;gt;&amp;lt;/tr&amp;gt;&#xA;        &amp;lt;/tbody&amp;gt;&#xA;      &amp;lt;/table&amp;gt;&#xA;&#xA;      &amp;lt;a id=&quot;add_row&quot; class=&quot;btn btn-default pull-left  btn--small&quot;&amp;gt;Add Kid&amp;lt;/a&amp;gt;&amp;lt;a id='delete_row' class=&quot;pull-right btn btn-default btn--small&quot;&amp;gt;Remove Kid&amp;lt;/a&amp;gt;&#xA;&#xA;      &amp;lt;p&amp;gt;&#xA;        &amp;lt;label for=&quot;photographPermission&quot;&amp;gt;I give permission for my kid to be photographed and understand that photos may be used for future Harvest Glasgow event promotions. We will also make photographs available for parents to download from our website&amp;lt;/label&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;radio&quot; name=&quot;fields[photoPermission]&quot; value=&quot;Yes&quot; checked&amp;gt; Yes, I'm happy with that&amp;lt;br&amp;gt;&#xA;        &amp;lt;input type=&quot;radio&quot; name=&quot;fields[photoPermission]&quot; value=&quot;No&quot;&amp;gt; No, I don't want any pictures of my kid taken&#xA;      &amp;lt;/p&amp;gt;&#xA;&#xA;      &amp;lt;button id=&quot;submit&quot; type=&quot;submit&quot; class=&quot;ready submit&quot;&amp;gt;Register&amp;lt;/button&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-08-01T20:39:53.797" Title="CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'targetId' at row 1" Tags="&lt;guest-entries&gt;&lt;plugin-guestentries&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21414" PostTypeId="2" ParentId="21401" CreationDate="2017-08-02T04:15:37.310" Score="1" Body="&lt;p&gt;If you're referring to adding extra fields to what a calendar itself contains (for displaying additional content with &lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Calendar object&lt;/a&gt;), then that currently is not possible. Only the built in options are available.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-08-02T04:15:37.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21415" PostTypeId="1" CreationDate="2017-08-02T07:06:45.390" Score="1" ViewCount="154" Body="&lt;p&gt;I've potentially have had some messages not come through to email. I've seen the user has reached my thank you page but I don't always receive a message. Are these stored anywhere in the Database to check?&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2017-08-03T05:32:19.830" LastActivityDate="2017-08-03T05:32:19.830" Title="Checking submission from the Contact Form plugin" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21416" PostTypeId="1" CreationDate="2017-08-02T08:40:01.070" Score="2" ViewCount="374" Body="&lt;p&gt;I'm trying to modify a field on an entry before it is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is use a field from a linked entry to populate the same field on the entry being saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From logging I know the event is triggered, and that I can access the &lt;code&gt;seo&lt;/code&gt; variable on the linked element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: The field I'm trying to copy the content from is the SEO field supplied by the sprout SEO plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I try to set the field on the main entry with the content from the linked one, I get the following message&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\EntryModel.seo&quot; is not defined.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So my question is, how can I correctly set the &lt;code&gt;seo&lt;/code&gt; field on the entry being saved? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Below you can see the code currently in my plugins &lt;code&gt;init&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if($entry-&amp;gt;type['handle'] === 'service'){&#xA;        $serviceContent = $entry-&amp;gt;linkToService-&amp;gt;first();&#xA;        $event-&amp;gt;params['entry']-&amp;gt;seo = $serviceContent-&amp;gt;seo;&#xA;&#xA;        // Tried this aswell, gives second error mentioned below&#xA;        $entry-&amp;gt;getContent()-&amp;gt;seo = $serviceContent-&amp;gt;seo;&#xA;    }&#xA; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;After trying the answer provided by @justussimon91, the error message changed to: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\SproutSeo_MetadataModel.metadata&quot; is not defined.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now this might be related to something specific with the Sprout SEO plugin so I'll raise the issue there as well.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-08-02T11:16:01.627" LastActivityDate="2017-08-10T20:10:09.740" Title="Modifying entry with 'onBeforeSaveEntry' event" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;plugin-sproutseo&gt;&lt;onsaveentry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21417" PostTypeId="2" ParentId="21415" CreationDate="2017-08-02T08:59:29.377" Score="1" Body="&lt;p&gt;Based on that code I see on github (I'm assuming you're referring to &lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this plugin&lt;/a&gt;) I'm afraid they're not saved to the database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However craft logs each mail succesfully sent with its internal mailer so you could check your log files to see if any are missing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log messages look like &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Successfully sent email with subject: xyz&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That should give you an indication of how many are missing, as for the actual content, there I'm afraid you're out of luck as far as I know. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-02T08:59:29.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21418" PostTypeId="2" ParentId="21416" CreationDate="2017-08-02T09:05:53.713" Score="1" Body="&lt;p&gt;Try setting your &lt;code&gt;seo&lt;/code&gt;-field like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;seo = ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;seo = ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5798" LastActivityDate="2017-08-02T09:05:53.713" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21419" PostTypeId="1" AcceptedAnswerId="21681" CreationDate="2017-08-02T10:10:40.550" Score="1" ViewCount="168" Body="&lt;p&gt;I want to update programatically a plugin's setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{   &#xA;     craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event){&#xA;        // Set InvoiceNumber&#xA;        $newInvoiceNumber = $this-&amp;gt;getSettings()-&amp;gt;currentInvoiceNumber + 1;&#xA;        $myPlugin = craft()-&amp;gt;plugins-&amp;gt;getPlugin( 'Ultraschall' );&#xA;        craft()-&amp;gt;plugins-&amp;gt;savePluginSettings( $myPlugin, &#xA;                                              array('currentInvoiceNumber', $newInvoiceNumber ));&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP warning&#xA;array_key_exists() expects parameter 2 to be array, null given&#xA;/mnt/web209/c2/98/5363898/htdocs/dev.ultraschall-leinwand.de/craft/app/models/BaseModel.php(418)&#xA;&#xA;417  // Is this the first time this extra attribute has been set?&#xA;418  else if (!array_key_exists($name, $this-&amp;gt;_extraAttributeNames))&#xA;419  {&#xA;420     $this-&amp;gt;_extraAttributeNames[] = $name;&#xA;421  }&#xA;422 &#xA;423  $this-&amp;gt;_attributes[$name] = $value;&#xA;424  return true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have added defineSettings() and getSettingsHtml() to the Plugin and can change values via CP without problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I get this error?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2017-08-23T17:35:35.910" Title="Error updating programmatically a plugin's setting" Tags="&lt;plugin-craftcommerce&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21420" PostTypeId="2" ParentId="21381" CreationDate="2017-08-02T10:29:58.320" Score="1" Body="&lt;p&gt;I finally found a solution of my problem that makes the A&amp;amp;M Nav plugin the perfect choice for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general problem is that amnav offers this function to fetch the activenode id:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set activeNodeId = craft.amNav.getActiveNodeIdForLevel('mainmenu',1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't help because:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the level1 (last parameter) is related to the structure in craft, not in the plugin. In my case the child of a menuitem is not necessarly a child in craft (e.g. a single content). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means, this function doesn't help me to get the children of a parent that has active children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code works to get the active menu item of the first level in the A&amp;amp;M Nav structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# for first level #}&#xA;{% set activeNodeId = craft.amNav.getActiveNodeIdForLevel('mainmenu',1) %}&#xA;&#xA;{# for second level #}&#xA;{% set nav = craft.amNav.getNavRaw(&quot;mainmenu&quot;) %}&#xA;&#xA;{% for item in nav %}&#xA;    {% if item.hasActiveChild or item.active %}&#xA;        {% set activeNodeId = item.id %}&#xA;        {% set activeNode = item %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-09-01T18:24:34.210" LastActivityDate="2017-09-01T18:24:34.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21421" PostTypeId="1" AcceptedAnswerId="21430" CreationDate="2017-08-02T10:55:37.830" Score="1" ViewCount="198" Body="&lt;p&gt;I need to get the content of a field in the Matrix of the English localization in my template. I already have the handle of that field for the current language, but I don't know how to get the English version for that field...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this for getting a field of a Matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.sections.getSectionByHandle('news').getEntryTypes()[0].getFieldLayout().getFields() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that works of course again only for the field in the current localization... which I already have.&lt;/p&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-08-03T06:29:43.117" LastActivityDate="2017-08-03T06:29:43.117" Title="Get field of a Matrix in certain locale" Tags="&lt;matrix&gt;&lt;localization&gt;&lt;field&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21422" PostTypeId="2" ParentId="21421" CreationDate="2017-08-02T11:07:36.020" Score="2" Body="&lt;p&gt;You should be able to set the desired locale by adding &lt;code&gt;.locale('en')&lt;/code&gt; to your code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.sections.getSectionByHandle('news').getEntryTypes()[0].locale('en').getFieldLayout().getFields() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming you've got &lt;code&gt;english&lt;/code&gt; defined as &lt;code&gt;en&lt;/code&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-02T11:07:36.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21423" PostTypeId="2" ParentId="21421" CreationDate="2017-08-02T11:17:13.173" Score="1" Body="&lt;p&gt;thanks Michael, that brings me further.&#xA;This already works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{craft.entries.id(entry.id).locale('en').first().myMatrix[blockCount].myFieldinsideMatrix }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I dont know what to fill in for &quot;blockCount&quot;. That leads me to a more general question: &#xA;A field inside an entry of a local is always linked to the same field in another local. But the fields inside Matrixes seem not, because I can create completely different blocks for each local.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That meens what I am trying to do is not possible, right?&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-08-02T11:17:13.173" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21424" PostTypeId="1" CreationDate="2017-08-02T11:29:18.847" Score="1" ViewCount="457" Body="&lt;p&gt;I am writing a plugin function that takes an entry id, the entry has a matrix field (called block) and the matrix has a blocktype which contains a number field (blockStep), an entries field (blockContent) and another entries field (blockDependency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the entry, which i am calling a module, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$module = craft()-&amp;gt;entries-&amp;gt;getEntryById($moduleid);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine. Then I get the matrix field, called block, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixBlocks = $module-&amp;gt;block;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This also works fine. However, when I try to loop through the matrix field, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    foreach ($matrixBlocks as $block){&#xA;      var_dump( $block-&amp;gt;getContent()-&amp;gt;blockStep);&#xA;      var_dump( $block-&amp;gt;getContent()-&amp;gt;blockContent);&#xA;      var_dump( $block-&amp;gt;getContent()-&amp;gt;blockDependency);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only the blockStep, which is a number, is set - the two entries fields are just returning &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help? How should I be accessing these entries fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastEditorUserId="6916" LastEditDate="2017-08-02T12:54:46.613" LastActivityDate="2017-08-03T06:23:21.317" Title="Accessing entries in a matrix field in plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21425" PostTypeId="2" ParentId="15630" CreationDate="2017-08-02T12:51:52.090" Score="1" Body="&lt;p&gt;Shameless plug: We've written a plugin that automatically updates your email settings depending on your environment. It's not free, but it is cheap :-) Please &lt;a href=&quot;http://red-robot.co.uk/our-work/email-settings-craft-cms-plug-in&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out&lt;/a&gt; the page on our website for more information. &lt;/p&gt;&#xA;" OwnerUserId="5304" LastActivityDate="2017-08-02T12:51:52.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21426" PostTypeId="2" ParentId="9550" CreationDate="2017-08-02T12:52:09.577" Score="1" Body="&lt;p&gt;Shameless plug: We've written a plugin that automatically updates your email settings depending on your environment. It's not free, but it is cheap :-) Please &lt;a href=&quot;http://red-robot.co.uk/our-work/email-settings-craft-cms-plug-in&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out&lt;/a&gt; the page on our website for more information. &lt;/p&gt;&#xA;" OwnerUserId="5304" LastActivityDate="2017-08-02T12:52:09.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21427" PostTypeId="2" ParentId="21424" CreationDate="2017-08-02T14:30:28.477" Score="2" Body="&lt;p&gt;I think I've figured out how to do this now (mainly through trial and error).&#xA;The code above should actually be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($matrixBlocks as $block) {&#xA;&#xA;    foreach ($block-&amp;gt;blockContent as $blockContent) {&#xA;        ....&#xA;    }&#xA;    foreach ($block-&amp;gt;blockDependency as $blockDependency){&#xA;        ....&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the the &lt;code&gt;$blockContent&lt;/code&gt; and &lt;code&gt;$blockDependency&lt;/code&gt; variables will contain the entries required.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastEditorUserId="57" LastEditDate="2017-08-03T06:23:21.317" LastActivityDate="2017-08-03T06:23:21.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21428" PostTypeId="1" CreationDate="2017-08-02T14:49:12.377" Score="2" ViewCount="407" Body="&lt;p&gt;A while ago I asked how to check &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10632/how-can-i-check-if-a-plugin-is-installed-and-enabled&quot;&gt;if a plugin is enabled/installed&lt;/a&gt;. I've since used a couple methods to do my checks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plugin = craft.plugins.getPlugin('myPlugin', false) %}&#xA;&#xA;{{ plugin.isEnabled() ? 'plugin enabled' : 'plugin disabled'}} &amp;lt;br/&amp;gt;&#xA;{{ plugin.isInstalled() ? 'plugin installed' : 'plugin not installed'}} &amp;lt;br/&amp;gt;&#xA;&#xA;{{ craft.myPlugin is defined ? 'plugin true' : 'plugin false' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11899/is-there-a-fallback-when-a-twig-extension-is-not-enabled&quot;&gt;recall this working with Twig Extension functions and filters too&lt;/a&gt;. It wasn't pretty, but it worked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may wrong, but I think one of the Craft CMS Updates have broken this. Because as-of-late, when I do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin is defined ? myFunction() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin is defined ? someVariable|myFilter() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(myFunction being a twig function, and myFilter being a twig filter)... I get an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unknown &quot;myFunction&quot; function&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Another new &lt;em&gt;change/bug&lt;/em&gt; I've noticed (related to this); if a database can't be connected to and devMode is off, I will get this instead of the 503 error template. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unknown &quot;myFunction&quot; function in &quot;_layouts/main&quot; at line 85.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's as if the Twig functions/filters get priority over anything else. Am I making this up, and this has always been the case? Or has something changed?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="57" LastEditDate="2017-08-03T19:25:46.993" LastActivityDate="2018-05-09T21:49:53.747" Title="Checking if a plugin is installed or enabled are ignored by Twig Extensions" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21429" PostTypeId="2" ParentId="21384" CreationDate="2017-08-02T15:24:21.783" Score="1" Body="&lt;p&gt;Shame on me, but maybe still interesting to others who have this problem: I'm using vagrant and the path of my extension was NOT mounted to the vagrant box. That's all. So it simply could not find the files. Maybe a warning by craft would be nice, that it can not load the plugin files&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I do not understand, why it found the composer.json to read the basic information, which showed up in the Plugins section of Craft... &lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="6886" LastEditDate="2017-08-02T16:08:54.910" LastActivityDate="2017-08-02T16:08:54.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21430" PostTypeId="2" ParentId="21421" CreationDate="2017-08-02T16:26:16.400" Score="1" Body="&lt;p&gt;Here we go, the final answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blockHeadingEnglish = craft.entries.id(entry.id).locale('en').first().myMatrix.id(block.id).first().myFiel %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-08-02T16:26:16.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21431" PostTypeId="2" ParentId="19772" CreationDate="2017-08-02T20:35:44.900" Score="3" Body="&lt;p&gt;Shameless plug: We've written a plugin that automatically updates your email settings depending on your environment. It's not free, but it is cheap :-) Please &lt;a href=&quot;http://red-robot.co.uk/our-work/email-settings-craft-cms-plug-in&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out&lt;/a&gt; the page on our website for more information. &lt;/p&gt;&#xA;" OwnerUserId="5304" LastActivityDate="2017-08-02T20:35:44.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21432" PostTypeId="1" AcceptedAnswerId="21435" CreationDate="2017-08-02T22:19:56.350" Score="1" ViewCount="162" Body="&lt;p&gt;I'm working through the integration of a new Authorize.net gateway and bumping into errors trying to successfully process payments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I view / output the response that's coming back from Authorize.net after the failed transactions in my template for debugging purposes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I spit out &lt;code&gt;{{ dump(paymentForm) }}&lt;/code&gt;, but I'm not seeing anything especially insightful.&lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2017-08-03T05:12:25.007" Title="How do I view / output the gateway response message?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21433" PostTypeId="1" AcceptedAnswerId="21448" CreationDate="2017-08-02T23:37:31.517" Score="1" ViewCount="472" Body="&lt;p&gt;I'm running into some trouble using the &quot;hash&quot; filter in Craft's first-party Contact Form plugin. The docs suggest using it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ 'contact/thanks?from={fromName}'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On my development site, this is redirecting an otherwise-successful form to &lt;code&gt;domain.com/hash_valuecontact/thanks?from=name&lt;/code&gt;, and therefore a 404 page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the value to &lt;code&gt;'/contact/thanks?from{fromName}'|hash&lt;/code&gt; results in a more proper URL (&lt;code&gt;domain.com/hash_value/contact/thanks?from=name&lt;/code&gt;) but still a 404. The docs suggest the hash is prepended to the value so the URL is expected but I'm not sure how the hash is decoded. And since the name is sent via the query string, I'm not sure what the hash is really doing in the first place, or why it's important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question—is the hash actually important in this context, and if so how is it implemented? The docs don't contribute much information there. Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="7076" LastActivityDate="2017-08-03T19:38:55.203" Title="How does &quot;hash&quot; work in the context of the Contact Form?" Tags="&lt;plugin-contactform&gt;&lt;hash&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21434" PostTypeId="1" CreationDate="2017-08-03T00:27:55.857" Score="1" ViewCount="701" Body="&lt;p&gt;I’m on a mac running MAMP and my install is functional. Localhost will direct to and display files in “templates” but it wont fully cooperate with subfolders within templates, such as templates/news. From templates/news/_entry.html, I’m able to {% extends &quot;_layout&quot; %} to the _layout.html, but I can’t call up anything via the block. Using {% block content %} is a no go. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m sure it’s a simple fix, but it’s hard to search for an answer when I don’t know where to start. Can anyone help? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached is a screengrab of my templates folder. You might notice from the &quot;brews&quot; folder that I've been following the Mijingo tutorial for Craft CMS. Nonetheless, the default &quot;news&quot; folder also doesn't load the block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iIgoF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iIgoF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7079" LastActivityDate="2017-08-04T15:24:11.283" Title="{% block content %} is a no-go in template/subfolders" Tags="&lt;entry&gt;&lt;installation&gt;&lt;permissions&gt;&lt;mamp&gt;&lt;subfolder&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21435" PostTypeId="2" ParentId="21432" CreationDate="2017-08-03T02:12:50.430" Score="2" Body="&lt;p&gt;Best to do this in your business logic plugin really, rather than in templates I'd say. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You probably don't want to be passing this through to templates generally.  That said, you could easily add a template variable to this approach I guess...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some example code - and note what you get back will vary greatly depending on the gateway, so make sure you use defensive code like &lt;code&gt;array_key_exists&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set an http session var, you can then retrieve this using a template variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Save the Beagle Anti-Fraud Score to the order&#xA;    craft()-&amp;gt;on('commerce_transactions.onSaveTransaction', function ($event){&#xA;&#xA;            $transaction = $event-&amp;gt;params['transaction'];&#xA;            $order = $transaction-&amp;gt;order;&#xA;&#xA;            // Transactions are saved before responses too....&#xA;            if($transaction-&amp;gt;response){&#xA;                craft()-&amp;gt;httpSession-&amp;gt;add(&quot;gatewayResponse&quot;, $transaction-&amp;gt;response);&#xA;                BusinessLogicPlugin::log($transaction-&amp;gt;response);&#xA;&#xA;                //example of saving some of this data to a custom field in the order if you want to hang on to any of it...&#xA;                if (array_key_exists(&quot;BeagleScore&quot;,$transaction-&amp;gt;response)){&#xA;                    $score = (string) $transaction-&amp;gt;response['BeagleScore'];&#xA;                    BusinessLogicPlugin::log($score);&#xA;                    $order-&amp;gt;setContentFromPost([&quot;beagleScore&quot;=&amp;gt;$score]);&#xA;                    BusinessLogicPlugin::log(craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order));&#xA;                }&#xA;            }&#xA;     });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, to set it up as a template variable, something like this will work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class YourPluginVariable&#xA;{&#xA;    public function gatewayResponse() {&#xA;&#xA;        $return = &quot;&quot;;&#xA;        $gatewayResponse = craft()-&amp;gt;httpSession-&amp;gt;get(&quot;gatewayResponse&quot;);&#xA;&#xA;        if($gatewayResponse)&#xA;            $return = $gatewayResponse;&#xA;&#xA;        craft()-&amp;gt;httpSession-&amp;gt;remove(&quot;gatewayResponse&quot;);&#xA;&#xA;        return $return;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2017-08-03T05:12:25.007" LastActivityDate="2017-08-03T05:12:25.007" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21436" PostTypeId="2" ParentId="21432" CreationDate="2017-08-03T04:05:10.640" Score="1" Body="&lt;p&gt;Bonkers. Craft is already logging this info in the &lt;code&gt;commerce.log&lt;/code&gt; file and I somehow managed to miss it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone looking to do something a bit more custom with the data that's coming back from the gateway check out Jeremy Daalder's excellent answer. &lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2017-08-03T04:05:10.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21437" PostTypeId="2" ParentId="21415" CreationDate="2017-08-03T05:31:54.977" Score="0" Body="&lt;p&gt;There is a support article &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that deals with email delivery issues in Craft/PHP and some workarounds to improve the chances of successfully delivering them and tips for debugging the ones that don't make it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-03T05:31:54.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21438" PostTypeId="2" ParentId="21434" CreationDate="2017-08-03T09:41:17.917" Score="1" Body="&lt;p&gt;It's not a server sided issue you are running into. Best guess is that you deleted some of the original code in either the _layout.html or your new template file. When you first setup the environment did the basic Craft site which is set in the standard files show up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you layout.html got the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Aswell or else it doesn't know where to load. Did you also check your entries in the backend if they are set right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be in your entry file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-08-03T09:41:17.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21440" PostTypeId="1" CreationDate="2017-08-03T13:43:01.020" Score="1" ViewCount="569" Body="&lt;p&gt;How can I loop from col2 to col4 ? Or loop by column heading handle?&#xA;Remplace {{ row.&lt;strong&gt;&lt;em&gt;col2&lt;/em&gt;&lt;/strong&gt; }}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;features small-font-size&quot;&amp;gt;&#xA;  {% for row in block.tableHandle %}&#xA;&#xA;      &amp;lt;li data-feature=&quot;{{ row.description }}&quot;&amp;gt;{{ row.col2 }}&amp;lt;/li&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6664" LastEditorUserId="57" LastEditDate="2017-08-03T19:04:16.013" LastActivityDate="2017-09-03T22:29:08.173" Title="Loop by column from a table" Tags="&lt;loop&gt;&lt;table-field&gt;&lt;table&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21442" PostTypeId="1" CreationDate="2017-08-03T14:41:04.740" Score="1" ViewCount="264" Body="&lt;p&gt;I have Craft 2.6.2986 in an AWS EC2 environment. My site looks fine, but in my craft.log, I see a lot of 404 errors. We don't have phpmyadmin2011 or phpmyadmin2012 page. Does anyone know how they get generated? Thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2017/08/03 13:20:18 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /srv/www/vetter_prod/releases/20170731141059/craft/app/controllers/TemplatesController.php:72&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('phpmyadmin2011', Array)&#xA;#1 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /srv/www/vetter_prod/releases/20170731141059/craft/app/etc/web/WebApp.php(291): CWebApplication-&amp;gt;processRequest()&#xA;#9 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /srv/www/vetter_prod/releases/20170731141059/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /srv/www/vetter_prod/releases/20170731141059/public/index.php(19): require_once('/srv/www/vetter...')&#xA;#12 {main}&#xA;REQUEST_URI=/phpmyadmin2011/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2017/08/03 13:20:19 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /srv/www/vetter_prod/releases/20170731141059/craft/app/controllers/TemplatesController.php:72&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('phpmyadmin2012', Array)&#xA;#1 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /srv/www/vetter_prod/releases/20170731141059/craft/app/etc/web/WebApp.php(291): CWebApplication-&amp;gt;processRequest()&#xA;#9 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /srv/www/vetter_prod/releases/20170731141059/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /srv/www/vetter_prod/releases/20170731141059/public/index.php(19): require_once('/srv/www/vetter...')&#xA;#12 {main}&#xA;REQUEST_URI=/phpmyadmin2012/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;2017/08/03 13:20:20 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /srv/www/vetter_prod/releases/20170731141059/craft/app/controllers/TemplatesController.php:72&#xA;Stack trace:&#xA;#0 [internal function]: Craft\TemplatesController-&amp;gt;actionRender('phpmyadmin2013', Array)&#xA;#1 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\TemplatesController), Array)&#xA;#2 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)&#xA;#3 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('render')&#xA;#7 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#8 /srv/www/vetter_prod/releases/20170731141059/craft/app/etc/web/WebApp.php(291): CWebApplication-&amp;gt;processRequest()&#xA;#9 /srv/www/vetter_prod/releases/20170731141059/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /srv/www/vetter_prod/releases/20170731141059/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#11 /srv/www/vetter_prod/releases/20170731141059/public/index.php(19): require_once('/srv/www/vetter...')&#xA;#12 {main}&#xA;REQUEST_URI=/phpmyadmin2013/&#xA;---&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2017-08-03T19:08:25.643" LastActivityDate="2017-08-03T19:08:25.643" Title="See 404 error cause by some weird URI in index.php" Tags="&lt;error&gt;&lt;404&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21443" PostTypeId="2" ParentId="21442" CreationDate="2017-08-03T15:00:41.027" Score="3" Body="&lt;p&gt;These are very likely bots that are scanning the website for various things (I see it for WordPress logins a ton). Two things you can do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Redirect them. This is what I do for &lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L50&quot; rel=&quot;nofollow noreferrer&quot;&gt;WordPress bots&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Install the &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retour plugin&lt;/a&gt; to get a better overview of what 404 errors happen on your site.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-03T15:00:41.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21445" PostTypeId="1" CreationDate="2017-08-03T17:35:44.010" Score="1" ViewCount="64" Body="&lt;p&gt;I am trying to number Form submissions using an incrementing number that would display in Email Notifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/boboldehampsink/increment&quot; rel=&quot;nofollow noreferrer&quot;&gt;Increment Plugin&lt;/a&gt; Field produces an incrementing number and would be ideal but it doesn't work because Freeform uses its own field type set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to generate and associate a unique number per form entry that could then be displayed?&lt;/p&gt;&#xA;" OwnerUserId="5868" LastActivityDate="2017-08-05T22:13:51.870" Title="What is the best way to number form entries in Freeform?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21446" PostTypeId="2" ParentId="21440" CreationDate="2017-08-03T19:03:55.907" Score="0" Body="&lt;p&gt;I'm not 100% sure I'm following the question, but if you just want to output every &lt;code&gt;col2&lt;/code&gt; and &lt;code&gt;col4&lt;/code&gt; row value, it'd be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for row in block.tableHandle %}&#xA;        &amp;lt;li data-feature=&quot;{{ row.description }}&quot;&amp;gt;{{ row.col2 }} - {{ row.col4 }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There isn't a native way to loop directly by a column's handle.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-08-04T19:48:35.970" LastActivityDate="2017-08-04T19:48:35.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21447" PostTypeId="2" ParentId="21428" CreationDate="2017-08-03T19:31:34.977" Score="2" Body="&lt;p&gt;I just a test of this locally in a sample plugin and I get expected behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I install and enable the plugin in Craft and use this in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plugin = craft.plugins.getPlugin('myPlugin', false) %}&#xA;&#xA;{{ plugin.isEnabled() ? 'plugin enabled' : 'plugin disabled'}}&amp;lt;br/&amp;gt;&#xA;{{ plugin.isInstalled() ? 'plugin installed' : 'plugin not installed'}}&amp;lt;br/&amp;gt;&#xA;&#xA;{{ craft.myPlugin is defined ? 'plugin true' : 'plugin false' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get this output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugin enabled &#xA;plugin installed &#xA;plugin true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I add a Twig Extension class to the plugin, then register a &lt;code&gt;myPluginTestFunction&lt;/code&gt; function that outputs &quot;It Works&quot;... i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFunctions()&#xA;{&#xA;    return array(&#xA;        'myPluginTestFunction' =&amp;gt; new Twig_Filter_Method($this, 'myPluginTestFunction', array('is_safe' =&amp;gt; array('html'))),&#xA;    );&#xA;}&#xA;&#xA;public function myPluginTestFunction()&#xA;{&#xA;    return 'It Works';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I do this is a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin is defined ? myPluginTestFunction() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get the expected output of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;It Works&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-03T19:31:34.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21448" PostTypeId="2" ParentId="21433" CreationDate="2017-08-03T19:38:55.203" Score="1" Body="&lt;p&gt;In the context of the &lt;a href=&quot;https://github.com/craftcms/contact-form/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form&lt;/a&gt; plugin, the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#hash&quot; rel=&quot;nofollow noreferrer&quot;&gt;|hash&lt;/a&gt; filter is only necessary if you want to &lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamically add recipients&lt;/a&gt; to the submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is there to ensure that data isn't tampered with between the time it is submitted and the time that it hits Craft.  Contact Form cares about this so malicious people/scripts don't turn your Craft install into an email SPAM relay machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like you're using it on the hidden &lt;code&gt;redirect&lt;/code&gt; parameter... it's completely unnecessary there, so you can remove it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-03T19:38:55.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21449" PostTypeId="1" CreationDate="2017-08-03T21:09:24.950" Score="1" ViewCount="93" Body="&lt;p&gt;Let’s say my form contains a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; element named &lt;code&gt;inquery_type&lt;/code&gt; with the following options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;General Inquiry&lt;/li&gt;&#xA;&lt;li&gt;Reservations&lt;/li&gt;&#xA;&lt;li&gt;Other&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And let's say that I want to automatically send an email notification &lt;em&gt;only&lt;/em&gt; if the form is submitted with an &lt;code&gt;inquiry_type&lt;/code&gt; value of &lt;code&gt;Reservations&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible. And if so, how would I handle this?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2017-08-03T21:09:24.950" Title="Dynamic email notifications based on submitted form values in Solspace Freeform" Tags="&lt;plugin-freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21451" PostTypeId="2" ParentId="21434" CreationDate="2017-08-04T15:24:11.283" Score="2" Body="&lt;p&gt;In this case, it was just human error and ignorance of how hidden template files work through the CMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believed that I should be able to call the hidden file in the browser, via something like &quot;base_url/subfolder/_hiddenfile.html&quot; and partially I was able. For whatever reason, using this primitive test method, I was able to see the header and footer, but not the block content, in the browser window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact is, what I was doing was not a viable test. I don't understand why, but that doesn't matter. &lt;/p&gt;&#xA;" OwnerUserId="7079" LastActivityDate="2017-08-04T15:24:11.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21452" PostTypeId="2" ParentId="19061" CreationDate="2017-08-04T19:07:50.067" Score="1" Body="&lt;p&gt;I have it working with axios. You have to set this header in the config array: 'X-Requested-With': 'XMLHttpRequest' ;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var config = {&#xA;       responseType: 'json',&#xA;       headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded'}&#xA;    };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you look at craft's getIsAjaxRequest()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getIsAjaxRequest()&#xA;{&#xA;    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;amp;&amp;amp; $_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's looking for the X_REQUESTED_WITH header and for it to be set XMLHttpRequest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On top of that you have to tell Axios to send the data as application/x-www-form-urlencoded. &lt;a href=&quot;https://www.npmjs.com/package/axios#using-applicationx-www-form-urlencoded-format&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.npmjs.com/package/axios#using-applicationx-www-form-urlencoded-format&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the URLSearchParams solution.&lt;/p&gt;&#xA;" OwnerUserId="6740" LastEditorUserId="6740" LastEditDate="2017-08-04T23:19:27.197" LastActivityDate="2017-08-04T23:19:27.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21453" PostTypeId="1" AcceptedAnswerId="21454" CreationDate="2017-08-05T11:05:22.430" Score="1" ViewCount="340" Body="&lt;p&gt;I have some questions about events. I want to fire a custom event from another plugin. The event handler is in &lt;strong&gt;MyHelpers_PostService.php&lt;/strong&gt; (plugin A).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onSavePost(Event $event)&#xA;{&#xA;    $this-&amp;gt;raiseEvent('onSavePost', $event);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My init() method (plugin B):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('myHelpers_Post.savePost', function(Event $event)&#xA;    {&#xA;       // delete a cache key &#xA;       craft()-&amp;gt;pluginB-&amp;gt;clearCache('forum-home-desktop');&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my first time working on Craft events, so please bear with me. I tested this by saving a new Helpers Post on the front-end and nothing happens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;clearCache()&lt;/strong&gt; method is just using Craft's &lt;strong&gt;deleteCachesByKey()&lt;/strong&gt;;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is &lt;strong&gt;myHelpers_Post.savePost&lt;/strong&gt; correct?&lt;/li&gt;&#xA;&lt;li&gt;What else do I need to make this work?&lt;/li&gt;&#xA;&lt;li&gt;How do I test this properly? Can I use Craft::dd() inside the handler?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5652" LastEditorUserId="5652" LastEditDate="2017-08-05T11:25:37.970" LastActivityDate="2017-08-05T12:44:35.630" Title="How to fire a custom event from another plugin?" Tags="&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21454" PostTypeId="2" ParentId="21453" CreationDate="2017-08-05T12:44:35.630" Score="1" Body="&lt;p&gt;&lt;strong&gt;myHelpers_Post.savePos&lt;/strong&gt;t was wrong. It should have been &lt;strong&gt;myHelpers_&lt;em&gt;p&lt;/em&gt;ost.savePost&lt;/strong&gt;. It's okay to delete this question.&lt;/p&gt;&#xA;" OwnerUserId="5652" LastActivityDate="2017-08-05T12:44:35.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21455" PostTypeId="1" CreationDate="2017-08-05T17:37:54.280" Score="2" ViewCount="469" Body="&lt;p&gt;I need to allow store managers to edit their store. I'm most of the way there and have the title field and a couple of other plain text fields set up. However there isn't any documentation available for other field types including:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;categories&lt;/li&gt;&#xA;&lt;li&gt;assets&lt;/li&gt;&#xA;&lt;li&gt;lightswitch&lt;/li&gt;&#xA;&lt;li&gt;relationship (entries)&lt;/li&gt;&#xA;&lt;li&gt;Store hours &lt;a href=&quot;https://github.com/craftcms/store-hours/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/store-hours/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; is only includes examples for input and textarea fieldtypes and not any other first party custom fieldtype .&#xA;What is the best approach to being able to edit these field types?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-08-05T22:22:00.963" Title="Front End Editing with Entry From" Tags="&lt;entry&gt;&lt;frontend-form&gt;&lt;editing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21456" PostTypeId="2" ParentId="21445" CreationDate="2017-08-05T22:13:51.870" Score="1" Body="&lt;p&gt;If you want to do this without creating a plugin, a &quot;cheat&quot; way would be to use the entry id of the submitted form - that would guarantee that you have a unique number and, assuming they are being saved to the same section, they would be in sequence.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-08-05T22:13:51.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21457" PostTypeId="2" ParentId="21455" CreationDate="2017-08-05T22:22:00.963" Score="2" Body="&lt;p&gt;There is actually quite a bit of documentation on templating for various field types. Go to the &lt;a href=&quot;https://craftcms.com/docs/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fields section&lt;/a&gt; of the online docs and then select the field you are interested in, e.g. you will find a very comprehensive templating guide for assets &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-08-05T22:22:00.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21460" PostTypeId="2" ParentId="12497" CreationDate="2017-08-07T01:09:32.627" Score="2" Body="&lt;p&gt;Just like &lt;strong&gt;khalwat&lt;/strong&gt; said ^^  If you're using MAMP like me, it is in your MAMP Application file MAMP/bin/php/PHP_version_your_using/conf/&lt;strong&gt;php.ini&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was a combination of upping both &lt;strong&gt;memory_limit&lt;/strong&gt; &amp;amp; &lt;strong&gt;post_max_size&lt;/strong&gt; to 128M&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This did the trick. &#xA;Hope this saves somebody's time.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2017-08-07T01:09:32.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21461" PostTypeId="1" CreationDate="2017-08-07T02:06:28.247" Score="2" ViewCount="321" Body="&lt;p&gt;I'm currently in the process of making a website for a restaurant and using Craft CMS &amp;amp; I'm not sure how to go about making the menu page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a very complete page with a bunch of different categories of food &amp;amp; a bunch of items and pictures for each category. My goal is to have a subnav on the left be Sticky &amp;amp; have them scroll down with anchor links to the corresponding section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still relatively new with Craft CMS and wanted some opinions/tips on what the best and cleanest way of doing this would be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a wireframe so I could show you guys what I'm trying to accomplish.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Have the left Nav with anchor links to the corresponding food section.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the best technique to create those food category sections &amp;amp; put them into the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PXhu2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PXhu2.jpg&quot; alt=&quot;Wireframe example of the menu page, &quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2017-08-07T08:03:38.807" Title="Best Technique for have sections in display in same page with anchor link to each section" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;structure&gt;&lt;navigation&gt;&lt;content&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21464" PostTypeId="2" ParentId="21461" CreationDate="2017-08-07T08:03:38.807" Score="1" Body="&lt;p&gt;What I should do is create a category group whish should be filled with your &quot;Food Categories&quot;. Once you've done that you could display them in your side menu. (If you show the menu on everypage make sure to include it in your _layout.html or as a new block however you like it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your food category section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a Channel for those. Add all the fields you need and put them in there. Don't forget to create a Category field connected to your food categories group. This way you can link an entry to the category it's supposed to go too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you created a couple of entries and connected them to their categories. You can display them in the big section by looping over all the entries in your Food Channel. You can grab the category by looping over the category field you made. This way you can add the coloured banner which belongs to the chosen category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some links for all this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.categories&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/categories-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/categories-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/categories&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS also has a slack community. For more detailed questions you could ask for help there. You can checkout how to join here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/community#slack&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-08-07T08:03:38.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21465" PostTypeId="1" AcceptedAnswerId="21469" CreationDate="2017-08-07T13:47:01.113" Score="2" ViewCount="654" Body="&lt;p&gt;How can I get the details of an asset volume in Craft 3, if I only know the handle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only thing I found was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getVolumes()-&amp;gt;getVolumeById($id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I get the id? I do not want to iterate over &lt;code&gt;getAllVolumes()&lt;/code&gt;... &lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-07T15:41:23.273" Title="Craft 3: How to get Volume by handle?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21466" PostTypeId="1" CreationDate="2017-08-07T14:35:54.233" Score="1" ViewCount="111" Body="&lt;p&gt;Alright, so I am trying to persuade a client to switch to Craft Commerce for their bakery shop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thing is, their current setup is kinda messy, and I just cant figure out how to convert it properly to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case:&lt;/strong&gt;&#xA;They have Cakes, Cakes comes in a multitude of sizes, with a lot of choices. Different types of cakes have different choices (Fill, jelly, nuts, colors, figures etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All possible combinations of the choices results in a unique ID (EAN) for that cake, that the bakery can use in their system for production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats ok, we can have product types and variants for all these. But here is the hard part: each bakery have their own set of choices, some bakeries dont have the same type of jelly, or the same colors for the toppings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each bakery choose what cakes they want to sell, and what kind of configurations they have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When on their front page, you type inn your ZIP code and we use that to determine the closest bakery, based on that, we show that bakery's cakes, with their configurations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there are about 10 bakeries, having a chocolate cake with custom variants per bakery will get really messy really fast, given how many cakes each bakery has. So I am trying to figure out how to separate each bakery and its product in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I toyed with the idea of creating one product type per bakery, and just having a generic &quot;cake&quot; model that can be built up however they like, but this seems very hard for both us and the client, they having to create the same options over and over, and us having to &quot;magically&quot; get all kinds of configurations from some kind of matrix field, creating choices based on this in the frontend, and sending those choices by mail when the order is complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some kind of &quot;hack&quot; where I can have a separate product (database) tables per user group, or something like that? If bakery X logs on the CP, we show products from this table, if bakery Y, we show products form another table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the site is going to be joint, about us, contact, articles etc are all the same across bakeries. So I would like to avoid having 10 licenses, 10 databases and 10 installs to cope with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ideas are greatly appreciated, maybe I am looking at this the wrong way, but having 300 cakes, with 18 variants each is going to make it impossible for a specific bakery to maintain their cakes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathias&lt;/p&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="45" LastEditDate="2017-08-25T21:03:12.960" LastActivityDate="2017-08-26T21:53:24.173" Title="Craft Commerce: Bakery site with multiple bakeries (How to handle product types and variants)" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21467" PostTypeId="2" ParentId="21366" CreationDate="2017-08-07T15:21:11.207" Score="4" Body="&lt;p&gt;I'm an idiot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Settings area, I was expecting the plugin to show up in the Plugin section after uploading. Don't know why, but noticed last night that under the System section, there was a plugin option there. Once I went in there, and actually &lt;strong&gt;installed&lt;/strong&gt; the plugin, it showed up under the Plugins section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;sheesh&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2017-08-07T15:21:11.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21468" PostTypeId="2" ParentId="827" CreationDate="2017-08-07T15:30:38.647" Score="1" Body="&lt;p&gt;for me trying the happylager template I had to change access to to site dir&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;chmod  a+w public/assets/site&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7097" LastActivityDate="2017-08-07T15:30:38.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21469" PostTypeId="2" ParentId="21465" CreationDate="2017-08-07T15:41:23.273" Score="3" Body="&lt;p&gt;As of &lt;a href=&quot;https://github.com/craftcms/cms/commit/7b31701c9a139bb8078563c86a0698d7f68e35a0&quot; rel=&quot;nofollow noreferrer&quot;&gt;this commit&lt;/a&gt;, there is a &lt;code&gt;Craft::$app-&amp;gt;getVolumes()-&amp;gt;getVolumeByHandle($handle)&lt;/code&gt; method you can call.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-07T15:41:23.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21470" PostTypeId="1" AcceptedAnswerId="21478" CreationDate="2017-08-07T15:42:31.593" Score="2" ViewCount="469" Body="&lt;p&gt;I have channel X set up where it's entries have a &quot;users field&quot;, an &quot;entries field&quot; (that are picked from channel Y) and a whole bunch of other data with regards to the how a defined user has interacted with the defined entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst viewing an entry from channel Y I wish to dig into the data kept in channel X, more specifically the entry in channel X that has both the same users field as the currentUser AND the same entries field as the entry viewed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current solution is the following and makes me cringe with the thought of things getting bigger...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fetchedResults = craft.entries.section('channelXhandle').relatedTo(currentUser) %}&#xA;{% for resultEntry in fetchedResults %}&#xA;    {% if resultEntry.member.first().id == currentUser.id %}&#xA;        {# grab the fruit #}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's done the trick up until now, but now I want to find out if there is an entry in channel X that has both the channel Y entry and currentUser defined together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following but it didn't help. It retrieves all the entries as though the relatedTo params are &lt;code&gt;currentUser&lt;/code&gt; or &lt;code&gt;entry&lt;/code&gt; rather than &lt;code&gt;currentUser&lt;/code&gt; and &lt;code&gt;entry&lt;/code&gt; that I'm looking to retrieve.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fetchedResults = craft.entries.section('channelXhandle').relatedTo(currentUser, entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any pointers in the right direction much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Solution in light of Steve's Answer&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fetchedResult = craft.entries.section('channelXhandle').relatedTo('and',&#xA;    { sourceElement: currentUser, field: '[users field handle]' },&#xA;    { targetElement: entry, field: '[entries field handle]' }&#xA;).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note, I tagged on &lt;code&gt;.first()&lt;/code&gt; in the above since in my case there should only be one resulting match anyway.&lt;/p&gt;&#xA;" OwnerUserId="7098" LastEditorUserId="7098" LastEditDate="2017-08-08T08:30:03.800" LastActivityDate="2017-08-08T08:30:03.800" Title="relatedTo currentUser AND entry" Tags="&lt;templating&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21471" PostTypeId="1" AcceptedAnswerId="21570" CreationDate="2017-08-07T15:45:23.973" Score="1" ViewCount="214" Body="&lt;p&gt;Can anyone suggest on how to programatically save fields to a GlobalSet?&#xA;I’ve been following this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6587/programatically-adding-fields-to-a-layout/18052#18052&quot;&gt;Programatically Adding Fields to a Layout&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, doesn’t seem to work with a global?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing the following :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a new field group - works &lt;/li&gt;&#xA;&lt;li&gt;Assign fields to field group - works&lt;/li&gt;&#xA;&lt;li&gt;Create global set - works &lt;/li&gt;&#xA;&lt;li&gt;Create field layout - works &lt;/li&gt;&#xA;&lt;li&gt;Create field layout tab - works &lt;/li&gt;&#xA;&lt;li&gt;Set fields to layout tab - nope&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get all the fields from company info fieldgroup&#xA;$Fields = $FieldGroup-&amp;gt;getFields();&#xA;// Get field layout&#xA;$GlobalSetLayout = $GlobalSet-&amp;gt;getFieldLayout();&#xA;&#xA;&#xA;// Create tab model&#xA;$GlobalSetLayoutTab = new FieldLayoutTabModel();&#xA;$layout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType(ElementType::GlobalSet);&#xA;$GlobalSetLayoutTab-&amp;gt;setLayout($layout);&#xA;$GlobalSetLayoutTab-&amp;gt;setFields($Fields);&#xA;&#xA;// Set the tab's fields&#xA;$GlobalSetLayoutTab-&amp;gt;setFields($fields);&#xA;&#xA;// setTabs() expects an array&#xA;$layoutTabs[] = $GlobalSetLayoutTab;&#xA;&#xA;// Now, set the tabs back in the layout.&#xA;$layout-&amp;gt;setTabs($layoutTabs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if part of the issue is because Globals don’t exactly have a “tab”, but looking at others in the database it does seem to have one with the name “Content”&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2017-08-16T19:37:37.083" Title="Saving fields to a GlobalSet" Tags="&lt;plugin-development&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21472" PostTypeId="1" CreationDate="2017-08-07T16:10:13.040" Score="2" ViewCount="244" Body="&lt;p&gt;When using cache tag with pagination should the tag go outside the pagination tag?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;&amp;lt;div class=&quot;grid-x grid-padding-x&quot; data-equalizer data-equalize-on=&quot;medium&quot;&amp;gt;&#xA;    {% paginate craft.entries.section('employment').endDate('&amp;gt;= ' ~ now).limit(10) as pageInfo, pageEntries %}&#xA;    {% for entry in pageEntries %}&#xA;        &amp;lt;div class=&quot;small-12 medium-6 large-6 cell&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;news-card&quot; data-equalizer-watch&amp;gt;&#xA;                &amp;lt;div class=&quot;card-section text-center&quot;&amp;gt;&#xA;                    &amp;lt;h5&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&#xA;                    &amp;lt;span class=&quot;label my-purple&quot;&amp;gt;&#xA;                        {% if entry.openUntilFilled %}&#xA;                            Open Until Filled&#xA;                        {% else %}&#xA;                            Job Closing: {{ entry.endDate.format('M j, Y') }}&#xA;                        {% endif %}&#xA;                    &amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ entry.body|length &amp;gt; 1 ? entry.body|striptags|slice(0, 150) ~ '...' : entry.body }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a class=&quot;more&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;Read More&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;small-12 cell&quot;&amp;gt;&#xA;        {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&amp;amp;nbsp;{% endif %}&#xA;        {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="186" LastActivityDate="2017-08-07T21:36:40.850" Title="How to use `{% cache %}` and `{% paginate %}` together?" Tags="&lt;cache&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21473" PostTypeId="2" ParentId="21472" CreationDate="2017-08-07T21:36:40.850" Score="1" Body="&lt;p&gt;Yes, the database query you'd want to cache is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('employment').endDate('&amp;gt;= ' ~ now).limit(10) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So to get the benefits of caching, it needs to be within the cache tag.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-08-07T21:36:40.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21475" PostTypeId="1" CreationDate="2017-08-08T05:07:46.183" Score="1" ViewCount="434" Body="&lt;p&gt;SEOmatic is working as normal locally, but since I put the site up on production the Meta Entry fieldtype isn't overwriting the Site Metas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook 'seomaticRender' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;set up in my head as normal. I've created my Meta fieldset and added it to each entry type. I've set up SEOmatic before and never seen this issue, so I assume I missed something while bringing the site onto the hosting.&lt;/p&gt;&#xA;" OwnerUserId="6138" LastActivityDate="2017-08-08T05:18:43.747" Title="Why are my SEOmatic Entry Metas not overriding Sitewide SEO?" Tags="&lt;seo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21476" PostTypeId="2" ParentId="1419" CreationDate="2017-08-08T05:17:52.750" Score="1" Body="&lt;p&gt;It's important to note that your path to resources are relative to your&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whether that's &lt;code&gt;./public/index.php&lt;/code&gt; or &lt;code&gt;./index.php&lt;/code&gt; where craft is in the same directory level as &lt;code&gt;index.php&lt;/code&gt; make sure that's consistent at all three locations.&lt;/p&gt;&#xA;" OwnerUserId="6228" LastActivityDate="2017-08-08T05:17:52.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21477" PostTypeId="2" ParentId="21475" CreationDate="2017-08-08T05:18:43.747" Score="2" Body="&lt;p&gt;If you added the SEO Meta FieldType to existing entries, you'll need to re-save each section in order for it to start pulling content for you. I'm assuming that's what is going on here; see for more details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/05.-SEO-Entry-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/05.-SEO-Entry-Meta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-08T05:18:43.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21478" PostTypeId="2" ParentId="21470" CreationDate="2017-08-08T06:47:21.810" Score="1" Body="&lt;p&gt;If you take a look at the &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relations&lt;/a&gt; page from the docs. The last example at the bottom of the page shows how you can do a query using &lt;code&gt;AND&lt;/code&gt; for multiple criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example from the page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Passing Multiple Relation Criteria&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There might be times when you need to factor multiple types of&#xA;  relations into the mix. For example, outputting all of the current&#xA;  user’s favorite cocktails that include Gin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set gin = craft.entries.section('ingredients').slug('gin').first() %}&#xA;&#xA;{% set cocktails = craft.entries.section('cocktails').relatedTo('and',&#xA;    { sourceElement: currentUser, field: 'favoriteCocktails' },&#xA;    { targetElement: gin, field: 'ingredients' }&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;That first argument ('and') specified that all of the relation&#xA;  criteria must be matched. You can pass 'or' instead if you want any of&#xA;  the relation criteria to match.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hopefully that'll point you in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-08-08T06:47:21.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21479" PostTypeId="1" AcceptedAnswerId="21497" CreationDate="2017-08-08T09:25:53.093" Score="1" ViewCount="361" Body="&lt;p&gt;Due to problems I had with Craft 3 Beta 23 I switched back to version Beta 22 (I did this a couple of times)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do this by importing an sql dump of beta 22 and by directly requesting Beta 22 via composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strange thing: Craft forgets about Plugins it had installed. They simply do not appear anymore in the plugins list, although they are installed via composer and nothing changed in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cleared storage/runtime and I also cleared the DB cache via utilities, that does not help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints why Craft does not show the plugins anymore in the list? Is there another cache?&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-08T23:07:46.517" Title="Craft 3 forgets plugins" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21480" PostTypeId="1" CreationDate="2017-08-08T09:44:54.077" Score="1" ViewCount="137" Body="&lt;p&gt;I am trying to create an entry in a section via AJAX from the front end when not logged in. I am using the 'Guest Entries' plug in for craft to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries are all the same and consist of only a title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the whole thing working perfectly when I am logged in but not when I am logged out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no form on the page as the whole thing is called via JS. The Jquery code looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var formData = [{name: &quot;CRAFT_CSRF_TOKEN&quot;, value: &quot;biglongtokenhere&quot;},{name: &quot;action&quot;, value: &quot;guestEntries/saveEntry&quot;},{name: &quot;sectionId&quot;, value: &quot;5&quot;},{name: &quot;title&quot;, value: &quot;Added&quot;}];&#xA;  $.post('/', formData , function(response) {&#xA;    if (response.success) {&#xA;      //do stuff&#xA;    }else{&#xA;      // do other stuff&#xA;    }&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When logged out all I get back is a 400 bad request error. Logged in as an admin it works perfectly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plug in is installed correctly and has a default author selected and the 'Entries Enabled by Default' slider set to true on the settings screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is the plugin should allow for anonymous entry submission. Thanks in advance for any suggestions.  &lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2017-11-08T04:10:17.253" Title="Guest Entries plugin will only submit when logged in - not anonymously (via AJAX)" Tags="&lt;ajax&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21482" PostTypeId="1" CreationDate="2017-08-08T11:37:34.810" Score="1" ViewCount="433" Body="&lt;p&gt;How can I override the following admin template in Craft 2?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/app/templates/users/_edit.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried placing the template in my own template directory, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/users/_edit.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this doesn't override Craft's own template. &lt;/p&gt;&#xA;" OwnerUserId="6986" LastEditorUserId="45" LastEditDate="2017-08-25T21:02:41.913" LastActivityDate="2017-08-25T21:02:41.913" Title="Override admin template with own template" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21484" PostTypeId="2" ParentId="21482" CreationDate="2017-08-08T13:48:40.137" Score="4" Body="&lt;p&gt;For that path, Craft would look for the following template files, and use the first one that exists:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/app/templates/users/_edit&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/app/templates/users/_edit.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/app/templates/users/_edit.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/app/templates/users/_edit/index.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/app/templates/users/_edit/index.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins/users/templates/_edit&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins/users/templates/_edit.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins/users/templates/_edit.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins/users/templates/_edit/index.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;craft/plugins/users/templates/_edit/index.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[&lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#findTemplate-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the &lt;code&gt;users/_edit.html&lt;/code&gt; template in &lt;code&gt;craft/app/templates&lt;/code&gt; will always exist, it will always find that first and use it.&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2017-08-08T13:48:40.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21485" PostTypeId="1" AcceptedAnswerId="21518" CreationDate="2017-08-08T14:08:06.913" Score="1" ViewCount="214" Body="&lt;p&gt;In my Craft 3 Plugin I am saving an image (YouTube poster) to an asset volume like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$asset = new Asset();&#xA;$asset-&amp;gt;title = $url;&#xA;$asset-&amp;gt;tempFilePath = $tmpPath; // temp path for image in /storage/runtime/temp/&#xA;$asset-&amp;gt;volumeId = $volumeId; // ID of my Asset Volume&#xA;$asset-&amp;gt;filename = $filename; // filename like youtube_&amp;lt;youTubeKey&amp;gt;.jpg&#xA;$asset-&amp;gt;newFolderId = $folder-&amp;gt;id; // root folder id of the volume&#xA;$asset-&amp;gt;avoidFilenameConflicts = true;&#xA;$asset-&amp;gt;setScenario(Asset::SCENARIO_CREATE);&#xA;clearstatcache();&#xA;list ($w, $h) = Image::imageSize($tmpPath);&#xA;$asset-&amp;gt;setWidth($w);&#xA;$asset-&amp;gt;setHeight($h);&#xA;$result = Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The image saved does not have width or height (so it's there while saving), so if I later output its width like this in TWIG: &lt;code&gt;{{ dump(img.width) }}&lt;/code&gt; it will be &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints what I need to call so that craft persists the image width / height?&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="6886" LastEditDate="2017-08-08T17:33:40.850" LastActivityDate="2017-08-09T21:13:02.423" Title="Craft 3 Plugin: Saved image asset has no width / height" Tags="&lt;plugin-development&gt;&lt;image&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21486" PostTypeId="1" CreationDate="2017-08-08T14:53:00.150" Score="1" ViewCount="439" Body="&lt;p&gt;I am using Craft CMS 2.6.2987 and the Craft Commerce plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building a list of products on a page using query params. The idea is that there are 2 approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A user clicks a set of checkboxes and it populates the URL dynamically with these values and ajax updates the container with the results from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) When a user arrives at a page with query params on it I loop through the products and get them based on the params in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently ordering products in a structure like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eu9xy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eu9xy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am doing this is because the client wants full control over ordering of products on these pages via drag and drop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within each structure entry there are matrix fields that have the actual products in them that are taken from commerce products like the below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4ee9Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ee9Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this setup we have the following on this URLfor example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/products/tables&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0wE35.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0wE35.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the filter buttons there are dropdowns that when clicked populate the url with query params that output the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/products/tables?types=dining-table,placemats&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to know is if it is possible to query commerce products based on the above because &lt;code&gt;dining-table,placemats&lt;/code&gt; will be linked directly to Commerce product types as you can see below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zwn2W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zwn2W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit code added&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.productBlock.type('products') %}&#xA;&#xA;            {% if block.layout == &quot;leftFeatured&quot; %}&#xA;&#xA;            &amp;lt;section class=&quot;center mv5&quot;&amp;gt;&#xA;                &amp;lt;section class=&quot;cf nl4 nr4 Grid--gutters&quot;&amp;gt;&#xA;                {% if block.product|length %}&#xA;                    {% for product in block.product %}&#xA;&#xA;                        {% set mainImage = product.productImages.first() %}&#xA;                        {% set mainImageUrl = mainImage.getUrl() %}&#xA;                        {% set body = product.body|e %}&#xA;                        {% set groupedFieldData = [] %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('id'):product.id}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('title'):product.title}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('productImage'):mainImageUrl}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('body'):body}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('brand'):product.productBrand.first().title}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('designer'):product.productDesigner.first().title}) %}&#xA;                        {% set groupedFieldData = groupedFieldData|merge({('url'):product.url}) %}&#xA;&#xA;&#xA;                        &amp;lt;article id=&quot;product-{{ product.id }}&quot; class=&quot;{% if loop.index == 1 %}w-50-ns w-100{% else %}w-25-ns w-100{% endif %} fl mb3 Grid-cell&quot;&amp;gt;&#xA;                            &amp;lt;span class=&quot;bg Grid-fill product--hover&quot; style=&quot;background-image:url({{ mainImageUrl }});&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;block&quot;&amp;gt;&#xA;                                    &amp;lt;div class=&quot;absolute top-1 left-1 share-hover link z-2&quot;&amp;gt;&#xA;                                        &amp;lt;svg class=&quot;share-icon absolute&quot; width=&quot;19&quot; height=&quot;18&quot;&amp;gt;&#xA;                                            &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#share_icon&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                        &amp;lt;/svg&amp;gt;&#xA;                                        &amp;lt;ul class=&quot;ma0 pa0 mb4 list share-list relative&quot;&amp;gt;&#xA;                                            &amp;lt;li class=&quot;dib v-top mw2&quot;&amp;gt;&#xA;                                                &amp;lt;div class=&quot;icon icon--kudos_icon&quot;&amp;gt;&#xA;                                                    &amp;lt;a class=&quot;share twitter&quot; v-on:click.stop.prevent=&quot;openShareWindow($event)&quot; href=&quot;https://twitter.com/share?url=https://simplesharebuttons.com&amp;amp;amp;text=Simple%20Share%20Buttons&amp;amp;amp;hashtags=simplesharebuttons&quot;&amp;gt;&#xA;                                                        &amp;lt;svg width=&quot;100%&quot; height=&quot;20&quot;&amp;gt;&#xA;                                                            &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#twitter_logo&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                                        &amp;lt;/svg&amp;gt;&#xA;                                                    &amp;lt;/a&amp;gt;&#xA;                                                &amp;lt;/div&amp;gt;&#xA;                                            &amp;lt;/li&amp;gt;&#xA;                                            &amp;lt;li class=&quot;dib v-top mw2&quot;&amp;gt;&#xA;                                                &amp;lt;div class=&quot;icon icon--kudos_icon&quot;&amp;gt;&#xA;                                                    &amp;lt;a href=&quot;https://www.facebook.com/sharer.php?u=https://codepen.io/patrickkahl&quot; v-on:click.stop.prevent=&quot;openShareWindow($event)&quot;&amp;gt;&#xA;                                                        &amp;lt;svg width=&quot;100%&quot; height=&quot;20&quot;&amp;gt;&#xA;                                                            &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#facebook_logo&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                                        &amp;lt;/svg&amp;gt;&#xA;                                                    &amp;lt;/a&amp;gt;&#xA;                                                &amp;lt;/div&amp;gt;&#xA;                                            &amp;lt;/li&amp;gt;&#xA;                                            &amp;lt;li class=&quot;dib v-top mw2&quot;&amp;gt;&#xA;                                                &amp;lt;div class=&quot;icon icon--kudos_icon&quot;&amp;gt;&#xA;                                                    &amp;lt;a href=&quot;http://pinterest.com/pin/create/button/?url={{ product.url }}&amp;amp;media={{ product.url }}&amp;amp;description={{ product.title }}&quot; v-on:click.stop.prevent=&quot;openShareWindow($event)&quot;&amp;gt;&#xA;                                                        &amp;lt;svg width=&quot;100%&quot; height=&quot;20&quot;&amp;gt;&#xA;                                                            &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#pinterest_logo&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                                        &amp;lt;/svg&amp;gt;&#xA;                                                    &amp;lt;/a&amp;gt;&#xA;                                                &amp;lt;/div&amp;gt;&#xA;                                            &amp;lt;/li&amp;gt;&#xA;                                        &amp;lt;/ul&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;&#xA;                                    &amp;lt;a href=&quot;#&quot; v-on:click.stop.prevent=&quot;quickView($event)&quot; class=&quot;absolute bottom-1 left-1 link gray z-2&quot;&amp;gt;&#xA;                                        &amp;lt;span style=&quot;display: none;&quot; class=&quot;product-data&quot;&amp;gt;{{ groupedFieldData|json_encode()|raw }}&amp;lt;/span&amp;gt;&#xA;                                        &amp;lt;svg class=&quot;v-mid&quot; width=&quot;19&quot; height=&quot;18&quot;&amp;gt;&#xA;                                            &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#colour_icon&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                        &amp;lt;/svg&amp;gt;&#xA;                                        &amp;lt;span class=&quot;v-mid&quot;&amp;gt;(12)&amp;lt;/span&amp;gt;&#xA;                                    &amp;lt;/a&amp;gt;&#xA;                                    {% if craft.like.isLike(product.id) %}&#xA;                                        &amp;lt;a href=&quot;{{actionUrl('like/remove', {id:product.id})}}&quot; v-on:click.stop.prevent=&quot;addFavourite($event)&quot; class=&quot;absolute top-1 right-1 z-2&quot;&amp;gt;&#xA;                                            &amp;lt;svg width=&quot;19&quot; height=&quot;18&quot;&amp;gt;&#xA;                                                &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#favourite_icon_added&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                            &amp;lt;/svg&amp;gt;&#xA;                                        &amp;lt;/a&amp;gt;&#xA;                                    {% else %}&#xA;                                        &amp;lt;a href=&quot;{{actionUrl('like/add', {id:product.id})}}&quot; v-on:click.stop.prevent=&quot;addFavourite($event)&quot; class=&quot;absolute top-1 right-1 z-2&quot;&amp;gt;&#xA;                                            &amp;lt;svg width=&quot;19&quot; height=&quot;18&quot;&amp;gt;&#xA;                                                &amp;lt;use class=&quot;no-barba&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xlink:href=&quot;/dist/images/icons.svg#favourite_icon&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;                                            &amp;lt;/svg&amp;gt;&#xA;                                        &amp;lt;/a&amp;gt;&#xA;                                    {% endif %}&#xA;                                    &amp;lt;a href=&quot;{{ product.url }}&quot; style=&quot;display: block;width: 100%;height: 100%;position: absolute;left: 0;top: 0;z-index: 1;&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/span&amp;gt;&#xA;                            &amp;lt;div class=&quot;mv2 lh-copy&quot;&amp;gt;&#xA;                            &amp;lt;p class=&quot;text-product&quot;&amp;gt;{{ product.title }}&amp;lt;br&amp;gt;&#xA;                            {% if product.productBrand | length &amp;gt; 0 %}&#xA;                                {{ product.productBrand.first() }}&#xA;                            {% endif %} {% if product.productDesigner | length &amp;gt; 0 %}&#xA;                                for {{ product.productDesigner.first() }}&#xA;                            {% endif %}&amp;lt;br&amp;gt;&#xA;                            &amp;lt;/p&amp;gt;&#xA;                            &amp;lt;p&amp;gt;{{ product.defaultVariant.price|commerceCurrency(cart.currency) }}&amp;lt;/p&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;&#xA;                        &amp;lt;/article&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endif %}&#xA;                &amp;lt;/section&amp;gt;&#xA;            &amp;lt;/section&amp;gt;&#xA;&#xA;&#xA;            {% elseif block.layout == &quot;rightFeatured&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a robust way of being able to build up the URLs or query multiple types of content from products related to sections in matrix fields and products related to product fields?&lt;/p&gt;&#xA;" OwnerUserId="5033" LastEditorUserId="5033" LastEditDate="2017-08-10T12:07:46.657" LastActivityDate="2017-08-11T20:19:46.600" Title="Can Craft Commerce products be filtered with multiple query params?" Tags="&lt;entries&gt;&lt;plugin-craftcommerce&gt;&lt;relations&gt;&lt;ecommerce&gt;&lt;query&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21487" PostTypeId="1" AcceptedAnswerId="21498" CreationDate="2017-08-08T16:41:30.983" Score="1" ViewCount="120" Body="&lt;p&gt;I need to accept a decimal value for the quantity of a line item and for the total quantity. I understand this is not a normal request for most products but my client sells items by the foot and needs the flexibility to sell lengths in feet and inches (ex. 10 ft. 6 in. = 10.5 or 5 ft 6.5 in. = 5.541. I could probably hack this using JavaScript on the front-end but would like to do this the correct way. Any guidance is greatly appreciated. Has anyone achieved this?&lt;/p&gt;&#xA;" OwnerUserId="7106" LastActivityDate="2017-08-08T23:47:54.423" Title="Decimal value for quantity" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21488" PostTypeId="1" AcceptedAnswerId="21493" CreationDate="2017-08-08T18:05:20.690" Score="3" ViewCount="312" Body="&lt;p&gt;I have a question regarding populating models, in that I have a &lt;code&gt;DateTime&lt;/code&gt; field in my model that I'm pulling / populating from the database. The &lt;code&gt;DateTime&lt;/code&gt; value does not include the timezone it was set to when it was stored, its stored in UTC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the original timezone value (Not the same as the CRAFT timezone but the users timezone that actually created the entry) stored in the model attributes as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can extend the model so that when the data is populated I can force the correct timezone on the &lt;code&gt;DateTime&lt;/code&gt; fields? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure that Craft is going to convert them to the timezone craft is set to when it pulls it into the model, but I dont want that in this case. I want it set to the TZ stored in the &quot;timeZone&quot; column/attribute...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Timezone is America/Chicago&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user's timezone is America/New_York&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user selects a date and time and the controller creates the DateTime object with the user's selection, specifying the timezone America/New_Yrok, then tells the model to save, so it stores it in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Database DateTime value is now stored in UTC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I fetch this data and populate a model with it and reference the DateTime object, its going to be in Amercia/Chicago right? since that's what the craft system is set to, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the best way to set up the model so it automatically knows to use &lt;code&gt;$this-&amp;gt;getAttribute('timeZone')&lt;/code&gt; as the timezone for that field rather than the Craft system setting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I ended up doing that appears to work. I added this to my model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function populateModel($values) {&#xA;    $model = PARENT::populateModel($values);&#xA;&#xA;    /** @var $startTime DateTime */&#xA;    $startTime = $model-&amp;gt;getAttribute('startTime');&#xA;    if($startTime) {&#xA;        $startTime-&amp;gt;setTimezone($model-&amp;gt;timeZone);&#xA;        $model-&amp;gt;setAttribute('startTime', $startTime);&#xA;    }&#xA;    /** @var $endTime DateTime|null */&#xA;    $endTime = $model-&amp;gt;getAttribute('endTime');&#xA;    if($endTime) {&#xA;        $endTime-&amp;gt;setTimezone($model-&amp;gt;timeZone);&#xA;        $model-&amp;gt;setAttribute('endTime', $endTime);&#xA;    }&#xA;&#xA;    return $model;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="6309" LastEditDate="2017-08-08T22:47:37.313" LastActivityDate="2017-08-08T22:47:37.313" Title="Pull DateTime field using alternate timezone?" Tags="&lt;datetime&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21489" PostTypeId="1" AcceptedAnswerId="21502" CreationDate="2017-08-08T18:29:12.407" Score="0" ViewCount="2113" Body="&lt;p&gt;I get &quot;Service Unavailable&quot; when I go to my (hosted, not local) test site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It had been working just fine until I decided to swap databases today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deleted the old database and replaced it with the new database.  I kept the database name the same.  I changed the username and password in cPanel and then duplicated those changes in my craft/db.php file... But no dice...  I get the nice little warning:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Service Unavailable&lt;/strong&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Our site is temporarily unavailable.  Please try again later.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have checked more than once, the path, db name, username and password all check out.  Any suggestions?  ...other than start over&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2018-04-30T22:37:31.573" LastActivityDate="2018-04-30T22:37:31.573" Title="Site is &quot;Temporarily Unavailable&quot;" Tags="&lt;installation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21490" PostTypeId="1" CreationDate="2017-08-08T18:34:58.117" Score="2" ViewCount="35" Body="&lt;p&gt;I created a section for appointment record (channel type). Each appointment record has different fields, i.e. customer name, phone#, address, etc... I would like to set a unique appointment_record_id (Numeric, i.e. 234) for each record.  Is there any way to create it?&lt;/p&gt;&#xA;" OwnerUserId="5964" LastEditorUserId="57" LastEditDate="2017-08-08T20:44:17.473" LastActivityDate="2017-08-11T19:30:30.017" Title="Any ID I could reference in sections" Tags="&lt;entries&gt;&lt;sections&gt;&lt;channels&gt;&lt;id&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21491" PostTypeId="2" ParentId="21489" CreationDate="2017-08-08T18:36:53.670" Score="1" Body="&lt;p&gt;Try going to /admin, you should get a clearer error message.&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2017-08-08T18:36:53.670" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21493" PostTypeId="2" ParentId="21488" CreationDate="2017-08-08T20:42:45.253" Score="3" Body="&lt;p&gt;100% untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Have your model override BaseModel's &lt;a href=&quot;https://craftcms.com/classreference/models/BaseModel#populateModel-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;populateModel&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the DateTime field you're interested in and get its value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a new &lt;a href=&quot;http://php.net/manual/en/class.datetime.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateTime&lt;/a&gt; object and pass in the value from the &lt;code&gt;timeZone&lt;/code&gt; attribute.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the new DateTime object back on the original DateTime field.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Call &lt;code&gt;parent::populateModel($values)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-08T20:42:45.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21494" PostTypeId="2" ParentId="21490" CreationDate="2017-08-08T21:45:27.087" Score="1" Body="&lt;p&gt;If you were to do this on entry save, it'd be much easier/cleaner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onBeforeSaveEntry&lt;/code&gt;&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin would check the &lt;code&gt;isNewEntry&lt;/code&gt; param to make this this is a new entry and not an existing one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's new, you could generate a random numeric value with &lt;a href=&quot;http://php.net/mt_rand&quot; rel=&quot;nofollow noreferrer&quot;&gt;mt_rand&lt;/a&gt;, assign it to your custom field and left the request continue so Craft can save it to the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A string field for the unique identifier would be better though, since mt_rand will not always produce unique numbers (for unique numbers you'd need to keep a separate database table and obtain id's within a transaction). If you'd use strings you could use &lt;a href=&quot;http://php.net/manual/en/function.uniqid.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;uniqid('', true)&lt;/a&gt; if you deploy on a single server, or better use a &lt;a href=&quot;http://codeaid.net/php/generate-a-random-guid&quot; rel=&quot;nofollow noreferrer&quot;&gt;uuid/guid&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you didn't do it on save, but wanted to be auto-populated when someone clicked &quot;New Entry&quot;, you'd have to do something much more hacky like have &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;JS loaded&lt;/a&gt; load, try to target the field in the particular section with JavaScript and inject the random number into the DOM.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="6868" LastEditDate="2017-08-11T19:30:30.017" LastActivityDate="2017-08-11T19:30:30.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21496" PostTypeId="1" CreationDate="2017-08-08T22:52:41.513" Score="1" ViewCount="33" Body="&lt;p&gt;I have a record with a time field set like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'startTime'         =&amp;gt; array(AttributeType::DateTime, 'column'=&amp;gt;ColumnType::Time, 'required' =&amp;gt; true),&#xA;'endTime'           =&amp;gt; array(AttributeType::DateTime, 'column'=&amp;gt;ColumnType::Time),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The data is stored in the database as a string like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10:45:53&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I populate models from an elementCriteria query, the string value &quot;10:45:53&quot; does not work with creating a new DateTime object so I get false returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would need to supply a full date in order to get a valid DateTime object back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I deal with this? Is this i a bug in core? Why have &lt;code&gt;ColumnType::Time&lt;/code&gt; if its not going to work correctly when pulling the value from the database?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-08-09T20:19:46.917" Title="MySQL ColumnType::Time does does not populate model from setAttribute()" Tags="&lt;plugin-development&gt;&lt;datetime&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21497" PostTypeId="2" ParentId="21479" CreationDate="2017-08-08T23:07:46.517" Score="4" Body="&lt;p&gt;Craft 3 knows about available plugins via the &lt;code&gt;vendor/craftcms/plugins.php&lt;/code&gt; file, which stores info about all Composer packages that were installed with &lt;code&gt;type: craft-plugin&lt;/code&gt; in composer.json.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that file doesn’t exist or is just returning an empty array, then make sure that the &lt;code&gt;craftcms/plugin-installer&lt;/code&gt; Composer package is installed, and try re-requiring each of your Craft plugins. As they are (re-)installed, they should get added to &lt;code&gt;plugins.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-08-08T23:07:46.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21498" PostTypeId="2" ParentId="21487" CreationDate="2017-08-08T23:47:54.423" Score="2" Body="&lt;p&gt;You could build a plugin that listens to &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onbeforeaddtocart&lt;/a&gt; and translates the front end values of 10.5 or 10'6&quot; or whatever into the number of inches (or, if you're working in a sane part of the world, even cm!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on display of the cart or updates etc, you'll want to use some JS and/or twig maths to translate that back into those crazy feet/inch units you need there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I honestly think trying to retro-fit in partial unit sales into Commerce as a whole would be quite a considerable challenge, so I think the best way to solve this is to use your smallest unit as the back end unit of quantity for the product, and do the magic in your plugin/and display.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-08-08T23:47:54.423" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21499" PostTypeId="1" AcceptedAnswerId="21516" CreationDate="2017-08-09T01:09:23.350" Score="0" ViewCount="376" Body="&lt;p&gt;Transformed Images are failing to load with a &lt;code&gt;404 error&lt;/code&gt;  For example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://mysite.com/index.php?p=cpresources/transforms/382&amp;amp;x=v0nGRK3Qr&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happened after I swapped the db.  So, everything had previously been working.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;My images reside &lt;code&gt;/public_html/mysite/img/posts/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;BUT, &lt;code&gt;Update Asset Indexes&lt;/code&gt; generates &lt;code&gt;The path of your source &quot;Main Post Image&quot; appears to be invalid&lt;/code&gt; And, none of the images load when I try to view Assets in cp.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I can access the image from the &lt;code&gt;public URL&lt;/code&gt; to the assets is &lt;code&gt;http://www.mysite.com/img/posts&lt;/code&gt;.  And, I can access the original uploaded images here. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I &lt;strong&gt;assume&lt;/strong&gt; the path to my images (which I understand can be different from the URL) is the problem. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Path is current set to /mysite/img/posts/'.  I have tried multiple permutations - nothing seems to work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Help/Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2017-08-09T13:41:14.220" LastActivityDate="2017-08-09T20:03:26.093" Title="404 Error on Image Transforms" Tags="&lt;assets&gt;&lt;control-panel&gt;&lt;php&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21500" PostTypeId="2" ParentId="21489" CreationDate="2017-08-09T03:41:00.323" Score="2" Body="&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21489/help-my-site-is-temporarily-unavailable-huh/21491?noredirect=1#comment29711_21491&quot;&gt;your comments&lt;/a&gt; to @benface, I believe your database is using a version of Craft ahead of your files.&lt;/p&gt;&#xA;" OwnerUserId="217" LastActivityDate="2017-08-09T03:41:00.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21502" PostTypeId="2" ParentId="21489" CreationDate="2017-08-09T07:54:16.720" Score="5" Body="&lt;p&gt;Others have said what the problem is, but in the interest of clarity for future readers...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;: The database is expecting a newer version of Craft's filesystem than you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: Replace the /app folder with one from a fresh Craft download and visit your admin trigger URL&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-08-09T07:54:16.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21503" PostTypeId="2" ParentId="12453" CreationDate="2017-08-09T08:47:46.987" Score="1" Body="&lt;p&gt;If the cron jobs are triggered at the server where your Craft installation is hosted, it might be better to implement a &lt;em&gt;consolecommand&lt;/em&gt; instead to execute the logic you want. They are well suited for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a console command your crontab entry would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*/1 * * * * php /opt/craft-app/current/craft/app/etc/console/yiic PLUGINNAME ACTIONNAME myParam=myValue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(where PLUGINNAME is the name of your plugin, and ACTIONNAME is a method defined in your consolecommand; myParam are arguments passed to your action)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a plugin that makes use of a consolecommand: &lt;a href=&quot;https://straightupcraft.com/craft-plugins/taskrunner&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/taskrunner&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(beware if you make use of environmental specific variables you might have to do so in your plugin to get the right configuration)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Activation of 'cron actions' through 'url requests' may be considered bad practice;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;you'd have to open up a section of your admin panel publicly, or implement another authentication mechanism (i.e. api key)&lt;/li&gt;&#xA;&lt;li&gt;hence, the 'action' may be vulnerable to various kinds of attacks&lt;/li&gt;&#xA;&lt;li&gt;by activation through cron you can log success and error output more easily to 'cron logs' or get notified by email on failure (through crontab settings)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6868" LastActivityDate="2017-08-09T08:47:46.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21504" PostTypeId="1" AcceptedAnswerId="21505" CreationDate="2017-08-09T09:41:02.373" Score="1" ViewCount="32" Body="&lt;p&gt;The FeedMe &lt;a href=&quot;https://sgroup.com.au/plugins/feedme/feature-tour/trigger-import-via-cron&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; state that there is a Direct Feed Link for cron usage. I'm not seeing it. All I see is the Debug, Status and Delete icon. Or is this a PRO feature?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'using Craft 2.6.x and FeedMee 2.0.6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Martijn&lt;/p&gt;&#xA;" OwnerUserId="6970" LastActivityDate="2017-08-09T12:02:41.483" Title="FeedMe Direct Feed Link not showing in CP" Tags="&lt;plugin-feedme&gt;&lt;cron&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21505" PostTypeId="2" ParentId="21504" CreationDate="2017-08-09T12:02:41.483" Score="1" Body="&lt;p&gt;Apologies for the confusion, this was updated in the latest Feed Me version, but not reflected in the docs (we're currently re-working them a little).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The direct feed link icon is no more - its not accessible on the first page where you set the name and URL.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-08-09T12:02:41.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21506" PostTypeId="1" CreationDate="2017-08-09T12:19:43.493" Score="1" ViewCount="150" Body="&lt;p&gt;I'm trying to set a fallback description in case there is none. This is the bit of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if seomaticMeta.seoDescription is empty and entry is defined %}&#xA;    {% set fallbackDescription = &quot;&quot; %}&#xA;    {% if entry.description is defined %}&#xA;        {% set fallbackDescription = extractSummary( entry.description ) %}&#xA;    {% endif %}&#xA;    {% if fallbackDescription is not empty %}&#xA;        {% set seomaticMeta = seomaticMeta | merge({&#xA;            seoDescription: fallbackDescription,&#xA;            og: {&#xA;                description: fallbackDescription&#xA;            },&#xA;            twitter: {&#xA;                description: fallbackDescription&#xA;            }&#xA;        }) %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get an error: &lt;code&gt;Unknown &quot;extractSummary&quot; function in &quot;_globals/_layout&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="4747" LastActivityDate="2017-12-07T23:11:54.880" Title="extractSummary twig filter is unknown" Tags="&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21507" PostTypeId="1" AcceptedAnswerId="21569" CreationDate="2017-08-09T14:38:22.797" Score="1" ViewCount="219" Body="&lt;p&gt;I setup an Assets field called Images. My Default Upload Location is set as &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My File System Path for that folder is &lt;code&gt;img/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directory structure that is generated is correct and in this format: &lt;code&gt;img/artists/artist_name/category_name/project_name&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the images are being saved in the root &lt;code&gt;img/&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="7082" LastEditorUserId="57" LastEditDate="2017-08-09T21:35:36.640" LastActivityDate="2017-08-14T20:56:43.240" Title="Assets are not saved in dynamically generated folders" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21509" PostTypeId="1" AcceptedAnswerId="21523" CreationDate="2017-08-09T16:34:52.183" Score="2" ViewCount="774" Body="&lt;p&gt;.find has been deprecated and we are told to use .all() instead. This seems to work for cases that don't have Eager Loading going on, but fails when eager loading is tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My working Craft 2 code might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mixedContent = entry.mixedContent.find({&#xA;    with: [&#xA;        'singleImage:image',&#xA;        'imageGallery:images',&#xA;        'download:file',&#xA;        'relatedItems:relatedItems'&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simply transposing &quot;.find&quot; with &quot;.all&quot; results in the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error: Call to a member function getQueryBuilder() on array&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Switching the syntax I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mixedContent = entry.mixedContent({&#xA;    with: [&#xA;        'singleImage:image',&#xA;        'imageGallery:images',&#xA;        'download:file',&#xA;        'relatedItems:relatedItems'&#xA;    ]&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But got this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Calling unknown method: craft\elements\Entry::mixedContent()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2017-08-09T21:52:28.873" LastActivityDate="2017-08-10T05:54:06.380" Title="Craft 3: .find() deprecated but .all() fails?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21510" PostTypeId="1" CreationDate="2017-08-09T17:23:47.627" Score="1" ViewCount="252" Body="&lt;p&gt;Basically, I have no clue what this means?  But, I am unable to edit any entries in Control Panel -- everything times out after I try to save and/or return to the main entries page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[Error] XMLHttpRequest cannot load http://www.mysite.com/index.php/nc3/actions/users/getAuthTimeout?dontExtendSession=1 due to access control checks.&#xA;    send (jquery-2.2.4.min.js:4:15971)&#xA;    ajax (jquery-2.2.4.min.js:4:11523)&#xA;    checkAuthTimeout (craft.js:3:22301)&#xA;    f (jquery-2.2.4.min.js:2:3704)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know for sure, but the error seems to be connected to adding &lt;code&gt;siteURL&lt;/code&gt; to &lt;code&gt;general.php&lt;/code&gt;.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, (and I am a noob) it was set to &lt;a href=&quot;http://www.mysite.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mysite.com&lt;/a&gt;.   which is exactly what appears in CP.   I assume I do not need to list it in both places?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2017-08-09T17:34:16.080" LastActivityDate="2017-08-09T17:34:16.080" Title="Control Panel freezes due to Access Control Checks?" Tags="&lt;control-panel&gt;&lt;error-message&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21512" PostTypeId="1" AcceptedAnswerId="21521" CreationDate="2017-08-09T18:17:40.347" Score="2" ViewCount="361" Body="&lt;p&gt;Looking at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11828/include-a-php-resource-within-a-plugin&quot;&gt;this answer&lt;/a&gt;, I suppose I am under the assumption that Craft::import() will take an alias, find the path, and import that class into the Craft namespace... which would be the benefit over simply using &lt;code&gt;require_once()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I import with: &#xA;&lt;code&gt;Craft::import('plugins.myplugin.resources.chargebee.lib.ChargeBee', true);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which works, however to use ChargeBee.php, I have to reference it from the global namespace. Not sure if this is the expected behaviour, but I would love to work within the Craft namespace if possible. Any help is greatly appreciated! &lt;/p&gt;&#xA;" OwnerUserId="6514" LastEditorUserId="6514" LastEditDate="2017-08-10T15:17:40.973" LastActivityDate="2017-08-10T15:17:40.973" Title="Using Craft::import() to include external resource into the Craft Namespace" Tags="&lt;plugin-development&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21513" PostTypeId="2" ParentId="6708" CreationDate="2017-08-09T19:19:00.163" Score="2" Body="&lt;p&gt;I recently ran into this issue as well for a site with multiple locales using a multi-environment configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue turned out to be that the secondary locales did not have a multi-environment configuration setup in a way that helped identify what environment they were operating in. Updating the secondary locales index.php files to test for the environment and define the &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt; variable got things working again.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-08-09T19:19:00.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21514" PostTypeId="1" AcceptedAnswerId="24151" CreationDate="2017-08-09T19:50:20.720" Score="1" ViewCount="251" Body="&lt;p&gt;I want to do something that's perhaps connected to the id so that if the title/slug updates, then I don't have to hunt anything down in entries across the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this maybe?&#xA;&lt;code&gt;[Link to an entry](/section#entry:10725)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-03-13T13:04:26.770" Title="How to link to an entry in a Markdown field in the CMS" Tags="&lt;wysiwyg&gt;&lt;link&gt;&lt;markdown&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21515" PostTypeId="1" AcceptedAnswerId="21522" CreationDate="2017-08-09T20:02:51.510" Score="1" ViewCount="105" Body="&lt;p&gt;I am trying to get the value of an environment variable (defined in the general.php config file) in the routes.php config file. Is it possible or not? I tried &lt;code&gt;$environmentVariables = craft()-&amp;gt;config-&amp;gt;get('environmentVariables')['myVariable']&lt;/code&gt; but that throws an error: &lt;code&gt;Call to undefined function craft()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2017-08-09T22:25:45.803" Title="Can I get the value of an environment variable in routes.php (or other config files)?" Tags="&lt;config&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21516" PostTypeId="2" ParentId="21499" CreationDate="2017-08-09T20:03:26.093" Score="2" Body="&lt;p&gt;&lt;code&gt;/mysite/img/posts/&lt;/code&gt; is an absolute path pointing to the root of your drive mount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably just need to make it relative.  i.e. either &lt;code&gt;mysite/img/posts&lt;/code&gt; or &lt;code&gt;./mysite/img/posts&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-09T20:03:26.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21517" PostTypeId="2" ParentId="21496" CreationDate="2017-08-09T20:19:46.917" Score="1" Body="&lt;p&gt;It turns out that I don't think you should really use craft's &lt;code&gt;DateTime&lt;/code&gt; object for time only. I suppose there is a case where you might want but if you just have a &quot;time of day&quot; absent a date, I ended up using &lt;code&gt;AttributeType::String&lt;/code&gt; for them, but still use a &lt;code&gt;ColumnType::Time&lt;/code&gt; for the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then all I needed to do is override populateModel method to do a little magic to convert them from 24 hour format to 12 hour format like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function to12Hour($dbTime) {&#xA;&#xA;    $dbTime = explode(&quot;:&quot;, $dbTime);&#xA;&#xA;    if($dbTime[0] &amp;gt; 12) {&#xA;        $ampm = &quot;PM&quot;;&#xA;        $dbTime[0] = $dbTime[0] - 12;&#xA;    } else if($dbTime[0] == 0) {&#xA;        $ampm = &quot;AM&quot;;&#xA;        $dbTime[0] = 12;&#xA;    } else {&#xA;        $ampm = &quot;AM&quot;;&#xA;    }&#xA;&#xA;    return $dbTime[0] . &quot;:&quot; . $dbTime[1] . &quot; &quot; . $ampm;&#xA;}&#xA;&#xA;public static function populateModel($values) {&#xA;&#xA;    $model = parent::populateModel($values);&#xA;&#xA;    if ($values['startTime']) {&#xA;        $model-&amp;gt;setAttribute('startTime', self::to12Hour($values['startTime']));&#xA;    }&#xA;&#xA;    if ($values['endTime']) {&#xA;        $model-&amp;gt;setAttribute('endTime', self::to12Hour($values['endTime']));&#xA;    }&#xA;&#xA;    return $model;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You just need to make sure you're storing the time in 24 hour format and to ensure that is the case, I set up my attribute types like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        'startTime'         =&amp;gt; array(AttributeType::String, 'column'=&amp;gt;ColumnType::Time, 'required' =&amp;gt; true, 'matchPattern' =&amp;gt; '/^\d\d:\d\d:\d\d$/'),&#xA;        'endTime'           =&amp;gt; array(AttributeType::String, 'column'=&amp;gt;ColumnType::Time, 'matchPattern' =&amp;gt; '/^\d\d:\d\d:\d\d$/'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-08-09T20:19:46.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21518" PostTypeId="2" ParentId="21485" CreationDate="2017-08-09T21:13:02.423" Score="1" Body="&lt;p&gt;As Andris Sevcenko pointed out, the problem is Craft 3 Beta 22 and a Multisite Configuration. Fixed in Beta 23.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-09T21:13:02.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21519" PostTypeId="2" ParentId="21506" CreationDate="2017-08-09T21:30:58.197" Score="0" Body="&lt;p&gt;That method is definitely available as a global function in the &lt;a href=&quot;https://github.com/nystudio107/seomatic/blob/376eddfbeff5c7ad3932b33de4fbf78b61b3dc5d/twigextensions/SeomaticTwigExtension.php#L73&quot; rel=&quot;nofollow noreferrer&quot;&gt;latest version&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it looks like it's been there from the &lt;a href=&quot;https://github.com/nystudio107/seomatic/blob/c72e37bf1dddba33b368153a96e5db54c499dc42/twigextensions/SeomaticTwigExtension.php#L51&quot; rel=&quot;nofollow noreferrer&quot;&gt;very beginning&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These might sound silly, but maybe double check that the plugin is installed and that you're using the latest version?  Even if you are, might be worth re-downloading to make sure you're not missing any of its files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-09T21:30:58.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21520" PostTypeId="2" ParentId="21506" CreationDate="2017-08-09T21:47:13.783" Score="1" Body="&lt;p&gt;So it sounds to me like either the plugin isn't installed (which doesn't make a ton of sense, because you'd be getting other errors, too), or if it is installed, pieces of it are missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;extractSummary&lt;/code&gt; is a Twig filter/function and has been available since the start; I'd try making sure there's nothing wrong with your install/deploy, or try re-downloading a fresh copy of the SEOmatic plugin.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-09T21:47:13.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21521" PostTypeId="2" ParentId="21512" CreationDate="2017-08-09T22:01:28.503" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;and import that class into the Craft namespace&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope... it'll import that file, but will use whatever namespace the file is using (including global).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the &lt;code&gt;ChargeBee.php&lt;/code&gt; file has a &lt;code&gt;ChargeBee&lt;/code&gt; class in it that lives in the global namespace, which is why you have to reference it there.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-09T22:01:28.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21522" PostTypeId="2" ParentId="21515" CreationDate="2017-08-09T22:25:45.803" Score="1" Body="&lt;p&gt;I think you'll just need to do something like this in your &lt;code&gt;routes.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$general = require __DIR__.'/general.php';&#xA;&#xA;return array(&#xA;    'foo' =&amp;gt; $general['environmentVariables']['bar'],&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-09T22:25:45.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21523" PostTypeId="2" ParentId="21509" CreationDate="2017-08-09T22:40:34.360" Score="3" Body="&lt;p&gt;Assuming &lt;code&gt;mixedContent&lt;/code&gt; is a Matrix or relational field, the correct syntax would be:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set mixedContent = entry.mixedContent.with([&#xA;    'singleImage:image',&#xA;    'imageGallery:images',&#xA;    'download:file',&#xA;    'relatedItems:relatedItems'&#xA;]).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="340" LastEditDate="2017-08-10T05:54:06.380" LastActivityDate="2017-08-10T05:54:06.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21524" PostTypeId="2" ParentId="21480" CreationDate="2017-08-10T01:48:57.080" Score="1" Body="&lt;p&gt;So can now answer this myself. Basically the issue is the CSRF token validation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Options are to disable CSRF in the config.php file. Up to you how comfortable you are with that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or use the CSRF token properly! I thought I could set the token statically but that's not the case (which is obvious in hindsight). It is unique to each browser and is set as a cookie.  To work with a pure JS set up this needs be set dynamically as a JS variable on page load. More information here: &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2017-08-10T01:48:57.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21525" PostTypeId="1" AcceptedAnswerId="21529" CreationDate="2017-08-10T09:15:55.687" Score="3" ViewCount="1353" Body="&lt;p&gt;I'm trying to add the ability to be able to align text left, right and center to my rich text fields. I have had a look into it and can only find a version which works perfect for body fields but not rich content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin I tried to use for this is here: &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also looked at redactorstyles which did the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there possibly a way to apply this to all fields or is there another way I could go about it in redactors standard.json? &lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2020-10-19T18:37:04.660" Title="Text Align Buttons for Rich Text Fields" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21527" PostTypeId="2" ParentId="21416" CreationDate="2017-08-10T20:10:09.740" Score="2" Body="&lt;p&gt;Sprout SEO is a conjunction of different fields when you save an entry it will send the values from the Sprout SEO field (title, description, ogImage, etc..) in the 'metadata' namespace. So, in order to override this value, you can follow the next example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;       if($entry-&amp;gt;type['handle'] === 'service'){&#xA;          $serviceContent = $entry-&amp;gt;linkToService-&amp;gt;first();&#xA;&#xA;          $seo = $entry-&amp;gt;getContent()-&amp;gt;seo;&#xA;          $seo['metadata']['optimizedDescription'] = &quot;Override description value&quot;;&#xA;          // Update it in the post request&#xA;         $entry-&amp;gt;setContentFromPost(array('seo' =&amp;gt; $seo));&#xA;      }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example I override the 'optimizedDescription' you can see all the properties in the 'sproutseo/models/SproutSeo_MetadataModel.php' File.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that you can also override any value on the front-end using &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/template-overrides&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; or add a Custom Format to specific values like the title or description using twig logic on your &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/core-concepts/element-metadata-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO field&lt;/a&gt; settings&lt;/p&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2017-08-10T20:10:09.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21528" PostTypeId="1" AcceptedAnswerId="21555" CreationDate="2017-08-10T20:48:57.393" Score="1" ViewCount="146" Body="&lt;p&gt;I'm building out a front end entry form with a Natrix and everything is coming along fine. However when users create a new row each new row needs to be unique in order to be saved. This is where I'm stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Simplified HTML:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;matrixblock&quot;&amp;gt;&#xA;    &amp;lt;p&amp;gt;&#xA;    block id: new_0&#xA;&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[staffProfiles][new_0][fields][employeeName]&quot; value=&quot;&quot; placeholder=&quot;Full Name&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.col-sm-6 --&amp;gt;&#xA;&amp;lt;div class=&quot;col-sm-6&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[staffProfiles][new_0][fields][jobTitle]&quot; value=&quot;&quot;  placeholder=&quot;Job Title&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.col-sm-6 --&amp;gt;&#xA;&#xA;&#xA;&amp;lt;a href=&quot;&quot; class=&quot;remove-row&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-times&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.matrixblock --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;JS:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var blocknum = 0;&#xA;&#xA;// add a new person&#xA;$('#addPerson').click(function(e){&#xA;    e.preventDefault();&#xA;    console.log('clicked addPerson');&#xA;&#xA;    //iterate blocknumber&#xA;    blocknum = blocknum+= 1;&#xA;    console.log('blocknum is ' + blocknum);&#xA;&#xA;    var newPerson = &quot;&amp;lt;div class='newperson'&amp;gt;&amp;lt;/div&amp;gt;&quot;;&#xA;    $('.newBlock').append(newPerson);&#xA;    $('.newBlock .newperson:last-child').load('/store/newperson');&#xA;&#xA;    // replace all instances of new_0 with new1, new2 etc.. as rows added&#xA;    // this line doesn't do anything, why?&#xA;    $('.newBlock .newperson:last-child').replace('new_0','new' + blocknum);&#xA;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;console.log('blocknum is ' + blocknum);&lt;/code&gt; is showing that the blocknum is increasing with each row. the &lt;strong&gt;Replace&lt;/strong&gt; in the last line of javascript is just not doing anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new person row gets added via ajax correctly but each time it's added [new_0] needs to be unique, but nothing I'm trying is working.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2017-08-14T05:11:04.043" LastActivityDate="2017-08-14T05:11:04.043" Title="How to update front end Craft new row - stuck on JavaScript" Tags="&lt;ajax&gt;&lt;javascript&gt;&lt;entry-form&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21529" PostTypeId="2" ParentId="21525" CreationDate="2017-08-10T21:39:50.373" Score="4" Body="&lt;p&gt;Per their &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras#configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;configuration docs&lt;/a&gt;, which also link to &lt;a href=&quot;https://craftcms.com/docs/rich-text-fields#redactor-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's docs&lt;/a&gt; on the subject, it looks like you'd just need to add &quot;alignment&quot; to the plugins portion of one of your &lt;code&gt;craft/config/redactor/&lt;/code&gt; JSON config files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;plugins&quot;: [&quot;alignment&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then whatever config you end up modifying, you'll want to make sure that config is selected under that field's settings in Craft (Settings-&gt;Fields-&gt;Your Rich Text Field).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-10T21:39:50.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21530" PostTypeId="2" ParentId="21528" CreationDate="2017-08-10T21:52:02.307" Score="1" Body="&lt;p&gt;You can get the number of rows you already have from the DOM, then use that to determine how many you'll have after you add a new one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#addPerson').click(function(e){&#xA;  e.preventDefault();&#xA;  console.log('clicked addPerson');&#xA;&#xA;  var newPerson = &quot;&amp;lt;div class='newperson'&amp;gt;&amp;lt;/div&amp;gt;&quot;;&#xA;  $('.newBlock').append(newPerson);&#xA;  $('.newBlock .newperson:last-child').load('/store/newperson');&#xA;&#xA;  var blocknum = $('.newBlock .newperson').length;&#xA;  $('.newBlock .newperson:last-child').replace('new_0','new' + blocknum);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;Also note that in your example you were replacing using &lt;code&gt;$blocknum&lt;/code&gt;, but you had defined it to be &lt;code&gt;blocknum&lt;/code&gt; without the &lt;code&gt;$&lt;/code&gt;.&lt;/del&gt; You've already fixed this :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this works out!&lt;/p&gt;&#xA;" OwnerUserId="4676" LastActivityDate="2017-08-10T21:52:02.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21531" PostTypeId="1" CreationDate="2017-08-10T22:05:20.240" Score="2" ViewCount="38" Body="&lt;p&gt;Original question from Craft Slack:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to hack the &lt;code&gt;AssetIndexTool&lt;/code&gt; to start at a certain asset/position/filename/index?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We’re using Rackspace Cloud Files and have around 25k images loaded. However, Cloud Files is limited to returning 10,000 objects per “page”. And it doesn’t look like Craft will paginate these objects. Wondering if we can just hack it to start the asset indexing at a certain place instead of starting at a certain index/filename, etc.&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2017-08-10T22:05:20.240" Title="Overcoming Rackspace Cloud Files 10,000 object limit" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21532" PostTypeId="2" ParentId="21531" CreationDate="2017-08-10T22:05:20.240" Score="2" Body="&lt;p&gt;Found the spot to hack this. It was not within the &lt;code&gt;AssetIndexTool&lt;/code&gt; as originally theorized, but in the  In &lt;code&gt;RackspaceAssetSourceType&lt;/code&gt; in the &lt;code&gt;_getFileList&lt;/code&gt; function you can append a &lt;code&gt;marker&lt;/code&gt; &lt;code&gt;marker_end&lt;/code&gt; and/or &lt;code&gt;limit&lt;/code&gt; to the file list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;marker&lt;/code&gt; should just be a URI without the extension. As an example, we change the parameters on &lt;code&gt;$targetUri&lt;/code&gt; to look like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;amp;format=json&amp;amp;marker=products/BC-174&amp;amp;limit=250';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will index the items form that marker and effectively ignore all the other assets you have already indexed. Craft will prompt you to delete the items you already have, as they are not found because you have skipped them by hacking the &lt;code&gt;$fileList&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found you can safely hit &lt;em&gt;Cancel&lt;/em&gt; and your items from the marker range will be imported, and your other indexes will not be affected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developer.rackspace.com/docs/cloud-files/v1/storage-api-reference/container-services-operations/#show-container-details-and-list-objects&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; is very helpful in finding out what you can do with the &lt;code&gt;marker&lt;/code&gt; params. &lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2017-08-10T22:05:20.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21533" PostTypeId="1" CreationDate="2017-08-11T01:51:40.253" Score="0" ViewCount="107" Body="&lt;p&gt;I have a search that is working locally, but not when I push it to my test environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imported the database from my local environment into test, so the data should exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL for each is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;test: &lt;a href=&quot;https://mytesturl/site/?q=test&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mytesturl/site/?q=test&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;local: &lt;a href=&quot;http://local/site/?q=test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://local/site/?q=test&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set the query, which returns null/empty in test, but populates correctly locally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set query = craft.request.getParam('q') %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm drawing a blank what could be wrong. Seems to be a config issue, but I'm not sure where to look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6512" LastEditorUserId="45" LastEditDate="2017-08-25T20:59:22.480" LastActivityDate="2017-09-24T21:45:10.397" Title="Craft request returns null in test, but works locally" Tags="&lt;query&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21534" PostTypeId="2" ParentId="21261" CreationDate="2017-08-11T05:37:37.227" Score="3" Body="&lt;p&gt;One pitfall: In Craft 2 I've had troubles with a script that created thousands of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CP totally hung because it could not process the numerous tasks that were created (tasks of the like 'updateUri' ..). This was probably due to time limits and memory consumption; tasks were not processed anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve that I created a &lt;a href=&quot;https://straightupcraft.com/craft-plugins/taskrunner&quot; rel=&quot;nofollow noreferrer&quot;&gt;task runner plugin&lt;/a&gt;, that processes a limited amount of tasks in the background through a cron job, and disables task execution on control panel access.&lt;/p&gt;&#xA;" OwnerUserId="6868" LastActivityDate="2017-08-11T05:37:37.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21535" PostTypeId="2" ParentId="21533" CreationDate="2017-08-11T06:09:46.377" Score="1" Body="&lt;p&gt;This sounds similar to your issue, have a look. People provided a solution there, it apparently might have something to do with your .htaccess file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10416/getparam-not-working-on-live-server?noredirect=1&amp;amp;lq=1&quot;&gt;getParam not working on live server?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5798" LastActivityDate="2017-08-11T06:09:46.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21537" PostTypeId="1" CreationDate="2017-08-11T07:27:11.973" Score="2" ViewCount="211" Body="&lt;p&gt;I have one of those questions that I have no idea how to phrase…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically Stripe is sending an email notification to my client's ‘accounts department’ on successful payment, but it only includes their email address and the value of their order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What they’ve requested is that it also includes the customer name in the email that goes to the accounts department.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From looking at the details of a Stripe Event I can see that none of the address details are in there, so either we’ve messed up with out integration, or commerce doesn’t send this info?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone able to shed some light on that?&lt;/p&gt;&#xA;" OwnerUserId="6272" LastEditorUserId="57" LastEditDate="2017-08-11T18:57:17.120" LastActivityDate="2017-08-11T18:57:17.120" Title="Including customer details in Stripe emails" Tags="&lt;plugin-craftcommerce&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21539" PostTypeId="2" ParentId="21537" CreationDate="2017-08-11T08:29:51.477" Score="3" Body="&lt;p&gt;Probably best to use Craft Commerce emails, then you can put whatever information you want into the emails to your accounts departments. Like: &lt;code&gt;{{ order.billingAddress.fullName }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the billing address information is not being sent to Stripe, you might need to modify your checkout.js or stripe.js payment screen implementation to ensure it sends the billing address information through along with the card info: &lt;a href=&quot;https://stripe.com/docs/stripe.js#stripe-create-token&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://stripe.com/docs/stripe.js#stripe-create-token&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other gateways, Stripe is building the card request within javascript to make the token, when our server sends the payment request, it only uses that token - no billing address is sent again.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-08-11T08:36:08.927" LastActivityDate="2017-08-11T08:36:08.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21540" PostTypeId="1" CreationDate="2017-08-11T13:31:28.823" Score="1" ViewCount="847" Body="&lt;p&gt;I have a Craft 3 beta project working fine on my local &lt;code&gt;laravel/homestead&lt;/code&gt; box using nginx, however when I push to Heroku using their &lt;code&gt;heroku-php-nginx&lt;/code&gt; build pack I get nginx (not Craft) 404s when trying to access the &lt;code&gt;/admin&lt;/code&gt; area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;Procfile&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;web: vendor/bin/heroku-php-nginx -C deploy/nginx.conf public/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my &lt;code&gt;deploy/nginx.conf&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    try_files $uri @rewriteapp;&#xA;}&#xA;&#xA;location @rewriteapp {&#xA;    rewrite ^(.*)$ /index.php?p=$1 last;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5470" LastEditorUserId="57" LastEditDate="2017-08-11T19:29:17.390" LastActivityDate="2017-08-11T19:29:17.390" Title="Craft 3 beta nginx config" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21542" PostTypeId="2" ParentId="21074" CreationDate="2017-08-11T15:11:46.080" Score="8" Body="&lt;p&gt;Here’s a simple plugin with two tabs and two fields, one field per tab. This plugin was generated on &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;. It’s a great starting point to get the plugin scaffolding set up. After that I added the code that I’ve included below to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should give you something like the following screenshot for the first tab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yBZrD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yBZrD.png&quot; alt=&quot;First tab of plugin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for the second tab it should look similar to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FIiba.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FIiba.png&quot; alt=&quot;Second tab of plugin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Folder Structure&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-] craft&#xA;   [-] plugins&#xA;      [-] myplugin&#xA;         [-] controllers&#xA;            |-- MyPlugin_TabOneController.php&#xA;            |-- MyPlugin_TabTwoController.php&#xA;         [+] resources&#xA;         [+] services&#xA;         [-] templates&#xA;            [-] _layouts&#xA;               |-- cp.twig&#xA;            [-] tabOne&#xA;               |-- _index.twig&#xA;            [-] tabTwo&#xA;               |-- _index.twig&#xA;         [+] translations&#xA;         [+] variables&#xA;         |-- MyPluginPlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/MyPluginPlugin.php&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'm only highlighting the functions that were necessary for the plugins to show up. Add or adjust them as needed.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;...&#xA;&#xA;public function registerCpRoutes()&#xA;{&#xA;    return array(&#xA;        'myplugin' =&amp;gt; ['action' =&amp;gt; &quot;myPlugin/tabOne/index&quot;],&#xA;        'myplugin/additional-settings' =&amp;gt; ['action' =&amp;gt; &quot;myPlugin/tabTwo/index&quot;],&#xA;        /**&#xA;         * Each 'action' relates to a controller in your plugin.&#xA;         * The names of your controller and these action must match.&#xA;         */&#xA;    );&#xA;}&#xA;&#xA;protected function defineSettings()&#xA;{&#xA;    return array(&#xA;        'someSetting' =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Some Setting', 'default' =&amp;gt; ''),&#xA;        'additionalSetting' =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Some Additional Setting', 'default' =&amp;gt; ''),&#xA;        /*...more settings here as needed...*/&#xA;    );&#xA;}&#xA;&#xA;public function getSettingsHtml()&#xA;{&#xA;   return craft()-&amp;gt;templates-&amp;gt;render('myplugin/MyPlugin_Settings', array(&#xA;       'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;   ));&#xA;}&#xA;&#xA;public function getSettingsUrl()&#xA;{&#xA;    return 'myplugin';&#xA;    /* This must be the same as the first segment in your cpRoutes. */&#xA;}&#xA;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/controllers/MyPlugin_TabOneController.php&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyPlugin_TabOneController extends BaseController&#xA;{&#xA;&#xA;    /**&#xA;     * @var    bool|array Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = array('actionIndex',&#xA;        );&#xA;&#xA;    /**&#xA;     */&#xA;    public function actionIndex()&#xA;    {&#xA;        $settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings();&#xA;        $this-&amp;gt;renderTemplate('myplugin/tabOne/_index', array(&#xA;            'settings' =&amp;gt; $settings,&#xA;        ));&#xA;        /**&#xA;         * The path above is to your templates folder in your plugin.&#xA;         */&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/controllers/MyPlugin_TabTwoController.php&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class MyPlugin_TabTwoController extends BaseController&#xA;{&#xA;&#xA;    /**&#xA;     * @var    bool|array Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = array('actionIndex',&#xA;        );&#xA;&#xA;    /**&#xA;     */&#xA;    public function actionIndex()&#xA;    {&#xA;        $settings = craft()-&amp;gt;plugins-&amp;gt;getPlugin('myPlugin')-&amp;gt;getSettings();&#xA;        $this-&amp;gt;renderTemplate('myplugin/tabTwo/_index', array(&#xA;            'settings' =&amp;gt; $settings,&#xA;        ));&#xA;        /**&#xA;         * The path above is to your templates folder in your plugin.&#xA;         */&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/templates/_layouts/cp.twig&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;It’s not necessary to break out the templates like I have here but it does help to keep from repeating your self in the templates, especially if you have several tabs.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% includeCssResource &quot;myplugin/css/Myplugin_Style.css&quot; %}&#xA;{% includeJsResource &quot;myplugin/js/Myplugin_Script.js&quot; %}&#xA;&#xA;{% set title = 'My Plugin' %}&#xA;&#xA;{% set tabs = {&#xA;    settings: { label: &quot;Settings&quot;|t, url: url('myplugin') },&#xA;    additionalSettings: { label: &quot;Additional Settings&quot;|t, url: url('myplugin/additional-settings') },&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/templates/tabOne/_index.twig&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;data-saveshortcut&lt;/code&gt; attribute on the form will allow you to use the keyboard shortcut to save your plugin’s settings by using &lt;kbd&gt;⌘ + S&lt;/kbd&gt; on a Mac. I’m assuming that &lt;kbd&gt;Ctrl + S&lt;/kbd&gt; works on Windows although I haven’t tried it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;myplugin/_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set selectedTab = 'settings' %}&#xA;&#xA;{% set content %}&#xA;&#xA;    &amp;lt;h2&amp;gt;Settings&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; data-saveshortcut data-confirm-unload&amp;gt;&#xA;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;plugins/savePluginSettings&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;pluginClass&quot; value=&quot;MyPlugin&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;myplugin&quot;&amp;gt;&#xA;&#xA;        {{ forms.textField({&#xA;            label: 'Some Setting',&#xA;            instructions: 'Enter some setting here.',&#xA;            id: 'settings-someSetting',&#xA;            name: 'settings[someSetting]', &#xA;            value: settings['someSetting']})&#xA;        }}&#xA;&#xA;        &amp;lt;div class=&quot;buttons&quot;&amp;gt;&#xA;            &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Save'|t }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;code&gt;myplugin/templates/tabOne/_index.twig&lt;/code&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Notice that you’ll need to set the &lt;code&gt;selectedTab&lt;/code&gt; in each template for the tabs to work correctly. This should match one of your keys that was set in the &lt;code&gt;tabs&lt;/code&gt; variable in the &lt;code&gt;myplugin/templates/_layouts/cp.twig&lt;/code&gt;. Also the hidden &lt;code&gt;redirect&lt;/code&gt; input in the form should be set to wherever you want to it end up. I noticed that it felt the best when it went back to the original page and it showed the saved values.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends &quot;myplugin/_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set selectedTab = 'additionalSettings' %}&#xA;&#xA;{% set content %}&#xA;&#xA;    &amp;lt;h2&amp;gt;Additional Settings&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; data-saveshortcut data-confirm-unload&amp;gt;&#xA;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;plugins/savePluginSettings&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;pluginClass&quot; value=&quot;MyPlugin&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;myplugin/additional-settings&quot;&amp;gt;&#xA;&#xA;        {{ forms.textField({&#xA;            label: 'Some Additional Setting',&#xA;            instructions: 'Enter some setting here.',&#xA;            id: 'settings-additionalSetting',&#xA;            name: 'settings[additionalSetting]', &#xA;            value: settings['additionalSetting']})&#xA;        }}&#xA;&#xA;        &amp;lt;div class=&quot;buttons&quot;&amp;gt;&#xA;            &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;{{ 'Save'|t }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should do it!&lt;/p&gt;&#xA;" OwnerUserId="3951" LastEditorUserId="3951" LastEditDate="2017-11-26T14:23:15.593" LastActivityDate="2017-11-26T14:23:15.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21543" PostTypeId="1" CreationDate="2017-08-11T15:20:37.757" Score="1" ViewCount="24" Body="&lt;p&gt;I'm trying to add a link to a front-end upload in an email notification.  The docs say &quot;To send notifications that include a direct link to your file, you can enable Template Overrides&quot;. I've done that, but all I can get is a link to a temporary file in cpresources/tempassets which doesn't exist any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see how the code in the docs could be used in the email.html override file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is from the docs: (&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/front-end-file-uploads&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/front-end-file-uploads&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resume = object.resumeAssetFieldHandle.first() %}&#xA;Resume: {{ resume.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work for me. Presumably resumeAssetFieldHandle is just an example field name but I don't know what the object is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have (after line 44)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if field.handle == 'uploadFile' %}&#xA;{{ value[0].getUrl() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives me the temp link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers to how I can get the permanent link?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7119" LastEditorUserId="7119" LastEditDate="2017-08-15T09:10:51.683" LastActivityDate="2017-10-28T11:48:09.890" Title="Link to a front-end upload in email notification using the Sprout Forms plugin" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21544" PostTypeId="2" ParentId="21490" CreationDate="2017-08-11T16:08:15.353" Score="1" Body="&lt;p&gt;Thanks @Brad, I created a plugin with &lt;code&gt;appointment_record_id&lt;/code&gt; (PK with auto increment), &lt;code&gt;customer_id&lt;/code&gt; and &lt;code&gt;timestamp&lt;/code&gt; table. I insert a record when system creates Appointment Record, and then I reference the &lt;code&gt;appointment_record_id&lt;/code&gt; as my id.&lt;/p&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-08-11T16:08:15.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21545" PostTypeId="1" AcceptedAnswerId="21559" CreationDate="2017-08-11T16:50:21.817" Score="1" ViewCount="200" Body="&lt;p&gt;I have 3 level structure for my entries with separate template for each level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/artists/artist-name/&lt;/code&gt; uses &lt;code&gt;artists/_types/artists.html&lt;/code&gt; template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/artists/artist-name/section-name/&lt;/code&gt; uses &lt;code&gt;artists/_types/section.html&lt;/code&gt; template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/artists/artist-name/section-name/project-name/&lt;/code&gt; uses &lt;code&gt;artists/_types/project.html&lt;/code&gt; template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need to do is to specify additional layout for level 3 entry so depending on URI I can display one or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the additional URI I want to use:&#xA;&lt;code&gt;/artists/artist-name/section-name/project-name/thumb&lt;/code&gt; and I want to load the &lt;code&gt;artists/_types/thumb.html&lt;/code&gt; template&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-08-13T11:49:08.817" Title="Specify which template/layout to use based on URI segment" Tags="&lt;templating&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21546" PostTypeId="2" ParentId="21540" CreationDate="2017-08-11T17:18:54.300" Score="1" Body="&lt;p&gt;This setup works fine with Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-11T17:18:54.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21547" PostTypeId="1" CreationDate="2017-08-11T18:09:41.677" Score="1" ViewCount="71" Body="&lt;p&gt;I’m currently redesigning a website for a scientific research institute that conducts research projects in multiple different areas, produces reports on those projects once they are complete, and then occasionally has that work published in scientific journals and periodicals. The institute has a list of ‘technical team members’ (scientists) that need to relate to these projects, reports and publications in some way. More specifically, I need to be able to specify “primary authors” (for reports and publications) and “primary investigators” (for projects).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit about how I have it set up: &#xA;I have four structures for each section: technical team, projects, reports, publications with entry types for indexes and details. I used structures so I could specify hierarchy in order to get URLs like “technical team/team member name”, “projects/project name”, etc. I used entry types so the client could edit the “overview content” on index pages (something not achievable with plain old _entry.html and index.html to my understanding). Also, this site is very big and this set up just worked for my content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for example, this is how I am currently relating team members to projects. I have a ‘Featured projects’ entries field in my “Team Member” entry where the client can choose projects that the team member has been a part of. ’Featured projects’ are a little more in depth and have more information than reports and publications, but the set up is pretty much the same for reports and publications - just with fewer fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In templates/technical-team/_types/teamMember.html to get featured projects in a sidebar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredProjects = craft.entries({&#xA;  section: 'projects',&#xA;  type: 'featuredProject',&#xA;}).relatedTo(entry) %}&#xA;{% if featuredProjects|length %}&#xA;    &amp;lt;div class=&quot;related-block&quot;&amp;gt;&#xA;        &amp;lt;h4&amp;gt;FEATURED PROJECTS&amp;lt;/h4&amp;gt;&#xA;        {% for project in featuredProjects %}&#xA;            &amp;lt;div class=&quot;related-item&quot;&amp;gt;&#xA;                {% if project.projectPhoto | length %}&#xA;                &amp;lt;img src=&quot;{{ project.projectPhoto.first.url('relatedPhoto') }}&quot; /&amp;gt;&#xA;                {% endif %}&#xA;                &amp;lt;div&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ project.url }}&quot;&amp;gt;{{ project.title }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ project.intro|striptags|slice(0,120)|default('Read more') }}...&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in templates/projects/_types/featuredProject.html to get related team members in a sidebar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set teamMembers = craft.entries.section('technicalTeam').relatedTo(entry) %}&#xA;{% for teamMember in teamMembers %}&#xA;    &amp;lt;div class=&quot;related-item&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ teamMember.bioPhoto.first.url }}&quot; width=&quot;80&quot; /&amp;gt;&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ teamMember.url }}&quot;&amp;gt;{{ teamMember.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ teamMember.teamMemberTitle }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ teamMember.url }}&quot; class=&quot;view-more&quot;&amp;gt;VIEW TEAM MEMBER &amp;lt;i class=&quot;fa fa-angle-right&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is working perfectly fine, btw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for my question: what would be the best way to denote that a ‘related team member’ is the “primary investigator” (for featured projects) and the “primary author” (for reports and publications)? Side note: there can be more than one primary investigator and primary author for these projects, reports and publications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to have would be, for example, on the report/publication “detail” it would pull the team member’s photo, name, and title (as it already does) and then, if they were the primary author, the words “primary author” would appear below their info. In the same way, on the team member detail page, it would list the reports or publications that are related to that team member and then, if they were the primary author, the words “primary author” would appear below the project info… you get the idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my only option to have them as separated entries fields? So, within a report entry I would have a “primary authors” tab with the ability to choose team members, and an “other authors” tab to choose all other team members involved? Perhaps, then I would add a &lt;code&gt;&amp;lt;span&amp;gt;primary author&amp;lt;/span&amp;gt;&lt;/code&gt; to the loop for primary authors? I feel like there has to be some sort of set up with categories, tags, or light switch fields that I can take advantage of but since this is my first time using Craft I’m not quite sure what that is. Appreciate any help/advice anyone can give!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per @Youniteus answer below, I have added a matrix field 'authors' to the report detail entry type which has two fields: 1. an entries field where the user can select entries from the 'technical team' section and 2. a light switch field that, when ticked on, displays the words &quot;primary author&quot; under that team member's bio. It's working great, here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.authors %}&#xA;  {% set relatedTeamMembers = craft.entries.section('technicalTeam').relatedTo(block) %}&#xA;  {% for entry in relatedTeamMembers %}&#xA;  &amp;lt;div class=&quot;related-item&quot;&amp;gt;&#xA;    &amp;lt;img src=&quot;{{ entry.bioPhoto.first.url }}&quot; width=&quot;80&quot; /&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.teamMemberTitle }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;view-more&quot;&amp;gt;VIEW TEAM MEMBER &amp;lt;i class=&quot;fa fa-angle-right&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% if block.primaryAuthor %}&#xA;            &amp;lt;p&amp;gt;Primary Author&amp;lt;/p&amp;gt;&#xA;        {% else %}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but on my team member's template (/templates/technical-team/_types/teamMember.html), I am unable to get the light switch's value. Only the related report's entry title and url. Here's how I'm getting that: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedReports = craft.entries.section('reports').relatedTo({&#xA;    targetElement: entry,&#xA;    field: 'authors',&#xA;}) %}&#xA;{% for entry in relatedReports %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried the following to get the light switch's value to no avail:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in relatedReports %}&#xA;    {% if block.primaryAuthor %}&#xA;        &amp;lt;p&amp;gt;Primary Author&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it even possible to get a &lt;em&gt;different&lt;/em&gt; field from a matrix block that contains a related entries field from that related entry? (hope that's not too confusing)&lt;/p&gt;&#xA;" OwnerUserId="7044" LastEditorUserId="7044" LastEditDate="2017-08-14T17:29:33.523" LastActivityDate="2017-08-14T17:29:33.523" Title="Specify ‘primary’ entries in list of related entries" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21550" PostTypeId="2" ParentId="21486" CreationDate="2017-08-11T20:19:46.600" Score="1" Body="&lt;p&gt;I think you could use the relatedTo parameters for this:&#xA;&lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations#the-relatedTo-param&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It basically allows you to filter elements based on their relationships with other elements. &lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-11T20:19:46.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21551" PostTypeId="2" ParentId="21547" CreationDate="2017-08-11T20:43:37.533" Score="1" Body="&lt;p&gt;Another option would be te create a matrix field that has a block that consists of both an entry field (with limit 1) and some other field to indicate whether the selected entry is a primary one. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An advantage of this approach is that you could easily add more &quot;statuses&quot;, such as primary, secondary. &lt;/li&gt;&#xA;&lt;li&gt;A disadvantage would be that the interface for editing these entries would be more complex /  little less straightforward. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-11T20:43:37.533" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21552" PostTypeId="2" ParentId="21294" CreationDate="2017-08-11T22:23:44.447" Score="2" Body="&lt;p&gt;I was able to get good results using &lt;code&gt;{{ block.myFieldName|nl2br|markdown }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-08-11T22:23:44.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21553" PostTypeId="1" CreationDate="2017-08-12T10:15:00.293" Score="1" ViewCount="258" Body="&lt;p&gt;Is there an easy way in Craft 3 to get all missing translations for a certain language after they were piped through the translate TWIG filter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'translate this text' | t }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-12T11:34:01.440" Title="Craft 3: Get missing translations" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21554" PostTypeId="2" ParentId="21553" CreationDate="2017-08-12T11:34:01.440" Score="1" Body="&lt;p&gt;There is a PhpStorm plugin that adds “Missing translations”, “Unused translations” and “Translation message correctness” inspections to the IDE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/kalessil/yii2inspections&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/kalessil/yii2inspections&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But unless I am missing something, it’s currently missing support for “Missing translations” inspections in Twig files. Both other features work well with Twig:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QsAcv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QsAcv.png&quot; alt=&quot;Unused translations inspection&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-08-12T11:34:01.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21555" PostTypeId="2" ParentId="21528" CreationDate="2017-08-12T14:19:57.563" Score="1" Body="&lt;p&gt;In the end I didn't get this working with replacing the new_0 in the fields array of the ajax content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I opted instead to limit adding new people to one at a time by having the new person button fade out when clicked and a message appearing stating:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;You must save your entry to add more staff&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the end this forces the store manager to save their work more often, which is always a good thing, and keeps the javascript simpler. Functionality that is required is working. Would be nice to add multiple people at a time, but for now a solution that everyone is happy with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;new javascript code is below. the .addMorePeople fadein contains the message about saving the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// add a new person&#xA;$('#addPerson').click(function(e){&#xA;    e.preventDefault();&#xA;    console.log('clicked addPerson');&#xA;&#xA;    var newPerson = &quot;&amp;lt;div class='newperson'&amp;gt;&amp;lt;/div&amp;gt;&quot;;&#xA;    $('.newBlock').append(newPerson);&#xA;    $('.newBlock .newperson:last-child').load('/store/newperson');&#xA;&#xA;    // hide add button so that they must save to add more&#xA;    $(this).fadeOut(&quot;slow&quot;, function(){&#xA;        $this.remove();&#xA;    });&#xA;    $('.addMorePeople').fadeIn('slow');&#xA;&#xA;    {# load redactor on the new row #}&#xA;    {% includeJs &quot;$('.newperson:last-child .employeeBio').redactor();&quot; %}&#xA;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-08-12T14:19:57.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21556" PostTypeId="1" AcceptedAnswerId="21560" CreationDate="2017-08-12T21:08:03.347" Score="2" ViewCount="224" Body="&lt;p&gt;I have an event calendar of sorts for music gigs. The back-end has sections for Artists and Venues, where I enter appropriate info, and another section, Shows, which I choose an artist, a venue, and enter the event date (in a custom field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template that pulls everything together grabs all future show dates, groups the dates by the artist, then checks each entry for fields before displaying it in the HTML, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#-- grab all current shows and order by date --#}&#xA;{% set all_shows = craft.entries.section('shows').gig_date('&amp;gt;=' ~ (now.date)).order('gig_date asc') %}&#xA;&#xA;{#-- group shows by artist --#}&#xA;{% set artist_shows = all_shows|group('gig_artist.first()') %}&#xA;&#xA;{% for artist, shows in artist_shows %}&#xA;&#xA;    {#-- artist title --#}&#xA;    &amp;lt;h3&amp;gt;{% if shows[0].gig_artist[0].artist_url|length %}&amp;lt;a href=&quot;{{ shows[0].gig_artist[0].artist_url }}&quot;&amp;gt;{{ artist }}&amp;lt;/a&amp;gt;{% else %}{{ artist }}{% endif %}&amp;lt;/h3&amp;gt;&#xA;&#xA;    &amp;lt;table&amp;gt;&#xA;        &amp;lt;tbody&amp;gt;&#xA;&#xA;            {#-- shows list --#}&#xA;            {% for show in shows %}&#xA;&#xA;                &amp;lt;tr&amp;gt;&#xA;                    &amp;lt;td class=&quot;gig_date&quot;&amp;gt;&#xA;&#xA;                        {#-- date --#}&#xA;                        &amp;lt;time title=&quot;{{ show.gig_date.w3c }}&quot;&amp;gt;{{ show.gig_date|date('F j') }}&amp;lt;/time&amp;gt;&#xA;                    &amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td class=&quot;gig_venue&quot;&amp;gt;&#xA;&#xA;                        {#-- venue name and website--#}&#xA;                        {% if show.gig_venue[0].venue_url|length %}&amp;lt;a href=&quot;{{ show.gig_venue[0].venue_url }}&quot;&amp;gt;{{ show.gig_venue[0].title }}&amp;lt;/a&amp;gt;{% else %}{{ show.gig_venue[0].title }}{% endif %}&#xA;&#xA;                        {#-- city --#}  &#xA;                        {% if show.gig_venue[0].venue_city|length %}, {{ show.gig_venue[0].venue_city }}{% endif %}&#xA;&#xA;                        {#-- state --#}&#xA;                        {% if show.gig_venue[0].venue_state|length %} {{ show.gig_venue[0].venue_state }}{% endif %}&#xA;&#xA;                        {#-- notes --#}&#xA;                        {% if show.gig_notes|length %}&amp;lt;div class=&quot;gig_notes&quot;&amp;gt;{{ show.gig_notes }}&amp;lt;/div&amp;gt;{% endif %}&#xA;                    &amp;lt;/td&amp;gt;&#xA;&#xA;                &amp;lt;/tr&amp;gt;&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/tbody&amp;gt;    &#xA;    &amp;lt;/table&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This page takes several seconds to render on my site versus the other pages. I've tried this without the &lt;code&gt;|group&lt;/code&gt; filtering, and without the date comparison, and it's still equally slow, which leads me to believe it's the pinging the multiple entry fields that's slowing things down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a hunch eager loading will be helpful, but unfortunately I can't wrap my brain around it at this level. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7076" LastEditorUserId="45" LastEditDate="2017-08-25T20:59:02.707" LastActivityDate="2017-08-25T20:59:02.707" Title="How to improve performance of this nested entries/array template?" Tags="&lt;templating&gt;&lt;entrymodel&gt;&lt;eager-loading&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21557" PostTypeId="2" ParentId="21556" CreationDate="2017-08-13T07:12:34.840" Score="4" Body="&lt;p&gt;Have you considered to cache the whole output? &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2017-08-13T07:12:34.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21559" PostTypeId="2" ParentId="21545" CreationDate="2017-08-13T11:49:08.817" Score="1" Body="&lt;p&gt;I'm not completely sure about what you're asking, but you might want to look in to craft.request:&#xA; &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.request&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your structure template, you can check your URL segments, and use twig include to load the desired template, based on those segments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another related feature is dynamic routing:&#xA;&lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/routing#dynamic-routes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use this to route a URL to a different template. &lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-13T11:49:08.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21560" PostTypeId="2" ParentId="21556" CreationDate="2017-08-13T19:04:57.250" Score="4" Body="&lt;p&gt;Caching will improve performance, but the actual issue is that your code is generating a lot of queries. You should look into eager loading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/eager-loading-elements&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is that you predefine what sub-elements you're going to need (in your case gig_artist and gig_venue), so that Craft can preload them instead of loading them when Craft encounters them in your code (and do less efficient queries). &lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-13T19:04:57.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21562" PostTypeId="2" ParentId="44" CreationDate="2017-08-14T01:10:45.180" Score="1" Body="&lt;p&gt;I tried using the codes found here but couldn't get my 404 page to work without getting a twig_error page so I had to look for another language switcher. I found &lt;a href=&quot;https://craftcms.stackexchange.com/a/1659/6586&quot;&gt;this code&lt;/a&gt; and just added in my css  .nav-link.current {display: none;} ( Finally a language switcher that won't give me errors. Even if the entry doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locales = ['en', 'fr'] %}&#xA;{% for locale in locales %}&#xA;&#xA;&amp;lt;!-- Check if locale equals the requested page locale --&amp;gt;&#xA;{% if locale == craft.locale %}&#xA;    {% set current = true %}&#xA;{% else %}&#xA;    {% set current = false %}&#xA;{% endif %}&#xA;&#xA;&#xA;&amp;lt;!-- Is this an entry page? --&amp;gt;&#xA;{% if entry is defined %}&#xA;&#xA;&#xA;    &amp;lt;!-- Find the current entry in the other locale --&amp;gt;&#xA;    {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}&#xA;&#xA;    &amp;lt;!-- Make sure that the localised entry exists --&amp;gt;&#xA;    {% if localeEntry %}&#xA;&#xA;        {# Make sure that it's actually localized to this locale#}&#xA;        {% if localeEntry.locale == locale %}&#xA;&#xA;            {# Output a link to it #}&#xA;            &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;            {# Output a link to the hompage #}&#xA;            &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;    {% else %}&#xA;&#xA;        {# Output a link to the hompage #}&#xA;        &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{# Not an entry page #}&#xA;{% else %}&#xA;&#xA;    {# Output the same path with the locale's base URL (`siteUrl`) #}&#xA;    &amp;lt;a href=&quot;{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}&quot; class=&quot;nav-link{{ current ? ' current'}}&quot;&amp;gt;{{ craft.i18n.getLocaleById(locale).id[:2] }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2017-08-14T01:10:45.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21563" PostTypeId="2" ParentId="18153" CreationDate="2017-08-14T01:14:09.453" Score="1" Body="&lt;p&gt;Probably what you're seeing the the generic webserver 404 error page... which means there's something wrong with your server config, as its not sending 404's to Craft to handle.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-14T01:14:09.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21565" PostTypeId="2" ParentId="18615" CreationDate="2017-08-14T11:37:06.717" Score="1" Body="&lt;p&gt;Forgot about this question!&#xA;I've since solved it by using a different approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm injecting the broser-sync script via its config, avoiding injection if the url is '/admin/', and redirecting to :8000 if '/admin/' is visited from :3000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my whole working browser-sync.js config file, for those few other souls searching for something similar: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I'm auto-injecting the webpack dev build with this config as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const sync = 3000&#xA;const script = 'browser-sync-client.js'&#xA;&#xA;const php = 8000&#xA;const webpack = 1337&#xA;const adminPath = '/admin/'&#xA;const address = require('ip').address()&#xA;&#xA;&#xA;&#xA;module.exports = {&#xA;    port: sync,&#xA;    proxy: {target: `${address}:${php}`},&#xA;&#xA;    files: [&#xA;        'source/layout.twig',&#xA;        'source/pages/*.twig',&#xA;        'source/components/*.twig'&#xA;    ],&#xA;&#xA;&#xA;&#xA;    ui: false,&#xA;    open: false,&#xA;    notify: false,&#xA;    ghostMode: false,&#xA;    socket: {clientPath: ''},&#xA;&#xA;    logLevel: 'info',&#xA;    logPrefix: 'Browser-sync',&#xA;&#xA;    watchEvents: ['change', 'add'],&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;    rewriteRules: [&#xA;        {match: /&amp;lt;\/head&amp;gt;/i, fn(request, result, match) {&#xA;            return `&amp;lt;script src=&quot;http://${address}:${webpack}/build.js&quot;&amp;gt;&amp;lt;/script&amp;gt;` + match&#xA;        }}&#xA;    ],&#xA;&#xA;    snippetOptions: {&#xA;        ignorePaths: adminPath + '*',&#xA;        rule: {&#xA;            match: /&amp;lt;\/body&amp;gt;/i,&#xA;            fn(snippet, match) {&#xA;                return `&amp;lt;script src=&quot;http://${address}:${sync}/${script}&quot;&amp;gt;&amp;lt;/script&amp;gt;` + match&#xA;            }&#xA;        }&#xA;    },&#xA;&#xA;    middleware: [function(request, result, next) {&#xA;        if (request.url.startsWith(adminPath)) {&#xA;            result.writeHead(301, {Location: `http://${address}:${php}${request.url}`})&#xA;            result.end()&#xA;        } else {&#xA;            next()&#xA;        }&#xA;    }]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3717" LastActivityDate="2017-08-14T11:37:06.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21566" PostTypeId="1" AcceptedAnswerId="21571" CreationDate="2017-08-14T13:13:37.727" Score="1" ViewCount="521" Body="&lt;p&gt;I need to get data from fields from another section. &#xA;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% for kontaktEntry in craft.entries.section('kontakt').entry.kontakter %}&#xA;            &amp;lt;div&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ kontaktEntry.epost }}&quot;&amp;gt;&#xA;                    {% set image = kontaktEntry.bilde.first() %}&#xA;                    {% if image %}&#xA;                        &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;100&quot; height=&quot;100&quot; alt=&quot;{{kontaktEntry.navn}}&quot;/&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;h3 class=&quot;center&quot;&amp;gt;{{ kontaktEntry.navn }}&amp;lt;/h3&amp;gt;&#xA;                    {{ kontaktEntry.stilling }}&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;kontakter is a matrix. I get nothing in output. What is wrong here? &lt;/p&gt;&#xA;" OwnerUserId="6781" LastEditorUserId="6991" LastEditDate="2017-08-14T14:42:34.777" LastActivityDate="2017-08-15T07:09:32.987" Title="How to get fields from another section?" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21567" PostTypeId="1" AcceptedAnswerId="21592" CreationDate="2017-08-14T17:57:39.473" Score="1" ViewCount="775" Body="&lt;p&gt;I am attempting to list out all jobs that the current author has created but which are not already to other entries they've created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have both an array and a string containing the entry ids to exclude which I can see with these tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# delete later, only here to visually show entry ids while coding #}&#xA;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;array:&amp;lt;/strong&amp;gt; {{ excludeRelatedJobs|join(', ') }}&amp;lt;/p&amp;gt;&#xA;&#xA;{# convert array to string #}&#xA;{% set excludedJobs = excludeRelatedJobs|join(', ') %}&#xA;&#xA;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;string:&amp;lt;/strong&amp;gt; {{ excludedJobs }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when I try to exclude the ids from the list they are not excluded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;current code that should exclude ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set careers = craft.entries.section('careers').authorId(user.id).id('not' ~ excludedJobs) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for job in careers %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/careers/edit/{{ job.id }}&quot;&amp;gt;{{ job.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I manually exclude the id like this it works correctly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set careers = craft.entries.section('careers').authorId(user.id).id('not 581') %}&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-08-16T16:12:23.283" Title="exclude list of entries from craft.entries tag" Tags="&lt;templating&gt;&lt;id&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21568" PostTypeId="1" CreationDate="2017-08-14T19:51:05.843" Score="1" ViewCount="3403" Body="&lt;p&gt;I'm not 100% sure this is a Craft specific problem, but I'll try here, as it relates to a Craft installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After running a number of tests, it seems that my CSS and JavaScript files are not getting GZIP-ed. I have a &lt;code&gt;.htaccess&lt;/code&gt; file in my &lt;code&gt;public&lt;/code&gt; folder, and no &lt;code&gt;.htaccess&lt;/code&gt; files in the subfolders below. My CSS and JS files are stored in &lt;code&gt;/assets/css&lt;/code&gt;and &lt;code&gt;/assets/js&lt;/code&gt; respectively (relative to the &lt;code&gt;public&lt;/code&gt;folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My .htaccess file looks like this. Is there something I'm doing wrong? I thought the settings of the &lt;code&gt;.htacces&lt;/code&gt; should work for subfolders when not overridden?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /&#xA;    RewriteOptions InheritDown&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA;  AddOutputFilterByType DEFLATE application/javascript&#xA;  AddOutputFilterByType DEFLATE application/rss+xml&#xA;  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject&#xA;  AddOutputFilterByType DEFLATE application/x-font&#xA;  AddOutputFilterByType DEFLATE application/x-font-opentype&#xA;  AddOutputFilterByType DEFLATE application/x-font-otf&#xA;  AddOutputFilterByType DEFLATE application/x-font-truetype&#xA;  AddOutputFilterByType DEFLATE application/x-font-ttf&#xA;  AddOutputFilterByType DEFLATE application/x-javascript&#xA;  AddOutputFilterByType DEFLATE application/xhtml+xml&#xA;  AddOutputFilterByType DEFLATE application/xml&#xA;  AddOutputFilterByType DEFLATE font/opentype&#xA;  AddOutputFilterByType DEFLATE font/otf&#xA;  AddOutputFilterByType DEFLATE font/ttf&#xA;  AddOutputFilterByType DEFLATE image/svg+xml&#xA;  AddOutputFilterByType DEFLATE image/x-icon&#xA;  AddOutputFilterByType DEFLATE text/css&#xA;  AddOutputFilterByType DEFLATE text/html&#xA;  AddOutputFilterByType DEFLATE text/javascript&#xA;  AddOutputFilterByType DEFLATE text/plain&#xA;  AddOutputFilterByType DEFLATE text/xml&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2018-11-28T14:51:22.620" Title="GZIP seems to compress only HTML, not CSS or JavaScript" Tags="&lt;htaccess&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21569" PostTypeId="2" ParentId="21507" CreationDate="2017-08-14T20:56:43.240" Score="1" Body="&lt;p&gt;I got the images to upload into correct folders by switching Image field to &quot;Restrict uploads to a single folder&quot; option. I also had to fix the File System Path in Settings&gt;Assets&gt;Asset Sources to the full file system path.&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-08-14T20:56:43.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21570" PostTypeId="2" ParentId="21471" CreationDate="2017-08-15T00:37:44.917" Score="2" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Generate name and handle.&#xA;$globalSetName = &quot;My Global Set&quot;;&#xA;$globalSetHandle = lcfirst(str_replace(&quot; &quot;,&quot;&quot;, ucwords($globalSetName)));&#xA;&#xA;// Create a global set&#xA;$globalSet= new GlobalSetModel();&#xA;$globalSet-&amp;gt;name = $globalSetName;&#xA;$globalSet-&amp;gt;handle = $globalSetHandle;&#xA;&#xA;// get all the fields from  fieldgroup&#xA;$fields = $fieldGroup-&amp;gt;getFields();&#xA;&#xA;// Get ids of the fields.&#xA;$fieldIds = array();&#xA;foreach ($fields as $field)&#xA;{&#xA;    $fieldIds[] = $field-&amp;gt;id;&#xA;}&#xA;&#xA;// Assemble the field layout&#xA;$globalSetLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout(&#xA;    array(&#xA;        'Content' =&amp;gt; $fieldIds,&#xA;    )&#xA;);&#xA;&#xA;// Set the field layout type.&#xA;$globalSetLayout-&amp;gt;type = ElementType::GlobalSet;&#xA;&#xA;// Set field layout on global set.&#xA;$globalSet-&amp;gt;setFieldLayout($globalSetLayout);&#xA;&#xA;// Save global set.&#xA;craft()-&amp;gt;globals-&amp;gt;saveSet($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-08-16T19:37:37.083" LastActivityDate="2017-08-16T19:37:37.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21571" PostTypeId="2" ParentId="21566" CreationDate="2017-08-15T07:09:32.987" Score="3" Body="&lt;p&gt;I'm not sure that .entry is a valid parameter? I think that craft.entries.section('kontakt') contains an array with entries, so maybe you you could do .first on it, so basically I think you wanted to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for kontaktEntry in craft.entries.section('kontakt').first.kontakter %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ kontaktEntry.epost }}&quot;&amp;gt;&#xA;                {% set image = kontaktEntry.bilde.first() %}&#xA;                {% if image %}&#xA;                    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; width=&quot;100&quot; height=&quot;100&quot; alt=&quot;{{kontaktEntry.navn}}&quot;/&amp;gt;&#xA;                {% endif %}&#xA;                &amp;lt;h3 class=&quot;center&quot;&amp;gt;{{ kontaktEntry.navn }}&amp;lt;/h3&amp;gt;&#xA;                {{ kontaktEntry.stilling }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-15T07:09:32.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21572" PostTypeId="1" AcceptedAnswerId="21574" CreationDate="2017-08-15T07:42:50.607" Score="1" ViewCount="745" Body="&lt;p&gt;We're currently having an Android-App access some of the entries of our Craft-based website. We are currently still using a self built API, and for easier creation of new API-Calls we are trying to migrate over to Pixel &amp;amp; Tonic's Element API plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries (or the blocks of a Matrix-field of that entry, to be more precise) are accessed like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/alloverlist' =&amp;gt; function() { // GET ALLOVER-CHALLENGES&#xA;        return [&#xA;            'elementType' =&amp;gt; ElementType::Entry,&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'challenges',&#xA;                ],&#xA;            'paginate' =&amp;gt; false,&#xA;            'first' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function(EntryModel $entry){&#xA;&#xA;                $allOverChallenges = [];&#xA;                foreach ($entry-&amp;gt;allOverChallenge as $challenge){&#xA;                    $allOverChallenges[] = [&#xA;                        'elementId' =&amp;gt; $challenge-&amp;gt;id,&#xA;                        'field_allOverChallenge_allOverName' =&amp;gt; $challenge-&amp;gt;allOverName,&#xA;                    ];&#xA;                }&#xA;&#xA;                return [&#xA;                    $allOverChallenges&#xA;                ];&#xA;            },&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The returned JSON-String has the following appearance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;[&#xA;    {&#xA;        &quot;elementId&quot;: &quot;1298&quot;,&#xA;        &quot;field_allOverChallenge_allOverName&quot;: &quot;Dein schönster Sonnenaufgang&quot;&#xA;    },&#xA;    {&#xA;        &quot;elementId&quot;: &quot;1310&quot;,&#xA;        &quot;field_allOverChallenge_allOverName&quot;: &quot;AllOverChallenge2&quot;&#xA;    },&#xA;    {&#xA;        &quot;elementId&quot;: &quot;1318&quot;,&#xA;        &quot;field_allOverChallenge_allOverName&quot;: &quot;Allover Challenge 3&quot;&#xA;    }&#xA;]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the Android-App accepts the JSON-String just with single square-brackets, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;   {&#xA;     &quot;key&quot;:&quot;value&quot;,&#xA;      ...&#xA;   },&#xA;&#xA;   {&#xA;     &quot;key&quot;:&quot;value&quot;,&#xA;      ...&#xA;   }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the sake of not having to change the existing Android-App, is it somehow possible to remove the additional square brackets? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-08-16T11:41:14.400" LastActivityDate="2017-08-16T11:41:14.400" Title="Element API: Remove additional set of square brackets from JSON-String" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21573" PostTypeId="1" CreationDate="2017-08-15T08:16:06.157" Score="1" ViewCount="544" Body="&lt;p&gt;I use MAMP Pro for a few years in combination with Craft CMS, but since the new upgrade to version 4 I cannot upload JPGs anymore. Dit anybody had the same issue and how to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the PHP7.0.20.ini there's a line says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MAMP_Imagick_MAMPextension=imagick.so&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And these are the settings for resource limits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_execution_time = 240&#xA;max_input_time = 240&#xA;memory_limit = 1024M &#xA;upload_max_filesize = 32M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's different from earlier versions, so it looks like ImageMagick is loaded?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers, Martijn&lt;/p&gt;&#xA;" OwnerUserId="4775" LastEditorUserId="4775" LastEditDate="2017-08-15T08:21:11.430" LastActivityDate="2017-08-15T13:23:12.257" Title="Problem uploading JPG in MAMP Pro 4.2 (9213)" Tags="&lt;assets&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21574" PostTypeId="2" ParentId="21572" CreationDate="2017-08-15T09:57:48.693" Score="3" Body="&lt;p&gt;Though I don't know the Element API, have you tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    return $allOverChallenges;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    return [&#xA;        $allOverChallenges&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like you are simply adding these brackets (Array) on the return.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-15T09:57:48.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21575" PostTypeId="1" CreationDate="2017-08-15T10:10:13.230" Score="0" ViewCount="285" Body="&lt;p&gt;Is it possible to cache a variable assignment and/or an element query with TWIG in Craft 3? With Yii2 this is possible, but is there a wrapper to TWIG?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 use cases:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.someThingVerySlowHere() %}&#xA;{% set myObject = customVerySlowTwigFunction(...) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why would I want to do that? Let's assume I have 2 blocks in my page, both make use of the variables assigned above, then I can not cache this within the block itself (where the &lt;code&gt;{% cache %}&lt;/code&gt; tag belongs, unless I assign/query twice.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-15T10:20:02.247" Title="Craft 3: Cache element query or variable assignment" Tags="&lt;templating&gt;&lt;cache&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21576" PostTypeId="2" ParentId="21575" CreationDate="2017-08-15T10:20:02.247" Score="-1" Body="&lt;p&gt;The request makes sense, but I thought that Craft did some magic to make sure that a duplicate query/variable-assignment wasn't an issue by re-using the query internally. I have &lt;em&gt;no idea&lt;/em&gt; why I think that though.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-08-15T10:20:02.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21578" PostTypeId="1" AcceptedAnswerId="21622" CreationDate="2017-08-15T11:36:31.680" Score="1" ViewCount="86" Body="&lt;p&gt;I'm trying to limit the results to 5, but its returning all of the results instead. I am using the below code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;  cache : false,&#xA;  query : {&#xA;    limit : 5&#xA;  }&#xA;} %}&#xA;&#xA;{% set timeline = craft.placid.request('projectsLatestTrending', options ) %}&#xA;&#xA;&amp;lt;ol&amp;gt;&#xA;{% for tweet in timeline.data %}&#xA;  &amp;lt;li&amp;gt;{{ tweet.name }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="57" LastEditDate="2017-08-15T17:43:04.150" LastActivityDate="2017-08-17T20:21:18.143" Title="Placid plugin - limit returned results" Tags="&lt;json&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21579" PostTypeId="2" ParentId="21578" CreationDate="2017-08-15T12:42:11.183" Score="1" Body="&lt;p&gt;Not a true answer, but a work around:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tweet in timeline.data %}&#xA;    {% if loop.index &amp;lt;= 5 %}&#xA;        ...&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-08-15T12:42:11.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21580" PostTypeId="2" ParentId="21573" CreationDate="2017-08-15T13:23:12.257" Score="5" Body="&lt;p&gt;I found the answer: in the main window of MAMP Pro there's a sidebar with a sub heading Languages &gt; PHP. When you click that and check the option under Extensions: Imagick / ImageMagick, all my problems disappear and I can upload JPG and PNG.&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2017-08-15T13:23:12.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21581" PostTypeId="1" CreationDate="2017-08-15T15:01:39.997" Score="2" ViewCount="411" Body="&lt;p&gt;I'm trying to set dynamic upload locations for my asset fields that are in a Super Table field within a Matrix field. So it's Matrix &gt; Super Table &gt; Asset field. I'm getting the following error when I save an entry, though. &lt;code&gt;Could not resolve the subpath “{owner.section.handle}/{owner.slug}”.&lt;/code&gt;&#xA;Omitting the &lt;code&gt;owner&lt;/code&gt; part doesn't work either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5233" LastActivityDate="2017-09-16T05:46:33.943" Title="Dynamic upload location for Super Table within a Matrix field?" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21582" PostTypeId="2" ParentId="21578" CreationDate="2017-08-15T18:10:09.063" Score="1" Body="&lt;p&gt;I managed to solve this using the slice filter. Short hand shown below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your input Matt Wilcox. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tweet in timeline.data[0:5] %}&#xA;&#xA;    ...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-08-15T18:10:09.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21583" PostTypeId="1" AcceptedAnswerId="21600" CreationDate="2017-08-15T19:20:04.667" Score="0" ViewCount="604" Body="&lt;p&gt;Is there any configuration hint for enabling memcache in Craft 3? I'm on 3-beta-24&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheMethod' =&amp;gt; 'memcache',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to config/general.php, but this did neither cause any hits on memcache nor any error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft 2 (sic!) docs say you also need &lt;em&gt;config/memcache.php&lt;/em&gt;, which I created&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;returning an empty array&lt;/li&gt;&#xA;&lt;li&gt;returning an array containing the properties I found in *app/vendor/craftcms/cms/src/config/MemCacheConfig.php:&lt;/li&gt;&#xA;&lt;li&gt;returning a 2 dimensional array with the the first array containing the properties from 2. above&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Nothing worked, but 2. &amp;amp; 3. throw unknown property exceptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my memcache.php (according to variant 3. above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    [        // A memcached server hostname or IP address.&#xA;        'host' =&amp;gt; 'localhost',&#xA;        // Whether or not to use a persistent connection.&#xA;        'persistent' =&amp;gt; true,&#xA;        // The memcached server port.&#xA;        'port' =&amp;gt; 11211,&#xA;        // How often a failed server will be retried (in seconds).&#xA;        'retryInterval' =&amp;gt; 15,&#xA;        // If the server should be flagged as online upon a failure.&#xA;        'status' =&amp;gt; true,&#xA;        // The value in seconds which will be used for connecting to the server.&#xA;        'timeout' =&amp;gt; 15,&#xA;        // Probability of using this server among all servers.&#xA;        'weight' =&amp;gt; 1,&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the exception:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unknown Property – yii\base\UnknownPropertyException&#xA;Setting unknown property: craft\config\MemCacheConfig::0&#xA; in .../app/vendor/yiisoft/yii2/base/Object.php at line 161&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;looks like the config can't handle multiple memcache servers as array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the stacktrace: &lt;a href=&quot;https://pastebin.ca/3855627&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.ca/3855627&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="6886" LastEditDate="2017-08-16T07:54:31.853" LastActivityDate="2017-08-16T19:34:58.677" Title="Craft 3: Enabling Memcache" Tags="&lt;cache&gt;&lt;config&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21584" PostTypeId="2" ParentId="17796" CreationDate="2017-08-16T05:56:32.953" Score="1" Body="&lt;p&gt;We tried a lot of things to fix this but could not as yet. We tried Nginx config chnages, and on a different server htaccess setting changes, having settings in the config like enableCsrfProtection off, usePathInfo' =&gt; true etc. The requireElevatedSession works ok for us on change a users password etc so this did not seem to be the problem as some other users have had.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way we could get around this for now was by editing the Charge plugin to stop the requireElevatedSession (Asks for a password before doing anything). I hope everything is ok with Joel at SquareBit as his support before on this plugin was excellent, but have had no reply from the last few months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We changed:&#xA;'craft/plugins/charge/controllers/Charge_ChargesController.php'&#xA;lines 113 and 175 and Comment out/remove &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//$this-&amp;gt;requireElevatedSession();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in 'craft/plugins/charge/templates/payment/_view.html' removed JS calls&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//new Craft.ElevatedSessionForm('.charge-refund-action');&#xA;//new Craft.ElevatedSessionForm('.charge-recur-cancel-action');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, or if anyone knows of a better fix?&lt;/p&gt;&#xA;" OwnerUserId="5838" LastActivityDate="2017-08-16T05:56:32.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21585" PostTypeId="1" CreationDate="2017-08-16T08:45:54.993" Score="2" ViewCount="356" Body="&lt;p&gt;Scenario:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Live server where customer adds content and articles, which are store&#xA;in the database&lt;/li&gt;&#xA;&lt;li&gt;Staging server where we add new functionality, fields, sections and more&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When the development of the new functionality on the staging server is complete, it should be merged with the new content of the live server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How easy is this to handle? Is it as easy as just importing the staging db server into the live server one? Will not existing content be overwritten?&lt;/p&gt;&#xA;" OwnerUserId="6380" LastActivityDate="2017-08-16T13:19:23.310" Title="What is the most adviceable way to combine a staging and live database?" Tags="&lt;database&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21586" PostTypeId="1" AcceptedAnswerId="21587" CreationDate="2017-08-16T09:11:05.773" Score="2" ViewCount="286" Body="&lt;p&gt;Is there any plugin that allows admin user to edit localization files from backend interface?&lt;/p&gt;&#xA;" OwnerUserId="6620" LastActivityDate="2017-08-16T09:57:39.640" Title="Editing translation files from backend" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21587" PostTypeId="2" ParentId="21586" CreationDate="2017-08-16T09:57:39.640" Score="2" Body="&lt;p&gt;I think this &lt;a href=&quot;https://github.com/boboldehampsink/translate&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; does what you want. It allows editing the translations for any static text passed trough Crafts translate functions &amp;amp; filters. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-16T09:57:39.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21588" PostTypeId="1" AcceptedAnswerId="21597" CreationDate="2017-08-16T11:15:34.263" Score="1" ViewCount="552" Body="&lt;p&gt;Are there any image manipulation options in Craft 3? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like grayscale or so?&#xA;(what imager does for Craft 2: &lt;a href=&quot;https://imager.vaersaagod.no/?img=5&amp;amp;demo=basic-image-adjustments&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imager.vaersaagod.no/?img=5&amp;amp;demo=basic-image-adjustments&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-08-16T19:26:01.670" Title="Craft 3: Image transformation - grayscale" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21589" PostTypeId="2" ParentId="21585" CreationDate="2017-08-16T12:47:37.973" Score="3" Body="&lt;p&gt;The way we do it is we take a copy of the live database when we begin development work, do the dev work on local/stage, get sign off... then manually add the new fields etc onto the live database. Otherwise, you're going to lose data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of any way you could automagically merge two different databases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method to help speed up copying fields from one database to another (which is what you're doing) is to use the &lt;a href=&quot;https://github.com/engram-design/FieldManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Field Manager&lt;/a&gt; plugin, which can export fields as JSON from your staging version, and you can import that JSON using Field Manager again on the live version. You'll still need to manually assign those fields to the associated sections.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-08-16T12:47:37.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21590" PostTypeId="2" ParentId="21585" CreationDate="2017-08-16T13:19:23.310" Score="1" Body="&lt;p&gt;Another way you could try is to check out &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt; written by @nystudio107 on the Slack channel. I'm sure he'd be able to help with any sticking points.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-08-16T13:19:23.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21591" PostTypeId="1" CreationDate="2017-08-16T14:10:53.243" Score="1" ViewCount="118" Body="&lt;p&gt;We are using Charge and have two custom fields we want to populate when a charge is successful. One works and one doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can get it to populate a &quot;pageTitle&quot; field which is pretty standard as a hidden field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other field's value needs to change based on the selected planChoice - this one doesn't save anything. The Charge works but the custom field remains blank. Any ideas how to get this to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's stripped down code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form ...&amp;gt;&#xA;    ... charge specific default stuff ...&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[pageTitle]&quot; value=&quot;{{ entry.title | e }}&quot;/&amp;gt;&amp;lt;!-- This is a custom field on the Charge, that does get saved --&amp;gt;&#xA;&#xA;    {% set options = {&#xA;        'planChoices' : {&#xA;            'two' : {&#xA;                'label' : &quot;This is a standard Charge field #{entry.title}&quot;,&#xA;                'planAmount' : (ticketPrice * 2),&#xA;                'fields[ticketInfo]' : &quot;This is a custom field on Charge that doesn't get saved #{entry.title}&quot;&#xA;             },&#xA;             ...&#xA;         }&#xA;    } %}&#xA;&#xA;    {{ craft.charge.setPaymentOptions(options) }}&#xA;&#xA;    {{ forms.select({&#xA;        label:   'Plan Choice',&#xA;        name:    'planChoice',&#xA;        id:      'planChoice',&#xA;        options: options.planChoices,&#xA;        value:   (charge is defined ? charge.planChoice),&#xA;        errors:  (charge is defined ? charge.getErrors('planChoice'))&#xA;    }) }}&#xA;&#xA;    ... other normal form bits ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-08-16T14:10:53.243" Title="Populating a Custom Field via a Plan Choice in Charge?" Tags="&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21592" PostTypeId="2" ParentId="21567" CreationDate="2017-08-16T16:12:23.283" Score="1" Body="&lt;p&gt;As @Youniteus stated in a comment to this post the answer was related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1758/what-is-the-best-way-to-exclude-an-array-of-entries&quot;&gt;this question&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had to tweak the join statements a bit but it's working now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;complete code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# convert array to string  so we can remove these ids #}&#xA;{% set excludedJobs = excludeRelatedJobs|join(', not ') %}&#xA;&#xA;{# set careers to all jobs created by author#}&#xA;{% if not excludedJobs|length%} &#xA;    {% set careers = craft.entries.section('careers').authorId(user.id) %}&#xA;&#xA;{# filter out jobs already added to store#}&#xA;{% else %}&#xA;    {% set careers = craft.entries.section('careers').authorId(user.id).id('and, not ' ~ excludedJobs) %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for job in careers %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/careers/edit/{{ job.id }}&quot;&amp;gt;{{ job.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-08-16T16:12:23.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21593" PostTypeId="2" ParentId="1092" CreationDate="2017-08-16T18:01:45.970" Score="1" Body="&lt;p&gt;It was clearly documented on &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/url_encode.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Official Documentation&lt;/a&gt; that we can use &lt;code&gt;url_encode&lt;/code&gt; filter to convert it to url friendly string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;path-seg*ment&quot;|url_encode }}&#xA;{# outputs &quot;path-seg%2Ament&quot; #}&#xA;&#xA;{{ &quot;string with spaces&quot;|url_encode }}&#xA;{# outputs &quot;string%20with%20spaces&quot; #}&#xA;&#xA;{{ {'param': 'value', 'foo': 'bar'}|url_encode }}&#xA;{# outputs &quot;param=value&amp;amp;foo=bar&quot; #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7131" LastActivityDate="2017-08-16T18:01:45.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21594" PostTypeId="1" AcceptedAnswerId="21621" CreationDate="2017-08-16T18:05:24.177" Score="1" ViewCount="71" Body="&lt;p&gt;When querying multiple model types (entries, Commerce products and Commerce variants) I want to be able to detect the model type of each item as I iterate over the results array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally to avoid this sort of error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\EntryModel and its behaviors do not have a method or closure named&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be a clean way of doing this but I may be wrong!&lt;/p&gt;&#xA;" OwnerUserId="7132" LastEditorUserId="57" LastEditDate="2017-08-17T03:44:32.767" LastActivityDate="2017-08-17T19:18:07.320" Title="How to detect the model type of an item in an array of query results" Tags="&lt;plugin-craftcommerce&gt;&lt;entrymodel&gt;&lt;models&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21595" PostTypeId="2" ParentId="21568" CreationDate="2017-08-16T18:07:15.727" Score="2" Body="&lt;p&gt;You can use .htaccess config from &lt;a href=&quot;https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess&quot; rel=&quot;nofollow noreferrer&quot;&gt;HTML Boilerplate&lt;/a&gt; for better configuration. There are a lot of useful config option there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this config to enable gzip compression in my personal blog, and it's worked perfectly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA;&#xA;    # Force compression for mangled `Accept-Encoding` request headers&#xA;    &amp;lt;IfModule mod_setenvif.c&amp;gt;&#xA;        &amp;lt;IfModule mod_headers.c&amp;gt;&#xA;            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding&#xA;            RequestHeader append Accept-Encoding &quot;gzip,deflate&quot; env=HAVE_Accept-Encoding&#xA;        &amp;lt;/IfModule&amp;gt;&#xA;    &amp;lt;/IfModule&amp;gt;&#xA;&#xA;&#xA;    # Compress all output labeled with one of the following media types.&#xA;    &amp;lt;IfModule mod_filter.c&amp;gt;&#xA;        AddOutputFilterByType DEFLATE &quot;application/atom+xml&quot; \&#xA;                                      &quot;application/javascript&quot; \&#xA;                                      &quot;application/json&quot; \&#xA;                                      &quot;application/ld+json&quot; \&#xA;                                      &quot;application/manifest+json&quot; \&#xA;                                      &quot;application/rdf+xml&quot; \&#xA;                                      &quot;application/rss+xml&quot; \&#xA;                                      &quot;application/schema+json&quot; \&#xA;                                      &quot;application/vnd.geo+json&quot; \&#xA;                                      &quot;application/vnd.ms-fontobject&quot; \&#xA;                                      &quot;application/x-font-ttf&quot; \&#xA;                                      &quot;application/x-javascript&quot; \&#xA;                                      &quot;application/x-web-app-manifest+json&quot; \&#xA;                                      &quot;application/xhtml+xml&quot; \&#xA;                                      &quot;application/xml&quot; \&#xA;                                      &quot;font/eot&quot; \&#xA;                                      &quot;font/opentype&quot; \&#xA;                                      &quot;image/bmp&quot; \&#xA;                                      &quot;image/svg+xml&quot; \&#xA;                                      &quot;image/vnd.microsoft.icon&quot; \&#xA;                                      &quot;image/x-icon&quot; \&#xA;                                      &quot;text/cache-manifest&quot; \&#xA;                                      &quot;text/css&quot; \&#xA;                                      &quot;text/html&quot; \&#xA;                                      &quot;text/javascript&quot; \&#xA;                                      &quot;text/plain&quot; \&#xA;                                      &quot;text/vcard&quot; \&#xA;                                      &quot;text/vnd.rim.location.xloc&quot; \&#xA;                                      &quot;text/vtt&quot; \&#xA;                                      &quot;text/x-component&quot; \&#xA;                                      &quot;text/x-cross-domain-policy&quot; \&#xA;                                      &quot;text/xml&quot;&#xA;&#xA;    &amp;lt;/IfModule&amp;gt;&#xA;&#xA;    &amp;lt;IfModule mod_mime.c&amp;gt;&#xA;        AddEncoding gzip              svgz&#xA;    &amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7131" LastActivityDate="2017-08-16T18:07:15.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21597" PostTypeId="2" ParentId="21588" CreationDate="2017-08-16T19:26:01.670" Score="1" Body="&lt;p&gt;Craft 3 currently doesn't have image filter support, but it is on the list and you can track the Github issue here: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1492&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1492&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-16T19:26:01.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21598" PostTypeId="1" CreationDate="2017-08-16T19:26:42.157" Score="2" ViewCount="10566" Body="&lt;p&gt;Good afternoon,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new in Craft so I installed this step-by-step and I tried to install this theme: &lt;a href=&quot;https://github.com/duezerouno/0-201&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/duezerouno/0-201&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I did everything, I can see a template error on my site that shows the next: &lt;em&gt;Unexpected token &quot;end of template&quot; of value &quot;&quot; (&quot;end of statement block&quot; expected).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like the error is on the &lt;strong&gt;_head.twig&lt;/strong&gt; file and says that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;{% block head %}&#xA;&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;&amp;lt;meta http-equiv=&quot;x-ua-compatible&quot; content=&quot;ie=edge&quot;&amp;gt;&#xA;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}     &amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;&quot;&amp;gt;&#xA;&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;&#xA;&#xA;&amp;lt;link rel=&quot;apple-touch-icon&quot; href=&quot;apple-touch-icon.png&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;home&quot; href=&quot;{{ siteUrl }}&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;icon&quot; href=&quot;images/favicon.png&quot;&amp;gt;&#xA;&#xA;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;/styles/app.css&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone can help me with this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7134" LastActivityDate="2018-05-31T17:00:33.670" Title="Unexpected token &quot;end of template&quot; of value &quot;&quot; (&quot;end of statement block&quot; expected)" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21599" PostTypeId="2" ParentId="21598" CreationDate="2017-08-16T19:34:42.607" Score="0" Body="&lt;p&gt;you need to close the block, easy mistake&lt;/p&gt;&#xA;" OwnerUserId="6981" LastEditorUserId="6981" LastEditDate="2018-05-31T17:00:33.670" LastActivityDate="2018-05-31T17:00:33.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21600" PostTypeId="2" ParentId="21583" CreationDate="2017-08-16T19:34:58.677" Score="2" Body="&lt;p&gt;If you look at the MemCacheConfig.php file, you'll see that it's expecting a single property, &quot;servers&quot;, which contains an array of associative arrays with properties. So, try this as your memcache config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;return [&#xA;    'servers' =&amp;gt; &#xA;[&#xA;  [        // A memcached server hostname or IP address.&#xA;             'host' =&amp;gt; 'localhost',&#xA;             // Whether or not to use a persistent connection.&#xA;             'persistent' =&amp;gt; true,&#xA;             // The memcached server port.&#xA;             'port' =&amp;gt; 11211,&#xA;             // How often a failed server will be retried (in seconds).&#xA;             'retryInterval' =&amp;gt; 15,&#xA;             // If the server should be flagged as online upon a failure.&#xA;             'status' =&amp;gt; true,&#xA;             // The value in seconds which will be used for connecting to the server.&#xA;             'timeout' =&amp;gt; 15,&#xA;             // Probability of using this server among all servers.&#xA;             'weight' =&amp;gt; 1,&#xA;    ]&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7135" LastActivityDate="2017-08-16T19:34:58.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21601" PostTypeId="2" ParentId="21598" CreationDate="2017-08-16T19:36:45.777" Score="2" Body="&lt;p&gt;It looks like their &lt;a href=&quot;https://github.com/duezerouno/0-201/blob/master/templates/_head.twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;_head&quot;&lt;/a&gt; template is missing the closing &lt;code&gt;{% endblock %}&lt;/code&gt; at the end.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-16T19:36:45.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21602" PostTypeId="1" AcceptedAnswerId="21629" CreationDate="2017-08-16T19:53:27.573" Score="2" ViewCount="1190" Body="&lt;p&gt;When trying to login to my live env on craft, I get the following error in the javascript console.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Error] Failed to load resource: the server responded with a status of 404 (HTTP/2.0 404) (login, line 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This only happens in the live environment, which is weird because the DB and front-end code are synced between local and live. There is also a staging website where the login page works. &lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2017-08-18T14:33:45.013" Title="/admin/actions/users/login 404" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;login&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21603" PostTypeId="2" ParentId="21568" CreationDate="2017-08-16T20:12:04.373" Score="2" Body="&lt;p&gt;Apache supports gzip with two compression modules: &lt;code&gt;mod_gzip&lt;/code&gt; and &lt;code&gt;mod_deflate&lt;/code&gt;. The latter is supposedly more widely available but some hosts may have one or the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mod_gzip&lt;/code&gt; is the older of the modules and came with Apache 1.3, &lt;code&gt;mod_deflate&lt;/code&gt; is newer and compresses better, though when you're dealing with text like js/css/html, the difference is only a few bytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;mod_deflate&lt;/code&gt; is giving you fits, you could also try &lt;code&gt;mod_gzip&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ifModule mod_gzip.c&amp;gt;&#xA;  mod_gzip_on Yes&#xA;  mod_gzip_dechunk Yes&#xA;  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$&#xA;  mod_gzip_item_include mime ^application/x-javascript.*&#xA;  mod_gzip_item_include mime ^text/.*&#xA;  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*&#xA;  mod_gzip_item_exclude mime ^image/.*  &#xA;  mod_gzip_item_include handler ^cgi-script$&#xA;&amp;lt;/ifModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If Apache is running PHP as mod_php, you can also see what modules are running using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    print_r( apache_get_modules() );&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-08-16T20:12:04.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21604" PostTypeId="2" ParentId="21602" CreationDate="2017-08-16T20:25:08.690" Score="6" Body="&lt;p&gt;What server provisioner are you using? Forge? Something else? If it's Forge, it's most likely this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twitter.com/nystudio107/status/895726366477344772&quot; rel=&quot;noreferrer&quot;&gt;https://twitter.com/nystudio107/status/895726366477344772&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also here are some Nginx configs (with Forge examples) that are known to work with Craft CMS 2.x and 3.x: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2017-08-18T01:53:30.923" LastActivityDate="2017-08-18T01:53:30.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21605" PostTypeId="1" AcceptedAnswerId="21612" CreationDate="2017-08-17T02:16:29.130" Score="5" ViewCount="514" Body="&lt;p&gt;With &lt;a href=&quot;https://craftcms.com/docs/image-transforms&quot; rel=&quot;noreferrer&quot;&gt;Craft's image transforms&lt;/a&gt; used to resize images or generate thumbnails, can you prevent images from being &lt;em&gt;upscaled&lt;/em&gt;? There's often cases where it makes no sense to &lt;em&gt;increase&lt;/em&gt; the dimensions of an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if there was a setting for this, but I can't find one documented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, is the solution to fetch the image size in Twig and then &lt;em&gt;conditionally&lt;/em&gt; apply the image transform?&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2020-09-25T07:11:12.290" Title="Can you prevent upscaling when using Craft's image transforms?" Tags="&lt;image-transforms&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21606" PostTypeId="1" AcceptedAnswerId="21607" CreationDate="2017-08-17T03:06:27.293" Score="0" ViewCount="136" Body="&lt;p&gt;I'm very lost with the gateway. It seems that Authorize.net is highly supported with Craft Commerce but the gateway isn't working. I had the dummy gateway working perfectly fine so that when I'd go through the whole processes and the order would show up. I put in authorize.net AIM as a new gateway and now when I get to the payment it does nothing at all. I put in this code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.config.devMode and (craft.session.hasFlash('notice') or craft.session.hasFlash('error')) %}&#xA;&#xA;  {% set noticeFlash = craft.session.getFlash('notice')|join('|') %}&#xA;  {% set errorFlash = craft.session.getFlash('error')|join('|') %}&#xA;&#xA;    Notice: [{{  noticeFlash }}]&#xA;    Error: [{{  errorFlash }}]&#xA;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get back&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error: [Payment method does not exist or is not allowed.]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've put in the API user and key and the link at the bottom. Am I supposed to set the gateway as default somewhere?&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2017-08-17T04:09:45.763" LastActivityDate="2017-08-17T04:25:57.527" Title="Authorize.net not connecting in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;&lt;omnipay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21607" PostTypeId="2" ParentId="21606" CreationDate="2017-08-17T04:19:34.930" Score="1" Body="&lt;p&gt;That error is from the cart service when trying to set the payment method ID on the cart during payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 possible reasons the error would appear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The payment ID you are submitting is wrong&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;paymentMethodId&quot; value=&quot;theIDhere&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) In the settings (for a correctly submitted payment ID), the &quot;Enabled to select on front-end&quot; setting has been turned off. Screenshot: &lt;a href=&quot;http://jmp.sh/AxoM1tI&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jmp.sh/AxoM1tI&lt;/a&gt; You need this on, to allow customers to use the method on checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-08-17T04:19:34.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21609" PostTypeId="2" ParentId="21581" CreationDate="2017-08-17T05:20:05.643" Score="3" Body="&lt;p&gt;Have you tried using &lt;code&gt;{owner.owner.slug}&lt;/code&gt;? If you've got Matrix &gt; Super Table &gt; Asset, and you're trying to get an attribute on the Entry/Element, you'll need to go two level out from the Super Table field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry&#xA;  Matrix&#xA;    Super Table&#xA;      Asset Field&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The owner of the Super Table field is the Matrix field. The owner of the Matrix field is the Entry.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-08-17T05:20:05.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21610" PostTypeId="2" ParentId="21145" CreationDate="2017-08-17T05:33:55.203" Score="1" Body="&lt;p&gt;This is actually a bit of an issue with XML-based feeds. To Feed Me, both your node's are &lt;code&gt;link&lt;/code&gt; nodes. They have different attributes for sure, but Feed Me doesn't identify nodes by their tag &lt;em&gt;and&lt;/em&gt; attributes, so it'll look at all tags called &lt;code&gt;link&lt;/code&gt; to get the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've stated, you'll be getting a bunch of errors due to this. Can you restructure your feed at all? The ideal method would be to rename one to &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, there's no way to manually define field mapping, as its already complicated. You're more than welcome to submit a &lt;a href=&quot;https://github.com/engram-design/FeedMe/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2017-08-17T05:33:55.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21611" PostTypeId="1" CreationDate="2017-08-17T06:32:01.230" Score="1" ViewCount="180" Body="&lt;p&gt;I'm trying to change a userphoto of a certain user to a base64-encoded imagestring that is supplied in a POST request. I already succeeded in uploading an actual asset that way, however, userphotos seem to be handled in a completely different fashion apparently. While this is supposed to change in Craft3, is there a proper way to achieve what I'm trying in Craft 2.x?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've come up with so far, it obviously does not work though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $postdata = file_get_contents(&quot;php://input&quot;);&#xA;    $posts = json_decode($postdata);&#xA;&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($posts-&amp;gt;userid);&#xA;    if ($user == null){&#xA;        return array( &quot;status&quot; =&amp;gt; &quot;no user found for id &quot;.$posts-&amp;gt;userid );&#xA;    }&#xA;&#xA;    $imageData = base64_decode($posts-&amp;gt;image);&#xA;    $source = imagecreatefromstring($imageData);&#xA;&#xA;    craft()-&amp;gt;users-&amp;gt;saveUserPhoto($user-&amp;gt;id.&quot;-&quot;.time().&quot;.jpg&quot;,$source, $user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure whats wrong really, or how I am supposed to properly achieve what I'm trying to do. I suspect the image file isn't handed over to &lt;code&gt;saveUserPhoto()&lt;/code&gt; in the correct way due to the following error message, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 2 passed to Craft\UsersService::saveUserPhoto() must be an&#xA;  instance of Craft\BaseImage, resource given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;, but I could be completely wrong with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-08-17T06:37:48.893" LastActivityDate="2017-08-17T06:37:48.893" Title="Change user's photo to base64-encoded image received via POST" Tags="&lt;plugin-development&gt;&lt;user-profile&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21612" PostTypeId="2" ParentId="21605" CreationDate="2017-08-17T07:06:06.320" Score="8" Body="&lt;p&gt;As found &lt;a href=&quot;https://github.com/craftcms/cms/issues/844&quot; rel=&quot;noreferrer&quot; title=&quot;here&quot;&gt;here&lt;/a&gt;, this actually seems to be a requested feature that is not yet implemented. However, in the link given, Brandon also supplied a workaround for the time being:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = {&#xA;width: min(150, image.width),&#xA;height: min(100, image.height)&#xA;} %}&#xA;&#xA;&amp;lt;img src=&quot;{{ image.getUrl(transform) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5798" LastActivityDate="2017-08-17T07:06:06.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21613" PostTypeId="2" ParentId="19694" CreationDate="2017-08-17T09:44:01.197" Score="1" Body="&lt;p&gt;For some reason the &lt;code&gt;{% if item.discount %}&lt;/code&gt; isn't working for me.&#xA;I've solved it by comparing the item.discount value. If not 0.0000 then it may show up&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if item.discount != '0.0000' %} &#xA;  {{&quot;Discount&quot;|t}}: {{ item.discount|commerceCurrency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3785" LastActivityDate="2017-08-17T09:44:01.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21614" PostTypeId="1" CreationDate="2017-08-17T10:33:36.993" Score="1" ViewCount="163" Body="&lt;p&gt;I know the long-form method for achieving my goal, but I'm hitting a wall in trying to keep the conditionals down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to search for entries related to a specific category field &lt;strong&gt;AND&lt;/strong&gt; search for entries with no category selection for that same field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I can only do the first part. Here's a snippet of a much larger query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all categories within specific category groups #}&#xA;{% set skillsOptions = craft.categories.group('skillsCategories') %}&#xA;{% set durationOptions = craft.categories.group('durationCategories') %}&#xA;&#xA;{# working: find all entries with any category selected #}&#xA;{# not working: also find all entries with no category selected #}&#xA;{% set opportunities = craft.entries.section('opportunities').relatedTo('and',&#xA;    {&#xA;        targetElement: ['or', skillsOptions],&#xA;        field: 'skills'&#xA;    },&#xA;    {&#xA;        targetElement: ['or', durationOptions],&#xA;        field: 'duration'&#xA;    }&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="217" LastActivityDate="2017-08-17T10:33:36.993" Title="Advanced search entries relatedTo category and unrelated to any category" Tags="&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21618" PostTypeId="1" CreationDate="2017-08-17T15:33:29.957" Score="2" ViewCount="331" Body="&lt;p&gt;I have a bunch (about 3000) of imported users from a website, which is currently on a redesign.&#xA;When the site is finished, I would like to send an email to all users,&#xA;saying that the site is relaunched, has a new structure ect. and therefore they have to set a new password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found nothing in the Craft settings, as well in the forum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to write a plugin?&#xA;Or can I achieve this with the Sprout Email plugin?&#xA;I saw, there is a event &quot;When a user logs in&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could also work for me: a users logs in and gets automatically&#xA;to the a page to set a new password.&lt;/p&gt;&#xA;" OwnerUserId="6734" LastEditorUserId="57" LastEditDate="2017-08-17T19:00:28.833" LastActivityDate="2017-08-17T19:09:42.807" Title="Send Password Reset Email to all users at once" Tags="&lt;users&gt;&lt;emails&gt;&lt;activation&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21619" PostTypeId="1" CreationDate="2017-08-17T16:18:06.140" Score="1" ViewCount="64" Body="&lt;p&gt;I'm having an issue where I am getting template errors related to my craft cache tags in some environments but not others. I have my site set up on a production server that is a Linode/Forge setup. The site works fine there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally I am using a Homestead/Vagrant setup and I am getting template errors on any pages that use the cache tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code that is having the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;&#xA;{% block pageStyles %}&#xA;&#xA;{% for entry in craft.entries.section('juices') %}&#xA;    .color-nameplate.btn-{{entry.slug}} {&#xA;        background-color: {{entry.productColorCode}};&#xA;    }&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&#xA;{% block bodyClass %}home-page{% endblock %}&#xA;&#xA;&#xA;{% block content %}&#xA;&#xA;{% cache if craft.config.cache %}&#xA;&#xA;{% for row in entry.bodyBuilder.level(1) %}&#xA;    {% include 'bodyblocks/' ~ row.type.handle with {row: row} %}&#xA;{% endfor %}&#xA;&#xA;{% endcache %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code works in the production environment but not on local. On local it is showing the following template error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;name&quot; of value &quot;craft&quot; (&quot;end of statement block&quot; expected).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I remove the cache tags then the template displays, but this won't work for my production environment so I need to work out what the issue is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brian&lt;/p&gt;&#xA;" OwnerUserId="2265" LastActivityDate="2017-11-22T04:00:56.450" Title="Getting Template Errors When Using Cache Tag in some environments but not in others" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21620" PostTypeId="2" ParentId="21618" CreationDate="2017-08-17T19:09:42.807" Score="3" Body="&lt;p&gt;I'm not sure if the Sprout Email plugin can do anything to help you or not, but I can think of a few options that would involve simple, &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom&lt;/a&gt; &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugins&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every user has a &quot;Require a password reset on next login&quot; that an administrator can set from the CP under their settings.  You probably don't want to do that manually for 3,000 users, but a simple plugin (or a simple SQL query) could set the &lt;code&gt;passwordResetRequired&lt;/code&gt; column in the &lt;code&gt;craft_users&lt;/code&gt; table in the database to &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to send an email and include a password reset link in that email ahead of time, a plugin would change that column to &lt;code&gt;1&lt;/code&gt; for all users and follow similar logic in the &lt;a href=&quot;https://craftcms.com/classreference/controllers/UsersController&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController&lt;/a&gt; for getting the password reset link and include that in the email body that you'd send to every user programatically.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-17T19:09:42.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21621" PostTypeId="2" ParentId="21594" CreationDate="2017-08-17T19:18:07.320" Score="0" Body="&lt;p&gt;Twig doesn't have a native &quot;instanceof&quot; check, but it'd be pretty trivial to create a &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt; that added a Twig Extension where you can add an &lt;a href=&quot;https://secure.php.net/manual/en/internals2.opcodes.instanceof.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;instanceof&lt;/a&gt; test.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTests()&#xA;{&#xA;    return array(&#xA;        'instanceof' =&amp;gt;  new \Twig_Function_Method($this, 'isInstanceof')&#xA;    );&#xA;}&#xA;&#xA;public function isInstanceof($var, $instance)&#xA;{&#xA;    return  $var instanceof $instance;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from your template, you'd do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if value is instanceof('Commerce_ProductModel') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-17T19:18:07.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21622" PostTypeId="2" ParentId="21578" CreationDate="2017-08-17T20:16:11.910" Score="1" Body="&lt;p&gt;That function was added in Feb 2016, &lt;a href=&quot;https://github.com/olivierbon/Placid/issues/21&quot; rel=&quot;nofollow noreferrer&quot;&gt;see the Github issue page&lt;/a&gt;.&#xA;This is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.placid.request('EventsFeed').limit(5) %}&#xA;&#xA;{% for event in events.data %}&#xA;  {{ event.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the use of the .data part, this was added in the 1.7.112 version.&#xA;&lt;a href=&quot;https://github.com/olivierbon/Placid/wiki/Dealing-with-responses&quot; rel=&quot;nofollow noreferrer&quot;&gt;More details here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2017-08-17T20:21:18.143" LastActivityDate="2017-08-17T20:21:18.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21623" PostTypeId="1" CreationDate="2017-08-17T20:24:59.993" Score="1" ViewCount="197" Body="&lt;p&gt;Has anyone ever tried and/or succeeded at integrating a &lt;a href=&quot;https://en.wikipedia.org/wiki/Sharable_Content_Object_Reference_Model&quot; rel=&quot;nofollow noreferrer&quot;&gt;SCORM&lt;/a&gt; player with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to &quot;roll my own&quot; &lt;a href=&quot;https://en.wikipedia.org/wiki/Learning_management_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;LMS&lt;/a&gt; in Craft because &lt;a href=&quot;https://en.wikipedia.org/wiki/Moodle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Moodle&lt;/a&gt; is WAY overkill, but I need to be able to deliver SCORM content, as well as access and utilize the data provided by the SCORM files.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="6007" LastEditDate="2019-11-11T11:46:22.703" LastActivityDate="2019-11-11T11:46:22.703" Title="SCORM Player in Craft" Tags="&lt;integration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21624" PostTypeId="2" ParentId="9400" CreationDate="2017-08-17T20:36:53.330" Score="1" Body="&lt;p&gt;I would highly recommend you for &lt;strong&gt;&lt;a href=&quot;https://fxdata.cloud&quot; rel=&quot;nofollow noreferrer&quot;&gt;**F(x) Data Cloud&lt;/strong&gt;&lt;/a&gt;** .The major reason for recommending you is that you will get more cost-Effective Plans, Higher Uptime,  Custom SSD Storage and most importantly appreciable Technical Support. I have been using their 7 servers at this moment and quite happy with the Cost and Services.&#xA;Visit: &lt;a href=&quot;https://fxdata.cloud&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://fxdata.cloud&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="7140" LastActivityDate="2017-08-17T20:36:53.330" CommentCount="0" CommunityOwnedDate="2017-08-17T20:36:53.330" ContentLicense="CC BY-SA 3.0" />
  <row Id="21625" PostTypeId="1" CreationDate="2017-08-17T20:41:54.577" Score="1" ViewCount="118" Body="&lt;p&gt;Good evening, I am new to Craft CMS. I have been a MODX builder for a while and decided to make the move to Craft. I have begun building and I am trying to make a simple way for the user to manage tabs. Do excuse the syntax as I am moving it from MODX. First the visual &#xA;&lt;a href=&quot;https://i.stack.imgur.com/uR9Wn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uR9Wn.png&quot; alt=&quot;What I would like to make super easy for the content people&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again the code will be in MODX but I will try to get the main points&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;section class=&quot;corporate-standards no-padding-bottom wow fadeIn&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA; &amp;lt;!-- section title --&amp;gt;&#xA; &amp;lt;div class=&quot;col-md-12 text-center&quot;&amp;gt;&#xA; &amp;lt;h3 class=&quot;section-title no-padding-bottom&quot;&amp;gt;Our Services&amp;lt;/h3&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA; &amp;lt;!-- end section title --&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA; &amp;lt;div class=&quot;container-fluid margin-five no-margin-bottom no-padding&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;row no-margin&quot;&amp;gt;&#xA; &amp;lt;!-- tab --&amp;gt;&#xA; &amp;lt;div class=&quot;col-md-12 col-sm-12 center-col text-center no-padding&quot; id=&quot;animated-tab&quot;&amp;gt;&#xA;  &amp;lt;!-- tab navigation --&amp;gt;&#xA; &amp;lt;ul class=&quot;nav nav-tabs margin-five no-margin-top xs-margin-bottom-seven&quot;&amp;gt;&#xA;                        &amp;lt;li class=&quot;nav active&quot;&amp;gt;&amp;lt;a href=&quot;#tab6_sec1&quot; data-toggle=&quot;tab&quot; class=&quot;xs-min-height-inherit xs-no-padding&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;i class=&quot;icon-[[*service_icon1]]&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span class=&quot;text-small text-uppercase letter-spacing-3 margin-five font-weight-600 xs-letter-spacing-none xs-display-none&quot;&amp;gt;[[*main_service1]]&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;nav&quot;&amp;gt;&amp;lt;a href=&quot;#tab6_sec2&quot; data-toggle=&quot;tab&quot; class=&quot;xs-min-height-inherit xs-no-padding&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;i class=&quot;icon-[[*service_icon2]]&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span class=&quot;text-small text-uppercase letter-spacing-3 margin-five font-weight-600 xs-letter-spacing-none xs-display-none&quot;&amp;gt;[[*main_service2]]&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;nav&quot;&amp;gt;&amp;lt;a href=&quot;#tab6_sec3&quot; data-toggle=&quot;tab&quot; class=&quot;xs-min-height-inherit xs-no-padding&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;i class=&quot;icon-[[*service_icon3]]&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span class=&quot;text-small text-uppercase letter-spacing-3 margin-five font-weight-600 xs-letter-spacing-none xs-display-none&quot;&amp;gt;[[*main_service3]]&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;                        &amp;lt;li class=&quot;nav&quot;&amp;gt;&amp;lt;a href=&quot;#tab6_sec4&quot; data-toggle=&quot;tab&quot; class=&quot;xs-min-height-inherit xs-no-padding&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;i class=&quot;icon-[[*service_icon4]]&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span class=&quot;text-small text-uppercase letter-spacing-3 margin-five font-weight-600 xs-letter-spacing-none xs-display-none&quot;&amp;gt;[[*main_service4]]&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And Here is the repeatable code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;[[+additionalField]]&quot; class=&quot;text-center center-col tab-pane fade in [[+additionalField5]]&quot;&amp;gt; &#xA;                            &amp;lt;div class=&quot;tab-pane fade in&quot;&amp;gt; &#xA;                                &amp;lt;div class=&quot;col-lg-6 col-md-6 no-padding corporate-standards-img cover-background position-relative&quot; style=&quot;background-image:url('[[ImagePlus? &amp;amp;value=`[[+image]]`]]');&quot; alt=&quot;[[+additionalField6]]&quot;&amp;gt;&#xA;                                    &amp;lt;div class=&quot;opacity-medium bg-dark-gray&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;p class=&quot;title-small text-uppercase corporate-standards-title white-text letter-spacing-7&quot;&amp;gt;&amp;lt;span class=&quot;title-extra-large no-letter-spacing yellow-text&quot;&amp;gt;[[+additionalField1]]&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[[+additionalField2]]&amp;lt;/p&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                                &amp;lt;div class=&quot;col-lg-6 col-md-6 corporate-standards-text sm-margin-lr-four sm-margin-top-four xs-padding-tb-ten&quot;&amp;gt;&#xA;                                    &amp;lt;div class=&quot;img-border-small-fix border-gray&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;i class=&quot;icon-[[+additionalField4]] large-icon yellow-text&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                                    &amp;lt;h2 class=&quot;margin-ten no-margin-bottom&quot;&amp;gt;[[+title]]&amp;lt;/h2&amp;gt;&#xA;                                    &amp;lt;p class=&quot;text-med margin-ten width-80 center-col xs-width-100&quot;&amp;gt;[[+description]]&amp;lt;/p&amp;gt;&#xA;                                    &amp;lt;a class=&quot;text-small highlight-link text-uppercase bg-black white-text&quot; href=&quot;[[~[[+link]]]]&quot;&amp;gt;[[+additionalField3]] &amp;lt;i class=&quot;fa fa-long-arrow-right extra-small-icon white-text&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help or a point in the right direction would be appreciated. I have been using MIGx and Imageplus for so long I am kind of at a loss. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS..Besides my lack of finding ways to do repeatable content. Craft is my new go to. &lt;/p&gt;&#xA;" OwnerUserId="7139" LastEditorUserId="45" LastEditDate="2017-08-25T20:57:02.857" LastActivityDate="2017-08-25T20:57:02.857" Title="First Craft CMS build need help with tabs with images" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21626" PostTypeId="1" CreationDate="2017-08-18T01:28:01.760" Score="1" ViewCount="46" Body="&lt;p&gt;We're getting a 404 (or a Craft 'page not found' error) with this path on the remote server:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://foo.example.net/admin/actions/users/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same database using remote mySQL. Local logins work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS 2.6.2989&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2017-09-17T01:58:24.257" Title="What might cause logins to work locally yet not in deployed environment?" Tags="&lt;admin&gt;&lt;login&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21627" PostTypeId="2" ParentId="21626" CreationDate="2017-08-18T01:35:55.670" Score="1" Body="&lt;p&gt;Crikey...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/21602/admin-actions-users-login-404&quot;&gt;/admin/actions/users/login 404&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twitter.com/nystudio107/status/895726366477344772&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twitter.com/nystudio107/status/895726366477344772&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forge!&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2017-08-18T01:35:55.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21628" PostTypeId="2" ParentId="21626" CreationDate="2017-08-18T01:49:56.087" Score="0" Body="&lt;p&gt;Yeah, that's a fun one I ran into. The server configs here are known to work with Nginx &amp;amp; Craft CMS 2.x &amp;amp; 3.x: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-18T01:49:56.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21629" PostTypeId="2" ParentId="21602" CreationDate="2017-08-18T07:18:29.023" Score="5" Body="&lt;p&gt;So I looked into this a bunch more tonight to satisfy my curiosity, and here's what is happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default rewrite rule that Forge is apparently adding is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($request_uri ~* &quot;^(.*/)index\.php/?(.*)&quot;) {&#xA;    return 301 &quot;$1$2&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What this does is essentially it just removes &lt;code&gt;index.php&lt;/code&gt; from URLs, which seems harmless enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the login screen, Craft has a JavaScript that does an XHR to the following URL:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/index.php/admin/actions/users/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matches the rule above, and gets rewritten as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/admin/actions/users/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is that &lt;a href=&quot;https://serverfault.com/questions/312111/how-do-i-get-nginx-to-forward-http-post-requests-via-rewrite&quot;&gt;redirects will never resend POST data&lt;/a&gt; and the request now becomes a &lt;code&gt;GET&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, sure enough, the UsersController gets hit, and the &lt;code&gt;actionLogin()&lt;/code&gt; method is called, but:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionLogin()&#xA;{&#xA;    if (craft()-&amp;gt;userSession-&amp;gt;isLoggedIn())&#xA;    {&#xA;        // Too easy.&#xA;        $this-&amp;gt;_handleSuccessfulLogin(false);&#xA;    }&#xA;&#xA;    if (craft()-&amp;gt;request-&amp;gt;isPostRequest())&#xA;    {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LcBNN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LcBNN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...because the request is no longer a POST request, Craft bails, and request 404s, and everyone is unhappy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how to fix it? Probably Forge should check for &lt;code&gt;$request_method != POST&lt;/code&gt; before attempting the 301 redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; If you're using Craft, just remove the above rule, it isn't needed.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2017-08-18T14:33:45.013" LastActivityDate="2017-08-18T14:33:45.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21630" PostTypeId="1" AcceptedAnswerId="21659" CreationDate="2017-08-18T12:18:47.690" Score="2" ViewCount="282" Body="&lt;p&gt;If I have a field of checkboxes, I'd like to be able to access them by the name of each checkbox as the variable name, and the 0 or 1 checked state as the value. Said variables need to be accessible beyond the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example (doesn't work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for checkbox in checkboxes %}&#xA;    {% set {{ checkbox }} = checkbox.selected %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've looked into things and seen answers mentioning &lt;code&gt;_context&lt;/code&gt;, &lt;code&gt;attribute()&lt;/code&gt;, and the like, but haven't been able to get anything to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, if I have a checkboxes field with a single checkbox whose name is &lt;code&gt;my_checkbox&lt;/code&gt;, label is &quot;My Checkbox&quot;, and is checked in an entry, I'd like to be able to use &lt;code&gt;{{ my_checkbox }}&lt;/code&gt; to output &quot;1&quot; (i.e. it's checked).&lt;/p&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="57" LastEditDate="2017-08-18T23:46:40.107" LastActivityDate="2017-08-21T12:12:03.283" Title="How can I dynamically set checkboxes to be named variables?" Tags="&lt;variable&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21631" PostTypeId="2" ParentId="648" CreationDate="2017-08-18T12:35:22.193" Score="1" Body="&lt;p&gt;To access a cookie you can use the plugin variable class&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Class PluginVariable&#xA; * @package Craft&#xA; */&#xA;class PluginVariable&#xA;{&#xA;    /**&#xA;     * Get the cookie value&#xA;     *&#xA;     * @param string $name&#xA;     * @return string&#xA;     */&#xA;    public function getPluginCookie($name)&#xA;    {&#xA;        return $_COOKIE[$name] ?? '';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And inside your twig file you call &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set pluginCookie = craft.plugin.getPluginCookie('some_cookie_name') %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7015" LastActivityDate="2017-08-18T12:35:22.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21633" PostTypeId="2" ParentId="21623" CreationDate="2017-08-18T13:05:54.887" Score="2" Body="&lt;p&gt;Not sure about specific integrations with Craft per se, but one way to achieve this fairly quickly is to integrate with SCORM Cloud's API. It is a SaaS offering that can be leveraged to add SCORM capability to just about any site, LMS, CMS, etc. Integrations with Moodle, WordPress, etc. already exist. See &lt;a href=&quot;https://scorm.com/scorm-solved/scorm-cloud-features/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://scorm.com/scorm-solved/scorm-cloud-features/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7143" LastActivityDate="2017-08-18T13:05:54.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21635" PostTypeId="1" AcceptedAnswerId="21636" CreationDate="2017-08-18T15:29:46.657" Score="1" ViewCount="45" Body="&lt;p&gt;Does Craft parse the contents of a false/negative/empty conditional statement? So would you take a performance hit if you had a big chunk of code inside a conditonal that was false?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foo = &quot;foo&quot; %}&#xA;{% if foo == foo %}Small code {% else %} MASSIVE CODE{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-08-18T16:09:10.597" Title="Does Craft parse requests inside a conditional if it is false?" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21636" PostTypeId="2" ParentId="21635" CreationDate="2017-08-18T16:09:10.597" Score="3" Body="&lt;p&gt;&lt;strong&gt;Yes,&lt;/strong&gt; Twig will parse it all down to PHP before running it. It stores the rendered PHP in a &lt;code&gt;/storage/runtime/compiled_templates/&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;No,&lt;/strong&gt; Craft will not run anything inside the conditional if it's &lt;code&gt;false&lt;/code&gt;. At that point, it's simply processing exactly as normal PHP would.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So no, you shouldn't be notably penalized for anything inside a falsey &lt;code&gt;if&lt;/code&gt; statement.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-08-18T16:09:10.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21637" PostTypeId="1" CreationDate="2017-08-18T17:43:40.030" Score="1" ViewCount="656" Body="&lt;p&gt;I have been working on setting up locales for left-to-right languages. I wanted to know the support Craft provides for Right-to-Left languages like Arabic, Hebrew etc. Is there a plugin that could help or is it just the way other locales are setup (but with additional step)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight on this topic is helpful!&#xA;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="6995" LastEditorUserId="45" LastEditDate="2017-08-25T20:53:27.443" LastActivityDate="2017-08-25T20:53:27.443" Title="What is the best way to setup Right to Left language locale in Craft?" Tags="&lt;localization&gt;&lt;craft-features&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21642" PostTypeId="2" ParentId="21637" CreationDate="2017-08-18T22:07:10.923" Score="0" Body="&lt;p&gt;I'm not sure exactly what support you're looking for, but the Craft Control Panel does fully support RTL languages like Arabic and Hebrew.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aHhM7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aHhM7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-18T22:07:10.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21643" PostTypeId="1" AcceptedAnswerId="21649" CreationDate="2017-08-19T05:06:28.387" Score="1" ViewCount="2358" Body="&lt;p&gt;I've tried installing a plugin to my Craft 3 local installation. I ran this from the command line in my project root:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;composer require boboldehampsink/import&lt;/code&gt; but, this error was returned&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/import/ does not exist and could not be created.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks if anyone can help.&lt;/p&gt;&#xA;" OwnerUserId="7059" LastActivityDate="2017-08-19T23:57:41.027" Title="How to install plugin in Craft 3" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21644" PostTypeId="2" ParentId="21637" CreationDate="2017-08-19T07:04:43.137" Score="2" Body="&lt;p&gt;You can use the locale as per below examples in your _layout.twig file. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;{% if craft.locale == 'ar' %}rtl{% endif %}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your css would then be: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.rtl {direction:rtl}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html dir=&quot;{% if craft.locale == 'ar' %}rtl{% endif %} lang=&quot;&#xA;{{craft.locale}}&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.w3.org/International/questions/qa-html-dir&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.w3.org/International/questions/qa-html-dir&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="4990" LastEditDate="2017-08-21T09:22:57.077" LastActivityDate="2017-08-21T09:22:57.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21646" PostTypeId="1" CreationDate="2017-08-19T20:47:54.993" Score="0" ViewCount="263" Body="&lt;p&gt;I am new to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to change any files to display the Description that I have set up for &lt;a href=&quot;http://viviendasdeprimera.com/eventos/proyectos-de-casas-en-arraijan&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://viviendasdeprimera.com/eventos/proyectos-de-casas-en-arraijan&lt;/a&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="7153" LastEditorUserId="45" LastEditDate="2017-08-20T03:57:22.673" LastActivityDate="2017-08-20T03:57:22.673" Title="Displaying the Meta Description" Tags="&lt;templating&gt;&lt;meta&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21647" PostTypeId="2" ParentId="21646" CreationDate="2017-08-19T20:57:02.520" Score="1" Body="&lt;p&gt;Craft will not automatically create &lt;em&gt;anything&lt;/em&gt; on the frontend for you. You could use something like the &lt;a href=&quot;https://github.com/nystudio107/craft3-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin, though.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-19T20:57:02.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21648" PostTypeId="2" ParentId="21646" CreationDate="2017-08-19T23:45:16.580" Score="2" Body="&lt;p&gt;Mike: yes you do. It sounds like you had your site built by another developer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike other CMS, everything that displays on your website in Craft is custom built. The gist is you setup a bunch of &lt;a href=&quot;https://craftcms.com/docs/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;fields&lt;/a&gt; on the backend (Craft's &quot;control panel&quot;)—which is probably what you did. Think of the control panel as simply an interface to database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, those fields won't display anything on the front-end. What is output is controlled by &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;templates&lt;/a&gt;. If you're used to something like WordPress, Craft basically only has one &quot;theme&quot; and it's not accessible in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, you basically need to tell Craft where to spit it out.  Depending on how your site was built, it's probably in a &lt;code&gt;_layout.html&lt;/code&gt; file inside the &lt;code&gt;craft/app/templates&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your field's name is Meta Description, you could add it to the template in the appropriate place  somewhere like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.metaDescription is defined %}&#xA;  &amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription }}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the control panel, the field would need to added to any section you want to use the Meta Description. If you've added that field to a section, the field will be output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more help with this, check out the &lt;a href=&quot;https://craftcms.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft documentation&lt;/a&gt;, &lt;a href=&quot;https://mijingo.com/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo&lt;/a&gt;'s  lessons on Craft, or hire a &lt;a href=&quot;https://straightupcraft.com/professionals&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft professional&lt;/a&gt; to help you out.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-08-19T23:45:16.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21649" PostTypeId="2" ParentId="21643" CreationDate="2017-08-19T23:52:39.173" Score="1" Body="&lt;p&gt;You are trying to install a Craft 2.x plugin, which you can see, among other things, by looking at its composer.json. Craft 3 plugins will always have a &lt;code&gt;&quot;extra&lt;/code&gt; property with a &lt;code&gt;&quot;handle&quot;&lt;/code&gt; defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;extra&quot;: {&#xA;    &quot;handle&quot;: &quot;plugin-handle&quot;,&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The currently latest release of the Import plugin is v0.8.33, and is not compatible with Craft 3:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/boboldehampsink/import/blob/0.8.33/composer.json&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/import/blob/0.8.33/composer.json&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until the plugin store goes live, most plugin developers note their compatible plugins in this list:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/craftcms/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/plugins&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-08-19T23:57:41.027" LastActivityDate="2017-08-19T23:57:41.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21650" PostTypeId="1" CreationDate="2017-08-20T14:02:47.030" Score="1" ViewCount="80" Body="&lt;p&gt;I created a new asset source/folder called &quot;my-assets&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has an entry in the DB in &quot;craft_assetsources&quot; with the id=10, path=&quot;my_base_folder/assets/my-assets/&quot; and url=&quot;/assets/my-assets/&quot;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plus an entry in the &quot;craft_assetfolders&quot; with the id=27, sourceID=10 and name=&quot;my-assets&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I've created a subfolder called &quot;my-images&quot;, which only has an entry in &quot;craft_assetfolders&quot; with id=28, sourceID=10 and path=&quot;my-images/&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use the myImage.asset.getUrl() on an image from that subfolder, I get the url &quot;/assets/my-assets/myImage.jpg&quot; instead of &quot;/assets/my-assets/my-images/myImage.jpg&quot;, which obviously results in the image not being found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this happens and especially how to fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any help!&lt;/p&gt;&#xA;" OwnerUserId="7155" LastActivityDate="2017-08-23T21:27:17.620" Title="asset.getUrl() not correct: missing subfolder directory" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21652" PostTypeId="2" ParentId="21625" CreationDate="2017-08-20T20:07:58.613" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix fields&lt;/a&gt; are definitely the way to go for repeatable content.  Matrix lets the user mix and match different kinds &quot;block types&quot;. You might set up an image block, a text block, pull quote block, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help answer your question, the basic premise for Matrix is you loop through the different blocks and depending on which block it is, you spit out different code to make that block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've robbed this from the &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs on Matrix&lt;/a&gt; and added some comments:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This loops through a Matrix field called &lt;code&gt;myMatrixField&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can check which type of &lt;code&gt;block&lt;/code&gt; is is with &lt;code&gt;.type&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;heading&quot; %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ block.heading }}&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check for a block called &lt;code&gt;text&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;text&quot; %}&#xA;&#xA;    {{ block.text|markdown }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check for a block called &lt;code&gt;image&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;image&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/assets-fields#examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets/images&lt;/a&gt; in Craft are all basically &quot;stored&quot; as groups of images (even if you have only one image) so you need to Craft it which one to get. &lt;code&gt;.first()&lt;/code&gt; gets the first image. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set image = block.image.first() %}&#xA;    {% if image %}&#xA;        &amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; width=&quot;{{ image.getWidth('thumb') }}&quot; height=&quot;{{ image.getHeight('thumb') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check for a block called &lt;code&gt;quote&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;quote&quot; %}&#xA;&#xA;    &amp;lt;blockquote&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ block.quote }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;cite&amp;gt;– {{ block.cite }}&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In addition to the CreateSean's suggestion above to check out Ryan Irelan's Mijingo series, also download and play with the &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager&lt;/a&gt; demo site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy Lager lets you peek behind the scenes and get a really great overview of how to use and template many of Craft's features including &lt;a href=&quot;https://craftcms.com/features/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; and Matrix. It has some great inspiration for how to code up reusable modules that also do alignment and how you could pull it off via Twig and CSS.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-08-20T20:07:58.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21653" PostTypeId="1" CreationDate="2017-08-20T21:45:23.050" Score="2" ViewCount="155" Body="&lt;p&gt;I added a new SEOmatic field to a section that has around 500 entries. As for any other new fields that you add to a section, the default values are only applied on the entries if you open and save every single one of them once. Shouldn't there be a solution form crafts side? Something like &quot;apply on all existing entries&quot;? Or is there any comfortable solution for that already existing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... I am thinking about adding a feature request since I was struggling with this several times already. What do you guys think?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found some other similar questions, but no really easy and satisfying solutions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/11269/can-i-add-an-enabled-by-default-lightswitch-field-to-existing-entries&quot;&gt;Can I add an enabled-by-default lightswitch field to existing entries?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-08-20T21:45:23.050" Title="Default values of new fields for existing entries" Tags="&lt;entries-field&gt;&lt;plugin-seomatic&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21654" PostTypeId="1" AcceptedAnswerId="21655" CreationDate="2017-08-21T03:02:08.427" Score="2" ViewCount="418" Body="&lt;p&gt;I'm trying to get a list from a simple plain text field which will accept line breaks. I need to find a way to wrap an li tag around the content on that line. So everytime I hit enter, it wraps &lt;code&gt;&amp;lt;li&amp;gt;Whatever is on that line&amp;lt;/li&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So going from this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ajxdM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ajxdM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Into this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vf1Sm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vf1Sm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2017-08-21T04:55:57.490" Title="How to get a list item &lt;li&gt; using a plain text field every time I hit enter" Tags="&lt;templating&gt;&lt;field&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21655" PostTypeId="2" ParentId="21654" CreationDate="2017-08-21T04:55:57.490" Score="4" Body="&lt;p&gt;You'll want to &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/split.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;split&lt;/a&gt; on the line breaks, then loop through the resulting array...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for ingredient in listOfIngredients|trim|split('\n') %}&#xA;    &amp;lt;li&amp;gt;{{ ingredient }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-08-21T04:55:57.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21658" PostTypeId="1" CreationDate="2017-08-21T12:00:51.800" Score="0" ViewCount="46" Body="&lt;p&gt;We're having trouble with images being transformed with glitches in them. What would you advise to debug behavior like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ymiwD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ymiwD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rbzdV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rbzdV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-08-21T19:58:48.347" Title="Image transform glitches" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21659" PostTypeId="2" ParentId="21630" CreationDate="2017-08-21T12:12:03.283" Score="2" Body="&lt;p&gt;So I had missed the &lt;code&gt;entry.checkboxFieldHandle.contains('tequila')&lt;/code&gt; line in the docs, which allows me to access the checkbox values outside the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2017-08-21T12:12:03.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21661" PostTypeId="2" ParentId="21637" CreationDate="2017-08-21T14:09:33.290" Score="1" Body="&lt;p&gt;You should be able to copy the format of a rtl language locale file in &lt;code&gt;craft &amp;gt; app &amp;gt; framework &amp;gt; i18n &amp;gt; data&lt;/code&gt;. For instance if you select the Arabic &lt;code&gt;ar.php&lt;/code&gt; file around line 268 set your language orientation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0h7bh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0h7bh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-08-21T14:09:33.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21662" PostTypeId="1" CreationDate="2017-08-21T14:13:24.693" Score="1" ViewCount="104" Body="&lt;p&gt;Curious if anyone knows how we would setup Bitcoin support for Craft Commerce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know how to handle it on the user and Stripe site to enable the checkout but will we need a custom payment handler on the PHP side to handle the responses or will the built in Stripe support work the same way?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2017-08-21T20:03:50.037" LastActivityDate="2018-01-10T22:51:59.910" Title="Stripe Bitcoin Support for Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21663" PostTypeId="2" ParentId="14082" CreationDate="2017-08-21T14:58:38.173" Score="1" Body="&lt;p&gt;Isn't eager loading the wrong idea here, since categories do not have a property anyway, which automatically points to entries assign to this category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take 2 samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample #1: behavior like lazy loading (one entry query per category)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories %}&#xA;{% set entries = craft.entries...relatedTo(category)&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sample #2: behavior like eager loading (one entry query for all categories)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries...relatedTo(categories)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the only trick is to sort the entries in a way that they are easy accessible from each category in the &lt;code&gt;{% for category in categories %}&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should't Craft automatically cache the loaded categories and therefor make accessing them from the entry fast after having executed the Sample #2 query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean is that it would not become faster, only more comfortable if this eager loading was possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only ideas...&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="125" LastEditDate="2018-07-21T12:23:51.603" LastActivityDate="2018-07-21T12:23:51.603" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="21665" PostTypeId="1" AcceptedAnswerId="21668" CreationDate="2017-08-21T17:04:31.450" Score="1" ViewCount="1683" Body="&lt;p&gt;I'm struggling to get current locale code from the controller, I would use craft.locale in the template, but craft()-&gt;locale does not do the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2017-08-21T20:13:10.367" Title="How to get current locale in the controller" Tags="&lt;plugin-development&gt;&lt;localization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21666" PostTypeId="2" ParentId="21665" CreationDate="2017-08-21T17:57:10.087" Score="1" Body="&lt;p&gt;You could easily create a hidden input and set the value to &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;locale&quot; value=&quot;{{ craft.locale }}&quot;&amp;gt;&lt;/code&gt; and import that into the controller via &lt;code&gt;$locale = craft()-&amp;gt;request-&amp;gt;getPost('locale');&lt;/code&gt; This will allow you to know the current selected locale in the CP. &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-08-21T17:57:10.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21667" PostTypeId="2" ParentId="21658" CreationDate="2017-08-21T19:58:48.347" Score="1" Body="&lt;p&gt;If you're using &lt;a href=&quot;https://secure.php.net/manual/en/book.image.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;GD&lt;/a&gt;, try swapping to &lt;a href=&quot;https://secure.php.net/manual/en/book.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagick&lt;/a&gt;.  Also, make sure you're using a recent version of the &lt;a href=&quot;https://www.imagemagick.org/script/changelog.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;library&lt;/a&gt; as well as the &lt;a href=&quot;https://pecl.php.net/package-changelog.php?package=imagick&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP wrapper&lt;/a&gt; extension.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-21T19:58:48.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21668" PostTypeId="2" ParentId="21665" CreationDate="2017-08-21T20:13:10.367" Score="3" Body="&lt;p&gt;&lt;code&gt;craft.locale&lt;/code&gt; from a template goes to the &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/CraftVariable.php#L86&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;locale()&lt;/code&gt;&lt;/a&gt; method of the &lt;code&gt;CraftVariable&lt;/code&gt; class, which just calls &lt;code&gt;craft()-&amp;gt;language&lt;/code&gt; from PHP, which you could use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-21T20:13:10.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21669" PostTypeId="1" AcceptedAnswerId="21679" CreationDate="2017-08-21T21:37:08.433" Score="1" ViewCount="195" Body="&lt;p&gt;I switched from Apache to Nginx.  When I did that the Craft folder that was outside of the web root no longer was recognized.  Checked around, dug into my .conf files and spent a boatload on this issue, no dice.  Thinking it was ownership or folder permissions, but I changed /craft folder to 777, made no difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I brought back in the Craft directory under public_html it was all good.  I would rather it be outside of that.  Have any of you run Nginx and Craft together successfully with the folder being under public_html?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-08-23T03:41:46.707" Title="Craft Folder Error" Tags="&lt;permissions&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21670" PostTypeId="1" CreationDate="2017-08-22T06:05:37.993" Score="1" ViewCount="100" Body="&lt;p&gt;I'm trying to retrieve a list of events that are ordered by calendar and also event title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't get any of the ordering values to have any effect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set events = craft.calendar.events({&#xA;    dateRangeStart: '2017-08-27',&#xA;    dateRangeEnd: '2017-08-27',&#xA;    order: 'calendarId ASC'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All I ever get is the results by &lt;code&gt;element.id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation says &lt;code&gt;'use any of the keys above'&lt;/code&gt; and then uses a key that's not listed above. It suggests &lt;code&gt;'startDate'&lt;/code&gt; which is an event property, so I'm assuming that I'd be allowed to use event &lt;code&gt;'title'&lt;/code&gt;...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could just get all the events for the day and then group and sort in Twig but that's a terrible spot for grouping and sorting, and the docs suggest that the ordering of results works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what I'm getting wrong?&lt;/p&gt;&#xA;" OwnerUserId="6390" LastEditorUserId="6390" LastEditDate="2017-08-22T23:58:51.223" LastActivityDate="2017-08-22T23:58:51.223" Title="Ordering events using Solspace Calendar (Craft CMS)" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21671" PostTypeId="2" ParentId="9211" CreationDate="2017-08-22T09:18:35.230" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/users/784/douglas-mcdonald&quot;&gt;Douglas McDonald&lt;/a&gt;'s answer is correct with one issue though. The import statement is actually case sensitive&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft::import('plugins.myplugin.twigextensions.&lt;strong&gt;M&lt;/strong&gt;yTwigExtension');&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I also have 2 additional notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;getName()&lt;/code&gt; method is deprecated so you shouldn't bother with it&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;getFilters()&lt;/code&gt; method can be written much shorter, for example:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getFilters()&#xA;{&#xA;    return [&#xA;        'myfilter' =&amp;gt; new \Twig_Filter_Method($this, 'myfilter'),&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user7015" LastActivityDate="2017-08-22T09:18:35.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21674" PostTypeId="1" CreationDate="2017-08-22T16:00:18.883" Score="1" ViewCount="1322" Body="&lt;p&gt;I have checked all other questions on stack exchange with similar titles and they don't seem to help my situation. &#xA;I have added assets sources to craft CMS. but when uploading I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The error message was: &quot;Error uploading the file:  The file system path &quot;{siteUrl}assets/images/hero-images/&quot; set for this source does not exist.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am working locally using MAMP. I do not have multiple environments. only local.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;em&gt;siteUrl&lt;/em&gt; variable seems to work fine when used directly in templates. just doesn't work for assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;File system path is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;assets/images/hero-images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;URL is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{siteUrl}assets/images/hero-images/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;General config is set to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; &quot;//projectname:8888/html/&quot;,&#xA;&#xA;    // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)&#xA;    'environmentVariables' =&amp;gt; array(),&#xA;&#xA;    // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;    'defaultWeekStartDay' =&amp;gt; 0,&#xA;&#xA;    // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;&#xA;    // Whether &quot;index.php&quot; should be visible in URLs (true, false, &quot;auto&quot;)&#xA;    'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;&#xA;    // Control Panel trigger word&#xA;    'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;    // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;    'devMode' =&amp;gt; false,&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I open the assets in chrome, this is their file path.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://projectname:8888/html/assets/images/hero-images/be-inspired-mobile.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is driving me mad and have checked everything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using exactly the same config settings as all my other sites which work absolutely fine.&#xA;Any help will be really appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="7165" LastEditDate="2017-08-24T08:12:26.783" LastActivityDate="2017-08-24T08:21:44.980" Title="Craft asset urls not working" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21675" PostTypeId="2" ParentId="21674" CreationDate="2017-08-22T17:16:31.520" Score="1" Body="&lt;p&gt;As per the Craft Docs at &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs#environment-specific-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/multi-environment-configs#environment-specific-variables&lt;/a&gt;, add a &lt;code&gt;basePath&lt;/code&gt; (or other name) variable to you config. For MAMP, it should look something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'basePath' =&amp;gt; '/Applications/MAMP/htdocs/example.dev/public/'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your asset source settings, change File System Path to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{basePath}assets/images/hero-images/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2017-08-22T17:16:31.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21676" PostTypeId="1" CreationDate="2017-08-22T17:47:11.797" Score="2" ViewCount="327" Body="&lt;p&gt;Recently moved site to a new server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attempting to edit a post created before migration fails. The edit page reloads with the changes removed. Note: 1) this happens for only SOME, but not ALL of entries in the same channel. 2) the entries that fail and those that succeed are set to use the same templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Utilities - Logs shows this error message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Level     error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category  exception.Craft\HttpException.404&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Message   Craft\HttpException in &#xA;  /home/method/craft/app/controllers/TemplatesController.php:72&lt;/p&gt;&#xA;" OwnerUserId="7150" LastEditorUserId="7150" LastEditDate="2017-08-22T18:43:27.600" LastActivityDate="2017-08-23T23:21:18.967" Title="Fixing Craft\HttpException Error" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21677" PostTypeId="1" CreationDate="2017-08-22T23:17:57.640" Score="2" ViewCount="431" Body="&lt;p&gt;Basically, I have an asset volume called Images, with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;base URL: /photos/&#xA;file system path: ~media/images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I go to upload the asset and I try to view it, it gives me a 404 &quot;Template not Found&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mydomain.com/photos/image.jpg&lt;/p&gt;&#xA;" OwnerUserId="7166" LastActivityDate="2017-08-23T17:26:38.203" Title="Can't find assets publicly via URL" Tags="&lt;assets&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21678" PostTypeId="1" AcceptedAnswerId="21688" CreationDate="2017-08-22T23:26:31.887" Score="1" ViewCount="390" Body="&lt;p&gt;I have an Assets field with a set of images. What is the best way to find one image that has 'featured' checkbox checked? This is the code I put together to check which of the images is marked 'featured' but I'm not sure how to modify this so to display just the 'featured' image without looping through the entire set. In my use case I need to display a page of entries with featured image for each of them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.image %}&#xA;   &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;   {% if image.featured | length %}(Featured Image){% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-08-23T16:32:35.333" Title="How to display a specific image from Assets field" Tags="&lt;assets&gt;&lt;elementcriteriamodel&gt;&lt;image&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21679" PostTypeId="2" ParentId="21669" CreationDate="2017-08-23T03:41:46.707" Score="1" Body="&lt;p&gt;I further adjusted permissions on the folders again and made a copy (everything with the craft folder in /public_html was working fine), moved that copy back under the public root.  Switched the directory call in index.php and it works now.  Go figure, it was permissions after all.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-08-23T03:41:46.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21681" PostTypeId="2" ParentId="21419" CreationDate="2017-08-23T07:20:07.647" Score="2" Body="&lt;p&gt;I made a simple mistake by defining the array with the setting value.&#xA;I wrote &lt;code&gt;array('currentInvoiceNumber', $newInvoiceNumber)&lt;/code&gt; instead of &lt;code&gt;array('currentInvoiceNumber' =&amp;gt; $newInvoiceNumber)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2017-08-23T17:35:35.910" LastActivityDate="2017-08-23T17:35:35.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21682" PostTypeId="1" CreationDate="2017-08-23T09:38:32.200" Score="1" ViewCount="498" Body="&lt;p&gt;I want to add slider on my home page. How can I add slider?&lt;/p&gt;&#xA;" OwnerUserId="7163" LastEditorUserId="45" LastEditDate="2017-08-25T20:52:52.523" LastActivityDate="2017-08-25T20:52:52.523" Title="How can I add banner slider on my home page?" Tags="&lt;frontend&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21683" PostTypeId="1" AcceptedAnswerId="21684" CreationDate="2017-08-23T09:58:08.137" Score="4" ViewCount="109" Body="&lt;p&gt;I've got a channel where entries will be tagged with multiple categories. I want to use those categories to show related content for each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if an entry has cat_a, cat_b and cat_c, I want to pull in any entry that has cat_a, cat_b or cat_c, then order by how many categories they have in common – so an entry matching two of those categories would come before and entry only matching one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I want to also sort by date. So I'd first show entries matching all 3 categories (newest first), then entries matching 2 categories (newest first) etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to do this?&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2017-08-23T10:17:03.370" Title="Sort entries by best match to multiple categories" Tags="&lt;categories&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21684" PostTypeId="2" ParentId="21683" CreationDate="2017-08-23T10:17:03.370" Score="3" Body="&lt;p&gt;Have a look at the Similar plugin &lt;a href=&quot;https://github.com/aelvan/Similar-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Similar-Craft&lt;/a&gt;, it should do exactly what you’re looking for.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set baseCriteria = craft.entries({&#xA;    order: 'postDate desc',&#xA;    limit: 5,&#xA;}) %}&#xA;&#xA;{% set similarEntries = craft.similar.find({&#xA;    element: entry,&#xA;    context: entry.myCategoriesField,&#xA;    criteria: baseCriteria,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-08-23T10:17:03.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21685" PostTypeId="2" ParentId="21682" CreationDate="2017-08-23T11:15:08.823" Score="4" Body="&lt;p&gt;In Craft, you as developer are responsible for everything that is front-end output. So if you want a banner slider, you'll have to add a field on the entry where you can add images, and in your entry's template, write the needed html to display the banner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest going trough the &lt;a href=&quot;http://craftcms.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; to learn about entries, fields,templates, ... Also you could check out the courses at for example &lt;a href=&quot;http://mijingo.com/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;mijngo&lt;/a&gt; but those aren't free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As carlcs pointed out, here are some popular options for displaying banners:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://kenwheeler.github.io/slick/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slick&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://flickity.metafizzy.co/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Flickity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-23T11:15:08.823" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21686" PostTypeId="1" AcceptedAnswerId="21687" CreationDate="2017-08-23T13:24:21.600" Score="1" ViewCount="161" Body="&lt;p&gt;I have a collection of entries in a structure, and each entry can be in multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to sort the entries seperately for each category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category 1: entry 1, entry 2, entry 3&#xA;Category 2: entry 3, entry 2, entry 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There seems to be lots of very similar questions here already, but none that are exactly like this, and I can't figure out how to do it. Can someone please help?&lt;/p&gt;&#xA;" OwnerUserId="6916" LastActivityDate="2017-08-23T14:23:20.020" Title="Sort entries per category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21687" PostTypeId="2" ParentId="21686" CreationDate="2017-08-23T14:23:20.020" Score="3" Body="&lt;p&gt;I might be wrong, but your question sounds like you currently don’t even have something set up in the CMS that determines the order the entries should be listed under each category, and the reason for this probably is that you are using a Categories field assigned to the entries’ field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am suggesting is to reverse that setup. An Entries field on your category’s field layout not only allows to select which entries you want to relate to each category, but also in which order they should be listed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before implementing this you better check if this reversed setup does also make sense for the data entry, but the fact that you’re interested in the sort order is an indication that this might be the case.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-08-23T14:23:20.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21688" PostTypeId="2" ParentId="21678" CreationDate="2017-08-23T15:29:17.203" Score="1" Body="&lt;p&gt;I can do something like this and it will display all featured images but will require looping through the entire image set for each entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.image %}&#xA;    {% if image.featured | length %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{ image.title }}&quot; class=&quot;img-fluid&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also came up with another solution that goes through the images until it finds a featured image and then stops. If no featured image is found it displays the first one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set break = false %}&#xA;{% for image in entry.image if not break %}&#xA;    {% if image.featured | length %}&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{ image.title }}&quot; class=&quot;img-fluid&quot;&amp;gt;&amp;lt;/a&amp;gt;                                 &#xA;      % set break = true %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for image in entry.image.limit(1) if not break %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ image.getUrl('thumb') }}&quot; alt=&quot;{{ image.title }}&quot; class=&quot;img-fluid&quot;&amp;gt;&amp;lt;/a&amp;gt;                                 &#xA;    {% set break = true %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7082" LastEditorUserId="7082" LastEditDate="2017-08-23T16:32:35.333" LastActivityDate="2017-08-23T16:32:35.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21689" PostTypeId="1" CreationDate="2017-08-23T15:47:42.633" Score="1" ViewCount="1362" Body="&lt;p&gt;Could a tool like AngularJS or VueJS or React help in significantly customizing the Craft admin interface? Could it help add additional functionalities? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, let's take the example of adding external links to a post. Vox Media's Chorus lets writers save links in a browser bookmarklet (during their research process), and then pop it on the sidebar in their CMS admin interface when the writer clicks on the bookmarklet. The writer could now just select a phrase in his copy, and then click on a link in the sidebar and have it added to the text automatically. No selecting the text and then clicking on Add link and then copy-pasting the link. Lot of steps reduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above cannot be done on Craft by default and in my research I haven't found a plugin that enables such a functionality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could the admin interface in Craft be altered to include such functions that aid in speeding up the editorial workflow?&lt;/p&gt;&#xA;" OwnerUserId="7169" LastActivityDate="2017-08-23T18:05:22.033" Title="How Customizable is the Craft Admin Interface?" Tags="&lt;admin&gt;&lt;javascript&gt;&lt;editor&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21690" PostTypeId="1" AcceptedAnswerId="21692" CreationDate="2017-08-23T16:21:03.390" Score="3" ViewCount="194" Body="&lt;p&gt;Is it possible to control the Matrix layout with CSS within the CP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Rich Text fields I have are currently displaying like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wzUtO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wzUtO.png&quot; alt=&quot;Craft CMS matrix default layout&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'd like this specific field to look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/52zYk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/52zYk.png&quot; alt=&quot;Craft CMS matrix custom layout&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to avoid using a plugin if possible.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="57" LastEditDate="2017-08-23T17:52:19.493" LastActivityDate="2017-08-23T22:58:09.473" Title="Control CP matrix layout with CSS" Tags="&lt;control-panel&gt;&lt;cp-dashboard&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21691" PostTypeId="1" AcceptedAnswerId="21708" CreationDate="2017-08-23T16:37:11.430" Score="1" ViewCount="201" Body="&lt;p&gt;We've built quite a few sites in Craft CMS and have been waiting for a project to get stuck into Craft Commerce - that time is here! BUT, one thing - it's for a carpet company so allowing the user to add a width and length of carpet is critical. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading many similar questions, I see that everyone's pointing to creating variants for each option. This isn't practical for this case as they have many types of widths let alone being able to type in a length. Plus, they get new stock quite often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're currently using WooCommerce and we really don't want to go back to Magento so it'll be a shame if we couldn't use Craft Commerce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here are my questions - has anybody released a plugin that can do the above? If not, is a plugin the way to go for this? Finally, are there any plans to add this functionality into Craft Commerce?&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2017-08-23T23:47:31.883" Title="Width, length and dynamic pricing - Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21692" PostTypeId="2" ParentId="21690" CreationDate="2017-08-23T16:52:32.167" Score="2" Body="&lt;p&gt;Unfortunately not. To do that kind of change your best bet would be to use &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CPCSS&lt;/a&gt;. It's a plugin but really only just provides you with a way to inject custom styles or a stylesheet for use in the control panel. It's well maintained by a responsible author so I don't see any reason to worry about that one.&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2017-08-23T16:52:32.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21695" PostTypeId="2" ParentId="21689" CreationDate="2017-08-23T17:50:55.633" Score="1" Body="&lt;p&gt;There are some ways to customize the Craft Control Panel interface, but probably not to the extent that you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The native way to do this would be through the use of the not-at-all documented template hooks similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14516/how-to-add-a-custom-button-at-the-right-section-of-an-entry/14526#14526&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can search through the &lt;code&gt;craft/app/templates&lt;/code&gt; folder for &lt;code&gt;{% hook&lt;/code&gt; to get a full list of hooks available and the templates they live in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a bit more kludgy solution, you could use plugins like &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP CSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP JS&lt;/a&gt; for injecting arbitrary CSS/JS into Control Panel requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth noting this from the &lt;a href=&quot;https://craftcms.com/license&quot; rel=&quot;nofollow noreferrer&quot;&gt;license agreement&lt;/a&gt; when dealing with plugins that modify Control Panel functionality:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You may not write a plugin that breaks or tampers with any of Craft’s built-in functionality, including any restrictions related to license/edition enforcement, its core feature set, or its Premium Features.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-23T17:50:55.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21697" PostTypeId="2" ParentId="21689" CreationDate="2017-08-23T18:05:22.033" Score="1" Body="&lt;p&gt;Another solution to this would be to accomplish what you want to accomplish via a custom plugin, or via a custom frontend entry form, in which you'd control the exact experience that the content authors see. c.f.: &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously either of these require additional development work.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-08-23T18:05:22.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21698" PostTypeId="1" AcceptedAnswerId="21713" CreationDate="2017-08-23T19:32:08.960" Score="2" ViewCount="607" Body="&lt;p&gt;I'm running Craft with MAMP under this file system path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/&#xA;public_html/&#xA;    index.php&#xA;    img/uploads/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Via Settings &gt; Assets, I have set the following paths:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GlEVH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GlEVH.png&quot; alt=&quot;Craft CMS Assets Settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried this path under &quot;URL&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost:8888/project_name/craft/public_html/img/uploads/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I go to upload an image, the loading bar is stuck at 100% and nothing uploads. What am I doing wrong here?&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="57" LastEditDate="2017-08-23T22:50:24.387" LastActivityDate="2017-08-24T13:56:19.037" Title="Assets on localhost" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21699" PostTypeId="1" AcceptedAnswerId="21705" CreationDate="2017-08-23T19:48:00.880" Score="1" ViewCount="645" Body="&lt;pre&gt;&lt;code&gt;$entry = Entry::find()-&amp;gt;section('my_section')-&amp;gt;relatedTo($entry)-&amp;gt;all();&#xA;$entry['myMatrixField']; // What do I do with this??&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know there are tutorials about how to handle Matrix fields in plugins in Craft 2, but how do I do this in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="7166" LastEditorUserId="57" LastEditDate="2017-08-23T21:54:49.070" LastActivityDate="2017-08-23T22:49:47.843" Title="How do you iterate over Matrix field in a Craft 3 plugin?" Tags="&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21700" PostTypeId="2" ParentId="21698" CreationDate="2017-08-23T21:21:20.147" Score="2" Body="&lt;p&gt;Try access your asset by this URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost:8888/img/uploads/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7131" LastActivityDate="2017-08-23T21:21:20.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21701" PostTypeId="2" ParentId="21650" CreationDate="2017-08-23T21:27:17.620" Score="1" Body="&lt;p&gt;Go to setting, then try to click Update Assets Indexes.&lt;/p&gt;&#xA;" OwnerUserId="7131" LastActivityDate="2017-08-23T21:27:17.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21703" PostTypeId="2" ParentId="21619" CreationDate="2017-08-23T21:32:41.320" Score="0" Body="&lt;p&gt;Have you tried to activate development mode under &lt;code&gt;craft/config/general.php&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7131" LastActivityDate="2017-08-23T21:32:41.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21704" PostTypeId="1" CreationDate="2017-08-23T22:24:36.337" Score="1" ViewCount="389" Body="&lt;p&gt;I'm working with an external system that requires me to send line items + their tax rate, and the shipping as it's own line item + any tax applied to the shipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The format expected looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;items&quot;: [&#xA;    {&#xA;        &quot;reference&quot;: &quot;11&quot;,&#xA;        &quot;name&quot;: &quot;The Fleece Awakens&quot;,&#xA;        &quot;quantity&quot;: 13,&#xA;        &quot;unit_price&quot;: 5250,&#xA;        &quot;tax_rate&quot;: 2500&#xA;    },&#xA;    {&#xA;        &quot;reference&quot;: &quot;9&quot;,&#xA;        &quot;name&quot;: &quot;Romper for a Red Eye&quot;,&#xA;        &quot;quantity&quot;: 3,&#xA;        &quot;unit_price&quot;: 4000,&#xA;        &quot;tax_rate&quot;: 2500&#xA;    },&#xA;    {&#xA;        &quot;reference&quot;: &quot;2&quot;,&#xA;        &quot;name&quot;: &quot;Fedex&quot;,&#xA;        &quot;quantity&quot;: 1,&#xA;        &quot;unit_price&quot;: 180,&#xA;        &quot;tax_rate&quot;: 1500&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The price and tax rate is multiplied by 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gets even more complex depending on how the tax and shipping rules are setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to cover everything, like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When a shipping method has a base rate + perItemRate&lt;/li&gt;&#xA;&lt;li&gt;When tax is applied either to item price or item shipping cost, or item price + shipping cost&lt;/li&gt;&#xA;&lt;li&gt;When tax is included &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How would I consistently get it in the format like this, while accounting for any adjusters (tax, shipping, sale/discounts)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed adjusters has &lt;code&gt;optionsJson-&amp;gt;lineItemsAffected&lt;/code&gt;, which might be interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't know enough about the complex tax/shipping system or how adjusters work in general to foresee all the different combinations of adjusters.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-08-25T04:39:24.130" Title="Getting line items + shipping and their tax rates in a plugin" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21705" PostTypeId="2" ParentId="21699" CreationDate="2017-08-23T22:49:47.843" Score="1" Body="&lt;p&gt;If you had a Matrix field with a handle of &lt;code&gt;matrix&lt;/code&gt; and it had a Matrix Block Type with a handle of &lt;code&gt;MyMatrixBlock&lt;/code&gt; and it had a Plain Text field with a handle of &lt;code&gt;text&lt;/code&gt;, this is how you'd grab it in PHP.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = Craft::$app-&amp;gt;getEntries()-&amp;gt;getEntryById(2);&#xA;&#xA;foreach ($entry-&amp;gt;matrix as $matrixBlock) {&#xA;    if ($matrixBlock-&amp;gt;getType()-&amp;gt;name === 'MyMatrixBlock') {&#xA;        // Grab a text field from the block.&#xA;        $textField = $matrixBlock-&amp;gt;text;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-23T22:49:47.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21706" PostTypeId="2" ParentId="21690" CreationDate="2017-08-23T22:58:09.473" Score="1" Body="&lt;p&gt;Change your Matrix field to a &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;SuperTable field&lt;/strong&gt;&lt;/a&gt; and use the &quot;Table Layout&quot; setting for the field to accomplish this data arrangement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Table Layout&quot; setting is here:&lt;br&gt;&#xA;&lt;a href=&quot;https://www.screencast.com/t/Y3jm9DIr&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.screencast.com/t/Y3jm9DIr&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2017-08-23T22:58:09.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21707" PostTypeId="2" ParentId="21676" CreationDate="2017-08-23T23:21:18.967" Score="2" Body="&lt;p&gt;That's it. mod_security is on by default and a rule is getting triggered. Turned it off and now the entry can be modified and saved. Thank you Brad! &lt;/p&gt;&#xA;" OwnerUserId="7150" LastActivityDate="2017-08-23T23:21:18.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21708" PostTypeId="2" ParentId="21691" CreationDate="2017-08-23T23:47:31.883" Score="1" Body="&lt;p&gt;Sounds to me like this is a job for a Custom Purchasable.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you write a plugin such that your created element meets the Purchasable interface, which handles it's own pricing calculations etc., and that custom purchasable becomes a sellable item through Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation is here: &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/purchasables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, I can't see why Commerce wouldn't work well for such a scenario as it allows for complete flexibility with front end presentation and checkout.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-08-23T23:47:31.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21709" PostTypeId="1" CreationDate="2017-08-24T00:12:12.863" Score="1" ViewCount="376" Body="&lt;p&gt;I'm looking to pull assets from a local folder when developing locally, and an S3 folder when on staging/production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? It looks like no, but I'm hoping that's not the definitive answer: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15190/multi-environment-s3-asset-paths&quot;&gt;Multi-Environment S3 Asset Paths&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears you can't alter the asset 'type'. However, I've seen configs (specifically, this one: &lt;a href=&quot;https://designkarma.co.uk/blog/localization-multi-environment-setup-in-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://designkarma.co.uk/blog/localization-multi-environment-setup-in-craft&lt;/a&gt;) that seem to use different urls for local vs s3 assets. That gets rid of the ability to set a cache duration and other s3 specific options, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only real way to do this is to set CORS settings on the S3 folder to allow connections from a local development URL, and use that for local/staging, and another bucket/config for production?&lt;/p&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2018-04-19T16:16:14.863" Title="Local vs Amazon S3 asset paths in multi-environment config" Tags="&lt;assets&gt;&lt;multi-environment&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21710" PostTypeId="2" ParentId="21704" CreationDate="2017-08-24T07:40:32.297" Score="2" Body="&lt;p&gt;Currently there is a limitation on the adjuster system, in that there is no history of every adjustment made to the order for most adjusters. This is a limitation of the current architecture. I will walk through the current architecture and explain the changes that we plan to release in Craft Commerce 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with an order that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;itemA price        10&#xA;      shippingCost 0&#xA;      discount     0&#xA;      tax          0&#xA;      total        10&#xA;&#xA;itemA price        20&#xA;      shippingCost 0&#xA;      discount     0&#xA;      tax          0&#xA;      total        20&#xA;&#xA;baseShippingCost   0&#xA;baseTax            0&#xA;baseDiscount       0&#xA;&#xA;order total        30&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above order, there has been no adjustments run &quot;over&quot; the order yet. Lets think of this as the state of the order at the beginning of a recalculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the adjuster recalculation starts it clears all the adjustable values (&lt;code&gt;shippingCost&lt;/code&gt;, &lt;code&gt;discount&lt;/code&gt;, &lt;code&gt;tax&lt;/code&gt;) from the line items, and also clears the 'base' values on the order (&lt;code&gt;baseShippingCost&lt;/code&gt;, &lt;code&gt;baseDiscount&lt;/code&gt;, &lt;code&gt;baseTax&lt;/code&gt;). It also resets the totals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first adjuster to run is the discount adjuster. It will apply any matching discounts by modifying the amount of &lt;code&gt;discount&lt;/code&gt; on each line item as well as the &lt;code&gt;baseDiscount&lt;/code&gt; amount for order level discounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that 2 discounts were applied to the order. One that takes $1 off each line item and $10 of the total order, and the second discount taking $5 off the total order and $2 off each line item. Since there are 2 discounts, the discount adjuster is deciding to return 2 adjustments to the order, one totaling $12 and the other totaling $9. The order will then look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;itemA price        10&#xA;      shippingCost 0&#xA;      discount     -3&#xA;      tax          0&#xA;      total        7&#xA;&#xA;itemA price        20&#xA;      shippingCost 0&#xA;      discount     -3&#xA;      tax          0&#xA;      total        17&#xA;&#xA;Adjustment1 (discount) -12&#xA;Adjustment2 (discount) -9&#xA;&#xA;baseShippingCost   0&#xA;baseTax            0&#xA;baseDiscount       -15&#xA;&#xA;order total        9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The total of the order is now $9. Currently, there are 2 ways to get to this total:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;all line item totals (which include each line item's `shippingCost`, `tax`, `discount`)&#xA;+&#xA;`baseShippingCost`, `baseDiscount`, `baseTax`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;adjustments&#xA;+&#xA;all line item price &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both of these methods get to the same total, but the problem with this is that BOTH methods still do not contain all the information. For example, the line itemA's &lt;code&gt;discount&lt;/code&gt; is -3 but it is made up of 2 discount adjustments, &lt;code&gt;-1 and -2&lt;/code&gt;. There currently is no way to fully know how that value came to be. The same goes for the total adjustment amount, it only stored a total adjustment made to the order, with no breakdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not ideal, but we tried to combat it with an attribute on the adjustment model:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;OrderAdjustmentModel::optionsJson&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This column stores an array of line item IDs (in array key &lt;code&gt;lineItemsAffected&lt;/code&gt;) that the adjustment modified, and it also stores information about the modification rules used like the discount's attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in &lt;code&gt;AdjustmentA&lt;/code&gt; all of the attributes (pricing rules) of the discount are serialized into a json array and stored in the &lt;code&gt;optionsJson&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the 2 ideas above do not help in understanding all adjustments made to order without a lot of work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution in Craft Commerce 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have been working on Commerce 2 with a solution to the above issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) All adjustments made to the line items are now stored as seperate adjustments on the order. For example, in the above order AdjustmentA would &#xA;create 3 adjustments, 1 to each line item for the discount, and one to the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All adjustments will be for single amount, not combined amounts. This means adjusters will no longer do this: &lt;code&gt;$order-&amp;gt;baseShippingCost += 10&lt;/code&gt;. They will not mutate the value, only add a new adjustment of 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) All line item fields that an adjuster modifies are removed. This means &lt;code&gt;shippingCost&lt;/code&gt;, &lt;code&gt;tax&lt;/code&gt;, &lt;code&gt;discounts&lt;/code&gt; are no longer stored on the line item. The attributes will be replaced with magic getters that add up all adjustments made to the line item for a particular adjustment type. We will probably still store them in the database but in a column called 'adjustment totals' as json (so you can still do DB queries on them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) All order level &lt;code&gt;baseShipping&lt;/code&gt;, &lt;code&gt;baseTax&lt;/code&gt;, &lt;code&gt;baseDiscount&lt;/code&gt; attributes will be removed and replaced with order level adjustments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means adjusters now will return more adjustment models (with more lines added to the order), but the developer can still use the magic methods to show the total amount of shipping, discounts, tax at the line item or order level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have any questions, and I will update the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note1: The migration to the new order calculation system will turn each of the line item's adjustable amounts (&lt;code&gt;shippingCost&lt;/code&gt;, &lt;code&gt;tax&lt;/code&gt;, &lt;code&gt;discount&lt;/code&gt;) and &lt;code&gt;baseX&lt;/code&gt; amounts into line item adjustments. We will archive the old adjustment totals (or zero them out so they can still show the data). This will not lose any order information, nor add any, but will be compatible with the new order recalculation adjustment system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note2: The issue with supplying information to 3rd parties ONLY as line items is that there can be order level adjustments that live outside of the line items. You would need to figure out how to send that additional pricing information yourself.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2017-08-25T04:39:24.130" LastActivityDate="2017-08-25T04:39:24.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21712" PostTypeId="1" AcceptedAnswerId="21760" CreationDate="2017-08-24T10:14:10.550" Score="0" ViewCount="525" Body="&lt;p&gt;We uploaded a lot of images to the S3 bucket that is connected to our assets in Craft, but when we run &quot;Update Asset Indexes&quot; on the settings page, those images aren't added to the assets in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure that the settings for the asset source is correct (images that we upload via Craft are working). And it doesn't seem to be related to a time-out, because we updated the php and nginx settings, and now it finishes after ~70s instead of 60s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are we doing wrong? &#xA;Is it even possible to import images this way?&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-29T17:25:54.937" Title="Update Asset Indexes for new files in s3 not working" Tags="&lt;assets&gt;&lt;php&gt;&lt;s3&gt;&lt;nginx&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21713" PostTypeId="2" ParentId="21698" CreationDate="2017-08-24T13:42:17.210" Score="0" Body="&lt;p&gt;It turns out that the problem wasn't down to the asset paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After setting the original paths from my question, I was able to upload PNG files, but not JPEGs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to &lt;a href=&quot;https://stackoverflow.com/questions/13201071/how-to-install-image-magick-for-mamp-pro-on-mountain-lion-10-8-2&quot;&gt;enable ImageMagick in php.ini on MAMP&lt;/a&gt; for Craft to accept JPEG uploads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5415/all-images-uploading-except-jpg-files&quot;&gt;this answer&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="7160" LastEditDate="2017-08-24T13:56:19.037" LastActivityDate="2017-08-24T13:56:19.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21714" PostTypeId="1" CreationDate="2017-08-24T14:56:41.060" Score="1" ViewCount="368" Body="&lt;p&gt;Is there a best way to import a large number of records - About 315000 to be precise. The company provides a service which is only available to specific addresses.&#xA;So I had set up a section to contain the addresses where the service is available. With fields - Address1, Address2, Postcode, Town&#xA;Just got the data to import and discovered that there is 315000 records - I got the data in csv format. Tried with Import and FeedMe Plugins but run into memory issues straight away. CSV file is nearly 15MB and when converted to XML for feedme it is 52MB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what are my options for importing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I ramp up the resources on a Digital Ocean Server for the time that the import is required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I try another method to try this lookup service on the website? &lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-08-24T17:26:39.297" Title="Import Large Number of records - 300,000" Tags="&lt;import&gt;&lt;plugin-feedme&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21715" PostTypeId="1" AcceptedAnswerId="21717" CreationDate="2017-08-24T15:11:01.597" Score="2" ViewCount="252" Body="&lt;p&gt;I'm working on a plugin to calculate price based on width and height but struggling to get the product type of each product into the 'onPopulateLineItem' event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I've looked into the purchasables and lineItems arrays to get the information, and although I can see the typeId under the $event array, I just can't get this value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction for this please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** UPDATE **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to get something with the below, but this feels really hacky. Is there a better way I should be doing this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lineItem = $event-&amp;gt;params['lineItem'];&#xA;echo $lineItem['snapshot']['product']['typeId'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4942" LastEditorUserId="4942" LastEditDate="2017-08-24T15:19:38.620" LastActivityDate="2017-08-25T04:39:31.827" Title="Get product type on event handler" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21716" PostTypeId="2" ParentId="21714" CreationDate="2017-08-24T17:26:39.297" Score="1" Body="&lt;p&gt;Increasing your servers available memory and execution time can help increase the number of items you can import in a single file, but with the number of records you're dealing with it's likely, you'll need to break your import into multiple steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider breaking up the import files into smaller batches that can be imported within your environment's memory limit. As a first step, you could manually test for a limit of the max number of entries you can import.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could be done by going back to the source that provided you the large CSV file and asking if they can provide you several CSV files of 50,000 records each, 10,0000 records each, or whatever number of records you found to be your limit. You may end up with lots of files and that's fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially also write a script that takes your CSV file or converted XML file and breaks it into several files on your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with all the options in the Import and FeedMe plugins. My firm develops Sprout Import and we support batch importing multiple files. Sprout Import also requires data to be in a specific JSON format, which would likely require writing an additional script in your case as well.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-08-24T17:26:39.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21717" PostTypeId="2" ParentId="21715" CreationDate="2017-08-24T18:28:17.803" Score="0" Body="&lt;p&gt;100% untested, but I'd probably go through the purchasable to get the product type.  Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$lineItem = $event-&amp;gt;params['lineItem'];&#xA;$purchasable = $lineItem-&amp;gt;getPurchasable();&#xA;$variant = $purchasable-&amp;gt;getProduct();&#xA;$productType = $variant-&amp;gt;getType();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$productType&lt;/code&gt; will be of type &lt;code&gt;commerce\models\Commerce_ProductTypeModel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-24T18:28:17.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21720" PostTypeId="2" ParentId="21715" CreationDate="2017-08-24T23:33:04.717" Score="2" Body="&lt;p&gt;Very minor change to Brad's approach, and with a bit more checking to avoid issues like the product being deleted while the code is looking in that direction, etc. (based on Luke's advice).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($cart-&amp;gt;lineItems as $item)&#xA;{&#xA;    // check the purchasable has not been deleted in the meantime&#xA;    if ($item-&amp;gt;purchasableId)&#xA;    {&#xA;        // get the variant and the actual product so we can get to custom fields&#xA;        $variant = $item-&amp;gt;purchasable;&#xA;&#xA;        // If there is no product associated with this purchasable, it's a digital virtual product so just skip it&#xA;        if (!isset($variant-&amp;gt;product))&#xA;        {&#xA;            continue;&#xA;        }&#xA;&#xA;        // get the actual product element from the purchasable&#xA;        $product = $variant-&amp;gt;product;&#xA;&#xA;        // How to get a regular field on the product&#xA;        $title = $product-&amp;gt;title;&#xA;&#xA;        // How to get the product type - use handle rather than name, as this is less likely to change&#xA;        $productType = $product-&amp;gt;type-&amp;gt;handle;&#xA;&#xA;        ...etc&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="57" LastEditDate="2017-08-25T04:39:31.827" LastActivityDate="2017-08-25T04:39:31.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21722" PostTypeId="5" CreationDate="2017-08-25T20:56:12.437" Score="0" Body="&lt;p&gt;Please do not use the &quot;craft&quot; tag. It is redundant and uninformative. There are many tags to choose from, please use tags which more specifically covered in your question.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-08-25T20:56:12.437" LastActivityDate="2017-08-25T20:56:12.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21723" PostTypeId="4" CreationDate="2017-08-25T20:56:12.437" Score="0" Body="DO NOT USE THIS TAG. The entire website is about Craft, it is redundant to tag a post &quot;craft&quot;." OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-08-25T20:56:12.437" LastActivityDate="2017-08-25T20:56:12.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21724" PostTypeId="1" CreationDate="2017-08-25T22:11:11.650" Score="2" ViewCount="327" Body="&lt;p&gt;Has Craft stopped shipping with unit tests? I'm trying to unit test a plugin and have noticed from several previous answers (e.g &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16324/phpunit-testing-for-craft-plugins-or-controllers&quot;&gt;PHPUnit testing for Craft plugins or controllers&lt;/a&gt;) that it was possible at some stage using Craft's local tests. Have these since been removed? There no longer seems to be a tests folder inside the latest download of Craft/app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the current best practice for setting up Unit Tests using Craft 2 in a plugin?&lt;/p&gt;&#xA;" OwnerUserId="3438" LastActivityDate="2017-12-15T20:28:10.463" Title="Unit Testing with current version of Craft" Tags="&lt;plugin-development&gt;&lt;tests&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21725" PostTypeId="1" AcceptedAnswerId="21736" CreationDate="2017-08-25T22:16:09.013" Score="2" ViewCount="121" Body="&lt;p&gt;If we pass through an array of Channels &amp;amp; Structure sections we find that Channels entries tend to be listed first. So the first 15 will comprise of ChannelOne and ChannelTwo and then start listing the Structure section. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homepageEntries = craft.entries({&#xA;    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],&#xA;    limit: 15&#xA;}) %}&#xA;&#xA;{% for item in homepageEntries %}&#xA;{{ item.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All we want is a list of the 15 most recent items from a number of sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not look to be as straightforward as it seems. Creating multiple arrays of ids and merging still seems to produce the same results. &lt;/p&gt;&#xA;" OwnerUserId="7177" LastActivityDate="2017-08-27T19:45:04.757" Title="List most recent items combined from Channel and Structure sections" Tags="&lt;templating&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21727" PostTypeId="2" ParentId="8570" CreationDate="2017-08-26T13:48:58.090" Score="2" Body="&lt;p&gt;I came across this post while attempting to solve a similar problem myself. Here is my solution (I am sure it could be refactored some) using Bootstrap 4 Beta and a Matrix field. This includes the indicators and the next/prev button. I wanted to make sure if the client added more photos to the carousel, it would scale properly. I wouldn't suggest more than 5 slides, though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.carousel | length %}&#xA;&amp;lt;div class=&quot;container-fluid quotes p-0 hidden-sm-down&quot;&amp;gt;&#xA;  &amp;lt;div id=&quot;quotesCarousel&quot; class=&quot;carousel slide&quot; data-ride=&quot;carousel&quot; data-interval=&quot;6000&quot; &amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;carousel-inner&quot; role=&quot;listbox&quot;&amp;gt;&#xA;    {% set carousel_count = 0 %}&#xA;    {% for block in entry.carousel %}&#xA;      {% set loopIndex = loop.index %}&#xA;      {% switch block.type %}&#xA;        {% case 'carouselSegment' %}&#xA;          {% set carousel_count = loopIndex %}&#xA;          {% set image = block.image.first %}&#xA;            &amp;lt;div class=&quot;carousel-item {% if loopIndex == 1 %}active{% endif %}&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;carousel-caption d-none d-md-block align-items-center&quot;&amp;gt;&#xA;                &amp;lt;h3&amp;gt;&amp;lt;em&amp;gt;{{block.mainContent}}&amp;lt;/em&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;h2 class=&quot;py-3&quot;&amp;gt;{{block.subContent}}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{block.contentSource}}&amp;lt;/h4&amp;gt;&#xA;              &amp;lt;/div&amp;gt;&#xA;              &amp;lt;img class=&quot;d-block img-fluid&quot; src=&quot;{{image.getUrl()}}&quot; alt=&quot;{{image.title}}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;      {% endswitch %}&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  &amp;lt;ol class=&quot;carousel-indicators&quot;&amp;gt;&#xA;    {% for i in 1..carousel_count %}&#xA;    &amp;lt;li data-target=&quot;#quotesCarousel&quot; data-slide-to=&quot;{{i}}&quot; class=&quot;{% if i == 1 %}active{% endif %}&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ol&amp;gt;&#xA;&#xA;  &amp;lt;a class=&quot;carousel-control-prev&quot; href=&quot;#quotesCarousel&quot; role=&quot;button&quot; data-slide=&quot;prev&quot;&amp;gt;&#xA;    &amp;lt;span class=&quot;carousel-control-prev-icon&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;sr-only&quot;&amp;gt;Previous&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;  &amp;lt;a class=&quot;carousel-control-next&quot; href=&quot;#quotesCarousel&quot; role=&quot;button&quot; data-slide=&quot;next&quot;&amp;gt;&#xA;    &amp;lt;span class=&quot;carousel-control-next-icon&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;sr-only&quot;&amp;gt;Next&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6989" LastActivityDate="2017-08-26T13:48:58.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21728" PostTypeId="1" CreationDate="2017-08-26T16:33:59.397" Score="3" ViewCount="7883" Body="&lt;p&gt;I am trying to install Craft CMS on Ubuntu 14.04 running NGINX, I get this error log, any suggestions on how to fix this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/08/26 16:18:08 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /usr/share/nginx/craft/app/etc/web/WebApp.php:800&#xA;Stack trace:&#xA;#0 /usr/share/nginx/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#1 /usr/share/nginx/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#2 /usr/share/nginx/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#3 /usr/share/nginx/html/index.php(19): require_once('/usr/share/ngin...')&#xA;#4 {main}&#xA;REQUEST_URI=/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="7179" LastEditorUserId="1016" LastEditDate="2017-08-26T17:08:00.560" LastActivityDate="2017-08-27T21:02:47.910" Title="Craft CMS . Service unavailable" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21729" PostTypeId="1" CreationDate="2017-08-26T19:04:43.777" Score="1" ViewCount="90" Body="&lt;p&gt;I am fighting since days with this situation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Select field with around 150 item and depending on a selected item a list of icons and names should be shown (around 50). The list of items (names and an url for an icon) comes from an API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calling this API withing the variable component of a plugin. I have to do it with PHP, AJAX API call is not possible in my case. &#xA;So right now I am putting the whole content in a string and spitting that string out in twig. Resulting in a 37,6 MB document. So this is not the solution...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought is now to return an array of the API in my variable component and grab just the DATA I need on the change event of the select field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible? Can I use the include statement of twig with AJAX? Or grab data from the variable in the plugin with JS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am really not getting forward with this and it's driving me mad !&lt;/p&gt;&#xA;" OwnerUserId="6840" LastEditorUserId="57" LastEditDate="2017-08-27T21:04:09.433" LastActivityDate="2017-08-27T21:04:09.433" Title="Include with AJAX" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;include&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21730" PostTypeId="2" ParentId="21725" CreationDate="2017-08-26T20:27:27.363" Score="2" Body="&lt;p&gt;I'm not exactly sure why what you're trying doesn't work, but there seems to be a workable solution in this post: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12522/how-do-i-sort-a-collection-of-entries-from-multiple-sections-by-date&quot;&gt;How do I sort a collection of entries from multiple sections by date?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set channelOneIds = craft.entries.section('channelOne').ids() %}&#xA;{% set structureOneIds = craft.entries.section('structureOne').ids() %}&#xA;{% set channelTwoIds = craft.entries.section('channelTwo').ids() %}&#xA;{% set structureTwoIds = craft.entries.section('structureTwo').ids() %}&#xA;&#xA;{% set homepageEntryIds = channelOneIds&#xA;    |merge(structureOneIds)&#xA;    |merge(channelTwoIds)&#xA;    |merge(structureTwoIds)&#xA;%}&#xA;&#xA;{% set homepageEntries = craft.entries.id(homepageEntryIds).limit(15) %}&#xA;&#xA;{% for item in homepageEntries %}&#xA;    {{ item.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sorting by postDate descending, is the default, but if you want to be explicit, you can add &lt;code&gt;.order('postDate desc')&lt;/code&gt; just before the &lt;code&gt;.limit&lt;/code&gt; when setting &lt;code&gt;homepageEntries&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2017-08-26T20:27:27.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21731" PostTypeId="2" ParentId="21466" CreationDate="2017-08-26T21:53:24.173" Score="1" Body="&lt;p&gt;The way I see it, you have 2 very similar but different problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How does each &lt;strong&gt;bakery&lt;/strong&gt; log in and maintain their own inventory?&lt;/li&gt;&#xA;&lt;li&gt;How does each &lt;strong&gt;cake&lt;/strong&gt; get built up in the admin?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can pull off the separation of locations by using different permissions. Each Bakery would have their own user login (Store #1, Store #2, etc.) By setting the appropriate permissions, when Bakery #1 logs in, they won't see any other entries/products other than their own. To filter this on the front end, you just ask Craft to filter by the appropriate author. So in other words, Author = Bakery location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We built a site where we had different, individual teachers logging into the same Craft install. Every teacher could post their own class schedule. We also didn't want them to view or edit each other's classes (but everyone on the front end could see and filter them for example). In your case, it would basically work the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem is much more complex.  I don't think you're that far off from creating a single &quot;cake&quot; product or different cake products (depending on what you're selling), for example, and then creating different options (variants) around those basic types. How you build up those products really depends on how you manage inventory, SKUs, variants, prices, etc. If some of those options don't have prices (eg butter creme frosting doesn't cost more than vanilla), it's just an additional option, that gets to be a bit easier in terms of options. You can just pull those options off with Craft fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to pull it off on the admin side would be if the bakeries know how to upload an Excel/CSV file to the site, they could update their availability from that. It would be up to the you, the developer, to figure out what data is available and some sort of function to make it work. That's a pretty common use case for, say, a manufacturer with thousands of SKUs. To change pricing one-by-one in the Craft admin would take hours. But a CSV lets you bump all the prices up or down with just a couple Excel macros, which you can then export out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, these are both non-trivial problems to solve. There's probably other ways to do so but Craft gives you some tools to help pull this off.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-08-26T21:53:24.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21732" PostTypeId="1" AcceptedAnswerId="21734" CreationDate="2017-08-27T06:25:28.810" Score="1" ViewCount="126" Body="&lt;p&gt;I am working with a design that requires entries to be laid out on a listing page in a specific order based on whether they are &quot;Standard&quot; or &quot;Premium&quot;. The order of the paginated listing page is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Standard, Standard,  Premium&lt;/li&gt;&#xA;&lt;li&gt;Standard, Standard, Standard, Standard&lt;/li&gt;&#xA;&lt;li&gt;Premium, Standard, Standard&lt;/li&gt;&#xA;&lt;li&gt;Standard, Standard, Standard, Standard&lt;/li&gt;&#xA;&lt;li&gt;Pagination&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There could be a number of approaches with how I store the entries but my approach has been to set up a channel section &quot;Offers&quot; with two entry types &quot;Standard&quot; and &quot;Premium&quot;. If the layout was not important I have the following working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('offers').limit(14) as pageInfo, pageEntries %}&#xA;&#xA;{% for entry in pageEntries %}&#xA;  {% if entry.type == 'premium' %}&#xA;    {% include &quot;_includes/offers/listing-card-premium&quot; %}&#xA;  {% endif %}&#xA;  {% if entry.type == 'standard' %}&#xA;    {% include &quot;_includes/offers/listing-card&quot; %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# PAGINATIOIN NAV HERE #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, how do I achieve the above but using the specific order I need, whilst still paginating the entries and keeping track of what's been displayed.&lt;/p&gt;&#xA;" OwnerUserId="132" LastActivityDate="2017-08-27T11:12:04.820" Title="Create a specific order of paginated entries by entry type" Tags="&lt;entries&gt;&lt;entry-type&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21733" PostTypeId="2" ParentId="16660" CreationDate="2017-08-27T11:03:26.910" Score="2" Body="&lt;p&gt;I had the same issue on &lt;code&gt;macOS Sierra&lt;/code&gt;, running on with the following installed using &lt;code&gt;homebrew&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft CMS (2.6.2989)&lt;/li&gt;&#xA;&lt;li&gt;nginx (1.12.1)&lt;/li&gt;&#xA;&lt;li&gt;php-fpm 7.1 (7.1.8)&lt;/li&gt;&#xA;&lt;li&gt;php71-imagick (3.4.3)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After a number of hour of digging around I found the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default (don't ask me why), the configuration file for Imagick has image format configuration commented out....Thanks for that guys.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The Fix&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Uncomment file format configurations in &lt;code&gt;/usr/local/etc/ImageMagick-7/magic.xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;magicmap&amp;gt;&#xA;  &amp;lt;magic name=&quot;GIF&quot; offset=&quot;0&quot; target=&quot;GIF8&quot;/&amp;gt;&#xA;  &amp;lt;magic name=&quot;JPEG&quot; offset=&quot;0&quot; target=&quot;\377\330\377&quot;/&amp;gt;&#xA;  &amp;lt;magic name=&quot;PNG&quot; offset=&quot;0&quot; target=&quot;\211PNG\r\n\032\n&quot;/&amp;gt;&#xA;  &amp;lt;magic name=&quot;TIFF&quot; offset=&quot;0&quot; target=&quot;\115\115\000\052&quot;/&amp;gt;&#xA;&amp;lt;/magicmap&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then restart php-fpm (on macOS it was for me &lt;code&gt;brew services restart php71&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Don't forget!&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Once you've done the above, don't forget to run the &lt;code&gt;Update Assets Indexes&lt;/code&gt; in Craft CP. This will generate all of the thumbnails for the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ioEiS.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ioEiS.jpg&quot; alt=&quot;Run -&amp;gt; Update Assets Indexes&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone. &lt;/p&gt;&#xA;" OwnerUserId="7182" LastActivityDate="2017-08-27T11:03:26.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21734" PostTypeId="2" ParentId="21732" CreationDate="2017-08-27T11:12:04.820" Score="1" Body="&lt;p&gt;If I get you right, you want to exclude the premium entries from the others? Carefull, code is not tested ;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set premiumEntries = craft.entries({&#xA;    section: 'offers',&#xA;    entry-type: 'premium',&#xA;    order: 'postDate desc'&#xA;}) %}&#xA;&#xA;{% set standardEntries = craft.entries({&#xA;    section: 'offers',&#xA;    entry-type: 'standard',&#xA;    order: 'postDate desc'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you need to do a loop to merge the standard to the premium. &#xA;Something like this&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4475/merge-two-arrays-of-elementmodels&quot;&gt;Merge two arrays of ElementModels?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... and finally paginate trough all of them. &#xA;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2017-08-27T11:12:04.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21735" PostTypeId="1" CreationDate="2017-08-27T17:27:27.477" Score="1" ViewCount="78" Body="&lt;p&gt;Hi Craft CMS community &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short background: I am working for over 10 years with CMS and lately was using ProcessWire (and sometimes WordPress). Both are fine and especially ProcessWire is a really cool CMS for all sorts of things. I've built small to large websites, shops, blogs etc. with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, sometimes I feel like the last 10% of awesomeness are missing :-) and some parts doesn't match my needs. That's the only reason looking for something else and Craft looks quite good (knowing there is nothing fitting 100%).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read the templating docs and those for plugin development. But there are some questions left.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is no MVC like system, right? Where do I put (separate) code that is not for frontend output? Like on a calendar where a user can filter what needs to be displayed (aka the controller).&lt;/li&gt;&#xA;&lt;li&gt;I really couldn't figure out how to create an entry (I think this is something like a page in Craft) from the API not the CP?&lt;/li&gt;&#xA;&lt;li&gt;Do I need to use plugins for all kind of interaction (like gather user data from a form and save it as an entry or somewhere else in the Craft DB)? Or implementing PayPal or using PHPMailer or creating PDF files etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I consider using it for first time on my next project. Not a simple corporate website, but with a lot of different challenges how to convert clients ideas into a web-project :-) Do you think Craft has a rather steep learning curve like Magento or is something simple to use as WordPress? Maybe here are ProcessWire user with experience on both CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading :-)&lt;/p&gt;&#xA;" OwnerUserId="7183" LastActivityDate="2017-08-28T06:02:20.113" Title="Questions prior using Craft for the first time" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21736" PostTypeId="2" ParentId="21725" CreationDate="2017-08-27T19:45:04.757" Score="3" Body="&lt;p&gt;I was presuming that the default Order for Channels and Structure was postDate desc. But it turns out the default for Structure is sortOrder&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set homepageEntries = craft.entries({&#xA;    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],&#xA;    order: 'postDate desc',&#xA;    limit: 15&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explicitly stating the order seems to fix this issue&lt;/p&gt;&#xA;" OwnerUserId="7177" LastActivityDate="2017-08-27T19:45:04.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21737" PostTypeId="2" ParentId="21728" CreationDate="2017-08-27T21:02:47.910" Score="4" Body="&lt;p&gt;The 503 error that is triggered from that log entry happens when Craft files are in place on the server, but it haven't been installed yet and someone loads the front-end of the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you've set everything else up correct, you just need to complete step #5 in the install docs: &lt;a href=&quot;https://craftcms.com/docs/installing#step-5-run-the-installer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/installing#step-5-run-the-installer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-27T21:02:47.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21738" PostTypeId="1" CreationDate="2017-08-27T22:30:45.697" Score="1" ViewCount="290" Body="&lt;p&gt;Live preview works in some sections, but not ones that use routes and have &quot;entries in this section have their own urls&quot; deselected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behaviour?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to use live preview on these sections?&lt;/p&gt;&#xA;" OwnerUserId="7150" LastActivityDate="2017-08-28T00:11:40.177" Title="Live Preview not working in some sections" Tags="&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21739" PostTypeId="2" ParentId="21738" CreationDate="2017-08-28T00:11:40.177" Score="1" Body="&lt;p&gt;It is expected behavior.  Live Preview is meant to show you what that entry will look like on the front-end of your site with the template specified in that section's setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that entry doesn't have a URL as defined in the section settings, then there is nothing to preview.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-28T00:11:40.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21740" PostTypeId="2" ParentId="21735" CreationDate="2017-08-28T06:02:20.113" Score="2" Body="&lt;p&gt;While I've got no expierence with ProcessWire, I'm a fairly new Craft user myself, and I have to say, it's been a breeze to work with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;All your separate, custom code goes into a plugin, which has to have a certain structure (can be generated for you at &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this site&lt;/a&gt;). There you can hook into events, make your own controllers for custom actions, ... &lt;/li&gt;&#xA;&lt;li&gt;Creating an entry from code can be done by working with it's Model/Record classes and saving it. &lt;/li&gt;&#xA;&lt;li&gt;There's quite some things already in Craft by default, but to handle forms, you'll either have to write your own controller action to capture it, or use a plugin, same goes for using PayPal or creating PDF's. You can also use composer packages with Craft. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While there is a slight learning curve, mainly for plugin development (as you need to know more about Craft's internals than when just creating templates etc...), I found the community around Craft to be one of the best I ever encountered. When stuck, feel free to pose your questions here or on slack :)&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-28T06:02:20.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21742" PostTypeId="1" AcceptedAnswerId="21746" CreationDate="2017-08-28T09:58:39.217" Score="2" ViewCount="1778" Body="&lt;p&gt;Quick question: Is it possible to access the browser's local storage in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In JavaScript you would do something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;localStorage.getItem('myItem');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="57" LastEditDate="2017-08-28T21:48:00.453" LastActivityDate="2017-08-28T21:48:09.630" Title="Local storage in Twig" Tags="&lt;templating&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21743" PostTypeId="1" AcceptedAnswerId="21791" CreationDate="2017-08-28T10:38:48.783" Score="1" ViewCount="117" Body="&lt;p&gt;I've also raised this question / issue at &lt;a href=&quot;https://github.com/engram-design/FeedMe/issues/255&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/FeedMe/issues/255&lt;/a&gt; but this forum might be a better a place as I'm unsure if it is a bug actually&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FeedMe uses date_parse to parse dates in an inbound feed. This usually works out great, the problem I have now is a certain XML-feed is using the Belgian date format (dd/mm/yyyy). I'm unable to change that unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 issues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in case the dd is &gt; 12, the import does not process the date&lt;/li&gt;&#xA;&lt;li&gt;when dd &amp;lt;= 12, it does import them but for some reason it has an -2h offset. Probably some timezone issue, as the timezone is set to Europe/Brusssels, which is CET+2h&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;preparse the dates somehow, to make sure the dates are available in a format that can be understood at all time (eg. yyyy-mm-dd)?&lt;/li&gt;&#xA;&lt;li&gt;set the timezone somehow, so the feedme / craft knows the dates are being presented in CET+2h already?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDITED&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The timezone issue (second bullet) appears to be a known issue, see &lt;a href=&quot;https://github.com/engram-design/FeedMe/commit/a923b67350341dcb17a628376bbb9ab4aa373780&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/FeedMe/commit/a923b67350341dcb17a628376bbb9ab4aa373780&lt;/a&gt; &#xA;This commit did not make it to a release yet (I'm using the most recent one 2.0.7 that doesn't contain this bug fix), if you use the codebase that is currently on the master branch this issue is fixed! &#xA;This leaves me with just 1 to go! &lt;/p&gt;&#xA;" OwnerUserId="397" LastEditorUserId="397" LastEditDate="2017-08-28T11:17:55.637" LastActivityDate="2017-09-01T07:46:26.110" Title="BE formatted dates not imported correctly (or not at all)" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21744" PostTypeId="1" CreationDate="2017-08-28T14:08:45.353" Score="1" ViewCount="80" Body="&lt;p&gt;I have entries called &lt;code&gt;products&lt;/code&gt;. Those entries are organized in categories. I'm using fields to save technical data for each product ( ex. Flow rate, Pressure, Voltage, etc. ).&#xA;Not all fields suit all product categories ( ex. Voltage doesn't make sense for pneumatic pumps ). &#xA;Is there a way to associate some fields only to products in a specific category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="5275" LastEditDate="2017-08-28T14:54:45.057" LastActivityDate="2017-09-04T12:36:28.927" Title="Dynamic fields layout based on categories" Tags="&lt;entries&gt;&lt;categories&gt;&lt;field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21745" PostTypeId="1" CreationDate="2017-08-28T14:49:55.497" Score="0" ViewCount="120" Body="&lt;p&gt;I'm trying to add an export function to my calendar that will export a single event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use the example code, it exports my entire calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried passing a single event using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.calendar.event(craft.request.getSegment(3), ({&#xA;    loadOccurrences: false &#xA;})) %}&#xA;&#xA;{{ craft.calendar.export(events) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to Calendar\Library\Export\AbstractExportCalendar::__construct() must be an instance of Calendar\Library\Events\EventList, instance of Calendar\Library\Events\Event given, called in /craft/plugins/calendar/variables/CalendarVariable.php on line 128 and defined&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a way to export only individual events?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="57" LastEditDate="2017-08-28T21:39:48.343" LastActivityDate="2017-11-26T23:20:35.817" Title="Solspace Calendar: Export a single event" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21746" PostTypeId="2" ParentId="21742" CreationDate="2017-08-28T17:41:39.437" Score="5" Body="&lt;p&gt;No. Twig gets compiled into PHP and is run entirely on the server.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="57" LastEditDate="2017-08-28T21:48:09.630" LastActivityDate="2017-08-28T21:48:09.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21748" PostTypeId="1" AcceptedAnswerId="21761" CreationDate="2017-08-28T19:21:25.787" Score="1" ViewCount="79" Body="&lt;p&gt;***I have just realised I am mixing up my filtering and sorting. I have amended the question to try and make it a bit clearer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to use SuperSort plugin to run different filters, but I'm struggling as only the last filter gets applied. I would like to add the filter to a button or link, so that when the user clicks on it, it activates the filter. Any tips?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;search&amp;lt;/h1&amp;gt;&#xA;&#xA;&amp;lt;form action=&quot;{{ url('search') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set users = craft.users.search(query).order('dateUpdated')|reverse %}&#xA;&#xA;{% if users|length %}&#xA;    &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;span&amp;lt;a href=&quot;{{ users.dateUpdated }}&quot;&amp;gt;{{ users|length }} results:&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{% set usersByFirstName = craft.users.search('sortAS', '{{ firstName}}') %}&quot;&amp;gt;A-Z&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{% set users = craft.users.search(query).order('firstName')|reverse%}&quot;&amp;gt;Z-A&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Nearby&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Newest&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Oldest&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;link#1 - sort A-Z&#xA;link#2 - sort dateUpdated&lt;/p&gt;&#xA;" OwnerUserId="6631" LastEditorUserId="6631" LastEditDate="2017-08-29T09:50:05.480" LastActivityDate="2017-08-29T17:38:38.947" Title="How can I let the user activate a particular SuperSort filter" Tags="&lt;filter&gt;&lt;plugin-supersort&gt;&lt;link&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21749" PostTypeId="2" ParentId="21745" CreationDate="2017-08-28T21:44:01.657" Score="1" Body="&lt;p&gt;There's a definitely a syntax error in your first line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;({&#xA;    loadOccurrences: false&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    loadOccurrences: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, from their docs, the &lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.export/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;export&lt;/code&gt;&lt;/a&gt; method only shows one parameter being passed in and you've specified two.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-28T21:44:01.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21750" PostTypeId="1" CreationDate="2017-08-29T02:58:03.413" Score="0" ViewCount="126" Body="&lt;p&gt;I'm using Freeform Pro to manually output a select field, but I think my question is a general Craft/Twig conditional question so I'm posting it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The option values in my dropdown field are made up of two variables outputted together - an entry title and a category title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to add a conditional for the 'selected' state of the dropdown but I can't get the conditional to work as I'm not sure of the proper syntax to for a concatenated value like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried each of the following but none of them work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&quot;{{ entry.title }} {{ category.entryAlternativeTitle }}&quot; {% if requestTeam.value == 'entry.title category.title' %}selected{% endif %}&amp;gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&amp;lt;/option&amp;gt;&#xA;&#xA;&amp;lt;option value=&quot;{{ entry.title }} {{ category.entryAlternativeTitle }}&quot; {% if requestTeam.value == entry.title category.title %}selected{% endif %}&amp;gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&amp;lt;/option&amp;gt;&#xA;&#xA;&amp;lt;option value=&quot;{{ entry.title }} {{ category.entryAlternativeTitle }}&quot; {% if requestTeam.value == entry.title ~ category.title %}selected{% endif %}&amp;gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&amp;lt;/option&amp;gt;&#xA;&#xA;&amp;lt;option value=&quot;{{ entry.title }} {{ category.entryAlternativeTitle }}&quot; {% if requestTeam.value == {{ entry.title }} {{ category.title }} %}selected{% endif %}&amp;gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help with this.&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-08-29T04:17:43.757" Title="How to add two variables into one conditional" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;plugin-freeform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21751" PostTypeId="2" ParentId="21750" CreationDate="2017-08-29T03:56:09.117" Score="1" Body="&lt;p&gt;Stephen to concatenate remove the quotation marks around both titles and add the tilde between them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if requestTeam.value == entry.title ~ category.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2017-08-29T03:56:09.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21752" PostTypeId="2" ParentId="21750" CreationDate="2017-08-29T04:04:33.987" Score="2" Body="&lt;p&gt;It looks like according to your code this (and Aran's) solution should work except for one small difference... if you are testing for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.title ~ category.title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value parameter (what is getting stored in the database) should match by removing the space, so from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title }}{{ category.entryAlternativeTitle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could also test for the space if you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if requestTeam.value == entry.title ~ ' ' ~ category.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update: Also want to note that you may need to test for the &quot;entryAlternativeTitle&quot; variable. Can't know for sure without seeing all of your code but if this is all being executed in the same chunk it should most likely be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if requestTeam.value == entry.title ~ ' ' ~ category.entryAlternativeTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="28" LastEditorUserId="28" LastEditDate="2017-08-29T04:17:43.757" LastActivityDate="2017-08-29T04:17:43.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21754" PostTypeId="2" ParentId="21543" CreationDate="2017-08-29T10:44:49.323" Score="1" Body="&lt;p&gt;I was adding {slug} in the upload location. This worked for the final file but seems to trigger the behaviour where it links to the temp file.&lt;/p&gt;&#xA;" OwnerUserId="7119" LastActivityDate="2017-08-29T10:44:49.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21755" PostTypeId="1" CreationDate="2017-08-29T13:51:06.777" Score="1" ViewCount="82" Body="&lt;p&gt;Running into a weird issue with the site build I'm working currently: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're creating users based on email addresses coming from an event platform API and are sending activation emails to those users (from our plugin, &#xA;using &lt;code&gt;craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email gets sent out but the activation &lt;code&gt;{{link}}&lt;/code&gt; is missing the host part of the URL. Instead we're seeing links like this: &lt;code&gt;http:/actions/users/setpassword?code=bo2EDjfC7ebsrEpsx5T%7EyJ2Q6TRR0bI6&amp;amp;id=912b5712-89f6-4dbc-9337-dec15b518536&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the host in between and the link works perfectly. I've tried setting a &lt;code&gt;{{ siteUrl }}&lt;/code&gt; specifically the locale I'm in but that doesn't do the trick either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to the new user in the back-end and copy the activation URL there, that one is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers as to what might be causing this? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the &lt;code&gt;craft/config/general.php&lt;/code&gt; we're using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;if (!defined('PROJECTCODE')) {&#xA;    define('PROJECTCODE', strtolower('seapla'));&#xA;}&#xA;&#xA;if (!defined('ENV')) {&#xA;    switch (strtolower($_SERVER['DOCUMENT_ROOT'])) {&#xA;        case '/data/sites/web/'.PROJECTCODE.'/subsites/'.PROJECTCODE.'.live.be/public';&#xA;            define('ENV', 'live');&#xA;            break;&#xA;&#xA;        case '/data/sites/web/'.PROJECTCODE.'/subsites/'.PROJECTCODE.'.staging.be/public';&#xA;            define('ENV', 'staging');&#xA;            break;&#xA;&#xA;        default:&#xA;            define('ENV', 'local');&#xA;            break;&#xA;    }&#xA;}&#xA;&#xA;$settings = [&#xA;    'subscriptionPrice' =&amp;gt; 275,&#xA;    'subscriptionPeriod' =&amp;gt; 'P1Y',&#xA;    'invoicePrefix' =&amp;gt; 'ECF2017',&#xA;    'autoLoginAfterAccountActivation' =&amp;gt; true,&#xA;    'useEmailAsUsername' =&amp;gt; true,&#xA;    'setPasswordPath' =&amp;gt; '_members/_reset',&#xA;    'logoutPath'=&amp;gt; 'e-learning',&#xA;    'defaultCpLanguage' =&amp;gt; 'en_be',&#xA;    'defaultWeekStartDay' =&amp;gt; 1,&#xA;    'logoutPath' =&amp;gt; 'logout',&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'postCpLoginRedirect' =&amp;gt; 'entries',&#xA;    'addTrailingSlashesToUrls' =&amp;gt; false,&#xA;    'defaultSearchTermOptions' =&amp;gt; array(&#xA;        'subLeft' =&amp;gt; true,&#xA;        'subRight' =&amp;gt; true,&#xA;    ),&#xA;    'environmentVariables' =&amp;gt; [&#xA;        'basePath' =&amp;gt; getcwd(),&#xA;        'baseUrl' =&amp;gt; strtolower((isset($_SERVER['HTTPS']) &amp;amp;&amp;amp; $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']),&#xA;    ],&#xA;    'siteUrl' =&amp;gt; strtolower((isset($_SERVER['HTTPS']) &amp;amp;&amp;amp; $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']),&#xA;];&#xA;&#xA;switch (ENV) {&#xA;    case 'live':&#xA;        $settings['devMode'] = false;&#xA;        $settings['cache'] = true;&#xA;        break;&#xA;&#xA;    case 'staging':&#xA;        $settings['devMode'] = true;&#xA;        $settings['cache'] = false;&#xA;        break;&#xA;&#xA;    default:&#xA;        $settings['devMode'] = true;&#xA;        $settings['cache'] = false;&#xA;        break;&#xA;}&#xA;&#xA;return $settings;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5206" LastEditorUserId="5206" LastEditDate="2017-08-31T13:11:39.463" LastActivityDate="2017-09-04T08:02:31.903" Title="Activiation URL empty" Tags="&lt;users&gt;&lt;emails&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21757" PostTypeId="1" AcceptedAnswerId="21758" CreationDate="2017-08-29T15:00:54.130" Score="1" ViewCount="2123" Body="&lt;p&gt;I have a matrix field shaped as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MatrixField&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Block ( just 1 blocktype )&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Field1&lt;/li&gt;&#xA;&lt;li&gt;Field2&lt;/li&gt;&#xA;&lt;li&gt;Field3&lt;/li&gt;&#xA;&lt;li&gt;Field4&lt;/li&gt;&#xA;&lt;li&gt;FieldN&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to loop through all the fields inside a block, check if the field is set and other stuff. How can I do it?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-08-29T16:12:17.090" Title="Loop through fields of a matrix block" Tags="&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21758" PostTypeId="2" ParentId="21757" CreationDate="2017-08-29T16:12:17.090" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Check if the &lt;code&gt;matrixField&lt;/code&gt; is populated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if entry.matrixField|length %}{% endif %}&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are two options to pull out fields from a block type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option A:&lt;/strong&gt; use a for-loop pointed at your Matrix field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// If you want to output block of a certain type&#xA;{% if entry.matrixField|length %} &#xA;    {% for block in entry.matrixField.type('yourBlock') %}&#xA;        {{ block.field1 }}&#xA;        {{ block.field2 }}&#xA;        {{ block.fieldN }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;// OR multiple types&#xA;{% if entry.matrixField|length %} &#xA;    {% for block in entry.matrixField %}&#xA;        {% if block.type == &quot;yourBlock&quot; %}&#xA;            {{ block.field1 }}&#xA;            {{ block.field2 }}&#xA;            {{ block.fieldN }}&#xA;        {% elseif block.type == &quot;yourBlock1&quot; %}&#xA;            {{ block.field1 }}&#xA;            {{ block.field2 }}&#xA;            {{ block.fieldN }}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option B:&lt;/strong&gt; use simplified method of a for-loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.matrixField|length %} &#xA;    {% set yourBlock = entry.matrixField.type('yourBlock') %}&#xA;    {% for block in entry.matrixField %}&#xA;        {% switch block.type %}&#xA;            {% case &quot;yourBlock&quot; %}&#xA;                {{ block.field1 }}&#xA;                {{ block.field2 }}&#xA;                {{ block.fieldN }}&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also check Craft's documentation &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;noreferrer&quot;&gt;about Matrix Fields&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-08-29T16:12:17.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21760" PostTypeId="2" ParentId="21712" CreationDate="2017-08-29T17:25:54.937" Score="0" Body="&lt;p&gt;We ended up using this cli tool:&#xA;&lt;a href=&quot;https://github.com/rsanchez/craft-cli&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/rsanchez/craft-cli&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We still had to tweak the php memory limit in the php config: &lt;code&gt;memory_limit 2048M&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But eventually we managed to index 21.000+ images this way. &lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-08-29T17:25:54.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21761" PostTypeId="2" ParentId="21748" CreationDate="2017-08-29T17:38:38.947" Score="4" Body="&lt;p&gt;So in order to do this you have to reformat your code and your strategy a bit. You cant provide a Craft query as a link, all that does is grab an array from the database and it won't inherently print something out.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{% set usersByFirstName = craft.users.search('sortAS', '{{ firstName}}') %}&quot;&amp;gt;A-Z&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The best way to change the way your results are being sorted (if you want to do it via Twig and not something front-end like JS is to send the sort style through a query string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's assume you are returning a list of users and you want to sort them by first name alpha ascending:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.order('firstName asc').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to change the direction of the order create a link like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;url/user-list?sort=desc&quot;&amp;gt;Sort Z-A&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the page reloads a new query parameter is available to you &lt;code&gt;sort&lt;/code&gt;, you can get it with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sort = craft.request.getParam('sort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can use that variable to alter the way your original query works. Something like this... starting over from scratch:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('sort')|length &amp;gt; 0 %}&#xA;&#xA;    {% set sort = craft.request.getParam('sort') %}&#xA;&#xA; {% else %}&#xA;&#xA;    {% set sort = 'asc' %} {# default sort #}&#xA;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the Craft query, you could just user this instead of our original query above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set users = craft.users.order('firstName ' ~ sort).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when the page first loads you will get users sorted by &lt;code&gt;firstName asc&lt;/code&gt; and when you click the filter it will reload with &lt;code&gt;firstName desc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can apply this same query string method to all of the parameters. Getting variables like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sortBy = craft.request.getParam('sortBy') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;sortBy&lt;/code&gt; equals &lt;code&gt;firstName&lt;/code&gt; or &lt;code&gt;lastName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That query string would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;url/user-list?sort=desc&amp;amp;sortby=firstName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And so on.&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2017-08-29T17:38:38.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21762" PostTypeId="1" CreationDate="2017-08-30T06:22:01.790" Score="1" ViewCount="75" Body="&lt;p&gt;I was wondering if there's a way to change the position of elements in an entry type structure. I want to change the positions of the elements when a user logs in, so I'll write it in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="6720" LastEditDate="2017-08-30T07:56:28.320" LastActivityDate="2017-08-30T07:56:28.320" Title="Change position of entry types in a structure" Tags="&lt;plugin-development&gt;&lt;structure&gt;&lt;position&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21763" PostTypeId="2" ParentId="21762" CreationDate="2017-08-30T07:23:37.700" Score="2" Body="&lt;p&gt;This did the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft()-&amp;gt;sections-&amp;gt;reorderEntryTypes($entryTypeIds);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;$entryTypeIds&lt;/code&gt; is an array with all the id's in the correct order&lt;/p&gt;&#xA;" OwnerUserId="6720" LastActivityDate="2017-08-30T07:23:37.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21765" PostTypeId="2" ParentId="8314" CreationDate="2017-08-30T11:07:00.950" Score="1" Body="&lt;p&gt;For what it's worth, I had a completely different cause resulting in nearly-identical outcomes. For a site I had just started to get going, I found at one point that the Homepage entry simply would not load for editing. It showed up in the frontend with the default content, but the backend Edit Entry page utterly refused to load.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out that when testing Redactor configurations, I had &lt;code&gt;/* bulk-commented */&lt;/code&gt; out a section of the &lt;code&gt;.json&lt;/code&gt; code (in &lt;code&gt;/craft/config/redactor/[test config name].json&lt;/code&gt;), which was causing the problem. Inline comments (&lt;code&gt;// this is an inline comment&lt;/code&gt;) seemed to be acceptable in practice and wouldn't cause the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that technically the JSON spec &lt;a href=&quot;https://stackoverflow.com/questions/244777/can-comments-be-used-in-json&quot;&gt;apparently does not allow comments&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2017-08-30T11:07:00.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21766" PostTypeId="1" CreationDate="2017-08-30T12:33:48.607" Score="1" ViewCount="86" Body="&lt;p&gt;Just like the title states, the &lt;code&gt;slug&lt;/code&gt; variable is not available when a category's url are disabled:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;field-styles&quot; id=&quot;field-styles&quot; class=&quot;select&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Style&amp;lt;/option&amp;gt;&#xA;    {% for style in craft.categories.group('productStyles').order('title') %}&#xA;    &amp;lt;option value=&quot;{{ style.slug }}&quot;&amp;gt;{{ style.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The snippet of code above works when the URL's are enabled for this category group. When disabled, the input &lt;code&gt;value&lt;/code&gt; is blank.&lt;/p&gt;&#xA;" OwnerUserId="202" LastActivityDate="2017-08-30T13:08:13.480" Title="Category slug variable is not available when category url's are disabled" Tags="&lt;categories&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21767" PostTypeId="2" ParentId="21766" CreationDate="2017-08-30T12:55:53.470" Score="1" Body="&lt;p&gt;&lt;s&gt;That's by design, slugs are used for building the url to link to a specific element, in this case, a category.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; seems I was wrong on the above, see comment. Leaving the rest of the answer as using the ID offers a solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll have to use the id to refer to the category as value, like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;field-styles&quot; id=&quot;field-styles&quot; class=&quot;select&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;Style&amp;lt;/option&amp;gt;&#xA;    {% for style in craft.categories.group('productStyles').order('title') %}&#xA;    &amp;lt;option value=&quot;{{ style.id }}&quot;&amp;gt;{{ style.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-08-30T13:08:13.480" LastActivityDate="2017-08-30T13:08:13.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21768" PostTypeId="1" AcceptedAnswerId="21777" CreationDate="2017-08-30T14:30:03.047" Score="2" ViewCount="223" Body="&lt;p&gt;I am new to Craft and read a lot of arctilces and most of the docs. Most parts are quite easy. Now I plan how to organize all the different parts and pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a simple outline. Not every page, but to get the ieda.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home                            (Single)&#xA;- News                          (Section; structure: news)&#xA;  - Posts                       (news entry with category post?)&#xA;  - Press                       (news entry with category press?)&#xA;  - Media                       …&#xA;  - Events                      …&#xA;- About                         (Section; structure: pages)&#xA;  - About us                    (pages entry with defult entry type)&#xA;  - History                     (pages entry with defult entry type)&#xA;  - Team                        (pages entry with defult entry type)&#xA;- People                        &#xA;  - Locations                   (Section; channel: location)&#xA;  - Page-A, Page-B, etc…        (? other entry types)&#xA;- Members                       (Section; structure: pages)&#xA;  - Info                        (pages entry with defult entry type)&#xA;  - Jobs                        (?)&#xA;  - Listing                     (pages entry with defult entry type)&#xA;  - Register/Login              (?)&#xA;  - (PROTECTED MEMBERS AREA)    (?)&#xA;    - Auth-Group-I&#xA;      - Page A, Page B, …&#xA;    - Auth-Group-II&#xA;      - Page-A, Page-B, …&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First:&lt;/strong&gt;&#xA;There are 4 different &quot;sections&quot; (in terms of the content and audience). Would it be possible/a good idea to put alle those into one Craft section, titled pages?&#xA;And on those pages, where I need other content, like locations (store locator), I pull data from a dedicated section titled locations. Or on another I query the job listings.&#xA;That way I can group most pages, create the hierachy and spearate the content in logical groups/sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second:&lt;/strong&gt;&#xA;Otherwise, would it be better to give each website section its own Craft section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Third:&lt;/strong&gt;&#xA;What about those &quot;special pages&quot; like my register/login form, the job lsiting page, etc. Do they become a Single?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fourth:&lt;/strong&gt;&#xA;What is more appropriate for my different news pages: using categories or entry types?&lt;/p&gt;&#xA;" OwnerUserId="7183" LastActivityDate="2017-08-31T05:58:34.843" Title="First Craft website: how to organize different content" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21769" PostTypeId="1" AcceptedAnswerId="21771" CreationDate="2017-08-30T17:19:43.130" Score="2" ViewCount="72" Body="&lt;p&gt;I have &quot;locations&quot; section where each entry is a location, with a Smart Map field for the address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have another section &quot;pages&quot;, where I have a matrix field which contains an entry relationship field, where I can select entries (locations) from the first channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to output a map of all locations selected in my matrix field, but I'm getting an error:&#xA;Property &quot;Craft\SmartMap_AddressModel.title&quot; is not defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the code below to get the address fields from the individual entries, and put them into an array. I think maybe I'm not understanding what exactly needs to be in the locations array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = [] %}&#xA;&#xA;{#  loop though all relationship fields for this entry #}&#xA;{% for block in entry.pageBuilder.type('listingGroup') %}&#xA;&#xA;    {#  loop through related entries #}&#xA;    {% for member in block.listing %}&#xA;&#xA;        {# get individual entry address #}&#xA;        {% set address = member.address %}&#xA;&#xA;        {# add entry address to locations array #}&#xA;        {% set locations = locations|merge([address])%}&#xA;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="323" LastActivityDate="2021-01-01T06:53:51.163" Title="Smart Map - Output map locations from relationship file in a matrix" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21771" PostTypeId="2" ParentId="21769" CreationDate="2017-08-30T17:45:09.543" Score="2" Body="&lt;p&gt;At a glance, your code &lt;em&gt;looks&lt;/em&gt; perfect... but I think there's a subtle error. The &lt;code&gt;locations&lt;/code&gt; parameter can be an array of &lt;strong&gt;elements&lt;/strong&gt;, but you are building an array of &lt;strong&gt;Address fields&lt;/strong&gt; (which is not valid).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GFUYT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GFUYT.png&quot; alt=&quot;locations&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can simplify the middle part of your code to this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{# add entry to locations array #}&#xA;{% set locations = locations|merge([member]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That way, &lt;code&gt;locations&lt;/code&gt; will end up being &lt;strong&gt;an array of elements&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:53:51.163" LastActivityDate="2021-01-01T06:53:51.163" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="21772" PostTypeId="1" AcceptedAnswerId="21773" CreationDate="2017-08-30T20:20:18.510" Score="2" ViewCount="2380" Body="&lt;p&gt;I am having a problem getting image urls from Craft 3. I understand that there is a new syntax but I cannot find the syntax to use. The craft 2 version of what I am trying to accomplish is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set heroImage = entry.heroImage.first().url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I achieve this in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2018-11-02T18:41:26.557" Title="Craft 3 Template - Getting Image URLs" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21773" PostTypeId="2" ParentId="21772" CreationDate="2017-08-30T21:53:08.857" Score="4" Body="&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set heroImage = entry.heroImage.one().getUrl() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although this probably works as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set heroImage = entry.heroImage.one().url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, &lt;code&gt;.first()&lt;/code&gt; has been replaced with &lt;code&gt;.one()&lt;/code&gt;.  &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#query-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#query-methods&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2018-11-02T18:41:26.557" LastActivityDate="2018-11-02T18:41:26.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21774" PostTypeId="2" ParentId="17315" CreationDate="2017-08-31T04:20:20.390" Score="-2" Body="&lt;p&gt;In your case, i think you can use &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;element-api&lt;/a&gt;, this is a great plugin for extracting data through ajax.&lt;/p&gt;&#xA;" OwnerUserId="7192" LastActivityDate="2017-08-31T04:20:20.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21775" PostTypeId="1" AcceptedAnswerId="21776" CreationDate="2017-08-31T04:21:27.063" Score="2" ViewCount="67" Body="&lt;p&gt;I think I know the answer for this (multiple) but I just wanted to see how others are doing it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I have a single default &lt;code&gt;meta&lt;/code&gt; field type that I add to most of my sections. At this stage I've got the advanced 'Meta Details' turned off but we're starting to need to make per section tweaks and I'm looking at enabling this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given we want finite control (and better sectional specific fall backs if the meta information isn't supplied) I'm now realising that most people probably have a &lt;code&gt;meta&lt;/code&gt; field for each section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do migrate from a single to multiple (~30 sections atm) there's not a simple way to migrate the existing meta data is there? &lt;/p&gt;&#xA;" OwnerUserId="450" LastActivityDate="2017-08-31T05:12:45.240" Title="Sprout SEO best practice - single or multiple field types?" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21776" PostTypeId="2" ParentId="21775" CreationDate="2017-08-31T05:12:45.240" Score="3" Body="&lt;p&gt;&lt;em&gt;tldr; Use as many Element Metadata fields as you need unique mappings between your Elements and your metadata. You can replace an existing Element Metadata field with a new one without losing data, but it will depend on the field settings of the old and new field.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;A single Element Metadata field as a starting point&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A single Element Metadata field across all sections is a good place to start. It reduces project overhead for getting things setup and provides a starting point with more comprehensive metadata than most sites. I typically recommend creating two custom fields: &lt;code&gt;Summary&lt;/code&gt; and &lt;code&gt;Feature Image&lt;/code&gt; and then mapping the single Element Metadata field to those common fields: Title, Summary, and Feature Image across all sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you describe, in some cases you begin to need more specific metadata. This is a good signal for when to start considering multiple Element Metadata fields. Often, a section may have custom fields that are better suited for its metadata, and creating an Element Metadata field specific to that section will give you the flexibility to customize that sections metadata in a unique way.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Updating Element Metadata fields&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you're transitioning from an existing Element Metadata field to a new one, it's good to think about it like a migration and any SEO implications that may be affected if your metadata changes. Depending on how you set things up initially, and on what you are trying to achieve, there are a few considerations.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Dynamic Metadata&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The easiest way to manage metadata is to have it dynamically generated from other content fields already present in your element field layout. If you take this approach, admins are not manually entering any metadata and all metadata is being generated based on the pattern that you set it up with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you update the patterns of your dynamic metadata in the Element Metadata field or add a new Element Metadata field to a channel to replace an old one, you don't need to migrate any metadata because the new field will generate the metadata dynamically for you. When you change the settings in an Element Metadata field or resave a Field Layout, Sprout SEO triggers a ResaveElements task (just like Craft does when you change a URL Format in your Section settings) and resaves all Elements that are related to that field which also resaves all the metadata based on the pattern you have in the field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you don't have to take any action on your website, note that in this scenario, if you change the metadata pattern, you are potentially changing the metadata on all of your pages. Make sure the changes are what you want and test and monitor those changes accordingly for your needs.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Custom Metadata&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you've enabled admins to edit metadata directly via Editable Meta Fields or the Meta Details overrides, the data should persist if you change to a new Element Metadata field. Sprout SEO only supports one Element Metadata field per Field Layout. When you update a field layout and replace an old Element Metadata field with a new one, as far as your Element is concerned, the only thing that changed is the Element Metadata field settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, be sure to test any changes you make and confirm the data is still there. It is possible to change the settings in a way that would overwrite some metadata when elements are resaved. But, if you keep the same custom metadata Editable Fields or Meta Details fields enabled, the existing data should persist.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-08-31T05:12:45.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21777" PostTypeId="2" ParentId="21768" CreationDate="2017-08-31T05:58:34.843" Score="1" Body="&lt;p&gt;I'll try answer each question as best as I can... Feel free to ask for more information if you still have questions. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First:&lt;/strong&gt; For your use case, it might indeed by a good idea to put all actual pages in 1 structure, it allows you to better visualise the content structure. You can than pull in the required news, locations, jobs content with corresponding fields.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second:&lt;/strong&gt; It depends on how many pages you'll have, if you put it all in one big structure, and you have to many pages in there, you might loose the overview. From what you lined out, I'd put it in 1 structure, and you can still use different entry types if you need different content. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Third:&lt;/strong&gt; Singles are ment to be one-off pages, mostly with a specific design, but yes, pages for registering, logging in are excellent candidates for singles. Once you'll use the fields or design on it more often, you might be better off putting it as an extra type in a section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically for Jobs, if those are again their own set of entries (I'd put them in a channel) you can use &lt;code&gt;jobs/index.html&lt;/code&gt; as template for your overview page (assuming you specified &lt;code&gt;jobs/_entry&lt;/code&gt; as path when registering the section).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fourth:&lt;/strong&gt; It all depends on how much the content itself will vary between posts, press and media. IF you'll need a different set of fields, you'll be better off creating different entry types. If however they'll all follow the same set of fields, you can work with categories to differentiate between the different pages. &lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-08-31T05:58:34.843" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21779" PostTypeId="1" CreationDate="2017-08-31T09:37:25.783" Score="2" ViewCount="335" Body="&lt;p&gt;I've had the unfortunate task of importing thousands of entries in to Craft from Worpdress. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of the entries has a Rich Text field and within the first couple of paragraphs there is an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to use this image as the overview thumbnail on a listing page. How can I extract that image tag, or just the src attribute from it to get the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of the image tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img class=&quot;size-full wp-image-13325&quot; src=&quot;https://www.domain.com/news/wp-content/uploads/2015/12/image.jpg&quot; alt=&quot;etc&quot; width=&quot;620&quot; height=&quot;385&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried to use the &lt;code&gt;|split&lt;/code&gt; filter and some others with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help/direction&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-10-31T00:26:51.973" Title="Grab first &lt;img&gt; or &lt;img&gt; src from Rich Text field" Tags="&lt;templating&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21781" PostTypeId="1" CreationDate="2017-08-31T11:22:47.420" Score="1" ViewCount="29" Body="&lt;p&gt;Like the title tells you the headings, titles of the category groups, are not showing in the sidebar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RBNZP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RBNZP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a screenshot from the github page of the plugin.&#xA;The &quot;FOOD&quot; and &quot;DRINKS&quot; titles are not being displayed when I use the plugin. In the source I can see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;heading&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the plugin knows that there should be a heading but It does not fill the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="6720" LastEditorUserId="57" LastEditDate="2017-08-31T17:25:41.540" LastActivityDate="2017-11-29T18:53:37.443" Title="Category Sources plugin not showing headings" Tags="&lt;entries&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21784" PostTypeId="2" ParentId="16122" CreationDate="2017-08-31T14:09:53.867" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt; v2.5.0 adds improved support for permissions. These permissions can be set per user group and now include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Manage Forms&#xA;- View Form Entries&#xA;-- Edit Form Entries&#xA;- Edit Settings&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To allow a particular user group to create and edit forms, they will need the &lt;code&gt;Manage Forms&lt;/code&gt; permission.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-08-31T14:09:53.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21785" PostTypeId="2" ParentId="21779" CreationDate="2017-08-31T17:11:19.533" Score="0" Body="&lt;p&gt;Sounds like a job for &lt;a href=&quot;https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/&quot; rel=&quot;nofollow noreferrer&quot;&gt;regular expressions&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig has limited support for regex natively, but there is a handy Craft &lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; that adds &lt;a href=&quot;https://secure.php.net/manual/en/function.preg-match.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;preg_match&lt;/a&gt; support, which is what you'll need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-31T17:11:19.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21786" PostTypeId="2" ParentId="21781" CreationDate="2017-08-31T17:28:51.663" Score="1" Body="&lt;p&gt;I just tested this on the fresh install of the latest Craft &lt;a href=&quot;https://craftcms.com/changelog#2-6-2989&quot; rel=&quot;nofollow noreferrer&quot;&gt;2.6.2989&lt;/a&gt; and the latest &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources/archive/master.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Category Sources zip&lt;/a&gt; and it working as expected where &quot;Food&quot; and &quot;Drinks&quot; are the Category Group names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SzFwa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SzFwa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd double check you're running the latest of each.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-08-31T17:28:51.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21787" PostTypeId="2" ParentId="21332" CreationDate="2017-08-31T19:44:46.977" Score="2" Body="&lt;p&gt;Per Michael's suggestion above, with some help from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4414/search-contact-person-plugin-via-ajax&quot;&gt;this answer&lt;/a&gt;, I passed the results from the API call back to a craft template as query params, so it looked like this (simplified): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.isAjax %}&#xA;    {% set myReps = craft.request.getParam('personId') %}&#xA;    {% set myIds = myReps | split(',') %}&#xA;    {% for myId in myIds %}&#xA;        {% set person = craft.entries.section('representatives').repId(myId).first() %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then output my info from there.&lt;/p&gt;&#xA;" OwnerUserId="5026" LastActivityDate="2017-08-31T19:44:46.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21788" PostTypeId="2" ParentId="19747" CreationDate="2017-08-31T20:36:30.087" Score="4" Body="&lt;p&gt;For now (when the docs are not ready) you look into the craft source how things are saved for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/FieldsController.php#L250&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/controllers/FieldsController.php#L250&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the source code I've created the following migration file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/jeroenlammerts/de0471dc210749f4afe8d2e69bab46d8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/jeroenlammerts/de0471dc210749f4afe8d2e69bab46d8&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2017-08-31T20:36:30.087" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21790" PostTypeId="1" AcceptedAnswerId="21811" CreationDate="2017-08-31T20:57:08.227" Score="0" ViewCount="70" Body="&lt;p&gt;I've got two kinds of channel entries: &lt;code&gt;Bills&lt;/code&gt; and &lt;code&gt;Legislators&lt;/code&gt;. &lt;code&gt;Legislators&lt;/code&gt; have a SuperTable of votes. Each vote is related to one &lt;code&gt;Bill&lt;/code&gt;. I want to get all the votes associated with a particular &lt;code&gt;Bill&lt;/code&gt; and display them on that &lt;code&gt;Bill&lt;/code&gt;'s page, but I can't fetch more than 100 items. Here's my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reverseRelatedVotes = craft.supertable.getRelatedElements({&#xA;    relatedTo: {&#xA;        targetElement: entry,&#xA;        field: 'scorecardVotes.bill',&#xA;        },&#xA;    section: 'legislators'&#xA;}).limit(null).order('lastName ASC') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;limit(10)&lt;/code&gt; works as expected, but anything over the standard Craft limit of 100 returns 100. How can I get all the related votes for a given &lt;code&gt;Bill&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5026" LastActivityDate="2017-09-03T17:46:12.327" Title="Override SuperTable reverse related entries limit" Tags="&lt;templating&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21791" PostTypeId="2" ParentId="21743" CreationDate="2017-09-01T07:46:26.110" Score="2" Body="&lt;p&gt;After being in contact with the developer both issues are solved. If you have a similar issue use the latest codebase on the master branch (not the 2.0.7 as that version doesn't have the fixes yet) &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;for the first issue (date format problem) there is an additional functionality available that allows you to predefine what the layout is of the date field you're trying to import&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/unq1b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/unq1b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;second issue (the date offset problem) was a bug and has been fixed &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The most recent codebase can be found here: &lt;a href=&quot;https://github.com/engram-design/FeedMe/archive/master.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/engram-design/FeedMe/archive/master.zip&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A big thanks to &lt;a href=&quot;https://github.com/engram-design&quot; rel=&quot;nofollow noreferrer&quot;&gt;Josh Crawford&lt;/a&gt; for helping out that fast!&lt;/p&gt;&#xA;" OwnerUserId="397" LastActivityDate="2017-09-01T07:46:26.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21793" PostTypeId="1" CreationDate="2017-09-01T09:19:34.737" Score="1" ViewCount="208" Body="&lt;p&gt;We have a big problem with CraftCMS and Multilang.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We have the default language German (DE) in Craft.&lt;/li&gt;&#xA;&lt;li&gt;We have news entries with matrix fields&lt;/li&gt;&#xA;&lt;li&gt;We create a new language English (EN) as second language&lt;/li&gt;&#xA;&lt;li&gt;We activate this language (EN) in the News section&lt;/li&gt;&#xA;&lt;li&gt;We open an existing news entry and click on the second language (EN)&lt;/li&gt;&#xA;&lt;li&gt;The content of the matrix field does not exist&lt;/li&gt;&#xA;&lt;li&gt;We go WITHOUT saving back to the source language (DE) and save the post&lt;/li&gt;&#xA;&lt;li&gt;We switch back to the second language (EN) and now the Matrix Content is here&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For us it seems that the Autosave function, which is triggered when you add a new language to a section, does not process the matrix fields (Neo + SuperTable same problem) properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Problem is on all our client sites which use multilang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a Video&#xA;&lt;a href=&quot;https://www.dropbox.com/s/7jzg6ts3l90xze1/craftbug.mov?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/7jzg6ts3l90xze1/craftbug.mov?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3898" LastActivityDate="2018-07-29T00:00:29.343" Title="Multilang Bug with Matrix, Neo, SuperTable (with Video)" Tags="&lt;matrix&gt;&lt;localization&gt;&lt;plugin-supertable&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21794" PostTypeId="1" CreationDate="2017-09-01T15:22:51.517" Score="1" ViewCount="170" Body="&lt;p&gt;A customer of mine has printed references of the entry Ids of their product. Now they want to have a search form on their website where it's possible to search either by the name or by entry Ids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you search for an entry id and other fields at the same time in a search form?  &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2017-09-01T21:57:31.600" Title="Search for the entry Id with the search form" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21795" PostTypeId="2" ParentId="21793" CreationDate="2017-09-01T18:23:06.937" Score="1" Body="&lt;p&gt;You're essentially running into this bug: &lt;a href=&quot;https://github.com/craftcms/cms/issues/16&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/16&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been fixed for the upcoming Craft 3, but the fix was involved likely won't be backported to Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-01T18:23:06.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21796" PostTypeId="2" ParentId="21794" CreationDate="2017-09-01T18:36:15.257" Score="2" Body="&lt;p&gt;This currently isn't possible with Craft's native search solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Element IDs aren't indexed in the &lt;code&gt;craft_searchindex&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround you could maybe use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse&lt;/a&gt; plugin to copy the entry ID into a custom field called &quot;entryId&quot; so you could search via &lt;code&gt;entryId:####&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-09-01T21:57:31.600" LastActivityDate="2017-09-01T21:57:31.600" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21797" PostTypeId="1" AcceptedAnswerId="21800" CreationDate="2017-09-01T19:58:22.073" Score="3" ViewCount="121" Body="&lt;p&gt;I have two relationship fields. I am trying to query all entries where the first field is related to a particular element and the second field is related to nothing. Here is how I &lt;em&gt;thought&lt;/em&gt; it would work but it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;relatedTo = ['and',&#xA;[&#xA;    'targetElement' =&amp;gt; anElementId,&#xA;    'field'         =&amp;gt; 'relationshipOne'&#xA;],&#xA;[&#xA;    'targetElement' =&amp;gt; null, // also tried &quot;:empty:&quot;&#xA;    'field'         =&amp;gt; 'relationshipTwo'&#xA;]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4474" LastEditorUserId="4474" LastEditDate="2017-09-01T20:13:08.337" LastActivityDate="2017-09-01T20:33:19.477" Title="How do I query two relationship fields where one relationship MUST be empty?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21798" PostTypeId="1" CreationDate="2017-09-01T20:01:18.443" Score="0" ViewCount="46" Body="&lt;p&gt;I have built and deployed dozens of Craft sites, so I know how to remove 'index.php' from urls, but now I have a site that refuses to accept my most determined efforts to remove it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the situation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am using the Craft supplied .htaccess file with the same settings&#xA;as all of my other sites.&lt;/li&gt;&#xA;&lt;li&gt;Just to be thorough, I added 'omitScriptNameInUrls' =&gt; 'true', to the config file&lt;/li&gt;&#xA;&lt;li&gt;double checked all of the general settings in the CP and all is as it should be&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After trying a few things, I found that if I use {{ siteUrl }}&lt;em&gt;path&lt;/em&gt; I get a clean url, but if I use {{ url('path') }} it leaves that nasty index.php in the url. The same is true for {{ entry.url }}. One last bit of puzzlement - if I manually enter a full path, e.g. &lt;a href=&quot;http://sitename/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sitename/news&lt;/a&gt; it works fine  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect I am missing something obvious, but it is definitely driving me nuts!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-09-02T16:08:51.987" Title="Strange 'index.php' Issue" Tags="&lt;url&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21799" PostTypeId="2" ParentId="21798" CreationDate="2017-09-01T20:12:46.137" Score="1" Body="&lt;p&gt;Have you tried everything here? &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-01T20:12:46.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21800" PostTypeId="2" ParentId="21797" CreationDate="2017-09-01T20:33:19.477" Score="4" Body="&lt;p&gt;Splitting the criteria up like this works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;relatedTo = [&#xA;    'targetElement' =&amp;gt; anElementId,&#xA;    'field'         =&amp;gt; 'relationshipOne'&#xA;];&#xA;$criteria-&amp;gt;relationshipTwo = ':empty:';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to @carlcs in the Craft Slack channel.&lt;/p&gt;&#xA;" OwnerUserId="4474" LastActivityDate="2017-09-01T20:33:19.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21801" PostTypeId="1" AcceptedAnswerId="21802" CreationDate="2017-09-02T07:02:50.857" Score="2" ViewCount="414" Body="&lt;p&gt;I’m using a structure for creating new pages and navigation. In this structure there are multiple entry types where one is used for creating category pages. Here a user can add some content and select a category that will be used to load projects that are related to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template I'm using this code to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.projectCategory.first().slug %}&#xA;{% set params = {&#xA;        section: 'projects',&#xA;        relatedTo: category&#xA;} %}&#xA;{% set projectEntries = craft.entries(params) %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ category }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    &amp;lt;div&amp;gt;&#xA;{% for projectEntry in projectEntries %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ projectEntry.url }}&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;index-image&quot;&amp;gt;&#xA;                    {% set image = projectEntry.featuredImage.first() %}{% if image %}&amp;lt;img src=&quot;{{ image.getUrl('fullImage') }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;{% endif %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;index-title&quot;&amp;gt;&#xA;                    &amp;lt;h2&amp;gt;{{ projectEntry.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First I'm getting the category slug that was selected for this category page. After that I'm setting up my parameters for getting projects (this is another section) that are related to that category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before it worked perfectly fine when I had put in a &quot;static&quot; category (so not using the category variable) but when I tried to push the selected category the whole thing stopped working. Even going back to my original code that worked doesn't load any projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the &quot;relatedTo&quot; argument it loads all projects just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the slug is perfectly shown in the H1 tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7207" LastActivityDate="2017-09-02T07:52:55.643" Title="Why isn't relatedTo not working (anymore)?" Tags="&lt;categories&gt;&lt;relations&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21802" PostTypeId="2" ParentId="21801" CreationDate="2017-09-02T07:52:55.643" Score="3" Body="&lt;p&gt;You are so close! All you need to do is to remove the ’.slug’, because that is what the param is expecting.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-09-02T07:52:55.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21803" PostTypeId="1" CreationDate="2017-09-02T13:28:37.473" Score="1" ViewCount="36" Body="&lt;p&gt;Craft Commerce allows us to have one set of custom Order Fields associated with a checkout process. I have a situation where we are selling tickets to a yearly event and I need to ask two questions of each registrant that change from year to year. For this example, I'll present the following two questions, but it's possible that the number of questions and type of question changes from year to year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Year 1:&#xA;- Will you attend the opening reception on Friday?&#xA;- Will you attend the lunch reception on Saturday?&#xA;&#xA;Year 2:&#xA;- Will you attend the opening reception on Thursday?&#xA;- Will you attend the lunch reception on Friday?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems custom Order Fields will not easily solve this use case with an ideal workflow for the content admin for two reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The questions need to change from year to year, which would require a developer update the Order Fields layout&lt;/li&gt;&#xA;&lt;li&gt;Even if a developer did go in and change the questions to be the ones relevant to the year, they'd be breaking the data model of the previous year rendering past data inaccurate and useless (if someone wished to query it for whatever reason)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The ideal solution would allow an admin to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a product for a new year&lt;/li&gt;&#xA;&lt;li&gt;Customize the arbitrary questions they need to ask each user who checks out (The questions for the Order would ideally be associated with the Product Field Layout, not the Order Field Layout)&lt;/li&gt;&#xA;&lt;li&gt;Have the option to query accurate data (questions and responses) for all customers of a product for a specific year&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Before I go down the road of custom development, are there any supported or existing options that address the use case described above?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-09-03T13:33:04.113" LastActivityDate="2017-09-03T13:33:04.113" Title="Is it possible to ask a user arbitrary, changing questions at checkout with Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;user-interface&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21804" PostTypeId="1" CreationDate="2017-09-02T15:52:35.937" Score="1" ViewCount="28" Body="&lt;p&gt;I want to submit a XML sitemap to Google with frontend searches, in order to boost the SEO for a site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the approach I would take. But then, I might be very naive and there's other techniques for boosting the SEO with predefined searches?! &lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="367" LastEditDate="2017-09-03T15:06:11.847" LastActivityDate="2017-09-03T15:06:11.847" Title="Is it possible to list all searches with at least one result that were made on a site?" Tags="&lt;search&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21805" PostTypeId="2" ParentId="21798" CreationDate="2017-09-02T16:01:05.387" Score="4" Body="&lt;p&gt;This recently tripped me up. &lt;code&gt;'true'&lt;/code&gt; (with quotes) is not the same as &lt;code&gt;true&lt;/code&gt; (without the quotes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lose the quotes in the config file, clear Craft's caches, and it should stick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also make sure your &lt;code&gt;siteUrl&lt;/code&gt; is the same as what your web server is configured as. If you have a redirect in there, say &lt;code&gt;www.example.com&lt;/code&gt; goes to &lt;code&gt;example.com&lt;/code&gt;, and your &lt;code&gt;siteUrl&lt;/code&gt; is configured to use the former, that seems to trip up Craft's check too. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-09-02T16:08:51.987" LastActivityDate="2017-09-02T16:08:51.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21807" PostTypeId="2" ParentId="21241" CreationDate="2017-09-03T00:48:30.790" Score="1" Body="&lt;p&gt;Ahh this is a bit misleading because the docs don't really spell it out. &quot;formHandle&quot; according to the docs really feels like it might be the variable you set your form to, but it's literally the form handle you got when you titled your form in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if your form starts with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set apple = craft.amForms.getForm('fireTruck') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your error code needs to be this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if fireTruck is defined %}&#xA;    {{ errorList(fireTruck.getErrors('someField')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if apple is defined %}&#xA;    {{ errorList(apple.getErrors('someField')) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-03T00:48:30.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21808" PostTypeId="1" AcceptedAnswerId="21809" CreationDate="2017-09-03T04:14:50.310" Score="0" ViewCount="86" Body="&lt;p&gt;I've got a portfolio site I'm building, and on each project's page I'm wanting to show a list of people who worked that project. I created a channel section called &quot;work&quot; with an entry field type called &quot;team&quot;. I then created another channel called teamMembers with a plain-text field for their name, another plaintext field for a link to their website, an assets field for their profile picture, and a categories field which would indicate their role in the project. When I'm adding a project as an entry in &quot;work&quot; i have an entries field that allows me to select team members from the teamMembers channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the life of me I can't figure out how to display a list of team members (with each team member's name, link and photo) who worked on a project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my progress so far: &lt;a href=&quot;http://dziey3.com/work/polaris&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dziey3.com/work/polaris&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;team-members&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;Team&amp;lt;/h3&amp;gt;&#xA;&#xA;            {% set team = entry.team %}&#xA;            {% for asset in entry.teamMembersPhoto.find() %}&#xA;            &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;            {% endfor %}&#xA;            {% for field in team %}&#xA;            &amp;lt;p&amp;gt;{{ field.title }}&amp;lt;/p&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7212" LastActivityDate="2017-09-03T13:08:57.453" Title="How to display all fields for an entry within an entry field type?" Tags="&lt;entries&gt;&lt;assets&gt;&lt;fieldtypes&gt;&lt;entries-field&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21809" PostTypeId="2" ParentId="21808" CreationDate="2017-09-03T13:08:57.453" Score="1" Body="&lt;p&gt;It seems on your website that you get the team listed, but not the photos. I think the problem might be that you are accessing the &lt;code&gt;teamMembersPhoto&lt;/code&gt;of the &lt;code&gt;entry&lt;/code&gt;, not the &lt;code&gt;team&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try changing it to&#xA;&lt;code&gt;{% for asset in team.teamMembersPhoto.find() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-09-03T13:08:57.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21811" PostTypeId="2" ParentId="21790" CreationDate="2017-09-03T17:46:12.327" Score="0" Body="&lt;p&gt;Figured it out - I needed to remove the limit earlier in the process: adding 'limit' =&gt; null after line 72 of SuperTableVariable.php did the trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll submit a pull request to that effect as soon as I figure out how to do that. &lt;/p&gt;&#xA;" OwnerUserId="5026" LastActivityDate="2017-09-03T17:46:12.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21813" PostTypeId="1" AcceptedAnswerId="21815" CreationDate="2017-09-03T20:38:27.780" Score="1" ViewCount="144" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;amforms&lt;/a&gt; and would like to display all form errors at the top of my page, not just per field. I can't seem to find the answer in the docs. Is this option available?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-04T01:39:43.083" Title="Show all form errrors using amforms" Tags="&lt;validation&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21814" PostTypeId="2" ParentId="21440" CreationDate="2017-09-03T22:29:08.173" Score="1" Body="&lt;p&gt;Is this what you're after?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in block.tableHandle %}&#xA;&#xA;    {% for columnHandle, columnValue in row %}&#xA;        {# If not col1 #}&#xA;        {% if loop.index != 1 %}&#xA;            &amp;lt;p&amp;gt;Do whatever you want with: {{ columnValue }}&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2017-09-03T22:29:08.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21815" PostTypeId="2" ParentId="21813" CreationDate="2017-09-04T01:39:43.083" Score="1" Body="&lt;p&gt;I'm not sure if this is the intended way, but I rigged this up and so far it works well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set yankee = craft.amForms.getForm('hotel') %}&#xA;&#xA;{% macro foxtrot(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import foxtrot %}&#xA;&#xA;{# list of form errors #}&#xA;{% if hotel is defined %}&#xA;    &amp;lt;div class=&quot;error-class&quot;&amp;gt;&#xA;        {% set fields = yankee.getFields() %}&#xA;        &amp;lt;h4&amp;gt;Please correct the errors listed below before submitting the form.&amp;lt;/h4&amp;gt;&#xA;        &amp;lt;ol&amp;gt;&#xA;            {% for field in fields %}&#xA;                {{ foxtrot(hotel.getErrors(field.handle)) }}&#xA;            {% endfor %}&#xA;        &amp;lt;/ol&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-04T01:39:43.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21816" PostTypeId="2" ParentId="21755" CreationDate="2017-09-04T08:02:31.903" Score="1" Body="&lt;p&gt;Figured it out by debugging &lt;code&gt;getSiteUrl&lt;/code&gt; in &lt;code&gt;UrlHelper&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting siteUrl like &lt;code&gt;'siteUrl' =&amp;gt; strtolower((isset($_SERVER['HTTPS']) &amp;amp;&amp;amp; $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'])&lt;/code&gt; is fine for browser requests, but &lt;code&gt;$_SERVER['SERVER_NAME']&lt;/code&gt; isn't available when running a console command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scheme is set correctly and since we have &lt;code&gt;addTrailingSlashesToUrls&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt;, the result became &lt;code&gt;http:/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed for now by hard-coding siteUrl in our general.php for each environment.&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-09-04T08:02:31.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21817" PostTypeId="1" CreationDate="2017-09-04T08:48:01.727" Score="2" ViewCount="37" Body="&lt;p&gt;I have a list of dates which are grouped by year and date and also checks if there is a entry in that year:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSubmissions = craft.amForms.submissions(&#xA;  {&#xA;    formHandle: 'reservation',&#xA;    limit: null,&#xA;    order: 'datum asc',&#xA;  })&#xA;%} {# Gets all the entries #}&#xA;&#xA;{% set izgrad = now | date('Y-m-d') %} {# format now #}&#xA;{% set alteAnmeldung = allSubmissions.dateCreated | date('Y') %}&#xA;&#xA;{% for year, entriesInYear in allSubmissions | group(&quot;datum.year&quot;) %}&#xA;&#xA;  {% if year &amp;gt;= alteAnmeldung %} {# only show the current and future year #}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{ year }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for month, entriesInMonth in entriesInYear | group(&quot;datum|date('m')&quot;) %}&#xA;          {% for day, entriesInDay in entriesInMonth | group(&quot;datum|date('d')&quot;) %}&#xA;            {% for item in entriesInDay %}&#xA;              {% if loop.first %}&#xA;                {% if izgrad &amp;lt;= item.datum %}&#xA;                  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#{{ item.datum }}&quot;&amp;gt;{{ item.datum | date('d.m.Y') }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endif %}&#xA;              {% endif %}&#xA;            {% endfor %}&#xA;          {% endfor %}&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works and the list looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WH8sT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WH8sT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the code looks horribly inefficient. (this creates 74 db queries). I think there must be a better way to write this. Is it possible to group the fields with less steps for example?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-09-04T08:48:01.727" Title="Efficiently Group a date list" Tags="&lt;group&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21818" PostTypeId="1" AcceptedAnswerId="21819" CreationDate="2017-09-04T09:28:00.937" Score="1" ViewCount="685" Body="&lt;p&gt;I've a trigger on my frontend that requires an action. I've started from the businessLogic template but I'm getting a 404 and can't find why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionExampleAjax()&#xA;    {&#xA;      // Stuff&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How I call it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.post('/actions/businessLogic/actionExampleAjax', data, function(response, textStatus, jqXHR) {&#xA;    // Stuff&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The server response ( 404):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The system is unable to find the requested action &quot;actionExampleAjax&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The action trigger is set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'actionTrigger' =&amp;gt; 'actions'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same approach works fine with a form submission, but I don't want to use a form in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-09-04T10:57:43.860" Title="Ajax call to action 404" Tags="&lt;ajax&gt;&lt;controller&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21819" PostTypeId="2" ParentId="21818" CreationDate="2017-09-04T10:57:43.860" Score="2" Body="&lt;p&gt;The URL you call using Ajax shouldn't include the &lt;code&gt;action&lt;/code&gt; trigger, since Craft will add this to call the correct method in your controller when it interprets the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the example you gave, your Ajax URL should be: &lt;code&gt;/actions/businessLogic/exampleAjax&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details can be found in the &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Development docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you change the &lt;code&gt;actionTrigger&lt;/code&gt; in the &lt;code&gt;general.php&lt;/code&gt; config file, then you will need to change the first segment of the Ajax URL to match the new value for the &lt;code&gt;actionTrigger&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-09-04T10:57:43.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21820" PostTypeId="1" CreationDate="2017-09-04T11:20:49.573" Score="1" ViewCount="207" Body="&lt;p&gt;We require a way to remove old db files from the storage|backups folder and I was wondering if there is a way to do this automatically or if someone has written a plugin that does it via a cron job?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-09-04T22:00:07.077" Title="Is there a way to clear old database files from storage|backups folder automatically?" Tags="&lt;database&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21821" PostTypeId="2" ParentId="21744" CreationDate="2017-09-04T12:36:28.927" Score="1" Body="&lt;p&gt;So I'm going to add this as an answer just in case others find it a useful option to pursue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would create your fields; &lt;code&gt;voltage&lt;/code&gt;, &lt;code&gt;flow rate&lt;/code&gt;, etc. then I would create a Structure called &lt;code&gt;Products&lt;/code&gt; with different Entry Types corresponding to the various categories you are using to sort your products. Then you can add your fields to the appropriate Entry Types. Then when you go to add a new product, you'll have a dropdown where you can select what Entry Type this entry should be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's how I would setup your site structure if I were in your place &lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2017-09-04T12:36:28.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21822" PostTypeId="2" ParentId="21820" CreationDate="2017-09-04T13:51:21.167" Score="1" Body="&lt;p&gt;******* Updated based on khalwat's comment ************&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think Craft does that automatically. Not sure about 3rd party plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a custom controller function to run by Cron Job, and it's been working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does nothing but looping through the .sql files in the craft/storage/backups folder and delete the ones which are older than X days, based on the modified time of the file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDeleteOldBackups() {&#xA;    try {&#xA;        $dir = 'craft/storage/backups';&#xA;        $backupFiles = scandir($dir);&#xA;&#xA;        $x = craft()-&amp;gt;config-&amp;gt;get('xDaysToDeleteDbBackup') ?: 30; // Keep the backup files for 30 days by default. Change it to w/e you like.&#xA;&#xA;        // Craft uses Greenwitch time to name the backup files&#xA;        $xDaysAgo = strtotime('-' . $x . ' days', time());&#xA;        // depending on how you want to compare the dates, the following line can be ignored.&#xA;        $xDaysAgo = strtotime(date('y-m-d', $xDaysAgo));&#xA;&#xA;        // loop through files, find the file's last modified time and compare with $xDaysAgo&#xA;        if(!empty($backupFiles)) {&#xA;            foreach ($backupFiles as $fileName) {&#xA;                if(strpos($fileName, '.sql') !== false) {&#xA;                    $filepath = $dir . '/' . $fileName;&#xA;                    if(file_exists($filepath)) {&#xA;                        $created = filemtime($filepath);&#xA;                        if($created &amp;amp;&amp;amp; $created &amp;lt; $xDaysAgo) {&#xA;                            // print_r($filepath . ' '); // for testing&#xA;                            unlink($filepath); //delete the file&#xA;                        }&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        \Yii::app()-&amp;gt;end(); // no render&#xA;    } catch (\Exception $e) {&#xA;        die('Failed to delete dated backup files.');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Put the function in one of the controller of your custom plugin, kindly reminder to allow anonymous access for this function. The URL for the Cron Job will be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;[host]/actions/pluginhandle/deleteOldBackups&lt;/pre&gt;&#xA;" OwnerUserId="7136" LastEditorUserId="7136" LastEditDate="2017-09-04T22:00:07.077" LastActivityDate="2017-09-04T22:00:07.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21823" PostTypeId="1" AcceptedAnswerId="21824" CreationDate="2017-09-04T14:29:06.007" Score="3" ViewCount="1751" Body="&lt;p&gt;I'm using Craft 3 and I have 2 Sites setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;config/general.php&lt;/code&gt; file I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    '*' =&amp;gt; [&#xA;        'environmentVariables' =&amp;gt; [&#xA;            'baseAssetsUrl' =&amp;gt; '//'.strtolower($_SERVER['SERVER_NAME']).'/assets/',&#xA;            'baseAssetsPath' =&amp;gt; realpath(dirname(__FILE__)).'/../web/assets',&#xA;        ],&#xA;    ],&#xA;&#xA;    'craft3uk.dev' =&amp;gt; [&#xA;        'timezone' =&amp;gt; 'Europe/London',&#xA;        'siteUrl' =&amp;gt; 'http://www.craft3uk.dev/',&#xA;    ],&#xA;&#xA;    'craft3me.dev' =&amp;gt; [&#xA;        'timezone' =&amp;gt; 'Asia/Dubai',&#xA;        'siteUrl' =&amp;gt; 'http://www.craft3me.dev/',&#xA;    ],&#xA;&#xA;    'dev' =&amp;gt; [&#xA;        'devMode' =&amp;gt; true,&#xA;    ],&#xA;&#xA;    'staging' =&amp;gt; [&#xA;    ],&#xA;&#xA;    'production' =&amp;gt; [&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can access the variables fine in a template like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set baseAssetsUrl = craft.app.config.general.environmentVariables.baseAssetsUrl %}&#xA;{% set baseUploadsUrl = craft.app.config.general.environmentVariables.baseUploadsUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I try using &lt;code&gt;{baseAssetsPath}&lt;/code&gt; like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pyFkX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pyFkX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vG78I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vG78I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit confused as I have a Craft 2 site setup the exact same way and this works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot see anything in the Craft 3 docs regarding this either?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me out please?&lt;/p&gt;&#xA;" OwnerUserId="170" LastEditorUserId="45" LastEditDate="2017-09-08T15:35:23.877" LastActivityDate="2017-09-08T15:35:23.877" Title="Craft 3: Environment variables are not parsed when used in Assets source field" Tags="&lt;assets&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21824" PostTypeId="2" ParentId="21823" CreationDate="2017-09-04T14:50:30.717" Score="3" Body="&lt;p&gt;Environmental variables as such don't exist &quot;as a thing&quot; in Craft 3. Instead, you'd define your Volumes in the AdminCP and override anything you need in &lt;code&gt;craft/config/volumes.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of how to do it here: &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 Multi-Environment&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-04T14:50:30.717" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21827" PostTypeId="1" AcceptedAnswerId="21848" CreationDate="2017-09-05T04:09:52.683" Score="1" ViewCount="198" Body="&lt;p&gt;I just had a fresh install of Charge 2 and my Craft version is Craft CMS 2.6.2989. However as long as I have &lt;code&gt;{{craft.charge.setPaymentOptions()}}&lt;/code&gt; in my template, all my form fields disappear and show up again after I remove this line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Bookings&quot; | t %}&#xA;&#xA;{% set entry = craft.entries.section('bookings').first %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;div class=&quot;[ grid ] island&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;[ grid__item desk-seven-twelfths ]&quot;&amp;gt;&#xA;            {% if entry.heading | length %}&#xA;                &amp;lt;h1 class=&quot;brand-color&quot;&amp;gt;{{ entry.heading }}&amp;lt;/h1&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% if entry.featureImage | length %}&#xA;                &amp;lt;img src=&quot;{{ entry.featureImage.first.url('halfWidth') }}&quot; alt=&quot;{{ entry.Title }}&quot; class=&quot;push--bottom&quot;&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% if entry.introText | length %}&#xA;                &amp;lt;div class=&quot;lede&quot;&amp;gt;{{ entry.introText }}&amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% if entry.body | length %}&#xA;                {% include '_partials/_body' %}&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;[ grid__item desk-one-third push--desk-one-twelfth ]&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;island ui-background--light&quot;&amp;gt;&#xA;                &amp;lt;h3 class=&quot;push-half--bottom text--center ui-color--dark&quot;&amp;gt;{{ &quot;Make a Payment&quot; | t }}&amp;lt;/h3&amp;gt;&#xA;&#xA;                &amp;lt;hr class=&quot;rule rule--double&quot;&amp;gt;&#xA;&#xA;                &amp;lt;form id=&quot;charge-form&quot; method=&quot;post&quot; data-publicKey=&quot;{{ craft.charge.publicKey }}&quot;&amp;gt;&#xA;                    {% set chargeOptions = {'planAmount' : 99} %}&#xA;                    {{craft.charge.setPaymentOptions(chargeOptions)}}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;charge/charge&quot;/&amp;gt;&#xA;&#xA;                    &amp;lt;label for=&quot;customerEmail&quot;&amp;gt;Receipt Email&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; name=&quot;customerEmail&quot; value=&quot;{{ currentUser ? currentUser.email }}&quot; id=&quot;customerEmail&quot;/&amp;gt;&#xA;&#xA;                    &amp;lt;label for=&quot;cardNumber&quot;&amp;gt;Card Number&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; data-stripe=&quot;number&quot; placeholder=&quot;•••• •••• •••• ••••&quot; id=&quot;cardNumber&quot;/&amp;gt;&#xA;&#xA;                    &amp;lt;label for=&quot;cardExpiry&quot;&amp;gt;Card Expiry&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; data-stripe=&quot;exp&quot; placeholder=&quot;mm / yy&quot; id=&quot;cardExpiry&quot;/&amp;gt;&#xA;&#xA;                    &amp;lt;label for=&quot;cardCvc&quot;&amp;gt;Card CVC&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;text&quot; data-stripe=&quot;cvc&quot; placeholder=&quot;123&quot; id=&quot;cardCvc&quot;/&amp;gt;&#xA;                &amp;lt;/form&amp;gt; &#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    {% includeJsResource('charge/js/jquery.charge.js') %}&#xA;    {% includeJsResource('charge/js/stripe_v2.min.js') %}&#xA;    {% includejs %}&#xA;        $(this).charge();&#xA;    {% endincludejs %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6AoyC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6AoyC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see what's wrong with my setup...&lt;/p&gt;&#xA;" OwnerUserId="7216" LastEditorUserId="45" LastEditDate="2017-09-08T15:34:42.713" LastActivityDate="2017-09-08T15:34:42.713" Title="Charge 2 - Stripe form fields not showing" Tags="&lt;templating&gt;&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21828" PostTypeId="1" CreationDate="2017-09-05T13:06:38.393" Score="1" ViewCount="317" Body="&lt;p&gt;It seems that after x amount of time (somewhere between 30-60 mins?) of inactivity on a page the session is being destroyed/cleared/etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will sit on a page with an active session for an hour and make 0 calls to the PHP. The next time I make a call to my PHP the session is completely gone. I have 0 variables in my session. I'm logging in the beforeAction and the session is just an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought it was my custom code that was clearing the session accidentally but before my code even executes the session is gone which leads me to believe it has something to do with Craft bootstrapping up to receive the PHP request.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2017-11-05T16:51:52.237" Title="Session destroy due to inactivity?" Tags="&lt;craft-features&gt;&lt;session&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21829" PostTypeId="1" CreationDate="2017-09-05T14:07:15.187" Score="2" ViewCount="762" Body="&lt;p&gt;I'm trying to use the Element Criteria Model to retrieve all entries where value &lt;code&gt;X&lt;/code&gt; or value &lt;code&gt;Y&lt;/code&gt; is not null?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get all entries where values and X &lt;em&gt;and&lt;/em&gt; Y are not empty but not sure how to achieve this with either X &lt;em&gt;or&lt;/em&gt; Y being not empty. any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;limit = NULL;&#xA;&#xA;foreach ($fields AS $field) {&#xA;    $criteria-&amp;gt;$field = ':notempty:';&#xA;}&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I have for &lt;em&gt;AND&lt;/em&gt; but not sure how best to go about achieving the same query for &lt;em&gt;OR&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An equivalent SQL query would be something along lines of &lt;code&gt;WHERE (X IS NOT NULL &amp;amp;&amp;amp; X &amp;lt;&amp;gt; '') OR (Y IS NOT NULL &amp;amp;&amp;amp; Y &amp;lt;&amp;gt; '')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2017-09-05T18:19:02.950" LastActivityDate="2017-09-05T18:19:23.477" Title="Element Criteria Model: filtering by empty values" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21830" PostTypeId="2" ParentId="21829" CreationDate="2017-09-05T14:30:09.067" Score="2" Body="&lt;p&gt;Okay, doesn't seem to be the most elegant but the only way I could achieve this was by carrying out the entries criteria query within my &lt;code&gt;$fields&lt;/code&gt; loop. So, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = [];&#xA;&#xA;foreach ($fields AS $field) {&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;limit = NULL;&#xA;    $criteria-&amp;gt;$field = ':notempty:';&#xA;    $tmpEntries = $criteria-&amp;gt;find();&#xA;&#xA;    $entries = array_merge($entries,$tmpEntries);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2017-09-05T18:19:23.477" LastActivityDate="2017-09-05T18:19:23.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21831" PostTypeId="1" AcceptedAnswerId="21836" CreationDate="2017-09-05T15:44:15.307" Score="1" ViewCount="190" Body="&lt;p&gt;I am trying to setup Craft to use a memcached (yes it is memcached, not memcache) cluster in AWS ElastiCache to handle sessions. I originally went the route of updating my php.ini file in Apache2 to override the PHP session save handler and session save path. That worked at first, but I found that sometimes memcached would seem to return null if a session object was being accessed around the same time. After running into that error a bunch and not being able to resolve it, I decided to try setting up memcached through Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is does Craft default to local file storage if it can't connect to my memcached cluster?&lt;/strong&gt; The reason I think this is happening is because if I use the overridePhpSessionLocation, I can tell that it isn't working because I am getting timed out on my site since we store the timeout in the session. However, when I set overridePhpSessionLocation to 'auto', and then put all the proper information in my memcache.php file, the site seems to work. But if I screw up the hostname in the memcache.php file, the site still works. So what is going on? Is Craft defaulting to local file storage when there is a connection issue or is there something else happening?&lt;/p&gt;&#xA;" OwnerUserId="7219" LastActivityDate="2017-09-05T18:34:52.003" Title="Craft cacheMethod setting is being overridden" Tags="&lt;php&gt;&lt;session&gt;&lt;apache&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21832" PostTypeId="2" ParentId="14847" CreationDate="2017-09-05T17:20:08.743" Score="1" Body="&lt;p&gt;you have to call&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block-&amp;gt;text-&amp;gt;getParsedContent()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or another method of &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/RichTextData&quot; rel=&quot;nofollow noreferrer&quot;&gt;RichTextData&lt;/a&gt; Model&lt;/p&gt;&#xA;" OwnerUserId="7097" LastActivityDate="2017-09-05T17:20:08.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21833" PostTypeId="1" AcceptedAnswerId="21837" CreationDate="2017-09-05T17:27:52.173" Score="1" ViewCount="55" Body="&lt;p&gt;I updated Sprout SEO on our development site, but get the following error when trying to view the site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft\TemplatesService and its behaviors do not have a method or closure named &quot;setTemplatesPath&quot;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the Control Panel, but navigating within the Sprout SEO tab gets me the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Unexpected token &quot;punctuation&quot; of value &quot;?&quot;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are not on the latest version of Craft (Pro 2.5.2754) for a few reasons - not ideal, I know. Can anyone let me know where I should look to resolve this, or if it's a compatibility issue?&lt;/p&gt;&#xA;" OwnerUserId="7220" LastActivityDate="2017-09-05T18:47:53.743" Title="Problem updating to latest version of Sprout SEO" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21834" PostTypeId="1" AcceptedAnswerId="21839" CreationDate="2017-09-05T17:48:56.763" Score="2" ViewCount="2598" Body="&lt;p&gt;I have an {% include%} which displays entries from a structure. This {% include%} is displayed on the homepage and other entries throughout the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the homepage, I'd like the include to show a specific title. On the other entries, I'd like it to show a different title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getUrl() == &quot;/&quot; %}&#xA;    &amp;lt;h2&amp;gt;Homepage Title&amp;lt;/h2&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h2&amp;gt;Other Title&amp;lt;/h2&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both titles appear on the homepage, but the &lt;code&gt;{% else %}&lt;/code&gt; title appears correctly on the other entries. What am I doing wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code from the include file: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid specialties&quot;&amp;gt;&#xA;&#xA;    {% if craft.request.getUrl() == siteUrl %}&#xA;        &amp;lt;h2&amp;gt;Homepage Title&amp;lt;/h2&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h2&amp;gt;Other Title&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% for entry in craft.entries.section('feed').find() %}&#xA;        &amp;lt;article class=&quot;fifth&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                {% set image = entry.icon.first() %}&#xA;                    &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;                {% endif %}&#xA;                &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the homepage code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;    {% include &quot;_includes/layout_builder&quot; %}&#xA;    {% include &quot;_includes/specialties&quot; %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="7160" LastEditDate="2017-09-07T16:44:32.963" LastActivityDate="2020-05-16T17:35:55.080" Title="If page conditions" Tags="&lt;url&gt;&lt;conditional&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21835" PostTypeId="2" ParentId="21828" CreationDate="2017-09-05T18:17:57.257" Score="1" Body="&lt;p&gt;You're likely running into Craft's &lt;a href=&quot;https://craftcms.com/docs/config-settings#userSessionDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;userSessionDuration&lt;/a&gt; config setting.  It defaults to one hour and will automatically log you out (thereby destroying your session) after reaching that period of inactivity.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-05T18:17:57.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21836" PostTypeId="2" ParentId="21831" CreationDate="2017-09-05T18:34:52.003" Score="1" Body="&lt;p&gt;The &lt;code&gt;craft/config/memcache.php&lt;/code&gt; file has nothing to do with where PHP sessions are stored.  It is for Craft's &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13382/what-are-the-cache-options-available-to-a-craft-installation/13383#13383&quot;&gt;general purpose data caching&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to save PHP session in memcache, you'll need to set the php.ini save_handler and save_path similar to: &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-store-php-sessions-in-memcached-on-a-centos-vps&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.digitalocean.com/community/tutorials/how-to-store-php-sessions-in-memcached-on-a-centos-vps&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I'd suggest not using the &lt;code&gt;overridePhpSessionLocation&lt;/code&gt; config setting.  Everything it does can be done through php.ini and it's been removed from the upcoming Craft 3 release anyway.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-05T18:34:52.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21837" PostTypeId="2" ParentId="21833" CreationDate="2017-09-05T18:47:53.743" Score="1" Body="&lt;p&gt;We were able to recreate your issue. The error caused by an older version of Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error should be fixed by upgrading to &lt;a href=&quot;https://craftcms.com/changelog#2-6-2771&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.2771&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-05T18:47:53.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21839" PostTypeId="2" ParentId="21834" CreationDate="2017-09-05T19:25:23.477" Score="6" Body="&lt;p&gt;Both titles can not appear in your condition(on the homepage). Always only one &lt;code&gt;true&lt;/code&gt; statement is executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your problem: there is one &lt;a href=&quot;https://craftcms.com/docs/templating/global-variables#siteUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;global variable&lt;/a&gt; that solves your problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getUrl() == siteUrl %}&#xA;    &amp;lt;h2&amp;gt;Homepage Title&amp;lt;/h2&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;h2&amp;gt;Other Title&amp;lt;/h2&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is also the link &lt;a href=&quot;https://craftcms.com/support/site-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Craft Determines the Site URL&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-12-12T08:23:30.270" LastActivityDate="2018-12-12T08:23:30.270" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="21840" PostTypeId="1" CreationDate="2017-09-05T22:23:32.483" Score="1" ViewCount="123" Body="&lt;p&gt;Running into an issue whereby front end asset uploads are not the correct orientation. I've spotted this mostly with user profile pics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to start debugging this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My server has ImageMagick extension installed. I believe it's happening when a photo is being directly uploaded from a phone/mobile device. (The one time I managed to recreate it was a direct upload of an untouched photo from my iPhone.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2017-09-05T22:23:32.483" Title="Front end asset uploads not correctly rotated" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="21841" PostTypeId="1" CreationDate="2017-09-06T08:59:01.990" Score="1" ViewCount="154" Body="&lt;p&gt;I'm on 2.6.2988, I have a text-block in my entry with standard Redactor settings enabled showing the source-button in the menu.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same entry I have a Matrix field with text-block with standard Redactor settings but the source-button is not showing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is Matrix using a different config?&lt;/p&gt;&#xA;" OwnerUserId="7097" LastEditorUserId="57" LastEditDate="2017-09-06T17:48:57.613" LastActivityDate="2017-09-12T11:34:33.183" Title="Redactor source plugin working on Text field but not on a Text field in Matrix" Tags="&lt;plugins&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21842" PostTypeId="1" AcceptedAnswerId="21844" CreationDate="2017-09-06T14:56:05.310" Score="1" ViewCount="47" Body="&lt;p&gt;So I'm getting to a point where I have a lot of services in a particular plugin, and I would like to organize my plugin services into sub-folders. I've tried a couple ways but the controllers don't seem to be able to find the appropriate services unless they are in the main services directory. I know I can put controller files in sub-folders of the controllers folder, so I thought the same would be true for services. Does Craft support what I'm trying to do?&lt;/p&gt;&#xA;" OwnerUserId="7219" LastActivityDate="2017-09-06T17:54:53.607" Title="Craft plugin services in subfolders" Tags="&lt;php&gt;&lt;craft-features&gt;&lt;controller&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21843" PostTypeId="1" CreationDate="2017-09-06T17:20:59.883" Score="1" ViewCount="685" Body="&lt;p&gt;Each of my entries has multiple categories (e.g. series, disciplines, and stages). I can get a list of elements related to a single category but I'd also like to get the category information as well (title, summary etc). Ideally, I'd like to pass the &lt;code&gt;$slug&lt;/code&gt; to the transformer so I can grab the category from there, is that possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current code for an endpoint from elementapi.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/series/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;  // get category by slug&#xA;  $series = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;  $series-&amp;gt;group = 'series';&#xA;  $series-&amp;gt;slug = $slug;&#xA;  $series-&amp;gt;first();&#xA;&#xA;  return [&#xA;    'elementType' =&amp;gt; ElementType::Entry,&#xA;    'criteria' =&amp;gt; [&#xA;      'section' =&amp;gt; ['lessons'],&#xA;      'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $series]&#xA;    ],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;      return structureEntry($entry);&#xA;    }&#xA;  ];&#xA;},&#xA;&#xA;/*-------------------------------------------*/&#xA;&#xA;function structureEntry($entry) {&#xA;  return [&#xA;    'id' =&amp;gt; (int)$entry-&amp;gt;id,&#xA;    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;    'slug' =&amp;gt; $entry-&amp;gt;slug,&#xA;    'summary' =&amp;gt; $entry-&amp;gt;summary ? $entry-&amp;gt;summary : null,&#xA;    'featuredImage' =&amp;gt; $entry-&amp;gt;featuredImage-&amp;gt;first() ? getImageSizes($entry-&amp;gt;featuredImage-&amp;gt;first()) : null,&#xA;    'body' =&amp;gt; $entry-&amp;gt;body ? (string)$entry-&amp;gt;body : null,&#xA;    'series' =&amp;gt; $entry-&amp;gt;series ? getCategoryData($entry-&amp;gt;series) : null,&#xA;    'stage' =&amp;gt; $entry-&amp;gt;stage ? getCategoryData($entry-&amp;gt;stage) : null,&#xA;    'disciplines' =&amp;gt; $entry-&amp;gt;discipline ? getCategoryData($entry-&amp;gt;discipline) : null&#xA;  ];&#xA;}&#xA;&#xA;function getCategoryData($categories) {&#xA;  $cats = array();&#xA;&#xA;  for($i = 0; $i &amp;lt; count($categories); $i++) {&#xA;    $cats[$i] = [&#xA;      'id' =&amp;gt; (int)$categories[$i]-&amp;gt;id,&#xA;      'title' =&amp;gt; $categories[$i]-&amp;gt;title,&#xA;      'slug' =&amp;gt; $categories[$i]-&amp;gt;slug,&#xA;      'summary' =&amp;gt; $categories[$i]-&amp;gt;summary&#xA;    ];&#xA;  }&#xA;&#xA;  return $cats;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'd like to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/series/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;  // get category by slug&#xA;  $series = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;  $series-&amp;gt;group = 'series';&#xA;  $series-&amp;gt;slug = $slug;&#xA;  $series-&amp;gt;first();&#xA;&#xA;  return [&#xA;    'elementType' =&amp;gt; ElementType::Entry,&#xA;    'criteria' =&amp;gt; [&#xA;      'section' =&amp;gt; ['lessons'],&#xA;      'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $series]&#xA;    ],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;      $category = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;      $category-&amp;gt;group = 'series';&#xA;      $category-&amp;gt;slug = $slug;&#xA;      $category-&amp;gt;first();&#xA;&#xA;      return array_merge(structureEntry($entry), structureCategory($category));&#xA;    }&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="6750" LastEditorUserId="57" LastEditDate="2017-09-06T17:56:57.533" LastActivityDate="2017-09-07T16:41:03.797" Title="Element API access param in transformer" Tags="&lt;plugin-elementapi&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21844" PostTypeId="2" ParentId="21842" CreationDate="2017-09-06T17:54:53.607" Score="2" Body="&lt;p&gt;Craft will only look in the immediate &lt;code&gt;pluginHandle/services&lt;/code&gt; folder when auto-loading and registering a plugin's service files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to support services in subfolders (i.e. &lt;code&gt;pluginhandle/services/subfolder1&lt;/code&gt;, etc.), you'd have to manually autoload and register those classes yourself from your plugin's &lt;code&gt;init()&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-06T17:54:53.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21847" PostTypeId="1" AcceptedAnswerId="21849" CreationDate="2017-09-07T00:17:14.713" Score="1" ViewCount="151" Body="&lt;p&gt;My main config is Apache/Centos 7/WHM/Redis/OPCache/PHP7.1/MariaDb/PHP-fpm/Http2 and have optimized my server to a great degree.  It's a 32GB dedicated HexaCore.  I have worked really diligent to get the server optimized over the last few weeks and the state it currently is in, it's pretty dang fast.  Now so you know I am not tooting my own horn, I will preface by saying this, I am the furthest away from a server admin as anyone can be, but I get by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; When serving up an local asset like CSS (/style.css) over HTTPS it takes about 2 seconds longer to load. A big part is the time of 800+ms for the style.css to load over https, ugh. So I am asking how can I use http2 to my advantage with Craft? I want to run in HTTPS all the time but not with the handshaking lag. Any suggestions or examples would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you are tempted to say go Nginx, I would love too but unless you are volunteering, at this time I cannot put myself through an Nginx install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-09-07T03:24:51.403" Title="Optimizing With Http2 In Mind" Tags="&lt;server&gt;&lt;apache&gt;&lt;ssl&gt;&lt;speed&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21848" PostTypeId="2" ParentId="21827" CreationDate="2017-09-07T03:09:38.327" Score="1" Body="&lt;p&gt;After looking into the source code of the encrypt function, the &lt;code&gt;craft.charge.setPaymentOptions()&lt;/code&gt; function calls &lt;code&gt;mcrypt_module_get_algo_key_size&lt;/code&gt; and because my vagrant box (ubuntu 14.04) didn't have &lt;code&gt;php5-mcrypt&lt;/code&gt; installed, it failed there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix it: run &lt;code&gt;apt-get install php5-mcrypt &amp;amp;&amp;amp; sudo php5enmod mcrypt&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7216" LastActivityDate="2017-09-07T03:09:38.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21849" PostTypeId="2" ParentId="21847" CreationDate="2017-09-07T03:24:51.403" Score="2" Body="&lt;p&gt;So... just to be clear. This &lt;code&gt;/style.css&lt;/code&gt; is a static asset, it's not sitting in the &lt;code&gt;craft/templates&lt;/code&gt; folder, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that's the case, something is definitely wrong if &lt;code&gt;https&lt;/code&gt; is taking 2 seconds to load it. Sounds like something with your server is misconfigured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are you measuring this, exactly?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-07T03:24:51.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21850" PostTypeId="2" ParentId="9880" CreationDate="2017-09-07T07:03:34.760" Score="1" Body="&lt;p&gt;About 1: Multi-site functionality is coming in Craft 3 (in public beta now), see &lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2017-09-07T07:03:34.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21852" PostTypeId="1" AcceptedAnswerId="21858" CreationDate="2017-09-07T08:57:44.993" Score="1" ViewCount="2040" Body="&lt;p&gt;I want to get the lates &lt;code&gt;postDate&lt;/code&gt; of a List and format it for the &lt;code&gt;cache&lt;/code&gt; tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestSubmission = craft.amForms.submissions(&#xA;    { formHandle: 'reservation', order: 'dateCreated desc' }).datum('&amp;gt;= '~now).dateCreated().first()&#xA;%}&#xA;&#xA;{{ latestSubmission }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This Returns: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do., 07 Sep. 2017 10:32:05&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I want to pass it into the Cache Tag so I want to format it and write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ latestSubmission | date('c') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This returns the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DateTime::__construct(): Failed to parse time string (Do., 07 Sep. 2017 10:32:05) at position 0 (D): The timezone could not be found in the database&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why? Why can’t I reformat it when it is already returning a date?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2017-09-07T14:11:47.297" LastActivityDate="2017-12-07T04:24:34.087" Title="DateTime::__construct(): Failed to parse time string" Tags="&lt;datetime&gt;&lt;postdate&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21853" PostTypeId="1" CreationDate="2017-09-07T10:56:29.233" Score="1" ViewCount="82" Body="&lt;p&gt;Hi I've been managing my clients Wordpress site for over 7 years now and redesigned it a few times. Recently, I convinced my client to move over to Craft CMS and 4 months ago we went live with a new design. This was my first build in Craft, the development went well having studied some good tutorials. Since then, in the 4 months that the site has been live the visitor sessions in Google Analytics have halved and have stayed at half continuously. They pretty much halved around the day or the week the site went live. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bounce rate has increased by 10% and the average session duration has increased by 20%, which would suggest that the site is slow to respond? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have run the site through Google Site Speed and there is some action to take regarding compression etc, minor stuff though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft perform more slowly than Wordpress, or probably a better question: does Craft require more server resources than Wordpress?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server is a dedicated server and has 2gb of RAM for 15 active domains and 256mb of memory is allocated to PHP for this particular domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pictures do seem to render a little more slowly than before especially on a slide show on the home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did have a lot of 404's which I was a bit slow to notice and clear up but have been dealt with in the .htaccess file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also moved the website onto SSL for added security so don't know if there is anything that I should look into there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All meta tags were ported over correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I been penalised in some way by Google for the change in website design or structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, I don't know why my site visitors would halve like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other tips or suggestions would be really helpful thanks.&lt;/p&gt;&#xA;" OwnerUserId="6448" LastActivityDate="2017-09-08T04:30:10.777" Title="Visitor drop off since moving over to Craft CMS" Tags="&lt;server&gt;&lt;speed&gt;&lt;resources&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21855" PostTypeId="1" CreationDate="2017-09-07T12:15:08.367" Score="0" ViewCount="156" Body="&lt;p&gt;If I'm enabling a user to post to Craft using the front-end entry form, is there a way that I can sanitize the title of a post?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to apply AP formatting to titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Stephen has a plugin &lt;a href=&quot;https://github.com/experience/entitle.craft-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entitle&lt;/a&gt; that does this but I'd rather have it on the initial submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a JS app so I can't do it on the Twig side.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-09-08T04:36:12.640" Title="Sanitize front-end entry form field" Tags="&lt;filter&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21857" PostTypeId="1" AcceptedAnswerId="23441" CreationDate="2017-09-07T14:11:56.177" Score="4" ViewCount="366" Body="&lt;p&gt;I need to return two types of entry to an external service, and am trying to do so in one endpoint. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to return all of the instances of each type, but it returns an array of mixed types.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;api/myEndpoint&quot; =&amp;gt; function() {&#xA;        return [&#xA;            &quot;criteria&quot; =&amp;gt; [&#xA;                &quot;type&quot; =&amp;gt; [&quot;typeOne&quot;, &quot;typeTwo&quot;],&#xA;            ],&#xA;            &quot;transformer&quot; =&amp;gt; new MyTransformer()&#xA;        ];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to achieve: &lt;code&gt;{ &quot;data&quot;: { &quot;typeOne&quot;: [{...}, {...}], &quot;typeTwo&quot;: [{...}, {...}]}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of various workarounds for this specific case. It would be easy enough to add a type field within the Transformer, and sort them on the other side. Or, simply make two calls. However, our team was planning on using Craft as a headless CMS for future projects, and it's important to me  be able to control the structure of Element API's JSON response. &lt;/p&gt;&#xA;" OwnerUserId="7225" LastActivityDate="2018-01-10T18:39:42.197" Title="With Element API, can I combine two entry types into a JSON object, keyed by type?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21858" PostTypeId="2" ParentId="21852" CreationDate="2017-09-07T14:34:03.623" Score="1" Body="&lt;p&gt;You're getting that error because &lt;code&gt;Do., 07 Sep. 2017 10:32:05&lt;/code&gt; isn't in a valid PHP &lt;a href=&quot;https://secure.php.net/manual/en/datetime.formats.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Date/Time format&lt;/a&gt; when you pass it into the &lt;code&gt;|date&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing it to &lt;code&gt;07 Sep. 2017 10:32:05&lt;/code&gt; should work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-12-07T04:24:34.087" LastActivityDate="2017-12-07T04:24:34.087" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21859" PostTypeId="1" AcceptedAnswerId="21871" CreationDate="2017-09-07T15:25:12.633" Score="2" ViewCount="721" Body="&lt;p&gt;I realize there are lots of options out there, but I’d be interested to know what service folks would recommend for integrating a CDN with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'd also be helpful to know what the general pain points, strengths and/or weaknesses of a given approach are (especially as it relates to Craft integration). &lt;/p&gt;&#xA;" OwnerUserId="588" LastEditorUserId="588" LastEditDate="2017-09-07T18:52:08.550" LastActivityDate="2017-09-08T04:21:15.353" Title="Recommended approach for integrating a CDN with a Craft site" Tags="&lt;performance&gt;&lt;cdn&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21860" PostTypeId="2" ParentId="21843" CreationDate="2017-09-07T16:41:03.797" Score="2" Body="&lt;p&gt;I managed to get access to the slug in the transformer function by using &lt;code&gt;use&lt;/code&gt;. I'm not sure if it's the correct way but it works for now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/series/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;  // get category by slug&#xA;  $category = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;  $category-&amp;gt;group = 'series';&#xA;  $category-&amp;gt;slug = $slug;&#xA;  $category-&amp;gt;first();&#xA;&#xA;  return [&#xA;    'elementType' =&amp;gt; ElementType::Entry,&#xA;    'criteria' =&amp;gt; [&#xA;      'section' =&amp;gt; ['lessons'],&#xA;      'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $series]&#xA;    ],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) use ($category) {&#xA;&#xA;      $firstCategory = $category-&amp;gt;first();&#xA;&#xA;      $cat = [&#xA;        'id' =&amp;gt; $firstCategory-&amp;gt;id,&#xA;        'slug' =&amp;gt; $firstCategory-&amp;gt;slug,&#xA;        'title' =&amp;gt; $firstCategory-&amp;gt;title&#xA;      ];&#xA;&#xA;      return array_merge(structureEntry($entry), structureCategory($cat));&#xA;    }&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6750" LastActivityDate="2017-09-07T16:41:03.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21862" PostTypeId="1" CreationDate="2017-09-07T17:02:57.097" Score="0" ViewCount="91" Body="&lt;p&gt;I have a matrix that essentially creates categorized lists of other entries. The fields in my matrix block are &quot;categoryName&quot;, a plain text field and &quot;member&quot;, a entry relationship field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know i can output a list in with all of the blocks in order like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in allMembers %}&#xA;  {% for member in block.members %}&#xA;    {{ block.categoryName }}:&#xA;    {{ member.title|typogrify }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this give me a list like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category 1: Apples &lt;/li&gt;&#xA;&lt;li&gt;Category 1: Oranges&lt;/li&gt;&#xA;&lt;li&gt;Category 1: Pears&lt;/li&gt;&#xA;&lt;li&gt;Category 2: Cats&lt;/li&gt;&#xA;&lt;li&gt;Category 2: Dogs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I really want, though is to combine the contents of both blocks into a single array, and also pull in the category names,so i can sort them alphabetically by related entry title, like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category 1: Apples &lt;/li&gt;&#xA;&lt;li&gt;Category 2: Cats&lt;/li&gt;&#xA;&lt;li&gt;Category 2: Dogs&lt;/li&gt;&#xA;&lt;li&gt;Category 1: Oranges&lt;/li&gt;&#xA;&lt;li&gt;Category 1: Pears&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know I can merge all of the related entries into a single array like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allMembers = [] %}&#xA;{# loop through all relationship fields for this entry #}&#xA;{% for block in entry.featuredMembers %}&#xA;  {# loop through related entries #}&#xA;  {% for member in block.members %}&#xA;    {# add member to members array #}&#xA;    {% set allMembers = allMembers|merge([member]) %}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{% for block in allMembers%}&#xA;  {{ block.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then I lose the Category Name. Is there a way to associate the categoryName field with the individual related entries before I merge them into my allMembers array?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-10-08T20:11:45.553" Title="Merge related entries from several matrix blocks while maintaining other matrix field data" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21863" PostTypeId="1" CreationDate="2017-09-07T17:22:52.930" Score="1" ViewCount="51" Body="&lt;p&gt;I have two custom element types, &lt;code&gt;Event&lt;/code&gt; and &lt;code&gt;Booking&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are related via the &lt;code&gt;eventId&lt;/code&gt; column on the Booking record which is a FK to the Event record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Booking record also has a &lt;code&gt;seats&lt;/code&gt; column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A usage scenario is that someone may come along and make a booking for two people (seats) at an event. Another person may then make a separate booking for the same event for 4 people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each event I'm going to need to know the total seats booked (in our example that would be 6).&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Option 1&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I could just have a &lt;code&gt;totalSeatsBooked&lt;/code&gt; property on the EventModel with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$totalBookedSeats = 0;&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Booking');&#xA;$criteria-&amp;gt;occurrenceId = $this-&amp;gt;id;&#xA;$eventBookings = $criteria-&amp;gt;find();&#xA;&#xA;if ($eventBookings)&#xA;{&#xA;    foreach ($eventBookings as $booking)&#xA;    {&#xA;        $totalSeatsBooked += $booking-&amp;gt;seats;&#xA;    }&#xA;}&#xA;&#xA;return $totalSeatsBooked;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that's going to get inefficient if I start having to list multiple events at the same time.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Option 2&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I could have a column on the EventRecord called &lt;code&gt;totalSeatsBooked&lt;/code&gt; and use an &lt;code&gt;onSaveBooking&lt;/code&gt; event to recalculate and save the total when ever a booking is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could work but it might be prone to becoming out-of-sync. I'd also only want to save the total when the booking is created, or when the seats value changes. Which adds complexity.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Option 3&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This is the one I'm unsure about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I extend the event's element query some how to join the two tables and run a sub-query to get the seats count? If it was possible and relatively efficient this would be my choice I think. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="379" LastActivityDate="2017-09-07T17:22:52.930" Title="Save or efficiently query a count from a related table" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21864" PostTypeId="1" AcceptedAnswerId="21865" CreationDate="2017-09-07T17:41:22.220" Score="12" ViewCount="3254" Body="&lt;p&gt;How can you programmatically save an entry that has a Matrix field in Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Something like &lt;a href=&quot;https://gist.github.com/brandonkelly/8149062&quot; rel=&quot;noreferrer&quot;&gt;this gist&lt;/a&gt; for Craft 2)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-09-01T05:50:42.120" Title="How to save Matrix data programmatically in Craft 3" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="21865" PostTypeId="2" ParentId="21864" CreationDate="2017-09-07T17:41:22.220" Score="17" Body="&lt;p&gt;Saving Matrix fields programmatically got a lot easier in Craft 3 thanks to all the content refactoring.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\elements\Entry;&#xA;use craft\elements\MatrixBlock;&#xA;&#xA;// Figure out the section &amp;amp; entry type&#xA;$section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('news');&#xA;$entryTypes = $section-&amp;gt;getEntryTypes();&#xA;$entryType = reset($entryTypes);&#xA;&#xA;// Create an entry&#xA;$entry = new Entry([&#xA;    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;    'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;    'fieldLayoutId' =&amp;gt; $entryType-&amp;gt;fieldLayoutId,&#xA;    'authorId' =&amp;gt; 1,&#xA;    'title' =&amp;gt; 'My Entry',&#xA;    'slug' =&amp;gt; 'my-entry',&#xA;    'postDate' =&amp;gt; new DateTime(),&#xA;]);&#xA;&#xA;// Set the custom field values (including Matrix)&#xA;$entry-&amp;gt;setFieldValues([&#xA;    'summary' =&amp;gt; 'Some &quot;summary&quot; custom field value...',&#xA;    'matrixField' =&amp;gt; [&#xA;        'new1' =&amp;gt; [&#xA;            'type' =&amp;gt; 'blockTypeHandle',&#xA;            'fields' =&amp;gt; [&#xA;                // the block's custom field values...&#xA;            ],&#xA;        ],&#xA;        'new2' =&amp;gt; [&#xA;            'type' =&amp;gt; 'blockTypeHandle',&#xA;            'fields' =&amp;gt; [&#xA;                // the block's custom field values...&#xA;            ],&#xA;        ],&#xA;    ],&#xA;]);&#xA;&#xA;// Save the entry&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-09-07T17:41:22.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21866" PostTypeId="1" AcceptedAnswerId="21867" CreationDate="2017-09-07T20:55:28.837" Score="3" ViewCount="518" Body="&lt;p&gt;I'm building an export plugin in Craft 2 and the entries are saved by the front-end and are never enabled, so no Post Date.  I have a form with the forms.date selectors that sends a start and end date to my controller.  How can I filter on Date Created?  After and before only works on Post Date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this for now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'contestEntries';&#xA;// Date Created &amp;gt;= start_date&#xA;// Date Created &amp;lt;= end_date&#xA;$criteria-&amp;gt;status = null;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="7065" LastActivityDate="2017-09-07T23:39:00.413" Title="How to pull entries with Date Created &gt; start and &lt; end?" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21867" PostTypeId="2" ParentId="21866" CreationDate="2017-09-07T21:05:20.857" Score="2" Body="&lt;p&gt;Here is syntax you can use to search a date field between two dates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$startDate = date('Y-m-d', strtotime($settings[&quot;start_date&quot;][&quot;date&quot;]));&#xA;$endDate = date('Y-m-d', strtotime($settings[&quot;end_date&quot;][&quot;date&quot;]));&#xA;&#xA;$criteria-&amp;gt;dateCreated = ['and','&amp;gt;= '.$startDate, '&amp;lt;= '.$endDate];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2017-09-07T23:39:00.413" LastActivityDate="2017-09-07T23:39:00.413" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21868" PostTypeId="1" AcceptedAnswerId="21890" CreationDate="2017-09-07T21:26:04.307" Score="1" ViewCount="78" Body="&lt;p&gt;Very new to plugin stuff and taking baby steps so forgive me if this is obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a simple notification service set up to send an email to the author of an entry (front end submitted) when it is saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simply sends the email to &lt;code&gt;$entry-&amp;gt;author&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry that gets submitted also has a related entry field and I'd like to send the author of that entry an email as well, but I'm not sure how I'd get access to them? Any pointers?&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2017-10-08T19:19:29.580" Title="Get a related entries author in a plugin" Tags="&lt;plugin-development&gt;&lt;emails&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21869" PostTypeId="1" AcceptedAnswerId="21872" CreationDate="2017-09-08T03:37:35.523" Score="2" ViewCount="1447" Body="&lt;p&gt;I am looking at shaving www. and enforcing https on the entire site without a plugin.  All along removing the index.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my .htaccess file, it works but is it optimized.  If you have any suggestions on how to condense or streamline would like to hear or see an example please. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;&#xA;RewriteEngine On&#xA;&#xA;# Remove WWW and SSL enforce&#xA;RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]&#xA;RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]&#xA;RewriteCond %{HTTPS} off&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]&#xA;&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.*)/$ /$1 [L,R=301]&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2017-09-08T04:22:13.270" Title="Anyone with a tricked out .htaccess file" Tags="&lt;redirect&gt;&lt;htaccess&gt;&lt;apache&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21870" PostTypeId="2" ParentId="21869" CreationDate="2017-09-08T04:20:02.307" Score="3" Body="&lt;p&gt;Since you mentioned in an earlier post that you are performance-minded, this might interest you: &lt;a href=&quot;https://nystudio107.com/blog/stop-using-htaccess-files-no-really&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stop using .htaccess files! No, really.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-08T04:20:02.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21871" PostTypeId="2" ParentId="21859" CreationDate="2017-09-08T04:21:15.353" Score="2" Body="&lt;p&gt;It's extremely easy if you're using a pull CDN like MaxCDN or KeyCDN. You just point your CDN at your server, and then point your Asset Sources at your CDN.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-08T04:21:15.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21872" PostTypeId="2" ParentId="21869" CreationDate="2017-09-08T04:22:13.270" Score="5" Body="&lt;p&gt;Been using this one for years, works great:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # ========================================= #&#xA;    # Force website to use &quot;www&quot;&#xA;    RewriteCond %{HTTP_HOST} ^example.com [NC]&#xA;    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]&#xA;    # ========================================= #&#xA;&#xA;    # ========================================= #&#xA;    # Force website to use &quot;https&quot;&#xA;    RewriteCond %{HTTPS} off&#xA;    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]&#xA;    # ========================================= #&#xA;&#xA;    # ========================================= #&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;    # ========================================= #&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This one &lt;em&gt;adds&lt;/em&gt; &lt;code&gt;www&lt;/code&gt;, but it's simple to reverse that (as you do in your original example).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-09-08T04:22:13.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21873" PostTypeId="2" ParentId="21853" CreationDate="2017-09-08T04:30:10.777" Score="3" Body="&lt;p&gt;I wouldn't be overly concerned about bounce rates and such, I'd be more concerned about conversion metrics. The reason is that many things affect bounce rate; if the new site is better designed, people may not &lt;em&gt;need&lt;/em&gt; to click on additional pages to find out what they want to know, for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing inherent with Craft that would result in this type of a falloff. For sure making sure all of the 404 errors get buttoned up would be a good start, and the &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retour plugin&lt;/a&gt; can assist with that. You could also consider installing the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic plugin&lt;/a&gt; to assist you with modern SEO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I'm the author of both of those plugins.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-08T04:30:10.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21874" PostTypeId="2" ParentId="21855" CreationDate="2017-09-08T04:36:12.640" Score="2" Body="&lt;p&gt;I would definitely not rely on client-side validation. It's fine to do it from a UX point of view, but you should also be doing it server-side as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a Vue app, write a custom validator for &lt;a href=&quot;https://github.com/baianat/vee-validate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vee Validate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-08T04:36:12.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21875" PostTypeId="1" CreationDate="2017-09-08T06:21:31.090" Score="0" ViewCount="69" Body="&lt;p&gt;Is it possible to pull an image from another entry? It seems like it would be simple. I've read a lot of posts and documentation, and feel like I'm close...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.slug('homepage') %}&#xA;&#xA;{% for image in entry.podcastItunesImage %}&#xA;    &amp;lt;itunes:image href=&quot;{{ siteUrl }}{{ image.getUrl}}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, I'm trying to put an asset field on the Homepage for a iTunes image.&lt;/p&gt;&#xA;" OwnerUserId="7190" LastEditorUserId="57" LastEditDate="2017-09-08T16:38:41.213" LastActivityDate="2017-09-12T18:57:31.650" Title="Image from Another Entry" Tags="&lt;entries&gt;&lt;image&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21876" PostTypeId="2" ParentId="21875" CreationDate="2017-09-08T08:13:33.410" Score="1" Body="&lt;p&gt;Yeah, I think you are close, you've just go your variables a bit mixed up. You set &lt;code&gt;entries&lt;/code&gt;, but then reference &lt;code&gt;entry&lt;/code&gt; and I think &lt;code&gt;getUrl&lt;/code&gt; should be called as a function &lt;code&gt;getUrl()&lt;/code&gt; as it's not a property (it might work that way, I've never tried tbh)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug('homepage') %}&#xA;&#xA;{% for image in entry.podcastItunesImage %}&#xA; &amp;lt;itunes:image href=&quot;{{ image.first.getUrl() }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;Oh I don't think you need &lt;code&gt;{{ siteUrl }}&lt;/code&gt; when you call &lt;code&gt;getUrl()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="643" LastEditorUserId="5762" LastEditDate="2017-09-12T18:57:31.650" LastActivityDate="2017-09-12T18:57:31.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21877" PostTypeId="1" CreationDate="2017-09-08T09:55:40.113" Score="1" ViewCount="175" Body="&lt;p&gt;I use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sourcePath = $assetRecord-&amp;gt;source-&amp;gt;sourceType-&amp;gt;getBasePath();&#xA;$folderPath = $assetRecord-&amp;gt;getFolder()-&amp;gt;path;&#xA;$path = $sourcePath.$folderPath.$assetRecord-&amp;gt;filename;&#xA;&#xA;if (IOHelper::fileExists($path)) {&#xA;    $content = IOHelper::getFileContents($assetRecord-&amp;gt;url);&#xA;    craft()-&amp;gt;request-&amp;gt;sendFile($test, $content, array('forceDownload' =&amp;gt; true));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The fileExists always return false. I use the image all over the site without any problems. Also the &lt;code&gt;$path&lt;/code&gt; variable return normal path from inside the public folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code lives inside a custom plugin.&lt;/p&gt;&#xA;" OwnerUserId="7230" LastEditorUserId="57" LastEditDate="2017-09-08T17:05:45.600" LastActivityDate="2017-09-08T17:05:45.600" Title="IOHelper::fileExists always false" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21878" PostTypeId="1" CreationDate="2017-09-08T10:33:52.253" Score="1" ViewCount="436" Body="&lt;p&gt;I’m on Craft v. 2.6.2983 and am encountering the well flagged issue of the control panel logging me out after 60 seconds. I've tried most of the solutions posted here and have had no success in resolving the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're three months into a Craft deploy this issue has only begun to arise in the last number of weeks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using redis for session storage and my sessions are remembered when I refresh or open a new tab. Using redis-cli monitor I can see sessions are being stored with the correct TTL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the following in my config/general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'appId' =&amp;gt; 'itmaapp123',&#xA;'defaultCookieDomain' =&amp;gt; '.itma.ie',&#xA;'validationKey' =&amp;gt; [REDACTED],&#xA;'overridePhpSessionLocation' =&amp;gt; 'tcp://redis:6379',&#xA;'cacheMethod' =&amp;gt; 'redis',&#xA;'userSessionDuration' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also set the relevant variables in config/rediscache.php (including timeout =&gt; 300).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insights on what might be causing the issue? My stack is Craft 2.6.2983 on nginx with php7.0-fpm and redis for session storage. nginx, php and redis are all running in docker containers behind an nginx reverse proxy. I'm using Cloudflare with SSL for cache and CDN.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7205" LastActivityDate="2017-09-15T15:45:45.950" Title="Control Panel Session 60 second Timeout" Tags="&lt;php&gt;&lt;session&gt;&lt;redis&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21879" PostTypeId="2" ParentId="21878" CreationDate="2017-09-08T11:25:41.257" Score="1" Body="&lt;p&gt;I've had issues before where I was getting logged out and could not fathom why: it turned out (after weeks) that when I was using Inspector Tools' Responsive Design mode, Chrome sends different UA strings... which by default causes Craft to log the user out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a long shot; but see if you're only experiencing the issue when you've got your inspector open and in mobile device simulation / responsive design modes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fix for me was to add the following to config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false, // stop Craft logging you out of the CMS while using Chrome's &quot;Device Mode&quot; view for responsive development&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-09-08T11:25:41.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21880" PostTypeId="1" AcceptedAnswerId="21895" CreationDate="2017-09-08T11:57:49.393" Score="2" ViewCount="191" Body="&lt;p&gt;I have a simple dropdown attached to each asset that allows the user to select the desired crop position (in %, so '0% 0%' , '0% 50%' , and so on). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my twig template I have this inside a for loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryImage = entry.pageHeader.first() %}&#xA;{% set imageCrop = entryImage.cropPosition %}&#xA;&#xA;  {% set transformedImages = craft.imager.transformImage(entryImage, [&#xA;        { width: 1680, jpegQuality: 75 },&#xA;        { width: 1080, jpegQuality: 75 },&#xA;        { width: 680, jpegQuality: 70 },&#xA;        { width: 480, jpegQuality: 70 }&#xA;      ], { ratio: 21/9, position: 'entryImage.cropPosition' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I've set the crop position inside the imageCrop variable and when I print it to screen the correct value is there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how the hell do I get the value that is set inside that imageCrop variable into my transformedImages array? I keep getting errors like: &lt;code&gt;Undefined offset: 1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2017-09-09T00:19:37.690" Title="Setting Imager crop position dynamically" Tags="&lt;plugin-imager&gt;&lt;responsive-images&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21881" PostTypeId="1" CreationDate="2017-09-08T12:13:26.643" Score="2" ViewCount="655" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;amforms&lt;/a&gt; for a client and need to create a user confirmation email that has a pdf attached containing the submitted form data, like a receipt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a little google searching, I believe I'd have to hook into amforms' &lt;code&gt;onEmailSubmission&lt;/code&gt; method and generate the pdf using the &lt;a href=&quot;http://www.mpdf1.com/mpdf/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;mPDF library&lt;/a&gt;, is this correct?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do I add the mPDF library to Craft?&lt;/li&gt;&#xA;&lt;li&gt;After creating a nice pdf template design, how can I populate a 2 column table in the pdf with form names/values submission data from all the fields?&lt;/li&gt;&#xA;&lt;li&gt;And then finally attach that pdf to the user confirmation email?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Does anybody have experience with this whether using amforms or not?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-05-11T12:03:23.393" Title="Generate pdf with form submission data" Tags="&lt;form&gt;&lt;plugin-amforms&gt;&lt;pdf&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21882" PostTypeId="2" ParentId="18509" CreationDate="2017-09-08T12:23:44.137" Score="2" Body="&lt;p&gt;Looking at the code where your errors is occurring (line 46 of craft/app/fieldtypes/BaseOptionsFieldType.php), it looks like you have either a Checkboxes or Multi-Select field whose &lt;code&gt;options&lt;/code&gt; setting is somehow set, but not set to an array. Not sure how it could have gotten into that state, but that’s the only thing that would explain your error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try re-saving any Checkboxes/Multi-Select fields (or if you have any 3rd party field types installed that might be extending Craft’s BaseOptionsFieldType, that would be even more likely the culprit), ensuring they have at least one option set.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-09-08T12:23:44.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21883" PostTypeId="1" CreationDate="2017-09-08T12:27:10.787" Score="2" ViewCount="48" Body="&lt;p&gt;I want to change the total amount programatically before the payments are processed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the total amount is $1000 I want to give a discount based on a point system in the users profile. You can add the desired amount based on his total points. If he adds 20 he gets a $20 discount and only have to pay $800. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to implement this? I have tried with &lt;code&gt;commerce_transactions.onCreateTransaction&lt;/code&gt; but no luck.&lt;/p&gt;&#xA;" OwnerUserId="6694" LastEditorUserId="57" LastEditDate="2017-09-08T16:51:25.297" LastActivityDate="2017-09-10T08:34:25.267" Title="How to change/discount total amount before payment" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21884" PostTypeId="1" AcceptedAnswerId="21904" CreationDate="2017-09-08T12:44:37.313" Score="3" ViewCount="617" Body="&lt;p&gt;I'm curious what the best way to handle quantity discounts would be on a product/variant level. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The base price of a &lt;strong&gt;variant&lt;/strong&gt; is $3 each, but if you buy 10-19 they're $2 each, and if you buy more than 20 they're $1 each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different variant of the same product could have a base price of $10 each, but if you buy 20-49 they're $8 each, and if you buy over 50 they're $6 each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2 (added file paths)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the comments by Luke and Andris below, I've implemented an adjuster to handle this. I created a &lt;code&gt;table&lt;/code&gt; field with the handle &lt;code&gt;quantityPricing&lt;/code&gt; with 3 columns: &lt;code&gt;minQuantity&lt;/code&gt;, &lt;code&gt;maxQuantity&lt;/code&gt;, &lt;code&gt;price&lt;/code&gt;. I then applied this field to the variants on a product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way a user can create as many prices for quantity ranges as they want. I then create the adjuster, checking the line items via the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft/plugins/myplugin/Adjusters/Myplugin_Adjustername.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class Myplugin_Adjustername implements Commerce_AdjusterInterface {&#xA;public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = [])&#xA;{&#xA;&#xA;    if (empty($lineItems))&#xA;    {&#xA;        return [];&#xA;    }&#xA;&#xA;    $updated  = [];&#xA;    $amount   = 0;&#xA;    $adjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;    $adjuster-&amp;gt;type        = 'Discount';&#xA;    $adjuster-&amp;gt;name        = 'Quantity Pricing';&#xA;    $adjuster-&amp;gt;description = 'The overall price of the cart has been adjsuted based on the number of items you are purchasing.';&#xA;    $adjuster-&amp;gt;orderId     = $order-&amp;gt;id;&#xA;&#xA;    foreach ($lineItems as $lineItem)&#xA;    {&#xA;        $purchasable = $lineItem-&amp;gt;purchasable;&#xA;        if (!empty($purchasable-&amp;gt;quantityPricing))&#xA;        {&#xA;            $updated[]     = $lineItem-&amp;gt;id;&#xA;            $updatedAmount = 0;&#xA;            foreach ($purchasable-&amp;gt;quantityPricing as $qp)&#xA;            {&#xA;                if (&#xA;                    ($lineItem-&amp;gt;qty &amp;gt;= $qp['minQuantity'] &amp;amp;&amp;amp; $lineItem-&amp;gt;qty &amp;lt;= $qp['maxQuantity'])&#xA;                 ||&#xA;                    ($lineItem-&amp;gt;qty &amp;gt;= $qp['minQuantity'] &amp;amp;&amp;amp; empty($qp['maxQuantity']))&#xA;                )&#xA;                {&#xA;                    $lineItem-&amp;gt;discount = ($qp['price'] - $lineItem-&amp;gt;price) * $lineItem-&amp;gt;qty;&#xA;                    $updatedAmount      = $lineItem-&amp;gt;discount;&#xA;                }&#xA;            }&#xA;            $amount += $updatedAmount;&#xA;        }&#xA;    }&#xA;&#xA;    $adjuster-&amp;gt;amount      = $amount;&#xA;    $adjuster-&amp;gt;optionsJson = ['lineItemsAffected' =&amp;gt; $updated];&#xA;&#xA;    $adjuster-&amp;gt;included = false;&#xA;&#xA;    if (empty($updated))&#xA;    {&#xA;        return[];&#xA;    }&#xA;&#xA;    return [$adjuster];&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was also seemingly able to do this using &lt;code&gt;onPopulateLineItem&lt;/code&gt; but based on the advice below changed it. My code for that looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('commerce_lineItems.onPopulateLineItem', function($event){&#xA;&#xA;            $purchasable = $event-&amp;gt;params['purchasable'];&#xA;            $lineItem    = $event-&amp;gt;params['lineItem'];&#xA;&#xA;            // This method checks for quantity pricing and updates &#xA;            // line items costs depending on what it finds.&#xA;            if (!empty($purchasable-&amp;gt;quantityPricing))&#xA;            {&#xA;                foreach ($purchasable-&amp;gt;quantityPricing as $qp)&#xA;                {&#xA;                    if (&#xA;                        ($lineItem-&amp;gt;qty &amp;gt;= $qp['minQuantity'] &amp;amp;&amp;amp; $lineItem-&amp;gt;qty &amp;lt;= $qp['maxQuantity'])&#xA;                     ||&#xA;                        ($lineItem-&amp;gt;qty &amp;gt;= $qp['minQuantity'] &amp;amp;&amp;amp; empty($qp['maxQuantity']))&#xA;                    )&#xA;                    {&#xA;                        $lineItem-&amp;gt;price = (float) $qp['price'];&#xA;                    }&#xA;                }&#xA;            }&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the comments below, I'm not exactly sure why an Adjuster is the better route to go, because both seem to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please don't hesitate to mention if I did something ridiculously stupid somewhere. It certainly wouldn't be the first time.&lt;/p&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2018-03-23T21:07:04.030" LastActivityDate="2018-03-23T21:07:04.030" Title="Craft Commerce: How do I handle quantity based discounts on a product level?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21885" PostTypeId="2" ParentId="21880" CreationDate="2017-09-08T13:56:37.003" Score="2" Body="&lt;p&gt;If the value of &lt;code&gt;imageCrop&lt;/code&gt; is a string in the correct format (ie &lt;code&gt;50% 50%&lt;/code&gt;, &lt;code&gt;0% 0%&lt;/code&gt;, or similar), this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryImage = entry.pageHeader.first() %}&#xA;{% set imageCrop = entryImage.cropPosition %}&#xA;&#xA;{% set transformedImages = craft.imager.transformImage(entryImage, [&#xA;    { width: 1680, jpegQuality: 75 },&#xA;    { width: 1080, jpegQuality: 75 },&#xA;    { width: 680, jpegQuality: 70 },&#xA;    { width: 480, jpegQuality: 70 }&#xA;  ], { ratio: 21/9, position: imageCrop }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2017-09-08T13:56:37.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21886" PostTypeId="2" ParentId="17227" CreationDate="2017-09-08T14:05:17.113" Score="1" Body="&lt;p&gt;You can achieve this with a custom adjuster. Please refer the code snippet below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a new adjuster and apply your logic here&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// check each line item&#xA;foreach($lineItems as $lineItem)&#xA;{&#xA;....&#xA;&amp;lt;your business logic here&#xA;....&#xA;$discount_total = &amp;lt;amount&amp;gt;;&#xA;}&#xA;&#xA;$order-&amp;gt;baseDiscount = $order-&amp;gt;baseDiscount - $discount_total;&#xA;&#xA;$myAdjuster-&amp;gt;type = &quot;Custom discount&quot;;&#xA;$myAdjuster-&amp;gt;name = &quot;Group discount&quot;;&#xA;$myAdjuster-&amp;gt;description = &quot;Total of discount&quot;;&#xA;$myAdjuster-&amp;gt;amount = -$discount_total;&#xA;$myAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;//        //if your Adjuster affects lineItems rather than the total, you record the ids here&#xA;$myAdjuster-&amp;gt;optionsJson = ['lineItemsAffected'=&amp;gt; null ];&#xA;$myAdjuster-&amp;gt;included = false;&#xA;&#xA;return [$myAdjuster];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6694" LastActivityDate="2017-09-08T14:05:17.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21888" PostTypeId="2" ParentId="21877" CreationDate="2017-09-08T17:05:21.717" Score="1" Body="&lt;p&gt;&lt;code&gt;IOHelper::fileExists()&lt;/code&gt; will return false for a few reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Either PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.realpath.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;realpath&lt;/a&gt; or &lt;a href=&quot;https://secure.php.net/manual/en/function.is-file.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;is_file&lt;/a&gt; returns false. i.e. the given path doesn't exist or PHP doesn't have executable permissions on the folders leading up to that path or read permissions on the file itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're using a case-sensitive file system and you're passing in a different cased path/filename than what's on the file system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-08T17:05:21.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21889" PostTypeId="2" ParentId="21862" CreationDate="2017-09-08T17:15:58.210" Score="1" Body="&lt;p&gt;Figured it out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for member in allMembers %}&#xA;    {% set cat = entry.featuredMembers.relatedTo(member).first() %} &#xA;    {{ member.categoryName }} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="1098" LastEditDate="2017-10-08T20:11:45.553" LastActivityDate="2017-10-08T20:11:45.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21890" PostTypeId="2" ParentId="21868" CreationDate="2017-09-08T17:28:56.493" Score="1" Body="&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Grab an entry.&#xA;$entry = craft()-&amp;gt;entries-&amp;gt;getEntryById(4);&#xA;&#xA;// The current entry's author.&#xA;$originalAuthor = $entry-&amp;gt;getAuthor();&#xA;&#xA;// This is assuming your Entries field is called &quot;relatedEntry&quot;&#xA;$relatedEntry = $entry-&amp;gt;relatedEntry-&amp;gt;first();&#xA;&#xA;// Make sure one was selected.&#xA;if ($relatedEntry)&#xA;{&#xA;    // The related entry's author.&#xA;    $relatedEntryAuthor = $relatedEntry-&amp;gt;getAuthor();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-08T17:28:56.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21891" PostTypeId="1" AcceptedAnswerId="21912" CreationDate="2017-09-08T17:36:29.433" Score="1" ViewCount="818" Body="&lt;p&gt;We’re running into issues with the null coalescence operator in the latest version of Craft (2.6.2989).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qj6Wv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qj6Wv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why this might be happening?&lt;/p&gt;&#xA;" OwnerUserId="596" LastEditorUserId="45" LastEditDate="2017-09-08T19:19:40.040" LastActivityDate="2017-09-11T09:18:10.897" Title="Unexpected token &quot;punctuation&quot; of value &quot;?&quot;" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21892" PostTypeId="2" ParentId="21881" CreationDate="2017-09-08T23:28:36.863" Score="4" Body="&lt;p&gt;Note: I've never used amforms nor mPDF, so I'm on a bit thin ice with this answer – hopefully it'll prove semi-useful, though.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I add the mPDF library to Craft?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To include any third-party PHP library in Craft, you'll need to &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;build&lt;/a&gt; a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt;, since that's the only real way to write (or include) PHP inside a Craft CMS app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft plugins are just plain ol' PHP, so to actually include the library, you can use a regular &lt;code&gt;require&lt;/code&gt; statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    ...&#xA;    require_once('/path/to/mpdf.php');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...however, the recommended way to include a third party package is to use &lt;a href=&quot;https://getcomposer.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer&lt;/a&gt; (which mPDF &lt;a href=&quot;https://github.com/mpdf/mpdf#installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;supports&lt;/a&gt;) and autoload your dependencies from your plugin's main class' &lt;code&gt;init&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    ...&#xA;    require_once(__DIR__ . '/vendor/autoload.php');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing to pay attention to when using third party libraries inside a Craft plugin, is that Craft has it's &lt;code&gt;\Craft&lt;/code&gt; namespace for the core and all plugins, and your third party library's code won't be found under that namespace. To account for this, you can use the &lt;code&gt;use&lt;/code&gt; statement (add it to the top of any file where you want to use the mPDF library:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use \Mpdf\Mpdf as Mpdf;&#xA;&#xA;...&#xA;$mpdf = new Mpdf();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you can skip the &lt;code&gt;use&lt;/code&gt; statement, in which case you'll have to type out the namespace path for the third party library every time you use it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$mpdf = new \Mpdf\Mpdf();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After creating a nice pdf template design, how can I populate a 2 column table in the pdf with form names/values submission data from all the fields?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In order to generate a PDF based on the fields submitted via amforms, you'll probably need to hook into the &lt;code&gt;onEmailSubmission&lt;/code&gt; event (as you mention), and render a Twig template to HTML before using mPDF to generate a PDF from that HTML output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a very basic example – this would also go into your plugin's main class' &lt;code&gt;init&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    // Require your Composer dependencies (mPDF, possibly others)&#xA;    require_once(__DIR__ . '/vendor/autoload.php');&#xA;&#xA;    // Hook into amforms' onEmailSubmission event&#xA;    craft()-&amp;gt;on('amForms_submissions.onEmailSubmission', function (Event $event) {&#xA;&#xA;        $params = $event-&amp;gt;params();&#xA;&#xA;        // Use whatever's in $params to generate a PDF via mPDF&#xA;        // One way to do it is to compile a Twig template from your site's /templates folder via Craft's [TemplatesService][5], and then feed the HTML output to mPDF:&#xA;        $html = craft()-&amp;gt;templates-&amp;gt;render('/path/to/template', $params);&#xA;&#xA;        // Create a mPDF instance, and generate a PDF file from the HTML&#xA;        $mpdf = new Mpdf();&#xA;        $mpdf-&amp;gt;WriteHTML($html);&#xA;&#xA;        // Have mPDF save the PDF file to some location&#xA;        $mpdf-&amp;gt;Output('/path/to/your/pdf.pdf');&#xA;&#xA;        // Some code that will attach the PDF to the email amforms will send&#xA;        ...&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: As I've never used amforms, I'm not totally sure about the syntax for the actual event listener here – the plugin's documentation is lacking in terms of its custom events; briefly looking at the source code makes me believe that &lt;code&gt;amForms_submissions&lt;/code&gt; is the correct prefix for the event, but a minor disclaimer here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond the simple example above, for details on how to generate the actual PDF, I'll have to refer to the official mPDF documentation: &lt;a href=&quot;https://mpdf.github.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mpdf.github.io/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And then finally attach that pdf to the user confirmation email?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've no idea how to attach the PDF to the actual confirmation email amforms sends, and the documentation doesn't mention a use case like that – hopefully someone familiar with amforms can help you out with that part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally – this is probably not helpful to your specific use case, but still – here's how you could send the PDF using Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/EmailService#sendEmail-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;EmailService&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = new EmailModel();&#xA;$email-&amp;gt;toEmail = 'hello@example.com';&#xA;$email-&amp;gt;subject = 'Your PDF is ready, boss';&#xA;$email-&amp;gt;body    = 'How you doin, {{ user.name }}?';&#xA;$email-&amp;gt;attachments = [[&#xA;   'path' =&amp;gt; '/path/to/your/pdf.pdf',&#xA;   'name' =&amp;gt; 'An awesome PDF',&#xA;   'encoding' =&amp;gt; 'UTF-8',&#xA;   'type' =&amp;gt; 'application/pdf',&#xA;]];&#xA;&#xA;craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(If amforms doesn't offer a way to include the PDF attachment, you might be able to solve it by a) using the &lt;code&gt;onBeforeEmailSubmission&lt;/code&gt; event instead and setting &lt;code&gt;$event-&amp;gt;performAction&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; inside the event handler, to prevent amforms from actually sending the email confirmation; then compile an &lt;code&gt;EmailModel&lt;/code&gt; yourself (like in the example above), and sending that instead – just an idea)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-09-08T23:53:28.153" LastActivityDate="2017-09-08T23:53:28.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21893" PostTypeId="1" CreationDate="2017-09-08T23:29:26.793" Score="1" ViewCount="210" Body="&lt;p&gt;I'm trying to create a switch statement for a single entry event template that has various entry fields associated with it (description, contact, location, etc.) from an Events Channel I have. Rather than using a bunch of IF's to display only those fields that have been populated, I'm trying to use a switch statement instead, but I can't get this to work when I based the switch on the 'entry.type.&quot; I'm trying to something like this, but it's not working. Any help would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.type %}&#xA;{% case 'contact' %}&#xA;    {{ entry.contact }}&#xA;{% case 'location' %}&#xA;    {{ entry.location }}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5958" LastActivityDate="2017-09-08T23:48:54.187" Title="Creating a switch based on entry handle" Tags="&lt;switch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21894" PostTypeId="2" ParentId="21893" CreationDate="2017-09-08T23:48:54.187" Score="1" Body="&lt;p&gt;It's a little unclear what you need to achieve here –&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your entries' &lt;a href=&quot;https://craftcms.com/features/entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry type&lt;/a&gt; handles actually &lt;em&gt;are&lt;/em&gt; &lt;code&gt;'contact'&lt;/code&gt; and &lt;code&gt;'location'&lt;/code&gt;, the above code should work; which means that you've got an error somewhere that isn't really possible to figure out based on your description – e.g. the entry type handle is actually &lt;code&gt;contacts&lt;/code&gt;, and not &lt;code&gt;contact&lt;/code&gt;, or something like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing you might try, is to simply print the &lt;code&gt;entry.type&lt;/code&gt; variable in a template, to see if it contains what you expect it to contain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.type }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if your issue is simply that some entries have a &lt;code&gt;contact&lt;/code&gt; field populated and others have a &lt;code&gt;location&lt;/code&gt; field populated, you can't really use a &lt;code&gt;{% switch %}&lt;/code&gt; statement in any sensible manner for that – though a plain old &lt;code&gt;{% if %}&lt;/code&gt; would do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.contact %}&#xA;    {{ entry.contact }}&#xA;{% elseif entry.location %}&#xA;    {{ entry.location }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-08T23:48:54.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21895" PostTypeId="2" ParentId="21880" CreationDate="2017-09-09T00:09:39.697" Score="2" Body="&lt;p&gt;Your issue is that Craft (or rather, Imager) is not treating your &lt;code&gt;entry.cropPosition&lt;/code&gt; Dropdown field as a &lt;em&gt;string&lt;/em&gt;; you're essentially passing the actual &lt;code&gt;DropdownFieldType&lt;/code&gt; model (an array like object).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix it, replace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;position: entry.cropPosition&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;position: entry.cropPosition.value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, you might want to add a default value to the field, in case you have entries without a value set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;position: entry.cropPosition.value|default('50% 50%')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full, corrected code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformedImages = craft.imager.transformImage(entryImage, [&#xA;    { width: 1680, jpegQuality: 75 },&#xA;    { width: 1080, jpegQuality: 75 },&#xA;    { width: 680, jpegQuality: 70 },&#xA;    { width: 480, jpegQuality: 70 }&#xA;  ], { ratio: 21/9, position: entryImage.cropPosition.value|default('50% 50%') }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, make sure you're not wrapping &lt;code&gt;entryImage.cropPosition&lt;/code&gt; in quotes (i.e. &lt;code&gt;'entryImage.cropPosition'&lt;/code&gt;), which you do in your example (you probably don't have this in your actual code, based on the error message you're seeing). If you wrap the value in quotes, you're actually passing Imager the &lt;em&gt;string&lt;/em&gt; &lt;code&gt;&quot;entryImage.cropPosition&quot;&lt;/code&gt;, not the actual value for the field.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-09-09T00:19:37.690" LastActivityDate="2017-09-09T00:19:37.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21896" PostTypeId="2" ParentId="18529" CreationDate="2017-09-09T03:33:46.770" Score="2" Body="&lt;p&gt;Just want to chime in with what fixed this for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the same issue and it was the Nginx configuration. Specifically, the order that I some of my location and cache settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get it working, I strictly followed the order from this: &lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/static-caching-with-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7236" LastActivityDate="2017-09-09T03:33:46.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21898" PostTypeId="1" AcceptedAnswerId="22192" CreationDate="2017-09-09T14:15:31.590" Score="2" ViewCount="581" Body="&lt;p&gt;I have to make a website that has a single craft installation and one database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the site is for a company that owns several garages which should have their own subsite on a subdomain. It should all be multilingual and those subsite/subdomains would have single pages as well as channels for &lt;code&gt;used cars&lt;/code&gt; or &lt;code&gt;new cars&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I'm wondering is how to set up those subsites. &#xA;Their url structure should be like &lt;code&gt;http://subsite.domain.com/{lang}/{single-page}&lt;/code&gt; or &lt;code&gt;http://subsite.domain.com/{lang}/blog/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking maybe using a structure per subsite to keep all the content uncluttered in the dashboard and creating a channel for each subsite &lt;code&gt;blog&lt;/code&gt;, &lt;code&gt;used cars section&lt;/code&gt; and &lt;code&gt;new cars section&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not really sure what the best way to set this up would be or even how to point the pages/channels to a subdomain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I have to create new multi-environmont configs for each subsite or is there a way to do this automatically or maybe that's not even necessary? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each subsite will also have users who can only edit that specific subsite. (Maybe something to keep in mind when structuring the site)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a  little diagram that might help show what I'm looking for:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Of6ne.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Of6ne.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I'll be using craft pro for the languages and users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help and tips would be much appreciated.&#xA;(Feel free to ask for more information if necessary)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance&lt;/p&gt;&#xA;" OwnerUserId="5363" LastEditorUserId="5363" LastEditDate="2017-09-12T14:45:06.370" LastActivityDate="2017-09-30T03:36:40.130" Title="Structuring site with multiple subsites" Tags="&lt;multi-environment&gt;&lt;multi-domain&gt;&lt;multi-site&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21899" PostTypeId="1" CreationDate="2017-09-09T17:08:55.753" Score="1" ViewCount="664" Body="&lt;p&gt;I'm trying to build a feed of entries in a column grid. Something like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;column&quot;&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;First entry&amp;lt;/a&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;Fourth entry&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;column&quot;&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;Second entry&amp;lt;/a&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;Fifth entry&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;column&quot;&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;Third entry&amp;lt;/a&amp;gt;&#xA; &amp;lt;a class=&quot;entry&quot;&amp;gt;Sixth entry&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I achieve that? In my head &lt;code&gt;.batch(3)&lt;/code&gt; only works horizontally for rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt; To make it more clearly, that's my goal and the reason for columns instead of rows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wmLq3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wmLq3.jpg&quot; alt=&quot;Column Grid&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7146" LastEditorUserId="7146" LastEditDate="2017-09-11T18:41:35.920" LastActivityDate="2017-09-11T19:15:47.290" Title="Split entries in columns" Tags="&lt;entries&gt;&lt;layout&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21900" PostTypeId="1" AcceptedAnswerId="21907" CreationDate="2017-09-09T19:26:05.097" Score="1" ViewCount="38" Body="&lt;p&gt;wonder if a guru could help, I am nearly there, just stuck on the right call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building a standard css/jquery responsive tab solution. I am pulling back child entries to populate a parent page with said tabs. The problem is the for loop, not being able to close the unordered list before the next part. I wonder if anyone could help please.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;!-- Tabs --&amp;gt;&#xA;{% set entries = craft.entries.section('country').level(3) %}&#xA;&amp;lt;ul class=&quot;tabs&quot;&amp;gt;&#xA;&#xA;{% for entry in entries %}&#xA;&amp;lt;li {% if loop.first %} class=&quot;&quot; {% else %} class=&quot;active&quot; {% endif %} rel=&quot;{{ loop.index }}&quot;&amp;gt;{{entry.pageTitle}}&amp;lt;/li&amp;gt;&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;tab_container&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- start tab --&amp;gt;&#xA;&amp;lt;h3 {% if loop.first %} class=&quot;d_active tab_drawer_heading&quot;  {% else %} class=&quot;tab_drawer_heading&quot; {% endif %}  rel=&quot;{{ loop.index }}&quot;&amp;gt;{{entry.pageTitle}}&amp;lt;/h3&amp;gt;&#xA;&amp;lt;div id=&quot;{{ loop.index }}&quot; class=&quot;tab_content&quot;&amp;gt;&#xA;{{entry.pageTitle}}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;!-- end tab --&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- .tab_container --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2236" LastActivityDate="2017-09-10T21:46:59.953" Title="A tabbed UI for child entries" Tags="&lt;entries&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21901" PostTypeId="1" CreationDate="2017-09-10T01:11:04.417" Score="3" ViewCount="1144" Body="&lt;p&gt;I'm just getting started with Craft (and digging it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen lots of xml sitemap plugins available already.  How do I create a human readable sitemap that will be browsable from the front end and that I can link to in the footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help in advance!&lt;/p&gt;&#xA;" OwnerUserId="7237" LastActivityDate="2017-09-10T01:20:58.883" Title="How do I create a Human readable sitemap in Craft CMS" Tags="&lt;plugin-sitemap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21902" PostTypeId="2" ParentId="21901" CreationDate="2017-09-10T01:20:58.883" Score="4" Body="&lt;p&gt;You could do this manually within a &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;template&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code should get you started – it will output all of the sections and their entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through all the sections #}&#xA;{% for section in craft.sections.getAllSections() %}&#xA;  {# We only care about sections that have URLs #}&#xA;  {% if section.hasUrls %}&#xA;    &amp;lt;h2&amp;gt;{{ section.name }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {# Loop through each of its entries #}&#xA;      {% for entry in craft.entries.sectionId(section.id).limit(null) %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this won’t include any links to pages that only exist as a template. For example if you have a &lt;code&gt;contact.twig&lt;/code&gt; template, and you don’t have a Single section in the Control Panel for it, then that will need to manually be added at the beginning or end of this list.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-09-10T01:20:58.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21903" PostTypeId="2" ParentId="21883" CreationDate="2017-09-10T08:34:25.267" Score="2" Body="&lt;p&gt;Have you looked into building an adjuster for this purpose? You can find the documentation &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-09-10T08:34:25.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21904" PostTypeId="2" ParentId="21884" CreationDate="2017-09-10T08:37:31.703" Score="3" Body="&lt;p&gt;Have you looked into building an adjuster for this purpose? You can find the documentation &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-09-10T08:37:31.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21905" PostTypeId="1" CreationDate="2017-09-10T10:03:07.770" Score="1" ViewCount="432" Body="&lt;p&gt;Hi this is a variation of the question asked here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17347/update-commerce-cart-using-ajax&quot;&gt;on updating the cart using ajax&lt;/a&gt;, instead I'm attempting to use the Fetch API. As a test the form submits properly when submitting in the usual way without using the Fetch request. I've attempted to replicate the synchronous request header that I inspected in the Chrome Network tab but I still get a Bad Request error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;addToCartForm&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ product.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let formElem = document.getElementById('addToCartForm');&#xA;let form = new FormData(formElem);&#xA;let request = new Request('/', {&#xA;  credentials: 'include',&#xA;  method: 'post',&#xA;  mode: 'same-origin',&#xA;  redirect: 'follow',&#xA;  headers: new Headers({&#xA;    'Content-Type': 'application/x-www-form-urlencoded',&#xA;    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',&#xA;    'X-Requested-With': 'XMLHttpRequest' // so craft detects ajax&#xA;  }),&#xA;  body: form&#xA;});&#xA;&#xA;fetch(request).then((response) =&amp;gt; {&#xA;  if(response.ok) {&#xA;    return response.text();&#xA;  }&#xA;  throw new Error('Network response was not ok.');&#xA;}).then((response) =&amp;gt; {&#xA;  console.log('Worked:');&#xA;  console.log(response);&#xA;}).catch((error) =&amp;gt; {&#xA;  console.log(error);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2017-09-11T12:27:31.873" Title="Update Commerce Cart using Fetch" Tags="&lt;plugin-craftcommerce&gt;&lt;ajax&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21906" PostTypeId="2" ParentId="21899" CreationDate="2017-09-10T18:35:28.280" Score="1" Body="&lt;p&gt;There's no easy twig function available to do this, but the code from &lt;a href=&quot;https://stackoverflow.com/questions/17715777/how-to-make-3-columns-table-with-twig-in-symfony2&quot;&gt;this answer&lt;/a&gt; should be able to help you.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set columns = 3 %}&#xA;{% for entry in entries %}&#xA;    {% if loop.first or loop.index0 is divisibleby(columns) %}&#xA;        &amp;lt;tr&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;td&amp;gt;{{ entry.title }}&amp;lt;/td&amp;gt;&#xA;&#xA;    {% if loop.last and loop.index is not divisibleby(columns) %}&#xA;        {% for n in range(low=columns - (loop.index % columns), high=1, step=-1) %}&#xA;            &amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    {% if loop.last or loop.index is divisibleby(columns) %}&#xA;        &amp;lt;/tr&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6675" LastActivityDate="2017-09-10T18:35:28.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21907" PostTypeId="2" ParentId="21900" CreationDate="2017-09-10T21:32:57.260" Score="1" Body="&lt;p&gt;I would go for two loops to make it easier to maintain sanity later on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Tabs --&amp;gt;&#xA;{% set entries = craft.entries.section('country').level(3) %}&#xA;&amp;lt;ul class=&quot;tabs&quot;&amp;gt;&#xA;   {% for entry in entries %}   &#xA;   &amp;lt;li class=&quot;{% if loop.first %}active{% endif %}&quot; rel=&quot;{{ loop.index }}&quot;&amp;gt;{{entry.pageTitle}}&amp;lt;/li&amp;gt;&#xA;   {% endif %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;&amp;lt;!-- Tab_container --&amp;gt;&#xA;&amp;lt;div class=&quot;tab_container&quot;&amp;gt;&#xA;   {% for entry in entries %}  &#xA;   &amp;lt;h3 class=&quot;{% if loop.first %}d_active{% endif %} tab_drawer_heading&quot; rel=&quot;{{ loop.index }}&quot;&amp;gt;{{entry.pageTitle}}&amp;lt;/h3&amp;gt;&#xA;   &amp;lt;div id=&quot;{{ loop.index }}&quot; class=&quot;tab_content&quot;&amp;gt;&#xA;      {{entry.pageTitle}}&#xA;   &amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="6064" LastEditDate="2017-09-10T21:46:59.953" LastActivityDate="2017-09-10T21:46:59.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21908" PostTypeId="1" AcceptedAnswerId="21914" CreationDate="2017-09-10T21:43:58.413" Score="1" ViewCount="267" Body="&lt;p&gt;Is it possible to submit to an AM Forms form via Ajax? I cannot find anything in the docs? Is there a tutorial somewhere?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-09-11T11:14:06.153" Title="Ajax Submit with AM Forms - How To" Tags="&lt;ajax&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21909" PostTypeId="1" CreationDate="2017-09-11T00:13:12.513" Score="0" ViewCount="63" Body="&lt;p&gt;Just want uploaded images for entries to show for desktop AND mobile&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = entry.galleryImage %}&#xA;&#xA;{% if assets | length %}&#xA;&#xA;{% for asset in assets %}&#xA;    {% if asset.kind == 'video' %}&#xA;        &amp;lt;video class=&quot;vid&quot; preload=&quot;none&quot; controls=&quot;false&quot; loop webkit-playsinline muted&amp;gt;&#xA;            &amp;lt;source src=&quot;{{ asset.url }}&quot; poster=&quot;{{ asset.url }}&quot; type=&quot;video/mp4&quot;&amp;gt;&#xA;        &amp;lt;/video&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;img class=&quot;gallery_img_1&quot;  src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7239" LastEditorUserId="57" LastEditDate="2017-09-11T05:39:48.040" LastActivityDate="2017-09-11T05:39:48.040" Title="Images Uploaded in CMS not showing on mobile [desktop is fine]" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21910" PostTypeId="2" ParentId="21909" CreationDate="2017-09-11T01:54:33.707" Score="2" Body="&lt;p&gt;From Craft's POV, there's no difference between desktop and mobile.  I'd check your CSS to see if you're changing how things are displayed depending on the &lt;code&gt;@media&lt;/code&gt; query breakpoints.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-11T01:54:33.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21912" PostTypeId="2" ParentId="21891" CreationDate="2017-09-11T09:18:10.897" Score="2" Body="&lt;p&gt;The issue was a plugin’s &lt;code&gt;composer.json&lt;/code&gt; that was loading an older version of Twig as a nested dependancy, which was overriding Craft’s Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running a &lt;code&gt;composer update&lt;/code&gt; for that plugin rectified the issue.&lt;/p&gt;&#xA;" OwnerUserId="596" LastActivityDate="2017-09-11T09:18:10.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21913" PostTypeId="2" ParentId="21905" CreationDate="2017-09-11T10:49:37.923" Score="1" Body="&lt;p&gt;As mentioned on Twitter, pretty sure this we will be an issue with CSRF ... Get it working first with that turned off is my advice. I have not used Fetch, though.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-09-11T10:49:37.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21914" PostTypeId="2" ParentId="21908" CreationDate="2017-09-11T11:14:06.153" Score="2" Body="&lt;p&gt;There is an issue open over on their &lt;a href=&quot;https://github.com/am-impact/amforms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt;, asking about this and the last answer says it's something they are going to add at a later date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/am-impact/amforms/issues/144&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ajax Sending Issue&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in short I guess not for the time being.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I guess if you have the time and fancy the challenge, you could always add it yourself and do a Pull Request?&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-09-11T11:14:06.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21916" PostTypeId="1" CreationDate="2017-09-11T12:17:11.633" Score="0" ViewCount="234" Body="&lt;p&gt;On a entries (listing) page I'm using pagination and a fixed limit of entries set. I want visitors to be able to select (dropdown) the number of entries that should be listed (limit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not a Java or AJAX expert can someone show me the way?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid-show&quot;&amp;gt;&#xA;   &amp;lt;select&amp;gt;&#xA;      &amp;lt;option value=&quot;12&quot;&amp;gt;12&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;20&quot;&amp;gt;20&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;50&quot;&amp;gt;50&amp;lt;/option&amp;gt;&#xA;   &amp;lt;/select&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% paginate craft.entries({&#xA;    section: 'holidayHomes',&#xA;    limit: 12 ,&#xA;}) as pageInfo, pageEntries %}&#xA;&#xA;{% for entry in pageEntries %}&#xA;&#xA;      &amp;lt;div class=&quot;cdescription&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot; &amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;          &amp;lt;p&amp;gt;{{ entry.body | striptags | slice(0,300)~'...' }}&amp;lt;/p&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2017-09-11T19:27:34.583" Title="Dynamic entries limit via dropdown" Tags="&lt;entries&gt;&lt;ajax&gt;&lt;javascript&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21917" PostTypeId="2" ParentId="14530" CreationDate="2017-09-11T12:21:28.417" Score="1" Body="&lt;p&gt;I'm following Brandon's example here but am having trouble passing the variable that is set from the first subtask to the second subtask. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Primary Task&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Products_TestPrimaryTask extends BaseTask&#xA;{&#xA;    public $myVar;&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Running Primary Task';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 2;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        switch ($step)&#xA;        {&#xA;            case 0:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('Products_TestSub1', null, array(&#xA;                    'primaryTaskId' =&amp;gt; $this-&amp;gt;model-&amp;gt;id&#xA;                ));&#xA;            }&#xA;            case 1:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('Products_TestSub2', null, array(&#xA;                    'subVar' =&amp;gt; $this-&amp;gt;myVar,&#xA;                ));&#xA;            }&#xA;        }&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    public function setPrimaryTaskVar($var)&#xA;    {&#xA;        $this-&amp;gt;myVar = $var;&#xA;&#xA;        ProductsPlugin::log('Variable in Primary Task: ' . print_r($this-&amp;gt;myVar, true));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sub Task 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Products_TestSub1Task extends BaseTask&#xA;{&#xA;    protected function defineSettings()&#xA;    {&#xA;        return [&#xA;            'primaryTaskId' =&amp;gt; AttributeType::Number&#xA;        ];&#xA;    }&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Running Sub Task 1';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 1;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        $primaryTask = craft()-&amp;gt;tasks-&amp;gt;getTaskById($this-&amp;gt;getSettings()-&amp;gt;primaryTaskId);&#xA;        $primaryTask-&amp;gt;getTaskType()-&amp;gt;setPrimaryTaskVar('hello');&#xA;&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sub Task 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Products_TestSub2Task extends BaseTask&#xA;{&#xA;    protected function defineSettings()&#xA;    {&#xA;        return [&#xA;            'subVar' =&amp;gt; AttributeType::String&#xA;        ];&#xA;    }&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Running Sub Task 2';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 1;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        ProductsPlugin::log('Variable in Sub Task 2: ' . print_r($this-&amp;gt;getSettings()-&amp;gt;subVar, true));&#xA;&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So Sub Task 1 calls the &lt;code&gt;setPrimaryTaskVar&lt;/code&gt; method in the Primary Task, which sets the variable that then gets passed to Sub Task 2 in step 2 of the Primary Task. However, when I try to log that variable in Sub Task 2 it is showing as null.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something obvious here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;WORKAROUND&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After playing around with this a bit more, the only way I could persist the data between steps in the Primary Task was to save the variable in question to a SESSION var. So the Primary Task class has been amended to the following. Hope this helps someone else:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Products_TestPrimaryTask extends BaseTask&#xA;{&#xA;    /**&#xA;     * Returns the default description for this task.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Running Primary Task';&#xA;    }&#xA;&#xA;    /**&#xA;     * Gets the total number of steps for this task.&#xA;     *&#xA;     * @return int&#xA;     */&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 2;&#xA;    }&#xA;&#xA;    /**&#xA;     * Runs a task step.&#xA;     *&#xA;     * @param int $step&#xA;     * @return bool&#xA;     */&#xA;    public function runStep($step)&#xA;    {&#xA;        switch ($step)&#xA;        {&#xA;            case 0:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('Products_TestSub1', null, array(&#xA;                    'primaryTaskId' =&amp;gt; $this-&amp;gt;model-&amp;gt;id&#xA;                ));&#xA;            }&#xA;            case 1:&#xA;            {&#xA;                return $this-&amp;gt;runSubTask('Products_TestSub2', null, array(&#xA;                    'subVar' =&amp;gt; $_SESSION['subVar']&#xA;                ));&#xA;            }&#xA;        }&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    public function setPrimaryTaskVar($var)&#xA;    {&#xA;        $_SESSION['subVar'] = $var;&#xA;&#xA;        ProductsPlugin::log('Variable in Primary Task: ' . print_r($_SESSION['subVar'], true));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5203" LastEditorUserId="5203" LastEditDate="2017-09-11T13:03:00.853" LastActivityDate="2017-09-11T13:03:00.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21918" PostTypeId="2" ParentId="21905" CreationDate="2017-09-11T12:27:31.873" Score="2" Body="&lt;p&gt;The problem was resolved by changing the headers set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let form = new FormData(this.form);&#xA;let request = new Request('/', {&#xA;  credentials: 'include',&#xA;  method: 'post',&#xA;  mode: 'same-origin',&#xA;  redirect: 'follow',&#xA;  headers: new Headers({&#xA;    'Accept': '*/*',&#xA;    'X-Requested-With': 'XMLHttpRequest'&#xA;  }),&#xA;  body: form&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of declaring the Content-Type in the request, I set the encoding type on the form itself, this step is optional as the request sets as multipart/form data by default I think.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;..&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2017-09-11T12:27:31.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21919" PostTypeId="1" CreationDate="2017-09-11T12:55:19.463" Score="1" ViewCount="1223" Body="&lt;p&gt;I have an odd problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I render a simple HTML template without any link to the Control Panel, I get the following message on random pages:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An error occurred when rendering a template&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Whenever I change I can't seem the remove this error or find the problem / solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I cannot access the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5755" LastEditorUserId="57" LastEditDate="2017-09-11T18:55:27.453" LastActivityDate="2017-12-28T16:18:16.820" Title="An error occurred when rendering a template" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21920" PostTypeId="1" AcceptedAnswerId="21922" CreationDate="2017-09-11T14:22:36.173" Score="3" ViewCount="656" Body="&lt;p&gt;My client has an online store that we are building with 10 or so products. They will also have a high street store which sells the exact same products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to integrate Craft Commerce with POS (&lt;a href=&quot;https://squareup.com/gb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Squareup&lt;/a&gt; or &lt;a href=&quot;https://www.izettle.com/gb&quot; rel=&quot;nofollow noreferrer&quot;&gt;iZettle&lt;/a&gt; ) software so the stock levels are kept up to date?&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="7160" LastEditDate="2017-09-11T14:30:17.803" LastActivityDate="2018-05-02T12:41:48.660" Title="POS integration with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;integration&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21921" PostTypeId="1" CreationDate="2017-09-11T14:36:44.437" Score="2" ViewCount="402" Body="&lt;p&gt;Using Sprout Forms Plugin, and following the front end &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/front-end-file-uploads&quot; rel=&quot;nofollow noreferrer&quot;&gt;file uploads example&lt;/a&gt;, I'm trying to use the famous &lt;a href=&quot;https://blueimp.github.io/jQuery-File-Upload/&quot; rel=&quot;nofollow noreferrer&quot;&gt;jQuery File Upload plugin&lt;/a&gt; to deal with batch of large files and get upload progression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine, but :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How can I keep the files in a temporary folder before the form is submitted ?&lt;/li&gt;&#xA;&lt;li&gt;When user is a guest, I'm getting a 403 (Forbidden) error after each&#xA;file upload (this happens even using &lt;a href=&quot;https://github.com/craftcms/guest-entries/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries's plugin&lt;/a&gt; from Pixel&amp;amp;Tonic, and with CSRF Protection is disabled) ;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-12-23T18:02:05.450" Title="Temp folder and file upload permissions issue" Tags="&lt;plugin-sproutforms&gt;&lt;upload&gt;&lt;guest-entries&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21922" PostTypeId="2" ParentId="21920" CreationDate="2017-09-11T15:35:16.920" Score="2" Body="&lt;p&gt;It's totally possible. However, since there is no existing plugins for this that is readily available, you'd have to create a custom plugin to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the necessary coding chops, you can get a flying start by generating the boilerplate over at &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, you can hire a programmer in the Craft community to do this for you. Posting in the Craft slack channel #jobs should get you started.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-09-11T15:35:16.920" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21924" PostTypeId="2" ParentId="21899" CreationDate="2017-09-11T19:15:47.290" Score="1" Body="&lt;p&gt;You'll need to loop through all entries first and divide the entries into three arrays. Then using a combination of &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;fixedOrder&lt;/code&gt; you can create three more entries calls to loop through each column and it's entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would make a nice dynamic solution that doesn't need refactoring as more entries are added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#fixedOrder&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries#fixedOrder&lt;/a&gt;&#xA;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#id&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries#id&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7243" LastActivityDate="2017-09-11T19:15:47.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21925" PostTypeId="2" ParentId="21916" CreationDate="2017-09-11T19:27:34.583" Score="1" Body="&lt;p&gt;Somehow you would just need to communicate to your template that you are changing the default limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fairly simple/standard way is through a query string, and then looking for the value of the variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two things you need to accomplish are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setting the query string if someone changes the dropdown box&lt;/li&gt;&#xA;&lt;li&gt;Checking for a value of the query string key in your code.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To set a query string, you could do it a couple of different ways. The easiest way would actually be to submit your form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;grid-show&quot;&amp;gt;&#xA;    &amp;lt;form action=&quot;&quot; method=&quot;get&quot;&amp;gt;&#xA;        &amp;lt;select name=&quot;limit&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;12&quot;&amp;gt;12&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;20&quot;&amp;gt;20&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;50&quot;&amp;gt;50&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; /&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second step involves checking for the value of the query string within your Twig and if it's not set default to 12:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;    section: 'holidayHomes',&#xA;    limit: craft.request.getParam('limit') ?? 12,&#xA;}) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted this to happen via Ajax it would be a bit more involved, but the principle is the same, ie look for a query string variable and use that as your limit.&lt;/p&gt;&#xA;" OwnerUserId="84" LastActivityDate="2017-09-11T19:27:34.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21926" PostTypeId="2" ParentId="16219" CreationDate="2017-09-11T21:52:57.060" Score="1" Body="&lt;p&gt;I ran into a similar issue. The paths that were being inserted for images in the Redactor field were relative, like &lt;em&gt;assets/folder/file.jpg&lt;/em&gt; so in the context of the Craft admin, they were trying to load a path like &lt;em&gt;admin/entries/blog/assets/folder/file.jpg&lt;/em&gt; which obviously wouldn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to fix this by updating the &quot;assetsBaseUrl value in my craft/config/general.php to include a leading slash, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'assetsBaseUrl' =&amp;gt; '/assets'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That forced the admin to reach out to the absolute root location of the assets folder rather than trying to load based on a relative path from somewhere deep inside the admin.&lt;/p&gt;&#xA;" OwnerUserId="7244" LastEditorUserId="7244" LastEditDate="2019-03-03T05:10:58.033" LastActivityDate="2019-03-03T05:10:58.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21927" PostTypeId="1" AcceptedAnswerId="21928" CreationDate="2017-09-11T23:18:25.473" Score="1" ViewCount="120" Body="&lt;p&gt;A client has a Singles entry with a Matrix block defined that contains a few text fields, and one image field. They've created approximately 450 instances of this Matrix block, and can no longer update the page. Craft throws a 500 error. Craft logs just show a basic &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;exception 'Craft\HttpException' in /srv/[clientName]/releases/20170418025256/craft/app/controllers/TemplatesController.php:59&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and nothing of use in the Apache error logs. Anyone have experience with this sort of error, or confidence that this would be a Craft bug?&lt;/p&gt;&#xA;" OwnerUserId="7245" LastEditorUserId="57" LastEditDate="2017-09-11T23:32:29.817" LastActivityDate="2017-09-11T23:32:29.817" Title="Single entry with 450 Matrix blocks throwing error on save" Tags="&lt;matrix&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21928" PostTypeId="2" ParentId="21927" CreationDate="2017-09-11T23:32:09.347" Score="3" Body="&lt;p&gt;Most likely you're bumping into &lt;code&gt;php.ini&lt;/code&gt; limitations.  I'd bump the values of &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.memory-limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;memory_limit&lt;/a&gt;, &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.post-max-size&quot; rel=&quot;nofollow noreferrer&quot;&gt;post_max_size&lt;/a&gt; and &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-input-vars&quot; rel=&quot;nofollow noreferrer&quot;&gt;max_input_vars&lt;/a&gt; and see if that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are common culprits when POSTing large amounts of data (which is what 450 Matrix Blocks would be considered).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-11T23:32:09.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21929" PostTypeId="1" AcceptedAnswerId="22622" CreationDate="2017-09-12T05:44:55.113" Score="1" ViewCount="404" Body="&lt;p&gt;Using Freeform, I am wanting to have a checkbox on a front end form that is not checked by default that posts 'Yes' if checked and 'No' if not checked. I am creating a manual HTML form that works fine for all the other fields, but I can't figure out what to write for the checkbox logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the &lt;a href=&quot;https://solspace.com/craft/freeform/docs/field/#field-checkbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; I know I can set the value in the back end to a default of either 'Yes' or 'No', I have done this and using the following template code but it always sends through the same value of either Yes or No depending on what you set in the back end.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot;&#xA;        name=&quot;{{ receiveContactFromTFA.handle }}&quot;&#xA;        value=&quot;{{ receiveContactFromTFA.value == 'Yes' ? 'Yes' : 'No' }}&quot;&#xA;        {% if receiveContactFromTFA.value == 'Yes' %} checked{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also just tried not having a value attribute at all but again the value defaults to yes because it is set in the back end. I have also tried removing the value entirely and having the following template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot;&#xA;        name=&quot;{{ receiveContactFromTFA.handle }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I do that then then nothing posts. I know a checkbox will normally post a '1' if checked but how do you handle this logic using Freeform to be either 'Yes' or 'No'?&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="57" LastEditDate="2017-09-12T18:26:36.487" LastActivityDate="2017-10-28T08:39:19.833" Title="How to set simple yes/no checkbox using Freeform" Tags="&lt;plugin-freeform&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21930" PostTypeId="1" CreationDate="2017-09-12T09:11:18.417" Score="1" ViewCount="451" Body="&lt;p&gt;I'm basically having this problem &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19754/getting-started-with-order-adjuster-plugin&quot;&gt;Getting started with Order Adjuster plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the file plugins/carbonbalance/carbonBalancePlugin.php containing;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;Craft::import('plugins.carbonbalance.adjusters.carbonBalanceAdjuster');&#xA;&#xA;class CarbonBalancePlugin extends BasePlugin {&#xA;&#xA;    ... usual standard plugin methods ...&#xA;&#xA;    public function init()&#xA;    {       &#xA;    }&#xA;&#xA;    public function commerce_registerOrderAdjusters()&#xA;    {&#xA;        return [&#xA;            new CarbonBalanceAdjuster&#xA;        ];&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in plugins/carbonbalance/adjusters/carbonBalanceAdjuster.php I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Commerce\Adjusters;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class CarbonBalanceAdjuster implements Commerce_AdjusterInterface {&#xA;&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = []){&#xA;&#xA;    $myAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;    return [$myAdjuster];&#xA;&#xA;   }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get the following error message&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Class 'Craft\CarbonBalanceAdjuster' not found&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand this is most likely a naming issue, but I cannot see where I'm going wrong in that respect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;I think I have got past this problem by using;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;    {       &#xA;        //Craft::import('plugins.carbonbalance.adjusters.carbonBalanceAdjuster');&#xA;        require_once('adjusters/carbonBalanceAdjuster.php');&#xA;&#xA;    }&#xA;&#xA;public function commerce_registerOrderAdjusters()&#xA;    {&#xA;        return [&#xA;            new \Commerce\Adjusters\CarbonBalanceAdjuster&#xA;        ];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This appears to load the Adjuster, but shows other errors because I haven't yet completed the adjust method.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2017-09-12T09:35:54.133" LastActivityDate="2017-09-12T18:31:11.910" Title="Problem with Adjuster plugin Class not found" Tags="&lt;plugins&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21931" PostTypeId="2" ParentId="21841" CreationDate="2017-09-12T11:34:33.183" Score="1" Body="&lt;p&gt;in german settings look carefully at the Redactor-Konfiguration , if you select Standardwert it uses Simple.json and not Standard.json.  &lt;/p&gt;&#xA;" OwnerUserId="7097" LastActivityDate="2017-09-12T11:34:33.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21933" PostTypeId="2" ParentId="19459" CreationDate="2017-09-12T13:45:24.423" Score="1" Body="&lt;p&gt;Good solution by Luke,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you are still looking for a query to filter Orders by statuses, here's a working solution : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for pastOrders in craft.commerce.orders.customer(craft.commerce.customer).orderStatus(1).find() %}&#xA;    {{order.id}}&#xA;    {{order.orderStatus.name}}&#xA;{% endfor %}&#xA;&#xA;{% for pendingOrders in craft.commerce.orders.customer(craft.commerce.customer).orderStatus(2).find() %}&#xA;    {{order.id}}&#xA;    {{order.orderStatus.name}}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 1 is the ID of your pasts orders and 2 is the ID of pending order status...&lt;/p&gt;&#xA;" OwnerUserId="7249" LastActivityDate="2017-09-12T13:45:24.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21934" PostTypeId="1" AcceptedAnswerId="21942" CreationDate="2017-09-12T14:28:39.420" Score="1" ViewCount="5070" Body="&lt;p&gt;I have this code that will pull the values of a checkbox or radio from the fields in Craft CMS, do be used and selected by a user on a front end form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for checkboxOption in currentUser.fieldHandle.options %}&#xA;        {% set checked = false %}&#xA;&#xA;        {% if checkboxOption.selected %}&#xA;            {% set checked = true %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;input type=&quot;radio&quot; value=&quot;{{ checkboxOption.value }}&quot; name=&quot;fields[fieldHandle]&quot; {% if checked %} checked=&quot;checked&quot; {% endif %}&amp;gt;&amp;lt;span&amp;gt;{{ checkboxOption.label }}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do the same for a dropdown list?&lt;/p&gt;&#xA;" OwnerUserId="7118" LastEditorUserId="57" LastEditDate="2017-09-12T18:34:47.797" LastActivityDate="2017-09-12T18:55:19.907" Title="How to use Twig to pull drop down menu items for a front end form" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21935" PostTypeId="1" AcceptedAnswerId="21936" CreationDate="2017-09-12T15:07:02.963" Score="1" ViewCount="803" Body="&lt;p&gt;Is it possible to do the following?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'overview' %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;{% elseif entry.type == ['availability', 'specifications', 'sitemap', 'location'] %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;{% else %}&#xA;&#xA;    {{ entry.title }}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the minute it is not returning anything inside the elseif, can anyone spot anything wrong with the logic or is there an alternative method?&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2019-02-10T04:03:32.553" Title="If multiple entry types?" Tags="&lt;conditional&gt;&lt;entry-type&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21936" PostTypeId="2" ParentId="21935" CreationDate="2017-09-12T15:31:12.743" Score="3" Body="&lt;p&gt;You were so close! Instead of asking whether &lt;code&gt;entry.type&lt;/code&gt; is equal to the array (which it isn't), you need to find out whether the value of &lt;code&gt;entry.type&lt;/code&gt; matches one of the array items.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an updated snippet that should work for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'overview' %}&#xA;    {{ entry.title }}&#xA;{% elseif entry.type.handle in ['availability', 'specifications', 'sitemap', 'location'] %}&#xA;    {{ entry.title }}&#xA;{% else %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to recognize that &lt;code&gt;entry.type&lt;/code&gt; is actually an &lt;em&gt;object&lt;/em&gt;. When checking a value using &lt;code&gt;in&lt;/code&gt;, the object's &lt;code&gt;__toString&lt;/code&gt; method will not be invoked. Therefore you'll need explicitly specify &lt;code&gt;entry.type.handle&lt;/code&gt; when testing whether the type is &lt;code&gt;in&lt;/code&gt; an array.&lt;/p&gt;&#xA;" OwnerUserId="5348" LastEditorUserId="45" LastEditDate="2019-02-10T04:03:32.553" LastActivityDate="2019-02-10T04:03:32.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21937" PostTypeId="2" ParentId="21935" CreationDate="2017-09-12T15:46:46.430" Score="2" Body="&lt;p&gt;Maybe off topic, but if you are looking to have a lot of logic based around entry types, maybe its easier to have one template per entry type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set your section to use the template &quot;sectionName/_entry&quot;, that entry can contain the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include['sectionName/' ~ entry.type, 'sectionName/default'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way you can have a template per entry type, with a fallback to default.twig inside the &quot;sectionName&quot; folder (inside your template folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you could have a overview.twig and sitemap.twig etc.&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2017-09-12T15:46:46.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21938" PostTypeId="1" AcceptedAnswerId="21939" CreationDate="2017-09-12T15:49:09.273" Score="1" ViewCount="573" Body="&lt;p&gt;There have been a few updates to the system and some of the plugins I am using. I have installed everything locally and a plugin needed to run new migrations as a result of the update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works great locally, I went to &lt;code&gt;/admin&lt;/code&gt; to &quot;Finish up&quot; the updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have moved the files out to my staging server. I always manually update (even though Craft will do this for me). Once all of the files have deployed, I once again visit &lt;code&gt;/admin&lt;/code&gt; to run the migrations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the database is quite large (&gt; 100MB) and I am getting a &lt;code&gt;504 Gateway timeout error&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to fix this?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-09-12T15:58:06.180" Title="Why is Craft returning a 504 during a system update?" Tags="&lt;updating&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21939" PostTypeId="2" ParentId="21938" CreationDate="2017-09-12T15:52:59.090" Score="1" Body="&lt;p&gt;Because your database is a decent size, your server is exceeding the maximum execution time. That is what is resulting in the 504.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely, you will need to &lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow noreferrer&quot;&gt;disable the auto-update feature&lt;/a&gt; and manually make a backup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/504-gateway-timed-out-error&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check out this article&lt;/a&gt; on how you can trouble shoot this error. (Thanks Brad)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check with your hosting provider to see if they can increase the execution time.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-09-12T15:52:59.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21940" PostTypeId="2" ParentId="21938" CreationDate="2017-09-12T15:58:06.180" Score="2" Body="&lt;p&gt;I've had this issue before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's usually to do with one of two things for me - either the &lt;a href=&quot;https://serverfault.com/questions/500467/apache2-proxy-timeout&quot;&gt;PHP script timeout&lt;/a&gt; value or the &lt;a href=&quot;https://stackoverflow.com/questions/3829403/how-to-increase-the-execution-timeout-in-php&quot;&gt;FPM proxy timeout&lt;/a&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method of fixing this is to change the update settings in the general Craft &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;configuration&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'backupDbOnUpdate' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind though that you will need to back up the database yourself.&lt;/p&gt;&#xA;" OwnerUserId="7250" LastActivityDate="2017-09-12T15:58:06.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21941" PostTypeId="2" ParentId="21930" CreationDate="2017-09-12T18:31:11.910" Score="1" Body="&lt;p&gt;&lt;code&gt;carbonBalanceAdjuster.php&lt;/code&gt; should be &lt;code&gt;CarbonBalanceAdjuster.php&lt;/code&gt; since the name of the class is &lt;code&gt;CarbonBalanceAdjuster&lt;/code&gt; and you're probably on a case-sensitive file system, which is why auto-loading can't find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same goes for your other plugin files as well.  You can use &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; to generate boilerplate plugin code to help avoid case-sensitivity issues like this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-12T18:31:11.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21942" PostTypeId="2" ParentId="21934" CreationDate="2017-09-12T18:55:19.907" Score="0" Body="&lt;p&gt;You'd do something very similar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[fieldHandle]&quot;&amp;gt;&#xA;&#xA;    {% for dropdownOption in currentUser.fieldHandle.options %}&#xA;        &amp;lt;option value=&quot;{{ dropdownOption.value }}&quot;{% if option.selected %} selected{% endif %}&amp;gt;{{ dropdownOption.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-12T18:55:19.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21943" PostTypeId="1" CreationDate="2017-09-12T18:56:06.617" Score="2" ViewCount="153" Body="&lt;p&gt;I'm trying to output a static map from a smart map field in a matrix. I can output a dynamic map with no issues, but the static map code isn't working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = entry.locationsAndNotes %}&#xA;{% set options = {&#xA;    width: 370,&#xA;    height: 208,&#xA;    zoom: 16,&#xA;} %}&#xA;{{ craft.smartMap.img(locations[0], options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url it outputs looks like this: &lt;a href=&quot;https://maps.googleapis.com/maps/api/staticmap?visual_refresh=true&amp;amp;key=myKey&amp;amp;scale=2&amp;amp;center=-48.876667,-123.393333&amp;amp;size=370x208&amp;amp;maptype=roadmap&amp;amp;zoom=16&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://maps.googleapis.com/maps/api/staticmap?visual_refresh=true&amp;amp;key=myKey&amp;amp;scale=2&amp;amp;center=-48.876667,-123.393333&amp;amp;size=370x208&amp;amp;maptype=roadmap&amp;amp;zoom=16&lt;/a&gt;&#xA;Pasted into a browser, i get an error that the API server rejected my request because it is missing the size parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change all of the &lt;code&gt;&amp;amp;amp&lt;/code&gt; to &amp;amp;, an image loads, but it's just a blank blue map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like this should work, since I can render a dynamic map, but I'm not sure if it's an issue with my code, or the plugin, or the api.&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2017-09-12T18:56:06.617" Title="Smart Maps problems displaying static maps" Tags="&lt;plugin-smartmap&gt;&lt;google-maps&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2017-09-12T20:08:18.347" ContentLicense="CC BY-SA 3.0" />
  <row Id="21944" PostTypeId="1" AcceptedAnswerId="21945" CreationDate="2017-09-12T20:21:38.237" Score="1" ViewCount="35" Body="&lt;p&gt;I would love to be able to show another column inside Entries type field. Specifically, Image field. Basically,the same functionality as on the Entries list. Is there a plugin or another way of implementing this.&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-09-12T20:49:02.253" Title="Is it possible to display another column in Entries type field?" Tags="&lt;control-panel&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21945" PostTypeId="2" ParentId="21944" CreationDate="2017-09-12T20:49:02.253" Score="2" Body="&lt;p&gt;Nope, not out of the box – but being able to display fields in addition to the entry title for selected entries being displayed in an Entries field, in an easy-to-use interface like the Customizable Element Index, sounds like &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;a killer feature request&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, your best (albeit not super &lt;em&gt;easy&lt;/em&gt;, I suspect) bet would be to &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a custom plugin&lt;/a&gt; that adds a custom &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;FieldType&lt;/a&gt; extending the &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/EntriesFieldType&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntriesFieldType&lt;/a&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By overriding &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/fieldtypes/BaseElementFieldType.php#L52&quot; rel=&quot;nofollow noreferrer&quot;&gt;the BaseElementFieldType's &lt;code&gt;$inputTemplate&lt;/code&gt;&lt;/a&gt; property (i.e. by adding an &lt;code&gt;$inputTemplate&lt;/code&gt; property to &lt;em&gt;your&lt;/em&gt; custom FieldType's class, pointing to a different template) you might be able to display entries in a different manner compared to the vanilla Entries field.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-12T20:49:02.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21946" PostTypeId="2" ParentId="20596" CreationDate="2017-09-12T21:21:54.957" Score="1" Body="&lt;p&gt;Whenever you submit forms to Craft, your &lt;code&gt;name&lt;/code&gt; attribute must be formatted in a certain way by adding your values to a &lt;code&gt;fields[]&lt;/code&gt; array. In your case, the field should look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[nomDocumentEfficy]&quot; value=&quot;my_value&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this happening if you ever inspect a form field inside an entry in the CMS, or if you inspect the output generated by amforms' tags you're using: &lt;code&gt;{{ form.displayField('email') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, &lt;em&gt;not all form field types get added to this array the same as a simple &lt;code&gt;text&lt;/code&gt; or &lt;code&gt;hidden&lt;/code&gt; field!&lt;/em&gt; For reference on how to format &lt;code&gt;checkbox&lt;/code&gt; fields, &lt;code&gt;date&lt;/code&gt; fields, or even Matrix fields, for example, you can reference this great guide on &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;StraightUpCraft&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-12T21:21:54.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21948" PostTypeId="2" ParentId="20303" CreationDate="2017-09-12T22:03:05.540" Score="1" Body="&lt;p&gt;I'm confused by what you mean by &quot;output&quot;. Do you mean: how do you write custom HTML for checkboxes or radio buttons and have them submit to amforms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, you need to understand the &lt;code&gt;name&lt;/code&gt; attribute always needs a &lt;code&gt;fields[]&lt;/code&gt; array. &lt;strong&gt;&lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;StraightUpCraft&lt;/a&gt;&lt;/strong&gt; has a great rundown of how all field types' name attributes should be formatted in order to submit to Craft, no matter if you're using amforms, Sprout, or whatever.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Radio Buttons&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Radio buttons are a &quot;single option field&quot;, meaning that when the form submits, only one value goes through. Your code should look like this (&lt;em&gt;I stripped out some of the unnecessary markup&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Choose an option&#xA;    &amp;lt;input type=&quot;radio&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;Option 1&quot;&amp;gt; Option 1&#xA;    &amp;lt;input type=&quot;radio&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;Option 2&quot;&amp;gt; Option 2&#xA;    &amp;lt;input type=&quot;radio&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;Option 3&quot;&amp;gt; Option 3&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Checkboxes&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Checkboxes are &quot;multi option fields&quot;, meaning that when the form submits, any number of values can go through, so you need to submit them a bit differently:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Choose your class type&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldHandle]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[fieldHandle][]&quot; value=&quot;Option 1&quot;&amp;gt; Option 1&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[fieldHandle][]&quot; value=&quot;Option 2&quot;&amp;gt; Option 2&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[fieldHandle][]&quot; value=&quot;Option 3&quot;&amp;gt; Option 3&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pay close attention to each &lt;code&gt;input&lt;/code&gt; having an extra &lt;code&gt;[]&lt;/code&gt; at the end and the &lt;code&gt;hidden&lt;/code&gt; input that collects all their values into a final array.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;One very important note&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You &lt;em&gt;absolutely&lt;/em&gt; need to make sure the values of each input you have in the HTML equal the values you created in the CMS when you created the field. This includes capitalization and spaces.  So if your checkbox field in the CMS, for example, had a handle of &lt;code&gt;breakfast&lt;/code&gt;, and each option's Label/Value was set like &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;French Toast | &lt;code&gt;French Toast&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ham n' Eggs  | &lt;code&gt;ham-n-eggs&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Corn Flakes  | &lt;code&gt;c0rnFlaaaake$$&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;then your input values need to match &lt;em&gt;exactly&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;Breakfast Options:&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[breakfast]&quot; value=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[breakfast][]&quot; value=&quot;French Toast&quot;&amp;gt; Option 1 (this text can be anything)&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[breakfast][]&quot; value=&quot;ham-n-eggs&quot;&amp;gt; Option 2&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[breakfast][]&quot; value=&quot;c0rnFlaaaake$$&quot;&amp;gt; Option 3&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft's expecting these to line up, and if they don't, then either these fields' values will be ignored on submit or, if the field is set to required in the CMS, you'll get a back-end validation error.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-12T22:03:05.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21949" PostTypeId="2" ParentId="16753" CreationDate="2017-09-12T22:26:42.517" Score="1" Body="&lt;p&gt;I know I'm a bit late to this, but I think it's because your &lt;code&gt;{{ loop.index }}&lt;/code&gt; is not &lt;strong&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;0-indexed&lt;/a&gt;&lt;/strong&gt;, which is necessary for the array.  It should look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[selections][{{ loop.index0 }}][col1]&quot; value=&quot;{{ item.qty }} x {{ item.description }}&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need an extra valueless &lt;code&gt;hidden&lt;/code&gt; field above the loop to collect all the values into one array:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[selections]&quot; value=&quot;&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a fuller example on how to format the HTML for all fields of all types on this &lt;strong&gt;&lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;StraightUpCraft&lt;/a&gt;&lt;/strong&gt; page.  Scroll to the very bottom for tables.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-12T22:26:42.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21950" PostTypeId="2" ParentId="19438" CreationDate="2017-09-12T22:54:56.210" Score="2" Body="&lt;p&gt;Because radio inputs are a &quot;single value field&quot;, meaning that when the form submits, only one value actually goes through, you don't need the extra &lt;code&gt;[]&lt;/code&gt; array brackets at the end of each &lt;code&gt;fields[]&lt;/code&gt; array.  In fact, you don't even need the hidden field above it.  That setup would work for checkboxes, where any number of values could be submitted. A great reference for how to format HTML form fields correctly to submit to Craft can be found on this &lt;strong&gt;&lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;StraightUpCraft&lt;/a&gt;&lt;/strong&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your code should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;radio&quot; value=&quot;yes&quot; name=&quot;fields[areYouBeekeeper]&quot; {%- if account is defined %}value=&quot;{{ account.areYouBeekeeper }}&quot;{% endif -%}&amp;gt;Yes&#xA;&amp;lt;/label&amp;gt;&#xA;&amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;radio&quot; value=&quot;no&quot; name=&quot;fields[areYouBeekeeper]&quot; {%- if account is defined %}value=&quot;{{ account.areYouBeekeeper }}&quot;{% endif -%}&amp;gt;No&#xA;&amp;lt;/label&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the &lt;code&gt;input&lt;/code&gt; values &lt;code&gt;yes&lt;/code&gt; and &lt;code&gt;no&lt;/code&gt; need to be exactly the same (lowercase in this case) as they are in the &lt;strong&gt;Values&lt;/strong&gt; column of the respective custom radio field created in the CMS.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-12T22:54:56.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21951" PostTypeId="1" AcceptedAnswerId="21994" CreationDate="2017-09-13T01:05:49.470" Score="1" ViewCount="129" Body="&lt;p&gt;I created a Profile structure for my client's employees. He asked if I could generate an email signature for them from their Profile. I figured out a way to put all the signatures on one page using a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('profiles') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;loop on a single page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is there a way to give each person their own page for an email signature? &lt;code&gt;/PROFILE/email-signature&lt;/code&gt; that pulls content from the profile. I want this to update dynamically as he adds/removes employees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I create a secondary template for the profiles for an email-signature?&lt;/p&gt;&#xA;" OwnerUserId="7190" LastEditorUserId="4433" LastEditDate="2017-09-15T02:38:15.610" LastActivityDate="2017-09-15T21:24:58.367" Title="Secondary Template for Structure" Tags="&lt;templating&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21952" PostTypeId="2" ParentId="21929" CreationDate="2017-09-13T02:32:21.247" Score="2" Body="&lt;p&gt;I don't think this has anything to do with your code, and actually appears to be a bug in Freeform itself, where the Submission object and email notifications are showing the value as whatever the default is set to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a note about this issue and we'll have it corrected shortly. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-09-13T02:32:21.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21953" PostTypeId="1" AcceptedAnswerId="21963" CreationDate="2017-09-13T06:57:01.220" Score="0" ViewCount="50" Body="&lt;p&gt;I have a site that I've created a 'Generic Page' type for that is a Structured type with URL Format of {slug}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is great for the client as they can create an entry for 'toplevelpage' and then children e.g. 'toplevelpage/firstchild' and the URL structure works as desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a few places, they have custom pages that are not Structured type 'Generic Page' entries but need to sit in that same site URL structure. For example, toplevelpage/fistchild is a 'Generic Page' but they need a toplevelpage/customchild but the parent URL is now owned by the Structured type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I get Craft or Twig to look for Singles or even Twig magic at that level and then just have a stub structured Generic Page that has is content overwritten?&lt;/p&gt;&#xA;" OwnerUserId="7253" LastEditorUserId="57" LastEditDate="2017-09-13T17:18:58.337" LastActivityDate="2017-09-13T19:53:03.160" Title="Replacing content a specific URL/page already reserved in Structured Data Entries" Tags="&lt;url&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21954" PostTypeId="1" CreationDate="2017-09-13T07:41:36.643" Score="3" ViewCount="130" Body="&lt;p&gt;I have 2 Main Groups of Categories, which themselves have Sub-Categories.&lt;br&gt;&#xA;The Categories you see have checkboxes to filter entries below.&lt;br&gt;&#xA;One Sub-Group has also Children (With Material/ Without Material) -&gt;Screenshot.&lt;br&gt;&#xA;I need to collapse these two groups (on click they open/close).&lt;br&gt;&#xA;&lt;strong&gt;How can i target these Sub-sub-Category Groups?&lt;/strong&gt;&lt;br&gt;&#xA;Right now i use:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% ifchildren %}&#xA; &amp;lt;ul class=&quot;subcategory-list&quot;&amp;gt;&#xA;   {% children %}&#xA; &amp;lt;/ul&amp;gt;&#xA;{% endifchildren %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KvuOa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KvuOa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried some with siblings but cannot get it to work. I also need to add extra html fot the arrow to indicate the collapse and to open the sublist.&lt;br&gt;&#xA; If i add it right now, it gets added to all category-groups.&lt;br&gt;&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6734" LastEditorUserId="6734" LastEditDate="2017-09-13T09:37:52.270" LastActivityDate="2017-09-14T02:42:43.093" Title="How to target Sub-Category of Sub-Category" Tags="&lt;category&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21955" PostTypeId="2" ParentId="14323" CreationDate="2017-09-13T10:14:24.453" Score="1" Body="&lt;p&gt;If you create a new UserModel then you will, as you have found, also need to set the username, password etc. as you effectively creating a blank model then filling it in and saving over the existing user's details (since you set the same ID).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This runs the risk of overwriting other custom data, resetting the password, removing group permissions etc. If ever you add a new custom profile field, you must also remember to update your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you don't need to create a new UserModel as you are already making one when you use;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUser();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a UserModel, already populated with the user's details.&#xA;So you only need to update the custom field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this instead;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;$user-&amp;gt;getContent()-&amp;gt;mycustomfield = 'my custom value';&#xA;$success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;if (!craft()-&amp;gt;users-&amp;gt;saveUser($user))&#xA;{&#xA;    $errors = $user-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-09-13T10:14:24.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21956" PostTypeId="1" CreationDate="2017-09-13T10:22:19.633" Score="1" ViewCount="37" Body="&lt;p&gt;I have an SVG file in my plugins resources, I'd like to use the asset in the front end.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ resourceUrl('cocktailrecipes/images/gin.svg') }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems using the &lt;a href=&quot;https://craftcms.com/docs/plugins/resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;resourceURL()&lt;/a&gt; only allows a select few image types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to extend the permitted image types to include '.svg'?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="57" LastEditDate="2017-09-13T17:43:23.347" LastActivityDate="2017-09-13T17:43:23.347" Title="Requesting SVGs from a plugins resources directory doesn't work" Tags="&lt;plugins&gt;&lt;resources&gt;&lt;svg&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21957" PostTypeId="1" AcceptedAnswerId="21962" CreationDate="2017-09-13T14:05:08.667" Score="1" ViewCount="29" Body="&lt;p&gt;I'm working on a new build of a site with a new database, I think that copying the plugin folder will not carry over the analytics statistics, are there database entries that I need to copy over?&lt;/p&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="6007" LastEditDate="2019-02-25T15:03:50.607" LastActivityDate="2019-02-25T15:03:50.607" Title="Transfer Dukt Analytics to new build" Tags="&lt;plugins&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21958" PostTypeId="1" AcceptedAnswerId="21965" CreationDate="2017-09-13T14:36:16.323" Score="1" ViewCount="207" Body="&lt;p&gt;I am using Contact Form v1.9.0 with latest version of Craft.&#xA;I've additional fields to the form so that the inputted values appear in the email message. However, the only field being sent within the message is the &lt;code&gt;message[body]&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A link to a gist of my form code is below:&#xA;&lt;a href=&quot;https://gist.github.com/anonymous/f380c316ad14864aed7aa95dbb2cafc8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/anonymous/f380c316ad14864aed7aa95dbb2cafc8&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using jquery to copy and replace the value of &lt;code&gt;fromName&lt;/code&gt; and &lt;code&gt;fromEmail&lt;/code&gt;, which you'll see are hidden fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This exact form has been used on numerous sites in the past few months, using Contact Form 1.8.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on why those additional fields aren't being attached to the email message?&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2017-09-13T20:28:56.667" Title="Additional Fields aren't sent within Contact Form email" Tags="&lt;form&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21959" PostTypeId="2" ParentId="21956" CreationDate="2017-09-13T15:39:05.127" Score="1" Body="&lt;p&gt;Actually, the &lt;a href=&quot;https://craftcms.com/classreference/helpers/UrlHelper#getResourceUrl-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;resourceUrl()&lt;/code&gt;&lt;/a&gt; method doesn't care about the resource file's extension and is able to serve up SVGs (and any other filetype) just fine, so there must be something else wrong. Most likely, the path (i.e. &lt;code&gt;cocktailrecipes/images/gin.svg&lt;/code&gt;) to the file isn't correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your plugin has the handle &lt;code&gt;cocktailrecipes&lt;/code&gt; (all lowercase; the handle should be identical to your plugin's folder under &lt;code&gt;/craft/plugins&lt;/code&gt;), for your particular example Craft will expect to find your file under &lt;code&gt;/craft/plugins/cocktailrecipes/resources/images/gin.svg&lt;/code&gt; – first thing to check, is if that file is actually in that location.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-13T15:39:05.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21960" PostTypeId="2" ParentId="21958" CreationDate="2017-09-13T16:00:10.387" Score="1" Body="&lt;p&gt;I'm not 100% sure it's this, but you've got a couple of fields with spaces in their names:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;message[First Name] &#xA;message[Last Name]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd probably get rid of those spaces or at least enclose them in quotes first, see if that improves things. Other than that I couldn't spot anything obvious. &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-09-13T16:00:10.387" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21961" PostTypeId="1" CreationDate="2017-09-13T17:56:41.887" Score="1" ViewCount="177" Body="&lt;p&gt;I have a section of 'deals/coupons' with custom startDate and endDate.  These are needed so the client can load up a bunch of deals but only have them render to the page when a particular deal is 'active'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below syntax works to not show any deal before it's startdate has passed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;   section : 'dealDirectory',&#xA;   limit   : pageSize,&#xA;   startDate : '&amp;lt;=' ~ now&#xA;}) as pageInfo, dealEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And using the below code I can prevent deals from showing after their enddate but only if enddate has data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;   section : 'dealDirectory',&#xA;   limit   : pageSize,&#xA;   startDate : '&amp;lt;=' ~ now&#xA;   endDate : '&amp;gt;=' ~ now&#xA;}) as pageInfo, dealEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If enddate does not have a value it eliminates those entries from showing.  I need to find a way to check if enddate is greater than now OR is null so that it will continue to show deals that do not have an enddate. Such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;   section : 'dealDirectory',&#xA;   limit   : pageSize,&#xA;   startDate : '&amp;lt;=' ~ now&#xA;   endDate   : '&amp;gt;= ' ~ now ~ 'or is null'  // but this syntax incorrect&#xA;}) as pageInfo, dealEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having a hard time finding a reference for this type of markup.&lt;/p&gt;&#xA;" OwnerUserId="7102" LastActivityDate="2017-09-14T01:46:41.113" Title="How to check for a value OR NULL on custom enddate field using yii syntax when calling entries?" Tags="&lt;entry&gt;&lt;custom-field&gt;&lt;null&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21962" PostTypeId="2" ParentId="21957" CreationDate="2017-09-13T18:25:27.427" Score="0" Body="&lt;p&gt;Doesn't look like Dukt Analytics has any tables it creates in the database, but it does require Dukt OAuth, which creates a &lt;code&gt;craft_oauth_providers&lt;/code&gt; table and a &lt;code&gt;craft_oauth_tokens&lt;/code&gt; table you could move over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of the plugin save their plugin settings in the &lt;code&gt;craft_plugins&lt;/code&gt; table, so you might want to move their rows over as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-13T18:25:27.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21963" PostTypeId="2" ParentId="21953" CreationDate="2017-09-13T19:53:03.160" Score="1" Body="&lt;p&gt;First off, for communication reasons, let's refer to the &quot;Structure&quot; as a section, not a page type. Anytime you create either a Channel or Structure section, you have the ability to create what are called &quot;entry types&quot;.  You will see them listed on the far right of Settings &gt; Sections in Craft.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The Solution in a nutshell&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;In your case, you will want to create a new &lt;strong&gt;Entry Type&lt;/strong&gt; in your Structure to accommodate this custom deviant page, which will allow you to choose different fields for that type and its own template for its own custom code.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;What is an &quot;Entry Type&quot;?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Ok, so what is an Entry Type?  You know when you go to post a status on facebook and you have the ability to just write text, or you could choose to upload an image, or you might want to check in?  All of these different types of status posts may share the same fields (like the text field to post your status), but some have additional or completely different fields (like uploading an image), but they are all &quot;&lt;em&gt;Status Posts&lt;/em&gt;&quot; to Facebook, just different types of status posts.  This is a &lt;em&gt;very&lt;/em&gt; over-simplified example, I know, but it's kind of what Entry Types in Craft are for a Channel or Structure.  They're like an inherent built-in category group that allow you to design different custom field layouts for different types of entries within that one Channel or Structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you make a Structure called &quot;Generic Pages&quot;, you could then create different entry types in that Structure like &quot;Single Column&quot;, &quot;With Sidebar&quot;, &quot;Top Banner&quot;, etc, and they can all get their own custom field setup with their own templates.  Or you could just use one template for them all. I've created Events channels before using things like &quot;Event&quot;, &quot;Concert&quot;, &quot;Party&quot;, &quot;Meetup&quot;, etc as the different types.  When I create a new entry in the &quot;Events&quot; channel, I then choose which &lt;em&gt;type&lt;/em&gt; of event it is, and by doing so, I'm able to customize which type gets which fields.  They all have a &quot;Start Date&quot; field, but maybe the &quot;Concert&quot; type has a &quot;Door Price&quot; field, whereas &quot;Meetup&quot; doesn't. This way you don't have a confusing &quot;Door Price&quot; field for &quot;Meetup&quot; events that shouldn't be or don't need to be filled in.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Templating&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Ok, so how do we handle this in the templates? When you create the section in Craft, you'll point to whatever template you want for the section as a whole (let's say &lt;code&gt;/generic-pages/_entry&lt;/code&gt; for example).  In that &lt;code&gt;_entry&lt;/code&gt; template, add just this line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% include &quot;generic-pages/&quot; ~ entry.type %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then inside the &lt;code&gt;/generic-pages/&lt;/code&gt; directory, you create a different template for each entry type you made in Craft.  Name that template exactly how the handle looks like.  So if you made a &quot;Single Column&quot; entry type and the handle is &lt;code&gt;singleColumn&lt;/code&gt;, then &quot;singleColumn.html&quot; is the name of your template.  Customize that template all you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a proper article on Craft's site talking about this method:&#xA;&lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entry-type-templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you're using one template for all entries in this Structure/Channel regardless of entry type, you can still be selective with how you grab your entries like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('genericPages').type('singleColumn') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or be conditional based on type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.type == 'concert' %}&#xA;    // do something&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Read more about Entry Types in the Craft Docs: &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/sections-and-entries#entry-types&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-13T19:53:03.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21964" PostTypeId="2" ParentId="16348" CreationDate="2017-09-13T20:04:06.800" Score="1" Body="&lt;p&gt;In regards to the includeCssFile issue, I was able to get siteUrl to work by using &lt;code&gt;{% includeCssFile siteUrl~&quot;css/application.css&quot; %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7257" LastActivityDate="2017-09-13T20:04:06.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21965" PostTypeId="2" ParentId="21958" CreationDate="2017-09-13T20:28:56.667" Score="2" Body="&lt;p&gt;This issue is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;message&quot; name=&quot;message[body]&quot; cols=&quot;30&quot; rows=&quot;6&quot; placeholder=&quot;Questions or Comments&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're defining &lt;code&gt;name&lt;/code&gt; twice.  The 2nd one gets ignored (which is required if you're using the array syntax for other fields).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-13T20:28:56.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21966" PostTypeId="1" CreationDate="2017-09-13T21:46:29.970" Score="2" ViewCount="159" Body="&lt;p&gt;I have a smart map where I'm trying to use linked SVG files for the marker icons. In Safari, the files load at actual size, which in this case is fine, but in Chrome and Edge, they are scaled up, and in Firefox and IE, they don't show up at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried setting a size using marker options, but it looks like that doesn't support google.maps.MarkerLabel properties:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    markerOptions: {&#xA;        scaledSize: 'new google.maps.Size(50,50)',&#xA;    },&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I replace the SVG icon with PNGs, they work fine in all browsers.&#xA;Is there a different way to specify the icon size/path for SVGs?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="323" LastEditDate="2017-09-13T21:57:01.640" LastActivityDate="2021-01-01T06:56:27.333" Title="Smart Map with linked SVG icons for markers" Tags="&lt;plugin-smartmap&gt;&lt;svg&gt;&lt;google-maps&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21967" PostTypeId="2" ParentId="19949" CreationDate="2017-09-13T21:51:22.003" Score="1" Body="&lt;p&gt;I didn't understand Ben's answer, and I just needed to output an entry's SEO meta title with a fallback to the entry title in a &lt;code&gt;for&lt;/code&gt; loop. Maybe this will help someone in a similar situation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% if entry.sproutSeoElementMetadata.title %}&#xA;        {% set title = entry.sproutSeoElementMetadata.title %}&#xA;    {% else %}&#xA;        {% set title = entry.title %}&#xA;    {% endif %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Just like &lt;code&gt;entry.sproutSeoElementMetadata.title&lt;/code&gt; will grab the meta title of that entry, you can do the same with description: &lt;code&gt;entry.sproutSeoElementMetadata.description&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The meta image is a bit more complicated though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get meta image's asset id #}&#xA;{% set imageId = entry.sproutSeoElementMetadata.ogImage %}&#xA;&#xA;{# get the actual asset image by its id #}&#xA;{% set image = craft.assets.id(imageId).first %}&#xA;&#xA;{# output the image's url #}&#xA;{{ image.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2017-09-15T21:00:38.717" LastActivityDate="2017-09-15T21:00:38.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21968" PostTypeId="1" CreationDate="2017-09-13T22:32:20.807" Score="2" ViewCount="41" Body="&lt;p&gt;I have this line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('x') etc etc %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which I use to pull data for a header in my _layout.html template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then later, knowing I am done with the array, inside a block in an another template which extends _layout I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('y') etc etc %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In fact I have reused the 'entries' name regularly through many templates and a number of sites and haven't, as far as I know, had a problem, except in one case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case if the cache has just been cleared (manually at least) then the second setting of entries does not work and it contains the values from the first set, mucking up the page of course. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On reloading the page, and subsequently until the cache is cleared manually every thing works as expected (although I don't know what happens when the cache automatically clears as I am never sure when that has just happened).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was an easy fix just to change 'entries' to 'whatevers' in the second line, and where it is referred to in the rest of the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it bad practice to do what I have done (before the change), or is it likely that there is another error in my code that is causing this problem?&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2017-09-13T23:41:51.013" Title="Is it bad practice to re-use array variable name?" Tags="&lt;templating&gt;&lt;set&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21969" PostTypeId="2" ParentId="21968" CreationDate="2017-09-13T23:41:51.013" Score="3" Body="&lt;p&gt;There's no problem re-using a variable name from a technical point of view. There is likely a problem elsewhere in your code.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-13T23:41:51.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21970" PostTypeId="1" CreationDate="2017-09-14T00:30:29.540" Score="1" ViewCount="284" Body="&lt;p&gt;I just moved my Craft CMS site to production (MediaTemple DV) and I can't upload images to my asset sources. I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error uploading the file: there was a problem creating the temporary path.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked (and fixed) the asset source paths but I still get the error.&#xA;I guess I need to change permissions on some directory, but which one? I don't know where this 'temporary path' is supposed to be created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I diagnosed the error correctly? If so, where should that path be created?&lt;/p&gt;&#xA;" OwnerUserId="5200" LastActivityDate="2017-09-14T00:30:29.540" Title="For asset uploads, where should the 'temporary path&quot; be created?" Tags="&lt;assets&gt;&lt;permissions&gt;&lt;filesystem&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21971" PostTypeId="2" ParentId="21961" CreationDate="2017-09-14T01:46:41.113" Score="1" Body="&lt;p&gt;Shooting in the dark here, but looking off &lt;a href=&quot;https://craftcms.stackexchange.com/a/415/4433&quot;&gt;this ticket&lt;/a&gt; and the ECM &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;parameter value syntax in the docs&lt;/a&gt;, could you do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;    section : 'dealDirectory',&#xA;    limit   : pageSize,&#xA;    startDate : '&amp;lt;=' ~ now&#xA;    endDate: 'or', '&amp;gt;= ' ~ now, 'not null'&#xA;}) as pageInfo, dealEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;or&lt;/code&gt; is a total guess based on the &lt;code&gt;and&lt;/code&gt; in the other ticket.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-14T01:46:41.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21972" PostTypeId="1" CreationDate="2017-09-14T02:05:30.373" Score="1" ViewCount="611" Body="&lt;p&gt;I have a number of entries that all belong under a Channel that I created. Each entry has a category field where the user can select one or many categories to associate the entry with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am displaying these entries on my page, but would like to display each entry under the appropriate category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, my entries are currently displayed like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1 (Category A)&lt;/li&gt;&#xA;&lt;li&gt;Entry 2 (Category C)&lt;/li&gt;&#xA;&lt;li&gt;Entry 3 (Category A)&lt;/li&gt;&#xA;&lt;li&gt;Entry 4 (Category B)&lt;/li&gt;&#xA;&lt;li&gt;Entry 5 (Category A)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want it to display like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1 (Category A)&lt;/li&gt;&#xA;&lt;li&gt;Entry 3 (Category A)&lt;/li&gt;&#xA;&lt;li&gt;Entry 5 (Category A)&lt;/li&gt;&#xA;&lt;li&gt;Entry 4 (Category B)&lt;/li&gt;&#xA;&lt;li&gt;Entry 2 (Category C)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What's the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="6512" LastEditorUserId="4433" LastEditDate="2017-09-15T00:11:18.667" LastActivityDate="2017-09-15T00:11:18.667" Title="List entries by category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21973" PostTypeId="2" ParentId="21972" CreationDate="2017-09-14T02:22:34.753" Score="1" Body="&lt;p&gt;This will exclude empty categories, meaning they don't have any entries associated with them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('channelHandle').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).group('categoryGroupHandle') %}&#xA;&#xA;{% for category in categories %}&#xA;    &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% set entries = craft.entries.section('channelHandle').relatedTo(category) %}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-14T02:22:34.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21974" PostTypeId="2" ParentId="21954" CreationDate="2017-09-14T02:42:43.093" Score="3" Body="&lt;p&gt;I'm not sure, but I think you might need to use &lt;code&gt;level&lt;/code&gt; in your loop. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('groupHandle').level(3) %}&#xA;&#xA;{% for category in categories %}&#xA;    // etc&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have a look at the docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories#level&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.categories#level&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-14T02:42:43.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21975" PostTypeId="1" CreationDate="2017-09-14T07:22:42.133" Score="0" ViewCount="130" Body="&lt;p&gt;I'm trying to get a list of entries of a certain section, however I'd like to exclude certain users that are defined within a field of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The users to exclude from the query are fetched like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exclude_users = entry.winners_exclude %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, what I'm trying to do is to exclude the users in the&lt;code&gt;exclude_users&lt;/code&gt;-array from being returned with the query results, something like the following (which does obviously not work, but you might get the idea of what I'm trying:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('bildupload').author(not in exclude_users).search('challengeId:' ~ch.id).order('likecounter desc').limit(3).with(['useruploads']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Specifically I'm talking about the &lt;code&gt;.author(not in exclude_users)&lt;/code&gt; part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't really find anything on the question if that is at all possible within the elementCriteriaModel query itself. It works with an additional if-condition within the for-loop, however since the elementCriteriaModel needs to be &lt;code&gt;.limit&lt;/code&gt;(ed) to 3 but needs to exclude some users, excluding them within the loop after limiting the result to the first 3 results obviously results not in what I want, since it will just exclude the users from the first 3 results.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="57" LastEditDate="2017-09-14T15:13:08.793" LastActivityDate="2017-09-14T15:13:08.793" Title="Exclude entries by array of authors from ElementCriteriaModel" Tags="&lt;search&gt;&lt;elementcriteriamodel&gt;&lt;filter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21976" PostTypeId="1" AcceptedAnswerId="22005" CreationDate="2017-09-14T07:28:34.147" Score="1" ViewCount="101" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a site that has frontend registration with some custom fields. The client would like to have a notification email whenever someone activates their account, containing the info on that user (so name, email and the custom fields). &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue at hand:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, I'm getting the following error when I try to send an HTML email on the 'onActivateUser': &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to find the template “_emails/customer-service-notification”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If however I try to send a plain text email, it all goes without problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer to send out an HTML email so I'd like to resolve this. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I already tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Triggering the service function in another way (via custom controller action) sends the html email just fine&lt;/li&gt;&#xA;&lt;li&gt;Sending the mail by just setting the content as string in the function works just fine&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Main plugin file - init function&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onActivateUser', function (Event $event){&#xA;    $user = $event-&amp;gt;params['user'];&#xA;    craft()-&amp;gt;plugin_customerServiceNotification-&amp;gt;sendNotificationMail($user);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;customerServiceNotification&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sendNotificationMail(UserModel $user){&#xA;    $mailer = craft()-&amp;gt;email;&#xA;    $mailToBeSent = new EmailModel();&#xA;&#xA;    $mailToBeSent-&amp;gt;subject = Craft::t('Nieuwe gebruiker geregistreerd');&#xA;    $mailToBeSent-&amp;gt;fromName = 'xyz';&#xA;    $mailToBeSent-&amp;gt;sender = 'noreply@xyz.be';&#xA;&#xA;    $mailToBeSent-&amp;gt;toEmail = 'xyz@xyz.be';&#xA;&#xA;    $content = craft()-&amp;gt;templates-&amp;gt;render(&#xA;        '_emails/customer-service-notification',&#xA;        [&#xA;            'userInfo' =&amp;gt; [&#xA;                'email' =&amp;gt; $user-&amp;gt;email,&#xA;                'name' =&amp;gt; $user-&amp;gt;fullName,&#xA;            ],&#xA;        ]&#xA;    );&#xA;    $mailToBeSent-&amp;gt;htmlBody = $content;&#xA;&#xA;    $mailer-&amp;gt;sendEmail($mailToBeSent);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Folder structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qei8H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qei8H.png&quot; alt=&quot;Folder structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2017-09-15T05:57:35.543" LastActivityDate="2017-09-15T18:42:24.657" Title="Error when trying to send HTML email on event onActivateUser" Tags="&lt;plugin-development&gt;&lt;emails&gt;&lt;events&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21977" PostTypeId="2" ParentId="21975" CreationDate="2017-09-14T08:46:51.140" Score="1" Body="&lt;p&gt;Have you tried building your excluded list like this &lt;code&gt;['and', 'not user1', 'not user2']&lt;/code&gt; ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I know syntax like that works for excluding sections in search results. Below is how I excluded certain sections from search results. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% paginate craft.entries.section(['and', 'not services', 'not solutions']).search(query).limit(settings.postsPerPage) as pageInfo, entries %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-09-14T08:46:51.140" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21978" PostTypeId="2" ParentId="21975" CreationDate="2017-09-14T09:20:50.967" Score="2" Body="&lt;p&gt;Iterating on Michael's answer: build an array of users to exclude, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludeArray = null %}&#xA;{% for user in entry.winners_exclude %}&#xA;    {% if loop.first %}{% set excludeArray = ['and'] %}{% endif %} {# only set this array if exclude users exist #}&#xA;    {% set excludeArray = excludeArray |merge(['not ' ~ user.id]) %}&#xA;{% endfor %}&#xA;&#xA;{# check if users should be excluded, I'm not sure what happens if you'd do .author(null) #}&#xA;{% if excludeUsers %}&#xA;    {% paginate craft.entries.section('bildupload').author(excludeUsers) %}&#xA;{% else %}&#xA;    {% paginate craft.entries.section('bildupload') %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2017-09-14T09:20:50.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21979" PostTypeId="1" AcceptedAnswerId="21987" CreationDate="2017-09-14T10:04:25.330" Score="1" ViewCount="82" Body="&lt;p&gt;I have a website with 2 locales set up, and have an entry that has content in both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I &lt;code&gt;Save as a new entry&lt;/code&gt;, Craft only saves the locale that is open at the time, and then copies that same content to the other locale, instead of copying the original localised content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I end up having one entry with the same content on both locales, instead of having an exact copy of the previous entry (with different content in the 2 locales)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug, a normal behaviour or am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="5500" LastActivityDate="2017-09-14T15:29:44.143" Title="Save as a new entry doesn't seem to copy all locales" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21982" PostTypeId="1" AcceptedAnswerId="21997" CreationDate="2017-09-14T13:29:52.217" Score="2" ViewCount="486" Body="&lt;p&gt;I've &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20800/nested-categories-in-url-slug&quot;&gt;asked already&lt;/a&gt; about nested categories here, but I've just upgraded to Craft 3 and things seem to have changed a little.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three top-level category groups:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Home&#xA;- About&#xA;- Funding&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each of these has multiple categories, and some of these categories are nested up to three levels deep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem: the nested category URIs don't include the category group (which I appreciate doesn't have its own slug). Instead I get stuff like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/cat-A/subcat-1/&#xA;/cat-B/subcat-2/subcat-6/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... when what I want is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;about/cat-A/subcat-1/&#xA;funding/cat-B/subcat-2/subcat-6/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I manually add &lt;code&gt;funding/&lt;/code&gt; or &lt;code&gt;about/&lt;/code&gt; as part of those categories' URI formats (eg. &lt;code&gt;funding/{parent.uri}/{slug}&lt;/code&gt;) then it appends &lt;code&gt;funding/&lt;/code&gt; at each level, eg: &lt;code&gt;funding/funding/funding/cat-B/subcat-2/subcat-6&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to achieve what I want for &lt;em&gt;entries&lt;/em&gt;, by setting their URI format like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.first().group.handle}/{category.last().uri}/{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... which gives me stuff like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;funding/cat-B/subcat-2/subcat-6/entry-title-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I only really need this feature to work because I envision users browsing the categories and potentially clicking the URI/links and being taken to the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my earlier post I created a top-level category group called &quot;Navigation&quot; which contained all my categories – this achieved the correct URIs. This feels messy/hacky though and means my users have to see a redundant &quot;Navigation&quot; group when editing categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's likely I'm misunderstanding some aspect of Craft here – can anyone help me achieve what I'm trying to do here?&lt;/p&gt;&#xA;" OwnerUserId="6844" LastEditorUserId="6844" LastEditDate="2017-09-14T14:34:17.497" LastActivityDate="2018-10-11T19:05:03.733" Title="Including the category group in nested category URIs?" Tags="&lt;craft3&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21983" PostTypeId="1" AcceptedAnswerId="21986" CreationDate="2017-09-14T14:11:06.310" Score="3" ViewCount="944" Body="&lt;p&gt;We're noticing that links to hidden entries that are shared via token (share button) eventually expire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How long do these links last? Is there a setting to adjust how long the token will last?&lt;/p&gt;&#xA;" OwnerUserId="347" LastActivityDate="2018-10-03T21:19:55.567" Title="How long does the share link on the entry edit screen last?" Tags="&lt;link&gt;&lt;editing&gt;&lt;token&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21984" PostTypeId="1" CreationDate="2017-09-14T14:14:33.610" Score="0" ViewCount="104" Body="&lt;p&gt;Usually the effects work fine for me, are there are server requirements to get them working that I have missed? or is the template code below incorrect?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.clientLogos %}&#xA;    {% for image in block.clientLogo %}&#xA;        {% set logoImages = craft.imager.transformImage(image, &#xA;        { width: 210, height: 90, mode: 'crop', position: 'center-center', jpegQuality: 90, effects: { grayscale: true, gamma: 1.5 } } &#xA;        ) %}&#xA;        &amp;lt;img src=&quot;{{ image.url(logoImages) }}&quot; alt=&quot;{{ block.clientTitle }}&quot; title=&quot;{{ block.clientTitle }}&quot;/&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-09-14T14:14:33.610" Title="Imager Effects not working" Tags="&lt;plugins&gt;&lt;image-transforms&gt;&lt;plugin-imager&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21985" PostTypeId="1" AcceptedAnswerId="21988" CreationDate="2017-09-14T15:01:09.737" Score="1" ViewCount="89" Body="&lt;p&gt;I'm looking to dynamically replace the ℠ glyph with &lt;code&gt;&amp;lt;sup&amp;gt;SM&amp;lt;/sup&amp;gt;&lt;/code&gt; in all rich text fields, since that glyph doesn't exist in the font we're using. I'd like to avoid having to call the &lt;code&gt;|replace&lt;/code&gt; filter on every field in every template, and I can't seem to get the &lt;code&gt;customAsciiCharMappings&lt;/code&gt; general config setting to work either (I'm not sure if I really understand what it does). Does Craft have something like a global replace function/filter?&lt;/p&gt;&#xA;" OwnerUserId="7260" LastEditorUserId="57" LastEditDate="2017-09-14T15:50:18.537" LastActivityDate="2017-09-14T15:50:18.537" Title="Can I call a filter on all Rich Text fields?" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;replace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21986" PostTypeId="2" ParentId="21983" CreationDate="2017-09-14T15:09:41.163" Score="6" Body="&lt;p&gt;24 hours by default, but it can be configured via the &lt;code&gt;defaultTokenDuration&lt;/code&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#defaulttokenduration&quot; rel=&quot;noreferrer&quot;&gt;v2 documentation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#defaulttokenduration&quot; rel=&quot;noreferrer&quot;&gt;v3 documentation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastEditorUserId="5072" LastEditDate="2018-10-03T21:19:55.567" LastActivityDate="2018-10-03T21:19:55.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="21987" PostTypeId="2" ParentId="21979" CreationDate="2017-09-14T15:29:44.143" Score="1" Body="&lt;p&gt;This is a known Craft 2 issue that has been &lt;a href=&quot;https://github.com/craftcms/cms/issues/1523&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixed&lt;/a&gt; in the upcoming Craft 3 release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It likely won't be back-ported to Craft 2 since it takes advantage of much larger refactorings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-14T15:29:44.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21988" PostTypeId="2" ParentId="21985" CreationDate="2017-09-14T15:50:04.613" Score="1" Body="&lt;p&gt;&lt;code&gt;customAsciiCharMappings&lt;/code&gt; won't help you here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the &quot;Find and Replace&quot; tool available to admins (Settings-&gt;Tools) in the Control Panel, but its' a one-off thing and searches/replaces against &lt;em&gt;all&lt;/em&gt; textual field types (Plain Text, Rich Text, etc. both inside and outside of Matrix fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly, probably just create a small Twig macro that wraps &lt;code&gt;|replace&lt;/code&gt; and use that wherever you're outputting Rich Text fields on the site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-14T15:50:04.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21989" PostTypeId="1" CreationDate="2017-09-14T17:01:50.073" Score="1" ViewCount="264" Body="&lt;p&gt;I'm trying to load an entry based on the following url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/artists/nameOfArtist/nameOfCategory/myEntry/thumb&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This URL follows the structure of my entries: Artist &gt; Category &gt; Entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm thinking that something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set project = craft.request.getSegment(-2) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;- This gets me the variable from 'myEntry' segment.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artistParent = craft.request.getSegment(-4) %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;- This gets me the variable from 'nameOfArtist' segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I want to find the 'project' entry that lives under 'nameOfArtist'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.slug(project).descendantOf(artistParent).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this is not working. What am I missing? Or is there a better way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-09-15T00:34:09.443" Title="Loading entry based on dynamic route" Tags="&lt;routes&gt;&lt;descendantof&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21990" PostTypeId="1" CreationDate="2017-09-14T17:43:16.007" Score="2" ViewCount="2034" Body="&lt;p&gt;Currently, I have 3 sites set up in Craft 3 beta. I'm trying to get all my sites to share one asset folder by using absolute path. However, I can't seem to set it up. The siteUrl is not parsing as I would expect. I would get &quot;{siteUrl}/assets/people/image.png&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S3B4f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S3B4f.png&quot; alt=&quot;Setup on Craft3&amp;#39;s asset dashboard&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NgPSb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NgPSb.png&quot; alt=&quot;Inside general.php&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7200" LastActivityDate="2017-09-15T21:13:12.750" Title="Setting absolute path to asset files for Craft 3 multisite" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21991" PostTypeId="1" AcceptedAnswerId="21993" CreationDate="2017-09-14T19:27:33.763" Score="2" ViewCount="166" Body="&lt;p&gt;The output of a Element API endpoint allows you to change the resourceKey which contains the json data. Is it possible to return &lt;em&gt;just&lt;/em&gt; the data without a resourceKey at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Values such as null, false and empty string just default to data. &lt;/p&gt;&#xA;" OwnerUserId="857" LastActivityDate="2017-09-14T20:24:49.643" Title="Element API endpoint without a resourceKey" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21992" PostTypeId="2" ParentId="21990" CreationDate="2017-09-14T20:15:58.543" Score="1" Body="&lt;p&gt;Environment variables as a concept don't exist anymore in Craft 3.  You can read about it along with the recommend replacements in the Craft 2 =&gt; 3 &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/upgrade.md#environment-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;upgrade guide&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-14T20:15:58.543" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21993" PostTypeId="2" ParentId="21991" CreationDate="2017-09-14T20:24:49.643" Score="0" Body="&lt;p&gt;Not cleanly... the &lt;a href=&quot;https://github.com/thephpleague/fractal&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fractal&lt;/a&gt; library that the Element API plugin uses to serialize that data has &lt;code&gt;'data'&lt;/code&gt; hard-coded as the root element if no other resource key is passed in.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-14T20:24:49.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21994" PostTypeId="2" ParentId="21951" CreationDate="2017-09-14T22:48:42.950" Score="3" Body="&lt;p&gt;It sounds like you need to create a dynamic route by going to &lt;strong&gt;Settings &gt; Routes &gt; &quot;New Route&quot;&lt;/strong&gt;.  Then you'd set your custom route to &lt;code&gt;profiles/{slug}/email-signature&lt;/code&gt; and decide which template to serve when the url looks that way.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either serve the &lt;code&gt;_entry&lt;/code&gt; template you're serving for &lt;code&gt;/profiles/john-doe&lt;/code&gt; or create a new one. Depending on the situation, you may need to set the entry in the template like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set person = craft.request.getSegment(2) %}&#xA;{% set entry = craft.entries.section('profiles').slug(person).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...in the event Craft can't figure it out because you're on a separate template.  Grabbing segment 2 means you're grabbing &lt;code&gt;john-doe&lt;/code&gt; from the URL, which will help Craft know which entry to find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's more info on routing in the docs: &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/routing#dynamic-routes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2017-09-14T22:55:28.280" LastActivityDate="2017-09-14T22:55:28.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21995" PostTypeId="2" ParentId="21989" CreationDate="2017-09-15T00:34:09.443" Score="1" Body="&lt;p&gt;I think it's because you're trying to cram too much into your &lt;code&gt;entry&lt;/code&gt; variable.  For one, &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#slug&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.slug()&lt;/code&gt;&lt;/a&gt; is going to return an entry with that slug, so I think that's a bit of a full stop.  For two, &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#descendantOf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.descendantOf()&lt;/code&gt;&lt;/a&gt; accepts an EntryModal object, but you're feeding it a uri/slug (ie. &lt;code&gt;name-of-artist&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set artistEntry = craft.entries.slug(artistParent).first %}&#xA;{% set projectEntry = craft.entries.descendantOf(artistEntry).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that &lt;code&gt;.descendantOf()&lt;/code&gt; only works with structures (not channels), so I'm assuming that's what you're working with. Also, you may need to specify how far down the lineage to go with &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#descendantDist&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.descendantDist()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-15T00:34:09.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21997" PostTypeId="2" ParentId="21982" CreationDate="2017-09-15T02:43:18.950" Score="1" Body="&lt;p&gt;I'm not sure if this is a Craft 3 only issue. The following should work on Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top-level Category: something/{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nested Category: {parent.uri}/{slug}&lt;/p&gt;&#xA;" OwnerUserId="5009" LastActivityDate="2017-09-15T02:43:18.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21998" PostTypeId="1" AcceptedAnswerId="21999" CreationDate="2017-09-15T07:23:26.863" Score="2" ViewCount="218" Body="&lt;p&gt;I have an activity calendar (more like a weekly schedule) which filters per day and per category. Because there are so many activities I can't just load them all in at once so I use some sort of Ajax pagination kind of way which grabs the category handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, it will always use the first category that has been selected for the event instead of going through them all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So everything works fine as long as 1 category is selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('cat') == '' %}&#xA;     {% set selectedCat = 'startingCategory' %}&#xA;{% else %}&#xA;     {% set selectedCat = craft.request.getParam('cat') %}&#xA;{% endif %}&#xA;&amp;lt;div class=&quot;row activiteitenRow&quot; id=&quot;tegelContent&quot;&amp;gt;&#xA;     {% for category in craft.categories.group('leeftijdsGroepen') %}&#xA;          {% set query = {&#xA;                 section : 'sportidEvenementen',&#xA;                 order : 'evenementDatum desc',&#xA;                 limit : null,&#xA;                 relatedTo : category,&#xA;           } %}&#xA;           {% set entries = craft.entries(query) %}&#xA;           {% for entry in entries &#xA;                  if entry.categories[0]|camel == selectedCat&#xA;            %}&#xA;&#xA;            {# activity display code here #}&#xA;&#xA;            {% endfor %}&#xA;      {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think the problem is in the final forloop:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in entries if entry.categories[0]|camel == selectedCat %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;code&gt;.first()&lt;/code&gt; Before but it was obvious that would only grab the first category but it needs to use an array but, really can't find a way to fix this.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2017-09-15T08:08:42.417" LastActivityDate="2017-09-15T09:02:21.627" Title="Load entries based on category field value while multiple categories are selected" Tags="&lt;entries&gt;&lt;categories&gt;&lt;filter&gt;&lt;forloop&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21999" PostTypeId="2" ParentId="21998" CreationDate="2017-09-15T09:02:21.627" Score="1" Body="&lt;p&gt;After looking for some more options I found the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I was looking for a solution on how to check if the handle was inside of the array but, didn't manage to output the entire array as a conditional. I ended up changing the filter to filter on the category id (should have done that in the first place). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm filtering by ID so I could just use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in entries if selectedCat in entry.categories.ids() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got some help from this answer after I figured out to use ID's instead of handle's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17155/converting-array-of-entries-to-an-array-of-ids&quot;&gt;Converting array of entries to an array of ids&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2017-09-15T09:02:21.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22000" PostTypeId="1" CreationDate="2017-09-15T10:03:38.920" Score="1" ViewCount="106" Body="&lt;p&gt;I'm quite new to Craft CMS and have takeen over an application (using Twig templates).  I'm trying to run a filter but not having much joy so maybe I might get some help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, there is a people section (&lt;code&gt;craft.entries.section('people')&lt;/code&gt;) with over 1000 entries. These are displayed in an HTML table, each row has 3 columns (handled using the &lt;code&gt;batch()&lt;/code&gt; call). I want to exclude certain entries that match a particular condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I want to exclude all 'people' that partially match a list of names (e.g 'xyz', 'zzzz', 'joebloggs')&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for people in craft.entries.section('people').order('title asc').limit(500)|batch(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do a query like this before the loop? Or is it something I need to check on each iteration inside the loop? Doing this might make the &lt;code&gt;batch()&lt;/code&gt; unusable?&lt;/p&gt;&#xA;" OwnerUserId="7262" LastEditorUserId="57" LastEditDate="2017-09-15T18:44:29.973" LastActivityDate="2017-09-15T18:44:29.973" Title="Filtering out section entries" Tags="&lt;filter&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22001" PostTypeId="2" ParentId="22000" CreationDate="2017-09-15T10:56:38.843" Score="2" Body="&lt;p&gt;If you want to search for entries, you can use the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#search&quot; rel=&quot;nofollow noreferrer&quot;&gt;search&lt;/a&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set people = craft.entries&#xA;    .section('people')&#xA;    .search('*xyz* OR *zzzz*') &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can loop through those people like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for person in people |batch(3) %}&#xA;    {{ person.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By default, &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;search&lt;/a&gt; doesn't do fuzzy search, that's where the *s come in. You can, however, &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow noreferrer&quot;&gt;enable fuzzy search by default&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to limit your search to a field, do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.entries.search('fieldHandle:xyz OR fieldHandle:zzzz') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2017-09-15T10:56:38.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22003" PostTypeId="1" CreationDate="2017-09-15T15:16:13.743" Score="2" ViewCount="67" Body="&lt;p&gt;I'm unable to save an entry, and I'm getting an error saying that a Rich Text field is too long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I disable the entry, it saves fine, but when it's enabled, it doesn't save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I increase the max size of a Rich Text field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6hHDU.png&quot; alt=&quot;&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uluWG.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4333" LastEditorUserId="57" LastEditDate="2017-09-15T18:58:16.097" LastActivityDate="2017-09-15T19:00:09.093" Title="Can you increase the max size of Rich Text fields?" Tags="&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22004" PostTypeId="2" ParentId="21878" CreationDate="2017-09-15T15:45:45.950" Score="1" Body="&lt;p&gt;I seemed to have resolved this issue. Though I am not entirely clear about why the following works, I'll describe what worked for me in case someone else is alos having this issue. If anyone can shed more light on why this may have been causing problems please share.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our website uses localization and as such we have a separate index.php file for each locale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my index.php file I am setting variables using ini_set and had been under the impression that it was necessary to set these for each locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I had the following in my main index.php file and the locale index.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ini_set('session.save_handler', 'redis');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once I removed ini_set calls from the locale index.php files the control panel session issue seems to have been resolved.&lt;/p&gt;&#xA;" OwnerUserId="7205" LastActivityDate="2017-09-15T15:45:45.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22005" PostTypeId="2" ParentId="21976" CreationDate="2017-09-15T18:42:24.657" Score="1" Body="&lt;p&gt;Changing &lt;code&gt;sendNotificationEmail()&lt;/code&gt; to this should fix it for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sendNotificationMail(UserModel $user) {&#xA;    $mailer = craft()-&amp;gt;email;&#xA;    $mailToBeSent = new EmailModel();&#xA;&#xA;    $mailToBeSent-&amp;gt;subject = Craft::t('Nieuwe gebruiker geregistreerd');&#xA;    $mailToBeSent-&amp;gt;fromName = 'xyz';&#xA;    $mailToBeSent-&amp;gt;sender = 'noreply@xyz.be';&#xA;&#xA;    $mailToBeSent-&amp;gt;toEmail = 'xyz@xyz.be';&#xA;&#xA;    $originalTemplateMode = craft()-&amp;gt;templates-&amp;gt;getTemplateMode();&#xA;    craft()-&amp;gt;template-&amp;gt;setTemplateMode(TemplateMode::Site);&#xA;&#xA;    $content = craft()-&amp;gt;templates-&amp;gt;render(&#xA;        '_emails/customer-service-notification',&#xA;        [&#xA;            'userInfo' =&amp;gt; [&#xA;                'email' =&amp;gt; $user-&amp;gt;email,&#xA;                'name' =&amp;gt; $user-&amp;gt;fullName,&#xA;            ],&#xA;        ]&#xA;    );&#xA;&#xA;    $mailToBeSent-&amp;gt;htmlBody = $content;&#xA;    $mailer-&amp;gt;sendEmail($mailToBeSent);&#xA;&#xA;    craft()-&amp;gt;templates-&amp;gt;setTemplateMode($originalTemplateMode);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-15T18:42:24.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22006" PostTypeId="1" AcceptedAnswerId="22049" CreationDate="2017-09-15T18:59:28.613" Score="2" ViewCount="426" Body="&lt;p&gt;I'm running into a few issues trying to set up 301/302 redirects with Craft and nginx. The legacy site has &lt;code&gt;/contact.php&lt;/code&gt; paths which I would like to direct to &lt;code&gt;/info/&lt;/code&gt; but when I visit &lt;code&gt;mysite.com/contact.php&lt;/code&gt; it gives me the &lt;code&gt;No input file specified.&lt;/code&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried setting this up with Retour plugin, and inside of nginx files, but they both return &lt;code&gt;No input file&lt;/code&gt; since there is no &lt;code&gt;contact.php&lt;/code&gt; on my server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my nginx file for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen 80;&#xA;    listen 443 ssl http2;&#xA;    server_name mysite.com;&#xA;    root &quot;/home/vagrant/mysite/public&quot;;&#xA;&#xA;    index index.html index.htm index.php;&#xA;&#xA;    charset utf-8;&#xA;&#xA;    location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;&#xA;    location = /favicon.ico { access_log off; log_not_found off; }&#xA;    location = /robots.txt  { access_log off; log_not_found off; }&#xA;&#xA;    access_log off;&#xA;    error_log  /var/log/nginx/mysite.error.log error;&#xA;&#xA;    sendfile off;&#xA;&#xA;    client_max_body_size 100m;&#xA;&#xA;    location ~ \.php$ {&#xA;        fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;&#xA;        fastcgi_index index.php;&#xA;        include fastcgi_params;&#xA;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;&#xA;        fastcgi_intercept_errors off;&#xA;        fastcgi_buffer_size 16k;&#xA;        fastcgi_buffers 4 16k;&#xA;        fastcgi_connect_timeout 300;&#xA;        fastcgi_send_timeout 300;&#xA;        fastcgi_read_timeout 300;&#xA;    }&#xA;&#xA;    location ~ /\.ht {&#xA;        deny all;&#xA;    }&#xA;&#xA;    ssl_certificate     /etc/nginx/ssl/mysite.crt;&#xA;    ssl_certificate_key /etc/nginx/ssl/mysite.key;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know Craft is doing some weird things here to avoid &lt;code&gt;index.php&lt;/code&gt;, not sure how it affects my situation though. In addition to mapping &lt;code&gt;/contact.php&lt;/code&gt; to &lt;code&gt;/info/&lt;/code&gt;, I would also like to make &lt;code&gt;/gallery.php?c=category&lt;/code&gt; to &lt;code&gt;/?filter=category&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="6981" LastEditorUserId="57" LastEditDate="2017-09-15T19:01:23.273" LastActivityDate="2017-09-22T20:14:19.200" Title="Redirects with Craft and nginx" Tags="&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22007" PostTypeId="2" ParentId="22003" CreationDate="2017-09-15T19:00:09.093" Score="2" Body="&lt;p&gt;Under your Rich Text field's setting, there is a &quot;Column Type&quot; option that's set to &lt;code&gt;text&lt;/code&gt; by default, which will hold about 64k worth of data.  You can change it to &lt;code&gt;mediumtext&lt;/code&gt;, which will store about 16M worth of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PTSPb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PTSPb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-15T19:00:09.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22009" PostTypeId="2" ParentId="21990" CreationDate="2017-09-15T21:13:12.750" Score="2" Body="&lt;p&gt;Found out the answer on how to get all my sites on Craft 3 to share one image folder. So you have to set your base url for all your site to your original site's base url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7L08x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7L08x.png&quot; alt=&quot;Set Base Url for all sites to the same url.&quot;&gt;&lt;/a&gt;&#xA;Then in your code, you just put {{ siteUrl }} before your image url. Kind of confusing since siteUrl is actually the Base Url in the dashboard.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IxYx9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IxYx9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7200" LastActivityDate="2017-09-15T21:13:12.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22010" PostTypeId="2" ParentId="21951" CreationDate="2017-09-15T21:24:58.367" Score="2" Body="&lt;p&gt;This should be a comment on Ryan's answer, but I don't have the necessary reputation to post it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using a custom route like &lt;code&gt;profiles/{slug}/email-signature&lt;/code&gt; then you don't need to use &lt;code&gt;getSegment(2)&lt;/code&gt; to access the person. The whole point is that your setting the &lt;code&gt;slug&lt;/code&gt; variable during the routing so should be able to just use &lt;code&gt;{{ slug }}&lt;/code&gt; in the template that the route is pointed at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd just need:&#xA;&lt;code&gt;{% set entry = craft.entries.section('profiles').slug(slug).first %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3864" LastActivityDate="2017-09-15T21:24:58.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22011" PostTypeId="1" CreationDate="2017-09-15T23:23:21.543" Score="1" ViewCount="27" Body="&lt;p&gt;Is a backup needed before updating? Will installing new updates have any affect on the pages already saved or the existing structure?&lt;/p&gt;&#xA;" OwnerUserId="7075" LastActivityDate="2017-09-16T21:30:29.257" Title="Issues with Updating" Tags="&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22012" PostTypeId="2" ParentId="6638" CreationDate="2017-09-16T08:01:40.443" Score="2" Body="&lt;p&gt;To get an URL to a specific CraftCMS single entry.&#xA;Look up for the entry unique id in admin panel and then apply in Twig template:&#xA;Example below: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set page_cookies_policy = craft.entries.id(10).first() %}&#xA;   {% set page_terms = craft.entries.id(11).first() %}&#xA;&#xA;   &amp;lt;ul class=&quot;footer-sub-nav&quot;&amp;gt;&#xA;       &amp;lt;li&amp;gt;{{ page_cookies_policy.getLink() }}&amp;lt;/li&amp;gt;&#xA;       &amp;lt;li&amp;gt;{{ page_terms.getLink() }}&amp;lt;/li&amp;gt;&#xA;   &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5817" LastActivityDate="2017-09-16T08:01:40.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22014" PostTypeId="2" ParentId="22011" CreationDate="2017-09-16T21:30:29.257" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is a backup needed before updating?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's definitely recommended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless of it is an &lt;a href=&quot;https://craftcms.com/docs/updating&quot; rel=&quot;nofollow noreferrer&quot;&gt;auto-update or a manual update&lt;/a&gt;, Craft will attempt to perform a database backup if the &lt;a href=&quot;https://craftcms.com/docs/config-settings#backupDbOnUpdate&quot; rel=&quot;nofollow noreferrer&quot;&gt;backupDbOnUpdate&lt;/a&gt; config setting is set to &lt;code&gt;true&lt;/code&gt; (it is by default).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is set to &lt;code&gt;false&lt;/code&gt; you'd want to perform your own backup before doing a Craft update.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Will installing new updates have any affect on the pages already saved or the existing structure?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Updates should not make breaking changes to the front-end of your site.  The ones that do will be advertised as so, such as the Craft 2 =&gt; 3 update process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the steps that Craft goes through to make sure updating is done safely here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1111/how-safe-is-auto-updating&quot;&gt;How safe is auto-updating?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-16T21:30:29.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22015" PostTypeId="1" CreationDate="2017-09-17T02:48:17.473" Score="1" ViewCount="96" Body="&lt;p&gt;Using Sprout Forms in conjunction with Amazon S3. The file is being uploaded to the S3 source, however it fails to send when viewing the Craft log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[error] [application] Email error: Could not access file: /home/me/me.example.com/craft/storage/runtime/assets/sources/8540.txt&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that the file 8540.txt (named differently) is stored on Amazon S3, but it does not exist in the runtime/assets/sources/ directory. Any idea why the files for images successfully send and are properly created in the runtime/assets/sources/ directory but any other file type i.e. pdf, doc, txt, the server does not create the file and the email fails to send because the file does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a server configuration or a Craft configuration?&lt;/p&gt;&#xA;" OwnerUserId="3721" LastActivityDate="2017-09-20T01:01:15.577" Title="Email error: Could not access file" Tags="&lt;emails&gt;&lt;plugin-sproutforms&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22016" PostTypeId="1" AcceptedAnswerId="22017" CreationDate="2017-09-17T18:31:38.273" Score="1" ViewCount="227" Body="&lt;p&gt;How do I use the elementapi to get the list of entries for the logged in user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a couple of options to no avail, like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v1/user/&amp;lt;userId:\d+&amp;gt;.json' =&amp;gt; function($userId) {&#xA;&#xA;            $author = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; 'Entry',&#xA;                'criteria' =&amp;gt; [&#xA;                    'section' =&amp;gt; 'jobs',&#xA;                    'author' =&amp;gt; $author&#xA;                ],&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as an example of one I thought should have worked but it just returns everything.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-09-17T21:09:19.883" Title="getting the current user entries from elementapi" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22017" PostTypeId="2" ParentId="22016" CreationDate="2017-09-17T21:03:31.287" Score="2" Body="&lt;p&gt;If you really want the entries for the &lt;em&gt;currently logged in user&lt;/em&gt;, having a parameter for &lt;code&gt;userId&lt;/code&gt; in your endpoint URL doesn't really make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not tested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v1/user.json' =&amp;gt; function () {&#xA;&#xA;    $author = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;    if (!$author) {&#xA;        HeaderHelper::setHeader(array('status' =&amp;gt; 404));&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; ElementType::Entry,&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'jobs',&#xA;            'authorId' =&amp;gt; $author-&amp;gt;id,&#xA;        ],&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that the above example endpoint would be available at &lt;code&gt;http://example.com/api/v1/user.json&lt;/code&gt;, where your example code would create an endpoint with a required &lt;code&gt;userId&lt;/code&gt; parameter, i.e. &lt;code&gt;http://example.com/api/v1/user/12345.json&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also notice that the currently logged in user is pulled via the &lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService&quot; rel=&quot;nofollow noreferrer&quot;&gt;UserSessionService&lt;/a&gt; (&lt;code&gt;craft()-&amp;gt;userSession&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, note that you should use &lt;code&gt;'authorId' =&amp;gt; $author-&amp;gt;id&lt;/code&gt; in your criteria – not &lt;code&gt;'author' =&amp;gt; $author&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-09-17T21:09:19.883" LastActivityDate="2017-09-17T21:09:19.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22018" PostTypeId="1" AcceptedAnswerId="22020" CreationDate="2017-09-17T21:28:39.243" Score="1" ViewCount="120" Body="&lt;p&gt;I want to customize the user-registration-form with error/success-states.&lt;br&gt;&#xA;If, for example, the user enters a wrong email, but correct username and password, it would be nice to set the value of the password input field back to the original entered password - like the username-field does.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if account is defined %}&#xA;&amp;lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; value=&quot;{{account.password}}&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In matter of UX, this does not really works good, because it's the hashed version of the password. The origin was much shorter. So the user could be a bit surprised...&lt;br&gt;&#xA;Not setting the value, but set the state to success with an empty field is not much better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible, to set the origin entered password as the value?&lt;br&gt;&#xA;If, does this work on resend the form?&lt;br&gt;&#xA;Any other ideas are welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tnx&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bh1gj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bh1gj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7268" LastEditorUserId="7268" LastEditDate="2017-09-17T21:34:22.923" LastActivityDate="2017-09-18T05:39:07.190" Title="How to get the original entered password value on registration form error?" Tags="&lt;users&gt;&lt;registration&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22019" PostTypeId="1" CreationDate="2017-09-18T02:00:41.263" Score="1" ViewCount="110" Body="&lt;p&gt;Creating an RSS feed in craft and I have it to loop through all the entries via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set sermons = craft.entries.section('sermonEntry').limit(null).find() %}&#xA;    {% for sermon in sermons %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On my feed url (example.com/feed) I can only see 17 of my entries. However when I view the page source. I see all of my entries in XML format (roughly 31 entries)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have an idea why this may be? Or if it will affect my podcasts that go to itunes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if there is a limitation on atom or rss with craft but I have seen 100's of entries on a rss feed page so maybe I am overlooking something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6645" LastActivityDate="2017-11-17T19:52:37.370" Title="Not All Entries showing in feed page but do show in Page Source XML" Tags="&lt;entries&gt;&lt;rss&gt;&lt;xml&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22020" PostTypeId="2" ParentId="22018" CreationDate="2017-09-18T05:39:07.190" Score="3" Body="&lt;p&gt;You could always use the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getPost&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft request object&lt;/a&gt; to repopulate the fields, however I don't think it's common practice to repopulate password fields for security reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing that is considered bad practice is differentiating behaviour for partially correct credentials - the response from the web server should always be the same whether one part or multiple parts are missing from a correct authorization submission to prevent information disclosure to a potential attacker.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-09-18T05:39:07.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22021" PostTypeId="1" CreationDate="2017-09-18T10:23:06.747" Score="1" ViewCount="99" Body="&lt;p&gt;My clients wants its restaurant owners to create FAQs from frontend where each owner can add its questions from frontend and the users will have to submit its answers. I thought to implement it through creating a matrix field which will be available for each restaurants entry. The name of the field could be the question and the text field could be the answer. Each users could save there answers to a new block. I know how to put data into matrix fields that are already made. But i can't find anything from which i can add fields in a matrix block. Is it even possible? Is there any type of plugin available which would help me in it? Any other ideas for this issue would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="57" LastEditDate="2017-09-18T22:21:16.010" LastActivityDate="2017-09-18T22:21:16.010" Title="Is it possible to create fields in a Matrix block from frontend?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22022" PostTypeId="2" ParentId="14587" CreationDate="2017-09-18T10:32:40.197" Score="1" Body="&lt;p&gt;Sounds like a feature request for the developers of Venti, but this code should help you achieve what you need.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upcomingEvents = [] %}&#xA;{% set upcomingEventIds = [] %}&#xA;&#xA;{% for event in events %}&#xA;    {% if not event.eid in upcomingEventIds %}&#xA;        {% set upcomingEvents = upcomingEvents|merge([event]) %}&#xA;        {% set upcomingEventIds = upcomingEventIds|merge([event.eid]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2017-09-18T10:32:40.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22023" PostTypeId="1" CreationDate="2017-09-18T11:42:45.260" Score="1" ViewCount="159" Body="&lt;p&gt;I'm using Luke Holder's Geo plugin and it's been working great, so far. I'm testing on mobile and while it works fine on my Android device, visiting the site on two different iPhone 6s has resulted in the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Undefined property: stdClass::$traits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Line 94 in &lt;a href=&quot;https://github.com/lukeholder/craft-geo/blob/master/geo/services/Geo_LocationService.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lukeholder/craft-geo/blob/master/geo/services/Geo_LocationService.php&lt;/a&gt; is responsible but I haven't yet figured out why it's doing it, nor how to prevent it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both phones are on a different mobile network (O2 in the UK) to my Android device (Three). I've tested on an iPhone SE (Tesco, which piggy-backs O2) and that's fine. So it's either the iPhone 6 that's the problem, or their network. But manually entering the Nekudo URL with the IP addresses reveals nothing different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://geoip.nekudo.com/api/92.10.112.255/full&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://geoip.nekudo.com/api/92.10.112.255/full&lt;/a&gt; (IP of Android device)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://geoip.nekudo.com/api/82.132.243.85/full&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://geoip.nekudo.com/api/82.132.243.85/full&lt;/a&gt; (IP of one of the iPhone 6s)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is not in devMode (everything is fine when it is). I can't understand why the same server would return a server error for one phone and not another phone. There was an issue with the plugin returning this error when using a local IP address but I don't think that applies here. I ahve noticed that the two phones in question are locating to London, 100 miles away from their true location - could that be a clue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-09-19T15:28:42.577" LastActivityDate="2017-09-19T15:28:42.577" Title="Geo plugin returns Undefined property: stdClass::$traits" Tags="&lt;plugins&gt;&lt;geo&gt;&lt;plugin-geo&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22024" PostTypeId="1" AcceptedAnswerId="22025" CreationDate="2017-09-18T11:54:32.660" Score="2" ViewCount="828" Body="&lt;p&gt;I'm a long time WordPress developer who's moved over to Craft CMS (loving it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When moving over WordPress sites from MAMP to a live production server, I follow this process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upload all WP files to live server&lt;/li&gt;&#xA;&lt;li&gt;Export database via phpMyAdmin&lt;/li&gt;&#xA;&lt;li&gt;Create database on live server and import database dump&lt;/li&gt;&#xA;&lt;li&gt;User &lt;a href=&quot;https://interconnectit.com/products/search-and-replace-for-wordpress-databases/&quot; rel=&quot;nofollow noreferrer&quot;&gt;search and replace tool&lt;/a&gt; to change URLs&lt;/li&gt;&#xA;&lt;li&gt;Flush permalinks via WP admin&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For Craft, I've done the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upload all Craft files to live server&lt;/li&gt;&#xA;&lt;li&gt;Export database from CP in Craft&lt;/li&gt;&#xA;&lt;li&gt;Create database on live server and import Craft DB zip&lt;/li&gt;&#xA;&lt;li&gt;Via live Craft CP, change Site URL and Asset URL&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Everything is working perfectly, but I just want to check I hadn't missed anything here? Not having to do a search and replace is awesome.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastActivityDate="2017-09-18T13:02:01.293" Title="Moving from staging (MAMP) to live production server" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22025" PostTypeId="2" ParentId="22024" CreationDate="2017-09-18T13:02:01.293" Score="6" Body="&lt;p&gt;Everything looks good to go more or less, but #4 can be improved upon by creating a &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;noreferrer&quot;&gt;multi-environment config&lt;/a&gt; file.  This way, instead of having to change your site urls and base path (for assets) in the event you want to overwrite your local db with your live site db to sync it up, you just use a variable in the CMS like &lt;code&gt;{siteUrl}&lt;/code&gt; or &lt;code&gt;{basePath}&lt;/code&gt; that's set in your config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;nystudio107&lt;/strong&gt; has &lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;a great article&lt;/a&gt; walking you through setting up a great multi-environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're feeling even more adventurous, I also highly suggest his &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Database &amp;amp; Asset Syncing&lt;/a&gt; article that allows you to run a command from your terminal to instantly pull down and import a copy of your database/assets from any environment you want into your local.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-18T13:02:01.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22026" PostTypeId="2" ParentId="22021" CreationDate="2017-09-18T13:17:45.730" Score="2" Body="&lt;p&gt;There's a lengthy rundown about this in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/33/how-do-you-create-a-front-end-form-for-users-to-submit-content&quot;&gt;this ticket&lt;/a&gt; if you need a detailed explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, you'll want to check out P&amp;amp;T's &lt;a href=&quot;https://github.com/craftcms/guest-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries plugin&lt;/a&gt; to populate entries on the back-end from front-end input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I highly suggest paying very close attention to how you should set up your form fields' &lt;code&gt;name&lt;/code&gt; attributes from this StraightUpCraft post (scroll to the very bottom for Matrix fields): &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-18T13:17:45.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22027" PostTypeId="1" AcceptedAnswerId="22031" CreationDate="2017-09-18T13:41:22.760" Score="1" ViewCount="146" Body="&lt;p&gt;Is there a safe limit to the number of entries related to another entry via the entry field (including nesting 2 deep) before putting too much strain on  performance? I'm approaching a products range using the entry field, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parent&#xA;-child&#xA;-child&#xA;-child parent&#xA;-- child&#xA;-- child&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2017-09-18T22:29:10.600" Title="Safe number of related entries – before performance hindered?" Tags="&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22028" PostTypeId="1" AcceptedAnswerId="22032" CreationDate="2017-09-18T14:50:28.677" Score="2" ViewCount="759" Body="&lt;p&gt;I have made a simple plugin (with pluginfactory.io) that has been working perfectly so far. But after taking it to our live test-site it is causing the /admin/settings page to stop working, throwing the error that the plugin's settings template cannot be found. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[error] [exception.Craft\TemplateLoaderException] Craft\TemplateLoaderException: Unable to find the template “pluginname/pluginName_Settings” in &quot;settings/_index&quot; at line 8. in /craft/app/etc/templating/twigextensions/TemplateLoader.php:123&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have dumped the production DB and imported it locally, I have checked that the files exists both in git and on the server, but I still only get this error on the server, everything is working fine locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what could be causing this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml() {&#xA;    return craft()-&amp;gt;templates-&amp;gt;render('pluginname/pluginName', array(&#xA;        'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="57" LastEditDate="2017-09-18T22:33:29.867" LastActivityDate="2017-09-18T22:39:48.247" Title="Plugin's setting template not found" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22029" PostTypeId="2" ParentId="16699" CreationDate="2017-09-18T17:07:05.457" Score="2" Body="&lt;p&gt;This is what I ended up doing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/disclosedassets/blob/master/resources/js/disclosedassets.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/disclosedassets/blob/master/resources/js/disclosedassets.js&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;code&gt;Garnish.Modal.visibleModal&lt;/code&gt; that will contain the handle to the Garnish modal object if one is visible. You can use this to see if a modal is visible, and even see which one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately there's no &lt;em&gt;event&lt;/em&gt; I'm aware of that triggers when a modal is shown, so you'll still have to poll via &lt;code&gt;window.setTimeout()&lt;/code&gt; -- it's a hack, but... &lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-18T17:07:05.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22030" PostTypeId="2" ParentId="22019" CreationDate="2017-09-18T18:53:34.993" Score="1" Body="&lt;p&gt;I accidentally had loop inside of the description tag which strangely caused only 17 entries to post to the RSS feed. Below is an example of what was causing the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;description&amp;gt;&amp;lt;![CDATA[&#xA;  {% set speaker = craft.categories.group('speaker').relatedTo(entry).find() %}&#xA;  {% for name in speaker %}&#xA;  A Sermon from {{ entry.sermondate | date(&quot;l, F j, Y&quot;) }}: {{ entry.title }} by {{ name.title }}]]&amp;gt;&amp;lt;/description&amp;gt;&#xA;        &amp;lt;category&amp;gt;Podcasts&amp;lt;/category&amp;gt;&#xA;        &amp;lt;category&amp;gt;Christianity&amp;lt;/category&amp;gt;&#xA;        &amp;lt;author&amp;gt;{{ name.title }}&amp;lt;/author&amp;gt;&#xA;        &amp;lt;itunes:explicit&amp;gt;No&amp;lt;/itunes:explicit&amp;gt;&#xA;        &amp;lt;itunes:author&amp;gt;{{ name.title }}&amp;lt;/itunes:author&amp;gt;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After I set it outside the Description tag if gave me all my entries on the RSS feed. Here is my final feed code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&#xA;    &amp;lt;rss xmlns:content=&quot;http://purl.org/rss/1.0/modules/content/&quot; xmlns:wfw=&quot;http://wellformedweb.org/CommentAPI/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot; xmlns:sy=&quot;http://purl.org/rss/1.0/modules/syndication/&quot; xmlns:slash=&quot;http://purl.org/rss/1.0/modules/slash/&quot; xmlns:itunes=&quot;http://www.itunes.com/dtds/podcast-1.0.dtd&quot; version=&quot;2.0&quot;&amp;gt;&#xA;    &amp;lt;channel&amp;gt;&#xA;    &amp;lt;title&amp;gt;Sermons at Example Church&amp;lt;/title&amp;gt;&#xA;    &amp;lt;atom:link href=&quot;{{ url() }}&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&amp;gt;&#xA;    &amp;lt;link&amp;gt;http://www.examplechurch.org/sermons/&amp;lt;/link&amp;gt;&#xA;    &amp;lt;description&amp;gt;Weekly morning sermons from Example Church in Sab Diego, CA. For all of our sermon archives, please visit http://www.example.org/sermons.&amp;lt;/description&amp;gt;&#xA;    &amp;lt;lastBuildDate&amp;gt;Sun, 17 Sep 2017 00:00:00 -0600&amp;lt;/lastBuildDate&amp;gt;&#xA;    &amp;lt;language&amp;gt;en-us&amp;lt;/language&amp;gt;&#xA;    &amp;lt;sy:updatePeriod&amp;gt;hourly&amp;lt;/sy:updatePeriod&amp;gt;&#xA;    &amp;lt;sy:updateFrequency&amp;gt;1&amp;lt;/sy:updateFrequency&amp;gt;&#xA;    &amp;lt;itunes:author&amp;gt;Example Church&amp;lt;/itunes:author&amp;gt;&#xA;    &amp;lt;itunes:summary&amp;gt;Weekly morning sermons from Example Church in Sab Diego, CA. For all of our sermon archives, please visit http://www.example.org/sermons.&amp;lt;/itunes:summary&amp;gt;&#xA;    &amp;lt;itunes:owner&amp;gt;&#xA;      &amp;lt;itunes:name&amp;gt;Example Church - San Diego, California&amp;lt;/itunes:name&amp;gt;&#xA;      &amp;lt;itunes:email&amp;gt;web@examplechurch.org&amp;lt;/itunes:email&amp;gt;&#xA;    &amp;lt;/itunes:owner&amp;gt;&#xA;    &amp;lt;itunes:explicit&amp;gt;No&amp;lt;/itunes:explicit&amp;gt;&#xA;    &amp;lt;itunes:category text=&quot;Religion &amp;amp;amp; Spirituality&quot;&amp;gt;&#xA;    &amp;lt;itunes:category text=&quot;Christianity&quot;&amp;gt;&amp;lt;/itunes:category&amp;gt;&#xA;    &amp;lt;/itunes:category&amp;gt;&#xA;    &amp;lt;itunes:category text=&quot;Health&quot;&amp;gt;&amp;lt;/itunes:category&amp;gt;&#xA;    &amp;lt;itunes:category text=&quot;Society &amp;amp;amp; Culture&quot;&amp;gt;&amp;lt;/itunes:category&amp;gt;&#xA;     {% if podcastImage.podcastimage|length %}&#xA;    &amp;lt;itunes:image href=&quot;{{ podcastImage.podcastimage.first.getUrl() }}&quot;&amp;gt;&amp;lt;/itunes:image&amp;gt;&#xA;     {% endif %}&#xA;    {% set entries = craft.entries.section('sermonEntry').limit(null).find() %}&#xA;     {% for entry in entries %}&#xA;    &amp;lt;item&amp;gt;&#xA;      &amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;&#xA;      &amp;lt;link&amp;gt;{{ entry.url }}&amp;lt;/link&amp;gt;&#xA;      &amp;lt;pubDate&amp;gt;{{ entry.postDate.rss }}&amp;lt;/pubDate&amp;gt;&#xA;       {% set audio = entry.audio.first() %}&#xA;       {% if audio %}&#xA;      &amp;lt;enclosure url=&quot;{{ audio.url }}&quot; type=&quot;audio/mp3&quot;&amp;gt;&amp;lt;/enclosure&amp;gt;&#xA;       {% endif %}&#xA;      &amp;lt;guid&amp;gt;{{ entry.url }}&amp;lt;/guid&amp;gt;&#xA;       {% set speaker = craft.categories.group('speaker').relatedTo(entry).find() %}&#xA;      {% for name in speaker %}&#xA;      &amp;lt;description&amp;gt;&amp;lt;![CDATA[A Sermon from {{ entry.sermondate | date(&quot;l, F j, Y&quot;) }}: {{ entry.title }} by {{ name.title }}]]&amp;gt;&amp;lt;/description&amp;gt;&#xA;      &amp;lt;category&amp;gt;Podcasts&amp;lt;/category&amp;gt;&#xA;      &amp;lt;category&amp;gt;Christianity&amp;lt;/category&amp;gt;&#xA;      &amp;lt;author&amp;gt;{{ name.title }}&amp;lt;/author&amp;gt;&#xA;      &amp;lt;itunes:explicit&amp;gt;No&amp;lt;/itunes:explicit&amp;gt;&#xA;      &amp;lt;itunes:author&amp;gt;{{ name.title }}&amp;lt;/itunes:author&amp;gt;{% endfor %}&#xA;      &amp;lt;itunes:keywords&amp;gt;Example Church,Sermons,Christianity,Jesus Christ,Bible Teaching,Discipleship,Service&amp;lt;/itunes:keywords&amp;gt;&#xA;     &amp;lt;/item&amp;gt;&#xA;     {% endfor %}&#xA;   &amp;lt;/channel&amp;gt;&#xA;   &amp;lt;/rss&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6645" LastActivityDate="2017-09-18T18:53:34.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22031" PostTypeId="2" ParentId="22027" CreationDate="2017-09-18T22:29:10.600" Score="2" Body="&lt;p&gt;The real answer, as with most performance related questions is, &quot;it depends&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's based on environmental factors like how much resources does your site and database have, what else the templates are doing, how are the servers configured, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 limits the amount of elements returned in a query to 100 by default, so that would probably be a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-18T22:29:10.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22032" PostTypeId="2" ParentId="22028" CreationDate="2017-09-18T22:39:48.247" Score="1" Body="&lt;p&gt;Sounds like production has a case-sensitive file system and locally you don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you're trying to render a template called &lt;code&gt;mytemplate.html&lt;/code&gt; on the file system, but you're using &lt;code&gt;myTemplate.html&lt;/code&gt; in the plugin code.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-18T22:39:48.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22033" PostTypeId="1" AcceptedAnswerId="22034" CreationDate="2017-09-18T22:57:28.257" Score="2" ViewCount="650" Body="&lt;p&gt;I'm trying to upload a 40MB video through the assets tab in the admin panel, but I get an error saying &quot;The file &quot;x.mp4&quot; could not be uploaded, because it exceeds the maximum upload size of 8.0 MB.&quot;&#xA;In my php.ini file it looks like I've got it set to 265MB and i'm not sure where else to check. Here's what my php.ini file looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;allow_url_fopen = Off&#xA;allow_url_include = Off&#xA;display_errors = Off&#xA;enable_dl = Off&#xA;file_uploads = On&#xA;max_execution_time = 30&#xA;max_input_time = 60&#xA;max_input_vars = 1000&#xA;memory_limit = 128M&#xA;session.gc_maxlifetime = 1440&#xA;session.save_path = &quot;/var/cpanel/php/sessions/ea-php71&quot;&#xA;upload_max_filesize = 256M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7212" LastActivityDate="2017-09-18T23:17:50.077" Title="8MB memory limit on asset uploads?" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22034" PostTypeId="2" ParentId="22033" CreationDate="2017-09-18T23:17:50.077" Score="1" Body="&lt;p&gt;Craft has a &lt;a href=&quot;https://craftcms.com/docs/config-settings#maxUploadFileSize&quot; rel=&quot;nofollow noreferrer&quot;&gt;maxUploadFileSize&lt;/a&gt; config setting, but it is set to 16MB by default.  Maybe someone has changed it to 8MB for your install, though.  It would be in &lt;code&gt;craft/config/general.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-18T23:17:50.077" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22038" PostTypeId="1" CreationDate="2017-09-19T01:01:24.200" Score="1" ViewCount="178" Body="&lt;p&gt;Is it possible to assign regions to assets similarly to the way that we restrict entries to a region for multi-region/sites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I could specify a path for each region/site as well.&lt;/p&gt;&#xA;" OwnerUserId="7166" LastEditorUserId="7166" LastEditDate="2017-09-19T01:22:51.840" LastActivityDate="2018-04-17T07:54:43.443" Title="Is it possible to restrict assets in multi region/site specific similarly to how you can restrict entries?" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22039" PostTypeId="2" ParentId="22038" CreationDate="2017-09-19T03:45:22.853" Score="1" Body="&lt;p&gt;Currently Asset Volumes in Craft 3 are defined on a global basis.  If you would like to see differently, you can create a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; and be sure to include your use-case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asset fields have advanced settings where you can relate Assets from a specific site or not in the Control Panel under Assets-&gt;Fields-&gt;(your Asset field)-&gt;Advanced&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-19T03:45:22.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22040" PostTypeId="1" AcceptedAnswerId="22041" CreationDate="2017-09-19T08:08:12.377" Score="3" ViewCount="230" Body="&lt;p&gt;I'm trying to set an Entries field within a Commerce Order once the order completes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using the onOrderComplete event like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete',function($event){    &#xA;    $order = $event-&amp;gt;params['order'];&#xA;&#xA;    $order-&amp;gt;setContent(array( 'calculation' =&amp;gt; 678 )); // magic number for testing&#xA;    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);    &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and also;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft()-&amp;gt;on('commerce_orders.onOrderComplete',function($event){    &#xA;     $order = $event-&amp;gt;params['order'];&#xA;&#xA;     $order-&amp;gt;calculation = 678; // magic number for testing&#xA;     craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);    &#xA; });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried setting the field value on the add to cart form with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[calculation][]&quot; value=&quot;678&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again with no luck (I am using MultiAdd so thought it might not be working because of that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the right direction here?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-09-19T08:15:10.157" Title="Set Entries field in Commerce order on completion" Tags="&lt;plugin-craftcommerce&gt;&lt;entries-field&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22041" PostTypeId="2" ParentId="22040" CreationDate="2017-09-19T08:15:10.157" Score="6" Body="&lt;p&gt;See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust&quot;&gt;What is getContent() / the ContentModel, and how do I use it to get and set custom field values?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you needed to change the method used for setting content on an element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1264/in-a-plugin-how-do-i-save-an-entry-with-a-related-entry&quot;&gt;In a plugin, how do I save an entry with a related entry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the relation fields always expect an array of ids, even if there is a single relation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting those together you should be able to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete',function($event){    &#xA;    $order = $event-&amp;gt;params['order'];&#xA;&#xA;    $order-&amp;gt;setContentFromPost(['entryRelaionFieldName' =&amp;gt; [678] ]);&#xA;&#xA;    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);    &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-09-19T08:15:10.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22044" PostTypeId="1" AcceptedAnswerId="22051" CreationDate="2017-09-19T14:01:56.513" Score="1" ViewCount="440" Body="&lt;p&gt;After some unsuccessful uploads I ended up with a lot of loose files in craft/storage/runtime/assets/tempuploads&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They show up in the asset list when selecting assets for new entry. How do I remove them completely from the record?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried manually deleting them via FTP and running &quot;Update Asset Indexes&quot; but that didn't work. Also tried &quot;Clear Caches&quot; options.&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-09-20T04:25:33.650" Title="Clearing temporary assets from craft/storage/runtime" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22045" PostTypeId="1" AcceptedAnswerId="31039" CreationDate="2017-09-19T17:05:54.100" Score="7" ViewCount="2419" Body="&lt;p&gt;I'm building a Vue.js site with Craft as the backend, which works pretty well so far. The only thing I can't get to work yet is live preview.&lt;br&gt;&#xA;Vue-Router relies on the &lt;code&gt;window.location&lt;/code&gt; which is flawed in live preview (&lt;code&gt;https://example.com/admin/entries/pages/1-homepage&lt;/code&gt; instead of &lt;code&gt;https://example.com/homepage&lt;/code&gt;). Is there any way to get this right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update: A new issue popped up.&lt;/strong&gt; About to test things, I noticed the content does not change because - obviously - I pull it from the Element API, which pulls it from the database. I'll update my answer below when I've found a way around this.&lt;/p&gt;&#xA;" OwnerUserId="7275" LastEditorUserId="7275" LastEditDate="2017-09-20T06:34:22.133" LastActivityDate="2019-08-21T10:18:51.200" Title="Live preview using Vue.js" Tags="&lt;frontend&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22046" PostTypeId="2" ParentId="22044" CreationDate="2017-09-20T00:12:11.950" Score="0" Body="&lt;p&gt;If you've already deleted the actual files, you can try rebuilding the Asset Index (via Settings -&gt; Update Asset Indexes&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-20T00:12:11.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22047" PostTypeId="2" ParentId="153" CreationDate="2017-09-20T00:17:32.497" Score="3" Body="&lt;p&gt;This article may help as well: &lt;a href=&quot;https://nystudio107.com/blog/twig-processing-order-and-scope&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Processing Order &amp;amp; Scope&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-20T00:17:32.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22048" PostTypeId="1" AcceptedAnswerId="22050" CreationDate="2017-09-20T00:21:15.250" Score="0" ViewCount="416" Body="&lt;p&gt;Recently new to Craft and Twig although I have used Expression Engine in the past. I am looking for a way to update a for loop that is pulling entries from a defined category based on the current entry/page category by using a dropdown list with all categories available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries: Vehicles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Categories: Truck, Suv, Compact, Economy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fields: Color, numofDoors, passangers, gasmileage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set related = craft.entries.section('vehicles').relatedTo(entryVehicleCategories%}&#xA;&#xA;{% for vehicle in related %}&#xA;&#xA;    {% if related|length %}&#xA;        &amp;lt;h2&amp;gt;Name:{{vehicle.name}}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;color:{{vehicle.color}}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;Number of doors:{{vehicle.numofdoors}}&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;h2&amp;gt;No content&amp;lt;/h2&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;vehicle-search&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;Truck&quot;&amp;gt;Truck&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Suv&quot;&amp;gt; Suv &amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Compact&quot;&amp;gt; Compact &amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;Economy&quot;&amp;gt; Economy &amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Upon form submit I am hoping I can change/set related to something new.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: Current loop is looping and showing all related truck entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Action wanted: User selects suv and div reloads suv entries on page without reloading page.&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="7277" LastEditDate="2017-09-20T12:56:07.627" LastActivityDate="2017-09-20T13:34:23.723" Title="Refresh Craft for loop with form parameters" Tags="&lt;categories&gt;&lt;form&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22049" PostTypeId="2" ParentId="22006" CreationDate="2017-09-20T00:25:27.247" Score="2" Body="&lt;p&gt;To fix the &quot;No Input File&quot; in your Nginx config, you'll need something like this inside if your php location handler:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    try_files $uri $uri/ /index.php?$query_string;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will cause it to run the query through Craft (via &lt;code&gt;index.php&lt;/code&gt;) if the &lt;code&gt;.php&lt;/code&gt; file doesn't exist, which then allows Retour to handle it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this works by hitting a random &lt;code&gt;.php&lt;/code&gt; url on my site: &lt;a href=&quot;https://nystudio107.com/woof.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/woof.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L106&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L106&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-20T00:25:27.247" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22050" PostTypeId="2" ParentId="22048" CreationDate="2017-09-20T03:24:43.310" Score="1" Body="&lt;p&gt;You will need to use JavaScript, either AJAX calling to a template that re-runs a new Twig &lt;code&gt;for&lt;/code&gt; loop and returns the results in HTML, or a framework like Vue or React in conjunction with P&amp;amp;T's &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; that will create an endpoint of your section's entries in JSON format. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you don't mind a page refresh, you can filter your entries dynamically using &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.request&lt;/code&gt;&lt;/a&gt; to grab pretty much whatever you want: a segment from the URL, query string, post data, etc. So basically, when the form submits, your redirect url should go to that page and either you add submitted data to the url via &lt;code&gt;get&lt;/code&gt; or grab the data via &lt;code&gt;post&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, fyi, you have a syntax error in your code: missing a &lt;code&gt;)&lt;/code&gt; at the end of your &lt;code&gt;.relatedTo&lt;/code&gt; ;)&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2017-09-20T13:34:23.723" LastActivityDate="2017-09-20T13:34:23.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22051" PostTypeId="2" ParentId="22044" CreationDate="2017-09-20T04:25:33.650" Score="1" Body="&lt;p&gt;In Craft 2 the only real solution is to delete all the entries from craft_assetfiles where the sourceId is set to &lt;code&gt;null&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why there's no clear cache tool for these is because that might allow for deletion of Assets that were just uploaded by someone else who might be about to use them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really far from a practical solution and we know that, but it's not easily improved in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 will slightly improve things by adding a &quot;Temporary uploads&quot; Asset volume which will hold all of the current user's &lt;em&gt;leftover&lt;/em&gt; Assets, allowing you to deal with them as you would with regular Assets.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-09-20T04:25:33.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22052" PostTypeId="2" ParentId="22045" CreationDate="2017-09-20T06:18:19.857" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br /&gt;&#xA;As of Craft 3.2 there is native support for headless previews. Please&#xA;see &lt;a href=&quot;https://craftcms.stackexchange.com/a/31039/7275&quot;&gt;Cue's extensive answer&lt;/a&gt; for a detailed&#xA;explanation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;br&gt;&#xA;&lt;h3&gt;Original answer&lt;/h3&gt;&#xA;&lt;p&gt;I managed to do this, although I'm still not quite happy with it.&lt;br /&gt;&#xA;First part of the solution is figuring out whether this is a live preview. To do so, I decided to append data attributes to the HTML element. You're free to use global variables or whatever else suits you, though.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% if craft.request.isLivePreview %}&#xA;  &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&#xA;    window.document.documentElement.dataset.livePreview = true;&#xA;    window.document.documentElement.dataset.path        = '{{ '/' ~ craft.request.path }}';&#xA;  &amp;lt;/script&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next up, getting Vue-Router to not use &lt;code&gt;window.location&lt;/code&gt; for route matching and navigating straight to the desired URI:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;const isLivePreview  = window.document.documentElement.dataset.livePreview,&#xA;      actualPath     = window.document.documentElement.dataset.path;&#xA;&#xA;if (isLivePreview) {&#xA;  routerConfig.mode = 'abstract';&#xA;}&#xA;&#xA;const router = new VueRouter(routerConfig);&#xA;&#xA;if (isLivePreview) {&#xA;  router.replace({ path: actualPath });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This makes live preview work like a charm so far. What I don't like, though, is a) the doubled &lt;code&gt;if (isLivePreview)&lt;/code&gt; and b) the need to check this for every visitor and therefore 99% of all requests.&lt;br /&gt;&#xA;If anyone can come up with something better it will be greatly appreciated. I'm leaving the question open for a few days.&lt;/p&gt;&#xA;" OwnerUserId="7275" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-08-21T10:18:51.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22053" PostTypeId="1" CreationDate="2017-09-20T07:03:24.080" Score="0" ViewCount="190" Body="&lt;p&gt;When i have upload the image using below settings that will give me an error  The error message was: &lt;strong&gt;&quot;Error uploading the file: The file system path &quot;/public_html/src/assets/images/&quot; set for this source does not exist.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;general.php file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA; $siteUrl = array(&#xA;    'en_gb' =&amp;gt; 'https://www.ancamotion.com/',&#xA;    'de' =&amp;gt; 'https://www.ancamotion.de/',&#xA;    'zh_cn' =&amp;gt; 'https://www.ancamotion.cn/',&#xA;    'zh_tw' =&amp;gt; 'https://www.ancamotion.com.tw/',&#xA;);&#xA;&#xA;return array(&#xA;&#xA;    '*' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; false,&#xA;        'extraAllowedFileExtensions' =&amp;gt; 'exe, xml',&#xA;        'maxUploadFileSize' =&amp;gt; 67108864,&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'timezone' =&amp;gt; 'Australia/Melbourne',&#xA;        'setPasswordPath' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'securezone/resetpasswordform.html',&#xA;                 'de' =&amp;gt; 'securezone/resetpasswordform.html',&#xA;                  'cn' =&amp;gt; 'securezone/resetpasswordform.html',&#xA;        ),&#xA;        'setPasswordSuccessPath' =&amp;gt; array(&#xA;            'en' =&amp;gt; 'password/thanks-reset.html',&#xA;                'de' =&amp;gt; 'password/thanks-reset.html',&#xA;                'cn' =&amp;gt; 'password/thanks-reset.html',&#xA;        ),&#xA;    ),&#xA;&#xA;   'ancamotion.com' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; $siteUrl,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/public_html/',&#xA;            'baseUrl'  =&amp;gt; 'https://www.ancamotion.com/',&#xA;        ),&#xA;    ),&#xA;   'ancamotion.de' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; $siteUrl,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/public_de/',&#xA;            'baseUrl'  =&amp;gt; 'https://www.ancamotion.de/',&#xA;        ),&#xA;    ),&#xA;   'ancamotion.cn' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; $siteUrl,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/public_cn/',&#xA;            'baseUrl'  =&amp;gt; 'https://www.ancamotion.cn/',&#xA;        ),&#xA;    ),&#xA;   'ancamotion.com.tw' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; $siteUrl,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/public_tw/',&#xA;            'baseUrl'  =&amp;gt; 'https://www.ancamotion.com.tw/',&#xA;        ),&#xA;    ),&#xA;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my settings from website admin Assets are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File System Path --&gt; {basePath}src/assets/images/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL --&gt; {baseUrl}src/assets/images/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You in advanced.&lt;/p&gt;&#xA;" OwnerUserId="7278" LastActivityDate="2017-09-20T07:28:51.617" Title="Having an issue with assets, while i am upload the image from the admin" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22054" PostTypeId="2" ParentId="22053" CreationDate="2017-09-20T07:28:51.617" Score="2" Body="&lt;p&gt;That error message means your &lt;code&gt;basePath&lt;/code&gt; is incorrect and Craft can't find the directory you're referring to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your settings, it looks like Craft would try to upload images to &lt;code&gt;/public_html/src/assets/images/&lt;/code&gt;. If that's correct, try using &lt;code&gt;/&lt;/code&gt; or nothing instead of your current &lt;code&gt;basePath&lt;/code&gt;. And make sure the folder exists on the server.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-09-20T07:28:51.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22056" PostTypeId="1" CreationDate="2017-09-20T09:43:36.460" Score="1" ViewCount="239" Body="&lt;p&gt;I don't have any logs appearing in &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; (in fact I don't have anything at all in &lt;code&gt;craft/storage/runtime&lt;/code&gt;.  I'm running Craft on Heroku.  I've tried setting post-install scripts in the &lt;code&gt;composer.json&lt;/code&gt; file to run&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chmod -R 774 craft/storage&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it doesn't change the permissions (they remain at 700).  We run Papertrail to collect logs from the dynos, but these only seem to include web requests - no application logging.  I've tried enabling &lt;code&gt;devMode&lt;/code&gt;, but it makes no difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to debug some issues we have with the application occasionally falling over, but without access to logs it's impossible - is there any way to make Craft start logging?  Just logging to stdout would be fine, as Papertrail would collect the logs. I can't find any configuration options, maybe I've missed them?&lt;/p&gt;&#xA;" OwnerUserId="7107" LastActivityDate="2018-04-18T23:23:54.037" Title="Craft on Heroku is not logging. How can I make it start?" Tags="&lt;logging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22057" PostTypeId="1" AcceptedAnswerId="22059" CreationDate="2017-09-20T11:31:54.330" Score="2" ViewCount="388" Body="&lt;p&gt;I have a client who wants to search for specific PDF files when she makes use of Craft's search function. The way she wants the PDF's to be found is that the words inside of the PDF is somehow processed by Craft and when you search for certain words that are included in a PDF it will show results of PDF's that contain these search words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have Googled for a module that can do such a thing but so far I have no luck. Does anyone know if such a module/plugin exists for Craft or do I need to hire someone to create that for me? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for reading.&lt;/p&gt;&#xA;" OwnerUserId="4732" LastActivityDate="2017-09-21T15:33:55.697" Title="Possibility to use Craft's search function to search in PDF files" Tags="&lt;plugins&gt;&lt;search&gt;&lt;pdf&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22059" PostTypeId="2" ParentId="22057" CreationDate="2017-09-20T12:35:03.067" Score="3" Body="&lt;p&gt;As far as I know, there is no ready-built solutions available for Craft that makes text in PDFs searchable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably have to look into building this plugin yourself, or hire someone to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Posting in the #jobs channel on Craft's Slack is a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2017-09-20T12:35:03.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22060" PostTypeId="1" CreationDate="2017-09-20T12:44:51.400" Score="0" ViewCount="292" Body="&lt;p&gt;following situation: let's assume I have page with some &lt;strong&gt;ARTICLES&lt;/strong&gt; (textfields): Article1, Article2, Article3, etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now is there a module for CraftCMS that I can add textfields (articles) to a page directly in the backend (admin page)? So when I want to add a new article, then I don't have to do this with PHP or else.&lt;/p&gt;&#xA;" OwnerUserId="7281" LastEditorUserId="57" LastEditDate="2017-09-20T18:51:13.287" LastActivityDate="2017-09-20T18:51:13.287" Title="Add fields/custom fields to page in the admin page (backend)" Tags="&lt;plugins&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22061" PostTypeId="2" ParentId="22057" CreationDate="2017-09-20T14:09:45.707" Score="1" Body="&lt;p&gt;It's not as neat as something automated but could add a custom field to your asset type (or if each PDF has an entry, to that entry type) called something like 'PDF Content'. I would probably make it a multi-line plain text field. You can then get your client to copy and paste all the content from the pdf into that field when uploading and use this content to search from.&lt;/p&gt;&#xA;" OwnerUserId="526" LastActivityDate="2017-09-20T14:09:45.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22063" PostTypeId="1" AcceptedAnswerId="22162" CreationDate="2017-09-20T15:22:08.157" Score="1" ViewCount="134" Body="&lt;p&gt;I've got an error message from my craft (2.6.2990) after adding a German locale: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Resaving all localizable elements: Failed&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Resaving matrix blocks: Failed &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;in the sidebar and here is what I found in craft logs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2017/09/20 14:52:13 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'zg_blike.craft_matrixcontent_files' doesn't exist. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `matrixblocks`.`fieldId`, `matrixblocks`.`ownerId`, `matrixblocks`.`ownerLocale`, `matrixblocks`.`typeId`, `matrixblocks`.`sortOrder`&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked the DB and of course did not find table called &lt;code&gt;craft_matrixcontent_files&lt;/code&gt;, instead only &lt;code&gt;craft_matrixcontent_file&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7096" LastActivityDate="2017-09-28T21:54:47.710" Title="Problem adding new locale / Resaving matrix blocks Failed / Table 'matrixcontent_files' doesn't exist" Tags="&lt;localization&gt;&lt;error&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22064" PostTypeId="2" ParentId="18639" CreationDate="2017-09-20T16:46:12.100" Score="1" Body="&lt;p&gt;I imagine you must have noticed this as your text editor would have highlighted them, but if not check your quote marks. Even if wrapping them in both quotations is intentional, you still have one that is ‘ and one that is '. They look similar but are not the same. run your code through this to clean special characters.&#xA;&lt;a href=&quot;http://www.nousphere.net/cleanspecial.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.nousphere.net/cleanspecial.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-09-20T16:46:12.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22065" PostTypeId="2" ParentId="16567" CreationDate="2017-09-20T16:48:26.600" Score="2" Body="&lt;p&gt;I've had this same problem getting Printmaker use an external stylesheet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply putting the styles in the head of the template sorted it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also try setting the path to your css with a &lt;code&gt;.&lt;/code&gt; like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;./path/to/styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2017-09-20T18:01:24.820" LastActivityDate="2017-09-20T18:01:24.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22066" PostTypeId="1" CreationDate="2017-09-20T16:53:44.273" Score="1" ViewCount="1085" Body="&lt;p&gt;I'm super new to Craft and was wondering if someone could help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set up a hero banner. So there will be a full-width image, on top of this will be the heading text and a CTA button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the background to be editable by the user so have set up a field for this called 'hero image'. This is how it looks now but it doesn't seem to be working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;hero-image&quot; style=&quot;background-image: url('{{heroImage}}');&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;home&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;hero-overlay&quot;&amp;gt;&#xA;            &amp;lt;header id=&quot;site-header&quot;&amp;gt;  &#xA;                &amp;lt;div class=&quot;main-message&quot;&amp;gt;  &#xA;                    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;description-image&quot;&amp;gt;&#xA;                            {{ entry.description }}&#xA;                        &amp;lt;/p&amp;gt;&#xA;&#xA;                        &amp;lt;a class=&quot;btn btn-cta-primary btn-cta-blue&quot; href=&quot;{{entry.buttonUrl}}&quot; role=&quot;button&quot;&amp;gt;{{ entry.buttonText }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm so confused!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7282" LastEditorUserId="57" LastEditDate="2017-09-20T18:49:05.517" LastActivityDate="2017-09-20T18:49:05.517" Title="Dynamic background image" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22067" PostTypeId="2" ParentId="22066" CreationDate="2017-09-20T17:22:50.297" Score="1" Body="&lt;p&gt;I see a few issues with your code. (1) Unless you set &lt;code&gt;heroImage&lt;/code&gt; as a variable somewhere, then you need to change &lt;code&gt;heroImage&lt;/code&gt; to &lt;code&gt;entry.heroImage&lt;/code&gt;. (2) But, an asset field returns an assetModel, not the actual image. To access the image, you need to use &lt;code&gt;.first()&lt;/code&gt; to select the first asset in the assetModel. (3) Then you need to access the URL on that image, by using &lt;code&gt;url&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set heroImage = entry.heroImage.first() %}&#xA;&#xA;&amp;lt;div class=&quot;hero-image&quot; style=&quot;background-image: url('{{ heroImage.url() }}');&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;home&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;hero-overlay&quot;&amp;gt;&#xA;            &amp;lt;header id=&quot;site-header&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;main-message&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                        &amp;lt;p class=&quot;description-image&quot;&amp;gt; {{ entry.description }}&amp;lt;/p&amp;gt;&#xA;                        &amp;lt;a class=&quot;btn btn-cta-primary btn-cta-blue&quot; href=&quot;{{ entry.buttonUrl }}&quot; role=&quot;button&quot;&amp;gt;{{ entry.buttonText }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2017-09-20T17:22:50.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22068" PostTypeId="2" ParentId="22060" CreationDate="2017-09-20T17:32:23.710" Score="1" Body="&lt;p&gt;Craft CMS is a full-featured CMS. You should not need to use PHP at all unless you need very custom functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like what you should do is create an &quot;Articles&quot; Section, and add whatever fields you need for articles into that section's layout. Then you'll have a nice user-friendly way to enter content on the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see: &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sections and Entries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-20T17:32:23.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22069" PostTypeId="2" ParentId="22056" CreationDate="2017-09-20T18:42:39.987" Score="1" Body="&lt;p&gt;There is a plugin that redirects all of Craft log output to stderr that works on Heroku and Fortrabbit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ostark/craft-stderr-logger&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ostark/craft-stderr-logger&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-20T18:42:39.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22070" PostTypeId="1" AcceptedAnswerId="22072" CreationDate="2017-09-20T19:19:22.670" Score="1" ViewCount="106" Body="&lt;p&gt;I'm looking to format out image tags from a string using the &lt;code&gt;|replace&lt;/code&gt; filter. The behavior I'm looking for is to give it a string like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;img src=&quot;test.jpg&quot;&amp;gt;&amp;lt;p&amp;gt;some text&amp;lt;/p&amp;gt;&amp;lt;img src=&quot;test.jpg&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and get back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;p&amp;gt;some text&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, when I use &lt;code&gt;{{ snippet|replace('/&amp;lt;img(.*)&amp;gt;/', '') }}&lt;/code&gt; it matches the entire string, from the opening &lt;code&gt;&amp;lt;img&lt;/code&gt; to the second image's closing &lt;code&gt;&amp;gt;&lt;/code&gt; rather than matching both &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags individually. How can I force the regex to match only through the first &lt;code&gt;&amp;gt;&lt;/code&gt; it finds before continuing?&lt;/p&gt;&#xA;" OwnerUserId="7260" LastActivityDate="2017-09-20T20:12:49.220" Title="|replace filter is matching too many characters" Tags="&lt;filter&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22072" PostTypeId="2" ParentId="22070" CreationDate="2017-09-20T20:12:49.220" Score="1" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ snippet|replace('/&amp;lt;img([\w\W]+?)&amp;gt;/', '') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see an explanation of the regex in the right column of &lt;a href=&quot;https://regex101.com/r/DvJHeY/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://regex101.com/r/DvJHeY/1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-20T20:12:49.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22073" PostTypeId="1" CreationDate="2017-09-20T20:59:30.810" Score="2" ViewCount="1252" Body="&lt;p&gt;I'm filtering entries based off a searchbar with multiple parameters, and I'm building up an entries filter based off of them. Everything works great except for having more than one .search functions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set req = craft.request %}&#xA;&#xA;{% set results = craft.entries.section(&quot;properties&quot;) %}&#xA;&#xA;{% set params = ['location', 'min-price', 'max-price', 'status'] %}&#xA;{% set query = {} %}&#xA;&#xA;{% for param in params %}&#xA;  {% set key = param | camel %}&#xA;  {% set value = req.getParam(param) %}&#xA;  {% set query = query | merge({ (key):(value) }) %}&#xA;{% endfor %}&#xA;&#xA;{% if query.location %}&#xA;  {% set results = results.search(query.location) %}&#xA;{% endif %}&#xA;&#xA;{% if query.minPrice or query.maxPrice %}&#xA;  {% set min = query.minPrice ? query.minPrice : '' %}&#xA;  {% set max = query.maxPrice ? query.maxPrice : '' %}&#xA;  {% set results = results.search(&quot;price:&quot; ~ '500000') %}&#xA;{% endif %}&#xA;&#xA;{% if query.status %}&#xA;  {% set results = results.search('statusCategory:' ~ query.status) %}&#xA;{% endif %}&#xA;&#xA;{% for entry in results %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've removed the whole min/max part just to simplify things, but it seems that if there is both a location and min/max price parameter, whichever one is last overrides the first. How can I combine these search parameters?&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2018-03-19T23:36:16.583" Title="How do I search craft.entries with multiple parameters?" Tags="&lt;form&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22074" PostTypeId="2" ParentId="22073" CreationDate="2017-09-20T21:31:31.943" Score="2" Body="&lt;p&gt;100% untested, but try something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're basically creating an array of all of your &lt;code&gt;search&lt;/code&gt; criteria, then joining them into one &lt;code&gt;.search()&lt;/code&gt; call at the end as a string separated with a space.  That's because Craft does &quot;and&quot; &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;searching&lt;/a&gt; with multiple terms by default.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set req = craft.request %}&#xA;&#xA;{% set results = craft.entries.section(&quot;properties&quot;) %}&#xA;&#xA;{% set params = ['location', 'min-price', 'max-price', 'status'] %}&#xA;{% set query = {} %}&#xA;{% set search = [] %}&#xA;&#xA;{% for param in params %}&#xA;    {% set key = param | camel %}&#xA;    {% set value = req.getParam(param) %}&#xA;    {% set query = query | merge({ (key):(value) }) %}&#xA;{% endfor %}&#xA;&#xA;{% if query.location %}&#xA;    {% set search = search|merge([query.location]) %}&#xA;{% endif %}&#xA;&#xA;{% if query.minPrice or query.maxPrice %}&#xA;    {% set min = query.minPrice ? query.minPrice : '' %}&#xA;    {% set max = query.maxPrice ? query.maxPrice : '' %}&#xA;    {% set search = search|merge([&quot;price:&quot; ~ '500000']) %}&#xA;{% endif %}&#xA;&#xA;{% if query.status %}&#xA;    {% set search = search|merge(['statusCategory:' ~ query.status]) %}&#xA;{% endif %}&#xA;&#xA;{% if search|length %}&#xA;    {% set results = results.search(search|join(' ') %}&#xA;{% endif %}&#xA;&#xA;{% for entry in results %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-20T21:31:31.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22075" PostTypeId="1" CreationDate="2017-09-21T10:24:56.853" Score="1" ViewCount="430" Body="&lt;p&gt;I have been working locally on MAMP and now have deployed the site to Digital Ocean using this &lt;a href=&quot;https://deploybot.com/guides/deploy-craft-cms-to-digitalocean&quot; rel=&quot;nofollow noreferrer&quot;&gt;guide&lt;/a&gt;.&#xA;However I can't access the site. for page links I get the service unavailable error, and for the admin I get the &lt;code&gt;'Craft can’t connect to the database with the credentials in craft/config/db.php.'&lt;/code&gt; error. &#xA;i have checked my database credentials many times and they match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft'&#xA;    ),&#xA;    '000.00.000.00' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'craftcms',&#xA;        'password' =&amp;gt; '************',&#xA;        'database' =&amp;gt; 'craft'&#xA;    ),&#xA;    'localhost' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; '************',&#xA;        'database' =&amp;gt; 'craftdev'&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my general config settings are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(   &#xA;        //'siteUrl' =&amp;gt; &quot;//projectname:8888/html/&quot;,&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/users/toddpadwick/Sites/projectname/html/',&#xA;            'siteUrl'  =&amp;gt; '//projectname:8888/html/',&#xA;        ),&#xA;        'testToEmailAddress' =&amp;gt; 'email@email.com',&#xA;        // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;        'defaultWeekStartDay' =&amp;gt; 0,&#xA;        // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        // Whether &quot;index.php&quot; should be visible in URLs (true, false, &quot;auto&quot;)&#xA;        'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;        // Control Panel trigger word&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;        // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;        'devMode' =&amp;gt; true,&#xA;    ),&#xA;    // Use IP address of your droplet below&#xA;    '000.00.000.00' =&amp;gt; array(&#xA;&#xA;        //'siteUrl' =&amp;gt; 'http://000.00.000.00/',&#xA;&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'basePath' =&amp;gt; '/var/www/html/',&#xA;            'siteUrl'  =&amp;gt; 'http://000.00.000.00/',&#xA;        ),&#xA;        // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;        'defaultWeekStartDay' =&amp;gt; 0,&#xA;        // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        // Whether &quot;index.php&quot; should be visible in URLs (true, false, &quot;auto&quot;)&#xA;        'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;        // Control Panel trigger word&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;        // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;        'devMode' =&amp;gt; false,&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-09-26T10:02:02.180" Title="Craft on digital ocean Ubuntu: Craft can’t connect to the database with the credentials in craft/config/db.php" Tags="&lt;database&gt;&lt;config&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22076" PostTypeId="2" ParentId="22075" CreationDate="2017-09-21T10:40:47.590" Score="1" Body="&lt;p&gt;Could you post your nginx/apache configuration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short the configuration array key is matched based on the server name (server_name in nginx, ServerName in Apache httpd iirc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using some sort of default configuration it might not have a server_name, or a bogus one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if your configuration array is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;&#xA;  '1.2.3.4' =&amp;gt; array(&#xA;    'someSetting' =&amp;gt; 'foo'&#xA;  );&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should have a corresponding configuration in (nginx in this example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;  listen 80;&#xA;  server_name 1.2.3.4;&#xA;  ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have more than one host in server_name, Craft will match on the first.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-09-21T10:40:47.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22077" PostTypeId="2" ParentId="18639" CreationDate="2017-09-21T10:55:42.997" Score="1" Body="&lt;p&gt;If your db is on an aws rds instance you have to update the host parameter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find it in the aws management console, it will be something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;rdsname&amp;gt;.&amp;lt;random stuff&amp;gt;.&amp;lt;region&amp;gt;.rds.amazonaws.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All in all after looking at the post I would say it is fairly outdated and I wouldn't recommend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read this article: &lt;a href=&quot;https://nystudio107.com/blog/web-hosting-for-agencies-freelancers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/web-hosting-for-agencies-freelancers&lt;/a&gt; and if you're not a server guy, consider outsourcing it to forge or similar.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-09-21T10:55:42.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22078" PostTypeId="2" ParentId="22075" CreationDate="2017-09-21T13:18:30.227" Score="1" Body="&lt;p&gt;Are you able to use a domain name rather than an IP address?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, try moving the connection details into the '*' section like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft'&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'craftcms',&#xA;        'password' =&amp;gt; '************',&#xA;        'database' =&amp;gt; 'craft'&#xA;    ),&#xA;&#xA;    'localhost' =&amp;gt; array(&#xA;        'server' =&amp;gt; 'localhost',&#xA;        'user' =&amp;gt; 'root',&#xA;        'password' =&amp;gt; '************',&#xA;        'database' =&amp;gt; 'craftdev'&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and give that a try&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-09-21T13:18:30.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22079" PostTypeId="1" CreationDate="2017-09-21T13:31:01.993" Score="1" ViewCount="106" Body="&lt;p&gt;What's the best way to accomplish a variable subscription amount with the Charge plugin? I.e. the Stripe payment amount needs to change from month to month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, say a subscription is £0.99 each month, and then additional purchases are £0.99 on top of this, can I update the subscription somehow before the charge date with the final amount, or can I put through additional payments each month using the Stripe ID attached to the subscription?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5304" LastEditorUserId="57" LastEditDate="2017-09-21T14:32:11.030" LastActivityDate="2017-09-21T14:32:11.030" Title="Charge Plugin v2.2.1: Variable subscription amounts" Tags="&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22082" PostTypeId="2" ParentId="22057" CreationDate="2017-09-21T15:33:55.697" Score="3" Body="&lt;p&gt;I would also suggest a custom plugin approach. A good starting point would be this package: &lt;a href=&quot;https://github.com/smalot/pdfparser&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/smalot/pdfparser&lt;/a&gt;. I am mostly including this answer for anyone who happens to find this question and has the ability/inclination to create such a plugin.&lt;/p&gt;&#xA;" OwnerUserId="7290" LastActivityDate="2017-09-21T15:33:55.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22083" PostTypeId="2" ParentId="13748" CreationDate="2017-09-21T15:41:36.727" Score="3" Body="&lt;p&gt;I just came across this problem and solved it by editing the &lt;strong&gt;JsonExpandService.php&lt;/strong&gt; file (located in craft/plugins/jsonexpand/services/) in two places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change line 101 from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$relatedArray[$subHandle] = $subValue;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($subField['type'] == &quot;RichText&quot;) {&#xA;    // Rich Text field values need to be converted to a string&#xA;    $relatedArray[$subHandle] = (string)$subValue;&#xA;} else {&#xA;    $relatedArray[$subHandle] = $subValue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And change line 115 from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryData[$handle] = $value;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($field['type'] == &quot;RichText&quot;) {&#xA;    $entryData[$handle] = (string)$value;&#xA;} else {&#xA;    $entryData[$handle] = $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This fixed Rich Text fields coming through as empty objects for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin hasn't been updated in 3 years, so Craft probably changed something about how Rich Text fields are outputted and the plugin never adjusted. Just a guess.&lt;/p&gt;&#xA;" OwnerUserId="7291" LastActivityDate="2017-09-21T15:41:36.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22085" PostTypeId="1" AcceptedAnswerId="22098" CreationDate="2017-09-21T21:46:48.817" Score="0" ViewCount="84" Body="&lt;p&gt;How would you go about pulling a selected entry from one channel into another entry using Craft variables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a page with an author channel field that allows a user to select the author from entries in an author channel. Once selected, I am wanting the page to display the author content from the selected Author entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using the following but have gotten no output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.authorTeamMember|length %} &#xA;    {% set myEntry = entry.authorTeamMember.first() %}&#xA;&#xA;    {{entry.authorName}}&#xA;    {{entry.authorDescription}}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No Author&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="57" LastEditDate="2017-09-21T22:40:12.023" LastActivityDate="2017-09-23T03:33:30.813" Title="Calling Sub Channel Entries" Tags="&lt;entries-field&gt;&lt;channels&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22086" PostTypeId="2" ParentId="22085" CreationDate="2017-09-21T22:42:14.290" Score="0" Body="&lt;p&gt;You're close!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You select the author correctly with and assign it to the &lt;code&gt;myEntry&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntry = entry.authorTeamMember.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you just need to output the data from &lt;code&gt;myEntry&lt;/code&gt; instead of &lt;code&gt;entry&lt;/code&gt;.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.authorTeamMember|length %} &#xA;    {% set myEntry = entry.authorTeamMember.first() %}&#xA;&#xA;    {{ myEntry.authorName }}&#xA;    {{ myEntry.authorDescription }}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No Author&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-21T22:42:14.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22087" PostTypeId="1" CreationDate="2017-09-22T09:47:54.107" Score="0" ViewCount="111" Body="&lt;p&gt;I have an odd situation on a multi-lingual site I am building. I have the site set up on my local dev server and it works fine switching between languages. I have now added the site to an external server to show the client on a subdomain so test-dev.mydomain.com. Everything is exactly the same and the config file has been set up to target this domain. However now switching to another language only brings up the English version of the site when navigating past the home page. Any ideas what is happening here? Could this be because it is sitting on a subdomain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Config snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'test-dev.mydomain.com' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; 'true',&#xA;    'env' =&amp;gt; 'dev',&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteStore' =&amp;gt; '/assets',&#xA;        'sitePath'  =&amp;gt; 'http://test-dev.mydomain.com/',&#xA;    ),&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en_gb' =&amp;gt; 'http://test-dev.mydomain.com/',&#xA;        'de_de' =&amp;gt; 'http://test-dev.mydomain.com/de/',&#xA;        'pl_pl' =&amp;gt; 'http://test-dev.mydomain.com/pl/',&#xA;        ),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-10-27T16:52:25.390" Title="Multi language site not working on sub domain" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22088" PostTypeId="1" AcceptedAnswerId="23823" CreationDate="2017-09-22T11:26:32.877" Score="2" ViewCount="244" Body="&lt;p&gt;I'm generating a PDF from a template using the Printmaker plugin.&#xA;My CSS is being picked up and rendered mostly correctly and&#xA;if the template is rendered to screen as HTML then the fonts work. However I can't get the fonts to work with the PDF generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what I need to do to get the font information embedded within the PDF?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-02-13T02:18:44.017" Title="Custom fonts with Printmaker" Tags="&lt;plugin-printmaker&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22089" PostTypeId="2" ParentId="22088" CreationDate="2017-09-22T11:58:25.753" Score="1" Body="&lt;p&gt;Seemed to be a matter of requiring the full URL to the font file and removal of any weight declarations in the CSS.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-09-22T11:58:25.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22090" PostTypeId="1" CreationDate="2017-09-22T15:38:31.863" Score="1" ViewCount="452" Body="&lt;p&gt;I'm trying to remove duplicate image objects from an array, but can't figure out why it won't find it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in product.productGallery %}&#xA;    {% set productGalleryArray = productGalleryArray|merge([image]) %}&#xA;{% endfor %}&#xA;&#xA;{% for variant in product.variants %}&#xA;    {% set variantImage = variant.productVariantImage.first() %}&#xA;    {% if variantImage|length and variantImage not in productGalleryArray %}&#xA;        {% set productGalleryArray = productGalleryArray|merge([variantImage]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if productGalleryArray|length %}&#xA;    &amp;lt;div class=&quot;slideshow&quot;&amp;gt;&#xA;        {% for image in productGalleryArray %}&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially what I'm trying to do is have a &lt;code&gt;productGallery&lt;/code&gt; field which you can add images to, but also add an image to the product variant via &lt;code&gt;productVariantImage&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can cause the issue where by theres duplicate of the same image being output from the slideshow after it's merged the two fields together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I need to ideally:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Remove the duplicates before the array is merged, OR&lt;/li&gt;&#xA;&lt;li&gt;Find and remove duplicates after the array is merged (Via a Twig filter?)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-09-22T17:41:01.690" Title="Checking for duplicates in array" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22092" PostTypeId="1" AcceptedAnswerId="22094" CreationDate="2017-09-22T16:16:14.710" Score="1" ViewCount="101" Body="&lt;p&gt;So I have some entries and one of the fields is for a &quot;hotline&quot;. The hotlines are all entries. The CMS part works, I can click the field and choose an entry from the hotlines channel, however this is where I'm stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin code I cannot seem to figure out a way to actually get the hotline that was chosen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;$center&lt;/code&gt; variable which is an &lt;code&gt;EntryModel&lt;/code&gt; of the entry that has the field for &quot;hotlines&quot; attached to it, with the value set (according to the admin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$center-&amp;gt;hotline&lt;/code&gt; and &lt;code&gt;$center-&amp;gt;getFieldValue('hotline')&lt;/code&gt; just return an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; and when I inspect that object inside xdebug there is nothing there that would be usable in getting the actual hotline that's selected. No ID. No object. No nothing. Just information about the field it self, not the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the heck am I doing wrong here? This is so &quot;unintuitive&quot; compared to the rest of craft! &lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-09-22T16:29:24.067" Title="Entry FieldType - Get the EntryModel of the entry chosen in the field?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22093" PostTypeId="2" ParentId="22092" CreationDate="2017-09-22T16:23:23.217" Score="1" Body="&lt;p&gt;Nevermind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently I have to grab &lt;code&gt;first()&lt;/code&gt; which will give me the selected entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I tried this before and it didn't work. I must have been in the wrong context or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$center-&amp;gt;getFieldValue('hotline')-&amp;gt;first();&lt;/code&gt;&#xA;or&#xA;&lt;code&gt;$center-&amp;gt;hotline-&amp;gt;first();&lt;/code&gt; is what I needed.&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-09-22T16:23:23.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22094" PostTypeId="2" ParentId="22092" CreationDate="2017-09-22T16:29:24.067" Score="1" Body="&lt;p&gt;This is the same as using &lt;code&gt;craft.entries&lt;/code&gt; in Twig. To get the entries from a &lt;code&gt;ElementCriteriaModel&lt;/code&gt; you need to call the &lt;code&gt;find()&lt;/code&gt; method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a plugin you can do this like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$relatedEntries = $center-&amp;gt;hotline-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable &lt;code&gt;$relatedEntries&lt;/code&gt; will be an array of &lt;code&gt;EntryModel&lt;/code&gt;s if multiple entries are related in the field or a single &lt;code&gt;EntryModel&lt;/code&gt; if there is a single entry related in the field. &lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2017-09-22T16:29:24.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22095" PostTypeId="2" ParentId="22090" CreationDate="2017-09-22T17:41:01.690" Score="1" Body="&lt;p&gt;I think you're checking correctly with &lt;code&gt;{% if variantImage not in productGalleryArray %}&lt;/code&gt; (this should check if &lt;code&gt;variantImage&lt;/code&gt; isn't already in the array), but your code doesn't seem to set a &lt;code&gt;productGalleryArray&lt;/code&gt; array in the global scope. Variables initially set inside &lt;code&gt;for&lt;/code&gt; loops are scoped only to that &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think you just need to declare an empty array at the top of your code &lt;em&gt;outside&lt;/em&gt; and &lt;em&gt;before&lt;/em&gt; the first &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productGalleryArray = [] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-22T17:41:01.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22096" PostTypeId="2" ParentId="22006" CreationDate="2017-09-22T20:14:19.200" Score="0" Body="&lt;p&gt;I ended up writing php files in the public directory to redirect users:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;public/gallery.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;if($_SERVER['QUERY_STRING']){&#xA;    parse_str($_SERVER['QUERY_STRING']);&#xA;    if($q){&#xA;        header(&quot;Location: https://&quot;.$_SERVER['SERVER_NAME'].&quot;/?filter=&quot;.$q);&#xA;        die();&#xA;    } else {&#xA;        header(&quot;Location: https://&quot;.$_SERVER['SERVER_NAME'].&quot;/&quot;);&#xA;        die();&#xA;    }&#xA;}&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2017-09-22T20:14:19.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22097" PostTypeId="2" ParentId="2085" CreationDate="2017-09-22T20:54:09.077" Score="5" Body="&lt;p&gt;I just released a plugin to solve this problem. No apache/nginx needed, just a simple plugin to install directly in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/dgrigg/knockknock&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/dgrigg/knockknock&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="728" LastActivityDate="2017-09-22T20:54:09.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22098" PostTypeId="2" ParentId="22085" CreationDate="2017-09-22T21:58:05.637" Score="0" Body="&lt;p&gt;So I had to adjust Brads code slightly and tweak it to get what I wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue: I was getting some entrys but not all the entrys I wanted when I was pulling a list as one of my entryfields for my page was a channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I was pulling the information for my authorName from myEntry, myEntry was assigned to the channel field and would only pick up and register the first author entry i created. I had to change &lt;code&gt;{{ myEntry.AuthorName }}&lt;/code&gt; to &lt;code&gt;{{ myEntry.Title }}&lt;/code&gt; as the channel entry for each author had a title field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.authorTeamMember|length %} &#xA;    {% set myEntry = entry.authorTeamMember.first() %}&#xA;&#xA;    {{ myEntry.Title }}&#xA;    {{ myEntry.authorDescription }}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;No Author&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="57" LastEditDate="2017-09-23T03:33:30.813" LastActivityDate="2017-09-23T03:33:30.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22100" PostTypeId="1" CreationDate="2017-09-23T01:00:46.087" Score="1" ViewCount="95" Body="&lt;p&gt;I am trying to pull channel entries and display them using a loop. These entries would then be organized by the category they are assigned to based on a categoryfield a user selects when creating the entry. Below is the code I am beginning with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.myCategoriesField.first() %}&#xA;{% if category %}&#xA; {% for car in craft.entries.section('category')%}&#xA;  **Might need a set option here for entries??**&#xA;&#xA;  {{car.Title}}&#xA;  {{car.carDescription}}&#xA;&#xA; {%endfor%}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Car&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prius: {{Description}}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Truck&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ram {{Description}}&lt;/li&gt;&#xA;&lt;li&gt;Silverado{{Description}}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;SUV&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Suburban {{Description}}&lt;/li&gt;&#xA;&lt;li&gt;Escape {{Description}}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or direction would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked into the following code but don't think it would work the way I want to.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.myCategoriesField.first() %}&#xA;{% if category %}&#xA;    ...&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7277" LastActivityDate="2017-09-24T20:14:22.207" Title="Pulling categorized entries in a category loop" Tags="&lt;categories&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22101" PostTypeId="2" ParentId="22100" CreationDate="2017-09-23T23:18:39.140" Score="1" Body="&lt;p&gt;Have part of the solution which is to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = entry.categoriesFieldHandle %}&#xA;{% if categories | length %}&#xA;&#xA;&amp;lt;h3&amp;gt;Some great categories&amp;lt;/h3&amp;gt;&#xA;{% nav category in categories %}&#xA;    {%for entry%}&#xA;    {%endfor%}&#xA;&#xA;{% endnav %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just now need to find out how to add the Category Title in and work on separating the entries out.&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="7277" LastEditDate="2017-09-24T20:14:22.207" LastActivityDate="2017-09-24T20:14:22.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22102" PostTypeId="1" CreationDate="2017-09-24T21:34:07.680" Score="1" ViewCount="84" Body="&lt;p&gt;We're writing an article on the largest Craft sites built and I'm having some challenges finding this information. Ideally, we want to compile a list of the top 20. &quot;Largest&quot; is determined by certain criteria like: Traffic (uniques/month; and pages/month); Number of Entries, Number of Members; Number of forum posts, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came across this article &lt;a href=&quot;https://straightupcraft.com/articles/who-uses-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/who-uses-craft-cms&lt;/a&gt; as a start to find out some basic info on sites built in Craft but it doesn't provide me with any info that would suggest these are some of the largest sites. In fact, when I entered in some of the names from that list into Alexa &lt;a href=&quot;https://www.alexa.com/siteinfo&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.alexa.com/siteinfo&lt;/a&gt; their global ranking was quite low. I'm seeking help on how to surface this info.&lt;/p&gt;&#xA;" OwnerUserId="7296" LastEditorUserId="45" LastEditDate="2018-08-20T22:55:31.590" LastActivityDate="2018-08-20T22:55:31.590" Title="Seeking information on the largest Craft sites built" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22103" PostTypeId="1" AcceptedAnswerId="22114" CreationDate="2017-09-24T22:03:40.817" Score="1" ViewCount="139" Body="&lt;p&gt;How do you set a variable to a specific category so you can do an if or for loop? I have entries(staffList) associated to categories (Management,Staff,Other,PartTime)and I am trying to set a variable to do a loop off of and pull the entry fields but am having a difficult time setting the variable to pull just a specific category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is what I am using to set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set staff = craft.entries.section('staffList').relatedTo('Management') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas where I am going wrong?&lt;/p&gt;&#xA;" OwnerUserId="7277" LastActivityDate="2017-09-25T23:16:15.320" Title="Setting Variable to Specific Category for Loop" Tags="&lt;categories&gt;&lt;craft3&gt;&lt;set&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22104" PostTypeId="1" CreationDate="2017-09-25T07:34:54.203" Score="0" ViewCount="216" Body="&lt;p&gt;Want to add page number to title and meta description because I have a lot of duplicates. Could you tell me how I can do it?  &lt;/p&gt;&#xA;" OwnerUserId="7297" LastEditorUserId="57" LastEditDate="2017-09-25T19:00:34.877" LastActivityDate="2017-09-29T15:34:33.427" Title="Add page number to Title and meta desc" Tags="&lt;pagination&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22105" PostTypeId="1" AcceptedAnswerId="22108" CreationDate="2017-09-25T07:46:16.440" Score="2" ViewCount="80" Body="&lt;p&gt;I have imported data with 18000+ entries. It's a list of product models with brands associated to each. The product model is being used as the title and the brand field is plain text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are approximately 140 brands which I need to output as a dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't output this many entries and then try and group (and order them) on the template as it crashes the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is code that would work if it didn't crash the page (and would take minutes to load the page even if it didn't).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('solarWaterHeaterModels').order('brand asc').limit(null).find() %}&#xA;&#xA;{% set allEntriesByBrand = allEntries|group('brand') %}&#xA;&#xA;{% for brand, entriesInBrand in allEntriesByBrand %}&#xA;&#xA;    {% for entry in entriesInBrand %}&#xA;        {% if loop.index == 1 %}&#xA;            &amp;lt;option value=&quot;{{ entry.brand }}&quot;&amp;gt;{{ entry.brand }}&amp;lt;/option&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer some guidance on how to approach this please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="4823" LastActivityDate="2017-09-25T11:19:39.860" Title="Grouping a large number of entries" Tags="&lt;group&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22106" PostTypeId="1" CreationDate="2017-09-25T09:34:29.600" Score="1" ViewCount="98" Body="&lt;p&gt;I have a basic contact form set up and working but I've now got to change it to make it support locales. So depending on what language version of the website you are looking at, the form submits to a different address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I have so far is I've set up several forms one for each language with their form handles being &lt;code&gt;contact_en&lt;/code&gt;, &lt;code&gt;contact_de&lt;/code&gt; etc, which is working fine I get submissions to the different forms. What I haven't got working is the validation, in particular how reference the submitted field and get any errors. In the original working form my form handle was &lt;code&gt;contact&lt;/code&gt;, so to reference the field I used &lt;code&gt;contact.fullName&lt;/code&gt;, this worked fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now to setup the form initially I'm using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set form = craft.amForms.getForm('contact_' ~ craft.locale) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get a handle to the form so I can reference the fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set formHandle = form.handle %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just returns a string, so it fails if I tried to reference a field like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ formHandle.fullName }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there's a straightforward way of doing it that I'm not seeing! Any help gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-09-25T09:34:29.600" Title="AMForms - How to use dynamic formHandle" Tags="&lt;templating&gt;&lt;plugin-amforms&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22107" PostTypeId="2" ParentId="22102" CreationDate="2017-09-25T10:32:48.547" Score="5" Body="&lt;p&gt;Stack Exchange is generally for more technical questions, so you might not get many replies here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you contacted the folks at Pixel &amp;amp; Tonic directly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also join the &lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;noreferrer&quot;&gt;Craft CMS Slack&lt;/a&gt;. Plenty of developers hang out on there that might not look here, so it'd be worth your while asking the same question there.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-09-25T10:32:48.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22108" PostTypeId="2" ParentId="22105" CreationDate="2017-09-25T11:19:39.860" Score="2" Body="&lt;p&gt;First, based on your example code I don't think you actually need to loop on the entries – you could simply group them on the brand name, and then loop on the keys for the grouped array (the keys would be your brand names):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set brands = allEntries|group('brand')|keys %}&#xA;&#xA;{% for brand in brands %}&#xA;     &amp;lt;option value=&quot;{{ brand }}&quot;&amp;gt;{{ brand }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that's a slight optimization, but you'd still be pulling ~18k entries to print ~140 brand names and I'm not sure the above wouldn't still crash your server – so ideally you should probably use a different strategy altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're comfortable w/ writing a little PHP, I'd suggest you &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;scaffold a custom plugin&lt;/a&gt; – make sure that the &lt;em&gt;Variables&lt;/em&gt; component is included, and add something like the below to the &lt;code&gt;variables/YourPluginHandleVariable.php&lt;/code&gt; class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getBrands()&#xA;{&#xA;    $query = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;    $query-&amp;gt;selectDistinct('field_brand');&#xA;    $query-&amp;gt;from('content');&#xA;    return array_filter($query-&amp;gt;queryColumn());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template, you'd use this like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set brands = craft.yourPluginHandle.getBrands() %}&#xA;&#xA;{% for brand in brands %}&#xA;     &amp;lt;option value=&quot;{{ brand }}&quot;&amp;gt;{{ brand }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be sure to replace &lt;code&gt;yourPluginHandle&lt;/code&gt; and &lt;code&gt;YourPluginHandleVariable&lt;/code&gt; with the actual handle for your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I haven't actually tested the above w/ as many as +18k rows, so even a distinct select query might not be performant enough. Of course, you can always &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;cache&lt;/a&gt; the result.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-25T11:19:39.860" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22109" PostTypeId="1" AcceptedAnswerId="22113" CreationDate="2017-09-25T14:15:51.630" Score="3" ViewCount="410" Body="&lt;p&gt;I have an AJAX &lt;code&gt;GET&lt;/code&gt; call that should count all the products matching three different taxonomies.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product families  &lt;/li&gt;&#xA;&lt;li&gt;Sectors of application&lt;/li&gt;&#xA;&lt;li&gt;Liquids suitable for the product&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;so in the form the user could select &lt;code&gt;pumps&lt;/code&gt;, &lt;code&gt;agriculture&lt;/code&gt;, &lt;code&gt;diesel&lt;/code&gt; and the controller called should count the products that matches all those criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the solution in the templating engine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relationParams = ['and', id1, id2, id3 ] %}&#xA;{% set products = craft.entries.section('products').relatedTo(relationParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But something is not working as expected in the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $prodCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry)-&amp;gt;section('products');&#xA;&#xA;        $prodCriteria-&amp;gt;relatedTo = array(&#xA;            'and',&#xA;            'targetElement' =&amp;gt; $catIds // Where $catIds is an array of ids&#xA;        );            &#xA;        $products = $prodCriteria-&amp;gt;count();&#xA;&#xA;        $this-&amp;gt;returnJson( $products );    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems like &lt;code&gt;relatedTo&lt;/code&gt; behave like an &lt;code&gt;or&lt;/code&gt; operator. &#xA;Also, is it possible to make the relatedTo behave in a more complex way, like, I want to use &lt;code&gt;or&lt;/code&gt; for product families and &lt;code&gt;and&lt;/code&gt; for other taxonomies?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-09-25T23:01:40.857" Title="Query entries relatedTo multiple categories in controller" Tags="&lt;relations&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22110" PostTypeId="1" CreationDate="2017-09-25T15:10:12.423" Score="0" ViewCount="859" Body="&lt;p&gt;I am building an API that takes all products from the Craft Commerce &lt;code&gt;Commerce_ProductModel&lt;/code&gt;. In this I am using the Element API plugin to build it out. I am running on Craft 2 latest version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have so far built out the JSON API and it's returning what I need with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/allproducts' =&amp;gt; [&#xA;    'elementType' =&amp;gt; 'Commerce_Product',&#xA;    'criteria' =&amp;gt; [&#xA;        'search' =&amp;gt; buildSearchQuery(craft()-&amp;gt;request-&amp;gt;getParam('types'))&#xA;    ],&#xA;    'transformer' =&amp;gt; function(Commerce_ProductModel $product) {&#xA;&#xA;        $mergedProductData = [];&#xA;&#xA;        $title = $product-&amp;gt;title;&#xA;        $url = UrlHelper::getUrl($product-&amp;gt;url);&#xA;        $brand = (string)$product-&amp;gt;productBrand[0];&#xA;        $designer = (string)$product-&amp;gt;productDesigner[0];&#xA;        $num_decimals = (intval($product-&amp;gt;defaultVariant-&amp;gt;price) == $product-&amp;gt;defaultVariant-&amp;gt;price) ? 0 :2;&#xA;        $price = number_format($product-&amp;gt;defaultVariant-&amp;gt;price,$num_decimals);&#xA;&#xA;        $frontImage = $product-&amp;gt;productImages[0];&#xA;        $frontImages = [];&#xA;&#xA;        if ($frontImage)&#xA;        {&#xA;            craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;&#xA;            if (craft()-&amp;gt;plugins-&amp;gt;getPlugin('Imager'))&#xA;            {&#xA;                $transformedImages = craft()-&amp;gt;imager-&amp;gt;transformImage(&#xA;                    $frontImage,&#xA;                    array(&#xA;                        array(&#xA;                            'width' =&amp;gt; 1170,&#xA;                        ),&#xA;                        array(&#xA;                            'width' =&amp;gt; 780,&#xA;                            'jpegQuality' =&amp;gt; 65,&#xA;                        ),&#xA;                        array(&#xA;                            'width' =&amp;gt; 390,&#xA;                            'jpegQuality' =&amp;gt; 65,&#xA;                        ),&#xA;                    ),&#xA;                    array(&#xA;                        'ratio' =&amp;gt; 16/9,&#xA;                        'position' =&amp;gt; 'bottom-right',&#xA;                        'jpegQuality' =&amp;gt; 80,&#xA;                    ),&#xA;                    array(&#xA;                        'fillTransforms' =&amp;gt; true,&#xA;                    )&#xA;                );&#xA;&#xA;                $frontImages[] = craft()-&amp;gt;imager-&amp;gt;srcset($transformedImages);&#xA;&#xA;            } else {&#xA;                $frontImages[] = $frontImage-&amp;gt;getUrl(['width' =&amp;gt; 390, 'height' =&amp;gt; 294]);&#xA;            }&#xA;        }&#xA;&#xA;        $mergedProductData[] = [&#xA;            'id' =&amp;gt; $product-&amp;gt;id,&#xA;            'title' =&amp;gt; $title,&#xA;            'productImage' =&amp;gt; $frontImages,&#xA;            'body' =&amp;gt; (string) $product-&amp;gt;body,&#xA;            'brand' =&amp;gt; $brand,&#xA;            'designer' =&amp;gt; $designer,&#xA;            'url' =&amp;gt; $url&#xA;        ];&#xA;&#xA;        return [&#xA;            'title' =&amp;gt; $title,&#xA;            'id' =&amp;gt; $product-&amp;gt;id,&#xA;            'frontImage' =&amp;gt; $frontImages,&#xA;            'type' =&amp;gt; $product-&amp;gt;type-&amp;gt;name,&#xA;            'designer' =&amp;gt; $designer,&#xA;            'brand' =&amp;gt; $brand,&#xA;            'price' =&amp;gt; $price,&#xA;            'url' =&amp;gt; $url,&#xA;            'isInWishlist' =&amp;gt; craft()-&amp;gt;like-&amp;gt;isLike($product-&amp;gt;id),&#xA;            'quickViewJson' =&amp;gt; $mergedProductData&#xA;        ];&#xA;    },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is great, its returning what I need and its nothing more but I am trying to return search values against it by looking for the product type form the &lt;code&gt;Commerce_ProductModel&lt;/code&gt; and its hard to figure out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I ideally want to do is run a URL query like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/api/allproducts?types[]=New&amp;amp;types[]=Tables&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the code above there is this function that I was given by another developer that allows you to build queries like the URL above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;buildSearchQuery(craft()-&amp;gt;request-&amp;gt;getParam('types'))&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this I want to be able to query any &lt;code&gt;product type&lt;/code&gt; from Craft Commerce so it only returns products of these types. The function is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function buildSearchQuery($input) {&#xA;&#xA;    $query = &quot;&quot;;&#xA;    $i = 0;&#xA;&#xA;    foreach ($input as $value) {&#xA;&#xA;        if($i &amp;gt; 0) {&#xA;            $query .= &quot; OR &quot;;&#xA;        }&#xA;&#xA;        $query .= &quot;title:*$value* OR body:*$value*&quot;;&#xA;        $i++;&#xA;    }&#xA;&#xA;    return $query;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed any light on how this can be done at all?&lt;/p&gt;&#xA;" OwnerUserId="5033" LastEditorUserId="57" LastEditDate="2017-09-25T23:08:29.477" LastActivityDate="2017-09-26T05:36:05.907" Title="Is it possible to search in Craft Commerce by product type?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;query&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22111" PostTypeId="2" ParentId="21165" CreationDate="2017-09-25T21:46:48.203" Score="1" Body="&lt;p&gt;Make sure those &quot;missing&quot; fields aren't used in the title format (under the advanced tab) or in your notifications -  both in the control panel. Ran into something similar just now.&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2017-09-25T21:46:48.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22112" PostTypeId="2" ParentId="22109" CreationDate="2017-09-25T23:01:24.700" Score="1" Body="&lt;p&gt;Completely untested, but I believe what you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array_unshift($catIds , 'and');&#xA;&#xA;$prodCriteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; $catIds // Where $catIds is an array of ids&#xA;);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-25T23:01:24.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22113" PostTypeId="2" ParentId="22109" CreationDate="2017-09-25T23:01:40.857" Score="2" Body="&lt;p&gt;You need to pass an array of element IDs, &lt;em&gt;where the first index is &lt;code&gt;&quot;and&quot;&lt;/code&gt;&lt;/em&gt; – just like in your template (Twig) code – to &lt;code&gt;targetElement&lt;/code&gt;. Basically, this just means that you need to prepend the string &lt;code&gt;&quot;and&quot;&lt;/code&gt; to your array of IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;$prodCriteria-&amp;gt;relatedTo = array(&#xA;    'targetElement' =&amp;gt; array_merge(['and'], $catIds),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-25T23:01:40.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22114" PostTypeId="2" ParentId="22103" CreationDate="2017-09-25T23:16:15.320" Score="2" Body="&lt;p&gt;You can't just pass a string (category name) to &lt;code&gt;relatedTo&lt;/code&gt;, you need to pass either the category ID or a complete &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;CategoryModel&lt;/a&gt; (you can also pass in an array of IDs or models, if there are several categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that unless you already have the category IDs or models, you'll need to pull them using the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.categories&lt;/code&gt;&lt;/a&gt; service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set management = craft.categories.title('Management').first() %}&#xA;&#xA;{% set staff = craft.entries.section('staffList').relatedTo(management) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If you have multiple category groups, and there's a possibility you might have multiple categories across those groups with the same name, you should specify which category group the category you're after belongs to:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set management = craft.categories.group('categoryGroupHandle').title('Management').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to pull staff entries related to multiple categories, here's how that could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.title(['Management', 'Staff', 'Other']) %}&#xA;&#xA;{% set staff = craft.entries.section('staffList').relatedTo(categories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, keep in mind that if you're rendering a &lt;em&gt;category template&lt;/em&gt; (i.e. you've requested the URL for a particular category and Craft has rendered the template specified in the relevant category group's template path), Craft will actually populate the template with a &lt;code&gt;category&lt;/code&gt; variable, containing the CategoryModel for the category belonging to that URL. If this is the case, then you simply need to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set staff = craft.entries.section('staffList').relatedTo(category) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-25T23:16:15.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22115" PostTypeId="1" CreationDate="2017-09-26T05:13:19.843" Score="1" ViewCount="102" Body="&lt;p&gt;I am having some problems on integrating Craft Commerce with &lt;a href=&quot;https://github.com/thephpleague/omnipay-eway&quot; rel=&quot;nofollow noreferrer&quot;&gt;eWAY&lt;/a&gt;.&#xA;When I submit the payment form, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error: [Payment error: EWAY_CARDNAME Required, EWAY_CARDNUMBER Required, Invalid EWAY_CARDEXPIRYMONTH, Invalid EWAY_CARDEXPIRYYEAR, EWAY_CARDCVN Required]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Should the eWAY gateway plugin be converting the form input field names to these eWAY field names?&lt;/p&gt;&#xA;" OwnerUserId="7057" LastEditorUserId="57" LastEditDate="2017-09-26T18:39:33.010" LastActivityDate="2017-09-26T23:49:56.147" Title="Craft Commerce eWAY payment error" Tags="&lt;plugin-craftcommerce&gt;&lt;payment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22116" PostTypeId="2" ParentId="22110" CreationDate="2017-09-26T05:36:05.907" Score="1" Body="&lt;p&gt;Products can be queried by the product types &lt;code&gt;type&lt;/code&gt; (a handle or ProductTypeModel) or &lt;code&gt;typeId&lt;/code&gt; the ID of the type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a template this would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.products.typeId([1,3,4]).find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.products.type(['new','another']).find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is as per the parameter value syntax: &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in an element criteria query syntax in PHP it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'type' =&amp;gt; ['New','Another']&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'typeId' =&amp;gt; [1,2]&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'type' =&amp;gt; craft()-&amp;gt;commerce_productTypes-&amp;gt;getAllProductTypes()[0]&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The example you can was to build a query string for the search element criteria param, which could optionally be another criteria if you wanted.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-09-26T05:36:05.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22118" PostTypeId="1" AcceptedAnswerId="22129" CreationDate="2017-09-26T08:46:31.583" Score="1" ViewCount="27" Body="&lt;p&gt;I have imported entries, each with 2 fields that comprise a range of numbers... &lt;code&gt;numberStart&lt;/code&gt; and &lt;code&gt;numberEnd&lt;/code&gt;. e.g. &lt;code&gt;3000 - 3006&lt;/code&gt;, in some instances both are the same number e.g. &lt;code&gt;8001 - 8001&lt;/code&gt; The user will be inputting a single number and I need to return the single entry where the inputted number lands between (or is equal to) the start and (or) end number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userInputtedNumber = 3000 %} &#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'section',&#xA;    numberStart: '&amp;gt;=' ~ userInputtedNumber,&#xA;    numberEnd: '&amp;lt;=' ~ userInputtedNumber,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just returns nothing as the operators clash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas will be welcomed!&lt;/p&gt;&#xA;" OwnerUserId="4823" LastActivityDate="2017-09-27T00:18:43.347" Title="Check number against 2 seperate fields and return the entry that matches" Tags="&lt;comparisons&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22119" PostTypeId="2" ParentId="22075" CreationDate="2017-09-26T10:02:02.180" Score="1" Body="&lt;p&gt;Turns out this was a stupid mistake: I just had a white-space before &#xA;&#xA;&lt;p&gt;Somehow it worked locally but not on the server. &lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-09-26T10:02:02.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22121" PostTypeId="1" CreationDate="2017-09-26T15:09:04.083" Score="0" ViewCount="432" Body="&lt;p&gt;New user has activated account but is getting this message when trying to log in: &quot;you cannot access the CP with that account&quot;&lt;/p&gt;&#xA;" OwnerUserId="7303" LastActivityDate="2017-09-26T18:44:18.667" Title="you cannot access the CP with that account" Tags="&lt;control-panel&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22124" PostTypeId="2" ParentId="16687" CreationDate="2017-09-26T18:06:40.247" Score="1" Body="&lt;p&gt;I am using &lt;a href=&quot;https://isotope.metafizzy.co/filtering.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://isotope.metafizzy.co/filtering.html&lt;/a&gt; for this. Really easy to use&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-09-26T18:06:40.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22126" PostTypeId="1" CreationDate="2017-09-26T18:14:51.523" Score="1" ViewCount="541" Body="&lt;p&gt;So I am trying to create a new entry, but every time I click save, nothing is actually saved. (see gif) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/503to.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/503to.gif&quot; alt=&quot;Saving error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;THINGS I HAVE TRIED:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Overwriting the app folder with a freshly downloaded one (I am already on the latest stable build)&lt;/li&gt;&#xA;&lt;li&gt;Increasing &lt;code&gt;max_input_vars&lt;/code&gt; and &lt;code&gt;post_max_size&lt;/code&gt; in my php config&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;THINGS I HAVE NOTICED&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It works if I leave the rich text field blank, or with minimal content (like maybe 2 sentences) &lt;/li&gt;&#xA;&lt;li&gt;Nothing ever makes it to the database, &lt;code&gt;_entryversions&lt;/code&gt; remains unchanged&lt;/li&gt;&#xA;&lt;li&gt;I don't see anything weird in my log, e.g. no &lt;code&gt;[error]&lt;/code&gt; tags&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Craft Version: 2.6.2990&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2018-03-13T03:12:25.703" Title="Craft entries won't save (new or edits)" Tags="&lt;entry&gt;&lt;saveentry&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22127" PostTypeId="2" ParentId="22121" CreationDate="2017-09-26T18:44:18.667" Score="2" Body="&lt;p&gt;If a user gets that message when logging in, then it means they haven't been assigned the &lt;a href=&quot;https://craftcms.com/docs/users#permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Access the CP&quot;&lt;/a&gt; permissions in the Control Panel, either directly or through a &lt;a href=&quot;https://craftcms.com/docs/users#user-groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Group&lt;/a&gt; that they belong to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-26T18:44:18.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22128" PostTypeId="2" ParentId="22115" CreationDate="2017-09-26T23:49:56.147" Score="2" Body="&lt;p&gt;Which eWay are you implementing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have used eWAY Rapid Direct with no issues for over a year now with Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They key most people seem to miss is that you must implement the CSE - Client Side Encryption part of the eWay process before the gateway submission to eWay will wok.  This is documented by eWay here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://eway.io/api-v3/#how-it-works&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://eway.io/api-v3/#how-it-works&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essense you just need to include some JS on your payment form page.  On that page you accept the card number etc pretty much as normal, but &lt;em&gt;before you pass it to eway&lt;/em&gt; is must be encrypted on the client machine.  Here's some scrappy JS to show what I mean first include the eWay JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                    {# Include EWAY CSE JS #}&#xA;                {% if craft.config.devMode %}&#xA;                    &amp;lt;script src=&quot;https://secure.ewaypayments.com/scripts/eCrypt.debug.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;                {% else %}&#xA;                    &amp;lt;script src=&quot;https://secure.ewaypayments.com/scripts/eCrypt.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;                {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and in your payment form have something like this as you will need it later (I store my key in the commerce config file so I can set a dev vs live one based on environment, but you could jstu hardcode it below or whatever):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              {% set paymentMethods = craft.commerce.paymentMethods %}&#xA;                  &amp;lt;input type=&quot;hidden&quot; name=&quot;CSEKey&quot; value=&quot;{{ paymentMethods[1].settings.CSEKey }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you need to deal with the actual encryption side of things...something like this should do it for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        var method = $('input[name=paymentMethodId]:checked', '#submitOrder').val();&#xA;&#xA;    if (method == 1) {&#xA;        // EWAY Client Side Encryption - See https://eway.io/api-v3/#encrypt-function&#xA;&#xA;        // EWAY CSE - encrypt the card number and the CCV on the client's machine so it's never seen by us or anyone else.&#xA;        // Pull the values from the test input fields (fake*)&#xA;        // and inject the encrypted version into the real fields&#xA;        var $fakeCardNumber = $(&quot;#fakeNumber&quot;);&#xA;        var $fakeCcv = $(&quot;#fakeCvv&quot;);&#xA;        var $cardNumber = $(&quot;input[name=encryptedCardNumber]&quot;);&#xA;        var $ccv = $(&quot;input[name=encryptedCardCvv]&quot;);&#xA;&#xA;        // get the unencrypted values and remove all spaces from the numbers&#xA;        var cardNumber = $fakeCardNumber.val().replace(/\s/g, &quot;&quot;);&#xA;        var ccv = $fakeCcv.val().replace(/\s/g, &quot;&quot;);&#xA;&#xA;        // and now re-set them to the encrypted values if these are actually filled in&#xA;        if (cardNumber) {&#xA;            $cardNumber.val(eCrypt.encryptValue(cardNumber, CSEKey));&#xA;        }&#xA;        if (ccv) {&#xA;            $ccv.val(eCrypt.encryptValue(ccv, CSEKey));&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's not the most beautiful code, but I think once you've implemented that (which you need tom to be compliant with eWay) - you will find things drop into place easily enough from there.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-09-26T23:49:56.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22129" PostTypeId="2" ParentId="22118" CreationDate="2017-09-27T00:18:43.347" Score="0" Body="&lt;p&gt;Think you've just got a logic error in your Twig code.  This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set userInputtedNumber = 3000 %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'channel',&#xA;    numStart: '&amp;lt;=' ~ userInputtedNumber,&#xA;    numEnd: '&amp;gt;=' ~ userInputtedNumber,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-27T00:18:43.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22130" PostTypeId="1" CreationDate="2017-09-27T01:35:46.113" Score="1" ViewCount="53" Body="&lt;p&gt;Is it possible to add a border-radius to an Image Transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using circular profile photos for a client. I could do the radius in CSS, but it'd be nice for the image to output with the radius.&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-09-27T01:44:48.173" Title="Border Radius on Image Transforms" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22131" PostTypeId="2" ParentId="22130" CreationDate="2017-09-27T01:44:48.173" Score="3" Body="&lt;p&gt;I'd just crop it with CSS, as you alluded to. &lt;a href=&quot;https://www.webpagefx.com/blog/web-design/circular-images-css/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.webpagefx.com/blog/web-design/circular-images-css/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-09-27T01:44:48.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22132" PostTypeId="2" ParentId="21006" CreationDate="2017-09-27T10:00:53.140" Score="2" Body="&lt;p&gt;A while since you asked, so in case you haven't figured it out yet, here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To attach to a plugin hook, you need to create your own plugin. So in your plugins folder, add a new folder called &lt;code&gt;SearchPlusItemMapping&lt;/code&gt; or whatever you want to call your plugin. In that folder you'll need to create a php file called &lt;code&gt;SearchPlusItemMappingPlugin&lt;/code&gt; (change whatever comes before &lt;code&gt;Plugin&lt;/code&gt; if you gave your plugin a different name. In this file, add the following lines:&#xA;    namespace Craft;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SearchPlusMappingPlugin extends BasePlugin&#xA;{&#xA;    public function getName()&#xA;    {&#xA;        return Craft::t('Search Plus Item Mapping');&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'Your Name';&#xA;    }&#xA;&#xA;    public function getDeveloperUrl()&#xA;    {&#xA;        return 'https://somesite.com';&#xA;    }&#xA;&#xA;    public function searchPlus_alterBasicItemMapping(){}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then at the bottom you add your function.&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2017-09-27T10:00:53.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22134" PostTypeId="1" CreationDate="2017-09-27T10:12:22.173" Score="2" ViewCount="237" Body="&lt;p&gt;Anyone had experience of assigning a user group when saving or registering a user via a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried various combinations of &lt;code&gt;$user-&amp;gt;group = 1&lt;/code&gt;, &lt;code&gt;$user-&amp;gt;group = [1]&lt;/code&gt;, &lt;code&gt;$user-&amp;gt;setGroups([$group])&lt;/code&gt; and &lt;code&gt;$user-&amp;gt;setGroups($group)&lt;/code&gt; (where $group is the group I want to assign the user to) but whilst the user is being saved fine the user group is not assigned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-09-27T10:22:53.483" Title="Saving/assigning User Group via a plugin" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-groups&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22135" PostTypeId="2" ParentId="22134" CreationDate="2017-09-27T10:22:53.483" Score="3" Body="&lt;p&gt;So it seems the only way to achieve this is to assign the user to the group, not the other way round (assign the group to the user).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So once my user has saved I can call following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groupId);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-09-27T10:22:53.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22136" PostTypeId="1" CreationDate="2017-09-27T11:31:27.370" Score="1" ViewCount="1256" Body="&lt;p&gt;I'm trying to get prev/next entry using positionedAfter and positionedBefore filters but getting weird order on results because order('postDate desc') seems to be ignored.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevSibling = craft.entries.positionedAfter(entry).order('postDate desc').first() %}&#xA;&#xA;{% set nextSibling = craft.entries.positionedBefore(entry).order('postDate desc').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="7309" LastActivityDate="2017-09-27T11:44:48.150" Title="Entries order postDate not working" Tags="&lt;entries&gt;&lt;ordering&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22137" PostTypeId="2" ParentId="22136" CreationDate="2017-09-27T11:44:48.150" Score="2" Body="&lt;p&gt;&lt;code&gt;positionedAfter&lt;/code&gt; only applies to entries within a structure section (&lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#positionedAfter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries#positionedAfter&lt;/a&gt;). See &lt;a href=&quot;https://craftcms.stackexchange.com/a/58/642&quot;&gt;this answer&lt;/a&gt; for how to get next and previous entries.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-09-27T11:44:48.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22138" PostTypeId="1" CreationDate="2017-09-27T12:29:02.723" Score="1" ViewCount="509" Body="&lt;p&gt;For a Craft 2 S3 asset source, access keys are expected to be entered in from the Control Panel. Is there a way to supply the access key and secret through environment variables instead?&lt;/p&gt;&#xA;" OwnerUserId="7310" LastEditorUserId="57" LastEditDate="2017-09-27T18:33:09.737" LastActivityDate="2017-11-28T05:29:08.570" Title="How to store S3 credentials in environment variables?" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22139" PostTypeId="1" AcceptedAnswerId="22141" CreationDate="2017-09-27T14:35:53.323" Score="1" ViewCount="323" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;MailChimp Subscribe for Craft&lt;/a&gt; plugin to embed several subscription forms on a website I'm building. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code appears via my master &lt;code&gt;_layout.html&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;POST&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;mailchimpSubscribe/list/Subscribe&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;successfully-subscribed&quot;&amp;gt;&#xA;&#xA;    {# MailChimp List ID #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;lid&quot; value=&quot;XXXXXXXXXX&quot;&amp;gt;&#xA;&#xA;    {% if mailchimpSubscribe is defined %}&#xA;        {% if (not mailchimpSubscribe.success) and (mailchimpSubscribe.errorCode!='1000') %}&#xA;            &amp;lt;p&amp;gt;An error occured. Please try again.&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;field-line&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; placeholder=&quot;Name&quot; name=&quot;mcvars[NAME]&quot; value=&quot;{% if (mailchimpSubscribe is defined) and (not mailchimpSubscribe.success) %}{{ mailchimpSubscribe.values.vars.NAME }}{% endif %}&quot; required&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;field-line&quot;&amp;gt;&#xA;        &amp;lt;label{% if (mailchimpSubscribe is defined) and (mailchimpSubscribe.errorCode=='1000') %} class=&quot;error&quot;{% endif %}&amp;gt;Email:&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;email&quot; placeholder=&quot;Email Address&quot; name=&quot;email&quot; value=&quot;{% if (mailchimpSubscribe is defined) and (not mailchimpSubscribe.success) %}{{ mailchimpSubscribe.values.email }}{% endif %}&quot; required&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; name=&quot;&quot; value=&quot;Go!&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I hit go, I get the following Bad Request error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NyouD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NyouD.jpg&quot; alt=&quot;Bad Request&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've temporarily fixed the error via &lt;code&gt;general.php&lt;/code&gt; by disabling CSRF Protection (not recommended).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I implement CSRF Protection on this form? I've followed &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, but replacing the name and value fields will surely disable the plugin's functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I also implement the method shown &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for other forms like &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Am Forms&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;There's a pull request on the &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft/pull/43&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin git page&lt;/a&gt; regarding this.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="7160" LastEditDate="2017-09-27T14:55:49.357" LastActivityDate="2017-09-27T14:55:49.357" Title="Enabling CSRF Protection for Mailchimp Subscribe plugin and other forms" Tags="&lt;form&gt;&lt;security&gt;&lt;csrf&gt;&lt;plugin-amforms&gt;&lt;plugin-mailchimpsubscribe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22140" PostTypeId="1" AcceptedAnswerId="22142" CreationDate="2017-09-27T14:41:40.527" Score="1" ViewCount="175" Body="&lt;p&gt;I've set up a print template for furniture labels.&lt;br&gt;&#xA;I let my client print the labels with a special Link like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/label?ids=&quot;x|y|z&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It all works good. Now he sometimes wants to print the same label multiple times, so he and I tried the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/label?ids=&quot;x|x|x|y|z|z|z&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The underlying code is the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = craft.request.param('ids')| split('|')|join(',') %}&#xA;{% set params =&#xA;    {&#xA;        section: 'furniture',&#xA;        limit : null,&#xA;        id: ids&#xA;&#xA;    }&#xA;%}&#xA;{% paginate craft.entries(params) as entries %}&#xA;{% for entry in entries %}&#xA;     ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will only display x and z one time.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way around this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated. &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2017-09-28T06:31:39.097" Title="How to display an entry id multiple times?" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22141" PostTypeId="2" ParentId="22139" CreationDate="2017-09-27T14:43:58.857" Score="3" Body="&lt;p&gt;Enable CSRF protection in your config again and add &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt; right after the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; opening tag on &lt;em&gt;all&lt;/em&gt; forms on your site, regardless if they are amforms or mailchimp subscribe.  I can verify that it won't interfere with the mailchimp plugin as I am currently (and just recently) installed it on a project I'm working on and it works fine.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-27T14:43:58.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22142" PostTypeId="2" ParentId="22140" CreationDate="2017-09-27T15:04:27.643" Score="3" Body="&lt;p&gt;I would write something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = craft.request.param('ids')| split('|') %}&#xA;{% for id in ids %}&#xA;    {% set entry = craft.entries.id(id).first() %}&#xA;    …&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, to reduce the queries, store all the entries in a variable and then loop through ids and find the right match in this smaller set.&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="367" LastEditDate="2017-09-28T06:31:39.097" LastActivityDate="2017-09-28T06:31:39.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22143" PostTypeId="1" AcceptedAnswerId="22149" CreationDate="2017-09-27T15:16:31.807" Score="1" ViewCount="32" Body="&lt;p&gt;I have a product overview page, with images and some text, then a call to action that launches a product customiser for that particular product. (the customiser is requiring some bespoke JSON using line items).&#xA;It is on the product customise page that the 'add to cart' button is placed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the following URLS for each seperate page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Product overview:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myshop.com/products/productname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Product customiser:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myshop.com/products/productname/customise/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing this? By default, Craft only seems to let me use one template per product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="57" LastEditDate="2017-09-27T18:37:10.893" LastActivityDate="2017-09-27T21:54:45.100" Title="How can I break up a product into two page templates?" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22144" PostTypeId="1" AcceptedAnswerId="22147" CreationDate="2017-09-27T15:54:53.733" Score="1" ViewCount="75" Body="&lt;p&gt;I'd like to have consistent URL's for an account section but depending on the current users group, the template will be different. I know I could use the same template but there would be a lot of if/else's throughout and I'd like to avoid that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL pattern would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If customer group&#xA;&lt;code&gt;'account/settings' =&amp;gt; '_dashboard/customer/settings'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If admin group&#xA;&lt;code&gt;'account/settings' =&amp;gt; '_dashboard/admin/settings'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking this might be possible with a plugin controller that each route would hit and then decide which template to render.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both groups&#xA;&lt;code&gt;'account/settings' =&amp;gt; ['action' =&amp;gt; 'action/path']&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function action()&#xA;{&#xA;   // Get user&#xA;   // Set path based on user group&#xA;   // Set template path to front end&#xA;   // Render template&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can you see any problems with the above solution? Will there be much of a performance hit? Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2017-09-27T19:07:45.477" Title="Use different template for same route based on user group" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22145" PostTypeId="1" AcceptedAnswerId="22148" CreationDate="2017-09-27T16:29:58.693" Score="2" ViewCount="66" Body="&lt;p&gt;I'm creating a website where members have a form of questions to fill in each day. But within this form is a another set of questions that are always the same each day, but will have different answers in each day (it's like a diary entry, but built up of various fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way in Sprout Forms for a form to be almost &quot;embedded&quot; in others? So that if the fields in the embedded form are changed they then change across all the parent forms it is included in, if that makes sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can think to do it at present is create a form with 2 tabs: main and diary. The main tab will contain specific fields for that day, the diary tab will have the set questions that are asked each day. And then I do a &quot;save as&quot; to duplicate the diary fields into another form and change those in the main tab. Issue is that if the diary structure ever gets changed / updated I would have to manually do this perhaps 30 or so times.&lt;/p&gt;&#xA;" OwnerUserId="7312" LastEditorUserId="57" LastEditDate="2017-09-27T18:38:28.103" LastActivityDate="2017-09-27T20:37:37.803" Title="Using a Sprout Form within a Sprout Form?" Tags="&lt;form&gt;&lt;field&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22146" PostTypeId="2" ParentId="22138" CreationDate="2017-09-27T18:36:16.170" Score="1" Body="&lt;p&gt;Not really.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2 &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/assetsourcetypes/S3AssetSourceType.php#L410-L422&quot; rel=&quot;nofollow noreferrer&quot;&gt;S3 settings&lt;/a&gt; ultimately get stored in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally the answer would be &quot;you can write a plugin that adds its own Asset Source Type and changes that behavior&quot;, but in Craft 2, it is not easy to add custom Asset Source Types, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 has solved both of those problems.  You can register custom &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/volume-types.md#registering-custom-volume-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Volume Types&lt;/a&gt; as well as &lt;a href=&quot;https://github.com/craftcms/docs/blob/adf409846292dc7f35f79e0a19dbdc4defd33e20/en/configuration.md#overriding-volume-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;override Volume settings&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-27T18:36:16.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22147" PostTypeId="2" ParentId="22144" CreationDate="2017-09-27T19:07:45.477" Score="2" Body="&lt;p&gt;Just do it with Twig by having a main template pull from two other templates based on the user group. So in your index template (or whatever template gets called), just add this at the top:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('customer') %}&#xA;    {% include '_dashboard/customer/settings' %}&#xA;{% else %}&#xA;    {% include '_dashboard/admin/settings' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then fill out each template however you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conversely, you can check if the user is a CMS admin with &lt;code&gt;{% if currentUser.admin %}&lt;/code&gt; and then the &lt;code&gt;{% else %}&lt;/code&gt; would be for customers.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-27T19:07:45.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22148" PostTypeId="2" ParentId="22145" CreationDate="2017-09-27T20:37:37.803" Score="1" Body="&lt;p&gt;There is no default way to add a form within a form in Sprout Forms. Your proposed manual solution seems like a decent approach, but whenever you change a question on an existing form you will also be altering the historic data in any of your reports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A two-forms approach&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more straightforward approach may be to make your process two forms. Have a primary form that has the core questions that don't change and a second form that the users are directed to for the questions that do. You could use a Form Relations as a Global Field or on a particular Single to assign which secondary form was needed and should be able to link between the submitted entries by tracking the IDs via a Sprout Fields Hidden Field or developing a custom front-end field that created the relationship in a more user-friendly way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using two forms will help you maintain accurate historic data and stick within existing functionality which will likely be easier to maintain in the long run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A custom field approach&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More speculatively, you could potentially develop a custom plugin and custom field that help you do this. It would definitely require a bit of planning, and I probably would vote against going this route, but to highlight some of the challenges you would face, here are some initial thoughts on what that might look like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The fields that change would probably need to store data in a similar way. If all the fields that needed to change were Plain Text fields, that will likely be much easier of a problem to try to solve than if you need to swap questions that relate to different types of fields. It will likely be easier if the number of questions also stayed the same. &lt;/li&gt;&#xA;&lt;li&gt;Sprout Forms stores fields locally to each form created, so you would not be able to use the Field Settings to control global attributes, you would need a separate custom field plugin settings area where you could control settings, such as the labels of the questions that change, across all instances of where the fields are used.&lt;/li&gt;&#xA;&lt;li&gt;You'd probably also run into some challenges on how to create reports on the historic data. If answers to the questions of the first month relate to different questions than the answers to the data of the second month, you'd also have to find a way to store the questions that were being answered as part of the form submissions to know what the responses were actually referring to.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-27T20:37:37.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22149" PostTypeId="2" ParentId="22143" CreationDate="2017-09-27T21:54:45.100" Score="2" Body="&lt;p&gt;I think you just need to create a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt; to either ignore &lt;code&gt;customise/&lt;/code&gt; in the url or serve up a different template altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See my answer on this ticket for more information. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21951/secondary-template-for-structure/21994#21994&quot;&gt;Secondary Template for Structure&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-09-27T21:54:45.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22150" PostTypeId="1" CreationDate="2017-09-28T02:48:52.077" Score="3" ViewCount="239" Body="&lt;p&gt;I have a client that wants their Solspace Calendar Events to show up in the global site search results (along with entries from other sections)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was to query the entries and calendar events separately, merge the result sets together, and then paginate them. Basically this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21854/merge-craft-entries-and-venti-events-in-search-results&quot;&gt;Merge Craft entries and Venti events in search results&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that doesn't seem to work. Is there any way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="6541" LastActivityDate="2017-09-28T02:48:52.077" Title="Is there any way to include Solspace Calendar events in a global site search?" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22151" PostTypeId="1" AcceptedAnswerId="22153" CreationDate="2017-09-28T04:20:32.063" Score="0" ViewCount="178" Body="&lt;p&gt;I'm sure this is somewhere in Craft documentation but I cannot find anything on it. There is that checkbox in the product area that says &quot;Promotable&quot;. I'm assuming this is so I can reference it later in the code (which is why I'm interested in this box), but I've browsed through the documentation and found nothing about it. The lack of questions about it on here makes me assume I just missed it. Could I get an explanation or a link? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2017-10-03T01:56:51.810" LastActivityDate="2017-10-03T01:56:51.810" Title="How to use promotable Boolean in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22153" PostTypeId="2" ParentId="22151" CreationDate="2017-09-28T07:25:52.587" Score="2" Body="&lt;p&gt;In Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;promotable&lt;/strong&gt; (&lt;em&gt;true&lt;/em&gt; or &lt;em&gt;false&lt;/em&gt;)&lt;br&gt;&#xA;  Is this product and its variants able to be on sale or at a discount.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/product-model#promotable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/product-model#promotable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3864" LastActivityDate="2017-09-28T07:25:52.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22154" PostTypeId="1" AcceptedAnswerId="22166" CreationDate="2017-09-28T07:56:26.727" Score="1" ViewCount="86" Body="&lt;p&gt;I would like the user to be able to switch between currencies (and tax), but I haven't figured out how to pull the currencies defined in Craft Commerce into a for loop. (I am pretty new to this platform)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need this to be changeable on the front end via both a drop down menu in the header and automatic Geo locating. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions greatly appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="57" LastEditDate="2017-09-28T14:18:37.167" LastActivityDate="2017-09-29T02:49:05.050" Title="Craft Commerce: Geo Location, and option select dropdown to switch between currencies" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;currency&gt;&lt;geo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22158" PostTypeId="1" AcceptedAnswerId="22209" CreationDate="2017-09-28T10:43:12.930" Score="1" ViewCount="355" Body="&lt;p&gt;I have an asset directory which is set to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}assets/images/products/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know my basePath is right as it works on other asset sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My entry upload location for products is set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{slug}/static/studio&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I get the following error when uploading assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;upload failed. error uploading the file: The folder &quot;/var/www/html/assets/images/products/carambola-earrings/static/studio/&quot; does not exist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried 'updating asset indexes'. But no luck. I have also double checked that the assets/images/products/ directory exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also checked the permissions are set to '775' for '/var/www/html'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help greatly appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-10-02T09:16:25.920" Title="Dynamic Subfolder Paths - folder does not exist even after updating asset directories in settings" Tags="&lt;assets&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22159" PostTypeId="2" ParentId="15900" CreationDate="2017-09-28T15:48:42.943" Score="1" Body="&lt;p&gt;We had a similar issue to this recently and found it was caused by CSRF protection being turned on, SagePay is attempting to POST data back to your server but without the CSRF token it becomes an invalid request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to this is to add a quick check in your &lt;code&gt;config/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'enableCsrfProtection' =&amp;gt; !isset($_GET['p']) || $_GET['p'] !== 'actions/commerce/payments/acceptNotification',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5606" LastActivityDate="2017-09-28T15:48:42.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22161" PostTypeId="1" AcceptedAnswerId="22176" CreationDate="2017-09-28T19:27:14.387" Score="2" ViewCount="146" Body="&lt;p&gt;Without taking the time to explain the reason behind the requirement, I need to make about 3,000 empty entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this, that is &lt;strong&gt;how can I generate X number of entries without manually saving them from the admin area&lt;/strong&gt;, outside of writing my own plugin? I don't think there's any good way to just write some SQL and barf them into existence right inside the database :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm fairly certain this would have to be done via custom plugin development if it is indeed possible. I've never made a Craft plugin before, so I'm a little gunshy!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine the structure of the plugin would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onSaveEntry(Event $event)&#xA;{&#xA;    $title = $entry-&amp;gt;title;&#xA;&#xA;    for ( $i = $title; $i&amp;lt;8000; $i++)&#xA;    {&#xA;        do&#xA;        {&#xA;            public function saveEntry(EntryModel $entry)&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, this is pseudo-code at best. I'm not sure what to exactly do here. But I hope this illustrates my thinking:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When I save a new entry, I want this thing to fire.&lt;/li&gt;&#xA;&lt;li&gt;Right now my entries have auto-generated titles: take the last entry and add one: 5000 -&gt; 5001 -&gt; 5002, etc.&lt;/li&gt;&#xA;&lt;li&gt;As long as we have less than 8000 entries (technically 3000 entries, as our entry titles will be 5000 - 8000) we want to keep saving new entries.&lt;/li&gt;&#xA;&lt;li&gt;Once we finally save an entry with a title of 7999 or 8000, stop making entries.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this possible? What do I need to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you soooo much to whoever out there can help me out!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastEditorUserId="5471" LastEditDate="2017-09-28T19:58:29.543" LastActivityDate="2017-09-29T12:13:33.860" Title="Mass Creation of Entries" Tags="&lt;entries&gt;&lt;saving&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22162" PostTypeId="2" ParentId="22063" CreationDate="2017-09-28T21:54:47.710" Score="1" Body="&lt;p&gt;I had a field called &lt;code&gt;files&lt;/code&gt;, it did not belong to matrix. After deleting it (tried also simply renaming), the problem disappeared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I created a field with the same name and that did not cause any problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still do not know the exact reason, but later will have time dig a bit deeper, so if get some results will post them.&lt;/p&gt;&#xA;" OwnerUserId="7096" LastActivityDate="2017-09-28T21:54:47.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22163" PostTypeId="1" CreationDate="2017-09-28T22:52:14.233" Score="0" ViewCount="206" Body="&lt;p&gt;{{ entry.url }} is generating a https:// link. I don't have SSL on this site, so the page errors out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Settings &gt; General &gt; Site Url is &quot;http://...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My .htaccess is below (though I've read the redirect doesn't work on shared hosting).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RewriteEngine On&#xA;    RewriteBase /&#xA;    RewriteCond %{SERVER_PORT} 443&#xA;    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Aside from &quot;Get an SSL certificate,&quot; any suggestions on a fix?&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-11-28T11:30:50.163" Title="entry.url forcing https" Tags="&lt;url&gt;&lt;htaccess&gt;&lt;link&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22164" PostTypeId="2" ParentId="22161" CreationDate="2017-09-29T00:25:44.640" Score="1" Body="&lt;p&gt;Or you could just use an existing seeding plugin like &lt;a href=&quot;https://github.com/am-impact/amseed&quot; rel=&quot;nofollow noreferrer&quot;&gt;A&amp;amp;M Seed&lt;/a&gt;. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if it does do exactly what you're looking for, you can use it as a starting point for your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-29T00:25:44.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22165" PostTypeId="1" CreationDate="2017-09-29T00:42:55.217" Score="2" ViewCount="388" Body="&lt;p&gt;I am using InstaBlog plugin to manage Blogs in Craft. I would like to import some 1000 blog entries from Drupal. I know it has an option to import blogs from WordPress. I was wondering if this can be done from Drupal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is highly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6995" LastActivityDate="2017-09-29T12:29:17.617" Title="Importing Blog posts from Drupal into Craft" Tags="&lt;import&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22166" PostTypeId="2" ParentId="22154" CreationDate="2017-09-29T02:49:05.050" Score="1" Body="&lt;p&gt;The Cart's currency &lt;code&gt;{{cart.currency}}&lt;/code&gt; is always the default base currency. You can't change or switch this currency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means all prices/discounts/taxes are all stored and entered in that currency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example templates, the price of items is shown in that currency using the currency filter and passing in the &lt;code&gt;cart.currency&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Sale Price Subtotal: {{ item.subtotal|commerceCurrency(cart.currency) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the user goes to pay for the order, we allow them to pay in a different currency called the &lt;code&gt;paymentCurrency&lt;/code&gt; this is accessible with &lt;code&gt;{{cart.paymentCurrency}}&lt;/code&gt;. You can also change the cart's current payment current with the controller action &lt;code&gt;commerce/cart/updateCart&lt;/code&gt; and passing a valid currency ISO. The ISO you pass must be a valid one set up in your settings, along with a conversion ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't recommend converting the price of all items with the payment currency using the currency filter, as the total will not match the order amount. We recommend only converting the actual payment due or order total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to changing the payment currency with controller action here are the other ways you can change the payment currency: &lt;a href=&quot;https://craftcommerce.com/docs/payment-currencies#switching-currencies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-currencies#switching-currencies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default the payment currency is the default currency of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for taxes, these are always based on the shipping address. So the only way to switch the tax rate would be by the customer changing their shipping address on the cart. FYI there is an option to base the tax calcs on the billing address:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/configuration#usebillingaddressfortax&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/configuration#usebillingaddressfortax&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-09-29T02:49:05.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22167" PostTypeId="2" ParentId="22138" CreationDate="2017-09-29T03:38:10.560" Score="1" Body="&lt;p&gt;You can hack some env-var functionality into your S3 sources by sprinkling &lt;code&gt;craft()-&amp;gt;config-&amp;gt;parseEnvironmentString()&lt;/code&gt; into &lt;em&gt;S3AssetSourceType.php&lt;/em&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've historically used this to get per-env &lt;em&gt;paths&lt;/em&gt; &amp;mdash; i.e. parsing vars in &lt;code&gt;getBaseUrl()&lt;/code&gt;, &lt;code&gt;getPathPrefix()&lt;/code&gt;, and &lt;code&gt;getS3Path()&lt;/code&gt; &amp;mdash; rather then &lt;em&gt;credentials&lt;/em&gt;. (I'm usually okay with storing those credentials in the db, because I almost always create an IAM user/policy just for the CMS.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the concept should be the same. Off the top of my head, I think in order to get it to parse credentials and other settings, you'd have to override &lt;code&gt;getSettings()&lt;/code&gt;, along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @inheritDoc BaseSavableComponentType::getSettings()&#xA; *&#xA; * @return BaseModel&#xA; */&#xA;public function getSettings()&#xA;{&#xA;&#xA;    if (!isset($this-&amp;gt;_settings))&#xA;    {&#xA;&#xA;        $this-&amp;gt;_settings = parent::getSettings();&#xA;&#xA;        foreach ($this-&amp;gt;_settings-&amp;gt;getAttributes() as $name =&amp;gt; $value)&#xA;        {&#xA;            if (is_string($value))&#xA;            {&#xA;                $this-&amp;gt;_settings-&amp;gt;setAttribute(&#xA;                    $name,&#xA;                    craft()-&amp;gt;config-&amp;gt;parseEnvironmentString($value)&#xA;                );&#xA;            }&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    return $this-&amp;gt;_settings;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Either you'll need to remember to restore this hack whenever you update Craft, or if you wanted to be super-fancy you could hook onto the &lt;code&gt;updates.onEndUpdate&lt;/code&gt; event to re-write that method into the correct file.&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2017-09-29T03:38:10.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22168" PostTypeId="2" ParentId="22163" CreationDate="2017-09-29T03:43:28.843" Score="1" Body="&lt;p&gt;I got the link to work, but it seems like a dumb workaround. For some reason, &lt;code&gt;http://example.com&lt;/code&gt; redirects to &lt;code&gt;https://example.com&lt;/code&gt; when I use {{ entry.Url }}, but when I use &lt;code&gt;http://www.&lt;/code&gt; the redirect doesn't occur. I changed my Site Url to &lt;code&gt;www.&lt;/code&gt; and created a redirect to &lt;code&gt;www.&lt;/code&gt; in the .htaccess file.&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-09-29T03:43:28.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22169" PostTypeId="1" AcceptedAnswerId="22170" CreationDate="2017-09-29T05:26:19.767" Score="1" ViewCount="4107" Body="&lt;p&gt;I have a hero textbox that I would like to control from the base template using a simple if/elseif.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a field called &quot;hero&quot; for the homepage. For pages in the &quot;Small Groups&quot; section, I want the hero to say &quot;Groups.&quot; For everything else, I want it to be the entry title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems straightforward, but this isn't working? It is ignoring the elseif.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry == craft.entries.section('homepage') %}&#xA;    {{ entry.hero }}&#xA;{% elseif entry == craft.entries.section('smallgroups') %}&#xA;    Groups&#xA;{% else %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7190" LastEditorUserId="57" LastEditDate="2017-09-29T17:46:42.490" LastActivityDate="2017-09-29T17:46:42.490" Title="if / elseif from base template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22170" PostTypeId="2" ParentId="22169" CreationDate="2017-09-29T06:39:43.540" Score="2" Body="&lt;p&gt;Your issue is probably that you're actually comparing an &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; (&lt;code&gt;entry&lt;/code&gt;) to an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; (the array-like object used for querying entries, which is returned by the &lt;code&gt;craft.entries&lt;/code&gt; call).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.section.handle == 'homepage' %}&#xA;    {{ entry.hero }}&#xA;{% elseif entry.section.handle == 'smallgroups' %}&#xA;    Groups&#xA;{% else %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming your section handles are correct, the above should work – although this is a perfect use for using the &lt;a href=&quot;https://craftcms.com/docs/templating/switch&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% switch %}&lt;/code&gt;&lt;/a&gt; tag instead of &lt;code&gt;{% if %}&lt;/code&gt;, which in my opinion would make your code more readable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch entry.section.handle %}&#xA;    {% case 'homepage' %}&#xA;        {{ entry.hero }}&#xA;    {% case 'smallgroups' %}&#xA;        Groups&#xA;    {% default %}&#xA;        {{ entry.title }}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-09-29T06:39:43.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22171" PostTypeId="1" CreationDate="2017-09-29T07:44:02.457" Score="2" ViewCount="55" Body="&lt;p&gt;I have a registration form on my frontend and when people click register but the form fails (due to the username already existing for example) I would like to keep all info they entered in the form so they don't need to enter all their data again while editing the form input that gave the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that there is an account model which you can use to keep all the info into the inputs. I used the &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;official example&lt;/a&gt; as a source.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- if account is defined %} value=&quot;{{ account.fieldName}}&quot;{% endif -%}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6516/how-can-i-translate-checkboxes-on-a-frontend-user-registration-form-to-lightswit&quot;&gt;this&lt;/a&gt; for checkboxes but for some reason it doesn't seem  to work. I used this in my code (&lt;em&gt;receiveNewsletter&lt;/em&gt; is a lightswitch in Craft / checbox on the frontend):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- if account is defined and account.receiveNewsletter == &quot;1&quot; %}checked{% endif -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it always seems to return &lt;code&gt;TRUE&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have no idea how to handle this for select inputs. Can anyone get me back on track please?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="57" LastEditDate="2017-09-29T18:17:51.700" LastActivityDate="2017-09-29T18:17:51.700" Title="Retain value from select and checkbox on frontend form after failure" Tags="&lt;drop-down&gt;&lt;checkboxes&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22172" PostTypeId="2" ParentId="22165" CreationDate="2017-09-29T07:46:15.167" Score="2" Body="&lt;p&gt;you might have more luck using the &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; plugin as it can accept an xml file where you can map the fields to fields on your entries.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-09-29T07:46:15.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22173" PostTypeId="2" ParentId="21057" CreationDate="2017-09-29T09:03:29.607" Score="1" Body="&lt;p&gt;Actually, the templates that are provided in the docs over &lt;a href=&quot;https://solspace.com/craft/freeform/docs/formatting-template-examples/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; are a pretty good place to start. You can change the markup, but you need the &lt;code&gt;javascript:;&lt;/code&gt; tag in the &lt;code&gt;a href=&lt;/code&gt;to get the multi-steps working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like any other form, I would suggest that you use some front-end validation. There are some nice libraries out there that get you up and running pretty quickly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any specifics you're struggling with?&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2017-10-01T14:15:50.270" LastActivityDate="2017-10-01T14:15:50.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22174" PostTypeId="1" CreationDate="2017-09-29T10:55:23.960" Score="1" ViewCount="684" Body="&lt;p&gt;I’m currently using react as a font end SPA with craft cms as the backend. I’m trying to create user accounts where a user use can sign up and favourite content on the site, using the Like for craft cms plugin - &lt;a href=&quot;https://github.com/dukt/like&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/like&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far the user is able to sign up, login and logout. However I’m having issues with accessing the renewed CSRF token when then the user logs in. I am accessing the CSRF token as per the documentation - &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection#updating-your-javascript&lt;/a&gt;. So these are currently the steps of the CSRF token login process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) User lands on website and the CSRF token is created e.g.&#xA;pRO1LyYLzxulTZ6ttv17kZ4gBQzTYHeQEpwZI8nL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) User logs in (updated CSRF token is generated, don’t have access to it unless I refresh the page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) User likes an entry (400 error ’The CSRF token could not be verified.’).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Refresh the page &#xA;CSRF Token = pRO1LyYLzxulTZ6ttv17kZ4gBQzTYHeQEpwZI8nL\x7C42101f4b43f2bc331d376d055c77c8f7146d30e4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) User can now like an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried to get the updated CSRF token from the cookie, but I can’t access it via document.cookie for security because they are tagged httponly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get the updated value of the CSRF token? Possibly after the login action?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help! &lt;/p&gt;&#xA;" OwnerUserId="6750" LastActivityDate="2017-09-29T10:55:23.960" Title="How to access logged in CSRF token?" Tags="&lt;ajax&gt;&lt;javascript&gt;&lt;csrf&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22175" PostTypeId="1" CreationDate="2017-09-29T11:28:50.163" Score="1" ViewCount="665" Body="&lt;p&gt;I am adding a video in a Rich Text field through file button in toolbar. I want to play these video in iframe. How can I do this..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there anyother option or plugin by which I can upload video which and add in richtext filed anywhere I want and show this in iframe on frontend.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="57" LastEditDate="2017-09-29T22:34:53.293" LastActivityDate="2017-10-02T07:46:57.290" Title="Video frame for video file in a Rich Text field" Tags="&lt;craft-features&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22176" PostTypeId="2" ParentId="22161" CreationDate="2017-09-29T12:13:33.860" Score="1" Body="&lt;p&gt;Here are two approaches you could take:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Seed Plugins&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/seed-data/faker-and-fake-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; - Sprout Import has features for both Seeding and Weeding seeded data. Sprout Import uses Faker to generate fake data and makes Faker available to you in your templates too. If you need to customize your fake data, the docs give an example of how you can generate fake data as a template, and then import that data. Sprout Import also has APIs to add support for custom Elements, Settings, and Fields if more customization is needed. When you add fake data with Sprout Import, you can mark is as &quot;Seed Data&quot; and later remove it from your Craft install from the Weed tab.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/am-impact/amseed&quot; rel=&quot;nofollow noreferrer&quot;&gt;A&amp;amp;M Seed&lt;/a&gt; - I have not used A&amp;amp;M Seed but I believe it's the only other plugin I've seen that is built specifically for seeding.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Import Plugins&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;As described with Sprout Import above, another approach to generating fake data is to generate fake data in an appropriate format that can be imported using an import plugin. Sprout Import accommodates this use case out of the box, but there are a handful of other Import plugins that you could generate data for and import directly.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/seed-data/faker-and-fake-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Import&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/seed-data/faker-and-fake-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; and the &lt;a href=&quot;https://github.com/sjelfull/Craft-Faker&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Faker&lt;/a&gt; plugin both give you a way to use Faker in your twig templates to help generate Fake data to import. Each import plugin may have it's own requirements as to what format that data should be in, but Craft enables you to create Twig templates with whatever file extension you prefer (.json, .xml, etc).&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-29T12:13:33.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22177" PostTypeId="2" ParentId="22165" CreationDate="2017-09-29T12:29:17.617" Score="5" Body="&lt;p&gt;There are several import plugins that can help you import your data from Drupal, but they may require a bit more configuration than the InstaBlog plugin that is designed for a specific use case.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Import Plugins&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Import plugins like &lt;a href=&quot;https://github.com/engram-design/FeedMe&quot; rel=&quot;noreferrer&quot;&gt;FeedMe&lt;/a&gt; and &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;noreferrer&quot;&gt;Import&lt;/a&gt; provide you a user interface where you can map fields from your import file to fields in Craft. Assuming you can export your data into one of the supported formats for those plugins, you could map the fields from your export and use the interface to import your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;noreferrer&quot;&gt;Sprout Import&lt;/a&gt; is also a versatile import plugin, but does not currently have a UI. It requires that you get your data into an import-friendly JSON format, and also gives you a lot of flexibility in how you resolve relationships or handle custom data types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.drupal.org/project/views_data_export&quot; rel=&quot;noreferrer&quot;&gt;Drupal Views Data Export&lt;/a&gt; is a good plugin to help output your Drupal data in the format that can be used by one of the above import plugins.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Extract, Transform, Load&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A good process to follow as you migrate your data is referred to as the ETL Process (Extract, Transform, Load). You need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Extract&lt;/strong&gt; - Get your data out of the previous system (in your case Drupal)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; - Transform that data into a format that can be imported into the new system (this can be done with Drupal Views Data Export module, or some other method that can help transform the data in the Drupal Database to importable files for one of the Craft import plugins)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Load&lt;/strong&gt; - Import your data into Craft (this step is handled by the Craft import plugins)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For large amounts of data, you'll likely run into several other challenges as well. Many of those questions will likely be documented by the specific import plugin you choose. When working with large migrations, while many things can be handled programmatically, don't forget to consider what can be handled manually as well. Often, a few parts of a migration are easier to do manually and being open to a bit of manual work can help make some of the programmatic steps less complicated.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-29T12:29:17.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22178" PostTypeId="1" CreationDate="2017-09-29T13:46:07.057" Score="1" ViewCount="1462" Body="&lt;p&gt;I would like to know that do we have Google XML Sitemaps plugin for Craft CMS. If yes is there an tutorial that how I can use it. I would like to use it for SEO purpose so that Google can easily crawl my website. A short explanation or video tutorial would be really nice. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7322" LastEditorUserId="57" LastEditDate="2017-09-29T17:25:07.247" LastActivityDate="2017-09-29T17:25:07.247" Title="Google XML Sitemaps plugin" Tags="&lt;plugin-sitemap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22179" PostTypeId="1" AcceptedAnswerId="22199" CreationDate="2017-09-29T14:30:47.963" Score="1" ViewCount="243" Body="&lt;p&gt;I have a Craft/Commerce set up with Euro is base (and only) currency and 3 locales are defined in the site (&lt;code&gt;nl_be&lt;/code&gt;, &lt;code&gt;fr_be&lt;/code&gt; and &lt;code&gt;en_be&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prices are showing up as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;0,99 €&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;instead of&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;€0,99&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I print the entry's locale I get &lt;code&gt;nl_be&lt;/code&gt; and my preferred language in the CP is also set to &lt;code&gt;nl_be&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url I'm using is also localised, through /nl/index.php, which sets &lt;code&gt;CRAFT_LOCALE&lt;/code&gt; to &lt;code&gt;nl_be&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit clueless as to what I'm missing, any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-10-01T23:11:47.153" Title="Product price format in euro" Tags="&lt;plugin-craftcommerce&gt;&lt;localization&gt;&lt;currency&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22180" PostTypeId="2" ParentId="22178" CreationDate="2017-09-29T14:50:36.920" Score="2" Body="&lt;p&gt;There are several plugins that can dynamically generate XML sitemaps for you on your Craft CMS site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Google XML Sitemaps are not specific to Google. Google supports the &lt;a href=&quot;https://www.sitemaps.org/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard sitemap protocol&lt;/a&gt; which is also used by Microsoft and Yahoo!.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll highlight two commercial plugins that support generating sitemaps for all native URL-Enabled Content which includes Entries, Categories, and Commerce Products:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.putyourlightson.net/craft-sitemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sitemap&lt;/a&gt; - Sitemap by Put Your Lights on is a plugin that focuses specifically on creating an XML sitemap for you.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/getting-started/sitemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO&lt;/a&gt; - Sprout SEO is a more comprehensive plugin for a wider range of SEO needs, which includes search, social sharing, sitemaps, and redirects. Sprout SEO will generate an XML sitemap for you and supports large sitemaps, multi-regional, and multilingual sitemaps. Sprout is also extensible and developers can add Sitemap support for custom URL-Enabled Sections.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are also several other free sitemap plugins. A &lt;a href=&quot;https://straightupcraft.com/craft-plugins?q=sitemap&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;search for 'sitemap'&lt;/a&gt; in the plugin directory on Straight Up Craft can point you in the direction of several of those.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-29T14:50:36.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22183" PostTypeId="2" ParentId="22104" CreationDate="2017-09-29T15:34:33.427" Score="2" Body="&lt;p&gt;You'll need to add more details about your current setup for a more specific answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, adding a number to the Meta Title and Meta Description is probably not a good approach to solve your problem of duplicates. Search engines score your page based on how relevant your content is. Adding a number, unless it has some meaning (perhaps a date for an event, tax form number, or &lt;a href=&quot;https://www.google.com/search?q=241543903&amp;amp;rlz=1C5CHFA_enUS754US754&amp;amp;source=lnms&amp;amp;tbm=isch&amp;amp;sa=X&amp;amp;ved=0ahUKEwiwif2q2srWAhXB4iYKHTZeDvkQ_AUICigB&amp;amp;biw=1547&amp;amp;bih=905&quot; rel=&quot;nofollow noreferrer&quot;&gt;241543903&lt;/a&gt;), is just going to be noise and not help your page rank in any meaningful way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider what other data you have in your posts. Can you add the name of a category some items are in? Can you add the name of a User that posted the content? Often there is a way to take a generic page and add a second dimension of data to make it more meaningful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Generic Name - Category 1 - Site Name&#xA;Generic Name - Category 2 - Site Name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if the pages really are not meaningful, consider pointing search engines to &lt;a href=&quot;https://support.google.com/webmasters/answer/139066?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;a more meaningful canonical URL&lt;/a&gt;. For example, if you have a paginated index page, sometimes all the secondary pages will appear to have the same metadata.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these cases you can add the &lt;code&gt;canonical&lt;/code&gt; meta tag to point back to the primary page as the one that should be recognized by search engines.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://website.com/section (points to self with metadata)&#xA;&#xA;https://website.com/section/2 (points to main section page with metadata)&#xA;&amp;lt;link rel=&quot;canonical&quot; href=&quot;https://website.com/section&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-29T15:34:33.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22184" PostTypeId="1" CreationDate="2017-09-29T17:24:18.263" Score="2" ViewCount="182" Body="&lt;p&gt;Had absolutely no issue with an older version of their host on the installation and running a Craft CMS site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one has been a bear&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a step by step on best way to install &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only real difference I see is MariaDB, yet they assured me it was just a top layer of MySQL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cPanel Version  66.0 (build 23)&#xA;Apache Version  2.4.27&#xA;PHP Version 5.6.31&#xA;MySQL Version   10.2.9-MariaDB&#xA;Architecture    x86_64&#xA;Operating System    linux&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7324" LastActivityDate="2019-08-23T05:02:55.490" Title="Craft CMS on Host Inmotion" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22185" PostTypeId="1" CreationDate="2017-09-29T19:27:24.837" Score="3" ViewCount="5220" Body="&lt;p&gt;I am thinking about using Craft CMS for building multiple websites for my organization. A friend recommended Craft CMS, but I am finding it very hard to get started, unlike GRAV, which was very easy to install and use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a tutorial that steps users through the building of a simple website from A to Z and in the process explain why Craft CMS should be given more consideration over other tools. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked online only to find a few such tutorials, but you have to pay to access them. I am in the evaluation phase and do not want to pay for something that I might not use.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows of a good and comprehensive tutorial, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="7325" LastActivityDate="2020-11-25T18:24:26.490" Title="Is there an easy-to-follow tutorial to learn Craft CMS basics?" Tags="&lt;templating&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22186" PostTypeId="1" AcceptedAnswerId="22187" CreationDate="2017-09-29T20:03:36.613" Score="4" ViewCount="4469" Body="&lt;p&gt;I'm trying to figure out the best place to keep my one master CSS file in craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the CSS linked in my template as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;link rel=&quot;stylesheet&quot; href=&quot;../craft/css/master.css&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now Blog entries can't get to it, as they are looking in &lt;strong&gt;www.domain.com/index.php/blog/craft/css/master.css&lt;/strong&gt; now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better place to put the CSS, or a better way to link to it in templates?&lt;/p&gt;&#xA;" OwnerUserId="7327" LastActivityDate="2018-06-23T16:06:09.620" Title="What is the optimal place to store CSS files?" Tags="&lt;css&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22187" PostTypeId="2" ParentId="22186" CreationDate="2017-09-29T22:05:40.120" Score="10" Body="&lt;p&gt;In most cases, the best place to store CSS is in a publicly accessible directly, not managed by Craft at all. Such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public/assets/css/master.css&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Storing your CSS and other front-end assets outside of Craft reduces the overhead of accessing those files. While Craft allows you to store css files in your Craft templates folder, there is additional overhead to access those files as they need to be processed by Craft.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-29T22:05:40.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22188" PostTypeId="1" CreationDate="2017-09-29T22:19:32.733" Score="2" ViewCount="48" Body="&lt;p&gt;I'm new to Craft from ExpressionEngine and wondered how people handle Month/Year archive pages.  I have figured out how to get the archives to display but the code seems overly complex.  I wondered if there is a more straightforward approach or if it is possible to display your archive using the same template as the news/index  which displays all. In EE this was possible and just wondered if it was in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.  My archive template code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if month is not defined %}&#xA;    {% set before = year + 1 %}&#xA;    {% set after  = year %}&#xA;{% else %}&#xA;    {% if month == 12 %}&#xA;        {% set yearBefore = year + 1 %}&#xA;        {% set monthBefore = '01' %}&#xA;&#xA;        {% set before = yearBefore~'-'~monthBefore %}&#xA;        {% set after = year~'-'~month %}&#xA;    {% else %}&#xA;        {% set before = year ~ '-' ~ (month + 1) %}&#xA;        {% set after  = year ~ '-' ~ month %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% set allEntries = craft.entries.section('news').limit(null).after(after).before(before) %}&#xA;&#xA;{% for date, entries in allEntries | group(&quot;postDate|date('F Y')&quot;) %}&#xA;    &amp;lt;h3&amp;gt;Entries from {{ date }}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;article class=&quot;post&quot;&amp;gt;&#xA;            {% for asset in entry.newsthumb %}&#xA;                &amp;lt;div class=&quot;image-wrapp&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ asset.url('newsthumb') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt; &amp;lt;/a&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;            &amp;lt;div class=&quot;text-wrapp&quot;&amp;gt;&#xA;                &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;                &amp;lt;time datetime=&quot;2017-07-27&quot; class=&quot;post-time&quot;&amp;gt;{{ entry.postDate.format('F d, Y') }} &amp;lt;/time&amp;gt;&#xA;&#xA;                {{ entry.newssummary }}&#xA;&#xA;                {% if entry.newscategory | length %}&amp;lt;ul class=&quot;category-list&quot;&amp;gt;{% endif %}&#xA;                {% nav category in entry.newscategory %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}{{ not loop.last ? ', ' }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endnav %}&#xA;&#xA;                {% if entry.newscategory | length %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="57" LastEditDate="2017-09-30T00:24:51.303" LastActivityDate="2017-10-02T02:10:11.097" Title="Is it possible to use same template for index and archive template?" Tags="&lt;archives&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22189" PostTypeId="1" CreationDate="2017-09-29T23:39:12.650" Score="2" ViewCount="100" Body="&lt;p&gt;I have the latest versions of Craft CMS, Sprout Email and Craft Contact plugins. Sprout behaves fine with some notifications I have set up. However, if I submit a contact form it throws a PHP error - &lt;code&gt;mb_convert_case() expects parameter 1 to be string, array given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I disable Sprout, then Contact Form works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the logs, I see that submitting the form triggers a 'When an entry is saved' event and Sprout starts looking at whether it is something it should handle and then chokes when trying to parse it as an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I finally got things to work by disabling the &quot;Enable Sent Email tracking&quot; feature in Sprout Email, but I would prefer not to have to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered anything like this or have any thoughts on this? Thanks for any input!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2017-09-30T00:42:58.633" LastActivityDate="2017-10-18T21:58:34.440" Title="Sprout Email conflicts with Craft Contact Form" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22190" PostTypeId="2" ParentId="22175" CreationDate="2017-09-30T00:40:19.387" Score="0" Body="&lt;p&gt;In your Rich Text field settings, if you select the &quot;Standard&quot; Redactor config that ships with a fresh Craft install (maps to the &lt;code&gt;.json&lt;/code&gt; files in &lt;code&gt;craft/config/redactor&lt;/code&gt;), it has the &quot;Video&quot; plugin selected by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dmt1m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dmt1m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will add a Video button to your Rich Text field toolbar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w0LiT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w0LiT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking it will let you embed iframe code that you can output on the front-end of your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DVxJx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DVxJx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-09-30T00:40:19.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22191" PostTypeId="2" ParentId="22185" CreationDate="2017-09-30T00:54:55.330" Score="4" Body="&lt;p&gt;Craft has an official getting started tutorial now! &lt;a href=&quot;https://craftcms.com/docs/getting-started-tutorial/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/getting-started-tutorial/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Original Answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Welcome to Craft!  Here's a collection of developer resources to help get you up to speed on Craft quickly.&lt;/p&gt;&#xA;&lt;p&gt;The most important thing to note about Craft CMS and Craft Commerce is that they are platforms used to build bespoke solutions for clients. They are light on traditional &amp;quot;out of the box&amp;quot; features and instead invest heavily on providing developers with a modern toolset and content teams with a great author experience. In practice this means that every Craft site is made specifically for the client which is great and what clients and developers appreciate about it. The downside is if you are brand new to Craft and have no context to the original build out or developer, it can be a challenge to get up to speed.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Craft Official Docs &amp;amp; Support&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms.com/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS docs&lt;/a&gt; - Pretty comprehensive and worth reading if you're new to Craft.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcommerce.com/docs/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce docs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Slack group&lt;/a&gt; - All of the Craft dev team is on Slack every day with 5,000+ other Craft developers and users from all over the world.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms.stackexchange.com/&quot;&gt;Craft StackExchange&lt;/a&gt; - You'e obviously found this one, but this is the best place to ask &amp;quot;how do I&amp;quot; implementation questions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Learn Craft&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Free and commercial.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://mijingo.com/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo Craft's Tutorials&lt;/a&gt; — Mijingo is an official Craft education &amp;amp; training partner. They have a number of excellent free and paid resources for Craft &amp;amp; Craft Commerce. Ryan Irelan, Mijingo's founder, also offers customized training online or on-site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://tutsplus.com/courses/search/Craft+CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tuts+ Tutorials&lt;/a&gt; — Not official but very good and low cost (most are $9).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/hangouts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Straight Up Hangouts&lt;/a&gt; — Hosted by Ben Parizek, these are live learning sessions with Ben and a member of the Craft team.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog&quot; rel=&quot;nofollow noreferrer&quot;&gt;Studio 107 Blog&lt;/a&gt; — Andrew Welch is a prolific Craft developer and the creator of the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOMatic plugin&lt;/a&gt;. He has some excellent developer-oriented posts on Craft that are worth reading.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2020-11-19T19:37:44.617" LastActivityDate="2020-11-19T19:37:44.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22192" PostTypeId="2" ParentId="21898" CreationDate="2017-09-30T03:36:40.130" Score="1" Body="&lt;p&gt;As of this comment, Craft 3 is still in beta but you may want to consider it as your challenge sounds like the new Sites functionality may be a good fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sites, allow you to manage multiple websites and multiple languages in one Craft installation. You can find a longer discussion and some examples here: &#xA;&lt;a href=&quot;https://straightupcraft.com/events/managing-multiple-sites-in-craft-3-sites-and-localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Managing Multiple Sites in Craft 3 – Sites and Localization&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a Site for each combo of Garage and Language that you need to manage. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Garage 1 - French&lt;/li&gt;&#xA;&lt;li&gt;Garage 1 - German&lt;/li&gt;&#xA;&lt;li&gt;Garage 2 - French&lt;/li&gt;&#xA;&lt;li&gt;Garage 2 - German&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The blog and other sections for each of these sites could be managed under one channel. Admin users would be able to switch between each subsite just as they switch between locales when editing an entry. User Groups could be created for each subsite as well as the permissions in Craft 3 will allow you to restrict a users access to a specific subsite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about how to configure each site in this &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;Localization Guide&lt;/a&gt; in the Craft docs. You'll need to configure a couple of files for each site and make sure your DNS is pointing to the right place for each subdomain. But once you get those items setup, you should be able to use the same templates for all of the different sites and languages.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-09-30T03:36:40.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22193" PostTypeId="2" ParentId="21779" CreationDate="2017-09-30T23:51:59.513" Score="2" Body="&lt;p&gt;I had the exact same issue with a client and their horrendous Wordpress blog posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, after importing all the posts and copying over the related images, I wrote a simple plugin that lets you use a &lt;code&gt;|firstImage&lt;/code&gt; filter to grab the first image from a rich text field. I've added it to GitHub: &lt;a href=&quot;https://github.com/DigitalSquid/Craft-CMS-First-Image&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/DigitalSquid/Craft-CMS-First-Image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A rough example of how to use it:&lt;code&gt;&#xA;{% set firstImage = entry.body|firstImage %}&#xA;{% if firstImage|length %}&#xA;    &amp;lt;img src=&quot;{{ firstImage }}&quot; /&amp;gt;&#xA;{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3864" LastEditorUserId="3864" LastEditDate="2017-10-01T00:23:52.393" LastActivityDate="2017-10-01T00:23:52.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22194" PostTypeId="2" ParentId="21146" CreationDate="2017-10-01T03:38:37.500" Score="1" Body="&lt;p&gt;I ran into this issue too and had landed on this thread. I was able to piece together a solution using the modify elements query method. I wrote a pull request that got merged, so lazy-loading works with this plugin as of version &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint/commit/5b5f2c0bf416cfe98ae2332d1c0a62334ae4b69f&quot; rel=&quot;nofollow noreferrer&quot;&gt;1.1.4&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1116" LastActivityDate="2017-10-01T03:38:37.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22195" PostTypeId="2" ParentId="18608" CreationDate="2017-10-01T03:40:20.867" Score="2" Body="&lt;p&gt;I ran into this issue too and had landed on this thread (and another similar one). I was able to piece together a solution using the modify elements query method. I wrote a pull request that got merged, so lazy-loading works with this plugin as of version 1.1.4.&lt;/p&gt;&#xA;" OwnerUserId="1116" LastActivityDate="2017-10-01T03:40:20.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22196" PostTypeId="2" ParentId="15365" CreationDate="2017-10-01T03:43:31.123" Score="1" Body="&lt;p&gt;I was running into this same issue where all of the focal points were being lost when saving entries from the command line. I wrote a pull request to fix the issue that was recently merged, so this should hopefully no longer be an issue as of version &lt;a href=&quot;https://github.com/smcyr/Craft-FocusPoint/commit/ed063821a3009c9a0f66e1bbc9ca5fa3f410e007&quot; rel=&quot;nofollow noreferrer&quot;&gt;1.1.7&lt;/a&gt;. :)&lt;/p&gt;&#xA;" OwnerUserId="1116" LastActivityDate="2017-10-01T03:43:31.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22197" PostTypeId="1" AcceptedAnswerId="22214" CreationDate="2017-10-01T22:14:45.040" Score="1" ViewCount="41" Body="&lt;p&gt;I’m using the &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow noreferrer&quot;&gt;LJ Dynamic Fields&lt;/a&gt; plugin and have a dynamic multi select setup for the client to select predefined tags, which is working all fine in the cms using the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tags in craft.tags.group('default').limit(null).order('title') %}&#xA;{ &quot;value&quot;:&quot;{{ tags.id }}&quot; , &quot;label&quot;:&quot;{{ tags | raw | capitalize }}&quot;&#xA;}{% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in my template I can only seem to output the id, but I want the tag title. I’m using the following code in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tags in entry.tagsMultiSelect %}&#xA;&amp;lt;a href=&quot;&quot;&amp;gt;{{ tags }}&amp;lt;/a&amp;gt;&#xA;{% if not loop.last %}, {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me where I’m going wrong?&lt;/p&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2017-10-02T14:55:11.093" Title="LJ Dynamic Fields unable to output title" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22198" PostTypeId="2" ParentId="22184" CreationDate="2017-10-01T22:46:46.270" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not find your craft/ folder. Please ensure that $craftPath is set correctly in &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is usually one of 3 things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The path to the &lt;code&gt;craft&lt;/code&gt; folder defined in your public index.php file in &lt;code&gt;$craftPath&lt;/code&gt; is incorrect.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The path defined in &lt;code&gt;$craftPath&lt;/code&gt; is correct, but PHP doesn't have permissions to go into that folder and open index.php.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your php.ini file has &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.open-basedir&quot; rel=&quot;nofollow noreferrer&quot;&gt;open_basedir&lt;/a&gt; restrictions in place that prevent PHP from opening that folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-01T22:46:46.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22199" PostTypeId="2" ParentId="22179" CreationDate="2017-10-01T23:11:47.153" Score="1" Body="&lt;p&gt;Yii 1 gets its localization data from the &lt;a href=&quot;http://cldr.unicode.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unicode Common Locale Data Repository&lt;/a&gt;.  You can see that info in &lt;code&gt;craft/app/vendor/yiisoft/yii/framework/i18n/data/nl_be.php&lt;/code&gt; where &lt;code&gt;currencyFormat&lt;/code&gt; is defined as &lt;code&gt;'currencyFormat' =&amp;gt; '#,##0.00 ¤'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;¤&lt;/code&gt; is the placeholder for the locale's currency symbol, which puts it after the digits, which explains the behavior you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to continue to use that specific locale, you could do a &lt;code&gt;|replace&lt;/code&gt; everywhere you output a currency.  Or you could core hack that locale file to alter it and just make a note to check it after updating.  Those locale files do get updated, but it's pretty rarely. Or you could switch to &lt;code&gt;nl.php&lt;/code&gt; which appears to have the currency symbol first.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-01T23:11:47.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22200" PostTypeId="2" ParentId="22188" CreationDate="2017-10-02T02:10:11.097" Score="1" Body="&lt;p&gt;The way I do this is to use a different template for each set of entries. So there would be an archive one for all the articles from a given month: &lt;code&gt;_news/index-archive&lt;/code&gt;, and a category one for all the articles in a given category: &lt;code&gt;_news/index-category&lt;/code&gt;, and one for all of the entries: &lt;code&gt;_news/index-all&lt;/code&gt;, maybe one for articles by tag, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of these templates sets &lt;code&gt;entries&lt;/code&gt; to the relevant entries, and then does&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_news/index-generic' with {&#xA;  entries: entries&#xA;} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And &lt;code&gt;index-generic&lt;/code&gt; has all the shared display code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably there will be a couple of other things that vary as well, for example a heading:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_news/index-generic' with {&#xA;  entries: entries,&#xA;  heading: 'Category: '~category.title&#xA;} only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-02T02:10:11.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22202" PostTypeId="2" ParentId="19274" CreationDate="2017-10-02T04:35:35.473" Score="2" Body="&lt;p&gt;The original answer is good, but as noted, somewhat incorrect, at least concerning a chainable &lt;code&gt;.with()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my attempt to explain things: &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speed up your Craft CMS Templates with Eager Loading&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-02T04:35:35.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22203" PostTypeId="2" ParentId="17639" CreationDate="2017-10-02T04:39:03.667" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Thanks for this Mats. Is there a general guide as to when you should really use Eager loading? I am not seeing much improvement&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The article &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speed up your Craft CMS Templates with Eager Loading&lt;/a&gt; I wrote hopefully gives you the &quot;general guide&quot; you asked for.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-02T04:39:03.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22204" PostTypeId="2" ParentId="2085" CreationDate="2017-10-02T05:55:43.300" Score="1" Body="&lt;p&gt;I know this doesn't answer the question, but personally I don't bother; I just add a robots.txt file to stop it getting indexed.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2017-10-02T05:55:43.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22205" PostTypeId="2" ParentId="22186" CreationDate="2017-10-02T07:18:00.720" Score="1" Body="&lt;p&gt;As Ben said, you want them in the public folder. Also, you may want to use the Twig tag &lt;code&gt;{% includeCssFile ...%)&lt;/code&gt; instead of the HTML &lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; ...&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It outputs the same way, but it works better once you start having different template folders on your site. Documentation can be found here: &lt;a href=&quot;https://craftcms.com/docs/templating/includecssfile&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/includecssfile&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-10-02T07:18:00.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22206" PostTypeId="2" ParentId="22185" CreationDate="2017-10-02T07:23:14.093" Score="1" Body="&lt;p&gt;Jeroen Kenters' YouTube video called &quot;Migrating a website to Craft CMS for Beginners&quot; was extremely helpful for me. Assuming you know about the other languages involved (HTML and CSS), it's a great quick-start guide. He also goes over how/where to find things on the Craft and Twig documentation sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=m3BO5EP05qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=m3BO5EP05qs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-10-02T07:23:14.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22207" PostTypeId="2" ParentId="22175" CreationDate="2017-10-02T07:46:57.290" Score="1" Body="&lt;p&gt;If you want to upload and host the video on your site's server, then I would create a field with an Asset field type and restrict the type to Video. Without further details, it's hard to understand why you'd want to handle it within a Rich Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're hosting the video, you don't need an iframe. Just use the HTML5 &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; tag...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for video in entry.FIELDNAME %}&#xA;&amp;lt;video width=&quot;320&quot; height=&quot;240&quot; controls&amp;gt;&#xA;&amp;lt;source src=&quot;{{ video.getUrl }}&quot; type=&quot;video/mp4&quot;&amp;gt;&#xA;&amp;lt;/video&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your servers will be handling the bandwidth for video delivery though; which is why most people post to YouTube or Vimeo and use the iframe to pass it through. To do that, you'd use the include that Brad mentioned.&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-10-02T07:46:57.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22209" PostTypeId="2" ParentId="22158" CreationDate="2017-10-02T09:16:25.920" Score="2" Body="&lt;p&gt;Ok, so I have figured out why this wasn't working. &#xA;When clicking on reset asset indexes It was always popping up an alert saying that another asset was missing. I already knew this, and it was something I intended on dealing with later. So I clicked OK and as the progress indicator continued to run along with the Tick Icon, I assumed it continued to update everything else, skipping over the error.&#xA;But it turns out this isn't the case. The function halts at the error. So once I fixed this other missing asset, everything worked.&#xA;It is a little misleading having the progress animation and tick icon still work when in fact nothing is happening.&#xA;thanks for all your help. :)&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-10-02T09:16:25.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22210" PostTypeId="1" CreationDate="2017-10-02T09:43:56.303" Score="1" ViewCount="679" Body="&lt;p&gt;I am trying to display a list of entries.  Specifically the parent entry and it's children's entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started off using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in craft.entries.section('forms').isChildOf.slug('applicant-form') %}&#xA;&#xA;    &amp;lt;li&amp;gt;&#xA;        {{ page.getLink() }}&#xA;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this only displays the Parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this solution on Stack here, and all the children display but not the parent.  I also wonder if this is the best solution to display the children as it seems a bit more lines than what is in the Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topLevel = (entry.level == 1) ? entry : entry.getAncestors().level(1).first()  %}&#xA;&#xA;{% if topLevel.hasDescendants %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% set nav =  topLevel.getDescendants()  %}&#xA;&#xA;        {% nav page in nav  %}&#xA;            {% if page.id != entry.id %}&#xA;                &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {%else%}&#xA;                &amp;lt;li&amp;gt;{{page}}&amp;lt;/li&amp;gt;&#xA;            {%endif%}&#xA;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;&#xA;        {% endnav %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7118" LastEditorUserId="57" LastEditDate="2017-10-02T18:06:11.920" LastActivityDate="2017-10-03T23:32:57.650" Title="List both parent entry and its child entry" Tags="&lt;children&gt;&lt;parents&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22211" PostTypeId="1" AcceptedAnswerId="22212" CreationDate="2017-10-02T10:34:17.683" Score="2" ViewCount="64" Body="&lt;p&gt;When adding a Categories field to a section, if you select only child categories, Craft automatically selects the parent categories too. I emailed Craft support about this and they explained it's by design and the workaround is to use a Structure instead of Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unhappy with this as a workaround and was hoping their was another way to do this, either with a custom plugin or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="6077" LastActivityDate="2017-10-02T18:07:33.307" Title="Associate child categories only to an entry" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22212" PostTypeId="2" ParentId="22211" CreationDate="2017-10-02T11:16:07.993" Score="2" Body="&lt;p&gt;I managed to workaround this by creating my own custom fieldtype which is 99% the code from the Craft CategoriesFieldType, but with the only difference being I removed the call to &lt;code&gt;craft()-&amp;gt;categories-&amp;gt;fillGapsInCategoryIds($categoryIds)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works but I've yet to see if it causes any side-effects I need to worry about.&lt;/p&gt;&#xA;" OwnerUserId="6077" LastEditorUserId="57" LastEditDate="2017-10-02T18:07:33.307" LastActivityDate="2017-10-02T18:07:33.307" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22214" PostTypeId="2" ParentId="22197" CreationDate="2017-10-02T14:55:11.093" Score="3" Body="&lt;p&gt;The values in your &lt;code&gt;tagsMultiSelect&lt;/code&gt; are the tag ids, not the tags.&#xA;So, what you need to do in your template is convert that id to a tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tagId in entry.tagsMultiSelect %}&#xA;  {# get the tag with that id #}&#xA;  {% set tag = craft.tags.id(tagId).first %}&#xA;&#xA;  &amp;lt;a href=&quot;&quot;&amp;gt;{{ tag.title ?? 'no such tag' }}&amp;lt;/a&amp;gt;&#xA;  {% if not loop.last %}, {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If what you want is a predefined set of tags, you might also consider changing that tag group into a category - that would let you use a regular category field for your &lt;code&gt;tagsMultiSelect&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-02T14:55:11.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22215" PostTypeId="1" AcceptedAnswerId="22245" CreationDate="2017-10-02T17:27:06.187" Score="1" ViewCount="181" Body="&lt;p&gt;I've gone through all the steps here to remove index.php &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The .htacess file is the default one that came with Craft on install&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In my config/general.php file I have the setting set explicity..&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; 'true',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I wrote to Arcustech for help with the httpd.conf file as the last step and they said...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Changing that setting is not something we will update on Arcustech. If you were not already aware, we are a Craft CMS Hosting Partner and removing index.php in Craft URLs works on our servers without that update.&lt;/p&gt;&#xA;&lt;p&gt;If you tell Craft Support you are hosted with Arcustech the Craft support team will know stuff will work here, so something else is wrong in the setup or .htaccess file. The account is not set up as a Craft Optimized plan (&lt;a href=&quot;https://www.arcustech.com/managed/craftcms-hosting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.arcustech.com/managed/craftcms-hosting/&lt;/a&gt;) but that does not matter for basic functionality like that in Craft.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I asked to be moved to the Craft Optimized plan, but it doesn't sound like that's an issue.&lt;/p&gt;&#xA;&lt;p&gt;Any idea what's going on? Somedays it's fine. Today, at the moment, it's not.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-04T13:59:06.930" Title="Why does index.php persists in my URL?" Tags="&lt;url&gt;&lt;config&gt;&lt;admin&gt;&lt;index&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22216" PostTypeId="1" CreationDate="2017-10-02T18:37:23.570" Score="0" ViewCount="527" Body="&lt;p&gt;So far I've only ever developed for Apache servers but that streak is about to end and I'm having to dive into nginx. However, none of the so-called base nginx conf files seem to work for me and there's a lot of things that seem superfluous or specific to a workflow or prescribed manner of doing things. This is fine, with more experience, but when I install Craft CMS for the first time there is an .htaccess file that comes with the install that is enough to get up and running in MAMO Pro without any problems. What would the nginx conf file equivalent to this be? Once I get up and running I can worry about improving or adding things as needed but for now I just need to get  basic installation up and running in MAMP Pro. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I started researching nginx a little more and I think I'm beginning to understand more about how it works but at a very rudimentary level. I got Craft installed but only the home page works. Subpage links don't work and I can't access the admin site. The link is site.dev:81 (since it's nginx it's running on port 81) and the home page loads fine but clicking on a link sends the browser to site.dev/page.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the nginx.conf file MAMP Pro creates. I see little difference between the file @khalwat links to and the one MAMP creates other then the MAMP file being more verbose. Is there anything in this conf file that would create problems for Craft and cause the url to behave in the manner described?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;`&#xA;    MAMP_ngx_http_image_filter_module_MAMPload_module &quot;modules/ngx_http_image_filter_module.so&quot;;&#xA;    MAMP_ngx_http_perl_module_MAMPload_module &quot;modules/ngx_http_perl_module.so&quot;;&#xA;    MAMP_ngx_http_xslt_filter_module_MAMPload_module &quot;modules/ngx_http_xslt_filter_module.so&quot;;&#xA;    MAMP_ngx_mail_module_MAMPload_module &quot;modules/ngx_mail_module.so&quot;;&#xA;    MAMP_ngx_stream_module_MAMPload_module &quot;modules/ngx_stream_module.so&quot;;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MAMP_User_Directive_MAMPuser                        MAMP_User_MAMP MAMP_Group_MAMP;&#xA;worker_processes            auto;&#xA;&#xA;events {&#xA;worker_connections      1024;&#xA;}&#xA;&#xA;http {&#xA;include                 /Applications/MAMP/conf/nginx/mime.types;&#xA;default_type            text/html;&#xA;gzip                    on;&#xA;gzip_types              text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;&#xA;&#xA;sendfile                on;&#xA;keepalive_timeout       65;&#xA;&#xA;# access_log            &quot;/Applications/MAMP/logs/nginx_access.log&quot;;&#xA;error_log               &quot;MAMP_NginxErrorLog_MAMP&quot;;&#xA;&#xA;server_names_hash_bucket_size  128;&#xA;&#xA;MAMP_Bonjour_SubsFilter_IF_MAMP&#xA;subs_filter_types       text/html text/xml application/javascript;&#xA;MAMP_Bonjour_SubsFilter_END_MAMP&#xA;&#xA;server {&#xA;    listen              MAMP_Port_MAMP default_server;&#xA;    listen              MAMP_SSL_Port_MAMP default_server ssl;&#xA;    ssl_ciphers         'aNULL';&#xA;    ssl_certificate     &quot;/Applications/MAMP/conf/server/default.crt&quot;;&#xA;    ssl_certificate_key &quot;/Applications/MAMP/conf/server/default.key&quot;;&#xA;&#xA;    return 444;&#xA;}&#xA;&#xA;server {&#xA;    listen              MAMP_Port_MAMP;&#xA;    server_name         localhost;&#xA;&#xA;    root                &quot;MAMP_Localhost_DocumentRoot_MAMP&quot;;&#xA;&#xA;    location / {&#xA;        index            MAMP_Localhost_DirectoryIndex_MAMP;&#xA;    }&#xA;&#xA;    location ~* /MAMP([^-].*)$ {&#xA;        root             &quot;/Library/Application Support/appsolute/MAMP PRO&quot;;&#xA;        index            index.php;&#xA;&#xA;        location ~ \.php$ {&#xA;            try_files        $uri =404;&#xA;            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;        }&#xA;    }&#xA;&#xA;    location ~* /phpMyAdmin(.*)$ {&#xA;        root             &quot;/Library/Application Support/appsolute/MAMP PRO&quot;;&#xA;        index            index.php;&#xA;&#xA;        location ~ \.php$ {&#xA;            try_files        $uri =404;&#xA;            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;        }&#xA;    }&#xA;&#xA;    location ~* /phpPgAdmin(.*)$ {&#xA;        root             /Applications/MAMP/bin;&#xA;        index            index.php;&#xA;&#xA;        location ~ \.php$ {&#xA;            try_files        $uri =404;&#xA;            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;        }&#xA;    }&#xA;&#xA;    location ~* /phpLiteAdmin(.*)$ {&#xA;        root             /Applications/MAMP/bin;&#xA;        index            index.php;&#xA;&#xA;        location ~ \.php$ {&#xA;            try_files        $uri =404;&#xA;            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;        }&#xA;    }&#xA;&#xA;    location ~* /adminer(.*)$ {&#xA;        root             /Applications/MAMP/bin;&#xA;        index            adminer.php;&#xA;&#xA;        location ~ \.php$ {&#xA;            try_files        $uri =404;&#xA;            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;        }&#xA;    }&#xA;&#xA;    location /icons {&#xA;        alias /Applications/MAMP/Library/icons;&#xA;        autoindex on;&#xA;    }&#xA;&#xA;    location /favicon.ico {&#xA;        alias /Applications/MAMP/bin/favicon.ico;&#xA;        # log_not_found off;&#xA;        # access_log off;&#xA;    }&#xA;&#xA;    location ~ \.php$ {&#xA;        try_files        $uri =404;&#xA;        fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;&#xA;        fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;        include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;    }&#xA;&#xA;    location ~ /\. {&#xA;        deny all;&#xA;    }&#xA;&#xA;    # location ~* \.(gif|jpg|png|pdf)$ {&#xA;    #     expires          30d;&#xA;    # }&#xA;&#xA;    # location = /robots.txt {&#xA;    #     allow all;&#xA;    #     log_not_found off;&#xA;    #     access_log off;&#xA;    # }&#xA;&#xA;    # location ~* \.(txt|log)$ {&#xA;    #     allow 127.0.0.1;&#xA;    #     deny all;&#xA;    # }&#xA;&#xA;    # location ~ \..*/.*\.php$ {&#xA;    #     return 403;&#xA;    # }&#xA;&#xA;    location /nginx_status {&#xA;        stub_status      on;&#xA;        access_log       off;&#xA;        allow            127.0.0.1;&#xA;        deny             all;&#xA;    }&#xA;}&#xA;&#xA;MAMP_VirtualHost_iteration_begin_MAMP&#xA;server {&#xA;    server_name         MAMP_VirtualHost_ServerName_MAMP;&#xA;    listen              MAMP_IP_Port_MAMP;&#xA;    MAMP_VirtualHost_ServerAliases_MAMP&#xA;&#xA;    root                &quot;MAMP_VirtualHost_DocumentRoot_MAMP&quot;;&#xA;&#xA;    location / {&#xA;        try_files       MAMP_Try_Files_MAMP;&#xA;        index           MAMP_VirtualHost_DirectoryIndex_MAMP;&#xA;        autoindex       MAMP_VirtualHost_AutoIndex_MAMP;&#xA;        MAMP_VirtualHost_Allow_MAMP&#xA;        MAMP_VirtualHost_Deny_MAMP&#xA;        MAMP_LocationCustom_MAMP&#xA;    }&#xA;&#xA;    MAMP_Nginx_ReverseProxy_IF_MAMP&#xA;    # proxy the PHP scripts to Apache&#xA;    location ~ \.php$ {&#xA;        proxy_set_header Host $host;&#xA;        proxy_set_header X-Real-IP $remote_addr;&#xA;        proxy_pass http://MAMP_Apache_IP_MAMP:MAMP_Apache_Port_MAMP;&#xA;    }&#xA;    MAMP_Nginx_ReverseProxy_ELSE_MAMP&#xA;    location ~ \.php$ {&#xA;        try_files        $uri =404;&#xA;        fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpHost_MAMP.sock;&#xA;        fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;        include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;    }&#xA;    MAMP_Nginx_ReverseProxy_END_MAMP&#xA;&#xA;    MAMP_Bonjour_Substitution_IF_MAMP&#xA;    proxy_set_header Accept-Encoding &quot;&quot;;&#xA;    subs_filter http://MAMP_Bonjour_Hostname_MAMP http://MAMP_Bonjour_DNS_Name_MAMP gi;&#xA;    subs_filter https://MAMP_Bonjour_Hostname_MAMP https://MAMP_Bonjour_DNS_Name_MAMP gi;&#xA;    MAMP_Bonjour_Substitution_END_MAMP&#xA;&#xA;    MAMP_VirtualHost_AdditionalCustom_MAMP&#xA;}&#xA;MAMP_VirtualHost_iteration_end_MAMP&#xA;&#xA;MAMP_SSLVirtualHost_iteration_begin_MAMP&#xA;server {&#xA;    server_name         MAMP_SSLVirtualHost_ServerName_MAMP;&#xA;    listen              MAMP_SSL_IP_Port_MAMP ssl;&#xA;    MAMP_SSLVirtualHost_ServerAliases_MAMP&#xA;&#xA;    root                &quot;MAMP_SSLVirtualHost_DocumentRoot_MAMP&quot;;&#xA;    # access_log          &quot;/Applications/MAMP/logs/nginx_ssl_access.log&quot;;&#xA;    error_log           &quot;/Applications/MAMP/logs/nginx_ssl_error.log&quot;;&#xA;&#xA;    ssl_certificate     &quot;MAMP_SSLVirtualHost_Certificate_MAMP&quot;;&#xA;    ssl_certificate_key &quot;MAMP_SSLVirtualHost_CertificateKey_MAMP&quot;;&#xA;    ssl_session_cache   shared:SSL:10m;&#xA;    ssl_session_timeout 10m;&#xA;    ssl_session_tickets off;&#xA;&#xA;    MAMP_SSLVirtualHost_OnlyAllowTLS_MAMPssl_protocols       TLSv1 TLSv1.1 TLSv1.2;&#xA;    MAMP_SSLVirtualHost_OnlyAllowTLS_MAMPssl_ciphers         'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';&#xA;    MAMP_SSLVirtualHost_OnlyAllowTLS_MAMPssl_prefer_server_ciphers  on;&#xA;&#xA;    location / {&#xA;        try_files       MAMP_Try_Files_MAMP;&#xA;        index           MAMP_SSLVirtualHost_DirectoryIndex_MAMP;&#xA;        autoindex       MAMP_VirtualHost_AutoIndex_MAMP;&#xA;        MAMP_VirtualHost_Allow_MAMP&#xA;        MAMP_VirtualHost_Deny_MAMP&#xA;    }&#xA;&#xA;    MAMP_Nginx_ReverseProxy_IF_MAMP&#xA;    # proxy PHP scripts to Apache&#xA;    location ~ \.php$ {&#xA;        proxy_set_header Host $host;&#xA;        proxy_set_header X-Real-IP $remote_addr;&#xA;        proxy_pass http://MAMP_Apache_IP_MAMP:MAMP_Apache_Port_MAMP;&#xA;    }&#xA;    MAMP_Nginx_ReverseProxy_ELSE_MAMP&#xA;    location ~ \.php$ {&#xA;        try_files        $uri =404;&#xA;        fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpHost_MAMP.sock;&#xA;        fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;        include          /Applications/MAMP/conf/nginx/fastcgi_params;&#xA;    }&#xA;    MAMP_Nginx_ReverseProxy_END_MAMP&#xA;&#xA;    MAMP_Bonjour_Substitution_IF_MAMP&#xA;    proxy_set_header Accept-Encoding &quot;&quot;;&#xA;    subs_filter http://MAMP_Bonjour_Hostname_MAMP http://MAMP_Bonjour_DNS_Name_MAMP gi;&#xA;    subs_filter https://MAMP_Bonjour_Hostname_MAMP https://MAMP_Bonjour_DNS_Name_MAMP gi;&#xA;    MAMP_Bonjour_Substitution_END_MAMP&#xA;&#xA;    MAMP_VirtualHost_AdditionalCustom_MAMP&#xA;}&#xA;MAMP_SSLVirtualHost_iteration_end_MAMP&#xA;}&#xA;&#xA;# DONT REMOVE: MAMP PRO nginx.conf template compatibility version: 15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;`&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="231" LastEditDate="2017-10-05T15:31:21.367" LastActivityDate="2017-10-05T15:31:21.367" Title="what is a base, no frills, nginx conf file to get up and running with Craft CMS and MAMP Pro" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22217" PostTypeId="2" ParentId="22216" CreationDate="2017-10-02T19:46:04.383" Score="1" Body="&lt;p&gt;So there is &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt; which might actually be one of the configs you found, and decided there is too much superfluous stuff going on with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I never added a basic configuration for Nginx-Craft is the local dev environment I use (&lt;a href=&quot;https://nystudio107.com/blog/local-development-with-vagrant-homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Homestead&lt;/a&gt;) creates these configurations for you, so I've never seen the need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, I added a basic configuration to the repo for you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/basic_localdev.com.conf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/basic_localdev.com.conf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you change the &lt;code&gt;fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;&lt;/code&gt; to reflect a path to whatever version of PHP you're running locally.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2017-10-02T20:02:55.970" LastActivityDate="2017-10-02T20:02:55.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22219" PostTypeId="2" ParentId="22210" CreationDate="2017-10-03T08:55:47.877" Score="1" Body="&lt;p&gt;This is the corrected Twig code. I simply added &lt;code&gt;{{ entry.title }}&lt;/code&gt; as an &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; item. This nav appears only on the page that I needed &lt;code&gt;entry.title&lt;/code&gt; displaying.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navList = (entry.level == 2) ? entry : entry.getAncestors().level(2).first()  %}&#xA;&#xA;{% if navList.hasDescendants %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% set nav =  navList.getDescendants()  %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% nav page in nav  %}&#xA;            {% if page.id != entry.id %}&#xA;                &amp;lt;li&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;li&amp;gt;{{page}}&amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7118" LastEditorUserId="130" LastEditDate="2017-10-03T23:32:57.650" LastActivityDate="2017-10-03T23:32:57.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22220" PostTypeId="1" CreationDate="2017-10-03T10:32:55.943" Score="0" ViewCount="2945" Body="&lt;p&gt;Researching this online and not having much luck if anyone has done this before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one get the content from the CMS to update the FE and also create new pages / modules as a normal CMS would allow you to do? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Little confused on this. &lt;/p&gt;&#xA;" OwnerUserId="7337" LastActivityDate="2018-09-07T19:44:34.063" Title="Craft CMS &amp; React JS" Tags="&lt;craft-features&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22221" PostTypeId="1" CreationDate="2017-10-03T10:54:51.637" Score="1" ViewCount="32" Body="&lt;p&gt;I've setup a Matrix field with an entries field and output the value like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = block.blockLink.first() %}&#xA; {% if entry %}&#xA;  &amp;lt;p class=&quot;ctaLink&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Find out more&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA; {% endif %}    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs the value of the entries field OK. However any other Matrix field that follows on from this one fails to display at all. What am I doing wrong? Any advice gratefully received!&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="57" LastEditDate="2017-10-03T18:33:58.867" LastActivityDate="2017-10-04T14:23:33.500" Title="Matrix entries field prevents following Matrix field to display" Tags="&lt;matrix&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22222" PostTypeId="1" CreationDate="2017-10-03T14:51:27.927" Score="1" ViewCount="307" Body="&lt;p&gt;I am migrating content from a drupal site into Craft CMS. I am trying to using the FeedMe Plugin to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm working with a single test XML file to make sure my fields and setup are correct before I do the bulk import. However, my xml only ever creates the first matrix block. There is no limit to the number of blocks a user can include in the matrix block field I'm importing to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry I am migrating content into has three tabs for fields. The main tab consists of the title and a matrix block. The third tab has a third party field &quot;Legacy URL&quot; from the Retour Craft CMS Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My XML looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&#xA;&amp;lt;node_export created=&quot;Mon, 02 Oct 2017 00:15:47 -0400&quot;&amp;gt;&#xA;    &amp;lt;node&amp;gt;&#xA;        &amp;lt;title&amp;gt;Celebrating J Day&amp;lt;/title&amp;gt;&#xA;        &amp;lt;nid&amp;gt;862&amp;lt;/nid&amp;gt;&#xA;        &amp;lt;post_date&amp;gt;2017-09-22T00:00:00&amp;lt;/post_date&amp;gt;&#xA;        &amp;lt;summary&amp;gt;A super summary.&amp;lt;/summary&amp;gt;&#xA;        &amp;lt;storyBlock&amp;gt;&#xA;            &amp;lt;image&amp;gt;&#xA;                &amp;lt;image&amp;gt;http://website.com/path/to/my/image.png&amp;lt;/image&amp;gt;&#xA;                &amp;lt;position&amp;gt;center&amp;lt;/position&amp;gt;&#xA;            &amp;lt;/image&amp;gt;&#xA;            &amp;lt;text&amp;gt;&#xA;                &amp;lt;text&amp;gt;Some awesome text is here.&amp;lt;/text&amp;gt;&#xA;            &amp;lt;/text&amp;gt;&#xA;        &amp;lt;/storyBlock&amp;gt;&#xA;    &amp;lt;/node&amp;gt;&#xA;&amp;lt;/node_export&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My FeedMe field mapping looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1wk2E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1wk2E.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WGdBN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WGdBN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The title, post_date, summary, and image matrix block all get imported properly. However, the text block and the nid into the legacy url field are not being imported.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The versions of everything:&#xA;FeedMe 2.0.7&#xA;Craft CMS 2.6.2991&#xA;PHP 7&#xA;MySQL 5.7&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it look like I've set something up incorrectly? Any advice on how I can get this running correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If any of the above is unclear, or if there is additional information I can provide, please let me know. I really appreciate your time and support!&lt;/p&gt;&#xA;" OwnerUserId="7339" LastEditorUserId="57" LastEditDate="2017-10-03T18:34:46.200" LastActivityDate="2018-12-26T21:10:20.067" Title="Issue Importing Data to Matrix Fields With FeedMe Plugin" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22223" PostTypeId="1" AcceptedAnswerId="22241" CreationDate="2017-10-03T15:29:18.700" Score="4" ViewCount="588" Body="&lt;p&gt;Is there a way to do relatedTo categories where the category is (a or b) and (c or d or e)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get (a or b) working using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.commerce.products.relatedTo(categories).limit(20) as pageInfo, products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can separately get (a and b) working using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relationParam = ['and', { sourceElement: product }] %}&#xA;{% for category in categories %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: category }]) %}&#xA;{% endfor %}&#xA;{% paginate craft.commerce.products.relatedTo(relationParam).limit(20) as pageInfo, products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to combine these though as I am working with 3 category groups for filtering and want to match products where it is related to any of the selected categories in group 1, and any of the selected categories in group 2, and any of the selected categories in group 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of selections would be like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Group 1: Essentials, Pearlised&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Group 2: C6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Group 3: Reds, Greens&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the 'or' syntax gives me too many results where they no longer match on each group and using the 'and' syntax is too restrictive and wants the product to have all of the selected categories. Does anybody know how I can nest the relatedTo criteria in such a way to get what I need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attempted using the following but it didn't yield any results at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relationParam = ['and'] %}&#xA;{% if rangeCategories|length %}&#xA;    {% set rangeParam = ['or'] %}&#xA;    {% for category in rangeCategories %}&#xA;        {% set rangeParam = rangeParam|merge([{ targetElement: category }]) %}&#xA;    {% endfor %}&#xA;    {% set relationParam = relationParam|merge(rangeParam) %}&#xA;{% endif %}&#xA;{% if sizeCategories|length %}&#xA;    {% set sizeParam = ['or'] %}&#xA;    {% for category in sizeCategories %}&#xA;        {% set sizeParam = sizeParam|merge([{ targetElement: category }]) %}&#xA;    {% endfor %}&#xA;    {% set relationParam = relationParam|merge(sizeParam) %}&#xA;{% endif %}&#xA;{% if colourCategories|length %}&#xA;    {% set colourParam = ['or'] %}&#xA;    {% for category in colourCategories %}&#xA;        {% set colourParam = colourParam|merge([{ targetElement: category }]) %}&#xA;    {% endfor %}&#xA;    {% set relationParam = relationParam|merge(colourParam) %}&#xA;{% endif %}&#xA;{% paginate craft.commerce.products.relatedTo(relationParam).limit(20) as pageInfo, products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've not seen any examples of people using both 'and' 'or' syntax and there are no notes about this on the documentation so any help would be appreciated. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-10-06T09:34:55.157" Title="Multiple category relationship criteria (or)and(or)" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relatedto&gt;&lt;products&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22225" PostTypeId="2" ParentId="22220" CreationDate="2017-10-03T16:19:12.107" Score="2" Body="&lt;p&gt;You could take a look at the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; to help bridge the gap between your React front-end and your Craft back-end. That will at least help you with getting data out of Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as creating new pages and modules you'd use Craft's Control Panel (CP). You're going to have to take a look at the &lt;a href=&quot;https://craftcms.com/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Documentation&lt;/a&gt; in particular &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sections &amp;amp; Entries&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-10-03T16:19:12.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22226" PostTypeId="1" CreationDate="2017-10-03T16:25:40.050" Score="1" ViewCount="182" Body="&lt;p&gt;Users are always logged out on the front end on my Craft website.  Even when logged in as admin I can access the CMS but on the front end user session always returns the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\UserSessionService Object&#xA;(&#xA;    [_identity:Craft\UserSessionService:private] =&amp;gt; &#xA;    [_identityCookie:Craft\UserSessionService:private] =&amp;gt; &#xA;    [_userModel:Craft\UserSessionService:private] =&amp;gt; &#xA;    [_userRow:Craft\UserSessionService:private] =&amp;gt; &#xA;    [_sessionRestoredFromCookie:Craft\UserSessionService:private] =&amp;gt; &#xA;    [_dontExtendSession:Craft\UserSessionService:private] =&amp;gt; &#xA;    [allowAutoLogin] =&amp;gt; 1&#xA;    [guestName] =&amp;gt; Guest&#xA;    [loginUrl] =&amp;gt; Array&#xA;        (&#xA;            [0] =&amp;gt; /site/login&#xA;        )&#xA;&#xA;    [identityCookie] =&amp;gt; &#xA;    [authTimeout] =&amp;gt; 259200&#xA;    [absoluteAuthTimeout] =&amp;gt; &#xA;    [autoRenewCookie] =&amp;gt; 1&#xA;    [autoUpdateFlash] =&amp;gt; 1&#xA;    [loginRequiredAjaxResponse] =&amp;gt; &#xA;    [_keyPrefix:CWebUser:private] =&amp;gt; 4e3924125ff89a395a13e8e5580209e2&#xA;    [_access:CWebUser:private] =&amp;gt; Array&#xA;        (&#xA;        )&#xA;&#xA;    [behaviors] =&amp;gt; Array&#xA;        (&#xA;        )&#xA;&#xA;    [_initialized:CApplicationComponent:private] =&amp;gt; 1&#xA;    [_e:CComponent:private] =&amp;gt; &#xA;    [_m:CComponent:private] =&amp;gt; &#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea why this could be happening?&lt;/p&gt;&#xA;" OwnerUserId="7341" LastEditorUserId="57" LastEditDate="2017-10-03T18:35:54.577" LastActivityDate="2017-10-03T18:35:54.577" Title="Users are always logged out on front end" Tags="&lt;frontend&gt;&lt;login&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22227" PostTypeId="2" ParentId="22226" CreationDate="2017-10-03T17:45:32.030" Score="3" Body="&lt;p&gt;I tracked down a similar problem, and documented it here: &lt;a href=&quot;https://nystudio107.com/blog/the-case-of-the-missing-php-session&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Case of the Missing PHP Session&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if it'll address the issue you're having specifically, but it may give you some clue on where to look.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-03T17:45:32.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22228" PostTypeId="2" ParentId="6557" CreationDate="2017-10-03T17:52:19.933" Score="2" Body="&lt;p&gt;FWIW, I'd suggest a more holistic approach, such as the one described in my article &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'll make your long-term workflow much easier.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-03T17:52:19.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22231" PostTypeId="1" CreationDate="2017-10-03T22:49:17.040" Score="0" ViewCount="236" Body="&lt;p&gt;When either of two of our admin logins attempt to add a new admin user and select to send an activation email, we get this error message: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error  stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is Craft CMS attempting to connect with SSL3 which is intentionally disabled at the server level due to known vulnerabilities?&lt;/p&gt;&#xA;" OwnerUserId="7345" LastEditorUserId="57" LastEditDate="2017-10-03T22:54:05.350" LastActivityDate="2017-10-03T22:54:05.350" Title="Why is Craft CMS attempting to connect with SSL3" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22232" PostTypeId="2" ParentId="22231" CreationDate="2017-10-03T22:52:25.940" Score="2" Body="&lt;p&gt;The error is coming from when Craft tries to send out an activation email for the new user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft's email settings (Settings-&gt;Email), you're telling Craft to connect to your email provider over SSL (TLS), but it looks like your local OpenSSL certificate config is setup improperly on your box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More info here: &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I definitely wouldn't recommend their workaround of disabling SSL certificate verification as that opens up a slew of security issues, but would fix the local OpenSSL configuration.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-03T22:52:25.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22233" PostTypeId="2" ParentId="22221" CreationDate="2017-10-03T23:08:18.400" Score="1" Body="&lt;p&gt;My suspicion is that the &lt;code&gt;entry&lt;/code&gt; you are defining is confilicting with the &lt;code&gt;entry&lt;/code&gt; that Craft gives you as the entry that this template is displaying. Try this, and see if it helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blockLinkEntry = block.blockLink.first() %}&#xA;{% if blockLinkEntry %}&#xA;  &amp;lt;p class=&quot;ctaLink&quot;&amp;gt;&amp;lt;a href=&quot;{{ blockLinkEntry.url }}&quot;&amp;gt;Find out more&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-03T23:08:18.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22234" PostTypeId="2" ParentId="22223" CreationDate="2017-10-03T23:30:10.627" Score="3" Body="&lt;p&gt;I think what you want here is the union of (products related to a or b) and (products related to c, d, or e).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One good way to do these more complicated queries is to construct a set of the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#ids&quot; rel=&quot;nofollow noreferrer&quot;&gt;ids&lt;/a&gt;, and then do your final query based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we will get the ids of products related to a or b:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set aOrBProductIds = craft.commerce.products({&#xA;    relatedTo: aOrBCategories,&#xA;    limit: null&#xA;  }).ids()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the ids of products related to c, d, or e:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cOrDorEProductIds = craft.commerce.products({&#xA;    relatedTo: cOrDorECategories),&#xA;    limit: null&#xA;  }).ids()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; those arrays into one array with all of the ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productIds = aOrBProductIds | merge(cOrDorEProductIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, get the products, and paginate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productsToPaginate = craft.commerce.products.id(productIds) %}&#xA;{% paginate productsToPaginate.limit(20) as pageInfo, products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-03T23:30:10.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22235" PostTypeId="1" AcceptedAnswerId="22236" CreationDate="2017-10-04T02:27:32.843" Score="0" ViewCount="315" Body="&lt;p&gt;I'm having a bit of difficulty having 2 different matrix blocks show on one page, and they both have Entries fields. As soon as I put &lt;code&gt;{% set entry&lt;/code&gt; for my first Matrix, the second Matrix disappears.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.sideMenu %}&#xA; {% if block.type == &quot;sideMenuItem&quot; %}&#xA;    {% set entry = block.sideLink.first() %}&#xA;      {% if entry %}&#xA;         &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ block.sideTitle }}&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA; {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="130" LastEditDate="2017-10-04T23:52:30.233" LastActivityDate="2017-10-04T23:52:30.233" Title="Multiple Matrix blocks on one page" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22236" PostTypeId="2" ParentId="22235" CreationDate="2017-10-04T04:33:29.620" Score="1" Body="&lt;p&gt;If you look at how Craft handles &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;routing&lt;/a&gt; you will see this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the URI matches an entry’s or category’s URI, the section’s/category group’s template will get loaded, and the matched element will be made available to the template via a pre-populated &lt;code&gt;entry&lt;/code&gt; or &lt;code&gt;category&lt;/code&gt; variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So Craft is assigning that &lt;code&gt;entry&lt;/code&gt; variable that you are referencing on line 1 of your code. Then on line 3, you do &lt;code&gt;{% set entry = block.sideLink.first() %}&lt;/code&gt; which overwrites that initial &lt;code&gt;entry&lt;/code&gt; variable with this new value, which is why the second matrix disappears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you probably want to do is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.sideMenu %}&#xA;  {% if block.type == &quot;sideMenuItem&quot; %}&#xA;    {% set sideLinkEntry = block.sideLink.first() %}&#xA;    {% if sideLinkEntry %}&#xA;       &amp;lt;a href=&quot;{{ sideLinkEntry.url }}&quot;&amp;gt;{{ block.sideTitle }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your original &lt;code&gt;entry&lt;/code&gt; will be unmodified.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-04T04:33:29.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22238" PostTypeId="2" ParentId="18437" CreationDate="2017-10-04T07:22:47.830" Score="1" Body="&lt;p&gt;This is the solution I ended up with. Creating arrays of both:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The days in the week from and including today&lt;/li&gt;&#xA;&lt;li&gt;The days in the week previous to today&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And then looping through each in succession to produce the format I want. I also added some code to display &quot;today&quot; and &quot;tomorrow&quot; as the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no doubt there will be a more elegant solution but this did the job for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('menuSection').find() %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;        {% set day = now|date('l') %}&#xA;&#xA;        {% set daysFromToday = [] %}&#xA;        {% set previousDays = [] %}&#xA;&#xA;        {% for item in menuItem.weeklyMenuItems %}&#xA;            {% if item.dayOfTheWeek == day %}&#xA;                {% set daysFromToday = daysFromToday|merge([item.id]) %}&#xA;                {% set day = day|date_modify('+1 day') %}&#xA;                {% set day = day|date('l') %}&#xA;            {% else %}&#xA;                {% set previousDays = previousDays|merge([item.id])  %}&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        {% set daysFromTodayString = daysFromToday|join(', ') %}&#xA;        {% set previousDaysString = previousDays|join(', ')  %}&#xA;&#xA;        {% for item in menuItem.weeklyMenuItems.id(daysFromTodayString) %}&#xA;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;h3&amp;gt;{% if loop.index == 1 %}today{% elseif loop.index == 2 %}Tomorrow{% else %}{{ item.dayOfTheWeek }}{% endif %}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ item.itemTitle }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;        {% for item in menuItem.weeklyMenuItems.id(previousDaysString) %}&#xA;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;div&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;{{ item.dayOfTheWeek }}&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ item.itemTitle }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4823" LastActivityDate="2017-10-04T07:22:47.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22239" PostTypeId="1" CreationDate="2017-10-04T08:40:53.183" Score="1" ViewCount="218" Body="&lt;p&gt;I'm trying to rename a file before it is actually saved into Craft, by using the following code snippet in a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.onBeforeSaveAsset', function(Event $event) {&#xA;        if($event-&amp;gt;params['isNewAsset'])&#xA;        {&#xA;            $asset = $event-&amp;gt;params['asset'];&#xA;            $filename = 'SOME_RANDOM_STRING'.$asset-&amp;gt;getExtension();&#xA;&#xA;            $asset-&amp;gt;setAttribute('filename', $filename);&#xA;&#xA;            craft()-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found the snippet on some other question on this board, and while it seems to be correct, as soon as the above snippet is used files won't upload anymore. Within craft itself, the upload bar just stays there forever with nothing happening anymore, and when using a frontend ajax form to upload a file, the ajax request fails. However, there are no errors printed into the logfiles, so I really can't figure out what's causing the issue. As soon as I remove the above snippet again, uploads work fine again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;After editing the code to what Brad provided, it still won't work, but at least the logfiles now show some actual error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/10/09 06:11:24 [error] [php] fopen(https://s3-eu-west-1.amazonaws.com/***/challenges/NZpnyFj5.jpg): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden&#xA; (/home/praktikant/www/x-challenge.info/craft/plugins/businesslogic/BusinessLogicPlugin.php:172)&#xA;Stack trace:&#xA;#0 /home/praktikant/www/x-challenge.info/craft/plugins/businesslogic/BusinessLogicPlugin.php(88): Craft\BusinessLogicPlugin-&amp;gt;generateCopyright()&#xA;#1 unknown(0): Craft\BusinessLogicPlugin-&amp;gt;Craft\{closure}()&#xA;#2 /home/praktikant/www/x-challenge.info/craft/app/framework/base/CComponent.php(567): call_user_func()&#xA;#3 /home/praktikant/www/x-challenge.info/craft/app/services/AssetsService.php(1174): Craft\AssetsService-&amp;gt;raiseEvent()&#xA;#4 /home/praktikant/www/x-challenge.info/craft/app/services/AssetsService.php(224): Craft\AssetsService-&amp;gt;onSaveAsset()&#xA;#5 /home/praktikant/www/x-challenge.info/craft/app/assetsourcetypes/BaseAssetSourceType.php(275): Craft\AssetsService-&amp;gt;storeFile()&#xA;#6 /home/praktikant/www/x-challenge.info/craft/app/services/AssetsService.php(776): Craft\S3AssetSourceType-&amp;gt;insertFileByPath()&#xA;#7 /home/praktikant/www/x-challenge.info/craft/app/fieldtypes/AssetsFieldType.php(273): Craft\AssetsService-&amp;gt;insertFileByLocalPath()&#xA;#8 /home/praktikant/www/x-challenge.info/craft/app/models/BaseElementModel.php(912): Craft\AssetsFieldType-&amp;gt;prepValueFromPost()&#xA;#9 /home/praktikant/www/x-challenge.info/craft/app/controllers/EntriesController.php(931): Craft\EntryModel-&amp;gt;setContentFromPost()&#xA;#10 /home/praktikant/www/x-challenge.info/craft/app/controllers/EntriesController.php(446): Craft\EntriesController-&amp;gt;_populateEntryModel()&#xA;#11 /home/praktikant/www/x-challenge.info/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;#12 /home/praktikant/www/x-challenge.info/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#13 /home/praktikant/www/x-challenge.info/craft/app/framework/web/CController.php(286): Craft\EntriesController-&amp;gt;runAction()&#xA;#14 /home/praktikant/www/x-challenge.info/craft/app/framework/web/CController.php(265): Craft\EntriesController-&amp;gt;runActionWithFilters()&#xA;#15 /home/praktikant/www/x-challenge.info/craft/app/framework/web/CWebApplication.php(282): Craft\EntriesController-&amp;gt;run()&#xA;#16 /home/praktikant/www/x-challenge.info/craft/app/etc/web/WebApp.php(817): Craft\WebApp-&amp;gt;runController()&#xA;#17 /home/praktikant/www/x-challenge.info/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#18 /home/praktikant/www/x-challenge.info/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#19 /home/praktikant/www/x-challenge.info/craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#20 /home/praktikant/www/x-challenge.info/public/index.php(19): require_once()&#xA;REQUEST_URI=/hochladen&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error seems to be related to the &lt;code&gt;fopen()&lt;/code&gt; not being able to open the file saved to the S3 bucket. However, I don't really understand why because the files on the S3 bucket can be accessed just fine if they are uploaded without trying to rename them on &lt;code&gt;onBeforeSaveAsset&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="5798" LastEditDate="2017-10-09T08:32:38.283" LastActivityDate="2017-10-09T08:32:38.283" Title="renaming a file in onBeforeSaveAsset won't work" Tags="&lt;assets&gt;&lt;plugins&gt;&lt;php&gt;&lt;events&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22240" PostTypeId="2" ParentId="22221" CreationDate="2017-10-04T09:17:04.907" Score="0" Body="&lt;p&gt;After trial and error I came up with this alternative: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.blockLink|length %}&#xA;  &amp;lt;p class=&quot;ctaLink&quot;&amp;gt;&amp;lt;a href=&quot;{{ block.blockLink.first.url }}&quot;&amp;gt;Find out more&amp;lt;/a&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This worked for me, but I'm not sure if it's the 'correct' method or not.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="130" LastEditDate="2017-10-04T14:23:33.500" LastActivityDate="2017-10-04T14:23:33.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22241" PostTypeId="2" ParentId="22223" CreationDate="2017-10-04T11:04:41.437" Score="2" Body="&lt;p&gt;After Marion Newlevant suggested the merging of arrays of productIds instead of doing complex relatedTo parameters, I modified my code to read as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if rangeCategories|length or sizeCategories|length or colourCategories|length %}&#xA;    {% set productIds = [] %}&#xA;    {% set rangeProductIds = &quot;&quot; %}&#xA;    {% set sizeProductIds = &quot;&quot; %}&#xA;    {% set colourProductIds = &quot;&quot; %}&#xA;    {% if rangeCategories|length %}&#xA;        {% set rangeProductIds = craft.commerce.products.type('envelopes').relatedTo(rangeCategories).limit(null).ids() %}&#xA;        {% set productIds = productIds|merge(rangeProductIds) %}&#xA;    {% endif %}&#xA;    {% if sizeCategories|length %}&#xA;        {% set sizeProductIds = craft.commerce.products.type('envelopes').relatedTo(sizeCategories).limit(null).ids() %}&#xA;        {% set productIds = productIds|merge(sizeProductIds) %}&#xA;    {% endif %}&#xA;    {% if colourCategories|length %}&#xA;        {% set colourProductIds = craft.commerce.products.type('envelopes').relatedTo(colourCategories).limit(null).ids() %}&#xA;        {% set productIds = productIds|merge(colourProductIds) %}&#xA;    {% endif %}&#xA;    {% set finalIds = [] %}&#xA;    {% for productId in productIds %}&#xA;        {% set add = &quot;true&quot; %}&#xA;        {% if rangeProductIds|length %}&#xA;            {% if productId not in rangeProductIds %}&#xA;                {% set add = &quot;false&quot; %}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;        {% if sizeProductIds|length %}&#xA;            {% if productId not in sizeProductIds %}&#xA;                {% set add = &quot;false&quot; %}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;        {% if colourProductIds|length %}&#xA;            {% if productId not in colourProductIds %}&#xA;                {% set add = &quot;false&quot; %}&#xA;            {% endif %}&#xA;        {% endif %}&#xA;        {% if add == &quot;true&quot; %}&#xA;            {% set finalIds = finalIds|merge([productId]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    {% paginate craft.commerce.products.id(finalIds).limit(20) as pageInfo, envelopes %}&#xA;{% else %}&#xA;    {% paginate craft.commerce.products.type('envelopes').limit(20) as pageInfo, envelopes %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means that instead of merging and showing all products that belong to each one of the selected categories, we are now checking if the productId exists in all of the selected category group arrays. This has meant that the filtering now works for all combinations as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[C5] [Reds or Greens]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Pearlised] [Square or C6] [Golds]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Pearlised or Essentials] [C5] [Blues or Greens or Reds]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[C5]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you Marion for pointing me in the direction of array merging the ids with simple relatedTo parameters. If anyone else needs to do this kind of category querying then please feel free to use this code block.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastEditorUserId="5835" LastEditDate="2017-10-06T09:34:55.157" LastActivityDate="2017-10-06T09:34:55.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22242" PostTypeId="1" AcceptedAnswerId="26179" CreationDate="2017-10-04T11:48:14.317" Score="1" ViewCount="430" Body="&lt;p&gt;I got this code off of Craft Commerce, I had caught an error on the site previously so I'm thinking there might be an error here? I've put it in my file but when I input anything in the form I don't have any response of any kind. I don't get an error message or success message, it just redirects back to the cart and the pricing also remains exactly the same. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;store/cart&quot;&amp;gt;&#xA;     {{ getCsrfInput() }}&#xA;     &amp;lt;span class=&quot;{% if cart.getError('couponCode') %}has-error{% endif %}&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;text&quot; name=&quot;couponCode&quot; class=&quot;{% if cart.getError('couponCode') %}has-error{% endif %}&quot; value=&quot;{{ cart.couponCode }}&quot; placeholder=&quot;{{ &quot;Coupon Code&quot;|t }}&quot;&amp;gt;&#xA;     &amp;lt;/span&amp;gt;&#xA;     &amp;lt;input type=&quot;submit&quot; value=&quot;{% if cart.couponCode %}Change{% else %}Apply{% endif %} Coupon&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-05-16T11:21:11.860" Title="Using the coupon code from Craft Commerce site" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22243" PostTypeId="1" CreationDate="2017-10-04T12:48:09.423" Score="1" ViewCount="80" Body="&lt;p&gt;When using the digital products plugin, is there a way to apply a sale or discount to these products? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/15811/5564&quot;&gt;This answer&lt;/a&gt; mentions a digital product only has a &lt;code&gt;price&lt;/code&gt; property and not a &lt;code&gt;salePrice&lt;/code&gt; property. Does that mean that it is impossible for a digital product to have some sort of discounted price?&lt;/p&gt;&#xA;" OwnerUserId="5564" LastActivityDate="2017-10-04T12:48:09.423" Title="How do you apply a sale/discount to digital products?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22244" PostTypeId="1" AcceptedAnswerId="22793" CreationDate="2017-10-04T13:54:06.263" Score="1" ViewCount="213" Body="&lt;p&gt;I've taken the difference between the actual price and sale price of items and created a variable to hold the total value to give me a total discount at my checkout. I am curious if there is a way to do this with less code though? If I try to show &lt;code&gt;{{ cart.totalDiscount | currency(cart.currency) }}&lt;/code&gt; it just comes up as $0.00, and this is with promotions -&gt; sales at 10% off for all products. If there is a simple snippet like the one I referenced I'd love to know about it. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-11-12T23:58:04.870" Title="Show all discounts at checkout with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22245" PostTypeId="2" ParentId="22215" CreationDate="2017-10-04T13:59:06.930" Score="1" Body="&lt;p&gt;It was the single quotes around 'true' in the config file :)&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2017-10-04T13:59:06.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22246" PostTypeId="1" AcceptedAnswerId="22294" CreationDate="2017-10-04T14:49:29.247" Score="2" ViewCount="159" Body="&lt;p&gt;I've had this working before but with the billing address as well. Do both the billing and shipping addresses need to be filled out in the same form for this to work? I get this error when I click the submit and the page just refreshes instead of redirects. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CWebUser.flash.error' =&gt; 'Cart not completely updated.',&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is my code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; class=&quot;flex-container flex-center flex-col nav-buttons flex-lg&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;&quot; placeholder=&quot;email@site.com&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[firstName]&quot; value=&quot;&quot; placeholder=&quot;First Name&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[lastName]&quot; value=&quot;&quot; placeholder=&quot;Last Name&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[address1]&quot; value=&quot;&quot; placeholder=&quot;Street Address&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[address2]&quot; value=&quot;&quot; placeholder=&quot;Apartment/Suite/etc&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[city]&quot; value=&quot;&quot; placeholder=&quot;City&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[zipCode]&quot; value=&quot;&quot; placeholder=&quot;Zipcode&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[countryId]&quot; value=&quot;233&quot;&amp;gt;&#xA;    &amp;lt;select style=&quot;width:100%; padding:10px 0; margin:10px 0; text-align-last:center;&quot; name=&quot;shippingAddress[stateId]&quot;&amp;gt;&#xA;        &amp;lt;option&amp;gt;State&amp;lt;/option&amp;gt;&#xA;        {% for stateId, stateName in craft.commerce.statesArray[&quot;233&quot;] %}&#xA;            &amp;lt;option value=&quot;{{ stateId }}&quot;&amp;gt;{{ stateName }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;store/checkout/payment&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;To Payment&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-10-07T17:43:59.243" Title="Address form not redirecting to payment form in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22248" PostTypeId="1" AcceptedAnswerId="22259" CreationDate="2017-10-04T19:24:14.717" Score="1" ViewCount="319" Body="&lt;p&gt;I'm working on a online store website and we need a filter to hide some products based on the country. I created a lightswitch field called &quot;Hide in Europe&quot; (default false) and added it to the categories, and set it to true on some products to test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the block of code that creates the query params to filter the products.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- START QUERYPARAMS --&amp;gt;&#xA;        &amp;lt;!-- Initialize query paramaters array --&amp;gt;&#xA;        {% set queryParams = {} %}&#xA;&#xA;        &amp;lt;!-- Add sale parameter to query paramaters array if searching for sale items --&amp;gt;&#xA;        {% if craft.request.getSegment(2) == &quot;sale&quot; %}&#xA;          {% set queryParams = queryParams|merge({ hasSales: true }) %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- If on new arrivals page, add new arrivals to query parameters array --&amp;gt;&#xA;        {% if craft.request.getSegment(2) == &quot;new-arrivals&quot; %}&#xA;          {% set queryParams = queryParams|merge({ newArrival: true }) %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- If order parameter passed in, merge it to the query parameters array --&amp;gt;&#xA;        {% if craft.request.getParam('order') != &quot;&quot; and craft.request.getParam('order') != &quot;default-sorting&quot; %}&#xA;          {% set queryParams = queryParams|merge({ order: craft.request.getParam('order') }) %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- Initiating rate variable --&amp;gt;&#xA;        {% set rate = 0 %}&#xA;&#xA;        &amp;lt;!-- Setting rate according to current currency --&amp;gt;&#xA;        {% for currency in craft.commerce.paymentCurrencies %}&#xA;          {% if currency == cart.paymentCurrency %}&#xA;            {% set rate = currency.rate %}&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;!-- Set price variables to default values if none are passed in --&amp;gt;&#xA;        {% if (craft.request.getParam('lowPrice') != &quot;&quot; and craft.request.getParam('highPrice')) != &quot;&quot; %}&#xA;          {% set lowPrice = (craft.request.getParam('lowPrice')) / rate %}&#xA;          {% set highPrice = (craft.request.getParam('highPrice')) / rate %}&#xA;        {% else %}&#xA;          {% set lowPrice = 0 %}&#xA;          {% set highPrice = 1500 * rate %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- Add price paramaters to queryParams array --&amp;gt;&#xA;        {% set queryParams = queryParams|merge({&#xA;          defaultPrice: [&#xA;            'and',&#xA;          '&amp;gt;= ' ~ lowPrice,&#xA;          '&amp;lt;= ' ~ highPrice,&#xA;          ]&#xA;        })&#xA;        %}&#xA;&#xA;        {% set queryParams = queryParams|merge({ hideInEurope: false }) %}&#xA;        &amp;lt;!-- END QUERYPARAMS --&amp;gt;&#xA;&#xA;        &amp;lt;!-- Perform query and store results in results array --&amp;gt;&#xA;        {% paginate craft.commerce.products(queryParams).type(typesArray).search(queryString ~ (q is defined ? ' ~ ' ~ q : '')).limit(productLimit) as pageInfo, products %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, we have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = queryParams|merge({ hideInEurope: false }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But for some reason, the products that I set as TRUE are still showing on the list. On the other hand, if I set &lt;code&gt;hideInEurope: true&lt;/code&gt;, only the products that I set the field as true show, so it seems to be working. Looks like when I set the param to false, it gets &quot;ignored&quot;. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="7348" LastActivityDate="2017-10-05T13:59:58.663" Title="Filter products by custom boolean field" Tags="&lt;custom-field&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22249" PostTypeId="2" ParentId="21106" CreationDate="2017-10-05T02:41:43.967" Score="1" Body="&lt;p&gt;I suspect it might be your values. Try testing with this hard coded in and see if it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;endDate&quot; name=&quot;fields[endDate][date]&quot; value=&quot;12/30/2017&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;endTime&quot; name=&quot;fields[endDate][time]&quot; value=&quot;2:15 AM&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I always reference what's on this &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;StraightUpCraft&lt;/a&gt; guide, and I try to be as &lt;em&gt;exact&lt;/em&gt; as possible to the examples. You can also just inspect date fields inside a saved entry in the CMS to see what the values look like and mimic that on the front end.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-10-05T02:41:43.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22250" PostTypeId="1" AcceptedAnswerId="22261" CreationDate="2017-10-05T04:31:24.573" Score="1" ViewCount="380" Body="&lt;p&gt;How will data be handled in Craft 3, when it comes to the '&lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;multi-site&quot;&gt;multi-site&lt;/a&gt;' feature?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will most structured data will be accessible across sites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about &lt;strong&gt;user data&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have 'Site A' and 'Site B' running off the one install and someone creates an account on Site A, will they also have an account on Site B?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will we be able to restrict which CP users see data from which site?&lt;/p&gt;&#xA;" OwnerUserId="567" LastActivityDate="2017-10-05T22:02:10.413" Title="User data segregation for multi-sites in Craft 3?" Tags="&lt;control-panel&gt;&lt;user-profile&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22251" PostTypeId="2" ParentId="16609" CreationDate="2017-10-05T06:45:56.310" Score="1" Body="&lt;p&gt;You must call the inner blocks (level2, level3 and so on) like the first level&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.bodyMain is defined and entry.bodyMain | length %}&#xA;    {% nav block in entry.bodyMain.level(1) %}&#xA;        {% switch block.type.handle %}&#xA;&#xA;            {% case 'accordion' %}&#xA;                &amp;lt;ul class=&quot;accordion accordion-2&quot;&amp;gt;&#xA;&#xA;                    {% nav block in block.children %}&#xA;                        {% switch block.type.handle %}&#xA;&#xA;                            {% case 'timeBlock' %}&#xA;                                &amp;lt;li&amp;gt;&#xA;                                    &amp;lt;a class=&quot;opener&quot; href=&quot;#&quot;&amp;gt;{{ block.heading }}&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;div class=&quot;slide&quot;&amp;gt;&#xA;                                        {{ block.body }}&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                &amp;lt;/li&amp;gt;&#xA;&#xA;                        {% endswitch %}&#xA;                    {% endnav %}&#xA;&#xA;                &amp;lt;/ul&amp;gt;&#xA;&#xA;        {% endswitch %}&#xA;    {% endnav %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.bodyMain is defined and entry.bodyMain | length %}&#xA;    {% nav block in entry.bodyMain.level(1) %}&#xA;        {% switch block.type.handle %}&#xA;&#xA;            {% case 'accordion' %}&#xA;                &amp;lt;ul class=&quot;accordion accordion-2&quot;&amp;gt;&#xA;                    {% for block in block.children %}&#xA;                        {% include &quot;_includes/_blocks/&quot; ~ block.type %}&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;&#xA;        {% endswitch %}&#xA;    {% endnav %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For that you must build a file with this content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;    &amp;lt;a class=&quot;opener&quot; href=&quot;#&quot;&amp;gt;{{ block.heading }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;div class=&quot;slide&quot;&amp;gt;&#xA;        {{ block.body }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5577" LastActivityDate="2017-10-05T06:45:56.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22252" PostTypeId="1" CreationDate="2017-10-05T08:53:48.363" Score="1" ViewCount="90" Body="&lt;p&gt;I'm not able to login to my local craft cms in google chrome canary, version 63.0.3233.0. I've attached a screenshot of the error message I've received when trying to go to the standard login page. I can log in fine on normal Chrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Canary is beta software of newer version of chrome, however, if they release this into the wild later on, is it something to worry about? I'm running MAMP free. Is it something that can be fixed with MAMP pro or? Any suggestions most welcome. Thanks :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Id48u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Id48u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5711" LastActivityDate="2017-11-04T14:35:15.683" Title="Can't access Craft CMS admin in Chrome Canary 63.0.3233.0" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22255" PostTypeId="1" AcceptedAnswerId="22256" CreationDate="2017-10-05T11:59:56.657" Score="3" ViewCount="876" Body="&lt;p&gt;I'm trying to make a archive page for a blog sorted by months. I tried to consult the solution from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11508/linking-and-showing-archive-by-month&quot;&gt;Linking and showing archive by month&lt;/a&gt;, but I can't get it to work like it should. The code I have now just displays all entries regardless of their post date.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catch = year ~ '-' ~ month ~ '-01' %}&#xA;{% set firstDay = catch | date_modify('first day of ', month ~ year ~ ' 00:00:00') %}&#xA;{% set lastDay = catch | date_modify('last day of ', month ~ year ~ ' 23:59:59') %}&#xA;{% set archive  = craft.entries.section('blog').postDate('and', '&amp;gt;= ' ~ firstDay.date, '&amp;lt;= ' ~ lastDay.date) %}&#xA;{% for entry in archive %}&#xA;    &amp;lt;div class=&quot;posts-block&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had to add &quot;.date&quot; behind &quot;firstDay&quot; and &quot;lastDay&quot;, or I get an error (Object of class DateTime could not be converted to string) If I remove the &quot;and&quot; from &quot;archive&quot; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set archive  = craft.entries.section('blog').postDate('&amp;gt;= ' ~ firstDay.date, '&amp;lt;= ' ~ lastDay.date) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then it sorts my entries according to &quot;firstDay&quot;, but completely ignores &quot;lastDay&quot;. I tried to threw an and into the middle of the string, but that didn't to anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to use .after and .before, but then I just get what seems like a random set of entries...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set archive = craft.entries.section('blog').limit(null).after(firstDay).before(lastDay) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7315" LastActivityDate="2018-04-24T07:52:33.547" Title="Filter entries by month" Tags="&lt;entries&gt;&lt;postdate&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22256" PostTypeId="2" ParentId="22255" CreationDate="2017-10-05T13:26:08.027" Score="6" Body="&lt;p&gt;The value you need to set the &lt;code&gt;postDate&lt;/code&gt; parameter to is quite complex. If you define a dedicated variable for it, it makes the code more readable and you can more easily debug the value using the &lt;code&gt;dump()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the problem itself, you were on the right track. The main problem is a syntax mistake, you are passing in the &lt;code&gt;'and', '&amp;gt;= ', ...&lt;/code&gt; values without wrapping them as an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other changes I’d suggest is to use the &lt;code&gt;&amp;lt;&lt;/code&gt; operator in combination with a relative time of &lt;code&gt;'first day of next month'&lt;/code&gt;, so every entry before 00:00 of that day (see documentation of &lt;a href=&quot;http://php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;relative date/time formats&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And instead of the &lt;code&gt;.date&lt;/code&gt; property, I'd rather use the &lt;code&gt;date&lt;/code&gt; filter to output the DateTime object as a string in the right format. Which can be &lt;code&gt;'Y-m-d'&lt;/code&gt; to omit the time completely (Craft sets it back to 00:00), or one of the characters that output a full date with time &lt;code&gt;'c'&lt;/code&gt; or &lt;code&gt;'U'&lt;/code&gt; (see documentation of &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;date format parameter&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstDay = date(year ~ '-' ~ month ~ '-01') %}&#xA;{% set lastDay = firstDay|date_modify('first day of next month') %}&#xA;&#xA;{% set postDateParam = ['and', '&amp;gt;= ' ~ firstDay|date('c'), '&amp;lt; ' ~ lastDay|date('c')] %}&#xA;&#xA;&amp;lt;pre&amp;gt;{{ dump(postDateParam) }}&amp;lt;/pre&amp;gt;&#xA;&#xA;{% set archive = craft.entries({&#xA;    section: 'blog',&#xA;    postDate: postDateParam,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-04-24T07:52:33.547" LastActivityDate="2018-04-24T07:52:33.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22257" PostTypeId="1" CreationDate="2017-10-05T13:43:24.593" Score="1" ViewCount="262" Body="&lt;p&gt;This is related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19946/how-to-overrule-craft-error-messages-with-custom-seterror&quot;&gt;How to overrule Craft error messages with custom setError()?&lt;/a&gt; but I don't have enough rep to comment on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that needs to check if a user is ok to be deleted before doing so. Stopping the delete with &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt; works fine, but I am unable to overwrite the Craft message with my own to tell them why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code demonstrates the problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeDeleteUser', function(Event $event){&#xA;    craft()-&amp;gt;userSession-&amp;gt;setError(&quot;I don't want to delete &quot; . $event-&amp;gt;params['user']-&amp;gt;username);&#xA;    $event-&amp;gt;performAction = false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If deleting from the edit user page the &quot;Couldn't delete the user&quot; message is shown. I can change &lt;code&gt;setError()&lt;/code&gt; to &lt;code&gt;setNotice()&lt;/code&gt; and it will be displayed alongside the Craft error as a potential workaround, but I'm reporting an error so would like to display it as such. (There is the other workaround of setting the error on a field of the user entry, but in my case the error has nothing to do with a field on the page so this would be misleading.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If deleting from the users listing page &lt;code&gt;setError()&lt;/code&gt; shows nothing, just the Craft notice &quot;Deleted Users&quot; is shown. This also cannot be overridden with &lt;code&gt;setNotice()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of overriding the Craft error message or showing my own error message alongside it?&lt;/p&gt;&#xA;" OwnerUserId="173" LastEditorUserId="57" LastEditDate="2017-10-05T14:38:48.593" LastActivityDate="2018-05-03T21:31:13.013" Title="Unable to set error message in onBeforeDeleteUser" Tags="&lt;plugin-development&gt;&lt;error-message&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22258" PostTypeId="2" ParentId="22252" CreationDate="2017-10-05T13:59:38.760" Score="1" Body="&lt;p&gt;Context: &lt;a href=&quot;https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gist is that Chrome is forcing all .dev domains to use https (SSL) via HSTS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to continue to use a .dev domain, then you'll need to create a valid self-signed SSL cert and make sure OpenSSL is configured properly on your box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can swap to using something like craft.test because .test is reserved to never be used as an official top level domain. &lt;a href=&quot;https://en.wikipedia.org/wiki/.test&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/.test&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-05T13:59:38.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22259" PostTypeId="2" ParentId="22248" CreationDate="2017-10-05T13:59:58.663" Score="2" Body="&lt;p&gt;Found the answer. When creating the where clauses for the query, there's a line that checks &lt;code&gt;empty($str)&lt;/code&gt;, so passing a false boolean value, PHP interprets it as an empty string, so the where clause doesn't get created. So I fixed it by changing the query param to &lt;code&gt;hideInEurope: 'false'&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7348" LastActivityDate="2017-10-05T13:59:58.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22260" PostTypeId="1" AcceptedAnswerId="22263" CreationDate="2017-10-05T14:07:42.550" Score="2" ViewCount="527" Body="&lt;p&gt;Is there a way to make a Rich Text field using Redactor, to only display and allow input in the HTML view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step I tried was making a redactor config file that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;html&quot;],&#xA;    &quot;plugins&quot;: [],&#xA;    &quot;toolbarFixed&quot;: false&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the default view is still the WYSIWYG view. I want the HTML button to be toggled by default...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2017-10-05T14:21:36.373" Title="Force redactor to only display HTML editor view" Tags="&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22261" PostTypeId="2" ParentId="22250" CreationDate="2017-10-05T14:11:32.047" Score="1" Body="&lt;p&gt;Craft 3 multi-site is an extension of &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;locales&lt;/a&gt; in Craft 2, so how the data is stored is virtually identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is that locales in Craft 2 are tied to language/country codes, but sites in Craft 3 are more abstract concepts that are user defined.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I have 'Site A' and 'Site B' running off the one install and someone creates an account on Site A, will they also have an account on Site B?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;User accounts are global.  They are not created on a per-site basis, but they can be restricted on a per-site basis through user/user group permissions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Will we be able to restrict which CP users see data from which site?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;User/user group have site permissions for elements that support it just like they have &quot;locale&quot; permissions in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-10-05T22:02:10.413" LastActivityDate="2017-10-05T22:02:10.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22262" PostTypeId="1" AcceptedAnswerId="22296" CreationDate="2017-10-05T14:12:02.270" Score="1" ViewCount="613" Body="&lt;p&gt;I have two templates. For the purpose of this question lets say the first template is step 1, and the second is step 2.&#xA;There are links to launch these templates all over the site, but some times an entry is defined and sometimes its not. if the entry is defined, step 1 is skipped.&#xA;On both steps I have a 'close/cancel' button. I need these buttons to go to whatever url the user was on when they 'launched' this process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of storing a URL as a variable when the 'launch' button is clicked even after moving from step 1 to step 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see user journey diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sMZXH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sMZXH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-10-08T20:10:58.113" Title="provide a 'back' or 'cancel' or 'close' button to return to whatever page that particular template was accessed from" Tags="&lt;templating&gt;&lt;url&gt;&lt;redirect&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22263" PostTypeId="2" ParentId="22260" CreationDate="2017-10-05T14:21:36.373" Score="1" Body="&lt;p&gt;I don’t think it’s possible at all and what’s the benefit of using a WYSIWYG field at all when you don’t use any of the features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’d rather use a plain text field or even better, a field type which is optimized for code editing like the Simple Text field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/simple-text/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/simple-text/tree/v1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-10-05T14:21:36.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22264" PostTypeId="2" ParentId="22239" CreationDate="2017-10-05T14:24:51.487" Score="1" Body="&lt;p&gt;You're missing the closing &lt;code&gt;}&lt;/code&gt; for the if statement.  Add that in and it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('assets.onBeforeSaveAsset', function(Event $event) {&#xA;    if ($event-&amp;gt;params['isNewAsset'])&#xA;    {&#xA;        $asset = $event-&amp;gt;params['asset'];&#xA;        $filename = StringHelper::randomString(8).'.'.$asset-&amp;gt;getExtension();&#xA;&#xA;        $asset-&amp;gt;setAttribute('filename', $filename);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-10-06T16:59:59.877" LastActivityDate="2017-10-06T16:59:59.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22266" PostTypeId="1" CreationDate="2017-10-05T15:43:21.060" Score="1" ViewCount="100" Body="&lt;p&gt;I've seen some Craft CPs that display the sidebar menu horizontally in the top of the browser as a header.  Does anyone know how this is done? Is there a plugin? I think this would be useful for clients using a smaller monitor, particularly when using live preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastActivityDate="2017-10-05T17:27:17.017" Title="How to move sidebar menu to top in CP" Tags="&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22267" PostTypeId="1" AcceptedAnswerId="22268" CreationDate="2017-10-05T16:15:16.650" Score="1" ViewCount="197" Body="&lt;p&gt;I am attempting to create a form where the user can update their subscription card details (with Stripe Elements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From looking at the Charge plugin's source code, I believe the endpoint I need is &lt;code&gt;charge/updateSubscription&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with checkout I am creating an opts hidden input in my twig template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{&#xA;  craft.charge.setPaymentOptions({&#xA;    planAmount: currentSubscription.planAmount,&#xA;    planInterval: currentSubscription.planInterval,&#xA;    planIntervalCount: currentSubscription.planIntervalCount&#xA;  })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then making a POST request with Javascript to the endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getStripeToken(cardToken =&amp;gt; {&#xA;  post({&#xA;    params: {&#xA;      action: 'charge/updateSubscription',&#xA;      opts,&#xA;      cardToken,&#xA;      subscriptionId&#xA;    },&#xA;    then: response =&amp;gt; console.log(response)&#xA;    url: '/'&#xA;  })&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Quite simply, this doesn't work. I receive a &lt;code&gt;{success: true}&lt;/code&gt; response, but the Stripe card has not been updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody what I'm doing wrong, or even if this is possible?&lt;/p&gt;&#xA;" OwnerUserId="7111" LastActivityDate="2017-10-06T12:35:58.240" Title="Charge: Update subscription card details" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22268" PostTypeId="2" ParentId="22267" CreationDate="2017-10-05T17:04:32.313" Score="4" Body="&lt;p&gt;In the end I worked out the card is related to a customer, not a subscription.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't see any public endpoint to update a customer's card, so I added this method in &lt;code&gt;charge/controllers/ChargeController.php&lt;/code&gt; (not ideal to update the plugin directly I know):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpdateCard()&#xA;{&#xA;  $this-&amp;gt;requirePostRequest();&#xA;  $customer = craft()-&amp;gt;charge_customer-&amp;gt;find();&#xA;  $cardToken = craft()-&amp;gt;request-&amp;gt;getRequiredPost('cardToken');&#xA;&#xA;  if ($customer-&amp;gt;addCard($cardToken)) {&#xA;    $this-&amp;gt;returnJson(['success' =&amp;gt; true]);&#xA;  } else {&#xA;    $this-&amp;gt;returnJson(['success' =&amp;gt; false]);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then can make requests to the &lt;code&gt;charge/updateCard&lt;/code&gt; endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getStripeToken(cardToken =&amp;gt; {&#xA;  post({&#xA;    params: {&#xA;      action: 'charge/updateCard',&#xA;      cardToken&#xA;    },&#xA;    then: ({ success }) =&amp;gt; console.log(`Card updated: ${success}`)&#xA;    url: '/'&#xA;  })&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7111" LastEditorUserId="7111" LastEditDate="2017-10-06T12:35:58.240" LastActivityDate="2017-10-06T12:35:58.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22269" PostTypeId="2" ParentId="22266" CreationDate="2017-10-05T17:27:17.017" Score="2" Body="&lt;p&gt;Maybe you could pull it off with some &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSS&lt;/a&gt;/&lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;JS&lt;/a&gt; hackery, but it'd be pretty sketchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The navigation bar used to be at the top of the Control Panel up until Craft 2.5 came out.  The screenshots you're seeing are probably of the older versions of Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-05T17:27:17.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22270" PostTypeId="2" ParentId="22257" CreationDate="2017-10-05T17:44:46.403" Score="1" Body="&lt;p&gt;I can't think of a clean way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setError()&lt;/code&gt; is just a wrapper for &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash()&lt;/code&gt; that uses a key of &lt;code&gt;error&lt;/code&gt; and saves the message to user session and is good for one request.  Multiple calls to it just overwrite the same key causing the last one in to win.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could maybe use &lt;code&gt;setFlash()&lt;/code&gt; directly, passing in your own key, then add some &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;JS&lt;/a&gt; for displaying the additional flash message similar to how Craft does it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-05T17:44:46.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22272" PostTypeId="1" CreationDate="2017-10-06T07:22:11.833" Score="1" ViewCount="164" Body="&lt;p&gt;I am populating a select drop down with custom options in the template, but those options are not being displayed in the individual Form submission page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if field.handle == &quot;country&quot; %}            &#xA;&amp;lt;div class=&quot;fe {{ columnClass }}&quot;&amp;gt;&#xA;   &amp;lt;label class=&quot;select-label&quot;&amp;gt;&#xA;      &amp;lt;select name=&quot;{{ field.handle }}&quot; id=&quot;form-input-{{ field.handle }}&quot; required&amp;gt;&#xA;          &amp;lt;option value=&quot;&quot;&amp;gt;Country *&amp;lt;/option&amp;gt;&#xA;          &amp;lt;option value=&quot;AF&quot;&amp;gt;Afghanistan&amp;lt;/option&amp;gt;&#xA;          &amp;lt;option value=&quot;xx&quot;&amp;gt;another country...&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Country field handle is &lt;code&gt;country&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outputted html is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;fe freeform-column  freeform-column-6&quot;&amp;gt;&#xA;    &amp;lt;label class=&quot;select-label&quot;&amp;gt;&#xA;        &amp;lt;select name=&quot;country&quot; id=&quot;form-input-country&quot; required&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;Country *&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;AF&quot;&amp;gt;Afghanistan&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;xx&quot;&amp;gt;Another country...&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I view the individual submission in admin I see the below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Q11Ya.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q11Ya.png&quot; alt=&quot;Form submission page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the submission list page the value does appear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a8ZF5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a8ZF5.png&quot; alt=&quot;Submissions List&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2017-10-06T15:43:26.650" Title="Solspace select options not being stored" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22274" PostTypeId="1" AcceptedAnswerId="22285" CreationDate="2017-10-06T08:10:24.170" Score="1" ViewCount="136" Body="&lt;p&gt;I've developed my Craft website locally ( in fact on a virtual machine on the company intranet, so it's accessible within the company ).&#xA;Now it's time to fill the site with contents and translate them for 7 different locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My boss is asking me to provide a CSV or similar structured file to let other employees and a translation agency fill the content without accessing the CMS directly.&#xA;Is this possible? Is it a good approach?&#xA;Keep in mind that the entries have some Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is it better to insert the content in the staging environment or in  developement? Or it doesn't matter?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="57" LastEditDate="2017-10-06T17:03:54.013" LastActivityDate="2017-10-06T18:58:40.547" Title="Content creation and translation workflow" Tags="&lt;localization&gt;&lt;content&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22276" PostTypeId="1" AcceptedAnswerId="22277" CreationDate="2017-10-06T09:30:28.127" Score="1" ViewCount="35" Body="&lt;p&gt;I want to reroute old html pages.&#xA;The format is:  /title-35-of-page.863.en.html&#xA;I want to route every adresse with .html at the end also get the lang and id part of the address for further handling, but have problems with the dots.&#xA;This are some versions that i tried, but none of them worked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'(?P&amp;lt;title&amp;gt;[-\w\d]+).html' =&amp;gt; array('action' =&amp;gt; 'jpk/rerouteOldPages')&#xA;'(?P&amp;lt;title&amp;gt;[-\w\d]+)html' =&amp;gt; array('action' =&amp;gt; 'jpk/rerouteOldPages')&#xA;'(?P&amp;lt;title&amp;gt;[-\w\d]+)\.(?P&amp;lt;papayaId&amp;gt;\d+)\.(?P&amp;lt;language&amp;gt;\[a-z]{2})\.html' =&amp;gt; array('action' =&amp;gt; 'jpk/rerouteOldPages')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2017-10-06T10:31:59.963" Title="how to reroute old html pages?" Tags="&lt;plugin-development&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22277" PostTypeId="2" ParentId="22276" CreationDate="2017-10-06T10:31:59.963" Score="1" Body="&lt;p&gt;Ok, this works, the backslash behind &quot;...language&gt;&quot; was wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'(?P&amp;lt;title&amp;gt;[-\w\d]+)\.(?P&amp;lt;papayaId&amp;gt;\d+)\.(?P&amp;lt;language&amp;gt;[\w]{2})\.html' =&amp;gt; array('action' =&amp;gt; 'jpk/rerouteOldPages'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2017-10-06T10:31:59.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22278" PostTypeId="1" AcceptedAnswerId="22284" CreationDate="2017-10-06T12:22:20.210" Score="1" ViewCount="133" Body="&lt;p&gt;I'm using this Import plugin &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/import&lt;/a&gt;.&#xA; It has a hook called &lt;code&gt;modifyImportRow&lt;/code&gt;, which would let me process single .csv rows with my custom logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I have to process a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where and how to call hooks in general. In the plugin? In another plugin like &lt;code&gt;businessLogic&lt;/code&gt;? Is there a specific file?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="6817" LastEditDate="2017-10-09T07:00:49.650" LastActivityDate="2017-10-09T07:00:49.650" Title="Where to call hook modifyImportRow?" Tags="&lt;hook&gt;&lt;plugin-import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22279" PostTypeId="2" ParentId="15394" CreationDate="2017-10-06T12:36:12.493" Score="2" Body="&lt;p&gt;I'm assuming that you're attempting to create the Matrix, with one or more blocks each containing one or more fields, from scratch? I.e. you're not simply trying to populate content into an already defined Matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going off of that assumption:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Sorry, this code is not based on your code - I simply took working code from one of my other projects.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create a field-group to store our Matrix in&#xA;$fieldGroup       = new FieldGroupModel();&#xA;$fieldGroup-&amp;gt;name = 'My Field Group';&#xA;craft()-&amp;gt;fields-&amp;gt;saveGroup($fieldGroup);&#xA;&#xA;// Create the matrix-field itself&#xA;$field          = new FieldModel();&#xA;$field-&amp;gt;groupId = $fieldGroup-&amp;gt;getAttribute('id');&#xA;$field-&amp;gt;name    = 'My Matrix';&#xA;$field-&amp;gt;handle  = 'myMatrix';&#xA;$field-&amp;gt;type    = 'Matrix';&#xA;&#xA;// Create a rich-text field which we will need later&#xA;$textField = ['name' =&amp;gt; 'Text Field',&#xA;              'handle'       =&amp;gt; 'label',&#xA;              'required'     =&amp;gt; TRUE,&#xA;              'instructions' =&amp;gt; '',&#xA;              'type'         =&amp;gt; 'RichText',&#xA;              'typesettings' =&amp;gt; ['configFile'            =&amp;gt; 'Standard.json',&#xA;                                 'cleanupHtml'           =&amp;gt; 1,&#xA;                                 'purifyHtml'            =&amp;gt; 1,&#xA;                                 'columnType'            =&amp;gt; 'text',          &#xA;                                 'availableAssetSources' =&amp;gt; '',&#xA;                                 'availableTransforms'   =&amp;gt; '']];&#xA;&#xA;// Define block-types for our Matrix-field&#xA;$blockTypes = ['new1' =&amp;gt; ['name'   =&amp;gt; 'My text field',&#xA;                          'handle' =&amp;gt; 'myTextField',&#xA;                          'fields' =&amp;gt; ['new1' =&amp;gt; $textField]];&#xA;&#xA;// Assign block-types to the Matrix-field&#xA;$field-&amp;gt;settings = ['blockTypes' =&amp;gt; $blockTypes];&#xA;&#xA;// Finish the creation of the Matrix-field by saving it&#xA;craft()-&amp;gt;fields-&amp;gt;saveField($field)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've had to adjust the code slightly to not give you the full 125 lines of code I use (mostly due to having a LOT of different block-types with a lot of different fields) - but hopefully you can get the gist of how it's working and solve your issue based on this :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PPS: It seems like your code should work fine if you only tweak the order in which you do things slightly.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create Field Group&lt;/li&gt;&#xA;&lt;li&gt;Create Matrix Field&lt;/li&gt;&#xA;&lt;li&gt;Define Block Fields&lt;/li&gt;&#xA;&lt;li&gt;Create Block Types using defined Block Fields&lt;/li&gt;&#xA;&lt;li&gt;Assign Block Types to Matrix Field&lt;/li&gt;&#xA;&lt;li&gt;Save Matrix Field&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-06T12:36:12.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22280" PostTypeId="2" ParentId="20472" CreationDate="2017-10-06T13:27:51.200" Score="2" Body="&lt;p&gt;Filtering entries by year with pagination example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery() %}&#xA;{% set selectedYear = query.year is defined ? query.year|abs : FALSE %}&#xA;&#xA;{% paginate craft.entries({&#xA;   section: 'news',&#xA;   postDate: '&amp;gt;=' ~ selectedYear,&#xA;   postDate: '&amp;lt;' ~ (selectedYear + 1)&#xA;}).limit(12) as pageInfo, newsEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5817" LastEditorUserId="5817" LastEditDate="2017-10-07T08:03:37.027" LastActivityDate="2017-10-07T08:03:37.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22281" PostTypeId="1" AcceptedAnswerId="22293" CreationDate="2017-10-06T15:27:57.143" Score="2" ViewCount="515" Body="&lt;p&gt;What are all the available options that products can be ordered by?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.commerce.products({ order: '???' })&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found this reference &lt;a href=&quot;https://craftcommerce.com/docs/products-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/products-fields#templating&lt;/a&gt; but it does not list the available options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus points if it includes the key that sorts by sales (aka popularity).&lt;/p&gt;&#xA;" OwnerUserId="7111" LastEditorUserId="7111" LastEditDate="2017-10-06T20:04:38.917" LastActivityDate="2017-10-07T17:04:22.767" Title="Commerce product order/sort options" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22282" PostTypeId="2" ParentId="22272" CreationDate="2017-10-06T15:43:26.650" Score="1" Body="&lt;p&gt;Unfortunately this is currently a limitation of Freeform. It expects that the option values are predefined for the field, and not dynamically loaded at template level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our feature requests list to come up with a way to let users override this functionality. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-10-06T15:43:26.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22283" PostTypeId="1" AcceptedAnswerId="22423" CreationDate="2017-10-06T15:47:14.307" Score="1" ViewCount="421" Body="&lt;p&gt;I set up a custom form template using Sprout Forms and added &lt;code&gt;{{ craft.sproutInvisibleCaptcha.protect() }}&lt;/code&gt; inside the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see there are several captcha tags added by the plugin, but as I am using AJAX submission:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How can I make it works using this submission method?&lt;/li&gt;&#xA;&lt;li&gt;How do I handle redirect to my 'redirect' location?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I did these tests:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prevent a form from being submmitted if a user does not have JavaScript enabled ;&lt;/li&gt;&#xA;&lt;li&gt;Block form submissions by robots who auto-fill all of your form fields ;&lt;/li&gt;&#xA;&lt;li&gt;Require minimum time to fill out your form ;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All of these tests have failed, spam haven't been caught.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is the captcha field inside custom Sprout Form template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.sproutInvisibleCaptcha.protect() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirectOnFailure&quot; value=&quot;{{ craft.request.getUrl() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the AJAX post inside JS script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var postUrl  = 'sproutForms/entries/saveEntry',&#xA;    formData = {&#xA;    action: postUrl,&#xA;    handle: 'test',&#xA;    fields: {}&#xA;};&#xA;&#xA;formData['fields[minPrice]'] = $scope.results.minPrice;&#xA;formData['fields[maxPrice]'] = $scope.results.maxPrice;&#xA;&#xA;formData = $.param(formData);&#xA;&#xA;$.ajax({&#xA;    type     : 'POST',&#xA;    url      : postUrl,&#xA;    data     : formData,&#xA;    dataType : 'json',&#xA;    encode   : true&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2017-10-17T09:51:35.013" LastActivityDate="2017-10-17T13:07:28.227" Title="How can I make Sprout Invisible Captcha plugin works using AJAX submission?" Tags="&lt;plugin-sproutforms&gt;&lt;security&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22284" PostTypeId="2" ParentId="22278" CreationDate="2017-10-06T16:31:15.693" Score="2" Body="&lt;p&gt;You'd do it from another plugin, just as if you were latching onto any of Craft's native hooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-and-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/hooks-and-events&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the &lt;code&gt;businessLogic&lt;/code&gt; plugin as a starting point or use &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; to generate boilerplate plugin code.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-06T16:31:15.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22285" PostTypeId="2" ParentId="22274" CreationDate="2017-10-06T17:03:43.387" Score="1" Body="&lt;p&gt;Never used it, but probably worth looking at this plugin: &lt;a href=&quot;https://github.com/boboldehampsink/translate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/translate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some related feature requests about adding this to Craft core you might want to chime in on as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/970&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/970&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1173&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1173&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-06T17:03:43.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22286" PostTypeId="1" AcceptedAnswerId="22289" CreationDate="2017-10-06T17:59:24.860" Score="1" ViewCount="315" Body="&lt;p&gt;I'm trying to do an &lt;code&gt;andWhere()&lt;/code&gt; &quot;OR&quot; group for a special criteria value so basically when building an element criteria I want to just set `$criteria-&gt;upcomingOnly to true, and then have the following code run. The problem is that the greater than or equal to is being added to the value and its doing an equals comparison on it which obviously is going to return nothing. Anyone have any idea what I need to change to get desired result?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($criteria-&amp;gt;upcomingOnly) {&#xA;    $today = new DateTime('now');&#xA;    $query-&amp;gt;andWhere(['or',&#xA;        ['events.eventStart' =&amp;gt; '&amp;gt;= ' . $today-&amp;gt;format('Y-m-d')],&#xA;        ['events.eventEnd' =&amp;gt; '&amp;gt;= ' . $today-&amp;gt;format('Y-m-d')]&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically the resulting query is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WHERE ((elements_i18n.locale = :locale) AND (elements.archived = 0)) AND ((`events`.`eventStart`=:pzek8XoNML) OR (`events`.`eventEnd`=:pZQmaPhwE8))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `eventStart` ASC LIMIT 50. Bound with :locale='en_us', :pzek8XoNML='&amp;gt;= 2017-10-06', :pZQmaPhwE8='&amp;gt;= 2017-10-06'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I would like to get something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WHERE ((elements_i18n.locale = :locale) AND (elements.archived = 0)) AND ((`events`.`eventStart`&amp;gt;=:pzek8XoNML) OR (`events`.`eventEnd`&amp;gt;=:pZQmaPhwE8))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `eventStart` ASC LIMIT 50. Bound with :locale='en_us', :pzek8XoNML='2017-10-06', :pZQmaPhwE8='2017-10-06'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="57" LastEditDate="2017-10-06T21:57:28.883" LastActivityDate="2017-10-09T17:20:20.607" Title="ElementCriteriaModel andWhere() with different comparison operators?" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;elementcriteriamodel&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22287" PostTypeId="2" ParentId="22274" CreationDate="2017-10-06T18:58:40.547" Score="1" Body="&lt;p&gt;There is also this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.acclaro.com/our-technology-platform/craft-cms-translation-connector/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS Translation Connector&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-06T18:58:40.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22288" PostTypeId="1" AcceptedAnswerId="22290" CreationDate="2017-10-06T20:56:45.103" Score="1" ViewCount="164" Body="&lt;p&gt;I'm trying to set up an archive page by passing dates in the URL to the entries search parameter to show events from a specific month.  The &lt;code&gt;eventstart&lt;/code&gt; is a custom date field.  If I enter numbers i.e. 2017-11 in the search parameter it works but the URL segments don't seem to parse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set year = craft.request.segment(3) %}&#xA;{% set month = craft.request.segment(4) %}&#xA;&#xA;{% set entries = craft.entries.section('calendar').search('eventstart:&quot;year-month)&quot;') %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="57" LastEditDate="2017-10-06T22:16:45.130" LastActivityDate="2017-10-06T22:20:01.473" Title="How do I pass a URL segment to a search parameter?" Tags="&lt;search&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22289" PostTypeId="2" ParentId="22286" CreationDate="2017-10-06T22:15:25.467" Score="1" Body="&lt;p&gt;You shouldn't need to use nested array syntax, just normal strings should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;100% untested, but something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($criteria-&amp;gt;upcomingOnly) {&#xA;    $query-&amp;gt;andWhere(['or',&#xA;            'events.eventStart &amp;gt;= :date',&#xA;            'events.eventEnd =&amp;gt; :date',&#xA;        ],&#xA;        [':date' =&amp;gt; new DateTime('now')-&amp;gt;format('Y-m-d')]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I fixed the missing quote, so no, there is nothing else I would like to add to this post...)&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="6309" LastEditDate="2017-10-09T17:20:20.607" LastActivityDate="2017-10-09T17:20:20.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22290" PostTypeId="2" ParentId="22288" CreationDate="2017-10-06T22:20:01.473" Score="2" Body="&lt;p&gt;You'd need to use Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;string concatenation&lt;/a&gt; in order to do this with the &lt;code&gt;~&lt;/code&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('calendar').search('eventstart:' ~ year ~ '-' ~ month) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-06T22:20:01.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22291" PostTypeId="1" CreationDate="2017-10-07T12:09:16.263" Score="1" ViewCount="91" Body="&lt;p&gt;Occasionally—I'd say about 30-40% of the time—when submitting a form in the backend, be it saving an entry, updating a custom field, etc, the page will just sit there, loading. This can and often does continue for ~ 299.88 seconds, after which it will proceed to the next screen as if nothing ever happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked through the console log, but all the timestamps seem to be within a second of each other, so nothing jumps out as the step where things are getting hung up. I suspect a server problem, but I'm posting here just in case anyone can point me in a more specific direction than &quot;there's a problem somewhere&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To date, this has not occurred on the frontend, but there aren't any frontend forms to submit, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pastebin of the console log (the load time is on line 725): &lt;a href=&quot;https://pastebin.com/aB4JkrBv&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.com/aB4JkrBv&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2017-10-10T18:03:35.223" Title="CP form submissions occasionally reaching PHP's 300 second timeout" Tags="&lt;control-panel&gt;&lt;timeout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22292" PostTypeId="2" ParentId="22291" CreationDate="2017-10-07T16:14:35.680" Score="3" Body="&lt;p&gt;I can think of a couple things why this is happening:&lt;/p&gt;&#xA;&lt;h1&gt;1) Custom code doing a save operation.&lt;/h1&gt;&#xA;&lt;p&gt;If you're hooking into &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onSaveEntry&lt;/code&gt;&lt;/a&gt; for example,  Craft also lets other plugins have a chance at calling their own save code as well.&lt;/p&gt;&#xA;&lt;p&gt;So when you do a &lt;code&gt;saveEntry&lt;/code&gt; (or other element), Craft is going to &lt;em&gt;repeat&lt;/em&gt; that call when you do it from your own code, basically putting you into an infinite loop because it keeps getting called until the server times out.&lt;/p&gt;&#xA;&lt;p&gt;The fix is to make sure  you only call &lt;code&gt;saveEntry&lt;/code&gt; once. There's a couple ways to do this depending on what you're trying to do.&lt;/p&gt;&#xA;&lt;p&gt;One way to debug this would be to a create super simple plugin, using &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Business Logic&lt;/a&gt; or &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;PluginFactory&lt;/a&gt; that listens for the &lt;code&gt;saveEntry&lt;/code&gt; event and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2905/how-to-log-info-from-an-onsaveentry-event&quot;&gt;logs it&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you see the plugin's log fill up, then some plugin is putting itself into a loop more than once.&lt;/p&gt;&#xA;&lt;h1&gt;2) runTasksAutomatically is not being called&lt;/h1&gt;&#xA;&lt;p&gt;Over time, Craft generates a lot of cache files, sessions, etc. Craft will automatically do some housekeeping for you and clean this up, however, the &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;runTasksAutomatically&lt;/code&gt;&lt;/a&gt; config doesn't run on some server setups, forcing you to do the maintenance yourself. It's like a stuffed up drain, if it doesn't run for awhile, it takes longer to purge.&lt;/p&gt;&#xA;&lt;p&gt;If your server doesn't support cron, you could use an uptime monitoring service like &lt;a href=&quot;https://uptimerobot.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Uptime Robot&lt;/a&gt; or Pingdom to trigger the task call for you periodically.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-10T18:03:35.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22293" PostTypeId="2" ParentId="22281" CreationDate="2017-10-07T17:04:22.767" Score="2" Body="&lt;p&gt;When you call &lt;code&gt;craft.commerce.products&lt;/code&gt; you're asking Craft for an &lt;a href=&quot;https://craftcommerce.com/docs/product-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce_ProductModel&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could sort by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title (alpha)&lt;/li&gt;&#xA;&lt;li&gt;defaultPrice&lt;/li&gt;&#xA;&lt;li&gt;type&lt;/li&gt;&#xA;&lt;li&gt;promotable (sale products on top)&lt;/li&gt;&#xA;&lt;li&gt;postDate (newest products)&lt;/li&gt;&#xA;&lt;li&gt;.. etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To sort by sales (popularity), you might consider something like BonFire's &lt;a href=&quot;http://www.hellobonfire.com/product/popular-products-plugin-for-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Popular Products&lt;/a&gt; plugin which keeps track of how many purchases were made and how many times the product was viewed, very similar to Ben Croker's &lt;a href=&quot;https://www.putyourlightson.net/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryCount&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-10-07T17:04:22.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22294" PostTypeId="2" ParentId="22246" CreationDate="2017-10-07T17:43:59.243" Score="2" Body="&lt;p&gt;I extended my code to include the billing address and it worked. So I guess the answer to my question is yes, shipping and billing address need to be submitted together.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-10-07T17:43:59.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22295" PostTypeId="2" ParentId="22262" CreationDate="2017-10-07T18:09:19.707" Score="3" Body="&lt;p&gt;If you need to set a correct link on the cancel buttons than using browser history is the easiest way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;  // Going to STEP2&#xA;  &amp;lt;button onclick=&quot;window.history.go(-1); return false;&quot;&amp;gt;Cancel&amp;lt;/button&amp;gt;&#xA;{% else %}&#xA;  // Going to STEP1&#xA;  &amp;lt;button onclick=&quot;window.history.go(-1); return false;&quot;&amp;gt;Cancel&amp;lt;/button&amp;gt;&#xA;  // Going from STEP1 next to STEP2&#xA;  &amp;lt;button onclick=&quot;window.history.go(-2); return false;&quot;&amp;gt;Cancel&amp;lt;/button&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're welcome to play with calling JavaScript method for the cancel buttons.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2017-10-07T18:09:19.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22296" PostTypeId="2" ParentId="22262" CreationDate="2017-10-07T23:21:02.963" Score="4" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies&lt;/a&gt; plugin to store the last visited URL before the user hits one of the &quot;step&quot; templates, i.e. by putting something like the following in every template where the links to the &quot;steps&quot; template occurs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ setCookie( 'lastUrlBeforeStepStuff', craft.request.url) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, inside your &quot;step&quot; templates, you could render the &quot;cancel&quot; links like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ getCookie( 'lastUrlBeforeStepStuff' )|default('/some/path/to/fall/back/to') }}&quot;&amp;gt;Cancel&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-10-08T20:10:58.113" LastActivityDate="2017-10-08T20:10:58.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22297" PostTypeId="1" AcceptedAnswerId="22298" CreationDate="2017-10-08T21:38:42.393" Score="2" ViewCount="566" Body="&lt;p&gt;I have a structured channel setup to house all the static pages on the site. All of the pages display fine on the page entry template. But the &lt;code&gt;/login&lt;/code&gt; page does not. It displays fine in Live Preview. But on the actual site it immediately redirects to the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;/login&lt;/code&gt; a protected keyword or something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My .htaccess file is quite normal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;RewriteRule ^(.*)/$ /$1 [L,R=301]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have the Sprout SEO plugin handling some basic redirects. I'm at a loss to know where to even look next.  Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't a login form to get into Craft by the way. It's to login to a separate website entirely.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="333" LastEditDate="2017-10-09T18:17:41.120" LastActivityDate="2017-10-09T18:17:41.120" Title="/login page in Craft keeps redirecting to home page. What could be causing that?" Tags="&lt;redirect&gt;&lt;login&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22298" PostTypeId="2" ParentId="22297" CreationDate="2017-10-08T23:00:59.247" Score="3" Body="&lt;p&gt;/login is the default login page for Craft (see &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/config-settings&lt;/a&gt; and scroll down to the users section ). You can override it by adding something like this to your config file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'loginPath' =&gt; 'members/login',&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2017-10-08T23:00:59.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22299" PostTypeId="1" AcceptedAnswerId="22301" CreationDate="2017-10-09T08:49:34.653" Score="1" ViewCount="79" Body="&lt;p&gt;If I want to link another website, I am doing this with a normal text field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.subHeading }}&quot; target=&quot;_blank&quot;&amp;gt;{{ entry.subHeading }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;subHeading&lt;/strong&gt; is the link.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I now click on the text on my website, I get something like this: &lt;code&gt;www.example.com/https://www.google.ch&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get my own website text out of the link?&lt;/p&gt;&#xA;" OwnerUserId="7364" LastEditorUserId="57" LastEditDate="2017-10-09T17:19:45.860" LastActivityDate="2017-10-09T17:19:45.860" Title="links to another website without my own url" Tags="&lt;field&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22300" PostTypeId="1" CreationDate="2017-10-09T10:19:48.867" Score="2" ViewCount="539" Body="&lt;p&gt;I'm dealing with the import plugin, processing a .csv file. &#xA;in the .csv there's a column with &lt;code&gt;|&lt;/code&gt; separated values that shoud be inserted in a table field.&#xA;The entry are created correctly, also the table field ( just 1 column ) has the correct number of rows, but the content is empty ( &lt;code&gt;$featureContent&lt;/code&gt; length is &gt; 0 ).&#xA;Here's the code, what am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($fields as $handle =&amp;gt; $value) {&#xA;&#xA;   $value = explode('|', $value);&#xA;   $content[$handle] = array();&#xA;&#xA;   foreach ( $value as $featureContent ) {                       &#xA;      $featuresRow = array( 'singleFeature' =&amp;gt; $featureContent );&#xA;      array_push( $content[$handle], $featuresRow);                             &#xA;   }&#xA;&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;--- Edit --- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://craftcms.stackexchange.com/a/1333/6817&quot;&gt;this response&lt;/a&gt; the table data is stored in Json format, so now I'm trying to create the table providing a json formatted string.&#xA;As this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&quot;col1&quot;:&quot;very beautiful&quot;},&#xA;  {&quot;col1&quot;:&quot;really beautiful&quot;},&#xA;  {&quot;col1&quot;:&quot;astonishing beautiful&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, this doesn't work for me. It doesn't even creates the 3 rows as the other approach. &lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="6817" LastEditDate="2017-10-10T07:22:34.890" LastActivityDate="2018-10-03T06:48:12.093" Title="Saving to table field via plugin" Tags="&lt;import&gt;&lt;table-field&gt;&lt;csv&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22301" PostTypeId="2" ParentId="22299" CreationDate="2017-10-09T11:58:54.417" Score="2" Body="&lt;p&gt;I assume that &lt;code&gt;subHeading&lt;/code&gt; is a &lt;code&gt;plain text&lt;/code&gt; field. &#xA;Just a guess, are you inserting a string that can be interpreted as a relative path on your website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex. &lt;code&gt;google.com&lt;/code&gt; vs &lt;code&gt;https://www.google.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first will lead to yoursite.com/google.com, the latter should work fine.&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-10-09T11:58:54.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22302" PostTypeId="1" CreationDate="2017-10-09T14:25:13.777" Score="1" ViewCount="360" Body="&lt;p&gt;I'm using the Element API to grab entries and their data (via &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13118/how-do-you-use-the-element-api-plugin-to-output-matrix-blocks-for-an-entry&quot;&gt;this&lt;/a&gt; answer). What I want to do is accept a URL parameter (eg. &lt;code&gt;?location=foo&lt;/code&gt;) and filter the returned entries by a Matrix field called &lt;code&gt;fundingProgramme&lt;/code&gt;, where its sub-field &lt;code&gt;area&lt;/code&gt; (a dropdown) has a value matching the URL query parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't work out how to do this using the Element API. Here's what I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'content/&amp;lt;locale:en|cy&amp;gt;/programs.json' =&amp;gt; function($locale) {&#xA;&#xA;    $siteId = ($locale === 'en' || !$locale) ? 1 : 2;&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'fundingProgrammes',&#xA;            'siteId' =&amp;gt; $siteId&#xA;        ],&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;            $request = Craft::$app-&amp;gt;getRequest();&#xA;            $location = $request-&amp;gt;getParam('location');&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'test' =&amp;gt; $entry-&amp;gt;fundingProgramme[0]-&amp;gt;area-&amp;gt;label&#xA;            ];&#xA;        },&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(the &lt;code&gt;test&lt;/code&gt; key at the end is me proving that I can retrieve the field &lt;code&gt;programmeTitle&lt;/code&gt; from the Matrix field &lt;code&gt;fundingProgramme&lt;/code&gt;. There's only one stored against each entry, though).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I query against this field? Would I have to do this in the transformer rather than the criteria?&lt;/p&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2017-10-09T14:25:13.777" Title="Using element API to query a matrix field" Tags="&lt;matrix&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22303" PostTypeId="1" CreationDate="2017-10-09T18:41:52.510" Score="1" ViewCount="33" Body="&lt;p&gt;I implemented a form on a website using the Freeform Plugin (by Solspace) and I would like another company to have access to the results of this form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking of using the bootstrap demo to display the submissions, but to access it one has to be connected to the Craft Account:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser and currentUser.admin %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I create an authentication system but only for the Submission Page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6659" LastActivityDate="2017-10-09T18:41:52.510" Title="Give Access to Freeform (Solspace) Submission Answers to a tierce person" Tags="&lt;plugin-freeform&gt;&lt;authentication&gt;&lt;bootstrap-craft&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22304" PostTypeId="1" AcceptedAnswerId="22315" CreationDate="2017-10-10T03:06:36.217" Score="1" ViewCount="235" Body="&lt;p&gt;In the control panel, is it possible to search for entries where a specific field is empty? The Craft &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow noreferrer&quot;&gt;search syntax page&lt;/a&gt; doesn't help here, and the logical values used in twig don't seem to work here. I haven't been able to find any other info about this either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Side note: the search syntax is a bit out of reach for many non-dev users (read clients). An advanced search/filter form for entries would be awesome.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="7368" LastActivityDate="2017-10-10T19:42:59.423" Title="CP search for entries where a specific field is empty" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22305" PostTypeId="2" ParentId="22304" CreationDate="2017-10-10T08:22:24.090" Score="1" Body="&lt;p&gt;We use Zenbu for this exact thing. As we're importing a lot of data, we need to find which entries are missing data - &lt;a href=&quot;https://zenbustudio.com/software/zenbu-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://zenbustudio.com/software/zenbu-craftcms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2017-10-10T08:22:24.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22306" PostTypeId="1" AcceptedAnswerId="22310" CreationDate="2017-10-10T09:52:59.700" Score="2" ViewCount="838" Body="&lt;p&gt;Is there a twig filter to encode special characters like umlauts:&#xA;&lt;code&gt;{{ entry.title | filter }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Datensätze &amp;amp; Karten&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which then should result in:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;datensaetze-karten&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically what &lt;code&gt;'convertFilenamesToAscii' =&amp;gt; true,&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/config-settings#convertFilenamesToAscii&quot; rel=&quot;nofollow noreferrer&quot;&gt;does&lt;/a&gt; but as a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use this as a anchorlink later on so umlauts are not the best to have in anchor links.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2019-05-08T09:13:54.117" Title="Convert characters to Ascii" Tags="&lt;filter&gt;&lt;escaping&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22307" PostTypeId="1" CreationDate="2017-10-10T10:10:47.957" Score="1" ViewCount="204" Body="&lt;p&gt;My client has a catalogue website with a big amount of assets. What's the best way to move the assets from local to Amazon S3?&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2017-10-10T10:10:47.957" Title="What's the best way to move a lot of assets from local to S3 and keep relations" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2017-10-15T05:22:14.773" ContentLicense="CC BY-SA 3.0" />
  <row Id="22308" PostTypeId="1" CreationDate="2017-10-10T10:59:12.407" Score="1" ViewCount="301" Body="&lt;ol&gt;&#xA;&lt;li&gt;Customer 1 adds a product to their cart. Does not complete their order.&lt;/li&gt;&#xA;&lt;li&gt;Customer 2 purchases the remaining stock of that product, completing their order.&lt;/li&gt;&#xA;&lt;li&gt;Customer 1 returns to the store the next day, picking up where they left off.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What should happen in Craft Commerce? Will Customer 1 be allowed to purchase the now out-of-stock product?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-10-11T00:30:19.967" Title="Craft Commerce carts containing out-of-stock products" Tags="&lt;plugin-craftcommerce&gt;&lt;stock&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22309" PostTypeId="1" AcceptedAnswerId="22311" CreationDate="2017-10-10T11:18:00.250" Score="5" ViewCount="2512" Body="&lt;p&gt;I'm getting started with Craft, using version &lt;strong&gt;3 beta&lt;/strong&gt;, and I don't find the menu option for adding locales so I guess it's not yet ready but there must be another option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone guide me through the process of creating a multi-language &lt;strong&gt;Craft 3&lt;/strong&gt; site?&lt;/p&gt;&#xA;" OwnerUserId="7347" LastActivityDate="2018-11-15T01:46:14.870" Title="How to add locales in Craft 3" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22310" PostTypeId="2" ParentId="22306" CreationDate="2017-10-10T12:14:42.637" Score="3" Body="&lt;p&gt;I would use a combination of things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/replace.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;replace&lt;/a&gt; filter to convert &lt;code&gt;ä&lt;/code&gt; to &lt;code&gt;ae&lt;/code&gt; etc.&lt;/li&gt;&#xA;&lt;li&gt;Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/convert_encoding.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;convert_encoding&lt;/a&gt; filter to eliminate any remaining non-ascii characters&lt;/li&gt;&#xA;&lt;li&gt;Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/filters#kebab&quot; rel=&quot;nofollow noreferrer&quot;&gt;kebab&lt;/a&gt; filter to do its thing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and of course wrap the thing up in a macro&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro ascii_kebab(s) %}&#xA;  {{ s&#xA;    | replace({&#xA;        'ä': 'ae'&#xA;      })&#xA;    | convert_encoding('ASCII', 'UTF-8')&#xA;    | kebab&#xA;  }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastEditorUserId="130" LastEditDate="2018-11-11T11:02:08.567" LastActivityDate="2018-11-11T11:02:08.567" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="22311" PostTypeId="2" ParentId="22309" CreationDate="2017-10-10T14:03:36.887" Score="8" Body="&lt;p&gt;&quot;Sites&quot; in Craft 3 replaces the old &quot;Locales&quot; concept in Craft 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's not much &lt;a href=&quot;https://github.com/craftcms/docs#core-concepts&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; on them yet, but the &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;setup process&lt;/a&gt; is virtually the same as it is in Craft 2 for locales.  The main difference is that a &quot;site&quot; isn't necessarily tied to a language code, like it is in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/news/craft-3-multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-multi-site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: &lt;a href=&quot;https://docs.craftcms.com/v3/localization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Localization docs for Craft 3&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="57" LastEditorUserId="50" LastEditDate="2018-11-15T01:46:14.870" LastActivityDate="2018-11-15T01:46:14.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22312" PostTypeId="1" CreationDate="2017-10-10T15:15:05.577" Score="1" ViewCount="400" Body="&lt;p&gt;In the &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo&lt;/a&gt; plugin, I've made a block that has the option to add 3 child blocks underneath it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code from the parent block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'neo/default' %}&#xA;{% block blockContent %}&#xA;&#xA;&amp;lt;section id=&quot;services&quot; class=&quot;white-bg&quot;&amp;gt;&#xA; &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;row margin-60&quot;&amp;gt;&#xA;     &amp;lt;div class=&quot;col-sm-12 text-center&quot;&amp;gt;&#xA;       &amp;lt;h2&amp;gt;{{ block.mainTitle }}&amp;lt;/h2&amp;gt;&#xA;     &amp;lt;/div&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA;&#xA;   &amp;lt;div class=&quot;row margin-60&quot;&amp;gt;&#xA;&#xA;    {% if block.children %}&#xA;     {% for item in block.children %}&#xA;     {% if loop.first %}&#xA;     {% include &quot;neo/children/&quot; ~ item.type %}&#xA;     {% endif %}&#xA;    {% endfor %}&#xA;    {% endif %}&#xA;&#xA;   &amp;lt;/div&amp;gt;&#xA;&#xA; &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the parent block can have up to 3 child blocks. You'll get 3 blocks on one row, each block has a 'col-sm-4' (Up to 12 fit on one row if aren't familiar with Bootstrap) class so it fits on one row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if a user only chooses to have 2 child blocks the classes 'col-sm-4' will remain the same. I'd like to change this class to 'col-sm-6' and when only one child block is selected, 'col-sm-12'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay so this is the code for the child block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block blockContent %}    &#xA;{% for block in entry.body %}&#xA;{% switch block.type.handle %}&#xA;{% case 'serviceItem' %}&#xA;&#xA;&amp;lt;div class=&quot;col-sm-4 margin-20 wow fadeInUp&quot; data-wow-delay=&quot;0.4s&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;text-center margin-20&quot;&amp;gt;&amp;lt;i class=&quot;fa {{ block.mainTitle }} fa-4x black&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&#xA;  {{ block.text }}&#xA;  &amp;lt;a class=&quot;more&quot; href=&quot;#&quot;&amp;gt;LEARN MORE&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I tried first is set the length of the child block. And with that number defined, with the help of if statements, change the layout like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numberOfItems = block.serviceItem|length %}&#xA; {% if numberOfItems == 1 %}&#xA;  &amp;lt;div class=&quot;col-sm-12 margin-20 wow fadeInUp&quot; data-wow-delay=&quot;0.4s&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;text-center margin-20&quot;&amp;gt;&amp;lt;i class=&quot;fa {{ block.mainTitle }} fa-4x black&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&#xA;   {{ block.text }}&#xA;   &amp;lt;a class=&quot;more&quot; href=&quot;#&quot;&amp;gt;LEARN MORE&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA; {% elseif numberOfItems == 2 %}&#xA;&#xA;  &amp;lt;div class=&quot;col-sm-6 margin-20 wow fadeInUp&quot; data-wow-delay=&quot;0.4s&quot;&amp;gt;&#xA;   &amp;lt;div class=&quot;text-center margin-20&quot;&amp;gt;&amp;lt;i class=&quot;fa {{ block.mainTitle }} fa-4x black&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&#xA;   {{ block.text }}&#xA;   &amp;lt;a class=&quot;more&quot; href=&quot;#&quot;&amp;gt;LEARN MORE&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately that method doesn't work since it won't count itself more than once since it is being looped outside of the code file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope my explanation was sufficient of what I hope to achieve.&#xA;Does anyone perhaps know the solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="4732" LastEditorUserId="57" LastEditDate="2017-10-10T20:00:12.937" LastActivityDate="2018-02-04T17:48:54.703" Title="Counting included child blocks in the Neo plugin" Tags="&lt;loop&gt;&lt;children&gt;&lt;blocks&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22313" PostTypeId="2" ParentId="1079" CreationDate="2017-10-10T17:30:21.507" Score="0" Body="&lt;p&gt;This article may be useful to anyone searching here as well: &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-10T17:30:21.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22314" PostTypeId="1" CreationDate="2017-10-10T19:01:40.447" Score="1" ViewCount="641" Body="&lt;p&gt;Getting the following error on production environment when trying to add a new Field.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'redacted' already exists&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea what could be causing this?&lt;/p&gt;&#xA;" OwnerUserId="4935" LastActivityDate="2017-10-12T18:17:53.723" Title="Base table or view already exists" Tags="&lt;field&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22315" PostTypeId="2" ParentId="22304" CreationDate="2017-10-10T19:42:59.423" Score="1" Body="&lt;p&gt;If you wanted to search for every &lt;code&gt;body&lt;/code&gt; field that did &lt;em&gt;not&lt;/em&gt; have a value, the syntax would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-body:*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which basically says, give me every &lt;code&gt;body&lt;/code&gt; field that has a value and negates it.  Have updated the &lt;a href=&quot;https://craftcms.com/docs/searching#supported-syntaxes&quot; rel=&quot;nofollow noreferrer&quot;&gt;search docs&lt;/a&gt; with an example.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-10T19:42:59.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22316" PostTypeId="1" AcceptedAnswerId="22317" CreationDate="2017-10-10T22:33:36.210" Score="1" ViewCount="43" Body="&lt;p&gt;I'm trying to display an asset that the client has selected to show up on the main page, and have it display on a totally different page. This sounds simple but I keep getting errors (and im learning).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Main page asset:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in entry.donateHeaderImage %}&#xA;   &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure how to display that asset on a different page in Craft. &lt;/p&gt;&#xA;" OwnerUserId="7327" LastActivityDate="2017-10-10T22:52:08.827" Title="Grabbing an asset field from Page A to display on Page B" Tags="&lt;assets&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22317" PostTypeId="2" ParentId="22316" CreationDate="2017-10-10T22:52:08.827" Score="3" Body="&lt;p&gt;First you need to get the entry for the main page. There are a number of ways you might do that (check the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.entries&lt;/a&gt; documentation). One would be to fetch it by section handle, so assuming the main page has section handle of &lt;code&gt;mainPage&lt;/code&gt;, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainPage = craft.entries.section('mainPage').first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you can get the from the main page asset as before:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in mainPage.donateHeaderImage %}&#xA;  &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To be safe, you should always handle the possibility that &lt;code&gt;craft.entries&lt;/code&gt; won't return anything (maybe the mainPage section handle changed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So either test it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainPage = craft.entries.section('mainPage').first %}&#xA;{% if mainPage %}&#xA;  {% for asset in mainPage.donateHeaderImage %}&#xA;    &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or use the powerful &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;null-coalescing operator&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in craft.entries.section('mainPage').first.donateHeaderImage ?? [] %}&#xA;  ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-10T22:52:08.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22318" PostTypeId="2" ParentId="22308" CreationDate="2017-10-11T00:30:19.967" Score="2" Body="&lt;p&gt;The next time the cart 're-calculates' - so really any process on the cart such as updating it etc, the out of stock product will be detected and removed from the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If somehow they get straight to the attempt order completion stage, then I am pretty sure an error is raised (&amp;amp; returned in flash) and the order won't complete.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-10-11T00:30:19.967" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22319" PostTypeId="1" CreationDate="2017-10-11T07:50:01.680" Score="3" ViewCount="385" Body="&lt;p&gt;I have a field for upload an image in asset field. Can we set a default image in this field. Means when I create a new entry a default image has been already selected in asset field.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastActivityDate="2017-10-11T12:40:07.710" Title="How we can set an image as default value in assets field" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22321" PostTypeId="1" AcceptedAnswerId="22335" CreationDate="2017-10-11T10:55:14.933" Score="1" ViewCount="252" Body="&lt;p&gt;I’ve already got a ton of content put in by the client, and there’s quite a bit of accented characters (é, à, ...) in the titles, and thus also in the slugs where they get url encoded, which my client considers 'ugly'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I’ve added the &lt;code&gt;limitAutoSlugsToAscii' =&amp;gt; true&lt;/code&gt; rule to the config, but how can I best rework the url’s for the already existing content? There’s about 1000 entries already in the website so I’d rather not go over them by hand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I just clear the slug column in the database? Or will I have to write a temporary custom controller action that I can trigger to loop over all entries to redo their slug? Or is there another (better) solution?&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-10-11T17:16:32.543" Title="Bulk regenerate slugs" Tags="&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22322" PostTypeId="2" ParentId="1217" CreationDate="2017-10-11T11:54:11.357" Score="2" Body="&lt;p&gt;As of Craft 2.6.2771, sections now have a “Default Entry Status” section.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-10-11T11:54:11.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22323" PostTypeId="2" ParentId="9309" CreationDate="2017-10-11T11:54:32.990" Score="3" Body="&lt;p&gt;As of Craft 2.6.2771, sections now have a “Default Entry Status” section.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-10-11T11:54:32.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22324" PostTypeId="1" AcceptedAnswerId="22329" CreationDate="2017-10-11T12:18:26.960" Score="1" ViewCount="59" Body="&lt;p&gt;I have an unusual issue with a for loop divisible by. The code works fine initially as it loops through the entries and closes a the list element on the 4th loop. However when it gets to the end of the entries and there are less than 4 left it strangely adds them into the source but does not display them visually on the page or in chromes inspector?? Has anyone come across this before? Nothing is hiding the last entries and if I change divisible by to different values it does the same only show entries that are divisible by and loses the remainder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.first %}&#xA;  &amp;lt;li&amp;gt;&#xA;{% endif %}&#xA;&#xA;..... code pulling out entry details into divs&#xA;&#xA;{% if loop.index is divisible by(4) and not loop.last %}&#xA;  &amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#xA;{% endif %}&#xA;{% if loop.last %}&#xA;  &amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-10-11T14:11:53.053" Title="divisible by strange issue" Tags="&lt;loop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22325" PostTypeId="2" ParentId="22319" CreationDate="2017-10-11T12:40:07.710" Score="6" Body="&lt;p&gt;That's not possible, but the way I handle this is to have a Global called &quot;Missing Image Fallback&quot; inside a &quot;Generic&quot; Global field set, and then when I need to reference an image I use the following twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.myImageField.first ?? generic.missingImageFallback.first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will assign the first myImageField asset to 'image' if it's been filled in, but fall back to the generic global field if not.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-10-11T12:40:07.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22326" PostTypeId="1" CreationDate="2017-10-11T13:19:26.433" Score="1" ViewCount="79" Body="&lt;p&gt;How should I structure a .csv and process the data to import matrix fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whith table I used a &lt;code&gt;json_encode&lt;/code&gt; but of course this doesn't work with matrixes. &lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-10-11T13:19:26.433" Title="Import CSV to matrix field" Tags="&lt;matrix&gt;&lt;import&gt;&lt;csv&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22327" PostTypeId="1" AcceptedAnswerId="22336" CreationDate="2017-10-11T13:19:37.627" Score="2" ViewCount="1930" Body="&lt;p&gt;Is there any craft command command (shell) which can be used to perform the database updates necessary after a CMS update? (e.g. Craft3 beta-28 to beta29 or multi version updates)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background: We are deploying our projects with Jenkins and I would want Jenkins to call such a command after each deployment (or after each CMS update). Going to the /admin/ Panel manually to be told that the database needs to be upgraded is not ideal.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="57" LastEditDate="2017-10-11T17:21:45.433" LastActivityDate="2018-04-04T08:15:39.400" Title="Craft 3: Update database after CMS upgrade via console command" Tags="&lt;database&gt;&lt;craft3&gt;&lt;migration&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22328" PostTypeId="1" CreationDate="2017-10-11T14:06:57.537" Score="1" ViewCount="63" Body="&lt;p&gt;I'm trying to import data with the &lt;a href=&quot;https://github.com/boboldehampsink/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;import&lt;/a&gt; plugin into entries with a &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; field. How is structured this field and how can I insert the data?&lt;/p&gt;&#xA;" OwnerUserId="6817" LastActivityDate="2017-10-11T14:06:57.537" Title="Import data into SEOmatic" Tags="&lt;plugin-import&gt;&lt;plugin-seomatic&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22329" PostTypeId="2" ParentId="22324" CreationDate="2017-10-11T14:11:53.053" Score="2" Body="&lt;p&gt;You have some other bug somewhere else. Check the &lt;em&gt;code pulling out entry details&lt;/em&gt; to be sure that it doesn't modify &lt;code&gt;loop&lt;/code&gt; or the list you are looping on, or the current item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in (1..10) %}&#xA;  {% if loop.first %} [ {% endif %}&#xA;  {{ item }}&#xA;  {% if loop.index is divisible by(4) and not loop.last %}&#xA;    ] [&#xA;  {% endif %}&#xA;  {% if loop.last %} ] {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And outputs this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 1 2 3 4 ] [ 5 6 7 8 ] [ 9 10 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can simplify it a bit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in (1..10) %}&#xA;  {% if loop.first %} [ {% endif %}&#xA;  {{ item }}&#xA;  {% if loop.index is divisible by(4) or loop.last %}&#xA;    ] [&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also can use the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/batch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;batch&lt;/a&gt; filter, which I think makes things slightly clearer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for b in (1..10) | batch(4) %}&#xA;  [&#xA;    {% for item in b %}&#xA;      {{ item }}&#xA;    {% endfor %}&#xA;  ]&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-11T14:11:53.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22330" PostTypeId="1" AcceptedAnswerId="22343" CreationDate="2017-10-11T14:18:57.070" Score="1" ViewCount="1208" Body="&lt;p&gt;I've got a Craft 2 site on an NGINX server that uses FastCGI Caching (based on &lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Static Page Caching with Craft CMS&lt;/a&gt;), but I've got a few pages that have some dynamic content that I'd like to exclude from the cache. I understand I can do this within the NGINX config, but my client has asked if they can somehow manage this within Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried doing this with headers and cookies, but haven't had any luck yet. What I think is happening is that these things are set after the request is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use a plugin that can get information on which path to exclude into my NGINX config on a per-path basis? If so, where would be a good place to start?&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2017-10-12T15:36:23.467" Title="Exclude path in NGINX config (for FastCGI Caching)" Tags="&lt;cache&gt;&lt;config&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22331" PostTypeId="1" AcceptedAnswerId="22333" CreationDate="2017-10-11T14:41:36.780" Score="1" ViewCount="523" Body="&lt;p&gt;I am in the process of building a gift card system for a Craft Commerce site. The current process is that the customer will order a gift card and proceed through checkout as with any other item. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only information passed through the options is the amount, which is used to generate the gift card. The process works perfectly, and the gift card is generated exactly how it is supposed too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to modify the line items using the event &lt;code&gt;onBeforeOrderComplete&lt;/code&gt; or &lt;code&gt;onOrderComplete&lt;/code&gt;. I would like to change the options to include the amount, and the gift card code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the process I have at the moment, which is just one of the many variations that I've attempted. Nothing I do seems to change the options on the order.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event) {&#xA;    $order = $event-&amp;gt;params['order'];&#xA;    $items = $order-&amp;gt;lineItems;&#xA;&#xA;    foreach( $items as $key =&amp;gt; $item ) {&#xA;        $type = $item-&amp;gt;getPurchasable()-&amp;gt;getProduct()-&amp;gt;getType();&#xA;        if ($type-&amp;gt;handle === 'giftCard') { &#xA;            $options = $item-&amp;gt;options;&#xA;            $giftcard = new GiftCards_GiftCardModel();&#xA;&#xA;            $giftcard-&amp;gt;amount = $item-&amp;gt;price;&#xA;            $giftcard-&amp;gt;balance = $item-&amp;gt;price;&#xA;            $giftcard-&amp;gt;isActive = 1;&#xA;&#xA;            craft()-&amp;gt;giftCards-&amp;gt;saveGiftCard($giftcard);&#xA;&#xA;            $options['code'] = $giftcard-&amp;gt;code;&#xA;            $items[$key]-&amp;gt;options = $options;&#xA;        }&#xA;    }&#xA;&#xA;    $order-&amp;gt;lineItems = $items;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My only other solution is to generate the gift card code when the gift card is added to the cart and change the active status when order is complete. This would solve my problem completely, but it runs the risk of having hundreds or even thousands of gift cards generated and never completely activated.  &lt;/p&gt;&#xA;" OwnerUserId="7372" LastActivityDate="2017-10-11T15:35:02.150" Title="Modifying Commerce line items after order is complete" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22332" PostTypeId="1" CreationDate="2017-10-11T14:48:19.657" Score="3" ViewCount="96" Body="&lt;p&gt;We have Algolia search running on our Craft install through the Search Plus plunin. When I disable an entry I'm finding that it is still searchable through Algolia, which then results in a broken link. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else experienced this or do you know of a way to filter out results that are disabled?&lt;/p&gt;&#xA;" OwnerUserId="7373" LastEditorUserId="57" LastEditDate="2017-10-11T17:31:20.467" LastActivityDate="2017-10-11T17:31:20.467" Title="Algolia indexing disabled items in Craft" Tags="&lt;plugin-searchplus&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22333" PostTypeId="2" ParentId="22331" CreationDate="2017-10-11T15:35:02.150" Score="1" Body="&lt;p&gt;I found a solution (possibly temporary) to my problem. Instead of trying to modify the line items via the order itself, I am modifying them directly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After changing the line item during the for loop, I pass the &lt;code&gt;$item&lt;/code&gt; variable back into this code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;commerce_lineItems-&amp;gt;saveLineItem($item);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure what the extra impact that is on the number of queries, but considering that most people will only order a single gift card, maybe two, I would imagine that it's not a terrible way to accomplish this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still open to ideas of a better way to solve my issue, but for now it seems to do the trick.&lt;/p&gt;&#xA;" OwnerUserId="7372" LastActivityDate="2017-10-11T15:35:02.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22335" PostTypeId="2" ParentId="22321" CreationDate="2017-10-11T17:16:32.543" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Or will I have to write a temporary custom controller action that I can trigger to loop over all entries to redo their slug?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin could then just use &lt;code&gt;StringHelper::asciiString($slug);&lt;/code&gt; to do the ASCII conversion and re-save it back to the database.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-11T17:16:32.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22336" PostTypeId="2" ParentId="22327" CreationDate="2017-10-11T17:21:31.320" Score="7" Body="&lt;p&gt;You can use &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-db-migrations.html#applying-migrations&quot; rel=&quot;noreferrer&quot;&gt;Yii's migrate console command&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Triggered in Craft 3 via &lt;code&gt;craft migrate --type=app&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-11-13T18:03:44.920" LastActivityDate="2017-11-13T18:03:44.920" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22340" PostTypeId="1" CreationDate="2017-10-12T08:39:20.643" Score="1" ViewCount="171" Body="&lt;p&gt;Problem: I want to trigger an action (&lt;a href=&quot;https://github.com/nystudio107/instantanalytics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Instant Analytics&lt;/a&gt; plugin) whenever a payment (Craft Commerce plugin) is successful (webhook). Payment provider is Mollie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I created a plugin that listens to the &lt;code&gt;onOrderComplete&lt;/code&gt; event to send the analytics action. But it looks like the event &lt;code&gt;onOrderComplete&lt;/code&gt; is not triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete', function(Event $event) {&#xA;    craft()-&amp;gt;instantAnalytics-&amp;gt;analytics()-&amp;gt;addCommerceCheckoutStep($event-&amp;gt;params['order'], 4, 'Payed');&#xA;    craft()-&amp;gt;instantAnalytics-&amp;gt;analytics()-&amp;gt;sendPageView();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Question 1: Is this event a good one? Or is there an event that is thrown at the moment of a successful payment of an incoming webhook?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2: Why is the &lt;code&gt;onOrderComplete&lt;/code&gt; event not thrown?&lt;/p&gt;&#xA;" OwnerUserId="7378" LastEditorUserId="57" LastEditDate="2017-10-12T17:26:41.510" LastActivityDate="2017-10-12T17:26:41.510" Title="commerce_orders onOrderComplete not triggered?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;events&gt;&lt;analytics&gt;&lt;payment&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22341" PostTypeId="2" ParentId="22330" CreationDate="2017-10-12T12:16:55.820" Score="1" Body="&lt;p&gt;To the best of my knowledge it is not possible to skip/exclude caching based on the response with fastcgi cache.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-10-12T12:16:55.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22342" PostTypeId="1" CreationDate="2017-10-12T13:06:10.307" Score="1" ViewCount="46" Body="&lt;p&gt;I am trying to being authorized at Chanel Adviser but it's showing error, &quot;invalid_client&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am invoking this URL : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://api.channeladvisor.com/oauth2/token?client_id=qgonsl3lqy4qbje8pxl294stbc8m7ne3&amp;amp;response_type=token&amp;amp;scope=orders+inventory&amp;amp;redirect_uri=https%3A%2F%2Fwww.redirecturl.com%2Foauth2%2Fcallback&amp;amp;state=insertantiforgerytoken&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am following there official process described here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://developer.channeladvisor.com/authorization/oauth-2-0-authorization-flow&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anybody can help me where I am making the mistake?&lt;/p&gt;&#xA;" OwnerUserId="7380" LastActivityDate="2018-05-10T20:50:29.073" Title="Authorization fail" Tags="&lt;plugin-elementapi&gt;&lt;authentication&gt;&lt;plugin-duktoauth&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22343" PostTypeId="2" ParentId="22330" CreationDate="2017-10-12T15:12:22.563" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I've tried doing this with headers and cookies, but haven't had any luck yet. What I think is happening is that these things are set after the request is made.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are correct. &lt;code&gt;fastcgi_cache&lt;/code&gt; is basically a switch, is it on or off. Your backend has no say in that because nginx doesn't look to the backend at all to figure out whether it should serve the request via cache or fire up FPM. It looks via the things it does have access to at the time... location, query_string, user_agent, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How often does your client need to update?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the things that makes nginx fast is config files are only read into memory once. Apache, by contrast, looks for &lt;code&gt;.htaccess&lt;/code&gt; files inside every directory in the tree on every request being served. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make changes to a config requires nginx to be reloaded (or restarted). Complicating things, port 80 is a privileged port which means to open it up/listen on it, you need to have root permissions. That's not something you would want to give to a user via a web interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are some workarounds. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;If you are able to name your slugs differently in advance&lt;/strong&gt; (e.g. append or prefix &quot;-form&quot; or &quot;-dyn&quot; or something like that to the URL), you can use that to tell nginx not to load from cache.  You could even have Craft generate part of the URL for you based on the value of a &quot;Does this have dynamic content?&quot; lightswitch. &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Generate part of the nginx config dynamically by using a cron job&lt;/strong&gt; which runs a shell script every 15 mins or so to check if there are configuration changes. If there are changes, reload nginx. I'd recommend using a &lt;a href=&quot;https://www.ignoredbydinosaurs.com/posts/236-cool-nginx-feature-of-the-week&quot; rel=&quot;nofollow noreferrer&quot;&gt;map&lt;/a&gt;, put that in a separate file, and then include it so you're not touching of the main config files.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Use the &lt;a href=&quot;https://github.com/openresty/lua-nginx-module#readme&quot; rel=&quot;nofollow noreferrer&quot;&gt;lua module&lt;/a&gt;.&lt;/strong&gt; Lua is a scripting language that lets you run dynamic code on every request. I haven't used it so I don't know how performant it would be but it could work to set variables, etc. &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Load content in via JavaScript.&lt;/strong&gt; Depending on what you're trying to do, ignore the web server altogether and load content dynamically. If it's an interactive thing that's going to be tough for google to cache anyway, that could work well here.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Caching is super tricky. &lt;a href=&quot;https://varnish-cache.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Varnish&lt;/a&gt; has a lot more options when it comes to dynamic content but it's potentially another dameon you need to setup and maintain. nginx is great because of its simplicity, however, that simplicity comes at a cost of flexibility.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-10-12T15:36:23.467" LastActivityDate="2017-10-12T15:36:23.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22344" PostTypeId="1" AcceptedAnswerId="22345" CreationDate="2017-10-12T16:28:25.723" Score="2" ViewCount="201" Body="&lt;p&gt;I'm trying to start a loop at the 8th entry in a structure and then loop through the remaining entries in that structure and stop once I reach the end. How would I accomplish this in Craft? &lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2017-10-12T16:41:09.343" Title="Start a Loop at the nth Entry in a Structure and Loop to the End?" Tags="&lt;structure&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22345" PostTypeId="2" ParentId="22344" CreationDate="2017-10-12T16:41:09.343" Score="3" Body="&lt;p&gt;Using the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#offset&quot; rel=&quot;nofollow noreferrer&quot;&gt;offset&lt;/a&gt; parameter you can achieve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for entry in craft.entries.section('structureSection').offset(8) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="202" LastActivityDate="2017-10-12T16:41:09.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22346" PostTypeId="2" ParentId="22342" CreationDate="2017-10-12T17:33:36.757" Score="1" Body="&lt;p&gt;You didn't mention in the post, but you tagged the question with &lt;a href=&quot;https://dukt.net/oauth&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt oAuth&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to connect with that, Channel Advisor isn't a 1st or 3rd party Dukt oAuth provider.  You can see a list of the available ones here: &lt;a href=&quot;https://dukt.net/oauth/providers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dukt.net/oauth/providers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to right an oAuth Channel Advisor &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft plugin&lt;/a&gt; in order for it to work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-12T17:33:36.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22347" PostTypeId="2" ParentId="22314" CreationDate="2017-10-12T18:17:53.723" Score="2" Body="&lt;p&gt;This turned out to be an issue with the mysql server itself, not a Craft CMS issue at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that during a previous field addition, the database server crashed and left hanging temporary files that didn't match with the database itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spun up a new database, copied the DB over and everything worked as expected. &lt;/p&gt;&#xA;" OwnerUserId="4935" LastActivityDate="2017-10-12T18:17:53.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22348" PostTypeId="1" AcceptedAnswerId="22367" CreationDate="2017-10-12T18:42:32.460" Score="1" ViewCount="63" Body="&lt;p&gt;Basically, I have two sections of a page. In one section of the page, I want to output the first 8 entries in a loop. In the next section of a page, I want to output from the 9th entry to the end of the loop. The entries that I'm looping through are eager loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I'm doing it right now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set clients = element.clients.find({&#xA;    with: [&#xA;        ['logo', {&#xA;            withTransforms: ['newClientLogoPage']&#xA;        },]&#xA;    ]})&#xA;%}&#xA;&#xA;SECTION #1:&#xA;{% for client in clients %}   &#xA;    {% if loop.index0 &amp;lt;= 7 %}&#xA;        DO SOME STUFF&#xA;&#xA;SECTION #2:&#xA;{% for client in clients %} &#xA;    {% if loop.index0 &amp;gt;= 8 %} &#xA;        DO SOME STUFF&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, I'm fully looping through the same entries twice and just starting and ending what is output at different spots using loop index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better / more efficient way to start and end my loops at different points without doing two full loops like I am now?&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="57" LastEditDate="2017-10-12T20:33:08.263" LastActivityDate="2017-10-13T16:26:43.997" Title="Starting &amp; Ending Loops with Eager Loaded Elements" Tags="&lt;forloop&gt;&lt;loop&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22349" PostTypeId="1" AcceptedAnswerId="22350" CreationDate="2017-10-12T20:42:56.970" Score="1" ViewCount="103" Body="&lt;p&gt;I'm having a bit of trouble showing a message if there's no entries in my blog. I tried the length filter but my empty message wont show:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('volunteerPosition').find() %}&#xA;  {% if entry.volunteerPosition|length %}&#xA;&#xA;      {{entry.volunteerShortDescription}}&#xA;&#xA;  {% else %}&#xA;&#xA;      Sorry, Nothing to show.&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="57" LastEditDate="2017-10-12T20:55:17.790" LastActivityDate="2017-10-13T02:01:47.313" Title="If no blog entries, show something else" Tags="&lt;entries&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22350" PostTypeId="2" ParentId="22349" CreationDate="2017-10-12T20:54:52.830" Score="2" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all of the entries in the 'volunteerPosition' section #}&#xA;{% set entries = craft.entries.section('volunteerPosition').find() %}&#xA;&#xA;{# Do we have any %}&#xA;{% if entries|length %}&#xA;&#xA;    {# Loop through them #}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.volunteerShortDescription }}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;{% else %}&#xA;    {# Nothing to see here #}&#xA;    Sorry, nothing to show.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-10-13T02:01:47.313" LastActivityDate="2017-10-13T02:01:47.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22351" PostTypeId="1" AcceptedAnswerId="22366" CreationDate="2017-10-12T22:34:23.217" Score="2" ViewCount="322" Body="&lt;p&gt;I have a frontend entry form with some checkboxes that is not behaving correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you uncheck all options and save, nothing changes (this is bad). However if you uncheck one item and check another item it saves correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally in the Craft CP if you uncheck all items it saves correctly so it clearly works there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;relevant template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for volunteer in craft.entries.section('careers').search('positionType:volunteerPosition') %}&#xA;  &amp;lt;label class=&quot;d-block&quot;&amp;gt; &#xA;        &amp;lt;input type=&quot;checkbox&quot; class=&quot;form-check-input&quot; name=&quot;fields[volunteerPositions][]&quot; class=&quot;form-check-input&quot; value=&quot;{{volunteer.id}}&quot; {% if volunteer.id in selectedEntries %}checked{% endif %}&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;{{volunteer.title}}  (created by {{volunteer.author }}) &#xA;      &amp;lt;/label&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-10-13T15:08:37.267" Title="Frontend Form - Checkboxes cannot &quot;all&quot; be unchecked" Tags="&lt;frontend&gt;&lt;checkboxes&gt;&lt;frontend-form&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22352" PostTypeId="1" CreationDate="2017-10-13T04:45:33.037" Score="2" ViewCount="211" Body="&lt;p&gt;I was changing some entry types to allow for a parent/child structure when I realised that this was already something Craft could do natively. When I undid my changes and attempted to assign a parent page, I am given the following error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\Entry Model could not be converted to int.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am still fairly new to Craft so I am quite limited in understanding exactly what I did to break it. I can still create and edit entries, I just can't set a parent page anymore.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2017/10/13 22:37:16 [warning] [application] There was a problem parsing the feed: cURL error 60: SSL certificate problem: unable to get local issuer certificate&#xA;&#xA;******************************************************************************************************&#xA;2017/10/13 22:37:58 [error] [php] Object of class Craft\EntryModel could not be converted to int (C:\wamp64\www\craft\storage\runtime\compiled_templates\9a\9a68f00c27a5bff3f289231a8d85ef2d821f962bf46e9f246c88cce64dc926f2.php:19)&#xA;Stack trace:&#xA;#0 C:\wamp64\www\craft\app\etc\templating\BaseTemplate.php(26): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd-&amp;gt;displayWithErrorHandling()&#xA;#1 C:\wamp64\www\craft\app\vendor\twig\twig\lib\Twig\Template.php(403): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd-&amp;gt;displayWithErrorHandling()&#xA;#2 C:\wamp64\www\craft\app\vendor\twig\twig\lib\Twig\Template.php(411): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd-&amp;gt;display()&#xA;#3 C:\wamp64\www\craft\app\services\TemplatesService.php(388): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd-&amp;gt;render()&#xA;#4 C:\wamp64\www\craft\app\helpers\ElementHelper.php(122): Craft\TemplatesService-&amp;gt;renderObjectTemplate()&#xA;#5 C:\wamp64\www\craft\app\services\ElementsService.php(1556): setUniqueUri()&#xA;#6 C:\wamp64\www\craft\app\services\EntriesService.php(176): Craft\ElementsService-&amp;gt;saveElement()&#xA;#7 C:\wamp64\www\craft\app\controllers\EntriesController.php(462): Craft\EntriesService-&amp;gt;saveEntry()&#xA;#8 C:\wamp64\www\craft\app\framework\web\actions\CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;#9 C:\wamp64\www\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;#10 C:\wamp64\www\craft\app\framework\web\CController.php(286): Craft\EntriesController-&amp;gt;runAction()&#xA;#11 C:\wamp64\www\craft\app\framework\web\CController.php(265): Craft\EntriesController-&amp;gt;runActionWithFilters()&#xA;#12 C:\wamp64\www\craft\app\framework\web\CWebApplication.php(282): Craft\EntriesController-&amp;gt;run()&#xA;#13 C:\wamp64\www\craft\app\etc\web\WebApp.php(823): Craft\WebApp-&amp;gt;runController()&#xA;#14 C:\wamp64\www\craft\app\etc\web\WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#15 C:\wamp64\www\craft\app\framework\base\CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#16 C:\wamp64\www\craft\app\index.php(62): Craft\WebApp-&amp;gt;run()&#xA;#17 C:\wamp64\www\public_html\index.php(19): require_once()&#xA;REQUEST_URI=/public_html/admin/entries/pages/90-cherries&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7382" LastEditorUserId="7382" LastEditDate="2017-10-15T07:05:45.823" LastActivityDate="2017-10-15T07:37:46.497" Title="Can't assign a parent page to an entry" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22353" PostTypeId="1" CreationDate="2017-10-13T05:49:13.777" Score="0" ViewCount="86" Body="&lt;p&gt;Good mornig&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having a problem with my bannerImage.&#xA;First off i show you how i did it and what the problem is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FMQDC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FMQDC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first picture you can see, how i get the image.&#xA;This method works fine for 3 other pages on this website.¨&#xA;My field setup is correct, because in other templates it works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing i can now think off is that there's something wrong with the name of the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;I fixed this problem like this.&lt;a href=&quot;https://i.stack.imgur.com/XFb5k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XFb5k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7364" LastEditorUserId="7364" LastEditDate="2017-10-17T07:45:28.277" LastActivityDate="2017-10-17T07:45:28.277" Title="Image does not be shown" Tags="&lt;assets&gt;&lt;image&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22354" PostTypeId="2" ParentId="18353" CreationDate="2017-10-13T08:55:27.220" Score="2" Body="&lt;p&gt;The AJAX POST url variable (&lt;code&gt;postUrl&lt;/code&gt;) should be set from the form template with this Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var postUrl;&#xA;    if ('{{ craft.i18n.getCurrentLocale() }}' == '{{ craft.i18n.getPrimarySiteLocale() }}') {&#xA;        postUrl = '/';&#xA;    } else {&#xA;        postUrl = '/{{ craft.i18n.getCurrentLocale() }}/';&#xA;    }&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore, an hidden field should be added in order to call the Sprout Forms' controller on submit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This submits the form in the current locale, and returns errors in this same locale.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-10-13T08:55:27.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22355" PostTypeId="1" AcceptedAnswerId="22363" CreationDate="2017-10-13T09:07:31.567" Score="1" ViewCount="675" Body="&lt;p&gt;Having looked at other answers I'm pretty sure I've got this correct but it's still not working for me.  I've stripped the code down to make it easier to read.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error i'm getting is &quot;Impossible to access an attribute (&quot;packageName&quot;) on a string variable (&quot;40&quot;).&quot;  This error repeats for packageTitle, packageShortIntro etc if I delete the packageName line etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other fields, 'block.body', 'block.subTitle' are coming through fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also please note there is also a Table field within the SuperTable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageContent %}&#xA;    {% switch block.type %}&#xA;&#xA;        {% case 'bodyText' %}&#xA;            {{ block.body }}&#xA;&#xA;        {% case 'packages' %}&#xA;            &amp;lt;!-- Supertable --&amp;gt;&#xA;            {% for row in block.package %}&#xA;                {{ row.packageName }}&#xA;                {{ row.packageTitle }}&#xA;                {{ row.packageShortIntro }}&#xA;&#xA;                {% for items in row.itemsAvailable %}&#xA;                    {{ items.item }}&#xA;                    {{ items.isAvailable }}&#xA;                {% endfor %}&#xA;&#xA;                {{ row.packageCost }}&#xA;            {% endfor %}&#xA;            &amp;lt;!-- End Supertable --&amp;gt;&#xA;&#xA;        {% case 'subTitle' %}&#xA;            {{ block.subTitle }}&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks for looking and any advice you can offer.&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2017-10-13T22:34:46.267" LastActivityDate="2017-10-24T09:59:11.133" Title="Output SuperTable fields from inside Matrix field" Tags="&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22356" PostTypeId="1" AcceptedAnswerId="22364" CreationDate="2017-10-13T09:50:47.880" Score="1" ViewCount="72" Body="&lt;p&gt;I'm having problems with Worldpay and their notorious dislike of 302 redirects with the payment response. I remember this problem last year and Luke fixed it but it seems to have returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within Commerce_PaymentsService there is code targeting Worldpay and some other gateways, around line 15 in the latest version. I believe that was to avoid the 302 redirect problem from last year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done is added code to log where the script is getting to, and it seems it never even reaches this code. You can see from the sample below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if ($success &amp;amp;&amp;amp; $transaction-&amp;gt;status == Commerce_TransactionRecord::STATUS_SUCCESS)&#xA;    {&#xA;        CommercePlugin::log('Commerce_PaymentsService line 814', LogLevel::Info, true);&#xA;        craft()-&amp;gt;commerce_orders-&amp;gt;updateOrderPaidTotal($transaction-&amp;gt;order);&#xA;    }&#xA;    CommercePlugin::log('Commerce_PaymentsService line 817', LogLevel::Info, true);&#xA;&#xA;    // For gateways that call us directly and usually do not like redirects.&#xA;    // TODO: Move this into the gateway adapter interface.&#xA;    $gateways = array(&#xA;        'AuthorizeNet_SIM',&#xA;        'Realex_Redirect',&#xA;        'SecurePay_DirectPost',&#xA;        'WorldPay',&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The line saying 'Commerce_PaymentsService line 817' is not being reached. I've currently following the trail and am several functions within Commerce_OrdersService applying the same metho to figure out what's happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a change in the way Commerce works that would bypass this Worldpay test?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a support request yesterday, but no response yet, which is why I'm on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: the latest version of Craft Commerce has changed things with Customer Emails. I've got some deprecated notices in the control panel. I'm wondering whether there is an email problem which is stopping things proceeding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2: rolled back two versions before the email change and it's still broken. I've noticed that when you update an order's status in the control panel the email is not being sent and a popup error saying 'Undefined' is being shown. There's nothing in any of the logs so it looks like more trawling through Craft Commerce. Test emails from Craft work fine, and the email template is fine when viewed on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 3: Removing the emails from the order statuses allows the order status to be updated fine. So there is definitely a problem with the emails. Then I've updated to use a test email containing nothing but static text - that processes, send and even redirects from Worldpay fine. It's my order email template.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2017-10-13T11:50:30.657" LastActivityDate="2018-01-19T11:00:52.187" Title="Craft Commerce Worldpay 302 error" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22357" PostTypeId="1" AcceptedAnswerId="22381" CreationDate="2017-10-13T10:04:24.230" Score="3" ViewCount="150" Body="&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm writing a plugin that will function as a document-archive with access-rights to different folders set based on user-groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to folders which are restricted, there is also one folder in the asset-source which is &quot;open&quot; to everyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the full plugin working; or at least so I thought until one of the test-users moved the &quot;open&quot; folder inside the asset-source trough the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suddenly the &quot;open&quot; folder (and it's contents) were no longer displayed anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was fetching this folder based on it its ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why you should not rely on folder-ids in Craft&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically - folder-IDs are dynamic, which means that you cannot safely look up a folder by ID!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's do a little experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create an asset-source named &lt;code&gt;My assets&lt;/code&gt;, and under it create two folders: &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Test2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now - if you look at your &lt;code&gt;craft_assetfolders&lt;/code&gt; database-table, you'll see something akin to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ID - parentId - sourceId - name        - path&#xA;77 - NULL     - 4        - &quot;My-assets&quot; - &#xA;78 - 77       - 4        - &quot;Test&quot;      - &quot;Test/&quot;&#xA;79 - 77       - 4        - &quot;Test2&quot;     - &quot;Test2/&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;parentId&lt;/code&gt; and &lt;code&gt;sourceId&lt;/code&gt; might be different numbers in your example - they depend on how much your &lt;code&gt;craft_assetfolders&lt;/code&gt; database-table contained before you started this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far this all makes perfect sense - until you move a folder! Per example, drag and drop &lt;code&gt;Test&lt;/code&gt; into &lt;code&gt;Test2&lt;/code&gt;, then reload the view of your database-table&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will now read&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ID - parentId - sourceId - name        - path&#xA;77 - NULL     - 4        - &quot;My-assets&quot; - &#xA;79 - 77       - 4        - &quot;Test2&quot;     - &quot;Test2/&quot;&#xA;80 - 79       - 4        - &quot;Test&quot;      - &quot;Test2/Test/&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What happened to &lt;code&gt;id 78&lt;/code&gt;? It's gone! However the folder &lt;code&gt;Test&lt;/code&gt; still exists, it still contains all of its assets etc - it just has a new ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now - for the sake of experimenting, let us drag and drop &lt;code&gt;Test&lt;/code&gt; back to the root of our asset-source and reload our view of the database-table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ID - parentId - sourceId - name        - path&#xA;77 - NULL     - 4        - &quot;My-assets&quot; - &#xA;79 - 77       - 4        - &quot;Test2&quot;     - &quot;Test2/&quot;&#xA;81 - 77       - 4        - &quot;Test&quot;      - &quot;Test/&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically - whenever you move an asset-folder, rather than simply update the &lt;code&gt;path&lt;/code&gt; and &lt;code&gt;parentId&lt;/code&gt; values of the associated database-row, the old row is deleted and a new one is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summa summarium - having a plugin or template reference a folder by its ID is hardly safe!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What other options do we have?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, in addition to ID folders also have a UID. But, since that is set on row creation, that also changes when a folder is moved. So that's another no-go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could look it up by name - but names can be changed, so that's as unreliable as looking it up by ID (or UID).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you were to write up a plugin-setting that allows you to pick the desired folder, that would - given that you move (or - if your plugin stores name rather than ID - rename) the folder - contain a null-reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can we - safely - identify a single asset-folder in a plugin, and know that it will always point to said folder and subsequently its contents?&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-15T01:01:39.853" Title="How can I safely identify a single asset-folder?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22358" PostTypeId="2" ParentId="22353" CreationDate="2017-10-13T10:15:49.453" Score="1" Body="&lt;p&gt;This might be a silly question, but is your &lt;code&gt;.pic-banner&lt;/code&gt; class for this template styled correctly, ie. given a height etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're setting it is a background-image it won't &quot;expand&quot; the element to the aspects of the image as it normally would using a img-element.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-13T10:15:49.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22359" PostTypeId="2" ParentId="22351" CreationDate="2017-10-13T10:25:04.203" Score="0" Body="&lt;p&gt;I think this might be related to form-data rather than being an actual Craft-issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically - when you submit your form, the data gets passed to the server. If we have checkboxes A, B and C with names checkboxes[] - and we check them all, the server would receive a &lt;code&gt;checkboxes&lt;/code&gt; array looking like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;['A', 'B', 'C']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if you check none of them and submit, the &lt;code&gt;checkboxes&lt;/code&gt; array would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically - in order to &quot;uncheck&quot; previously checked boxes in saved data, you have to implement your own &quot;unchecking&quot; routine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mocking it up really quickly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach savedData.checkboxes as i =&amp;gt; checkbox&#xA;    savedData.checkboxes[i] = in_array(checkbox, checkboxes)&#xA;endforeach&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically you loop through all checkboxes in the savedData, and set it to checked if it also exists in the &lt;code&gt;checkboxes&lt;/code&gt; array; otherwise you set it to &quot;unchecked&quot;&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-13T10:25:04.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22360" PostTypeId="2" ParentId="22353" CreationDate="2017-10-13T10:29:11.473" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;I don't think that the second screen has anything todo with it, because it's just about titles and adding a class to the body.&lt;/li&gt;&#xA;&lt;li&gt;What do you get in the source of the rendered page? Does the div inside the if statement appear or not? And if yes, try to open the image url, which is created, in a new tab and see what you get.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2017-10-13T10:29:11.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22361" PostTypeId="1" AcceptedAnswerId="22362" CreationDate="2017-10-13T10:31:35.060" Score="2" ViewCount="232" Body="&lt;p&gt;How can I query all completed orders within the last hour? It seems craft is only comparing a date by &lt;code&gt;YYYY-MM-DD&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following query collects all orders from the same day, as &lt;code&gt;{{dateFrom}}&lt;/code&gt; would output &lt;code&gt;2017-10-13&lt;/code&gt; and not eg. &lt;code&gt;2017-10-13 11:22:08&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateFrom = now|date_modify('-3600 seconds') %}&#xA;{% for order in craft.commerce.orders.dateOrdered( '&amp;gt;= ' ~ dateFrom) %}&#xA;  ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;adding something like &#xA;&lt;code&gt;craft.commerce.orders.dateOrdered( '&amp;gt;= ' ~ dateFrom|date('c'))&lt;/code&gt; would find any orders at all.&lt;/p&gt;&#xA;" OwnerUserId="7383" LastActivityDate="2017-10-13T11:31:32.363" Title="query orders by date AND time in craft commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22362" PostTypeId="2" ParentId="22361" CreationDate="2017-10-13T11:31:32.363" Score="1" Body="&lt;pre&gt;&lt;code&gt;'&amp;gt;= ' ~ dateFrom|date('c')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is correct to output the DateTime object as a string with the time (and timezone) included. If you don’t use the filter it’s output in the &lt;code&gt;Y-m-d&lt;/code&gt; format by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my recommendation would be to double check what &lt;code&gt;dateFrom|date('c')&lt;/code&gt; actually outputs and to compare it with the &lt;code&gt;dateOrdered&lt;/code&gt; values in the CP or database.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-10-13T11:31:32.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22363" PostTypeId="2" ParentId="22355" CreationDate="2017-10-13T11:40:54.147" Score="0" Body="&lt;p&gt;Your Super Table field is probably configured as a static field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the documentation for how to access subfields in this case:  &lt;a href=&quot;https://verbb.io/craft-plugins/super-table/docs/guides/templating-examples#static-super-table-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/super-table/docs/guides/templating-examples#static-super-table-field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of the for-loop you’d have sth. like this: &lt;code&gt;{{ block.package.packageName }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-10-24T09:59:11.133" LastActivityDate="2017-10-24T09:59:11.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22364" PostTypeId="2" ParentId="22356" CreationDate="2017-10-13T14:03:27.247" Score="1" Body="&lt;p&gt;This was an email template problem. While the template loaded fine in a browser, it was failing when being sent by Craft Commerce on a status update. The only clue was when manually updating a status in the control panel and receiving a Javascript alert saying 'Undefined'. Nothing in any logs. I feel quite fortunate to have happened to have stumbled across the solution with only a day's work.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-01-19T11:00:52.187" LastActivityDate="2018-01-19T11:00:52.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22366" PostTypeId="2" ParentId="22351" CreationDate="2017-10-13T15:08:37.267" Score="6" Body="&lt;p&gt;Your code is correct but you need to add another line near the top:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[volunteerPositions]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the &lt;a href=&quot;https://craftcms.com/docs/checkboxes-fields#templating&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you are including a Checkboxes field on a front-end entry from, make sure to include a hidden input before the checkboxes, so that an empty value is submitted if no checkboxes are checked.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-10-13T15:08:37.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22367" PostTypeId="2" ParentId="22348" CreationDate="2017-10-13T16:26:43.997" Score="2" Body="&lt;p&gt;Found this nugget about &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#iterating-over-a-subset&quot; rel=&quot;nofollow noreferrer&quot;&gt;Iterating over a Subset&lt;/a&gt; in the Twig docs about slice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for client in clients|slice(0, 8) %}&#xA;    ... &#xA;{% endfor %}&#xA;&#xA;{% for client in clients|slice(8) %}&#xA;      ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details about &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;slice&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-10-13T16:26:43.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22368" PostTypeId="2" ParentId="21929" CreationDate="2017-10-13T17:09:32.817" Score="2" Body="&lt;p&gt;This still appears to be an issue with checkboxes on Freeform Craft 1.6.2. The mailing list checkbox is repopulating as expected but the checkbox field is not repopulating in a multi-step form after submitting and going back. All fields have a value of 1.&lt;/p&gt;&#xA;" OwnerUserId="4794" LastActivityDate="2017-10-13T17:09:32.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22369" PostTypeId="1" CreationDate="2017-10-13T17:12:28.950" Score="2" ViewCount="734" Body="&lt;p&gt;I know if I turn off Purify HTML I might be able to get anchors working in Redactor rich text fields, but I want the ole client to be able to insert anchor links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does a plugin for this exist, or is it possible to make an 'insert anchor' button on my own easily?&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="57" LastEditDate="2017-10-13T22:37:02.813" LastActivityDate="2017-10-13T22:37:02.813" Title="Can you add anchors in redactor?" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22370" PostTypeId="1" CreationDate="2017-10-13T18:43:09.120" Score="1" ViewCount="399" Body="&lt;p&gt;I'm trying to build an accordion in my matrix field (that also holds entries for a slideshow, button, image, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im having trouble with getting each entry to go inside &lt;strong&gt;&amp;lt; div id=&quot;accordion&quot;&gt;&amp;lt; /div&gt;&lt;/strong&gt; and not repeat this accordion div over and over.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% elseif block.type == &quot;sectionaccordion&quot; %}&#xA;&#xA;    &amp;lt;div id=&quot;accordion&quot;&amp;gt;&#xA;      {% for block in entry.sectionaccordion %}&#xA;        &amp;lt;div class=&quot;accordiontitle&quot;&amp;gt;{{ block.accordionTitle }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;accordion-content default&quot;&amp;gt;&#xA;          {{ block.accordionText }}&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this setup, I keep getting &lt;em&gt;Craft\EntryModel and its behaviors do not have a method or closure named &quot;sectionaccordion&quot;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vd725.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vd725.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="7327" LastEditDate="2017-10-13T19:50:21.280" LastActivityDate="2017-10-13T20:50:46.143" Title="Building an accordion with a Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22371" PostTypeId="2" ParentId="22369" CreationDate="2017-10-13T20:36:15.510" Score="2" Body="&lt;p&gt;I ended up getting this great plugin called Redactor Extras&#xA;&lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installed easily, and it has a properties option that it adds to rich text fields that lets you add a class or id to a piece of text. I just add id=something and then link to #something. Works like a charm for adding anchors!&lt;/p&gt;&#xA;" OwnerUserId="7327" LastActivityDate="2017-10-13T20:36:15.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22372" PostTypeId="2" ParentId="22370" CreationDate="2017-10-13T20:50:46.143" Score="3" Body="&lt;p&gt;The error has to do with the line &lt;code&gt;{% for block in entry.sectionaccordion %}&lt;/code&gt; because it's looking for a field in your entry called &lt;code&gt;sectionaccordion&lt;/code&gt; but &lt;code&gt;sectionaccordion&lt;/code&gt; is not a field; it's a block &lt;em&gt;inside&lt;/em&gt; a field (your matrix field).  So the error is basically saying &quot;there is no field called 'sectionaccordion' for this entry&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also don't want to use a &lt;code&gt;for&lt;/code&gt; loop here because there's nothing to loop through.  You're already looping through matrix blocks created in this matrix field, and your code is saying &quot;if the block is of type &lt;code&gt;sectionaccordion&lt;/code&gt;, print the contents of it.&quot;  The contents of that block won't be another loop; it'll only be 1 Accordion Title and 1 Accordion Text field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, by saying &lt;code&gt;{% elseif block.type == &quot;sectionaccordion&quot; %}&lt;/code&gt;, you are eliminating the chance to display a slideshow since that is a different block type, one not called &lt;code&gt;sectionaccordion&lt;/code&gt;.  If you want a slideshow inside your accordion block type, then you need to create a 3rd field for it inside &lt;code&gt;sectionaccordion&lt;/code&gt; and just recreate whatever you did in the &lt;code&gt;sectionslideshow&lt;/code&gt; block type.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-10-13T20:50:46.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22373" PostTypeId="1" AcceptedAnswerId="22472" CreationDate="2017-10-13T21:15:59.803" Score="3" ViewCount="1925" Body="&lt;p&gt;Just as the title indicates, I'm looking for a way to customize the email template of the &quot;click here to activate your account&quot; email that is sent to users when they register. I would also like to know if its possible and how to do this with other system email templates, such as the reset password link email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;I see you can edit the plain text emails at &lt;code&gt;Settings &amp;gt; Email &amp;gt; Messages&lt;/code&gt; however I would like to be able to define a twig template to handle creating HTML versions of these.&lt;/p&gt;&#xA;" OwnerUserId="6309" LastEditorUserId="6309" LastEditDate="2017-10-13T21:21:42.403" LastActivityDate="2019-09-04T13:56:10.043" Title="Customize activation and other system emails" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22375" PostTypeId="1" AcceptedAnswerId="22376" CreationDate="2017-10-14T00:43:42.260" Score="1" ViewCount="227" Body="&lt;p&gt;I'm trying to loop through two separate channels, but combined together. And then just check which channel the entry belongs to in the loop to display it correctly. This is how I had it done in EE, but I can't seem to find a way with Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{exp:channel:entries channel=&quot;press|in-the-press&quot; orderby=&quot;date&quot; dynamic=&quot;no&quot; limit=&quot;10&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="333" LastActivityDate="2017-10-14T01:15:34.267" Title="How do I loop through two sections as one set" Tags="&lt;entries&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22376" PostTypeId="2" ParentId="22375" CreationDate="2017-10-14T01:15:34.267" Score="3" Body="&lt;p&gt;According to the Craft docs, the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#section&quot; rel=&quot;nofollow noreferrer&quot;&gt;section parameter&lt;/a&gt; takes a &quot;section handle, an array of section handles, or a SectionModel object&quot;. So this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(['press', 'in-the-press']).limit(10) %}&#xA;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2017-10-14T01:15:34.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22377" PostTypeId="2" ParentId="22373" CreationDate="2017-10-14T02:16:45.273" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I see you can edit the plain text emails at Settings &gt; Email &gt; Messages however I would like to be able to define a twig template to handle creating HTML versions of these.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Currently not possible natively, but there is a feature request you might want to add a thumbs-up/comment to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1020&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1020&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-14T02:16:45.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22378" PostTypeId="1" CreationDate="2017-10-14T08:29:11.517" Score="1" ViewCount="38" Body="&lt;p&gt;Without going into too much detail, I have a plugin where I'm trying to manage two different sets of tabs with some custom javascript. When the object initializes, I need to add a &lt;code&gt;pane&lt;/code&gt; from the page layout to the object. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.$pane = new Craft.Pane($(&quot;.pane&quot;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That line of code kinda works. However, when the page loads the console reports:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Double-instantiating a pane on an element&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the above line of code &lt;code&gt;this.$pane = new Craft.Pane($(&quot;.pane&quot;));&lt;/code&gt;, the console log message goes away. With the line of code some things work. Without the line of code other things work. I need all the things to work at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to know the right question to ask, so please point me in the right direction if I am off the mark. &lt;strong&gt;Is it possible to check if there is an existing &lt;code&gt;Craft.Pane&lt;/code&gt; object that exists before I try to create a &lt;code&gt;new Craft.Pane&lt;/code&gt; object?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-10-16T00:44:29.807" Title="How to avoid &quot;Double-instantiating a pane on an element&quot;" Tags="&lt;plugin-development&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22379" PostTypeId="1" AcceptedAnswerId="22380" CreationDate="2017-10-14T16:55:39.160" Score="1" ViewCount="106" Body="&lt;p&gt;My payment page form works just fine with the dummy gateway, but once I change it to use my authorize.net gateway it says that the CSRF token isn't verified. The code below isn't complete, but I figured maybe there is something in this part that is causing it? Any ideas would be great, thanks!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;flex-container flex-center flex-col nav-buttons flex-lg&quot; method=&quot;POST&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/store/customer/order?number={number}&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/store/checkout/payment&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;paymentMethodId&quot; value=&quot;1&quot;/&amp;gt;&#xA;&#xA;{% set formValues = {&#xA;    firstName: paymentForm is defined ? paymentForm.firstName : (cart.billingAddress ? cart.billingAddress.firstName : ''),&#xA;    lastName: paymentForm is defined ? paymentForm.lastName : (cart.billingAddress ? cart.billingAddress.lastName : ''),&#xA;    number: paymentForm is defined ? paymentForm.number : '',&#xA;    cvv: paymentForm is defined ? paymentForm.cvv : '',&#xA;    month: paymentForm is defined ? paymentForm.month : 1,&#xA;    year: paymentForm is defined ? paymentForm.year : (currentYear +1),&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-10-14T17:01:09.070" Title="CSRF Token not verified with actual gateway in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;payment-methods&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22380" PostTypeId="2" ParentId="22379" CreationDate="2017-10-14T17:01:09.070" Score="2" Body="&lt;p&gt;Welp... I feel like an idiot. It wouldn't let it through because I didn't set the endpoints found at &lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-gateways&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-10-14T17:01:09.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22381" PostTypeId="2" ParentId="22357" CreationDate="2017-10-14T18:49:28.533" Score="2" Body="&lt;p&gt;Moving a folder is a pretty complex operation. You have to move all the files contained in the folder, all of the subfolders and all of the files contained in the subfolders. Another thing to consider is that a move is essentially a copy+delete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how Assets goes about all of this is that firstly it mirrors the subfolder structure to be moved in the target destination. It then moves the files one by one. After that, it deletes all of the old folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dividing the operation into many steps accomplishes several things:&#xA;1) It allows for displaying the progress bar.&#xA;2) It divides the processing time and memory needed across multiple requests, helping prevent timeouts&#xA;3) If the user closes the browser window, there is at least fault tolerance and no files are lost - you just get duplicates of some files and you can retry the same operation using &quot;replace&quot; instead of trying to figure out which files were moved and which were not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the folder ID changes, because it's not the same folder anymore. Theoretically, it would be possible to manually adjust the folder IDs afterwards so that they remain unchanged, but I don't think that's a good precedent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could argue that folder IDs are a Craft internal thing and relying on them is not encouraged, however, I would just offer a better solution UX wise - just use an Asset source type drop down selector and a text box for the relative path. Not only it would be less amibigious than a magical ID, it would also be more consistent with user experience of addressing folders while also pointing to a specific spot, instead of an entity, which is definitely better for long-term maintenance.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="57" LastEditDate="2017-10-15T01:01:39.853" LastActivityDate="2017-10-15T01:01:39.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22382" PostTypeId="1" AcceptedAnswerId="22399" CreationDate="2017-10-14T19:31:07.560" Score="1" ViewCount="1072" Body="&lt;p&gt;I'm currently trying to filter my search results by category, I've been following &lt;a href=&quot;https://craftcookbook.net/recipes/universal-category-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt; but cannot get it to work. It keeps not adding on the category parameter, but instead just replaces the search parameter like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On search:&lt;/strong&gt;&#xA;&quot;/search/?q=dress&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On Clicking a Filter:&lt;/strong&gt;&#xA;&quot;/search/?category=wedges&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code running my search box:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;search-box w-form&quot;&amp;gt;&#xA;  &amp;lt;form action=&quot;search/&quot; class=&quot;form&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; class=&quot;text-field w-input&quot; maxlength=&quot;256&quot; type=&quot;search&quot; autofocus=&quot;true&quot; name=&quot;q&quot; data-name=&quot;Name&quot; placeholder=&quot;e.g. Black Dress&quot; id=&quot;name&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; data-wait=&quot;Please wait...&quot; class=&quot;search-field-go w-button&quot; value=&quot;&quot;&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the code running the results page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% if craft.request.getParam('category') is not null %}&#xA;    {% set category = craft.categories.slug(craft.request.getParam('category')) %}&#xA;    {% set entries = craft.entries.search(query).order('score').relatedTo(category).find() %}&#xA;{% else %}&#xA;    {% set entries = craft.entries.search(query).order('score') %}&#xA;{% endif %}&#xA;&#xA;{% include 'search/_filters' %}&#xA;&#xA;&amp;lt;!-- SEARCH CONTAINER --&amp;gt;&#xA;&#xA;{% if entries|length %}&#xA;    &amp;lt;p&amp;gt;{{ entries|length }} results:&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;   {% for category in craft.categories.group('womens').find() %}&#xA;    &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{craft.request.url}}/?category={{ category.slug }}&quot;&amp;gt;{{ category.title}} &amp;lt;/a&amp;gt;&#xA;         &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2017-10-16T13:14:30.543" Title="Filtering Search Results by Category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;search&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22384" PostTypeId="1" AcceptedAnswerId="22385" CreationDate="2017-10-15T05:23:43.290" Score="1" ViewCount="97" Body="&lt;p&gt;I’ve got a &lt;code&gt;people&lt;/code&gt; entry type that has a &lt;code&gt;peopleCategory&lt;/code&gt; multiselect field. I’m wanting to loop through all the people and grab the ones that have a a specific item selected in the multiselect field (in this case - that they have been marked as being in 'leadership'). I was using   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section(‘People’).peopleCategory(‘leadership’) %}&#xA;    {% if entry.peopleCategory.contains('leadership') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but in conjunction with another if statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index==1 %}&#xA;{% elseif loop.index==2 %} &#xA;{% elseif loop.index==3 %} &#xA;etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that ended up throwing off the formatting in the template  - so now I’m tyring to find a new solution using something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set leadershipTeamTest = allPeople.peopleCategory('leadership').peopleCategory('leadership') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allPeople = craft.entries.section('People') %}&#xA;{% set leadershipTeam = allPeople.peopleCategory('leadership').peopleCategory.contains('leadership') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but having trouble where it’s either returning everyone, or no one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still a pretty new to Craft - but would appreciate any help ( was using this - &lt;a href=&quot;https://craftcms.com/docs/multi-select-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/multi-select-fields&lt;/a&gt; but couldnt get it going)&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="57" LastEditDate="2017-10-16T19:49:51.390" LastActivityDate="2017-10-16T19:50:01.563" Title="Looping through Entries based on MultiSelect Field Selection" Tags="&lt;forloop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22385" PostTypeId="2" ParentId="22384" CreationDate="2017-10-15T05:39:09.000" Score="1" Body="&lt;p&gt;Pretty straight forward in the end =]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allPeople = craft.entries.section('People') %}     &#xA;{% for entry in allPeople if entry.peopleCategory.contains('leadership') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="57" LastEditDate="2017-10-16T19:50:01.563" LastActivityDate="2017-10-16T19:50:01.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22386" PostTypeId="2" ParentId="22352" CreationDate="2017-10-15T07:37:46.497" Score="2" Body="&lt;p&gt;I was able to fix the issue - it had to do with the URL structure I had set in the Section's URL format area. For nested entries, I had put {parent-uri}/{slug} when in fact it needed to be {parent.uri}/{slug}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can now assign parents to entries and this is reflected in the URLs on the front end.&lt;/p&gt;&#xA;" OwnerUserId="7382" LastActivityDate="2017-10-15T07:37:46.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22387" PostTypeId="1" CreationDate="2017-10-15T08:15:26.963" Score="1" ViewCount="463" Body="&lt;p&gt;This is a follow-up to an earlier question from 2014: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1400/pt-contact-form-plugin-how-can-i-copy-name-and-email-address-in-the-body-o&quot;&gt;P&amp;amp;T Contact Form plugin: How can I copy “name” and “email address” in the body of the mail?&lt;/a&gt; ... it seems that Craft (and the plugin) has gone through significant updates since that question was answered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I include &lt;code&gt;fromName&lt;/code&gt; and &lt;code&gt;fromEmail&lt;/code&gt; into the body of the message?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read about events in the documentation, but it doesn't say where they go. Do I put those into the craft&gt;config&gt;contactform.php file? How would I setup an event to handle that inclusion?&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-10-16T06:08:13.573" Title="Contact Form: Name and Email in Message Body" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22388" PostTypeId="2" ParentId="22378" CreationDate="2017-10-16T00:44:29.807" Score="1" Body="&lt;p&gt;I was able to resolve this by testing to see if the pane existed before re-instantiating the element. Happy to consider another answer if someone can explain what is going on better. For now, the following worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Check to see if an element was already registered as a `Craft.Pane`:&#xA;if (!$(&quot;#myelement.pane&quot;).data('pane'))&#xA;{&#xA;    // Create a pane object if it is not&#xA;    this.$pane = new Craft.Pane($(&quot;#myelement.pane&quot;));&#xA;}&#xA;else&#xA;{&#xA;    // Use the existing pane object if it exists&#xA;    this.$pane = $(&quot;#myelement.pane&quot;).data('pane');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-10-16T00:44:29.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22389" PostTypeId="1" CreationDate="2017-10-16T01:05:06.700" Score="1" ViewCount="101" Body="&lt;p&gt;I have a site which has 100's of pending &quot;Deleting oldest 404 redirects&quot; tasks and they keep stalling so the list isn't clearing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client has added lots of custom rules to the &lt;code&gt;.htaccess&lt;/code&gt; which I will need to investigate, could this be the cause?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can remove all the pending/stalled tasks manually?&lt;/p&gt;&#xA;" OwnerUserId="6806" LastEditorUserId="57" LastEditDate="2017-10-16T20:05:23.733" LastActivityDate="2017-10-16T20:05:23.733" Title="Deleting oldest 404 redirects task stalling" Tags="&lt;404&gt;&lt;tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22390" PostTypeId="2" ParentId="22389" CreationDate="2017-10-16T01:12:50.443" Score="1" Body="&lt;p&gt;I found the table 'craft_tasks' in the database, there were actually over 5,000 tasks in here all run by Sprout Seo. I emptied the table which has cleared the tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will need to look into why these tasks are not running correctly on the clients server.&lt;/p&gt;&#xA;" OwnerUserId="6806" LastActivityDate="2017-10-16T01:12:50.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22392" PostTypeId="2" ParentId="22387" CreationDate="2017-10-16T06:08:13.573" Score="2" Body="&lt;p&gt;I figured it out by duplicating the field...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; &#xA;value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;{{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;fullName&quot; name=&quot;message[Full Name]&quot; class=&quot;fullName&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then duplicating the single entry to the hidden with some Javascript...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $('#fromName').bind('keypress keyup blur', function() {&#xA;      $('#fullName').val($(this).val());&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It parses through to the email message as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full Name: First Last&lt;/p&gt;&#xA;" OwnerUserId="7190" LastActivityDate="2017-10-16T06:08:13.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22393" PostTypeId="1" CreationDate="2017-10-16T06:58:32.017" Score="2" ViewCount="473" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://solspace.com/craft/freeform/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform&lt;/a&gt; for a fairly large form. I'm trying to use a combination of the form builder (Composer) feature and custom HTML and I'm not sure it's possible! I'll give you the scenario and you can tell me if I need to write it &lt;em&gt;all&lt;/em&gt; without the Composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the desired layout I have in the form builder but I need to wrap some field rows (in a &lt;code&gt;&amp;lt;fieldset&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; so I can hide them (so I can show them when certain radios are checked).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see how I can add this to the middle of the &lt;code&gt;{% for row in form %}&lt;/code&gt; loop as there will be 10+ rows that need wrapping, including custom HTML field for the legend. i.e. there is no grouping mechanism I can check against that I can see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to hear any suggestions so I can still leverage &lt;em&gt;some&lt;/em&gt; of the form builder :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="4823" LastEditDate="2017-10-16T22:54:56.317" LastActivityDate="2017-10-17T12:33:10.920" Title="Freeform - Grouping fields from the form builder" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22394" PostTypeId="1" AcceptedAnswerId="23550" CreationDate="2017-10-16T09:33:20.443" Score="1" ViewCount="64" Body="&lt;p&gt;If anyone else is using Worldpay with Craft Commerce (am starting to feel like I'm one of a very small number), do you have order refund functionality? As in, the Refund button that exists on the order page with the control panel.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-01-19T11:00:11.793" Title="Does Craft Commerce support Worldpay refunds?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22395" PostTypeId="1" AcceptedAnswerId="22409" CreationDate="2017-10-16T10:19:00.303" Score="1" ViewCount="418" Body="&lt;p&gt;I have a Craft CMS powered site which has &amp;quot;Suppliers&amp;quot; set up as a user group. A route is being used to link through to these suppliers on the frontend; example.com/supplier/loremipsum.&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to add an option to the link button on the Rich editor field, that would allow me to choose a user from the &lt;em&gt;supplier&lt;/em&gt; user group? Much like the &amp;quot;Link to an entry&amp;quot; option.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HRP6m.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HRP6m.jpg&quot; alt=&quot;Link to an entry&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7394" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-16T22:56:53.973" Title="Adding link type to Redactor Rich Editor" Tags="&lt;redactor&gt;&lt;richtext&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22396" PostTypeId="1" AcceptedAnswerId="22397" CreationDate="2017-10-16T11:16:33.073" Score="2" ViewCount="151" Body="&lt;p&gt;I'm created an Index like page (like at the back of a book) for entries within a certain section, ordered alphabetically with the letter proceeding it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code below seems like a tedious way to do it, is their an easier way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I handle the entries with a number as the first character (0-9) of the title?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     &amp;lt;h2&amp;gt;A&amp;lt;/h2&amp;gt;&#xA;&#xA;     &amp;lt;ul class=&quot;sub-nav&quot;&amp;gt;&#xA;      {% for entry in craft.entries.section('artists').search('title::A*').order('title').find() %}&#xA;        &amp;lt;li&amp;gt;...&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;h2&amp;gt;B&amp;lt;/h2&amp;gt;&#xA;&#xA;     &amp;lt;ul class=&quot;sub-nav&quot;&amp;gt;&#xA;      {% for entry in craft.entries.section('artists').search('title::B*').order('title').find() %}&#xA;        &amp;lt;li&amp;gt;...&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;h2&amp;gt;C&amp;lt;/h2&amp;gt;&#xA;&#xA;     &amp;lt;ul class=&quot;sub-nav&quot;&amp;gt;&#xA;      {% for entry in craft.entries.section('artists').search('title::C*').order('title').find() %}&#xA;        &amp;lt;li&amp;gt;...&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2017-10-16T12:57:10.367" Title="Creating a sitemap/index page, ordered by A-Z and 0-9" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22397" PostTypeId="2" ParentId="22396" CreationDate="2017-10-16T12:57:10.367" Score="4" Body="&lt;p&gt;The way to do this is with the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group&lt;/a&gt; filter. You want to group the entries by the first character of the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get the entries as an actual array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('artists').order('title').find %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Group them by first letter of title. &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/first.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;first&lt;/a&gt; will return the first character of a string. &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/upper.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;upper&lt;/a&gt; converts a string to uppercase.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEntries = allEntries|group('title|first|upper') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can loop through them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for index, values in groupedEntries %}&#xA;  &amp;lt;h2&amp;gt;{{index}}&amp;lt;/h2&amp;gt;&#xA;  &amp;lt;ul class=&quot;sub-nav&quot;&amp;gt;&#xA;    {% for e in values %}&#xA;      &amp;lt;li&amp;gt;...{{e}}...&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5404/how-can-i-group-a-list-of-tags-into-ranges-of-first-letters-a-e-f-j-etc&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-16T12:57:10.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22398" PostTypeId="1" CreationDate="2017-10-16T13:02:56.103" Score="1" ViewCount="1128" Body="&lt;p&gt;So I've been following the &lt;a href=&quot;https://craftcms.com/docs/templating/search-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; on how to create a search form in Craft and it works fine. But instead of having a results.twig page I would like to have just one index page and get all the results with AJAX. Is there a simple way to accomplish this in Craft? And if so, does anyone have an example?&lt;/p&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2017-10-16T23:23:04.903" Title="Simple AJAX search form" Tags="&lt;search&gt;&lt;ajax&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22399" PostTypeId="2" ParentId="22382" CreationDate="2017-10-16T13:14:30.543" Score="2" Body="&lt;p&gt;In this line here (reformatted for legibilty):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{craft.request.url}}/?category={{ category.slug }}&quot;&amp;gt;&#xA;  {{ category.title}}&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You are generating the url by from &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#getUrl&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.request.url&lt;/a&gt; and appending the category. But the original query is not part of the url at this point. I think this will work and be clearer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url(craft.request.path, {q: query, category: category.slug}) }}&quot;&amp;gt;&#xA;  {{ category.title}}&#xA;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This uses the &lt;a href=&quot;https://craftcms.com/docs/templating/functions#url&quot; rel=&quot;nofollow noreferrer&quot;&gt;url&lt;/a&gt; function, passing it the query string parameters.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2017-10-16T13:14:30.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22400" PostTypeId="1" AcceptedAnswerId="22410" CreationDate="2017-10-16T14:15:23.043" Score="2" ViewCount="216" Body="&lt;p&gt;I'd like to display the last 4 digits of the credit card used for a purchase in a front-end template. It appears the data is in the db in the &lt;code&gt;craft_commerce_transactions&lt;/code&gt; table &lt;code&gt;reference&lt;/code&gt; column in JSON format.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;approvalCode&quot;:&quot;PNRABL&quot;,&#xA;    &quot;transId&quot;:&quot;60007205645&quot;,&#xA;    &quot;card&quot;: {&#xA;        &quot;number&quot;:&quot;1234&quot;,&#xA;        &quot;expiry&quot;:&quot;112318&quot;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a method supported by Craft Commerce to display this data in a users account area?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-10-17T01:50:33.027" LastActivityDate="2017-10-17T01:50:33.027" Title="How to display the last 4 digits of the credit card used for a Craft Commerce purchase" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22401" PostTypeId="1" AcceptedAnswerId="22402" CreationDate="2017-10-16T14:26:36.600" Score="1" ViewCount="46" Body="&lt;p&gt;I have a basic login form that's talking to a separate server that's out of my immediate control. I'm trying to read the responses it's sending in the URL within the Craft template.&#xA;For example...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.adacore.com/login?login=incorrect&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've only ever done it before in PHP. Is it possible with Craft/Twig to access these variables directly? Or should I just read the &lt;code&gt;craft.request.queryString&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And change the template accordingly as needed.&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2017-10-16T23:24:21.913" Title="How to read form response URL variables in template?" Tags="&lt;form&gt;&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22402" PostTypeId="2" ParentId="22401" CreationDate="2017-10-16T14:42:44.207" Score="2" Body="&lt;p&gt;I'd go with the built in craft functions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getQuery('login')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.request documentation here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7318" LastEditorUserId="57" LastEditDate="2017-10-16T23:24:21.913" LastActivityDate="2017-10-16T23:24:21.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22404" PostTypeId="1" AcceptedAnswerId="22419" CreationDate="2017-10-16T15:09:46.773" Score="0" ViewCount="356" Body="&lt;p&gt;I've got a question that I can't seem to get fixed all by myself... I've got a search form and each entry has got field with some checkboxes (in this case these are options). Now I'd like to search when they check multiple checkboxes but I can't seem to get that to work...&#xA;I've set up a form in which I'm fetching a parameter and just to test it with 2 checkboxes checked I've split them up in 'week1' and 'week2' like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set week_search_query =  week1 ~ ' ' ~ week2  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried the same with 'and' and '&amp;amp;' in between the quotes but can't seem to get it to work, while with the 'week1' alone like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set week_search_query =  week1 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it works perfectly. (if I print out the content of 'week_search_query' in this case I get &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;weken2017:41&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;with weken2017 as fieldname and 41 as value). &#xA;But what I'd like to to is search by 2 checked checkboxes at once as in the first example, so I can:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.search(week_search_query)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All help is welcome, I feel like quite a newbie ATM :-)&lt;/p&gt;&#xA;" OwnerUserId="4934" LastEditorUserId="4934" LastEditDate="2017-10-17T12:01:56.183" LastActivityDate="2017-10-18T08:28:05.483" Title="Searching on multiple checkboxes" Tags="&lt;search&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22405" PostTypeId="2" ParentId="22398" CreationDate="2017-10-16T15:22:14.070" Score="2" Body="&lt;p&gt;You can create your own search...&#xA;lets say this is your html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;input&quot; id=&quot;searchTags&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;button&quot; id=&quot;startSearch&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;div id=&quot;results&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you have the following script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#startSearch&quot;).click(function(){&#xA;    var data = {&#xA;        action: 'pluginhandle/controller/searchEntries',&#xA;        options: $(&quot;#searchTags&quot;).val()&#xA;    };&#xA;    $.ajax({&#xA;       type: &quot;post&quot;,&#xA;       url: '/',&#xA;       data: data,&#xA;       success: function(response){&#xA;       // replace content from $(&quot;#results&quot;) with your new html&#xA;       },&#xA;    ....&#xA;   });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your controller would look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSearchEntry(){ &#xA;     $criteria = new ElementCriteriaModel(ElementType::Entry);     &#xA;     // build your criteriaModel based on your needs&#xA;     $html = $this-&amp;gt;renderTemplate('results.twig', array(&#xA;         'entries' =&amp;gt; $criteria-&amp;gt;find()&#xA;     ));&#xA;     return $this-&amp;gt;returnJson($html);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;your results.twig would be like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries is defined and entries|length %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2017-10-16T23:23:04.903" LastActivityDate="2017-10-16T23:23:04.903" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22406" PostTypeId="1" CreationDate="2017-10-16T16:03:21.047" Score="1" ViewCount="19" Body="&lt;p&gt;I'm making a website where the 1st submit of the form needs to be sent to 6 people on a list, the second submit of that same form needs to be send to the next 6 persons on the list, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also would like to store the number of form submits every person in the list has received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if this is feasible with the Contact Form plugin.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="57" LastEditDate="2017-10-16T23:27:13.137" LastActivityDate="2017-11-15T23:42:48.887" Title="How to configure Craft From for a form roulet/carousel?" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22407" PostTypeId="1" AcceptedAnswerId="22422" CreationDate="2017-10-16T16:21:14.623" Score="2" ViewCount="104" Body="&lt;p&gt;I'm trying to use Paypal Express with Craft Commerce. &#xA;It sends us Paypal's login page correctly, with the right amounts, but when you click pay it returns us to this URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/index.php/actions/commerce/payments/completePayment?commerceTransactionId=43&amp;amp;commerceTransactionHash=cbcad33abe2cf99ea63c8ee49c0ee9af&amp;amp;token=EC-0N649078HJ025430W&amp;amp;PayerID=VAWBVKWL78DHN&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but shows a 404 error with no other errors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using the show errors code mentioned in this post: &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19090/handoff-to-paypal-express-with-craft-commerce&quot;&gt;Handoff to Paypal Express with Craft Commerce&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I've tried it with Stripe which fully works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no log error logs in PHP or Craft's logs, just a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried changing different products, different shipping types, I've uninstalled all other plugins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just fails with Paypal, and works with Stripe. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7397" LastEditorUserId="57" LastEditDate="2017-10-16T23:34:11.737" LastActivityDate="2017-10-17T12:04:17.697" Title="Paypal Express shows a 404 error when returning to Commerce's completePayment endpoint" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22408" PostTypeId="2" ParentId="20697" CreationDate="2017-10-16T21:08:16.477" Score="1" Body="&lt;p&gt;Just to follow up on this, we created a plugin that adds email addresses (+ First &amp;amp; Last Name) to a MailChimp list whenever the user starts the process of an order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/madebyshape/mailchimp-commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/madebyshape/mailchimp-commerce&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-10-16T21:08:16.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22409" PostTypeId="2" ParentId="22395" CreationDate="2017-10-16T22:56:53.973" Score="0" Body="&lt;p&gt;You could do this with a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that used the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#addRichTextLinkOptions&quot; rel=&quot;nofollow noreferrer&quot;&gt;addRichTextLinkOptions&lt;/a&gt; to add extra options to that dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; to generate boilerplate plugin code to get you up and running quickly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-16T22:56:53.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22410" PostTypeId="2" ParentId="22400" CreationDate="2017-10-16T23:20:16.797" Score="1" Body="&lt;p&gt;I'm not sure whether you're referring to displaying this in the Control Panel somewhere or on the front-end of a site in a user account area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming it's on the front-end of a site and you've already got a reference to the order, it'd be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab an order #}&#xA;{% set order = craft.commerce.orders.id(15).first() %}&#xA;&#xA;{% if order %}&#xA;    {% Grab all of it's transactions %}&#xA;    {% set transactions = order.getTransactions() %}&#xA;&#xA;    {# Loop through all of them looking for the one(s) you're interested in on this order.  Here, we just grab the first. #}&#xA;    {% set transaction = transactions[0] %}&#xA;&#xA;    {# Output the reference #}&#xA;    {{ transaction.reference }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that the reference value is a response that comes back directly from the particular payment gateway, so it may or may not even be JSON, much less include the last 4 digits of a credit card number.  If it is JSON, XML, etc. then you'll need to parse that value looking for where they save the last 4 digits.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-10-16T23:25:46.060" LastActivityDate="2017-10-16T23:25:46.060" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22411" PostTypeId="2" ParentId="22406" CreationDate="2017-10-16T23:31:58.210" Score="1" Body="&lt;p&gt;It's not natively possible, but it's doable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin does support &lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic recipients&lt;/a&gt;.  I'm assuming that the rotating list of people is going to be stored in a database table or some other data source, though.  So in order to pull in the next correct group of people to send to, you'd need to write a &lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; so you could run your own business logic.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I also would like to store the number of form submits every person in the list has received.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When grabbing the next group of people to send to, your plugin would increment a tally for each of the people in the list and save it back out to a database table or other data store.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-16T23:31:58.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22412" PostTypeId="2" ParentId="22400" CreationDate="2017-10-17T00:57:54.633" Score="1" Body="&lt;p&gt;An alternate approach to Brad's would be to save the four digits to a field on the order at the time of the transaction...would make for easier retrieval later.  We do this with a fraud score our one of our gateways gives us... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Save the Beagle Anti-Fraud Score to the order&#xA;    craft()-&amp;gt;on('commerce_transactions.onSaveTransaction', function ($event)&#xA;    {&#xA;&#xA;            $transaction = $event-&amp;gt;params['transaction'];&#xA;            $order = $transaction-&amp;gt;order;&#xA;&#xA;            // Transactions are saved before responses too....&#xA;            if($transaction-&amp;gt;response){&#xA;                BusinessLogicPlugin::log($transaction-&amp;gt;response);&#xA;&#xA;                if (array_key_exists(&quot;BeagleScore&quot;,$transaction-&amp;gt;response)){&#xA;                    $score = (string) $transaction-&amp;gt;response['BeagleScore'];&#xA;                    BusinessLogicPlugin::log(&quot;Beagle score found: $score&quot;);&#xA;                    $order-&amp;gt;setContentFromPost([&quot;beagleScore&quot;=&amp;gt;$score]);&#xA;                    craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order);&#xA;                }&#xA;            }&#xA;     });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-10-17T00:57:54.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22413" PostTypeId="1" CreationDate="2017-10-17T02:30:57.957" Score="2" ViewCount="630" Body="&lt;p&gt;I'm using the table function built into Redactor, and all my tables are coming out with the minimum width possible, without any padding between columns. How do I modify how Redactor builds its tables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XX4nj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XX4nj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="57" LastEditDate="2017-10-17T17:41:23.487" LastActivityDate="2017-10-18T12:29:08.673" Title="Is there a better way to make tables in Craft?" Tags="&lt;redactor&gt;&lt;table&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22414" PostTypeId="2" ParentId="22413" CreationDate="2017-10-17T03:04:07.207" Score="4" Body="&lt;p&gt;I'd use a &lt;a href=&quot;https://craftcms.com/docs/table-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Table&lt;/a&gt; or &lt;a href=&quot;https://github.com/engram-design/SuperTable&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt; field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want to stick to a Redactor Rich Text field, put a wrapper &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; around the &lt;code&gt;{{ entry.redactorField }}&lt;/code&gt; Twig markup, and use CSS to style the table ala &lt;code&gt;.myRedactorWrapper th&lt;/code&gt; etc.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-17T03:04:07.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22415" PostTypeId="2" ParentId="22393" CreationDate="2017-10-17T03:26:13.263" Score="1" Body="&lt;p&gt;It sounds like what you would ultimately need here is some sort of grouping of fields feature, which Freeform currently does not have. So I would lean towards saying there isn't a way you can do this purely in Composer, unless of course you had a very stripped down Formatting template, and relied heavily on HTML blocks inside Composer to simulate what you're after. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-10-17T03:26:13.263" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22416" PostTypeId="2" ParentId="22393" CreationDate="2017-10-17T07:33:59.697" Score="0" Body="&lt;p&gt;Not very proud of my way of approaching it, but I had similar requirements and what I ended up with is a bunch of arrays that I define in the template before looping through the form’s rows and fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those arrays are simple key-value pairs, where I map values for field group headings, JavaScript hooks for conditional fields, rules for frontend validation to a key that’s composed from the form handle and field handle. Basically allows me to conditionally modify my markup for each individual field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic forms can still be setup with the Composer alone, but to enhanced in this fashion we need to write code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupHeadings = {&#xA;    offerBav_employerName: 'foo',&#xA;    offerBav_titles: 'bar',&#xA;    contact_titles: 'bar',&#xA;    contact_message: 'baz',&#xA;} %}&#xA;&#xA;{% set validationRulesMap = {&#xA;    email: 'email',&#xA;    birthday: 'date_format:DD.MM.YYYY',&#xA;    employerZip: 'digits:5',&#xA;    inceptionDate: 'date_format:MM.YYYY',&#xA;} %}&#xA;&#xA;{% for row in form %}&#xA;    {% for field in row %}&#xA;        {% set handle = form.handle ~ '_' ~ field.handle %}&#xA;&#xA;        {% if handle in groupHeadings|keys %}&#xA;            &amp;lt;h3 class=&quot;c-form__subheading&quot;&amp;gt;{{ groupHeadings[handle] }}&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {#&#xA;         # Output fields with JavaScript hooks&#xA;         # and dynamically generated classes.&#xA;         #}&#xA;    {% endfor %}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-10-17T12:33:10.920" LastActivityDate="2017-10-17T12:33:10.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22417" PostTypeId="1" CreationDate="2017-10-17T07:57:01.553" Score="1" ViewCount="1002" Body="&lt;p&gt;I'am writing a plugin that has to return an array of data, however Twig does not seem to accept it if I return a PHP array.  I don't want to use an explode in Twig to make it into an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen in other plugins i can just call a function from twig like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set result = craft.winkelwagen.printWinkelWagen(currentUser.id) %}&#xA;&#xA;{% for output in result %}&#xA;    {{ output }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I get an array to string conversion error.  Does anyone know the correct way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7398" LastEditorUserId="57" LastEditDate="2017-10-17T17:45:51.233" LastActivityDate="2017-10-17T17:45:51.233" Title="Returning an array to Twig from a plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22418" PostTypeId="2" ParentId="22417" CreationDate="2017-10-17T08:16:40.173" Score="4" Body="&lt;p&gt;Your plugin should be able to handle PHP arrays just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft/plugins/myplugin/variables/MyPluginVariable.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getArray()&#xA;{&#xA;    return array('hi', 'there');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;craft/templates/template.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set result = craft.myPlugin.getArray() %}&#xA;{% for item in result %}&#xA;    {{ item }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error you're seeing is likely because &lt;code&gt;output&lt;/code&gt; itself is an array. If you have devMode enabled you can try a &lt;code&gt;{{ dump(output) }}&lt;/code&gt; inside your for-loop to see what it actually is / contains.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4465" LastEditDate="2017-10-17T11:04:41.797" LastActivityDate="2017-10-17T11:04:41.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22419" PostTypeId="2" ParentId="22404" CreationDate="2017-10-17T08:18:38.943" Score="1" Body="&lt;p&gt;Updating answer as question was updated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I see it, you want to find any and all entries where the field &lt;code&gt;weken2017&lt;/code&gt; has either the value &lt;code&gt;42&lt;/code&gt; or &lt;code&gt;43&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that I have understood this much correctly, &lt;code&gt;{% set entries = craft.entries.search(['OR', 'weken2017:42', 'weken2017:43']) %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4465" LastEditDate="2017-10-18T08:28:05.483" LastActivityDate="2017-10-18T08:28:05.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22420" PostTypeId="1" AcceptedAnswerId="22425" CreationDate="2017-10-17T08:58:02.113" Score="1" ViewCount="57" Body="&lt;p&gt;I want to do exactly this: &lt;strong&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1640&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-step &amp;amp; bi-directional relations with relatedTo (#1640)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Common example: Let’s say you have Books, Authors, and Publishers, and two relationship fields on the Books channel: &lt;code&gt;author&lt;/code&gt; and &lt;code&gt;publisher&lt;/code&gt;. On a Publisher’s page, you want to list all of the Authors that have published books with them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here’s what I’ve tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bookIds = craft.entries()&#xA;.section('books')&#xA;.relatedTo({ targetElement: publisher, field: 'publisher' })&#xA;.ids() %}&#xA;&#xA;{% set authors = craft.entries()&#xA;.section('authors')&#xA;.relatedTo({ sourceElement: bookIds, field: 'books' })&#xA;.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However the code results in an &quot;Undefined offset: 0&quot; error. The error seems to occur in the first block of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I'm not sure about the field in the penultimate line, shouldn't it be 'authors' rather than 'books'?&lt;/p&gt;&#xA;" OwnerUserId="7399" LastEditorUserId="9" LastEditDate="2017-10-17T10:38:02.467" LastActivityDate="2017-10-17T14:58:20.327" Title="Filtering by cousins" Tags="&lt;relations&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22421" PostTypeId="1" CreationDate="2017-10-17T09:09:53.410" Score="1" ViewCount="61" Body="&lt;p&gt;Is there any way to integrate Salesforce with Craft's &lt;a href=&quot;https://craftcms.com/docs/templating/user-registration-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;front-end user registration form&lt;/a&gt;? Is see &lt;a href=&quot;https://solspace.com/craft/freeform/docs/crm-api-salesforce/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform has a nice Salesforce integration&lt;/a&gt; but for this project the data needs to be sent across when people create a new member account, and when they update their profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone tackled this before? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2017-10-17T09:09:53.410" Title="User registration form Solspace integration" Tags="&lt;user-profile&gt;&lt;registration&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22422" PostTypeId="2" ParentId="22407" CreationDate="2017-10-17T12:04:17.697" Score="4" Body="&lt;p&gt;You have a variable name collision. You must change your &lt;a href=&quot;https://craftcms.com/docs/config-settings#tokenParam&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft token&lt;/a&gt; name to something else, as per &lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#paypal-express&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2017-10-17T12:04:17.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22423" PostTypeId="2" ParentId="22283" CreationDate="2017-10-17T13:01:18.490" Score="3" Body="&lt;p&gt;Based on your code - and our comments - you need something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;someFormId&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sproutForms/entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;test&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirectOnFailure&quot; value=&quot;{{ craft.request.getUrl() }}&quot;&amp;gt;&#xA;    &amp;lt;!---some more fields--&amp;gt;&#xA;    &amp;lt;button type=&quot;button&quot; id=&quot;sendRequest&quot; value=&quot;send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and your javascript like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#sendRequest&quot;).click(function(){&#xA;    var formData = $(&quot;#someFormId&quot;).serialize();&#xA;    //proceed with your ajax request &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;reason: The Plugin checks all your variables in your &lt;code&gt;$_POST&lt;/code&gt; request. Depending on the keys in this array it checks for spam. In your request you send none of those fields -&gt; the plugin validation does not trigger. You can check which fields are injected with the &lt;code&gt;{{ craft.sproutInvisibleCaptcha.protect() }}&lt;/code&gt; function and add them manually in your request as well but it's easier to just serialize the form. Maybe you have to play around with the action url. I'm used to craft 3 since two months and it could be I messed up the exact parameter in a serialize for craft2&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-17T13:07:28.227" LastActivityDate="2017-10-17T13:07:28.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22424" PostTypeId="1" CreationDate="2017-10-17T13:01:37.020" Score="2" ViewCount="1050" Body="&lt;p&gt;I have never gotten this before when using Craft cms this is the first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to load my site (locally), I am getting this message &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;unserialize(): Error at offset 0 of 24 bytes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached some screenshots of what I am getting in more detail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I suppose to do to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X5lps.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X5lps.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ulzMH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ulzMH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/m3R7b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m3R7b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5448" LastActivityDate="2018-03-17T21:21:49.813" Title="Caching Issue &quot;unserialize(): Error at offset 0 of 24 bytes&quot;" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22425" PostTypeId="2" ParentId="22420" CreationDate="2017-10-17T14:58:20.327" Score="1" Body="&lt;p&gt;The error you’re getting is a bug in Craft. (Just fixed that for the next release.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around it, replace the &lt;code&gt;{% set authors ... %}&lt;/code&gt; tag with:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if bookIds|length %}&#xA;    {% set authors = craft.entries()&#xA;        .section('authors')&#xA;        .relatedTo({ sourceElement: bookIds, field: 'books' })&#xA;        .all() %}&#xA;{% else %}&#xA;    {% set authors = [] %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2017-10-17T14:58:20.327" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22426" PostTypeId="1" AcceptedAnswerId="22429" CreationDate="2017-10-17T16:00:28.947" Score="3" ViewCount="1001" Body="&lt;p&gt;I have a multisite on Craft 3 and I was wondering how to get section content from another site? Let's say I'm on a default site and I want to get contact content from site with handle siteA?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this be done?&lt;/p&gt;&#xA;" OwnerUserId="7401" LastEditorUserId="3951" LastEditDate="2017-10-23T11:16:53.810" LastActivityDate="2017-10-23T11:16:53.810" Title="How to get section content from another site with multisite setting" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22427" PostTypeId="1" AcceptedAnswerId="22428" CreationDate="2017-10-17T16:18:35.010" Score="1" ViewCount="36" Body="&lt;p&gt;I need to prepend a URL to the beginning of an asset URL in order to track stats for a podcast via Blubrry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically I need to drop the https that would appear in my URL by default.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-10-17T16:25:50.810" Title="Customise the URL for an asset" Tags="&lt;assets&gt;&lt;url&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22428" PostTypeId="2" ParentId="22427" CreationDate="2017-10-17T16:25:50.810" Score="2" Body="&lt;p&gt;This doesn't work with Blubrry specifically, but you can use it to get the data into Google Analytics for things that aren't normally trackable: &lt;a href=&quot;https://github.com/nystudio107/instantanalytics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Instant Analytics&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;https://github.com/nystudio107/instantanalytics#tracking-rss-feeds&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tracking RSS Feeds&lt;/a&gt; section.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-17T16:25:50.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22429" PostTypeId="2" ParentId="22426" CreationDate="2017-10-17T18:04:53.217" Score="4" Body="&lt;p&gt;From a template you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('jobs').site('siteA').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your follow up comment, you're passing &lt;code&gt;craft.entries&lt;/code&gt; as an element to &lt;code&gt;relatedTo&lt;/code&gt;, but that's just going to be an instance of the &lt;code&gt;ElementQuery&lt;/code&gt; class.  You need to give it the actual element you're interested in finding the relationship to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-17T18:04:53.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22430" PostTypeId="1" CreationDate="2017-10-17T18:22:12.183" Score="1" ViewCount="283" Body="&lt;p&gt;I'd like to set a user defined order for a Categories field. For example, categories are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cat A&#xA;Cat B&#xA;Cat C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to give the ability for users to drag and drop the order, to say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cat B&#xA;Cat A&#xA;Cat C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to handle this?&lt;/p&gt;&#xA;" OwnerUserId="6512" LastActivityDate="2017-10-17T18:40:35.730" Title="User defined order for categories" Tags="&lt;categories&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22432" PostTypeId="2" ParentId="22430" CreationDate="2017-10-17T18:34:33.500" Score="1" Body="&lt;p&gt;I ended up finding this code snipped, which worked for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/zackspear/7cdd656f9bb34e210676&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/zackspear/7cdd656f9bb34e210676&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6512" LastActivityDate="2017-10-17T18:34:33.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22433" PostTypeId="2" ParentId="22430" CreationDate="2017-10-17T18:40:35.730" Score="1" Body="&lt;p&gt;You can do this in the CP by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a category field &quot;categories&quot;, the user can select one or more categories and then drag them into the order they want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the frontend you just loop over them like this to show them in the order they selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.categories %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same goes if you want to just show all categories from a category group, you can drag and drop them in the CP and then print them out in your code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('cats') %}&#xA;    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2017-10-17T18:40:35.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22435" PostTypeId="1" CreationDate="2017-10-18T03:21:37.823" Score="1" ViewCount="405" Body="&lt;p&gt;I'm stumped trying to order paginated entries for a channel. The end goal is to have listings with the most recent postDate at the top. The code below has the most recent item third instead of first. The first item should be third.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same happens as you paginate to the next page. The third item listed should be the first item listed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('podcastEpisodes').order('postDate desc').limit('3') as pageInfo, pageEntries %}&#xA;{% for entry in pageEntries  %}&#xA;&#xA;{% set category = entry.topic.first() %}&#xA;    &amp;lt;div class=&quot;masonry__item&quot; data-masonry-filter=&quot;{% if category %}{{ category.title }}{% endif %}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;p class=&quot;date&quot;&amp;gt;{{ entry.postDate|date('M j, Y') }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% set myEntry = entry.podcaster.first() %}&#xA;        {% if myEntry %}&#xA;        &amp;lt;p class=&quot;podcaster&quot;&amp;gt;{{ myEntry.title }}&amp;lt;/p&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;h4&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea why this is happening?&lt;/p&gt;&#xA;" OwnerUserId="7387" LastActivityDate="2017-12-17T18:32:26.950" Title="Order a paginated entry by postDate" Tags="&lt;pagination&gt;&lt;ordering&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22436" PostTypeId="2" ParentId="19658" CreationDate="2017-10-18T11:11:06.067" Score="2" Body="&lt;p&gt;You could modify this JavaScript to do it for you. We currently have it running on a site where this was sought-after&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat: Our script opens ALL folders, not just the first level - hence the need to modify.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(window).on('load', function() {&#xA;    var $ = jQuery;&#xA;&#xA;    var openFolders = function() {&#xA;        var imageRootLinks = $('a[data-key^=&quot;folder:&quot;]');&#xA;&#xA;        $.each(imageRootLinks, function(index, link) {&#xA;            var imageRoot = $(link).parent();&#xA;            var toggle = imageRoot.find('.toggle');&#xA;            if (toggle.length &amp;amp;&amp;amp; !imageRoot.hasClass('expanded')) {&#xA;                toggle.first().click();&#xA;            }&#xA;        });&#xA;    };&#xA;&#xA;    // open folders in left menu&#xA;    openFolders();&#xA;&#xA;    // open folders in image selector&#xA;    $(document).ajaxComplete(function(e, status, requestData) {&#xA;        if (requestData.url &amp;amp;&amp;amp; requestData.url.indexOf('getElements') &amp;amp;&amp;amp; requestData.data &amp;amp;&amp;amp; requestData.data.indexOf('context=modal&amp;amp;elementType=Asset') != -1) {&#xA;            openFolders();  &#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then simply include the JS-file through a plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// runs on all requests&#xA;public function init() {&#xA;    // check that user is logged in and in the control panel&#xA;    if ( craft()-&amp;gt;request-&amp;gt;isCpRequest() &amp;amp;&amp;amp; craft()-&amp;gt;userSession-&amp;gt;isLoggedIn() ) {&#xA;        // the includeJsResource method will add a js file to the bottom of the page&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJsResource('myplugin/js/openFolders.js');&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-18T11:11:06.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22437" PostTypeId="2" ParentId="19401" CreationDate="2017-10-18T11:16:16.383" Score="1" Body="&lt;pre&gt;&lt;code&gt;if ($upload-&amp;gt;isSuccess()) {&#xA;     $fileId = $upload-&amp;gt;getDataItem('fileId');&#xA;     $asset = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;     $folderId = $asset-&amp;gt;getFolder()-&amp;gt;getAttribute('id');&#xA;     ...&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2017-10-18T11:16:16.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22438" PostTypeId="1" AcceptedAnswerId="22446" CreationDate="2017-10-18T11:20:51.947" Score="2" ViewCount="251" Body="&lt;p&gt;Folks, just wondering if anyone has further knowledge on Craft Commerce's Tax Rates? I am setting up my first commerce store and the client requires that if the customer is buying from the EU, and has a valid VAT number, they then &lt;em&gt;do not&lt;/em&gt; pay the 20% VAT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my Tax Categories, Zones and Rates set up, and have checked the option to 'Don't apply this tax when the shipping address has a valid VAT ID' - however when it comes to the payment screen after putting in a VAT number in the businessTaxId input on the Shipping Address screen, it does not deduct the 20% added VAT. It does pick up the correct Tax Zone as I can see it is EU Tax that has been added, it is just not deducting when I enter a VAT ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering is there something else that I would need to be covering first before this works? Apologies if this is a little too vague.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently running the latest version of Craft &amp;amp; Craft Commerce, and working from the base files that you get when you download.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit&#xA;I have just noticed this error in the commerce.log file if it helps matters&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Forced] Communication with VAT API failed: MS_UNAVAILABLE&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4783" LastEditorUserId="4783" LastEditDate="2017-10-18T15:29:40.863" LastActivityDate="2017-10-18T17:32:05.150" Title="VAT not being removed when adding a number to businessTaxID" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22439" PostTypeId="1" AcceptedAnswerId="22442" CreationDate="2017-10-18T11:54:01.447" Score="1" ViewCount="229" Body="&lt;p&gt;Despite having tried the tips from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/827/image-transforms-returning-cpresources-url&quot;&gt;Image transforms returning cpresources url&lt;/a&gt;, I am still having issues with image-transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the problem is when i put the image without transform it work fine, but when i add the transform parametre it vanish, and even i tried to apply transfom in the template, the image show up but without crop option, only adjust the width and height in the front.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried clearing the cache and db table already as well as updating the asset index. I have double checked the sources paths and it is not a file permission issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running Craft Pro 2.6.2992&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'generateTransformsBeforePageLoad' =&gt; true is set in craft/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;template-code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          {% set  blocWith = &quot;large-12&quot; %}&#xA;          {% if block.image.first.url is defined %}&#xA;          {% set imageUrl = block.image.first.getUrl('imagewidthlarge') %}&#xA;          {% set imageHeight = block.image.first.getHeight('imagewidthlarge') %}&#xA;          {% set imageWidth = block.image.first.getWidth('imagewidthlarge') %}&#xA;&#xA;      {% endif %}&#xA;              &amp;lt;img src=&quot;{{ imageUrl ?? '404' }}&quot; height=&quot;{{ imageHeight }}&quot; width=&quot;{{ imageWidth }}&quot;/&amp;gt;&#xA;              &amp;lt;div class=&quot;textBloc&quot;&amp;gt;&#xA;                {% if block.heading is not empty %}&amp;lt;h2 class=&quot;m-b-20&quot; style=&quot;color:{{ block.textColor }} !important&quot; &amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;{% endif %}&#xA;                {% if block.subtitle is not empty %}&amp;lt;h3 class=&quot;m-b-20&quot;style=&quot;color:{{ block.textColor }} !important&quot; &amp;gt;{{ block.subtitle }}&amp;lt;/h3&amp;gt;{% endif %}&#xA;                {{ include(template_from_string(block.text)|raw) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is what the page-source looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;http://my-site.dev:8080/fr/cpresources/404?x=24sONoMIB&quot; height=&quot;483&quot; width=&quot;1202&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;vu front :&#xA;&lt;a href=&quot;https://i.stack.imgur.com/215JV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/215JV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please i'm on a deadline on this projects i tryied all i could to work it out but still, i need this image transform to work &lt;/p&gt;&#xA;" OwnerUserId="6603" LastActivityDate="2017-10-18T15:00:31.623" Title="Image transforms return cpresources URL and doesn't apply crop" Tags="&lt;image-transforms&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22442" PostTypeId="2" ParentId="22439" CreationDate="2017-10-18T15:00:31.623" Score="1" Body="&lt;p&gt;I did find the solution i checked the basepath with the server hosting my project and it turned out that the relative path dosen't work like the absolute path, so i serached for the root in the server and i inserted the full path, it work !! thanks for letting me know this by myself :)&lt;/p&gt;&#xA;" OwnerUserId="6603" LastActivityDate="2017-10-18T15:00:31.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22444" PostTypeId="1" AcceptedAnswerId="22448" CreationDate="2017-10-18T16:54:10.700" Score="1" ViewCount="690" Body="&lt;p&gt;Is it possible to bypass the Varnish cache when the user is logged in? I've tried using the &quot;CraftSessionId&quot; cookie, but it seems that it is also set for non logged in users.&lt;/p&gt;&#xA;" OwnerUserId="4638" LastEditorUserId="4638" LastEditDate="2017-10-19T08:51:25.827" LastActivityDate="2018-07-22T12:56:11.037" Title="Bypass Varnish cache if user is logged in" Tags="&lt;cache&gt;&lt;cookies&gt;&lt;varnish&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22445" PostTypeId="1" AcceptedAnswerId="22451" CreationDate="2017-10-18T17:27:39.177" Score="2" ViewCount="1840" Body="&lt;p&gt;When attempting to install Craft 3 in OSX El Cap, I'm getting the following errors:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255&#xA;  /Craft3/vendor/craftcms/cms/bootstrap/bootstrap.php on line 104&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Parse error: parse error in PATH/vendor/craftcms/cms/bootstrap/bootstrap.php on line 104&#xA;  Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I used the &lt;code&gt;--ignore-platform-reqs&lt;/code&gt; flag as I am using PHP7 on MAMP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I attempt to load index.php in the browser I'm seeing this seemingly related issue in the trace:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;in PATH/web/index.php at line 21 – yii\base\Application::run() 15161718192021    (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&gt;load();}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;// Load and run Craft&#xA;  define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;  $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';&#xA;  $app-&gt;run();&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've substituted &quot;PATH&quot; in all errors in lieu of the actual path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice on resolving this would be much appreciated. &lt;/p&gt;&#xA;" OwnerUserId="1077" LastEditorUserId="57" LastEditDate="2017-10-18T17:39:21.260" LastActivityDate="2017-12-12T13:19:34.867" Title="Error on Craft 3 install" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22446" PostTypeId="2" ParentId="22438" CreationDate="2017-10-18T17:32:05.150" Score="0" Body="&lt;p&gt;Commerce, by default, uses &lt;a href=&quot;https://github.com/snowcap/vat-validation&quot; rel=&quot;nofollow noreferrer&quot;&gt;this library&lt;/a&gt; for VAT validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That library is just a wrapper for a European SOAP endpoint for these types of things at &lt;a href=&quot;http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error code &lt;code&gt;MS_UNAVAILABLE&lt;/code&gt; that endpoint can return says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Member State service is unavailable, try again later or with another Member State;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I'm guessing an invalid member state was selected, or they are having some technical difficulties on their end.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-18T17:32:05.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22447" PostTypeId="2" ParentId="22435" CreationDate="2017-10-18T17:35:08.713" Score="2" Body="&lt;p&gt;The code above is correct and working properly. There was a conflict with a masonry js file making the Craft ordering not work. Big thanks to @Anubarak for testing the code on their side.&lt;/p&gt;&#xA;" OwnerUserId="7387" LastActivityDate="2017-10-18T17:35:08.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22448" PostTypeId="2" ParentId="22444" CreationDate="2017-10-18T17:36:38.200" Score="0" Body="&lt;p&gt;&lt;code&gt;CraftSessionId&lt;/code&gt; is just the &lt;a href=&quot;https://secure.php.net/manual/en/function.session-set-cookie-params.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP session cookie&lt;/a&gt; renamed, so you'll get it on every request that requires session, regardless if they are authenticated with Craft or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft authentication cookie is a cookie with a 32 character randomly generated name.  i.e. &lt;code&gt;7afe5904f6b2a09ce620eca02e80328c&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-18T17:36:38.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22449" PostTypeId="2" ParentId="22424" CreationDate="2017-10-18T17:42:50.820" Score="2" Body="&lt;p&gt;Sounds like something just got corrupted when saving to &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; and now PHP/Craft is having a problem reading the corrupted data from cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No idea how it happened, but clearing &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; should resolve the issue for now.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-18T17:42:50.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22450" PostTypeId="1" AcceptedAnswerId="22483" CreationDate="2017-10-18T20:14:23.810" Score="2" ViewCount="523" Body="&lt;p&gt;When I activate Auto Generated SKU's in Craft Commerce, I get the &quot;SKU's cannot be left blank&quot; error when I submit a new product. Isn't it the point to leave them blank so they'll auto generate based on other fields?&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2017-10-18T20:56:37.570" LastActivityDate="2017-10-19T18:58:33.677" Title="Auto Generated SKU" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22451" PostTypeId="2" ParentId="22445" CreationDate="2017-10-18T20:46:53.477" Score="3" Body="&lt;p&gt;In order to install under MAMP with PHP7 we added the MAMP PHP7 path with the following command:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;export PATH=&quot;/Applications/MAMP/bin/php/php7.0.15/bin:$PATH&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;After achieving a successful Craft 3 install we ran the setup in the CLI and we also created a fresh DB and a new MAMP host following the sequence recommended in the installation docs. &lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2017-10-18T20:46:53.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22452" PostTypeId="2" ParentId="21199" CreationDate="2017-10-18T21:42:08.797" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email&lt;/a&gt; and &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/lists&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Lists&lt;/a&gt; can support some scenarios like this and are working toward supporting more use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Lists lets you define a Subscriber List and allow users to Subscribe to it. A Subscription can be any relationship between a Subscriber/User and another Element, such as a Blog Entry. If you just want a generic list, you can have users Subscribe to a List Element (provided by Sprout Lists).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Email lets you setup Notification Emails that are triggered by events, and those Notification Emails can be sent to Sprout Lists Subscriber Lists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your situation, you could set up a Notification that was triggered whenever a new entry was created in a specific channel, and send a dynamic Notification with into about what was updated to everyone on the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: As of this post, Sprout Email is not doing anything too fancy when it comes to sending to a list, so if your list size grows, you may run into a scenario where more optimization needs around managing larger lists. We have plans to address that scenario but it's likely that won't happen until Craft 3 or afterwards. Reach out to the Sprout team if you have any questions.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2017-10-18T22:11:28.360" LastActivityDate="2017-10-18T22:11:28.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22454" PostTypeId="2" ParentId="22189" CreationDate="2017-10-18T21:58:34.440" Score="1" Body="&lt;p&gt;This issue has been resolved in &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email 3&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be sure to read the upgrade notes. This is a major release and some scenarios may require a few manual steps to get updated.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-10-18T21:58:34.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22455" PostTypeId="2" ParentId="21199" CreationDate="2017-10-18T22:00:08.533" Score="2" Body="&lt;p&gt;It appears that &lt;a href=&quot;https://solspace.com/craft/freeform/docs/mailing-list-integrations/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace Freeform Pro&lt;/a&gt; supports some limited integrations with third party email marketing tools.&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2017-10-18T22:00:08.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22456" PostTypeId="2" ParentId="21199" CreationDate="2017-10-18T22:30:34.367" Score="2" Body="&lt;p&gt;As someone who's ran their own mail server and even wrote some super basic list management software years ago, e-mail is no picnic, especially nowadays. You can integrate with some 3rd party SMTP providers like AWS SES, Postmark, etc. but you still need to do a bunch of work to make it happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other common way to do this is most providers can ping your website's RSS feed periodically for new content. They handle all the legwork, cron jobs, etc.  behind the scenes. You can usually spit out custom fields (like perhaps a header image, etc.) and then craft the e-mail based on those. Active Campaign and MailChimp are good examples of providers that handle this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting up an &lt;a href=&quot;https://craftcms.com/docs/templating/rss-feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;RSS Feed&lt;/a&gt; in Craft is also super straightforward—no programming, plugins, or API necessary. You just create a new template in Craft, name it with an &lt;code&gt;.rss&lt;/code&gt; extension and let Craft handle it like normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the best thing is, if if you move providers, you can just unplug from one and setup the feed in another.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-10-18T22:30:34.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22457" PostTypeId="2" ParentId="19601" CreationDate="2017-10-19T02:10:52.643" Score="6" Body="&lt;p&gt;You can also check out the free video on it here: &lt;a href=&quot;https://mijingo.com/lessons/craft-3-multi-site/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using Craft CMS 3 Multi-site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multi-site has changed as of Craft 3 RC11. It now requires much less config outside of the control panel. &lt;a href=&quot;https://docs.craftcms.com/v3/sites.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;See the official docs on Sites in Craft 3.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="5275" LastEditDate="2018-08-15T14:58:50.487" LastActivityDate="2018-08-15T14:58:50.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22458" PostTypeId="1" CreationDate="2017-10-19T04:11:25.807" Score="1" ViewCount="570" Body="&lt;p&gt;Is there any plugin or relatively straightforward and accepted way to add a recaptcha to the login for the admin page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My research so far has come up with nothing. I'm curious if others have looked into this with any result. &lt;/p&gt;&#xA;" OwnerUserId="7377" LastActivityDate="2020-09-07T14:43:56.917" Title="Adding reCAPTCHA to the admin login page" Tags="&lt;login&gt;&lt;security&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22459" PostTypeId="2" ParentId="22458" CreationDate="2017-10-19T06:48:22.930" Score="1" Body="&lt;p&gt;As far as I know there is no &quot;build in way&quot; to achieve this. &#xA;There is a way but it's really ugly and I would suggest you not to do what I write. Maybe someone can make it a little bit &quot;cleaner&quot; better or whatever but this code should actually not be used. It's only some kind of food for thought..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok so... you &lt;strong&gt;could&lt;/strong&gt; inject a custom javascript code during the login process that adds a captcha to the login html...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    parent::init();&#xA;    if(craft()-&amp;gt;request-&amp;gt;url === &quot;/admin/login&quot;){&#xA;        // build your captcha, store the correct one in your session and build your html here&#xA;        craft()-&amp;gt;templates-&amp;gt;includeJs(&#xA;            // after document ready, append your html to the form&#xA;            // $(&quot;#login-form&quot;).append(yourHtml); or something like that&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like I said, it's a but ugly but I was not able to find a &quot;clean way&quot;. The other workaround would be adding your code directly into the login.html but as soon as this file is updated you would have to include your html again (or you would have to prevent updates at all)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can use this hook &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#user-api-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt; to check if the passed paramter matches yours. The following code is just an example. I didn't include any security checks. &lt;strong&gt;Don't use this as it is on your website&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('userSession.onLogin', function(Event $event){&#xA;    $captcha = craft()-&amp;gt;request-&amp;gt;getPost('yourCaptchaParam');&#xA;    if($captcha !== craft()-&amp;gt;httpSession-&amp;gt;get('captcha')){&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    return false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; ups sry - I saw too late you want to use the reCaptcha and not a captcha.. but the process would be the same&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2: &#xA;This is the default craft login action. You can try to remove the default event handler from the button and attach your own in your init as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;submitLogin: function()&#xA;{&#xA;    var data = {&#xA;        loginName: this.$loginNameInput.val(),&#xA;        password: this.$passwordInput.val(),&#xA;        rememberMe: (this.$rememberMeCheckbox.prop('checked') ? 'y' : '')&#xA;    };&#xA;&#xA;    Craft.postActionRequest('users/login', data, $.proxy(function(response, textStatus)&#xA;    {&#xA;        if (textStatus == 'success')&#xA;        {&#xA;            if (response.success)&#xA;            {&#xA;                window.location.href = Craft.getUrl(response.returnUrl);&#xA;            }&#xA;            else&#xA;            {&#xA;                //since you have no ganish, just change that to a jquery method&#xA;                Garnish.shake(this.$form);&#xA;                this.onSubmitResponse();&#xA;&#xA;                // Add the error message&#xA;                if (!error)&#xA;                {&#xA;                     error = Craft.t('An unknown error occurred.');&#xA;                }&#xA;&#xA;                this.$error = $('&amp;lt;p class=&quot;error&quot; style=&quot;display:none&quot;&amp;gt;'+error+'&amp;lt;/p&amp;gt;').insertAfter($('.buttons', this.$form));&#xA;                this.$error.velocity('fadeIn');&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            this.$submitBtn.removeClass('active');&#xA;            this.$spinner.addClass('hidden');&#xA;            this.loading = false;&#xA;        }&#xA;&#xA;    }, this));&#xA;&#xA;    return false;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-27T03:05:06.510" LastActivityDate="2017-10-27T03:05:06.510" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22460" PostTypeId="2" ParentId="10657" CreationDate="2017-10-19T07:46:36.283" Score="1" Body="&lt;p&gt;For me, it usually breaks down like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Static assets are unrelated to the content of the website. They are &lt;em&gt;design related&lt;/em&gt;.&#xA;Dynamic assets are content. They &lt;em&gt;have meaning&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;/public&#xA;  /assets (The website design, these are all static)&#xA;    /css&#xA;    /images&#xA;    /fonts&#xA;  /content (Stuff uploaded through Craft by users, all dynamic)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-10-19T07:46:36.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22461" PostTypeId="1" AcceptedAnswerId="22463" CreationDate="2017-10-19T11:25:52.457" Score="1" ViewCount="329" Body="&lt;p&gt;I can see in the CP (craft 3) that my &lt;strong&gt;sections&lt;/strong&gt; have a 'translatable' icon but I don't find anywhere in the UI to translate section names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J9ZtY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J9ZtY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to translate these?&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2017-10-19T11:31:00.193" LastActivityDate="2017-10-25T18:29:00.607" Title="Translate Section name" Tags="&lt;localization&gt;&lt;sections&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22462" PostTypeId="1" CreationDate="2017-10-19T12:28:50.430" Score="3" ViewCount="400" Body="&lt;p&gt;Good Afternoon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to recover admin login information for a website I have recently taken on, however there is no craft_users table within the database.  Any help to locate the user info would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7415" LastActivityDate="2019-01-09T14:50:28.837" Title="No craft_users table in Database" Tags="&lt;login&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22463" PostTypeId="2" ParentId="22461" CreationDate="2017-10-19T12:33:54.767" Score="1" Body="&lt;p&gt;I haven't found how to do it through the UI but it's possible to add the section names in translation files as keys and then translate them in the views using &lt;code&gt;{{ &quot;key_name&quot; | translate }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You must follow &lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; but keeping in mind the &lt;code&gt;translations&lt;/code&gt; folder &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/upgrade.md#static-translation-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;changed its location and structure from Craft 2 to Craft 3&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to place it right under your project directory:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yourProject&#xA;|--templates&#xA;|--translations/&#xA;|---en/&#xA;|-----site.php&#xA;|---es/&#xA;|-----site.php&#xA;|--vendor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2017-10-25T18:29:00.607" LastActivityDate="2017-10-25T18:29:00.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22464" PostTypeId="2" ParentId="22462" CreationDate="2017-10-19T12:50:31.623" Score="2" Body="&lt;p&gt;A Craft website can be configured to have a different table prefix. This can be updated in the &lt;code&gt;craft/config/db.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, the prefix is the default, &lt;code&gt;craft&lt;/code&gt;, so the users table will be &lt;code&gt;craft_users&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'craft',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, the prefix is &lt;code&gt;unexpected&lt;/code&gt; so the users table will be &lt;code&gt;unexpected_users&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; 'unexpected',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example, the prefix is (blank) so the users table will be &lt;code&gt;users&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    '*' =&amp;gt; array(&#xA;        'tablePrefix' =&amp;gt; '',&#xA;    )&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-10-19T12:50:31.623" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22465" PostTypeId="1" CreationDate="2017-10-19T13:14:57.723" Score="2" ViewCount="963" Body="&lt;p&gt;I've just started using craft Commerce. What's the accepted way to categorise products? For example, i’m trying to replicate this structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bags and Scarves (shows all products in this category)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hand Bags (shows just hand bags)&lt;/li&gt;&#xA;&lt;li&gt;Overnight Bags (shows just overnight)&lt;/li&gt;&#xA;&lt;li&gt;Purses (shows just purses)&lt;/li&gt;&#xA;&lt;li&gt;Scarfs (shows just scarfs)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hair Accessories (shows all accessories)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hair Bands (shows just hair bands)&lt;/li&gt;&#xA;&lt;li&gt;Hair Clips (etc)&lt;/li&gt;&#xA;&lt;li&gt;Brushes (etc)&lt;/li&gt;&#xA;&lt;li&gt;Combs (etc)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hair Care Products (shows all hair care ‘HERO’ products)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product with variations&lt;/li&gt;&#xA;&lt;li&gt;Product with variations&lt;/li&gt;&#xA;&lt;li&gt;Product with variations&lt;/li&gt;&#xA;&lt;li&gt;Product with variations&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Jewellery  (all jewellery, no sub cats)&lt;/li&gt;&#xA;&lt;li&gt;Gift Vouchers&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;£10&lt;/li&gt;&#xA;&lt;li&gt;£20&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can’t see how product types would work?  I added the top level as if they were “departments” but the front end doesn’t show these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help and code examples appreciated to get me going.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2017-10-19T14:43:01.600" Title="Craft Commerce Categories and Product Types" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22466" PostTypeId="1" CreationDate="2017-10-19T13:43:58.460" Score="0" ViewCount="100" Body="&lt;p&gt;Help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a parent page called 'Employment' that is a structure - it has 8 sub pages beneath it. I have just created a new single template and would like this to replace this page - is this possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would really appreciate the help!&lt;/p&gt;&#xA;" OwnerUserId="7417" LastActivityDate="2017-10-19T14:53:08.147" Title="Changing parent page to a single" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22468" PostTypeId="2" ParentId="22465" CreationDate="2017-10-19T14:43:01.600" Score="1" Body="&lt;p&gt;Product Types are really for the content of the fields and field layout of each product plus basic options for things like tax/shipping category defaults.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For full categorization in menus and site structure, we recommend putting a category field on all products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you might have a category field names 'department' which you put all products into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then could show all products related to that category: &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need more guidance in the comments.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-10-19T14:43:01.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22469" PostTypeId="2" ParentId="22466" CreationDate="2017-10-19T14:47:37.410" Score="1" Body="&lt;p&gt;As a more detailed reply to your comment:&#xA;&lt;br&gt;You don't need to create a completely new section in order to have a different template. For Example when you create a section called 'Employment' you can have several different &lt;code&gt;entryTypes&lt;/code&gt; in this &lt;code&gt;section&lt;/code&gt;. In your &lt;code&gt;/admin/settings/sections&lt;/code&gt;you can see all your sections (left) and when you click on their &lt;code&gt;entryTypes&lt;/code&gt; on the right you'll enter this page &lt;code&gt;/admin/settings/sections/&amp;lt;sectionId&amp;gt;/entrytypes&lt;/code&gt; to edit them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the following folder structure you can do this:&lt;br&gt;&#xA;|-/templates&lt;br&gt;&#xA;|--/pages&lt;br&gt;&#xA;|---_entry.twig&lt;br&gt;&#xA;|---/entryTypes&lt;br&gt;&#xA;|----imprint.twig&lt;br&gt;&#xA;|----contact.twig&lt;br&gt;&#xA;for example your section is called &lt;code&gt;pages&lt;/code&gt; and you have the &lt;code&gt;entryTypes&lt;/code&gt; imprint and contact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your section template is /pages/_entry.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;    'pages/_entrytypes/' ~ entry.type ~ '.twig'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so depending on your entryType the template for imprint or contact will be rendered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you would create a folder &lt;code&gt;Employment&lt;/code&gt; and create different &lt;code&gt;entryTypes&lt;/code&gt; for the different templates you want to render. In your &lt;code&gt;Employment&lt;/code&gt; you render the template depending on your need.&#xA;You can also extend your file to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;    'pages/_custom/' ~ entry.slug ~ '.twig',&#xA;    'pages/_custom/' ~ entry.someCustomFieldValue ~ '.twig',&#xA;    'pages/_entrytypes/' ~ entry.type ~ '.twig',&#xA;    'pages/_generic.twig'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so you can choose you template via slug/dropdown lists/checkboxes or whatever you want&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-19T14:53:08.147" LastActivityDate="2017-10-19T14:53:08.147" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22472" PostTypeId="2" ParentId="22373" CreationDate="2017-10-19T16:12:49.710" Score="8" Body="&lt;p&gt;Actually Brad, I was able to figure out a way to do this with some help from @carlcs in the slack channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I defined an &quot;HTML Template&quot; in the main email settings screen, then in that template I extend a basic HTML email wrapper, then inside my content block I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if emailKey == 'account_activation' %}&#xA;    {% include 'mail/activation' %}&#xA;{% endif %}&#xA;{% if emailKey == 'forgot_password' %}&#xA;    {% include 'mail/forgot-password' %}&#xA;{% endif %}&#xA;{% if emailKey == 'test_email' %}&#xA;    {% include 'mail/test-email' %}&#xA;{% endif %}&#xA;{% if emailKey == 'verify_new_email' %}&#xA;    {% include 'mail/verify-new-email' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I just created HTML versions of each email within the context of my wrapper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works perfectly!&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-10-19T16:12:49.710" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22473" PostTypeId="1" CreationDate="2017-10-19T16:28:25.587" Score="1" ViewCount="276" Body="&lt;p&gt;I would like to eager load: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A list of entries&lt;/li&gt;&#xA;&lt;li&gt;Within the entries loop, the first image, from the first of a block type on a matrix field.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Loading the entries like this&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  sectionId: 12,&#xA;  with: [&#xA;    'pageContent.text:text',&#xA;    ['pageContent.images:images', {&#xA;      withTransforms: [{&#xA;        width: 100,&#xA;        height: 100&#xA;      }]&#xA;    }]&#xA;  ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Loading the images:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I can only seem to load an image like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.pageContent %}&#xA;  {% if block.type == 'images' %}&#xA;    {% if img is not defined %}&#xA;      {% set img = block.images[0] ?? null %}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I cannot seems to filter the query to the matrix down like you can when getting a matrix normally, I just receive a bunch of errors, I am trying  something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = entry.content.type('images').first.images[0] ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additionally, it appears I cannot use the loop to save a variable to use outside of it, I presume this is intentional and how eager loading works. If that is the case, would I even benefit from any optimisation on the query at all if it is looping on blocks I do not need? As an example, I would normally do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = entry.content.type('images').first.images.first ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Following on from whether this is worth it... I also want to get a text field on this matrix (from the first of a block type again), but, in another position in the template. Does this mean I need to do another loop again to get the data specifically for another field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to deal with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that makes sense, let me know if not I'll do my best to clarify.&lt;/p&gt;&#xA;" OwnerUserId="4066" LastActivityDate="2018-03-18T21:29:30.313" Title="Eager load a list of entries, then only the first asset, from the first block type" Tags="&lt;eager-loading&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22474" PostTypeId="1" CreationDate="2017-10-19T16:43:13.247" Score="1" ViewCount="140" Body="&lt;p&gt;Inherited a site which uses guest entries for a job application form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Postmaster plugin is being used to notify someone that a new entry has been posted but now they'd also like to send the person who applied for the job a confirmation mail after submitting the guest entries form... any suggestions on how to do this?&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2017-11-18T18:52:41.200" Title="Guest entries - send confirmation mail to person who filled out entry" Tags="&lt;guest-entries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22475" PostTypeId="1" CreationDate="2017-10-19T16:55:45.280" Score="4" ViewCount="2877" Body="&lt;p&gt;So I am working on converting a previously-standalone Yii 2 app into a Craft module and am having some issues with routing.  I wish to keep my old URL structure as much as possible.  As such, I created a plugin and register routes.  However, I've noticed an issue: When I call Url::to(), I get back URLs that seem to rely on the actionTrigger parameter, even if I explicitly defined routes in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the routes as I have them in my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CustomerPortal extends \craft\base\Plugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        Event::on(&#xA;            UrlManager::class,&#xA;            UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;            function(\craft\events\RegisterUrlRulesEvent $event) {&#xA;                $event-&amp;gt;rules['portal/&amp;lt;action:[\w-+]&amp;gt;'] = 'customer-portal/portal/&amp;lt;action&amp;gt;';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I make the call in a controller to redirect to a route, it builds the URL using an action param, not the rules we defined.  For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class UserController extends \craft\web\Controller&#xA;{&#xA;    public function actionRedirect()&#xA;    {&#xA;        echo Url::to(['checkout');&#xA;        // I'd expect to see '/checkout', but instead we get &#xA;        // '/actions/customer-portal/user/checkout' since we aren't&#xA;        // applying either of our rules.&#xA;    }&#xA;&#xA;    public function actionCheckout()&#xA;    {&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that the rules are checked when parsing, but not during URL creation, and if you come in with an action prefix, the rules aren't parsed then, but the raw action is attempted.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something or is this a bug and either way, can anyone think of a way to work around it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Figured out the issue with routes not resolving I had originally, it turns out in the end, my issues was that the regex in the rules wasn't accounting for the fact that many of routes have dashes in them (for example: /user/billing-info).  The default Yii docs say to use &lt;code&gt;&amp;lt;action:\w+&amp;gt;&lt;/code&gt;, but that doesn't match the dash character in the URL.  Using &lt;code&gt;&amp;lt;action:[\w-]+&amp;gt;&lt;/code&gt; works perfectly and makes this all work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, I'm still not getting Url::to or anything else that references UrlManager to work properly since UrlManager seems to add the action param to the URL before checkout to see if we match existing routes.&lt;/p&gt;&#xA;" OwnerUserId="7413" LastEditorUserId="85" LastEditDate="2018-06-09T09:16:45.433" LastActivityDate="2018-06-09T09:16:45.433" Title="Craft 3 Plugin Routing Problems" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;yii&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22477" PostTypeId="2" ParentId="22473" CreationDate="2017-10-19T17:01:18.583" Score="0" Body="&lt;p&gt;This article may be helpful to you: &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speed up your Craft CMS Templates with Eager Loading&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, when you eager load the Matrix blocks, you're no longer getting an ElementCriteriaModel, rather you're getting an array pre-loaded with the Matrix blocks. That's why you can't do something like &lt;code&gt;entry.pageContent.type('images').first.images&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-19T17:01:18.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22478" PostTypeId="1" CreationDate="2017-10-19T17:18:35.210" Score="2" ViewCount="119" Body="&lt;p&gt;We have an S3 asset source with ~33k images. In the admin, quite a few aren’t completely loaded (see image below). Users are able to add these to entries but they don’t display on the front end. Sometimes, a few hours later, they will start displaying. These images are accessible and not corrupt on S3 itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZCPTH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZCPTH.png&quot; alt=&quot;&amp;quot;Broken&amp;quot; images in assets within Craft CP&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m wondering if there’s something specific causing this: PHP memory limits? Some kind of config setting? Server specs? I’ve updated the asset indexes and the task appears to complete with no errors in the log, but there's no change in the asset experience in the admin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you're able to view and download the asset just fine from within the admin. Just no thumbnail and no display when added to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our client is just noticing this issue now that they're adding backdated content, but I suspect that it has existed since we set up this asset source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I've discovered (thanks to Andris via Craft support) that if I re-upload these &quot;ghost assets&quot;, their attributes are correctly populated, so I've been doing that, albeit slowly as they're not sequential. I also noticed that these assets are missing width, height, and size in the &lt;code&gt;craft_assetfiles&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="7408" LastEditorUserId="7408" LastEditDate="2017-10-24T02:49:56.727" LastActivityDate="2017-10-24T02:49:56.727" Title="&quot;Missing&quot; assets from large S3 asset source" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22479" PostTypeId="1" AcceptedAnswerId="22481" CreationDate="2017-10-19T17:42:33.400" Score="1" ViewCount="38" Body="&lt;p&gt;Recently a user, using the admin panel, triggered a Craft CMS update. I would like to determine which user it was.  Is there any log of these actions where I can check for this?   If it's in craft/storage/runtime/logs/craft.log, can you please tell me what to search for?&lt;/p&gt;&#xA;" OwnerUserId="7421" LastActivityDate="2017-10-19T18:18:41.247" Title="How can I determine which user triggered an update?" Tags="&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22480" PostTypeId="2" ParentId="22474" CreationDate="2017-10-19T18:00:52.673" Score="1" Body="&lt;p&gt;Assuming the person that applied has a text field they entered their email address on in the Guest Entry, then the plugin has an &lt;a href=&quot;https://github.com/craftcms/guest-entries/tree/v1#guestentriessuccess-and-guestentrieserror-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;onSuccess&lt;/code&gt;&lt;/a&gt; event that gets fired when a guest entry is successfully saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could listen to that from another plugin, grab their email address from the custom field, then build an email and programatically send it their way.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-19T18:00:52.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22481" PostTypeId="2" ParentId="22479" CreationDate="2017-10-19T18:18:41.247" Score="0" Body="&lt;p&gt;That one is tricky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't think of anything that gets logged in Craft's log files currently that would help determine that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do keep track of the request IP address in all of our web service logs, so if you wanted to send the domain along with the approximate update time to support@craftcms.com, we could at least send over the IP address the update was triggered from.  That won't help much if the person was sitting behind a proxy/DHCP server, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-19T18:18:41.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22482" PostTypeId="1" CreationDate="2017-10-19T18:33:48.157" Score="2" ViewCount="138" Body="&lt;p&gt;I currently have about 420 products and over 100 of categories to choose from for each products, showing the list of categories and filtering it, works fine, and performance is not too bad when it's also cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do now is show the total number of products for each filter, but it has to update when I select a filter,(on a side note: my filter is currently being done through ajax).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that, with all the number of products and filters, when I get all the total number products for that filter, it gets very query heavy and slow which is not a good user experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to do this, performance wise?&lt;/p&gt;&#xA;" OwnerUserId="6510" LastActivityDate="2017-10-19T18:33:48.157" Title="Filtering products by categories and showing number of products related to selected category" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;&lt;relations&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22483" PostTypeId="2" ParentId="22450" CreationDate="2017-10-19T18:58:33.677" Score="1" Body="&lt;p&gt;It's a little awkward, but the documentation has a note about this: &lt;a href=&quot;https://craftcommerce.com/docs/product-types#automatic-sku-format&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/product-types#automatic-sku-format&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a product does &lt;em&gt;not&lt;/em&gt; have a variant, then you'd just use &lt;code&gt;{slug}&lt;/code&gt;.  If it &lt;em&gt;does&lt;/em&gt; have a variant, then you'd use &lt;code&gt;{product.slug}&lt;/code&gt;.  This should be less awkward in the upcoming Commerce 2 as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-19T18:58:33.677" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22484" PostTypeId="1" CreationDate="2017-10-19T19:47:27.327" Score="0" ViewCount="210" Body="&lt;p&gt;I want to display just a short blurb from each blog entry. I dont know how to display my { entry.blogentry } without having all of the text show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to just show the first 100 characters OR first few lines?&lt;/p&gt;&#xA;" OwnerUserId="7327" LastActivityDate="2017-10-19T20:05:09.743" Title="Display X number of characters from an entry" Tags="&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22485" PostTypeId="2" ParentId="22484" CreationDate="2017-10-19T20:05:09.743" Score="3" Body="&lt;p&gt;You can use the Twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;slice&lt;/a&gt; filter do do this, e.g.: &lt;code&gt;entry.text |slice(0, 100)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want something that looks a little nicer, and you're using the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin, you can use the &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#truncatestringonword&quot; rel=&quot;nofollow noreferrer&quot;&gt;truncateStringOnWord&lt;/a&gt; filter, which will truncate to the number of characters you want, but only on word breaks (and it'll add an …).&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-19T20:05:09.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22486" PostTypeId="2" ParentId="19061" CreationDate="2017-10-19T20:08:09.587" Score="2" Body="&lt;p&gt;I have it working like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First set axios defaults to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;window.axios.defaults.headers.common = {&#xA;    'X-Requested-With': 'XMLHttpRequest'&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your component I use &lt;a href=&quot;https://www.npmjs.com/package/axios#using-applicationx-www-form-urlencoded-format&quot; rel=&quot;nofollow noreferrer&quot;&gt;URLSearchParams()&lt;/a&gt; to convert object to encoded url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example my user login method might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;methods: {&#xA;    login() {&#xA;        var params = new URLSearchParams();&#xA;        params.append(window.csrfTokenName, window.csrfTokenValue);&#xA;        // The rest of the required fields for user login&#xA;        // add the axios.post('/', params) call bellow&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The token stuff is just coming from my _layout.html file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.config.csrfTokenName|e('js') }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.request.csrfToken|e('js') }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="971" LastActivityDate="2017-10-19T20:08:09.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22488" PostTypeId="2" ParentId="22475" CreationDate="2017-10-19T22:26:39.390" Score="1" Body="&lt;h2&gt;EDIT:&lt;/h2&gt;&#xA;&lt;p&gt;I'm so sorry - I messed it up... I rechecked the craft code and I was all the way wrong with the first answer. I hope you had no trouble because of me.&lt;/p&gt;&#xA;&lt;p&gt;The correct answer is this one....&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_SITE_URL_RULES, function(RegisterUrlRulesEvent $event) {&#xA;    $event-&amp;gt;rules['redirect/&amp;lt;action:\w+&amp;gt;'] = 'customer-portal/portal/';&#xA;    $event-&amp;gt;rules['checkout']              = 'customer-portal/portal/checkout';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and in your controller&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function actionIndex(){&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $method = $request-&amp;gt;getParam('action');&#xA;    return $this-&amp;gt;redirect($method);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In order to have access to the backend function you need to make it &amp;quot;public&amp;quot; so you have to include a &lt;code&gt;protected $allowAnonymous = true;&lt;/code&gt; or an array with all functions &lt;code&gt;protected $allowAnonymous = ['functionOne', 'functionTwo'];&lt;/code&gt;&#xA;Your Controller could look like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class UserController extends Controller {&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    // pretend the request is /redirect/foo and we have created the rule &#xA;    // $event-&amp;gt;rules['foo']                    = 'customer-portal/user/foo'; and&#xA;    // $event-&amp;gt;rules['redirect/&amp;lt;action:\w+&amp;gt;']  = 'customer-portal/user/redirect';&#xA;    public function actionRedirect(){&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;        $method = $request-&amp;gt;getParam('action');&#xA;        return $this-&amp;gt;redirect($method);&#xA;    }&#xA;&#xA;    public function actionFoo(){&#xA;        die(&amp;quot;foo&amp;quot;);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Old Post... ignore this&lt;/p&gt;&#xA;&lt;p&gt;&lt;s&gt;It's not a bug, that's the way how craft handles it. Unlike in other cms plugins in craft are not supposed to handle entire frontend page requests in order to render the entire page.&#xA;You can access actions from controllers only via the /action url. Everything else is handled by entries/elements&lt;/p&gt;&#xA;&lt;p&gt;So you'll not be able to achieve what you want since craft tries to access an entry when you don't include an action url. All frontend request without an action url need to be related to an entry/element or a category. So when you try to access &lt;code&gt;/redirect&lt;/code&gt; craft will search for an entry with the slug &lt;code&gt;redirect&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;What you want is the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;creating an entry with the slug &amp;quot;redirect&amp;quot;&lt;/li&gt;&#xA;&lt;li&gt;$entry = Craft::$app-&amp;gt; //your logic to fetch this specific entry&lt;/li&gt;&#xA;&lt;li&gt;$this-&amp;gt;redirect($entry-&amp;gt;url)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;When you want to create a plugin for other people to use it, you have to create a settings page, include a relation field to that and let other people link an entry to the redirect -&amp;gt; you can fetch this entry from your settings and redirect to it.&lt;/p&gt;&#xA;&lt;p&gt;The other thing... &lt;code&gt;$event-&amp;gt;rules['portal/&amp;lt;action&amp;gt;'] = 'customer-portal/portal/&amp;lt;action&amp;gt;';&lt;/code&gt; is wrong.. Take a look at this &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/updating-plugins.md#registersiteroutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;&lt;br&gt;&#xA;&lt;code&gt;$event-&amp;gt;rules['portal/&amp;lt;action:\w+&amp;gt;'] = 'customer-portal/portal/handle-redirect';&lt;/code&gt;&#xA;and in your portalController&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function actionHandleRedirect(){&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $function = &amp;quot;action&amp;quot; . $request-&amp;gt;getParam('action');&#xA;    $this-&amp;gt;$function();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But I would suggest you not to do that and use the craft way to handle these things&lt;/s&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-20T06:44:44.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22489" PostTypeId="1" AcceptedAnswerId="22491" CreationDate="2017-10-20T02:25:53.307" Score="0" ViewCount="425" Body="&lt;p&gt;I have an Entry field (page) as part of my Matrix field (footer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the client selects 5 entries, I want to display them all in my list and not just the first. I can only seem to get my code working with .first or .last. Everything else I try gives me the old &quot;Object of class Craft\ElementCriteriaModel could not be converted to string&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;footlist&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;foottitle&quot;&amp;gt;{{ block.navSection }}&amp;lt;/li&amp;gt;&#xA;        {% if block.type == &quot;footerCategory&quot; %}&#xA;        {% set page = block.page.first() %}&#xA;           &amp;lt;li&amp;gt;{{ page.title }}&amp;lt;/li&amp;gt;&#xA;        {% endif %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My matrix for this list:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fI1Tm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fI1Tm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7327" LastActivityDate="2017-10-20T04:12:35.487" Title="Show all entries from an entry field" Tags="&lt;matrix&gt;&lt;entries-field&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22490" PostTypeId="2" ParentId="22489" CreationDate="2017-10-20T04:04:59.157" Score="1" Body="&lt;p&gt;The elementCriteriaModel is a class/object that handles your search. It's a class that combines multiple methods to fetch entries from your database with an iterable interface on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means: when you receive an entry you get all the queries you need attached to it to pull all the relationship instead of loading all the other entries all the time. So entry.matrix is nothing but database command to pull the other entries which makes craft fast. Otherwise you would take much more time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it short: when you loop through your elementCriteriaModel the method &lt;code&gt;.find()&lt;/code&gt; is executed, that fetches all your entries and return them as an array. The method first() returns only the first element, last() returns only the last element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to pull all you just need to loop block.page&#xA;&lt;code&gt;{% for entry in block.page %}&lt;/code&gt; will to it &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-20T04:04:59.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22491" PostTypeId="2" ParentId="22489" CreationDate="2017-10-20T04:12:35.487" Score="1" Body="&lt;p&gt;I think you'll need to remove the &lt;code&gt;first()&lt;/code&gt; part. Then your twig will look something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;footlist&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;foottitle&quot;&amp;gt;{{ block.navSection }}&amp;lt;/li&amp;gt;&#xA;        {% if block.type == &quot;footerCategory&quot; %}&#xA;            {% set pages = block.page %}&#xA;            {% if pages|length %}&#xA;                {% for page in pages %}&#xA;                    &amp;lt;li&amp;gt;{{ page.title }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            {% end if %}&#xA;        {% endif %}&#xA;    &amp;lt;/li&amp;gt; &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-10-20T04:12:35.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22492" PostTypeId="1" CreationDate="2017-10-20T07:20:00.847" Score="1" ViewCount="71" Body="&lt;p&gt;I've just changed my local development environment from using &lt;code&gt;.local&lt;/code&gt; domains to &lt;code&gt;.localhost&lt;/code&gt; (no more DNS trouble on MacOS, yay!).&lt;br&gt;&#xA;So I set Crafts &lt;code&gt;siteUrl&lt;/code&gt; to &lt;code&gt;.localhost&lt;/code&gt;, and while Craft serves pages that link correctly, my images still point to the old URLs. How's that and what to do now?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are mostly served like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;picture class=&quot;site-logo&quot;&amp;gt;&#xA;  &amp;lt;source&#xA;    srcset=&quot;{{ branding.logo.first().url('small') }}&quot;&#xA;    media=&quot;(min-width: 100px)&quot;&#xA;  &amp;gt;&#xA;  &amp;lt;img src=&quot;{{ branding.logo.first().url('large') }}&quot; alt=&quot;{{ siteName }}&quot;&amp;gt;&#xA;&amp;lt;/picture&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7275" LastActivityDate="2017-10-21T09:58:48.467" Title="Assets have old URL" Tags="&lt;assets&gt;&lt;url&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22493" PostTypeId="2" ParentId="22492" CreationDate="2017-10-20T07:27:59.170" Score="1" Body="&lt;p&gt;Good lord, this is embarrassing. For some reason I had a static URL in the asset source configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; To provide at least a little value to others finding this: If you configure your asset sources, make sure the not use full URLs in the URL field.&lt;br&gt;&#xA;So, instead of &lt;code&gt;https://example.com/images/&lt;/code&gt; use &lt;code&gt;/images&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7275" LastEditorUserId="7275" LastEditDate="2017-10-21T09:58:48.467" LastActivityDate="2017-10-21T09:58:48.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22494" PostTypeId="1" CreationDate="2017-10-20T09:53:29.907" Score="1" ViewCount="77" Body="&lt;p&gt;using the contactForm plugin, I want to make a contact form, that sends to an email address of the users choosing, not the email set up in the admin.&#xA;Does anyone know the simplest way of doing this?&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-10-20T10:30:36.350" Title="Send to a friend that sends an email to a defined email of the users choosing" Tags="&lt;form&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22495" PostTypeId="2" ParentId="22494" CreationDate="2017-10-20T10:30:36.350" Score="1" Body="&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;input&quot; name=&quot;toEmail&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1#dynamically-adding-email-recipients-requires-craft-25&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/tree/v1#dynamically-adding-email-recipients-requires-craft-25&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-20T10:30:36.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22497" PostTypeId="1" CreationDate="2017-10-20T13:31:13.830" Score="1" ViewCount="249" Body="&lt;p&gt;I'm in the middle of learning Craft Commerce.  When I go to an individual product my URL says &lt;code&gt;/shop/wella-shampoo/&lt;/code&gt;.  I'd like it to say &lt;code&gt;/shop/**hair-care**/wella-shampoo/&lt;/code&gt; because this is the category this product falls into.&lt;/p&gt;&#xA;&lt;p&gt;I've tried adding &lt;code&gt;shop/{categories.first().slug}/{slug}&lt;/code&gt; to the URL Format but I get the following error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Internal Server Error&lt;/p&gt;&#xA;&lt;p&gt;Craft\Commerce_ProductModel and its behaviors do not have a method or closure named &amp;quot;categories&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="189" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-11-25T00:55:48.287" Title="Get the category into the url of the product page" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;&lt;url&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22498" PostTypeId="1" AcceptedAnswerId="22516" CreationDate="2017-10-20T14:01:55.553" Score="2" ViewCount="517" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;AM Forms&lt;/a&gt; on a site that I've built. The site is now in production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via the &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;AM Forms&lt;/a&gt; notifications settings, the email I've entered for &lt;strong&gt;Email recipients&lt;/strong&gt; and &lt;strong&gt;Sender email address notification email&lt;/strong&gt; is an email which is hosted with &lt;a href=&quot;https://gsuite.google.com/together/&quot; rel=&quot;nofollow noreferrer&quot;&gt;G Suite&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct in thinking that these notifications are being sent via Craft's email settings (currently PHP Mail)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;G Suite is running DKIM, SPF and DMARC, so the PHP Mail protocol is not the best method for receiving these notifications. If I change Craft's email protocol to GMail, how safe are the credentials I enter and are they encrypted?&lt;/p&gt;&#xA;" OwnerUserId="7160" LastActivityDate="2017-10-20T23:28:20.010" Title="Sending email from GMail protocol" Tags="&lt;emails&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22500" PostTypeId="1" CreationDate="2017-10-20T14:24:46.293" Score="1" ViewCount="120" Body="&lt;p&gt;I have an adjuster that calculates shipping cost which I can see when I view the order in the backend. The problem is that the shipping adjustment is not being added to the total price. Any help would be GREATLY appreciated. &lt;/p&gt;&#xA;" OwnerUserId="6185" LastActivityDate="2018-03-22T11:55:10.027" Title="Shipping Adjustment not being added to Total Price" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22501" PostTypeId="1" AcceptedAnswerId="22514" CreationDate="2017-10-20T15:00:08.353" Score="1" ViewCount="540" Body="&lt;p&gt;I'm trying to use &lt;a href=&quot;https://github.com/radarseven/Craft-Twig-ImageBase64&quot; rel=&quot;nofollow noreferrer&quot;&gt;this plugin&lt;/a&gt;, but it requires an &lt;code&gt;AssetFileModel&lt;/code&gt; as input. I can pass it the asset in question, no problem, but I'm wanting to pass it a transformed version of the asset. However, it seems like there's no way in Craft to pass a transformed image as an &lt;code&gt;AssetFileModel&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = assetField.first() %}&#xA;&#xA;{# Doesn't work; `image.url({width: 40})` outputs a URL as a string, not an AssetFileModel #}&#xA;{% set imageTiny = image.url({ width: 40 }) | image64(true) %}&#xA;&#xA;&amp;lt;div style=&quot;background: url({{ imageTiny }});&quot;&amp;gt;...&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The desired result is for a base64-encoded string of the tiny, 40px-wide image to be output in the HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2017-10-20T22:02:47.310" Title="How can I base64-encode an Image Transform?" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;assetfilemodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22502" PostTypeId="2" ParentId="22501" CreationDate="2017-10-20T15:30:27.727" Score="2" Body="&lt;p&gt;It's not going to work with this particular plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;        // Require an instance of `AssetFileModel`&#xA;        if (! $asset instanceof AssetFileModel)&#xA;        {&#xA;            // Die quietly.&#xA;            return false;&#xA;        }&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It specifically checks the parameter that you pass in, and expects it to be an &lt;code&gt;AssetFileModel&lt;/code&gt;. It wouldn't be too hard to modify the plugin to work for your use-case, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see what you're trying to do; if you're using Craft 3, you could use the &lt;a href=&quot;https://github.com/nystudio107/craft3-imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageOptimize&lt;/a&gt; plugin to do it for you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-20T15:30:27.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22504" PostTypeId="1" CreationDate="2017-10-20T16:01:15.077" Score="3" ViewCount="121" Body="&lt;p&gt;Has anyone migrated a Blogger site to CraftCMS? I'd like to migrate comments and posts. What is the best way to go about this? Could I import my site to Wordpress and then to Craft?&lt;/p&gt;&#xA;" OwnerUserId="7425" LastActivityDate="2017-10-20T16:31:35.330" Title="Migrating my Blogger site to CraftCMS" Tags="&lt;migration&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22505" PostTypeId="2" ParentId="22504" CreationDate="2017-10-20T16:09:18.477" Score="4" Body="&lt;p&gt;I migrated a Blogger site by writing a Craft plugin to parse Blogger's XML and save images, posts, and categories into the Craft setup established with the client. The challenge with Craft is that last part: &lt;em&gt;you're&lt;/em&gt; the one deciding how things will work, the CMS doesn't come with opinions about how your blog posts will be constructed or organized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt; or &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; plugins to migrate your Blogger data, but you'll still need to set up your blog in Craft and decide how to map the Blogger data to your Craft install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comments are another animal. It may be easiest to move them to &lt;a href=&quot;https://disqus.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Disqus&lt;/a&gt;. I've not used &lt;a href=&quot;https://github.com/verbb/comments&quot; rel=&quot;nofollow noreferrer&quot;&gt;this comment plugin&lt;/a&gt;, but expect it would be solid.&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="22" LastEditDate="2017-10-20T16:31:35.330" LastActivityDate="2017-10-20T16:31:35.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22506" PostTypeId="1" CreationDate="2017-10-20T16:41:59.340" Score="4" ViewCount="632" Body="&lt;p&gt;I want to be able to delete assets that are not linked to. I have adapted the following code from previous examples of this kind of thing, but it doesn't seem to pick up all the related entries, just some of them. Some photos do not show a related entry but if I go to the entry where I think it might have been used it is still in use. Am I missing something in matching the entries to the assets?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set photos = craft.assets.kind('image') %}&#xA;{% for photo in photos %}&#xA;    &amp;lt;img src=&quot;{{ photo.getUrl('square') }}&quot;&amp;gt;&#xA;    &amp;lt;br&amp;gt;{{ photo.filename }} / {{ photo.folderId }}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {# Loop throught entries related to this asset #}&#xA;        {% for entry in craft.entries.relatedTo(photo).order('title') %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried using the &lt;a href=&quot;https://github.com/born05/craft-assetusage&quot; rel=&quot;nofollow noreferrer&quot;&gt;assetusage plugin&lt;/a&gt; but it doesn't seem to work with non images and I also wanted to test if it was working properly.&#xA;I also looked at the &lt;a href=&quot;https://github.com/weareboxhead/Craft-Asset-Use&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset-Use plugin&lt;/a&gt; but that is beta and only does images.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2017-10-21T16:45:59.710" Title="How to find out which assets are being used" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22509" PostTypeId="1" AcceptedAnswerId="22522" CreationDate="2017-10-20T19:47:15.023" Score="2" ViewCount="1293" Body="&lt;p&gt;I'm working on a simple plugin to facilitate front-end, anonymous lead generation forms submitted to Salesforce via cURL to it's Web-to-Lead servlet. The logic and data transfer are working (debug showing positive receipt of the query from the servlet), but no matter what the :success function on the $.ajax call isn't triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting a 200 OK back from the cURL, so my assumption is that the :error function is being triggered because the result isn't properly formatted JSON. I'm calling the returnJson function from the baseController, however all I can see in the response object is &quot;responseText&quot; with the raw HTML of the servlet response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller PHP&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $allowAnonymous = array('actionPostLead');&#xA;&#xA;public function actionPostLead()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    // Initialize the $kv array and query var for later use&#xA;    $kv = array();&#xA;    $query_string = '';&#xA;&#xA;    //If there are POST variables&#xA;    if ($_POST) {&#xA;&#xA;        // For each POST variable as $name_of_input_field =&amp;amp;amp;gt; $value_of_input_field&#xA;        foreach ($_POST as $key =&amp;gt; $value) {&#xA;&#xA;            // Set array element for each POST variable (ie. first_name=Arsham)&#xA;            $kv[] = stripslashes($key).'='.stripslashes($value);&#xA;        }&#xA;&#xA;        // Create a query string with join function separted by &amp;amp;amp;amp;&#xA;        $query_string = join('&amp;amp;', $kv);&#xA;    }&#xA;&#xA;    // Check to see if cURL is installed ...&#xA;    if (!function_exists('curl_init')) {&#xA;        die('Sorry cURL is not installed!');&#xA;    }&#xA;&#xA;    // The original form action URL from Step 2 :)&#xA;    $url = 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';&#xA;&#xA;    // Open cURL connection&#xA;    $ch = curl_init();&#xA;&#xA;    // Set the url, number of POST vars, POST data&#xA;    curl_setopt($ch, CURLOPT_URL, $url);&#xA;    curl_setopt($ch, CURLOPT_POST, count($kv));&#xA;    curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);&#xA;&#xA;    // Execute SalesForce web to lead PHP cURL&#xA;    $result = curl_exec($ch);&#xA;&#xA;    // close cURL connection&#xA;    curl_close($ch);&#xA;&#xA;    if ($result) {&#xA;        $this-&amp;gt;returnJson(array('success' =&amp;gt; true));&#xA;    } else {&#xA;        $this-&amp;gt;returnErrorJson($e-&amp;gt;getMessage());&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Javascript&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    type: 'POST',&#xA;    url: '/',&#xA;    data: data,&#xA;    dataType: 'json',&#xA;    success: function(response) {&#xA;&#xA;        formBlock.removeClass('submitting');&#xA;        var successMessage = $('.formBlock.on').data('success-message');&#xA;        showFormSuccessBanner(successMessage);&#xA;        hideForm(id);&#xA;    },&#xA;    error: function(err) {&#xA;        console.log(&quot;Error&quot;);&#xA;        console.log(err);&#xA;&#xA;        formBlock.removeClass('submitting');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I'm close, but I've been digging for several hours and can't figure out what I'm doing wrong with the response.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2017-10-21T17:32:49.527" Title="JQuery $.ajax &quot;:success&quot; form logic with Plugin Controller?" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;json&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22510" PostTypeId="1" CreationDate="2017-10-20T20:19:25.197" Score="1" ViewCount="172" Body="&lt;p&gt;&lt;code&gt;session_regenerate_id(): Session object destruction failed&lt;/code&gt; is the error i'm receiving after attempting to log in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just updated to Ubuntu 16.04LTS using PHP7 and php-memcached. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a fix for this in a craft version? I'm on version 2.6.2791 and this behavior is still broken. I cannot seem to find a workaround besides overwriting Yii with a workaround myself.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2017-10-23T15:00:22.517" Title="Craft login problem with memcache and ubuntu?" Tags="&lt;php&gt;&lt;session&gt;&lt;yii&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22511" PostTypeId="1" AcceptedAnswerId="22524" CreationDate="2017-10-20T20:56:40.557" Score="1" ViewCount="655" Body="&lt;p&gt;I set up a quick and dirty migration to add two columns to two tables. These are to be basically boolean 1/0 switch fields. I'm setting up my migration file as follows, note the 'not null' in both column types:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class m171020_153541_grnplatform_AutoRenewUpdate extends BaseMigration&#xA;{&#xA;    public function safeUp()&#xA;    {&#xA;&#xA;        $this-&amp;gt;addColumn('grnplatform_payment_cards', 'expireNotified', &quot;tinyint(1) unsigned NOT NULL DEFAULT '0'&quot;);&#xA;        $this-&amp;gt;addColumn('grnplatform_subscriptions', 'failedRenew', &quot;tinyint(1) unsigned NOT NULL DEFAULT '0'&quot;);&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    public function safeDown() {&#xA;&#xA;        $this-&amp;gt;dropColumn('grnplatform_payment_cards', 'expireNotified');&#xA;        $this-&amp;gt;dropColumn('grnplatform_subscriptions', 'failedRenew');&#xA;&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However after the migration runs, my &lt;code&gt;show create table&lt;/code&gt; command yields this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE `craft_grnplatform_subscriptions` (&#xA;  `id` int(11) NOT NULL,&#xA;  `userId` int(11) NOT NULL,&#xA;  `active` tinyint(1) unsigned NOT NULL DEFAULT '1',&#xA;  `renewalPeriod` enum('monthly','quarterly','yearly') COLLATE utf8_unicode_ci DEFAULT NULL,&#xA;  `autoRenew` tinyint(1) unsigned NOT NULL DEFAULT '0',&#xA;  `lastRenewal` date NOT NULL,&#xA;  `nextRenewal` date NOT NULL,&#xA;  `failedRenew` tinyint(1) unsigned DEFAULT '0',&#xA;  `dateCreated` datetime NOT NULL,&#xA;  `dateUpdated` datetime NOT NULL,&#xA;  `uid` char(36) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',&#xA;  PRIMARY KEY (`id`),&#xA;  UNIQUE KEY `craft_grnplatform_subscriptions_userId_unq_idx` (`userId`),&#xA;  KEY `craft_grnplatform_subscriptions_nextRenewal_idx` (`nextRenewal`),&#xA;  CONSTRAINT `FK_craft_grnplatform_subscriptions_craft_grnplatform_vendor_data` FOREIGN KEY (`userId`) REFERENCES `craft_grnplatform_vendor_data` (`userId`) ON DELETE CASCADE,&#xA;  CONSTRAINT `craft_grnplatform_subscriptions_id_fk` FOREIGN KEY (`id`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE,&#xA;  CONSTRAINT `craft_grnplatform_subscriptions_userId_fk` FOREIGN KEY (`userId`) REFERENCES `craft_users` (`id`) ON DELETE CASCADE&#xA;) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice how the &quot;not null&quot; is missing from the column declaration for 'failedRenew`...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can get set the NOT NULL value on a column I'm adding from a migration?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-10-27T00:46:24.457" Title="Plugin DB migration add &quot;not null&quot; column" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22512" PostTypeId="2" ParentId="22510" CreationDate="2017-10-20T21:01:29.220" Score="1" Body="&lt;p&gt;I saw a few work arounds for this here, hopefully it helps:&#xA;&lt;a href=&quot;https://github.com/yiisoft/yii/issues/2376&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/yiisoft/yii/issues/2376&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-10-20T21:01:29.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22513" PostTypeId="2" ParentId="22511" CreationDate="2017-10-20T21:28:36.113" Score="2" Body="&lt;p&gt;This looks like it could be a Yii issue, if a rather occluded one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how it is in another framework: &lt;a href=&quot;https://github.com/metabase/metabase/issues/3506&quot; rel=&quot;nofollow noreferrer&quot;&gt;MySQL TINYINT(1) columns are always interpreted as booleans #3506&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is a pointedly uncertain link with link, on a quite confused Yii discussion circling around this: &lt;a href=&quot;https://github.com/yiisoft/yii2/issues/1099#issuecomment-27363543&quot; rel=&quot;nofollow noreferrer&quot;&gt;It is already documented that tinyint(1) would be treated as boolean&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think it is actually doc'd so -- actually it's the other way around. But doc may not tell all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest making the def tinyint(2) and see if it cures...good fortune...&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2017-10-20T21:35:12.873" LastActivityDate="2017-10-20T21:35:12.873" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22514" PostTypeId="2" ParentId="22501" CreationDate="2017-10-20T22:02:47.310" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = assetField.first().setTransform({width: 40}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should return an &lt;code&gt;AssetFileModel&lt;/code&gt;, allowing you to do &lt;code&gt;{{ image64(image) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to reuse the image with other transforms later, you might have to do some magic / use different variables.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-10-20T22:02:47.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22515" PostTypeId="2" ParentId="14647" CreationDate="2017-10-20T22:20:20.453" Score="2" Body="&lt;p&gt;If this memcache cluster is purely for craft caching you could consider using redis instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found both the old and newer memcache implementations in php to be flaky, but those are personal experiences without any scientific proofs backing them.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-10-20T22:20:20.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22516" PostTypeId="2" ParentId="22498" CreationDate="2017-10-20T23:28:20.010" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Am I correct in thinking that these notifications are being sent via Craft's email settings (currently PHP Mail)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably.  There are &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;plenty of other reasons&lt;/a&gt; to not use PHP Mail on a production environment, though.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I change Craft's email protocol to GMail, how safe are the credentials I enter and are they encrypted?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you select the &quot;GMail&quot; as an email delivery method in Craft, Craft sets the SMTP hostname to smtp.gmail.com, forces SMTP authentication over SSL over port 465 and passes in the given username/password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No encryption is done because SSL is used, so the credentials are as safe as SSL is.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-20T23:28:20.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22517" PostTypeId="1" AcceptedAnswerId="32957" CreationDate="2017-10-21T08:39:58.370" Score="1" ViewCount="593" Body="&lt;p&gt;Is it possible to retrieve a control panel defined imagetransform’s dimensions in a front-end template without having to retrieve an asset? Because when there is no asset provided, I can't seem to find a (dynamic) way to get the width and height of the transform in order to calculate dimensions for a placeholder div&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2019-11-07T14:45:33.643" Title="Get a defined image-transform's width and height in front-end template" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22518" PostTypeId="1" AcceptedAnswerId="22519" CreationDate="2017-10-21T09:47:40.357" Score="1" ViewCount="63" Body="&lt;p&gt;I have a matrix block called team that has an assets field within it that has all of the companies headshots. However, there are more than 30 images, but the design is to only have 6 showing on load, and then on click of a load more button the next 6 will show, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure how to achieve this within a matrix block as all the examples I've seen elsewhere are for pages and sections. But I just need to load the images from within the matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my code for the images. Can someone help?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for headshot in block.headshots %}&#xA;&amp;lt;figure class=&quot;team__headshots&quot;&amp;gt;&#xA;  {% if headshot | length %}&#xA;  {% set transformedImages = craft.imager.transformImage(headshot,&#xA;      [&#xA;          { width: 180, ratio: 4/5 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          jpegQuality: 80,&#xA;          position: headshot.focalPoint,&#xA;          interlace: true&#xA;      }&#xA;  ) %}&#xA;  {% set tabletl = craft.imager.transformImage(headshot,&#xA;      [&#xA;          { width: 142, ratio: 4/5 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          jpegQuality: 80,&#xA;          position: headshot.focalPoint,&#xA;          interlace: true&#xA;      }&#xA;  ) %}&#xA;  {% set tabletp = craft.imager.transformImage(headshot,&#xA;      [&#xA;          { width: 230, ratio: 4/5 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          jpegQuality: 80,&#xA;          position: headshot.focalPoint,&#xA;          interlace: true&#xA;      }&#xA;  ) %}&#xA;  {% set mobile = craft.imager.transformImage(headshot,&#xA;      [&#xA;          { width: 360, ratio: 4/5, jpegQuality: 65 },&#xA;      ],&#xA;      {&#xA;          format: 'jpg',&#xA;          allowUpscale: false,&#xA;          mode: 'crop',&#xA;          position: headshot.focalPoint,&#xA;          interlace: true&#xA;      }&#xA;  ) %}&#xA;  &amp;lt;picture&amp;gt;&#xA;  &amp;lt;source srcset=&quot;{{ craft.imager.srcset(mobile) }}&quot; media=&quot;(max-width: 767px)&quot;&amp;gt;&#xA;  &amp;lt;source srcset=&quot;{{ craft.imager.srcset(tabletp) }}&quot; media=&quot;(min-width: 768px) and (max-width: 991px)&quot;&amp;gt;&#xA;  &amp;lt;source srcset=&quot;{{ craft.imager.srcset(tabletl) }}&quot; media=&quot;(min-width: 992px) and (max-width: 1199px)&quot;&amp;gt;&#xA;  &amp;lt;img class=&quot;img-responsive&quot;&#xA;       src=&quot;{{ transformedImages[0].url }}&quot;&#xA;       sizes=&quot;(min-width: 768px) 33.3vw, 50vw&quot;&#xA;       alt=&quot;{% if headshot.altTag|length %}{{ headshot.altTag }}{% else %}{{ headshot.title }}{% endif %}&quot;&#xA;       width=&quot;100%&quot;&amp;gt;&#xA;  &amp;lt;/picture&amp;gt;&#xA;  {% endif %}&#xA;  &amp;lt;div class=&quot;team__headshots-overlay&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;team__headshots-captions&quot;&amp;gt;&#xA;      &amp;lt;h4&amp;gt;{{ headshot.title }}&amp;lt;/h4&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{ headshot.jobTitle }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/figure&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastEditorUserId="5557" LastEditDate="2017-10-21T12:24:14.360" LastActivityDate="2017-10-21T12:40:43.157" Title="Load more images in matrix block" Tags="&lt;matrix&gt;&lt;search&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22519" PostTypeId="2" ParentId="22518" CreationDate="2017-10-21T10:56:11.220" Score="2" Body="&lt;p&gt;Your &lt;code&gt;block.headshots&lt;/code&gt; is not an array of all images, you have to understand what craft does in order to work properly with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;block.headshots&lt;/code&gt; and all other relations (Matrix elements, images, category links...) are all &lt;code&gt;elementCriteriaModels&lt;/code&gt; so instead of having an array of objects - your &lt;code&gt;block.headshots&lt;/code&gt; is just a single object that has an iterator interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you execute &lt;code&gt;{% for headshot in block.headshots %}&lt;/code&gt; it performs the &lt;code&gt;.find()&lt;/code&gt; function and returns an array.&#xA;Unfortunately I'm not on my computer currently so I can't provide the exact code so maybe the syntax of something of the following might be wrong, but if you know how to search entries with &lt;code&gt;craft.entries.find()&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel#find-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt; you can correct it, here you have more examples &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;elementCriteriaModel&lt;/a&gt;. Your code should look like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for headshot in block.headshots.find({limit: 10}) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not matter if you are searching pages (entries), assets, matrix blocks, sections, categories or whatever.. Craft does always the same, building an elementCriteriaModel that is executed as soon as you loop through it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: your controller to load the assets could look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionLoadAssets(){&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;    $response = array(&#xA;        'success'   =&amp;gt; false,&#xA;        'message'   =&amp;gt; ''&#xA;    );&#xA;&#xA;    // config how many entries should be loaded&#xA;    $config = craft()-&amp;gt;globals-&amp;gt;getSetByHandle('config');&#xA;    $limit = $config['countReloadImages'];&#xA;    // offset.. how many did we load already&#xA;    $offset = craft()-&amp;gt;request-&amp;gt;getPost('offset');&#xA;    // which block is it&#xA;    $matrixIndex = craft()-&amp;gt;request-&amp;gt;getPost('matrixIndex');&#xA;    // entryId&#xA;    $entryId = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;&#xA;    if($entry = craft()-&amp;gt;elements-&amp;gt;getElementById($entryId)){&#xA;        // search for the correct field -&amp;gt; we just insert an offset&#xA;        // this is untested, maybe you have to play around with the correct number&#xA;        // I'm not sure if you can just send the id of the matrixfield and use 'id' =&amp;gt; $matrixIndex&#xA;        // you could to try it out...&#xA;        $matrix = $entry-&amp;gt;team-&amp;gt;find([&#xA;            'offset'    =&amp;gt; $matrixIndex&#xA;        ]);&#xA;        $html = '';&#xA;        if($matrix &amp;amp;&amp;amp; ($assets = $matrix-&amp;gt;headshot-&amp;gt;find(['offset' =&amp;gt; $offset, 'limit' =&amp;gt; $limit]))){&#xA;            // build a template to render the images, you'll return the html&#xA;            $html = $this-&amp;gt;renderTemplate('some tempalte here', array(&#xA;                'asset' =&amp;gt; $assets&#xA;            ));&#xA;        }&#xA;        // you could include your logic if you found less entries than configured ($limit) and return a &quot;hide reload button&quot;&#xA;        $response['html'] = $html;&#xA;        $response['success'] = true;&#xA;    }else{&#xA;        $response['message'] = Craft::t('could not find entry with Id ' . $entryId);&#xA;    }&#xA;&#xA;    return $response;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit2: I found a better solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionLoadMore(){&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;    // id of your field headtshot&#xA;    $field = craft()-&amp;gt;fields-&amp;gt;getFieldById(5);&#xA;&#xA;    $criteria-&amp;gt;relatedTo = array(&#xA;        'sourceElement' =&amp;gt; //your matrix ID,&#xA;        'field'         =&amp;gt; $field-&amp;gt;id&#xA;    );&#xA;    $criteria-&amp;gt;offset = //your offset;&#xA;    $criteria-&amp;gt;limit = //your limit;&#xA;    $assets = $criteria-&amp;gt;find();&#xA;&#xA;    // render template -&amp;gt; return html look at the first example&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-21T12:40:43.157" LastActivityDate="2017-10-21T12:40:43.157" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22520" PostTypeId="2" ParentId="22517" CreationDate="2017-10-21T12:59:37.707" Score="1" Body="&lt;p&gt;Craft does not provide the assetTransformService in the craft.variable but you can include it by yourself.&#xA;Create a function in your PluginVariable.php that does&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTransformationByHandle($handle){&#xA;    return craft()-&amp;gt;assetTransforms-&amp;gt;getTransformByHandle($handle);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in your twig template&lt;br&gt;&#xA;&lt;code&gt;{% set transformation = craft.pluginHandle.getTransformationByHandle('yourHandle') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: if you don't have a custom plugin then visit this page &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory&lt;/a&gt; fill out the inputs and select the lightswitch for &quot;variable&quot; paste my function into the &lt;code&gt;/variables/pluginHandleVariable.php&lt;/code&gt; file and create a folder with the same name as your pluginhandle (the one you inserted in the input at the page) in &lt;code&gt;/app/plugins/&lt;/code&gt; then go to the control panel, install the plugin.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-21T13:11:59.707" LastActivityDate="2017-10-21T13:11:59.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22521" PostTypeId="2" ParentId="22506" CreationDate="2017-10-21T16:45:59.710" Score="1" Body="&lt;p&gt;Create this function in your plugins variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllIds(){&#xA;    return craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;select('id')-&amp;gt;from('elements')-&amp;gt;where([&#xA;        'not like', 'type', 'Asset'&#xA;    ])-&amp;gt;queryColumn();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll fetch all ids in Craft, then you can to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allIds = craft.your-plugin-handle.getAllIds() %}&#xA;&#xA;{% set usedAssets = craft.assets({&#xA;    relatedTo: allIds,&#xA;    limit: null,&#xA;}).ids() %}&#xA;&#xA;{% set unusedAssets = craft.assets({&#xA;    id: 'and, not ' ~ usedAssets|join(', not '),&#xA;    limit: null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To be honest I'm not sure what the error is in your code. You should get all entries related to the asset, even if they are in a matrix block. Maybe you related to asset to a category and this category to an entry and you assume to get the entry(?)&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-21T16:45:59.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22522" PostTypeId="2" ParentId="22509" CreationDate="2017-10-21T17:32:49.527" Score="2" Body="&lt;p&gt;The issue was that curl was, by default, returning the result of the http request to the WebToLead servlet directly, rather than only storing it as $result. This raw HTML response was super-ceding the returnJson() response, resulting in an error in jQuery's ajax function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To force PHP curl to echo the result rather than return it, you need to set a curl option for &lt;code&gt;CURLOPT_RETURNTRANSFER&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt;. Revised as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set the url, number of POST vars, POST data&#xA;curl_setopt($ch, CURLOPT_URL, $url);&#xA;curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE  );&#xA;curl_setopt($ch, CURLOPT_POST, count($kv));&#xA;curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns just the JSON response from the function in Craft's baseController, and therefore a successful response to jQuery.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2017-10-21T17:32:49.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22524" PostTypeId="2" ParentId="22511" CreationDate="2017-10-22T03:06:26.253" Score="2" Body="&lt;p&gt;Here's a completed answer, while leaving the information from the initial foray, as it could give useful leads in other cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is indeed a Craft bug, reported there as issue &lt;a href=&quot;https://github.com/craftcms/cms/issues/2044&quot; rel=&quot;nofollow noreferrer&quot;&gt;#2044&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in DbHelper isn't quite reckoning correctly if you use a string definition for a column $type. The specific problem in this case is the small code block starting at line 223. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This improperly adds an extra 'null' at the end of the original string, which in turn gets complicated by flonkey default behaviors of MySql, in the way of some mentioned in the earlier post, for a thoroughly confusing improper result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until corrected, you can bypass the problems by instead specifying the $type definition as an array: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $type = array(&#xA;            'column' =&amp;gt; 'tinyint',&#xA;            'length' =&amp;gt; '1',&#xA;            'unsigned' =&amp;gt; 'true',&#xA;            'required' =&amp;gt; 'true',&#xA;            'default' =&amp;gt; '1',&#xA;        );&#xA;&#xA;        $this-&amp;gt;addColumn('craft_grnplatform_subscriptions ', 'failedRenew', $type);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Resulting DDL read back from the database:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        `failedRenew` tinyint(1) unsigned NOT NULL DEFAULT '1',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same means can be used for other types which may run into problems with DbHelper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A look through Craft 3's handling suggests this problem won't be present there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N.B. Another problem was later noticed, so you'll want use only the SQL string method if you are defining a private key (pk), as an array would likely fail there.  This should be fixed also when the posted issue is resolved.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2017-10-27T00:46:24.457" LastActivityDate="2017-10-27T00:46:24.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22526" PostTypeId="1" CreationDate="2017-10-22T05:03:17.447" Score="0" ViewCount="369" Body="&lt;p&gt;I’m a would-be first-time Craft user. I’m trying to set up a first trial site but not having much success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve been trying to install Craft CMS on my host provider’s server. I use SmartHosting/Krystal as hosting provider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve gone through the install instructions and get as far as step three. On step three it blinks on ‘Installing Craft CMS’ for about half a second before changing to ‘Oops.’  With the circular timer beneath, it just stays on this “forever”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I search for this issue, there are quite a few mentions of this being a problem with Dreamhost (hosting service provider) so I have taken this up with my service provider in case it’s a similar issue. They have tried the same installation procedure on my behalf and get the same problem.  Their last reply to me is as below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me solve my install problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;+++++&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having spent some time on this for you I'm not entirely sure what's causing this issue. the CraftCMS system isn't outputting any PHP errors and I can't see any errors on the server logs either. Progressing this I'd have to recommend reaching out to craftcms support to find out if there's any known issues or if they can assist in debugging this issue for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;++++&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS One possibility is that the install did work after all and the oops message is erroneous. Is there a simple way to find out if it did in fact work OK?&lt;/p&gt;&#xA;" OwnerUserId="6481" LastActivityDate="2017-11-25T23:03:46.710" Title="Can't install - Oops at step three" Tags="&lt;error&gt;&lt;install&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="22527" PostTypeId="1" AcceptedAnswerId="22529" CreationDate="2017-10-22T12:42:51.683" Score="1" ViewCount="240" Body="&lt;p&gt;I have a channel set up with front end submitted entries. I want a way for users to be able to subscribe themselves to receive an update whenever the entry (or it's related entries) are updated. I was thinking one way to so this so that it can be managed on the front end would be to add a Users field to the entry and let logged in users add themselves to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a simple notification service that I am using in a custom plugin that is sending emails to entry authors, but I'm not sure how, or what would be the best way to send emails to multiple users as per the above requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(p.s I'm new and limited in my plugin knowledge!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts or suggestions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2017-10-22T16:13:30.747" Title="Plugin sending emails to all users in an entries Users field" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22528" PostTypeId="1" CreationDate="2017-10-22T13:31:32.020" Score="0" ViewCount="66" Body="&lt;p&gt;Ok, so this is pretty bizarre... Entries from 2016 are NOT displaying when searched for in the admin panel. Whether we search by the year, title, or part of the title&lt;strike&gt;, until they're edited (using the id to access them)&lt;/strike&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see entries from 2015 and 2017 but only a few from 2016 which&lt;strike&gt;, as I said, are the ones we managed to edit&lt;/strike&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens in the list of entries as well as on fields that link to them and we've got LOTS of entries...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE - Check this out:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Articles listed from December 2016:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/o0rmkiazm436etb/Screenshot%202017-10-22%2009.16.07.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/o0rmkiazm436etb/Screenshot%202017-10-22%2009.16.07.png&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Searching for name of article:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/ydwilwz6pye1jb4/Screenshot%202017-10-22%2009.16.44.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/ydwilwz6pye1jb4/Screenshot%202017-10-22%2009.16.44.png&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Searching for year 2016, bottom of results, all 2015 and 2017:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/w7imwnnfyrnjjri/Screenshot%202017-10-22%2009.17.15.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/w7imwnnfyrnjjri/Screenshot%202017-10-22%2009.17.15.png&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If i access the article highlighted on screenshot 1, via URL:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/opdv12hpyz993z4/Screenshot%202017-10-22%2009.20.50.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/opdv12hpyz993z4/Screenshot%202017-10-22%2009.20.50.png&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The articles are there, they're accessible from the user end, but for some reason they won't show up on the Admin side. Bizarre...&lt;/p&gt;&#xA;" OwnerUserId="47" LastEditorUserId="47" LastEditDate="2017-10-23T12:48:21.287" LastActivityDate="2017-10-24T09:29:12.770" Title="Entries from previous year 2016 not displaying" Tags="&lt;search&gt;&lt;entries-field&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22529" PostTypeId="2" ParentId="22527" CreationDate="2017-10-22T15:10:57.100" Score="3" Body="&lt;p&gt;If you have questions or other issues feel free to ask.&lt;br&gt;&#xA;Please don't be confused, my Plugins handle/name is &quot;Test&quot; because I only use it for these purposes.. So whenever you see the name &quot;Test&quot; you know you have to rename it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is your plugins init function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Called after the plugin class is instantiated; do any one-time initialization here such as hooks and events:&#xA; * @return mixed&#xA; */&#xA;public function init()&#xA;{&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;    {&#xA;        // trigger only when entries are changed not when created&#xA;        if(!$event-&amp;gt;params['isNewEntry']){&#xA;            /** @var EntryModel $entry */&#xA;            $entry = $event-&amp;gt;params['entry'];&#xA;            // create your logic to check if it is the correct entry...&#xA;            // you should check for your section here otherwise you'll send a mail for all updates^^&#xA;            // I just used the handle pages in my test system&#xA;            if($entry-&amp;gt;getSection()-&amp;gt;handle === &quot;pages&quot;){&#xA;                // next: fetch all user related to the entry...&#xA;                // since I don't know your entire fields, you have to implement the logic&#xA;                // to fetch users from entries that are related to the entry yourself&#xA;                // if you need help just ask&#xA;                $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::User);&#xA;                $criteria-&amp;gt;relatedTo($entry);&#xA;&#xA;                /** @var UserModel $user */&#xA;                foreach( $criteria as $user){&#xA;                    // create a new entry in the database&#xA;                    $email = new Test_EmailRecord();&#xA;                    $email-&amp;gt;entryId = $entry-&amp;gt;id;&#xA;                    $email-&amp;gt;email = $user-&amp;gt;email;&#xA;                    $email-&amp;gt;save();&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you have to create the following record&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;&#xA;class Test_EmailRecord extends BaseRecord&#xA;{&#xA;    public function getTableName()&#xA;    {&#xA;        return 'cron_mails';&#xA;    }&#xA;&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            // you could store the user Id here too, but this way&#xA;            // you can send the mail to non users too&#xA;            'email' =&amp;gt; AttributeType::String,&#xA;            'entryId' =&amp;gt; array(AttributeType::Number),&#xA;        );&#xA;    }&#xA;&#xA;    // you could - if you want - create relations here..&#xA;    // https://craftcms.com/docs/plugins/records#defining-relations&#xA;    // but since it's only an example and not needed I skipped that part&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you need this in your controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /**&#xA; * Cronjob to send emails... you can activate it every X hours&#xA; * or once per day or whatever you want&#xA; * when this function is trigger a specific number of mails will be send&#xA; * their entries in the database will be deleted until there are no rows in the&#xA; * table&#xA; */&#xA;public function actionSendMails()&#xA;{&#xA;    // fetch mails with limit.. insert your limit here.. I would suggest to fetch 20-50&#xA;    // entries per trigger depending on how often it should run&#xA;    $emails = Test_EmailRecord::model()-&amp;gt;findAllBySql('select * from craft_cron_mails LIMIT 1');&#xA;&#xA;    if (is_array($emails) &amp;amp;&amp;amp; count($emails)) {&#xA;        foreach ($emails as $email) {&#xA;            /** @var UserModel $user */&#xA;            $user = craft()-&amp;gt;users-&amp;gt;getUserByEmail($email-&amp;gt;email);&#xA;&#xA;            // do your logic if no user is found..&#xA;            // of course you could store the user Id rather than the email in the database table&#xA;            // but this way you can send the mail to non users too if you like&#xA;            if (!$user) {&#xA;                // you can just remove that part&#xA;                // I just wanted to show you could create an array with defaults here&#xA;                // if the user is not registered&#xA;                $user = array(/* fill some placeholders for your twig template */);&#xA;            }&#xA;&#xA;            // prepare templates, you can address each user personally with a hello Mr {{ user.name }}&#xA;            // the entry {{ entry.title }} was edited and such... &#xA;            $message = craft()-&amp;gt;templates-&amp;gt;render('path/to/template.twig', array(&#xA;                'user' =&amp;gt; $user,&#xA;                'entry' =&amp;gt; craft()-&amp;gt;elements-&amp;gt;getElementById($email-&amp;gt;entryId)&#xA;            ));&#xA;            if ($this-&amp;gt;sendMail($message, &quot;The post was edited&quot;, $user-&amp;gt;email)) {&#xA;                //remove the column if the mail was send&#xA;                $email-&amp;gt;delete();&#xA;            }&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;/**&#xA; * This function sends the mail, it usually belongs to a service&#xA; * but to make it easier I'll just leave it here&#xA; *&#xA; * @param $message&#xA; * @param $subject&#xA; * @param null $mail&#xA; * @return bool&#xA; */&#xA;public function sendMail($message, $subject, $mail = null)&#xA;{&#xA;    $errors = false;&#xA;    $adminEmail = craft()-&amp;gt;systemSettings-&amp;gt;getSetting('email', 'emailAddress');&#xA;&#xA;    $email = new EmailModel();&#xA;&#xA;    $email-&amp;gt;fromEmail = $adminEmail;&#xA;    $email-&amp;gt;replyTo = $adminEmail;&#xA;    $email-&amp;gt;sender = $adminEmail;&#xA;    $email-&amp;gt;fromName = craft()-&amp;gt;getSiteName();&#xA;    $email-&amp;gt;toEmail = $mail;&#xA;    $email-&amp;gt;subject = $subject;&#xA;    $email-&amp;gt;body = $message;&#xA;&#xA;    if (!craft()-&amp;gt;email-&amp;gt;sendEmail($email)) {&#xA;        $errors = true;&#xA;    }&#xA;&#xA;    return $errors;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-22T16:13:30.747" LastActivityDate="2017-10-22T16:13:30.747" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22530" PostTypeId="1" CreationDate="2017-10-22T15:13:43.200" Score="1" ViewCount="132" Body="&lt;p&gt;I'm trying to create a mechanism for informing users that a particular entry is not available in the selected language, and providing a link to read the article in an alternative language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, if one of my secondary locales returns a 404 for a particular URL and goes to a localised 404 error template, is there a way to check in the 404 template if the corresponding URL path matches an entry in my main locale, so I can link to that entry from the 404 page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what I want is a method for searching for an entry using a string containing the complete URL path, but I don't think that’s available, so what would be the best alternative?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2017-10-22T15:13:43.200" Title="If an entry doesn't exist in a locale and returns a 404, how can I check if the entry exists in a different locale?" Tags="&lt;entries&gt;&lt;localization&gt;&lt;elementcriteriamodel&gt;&lt;404&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22531" PostTypeId="1" AcceptedAnswerId="22532" CreationDate="2017-10-22T22:13:21.257" Score="1" ViewCount="263" Body="&lt;p&gt;I’m new at Craft CMS and I hope someone of you could help me a little.&#xA;At the moment I get all entries from my blog by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually I have 5 categories (catA, catB, catC, catD, catE) at one level, but now I have another category Nr. 6. (catF)&#xA;All 5 categories are shown at the blogpage, but catF sound just shown at an separate page (pageF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not find a way to hide all entries from catF at the blogpage and just show these entries at pageF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thy four your help.&#xA;smueller&lt;/p&gt;&#xA;" OwnerUserId="7428" LastEditorUserId="7428" LastEditDate="2017-10-23T10:04:45.183" LastActivityDate="2017-10-24T09:00:33.010" Title="hide section entries from one section" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22532" PostTypeId="2" ParentId="22531" CreationDate="2017-10-23T06:56:35.013" Score="3" Body="&lt;p&gt;New Answer based on our discussion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Step 1. get the category you want to exclude&#xA;     since I still don't know your structure I'll just grab it&#xA;     per id. You can see that in your cp edit url (the last number) --&amp;gt;&#xA;{% set category = craft.categories.id(108).first() %}&#xA;&#xA;&amp;lt;!-- Step 2. get all entryIds related to that category --&amp;gt;&#xA;&amp;lt;!-- this should be an array of ids you can dump it to check them --&amp;gt;&#xA;{% set entriesInCategory = craft.entries.relatedTo(category).ids() %}&#xA;&#xA;&amp;lt;!-- Step 3 exclude those ids from your last query --&amp;gt;&#xA;{% set entries = craft.entries.section('blogItem').id('and, not ' ~ entriesInCategory|join(', not ')) %}&#xA;&#xA;&amp;lt;!-- just for debugging and testing if these are the correct one --&amp;gt;&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;!-- then you can use your paginate with those entries --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;old Post&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can grab all entries that are related to category F and exclude them in your query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catF = craft.categories.group('categories').ids() %}&#xA;{% set entriesForCatF = craft.entries({&#xA;    relatedTo: catF,&#xA;}).ids() %}&#xA;&#xA;{% set entriesNotInCategoryF = craft.entries.section('blogItem').id('and, not ' ~ entriesForCatF |join(', not ')).ids() %}&#xA;&#xA;&#xA;{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage).id('and, not ' ~ entriesNotInCategoryF |join(', not ')) as pageActive, pageEntrys %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="125" LastEditDate="2017-10-24T09:00:33.010" LastActivityDate="2017-10-24T09:00:33.010" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="22533" PostTypeId="2" ParentId="22500" CreationDate="2017-10-23T08:46:39.630" Score="1" Body="&lt;p&gt;Turns out it was another plugin interfering with the order total.&lt;/p&gt;&#xA;" OwnerUserId="6185" LastActivityDate="2017-10-23T08:46:39.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22534" PostTypeId="1" AcceptedAnswerId="22655" CreationDate="2017-10-23T10:48:12.710" Score="1" ViewCount="483" Body="&lt;p&gt;I've created a plugin that will check for a unique email address in the submissions of Freeform.&#xA;Because I don't want this check to be done with Ajax, I use the Freeform hook 'onBeforeSave'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever a email is already used, I want the user to know. I'm telling Freeforms that the form is not valid:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on(&#xA;    &quot;freeform_submissions.onBeforeSave&quot;,&#xA;    function (Event $event) {&#xA;&#xA;        // Let Freeform know the form is not valid&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I haven't found a way to communicate this to the frontend. It would be nice if I could set a Freeform error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any solutions?&lt;/p&gt;&#xA;" OwnerUserId="5271" LastEditorUserId="57" LastEditDate="2017-10-25T21:45:59.183" LastActivityDate="2017-11-01T10:22:18.207" Title="Freeforms - add error" Tags="&lt;error-message&gt;&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22535" PostTypeId="1" AcceptedAnswerId="22536" CreationDate="2017-10-23T10:58:02.227" Score="1" ViewCount="581" Body="&lt;p&gt;I'm not a web developer but I seem to have taken over our business website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It uses &#xA;apnexus&#xA;doubleclick and&#xA;google analytics&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to make sure we are prepared for the GDPR and seek consent from any new visitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction?  Are these built into all Craft CMS sites?  Will they be updated to follow the new regulations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you ...&lt;/p&gt;&#xA;" OwnerUserId="7430" LastActivityDate="2017-10-23T13:29:30.200" Title="Greetings - about cookies?" Tags="&lt;cookies&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22536" PostTypeId="2" ParentId="22535" CreationDate="2017-10-23T13:29:30.200" Score="5" Body="&lt;p&gt;As Ryan has said in the comments, there currently isn't a native cookie consent feature within Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to either install a plugin (&lt;a href=&quot;https://github.com/xkisu/craftcookieconsent&quot; rel=&quot;noreferrer&quot;&gt;Cookie Consent plugin for Craft CMS&lt;/a&gt; is good) or use a service like &lt;a href=&quot;https://silktide.com/tools/cookie-consent/download/&quot; rel=&quot;noreferrer&quot;&gt;Silk Tide Cookie Consent&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both options require you to have access to your website via FTP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the plugin, you'll upload it to the /craft/plugins/ directory and activate it via the Craft CMS control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://silktide.com/tools/cookie-consent/download/&quot; rel=&quot;noreferrer&quot;&gt;Silk Tide&lt;/a&gt; method requires you to add some code between the &lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/code&gt; tags. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need help with this, there are lots of developers on here (including myself) that can help.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastActivityDate="2017-10-23T13:29:30.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22537" PostTypeId="1" CreationDate="2017-10-23T14:25:54.063" Score="1" ViewCount="240" Body="&lt;p&gt;I'm having issues finding out what all the classes are Craft uses to style its control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have extended the layout but is there any place with more information about what classed there are and how to use them?&lt;/p&gt;&#xA;" OwnerUserId="7398" LastEditorUserId="57" LastEditDate="2017-10-25T21:52:48.483" LastActivityDate="2018-09-11T20:08:39.500" Title="Plugin settings page in CP styling" Tags="&lt;plugin-development&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22538" PostTypeId="1" CreationDate="2017-10-23T14:53:38.773" Score="2" ViewCount="370" Body="&lt;p&gt;I’d like be able to restrict access to the content of entries, served by a common template, subject to the &lt;strong&gt;user group&lt;/strong&gt; of the logged in user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is a template T&lt;/li&gt;&#xA;&lt;li&gt;User U is a member of group G&lt;/li&gt;&#xA;&lt;li&gt;Users V and W are members of group H&lt;/li&gt;&#xA;&lt;li&gt;Entry A, served by template T, is accessible by group G, and therefore only by user U&lt;/li&gt;&#xA;&lt;li&gt;Entry B, also served by template T, is accessible by group H, and therefore only by users V and W&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this possible with Craft out of the box? Or does it require custom plugins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve done this kind of thing in ExpressionEngine using its ZooVisitor add-on, but this is my first foray into user restricted access to content with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a sticking point is the single template, could it be done with a template &lt;em&gt;per user group&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be grateful if someone could point me in the right direction, as I can’t quite see the wood for the trees on this scope in the Docs.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I infer from &lt;a href=&quot;https://craftcms.com/docs/templating/usermodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/usermodel&lt;/a&gt; I can…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup(group) %} {# do something… #} {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I guess I just need a way to feed entry specific stuff into the conditional. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or more ideally, dynamically write the conditional as an outcome of creating a new entry that has user group requirements assigned to it. Though that sounds a bit tricky.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2017-10-23T15:15:11.677" LastActivityDate="2017-10-24T06:50:38.090" Title="User restricted access to content via a common template" Tags="&lt;templating&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22539" PostTypeId="2" ParentId="22510" CreationDate="2017-10-23T15:00:22.517" Score="1" Body="&lt;p&gt;I resolved this by updating core YII functionality that was not working suddenly with Ubuntu 16.04 and the latest version of php 7.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CHttpSession::regenerateID changed to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function regenerateID($deleteOldSession=false)&#xA;{&#xA;    if(session_id() === '')&#xA;        session_regenerate_id($deleteOldSession);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2017-10-23T15:00:22.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22540" PostTypeId="1" CreationDate="2017-10-23T15:44:42.797" Score="0" ViewCount="318" Body="&lt;p&gt;I've got a number of assets directories set up. One of them is having an issue where if you upload an image it doesn't appear in the control panel despite having been uploaded to the server. I checked and it's in the directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When uploading you see the upload progress bar, then that disappears and the image doesn't appear anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to resolve this. Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-10-23T15:44:42.797" Title="Uploading Assets - Problems" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22541" PostTypeId="1" AcceptedAnswerId="22542" CreationDate="2017-10-23T16:14:49.307" Score="2" ViewCount="82" Body="&lt;p&gt;I'm not the developer. I have no need for the software on my workstation. I just want to buy the license. Can I buy a license without installing?&lt;/p&gt;&#xA;" OwnerUserId="7432" LastActivityDate="2017-10-23T16:29:01.370" Title="Noob here. Can I buy a license without installing the software?" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22542" PostTypeId="2" ParentId="22541" CreationDate="2017-10-23T16:29:01.370" Score="2" Body="&lt;p&gt;It's not possible to do this by yourself... reach out to Pixel &amp;amp; Tonic directly:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;support@craftcms.com&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this software already &lt;em&gt;is&lt;/em&gt; installed somewhere public, you can simply log in and pay for it directly.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2017-10-23T16:29:01.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22543" PostTypeId="1" CreationDate="2017-10-24T00:08:16.240" Score="1" ViewCount="227" Body="&lt;p&gt;Is there a way to send errors back to the set password form?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am listening to the &lt;code&gt;users.onBeforeSetPassword&lt;/code&gt; event in which I want to confirm that the string in a confirm password field is the same as in the newPassword field.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSetPassword', function(Event $event) {&#xA;       // Only do anything if it is a front end submission&#xA;       if(craft()-&amp;gt;request-&amp;gt;isSiteRequest())&#xA;       {&#xA;           $newPassword = craft()-&amp;gt;request-&amp;gt;getPost('newPassword');&#xA;           $passwordConfirm = craft()-&amp;gt;request-&amp;gt;getPost('passwordConfirm');&#xA;           if(isset($passwordConfirm) &amp;amp;&amp;amp; strcmp($newPassword, $passwordConfirm) !== 0)&#xA;           {&#xA;               $event-&amp;gt;params['user']-&amp;gt;addErrors(array('newPassword' =&amp;gt; Craft::t('Passwords do not match')));&#xA;               $event-&amp;gt;performAction = false;&#xA;           }&#xA;       }&#xA;   });&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does prevent the user from resetting their password but doesn't send a error message back to the template.  How can I pass a variable back to the template so I can show the user their error?&lt;/p&gt;&#xA;" OwnerUserId="4320" LastActivityDate="2019-11-20T06:15:58.120" Title="Confirm Password on Set Password Form" Tags="&lt;plugin-development&gt;&lt;events&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22544" PostTypeId="2" ParentId="22543" CreationDate="2017-10-24T06:44:54.067" Score="2" Body="&lt;p&gt;You could use the &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash('your message here');&lt;/code&gt; functionality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it works is explained in &lt;a href=&quot;https://craftcms.stackexchange.com/a/15152/6991&quot;&gt;this&lt;/a&gt; or &lt;a href=&quot;https://craftcms.stackexchange.com/a/4602/6991&quot;&gt;this&lt;/a&gt; answer for example but it boils down to setting the message in your event handler and then checking in your template if there's a message and if there's one, display it.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2017-10-24T06:44:54.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22545" PostTypeId="2" ParentId="22538" CreationDate="2017-10-24T06:50:38.090" Score="3" Body="&lt;p&gt;I assume you have basic knowledge in creating plugins, if not I suggest visiting the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's actually pretty easy to achieve your goal.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a Plugin and store an array of permission's in it's settings&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- first permission --&amp;gt;&#xA;&amp;lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;permissions[]&quot; value=&quot;&quot; autofocus=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- 2nd permission --&amp;gt;&#xA;&amp;lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;permissions[]&quot; value=&quot;&quot; autofocus=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- 3rd permission --&amp;gt;&#xA;&amp;lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;permissions[]&quot; value=&quot;&quot; autofocus=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- 4th permission --&amp;gt;&#xA;&amp;lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;permissions[]&quot; value=&quot;&quot; autofocus=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&#xA;&#xA;&amp;lt;!-- just include some javascript logic to add fields if needed to create them dynamically --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Register those permission from your plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerUserPermissions()&#xA;{&#xA;    $permissions = array();&#xA;    foreach($this-&amp;gt;getSettings()['permissions'] as $rule){&#xA;        $permissions[$rule] = array('label' =&amp;gt; $rule);&#xA;    }&#xA;&#xA;    return $permissions;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom fieldType that displays all usergroups dynamically or (for testing) create a simple dropdown field that stores user groups&#xA;&lt;a href=&quot;https://i.stack.imgur.com/viHNH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/viHNH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add this field to a matrix element -&gt; you can store a required group for each element&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to your usergroups and add the permissions to those groups then you can check if the currentuser is in the group you selected in your dropdown&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After you understood the process you can create a custom field type to store/link usergroups (so you can store multiple and select them based on all existing usergroups dynamically)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make your plugin settings more complex.. in my example you can only store the handle not the label of your permission so if you type &quot;Permission to do that&quot; instead of &quot;permissionToDoSomething&quot; it will break&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-24T06:50:38.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22546" PostTypeId="1" AcceptedAnswerId="26025" CreationDate="2017-10-24T07:46:48.373" Score="3" ViewCount="294" Body="&lt;p&gt;For the past couple of months now, I've noticed on my websites using the SearchPlus plugin that indexes are no longer syncing with Algolia. This also means that creating new search indexes is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been updating indexes manually via the Algolia dashboard, but this means that I can't create new indexes at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My best guess is that the plugin is no longer compatible with Algolia's API. Has anyone encountered this, or come up with a fix for this issue?&lt;/p&gt;&#xA;" OwnerUserId="6265" LastActivityDate="2018-05-05T16:49:53.443" Title="SearchPlus Plugin Not Syncing Indexes" Tags="&lt;search&gt;&lt;plugin-searchplus&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22547" PostTypeId="2" ParentId="22528" CreationDate="2017-10-24T09:29:12.770" Score="1" Body="&lt;p&gt;Sounds like your search indexes are corrupted. I’d try to run the “Rebuild Search Indexes” tool in CP &gt; Settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-10-24T09:29:12.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22548" PostTypeId="1" AcceptedAnswerId="22582" CreationDate="2017-10-24T09:51:09.443" Score="2" ViewCount="1891" Body="&lt;p&gt;So, I'm using the standard template system that comes with craft, which has this code in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;main {% if craft.request.getSegment(1) != &quot;&quot; %}id=&quot;content&quot;{% endif %}{% if craft.request.getSegment(1) == &quot;&quot; %}id=&quot;home&quot;{% endif %} role=&quot;main&quot;&amp;gt;&#xA;            {% block content %}&#xA;                &amp;lt;p&amp;gt;If you see me, you haven’t set your &amp;lt;code&amp;gt;{% verbatim %}{% block content %}…{% endblock %}{% endverbatim %}&amp;lt;/code&amp;gt; yet.&amp;lt;/p&amp;gt;&#xA;                &amp;lt;p&amp;gt;See Twig’s &amp;lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html#template-inheritance&quot;&amp;gt;Template Inheritance&amp;lt;/a&amp;gt; documentation for an explanation.&amp;lt;/p&amp;gt;&#xA;            {% endblock %}&#xA;        &amp;lt;/main&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clearly I've added a bit extra in there to set an ID on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as the page content is defined inside Block content, so it only knows what title to use inside block content, how to I get the Title out from the inner template back to the layout template to display here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently it just always displays the sitename which is no good. It should be getting the title from the title of whichever page is been pulled in as content which the content section works out from the CraftCMS routes/section information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is the default layout provided in Craft, there must be a simple way to do this!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried making sure the title variable is defined inside the content template but I can see that any variable I set inside the content template is never accessible in the _layout template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Heres the extra bits of relevant code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Layout: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for content in entries %}&#xA;{% set title = content.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    {#&#xA; # Layout template&#xA; # ---------------&#xA; #&#xA; # This template defines your site’s global layout. It can be&#xA; # “extended” by other templates to fill in the gaps.&#xA; #&#xA; # See Twig’s Template Inheritance documentation for more details:&#xA; # http://twig.sensiolabs.org/doc/templates.html#template-inheritance&#xA; #}&#xA;{% set title3 = &quot;test&quot; %}&#xA;{% block _layout %}&#xA;&#xA;&#xA;&#xA;    &#xA;    &#xA;    {% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;&#xA;    &#xA;&#xA;    &#xA;&#xA;    {% for templatehead in craft.entries.section('siteGeneral').limit(1) %}&#xA;    &#xA;        body{&#xA;            background-color: {{templatehead.backgroundColour}} ;&#xA;            {% set backgroundtemplate = templatehead.backgroundFile.first() %}&#xA;            {% if backgroundtemplate %}&#xA;                background-image: url({{backgroundtemplate.getURL()}});&#xA;            {% endif %}&#xA;            }&#xA;&#xA;        body p{&#xA;            color: {{templatehead.bodyTextColour}};&#xA;            }&#xA;&#xA;        #container, #header, #content, #footer, #home{&#xA;                background-color: {{templatehead.mainBackgroundColour}} ;&#xA;            }&#xA;&#xA;        h1, h2, h4, h5{&#xA;            color:{{templatehead.mainTitleColour}};&#xA;        }&#xA;&#xA;        h1.subtitle{&#xA;            border-bottom: 1px solid {{templatehead.borderLineColour}};&#xA;            }&#xA;&#xA;        body #container .innerblock p, body #container .innerblock h1, body #container .innerblock h2, body #container .innerblock h3, body #container .innerblock h4, body #container .innerblock h5{&#xA;            color: {{templatehead.innerBlockTextColour}};&#xA;            }&#xA;&#xA;        a, .fakelink{&#xA;            color: {{templatehead.innerBackgroundColour}};&#xA;&#xA;            }&#xA;&#xA;        .innerblock a{&#xA;            color: {{templatehead.innerBlockLinkColour}};&#xA;            }&#xA;&#xA;        .phone a, .phone:before, .email:before, .hrbottom ul li a:after{&#xA;            color: {{templatehead.mainTitleColour}};&#xA;            }&#xA;&#xA;        ul li ul.subnavmenu .subnavitemwrap{&#xA;            border-color: {{templatehead.mainTitleColour}};&#xA;        }&#xA;&#xA;        ul li ul.subnavmenu li.subnavitem a::after{&#xA;            background-color: {{templatehead.mainTitleColour}};&#xA;        }&#xA;&#xA;&#xA;         .phone, .email{&#xA;            color: {{templatehead.bodyTextColour}};&#xA;         }&#xA;&#xA;        .innerblock, .mobilemenuwrap{&#xA;            background-color: {{templatehead.innerBackgroundColour}};&#xA;            {% set boxbackground = templatehead.innerBackgroundImage.first() %}&#xA;            {% if boxbackground %}&#xA;                background-image: url({{boxbackground.getURL()}});&#xA;            {% endif %}&#xA;            background: {{templatehead.innerBackgroundColour}} url({{boxbackground.getURL()}}) no-repeat center top;&#xA;            color: {{templatehead.innerBlockTextColour}};&#xA;            }&#xA;&#xA;        .innerblock p, .innerblock h1, .innerblock h2, .innerblock h3, .innerblock h4, .innerblock h5{&#xA;            color: {{templatehead.innerBlockTextColour}};&#xA;            }&#xA;&#xA;        .slidewrap{&#xA;            border-top: 1px solid {{templatehead.borderLineColour}};&#xA;            }&#xA;&#xA;        #footer{&#xA;            background-color: {{templatehead.innerBackgroundColour}};&#xA;            }&#xA;&#xA;        .leftfooter a{&#xA;            color: {{templatehead.innerBackgroundColour}};&#xA;            }&#xA;&#xA;    &#xA;    {% endfor %}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;    Title: {{title}}&lt;br /&gt;&#xA;    Title3: {{title3}}&#xA;    &#xA;        &#xA;            Menu&lt;/p&gt;&#xA;            &lt;ul&gt;&#xA;                &lt;li&gt;Home&lt;/li&gt;&#xA;                {% for tempNav in craft.entries.section('contentPages').order('displayOrder') %}&#xA;                    {% if tempNav.isMainPage == &quot;yes&quot; %}&#xA;                        {% set parents = tempNav.childPages %}&#xA;                        &#xA;                            {{tempNav.title}}&#xA;                            {% if parents | length %}&#xA;                                &#xA;&#xA;                                            {% for subNav in parents %}&#xA;                                                {{subNav.title}}&lt;/li&gt;&#xA;                                            {% endfor %}&#xA;&#xA;                                &lt;/ul&gt;&#xA;                            {% endif %}&#xA;                        &lt;/li&gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;                &lt;li&gt;&lt;a href=&quot;/contactus&quot;&gt;CONTACT&lt;/a&gt;&lt;/li&gt;&#xA;            &#xA;        &#xA;        &#xA;            {% for tempEntry in craft.entries.section('siteGeneral').limit(1) %}&#xA;            &#xA;                &#xA;&#xA;                                        &#xA;&#xA;                                            &#xA;                                            &#xA;                        &#xA;&#xA;&#xA;                &#xA;                &#xA;                    &#xA;&#xA;                        Menu&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;                    &#xA;                    {% set logoimage = tempEntry.siteLogo.first() %}&#xA;                    {% if logoimage %}&#xA;                        &#xA;                        &#xA;                            &#xA;                        &#xA;                        &#xA;                    {% endif %}&#xA;                    Search&lt;/p&gt;&#xA;                    &#xA;                        Email us&#xA;                        Call us: {{tempEntry.phoneNumber}}&#xA;&#xA;                        &lt;br /&gt;&#xA;                        &#xA;&#xA;                            &#xA;                            &#xA;                        &#xA;                    &#xA;                &#xA;&#xA;                &#xA;                    &#xA;                        Email us: {{tempEntry.siteEMail}}&#xA;                        Call us: {{tempEntry.phoneNumber}}&#xA;                        &#xA;&#xA;                            &#xA;                            &#xA;                        &#xA;&#xA;                    &#xA;                    &#xA;                        &lt;ul&gt;&#xA;&#xA;                        {% for tempNav in craft.entries.section('contentPages').order('displayOrder') %}&#xA;                            {% if tempNav.isMainPage == &quot;yes&quot; %}&#xA;                                {% set parents = tempNav.childPages %}&#xA;                                &#xA;                                    {{tempNav.title}}&#xA;                                    {% if parents | length %}&#xA;                                        &#xA;&#xA;                                            &#xA;                                                &#xA;                                                    &#xA;                                                    {% for subNav in parents %}&#xA;                                                        {{subNav.title}}&lt;/li&gt;&#xA;                                                    {% endfor %}&#xA;                                                &#xA;                                            &#xA;                                        &lt;/ul&gt;&#xA;                                    {% endif %}&#xA;                                &lt;/li&gt;&#xA;                            {% endif %}&#xA;                        {% endfor %}&#xA;                            &lt;li&gt;&lt;a href=&quot;/contactus&quot;&gt;CONTACT&lt;/a&gt;&lt;/li&gt;&#xA;                        &#xA;                    &#xA;                &#xA;&#xA;            {% endfor %}&#xA;            &#xA;&#xA;        &#xA;&#xA;        &#xA;            {% block content %}&#xA;{% endblock %}&#xA;        &#xA;&#xA;&#xA;        &#xA;            &#xA;                &#xA;                &#xA;                CONNECT WITH US&#xA;&#xA;                 --&gt;&#xA;            &#xA;            &#xA;                &#xA;                {% for tempNav in craft.entries.section('contentPages').order('displayOrder') %}&#xA;                    {% if tempNav.footerLink == &quot;yes&quot; %}&#xA;                        &lt;li&gt;{{ tempNav.title }}&lt;/li&gt;&#xA;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;                &#xA;&#xA;            &#xA;            {% for tempEntry in craft.entries.section('siteGeneral').limit(1) %}&#xA;            &#xA;                &lt;p&gt;{{tempEntry.footerAddressLine}}&lt;/p&gt;&#xA;                &lt;p&gt;{{tempEntry.footerLegalLine}}&lt;/p&gt;&#xA;            &#xA;            {% endfor %}&#xA;        &#xA;        title: {{title}}&#xA;    &#xA;&#xA;&#xA;{% endblock %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Content: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{#&#xA; # Content Page Template&#xA; # ---------------&#xA; #&#xA;&#xA;&#xA; #}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;{% set entries = craft.entries({ slug: craft.request.getSegment(2) }).section(content) %}&#xA;&#xA;{% for content in entries %}&#xA;{% set title = content.title %}&#xA;Title: {{title}}&#xA;&#xA;    &#xA;        &#xA;            &#xA;                {% for slide in content.mainImage %}&#xA;&#xA;                    &#xA;                {% endfor %}&#xA;            &#xA;                &#xA;                    &#xA;                        &#xA;                            {{ content.textMainImageOverlay }}&#xA;                        &#xA;                    &#xA;                &#xA;&#xA;        &#xA;    &#xA;&#xA;&#xA;    {{content.innerPageTitle}}&#xA;    {% if content.innerPageTitleAdditional is not empty %}&#xA;     - &#xA;&#xA;    {{content.innerPageTitleAdditional}}&#xA;    {% endif %}&#xA;&#xA;    &#xA;&#xA;&#xA;&#xA;    &#xA;        &#xA;            {{content.innerboxText}}&#xA;&#xA;        &#xA;        &#xA;            {% for image in content.innerboxImage %}&#xA;                &#xA;            {% endfor %}&#xA;&#xA;        &#xA;    &#xA;&#xA;&#xA;&#xA;    {% for block in content.mainContentArea %}&#xA;    &#xA;        &#xA;            {% for image in block.sectionImage %}&#xA;                &#xA;&#xA;            {% endfor %}&#xA;        &#xA;        &#xA;            {{block.sectionTitle}}&#xA;            {{block.sectionText}}&#xA;&#xA;        &#xA;    &#xA;&#xA;&#xA;&#xA;    {% endfor %}&#xA;    {% set myClasses = ['left', 'center', 'right'] %}&#xA;    {% for block in content.pictureSection.type('heading') %}&#xA;        {% if block.type == &quot;heading&quot; %}&#xA;            &#xA;                &#xA;                    {{block.header}}&#xA;                    {{block.textSection}}&#xA;                &#xA;            &#xA;        {% endif %}&#xA;    {% endfor %}&#xA;    {% for block in content.pictureSection.type('images') %}&#xA;        {% if block.type == &quot;images&quot; %}&#xA;            &#xA;                {% for image in block.image %}&#xA;                    &#xA;                {% endfor %}&#xA;                {{block.label}}&#xA;            &#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;&#xA;        &#xA;            &#xA;        &#xA;&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="7002" LastEditorUserId="7002" LastEditDate="2017-10-26T08:29:16.903" LastActivityDate="2017-10-26T08:44:21.740" Title="How to set title in layout template from content template" Tags="&lt;templating&gt;&lt;entries&gt;&lt;meta&gt;" AnswerCount="1" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22550" PostTypeId="1" AcceptedAnswerId="22553" CreationDate="2017-10-24T12:05:32.740" Score="2" ViewCount="230" Body="&lt;p&gt;I have a Structure named &quot;pages&quot; which is set to use the template named &quot;_entry&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to visit one of the pages I’m just getting a blank screen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft log shows an error in the template loader because it can’t find a template.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\TemplateLoaderException: Unable to find the template&#xA;  &quot;about/index&quot;. in&#xA;  /path/to/site/craft/app/etc/templating/twigextensions/TemplateLoader.php:123&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The structure is set to use the template named &lt;code&gt;_entry&lt;/code&gt; which is present and all as it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried renaming the template to no avail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other parts of the site are working fine. It only seems to be this Structure that has a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is occurring on an Azure VM running Ubuntu 16.04 LTS with PHP 7.0, running MySQL 5.7 with Strict mode disabled and managed with ServerPilot. I'm pretty sure it's been working OK since I deployed to Azure a couple of days ago but I can't explicitly remember testing these pages since my involvement has largely been on a different part of the site (which is working OK).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working fine locally, and has been working fine on a test server set up at Digital Ocean (I've decommissioned that but I'm in the process of setting it up again to test this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I can confirm the same code works perfectly on the Digital Ocean/ServerPilot combo so it appears to be something Azure or possibly MySQL 5.7 related (the Azure deployment is using MySQL 5.7 with Strict mode disabled)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I'd incorrectly read the error message. The _entry template appears to be found. But this is then trying to load another template (in this case about/index) which is where things fail. &#xA;There is no about/index template it should fall through to a generic template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) %}&#xA;    {% set internal = craft.request.getSegment(1) ~ '/' ~ craft.request.getSegment(2) %}&#xA;    {% set index = craft.request.getSegment(1) ~ '/index' %}&#xA;{% else %}&#xA;    {% set internal = entry.uri ~ '/index' %}&#xA;    {% set index = entry.uri ~ '/index' %}&#xA;{% endif %}&#xA;&#xA;{% include [internal, index, '_generic'] ignore missing %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2017-10-24T14:52:16.660" LastActivityDate="2017-10-24T14:59:41.763" Title="Structure unable to find _entry template" Tags="&lt;templating&gt;&lt;structure&gt;&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22551" PostTypeId="1" AcceptedAnswerId="22575" CreationDate="2017-10-24T12:38:39.827" Score="0" ViewCount="81" Body="&lt;p&gt;Just wondering...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the function of the Stalled Tasks menu option?&lt;/li&gt;&#xA;&lt;li&gt;What is it supposed to do when clicking on it?&lt;/li&gt;&#xA;&lt;li&gt;Is it normal for it to be there... all the time?&lt;/li&gt;&#xA;&lt;li&gt;Is it normal for the browser to freeze when I click on it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="47" LastActivityDate="2017-10-25T22:08:41.980" Title="What's the function of the Stalled Tasks menu option?" Tags="&lt;admin&gt;&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22552" PostTypeId="1" AcceptedAnswerId="22608" CreationDate="2017-10-24T14:14:10.473" Score="2" ViewCount="911" Body="&lt;p&gt;How can I register an assetbundle in a frontend template?&#xA;This is my bundle&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace secondred\formbuilder\assetbundles\Formbuilder;&#xA;&#xA;use Craft;&#xA;use craft\web\AssetBundle;&#xA;use craft\web\assets\cp\CpAsset;&#xA;&#xA;class FormbuilderAsset extends AssetBundle&#xA;{&#xA;    // Public Methods&#xA;    // =========================================================================&#xA;&#xA;    /**&#xA;     * Initializes the bundle.&#xA;     */&#xA;    public function init()&#xA;    {&#xA;        // define the path that your publishable resources live&#xA;        $this-&amp;gt;sourcePath = &quot;@secondred/formbuilder/assetbundles/formbuilder/dist&quot;;&#xA;&#xA;        // define the dependencies&#xA;        $this-&amp;gt;depends = [&#xA;            CpAsset::class,&#xA;        ];&#xA;&#xA;        // define the relative path to CSS/JS files that should be registered with the page&#xA;        // when this asset bundle is registered&#xA;        $this-&amp;gt;js = [&#xA;            'js/Formbuilder.js',&#xA;        ];&#xA;&#xA;        $this-&amp;gt;css = [&#xA;            'css/Formbuilder.css',&#xA;        ];&#xA;&#xA;        parent::init();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I can register it with in my controller without any problems&lt;br&gt;&#xA;&lt;code&gt;$this-&amp;gt;view-&amp;gt;registerAssetBundle(FormbuilderAsset::class);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do view.registerAssetBundle(&quot;secondred\\formbuilder\\assetbundles\\formbuilder\\FormbuilderAsset&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;nothing happens.. no request, no error, nothing in network tab and no html is added to the page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;&lt;br&gt;I found the solution. If you are in a frontend ressource you need to call the &lt;code&gt;{{ endBody() }}&lt;/code&gt; method in order to get the bundles&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-26T09:21:30.320" LastActivityDate="2018-09-25T21:23:30.473" Title="Register Assetbundle in frontend template" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22553" PostTypeId="2" ParentId="22550" CreationDate="2017-10-24T14:59:41.763" Score="1" Body="&lt;p&gt;Got to the bottom of it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The _entry template relies on the fact there's a template error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the production site I'd added,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'suppressTemplateErrors' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the config, which stopped the behaviour that was being relied upon to serve the generic template&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-10-24T14:59:41.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22554" PostTypeId="1" CreationDate="2017-10-24T15:03:41.707" Score="2" ViewCount="76" Body="&lt;p&gt;Just finished my &lt;a href=&quot;http://www.kortekniestuhlmacher.nl&quot; rel=&quot;nofollow noreferrer&quot;&gt;first Craft CMS project&lt;/a&gt;. There have been some first hiccups but so far I've been really impressed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's one thing that I can't wrap my head around. It's a quite a massive website. This client wanted to be able to create different stories per project (loving the matrix here!!!) which got pretty large. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're full of images and stuff but still the website is loading very quick. The only thing that feels slow (on and off) is the CMS itself. When looking at the different entries sometimes the system hangs and that's pure when looking at the overview of all the entries. Switching to a different entry type overview (page to structure for example) also feels sluggish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips how to speed things up? The site itself is perfect, it's just the CMS itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server is running PHP 7.0 but has 128M. Not sure if upgrading it will give a performance boost to the CMS?&lt;/p&gt;&#xA;" OwnerUserId="7207" LastActivityDate="2017-10-30T10:47:45.997" Title="Is there a way to speed up the CMS on UNIX server?" Tags="&lt;speed&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22555" PostTypeId="1" AcceptedAnswerId="22556" CreationDate="2017-10-24T16:07:38.613" Score="1" ViewCount="86" Body="&lt;p&gt;I am trying to ingest an iTunes compatible RSS feed on the template with FeedMe... the enclosures have things like &lt;code&gt;&amp;lt;itunes:description&amp;gt;&lt;/code&gt; in them. When I try and access these properties I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unexpected token &quot;punctuation&quot; of value &quot;:&quot; (&quot;end of print statement&quot; expected).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone know how I can access these enclosures without creating a Twig error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example current Twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ feed[0].itunes:image['@href'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="28" LastActivityDate="2017-10-24T17:02:56.390" Title="FeedMe error with iTunes RSS compatible feed" Tags="&lt;plugin-feedme&gt;&lt;rss&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22556" PostTypeId="2" ParentId="22555" CreationDate="2017-10-24T17:02:56.390" Score="2" Body="&lt;p&gt;You can’t use dot syntax because of the colon, try this instead&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ feed[0]['itunes:image']['@href'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-10-24T17:02:56.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22559" PostTypeId="1" CreationDate="2017-10-24T18:55:17.813" Score="0" ViewCount="49" Body="&lt;p&gt;I'm using the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin and would like the query string in my URL to display with the site's title. Is this possible to add with the plugin?&lt;/p&gt;&#xA;" OwnerUserId="6512" LastActivityDate="2017-10-26T02:34:55.330" Title="Display query string SEOmatic" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22560" PostTypeId="1" AcceptedAnswerId="22605" CreationDate="2017-10-25T04:24:44.443" Score="1" ViewCount="130" Body="&lt;p&gt;This is my first attempt at setting up a front-end form so my users can update their profile information.  The profile is using the VZ Address plugin for the address field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I go to the page, it pulls all of my details in.  When I update something on the front-end and submit, I get a confirmation message (&quot;Your profile has been updated.&quot;) that it went fine, but the fields are not updated. I have template debugging turned on and there are no errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;&amp;lt;div class=&quot;cell small-12 medium-9&quot;&amp;gt;&#xA;    {% if craft.session.getFlash('notice') == 'User saved.'|t %}&#xA;    &amp;lt;div class=&quot;grid-x&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;cell&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;callout alert&quot;&amp;gt;Your profile has been updated.&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/clients/account/profile&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;        {% macro errorList(errors) %}&#xA;            {% if errors %}&#xA;                &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;        {% endmacro %}&#xA;        {% from _self import errorList %}&#xA;&#xA;        &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;            &amp;lt;fieldset class=&quot;cell small-12&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;firstName&quot;&amp;gt;Mailing Name&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;currentUser.address.name&quot; name=&quot;fields[currentUser.address.name]&quot; value=&quot;{{ currentUser.address.name }}&quot;&amp;gt;&#xA;            &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;            &amp;lt;fieldset class=&quot;cell small-12&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;firstName&quot;&amp;gt;Address&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;currentUser.address.street&quot; name=&quot;fields[currentUser.address.street]&quot; value=&quot;{{ currentUser.address.street }}&quot;&amp;gt;&#xA;            &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;            &amp;lt;fieldset class=&quot;cell small-12&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;firstName&quot;&amp;gt;Address 2&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;currentUser.address.street2&quot; name=&quot;fields[currentUser.address.street2]&quot; value=&quot;{{ currentUser.address.street2 }}&quot;&amp;gt;&#xA;            &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;        &amp;lt;fieldset class=&quot;cell small-6&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;city&quot;&amp;gt;City&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;currentUser.address.city&quot; name=&quot;fields[currentUser.address.city]&quot; value=&quot;{{ currentUser.address.city }}&quot;&amp;gt;&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;region&quot;&amp;gt;State&#xA;            &amp;lt;select&amp;gt;&#xA;                &amp;lt;option value=&quot;AL&quot;{%if currentUser.address.region==&quot;AL&quot; %} selected{% endif %}&amp;gt;Alabama&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;AK&quot;{%if currentUser.address.region==&quot;AK&quot; %} selected{% endif %}&amp;gt;Alaska&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;AZ&quot;{%if currentUser.address.region==&quot;AZ&quot; %} selected{% endif %}&amp;gt;Arizona&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;AR&quot;{%if currentUser.address.region==&quot;AR&quot; %} selected{% endif %}&amp;gt;Arkansas&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;CA&quot;{%if currentUser.address.region==&quot;CA&quot; %} selected{% endif %}&amp;gt;California&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;CO&quot;{%if currentUser.address.region==&quot;CO&quot; %} selected{% endif %}&amp;gt;Colorado&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;CT&quot;{%if currentUser.address.region==&quot;CT&quot; %} selected{% endif %}&amp;gt;Connecticut&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;DE&quot;{%if currentUser.address.region==&quot;DE&quot; %} selected{% endif %}&amp;gt;Delaware&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;DC&quot;{%if currentUser.address.region==&quot;DC&quot; %} selected{% endif %}&amp;gt;District Of Columbia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;FL&quot;{%if currentUser.address.region==&quot;FL&quot; %} selected{% endif %}&amp;gt;Florida&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;GA&quot;{%if currentUser.address.region==&quot;GA&quot; %} selected{% endif %}&amp;gt;Georgia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;HI&quot;{%if currentUser.address.region==&quot;HI&quot; %} selected{% endif %}&amp;gt;Hawaii&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;ID&quot;{%if currentUser.address.region==&quot;ID&quot; %} selected{% endif %}&amp;gt;Idaho&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;IL&quot;{%if currentUser.address.region==&quot;IL&quot; %} selected{% endif %}&amp;gt;Illinois&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;IN&quot;{%if currentUser.address.region==&quot;IN&quot; %} selected{% endif %}&amp;gt;Indiana&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;IA&quot;{%if currentUser.address.region==&quot;IA&quot; %} selected{% endif %}&amp;gt;Iowa&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;KS&quot;{%if currentUser.address.region==&quot;KS&quot; %} selected{% endif %}&amp;gt;Kansas&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;KY&quot;{%if currentUser.address.region==&quot;KY&quot; %} selected{% endif %}&amp;gt;Kentucky&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;LA&quot;{%if currentUser.address.region==&quot;LA&quot; %} selected{% endif %}&amp;gt;Louisiana&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;ME&quot;{%if currentUser.address.region==&quot;ME&quot; %} selected{% endif %}&amp;gt;Maine&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MD&quot;{%if currentUser.address.region==&quot;MD&quot; %} selected{% endif %}&amp;gt;Maryland&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MA&quot;{%if currentUser.address.region==&quot;MA&quot; %} selected{% endif %}&amp;gt;Massachusetts&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MI&quot;{%if currentUser.address.region==&quot;MI&quot; %} selected{% endif %}&amp;gt;Michigan&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MN&quot;{%if currentUser.address.region==&quot;MN&quot; %} selected{% endif %}&amp;gt;Minnesota&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MS&quot;{%if currentUser.address.region==&quot;MS&quot; %} selected{% endif %}&amp;gt;Mississippi&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MO&quot;{%if currentUser.address.region==&quot;MO&quot; %} selected{% endif %}&amp;gt;Missouri&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MT&quot;{%if currentUser.address.region==&quot;MT&quot; %} selected{% endif %}&amp;gt;Montana&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NE&quot;{%if currentUser.address.region==&quot;NE&quot; %} selected{% endif %}&amp;gt;Nebraska&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NV&quot;{%if currentUser.address.region==&quot;NV&quot; %} selected{% endif %}&amp;gt;Nevada&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NH&quot;{%if currentUser.address.region==&quot;NH&quot; %} selected{% endif %}&amp;gt;New Hampshire&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NJ&quot;{%if currentUser.address.region==&quot;NJ&quot; %} selected{% endif %}&amp;gt;New Jersey&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NM&quot;{%if currentUser.address.region==&quot;NM&quot; %} selected{% endif %}&amp;gt;New Mexico&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NY&quot;{%if currentUser.address.region==&quot;NY&quot; %} selected{% endif %}&amp;gt;New York&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NC&quot;{%if currentUser.address.region==&quot;NC&quot; %} selected{% endif %}&amp;gt;North Carolina&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;ND&quot;{%if currentUser.address.region==&quot;ND&quot; %} selected{% endif %}&amp;gt;North Dakota&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;OH&quot;{%if currentUser.address.region==&quot;OH&quot; %} selected{% endif %}&amp;gt;Ohio&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;OK&quot;{%if currentUser.address.region==&quot;OK&quot; %} selected{% endif %}&amp;gt;Oklahoma&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;OR&quot;{%if currentUser.address.region==&quot;OR&quot; %} selected{% endif %}&amp;gt;Oregon&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;PA&quot;{%if currentUser.address.region==&quot;PA&quot; %} selected{% endif %}&amp;gt;Pennsylvania&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;RI&quot;{%if currentUser.address.region==&quot;RI&quot; %} selected{% endif %}&amp;gt;Rhode Island&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;SC&quot;{%if currentUser.address.region==&quot;SC&quot; %} selected{% endif %}&amp;gt;South Carolina&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;SD&quot;{%if currentUser.address.region==&quot;SD&quot; %} selected{% endif %}&amp;gt;South Dakota&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;TN&quot;{%if currentUser.address.region==&quot;TN&quot; %} selected{% endif %}&amp;gt;Tennessee&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;TX&quot;{%if currentUser.address.region==&quot;TX&quot; %} selected{% endif %}&amp;gt;Texas&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;UT&quot;{%if currentUser.address.region==&quot;UT&quot; %} selected{% endif %}&amp;gt;Utah&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;VT&quot;{%if currentUser.address.region==&quot;VT&quot; %} selected{% endif %}&amp;gt;Vermont&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;VA&quot;{%if currentUser.address.region==&quot;VA&quot; %} selected{% endif %}&amp;gt;Virginia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;WA&quot;{%if currentUser.address.region==&quot;WA&quot; %} selected{% endif %}&amp;gt;Washington&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;WV&quot;{%if currentUser.address.region==&quot;WV&quot; %} selected{% endif %}&amp;gt;West Virginia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;WI&quot;{%if currentUser.address.region==&quot;WI&quot; %} selected{% endif %}&amp;gt;Wisconsin&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;WY&quot;{%if currentUser.address.region==&quot;WY&quot; %} selected{% endif %}&amp;gt;Wyoming&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot; disabled&amp;gt;-- US Outlying Territories --&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;AS&quot;{%if currentUser.address.region==&quot;AS&quot; %} selected{% endif %}&amp;gt;American Samoa (AS)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;GU&quot;{%if currentUser.address.region==&quot;GU&quot; %} selected{% endif %}&amp;gt;Guam (GU)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MP&quot;{%if currentUser.address.region==&quot;MP&quot; %} selected{% endif %}&amp;gt;Northern Mariana Islands (MP)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;PR&quot;{%if currentUser.address.region==&quot;PR&quot; %} selected{% endif %}&amp;gt;Puerto Rico (PR)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;UM&quot;{%if currentUser.address.region==&quot;UM&quot; %} selected{% endif %}&amp;gt;United States Minor Outlying Islands (UM)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;VI&quot;{%if currentUser.address.region==&quot;VI&quot; %} selected{% endif %}&amp;gt;Virgin Islands (VI)&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot; disabled&amp;gt;----- Canada Province -----&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;AB&quot;{%if currentUser.address.region==&quot;AB&quot; %} selected{% endif %}&amp;gt;Alberta&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;BC&quot;{%if currentUser.address.region==&quot;BC&quot; %} selected{% endif %}&amp;gt;British Columbia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;MB&quot;{%if currentUser.address.region==&quot;MB&quot; %} selected{% endif %}&amp;gt;Manitoba&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NB&quot;{%if currentUser.address.region==&quot;NB&quot; %} selected{% endif %}&amp;gt;New Brunswick&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NL&quot;{%if currentUser.address.region==&quot;NL&quot; %} selected{% endif %}&amp;gt;Newfoundland and Labrador&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NS&quot;{%if currentUser.address.region==&quot;NS&quot; %} selected{% endif %}&amp;gt;Nova Scotia&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NT&quot;{%if currentUser.address.region==&quot;NT&quot; %} selected{% endif %}&amp;gt;Northwest Territories&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;NU&quot;{%if currentUser.address.region==&quot;NU&quot; %} selected{% endif %}&amp;gt;Nunavut&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;ON&quot;{%if currentUser.address.region==&quot;ON&quot; %} selected{% endif %}&amp;gt;Ontario&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;PE&quot;{%if currentUser.address.region==&quot;PE&quot; %} selected{% endif %}&amp;gt;Prince Edward Island&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;QC&quot;{%if currentUser.address.region==&quot;QC&quot; %} selected{% endif %}&amp;gt;Quebec&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;SK&quot;{%if currentUser.address.region==&quot;SK&quot; %} selected{% endif %}&amp;gt;Saskatchewan&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option value=&quot;YT&quot;{%if currentUser.address.region==&quot;YT&quot; %} selected{% endif %}&amp;gt;Yukon&amp;lt;/option&amp;gt;&#xA;            &amp;lt;/select&amp;gt;&#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;postalCode&quot;&amp;gt;Zip Code&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;address.postalCode&quot; name=&quot;fields[address.postalCode]&quot; value=&quot;{{ currentUser.address.postalCode }}&quot;&amp;gt;&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I update the information in the CP, then the new information is displayed on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;action&quot; value of &quot;users/saveUser&quot; - is this something that I need to create, or is it a system file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stumped.&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-10-27T03:32:32.410" Title="Unable to get front-end Profile form to save changes" Tags="&lt;users&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22561" PostTypeId="1" CreationDate="2017-10-25T10:19:11.107" Score="1" ViewCount="129" Body="&lt;p&gt;I'm recording some custom data in Charge, but my client wants to see it within Stripe's control panel. I see you can set a &lt;code&gt;meta&lt;/code&gt; array in &lt;code&gt;craft.charge.setPaymentOptions()&lt;/code&gt; which should do the trick. But I'm collecting the custom data on the same page where I'm setting the payment options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, I've got a custom field called &lt;code&gt;giftAid&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[giftAid]&quot; value=&quot;1&quot;{{ charge is defined and charge.giftAid ? ' checked=&quot;checked&quot;' }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the same template I tried adding this to my payment options: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    ... other options ...&#xA;    meta: {&#xA;        'giftAid': charge.giftAid&#xA;    }&#xA;} %}&#xA;{{ craft.charge.setPaymentOptions(options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... but then I get the error &lt;code&gt;Variable &quot;charge&quot; does not exist.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass this data to Stripe if it's only set when this form is submitted?&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2017-10-25T10:19:11.107" Title="Charge: send metadata to Stripe on same template as where it's collected" Tags="&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22562" PostTypeId="1" AcceptedAnswerId="22577" CreationDate="2017-10-25T12:07:29.793" Score="1" ViewCount="108" Body="&lt;p&gt;This is annoying to have to click on “&lt;strong&gt;Try again&lt;/strong&gt;” to unlock the queued tasks. This could leads to dozen and dozen of stucked tasks that usually could be processed without any problem (like the &lt;em&gt;Generating search keywords&lt;/em&gt; tasks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;recommandations&lt;/a&gt; about how to avoid stuck stacks, and we have setup a lot of these. But from time to time, we still face tasks marked as “&lt;strong&gt;Stalled&lt;/strong&gt;” (and sometimes not) on several websites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know cron jobs using &lt;a href=&quot;https://craftcms.com/docs/config-settings#runTasksAutomatically&quot; rel=&quot;nofollow noreferrer&quot;&gt;runTasksAutomatically setting&lt;/a&gt; or &lt;a href=&quot;https://gitlab.com/24hoursmedia/craft2-plugins/craft2-taskrunner&quot; rel=&quot;nofollow noreferrer&quot;&gt;taskrunner plugin&lt;/a&gt; could also avoid this by calling the &lt;em&gt;runPendingTasks&lt;/em&gt; at a more regular interval than connect to the Control Panel from time to time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's probably a good answer for that, but why when there's a task marked as “&lt;strong&gt;Stalled&lt;/strong&gt;” in the Control Panel, this one is not ignored to automatically let the following tasks processing? And is there a way to automatically ignored these tasks marked as &lt;strong&gt;“Stalled”&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2017-10-25T12:15:49.683" LastActivityDate="2017-10-25T23:41:56.040" Title="Why when a task is marked as “Stalled” the following tasks can't automatically processed?" Tags="&lt;control-panel&gt;&lt;tasks&gt;&lt;cron&gt;&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22563" PostTypeId="2" ParentId="22554" CreationDate="2017-10-25T13:59:05.717" Score="2" Body="&lt;p&gt;First of, check your web server error log wether or not php is dying because of memory exhaustion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, working with many Craft objects/models tend to be slow, you can speed this up by using &lt;code&gt;{ cache }&lt;/code&gt; blocks cleverly, but be wary that using them wrong can severely impact your performance in a negative way.&#xA;Check this blog post for some insight into the topic: &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, the biggest improvement you can implement is caching before the application server (php), some alternatives are fastcgi cache (if using nginx), varnish, saas solutions like fastly/keycdn and probably many other I don't know about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementing caching can be a big job depending on the site and should be thoroughly tested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourth, you can add some sort of APM or tracer to investigate what part(s) of your solution is using the most time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't mention the timings of your site, could you elaborate a bit about how slow it is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience it is hard to get a craft2 site with a lot of content down under 500ms ttfb without heavy caching, but ymmw.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastEditorUserId="6731" LastEditDate="2017-10-30T10:47:45.997" LastActivityDate="2017-10-30T10:47:45.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22564" PostTypeId="1" CreationDate="2017-10-25T14:45:31.443" Score="1" ViewCount="121" Body="&lt;p&gt;I am having issues with Craft Commerce and Worldpay's Offsite Payment Gateway.  The way my clients accounts are set up with Worldpay, I cannot use the Worldpay JSON option so this I have to use the offsite method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I have it working that its coming through as successful transaction on Worldpay's end - however I get left on the offsite thank you page, it doesn't redirect back to my local craft install.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something that I need to do to trigger this? Because of this the order sits in my Orders under the Active cart tab, it does not fully complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2018-09-04T12:33:16.280" Title="Worldpay Offsite Gateway not redirecting to Customer Order screen on successful transaction" Tags="&lt;plugin-craftcommerce&gt;&lt;worldpay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22565" PostTypeId="2" ParentId="22560" CreationDate="2017-10-25T16:15:47.910" Score="1" Body="&lt;p&gt;I think that instead of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[currentUser.address.city]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you need to refer to the fields like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[address.city]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[address][city]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;perhaps even&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields[0][address][city]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In retrospect, this answer isn't very helpful.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-10-25T16:15:47.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22566" PostTypeId="1" AcceptedAnswerId="22578" CreationDate="2017-10-25T17:25:02.570" Score="1" ViewCount="265" Body="&lt;p&gt;I'd like to use the same results template for all of my search functions so I'm wondering if it's possible to limit the search to a specific channel i.e. news or calendar in the form rather than in the results template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastActivityDate="2017-11-25T07:11:45.950" Title="Limit search by channel on the form rather than the results template" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22567" PostTypeId="1" AcceptedAnswerId="22572" CreationDate="2017-10-25T17:32:53.610" Score="1" ViewCount="38" Body="&lt;p&gt;I have a set of entries from multiple channels and I want to loop through each section type that is in the set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;{% for entrySection in entries.sections %}&#xA;    {{ entrySection.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically if I have 100 results from across 8 sections, is there a way I can list out those 8 sections separately?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2017-10-25T20:48:20.977" Title="In a large set of entries across multiple sections, how can I loop through each section type in the set?" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22568" PostTypeId="1" AcceptedAnswerId="22570" CreationDate="2017-10-25T18:36:13.693" Score="1" ViewCount="455" Body="&lt;p&gt;I’ve created a very simple comments system whereby comments are set us a channel, with each (comment )entry related to a main entry from another section. Works fine. I’ve set up editing and deleting the comment via Ajax, but I’m stuck on saving it.&#xA;I’ve got the form submitting successfully via ajax, but I want to be able to display it immediately after it is saved/posted.&#xA;The successful response I get gives me the author username, entry id, date etc, but not the actual comment field. I also need to display additional user details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m not quite sure on best way to tackle this. Just looking for a pointer in the right direction. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2018-04-24T15:43:11.763" Title="Saving new entry via Ajax then immediately showing it" Tags="&lt;entry&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22569" PostTypeId="1" AcceptedAnswerId="22588" CreationDate="2017-10-25T19:32:50.907" Score="2" ViewCount="603" Body="&lt;p&gt;I need to group a set of entries alphabetically and I don't get a working and clean solution.&#xA;Taking &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation entry&lt;/a&gt;, I am doing it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set fromAtoF = craft.entries.section('shops').type('shops').order('title').search('title:a* OR A* OR b* OR B* OR c* OR C* OR d* OR D* OR e* OR E* OR f* OR F*') %}&#xA;  {% set fromGtoL = craft.entries.section('shops').type('shops').order('title').search('title:g* OR G* OR h* OR H* OR i* OR I* OR j* OR J* OR k* OR K* OR l* OR L*') %}&#xA;  {% set fromMtoR = craft.entries.section('shops').type('shops').order('title').search('title:m* OR M* OR n* OR N* OR o* OR O* OR p* OR P* OR q* OR Q* OR r* OR R*') %}&#xA;  {% set fromStoZ = craft.entries.section('shops').type('shops').order('title').search('title:s* OR S* OR t* OR T* OR u* OR U* OR v* OR V* OR w* OR W* OR x* OR X* OR y* OR Y* OR z* OR Z*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Problem 1&lt;/strong&gt;: I get entries starting by 'A' like 'Amazon' in the &lt;code&gt;fromStoZ&lt;/code&gt; group, and 'Walmart' in &lt;code&gt;fromGToL&lt;/code&gt;...etc&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Problem 2&lt;/strong&gt;: It's not clean nor elegant. There must be other ways to query this but I haven't found the good one yet.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set fromAtoF = craft.entries.section('shops').type('shops').order('title').search('title:a* OR b* OR title:c* OR title:d* OR title:e* OR title:f*') %}&#xA;  {% set fromGtoL = craft.entries.section('shops').type('shops').order('title').search('title:g* OR title:h* OR title:i* OR title:j* OR title:k* OR title:l*') %}&#xA;  {% set fromMtoR = craft.entries.section('shops').type('shops').order('title').search('title:m* OR title:n* OR title:o* OR title:p* OR title:q* OR title:r*') %}&#xA;  {% set fromStoZ = craft.entries.section('shops').type('shops').order('title').search('title:s* OR title:t* OR title:u* OR title:w* OR title:x* OR title:y* OR title:z*') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But neither it works; entries like 'Best Buy' and 'JC Penney' don't get into any group, but 'Best Buy2' goes correctly into fromAtoF&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2017-10-26T15:39:36.637" LastActivityDate="2017-10-26T15:39:36.637" Title="Grouping entries by title in Craft 3" Tags="&lt;search&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22570" PostTypeId="2" ParentId="22568" CreationDate="2017-10-25T19:33:09.957" Score="2" Body="&lt;p&gt;Use that as your controller, this is the craft default controller actionSaveEntry that you use right now with a few changes. You can access it in Javascript when you use action: &quot;pluginHandle/entry/saveEntry&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class EntryController extends BaseController&#xA;{&#xA;&#xA;    /**&#xA;     * @var    bool|array Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = array('actionSaveEntry');&#xA;&#xA;&#xA;    /**&#xA;     * Saves an entry.&#xA;     *&#xA;     * @return null&#xA;     */&#xA;    public function actionSaveEntry()&#xA;    {&#xA;        // craft default things.. this is actually the exact same function&#xA;        // like you call at the moment, it does the same..&#xA;        // just go to the part where I have the !Important! note&#xA;        $this-&amp;gt;requirePostRequest();&#xA;&#xA;        $entry = $this-&amp;gt;_getEntryModel();&#xA;&#xA;        // Permission enforcement&#xA;        $this-&amp;gt;enforceEditEntryPermissions($entry);&#xA;        $userSessionService = craft()-&amp;gt;userSession;&#xA;        $currentUser = $userSessionService-&amp;gt;getUser();&#xA;&#xA;        if ($entry-&amp;gt;id) {&#xA;            // Is this another user's entry (and it's not a Single)?&#xA;            if (&#xA;                $entry-&amp;gt;authorId != $currentUser-&amp;gt;id &amp;amp;&amp;amp;&#xA;                $entry-&amp;gt;getSection()-&amp;gt;type != SectionType::Single&#xA;            ) {&#xA;                if ($entry-&amp;gt;enabled) {&#xA;                    // Make sure they have permission to make live changes to those&#xA;                    $userSessionService-&amp;gt;requirePermission('publishPeerEntries:' . $entry-&amp;gt;sectionId);&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        // Populate the entry with post data&#xA;        $this-&amp;gt;_populateEntryModel($entry);&#xA;&#xA;        // Even more permission enforcement&#xA;        if ($entry-&amp;gt;enabled) {&#xA;            if ($entry-&amp;gt;id) {&#xA;                $userSessionService-&amp;gt;requirePermission('publishEntries:' . $entry-&amp;gt;sectionId);&#xA;            } else if (!$currentUser-&amp;gt;can('publishEntries:' . $entry-&amp;gt;sectionId)) {&#xA;                $entry-&amp;gt;enabled = false;&#xA;            }&#xA;        }&#xA;&#xA;        // Save the entry (finally!)&#xA;        // !Important! so this is where your action starts&#xA;        if (craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)) {&#xA;            $return['success'] = true;&#xA;            $return['id'] = $entry-&amp;gt;id;&#xA;            $return['title'] = $entry-&amp;gt;title;&#xA;&#xA;            // after saving the entry you can render your template&#xA;            // the documentation can be found here https://craftcms.com/docs/plugins/templates&#xA;            // just read this site and you'll know what to do.. &#xA;            // this allows you to render your &quot;comments&quot; template like when you &#xA;            // visit the page the first initially&#xA;            // you'll just do $(&quot;#idOfYourCommentsContainer&quot;).append(ajaxResponse['html']);&#xA;            // and thats it^^ &#xA;            // in the template you have access to the variables $entry =&amp;gt; the new entry&#xA;            // and the user currently.. if you need something else, feel free to ask&#xA;            $return['html'] = $this-&amp;gt;renderTemplate('/path/to/template', array(&#xA;                'entry' =&amp;gt; $entry,&#xA;                'user' =&amp;gt; $entry-&amp;gt;getAuthor()&#xA;            ));&#xA;&#xA;            $return['authorUsername'] = $entry-&amp;gt;getAuthor()-&amp;gt;username;&#xA;            $return['dateCreated'] = DateTimeHelper::toIso8601($entry-&amp;gt;dateCreated);&#xA;            $return['dateUpdated'] = DateTimeHelper::toIso8601($entry-&amp;gt;dateUpdated);&#xA;            $return['postDate'] = ($entry-&amp;gt;postDate ? DateTimeHelper::toIso8601($entry-&amp;gt;postDate) : null);&#xA;&#xA;            $this-&amp;gt;returnJson($return);&#xA;        } else {&#xA;            if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest()) {&#xA;                $this-&amp;gt;returnJson(array(&#xA;                    'errors' =&amp;gt; $entry-&amp;gt;getErrors(),&#xA;                    'success' =&amp;gt; false&#xA;                ));&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there is an error you get the array with all &quot;mistakes&quot; and error messages. For example if you define the field &quot;headline&quot; as required and the user didn't insert something in the &quot;headline&quot; field your response will be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;reponse = [&#xA;    &quot;error&quot; =&amp;gt; [&#xA;        'headline'  =&amp;gt; [&#xA;            'The Headline field is required //or something like that...'&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could select the &lt;code&gt;headline&lt;/code&gt; field by name or class with javascript and append the error message as well&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-25T19:50:21.610" LastActivityDate="2017-10-25T19:50:21.610" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22571" PostTypeId="2" ParentId="22569" CreationDate="2017-10-25T20:30:33.427" Score="4" Body="&lt;p&gt;Not exactly sure what you are trying to do with this data, but it sounds like you could use the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set alphaEntries = craft.entries.section('shops').type('shops').all() | group('title | slice(0, 1)') %}&#xA;&#xA;{% for letter, entries in alphaEntries %}&#xA;    &amp;lt;h2&amp;gt;{{ letter }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="31" LastEditorUserId="125" LastEditDate="2017-10-26T12:32:28.150" LastActivityDate="2017-10-26T12:32:28.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22572" PostTypeId="2" ParentId="22567" CreationDate="2017-10-25T20:48:20.977" Score="2" Body="&lt;p&gt;Try using the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query).order('score') %}&#xA;&#xA;{% for sectionName, sectionEntries in entries | group('section.name') %}&#xA;    &amp;lt;h2&amp;gt;{{ sectionName }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in sectionEntries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="31" LastActivityDate="2017-10-25T20:48:20.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22573" PostTypeId="2" ParentId="22534" CreationDate="2017-10-25T21:51:00.347" Score="0" Body="&lt;p&gt;Never used Freeform before, but it looks like that &lt;a href=&quot;https://solspace.com/craft/freeform/docs/events-and-hooks/#event-onbeforesave-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;event&lt;/a&gt; has a &lt;code&gt;model&lt;/code&gt; param passed into it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to add errors to it like any other models in Craft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on(&#xA;    &quot;freeform_submissions.onBeforeSave&quot;,&#xA;    function (Event $event) {&#xA;&#xA;        // Let Freeform know the form is not valid&#xA;        $event-&amp;gt;performAction = false;&#xA;&#xA;        $event-&amp;gt;params['model']-&amp;gt;addError('email', 'This email is already in use!');&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This assumes that there is an 'email' attribute on the &lt;code&gt;Freeform_SubmissionModel&lt;/code&gt; class and there is logic to display errors in your template similar to: &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/entry-form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-25T21:51:00.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22574" PostTypeId="2" ParentId="22537" CreationDate="2017-10-25T21:58:02.923" Score="1" Body="&lt;p&gt;Currently there is not a Control Panel style guide available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your best bet currently would be to inspect the source code as well as exiting plugins that have extended Craft's Control Panel templates to see how they do it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-25T21:58:02.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22575" PostTypeId="2" ParentId="22551" CreationDate="2017-10-25T22:08:41.980" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the function of the Stalled Tasks menu option?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To let you know there is currently a stalled task, to show all of the subsequent tasks that stalled task is blocking and in some scenarios, give you a chance to restart the task.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is it supposed to do when clicking on it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Show a modal with the stalled task and (potentially) other tasks that it is blocking.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it normal for it to be there... all the time?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope. The underlying reason that task stalled should be debugged and fixed. &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it normal for the browser to freeze when I click on it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-25T22:08:41.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22576" PostTypeId="1" CreationDate="2017-10-25T22:54:11.980" Score="4" ViewCount="1412" Body="&lt;p&gt;I really spend a lot of time searching for a solution to this problem.  When I try using the &lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow noreferrer&quot;&gt;Export plugin&lt;/a&gt; to export some entries with some Matrix fields and Neo fields for content, all that I can get is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems to me that no one could've resolved the problem &quot;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/20910/exporting-importing-all-translatable-textfields-of-all-entries-in-a-section&quot;&gt;Exporting / Importing all translatable Textfields of all entries in a section&lt;/a&gt;&quot; or &quot;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1590/how-to-export-client-entered-content-for-a-specific-channel-to-keep-my-local-dat&quot;&gt;How to export client-entered content for a specific channel to keep my local database in sync with staging&lt;/a&gt;&quot; which my problem is similar to.  I tried to search in the database for the content of the entry added by the client, found it and I'm working on how to replace it in my DB without causing errors, but the relation between tables still confuses me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions are, is there any solution yet? If not do I need to create a plugin that read Matrix fields and export it as JSON data? Do I continue in my attempts in the database to try and find the entries and their related content (is it possible)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I have explained enough clearly my situation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S : I'm still a novice in Craft CMS so take it easy on me ^^&lt;/p&gt;&#xA;" OwnerUserId="6603" LastEditorUserId="57" LastEditDate="2017-10-25T23:53:16.790" LastActivityDate="2019-09-04T13:55:40.207" Title="Exporting Entry content" Tags="&lt;entries&gt;&lt;content&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22577" PostTypeId="2" ParentId="22562" CreationDate="2017-10-25T23:41:56.040" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;why when there's a task marked as “Stalled” in the Control Panel, this one is not ignored to automatically let the following tasks processing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because tasks behind it might rely on the data that the successful completion of the stalled task would generate.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And is there a way to automatically ignored these tasks marked as “Stalled”?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could probably hack it somehow, but I wouldn't recommend it.  It's best to fix the underlying reason the task stalled in the first place.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-25T23:41:56.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22578" PostTypeId="2" ParentId="22566" CreationDate="2017-10-25T23:44:02.590" Score="1" Body="&lt;p&gt;You'd do it just like querying for any other element in Craft.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;    search: query,&#xA;    section: 'news'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-25T23:44:02.590" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22579" PostTypeId="2" ParentId="22497" CreationDate="2017-10-26T00:14:11.123" Score="1" Body="&lt;p&gt;It's a bit confusing, but since this product type has variants, using this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;shop/{object.categories.first().slug}/{object.slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it didn't have variants, you wouldn't need the &lt;code&gt;object&lt;/code&gt; reference in front of it.  The same thing applies if you're referencing a field inside of Matrix as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been made easier in the upcoming Commerce 2 so you don't have to worry about the differences.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-26T00:14:11.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22580" PostTypeId="2" ParentId="22554" CreationDate="2017-10-26T02:27:28.887" Score="1" Body="&lt;p&gt;Can you clarify how much RAM the VPS itself has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, yes, 128M for PHP sounds low to me; I set it to &lt;code&gt;512M&lt;/code&gt; for my Craft installs. I'd also suggest ensuring that &lt;code&gt;opcache&lt;/code&gt; is enabled as well.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-26T02:27:28.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22581" PostTypeId="2" ParentId="22559" CreationDate="2017-10-26T02:34:55.330" Score="1" Body="&lt;p&gt;So you can definitely do this via &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Twig Meta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-26T02:34:55.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22582" PostTypeId="2" ParentId="22548" CreationDate="2017-10-26T08:44:21.740" Score="1" Body="&lt;p&gt;This should do the trick&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{# do you use a custom routing or why do you repull the entry #}&#xA;{# you know craft presents you the entry if you are in a entrypage #}&#xA;{# so just using title = entry.title will be enough because the global entry variable already exists #}&#xA;{% set entry = craft.entries({ slug: craft.request.getSegment(2) }).section(content).first() %}&#xA;{% set title = entry.title %}&#xA;{% block content %}&#xA;&#xA;        Title: {{ title }}&#xA;        &amp;lt;div class=&quot;slidewrap&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;slider&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;slides slide&quot; style=&quot;&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;slideimgwrap&quot;&amp;gt;&#xA;                        {% for slide in entry.mainImage %}&#xA;                            &amp;lt;img src=&quot;{{ slide.url }}&quot; alt=&quot;{{ entry.title }}&quot; class=&quot;mySlides&quot;&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;slideoverlay&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;plainblock&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;slideoverlayinner&quot;&amp;gt;&#xA;                                &amp;lt;h2 class=&quot;slidetext&quot;&amp;gt;{{ entry.textMainImageOverlay }}&amp;lt;/h2&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;h1 class=&quot;pagetitle&quot;&amp;gt;{{ entry.innerPageTitle }}&#xA;            {% if entry.innerPageTitleAdditional is not empty %}&#xA;                &amp;lt;span class=&quot;hidemobile&quot;&amp;gt; - &amp;lt;/span&amp;gt;&amp;lt;br class=&quot;mobileonly&quot;&amp;gt;&#xA;                &amp;lt;span class=&quot;smallmobile&quot;&amp;gt;{{ entry.innerPageTitleAdditional }}&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/h1&amp;gt;&#xA;&#xA;&#xA;        &amp;lt;div class=&quot;innerblock&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;plainblock&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;mainboxlefttext&quot;&amp;gt;&#xA;                    {{ entry.innerboxText }}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;mainboxrightimage hidemobile&quot;&amp;gt;&#xA;                    {% for image in entry.innerboxImage %}&#xA;                        &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;                    {% endfor %}&#xA;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;plainblock&quot;&amp;gt;&#xA;            {% for block in entry.mainContentArea %}&#xA;                &amp;lt;div class=&quot;imageblock {% if block.sectionImageLocation == &quot;left&quot; %} left{% endif %}{% if block.sectionImageLocation == &quot;right&quot; %}right{% endif %}{% if block.sectionImageLocation == &quot;noImage&quot; %}noimage {% endif %}&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;image&quot;&amp;gt;&#xA;                        {% for image in block.sectionImage %}&#xA;                            &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;                        &amp;lt;h2 class=&quot;title&quot;&amp;gt;{{ block.sectionTitle }}&amp;lt;/h2&amp;gt;&#xA;                        {{ block.sectionText }}&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;            {% set myClasses = ['left', 'center', 'right'] %}&#xA;            {% for block in entry.pictureSection.type('heading') %}&#xA;                {% if block.type == &quot;heading&quot; %}&#xA;                    &amp;lt;div class=&quot;imageblock noImage noBottom&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;text&quot;&amp;gt;&#xA;                            &amp;lt;h2 class=&quot;title&quot;&amp;gt;{{ block.header }}&amp;lt;/h2&amp;gt;&#xA;                            {{ block.textSection }}&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;            {% for block in entry.pictureSection.type('images') %}&#xA;                {% if block.type == &quot;images&quot; %}&#xA;                    &amp;lt;div class=&quot;{{ cycle(myClasses, loop.index0) }} imagebox&quot;&amp;gt;&#xA;                        {% for image in block.image %}&#xA;                            &amp;lt;img src=&quot;{{ image.url }}&quot;/&amp;gt;&#xA;                        {% endfor %}&#xA;                        {{ block.label }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;plainblock footimage&quot;&amp;gt;&#xA;            &amp;lt;h1 class=&quot;pagetitle subtitle&quot; style=&quot;height: 27px;&quot;&amp;gt;&amp;lt;img src=&quot;/images/divide_logo.jpg&quot;&#xA;                                                                      style=&quot;width: auto; background-color: #fff; height: auto; padding: 0 10px;&quot;&amp;gt;&#xA;            &amp;lt;/h1&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-26T08:44:21.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22583" PostTypeId="2" ParentId="1743" CreationDate="2017-10-26T10:30:32.117" Score="1" Body="&lt;p&gt;I've done something similar with custom includes. Make a new section called 'includes' with a matrix to build content and options for background colour, text colour etc. Then from your 'home' page (or whatever page) have an 'entries' field that links to those includes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An added benefit of this method is that you can use these sections on multiple pages.&lt;/p&gt;&#xA;" OwnerUserId="526" LastActivityDate="2017-10-26T10:30:32.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22584" PostTypeId="1" CreationDate="2017-10-26T11:17:51.527" Score="1" ViewCount="70" Body="&lt;p&gt;Anyone with Neo experience had issues with outputting an assets field with multiple images?&#xA;I am not using a dynamic field, as I saw there are issues with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in block.serviceGallery %}&#xA;    &amp;lt;div class=&quot;fg-col-xs-6 fg-col-md-4&quot; data-gallery=&quot;{{ loop.parent.index }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl('square') }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error:&#xA;&lt;code&gt;Key &quot;index&quot; for array with keys &quot;entry, ... &quot; does not exist.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4229" LastEditorUserId="4229" LastEditDate="2017-10-26T13:31:59.527" LastActivityDate="2017-10-26T13:33:53.793" Title="Error when outputting assets from a field within a Neo field" Tags="&lt;assets&gt;&lt;assetfilemodel&gt;&lt;plugin-neo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22585" PostTypeId="2" ParentId="22584" CreationDate="2017-10-26T12:01:39.967" Score="1" Body="&lt;p&gt;You'll need to reference the field handle within &lt;em&gt;asset&lt;/em&gt;.&lt;br&gt;&#xA;For instance &gt; &lt;code&gt;{{ asset.imageHandle.getUrl('square') }}&lt;/code&gt;.&lt;br&gt;&#xA;I'm guessing you aren't seeing &lt;code&gt;{{ asset.title }}&lt;/code&gt; either?&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2017-10-26T12:01:39.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22586" PostTypeId="2" ParentId="22584" CreationDate="2017-10-26T13:33:53.793" Score="1" Body="&lt;p&gt;The issue here was not to do with NEO or how to access them, it was the loop index call to the parent not getting the correct context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ loop.parent.index }}&lt;/code&gt; was the issue. It needed to be &lt;code&gt;{{ loop.parent.loop.parent.loop.index }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4229" LastActivityDate="2017-10-26T13:33:53.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22587" PostTypeId="2" ParentId="22564" CreationDate="2017-10-26T15:24:57.740" Score="1" Body="&lt;p&gt;It turns out this installation is working as it should.  When I uploaded the website to a staging server and tested on it, it worked as expected. &#xA; Redirecting me back to my Craft website, and showing the Customer Order screen whilst sending out relevant emails.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if it has been documented anywhere, but seems that this doesn't play ball when working locally.  &lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2017-10-26T15:24:57.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22588" PostTypeId="2" ParentId="22569" CreationDate="2017-10-26T15:34:49.130" Score="3" Body="&lt;p&gt;I ended up using a combination of solutions provided:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set groupedShops = craft.entries.section('shops').type('shops')&#xA;                    .order('title').all() |&#xA;                    group(&quot;title|first|upper |&#xA;                    replace('/[A-F]/', 'A to F', 1) |&#xA;                    replace('/[G-L]/', 'G to L', 1) |&#xA;                    replace('/[M-R]/', 'M to R', 1) |&#xA;                    replace('/[S-Z]/', 'S to Z', 1)&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for groupName, group in groupedShops %}&#xA;      &amp;lt;h1&amp;gt; {{ groupName }} &amp;lt;/h1&amp;gt;&#xA;      &amp;lt;ul&amp;gt;&#xA;        {% for shop in group %}&#xA;          &amp;lt;li&amp;gt; {{ shop.title }} &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A to F:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amazon&lt;/li&gt;&#xA;&lt;li&gt;Best Buy&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;G to L:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Happy Shops&lt;/li&gt;&#xA;&lt;li&gt;Hollister&lt;/li&gt;&#xA;&lt;li&gt;Luxe DH&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very similar query is explained here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/5404/how-can-i-group-a-list-of-tags-into-ranges-of-first-letters-a-e-f-j-etc&quot;&gt;How can I group a list of tags into ranges of first letters (A–E, F–J, etc.)?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important detail pointed by @Carlcs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In Craft 3 you need to explicitly query for the entries using &lt;strong&gt;all()&lt;/strong&gt; method on the elment query object&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7347" LastActivityDate="2017-10-26T15:34:49.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22589" PostTypeId="1" CreationDate="2017-10-26T16:26:16.470" Score="1" ViewCount="72" Body="&lt;p&gt;We able to use charge plugin to store customer credit information as &quot;Customers&quot; in Stripe, however, &quot;Customers&quot; information might be saved awhile ago, we would like to re-verify the credit card information is still valid when the customer submits an order. Does anyone know how to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5964" LastActivityDate="2017-10-26T16:26:16.470" Title="Using the Charge plugin to store customer credit card info, how to re-validate the credit card when customer submits order" Tags="&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22591" PostTypeId="1" AcceptedAnswerId="22602" CreationDate="2017-10-26T17:08:31.437" Score="1" ViewCount="72" Body="&lt;p&gt;I have two different domains that are both being deployed from the same Github repo. Domain A has a Craft license. Domain B needs a Craft license. I don’t want to transfer from Domain A to Domain B but they are both reading from the same &lt;code&gt;craft/config/license.key&lt;/code&gt; file. &lt;/p&gt;&#xA;" OwnerUserId="7445" LastEditorUserId="45" LastEditDate="2017-11-12T20:50:27.163" LastActivityDate="2017-11-12T20:50:27.163" Title="Two Domains. One Repo. Need Second License" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22592" PostTypeId="1" AcceptedAnswerId="22597" CreationDate="2017-10-26T18:10:32.743" Score="1" ViewCount="54" Body="&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;podcastBlock&quot; %}&#xA;    {% for category in block.podcastChannel %}&#xA;        {{category.title}} &#xA;&#xA;        &amp;lt;audio class=&quot;mp3&quot; controls&amp;gt;&#xA;&#xA;        {% for entry in block.podcastChannel %}&#xA;            &amp;lt;source src=&quot;{{ entry.audioFile.one.url }}&quot; type=&quot;audio/mp3&quot;&amp;gt;&#xA;        {% endfor %} &#xA;    {% endfor %}&#xA;{% endif %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="7446" LastEditDate="2017-11-15T02:21:41.233" LastActivityDate="2017-11-15T02:21:41.233" Title="How to pull a single podcast source, using the Matrix field and loop?" Tags="&lt;matrix&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22593" PostTypeId="1" AcceptedAnswerId="22600" CreationDate="2017-10-26T18:27:16.077" Score="2" ViewCount="1017" Body="&lt;p&gt;I am trying to query entries (scripts) when a custom expiration date field is within a certain range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These questions/answers helped me get as far as I am, but I'm still stuck: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11014/advanced-query-filter-based-on-date-and-values&quot;&gt;Advanced query/filter based on date and values&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1680/how-can-you-return-elements-between-two-values&quot;&gt;How can you return elements between two values?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the full scenario. On this app's homepage, it lists a handful of recent scripts (prescriptions). It also has sections where it displays scripts that are expired and scripts that are about to expire (within two weeks of the current date).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some testing and found that the following conditionals filter the scripts just how I want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# When expiration date is between now and 2 weeks #}&#xA;{% if expirationDate &amp;gt;= now and expDate &amp;lt;= now|date_modify('+2 weeks') %}&#xA;&#xA;{# When expiration date is anytime before now #}&#xA;{% if expirationDate &amp;lt; now %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those work great. &lt;strong&gt;How can I move this filter into the query itself?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking something like the following, but it obviously doesn't work because of all the commas. But this is what I'm trying to do. &lt;strong&gt;How do I use this correctly in a hash?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set scriptsAboutToExpire = {&#xA;    section: 'scripts',&#xA;    order: 'expirationDate asc',&#xA;    expirationDate: 'and', '&amp;gt;=' ~ now, '&amp;lt;=' ~ now|date_modify('+2 weeks')&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-10-26T21:11:01.907" Title="Query entries between two values" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22594" PostTypeId="1" AcceptedAnswerId="22595" CreationDate="2017-10-26T18:33:49.963" Score="1" ViewCount="1751" Body="&lt;p&gt;I recently inherited a project in Craft from another developer, but he's moved on and no one knows what his admin password was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried generating a password on an account with a fresh install and copying that over the hashed password in MySQL without success.  Are there any other options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7447" LastActivityDate="2017-10-26T18:39:35.027" Title="Reset the password of an admin account" Tags="&lt;admin&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22595" PostTypeId="2" ParentId="22594" CreationDate="2017-10-26T18:39:35.027" Score="3" Body="&lt;p&gt;If you can access the users table, change the admin email to yours, then just use the forgot password link&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2017-10-26T18:39:35.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22596" PostTypeId="2" ParentId="22592" CreationDate="2017-10-26T19:18:17.740" Score="1" Body="&lt;p&gt;Try using the limit:1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in block.podcastChannel.limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7318" LastEditorUserId="7318" LastEditDate="2017-10-26T20:01:38.467" LastActivityDate="2017-10-26T20:01:38.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22597" PostTypeId="2" ParentId="22592" CreationDate="2017-10-26T19:35:02.017" Score="1" Body="&lt;p&gt;The issue was using two loops. I just needed the initial loop and referencing the loop call with the field-handle together. It now retrieves a single podcast.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;podcastBlock&quot; %}&#xA;    {% set groupTitle  = craft.categories.group('podcasts').one() %}&#xA;&#xA;    {% for podcast in block.podcastChannel %} &#xA;        &amp;lt;p class=&quot;subhead-section&quot;&amp;gt;{{ groupTitle }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;audio class=&quot;mp3&quot; controls&amp;gt;&#xA;        &amp;lt;source src=&quot;{{ podcast.audioFile.one.url }}&quot; type=&quot;audio/mp3&quot;&amp;gt;&#xA;     {% endfor %} &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="57" LastEditDate="2017-10-26T23:24:52.100" LastActivityDate="2017-10-26T23:24:52.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22598" PostTypeId="1" CreationDate="2017-10-26T19:58:35.840" Score="1" ViewCount="631" Body="&lt;p&gt;I have a search page that filters with these params:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;    section: 'properties',&#xA;    price: range,&#xA;    search: query.location,&#xA;    relatedTo: status,&#xA;    order: priceDesc&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;status&lt;/code&gt; variable needs to be set to a 'not' this category (or an array of all the other categories), but I can't seem to phrase my param correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried both the string and array method with category ID's, like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;relatedTo: ['not', category.id]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;relatedTo: ['or', category1.id, category2.id, ...]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advice?&lt;/p&gt;&#xA;" OwnerUserId="7285" LastEditorUserId="57" LastEditDate="2017-10-26T23:22:38.560" LastActivityDate="2017-10-27T18:05:37.810" Title="Pass 'not' category.id to relatedTo in Craft" Tags="&lt;entries&gt;&lt;categories&gt;&lt;relatedto&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22599" PostTypeId="1" AcceptedAnswerId="22603" CreationDate="2017-10-26T20:47:07.547" Score="2" ViewCount="121" Body="&lt;p&gt;Does the control panel search support postDate, expiryDate, dateCreated, dateUpdated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a custom date field, the below will return all dates in October 2017:&lt;br&gt;&#xA;&lt;code&gt;customDate:2017-10&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for entry attributes like postDate it returns nothing:&lt;br&gt;&#xA;&lt;code&gt;postDate:2017-09&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure would be good to be able to search by these date values.&lt;/p&gt;&#xA;" OwnerUserId="7368" LastActivityDate="2017-10-26T23:52:43.773" Title="CP search for entries by postDate?" Tags="&lt;entries&gt;&lt;control-panel&gt;&lt;search&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22600" PostTypeId="2" ParentId="22593" CreationDate="2017-10-26T21:11:01.907" Score="5" Body="&lt;p&gt;I got the answer to this thanks to @BrandonKelly from a comment in this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1680/how-can-you-return-elements-between-two-values/1683?noredirect=1#comment30865_1683&quot;&gt;How can you return elements between two values?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning it into a subarray does the trick: &lt;code&gt;expirationDate: [ 'and', '&amp;gt;=' ~ now, '&amp;lt;=' ~ now|date_modify('+2 weeks') ]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, @BrandonKelly!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-10-26T21:11:01.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22601" PostTypeId="2" ParentId="22526" CreationDate="2017-10-26T22:59:56.657" Score="1" Body="&lt;p&gt;it was 'table already exists' and now I understand. When I first ran the installation I had guessed at the user's db priveleges (based on another CMS) as I couldnt find the Craft ones at the time. So that created the table but with the wrong privileges. Each time I subsequently ran it, it failed as the table already existed. – a1mark Oct 22 at 8:48  &lt;/p&gt;&#xA;" OwnerUserId="6481" LastActivityDate="2017-10-26T22:59:56.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22602" PostTypeId="2" ParentId="22591" CreationDate="2017-10-26T23:21:08.843" Score="1" Body="&lt;p&gt;You can set the &lt;a href=&quot;https://craftcms.com/docs/php-constants#craft-config-path&quot; rel=&quot;nofollow noreferrer&quot;&gt;CRAFT_CONFIG_PATH&lt;/a&gt; PHP constant on a per site basis so each of the sites will get their own &lt;code&gt;craft/config&lt;/code&gt; folder (and therefore their own &lt;code&gt;license.key&lt;/code&gt; files).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-26T23:21:08.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22603" PostTypeId="2" ParentId="22599" CreationDate="2017-10-26T23:52:43.773" Score="0" Body="&lt;p&gt;Currently, the &lt;code&gt;postDate&lt;/code&gt; of an entry is not indexed for search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind of hacky, but you could make a custom DateTime field with duplicate information (i.e. &lt;code&gt;myPostDate&lt;/code&gt;) and do a search based on that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-10-26T23:52:43.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22604" PostTypeId="1" CreationDate="2017-10-27T03:28:56.937" Score="2" ViewCount="134" Body="&lt;p&gt;I have a dev site that I'm working on with around 1000 entries - mainly text content. I keep seeing &quot;DeleteStaleTemplateCaches&quot; stalled tasks come up - many times stacking 6-8 sets of similar stuck tasks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read the article about stalled tasks but it seems to say they are the result of using a cache tag. I have no caching of any kind - no cache tags and no caching on the server (that I'm aware of). I'm sometimes able to clear the tasks using Task Manager (after many tries) but they always return. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I should check? Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2017-11-28T01:29:04.433" Title="DeleteStaleTemplateCaches stalled tasks" Tags="&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22605" PostTypeId="2" ParentId="22560" CreationDate="2017-10-27T03:32:32.410" Score="2" Body="&lt;p&gt;The First Name and other built-in fields are kind of special. You can access them directly without having to prefix them with &lt;code&gt;fields&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use other custom fields, try using bracket syntax instead of dot syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;    &amp;lt;label for=&quot;address&quot;&amp;gt;&#xA;        Street Address&amp;lt;span&amp;gt;&amp;lt;small&amp;gt;&amp;lt;i class=&quot;fa fa-asterisk&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/small&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[address][name]&quot; class=&quot;form-control&quot; {%- if currentUser is defined %} value=&quot;{{ currentUser.address.name }}&quot;{% endif -%}&amp;gt;&#xA;    {{ currentUser is defined and currentUser ? errorList(currentUser.getErrors('address.name')) }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-10-27T03:32:32.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22606" PostTypeId="2" ParentId="22598" CreationDate="2017-10-27T04:45:50.423" Score="1" Body="&lt;p&gt;You need to exclude the ids in order to achieve your goal. So instead of &lt;code&gt;relatedTo not&lt;/code&gt; you need a normal related to but the &lt;code&gt;not&lt;/code&gt; statement in your id&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not on my computer currently so I'll edit the exact code in about 2h but it's the same like that one &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/22532/5557&quot;&gt;https://craftcms.stackexchange.com/a/22532/5557&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;id.('and, not ' ~ idsOfEntriesYouWantToExclude|join(', not ')&lt;/code&gt;&#xA;Is the important part. In order to get them you just select all entries that are related to the thing you want to exclude &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;untested but this should do it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% relatedEntries = craft.entries.relatedTo(status).ids() %}&#xA;{# just for debugging to test if the queryString is correct #}&#xA;{% set queryString = 'not ' ~ relatedEntries|join(', not ') %}&#xA;{% set results = craft.entries({&#xA;    id: 'and, ' ~ queryString,&#xA;    section: 'properties',&#xA;    price: range,&#xA;    search: query.location,&#xA;    order: priceDesc&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2017-10-27T18:05:37.810" LastActivityDate="2017-10-27T18:05:37.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22607" PostTypeId="2" ParentId="10" CreationDate="2017-10-27T05:22:35.777" Score="2" Body="&lt;p&gt;This came up today, so I figured I'd post for completeness. This is how I handle it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-27T05:22:35.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22608" PostTypeId="2" ParentId="22552" CreationDate="2017-10-27T06:31:43.880" Score="0" Body="&lt;p&gt;Answer:&lt;br&gt;&#xA;In order to render all the scripts in your registered assetbundles you need to call this function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ endBody() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;somewhere in your page (preferred at the end of the body) &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-10-27T06:31:43.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22610" PostTypeId="1" CreationDate="2017-10-27T09:11:37.290" Score="1" ViewCount="1527" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/craftcms/contact-form/tree/v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form plugin&lt;/a&gt; with AJAX. I have used the JS AJAX script supplied in the plugin but i get a 'Bad request: CSRF token could not be verified' error.&#xA;I have seen many other posts on here regarding AJAX and CSRF but non seem to apply to the Contact Form plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to get this to work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; class=&quot;request-ring-sizer&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;&amp;lt;h2&amp;gt;Order a free ring sizer&amp;lt;/h2&amp;gt;&#xA;&amp;lt;div class=&quot;inputGroup&quot;&amp;gt;&#xA;        &amp;lt;h3 class=&quot;small&quot;&amp;gt;Contact details&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap{% if message is defined and message.hasErrors('fromName') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; class=&quot;required&quot; type=&quot;text&quot; id=&quot;ring-sizer-fromName&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-fromName&quot;&amp;gt;Your name&amp;lt;/label&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('fromName') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap{% if message is defined and message.hasErrors('fromEmail') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; class=&quot;required&quot; type=&quot;email&quot; id=&quot;ring-sizer-fromEmail&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-fromEmail&quot;&amp;gt;Your email&amp;lt;/label&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('fromEmail') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;inputGroup&quot;&amp;gt;&#xA;        &amp;lt;h3 class=&quot;small&quot;&amp;gt;Your address&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap{% if message is defined and message.hasErrors('message[address1]') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; class=&quot;required&quot; type=&quot;text&quot; id=&quot;ring-sizer-message[address1]&quot; name=&quot;message[address1]&quot; value=&quot;{% if message is defined %}{{ message.message[address1] }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-message[address1]&quot;&amp;gt;Address line 1&amp;lt;/label&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('message[address1]') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; type=&quot;text&quot; id=&quot;ring-sizer-message[address2]&quot; name=&quot;message[address2]&quot; value=&quot;{% if message is defined %}{{ message.message[address2] }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-message[address2]&quot;&amp;gt;Address line 2&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap{% if message is defined and message.hasErrors('message[city]') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; class=&quot;required&quot; type=&quot;text&quot; id=&quot;ring-sizer-message[city]&quot; name=&quot;message[city]&quot; value=&quot;{% if message is defined %}{{ message.message[city] }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-message[city]&quot;&amp;gt;Town or City&amp;lt;/label&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('message[city]') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap short{% if message is defined and message.hasErrors('message[zipCode]') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; class=&quot;required&quot; type=&quot;text&quot; id=&quot;ring-sizer-message[zipCode]&quot; name=&quot;message[zipCode]&quot; value=&quot;{% if message is defined %}{{ message.message[zipCode] }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-message[zipCode]&quot;&amp;gt;Post code&amp;lt;/label&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('message[zipCode]') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap{% if message is defined and message.hasErrors('message[countryId]') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;select onkeydown=&quot;active(this);&quot; onblur=&quot;validate(this)&quot; class=&quot;address-country&quot; name=&quot;message[countryId]&quot; class=&quot;required&quot;&amp;gt;&#xA;                &amp;lt;option selected disabled&amp;gt;Select a Country&amp;lt;/option&amp;gt;&#xA;                {% for key, option in countries %}&#xA;                    &amp;lt;option value=&quot;{{ key }}&quot;&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if message is defined and message %}{{ message.getErrors('message[countryId]') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;inputWrap&quot;&amp;gt;&#xA;            &amp;lt;input onkeydown=&quot;active(this);&quot; onblur=&quot;active(this); validate(this)&quot; onfocus=&quot;active(this)&quot; type=&quot;text&quot; id=&quot;ring-sizer-message[state]&quot; name=&quot;message[state]&quot; value=&quot;{% if message is defined %}{{ message.message[state] }}{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            &amp;lt;label for=&quot;ring-sizer-message[state]&quot;&amp;gt;State&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;input name=&quot;preferredJewellery&quot; type=&quot;text&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; id=&quot;ring-sizer-subject&quot; name=&quot;subject&quot; value=&quot;I would like to request a free ring sizer&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot; class=&quot;button button--primary button--primary--center page-fade&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;    &amp;lt;div class=&quot;form-success&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;center alert alert--success&quot;&amp;gt;Thank you. We will let you know when we've dispatched your free ring&amp;amp;nbsp;sizer.&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- thanks --&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;$(document).ready(function(){&#xA;&#xA;    $('.request-ring-sizer').submit(function(ev) {&#xA;        console.log(&quot;ring sizer request submitted&quot;);&#xA;        // Prevent the form from actually submitting&#xA;        ev.preventDefault();&#xA;&#xA;        // Send it to the server&#xA;        $.ajax('/', {&#xA;            dataType: 'json',&#xA;            data: $(this).serialize(),&#xA;            success: function(response) {&#xA;                if (response.success) {&#xA;                    $('.request-ring-sizer .form-success').addClass(&quot;visible&quot;);&#xA;                } else {&#xA;&#xA;                    alert('An error occurred. Please try again.');&#xA;                }&#xA;            }&#xA;        });&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="57" LastEditDate="2017-10-27T18:11:55.900" LastActivityDate="2017-10-31T10:08:36.173" Title="Contact Form plugin - using Ajax, CSRF 400 bad request" Tags="&lt;ajax&gt;&lt;plugin-contactform&gt;&lt;csrf&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22611" PostTypeId="1" CreationDate="2017-10-27T09:16:02.997" Score="1" ViewCount="581" Body="&lt;p&gt;I want to create custom twig extension without any plugin dependency. Is anyone has solution for this?&lt;/p&gt;&#xA;" OwnerUserId="7450" LastActivityDate="2017-10-28T17:28:03.157" Title="Is there any way to create twig extension without a plugin?" Tags="&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22612" PostTypeId="2" ParentId="22611" CreationDate="2017-10-27T11:21:09.473" Score="1" Body="&lt;p&gt;I don’t believe there’s a way to create an actual Twig extension without making a plugin. However, depending on what you’re wanting your extension to do, would a Twig macro work? If you change your mind and decide to go the plugin route, creating a Twig extension that way isn’t too difficult. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2017-10-27T11:21:09.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22613" PostTypeId="1" AcceptedAnswerId="22710" CreationDate="2017-10-27T14:53:46.613" Score="2" ViewCount="266" Body="&lt;p&gt;I'm having some trouble saving custom user fields via a front-end form as described &lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. All the other forms on the site that use the same method save the data correctly. I'm able to pull in the user data correctly if I manually input it in the Craft dashboard. I examined the POST request from the form in devtools and I get a 200 status code so it seems like it's posting the data correctly, however it doesn't seem to be saving on Craft's side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. The code for the form can be seen below.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; id=&quot;customForm&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;secondaryEmailAddress&quot;&amp;gt;Secondary Email Address&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;secondaryEmailAddress&quot; type=&quot;email&quot; class=&quot;signup-input&quot; name=&quot;fields[secondaryEmailAddress]&quot; value=&quot;{{ currentUser.secondaryEmailAddress }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/email.png&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- End Input Container --&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;secondaryContactName&quot;&amp;gt;Secondary Contact Name&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input  id=&quot;secondaryContactName&quot; type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[secondaryContactName]&quot; value=&quot;{{ currentUser.secondaryContactName }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/username.png&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- End Input Container --&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;zipCode&quot;&amp;gt;Zip Code&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input  id=&quot;zipCode&quot; type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[zipCode]&quot; value=&quot;{{ currentUser.zipCode }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/zipcode.png&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- End Input Container --&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;describeYourself&quot;&amp;gt;Describe Yourself&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;describeYourself&quot; readonly type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[describeYourself]&quot; value=&quot;{{ currentUser.describeYourself.label }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/learner.png&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;dropdown-arrow&quot; src=&quot;{{ siteUrl }}assets/img/global/chevron-down.png&quot; /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- End Input Container --&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;div class=&quot;profile-dropdown&quot; id=&quot;describeDropdown&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for option in currentUser.describeYourself.options %}&#xA;                &amp;lt;li&amp;gt;{{ option.label }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;li class=&quot;conditionalDropdown&quot; id=&quot;myAgeItem&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;My Age&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;myAge&quot; readonly type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[myAge]&quot; value=&quot;{{ currentUser.myAge.label }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/learner-type.png&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;dropdown-arrow&quot; src=&quot;{{ siteUrl }}assets/img/global/chevron-down.png&quot; /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;div class=&quot;profile-dropdown&quot; id=&quot;myAgeDropdown&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for option in currentUser.myAge.options %}&#xA;                &amp;lt;li&amp;gt;{{ option.label }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;li class=&quot;conditionalDropdown&quot; id=&quot;learnerAgeItem&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;Learner Age&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;learnerAge&quot; readonly type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[learnerAge]&quot; value=&quot;{{ currentUser.learnerAge.label }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/learner-type.png&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;dropdown-arrow&quot; src=&quot;{{ siteUrl }}assets/img/global/chevron-down.png&quot; /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;div class=&quot;profile-dropdown&quot; id=&quot;learnerAgeDropdown&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for option in currentUser.learnerAge.options %}&#xA;                &amp;lt;li&amp;gt;{{ option.label }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;li class=&quot;conditionalDropdown&quot; id=&quot;teacherItem&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;Grades&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;grades&quot; readonly type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[grades]&quot; value=&quot;{{ currentUser.grades.label }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/learner-type.png&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;dropdown-arrow&quot; src=&quot;{{ siteUrl }}assets/img/global/chevron-down.png&quot; /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;div class=&quot;profile-dropdown&quot; id=&quot;gradesDropdown&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for option in currentUser.grades.options %}&#xA;                &amp;lt;li&amp;gt;{{ option.label }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;div class=&quot;input-container&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;howDidYouFindUs&quot;&amp;gt;How Did You Find Us?&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input id=&quot;howDidYouFindUs&quot; readonly type=&quot;text&quot; class=&quot;signup-input&quot; name=&quot;fields[howDidYouFindUs]&quot; value=&quot;{{ currentUser.howDidYouFindUs.label }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}assets/img/forms/online-search.png&quot;&amp;gt;&#xA;            &amp;lt;img class=&quot;dropdown-arrow&quot; src=&quot;{{ siteUrl }}assets/img/global/chevron-down.png&quot; /&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    &amp;lt;div class=&quot;profile-dropdown&quot; id=&quot;findUsDropdown&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for option in currentUser.howDidYouFindUs.options %}&#xA;                &amp;lt;li&amp;gt;{{ option.label }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;input class=&quot;button&quot; type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7276" LastEditorUserId="3951" LastEditDate="2017-11-09T19:37:32.740" LastActivityDate="2017-11-09T19:37:32.740" Title="User Profile Form Not Saving Data" Tags="&lt;templating&gt;&lt;form&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22614" PostTypeId="2" ParentId="22611" CreationDate="2017-10-27T15:09:33.213" Score="3" Body="&lt;h1&gt;Short answer:&lt;/h1&gt;&#xA;&lt;p&gt;No.&lt;/p&gt;&#xA;&lt;h1&gt;Longer answer:&lt;/h1&gt;&#xA;&lt;p&gt;Sorry, no... but there's a good reason for that.&lt;/p&gt;&#xA;&lt;p&gt;Twig is a &lt;em&gt;template&lt;/em&gt; language. PHP is &lt;em&gt;business logic&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In proper application design, you separate the business logic from its presentation typically in some sort of MVC structure.&lt;/p&gt;&#xA;&lt;p&gt;This sounds complicated, but it really makes your website/application a lot easier to maintain over time and keeps the different components from bumping into each other which can also improve security. (I'm looking at you WordPress where template code is often scattered over various plugins, themes, and much more.)&lt;/p&gt;&#xA;&lt;p&gt;Plugins (and also modules upcoming in Craft 3) typically fall into the business logic category. Twig does a lot by itself but sometimes you need to write some PHP to do more—which I'm assuming you're trying to avoid.&lt;/p&gt;&#xA;&lt;p&gt;Twig itself is obviously PHP so if you want to extend it, you need to write PHP.&lt;/p&gt;&#xA;&lt;h1&gt;What kind of Twig extension do you want to create?&lt;/h1&gt;&#xA;&lt;p&gt;The most common is a &lt;a href=&quot;https://craftcms.com/docs/templating/filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig filter&lt;/a&gt;, where a template sends Twig a value and then your code wrestles with the data and sends something back.&lt;/p&gt;&#xA;&lt;p&gt;This is straightforward to do. If you use &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; it will generate the necessary bootstrapping needed to get a Twig filter working.  Also check out Cameron's Spear's &lt;a href=&quot;https://cameronspear.com/blog/craft-cms-twig-filter-extension/&quot; rel=&quot;nofollow noreferrer&quot;&gt;write up&lt;/a&gt; on the nitty gritty.&lt;/p&gt;&#xA;&lt;p&gt;On the other end of the spectrum, creating your own &lt;a href=&quot;https://twig.symfony.com/doc/2.x/advanced.html#tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;tags&lt;/a&gt; (such as &lt;code&gt;{% myTwigTag %}&lt;/code&gt;) and tests requires more work.&lt;/p&gt;&#xA;&lt;p&gt;That should be more of a rare occurrence but it &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion&quot; rel=&quot;nofollow noreferrer&quot;&gt;has been done&lt;/a&gt; (for example Marion Newlevant's Break/Continue extension).&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-28T17:28:03.157" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22615" PostTypeId="2" ParentId="22610" CreationDate="2017-10-27T15:12:05.113" Score="1" Body="&lt;p&gt;Looks like you need to pass the csrf token through within your data as noted here &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="977" LastActivityDate="2017-10-27T15:12:05.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22616" PostTypeId="2" ParentId="22087" CreationDate="2017-10-27T16:52:25.390" Score="1" Body="&lt;p&gt;Ok after several weeks of head scratching. I worked out the solution. So hopefully this will help someone else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each locale has it's own folder on the root. So to enable you to view the pages on a subdomain you need to edit the .htaccess file within the locale folder and add a RewriteBase /fr or whatever the folder name of the locale you are targeting is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will then resolve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone else.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-10-27T16:52:25.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22617" PostTypeId="1" CreationDate="2017-10-27T18:25:23.597" Score="1" ViewCount="91" Body="&lt;p&gt;I have a Matrix field which contains several assets fields. Each has the dynamic subfolder path set to &lt;code&gt;{owner.section.handle}&lt;/code&gt;, so I can reuse the Matrix in multiple sections, but keep the assets organized.&lt;/p&gt;&#xA;&lt;p&gt;When I try to save an entry with an image, i get the error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Craft\InvalidSubpathException&lt;/p&gt;&#xA;&lt;p&gt;Could not resolve the subpath “{owner.section.handle}”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="323" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-10-27T18:44:45.387" Title="Can't save entries with dynamic subfolder path in Matrix" Tags="&lt;matrix&gt;&lt;error-message&gt;&lt;subfolder&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22618" PostTypeId="2" ParentId="22617" CreationDate="2017-10-27T18:39:17.317" Score="1" Body="&lt;p&gt;I figured it out -- I'll leave the question up in case anyone else runs into the issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had Assets fields in my Matrix, but I also had a SuperTable field in the Matrix which contained an image. That was the one causing the error. Changing the subfolder path to &lt;code&gt;{owner.owner.section.handle}&lt;/code&gt; solved the problem.&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="57" LastEditDate="2017-10-27T18:44:18.597" LastActivityDate="2017-10-27T18:44:18.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22619" PostTypeId="1" AcceptedAnswerId="22628" CreationDate="2017-10-27T18:55:22.253" Score="5" ViewCount="14063" Body="&lt;p&gt;I'm strangely having trouble with this simple Twig merge problem and can't find anything online. Simplified, let's say you had:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = [&#xA;    {name: 'Bill', age: 25},&#xA;    {name: 'Tim', age: 30},&#xA;    {name: 'John', age: 32}&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would you change, for example, Tim's age from 30 to 31?  I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = users[1]|merge({age: 31}) %}&#xA;{{ users[1].name }}: {{ users[1].age }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2020-10-07T13:52:43.943" Title="Overwrite value in object in array" Tags="&lt;templating&gt;&lt;array&gt;&lt;merge&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22620" PostTypeId="2" ParentId="22619" CreationDate="2017-10-27T20:05:55.320" Score="0" Body="&lt;p&gt;A little bit nasty but you could do it like this (I could not find anything else)&lt;br&gt;&#xA;Create this function in your plugins Variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @param array $array The array to modify&#xA; * @param string $path The path in the array&#xA; * @param mixed $value The value to set&#xA; * @param string $delimiter The separator for the path&#xA; * @return The new array&#xA; */&#xA;function setNestedArrayValue($array, $path, $value, $delimiter = '/') {&#xA;    $pathParts = explode($delimiter, $path);&#xA;&#xA;    $current = &amp;amp;$array;&#xA;    foreach($pathParts as $key) {&#xA;        $current = &amp;amp;$current[$key];&#xA;    }&#xA;    $current = $value;&#xA;&#xA;    return $array;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you have this in your twig template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set users = [&#xA;    {name: 'Bill', age: 25},&#xA;    {name: 'Tim', age: 30},&#xA;    {name: 'John', age: 32}&#xA;] %}&#xA;&#xA;{% set users = craft.pluginHandle.setNestedArrayValue(users, '0/age', 40) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-10-27T20:57:48.380" LastActivityDate="2017-10-27T20:57:48.380" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22621" PostTypeId="1" AcceptedAnswerId="22645" CreationDate="2017-10-28T08:18:59.933" Score="1" ViewCount="460" Body="&lt;p&gt;I know there is the Stripe checkout button that is in the example docs but I would like more control over how things look and work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this is where it's over to me to look at the Stripe docs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stripe.com/docs/checkout#integration-custom&quot; rel=&quot;nofollow noreferrer&quot;&gt;Styled Custom Button&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's difficult to work out what exactly is required in order to send all the details Stripe requires and then process the response giving Craft Commerce everything it needs. Then send the user to an order complete screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the custom button sort of working using:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;&#xA;  &amp;lt;button id=&quot;paymentButton&quot; class=&quot;button is-primary&quot;&amp;gt;Purchase&amp;lt;/button&amp;gt;&#xA;&#xA;  &amp;lt;script&amp;gt;&#xA;    var handler = StripeCheckout.configure({&#xA;      key: '{{ cart.paymentMethod.settings.publishableKey ?? '' }}',&#xA;      image: '/assets/img/tfa-logo-128.png',&#xA;      locale: 'auto',&#xA;      token: function(token) {&#xA;        // You can access the token ID with `token.id`.&#xA;        // Get the token ID to your server-side code for use.&#xA;      }&#xA;    });&#xA;&#xA;    document.getElementById('paymentButton').addEventListener('click', function(evt) {&#xA;      // Open Checkout with further options:&#xA;      handler.open({&#xA;        name: '{{ siteName }}',&#xA;        email: '{{ cart.email }}',&#xA;        currency: '{{ cart.paymentCurrency }}',&#xA;        description: 'Membership',&#xA;        zipCode: true,&#xA;        amount: {{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true,format=false) * 100 }}&#xA;      });&#xA;      evt.preventDefault();&#xA;    });&#xA;&#xA;    // Close Checkout on page navigation:&#xA;    window.addEventListener('popstate', function() {&#xA;      handler.close();&#xA;    });&#xA;  &amp;lt;/script&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This looks to work but doesn't send a charge to Stripe or save in the commerce plugin (it just sits as an active cart). I guess this is down to the token not being set but how do you do that? &lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2017-10-30T19:35:43.383" LastActivityDate="2017-10-31T20:31:06.377" Title="Using the custom styled Stripe button with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22622" PostTypeId="2" ParentId="21929" CreationDate="2017-10-28T08:39:19.833" Score="0" Body="&lt;p&gt;The bug was fixed for me in 1.6.2 my final code was just a simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot;&#xA;        name=&quot;{{ receiveContactFromTFA.handle }}&quot;&#xA;        value=&quot;{{ receiveContactFromTFA.value }}&quot;&#xA;        {% if receiveContactFromTFA.value == 'Yes' %} checked{% endif %}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastActivityDate="2017-10-28T08:39:19.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22623" PostTypeId="2" ParentId="22619" CreationDate="2017-10-28T21:58:57.427" Score="-1" Body="&lt;p&gt;Did you try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users[1]['age'] = 31 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2017-10-28T21:58:57.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22624" PostTypeId="2" ParentId="22604" CreationDate="2017-10-29T01:00:06.107" Score="2" Body="&lt;p&gt;Thanks to Brad Bell who solved this for me. There was data in my craft_templatecache* tables. When I cleared them out the issue went away.&lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2017-10-29T01:00:06.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22626" PostTypeId="2" ParentId="14573" CreationDate="2017-10-29T14:06:18.383" Score="1" Body="&lt;p&gt;You should setup a small plugin for this functionality. This helps you move out business logic and by the way you are helping others implementing stuff in craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would start with the root file for your plugin and there we register a route for the controller.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* urlbyid/UrlByIdPlugin.php */&#xA;class UrlByIdPlugin extends BasePlugin&#xA;{&#xA;    public function getName() { return 'Url by id'; }&#xA;    public function getVersion() { return '1.0.0'; }&#xA;    public function getDeveloper() { return 'You'; }&#xA;    public function getDeveloperUrl() { return 'https://www.yourdomain.com'; }&#xA;&#xA;    public function registerSiteRoutes()&#xA;    {&#xA;        return array(&#xA;        'entries/find' =&amp;gt; array('action' =&amp;gt; 'urlById/find'),&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So &lt;a href=&quot;http://www.yourdomain.com/entries/find&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.yourdomain.com/entries/find&lt;/a&gt; now routes to a controller UrlByIdController which does the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find the entry by id&lt;/li&gt;&#xA;&lt;li&gt;if it has a url -&gt; redirect to it&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;`&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* urlbyid/controllers/UrlByIdController.php */&#xA;namespace Craft;&#xA;class UrlByIdController extends BaseController&#xA;    {&#xA;        protected $allowAnonymous = true;&#xA;&#xA;    /*&#xA;    * Finding entries and redirect if found.&#xA;    */&#xA;    public function actionFind()&#xA;    {&#xA;        $requestedId = craft()-&amp;gt;request-&amp;gt;getParam('id');&#xA;        // build criteria to find model&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;id = $requestedId;&#xA;        $criteria-&amp;gt;limit = 1;&#xA;&#xA;        // fire !&#xA;        $entries = $criteria-&amp;gt;find();&#xA;        $entry = count($entries) &amp;gt; 0 ? $entries[0] : null;&#xA;&#xA;        // redirect if possible&#xA;        if($entry &amp;amp;&amp;amp; $entry-&amp;gt;url) {&#xA;&#xA;            // build new query, but remove id from query path&#xA;            $newLocation = $entry-&amp;gt;url . ( craft()-&amp;gt;request-&amp;gt;getParam('L') ? '?L='.craft()-&amp;gt;request-&amp;gt;getParam('L') : '');&#xA;&#xA;            header(&quot;HTTP/1.1 302 Found&quot;); &#xA;            header(&quot;Location: &quot; . $newLocation); &#xA;            exit();&#xA;        }else{&#xA;            header(&quot;HTTP/1.1 404 Not Found&quot;);&#xA;            header(&quot;Location: /404.html&quot;); &#xA;            exit();&#xA;        }&#xA;&#xA;        craft()-&amp;gt;end();&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could then implement a variable class to provide a helper for templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* urlbyid/variables/UrlByIdVariable.php */&#xA;namespace Craft;&#xA;    /*&#xA;    * Helper to generate Url with Id&#xA;    */&#xA;    class UrlByIdVariable&#xA;    {&#xA;        public function urlFor($entry)&#xA;        {&#xA;            if ($entry-&amp;gt;uri !== null)&#xA;                {&#xA;                    $url = UrlHelper::getSiteUrl('entries/find', array('id' =&amp;gt; $entry-&amp;gt;id), null, $entry-&amp;gt;locale);&#xA;                    return $url;&#xA;                }&#xA;        }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use this helper in your layouts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.urlById.urlFor(entry) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code improvements: Use craft internal redirector, not php standard&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please have a look at this small plugin I have written: &lt;a href=&quot;https://github.com/zauberware/urlbyid/&quot; rel=&quot;nofollow noreferrer&quot;&gt;UrlById&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6225" LastActivityDate="2017-10-29T14:06:18.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22627" PostTypeId="1" CreationDate="2017-10-29T16:15:02.977" Score="0" ViewCount="116" Body="&lt;p&gt;I am trying to get pretty urls &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php file I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which works fine and removes the index.php &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BUT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to force a &lt;code&gt;www&lt;/code&gt; in the htaccess the index.php comes back and I can't seem to remove this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have in my htaccess&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;RewriteCond %{HTTP_HOST} ^example\.com [NC]&#xA;RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="5448" LastEditorUserId="45" LastEditDate="2017-10-29T19:18:02.737" LastActivityDate="2017-10-30T03:06:48.883" Title="Adding `www` causing it to have index.php" Tags="&lt;craft3&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22628" PostTypeId="2" ParentId="22619" CreationDate="2017-10-29T21:46:41.510" Score="12" Body="&lt;h3&gt;Solution&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This won't work in Twig as presented in the question (see why below). Instead, &lt;code&gt;users&lt;/code&gt; would need to be changed to an associative array (or &quot;hash&quot; in Twig terminology) with keys &lt;em&gt;that aren't integers&lt;/em&gt;, and you'd have to insert a &lt;code&gt;merge&lt;/code&gt; inside a &lt;code&gt;merge&lt;/code&gt; to change the value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = {&#xA;    person0: {name: 'Bill', age: 25},&#xA;    person1: {name: 'Tim', age: 30},&#xA;    person2: {name: 'John', age: 32}&#xA;} %}&#xA;&#xA;{% set users = users|merge({ person1: users.person1|merge({age: 1000}) }) %}&#xA;&#xA;{% for key, user in users %}&#xA;    {{ key }}: {{ user.name }}, {{ user.age }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which now outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;person0: Bill, 25&#xA;person1: Tim, 1000&#xA;person2: John, 32&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to change the keys' integers dynamically, you will write it like this using Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/attribute.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;attribute&lt;/code&gt;&lt;/a&gt; function and using brackets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set loopIndex = 1 %}&#xA;{% set users = users|merge({ ('person' ~ loopIndex): attribute(users, 'person' ~ loopIndex)|merge({age: 1000}) }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;The Reason Why the Question's Array Doesn't Work&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Twig's &lt;code&gt;merge&lt;/code&gt; filter uses PHP's &lt;code&gt;array_merge&lt;/code&gt; function, and according to PHP's docs when using &lt;a href=&quot;http://php.net/manual/en/function.array-merge.php&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;array_merge&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, &lt;strong&gt;but will be appended&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So trying to overwrite an existing hash in the original array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = [&#xA;    {name: 'Bill', age: 25},&#xA;    {name: 'Tim', age: 30},&#xA;    {name: 'John', age: 32}&#xA;] %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...will just add the hash as a new, fourth item in the array, not replace the second one.  To demonstrate this clearer, we can rewrite &lt;code&gt;users&lt;/code&gt; as a hash like this (it's considered the same as above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = {&#xA;    0: {name: 'Bill', age: 25},&#xA;    1: {name: 'Tim', age: 30},&#xA;    2: {name: 'John', age: 32}&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By trying to target the key &lt;code&gt;1&lt;/code&gt; to change its hash and output &lt;code&gt;users&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = users|merge([ users.1|merge({age: 1000}) ]) %}&#xA;&#xA;{% for key, user in users %}&#xA;    {{ key }}: {{ user.name }}, {{ user.age }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...we get this list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0: Bill, 25&#xA;1: Tim, 30&#xA;2: John, 32&#xA;3: Tim, 1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A new &quot;Tim&quot; user will get appended even if you make the keys strings like &lt;code&gt;'0'&lt;/code&gt;, &lt;code&gt;'1'&lt;/code&gt;, etc, or using Twig's &lt;code&gt;attribute&lt;/code&gt; function. &lt;a href=&quot;https://github.com/twigphp/Twig/issues/789&quot; rel=&quot;noreferrer&quot;&gt;An issue for this&lt;/a&gt; was posted in Twig's github and the conversation explains it some more. You can only change a value if it's an array with a list of single values (not a hash) or if it's a key/value hash, and the key can't be an integer.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2017-10-29T22:02:07.303" LastActivityDate="2017-10-29T22:02:07.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22629" PostTypeId="1" AcceptedAnswerId="22633" CreationDate="2017-10-30T01:18:37.980" Score="2" ViewCount="462" Body="&lt;p&gt;I'm creating a plugin but want to simplify the title that appears in the CMS' left-hand main navigation for my client. I understand that by default it pulls from the &lt;code&gt;getName&lt;/code&gt; method but I want to choose something different than what's set there. Is it possible to do this?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2019-04-22T17:54:17.720" Title="Change plugin title in main side nav" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22630" PostTypeId="2" ParentId="22627" CreationDate="2017-10-30T03:06:48.883" Score="3" Body="&lt;p&gt;Your &lt;code&gt;.htaccess&lt;/code&gt; is basically saying &quot;Redirect example.com to www.example.com&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, that's cool. so you want to add &lt;code&gt;www&lt;/code&gt; to any request that a comes in. I'm guessing you put this &lt;em&gt;after&lt;/em&gt; Craft's code? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This actually needs to come &lt;em&gt;before&lt;/em&gt; you send the request to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your example should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;&#xA;  #Make sure the rewrite engine is on&#xA;  RewriteEngine On&#xA;&#xA;  # Redirect non-www requests to www&#xA;  RewriteCond %{HTTP_HOST} ^example\.com [NC] &#xA;  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]&#xA;&#xA;  # Send would-be 404 requests to Craft&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;  RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2017-10-30T03:06:48.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22631" PostTypeId="2" ParentId="22629" CreationDate="2017-10-30T09:16:03.083" Score="1" Body="&lt;p&gt;Can you not do this with something like CPNav? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/verbb/cp-nav&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/cp-nav&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-10-30T09:16:03.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22633" PostTypeId="2" ParentId="22629" CreationDate="2017-10-30T11:51:18.943" Score="4" Body="&lt;p&gt;Yes, it's possible. It will require two steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a setting in your plugin for &lt;code&gt;pluginNameOverride&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Use that setting in place of the default name of your plugin when loading your plugin&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This does not change the name of the URL slug for your plugin in the admin URL and has different behavior in the UI in Craft 2 and Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Craft 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;1) Add a new setting following the instructions in the docs: &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/plugin-settings.html#settings-page&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/plugin-settings.html#settings-page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Once you have your setting working. You can do this in the &lt;code&gt;getName&lt;/code&gt; method of your primary plugin file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getName()&#xA;{&#xA;    $pluginName = Craft::t('Your plugin name');&#xA;    $pluginNameOverride = $this-&amp;gt;getSettings()-&amp;gt;pluginNameOverride;&#xA;&#xA;    return $pluginNameOverride ? $pluginNameOverride : $pluginName;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: While this changes the name in the nav, it also changes the name in several other places, such as the list of plugins on the plugin page. If a user changes it to something odd, it may not be obvious to you or someone else debugging that the website has your plugin installed.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Craft 3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;1) Add a new setting following the instructions in the docs: &#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-settings.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/plugin-settings.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Override the parent &lt;code&gt;label&lt;/code&gt; value in the &lt;code&gt;getCpNavItem&lt;/code&gt; method&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getCpNavItem()&#xA;{&#xA;    $parent = parent::getCpNavItem();&#xA;&#xA;    // Allow user to override plugin name in sidebar&#xA;    if ($this-&amp;gt;getSettings()-&amp;gt;pluginNameOverride)&#xA;    {&#xA;        $parent['label'] = $this-&amp;gt;getSettings()-&amp;gt;pluginNameOverride;&#xA;    }&#xA;&#xA;    return array_merge($parent,[&#xA;        'subnav' =&amp;gt; [&#xA;            'sectionName' =&amp;gt; [&#xA;                'label' =&amp;gt; Craft::t('your-plugin', 'Tab Name'),&#xA;                'url'   =&amp;gt; 'your-plugin/section-name'&#xA;            ]&#xA;        ]&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This just changes your plugin name in the sidebar URL. Your plugin will continue to use its original name in the settings area.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="3630" LastEditDate="2019-04-22T17:54:17.720" LastActivityDate="2019-04-22T17:54:17.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22634" PostTypeId="2" ParentId="22610" CreationDate="2017-10-30T13:18:13.337" Score="0" Body="&lt;p&gt;Your form action attribute should not be empty (&lt;code&gt;$('input[name=&quot;action&quot;]', form).attr('action')&lt;/code&gt;) and your AJAX request should be sent using POST (&lt;code&gt;$.post&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.post('/', {&#xA;    dataType: 'json',&#xA;    action: $('input[name=&quot;action&quot;]', form).attr('action'),&#xA;    data: $(this).serialize(),&#xA;    success: function(response) {&#xA;        if (response.success) {&#xA;            $('.request-ring-sizer .form-success').addClass(&quot;visible&quot;);&#xA;        } else {&#xA;&#xA;            alert('An error occurred. Please try again.');&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-10-30T13:18:13.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22635" PostTypeId="1" CreationDate="2017-10-30T17:20:55.750" Score="1" ViewCount="37" Body="&lt;p&gt;I've run into an odd issue and I can't seem to figure out what is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Normal Process:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I click the Share arrow on a disabled entry.&lt;/li&gt;&#xA;&lt;li&gt;I copy the tokenized link and send it out.&lt;/li&gt;&#xA;&lt;li&gt;Folks without accounts are able to preview the page.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is happening now:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I click the Share arrow on a disabled entry.&lt;/li&gt;&#xA;&lt;li&gt;I copy the tokenized link and send it out.&lt;/li&gt;&#xA;&lt;li&gt;Folks without accounts are given a 'Forbidden' warning. If I refresh my preview page, I also get the same warning.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTES: There is no authentication required to access the template itself.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked the latest updates to Craft but did not see anything obvious that might affect that. I double-checked that the token time extension that we added in general.php and it's still set to a week.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G97DM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G97DM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7460" LastEditorUserId="45" LastEditDate="2017-11-12T20:50:39.597" LastActivityDate="2017-11-12T20:50:39.597" Title="Share: Getting 'Forbidden' message when sharing externally" Tags="&lt;entry&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22636" PostTypeId="2" ParentId="566" CreationDate="2017-10-30T19:23:19.187" Score="3" Body="&lt;p&gt;This limits it to 4 places and trims only trailing zeroes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ item.width | number_format(4) | trim(&quot;0&quot;, &quot;right&quot;) | trim(&quot;.&quot;) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7462" LastActivityDate="2017-10-30T19:23:19.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22637" PostTypeId="1" AcceptedAnswerId="22639" CreationDate="2017-10-30T19:43:00.833" Score="1" ViewCount="145" Body="&lt;p&gt;I am using the code from the example templates to integrate a simple stripe pay button on a commerce site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;/&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/orders/order?number={number}&quot;/&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/checkout/payment&quot;/&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  {% if cart.paymentMethod.class == 'Stripe' %}&#xA;  &amp;lt;script&#xA;    src=&quot;https://checkout.stripe.com/checkout.js&quot;&#xA;    class=&quot;stripe-button&quot;&#xA;    data-label=&quot;Pay Now&quot;&#xA;    data-key=&quot;{{ cart.paymentMethod.settings.publishableKey ?? '' }}&quot;&#xA;    data-name=&quot;{{ siteName }}&quot;&#xA;    data-image=&quot;/assets/img/tfa-logo-128.png&quot;&#xA;    data-description=&quot;Membership&quot; {# This is not used for order description in stripe - see Craft Commerce general settings #}&#xA;    data-email=&quot;{{ cart.email }}&quot;&#xA;    data-currency=&quot;{{ cart.paymentCurrency }}&quot;&#xA;    data-amount=&quot;{{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true,format=false) * 100 }}&quot;&#xA;    data-locale=&quot;auto&quot;&amp;gt;&#xA;  &amp;lt;/script&amp;gt;&#xA;  {% endif %}&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the form submits I get back the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Stripe no longer supports API requests made with TLS 1.0. Please&#xA;  initiate HTTPS connections with TLS 1.2 or later. You can learn more&#xA;  about this at &lt;a href=&quot;https://stripe.com/blog/upgrading-tls&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://stripe.com/blog/upgrading-tls&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this something that needs updating in the commerce plugin? I am running my local site using HTTPS using Valet. I found &lt;a href=&quot;https://packagist.org/packages/stripe/stripe-php#user-content-ssl--tls-compatibility-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; which suggests it might be the plugin that needs updating (I am using the latest version of craft commerce).&lt;/p&gt;&#xA;" OwnerUserId="132" LastEditorUserId="6007" LastEditDate="2019-05-02T17:32:10.300" LastActivityDate="2019-05-02T17:32:10.300" Title="Error with Craft Commerce &amp; Stripe no longer supports API requests made with TLS 1.0" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="22639" PostTypeId="2" ParentId="22637" CreationDate="2017-10-30T20:55:09.923" Score="2" Body="&lt;p&gt;This is an issue with your local install of OpenSSL &lt;code&gt;curl&lt;/code&gt;/PHP or some other system level component. &lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-30T20:55:09.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22641" PostTypeId="2" ParentId="566" CreationDate="2017-10-30T21:33:36.770" Score="1" Body="&lt;p&gt;If you don't want to pipe that much, you should be able to use &lt;code&gt;sprintf&lt;/code&gt; and do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ '%02g' | format(item.width) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/format.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/filters/format.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fi2.php.net/manual/en/function.sprintf.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://fi2.php.net/manual/en/function.sprintf.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-10-30T21:33:36.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22642" PostTypeId="2" ParentId="9265" CreationDate="2017-10-30T22:30:06.770" Score="4" Body="&lt;p&gt;For others that might be facing an issue similar to this – we found that our Craft site was gradually getting slower and slower over a period of several days, despite using the &lt;code&gt;{% cache %}&lt;/code&gt; tag. When we cleared the template cache, the site would be fast again until the cache grew in size and got slow again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was our uninformed use of the &lt;code&gt;{% cache %}&lt;/code&gt; tag that contributed to this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to firstly understand that &lt;strong&gt;using &lt;code&gt;{% cache %}&lt;/code&gt; without any parameters generates a separate copy of the block for every single URL that uses it&lt;/strong&gt;. If the page is requested with a different querystring, again the block is regenerated and a new copy is saved to the cache. This means you could potentially have many dozens, hundreds, or even thousands of copies of the same block in your cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because we had several search pages with URLs like &lt;code&gt;/search?q=searchterm&lt;/code&gt;, this kept creating more and more cached blocks every time somebody did a search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in our case we had to be more explicit when using the cache tag, in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For any block that should always output the same, regardless of URL, use  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For any block that &lt;em&gt;does&lt;/em&gt; change based on URL, but perhaps not on querystring (such as perhaps a menu/nav block) then use something like:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key &quot;navbar:&quot; ~ craft.request.path %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(as mentioned in the &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And here are the results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8eH6H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8eH6H.png&quot; alt=&quot;Craft CMS cache slowness&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastEditorUserId="5437" LastEditDate="2017-10-30T23:32:49.030" LastActivityDate="2017-10-30T23:32:49.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22643" PostTypeId="2" ParentId="12503" CreationDate="2017-10-30T23:30:46.927" Score="1" Body="&lt;p&gt;As described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/22642/5437&quot;&gt;this thread&lt;/a&gt;, we found that our Craft site was gradually getting slower and slower over a period of several days, despite using the &lt;code&gt;{% cache %}&lt;/code&gt; tag. When we cleared the template cache, the site would be fast again until the cache grew in size and got slow again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was our uninformed use of the &lt;code&gt;{% cache %}&lt;/code&gt; tag that contributed to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to firstly understand that &lt;strong&gt;using &lt;code&gt;{% cache %}&lt;/code&gt; without any parameters generates a separate copy of the block for every single URL that uses it&lt;/strong&gt;. If the page is requested with a different querystring, again the block is regenerated and a new copy is saved to the cache. This means you could potentially have many dozens, hundreds, or even thousands of copies of the same block in your cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read my full answer at: &lt;em&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/22642/5437&quot;&gt;Cache issues making site super slow in production but not in dev mode&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2017-10-30T23:30:46.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22644" PostTypeId="2" ParentId="9265" CreationDate="2017-10-31T06:16:05.527" Score="1" Body="&lt;p&gt;This will probably help you: &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-10-31T06:16:05.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22645" PostTypeId="2" ParentId="22621" CreationDate="2017-10-31T06:31:40.573" Score="0" Body="&lt;p&gt;Here is my working solution, basically all you need to do is grab the token from stripe and then submit it with the form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;https://checkout.stripe.com/checkout.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&amp;lt;form method=&quot;POST&quot; id=&quot;payment-form&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/checkout/payment&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/orders/order?number={number}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;token&quot; id=&quot;stripe-token&quot; value=&quot;&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;&#xA;  &amp;lt;button id=&quot;paymentButton&quot; class=&quot;button is-primary&quot;&amp;gt;&#xA;      &amp;lt;span class=&quot;icon&quot;&amp;gt;&#xA;        &amp;lt;i class=&quot;fa fa-check&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;      &amp;lt;/span&amp;gt;&#xA;      &amp;lt;span&amp;gt;&#xA;        Purchase&#xA;      &amp;lt;/span&amp;gt;&#xA;  &amp;lt;/button&amp;gt;&#xA;&#xA;  &amp;lt;script&amp;gt;&#xA;    var handler = StripeCheckout.configure({&#xA;      key: '{{ cart.paymentMethod.settings.publishableKey ?? '' }}',&#xA;      image: '/assets/img/tfa-logo-128.png',&#xA;      locale: 'auto',&#xA;      token: function(token) {&#xA;        // You can access the token ID with `token.id`.&#xA;        var stripeToken = token.id;&#xA;        // Get the token ID to your server-side code for use.&#xA;        document.getElementById('stripe-token').value = stripeToken;&#xA;        document.getElementById('payment-form').submit();&#xA;      }&#xA;    });&#xA;&#xA;    document.getElementById('paymentButton').addEventListener('click', function(evt) {&#xA;      // Open Checkout with further options:&#xA;      handler.open({&#xA;        name: '{{ siteName }}',&#xA;        email: '{{ cart.email }}',&#xA;        currency: '{{ cart.paymentCurrency }}',&#xA;        description: 'Membership',&#xA;        zipCode: true,&#xA;        amount: {{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true,format=false) * 100 }}&#xA;      });&#xA;      evt.preventDefault();&#xA;    });&#xA;&#xA;    // Close Checkout on page navigation:&#xA;    window.addEventListener('popstate', function() {&#xA;      handler.close();&#xA;    });&#xA;  &amp;lt;/script&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="132" LastEditorUserId="132" LastEditDate="2017-10-31T20:31:06.377" LastActivityDate="2017-10-31T20:31:06.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22646" PostTypeId="2" ParentId="22610" CreationDate="2017-10-31T10:08:36.173" Score="0" Body="&lt;p&gt;Turns out this was a mistake in the README docs. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;The v1 README uses $.post, so this is only an issue when someone uses&#xA;  the v1 plugin and the v2 ajax instructions. I haven't tested it with&#xA;  v2, but it looks like the SendController requires POST too.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The author of the plugin has now fixed this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/contact-form/issues/102&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/issues/102&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7165" LastActivityDate="2017-10-31T10:08:36.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22648" PostTypeId="1" AcceptedAnswerId="22659" CreationDate="2017-10-31T16:35:28.087" Score="1" ViewCount="1112" Body="&lt;p&gt;I'm trying to do a nicely formatted email from a plugin I'm making. The standard way I've been doing simple emails is all entirely in the code, somewhat like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$notificationEmail = new EmailModel();&#xA;$notificationEmail -&amp;gt; toEmail  = $userEmail;&#xA;$notificationEmail -&amp;gt; subject  = &quot;Subject here&quot;;&#xA;$notificationEmail -&amp;gt; body     = &quot;Thanks $userName, you’re now registered on our website.&quot;;&#xA;$notificationEmail -&amp;gt; htmlBody = &quot; ... MASSIVE COMPLICATED STUFF THATS FAR BETTER SUITED TO TWIG ... &quot;&#xA;craft()-&amp;gt;email-&amp;gt;sendEmail($notificationEmail);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've now got an email that is far better suited to being generated via a Twig template because I'm going to have to loop through relational fields and all sorts. I have no idea how and I don't seem to know what to Google to get what I'm after... Anyone got pointers to this sort of thing?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-11-01T12:13:45.583" Title="How do I use a Twig template to generate Email content from inside a plugin I'm making?" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22649" PostTypeId="1" CreationDate="2017-10-31T18:08:39.320" Score="3" ViewCount="961" Body="&lt;p&gt;There was this &quot;one time fee&quot; mantra overall and now I read &#xA;&lt;a href=&quot;https://craftcms.com/news/dot-all-2017-announcements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/dot-all-2017-announcements&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They will charge additionally on yearly base?&#xA;Does this include any update and security updates as well? &lt;/p&gt;&#xA;" OwnerUserId="7183" LastEditorUserId="57" LastEditDate="2017-10-31T18:18:55.757" LastActivityDate="2017-10-31T20:05:19.423" Title="Updates for v3 are paid only?" Tags="&lt;craft3&gt;&lt;pricing&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22650" PostTypeId="1" AcceptedAnswerId="22657" CreationDate="2017-10-31T19:57:09.483" Score="1" ViewCount="329" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nj4JC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nj4JC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to launch a Craft CMS site on 1&amp;amp;1.co.uk web hosting. I've uploaded my database, changed the siteUrl and uploaded the site with FTP but it's not working. I receive an error message (see image).&lt;/p&gt;&#xA;" OwnerUserId="7466" LastActivityDate="2017-11-01T12:10:48.857" Title="Trying to launch Craft CMS site on 1&amp;1.co.uk and told I don't have permission. Any help why?" Tags="&lt;templating&gt;&lt;url&gt;&lt;error&gt;&lt;installation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22651" PostTypeId="2" ParentId="22649" CreationDate="2017-10-31T19:59:18.910" Score="4" Body="&lt;p&gt;Ever since Craft 1 launched in 2013, purchasing a Craft license (Client or Pro editions) has included free updates – even major releases, which means that your current Craft 2 site will be eligible for a free upgrade to Craft 3 once it launches in April 2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the release of Craft 3, this will change: in order for your site to stay updated, you'll have to renew your Client or Pro license yearly, for a reduced fee ($39/year for Client edition, $59/year for Pro). If you opt out of renewing after the first year, you won't receive any further updates, but your license will still be valid and your site will still work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that the yearly fee does not apply to any existing licenses, which will continue to receive free updates indefinitely&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://craftcms.com/news/dot-all-2017-announcements&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/news/dot-all-2017-announcements&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-10-31T20:05:19.423" LastActivityDate="2017-10-31T20:05:19.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22652" PostTypeId="2" ParentId="2576" CreationDate="2017-10-31T20:31:35.350" Score="4" Body="&lt;p&gt;If your permissions are set correctly, your php.ini is all correct, your craft folder exists and everything seems like it should work fine... Make sure you have the &lt;code&gt;app&lt;/code&gt; folder inside the &lt;code&gt;craft&lt;/code&gt; folder as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll get the &quot;Could not find your craft/ folder.&quot; if there is no app folder.&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2017-10-31T20:31:35.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22653" PostTypeId="1" AcceptedAnswerId="22662" CreationDate="2017-11-01T08:18:54.690" Score="1" ViewCount="343" Body="&lt;p&gt;Looking at this plugin.&#xA;&lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need a form to do this, any help would be pic guys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fill in form - sends email to nominated email with enquiry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If sign up to newsletter is chosen then the name is added to mailchimp list and opt in email sent&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If sign up response is negative form still sends email to us, but the users email is not added to the mailchimp list or is added with a status of unsubscribe.&lt;/p&gt;&#xA;" OwnerUserId="7467" LastActivityDate="2017-11-01T14:24:48.170" Title="Form question - freeform /mailchimp" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22654" PostTypeId="1" CreationDate="2017-11-01T10:13:38.530" Score="1" ViewCount="45" Body="&lt;p&gt;I've just migrated a craft site to a staging server from a local environment and have come across an odd bug I have no idea what's causing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the word &quot;select&quot; in a blog post, the entry doesn't save and instead goes to a 404 page. If I capitalise a letter, &quot;Select&quot; for instance, it saves fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a rich text field that has the content and this didn't happen on my local environment either. There doesn't seem to be any errors showing up in craft logs as far as I can tell either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7469" LastEditorUserId="57" LastEditDate="2017-11-01T17:09:56.057" LastActivityDate="2017-11-01T17:09:56.057" Title="Specific word stops entry from saving" Tags="&lt;entries&gt;&lt;saving&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22655" PostTypeId="2" ParentId="22534" CreationDate="2017-11-01T10:22:18.207" Score="1" Body="&lt;p&gt;I've contacted Freeforms (Solspace). Unfortunately there is no solution for this problem (yet). Solspace told me:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This functionality currently isn't possible with Freeform. It's something on our feature requests list though.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5271" LastActivityDate="2017-11-01T10:22:18.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22657" PostTypeId="2" ParentId="22650" CreationDate="2017-11-01T10:36:41.513" Score="1" Body="&lt;p&gt;It's likely a problem with permissions on your folders. You can find the right permissions here: &lt;a href=&quot;https://craftcms.com/docs/installing#step-2-set-the-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/installing#step-2-set-the-permissions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2017-11-01T10:36:41.513" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22658" PostTypeId="2" ParentId="22650" CreationDate="2017-11-01T12:10:48.857" Score="1" Body="&lt;p&gt;I used to use 1and1 servers and this came up when my .htaccess wasn't set. Be sure to add the '.' to the beginning of the htaccess file name within the 'public' folder that comes with craft and you may even have to add 'RewriteBase /' to it too.&lt;/p&gt;&#xA;" OwnerUserId="4942" LastActivityDate="2017-11-01T12:10:48.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22659" PostTypeId="2" ParentId="22648" CreationDate="2017-11-01T12:13:45.583" Score="0" Body="&lt;p&gt;Thanks to Brad for providing the bulk of the answer. In more detail the line needing to be changed was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$notificationEmail -&amp;gt; htmlBody = craft()-&amp;gt;templates-&amp;gt;render('PLUGIN-FOLDER-NAME/TEMPLATE-NAME', ['theUser' =&amp;gt; $user]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could then use {{ theUser }} (Which is a UserModel) in the TEMPLATE-NAME template to generate everything I needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the full solution, to send an Email from a plugin, but using a Twig template to generate the HTML email content was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myEmail             = new EmailModel();&#xA;$myEmail -&amp;gt; toEmail  = $user-&amp;gt;email;&#xA;$myEmail -&amp;gt; subject  = &quot;Subject here&quot;;&#xA;$myEmail -&amp;gt; body     = &quot;PLAIN TEXT CONTENT&quot;;&#xA;$myEmail -&amp;gt; htmlBody = craft()-&amp;gt;templates-&amp;gt;render('PLUGIN-FOLDER-NAME/TEMPLATE-NAME', ['theUser' =&amp;gt; $user]);&#xA;craft()-&amp;gt;email-&amp;gt;sendEmail($myEmail);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $user was a variable containing a UserModel which I'd already got from previous code in the plugin I was writing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/services/TemplatesService#render-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/TemplatesService#render-detail&lt;/a&gt; for more detail (but for which I wish there were example code of how to use, and not just a dictionary).&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-11-01T12:13:45.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22660" PostTypeId="1" CreationDate="2017-11-01T12:51:26.877" Score="1" ViewCount="3088" Body="&lt;p&gt;Craft CMS 3 - I have used the CLI ./craft setup script to set the database connection on my local machine. I setup a MySQL connection, but when it attempts to validate my credentials, I get &quot;failed: could not find driver&quot;. However, when I make a direct MySQL CLI connection using the same credentials, it works just fine. Why can Craft CMS not connect to my local database?&lt;/p&gt;&#xA;" OwnerUserId="7470" LastEditorUserId="57" LastEditDate="2017-11-01T17:09:34.407" LastActivityDate="2018-03-21T07:58:02.920" Title="failed: could not find driver" Tags="&lt;database&gt;&lt;craft3&gt;&lt;cli&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22661" PostTypeId="2" ParentId="22654" CreationDate="2017-11-01T13:18:57.980" Score="4" Body="&lt;p&gt;This sounds like a &lt;code&gt;mod_security&lt;/code&gt; issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to reach out to whoever manages your server and ask them to relax the security around saving data to all URLs under your &lt;code&gt;/admin&lt;/code&gt; URL area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is happening behind the scenes is that the security on your server thinks that you may be trying to query the database and do something malicious. i.e. &lt;code&gt;SELECT * FROM craft_users;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-11-01T13:18:57.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22662" PostTypeId="2" ParentId="22653" CreationDate="2017-11-01T14:24:48.170" Score="2" Body="&lt;p&gt;Freeform includes &lt;a href=&quot;https://solspace.com/craft/freeform/docs/mailing-list-integrations/&quot; rel=&quot;nofollow noreferrer&quot;&gt;mail list integration&lt;/a&gt; for MailChimp, Constant Contact (pro only) and Campaign Monitor (pro only).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://solspace.com/craft/freeform/docs/mailing-list-integrations/&quot; rel=&quot;nofollow noreferrer&quot;&gt;As per their documentation&lt;/a&gt;, form fields can be mapped to your mail list. You can include a checkbox so visitors can choose to subscribe when submitting a form. If they do tick the checkbox, they will be sent a double opt in email (if this is enabled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do bear in mind though that MailChimp is &lt;a href=&quot;https://kb.mailchimp.com/lists/signup-forms/about-double-opt-in&quot; rel=&quot;nofollow noreferrer&quot;&gt;rolling out single opt-in&lt;/a&gt; from 31st October 2017 unless you're within the EU.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastActivityDate="2017-11-01T14:24:48.170" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22663" PostTypeId="1" CreationDate="2017-11-01T17:27:47.550" Score="1" ViewCount="57" Body="&lt;p&gt;I'm trying to set a default asset folder for a field, as per the Craft docs on &lt;a href=&quot;https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Subfolder Paths&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set the asset path for each blog article to be &lt;code&gt;/our-journal/{date}/{slug}&lt;/code&gt;, where date is the creation date of the article, falling back to today's date otherwise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/our-journal/{ entry.dateCreated|date('Y-m') ?: now|dateCreated('Y-m') }/{ slug }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting an internal server error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not resolve the subpath “our-journal/{ entry.dateCreated|date('Y-m') ?: now|dateCreated('Y-m') }/{ slug }”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've tried using both single and double braces around the variables, as the docs are a bit ambiguous.&lt;/p&gt;&#xA;" OwnerUserId="6731" LastActivityDate="2017-11-02T10:43:55.973" Title="Trying to set a default asset folder using Craft tags" Tags="&lt;assets&gt;&lt;field&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22665" PostTypeId="1" AcceptedAnswerId="22672" CreationDate="2017-11-01T18:41:12.183" Score="1" ViewCount="241" Body="&lt;p&gt;For some reason, order confirmation emails are being sent to customers who create an account during checkout but not if they checkout as a guest. I also see the error: &lt;code&gt;Email error. No email address found for order.&lt;/code&gt; in the &lt;code&gt;commerce.log&lt;/code&gt; file. Anyone know how to get the order confirmations to go out to guest users too? The emails are getting captured, as they show up in the backend. I'm using the latest versions of Craft and Commerce. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Even changing the order in the admin to another status and back still does not trigger an email to the user.&lt;/p&gt;&#xA;" OwnerUserId="4700" LastEditorUserId="4700" LastEditDate="2017-11-01T18:56:04.790" LastActivityDate="2017-11-02T01:46:27.040" Title="Order confirmation emails not being sent to guests" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22667" PostTypeId="1" AcceptedAnswerId="22668" CreationDate="2017-11-01T19:57:38.687" Score="1" ViewCount="522" Body="&lt;p&gt;I am making an ajax request to an entry. It is returning the entry's html - and all is working great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a section called &quot;portfolio&quot; and I loop through each:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;portfolio/index.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set projects = craft.entries.section('portfolio') %}&#xA;...&#xA;{% for project in projects %}   &#xA;    ...&#xA;    &amp;lt;a href=&quot;#!{{ project.slug }}&quot; class=&quot;hover-overlay&quot;&amp;gt;&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the project is clicked, I am making an ajax request to an entry. It is returning the entry's html - and all is working great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to strip out the &lt;em&gt;static&lt;/em&gt; html, and access the parent's entry variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is the html that I am returning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;portfolio/_entry.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;item-content&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;My Project&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-9&quot;&amp;gt;&#xA;            {# image will go here. #}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-md-3&quot;&amp;gt;&#xA;            &amp;lt;h4&amp;gt;My Project Description&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas eros dolor, efficitur lobortis eros et, dictum hendrerit nulla.&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;Client: My Client&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&amp;lt;h3&amp;gt;{{ project.title }}&amp;lt;/h3&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to do is something like this from within &lt;code&gt;portfolio/_entry.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set project = ?? %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that I &lt;em&gt;can&lt;/em&gt; use &lt;code&gt;{{ project.title }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-11-01T20:21:55.520" Title="How can I access a template variable from an include that is loaded via ajax?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22668" PostTypeId="2" ParentId="22667" CreationDate="2017-11-01T20:14:44.223" Score="1" Body="&lt;p&gt;Since you are only trying to access the existing entry model, you should be able to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;portfolio/_entry.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set project = entry %}&#xA;...&#xA;&amp;lt;h1&amp;gt;{{ project.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2017-11-01T20:21:55.520" LastActivityDate="2017-11-01T20:21:55.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22669" PostTypeId="2" ParentId="20017" CreationDate="2017-11-01T20:16:31.420" Score="2" Body="&lt;p&gt;Try all of the above suggestions first, then...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've added the configuration of 'defaultCookieDomain' to /craft/config/general.php as I did, you may see this error. I'm using MAMP which has no value set for session.cookie_domain in php.ini. I'm assuming that the conflict between my config setting in Craft and the setting in php.ini was the cause of this issue? To resolve the issue, I just removed the defaultCookieDomain in Craft general.php and the problem is resolved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure that it's even necessary to set defaultCookieDomain considering what the Craft documentation says about this config: &quot;The default domain name Craft will use when sending cookies to the browser. If it is left blank, Craft will leave it up to the browser to decide – which will be whatever the current request’s domain name is.&quot;&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2017-11-01T20:16:31.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22670" PostTypeId="1" AcceptedAnswerId="22671" CreationDate="2017-11-01T21:51:30.287" Score="1" ViewCount="257" Body="&lt;p&gt;I see there is a freeform forms fieldtype available after the plugin was installed. What exactly does this field do and how to render it correctly (within matrix)?&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2019-01-21T13:04:51.537" Title="Freeform forms fieldtype" Tags="&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22671" PostTypeId="2" ParentId="22670" CreationDate="2017-11-01T23:17:23.047" Score="3" Body="&lt;p&gt;From the &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v1/overview/fieldtype.html#how-the-fieldtypes-work&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Freeform Form (or Submissions) fieldtype lets the user assign any&#xA;  Freeform form (or form submissions) to any element: a section entry,&#xA;  categories, assets, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In a nutshell, this means you can embed forms to any entries you have, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kdgup.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kdgup.png&quot; alt=&quot;Embed freeform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.solspace.com/craft/freeform/v1/overview/fieldtype.html#usage-in-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;This section&lt;/a&gt; within the docs shows you how to correctly code your templates.&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="4496" LastEditDate="2019-01-21T13:04:51.537" LastActivityDate="2019-01-21T13:04:51.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22672" PostTypeId="2" ParentId="22665" CreationDate="2017-11-02T01:46:27.040" Score="2" Body="&lt;p&gt;Fixed by updating to 1.2.1350 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/changelog#build1350&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/changelog#build1350&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-11-02T01:46:27.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22673" PostTypeId="1" CreationDate="2017-11-02T05:50:38.480" Score="1" ViewCount="87" Body="&lt;p&gt;Currently looking into a site which requires a simple invoice payment form which needs to checkout with Worldpay.&#xA;Forms fields are simply Name, Email, Address, Invoice No and Invoice Amount.&#xA;I would like the payments to be stored in the backend of the CMS - and whether successful or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most straight forward way to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current Thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Craft Commerce - Will I need this full solution? Can it accept custom price fields - as per Invoice Amount?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Create Basic Form which can save the entries using the Guest Entries Plugin - When submitted it saves the details and loads a page on my site to verify information which also loads the details into the basic Worldpay Form method with a Complete Payment button.&#xA;Then to update record if payment successful - enter a url in the Worldpay Callback url which calls a custom plugin which will update the Payment Status of the entry. (I haven't created any plugins yet but in theory this one should be straight forward?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - Use some of the existing form solutions out there and hook into some events with those to update payment status? Sprout Forms, Freeform, Form Builder, AM Forms- &lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-11-02T05:50:38.480" Title="Simple Payment Form with Worldpay" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-sproutforms&gt;&lt;plugin-freeform&gt;&lt;plugin-guestentries&gt;&lt;plugin-amforms&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22676" PostTypeId="2" ParentId="22663" CreationDate="2017-11-02T10:07:10.873" Score="1" Body="&lt;p&gt;I had a stupid typo in my path, where instead of the &lt;code&gt;date&lt;/code&gt; filter, I'd typed &lt;code&gt;dateCreated&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/our-journal/{ entry.dateCreated|date('Y-m') ?: now|dateCreated('Y-m') }/{ slug }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/our-journal/{ entry.dateCreated|date('Y-m') ?: now|date('Y-m') }/{ slug }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which, with what I learnt about fallbacks (see below), can be shortened to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/our-journal/{ entry.dateCreated|date('Y-m') }/{ slug }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you're doing this within a matrix field, the entry is referred to by &lt;code&gt;owner&lt;/code&gt; - so you'd need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/our-journal/{ owner.dateCreated|date('Y-m') }/{ owner.slug }/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fallbacks&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also found that I didn't need to provide fallbacks for entry tags - I'd thought that I'd need to provide a fallback for when a new entry hasn't yet been saved (to stop it falling over on e.g. &lt;code&gt;dateCreated&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that Craft is clever enough to hold the image in some temporary store, then move it into the intended folder when the article is first saved.&lt;/p&gt;&#xA;" OwnerUserId="6731" LastEditorUserId="6731" LastEditDate="2017-11-02T10:43:55.973" LastActivityDate="2017-11-02T10:43:55.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22677" PostTypeId="1" CreationDate="2017-11-02T16:16:28.650" Score="0" ViewCount="79" Body="&lt;p&gt;Reposted from Slack&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to create a migration using console (as per docs) but whilst it created a &lt;code&gt;migrations&lt;/code&gt; folder it did not create a migration file. So resorted to creating manually but now getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Status: Internal Server Error&#xA;Response: &amp;lt;h1&amp;gt;Craft\Exception&amp;lt;/h1&amp;gt; &amp;lt;p&amp;gt;Could not validate update handle. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The offending migration file can be viewed at &lt;a href=&quot;https://gist.github.com/cole007/4bfff23c693ca496ca4929f464df2a05&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/cole007/4bfff23c693ca496ca4929f464df2a05&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking into the Update Controller that is throwing the error it seems to be down to the &lt;code&gt;_getFixedHandle()&lt;/code&gt; method where $data['handle'] is returning empty but no idea why this is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on debugging or resolving? Site launch is imminent so need to get to the bottom of why this is happening soon!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-11-02T19:09:33.843" Title="Plugin migration question" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22678" PostTypeId="1" CreationDate="2017-11-02T17:30:35.493" Score="0" ViewCount="61" Body="&lt;p&gt;using Freeform Pro, set mailchimp key, how do I target a specific list on mailchimp to send and config with please?&lt;/p&gt;&#xA;" OwnerUserId="7467" LastActivityDate="2017-12-27T10:57:48.833" Title="Freeform Mailchimp List - Target" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22679" PostTypeId="1" AcceptedAnswerId="24022" CreationDate="2017-11-02T18:17:46.997" Score="2" ViewCount="79" Body="&lt;p&gt;I'm trying to use the Imager plugin with some asset transforms that I've defined in the admin panel.  Passing the name of the transform is just tossing an error at me.  Is there a way to do this, or do I need to define the transforms inline?&lt;/p&gt;&#xA;" OwnerUserId="7447" LastActivityDate="2018-02-28T16:09:00.007" Title="Use Imager plugin with AssetTransforms defined in admin panel" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;plugin-imager&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22680" PostTypeId="2" ParentId="22679" CreationDate="2017-11-02T18:26:10.070" Score="2" Body="&lt;p&gt;You'll have to define your transforms inline - Imager doesn't support named (i.e. CP-/admin-defined) transforms.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2017-11-02T18:26:10.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22681" PostTypeId="2" ParentId="22677" CreationDate="2017-11-02T19:09:33.843" Score="2" Body="&lt;p&gt;Okay - this was a problem at our end. &#xA;We had a plugin which provided a twig extension that modified Craft's own hash method which was causing issues with the migration update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider solved! &lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2017-11-02T19:09:33.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22682" PostTypeId="1" CreationDate="2017-11-03T08:44:50.827" Score="1" ViewCount="83" Body="&lt;p&gt;I have made a plugin where I save a status of a related entry. I have enabled revisions in the section. But when I update the status entry, a new version is made with the newest content, but all the content of the previous versions are overwritten and are the same as the latest version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I forgot something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$saveStatus = craft()-&amp;gt;elements-&amp;gt;getElementById($statusEntry-&amp;gt;id);&#xA;$saveStatus-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;                            'eigenaarId'  =&amp;gt; array($user-&amp;gt;id),&#xA;                            'advertentieId' =&amp;gt; array($entryID),&#xA;                            'doorkoppelaarId' =&amp;gt; array($doorkoppelaar-&amp;gt;id),&#xA;                            'statusCode' =&amp;gt; $status['status_code'],&#xA;                            'statusMessage' =&amp;gt; $return[$i]['message'],&#xA;                            'statusErrors' =&amp;gt; json_encode($errors),&#xA;                            'statusWarnings' =&amp;gt; json_encode($warnings),&#xA;                        ));&#xA;&#xA;$newStatusEntry = craft()-&amp;gt;entries-&amp;gt;saveEntry($saveStatus);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sCPqy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sCPqy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7479" LastEditorUserId="7479" LastEditDate="2017-11-07T09:18:14.593" LastActivityDate="2017-11-07T09:18:14.593" Title="revision entry is the same with saveEntry in plugin" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22683" PostTypeId="1" CreationDate="2017-11-03T09:24:53.097" Score="1" ViewCount="248" Body="&lt;p&gt;We're building out a Commerce site that needs an &quot;Insurance&quot; option set on an order. Based on the selected option, a percentage of the subtotal should be added to the total amount in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added an adjuster for this, added a field to the order to keep track of which option the customer selects and I can add the adjuster to the order (as in: the type &amp;amp; amount are added to the cart in the backend).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it seems I can't add that amount to the cart total. In the docs I found this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Included Adjustments&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you mark the adjustment model’s included attribute as true, the&#xA;  adjustment does not make any changes to the orders value, but simply&#xA;  records an amount that was included in the price of the order.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The only included adjustment we use in the core system at the moment&#xA;  is included taxes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a way do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-11-03T09:24:53.097" Title="Include adjusters in order total" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;adjusters&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22685" PostTypeId="1" AcceptedAnswerId="22686" CreationDate="2017-11-03T17:07:26.490" Score="3" ViewCount="692" Body="&lt;p&gt;I'd like to show a 'Jobs' link in my navigation only if the Jobs page is enabled. Is there a way for craft to detect if the page is enabled, and show a div?&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="7327" LastEditDate="2017-11-03T17:42:24.970" LastActivityDate="2018-02-16T17:40:56.647" Title="If page is enabled, show div" Tags="&lt;conditional&gt;&lt;status&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22686" PostTypeId="2" ParentId="22685" CreationDate="2017-11-03T17:27:38.250" Score="6" Body="&lt;p&gt;You can check the status of an entry with &lt;code&gt;.status&lt;/code&gt;. &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries#status&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries#status&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code should work!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set jobsEntry = craft.entries.id(jobsId) %}&#xA;&#xA;{% if jobsEntry.status == 'live' %}&#xA;    &amp;lt;a href=&quot;{{ jobsEntry.url }}&quot;&amp;gt;Jobs&amp;lt;/a&amp;gt;&#xA;{% else  %}&#xA;    Jobs is disabled&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2017-11-03T17:27:38.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22687" PostTypeId="1" AcceptedAnswerId="22700" CreationDate="2017-11-04T10:24:58.977" Score="2" ViewCount="463" Body="&lt;p&gt;I am using a front-end form to upload images and store them as assets on an amazon S3 bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My server has imagick installed an uses it and in my config I have &quot;rotateImagesOnUploadByExifData&quot; set to true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When uploading an image I use this code to get the image and store it as an asset:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$file = UploadedFile::getInstanceByName('file');&#xA;$tempFilePath = $file-&amp;gt;getTempName();&#xA;$folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;    'sourceId' =&amp;gt; craft()-&amp;gt;config-&amp;gt;get('assetSourceId', 'myPlugin'),&#xA;    'id'       =&amp;gt; craft()-&amp;gt;config-&amp;gt;get('assetFolderId', 'myPlugin')&#xA;));            &#xA;&#xA;// Turn the file into a managed asset within that folder&#xA;$response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;    $tempFilePath,&#xA;    $file-&amp;gt;getName(),&#xA;    $folder-&amp;gt;id,&#xA;    AssetConflictResolution::KeepBoth&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything is working as expected, an asset is created, files get transferred to Amazon S3 bucket, but when transforming the image it shows rotated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I investigated:&#xA;The function 'insertFileByLocalPath' calls the function 'insertFileByPath' &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its turn this function performs the following check:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (IOHelper::getFileKind(IOHelper::getExtension($localFilePath)) == 'image'&#xA;            &amp;amp;&amp;amp; ImageHelper::isImageManipulatable(IOHelper::getExtension($localFilePath))&#xA;)&#xA;{&#xA;    craft()-&amp;gt;images-&amp;gt;cleanImage($localFilePath);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The cleanImage function should rotate the image and strip the exif data afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since these functions work with the temporary file name (which is e.g. &quot;/tmp/phpZB1A8y&quot;) this does not pass the test in the previous code. (it is not recognized as an image filename since it has no extension)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I could work around this issue?&lt;/p&gt;&#xA;" OwnerUserId="7482" LastEditorUserId="57" LastEditDate="2017-11-06T01:01:04.770" LastActivityDate="2018-10-24T13:11:57.697" Title="Rotate image according to EXIF orientation not working from a plugin" Tags="&lt;assets&gt;&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22689" PostTypeId="1" CreationDate="2017-11-04T13:57:05.640" Score="1" ViewCount="93" Body="&lt;p&gt;I would like to implement &lt;a href=&quot;https://developers.pinterest.com/docs/rich-pins/products/?&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pinterest Product Pin&lt;/a&gt; for my products. I need to update og:xxx values. Here is how i done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set og = seomaticMeta.og %}&#xA;{% set og = og | merge({'type': &quot;product&quot;, 'product:price:currency': &quot;USD&quot;, 'product:price:amount': variant.price|number_format(2) }) %}&#xA;{% set seomaticMeta = seomaticMeta | merge({'og': og}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds new tags but the property of the meta tag should not include 'og:' in product related meta tag. So this outputs something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:product:price:amount&quot; content=&quot;300.00&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;product:price:amount&quot; content=&quot;300.00&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can i achieve this?&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2017-11-04T15:00:51.480" Title="Edit meta property value in Open Graph meta tag" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22690" PostTypeId="2" ParentId="22689" CreationDate="2017-11-04T15:00:51.480" Score="1" Body="&lt;p&gt;Right now, SEOmatic assumes an &lt;code&gt;og:&lt;/code&gt; namespace for all OpenGraph tags, which clearly isn't correct. So you'd just need to add these tags yourself if you want to use them.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-04T15:00:51.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22692" PostTypeId="1" AcceptedAnswerId="22693" CreationDate="2017-11-04T23:59:48.073" Score="3" ViewCount="114" Body="&lt;p&gt;If I delete the Matrix block content (while editing an entry) does the associated is deleted as well or only the block but its data still remains in db?&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="57" LastEditDate="2017-11-06T01:09:07.147" LastActivityDate="2017-11-06T01:09:07.147" Title="Deleted matrix block means deleted data?" Tags="&lt;matrix&gt;&lt;database&gt;&lt;performance&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22693" PostTypeId="2" ParentId="22692" CreationDate="2017-11-05T11:16:03.397" Score="3" Body="&lt;p&gt;Any content or relationships that belong to the Matrix block will also be deleted, &lt;em&gt;when you save the entry&lt;/em&gt;. If there were any relationships, the target elements won’t be deleted, though.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-11-05T18:40:15.970" LastActivityDate="2017-11-05T18:40:15.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22695" PostTypeId="2" ParentId="21828" CreationDate="2017-11-05T16:51:52.237" Score="1" Body="&lt;p&gt;If you're running on Ubuntu, this will be relevant as well: &lt;a href=&quot;https://nystudio107.com/blog/the-case-of-the-missing-php-session&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Case of the Missing PHP Session&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-05T16:51:52.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22696" PostTypeId="1" AcceptedAnswerId="22697" CreationDate="2017-11-05T17:04:50.247" Score="1" ViewCount="50" Body="&lt;p&gt;I'm trying to bring in recommended products for adding to a bigger purchase. I set up a simple matrix but can't seem to figure out how to pull product information. This is what I have so far, it throws no errors, but it also gives nothing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in product.recommendProduct %}&#xA;    {% set i = i + 1 %}&#xA;       &amp;lt;div&amp;gt;&#xA;           {% set image = block.chooseProduct.mainProductImage.first() %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('productListing') }}&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ block.chooseProduct.title }}&amp;lt;/p&amp;gt;&#xA;       &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2017-11-05T19:23:13.023" Title="How to show a product from a field entry" Tags="&lt;plugin-craftcommerce&gt;&lt;matrix&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22697" PostTypeId="2" ParentId="22696" CreationDate="2017-11-05T19:23:13.023" Score="2" Body="&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.chooseProduct.first().mainProductImage.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation:&#xA;your field handle in your product is called &lt;code&gt;recommendProduct&lt;/code&gt; (matrix) that contains a relation &lt;code&gt;chooseProduct&lt;/code&gt;. Your &lt;code&gt;block.chooseProduct&lt;/code&gt; is an object of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt; so in order to fetch the product you need to call the &lt;code&gt;first()&lt;/code&gt; method (or something similar). So if you have multiple products in your &lt;code&gt;chooseProduct&lt;/code&gt; field your code would look like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in product.recommendProduct %}&#xA;{% set i = i + 1 %}&#xA;   &amp;lt;div&amp;gt;&#xA;       {% for relatedProduct in block.chooseProduct %}&#xA;            {% set image = relatedProduct.mainProductImage.first() %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('productListing') }}&quot;&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ relatedProduct.title }}&amp;lt;/p&amp;gt;&#xA;       {% endfor %} &#xA;   &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-05T19:23:13.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22698" PostTypeId="1" AcceptedAnswerId="22708" CreationDate="2017-11-06T05:35:30.793" Score="5" ViewCount="490" Body="&lt;p&gt;On Craft 2.x, is it a known limitation that we must allow &lt;code&gt;unsafe-inline&lt;/code&gt; for &lt;code&gt;script-src&lt;/code&gt; in the Content-Security-Policy? My admin dashboard fails to load when I don't allow it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...Trying to get a high grade on &lt;a href=&quot;https://observatory.mozilla.org/&quot; rel=&quot;noreferrer&quot;&gt;Mozilla Observatory&lt;/a&gt; :)&lt;/p&gt;&#xA;" OwnerUserId="7377" LastEditorUserId="125" LastEditDate="2017-11-06T14:31:48.407" LastActivityDate="2017-11-06T15:53:53.080" Title="Content Security Policy CSP" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22700" PostTypeId="2" ParentId="22687" CreationDate="2017-11-06T11:44:12.337" Score="1" Body="&lt;p&gt;The best way to do this would be to follow the same flow that Craft does - clean the filename, move to a temporary location, operate from there and afterwards delete the temporary file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft has an &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/assetsourcetypes/BaseAssetSourceType.php#L166-L170&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; in it's codebase to help you out. Just remember to delete the temp file afterwards.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2018-10-24T13:11:57.697" LastActivityDate="2018-10-24T13:11:57.697" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22701" PostTypeId="1" CreationDate="2017-11-06T12:41:24.510" Score="1" ViewCount="1838" Body="&lt;p&gt;How to create menus from admin panel of Craft 3 so I can render into frontend header and footer?&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="125" LastEditDate="2017-11-06T14:30:13.730" LastActivityDate="2018-05-24T04:58:05.160" Title="How to create menu in backend using Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;menu&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22702" PostTypeId="1" AcceptedAnswerId="22703" CreationDate="2017-11-06T13:43:27.360" Score="1" ViewCount="204" Body="&lt;p&gt;I'm working on a new website for my student radio station but I've stumbled into a few key bugs which are stopping us from advertising the new site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's live right now over on Stormfm.com, you'll be able to see the problems for yourselves there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The up coming shows section is supposed to display the next 3 shows, however there's a bug with it's limit, to get the section to display at least 3 shows I had to raise the limit to 30, this then means up to 30 shows display. I've copied the code below.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.section('shows').order('showTime').limit(30)&#xA;    if entry.showDay.contains('now'|date('N')) and entry.showTime &amp;gt; 'now'|date('H:i') %}&#xA;&#xA;&#xA;  &amp;lt;div class=&quot;flex-box mobile&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;link-block w-inline-block&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;up-coming-image&quot; style=&quot;background-image:url({{ entry.showImage[0].url }}); background-size:cover;&quot; &amp;gt;&#xA;        &amp;lt;div class=&quot;up-coming-fade&quot; data-ix=&quot;fademouse&quot;&amp;gt;&#xA;          &amp;lt;div&amp;gt;{{ entry.showTime }} - {{ entry.showLength }}&amp;lt;/div&amp;gt;&#xA;          &amp;lt;h4 class=&quot;up-coming-heading&quot;&amp;gt;{{ entry.Title }}&amp;lt;/h4&amp;gt;&#xA;          &amp;lt;div&amp;gt;With {{ entry.hostname.first().title }} &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;image-btn&quot;&amp;gt;&amp;amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also I want to display what the current show on air is, originally I was going to use a similar code to the above, limit it to 1 and have it minus an hour but I can't seem to work out how to do that. For the short term I can flip the greater than to less than, however this then displays only the closest show and I can't else out into a default display if nothing is currently timetabled as on air. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this all makes sense and would appreciate any help you might be able to provide! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tom&lt;/p&gt;&#xA;" OwnerUserId="7490" LastEditorUserId="3951" LastEditDate="2017-11-16T08:35:32.110" LastActivityDate="2017-11-16T08:35:32.110" Title="Get next 3 upcoming entries" Tags="&lt;limit&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22703" PostTypeId="2" ParentId="22702" CreationDate="2017-11-06T14:18:03.703" Score="4" Body="&lt;p&gt;What you do, is this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get 30 items from the database, ordered by showTime&lt;/li&gt;&#xA;&lt;li&gt;Then, you filter them with the if-attribute in the for-statement&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This means, that you could get anywhere from 0 to 30 results. What you want to do, is make sure the filtering happens within the element query. I did not test this (not sure about the time criteria part), but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries&#xA;    .section('shows')&#xA;    .order('showTime')&#xA;    .search('showDay:*' ~ now |date('N') ~ '*')&#xA;    .showTime('&amp;gt;= ' ~ now |date('H:i'))&#xA;    .limit(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2017-11-06T17:58:23.640" LastActivityDate="2017-11-06T17:58:23.640" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22704" PostTypeId="2" ParentId="22701" CreationDate="2017-11-06T14:28:53.583" Score="3" Body="&lt;p&gt;For Craft 2, a number of plugins exist that assist with building navigational structures. None of those has been made available for Craft 3 (yet), but one plugin-less option (thanks to Ben Parizek, who let me in on this) would be, to create a 'navigation' section (structure), in which you can create navigation entries (= navigation items) that you can than drag and drop to get the right navigational structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each entry in this section has, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A field that connects it to another entry&lt;/li&gt;&#xA;&lt;li&gt;A field that let's the user add a url to navigate to&lt;/li&gt;&#xA;&lt;li&gt;Any other field that would let the user alter the navigation's behaviour (color, open in new window, etc)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After that, it would be up to you to translate this structure to a navigation in your template(s).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2017-11-06T14:28:53.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22705" PostTypeId="5" CreationDate="2017-11-06T15:13:05.850" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2017-11-06T15:13:05.850" LastActivityDate="2017-11-06T15:13:05.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22706" PostTypeId="4" CreationDate="2017-11-06T15:13:05.850" Score="0" Body="This is a special tag that is designed to be used only by the system for questions that have had all of their other tags removed. Do not add this tag to existing questions, it is reserved for use by the system to identify posts with no valid tags." OwnerUserId="6007" LastEditorUserId="6007" LastEditDate="2017-11-08T20:12:52.410" LastActivityDate="2017-11-08T20:12:52.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22707" PostTypeId="1" CreationDate="2017-11-06T15:46:19.070" Score="0" ViewCount="380" Body="&lt;p&gt;I have a site and been tested locally and on staging server and it checks out fine.&#xA;I have moved it to the clients live server (Windows 2016) but when I hit the pay button via dummy gateway or Worldpay Gateway I get the error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to get property of non-object:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IS8rb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IS8rb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this only occuring on the Live Environment - PHP version is the same locally as the server - 7.1.7&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2017-11-06T15:46:19.070" Title="Commerce - Live Environment - &quot;Trying to get property of non-object&quot;" Tags="&lt;plugin-craftcommerce&gt;&lt;error-message&gt;&lt;error&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="22708" PostTypeId="2" ParentId="22698" CreationDate="2017-11-06T15:53:53.080" Score="5" Body="&lt;p&gt;I implemented this recently and what I ended up doing is return the content security headers using PHP. Depending on the request path (is it a CP URL or not?), we send CSP headers with unsafe-inline and unsafe-eval or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the CP is still unsecured, but what you can do is to specify a custom domain for the CP in your configuration (using the &quot;&lt;a href=&quot;https://craftcms.com/docs/config-settings#baseCpUrl&quot; rel=&quot;noreferrer&quot;&gt;baseCpUrl&lt;/a&gt;&quot; key). Something like &quot;admin.yourwebsite.com&quot; that only certain users can access (using IP filtering for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is still not a perfect solution, but we cannot do anything at the CP level unfortunately. I hope this will not be an issue anymore in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2017-11-06T15:53:53.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22710" PostTypeId="2" ParentId="22613" CreationDate="2017-11-06T20:43:59.930" Score="1" Body="&lt;p&gt;Realized my issue, I was sending back the option labels instead of the option values for the dropdown fields in the form.&lt;/p&gt;&#xA;" OwnerUserId="7276" LastActivityDate="2017-11-06T20:43:59.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22711" PostTypeId="1" AcceptedAnswerId="22712" CreationDate="2017-11-07T05:31:06.847" Score="3" ViewCount="558" Body="&lt;p&gt;The title is self-explanatory, but I need to buid a service function to remove unused assets, or at least to fetch those in order to delete found assets after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any simple solution?&lt;/p&gt;&#xA;" OwnerUserId="3499" LastActivityDate="2017-11-07T18:09:44.657" Title="Fetch/Remove all unused assets (by plugin)" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;delete&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22712" PostTypeId="2" ParentId="22711" CreationDate="2017-11-07T05:47:07.877" Score="4" Body="&lt;p&gt;This should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//First fetch all ids from elements table&#xA;$allIds = craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;select('id')-&amp;gt;from('elements')-&amp;gt;where([&#xA;    'not like', 'type', 'Asset'&#xA;])-&amp;gt;queryColumn();&#xA;&#xA;// query for all related Assets -&amp;gt; assets that are used somewhere&#xA;$usedAssetCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$usedAssetCriteria-&amp;gt;relatedTo = $allIds;&#xA;$usedAssetCriteria-&amp;gt;limit = null;&#xA;$usedAssets = $usedAssetCriteria-&amp;gt;ids();&#xA;&#xA;// query for all assets not in the list of the used one&#xA;$unUsedCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Asset);&#xA;$unUsedCriteria-&amp;gt;id = 'and, not ' . implode(', not ', $usedAssets);&#xA;craft()-&amp;gt;assets-&amp;gt;deleteFiles($unUsedCriteria-&amp;gt;ids());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-07T18:09:44.657" LastActivityDate="2017-11-07T18:09:44.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22713" PostTypeId="1" CreationDate="2017-11-07T05:56:20.720" Score="1" ViewCount="112" Body="&lt;p&gt;I want to create product groups and save some data in themselves. but I only could add field to individual product, not product type itself.&#xA;Or it is nice if product could have hierarchal structures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve?&lt;/p&gt;&#xA;" OwnerUserId="7492" LastActivityDate="2017-11-07T05:56:20.720" Title="Add fields to Product Type itself" Tags="&lt;plugin-craftcommerce&gt;&lt;products&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22714" PostTypeId="1" CreationDate="2017-11-07T09:51:23.913" Score="1" ViewCount="163" Body="&lt;p&gt;Sprout Forms 2.5.1&#xA;Sprout Email 3.0.3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting the error &quot;Internal Server Error - Illegal string offset 'template'&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have updated the template file to use &lt;code&gt;email&lt;/code&gt; variable instead of &lt;code&gt;entry&lt;/code&gt; for the html and text content respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack trace: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;******************************************************************************************************&#xA;    2017/11/06 20:38:21 [error] [php] Illegal string offset 'template' (/home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php:212)&#xA;    Stack trace:&#xA;    #0 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(69): Craft\SproutEmailService-&amp;gt;error()&#xA;    #1 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(468): Craft\SproutEmailService-&amp;gt;renderObjectTemplateSafely()&#xA;    #2 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/integrations/sproutemail/mailers/SproutEmail_DefaultMailer.php(99): Craft\SproutEmailService-&amp;gt;renderEmailTemplates()&#xA;    #3 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(487): Craft\SproutEmail_DefaultMailer-&amp;gt;sendNotificationEmail()&#xA;    #4 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(383): Craft\SproutEmail_NotificationEmailsService-&amp;gt;relayNotificationThroughAssignedMailer()&#xA;    #5 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(359): Craft\SproutEmail_NotificationEmailsService-&amp;gt;handleDynamicEvent()&#xA;    #6 unknown(0): Craft\SproutEmail_NotificationEmailsService-&amp;gt;Craft\{closure}()&#xA;    #7 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(298): call_user_func_array()&#xA;    #8 /home/forge/www.sitename.co.uk/craft/app/framework/base/CComponent.php(567): Craft\SproutEmail_NotificationEmailsService-&amp;gt;Craft\{closure}()&#xA;    #9 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutFormsService.php(79): Craft\SproutFormsService-&amp;gt;raiseEvent()&#xA;    #10 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(246): Craft\SproutFormsService-&amp;gt;onSaveEntry()&#xA;    #11 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(195): Craft\SproutForms_EntriesService-&amp;gt;callOnSaveEntryEvent()&#xA;    #12 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/controllers/SproutForms_EntriesController.php(162): Craft\SproutForms_EntriesService-&amp;gt;saveEntry()&#xA;    #13 /home/forge/www.sitename.co.uk/craft/app/framework/web/actions/CInlineAction.php(49): Craft\SproutForms_EntriesController-&amp;gt;actionSaveEntry()&#xA;    #14 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams()&#xA;    #15 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(286): Craft\SproutForms_EntriesController-&amp;gt;runAction()&#xA;    #16 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(265): Craft\SproutForms_EntriesController-&amp;gt;runActionWithFilters()&#xA;    #17 /home/forge/www.sitename.co.uk/craft/app/framework/web/CWebApplication.php(282): Craft\SproutForms_EntriesController-&amp;gt;run()&#xA;    #18 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(823): Craft\WebApp-&amp;gt;runController()&#xA;    #19 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;    #20 /home/forge/www.sitename.co.uk/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;    #21 /home/forge/www.sitename.co.uk/craft/app/index.php(62): Craft\WebApp-&amp;gt;run()&#xA;    #22 /home/forge/www.sitename.co.uk/public/index.php(19): require_once()&#xA;    REQUEST_URI=/contact-us&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2017-11-07T17:52:33.570" LastActivityDate="2017-11-07T17:52:33.570" Title="Sprout Forms + Email - internal server error" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22715" PostTypeId="2" ParentId="22714" CreationDate="2017-11-07T12:28:21.260" Score="1" Body="&lt;p&gt;Although the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/examples/template-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Email docs&lt;/a&gt; state it is preferable to use shorthand syntax for variables in notifications, I found this to not be the case for the Notification subject line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So using &lt;code&gt;{companyName}&lt;/code&gt; in the subject would cause the issue shown above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{object.companyName}}&lt;/code&gt; fixes this.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="57" LastEditDate="2017-11-07T17:52:05.697" LastActivityDate="2017-11-07T17:52:05.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22717" PostTypeId="1" CreationDate="2017-11-07T15:28:28.347" Score="1" ViewCount="134" Body="&lt;p&gt;I have successfully implemented a front-end form that allows the user to add new &quot;blocks&quot; to a certain matrix field. This matrix field has one text field, two date fields, and one entry field that links to one specific entry type: &lt;code&gt;sites&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I add an option to the dropdown list that would allow the user to &quot;ignore&quot; this field as if they left it alone when adding data in the admin area?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;fields[scriptLots][new1][fields][lotSite][]&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;No Site&amp;lt;/option&amp;gt;&#xA;    {% for site in sites.order('title') %}&#xA;        &amp;lt;option value=&quot;{{site.id}}&quot;&amp;gt;{{site.title}}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figured just adding an option tag ahead of the &lt;code&gt;for&lt;/code&gt; loop with no value would do the trick. However this just responds in a major error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`dsi_craft_vetscripts`.`craft_relations`, CONSTRAINT `craft_relations_targetId_fk` FOREIGN KEY (`targetId`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_relations` (`fieldId`, `sourceId`, `sourceLocale`, `targetId`, `sortOrder`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, NULL, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7). Bound with :row0_col0='54', :row0_col1='3382', :row0_col3='', :row0_col4=1, :row0_col5='2017-11-07 15:26:00', :row0_col6='2017-11-07 15:26:00', :row0_col7='06895bfe-d902-49f6-a085-bd080f68cdef'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that empty value attribute seems to be breaking something. How can I add a null option?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2017-11-07T15:28:28.347" Title="Front end entry dropdown with null option" Tags="&lt;matrix&gt;&lt;entries-field&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22718" PostTypeId="1" AcceptedAnswerId="22803" CreationDate="2017-11-07T16:18:48.673" Score="2" ViewCount="249" Body="&lt;p&gt;Running Craft Version 2.6.2994 on an EC2 instance that has PHP 7.0.21, and MySQL v 5.6.37 installed. When I try to create a new Matrix, I get the following error when saving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I test this on my localhost, which has PHP 7.1.5 and MySQL 5.6.35 running Valet, everything seems to work fine so I'm not sure if this is an issue with the version of PHP/MySQL, or in the code. I've also tried it with the root MySQL user having full permissions and it still gives the same error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: &#xA;Syntax error or access violation: 1064 You have an error in your SQL syntax; &#xA;check the manual that corresponds to your MySQL server version for the right &#xA;syntax to use near 'COLLATE=' at line 9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The entire project shows &lt;code&gt;'COLLATE='&lt;/code&gt; appears in ~2 locations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MysqlSchema.php, LN 198:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$options = 'ENGINE='.$engine.' DEFAULT CHARSET='.craft()-&amp;gt;config-&amp;gt;get('charset', ConfigFile::Db).' COLLATE='.craft()-&amp;gt;config-&amp;gt;get('collation', ConfigFile::Db).($options ? ' '.$options : '');`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And DbHelper.php, LN 219:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$def .= ' COLLATE '.$config['collation'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Current Plugins Installed:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/verbb/expanded-singles/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expanded Singles 0.2.5&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;JSON Decode Twig Filter 1.0.9&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-neo/wiki&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo 1.4.1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/mmikkel/Reasons-Craft/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reasons 1.0.10&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/benjamminf/craft-relabel/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relabel 0.1.3&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;SEO 1.4.7&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pennebaker/craftcms-thearchitect/wiki&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sidebar enhancer 1.0.9&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pennebaker/craftcms-thearchitect/wiki&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Architect 1.6.0&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Edit: Full stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/11/07 16:28:18 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE=' at line 9. The SQL statement executed was: CREATE TABLE `craft_matrixcontent_test` (&#xA;        `id` int(11) NOT NULL AUTO_INCREMENT,&#xA;        `elementId` INT(11) NOT NULL,&#xA;        `locale` CHAR(12) NOT NULL,&#xA;        `dateCreated` datetime NOT NULL,&#xA;        `dateUpdated` datetime NOT NULL,&#xA;        `uid` CHAR(36) NOT NULL DEFAULT 0,&#xA;        PRIMARY KEY (id)&#xA;) ENGINE=InnoDb DEFAULT CHARSET= COLLATE=.&#xA;2017/11/07 16:28:18 [error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE=' at line 9 in /var/www/craft/app/framework/db/CDbCommand.php:358&#xA;Stack trace:&#xA;#0 /var/www/craft/app/framework/db/CDbCommand.php(1352): CDbCommand-&amp;gt;execute()&#xA;#1 /var/www/craft/app/etc/db/DbCommand.php(507): CDbCommand-&amp;gt;createTable('craft_matrixcon...', Array, NULL)&#xA;#2 /var/www/craft/app/services/MatrixService.php(1071): Craft\DbCommand-&amp;gt;createTable('craft_matrixcon...', Array)&#xA;#3 /var/www/craft/app/services/MatrixService.php(535): Craft\MatrixService-&amp;gt;_createContentTable('matrixcontent_t...')&#xA;#4 /var/www/craft/app/fieldtypes/MatrixFieldType.php(152): Craft\MatrixService-&amp;gt;saveSettings(Object(Craft\MatrixSettingsModel), false)&#xA;#5 /var/www/craft/app/services/FieldsService.php(646): Craft\MatrixFieldType-&amp;gt;onAfterSave()&#xA;#6 /var/www/craft/app/controllers/FieldsController.php(122): Craft\FieldsService-&amp;gt;saveField(Object(Craft\FieldModel))&#xA;#7 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\FieldsController-&amp;gt;actionSaveField()&#xA;#8 /var/www/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#9 /var/www/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#10 /var/www/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#11 /var/www/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('saveField')&#xA;#12 /var/www/craft/app/etc/web/WebApp.php(823): CWebApplication-&amp;gt;runController('fields/saveFiel...')&#xA;#13 /var/www/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#14 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#15 /var/www/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#16 /var/www/public/index.php(31): require_once('/var/www/craft/...')&#xA;#17 {main}&#xA;REQUEST_URI=/admin/settings/fields/new?groupId=3&#xA;HTTP_REFERER=http://ipaddress/admin/settings/fields/new?groupId=3&#xA;---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6661" LastEditorUserId="57" LastEditDate="2017-11-08T03:48:53.440" LastActivityDate="2017-11-13T18:19:00.787" Title="MySQL Error 1064 when trying to create a Matrix" Tags="&lt;matrix&gt;&lt;error-message&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22719" PostTypeId="1" CreationDate="2017-11-07T17:03:02.403" Score="1" ViewCount="88" Body="&lt;p&gt;Got issues with Freeform Pro Plugin, no matter what settings I set on status in the plugin the subscriber goes right into the list on Mailchimp even though status is set to 'pending' on plugin both at default and form setting level.No double opt-in verification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas guys?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus unrelated, the user when sends also gets a notification of what they have sent, we don't want this. And if we ever did, we would want a custom template for it. any help would be great. &lt;/p&gt;&#xA;" OwnerUserId="7467" LastActivityDate="2018-06-25T15:36:03.657" Title="Freeform Pro Plugin Mailchimp integration" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22720" PostTypeId="1" AcceptedAnswerId="22722" CreationDate="2017-11-07T17:24:30.190" Score="1" ViewCount="65" Body="&lt;p&gt;For some reason when we're bootstrapping Craft CMS it's VERY slow to bootstrap (500ms) worth of slowness. This is utilizing HTTP2 and PHP7 so we're expecting it to be much faster than this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming this is just some setting we're missing and/or our Craft installation is doing too much for one app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the _layout.html to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;title&amp;gt;TESTING&amp;lt;/title&amp;gt;&#xA;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot; /&amp;gt;&#xA;    &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=Edge&quot; /&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, user-scalable=no&quot; /&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&#xA;&amp;lt;body id=&quot;body&quot;&amp;gt;&#xA;    &amp;lt;!-- View container--&amp;gt;&#xA;    &amp;lt;div class=&quot;view-container&quot; id=&quot;main-view-container&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;TESTING IN THE BODY&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not much going on there. However, this is still taking 500-600ms to bootstrap. This is my general.php file --&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;require __Dir__ . '/../../vendor/autoload.php';&#xA;require_once __Dir__ . '/../plugins/global/config/Environment.php';&#xA;&#xA;//error reporting&#xA;if (Craft\Environment::isProduction()) {&#xA;    //log all errors except for notices, strict php guidelines, etc&#xA;    error_reporting(E_ALL &amp;amp; ~E_STRICT &amp;amp; ~E_NOTICE &amp;amp; ~E_DEPRECATED); &#xA;    ini_set('display_errors', 0);&#xA;} else if (Craft\SayEnvironment::isDemo()) {&#xA;    error_reporting(E_ALL &amp;amp; ~E_STRICT &amp;amp; ~E_WARNING);&#xA;    ini_set('display_errors', 0); //don't display errors to console in demo&#xA;}&#xA;&#xA;return array(&#xA;&#xA;//////////////////////////&#xA;///  Default Settings  ///&#xA;//////////////////////////&#xA;'*' =&amp;gt; array(&#xA;    'useCompressedJs' =&amp;gt; false,&#xA;    'appId' =&amp;gt; 'myappid',&#xA;    'validationKey' =&amp;gt; 'asdfasfdasdfasdfasfasd',&#xA;    'timezone' =&amp;gt; 'America/Chicago',&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;    'generateTransformsBeforePageLoad' =&amp;gt; true,&#xA;    'maxUploadFileSize' =&amp;gt; 33554432,&#xA;    'phpMaxMemoryLimit' =&amp;gt; '512M',&#xA;    'slugWordSeparator' =&amp;gt; '-',&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;    'devMode' =&amp;gt; false&#xA;),&#xA;&#xA;////////////////////////&#xA;//  Local Overrides  ///&#xA;////////////////////////&#xA;'localhost' =&amp;gt; array(&#xA;    'cacheMethod' =&amp;gt; 'file',&#xA;    'overridePhpSessionLocation' =&amp;gt; false,&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'siteUrl' =&amp;gt; 'https://localhost/'&#xA;    )&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Realistically all I'm asking Craft to do right now is bootstrap itself and load this _layout.html file. Any ideas why this implementation might be slow? We have 15-20 large plugins but we're not really doing anything with them in this instance?&lt;/p&gt;&#xA;" OwnerUserId="4256" LastEditorUserId="57" LastEditDate="2017-11-08T03:53:59.180" LastActivityDate="2017-11-08T03:53:59.180" Title="Craft 2.6 slow bootstrapping?" Tags="&lt;bootstrap-craft&gt;&lt;speed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22722" PostTypeId="2" ParentId="22720" CreationDate="2017-11-07T18:04:38.243" Score="2" Body="&lt;p&gt;It shouldn't be that slow to bootstrap, but even if you're not doing anything with the plugins in your template, they are still loaded and instantiated with every request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you, I'd do some profiling with Blackfire or NewRelic to see what's really going on.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-07T18:04:38.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22723" PostTypeId="2" ParentId="1423" CreationDate="2017-11-07T21:44:36.167" Score="3" Body="&lt;p&gt;If you need to do something like the image below. The best option is to set the content as a variable and use the &lt;code&gt;replace()&lt;/code&gt; filter to replace the tokens tags. Finally, use &lt;code&gt;autoescape&lt;/code&gt; pair tag to output the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not an elegant solution, but it works for me ;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# #############&#xA;        Field names&#xA;        -----&#xA;        Body: f_body&#xA;        Assets:&#xA;            f_media&#xA;                position&#xA;                media (assets)&#xA;############# #}&#xA;&#xA;&#xA;{% block content %}&#xA;&#xA;    {% set body = entry.f_body|raw %}&#xA;&#xA;    {% for item in entry.f_media %}&#xA;        {% if item.type == 'assets' %}&#xA;            {% set name = '{image_' ~ loop.index ~ '}' %} # name of token to replace&#xA;            {% set image = item.media[0].getUrl() %} # image path&#xA;            {% set imageElement = '&amp;lt;img src=&quot;' ~ image ~ '&quot; class=&quot;' ~ item.position ~ '&quot; /&amp;gt;'  %} # image element&#xA;&#xA;            {% set body = body|replace(name, imageElement) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;&#xA;    {% autoescape false %}&#xA;        {{ body }}&#xA;    {% endautoescape %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ps: This is something I came up quickly, needs bit of refactoring obvs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EwbMt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EwbMt.png&quot; alt=&quot;Image replacement technique&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7496" LastEditorUserId="7496" LastEditDate="2017-11-10T16:57:12.977" LastActivityDate="2017-11-10T16:57:12.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22724" PostTypeId="2" ParentId="12694" CreationDate="2017-11-08T04:43:48.297" Score="1" Body="&lt;p&gt;For those that come looking for the answer about logging in by service without the rest of the context of the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See UserSession service docs:&#xA;&lt;a href=&quot;https://craftcms.com/classreference/services/UserSessionService#login-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/UserSessionService#login-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Login with user/password:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;login($username, $password, $rememberMe = false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or when you have already authenticated and simply wish to login:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;loginByUserId($userId, $rememberMe = false, $setUsernameCookie = false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7336" LastActivityDate="2017-11-08T04:43:48.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22725" PostTypeId="1" CreationDate="2017-11-08T04:43:54.853" Score="1" ViewCount="201" Body="&lt;p&gt;I have a multi-country website that I am building with Craft Pro Commerce. I have set up locales for 5 countries. So, for the New Shipping Address section, I would like to have the country options limited to match the current locale country, except if the locale is &quot;en&quot;, which would be a catch-all to include a list of the rest of the country shipping options... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of the box, the logic for the country select field is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;select class=&quot;address-country u-full-width&quot; name=&quot;{{ modelName }}[countryId]&quot;&amp;gt;&#xA;    {% for key, option in countries %}&#xA;        {% set optionValue = (model ? model.countryId : '') %}&#xA;            &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;select name=&quot;country-select&quot;  id=&quot;country-select&quot; class=&quot;form-control&quot; onchange=&quot;location = this.value;&quot; autocomplete=&quot;off&quot;&amp;gt;&amp;gt;&#xA;    {% set locales = craft.i18n.getSiteLocaleIds() %}&#xA;    {% set locale = craft.locale %}&#xA;        {% for loc in locales %}&#xA;            {# checking if current loop has active locale #}&#xA;            {% set isHome = (loc == locale) %}&#xA;            {% if isHome %}&#xA;&#xA;                {% if loc == &quot;en&quot; %}&#xA;                    &amp;lt;option value=&quot;/&quot; selected&amp;gt;Europe&amp;lt;/option&amp;gt;   &#xA;&#xA;                {% else %}&#xA;                    {% set subTags = locale|split('_') %}&#xA;                    {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;                        &amp;lt;option value=&quot;{{ loc | replace({'en': ''}) | trim('_') }}&quot; selected&amp;gt;{% if territory %}{{ territory }}{% endif %}&amp;lt;/option&amp;gt;   &#xA;                {% endif %}&#xA;&#xA;        {% else %}&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried of bunch of ideas from Stackoverflow, but couldn't get anything to work as needed... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14290/have-the-country-in-craft-commerce-countrieslist-default/16549&quot;&gt;Have the country in craft.commerce.countriesList default&lt;/a&gt; (too static, I need something dynamic)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19284/locale-specific-country-select-menu&quot;&gt;Locale-specific country select menu&lt;/a&gt; (not really what I need... I need to set the country for the Shipping address. I can create a list of the countries whose locales I've selected in the CMS:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;li class=&quot;country-button&quot;&amp;gt;&#xA;&#xA;    &amp;lt;form action=&quot;&quot; name=&quot;dropdown&quot;&amp;gt;&#xA;        &amp;lt;select name=&quot;country-select&quot;  id=&quot;country-select&quot; class=&quot;form-control&quot; onchange=&quot;location = this.value;&quot; autocomplete=&quot;off&quot;&amp;gt;&amp;gt;&#xA;            {% set locales = craft.i18n.getSiteLocaleIds() %}&#xA;            {% set locale = craft.locale %}&#xA;            {% for loc in locales %}&#xA;                {# checking if current loop has active locale #}&#xA;                {% set isHome = (loc == locale) %}&#xA;                {% if isHome %}&#xA;&#xA;                    {% if loc == &quot;en&quot; %}&#xA;                        &amp;lt;option value=&quot;{{ craft.config.originalUrl }}&quot; selected&amp;gt;Europe&amp;lt;/option&amp;gt;   &#xA;&#xA;                    {% else %}&#xA;                        {% set subTags = locale|split('_') %}&#xA;                        {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;                            &amp;lt;option value=&quot;{{ loc | replace({'en': ''}) | trim('_') }}&quot; selected&amp;gt;{% if territory %}{{ territory }}{% endif %}&amp;lt;/option&amp;gt;   &#xA;                    {% endif %}&#xA;&#xA;                {% else %}&#xA;&#xA;                    {% if loc == &quot;en&quot; %}&#xA;                        &amp;lt;option value=&quot;{{ craft.config.originalUrl }}&quot;&amp;gt;EU&amp;lt;/option&amp;gt;   &#xA;                    {% else %}&#xA;                        &amp;lt;option value=&quot;{{ loc | replace({'en': ''}) | trim('_') }}&quot;&amp;gt;{{ loc | replace({'en': ''}) | trim('_') | upper }} &amp;lt;/option&amp;gt;   &#xA;                    {% endif %}&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I can get the users country using JS&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;function getCountry() {&#xA;    $.getJSON(&quot;http://freegeoip.net/json/&quot;, function (data) {&#xA;        var country = data.country_name;&#xA;        var country_code = data.country_code.toLowerCase();&#xA;        var country_code_url = country_code.toLowerCase();&#xA;        var ip = data.ip;&#xA;        var baseHrefSplash = baseHref + &quot;/splash/&quot;;&#xA;&#xA;        var s = baseHref&#xA;        search = '//'&#xA;        var n = 2&#xA;&#xA;        var newBaseHref = baseHrefSplash.replace(RegExp(&quot;^(?:.*?//){&quot; + n + &quot;}&quot;), function(x){return x.replace(RegExp(search + &quot;$&quot;), &quot;/&quot;)})&#xA;&#xA;        console.log(&quot;country: &quot; + country);&#xA;        console.log(&quot;country code: &quot; + country_code);&#xA;&#xA;        // document.getElementById(&quot;test-country&quot;).innerHTML = country;&#xA;        // document.getElementById(&quot;test-country2&quot;).innerHTML = country_code_url;&#xA;&#xA;        // if (country_code_url != urlEndingTrim ) {&#xA;        //     console.log(&quot;what url should i go to? &quot; + newBaseHref)&#xA;        //     window.location = newBaseHref;&#xA;        // } else {&#xA;        //     console.log( urlEndingTrim + &quot; is equal to &quot; + country_code_url)&#xA;        // }&#xA;&#xA;        $.cookie('the_cookie', country +  &quot;, &quot; + country_code_url);&#xA;        console.log($.cookie('the_cookie'));&#xA;&#xA;&#xA;        $(&quot;#address-country&quot;).val('country');&#xA;&#xA;    }); &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm really stuck... I've set shipping zones in the CMS, ideally, it would be amazing to be able to use those when setting the shipping address country, but I'll settle for another option that is still dynamic, using the current country locale. Thank you so much!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/strong&gt; What I have figured out so far is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've essentially left the html alone, it's the original html from Craft Commerce plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;select id=&quot;address-country&quot; class=&quot;address-country u-full-width&quot; name=&quot;{{ modelName }}[countryId]&quot; autocomplete=&quot;off&quot; placeholder=&quot;Country&quot;&amp;gt;&#xA;    {% for key, option in countries %}&#xA;        {% set optionValue = (model ? model.countryId : '') %}&#xA;&#xA;        &amp;lt;option value=&quot;{{ key }}&quot; {% if key == optionValue %} selected{% endif %}&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the js file, I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;function setShippingCountry() {&#xA;    $.getJSON(&quot;http://freegeoip.net/json/&quot;, function (data) {&#xA;        var country = data.country_name;&#xA;        var country_code = data.country_code.toLowerCase();&#xA;        var country_code_url = country_code.toLowerCase();&#xA;        var ip = data.ip;&#xA;&#xA;        if (country == 'Australia') {&#xA;            var temp=&quot;13&quot;; &#xA;            $(&quot;#address-country&quot;).val(temp);&#xA;            $('#address-country option[value!=&quot;13&quot;]').remove();&#xA;&#xA;        } else if (country == 'New Zealand') {&#xA;            var temp=&quot;171&quot;; &#xA;            $(&quot;#address-country&quot;).val(temp);&#xA;            $('#address-country option[value!=&quot;171&quot;]').remove();&#xA;&#xA;        } else if (country == 'United States') {&#xA;            var temp=&quot;233&quot;; &#xA;            $(&quot;#address-country&quot;).val(temp);&#xA;            $('#address-country option[value!=&quot;233&quot;]').remove();&#xA;&#xA;&#xA;        } else if (country == 'Canada') {&#xA;            var temp=&quot;38&quot;; &#xA;            $(&quot;#address-country&quot;).val(temp);&#xA;            $('#address-country option[value!=&quot;38&quot;]').remove();            &#xA;&#xA;        } else {&#xA;            $('#address-country option[value=&quot;13&quot;], #address-country option[value=&quot;171&quot;], #address-country option[value=&quot;233&quot;], #address-country option[value=&quot;38&quot;]').remove();                        &#xA;&#xA;        }&#xA;    });&#xA;}&#xA;setShippingCountry();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function is getting the user's location/country, setting that country name as the selected value, then, for certain countries, it's hiding all unselected options, and for the rest of the countries, it shows all of the countries except for AU, NZ, US, and CA. The only thing left now is to get the &quot;States&quot; select option to populate on page load for AU, US, and CA so that the user won't have to click the country select option since it's already been selected on page load...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of resources that helped me work out this solution so far:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/19611557/how-to-set-default-value-for-html-select&quot;&gt;https://stackoverflow.com/questions/19611557/how-to-set-default-value-for-html-select&lt;/a&gt; &#xA;and &#xA;&lt;a href=&quot;http://jsfiddle.net/9dgV5/2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jsfiddle.net/9dgV5/2/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5644" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:38.070" LastActivityDate="2017-11-09T19:38:38.070" Title="Set Shipping Address country dynamically depending on locale for multi-country website" Tags="&lt;plugin-craftcommerce&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22727" PostTypeId="1" CreationDate="2017-11-08T10:31:12.973" Score="0" ViewCount="138" Body="&lt;p&gt;I want to use the built-in Craft field macros to show a date field in a plugin template for filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can retrieve the submitted value on any submission (via GET) but how do I then prepopulate said date field with the previously submitted value? &#xA;When I try to simply pass the submission into the value property I get an &lt;code&gt;Array to string conversion&lt;/code&gt; error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin template code …&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = craft.request.getParam('start') %}    &#xA;{{ dump(start) }}&#xA;{{ forms.dateField({&#xA;    label: 'Start date',&#xA;    id: 'start',&#xA;    name: 'start',&#xA;    value: start }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my question is; is there anyway I can pass a value into the dateField that has been submitted via a POST or GET variable?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="992" LastEditDate="2017-11-13T16:23:49.277" LastActivityDate="2017-11-13T16:23:49.277" Title="Updating `{{ forms.dateField }}` value from GET variable" Tags="&lt;plugin-development&gt;&lt;localization&gt;&lt;datetime&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22728" PostTypeId="1" CreationDate="2017-11-08T10:45:48.190" Score="2" ViewCount="61" Body="&lt;p&gt;So I am trying to reuse some include files built for a matrix builder that are also in some instances used as stand alone fields (Video, Downloads etc). The way I have coded this is that the object/handle changes from using &lt;code&gt;block.handlename&lt;/code&gt; to &lt;code&gt;entry.handlename&lt;/code&gt; what would be the most efficient way to code this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently this is what I have done, but not sure it feels ‘right’?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So taking the video as an example. I have an include file &lt;code&gt;_includes/matrix/video.html&lt;/code&gt;&#xA;I am then calling this from a Matrix Block like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.mainContent.level(1) %}&#xA;{% switch block.type %}&#xA;{% case block.type %}&#xA;{% include '_includes/matrix/' ~ block.type %}&#xA;{% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And also an entry template like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.video|length %}&#xA;&amp;lt;div id=&quot;video&quot; class=&quot;tab&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;tab__content&quot;&amp;gt;&#xA;        {% include '_includes/matrix/video' with { object : entry } %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my video include file &lt;code&gt;_includes/matrix/video.html&lt;/code&gt; I now have this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set object = object ?? block %}&#xA;{% set url = object.video %}&#xA;&#xA;&amp;lt;div class=&quot;videoWrapper&quot;&amp;gt;&#xA;    {{ url|videoEmbed({ byline: 0, autoplay: 0, rel:0 }) }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this means i need to this each time I am calling an entry? &lt;code&gt;{% include '_includes/matrix/video&lt;/code&gt; with &lt;code&gt;{ object : entry } %}&lt;/code&gt; Is this the best approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions/recommendations?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-11-08T10:58:16.540" Title="Re-using includes when the object type changes (entry vs block) - what is the best method?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;entry&gt;&lt;include&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22729" PostTypeId="1" CreationDate="2017-11-08T10:49:49.690" Score="2" ViewCount="354" Body="&lt;p&gt;Because I used a similar address model to the one supplied in the Craft Commerce templates, which essentially uses the same form partials for both address and billing, and also hides and shows the form using JavaScript, I can't use HTML required attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to add in the config files a way to make 'shipping.phone' required and return an error in the same way the default required fields work?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;inputGroup{% if model and model.hasErrors('phone') %} error{% endif%}&quot;&amp;gt;&#xA;    &amp;lt;h3 class=&quot;small&quot;&amp;gt;Contact details&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;div class=&quot;inputWrap&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; id=&quot;{{ modelName }}-phone&quot; class=&quot;u-full-width&quot; name=&quot;{{ modelName }}[phone]&quot; value=&quot;{{ model ? model.phone : '' }}&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;highlight&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;span class=&quot;bar&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;        &amp;lt;label for=&quot;{{ modelName }}-phone&quot;&amp;gt;Telephone number&amp;lt;/label&amp;gt;&#xA;        &amp;lt;span class=&quot;flash&quot;&amp;gt;{% if model and model.hasErrors('phone') %}{{ model.getError('phone') }}{% else %}Required{% endif %}&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;p class=&quot;footnote&quot;&amp;gt;In case we need to contact you about important details regarding your order.&amp;lt;/p&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:31.677" LastActivityDate="2018-07-19T21:42:51.637" Title="Craft Commerce: make address phone telephone field required without JavaScript" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;&lt;validation&gt;&lt;ecommerce&gt;&lt;required&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22730" PostTypeId="2" ParentId="22728" CreationDate="2017-11-08T10:54:08.650" Score="1" Body="&lt;p&gt;Perhaps a better method is to include; &lt;code&gt;{% set object = block ?? entry %}&lt;/code&gt; at the top of the &lt;code&gt;_includes/matrix/video.htm&lt;/code&gt; template and this negates the need to use with &lt;code&gt;{ object : entry }&lt;/code&gt; in the includes&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-11-08T10:54:08.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22731" PostTypeId="2" ParentId="22728" CreationDate="2017-11-08T10:58:16.540" Score="2" Body="&lt;p&gt;From what I can see here, the only important object you care about in the include file is the video object. So what you could do is simply passing the video field in parameter directly, using, for the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/matrix/video' with { video : entry.video } only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and for the matrix block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/matrix/video' with { video : block.video } only %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But&lt;/strong&gt; then you would need to explicitly call each matrix block type with associated parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would in any case add the &lt;code&gt;&quot;only&quot;&lt;/code&gt; keyword after the parameters, as it guarantees that your template will be isolated from other variables already defined in the main template.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2017-11-08T10:58:16.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22732" PostTypeId="1" AcceptedAnswerId="22737" CreationDate="2017-11-08T16:27:41.903" Score="1" ViewCount="101" Body="&lt;p&gt;I have a frontend form and would like to save multiple related entries by checking 1 checkbox.&#xA;I have this working to save 1 related entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;user-type-select-{{ userType|kebab }}&quot; name=&quot;fields[hasUserTypes][]&quot; value=&quot;{{ userType.id }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I pass multiple &lt;code&gt;userType.id&lt;/code&gt; values in there? I tried various syntaxes such as comma seperated, enclosed in brackets like an array or a comma seperated string with the &lt;code&gt;|hash&lt;/code&gt; filter as seen &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but nothing worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct sytax?&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2017-11-08T16:38:16.470" LastActivityDate="2017-11-08T18:22:09.723" Title="How to save multiple related entries on the frontend with 1 checkbox?" Tags="&lt;relatedto&gt;&lt;saveentry&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22733" PostTypeId="1" AcceptedAnswerId="22734" CreationDate="2017-11-08T16:38:11.537" Score="2" ViewCount="384" Body="&lt;p&gt;This is a news feed with a title, image and short blurb beneath. The entry content is built with the Matrix. An entry can be made up of a single 'textEditorBlock' or multiple 'textEditorBlock'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I just want to return the first 'textEditorBlock' from Matrix.&lt;/strong&gt; Currently, all existing 'textEditorBlock' blocks get returned.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Count the number of Matrix Blocks; type: textEditorBlock  #}&#xA;{% set blocks = post.buildStory.type('textEditorBlock') %}&#xA;{{ blocks | length }}&#xA;&#xA;{% for block in post.buildStory.all() %}&#xA;   {# the text #}&#xA;   {% set paragraphs = block.textEditor %}&#xA;   {% set teaser = paragraphs | length &amp;gt; 75 ? paragraphs | slice(0, 250) ~ '...' :  paragraphs %}&#xA;   &amp;lt;p&amp;gt;{{  teaser  | striptags | raw | typogrify  }}&amp;lt;/p&amp;gt;       &#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: the {{ blocks | length }} tells me the number of 'textEditorBlock' that exist for each entry (1, 4, 4, 2 and 2).&lt;/p&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="57" LastEditDate="2017-11-08T21:26:13.983" LastActivityDate="2017-11-08T21:26:13.983" Title="How to pull the first block of its kind from a Matrix?" Tags="&lt;matrix&gt;&lt;filter&gt;&lt;blocks&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22734" PostTypeId="2" ParentId="22733" CreationDate="2017-11-08T16:50:10.500" Score="4" Body="&lt;p&gt;You could try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set block = post.buildStory.type('textEditorBlock').first() %}&#xA;    {{block.textEditor}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3941" LastActivityDate="2017-11-08T16:50:10.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22735" PostTypeId="2" ParentId="22733" CreationDate="2017-11-08T16:55:00.117" Score="1" Body="&lt;p&gt;You could do: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = post.buildStory.type('textEditorBlock').limit(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, not your question, but this hacksaw port is great for those teasers.  Has some extra logic to make those a bit cleaner.  Check it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ehousestudio/craft_hacksaw&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ehousestudio/craft_hacksaw&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6302" LastActivityDate="2017-11-08T16:55:00.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22736" PostTypeId="1" AcceptedAnswerId="22810" CreationDate="2017-11-08T17:24:20.957" Score="1" ViewCount="84" Body="&lt;p&gt;we are trying to import users into a specific group but cant figure out how the json should go. Currently we have:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-json prettyprint-override&quot;&gt;&lt;code&gt;[&#xA;    {&#xA;        &quot;@model&quot;: &quot;User&quot;,&#xA;        &quot;attributes&quot;: {&#xA;            &quot;username&quot;: &quot;name@example.com&quot;,&#xA;            &quot;firstName&quot;: &quot;john&quot;,&#xA;            &quot;lastName&quot;: &quot;smith&quot;,&#xA;            &quot;email&quot;: &quot;name@example.com&quot;,&#xA;            &quot;pending&quot;: &quot;0&quot;,&#xA;            &quot;lastLoginDate&quot;: &quot;2017-08-11 04:12:06&quot;,&#xA;            &quot;dateCreated&quot;: &quot;2017-11-06 12:04:04&quot;,&#xA;            &quot;dateUpdated&quot;: &quot;2017-11-06 12:04:04&quot;&#xA;        },&#xA;        &quot;content&quot;: {&#xA;            &quot;fields&quot;: {&#xA;                &quot;customField&quot;: &quot;00000&quot;&#xA;            }&#xA;        },&#xA;        &quot;settings&quot;: {&#xA;            &quot;groups&quot;: {&#xA;                &quot;groupId&quot;: &quot;1&quot;&#xA;            }&#xA;        }&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've tried several variations on settings, permissions, and putting groups under content and attributes but nothing has worked so far.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="3951" LastEditDate="2017-11-09T19:38:17.157" LastActivityDate="2018-06-25T21:01:36.177" Title="Assign User to Group While Importing on Sprout Imports" Tags="&lt;json&gt;&lt;user-groups&gt;&lt;plugin-sproutimport&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22737" PostTypeId="2" ParentId="22732" CreationDate="2017-11-08T18:22:09.723" Score="2" Body="&lt;p&gt;You can't solve that with one input alone but you can make use of hidden fields (like craft does)&#xA;Your solution would be 1 visible dummy checkbox and multiple hidden &quot;real&quot; inputs.. So your visible dummy checkbox triggers a javascript event, that sets the values of your hidden.&#xA;Here is the syntax&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;user-type-select-{{ userType|kebab }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have to add a javascript/jquery onchange event that sets the values of your hidden fields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; id=&quot;someId1&quot; name=&quot;fields[hasUserTypes][]&quot; value=&quot;someIntegerValue1&quot; /&amp;gt; &#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;someId2&quot; name=&quot;fields[hasUserTypes][]&quot; value=&quot;someIntegerValue2&quot; /&amp;gt; &#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;someId3&quot; name=&quot;fields[hasUserTypes][]&quot; value=&quot;someIntegerValue3&quot; /&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in your php part your &lt;code&gt;$_POST&lt;/code&gt; variable would be looking like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    ....&#xA;    'fields' =&amp;gt; array(&#xA;        'hasUserTypes' =&amp;gt; array(&#xA;            someIntegerValue1, someIntegerValue2, someIntegerValue3&#xA;        ),             &#xA;    ),&#xA;    ....&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have (let us say) 3 visible checkboxes and each of it contains 2-3 relation presets you would like to store you have to change the values of your 2-3 hidden fields depending on what the user has selected. If you right click on craft cp pages and inspect the code you'll see craft does exactly the same, for every relation you select one &lt;code&gt;&amp;lt;input type=&quot;hidden&quot;&amp;gt;&lt;/code&gt; is created with the value of the id from the related entry&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-08T18:22:09.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22739" PostTypeId="1" CreationDate="2017-11-08T19:35:02.833" Score="1" ViewCount="100" Body="&lt;p&gt;This code works as expected...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if submission.symptomCheckerSymptoms == &quot;Itching&quot; %}&#xA;    it works&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... but when when multiple options are selected, it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is a checkbox group. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="45" LastEditDate="2017-11-08T20:07:37.873" LastActivityDate="2017-11-09T16:53:51.347" Title="Freeform conditionals" Tags="&lt;plugin-freeform&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22740" PostTypeId="1" CreationDate="2017-11-08T19:53:28.363" Score="1" ViewCount="255" Body="&lt;p&gt;I want to make a promotion where at a certain cart total threshold, if a particular product is in the cart, it would be free. (e.g. spend $50 and get a free mug).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to sketch out the best way to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like if a discount had a a &quot;Cart total&quot; condition, I could pull it off w/o a custom adjuster. It has &quot;Purchase Total&quot;, but that says only applies to the &lt;em&gt;matching&lt;/em&gt; products, not the entire cart. In this case I would want to select the mug in the &quot;products&quot; condition, and set the percent discount to 100% (I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas where to start?&lt;/p&gt;&#xA;" OwnerUserId="314" LastActivityDate="2017-11-12T23:28:16.743" Title="Commerce Discount: spend $X, get product free" Tags="&lt;plugin-craftcommerce&gt;&lt;discounts&gt;&lt;promotions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22741" PostTypeId="1" CreationDate="2017-11-08T20:00:10.813" Score="3" ViewCount="223" Body="&lt;p&gt;I have no experience using Craft but will be redesigning a large site using Craft. Most of the content will not be moved or restructured, I'll mostly be making cosmetic changes with HTML and CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to redesign a site while it is already live? I'd like to keep the CMS active whilst I'm making changes so that other people on my team can keep adding content before activating certain pages.&lt;/p&gt;&#xA;" OwnerUserId="7502" LastActivityDate="2017-11-13T13:47:11.360" Title="Best way to handle redesign of large site" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22742" PostTypeId="1" CreationDate="2017-11-09T00:03:20.077" Score="1" ViewCount="780" Body="&lt;p&gt;When I try to log in to CP as admin with correct credentials I'm getting &quot;Invalid username or password&quot; error and the response contains &lt;code&gt;errorCode: 0&lt;/code&gt; (I'm guessing CBaseUserIdentity::ERROR_NONE)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Weird part is that when I pull the same database to my local dev I can login using same credentials. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only thing I can see in the logs is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Tried to restore session from a cookie, but the given login name does not match the given uid. UID: bd098373-8d73-4f6c-8326-9f5a2825f5a4 and loginName: Guest.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;PHP can write into /craft/storage folder. I tried clearing out craft_session table, overridePhpSessionLocation =&gt; false and removing craft/storage/runtime/, nothing helped. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using PHP7.1 and MySQL 5.7. &lt;/p&gt;&#xA;" OwnerUserId="3382" LastEditorUserId="3382" LastEditDate="2017-11-09T14:55:57.663" LastActivityDate="2017-11-09T17:10:44.950" Title="Invalid username or password, errorCode:0 but I'm using correct credentials" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22743" PostTypeId="1" CreationDate="2017-11-09T01:41:23.943" Score="1" ViewCount="47" Body="&lt;p&gt;I’m looping through blocks in a matrix field on a page. In multiple different blocks in that loop, all of which could be different block types, I’d like to have an if statement that basically says if the most recent instance of a particular block type (we'll call it &quot;referenceBlockType&quot;) contains x in y field, then do z. Note that by most recent instance I mean the closest previous instance of referenceBlockType relative to the position of the block that contains the if statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;referenceBlockType appears multiple times in the loop and is not necessarily a direct sibling of the block that is referencing it, nor is it always the first or last field in the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that? Thanks! &lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2017-11-10T03:50:15.103" LastActivityDate="2017-11-10T05:25:11.627" Title="If Most Recent Instance of a Block Contains X in Y Field Then Do Z" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22744" PostTypeId="2" ParentId="22729" CreationDate="2017-11-09T01:59:44.733" Score="2" Body="&lt;p&gt;The way to do address validation with Commerce in gneral is using a plugin and listening to the &lt;code&gt;onBeforeSaveAddress&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up a listener with something like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;    craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress',&#xA;        [&#xA;            craft()-&amp;gt;businessLogic_logic,&#xA;            'onBeforeSaveAddressHandler'&#xA;        ]&#xA;    ); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's an example of a function that does some validation:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function onBeforeSaveAddressHandler($event){&#xA;&#xA;    $address = $event-&amp;gt;params['address'];&#xA;&#xA;    if(!$address-&amp;gt;firstName){&#xA;        $address-&amp;gt;addError('firstName','First name must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    if(!$address-&amp;gt;lastName){&#xA;        $address-&amp;gt;addError('lastName','Last name must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    if(!$address-&amp;gt;phone){&#xA;        $address-&amp;gt;addError('phone','Phone number must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    if(!$address-&amp;gt;address1){&#xA;        $address-&amp;gt;addError('address1','Street Address line 1 must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    if(!$address-&amp;gt;city){&#xA;        $address-&amp;gt;addError('city','Suburb must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    if(!$address-&amp;gt;zipCode){&#xA;        $address-&amp;gt;addError('zipCode','Postcode must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }     &#xA;    if(!$address-&amp;gt;countryId){&#xA;        $address-&amp;gt;addError('countryId','Country ID must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }          &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastEditorUserId="3951" LastEditDate="2017-11-09T17:28:53.163" LastActivityDate="2017-11-09T17:28:53.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22745" PostTypeId="2" ParentId="22743" CreationDate="2017-11-09T06:17:08.253" Score="1" Body="&lt;p&gt;My answer is based on the assumption you only have one matrix module you want to compare, otherwise you would have to store your values in an array with the key as &lt;code&gt;block.getType().handle&lt;/code&gt; or you would have to create multiple variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to create a variable that stores the value of your field if the block handle matches. So you check if your handles are equal and compare them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestBlockValue = null %}&#xA;{% for block in entry.matrix %}&#xA;    {% if block.getType().handle == 'referenceBlockType' %}&#xA;        {% if latestBlockValue is not null and latestBlockValue == x %}&#xA;            {# z #}&#xA;        {% endif %}&#xA;        {% set latestBlockValue = block.y %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-10T05:25:11.627" LastActivityDate="2017-11-10T05:25:11.627" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22746" PostTypeId="2" ParentId="22741" CreationDate="2017-11-09T06:40:14.173" Score="6" Body="&lt;p&gt;As a more detailed answer than in my comments.&lt;/p&gt;&#xA;&lt;p&gt;You should never make such huge changes in a running live system without deactivating it. No matter how experienced you are with twig, craft, php... you can easily make mistakes and you do not want users/customers to see them because they may not return to your page. There are many reasons why it is necessary to create a development environment for these kind of things.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Debugging/Error messages you do not want to activate the dev mode for twig because users would see errors if there are any. But as a developer you have to see your exceptions/syntax errors.&lt;/li&gt;&#xA;&lt;li&gt;Matrix fields in craft: in some projects users can have an incredible amount of different combinations to create pages with many different matrix block types and it requires much time to test them all. I had pages with over 100 different different possibilities to order/render the content because our customer wanted it that way. So you need to create many different entries/edit them and so on. You do not want to do that live&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;TL/DR&lt;/strong&gt;&lt;br&gt;&#xA;The best solution would be creating a development environment for your page&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to your preferred SQL interface (usually phpMyAdmin) and export your entire database&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Import that sql file into another database (you can use your localhost with xampp too if you are the only designer)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;copy your entire project to your new environment - either on a new server or at localhost&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;change the design&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;upload all your changes (usually the &lt;code&gt;templates&lt;/code&gt; folder, as well as all assets - js, css, image files)&lt;/p&gt;&#xA;&lt;p&gt;You don't have to worry about the license for craft &lt;a href=&quot;https://craftcms.com/support/license-enforcement&quot; rel=&quot;noreferrer&quot;&gt;click&lt;/a&gt; as long as you follow these rules you won't get in trouble for having the same project on different servers/locations.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-11-09T06:40:14.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22747" PostTypeId="2" ParentId="22741" CreationDate="2017-11-09T08:08:34.830" Score="7" Body="&lt;p&gt;Set up a local development environment, and invest in a workflow as described here: &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-09T08:08:34.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22748" PostTypeId="1" AcceptedAnswerId="22758" CreationDate="2017-11-09T08:29:41.433" Score="0" ViewCount="113" Body="&lt;p&gt;When we're adding a &quot;link &gt; link to an entry&quot; to a rich text field, this will result in a link to &lt;code&gt;https://www.site.com/page#entry:3962:url&lt;/code&gt; and we understand what the purpose is of this additional &lt;code&gt;#entry:3962:url&lt;/code&gt;, but is there a way to disable this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multi-domain setup we created is not compatible with this feature, so it will create links that are broken. The easiest fix for our customer is to disable this feature all together. Is that possible and how?&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2017-11-09T17:01:00.460" Title="Disable &quot;dynamic links&quot; in rich text fields" Tags="&lt;entries&gt;&lt;url&gt;&lt;field&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22749" PostTypeId="1" AcceptedAnswerId="22762" CreationDate="2017-11-09T13:22:57.760" Score="4" ViewCount="489" Body="&lt;p&gt;I'm building an MVP for a project, I'm using Craft and would like to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an experiment (/experiments/)&lt;/li&gt;&#xA;&lt;li&gt;Create multiple cages for the animals within the previous created experiment eg. 5 cages - (/experiments//cages/)&lt;/li&gt;&#xA;&lt;li&gt;Add a number of rodents to each of those cages e.g. Create 5 cages with 5 rodents in each. (/experiments//cages/)&lt;/li&gt;&#xA;&lt;li&gt;Add measurements to a specific mouse e.g., weight / tumour size (/experiments//cages/)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I was thinking this would be possible by using an entry form to add entries to a structure that looks like this-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;--Experiments&#xA;----Cage 1&#xA;------Rodent 1&#xA;------Rodent 2&#xA;------Rodent 3&#xA;----Cage 2&#xA;------Rodent 1&#xA;------Rodent 2&#xA;------Rodent 3&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is - &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to create multiple entries per form eg.&#xA;&lt;strong&gt;Create 5 cages with 5 rodents in each.&lt;/strong&gt; from a single entry form submission?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to assign the entry type in an entry form? (eg. Cage or Mouse entry type?) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to assign the parent to an entry via the entry form?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If these aren't possible with an entry form + structure what would be the best way to approach it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2017-11-09T20:12:28.823" Title="Entry Form - Multiple Entries &amp; Entry Type &amp; Parent" Tags="&lt;entry&gt;&lt;structure&gt;&lt;entry-type&gt;&lt;parents&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22750" PostTypeId="1" CreationDate="2017-11-09T15:30:20.470" Score="0" ViewCount="186" Body="&lt;p&gt;I have a form created with &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;AM forms&lt;/a&gt; that on submission does nothing. It doesn't go to the redirect url and nothing is saved to the database. Not sure what I am missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my simplified code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set form = craft.amForms.getForm('clubMembershipApplication') %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; class=&quot;form-horizontal col-sm-8 col-sm-offset-2 bv-form&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;&#xA;  {# This should always be here! #}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;&#xA;  {# Insert your forms handle. #}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&#xA;  {# Optional: Redirect URL. Will redirect to current page by default. #}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;membership/thankyou&quot;&amp;gt;&#xA;&#xA;  various fields here&#xA;&#xA;  &amp;lt;div class=&quot;submit-btn-container col-sm-8 col-sm-offset-4&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;solo-btn btn&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastEditorUserId="3951" LastEditDate="2017-11-09T15:36:28.793" LastActivityDate="2017-11-09T15:36:28.793" Title="AM Forms not Submitting" Tags="&lt;templating&gt;&lt;plugin-amforms&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22751" PostTypeId="1" AcceptedAnswerId="22752" CreationDate="2017-11-09T15:41:38.087" Score="1" ViewCount="1441" Body="&lt;p&gt;This question relates to two Craft sites running on the same server. One site is a production version, the other is staging. I use WHM v68 and EasyApache 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Production is on PHP 5.5.38. Staging is on PHP 7.0.25. Both sites report the following from admin/utils/phpinfo:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;imagick module version: 3.4.3&lt;/li&gt;&#xA;&lt;li&gt;Imagick compiled with ImageMagick version: ImageMagick 6.9.4-1 Q16 x86_64 2016-10-13&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to upgrade both sites to PHP 7.1, starting with staging. When I use WHM's MultiPHP Manager to update staging to PHP 7.1, I'm unable to load Craft. I receive this message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can’t run Craft CMS :(&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your server doesn’t meet the following requirements to run Craft CMS:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GD or ImageMagick is required, however ImageMagick is recommended as it adds animated GIF support, and preserves 8-bit and 24-bit PNGs during image transforms.&lt;/li&gt;&#xA;&lt;li&gt;GD or ImageMagick is required, however ImageMagick is recommended as it adds animated GIF support, and preserves 8-bit and 24-bit PNGs during image transforms.&#xA;Please talk to your host/IT department about upgrading your server.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand this because I know that ImageMagick and imagick are both installed and enabled. And imagick 3.4.3 (&lt;a href=&quot;https://pecl.php.net/package-changelog.php?package=imagick&amp;amp;release=3.4.3&quot; rel=&quot;nofollow noreferrer&quot;&gt;since RC1&lt;/a&gt;) should support PHP 7.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2017-11-09T15:51:38.307" Title="Upgraded to PHP 7.1 - GD or ImageMagick is required" Tags="&lt;php&gt;&lt;imagick&gt;&lt;requirements&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22752" PostTypeId="2" ParentId="22751" CreationDate="2017-11-09T15:51:38.307" Score="4" Body="&lt;p&gt;You'll need to contact your hosting provider. There are any number of ways that this &quot;PHP switching&quot; can be implemented, but typically each major PHP version has its own separate modules/config files that tell it which modules to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the fact that ImageMagick is installed on the server doesn't mean that it's globally available to every PHP version that's running. So, contact your hosting provider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I feel obligated to mention that boutique hosting environments can be a source of issues like this, so I try to avoid them, as per: &lt;a href=&quot;https://nystudio107.com/blog/web-hosting-for-agencies-freelancers&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Agencies &amp;amp; Freelancers Should Do Web Hosting&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-09T15:51:38.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22753" PostTypeId="1" AcceptedAnswerId="22755" CreationDate="2017-11-09T15:57:48.463" Score="1" ViewCount="714" Body="&lt;p&gt;I have mysite.com and I need to use a segment as if it were a querystring parameter for accomplishing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/us         -&amp;gt;  same template as: mysite.com&#xA;mysite.com/pricing/bz -&amp;gt;  same template as: mysite.com/pricing&#xA;mysite.com/shops/ag   -&amp;gt;  same template as: mysite.com/shops&#xA;mysite.com/team/mx    -&amp;gt;  same template as: mysite.com/team&#xA;...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my templates I need to know the value of the &lt;code&gt;country code&lt;/code&gt; used in the first segment for using country-specific values for small details like illustrations and prices. Just as if it was a querystring parameter, but it has to be a segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This has nothing to do with language. I also have already a multi-site configuration for two languages: mysite.com and mysite.com/es&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would also need to support these too:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com/es/us        -&amp;gt;  same template as: mysite.com/es&#xA;mysite.com/es/bz/shops  -&amp;gt;  same template as: mysite.com/es/shops&#xA;mysite.com/es/ag/team   -&amp;gt;  same template as: mysite.com/es/team&#xA;... etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the way to go? How do I tell Craft to render the template for &lt;code&gt;mysite.com/{section_name}&lt;/code&gt; when requesting &lt;code&gt;mysite.com/{section_name}/{country_code}&lt;/code&gt; So I can use country_code as a parameter from the craft.request segments? I'm struggling with this &lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2017-11-09T16:33:47.257" LastActivityDate="2017-11-15T11:10:38.617" Title="Use url segment as querystring parameter [Craft 3]" Tags="&lt;craft3&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22754" PostTypeId="2" ParentId="22742" CreationDate="2017-11-09T15:58:15.953" Score="1" Body="&lt;p&gt;Ok I've solved the issue. PHP was trying to save the sessions into a non-existing directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check the current session path, I've added &lt;code&gt;var_dump(session_save_path());&lt;/code&gt; in Craft's &lt;code&gt;/public/index.php&lt;/code&gt; (was set to &lt;code&gt;/var/lib/php-fpm/session&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fix was to update &lt;code&gt;session.save_path&lt;/code&gt; setting in the php.ini to point to the right directory with correct permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone in the future.&lt;/p&gt;&#xA;" OwnerUserId="3382" LastEditorUserId="3382" LastEditDate="2017-11-09T17:10:44.950" LastActivityDate="2017-11-09T17:10:44.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22755" PostTypeId="2" ParentId="22753" CreationDate="2017-11-09T16:15:17.343" Score="3" Body="&lt;p&gt;You need to &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;define routes&lt;/a&gt; for these URLs in settings in the CP or via the config/routes.php file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'team/&amp;lt;regionId:[^\/]+&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'team/_index'],&#xA;    'pricing/&amp;lt;regionId:[^\/]+&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'pricing/_index'],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By defining the named subpattern, the template will get loaded with a &lt;code&gt;regionId&lt;/code&gt; variable defined.&#xA;Use the &lt;code&gt;is defined&lt;/code&gt; test or the null-coalescing operator to see if the template got loaded via your custom route or via the entry route. In the case that the template gets loaded via the custom route you also need to define the &lt;code&gt;entry&lt;/code&gt; variable manually, null-coalescing operator again allows you to do that quite elegantly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = entry ?? craft.entries.section('pricing').one() %}&#xA;{% set regionId = regionId ?? 'en' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-11-15T11:10:38.617" LastActivityDate="2017-11-15T11:10:38.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22756" PostTypeId="1" CreationDate="2017-11-09T16:19:53.457" Score="2" ViewCount="143" Body="&lt;p&gt;I'm working with the ADLDAP plugin in order to provide frontend authentication against my organizations Active Directory.  The problem is that I continually receive the message &quot;Can't bind to LDAP server!&quot; after attempting to log in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested the LDAP connection first on Windows Server 2016, by using the built in LDP.exe utility, and that test proved successful.&#xA;Next, I constructed a pure PHP page, and the LDAP binding was successful.&lt;br&gt;&#xA;Here is that code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// using ldap bind&#xA;$ldaprdn  = '*****';     // ldap rdn or dn&#xA;$ldappass = '*****';  // associated password&#xA;&#xA;// connect to ldap server&#xA;$ldapconn = ldap_connect(&quot;***.***.***.***&quot;)&#xA;    or die(&quot;Could not connect to LDAP server.&quot;);&#xA;&#xA;if ($ldapconn) {&#xA;&#xA;    // binding to ldap server&#xA;    $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);&#xA;&#xA;    // verify binding&#xA;    if ($ldapbind) {&#xA;        echo &quot;LDAP bind successful...&quot;;&#xA;    } else {&#xA;        echo &quot;LDAP bind failed...&quot;;&#xA;    }&#xA;&#xA;}&#xA;&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft, I carefully followed the installation instructions, per the page: &lt;a href=&quot;https://github.com/thepitagroup/adldap_craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thepitagroup/adldap_craftcms&lt;/a&gt; as well as the changes introduced in the thread: &lt;a href=&quot;https://github.com/thepitagroup/adldap_craftcms/issues/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thepitagroup/adldap_craftcms/issues/1&lt;/a&gt;.&#xA;These changes were helpful and got me a little further along, but now, I'm stuck with the error message: &quot;Can't bind to LDAP server!&quot;&#xA;The url remains on the 'login' page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to find more detail as to the cause of the error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="3951" LastEditDate="2017-11-09T19:37:26.933" LastActivityDate="2017-11-13T15:39:09.283" Title="Using ADLDAP plugin in Craft 2.6 - can't bind to LDAP" Tags="&lt;plugins&gt;&lt;authentication&gt;&lt;windows&gt;&lt;plugin-adldap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22757" PostTypeId="2" ParentId="22739" CreationDate="2017-11-09T16:53:51.347" Score="1" Body="&lt;p&gt;The solution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if &quot;itching&quot; in submission.symptomCheckerSymptoms.value %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="720" LastActivityDate="2017-11-09T16:53:51.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22758" PostTypeId="2" ParentId="22748" CreationDate="2017-11-09T17:01:00.460" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;and we understand what the purpose is of this additional &lt;code&gt;#entry:3962:url&lt;/code&gt;, but is there a way to disable this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Currently not.  You'd need to write a Craft/Redactor plugin that used the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#addRichTextLinkOptions&quot; rel=&quot;nofollow noreferrer&quot;&gt;addRichTextLinkOptions&lt;/a&gt; hook to do something similar to what the default &quot;Link to an Entry&quot; does, but with your own custom logic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-09T17:01:00.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22759" PostTypeId="1" CreationDate="2017-11-09T17:40:25.893" Score="0" ViewCount="1094" Body="&lt;p&gt;This is probably very straight forward but unfortunately I can't seem to solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to create a dynamic URI structure that allows us to easily create pages and link them with parent directories. So basically we have 4-5 pages that need to be added as &quot;singles&quot;. Then we have around 40 pages (with around 3-4 total layouts) that we don't want to create a &quot;Single&quot; for each. So we've created a &quot;Structure&quot; called Pages and inside have 3-4 entry types. Grid list, plain template, big image and small image. We just want to create a bunch of &quot;pages&quot; and specify the parent URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we have a single &quot;Our Company&quot;, but then inside that parent we have multiple pages which we want to add in the &quot;Pages&quot; structure. But as our Entry URI for &quot;pages&quot; is set to {slug} this URL is www.website.com/slug. We need it to be www.website.com/our-company/slug. Of course we can simply update the Entry URI to have &quot;our-company&quot; but this won't work as all of the Entry URI's for all 40 pages will be our-company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically, how can we manually or dynamically specify the segment 1 that page's URI should be?&lt;/p&gt;&#xA;" OwnerUserId="7505" LastActivityDate="2018-01-19T19:20:22.560" Title="Dynamic Entry URI's for pages" Tags="&lt;url&gt;&lt;routes&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22760" PostTypeId="1" AcceptedAnswerId="22761" CreationDate="2017-11-09T17:48:40.830" Score="5" ViewCount="684" Body="&lt;p&gt;Simple use case: I have a channel that is setup solely to be used in an entries field to relate goals that are used on multiple pages. The goals channel simply has the title field, as the goals themselves are all one sentence statement and need to be easily identifiable by content editors for the site. Unfortunately, one of them is 268 characters, and the Title field has a limit of 255 characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is - is there a recommended way to change the character limit for the title field? If it's in the database structure, where is it? (I will continue to dig through the database for this). If it's in config, is there a configuration override to do this so it doesn't get changed back every update, or a plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7506" LastActivityDate="2017-11-09T19:42:54.390" Title="Is it possible to increase the Title character limit?" Tags="&lt;titles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22761" PostTypeId="2" ParentId="22760" CreationDate="2017-11-09T18:19:02.773" Score="2" Body="&lt;p&gt;The &lt;code&gt;title&lt;/code&gt; column in the &lt;code&gt;craft_content&lt;/code&gt; database table has the column type &lt;code&gt;VARCHAR&lt;/code&gt;, which is limited to 255 characters. There's no setting that'll change the column type for you – you can always use a tool like phpMyAdmin or Sequel Prop to change it to &lt;code&gt;TEXT&lt;/code&gt; in order to increase the limit and it'll probably work, though it seems like a bit of a risk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Brought to my attention by the OP in the comments below that both the actual input field and possibly some validation functionality is also limiting the &lt;code&gt;title&lt;/code&gt; field to 255 characters. My revised TLDR answer: Nope, don't bother trying :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, the following would probably be a safer/better way to solve your issue:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a PlainText field to your Entry Type (give the handle &lt;code&gt;text&lt;/code&gt; or the like). Consider making it multiline, since there's a fair amount of text for each entry.&lt;/li&gt;&#xA;&lt;li&gt;Pop into the Entry Type's settings (under CP -&gt; Settings -&gt; Sections -&gt; [entry type], and uncheck the &lt;code&gt;Show the Title field&lt;/code&gt; checkbox.&lt;/li&gt;&#xA;&lt;li&gt;In the &lt;code&gt;Title Format&lt;/code&gt; field that appears, add something like this:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ object.text | length &amp;gt; 252 ? object.text | slice(0, 252) ~ '...' : object.text }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the above in place, your content editor(s) will still only have to edit a single field (it'll just be called &lt;em&gt;Text&lt;/em&gt; instead of &lt;em&gt;Title&lt;/em&gt;), and the contents of the &quot;Text&quot; PlainText field will be copied over to the actual &lt;em&gt;Title&lt;/em&gt; field when the entry is saved. For the few entries that have more than 255 characters, the title will be truncated to the first 252 characters, suffixed w/ &lt;code&gt;...&lt;/code&gt; – those 252 characters &lt;em&gt;should&lt;/em&gt; probably be enough to identify each entry inside the CP (you might want to add &lt;a href=&quot;https://craftcms.com/support/enabling-fuzzy-search-by-default&quot; rel=&quot;nofollow noreferrer&quot;&gt;fuzzy searching&lt;/a&gt;, btw), and the dots look nicer than just cutting the text off. The &lt;code&gt;text&lt;/code&gt; field will contain the full, un-truncated text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, in your templates you'll need to use &lt;code&gt;{{ entry.text }}&lt;/code&gt; instead of &lt;code&gt;{{ entry.title }}&lt;/code&gt; to get the full text.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-11-09T19:42:54.390" LastActivityDate="2017-11-09T19:42:54.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22762" PostTypeId="2" ParentId="22749" CreationDate="2017-11-09T19:17:17.693" Score="8" Body="&lt;p&gt;A little bit late but here it is.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and create a plugin, you need at least 1 Controller but you can leave the Name value blank to create a controller with the same Name as your PluginHandle. So if you choose &quot;Experiment&quot; as your Pluginhandle your controller will be &lt;code&gt;ExperimentController&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Click on &quot;Build my Plugin&quot; and save the files in your &lt;code&gt;craft/plugins/&amp;gt;&amp;gt;pluginhandle&amp;lt;&amp;lt;&lt;/code&gt; folder (of course you need to create the &gt;&gt;pluginhandle&amp;lt;&amp;lt; directory eg.) Then you should install the plugin&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Insert this function in your controller. Note: this is just an example. I don't know your fieldLayout or some special behaviors you might want to include. So this is just the basic logic with some error handling. &lt;strong&gt;Important&lt;/strong&gt; please read the commands and change the entryType Ids&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     /**&#xA;     * @var    bool|array Allows anonymous access to this controller's actions.&#xA;     * @access protected&#xA;     */&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    /**&#xA;     * @throws Exception&#xA;     */&#xA;    public function actionSaveEntry(){&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        // check for an Id if there is one we update an existing entry if not we create a new one&#xA;        if($entryId = craft()-&amp;gt;request-&amp;gt;getParam('entryId')){&#xA;            if(!$entry = craft()-&amp;gt;elements-&amp;gt;getElementById($entryId)){&#xA;                throw new Exception('Could not find entry with id');&#xA;            }&#xA;        }else{&#xA;            $entry = new EntryModel();&#xA;            $entry-&amp;gt;typeId = craft()-&amp;gt;request-&amp;gt;getParam('entryType');&#xA;            $entry-&amp;gt;sectionId = craft()-&amp;gt;request-&amp;gt;getParam('sectionId');&#xA;        }&#xA;&#xA;        // set the content of your entry/experiment&#xA;        $entryData = craft()-&amp;gt;request-&amp;gt;getParam('experiment');&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes($entryData['fields']);&#xA;&#xA;        // try to save the entry&#xA;        if(craft()-&amp;gt;entries-&amp;gt;saveEntry($entry)){&#xA;            // fetch the id from the experiment so we can use that as a parentId for the cage&#xA;            $entryId = $entry-&amp;gt;id;&#xA;            // if everything is alright we can save the cage like we did it with the experiment&#xA;            if($cagesData = craft()-&amp;gt;request-&amp;gt;getParam('cage')){&#xA;&#xA;                foreach ($cagesData as $cageData){&#xA;                    // like with the entry check for an Id&#xA;                    if($cageId = $cageData['entryId']){&#xA;                        if(!$cage = craft()-&amp;gt;elements-&amp;gt;getElementById($cageId)){&#xA;                            throw new Exception('Could not find cage with the given Id');&#xA;                        }&#xA;                    }else{&#xA;                        $cage = new EntryModel();&#xA;                        $cage-&amp;gt;typeId = 5; // you could as well create a hidden field like for the entry itself but you must change the typeId to your entryType Id&#xA;                        $cage-&amp;gt;sectionId = craft()-&amp;gt;request-&amp;gt;getParam('sectionId');&#xA;                    }&#xA;&#xA;                    // save the content as well&#xA;                    $cage-&amp;gt;getContent()-&amp;gt;setAttributes($cageData['fields']);&#xA;                    // and set the parent&#xA;                    $cage-&amp;gt;parentId = $entryId;&#xA;                    if(craft()-&amp;gt;entries-&amp;gt;saveEntry($cage)){&#xA;                        $cageId = $cage-&amp;gt;id;&#xA;                        // and now we are going to do the same with the animals&#xA;                        if($rodentsData = $cageData['rodents']) {&#xA;                            $rodentErrors = [];&#xA;                            foreach ($rodentsData as $rodentData){&#xA;                                // like with the entry check for an Id&#xA;                                if (array_key_exists('entryId', $rodentData) &amp;amp;&amp;amp; $rodentId = $rodentData['entryId']) {&#xA;                                    if (!$rodent = craft()-&amp;gt;elements-&amp;gt;getElementById($rodentId)) {&#xA;                                        throw new Exception('Could not find rodent with the given Id');&#xA;                                    }&#xA;                                } else {&#xA;                                    $rodent = new EntryModel();&#xA;                                    $rodent-&amp;gt;typeId = 6; // change your entryType Id here&#xA;                                    $rodent-&amp;gt;sectionId = craft()-&amp;gt;request-&amp;gt;getParam('sectionId');&#xA;                                }&#xA;&#xA;                                $rodent-&amp;gt;getContent()-&amp;gt;setAttributes($rodentData['fields']);&#xA;                                $rodent-&amp;gt;parentId = $cageId;&#xA;                                if (!craft()-&amp;gt;entries-&amp;gt;saveEntry($rodent)) {&#xA;                                    // important note: if there are any errors here, the cage and the experiment is&#xA;                                    // saved anyway so you should insert the id of the experiment to the form in order&#xA;                                    // to update the form instead of creating a new one again and again&#xA;                                    // if the experiment has an Id but the cage/rodent not you'll just update the experiment&#xA;                                    // and create new cages/rodents for it&#xA;                                    $rodentErrors[] = $rodent-&amp;gt;getErrors();&#xA;                                }else{&#xA;                                    $rodentErrors = [];&#xA;                                }&#xA;                            }&#xA;                            // include errors of each item&#xA;                            craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                                'rodentErrors' =&amp;gt; $rodentErrors&#xA;                            ));&#xA;                        }&#xA;                    }else{&#xA;                        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                            'cageErrors' =&amp;gt; $cage-&amp;gt;getErrors()&#xA;                        ));&#xA;                    }&#xA;                }&#xA;&#xA;            }&#xA;        }else{&#xA;            // handle your errors here.. you can use $entry-&amp;gt;getErrors()&#xA;            // return them to your frontend and render them in twig or something&#xA;            craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;                'experimentErrors' =&amp;gt; $entry-&amp;gt;getErrors()&#xA;            ));&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your html template. Note I don't know your fieldLayout so I just included the title and the craft default &lt;code&gt;body&lt;/code&gt; field. In order to add your custom fields to the html you need to set the input name to &lt;code&gt;entryType[fields][fieldHandle]&lt;/code&gt; so if you want to add a field with the handle &lt;code&gt;foo&lt;/code&gt; to the &lt;code&gt;cage&lt;/code&gt; you would name it &lt;code&gt;cage[fields][foo]&lt;/code&gt;. As for the routing: your &lt;code&gt;action&lt;/code&gt; must be &lt;code&gt;pluginHandle/functionName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    {# your plugin name and function name #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;test/saveEntry&quot;&amp;gt;&#xA;    {# the id of your section for me its 4 you need to change this value to your section Id #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;4&quot;&amp;gt;&#xA;    {# enable the entry #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    {# id of your entry leave it blank to insert a new entry, insert a id to change an existing entry#}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;&quot;&amp;gt;&#xA;    {# the id of your experiments entryType for me its 4 you need to change this value #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryType&quot; value=&quot;4&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;experiment[fields][title]&quot;&amp;gt;&#xA;    &amp;lt;input  type=&quot;text&quot; name=&quot;experiment[fields][body]&quot;&amp;gt;&#xA;&#xA;    {# now the cage as a children #}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;title&quot;&amp;gt;cage title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][fields][title]&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][fields][body]&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[0][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        {# and some Rodents as children for the cages #}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;label for=&quot;title&quot;&amp;gt;Rodent title&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][0][fields][title]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][0][fields][body]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[0][rodents][0][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;label for=&quot;title&quot;&amp;gt;Rodent title&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][1][fields][title]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][1][fields][body]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[0][rodents][1][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;label for=&quot;title&quot;&amp;gt;Rodent title&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][2][fields][title]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[0][rodents][2][fields][body]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[0][rodents][2][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {# and another cage #}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;title&quot;&amp;gt;cage title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;cage[1][fields][title]&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;cage[1][fields][body]&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[1][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        {# and some Rodents as children for the cages #}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;label for=&quot;title&quot;&amp;gt;Rodent title&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[1][rodents][0][fields][title]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;cage[1][rodents][0][fields][body]&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cage[1][rodents][0][entryId]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# just as an example how you could display errors or at least receive the error object #}&#xA;{% if rodentErrors is defined %}&#xA;    {% for errors in rodentErrors %}&#xA;        {% for fieldHandle, errorMessages in errors  %}&#xA;            {{ fieldHandle }} {{ errorMessages[0] }}&amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please let me know when you need help and feel free to ask what you like.&lt;br&gt;&#xA;If done right, you'll end up with a structure like this with your form (note: please ignore the titles...)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HtMAw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HtMAw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-09T20:12:28.823" LastActivityDate="2017-11-09T20:12:28.823" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22763" PostTypeId="1" CreationDate="2017-11-09T19:52:23.137" Score="3" ViewCount="726" Body="&lt;p&gt;I'm setting up a multi-lingual site and want to force the language segments:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;domain.com/en/&lt;br&gt;&#xA;domain.com/fr/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if you go in the URL bar and remove the en/ or fr/ it loads up the English page without the language segment. How do I force this to load. Have tried a few .htaccess suggestions found via Google but nothing is working.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="125" LastEditDate="2017-11-14T16:39:03.160" LastActivityDate="2017-11-14T16:42:04.540" Title="Force language segment in URL on multi-lingual site" Tags="&lt;localization&gt;&lt;htaccess&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22764" PostTypeId="1" AcceptedAnswerId="22766" CreationDate="2017-11-09T20:17:51.037" Score="1" ViewCount="40" Body="&lt;p&gt;Im developing my first plugin and was interested in using the &lt;code&gt;findFolder()&lt;/code&gt; method from &lt;code&gt;AssetsService&lt;/code&gt; but i noticed the class is depreciated. What is the proper way of achieiving the functionality of &lt;code&gt;findFolder()&lt;/code&gt; without using the deprecated class? TIA!&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2017-11-09T21:14:07.850" Title="Replacement for deprecated AssetsService" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22766" PostTypeId="2" ParentId="22764" CreationDate="2017-11-09T21:14:07.850" Score="0" Body="&lt;p&gt;Most of the Assets related classes in Craft 2 have been deprecated because they've been completely re-written/refactored/removed for the upcoming Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you're looking for a Craft 2 replacement, there isn't one... the replacements are in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-09T21:14:07.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22767" PostTypeId="1" AcceptedAnswerId="22813" CreationDate="2017-11-09T23:10:12.720" Score="1" ViewCount="92" Body="&lt;p&gt;I have the following XML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nodes&amp;gt;&#xA;    &amp;lt;node&amp;gt;&#xA;        &amp;lt;title&amp;gt;Test Org - Pleae Ignore&amp;lt;/title&amp;gt;&#xA;        &amp;lt;logo&amp;gt;&#xA;            &amp;lt;enclosure url=&quot;https://www.mydomain.org/sites/default/files/louis%20xiv.jpg&quot; length=&quot;71280&quot; type=&quot;image/jpeg&quot; /&amp;gt;&#xA;        &amp;lt;/logo&amp;gt;&#xA;    &amp;lt;/node&amp;gt;&#xA;    &amp;lt;node&amp;gt;&#xA;        &amp;lt;title&amp;gt;Test Org - Pleae Ignore&amp;lt;/title&amp;gt;&#xA;        &amp;lt;logo&amp;gt;&#xA;            &amp;lt;enclosure url=&quot;https://www.mydomain.org/sites/default/files/louis%20xiv.jpg&quot; length=&quot;71280&quot; type=&quot;image/jpeg&quot; /&amp;gt;&#xA;        &amp;lt;/logo&amp;gt;&#xA;    &amp;lt;/node&amp;gt;&#xA;    &amp;lt;node&amp;gt;&#xA;        &amp;lt;title&amp;gt;Test Org - Pleae Ignore&amp;lt;/title&amp;gt;&#xA;        &amp;lt;logo&amp;gt;&#xA;            &amp;lt;enclosure url=&quot;https://www.mydomain.org/sites/default/files/louis%20xiv.jpg&quot; length=&quot;71280&quot; type=&quot;image/jpeg&quot; /&amp;gt;&#xA;        &amp;lt;/logo&amp;gt;&#xA;    &amp;lt;/node&amp;gt;&#xA;&amp;lt;/nodes&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the following template markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    url: 'https://www.domain.org/xml-details?nid=12345',&#xA;    type: 'xml',&#xA;    element: 'node',&#xA;    cache: 60,&#xA;} %}&#xA;&#xA;{% set feed = craft.feedme.feed(params) %}&#xA;{% for node in feed %}&#xA;    {{ node.title }}&#xA;    {{ node.logo.enclosure.attributes.url }}&#xA;{% endear %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ node.title }}&lt;/code&gt; displays fine, but &lt;code&gt;{{ node.logo.enclosure.attributes.url }}&lt;/code&gt; displays nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on other threads I've read, I've also tried &lt;code&gt;{{ node.logo.enclosure['@url'] }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither returns the value of the &lt;code&gt;url&lt;/code&gt; attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help getting this to work is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Using just &lt;code&gt;{{ node.logo }}&lt;/code&gt; in the template outputs &lt;code&gt;&amp;lt;enclosure url=&quot;https://www.mydomain.org/sites/default/files/louis%20xiv.jpg&quot; length=&quot;71280&quot; type=&quot;image/jpeg&quot; /&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Here's my &lt;code&gt;{{ dump(node) }}&lt;/code&gt; output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(30) {&#xA;  [&quot;recordId&quot;]=&amp;gt;&#xA;  string(5) &quot;19795&quot;&#xA;  [&quot;title&quot;]=&amp;gt;&#xA;  string(22) &quot;Robertson Blood Center&quot;&#xA;  [&quot;summary&quot;]=&amp;gt;&#xA;  string(101) &quot;&amp;lt;p&amp;gt;Volunteer- Donate blood. Your donation of life is used by wounded military at home and abroad.&amp;lt;/p&amp;gt;&quot;&#xA;  [&quot;logo&quot;]=&amp;gt;&#xA;  string(156) &quot;&amp;lt;enclosure url=&quot;https://www.mydomain.org/sites/default/files/1959440_10152076927213038_3915913252856478361_n%5B1%5D_2.jpg&quot; length=&quot;35608&quot; type=&quot;image/jpeg&quot; /&amp;gt;&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="3682" LastEditDate="2017-11-14T00:25:10.083" LastActivityDate="2017-11-14T05:54:37.403" Title="FeedMe Node Attributes" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22768" PostTypeId="1" AcceptedAnswerId="22775" CreationDate="2017-11-10T05:50:19.547" Score="1" ViewCount="920" Body="&lt;p&gt;I'm running into an issue where incorrect results are being returned when filtering Craft Commerce orders by date in a template. Can anyone help? I cannot figure out what is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FACTS:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft install is using &lt;code&gt;America/Denver&lt;/code&gt; for timezone.&lt;/li&gt;&#xA;&lt;li&gt;I'm passing dates via the query string with this format: &lt;code&gt;YYYY-mm-dd&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;PHP version is 7.1.&lt;/li&gt;&#xA;&lt;li&gt;Problem timestamp from the DB is (2017-11-10 00:14:04)... this doesn't match the screenshot below because I've been fiddling with dates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is my reduced code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = &quot;2017-11-09&quot; | date('Y-m-d 00:00:00', 'America/Denver')  %}&#xA;{% set end = &quot;2017-11-09&quot; | date('Y-m-d 23:59:59', 'America/Denver') %}&#xA;{% set orders = craft.commerce.orders.dateOrdered('and', '&amp;gt;= ' ~ start, '&amp;lt;= ' ~ end).find() %}&#xA;&#xA;{% for order in orders %}&#xA;    {{ order.dateOrdered | date('Y-m-d H:i:s e') }}&amp;lt;br/&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is the returned data with the incorrect entry:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wvj3N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wvj3N.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="103" LastEditorUserId="103" LastEditDate="2017-11-10T22:10:13.743" LastActivityDate="2017-11-10T23:57:18.200" Title="Date filtering returning wrong results - timezone issue?" Tags="&lt;datetime&gt;&lt;ecommerce&gt;&lt;timezone&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22769" PostTypeId="1" AcceptedAnswerId="22778" CreationDate="2017-11-10T16:55:20.960" Score="3" ViewCount="814" Body="&lt;p&gt;My client has gift wrapping services but they apply to the entire order, not one single line item. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I add notes or custom fields to the entire order, at the shipping stage of checkout? is this possible without a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to apply notes and giftwrapping options to the first line item by using the commerce/cart/updateLineItem form, on the cart.lineItems.first() but it didn't work. I presume that after the user proceeds to checkout the line Items no longer exist?&lt;/p&gt;&#xA;" OwnerUserId="7165" LastEditorUserId="57" LastEditDate="2017-11-10T17:47:49.640" LastActivityDate="2018-07-27T20:10:47.413" Title="Option and notes fields after cart at checkout for order, not just line items" Tags="&lt;plugin-craftcommerce&gt;&lt;custom-field&gt;&lt;ecommerce&gt;&lt;order&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22770" PostTypeId="1" CreationDate="2017-11-10T20:27:20.957" Score="0" ViewCount="28" Body="&lt;p&gt;Entries should be live and say so in the CP, but they where gone in a listing in the frontend. But after saving entry by entry they appear again. What could be wrong?&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2017-11-10T20:27:20.957" Title="What's wrong when entries appear again after save?" Tags="&lt;entries&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22771" PostTypeId="1" CreationDate="2017-11-10T20:48:07.593" Score="1" ViewCount="86" Body="&lt;p&gt;I am creating a more robust find and replace plugin which shows what is being replaced and where. I need to query for all entries(or content records?) where content is like '%findme%'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I query for entries or should I query for content records for this find and replace?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw that there is an &lt;code&gt;EntryRecord&lt;/code&gt;, so I can give it CDBCriteria object to find but there is no &lt;code&gt;ContentRecord&lt;/code&gt; so how do I get the content with the string in it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all I have so far. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;limit = $model-&amp;gt;limit;&#xA;$relaventContent = ContentService::model()-&amp;gt;findAll($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6978" LastEditorUserId="57" LastEditDate="2017-11-12T00:00:20.237" LastActivityDate="2017-11-12T00:00:20.237" Title="Get entries which have content like '%findme%'" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22772" PostTypeId="1" AcceptedAnswerId="22781" CreationDate="2017-11-10T20:52:59.633" Score="1" ViewCount="635" Body="&lt;p&gt;I'm trying to post a public entry form in a matrix field. I've added a count so that the block id is unique. However it's just clearing the matrix field and saving a single entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrix = entry.measurement | length %}&#xA;{% set count = matrix + 1 %}&#xA;{% set matrix_count = 'new' ~ count %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[measurement][{{ matrix_count }}][type]&quot; value=&quot;measurement&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;legend&quot;&amp;gt;&#xA;      &amp;lt;h2&amp;gt;Tumour Volume&amp;lt;/h2&amp;gt;&#xA;      &amp;lt;p&amp;gt;All entries should be submitted in (mm)&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;fields&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;&quot;&amp;gt;Length&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;number&quot; name=&quot;fields[measurement][{{ matrix_count }}][fields][length]&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2020-02-24T07:25:47.600" Title="Matrix Entry form" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22773" PostTypeId="1" AcceptedAnswerId="22802" CreationDate="2017-11-10T21:43:56.157" Score="1" ViewCount="123" Body="&lt;p&gt;I am developing a custom plugin that has a variable setting that can take multiple options. I've decided to use &lt;code&gt;forms.editableTable&lt;/code&gt; from Craft's &lt;code&gt;_includes/forms&lt;/code&gt;. It does the job great, saving and retrieving the settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am trying to add validation to the columns on the table: the validation model is set and I am correctly passing the errors to the &quot;right&quot; position (&lt;em&gt;Meaning I get the row index and which column has the error&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know &lt;a href=&quot;https://github.com/craftcms/cms/blob/2.6.2997/src/resources/js/craft/EditableTable.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft.EditableTable&lt;/a&gt; has the &lt;a href=&quot;https://github.com/craftcms/cms/blob/2.6.2997/src/resources/js/craft/EditableTable.js#L100&quot; rel=&quot;nofollow noreferrer&quot;&gt;getRowHtml&lt;/a&gt; method that I can use to retrieve the row and apply error classes to the field(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've watched the &lt;a href=&quot;https://www.youtube.com/watch?time_continue=7&amp;amp;v=OcgdIlBlZc8&quot; rel=&quot;nofollow noreferrer&quot;&gt;Javascript in the Control Panel&lt;/a&gt; video, but Craft.EditableTable doesn't set a data attribute with it's instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other ways to get it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7145" LastActivityDate="2017-11-13T16:39:58.187" Title="How to access Craft.EditableTable instance in CraftCM" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22774" PostTypeId="1" AcceptedAnswerId="22855" CreationDate="2017-11-10T22:24:58.703" Score="1" ViewCount="233" Body="&lt;p&gt;I have a localized site set up where the language switcher and translations are working fine. However when I link to internal pages it goes to a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;general.php has this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; //local only&#xA; 'etf-craft.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;    'siteUrl' =&amp;gt; array(&#xA;       'en' =&amp;gt; 'http://etf-craft.dev/en/',&#xA;       'fr' =&amp;gt; 'http://etf-craft.dev/fr/'&#xA;   ),&#xA;   'environmentVariables' =&amp;gt; array(&#xA;        'environment' =&amp;gt; 'local',&#xA;        'basePath' =&amp;gt; 'D:\sites\etf-craft\public_html',&#xA;        'baseUrl'  =&amp;gt; 'http://etf-craft.dev',&#xA;    )&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;site structure is like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft&lt;/li&gt;&#xA;&lt;li&gt;public&lt;/li&gt;&#xA;&lt;li&gt;public/en/&lt;/li&gt;&#xA;&lt;li&gt;public/fr/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;index.php in /fr/ and /en/ directories contains the following where french says /fr/ instead of /en/:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the English content&#xA;define('CRAFT_LOCALE', 'en');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One link I've created that 404s on me is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;/{{ craft.locale }}/news&quot; class=&quot;news&quot;&amp;gt;{{ &quot;News&quot; | t}}&#xA;      &amp;lt;i class=&quot;arrow right&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I expect is that it takes me to &lt;a href=&quot;http://etf-craft.dev/en/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://etf-craft.dev/en/news&lt;/a&gt; and the news page shows up. However I end up going to a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if I manually remove the /en/ from the address bar the news template shows up correctly.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;not working&lt;/strong&gt; - &lt;a href=&quot;http://etf-craft.dev/en/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://etf-craft.dev/en/news&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;working&lt;/strong&gt; - &lt;a href=&quot;http://etf-craft.dev/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://etf-craft.dev/news&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2017-11-13T22:41:27.720" LastActivityDate="2017-11-15T18:01:33.050" Title="Localization - linking to other pages goes to 404" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22775" PostTypeId="2" ParentId="22768" CreationDate="2017-11-10T23:43:53.367" Score="1" Body="&lt;p&gt;Essentially you're running into this same issue: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18102/using-user-selectable-timezones-to-show-localized-post-dates&quot;&gt;Using user-selectable timezones to show localized post dates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not terribly pretty, but as a workaround, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = date(&quot;2017-11-09 00:00:00&quot;)|date_modify(&quot;+7 hours&quot;)|date('Y-m-d h:i:s')  %}&#xA;{% set end = date(&quot;2017-11-09 23:59:59&quot;)|date_modify(&quot;+7 hours&quot;)|date('Y-m-d h:i:s')  %}&#xA;&#xA;{# +7 hours is because America/Denver is UTC-7, but would need to be adjusted to +6 hours when observing daylight savings time #} &#xA;&#xA;{% set orders = craft.commerce.orders.dateOrdered('and', '&amp;gt;= ' ~ start, '&amp;lt;= ' ~ end).find() %}&#xA;&#xA;{% for order in orders %}&#xA;    {{ order.dateOrdered | date('Y-m-d H:i:s e') }}&amp;lt;br/&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, note that this should &quot;just work&quot; in the upcoming Craft 3 as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be a cleaner way to do this using &lt;a href=&quot;https://craftcms.stackexchange.com/a/18110/57&quot;&gt;@carlcs's workaround&lt;/a&gt;, but I'm not seeing it at the moment.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-11-10T23:57:18.200" LastActivityDate="2017-11-10T23:57:18.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22776" PostTypeId="1" CreationDate="2017-11-11T00:15:43.237" Score="2" ViewCount="316" Body="&lt;p&gt;I have a client who needs to list product &quot;Bundles&quot; as individual products. So basically, there would be products x, y, and z, all with their own SKU, and then bundle A with it's own SKU. Bundle A is all three products (x, y, z) at a discounted price. When Bundle A is purchased, the SKU is sent to their ops and packaging team (we have an integration from Commerce to their warehouse software).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is, only bundle A's SKU is sent on purchase, which is fine because the warehouse team know what products belong to what bundle. However, the products in the bundle (x, y, z) have variations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is their some reasonable to add a product connection field to the variation of the Bundle? The issue is that the Bundle SKU would need to stay the same, but the customer needs to able to pick the variations of the related products that are in the bundle and have it stored in Commerce for the warehouse team to manually check. I'm a little lost on how to handle this. Basically, when a bundle A is ordered, their needs to be some way to store what variations of the related products were chosen for the bundle. Any suggestions, or am I missing some basic feature that would cover this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the rush of this job (customer wants this for the shopping season) I'm thinking this (thoughts or comments asked for):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a Variation text field (&lt;code&gt;bundleChoices&lt;/code&gt;) for the bundle. On the bundle add-to-cart page where all products in the bundle are listed, use Javascript to stop the add-to-cart button, collect the bundle's product's variation choices and skus, and fill in a hidden (&lt;code&gt;bundleChoices&lt;/code&gt;) field. Then add the bundle product with plaintext data describing the product variations chosen for this bundle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've decided to drop product variants in a bundle product. So if you buy a bundle, you get &lt;code&gt;product x variant a&lt;/code&gt;, &lt;code&gt;product y variant f&lt;/code&gt;, and &lt;code&gt;product z variant q&lt;/code&gt;, no substitutions on the products normal options. To accomplish this, a bundle product will have a field for SKUs where just copy and paste the variant SKUs you want attached to the bundle. &lt;/p&gt;&#xA;" OwnerUserId="5422" LastEditorUserId="5422" LastEditDate="2017-11-11T04:02:05.820" LastActivityDate="2017-11-11T04:02:05.820" Title="Commerce Bundle Product" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22777" PostTypeId="2" ParentId="22769" CreationDate="2017-11-11T00:38:31.843" Score="3" Body="&lt;p&gt;First, add a custom field to your orders, let's call it &lt;code&gt;orderNotes&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in any &lt;code&gt;updateCart&lt;/code&gt; form, you can use an input with &lt;code&gt;name=&quot;fields[orderNotes]&quot;&lt;/code&gt; to set the value of that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Line items persist on the cart until the end of checkout.  At that point they become a saved snapshot of those line items on the completed order.)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; &amp;gt;&#xA;       {{ getCsrfInput() }}&#xA;       &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;       &amp;lt;input type=&quot;text&quot; name=&quot;fields[orderNotes]&quot;&amp;gt;&#xA;       ...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-11T00:38:31.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22778" PostTypeId="2" ParentId="22769" CreationDate="2017-11-11T00:46:40.320" Score="2" Body="&lt;p&gt;You could create a special product for the gift wrapping and offer to add it to the cart during the checkout process with a separate updateCart form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the notes, you can add a custom field to your order as described in the following: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13104/how-can-i-update-custom-order-fields-in-the-frontend&quot;&gt;How can I update custom order fields in the frontend&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2017-11-11T00:46:40.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22779" PostTypeId="2" ParentId="22776" CreationDate="2017-11-11T00:49:54.667" Score="1" Body="&lt;p&gt;Without thinking about it too deeply, I think rather than sending the single bundle Id, you will probably want to use MultiAdd for this - &lt;a href=&quot;https://github.com/verbb/multi-add&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/multi-add&lt;/a&gt; - and basically set up a form that intercepts the user choices and translates those to the appropriate variant Ids for submission to Commerce.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-11T00:49:54.667" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22780" PostTypeId="1" AcceptedAnswerId="22787" CreationDate="2017-11-11T03:29:27.077" Score="2" ViewCount="442" Body="&lt;p&gt;My commerce site is setup using Stripe Checkout for payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible a customer might have a zero-balance cart after discounts are applied to their order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are my options to allow the user to checkout without adding their credit card info into Stripe Checkout's overlay?&lt;/p&gt;&#xA;" OwnerUserId="103" LastActivityDate="2017-11-12T03:57:03.183" Title="Zero dollar Commerce orders - payment how-to?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22781" PostTypeId="2" ParentId="22772" CreationDate="2017-11-11T07:56:46.993" Score="3" Body="&lt;p&gt;Of course it clears all the existing matrix elements if you update an entry. For craft it's like you delete the existing matrix blocks and create a new one. In order to keep all of them you have to send them in the form or create a custom controller to do it.&#xA;You can insert all current matrix blocks in hidden fields, so users won't see them but craft will not delete them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code is totally untested (I don't have much time) it is just to show you the direction&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.measurement %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[measurement][{{ block.id }}][type]&quot; value=&quot;{{ block.getType().handle }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[measurement][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[measurement][{{ block.id }}][fields][length]&quot; value=&quot;{{ block.length }}&quot; &amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Important note: your new matrix element's should not have the id of the latest+1. Your new matrix elements index should be &lt;code&gt;newX&lt;/code&gt; with X = the number of the new element. So if you want to insert 1 new block your index would be &lt;code&gt;new1&lt;/code&gt;, your second block would be &lt;code&gt;new2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;number&quot; name=&quot;fields[measurement][new1][fields][length]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can inspect the backend form in your cp to get to know the structure craft need. It should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- existing block --&amp;gt;&#xA;&amp;lt;div class=&quot;matrixblock&quot; data-id=&quot;7&quot; data-type=&quot;block&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contentMatrix][7][type]&quot; value=&quot;block&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contentMatrix][7][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;!-- some fields here --&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;!-- new block --&amp;gt;&#xA;&amp;lt;div class=&quot;matrixblock&quot; data-id=&quot;new1&quot; data-type=&quot;newBlock&quot; style=&quot;opacity: 1;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contentMatrix][new1][type]&quot; value=&quot;newBlock&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[contentMatrix][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;!-- some fields here --&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do't want to render the entire matrix as hidden fields for any reason let me know and I'll provide you a custom controller action to add the matrix block instead of overwriting it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;This is your controller action&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @throws Exception&#xA; */&#xA;public function actionSaveEntryMatrix(){&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    // check for the entries id, throw an exception if there is none (eg user manipulated the form)&#xA;    if(!$entryId = craft()-&amp;gt;request-&amp;gt;getParam('entryId')){&#xA;        throw new Exception('could not find EntryId');&#xA;    }&#xA;    if(!$entry = craft()-&amp;gt;elements-&amp;gt;getElementById($entryId)){&#xA;        throw new Exception('Could not find entry with id');&#xA;    }&#xA;&#xA;    // get all attributes&#xA;    $attributes = $entry-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;    $entryData = craft()-&amp;gt;request-&amp;gt;getParam('fields');&#xA;&#xA;    // just in case you want to update other fields of the entry&#xA;    if($entryData &amp;amp;&amp;amp; is_array($entryData)){&#xA;        foreach ($entryData as $k =&amp;gt; $v){&#xA;            if(array_key_exists($k, $attributes)){&#xA;                $attributes[$k] = $v;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    // now the fun starts...&#xA;    // insert your field Handle of your matrix field here to get the field&#xA;    $measurementField = craft()-&amp;gt;fields-&amp;gt;getFieldByHandle('measurement');&#xA;    // fetch all available blocktypes for that field&#xA;    $blockTypes = craft()-&amp;gt;matrix-&amp;gt;getBlockTypesByFieldId($measurementField-&amp;gt;id, 'handle');&#xA;&#xA;    // get all measurements from post request&#xA;    $measurements = craft()-&amp;gt;request-&amp;gt;getParam('measurement');&#xA;    // this array will contain all your matrixblocks&#xA;    $measurementsBlocks = [];&#xA;&#xA;    // fetch all old/existing matrix blocks&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;    $criteria-&amp;gt;fieldId = $measurementField-&amp;gt;id;&#xA;    $criteria-&amp;gt;ownerId = $entry-&amp;gt;id;&#xA;    $criteria-&amp;gt;limit = null;&#xA;    $criteria-&amp;gt;status = null;&#xA;    $criteria-&amp;gt;localeEnabled = null;&#xA;    $criteria-&amp;gt;locale = $entry-&amp;gt;locale;&#xA;    $oldBlocks = $criteria-&amp;gt;find();&#xA;&#xA;    // Index them by ID&#xA;    foreach ($oldBlocks as $oldBlock) {&#xA;        $measurementsBlocks[$oldBlock-&amp;gt;id] = $oldBlock;&#xA;    }&#xA;&#xA;    // start the new sortOrder&#xA;    $sortOrder = count($measurementsBlocks);&#xA;    foreach ($measurements as $blockId =&amp;gt; $blockData) {&#xA;        $blockType = $blockTypes[$blockData['type']];&#xA;        // Is this new a new block or an existing?&#xA;        if (strncmp($blockId, 'new', 3) === 0){&#xA;            $block = new MatrixBlockModel();&#xA;            $block-&amp;gt;fieldId = $measurementField-&amp;gt;id;&#xA;            $block-&amp;gt;typeId  = $blockType-&amp;gt;id;&#xA;            $block-&amp;gt;ownerId = $entry-&amp;gt;id;&#xA;            $block-&amp;gt;locale  = $entry-&amp;gt;locale;&#xA;&#xA;            $isNew = true;&#xA;            // Preserve the collapsed state, which the browser can't remember on its own for new blocks&#xA;            $block-&amp;gt;collapsed = !empty($blockData['collapsed']);&#xA;        }else{&#xA;            // if it is an existing block just load it&#xA;            $block = $measurementsBlocks[$blockId];&#xA;            $isNew = false;&#xA;        }&#xA;&#xA;        // get content from Post&#xA;        if(isset($blockData['fields'])){&#xA;            $block-&amp;gt;setContentFromPost($blockData['fields']);&#xA;        }&#xA;&#xA;        // if it is a new block increase the sortOrder and add it to the array&#xA;        if($isNew){&#xA;            $sortOrder++;&#xA;            $block-&amp;gt;sortOrder = $sortOrder;&#xA;            $measurementsBlocks[] = $block;&#xA;        }else{&#xA;            // otherwise just update the array&#xA;            $measurementsBlocks[$block-&amp;gt;id] = $block;&#xA;        }&#xA;    }&#xA;&#xA;    // add the matrix elements + all updated field to the entries content&#xA;    $attributes['measurement'] = $measurementsBlocks;&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes($attributes);&#xA;&#xA;    // finally save the entry&#xA;    if(craft()-&amp;gt;elements-&amp;gt;saveElement($entry)){&#xA;        // redirect to your preferred url&#xA;        $this-&amp;gt;redirect(craft()-&amp;gt;request-&amp;gt;getParam('redirect'));&#xA;    }else{&#xA;        // if there are errors add the entry to the route variables so you can display errors in twig via&#xA;        // entry.getErrors()&#xA;        craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;            'entry' =&amp;gt; $entry&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this will be your form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;!-- change your action value to your one... my plugin has the handle test --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;test/saveEntryMatrix&quot;&amp;gt;&#xA;    &amp;lt;!--&#xA;        set your redirect value to your needs&#xA;        as you said if you want to add a field&#xA;        `/{{ entry.url }}/add-data`&#xA;        or&#xA;        `/{{ entry.url }}/edit-data?id=yourId`&#xA;    --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- in case you want to edit an existing block note: 50 was my id to test things --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;measurement[50][type]&quot; value=&quot;measurement&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;legend&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;Tumour Volume&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;All entries should be submitted in (mm)&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;fields&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot;&amp;gt;Length&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;number&quot; name=&quot;measurement[50][fields][length]&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- endcase --&amp;gt;&#xA;&#xA;    &amp;lt;!-- in case you want to add a new one --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;measurement[new1][type]&quot; value=&quot;measurement&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;legend&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;Tumour Volume&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p&amp;gt;All entries should be submitted in (mm)&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;fields&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot;&amp;gt;Length&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;number&quot; name=&quot;measurement[new1][fields][length]&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;!-- endcase --&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;About the redirect: do you know how craft rooting works?&#xA;It seems like you have to make use of the &lt;code&gt;public function registerSiteRoutes()&lt;/code&gt; function: in case you don't know how that works, please open another question to keep this one clean or read the documentation&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-11T10:39:30.043" LastActivityDate="2017-11-11T10:39:30.043" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22782" PostTypeId="1" AcceptedAnswerId="22783" CreationDate="2017-11-11T08:36:00.050" Score="1" ViewCount="502" Body="&lt;p&gt;I am trying to get the required attribute of a field in a frontend form. I know this attribute only makes sense in the context of an entry type. Doing this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.fields.getFieldByHandle('handle')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;returns a FieldModel object which has no context to any entry type. This way I can get the field name and the instructions for example. In Craft we set the required attribute in the entry type editor. So my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How can I get a field's required attribute in the context of a specific entry type?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: My goal is to create a frontend form of an entry type and have every change to the field's required flags in the backend automatically reflected in the frontend form: &lt;code&gt;&amp;lt;input required ...&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5851" LastEditorUserId="5851" LastEditDate="2017-11-11T11:21:22.990" LastActivityDate="2017-11-12T00:11:36.013" Title="Get a field's required attribute in frontend form" Tags="&lt;templating&gt;&lt;field&gt;&lt;frontend&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22783" PostTypeId="2" ParentId="22782" CreationDate="2017-11-11T08:49:09.690" Score="2" Body="&lt;p&gt;I could not find a way to get a specific field for a model but you can get all and loop through them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- fetch all fields for your entryType --&amp;gt;&#xA;{% for field in craft.entries.section('yourSection').type('yourEntryType').first.getFieldLayout().getFields() %}&#xA;    &amp;lt;!-- loop them and check the handle if it is your field --&amp;gt;&#xA;    {% if field.getField().handle == &quot;yourFieldHandle&quot; %}&#xA;        &amp;lt;!-- the required attribute --&amp;gt;&#xA;        {% set required = field.required %}&#xA;        {{ field.getField().name }}&#xA;        {{ field.getField().instructions }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: if you really want to have only one field instead of the array I could create php code for you but since many people refuse to use php in craft I presented the &quot;slower&quot; twig method&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: There is a &lt;code&gt;required&lt;/code&gt; property in both the &lt;code&gt;FieldLayoutFieldModel&lt;/code&gt; (stored above in &lt;code&gt;field&lt;/code&gt;) and in the &lt;code&gt;FieldModel&lt;/code&gt; (&lt;code&gt;field.getField()&lt;/code&gt; above). What we want as the required flag of the entry type is the first: &lt;code&gt;field.required&lt;/code&gt;. This is what appears to be the little red asterisk in Craft's backend.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5851" LastEditDate="2017-11-12T00:11:36.013" LastActivityDate="2017-11-12T00:11:36.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22784" PostTypeId="2" ParentId="22771" CreationDate="2017-11-11T11:02:47.450" Score="1" Body="&lt;p&gt;It's up to you what you prefer to use. Usually people use the &lt;code&gt;ElementCriteriaModel&lt;/code&gt;. You could achieve your goal with the record itself too but it requires more code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;ElementCriteriaModel&lt;/code&gt; provides more ready-to-use options and returns populated entries, &lt;code&gt;Records&lt;/code&gt; provide only records, so no populated entries with all relations and such&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what that &lt;code&gt;$model-&amp;gt;limit&lt;/code&gt; is supposed to do, maybe this is a setting in your globals, but you would normally search for entries that contains something (you can find the rules &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) with this code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;search = 'yourKeyWord';&#xA;$relaventContent = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you just want to have all entries you would do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;limit = null;&#xA;$relaventContent = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-11T11:08:29.140" LastActivityDate="2017-11-11T11:08:29.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22786" PostTypeId="2" ParentId="13258" CreationDate="2017-11-11T15:08:51.170" Score="1" Body="&lt;p&gt;If you're using Craft 3, the &lt;a href=&quot;https://github.com/nystudio107/craft3-typogrify&quot; rel=&quot;nofollow noreferrer&quot;&gt;Typogrify&lt;/a&gt; plugin will do the &lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt; on ordinal numbers automatically for you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-11T15:08:51.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22787" PostTypeId="2" ParentId="22780" CreationDate="2017-11-12T02:28:18.153" Score="4" Body="&lt;p&gt;Stripe, like most payment providers will most likely not allow $0 payments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the typical approach is to set up the manual gateway in addition to stripe,  and detect if &lt;code&gt;order.totalPrice&lt;/code&gt; is $0, then simply change the &lt;code&gt;paymentMethodId&lt;/code&gt; to the manual gateway id as you submit. The manual gateway will happily complete with a $0 total. &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-11-12T03:57:03.183" LastActivityDate="2017-11-12T03:57:03.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22789" PostTypeId="1" CreationDate="2017-11-12T19:44:09.040" Score="1" ViewCount="156" Body="&lt;p&gt;Can anyone provide a working example to extend the following code (add support for matrix block named &quot;copy&quot;) and allow getPage usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;   section: ['news'],&#xA;   order: 'postDate desc',&#xA;   limit: 5,&#xA;   with: [&#xA;     ['assets', { kind: 'image' }]&#xA;   ]&#xA;}) %}&#xA;&#xA;&#xA;{% for content in entry.contentBuilder.type('copy').limit(1) %}&#xA;   {{ content.copy.getPage(1) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="720" LastActivityDate="2017-11-12T22:34:50.067" Title="Eager-loading of matrix field with getPage" Tags="&lt;matrix&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22790" PostTypeId="2" ParentId="22789" CreationDate="2017-11-12T20:43:52.970" Score="1" Body="&lt;p&gt;Update after Brad's comment since the &lt;code&gt;with&lt;/code&gt; part seems to be ok - by the way thank you, it is another good example that you never stop learning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I never saw that &lt;code&gt;with&lt;/code&gt; attribute in a &lt;code&gt;ElementCriteriaModel&lt;/code&gt; and after several searches I could not find any use of that attribute in craft (Please correct me if I'm wrong)&lt;/s&gt; the rest should be fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of the &lt;code&gt;.limit(1)&lt;/code&gt; you could do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content = entry.contentBuilder.type('copy').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;getPage()&lt;/code&gt; function only exists in the class &lt;code&gt;RichTextData&lt;/code&gt; maybe you have a different fieldType? Otherwise you could just do &lt;code&gt;{{ content.copy }}&lt;/code&gt; as well to display the text in that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all it would be a good idea to tell us a little bit more about your goal, your fields and your errors. Your description is a little bit insufficient in my opinion &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-12T22:34:50.067" LastActivityDate="2017-11-12T22:34:50.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22791" PostTypeId="2" ParentId="21130" CreationDate="2017-11-12T23:15:34.430" Score="2" Body="&lt;p&gt;You've sort of answered your own question - Commerce only allows one coupon on a cart at any time (currently).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine if a coupon is set, and print the code, it's basically:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if cart.couponCode %}&#xA;     {{ cart.couponCode }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You CAN have discounts applied as well as coupons, though.&#xA;With those, you can look through with something like this (removing the coupons if you've previously printed that)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for adjustment in cart.adjustments if adjustment.type == &quot;Discount&quot; %}&#xA;    {% set isCoupon = adjustment.optionsJson.code ? true : false %} &#xA;        {{ adjustment.description }}&#xA;        ...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-12T23:15:34.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22792" PostTypeId="2" ParentId="22740" CreationDate="2017-11-12T23:28:16.743" Score="1" Body="&lt;p&gt;I don't think avoiding an adjuster or plugin approach here really gains you anything much and it probably creates potential issues - it will likely just make the discount rules confusing as you can't really document the special conditions anywhere on those rules etc (and experience shows over time editors are likely to forget the special conditions and make mistakes with these sorts of hidden logic approaches).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I would approach this by listening to &lt;code&gt;onAddToCart&lt;/code&gt; and &lt;code&gt;onRemoveFromCart&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart&lt;/a&gt;&#xA;&lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In each of these I would call a function that inspects the order total and either adds the free item (if not already in the cart) if the total is high enough, or removes it if it is present but the order total slips below the desired total.  And you'd want to look at the item total, not the cart total presumably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it editor friendly, I would also add a control panel page that allows the editors to set the cart total threshold and the free product they get if the threshold is exceeded.  &lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-12T23:28:16.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22793" PostTypeId="2" ParentId="22244" CreationDate="2017-11-12T23:58:04.870" Score="1" Body="&lt;p&gt;Hmm, something else is at play here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.totalDiscount != 0 or cart.couponCode %}&#xA;  - {{ cart.totalDiscount | currency(cart.currency) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you sure the promotion is actually being applied?  I guess it is if you can calculate the discount.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-12T23:58:04.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22794" PostTypeId="2" ParentId="21209" CreationDate="2017-11-13T00:07:44.737" Score="2" Body="&lt;p&gt;I am sure you've worked this out by now, but in general terms, how you build this is entirely up to you, in front end terms.  You can make it as fancy or as simple as you like, in terms of the UI.  From simple checkboxes to some totally flash JS based UI, it's entirely up to you, as long as the form then submits the right values.  You can display any fields you wish (including images and prices) - from both the product and the specific variant(s) you're showing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing Commerce actually cares about is the &lt;code&gt;purchasableId&lt;/code&gt; and quantity (&lt;code&gt;qty&lt;/code&gt;) that you pass when you POST the &lt;code&gt;updateCart&lt;/code&gt; form.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, when it comes to display of the basket, you will get a lineItem with the chosen &lt;code&gt;purchasableId&lt;/code&gt; and from there can get back to the product and all its fields easily enough.  But how you choose to actually display this is again entirely up to you - you can, for example, create a basket that allows the customer to change the variant on the fly (you'd perhaps send an ajax remove item followed by an ajax add of the newly chosen &lt;code&gt;purchasableId&lt;/code&gt; and &lt;code&gt;qty&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="340" LastEditDate="2017-11-14T00:05:51.283" LastActivityDate="2017-11-14T00:05:51.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22795" PostTypeId="1" CreationDate="2017-11-13T03:37:35.333" Score="1" ViewCount="488" Body="&lt;p&gt;Can anyone see why this data would return as invalid in Feed Me? It's valid JSON.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;    [&#xA;      {&#xA;        &quot;FIELD1&quot;:&quot;1&quot;,&#xA;        &quot;FIELD2&quot;:&quot;Airmax&quot;,&#xA;        &quot;FIELD3&quot;:&quot;150-08ACW-134 &quot;,&#xA;        &quot;FIELD4&quot;:&quot;09 Apr 2013&quot;,&#xA;        &quot;FIELD5&quot;:&quot;31 Dec 2030&quot;,&#xA;        &quot;FIELD6&quot;:&quot;24&quot;,&#xA;        &quot;FIELD7&quot;:&quot;23&quot;,&#xA;        &quot;FIELD8&quot;:&quot;28&quot;,&#xA;        &quot;FIELD9&quot;:&quot;29&quot;,&#xA;        &quot;FIELD10&quot;:&quot;29&quot;&#xA;      },&#xA;      {&#xA;        &quot;FIELD1&quot;:&quot;2&quot;,&#xA;        &quot;FIELD2&quot;:&quot;Airmax&quot;,&#xA;        &quot;FIELD3&quot;:&quot;270-11AC3-134&quot;,&#xA;        &quot;FIELD4&quot;:&quot;01 Nov 2012&quot;,&#xA;        &quot;FIELD5&quot;:&quot;31 Dec 2030&quot;,&#xA;        &quot;FIELD6&quot;:&quot;23&quot;,&#xA;        &quot;FIELD7&quot;:&quot;21&quot;,&#xA;        &quot;FIELD8&quot;:&quot;27&quot;,&#xA;        &quot;FIELD9&quot;:&quot;28&quot;,&#xA;        &quot;FIELD10&quot;:&quot;28&quot;&#xA;      }&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/creating-your-feed&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSON example tab in the docs&lt;/a&gt; just shows the XML version so I can't see what it's supposed to be! I know there needs to be a primary element so my data just might not be right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="3951" LastEditDate="2017-11-16T19:42:57.803" LastActivityDate="2018-08-23T01:53:46.253" Title="Feed Me: Valid JSON file returning as invalid" Tags="&lt;json&gt;&lt;plugin-feedme&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22796" PostTypeId="1" AcceptedAnswerId="22797" CreationDate="2017-11-13T09:57:29.560" Score="1" ViewCount="413" Body="&lt;p&gt;I am trying to load entries from a section which have a category field with multiple values. Based on that, I want to show specific entries filtered by category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; I have a news section and I want to load sports and entertainment news only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help me on this, please.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="960" LastEditDate="2017-11-13T20:30:51.243" LastActivityDate="2017-11-13T20:30:51.243" Title="How to load entries with a certain category only?" Tags="&lt;categories&gt;&lt;craft3&gt;&lt;category&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22797" PostTypeId="2" ParentId="22796" CreationDate="2017-11-13T10:15:42.833" Score="1" Body="&lt;p&gt;You could use this, note: this is untested maybe you have to remove the &lt;code&gt;first()&lt;/code&gt; or use &lt;code&gt;targetElement: category1.id&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category1 = craft.categories.id(yourId).one() %}&#xA;{% set category2 = craft.categories.id(yourId2).one() %}&#xA;{% set news = craft.entries.all({&#xA;    section: 'news',&#xA;    relatedTo: [&#xA;        'and',&#xA;        { targetElement: category1.id },&#xA;        { targetElement: category2.id }&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should read about that topic here &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-13T11:16:00.773" LastActivityDate="2017-11-13T11:16:00.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22798" PostTypeId="1" CreationDate="2017-11-13T11:23:22.053" Score="0" ViewCount="69" Body="&lt;p&gt;I'm trying to edit an expired entry from the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I hit save, none of the changes persist and a redirect doesn't take place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entries that have a live status are fine. Even when I modify the &lt;code&gt;postDate&lt;/code&gt; and &lt;code&gt;expiryDate&lt;/code&gt; manually, it doesn't update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was using the &lt;a href=&quot;https://github.com/carlcs/craft-autoexpire&quot; rel=&quot;nofollow noreferrer&quot;&gt;auto-expire&lt;/a&gt; plugin and it works fine for new entries. Even disabling it temporarily, the editing of expired entries fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have even stripped out all required fields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;jobForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{slug}/{id}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt; &amp;lt;label for=&quot;Date&quot;&amp;gt;Date&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;date&quot; id=&quot;postDate&quot; name=&quot;postDate&quot; value=&quot;{{ entry.postDate }}&quot;&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;label for=&quot;Expiry&quot;&amp;gt;Expiry&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;date&quot; id=&quot;expiryDate&quot; name=&quot;expiryDate&quot; value=&quot;{{ entry.expiryDate }}&quot;&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;        &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&#xA;                {%- if entry is defined %} value=&quot;{{ entry.title }}&quot;{% endif -%}&amp;gt;&#xA;&#xA;        {% if entry is defined %}&#xA;            {{ errorList(entry.getErrors('title')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Publish&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has something changed in Craft because it did work on older versions?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-11-13T11:23:22.053" Title="Editing expired entries from the front end" Tags="&lt;saveentry&gt;&lt;entry-form&gt;&lt;expired&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22799" PostTypeId="2" ParentId="22741" CreationDate="2017-11-13T13:47:11.360" Score="2" Body="&lt;p&gt;To migrate an existing site you'll want to create a second environment to work in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;www.yourwebsite.com (your live site)&lt;/li&gt;&#xA;&lt;li&gt;new.yourwebsite.com (your new website)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some of the other answers discuss setting up a second environment, so I'll leave that topic to them. For a large site, you have the good approach to not change many things. When your changing systems, when possible, it's often good to migrate things in a 1-to-1 manner. This helps keep things simpler with the migration and have more focus on the many other parts of the migration where you may run into complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your question, it sounds like the migration is driven by a redesign. While the design is an important part of the transition, there will also be several other phases of your migration and it's important to consider all of them to keep the site running smoothly and expectations aligned with an appropriate schedule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following phases of the migration&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Planning&lt;/strong&gt; - Determine who's responsible for what.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Content Architecture&lt;/strong&gt; - Build out the content model for the new site in Craft and create a mapping between all the sections and fields of the old site and new site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Template Migration&lt;/strong&gt; - Migrate the HTML, CSS, JS to the new site&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Asset Migration&lt;/strong&gt; - All of your assets will need to get into the new system. Even if you have your assets on a cloud service they will need to get synced with the new system and this can take time with large amounts of files. If your existing site manages assets in Rich Text fields or other messy-HTML type ways, consider what it will take to migrate those into your new data structure.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;SEO Migration&lt;/strong&gt; - As you build out your content architecture and prepare for migration, you'll want to make sure you are taking SEO into account as you transition things over. Run a scan of your site before and after the transition to make sure you know if anything major changes. Make sure to setup 301 redirects and monitor your traffic for a reasonable period of time after the transition to confirm things are working as expected and tweak things.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Data Migration&lt;/strong&gt; - Migrating the data often takes several iterations to get right. If you have highly relational content, it may matter what order you migrate things in. You'll also need to coordinate this phase with the people adding content.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Deployment&lt;/strong&gt; - You can put a freeze on the main website and migrate and launch the new site. Or you can run a migration with most of the data and have people enter data into both systems for a week to confirm that things are working as needed with the new site. Either way, there will likely be some timing issues to sort out about the live site and the final data migration and the transition. It's much easier to plan to deploy the new site to a new server than to try to overwrite the existing site in the location where it is. Make sure you're considering SEO at this point and that you have a plan in place on how you are handling the transition and monitoring of your existing search standing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In my experience with large migrations, there is &lt;em&gt;ALWAYS&lt;/em&gt; something unexpected that presents a challenge. Don't expect to have an accurate estimate at the planning stage. Make sure people on your team understand that the estimate will be refined and get more accurate as you go through the phases of the migration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not familiar with parts of the migration process, consider hiring someone to help make sure parts of it go smoothly. It's better to spend the time up front getting things right or have a specialist help with a particular part you are less familiar with than accidentally lose all of your existing search listings.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-11-13T13:47:11.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22801" PostTypeId="2" ParentId="22756" CreationDate="2017-11-13T15:39:09.283" Score="1" Body="&lt;p&gt;In more testing, I was able to eliminate the &quot;Can't bind to LDAP server!&quot; error message from Craft by removing both: Account Suffix and Admin Account Suffix settings from the ADLDAP parameter control panel.&lt;br&gt;&#xA;In my particular setup, I left all parameters empty in the 'optional' section of the parameter control panel, with the exception of the port ('389') and 'Follow Referrals.'&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2017-11-13T15:39:09.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22802" PostTypeId="2" ParentId="22773" CreationDate="2017-11-13T16:39:58.187" Score="1" Body="&lt;p&gt;So, after fiddling with it for a while, this is what I came up with it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using &lt;code&gt;forms.editableTable&lt;/code&gt; make sure you don't initialize &lt;code&gt;Craft.EditableTable&lt;/code&gt;. You can do that by setting the &lt;code&gt;initJs&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.editableTable({&#xA;    id: 'myTableId',&#xA;    name: 'myTableName',&#xA;    cols: yourTableCols,&#xA;    ...&#xA;    initJs: false,&#xA;    ...&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That means that you will have to initialize the &lt;code&gt;Craft.EditableTable&lt;/code&gt; yourself:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includejs %}&#xA;(function () {&#xA;&#xA;  var t = new Craft.EditableTable(&#xA;    &quot;{{ 'myTableId'   | namespaceInputId   | e('js') }}&quot;,&#xA;    &quot;{{ 'myTableName' | namespaceInputName | e('js') }}&quot;,&#xA;    {{ yourTableCols|json_encode|raw }},&#xA;    {&#xA;      onAddRow: function( tr ) {&#xA;        // attach event listeners to row fields here&#xA;      }&#xA;    }&#xA;  );&#xA;&#xA;} ());&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From this point on, you can add your own listeners to the fields in the row.&lt;/p&gt;&#xA;" OwnerUserId="7145" LastActivityDate="2017-11-13T16:39:58.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22803" PostTypeId="2" ParentId="22718" CreationDate="2017-11-13T18:19:00.787" Score="2" Body="&lt;p&gt;Adding the following to &lt;code&gt;db.php&lt;/code&gt; fixed the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'collation' =&amp;gt; 'utf8_unicode_ci',&#xA;'charset' =&amp;gt; 'utf8'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My guess is that there was some permission issue that was stopping it from getting those automatically, but I'm not entirely sure how they grab the values if its not set by default.&lt;/p&gt;&#xA;" OwnerUserId="6661" LastActivityDate="2017-11-13T18:19:00.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22804" PostTypeId="2" ParentId="22795" CreationDate="2017-11-13T18:33:54.260" Score="2" Body="&lt;p&gt;I think the Json-file in it self is valid (you can always run it through a linter like &lt;a href=&quot;https://jsonlint.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;JsonLint&lt;/a&gt;) but the problem lies with the fields. Some items (such as title) are required. I found a more accurate example in the repo of the plugin. You can find it &lt;a href=&quot;https://github.com/verbb/feed-me/issues/95&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;  &quot;title&quot;:  &quot;JSON&quot;,&#xA;  &quot;slug&quot;: &quot;json&quot;,&#xA;  &quot;pubDate&quot;: &quot;Tue, 24 Feb 2015 09:00:53 +0000&quot;,&#xA;  &quot;entry_date&quot;: &quot;Tue, 16 Jul 2013 17:14:36 +0000&quot;,&#xA;  &quot;status&quot;: &quot;enabled&quot;,&#xA;  &quot;Assets&quot;: {&#xA;    &quot;asset&quot;: [&#xA;      &quot;350x150.png&quot;,&#xA;      &quot;350x155.png&quot;&#xA;    ]&#xA;  },&#xA;  &quot;Categories&quot;: {&#xA;    &quot;category&quot;: [&#xA;      &quot;Category 1&quot;,&#xA;      &quot;Category 2&quot;&#xA;    ]&#xA;  },&#xA;  &quot;Checkboxes&quot;: &quot;option_2&quot;,&#xA;  &quot;Color&quot;: &quot;#ffffff&quot;,&#xA;  &quot;Date&quot;: &quot;Tue, 24 Feb 2015 09:00:53 +0000&quot;,&#xA;  &quot;Dropdown&quot;: &quot;option2&quot;,&#xA;  &quot;Entries&quot;: {&#xA;    &quot;Entry&quot;: [&#xA;      &quot;Sample Event&quot;,&#xA;      &quot;homepage&quot;&#xA;    ]&#xA;  },&#xA;  &quot;Lightswitch&quot;: &quot;Yes&quot;,&#xA;  &quot;Multi&quot;: &quot;Option2&quot;,&#xA;  &quot;Number&quot;: &quot;10&quot;,&#xA;  &quot;PlainText&quot;: &quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&quot;,&#xA;  &quot;Position&quot;: &quot;right&quot;,&#xA;  &quot;Radio&quot;: &quot;Option2&quot;,&#xA;  &quot;RichText&quot;: &quot;&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lectus nisl, mattis et luctus ut, varius vitae augue. Integer non lacinia urna, nec molestie enim. Aenean ultricies mattis ligula vel consectetur. Etiam ultrices fringilla lectus nec mollis.&amp;lt;/p&amp;gt; &amp;lt;p&amp;gt;Nunc elit magna, semper ac faucibus ut, volutpat eu augue. Vivamus id nibh facilisis, fermentum massa vitae, rhoncus mi. Praesent sit amet efficitur dui.&amp;lt;/p&amp;gt;&quot;,&#xA;  &quot;Table&quot;: {&#xA;    &quot;row&quot;: [&#xA;      {&#xA;        &quot;one&quot;: &quot;Option1&quot;,&#xA;        &quot;two&quot;: &quot;Option2&quot;,&#xA;        &quot;three&quot;: &quot;6&quot;,&#xA;        &quot;four&quot;: &quot;true&quot;&#xA;      },&#xA;      {&#xA;        &quot;one&quot;: &quot;Option3&quot;,&#xA;        &quot;two&quot;: &quot;Option4&quot;,&#xA;        &quot;three&quot;: &quot;7&quot;,&#xA;        &quot;four&quot;: &quot;false&quot;&#xA;      },&#xA;      {&#xA;        &quot;one&quot;: &quot;Option5&quot;,&#xA;        &quot;two&quot;: &quot;Option6&quot;,&#xA;        &quot;three&quot;: &quot;9&quot;,&#xA;        &quot;four&quot;: &quot;true&quot;&#xA;      }&#xA;    ]&#xA;  },&#xA;  &quot;tag&quot;: [&#xA;    &quot;Tag 1&quot;,&#xA;    &quot;Tag 2&quot;&#xA;  ]&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5672" LastActivityDate="2017-11-13T18:33:54.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22805" PostTypeId="1" CreationDate="2017-11-13T19:52:58.743" Score="1" ViewCount="284" Body="&lt;p&gt;I'm having a really weird issue with user registration. I've got verification turned off, and logging in after activation turned on, so that when a user registers then checks out, it's a seamless flow. And this works. But the login form at &lt;code&gt;/login&lt;/code&gt; does not. Whenever I try to create an account I get this in the logs: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_POST=array (&#xA;  'action' =&amp;gt; 'users/saveUser',&#xA;  'redirect' =&amp;gt; '/confirm-account',&#xA;  'firstName' =&amp;gt; 'Test',&#xA;  'lastName' =&amp;gt; 'User',&#xA;  'email' =&amp;gt; 'testuser9181@gmail.com',&#xA;  'password' =&amp;gt; REDACTED,&#xA;)&#xA;&#xA;$_SESSION=array (&#xA;  '8dfc5494412903b44af114111435fc5cYii.CWebUser.flash.error' =&amp;gt; 'Invalid username or password.',&#xA;  '8dfc5494412903b44af114111435fc5cYii.CWebUser.flashcounters' =&amp;gt; &#xA;  array (&#xA;    'error' =&amp;gt; 0,&#xA;  ),&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what might be going on here? I have no idea what's causing this, and why it's working on one page and not the other. I can copy/paste the registration code from the checkout page and it will not work at &lt;code&gt;/login&lt;/code&gt;. The same template is being extended.&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2017-11-13T19:58:45.927" Title="&quot;Invalid username or password&quot; when registering and logging in a user" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22806" PostTypeId="2" ParentId="22805" CreationDate="2017-11-13T19:58:45.927" Score="1" Body="&lt;p&gt;Fixed by upgrading to 2.6.2997.&lt;/p&gt;&#xA;" OwnerUserId="4700" LastActivityDate="2017-11-13T19:58:45.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22807" PostTypeId="1" AcceptedAnswerId="22812" CreationDate="2017-11-13T20:15:51.287" Score="1" ViewCount="65" Body="&lt;p&gt;I discovered today that searching a custom field for a number will return results containing either the positive or negative versions of the number, even if I do an exact search. For example: &lt;code&gt;fieldName::&quot;-2&quot;&lt;/code&gt; will give me entries where that field contains either &quot;2&quot; or &quot;-2&quot;. Same result if I search for &lt;code&gt;fieldName::&quot;2&quot;&lt;/code&gt;. The field in question is a &quot;number&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any workaround for this?&lt;/p&gt;&#xA;" OwnerUserId="62" LastActivityDate="2017-11-13T22:06:51.083" Title="How to differentiate between positive and negative numbers in search" Tags="&lt;control-panel&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22808" PostTypeId="1" AcceptedAnswerId="22811" CreationDate="2017-11-13T20:17:34.937" Score="1" ViewCount="50" Body="&lt;p&gt;I have 3 groups of tags that redirect to the same template. &lt;code&gt;tags/index.html&lt;/code&gt;. All the routing and linking those tags to their group page works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ siteUrl }}taggroup/{{ tag.slug }}&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that when I try to enter a tag that doesn't exist on the address bar (e.g., &lt;a href=&quot;http://sitename/taggroup/unknowntag&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sitename/taggroup/unknowntag&lt;/a&gt;) I get all entries displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my &lt;code&gt;tags/index.html&lt;/code&gt; code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not tag %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% set tag = craft.tags.slug(tag).first %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(tag).order('title').limit(null) %}&#xA;&#xA; {% if entries | length %}&#xA;&#xA;  {% for entry in entries %}&#xA;&#xA;    &amp;lt;!-- Code Here --&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;&#xA;  {% else %}&#xA;&#xA;   &amp;lt;!-- No Tag Code Here --&amp;gt;&#xA;&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What Am I doing wrong? Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2017-11-13T20:41:19.747" Title="Search for non-existing tags shows all entries" Tags="&lt;templating&gt;&lt;relations&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22810" PostTypeId="2" ParentId="22736" CreationDate="2017-11-13T20:19:52.227" Score="1" Body="&lt;p&gt;Sprout Import for Craft 3 supports importing Users and assigning them to User Groups. See the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/import/users.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Users&lt;/a&gt; page of documentation for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, you just need to assign the User Group ID to the &lt;code&gt;groups&lt;/code&gt; attribute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutimport\\importers\\elements\\User&quot;,&#xA;    &quot;attributes&quot;: {&#xA;      &quot;username&quot;: &quot;username&quot;,&#xA;      &quot;firstName&quot;: &quot;First&quot;,&#xA;      &quot;lastName&quot;: &quot;Last&quot;,&#xA;      &quot;email&quot;: &quot;user@website.com&quot;,&#xA;      &quot;pending&quot;: 1,&#xA;      &quot;lastLoginDate&quot;: &quot;2014-12-11 04:12:06&quot;,&#xA;      &quot;dateCreated&quot;: &quot;2014-04-09 12:04:04&quot;,&#xA;      &quot;dateUpdated&quot;: &quot;2015-04-04 06:04:08&quot;,&#xA;      &quot;admin&quot;: &quot;1&quot;,&#xA;      &quot;groups&quot;: [1,2]&#xA;    }&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;LEGACY RESPONSE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Import does not yet support importing to User Groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While we do hope to add this feature in the future, we currently don't have an ETA. Please feel free to reach out to us directly if you'd like to discuss custom development options to help get this feature implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add comments to or follow this feature &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-import/issues/17&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-06-25T21:01:36.177" LastActivityDate="2018-06-25T21:01:36.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22811" PostTypeId="2" ParentId="22808" CreationDate="2017-11-13T20:41:19.747" Score="2" Body="&lt;p&gt;That is only logical. Your &lt;code&gt;tag&lt;/code&gt; will be null so your query is actually &#xA;&lt;code&gt;{% set entries = craft.entries.relatedTo(null).order('title').limit(null) %}&lt;/code&gt; and that results in &#xA;&lt;code&gt;{% set entries = craft.entries.order('title').limit(null) %}&lt;/code&gt;&#xA;So in the end you will fetch all entries. &#xA;This is what you need &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tag = craft.tags.slug(tag).first %}&#xA;&amp;lt;!-- check if the tag exists --&amp;gt;&#xA;{% if tag %}&#xA;    &amp;lt;!-- the length filter actually fetches all entries -&amp;gt; executes the query and caches all entries&#xA;    so you can just fetch them in the beginning. You'll gain no performance boost with that filter --&amp;gt;&#xA;    {% set entries = craft.entries.relatedTo(tag).order('title').limit(null).find() %}&#xA;    {% if entries %}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;!-- code here you fetched entries --&amp;gt;&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        &amp;lt;!-- you have a tag but no entries related to that tag --&amp;gt;&#xA;    {% endif %}&#xA;{% else %}&#xA;    &amp;lt;!-- you have no tag -&amp;gt; you won't find any entries --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-13T20:41:19.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22812" PostTypeId="2" ParentId="22807" CreationDate="2017-11-13T22:06:51.083" Score="0" Body="&lt;p&gt;The reason it's happening:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Craft's &lt;a href=&quot;https://craftcms.com/classreference/services/SearchService&quot; rel=&quot;nofollow noreferrer&quot;&gt;SearchService&lt;/a&gt; indexes the keywords for a field, they go though a &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/SearchService.php#L302&quot; rel=&quot;nofollow noreferrer&quot;&gt;normalization&lt;/a&gt; process that specifically removes &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/StringHelper.php#L365&quot; rel=&quot;nofollow noreferrer&quot;&gt;punctuation and diacritics&lt;/a&gt; before being saved to the &lt;code&gt;craft_searchindex&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of numeric values, that's going to include things like decimals, grouping separators and negation symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A workaround if you're doing this on a front-end search form, is to query the field's value directly, bypassing the SearchService. So...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries.fieldName('-2').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is going to try and do a direct match against that field's actual value in the &lt;code&gt;craft_content&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few feature requests you might want to add your voice to that would make your situation better as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1630&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1630&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/833&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/833&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-13T22:06:51.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22813" PostTypeId="2" ParentId="22767" CreationDate="2017-11-13T23:48:54.703" Score="2" Body="&lt;p&gt;I believe the correct syntax you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ node.logo.enclosure['@url'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a handy hint, you can use the following to inspect any element parsed by Feed Me to see how you can access it. Using &lt;code&gt;{{ dump(node.logo.enclosure) }}&lt;/code&gt; for example, you can see an array with keys and values for you to access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is also outlined in the documentation - &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/using-in-your-templates#example-template-code&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/using-in-your-templates#example-template-code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Refer to full code below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    url: 'http://feedme.craft.dev/stack.xml',&#xA;    type: 'xml',&#xA;    element: 'node',&#xA;} %}&#xA;&#xA;{% for node in craft.feedme.feed(params) %}&#xA;    &amp;lt;pre&amp;gt;&#xA;        {{ dump(node) }}&#xA;    &amp;lt;/pre&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Produces:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(2) {&#xA;  [&quot;title&quot;]=&amp;gt;&#xA;  string(23) &quot;Test Org - Pleae Ignore&quot;&#xA;  [&quot;logo&quot;]=&amp;gt;&#xA;  array(1) {&#xA;    [&quot;enclosure&quot;]=&amp;gt;&#xA;    array(3) {&#xA;      [&quot;@url&quot;]=&amp;gt;&#xA;      string(60) &quot;https://www.mydomain.org/sites/default/files/louis%20xiv.jpg&quot;&#xA;      [&quot;@length&quot;]=&amp;gt;&#xA;      string(5) &quot;71280&quot;&#xA;      [&quot;@type&quot;]=&amp;gt;&#xA;      string(10) &quot;image/jpeg&quot;&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Looking at your exact feed, I can see the issue. Your feed actually has HTML, which is interpreted as a string. For instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;logo&amp;gt;&#xA;    &amp;amp;lt;enclosure url=&quot;https://www.mydomain.com/1959440_10152076927213038_3915913252856478361_n%5B1%5D_2.jpg&quot; length=&quot;35608&quot; type=&quot;image/jpeg&quot; /&amp;amp;gt;&#xA;&amp;lt;/logo&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice how is your original example its assumed its all XML? In fact, the logo node contains HTML, which is just treated like a string.&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2017-11-14T05:54:37.403" LastActivityDate="2017-11-14T05:54:37.403" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22815" PostTypeId="1" AcceptedAnswerId="22817" CreationDate="2017-11-14T01:32:36.030" Score="2" ViewCount="217" Body="&lt;p&gt;I want to only display entries on the category page which is the last in the array of the entries category, so that it doesn't also show on parent category page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let say these are my categories:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shop&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;List item&lt;/li&gt;&#xA;&lt;li&gt;Shoes&lt;/li&gt;&#xA;&lt;li&gt;T-shirts&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Entries with a category of &quot;shoes&quot; displays under both &quot;shop&quot; and &quot;shoes&quot; because of the way categories work as an array. My aim is to have it show only on &quot;shoes&quot;, not &quot;shop&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Get entries from the shop section --&amp;gt;&#xA;    {% set params = {&#xA;      section: 'shop'&#xA;    } %}&#xA;&#xA;    &amp;lt;!-- Check if curreny entry is a category page, Set params to get entries related to current category, order by entry &quot;order&quot; field --&amp;gt;&#xA;    {% if category is defined %}&#xA;      {% set params = params | merge({&#xA;        relatedTo: category&#xA;      }) %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;!-- Get all entries by params --&amp;gt;&#xA;    {% set blogEntries = craft.entries(params) %}&#xA;&#xA;    &amp;lt;!-- Paginate entries (9 per page) --&amp;gt;&#xA;    {% paginate blogEntries.limit(9) as pageInfo, pageEntries %}&#xA;&#xA;    &amp;lt;!-- Display each entry, only if the current category is the same as the LAST category in the entries array. The conditional makes sure that the entries with non-top-level categories aren't displayed under parent categories. --&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {# for entry in pageEntries if category.id == entry.productCategory.last().id #}&#xA;      {% for entry in pageEntries %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }} ({{ entry.productCategory | join(', ') }})&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  {% if blogEntries|length &amp;gt; 9 %}&#xA;    {% include &quot;_partials/pagination.twig&quot; %}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've managed to display the entries under the correct categories with the &#xA;&lt;code&gt;if category.id == entry.productCategory.last().id&lt;/code&gt; on the for loop displaying all the entries, however this does not work with pagination. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there a way to bake the conditional into the initial category params to avoid looping through all entries where the current category doesn't match the last category within the entry's array. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this makes sense, please feel free to get in touch for any clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Teegan&lt;/p&gt;&#xA;" OwnerUserId="7520" LastActivityDate="2017-11-14T03:54:10.250" Title="Displaying entries with pagination on a category page where the entry's last category in the array is the current category" Tags="&lt;entries&gt;&lt;pagination&gt;&lt;category&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22817" PostTypeId="2" ParentId="22815" CreationDate="2017-11-14T02:43:11.140" Score="1" Body="&lt;p&gt;Found the solution, thanks to Aaron Berkowitz on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11037/how-to-get-entries-related-to-current-category-only-not-children?rq=1&quot;&gt;How to get entries related to current category only (not children)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to exclude the entries related to the subcategories.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if category is defined %}&#xA; {% set dontInclude = [] %}&#xA;     {% for child in craft.categories.descendantOf(category) %}&#xA;        {% set dontInclude = dontInclude|merge(craft.entries.relatedTo(child).ids) %}&#xA;      {% endfor %}&#xA;&#xA;      {% set str = dontInclude|join(', not ') %}&#xA;&#xA;&#xA;  {% if dontInclude|length &amp;gt; 0 %}&#xA;    {% set params = params | merge({&#xA;      relatedTo: category,&#xA;      order: 'order ASC',&#xA;      id: 'and, not '~str&#xA;    }) %}&#xA;  {% else %}&#xA;    {% set params = params | merge({&#xA;      relatedTo: category,&#xA;      order: 'order ASC'&#xA;    }) %}&#xA;  {% endif %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;!-- Get all entries by params --&amp;gt;&#xA;    {% set blogEntries = craft.entries(params) %}&#xA;&#xA;    &amp;lt;!-- Paginate entries (9 per page) --&amp;gt;&#xA;    {% paginate blogEntries.limit(2) as pageInfo, pageEntries %}&#xA;&amp;lt;ul&amp;gt;&#xA;      {% for entry in pageEntries %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }} ({{ entry.productCategory|join(', ') }})&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7520" LastEditorUserId="7520" LastEditDate="2017-11-14T03:54:10.250" LastActivityDate="2017-11-14T03:54:10.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22818" PostTypeId="2" ParentId="22795" CreationDate="2017-11-14T08:05:50.733" Score="1" Body="&lt;p&gt;This is really odd but I saved the file with Prettier (a code beautifier) enabled in my text editor and it worked after that. Other than indentation and spacing I can't see the difference. Really odd, but it's working now.&lt;/p&gt;&#xA;" OwnerUserId="4823" LastActivityDate="2017-11-14T08:05:50.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22819" PostTypeId="1" AcceptedAnswerId="22820" CreationDate="2017-11-14T10:32:24.050" Score="2" ViewCount="81" Body="&lt;p&gt;I have two separate channel types, let's say &quot;News&quot; and &quot;Reviews&quot; and each of those can have tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have separate tags for each of those? So News has it's own set of tags, that can't be selected when creating a new Review.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm coming from a Wordpress background, and in Wordpress these custom post types would have their own taxonomies. (Or News would use tags, and I would create a new one for Reviews).&lt;/p&gt;&#xA;" OwnerUserId="7522" LastEditorUserId="57" LastEditDate="2017-11-14T21:00:50.937" LastActivityDate="2017-11-14T21:00:50.937" Title="Multiple Tag Groups/Sets for separate channels" Tags="&lt;categories&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22820" PostTypeId="2" ParentId="22819" CreationDate="2017-11-14T11:06:22.193" Score="2" Body="&lt;p&gt;Sounds like two different relation fields - linked with two different categories - would fit much better for your needs. When you create Tags/Taggroups everybody can insert everything so you can't forbid equal tags unless you hook into an event with php to prevent the saving process. When you create two different tag fields their autocomplete sources will be different but you can insert whatever you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you want to do is: create 2 different categories: The first &lt;code&gt;News&lt;/code&gt; the second &lt;code&gt;Reviews&lt;/code&gt; and add your keywords there. Then you create two relation fields, one linked with &lt;code&gt;News&lt;/code&gt;, the other one linked with &lt;code&gt;Reviews&lt;/code&gt;. Then you add those to your field layout&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-14T11:06:22.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22822" PostTypeId="1" CreationDate="2017-11-14T15:19:17.367" Score="1" ViewCount="126" Body="&lt;p&gt;I'm trying to duplicate an existing Craft CMS site by moving it from an online server to a local installation using MAMP. I have copied the /craft folder and all files in the root of /public_html (including the htaccess file). I have exported and reimported the database using PHPMyAdmin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now when I go to localhost:8888 I get a &quot;server not found&quot; error because I've been redirected to www.localhost — is this the issue? I tried swapping out the htaccess file to the default one from the craft installation packet but then instead of getting a server not found I get blank pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I'm pretty sure the database imported correctly because I could login to /admin before I moved the /craft folder to the local server.&lt;/p&gt;&#xA;" OwnerUserId="7502" LastActivityDate="2017-11-15T22:27:50.587" Title="Tried to duplicate site in local environment but loading blank" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22823" PostTypeId="2" ParentId="22763" CreationDate="2017-11-14T16:37:00.553" Score="2" Body="&lt;p&gt;Make sure to remove Craft’s default rewrite rule (“Send would-be 404 requests to Craft”) from the .htaccess in your document root, so it’s only in the .htaccess files of your locales’ subfolders. You can now remove the index.php as well and requests to your homepage domain.com/ should now respond with a 404 HTTP error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have now removed all (duplicate) routes starting at root level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last step is to redirect visits to the homepage to en/ via the .htaccess in your document root.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteRule ^$ /en [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-11-14T16:42:04.540" LastActivityDate="2017-11-14T16:42:04.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22824" PostTypeId="1" AcceptedAnswerId="22825" CreationDate="2017-11-14T16:47:31.297" Score="2" ViewCount="96" Body="&lt;p&gt;Is it possible to limit and offset the output of a Matrix field by 50%? I wanted to split the data across two columns. &lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2017-11-14T16:59:12.467" Title="Limit/offset output of Matrix field by 50%" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22825" PostTypeId="2" ParentId="22824" CreationDate="2017-11-14T16:59:12.467" Score="2" Body="&lt;p&gt;This is what I have used, some math and the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;slice&lt;/code&gt;&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set midIndex = ((entry.myMatrixField|length) / 2)|round - 1 %}&#xA;&#xA;{% set blocksA = entry.myMatrixField|slice(0, midIndex) %}&#xA;{% set blocksB = entry.myMatrixField|slice(midIndex, null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-11-14T16:59:12.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22826" PostTypeId="1" CreationDate="2017-11-14T17:14:20.873" Score="1" ViewCount="64" Body="&lt;p&gt;I'm pretty new to Craft, and we have been trying to implement a front end LDAP authentication to our website at my organization.  I found the ADLDAP plugin and have been testing it with the website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the link to the AdldapController.php file that seems to have most of the logic for the plugin:&#xA;&lt;a href=&quot;https://github.com/thepitagroup/adldap_craftcms/blob/master/adldap/controllers/AdldapController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thepitagroup/adldap_craftcms/blob/master/adldap/controllers/AdldapController.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking at the code in the AdldapController.php file and was wondering if the check for a matching username in Craft is necessary? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, my organization only desires to authenticate by Active directory.  It looks like this script is also checking to see if the user exists in the local craft user table (line 62). (Am I correct in understanding that this script will put the username/password combo from active directory verbatim into the MySQL table for future use, or is a new craft-only password generated?) Can this block of code be omitted as an 'option?' Pros/cons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any leads or input.&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2017-11-14T20:54:33.513" Title="ADLDAP plugin in Craft 2.6 - New User Required In Craft Table?" Tags="&lt;plugins&gt;&lt;craft-features&gt;&lt;plugin-adldap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22827" PostTypeId="2" ParentId="22826" CreationDate="2017-11-14T17:29:32.237" Score="1" Body="&lt;p&gt;In order to navigate as a user in craft the user needs a record in the &lt;code&gt;users&lt;/code&gt; table. So what the plugin does is the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Starting an authentication by active directory&lt;/li&gt;&#xA;&lt;li&gt;If the login credentials are correct it searches if a craft user exists&lt;/li&gt;&#xA;&lt;li&gt;If there is no craft user connected to the active directory user it creates a new user with the same name/password like he/she has in active directory&lt;/li&gt;&#xA;&lt;li&gt;If there is a craft user instead of checking the password with the craft user - in case you changed it in active directory - it just overwrites the current craft user password every single time a user tries to login. The password will be crypted only for craft. There are no changes to your active directory&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In summary: you don't need to be afraid, there are no changes in active directory but every time a user tries to login his password will be stored into the db again and again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Code is not optional, you have to store the active directory user as a craft user in order to change their permissions otherwise they won't be able to login to the backend or make any changes unless you implement your own logic/controllers to manage the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;just some more thoughts: If your users won't be able to login to the backend and should be able to make changes only via frontend requests, there is no need to store them as craft users, so you could eventually(!) - depends on the rest of the plugin - remove that block but you won't be able to use crafts build-in functions like detecting which user made certain changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would have to create a custom logic to give them permissions (if needed) and you would have to log user activities by yourself (if needed). So if you want to see who did something you have to include a custom &lt;code&gt;username&lt;/code&gt; field for every entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you can't use the &lt;code&gt;craft-&amp;gt;userSession&lt;/code&gt; service to get current user information and you have to implement logic that the user is actually logged in by yourself (store some values in the &lt;code&gt;$_SESSION&lt;/code&gt;) You can't use crafts &lt;code&gt;currentUser&lt;/code&gt; global in twig as well -&gt; you need a custom twig extension or a custom function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All controller actions must be allowed for everyone so they can't access all the craft default controllers since most of them don't allow anonymous requests. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-14T20:54:33.513" LastActivityDate="2017-11-14T20:54:33.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22828" PostTypeId="1" AcceptedAnswerId="22829" CreationDate="2017-11-14T17:43:06.100" Score="4" ViewCount="2621" Body="&lt;p&gt;I have five separate sections with x number of entries each. I would like to render all the entries from all the sections on a single entry template page. Is there a way to do this ? I know we can set entries like this  &lt;code&gt;{% set entries = craft.entries.section('sectionHandle').limit(10) %}&lt;/code&gt; , but I'm not sure how to get entries from all the sections. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or suggestion is highly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="6995" LastEditorUserId="5557" LastEditDate="2017-11-14T17:52:36.233" LastActivityDate="2018-08-20T06:41:56.387" Title="How to fetch entries from multiple sections" Tags="&lt;entries&gt;&lt;structure&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22829" PostTypeId="2" ParentId="22828" CreationDate="2017-11-14T17:47:17.027" Score="11" Body="&lt;p&gt;You can insert an array of different sections instead of a single one to pull entries from multiple sections&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(['sectionHandle', 'sectionHandleTwo']).limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also write that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: ['sectionHandle', 'sectionHandleTwo'],&#xA;  limit: 10&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you remove the &lt;code&gt;.section()&lt;/code&gt; / &lt;code&gt;section:...,&lt;/code&gt; entirely you'll fetch all entries from all sections. &#xA;Here's a link to the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5072" LastEditDate="2018-08-20T06:41:56.387" LastActivityDate="2018-08-20T06:41:56.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22830" PostTypeId="1" AcceptedAnswerId="22831" CreationDate="2017-11-14T18:37:32.383" Score="1" ViewCount="524" Body="&lt;p&gt;I am trying to get the page title of the categories page. Currently it shows as: &lt;code&gt;category-name&lt;/code&gt;, but I would like to have it set to &lt;code&gt;Category Name&lt;/code&gt; to match the &lt;code&gt;category.title&lt;/code&gt;.&#xA;My &lt;code&gt;categories/index.html&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = category %}&#xA;&#xA;{% block content %}&#xA;&#xA;    {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;    {% for entry in entries %}&#xA;&#xA;        -- Code Here --&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="979" LastActivityDate="2017-11-14T19:07:35.793" Title="Setting the page title for a category page" Tags="&lt;templating&gt;&lt;categories&gt;&lt;category&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22831" PostTypeId="2" ParentId="22830" CreationDate="2017-11-14T19:07:35.793" Score="3" Body="&lt;p&gt;We would need to know how you render your title. Otherwise it would just be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot; /&amp;gt;&#xA;    &amp;lt;title&amp;gt;{% if title is defined %}{{ title }} {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in your &lt;code&gt;category&lt;/code&gt; template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set title = 'Category ' ~ category.title %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-14T19:07:35.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22833" PostTypeId="1" AcceptedAnswerId="22844" CreationDate="2017-11-14T20:52:50.380" Score="1" ViewCount="336" Body="&lt;p&gt;We have a channel that has about 700 entries but is paginated with a limit of 30 entries. Our client is looking to add a button so users can print out all entries. One of our proposed solutions was to redirect to a stripped down page (no header, footer, etc.) with all of the filtered entries that automatically engages the browser's print method. The problem is if no filters have been applied, Craft can't handle 700 entries (I've tested a bit and 130 seems to be the limit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should one go about this? Is upping our memory limit (currently 128M) the only way around this? Would it be better to generate a JSON object on channel entry save that we could then load in the print page's template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some additional information. The page is basically just a list of companies. There is a field for the company's name, address, contact name, telephone, email, website, type (category), country (category), and also SEOmatic (which we obviously don't need to display). I haven't actually looked at the tables, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I am getting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 79 bytes) in /Library/WebServer/Documents/site/craft/app/fieldtypes/PlainTextFieldType.php on line 59&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel: Companies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field Layout:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Meta: SEOMatic (don't need to output)&lt;/li&gt;&#xA;&lt;li&gt;Company Name: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Address: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Contact Name: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Email: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Telephone: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Website: Plain Text&lt;/li&gt;&#xA;&lt;li&gt;Company Type: Category (there can be MULTIPLE types, doesn't have any fields associated with it)&lt;/li&gt;&#xA;&lt;li&gt;Company Country: Category (there can only be ONE type, doesn't have any fields associated with it)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Categories:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Company Types&lt;/li&gt;&#xA;&lt;li&gt;Company Countries&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6518" LastEditorUserId="6518" LastEditDate="2017-11-15T18:48:47.360" LastActivityDate="2017-11-17T06:28:14.770" Title="Querying channel entries hits memory limit" Tags="&lt;entries&gt;&lt;json&gt;&lt;channels&gt;&lt;limit&gt;&lt;memory&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22834" PostTypeId="1" AcceptedAnswerId="22836" CreationDate="2017-11-14T21:35:48.870" Score="1" ViewCount="3566" Body="&lt;p&gt;I'm getting incorrect loop.index results with the following code. It returns &quot;1&quot; for each entry returned. Is there a different way this needs to be written?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for order in orders %}&#xA;    {% for refund in order.transactions if refund.type == &quot;refund&quot; %}&#xA;        {{ loop.index  }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="103" LastActivityDate="2017-11-15T20:34:10.057" Title="loop.index is not returning correct number inside nested loop with inline if conditional" Tags="&lt;forloop&gt;&lt;count&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22835" PostTypeId="1" AcceptedAnswerId="22840" CreationDate="2017-11-14T21:40:17.643" Score="1" ViewCount="293" Body="&lt;p&gt;How can I write:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;is segment 3, and is not itemA and is not itemB?&lt;/li&gt;&#xA;&lt;li&gt;both itemA and itemB are segment 3 as well.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{% if craft.app.request.getSegment(3) and craft.request.getSegment(3) !== 'itemA' and craft.request.getSegment(3) !== 'itemB' %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I want to target a category that is segment 3, but I want to omit two other categories that are on the same segment(level):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Topics Category&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subcategory&lt;/li&gt;&#xA;&lt;li&gt;Subcategory&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;itemA(omit)&lt;/li&gt;&#xA;&lt;li&gt;itemB(omit)&lt;/li&gt;&#xA;&lt;li&gt;itemC(yes)&lt;/li&gt;&#xA;&lt;li&gt;itemD(yes)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In code, I want to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(2) == 'Subcategory' %}&#xA;   // do something&#xA;{% elseif craft.app.request.getSegment(3) and craft.request.getSegment(3) !== 'itemA' and craft.request.getSegment(3) !== 'itemB' %}&#xA;   // do other stuff&#xA;{% else %}&#xA;   // do a generic thing&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="57" LastEditDate="2017-11-14T23:49:38.737" LastActivityDate="2017-11-15T01:05:42.673" Title="How to write a segment that is not two other segments" Tags="&lt;request&gt;&lt;segments&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22836" PostTypeId="2" ParentId="22834" CreationDate="2017-11-14T21:47:14.977" Score="3" Body="&lt;p&gt;I'm guessing you want to display the loop index of the outer for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, Twig provides a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/recipes.html#accessing-the-parent-context-in-nested-loops&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;loop.parent&lt;/code&gt;&lt;/a&gt; context.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for order in orders %}&#xA;    {% for refund in order.transactions if refund.type == &quot;refund&quot; %}&#xA;        {{ loop.parent.loop.index  }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're looking to get the total number of times the inner loop gets hit, then something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set loopCount = 0 %}&#xA;&#xA;{% for order in orders %}&#xA;    {% for refund in order.transactions if refund.type == &quot;refund&quot; %}&#xA;        {% set loopCount = loopCount + 1 %}&#xA;        {{ loopCount  }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-11-15T20:34:10.057" LastActivityDate="2017-11-15T20:34:10.057" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22837" PostTypeId="2" ParentId="22833" CreationDate="2017-11-14T22:10:17.077" Score="2" Body="&lt;p&gt;Assuming you're referring to Craft 2, the EntryModels that get returned to a template do have a significant memory overhead attached to them you're probably running into.  Doing the math, even bumping your php.ini &lt;code&gt;memory_limit&lt;/code&gt; up to 256M is only going to get your around 260 results coming back with your given fields/configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's one of the big things we first improved in the upcoming &lt;a href=&quot;https://craftcms.com/3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you've got a couple of options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Paginate the results so you can do them in smaller batches.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;AJAX/lazy load the results over multiple requests in smaller batches.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; (&lt;a href=&quot;https://craftcms.com/docs/plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins&lt;/a&gt;) that bypasses Craft's Element/Model loading and queries the database directly and returns only the data you explicitly need back to the template, without all of the model overheard.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-14T22:10:17.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22838" PostTypeId="2" ParentId="22637" CreationDate="2017-11-14T22:32:30.077" Score="1" Body="&lt;p&gt;If you are using macOS then your cURL is most likely linked against SecureTransport rather than OpenSSL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To verify you can issue the following command: &lt;code&gt;php -i | grep &quot;SSL Version&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If affected, it should return: &lt;code&gt;SSL Version =&amp;gt; SecureTransport&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix the issue you need to recompile cURL and PHP linked with OpenSSL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For PHP 7.1 do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;brew uninstall php71-mcrypt&#xA;brew uninstall --ignore-dependencies --force php71&#xA;brew install --with-openssl curl&#xA;brew install --with-homebrew-curl php71&#xA;brew install php71-mcrypt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replace 71 with 70 if you're using PHP 7.0&lt;/p&gt;&#xA;" OwnerUserId="7254" LastEditorUserId="7254" LastEditDate="2017-11-14T22:57:06.140" LastActivityDate="2017-11-14T22:57:06.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22839" PostTypeId="1" AcceptedAnswerId="22852" CreationDate="2017-11-15T00:46:52.987" Score="1" ViewCount="118" Body="&lt;p&gt;I have a multi-select for users to sign up for newsletters.&#xA;When they edit their profile they need to be able to see which newsletters they are already signed up for. I have the code to output the entire options list or just the ones that they have selected but I haven't figured a way to add the selected attribute to the ones the user has selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsletters = craft.fields.getFieldByHandle('newsletters') %}&#xA;&amp;lt;select multiple&amp;gt;&#xA;    {% for opt in newsletters.settings.options %}&#xA;        &amp;lt;option value=&quot;{{ opt.value }}&quot; &amp;gt;{{ opt.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;for opt in newsletters.settings.options&quot; can be changed to &quot;for opt in newsletters.settings&quot; to show just the ones the user has already selected.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5501" LastEditDate="2017-11-15T16:46:50.770" LastActivityDate="2017-11-15T16:46:50.770" Title="Add Checked Attribute to Custom User Fields on Frontend User Form" Tags="&lt;custom-field&gt;&lt;usermodel&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22840" PostTypeId="2" ParentId="22835" CreationDate="2017-11-15T01:05:42.673" Score="1" Body="&lt;p&gt;I personally try to avoid inlining too many conditionals because I feel like it leaves room for logical loopholes. I also think using variables for segments keeps things easier to read.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seg2 = craft.request.getSegment(2) %}&#xA;{% set seg3 = craft.request.getSegment(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So maybe something like this? The keyword &lt;code&gt;in&lt;/code&gt; is Twig's way of checking &lt;code&gt;in_array()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set badItems = ['itemA', 'itemB'] %}&#xA;&#xA;{% if seg2 == 'Subcategory' %}&#xA;    // do top priority thing&#xA;{% elseif seg3 != '' and seg3 not in badItems %}&#xA;    // do secondary thing&#xA;{% else %}&#xA;    // do overall default thing&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, if you know the finite list of acceptable items beforehand, I think this is more concise.  Since segment 3 could be blank if it's not there, maybe try checking if it &lt;em&gt;is&lt;/em&gt; something instead of if it's &lt;em&gt;not&lt;/em&gt; something.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set goodItems = ['itemC', 'itemD'] %}&#xA;&#xA;{% if seg2 == 'Subcategory' %}&#xA;    // do top priority thing&#xA;{% elseif seg3 in goodItems %}&#xA;    // do secondary thing&#xA;{% else %}&#xA;    // do overall default thing&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-11-15T01:05:42.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22842" PostTypeId="1" CreationDate="2017-11-15T07:14:16.437" Score="1" ViewCount="76" Body="&lt;p&gt;I have the correct image asset source for S3 and also a local folder. Neither folder contents show (they were previously) and I see an &quot;unknown error occurred&quot; popup. I've tried turning off image transforms, increasing my PHP memory limit and simplifying my templates but I haven't had any luck&lt;/p&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="57" LastEditDate="2017-11-15T18:59:40.263" LastActivityDate="2017-11-16T20:30:20.540" Title="Cannot see local or s3 image asset source" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22843" PostTypeId="1" CreationDate="2017-11-15T08:03:52.553" Score="1" ViewCount="38" Body="&lt;p&gt;I have a site that deals exclusively with user generated content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a few years, the users table is getting to a stage where it can probably be pruned of folk who have registered but not actually submitted any content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What query would I run to show the users who have zero posts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought something like &lt;code&gt;select id from craft_users where id not in (select distinct authorId from craft_entries)&lt;/code&gt; would do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;distinct&lt;/code&gt; query certainly returns 1020 rows where we actually have around 1800 users.&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2017-11-15T09:42:29.873" LastActivityDate="2017-11-15T09:53:17.400" Title="Pruning the users table" Tags="&lt;database&gt;&lt;mysql&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22844" PostTypeId="2" ParentId="22833" CreationDate="2017-11-15T08:27:02.180" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Read some pages in the craft docs that Brad linked to get to know the basic structure where to place your files&lt;/li&gt;&#xA;&lt;li&gt;Go to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory&lt;/a&gt; and create a plugin, you only have to check the &quot;Variables&quot; light switch to generate a &lt;code&gt;PluginNameVariables&lt;/code&gt; file&lt;/li&gt;&#xA;&lt;li&gt;Download the files and place them in your &lt;code&gt;craft/app/&amp;gt;&amp;gt;pluginHandle&amp;lt;&amp;lt;&lt;/code&gt; folder like it is stated in the docs&lt;/li&gt;&#xA;&lt;li&gt;Install the plugin&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;copy the following code into your &lt;code&gt;craft/plugins/&amp;gt;&amp;gt;pluginHandle&amp;lt;&amp;lt;/variables/&amp;gt;&amp;gt;pluginHandle&amp;lt;&amp;lt;Variables.php&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @return mixed&#xA; */&#xA;public function getAllEntries(){&#xA;    // I want to create the code with the best possible performance, so I would&#xA;    // like to avoid using $field = craft()-&amp;gt;fields()-&amp;gt;getFieldByHandle();&#xA;    // and instead inserting the id directly, my ids are 13 and 14&#xA;    $countryFieldId = 13;&#xA;    $typeFieldId = 14;&#xA;    // insert your local here&#xA;    $locale = 'de';&#xA;    // insert your section handle, for my test system it is news&#xA;    $sectionHandle = 'news';&#xA;    $dbCommand = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;    // select all your needed fields, I don't want to loop through your field layout since&#xA;    // that would result in multiple queries and I want to have the best possible performance&#xA;    $dbCommand-&amp;gt;select([&#xA;        'country.title as countryTitle',&#xA;        'GROUP_CONCAT(type.title) as typeTitle',&#xA;        // content is your entry&#xA;        'content.title as elementTitle',&#xA;        'content.field_body as elementText'&#xA;    ]);&#xA;    $dbCommand-&amp;gt;from('elements as elements');&#xA;    $dbCommand-&amp;gt;join('elements_i18n as elements_i18n', 'elements_i18n.elementId = elements.id');&#xA;    $dbCommand-&amp;gt;join('content as content', 'content.elementId = elements.id');&#xA;    $dbCommand-&amp;gt;join('entries as entries', 'entries.id = elements.id');&#xA;    $dbCommand-&amp;gt;join('sections as sections', 'sections.id = entries.sectionId');&#xA;    $dbCommand-&amp;gt;leftJoin('structures as structures', 'structures.id = sections.structureId');&#xA;    $dbCommand-&amp;gt;leftJoin('structureelements as structureelements', '(structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)');&#xA;    $dbCommand-&amp;gt;setGroup('elements.id');&#xA;&#xA;    $dbCommand-&amp;gt;andWhere(array(&#xA;        'sections.handle'   =&amp;gt; $sectionHandle,&#xA;        'elements_i18n.locale'  =&amp;gt; $locale,&#xA;        'content.locale'  =&amp;gt; $locale,&#xA;        'elements.enabled'  =&amp;gt; 1,&#xA;        'elements_i18n.enabled'  =&amp;gt; 1,&#xA;        // you can check here for entries.expiryDate and these things here as well&#xA;    ));&#xA;    $dbCommand-&amp;gt;order('postDate DESC');&#xA;    $dbCommand-&amp;gt;setGroup('elements.id');&#xA;&#xA;    $dbCommand-&amp;gt;leftJoin(&quot;relations typeRelation&quot;, &quot;typeRelation.sourceId = elements.id&quot;);&#xA;    $dbCommand-&amp;gt;join(&quot;relations countryRelation&quot;, &quot;countryRelation.sourceId = elements.id&quot;);&#xA;    $dbCommand-&amp;gt;andWhere(array(&#xA;        'countryRelation.fieldId' =&amp;gt; $countryFieldId&#xA;    ));&#xA;    $dbCommand-&amp;gt;andWhere(array(&#xA;        'typeRelation.fieldId' =&amp;gt; $typeFieldId&#xA;    ));&#xA;    $dbCommand-&amp;gt;join(&quot;content as country&quot;, &quot;country.elementId = countryRelation.targetId&quot;);&#xA;    $dbCommand-&amp;gt;join(&quot;content as type&quot;, &quot;type.elementId = typeRelation.targetId&quot;);&#xA;&#xA;&#xA;    $elements = $dbCommand-&amp;gt;queryAll();&#xA;&#xA;    return $elements;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;read the comments, try to follow the code and change the values (change ids, select values, fields and such)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;in order to fetch the entries in your template you need to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.test.getAllEntries() %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;pre&amp;gt;&#xA;        {{ dump(entry) }}&#xA;    &amp;lt;/pre&amp;gt;&#xA;    {% set types = entry.typeTitle|split(',') %}&#xA;    &amp;lt;pre&amp;gt;&#xA;        {{ dump(types) }}&#xA;    &amp;lt;/pre&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;please let me know if you need help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;I made some more tests and noticed you won't fetch any entries with no relations. So please change this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dbCommand-&amp;gt;leftJoin(&quot;relations typeRelation&quot;, &quot;typeRelation.sourceId = elements.id&quot;);&#xA;$dbCommand-&amp;gt;join(&quot;content as type&quot;, &quot;type.elementId = typeRelation.targetId&quot;);&#xA;$dbCommand-&amp;gt;andWhere(array(&#xA;    'typeRelation.fieldId' =&amp;gt; $typeFieldId&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dbCommand-&amp;gt;leftJoin(&quot;relations typeRelation&quot;, &quot;typeRelation.sourceId = elements.id AND (typeRelation.fieldId = $typeFieldId)&quot;);&#xA;// join content where the ids match or where the target is null in order to get entries without relation&#xA;$dbCommand-&amp;gt;leftJoin(&quot;content as type&quot;, &quot;type.elementId = typeRelation.targetId OR typeRelation.targetId = null &quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And of course add your &lt;code&gt;language&lt;/code&gt; param&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-17T06:28:14.770" LastActivityDate="2017-11-17T06:28:14.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22845" PostTypeId="2" ParentId="22842" CreationDate="2017-11-15T09:06:29.010" Score="1" Body="&lt;p&gt;Check your craft.log and phperrors for clues, wild guess is that you're running out of memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is the case you should increase &lt;code&gt;memory_limit&lt;/code&gt; in PHP.&lt;/p&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2017-11-15T09:06:29.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22846" PostTypeId="2" ParentId="22843" CreationDate="2017-11-15T09:53:17.400" Score="1" Body="&lt;p&gt;Looks like this will do the trick&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;select * from craft_users&#xA;left join craft_entries on craft_users.id = craft_entries.authorId&#xA;where craft_entries.authorId is null and craft_users.id &amp;lt;&amp;gt; &quot;1&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16" LastActivityDate="2017-11-15T09:53:17.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22847" PostTypeId="1" AcceptedAnswerId="22848" CreationDate="2017-11-15T13:45:34.193" Score="5" ViewCount="279" Body="&lt;p&gt;I've started with Craft developing all locally. The struggle for me when working locally was synchronizing the database and the backend assets with coworkers on the same project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the last project we tried a different approach, where we have the db, the assets and the CP on a server. So all devs involved in the project had the same backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we still had locally were our templates and frontend stuff. The db.php pointed to the remote db. The basepath pointed to our local root so it would load the local templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm actually pretty happy with that solution the only problem I haven't figured out yet is using image transforms. Since I'm using locale templates (and a locale craft installation for templating ), the transforms tries to generate the images locally which doesn't seem to work. Maybe my configuration is off since I don't have to much experience with transforms and the configuration with this setup can get a little confusing as well :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does your setup look while working in a team?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And any suggestions for the my problem with transform?&lt;/p&gt;&#xA;" OwnerUserId="4603" LastEditorUserId="57" LastEditDate="2017-11-15T19:05:58.050" LastActivityDate="2018-01-19T12:55:33.950" Title="What are the best practices for the development setup?" Tags="&lt;image-transforms&gt;&lt;multi-environment&gt;&lt;best-practice&gt;&lt;setup&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22848" PostTypeId="2" ParentId="22847" CreationDate="2017-11-15T14:06:37.520" Score="6" Body="&lt;p&gt;That's the setup we use here. It's ok, but local development runs slowly because the database is off-site - we'll be moving to an internal database server in the new year because of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image transforms we just deal with by manually syncing the folders every now and then. I believe Andrew Welch has a script to help manage that - I've not tried it &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wish there was a way to tell Craft, in dev mode, that a missing image file is not a &quot;stop everything&quot; error.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2017-11-15T14:06:37.520" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22849" PostTypeId="1" CreationDate="2017-11-15T14:08:02.117" Score="1" ViewCount="304" Body="&lt;p&gt;Is is possible to populate a FreeForm checkbox group by an entries listing? I've got a series of courses with an entry for each one, and I'd like to create a series of checkboxes and values for each course. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of the checkbox gets shown in the email notification but not in the control panel. Is this possible to change? &lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="6614" LastEditDate="2017-11-21T09:38:53.073" LastActivityDate="2017-11-21T09:38:53.073" Title="Freeform check box group from entries" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22850" PostTypeId="2" ParentId="804" CreationDate="2017-11-15T14:58:51.390" Score="4" Body="&lt;p&gt;I ran into this requirement today and initially assumed a plugin would be required, but then I spotted that the native Assets action menu already included a Download File option and it was working just fine with files that weren’t publicly accessible. Maybe we could use that rather than reinventing the wheel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check DownloadFileElementAction.php you can see the markup and JS that’s used for this button in the control panel. It generates a simple &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag that POSTs to &lt;code&gt;assets/downloadAsset&lt;/code&gt;. With a tiny bit of tweaking that can be converted to a code suitable for use in a frontend template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; target=&quot;_blank&quot; action=&quot;&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;assets/downloadAsset&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;assetId&quot; value=&quot;123&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works a treat and includes all native permissions checks as you’d expect. So long as the requesting user has the &lt;code&gt;viewAssetSource&lt;/code&gt; permission for the Asset Source the download will work. If the requesting user is logged out then they are automatically redirected to your &lt;code&gt;loginPath&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only snag I’ve noticed is that Craft does return a JSON formatted error string if your user doesn’t have permission to view the asset. In my case this doesn’t matter, as all authenticated users will have permission to view the files - we’re just trying to prevent guests from seeing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this approach requires POSTs it’s a bit limiting (secured &lt;code&gt;img&lt;/code&gt; tags are a non-starter), but for typical download button use cases it looks fine to me and avoids the need for third party plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is a Craft 2 build, I haven’t tested this with Craft 3)&lt;/p&gt;&#xA;" OwnerUserId="3327" LastActivityDate="2017-11-15T14:58:51.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22851" PostTypeId="2" ParentId="2113" CreationDate="2017-11-15T14:59:27.807" Score="2" Body="&lt;p&gt;I had a problem finding the &lt;code&gt;folderId&lt;/code&gt; as I was using the &lt;code&gt;sourceId&lt;/code&gt; from looking at Asset Sources in the CMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the &lt;code&gt;folderId&lt;/code&gt;, I had to check the database and look in the &lt;code&gt;craft_assetfolders&lt;/code&gt; folder. This will then give you the &lt;code&gt;folderId&lt;/code&gt; for a particular Asset Source.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2017-11-15T14:59:27.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22852" PostTypeId="2" ParentId="22839" CreationDate="2017-11-15T15:26:26.010" Score="3" Body="&lt;p&gt;Solved!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for letter in currentUser.newsletters.options %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ letter.value }}&quot; name=&quot;{{ letter.value }}&quot; id=&quot;{{ letter.value }}&quot;&#xA;        {% if letter.selected == true %}checked=&quot;checked&quot; {% endif %}/&amp;gt;&#xA;    &amp;lt;label for =&quot;{{ letter.value }}&quot;&amp;gt;{{ letter.label }}&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="125" LastEditDate="2017-11-15T15:52:11.353" LastActivityDate="2017-11-15T15:52:11.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22853" PostTypeId="1" AcceptedAnswerId="22866" CreationDate="2017-11-15T16:40:16.700" Score="1" ViewCount="55" Body="&lt;p&gt;I'm using Freeform 1.7.2 and since version 1.6.2 a form anchor is automatically added:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added form anchor to be automatically generated so inline error returns can focus down to form, if it's lower down on page.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yet, the submission still jumps to the top of the page if there is an error. I asked a similar question before, but this was before the name anchor was added. Shouldn't this now work by itself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my super simple code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;formName&quot;, {&#xA;   instructionsBelowField: true,&#xA;   useRequiredAttribute: true,&#xA;}).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2017-11-16T08:28:06.683" LastActivityDate="2017-11-16T16:56:52.267" Title="Error reporting Freeform submission jumps to top of page despite auto form anchor" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22854" PostTypeId="1" CreationDate="2017-11-15T17:13:40.060" Score="1" ViewCount="20" Body="&lt;p&gt;I am running a craft site on craft 2.6.2997 and latest craft commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building a url query that allows the user to add query params to the url with a bit of js. The url structure is as follows as an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?types[]=coffeeAndSide&amp;amp;materials[]=lacquer&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On each click of the tags below it adds/removes the query items to the url and then I use an ajax GET request to pull the data from the page url to show the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One piece of trouble I am having is that in the url above the results should technically show something because there are relations in the &lt;code&gt;coffeeAndSide&lt;/code&gt; types query and it should show regardless of materials having this item in it. My query setup is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set typesQuery = craft.request.getParam('types') %}&#xA;{% set materialQuery = craft.request.getParam('materials') %}&#xA;&#xA;{# Start an array of search parameters (relationParam) with 'and' to match ALL categories #}&#xA;{% set relationParam = ['or','and'] %}&#xA;{% set productTypes = [] %}&#xA;{% set allValues = [] %}&#xA;&#xA;{# Find categories that match the slugs in your query string... #}&#xA;{% for querySlug in materialQuery %}&#xA;  {% set materialCategory = craft.categories.group('materials').slug(querySlug) %}&#xA;&#xA;  {# And merge them into the relationParam array. #}&#xA;  {% set relationParam = relationParam|merge({targetElement: materialCategory}) %}&#xA;  {% set allValues = allValues|merge({targetElement: materialCategory}) %}&#xA;{% endfor %}&#xA;&#xA;&#xA;{% for queryTypeSlug in typesQuery %}&#xA;&#xA;    {% set type = queryTypeSlug %}&#xA;&#xA;    {% set productTypes = productTypes|merge([type]) %}&#xA;    {% set allValues = allValues|merge([type]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% if relationParam|length &amp;lt; 1 %}&#xA;  {% set relationParam = '' %}&#xA;{% endif %}&#xA;&#xA;{% set products = craft.commerce.products({&#xA;  type: productTypes&#xA;}).relatedTo(relationParam) %}&#xA;&#xA;&#xA;{% set queriedProducts = products.find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason it doesn't show anything when really it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can get it to work where both &lt;code&gt;types&lt;/code&gt; and &lt;code&gt;materials&lt;/code&gt; can query on their own and if either of them have a result that should technically show?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Mark&lt;/p&gt;&#xA;" OwnerUserId="5033" LastActivityDate="2017-11-15T17:13:40.060" Title="Can I use relational parameters that query as items on their own?" Tags="&lt;plugin-craftcommerce&gt;&lt;relations&gt;&lt;ecommerce&gt;&lt;query&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22855" PostTypeId="2" ParentId="22774" CreationDate="2017-11-15T18:01:33.050" Score="3" Body="&lt;p&gt;First off, make sure you have .htaccess files in both the en and fr folders and this per the &lt;a href=&quot;https://craftcms.com/docs/localization-guide#step-5-set-up-the-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;localization guide&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, you're missing a comma in the siteUrl array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'http://etf-craft.dev/en/',&#xA;    'fr' =&amp;gt; 'http://etf-craft.dev/fr/' &amp;lt;--------add comma here-----&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12" LastActivityDate="2017-11-15T18:01:33.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22856" PostTypeId="1" CreationDate="2017-11-15T20:33:39.617" Score="1" ViewCount="333" Body="&lt;p&gt;Downloaded latest release, pushed app-new to server, renamed app to app-old, renamed app-new to app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try to go to admin, and I get a 500 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server error log shows.&#xA;2017-11-15 12:29:29 Error   500 GET /admin HTTP/1.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas.&#xA;Trying to update an install that hasn't been updated in a long time.&#xA;Going from 2.6.2911 to 2.6.2974&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can still get to admin if I use the old app by renaming app to app-new, and app-old to app&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2017-11-16T01:00:13.643" Title="Manual Update 500 error" Tags="&lt;config&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22858" PostTypeId="2" ParentId="22822" CreationDate="2017-11-15T22:27:50.587" Score="2" Body="&lt;p&gt;I ended it up fixing the issue by replacing the /craft folder with the original installation folder and then just replacing /craft/templates and /craft/plugins from the existing site.&lt;/p&gt;&#xA;" OwnerUserId="7502" LastActivityDate="2017-11-15T22:27:50.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22859" PostTypeId="2" ParentId="22856" CreationDate="2017-11-16T01:00:13.643" Score="1" Body="&lt;p&gt;Re-downloaded manual update, and pushed to the server via ftp again fixed the issue. Download might have been corrupt is my only thought.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2017-11-16T01:00:13.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22860" PostTypeId="1" AcceptedAnswerId="22897" CreationDate="2017-11-16T01:33:13.277" Score="1" ViewCount="124" Body="&lt;p&gt;How would you go about changing one segment of the current url? I have a select in the footer that you can click on a country name and then it redirects you to the homepage of that country version of the website. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- language: lang-twig --&amp;gt;&#xA;&amp;lt;form action=&quot;&quot; name=&quot;dropdown&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;country-select&quot;  id=&quot;country-select&quot; class=&quot;form-control&quot; onchange=&quot;location = this.value;&quot; autocomplete=&quot;off&quot;&amp;gt;&amp;gt;&#xA;        {% set locales = craft.i18n.getSiteLocaleIds() %}&#xA;        {% set locale = craft.locale %}&#xA;        {% for loc in locales %}&#xA;            {# checking if current loop has active locale #}&#xA;            {% set isHome = (loc == locale) %}&#xA;            {% if isHome %}&#xA;&#xA;                {% if loc == &quot;en&quot; %}&#xA;                    &amp;lt;option value=&quot;/{{ loc | replace({'en': 'eu'}) }}&quot; selected&amp;gt;Europe&amp;lt;/option&amp;gt;   &#xA;&#xA;                    {% set myJs %}&#xA;&#xA;                        var currentCountryLocale = &quot;Europe&quot;;&#xA;                        var currentCountryLocale = &quot;{{ loc | replace({'en': 'eu'}) | trim('_') }}&quot;;&#xA;&#xA;                    {% endset %}&#xA;&#xA;                    {% includeJs myJs %}&#xA;&#xA;                {% else %}&#xA;                    {% set subTags = locale|split('_') %}&#xA;                    {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;                        &amp;lt;option value=&quot;/{{ loc | replace({'en': ''}) | trim('_') }}&quot; selected&amp;gt;{% if territory %}{{ territory }}{% endif %}&amp;lt;/option&amp;gt;  &#xA;&#xA;                    {% set myJs %}&#xA;&#xA;                        var currentCountryName = &quot;{{ territory }}&quot;;&#xA;                        var currentCountryLocale = &quot;{{ loc | replace({'en': ''}) | trim('_') }}&quot;;&#xA;&#xA;&#xA;                    {% endset %}&#xA;&#xA;                    {% includeJs myJs %}&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% else %}&#xA;&#xA;                {% if loc == &quot;en&quot; %}&#xA;                    &amp;lt;option value=&quot;/{{ loc | replace({'en': 'eu'}) }}&quot;&amp;gt;EU&amp;lt;/option&amp;gt;   &#xA;                {% else %}&#xA;                    &amp;lt;option value=&quot;/{{ loc | replace({'en': ''}) | trim('_') }}&quot;&amp;gt;{{ loc | replace({'en': ''}) | trim('_') | upper }} &amp;lt;/option&amp;gt;   &#xA;                {% endif %}&#xA;&#xA;            {% endif %}&#xA;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have been trying to figure out how to switch only the country/region part of the url, which is segment(2), but all of my experiments so far have been extremely complicated and confusing and I haven't found a good solution yet. Am I missing something? There must be a more efficient way to accomplish this, as it's probably not a good idea to wrap conditionals inside of conditionals inside of more conditionals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have the added complexity of needing to include a continent (Europe) as one of the versions of the website, for which I'm using the &quot;en&quot; locale, as you can see in the bit of code above.&lt;/p&gt;&#xA;" OwnerUserId="5644" LastEditorUserId="5644" LastEditDate="2017-11-19T20:43:17.670" LastActivityDate="2017-11-19T20:43:17.670" Title="Is it possible to change one segment of the current url and keep the rest of it the same in a cleaner way?" Tags="&lt;localization&gt;&lt;multi-environment&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22861" PostTypeId="1" AcceptedAnswerId="22862" CreationDate="2017-11-16T02:35:38.047" Score="1" ViewCount="379" Body="&lt;p&gt;I am hoping to create a React Site that uses Craft CMS and the Element API as a backend.  However, I know I will need to authenticate users and be posting data back into Craft which I believe the Element API doesn't support.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping someone might be able to talk me through if authenticating users is possible using a plugin and craft session service and if so what would be the general strategy given that this would be (at least in development) across two origins.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;stage.project.com // craft cms w/ element api&lt;/li&gt;&#xA;&lt;li&gt;localhost:3000 // react development&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I haven't found any plugins out there that do just this, but it seems like it would be possible with a craft plugin.  Just wanted to confirm that this is possible and get a sense of how before investing the time.&lt;/p&gt;&#xA;" OwnerUserId="4320" LastActivityDate="2017-11-16T19:42:54.540" Title="Craft CMS Backing React FE using the element API" Tags="&lt;craft-pro&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22862" PostTypeId="2" ParentId="22861" CreationDate="2017-11-16T04:56:24.533" Score="3" Body="&lt;p&gt;I created a react native app with Craft CMS (still version 2.6) as backend using the Element API. But you're right, user authentication is not supported by the Element API. However, I created my own plugin to get user authenticated. I even create user and update their details through the app. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But storing user sessions in React Native is another story. That has nothing to do with Craft or any other CMS system cause you can't get server session to React Native. You need to write your own session handler. I remember a good blog post about that topic: &lt;a href=&quot;https://auth0.com/blog/adding-authentication-to-react-native-using-jwt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://auth0.com/blog/adding-authentication-to-react-native-using-jwt/&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There also might be other solutions because this could be a little bit overkill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps you as a first start.&lt;/p&gt;&#xA;" OwnerUserId="7527" LastEditorUserId="3951" LastEditDate="2017-11-16T19:42:54.540" LastActivityDate="2017-11-16T19:42:54.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22863" PostTypeId="1" CreationDate="2017-11-16T15:24:12.857" Score="0" ViewCount="63" Body="&lt;p&gt;I have created a page for our website, but I do not know how to add it as a tab on the home page. How do I do that? &lt;/p&gt;&#xA;" OwnerUserId="7529" LastEditorUserId="3951" LastEditDate="2017-11-16T18:06:55.783" LastActivityDate="2017-11-16T19:59:15.157" Title="How do I add a tab to my home page" Tags="&lt;templating&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22864" PostTypeId="1" AcceptedAnswerId="22966" CreationDate="2017-11-16T16:21:29.263" Score="1" ViewCount="413" Body="&lt;p&gt;I've migrated my client's Craft site to a new host. On the front end the site is fine and working as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with the Craft admin area. I can login, but once logged I can’t access anything other than the main dashboard screen. Clicking any of the links within the dashboard brings up the login screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I did try was to remove the &lt;code&gt;cpTrigger&lt;/code&gt; I’d set in /craft/config/general.php. For a moment I thought this had worked. I could access other areas of the dashboard, but then the dashboard logged me out after a minute or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve seen a few other posters with similar issues and have tried solutions that worked for them…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve delete the contents of &lt;code&gt;craft/storage/runtime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve checked the file permissions of &lt;code&gt;craft/storage/runtime&lt;/code&gt;. They are currently set to 774.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried adding the following to craft/config/general.php:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'overridePhpSessionLocation' =&amp;gt; false&lt;/code&gt;&#xA;As described here - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area/6876#6876&quot;&gt;Craft constantly logging out from admin area&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and also:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'overridePhpSessionLocation' =&amp;gt; true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As described here - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9628/migrated-server-now-getting-logged-out-constantly&quot;&gt;Migrated Server, Now Getting Logged Out Constantly&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried &lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false&lt;/code&gt; too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing has worked so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I could try?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand this is likely to be related to permissions for where session files are stored. Are there any questions I should be asking the the hosting company in relation to this? The site is on a shared hosting account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or advice with this much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* An update... *&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at &lt;code&gt;/admin/utils/phpinfo&lt;/code&gt; in the dashboard to check where &lt;code&gt;session.save_path&lt;/code&gt; is pointing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default it's set to &lt;code&gt;/tmp&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add &lt;code&gt;'overridePhpSessionLocation' =&amp;gt; true&lt;/code&gt; to &lt;code&gt;craft/config/general.php&lt;/code&gt;, the session location is set to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/vhtdocs/xxxxxxxx/craft/storage/runtime/sessions/&#xA;/tmp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That looks a bit odd to me? There are two paths – the craft path and the default session path below it. Is that correct?&lt;/p&gt;&#xA;" OwnerUserId="7513" LastEditorUserId="7513" LastEditDate="2017-11-21T15:51:52.810" LastActivityDate="2017-11-27T12:03:39.767" Title="Migrated site - now dashboard keeps logging out" Tags="&lt;admin&gt;&lt;login&gt;&lt;migration&gt;&lt;session&gt;&lt;dashboard&gt;" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22865" PostTypeId="2" ParentId="22864" CreationDate="2017-11-16T16:55:05.037" Score="1" Body="&lt;p&gt;Just a question; are you on a Nginx server?&#xA;I had a similar issue before with a client site. the Nginx configuration was removing the cookies when it cached the page, which redirected to the login page after logging in.&lt;/p&gt;&#xA;" OwnerUserId="7530" LastEditorUserId="7530" LastEditDate="2017-11-16T17:01:59.593" LastActivityDate="2017-11-16T17:01:59.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22866" PostTypeId="2" ParentId="22853" CreationDate="2017-11-16T16:56:52.267" Score="2" Body="&lt;p&gt;We've recently discovered that this feature is not always reliable unfortunately. However, we're working on addressing this and coming up with a better solution in the coming weeks. Sorry for any inconvenience.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-11-16T16:56:52.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22867" PostTypeId="2" ParentId="22863" CreationDate="2017-11-16T19:59:15.157" Score="1" Body="&lt;p&gt;The front-end of a Craft site is 100% custom and leaves you with complete control over the HTML, CSS, JS and images that are generated, so there's really no way for us to give you step-by-step instructions on how to make specific changes to the front of your site&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, you can modify the HTML and content of your site from the &lt;code&gt;craft/templates&lt;/code&gt; folder on your server.  Any CSS/JavaScript/images on your site will likely live in your public HTML folder on your server. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-16T19:59:15.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22868" PostTypeId="2" ParentId="22842" CreationDate="2017-11-16T20:30:20.540" Score="2" Body="&lt;p&gt;For anyone else experiencing this issue, there wasn't actually any error shown in the Craft log file. Craft was trying to index the S3 access log files on the bucket and treating them as image files. Reindexing images didn't solve the issue either but I got my images back by deleting all entries from the craft_assetfiles table for files have the dateModified field set to NULL (these were not image files but Craft had added them to the table). [Solved by Craft Support]&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2017-11-16T20:30:20.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22869" PostTypeId="1" AcceptedAnswerId="22870" CreationDate="2017-11-16T21:02:54.700" Score="1" ViewCount="250" Body="&lt;p&gt;I’m having trouble getting Contact Form to work when posting through AJAX. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;div id=&quot;my-form&quot; class=&quot;form&quot;&amp;gt;&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;contact/thanks&quot;&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;grid-container&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;medium-6 cell&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div class=&quot;medium-12 cell&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;                &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div id=&quot;thanks&quot; style=&quot;opacity:0&quot;&amp;gt;THANKS&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#my-form').submit(function(ev) {&#xA;    // Prevent the form from actually submitting&#xA;    ev.preventDefault();&#xA;&#xA;    // Get the post data&#xA;    var data = $(this).serialize();&#xA;&#xA;    // Send it to the server&#xA;    $.post('/', data, function(response) {&#xA;        if (response.success) {&#xA;            $('#thanks').fadeIn();&#xA;        } else {&#xA;            // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;            // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;            alert('An error occurred. Please try again.');&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case the response is not a success so the alert is triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of interest I console logged the response in the else block and it’s all the HTML on the page. And then I thought, why don’t I console log the data variable right after it’s declared and - same thing - it’s all the HTML on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody got any tips?&lt;/p&gt;&#xA;" OwnerUserId="6170" LastActivityDate="2017-11-16T21:53:43.563" Title="Trouble with submitting Contact Form plugin contact via AJAX" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22870" PostTypeId="2" ParentId="22869" CreationDate="2017-11-16T21:53:43.563" Score="1" Body="&lt;p&gt;This is your html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;my-form&quot; class=&quot;form&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And This is your js event handler&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#my-form').submit(function(ev) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;$(this)&lt;/code&gt; is actually a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; container element and &lt;code&gt;$(this).serialize()&lt;/code&gt; is null so you'll send no data. You should add a id to your form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; id=&quot;myForm&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and send the form data instead of a div data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = $(&quot;#myForm&quot;).serialize();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I reproduced it, and it worked - even though I would prefer sending an actual object instead of a serialized form, but that's only subjective &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-16T21:53:43.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22871" PostTypeId="1" AcceptedAnswerId="22886" CreationDate="2017-11-16T23:03:53.000" Score="2" ViewCount="2447" Body="&lt;p&gt;Who knows how to loop through all sites in multisite installation? I want to create kind of drop down menu to switch between websites.&#xA;I've found this code inside the backend template but looks like it doesn't works in frontend&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for site in allSites %}&#xA;            &amp;lt;tr data-id=&quot;{{ site.id }}&quot; data-name=&quot;{{ site.name|t('site') }}&quot;&amp;gt;&#xA;                &amp;lt;th scope=&quot;row&quot; data-title=&quot;{{ 'Name'|t('app') }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ url('settings/sites/' ~ site.id) }}&quot;&amp;gt;{{ site.name|t('site') }}&amp;lt;/a&amp;gt;&amp;lt;/th&amp;gt;&#xA;                &amp;lt;td data-title=&quot;{{ 'Handle'|t('app') }}&quot;&amp;gt;&amp;lt;code&amp;gt;{{ site.handle }}&amp;lt;/code&amp;gt;&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td data-title=&quot;{{ 'Language'|t('app') }}&quot;&amp;gt;&amp;lt;code&amp;gt;{{ site.language }}&amp;lt;/code&amp;gt;&amp;lt;/td&amp;gt;&#xA;                &amp;lt;td data-title=&quot;{{ 'Base URL'|t('app') }}&quot;&amp;gt;&amp;lt;code&amp;gt;{{ site.baseUrl }}&amp;lt;/code&amp;gt;&amp;lt;/td&amp;gt;&#xA;                {% if multiple %}&#xA;                    &amp;lt;td class=&quot;thin&quot;&amp;gt;&amp;lt;a class=&quot;move icon&quot; title=&quot;{{ 'Reorder'|t('app') }}&quot; role=&quot;button&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;                    &amp;lt;td class=&quot;thin&quot;&amp;gt;&amp;lt;a class=&quot;delete icon&quot; title=&quot;{{ 'Delete'|t('app') }}&quot; role=&quot;button&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;                {% endif %}&#xA;            &amp;lt;/tr&amp;gt;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPD:&#xA;Now I can fetch names of websites by their Ids:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% set allSitesIds = craft.app.sites.getAllSiteIds() %}&#xA;  {% for site in allSitesIds %}&#xA;  {% set siteName = craft.app.sites.getSiteById(site) %}&#xA;  {{siteName}}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5587" LastEditorUserId="5587" LastEditDate="2017-11-17T19:00:37.267" LastActivityDate="2017-11-17T19:00:37.267" Title="Loop through all sites in multisite installation" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22872" PostTypeId="1" CreationDate="2017-11-16T23:34:12.773" Score="4" ViewCount="2972" Body="&lt;p&gt;Before I get tagged as a duplicate I have already tried everything in the 'duplicate' issues on here to no avail so I'm posting my exact config to see what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my plugin code and my controller code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// My plugin and init funciton&#xA;use belniakmedia\sitedominjector\controllers\DefaultController;&#xA;class SiteDomInjector extends Plugin&#xA;{&#xA;    /**&#xA;     * @var SiteDomInjector&#xA;     */&#xA;    public static $plugin;&#xA;&#xA;    /** @var array */&#xA;    public $controllerMap = [&#xA;        'default' =&amp;gt; DefaultController::class,&#xA;    ];&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;        // Register our site routes&#xA;        Event::on(&#xA;            UrlManager::class,&#xA;            UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;            function (RegisterUrlRulesEvent $event) {&#xA;                $event-&amp;gt;rules['echo'] = 'site-dom-injector/default/index';&#xA;            }&#xA;        );&#xA;    }&#xA;}&#xA;&#xA;// My Controller&#xA;class DefaultController extends Controller&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionIndex()&#xA;    {&#xA;        $result = 'Welcome to the DefaultController actionIndex() method';&#xA;        return $result;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I really don't know if that controller map is necessary or not but one of the posts on here said they got it to work setting that up, so thats what I did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a photo of my plugin's file structure for continuity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1M1bV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1M1bV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I really have no idea why this isnt working but no matter what I do, when I try to browse to &lt;a href=&quot;http://site.local/echo&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.local/echo&lt;/a&gt; I get a 404 not found and the trace seems like its not even attempting to load the controller and is just looking for a matching template file... :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-11-17T16:22:53.473" Title="How to route to a controller action in Craft3?" Tags="&lt;plugin-development&gt;&lt;routing&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22873" PostTypeId="2" ParentId="22871" CreationDate="2017-11-17T02:27:07.690" Score="4" Body="&lt;p&gt;Nikolay,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I responded in the slack, I will respond here in case anyone else has this question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template you can access this information like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SiteUrl: {{ siteUrl }}&#xA;Langauge: {{ craft.app.language }}&#xA;Handle: {{ craft.app.sites.currentSite.handle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely positive how to loop the sites in the template but you can get a sites object in PHP by running the following in a controller somewhere or in the &lt;code&gt;init()&lt;/code&gt; method of any plugin that is installed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sites = Craft::$app-&amp;gt;getSites();&#xA;var_dump($sites);&#xA;exit;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will output the structure of the sites object. Baring this you can look through the craft source / docs to find the details on the site object that returns. There should be a method for getting sites by id or by handle; &lt;code&gt;$sites-&amp;gt;getSitesByID()&lt;/code&gt; or &lt;code&gt;$sites-&amp;gt;getSitesByHandle()&lt;/code&gt; but I have not double checked this so you'll have to try it or look it up. If there is not a method then it should be accessible via an array property like &lt;code&gt;$sites-&amp;gt;sitesByHandle&lt;/code&gt; or &lt;code&gt;$sites-&amp;gt;byHandle&lt;/code&gt;. Again you'll have to double check on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, that functionality should translate to the template version of the sites object &lt;code&gt;craft.app.sites&lt;/code&gt; so you should be able to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.getSitesByHandle() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or something like that anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you figure it out feel free to update this to reflect the proper methods / properties :)&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-11-17T02:27:07.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22874" PostTypeId="2" ParentId="22864" CreationDate="2017-11-17T02:39:12.897" Score="1" Body="&lt;p&gt;I'm not sure if 774 would be enough permissions on that folder. If the web server is not running as the account user (via ruid or suexec/suphp), or is not in the same group as the account user then it will not be able to write to it. Just throwing it out there.&lt;/p&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-11-17T02:39:12.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22875" PostTypeId="1" CreationDate="2017-11-17T03:14:12.023" Score="1" ViewCount="86" Body="&lt;p&gt;I'm using Sprout SEO on my site, and for some reason not all pages have a canonical url tag. Many pages have a canonical tag (the home page has one, for example), but a large number of pages are missing the canonical tag (many of my blog post pages, as an example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may be missing something, but I can't figure out how to get Sprout SEO to output a canonical tag for all pages. I tried adding:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({&#xA;  canonical:  craft.request.url &#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this resulted in the same behavior - some pages had canonical tags while others didn't. I just need all my pages to output a canonical tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help!&lt;/p&gt;&#xA;" OwnerUserId="7531" LastActivityDate="2017-11-17T03:14:12.023" Title="Sprout SEO - Not all pages have a canonical tag" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22876" PostTypeId="1" AcceptedAnswerId="22877" CreationDate="2017-11-17T04:33:40.540" Score="1" ViewCount="851" Body="&lt;p&gt;I need to get a product variant as an object in Twig, as well as get its parents details (the product fields, not just the variant fields). My first guess starts with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variant = craft.commerce.products.sku('my-sku-number') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work. I've also tried adding a the &lt;code&gt;.first()&lt;/code&gt; limiter to the end. What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts... should I be trying a search/find?&lt;/p&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2017-11-17T04:50:37.257" Title="How to get a product variant by SKU and get parent product details as well?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22877" PostTypeId="2" ParentId="22876" CreationDate="2017-11-17T04:50:37.257" Score="2" Body="&lt;p&gt;Untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;  hasVariant: {sku: 'my-sku-number'}&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/craft-commerce-products#hasvariant&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to search the default variant of the product:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({defaultSku : 'my-sku-number'}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://craftcommerce.com/docs/craft-commerce-products#defaultsku&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/craft-commerce-products#defaultsku&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-11-17T04:50:37.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22878" PostTypeId="2" ParentId="22871" CreationDate="2017-11-17T05:35:23.513" Score="1" Body="&lt;p&gt;I created a script in order to save different credentials for each site in my google analytics plugin.&#xA;So I had to render a dropdown to chose the site as well. Here is my code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the Plugin variable. You could actually remove the most and just return the &lt;code&gt;sites&lt;/code&gt; variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSites(){&#xA;    $response = [];&#xA;    $sites = Craft::$app-&amp;gt;sites-&amp;gt;getAllSites();&#xA;    // I had some permission checks here as well to see if the user &#xA;    // has access to the site, but I removed that in this example&#xA;    foreach($sites as $site){&#xA;        $response[] = array(&#xA;            &quot;label&quot; =&amp;gt; $site-&amp;gt;name,&#xA;            &quot;value&quot; =&amp;gt; $site-&amp;gt;id&#xA;        );&#xA;    }&#xA;    return $response;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is my template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.googleanalytics.getSites() %}&#xA;{% set siteId = entry.lnkSiteId? entry.lnkSiteId : sites[0][&quot;value&quot;] %}&#xA;{{ forms.selectField({&#xA;    label:          'Seite'|t,&#xA;    id:             'lnkSiteId',&#xA;    name:           'lnkSiteId',&#xA;    instructions:   'Bitte wählen Sie die Seite'|t,&#xA;    value:          siteId,&#xA;    options:        sites&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-17T05:48:53.803" LastActivityDate="2017-11-17T05:48:53.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22882" PostTypeId="2" ParentId="19936" CreationDate="2017-11-17T13:50:52.927" Score="1" Body="&lt;p&gt;I've made a plugin to do this now and it has stock checks to display messages if the quantity has been adjusted due to availability of a variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/a-digital/repeatorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/a-digital/repeatorder&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-11-17T13:50:52.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22883" PostTypeId="1" AcceptedAnswerId="22885" CreationDate="2017-11-17T15:52:56.067" Score="1" ViewCount="64" Body="&lt;p&gt;I'm trying to get the drafts for the entry on the front end to populate my plugin on the sidebar but cannot get the drafts returned with this code in a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry&lt;/code&gt; is an &lt;code&gt;EntryModel&lt;/code&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The entry ID is {{entry.id}} &#xA;&#xA;&#xA;{% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}&#xA;&#xA;{{ dump(drafts) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;drafts is an array of 0 elements&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even trying it in a PHP plugin class and hard-coding the entry ID like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$drafts = craft()-&amp;gt;entryRevisions-&amp;gt;getDraftsByEntryId(995);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$drafts&lt;/code&gt; is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everywhere I've looked says to do like the above; however, this doesn't return any drafts that belong to the entry as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the dropdown by the entry name, it has the 2 Drafts' names and when clicking them it takes me to the draft, so it seems like the drafts are correctly mapped to this entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="6978" LastEditorUserId="6978" LastEditDate="2017-11-17T16:04:35.040" LastActivityDate="2017-11-17T17:57:26.917" Title="craft.entryRevisions.getDraftsByEntryId(entry.id) is returning an empty array" Tags="&lt;control-panel&gt;&lt;entry&gt;&lt;frontend&gt;&lt;draft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22884" PostTypeId="2" ParentId="22872" CreationDate="2017-11-17T16:22:53.473" Score="3" Body="&lt;p&gt;The problem ended up being something underlying in craft or yii2 that will not route the word &quot;echo&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed out &quot;echo&quot; to &quot;test&quot; and it works fine. Even with both routes in, one does not and one does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Register our site routes&#xA;    Event::on(&#xA;        UrlManager::class,&#xA;        UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;        function (RegisterUrlRulesEvent $event) {&#xA;            $event-&amp;gt;rules['echo'] = 'site-dom-injector/default/index';&#xA;            $event-&amp;gt;rules['test'] = 'site-dom-injector/default/index';&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6309" LastActivityDate="2017-11-17T16:22:53.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22885" PostTypeId="2" ParentId="22883" CreationDate="2017-11-17T17:57:26.917" Score="1" Body="&lt;p&gt;Specify the locale when getting the drafts, or else it will fetch drafts for the default locale. In my case, there was only drafts for a particular locale but not the default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id, 'localeId') %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6978" LastActivityDate="2017-11-17T17:57:26.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22886" PostTypeId="2" ParentId="22871" CreationDate="2017-11-17T18:55:46.913" Score="4" Body="&lt;p&gt;If you want to do this purely from a template, then something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.getAllSites() %}&#xA;&#xA;{% for site in sites %}&#xA;    &amp;lt;li&amp;gt;{{ site.name }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, &lt;code&gt;craft.app&lt;/code&gt; in a template basically gives you access to everything in the &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;services&lt;/code&gt;&lt;/a&gt; namespace.  Adding &lt;code&gt;craft.app.sites&lt;/code&gt; opens up all of the methods in &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/services/Sites.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;services/Sites.php&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-17T18:55:46.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22887" PostTypeId="2" ParentId="20013" CreationDate="2017-11-18T07:31:57.643" Score="0" Body="&lt;p&gt;Incoming hack!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, So I had to solve this problem just now under a super deadline, and Brad's suggested sort field on a product was not a viable solution for the deadline. Here is how I implemented having a product detail page where a &quot;Next Product&quot; and &quot;Previous Product&quot; link works, based on products that have a Category field with a common selected category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works based on the &lt;code&gt;postDate&lt;/code&gt; of the products that have the common category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# The product object is the product I'm viewing in this template #}&#xA;&#xA;{# Make sure you have a category element to sort products on first,&#xA;   this is how I'm getting mine for this solution: #}&#xA;&#xA;{% set category = craft.categories.slug(craft.request.getSegment(2)).first() %}&#xA;&#xA;{# Next, let's take the currently viewed product's &#xA;   post date, subtract a minute, and then get the next previous&#xA;   product that lives in the relatedTo sort #}&#xA;&#xA;{% set timeLimit = product.postDate|date_modify('-1 min') %}&#xA;{% set prevProduct = craft.commerce.products.relatedTo(category).postDate(&quot;&amp;lt;=&quot; ~ timeLimit|date('c')).first() %}&#xA;&#xA;{# Awesome! We have the previous product with the relatedTo category &#xA;   with the closest oldest postDate #}&#xA;&#xA;{% if prevProduct is null %}&#xA;    No previous&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;{{ siteUrl }}store/{{ category.slug }}/{{ prevProduct.slug }}&quot;&amp;gt;{{ prevProduct.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&#xA;{# Now we do the exact opposite to get the next product #}&#xA;&#xA;{% set timeLimit = product.postDate|date_modify('+1 min') %}&#xA;{% set nextProduct = craft.commerce.products.relatedTo(category).postDate(&quot;&amp;gt;=&quot; ~ timeLimit|date('c')).first() %}&#xA;&#xA;{% if nextProduct is null %}&#xA;    No next&#xA;{% else %}&#xA;    &amp;lt;a href=&quot;{{ siteUrl }}store/{{ category.slug }}/{{ nextProduct.slug }}&quot;&amp;gt;{{ nextProduct.title }}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For my solution, I will be replacing the &quot;No next&quot; and &quot;No previous&quot; with a link to the oldest &lt;code&gt;postDate&lt;/code&gt; and newest &lt;code&gt;postDate&lt;/code&gt; products with these queries, creating a loop.&lt;/p&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2017-11-18T07:31:57.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22888" PostTypeId="1" AcceptedAnswerId="22889" CreationDate="2017-11-18T13:46:30.677" Score="0" ViewCount="123" Body="&lt;p&gt;If anyone visits &lt;a href=&quot;http://site.com/commerce/customer/order&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.com/commerce/customer/order&lt;/a&gt; they see the last order made even if they are not logged in and not related to that order in any way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The customer can see their order info if they use &lt;a href=&quot;http://site.com/commerce/customer/order?randomcustomerorderstringforthatspecificorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.com/commerce/customer/order?randomcustomerorderstringforthatspecificorder&lt;/a&gt;. Stripping the ? and the random string after it shows the last order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the standard template to display order information. They are redirected to this page after they complete a transaction. Relevant code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layout' %}&#xA;{% set number = craft.request.param('number') %}&#xA;{% set order = craft.commerce.orders.number(number).first() %}&#xA;{% if not order %}&#xA;    {% redirect 'commerce/customer' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it does not seem to be redirecting to commerce/customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2017-11-18T22:19:06.780" Title="Customer details revealed at base order URL" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22889" PostTypeId="2" ParentId="22888" CreationDate="2017-11-18T22:19:06.780" Score="1" Body="&lt;p&gt;As a rule in Commerce, when retrieving orders on client side templates, you should limit the retrieved orders to orders for the current customer only, using the &lt;code&gt;customer&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set number = craft.request.param('number') %}&#xA;{% set order = craft.commerce.orders.number(number).customer(craft.commerce.customer).first() %}&#xA;{% if not order %}&#xA;    {% redirect 'login' %}  {# or wherever #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(...if the included example templates aren't doing that, you should let Luke know.  I haven't looked at them in ages and don't have them to hand here...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(One slightly random side thing I have noted with time is that you should really limit loading of the order complete page to a single time, i.e. only specifically at the actual order completion - if you don't, you tend to get issues with re-submissions of orders to your analytics and so forth.  E.g. if the customer completes an order, goes somewhere on the site, then comes back to the complete page using the back button - it can create issues - so I remove the number parameter from the url using some JS and make sure I check for a number in the url in the &lt;code&gt;cart/complete&lt;/code&gt; template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Show empty cart if they somehow get back here without a number.... #}&#xA;{% set number = craft.request.param('number') %}&#xA;{% if not number %}&#xA;    {% redirect 'cart' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the JS would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;if(window.location.pathname == &quot;cart/complete&quot;){&#xA;    var cleanedUrl = utilities.removeURLParameter(window.location.href, &quot;number&quot;);&#xA;    window.history.pushState('',document.title,cleanedUrl);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-18T22:19:06.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22890" PostTypeId="2" ParentId="19936" CreationDate="2017-11-18T22:36:46.137" Score="1" Body="&lt;p&gt;Another approach here is to use MultiAdd (&lt;a href=&quot;https://github.com/verbb/multi-add&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/multi-add&lt;/a&gt;) to build a repeat order form rather than just a button to repeat the whole order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depends entirely on what you want, but this can be a bit more flexible as it allows them to repeat the same items but potentially change quantities or notes etc., and means you can display stock issue messages and so on &lt;em&gt;before&lt;/em&gt; they get to the cart screen, which is perhaps handier for the customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy to do - just loop through the old order as your're building your MultiAdd form and give each item a unique index, check for stock and display appropriate warnings at that point, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You can also use MultiAdd to create the one button approach of course, just using hidden fields instead of inputs, and that might be handy if you happen to be using MultiAdd anyway and want to keep your plugin numbers down, and/or want those stock messages on show before they go through the add to cart process).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-18T22:36:46.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22891" PostTypeId="1" AcceptedAnswerId="22892" CreationDate="2017-11-19T00:56:12.567" Score="2" ViewCount="3093" Body="&lt;p&gt;This is a pretty simple test before I implement some larger functionality. Eventually this will be just a glorified upload form via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part 1 - Ajax post&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    type: 'POST',        &#xA;    url: '/upload2',&#xA;    dataType: &quot;json&quot;,&#xA;    data: JSON.stringify({&quot;abc&quot;: &quot;123&quot;, csrfTokenName: csrfTokenValue}),    &#xA;    success: function(data, textStatus){&#xA;        alert('form submitted successfully');            &#xA;        alert('data'+data);&#xA;    },&#xA;    error: function (data, ErrorText, thrownError) {&#xA;        console.log(&quot;Failed to process request correctly, please try again&quot;);&#xA;        console.log(data);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part 2 - Plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin is installed. Inside my plugin init I've got a site rule setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$event-&amp;gt;rules['upload2'] = 'plugin/default/upload';&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can visit this url in the browser without issue. Here's my function I'm trying to access:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpload()&#xA;{        &#xA;    $response_array['status'] = 'success';  &#xA;    $response_array['post'] = $_POST;&#xA;    return json_encode($response_array);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try and run said code via ajax, console returns &lt;strong&gt;Bad Request: Unable to verify your data submission.&lt;/strong&gt; and a &lt;strong&gt;400 (Bad Request)&lt;/strong&gt; error to boot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could easily be one of those doh! moments but so far I'm losing this war. Should I just quit the internet and go live in the woods? (kidding)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea what I'm doing wrong here? Are ajax posts different in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="67" LastActivityDate="2018-12-04T15:16:11.190" Title="Craft 3 - ajax request to plugin" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;craft3&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22892" PostTypeId="2" ParentId="22891" CreationDate="2017-11-19T01:05:29.847" Score="5" Body="&lt;p&gt;95% of the time you see a 400 Bad Request error, it's because it's a CSRF token validation error (or you're just missing the token all-together).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 has CSRF validation enabled by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to pass the CSRF token to your JS in Craft 2: &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the CSRF token changes in Craft 3 you'll need to change: &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-06-13T19:12:50.203" LastActivityDate="2018-06-13T19:12:50.203" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="22893" PostTypeId="2" ParentId="21291" CreationDate="2017-11-19T07:04:59.163" Score="1" Body="&lt;p&gt;I built a website very similar to what you're describing using ExpressionEngine years ago. It's definitely doable in Craft, and it'd be much easier than most other platforms I can think of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as Brad noted in his reply, it will take some development effort.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-19T07:04:59.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22894" PostTypeId="2" ParentId="22864" CreationDate="2017-11-19T07:12:19.897" Score="1" Body="&lt;p&gt;Sounds to me like a server config issue. The site worked in one place, you moved it, and now you have this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's an Nginx server, this may be helpful: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-19T07:12:19.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22895" PostTypeId="2" ParentId="22847" CreationDate="2017-11-19T09:50:04.250" Score="4" Body="&lt;p&gt;Matt Wilcox alluded to it in his original comment, but something like Craft-Scripts will really help out with this workflow. You can read more here: &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-19T09:50:04.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22896" PostTypeId="1" CreationDate="2017-11-19T14:33:12.807" Score="1" ViewCount="158" Body="&lt;p&gt;I'm trying to use the Solspace Freeform plugin for Craft CMS to create an email form. My form needs to have dynamic recipients, but I have a channel in the system that has the email addresses I need in it already.I'm not sure how to set up the template to use those email addresses in the dropdown field since the dynamic recipients field isn't supposed to have the actual email addresses in it. I've looked at the docs, but I'm not clear on how to set this up. Can anyone help me sort this out?&lt;/p&gt;&#xA;" OwnerUserId="2265" LastEditorUserId="57" LastEditDate="2017-11-19T17:11:22.697" LastActivityDate="2017-11-19T17:11:22.697" Title="How Do I Use Channel Entry Data to Create a Dynamic Recipient List in Freeform?" Tags="&lt;emails&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22897" PostTypeId="2" ParentId="22860" CreationDate="2017-11-19T20:42:48.677" Score="1" Body="&lt;p&gt;So!!!! I was getting confused about the various craft properties pertaining to urls, and I thought that even if I grab the path, that it would include the region segment, but surprise! {{ craft.request.path }} grabs the remaining portion of the url, after the region segment! So, I can use code that I've written above and I only need to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- language: lang-twig --&amp;gt;&#xA;&#xA;    /{{ craft.request.path }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- language: lang-twig --&amp;gt;&#xA;&#xA;    &amp;lt;form action=&quot;&quot; name=&quot;dropdown&quot;&amp;gt;&#xA;        &amp;lt;select name=&quot;country-select&quot;  id=&quot;country-select&quot; class=&quot;form-control&quot; onchange=&quot;location = this.value;&quot; autocomplete=&quot;off&quot;&amp;gt;&amp;gt;&#xA;            {% set locales = craft.i18n.getSiteLocaleIds() %}&#xA;            {% set locale = craft.locale %}&#xA;            {% for loc in locales %}&#xA;                {# checking if current loop has active locale #}&#xA;                {% set isHome = (loc == locale) %}&#xA;                {% if isHome %}&#xA;&#xA;                    {% if loc == &quot;en&quot; %}&#xA;                        &amp;lt;option value=&quot;/{{ loc | replace({'en': 'eu'}) }}/{{ craft.request.path }}&quot; selected&amp;gt;Europe&amp;lt;/option&amp;gt;   &#xA;&#xA;                    {% else %}&#xA;                        {% set subTags = locale|split('_') %}&#xA;                        {% set territory = subTags|length &amp;gt; 1 ? craft.i18n.getLocaleData(craft.locale).getTerritory(subTags|last) : '' %}  &#xA;                            &amp;lt;option value=&quot;/{{ loc | replace({'en': ''}) | trim('_') }}/{{ craft.request.path }}&quot; selected&amp;gt;{% if territory %}{{ territory }}{% endif %}&amp;lt;/option&amp;gt;  &#xA;&#xA;                    {% endif %}&#xA;&#xA;                {% else %}&#xA;&#xA;                    {% if loc == &quot;en&quot; %}&#xA;                        &amp;lt;option value=&quot;/{{ loc | replace({'en': 'eu'}) }}/{{ craft.request.path }}&quot;&amp;gt;EU&amp;lt;/option&amp;gt;   &#xA;                    {% else %}&#xA;                        &amp;lt;option value=&quot;/{{ loc | replace({'en': ''}) | trim('_') }}/{{ craft.request.path }}&quot;&amp;gt;{{ loc | replace({'en': ''}) | trim('_') | upper }} &amp;lt;/option&amp;gt;   &#xA;                    {% endif %}&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yay!! I wanted to share my answer because I've been working on this issue for a few days and couldn't find a solution anywhere. Maybe it will help someone else that runs into this issue when building a multi-country website with Craft. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="5644" LastActivityDate="2017-11-19T20:42:48.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22898" PostTypeId="1" AcceptedAnswerId="22899" CreationDate="2017-11-20T00:35:02.287" Score="1" ViewCount="61" Body="&lt;p&gt;I'm going through my current project and making my loops more &quot;eager&quot;. It's working great in several areas and improving performance &lt;em&gt;massively&lt;/em&gt; but for some reason I can't get it to work when the entries I'm asking for have a dropdown field. &quot;newsType&quot; is the name of the field. Am I missing some obvious mistake here or are dropdowns a special case somehow? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Array to string conversion&#xA;echo twig_escape_filter($this-&amp;gt;env, $this-&amp;gt;getAttribute($context[&quot;article&quot;], &quot;newsType&quot;, array()), &quot;html&quot;, null, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestNews = {&#xA;    section : 'news',&#xA;    with : ['title', 'body', 'newsType'],&#xA;    limit : '6'&#xA;} %}&#xA;&#xA;{% if latestNews|length %}&#xA;{% for article in craft.entries(latestNews) %}&#xA;    &amp;lt;div class=&quot;newsEl {{ article.newsType }}&quot;&amp;gt;&#xA;    &amp;lt;h2&amp;gt;{{ article.newsType.label }}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;article&amp;gt;&#xA;       &amp;lt;h3&amp;gt;{{ article.title }}&amp;lt;/h3&amp;gt;&#xA;         &amp;lt;p&amp;gt;&#xA;           {{ article.body|striptags|slice(0, 150) ~ '...' }}&#xA;         &amp;lt;/p&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ article.url }}&quot; class=&quot;readMore&quot;&amp;gt;Read More &amp;lt;span&amp;gt;&amp;amp;rarr;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5309" LastActivityDate="2017-11-20T04:39:55.550" Title="How do I eager load a dropdown field?" Tags="&lt;eager-loading&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22899" PostTypeId="2" ParentId="22898" CreationDate="2017-11-20T00:54:44.060" Score="1" Body="&lt;p&gt;Dropdowns are not relations, and therefore they don't need to be eager loaded (and indeed can't be eager loaded).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an explanation of what's going on under the hood with eager loading: &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speed up your Craft CMS Templates with Eager Loading&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR only things that are &lt;em&gt;relations&lt;/em&gt;, which are other Elements are candidates for eager loading. Other fields like Dropdowns, etc. are loaded as part of the content already.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="340" LastEditDate="2017-11-20T04:39:55.550" LastActivityDate="2017-11-20T04:39:55.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22900" PostTypeId="2" ParentId="18760" CreationDate="2017-11-20T00:56:37.853" Score="1" Body="&lt;p&gt;This came up recently, so for anyone stumbling across is, here's a writeup on how Eager Loading works: &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speed up your Craft CMS Templates with Eager Loading&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-20T00:56:37.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22901" PostTypeId="2" ParentId="22847" CreationDate="2017-11-20T07:55:59.230" Score="2" Body="&lt;p&gt;I'd recommend you take a look at the excellent existing threads on this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/55/git-workflow-and-multi-environment-how-to-approach/62#62&quot;&gt;Git Workflow and Multi Environment - how to approach&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev&quot;&gt;What's the best practice for handling data migration and&#xA;organization across development environments?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;as well as the official documentation on &lt;a href=&quot;https://craftcms.com/docs/multi-environment-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-Environment Configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/6548/correct-way-to-set-up-development-and-production-environments-for-craft&quot;&gt;Correct way to set up development and production environments for Craft?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7538" LastActivityDate="2017-11-20T07:55:59.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22902" PostTypeId="1" AcceptedAnswerId="22906" CreationDate="2017-11-20T09:29:05.427" Score="0" ViewCount="326" Body="&lt;p&gt;I am looking to create multisite in Craft 3. Is there any way to create multisite in Craft?&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="57" LastEditDate="2017-11-20T20:38:08.527" LastActivityDate="2017-11-20T20:38:08.527" Title="How to create multisite in Craft CMS v3?" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22903" PostTypeId="1" CreationDate="2017-11-20T10:52:43.837" Score="1" ViewCount="429" Body="&lt;p&gt;It seems that an issue that was solved in craftcms 2.6.2991 is reintroduced afterwards.  I have just updated a site to version 2.6.2997 and the exactly the same error that was there prior to version 2.6.2991 is reappearing again on php 7.x environments&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;A non-numeric value encountered&quot; /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(1025)&#xA;&#xA;1013      * @param $transform&#xA;1014      * @return \Imagine\Image\Point&#xA;1015      */&#xA;1016     private function _getCropPoint($resizeSize, $cropSize, $transform)&#xA;1017     {&#xA;1018         // get default crop position from the settings&#xA;1019         $position = $this-&amp;gt;getSetting('position', $transform);&#xA;1020 &#xA;1021         // get the offsets, left and top, now as an int, representing the % offset&#xA;1022         list($leftOffset, $topOffset) = explode(' ', $position);&#xA;1023         &#xA;1024         // get position that crop should center around&#xA;1025         $leftPos = floor($resizeSize-&amp;gt;getWidth() * ($leftOffset / 100)) - floor($cropSize-&amp;gt;getWidth()/2);&#xA;1026         $topPos = floor($resizeSize-&amp;gt;getHeight() * ($topOffset / 100)) - floor($cropSize-&amp;gt;getHeight()/2);&#xA;1027         &#xA;1028         // make sure the point is within the boundaries and return the point&#xA;1029         return new \Imagine\Image\Point(&#xA;1030             min(max($leftPos, 0), ($resizeSize-&amp;gt;getWidth() - $cropSize-&amp;gt;getWidth())), &#xA;1031             min(max($topPos, 0), ($resizeSize-&amp;gt;getHeight() - $cropSize-&amp;gt;getHeight()))&#xA;1032         );&#xA;1033     }&#xA;1034 &#xA;1035 &#xA;1036     /**&#xA;1037      * Returns the filter method for resize operations&#xA;Stack Trace&#xA;- 0 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/app/etc/web/WebApp.php(693): CApplication-&amp;gt;handleError(2, &quot;A non-numeric value encountered&quot;, &quot;/var/www/vhosts//httpdocs/etc/plugins/imager/s...&quot;, 1025)&#xA;688         if (version_compare(PHP_VERSION, '7.1', '&amp;gt;=') &amp;amp;&amp;amp; strpos($message, 'Narrowing occurred during type inference. Please file a bug report') !== false)&#xA;689         {&#xA;690             return;&#xA;691         }&#xA;692 &#xA;693         parent::handleError($code, $message, $file, $line);&#xA;694     }&#xA;695 &#xA;696     // Private Methods&#xA;697     // =========================================================================&#xA;698 &#xA;- 1 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(1025): Craft\WebApp-&amp;gt;handleError(2, &quot;A non-numeric value encountered&quot;, &quot;/var/www/vhosts/xxx/httpdocs/etc/plugins/imager/s...&quot;, 1025, ...)&#xA;1020 &#xA;1021         // get the offsets, left and top, now as an int, representing the % offset&#xA;1022         list($leftOffset, $topOffset) = explode(' ', $position);&#xA;1023         &#xA;1024         // get position that crop should center around&#xA;1025         $leftPos = floor($resizeSize-&amp;gt;getWidth() * ($leftOffset / 100)) - floor($cropSize-&amp;gt;getWidth()/2);&#xA;1026         $topPos = floor($resizeSize-&amp;gt;getHeight() * ($topOffset / 100)) - floor($cropSize-&amp;gt;getHeight()/2);&#xA;1027         &#xA;1028         // make sure the point is within the boundaries and return the point&#xA;1029         return new \Imagine\Image\Point(&#xA;1030             min(max($leftPos, 0), ($resizeSize-&amp;gt;getWidth() - $cropSize-&amp;gt;getWidth())), &#xA;- 2 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(635): Craft\ImagerService-&amp;gt;_getCropPoint(Imagine\Image\Box, Imagine\Image\Box, array(&quot;width&quot; =&amp;gt; 1200, &quot;height&quot; =&amp;gt; 600, &quot;mode&quot; =&amp;gt; &quot;crop&quot;, &quot;allowUpscale&quot; =&amp;gt; false, ...))&#xA;630             $layer-&amp;gt;resize($resizeSize, $filterMethod);&#xA;631         }&#xA;632 &#xA;633         // Do the crop&#xA;634         if (!isset($transform['mode']) || mb_strtolower($transform['mode']) === 'crop' || mb_strtolower($transform['mode']) === 'croponly') {&#xA;635             $cropPoint = $this-&amp;gt;_getCropPoint($resizeSize, $cropSize, $transform);&#xA;636             $layer-&amp;gt;crop($cropPoint, $cropSize);&#xA;637         }&#xA;638 &#xA;639         // letterbox, add padding&#xA;640         if (isset($transform['mode']) &amp;amp;&amp;amp; mb_strtolower($transform['mode']) === 'letterbox') {&#xA;- 3 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(523): Craft\ImagerService-&amp;gt;_transformLayer(Imagine\Imagick\Image, array(&quot;width&quot; =&amp;gt; 1200, &quot;height&quot; =&amp;gt; 600, &quot;mode&quot; =&amp;gt; &quot;crop&quot;, &quot;allowUpscale&quot; =&amp;gt; false, ...), &quot;jpg&quot;, &quot;jpg&quot;)&#xA;518                 }&#xA;519                 &#xA;520                 $this-&amp;gt;imageInstance = $gif;&#xA;521 &#xA;522             } else {&#xA;523                 $this-&amp;gt;_transformLayer($this-&amp;gt;imageInstance, $transform, $sourceExtension, $targetExtension);&#xA;524             }&#xA;525             &#xA;526             // If Image Driver is imagick and removeMetadata is true, remove meta data&#xA;527             if ($this-&amp;gt;imageDriver === 'imagick' &amp;amp;&amp;amp; $this-&amp;gt;getSetting('removeMetadata', $transform)) {&#xA;528                 $this-&amp;gt;imageInstance-&amp;gt;strip();&#xA;- 6 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(341): Craft\ImagerService-&amp;gt;_getTransformedImage(Craft\Imager_ImagePathsModel, array(&quot;width&quot; =&amp;gt; 1200, &quot;height&quot; =&amp;gt; 600, &quot;mode&quot; =&amp;gt; &quot;crop&quot;, &quot;allowUpscale&quot; =&amp;gt; false, ...))&#xA;336         $r = null;&#xA;337 &#xA;338         if (isset($transform[0])) {&#xA;339             $transformedImages = array();&#xA;340             foreach ($transform as $t) {&#xA;341                 $transformedImage = $this-&amp;gt;_getTransformedImage($pathsModel, $transformDefaults != null ? array_merge($transformDefaults, $t) : $t);&#xA;342                 $transformedImages[] = $transformedImage;&#xA;343             }&#xA;344             $r = $transformedImages;&#xA;345         } else {&#xA;346             $transformedImage = $this-&amp;gt;_getTransformedImage($pathsModel, $transformDefaults != null ? array_merge($transformDefaults, (array)$transform) : $transform);&#xA;- 5 &#xA;–  /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/variables/ImagerVariable.php(26): Craft\ImagerService-&amp;gt;transformImage(Craft\AssetFileModel, array(array(&quot;width&quot; =&amp;gt; 1200, &quot;ratio&quot; =&amp;gt; 2), array(&quot;width&quot; =&amp;gt; 1024, &quot;ratio&quot; =&amp;gt; 2), array(&quot;width&quot; =&amp;gt; 768, &quot;ratio&quot; =&amp;gt; 1.3333333333333, &quot;jpegQuality&quot; =&amp;gt; 65)), array(&quot;format&quot; =&amp;gt; &quot;jpg&quot;, &quot;allowUpscale&quot; =&amp;gt; false, &quot;mode&quot; =&amp;gt; &quot;crop&quot;, &quot;jpegQuality&quot; =&amp;gt; 80, ...), null)&#xA;21      * @param $configOverrides&#xA;22      * @return mixed&#xA;23      */&#xA;24     public function transformImage($file, $transform, $transformDefaults = null, $configOverrides = null)&#xA;25     {&#xA;26         $image = craft()-&amp;gt;imager-&amp;gt;transformImage($file, $transform, $transformDefaults, $configOverrides);&#xA;27         return $image;&#xA;28     }&#xA;29 &#xA;30     /**&#xA;31      * Takes an array of Imager_ImageModel (or anything else that supports getUrl() and getWidth())&#xA;...&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="397" LastEditorUserId="57" LastEditDate="2017-11-20T20:47:28.917" LastActivityDate="2017-11-20T20:47:28.917" Title="&quot;A non-numeric value encountered&quot; reintroduced after version 2.6.2991" Tags="&lt;craft-pro&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22904" PostTypeId="1" CreationDate="2017-11-20T12:07:16.850" Score="1" ViewCount="601" Body="&lt;p&gt;Is it possible to get a list of category groups without having to loop through all categories to get their parent group name?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just making this question clearer, as it's related to using elementapi. Ideally, I'd like to get a list of category groups via elementapi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/menu' =&amp;gt; function() {&#xA;  return [&#xA;    'elementType' =&amp;gt; ElementType::Category,&#xA;    'paginate' =&amp;gt; false,&#xA;    'criteria' =&amp;gt; [&#xA;      'group' =&amp;gt; ['stages', 'series', 'disciplines'],&#xA;      'limit' =&amp;gt; null,&#xA;      'with' =&amp;gt; ['group']&#xA;    ],&#xA;    'transformer' =&amp;gt; function(CategoryModel $category) {&#xA;&#xA;      $group = $category-&amp;gt;group ?? null;&#xA;&#xA;      return [&#xA;        'id' =&amp;gt; (int)$category-&amp;gt;id,&#xA;        'title' =&amp;gt; $category-&amp;gt;title,&#xA;        'slug' =&amp;gt; $category-&amp;gt;slug,&#xA;        'summary' =&amp;gt; $category-&amp;gt;summary,&#xA;        'group' =&amp;gt; [&#xA;          'id' =&amp;gt; (int)$group-&amp;gt;id,&#xA;          'handle' =&amp;gt; (string)$group-&amp;gt;handle,&#xA;          'name' =&amp;gt; (string)$group-&amp;gt;name&#xA;        ]&#xA;      ];&#xA;    }&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd want to structure the data by categorygroup rather than cateogries, something like this (it doesn't work because CategoryGroup is not an elementType) but wondering if there is another way to get the same result?:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/menu' =&amp;gt; function() {&#xA;    return [&#xA;      'elementType' =&amp;gt; ElementType::CategoryGroup,&#xA;      'paginate' =&amp;gt; false,&#xA;      'limit' =&amp;gt; null&#xA;    ],&#xA;    'transformer' =&amp;gt; function(CategoryGroupModel $categoryGroup) {&#xA;&#xA;      $categories = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category)-&amp;gt;group($categoryGroup-&amp;gt;handle);&#xA;&#xA;      $cats = [];&#xA;      foreach($categories as $category) {&#xA;        $cats[] = [&#xA;          'id' =&amp;gt; (int)$category-&amp;gt;id,&#xA;          'title' =&amp;gt; $category-&amp;gt;title,&#xA;          'slug' =&amp;gt; $category-&amp;gt;slug&#xA;        ];&#xA;      }&#xA;&#xA;      return [&#xA;        'id' =&amp;gt; (int)$categoryGroup-&amp;gt;id,&#xA;        'title' =&amp;gt; $categoryGroup-&amp;gt;name,&#xA;        'handle' =&amp;gt; $categoryGroup-&amp;gt;handle,&#xA;        'categories' =&amp;gt; $cats&#xA;    }&#xA;  ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6750" LastEditorUserId="6750" LastEditDate="2017-11-20T14:53:06.773" LastActivityDate="2017-11-20T14:53:06.773" Title="How to get list of category groups?" Tags="&lt;plugin-elementapi&gt;&lt;category&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22905" PostTypeId="2" ParentId="17534" CreationDate="2017-11-20T13:32:17.153" Score="1" Body="&lt;p&gt;I've made a plugin to do this now and it has stock checks to display messages if the quantity has been adjusted due to the current availability of a variant. All previous options will be carried forward into the new cart also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The benefit of using this plugin is that you don't need to loop through each line item of the order in the template to populate a form. This should speed things up on large orders for you as all you have to do now is submit the order id to the plugin controller and it will handle the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used this on production sites with large numbers of variants and up to 12 custom options in a nested array where it's run without any issue for about 7 months. I thought I'd drop the link on here for anyone still attempting to create this functionality. I hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/a-digital/repeatorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/a-digital/repeatorder&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2017-11-20T13:32:17.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22906" PostTypeId="2" ParentId="22902" CreationDate="2017-11-20T14:21:29.037" Score="1" Body="&lt;p&gt;This is a very general question. Take a look at the following resources as a starting point:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/events/managing-multiple-sites-in-craft-3-sites-and-localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Managing Multiple Sites in Craft 3 – Sites and Localization&lt;/a&gt; - Straight Up Craft&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://mijingo.com/lessons/craft-3-multi-site/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using Craft CMS Multi-Site&lt;/a&gt; - Mijingo&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastActivityDate="2017-11-20T14:21:29.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22908" PostTypeId="1" AcceptedAnswerId="22910" CreationDate="2017-11-20T17:06:11.353" Score="1" ViewCount="292" Body="&lt;p&gt;I'm thinking about building an app with Craft that requires users from a specific user group (Business User Usergroup) to be able to log in on the frontend and add users from another user group (Client Usergroup) from the frontend, these users would be their clients and they would be able to view information set by the admin aswell as upload certain documents that they admin can then view. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;// If anyone is interested the application will be a portal where coaches/therapists can register, log in and become a user( of the business user Usergroup) and can then add their clients as users (Client Usergroup) and then they can communicate digitally before meeting. Obviously, i don't want therapists to be able to see clients that don't belong to them. For this, i need to restrict user permissions as to make sure that the therapist can only see and edit users/clients that belong to him. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i cant seem to figure out is if there is a way either with Craft or a plugin that makes sure that the admin cannot edit/see users added by other users in their user group. This means that if a user/coach from the Business Usergroup logs in and adds a client/user (from the Client Usergroup) only he/she, all super users and the client he added can login, view and edit these account details.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across a plugin or have experience with this type of &quot;user-specific&quot; bound user permission? If the explanation is too vague or unclear then i would be happy to explain in more detail. Hope someone can help with this and thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2017-11-20T19:39:30.133" Title="Restict admin user permissions to only editing users he/she has created." Tags="&lt;users&gt;&lt;permissions&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22909" PostTypeId="2" ParentId="22759" CreationDate="2017-11-20T18:20:52.950" Score="2" Body="&lt;p&gt;Not sure I'm following 100%, but in Craft 2, a structured section has a &quot;Nested Entries&quot; text box in the &quot;Entry URL Format&quot; under a section's settings where you can dynamically access the URI of a parent element in a structure like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, under a section's Settings, that has moved to &quot;Site Settings&quot; and you just have the &quot;Entry URL Format&quot; text box.  You could do something similar like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri ?? ''}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e. if there isn't a &lt;code&gt;parent.uri&lt;/code&gt;, just use the &lt;code&gt;slug&lt;/code&gt;, otherwise use prepend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've got the full power of Twig in those text boxes, so you can adjust however you need.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-20T18:20:52.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22910" PostTypeId="2" ParentId="22908" CreationDate="2017-11-20T19:16:07.730" Score="1" Body="&lt;p&gt;I believe what you're looking for is &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#isInGroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;'isInGroup'&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('groupHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will also accept an actual group object or a group ID as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also &lt;a href=&quot;http://buildwithcraft.com/docs/templating/usermodel#getGroups&quot; rel=&quot;nofollow noreferrer&quot;&gt;getGroups&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.author.getGroups() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you have several options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If all users only have one group (so they can not be in two) you can check if the current user is in the same group like the first group of &lt;code&gt;entry.author&lt;/code&gt;. But this has the disadvantage if someone wants to change his/her group the entry will become invisible for the previous group&lt;/li&gt;&#xA;&lt;li&gt;You could attach the group handle to an entry. So you field create a plainTextField and insert the group handle of the author to this entry -&gt; if the author changes his/her group the entry will still be available for the author as well as everyone who was able to see the entry before.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you choose the second option you would be able to include the search condition in a &lt;code&gt;ElementCriteriaModel&lt;/code&gt; very smooth. And search only entry that is connected by the current group of the currentUser. If someone should be able to see entries but he/she is not allowed to edit them you would just include the &lt;code&gt;isInGroup&lt;/code&gt; condition to check if she/he may proceed.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example your user list could look like that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.find() %}&#xA;{% for user in users %}&#xA;    &amp;lt;!-- everyone can see the firstName of each user --&amp;gt;&#xA;    {{ user.firstName }} &#xA;    {% if currentUser %}&#xA;        &amp;lt;!-- but only logged in users can see the last name --&amp;gt;&#xA;        {{ user.lastName }}&#xA;        {% set groupsOfUser = user.getGroups() %}&#xA;        {% if groupsOfUser|length %}&#xA;            {% if currentUser.isInGroup(groupsOfUser[0]) %}&#xA;                &amp;lt;!-- only users of the same group can edit/delete or whatever --&amp;gt;&#xA;            {% endif %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-20T19:39:30.133" LastActivityDate="2017-11-20T19:39:30.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22911" PostTypeId="2" ParentId="22903" CreationDate="2017-11-20T19:39:16.483" Score="1" Body="&lt;p&gt;The error appears to be coming from the Imager plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft/blob/master/imager/services/ImagerService.php#L1025&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft/blob/master/imager/services/ImagerService.php#L1025&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you're using the latest version, and then potentially post an issue here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-20T19:39:16.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22912" PostTypeId="2" ParentId="21186" CreationDate="2017-11-20T19:42:49.433" Score="1" Body="&lt;p&gt;Definitely agree with the comments that you should enable &lt;code&gt;devMode&lt;/code&gt; from day one when working on a project. In addition, coding defensively can help avoid common frontend errors as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's more on this topic in the article &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-20T19:42:49.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22913" PostTypeId="1" AcceptedAnswerId="22915" CreationDate="2017-11-20T19:54:31.387" Score="1" ViewCount="100" Body="&lt;p&gt;I have a Craft site where I need to redirect any traffic to www (including dev.lakesideohio.com). The rule seems to be working but for some reason the url gets changed to using index.php with query string which I am not using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;a href=&quot;https://mysite.com/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mysite.com/news&lt;/a&gt; goes to &lt;a href=&quot;https://www.mysite.com/index.php?p=news/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mysite.com/index.php?p=news/&lt;/a&gt; instead of &lt;a href=&quot;https://www.mysite.com/news&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mysite.com/news&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Redirect to www&#xA;RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]&#xA;RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L] &#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="3362" LastEditDate="2017-11-20T20:45:15.797" LastActivityDate="2017-11-20T20:45:15.797" Title="Simple Craft htaccess Help" Tags="&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22914" PostTypeId="2" ParentId="19674" CreationDate="2017-11-20T20:03:44.537" Score="2" Body="&lt;p&gt;I had this issue and solved it by ensuring that the locale checked against in the &lt;code&gt;matchEntry()&lt;/code&gt; function in &lt;code&gt;MyNewsChannel.php&lt;/code&gt; matched the locale of my site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/pixelandtonic/AppleNews/blob/master/applenewschannels/MyNewsChannel.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;example channel class&lt;/a&gt; provided in the plugin repo checks for a site locale set to &lt;code&gt;en&lt;/code&gt; on line 27:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if ($entry-&amp;gt;locale != 'en') {&#xA;return false;&#xA;}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My site locale was set to &lt;code&gt;en_us&lt;/code&gt;; correcting it in my channel class solved this for me. Maybe this is also the case for you or someone else who has landed here with a similar issue!&lt;/p&gt;&#xA;" OwnerUserId="7408" LastActivityDate="2017-11-20T20:03:44.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22915" PostTypeId="2" ParentId="22913" CreationDate="2017-11-20T20:17:59.557" Score="1" Body="&lt;p&gt;Check out: &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Removing “index.php” from URLs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-20T20:17:59.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22916" PostTypeId="1" CreationDate="2017-11-20T20:20:28.093" Score="2" ViewCount="210" Body="&lt;p&gt;I've been using Charge to handle a subscription service on a client site, and for the most part, it's been working well for the past year. Now that a year has gone by, the first set of recurring membership subscriptions are starting to be automatically renewed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A problem I'm seeing is that the dates displayed using Charge's &lt;code&gt;subscription.currentPeriodEnd&lt;/code&gt; template variables are not showing updated dates. They still show the end date for the initial year of the subscription, not the new end date which should be one year past the date of the renewal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else experiencing this and can suggest a fix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a potentially related issue, the recurring payment is being displayed as &quot;TEST&quot; mode in the UI in Charge. See screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/igm9F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/igm9F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="579" LastActivityDate="2018-07-26T11:27:51.317" Title="Charge plugin: subscription start and end dates not updating for recurring subscription payments" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22920" PostTypeId="1" CreationDate="2017-11-21T08:57:29.820" Score="3" ViewCount="435" Body="&lt;p&gt;In the CP, is it possible to disable Category X for site A, and not for Site B? And if so, how?&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2017-11-21T09:10:27.647" LastActivityDate="2017-11-21T12:58:52.033" Title="In Craft 3, (how) can I disable a category on a per site basis?" Tags="&lt;categories&gt;&lt;craft3&gt;&lt;category&gt;&lt;status&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22921" PostTypeId="2" ParentId="22849" CreationDate="2017-11-21T09:38:36.737" Score="1" Body="&lt;p&gt;This my solution, although it's not perfect. I set-up an entry loop within the form and included the following for a series of checkboxes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if loop.index == &quot;2&quot; %}&#xA;&#xA;&amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot;&#xA;        name=&quot;{{ course2.handle }}[]&quot;&#xA;        value=&quot;{{ course2.value }}&quot;&#xA;        {{ course2.checked ? &quot;checked&quot; : &quot;&quot; }}&#xA;    /&amp;gt;&#xA;&amp;lt;/label&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ courseName2.handle }}&quot; value=&quot;{{ entry.title &#xA;}} | {{ entry.courseDate|date('j.n.y') }}&quot;  /&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in the form submission the entry title in loop 2 is attached to the Course 2 checkbox. It would have been better if {loop.index} could be used within the handle name so the 'if' conditional is not needed. As pointed out above, the value of the checkbox can be set dynamically from the entry loop, but the result is not shown in the FreeForm control panel, just the email notification. Therefore is was necessary to include the hidden field to record the entry title. Hope that all makes sense.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2017-11-21T09:38:36.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22922" PostTypeId="1" AcceptedAnswerId="22946" CreationDate="2017-11-21T11:04:25.043" Score="1" ViewCount="487" Body="&lt;p&gt;This works fine on localhost but crashes on remote Server. I can return one category, but it will crash when I try to display multiple categories. I also tried to save the categories in a variable and return the variable, which again worked on localhost but not on remote Server.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'programevent.json' =&amp;gt; [&#xA;    'elementType' =&amp;gt; ElementType::Entry,&#xA;    // 'cache' =&amp;gt; true,&#xA;    'elementsPerPage' =&amp;gt; 999,&#xA;    'paginate' =&amp;gt; false,&#xA;    'limit' =&amp;gt; 999,&#xA;    'criteria' =&amp;gt; ['section' =&amp;gt; 'program','type' =&amp;gt;'Event'],&#xA;    'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;        HeaderHelper::setHeader([&#xA;            'Access-Control-Allow-Origin' =&amp;gt; '*'&#xA;        ]);&#xA;        $parent = $entry-&amp;gt;getParent();&#xA;&#xA;        return [&#xA;            'title' =&amp;gt; $entry-&amp;gt;title,&#xA;            'url' =&amp;gt; $entry-&amp;gt;url,&#xA;            'id' =&amp;gt; $entry-&amp;gt;id,&#xA;            'description' =&amp;gt; (string) $entry-&amp;gt;description,&#xA;            'level' =&amp;gt; $entry-&amp;gt;level,&#xA;            'themes' =&amp;gt; array_map( function (CategoryModel $category) {&#xA;                return [&#xA;                    'id' =&amp;gt; $category-&amp;gt;id,&#xA;                    'title' =&amp;gt; $category-&amp;gt;title&#xA;                ];&#xA;            }, $entry-&amp;gt;themes-&amp;gt;find()),&#xA;            'kindOfEvent' =&amp;gt; array_map( function (CategoryModel $category) {&#xA;                return [&#xA;                    'id' =&amp;gt; $category-&amp;gt;id,&#xA;                    'title' =&amp;gt; $category-&amp;gt;title&#xA;                ];&#xA;            }, $entry-&amp;gt;kindOfEvent-&amp;gt;find()),&#xA;            'languages' =&amp;gt; array_map( function (CategoryModel $category) {&#xA;                return [&#xA;                    'id' =&amp;gt; $category-&amp;gt;id,&#xA;                    'title' =&amp;gt; $category-&amp;gt;title&#xA;                ];&#xA;            }, $entry-&amp;gt;languages-&amp;gt;find()),&#xA;            'parent' =&amp;gt; $parent ? [&#xA;                'title' =&amp;gt; $parent-&amp;gt;title,&#xA;                'number' =&amp;gt; $parent-&amp;gt;number,&#xA;                'url' =&amp;gt; $parent-&amp;gt;url,&#xA;                'shuttleLine' =&amp;gt; array_map( function (CategoryModel $category) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $category-&amp;gt;title,&#xA;                        'color' =&amp;gt; $category-&amp;gt;color&#xA;                    ];&#xA;                }, $parent-&amp;gt;shuttleLine-&amp;gt;find()),&#xA;            ] : null,&#xA;&#xA;        ];&#xA;    },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4040" LastActivityDate="2017-11-22T20:16:49.893" Title="Element API with multiple categories gives back error 500" Tags="&lt;categories&gt;&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22923" PostTypeId="2" ParentId="22920" CreationDate="2017-11-21T11:19:30.077" Score="2" Body="&lt;p&gt;I guess it is either a bug or the developers don't want us to do it via cp request. In my plugin (phpCode) I can activate and deactivate categories per site easily but the cp template is missing the required input. When you compare the route of a category and an entry you'll notice it easily&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;code&gt;entries/_edit.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;sites&quot; class=&quot;pane&quot;&amp;gt;&#xA;        {% set parentIdParam = craft.app.request.getParam('parentId.0') ?: craft.app.request.getParam('parentId') %}&#xA;        {% for siteId in siteIds %}&#xA;            {% set site = craft.app.sites.getSiteById(siteId) %}&#xA;            &amp;lt;li{% if siteId == entry.siteId %} class=&quot;sel&quot;{% endif %}&amp;gt;&#xA;                {%- if siteId == entry.siteId -%}&#xA;                    {{ site.name|t('site') }}&#xA;                    {{ forms.lightswitch({&#xA;                        name: 'enabledForSite',&#xA;                        on:   entry.enabledForSite,&#xA;                        small: true,&#xA;                        disabled: isVersion&#xA;                    }) }}&#xA;                {%- else -%}&#xA;                    {% set siteEntryUrl = url(&#xA;                        'entries/'~sectionHandle~'/'~craft.app.request.getSegment(3)~'/'~site.handle,&#xA;                        (parentIdParam ? { parentId: parentIdParam })&#xA;                    ) -%}&#xA;                    &amp;lt;a href=&quot;{{ siteEntryUrl }}&quot;&amp;gt;{{ site.name|t('site') }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;div class=&quot;status {{ siteId in enabledSiteIds ? 'enabled' : 'disabled' }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                {%- endif -%}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the &lt;code&gt;categories/_edit.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;sites&quot; class=&quot;pane&quot;&amp;gt;&#xA;        {% set parentIdParam = craft.app.request.getParam('parentId.0') ?: craft.app.request.getParam('parentId') %}&#xA;        {% for siteId in siteIds %}&#xA;            {% set site = craft.app.sites.getSiteById(siteId) %}&#xA;            &amp;lt;li{% if siteId == category.siteId %} class=&quot;sel&quot;{% endif %}&amp;gt;&#xA;                {%- if siteId == category.siteId -%}&#xA;                    {{ site.name|t('site') }}&#xA;                {%- else -%}&#xA;                    {% set siteCategoryUrl = url(&#xA;                        'categories/'~groupHandle~'/'~craft.app.request.getSegment(3)~'/'~site.handle,&#xA;                        (parentIdParam ? { parentId: parentIdParam })&#xA;                    ) -%}&#xA;                    &amp;lt;a href=&quot;{{ siteCategoryUrl }}&quot;&amp;gt;{{ site.name|t('site') }}&amp;lt;/a&amp;gt;&#xA;                {%- endif -%}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's missing the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.lightswitch({&#xA;     name: 'enabledForSite',&#xA;     on:   entry.enabledForSite,&#xA;     small: true,&#xA;     disabled: isVersion&#xA; }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;even though when I include the input to the template it does not work since it's not populated correctly. The &lt;code&gt;_populateCategoryModel&lt;/code&gt; method does not recognize the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare it: &lt;code&gt;EntriesController&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _populateEntryModel(Entry $entry)&#xA;{&#xA;    // Set the entry attributes, defaulting to the existing values for whatever is missing from the post data&#xA;    $entry-&amp;gt;typeId = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('typeId', $entry-&amp;gt;typeId);&#xA;    $entry-&amp;gt;slug = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('slug', $entry-&amp;gt;slug);&#xA;    $entry-&amp;gt;postDate = (($postDate = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('postDate')) !== false ? (DateTimeHelper::toDateTime($postDate) ?: null) : $entry-&amp;gt;postDate);&#xA;    $entry-&amp;gt;expiryDate = (($expiryDate = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('expiryDate')) !== false ? (DateTimeHelper::toDateTime($expiryDate) ?: null) : null);&#xA;    $entry-&amp;gt;enabled = (bool)Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('enabled', $entry-&amp;gt;enabled);&#xA;    $entry-&amp;gt;enabledForSite = (bool)Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('enabledForSite', $entry-&amp;gt;enabledForSite);&#xA;    $entry-&amp;gt;title = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('title', $entry-&amp;gt;title);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;has the &lt;code&gt;$entry-&amp;gt;enabledForSite&lt;/code&gt; but the &lt;code&gt;CategoryController&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; private function _populateCategoryModel(Category $category)&#xA;{&#xA;    // Set the category attributes, defaulting to the existing values for whatever is missing from the post data&#xA;    $category-&amp;gt;slug = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('slug', $category-&amp;gt;slug);&#xA;    $category-&amp;gt;enabled = (bool)Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('enabled', $category-&amp;gt;enabled);&#xA;&#xA;    $category-&amp;gt;title = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('title', $category-&amp;gt;title);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;does not have it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want you could create a plugin to fix this issue, it's actually not that complicated since you can change everything in craft now, so you could overwrite the function. But It would be easier to create a ticket with a feature request or something. Maybe Brad could make it clearer&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To Resume&lt;/strong&gt;&lt;br&gt;&#xA;If you want to enable categories per site, you have to include the field to the template and to the controller in &lt;code&gt;_populateCategoryModel&lt;/code&gt; then it works&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-21T12:58:52.033" LastActivityDate="2017-11-21T12:58:52.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22924" PostTypeId="1" CreationDate="2017-11-22T02:30:01.337" Score="1" ViewCount="613" Body="&lt;p&gt;I created fields using Charge 2 plugin and after creating a form I getting an error &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Missing required param: card[exp_month].&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;div class=&quot;&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grp-form&quot;&amp;gt;&#xA;        &amp;lt;form &#xA;              id=&quot;charge-form&quot;&#xA;              method=&quot;post&quot;&#xA;              action=&quot;&quot;&#xA;              accept-charset=&quot;UTF-8&quot;&#xA;              data-publicKey=&quot;{{ craft.charge.getPublicKey }}&quot;&amp;gt;&#xA;&#xA;&#xA;            {{ forms.hidden({ name : 'action', value: 'charge/charge' }) }}&#xA;            {{ getCsrfInput() }}&#xA;&#xA;            {% set options = planAmount %}&#xA;            {{ craft.charge.setPaymentOptions(options) }}&#xA;&#xA;            &amp;lt;div class=&quot;custDet-form&quot;&amp;gt;&#xA;            &amp;lt;h4&amp;gt;Customer Details&amp;lt;/h4&amp;gt;&#xA;&#xA;                {% include 'charge/_includes/inputs/customerDetails' %}&#xA;&#xA;                {{ forms.textField({&#xA;                    name: 'fields[businessName]',&#xA;                    id: 'businessName',&#xA;                    label: 'Business Name',&#xA;                    placeholder: 'eg. My Business'&#xA;                }) }}&#xA;&#xA;                {{ forms.textField({&#xA;                    name: 'fields[phoneNumber]',&#xA;                    id: 'phoneNumber',&#xA;                    label: 'Phone Number'&#xA;                }) }}&#xA;&#xA;                {{ forms.textField({&#xA;                    name: 'fields[streetAddress]',&#xA;                    id: 'streetAddress',&#xA;                    label: 'Street Address'&#xA;                }) }}&#xA;&#xA;                {{ forms.textField({&#xA;                    name: 'fields[city]',&#xA;                    id: 'city',&#xA;                    label: 'City'&#xA;                }) }}&#xA;&#xA;&#xA;&#xA;                {{ forms.textField({&#xA;                    name: 'fields[postcode]',&#xA;                    id: 'postcode',&#xA;                    label: 'Post Code'&#xA;                }) }}&#xA;&#xA;&#xA;                &amp;lt;div class=&quot;select-indent&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;state&quot;&amp;gt;State&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;select multiple name=&quot;fields[state][]&quot; class=&quot;select-mult&quot;&amp;gt;&#xA;                        &amp;lt;option value=&quot;NSW&quot;&amp;gt;NSW&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;QLD&quot;&amp;gt;QLD&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;SA&quot;&amp;gt;SA&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;VIC&quot;&amp;gt;VIC&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;WA&quot;&amp;gt;WA&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;ACT&quot;&amp;gt;ACT&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;TAS&quot;&amp;gt;TAS&amp;lt;/option&amp;gt;&#xA;                        &amp;lt;option value=&quot;NT&quot;&amp;gt;NT&amp;lt;/option&amp;gt;&#xA;                    &amp;lt;/select&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;                {% if charge is defined %}&#xA;                    {% for error in charge.getErrors('simpleText') %}&#xA;                    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;                    {% endfor %}&#xA;                {% endif %}&#xA;&#xA;&#xA;         &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;cardDet-form&quot;&amp;gt;&#xA;            &amp;lt;h4&amp;gt;Plan Details&amp;lt;/h4&amp;gt;&#xA;            {{ stripe.amountField({&#xA;                label: 'Amount',&#xA;                value: options,&#xA;                readonly: true&#xA;            }) }}&#xA;&#xA;            &amp;lt;h4&amp;gt;Card Details&amp;lt;/h4&amp;gt;&#xA;             {% if charge is defined and charge.cardToken %}&#xA;            {# We already have the card details #}&#xA;            Pay with : {{ charge.cardType }} - {{ charge.cardLast4 }}&#xA;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardToken&quot; value=&quot;{{ charge.cardToken }}&quot; data-stripe=&quot;token&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardLast4&quot; value=&quot;{{ charge.cardLast4 }}&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardType&quot; value=&quot;{{ charge.cardType }}&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardName&quot; value=&quot;{{ charge.cardName }}&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpMonth&quot; value=&quot;{{ charge.cardExpMonth }}&quot;/&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpYear&quot; value=&quot;{{ charge.cardExpYear }}&quot;/&amp;gt;&#xA;&#xA;          {% else %}&#xA;            &amp;lt;label for=&quot;cardNumber&quot;&amp;gt;Card Number&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; data-stripe=&quot;number&quot; placeholder=&quot;•••• •••• •••• ••••&quot; id=&quot;cardNumber&quot;/&amp;gt;&#xA;&#xA;           &amp;lt;label for=&quot;cardExpiry&quot;&amp;gt;Card Expiry&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; data-stripe=&quot;exp&quot; placeholder=&quot;mm / yy&quot; id=&quot;cardExpiry&quot;/&amp;gt;&#xA;&#xA;            &amp;lt;label for=&quot;cardCvc&quot;&amp;gt;Card CVC&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; data-stripe=&quot;cvc&quot; placeholder=&quot;123&quot; id=&quot;cardCvc&quot;/&amp;gt;&#xA;          {% endif %}&#xA;&#xA;            &amp;lt;div id=&quot;payment-errors&quot; class=&quot;alert alert-error&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;            {% include 'charge/_includes/inputs/paymentButton' %}&#xA;&#xA;         &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;        &amp;lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;        &amp;lt;script src=&quot;{{ resourceUrl('charge/js/stripe_v2.min.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;        &amp;lt;script src=&quot;{{ resourceUrl('charge/js/jquery.charge.js') }}&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;        &amp;lt;script&amp;gt;&#xA;            (function () {&#xA;            Stripe.setPublishableKey('{{ craft.charge.getPublicKey() }}');&#xA;            $(this).charge();&#xA;            })();&#xA;        &amp;lt;/script&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7542" LastActivityDate="2017-11-22T03:16:47.737" Title="Missing required param: card[exp_month] on Charge 2" Tags="&lt;form&gt;&lt;craft-pro&gt;&lt;plugin-charge&gt;&lt;payment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22926" PostTypeId="2" ParentId="22924" CreationDate="2017-11-22T03:16:47.737" Score="2" Body="&lt;p&gt;Add the following hidden inputs below the &lt;code&gt;&amp;lt;input type=&quot;text&quot; data-stripe=&quot;exp&quot; placeholder=&quot;mm / yy&quot; id=&quot;cardExpiry&quot;/&amp;gt;&lt;/code&gt; line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpMonth&quot; data-stripe=&quot;exp_month&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;cardExpYear&quot; data-stripe=&quot;exp_year&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The example in the documentation seems to be missing that information but you can find it in the provided templates.&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2017-11-22T03:16:47.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22927" PostTypeId="2" ParentId="21619" CreationDate="2017-11-22T04:00:56.450" Score="2" Body="&lt;p&gt;So you're accessing &lt;code&gt;craft.config.cache&lt;/code&gt; but unless you've actually added your own &lt;code&gt;cache&lt;/code&gt; config setting in &lt;code&gt;craft/config/general.php&lt;/code&gt; that's not going to work. There's no &lt;code&gt;cache&lt;/code&gt; setting in Craft's &lt;a href=&quot;https://craftcms.com/docs/config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Config Settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the reason it works on &lt;code&gt;live&lt;/code&gt; production is it's a soft error, and you have &lt;code&gt;devMode&lt;/code&gt; off, so it continues to work. In &lt;code&gt;local&lt;/code&gt; dev, presumably you have &lt;code&gt;devMode&lt;/code&gt; on, so it rightly errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on Craft cache tags, you can read the &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt; article.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-22T04:00:56.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22928" PostTypeId="2" ParentId="2789" CreationDate="2017-11-22T04:34:06.280" Score="2" Body="&lt;p&gt;You could always just use the &lt;a href=&quot;https://github.com/nystudio107/minify&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minify plugin&lt;/a&gt; and wrap whatever you want in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% minify %}&#xA;&#xA;{% endminify %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If works with inline CSS/JS, too.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-11-22T04:34:06.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22931" PostTypeId="2" ParentId="17546" CreationDate="2017-11-22T05:10:33.943" Score="1" Body="&lt;p&gt;You have to insert this below your textfields &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if charge is defined %}&#xA;    {% for error in charge.getErrors('FieldNameHere') %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7542" LastEditorUserId="57" LastEditDate="2017-11-22T22:13:35.017" LastActivityDate="2017-11-22T22:13:35.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22932" PostTypeId="1" AcceptedAnswerId="22935" CreationDate="2017-11-22T09:41:22.617" Score="2" ViewCount="193" Body="&lt;p&gt;I would like to include a file on every block but the last three. How can I accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2017-11-22T11:03:12.420" Title="Get the three last Matrix blocks" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22933" PostTypeId="2" ParentId="22932" CreationDate="2017-11-22T10:00:10.847" Score="2" Body="&lt;p&gt;You can fetch all elements and slice the last 3 elements from them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesList = entry.fieldHandle.find() %}&#xA;{% set start = entriesList|length - 3 %}&#xA;{% set end = entriesList|length %}&#xA;{% set lastThree = entriesList | slice(start, end) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you need to make sure you have at least 3 objects your array&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-22T10:00:10.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22934" PostTypeId="1" AcceptedAnswerId="22937" CreationDate="2017-11-22T10:21:43.173" Score="1" ViewCount="101" Body="&lt;p&gt;I have an issue with a site I have just put live. devMode is still enabled even though the config site sets it as false for .com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; 'false',&#xA;        'siteName' =&amp;gt; 'sitename',&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'maxUploadFileSize' =&amp;gt; 33554432,&#xA;        'defaultSearchTermOptions' =&amp;gt; array(&#xA;            'subLeft' =&amp;gt; true,&#xA;            'subRight' =&amp;gt; true,&#xA;        ),&#xA;        ),&#xA;    '.com' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; 'false',&#xA;        'env' =&amp;gt; 'live',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did have a .dev option as well but removed this to see if it would make any difference but it hasn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I cleared all caches and still no joy devMode is still active. How can I clear this for the the live site has it logged it in the DB somewhere and it's not removing it?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2017-11-22T10:42:52.533" Title="Issue Devmode is still enable in multi-environment config file" Tags="&lt;devmode&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22935" PostTypeId="2" ParentId="22932" CreationDate="2017-11-22T10:27:02.537" Score="2" Body="&lt;p&gt;Inside of a for-loop you have access to some &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;special variables&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField %}&#xA;    {% set isEndBlock = loop.revindex &amp;lt;= 3 %}&#xA;&#xA;    {% if not isEndBlock %}&#xA;        {# do things #}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to change / override the default criteria of the Matrix field’s ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocksCount = entry.myMatrixField.count() %}&#xA;{% set isValid = blocksCount - 3 &amp;gt; 0 %}&#xA;&#xA;{% set startBlocks = isValid ? entry.myMatrixField({&#xA;    limit: blocksCount - 3,&#xA;}) : null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or criteria to get the last 3 blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set endBlocks = entry.myMatrixField({&#xA;    order: 'matrixblocks.sortOrder desc',&#xA;    limit: 3,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-11-22T11:03:12.420" LastActivityDate="2017-11-22T11:03:12.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22936" PostTypeId="2" ParentId="22934" CreationDate="2017-11-22T10:30:17.033" Score="1" Body="&lt;p&gt;The ordersequence of the environements does matter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;  '*' =&amp;gt; array(&#xA;    //yadayadayada&#xA;  ),&#xA;  // this has priority over the lower entry&#xA;  '.com' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;  ),&#xA;  // this has even lower priority&#xA;  '.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; false,&#xA;   ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2017-11-22T10:42:52.533" LastActivityDate="2017-11-22T10:42:52.533" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22937" PostTypeId="2" ParentId="22934" CreationDate="2017-11-22T10:40:08.380" Score="2" Body="&lt;p&gt;You’re setting the &lt;code&gt;devMode&lt;/code&gt; setting to the string &lt;code&gt;'false'&lt;/code&gt;, which seems to be evaluated to true. You need to set it to a boolean.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; false,&#xA;),&#xA;'.dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-11-22T10:40:08.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22941" PostTypeId="1" AcceptedAnswerId="22942" CreationDate="2017-11-22T17:00:50.270" Score="3" ViewCount="427" Body="&lt;p&gt;I have a public registration form process which assigns a specific group/permissions 'eventeer' to a user. This user can then login and can enter/edit information in a 'shared' section. 'Shared' meaning both admins + eventeer groups use the same admin cp section form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue: I have one field that I dont want to expose to an 'eventeer' but only expose for admin. Can this be accomplished with craft v2.6+ and/or plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="6536" LastEditorUserId="45" LastEditDate="2017-11-22T18:37:01.063" LastActivityDate="2017-11-22T18:37:01.063" Title="Permissions at field level. Can this be done?" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22942" PostTypeId="2" ParentId="22941" CreationDate="2017-11-22T17:18:02.997" Score="2" Body="&lt;p&gt;Not natively, but there's the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpbodyclasses&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel Body Classes&lt;/a&gt; plugin, which would enable you to add the handle for your &quot;eventeers&quot; User Group as a CSS classname to the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag (i.e. &lt;code&gt;body.usergroup-eventeers&lt;/code&gt;, if &quot;eventeers&quot; is the handle for your User Group).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that classname in place, you could add some CSS to the Control Panel (easiest done w/ the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;CPCSS plugin&lt;/a&gt;) to hide the particular field, e.g. w/ something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;body.usergroup-eventeers #fields-yourFieldHandle-field {&#xA;    display: none;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or, if it makes sense, you could flip it around and have your field hidden by default, and visible only if the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; has the &lt;code&gt;.userlevel-admin&lt;/code&gt; classname - which would in effect hide the field from everybody except people w/ admin accounts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#fields-yourFieldHandle-field {&#xA;    display: none;&#xA;}&#xA;&#xA;body.userlevel-admin #fields-yourFieldHandle-field {&#xA;    display: block;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Obviously, you'll need to change the &lt;code&gt;yourFieldHandle&lt;/code&gt; part for the field's selector to your field's actual handle.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, keep in mind that this will not be a &lt;em&gt;secure&lt;/em&gt; solution in the sense that the field will still be there, and any tech-savvy &quot;eventeer&quot; user can easily make the field appear by removing the above CSS rule in their browser's dev tools. However, in the current iteration of Craft it's as close as you'll come to accomplish what you want.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-11-22T17:29:27.943" LastActivityDate="2017-11-22T17:29:27.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22943" PostTypeId="1" AcceptedAnswerId="22969" CreationDate="2017-11-22T17:28:44.007" Score="3" ViewCount="815" Body="&lt;p&gt;I am working on a pagination for some articles. I am using a &lt;code&gt;for&lt;/code&gt; loop to get the 3 pages after and before the current page &lt;code&gt;.getPrevUrls(3)&lt;/code&gt; and &lt;code&gt;.getNextUrls(3)&lt;/code&gt;&#xA;So far it looks like this, where 35 is the last page and the black one is the current page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0NL4R.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0NL4R.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm trying to fix is when the current page is within the 3 page range &lt;code&gt;.getNextUrls(3)&lt;/code&gt; of the last page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vMsKY.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vMsKY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I create an &lt;code&gt;if statement&lt;/code&gt; to hide the dots and the last page if my current page is within 3 pages of the last one so that I don't get the last page number twice.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('mySection').limit(10) as pageInfo, pageEntries %}&#xA;&#xA;{% for page, url in pageInfo.getPrevUrls(3) %}&#xA;  &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span class=&quot;current&quot;&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;{% for page, url in pageInfo.getNextUrls(3) %}&#xA;  &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;&#xA;&amp;lt;a href=&quot;{{ pageInfo.lastUrl }}&quot;&amp;gt;{{pageInfo.totalPages}}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="979" LastEditDate="2017-11-27T18:31:51.700" LastActivityDate="2019-04-30T14:06:58.743" Title="Getting the last X number of pages in pagination" Tags="&lt;templating&gt;&lt;pagination&gt;&lt;loop&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22944" PostTypeId="1" AcceptedAnswerId="22947" CreationDate="2017-11-22T17:41:42.273" Score="1" ViewCount="127" Body="&lt;p&gt;I recently installed Calendar (latest 1.9.3) on my Craft install (latest 2.6.2997)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the demo templates provided by Calendar (/calendar_demo/), the month view, I am getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Call to a member function getTimestamp() on boolean in ../craft/app/helpers/DbHelper.php on line 597&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seem to narrow it down to the targetDate variable being set to &quot;today&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set targetDate = &quot;today&quot; %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if i go to the following url: &lt;code&gt;/calendar_demo/month/2017/11&lt;/code&gt; the month view works but the test event I have doesn't show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am on a Pro license and only plugins I have installed are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Contact Form (P&amp;amp;T)&lt;/li&gt;&#xA;&lt;li&gt;Focus Point&lt;/li&gt;&#xA;&lt;li&gt;Instagram Feed (currently disabled)&lt;/li&gt;&#xA;&lt;li&gt;Minimee&lt;/li&gt;&#xA;&lt;li&gt;Polls (currently disabled)&lt;/li&gt;&#xA;&lt;li&gt;Relabel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Again now sure what I am missing here any point in the right direction is welcomed.&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2017-12-07T14:24:03.233" Title="Calendar month view error" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;&lt;calendar&gt;&lt;plugin-calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22946" PostTypeId="2" ParentId="22922" CreationDate="2017-11-22T20:11:34.347" Score="1" Body="&lt;p&gt;You may want to try further limiting what you're returning from the API call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server may just have a low PHP memory size limit set. There are many answers to fix the PHP memory size bytes exhaustion error. Here's a few:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/415801/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-43148176-byte&quot;&gt;https://stackoverflow.com/questions/415801/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-43148176-byte&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/561066/fatal-error-allowed-memory-size-of-134217728-bytes-exhausted-codeigniter-xml&quot;&gt;https://stackoverflow.com/questions/561066/fatal-error-allowed-memory-size-of-134217728-bytes-exhausted-codeigniter-xml&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That is a PHP ini setting. If you don't have access to the php.ini file, you have to call &lt;a href=&quot;http://php.net/manual/en/function.ini-set.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;ini_set()&lt;/a&gt;&#xA; somewhere in your source code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This statement sets no memory limit, although I do not recommend using this: &lt;code&gt;ini_set('memory_limit','-1');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try the lowest amount that you can afford before deploying application, as this can cause server issues if too much memory is allocated to by a bad PHP script.&lt;/p&gt;&#xA;" OwnerUserId="6978" LastEditorUserId="6978" LastEditDate="2017-11-22T20:16:49.893" LastActivityDate="2017-11-22T20:16:49.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22947" PostTypeId="2" ParentId="22944" CreationDate="2017-11-23T06:58:08.797" Score="1" Body="&lt;p&gt;&lt;strong&gt;UPDATED RESPONSE...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We were finally able to get to the bottom of this and traced the issue down to your site likely having a &lt;strong&gt;DateTime&lt;/strong&gt; field with the handle &lt;code&gt;date&lt;/code&gt;, and this was apparently something Craft was choking on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next version of Calendar will fix this, but you can resolve this by renaming that &lt;strong&gt;DateTime&lt;/strong&gt; field or patch this by looking for this code in &lt;em&gt;calendar/services/Calendar_EventsService.php&lt;/em&gt; around &lt;em&gt;line 100&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEventList($criteria = null)&#xA;{&#xA;    if (!isset($criteria['allowedCalendarsOnly'])) {&#xA;        $criteria['allowedCalendarsOnly'] = false;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And right after that, add this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if (isset($criteria['date'])) {&#xA;        unset($criteria['date']);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if this resolves the issue for you. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="4496" LastEditDate="2017-12-07T14:24:03.233" LastActivityDate="2017-12-07T14:24:03.233" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22948" PostTypeId="1" AcceptedAnswerId="22949" CreationDate="2017-11-23T10:21:23.480" Score="6" ViewCount="8385" Body="&lt;p&gt;I can see that &lt;code&gt;craft.request.firstSegment&lt;/code&gt; and &lt;code&gt;craft.request.lastSegment&lt;/code&gt; works but &lt;code&gt;craft.request.secondSegment&lt;/code&gt; does not. Is there a way (as in ExpressionEngine) to get the value of any URL segment? &lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="125" LastEditDate="2017-11-23T10:49:57.473" LastActivityDate="2019-06-17T14:37:31.707" Title="How to get a URL segment" Tags="&lt;segments&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22949" PostTypeId="2" ParentId="22948" CreationDate="2017-11-23T10:37:37.470" Score="11" Body="&lt;p&gt;Craft 2: &lt;code&gt;craft.request.getSegment(2)&lt;/code&gt;, see &lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.request.html#getsegment-n&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3: &lt;code&gt;craft.app.request.getSegment(2)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="5261" LastEditDate="2019-06-17T14:37:31.707" LastActivityDate="2019-06-17T14:37:31.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22950" PostTypeId="2" ParentId="22948" CreationDate="2017-11-23T10:45:33.653" Score="6" Body="&lt;p&gt;There's also another way that would be more consistent, in case your segments are &lt;strong&gt;not always&lt;/strong&gt; in the same segments array &lt;strong&gt;position&lt;/strong&gt;.&#xA;You'd make your routes to match a certain mask in the &lt;strong&gt;routes.php&lt;/strong&gt; file like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  '&amp;lt;country_code:[a-z]{2}(-[a-z]{2})?&amp;gt;/&amp;lt;section_URI:team&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'team']&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your &lt;strong&gt;twig&lt;/strong&gt; template you could access the variables &lt;code&gt;country_code&lt;/code&gt; and &lt;code&gt;section_URI&lt;/code&gt; as long as these two were provided in the URL, otherwise they'll be undefined, which you can also check.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if country_code is defined %}&#xA;   //Do something with country_code&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The syntax used in Craft 3 routing differs from the one in Craft 2: &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#url-rules&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="9" LastEditDate="2018-11-02T18:50:27.123" LastActivityDate="2018-11-02T18:50:27.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22951" PostTypeId="1" AcceptedAnswerId="22975" CreationDate="2017-11-23T17:06:18.983" Score="1" ViewCount="263" Body="&lt;p&gt;I'm working on an inherited site where I have a sprout form and am adding additional fields. I have added a date/time field to the form with the settings in this screenshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WGZsi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WGZsi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template where all other fields are working I have added the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{{ craft.sproutForms.displayField('contact.targetProjectDate') }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This field does not display and there is nothing in the source either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-08-13T13:42:57.107" Title="Sprout Form Date/Time field not displaying" Tags="&lt;form&gt;&lt;datetime&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22953" PostTypeId="1" CreationDate="2017-11-24T08:13:31.663" Score="1" ViewCount="47" Body="&lt;p&gt;Is there a clean way to use angular in a dashboard widget for Craft 3 or craft 2? When the widget is created I can use it after a site refresh with no problems but I don't know if there is a hook or some kind of a javascript callback after the html is loaded so I can use my &lt;code&gt;$compile&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not that experienced with angular yet so maybe my question is wrong here but since I'm able to run angular after every other dynamic html change I want to ask here. I know I can use this function in order to compile the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;angular.element(document).injector().invoke(&#xA;    [&#xA;        &quot;$compile&quot;, function ($compile) {&#xA;            var scope = angular.element(document).scope();&#xA;            $compile(document)(scope);&#xA;            scope.$apply();&#xA;         }&#xA;    ]&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I need some callback event to fire it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-24T08:20:58.793" LastActivityDate="2017-11-24T08:20:58.793" Title="Angular 1.6 in Dashboard widget" Tags="&lt;plugin-development&gt;&lt;dashboard-widgets&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22954" PostTypeId="1" AcceptedAnswerId="23002" CreationDate="2017-11-24T11:47:02.233" Score="2" ViewCount="145" Body="&lt;p&gt;I've setup a custom email notification that is sent out after submitting a form. I want to have a set message but with a personalised greeting &quot;Hi Bob&quot;. I have the email.html file and that works but I can't figure out how to display the persons name. In my example the field handle it yourName and the form handle is contactForm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4865" LastActivityDate="2017-11-29T14:32:28.677" Title="How to get submitted data in Sprout Forms custom email" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22955" PostTypeId="2" ParentId="20350" CreationDate="2017-11-24T13:04:35.677" Score="3" Body="&lt;p&gt;What you could try to do, though I don't know if this will work, is use the same form that craft CP uses in the backend. Using Google f12 I managed to find this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;userform&quot; class=&quot;pane&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; autocomplete=&quot;off&quot; data-saveshortcut=&quot;&quot; data-saveshortcut-redirect=&quot;users/{id}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;//Forms you want user to input&#xA;&amp;lt;input type=&quot;submit&quot; class=&quot;btn submit&quot; value=&quot;Save&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above form is the same form that Craft uses natively to register users so it might work. Obviously, your admins will require the privileges to register users.&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2017-11-24T13:04:35.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22956" PostTypeId="1" AcceptedAnswerId="23047" CreationDate="2017-11-24T23:05:49.263" Score="1" ViewCount="59" Body="&lt;p&gt;I am trying to compare two fields located on Variants in Commerce. One is the price field and then I also have an original price field which is a custom field. I want to compare and get all variants where the price is less than the original price.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;            -&amp;gt;from('commerce_variants')&#xA;            -&amp;gt;where(&quot;price &amp;lt; field_originalPrice&quot;)&#xA;            -&amp;gt;queryAll();&#xA;&#xA;return $query;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far but could be way off on this since that custom field is actually on the &lt;code&gt;content&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be awesome! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2017-11-25T22:37:19.953" LastActivityDate="2017-12-04T22:00:47.843" Title="Building a DbCommand to compare two columns on Variants" Tags="&lt;plugin-craftcommerce&gt;&lt;createcommand&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22957" PostTypeId="2" ParentId="22566" CreationDate="2017-11-25T07:06:25.640" Score="1" Body="&lt;p&gt;Totally possible. Easy way to do it, is to add a hidden input field to the form for whatever section you want to search – the input field can be named anything, e.g. &lt;code&gt;s&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;s&quot; value=&quot;vegetables&quot;/&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above would add an additional GET variable to the search request, named &lt;code&gt;s&lt;/code&gt;. Just like with the &lt;code&gt;q&lt;/code&gt; parameter, you can use &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.request&lt;/code&gt;&lt;/a&gt; to pick up that parameter's value in your search results template, and add it to the the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; (i.e. &lt;code&gt;craft.entries&lt;/code&gt;, in this case):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set section = craft.request.getParam('s')|default('news') %}&#xA;{% set entries = craft.entries.section(section).search(query).order('score') %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that it's wise to use the &lt;code&gt;|default&lt;/code&gt; filter to add a default value to the &lt;code&gt;section&lt;/code&gt; variable, in case the &lt;code&gt;s&lt;/code&gt; GET parameter is missing or empty, for some reason – if you don't pass a section handle to the ECM, Craft searches &lt;em&gt;all&lt;/em&gt; sections, which is probably not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further: If you wanted to search multiple sections, you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;s[]&quot; value=&quot;vegetables&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;s[]&quot; value=&quot;fruits&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;s[]&quot; value=&quot;berries&quot;/&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and if you wanted to give the user control over which sections to search, you could opt for an input type other than hidden, e.g. checkboxes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;s[]&quot; value=&quot;vegetables&quot;/&amp;gt;Vegetables&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;s[]&quot; value=&quot;fruits&quot;/&amp;gt;Fruits&#xA;&amp;lt;input type=&quot;checkbox&quot; name=&quot;s[]&quot; value=&quot;berries&quot;/&amp;gt;Berries&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally, the same strategy would, of course, work fine for any other parameter/field value you can pass to an ElementCriteriaModel. You could, for instance, add a dropdown field enabling the user to filter search results by author:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;    &amp;lt;select name=&quot;a&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;All authors&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;3&quot;&amp;gt;Julia&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;53&quot;&amp;gt;Gary&amp;lt;/option&amp;gt;&#xA;        &amp;lt;option value=&quot;13&quot;&amp;gt;Susie&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Go&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, it'd probably make sense to default to &lt;code&gt;null&lt;/code&gt;, which would give you results for all authors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set authorId = craft.request.getParam('a')|default(null) %}&#xA;{% set entries = craft.entries.authorId(author).search(query).order('score') %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2017-11-25T07:11:45.950" LastActivityDate="2017-11-25T07:11:45.950" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22960" PostTypeId="1" CreationDate="2017-11-26T13:04:38.713" Score="1" ViewCount="52" Body="&lt;p&gt;When i applied discounts, &lt;a href=&quot;https://dev.iyzipay.com/en/checkout-form/initialize&quot; rel=&quot;nofollow noreferrer&quot;&gt;my payment gateway&lt;/a&gt; gives an error. It says that &lt;em&gt;Basket items price must be greater than zero&lt;/em&gt;. Here is the section that takes items in cart:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Add items&#xA;    $basketItems = [ ];&#xA;    $items       = $this-&amp;gt;getItems();&#xA;&#xA;    foreach ($items as $item) {&#xA;        $basketItem = new \Iyzipay\Model\BasketItem();&#xA;        $basketItem-&amp;gt;setId(&quot;item:&quot; . $item-&amp;gt;getName());&#xA;        $basketItem-&amp;gt;setName($item-&amp;gt;getName());&#xA;        $basketItem-&amp;gt;setCategory1(&quot;Category1&quot;);&#xA;        $basketItem-&amp;gt;setCategory2(&quot;Category2&quot;);&#xA;        $basketItem-&amp;gt;setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL);&#xA;        $basketItem-&amp;gt;setPrice('' . ($item-&amp;gt;getPrice() * $item-&amp;gt;getQuantity()));&#xA;&#xA;        array_push($basketItems, $basketItem);&#xA;    }&#xA;&#xA;    $request-&amp;gt;setBasketItems($basketItems);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without discounts plugin works fine. I can get payments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One additional thing is; that payment gateway accepts two basket amount as &lt;a href=&quot;https://dev.iyzipay.com/en/checkout-form/initialize#request&quot; rel=&quot;nofollow noreferrer&quot;&gt;price and paidPrice&lt;/a&gt; which is total amount of basket and final amount(tax+discount+sale...) respectively. But when i look at my plugin this amount is set as same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getData ()&#xA;{&#xA;    $card = $this-&amp;gt;getCard();&#xA;&#xA;    $amount = '' . $this-&amp;gt;getAmount();&#xA;&#xA;    $email     = $card-&amp;gt;getEmail();&#xA;    $firstName = $card-&amp;gt;getFirstName();&#xA;    $lastName  = $card-&amp;gt;getLastName();&#xA;    $fullName  = $firstName . ' ' . $lastName;&#xA;&#xA;    $billingAddress = $card-&amp;gt;getBillingAddress1() . ' ' . $card-&amp;gt;getBillingAddress2();&#xA;    $billingCity    = $card-&amp;gt;getBillingCity();&#xA;    $billingCountry = $card-&amp;gt;getBillingCountry();&#xA;&#xA;    $shippingAddress = $card-&amp;gt;getShippingAddress1() . ' ' . $card-&amp;gt;getShippingAddress2();&#xA;    $shippingCity    = $card-&amp;gt;getShippingCity();&#xA;    $shippingCountry = $card-&amp;gt;getShippingCountry();&#xA;&#xA;&#xA;    $request = new \Iyzipay\Request\CreateCheckoutFormInitializeRequest();&#xA;    $request-&amp;gt;setLocale(\Iyzipay\Model\Locale::TR);&#xA;    $request-&amp;gt;setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT);&#xA;    $request-&amp;gt;setCurrency('TRY');&#xA;    $request-&amp;gt;setConversationId('' . $this-&amp;gt;getTransactionId());&#xA;    $request-&amp;gt;setPrice($amount);&#xA;    $request-&amp;gt;setPaidPrice($amount);&#xA;    $request-&amp;gt;setCallbackUrl($this-&amp;gt;getReturnUrl());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Shouldn't be the price and paidPrice be different? May be these two are not related but i want to mention.&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2018-09-17T07:32:20.547" Title="Making discounts gives error on payment gateway" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;payment-methods&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22961" PostTypeId="1" CreationDate="2017-11-27T04:35:57.817" Score="1" ViewCount="54" Body="&lt;p&gt;Is there a way to add an additional one off fee using Charge plugin? Example situation: I need to charge my subscriber $150 USD per month.  However, for the first month only, there is an additional $50 USD for the set-up fee.&lt;/p&gt;&#xA;" OwnerUserId="7542" LastEditorUserId="57" LastEditDate="2017-11-27T05:17:46.207" LastActivityDate="2017-11-27T05:17:46.207" Title="With the Charge plugin, can you add an additional one-off fee on subscription?" Tags="&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22962" PostTypeId="1" CreationDate="2017-11-27T08:04:48.140" Score="2" ViewCount="208" Body="&lt;p&gt;I have some parent and their child categories which has more than one child.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an entry I have a category field where I selected a single child category (Bourbon) which is visible like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JBgOX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JBgOX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to show the title and URL of the only selected single child category which is Bourbon.&lt;/p&gt;&#xA;" OwnerUserId="6329" LastEditorUserId="57" LastEditDate="2017-11-27T19:47:19.560" LastActivityDate="2017-11-27T19:47:19.560" Title="How to fetch only selected child category?" Tags="&lt;craft-features&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22963" PostTypeId="2" ParentId="22962" CreationDate="2017-11-27T10:17:18.643" Score="2" Body="&lt;p&gt;I'm not really sure why craft is working that way and I'm not really sure if my way is the intended to solve it but it works at least for me. Make sure you select the one that fits best for you. Usually the best is the third one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First solution&lt;/strong&gt;&lt;br&gt;&#xA;If you have a limitation in your field how many categories you can link the &lt;code&gt;.last()&lt;/code&gt; function would suit since your child is always the last element and your parent is the first one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.fieldHandle.last() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this does not work if you are going to relate multiple Cateogies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second Solution&lt;/strong&gt;&lt;br&gt;&#xA;If your selected categories are always at level 2 and never at level 1 you can do the following. This works for multiple categories as well &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = entry.fieldHandle.level(2).all() %}&#xA;{% for category in categories %}&#xA;    {{ category.id }}&#xA;    {{ category.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Third solution&lt;/strong&gt;&lt;br&gt;&#xA;Change your matrix structure into two different channels (countries and continent) and relate your continent with your countries. In your relation field you restrict the selection to those two groups.&#xA;That way a user can select the country and/or a continent individually.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-27T10:25:50.813" LastActivityDate="2017-11-27T10:25:50.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22964" PostTypeId="1" AcceptedAnswerId="22965" CreationDate="2017-11-27T11:39:45.863" Score="2" ViewCount="1070" Body="&lt;p&gt;I have 3 sets of globals, which use the same fields handles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ firstGlobalHandle.aFieldHandle }}&#xA;{{ secondGlobalHandle.aFieldHandle }}&#xA;{{ thirdGlobalHandle.aFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In a child template, I set a variable corresponding to the handle of the global group which I need to call&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set globalHandle = &quot;secondGlobalHandle&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now in the In the parent template, I would like to do the following :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ '{{ globalHandle }}'.aFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do so ?&lt;/p&gt;&#xA;" OwnerUserId="7564" LastActivityDate="2017-11-27T11:47:52.267" Title="nesting variables in twig" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22965" PostTypeId="2" ParentId="22964" CreationDate="2017-11-27T11:47:52.267" Score="2" Body="&lt;p&gt;OK, my bad, this was answered &lt;a href=&quot;https://craftcms.stackexchange.com/questions/703/calling-variables-dynamically?rq=1&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the solution :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ _context[ globalHandle ].aFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7564" LastActivityDate="2017-11-27T11:47:52.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22966" PostTypeId="2" ParentId="22864" CreationDate="2017-11-27T12:03:39.767" Score="1" Body="&lt;p&gt;I contacted the hosting company and they managed to fix the issue. They whitelisted the cookie name in their varnish caching system.&lt;/p&gt;&#xA;" OwnerUserId="7513" LastActivityDate="2017-11-27T12:03:39.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22967" PostTypeId="1" AcceptedAnswerId="22980" CreationDate="2017-11-27T15:08:58.700" Score="2" ViewCount="370" Body="&lt;p&gt;I've got a Matrix field called Emergency Contacts (handle: emergencyContact) that I'm setting up so that users can add/update on the front end.  It has one block type - contact - with 4 fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Name (Plain Text - handle: contactName)&lt;/li&gt;&#xA;&lt;li&gt;Relationship (Dropdown - handle: contactRelationship)&lt;/li&gt;&#xA;&lt;li&gt;Phone (Input Mask - handle: contactPhone)&lt;/li&gt;&#xA;&lt;li&gt;Email (Plain Text - handle: contactEmail)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have everything displaying correct when I show existing information.  However, when they go to enter a new emergency contact, I can't figure out the right syntax to populate the dropdown menu to populate with the options for them to select.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my code.  I've tried several different things, most of which gave me an error.  This is my latest attempt.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emergencyContact][new1][type]&quot; value=&quot;contact&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emergencyContact][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactName&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[emergencyContact][new1][fields][contactName]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactRelationship&quot;&amp;gt;Relationship&amp;lt;/label&amp;gt;&#xA;        &amp;lt;select name=&quot;fields[emergencyContact][new1][fields][contactRelationship]&quot;&amp;gt;&#xA;        {% for option in contactRelationship.options %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactPhone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[emergencyContact][new1][fields][contactPhone]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactEmail&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;email&quot; name=&quot;fields[emergencyContact][new1][fields][contactEmail]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone able to help me get this resolved?&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-11-28T12:54:00.520" Title="Front End Form with Dropdown in Matrix - Adding New" Tags="&lt;matrix&gt;&lt;frontend&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22968" PostTypeId="2" ParentId="22967" CreationDate="2017-11-27T15:29:44.267" Score="1" Body="&lt;p&gt;I don't think I have a &lt;em&gt;specific&lt;/em&gt; answer, but I can point you to a few posts that I think will help get you rolling. How are you creating a new row for your matrix field? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1318/how-to-get-matrix-editor-into-frontend&quot;&gt;Get a matrix editor into front-end&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12602/managing-frontend-js-for-matrix-fields&quot;&gt;Managing Front-end Matrix/js&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14107/how-can-i-repopulate-a-matrix-field-on-a-front-end-form&quot;&gt;Repopulating after validation&#xA;error&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-11-27T15:29:44.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22969" PostTypeId="2" ParentId="22943" CreationDate="2017-11-27T19:20:52.733" Score="6" Body="&lt;p&gt;As I already wrote in my comment 3 days ago something like this should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('mySection').limit(10) as pageInfo, pageEntries %}&#xA;&#xA;{% for page, url in pageInfo.getPrevUrls(3) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span class=&quot;current&quot;&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;{% for page, url in pageInfo.getNextUrls(3) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if pageInfo.totalPages - pageInfo.currentPage &amp;gt; 3 %}&#xA;    &amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ pageInfo.lastUrl }}&quot;&amp;gt;{{pageInfo.totalPages}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[EDIT]:&lt;/strong&gt; In the above script you will come across situations where the gap sometimes occurs between consecutive numbers, which can look silly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E8it6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E8it6.png&quot; alt=&quot;Gap between consecutive numbers&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2BIsM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2BIsM.png&quot; alt=&quot;Single page gap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix this you can add a little extra logic to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set amountVisible = amountVisible|default(2) %}&#xA;{% if pageInfo.currentPage &amp;gt; amountVisible + 1 %}&#xA;    &amp;lt;a href=&quot;{{ pageInfo.firstUrl }}&quot;&amp;gt;1&amp;lt;/a&amp;gt;&#xA;&#xA;    {% if pageInfo.currentPage == amountVisible + 3 %}&#xA;        &amp;lt;a href=&quot;{{ pageInfo.getPageUrl(2) }}&quot;&amp;gt;2&amp;lt;/a&amp;gt;&#xA;    {% elseif pageInfo.currentPage &amp;gt; amountVisible + 3 %}&#xA;        &amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% for page, url in pageInfo.getPrevUrls(amountVisible) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span class=&quot;current&quot;&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/span&amp;gt;&#xA;&#xA;{% for page, url in pageInfo.getNextUrls(amountVisible) %}&#xA;    &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% if pageInfo.totalPages - pageInfo.currentPage &amp;gt; amountVisible %}&#xA;    {% if pageInfo.totalPages - pageInfo.currentPage == amountVisible + 2 %}&#xA;        &amp;lt;a href=&quot;{{ pageInfo.getPageUrl(pageInfo.totalPages - 1) }}&quot;&amp;gt;{{pageInfo.totalPages - 1}}&amp;lt;/a&amp;gt;&#xA;    {% elseif pageInfo.totalPages - pageInfo.currentPage &amp;gt; amountVisible + 1 %}&#xA;        &amp;lt;span&amp;gt;...&amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ pageInfo.lastUrl }}&quot;&amp;gt;{{pageInfo.totalPages}}&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this added logic will do two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If there is no gap, it won't render a thing.&lt;/li&gt;&#xA;&lt;li&gt;If the gap only amounts to one page it will render a page number instead.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This results in the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/coymK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/coymK.png&quot; alt=&quot;No more &amp;quot;useless&amp;quot; gaps&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an added bonus: if you add the &lt;code&gt;amountVisible&lt;/code&gt; variable on top with a default value you can put this in a twig partial which you can then easily implement on the paged view like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% include 'partials/pager' with { pageInfo: pageInfo, amountVisible: 3 } %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that passing &lt;code&gt;pageInfo&lt;/code&gt; explicitly is not required, but I do it for the sake of completeness and to prevent accidental cleanups of &quot;unused&quot; vars.)&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="9503" LastEditDate="2019-04-30T14:06:58.743" LastActivityDate="2019-04-30T14:06:58.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22970" PostTypeId="1" AcceptedAnswerId="22972" CreationDate="2017-11-27T19:26:16.303" Score="3" ViewCount="1147" Body="&lt;p&gt;I am fairly new to twig and templating with Craft (and I have inherited this code, so that makes it even more fun).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a calendar page that lets you filter the events in the calendar based on a venti group (using the &lt;a href=&quot;https://venticalendar.io/docs/groups.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Venti Calendar&lt;/a&gt; plugin to create those groups).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it currently works is that whatever group filter is selected, the url updates to have that group ID as the last segment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filter Names and their IDs: Cinema = 1, Theatre = 2, Events = 3, Education = 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user is looking at the events for the month of December 2017 with no filters, the url looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;example.com/month/2017/12&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a user is looking at the events for the same date, but has a filter applied (in this case, the &quot;Cinema&quot; filter), the url looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;example.com/month/2017/12/1&lt;/code&gt; Cinema has group ID of &lt;code&gt;1&lt;/code&gt; so 1 is the last segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to change the applied filter without resetting the date, I want to trim the last segment from the url, and replace with the new ID as the last segment. Doing this works completely as expected unless the last segment and the last character of the previous segment are the same number (e.g., &lt;code&gt;example.com/month/2017/12/2&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, if I am currently on this URL, and I want to change to a different filter (in this example we change to use Cinema Filter = 1), the following happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;example.com/month/2017/1/1&lt;/code&gt; where it should actually be &lt;code&gt;example.com/month/2017/12/1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is happening is that it is trimming the &lt;code&gt;2&lt;/code&gt; from the last segment and the segment before the last segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code for the filter buttons:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set groups = craft.venti.groups() %}&#xA;    {% for group in groups %}      &#xA;        &amp;lt;a class=&quot;button&quot; href=&quot;&#xA;            {% spaceless %}&#xA;            {% if craft.request.getLastSegment() in ['1','2','3','4'] %}       &#xA;                {{url(craft.request.path)|trim('/' ~ &#xA;                craft.request.getLastSegment())}}/{{group.id}}&#xA;            {% else %}&#xA;                {{url(craft.request.path)}}/{{group.id}}&#xA;            {% endif %}&#xA;            {% endspaceless %}&quot;&amp;gt;&#xA;            {{ group }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove &lt;code&gt;'/' ~&lt;/code&gt; from this: &#xA;&lt;code&gt;{{url(craft.request.path)|trim('/' ~ craft.request.getLastSegment())}}/{{group.id}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It actually works perfectly, save for the fact that the new url looks like this: &lt;code&gt;example.com/month/2017/12//1&lt;/code&gt; With the addition of that second backslash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone see what I am doing wrong here, or provide any help? If you need more of my code, please let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7323" LastEditorUserId="57" LastEditDate="2017-11-27T22:23:52.710" LastActivityDate="2017-11-28T17:25:42.057" Title="Trimming lastSegment from a URI trims that PLUS the last number of the previous segment" Tags="&lt;templating&gt;&lt;filter&gt;&lt;segments&gt;&lt;calendar&gt;&lt;plugin-ventievents&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22971" PostTypeId="1" AcceptedAnswerId="23013" CreationDate="2017-11-27T19:35:15.847" Score="1" ViewCount="407" Body="&lt;p&gt;I have entered API Username, Password and Signature from PayPal and added 'tokenParam' =&gt; 'craftToken' in Craft config and yet when I try to make a payment using PayPal Express I get the following....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.site.com/index.php/actions/commerce/payments/completePayment?commerceTransactionId=114&amp;amp;commerceTransactionHash=0ec5451ed35b360311214dfa75aee88f&amp;amp;token=EC-9GX1527947961953D&amp;amp;PayerID=RFN3LXKUP6SVQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.site.com/index.php/actions/commerce/payments/completePayment?commerceTransactionId=114&amp;amp;commerceTransactionHash=0ec5451ed35b360311214dfa75aee88f&amp;amp;token=EC-9GX1527947961953D&amp;amp;PayerID=RFN3LXKUP6SVQ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the following error:  The requested URL was not found on this server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on what I have missed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$domain = 'www.site.com';&#xA;&#xA;if($_SERVER[&quot;HTTPS&quot;] != &quot;on&quot;)&#xA;{&#xA;    header(&quot;Location: https://&quot; . $domain . $_SERVER[&quot;REQUEST_URI&quot;]); exit(); &#xA;}&#xA;&#xA;define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;define('BASEPATH',    realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA;return array(&#xA;    '*' =&amp;gt; array(&#xA;            'siteUrl' =&amp;gt; SITE_URL,&#xA;            'environmentVariables' =&amp;gt; array(&#xA;            'siteUrl'  =&amp;gt; SITE_URL,&#xA;            'basePath' =&amp;gt; BASEPATH,&#xA;            'defaultImageQuality' =&amp;gt; 60,&#xA;            'omitScriptNameInUrls' =&amp;gt; true,&#xA;            'tokenParam' =&amp;gt; 't',&#xA;        ),&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FORM&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.paymentMethodId %}&#xA;&#xA;    &amp;lt;form method=&quot;POST&quot; class=&quot;form-horizontal&quot; id=&quot;paymentForm&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/shop/customer/order?number={number}&quot;/&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/shop/checkout/payment&quot;/&amp;gt;&#xA;&#xA;        {{ getCsrfInput() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3816" LastEditorUserId="57" LastEditDate="2017-11-30T00:40:08.487" LastActivityDate="2017-11-30T01:35:56.823" Title="PayPal Express not redirecting back to Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22972" PostTypeId="2" ParentId="22970" CreationDate="2017-11-27T22:23:18.337" Score="1" Body="&lt;p&gt;Twig's &lt;code&gt;|trim&lt;/code&gt; filter is just a wrapper for PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.trim.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;trim()&lt;/code&gt;&lt;/a&gt; method, which says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Strip whitespace (or other characters) from the beginning and end of a string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in your example, you're telling it to strip all &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;2&lt;/code&gt; from the beginning and end of the given string, which explains the output you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you'll be better off by installing something like the &lt;a href=&quot;https://github.com/victor-in/Craft-TwigPCRE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig PCRE&lt;/a&gt; plugin, which gives Twig full access to the PHP &lt;code&gt;preg_&lt;/code&gt; regex methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'd just do a &lt;code&gt;preg_match&lt;/code&gt; to target exactly what you're looking for and replacing it with new values as necessary.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-27T22:23:18.337" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22973" PostTypeId="1" CreationDate="2017-11-27T22:36:35.703" Score="1" ViewCount="121" Body="&lt;p&gt;I'm using the Element API plugin to try and search for addresses using minimum and maximum lat &amp;amp; lng values and then using target element within the criteria parameters to filter the results however it doesn't seem to be working based on the code below. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$locationCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Entry');    &#xA;$locationCriteria-&amp;gt;lat = array('and', '&amp;gt;='.$max_min_values['min_latitude'], '&amp;lt;='.$max_min_values['max_latitude']);&#xA;$locationCriteria-&amp;gt;long =  array('and', '&amp;gt;='.$max_min_values['min_longitude'], '&amp;lt;='.$max_min_values['max_longitude']);&#xA;$locations = $locationCriteria-&amp;gt;find();&#xA;&#xA;return [&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'xxx',&#xA;                'relatedTo' =&amp;gt; [&#xA;                    'and',&#xA;                    ['targetElement' =&amp;gt; $locations],&#xA;                ]&#xA;            ],&#xA;            'elementType' =&amp;gt; ElementType::Entry,&#xA;            'transformer' =&amp;gt; new Search(),&#xA;        ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas? &lt;/p&gt;&#xA;" OwnerUserId="311" LastEditorUserId="311" LastEditDate="2017-11-28T22:03:47.253" LastActivityDate="2017-11-28T22:03:47.253" Title="Using target element criteria to filter results" Tags="&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22974" PostTypeId="2" ParentId="22970" CreationDate="2017-11-28T00:06:05.663" Score="1" Body="&lt;p&gt;Instead of doing complicated things with the result of &lt;code&gt;getLastSegment()&lt;/code&gt;, can't you just get the 4th segment using &lt;code&gt;getSegment(4)&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the segment you’re interested in is not always in the same position, you could use &lt;code&gt;getSegments()&lt;/code&gt; and conditionally grab a part depending on count of segments returned.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.request.getSegments() %}&#xA;{% set filter = segments|length == 4 ? segments[3] : segments[1] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-11-28T17:25:42.057" LastActivityDate="2017-11-28T17:25:42.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22975" PostTypeId="2" ParentId="22951" CreationDate="2017-11-28T00:19:34.323" Score="1" Body="&lt;p&gt;In the end I switched it to a default text field and used jQuery datepicker.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2017-11-28T00:19:34.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22977" PostTypeId="2" ParentId="22971" CreationDate="2017-11-28T02:46:49.450" Score="1" Body="&lt;p&gt;Things I can think of to check:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you using test mode, or is this live (and have you got that set correctly in Commerce's settings?).  If live, test mode needs to be &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, do you have the appropriate action, redirect for complete payments and cancelled ones set in your form?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;&amp;gt;&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/cart/complete?number={{ cart.number }}&quot;&amp;gt;&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;/cart/payment&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, try disabling CSRF on your site for your testing - does that make a difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When do you get that url/error - is that when it's re-directing to Paypal, or when it is coming back?&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-11-28T02:46:49.450" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22978" PostTypeId="2" ParentId="22163" CreationDate="2017-11-28T11:30:50.163" Score="1" Body="&lt;p&gt;You could try and add the following condition to the .htaccess which should redirect everything to http, perhaps it'll work: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteCond %{HTTPS} off&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2017-11-28T11:30:50.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22979" PostTypeId="1" AcceptedAnswerId="22982" CreationDate="2017-11-28T12:45:43.880" Score="1" ViewCount="240" Body="&lt;p&gt;I am trying to retrieve an array of entries on a particular section where &lt;code&gt;inspectionDate&lt;/code&gt; is greater than today's date. Here is the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'inspections';&#xA;$criteria-&amp;gt;inspectionDate &amp;gt; '(&quot;now&quot;)';&#xA;$criteria-&amp;gt;order = 'dateCreated asc';&#xA;$inspections = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting a &lt;code&gt;Property &quot;Craft\ElementCriteriaModel.inspectionDate&quot; is not defined.&lt;/code&gt; error when trying to run this code.I have made sure that inspectionDate is the field handle and is also a date type.&lt;/p&gt;&#xA;" OwnerUserId="3470" LastActivityDate="2017-11-28T13:10:06.233" Title="Retrieve entries on custom field date using ElementCriteriaModel" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22980" PostTypeId="2" ParentId="22967" CreationDate="2017-11-28T12:54:00.520" Score="3" Body="&lt;p&gt;Your Code has two errors:&#xA;1.  was missing.&#xA;2. The way you were fetching options was wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the correct code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emergencyContact]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emergencyContact][new1][type]&quot; value=&quot;contact&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[emergencyContact][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactName&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[emergencyContact][new1][fields][contactName]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactRelationship&quot;&amp;gt;Relationship&amp;lt;/label&amp;gt;&#xA;        {% set matrixField = craft.fields.getFieldByHandle('emergencyContact') %}&#xA;        {% set blockTypes = matrixField.getFieldType.getSettings.getBlockTypes %}&#xA;            {% for blockType in blockTypes %}&#xA;                {% if blockType.handle == &quot;contact&quot; %}&#xA;                     {% for field in blockType.getFields() %}&#xA;                       {% if field.handle == &quot;contactRelationship&quot; %}&#xA;                          &amp;lt;select&amp;gt;&#xA;                          {% for option in field.settings.options %}&#xA;                             &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;                           {% endfor %}&#xA;                           &amp;lt;/select&amp;gt;&#xA;                        {% endif %}&#xA;                      {% endfor %}&#xA;                 {% endif %}&#xA;              {% endfor %}&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactPhone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[emergencyContact][new1][fields][contactPhone]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;    &amp;lt;fieldset class=&quot;cell small-3&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;contactEmail&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;email&quot; name=&quot;fields[emergencyContact][new1][fields][contactEmail]&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope it helps you.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-11-28T12:54:00.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22981" PostTypeId="2" ParentId="22979" CreationDate="2017-11-28T13:02:03.750" Score="2" Body="&lt;p&gt;The Error was because &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$criteria-&gt;inspectionDate &gt; '(&quot;now&quot;)';&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This way you can't get today's date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$date = new DateTime();&#xA;$formattedDate = $date-&amp;gt;format(DateTime::MYSQL_DATETIME);&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'inspections';&#xA;$criteria-&amp;gt;inspectionDate = '&amp;gt; '.$formattedDate;&#xA;$criteria-&amp;gt;order = 'dateCreated asc';&#xA;$inspections = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-11-28T13:10:06.233" LastActivityDate="2017-11-28T13:10:06.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22982" PostTypeId="2" ParentId="22979" CreationDate="2017-11-28T13:08:17.673" Score="2" Body="&lt;p&gt;It seems like a syntax error, you did not set the date correctly. This should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'inspections';&#xA;    $criteria-&amp;gt;inspectionDate = &quot;&amp;gt;&quot; . time();&#xA;    $criteria-&amp;gt;order = 'dateCreated asc';&#xA;    $inspections = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-28T13:08:17.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22983" PostTypeId="2" ParentId="21919" CreationDate="2017-11-28T14:16:57.700" Score="1" Body="&lt;p&gt;&lt;strong&gt;Disk usage over quota&lt;/strong&gt; is a possible cause for the error message &lt;code&gt;An error occurred when rendering a template&lt;/code&gt; in Craft CMS v2.x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you will see the same when trying to access the control panel, regardless of dev mode setting.&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2017-11-28T14:16:57.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22984" PostTypeId="1" AcceptedAnswerId="22986" CreationDate="2017-11-28T17:03:29.213" Score="1" ViewCount="142" Body="&lt;p&gt;I have a Matrix field named &quot;skillLevels&quot; with a single block type.&#xA;Each row has 2 fields, &quot;skillName&quot; and &quot;skillLevel&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;skillName is a relationship to another entry (Skills)&#xA;skillLevel is a simple integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building a custom plugin which takes post data from a form.&#xA;The form contains an entry ID ($groupId), a skill name and a value to use to modify the level of that skill.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$groupEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($groupId);&#xA;&#xA;    $skillLevels = $groupEntry-&amp;gt;skillLevels;&#xA;&#xA;    foreach($skillLevels as $skill){&#xA;       $skillLevel = $skill-&amp;gt;skillLevel; // outputs the skill level&#xA;       $skillName = $skill-&amp;gt;skillName; // this doesn't work&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$skill-&amp;gt;$skillLevel&lt;/code&gt; gives me the integer stored in that field.&#xA;But &lt;code&gt;$skill-&amp;gt;skillLevel&lt;/code&gt; does not gives me a model. I then tried using $skill-&gt;skillLevel-&gt;id but still no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I look through the Matrix rows to find the row that matches the skill name coming from the form Post data?&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="57" LastEditDate="2017-11-28T19:13:03.793" LastActivityDate="2017-11-28T19:13:03.793" Title="How can I work with related entries within a Matrix in a plug in?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22985" PostTypeId="2" ParentId="22984" CreationDate="2017-11-28T17:13:04.197" Score="3" Body="&lt;p&gt;It’s an entries field, so &lt;code&gt;$skill-&amp;gt;skillName&lt;/code&gt; returns just the ElementCriteriaModel prepared to query for one or more elements matching the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = $skill-&amp;gt;skillName-&amp;gt;first();&#xA;$skillName = $entry ? $entry-&amp;gt;title : null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-11-28T17:13:04.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22986" PostTypeId="2" ParentId="22984" CreationDate="2017-11-28T17:14:00.673" Score="3" Body="&lt;p&gt;Your &lt;code&gt;skillName&lt;/code&gt; is a object of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt; so it is just a query. In order to fetch the element you need to do &lt;code&gt;$skill-&amp;gt;skillName-&amp;gt;first()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should read the docs about how to fetch entries and how the elementCriteriaModel works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: your &lt;code&gt;$skillLevels&lt;/code&gt; and your &lt;code&gt;$skill-&amp;gt;skillName&lt;/code&gt; are both the same type of objects. Both are ready to use queries that have a iterable interface. So when you loop through them (like you do) the &lt;code&gt;find()&lt;/code&gt; method is executed which returns you all the populated query results. You don't load all relations for an entry when you do &lt;code&gt;getEntryById&lt;/code&gt; - you get just queries you can execute &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-28T17:19:13.203" LastActivityDate="2017-11-28T17:19:13.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22988" PostTypeId="2" ParentId="5272" CreationDate="2017-11-28T20:22:29.720" Score="4" Body="&lt;p&gt;In case it helps someone, my issue was the permissions for the root index.php file...It was 666 (writeable by group) and when I switched that file permissions to 644, the installation was able to move forward.&lt;/p&gt;&#xA;" OwnerUserId="7581" LastActivityDate="2017-11-28T20:22:29.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22989" PostTypeId="2" ParentId="20558" CreationDate="2017-11-28T22:30:53.640" Score="2" Body="&lt;p&gt;In case it helps someone, my issue was the permissions for the root index.php file...It was 666 (writeable by group) and when I switched that file permissions to 644, the installation was able to move forward.&lt;/p&gt;&#xA;" OwnerUserId="7581" LastActivityDate="2017-11-28T22:30:53.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22990" PostTypeId="1" AcceptedAnswerId="22991" CreationDate="2017-11-28T23:03:51.580" Score="2" ViewCount="129" Body="&lt;p&gt;I'm writing a plugin that works with Fields in various ways, one thing I need to do is get the category source groups available to a particular category field. I have the field's handle and id and can get it's &lt;code&gt;FieldModel&lt;/code&gt; instance from that. But that fieldModel doesn't appear to have any information about what sources it is using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, I have a Category field named 'peopleClassification', and it has the category group 'peopleWhoWorkHere' as it's source set in the field settings page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I inspect the FieldModel object for the peopleClassification field, I'd expect to see the id or handle for the peopleWhoWorkHere group somewhere inside the object. I'm dumping the variables and checking the API docs, and I don't see a way to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that the CategoriesService might have a method for returning sources for a given field ID, but I couldn't find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have suggestions on where in the API I can connect these two? It's obviously possible, else Craft wouldn't work at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I'm not working with specific entry objects here, I'm trying to match field handles to group handles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@carlcs answer got me to the info I needed (thanks). Here's how I completed it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$field-&amp;gt;getFieldType()-&amp;gt;getSettings()&lt;/code&gt; returns an array with various pieces of meta data including a &lt;code&gt;source&lt;/code&gt; field with a value like &lt;code&gt;group:42&lt;/code&gt;. That number is the category group ID I needed to create an instance of category group object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;list($type, $gid) = split(':', $field-&amp;gt;getFieldType()-&amp;gt;getSettings()['source']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use $gid to load an instance of the Group from categories service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categoryGroup = craft()-&amp;gt;categories-&amp;gt;getGroupById($gid);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$categoryGroup&lt;/code&gt; contained the info I needed, including the group's handle, which I used to create a list of categories.&lt;/p&gt;&#xA;" OwnerUserId="6105" LastEditorUserId="6105" LastEditDate="2017-11-29T15:00:50.257" LastActivityDate="2017-11-29T15:00:50.257" Title="Plugin Development: find source group used by field" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22991" PostTypeId="2" ParentId="22990" CreationDate="2017-11-28T23:16:27.123" Score="1" Body="&lt;p&gt;From the FieldModel you need to get the FieldTypeModel and then its settings. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = $field–&amp;gt;getFieldType()-&amp;gt;getSettings();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-11-28T23:16:27.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22992" PostTypeId="2" ParentId="17051" CreationDate="2017-11-28T23:19:38.250" Score="1" Body="&lt;p&gt;I created a callback on click in the .CodeMirror-gutters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init: function(e) {&#xA;    var a = this.codemirror;&#xA;    $('.CodeMirror-gutters').on('click',function(e){&#xA;        if(a.$textarea.hasClass('open')){ a.hide(); }&#xA;    });&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and added a Material Icons code icon to the .CodeMirror-gutters:after css:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.CodeMirror-gutters:after {&#xA;    font-family: 'Material Icons';&#xA;    etc...&#xA;    content: '\E86F';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so that when the user clicks the gutter in 'source' mode, it toggles back to 'visual' mode.&lt;/p&gt;&#xA;" OwnerUserId="7585" LastEditorUserId="7585" LastEditDate="2017-11-28T23:43:22.567" LastActivityDate="2017-11-28T23:43:22.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22993" PostTypeId="1" CreationDate="2017-11-29T03:20:43.230" Score="1" ViewCount="78" Body="&lt;p&gt;I just updated the Charge 2 plugin to latest (version 2.2.1) and when I try to create a new coupon, I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbException&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General&#xA;error: 1366 Incorrect integer value: '' for column 'amountOff' at row 1. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried various scenarios; entering a fixed amount for the coupon, a percentage amount as well as trying various payment types, and it gives the same error above, regardless of whether I choose a fixed or percentage amount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else ran into this issue and if so, have you figured out a solution for it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried reverting back to previous versions of the plugin, and I get the same error. That last version that worked with coupons was Charge 2.1.8. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft 2.6.2997, PHP 7.1, MySQL 5.7.2. &lt;/p&gt;&#xA;" OwnerUserId="7586" LastEditorUserId="45" LastEditDate="2017-11-29T05:05:01.820" LastActivityDate="2017-11-29T05:05:01.820" Title="Creating coupon using Charge 2 plugin" Tags="&lt;plugins&gt;&lt;error-message&gt;&lt;mysql&gt;&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22994" PostTypeId="1" AcceptedAnswerId="22995" CreationDate="2017-11-29T11:03:16.187" Score="3" ViewCount="2841" Body="&lt;p&gt;How do you query an Element by a custom field in Craft 3? &#xA;My first try, according to &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/element-queries.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;craftcms/docs&lt;/a&gt; was: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$country = Entry::find()&#xA;                -&amp;gt;section('countries')&#xA;                -&amp;gt;where(['LIKE', 'code', 'CA'])-&amp;gt;one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this throws an exception. Here &lt;code&gt;code&lt;/code&gt; is a custom text field. I've also tried &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8587/filter-users-by-a-custom-field&quot;&gt;some answers&lt;/a&gt; on stack exchange and many other combinations but they're for Craft 2 and neither they work.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2017-11-29T11:50:28.973" LastActivityDate="2019-12-20T19:38:13.923" Title="How to query an entry by a custom field in Craft 3" Tags="&lt;craft3&gt;&lt;query&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22995" PostTypeId="2" ParentId="22994" CreationDate="2017-11-29T11:13:47.427" Score="7" Body="&lt;p&gt;Your where clause is actually a query based where so you have to select the database fields instead of the field handles. When you want to do it with where you have to make it like that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$country  = Entry::find()-&amp;gt;section('countries')-&amp;gt;where([&#xA;    'content.field_code'    =&amp;gt; ['like', 'CA']&#xA;])-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is the correct documentation right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: you might want to call the &lt;code&gt;getRawSql()&lt;/code&gt; function in order to see the query and all selected rows. When you use your code you'll see why your sql throws an exception&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt; &lt;br&gt;&#xA;You don't need to read the following part, these are just some explanations to the &lt;code&gt;content.field_code&lt;/code&gt;part - if you are interested in Craft go ahead if not skip it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if you know that but Craft adds the prefix &lt;code&gt;field_&lt;/code&gt; to every fieldhandle in the &lt;code&gt;content&lt;/code&gt; table (the table where Craft stores your entire content). So for every field you create the database includes a column &lt;code&gt;field_+$field-&amp;gt;handle&lt;/code&gt; that's why you have to include the &lt;code&gt;field_&lt;/code&gt; in before your handle in the query above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if you are going to change that prefix for any reasons you could use &lt;code&gt;Craft::$app-&amp;gt;getContent()-&amp;gt;fieldColumnPrefix&lt;/code&gt; in order to fetch the current column prefix. I doubt many people will do this but I wanted to make sure you know it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the &lt;code&gt;ElementQuery&lt;/code&gt; (the class you actually call when you do &lt;code&gt;Entry::find()&lt;/code&gt; contains the following code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @var string|null The content table that will be joined by this query.&#xA; */&#xA;public $contentTable = '{{%content}}';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is hard coded so only the developers from craft can make really deep changes here (unless you overwrite the structure in Craft) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the end: craft left joins the &lt;code&gt;content&lt;/code&gt; table and selects all columns. That's why you have to use &lt;code&gt;content.field_+$fieldHandle&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-11-29T13:45:19.763" LastActivityDate="2017-11-29T13:45:19.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22996" PostTypeId="1" CreationDate="2017-11-29T11:53:05.487" Score="1" ViewCount="238" Body="&lt;p&gt;I'm trying to set up a filtering system similar to the &lt;a href=&quot;http://www.asos.com/men/shoes-boots-trainers/cat/?cid=4209&amp;amp;refine=attribute_1027:7504%7Cbase_colour:11,16,33&amp;amp;currentpricerange=0-290&amp;amp;pgesize=36&quot; rel=&quot;nofollow noreferrer&quot;&gt;one found on the product pages on asos.com&lt;/a&gt;. That system has different category groups of filters, where selecting multiple filters inside a particular category group widens the results list (OR / conjuction), whereas filters across category groups narrow the results list (AND / disjunction).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to replicate this behaviour in Craft, but I'm struggling to combine AND and OR relations. I currently do the following to build up a list of filters across category groups from a comma separated query string in the form &lt;code&gt;?regions=22,33&amp;amp;teams=65&amp;amp;sectors=42,43,44&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryGroups = ['regions', 'teams', 'sectors', 'topics'] %}&#xA;{% set relations = ['and'] %}&#xA;{% for group in categoryGroups %}&#xA;  {% set filterValueString = craft.request.getParam(group) %}&#xA;  {% if filterValueString != '' %}&#xA;    {% set filterValues = filterValueString|split(',') %}&#xA;    {% set relations = relations|merge(filterValues) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% if relations | length &amp;gt; 1 %}&#xA;  {% set params = params | merge({ relatedTo: relations }) %}&#xA;{% endif %}&#xA;&#xA;{% set results = craft.entries(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a &lt;code&gt;relations&lt;/code&gt; array which looks like &lt;code&gt;['and', 22, 33, 42, 43, 44, 65]&lt;/code&gt;, and creates a system where adding a filter to an already filtered category group restricts the result set further, instead of widening it to encompass the new filter. I thought perhaps that I could construct &lt;code&gt;relations&lt;/code&gt; to look like &lt;code&gt;['and', [22, 33], [42, 43, 44], 65]&lt;/code&gt;, and the inner arrays (category groups) would default to an OR (as it would when passing a standard array of element IDs into &lt;code&gt;relatedTo&lt;/code&gt;), with the outer relation providing the AND, but this doesn't appear to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to get the behaviour I'm looking for?&lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2017-11-29T12:14:14.313" LastActivityDate="2017-11-29T12:39:36.100" Title="Building a filtering system using both OR and AND relations" Tags="&lt;categories&gt;&lt;relations&gt;&lt;logic&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22997" PostTypeId="2" ParentId="22996" CreationDate="2017-11-29T12:29:40.413" Score="2" Body="&lt;p&gt;I've looked at it further and arrived at a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;relations&lt;/code&gt; array needed to be in the form &lt;code&gt;['and', {element: [22, 33]}, {element: [42, 43, 44]}, {element: 65}]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that could be done using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relations = relations|merge([{element:filterValues}]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2017-11-29T12:39:36.100" LastActivityDate="2017-11-29T12:39:36.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22999" PostTypeId="1" AcceptedAnswerId="23010" CreationDate="2017-11-29T13:22:10.093" Score="1" ViewCount="646" Body="&lt;p&gt;I've created a simple migration to create a table for my plugin, but when I update the plugin via the CP, I get the following message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft was unable to install this update :( &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The site has been restored&#xA;  to the state it was in before the attempted update.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There was a problem updating your database.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As it's the only change to the plugin I think it's safe to say my migration isn't up to task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I know exactly what's wrong with my migration though? There don't appear to be any logs generated to show the actual error being caused. I'm running in &lt;code&gt;devMode&lt;/code&gt;, and I can't see anything in the browser console and there don't appear to be any errors in the standard logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here is the migration I'm trying to run, which was created manually rather than using &lt;code&gt;yiic&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_migrationName&#xA; */&#xA;class m171129_103222_myplugin_createLogTable extends BaseMigration&#xA;{&#xA;    /**&#xA;     * Any migration code in here is wrapped inside of a transaction.&#xA;     *&#xA;     * @return bool&#xA;     */&#xA;    public function safeUp()&#xA;    {&#xA;        craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;createTable('myplugin_log',&#xA;            array(&#xA;                'eventId' =&amp;gt; array(AttributeType::Number, 'required' =&amp;gt; true),&#xA;                'level' =&amp;gt; array('column' =&amp;gt; ColumnType::Varchar, 'maxLength' =&amp;gt; 5, 'required' =&amp;gt; true),&#xA;                'message' =&amp;gt; array(AttributeType::String, 'required' =&amp;gt; true),&#xA;                'date' =&amp;gt; array(AttributeType::DateTime, 'required' =&amp;gt; true),&#xA;            ));&#xA;&#xA;&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2018-12-06T17:01:11.860" LastActivityDate="2018-12-06T17:01:11.860" Title="How do you debug problems with a migration?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23000" PostTypeId="1" AcceptedAnswerId="23004" CreationDate="2017-11-29T14:00:05.157" Score="2" ViewCount="343" Body="&lt;p&gt;I need to display entries that contain an image, and a piece of text, on the home page of my website. &lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When someone clicks 'next', I would like it to go to the next entry (by post date) and display that entries image and text. I also need the user to be able to click on 'previous' (by post date again) and 'random'. &lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about this? &lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="7425" LastActivityDate="2017-11-29T15:03:34.430" Title="How do I display entries 1 by 1?" Tags="&lt;entries&gt;&lt;craft.entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23001" PostTypeId="2" ParentId="23000" CreationDate="2017-11-29T14:18:06.900" Score="1" Body="&lt;p&gt;You should read about how to create a plugin from the &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs&lt;/a&gt;, then you can create one with &lt;a href=&quot;http://Pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'll reload the entries with javascript in my example since I don't like reloading the page every single time and ajax is the way to go in these days. You can achieve this without any javascript/php code with only twig but users would have to refresh and reload the entire page then.&lt;/p&gt;&#xA;&lt;p&gt;First you need a Controller that loads your entry and return a template. You could as well increase your limit and show/hide the rest of the entries via javascript or css but since you asked for only one I'll provide the code to only show one.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSearchEntry()&#xA;{&#xA;    $offset = craft()-&amp;gt;request-&amp;gt;getParam('offset');&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = &amp;quot;news&amp;quot;;&#xA;    $criteria-&amp;gt;orderBy = &amp;quot;postDate&amp;quot;;&#xA;    $criteria-&amp;gt;limit = 1;&#xA;    $criteria-&amp;gt;offset = $offset;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;    $template = '';&#xA;    // to let your javascript know if it was successfuly&#xA;    $success = false;&#xA;    if($entries){&#xA;        $template = craft()-&amp;gt;templates-&amp;gt;render('path/to/your/template', array(&#xA;            'entry' =&amp;gt; $entries[0]&#xA;        ));&#xA;        $success = true;&#xA;    }else{&#xA;        // render some not found template or search again to show the first one or so&#xA;    }&#xA;    $this-&amp;gt;returnJson([&#xA;        'html'      =&amp;gt; $template,&#xA;        'success'   =&amp;gt; $success&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this is your javascript file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var offset = 0;&#xA;$(&amp;quot;#reloadButtonClick&amp;quot;).change(function(){&#xA;    offset++;&#xA;    var data = {&#xA;        action: &amp;quot;pluginname/controllerName/searchEntry&amp;quot;,&#xA;        offset: offset&#xA;    };&#xA;    $.ajax({&#xA;        type: &amp;quot;post&amp;quot;,&#xA;        url: '',&#xA;        data: data,&#xA;        success: function(data){&#xA;            if(data.success === true){&#xA;                $(&amp;quot;#idOfYourDiv&amp;quot;).html(data.html);&#xA;            }else{&#xA;                // display some errors or so&#xA;                offset = 0;&#xA;            }&#xA;        },&#xA;        error: function (XMLHttpRequest, textStatus) {&#xA;            console.log(&amp;quot;Status: &amp;quot; + textStatus);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When you want to &amp;quot;scroll&amp;quot; to the previous entry you have to decrease your offset at some point.&#xA;Note: this is just a very basic example to show you the direction, I did not include much error handling you should to that on your own&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-11-29T14:24:09.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23002" PostTypeId="2" ParentId="22954" CreationDate="2017-11-29T14:32:28.677" Score="2" Body="&lt;p&gt;Following Sprout Forms example templates (&lt;em&gt;/admin/sproutemail/settings/examples&lt;/em&gt;): in your email.html file &lt;code&gt;Hi {{ object['yourName'] }}&lt;/code&gt; or even &lt;code&gt;Hi {{ object.yourName }}&lt;/code&gt;, should print &lt;code&gt;Hi Bob&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-11-29T14:32:28.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23003" PostTypeId="1" CreationDate="2017-11-29T14:53:51.180" Score="2" ViewCount="253" Body="&lt;p&gt;I've been tasked with reviewing Craft as a potential solution for the company I work for and one of the requirements is that we need to be able to provide data from a external API in the page creating/editing interface in the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible and if so how?&lt;/p&gt;&#xA;" OwnerUserId="7593" LastEditorUserId="57" LastEditDate="2017-11-29T19:10:21.417" LastActivityDate="2017-11-29T19:52:33.823" Title="Is it possible to populate admin form with data supplied by an external API?" Tags="&lt;field&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;&lt;editing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23004" PostTypeId="2" ParentId="23000" CreationDate="2017-11-29T15:03:34.430" Score="4" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getNext&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getNext()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#getPrev&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getPrev()&lt;/code&gt;&lt;/a&gt; methods on your entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = craft.entries.section('yoursection').order('postDate asc') %}&#xA;&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{# to access url, I use #}&#xA;{{ prevEntry.url }}&#xA;{# to access title, I use #}&#xA;{{ prevEntry.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTE: I've shamelessly pinched this code from the answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14755/best-way-to-access-getprev-and-getnext-asset-fields&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to setup the &lt;code&gt;params&lt;/code&gt; variable so that it would create a list of entries which would include your current entry and the next/prev entries you expect. So include your ordering by &lt;code&gt;postDate&lt;/code&gt; etc.&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2017-11-29T15:03:34.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23005" PostTypeId="2" ParentId="23003" CreationDate="2017-11-29T15:19:18.143" Score="1" Body="&lt;p&gt;Short answer: yes it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long answer: there are quite a few ways to achieve that. You can create a custom plugin with a custom element type to create a list just like the normal entries in craft filled with your data. You can then - during the saving process - update the data with your api to sync it with whatever you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are kind of lazy you could just create a normal section for your entries with all the required fields from your api and create a cronjob/task/function to download/fetch all entries with your api and hook into a &lt;code&gt;onBeforeSaveEntry&lt;/code&gt; to validate the data and upload it to your api.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all in all yes. It's relative easy and can be done in quite a few hours/days once you get used to Craft because the CMS does many things for you. It renders all lists/forms and manages the entire saving, sorting, filtering and searching processes for you. You just have to import the data (easy thing) and export the data. If you require some special sort validations you can include those rules too and Craft displays all errors&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-29T15:19:18.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23006" PostTypeId="1" AcceptedAnswerId="23007" CreationDate="2017-11-29T15:31:43.983" Score="3" ViewCount="385" Body="&lt;p&gt;I have a matrix block that calls a category channel. The categories are nested three levels &quot;deep&quot; at times. I want to select first, second or third level links as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use .last(), I can get the full url path to return. When I use .nth(n), I have to specify a value, which automatically limits the link path to that level of &quot;deepness&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to &lt;strong&gt;get the .last() functionality, without using .last()?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;em&gt;.last() will be deprecated going forward in Craft 3 and beyond&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2019-02-22T19:00:08.913" Title="Need .last() functionality for categories – .last() will be deprecated going forward" Tags="&lt;categories&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23007" PostTypeId="2" ParentId="23006" CreationDate="2017-11-29T15:36:02.950" Score="4" Body="&lt;p&gt;If you are not going to update your current project to Craft 3 (which will break nearly all your templates and all plugins anyway) you don't need to bother about that message. This is only for Craft 3 and not for Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise looking in the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; might be a good idea. You can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries().section('news') %}&#xA;{% set total = query.count() %}&#xA;{% set last = query.nth(total - 1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set oldest = craft.entries()&#xA;    .section('news')&#xA;    .inReverse()&#xA;    .one() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2019-02-22T19:00:08.913" LastActivityDate="2019-02-22T19:00:08.913" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23008" PostTypeId="1" CreationDate="2017-11-29T16:24:00.167" Score="2" ViewCount="753" Body="&lt;p&gt;My log is getting hammered nonstop by the same error about every second (see image). Any idea what's going on here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level       error&#xA;Category    exception.Craft\HttpException.404&#xA;Message     Craft\HttpException in /home/folder/public_html/craft/app/controllers/TemplatesController.php:72&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w4fRl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w4fRl.png&quot; alt=&quot;Image here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6170" LastActivityDate="2017-12-06T01:57:14.380" Title="Constant exception.Craft\HttpException.404 in logs" Tags="&lt;error-message&gt;&lt;logs&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23009" PostTypeId="2" ParentId="23008" CreationDate="2017-11-29T16:27:48.523" Score="0" Body="&lt;p&gt;The Error is thrown here &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRender($template, array $variables = array())&#xA;{&#xA;    // Does that template exist?&#xA;    if (craft()-&amp;gt;templates-&amp;gt;doesTemplateExist($template))&#xA;    {&#xA;        $this-&amp;gt;renderTemplate($template, $variables);&#xA;    }&#xA;    else&#xA;    {&#xA;        throw new HttpException(404);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe you are trying to render a template that does not exist? &#xA;Are you not in dev mode and don't have a homepage template so it tries to redirect again and again? Or maybe the same issue with an error template? Do you have a &lt;code&gt;{% redirect %}&lt;/code&gt; in your templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: or maybe you deleted some files? You could output the $template variable in the controller in order to see which template causes the error&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-29T16:27:48.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23010" PostTypeId="2" ParentId="22999" CreationDate="2017-11-29T19:08:40.653" Score="2" Body="&lt;p&gt;Logs should be written to &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; to help debug issues like this.  It gets a little sketchy with fatal errors, though.  Logs get flushed to disk when the &lt;code&gt;onEndRequest&lt;/code&gt; event gets successfully fired.  If it's a fatal error that kills script execution, that event will never get fired and the logs don't get flushed.  That might have been what you're running into here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside of that, to answer your original question, the absolute best way to debug stuff like this is with &lt;a href=&quot;https://xdebug.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;xDebug&lt;/a&gt;.  &lt;a href=&quot;https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PhpStorm&lt;/a&gt; has a native xDebug client built in and it's pretty fantastic.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-29T19:08:40.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23011" PostTypeId="2" ParentId="23008" CreationDate="2017-11-29T19:19:20.020" Score="0" Body="&lt;p&gt;A 404 is just someone/something requesting a resources (path, image, JS file, CSS file, etc.) that your web server and Craft cannot resolve on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is on a publicly facing website, there's about a 99.99% chance it's just some script/bot probing different URLs for various endpoints to execute known exploits.  It's extremely common on any public facing website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look in your actual &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files instead of the log viewer in the Control Panel, you'll see the same 404's being logged along with the &lt;code&gt;REQUEST_URI&lt;/code&gt;.  That will show the non-existent path/resource that was requested.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-11-29T19:19:20.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23012" PostTypeId="2" ParentId="23003" CreationDate="2017-11-29T19:52:33.823" Score="0" Body="&lt;p&gt;A real easy way is to use something like the FeedMe plugin, &lt;a href=&quot;https://straightupcraft.com/craft-plugins/feed-me&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/feed-me&lt;/a&gt;,  against the api endpoint. Map it to your fields, give it a pending status so they are not live when imported. Then they can just open the entry and edit as they see fit.  As mention above, Run it against a cron job for a hands off daily import&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2017-11-29T19:52:33.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23013" PostTypeId="2" ParentId="22971" CreationDate="2017-11-30T01:35:56.823" Score="3" Body="&lt;p&gt;What's the output in your templates of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.config.tokenParam }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it isn't &lt;code&gt;t&lt;/code&gt; suspect your config is not setting the tokenParam for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you test with a stripped out general.php with only hard-coded values (No multi-environment config, or &lt;code&gt;if($_SERVER ...&lt;/code&gt; checks) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'tokenParam' =&amp;gt; 'myCraftToken'&#xA;    // ..other hard coded settings&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2017-11-30T01:35:56.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23014" PostTypeId="1" AcceptedAnswerId="23015" CreationDate="2017-11-30T02:45:24.807" Score="1" ViewCount="145" Body="&lt;p&gt;Why is it that in the below, referencing stRow.caption causes an error despite being wrapped in an &quot;if defined&quot; check?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\SuperTable_BlockModel and its behaviors do not have a method or&#xA;  closure named &quot;caption&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have to be doing something so catastrophically dumb that it's not sticking out yeah?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if stRow.caption is defined %}&#xA;    {% set caption = stRow.caption %} &amp;lt;&amp;lt;- This line causes the error&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same with using a null coelescing operator or a ternary operand.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ stRow.caption ?? &quot;&quot; }} &amp;lt;&amp;lt;- This causes the error&#xA;-- or --&#xA;{{ stRow.caption is defined ? stRow.caption : &quot;&quot; }}  &amp;lt;&amp;lt;- This causes the error too!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All three of those should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supertable: 1.0.4&#xA;Craft CMS: 2.6.2997&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2017-11-30T02:51:47.137" LastActivityDate="2017-11-30T04:49:19.567" Title="Is defined conditional passing, yet causes a &quot;do not have a method or closure named&quot; error" Tags="&lt;templating&gt;&lt;conditional&gt;&lt;plugin-supertable&gt;&lt;defined&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23015" PostTypeId="2" ParentId="23014" CreationDate="2017-11-30T04:49:19.567" Score="2" Body="&lt;p&gt;This is a weird twig behavior. You have to do &lt;code&gt;if   stRow['caption'] is defined&lt;/code&gt; to make it work because of the object syntax of twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes the if defined statement becomes true when you don't use the array syntax &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-11-30T04:49:19.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23016" PostTypeId="1" CreationDate="2017-11-30T09:29:50.110" Score="0" ViewCount="193" Body="&lt;p&gt;Pagination query/issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client/design for a site am building requires the first page to show fewer entries than subsequent pages so been guessing have to write some own/custom pagination jiggery pokery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I dynamically apply the values I want to pass into my &lt;code&gt;{% paginate %}&lt;/code&gt; tag it's not working as expected. Any thoughts why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To provide an example, I have a section with 20 entries in it. The first page should return 5 entries but subsequent pages should show 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So on page one I set a limit of &lt;code&gt;5&lt;/code&gt; and an offset of &lt;code&gt;0&lt;/code&gt;, eg &lt;code&gt;{% paginate list.offset(p).limit(l) as info, entries %}&lt;/code&gt; - where &lt;code&gt;list&lt;/code&gt; is my entries, &lt;code&gt;p&lt;/code&gt; is 0 and &lt;code&gt;l&lt;/code&gt; is 5 - and this works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for subsequent pages, eg for page 2 where &lt;code&gt;p&lt;/code&gt; is 5 and &lt;code&gt;l&lt;/code&gt; is 12` (offset of 5 and a limit of 12)  am only getting 3 entries on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? Do I just need to roll my pagination using &lt;code&gt;{% craft.entries %}&lt;/code&gt; instead? (edited)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;think will have to bypass native pagination entirely. If I dump out the info from my pagination query I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'first' =&amp;gt; 18&#xA;'last' =&amp;gt; 15&#xA;'total' =&amp;gt; 15&#xA;'currentPage' =&amp;gt; 2&#xA;'totalPages' =&amp;gt; 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a simpler way of rolling this out rather than some custom work?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="210" LastEditDate="2017-12-04T16:47:36.757" LastActivityDate="2017-12-04T16:47:36.757" Title="Pagination query" Tags="&lt;pagination&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23017" PostTypeId="2" ParentId="11838" CreationDate="2017-11-30T10:36:47.773" Score="2" Body="&lt;p&gt;Probably this has been fixed since this old question, but just wrapping &lt;code&gt;{{link}}&lt;/code&gt; variable in &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag lets me send custom HTML notifications with working clickable text links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot of messages settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aPsOj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aPsOj.png&quot; alt=&quot;Messages settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot of custom HTML email received:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p2zbB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p2zbB.png&quot; alt=&quot;Custom HTML email received&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps this won't work for the text version of the email, but if needed I suggest you to use this excellent plugin which let you send custom notifications in both HTML and text versions: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Emails&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-11-30T10:36:47.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23018" PostTypeId="2" ParentId="14745" CreationDate="2017-11-30T11:34:22.813" Score="2" Body="&lt;p&gt;A solution is now available in the Sprout Forms documentation: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/pre-populating-a-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example &gt; Pre-populating a Field&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2017-11-30T11:34:22.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23019" PostTypeId="2" ParentId="1709" CreationDate="2017-11-30T14:02:24.850" Score="3" Body="&lt;p&gt;I'm also struggeling with a multi-language scenario. We've got german as first locale, english as second and five other languages on top of it. The matrix field &lt;strong&gt;is marked as translatable&lt;/strong&gt; as are some text-blocks. I don't know how it happened but the contents and structure of the english entries were filled with the german content when I started to work on it. All other languages are empty. I tried to mark the matrix fields as not translatable, added a new locale and tried to resave the german pages. This leads to completely filled entries with german contents but the entries which already had translated content are overwritten by german texts. If I resave english entries, the english texts overwrite all others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, from my point of view this should be the workflow that leads to the best results:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with one locale&lt;/li&gt;&#xA;&lt;li&gt;Mark the matrix field as &quot;not translatable&quot;&lt;/li&gt;&#xA;&lt;li&gt;Mark the blocks in the matrix fields as translatable&lt;/li&gt;&#xA;&lt;li&gt;Finish your work on the first localization 100%&lt;/li&gt;&#xA;&lt;li&gt;Add all(!) additional locales at /settings/locales&lt;/li&gt;&#xA;&lt;li&gt;Add these locales to your section(s)&lt;/li&gt;&#xA;&lt;li&gt;Resave all entries of your initial language&lt;/li&gt;&#xA;&lt;li&gt;Fill your entries with translated content&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you add a new locale after that process you will have to start with an empty matrix. If not or if you have suggestions on a better workflow, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="5387" LastActivityDate="2017-11-30T14:02:24.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23020" PostTypeId="1" AcceptedAnswerId="23021" CreationDate="2017-11-30T15:30:08.140" Score="1" ViewCount="1149" Body="&lt;p&gt;I want to allow registered users to insert (i.e. upload) images into a Redactor rich text field in a front-end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dowloaded the Image Manager plugin from Imperavi (&lt;a href=&quot;https://imperavi.com/redactor/plugins/imagemanager/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/plugins/imagemanager/&lt;/a&gt;) and set up my Redactor config as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource &quot;lib/redactor/redactor.js&quot; %}&#xA;{% includeJsResource &quot;lib/redactor/plugins/source.js&quot; %}&#xA;{% includeJsResource &quot;lib/redactor/plugins/fullscreen.js&quot; %}&#xA;{% includeJsResource &quot;lib/redactor/plugins/imagemanager.js&quot; %}&#xA;{% includeCssResource &quot;lib/redactor/redactor.css&quot; %}&#xA;&#xA;{% set redactorJS %}&#xA;    $('#{{ elId }}').redactor({&#xA;        buttons: ['format', 'bold', 'italic', 'deleted', 'lists', 'link', 'html', 'image'],&#xA;        formatting: ['p', 'blockquote', 'h2', 'h3'],&#xA;        plugins: ['source','fullscreen', 'imagemanager'],&#xA;        minHeight: 300,&#xA;        imageUpload: '/upload.php',&#xA;    });&#xA;{% endset %}&#xA;{% includeJs redactorJS %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the image button in the toolbar and the browse files modal when I click the image button. However, it doesn’t upload anything because &lt;code&gt;imageUpload: '/upload.php',&lt;/code&gt; is obviously incorrect. What, if anything, can I replace &lt;code&gt;upload.php&lt;/code&gt; with? If this isn’t possible, what else could I do to achieve this functionality? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code in &lt;code&gt;craft/plugins/imagesuploaderscript/controllers/ImagesUploaderScriptController.php&lt;/code&gt; from CloudApp share link in comment below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;class ImagesUploaderScriptController extends BaseController&#xA;{&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected $valid_extensions = array('jpg', 'jpeg', 'png');&#xA;protected $assetSourceId = 1;&#xA;protected $assetFolderId = 1;&#xA;&#xA;public function actionUpload()&#xA;{&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $errors = array();&#xA;    $success = array();&#xA;&#xA;    if (!$_FILES['file']['error'])&#xA;    {&#xA;        $filename = $_FILES['file']['name'];&#xA;        $file = $_FILES['file']['tmp_name'];&#xA;        $extension = pathinfo($filename, PATHINFO_EXTENSION);&#xA;&#xA;        if (!in_array($extension, $this-&amp;gt;valid_extensions))&#xA;        {&#xA;            $errors[] = &quot;$filename has an invalid extension.&quot;;&#xA;        } else {&#xA;            $uploadDir = craft()-&amp;gt;assetSources-&amp;gt;getSourceById($this-&amp;gt;assetSourceId)-&amp;gt;settings['path'];&#xA;&#xA;            if (move_uploaded_file($file, $uploadDir . $filename))&#xA;            {&#xA;                IOHelper::deleteFile($file);&#xA;&#xA;                $file = $uploadDir . $filename;&#xA;&#xA;                $fileModel = new AssetFileModel();&#xA;                $fileModel-&amp;gt;sourceId = $this-&amp;gt;assetSourceId;&#xA;                $fileModel-&amp;gt;folderId = $this-&amp;gt;assetFolderId;&#xA;                $fileModel-&amp;gt;filename = IOHelper::getFileName($filename);&#xA;                $fileModel-&amp;gt;kind = IOHelper::getFileKind(IOHelper::getExtension($filename));&#xA;                $fileModel-&amp;gt;size = filesize($file);&#xA;                $fileModel-&amp;gt;dateModified = IOHelper::getLastTimeModified($file);&#xA;&#xA;                craft()-&amp;gt;assets-&amp;gt;storeFile($fileModel);&#xA;&#xA;                // print_r($fileModel);&#xA;&#xA;                // displaying file&#xA;                $image = array(&#xA;                    'url' =&amp;gt; 'images/'.$filename,&#xA;                    'id' =&amp;gt; 1&#xA;                );&#xA;                $this-&amp;gt;returnJSON($image);&#xA;                exit;&#xA;            }&#xA;            else&#xA;            {&#xA;                $errors[] = &quot;$filename was unable to be saved.&quot;;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJSON(compact('errors'));&#xA;    exit;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get my form to talk to it? Also, what else do I need to do to get it to work?&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-01-06T18:16:57.313" LastActivityDate="2018-01-06T18:16:57.313" Title="How can I insert images into a Redactor rich text field in a front-end form?" Tags="&lt;redactor&gt;&lt;image&gt;&lt;upload&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23021" PostTypeId="2" ParentId="23020" CreationDate="2017-11-30T16:00:30.790" Score="3" Body="&lt;p&gt;It doesn't seems possible natively, you should write a custom upload script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;→ &lt;a href=&quot;https://imperavi.com/redactor/docs/upload-images/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example #1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;→ &lt;a href=&quot;https://gist.github.com/sathoro/8178981#file-controller-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example #2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it doesn't matter to add the images inside your rich text field, one more simple workaround could be to allow image upload to your assets using a separate upload field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;→ &lt;a href=&quot;https://craftcms.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Uploading Files from Front-end Entry Forms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2017-12-01T10:13:18.243" LastActivityDate="2017-12-01T10:13:18.243" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23023" PostTypeId="1" CreationDate="2017-11-30T22:37:00.713" Score="0" ViewCount="163" Body="&lt;p&gt;As there is no native config to control the naming of assets I am trying to write a small plugin to do this.&#xA;Here is what I have;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('assets.saveAsset', function (Event $event) {&#xA;        if ($event-&amp;gt;params['isNewAsset']) {&#xA;&#xA;            $asset = $event-&amp;gt;params['asset'];&#xA;&#xA;            // Set the filename to a variable, appending the file extension&#xA;            // $extension = $asset-&amp;gt;getExtension();&#xA;            // $filename = strtolower($asset-&amp;gt;filename.md5(time()).'.'.$asset-&amp;gt;getExtension());&#xA;            $filename = strtolower($asset-&amp;gt;filename.'.'.$asset-&amp;gt;getExtension());&#xA;&#xA;            // Rename the file on the server&#xA;            craft()-&amp;gt;assets-&amp;gt;renameFile($asset, $filename);&#xA;&#xA;            // Set filename attribute and re-save asset&#xA;            $asset-&amp;gt;setAttribute('filename', $filename);&#xA;            craft()-&amp;gt;assets-&amp;gt;storeFile($asset);&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this currently results in a duplication of the extension like so;&#xA;model-rendering-image.jpg.jpg&lt;br&gt;&#xA;special-services.jpg.jpg  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove this part of the code &#xA;&lt;code&gt;'.'.$asset-&amp;gt;getExtension())&lt;/code&gt; then the asset isn't renamed at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't seem to get past this hurdle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone able to shed some light?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is there a reason that assets are not renamed to lowercase by default or why this isn't rolled in as a config option?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="57" LastEditDate="2017-12-01T22:38:29.620" LastActivityDate="2017-12-01T22:38:29.620" Title="Rename assets to lowercase" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23024" PostTypeId="2" ParentId="8360" CreationDate="2017-12-01T15:13:59.343" Score="3" Body="&lt;p&gt;I’ve done this a few times before and this is how I usually get it done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set Per Entry Password&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within Craft create a new Plain Text field for the entry you would like password protected. The password for the entry can be a phrase, random string of numbers and letters, whatever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Create a Login Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, set up a route to the login template including the slug of the page you are password protecting. For example, blog/{slug}/login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within your login template create a form that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Contains a field for your password&lt;/li&gt;&#xA;&lt;li&gt;Posts to itself&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;check-code&quot; action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;access-code&quot; id=&quot;access-code&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;submit&quot; /&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Check Form Submission against Entry’s Password&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the login template wrap the form in a conditional that checks for the password field’s POST value when the page is reloaded following successful form submission (I use Parsley for pre-submission form validation).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if craft.request.getPost('access-code') %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;form action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;            …&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, select the entry using craft.request.getSegment() and compare its password field against the post data from our form submission. If they don’t match then create a duplicate of our form from below with some kind of error message (I’m sure there’s a way to include the forms, without repeating markup using a macro or something). This allows the user to try again if they got it wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if craft.request.getPost('access-code') %}&#xA;&#xA;        {% set entry = craft.entries.section({entrySection}).slug(craft.request.getSegment(2)).first() %}&#xA;&#xA;        {% if entry.passwordField == craft.request.getPost('access-code') %}    &#xA;&#xA;        {% else %}&#xA;&#xA;            &amp;lt;form action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;Your access code was incorrect&amp;lt;/p&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; name=&quot;access-code&quot; id=&quot;access-code&quot; /&amp;gt;&#xA;                &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;form action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;            …&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, if the password and the post data do much we need to set a cookie and redirect the user to the entry’s template. In order to set the cookie, I’m using Andrew Welch’s &lt;a href=&quot;https://github.com/khalwat/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies plugin&lt;/a&gt;. In this case I’m setting the cookie to expire with the current browser session, but you can set it to be whatever you want following &lt;a href=&quot;http://php.net/manual/en/function.setcookie.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP’s set cookie parameters&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if craft.request.getPost('access-code') %}&#xA;&#xA;        {% set entry = craft.entries.section({entrySection}).slug(craft.request.getSegment(2)).first() %}&#xA;&#xA;        {% if entry.passwordField == craft.request.getPost('access-code') %}&#xA;&#xA;            {{ setCookie( craft.request.getSegment(2), entry.passwordField, 0, &quot;/&quot;) }}&#xA;            {% redirect &quot;blog/&quot;~craft.request.getSegment(2) %}&#xA;&#xA;        {% else %}&#xA;&#xA;            &amp;lt;form action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;                …&#xA;            &amp;lt;/form&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;form action=&quot;/{{ craft.request. getPath() }}&quot; method=&quot;POST&quot;&amp;gt;&#xA;            …&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Check for Cookie in Entry’s template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the top of your entry template check if the entry has a password set and if the browser does not have a cookie set, whose name matches the entry’s slug and whose value matches the entry’s password. If those conditions are met then the user has not logged in and will be redirected to the login page. Otherwise, the template will continue loading and the user will see the entry template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.passwordField != &quot;&quot;) and (getCookie( entry.slug ) != entry.passwordField) %}&#xA;&#xA;    {% redirect &quot;blog/&quot;~entry.slug~&quot;/login&quot; %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you’ve tested out that this process is working you, or other credentialed site users, may not want to have to enter in the password each time. Simply add another conditional to the entry template’s password/cookie check.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry.passwordField != &quot;&quot;) and (getCookie( entry.slug ) != entry.passwordField) and (currentUser == false) %}&#xA;&#xA;    {% redirect &quot;blog/&quot;~entry.slug~&quot;/login&quot; %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, if the user is logged in to the site the conditional will be bypassed and they will be able to see the content without getting redirected to the login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is pulled from a &lt;a href=&quot;https://noahread.net/blog/create-password-protected-pages-in-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post&lt;/a&gt; I wrote a while ago.&lt;/p&gt;&#xA;" OwnerUserId="288" LastActivityDate="2017-12-01T15:13:59.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23025" PostTypeId="1" CreationDate="2017-12-01T17:26:46.260" Score="1" ViewCount="142" Body="&lt;p&gt;I keep getting stranded at the &quot;Oops&quot; modal on install. This is on the third Craft site I've started. The other two Craft 2 sites stood up fine, an I've been developing them for nearly a year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen questions about this but haven't seen a resolution. Maybe my situation will help figure this out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log error output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'craft_entryversions' already exists' in /var/www/thesite/craft/app/framework/db/CDbCommand.php:358&#xA;&#xA;Stack trace:&#xA;&#xA;#0 /var/www/thesite/craft/app/framework/db/CDbCommand.php(1352): CDbCommand-&amp;gt;execute()&#xA;#1 /var/www/thesite/craft/app/etc/db/DbCommand.php(507): CDbCommand-&amp;gt;createTable('craft_entryvers...', Array, NULL)&#xA;#2 /var/www/thesite/craft/app/records/BaseRecord.php(301): Craft\DbCommand-&amp;gt;createTable('entryversions', Array, NULL, true)&#xA;#3 /var/www/thesite/craft/app/services/InstallService.php(172): Craft\BaseRecord-&amp;gt;createTable()&#xA;#4 /var/www/thesite/craft/app/services/InstallService.php(56): Craft\InstallService-&amp;gt;_createTablesFromRecords(Array)&#xA;#5 /var/www/thesite/craft/app/controllers/InstallController.php(159): Craft\InstallService-&amp;gt;run(Array)&#xA;#6 /var/www/thesite/craft/app/framework/web/actions/CInlineAction.php(49): Craft\InstallController-&amp;gt;actionInstall()&#xA;#7 /var/www/thesite/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 /var/www/thesite/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 /var/www/thesite/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 /var/www/thesite/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('install')&#xA;#11 /var/www/thesite/craft/app/etc/web/WebApp.php(823): CWebApplication-&amp;gt;runController('install/install')&#xA;#12 /var/www/thesite/craft/app/etc/web/WebApp.php(790): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /var/www/thesite/craft/app/etc/web/WebApp.php(203): Craft\WebApp-&amp;gt;_processInstallRequest()&#xA;#14 /var/www/thesite/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#15 /var/www/thesite/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#16 /var/www/thesite/public/index.php(19): require_once('/var/www/thesite...')&#xA;#17 {main}&#xA;REQUEST_URI=/index.php?p=admin/actions/install/install&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried this on a couple of local vagrant boxes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ubuntu xenial 64, nginx, php7.0-fpm, mysql server 5.7.20&lt;/li&gt;&#xA;&lt;li&gt;ubutnu trusty 64, nginx, php5-fpm, mysql-server 5.5.58&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have successfully installed an older version of Craft on both of these boxes before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DB user was root for both environments, so DB permissions shouldn't be an issue as suggested in another post about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried deleting the tables mentioned in the log and tried again, as mentioned in another post about this. I just got an error about another duplicate table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also destroyed and recreated each vagrant box, so I don't think lingering sql temp files are an issue as reported elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any new direction on this would be awesome. We already have a Craft site ready for production, but if we can't use it for a related site for the same client, we'll have to move on to something else, and that's the last thing I want to do.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastActivityDate="2017-12-04T17:43:39.563" Title="Craft 2.6.2999 install error: Base table or view already exists: 1050 Table 'craft_entryversions' already exists'" Tags="&lt;error&gt;&lt;install&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23026" PostTypeId="1" CreationDate="2017-12-01T18:32:38.100" Score="1" ViewCount="224" Body="&lt;p&gt;After running Craft update I'm getting error on the meta author, meta description and meta keywords fields. Any idea how to resolve issue?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Recoverable error&lt;br&gt;&#xA;  Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Error Output:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zJUqD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zJUqD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template Code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set site_title = 'site title here' %}&#xA;&#xA;{#&#xA;    ENTRY FALLBACK&#xA;    Not all pages have entries associated with them, e.g. search results, login page, etc.&#xA;#}&#xA;{% if entry.id is not defined %}&#xA;    {% set entry = craft.entries.id(2) %}&#xA;{% endif %}&#xA;&#xA;{#&#xA;   HOMEPAGE DATA&#xA;   Used as a fallback for when meta values don't exist in this entry&#xA;#}&#xA;{% set homepage_entry = craft.entries.id(2) %}&#xA;&#xA;&#xA;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&amp;gt;&#xA;    &amp;lt;title&amp;gt;{{ entry.id == '2' ? site_title : entry.title ~ ' &amp;gt; ' ~ site_title }}&amp;lt;/title&amp;gt;&#xA;    &amp;lt;meta name=&quot;author&quot; content=&quot;{{ entry.metaAuthor ? entry.metaAuthor : homepage_entry.metaAuthor }}&quot; /&amp;gt;&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ entry.metaDescription ? entry.metaDescription : homepage_entry.metaDescription }}&quot; /&amp;gt;&#xA;    &amp;lt;meta name=&quot;keywords&quot; content=&quot;{{ entry.metaKeywords ? entry.metaKeywords|join(',') : homepage_entry.metaKeywords|join(',') }}&quot; /&amp;gt;&#xA;    &amp;lt;link rel=&quot;shortcut icon&quot; href=&quot;images/favicon.ico&quot; /&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/all.css&quot;&amp;gt;&#xA;    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/nav.css&quot;&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what issue is, how to resolve and why this broke? &lt;/p&gt;&#xA;" OwnerUserId="806" LastEditorUserId="806" LastEditDate="2017-12-21T21:29:56.440" LastActivityDate="2018-05-20T23:47:38.940" Title="Recoverable error Object of class Craft\ElementCriteriaModel could not be converted to string after Update" Tags="&lt;error&gt;&lt;craft-pro&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23028" PostTypeId="1" CreationDate="2017-12-01T21:33:36.627" Score="0" ViewCount="91" Body="&lt;p&gt;Looking for a plugin/script to autocomplete addresses in a form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a couple of Freeform forms that ask for name, address, and a bunch of other data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, I'd like it so that when a user starts typing in the address, it shows an auto-complete box underneath, and when you select, it fills in fields for city, state, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at &lt;a href=&quot;https://ubilabs.github.io/geocomplete/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Geocomplete&lt;/a&gt;, but this seems like a thing that others (probably lots of others) have already done, and I'd rather not reinvent the wheel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm on Craft 2.9, and the regular version of Freeform (not pro). &lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2017-12-01T21:33:36.627" Title="Freeform - jquery lookup to fill in addresses?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;jquery&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23029" PostTypeId="2" ParentId="23023" CreationDate="2017-12-01T22:38:17.927" Score="1" Body="&lt;p&gt;Just tested your code and it worked as you'd expect if you leave off the extra &lt;code&gt;getExtension()&lt;/code&gt; call (the &lt;code&gt;filename&lt;/code&gt; property already includes the extension).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$filename = strtolower($asset-&amp;gt;filename);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it's not saving for you with that, you've got some other error happening elsewhere.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-01T22:38:17.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23030" PostTypeId="1" AcceptedAnswerId="23359" CreationDate="2017-12-02T13:02:31.867" Score="1" ViewCount="381" Body="&lt;p&gt;So there is this field called «Free Shipping» for each product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tBLd7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tBLd7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't find anything about this in the docs. I found out that I trigger it with &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;product.freeShipping&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But when activated it has no effect on shipping costs whatsoever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the idea behind this thing, and how do I activate it?&#xA;(I'm fiddling around in the standard templates)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about creating a Free Shipping Category and then activate it via conditional. Or what's the idea about this?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2017-12-02T22:29:37.653" LastActivityDate="2018-01-03T11:21:38.797" Title="Craft Commerce - Free Shipping Field" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23031" PostTypeId="2" ParentId="19273" CreationDate="2017-12-02T14:50:37.010" Score="6" Body="&lt;p&gt;In case someone uses Craft 3, this should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;?&#xA;return array(&#xA;    '&amp;lt;url:(?!api\/).*&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'index']&#xA;);&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7643" LastActivityDate="2017-12-02T14:50:37.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23032" PostTypeId="1" AcceptedAnswerId="23033" CreationDate="2017-12-02T18:37:37.400" Score="1" ViewCount="60" Body="&lt;p&gt;This question is a follow up of a previous question see: (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/22749/entry-form-multiple-entries-entry-type-parent&quot;&gt;Entry Form - Multiple Entries &amp;amp; Entry Type &amp;amp; Parent&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to add multiple children to a pre-existing multi level structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level 1&#xA;--Level 2 (The parent where I am adding the children)&#xA;----Child 1&#xA;----Child 2&#xA;..etc &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My Controller: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveAnimals(){&#xA;$this-&amp;gt;requirePostRequest();&#xA;&#xA;if($rodentsData = craft()-&amp;gt;request-&amp;gt;getParam('rodent')){&#xA;  $rodentErrors = [];&#xA;  foreach ($rodentsData as $rodentData){&#xA;      if (array_key_exists('entryId', $rodentData) &amp;amp;&amp;amp; $rodentId = $rodentData['entryId']) {&#xA;          if (!$rodent = craft()-&amp;gt;elements-&amp;gt;getElementById($rodentId)) {&#xA;              throw new Exception('Could not find rodent with the given Id');&#xA;          }&#xA;      } else {&#xA;          $rodent = new EntryModel();&#xA;          $rodent-&amp;gt;typeId = 6; // change your entryType Id here&#xA;          $rodent-&amp;gt;sectionId = craft()-&amp;gt;request-&amp;gt;getParam('sectionId');&#xA;          $rodent-&amp;gt;parentId = craft()-&amp;gt;request-&amp;gt;getParam('parentId');&#xA;          $rodent-&amp;gt;authorId = craft()-&amp;gt;request-&amp;gt;getParam('authorId');&#xA;      }&#xA;&#xA;      $rodent-&amp;gt;getContent()-&amp;gt;setAttributes($rodentData['fields']);&#xA;&#xA;      if (!craft()-&amp;gt;entries-&amp;gt;saveEntry($rodent)) {&#xA;          $rodentErrors[] = $rodent-&amp;gt;getErrors();&#xA;      }else{&#xA;          $rodentErrors = [];&#xA;      }&#xA;  }&#xA;  // include errors of each item&#xA;  craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array(&#xA;      'rodentErrors' =&amp;gt; $rodentErrors&#xA;  ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my form: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ getCsrfInput() }}&#xA;{# your plugin name and function name #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;experiment/SaveAnimals&quot;&amp;gt;&#xA;{# the id of your section for me its 4 you need to change this value to your section Id #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;4&quot;&amp;gt;&#xA;{# enable the entry #}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;{# id of your entry leave it blank to insert a new entry, insert a id to change an existing entry#}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;parentId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;authorId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;fields&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;field mt3&quot;&amp;gt;&#xA;    &amp;lt;label class=&quot;f5 lh-copy pb2&quot; for=&quot;title&quot;&amp;gt;Amount of Animals&amp;lt;/label&amp;gt;&#xA;    {#&amp;lt;input class=&quot;pa3 input-reset ba bw0 br2 w-100&quot; type=&quot;number&quot; id=&quot;Cage__Amount&quot; placeholder=&quot;5&quot; max=&quot;10&quot; required&amp;gt;#}&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;rodent[0][fields][title]&quot; value=&quot;Add Identifier&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;rodent[1][fields][title]&quot; value=&quot;Add Identifier&quot;&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;field submit mv4&quot;&amp;gt;&#xA;  &amp;lt;button class=&quot;bg-dark-blue white ph3 pv2 input-reset pointer ba bw0 f5 dib lh-copy w-100&quot; type=&quot;submit&quot;&amp;gt;Create experiment&amp;lt;/button&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently getting this error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to get property of non-object &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From EntriesService.php(468) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($entry-&amp;gt;getSection()-&amp;gt;type != SectionType::Structure)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2017-12-02T20:00:40.557" Title="Posting children to a Structure" Tags="&lt;structure&gt;&lt;controller&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23033" PostTypeId="2" ParentId="23032" CreationDate="2017-12-02T20:00:40.557" Score="1" Body="&lt;p&gt;The section ID was incorrect - set correctly and this function works.&lt;/p&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2017-12-02T20:00:40.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23034" PostTypeId="1" AcceptedAnswerId="23036" CreationDate="2017-12-03T12:28:01.183" Score="2" ViewCount="257" Body="&lt;p&gt;Any way to show the total word count in real-time to authors while they are writing an entry that has multiple blocks? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't need per-block word count ... I need total word count shown in real-time.&lt;/p&gt;&#xA;" OwnerUserId="7169" LastActivityDate="2017-12-03T14:01:59.980" Title="How to Show the Total Word Count of an Entry?" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23035" PostTypeId="2" ParentId="23034" CreationDate="2017-12-03T13:51:35.170" Score="1" Body="&lt;p&gt;You'll need to add a plugin like &lt;a href=&quot;https://github.com/doublesecretagency/craft-cpjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one from Lindsey DiLoreto&lt;/a&gt; that allows you to insert your own javascript into the CP.  Then you'll need to write some javascript that counts up each word in a textarea input for each block.  I'm sure stackoverflow has several answers on how to do that.  Keep in mind Craft already has jQuery installed if you choose to use it.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-12-03T13:51:35.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23036" PostTypeId="2" ParentId="23034" CreationDate="2017-12-03T14:01:59.980" Score="1" Body="&lt;p&gt;What you want to achieve is not an easy task because you would have to hook into many different events to recognize new blocktypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fastest and easiest method would be to use this plugin as the base of your own &lt;a href=&quot;https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/README.md&lt;/a&gt;. You can edit the init function to show the script for everyone and not just administrators. Then you use the plugins Javascript function as your base script &lt;a href=&quot;https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/source/javascripts/CpFieldLinks.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/source/javascripts/CpFieldLinks.js&lt;/a&gt; and change the &lt;code&gt;editFieldBtn&lt;/code&gt; template to display not the handle of your field but a custom variable. This variable will be the total word count. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to select all your needed fields with jquery (inspect the html in order to find out what selectors you can use) and use a word count script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I`ve created something similar a few months ago and did the same. It was relatively easy compared to do all the work from zero &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-03T14:01:59.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23037" PostTypeId="1" AcceptedAnswerId="23038" CreationDate="2017-12-03T19:47:14.307" Score="0" ViewCount="127" Body="&lt;p&gt;I have tried to find the new way get the total in a user group in php (plugin), but not having much luck... Please help&#xA;Assume it starts with Craft::$app-&gt;users ?&lt;/p&gt;&#xA;" OwnerUserId="1084" LastEditorUserId="5557" LastEditDate="2017-12-03T20:52:44.273" LastActivityDate="2017-12-06T18:27:30.430" Title="Craft 3 beta - User group total" Tags="&lt;users&gt;&lt;search&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23038" PostTypeId="2" ParentId="23037" CreationDate="2017-12-03T20:47:41.230" Score="1" Body="&lt;p&gt;Use the &lt;code&gt;ActiveRecord&lt;/code&gt; from &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-db-activerecord.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userGroupId = 1 // insert your usergroup Id here&#xA;$users = User::find()-&amp;gt;groupId($userGroupId)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or via handle&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userGroup = Craft::$app-&amp;gt;userGroups-&amp;gt;getGroupByHandle('handle');&#xA;$users = User::find()-&amp;gt;group($userGroup)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you mean the number of users in a group with total you just have to do &lt;code&gt;count()&lt;/code&gt; instead of &lt;code&gt;all()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the users of each group you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach(Craft::$app-&amp;gt;userGroups-&amp;gt;getAllGroups() as $userGroup){&#xA;    $users = User::find()-&amp;gt;group($userGroup)-&amp;gt;all();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-06T18:27:30.430" LastActivityDate="2017-12-06T18:27:30.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23039" PostTypeId="2" ParentId="1639" CreationDate="2017-12-04T03:33:02.860" Score="1" Body="&lt;p&gt;I know Lindsey's answer is the accepted answer from like 4 years ago, but it's worth pointing out that it only applies if your events use &lt;code&gt;postDate&lt;/code&gt; for when each event starts/ends.  But you don't need to do all that! Just use a custom datetime field for setting event start/end dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create custom &lt;a href=&quot;https://craftcms.com/docs/date-time-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;date/time fields&lt;/a&gt; in your entries. Then you grab your event entries on the listing page like normal but you order by your custom field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set upcomingEvents = craft.entries.section('mySection').order('customStartDate')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then control them in the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in upcomingEvents if event.customStartDateField &amp;gt;= now %}&#xA;    // event html&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;There are currently no upcoming events at this time.&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the details &lt;code&gt;_entry&lt;/code&gt; page, you go about it like normal; the &lt;code&gt;entry&lt;/code&gt; variable is auto populated for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a more complex example on &lt;a href=&quot;https://craftcookbook.net/recipes/better-events-listings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Cookbook&lt;/a&gt; if you need something more complicated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There are multiple reasons and benefits for using custom date fields rather than going with &lt;code&gt;postDate&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You don't need to uncheck the box that says &quot;Entries in this section have their own URLs&quot;. Instead, let Craft generate the entries' urls as usual.&lt;/li&gt;&#xA;&lt;li&gt;No wonky custom routing for what is really just a straight up typical channel of entries.&lt;/li&gt;&#xA;&lt;li&gt;You don't have to deal with the status; just leave it on the default &quot;live&quot; status and control the entry's visibility in the template based on if its start/end date is in the future or past related to the current date.&lt;/li&gt;&#xA;&lt;li&gt;The UX of having a custom date/time field in the entry's tab (when editing the entry) rather than off to the side is arguably far better for the user/client.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I get that the accepted answer answers the question in the title, but I found myself rethinking my approach to listing out events on a project I'm doing and realized the better way is to avoid using &lt;code&gt;postDate&lt;/code&gt; altogether for this instead of trying to force it. Hope it helps someone else too.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-12-04T03:33:02.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23040" PostTypeId="1" AcceptedAnswerId="23041" CreationDate="2017-12-04T09:41:33.640" Score="1" ViewCount="479" Body="&lt;p&gt;I have created a Craft CMS site on a VPS Server running CentOS 7. I have a file setup on the public_html like this: -&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;cms&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;craft&lt;/li&gt;&#xA;&lt;li&gt;public&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;app (this is running a Symfony Framework Web App and runs from app.example.com perfectly)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now I have the site working from www.example.com but when I login to the back office all of the links say... &lt;a href=&quot;https://www.example.com/cms/public/admin/dashboard&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.example.com/cms/public/admin/dashboard&lt;/a&gt;. I want to remove cms/public from the URL links in the back office.&lt;/p&gt;&#xA;" OwnerUserId="7677" LastActivityDate="2017-12-04T10:37:22.960" Title="Installing Craft in a Sub Folder" Tags="&lt;url&gt;&lt;redirect&gt;&lt;install&gt;&lt;htaccess&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23041" PostTypeId="2" ParentId="23040" CreationDate="2017-12-04T10:37:22.960" Score="1" Body="&lt;p&gt;Ok I actually managed to fix this. I moved the index.php file from the cms/public subfolder to public_html and it worked a treat. I had to change the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = 'cms/craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7677" LastActivityDate="2017-12-04T10:37:22.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23042" PostTypeId="1" AcceptedAnswerId="23235" CreationDate="2017-12-04T14:49:15.343" Score="5" ViewCount="4895" Body="&lt;p&gt;I'd like to set-up quickly blog on Craft CMS and I wonder if there are any starter templates available? It would be really useful.&lt;/p&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="57" LastEditDate="2017-12-04T18:37:42.240" LastActivityDate="2021-05-08T09:28:00.737" Title="Does Craft CMS have skeletons/starter/boilerplate templates?" Tags="&lt;templating&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23043" PostTypeId="2" ParentId="23042" CreationDate="2017-12-04T15:00:51.530" Score="5" Body="&lt;p&gt;I don't think you will find downloadable templates like for Wordpress and co because the philosophy of Craft is customization and the freedom to do what you want and not just downloading ready to use themes. Since everyone can build his/her completely own structure it's literally useless to create downloadable templates. You should try to build your own: &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/docs/templating-overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are example templates which contain enough code to get you started in the templates folder &lt;code&gt;craft/templates&lt;/code&gt; or &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2387/whats-the-right-way-to-create-a-simple-blog-in-craft&quot;&gt;here&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to have the freedom to customize everything you should search for another CMS.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-04T15:00:51.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23044" PostTypeId="2" ParentId="23042" CreationDate="2017-12-04T15:21:41.773" Score="5" Body="&lt;p&gt;You can try this one:&#xA;&lt;a href=&quot;https://github.com/70kft/craft-instablog&quot; rel=&quot;noreferrer&quot;&gt;Instablog&lt;/a&gt;&#xA;It could be a starting point.&lt;/p&gt;&#xA;" OwnerUserId="522" LastActivityDate="2017-12-04T15:21:41.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23045" PostTypeId="2" ParentId="23025" CreationDate="2017-12-04T17:43:39.563" Score="1" Body="&lt;p&gt;This is an indirect answer, but if you don't have time to debug the install process to set up a Vagrant box, grab this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/niceandserious/crafty-vagrant&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/niceandserious/crafty-vagrant&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something about it doesn't trigger the duplicate table trouble. Someday I'll have time to figure out why.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastActivityDate="2017-12-04T17:43:39.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23046" PostTypeId="2" ParentId="23026" CreationDate="2017-12-04T21:26:30.753" Score="1" Body="&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set author = entry.metaAuthor|length ? entry.metaAuthor[0] : homepage_entry.metaAuthor[0] }}&#xA;&#xA;&amp;lt;meta name=&quot;author&quot; content=&quot;{{ author }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-04T21:26:30.753" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23047" PostTypeId="2" ParentId="22956" CreationDate="2017-12-04T22:00:47.843" Score="2" Body="&lt;p&gt;Completely untested, but this should return all variants whose &lt;code&gt;price&lt;/code&gt; column's value is less than your custom field's &lt;code&gt;originalPrice&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$results = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('v.*')&#xA;    -&amp;gt;from('commerce_variants v')&#xA;    -&amp;gt;join('content c', 'v.id = c.elementId')&#xA;    -&amp;gt;where('v.price &amp;lt; c.field_originalPrice&quot;)&#xA;    -&amp;gt;queryAll();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-04T22:00:47.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23048" PostTypeId="2" ParentId="2631" CreationDate="2017-12-05T03:44:38.820" Score="3" Body="&lt;p&gt;You can fetch assets related to a certain source by using the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.assets#source&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft.assets.source&lt;/a&gt; method and passing in the source handle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your handle is 'my_images', the following will do the job:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.assets.source('my_images')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You avoid having to lookup db IDs that way.&lt;/p&gt;&#xA;" OwnerUserId="7689" LastActivityDate="2017-12-05T03:44:38.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23050" PostTypeId="1" AcceptedAnswerId="23053" CreationDate="2017-12-05T15:05:20.000" Score="1" ViewCount="78" Body="&lt;p&gt;Given a Matrix with each row containing a text field and a multi relationship field. And I am picking 1 Matrix row based on the value in the text field. How would I go about selecting a single, random, related entry for that row?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to do this a couple of ways but I'm not really getting anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm selecting the Matrix row and getting the related entries using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixRow = $entry-&amp;gt;matrixField-&amp;gt;textField($stringToMatch)-&amp;gt;first();&#xA;&#xA;$relatedEntries = $matrixRow-&amp;gt;relationshipField;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I now pick one of those related entries at random?&#xA;Is the only way to create an array and shuffle it?&#xA;Or is there a way I can do it when fetching the Matrix row?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding the following in an attempt to get all the related entries associated with the Matrix row. Figuring I can then modify this query by adding a limit and ordering randomly to get my 1 related entry. But it's coming back empty.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section         = 'videos';&#xA;$criteria-&amp;gt;relatedTo       = array(&#xA;    'targetElement'   =&amp;gt; $matrixRow,&#xA;    'field'     =&amp;gt; 'relationshipField'&#xA;);&#xA;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;foreach($entries as $entry){&#xA;    var_dump($entry-&amp;gt;title);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2017-12-05T15:39:29.663" LastActivityDate="2017-12-05T15:57:42.553" Title="Getting a single, random, related entry within a plug in" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;elementcriteriamodel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23051" PostTypeId="2" ParentId="23050" CreationDate="2017-12-05T15:42:50.863" Score="1" Body="&lt;p&gt;The &lt;code&gt;ElementCriteriaModel&lt;/code&gt; has a function &lt;code&gt;nth($offset)&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel#nth-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; so you could get a random number between 0 and &lt;code&gt;count()&lt;/code&gt; and put it in your &lt;code&gt;nth()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$randomNumber = rand(0, $matrixRow-&amp;gt;relationshipField-&amp;gt;count());&#xA;$relatedEntry = $matrixRow-&amp;gt;relationshipField-&amp;gt;nth($randomNumber);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As an answer to your edit: you know that &lt;code&gt;$matrixRow-&amp;gt;relationshipField&lt;/code&gt; is nearly the same as your edit? &lt;code&gt;$matrixRow-&amp;gt;relationshipField&lt;/code&gt; is an object, it is not an array of elements. It has an iterable interface so the &lt;code&gt;$criteria-&amp;gt;find()&lt;/code&gt; method is executed as soon as you loop through it. So in the end the criteria you build is nearly the same object like Craft gives you with &lt;code&gt;$matrixRow-&amp;gt;relationshipField&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-05T15:48:35.487" LastActivityDate="2017-12-05T15:48:35.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23052" PostTypeId="1" CreationDate="2017-12-05T15:45:06.590" Score="0" ViewCount="57" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BJ8G0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJ8G0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I have inherited a Craft website and need to update an existing URL, it will open a PDF document, so I need to replace an updated PDF&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have very basic Craft knowledge so need assistance.  I have added a Screenshot below showing the inforamtion behind the link which I hope helps&lt;/p&gt;&#xA;" OwnerUserId="7695" LastEditorUserId="7695" LastEditDate="2017-12-05T16:14:10.720" LastActivityDate="2017-12-05T16:24:37.477" Title="I need to update an existing URL" Tags="&lt;url&gt;&lt;link&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23053" PostTypeId="2" ParentId="23050" CreationDate="2017-12-05T15:51:27.327" Score="2" Body="&lt;p&gt;&lt;code&gt;$matrixRow-&amp;gt;relationshipField&lt;/code&gt; returns an ElementCriteriaModel pre-configured to query for the related elements. You can add / override additional criteria and then query for a matching element using the &lt;code&gt;first()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$randomEntry = $matrixRow-&amp;gt;relationshipField-&amp;gt;order('RAND()')-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is basically the same as what you’ve tried with your custom ElementCriteriaModel. It should also work once you have fixed the mistake in the &lt;code&gt;relatedTo&lt;/code&gt; param, as the entry that holds the field is the “sourceElement” of a relation.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2017-12-05T15:57:42.553" LastActivityDate="2017-12-05T15:57:42.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23054" PostTypeId="1" CreationDate="2017-12-05T16:19:57.723" Score="1" ViewCount="304" Body="&lt;p&gt;I currently have a form that has an upload file fieldtype and this currently stores the file in an asset source in Craft. What I would like to do is attach some of the form submitted field data alongside the asset using fields within the Asset field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I would like to store the Form Submission ID, Name and Email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas as to how I would go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2017-12-07T06:38:35.820" Title="Store form data with file upload in an asset source using Freeform" Tags="&lt;assets&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23055" PostTypeId="2" ParentId="23052" CreationDate="2017-12-05T16:24:37.477" Score="2" Body="&lt;p&gt;You can replace a file directly in the control panel. Navigate to Assets, select the file you want to replace and then click the cog icon to select the “Replace file” action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lCWpb.png&quot; width=&quot;384&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-12-05T16:24:37.477" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23056" PostTypeId="1" AcceptedAnswerId="23058" CreationDate="2017-12-05T19:39:40.147" Score="9" ViewCount="1997" Body="&lt;p&gt;I've been trying to run the new Craft CLI for the last couple of versions without any success. I figured maybe since we weren't at RC1 yet that it wasn't fully working. After seeing Ryan's video about it at &lt;a href=&quot;https://mijingo.com/lessons/craft-3-command-line/&quot; rel=&quot;noreferrer&quot;&gt;https://mijingo.com/lessons/craft-3-command-line/&lt;/a&gt; I realized that wasn't the case (and with RC1 being released today).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using MAMP Pro (like Ryan does in his video), but I have it using the standard MySQL port at 3306. I also have PHP 7.1 installed at the terminal through homebrew and pdo_mysql is a compiled in module. I am also using RC1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, if I use localhost I get a completely different message than if I use 127.0.0.1. But regardless, both still fail.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] localhost&#xA;Database port: [3306] 3306&#xA;Database username: [root] root&#xA;Database password:&#xA;Database name: craft3&#xA;Database table prefix:&#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory&#xA;&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] 127.0.0.1&#xA;Database port: [3306] 3306&#xA;Database username: [root] root&#xA;Database password:&#xA;Database name: [craft3] craft3&#xA;Database table prefix:&#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I create the database manually and put the credentials into my .env file everything connects just fine without any issue. Is there something else I should be considering?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2017-12-05T20:55:24.117" LastActivityDate="2018-11-15T19:25:03.927" Title="Craft CLI RC1 Connectivity Issues with MAMP Pro" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;mysql&gt;&lt;cli&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23057" PostTypeId="1" CreationDate="2017-12-05T19:55:12.920" Score="2" ViewCount="46" Body="&lt;p&gt;I am having a major issue with craft subscription. All data in stripe shows it as live mode and in craft it is showing as test payment. Also the subscription url points to &lt;code&gt;https://dashboard.stripe.com/test/plans/plan-name-here&lt;/code&gt; instead of &lt;code&gt;https://dashboard.stripe.com/plans/plan-name-here&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if someone has run into the problem please shed some light&lt;/p&gt;&#xA;" OwnerUserId="7342" LastActivityDate="2017-12-05T19:55:12.920" Title="Charge events are firing in live mode but returning as test" Tags="&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23058" PostTypeId="2" ParentId="23056" CreationDate="2017-12-05T21:07:08.090" Score="14" Body="&lt;p&gt;After playing with this a little further it seems the unixSocket setting is necessary to get this working so I added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'unixSocket' =&amp;gt; getenv('DB_SOCKET')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To &lt;code&gt;config/db.php&lt;/code&gt; and then added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DB_SOCKET=&quot;/Applications/MAMP/tmp/mysql/mysql.sock&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To my &lt;code&gt;.env&lt;/code&gt; file. After that, the installation will go through using the CLI. Perhaps there's still an option that doesn't require the unixSocket be set?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2017-12-05T21:07:08.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23059" PostTypeId="2" ParentId="1515" CreationDate="2017-12-06T01:52:13.170" Score="1" Body="&lt;p&gt;Here's more than you ever wanted to know on 404 and error templates in Craft CMS: &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#handling-exceptions-on-the-frontend&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-06T01:52:13.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23060" PostTypeId="2" ParentId="23042" CreationDate="2017-12-06T01:54:56.767" Score="6" Body="&lt;p&gt;Here's an example of how you can do it with Craft 3 and &lt;code&gt;composer create-project&lt;/code&gt;: &lt;a href=&quot;https://github.com/nystudio107/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;nystudio107/craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is discussed in the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; article.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-21T18:37:59.127" LastActivityDate="2018-03-21T18:37:59.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23061" PostTypeId="2" ParentId="23008" CreationDate="2017-12-06T01:57:14.380" Score="2" Body="&lt;p&gt;You can try installing the &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retour plugin&lt;/a&gt; to get a log of all of the 404 errors and their referrers, and potentially handle them via redirects.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-06T01:57:14.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23062" PostTypeId="1" CreationDate="2017-12-06T04:25:00.507" Score="1" ViewCount="35" Body="&lt;p&gt;I am getting the following error on my local machine when updating Craft 2.6.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft/app/helpers/ElementHelper.php.bak: failed to open stream: Permission denied&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't even see that file in the directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="57" LastEditDate="2017-12-06T18:01:37.773" LastActivityDate="2018-05-05T20:38:39.420" Title="Internal Server Error Regarding ElementHelper.php.bak" Tags="&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23064" PostTypeId="1" CreationDate="2017-12-06T11:55:41.583" Score="1" ViewCount="1299" Body="&lt;p&gt;Is it possible to get an idiots guide to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/22445/error-on-craft-3-install&quot;&gt;Error on Craft 3 install&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just not following the context of the answer/commands, a detailed step by step would be invaluable for fear of trying something, not really understanding what's going on and possibly doing it wrong and affecting dependent tech, just a thought, thanks.&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="4433" LastEditDate="2017-12-06T15:10:52.090" LastActivityDate="2017-12-07T10:00:38.550" Title="Craft 3 via composer with Mamp Pro" Tags="&lt;craft3&gt;&lt;install&gt;&lt;installation&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23065" PostTypeId="2" ParentId="23064" CreationDate="2017-12-06T12:09:02.810" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://nystudio107.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;nystudio107&lt;/a&gt; just released a nice guide yesterday for setting up a Craft 3 site via composer.  No mention of Mamp Pro, but I don't think that should really be a problem if you're already used to using it, as you would just make sure your hosts file is pointing to the &lt;code&gt;/web/index.php&lt;/code&gt; file.  The article does a great job of explaining what a lot of the terminal commands actually refer to instead of just telling you what to type in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2017-12-06T12:09:02.810" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23067" PostTypeId="1" CreationDate="2017-12-06T14:25:11.267" Score="2" ViewCount="381" Body="&lt;p&gt;I am trying to post data using AJAX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs describes a method &lt;a href=&quot;https://solspace.com/craft/freeform/docs/ajax-forms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. But that is mainly for jQuery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also looked at &lt;a href=&quot;https://expressionengine.stackexchange.com/questions/25347/solspace-freeform-how-to-send-file-via-ajax-with-freeform&quot;&gt;this url&lt;/a&gt;, which also uses jQuery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from what I understand, the &quot;action&quot; parameter in &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;freeform/api/form&quot;&amp;gt;&lt;/code&gt;is where the data is sent. But if I send data to that URL, I get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I properly submit a form using AJAX?&lt;/p&gt;&#xA;" OwnerUserId="6380" LastEditorUserId="57" LastEditDate="2017-12-07T04:17:40.407" LastActivityDate="2018-03-28T19:38:17.120" Title="Solspace Freeform plugin: AJAX without jQuery – how?" Tags="&lt;ajax&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23068" PostTypeId="1" AcceptedAnswerId="23073" CreationDate="2017-12-06T14:49:57.887" Score="1" ViewCount="478" Body="&lt;p&gt;Is there a way to modify how the html fields are outputted by Redactor? I'm creating an email template and I'm trying to add inline styles to Redactor's list items, links, etc.&lt;/p&gt;&#xA;" OwnerUserId="7706" LastActivityDate="2017-12-06T17:14:23.880" Title="Modify how the html fields are outputted by Redactor" Tags="&lt;templating&gt;&lt;redactor&gt;&lt;css&gt;&lt;html-entities&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23069" PostTypeId="1" CreationDate="2017-12-06T16:10:58.290" Score="2" ViewCount="181" Body="&lt;p&gt;I'm creating a custom plugin for customer reviews on products. &#xA;In the CP I have an interface to view and aprove these. What I am wondering is if it is any easy way to paginate my records? Right now on my index page Im just calling a twig extension that does a DB query for all rows in a review table. When this table gets bigger I might have performance and UX issues listing all the comments in one go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2017-12-06T16:16:29.217" Title="Paginate records?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23070" PostTypeId="2" ParentId="23069" CreationDate="2017-12-06T16:16:29.217" Score="1" Body="&lt;p&gt;You should be able to use &lt;code&gt;paginate&lt;/code&gt;. In my installation, I paginate through blog articles:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('articles').limit(4) as pageInfo, articles %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can just access them as usual:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for article in articles %}&#xA;    {{ article.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6731" LastActivityDate="2017-12-06T16:16:29.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23071" PostTypeId="2" ParentId="23068" CreationDate="2017-12-06T16:50:11.703" Score="1" Body="&lt;p&gt;Craft uses the redactor js plugin. You can change it's settings, plugins and all formats like you want in the config &lt;code&gt;craft/config/redactor&lt;/code&gt; or add custom presets. Here is the link how to configure the redactor &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/docs/settings/formatting/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-06T16:50:11.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23072" PostTypeId="1" AcceptedAnswerId="23142" CreationDate="2017-12-06T17:05:21.080" Score="2" ViewCount="53" Body="&lt;p&gt;How can I find entries with at least 1 image?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.group('storyCategories').slug(catSlug).first() %}&#xA;&#xA;{% set params = {&#xA;  section : 'stories',&#xA;  order : 'postDate desc',&#xA;  relatedTo: category,&#xA;  limit : '4'&#xA;} %}&#xA;{% set stories = craft.entries(params).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have this, but am not sure how to only get stories entries when the story has an image.&lt;/p&gt;&#xA;" OwnerUserId="7470" LastActivityDate="2017-12-11T11:10:20.167" Title="Find entries with at least 1 image" Tags="&lt;entries&gt;&lt;image&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23073" PostTypeId="2" ParentId="23068" CreationDate="2017-12-06T17:14:23.880" Score="2" Body="&lt;p&gt;To add inline styles to HTML tags generated by Redactor such as &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;, install the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon plugin&lt;/a&gt; and add the following to your template. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | retconAttr('li', { style: 'color: red;' }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info, consult the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;retconAttr&lt;/code&gt; filter documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2017-12-06T17:14:23.880" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23075" PostTypeId="2" ParentId="23062" CreationDate="2017-12-06T18:01:22.040" Score="1" Body="&lt;p&gt;At what point of the update process are you getting that error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During an auto-update, Craft creates a &lt;code&gt;.bak&lt;/code&gt; of every file that it's about to update before doing the file swap.  The last step of the update process (the &quot;Cleaning up...&quot; stage), goes through and deletes all of the &lt;code&gt;.bak&lt;/code&gt; files that were created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also make sure that the &lt;code&gt;craft/app&lt;/code&gt; folder is recursively writable by PHP as that's required for auto-updating to work correctly.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-06T18:01:22.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23076" PostTypeId="1" AcceptedAnswerId="23077" CreationDate="2017-12-06T18:33:56.730" Score="5" ViewCount="4075" Body="&lt;p&gt;I just finished upgrading to Craft 3 RC and all text on the site is gone. The WYSIWYG Editor has been replaced with this message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to find component class 'craft\fields\RichText'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1umuE.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1umuE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt;&#xA;What can I do?&lt;/p&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="57" LastEditDate="2017-12-06T18:46:45.420" LastActivityDate="2018-11-02T18:48:50.603" Title="Craft 3 RC Upgrade killed the WYSIWYG Editor" Tags="&lt;craft3&gt;&lt;wysiwyg&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23077" PostTypeId="2" ParentId="23076" CreationDate="2017-12-06T18:44:46.340" Score="11" Body="&lt;p&gt;With RC1 the rich text editor was moved to a plugin. You can find the Redactor editor (the previous richtext field) in the plugin store along with a new CKEditor editor as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read about this in the docs, too: &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#rich-text-fields&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="9" LastEditDate="2018-11-02T18:48:50.603" LastActivityDate="2018-11-02T18:48:50.603" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23079" PostTypeId="2" ParentId="10287" CreationDate="2017-12-06T20:11:14.157" Score="0" Body="&lt;p&gt;More than you ever wanted to know about the Craft &lt;code&gt;{% cache %}&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-06T20:11:14.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23080" PostTypeId="1" AcceptedAnswerId="23082" CreationDate="2017-12-06T20:30:56.443" Score="1" ViewCount="283" Body="&lt;p&gt;I have a field &quot;menu card&quot; in my globals' section &quot;menuCard&quot;, so I could access my file in the template with &lt;code&gt;menuCard.menuCard.first().url&lt;/code&gt;. That is fine, but when the editor changes the menu-card file and it has a different name, the url will be different:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;first week:&#xA;menu-card-17-10-01.pdf&#xA;&#xA;next week:&#xA;menu-card-17-10-08.pdf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As it is a menu-card for a restaurant which gets changed every week it would be awesome to always have the current menu-card pdf available through the same url/slug like &lt;code&gt;myrestaurant.com/menu&lt;/code&gt; and also reference the menu within my templates with &lt;code&gt;/menu&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do so in craftcms? For example an alias which points to my global field &lt;code&gt;menuCard.menuCard.first()&lt;/code&gt; or something like that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx&lt;/p&gt;&#xA;" OwnerUserId="7546" LastEditorUserId="5557" LastEditDate="2017-12-06T21:14:14.393" LastActivityDate="2017-12-06T21:34:34.500" Title="How to point a static url to a file" Tags="&lt;routing&gt;&lt;slug&gt;&lt;files&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23081" PostTypeId="2" ParentId="23080" CreationDate="2017-12-06T20:45:31.537" Score="1" Body="&lt;p&gt;You could setup a template at /menu that grabs the PDF you want and redirects with a 302 (not a 301 since it isn't permanent).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL would change, but that might be ok if you only care about having an easy link to share.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If redirecting is a deal breaker, you could make a small plugin that returns the file with proper headings, then call that from the /menu template.&lt;/p&gt;&#xA;" OwnerUserId="2186" LastEditorUserId="2186" LastEditDate="2017-12-06T20:50:59.680" LastActivityDate="2017-12-06T20:50:59.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23082" PostTypeId="2" ParentId="23080" CreationDate="2017-12-06T21:01:56.237" Score="1" Body="&lt;p&gt;You could create a simple plugin with &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory&lt;/a&gt; and copy the two function I'll give you to create the URL you like&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to the page, turn on the light switch for &quot;Controller&quot; but leave the name blank, download it, copy it to &lt;code&gt;craft/app/plugins/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Include this function to your plugins main file. If you did not disable preview/example code in the page you'll see there is already a &lt;code&gt;cocktails&lt;/code&gt; route there&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return [&#xA;        'menu' =&amp;gt; ['action' =&amp;gt; '&amp;gt;&amp;gt;insertYourPluginNameHere&amp;lt;&amp;lt;/downloadMenuCard'],&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;in this case &lt;code&gt;www.exampleurl.de/menu&lt;/code&gt; would download your file, you can change the key to whatever you want.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Insert this function in your created Controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDownloadMenuCard()&#xA;{&#xA;    $globalSetHandle = 'menuCard'; // change the handle of your global set here if needed&#xA;    $fieldHandle = 'menuCard'; // change the handle of your field here if needed&#xA;    $globals = craft()-&amp;gt;globals-&amp;gt;getSetByHandle($globalSetHandle);&#xA;    /** @var AssetFileModel $asset*/&#xA;    $asset = $globals-&amp;gt;$fieldHandle-&amp;gt;first(); &#xA;    $source = $asset-&amp;gt;getSource();&#xA;    $sourcePath = $source-&amp;gt;settings['path'];&#xA;    $folderPath = $asset-&amp;gt;getFolder()-&amp;gt;path;&#xA;&#xA;    $assetFilePath = $sourcePath.$folderPath.$asset-&amp;gt;filename;&#xA;&#xA;    craft()-&amp;gt;request-&amp;gt;sendFile($assetFilePath, IOHelper::getFileContents($assetFilePath));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can include a redirect after that if you want in order to display the landing page or whatever you want. If you don't want to download the file at all and just display it you can do &lt;code&gt;craft()-&amp;gt;request-&amp;gt;redirect($asset-&amp;gt;getUrl());&lt;/code&gt; after you fetched the asset&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach without a plugin would be to add the route in your &lt;code&gt;craft/config/routes.php&lt;/code&gt; file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'menu' =&amp;gt; 'download.twig',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And do the redirect in the template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set config = craft.globals.getSetByHandle('menuCard') %}&#xA;{% set file = config.menuCard.first() %}&#xA;{% redirect file.getUrl() 302 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-06T21:34:34.500" LastActivityDate="2017-12-06T21:34:34.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23083" PostTypeId="2" ParentId="17138" CreationDate="2017-12-06T22:05:25.143" Score="1" Body="&lt;p&gt;I did contact Craft about this near the time this question was posted, they were not sure why it was occuring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found that this issue was environment specific, it was specifically happening locally on MAMP4, with 5.6.* using NGINX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was unable to find the cause of the issue, but, in the end it was not happening on server environments so I decided to give up.&lt;/p&gt;&#xA;" OwnerUserId="585" LastActivityDate="2017-12-06T22:05:25.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23084" PostTypeId="1" CreationDate="2017-12-06T22:47:15.330" Score="1" ViewCount="133" Body="&lt;p&gt;I am trying to email some Entry data that they have created in CSV Format to the author/logged in user. I have a controller setup with a frontend form posting an action to the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSendCSV(){&#xA; $this-&amp;gt;requirePostRequest();&#xA;&#xA; $entryId = craft()-&amp;gt;request-&amp;gt;getParam('entryId');&#xA; $entry = craft()-&amp;gt;elements-&amp;gt;getElementById($entryId);&#xA;&#xA; $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA; if ($user-&amp;gt;id != $entry-&amp;gt;getAuthor()-&amp;gt;id) {&#xA;     HeaderHelper::setHeader(array('status' =&amp;gt; 404));&#xA;     craft()-&amp;gt;end();&#xA; }else{&#xA;   $list = array(&#xA;     //This is test data I'll construct the entry data here&#xA;    &quot;Peter,Griffin,Oslo,Norway&quot;,&#xA;    &quot;Glenn,Quagmire,Oslo,Norway&quot;);&#xA;    $file = fopen(&quot;test.csv&quot;,&quot;w&quot;);&#xA;    foreach ($list as $line){&#xA;      fputcsv($file,explode(',',$line));&#xA;    }&#xA;&#xA;    $email = new EmailModel();&#xA;    $email-&amp;gt;toEmail = $user-&amp;gt;email;&#xA;    $email-&amp;gt;subject = 'Your CSV';&#xA;    $email-&amp;gt;body = 'How you doin, {{ user.name }}?';&#xA;&#xA;    // Im not really sure what to do next here - do I save the CSV as an asset and then link it here? &#xA;    $email-&amp;gt;addAttachment('path/to/csv/', 'name in e-mail.csv', 'base64', 'text/csv');&#xA;&#xA;    craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA; }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the best way to handle this or should I save the entry data as CSV to my assets folder(Perhaps create a folder just for that user in the process to store all exports from them?) and send a link to users? If so what is the best method to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastActivityDate="2017-12-07T10:28:34.273" Title="Save Entry Data as CSV and Email it to the Author / Logged in User" Tags="&lt;emails&gt;&lt;controller&gt;&lt;entrymodel&gt;&lt;usermodel&gt;&lt;csv&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23085" PostTypeId="2" ParentId="23084" CreationDate="2017-12-07T05:52:47.533" Score="1" Body="&lt;p&gt;For this purpose there is not such a thing like a &quot;best&quot; way. Every thing has advantages and disadvantages. Depending on your goal you should decide what fits best for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally prefer to have my files attached to the email so I can be sure I actually have the file on every device and I can redownload it every time. Other people might say it's better to just have a link for whatever reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would create a temporary file and attach it to the mail like you do. Make sure to name each file separately. If you have really large entries (that need more time to generate the csv) and two authors click the button at the same time they could eventually overwrite each other. So it might be a good idea to include the author ID or something in the filename. You can delete it afterwards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to keep these files you could store them as Craft assets but i don't think this is necessary for your purpose. You could create a record if you like to track the activities. So if you need to see how many authors used that download how often you can insert it into your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the more interesting thing is how to fetch the entries and fields.&#xA;Btw you know you have to parse the body content in order to replace the twig tokens? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;You could use this function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /**&#xA; * Send Email&#xA; *&#xA; * @param $message string&#xA; * @param $subject string&#xA; * @param $mail string&#xA; * @param array $attachments&#xA; * @return bool&#xA; */&#xA;public function sendMail($message, $subject, $mail, $attachments = array()){&#xA;    $adminEmail = craft()-&amp;gt;systemSettings-&amp;gt;getSetting('email', 'emailAddress');&#xA;    $email = new EmailModel();&#xA;&#xA;    $email-&amp;gt;fromEmail = $adminEmail;&#xA;    $email-&amp;gt;replyTo = $adminEmail;&#xA;    $email-&amp;gt;sender = $adminEmail;&#xA;    $email-&amp;gt;fromName = craft()-&amp;gt;getSiteName();&#xA;    $email-&amp;gt;toEmail = $mail;&#xA;    $email-&amp;gt;subject = $subject;&#xA;    $email-&amp;gt;htmlBody = $message;&#xA;&#xA;    if(is_array($attachments) &amp;amp;&amp;amp; count($attachments)){&#xA;        foreach($attachments as $attachment){&#xA;            $email-&amp;gt;addAttachment($attachment['path'], $attachment['name']);&#xA;        }&#xA;    }&#xA;    return craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$attachment = [&#xA;    [&#xA;        'name' =&amp;gt; &quot;The name you want to display.csv&quot;,&#xA;        'path'  =&amp;gt; $file // path/to/your/file&#xA;    ]&#xA;];&#xA;&#xA;$subject = &quot;Your CSV&quot;;&#xA;$email = $user-&amp;gt;email;;&#xA;$message = craft()-&amp;gt;templates-&amp;gt;render('path/to/template', array(&#xA;    'username' =&amp;gt; '...',&#xA;    // .....&#xA;));&#xA;if($this-&amp;gt;sendMail($message, $subject, $email, $attachment)){&#xA;    // message send&#xA;}else{&#xA;    // some errors&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-07T10:28:34.273" LastActivityDate="2017-12-07T10:28:34.273" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23086" PostTypeId="1" CreationDate="2017-12-07T06:24:02.897" Score="1" ViewCount="109" Body="&lt;p&gt;Here is the scenario: I'm trying to create a gift membership subscription for 3 or 6 months of site access that you can send to somebody. Since the most common scenario is that someone else will be paying &amp;amp; sending this to someone as a gift, we obviously don't want the charge their card again at the end of the period, and the membership access should end unless they update their card details &amp;amp; renew with one of our regular subscription plans. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Charge 2 handles subscriptions (which recurring by definition) and it also handles 1-off charges. It's well documented how to create a membership site that is tied to subscriptions. What I’m trying to figure out is how to provide 3 or 6 months of membership, that does not renew at the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Subscription Model offers planInterval and planIntervalCount, but I don't see an option for something like 'endAfterCount' or something similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one-off charges (1 time charge of $39 for 3 months of access, for example) I don't think have a time interval attached to them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm probably missing something obvious here... any help is greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="7586" LastActivityDate="2018-03-24T22:11:32.223" Title="Is it possible to create a 3 month membership instead of a subscription using Charge 2 for Craft CMS?" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23087" PostTypeId="2" ParentId="23054" CreationDate="2017-12-07T06:30:38.090" Score="1" Body="&lt;p&gt;You could try to use Craft and/or freeform hooks &lt;a href=&quot;https://solspace.com/craft/freeform/docs/events-and-hooks/#events-freeform-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/events-and-hooks/#events-freeform-forms&lt;/a&gt; and fetch the assets related to the entry during the &lt;code&gt;beforeSave&lt;/code&gt;process, add field values of the submission to it and save it again. There are examples how to do this in Crafts documentation &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or the most flexible (and for me easiest) thing: create a custom controller that extends the freeform controller and add a few lines to attach those information to the asset. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-07T06:38:35.820" LastActivityDate="2017-12-07T06:38:35.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23088" PostTypeId="2" ParentId="23064" CreationDate="2017-12-07T09:33:25.560" Score="2" Body="&lt;p&gt;Incase helps any other designer come devs who haven't a full grasp on dev/CL workflow, these steps worked for me – with thanks to craft support/community:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;in terminal, run exactly this: &lt;code&gt;PATH=&quot;/Applications/MAMP/bin/php/php7.0.15/bin:$PATH&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;composer create-project craftcms/craft PATH -s beta --ignore-platform-reqs&lt;/code&gt;&#xA;PATH being your absolute path to your project (I crudely type in terminal, &#xA;&lt;code&gt;cd&lt;/code&gt; &#xA;then drag the folder into terminal to get that path).&#xA;Note: I seem to have to go through #1 each time I install Craft3 via composer else I get an error.&#xA;Note: in #1 the php version needs to match what you are using (needs to be 7+ I believe).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="5654" LastEditDate="2017-12-07T10:00:38.550" LastActivityDate="2017-12-07T10:00:38.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23089" PostTypeId="1" AcceptedAnswerId="23090" CreationDate="2017-12-07T10:26:37.630" Score="1" ViewCount="734" Body="&lt;p&gt;I have installed Craft with Composer and have run the set up command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I type in my database name I always get the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Testing database credentials... failed: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried with a Mamp Pro server set up (restarted as per another post) and with a different username (I can't seem to set a password in terminal during the setup?).  Any ideas how I can get past this final hurdle?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="57" LastEditDate="2017-12-07T23:14:47.673" LastActivityDate="2017-12-10T15:23:38.207" Title="Craft 3 composer installation" Tags="&lt;database&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23090" PostTypeId="2" ParentId="23089" CreationDate="2017-12-07T10:44:29.110" Score="3" Body="&lt;p&gt;Have you tried to enter the database information in your &lt;code&gt;.env&lt;/code&gt; file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your password is usually &lt;code&gt;&quot;root&quot;&lt;/code&gt; in a MAMP environment.&lt;/p&gt;&#xA;" OwnerUserId="7707" LastEditorUserId="1098" LastEditDate="2017-12-10T15:23:38.207" LastActivityDate="2017-12-10T15:23:38.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23091" PostTypeId="1" CreationDate="2017-12-07T10:59:07.940" Score="1" ViewCount="20" Body="&lt;p&gt;I am facing a strange issue. All the anchors are getting stripped while publishing the content of Rich Text field. Could anyone please help me.&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2017-12-07T10:59:07.940" Title="Rich Text	field is stripping anchor while showing the content" Tags="&lt;richtext&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23092" PostTypeId="1" CreationDate="2017-12-07T11:38:45.060" Score="1" ViewCount="920" Body="&lt;p&gt;I got a notification in the Craft 3 beta versions I have been working on to upgrade to 3.0.0 RC1. I clicked update and it began updating only the throw the following error. Any ideas what may have happened?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Status: Gateway Time-out&#xA;&#xA;Response: &amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;504 Gateway Time-out&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body bgcolor=&quot;white&quot;&amp;gt;&#xA;&amp;lt;center&amp;gt;&amp;lt;h1&amp;gt;504 Gateway Time-out&amp;lt;/h1&amp;gt;&amp;lt;/center&amp;gt;&#xA;&amp;lt;hr&amp;gt;&amp;lt;center&amp;gt;nginx/1.12.2&amp;lt;/center&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&amp;lt;!-- a padding to disable MSIE and Chrome friendly error page --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it's of any help, this is a composer install using Valet to run.&lt;/p&gt;&#xA;" OwnerUserId="5269" LastActivityDate="2017-12-07T23:24:24.040" Title="Upgrade to 3.0.0 RC1 failed due to 504 Gateway Time-out" Tags="&lt;craft3&gt;&lt;upgrades&gt;&lt;timeout&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23093" PostTypeId="2" ParentId="23092" CreationDate="2017-12-07T12:11:03.880" Score="2" Body="&lt;p&gt;Updated using &lt;code&gt;composer update craftcms/cms&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="5269" LastActivityDate="2017-12-07T12:11:03.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23095" PostTypeId="1" CreationDate="2017-12-07T14:14:32.223" Score="1" ViewCount="244" Body="&lt;p&gt;I'm planning to move from an outside free hosting site to &lt;a href=&quot;https://pages.github.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github Pages&lt;/a&gt; free hosting, my site is a small portfolio, but I make changes every now and then so I want to take advantage to have my changes live right when I push to my repository, not having to copy those files to my hosting server and etc. Also I currently have a paid domain, the process would be, host on Github Pages, and redirect to custom domain, in this case I use Hostinger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I currently have on my Repo the &lt;code&gt;templates&lt;/code&gt; folder, and my the &lt;code&gt;public_html&lt;/code&gt; folder, do I need to include the whole &lt;code&gt;craft&lt;/code&gt; folder and structure?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please any step by step procedure would be appreciated, thanks.&lt;/p&gt;&#xA;" OwnerUserId="6933" LastActivityDate="2017-12-07T14:47:09.103" Title="Hosting Craft Site on Github Pages with Paid Domain" Tags="&lt;hosting&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23096" PostTypeId="2" ParentId="23095" CreationDate="2017-12-07T14:22:08.223" Score="2" Body="&lt;p&gt;Whoops, sorry, just found out that Github Pages only works with static content (No PHP, No database).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Closing.&lt;/p&gt;&#xA;" OwnerUserId="6933" LastActivityDate="2017-12-07T14:22:08.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23097" PostTypeId="2" ParentId="23095" CreationDate="2017-12-07T14:47:09.103" Score="1" Body="&lt;p&gt;Cloudways support Git Deployment. Using this you could have your site on Git and make continuous pushes from anywhere and pull it through Cloudways Control panel. For more information about this you could visit &lt;a href=&quot;https://support.cloudways.com/using-git-for-deployment/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-12-07T14:47:09.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23098" PostTypeId="1" AcceptedAnswerId="23101" CreationDate="2017-12-07T14:50:02.477" Score="1" ViewCount="789" Body="&lt;p&gt;Is it possible to use a custom route for your plugin's CP section, instead of &lt;code&gt;cpTrigger/plugin-handle&lt;/code&gt;, or to direct &lt;code&gt;cpTrigger/plugin-handle&lt;/code&gt; to a different template other than &lt;code&gt;plugin-handle/index.twig&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2017-12-07T17:05:28.180" Title="Is it possible to set a new route for a plug-in CP section in Craft 3?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23099" PostTypeId="2" ParentId="23098" CreationDate="2017-12-07T14:58:56.163" Score="1" Body="&lt;p&gt;Of course you can &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/updating-plugins.md#registercproutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(RegisterUrlRulesEvent $event) {&#xA;    $event-&amp;gt;rules['whateveryoulike'] = ['template' =&amp;gt; 'cocktails/_edit'];&#xA;    $event-&amp;gt;rules['cocktails/&amp;lt;widgetId:\d+&amp;gt;'] = 'cocktails/edit-cocktail';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the url &lt;code&gt;www.example.com/admin/whateveryoulike&lt;/code&gt; redirects you to the template &lt;code&gt;cocktails/_edit&lt;/code&gt;. You don't need to use the plugin-handle, you can overwrite everything but you have to make sure no other plugin overwrites your routes..&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="9" LastEditDate="2017-12-07T16:56:02.420" LastActivityDate="2017-12-07T16:56:02.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23100" PostTypeId="1" CreationDate="2017-12-07T15:22:44.167" Score="3" ViewCount="191" Body="&lt;p&gt;I'm working on a &lt;a href=&quot;https://vuejs.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vue&lt;/a&gt; SPA (single page application) for a client and my &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementAPI&lt;/a&gt; config file has grown to be quite large.  To make it easier to maintain I was looking for suggestions of how to have each endpoint in its own file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any feedback is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="226" LastActivityDate="2017-12-19T20:52:35.373" Title="Break-up Element API Config into partials" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23101" PostTypeId="2" ParentId="23098" CreationDate="2017-12-07T16:54:54.360" Score="1" Body="&lt;p&gt;From your Plugin class, add this code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\events\RegisterUrlRulesEvent;&#xA;use craft\web\UrlManager;&#xA;use yii\base\Event;&#xA;&#xA;// ...&#xA;&#xA;class Plugin extends \craft\base\Plugin&#xA;{&#xA;    $hasCpSection = true;&#xA;&#xA;    public function init()&#xA;    {&#xA;        // Register a custom CP route&#xA;        Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(RegisterUrlRulesEvent $e) {&#xA;            $e-&amp;gt;rules['your/custom/uri'] = ['template' =&amp;gt; 'plugin-handle/index'];&#xA;        });&#xA;    }&#xA;&#xA;    public function getCpNavItem()&#xA;    {&#xA;        // Use the default name &amp;amp; icon, but customize the URL&#xA;        $navItem = parent::getCpNavItem();&#xA;        $navItem['url'] = 'your/custom/uri';&#xA;        return $navItem;&#xA;    }&#xA;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2017-12-07T17:05:28.180" LastActivityDate="2017-12-07T17:05:28.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23102" PostTypeId="1" CreationDate="2017-12-07T17:43:44.160" Score="2" ViewCount="600" Body="&lt;p&gt;I'm working on a Cloudflare integration plugin for Craft 3. I set up the plugin with settings, which works fine so far. Now I intended to verify the Cloudflare credentials using an AJAX call.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set up a controller at &lt;code&gt;controllers/DefaultController&lt;/code&gt; with a method named &lt;code&gt;actionFetchZones&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class DefaultController extends Controller {&#xA;    protected $allowAnonymous = [ 'fetch-zones' ];&#xA;&#xA;    public function init() {&#xA;        parent::init();&#xA;        $this-&amp;gt;defaultAction = 'fetch-zones';&#xA;    }&#xA;&#xA;    public function actionFetchZones() {&#xA;        return $this-&amp;gt;asJson( Plugin::getInstance()-&amp;gt;cloudflare-&amp;gt;getZones() );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I registered the action in the plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// register the actions&#xA;Event::on(&#xA;    UrlManager::class,&#xA;    UrlManager::EVENT_REGISTER_CP_URL_RULES,&#xA;    function( RegisterUrlRulesEvent $event ) {&#xA;        $event-&amp;gt;rules['POST cloudflare/zones'] = 'cloudflare/fetch-zones';&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the response is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST https://host.tld/admin/actions/cloudflare/zones 404 (Not Found)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I request &lt;code&gt;/admin/actions/cloudflare&lt;/code&gt; instead, I receive a &lt;code&gt;200&lt;/code&gt; response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin handle is set to &lt;code&gt;cloudflare&lt;/code&gt;, the app works fine otherwise. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; As requested, below is the AJAX call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest(&#xA;  'cloudflare/zones',&#xA;  { apiKey, email },&#xA;  (response, textStatus, request) =&amp;gt; { /* ... */ }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7275" LastEditorUserId="7275" LastEditDate="2017-12-08T06:07:14.180" LastActivityDate="2017-12-08T06:07:14.180" Title="Craft 3 Plugin - Only default action works" Tags="&lt;craft3&gt;&lt;controller&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23104" PostTypeId="1" CreationDate="2017-12-07T20:07:39.227" Score="1" ViewCount="179" Body="&lt;p&gt;Been working with Craft for about a year, but today for the first time I had to modify the Redactor config to place images inside a body field. I added 'image' to my buttons array and everything seemed OK. The button appeared and I could see and select from all my sources. I selected an image and added it to my body. After I save and check the page, image appears as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I try the same image again, but use an image transform instead. Now when I load the page, the image is missing. When I inspect the page's source, I see this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{asset:99:postThumbnail}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm just echoing out &lt;code&gt;entry.body&lt;/code&gt; as you'd expect. Do I need to run this through a special filter or tag to use the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before saving the image, I tried viewing the markup in the RTE's HTML mode and I see this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;figure&amp;gt;&amp;lt;img src=&quot;/uploads/postThumbnail/_postThumbnail/blog-fiduciary_responsibility_thumb.jpg#asset:99:postThumbnail&quot;&amp;gt;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the hash from the src URL, the field is saved without issue and I can view my image. Adding it back in recreates the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something else I should be doing in my Redactor config, field settings, or template to make this work right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;It appears that Redactor is inserting something called a &lt;a href=&quot;https://craftcms.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference tag&lt;/a&gt; into my &lt;code&gt;src&lt;/code&gt; attribute instead of a regular path. (Why I would want this I don't know.) In the templates, I'm suppose to pass the field value through the &lt;a href=&quot;https://craftcms.com/docs/templating/filters#parseRefs&quot; rel=&quot;nofollow noreferrer&quot;&gt;parseRefs&lt;/a&gt; tag to change that reference into a proper path. Like so...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body|parseRefs|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it appears that nothing is changing (tried with and without &lt;code&gt;raw&lt;/code&gt;). I read in the comments for this old SE Q (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1268/is-it-possible-to-use-twig-in-a-rich-text-field&quot;&gt;Is it possible to use Twig in a Rich Text Field?&lt;/a&gt;) that &lt;code&gt;parseRefs&lt;/code&gt; doesn't work on rich text fields, but that bring up the question of why Redactor is inserting these tags into my rich text in the first place, especially when regular old paths are working so well.&lt;/p&gt;&#xA;" OwnerUserId="6105" LastEditorUserId="6105" LastEditDate="2017-12-08T16:22:40.073" LastActivityDate="2017-12-08T16:22:40.073" Title="Redactor inserts reference tags into IMG when using image transforms, but tag not being processed by parseRefs" Tags="&lt;redactor&gt;&lt;image-transforms&gt;&lt;sources&gt;&lt;reference-tags&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23105" PostTypeId="1" CreationDate="2017-12-07T20:21:42.553" Score="1" ViewCount="448" Body="&lt;p&gt;I'm having a hell of a time tracking where i can change/update the default user profile photo/thumbnail folder location. I keep reading and have tested that you can create a new volume for assets. My interest is is being able to locate and change the default folder location. Any advice?  &lt;/p&gt;&#xA;" OwnerUserId="7711" LastActivityDate="2017-12-08T18:16:07.423" Title="Change/update the default user profile photo/thumbnail folder location" Tags="&lt;image&gt;&lt;default&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23106" PostTypeId="2" ParentId="406" CreationDate="2017-12-07T20:25:40.940" Score="1" Body="&lt;p&gt;For anyone wondering what's going on with a background update, look at the database, there's a table called &lt;code&gt;tasks&lt;/code&gt;, and each row has a &lt;code&gt;steps&lt;/code&gt; counter to tell you how many records are left to update. You can refresh the table to see how the updates are progressing.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastActivityDate="2017-12-07T20:25:40.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23107" PostTypeId="1" CreationDate="2017-12-07T22:24:13.617" Score="1" ViewCount="32" Body="&lt;p&gt;This may be something obvious that I'm missing, but how can I make craft use absolute URLs for images add to rich text editor fields? Or use the {{siteUrl}} prior to the image src URL in order to fix the issue of images not being found. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side note - Why are the images not visible within the rich text editor when added? Is this because of the relative URLs too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7611" LastActivityDate="2017-12-07T22:24:13.617" Title="_entry.twig in sub folder, rich text editor images using relative URL and are therefore not found" Tags="&lt;assets&gt;&lt;richtext&gt;&lt;siteurl&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23108" PostTypeId="2" ParentId="23092" CreationDate="2017-12-07T23:24:24.040" Score="1" Body="&lt;p&gt;You can use this article to help debug 504 Gateway Timeout errors that can be common when updating Craft, because those tend to be longer running operations: &lt;a href=&quot;https://craftcms.com/support/504-gateway-timed-out-error&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/504-gateway-timed-out-error&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/23093/57&quot;&gt;Your solution&lt;/a&gt; works because PHP timeouts from the command line are generally much more forgiving that PHP timeouts from a web browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 uses &lt;a href=&quot;https://getcomposer.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer&lt;/a&gt; for its updating needs (for itself and for plugins).  Composer has a tendency to be the opposite of fast, so you might want to go ahead and bump things like your php.ini file's &lt;code&gt;max_execution_time&lt;/code&gt; for future updates if you plan on doing it from the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-07T23:24:24.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23109" PostTypeId="2" ParentId="23105" CreationDate="2017-12-08T00:34:42.647" Score="1" Body="&lt;p&gt;I am only able to speak about Craft 2x, as I am not familiar at all with how Craft 3 handles profile images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where Craft 2x stores any uploaded profile image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft/storage/userphotos/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is kind of a special asset source that isn't accessible like you would find an asset field that you create is. You &lt;em&gt;can&lt;/em&gt; render the image, but as far as I know, you are not able to change it's location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-12-08T00:34:42.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23110" PostTypeId="2" ParentId="23105" CreationDate="2017-12-08T01:11:45.587" Score="2" Body="&lt;p&gt;In Craft 3 the place that users photos get stored in are proper Asset Volumes, meaning they can be stored in a folder on the local file system, or on S3, Google Cloud, or any other place that a plugin provides a Volume for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you create a Volume for user photos, go to Settings-&gt;Users-&gt;Settings in the Control Panel and you can choose that Volume under the &quot;User Photo Volume&quot; settings.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-08T01:11:45.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23111" PostTypeId="1" AcceptedAnswerId="23115" CreationDate="2017-12-08T08:46:26.360" Score="5" ViewCount="1182" Body="&lt;p&gt;I want to render a Twig template in an API endpoint. Specifically I need HTML for the JSON Feed field &quot;content_html&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempts until now (inside the transformer function):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = Craft::$app-&amp;gt;getView();&#xA;$template = $view-&amp;gt;resolveTemplate('_blog-entry');&#xA;&#xA;// first attempt:&#xA;$html = $view-&amp;gt;render($template, ['entry' =&amp;gt; $blogpost]);&#xA;&#xA;// second attempt:&#xA;$controller = Craft::$app-&amp;gt;createController('templates/render')[0];&#xA;&#xA;$html = $controller-&amp;gt;render($template, ['entry' =&amp;gt; $blogpost])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in both ways it says &quot;Template not found&quot; even if the path after the &quot;resolveTemplate&quot; is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anybody an idea how to do it? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6504" LastEditorUserId="6504" LastEditDate="2017-12-08T09:43:10.117" LastActivityDate="2019-02-19T11:02:14.130" Title="How to render a Twig template in the element-api plugin (v2.5)" Tags="&lt;plugin-elementapi&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23112" PostTypeId="1" CreationDate="2017-12-08T09:12:59.097" Score="2" ViewCount="156" Body="&lt;p&gt;I have a structure section, where the last child should be an anchor in the slug:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;parent/parent#child&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to setup conditional url formats on nested entries as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri}{% if object.getDescendants().total() != 0 %)/{% else %}#{% endif %}{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried the simpler&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri}{% if object.hasDescendants %)/{% else %}#{% endif %}{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but keep getting stuck tasks when re-saving entries. Can someone tell me what I'm doing wrong? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2017-12-09T03:04:49.113" Title="Conditional anchor in structure url" Tags="&lt;url&gt;&lt;structure&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23113" PostTypeId="1" CreationDate="2017-12-08T12:56:02.767" Score="6" ViewCount="3843" Body="&lt;p&gt;I've installed Craft 3 through composer and I'm attempting to work through the setup process within terminal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MacBook-Pro:~ jamie$ ~/Documents/repos/__craft-3-beta/craft setup&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] &#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: craft-three&#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] 127.0.0.1&#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: [craft-three] &#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that I get 2 different errors when using the IP add and localhost for DB_SERVER&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also cant get it working when manually filling in the .env file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using MAMP Pro on a Mac. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on this will be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7714" LastEditorUserId="57" LastEditDate="2017-12-08T17:45:21.057" LastActivityDate="2019-04-18T10:28:34.110" Title="Craft 3 Command setup failing" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;composer&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23114" PostTypeId="1" CreationDate="2017-12-08T13:29:23.113" Score="0" ViewCount="328" Body="&lt;p&gt;When I set the Focal Point for the first time, it works. If I change the Focal Point and save again, the changes do not take effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I set the Focal Point and &quot;save as a new asset&quot;, I can use that new file and its Focal Point. But, if I change that Focal Point, I have to &quot;save as a new asset&quot;, which creates multiple copies of the same image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also using ImageOptimize plugin. Any ideas why my Focal Point changes don't take effect?&lt;/p&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2017-12-08T16:25:10.000" Title="Focal Point - Changes don't take effect when Saved a second, or third time" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2017-12-12T04:58:16.630" ContentLicense="CC BY-SA 3.0" />
  <row Id="23115" PostTypeId="2" ParentId="23111" CreationDate="2017-12-08T14:20:33.300" Score="4" Body="&lt;p&gt;You didn’t tell where that Twig file is located, but I assume your issue has to do with being in the wrong “Template Mode”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s how you can switch mode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Documentation: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-plugin-templates-on-front-end-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-plugin-templates-on-front-end-requests&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="9" LastEditDate="2018-11-02T18:45:39.227" LastActivityDate="2018-11-02T18:45:39.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23117" PostTypeId="1" AcceptedAnswerId="23133" CreationDate="2017-12-08T15:57:37.277" Score="2" ViewCount="395" Body="&lt;p&gt;I have a photo gallery that pulls in all entries and then finds the images within them and then displays them along with links to the entries that used that image.&#xA;Except, it's not pulling in the ones that are in a matrix field named extendedContent with a block type of insertedImage and a asset field named image.&#xA;A simplified version of the code I'm using is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content = craft.entries({&#xA;    section: 'news,information,events',&#xA;    with: ['imageGallery','extendedContent.insertedImage:image']&#xA;}) %}&#xA;&#xA;{% paginate craft.assets.relatedTo(content).order('elements.dateCreated desc').kind('image').limit(25) as pageInfo, usedPhotos %}&#xA;&#xA;{# Loop through the array of assets #}&#xA;{% for imageGallery in usedPhotos %}  &#xA;    &amp;lt;img src=&quot;{{ imageGallery.url }}&quot;&amp;gt;&#xA;&#xA;    {# find all entries related to this asset #}&#xA;    {% set entry = craft.entries.relatedTo(imageGallery).order('title') %}&#xA;        {% for entry in entry %}&#xA;            {{ entry.title }}&#xA;        {% endfor %}  &#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Added: I'm guessing the issue is that the relationship of the image in the matrix field isn't to the entry but to the block it's in?&#xA;Does that mean that it's not possible to do what I want?&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2017-12-12T16:55:06.807" LastActivityDate="2017-12-12T16:55:06.807" Title="How to get all images from entries including Matrix field" Tags="&lt;matrix&gt;&lt;entrymodel&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23118" PostTypeId="2" ParentId="23114" CreationDate="2017-12-08T16:25:10.000" Score="1" Body="&lt;p&gt;If you're using Chrome, make sure you open up the URL to the image itself (you can do this by clicking on the variant in the OptimizedImages field) and do a Shift-reload. Chrome will locally cache images so you won't see the changes unless you force it to reload the image from the source.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-08T16:25:10.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23120" PostTypeId="1" AcceptedAnswerId="23121" CreationDate="2017-12-08T18:30:22.950" Score="1" ViewCount="109" Body="&lt;p&gt;If I have just one S3 bucket, should I still have multiple asset 'sources' in order to account for different asset types? Or should I just have multiple folders under single asset source to differentiate media types?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I might have these folders under a single asset source:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Illustrations/Icons&lt;/li&gt;&#xA;&lt;li&gt;Marketing Images&lt;/li&gt;&#xA;&lt;li&gt;Screenshots&lt;/li&gt;&#xA;&lt;li&gt;Marketing Videos&lt;/li&gt;&#xA;&lt;li&gt;Support Videos&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It just seems silly to add multiple asset 'sources' when the details are the same.&lt;/p&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2017-12-20T14:50:00.023" Title="What's the purpose of multiple asset sources?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23121" PostTypeId="2" ParentId="23120" CreationDate="2017-12-08T18:50:42.360" Score="2" Body="&lt;p&gt;You should use the bucket directory structure for the different asset types; you're right, they are all coming from the same source, really, so separete asset sources wouldn't be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another asset source would be simply another bucket, or another type of source such as Google Cloud or Rackspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could have an asset source called &lt;strong&gt;Web S3 Assets&lt;/strong&gt;, which connects to your bucket. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, you could have these directories within that bucket for all the types of assets you need to store.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;bucket-url&amp;gt;/images/icons/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;bucket-url&amp;gt;/images/illustrations/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;bucket-url&amp;gt;/images/screenshots/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;bucket-url&amp;gt;/videos/marketing/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;bucket-url&amp;gt;/videos/support/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;https://craftcms.com/docs/assets-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;Assets Fields&lt;/a&gt; to force usage, upload restrictions on these directories.&lt;/p&gt;&#xA;" OwnerUserId="6978" LastEditorUserId="6978" LastEditDate="2017-12-20T14:50:00.023" LastActivityDate="2017-12-20T14:50:00.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23122" PostTypeId="1" CreationDate="2017-12-08T20:41:08.227" Score="1" ViewCount="260" Body="&lt;p&gt;Ok, just thinking out loud and trying to work out the best way to achieve something. I have a community site with roughly 25k users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to create a way to send messages to those users within the front end of the site. This might be, for example, a notification of a new entry based on a set of criteria or even a message from the site admin to every user advising of a new feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user should be able to view the message, which marks it as read and have the ability to delete it. All messages would live in a notifications page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m just wondering if this is something that’s possible to achieve using Craft (via a plugin) or are there other services that are better suited to this. I can’t find anything online, everything seems geared towards push notifications which is slightly different to what I’m after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts as I can’t quite get my head around a way to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2017-12-15T10:38:12.610" Title="Creating a web app notification system/center?" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23124" PostTypeId="1" AcceptedAnswerId="23187" CreationDate="2017-12-08T23:35:07.620" Score="1" ViewCount="109" Body="&lt;p&gt;I want to output a list of events some of which are repeating, on a monthly basis. Each event should show up once even if it's scheduled to repeat multiple times in the same month and the information for each event must also include the date of last occurrence if there is one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be a little bit more specific I would like to access the value of the field &quot;End repeat&quot; when it's value is set to &quot;On date&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastEditorUserId="5881" LastEditDate="2017-12-12T19:49:08.780" LastActivityDate="2017-12-13T09:32:09.637" Title="Is there a way to retrieve the last date of an event using the Solspace calendar plugin?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23125" PostTypeId="1" AcceptedAnswerId="23126" CreationDate="2017-12-08T23:45:00.840" Score="1" ViewCount="492" Body="&lt;p&gt;I have a question about combining Twig and jQuery in Craft. I have a couple of filters on a page that outputs some entries:&#xA;&lt;a href=&quot;http://www.joycefdn.org/grants&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.joycefdn.org/grants&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My categories are organized like this:&#xA;Education and Economic Mobility&#xA; - Educator Quality &#xA; - Innovation&lt;br&gt;&#xA; - Pathways &#xA;Environment &#xA; - Climate Solutions&lt;br&gt;&#xA; - Great Lakes&lt;br&gt;&#xA;Culture &#xA; - Arts Access and Participation&lt;br&gt;&#xA; - Arts Leadership and Workforce&lt;br&gt;&#xA; - Creativity and Cultural Production&lt;br&gt;&#xA; - Joyce Awards &#xA;Democracy&lt;br&gt;&#xA; - Fair Elections&lt;br&gt;&#xA; - Media&lt;br&gt;&#xA;Gun Violence Prevention and Justice Reform&lt;br&gt;&#xA; - Gun Violence Prevention&lt;br&gt;&#xA; - 21st Century Policing&lt;br&gt;&#xA; - Reducing Mass Incarceration&lt;br&gt;&#xA;Special Opportunities&lt;br&gt;&#xA; - Communications&lt;br&gt;&#xA; - Cross-Programmatic Innovations&lt;br&gt;&#xA; - Digital Tools&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the top level being Programs and the second level being focus areas.  I would like to have it so that when a Program is selected then the Focus Area select menu gets populated with the categories that are children of that program.  I currently have this jQuery left over from another method I tried which does get the current Programs that are selected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;.grants-data form[name='grantSearch'] select[name='program']&quot;).change(function(){&#xA;    var selectedPrograms = $(&quot;form[name='grantSearch'] input[data-name='selectItemprogram'][value!='']:checked&quot;).map(function() {&#xA;    return this.value;&#xA;                }).get().join('|');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I have this which appends all of the descendants of all categories to the focus area menu:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catSlug = craft.categories.title('focusArea').first() %}&#xA;            {% set childFAs = craft.categories.descendantOf(catSlug) %} &#xA;            $(&quot;select#focusArea&quot;).html('&amp;lt;option value=&quot;&quot;&amp;gt;Focus Area&amp;lt;/option&amp;gt;');&#xA;            {% for fa in childFAs %}&#xA;            $(&quot;select#focusArea&quot;).append('&amp;lt;option value=&quot;{{fa.title}}&quot;&amp;gt;{{fa.title}}&amp;lt;/option&amp;gt;');&#xA;            {% endfor %}&#xA;            {% if faSlug|length %}&#xA;                $(&quot;select#focusArea option[value='{{faSlugOrig}}']&quot;).attr('selected',true);&#xA;            {% endif %}&#xA;            &amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I can't seem to connect these two so that only the descendants of the program that is clicked get populated.  I think I may be overthinking this or trying to combine two methods that just won't combine.  Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="5824" LastActivityDate="2017-12-09T01:30:49.183" Title="Selecting descendants of a category when ancestor is clicked" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23126" PostTypeId="2" ParentId="23125" CreationDate="2017-12-09T01:05:37.030" Score="0" Body="&lt;p&gt;Okay, please don't be afraid and give it a try. I'm using the angular way, it seems a little bit difficult but it's actually really easy once you get used to it and works perfectly as soon as you understand it a little bit. If you need changes I'll provide whatever you need.&lt;br&gt;&#xA;&lt;strong&gt;Edit&lt;/strong&gt;: here you can see a live example for it &lt;a href=&quot;https://plnkr.co/edit/uqIupfOslx7qWMedoiBE?p=preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;plunker&lt;/a&gt; or course without css but it is your html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's get into it.&#xA;For testing purposes I created this category structure in my backend and called the group &lt;code&gt;filter&lt;/code&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QAVVY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QAVVY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you need to include this library you can of course use the &lt;code&gt;{% includeJsRessource %}&lt;/code&gt; as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you create 2 javascript arrays one for the Culture, Democracy... I call them parents and one for their children that belong to them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get all filters of the first level&#xA;{% set filters = craft.categories.group('filter').level(1).find() %}&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var children = [];&#xA;    var parents = [];&#xA;    {% for filter in filters %}&#xA;        parents.push({&#xA;            title: &quot;{{ filter.title }}&quot;,&#xA;            id: &quot;{{ filter.id }}&quot;&#xA;        });&#xA;        // now fetch all children for them&#xA;        {% set children = craft.categories.group('filter').descendantOf(filter).level(2).find() %}&#xA;        {% for child in children %}&#xA;            children.push({&#xA;                title: &quot;{{ child.title }}&quot;,&#xA;                id: &quot;{{ child.id }}&quot;,&#xA;                parent: &quot;{{ filter.id }}&quot;&#xA;            });&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the end you'll have 2 array that could look like&lt;a href=&quot;https://i.stack.imgur.com/5qnGf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5qnGf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the funny part starts&#xA;include this javascript file. You can ask whatever you want I'll explain it. Even if the syntax and everything what's going on seems a little bit strange, but make sure this is loaded &lt;strong&gt;after&lt;/strong&gt; the library from above&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var  myApp = angular.module('myApp',[]).config(function($interpolateProvider) {&#xA;    $interpolateProvider.startSymbol('{[{').endSymbol('}]}');&#xA;});&#xA;&#xA;myApp.controller('filterController', ['$scope', function ($scope) {&#xA;    // all parents&#xA;    $scope.parents = parents;&#xA;    // all children&#xA;    $scope.children = children;&#xA;&#xA;    // return if the parent is selected or not&#xA;    $scope.filterBySelectedParent = function (item) {&#xA;        return $scope.selectedParents.indexOf(item.parent) !== -1;&#xA;    };&#xA;&#xA;    // an array with all selected parent ids&#xA;    $scope.selectedParents = [];&#xA;&#xA;    // include an item to the array or slice it when the input it clicked&#xA;    $scope.addFilter = function(id){&#xA;        var index = $scope.selectedParents.indexOf(id);&#xA;        if(index === -1){&#xA;            $scope.selectedParents.push(id);&#xA;        }else{&#xA;            $scope.selectedParents.splice(index, 1);&#xA;        }&#xA;    }&#xA;}]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally your new html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- this is your menu or your filter bar or whatever you want to call it --&amp;gt;&#xA;&amp;lt;!-- I inspected your html and tried to use that but you must include ng-app and ng-controller somewhere --&amp;gt;&#xA;&amp;lt;div ng-app=&quot;myApp&quot; ng-controller=&quot;filterController&quot;&amp;gt;&#xA;    &amp;lt;!-- your first ul... all your parents, the first filter in your page --&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li ng-repeat=&quot;filter in parents&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; ng-click=&quot;addFilter(filter.id);&quot; value=&quot;{[{filter.id}]}&quot;&amp;gt;&amp;lt;span&amp;gt;{[{ filter.title }]}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;!-- all your children, the second filter in your page --&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li class=&quot;&quot; ng-repeat=&quot;child in children | filter: filterBySelectedParent&quot;&amp;gt;&#xA;            &amp;lt;label class=&quot;&quot; &amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; data-name=&quot;selectItemfocusArea&quot; value=&quot;{[{ child.id }]}&quot;&amp;gt;&amp;lt;span&amp;gt;{[{ child.title }]}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/label&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;!-- include the rest here --&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: so what actually happens is the following &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;you create 2 arrays in javascript based on your backend inputs&lt;/li&gt;&#xA;&lt;li&gt;angular renders your menu based on those two arrays but the second one has a filter. Only clicked items of the first array are shown&lt;/li&gt;&#xA;&lt;li&gt;as soon as someone clicks on an filter it is included in an array &lt;code&gt;$scope.selectedParents&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;any change in this array is recognized automatically which results, that the html renders again =&gt; your other filters are shown.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please tell me if I missunderstood you somehow.. based on my current state I can change nearly everything really easily in just a few clicks. For example if you would like to automatically select your children you would include &lt;code&gt;ng-checked=&quot;filterBySelectedParent(child)&quot;&lt;/code&gt; on your input and remove the &lt;code&gt;| filter: filterBySelectedParent&lt;/code&gt;.. that's it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-09T01:30:49.183" LastActivityDate="2017-12-09T01:30:49.183" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23127" PostTypeId="2" ParentId="23112" CreationDate="2017-12-09T03:04:49.113" Score="2" Body="&lt;p&gt;There was a typo hidden in there, otherwise the logic works. To get children as anchors in a structure, the following should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri}{% if object.getDescendants().total() != 0 %}/{% else %}#{% endif %}{slug}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2017-12-09T03:04:49.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23128" PostTypeId="2" ParentId="23113" CreationDate="2017-12-09T05:54:44.547" Score="5" Body="&lt;p&gt;I was just confronted with this too. You most likely need to specify the unixSocket attribute for the MAMP Pro database. Take a look at my problem and solution at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23056/craft-cli-rc1-connectivity-issues-with-mamp-pro&quot;&gt;Craft CLI RC1 Connectivity Issues with MAMP Pro&lt;/a&gt;. Though if you're not able to get it working at all even manually I would definitely suggest resetting your root password in MAMP Pro as well.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2017-12-09T05:54:44.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23129" PostTypeId="2" ParentId="23122" CreationDate="2017-12-09T12:51:27.347" Score="2" Body="&lt;p&gt;I created a simple plugin for you to start. Note that is not a ready-to-use plugin so you'll have to change the things you need. This is just meant to be a starting point for you.&#xA;You can use the code and change it how you like it but mostly it is for learning purposes. So please don't expect it to be &quot;finished&quot; since I don't know your needs and your structure. The most important thing: my css/design skills are awful so I did not style anything.. you have to do it on your own&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to say what I could/should change for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here it is &lt;a href=&quot;https://github.com/Anubarak/usernotifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Usernotifications&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So let's go through it:&lt;/strong&gt;&lt;br&gt;&#xA;My idea was to create a section called &lt;code&gt;usernotifications&lt;/code&gt; (you don't have to do it by yourself, it is created onAfterInstall and can be changed later) that has different entry types for different messages and purposes. If you want to change the section handle make sure to change the &lt;code&gt;$criteria-&amp;gt;section = 'usernotifications';&lt;/code&gt; in my service. This way you can create messages/notifications how you like and make them really dynamic. Please read this for some ideas and instructions &lt;a href=&quot;https://github.com/Anubarak/usernotifications#usernotifications-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft renders all those entries unless the user dismisses them or if they are too old. Check my service for the logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Controller&lt;/strong&gt;:&lt;br&gt;has two methods, the first is &lt;code&gt;actionRemoveNotification&lt;/code&gt;to remove a message/notification for a user. So you'll display a &lt;code&gt;dismiss&lt;/code&gt; button and as soon as someone clicks it, you create a record in your database with the userId and the entryId, so you know which user removed a notification. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Remove a notification for a user &#xA; */&#xA;public function actionRemoveNotification(){&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $response = [&#xA;        'success'   =&amp;gt; false,&#xA;        'message'   =&amp;gt; 'could not find entry'&#xA;    ];&#xA;    if($entryId = craft()-&amp;gt;request-&amp;gt;getParam('id')){&#xA;        $userId = craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id;&#xA;&#xA;        $record = UsernotificationsRecord::model()-&amp;gt;find('entryId = :entryId AND userId = :userId', array(&#xA;            'entryId'   =&amp;gt; $entryId,&#xA;            'userId'    =&amp;gt; $userId&#xA;        ));&#xA;        if($record){&#xA;            // user already removed the message... there must be something wrong or he/ she cheated :P&#xA;            // you can actually ignore this... just wanted to show you how to search for entries^^&#xA;        }else{&#xA;            $record  = new UsernotificationsRecord();&#xA;        }&#xA;&#xA;        $record-&amp;gt;userId = $userId;&#xA;        $record-&amp;gt;entryId = $entryId;&#xA;&#xA;        if($record-&amp;gt;save()){&#xA;            $response['success'] = true;&#xA;            $response['message'] = 'notification removed for user';&#xA;         }else{&#xA;            $response['message'] = 'could not save record';&#xA;            $response['errors'] = $record-&amp;gt;getErrors();&#xA;        }&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The service&lt;/strong&gt;: &lt;br&gt;&#xA;The service should return all notifications for the current User or nothing at all if the user is not logged in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Get all notifications for the current user&#xA; *&#xA; * @return string&#xA; */&#xA;public function getAllNotificationsForUser(){&#xA;    // check if user is logged in...&#xA;    if(!craft()-&amp;gt;userSession-&amp;gt;getUser()){&#xA;        return false;&#xA;    }&#xA;&#xA;    // fetch all removed notifications of the user to not fetch them in our query&#xA;    $removedNotifications = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('entryId')&#xA;        -&amp;gt;from('usernotifications')&#xA;        -&amp;gt;where(['userId' =&amp;gt; craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;id])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = 'usernotifications';&#xA;    // user should not be overwhelmed with too many notification when they didn't log in for too long&#xA;    // so show only notifications 14 days ago, you can change this length or remove it if you want&#xA;    // but make sure to change the value in the task as well.&#xA;    // you could also create settings for the plugin where you can store how long&#xA;    // then entries should be displayed&#xA;    $someDateInThePast = date('U', strtotime(&quot;-14 days&quot;));&#xA;&#xA;    $criteria-&amp;gt;postDate = &quot;&amp;gt; &quot; . $someDateInThePast;&#xA;    // exclude the ids of the removed notifications&#xA;    if($removedNotifications){&#xA;        $criteria-&amp;gt;id = 'and, not ' . implode(', not ', $removedNotifications);&#xA;    }&#xA;&#xA;    return $criteria-&amp;gt;find();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your Variable&lt;/strong&gt;&lt;br&gt;&#xA;In your variable you'll get the html for those notifications, you can find the templates in &lt;code&gt;templates/entries/entrytypes&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllNotificationsForUser(){&#xA;    $html = '';&#xA;    $entries = craft()-&amp;gt;usernotifications-&amp;gt;getAllNotificationsForUser();&#xA;    if($entries){&#xA;        // I get a deprecated hint here, but the solution stated in craft throws&#xA;        // an exception... So I'm using this one&#xA;        $oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;        $newPath = craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'usernotifications/templates';&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;        $html = craft()-&amp;gt;templates-&amp;gt;render('entries/index.twig', array(&#xA;            'entries' =&amp;gt; $entries&#xA;        ));&#xA;        craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;    }&#xA;    return $html;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess these are the most important parts, you can check the rest in my git repo and ask/request whatever you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can render the entries with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set notifications = craft.usernotifications.getAllNotificationsForUser() %}&#xA;{{ notifications|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before I forget it: I created a task to remove too old records. You can access it via &lt;code&gt;/admin/actions/usernotifications/removeOldRecords&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-09T15:56:55.160" LastActivityDate="2017-12-09T15:56:55.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23130" PostTypeId="1" AcceptedAnswerId="23131" CreationDate="2017-12-09T14:45:14.407" Score="1" ViewCount="717" Body="&lt;p&gt;I have a section &quot;Emails&quot; which has an entry 'Welcome Email'. The template assigned for it under Section is '_email/welcome'. This works fine when viewed in frontend. But I want to render the same template in my plugin services. The code I have used is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$template = 'welcome';&#xA;$data = 'foo';&#xA;&#xA;$oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;$path = craft()-&amp;gt;path-&amp;gt;getTemplatesPath().'_email/';&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($path);&#xA;$html = craft()-&amp;gt;templates-&amp;gt;render($template,$data);&#xA;$breaks = array(&quot;&amp;lt;br /&amp;gt;&quot;,&quot;&amp;lt;br&amp;gt;&quot;,&quot;&amp;lt;br/&amp;gt;&quot;);  &#xA;$text = str_ireplace($breaks, &quot;\r\n&quot;, $html);&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this gives an error &quot;_email/_layout&quot; not found in craft.log . What am I doing wrong ? Could anyone please help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-12-09T15:04:52.210" Title="How to render an entry template in plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23131" PostTypeId="2" ParentId="23130" CreationDate="2017-12-09T15:04:52.210" Score="1" Body="&lt;p&gt;If it is a frontend request&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = craft()-&amp;gt;templates-&amp;gt;render('_emails/_layout.twig', $data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in a backend request&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$oldPath = craft()-&amp;gt;path-&amp;gt;getTemplatesPath();&#xA;$newPath = craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath();&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($newPath);&#xA;$html = craft()-&amp;gt;templates-&amp;gt;render('_emails/_layout.twig', array());&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($oldPath);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-09T15:04:52.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23133" PostTypeId="2" ParentId="23117" CreationDate="2017-12-09T19:03:39.923" Score="2" Body="&lt;p&gt;I doubt there is a good solution in twig but you can fetch the entries with php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you have to get all used asset Ids. So you'll check in the &lt;code&gt;relations&lt;/code&gt; table for all used assets with your 2 fields and for entries with your section ids&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllAssetsRelatedToEntries(){&#xA;    // list the ids of the sections, so you need the id of news, information and events&#xA;    $sectionIds = [2, 7];&#xA;    // id of your insertedImage field&#xA;    $fieldIdMatrixContent = 6;&#xA;    // id of your imageGallery field&#xA;    $fieldIdImageGallery = 7;&#xA;&#xA;    // fetches all assets that have a relation in the matrix field&#xA;    $imagesFromMatrixContent =  craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_relations.targetId')&#xA;        -&amp;gt;from('relations')&#xA;        -&amp;gt;join('matrixblocks', 'craft_matrixblocks.id = craft_relations.sourceId')&#xA;        -&amp;gt;join('entries', 'craft_entries.id = craft_matrixblocks.ownerId')&#xA;        -&amp;gt;where('craft_relations.fieldId = :fieldId', ['fieldId' =&amp;gt; $fieldIdMatrixContent])&#xA;        -&amp;gt;andWhere(['in', 'craft_entries.sectionId', $sectionIds])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    // fetches all assets that are related with the ImageGallery Field&#xA;    $imagesFromNormalField = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_relations.targetId')&#xA;        -&amp;gt;from('relations')&#xA;        -&amp;gt;where('craft_relations.fieldId = :fieldId', ['fieldId' =&amp;gt; $fieldIdImageGallery])&#xA;        -&amp;gt;join('entries', 'craft_entries.id = craft_relations.sourceId')&#xA;        -&amp;gt;andWhere(['in', 'craft_entries.sectionId', $sectionIds])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    return array_unique(array_merge($imagesFromMatrixContent,$imagesFromNormalField));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return you an array of all ids, thus you can build your paginate or other queries like you want and change the sort order or include other conditions&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allAssetIds = craft.pFplugin.getAllAssetsRelatedToEntries() %}&#xA;{% paginate craft.assets.id(allAssetIds).kind('image').limit('30') as pageInfo, usedPhotos %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The next step will be to search the entries for each asset&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllEntriesForAsset($assetId)&#xA;{&#xA;    // list the ids of the sections, so you need the id of news, information and events&#xA;    $sectionIds = [2, 7];&#xA;    // id of your insertedImage field&#xA;    $fieldIdMatrixContent = 6;&#xA;    // id of your imageGallery field&#xA;    $fieldIdImageGallery = 7;&#xA;&#xA;    $entryIdsFromMatrix = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_matrixblocks.ownerId')&#xA;        -&amp;gt;from('relations')&#xA;        -&amp;gt;join('matrixblocks', 'craft_matrixblocks.id = craft_relations.sourceId')&#xA;        -&amp;gt;where('craft_relations.targetId = :assetId', ['assetId' =&amp;gt; $assetId])&#xA;        -&amp;gt;join('entries', 'craft_entries.id = craft_matrixblocks.ownerId')&#xA;        -&amp;gt;andWhere('craft_relations.fieldId = :fieldId', ['fieldId' =&amp;gt; $fieldIdMatrixContent])&#xA;        -&amp;gt;andWhere(['in', 'craft_entries.sectionId', $sectionIds])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    $entryIdsImageGallery = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_relations.sourceId')&#xA;        -&amp;gt;from('relations')&#xA;        -&amp;gt;where('craft_relations.targetId = :assetId', ['assetId' =&amp;gt; $assetId])&#xA;        -&amp;gt;join('entries', 'craft_entries.id = craft_relations.sourceId')&#xA;        -&amp;gt;andWhere(['in', 'craft_entries.sectionId', $sectionIds])&#xA;        -&amp;gt;andWhere('craft_relations.fieldId = :fieldId', ['fieldId' =&amp;gt; $fieldIdImageGallery])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    return array_unique(array_merge($entryIdsFromMatrix,$entryIdsImageGallery));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesForAsset = craft.pFplugin.getAllEntriesForAsset(asset.id) %}&#xA;{% for entry in craft.entries().id(entriesForAsset).order('title') %}&#xA;    {{ entry.id }} {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In total it could look like this I just did not use the paginate&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allAssetIds = craft.pFplugin.getAllAssetsRelatedToEntries() %}&#xA;{% for asset in craft.entries.id(allAssetIds).find() %}&#xA;    {{ asset.id }} {{ asset.title }}&#xA;    Entries for Image&amp;lt;br&amp;gt;&#xA;    {% set entriesForAsset = craft.pFplugin.getAllEntriesForAsset(asset.id) %}&#xA;        {% for entry in craft.entries().id(entriesForAsset).order('title') %}&#xA;        {{ entry.id }} {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-11T08:45:48.463" LastActivityDate="2017-12-11T08:45:48.463" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23135" PostTypeId="1" AcceptedAnswerId="23138" CreationDate="2017-12-10T04:26:22.797" Score="2" ViewCount="198" Body="&lt;p&gt;I am uploading a repo that works fine on a staging server to a live server. When doing so however the homepage is showing as &quot;index of \&quot; page with the public and readme.md directories showing. Like so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Wudk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Wudk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i click on the public link it brings me to  the page, however it has no public assets or css. it is just HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8LO1w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8LO1w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database is linked properly. their are no errors that are showing as it is on dev mode. What can I do to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the file structure in my home directory which is proper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GdKWc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GdKWc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="7718" LastEditorUserId="7718" LastEditDate="2017-12-10T09:41:38.187" LastActivityDate="2017-12-10T11:50:12.087" Title="Homepage showing up as &quot;index of \&quot; page" Tags="&lt;assets&gt;&lt;php&gt;&lt;css&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23136" PostTypeId="1" CreationDate="2017-12-10T08:33:14.033" Score="2" ViewCount="139" Body="&lt;p&gt;I have configured several discounts based on usergroup conditions in Craft Commerce. Now i would like to create a price list for the shop owner, that contains the prices for the several usergroups. Below is a (try...) code example on how it should work. Is such a price list possible with Craft Commerce? How can i get this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set products = craft.commerce.products.type('normal').find() %}&#xA;&#xA;    {% for product in products %}&#xA;      {% for variant in product.variants %}&#xA;        {{ variant.sku }} - {{ variant.salePrice|forUsergroup(&quot;normal&quot;) }} -  {{ variant.salePrice|forUsergroup(&quot;silver&quot;) }} - {{ variant.salePrice|forUsergroup(&quot;gold&quot;) }} &amp;lt;br&amp;gt;&#xA;      {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3535" LastActivityDate="2017-12-19T05:59:46.160" Title="Craft Commerce price lists with discounts" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23137" PostTypeId="2" ParentId="23135" CreationDate="2017-12-10T10:03:19.913" Score="1" Body="&lt;p&gt;Ok here is a quick solution to your problem: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Move all your public files to the same directory where your craft folder is.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Change your Craft path in index.php file. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-12-10T10:03:19.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23138" PostTypeId="2" ParentId="23135" CreationDate="2017-12-10T11:50:12.087" Score="2" Body="&lt;p&gt;I found the problem, I guess it wasn't craft cms related. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had to update my apache2 site-enabled config file!&lt;/p&gt;&#xA;" OwnerUserId="7718" LastActivityDate="2017-12-10T11:50:12.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23139" PostTypeId="1" AcceptedAnswerId="23381" CreationDate="2017-12-10T12:59:28.437" Score="3" ViewCount="1402" Body="&lt;p&gt;Craft 3 RC is installed locally. After clicking on the &lt;strong&gt;Plugin Store&lt;/strong&gt; the loading animation stays for 1-3 seconds. After that, the right canvas leaves grey without content.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've checked the XHR request, it seems working.&lt;/li&gt;&#xA;&lt;li&gt;reinstalled Craft with composer&lt;/li&gt;&#xA;&lt;li&gt;tested several browsers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What could be a reason for an empty Plugin Store?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tested the issue with a clean install of Craft 3, same problem there. So it should be something global on my machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone have an idea where the problem could be hidden?&lt;/p&gt;&#xA;" OwnerUserId="7146" LastEditorUserId="7146" LastEditDate="2017-12-19T20:10:21.870" LastActivityDate="2018-04-10T06:19:32.123" Title="Plugin Store doesn't get content" Tags="&lt;plugins&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23141" PostTypeId="1" CreationDate="2017-12-10T23:29:59.830" Score="1" ViewCount="29" Body="&lt;p&gt;I'm adding a basic annual subscription to a portion of a website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have Registration Behaviour set to&#xA;Always - creates an account for all guest payments&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on the subscription form the createAccount select still appears (Save my account, No don't create an account&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm including the customerDetails fields like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'charge/_includes/inputs/customerDetails' with { 'registerGuest' : true }%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see the form logic in customerDetails.html but that doesn't feel like something that should be edited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to remove the select, since I should always be creating a new account by default OR I want to replace it with a hidden field.&lt;/p&gt;&#xA;" OwnerUserId="5957" LastActivityDate="2017-12-11T23:31:05.797" Title="How to hide createAccount select by default • Charge 2 Plugin" Tags="&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23142" PostTypeId="2" ParentId="23072" CreationDate="2017-12-11T11:10:20.167" Score="1" Body="&lt;p&gt;I've just realised I can do this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = { section : 'stories', order : 'postDate desc', relatedTo: category, limit : '4', storyImage: ':notempty:' } %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &quot;storyImage&quot; is the field name of my image field&lt;/p&gt;&#xA;" OwnerUserId="7470" LastActivityDate="2017-12-11T11:10:20.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23143" PostTypeId="1" AcceptedAnswerId="23144" CreationDate="2017-12-11T13:53:23.927" Score="2" ViewCount="294" Body="&lt;p&gt;With the &lt;a href=&quot;https://github.com/nystudio107/craft3-imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageOptimize&lt;/a&gt; plugin for Craft 3, you create an OptimizedImages field type and then assign that to the Field Layout of your chosen Asset Volume. As far as I can tell (I'm very new to Craft), this means that it won't work to add an Assets field inside a Matrix because it doesn't have the OptimizedImages field associated with it. (I've tried, and received &lt;code&gt;Calling unknown method: craft\elements\Asset::optimizedImages()&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone aware of a possible workaround? I'm guessing that something like &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Neo&lt;/a&gt;, which allows you use existing fields in a Matrix, would be a solution, but at this early stage, there is no version of the plugin for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any insight!&lt;/p&gt;&#xA;" OwnerUserId="7721" LastActivityDate="2017-12-11T14:20:13.473" Title="Using ImageOptimize plugin with Matrix fields" Tags="&lt;matrix&gt;&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23144" PostTypeId="2" ParentId="23143" CreationDate="2017-12-11T14:20:13.473" Score="3" Body="&lt;p&gt;I'm also using ImageOptimize and yes, it does work within Matrix.&#xA;Your image has to have the call to the plugin code as specified in the plugin docs. Additionally, your image calls must match the image size you've setup within the plugin preferences panel. Within Matrix, you are calling the assets Field Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a sample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.type == &quot;graphicCalloutBlock&quot; %}&#xA;        {# Full Width Image #}  &#xA;        {% set image = block.graphicCalloutImage.one() %}&#xA;            &amp;lt;div class=&quot;block&quot;&amp;gt;                               &#xA;                 {% if image | length %}&#xA;                 &amp;lt;img alt=&quot;&quot;&#xA;                 src=&quot;{{ image.optimizedImages.src() }}&quot;&#xA;                 srcset=&quot;{{ image.optimizedImages.srcset() }}&quot;&#xA;                 sizes=&quot;(min-width: 480px) 100vw, (min-width: 880px) 75vw, (min-width: 1024px) 50vw,  800px&quot; &#xA;                     /&amp;gt;                               &#xA;                {% endif %}&#xA;            &amp;lt;/div&amp;gt;&amp;lt;!-- end block --&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2017-12-11T14:20:13.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23145" PostTypeId="1" AcceptedAnswerId="23977" CreationDate="2017-12-11T16:22:20.647" Score="3" ViewCount="5044" Body="&lt;p&gt;Whenever I hit a non-existent page on a dev site, I only get Craft's native 404 page, not the one I have at &lt;code&gt;/craft/templates/404.html&lt;/code&gt;. The site has no routes. Any ideas why this might be?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="6955" LastEditDate="2018-03-27T20:25:39.893" LastActivityDate="2021-03-11T23:48:19.423" Title="Craft not loading custom 404 template for errors" Tags="&lt;templating&gt;&lt;404&gt;&lt;404-page&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23146" PostTypeId="2" ParentId="23145" CreationDate="2017-12-11T16:33:38.580" Score="4" Body="&lt;p&gt;It's quite possible that you are in Dev mode. If you switch to &lt;code&gt;false&lt;/code&gt;, the 404.html may then be recognized…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at general.php, then change &lt;code&gt;devMode&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;// Dev environment settings&#xA;    'dev' =&amp;gt; [&#xA;        'devMode' =&amp;gt; true,&#xA;    ],&#xA;&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2017-12-11T16:33:38.580" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23148" PostTypeId="1" CreationDate="2017-12-11T17:24:31.560" Score="1" ViewCount="35" Body="&lt;p&gt;I'm using the onCharge event to populate a separate purchases table that I can query elsewhere (combining both stripe and my other Paypal payments system). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The onCharge event is mostly working, but it's not populating the $chargeModel-&gt;amount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also not populating the $chargeModel-&gt;userId if a new user is being registered (it only populates if there was a previously existing user). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why the charge model wouldn't have all of its information during the onCharge event? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have in my plugin: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onCharge', function(Event $event) {    &#xA;    // Adding New Charges to Purchases Table&#xA;    craft()-&amp;gt;purchases_newPurchase-&amp;gt;addChargePurchase($event-&amp;gt;params['charge']);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="5557" LastEditDate="2017-12-11T19:05:26.543" LastActivityDate="2017-12-12T22:10:59.960" Title="Charge Model &quot;amount&quot; and &quot;userId&quot; not always populated" Tags="&lt;events&gt;&lt;plugin-charge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23149" PostTypeId="1" CreationDate="2017-12-11T19:05:05.780" Score="1" ViewCount="184" Body="&lt;p&gt;I'm looking to try and build a site that allows users to register an account and then add all of their social media profiles in one place, similar to addme.fun. Their profiles would then have public URLs that they could share, and it would also give them the ability to add more content and edit their profiles. Is Craft a good CMS for that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've built some really great projects with Craft and overall I love it, but I just want to make sure that it has all the capabilities that I'd need before I put too much time into it. Thanks, all!&lt;/p&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="57" LastEditDate="2017-12-11T20:54:56.750" LastActivityDate="2017-12-11T20:54:56.750" Title="Site with public profile pages" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23150" PostTypeId="2" ParentId="11293" CreationDate="2017-12-11T19:29:37.687" Score="5" Body="&lt;p&gt;In more recent versions of Craft 2.x (I forget when it was added), you can simply do this without needing a plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.config.get('setting', 'plugin')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;'plugin'&lt;/code&gt; is the name of your plugin's config file (sans &lt;code&gt;.php&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to do this in Craft 3, you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.app.getModule('pluginHandle').getSettings().mySetting&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-11T19:29:37.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23151" PostTypeId="1" CreationDate="2017-12-11T19:32:44.083" Score="1" ViewCount="262" Body="&lt;p&gt;Does anybody know if I can use Stripe to facilitate subscription payments using iDEAL (Dutch payment method). For instance using the Charge plugin or Sprout Commerce? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4775" LastEditorUserId="57" LastEditDate="2017-12-11T20:53:56.633" LastActivityDate="2018-08-20T03:22:51.280" Title="Monthly subscription with Stripe using iDEAL" Tags="&lt;stripe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23152" PostTypeId="2" ParentId="23149" CreationDate="2017-12-11T20:19:39.097" Score="2" Body="&lt;p&gt;Yes craft provides many tools that allows public registration and editing the profiles without a single line of php or even a plugin. Most functions are covered by the cms and even custom functions like social media support is really easy since you can extend the &lt;code&gt;UserController&lt;/code&gt; and change the things you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have the ability to create dynamic user groups, give permissions to those and restrict content on the site via twig. Like with entries you can define a field layout for every user so you could create all the fields you can create in a normal entry and give users the ability to change them in a frontend form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have config variables and settings that allows you to send custom invitation mails and validation mails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you need the commercial version for this. It's not provided in the free one. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-11T20:19:39.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23153" PostTypeId="1" CreationDate="2017-12-11T20:51:31.183" Score="0" ViewCount="369" Body="&lt;p&gt;Recently, when I edit categories or entries I get the dreaded &quot;An unknown error occurred.&quot; When I check the logs I see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017/12/11 20:41:51 [error] [exception.Craft\HttpException.403] Craft\HttpException in /srv/users/serverpilot/apps/0default/craft/app/services/UserSessionService.php:329&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not quite sure where to go from there. 403 makes it look like a permissions issue but my permissions are all setup just like I normally have them (744). Anyone got any ideas?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-02-21T23:45:21.560" Title="Help debugging &quot;An unknown error occurred.&quot;" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23154" PostTypeId="2" ParentId="23153" CreationDate="2017-12-11T21:13:49.240" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/tree/master-v2/src/services/UserSessionService.php#L325&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/master-v2/src/services/UserSessionService.php#L325&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is thrown when you don't have the permission to change/do something. Your file permissions do not matter it is about the permissions in craft. Are you not admin? Could you tell us if you are a normal user and don't have certain permissions? Maybe another member of your team changed something? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any plugins installed that have any hooks/events? &#xA;Do you have the latest Craft version? &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2018-02-21T23:45:21.560" LastActivityDate="2018-02-21T23:45:21.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23155" PostTypeId="2" ParentId="23151" CreationDate="2017-12-11T21:22:35.350" Score="2" Body="&lt;p&gt;Have you tried having a look at the API Docs for Stripe? They have written about ideal integration: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stripe.com/docs/sources/ideal&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://stripe.com/docs/sources/ideal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If its in your budget you should probably also have a look at Craft commerce which has partial Mollie integration which should, in turn, facilitate the iDeal payments solution that you are looking for. Though they do say it is only partially supported so you may need to investigate if this is exactly what you are looking for. &lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2017-12-11T21:22:35.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23156" PostTypeId="1" CreationDate="2017-12-11T21:25:07.103" Score="1" ViewCount="115" Body="&lt;p&gt;I have a project that the user choose a tag (tags are already created) and save the information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try save a entry which has a tag field, all the stuff saves, but the tags don't.  I try search information about that, but any where have a solution or the solution doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try &lt;a href=&quot;http://buildwithcraft.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry form&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7722" LastEditorUserId="57" LastEditDate="2017-12-11T22:14:15.433" LastActivityDate="2020-05-04T21:29:05.893" Title="Save an entry with tags" Tags="&lt;entry&gt;&lt;tags&gt;&lt;frontend-form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23157" PostTypeId="1" CreationDate="2017-12-11T21:47:58.837" Score="1" ViewCount="158" Body="&lt;p&gt;Im building a form in freeform and it is going to contain many state select dropdown fields. Is there any way to duplicate this field so I do not have to populate the options/values manually every time I use that field? &lt;/p&gt;&#xA;" OwnerUserId="7723" LastActivityDate="2019-01-21T05:39:54.017" Title="Duplicating fields in Freeform" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23158" PostTypeId="2" ParentId="23156" CreationDate="2017-12-11T22:16:32.587" Score="2" Body="&lt;p&gt;Hard to know without seeing some template code, but the syntax for saving existing tags on a front-end entry form looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select multiple name=&quot;fields[fieldHandle][]&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;13&quot;&amp;gt;Tag Name One&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;42&quot;&amp;gt;Tag Name Two&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;144&quot;&amp;gt;Tag Name Three&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replace &lt;code&gt;fieldHandle&lt;/code&gt; with the actual handle of your Tags field and &lt;code&gt;13&lt;/code&gt;, &lt;code&gt;42&lt;/code&gt; and &lt;code&gt;144&lt;/code&gt; with the actual Tag IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a great list of examples for what front-end inputs need to look like for Craft fields here you might find useful: &lt;a href=&quot;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-11T22:16:32.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23159" PostTypeId="1" AcceptedAnswerId="23167" CreationDate="2017-12-11T23:18:31.733" Score="1" ViewCount="776" Body="&lt;p&gt;I have a product with multiple options (e.g. colour, size, material) that all effect the price that the product then sells for. Is it possible for example if someone chooses the material:walnut that it adds $200 to the current price? How can I set this up inside Craft Commerce.&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2017-12-12T03:41:28.103" Title="Can I have a Craft Commerce product with options that change the product’s price?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23160" PostTypeId="2" ParentId="23141" CreationDate="2017-12-11T23:31:05.797" Score="2" Body="&lt;p&gt;Eventually I just edited customerDetails.html and swapped out the select with a hidden field. Done.    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.hidden({&#xA;    name: 'createAccount',&#xA;    id: 'createAccount',&#xA;    value: 'yes'&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5957" LastActivityDate="2017-12-11T23:31:05.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23161" PostTypeId="1" AcceptedAnswerId="23162" CreationDate="2017-12-11T23:39:29.217" Score="1" ViewCount="1011" Body="&lt;p&gt;I am having a syntax error on my craftCMS website. Hoping someone could help me. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Parse error: syntax error, unexpected '[' in /home16/puresoci/public_html/dev/craft/plugins/charge/ChargePlugin.php on line 14&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's the line that it is referring to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  craft()-&amp;gt;templates-&amp;gt;hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the whole function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;charge_license-&amp;gt;ping();&#xA;&#xA;    if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;        $this-&amp;gt;includeCpResources();&#xA;        craft()-&amp;gt;templates-&amp;gt;hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);&#xA;        craft()-&amp;gt;templates-&amp;gt;hook('charge.prepCpSettingsTemplate', [$this, 'prepCpSettingsTemplate']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I am a beginner on using PHP and I dont know how should I update this. I am using PHP 5.6 right now.&lt;/p&gt;&#xA;" OwnerUserId="7542" LastEditorUserId="7542" LastEditDate="2017-12-12T00:01:20.087" LastActivityDate="2017-12-12T00:01:34.720" Title="Parse error: syntax error, unexpected '['" Tags="&lt;plugins&gt;&lt;craft-pro&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23162" PostTypeId="2" ParentId="23161" CreationDate="2017-12-11T23:52:40.407" Score="1" Body="&lt;p&gt;The Charge plugin requires a minimum of &lt;strong&gt;PHP 5.4&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The brackets notation for arrays (which is what Charge uses) was added in 5.4.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://php.net/manual/en/language.types.array.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://php.net/manual/en/language.types.array.php&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Contact your hosting provider to find out how to upgrade.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2017-12-12T00:01:34.720" LastActivityDate="2017-12-12T00:01:34.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23163" PostTypeId="2" ParentId="23161" CreationDate="2017-12-11T23:53:31.700" Score="1" Body="&lt;p&gt;Honestly, if you can, I'd upgrade your hosting to use PHP 7. It's about 2x as fast as 5.x, and it's much more modern. PHP 5.3 isn't even supported anymore.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-11T23:53:31.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23164" PostTypeId="1" AcceptedAnswerId="23169" CreationDate="2017-12-12T00:12:10.780" Score="1" ViewCount="103" Body="&lt;p&gt;I'm trying to add a source on a custom element type that shows entries with an empty &lt;code&gt;assigned_user_id&lt;/code&gt; field. This criteria is not honored and returns the same results as the &quot;All Entries&quot; source. Is there any way to specify a null or empty string criteria value?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSources($context = null)&#xA;{&#xA;    $sources = [&#xA;        '*' =&amp;gt; [&#xA;            'label' =&amp;gt; Craft::t('All Entries'),&#xA;            'defaultSort' =&amp;gt; [&#xA;                'test_plugin.dateCreated',&#xA;                'desc'&#xA;            ]&#xA;        ]&#xA;    ];&#xA;&#xA;    $sources[] = ['heading' =&amp;gt; 'Assignments'];&#xA;&#xA;    $sources['unassigned'] = [&#xA;        'label'    =&amp;gt; Craft::t('Unassigned'),&#xA;        'criteria' =&amp;gt; ['assigned_user_id' =&amp;gt; '']&#xA;    ];&#xA;&#xA;    return $sources;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7724" LastActivityDate="2017-12-12T09:22:23.767" Title="Custom ElementType empty getSource criteria?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;&lt;sources&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23165" PostTypeId="1" AcceptedAnswerId="23229" CreationDate="2017-12-12T00:53:56.453" Score="0" ViewCount="1802" Body="&lt;p&gt;New guy here. Can someone explain what the proper way to pass a variable into an include? I'm using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;singlepage&quot; with { currentPage:'leaders' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.. and I'm getting a Variable &quot;currentPage&quot; does not exist error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, I have a template that I want to use for my singles pages, but I need to set a couple of variables for the template to use. So, I have a template for each single that simply sets the current page and then includes the single page template. Is this a good approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="7491" LastEditorUserId="57" LastEditDate="2017-12-12T00:57:08.297" LastActivityDate="2017-12-18T18:35:26.483" Title="Include with -- variable does not exist error" Tags="&lt;variable&gt;&lt;include&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23166" PostTypeId="2" ParentId="23165" CreationDate="2017-12-12T00:58:59.847" Score="2" Body="&lt;p&gt;You're probably looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;singlepage&quot; with { 'currentPage': 'leaders' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key (the part before the &lt;code&gt;:&lt;/code&gt;) needs to be a string, hence in quotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant Twig template docs are here: &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/include.html#include&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/tags/include.html#include&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-12T00:58:59.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23167" PostTypeId="2" ParentId="23159" CreationDate="2017-12-12T03:41:28.103" Score="2" Body="&lt;p&gt;Absolutely that is possible.  You can see an example of a complex options set up here for example (click Add Prints to get going...):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imagescience.com.au/services/fine-art-printing/order-fine-art-printing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imagescience.com.au/services/fine-art-printing/order-fine-art-printing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Variants are also used for pages like these:&#xA;&lt;a href=&quot;https://imagescience.com.au/products/inkjet-papers/museo-portfolio-rag&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imagescience.com.au/products/inkjet-papers/museo-portfolio-rag&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of the front end, how you set up the UI is &lt;em&gt;entirely&lt;/em&gt; up to you - in the top case, it's a React form at work, and in the second case just a simple table really.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of these forms ultimately just POSTs a list of fields to a Commerce controller - &lt;code&gt;purchasableID&lt;/code&gt; and &lt;code&gt;qty&lt;/code&gt; and optionally &lt;code&gt;notes&lt;/code&gt; for each item the user chooses using the form.  These is posted to a Commerce &lt;code&gt;addToCart&lt;/code&gt; controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The products themselves are all set up in teh back end of Commerce as variations - see &lt;a href=&quot;https://craftcommerce.com/docs/products&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/products&lt;/a&gt; for an overview of that.  Basically you define a grid of variant options, each of which gets its own ID (later POSTed, as above) and has its own unique SKU (Stock Keeping Unit).  Each variant can have as many or as few custom fields as you wish (as can the parent product)..and of course each variant can have its own price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product &amp;amp; variants system in Commerce is VERY powerful indeed, but does take a little getting used to.  Best way to get started is to download Commerce and have a look through the sample templates to get an idea how it all works, enter some sample products in the back end, then attempt to make a few simple add to cart forms of your own - one that works for jsut products, then one that works for variant products.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-12-12T03:41:28.103" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23168" PostTypeId="2" ParentId="23157" CreationDate="2017-12-12T05:57:47.750" Score="1" Body="&lt;p&gt;Not manually but you can search for the field in your database. If the plugin uses the normal &lt;code&gt;craft_fields&lt;/code&gt; you can copy it's settings and paste it in a new record&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-12T05:57:47.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23169" PostTypeId="2" ParentId="23164" CreationDate="2017-12-12T09:22:23.767" Score="1" Body="&lt;p&gt;You can set it to &lt;code&gt;':empty:'&lt;/code&gt;, as mentioned in the &lt;a href=&quot;https://github.com/craftcms/cms/blob/2.6.3000/src/helpers/DbHelper.php#L447&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;DbHelper::parseParam()&lt;/code&gt;&lt;/a&gt; documentation.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-12-12T09:22:23.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23170" PostTypeId="5" CreationDate="2017-12-12T09:36:16.563" Score="0" Body="&lt;p&gt;Geo Plugin is a Craft CMS plugin to get information about your users location.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-12-13T23:11:33.340" LastActivityDate="2017-12-13T23:11:33.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23171" PostTypeId="4" CreationDate="2017-12-12T09:36:16.563" Score="0" Body="A simple plugin to get information about your users location" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-12-13T23:11:22.250" LastActivityDate="2017-12-13T23:11:22.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23172" PostTypeId="2" ParentId="21724" CreationDate="2017-12-12T11:06:04.850" Score="1" Body="&lt;p&gt;I found a bootstrap that works for me apart from an issue with the database connection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find the link now but here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;define(&quot;CRAFT_ENVIRONMENT&quot;, &quot;dev&quot;);&#xA;// PHP sucks at resolving symlinked directories&#xA;define('CRAFT_BASE_PATH', realpath(str_replace(&quot;plugins/myplugin&quot;, '', dirname(__FILE__))).'/');&#xA;&#xA;// Define app constants&#xA;defined('CRAFT_APP_PATH')          || define('CRAFT_APP_PATH',          CRAFT_BASE_PATH.'app/');&#xA;defined('CRAFT_CONFIG_PATH')       || define('CRAFT_CONFIG_PATH',       CRAFT_BASE_PATH.'config/');&#xA;defined('CRAFT_VENDOR_PATH')       || define('CRAFT_VENDOR_PATH',       CRAFT_BASE_PATH.'app/vendor/');&#xA;defined('CRAFT_FRAMEWORK_PATH') || define('CRAFT_FRAMEWORK_PATH', CRAFT_APP_PATH.'framework/');;&#xA;defined('CRAFT_PLUGINS_PATH')      || define('CRAFT_PLUGINS_PATH',      CRAFT_BASE_PATH.'plugins/');&#xA;defined('CRAFT_STORAGE_PATH')      || define('CRAFT_STORAGE_PATH',      CRAFT_BASE_PATH.'storage/');&#xA;defined('CRAFT_TEMPLATES_PATH')    || define('CRAFT_TEMPLATES_PATH',    CRAFT_BASE_PATH.'templates/');&#xA;defined('CRAFT_TRANSLATIONS_PATH') || define('CRAFT_TRANSLATIONS_PATH', CRAFT_BASE_PATH.'translations/');&#xA;defined('YII_TRACE_LEVEL')          || define('YII_TRACE_LEVEL', 3);&#xA;// Load Yii&#xA;require_once CRAFT_APP_PATH.'framework/yiit.php';&#xA;Yii::$enableIncludePath = false;&#xA;require_once CRAFT_APP_PATH.'Craft.php';&#xA;require_once CRAFT_APP_PATH.'etc/web/WebApp.php';&#xA;require_once CRAFT_APP_PATH.'Info.php';&#xA;// Craft shits itself if there is no server or request path&#xA;$_SERVER['HTTP_HOST'] = 'dev.copywheat';&#xA;$_SERVER['REQUEST_URI'] = '/';&#xA;// Load test database&#xA;$config = require_once CRAFT_APP_PATH.'etc/config/test.php';&#xA;$config['params']['dbConfig'] = array();&#xA;&#xA;// Create app instance&#xA;$app = new \Craft\WebApp($config);&#xA;// Load plugin&#xA;require_once CRAFT_PLUGINS_PATH.'myplugin/mypluginPlugin.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm still having issues with the db connection.  Have had to resort to modifying the &lt;code&gt;craft/app/etc/config/defaults.db&lt;/code&gt; in order to override the environment file which does work for me at the moment.&lt;/p&gt;&#xA;" OwnerUserId="7008" LastEditorUserId="3951" LastEditDate="2017-12-15T20:28:10.463" LastActivityDate="2017-12-15T20:28:10.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23174" PostTypeId="2" ParentId="23124" CreationDate="2017-12-12T11:16:02.580" Score="1" Body="&lt;p&gt;Do you mean &lt;a href=&quot;https://solspace.com/craft/calendar/docs/searching-events/#calendar-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventOptions = {&#xA;    dateRangeStart: targetStartDate,&#xA;    dateRangeEnd: targetEndDate,&#xA;    limit: 15,&#xA;    search: &quot;EndrepeatHandle:On date&quot;&#xA;} %}&#xA;{% set events = craft.calendar.events(eventOptions) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-12T11:16:02.580" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23176" PostTypeId="2" ParentId="22445" CreationDate="2017-12-12T13:19:34.867" Score="2" Body="&lt;p&gt;According to this &lt;a href=&quot;https://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path&quot;&gt;thread&lt;/a&gt; you can add&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Use MAMP version of PHP&#xA;PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`&#xA;export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;code&gt;.bash_profile&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This grabs your current php Version in MAMP and you can install it without setting &lt;code&gt;--ignore-platform-reqs&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-12-12T13:19:34.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23177" PostTypeId="1" CreationDate="2017-12-12T15:49:02.227" Score="3" ViewCount="139" Body="&lt;p&gt;I'm attempting to write a basic plugin for Redactor (Redactor plugin on Craft 3 RC) but I'm tripping at the first hurdle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems I can add any attribute to my &lt;code&gt;&amp;lt;abbr&amp;gt;&lt;/code&gt; other than a &lt;code&gt;title&lt;/code&gt; (the only attribute I need!). Here is my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($)&#xA;{&#xA;    $.Redactor.prototype.abbr = function()&#xA;    {&#xA;        return {&#xA;            init: function ()&#xA;            {&#xA;                var button = this.button.add('abbr', 'Abbreviation');&#xA;                this.button.setIcon(button, '&amp;lt;i class=&quot;re-icon-toggle&quot;&amp;gt;&amp;lt;/i&amp;gt;');                &#xA;                this.button.addCallback(button, function()&#xA;                {&#xA;                    this.inline.format('abbr', 'title', 'test');&#xA;                });&#xA;            }&#xA;        };&#xA;    };&#xA;})(jQuery);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It wraps the selected text in &lt;code&gt;&amp;lt;abbr&amp;gt;&lt;/code&gt; but fails to add the title attribute. Other attribute types, such as &lt;code&gt;class&lt;/code&gt; work fine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;this.inline.format('abbr', 'class', 'test');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In two minds whether to post this here or on SO but as this is for a Craft site...)&lt;/p&gt;&#xA;" OwnerUserId="5176" LastEditorUserId="5176" LastEditDate="2017-12-13T12:42:39.943" LastActivityDate="2017-12-19T13:17:53.007" Title="&lt;abbr&gt; plugin for Redactor" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23178" PostTypeId="1" AcceptedAnswerId="23181" CreationDate="2017-12-12T17:29:39.887" Score="3" ViewCount="1784" Body="&lt;p&gt;I have an index page that filters entries based on url query strings, eg: &lt;code&gt;site.com/inductees?county=123&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put together a very simple pagination setup with next/prev links. However, when I click &quot;next&quot; I am brought to &lt;code&gt;site.com/inductees/p2&lt;/code&gt; and I lose my filtered set of entries from the &lt;code&gt;?county=123&lt;/code&gt; bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I get pagination working and keep the query string in my url?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2019-05-17T23:58:48.203" Title="Using pagination on a page with url with query string data" Tags="&lt;url&gt;&lt;pagination&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23179" PostTypeId="1" CreationDate="2017-12-12T19:43:36.737" Score="1" ViewCount="61" Body="&lt;p&gt;At the moment I'm trying to create a script that is supposed to be run (by chrome extension) on page load (of the new entry page) that with automatically set the entry type. The name of the entry type is &quot;Episodes&quot; and the value (from the html) of the entry type is 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the script I have so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var contenttype = document.getElementById('entryType');&#xA;contenttype.value = &quot;5&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When run, this changes the Entry Type field on the side, but it doesn't actually set the entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I go about doing this?&lt;/p&gt;&#xA;" OwnerUserId="7730" LastActivityDate="2017-12-12T21:30:29.043" Title="Programmatically Setting Entry Type Via Javascript" Tags="&lt;entry&gt;&lt;admin&gt;&lt;entry-type&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23180" PostTypeId="2" ParentId="23179" CreationDate="2017-12-12T20:43:19.180" Score="1" Body="&lt;p&gt;You need to trigger the change() event of the field (after the event handler is attached so not on page load but on &lt;code&gt;$(document).ready(&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#entryType&quot;).val(5).change();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-12T21:30:29.043" LastActivityDate="2017-12-12T21:30:29.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23181" PostTypeId="2" ParentId="23178" CreationDate="2017-12-12T21:22:53.127" Score="3" Body="&lt;p&gt;The huge advantage of craft over other CMS is the high flexibility and the ability to customize many things. Thus Craft won't provide non changeable &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags but links you can change like you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set country = craft.request.getParam('country') %}&#xA;&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}?country={{country}}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-12T21:22:53.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23183" PostTypeId="2" ParentId="23148" CreationDate="2017-12-12T22:10:59.960" Score="2" Body="&lt;p&gt;I'm pretty sure this issue is caused because the model is being passed to the event without being populated first (it only has the EXACT details that are manually populated when the record is created, not the additional functions). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to use &lt;code&gt;$chargeModel-&amp;gt;planAmount&lt;/code&gt; just fine, and I was actually able to re-look up the model based on the passed model id, which properly populated the model before passing it back.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastActivityDate="2017-12-12T22:10:59.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23186" PostTypeId="1" AcceptedAnswerId="23204" CreationDate="2017-12-13T08:00:56.070" Score="4" ViewCount="165" Body="&lt;p&gt;Does Craft have built-in queue handling for outbound mail? For example if Settings -&gt; Email -&gt; Protocol is set to &quot;SMTP&quot; and the mail server is temporarily down when an email is to be delivered, the email will then be delivered later when the mail server is online again? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess the answer is no, and that it's better to use sendmail if it's important messages?&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="57" LastEditDate="2017-12-13T23:48:47.437" LastActivityDate="2017-12-15T04:38:32.317" Title="Does Craft have built-in queue handling for outbound mail?" Tags="&lt;emails&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23187" PostTypeId="2" ParentId="23124" CreationDate="2017-12-13T09:32:09.637" Score="1" Body="&lt;p&gt;It turns out that the Calendar plugin provides a property named &lt;code&gt;event.repeating&lt;/code&gt;  that can be checked to determine if the event is repeating and then use &lt;code&gt;event.readableRepeatRule&lt;/code&gt; property to output the last date that the event will repeat on.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2017-12-13T09:32:09.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23189" PostTypeId="1" AcceptedAnswerId="23206" CreationDate="2017-12-13T11:02:14.743" Score="0" ViewCount="99" Body="&lt;p&gt;I've added many fields in the past with success but today, on my local MAMP server, after adding a new field to a Matrix and saving, I'm getting a PHP error when I try to view the entry's admin page, the page preview, or try to add a new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thankfully removing that field and saving gets me back to where I was. The CMS is up to date. Here is the error when trying to view the entry's admin, I can post more if it helps (the stack trace has 70+ errors in it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jrhIK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jrhIK.png&quot; alt=&quot;PHP error&quot;&gt;&lt;/a&gt;&#xA;When creating a new entry, the error is also on BaseOptionsFieldType.php but line 362:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if ($option['value'] == $value)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone have any ideas for getting around this? The field I want to add is a Lightswitch but I get the same error when trying a Plain Text field.&lt;/p&gt;&#xA;" OwnerUserId="6078" LastEditorUserId="6078" LastEditDate="2017-12-13T14:33:08.363" LastActivityDate="2017-12-14T09:20:57.840" Title="PHP error after adding new field" Tags="&lt;entry&gt;&lt;error-message&gt;&lt;php&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23190" PostTypeId="1" AcceptedAnswerId="23549" CreationDate="2017-12-13T12:20:23.713" Score="2" ViewCount="438" Body="&lt;p&gt;I'm getting alarmed by the size of the database backups and the database in general. The site has Craft Commerce installed, which contributes I think, but if you look at the following list of backups there seems to have been a sharp increase in database size that has nothing to do with Craft Commerce (which has been installed since July).&lt;/p&gt;&#xA;&lt;p&gt;Does anyone have an tips or articles to share about getting control of this? I feel it's getting ridiculous but that it has probably happened since we went live on October 17.&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&lt;p&gt;Looking at the database tables, there are definitely several tables that seem to larger than they should be:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;craft_searchindex 31MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_commerce_orders 30MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_elements_i18n 20MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_content 15MiB craft_elements 13MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_commerce_customers 8MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_entryversions 3MiB&lt;/li&gt;&#xA;&lt;li&gt;craft_deprecationerrors 1.5MiB&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I'm wondering if there is a spam issue here. Could that be it?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BEJpm.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BEJpm.gif&quot; alt=&quot;Contents of backups&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-01-19T10:58:25.177" Title="How to reduce database size?" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23191" PostTypeId="2" ParentId="23190" CreationDate="2017-12-13T12:42:50.717" Score="2" Body="&lt;p&gt;So two primary things can contribute to database bloat:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you have versioning turned on for your Sections, it will store &lt;em&gt;every&lt;/em&gt; change in the db. The &lt;a href=&quot;https://github.com/carlcs/craft-deleteentryversions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Delete Entry Versions&lt;/a&gt; plugin can help with this&lt;/li&gt;&#xA;&lt;li&gt;If your backup isn't dropping temporary cache tables like &lt;code&gt;templatecaches&lt;/code&gt;, &lt;code&gt;templatecachecriteria&lt;/code&gt;, etc. that can contribute to the bloat as well&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Given that you're seeing the backups get so much larger in a one week period makes me think it's probably the temporary cache tables causing the bloat, unless you're doing an awful lot of editing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's unclear how you are doing your backups, but check out the &lt;a href=&quot;https://nystudio107.com/blog/mitigating-disaster-via-website-backups&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mitigating Disaster via Website Backups&lt;/a&gt;; the &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt; used therein will not include the various temporary tables in the database backups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also possible that too many cache tables are being created due to the way you're using the &lt;code&gt;{% cache %}&lt;/code&gt; tags on the site; check out &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt; for details on what might be happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy way to check what's going on would be to connect to the database with something like Sequel Pro or what have you, and look at the number and size of the db rows in the various tables.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-13T12:42:50.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23192" PostTypeId="1" AcceptedAnswerId="23193" CreationDate="2017-12-13T13:00:36.090" Score="3" ViewCount="588" Body="&lt;p&gt;I am running into problems with virtual hosts while trying to run Craft locally.&#xA;My setup was working perfectly and after a restart of my mac I get error messages and I don't understand why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Mamp to run Apache and MySQL.&#xA;When I am going to one of my virtual host url I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fkvFm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fkvFm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I type 'localhost' I get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4YU0V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4YU0V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have double checked the &lt;strong&gt;httpd.conf&lt;/strong&gt; and the virtual hosts is enabled and my &lt;strong&gt;httpd-vhosts.conf&lt;/strong&gt; is set up correctly as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume there is a certain issue with the virtual hosts as but I just cannot figure it out and it stop working without any changes/updates form my side so I'm really loosing it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does any one has an idea where to start searching for the problem?&lt;/p&gt;&#xA;" OwnerUserId="3777" LastActivityDate="2017-12-14T16:16:08.107" Title="Problems setting up a local site" Tags="&lt;server&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23193" PostTypeId="2" ParentId="23192" CreationDate="2017-12-13T13:09:37.173" Score="5" Body="&lt;p&gt;You can't use the domain .dev anymore, it's Google's gTLD (&lt;a href=&quot;https://icannwiki.org/.dev&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://icannwiki.org/.dev&lt;/a&gt;) and they don't want to share. See &lt;a href=&quot;https://medium.engineering/use-a-dev-domain-not-anymore-95219778e6fd&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.engineering/use-a-dev-domain-not-anymore-95219778e6fd&lt;/a&gt; for a detailed backstory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you should use &lt;a href=&quot;https://en.wikipedia.org/wiki/.test&quot; rel=&quot;nofollow noreferrer&quot;&gt;the TLDs reserved by the IETF&lt;/a&gt; for this purpose, like &lt;code&gt;.test&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, this is &lt;a href=&quot;https://www.chromium.org/hsts&quot; rel=&quot;nofollow noreferrer&quot;&gt;the HSTS List maintained by Chromium&lt;/a&gt; which is in turn the basis for the lists used by &lt;a href=&quot;https://wiki.mozilla.org/SecurityEngineering/HTTP_Strict_Transport_Security_(HSTS)_Preload_List&quot; rel=&quot;nofollow noreferrer&quot;&gt;Firefox&lt;/a&gt;, Opera, Safari, &lt;a href=&quot;https://support.microsoft.com/en-us/help/3071338/internet-explorer-11-adds-support-for-http-strict-transport-security-s&quot; rel=&quot;nofollow noreferrer&quot;&gt;Internet Explorer and Edge&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastEditorUserId="3679" LastEditDate="2017-12-14T16:16:08.107" LastActivityDate="2017-12-14T16:16:08.107" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="23194" PostTypeId="2" ParentId="10065" CreationDate="2017-12-13T15:00:21.603" Score="10" Body="&lt;p&gt;A little bit late but maybe someone else has the same issue and want's to accomplish this.&#xA;You can use this Plugin &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion/tree/v1&quot; rel=&quot;noreferrer&quot;&gt;Twig Perversion&lt;/a&gt; to create macros that return values&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro getParentEntry(thisEntry) %}&#xA;    {% import _self as self %}&#xA;    {% if thisEntry.parent|length %}&#xA;        {% set parent = thisEntry.parent %}&#xA;    {% else %}&#xA;        {% set parent = false %}&#xA;    {% endif %}&#xA;    {% return parent %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you can use it with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = self.getParentEntry( entry ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="130" LastEditDate="2017-12-14T18:38:27.333" LastActivityDate="2017-12-14T18:38:27.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23195" PostTypeId="2" ParentId="23178" CreationDate="2017-12-13T15:34:59.683" Score="9" Body="&lt;p&gt;In most Craft projects I do I'll create a pagination include file so anything I need that requires pagination, I can just include that and I get the same pagination pattern anywhere within my site when I need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you do have to set the country attribute with each link, sometimes it might get a little tedious to do this manually or you may expand your attributes to include other options, like &lt;code&gt;?country=123&amp;amp;distance=50&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where Craft's &lt;code&gt;craft.request.getQueryStringWithoutPath()&lt;/code&gt; comes into play. In Craft 3 this has been changed to &lt;code&gt;craft.app.request.queryStringWithoutPath&lt;/code&gt;. But you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getQueryStringWithoutPath() %}&#xA;  {% set queryString = &quot;?&quot; ~ craft.request.getQueryStringWithoutPath() %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;a href=&quot;{{ paginate.prevUrl }}{% if queryString is defined %}{{ queryString }}{% endif %}&quot;&amp;gt;Previous&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then no matter what URL attributes you have, they'll always be included within your pagination links.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2017-12-13T15:34:59.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23196" PostTypeId="1" CreationDate="2017-12-13T18:22:41.807" Score="2" ViewCount="784" Body="&lt;p&gt;A plugin that is using a Guzzle request is now throwing an exception that the class cannot be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft CMS 2.6.3000. Where is Guzzle being pulled from? I can see it within &lt;code&gt;craft/app/vendor/guzzle&lt;/code&gt; and also within &lt;code&gt;plugins/oauth/vendor&lt;/code&gt; but for some reason this plugin cannot cannot use this class anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is being referenced as &lt;code&gt;$client = new \GuzzleHttp\Client();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can't the class be used?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2017-12-13T18:27:32.620" Title="Class 'GuzzleHttp\Client' not found" Tags="&lt;guzzle&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23197" PostTypeId="2" ParentId="23196" CreationDate="2017-12-13T18:27:32.620" Score="1" Body="&lt;p&gt;Just a quick guess, but here is what I have on a project I am working on.    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client();&#xA;$request = $client-&amp;gt;get($url);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;yours&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \GuzzleHttp\Client();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mine&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \Guzzle\Http\Client();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have &lt;code&gt;\Http\Client&lt;/code&gt; - maybe you are just missing the slash?&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2017-12-13T18:27:32.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23198" PostTypeId="1" CreationDate="2017-12-13T19:35:47.460" Score="1" ViewCount="1390" Body="&lt;p&gt;This is related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20983/connecting-to-rest-api-using-basic-auth&quot;&gt;here&lt;/a&gt;, but, as I don't currently have the reputation to comment there, I decided to ask my somewhat different question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing a plugin to connect to a RESTful API (using Basic Authentication).  I have been following the examples on the aforementioned link (above); however, the dot notation in calling the plugin is puzzling to me.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(note: prior to installing this custom plugin (which successfully installed), I installed the Guzzle plugin.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I leave the code as it appeared in the example (&quot;_entry.html&quot;) at the link ('craft.theater.get'), I receive the error message here: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fatal error: Class 'Craft\TheaterVariable' not found in craft\app\variables\CraftVariable.php on line 55&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use 'craft.theater.get' successfully in the index.html template?  Does 'theater' refer to the entire theater plugin, here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, for looping through the XML, is there something in Craft CMS similar to the PHP SimpleXML Parser for looping through the XML nodes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code (thanks to the link mentioned before):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Index.html (located in craft/templates/theater/ ):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Theater index template&#xA; # -------------------&#xA; #&#xA; # This template is loaded whenever http://example.com/news is&#xA; # requested, because it is located at Theater/index.html in your&#xA; # craft/templates/ folder.&#xA; #&#xA; # See this page for more details on how Craft routes requests:&#xA; # http://craftcms.com/docs/routing&#xA; #}&#xA;&#xA;{% extends &quot;_layout&quot; %}&#xA;{% set title = &quot;Theater&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;h1&amp;gt;Theater&amp;lt;/h1&amp;gt;&#xA;&#xA;{# begin - plugin test detection and confirmation #}&#xA;{% if craft.theater is defined %}&#xA;    Never fear... theater is here.&#xA;{% else %}&#xA;    I'm missing my theater.&#xA;{% endif %}&#xA;&#xA;{% set plugin = craft.plugins.getPlugin('theater', false) %}&#xA;&#xA;{{ plugin.isEnabled() ? 'plugin enabled' : 'plugin disabled'}}&amp;lt;br/&amp;gt;&#xA;{{ plugin.isInstalled() ? 'plugin installed' : 'plugin not installed'}}&amp;lt;br/&amp;gt;&#xA;&#xA;{{ craft.theater is defined ? 'plugin true' : 'plugin false' }}&#xA;{# end - plugin test detection and confirmation #}&#xA;&#xA;&#xA; {# below - I commented out the version with 'craft.theater.get'... when I replaced it with 'craft.guzzle.get' it worked, but unsure why #}&#xA;{# set showtimes  = craft.theater.get({ url: 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&amp;amp;format=json&amp;amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys' }) #}   &#xA;{% set showtimes  = craft.guzzle.get({ url: 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&amp;amp;format=json&amp;amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys' }) %}&#xA;&#xA; {# below - commented out original for statement 'showtimes.data' ... removed '.data' and it works #}&#xA;{# for show in showtimes.data #}&#xA;{% for show in showtimes %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ show.created }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code for the plugin file: TheaterPlugin.php (located in craft/plugins/theater/ ):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;&#xA;namespace Craft;&#xA;&#xA;class TheaterPlugin extends BasePlugin&#xA;{&#xA;    /**&#xA;     * @return mixed&#xA;     */&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;    }&#xA;&#xA;    /**&#xA;     * @return mixed&#xA;     */&#xA;    public function getName()&#xA;    {&#xA;         return Craft::t('TheaterVariable');&#xA;    }&#xA;&#xA;    /**&#xA;     * @return mixed&#xA;     */&#xA;    public function getDescription()&#xA;    {&#xA;        return Craft::t('TheaterVariable');&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getDocumentationUrl()&#xA;    {&#xA;        return '???';&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getReleaseFeedUrl()&#xA;    {&#xA;        return '???';&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getVersion()&#xA;    {&#xA;        return '1.0.0';&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getSchemaVersion()&#xA;    {&#xA;        return '1.0.0';&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getDeveloper()&#xA;    {&#xA;        return 'jw';&#xA;    }&#xA;&#xA;    /**&#xA;     * @return bool&#xA;     */&#xA;    public function hasCpSection()&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    /**&#xA;     */&#xA;    public function onBeforeInstall()&#xA;    {&#xA;    }&#xA;&#xA;    /**&#xA;     */&#xA;    public function onAfterInstall()&#xA;    {&#xA;    }&#xA;&#xA;    /**&#xA;     */&#xA;    public function onBeforeUninstall()&#xA;    {&#xA;    }&#xA;&#xA;    /**&#xA;     */&#xA;    public function onAfterUninstall()&#xA;    {&#xA;    }&#xA;&#xA;    public function get($options){&#xA;&#xA;        $url = $options['url'];&#xA;        $limit = array_key_exists('limit', $options) ? NumberHelper::makeNumeric($options['limit']) : null;&#xA;        $offset = array_key_exists('offset', $options) ? NumberHelper::makeNumeric($options['offset']) : 0;&#xA;&#xA;        try {&#xA;&#xA;            //API Credentials&#xA;            //$login = 'USERNAME';&#xA;            //$password = 'PASSWORD';&#xA;&#xA;&#xA;            $client = new \Guzzle\Http\Client();&#xA;            $request = $client-&amp;gt;get($url);&#xA;&#xA;            //cURL Options for Basic Authentication&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_RETURNTRANSFER, true);&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);&#xA;            $request-&amp;gt;getCurlOptions()-&amp;gt;set(CURLOPT_USERPWD, &quot;$login:$password&quot;);&#xA;&#xA;            $response = $request-&amp;gt;send();&#xA;&#xA;            if (!$response-&amp;gt;isSuccessful()) {&#xA;                return;&#xA;            }&#xA;&#xA;            $items = $response-&amp;gt;json();&#xA;&#xA;            $items = array_slice($items, $offset, $limit);&#xA;&#xA;            return $items;&#xA;&#xA;        } catch (Exception $e) {&#xA;&#xA;            return;&#xA;&#xA;        }&#xA;    }&#xA;&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2017-12-13T20:40:20.197" Title="Making a Plugin to Connect to a RESTful API - Error in get call" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23199" PostTypeId="2" ParentId="23198" CreationDate="2017-12-13T20:12:53.050" Score="2" Body="&lt;p&gt;I'll try to explain you how this thing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. The most important thing: Twig is a template language&lt;/strong&gt;&lt;br&gt;&#xA;Many people who are not used to PHP - or those who don't want to learn it/or coming from other CMS - like to abuse Twig and try to accomplish things that should not be accomplished.&lt;br&gt;&#xA;Even if you can use it for some logic you should not try to force it to do such things.&#xA;Sooner or later it is going to be messy and requires more resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus your templates should not contain too much business logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Therefore there are PluginVariables&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be able to access custom PHP Code Craft has the ability to offer you several methods to access your business logic from your template. One method is your PluginsVariable. You can insert a &lt;code&gt;TheaterVariable.php&lt;/code&gt; in your &lt;code&gt;/theater/variables/&lt;/code&gt; folder that could look like this &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;Doc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But - you should not implement too much logic in those either. Of course you can no one will ever say you must not do it, but the better solution is to create a &lt;a href=&quot;https://craftcms.com/docs/plugins/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;Service&lt;/a&gt;. Because these files are the place where your logic belongs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Phew why should I even listen to that guy... it works the way I do it, so what?&lt;/strong&gt;&lt;br&gt;&#xA;Of course you can create your website like you want, but maybe you'll want to create another site in the future - maybe a bigger project that requires a better structure. Then you'll be happy to have a good boilerplate and knowledge. Since most people do it in the intended way you'll be able to understand other plugins much  better and can change them too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why we separate our code in Variables, Controllers, Services and templates is the ability to change things more easily and to access everything from everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you want to update an API you only have to change one single service so your controllers and your templates don't consume any time. You don't need to restructure your template when your REST Api changes, everyone will know for sure he/she has to go into the services folder and modificate a few lines there instead of the entire project here and there. So you'll save much time and don't have to search for too long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can access your service from within your template (via variable), from URL requests (via controllers), via Ajax request (via controller) -&gt; you have one function that you use everywhere :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just imagine: in halve a year you would like to add certain content to your Rest responses. So you receive a response, title, description or whatever and you want to be able to update things here and there. That way you only have to create a new record/element type to insert the content from your API calls and pull those instead of the response directly. Think about the required time to do this with your current approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. I know... I said many things until now but they don't really concern your problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Craft&lt;/code&gt; variable you can access from your template contains all needed &lt;code&gt;services&lt;/code&gt; (&lt;code&gt;craft.entries&lt;/code&gt;, &lt;code&gt;craft.request&lt;/code&gt;....) and of course your &lt;code&gt;pluginVariable&lt;/code&gt; so &lt;code&gt;craft.theater&lt;/code&gt; does &lt;strong&gt;not&lt;/strong&gt; access your plugin. It tries to call the file &lt;code&gt;theather/variables/TheaterVariable&lt;/code&gt; and tries to call the &lt;code&gt;get&lt;/code&gt; function there. Your &lt;code&gt;TheaterPlugin&lt;/code&gt; file is only meant to be the container for some configurations (name, description, routings, cp hooks..) for your plugin. There is no real need to access it from twig when you leave your development environment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So - I think I answered all your questions, but still if you did not get it I'll resume.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'craft.guzzle.get'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I assume this works because the guzzle plugin has a &lt;code&gt;GuzzleVariable&lt;/code&gt; with the &lt;code&gt;get&lt;/code&gt; function. So you access that one.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Additionally, for looping through the XML, is there something in Craft CMS similar to the PHP SimpleXML Parser for looping through the XML nodes?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft has actually to be really specific nothing to do with Twig. It only provides certain objects in it and even so, you should parse your response in your PHP logic and pass the objects to twig.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fatal error: Class 'Craft\TheaterVariable' not found in craft\app\variables\CraftVariable.php on line 55&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Appears because you probably don't have the file.... like the error says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to use 'craft.theater.get' successfully in the index.html template?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;class TheaterVariable&#xA;{&#xA;    public function get()&#xA;    {&#xA;        return craft()-&amp;gt;yourCustomServiceName-&amp;gt;get();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-13T20:40:20.197" LastActivityDate="2017-12-13T20:40:20.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23200" PostTypeId="1" AcceptedAnswerId="23203" CreationDate="2017-12-13T22:42:08.477" Score="2" ViewCount="289" Body="&lt;p&gt;I have a URL passing values from form checkboxes to a template. All the checkboxes are grouped with the same &lt;code&gt;name=&lt;/code&gt; attribute. When multiple checkboxes are selected, the query string looks something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?checkValue=12345&amp;amp;checkValue=23456&amp;amp;checkValue=34567&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;code&gt;craft.request.getQuery('checkValue')&lt;/code&gt; returns only the last value (34567 in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I retrieve all the values so they can be used and manipulated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've corrected the naming of the checkboxes from &lt;code&gt;name=&quot;checkValue&quot;&lt;/code&gt; to &lt;code&gt;name=&quot;checkValue[]&quot;&lt;/code&gt;, so now my query string looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?checkValue%5B%5D=12345&amp;amp;checkValue%5B%5D=23456&amp;amp;checkValue%5B%5D=34567&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that change what can be accessed using &lt;code&gt;craft.request.getQuery('checkValue')&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="3682" LastEditDate="2017-12-14T00:32:08.893" LastActivityDate="2017-12-14T04:15:48.453" Title="getQuery() returns only one value" Tags="&lt;checkboxes&gt;&lt;querystring&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23201" PostTypeId="1" CreationDate="2017-12-13T22:46:02.613" Score="3" ViewCount="236" Body="&lt;p&gt;How could I go about allowing a (not logged in) guest user to submit their email address, check behind the scenes if it belongs to a user account, and then return: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A login form if it does&lt;/li&gt;&#xA;&lt;li&gt;A registration form if it doesn't&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3507" LastActivityDate="2017-12-13T23:21:31.660" Title="Check if submitted email address belongs to a user account" Tags="&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23202" PostTypeId="2" ParentId="23201" CreationDate="2017-12-13T23:21:31.660" Score="2" Body="&lt;p&gt;I assume you have basic knowledge about plugins and routing, if not I'll update my post in a few hours.. otherwise Your form could be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- check if user submitted something --&amp;gt;&#xA;{% if userExists is defined %}&#xA;    {% if userExists == true %}&#xA;        &amp;lt;!-- user exists login --&amp;gt;&#xA;        hello {{ user.name }}&#xA;&#xA;        &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;            {{ getCsrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;loginName&quot;&amp;gt;Username or email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;input id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot;&#xA;                   value=&quot;{{ craft.session.rememberedUsername }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;            &amp;lt;label&amp;gt;&#xA;                &amp;lt;input type=&quot;checkbox&quot; name=&quot;rememberMe&quot; value=&quot;1&quot;&amp;gt;&#xA;                Remember me&#xA;            &amp;lt;/label&amp;gt;&#xA;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;Login&quot;&amp;gt;&#xA;&#xA;            {% if errorMessage is defined %}&#xA;                &amp;lt;p&amp;gt;{{ errorMessage }}&amp;lt;/p&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ url('forgotpassword') }}&quot;&amp;gt;Forget your password?&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&#xA;    {% else %}&#xA;        &amp;lt;!-- user does not exist register --&amp;gt;&#xA;        &amp;lt;!-- snip see here for full content https://craftcms.com/docs/templating/user-registration-form --&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% else %}&#xA;    &amp;lt;!-- parameter not set show search form --&amp;gt;&#xA;    &amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;test/checkEmail&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;email&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your controller &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCheckEmail(){&#xA;    $email = craft()-&amp;gt;request-&amp;gt;getParam('email');&#xA;    if($user = craft()-&amp;gt;users-&amp;gt;getUserByEmail($email)){&#xA;        // user registered&#xA;        $userExists = true;&#xA;    }else{&#xA;        $userExists = false;&#xA;    }&#xA;    craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables([&#xA;        'userExists'    =&amp;gt; $userExists,&#xA;        'user'          =&amp;gt; $user&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-13T23:21:31.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23203" PostTypeId="2" ParentId="23200" CreationDate="2017-12-13T23:29:06.190" Score="3" Body="&lt;p&gt;This question is not really Craft related. Since you just don't send a valid request. You can't send one key multiple times unless you do it in an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The php &lt;code&gt;$_GET&lt;/code&gt; is a simple array with all your values and you overwrite them again and again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/5098397/how-to-pass-an-array-in-get-in-php&quot;&gt;https://stackoverflow.com/questions/5098397/how-to-pass-an-array-in-get-in-php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-13T23:29:06.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23204" PostTypeId="2" ParentId="23186" CreationDate="2017-12-13T23:48:32.027" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I guess the answer is no&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct... Craft is just the middle-man between creating the email and using whatever selected service is used to send it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-13T23:48:32.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23205" PostTypeId="2" ParentId="23200" CreationDate="2017-12-14T04:15:48.453" Score="2" Body="&lt;p&gt;Using the corrected checkbox name &lt;code&gt;name=checkValue[]&lt;/code&gt; the submitted values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;?checkValue%5B%5D=12345&amp;amp;checkValue%5B%5D=23456&amp;amp;checkValue%5B%5D=34567&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are converted to an array. The array values can now be accessed using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set checkVals = craft.request.getQuery('checkValue') %}&#xA;&#xA;{{ checkVals[1] }} {# outputs 23456 #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cVal in checkVals %}&#xA;    {{ cVal }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3682" LastActivityDate="2017-12-14T04:15:48.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23206" PostTypeId="2" ParentId="23189" CreationDate="2017-12-14T09:20:57.840" Score="0" Body="&lt;p&gt;I tried removing a few of the options from one of the Dropdowns within the Matrix and lo-and-behold, the errors are gone. Thanks so much! I guess I hit some kind of limit?&lt;/p&gt;&#xA;" OwnerUserId="6078" LastActivityDate="2017-12-14T09:20:57.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23208" PostTypeId="1" CreationDate="2017-12-14T16:09:26.000" Score="0" ViewCount="44" Body="&lt;p&gt;We bought the Charge Plugin and got it up and running for a subscription service and the website has just gone live.  We just realised any new user (subscriber) has access to all other users details if they know the control panel URL!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Charge is the only plugin ignoring user permissions in the CP.  With all permissions turned off, Charge is still available in the left hand panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise A.S.A.P.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2017-12-14T16:09:26.000" Title="Charge Plugin - Subscribers have access to the Control Panel and any other subscribers personal information" Tags="&lt;control-panel&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23209" PostTypeId="1" CreationDate="2017-12-14T18:14:12.783" Score="1" ViewCount="260" Body="&lt;p&gt;What is the best way to get only the total entry number from a section with the least overhead, in the element-api.php? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mark&lt;/p&gt;&#xA;" OwnerUserId="1084" LastActivityDate="2017-12-14T18:47:25.433" Title="element-api plugin / get entry total in section in Craft 3" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23210" PostTypeId="2" ParentId="23209" CreationDate="2017-12-14T18:28:23.180" Score="2" Body="&lt;p&gt;Ok i think i stumbled on the answer - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$signees = Entry::find()-&amp;gt;sectionId(4)-&amp;gt;count();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1084" LastEditorUserId="57" LastEditDate="2017-12-14T18:47:25.433" LastActivityDate="2017-12-14T18:47:25.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23211" PostTypeId="1" AcceptedAnswerId="23212" CreationDate="2017-12-14T21:03:52.073" Score="1" ViewCount="403" Body="&lt;p&gt;I need to create a quick, and small plugin for a client, and am having trouble with the official Craft plugin tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my base plugin code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MailchimpedPlugin extends BasePlugin&#xA;{&#xA;    function getName()&#xA;    {&#xA;         return Craft::t('Mailchimped');&#xA;    }&#xA;&#xA;    function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    protected function defineSettings() {&#xA;        return array(&#xA;            // Very confused about what goes here.&#xA;        );&#xA;    }&#xA;&#xA;    public function getSettingsHtml() {&#xA;        return craft()-&amp;gt;templates-&amp;gt;render('mailchimped/settings', array(&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;        ));&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is my settings page code w/ screenshot of what it looks like on the front end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_includes/forms' as forms %}&#xA;&#xA;&amp;lt;div&amp;gt;&#xA;  {{ forms.textField({&#xA;    label: &quot;API Key&quot;|t,&#xA;    id: 'apiKey',&#xA;    name: 'apiKey',&#xA;    placeholder: &quot;XXXXXXXXXXXX&quot;,&#xA;    required: true&#xA;  }) }}&#xA;&#xA;  {{ forms.textField({&#xA;    label: &quot;List ID&quot;|t,&#xA;    id: 'listId',&#xA;    name: 'listId',&#xA;    placeholder: &quot;d0ffd45cbd&quot;,&#xA;    required: true&#xA;  }) }}&#xA;&#xA;  &amp;lt;h3&amp;gt;Help&amp;lt;/h3&amp;gt;&#xA;  &amp;lt;a href=&quot;https://kb.mailchimp.com/integrations/api-integrations/about-api-keys&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    How To Find Your API Key&#xA;  &amp;lt;/a&amp;gt;&#xA;  &amp;lt;br /&amp;gt;&#xA;  &amp;lt;a href=&quot;https://kb.mailchimp.com/lists/manage-contacts/find-your-list-id&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    How To Find Your List ID&#xA;  &amp;lt;/a&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EECud.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EECud.png&quot; alt=&quot;Craft plugin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, all I want to know how to do, is to get the api key and list id field to save and be persisted after the user presses the save button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried reading through the plugin tutorial, and looked at the sample plugin Github page, but honestly, it has to much functionality for a beginner, and is just confusing me even more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, the accepted answer will have some code outlining how I would go about this. P.S. I am not looking for an existing plugin, as I want to to do this myself. My company(A studio) uses CraftCMS for their clients websites, so I want to know how to create custom plugins in the future.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2017-12-14T23:12:58.550" Title="Saving Field Data Custom Craft Plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23212" PostTypeId="2" ParentId="23211" CreationDate="2017-12-14T22:59:15.140" Score="2" Body="&lt;p&gt;It seems all you miss is the define setting and the value attribute in your template, Craft manages the settings for your plugins without any need to edit many things. It stores and loads them automatically. You can handle the entire process on your own and overwrite craft functions but out of the box you have to do nearly nothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a great boilerplate you could create a plugin with &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfaktory&lt;/a&gt; it has many examples how to manage things like routing, templating and all that kind of stuff. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just turn the &quot;Settings&quot; lightswitch to on and don't change the &quot;Comments&quot; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway here is some example code to store settings&#xA;In your Plugin.php you need&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /**&#xA; * Defines the attributes that model your plugin’s available settings.&#xA; *&#xA; * @return array&#xA; */&#xA;protected function defineSettings()&#xA;{&#xA;    // this is an array with all the settings the user may change. &#xA;    // Open the `AttributeType` file to see a full list. Eg. Integer, &#xA;    // String, JSON, Enum.... there are many ready to use data types, and of &#xA;    // course you could define validation rules like min length, max length, &#xA;    // in range and such&#xA;    return array(&#xA;        'apiKey' =&amp;gt; array(AttributeType::String, 'label' =&amp;gt; 'Your Api Key', 'default' =&amp;gt; 'XXXX'),&#xA;        'listId' =&amp;gt; array(AttributeType::String),&#xA;    );&#xA;}&#xA;&#xA;/**&#xA; * Returns the HTML that displays your plugin’s settings.&#xA; *&#xA; * @return mixed&#xA; */&#xA;public function getSettingsHtml()&#xA;{&#xA;   return craft()-&amp;gt;templates-&amp;gt;render('mailchimped/settings', array(&#xA;       'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;   ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.textField({&#xA;    label: 'Some Setting',&#xA;    instructions: 'Enter some setting here.',&#xA;    id: 'apiKey',&#xA;    name: 'apiKey', &#xA;    value: settings['apiKey']})&#xA;}}&#xA;&#xA;{{ forms.textField({&#xA;    label: 'Some Setting',&#xA;    instructions: 'Enter some setting here.',&#xA;    id: 'listId',&#xA;    name: 'listId', &#xA;    value: settings['listId']})&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yeah, thats finally it... you can access those with from everywhere&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MailchimpedPlugin::getSettings()['listId']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = MailchimpedPlugin::getSettings();&#xA;$data = $settings-&amp;gt;getAttributes();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-14T23:12:58.550" LastActivityDate="2017-12-14T23:12:58.550" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23213" PostTypeId="2" ParentId="23186" CreationDate="2017-12-15T04:38:32.317" Score="1" Body="&lt;p&gt;We are currently using Sendmail for a site, and messages were being blocked until we got their host to whitelist things.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So If it's an important message, I would use something like &lt;a href=&quot;https://postmarkapp.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PostMark&lt;/a&gt;, where deliverability is more reliable, plus you can also track whether messages were sent or not.  Not to mention their support is great!&lt;/p&gt;&#xA;" OwnerUserId="5925" LastActivityDate="2017-12-15T04:38:32.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23214" PostTypeId="2" ParentId="23177" CreationDate="2017-12-15T04:52:46.760" Score="2" Body="&lt;p&gt;Digging into Redactor a little deeper I found that it fails to include &lt;code&gt;&amp;lt;abbr&amp;gt;&lt;/code&gt; in its list of inline tags. To add support I made the following modifications to /lib/radactor/redactor.js:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Line 149:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pasteInlineTags: ['br', 'strong', 'ins', 'code', 'del', 'span', 'samp', 'kbd', 'abbr', 'sup', 'sub', 'mark', 'var', 'cite', 'small', 'b', 'u', 'em', 'i'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Line 310:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;inlineTags: ['a', 'span', 'strong', 'strike', 'b', 'u', 'em', 'i', 'code', 'del', 'ins', 'samp', 'kbd', 'abbr', 'sup', 'sub', 'mark', 'var', 'cite', 'small'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've made Imperavi aware of the omission so hopefully they'll get this sorted in the next release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Imperavi have sent a response:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We'll add the abbr support including the paste arrays in the next update. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5176" LastEditorUserId="5176" LastEditDate="2017-12-19T13:17:53.007" LastActivityDate="2017-12-19T13:17:53.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23215" PostTypeId="2" ParentId="23122" CreationDate="2017-12-15T10:38:12.610" Score="1" Body="&lt;p&gt;I don't know what your timeline is for this plugin but I did read this article from Andrew Fairlie where he introduces a craft plugin that he is developing. The article was written quite a while ago and I don't think he has ever released it. You could try and reach out to him to see if you can use the plugin or even take over its development in the case it has stalled. It seems to do exactly what you are asking for including the &quot;mark as read function&quot; as well as a couple of things on the side.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It obviously also depends on if you are comfortable with using other people's plugins or if you specifically want to write your own....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the article: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/the-feelings/introducing-notification-centre-for-craft-cms-38d453af5222&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/the-feelings/introducing-notification-centre-for-craft-cms-38d453af5222&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2017-12-15T10:38:12.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23217" PostTypeId="1" CreationDate="2017-12-15T11:42:14.517" Score="2" ViewCount="147" Body="&lt;p&gt;I'm trying to import a &lt;a href=&quot;https://github.com/fruitstudios/LinkIt&quot; rel=&quot;nofollow noreferrer&quot;&gt;LinkIt&lt;/a&gt; fieldtype into a Super Table with the Feed Me plugin. I've tried several ways but doesn't seem to be working. The part in my json which gets mapped to the Super Table looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;links&quot;: [&#xA;              {&#xA;                &quot;url&quot;: &quot;https://imaginehome.canvas.be/en&quot;,&#xA;                &quot;description&quot;: &quot;Imagine Home website&quot;&#xA;              }&#xA;          ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've managed to register LinkIt as a Feed Me fieldtype, but no matter what I seem to be returning in the &lt;code&gt;prepFieldData&lt;/code&gt; function, it will not import it. I have another Super Table field with just some rows with a text input in it and that works just fine.&lt;/p&gt;&#xA;" OwnerUserId="5564" LastActivityDate="2017-12-15T11:42:14.517" Title="How to import LinkIt (custom) fieldtype with Feed Me into Super Table" Tags="&lt;import&gt;&lt;plugin-feedme&gt;&lt;plugin-supertable&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23219" PostTypeId="1" AcceptedAnswerId="23285" CreationDate="2017-12-15T15:36:26.777" Score="1" ViewCount="366" Body="&lt;p&gt;In channel A, we have a Neo field with a couple of different block types, in 1 of those types we have an entries field with channel B entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the channel B entry, I'd like to find out if it is related to a channel A entry through that Neo field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going by &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/relations&lt;/a&gt; and how it works for a Matrix field I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% set partOfChannelA = craft.entries.section('channelA').relatedTo({&#xA;        targetElement: entryChannelB,&#xA;        field: 'neoField.blockType.fieldHandle'&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't work :)&#xA;Am I missing something or does this simply not work with a Neo field?&#xA;Thanks for helping out!&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-12-22T10:40:48.707" Title="Get relatedTo from Neo field" Tags="&lt;relations&gt;&lt;relatedto&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23220" PostTypeId="1" AcceptedAnswerId="23221" CreationDate="2017-12-15T17:50:42.603" Score="1" ViewCount="1435" Body="&lt;p&gt;I am making some progress with creating a custom plugin, and am curious as to whether I am following proper &quot;Craft standards&quot;. Here is my scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A user needs to submit a one field form that contains their email address. Upon button click, I would like to prevent the default action, and send the email address via AJAX to my plugin for processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading through the Craft Plugin Docs, I am under the impression that my plugin requires the following functionality(and in this order).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Send email address via AJAX to a Controller.&lt;/li&gt;&#xA;&lt;li&gt;The controller will then extract the email, and send it off to a &#xA;Service.&lt;/li&gt;&#xA;&lt;li&gt;The Service, is where I should write my code that connects to the MailChimp API&lt;/li&gt;&#xA;&lt;li&gt;Send the result of whether the Mailchimp API request was successful from the Service, back to the Controller.&lt;/li&gt;&#xA;&lt;li&gt;The Controller will then send back the response to my JavaScript, where I will ultimately display a success or error message to the user.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have been successful&lt;/strong&gt; in sending an AJAX request from my JavaScript code to my Controller via the following code, and receiving some dumby test text.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function sendAjax() {&#xA;    var xhr = new XMLHttpRequest()&#xA;    xhr.open('POST', siteUrl + 'ajax/ajax-mailchimp.html')&#xA;    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')&#xA;&#xA;    xhr.onload = function() {&#xA;      if(xhr.status === 200) {&#xA;        console.log(xhr.responseText)&#xA;      }&#xA;    }&#xA;    xhr.send(encodeURI('action=/craftMailchimped/submittal/receiveEmail&amp;amp;email=fakeemailaddress@yahoo.com'))&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my controller, I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class CraftMailchimped_SubmittalController extends BaseController {&#xA;&#xA;    public function actionReceiveEmail() {&#xA;        echo 'Wuzup?';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In case you are wondering&lt;/strong&gt; what '&lt;em&gt;ajax/ajax-mailchimp.html&lt;/em&gt;' is, its an empty template file, with no code in it. I did this, because I didn't really know what to put in as the URL in the xhr.POST method in my JavaScript code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am concerned I am not going about this in the right way, as I wouldn't even know how I would extract the email address inside my controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Form HTML for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;updates&quot; class=&quot;mchimp&quot;&amp;gt;&#xA;    &amp;lt;p class=&quot;newsletter&quot;&amp;gt;&#xA;      {{ entry.connectNewsletterCta }}&#xA;    &amp;lt;/p&amp;gt;&#xA;    &amp;lt;div class=&quot;elements-wrapper&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; required&amp;gt;&#xA;      &amp;lt;button class=&quot;btn&quot;&amp;gt;&#xA;        {{ entry.connectNewsletterButtonText }}&#xA;      &amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="7292" LastEditDate="2017-12-18T14:43:22.197" LastActivityDate="2017-12-18T14:43:22.197" Title="How to Properly Use Controller and Service in Custom Plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23221" PostTypeId="2" ParentId="23220" CreationDate="2017-12-15T18:13:51.717" Score="1" Body="&lt;p&gt;It's actually quite simple.&#xA;First you need a form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; id=&quot;myForm&quot;&amp;gt;&#xA;    &amp;lt;!-- insert your route as an action parameter in camelCase --&amp;gt;&#xA;    &amp;lt;!-- pluginName/controllerName/methodName --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;craftMailchimped/submittal/receiveEmail&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;email&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;button&quot; id=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you have your javascript (I'll use jQuery ajax for that)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#submit&quot;).click(function(e){&#xA;    e.preventDefault();&#xA;    $.ajax({&#xA;        type: &quot;post&quot;,&#xA;        url: '', //&amp;lt;- leave the url blank.. always...&#xA;        data: $(&quot;#myForm&quot;).serialize(),&#xA;        success: function(data){&#xA;            console.log(data);&#xA;            if(data.success === true){&#xA;                alert(data.message);&#xA;            }else{&#xA;                //display your data.errors here&#xA;            }&#xA;        },&#xA;        error: function (XMLHttpRequest, textStatus) {&#xA;            console.log(&quot;Status: &quot; + textStatus);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your controller and this &lt;a href=&quot;https://gist.github.com/Anubarak/3a972ba498f1578a0eb658a8be80c9f8&quot; rel=&quot;nofollow noreferrer&quot;&gt;model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionReceiveEmail() {&#xA;    $response = [&#xA;        'success'   =&amp;gt; false,&#xA;        'message'   =&amp;gt; Craft::t('something went wrong')&#xA;    ];&#xA;&#xA;    $emailModel = new CraftMailchimped_EmailModel();&#xA;    $emailModel-&amp;gt;email = craft()-&amp;gt;request-&amp;gt;getParam('email');&#xA;&#xA;    if(craft()-&amp;gt;yourServiceName-&amp;gt;subscribe($emailModel)){&#xA;        $response['success'] = true;&#xA;        $response['message'] = Craft::t('wuhu great :D');&#xA;    }else{&#xA;        $response['errors'] = $emailModel-&amp;gt;getErrors();&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your service could contain this method&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function subscribe(CraftMailchimped_EmailModel $emailModel){&#xA;    if($success = $emailModel-&amp;gt;validate()){&#xA;        //make your API calls&#xA;        $response = ......;&#xA;        if($response['error'] === 444){&#xA;            $emailModel-&amp;gt;addError('email', Craft::t('Email is already taken'));&#xA;            $success = false;&#xA;        }&#xA;    }&#xA;&#xA;    return $success;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you are totally right with your points. In case you want to see how to manage records in your database take a look at this plugin &lt;a href=&quot;https://github.com/Anubarak/usernotifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Click&lt;/a&gt; I created it for learning purposes for someone else in &lt;a href=&quot;https://craftcms.stackexchange.com/a/23129/5557&quot;&gt;this thread&lt;/a&gt;. Maybe you'll find it useful to learn some stuff like fetching objects from the database and inserting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;to resume &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You should always leave the url blank, define an action parameter for your route. The request type does not matter, it's the same for ajax and normal requests&lt;/li&gt;&#xA;&lt;li&gt;Your Route is always &lt;code&gt;pluginHandle/controllerName/functionName&lt;/code&gt; in camelCase&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your messages and responses should always be defined in your Controllers, your Services are just for logic that return true or false (or some objects like &lt;code&gt;craft()-&amp;gt;entries-&amp;gt;getEntryById()&lt;/code&gt;), you can create models with validations for error messages you can use them like that: (validators will provide the translated messages)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// in your controller&#xA;$mailChimpModel;&#xA;if(craft()-&amp;gt;mailchimp-&amp;gt;subscribe($mailChimpModel)){&#xA;    $response['success'] = true;&#xA;}else{&#xA;    $response['errors'] = $mailChimpModel-&amp;gt;getErrors();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$response['errors']&lt;/code&gt; is an array with all field handles and the corresponding translated error messages like &lt;code&gt;'email' =&amp;gt; ['This Mail is already in the list']&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Crafts &lt;code&gt;RequestService&lt;/code&gt; has all the methods you need to access the request variables. Those values are all safely escaped and secure, so you can be sure there won't be security measures. You can access parameters with &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getParam('key', default value);&lt;/code&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-16T10:06:25.807" LastActivityDate="2017-12-16T10:06:25.807" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23222" PostTypeId="1" CreationDate="2017-12-15T22:05:11.037" Score="1" ViewCount="66" Body="&lt;p&gt;I am very new to Craft so forgive me if I knacker how this is asked.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a set of IDs in an array.  I try sending that into a relatedTo statement (which yields a series of locations...see below code) and from that I loop through those locations, getting some subset descendents of those locations for display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is, this is a heavy load on the database and without caching takes forever to come back for rendering.   What I would like to do is essentially combine the queries for relatedCampIds, locationCats, and subCategories into a single query that's optimized.  I have tried using the BuildQuery example at &lt;a href=&quot;https://github.com/tightenco/craft-build-query&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/tightenco/craft-build-query&lt;/a&gt; but I am like a fish out of water and just don't see how I can extend that to do what I'm looking to do.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# CREATE AN ARRAY OF THE CAMP IDS #}&#xA;{% entry = craft.entries.section('pages')}&#xA;{% set relatedCampsIds = [] %}&#xA;{% set relatedCampsIds = relatedCampsIds|merge(craft.entries.section('pages').descendantOf(entry).type('camp').limit(null).ids()) %}&#xA;&#xA;{% set locationCats = craft.categories.relatedTo({ sourceElement: relatedCampsIds }).groupId(1).level(1).order('title').find() %}   &#xA;&#xA;{# get all camps related to the sport/sponsor and Area #}&#xA;{% for location in locationCats %}&#xA;    {# get all Cities of this Area where there are camps for the given sport/sponsor #}&#xA;    {% set subCategories = craft.categories.descendantOf(location).level(2).order('title').relatedTo({ sourceElement: relatedCampsIds}) %}&#xA;    {# loop over the subcategories #}&#xA;    {% for subCat in subCategories %}&#xA;        {# do some display stuff #}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help and understanding are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7746" LastActivityDate="2017-12-15T22:05:11.037" Title="Combine multi-tiered loop into a single query (via plugin)" Tags="&lt;plugin-development&gt;&lt;queries&gt;&lt;query&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23223" PostTypeId="1" CreationDate="2017-12-16T19:57:01.063" Score="1" ViewCount="430" Body="&lt;p&gt;I'm new to Craft, coming over from ExpressionEngine to start doing maintenance on an agency-built Craft site, and I have what may well be a very basic question... please be gentle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a page that allows searches on a particular section of entries. There is a form that has a handful of input fields corresponding to ExpressionEngine fields that can be searched. One of the input fields (locationState) always gives zero results, even though the data being searched for is there per admin and database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at craft.log, I can see that several database queries go into the search. The query that's just pulling primary keys for matching rows works fine. The next query, which wants to pull all fields for output for rows with those primary keys, looks like it has a problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM `craft_searchindex` &#xA;WHERE ((`keywords` LIKE '%title%') OR (`keywords` LIKE '%position%') OR (`keywords` LIKE '%jobtitle%') OR (`keywords` LIKE '%bioquick%') OR (`keywords` LIKE '%biofull%') OR (`keywords` LIKE '%institution%'))&#xA;AND `locale` = 'en_us' &#xA;AND `elementId` IN (5355,7874,8608)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those &lt;em&gt;title, position, jobtitle, bioquick, biofull,&lt;/em&gt; and &lt;em&gt;institution&lt;/em&gt; values look like they're unparsed variable names to me, like someone writing this code forgot to evaluate them for values before handing them off to the search service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go into the template for this search page do a dump(params), where &quot;params&quot; is the name of a variable being constructed out of user input to the search form input fields, I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(6) { &#xA;    [&quot;section&quot;]=&amp;gt; string(8) &quot;profiles&quot; &#xA;    [&quot;type&quot;]=&amp;gt; string(11) &quot;localExpert&quot; &#xA;    [&quot;order&quot;]=&amp;gt; string(5) &quot;score&quot; &#xA;    [&quot;limit&quot;]=&amp;gt; int(25) &#xA;    [&quot;locationState&quot;]=&amp;gt; string(2) &quot;DC&quot; &#xA;    [&quot;search&quot;]=&amp;gt; array(3) { &#xA;        [&quot;query&quot;]=&amp;gt; string(73) &quot;title: OR position: OR jobTitle: OR bioQuick: OR bioFull: OR institution:&quot; &#xA;        [&quot;subLeft&quot;]=&amp;gt; bool(true) &#xA;        [&quot;subRight&quot;]=&amp;gt; bool(true) &#xA;    } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are &lt;em&gt;title, position, jobtitle, bioquick, biofull,&lt;/em&gt; and &lt;em&gt;institution&lt;/em&gt; again. The full code that dynamically creates the params variable is too long to paste, but the piece of it that addresses these 6 fields looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fullquery = 'title:' ~ query ~ ' OR ' ~ 'position:' ~ query ~ ' OR ' ~ 'jobTitle:' ~ query ~ ' OR ' ~ 'bioQuick:' ~ query ~ ' OR ' ~ 'bioFull:' ~ query ~ ' OR ' ~ 'institution:' ~ query %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &quot;query&quot; is craft.request.getParam('q') and where &quot;fullquery&quot; eventually gets concatenated into params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The meat of my question here is this: for my failing search, craft.request.getParam('q') is null. So I'd expect that the value of &quot;fullquery&quot; would be concatenating empty strings, which matches what I see when I do that dump(params), but does NOT match the SQL query I see in craft.log, with those seeming unparsed variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I hope someone can help me out by at least confirming that what gets written to craft.log is the final and literal query, post all evaluation and parsing, right? Knowing that alone would help me know I'm not missing something super fundamental on my way to trying to figure out how my dumps don't match what's in craft.log, which seems pretty key to figuring out why my search is failing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, I'm doing my dump(params) immediately before the line of the template that runs the search via {% set entries = craft.entries( params ) %}, so nothing should be changing between the dump and the logging of the db query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you, and I hope my question is clear.&lt;/p&gt;&#xA;" OwnerUserId="7748" LastActivityDate="2017-12-16T19:57:01.063" Title="Debugging Craft search query: differences between craft.log and dump()" Tags="&lt;search&gt;&lt;logs&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23224" PostTypeId="1" AcceptedAnswerId="23225" CreationDate="2017-12-17T03:53:22.663" Score="1" ViewCount="115" Body="&lt;p&gt;I'm trying to show a list of entries related to the same category on a page that contains a single entry. I have two category separate category fields in the entry, both with one category each selected in them. The two category groups are named &lt;strong&gt;eventType&lt;/strong&gt; and &lt;strong&gt;venue&lt;/strong&gt;. The code below successfully shows a list of entry titles for one category group but not the other, and I can't seem to find out what's going wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below works for the eventType category group (it shows all the entries related to eventType). But when I swap out &lt;strong&gt;eventType&lt;/strong&gt; for &lt;strong&gt;venue&lt;/strong&gt;, it returns my &lt;strong&gt;else&lt;/strong&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft (it's great!), so maybe I'm going about this all wrong, or missing something obvious.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for thisCategory in entry.eventType %}&#xA;&#xA;    &amp;lt;h1&amp;gt;Other Events in {{ thisCategory.title }}&amp;lt;/h1&amp;gt;&#xA;    {% set category = craft.categories.slug(thisCategory.title) %}&#xA;    {% set entries = craft.entries.section('events').relatedTo(category).find() %}&#xA;&#xA;    {# If there are any entries, loop through them #}&#xA;    {% if entries | length %}&#xA;        {# For each entry we find, do this #}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        &amp;lt;p&amp;gt;Found no entries&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7749" LastEditorUserId="5557" LastEditDate="2017-12-27T17:13:49.283" LastActivityDate="2017-12-27T17:13:49.283" Title="relatedTo working for one category group but not another" Tags="&lt;templating&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23225" PostTypeId="2" ParentId="23224" CreationDate="2017-12-17T08:33:55.183" Score="2" Body="&lt;p&gt;Your approach seems interesting but you should never do such &quot;relations&quot;. They can be broken all over the way. Let me explain that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Title vs Handle&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most objects in Craft have the attributes &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;handle&lt;/code&gt;. The title is the name that can be rendered in the frontend. This should be your attribute to show users what the object is about. The &lt;code&gt;handle&lt;/code&gt; is your &quot;developing&quot; attribute. This is a unique field, with several validation rules to make this field selectable via &lt;code&gt;getEntryByHandle()&lt;/code&gt; thus you can link entries via handle, get them via handle and change the display name (title) however you like and can still select those via handle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Other Events in {{ thisCategory.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is totally correct, you show the title to the frontend&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(thisCategory.title) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is absolutely wrong. The validation rules for &lt;code&gt;title&lt;/code&gt; and the validation rules for the &lt;code&gt;slug&lt;/code&gt; attribute are totally different and you should never match those fields. When you have a title like &lt;code&gt;Foo Bar&lt;/code&gt; you'll never be able to match them since your slug would be &lt;code&gt;foo-bar&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way would be this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.yourCategoryFieldHandle.first() %}&#xA;{% set entries = craft.entries.section('events').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really really want to relate objects not via the &lt;code&gt;relation Field&lt;/code&gt; but via strings you should do it with the &lt;code&gt;handle&lt;/code&gt; but never with &lt;code&gt;titles&lt;/code&gt; or &lt;code&gt;slugs&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-17T08:33:55.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23226" PostTypeId="1" CreationDate="2017-12-17T20:18:24.983" Score="1" ViewCount="366" Body="&lt;p&gt;I would like to get the events with all their occurrences that belong to a specific month but ignore any of those occurrences before a certain date.&#xA;From the documentation, the &lt;code&gt;dateRangeStart&lt;/code&gt; parameter should the trick but it doesn't work for me. The following query returns all events starting from December 1st. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.calendar.month({&#xA;    dateRangeStart: '2017-12-17',&#xA;    calendar: calendarHandle&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-17T07:18:53.647" Title="Is there a way to output the events that belong in a month after a specific date using the Calendar plugin by Solspace?" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23227" PostTypeId="2" ParentId="23226" CreationDate="2017-12-18T04:00:32.967" Score="1" Body="&lt;p&gt;The &lt;code&gt;calendar.month&lt;/code&gt; function is designed to only display complete months, so as long as you specify a date, it's going to show you events for that whole month (before and after).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're looking for is the &lt;code&gt;calendar.events&lt;/code&gt; function:&#xA;&lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.events/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/docs/calendar.events/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code to display events starting from &lt;strong&gt;today&lt;/strong&gt; plus 1 month (+30 days) would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.calendar.events({&#xA;   dateRangeStart: 'today',&#xA;   dateRangeEnd: '30 days'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're looking to display events starting &lt;strong&gt;today&lt;/strong&gt; but stop and the &lt;strong&gt;END of the current month&lt;/strong&gt;, your code would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.calendar.events({&#xA;   dateRangeStart: 'today',&#xA;   dateRangeEnd: 'last day of +0 month'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-12-18T04:00:32.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23228" PostTypeId="1" AcceptedAnswerId="23230" CreationDate="2017-12-18T16:55:05.193" Score="8" ViewCount="2545" Body="&lt;h1&gt;1) Where To Put It&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I’m wondering how I should proceed with the &lt;code&gt;SECURITY_KEY&lt;/code&gt; which is now mandatory in Craft 3 (RC2). It has to be the same for one project, right? So it should be shared across developers. But is it a good idea to commit it to a Git repository? I guess not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then – where do I put it without losing it and still sharing it with team mates. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;2) What If It Changed?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Due to some circumstances I lost the security key of the initial installation and added a new one. Could that lead to unwanted behavior down the road? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enlightenment of any kind is much appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="1056" LastEditorUserId="57" LastEditDate="2017-12-18T18:25:47.247" LastActivityDate="2020-03-03T10:52:29.257" Title="How to handle the SECURITY_KEY?" Tags="&lt;craft3&gt;&lt;security&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23229" PostTypeId="2" ParentId="23165" CreationDate="2017-12-18T18:35:26.483" Score="0" Body="&lt;p&gt;Got this going by restructuring my templates. Not sure the exact reason I was getting the error but when I moved the variable declarations above the &quot;extends&quot; call the inner &quot;include&quot; had access to the variables. –&lt;/p&gt;&#xA;" OwnerUserId="7491" LastActivityDate="2017-12-18T18:35:26.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23230" PostTypeId="2" ParentId="23228" CreationDate="2017-12-18T19:11:05.370" Score="16" Body="&lt;p&gt;First a bit of history:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 has a similar concept where it would store a unique random security key in &lt;code&gt;craft/storage/runtime/validation.key&lt;/code&gt;.  Alternatively, you could set the &lt;a href=&quot;https://craftcms.com/docs/config-settings#validationKey&quot; rel=&quot;noreferrer&quot;&gt;validationKey&lt;/a&gt; config setting if you wanted to provide your own key instead of use the one generated by Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 would essentially only use this for encrypting cookie data in a browser for authenticated sessions.  Because everything in &lt;code&gt;craft/storage/runtime&lt;/code&gt; is temporary and could be deleted at any time, it is important in load-balanced environments to use the &lt;code&gt;validationKey&lt;/code&gt; config setting and set it to the same key for every web instance behind the load balancer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible that a plugin might go through &lt;code&gt;craft()-&amp;gt;security-&amp;gt;encrypt()&lt;/code&gt;, which takes the key into account, someone nukes the &lt;code&gt;validation.key&lt;/code&gt; file that lives in &lt;code&gt;craft/storage/runtime&lt;/code&gt; and Craft is unable to decrypt the data at that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 decided that it would probably need to start &lt;a href=&quot;https://github.com/craftcms/cms/issues/1977&quot; rel=&quot;noreferrer&quot;&gt;encrypting data in the database&lt;/a&gt; at some point in the future, so it needed a more reliable way to guarantee there was a security key it could use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;craft/storage/runtime/validation.key&lt;/code&gt; was deprecated and moved to &lt;code&gt;craft/storage/security.key&lt;/code&gt;, the &lt;code&gt;validationKey&lt;/code&gt; config settings was renamed to &lt;code&gt;securityKey&lt;/code&gt; and Craft 3 now requires it to be set in some form or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 also added another way to set it if you use the composer &lt;a href=&quot;https://github.com/craftcms/craft&quot; rel=&quot;noreferrer&quot;&gt;starter project&lt;/a&gt; via the &lt;code&gt;.env&lt;/code&gt; &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/.env.example#L5&quot; rel=&quot;noreferrer&quot;&gt;SECURITY_KEY&lt;/a&gt; environment variable, so that you can use &lt;code&gt;'securityKey' =&amp;gt; getenv('SECURITY_KEY'),&lt;/code&gt; in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to the questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It has to be the same for one project, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It should be, if you want to reliably encrypt and decrypt data across environments.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So it should be shared across developers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It should be, if you want to reliably encrypt and decrypt data across developers.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But is it a good idea to commit it to a Git repository?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Definitely not a public repository.  Arguable in a private one.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Due to some circumstances I lost the security key of the initial installation and added a new one. Could that lead to unwanted behavior down the road?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You wouldn't be able to decrypt any data that was encrypted with the old key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of session cookies, the worst that would happen is you'd lose your current session.  In the case of encrypted database email settings, you'd have to re-save your email settings.  In the case that a plugin is doing some custom encrypting and decrypting and relying on Craft's &lt;code&gt;craft\services\Security&lt;/code&gt; class to to it, you wouldn't be able to decrypt that data.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-18T19:11:05.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23231" PostTypeId="1" CreationDate="2017-12-18T20:43:10.640" Score="1" ViewCount="498" Body="&lt;p&gt;After a successful install I point the (MAMP PRO 4+) Document Root to the Craft &lt;code&gt;/web&lt;/code&gt; folder, which allows the final setup process. (via www/admin) However pointing at the site root (www) triggers this error; &lt;code&gt;HTTP 404 – Not Found – yii\web\NotFoundHttpException&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am missing a final step?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2017-12-18T21:00:20.860" Title="Installing Craft 3 RC on MAMP Pro - Pointing to the file directory" Tags="&lt;install&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23232" PostTypeId="2" ParentId="23231" CreationDate="2017-12-18T21:00:20.860" Score="2" Body="&lt;p&gt;Craft 3 does not come up with templates or default entries like Craft 2 so your &lt;code&gt;templates&lt;/code&gt; directory is probably empty. As soon as you create some files there and link them to your entries you won't see the error when you enter your home url&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-18T21:00:20.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23233" PostTypeId="1" AcceptedAnswerId="23234" CreationDate="2017-12-18T23:01:22.267" Score="1" ViewCount="363" Body="&lt;p&gt;Craft Personal 3.0.0-RC2 doesn't show the Pro Trial offer anymore? Is that correct?&#xA;I did install a Pro License however this triggers the system to change the domain (from local dev to live) which is unwanted.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2017-12-19T00:14:12.407" Title="Pro trial not showing" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23234" PostTypeId="2" ParentId="23233" CreationDate="2017-12-19T00:14:12.407" Score="1" Body="&lt;p&gt;Nothing around trial usage has changed between Craft 2 and Craft 3, so as long as you follow this, it should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/try-craft-client-pro&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/try-craft-client-pro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just keep in mind (because it sounds like you're swapping license keys around) that license.key info is cached for 24 hours at a time, so be sure and clear &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; in whenever you do something like that to get accurate results and hit the updates page if you need to force a call home to Craft's web services.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-19T00:14:12.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23235" PostTypeId="2" ParentId="23042" CreationDate="2017-12-19T02:34:59.043" Score="5" Body="&lt;p&gt;I’m new to Craft and I’m surprised something bare bones like this doesn’t exist. At least I haven’t found anything yet. However, if I was to set out to create something like this I would use a stripped-down version of what is built in this awesome course at Mijingo. I’ve taken the course and it’s worth every penny.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mijingo.com/products/screencasts/reusable-twig-templates-craft/&quot; rel=&quot;noreferrer&quot;&gt;https://mijingo.com/products/screencasts/reusable-twig-templates-craft/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2017-12-19T02:34:59.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23236" PostTypeId="1" AcceptedAnswerId="23255" CreationDate="2017-12-19T09:41:41.063" Score="1" ViewCount="59" Body="&lt;p&gt;I have a situation where I wish to automatically set entry title based on locale entry was created in. This is what I use for title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ object.locale == &quot;jp&quot; ? &quot;Japanese title&quot; : &quot;English title&quot;}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine but when I create an entry in Japanese locale and open it in English locale and resave it the title changes to &quot;English title&quot; and that's not what I want, I wish to preserve the original title. Is that possible somehow?&lt;/p&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2017-12-21T19:21:38.777" Title="Prevent automatic title on resave" Tags="&lt;localization&gt;&lt;titles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23237" PostTypeId="1" AcceptedAnswerId="23256" CreationDate="2017-12-19T09:58:18.440" Score="3" ViewCount="180" Body="&lt;p&gt;I have &lt;code&gt;&amp;lt;img src=&quot;/path/file-to-be-replaced.png&quot;&amp;gt;&lt;/code&gt; in a Single-Line Text Type in a Table Field Type which is inside a matrix. Now I want to replace all of them through &lt;code&gt;Find and replace&lt;/code&gt; option. But when I use &lt;code&gt;&amp;lt;img src=&quot;/path/file-to-be-replaced.png&quot;&amp;gt;&lt;/code&gt; and &lt;code&gt;Yes&lt;/code&gt; in Find and Replace Fields respectively then nowhere it is replaced. However a task runs saying &lt;code&gt;Replacing “&amp;lt;img src=&quot;/path/file-to-be-replaced.png&quot; /&amp;gt;” with “Yes”&lt;/code&gt; but still nothing happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6007" LastEditDate="2018-07-19T07:12:27.420" LastActivityDate="2018-07-19T07:12:27.420" Title="How to find and replace an &lt;img src&gt; tag?" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23238" PostTypeId="1" AcceptedAnswerId="23241" CreationDate="2017-12-19T10:32:27.110" Score="1" ViewCount="265" Body="&lt;p&gt;I want to allow people to chose which person/department to send a message to using the &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;P&amp;amp;T Contact Form plugin&lt;/a&gt;. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19077/how-to-add-recipient-drop-down-selection-field-with-the-contact-form-plugin&quot;&gt;I've seen one method to do this&lt;/a&gt;, eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;toEmail&quot;&amp;gt;&#xA;      &amp;lt;option value=&quot;{{ '1stname@example.com'|hash }}&quot;&amp;gt;1st name&amp;lt;/option&amp;gt;&#xA;      &amp;lt;option value=&quot;{{ '2ndname@example.com'|hash }}&quot;&amp;gt;2nd name&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it does mean that the actual email address is visible in the HTML code. Which would allow the spam robots to harvest it. Although it may be that the hash added makes it harder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the ideal world I would like the address to be completely hidden or encrypted in the form page html. I wonder if the name=&quot;toEmail&quot; value=&quot; &quot; could be a variable that is passed along with the value=&quot;contactForm/sendMessage&quot; action, that could then be referenced and replaced from a list in the &lt;a href=&quot;https://github.com/craftcms/contact-form#overriding-plugin-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;contact form config file&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did think of using a plugin to store the email address related to a name/department as a variable, but it still just adds the plain text address to the final html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that not having plain text email addresses should be the standard way of working so I'm surprised that there isn't already a plugin or method to do this, but I can't find one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit to show the final solution I'm using.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very grateful to &lt;a href=&quot;https://craftcms.stackexchange.com/users/5557/robin-schambach&quot;&gt;Robin Schambach&lt;/a&gt;, who provided all the clever code, I've just put it all together here to help anyone looking for a similar solution. The email addresses are never available or visible on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a Section named Contacts with plain text data fields of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;contactName&lt;/p&gt;&#xA;&#xA;&lt;p&gt;contactPosition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;contactEmail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;contactKey (this stores the name in camelCase, so &quot;johnSmith&quot; not &quot;John Smith&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows the end user to maintain/update the names and addresses of contacts without the developer needing to make changes on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;P&amp;amp;T Contact form plugin&lt;/a&gt; and &lt;a href=&quot;https://github.com/craftcms/contact-form#overriding-plugin-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;add a config file to overide the plugin settings&lt;/a&gt;.&#xA;The contents of that file should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;$toEmailId = craft()-&amp;gt;request-&amp;gt;getPost('toEmail');&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'contacts';&#xA;$allAddresses = [];&#xA;foreach($criteria as $entry){&#xA;    $allAddresses[$entry-&amp;gt;contactKey] = $entry-&amp;gt;contactEmail;&#xA;}&#xA;$toEmail = (array_key_exists($toEmailId, $allAddresses))? $allAddresses[$toEmailId] : null;&#xA;return array(&#xA;    'toEmail' =&amp;gt; ($toEmail ?: null),&#xA;    'prependSubject'      =&amp;gt; '',&#xA;    'prependSender'       =&amp;gt; '',&#xA;    'allowAttachments'    =&amp;gt; false,&#xA;    'honeypotField'       =&amp;gt; 'honeyPot',&#xA;    'successFlashMessage' =&amp;gt; 'Thanks for your message'&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My contact form looks like this (based on the P&amp;amp;T example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;contact/thanks&quot;&amp;gt;&#xA;&#xA;&#xA;    {% set entries = craft.entries.section('contacts').find %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;select name=&quot;toEmail&quot;&amp;gt;{# you could also use radio buttons #}&#xA;            &amp;lt;option value=&quot;{{ entry.contactKey }}&quot;&amp;gt;{{ entry.contactName }}, {{ entry.contactTitle }}&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromName&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{% if message is defined %}{{ message.subject }}{% endif %}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;    &amp;lt;input id=&quot;honeyPot&quot; name=&quot;honeyPot&quot; type=&quot;text&quot;&amp;gt;{# hide this via CSS #}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastEditorUserId="152" LastEditDate="2017-12-20T10:24:38.783" LastActivityDate="2017-12-20T10:24:38.783" Title="How to encrypt or hide variable/dynamic email address in contact form" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23239" PostTypeId="1" AcceptedAnswerId="23271" CreationDate="2017-12-19T12:28:00.613" Score="0" ViewCount="222" Body="&lt;p&gt;A website I built frequently throws up the following code instead of the homepage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have followed the Craft CMS install guide to the letter. Here's the output from php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;engine = On&#xA;zend.ze1_compatibility_mode = Off&#xA;short_open_tag = On&#xA;asp_tags = Off&#xA;precision    =  12&#xA;y2k_compliance = On&#xA;output_buffering = Off&#xA;zlib.output_compression = Off&#xA;implicit_flush = Off&#xA;serialize_precision = 100&#xA;safe_mode = Off&#xA;disable_functions =&#xA;realpath_cache_size=256k&#xA;expose_php = Off&#xA;max_execution_time = 600     ; Maximum execution time of each script, in seconds&#xA;max_input_time = 6000   ; Maximum amount of time each script may spend parsing request data&#xA;memory_limit = 768M      ; Maximum amount of memory a script may consume (128MB)&#xA;error_reporting  =  E_ALL &amp;amp; ~E_NOTICE&#xA;display_errors = Off&#xA;display_startup_errors = Off&#xA;log_errors = On&#xA;error_log = /var/sites/t/domain.com/public_html/error_log&#xA;log_errors_max_len = 1024&#xA;report_memleaks = On&#xA;track_errors = Off&#xA;variables_order = &quot;EGPCS&quot;&#xA;register_globals = Off&#xA;register_argc_argv = On&#xA;auto_globals_jit = On&#xA;upload_max_filesize = 100M&#xA;post_max_size = 100M&#xA;magic_quotes_runtime = Off&#xA;magic_quotes_gpc = Off&#xA;magic_quotes_sybase = Off&#xA;auto_prepend_file =&#xA;auto_append_file =&#xA;default_mimetype = &quot;text/html&quot;&#xA;extension_dir = &quot;/usr/newage/lib/php/extensions/no-debug-non-zts-20151012&quot;&#xA;enable_dl = Off&#xA;file_uploads = On&#xA;upload_tmp_dir = /tmp&#xA;allow_url_fopen = On&#xA;allow_url_include = Off&#xA;default_socket_timeout = 60&#xA;date.timezone = Europe/London&#xA;mysql.allow_persistent = On&#xA;mysql.max_persistent = -1&#xA;mysql.max_links = -1&#xA;mysql.default_port =&#xA;mysql.connect_timeout = 60&#xA;mysqli.max_links = -1&#xA;mysqli.default_port = 3306&#xA;mysqli.default_socket =&#xA;mysqli.default_user =&#xA;mysqli.default_pw =&#xA;mysqli.reconnect = On&#xA;[Session]&#xA;session.save_handler = files&#xA;session.save_path = /tmp&#xA;session.use_cookies = 1&#xA;session.name = PHPSESSID&#xA;session.auto_start = 0&#xA;session.cookie_lifetime = 0&#xA;session.cookie_path = /&#xA;session.cookie_domain =&#xA;session.cookie_httponly = &#xA;session.serialize_handler = php&#xA;session.gc_probability = 0&#xA;session.gc_divisor     = 100&#xA;session.gc_maxlifetime = 14400&#xA;session.bug_compat_42 = 1&#xA;session.bug_compat_warn = 1&#xA;session.referer_check =&#xA;session.entropy_length = 0&#xA;session.entropy_file =&#xA;session.cache_limiter = nocache&#xA;session.cache_expire = 180&#xA;session.use_trans_sid = 0&#xA;session.hash_function = 0&#xA;&#xA;#zend_extension=&quot;/usr/newage/lib/php/extensions/no-debug-non-zts-20151012/ioncube_loader_lin_5.6.so&quot;&#xA;#zend_extension_ts=&quot;/usr/newage/lib/php/extensions/no-debug-non-zts-20151012/ioncube_loader_lin_5.6_ts.so&quot;&#xA;#zend_extension=/usr/newage/lib/php/extensions/no-debug-non-zts-20151012/ZendGuardLoader.so&#xA;always_populate_raw_post_data=-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error log set in php.ini is showing up empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via the Craft CPanel, I'm seeing the following recurring errors from the logs tab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JBUxU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JBUxU.png&quot; alt=&quot;CPanel logs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the Server info via the Craft CPanel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NWgl4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NWgl4.png&quot; alt=&quot;CPanel Server info&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My host has told me that ImageMagick isn't available on the PHP version I'm running (7.1). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For iconv extension, the info bubble is reading:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You have a buggy version of iconv installed. (See PHP bug #48147 and&#xA;  iconv bug #13541&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My host has recently fixed load issues on one of their hosting clusters, which I initially thought might be causing the problems, but I'm still getting 503 errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may be unrelated, but the site also jumps from having normal permalinks, like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.domain.com/pretty-page-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.domain.com/pretty-page-url&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To messy permalinks, like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.domain.com/index.php/pretty-page-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.domain.com/index.php/pretty-page-url&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7160" LastEditorUserId="7160" LastEditDate="2017-12-20T09:19:34.680" LastActivityDate="2017-12-20T19:59:00.533" Title="Code shows instead of homepage" Tags="&lt;server&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23240" PostTypeId="1" CreationDate="2017-12-19T12:46:42.917" Score="1" ViewCount="259" Body="&lt;p&gt;The plugin documentation is somewhat lacking, but based on the documentation that exists and looking at the plugin files, I believe a post request should take the following form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set response = craft.rest.request&#xA;.url('http://my.api.endpoint')&#xA;.method('post')&#xA;.headers({&#xA;    key: XXXXXXXXX,&#xA;    secret: XXXXXXXXX&#xA;})&#xA;.query({&#xA;    name: craft.request.getPost('name'),&#xA;    email: craft.request.getPost('email'),&#xA;    telephone: craft.request.getPost('telephone'),&#xA;    message: craft.request.getPost('message')&#xA;})&#xA;.send() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I'm getting a 403 / Access denied response from the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm posting to the template containing this code from a form, hence the use of the &lt;code&gt;craft.request.getPost()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I send the same request using &lt;a href=&quot;https://www.getpostman.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Postman&lt;/a&gt;, it works perfectly. So I know the problem is with the request and not the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; It seems that the headers are not arriving at the API end. If I remove the &lt;code&gt;.method('post')&lt;/code&gt; parameter, the request works, albeit as a GET request with the data appended to the URL as a query string. So it seems that adding the &lt;code&gt;method&lt;/code&gt; parameter is somehow interfering with the sending of the headers.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="6007" LastEditDate="2018-07-19T07:12:23.100" LastActivityDate="2018-07-19T07:12:23.100" Title="How do I send a POST request using the Dukt REST plugin?" Tags="&lt;plugins&gt;&lt;post&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23241" PostTypeId="2" ParentId="23238" CreationDate="2017-12-19T13:18:26.433" Score="2" Body="&lt;p&gt;You can Create a custom array in which you store all valid email addresses and send the id which email to use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;toEmail&quot;&amp;gt;&#xA;  &amp;lt;option value=&quot;1&quot;&amp;gt;1st name&amp;lt;/option&amp;gt;&#xA;  &amp;lt;option value=&quot;2&quot;&amp;gt;2nd name&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in your config file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;$toEmailId = craft()-&amp;gt;request-&amp;gt;getPost('toEmail');&#xA;$yourArray = [&#xA;    1 =&amp;gt; 'firstmail.com',&#xA;    2 =&amp;gt; 'secondmail.com',&#xA;];&#xA;$toEmail = (array_key_exists($toEmailId, $yourArray))? $yourArray[$toEmailId]  : null;&#xA;return array(&#xA;    'toEmail' =&amp;gt; $toEmail,&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-19T15:06:41.417" LastActivityDate="2017-12-19T15:06:41.417" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23243" PostTypeId="2" ParentId="562" CreationDate="2017-12-19T14:11:39.280" Score="1" Body="&lt;p&gt;I'll add my two cents here, since it appears you are removing Wordpress created images (which I also did).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a regex initially to find all these duplicated files (this command works specifically on OSX, but is pretty portable):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;find -E . -regex '.*\-[0-9]{1,4}\x[0-9]{1,4}\.(png|gif|jpg)$'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then wrote a minor change to delete them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;find -E . -regex '.*\-[0-9]{1,4}\x[0-9]{1,4}\.(png|gif|jpg)$' -delete&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figure you can use this same regex pattern to find/replace in a database dump locally, which this answer here points to: &lt;a href=&quot;https://stackoverflow.com/a/9456574/776167&quot;&gt;https://stackoverflow.com/a/9456574/776167&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2017-12-19T14:11:39.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23244" PostTypeId="1" CreationDate="2017-12-19T14:38:01.440" Score="4" ViewCount="493" Body="&lt;p&gt;I'm trying to update my development site on MAMP from Craft 2 to 3. I've installed Composer and tried both upgrade methods (keeping the current directory structure &amp;amp; using the new structure). But with both options, I keep getting shown the install craft screen instead of the update screen. Which is not what I want to do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added my info to the .env file, but the only way I can seem to get the update screen is by using my old db.php file from craft 2. But then that means that I can use the .env file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I then go to complete the update, I tells me that craft can't do a database backup. If I then continue the update to craft 3, when I log in I'm shown the following dependency error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto-generated validation key stored at /Applications/MAMP/htdocs/lorindafontainefarris/craft3/storage/runtime/validation.key has been deprecated. Copy its value to the “securityKey” config setting in config/general.php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see a validation key to copy, but I already have one that was created for the .env file. Its just not being used because I've used the old db.php file from my craft 2 build. I'm assuming that I shouldn't have to use my old db.php file to get the update to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can anyone shed some light on why I keep seeing the Install screen when I go to update my craft2 project?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Richard &lt;/p&gt;&#xA;" OwnerUserId="7760" LastActivityDate="2018-03-20T01:37:37.583" Title="Issues upgrading Craft 2 to 3 - Keep seeing Install Screen not Update screen" Tags="&lt;config&gt;&lt;error-message&gt;&lt;craft3&gt;&lt;updating&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23245" PostTypeId="1" CreationDate="2017-12-19T16:07:45.993" Score="1" ViewCount="493" Body="&lt;p&gt;I have migrated my Craft CMS from Cpanel Apache server to Ngnix server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site is loading perfectly fine, whereas the Control Panel area is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is giving following error message;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Bad Request: The CSRF token could not be verified&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7761" LastEditorUserId="57" LastEditDate="2017-12-19T23:04:27.360" LastActivityDate="2017-12-19T23:04:27.360" Title="Login - The CSRF token could not be verified - Not able to login into admin" Tags="&lt;admin&gt;&lt;migration&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23246" PostTypeId="1" AcceptedAnswerId="23249" CreationDate="2017-12-19T17:53:58.567" Score="1" ViewCount="66" Body="&lt;p&gt;I'm moving an existing site to the new server and spent a couple of days trying to make this work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home page of the site loads just fine. Other pages load too if I add /index.php/ to the url. Otherwise I get 'Not Found' error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have gone through all the suggestions here: &lt;a href=&quot;https://craftcms.com/support/remove-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/remove-index.php&lt;/a&gt;, here: &lt;a href=&quot;https://craftcms.com/support/why-index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/why-index.php&lt;/a&gt;, and here: &lt;a href=&quot;https://craftcms.com/support/enable-path-info&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/enable-path-info&lt;/a&gt;. Everything checks out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My .htaccess in /public_html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;   RewriteEngine On&#xA;&#xA;   # Send would-be 404 requests to Craft&#xA;   RewriteCond %{REQUEST_FILENAME} !-f&#xA;   RewriteCond %{REQUEST_FILENAME} !-d&#xA;   RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;   RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm on a clean install of Apache server. Made sure I have all the required extensions and config matches suggestions on the Craft site.&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-12-19T18:37:03.603" Title="Removing index.php causes Not Found error on secondary pages" Tags="&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23247" PostTypeId="1" CreationDate="2017-12-19T17:53:58.677" Score="1" ViewCount="37" Body="&lt;p&gt;I am not a developer nor do I have a technical background, striving to solve a lingering issue with our it/hosting company. This means I unfortunately can't supply code for reference; simply seeking community support if anyone has encountered a similar issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We launched a new site that is configuring on the Namespro server but not connecting to the Craft Pro CMS DB. It seems to be a port or permissions error but our hosting company hasn't been able to resolve the issue for a couple of months now. The site has been live and encountered zero issues launching on our developer's digital ocean droplet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts??? Don't want to waste anyone's time but hopeful someone has encountered this issue with Namespro before. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="7763" LastActivityDate="2017-12-19T18:55:36.447" Title="DB not connecting on Namespro linux server" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23248" PostTypeId="1" AcceptedAnswerId="23258" CreationDate="2017-12-19T18:12:22.127" Score="0" ViewCount="23" Body="&lt;p&gt;So I've got a completely clean install of Craft 3: RC 2. I've installed Redactor, and nothing else. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the templates/index.twig file; this is all I have: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set test = ['one', 'two', 'three'] %}&#xA;&#xA;{% for t in test %}&#xA;  {{ t }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kIIWD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kIIWD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some trial and error, I figured out that content without any html markup will be wrapped with 'pre' tags by default. Is there an option to stop this behaviour? Maybe a general config option I can disable? &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-12-19T23:20:27.723" Title="How to disable loops from automatically wrapping non-marked up content?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;forloop&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23249" PostTypeId="2" ParentId="23246" CreationDate="2017-12-19T18:37:03.603" Score="1" Body="&lt;p&gt;Thanks to @brad-bell - his comment on another post pointed me in the right direction. I thought that I already checked on mode_rewrite but I didn't.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Apache mod_rewrite module wasn't installed, so the  block of Craft's default .htaccess file was being&#xA;  skipped not allowing index.php to be rewritten in the URL.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Enabling mod_rewrite solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2017-12-19T18:37:03.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23250" PostTypeId="1" AcceptedAnswerId="23251" CreationDate="2017-12-19T18:42:49.573" Score="1" ViewCount="1199" Body="&lt;p&gt;I have an Assets field assigned to my homepage. I can assign and upload images the same way I've always done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to templating, I can loop through the images and output the filename. What I can't do anymore is get the URL. What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = entry.featured %}&#xA;&#xA;{% if assets | length %}&#xA;&#xA;    &amp;lt;h3&amp;gt;Some great assets&amp;lt;/h3&amp;gt;&#xA;    {% for asset in assets %}&#xA;        &amp;lt;p&amp;gt;&#xA;          {{ asset.title }}&amp;lt;br /&amp;gt;&#xA;          {{ asset.url }}&#xA;        &amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The url's no longer return anything. I've also tried getUrl('someTransformHandle') too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see anything mentioned in the &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/assets.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 documentation for assets&lt;/a&gt; regarding any deprecations or significant changes. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-11-02T18:47:54.153" Title="Asset URL's return nothing in Craft 3" Tags="&lt;templating&gt;&lt;assets&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23251" PostTypeId="2" ParentId="23250" CreationDate="2017-12-19T18:51:41.183" Score="2" Body="&lt;p&gt;Did you set up your Asset Volumes to have the proper paths/URLs? Do you have &lt;code&gt;Assets in this volume have public URLs&lt;/code&gt; turned on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have a &lt;code&gt;volumes.php&lt;/code&gt; configured to be multi-environment aware? It's not a necessary step, unless you require the now-deprecated &lt;code&gt;environmentVariables&lt;/code&gt; settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/config/#aliases&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/#aliases&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="9" LastEditDate="2018-11-02T18:47:54.153" LastActivityDate="2018-11-02T18:47:54.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23252" PostTypeId="2" ParentId="23247" CreationDate="2017-12-19T18:55:36.447" Score="1" Body="&lt;p&gt;So if it can't connect to the database, then one of the following is not right in the &lt;code&gt;config/db.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;server&lt;/code&gt; - usually it's &lt;code&gt;localhost&lt;/code&gt; but perhaps they provide an external MySQL server?&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;database&lt;/code&gt; - the name of the database&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;user&lt;/code&gt; - the user authorized to access the database&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;password&lt;/code&gt; - the password used to connect to the database&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;FWIW, this type of issue (and also this lack of support) would make me want to keep the site on the Digital Ocean server, and not move it to Namespro.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-19T18:55:36.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23253" PostTypeId="2" ParentId="11545" CreationDate="2017-12-19T20:07:34.007" Score="1" Body="&lt;p&gt;Have you checked if your .htaccess file inside the /es directory gets interpreted? Write some crap in it and check if you get an error 500. If it does not, make sure you have AllowOverride set to All in your apache config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also check if you're really using apache, otherwise you need to configure your Nginx, ... in a different way for the subdir. see here: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="6886" LastEditDate="2017-12-20T08:13:01.787" LastActivityDate="2017-12-20T08:13:01.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23254" PostTypeId="2" ParentId="23100" CreationDate="2017-12-19T20:52:35.373" Score="1" Body="&lt;p&gt;I had sometime to review the documentation in more depth;&#xA;&lt;a href=&quot;https://github.com/craftcms/element-api/tree/v1#transformer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/element-api/tree/v1#transformer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An abbreviated example below. Note, I include all transformers in a &lt;code&gt;/transformers&lt;/code&gt; directory within &lt;code&gt;/config&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;file - craft/config/elementapi.php&lt;/em&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;  return [&#xA;    'endpoints' =&amp;gt; [&#xA;      // Home&#xA;      //&#xA;      'api/home' =&amp;gt; function() {&#xA;        require craft()-&amp;gt;path-&amp;gt;getConfigPath().'transformers/home.php';&#xA;        return [&#xA;          'elementType' =&amp;gt; ElementType::Entry,&#xA;          'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'homepage'&#xA;          ],&#xA;          'first' =&amp;gt; true,&#xA;          'cache' =&amp;gt; 'PT1M',&#xA;          'transformer' =&amp;gt; new homeAPI(),&#xA;        ];&#xA;      },&#xA;&#xA;      // About&#xA;      //&#xA;      'api/about' =&amp;gt; function() {&#xA;        require craft()-&amp;gt;path-&amp;gt;getConfigPath().'transformers/about.php';&#xA;        return [&#xA;          'elementType' =&amp;gt; ElementType::Entry,&#xA;          'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'about'&#xA;          ],&#xA;          'first' =&amp;gt; true,&#xA;          'transformer' =&amp;gt; new aboutAPI(),&#xA;        ];&#xA;      },&#xA;&#xA;      // Remaining Endpoints...&#xA;      // &#xA;    ]&#xA;  ];&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;file - craft/config/transformers/home.php&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;  namespace Craft;&#xA;  require craft()-&amp;gt;path-&amp;gt;getPluginsPath().'elementapi/vendor/autoload.php';&#xA;  use League\Fractal\TransformerAbstract;&#xA;&#xA;  class homeAPI extends TransformerAbstract {&#xA;    public function transform(EntryModel $entry) {&#xA;&#xA;      $bodyBlocks = [];&#xA;      foreach ($entry-&amp;gt;homepageContent as $block) {&#xA;        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;          case 'gallery':&#xA;&#xA;            $bodyBlocks[] = [&#xA;              'gallery' =&amp;gt; [&#xA;                'thumbnails' =&amp;gt; $thumbnails&#xA;              ]&#xA;            ];&#xA;          break;&#xA;&#xA;          // Remaining Fields...&#xA;          //&#xA;        }&#xA;      }&#xA;&#xA;      return [&#xA;        'id' =&amp;gt; (integer) $entry-&amp;gt;id,&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'content' =&amp;gt; $bodyBlocks,&#xA;      ];&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="226" LastActivityDate="2017-12-19T20:52:35.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23255" PostTypeId="2" ParentId="23236" CreationDate="2017-12-19T22:44:38.113" Score="1" Body="&lt;p&gt;Completely untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ !object.id ? (object.locale == &quot;jp&quot; ? &quot;Japanese title&quot; : &quot;English title&quot;) : object.title) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically only run your logic if the entry doesn't have an ID yet (which new entries won't until they are saved).&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-12-21T19:21:38.777" LastActivityDate="2017-12-21T19:21:38.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23256" PostTypeId="2" ParentId="23237" CreationDate="2017-12-19T22:54:25.677" Score="2" Body="&lt;p&gt;The Find and Replace tool only works with &quot;textual&quot; field types (i.e. Plain Text and Rich Text fields).  Table fields store their content JSON encoded in the database so the tool ignores it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-12-20T05:31:07.743" LastActivityDate="2017-12-20T05:31:07.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23257" PostTypeId="2" ParentId="23244" CreationDate="2017-12-19T23:02:51.247" Score="4" Body="&lt;p&gt;If you've seeing any install screen instead of an update screen, that means that Craft can connect to the database server specified in &lt;code&gt;craft/config/db.php&lt;/code&gt; file, but it either can't find the database you've specified or it can't find the &lt;code&gt;craft_info&lt;/code&gt; table.  A common cause of this is the &lt;code&gt;tablePrefix&lt;/code&gt; database config setting changed, for example.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-19T23:02:51.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23258" PostTypeId="2" ParentId="23248" CreationDate="2017-12-19T23:11:49.927" Score="1" Body="&lt;p&gt;Pretty sure that's just your browser's console trying to tidy things up when you inspect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you View Page Source, I'd guess it wouldn't be there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also just tested this with your example code on a fresh Craft 3 install on the latest Chrome and Firefox on Windows and the latest Safari on OSX and was not able to reproduce your picture.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-19T23:11:49.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23259" PostTypeId="2" ParentId="23248" CreationDate="2017-12-19T23:20:27.723" Score="1" Body="&lt;p&gt;Thanks for taking the time to replicate this Brad. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are quite right. This has nothing to do with Craft 3. &lt;strong&gt;Turns out the &lt;a href=&quot;https://github.com/tulios/json-viewer&quot; rel=&quot;nofollow noreferrer&quot;&gt;json-viewer&lt;/a&gt; Chrome extension I have installed was adjusting the markup! Uninstalling it did the trick.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never seen anything do that before. Should I be remove this question from StackExchange?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-12-19T23:20:27.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23260" PostTypeId="1" AcceptedAnswerId="23274" CreationDate="2017-12-20T09:18:34.877" Score="1" ViewCount="372" Body="&lt;p&gt;I've a Commerce store with orders dating back to September and have the following in my config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'purgeInactiveCarts' =&amp;gt; true,&#xA;'purgeInactiveCartsDuration' =&amp;gt; 'P1M',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The docs say that the purging should be triggered by me visiting the Inactive carts area of the Commerce order section, but it isn't. Does anyone know if:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The trigger is time limited, e.g. is only called once a day?&lt;/li&gt;&#xA;&lt;li&gt;There are any known issues with the purging of inactive carts?&lt;/li&gt;&#xA;&lt;li&gt;Anything else I could look at?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="167" LastEditorUserId="57" LastEditDate="2017-12-20T19:26:16.337" LastActivityDate="2017-12-21T07:31:24.420" Title="Purging inactive carts in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23261" PostTypeId="1" CreationDate="2017-12-20T09:52:12.003" Score="1" ViewCount="548" Body="&lt;p&gt;How can I set file size upload limits on a per-Asset Source basis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only see how to set a global &lt;a href=&quot;https://craftcms.com/docs/config-settings#maxUploadFileSize&quot; rel=&quot;nofollow noreferrer&quot;&gt;maxUploadFileSize&lt;/a&gt; in the general config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I must be missing something obvious though, as this is something that was even possible in EE1! :-) It's a common use case to have a lower limit on some upload destinations to keep clients from uploading massive files (e.g. images), and to allow a higher limit on certain upload destinations for general file downloads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, we will have to use a 10mb limit for everything globally (as an example), and the clients can then upload images up to that size (which can happen with high resolution images). This will waste storage space and potentially run into PHP memory issues when resizing high resolution images for the front-end. :-/&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2017-12-25T14:11:48.370" Title="How to set different file size upload limits for different Asset Sources" Tags="&lt;assets&gt;&lt;sources&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23262" PostTypeId="1" CreationDate="2017-12-20T13:12:52.450" Score="1" ViewCount="521" Body="&lt;pre&gt;&lt;code&gt;the var menutype is set to {{ menutype }}&#xA;&#xA;{% for block in menutype.menuGlobal %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to pass the result of {{ menutype }} into the for loop to return a dynamic menu, but the loop doesn't run. Hardcoding the string works, so the loop is fine, just appears not to recognise the variable output in the for statement.&lt;/p&gt;&#xA;" OwnerUserId="7766" LastActivityDate="2018-06-18T23:26:09.043" Title="Use twig Var in for loop" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23264" PostTypeId="2" ParentId="23262" CreationDate="2017-12-20T15:09:11.840" Score="1" Body="&lt;p&gt;Please try the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dynamicMenu = menutype~&quot;.menuGlobal&quot; %}&#xA;&#xA;{% for block in dynamicMenu %}&#xA;.&#xA;.&#xA;.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6249" LastActivityDate="2017-12-20T15:09:11.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23265" PostTypeId="2" ParentId="23261" CreationDate="2017-12-20T15:25:51.067" Score="2" Body="&lt;p&gt;Craft has no settings defined for it. The only setting it has is &lt;strong&gt;maxUploadFileSize&lt;/strong&gt; which you have already mentioned. So the solution of this is using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; Plugin. There is also a &lt;a href=&quot;https://nystudio107.com/blog/creating-optimized-images-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog&lt;/a&gt; from &lt;a href=&quot;https://nystudio107.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;nystudio107&lt;/a&gt; on this. Let Client upload image of any size or dimension, but you could resize them using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="6249" LastEditorUserId="6249" LastEditDate="2017-12-25T14:11:48.370" LastActivityDate="2017-12-25T14:11:48.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23266" PostTypeId="2" ParentId="23261" CreationDate="2017-12-20T16:00:12.867" Score="2" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/updating-plugins.md#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Event&lt;/a&gt; System from Yii/Craft and check for the file size during an upload&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Asset::class,&#xA;    Element::EVENT_BEFORE_SAVE,&#xA;    function(ModelEvent $modelEvent){&#xA;        /** @var Asset $model */&#xA;        $model = $modelEvent-&amp;gt;sender;&#xA;        $tmpPath = $model-&amp;gt;tempFilePath;&#xA;        $fileSize = filesize($tmpPath);&#xA;        if($fileSize &amp;gt; $someVariable){&#xA;            return false;&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can set &lt;code&gt;$someVariable&lt;/code&gt; by a custom field in your volume &lt;code&gt;$volume = Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeById($model-&amp;gt;volumeId);&lt;/code&gt; or by some config variables or in set of globals and so on&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-20T16:00:12.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23267" PostTypeId="1" AcceptedAnswerId="23270" CreationDate="2017-12-20T16:00:24.177" Score="1" ViewCount="73" Body="&lt;p&gt;I'm getting a very strange 404 error on my live site:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\HttpException: template = fonts/BlissBold-webfont.ttf in  /path/to/mydomain/craft/app/controllers/TemplatesController.php:72&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've searched my complete directory and the only reference to BlissBold-webfont.ttf is in a stylesheet.  How on earth is this affecting the TemplatesController?&lt;/p&gt;&#xA;" OwnerUserId="7008" LastActivityDate="2018-03-20T22:38:41.933" Title="TemplatesController error related to webfont!" Tags="&lt;404&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23268" PostTypeId="2" ParentId="23260" CreationDate="2017-12-20T19:26:05.850" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;The trigger is time limited, e.g. is only called once a day?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.  That logic runs every time the order index page is loaded.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;There are any known issues with the purging of inactive carts?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nothing I'm aware of.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;Anything else I could look at?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's the method and SQL query Commerce uses to determine if there are carts to purge.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function getCartsIdsToPurge()&#xA;{&#xA;    $configInterval = craft()-&amp;gt;config-&amp;gt;get('purgeInactiveCartsDuration', 'commerce');&#xA;    $edge = new \DateTime();&#xA;    $interval = new \DateInterval($configInterval);&#xA;    $interval-&amp;gt;invert = 1;&#xA;    $edge-&amp;gt;add($interval);&#xA;&#xA;    return Craft::app()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;select('orders.id')&#xA;        -&amp;gt;from('commerce_orders orders')&#xA;        -&amp;gt;where('isCompleted=:isCompleted AND dateUpdated &amp;lt;= :edge', [':isCompleted' =&amp;gt; 'not 1','edge' =&amp;gt; $edge-&amp;gt;format('Y-m-d H:i:s')])&#xA;        -&amp;gt;queryColumn();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Open up the orders table in the database and find a cart you think should be getting purged, but isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check if it has a 0/null value in the &lt;code&gt;isCompleted&lt;/code&gt; column and a &lt;code&gt;dateUpdated&lt;/code&gt; column that is (in your case) greater than 1 month old.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-20T19:26:05.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23269" PostTypeId="2" ParentId="23262" CreationDate="2017-12-20T19:33:47.887" Score="0" Body="&lt;p&gt;I believe you're looking for Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;attribute&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in attribute(menutype, menuGlobal) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It allows you to get dynamic attributes off of a variable.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-20T19:33:47.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23270" PostTypeId="2" ParentId="23267" CreationDate="2017-12-20T19:38:27.147" Score="1" Body="&lt;p&gt;TemplateController is what all template requests in Craft get routed through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That error just means that someone/something is trying to load a resource (in your case &lt;code&gt;yoursite.com/fonts/BlissBold-webfont.ttf&lt;/code&gt;) and that doesn't exist on your file system and Craft has no idea how to resolve that request, so it issues a &lt;code&gt;404 Not Found&lt;/code&gt; in response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's more of an informational thing than anything and not really an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the upcoming Craft 3, 404's get logged in separate files so as not to clutter up the main logs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-20T19:38:27.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23271" PostTypeId="2" ParentId="23239" CreationDate="2017-12-20T19:59:00.533" Score="3" Body="&lt;p&gt;If your website is showing the &lt;em&gt;text&lt;/em&gt; of your &lt;code&gt;index.php&lt;/code&gt; instead of the actual website code, something is misconfigured with your server setup. Anything &lt;code&gt;.php&lt;/code&gt; should be passed along to &lt;code&gt;php-fpm&lt;/code&gt; or whatever CGI handler you're using.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-20T19:59:00.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23272" PostTypeId="1" CreationDate="2017-12-20T20:16:34.773" Score="2" ViewCount="547" Body="&lt;p&gt;If you have a &lt;code&gt;checkbox&lt;/code&gt;  field on an entry type, how do you display all the selected values for an entry in a template with twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this for page permissions via user groups. We have a plugin that adds a new field type &quot;user groups&quot;. It lists all groups (which we have many) on the admin page of each entry. We want to check which groups will have access and then limit the page to users in that group only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: not using a standard checkbox field but a new field (via plugin). &lt;a href=&quot;https://github.com/quebecstudio/usergroupfield&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quebecstudio/usergroupfield&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7769" LastEditorUserId="7769" LastEditDate="2017-12-20T20:57:04.023" LastActivityDate="2017-12-21T08:54:24.827" Title="Output Checkbox Data on Template" Tags="&lt;templating&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23273" PostTypeId="2" ParentId="23272" CreationDate="2017-12-20T20:28:05.697" Score="1" Body="&lt;p&gt;You get all available options with the &lt;code&gt;options&lt;/code&gt; attribute and you can check if it is selected in the current entry with &lt;code&gt;option.selected&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for opt in entry.checkboxFieldHandle.options %}&#xA;    &amp;lt;label&amp;gt;&#xA;        &amp;lt;input name=&quot;fields[checkboxFieldHandle][]&quot; type=&quot;checkbox&quot; value=&quot;{{ opt.value }}&quot;&amp;gt;&#xA;        {{ opt.label }}&#xA;        {% if opt.selected %}&#xA;            I'm selected&#xA;        {% endif %}&#xA;    &amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But to be honest I don't really understand your second part&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;As for your field, you can display all the selected values with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selectedUserGroupIds = entry.userGroupFieldHandle %}&#xA;{% for userGroupId in selectedUserGroupIds %}&#xA;    {% set usergroup = craft.userGroups.getGroupById(userGroupId) %}&#xA;    {{ usergroup.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-21T08:54:24.827" LastActivityDate="2017-12-21T08:54:24.827" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23274" PostTypeId="2" ParentId="23260" CreationDate="2017-12-21T07:31:24.420" Score="1" Body="&lt;p&gt;The mistake was not reading the docs properly and putting the config values in general.php. Instead, I needed to create a commerce.php config file and put the values in that. As soon as I did, the orders were purged.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2017-12-21T07:31:24.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23275" PostTypeId="1" AcceptedAnswerId="23284" CreationDate="2017-12-21T10:17:32.963" Score="1" ViewCount="355" Body="&lt;p&gt;I want to display the variant title only on line items which have more than one variant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QFeM4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QFeM4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Image you can see the bold Product title and undeneath there is the variant title (Format A2). As you can see the last line item has only one variant so it's unnecessary to show the title there twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I write the conditional to show the title only on products with more than one variant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Product page I just wrote it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.variants | length &amp;gt; '1' %}&#xA;  {% for purchasable in product.variants %}&#xA;     {{ purchasable.title }}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in the cart it's a line item and not a product so this code doesn't work. How do I have to apply this to a line item?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2017-12-22T00:24:08.880" Title="Display variant title on cart page only for items with more than one variant" Tags="&lt;plugin-craftcommerce&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23277" PostTypeId="1" AcceptedAnswerId="23627" CreationDate="2017-12-21T16:00:43.727" Score="1" ViewCount="380" Body="&lt;p&gt;I need to be able to get a count (in the frontend) of the number of submissions that have a field with a specific value. I don't need the submitted data of the submissions, just the count of submissions whose data matches a specified value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code returns the total number of submissions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submissionCount = craft.freeform.submissions({&#xA;    form: 'myAmazingForm'&#xA;}).count %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried using the native Craft search parameter, but it returns zero:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submissionCount = craft.freeform.submissions({&#xA;    form: 'myAmazingForm'&#xA;}).search('fieldWithValue:123').count %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And yes, there &lt;em&gt;are&lt;/em&gt; submissions that would match that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-10-21T07:29:59.020" Title="Search/Filter Freeform submissions by field value" Tags="&lt;search&gt;&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23278" PostTypeId="1" AcceptedAnswerId="23311" CreationDate="2017-12-21T17:14:44.077" Score="1" ViewCount="78" Body="&lt;p&gt;We are still trying to make a custom mail plugin. We have one problem left. When someone makes a draft, and later publishes it, only the onSaveEntry fires but without NewEntry. So we were trying to use the onPublishDraft instead. But we can't get it to fire. I'm using Craft CMS 2.6.3 Pro&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is what we tried so far:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('entryRevisions.onPublishDraft', function(Event $event){}&#xA;craft()-&amp;gt;on('entryRevisions.publishDraft', function(Event $event){}&#xA;craft()-&amp;gt;on('publishDraft', function(Event $event){}&#xA;craft()-&amp;gt;entryRevisions-&amp;gt;onPublishDraft = function(Event $event) {}&#xA;craft()-&amp;gt;entryRevisions-&amp;gt;publishDraft = function(Event $event) {}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is the regular on save entry we use, maybe there is another way to catch a draft that is being published;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event){ &#xA;if ($event-&amp;gt;params['isNewEntry'] &amp;amp;&amp;amp; $entry-&amp;gt;status == 'live'){    }});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope you guys know how to do that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did do a test with the exact code Brad gave, but it still didn't do anything... This is how my test starts;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init(){&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('entryRevisions.onPublishDraft', function(Event $event) {&#xA;        Craft::log(&quot;draft published&quot;, LogLevel::Info, true);&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        Craft::log(&quot;Entry saved&quot;, LogLevel::Info, true);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only the second one gets logged when I change the status of the post, the first never.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-none prettyprint-override&quot;&gt;&lt;code&gt;*****************************************&#xA;2017/12/21 21:29:54 [info] [application] [Forced] Entry saved&#xA;*****************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7484" LastEditorUserId="3951" LastEditDate="2017-12-27T17:51:29.310" LastActivityDate="2017-12-27T23:14:04.893" Title="Event onPublishDraft not firing" Tags="&lt;craft-pro&gt;&lt;craft.entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23279" PostTypeId="2" ParentId="23277" CreationDate="2017-12-21T17:36:26.733" Score="1" Body="&lt;p&gt;This might not work, but you can try it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set submissionCount = craft.freeform.submissions({&#xA;    form: 'myAmazingForm',&#xA;    fieldWithValue: '123',&#xA;}).count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2017-12-21T17:36:26.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23280" PostTypeId="2" ParentId="23277" CreationDate="2017-12-21T17:37:10.537" Score="1" Body="&lt;p&gt;Unfortunately this currently isn't possible. However, we've added it to the feature requests list and will revisit adding this in the not-too-distant future. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2017-12-21T17:37:10.537" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23281" PostTypeId="1" AcceptedAnswerId="23283" CreationDate="2017-12-21T18:03:47.887" Score="1" ViewCount="358" Body="&lt;p&gt;I'm not sure what happened, but the &quot;Download PDF&quot; button that is on the orders in the CMS is missing. I thought maybe the order PDF template file or path was missing but both of those are there. Is there a true/false statement somewhere I might have erased? I can't find anything on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="57" LastEditDate="2017-12-21T19:33:12.727" LastActivityDate="2017-12-21T19:36:39.880" Title="Missing Download PDF Button in Orders for Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23282" PostTypeId="2" ParentId="23278" CreationDate="2017-12-21T19:32:30.907" Score="0" Body="&lt;p&gt;Just did a test in a simple plugin with this in its &lt;code&gt;init()&lt;/code&gt; method, then published a draft and it worked, so guessing it's some other logic in your plugin that is failing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entryRevisions.onPublishDraft', function(Event $event) {&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-21T19:32:30.907" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23283" PostTypeId="2" ParentId="23281" CreationDate="2017-12-21T19:36:39.880" Score="0" Body="&lt;p&gt;The Download PDF button will show if the &lt;code&gt;OrderModel&lt;/code&gt; that gets passed to the template's &lt;code&gt;getPdfUrl()&lt;/code&gt; method returns a URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the logic it uses in &lt;code&gt;commerce/models/Commerce_OrderModel.php&lt;/code&gt;, &lt;code&gt;function getPdfUrl()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets the &lt;code&gt;orderPdfPath&lt;/code&gt; Commerce setting, then checks if that template exists on the front-end templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you've got something messed up with the path to that template somewhere.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-21T19:36:39.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23284" PostTypeId="2" ParentId="23275" CreationDate="2017-12-22T00:24:08.880" Score="2" Body="&lt;p&gt;&lt;strong&gt;If you are using separate product types - some with variants, some without:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then what you're looking for is basically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for lineItem in cart.lineItems %}&#xA;    {% if lineItem.purchasable.product.type.hasVariants %}&#xA;       {# the purchasable is the chosen variant - display the product AND variant title #}&#xA;       {{ lineItem.purchasable.product.title }} &amp;lt;br&amp;gt;&#xA;       {{ lineItem.purchasable.title }}&#xA;    {% else %} &#xA;        {# no variants, just use the title from the product #}&#xA;        {{ lineItem.purchasable.product.title }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you're using just one product type, some entries of which have one variant and others more:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you need to get back from the &lt;code&gt;lineItem&lt;/code&gt; to the product so that would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if lineItem.purchasable.product.variants|length &amp;gt; 1 %}&#xA;    {{ lineItem.purchasable.title }}&#xA;{% else %}&#xA;    {{ lineItem.purchasble.product.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&#xA;(I've not tested these directly, just coded here in the browser but that should be pretty &#xA;close!)&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2017-12-22T00:24:08.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23285" PostTypeId="2" ParentId="23219" CreationDate="2017-12-22T10:40:48.707" Score="2" Body="&lt;p&gt;I ended up fixing this with a variable and querying it myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I needed the related entry if it was linked and a &lt;code&gt;false&lt;/code&gt; if it wasn't.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$neoElement = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;select('craft_relations.sourceId')&#xA;    -&amp;gt;from('relations')&#xA;    -&amp;gt;where('craft_relations.fieldId = 110')&#xA;    -&amp;gt;andWhere('craft_relations.targetId = :entryId', ['entryId' =&amp;gt; $entry-&amp;gt;id])&#xA;    -&amp;gt;queryColumn();&#xA;&#xA;if(!empty($neoElement)) {&#xA;    $parents = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_neoblocks.ownerId')&#xA;        -&amp;gt;from('neoblocks')&#xA;        -&amp;gt;where('craft_neoblocks.id = :neoElementId', ['neoElementId' =&amp;gt; $neoElement[0]])&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    if(!empty($parents)) {&#xA;        $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($parents[0]);&#xA;        return $parent;&#xA;    }&#xA;}&#xA;&#xA;return false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2017-12-22T10:40:48.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23286" PostTypeId="2" ParentId="21919" CreationDate="2017-12-22T11:06:00.443" Score="4" Body="&lt;p&gt;You can receive this error if you have uploaded a Craft website and your &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; and &lt;code&gt;craft/storage/runtime/complied_templates&lt;/code&gt; folders are not writable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We made these folders writable and resolved the error. &lt;/p&gt;&#xA;" OwnerUserId="4905" LastEditorUserId="3951" LastEditDate="2017-12-28T16:18:16.820" LastActivityDate="2017-12-28T16:18:16.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23287" PostTypeId="1" AcceptedAnswerId="23288" CreationDate="2017-12-22T13:00:07.263" Score="1" ViewCount="97" Body="&lt;p&gt;I'm a complete newby on Craft CMS and twig templating so please bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a users base which I want to filter by category (a custom field)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be my only input search element:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;select name=&quot;professionalita&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot; disabled selected&amp;gt;Professionalità&amp;lt;/option&amp;gt;&#xA;    {% for category in craft.categories.group('professionalita') %}&#xA;    &amp;lt;option value=&quot;{{category.url}}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I tried to build on results.html page.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# Get the search data #}&#xA;{% set profParam = craft.request.getParam('professionalita') %}&#xA;&#xA;{% extends &quot;_inc/layout&quot; %}&#xA;&#xA;{% block main %}&#xA;    {# Find and list matching entries #}&#xA;    {% set members = craft.users.group.('members').relatedTo(profParam) %}&#xA;&#xA;    {% if members|length %}&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for member in members %}&#xA;                &amp;lt;li&amp;gt;{{ member.firstName }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% else %}&#xA;        No members found.&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get no results even if there are actually correspondencies between the users and the category name being searched for.&lt;/p&gt;&#xA;" OwnerUserId="7667" LastEditorUserId="3951" LastEditDate="2017-12-27T17:51:26.257" LastActivityDate="2017-12-27T17:51:26.257" Title="One select search for Users in user.group" Tags="&lt;templating&gt;&lt;categories&gt;&lt;users&gt;&lt;relations&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23288" PostTypeId="2" ParentId="23287" CreationDate="2017-12-22T13:51:55.000" Score="1" Body="&lt;p&gt;I suggest you to read the docs about &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt;. You can search for relations by the following parameter&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In its simplest form, you can pass in one of these things to it:&lt;/p&gt;&#xA;&lt;p&gt;An AssetFileModel, CategoryModel, EntryModel, UserModel, or TagModel object&lt;/p&gt;&#xA;&lt;p&gt;An element’s ID&lt;/p&gt;&#xA;&lt;p&gt;An array of element objects and/or IDs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What you pass is a string or to be more specific a url&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&amp;quot;{{category.url}}&amp;quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What you have to do is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;option value=&amp;quot;{{category.id}}&amp;quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In order to find users related to a category id.&lt;/p&gt;&#xA;&lt;p&gt;However I strongly suggest you to build your search with PHP if you are going to include multiple parameters (more categories/search terms/complex and+or bindings) it is going to be a mess with twig&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2017-12-22T13:51:55.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23289" PostTypeId="1" CreationDate="2017-12-22T23:55:31.903" Score="1" ViewCount="1292" Body="&lt;p&gt;When I upload an image to assets, it just shows the progress bar loading, but it won’t upload my image into assets. Originally, this had worked before, but for some reason it suddenly just stopped working. I’m using Media Temple for my production. I checked my error log and it says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;Got error 'PHP message: PHP Warning:  File upload error - unable to&#xA;  create a temporary file in Unknown on line 0&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I’ve checked my files permissions and changed &lt;code&gt;/tmp&lt;/code&gt; to 777 and I’ve also changed my assets folder to 777 too. I even checked my disk space for the &lt;code&gt;/tmp&lt;/code&gt; folder and it still have 25GB left so it’s not out of disk space.&lt;/p&gt;&#xA;" OwnerUserId="7778" LastEditorUserId="3951" LastEditDate="2017-12-27T17:51:14.403" LastActivityDate="2019-07-17T15:35:16.553" Title="Can't upload assets in Craft 3 CMS" Tags="&lt;assets&gt;" AnswerCount="3" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23290" PostTypeId="1" AcceptedAnswerId="23291" CreationDate="2017-12-24T00:39:58.567" Score="5" ViewCount="4993" Body="&lt;p&gt;I just tried to export the DB on the Database Backup page. Unfortunately, I got an error message saying &lt;strong&gt;&quot;There was a problem backing up your database. Please check the Craft logs.&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I checked the logs, and found this...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not create backup: The shell command &quot;mysqldump --defaults-extra-file=/mysite/storage/runtime/temp/my.cnf... failed with exit code 127: sh: mysqldump: command not found...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(There's more to that error message, but I'm hoping that all the relevant parts are included here.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am I missing?&lt;/strong&gt; It seems like I still need to install something else, is that correct?&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-05-26T16:55:23.980" LastActivityDate="2018-05-26T16:55:23.980" Title="Craft 3: Can't backup database (&quot;mysqldump: command not found&quot;)" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23291" PostTypeId="2" ParentId="23290" CreationDate="2017-12-24T16:42:37.143" Score="8" Body="&lt;p&gt;Craft 3 did away with the PHP-based database backup solution that Craft 2 utilized (for many reasons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now it requires that the &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;mysqldump&lt;/code&gt;&lt;/a&gt; executable (if you're using MySQL) or &lt;a href=&quot;https://www.postgresql.org/docs/9.3/static/app-pgdump.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;pg_dump&lt;/code&gt;&lt;/a&gt; executable (if you're using PostgreSQL) is available to PHP in order to do backups.  This is usually just a matter of including the path to that executing in your PATH environment variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L111&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;backupCommand&lt;/code&gt;&lt;/a&gt; config setting that you can use to override Craft's default backup implementation if you have some other backup solution you'd like to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L553&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;restoreCommand&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related issue here: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1369&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1369&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2017-12-24T17:06:02.073" LastActivityDate="2017-12-24T17:06:02.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23293" PostTypeId="1" CreationDate="2017-12-26T13:32:48.373" Score="2" ViewCount="1000" Body="&lt;p&gt;Can you let me know what the process would be? I heard there was a no track tag we can put in the site header so the sites won't show up in search engines.&lt;/p&gt;&#xA;" OwnerUserId="7781" LastActivityDate="2017-12-26T17:22:24.300" Title="Need no search engine tracking option in Craft websites" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23294" PostTypeId="2" ParentId="23293" CreationDate="2017-12-26T13:41:10.693" Score="1" Body="&lt;p&gt;Crafts does absolutely nothing in your frontend by itself unless you use certain twig functions (that mostly render css/js files). So it's totally up to you what seo options you provide. It's note like other cms that render your headers or footers or create  non editable links thus you have the freedom to define everything by yourself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you don't want to appear in search engines just don't include seo optimisations. If your question is about how to do that you are in the wrong board here because that is off topic since it's not related to craft &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-26T13:49:10.693" LastActivityDate="2017-12-26T13:49:10.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23295" PostTypeId="1" CreationDate="2017-12-26T15:16:55.333" Score="1" ViewCount="291" Body="&lt;p&gt;If I set &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'suppressTemplateErrors' =&amp;gt; true &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This (templates/_pages/_entry.twig): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;'_pages/'~entry.slug|default,&#xA;&quot;_pages/&quot; ~ entry.type|default,&#xA;&quot;_pages/default&quot;&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gets me a blank page, since apparently it is seen as a mistake, and the execution of the twig template is stopped. However, when suppressTemplateErrors is set to false, there is no problem. &#xA;the code is supposed to search for a template with the name of an entry slug, if that doesn't exist look for one with the name of the type, and if that doesn't exist, load the default template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Logs (web.log):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2017-12-26 15:54:02 [::1][1][-][error][craft\web\twig\TemplateLoaderException] craft\web\twig\TemplateLoaderException: Coud not find template “_pages/about” . in /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/twig/TemplateLoader.php:125&#xA;Stack trace:&#xA;#0 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/twig/TemplateLoader.php(76): craft\web\twig\TemplateLoader-&amp;gt;_resolveTemplate('_pages/about')&#xA;#1 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Environment.php(270): craft\web\twig\TemplateLoader-&amp;gt;getCacheKey('_pages/about')&#xA;#2 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Environment.php(350): Twig_Environment-&amp;gt;getTemplateClass('_pages/about')&#xA;#3 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/twig/Environment.php(30): Twig_Environment-&amp;gt;loadTemplate('_pages/about', NULL)&#xA;#4 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Environment.php(478): craft\web\twig\Environment-&amp;gt;loadTemplate('_pages/about')&#xA;#5 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Template.php(318): Twig_Environment-&amp;gt;resolveTemplate(Array)&#xA;#6 /Users/username/Code/mywebsite/storage/runtime/compiled_templates/74/74f99748b2c43647e59f94561c58e670362eb7351e4ca94b81c3fcb1a4265158.php(10): Twig_Template-&amp;gt;loadTemplate(Array, '_pages/_entry', 2)&#xA;#7 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Template.php(99): __TwigTemplate_49b39b86eb9a0dbc650dce81e0d17fe48175bd75d54e21236890fb8d13a20492-&amp;gt;doGetParent(Array)&#xA;#8 /Users/username/Code/mywebsite/storage/runtime/compiled_templates/74/74f99748b2c43647e59f94561c58e670362eb7351e4ca94b81c3fcb1a4265158.php(16): Twig_Template-&amp;gt;getParent(Array)&#xA;#9 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Template.php(389): __TwigTemplate_49b39b86eb9a0dbc650dce81e0d17fe48175bd75d54e21236890fb8d13a20492-&amp;gt;doDisplay(Array, Array)&#xA;#10 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/twig/Template.php(51): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#11 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Template.php(366): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#12 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/twig/Template.php(32): Twig_Template-&amp;gt;display(Array, Array)&#xA;#13 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Template.php(374): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#14 /Users/username/Code/mywebsite/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#15 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/View.php(292): Twig_Environment-&amp;gt;render('_pages/_entry', Array)&#xA;#16 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/View.php(340): craft\web\View-&amp;gt;renderTemplate('_pages/_entry', Array)&#xA;#17 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/Controller.php(121): craft\web\View-&amp;gt;renderPageTemplate('_pages/_entry', Array)&#xA;#18 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/controllers/TemplatesController.php(79): craft\web\Controller-&amp;gt;renderTemplate('_pages/_entry', Array)&#xA;#19 [internal function]: craft\controllers\TemplatesController-&amp;gt;actionRender('_pages/_entry', Array)&#xA;#20 /Users/username/Code/mywebsite/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#21 /Users/username/Code/mywebsite/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#22 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/Controller.php(80): yii\base\Controller-&amp;gt;runAction('render', Array)&#xA;#23 /Users/username/Code/mywebsite/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('render', Array)&#xA;#24 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/Application.php(242): yii\base\Module-&amp;gt;runAction('templates/rende...', Array)&#xA;#25 /Users/username/Code/mywebsite/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&amp;gt;runAction('templates/rende...', Array)&#xA;#26 /Users/username/Code/mywebsite/vendor/craftcms/cms/src/web/Application.php(207): yii\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#27 /Users/username/Code/mywebsite/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#28 /Users/username/Code/mywebsite/www/index.php(35): yii\base\Application-&amp;gt;run()&#xA;#29 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7782" LastEditorUserId="7782" LastEditDate="2017-12-26T16:45:16.893" LastActivityDate="2017-12-26T16:56:09.163" Title="template extend not working if suppressTemplateError is set to true" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23296" PostTypeId="2" ParentId="23295" CreationDate="2017-12-26T16:56:09.163" Score="1" Body="&lt;p&gt;So just as an information architecture kind of thing, you might want to have just one &lt;code&gt;_layout.twig&lt;/code&gt; that &lt;em&gt;all&lt;/em&gt; of your entry types &lt;code&gt;extends&lt;/code&gt;, and just include various &lt;code&gt;{% block %}&lt;/code&gt; tags in the right places for the templates to fill in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way, if you make major changes to the abstract pages (say, adding meta info, or changing JavaScript that's loaded site-wide, etc.) you don't have to make those changes in a number of places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also leverage &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;include&lt;/a&gt; and &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/embed.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;embed&lt;/a&gt; and you'll likely end up with a more manageable template hierarchy in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, the problem you're having is that it's hitting this code block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;```&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function loadTemplate($name, $index = null)&#xA;{&#xA;    try&#xA;    {&#xA;        return parent::loadTemplate($name, $index);&#xA;    }&#xA;    catch (\Twig_Error $e)&#xA;    {&#xA;        if (craft()-&amp;gt;config-&amp;gt;get('suppressTemplateErrors'))&#xA;        {&#xA;            // Just log it and return an empty template&#xA;            craft()-&amp;gt;errorHandler-&amp;gt;logException($e);&#xA;&#xA;            $twig = craft()-&amp;gt;templates-&amp;gt;getTwig('Twig_Loader_String');&#xA;            return $twig-&amp;gt;loadTemplate('');&#xA;        }&#xA;        else&#xA;        {&#xA;            throw $e;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;```&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So while it normally would throw an exception, which Twig handles and then moves on to try the next template in the array you've passed it, with &lt;code&gt;suppressTemplateErrors =&amp;gt; true&lt;/code&gt; it just immediately returns an empty template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can file a bug report if you like, because this does appear to short-circuit the normal Twig fallback mechanism for template rendering, but I'd honestly re-examine how you're doing things. Depending on suppressing template errors for the site to work feels wrong.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-26T16:56:09.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23297" PostTypeId="2" ParentId="23293" CreationDate="2017-12-26T17:16:20.997" Score="6" Body="&lt;p&gt;If you're used to another CMS such as WordPress, you're probably used to using a &lt;code&gt;Discourage search engines from indexing this site&lt;/code&gt; option. As &lt;a href=&quot;https://craftcms.stackexchange.com/a/23294/1016&quot;&gt;Robin's answer&lt;/a&gt; mentions, the training wheels are off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that doesn't mean you can't replicate WP's functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you tick that box, there's a few things that happen behind the scenes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If &lt;code&gt;robots.txt&lt;/code&gt; file is requested, WP auto generates a version that tells google to skip indexing the site.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;code&gt;&amp;lt;meta name=&quot;robots&quot; content=&quot;noindex,follow&quot;&amp;gt;&lt;/code&gt; is added to each page.&lt;/li&gt;&#xA;&lt;li&gt;XML-RPC pinging is disabled (so WP won't &quot;ping&quot; services like ping-o-matic when you update pages on the site).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't automatically ping any services so you don't have to worry about the last option but the first 2 are pretty straightforward to setup.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Global Lightswitch / templates&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Create a &lt;a href=&quot;https://craftcms.com/docs/globals&quot; rel=&quot;noreferrer&quot;&gt;Global&lt;/a&gt; called &lt;code&gt;siteSettings&lt;/code&gt; and add a Lightswitch with a field handle of &lt;code&gt;disableIndexing&lt;/code&gt; so you can reference throughout the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of your templates, it can be as simple as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if siteSettings.disableIndexing %}&#xA;    &amp;lt;meta name=&quot;robots&quot; content=&quot;noindex,follow&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;robots.txt&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The second piece is some Craft magic. If you don't already have a &lt;code&gt;robots.txt&lt;/code&gt; file, create one inside Craft's &lt;code&gt;templates&lt;/code&gt; folder or remove it/move it if it exists in your public root folder.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is smart enough to parse your &lt;code&gt;robots.txt&lt;/code&gt; file as Twig code and even output the proper mime type. This allows you to dynamically change it as it is requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When &lt;code&gt;robots.txt&lt;/code&gt; is requested, instead of serving the file directly as your web server would, Craft will instead take the request and because there is a file that matches &lt;code&gt;robots.txt&lt;/code&gt; inside templates folder, it'll use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put this in your &lt;code&gt;robots.txt&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;User-agent: *&#xA;Disallow: {% if siteSettings.disableIndexing %}/{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We're basically telling search engines not to index anything when the Lightswitch is ticked. That's a pretty basic robots.txt file but it gets the job done for this example. There's a ton more &lt;a href=&quot;https://moz.com/learn/seo/robotstxt&quot; rel=&quot;noreferrer&quot;&gt;options&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Wrap up&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;That's really it.  The only thing to remember is to UNTICK the box when your site goes live or when you want search engines to revisit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of people in WP land get burned because they forget to turn it back on so this isn't really a great thing to do in the first place but this answer goes into some basic Craft concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want more control, instead of a Global lightswitch, you could setup one up on a per entry basis much like Yoast does. This is pretty common for landing pages used for PPC so they don't get indexed to begin with. Just remember not to include them in your sitemap as well.  Also consider the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;noreferrer&quot;&gt;SEOMatic&lt;/a&gt; plugin which can do all of this and more.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2017-12-26T17:22:24.300" LastActivityDate="2017-12-26T17:22:24.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23298" PostTypeId="1" AcceptedAnswerId="23299" CreationDate="2017-12-27T00:43:04.120" Score="1" ViewCount="401" Body="&lt;p&gt;just getting start with Craft, and I can't figure out why my images won't output. Any time I try to output even the path to the url of my image, I get an &lt;code&gt;internal error: Craft\AssetFileModel and its behaviors do not have a method or closure named [...]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can successfully do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.pageImage | length %}&#xA;    {% for pageImage in entry.pageImage %}&#xA;        {{ pageImage }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which just outputs the title of the image. But I want to display the image. I was expecting to be able to be able to use &lt;code&gt;{{pageImage.getUrl()}}&lt;/code&gt; or &lt;code&gt;{{pageImage.url}}&lt;/code&gt; or &lt;code&gt;{{pageImage.fileName}}&lt;/code&gt; but these will throw the aforementioned error. How do I output an image?&lt;/p&gt;&#xA;" OwnerUserId="7785" LastEditorUserId="3951" LastEditDate="2017-12-27T17:51:19.723" LastActivityDate="2017-12-27T17:51:19.723" Title="Can't output an image" Tags="&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23299" PostTypeId="2" ParentId="23298" CreationDate="2017-12-27T01:29:56.163" Score="2" Body="&lt;p&gt;You would usually display the image with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for pageImage in entry.pageImage %}&#xA;    &amp;lt;img src=&quot;{{ pageImage.getUrl() }}&quot;&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this only works if you enabled the public url option for the asset source. There is a light switch if those assets should have urls or not in your cp&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also has a &lt;code&gt;getImg()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns an &amp;lt;img&amp;gt; tag based on this asset.&#xA; *&#xA; * @return \Twig_Markup|null&#xA; */&#xA;public function getImg()&#xA;{&#xA;    if ($this-&amp;gt;kind == 'image' &amp;amp;&amp;amp; $this-&amp;gt;getHasUrls())&#xA;    {&#xA;        $img = '&amp;lt;img src=&quot;'.$this-&amp;gt;getUrl().'&quot; width=&quot;'.$this-&amp;gt;getWidth().'&quot; height=&quot;'.$this-&amp;gt;getHeight().'&quot; alt=&quot;'.HtmlHelper::encode($this-&amp;gt;title).'&quot; /&amp;gt;';&#xA;        return TemplateHelper::getRaw($img);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-27T01:29:56.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23300" PostTypeId="2" ParentId="22678" CreationDate="2017-12-27T10:57:48.833" Score="2" Body="&lt;p&gt;Add the mailing list &quot;field&quot; in the form you want by dragging it from the left sidebar to the form. &#xA;Click on the field when it's added. &#xA;In the right sidebar, change the dropdown field &quot;Mailing Lists&quot; to the list you want.  &lt;/p&gt;&#xA;" OwnerUserId="7782" LastActivityDate="2017-12-27T10:57:48.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23301" PostTypeId="1" CreationDate="2017-12-27T11:11:54.517" Score="3" ViewCount="46" Body="&lt;p&gt;I am wondering if there is a way to re-use pre defined field types and image crops over various Craft projects. I currently in the process of e.g. manually defining 20 different image crops I already defined for another project, which is a tedious task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not really familiar with SQL and database structures, so I am not sure if there is a way to simply copy fields from one projects database to another or if this would corrupt my database? &lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2017-12-27T11:38:21.023" Title="Workflow for re-using data structures and setups across projects?" Tags="&lt;database&gt;&lt;mysql&gt;&lt;workflow&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23302" PostTypeId="2" ParentId="23301" CreationDate="2017-12-27T11:30:34.000" Score="3" Body="&lt;p&gt;You have several options to solve this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Import fields via plugin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a plugin that handles all these function in it's installation callback so you would install the plugin and have all the things you need. But this requires basic knowledge in plugin development. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Advantage&lt;/em&gt; When Pixel and Tonic make any changes in their install process it won't infect your code and if you are going to make multiple plugins you'll be able to import the required fields whenever you use them. That's the way we handle it and when someone installs my Form Builder Plugin it includes a form relation field to each entries with type &lt;code&gt;pages&lt;/code&gt; and some crop rules automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disadvantage&lt;/em&gt; You need to learn php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Import via SQL&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Install a new Craft instance, insert all your default values you would like to have for a new project and export the entire database. When you start a new project you would skip the installation process but import your included database and the files of your &quot;default&quot; instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Advantage&lt;/em&gt; This is an easy and really fast way to achieve your goal. It does not require any knowledge or skills&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disadvantage&lt;/em&gt; You should pay attention when Pixel and Tonic makes core changes in their default structure or things could eventually break in the future (even if it is really unlikely because they are really careful with those things)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Search for a plugin from someone else that handles it&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is a &lt;a href=&quot;https://github.com/verbb/feed-me&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt; Plugin maybe this does what you want but I never really used plugins that are not created in my company so I can't tell something about it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-27T11:38:21.023" LastActivityDate="2017-12-27T11:38:21.023" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23303" PostTypeId="2" ParentId="9400" CreationDate="2017-12-27T15:24:21.587" Score="1" Body="&lt;p&gt;I can recommend the &lt;a href=&quot;https://www.kualo.co.uk/webhosting/craft-cms-hosting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS hosting by Kualo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;LiteSpeed&lt;/li&gt;&#xA;&lt;li&gt;Redis&lt;/li&gt;&#xA;&lt;li&gt;Latest PHP versions&lt;/li&gt;&#xA;&lt;li&gt;Block storage&lt;/li&gt;&#xA;&lt;li&gt;Green hosting.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7787" LastActivityDate="2017-12-27T15:24:21.587" CommentCount="0" CommunityOwnedDate="2017-12-27T15:24:21.587" ContentLicense="CC BY-SA 3.0" />
  <row Id="23304" PostTypeId="1" AcceptedAnswerId="23355" CreationDate="2017-12-27T16:11:23.270" Score="1" ViewCount="143" Body="&lt;p&gt;I'm trying to set a max amount on the quantity in the cart. My problem is I want a customer to be able to update their quantity while in the cart, but I can't seem to figure out how to set the max quantity according to the stock on hand. I've done this with variant.stock in the items page, but can't seem to find anything that allows me to pull that information according to the lineItem in the cart page.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-01-02T22:37:59.787" Title="Pull in stock from Craft Commerce cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23305" PostTypeId="1" CreationDate="2017-12-27T16:35:05.320" Score="1" ViewCount="425" Body="&lt;p&gt;I am trying to &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;filter and sort show entries by what time they begin&lt;/li&gt;&#xA;&lt;li&gt;display the current show&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have two fields, &lt;code&gt;startTime&lt;/code&gt;and &lt;code&gt;endTime&lt;/code&gt;, and while Craft lets me display only the time part in the Control Panel, I can't filter entries in my template by the time part only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Listing out entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shows = craft.entries({&#xA;    section: 'shows',&#xA;    order: 'startTime asc',&#xA;    day: 'sunday',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Displaying the current show:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nowPlaying = craft.entries({&#xA;    section: 'shows',&#xA;    startTime: '&amp;lt;= ' ~ rightNow | date('c'),&#xA;    endTime: '&amp;gt;' ~ rightNow | date('c'),&#xA;    day: rightNow | date('l'),&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I create all my show entries on the same day, filtering by the whole date is fine, but that's assuming&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the times are never changed (thus updating the date)&lt;/li&gt;&#xA;&lt;li&gt;I don't care to know what show is currently playing (because a show will only show up if I created it today).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I prefer not to reinvent the wheel by making a template-side sorting algorithm. Is there not a more elegant way to query just the time part in Craft filtering?&lt;/p&gt;&#xA;" OwnerUserId="7285" LastEditorUserId="5557" LastEditDate="2017-12-27T17:23:08.687" LastActivityDate="2017-12-28T00:47:43.480" Title="Sort entries by time part only of DateTime object" Tags="&lt;entry&gt;&lt;datetime&gt;&lt;filtering&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23306" PostTypeId="1" AcceptedAnswerId="23308" CreationDate="2017-12-27T17:17:17.907" Score="2" ViewCount="1230" Body="&lt;p&gt;I am attempting to loop through my &quot;journalEntries&quot; in order to find duplicates. For some reason, it is taking a very long time to finish and return a response to me. Last time I tested it, it took 12 seconds to finish.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'journalArticles';&#xA;$criteria-&amp;gt;limit = 10;&#xA;$copies = array();&#xA;&#xA;for($a = 0; $a &amp;lt; count($criteria); $a++) {&#xA;  for($b = $a + 1; $b &amp;lt; count($criteria); $b++) {&#xA;    if($criteria[$a]-&amp;gt;title === $criteria[$b]-&amp;gt;title) {&#xA;      array_push($copies, $criteria[$a]-&amp;gt;title);&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;$this-&amp;gt;returnJson($copies);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think it is something I am doing incorrectly within the two for loops. As you can see, I limit the amount of articles to only 10, so something seriously funky must be going on. Any help?&lt;/p&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="3951" LastEditDate="2017-12-28T16:25:12.263" LastActivityDate="2017-12-28T19:12:22.867" Title="Loop through entries taking far too long to finish" Tags="&lt;entries&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23307" PostTypeId="2" ParentId="23305" CreationDate="2017-12-27T17:27:29.073" Score="1" Body="&lt;p&gt;If your &lt;code&gt;day&lt;/code&gt; field is a relation field you should search for your related entries with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set today = insertYourLogicToFetchTheCurrentDay %}&#xA;{# eg set todayName = &quot;now&quot;|date(&quot;l&quot;)#}&#xA;{# set today = craft.categories.title(todayName).first() #}&#xA;{% set showsToday = craft.entries.section('shows').relatedTo(today).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't really understand the second part of your question to be honest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is your &lt;code&gt;rightNow&lt;/code&gt; a valid DateTime object? Normally I would do it like that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set startDate = now|date('U')%}&#xA;{% set endDate = now|date('U') %}&#xA;{% set entries = craft.entries.section('shows').startTime('&amp;gt;='~startDate).endDate('&amp;lt;=' ~ endDate).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay: based on our comments this solution could work (at least from my test) but this is just an example what you could do: i did no performance tests and it looks a little bit ugly since I did the &quot;fast&quot; way not the &quot;I'm using craft styles and craft macros to make everything look good&quot;. You would have to extend it.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory&lt;/a&gt; and fill out your fields. Turn on the light switch for &lt;code&gt;FieldTypes&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Download the files and move it to your Craft Plugins folder. You Plugin name should have the same name like your folder in plugins. So when you name your Plugin &lt;code&gt;MyPlugin&lt;/code&gt; your folder is &lt;code&gt;/craft/plugins/myplugin/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to the generated file &lt;code&gt;/fieldtypes&lt;/code&gt; and overwrite these functions&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns the input value as it should be saved to the database.&#xA; *&#xA; * @param mixed $value&#xA; * @return mixed&#xA; */&#xA;public function prepValueFromPost($value)&#xA;{&#xA;    return $value['hours'] . $value['minutes'];&#xA;}&#xA;&#xA;/**&#xA; * Prepares the field's value for use.&#xA; *&#xA; * @param mixed $value&#xA; * @return mixed&#xA; */&#xA;public function prepValue($value)&#xA;{&#xA;    if(empty($value)){&#xA;        return [&#xA;            'hours' =&amp;gt; '00',&#xA;            'minutes'   =&amp;gt; '00'&#xA;        ];&#xA;    }&#xA;    return [&#xA;        'hours' =&amp;gt; substr($value, 0, 2),&#xA;        'minutes' =&amp;gt; substr($value, 2, 4),&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There will be a template in your &lt;code&gt;/templates/field/...twig&lt;/code&gt; folder change the input to something like this... I know this looks awful... you should style it and implement some logic to preselect fields and such&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select name=&quot;{{ name ~ '[hours]' }}&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;00&quot;&amp;gt;00&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;01&quot;&amp;gt;01&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;02&quot;&amp;gt;02&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;03&quot;&amp;gt;03&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;04&quot;&amp;gt;04&amp;lt;/option&amp;gt;&#xA;    &amp;lt;!-- and so on --&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;selected = {{ values.hours }}&#xA;&#xA;&amp;lt;select name=&quot;{{ name ~ '[minutes]' }}&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;00&quot;&amp;gt;00&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;01&quot;&amp;gt;01&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;02&quot;&amp;gt;02&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;03&quot;&amp;gt;03&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;03&quot;&amp;gt;03&amp;lt;/option&amp;gt;&#xA;    &amp;lt;!-- and so on --&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;selected = {{ values.minutes }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Change your two fields to the new field type. That way your db values will look like &lt;code&gt;0030&lt;/code&gt; for 00:30 or &lt;code&gt;1340&lt;/code&gt; for 13:40 you can now display the values in your frontend with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('shows') %}&#xA;    {{ entry.startTime.hours }}:{{ entry.startTime.minutes }}&amp;lt;br&amp;gt;&#xA;    {{ entry.enddate.hours }}:{{ entry.e.minutes }}&amp;lt;br&amp;gt;&#xA;    {% set startDate = entry.startTime.hours ~ entry.startTime.minutes %}&#xA;    {% set endDate = entry.endTime.hours ~ entry.endTime.minutes %}&#xA;    {% if startDate &amp;gt;= 0430 and endDate &amp;lt;= 1340   %}&#xA;        The show is between 04:30 and 13:40&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you can search via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set now = &quot;now&quot;|date('H') ~ &quot;now&quot;|date('i') %}&#xA;{% set entries = craft.entries.section('shows').relatedTo(day).find({&#xA;    'startdate': '&amp;gt;='~now,&#xA;    'enddate': '&amp;lt;='~now&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-27T19:15:07.577" LastActivityDate="2017-12-27T19:15:07.577" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23308" PostTypeId="2" ParentId="23306" CreationDate="2017-12-27T17:49:52.080" Score="3" Body="&lt;p&gt;Something like this should work and be faster.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'journalArticles';&#xA;$criteria-&amp;gt;limit = 10;&#xA;$entries = $criteria-&amp;gt;find();&#xA;&#xA;$titles = array();&#xA;$copies = array();&#xA;&#xA;foreach ($entries as $entry)&#xA;{&#xA;    $titles[] = $entry-&amp;gt;title;&#xA;}&#xA;&#xA;foreach (array_count_values($titles) as $val =&amp;gt; $count)&#xA;{&#xA;    if ($count &amp;gt; 1)&#xA;    {&#xA;        $copies[] = $val;&#xA;    }&#xA;}&#xA;&#xA;$this-&amp;gt;returnJson($copies);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="3951" LastEditDate="2017-12-28T19:12:22.867" LastActivityDate="2017-12-28T19:12:22.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23309" PostTypeId="2" ParentId="23306" CreationDate="2017-12-27T18:09:55.063" Score="3" Body="&lt;p&gt;Just some side notes as an explanation why your code takes so long and to understand Craft a little bit more&#xA;your &lt;code&gt;count()&lt;/code&gt; function does actually this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function count()&#xA;{&#xA;    // If the query has already been executed, just return a count of the results.&#xA;    if (isset($this-&amp;gt;_matchedElements))&#xA;    {&#xA;        return count($this-&amp;gt;_matchedElements);&#xA;    }&#xA;&#xA;    $total = $this-&amp;gt;total();&#xA;&#xA;    if ($this-&amp;gt;offset)&#xA;    {&#xA;        $total -= $this-&amp;gt;offset;&#xA;&#xA;        if ($total &amp;lt; 0)&#xA;        {&#xA;            $total = 0;&#xA;        }&#xA;    }&#xA;&#xA;    if ($this-&amp;gt;limit &amp;amp;&amp;amp; $total &amp;gt; $this-&amp;gt;limit)&#xA;    {&#xA;        $total = $this-&amp;gt;limit;&#xA;    }&#xA;&#xA;    return $total;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it checks if there are cached elements and if not the &lt;code&gt;total&lt;/code&gt; function is executed&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function total($attributes = null)&#xA;{&#xA;    $this-&amp;gt;setAttributes($attributes);&#xA;&#xA;    $this-&amp;gt;_includeInTemplateCaches();&#xA;&#xA;    if (!isset($this-&amp;gt;_cachedTotal))&#xA;    {&#xA;        $this-&amp;gt;_cachedTotal = craft()-&amp;gt;elements-&amp;gt;getTotalElements($this);&#xA;    }&#xA;&#xA;    return $this-&amp;gt;_cachedTotal;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which only caches the number but &lt;strong&gt;not&lt;/strong&gt; the elements&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you actually do is executing the query about 100 times (because of your two loops) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just using &lt;code&gt;$entries = $criteria-&amp;gt;find()&lt;/code&gt; and looping through your entries is a far better idea&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="3951" LastEditDate="2017-12-28T16:18:02.140" LastActivityDate="2017-12-28T16:18:02.140" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23310" PostTypeId="2" ParentId="23305" CreationDate="2017-12-27T23:03:49.587" Score="2" Body="&lt;p&gt;For those interested, I found out you can tell Craft to search the database for the time part only with the mySQL command time() (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6600/order-entries-by-custom-time-field&quot;&gt;Order entries by custom time field&lt;/a&gt;). For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shows = craft.entries({&#xA;  section: 'shows',&#xA;  relatedTo: day.id,&#xA;  order: &quot;time(startTime)&quot;,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this sorts based on the absolute DB time (GMT time), so I substituted a conversion command for startTime:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set convertedStartTime = 'convert_tz(startTime,&quot;+00:00&quot;,&quot;-06:00&quot;)' %}&#xA;&#xA;{% set shows = craft.entries({&#xA;  section: 'shows',&#xA;  relatedTo: day.id,&#xA;  order: &quot;time(#{convertedStartTime})&quot;,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To my complete shock, this actually works. I could not find a similar way to search for the current show, so I first filtered entries by day, then ran a for-loop to find the current show (there's only ten shows or so per day):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set todaysShows = craft.entries({&#xA;  section: 'shows',&#xA;  relatedTo: today,&#xA;}) %}&#xA;&#xA;{% for show in todaysShows if not done %}&#xA;    {% set start = show.startTime | date_modify('now') %}&#xA;    {% set end = show.endTime | date_modify('now') %}&#xA;&#xA;    {% if now &amp;gt;= start and now &amp;lt; end %}&#xA;        {% set nowPlaying = show %}&#xA;        {% set done = true %}&#xA;    {% endif %}&#xA;&#xA;  {% endfor %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7285" LastEditorUserId="57" LastEditDate="2017-12-28T00:47:43.480" LastActivityDate="2017-12-28T00:47:43.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23311" PostTypeId="2" ParentId="23278" CreationDate="2017-12-27T23:14:04.893" Score="2" Body="&lt;p&gt;Maybe you already solved your issue but I wanted to explain what I did the last time... You can make use of the &lt;code&gt;craft_content&lt;/code&gt; table and it's implementation in Craft 2 that fetches and includes all columns no matter of the field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make use of the light switch field, if you already have one that you are not going to use in your specific entry type you can abuse that, otherwise create a new one. You don't want to include this field into your field layout, you'll only work with it in your php code. Instead of looking if your entry is a new entry you are going to check if that field is set to true or false. You can change the field however you like, it is saved correctly and populated correctly, but your clients won't be able to change it manually (so they can't resend the mail by mistake. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code I used, my requirement was to send the mail as soon as the entry was activated (they were saved as disabled from a frontend form). Since you asked in a comment how to check when an entry goes from disabled to enabled I thought it might be helpful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event) {&#xA;        if(!$event-&amp;gt;params['isNewEntry']){&#xA;            /* @var $entry EntryModel */&#xA;            $entry = $event-&amp;gt;params['entry'];&#xA;            if($entry-&amp;gt;section-&amp;gt;handle === &quot;projects&quot;){&#xA;                $oldEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entry-&amp;gt;id);&#xA;                // check if the entry was disabled and is now enabled and if no mail was already send&#xA;                if($oldEntry-&amp;gt;enabled === false &amp;amp;&amp;amp; $entry-&amp;gt;enabled === true &amp;amp;&amp;amp; $entry-&amp;gt;getContent()-&amp;gt;getAttribute('mailSended') === 0){&#xA;                    $originalPath = craft()-&amp;gt;templates-&amp;gt;getTemplatesPath();&#xA;                    craft()-&amp;gt;templates-&amp;gt;setTemplatesPath(CRAFT_TEMPLATES_PATH);&#xA;&#xA;                    $html = craft()-&amp;gt;templates-&amp;gt;render('email/type/activateProject.twig', array(&#xA;                        'entry' =&amp;gt; $entry,&#xA;                        'userFullName'  =&amp;gt; $entry-&amp;gt;getContent()-&amp;gt;getAttribute('firstName') . &quot; &quot; . $entry-&amp;gt;getContent()-&amp;gt;getAttribute('lastName')&#xA;                    ));&#xA;&#xA;                    if($html){&#xA;                        craft()-&amp;gt;rodach-&amp;gt;sendMail($html, Craft::t('email_subject_activate_entry'), $entry-&amp;gt;eMail);&#xA;                        $entry-&amp;gt;getContent()-&amp;gt;setAttribute('mailSended', 1);&#xA;                    }&#xA;&#xA;                    craft()-&amp;gt;templates-&amp;gt;setTemplatesPath($originalPath);&#xA;                }&#xA;            }&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-27T23:14:04.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23313" PostTypeId="1" CreationDate="2017-12-28T13:00:01.663" Score="1" ViewCount="32" Body="&lt;p&gt;In my Rich Text field,  I've got some text that looks like this (it uses an unordered list):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;• Line 1&#xA;• Line 2*&#xA;• Line 3&#xA;&#xA;* Here is some more text&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that the &quot;Line 3&quot; text is appearing in italics, and neither of the asterisks display in the page preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can stop this from happening? Perhaps there's an escape character to use in this situation?&lt;/p&gt;&#xA;" OwnerUserId="6078" LastActivityDate="2017-12-28T13:00:01.663" Title="How can I prevent Redactor italicising text within asterisks?" Tags="&lt;redactor&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23315" PostTypeId="5" CreationDate="2017-12-28T17:08:32.973" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2017-12-28T17:08:32.973" LastActivityDate="2017-12-28T17:08:32.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23316" PostTypeId="4" CreationDate="2017-12-28T17:08:32.973" Score="0" Body="For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases." OwnerUserId="5126" LastEditorUserId="5126" LastEditDate="2018-01-02T17:13:12.723" LastActivityDate="2018-01-02T17:13:12.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23317" PostTypeId="1" CreationDate="2017-12-28T18:38:29.303" Score="1" ViewCount="46" Body="&lt;p&gt;I've created a form in which to specify a category for a product on the product entry page. I can't seem to add the category that the customer selects to the order model. I've checked the orders in the control panel and they do not seem to be storing the category. Does anybody know how to add a selected category to the order model?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form id=&quot;values&quot; method=&quot;POST&quot;&amp;gt; &#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;     &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;cart&quot;&amp;gt;&#xA;     ...&#xA;     &amp;lt;select id=&quot;chocOptions&quot; name=&quot;chocolateOptions&quot; class=&quot;options&quot;&amp;gt;&#xA;          &amp;lt;option title=&quot;selectOption&quot;&amp;gt;Select Option&amp;lt;/option&amp;gt;&#xA;          {% for category in craft.categories.group('chocolate') %}&#xA;               &amp;lt;option value=&quot;{{ category.title }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;          {% endfor %} &#xA;     &amp;lt;/select&amp;gt; &#xA;     ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7791" LastEditorUserId="3951" LastEditDate="2018-01-03T00:25:49.323" LastActivityDate="2018-01-03T00:25:49.323" Title="Product category not being added to the order model. Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23318" PostTypeId="2" ParentId="23317" CreationDate="2017-12-28T18:53:47.913" Score="1" Body="&lt;p&gt;I never used Craft Commerce but you usually store relations (no matter which) with the id - not the title. So I expect the Commerce plugin will only recognize your category with this html&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt; &amp;lt;select id=&quot;chocOptions&quot; name=&quot;fields[chocolateOptions][]&quot; class=&quot;options&quot;&amp;gt;&#xA;      &amp;lt;option title=&quot;selectOption&quot;&amp;gt;Select Option&amp;lt;/option&amp;gt;&#xA;      {% for category in craft.categories.group('chocolate') %}&#xA;           &amp;lt;option value=&quot;{{ category.id }}&quot;&amp;gt;{{ category.title }}&amp;lt;/option&amp;gt;&#xA;      {% endfor %} &#xA; &amp;lt;/select&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you have to name your field correctly like statet &lt;a href=&quot;https://craftcms.stackexchange.com/a/13105/5557&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;The easiest way to get to know how you have to build your html is the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;open the form in your Craft CP&lt;/li&gt;&#xA;&lt;li&gt;Right click on the field&lt;/li&gt;&#xA;&lt;li&gt;Click on &quot;inspect&quot; or &quot;inspect element&quot; or something like this&lt;/li&gt;&#xA;&lt;li&gt;Search for the input or a hidden input. When I inspect a normal relation field it looks like this&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;element small removable hasstatus&quot; data-id=&quot;13&quot; data-locale=&quot;de&quot; data-status=&quot;live&quot;&#xA;     data-label=&quot;&quot; data-url=&quot;&quot; data-editable=&quot;&quot;&amp;gt;&#xA;    &amp;lt;!-- this is the important part --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[relation][]&quot; value=&quot;13&quot;&amp;gt;&#xA;   &amp;lt;!-- end --&amp;gt;&#xA;    &amp;lt;a class=&quot;delete icon&quot; title=&quot;Entfernen&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;    &amp;lt;span class=&quot;status live&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;div class=&quot;label&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;title&quot;&amp;gt;Some Name&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-28T19:04:46.163" LastActivityDate="2017-12-28T19:04:46.163" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23319" PostTypeId="1" CreationDate="2017-12-29T15:41:12.477" Score="2" ViewCount="1607" Body="&lt;p&gt;Followed all steps on &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/upgrade.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upgrading from Craft 2&lt;/a&gt; I have my .env, db.php, general.php and index.php in place... can't find any reference of this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens after &quot;To complete the update, some changes must be made to your database.&quot; and clicking on &quot;Finish Up&quot;&lt;/p&gt;&#xA;" OwnerUserId="5873" LastActivityDate="2019-01-18T17:13:08.420" Title="Error when updating 2 to 3: Bad Request Unable to verify your data submission" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;updating&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23320" PostTypeId="1" CreationDate="2017-12-29T15:57:03.777" Score="1" ViewCount="384" Body="&lt;p&gt;Very similar (almost exact) to this question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19909/poor-performance-on-midsized-site-queries-without-index&quot;&gt;Poor performance on midsized site / Queries without index?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CPU keeps getting pegged to 100% for MySQL, which makes the admin interface very slow (the site is cached using fastCGI, so generally the site still performs well regardless).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The troublesome query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FROM (SELECT `elements`.`id` AS `elementsId`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`&#xA;FROM `elements` `elements`&#xA;JOIN `elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `content` `content` ON content.elementId = elements.id&#xA;LEFT JOIN `relations` `sources1` ON (sources1.targetId = elements.id)&#xA;LEFT JOIN `relations` `targets1` ON (targets1.sourceId = elements.id)&#xA;JOIN `entries` `entries` ON entries.id = elements.id&#xA;JOIN `sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE (((((elements_i18n.locale = 'en_us') AND (content.locale = 'en_us')) AND (elements.archived = 0)) AND ((elements.enabled = 1) AND (elements_i18n.enabled = 1) AND (entries.postDate &amp;lt;= '2017-12-29 15:41:28') AND ((entries.expiryDate is null) OR (entries.expiryDate &amp;gt; '2017-12-29 15:41:28')))) AND (elements_i18n.enabled = 1)) AND ((sources1.sourceId='52') OR (targets1.targetId='52'))&#xA;GROUP BY `elements`.`id`) derivedElementsTable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What are CPU has looked like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0fN6J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0fN6J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where I should start hunting this down. This appears to only happen for the en_us locale, I haven't recorded another locale showing this. This is on a staging site on Digital Ocean, so it's getting zero traffic. It's also being managed by Forge on PHP 7.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I get any advice for hunting down the php that might be leading to this? It's not happening as a result of any clear action.&lt;/p&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2017-12-31T18:49:48.940" Title="MySQL CPU pegged on specific query" Tags="&lt;performance&gt;&lt;mysql&gt;&lt;query&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23321" PostTypeId="1" AcceptedAnswerId="23322" CreationDate="2017-12-29T17:26:02.207" Score="4" ViewCount="662" Body="&lt;p&gt;In &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10632/how-can-i-check-if-a-plugin-is-installed-and-enabled&quot;&gt;a question I asked&lt;/a&gt; a few years ago, it was very simple to perform a check on wether a plugin was installed or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 3, the same methods don't seem to work. The likes of this always returns &lt;code&gt;true&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.myPlugin is defined ? 'Installed' : 'Not Installed' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there another way to determine if a specific plugin is installed and enabled?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2017-12-29T17:37:15.590" Title="How can I check if a plugin is installed and enabled, in Craft 3?" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23322" PostTypeId="2" ParentId="23321" CreationDate="2017-12-29T17:37:15.590" Score="6" Body="&lt;p&gt;PHP&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\Craft::$app-&amp;gt;plugins-&amp;gt;isPluginInstalled('plugin-handle')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set installed = craft.app.plugins.isPluginInstalled('plugin-handle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is also a &lt;code&gt;isPluginDisabled&lt;/code&gt; and a &lt;code&gt;isPluginEnabled&lt;/code&gt; function.&#xA;Here is a class reference &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-plugins.html#isPluginInstalled()-detail&quot; rel=&quot;noreferrer&quot;&gt;craft\services\Plugins&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2017-12-29T17:37:15.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23323" PostTypeId="1" CreationDate="2017-12-29T19:00:17.023" Score="1" ViewCount="200" Body="&lt;p&gt;Sometimes the links are in-page, sometimes they point outside. I want to be able to create an array &lt;code&gt;menuitems&lt;/code&gt; that is passed to an include and which then generates a per-section index menu on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have the approach below, but I'm a little annoyed that I have to loop through &lt;code&gt;projects&lt;/code&gt; twice because of Twig's scope. Any better ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template projects.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = 'Projects' %}&#xA;{% set projects = craft.entries.section('projects').find() %}&#xA;{% block submenu %}&#xA;    {% set menuitems = [] %}&#xA;    {% for project in projects %} {# first loop #}&#xA;        {% set menuitems = menuitems|merge([project.title]) %}&#xA;    {% endfor %}&#xA;    {% include '_includes/_submenu' %}&#xA;{% endblock %}&#xA;{% block content %}&#xA;    {% for project in projects %} {# second, unnecessary loop #}&#xA;        &amp;lt;a href=&quot;project_{{ project.id }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ project.title }}&amp;lt;/h1&amp;gt;&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;template _includes/_submenu.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for item in menuitems %}&#xA;        &amp;lt;li class=&quot;pageMenu&quot;&amp;gt;{{ item }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7792" LastActivityDate="2017-12-29T19:00:17.023" Title="making a dynamic menu in a template" Tags="&lt;templating&gt;&lt;scope&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23326" PostTypeId="1" AcceptedAnswerId="23327" CreationDate="2017-12-30T15:28:24.173" Score="2" ViewCount="775" Body="&lt;p&gt;I'm trying to use the &quot;&lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedded Assets&lt;/a&gt;&quot; Craft plug-in to embed Youtube and Vimeo videos in a matrix field, but I can't figure it out. I've read through the instructions on the Github page but I can't make sense of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have successfully installed the plug-in, and it seems to be &quot;grabbing&quot; the videos correctly since I can see the video in the assets section and the json files are in the folder on my disk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put this twig code from the instructions of the plugin provider in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in assets %}&#xA;    {% set embed = craft.embeddedAssets.fromAsset(asset) %}&#xA;    {% if embed %}&#xA;        {{ embed.safeHtml|raw }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it breaks my page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error message I get, saying the variable &quot;assets&quot; does not exist:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;52         &amp;lt;div class=&quot;video&quot;&amp;gt;&#xA;53                 {% for videoEmbed in videoEmbed %}&#xA;54                     {% set embed = craft.embeddedAssets.entry.    (videoEmbed) %}&#xA;55                     {% if embed %}&#xA;56                     {{ embed.safeHtml|raw }}&#xA;57                     {% endif %}&#xA;58                 {% endfor %}&#xA;59                 {% endif %}&#xA;60 &#xA;61         &amp;lt;/div&amp;gt;&#xA;62 &#xA;63             &#xA;64         {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I work locally and have dev mode turned on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to use the plugin inside a matrix field with &quot;videoEmbed&quot; as block and field handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created an asset source/ folder called &quot;videos&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I am on the personal licence.&lt;/p&gt;&#xA;" OwnerUserId="7793" LastActivityDate="2017-12-30T20:13:20.110" Title="Using embedded assets plugin to display youtube or vimeo embed urls on a template" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23327" PostTypeId="2" ParentId="23326" CreationDate="2017-12-30T16:07:14.927" Score="3" Body="&lt;p&gt;You need to define your assets, if the asset field is named &lt;code&gt;videoEmbed&lt;/code&gt; in your matrix &lt;code&gt;matrixFieldHandle&lt;/code&gt; you would loop through the matrix and grab the first asset with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixFieldHandle %}&#xA;&#xA;  {% set asset = block.videoEmbed.first() %}&#xA;&#xA;  {% set embed = craft.embeddedAssets.fromAsset(asset) %}&#xA;&#xA;  {% if embed %}&#xA;    {{ embed.safeHtml|raw }}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find additional information about matrix-fields and templating here: &lt;a href=&quot;https://craftcms.com/docs/matrix-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/matrix-fields#templating&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2017-12-30T16:14:59.633" LastActivityDate="2017-12-30T16:14:59.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23328" PostTypeId="2" ParentId="23326" CreationDate="2017-12-30T20:13:20.110" Score="3" Body="&lt;p&gt;Just to wrap it up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a martix field for blog entries with the handle &lt;code&gt;blogBody&lt;/code&gt; with a rich text block and several image blocks for different styled images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added a block to the matrix field with the handle &lt;code&gt;blogBody&lt;/code&gt;, that has the handle &lt;code&gt;embedVideo&lt;/code&gt;. The corresponding field is also called &lt;code&gt;embedVideo&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template I added to the block with the handle &lt;code&gt;blogBody&lt;/code&gt; this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if block.type == &quot;embedVideo&quot; %}&#xA;        {% set asset = block.embedVideo.first() %}&#xA;        {% set embed = craft.embeddedAssets.fromAsset(asset) %}&#xA;            {% if embed %}&#xA;            &amp;lt;div id=&quot;video-box&quot; class=&quot;videobox&quot;&amp;gt;&#xA;                  {{ embed.safeHtml|raw }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also needed some responsiveness for the embedded video and used good &quot;&lt;a href=&quot;http://fitvidsjs.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;FitVids&lt;/a&gt;&quot;. So I wrapped the thing for the output in a div with a corresponding ID to FitVids and added a little bit of styling to the video wrapper using the class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nice.&lt;/p&gt;&#xA;" OwnerUserId="7793" LastActivityDate="2017-12-30T20:13:20.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23329" PostTypeId="1" CreationDate="2017-12-30T21:41:34.937" Score="2" ViewCount="647" Body="&lt;p&gt;How do you configure the new CKEditor editor to e.g. add images? Do you create a config/CKeditor folder with a .json file and install the @ckeditor/ckeditor5-image package?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2017-12-30T22:40:32.613" Title="Customising the new CKEditor5 in Craft 3" Tags="&lt;wysiwyg&gt;&lt;ckeditor5&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23330" PostTypeId="2" ParentId="23329" CreationDate="2017-12-30T22:33:04.570" Score="2" Body="&lt;p&gt;I don't think so. You can see the entire code &lt;a href=&quot;https://github.com/craftcms/ckeditor/blob/master/src/Field.php#L128&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ClassicEditor&#xA;    .create(document.getElementById('{$nsId}'))&#xA;    .then(function(editor) {&#xA;        $(editor.element).closest('form').on('submit', function() {&#xA;        editor.updateEditorElement();&#xA;    });&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the javascript that triggers the editor, as you can see, there are no &lt;a href=&quot;https://docs.ckeditor.com/ckeditor5/latest/api/module_core_editor_editorconfig-EditorConfig.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;config settings&lt;/a&gt; provided yet. I searched in the entire plugin but I could not find any other Javascript functions that are triggert so unless they provided a really nasty method to include them in the &lt;a href=&quot;https://github.com/craftcms/ckeditor/blob/master/lib/ckeditor/dist/ckeditor.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;original editor js file&lt;/a&gt; you can't change them yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only &quot;configurations&quot; are &lt;a href=&quot;https://github.com/craftcms/ckeditor#html-purifier-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Html Purifier&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - you could create a feature request or you could implement your own code to provide settings. You only need to change a few lines - it's totally trivial&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2017-12-30T22:40:32.613" LastActivityDate="2017-12-30T22:40:32.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23331" PostTypeId="1" AcceptedAnswerId="23346" CreationDate="2017-12-31T13:09:53.563" Score="2" ViewCount="312" Body="&lt;p&gt;I'm not sure if this is a bug, a security feature, or something to do with Twig 2; but since Craft 3 (RC3) I'm no longer able to access hidden twig files via ajax. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $.ajax({&#xA;    method:'GET',&#xA;    url:'/blog/test',&#xA;    success:function(data){&#xA;      $('body').append(data);&#xA;      console.log(&quot;SUCCESS&quot;, data);&#xA;    },&#xA;    error:function(data){&#xA;      console.log(&quot;ERROR&quot;, data);&#xA;    }&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I point the url to a hidden file with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;url:'/blog/_test',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a &lt;strong&gt;404 (Not Found)&lt;/strong&gt; error. For my example, I have both '_test.twig' and 'test.twig' files in the 'blog' directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing a breaking &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/changes-in-craft-3.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;change&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't really know what it was for, but &lt;code&gt;'enableCsrfProtection' =&amp;gt; true&lt;/code&gt; has always been set in my config/general.php file. (In both Craft 2 and 3). I've tried setting this to &lt;code&gt;false&lt;/code&gt; too, and I'm getting the same results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Robins comment, I've attempted to follow these instructions: &lt;a href=&quot;https://craftcms.com/support/csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enabling CSRF Protection&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the global variables &lt;code&gt;window.csrfTokenName&lt;/code&gt; and &lt;code&gt;window.csrfTokenValue&lt;/code&gt;. And now I'm stuck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty new to ajax, and I'm not sure how to extrapolate &lt;a href=&quot;https://craftcms.com/support/csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;the example&lt;/a&gt; in a way where I can add the CSRF Token correctly in my 'GET' method.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the response I'm getting: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ERROR &#xA;{readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}&#xA;abort : (statusText)&#xA;always : ()&#xA;catch : (fn)&#xA;done : ()&#xA;fail : ()&#xA;getAllResponseHeaders : ()&#xA;getResponseHeader : (key)&#xA;overrideMimeType : (type)&#xA;pipe : ()&#xA;progress : ()&#xA;promise : (obj)&#xA;readyState : 4&#xA;responseText : &quot;&amp;lt;pre&amp;gt;Not Found: Page not found.&amp;lt;/pre&amp;gt;&quot;&#xA;setRequestHeader : (name,value)&#xA;state : ()&#xA;status : 404&#xA;statusCode : (map)&#xA;statusText : &quot;Not Found&quot;&#xA;then : (onFulfilled,onRejected,onProgress)&#xA;__proto__ : Object&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2017-12-31T16:48:50.337" LastActivityDate="2018-01-02T17:12:50.257" Title="Hidden files are no longer accessible with AJAX in Craft 3" Tags="&lt;ajax&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23332" PostTypeId="2" ParentId="14465" CreationDate="2017-12-31T14:14:44.760" Score="4" Body="&lt;p&gt;In case anyone finds this in a Google search, this is how you'd do it in Craft 3, if, say, you wanted to add an Expires header:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = Craft::$app-&amp;gt;getResponse();&#xA;$response-&amp;gt;headers-&amp;gt;set('Expires', gmdate('D, d M Y H:i:s \G\M\T', strtotime(&quot;+1 month&quot;)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-runtime-responses.html&quot; rel=&quot;noreferrer&quot;&gt;Yii2 Responses&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2017-12-31T17:07:39.497" LastActivityDate="2017-12-31T17:07:39.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23333" PostTypeId="1" AcceptedAnswerId="23335" CreationDate="2017-12-31T14:31:25.597" Score="1" ViewCount="554" Body="&lt;p&gt;I’m struggling with getting the next &lt;code&gt;block&lt;/code&gt; inside of a loop of a Matrix-Field. I’ve tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextBlock = entry.articleContent.offset(1).limit(1) %}&#xA;{% if nextBlock.type == &quot;textBox&quot; %}&#xA; {{ nextBlock.textTitle }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces an &lt;strong&gt;ArgumentCountError&lt;/strong&gt;. Can someone help me with this issue?&lt;/p&gt;&#xA;" OwnerUserId="7146" LastActivityDate="2017-12-31T14:44:38.393" Title="Next block inside of a loop" Tags="&lt;matrix&gt;&lt;forloop&gt;&lt;loop&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23335" PostTypeId="2" ParentId="23333" CreationDate="2017-12-31T14:44:38.393" Score="4" Body="&lt;p&gt;Try doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nextBlock = block.getNext() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/templating/matrixblockmodel#getNext&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/matrixblockmodel#getNext&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-31T14:44:38.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23336" PostTypeId="1" CreationDate="2017-12-31T18:30:02.693" Score="1" ViewCount="188" Body="&lt;p&gt;I want to create a few dozen new entries from an Excel or .csv import.  Does this capability exist in Craft 3?  There was a plugin for Craft 2.  But, I need to prepare for the switch to Craft 3 and this is a critical (time-sensitive) need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, is there another way to import a large number of new entries (using another file format, etc.)???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2017-12-31T18:30:02.693" Title="How can I upload multiple new entries into Craft 3?" Tags="&lt;craft3&gt;&lt;import&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23337" PostTypeId="1" AcceptedAnswerId="23345" CreationDate="2017-12-31T18:33:17.040" Score="2" ViewCount="674" Body="&lt;p&gt;In my plugins init() function I have this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;view-&amp;gt;registerTwigExtension(new TestTwigExtension());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I duplicate that and change the Twig Extension class name, I just get an error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Class 'marknotton\test\Test2TwigExtension' not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In Craft 2.x, this worked: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function addTwigExtension() {&#xA;    Craft::import('plugins.test.twigextensions.test');&#xA;    Craft::import('plugins.test.twigextensions.test2');&#xA;    return array(&#xA;      new test(),&#xA;      new test2()&#xA;    );&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that approach has completely changed. I can't rename any file names, Craft::import doesn't exist anymore, and I can't pass an array into the &lt;code&gt;registerTwigExtension()&lt;/code&gt; function. (&lt;em&gt;Craft 3 is scary&lt;/em&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to achieve is a way of organising my Twig Extension files, rather than having everything in one file. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-01-01T01:48:45.917" Title="Register multiple TwigExtensions in one plugin in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23338" PostTypeId="2" ParentId="23320" CreationDate="2017-12-31T18:49:48.940" Score="2" Body="&lt;p&gt;I wouldn't be &lt;em&gt;too&lt;/em&gt; worried about MySQL using 100% CPU, especially on a multi-core VPS. But a good way to track down things like this is to &lt;a href=&quot;https://ma.ttias.be/mysql-slow-query-log-without-restart/&quot; rel=&quot;nofollow noreferrer&quot;&gt;enable the MySQL slow query log&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set whatever thresholds you want, and then peruse the log at your convenience to see the queries that are actually slowing things down.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2017-12-31T18:49:48.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23339" PostTypeId="1" CreationDate="2017-12-31T20:58:13.427" Score="3" ViewCount="1137" Body="&lt;p&gt;I am a little bit confused by the documentation about assets. It says that paths are relatives from the directory that holds the index.php file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am working on multisite, with the following folders:&lt;br&gt;&#xA;    craft/web/site1/&lt;br&gt;&#xA;    craft/web/site2/  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have:&lt;br&gt;&#xA;    craft/assets/site1/&lt;br&gt;&#xA;    craft/assets/site2/  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;br&gt;&#xA;    craft/web/site1/assets/&lt;br&gt;&#xA;    craft/web/site2/assets/&lt;/p&gt;&#xA;" OwnerUserId="7780" LastEditorUserId="57" LastEditDate="2018-01-09T19:02:33.653" LastActivityDate="2018-01-09T19:02:33.653" Title="Craft 3: multisite and assets" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23340" PostTypeId="1" CreationDate="2017-12-31T22:01:43.870" Score="1" ViewCount="403" Body="&lt;p&gt;I've enabled &lt;code&gt;Show the debug toolbar on the Control Panel&lt;/code&gt; in my Craft Admin account in a local development environment that uses SSL. As soon as I enable it, I get the following error each time I load any page in the CP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;VM1685:1 Mixed Content: The page at 'https://domain.dev/admin/myaccount' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://craft3.dev/actions/debug/default/toolbar?tag=5a495cbcf3e15'. This request has been blocked; the content must be served over HTTPS.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;SSL seems to be set up and working fine. I have the &lt;code&gt;siteUrl&lt;/code&gt; variable in my &lt;code&gt;general.php&lt;/code&gt; set up with an &lt;code&gt;https&lt;/code&gt; url as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; 'https://domain.dev',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What could be triggering this warning?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-11-02T18:44:26.270" Title="Yii Toolbar triggering mixed content warning in CP" Tags="&lt;control-panel&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23341" PostTypeId="1" CreationDate="2017-12-31T22:23:46.520" Score="2" ViewCount="157" Body="&lt;p&gt;I have a custom Element and need to modify the Element Index page. I'm attempting to extend &lt;code&gt;Craft.BaseElementIndex&lt;/code&gt; and register the extended class on my Element Index Page. I'm working on a plugin for Craft 3. Something similar seems to be working fine in Craft 2, but I'm not sure if this is really a version issue or just an issue with my implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($){&#xA;    Craft.MyCustomPlugin.MyElementIndex = Craft.BaseElementIndex.extend({&#xA;      getDefaultSort: function() {&#xA;          return ['elements.dateCreated', 'desc'];&#xA;      }&#xA;    });&#xA;&#xA;    Craft.registerElementIndexClass('mynamespace\\elements\\MyElement', Craft.MyCustomPlugin.MyElementIndex);&#xA;})(jQuery);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The javascript file seems to load however doesn't have any effect on the Element Index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add an &lt;code&gt;init&lt;/code&gt; method with a &lt;code&gt;console.log()&lt;/code&gt; statement, a message gets logged but then the results on the Element Index page don't load anymore.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($){&#xA;  Craft.MyCustomPlugin.MyElementIndex = Craft.BaseElementIndex.extend({&#xA;    init: function() {&#xA;      console.log('Who cooks for you?');&#xA;    },&#xA;    getDefaultSort: function() {&#xA;        return ['elements.dateCreated', 'desc'];&#xA;    }&#xA;  });&#xA;&#xA;  Craft.registerElementIndexClass('mynamespace\\elements\\MyElement', Craft.MyCustomPlugin.MyElementIndex);&#xA;})(jQuery);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-01T10:31:21.643" Title="How to extend Craft.BaseElementIndex for a custom Element Type" Tags="&lt;javascript&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23342" PostTypeId="2" ParentId="23339" CreationDate="2017-12-31T22:46:44.540" Score="1" Body="&lt;p&gt;Your second example is easy enough... just make sure the &lt;code&gt;assets&lt;/code&gt; folder exists under both of the &lt;code&gt;site1&lt;/code&gt; and &lt;code&gt;site2&lt;/code&gt; folders, the under your Asset Volume settings in the Control Panel, set the &quot;File System Path&quot; to the relative &lt;code&gt;assets&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2017-12-31T22:46:44.540" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23343" PostTypeId="2" ParentId="23340" CreationDate="2017-12-31T23:22:05.080" Score="1" Body="&lt;p&gt;On a multi-site setup, you need to use the multi-site array syntax for the &lt;code&gt;siteUrl&lt;/code&gt; config setting like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; [&#xA;    'siteHandle1' =&amp;gt; 'https://foo.com/',&#xA;    'siteHandle2' =&amp;gt; 'https://bar.com/',&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2018-11-02T18:44:26.270" LastActivityDate="2018-11-02T18:44:26.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23344" PostTypeId="2" ParentId="23339" CreationDate="2017-12-31T23:22:09.587" Score="1" Body="&lt;p&gt;I think I got it right, going the first solution I planned. So, in my Craft project directory (&quot;craft&quot;), I created &quot;craft/assets/site1&quot; and &quot;craft/assets/site2&quot; and when going into the admin panel and setting up the ressources, using &quot;../../assets/site1&quot; and &quot;../../assets/site2&quot; did the trick, everything working as expected. So, really, my source of confusion here was Craft recommending me “/path/to/folder” which lead me to add a / at the beginning of my paths; once I got rid of that, problem was solved. Thank you very much for your help ! :-)&lt;/p&gt;&#xA;" OwnerUserId="7780" LastActivityDate="2017-12-31T23:22:09.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23345" PostTypeId="2" ParentId="23337" CreationDate="2018-01-01T01:48:45.917" Score="7" Body="&lt;p&gt;There are several things going on here. This will be a general answer that can hopefully help you move forward. This example will use &lt;a href=&quot;https://github.com/barrelstrength/sprout-active&quot; rel=&quot;noreferrer&quot;&gt;Sprout Active&lt;/a&gt; as a reference and you can see the code here for an example of a plugin that implements multiple, simple Twig Extensions.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Define your Twig Extension class and Namespace&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, you can register a Twig Extension (or multiple Twig Extensions) in your Plugins &lt;code&gt;init&lt;/code&gt;. While the line to register the Twig Extension is straightforward, there are a lot of other details that matter in your file and I'll comment the code below to highlight why:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// In Craft 3, each class you create has a namespace. You need to &#xA;// make sure that this is referenced in any other classes that use this class&#xA;namespace barrelstrength\sproutactive;&#xA;&#xA;// We're referencing the namespaces of other classes in this class too.&#xA;// We use the Craft Plugin class, to create our plugin&#xA;use craft\base\Plugin;&#xA;&#xA;// You'll create this file next. We need to identify the namespace&#xA;// of the Twig Extension we'll be importing so Craft knows where it is&#xA;// when we reference `new TwigExtensions()` below&#xA;use barrelstrength\sproutactive\twig\TwigExtensions;&#xA;&#xA;class SproutActive extends Plugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        // Register the Twig Extensions file. We could name this anything&#xA;        // and put this anywhere in our folder structure now. As long as &#xA;        // we reference the namespace properly above, Craft will be able to &#xA;        // find it. We can create multiple Twig Extensions within this&#xA;        // TwigExtensions Class or create multiple files to manage our&#xA;        // Twig Extensions and import those classes too.&#xA;        Craft::$app-&amp;gt;view-&amp;gt;twig-&amp;gt;addExtension(new TwigExtensions());&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Twig 2 updated several things too&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Once we get the extensions loaded, you can create extensions similar to before, however, Craft 3 uses Twig 2 which introduces several breaking changes on it's own. You can see some discussion of the &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/changes-in-craft-3.md#twig-2&quot; rel=&quot;noreferrer&quot;&gt;Twig 2 front-end changes&lt;/a&gt; in the Craft docs but the docs don't discuss the API changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Twig 2, &lt;code&gt;Twig_SimpleFunction&lt;/code&gt; replaces &lt;code&gt;Twig_Function_Method&lt;/code&gt; and &lt;code&gt;Twig_Filter_Method&lt;/code&gt; so you'll need to update any Craft 2 Twig Extensions code to use &lt;code&gt;Twig_SimpleFunction&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Sprout Active &lt;code&gt;TwigExtensions&lt;/code&gt; Class you can see how the class creates multiple Twig functions within the &lt;code&gt;getFunctions&lt;/code&gt; method. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFunctions()&#xA;{&#xA;    return [&#xA;        new \Twig_SimpleFunction('active', [$this, 'getActive']),&#xA;        new \Twig_SimpleFunction('activeClass', [$this, 'getActiveClass'], ['is_safe' =&amp;gt; ['html']]),&#xA;        new \Twig_SimpleFunction('segment', [$this, 'getSegment']),&#xA;        new \Twig_SimpleFunction('segmentClass', [$this, 'getSegmentClass'], ['is_safe' =&amp;gt; ['html']])&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-01T01:48:45.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23346" PostTypeId="2" ParentId="23331" CreationDate="2018-01-01T08:54:47.997" Score="2" Body="&lt;p&gt;My guess is still: you did not define a route correct route for your template. You can check if you can access the file when you call the route normally via url &lt;code&gt;www.example.com/blog/test&lt;/code&gt; if you can see the template, then it should usually work, if not you did not define any routing rules &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/updating-plugins.md#registersiteroutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However: when you do it that way everyone with the link may see this template and I expect it to look not very good without content since it's probably only a partial, so I would highly recommend you to use the proper way via controller.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionRenderTemplate(){&#xA;    $response = [&#xA;        'success'   =&amp;gt; false,&#xA;        'message'   =&amp;gt; 'something went wrong'&#xA;    ];&#xA;    if($template = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('template')){&#xA;        try{&#xA;            $response['success'] = true;&#xA;            $response['html'] = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate($template, [&#xA;                'foo' =&amp;gt; Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('just an example to pass values');&#xA;            ]);&#xA;        }catch(\Twig_Error_Loader $e){&#xA;            $response['message'] = $e-&amp;gt;getMessage(); &#xA;        }catch(\yii\base\Exception $e){&#xA;            $response['message'] = $e-&amp;gt;getMessage();&#xA;        }&#xA;    }&#xA;    return $this-&amp;gt;asJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your javascript&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$.ajax({&#xA;    type: &quot;post&quot;,&#xA;    data: {&#xA;        action: 'plugin-handle/controller/render-template',&#xA;        template: 'path/to/template'&#xA;    },&#xA;    url: '',&#xA;    success: function (data) {&#xA;        if (data.success === true) {&#xA;            // do your stuff&#xA;            $('body').append(data.html);&#xA;        } else {&#xA;            // something went wrong&#xA;            // show a message or whatever&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;Please make sure you are in the correct folder for rendering your template, there is a difference between frontend and cp requests &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/updating-plugins.md#rendering-plugin-templates-on-front-end-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; that's why we always build a custom template service that checks if there is a template in the normal path first and only takes the plugin template if there is none so we can overwrite plugin templates if needed and don't need to check/overwrite the paths every time&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="3951" LastEditDate="2018-01-02T17:12:50.257" LastActivityDate="2018-01-02T17:12:50.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23347" PostTypeId="2" ParentId="23341" CreationDate="2018-01-01T10:10:56.110" Score="1" Body="&lt;p&gt;Not really an answer to your question but some thoughts..&#xA;I've tried your code with my form builder and I noticed two things (the first is really obvious) &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When you overwrite the default &lt;code&gt;init&lt;/code&gt; function everything will (of course) break because all the important staff happens there, you can make your calls in the &lt;code&gt;afterInit()&lt;/code&gt; function. &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/dist/js/Craft.js#L3573&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft.js Line 3573&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Give sub-classes a chance to do post-initialization stuff here&#xA;this.afterInit();&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This function handles the sort for Craft. &lt;code&gt;Craft.js line 2721&lt;/code&gt; &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/dist/js/Craft.js#L2721&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;setStoredSortOptionsForSource: function() {&#xA;    // Default to whatever's first&#xA;    this.setSortAttribute();&#xA;    this.setSortDirection('asc');&#xA;&#xA;    var sortAttr = this.getSelectedSourceState('order'),&#xA;        sortDir = this.getSelectedSourceState('sort');&#xA;&#xA;    if (!sortAttr) {&#xA;        // Get the default&#xA;        sortAttr = this.getDefaultSort();&#xA;&#xA;        if (Garnish.isArray(sortAttr)) {&#xA;            sortDir = sortAttr[1];&#xA;            sortAttr = sortAttr[0];&#xA;        }&#xA;    }&#xA;&#xA;    if (sortDir !== 'asc' &amp;amp;&amp;amp; sortDir !== 'desc') {&#xA;        sortDir = 'asc';&#xA;    }&#xA;&#xA;    this.setSortAttribute(sortAttr);&#xA;    this.setSortDirection(sortDir);&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important part is: &lt;code&gt;var sortAttr = this.getSelectedSourceState('order'),&lt;/code&gt; (&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/dist/js/Craft.js#L2726&quot; rel=&quot;nofollow noreferrer&quot;&gt;line 2726&lt;/a&gt;) and since &lt;code&gt;sortAttr&lt;/code&gt; (at least for me) was never null in my tests - the &lt;code&gt;sortAttr = this.getDefaultSort();&lt;/code&gt; is not triggert. This is because Craft caches the sort order for the user but I don't know how/when this happens. However: when I overwrite &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/dist/js/Craft.js#L2729&quot; rel=&quot;nofollow noreferrer&quot;&gt;line 2729&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (true || !sortAttr) {&#xA;    // Get the default&#xA;    sortAttr = this.getDefaultSort();&#xA;&#xA;    if (Garnish.isArray(sortAttr)) {&#xA;        sortDir = sortAttr[1];&#xA;        sortAttr = sortAttr[0];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getDefaultSort: function() {&#xA;    return ['dateCreated', 'asc'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was able to change the default sort. Hope it helps a little bit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; this will break the default Craft caching. Normally the default sort options runs only once, after that is keeps the sort order that the user specified. You could overwrite the function for your tests and remove the always true condition when it goes live for a reliable way to get your function triggert. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-01T10:31:21.643" LastActivityDate="2018-01-01T10:31:21.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23348" PostTypeId="1" CreationDate="2018-01-02T11:24:59.740" Score="3" ViewCount="385" Body="&lt;p&gt;I have this custom config in config/app.php,&#xA;but Craft seems to keep using the default Control panel Sendmail config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this doesn't get merged in the main.php file. (as promised)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; return [&#xA; 'components' =&amp;gt; [&#xA;     'mailer' =&amp;gt; function() {&#xA;&#xA;        // Get the stored email settings&#xA;        $settings = Craft::$app-&amp;gt;systemSettings-&amp;gt;getEmailSettings();&#xA;&#xA;        // Override the transport adapter class&#xA;        $settings-&amp;gt;transportType = craft\mail\transportadapters\Smtp::class;&#xA;&#xA;        // Override the transport adapter settings&#xA;        $settings-&amp;gt;transportSettings = [&#xA;            'host' =&amp;gt; 'xx',&#xA;            'port' =&amp;gt; 'xx',&#xA;            'useAuthentication' =&amp;gt; true,&#xA;            'username' =&amp;gt; 'xx',&#xA;            'password' =&amp;gt; 'xx'&#xA;        ];&#xA;&#xA;        return craft\helpers\MailerHelper::createMailer($settings);&#xA;     },&#xA; ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;];&lt;/p&gt;&#xA;" OwnerUserId="6098" LastActivityDate="2018-01-02T11:24:59.740" Title="Mailer config in Craft 3 not getting merged" Tags="&lt;emails&gt;&lt;craft3&gt;&lt;craft-pro&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23351" PostTypeId="1" AcceptedAnswerId="23354" CreationDate="2018-01-02T18:23:40.403" Score="3" ViewCount="634" Body="&lt;p&gt;Anyone know how to get the &lt;strong&gt;&lt;code&gt;Position&lt;/code&gt;&lt;/strong&gt; field type to show up in Craft 3 (RC)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;Matrix&lt;/code&gt; field, and an &lt;code&gt;Asset/Image&lt;/code&gt; field within that, and I'm trying to add a &lt;code&gt;Position&lt;/code&gt; field to it.&lt;/p&gt;&#xA;" OwnerUserId="7801" LastActivityDate="2018-01-02T21:11:01.463" Title="Missing Position Field Type in Matrix (Craft 3)" Tags="&lt;craft3&gt;&lt;fieldtypes&gt;&lt;position&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23352" PostTypeId="1" CreationDate="2018-01-02T18:31:47.667" Score="1" ViewCount="779" Body="&lt;p&gt;What I need is a social media stream with posts with the Hashtag mnbasel form Instagram, Facebook and Twitter. I couldn’t find any good tutorial. Hopefully someone can tell me what I miss or lead me to a tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I signed in to Instagram as a developer and got my Access Token using Client ID and Client Secret.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I created a Vue component with this script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; module.exports = {&#xA;  name: 'socialstream',&#xA;  data: function () {&#xA;    return {&#xA;      instagram: []&#xA;    }&#xA;  },&#xA;  mounted () {&#xA;    this.getEntries();&#xA;  },&#xA;  methods: {&#xA;    getEntries () {&#xA;      axios.get('https://api.instagram.com/v1/tags/search?q=mnbasel&amp;amp;access_token={access-token}')&#xA;        .then(response =&amp;gt; {&#xA;          this.instagram = response.data.data&#xA;        })&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I get from this is the following error message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught (in promise) Error: Request failed with status code 400&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the Result I get when I paste the URL in the Browser:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;code&quot;: 400,&#xA;&quot;error_type&quot;: &quot;OAuthPermissionsException&quot;,&#xA;&quot;error_message&quot;: &quot;This request requires scope=public_content, but this access token is not authorized with this scope. The user must re-authorize your application with scope=public_content to be granted this permissions.&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also installed the OAuth Plugin from Dukt and configured Instagram. Not sure if I need that and how to connect this information with the Vue component.&lt;/p&gt;&#xA;" OwnerUserId="4040" LastActivityDate="2018-02-05T16:39:14.897" Title="How to set up a social media feed with vue and axios" Tags="&lt;ajax&gt;&lt;javascript&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23353" PostTypeId="1" CreationDate="2018-01-02T18:47:02.047" Score="0" ViewCount="89" Body="&lt;p&gt;Using Craft 2 and amforms, I created a massive form on a client's temporary site while working on the full refresh on a staging server.  While that development's been going on, the live temp site has been collecting form submissions the whole time.  We're preparing to overwrite the live server with staging's db, and the only thing that needs to be conserved from the live temp site is all those form submissions that came in.  Does anybody know a solution on how to do this?  I've purchased Verbb's Feed Me plugin but unfortunately it doesn't include importing to custom element types.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-01-02T18:47:02.047" Title="amforms: Import form submissions from one site into another" Tags="&lt;database&gt;&lt;migration&gt;&lt;plugin-amforms&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23354" PostTypeId="2" ParentId="23351" CreationDate="2018-01-02T18:50:17.873" Score="4" Body="&lt;p&gt;The &quot;Position&quot; field type is retired in Craft 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use this: &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/button-box&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://plugins.supercooldesign.co.uk/plugin/button-box&lt;/a&gt;, or this &lt;a href=&quot;https://github.com/Rias500/craft3-position-fieldtype&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft3-position-fieldtype&lt;/a&gt; instead, or just use plain old dropdowns. &lt;/p&gt;&#xA;" OwnerUserId="5905" LastEditorUserId="45" LastEditDate="2018-01-02T21:11:01.463" LastActivityDate="2018-01-02T21:11:01.463" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23355" PostTypeId="2" ParentId="23304" CreationDate="2018-01-02T22:37:59.787" Score="2" Body="&lt;p&gt;Assuming your lineItem variable is called &lt;code&gt;item&lt;/code&gt;, you're looking for&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;item.purchasable.stock&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also need to pay attention to &lt;code&gt;maxQty&lt;/code&gt; which is the maximum number of a purchasable item that a user is allowed to buy. I limit customers to a maximum of 10 and create a select box on the basket form with a Remove option at the bottom:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set maxQuantity = item.purchasable.stock &amp;gt; 10 ? 10 : item.purchasable.stock %}&#xA;{% if item.purchasable.maxQty %}&#xA;    {% set maxQuantity = maxQuantity &amp;gt; item.purchasable.maxQty ? item.purchasable.maxQty : maxQuantity %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;select name=&quot;qty&quot;&amp;gt;&#xA;    {% for i in 1..maxQuantity %}&#xA;        &amp;lt;option value=&quot;{{ i }}&quot; {{ i == item.qty ? 'selected' }}&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;option value=&quot;0&quot;&amp;gt;Remove&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="536" LastActivityDate="2018-01-02T22:37:59.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23356" PostTypeId="1" AcceptedAnswerId="23425" CreationDate="2018-01-03T01:14:03.793" Score="1" ViewCount="749" Body="&lt;p&gt;I have installed composer successfully but when I try to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require craftcms/plugin-installer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- craftcms/cms 3.0.0-RC4 requires craftcms/plugin-installer ~1.5.0 -&amp;gt; satisfiable by craftcms/plugin-installer[1.5.0, 1.5.1, 1.5.2] but these conflict with your requirements or minimum-stability.&#xA;- craftcms/cms 3.0.0-RC4 requires craftcms/plugin-installer ~1.5.0 -&amp;gt; satisfiable by craftcms/plugin-installer[1.5.0, 1.5.1, 1.5.2] but these conflict with your requirements or minimum-stability.&#xA;- craftcms/cms 3.0.0-RC4 requires craftcms/plugin-installer ~1.5.0 -&amp;gt; satisfiable by craftcms/plugin-installer[1.5.0, 1.5.1, 1.5.2] but these conflict with your requirements or minimum-stability.&#xA;- Installation request for craftcms/cms 3.0.0-RC4 -&amp;gt; satisfiable by craftcms/cms[3.0.0-RC4].&#xA;&#xA;Installation failed, reverting ./composer.json to its original content.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried the following with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require craftcms/plugin-installer --ignore-platform-regs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note my composer.json file shows the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&#xA;&quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;&quot;repositories&quot;: [&#xA;    {&#xA;        &quot;type&quot;: &quot;composer&quot;,&#xA;        &quot;url&quot;: &quot;https://asset-packagist.org&quot;&#xA;    }&#xA;],&#xA;&quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;:{&#xA;        &quot;php&quot;:&quot;7.1.1&quot;&#xA;    }&#xA;},&#xA;&quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.0-RC4&quot;&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated! On a side note this is a local install using Mamp Pro.&lt;/p&gt;&#xA;" OwnerUserId="7387" LastActivityDate="2018-11-02T18:42:46.647" Title="Composer conflict when installing craftcms/plugin-installer" Tags="&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23357" PostTypeId="1" CreationDate="2018-01-03T10:49:24.687" Score="1" ViewCount="1117" Body="&lt;p&gt;I have a problem when updating with Composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My installation command line was this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php composer.phar create-project -s RC craftcms/craft $HOME/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As such, I tried to update, as per Ryan from Mijingo instructions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php composer.phar update craftcms/craft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I ended up with the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Composer could not find a composer.json file in /home/me&#xA;To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ &quot;Getting Started&quot; section&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I checked, &lt;code&gt;composer.json&lt;/code&gt; and &lt;code&gt;composer.lock&lt;/code&gt; are in the &lt;code&gt;craft&lt;/code&gt; directory, as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After looking through Composer &lt;code&gt;man&lt;/code&gt; page and web docs, I am still clueless, as I haven't found what &lt;code&gt;-s RC&lt;/code&gt; are used for in the installation command. I believe understanding these (this?) switches is probably the key, but I rather ask here than making a mistake and blowing the otherwise perfectly working install. ^^&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the CP, it doesn't work either, but that is not a surprise given the command line didn't and that I am using the &lt;code&gt;php composer.phar&lt;/code&gt; method rather than the sole &lt;code&gt;composer&lt;/code&gt; one.&lt;/p&gt;&#xA;" OwnerUserId="7780" LastActivityDate="2018-01-04T21:01:33.193" Title="Updating Craft 3 from RC3 to RC4 through Composer" Tags="&lt;craft3&gt;&lt;updating&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23358" PostTypeId="1" AcceptedAnswerId="23364" CreationDate="2018-01-03T11:03:20.150" Score="1" ViewCount="126" Body="&lt;p&gt;Trying to publish changes in one of 3 locales of an entry gives error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Internal Server Error&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1030 Got error 139 from storage engine&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It is basically a row size problem.&lt;/p&gt;&#xA;&lt;p&gt;The entry has many fields and there are 3 locales. It is possible to save a draft of the changes made.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What i tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;On staging server I have solved the problem with changing the database config&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;innodb_file_per_table=1&lt;/p&gt;&#xA;&lt;p&gt;innodb_file_format = Barracuda&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;and then changing row format of some tables (entries, content and fields) to compressed.&lt;/p&gt;&#xA;&lt;p&gt;This is not possible on live production server since host does not allow it. And also it probably is not the best solution.&lt;/p&gt;&#xA;&lt;p&gt;I also tried to change the table engine to MyISAM but this gave error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;SQL Error [1217] [23000]: Cannot delete or update a parent row: a foreign key constraint fails&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I hope there is a simple solution to all this.&lt;br /&gt;&#xA;Thank you for your help, I am a bit green in all this, my background is in design.&lt;/p&gt;&#xA;" OwnerUserId="7755" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-01-03T18:52:33.933" Title="Publishing entry returns Internal Server Error (1030 Got error 139)" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23359" PostTypeId="2" ParentId="23030" CreationDate="2018-01-03T11:21:38.797" Score="1" Body="&lt;p&gt;The free shipping flag on individual products stops costs being calculated by any shipping rule that is a &lt;code&gt;per item rate&lt;/code&gt; or &lt;code&gt;weight rate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://craftcommerce.com/docs/product-model#freeshipping&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/product-model#freeshipping&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-01-03T11:21:38.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23360" PostTypeId="1" CreationDate="2018-01-03T11:28:37.877" Score="3" ViewCount="653" Body="&lt;p&gt;I have a need to list a set of entries 9 at a time but with a random order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pagination happens via Ajax, with each next set of 9 entries loaded onto the page when the user clicks the &quot;See more&quot; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fetching the entries with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;        section: 'customers',&#xA;        limit: 9,&#xA;        order: 'Rand()',&#xA;    })&#xA;    as pageInfo, pageEntries&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then looping through the set and outputting as normal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for customers in pageEntries %}&#xA;    &amp;lt;div&amp;gt;{{ customers.title }}&amp;lt;/div&amp;gt;&#xA;    etc.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then adding a button to load the next set of results&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot; data-page=&quot;{{ pageInfo.currentPage }}&quot;&amp;gt;See more&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought I had this figured out but I'm seeing some duplication in the returned entries. Oddly it doesn't feel like there is &lt;em&gt;enough&lt;/em&gt; duplication to make me think my method is wrong. From about 100 entries, showing 9 at a time I might see 1 or 2 duplicates at most.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;code&gt;order: 'Rand()'&lt;/code&gt; from my criteria then it all works fine (except obviously not in a randomised order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why am I seeing duplicates? If the randomisation was applied &lt;em&gt;after&lt;/em&gt; 9 entries were retrieved then surely the first set of 9 would always be the same entries in random order. Likewise the second set, third set etc. Which isn't the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if the randomisation is applied to the entire set of entries before the set of 9 is returned then why would there be duplications?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I suppose the randomisation occurs on the full set every time and 9 entries are returned. But if this was the case surely I'd see more duplications.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-07T17:12:22.273" Title="Pagination with randomly ordered entries" Tags="&lt;entries&gt;&lt;pagination&gt;&lt;random&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23361" PostTypeId="2" ParentId="23357" CreationDate="2018-01-03T11:32:15.423" Score="1" Body="&lt;p&gt;So, not all hosts allow just using &lt;code&gt;composer&lt;/code&gt; and impose to use &lt;code&gt;php composer.phar&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that, I can now answer my two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When installing Craft using &lt;code&gt;php composer.phar create-project -s RC craftcms/craft $HOME/craft&lt;/code&gt;, the &lt;code&gt;-s&lt;/code&gt; switch is just telling which branch of the source project to use. Here, &lt;code&gt;RC&lt;/code&gt; stands for &lt;code&gt;Release Candidate&lt;/code&gt;. Before that, we had to use &lt;code&gt;-s BETA&lt;/code&gt; in order to install the betas. Something I didn't knew since I waited for the RC to jump in Craft 3 and start over from Craft 2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you want to update using &lt;code&gt;php composer.Phar&lt;/code&gt;, you need to go inside your project folder (where you installed Craft; &lt;code&gt;craft&lt;/code&gt; for me which means once logged I had to &lt;code&gt;cd craft&lt;/code&gt;) and then type &lt;code&gt;php ../composer.phar update&lt;/code&gt;, where &lt;code&gt;../composer.phar&lt;/code&gt; tells to go looking for Composer from the parent folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am ashamed not having thought of that; I really need to stop overthinking things.&lt;/p&gt;&#xA;" OwnerUserId="7780" LastEditorUserId="7780" LastEditDate="2018-01-04T21:01:33.193" LastActivityDate="2018-01-04T21:01:33.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23363" PostTypeId="1" AcceptedAnswerId="23366" CreationDate="2018-01-03T13:48:45.260" Score="2" ViewCount="56" Body="&lt;p&gt;I have a form built with Sprout forms that has a few radio button fields, all with numeric values. I'm looking to provide the total sum of these fields to a hidden/invisible field upon submit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to provide the value of the radio button field directly to the Invisible Field Value using twig syntax? Or should I just go the scripting route and use jQuery to update the hidden/invisible field's value?&lt;/p&gt;&#xA;" OwnerUserId="6636" LastActivityDate="2018-01-04T02:01:09.863" Title="Pass radio button values to invisible field in Sprout forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23364" PostTypeId="2" ParentId="23358" CreationDate="2018-01-03T18:52:33.933" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I also tried to change the table engine to MyISAM&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That won't work because Craft relies on foreign key constraints that InnoDB provides and MyISAM doesn't support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be some server config/changes you can do to address the issue, but because you're bumping into MySQL/InnoDB limitations, I'd try to address this from an information architecture point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. You've likely got a lot of fields that are probably ending up as &lt;code&gt;text&lt;/code&gt; data types in MySQL.  Can you change those to fields that use &lt;code&gt;varchar&lt;/code&gt; instead?  Can you logically break up the fields so they make sense inside of a Matrix field?  Matrix fields get their content stored in their own table outside of the main &lt;code&gt;craft_content&lt;/code&gt; table, which is where you're likely running into that error.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-03T18:52:33.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23365" PostTypeId="1" CreationDate="2018-01-03T23:40:00.027" Score="1" ViewCount="736" Body="&lt;p&gt;I have a checkout page where a user puts in their shipping address. At the bottom is a checkmark which by default sets the shipping address to be the same as the billing address. This however does not work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; class=&quot;sameAddressValue&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;use-same-address&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;sameAddress&quot;&amp;gt;&amp;lt;input id=&quot;sameAddress&quot; name=&quot;sameAddress&quot; type=&quot;checkbox&quot; checked=&quot;checked&quot;/&amp;gt;&#xA;    &amp;lt;span class=&quot;label-body&quot;&amp;gt;Use same address for billing&amp;lt;/span&amp;gt;&#xA;  &amp;lt;/label&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the checkmark is unchecked the sameAddress value is set to 0, the billing address fields appear and you can type in a different billing address. This does work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using sameAddress = 1 as advised in the documentation but it doesn't seem to work. Here's the relevant js that toggles the billing address and same address value. Is hiding he billing address fields causing some sort of error?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $(&quot;#sameAddress&quot;).change(function (e) {&#xA;        $('.billingAddress').toggleClass('hidden');&#xA;        if (this.checked) {&#xA;            $('.required-toggle').removeAttr('required');&#xA;            $('.sameAddressValue').val(1);&#xA;        } else{&#xA;            $('.required-toggle').attr('required', '');&#xA;            $('.sameAddressValue').val(0);&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Adding all the form code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/checkout/payment&quot;/&amp;gt;&#xA;&#xA;        {{ getCsrfInput() }}&#xA;&#xA;        &amp;lt;h3&amp;gt;Delivery address&amp;lt;/h3&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;half-width&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;shippingAddress-firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-firstName&quot; name=&quot;shippingAddress[firstName]&quot; pattern=&quot;.{2,}&quot; required value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;shippingAddress-lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-lastName&quot; name=&quot;shippingAddress[lastName]&quot; required value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;shippingAddress-businessName&quot;&amp;gt;Company (optional)&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-businessName&quot; name=&quot;shippingAddress[businessName]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; value=&quot;{{ cart.email }}&quot; name=&quot;email&quot; required placeholder=&quot;example@site.com&quot;/&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;shippingAddress-phone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-phone&quot; class=&quot;u-full-width&quot; placeholder=&quot;020 7946 0123&quot; name=&quot;shippingAddress[phone]&quot; required value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;        &amp;lt;div class=&quot;field clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;shippingAddress-address1&quot;&amp;gt;Address 1&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-address1&quot; name=&quot;shippingAddress[address1]&quot; required value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;field clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;shippingAddress-address2&quot;&amp;gt;Address 2&amp;lt;/label&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-address2&quot; name=&quot;shippingAddress[address2]&quot; value=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;half-width&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;shippingAddress-city&quot;&amp;gt;City&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-city&quot; name=&quot;shippingAddress[city]&quot; required value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;shippingAddress-postCode&quot;&amp;gt;Post Code&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-postCode&quot; name=&quot;shippingAddress[postCode]&quot; maxlength=&quot;8&quot; required value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;field clear&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;shippingAddress-countryId&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;            &amp;lt;select class=&quot;address-country u-full-width form-control input-sm&quot; id=&quot;shippingAddress-countryId&quot; name=&quot;shippingAddress[countryId]&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;77&quot;&amp;gt;United Kingdom&amp;lt;/option&amp;gt;&#xA;            &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {# Use same address button #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; class=&quot;sameAddressValue&quot; value=&quot;1&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;use-same-address&quot;&amp;gt;&#xA;            &amp;lt;label for=&quot;sameAddress&quot;&amp;gt;&amp;lt;input id=&quot;sameAddress&quot; name=&quot;sameAddress&quot; type=&quot;checkbox&quot; checked=&quot;checked&quot;/&amp;gt;&amp;lt;span class=&quot;label-body&quot;&amp;gt;Use same address for&#xA;        billing&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;billingAddress hidden&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;Billing address&amp;lt;/h3&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;half-width&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;billingAddress-firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; id=&quot;billingAddress-firstName&quot; name=&quot;billingAddress[firstName]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;billingAddress-lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; id=&quot;billingAddress-lastName&quot; name=&quot;billingAddress[lastName]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;billingAddress-businessName&quot;&amp;gt;Company (optional)&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;billingAddress-businessName&quot; name=&quot;billingAddress[businessName]&quot; value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; value=&quot;{{ cart.email }}&quot; name=&quot;email&quot; placeholder=&quot;email@site.com&quot;/&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field  clear&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;billingAddress-phone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; id=&quot;billingAddress-phone&quot; class=&quot;u-full-width&quot; name=&quot;billingAddress[phone]&quot; value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;            &amp;lt;div class=&quot;field clear&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;billingAddress-address1&quot;&amp;gt;Address 1&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; id=&quot;billingAddress-address1&quot; name=&quot;billingAddress[address1]&quot; value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field clear&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;billingAddress-address2&quot;&amp;gt;Address 2&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;billingAddress-address2&quot; name=&quot;billingAddress[address2]&quot; value=&quot;&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;half-width&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;billingAddress-city&quot;&amp;gt;City&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;required-toggle&quot; type=&quot;text&quot; id=&quot;billingAddress-city&quot; name=&quot;billingAddress[city]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;billingAddress-postCode&quot;&amp;gt;Post Code&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input class=&quot;required-toggle post-code&quot; type=&quot;text&quot; id=&quot;billingAddress-postCode&quot; name=&quot;billingAddress[postCode]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;field&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;billingAddress-countryId&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;                &amp;lt;select class=&quot;address-country u-full-width form-control input-sm&quot; id=&quot;billingAddress-countryId&quot; name=&quot;billingAddress[countryId]&quot;&amp;gt;&#xA;                    &amp;lt;option value=&quot;77&quot;&amp;gt;United Kingdom&amp;lt;/option&amp;gt;&#xA;                &amp;lt;/select&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;continue-button-wrapper&quot;&amp;gt;&#xA;            &amp;lt;input class=&quot;continue button&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="2158" LastEditDate="2018-01-04T16:12:16.217" LastActivityDate="2018-01-04T16:12:16.217" Title="How to make the shipping address and billing address the same?" Tags="&lt;plugin-craftcommerce&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23366" PostTypeId="2" ParentId="23363" CreationDate="2018-01-04T02:01:09.863" Score="0" Body="&lt;p&gt;Two potential ways to address this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Setup a Sprout Fields &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hidden Field&lt;/a&gt; and add javascript to your page (or in your form template using Template Overrides) to calculate the values and submit the calculated value with the rest of the form.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom front-end field&lt;/a&gt; integration that is aware of the Radio Button fields that you need to process and have that field calculate and display the result of those values. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first approach is probably the easiest approach and should work fine if you're sending your submissions via email and if it's unlikely that anybody will be editing the Radio Button fields in the CP.  The second approach may be more robust if there is a chance the Radio Buttons ever get edited and the Total Field needs to get recalculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Side Note: The Invisible Field won't work in this use case right now as you want to calculate values based on the submitted form values. The Invisible Field lets you pass it dynamic values as the page loads but at that time the page would not have any info on the values of the Radio Buttons.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-04T02:01:09.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23367" PostTypeId="1" AcceptedAnswerId="23368" CreationDate="2018-01-04T02:11:20.660" Score="1" ViewCount="36" Body="&lt;p&gt;I'm using the technique for creating an archive that's in the Craft docs: &lt;a href=&quot;https://craftcms.com/support/entry-archive&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entry-archive&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm archiving by day, so my code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set agendaEntries = craft.entries.section('agenda').status('live,pending,expired').limit(null) %}&#xA;&#xA;{% for day, entriesInDay in agendaEntries | group('postDate.day') %}&#xA;  &amp;lt;h2&amp;gt;{{ day | date('Y-m-d') }}&amp;lt;/h2&amp;gt;&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for entry in entriesInDay %}&#xA;       &amp;lt;li&amp;gt;&#xA;          {# entry data #}&#xA;       &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The looping and grouping (heh) works great, but the &lt;code&gt;{{ day }}&lt;/code&gt; variable doesn't correctly output the date, instead I get the day-before-Epoch date (1969-12-31).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really understand how the &lt;code&gt;for&lt;/code&gt; loop even knows what the &lt;code&gt;day&lt;/code&gt; variable is, so I don't know how to troubleshoot.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-01-04T07:24:40.570" Title="Archive Not Returning Correct Date Variable" Tags="&lt;forloop&gt;&lt;group&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23368" PostTypeId="2" ParentId="23367" CreationDate="2018-01-04T07:18:16.550" Score="2" Body="&lt;p&gt;Your &lt;code&gt;postDate.day&lt;/code&gt; will output the number of the day in the month so if your entries &lt;code&gt;postdate&lt;/code&gt; is 02.dd.yyyy your output is &lt;code&gt;2&lt;/code&gt;. Your array index will be something like &lt;code&gt;[2, 3, 5, 12, 31]&lt;/code&gt; thus these values will be converted from the timestamp into a readable day with&lt;code&gt;&amp;lt;h2&amp;gt;{{ day | date('Y-m-d') }}&amp;lt;/h2&amp;gt;&lt;/code&gt;. The first timestamp (0) is &lt;code&gt;01.01.1970&lt;/code&gt; because of your timezone you'll see only values around this date since you convert all the day numbers from 1-31 as timestamps to your given format. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you did not know: the &lt;code&gt;day&lt;/code&gt; variable represents only the keys of the array and with &lt;code&gt;| group('postDate.day')&lt;/code&gt; you define the keys. I think your goal is to have keys like &lt;code&gt;[ 'Monday', 'Tuesday'.... 'Sunday']&lt;/code&gt;. Your filter will look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for day, entriesInDay in agendaEntries | group('postDate|date('l')') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-04T07:24:40.570" LastActivityDate="2018-01-04T07:24:40.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23369" PostTypeId="2" ParentId="23365" CreationDate="2018-01-04T07:40:25.497" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/update-cart-addresses#summary&quot; rel=&quot;nofollow noreferrer&quot;&gt;Docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As you can see from both examples, the &lt;strong&gt;shipping address&lt;/strong&gt; is &lt;strong&gt;always&lt;/strong&gt; submitted, and the &lt;strong&gt;billingAddress&lt;/strong&gt; can either be also included, or set to the same address as the shipping address with the sameAddress param.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The shippings address is always submitted -&gt; the billing address can be included or not &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At the bottom is a checkmark which by default sets the shipping address to be the same as the billing address. This however does not work.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You set the &lt;strong&gt;shipping address&lt;/strong&gt; like &lt;strong&gt;billing address&lt;/strong&gt; which is the other way around and won't work unless you change the logic&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-04T07:40:25.497" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23370" PostTypeId="1" AcceptedAnswerId="23375" CreationDate="2018-01-04T14:10:11.980" Score="1" ViewCount="342" Body="&lt;p&gt;Craft v2.6.x&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to write a plugin to grab thumbnails of PDFs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my stand alone php code with imagemagick on server working like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$im = new Imagick();&#xA;$pdf = 'assets/documents/resources/after-release-impact-seafarers.pdf';&#xA;&#xA;$im-&amp;gt;setResolution(300,300);&#xA;//$im-&amp;gt;setCompressionQuality(95);&#xA;//$im-&amp;gt;scaleImage(200,0);&#xA;$im-&amp;gt;readimage($pdf . '[0]');&#xA;$im-&amp;gt;setImageFormat('jpeg');&#xA;//$im-&amp;gt;resizeImage( 640, 905, imagick::FILTER_POINT, 1 );&#xA;//$im-&amp;gt;resizeImage( 400, 565, imagick::FILTER_POINT, 1 );&#xA;$im-&amp;gt;resizeImage( 180, 232, imagick::FILTER_POINT, 1 );&#xA;&#xA;$im-&amp;gt;writeImage('1a2w12thumb.jpg');&#xA;$im-&amp;gt;clear();&#xA;$im-&amp;gt;destroy();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, how can I load imagemagick - which works on the server in my PDF thumbnail plugin class function?&#xA;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $im = new \Imagick();&#xA;&#xA;    $im-&amp;gt;setResolution(300,300);&#xA;    $im-&amp;gt;readimage($pdfAsset . '[0]');&#xA;    $im-&amp;gt;setImageFormat('jpeg');&#xA;    $im-&amp;gt;resizeImage( 640, 905, imagick::FILTER_POINT, 1 );&#xA;    $im-&amp;gt;writeImage($pdfAsset-&amp;gt;writepath.$pdfAsset-&amp;gt;filename . '.jpg');&#xA;    $im-&amp;gt;clear();&#xA;    $im-&amp;gt;destroy();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But none of the functions for imagemagick work:&#xA;Eg. error i get is Class 'Craft\imagick' not found&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a namespace issue with the imagine library? (I sound like I know what I am talking about but I am not sure I do!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to include/ use native imagemagick on server in Craft?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2018-01-04T18:28:40.727" LastActivityDate="2018-01-04T18:37:08.103" Title="How to include and use native imagemagick on server in Craft?" Tags="&lt;plugin-development&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23372" PostTypeId="1" AcceptedAnswerId="23373" CreationDate="2018-01-04T15:38:12.520" Score="1" ViewCount="236" Body="&lt;p&gt;I have a json file with a bunch of id's &amp;amp; associated images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The id's relate to existing entries in my Craft installation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matrix field called Content with a block type called allImages - the allImages block type has a single field called images defined as an Asset field type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is import the json file &amp;amp; update the existing entries with the images as defined in the json.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot for the life of me figure out how to add images to the Matrix field in code. There are plenty of samples around submitting post variables from a custom form to the saveEntry action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips would be greatly appreciated &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2018-01-04T16:12:32.637" Title="How do I programmatically add assets to an assets fieldtype on a Matrix" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;matrix&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23373" PostTypeId="2" ParentId="23372" CreationDate="2018-01-04T15:50:15.170" Score="2" Body="&lt;p&gt;This is totally untested but something like this could work (or at least give you some hints)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; since I was bored I tested the code.. it works&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionImport(){&#xA;    $jsonData = // getYouJsonDatasomehow here&#xA;    foreach($jsonData as $json){&#xA;        $entry = craft()-&amp;gt;elements-&amp;gt;getElementById($json['id']);&#xA;        /** @var \Craft\MatrixBlockModel[] $matrix */&#xA;        $matrix = $entry-&amp;gt;Content-&amp;gt;find();&#xA;        /** @var \Craft\MatrixBlockModel $block */&#xA;        foreach ($matrix as $block){&#xA;            // I pretend there is already the required block for the entry otherwise you have to create it&#xA;&#xA;            if($block-&amp;gt;getType()-&amp;gt;handle === 'allImages'){&#xA;                // long version...&#xA;                $attributes = $block-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;                $attributes['images'] = $json['imageIds'];&#xA;                // some other changes if you want... title or whatever&#xA;                $block-&amp;gt;getContent()-&amp;gt;setAttributes($attributes);&#xA;&#xA;                // short version would be&#xA;                $block-&amp;gt;getContent()-&amp;gt;setAttribute('images', $json['imageIds']);&#xA;                craft()-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;            }&#xA;        }&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since you did not say if the blocks/entries already exist or if the images even exist or if they have to be imported as well I decided to pretend everything is ready to use and your json images contain just an array of ids. If your images contains only local paths you would have to import them first with something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$arrImages = [];&#xA;foreach($json['images'] as $image){&#xA;    $path = $image['path'];&#xA;    $name = $image['name'];&#xA;&#xA;    $response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;        $yourFilePath,&#xA;        $nameOfImage,&#xA;        $folderId,&#xA;        AssetConflictResolution::Replace&#xA;    );&#xA;&#xA;    if($newFildeId = $response-&amp;gt;getResponseData()['fileId']){&#xA;        $arrImages[] = $newFildeId;&#xA;    }&#xA;}&#xA;&#xA;&#xA;$block-&amp;gt;getContent()-&amp;gt;setAttribute('images', $arrImages);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-04T16:12:32.637" LastActivityDate="2018-01-04T16:12:32.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23374" PostTypeId="2" ParentId="23360" CreationDate="2018-01-04T16:14:33.050" Score="0" Body="&lt;p&gt;Try to randomize all the entries first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries({&#xA;        section: 'customers',&#xA;        order: 'Rand()',&#xA;    })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then do the pagination:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate allEntries.limit(9) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6636" LastActivityDate="2018-01-04T16:14:33.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23375" PostTypeId="2" ParentId="23370" CreationDate="2018-01-04T18:37:08.103" Score="0" Body="&lt;p&gt;If you want to work with &lt;a href=&quot;https://secure.php.net/manual/en/class.imagick.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PECL imagick&lt;/a&gt;, which is the PHP wrapper for the &lt;a href=&quot;https://www.imagemagick.org/script/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageMagick&lt;/a&gt; library, then this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$im = new \Imagick();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not namespaced, so it exists in the global namespace, which is what the &lt;code&gt;\&lt;/code&gt; does for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-04T18:37:08.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23376" PostTypeId="2" ParentId="5399" CreationDate="2018-01-04T19:16:44.510" Score="2" Body="&lt;p&gt;This ended up being an environmental issue with semi-largish Matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The three most common culprits are your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-input-vars&quot; rel=&quot;nofollow noreferrer&quot;&gt;max_input_vars&lt;/a&gt;, &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-input-nesting-level&quot; rel=&quot;nofollow noreferrer&quot;&gt;max_input_nesting_level&lt;/a&gt; and &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.post-max-size&quot; rel=&quot;nofollow noreferrer&quot;&gt;post_max_size&lt;/a&gt; would would need to be adjusted upwards, but other settings might come into play depending on your environment an Matrix configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if your server is running anything like &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;mod_security&lt;/a&gt; or &lt;a href=&quot;https://suhosin.org/stories/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Suhosin&lt;/a&gt;, they have additional settings that might need to be adjusted higher that could affect this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-04T19:16:44.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23377" PostTypeId="1" CreationDate="2018-01-04T19:22:13.630" Score="1" ViewCount="149" Body="&lt;p&gt;Craft 2.6.2999&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two channels that I've set to structure. In my local install I can drag/drop entries no problem. HOwever on the staging server the drag drop function doesn't work - there are no handles and the entries look like they are a regular channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried changing the section type to channel and back to structure but no change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-01-04T19:22:13.630" Title="Structure not allowing drag/drop" Tags="&lt;control-panel&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2018-01-05T14:04:25.553" ContentLicense="CC BY-SA 3.0" />
  <row Id="23378" PostTypeId="1" AcceptedAnswerId="23379" CreationDate="2018-01-04T19:46:34.990" Score="2" ViewCount="108" Body="&lt;p&gt;Moderation scenario:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Registered user publishes an entry using a front-end form that sets the entry to &lt;code&gt;disabled&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Moderator receives email re new entry and changes status from &lt;code&gt;disabled&lt;/code&gt; to &lt;code&gt;enabled&lt;/code&gt; in the CP.&lt;/li&gt;&#xA;&lt;li&gt;User receives email informing them that the entry has been enabled.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I’ve got steps 2 &amp;amp; 3 working using both the Courier &amp;amp; Postmaster plugins independently. However, when the user edits their entry via another front-end-form, they also receive an email notification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the user be notified &lt;strong&gt;only&lt;/strong&gt; when the entry has been edited &lt;strong&gt;and&lt;/strong&gt; the entry's status has been changed from &lt;code&gt;disabled&lt;/code&gt; to &lt;code&gt;enabled&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Courier blueprints:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2: Triggers: &lt;code&gt;entries.onSaveEntry&lt;/code&gt; and Conditions: &lt;code&gt;{{ entry.sectionId == '3' and isNewEntry ? 'true' : 'false' }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3: Triggers: &lt;code&gt;entries.onSaveEntry&lt;/code&gt; and Conditions: &lt;code&gt;{{ entry.sectionId == '3' ? 'true' : 'false' }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="125" LastEditDate="2018-01-05T05:04:13.890" LastActivityDate="2018-01-05T05:04:13.890" Title="How can I use the Courier plugin to notify a user when an entry is enabled?" Tags="&lt;emails&gt;&lt;status&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23379" PostTypeId="2" ParentId="23378" CreationDate="2018-01-04T20:32:17.210" Score="2" Body="&lt;p&gt;In your Courier Blueprint listen to &lt;code&gt;entry.beforeSaveEntry&lt;/code&gt; events and use this code for the Trigger Condition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set oldEntry = craft.entries({&#xA;    id: entry.id,&#xA;    status: null,&#xA;}).first() %}&#xA;&#xA;{%- set wasDisabled = oldEntry.status == 'disabled' %}&#xA;{%- set isEnabled = entry.status == 'live' %}&#xA;&#xA;{{- wasDisabled and isEnabled ? 'true' : 'false' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-01-05T04:57:30.967" LastActivityDate="2018-01-05T04:57:30.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23380" PostTypeId="1" AcceptedAnswerId="23382" CreationDate="2018-01-04T20:33:43.803" Score="1" ViewCount="22" Body="&lt;p&gt;I want to add source tracking to my Craft CMS site.  Using Google Analytics I can track users through just about the entire process but can't see them as they go through account registration.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to simply add a query parameter to the &lt;code&gt;{{ link }}&lt;/code&gt; from the activation email. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that if I add &lt;code&gt;{{ link }}&amp;amp;source=test&lt;/code&gt; that the additional query param shows up, however what I really want is something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;amp;source={{ craft.request.getCookie('traffic_src') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the above solution returns the activation code and &lt;code&gt;source=&lt;/code&gt; which leads me to believe that it is undefined&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to approach this problem of accessing a cookie for a user in one of Craft's email messages.&lt;/p&gt;&#xA;" OwnerUserId="4320" LastEditorUserId="57" LastEditDate="2018-01-04T21:25:13.177" LastActivityDate="2018-01-04T21:29:06.503" Title="Access Site Cookie From Email Message" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23381" PostTypeId="2" ParentId="23139" CreationDate="2018-01-04T21:15:42.257" Score="1" Body="&lt;p&gt;The current Craft update solved the issue! Now finally I can see the content of the Plugin Store.&lt;/p&gt;&#xA;" OwnerUserId="7146" LastActivityDate="2018-01-04T21:15:42.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23382" PostTypeId="2" ParentId="23380" CreationDate="2018-01-04T21:29:06.503" Score="0" Body="&lt;p&gt;Assuming this is for Craft 2, there are a few cookie plugins that let you read and write cookie values from a Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lewisjenkins/craft-lj-cookies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/?q=cookie&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/?q=cookie&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-04T21:29:06.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23384" PostTypeId="2" ParentId="23319" CreationDate="2018-01-05T00:55:43.117" Score="1" Body="&lt;p&gt;I was able to fix it replacing the content of config/license.key by the word temp&lt;/p&gt;&#xA;" OwnerUserId="5873" LastActivityDate="2018-01-05T00:55:43.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23386" PostTypeId="1" AcceptedAnswerId="23387" CreationDate="2018-01-05T13:56:31.153" Score="1" ViewCount="934" Body="&lt;p&gt;SEOmatic puts a canonical on every page. But some pages I need to be able to add a custom canonical, but not sure how to overide SEOmatic's otherwise there will be two. &lt;/p&gt;&#xA;" OwnerUserId="5907" LastActivityDate="2018-01-05T14:33:39.280" Title="Can I add a custom canonical URL to a page if also using SEOmatic?" Tags="&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23387" PostTypeId="2" ParentId="23386" CreationDate="2018-01-05T14:13:54.477" Score="1" Body="&lt;p&gt;Like stated in the &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/02.-Rendering-your-SEO-Meta-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; you can overwrite the default template with your own one and implement your logic however you like. So you can check for certain condition if you want to use the default SEOmatic inputs or your custom one. You can create a custom template based on this file &lt;a href=&quot;https://github.com/nystudio107/seomatic/blob/master/templates/_seo_meta.twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;meta template&lt;/a&gt; and change &lt;a href=&quot;https://github.com/nystudio107/seomatic/blob/master/templates/_seo_meta.twig#L19&quot; rel=&quot;nofollow noreferrer&quot;&gt;line 19&lt;/a&gt;&#xA;from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if seomaticMeta.canonicalUrl |length %}&#xA;&amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ seomaticMeta.canonicalUrl }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.useCustomData is defined and entry.useCustomData == true%}&#xA;   &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ whatever }}&quot; /&amp;gt;&#xA;{% else %} &#xA;    {% if seomaticMeta.canonicalUrl |length %}&#xA;        &amp;lt;link rel=&quot;canonical&quot; href=&quot;{{ seomaticMeta.canonicalUrl }}&quot; /&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-05T14:13:54.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23388" PostTypeId="2" ParentId="23386" CreationDate="2018-01-05T14:33:39.280" Score="2" Body="&lt;p&gt;Robin's answer above is valid, but I have managed to create an override in my main _layout template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.canonicalUrl|length &amp;gt; 0 %}&#xA;    {% set seomaticMeta = seomaticMeta | merge({'canonicalUrl': entry.canonicalUrl}) %}&#xA;{% endif %}&#xA;&#xA;{% hook 'seomaticRender' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5907" LastActivityDate="2018-01-05T14:33:39.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23389" PostTypeId="1" CreationDate="2018-01-05T15:47:30.480" Score="1" ViewCount="547" Body="&lt;p&gt;Or is one pro license enough? We're running a stage environment and a production environment for the same website. Thoughts? &lt;/p&gt;&#xA;" OwnerUserId="7814" LastActivityDate="2018-01-05T16:14:31.580" Title="Do I need 2 licenses for staging and production" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23390" PostTypeId="2" ParentId="23389" CreationDate="2018-01-05T16:07:37.017" Score="2" Body="&lt;p&gt;One is enough you don't need a license for a development server at all &lt;a href=&quot;https://craftcms.com/support/license-enforcement&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is something from FAQ as well &lt;a href=&quot;https://craftcms.com/pricing&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Is there a way I can try Craft Client or Pro out before buying?&lt;/strong&gt;&#xA;  &lt;br&gt;&lt;br&gt;Yes. As long as you’re running Craft CMS from a non-public-looking domain name (e.g. “mysite.dev” or “staging.mysite.com”), you will have the option to test the Client and Pro editions indefinitely.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And a info from the &lt;a href=&quot;https://craftcms.com/license&quot; rel=&quot;nofollow noreferrer&quot;&gt;Terms and Conditions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;3. License Agreement Model&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&#xA;  This is a single-installation license, meaning you may integrate a Licensed Copy into one public-facing (“Internet”) or internal (“intranet”) web root directory at a time (the “Website”). &lt;strong&gt;You may also install and use Craft without limitation for local development and testing purposes.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-05T16:14:31.580" LastActivityDate="2018-01-05T16:14:31.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23391" PostTypeId="1" AcceptedAnswerId="23420" CreationDate="2018-01-05T17:52:58.317" Score="1" ViewCount="780" Body="&lt;p&gt;I'm new to Composer and am using a Mac along with MAMP as a local web server. I've installed Composer but it's referencing an old PHP 5 version that must be the default on my Mac.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to install Craft 3 via Composer by adding the --ignore-platform-reqs flag as per &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html#downloading-with-composer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/installation.html#downloading-with-composer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft 3 starter project files were all added successfully. However, at the end of the install output in terminal was the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@php craft setup/welcome&#xA;Craft requires PHP 7.0 or later.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I navigate to the project install directory and try running ./craft setup I get the same message &quot;Craft requires PHP 7.0 or later&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The installation docs did say you could alternatively edit the .env file directly, so I entered the database details in there instead. But when I went to access the browser install wizard, I got errors about the security key being missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I worked around that by just generating a random 32 character string myself and entering this for the SECURITY_KEY setting in the .env file &amp;amp; was then able to complete the install wizard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm wondering if that is OK to do? I'm concerned that there may be a particular format needed etc and that just pasting in my own key could cause issues down the line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I'd prefer to be able to just complete the standard setup via terminal instead and have the key config automatically set there. Is there a way I can get the craft setup command to use the newer PHP 7+ available from MAMP? Or is there an easy way to update the default PHP version Composer references without disturbing the rest of my Mac?&lt;/p&gt;&#xA;" OwnerUserId="135" LastEditorUserId="9" LastEditDate="2018-11-02T18:53:05.293" LastActivityDate="2018-11-02T18:53:05.293" Title="Problem setting security key when installing Craft 3" Tags="&lt;php&gt;&lt;craft3&gt;&lt;install&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23392" PostTypeId="2" ParentId="20016" CreationDate="2018-01-05T18:31:10.350" Score="1" Body="&lt;p&gt;This happened to me and London is relatively new and unsupported at one point, try changing the location to Oregon to see if this works&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-01-05T18:31:10.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23394" PostTypeId="1" CreationDate="2018-01-05T23:52:32.597" Score="1" ViewCount="32" Body="&lt;p&gt;Has anyone had success using the Group filter with Squarebit Charge? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a few different approaches, in each case getting array errors. Here is code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCharges = craft.charge.charges.limit(3)|group('cardName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% for cardName, details in allCharges %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cardName }}&#xA;&#xA;{% for details in allCharges %} &#xA;    {{ details.dateCreated }}...and more fields&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;{% endfor %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This throws an error message &lt;em&gt;&quot;Key &quot;dateCreated&quot; for array with keys &quot;0&quot; does not exist.&quot;&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I dump(details) I see an array that looks like all the fields you would expect, including &quot;dateCreated&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2018-01-08T00:15:27.453" LastActivityDate="2018-01-08T00:16:10.493" Title="Using the Group filter with Squarebit Charge plugin" Tags="&lt;plugin-charge&gt;&lt;group&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23395" PostTypeId="1" AcceptedAnswerId="23410" CreationDate="2018-01-06T15:21:37.560" Score="1" ViewCount="197" Body="&lt;p&gt;I want to iterate through my entries on the click of a 'next' and 'previous' button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have started off using getNext() and getPrev() by I'm in a bit of a rut.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('comics').first() %}&#xA;{% set asset = entry.comic.first() %}&#xA;{% set params = craft.entries.section('comics').order('id asc') %}&#xA;{% set prevEntry = entry.getPrev(params) %}&#xA;{% set prevAsset = prevEntry.comic.first() %}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;{% set nextAsset = nextEntry.comic.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the Twig code. To display the prevEntry I have been using jQuery. Here is that code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    function prevComic() {&#xA;      var $prevTitle = &quot;{{ prevEntry.title }}&quot;;&#xA;      $(&quot;.comic-title&quot;).text($prevTitle);&#xA;      $(&quot;.comic&quot;).attr('src', '{{ prevAsset.url }}');&#xA;      $(&quot;.comic-caption&quot;).text(&quot;{{ prevEntry.body }}&quot;);&#xA;    };&#xA;    function nextComic() {&#xA;      var $nextTitle = &quot;{{ nextEntry.title }}&quot;;&#xA;      $(&quot;.comic-title&quot;).text($nextTitle);&#xA;      $(&quot;.comic&quot;).attr('src', '{{ nextAsset.url }}');&#xA;      $(&quot;.comic-caption&quot;).text(&quot;{{ nextEntry.body }}&quot;);&#xA;    };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I'm using onclick() on the buttons to call the functions. &#xA;All I really want is for the 'previous' button to give me the previous entry to the entry currently displayed, and for the 'next' button to give me the next entry to the entry currently displayed. &#xA;Can anyone help me?&#xA;Thank you :) &lt;/p&gt;&#xA;" OwnerUserId="7425" LastActivityDate="2018-01-08T16:48:13.280" Title="How can I iterate through my entries?" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23396" PostTypeId="2" ParentId="23394" CreationDate="2018-01-06T19:08:33.917" Score="1" Body="&lt;p&gt;I got this to work with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allCharges = craft.charge.charges.limit(5) %}&#xA;{% set charges = allCharges|group(&quot;dateCreated|date('F')&quot;) %}&#xA;&#xA;{% for month, details in charges %}&#xA;    &amp;lt;div&amp;gt;   &#xA;        {{ month }}&#xA;&#xA;        {% for detail in details %}&#xA;            &amp;lt;p&amp;gt;{{detail.id}}{{detail.customerName}}&amp;lt;/p&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two things to note: the group filter was applied to the results of the Charges query, rather than applying it to the query itself; the second issue is that the Charge model contains sub-models,which will require an inner loop. &lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2018-01-08T00:16:10.493" LastActivityDate="2018-01-08T00:16:10.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23397" PostTypeId="1" CreationDate="2018-01-06T23:42:56.570" Score="3" ViewCount="3626" Body="&lt;p&gt;I am quite new in Craft CMS 3. I have developed a new site and now I want to move it to the production server. I have just moved all the files by FTP, moved the database, changed .env variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bRuE5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bRuE5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I go to the URL I get a message: &quot;Forbidden You don't have permission to access / on this server.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to URL/web then I get the first page but without images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL/admin shows &quot;Not Found The requested URL /admin was not found on this server.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I deploy the site? I cannot find a good article/help about deployment for Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="6781" LastActivityDate="2018-03-21T14:24:40.090" Title="Deployment of Craft 3 site to the production server" Tags="&lt;craft3&gt;&lt;deployment&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23398" PostTypeId="2" ParentId="23397" CreationDate="2018-01-07T00:20:35.383" Score="1" Body="&lt;p&gt;This article might be useful to you; there is a section on how to deploy Craft CMS 3 as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also recently did a podcast on &lt;a href=&quot;https://devmode.fm/episodes/website-deployment-without-tears&quot; rel=&quot;nofollow noreferrer&quot;&gt;Website Deployment without Tears&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-21T14:24:40.090" LastActivityDate="2018-03-21T14:24:40.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23399" PostTypeId="1" CreationDate="2018-01-07T14:49:54.497" Score="1" ViewCount="55" Body="&lt;p&gt;I have a Sprout form with table field. I'm trying to fill it as native Entry form table field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[tableField]&quot; value=&quot;&quot;&amp;gt;        &#xA;&amp;lt;textarea name=&quot;fields[tableField][0][col1]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[tableField][0][col2]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&amp;lt;textarea name=&quot;fields[tableField][0][col3]&quot; rows=&quot;1&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The data in the table is saved correctly, but after submitting the form, I get an error: &lt;strong&gt;Array to string conversion...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tell me please what is the problem.&#xA;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NYHnG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NYHnG.png&quot; alt=&quot;error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6238" LastEditorUserId="6238" LastEditDate="2018-01-08T09:10:04.560" LastActivityDate="2018-01-08T09:10:04.560" Title="Populating tables using Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23400" PostTypeId="1" AcceptedAnswerId="23470" CreationDate="2018-01-07T17:16:30.190" Score="1" ViewCount="666" Body="&lt;p&gt;What could be the reason for this error when I’m targeting a global field?: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Impossible to access an attribute (&quot;footer&quot;) on a boolean variable (&quot;&quot;).&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a global set &lt;em&gt;Footer&lt;/em&gt; with a matrix field also named &lt;em&gt;Footer&lt;/em&gt;, I'm trying to get its content via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in footer.footer %}&#xA;  {% if block.type == &quot;column&quot; %}&#xA;    &amp;lt;div&amp;gt;&#xA;      &amp;lt;h4&amp;gt;{{ block.headline }}&amp;lt;/h4&amp;gt;&#xA;      &amp;lt;div&amp;gt;{{ block.columnContent }}&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7146" LastEditorUserId="7146" LastEditDate="2018-01-08T15:56:06.980" LastActivityDate="2018-01-11T20:34:16.473" Title="Access global field content" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;globals&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23401" PostTypeId="1" CreationDate="2018-01-07T20:55:27.910" Score="1" ViewCount="80" Body="&lt;p&gt;I'm writing a plugin to duplicate a Structure within Craft 2.&lt;br&gt;&#xA;I've covered off duplicating the section, entry types, field layouts and can duplicate the entries, covering of the main Craft fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm completely stumped on duplicating a Neo field. I've figured out to access all the field types and content within the Neo blocks, but can't get the Neo field to validate for the new Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I'm considering dumping the SQL and using that because I've tried everything else!&lt;/p&gt;&#xA;" OwnerUserId="3984" LastActivityDate="2018-01-07T20:55:27.910" Title="Duplicating a Neo field's content" Tags="&lt;structure&gt;&lt;plugin-neo&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23402" PostTypeId="2" ParentId="23400" CreationDate="2018-01-08T00:40:53.367" Score="2" Body="&lt;p&gt;I do not see anything obviously wrong with your code, but something that has caught me out many times is a misspelling of field names, so be sure your twig code matches your field names exactly. One thing that is a bit odd is the error message references &quot;footerContent&quot;, but that does not appear in your code. &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-01-08T00:40:53.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23403" PostTypeId="2" ParentId="20016" CreationDate="2018-01-08T09:08:19.393" Score="1" Body="&lt;p&gt;Tbh I haven't bothered to test it, but this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Effect&quot;: &quot;Allow&quot;,&#xA;    &quot;Action&quot;: [&#xA;        &quot;s3:ListAllMyBuckets&quot;&#xA;    ],&#xA;    &quot;Resource&quot;: &quot;arn:aws:s3:::&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Probably should contain an asterix in the resource, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Effect&quot;: &quot;Allow&quot;,&#xA;    &quot;Action&quot;: [&#xA;        &quot;s3:ListAllMyBuckets&quot;&#xA;    ],&#xA;    &quot;Resource&quot;: &quot;arn:aws:s3:::*&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7254" LastEditorUserId="7254" LastEditDate="2018-01-08T12:22:39.333" LastActivityDate="2018-01-08T12:22:39.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23404" PostTypeId="1" CreationDate="2018-01-08T09:26:03.277" Score="3" ViewCount="410" Body="&lt;p&gt;I want to use &lt;a href=&quot;https://auth0.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auth0&lt;/a&gt; to provide a Single Sign On (SSO) for a couple of services I am integrating, one of which is Craft Commerce user accounts. Does Craft Commerce allow something like Auth0 for authentication?&lt;/p&gt;&#xA;" OwnerUserId="7823" LastActivityDate="2018-01-08T10:51:23.363" Title="Can Auth0 be used for Craft Commerce user accounts?" Tags="&lt;plugin-craftcommerce&gt;&lt;permissions&gt;&lt;password&gt;&lt;authentication&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23405" PostTypeId="1" CreationDate="2018-01-08T09:46:40.607" Score="1" ViewCount="29" Body="&lt;p&gt;For some reason, &quot;special&quot; characters such as the apostrophe get converted to HTML entities in the &lt;code&gt;seoTitle&lt;/code&gt; variable, resulting in unreadable tab titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fgi4F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fgi4F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there's this &lt;code&gt;&amp;amp;#039;&lt;/code&gt; instead of a regular &lt;code&gt;'&lt;/code&gt; (what is typed into the field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use &lt;code&gt;entry.title&lt;/code&gt; instead, I get a clean and readable output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wnha6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wnha6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to get a clean output from the &lt;code&gt;seoTitle&lt;/code&gt; variable?&lt;/p&gt;&#xA;" OwnerUserId="7824" LastActivityDate="2018-01-08T09:46:40.607" Title="Sprout SEO - Characters output to decimal HTML entities" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23406" PostTypeId="2" ParentId="23404" CreationDate="2018-01-08T10:51:23.363" Score="1" Body="&lt;p&gt;Craft Commerce and Craft does not support that service out of the box. A Craft plugin would need to created using their PHP Package: &lt;a href=&quot;https://github.com/auth0/auth0-PHP&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/auth0/auth0-PHP&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-01-08T10:51:23.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23408" PostTypeId="1" AcceptedAnswerId="23456" CreationDate="2018-01-08T12:25:53.003" Score="1" ViewCount="168" Body="&lt;p&gt;I am trying to output, from a single request, a geojson structure like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &quot;type&quot;: &quot;FeatureCollection&quot;,&#xA;    &quot;features&quot;: [&#xA;        {&#xA;            &quot;type&quot;: &quot;Feature&quot;,&#xA;            &quot;properties&quot;: {},&#xA;            &quot;geometry&quot;: {&#xA;                &quot;type&quot;: &quot;MultiLineString&quot;,&#xA;                &quot;coordinates&quot;: [&#xA;                    [&#xA;                        [-1.102108, 52.671813], &#xA;                        [-1.142189,52.620366]&#xA;                    ],&#xA;                    [&#xA;                        [-1.102108, 52.671813], &#xA;                        [-1.447277, 52.939653]&#xA;                    ],&#xA;                    [&#xA;                        [-1.102108, 52.671813], &#xA;                        [-1.447277, 52.914816]&#xA;                    ],&#xA;                    [&#xA;                        [-1.102108, 52.671813], &#xA;                        [-1.884783, 52.509112]&#xA;                    ]&#xA;                ]&#xA;            }&#xA;        },&#xA;        {&#xA;            &quot;type&quot;: &quot;Feature&quot;,&#xA;            &quot;properties&quot;: {},&#xA;            &quot;geometry&quot;: {&#xA;                &quot;type&quot;: &quot;MultiPoint&quot;,&#xA;                &quot;coordinates&quot;: [&#xA;                    [-1.102108, 52.671813],&#xA;                    [-1.142189, 52.620366],&#xA;                    [-1.447277, 52.939653],&#xA;                    [-1.447277, 52.914816],&#xA;                    [-1.884783, 52.509112]&#xA;                ]&#xA;            }&#xA;        }            &#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the multilinestring part sorted, and i know how to get the data for the multipoint part, bit i cant find a way, from the single elements api endpoint, how to add the multipoint feature onto the end of the returned array / json.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my elements api endpoint :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'geojson' =&amp;gt; function() {&#xA;&#xA;        function getCoordinates(UserModel $user){&#xA;            $return = array();&#xA;            foreach ($user-&amp;gt;connections as $connection) {&#xA;                $return[] = array(array($user-&amp;gt;longitude,$user-&amp;gt;latitude),array($connection-&amp;gt;longitude,$connection-&amp;gt;latitude));&#xA;            }&#xA;            return $return;&#xA;        }&#xA;&#xA;        return [&#xA;            'elementType' =&amp;gt; ElementType::User,&#xA;            'paginate' =&amp;gt; false,&#xA;            'transformer' =&amp;gt; function(UserModel $user) {&#xA;                return [                        &#xA;                        &quot;type&quot; =&amp;gt; &quot;Feature&quot;,&#xA;                        &quot;geometry&quot; =&amp;gt; array(&quot;type&quot; =&amp;gt; &quot;MultiLineString&quot;, &quot;coordinates&quot; =&amp;gt; getCoordinates($user)),&#xA;                        &quot;properties&quot; =&amp;gt; array(&quot;name&quot; =&amp;gt; &quot;Test&quot;)&#xA;                ];&#xA;            },&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know i can probably do this using two requests, but i want to do it in one.&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="4936" LastEditDate="2018-01-08T12:40:10.953" LastActivityDate="2018-01-11T13:26:48.580" Title="Using elements-api, how do i create a geojson structure with Features within a FeatureCollections" Tags="&lt;plugin-elementapi&gt;&lt;craft-pro&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23410" PostTypeId="2" ParentId="23395" CreationDate="2018-01-08T16:48:13.280" Score="2" Body="&lt;p&gt;The way you want to achieve this won't work. Twig is just a render engine for php so you can't execute it during your runtime. You could load &lt;strong&gt;all&lt;/strong&gt; entries during the page load and create a twig filter to &lt;code&gt;json_decode&lt;/code&gt; them in order to gain access with javascript or you can do something really really nasty like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('comics').order('id asc') %}&#xA;&amp;lt;script&amp;gt;&#xA;    var entries = [];&#xA;    {% for entry in allEntries %}&#xA;        entries.push({&#xA;            title: &quot;{{ entry.title }}&quot;,&#xA;            body: &quot;{{ entry.body }}&quot;,&#xA;            url: &quot;{{ entry.getUrl() }}&quot;&#xA;            // ..... &#xA;        });&#xA;    {% endfor %}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get an array of objects in javascript. But I would not suggest this. The clean way would be to create an ajax request and fetch the entry with php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at &lt;a href=&quot;https://craftcms.stackexchange.com/a/23001/5557&quot;&gt;this&lt;/a&gt; to learn how to create an ajax request to a controller. You would have to change your controller to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSearchEntry()&#xA;{&#xA;    $id = craft()-&amp;gt;request-&amp;gt;getParam('id');&#xA;    $element = craft()-&amp;gt;elements-&amp;gt;getElementById($id);&#xA;&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = &quot;comics&quot;;&#xA;    $criteria-&amp;gt;orderBy = &quot;id asc&quot;;&#xA;    if(!$nextElement = $element-&amp;gt;getNext($criteria)){&#xA;        $this-&amp;gt;returnJson([&#xA;            'success'   =&amp;gt; false&#xA;        ]);&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJson([&#xA;        'element'      =&amp;gt; [&#xA;            'title' =&amp;gt; $nextElement-&amp;gt;title,&#xA;            'body'  =&amp;gt; $nextElement-&amp;gt;body,&#xA;            // ....&#xA;            'id'    =&amp;gt; $nextElement-&amp;gt;id&#xA;        ],&#xA;        'success'   =&amp;gt; true&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your javascript you'll create an ajax request and change the values to the one you received if it was successful (if not there will be probably no other entries.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-08T16:48:13.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23412" PostTypeId="1" AcceptedAnswerId="23414" CreationDate="2018-01-08T17:32:32.733" Score="1" ViewCount="65" Body="&lt;p&gt;I need to pass the logged-in user's &lt;em&gt;email address&lt;/em&gt; as a variable to a embedded javascript form. I think the easiest way for me to do this is to dynamically embed the user's email address in the embed code URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the javascript snippet in the HTML block would be a URL &quot;form=&lt;a href=&quot;http://www.formsite.com/formname?email=&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.formsite.com/formname?email=&lt;/a&gt;&lt;strong&gt;XXXX@XXX.COM&lt;/strong&gt;&quot; -- how can I pass the logged in user's email into that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not a web developer nor do I have a lot of experience with craft other than as an admin level user. I'm trying to accomplish this without enlisting the services of a web developer to do any custom work.&lt;/p&gt;&#xA;" OwnerUserId="7825" LastActivityDate="2018-01-08T22:09:52.853" Title="Include user information in html block" Tags="&lt;templating&gt;&lt;entries&gt;&lt;current-user&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23414" PostTypeId="2" ParentId="23412" CreationDate="2018-01-08T22:09:52.853" Score="1" Body="&lt;p&gt;There is a &lt;code&gt;currentUser&lt;/code&gt; global variable that is available to all Twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a currently logged in user, it will return that user's &lt;a href=&quot;https://craftcms.com/docs/templating/craft.users&quot; rel=&quot;nofollow noreferrer&quot;&gt;UserModel&lt;/a&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, it's just a matter of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    form=http://formsite.com/formname?email={{ currentUser.email }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, what's inside the &lt;code&gt;if&lt;/code&gt; block will look different depending on how you're generating the embedded code URL.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-08T22:09:52.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23415" PostTypeId="2" ParentId="19747" CreationDate="2018-01-08T22:19:27.160" Score="2" Body="&lt;p&gt;I did some initial attempts, and this is what I cooked up (only the safeUp() method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is probably not the best way to do this, but the way I've so far found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently it creates a field group &lt;code&gt;myFieldGroup&lt;/code&gt; with a field &lt;code&gt;fieldName&lt;/code&gt; of type Plaintext.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As others have said, you can do virtually anything with migrations, all it takes is figuring out how.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function safeUp()&#xA;{&#xA;&#xA;    $fieldGroupName = 'myFieldGroup';&#xA;    $fieldService = Craft::$app-&amp;gt;getFields();&#xA;    $fieldGroup = new FieldGroup();&#xA;&#xA;    $fieldGroup-&amp;gt;name = $fieldGroupName;&#xA;&#xA;    $fieldGroupSuccess = $fieldService-&amp;gt;saveGroup($fieldGroup);&#xA;&#xA;&#xA;    if ($fieldGroupSuccess) {&#xA;        $fieldGroupId = null;&#xA;&#xA;        // FIXME: Couldn't find a method to search for a field group by name&#xA;        $fieldGroups = $fieldService-&amp;gt;getAllGroups();&#xA;        foreach ($fieldGroups as $group) {&#xA;            if ($group-&amp;gt;name == $fieldGroupName) {&#xA;                $fieldGroupId = $group-&amp;gt;id;&#xA;            }&#xA;        }&#xA;        if (!$fieldGroupId) {&#xA;            echo &quot;Couldn't find ID for field group, aborting&quot;;&#xA;            return false;&#xA;        }&#xA;        $field = $fieldService-&amp;gt;createField([&#xA;            'type' =&amp;gt; 'craft\fields\PlainText',&#xA;            'groupId' =&amp;gt; $fieldGroupId,&#xA;            'name' =&amp;gt; 'fieldName',&#xA;            'handle' =&amp;gt; 'fieldNameHandle'&#xA;        ]);&#xA;    }&#xA;    return $fieldService-&amp;gt;saveField($field);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7254" LastActivityDate="2018-01-08T22:19:27.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23416" PostTypeId="1" CreationDate="2018-01-08T22:42:19.493" Score="0" ViewCount="237" Body="&lt;p&gt;My local image transforms successfully load in the FE but they do not load remotely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the local url where images load successfully &lt;code&gt;/uploads/case-studies/deployment-image/_caseStudyDeploymentImage/image.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the remote url where images are broken &lt;code&gt;https://www.mysite.com/cpresources/transforms/8?x=IXLDGt3eW&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has happened before but i can’t remember why or how i fixed. i have cleared asset indexes in CP Settings.&lt;/p&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2018-01-10T07:53:47.933" Title="Image transforms on remote server are broken by `cpresources/transforms` url" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-01-15T21:20:32.467" ContentLicense="CC BY-SA 3.0" />
  <row Id="23417" PostTypeId="1" CreationDate="2018-01-08T23:53:54.787" Score="1" ViewCount="77" Body="&lt;p&gt;I added an element metadata field to my Sprout setup so that I could control things and automate a bit: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/core-concepts/element-metadata-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Metadata Field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, upon saving these field layouts, Sprout wants to re-save all entries. Fair enough, I quickly went through and added the layouts to all my sections. However, I've got 8686 entries, and so far this has taken 5+ hours on a 2 CPU server on Digital Ocean where the CPU is absolutely pegged. This server has 2GB of memory, and 3/4 is reserved for php/craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems every time I saved, it created new tasks for saving all entries, new regenerating search terms (it created thousands of regen search term tasks), etc. With multi-locale support for 10+ languages, this seems like it unleashed destruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E3BAN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E3BAN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gt3po.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gt3po.png&quot; alt=&quot;Digital Ocean CPU/Memory Graphs&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CGfyl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CGfyl.png&quot; alt=&quot;Top running on CLI&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5891" LastEditorUserId="5891" LastEditDate="2018-01-09T01:18:58.140" LastActivityDate="2018-01-09T02:32:00.653" Title="Sprout SEO Re-saving Entries and metadata CPU 100%" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23418" PostTypeId="2" ParentId="23417" CreationDate="2018-01-09T02:32:00.653" Score="2" Body="&lt;p&gt;Sprout SEO is running the Craft provided &lt;code&gt;ResaveElements&lt;/code&gt; task when you save the field. The same &lt;code&gt;ResaveElements&lt;/code&gt; task will run if you resave your Section as Craft needs to make sure that if you updated the URL of a section that it saves the right URLs to the database for all entries. (Sprout SEO is doing something similar making sure it has saved metadata needed for output). We have seen sites with a large number of locales experience load when resaving all elements and have seen similar with the resaving of Sections. In all cases where we've seen this, increasing server resources has solved the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case this is just caused by a series of one-off changes where things were resaved several times in a row, you could delete the tasks from the &lt;code&gt;craft_tasks&lt;/code&gt; table and retrigger the events so they are not triggered multiple times and see if that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best long-term solution will probably be to increase the resources on your server to ensure things go smoothly.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-09T02:32:00.653" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23419" PostTypeId="1" AcceptedAnswerId="23422" CreationDate="2018-01-09T09:54:15.700" Score="1" ViewCount="229" Body="&lt;p&gt;I'm encountering a problem with how to show UK style VAT tax on an item. I've created a tax rate called VAT at 20% that is included in the taxable subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when this tax is computed on say £8,000 rather than showing the tax as 20% or 1/5th = £1,600 it shows it as 1/6th = £1,333.33. I can't figure out why the tax isn't applying properly. Settings below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nd2rs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nd2rs.png&quot; alt=&quot;Settings for UK VAT Tax rate at 20% in Craft Commerce&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2018-01-09T17:52:37.107" Title="How to compute UK style VAT in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23420" PostTypeId="2" ParentId="23391" CreationDate="2018-01-09T15:13:21.307" Score="2" Body="&lt;p&gt;Add this line to your ~/.bash_profile file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;export PATH=&quot;/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.0.0/bin:${PATH}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming your php7 version in mamp is 7.0.0 of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a link with a few more steps if you aren't sure how to edit that file - &lt;a href=&quot;https://gist.github.com/irazasyed/5987693&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/irazasyed/5987693&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2018-01-09T15:13:21.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23421" PostTypeId="2" ParentId="23391" CreationDate="2018-01-09T15:40:10.063" Score="2" Body="&lt;p&gt;Recent versions of macOS High Sierra come with PHP 7.1.7, so another option is you can try upgrading your OS.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-01-09T15:40:10.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23422" PostTypeId="2" ParentId="23419" CreationDate="2018-01-09T17:52:37.107" Score="3" Body="&lt;p&gt;Try unticking the &lt;code&gt;This tax is already included in the taxable subject&lt;/code&gt; checkbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would imagine that with this checked, Commerce assumes that the prices entered for products already have tax applied, so the tax amount is calculated on that basis, hence it being 1/6 of the total rather than 1/5.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2018-01-09T17:52:37.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23425" PostTypeId="2" ParentId="23356" CreationDate="2018-01-09T20:17:11.317" Score="2" Body="&lt;p&gt;I had the same problem following that video, i assume the ReleaseCandidate upgrade differs from the beta upgrade. Following the instructions from the craftcms github repo worked for me. &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6580" LastEditorUserId="9" LastEditDate="2018-11-02T18:42:46.647" LastActivityDate="2018-11-02T18:42:46.647" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23426" PostTypeId="1" CreationDate="2018-01-09T23:35:20.033" Score="1" ViewCount="59" Body="&lt;p&gt;When I attempt to display available updates on my local copy, Craft is unable to display them and instead shows “You’re all up-to-date!”. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Available updates do display on my live copy, as well as on the “updates available” badge on the local copy CP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve cleared the cache to no avail and I’ve checked the logs and can’t see any errors. I'm running an nginx server and am starting to wonder if this problem arose when switching from apache -&gt; nginx.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently running version 2.6.2996 and am trying to update to 2.6.3001 as well as update a few plugins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone run into this issue while trying to display updates on their local copy CP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The responses coming back when I hit the updates page were all 200s and &lt;code&gt;allowAutoUpdates&lt;/code&gt; was set to true using the default setting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3PIrf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3PIrf.png&quot; alt=&quot;local copy&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7pbyA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7pbyA.png&quot; alt=&quot;live copy&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7832" LastEditorUserId="7832" LastEditDate="2018-01-10T22:59:22.367" LastActivityDate="2018-01-10T22:59:22.367" Title="Available updates not displaying on local copy but show up on live site; instead displays &quot;You're all up to date!&quot; with 5 pending updates" Tags="&lt;control-panel&gt;&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23427" PostTypeId="1" AcceptedAnswerId="23431" CreationDate="2018-01-10T02:49:29.783" Score="2" ViewCount="173" Body="&lt;p&gt;Does Craft CMS support 'encryption at rest' / 'data at rest' encryption? I've looked &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4448/how-secure-is-craft-and-why-is-it-secure&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;https://craftcms.com/support/topic/security&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;https://craftcms.com/support/securing-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; - but can't find any info on this. Explain like I'm 5. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="567" LastActivityDate="2018-01-10T13:19:59.260" Title="Does Craft CMS support 'encryption at rest' / 'data at rest' encryption?" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23428" PostTypeId="2" ParentId="23416" CreationDate="2018-01-10T07:53:47.933" Score="1" Body="&lt;p&gt;1.) Did you check if you have GD extension or ImageMagick extension working on the remote system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.) Are you using Apache on your remote system? If yes, is mod_rewrite working? (because the second URL does not point to a real file but is rewritten instead)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.) Maybe you are using Nginx on the remote system and therefor pretty urls are not working?&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2018-01-10T07:53:47.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23429" PostTypeId="1" AcceptedAnswerId="23430" CreationDate="2018-01-10T12:47:02.570" Score="1" ViewCount="988" Body="&lt;p&gt;I am using &lt;a href=&quot;https://box.scotch.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://box.scotch.io/&lt;/a&gt; (vagrant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to install Craft 3 with the cli, but can't get past these errors:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Connection refused &lt;/li&gt;&#xA;&lt;li&gt;No such file or directory&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One or the other error shows up depending on what I use for the host name.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have tried the answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23056/craft-cli-rc1-connectivity-issues-with-mamp-pro&quot;&gt;here.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;I can connect fine with Sequel Pro using the same credentials.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(Note: I did intentionally change the db name and password from the defaults that came with Scotchbox, and have successfully connected with those new details using Sequel Pro).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [192.168.33.10] &#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: [craft] &#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [192.168.33.10] localhost&#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: [craft] &#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] 127.0.0.1&#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: [craft] &#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="567" LastEditorUserId="567" LastEditDate="2018-01-10T21:12:15.707" LastActivityDate="2019-12-02T03:33:29.020" Title="How do I get past this MySQL error installing Craft 3 using CLI" Tags="&lt;install&gt;&lt;mysql&gt;&lt;composer&gt;&lt;cli&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23430" PostTypeId="2" ParentId="23429" CreationDate="2018-01-10T13:13:27.930" Score="1" Body="&lt;p&gt;This is all very specific to the box you're using, and how it's configured. I realize Scotch Box is a historically popular setup; you might also consider &lt;a href=&quot;https://laravel.com/docs/5.5/homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Homestead&lt;/a&gt; as it is geared specifically for PHP development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, according to the &lt;a href=&quot;https://box.scotch.io/docs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scotch Box docs&lt;/a&gt; the setup should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database Host: localhost&#xA;Database User: root&#xA;Database Password: root&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I assume you're doing in the second example? You are also running all of this from &lt;em&gt;inside&lt;/em&gt; of the box, yes?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-10T13:13:27.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23431" PostTypeId="2" ParentId="23427" CreationDate="2018-01-10T13:19:59.260" Score="1" Body="&lt;p&gt;As far as I'm aware, it does not. But this is typically something you'd do at the VPS level; examples of doing it on various platforms:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cloud.google.com/security/encryption-at-rest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Cloud Platform&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://linode.com/docs/security/encryption/use-luks-for-full-disk-encryption/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linode&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.digitalocean.com/community/questions/full-disk-encryption&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Ocean&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You could also do it at the database level as described here: &lt;a href=&quot;https://www.percona.com/blog/2016/04/08/mysql-data-at-rest-encryption/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MySQL Data at Rest Encryption&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-10T13:19:59.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23432" PostTypeId="1" CreationDate="2018-01-10T14:18:41.903" Score="2" ViewCount="60" Body="&lt;p&gt;One of our admins have mistakenly added the &lt;code&gt;translatable&lt;/code&gt; option to an important matrix field. We were using this option to synchronise content blocks across multiple languages.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the our main “Block Matrix Field” which is used across &lt;em&gt;many&lt;/em&gt; of our templates and we have more than 5 different languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to remove the &lt;code&gt;translatable&lt;/code&gt; flag to the block matrix, it overwrites all the content for the matrix for all the languages on the first save. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to revert this change somehow, but we’re unsure of when the error was introduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to make sure that the flag is disabled &lt;em&gt;without losing all our content&lt;/em&gt;? I have a DB backup of before we did any saves with the flag disabled, which means that we can follow a recipe if you have one.&lt;/p&gt;&#xA;" OwnerUserId="7837" LastActivityDate="2018-01-10T20:33:41.587" Title="Can you remove the `translatable` option to a matrix field without losing locale content?" Tags="&lt;matrix&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23433" PostTypeId="2" ParentId="23429" CreationDate="2018-01-10T14:40:56.017" Score="1" Body="&lt;p&gt;The default database name created by Scotchbox is &lt;code&gt;scotchbox&lt;/code&gt;, not Craft, and the DB Password is &lt;code&gt;root&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the DB connection details in &lt;a href=&quot;https://box.scotch.io/docs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Scotchbox Docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastEditorUserId="3679" LastEditDate="2018-01-10T16:23:34.627" LastActivityDate="2018-01-10T16:23:34.627" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23434" PostTypeId="1" AcceptedAnswerId="23449" CreationDate="2018-01-10T15:14:08.240" Score="1" ViewCount="211" Body="&lt;p&gt;We've had this problem for a while now and it's largely gone un-noticed but I'd like to raise it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a bunch of products that are discounted when you buy them in bulk. E.g. 12 products for 69.99. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to achieve this we calculate what the price should be for each product, by dividing 69.99 / 12, which is 5.8325.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We put this in the database as the product price and I can see it is stored in the database correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when you add 12 items to the cart, the total is 69.96 - anything past 2 decimal places is being rounded off prior to multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to work out a fix for this, but its not ideal as it will get wiped out if anyone ever updates the LineItemModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my solution to change the calculation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSubtotal()&#xA;{&#xA;    // The subtotal should always be rounded.&#xA;    return $this-&amp;gt;qty * CommerceCurrencyHelper::round($this-&amp;gt;salePrice);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSubtotal()&#xA;{&#xA;    // The subtotal should always be rounded.&#xA;    return CommerceCurrencyHelper::round($this-&amp;gt;qty * $this-&amp;gt;salePrice);// Modified: JL&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and change&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function fillFromPurchasable(Purchasable $purchasable)&#xA;{&#xA;    $this-&amp;gt;price = $purchasable-&amp;gt;getPrice();&#xA;    $this-&amp;gt;taxCategoryId = $purchasable-&amp;gt;getTaxCategoryId();&#xA;    $this-&amp;gt;shippingCategoryId = $purchasable-&amp;gt;getShippingCategoryId();&#xA;&#xA;    // Since sales cannot apply to non core purchasables yet, set to price at default&#xA;    $this-&amp;gt;salePrice = $purchasable-&amp;gt;getPrice();&#xA;    $this-&amp;gt;saleAmount = 0;&#xA;&#xA;    $snapshot = [&#xA;        'price'         =&amp;gt; $purchasable-&amp;gt;getPrice(),&#xA;        'sku'           =&amp;gt; $purchasable-&amp;gt;getSku(),&#xA;        'description'   =&amp;gt; $purchasable-&amp;gt;getDescription(),&#xA;        'purchasableId' =&amp;gt; $purchasable-&amp;gt;getPurchasableId(),&#xA;        'cpEditUrl'     =&amp;gt; '#',&#xA;        'options'       =&amp;gt; $this-&amp;gt;options&#xA;    ];&#xA;&#xA;    // Add our purchasable data to the snapshot, save our sales.&#xA;    $this-&amp;gt;snapshot = array_merge($purchasable-&amp;gt;getSnapShot(), $snapshot);&#xA;&#xA;    $purchasable-&amp;gt;populateLineItem($this);&#xA;&#xA;    //raising onPopulate event&#xA;    $event = new Event($this, [&#xA;        'lineItem' =&amp;gt; $this,&#xA;        'purchasable' =&amp;gt; $this-&amp;gt;purchasable&#xA;    ]);&#xA;    craft()-&amp;gt;commerce_lineItems-&amp;gt;onPopulateLineItem($event);&#xA;    // Always make sure salePrice is equal to the price and saleAmount&#xA;    $this-&amp;gt;salePrice = CommerceCurrencyHelper::round($this-&amp;gt;saleAmount + $this-&amp;gt;price);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function fillFromPurchasable(Purchasable $purchasable)&#xA;{&#xA;    $this-&amp;gt;price = $purchasable-&amp;gt;getPrice();&#xA;    $this-&amp;gt;taxCategoryId = $purchasable-&amp;gt;getTaxCategoryId();&#xA;    $this-&amp;gt;shippingCategoryId = $purchasable-&amp;gt;getShippingCategoryId();&#xA;&#xA;    // Since sales cannot apply to non core purchasables yet, set to price at default&#xA;    $this-&amp;gt;salePrice = $purchasable-&amp;gt;getPrice();&#xA;    $this-&amp;gt;saleAmount = 0;&#xA;&#xA;    $snapshot = [&#xA;        'price'         =&amp;gt; $purchasable-&amp;gt;getPrice(),&#xA;        'sku'           =&amp;gt; $purchasable-&amp;gt;getSku(),&#xA;        'description'   =&amp;gt; $purchasable-&amp;gt;getDescription(),&#xA;        'purchasableId' =&amp;gt; $purchasable-&amp;gt;getPurchasableId(),&#xA;        'cpEditUrl'     =&amp;gt; '#',&#xA;        'options'       =&amp;gt; $this-&amp;gt;options&#xA;    ];&#xA;&#xA;    // Add our purchasable data to the snapshot, save our sales.&#xA;    $this-&amp;gt;snapshot = array_merge($purchasable-&amp;gt;getSnapShot(), $snapshot);&#xA;&#xA;    $purchasable-&amp;gt;populateLineItem($this);&#xA;&#xA;    //raising onPopulate event&#xA;    $event = new Event($this, [&#xA;        'lineItem' =&amp;gt; $this,&#xA;        'purchasable' =&amp;gt; $this-&amp;gt;purchasable&#xA;    ]);&#xA;    craft()-&amp;gt;commerce_lineItems-&amp;gt;onPopulateLineItem($event);&#xA;    // Always make sure salePrice is equal to the price and saleAmount&#xA;    $this-&amp;gt;salePrice = $this-&amp;gt;saleAmount + $this-&amp;gt;price;// Modified: JL&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me if this is a known issue and whether there is any reason why the code is not like this to begin with? Why store values at 4dp if it's always rounded off to 2dp when calculated?&lt;/p&gt;&#xA;" OwnerUserId="1021" LastActivityDate="2018-01-11T04:16:06.853" Title="Rounding issue with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;rounding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23436" PostTypeId="1" AcceptedAnswerId="23454" CreationDate="2018-01-10T16:24:14.973" Score="2" ViewCount="598" Body="&lt;p&gt;The Craft 3 multi-sites is very useful. However, I found the list dropdown while editing an entry confusing and awkward in my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several sites group, each containing a localized version of the site version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- International Sales&#xA;    - English version&#xA;- Production&#xA;    - English version&#xA;    - French version&#xA;— Distribution&#xA;    - English version&#xA;    - French version&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could have set the sites group like this, to get the right display name when looping on each sites (using &lt;code&gt;craft.app.sites.getAllSites()&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- International Sales&#xA;    - International Sales&#xA;- Production&#xA;    - Production&#xA;    - Production&#xA;— Distribution&#xA;    - French Distribution&#xA;    - Distribution France&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as you can see, there's almost nothing that inform the user which site version is using which locale, when editing the sites from the CP's dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I had to change each name by something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- International Sales&#xA;    - International Sales → English&#xA;- Production&#xA;    - Production → English&#xA;    - Production → French&#xA;— Distribution&#xA;    - Distribution France → English&#xA;    - Distribution France → French&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6XlHM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6XlHM.png&quot; alt=&quot;Sites Dropdown when editing an Entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm facing two problems:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I set an ordered list of all sites using Twig?&#xA;Because&#xA;&lt;code&gt;craft.app.sites.getAllSites()&lt;/code&gt; loop through sites using an&#xA;alphabetical order, like in the CP. For example, I would like the&#xA;&lt;em&gt;Distribution&lt;/em&gt; group displayed before the &lt;em&gt;Production&lt;/em&gt; group.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I set a display name different from the site name? Because&#xA;&lt;em&gt;International Sales → English&lt;/em&gt;, &lt;em&gt;Production → English&lt;/em&gt;, etc. are ugly names, only for visual reference in the CP. I would like to&#xA;display their names like in the second version of the list:&#xA;&lt;em&gt;International Sales&lt;/em&gt;, &lt;em&gt;French Distribution&lt;/em&gt;, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-01-12T15:41:32.457" Title="Craft 3: how can I set an ordered list of all sites, and set a display name different from the site name?" Tags="&lt;localization&gt;&lt;entry&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23437" PostTypeId="1" CreationDate="2018-01-10T17:10:13.323" Score="2" ViewCount="332" Body="&lt;p&gt;I have set up multi-sites using several locales:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;— International Website&#xA;    — English&#xA;— Local Website&#xA;    — French&#xA;    — Dutch&#xA;    — etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the user has a French or Dutch IP, it should be auto-redirect to the Local Website version. Otherwise, it should be redirected to International Website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this plugin, that probably could make this works: &lt;a href=&quot;https://github.com/lukeyouell/craft3-geocookie&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lukeyouell/craft3-geocookie&lt;/a&gt;. I guess I would need to check the cookie inside my base.twig layout before to finally &lt;code&gt;{% redirect %}&lt;/code&gt; to the matching version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I was wondering if there were (better) other ways to do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-01-10T17:21:40.617" Title="Craft 3: how can I auto-redirect to a site version using the user IP?" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;redirect&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23438" PostTypeId="2" ParentId="23437" CreationDate="2018-01-10T17:21:40.617" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://superbig.co/plugins/country-redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Country Redirect&lt;/a&gt; will let you do that without any latency from external services, with the soon-to-be-released Craft 3 version (I'll update the answer once its out).&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2018-01-10T17:21:40.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23439" PostTypeId="2" ParentId="20043" CreationDate="2018-01-10T17:22:43.957" Score="1" Body="&lt;p&gt;I found issue using {slug} in Global when sharing same asset field. Ended up leaving {slug} in entries field and using {id} for Global asset field (created new field), not sure if there is a better way to use Asset in global&lt;/p&gt;&#xA;" OwnerUserId="4610" LastActivityDate="2018-01-10T17:22:43.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23440" PostTypeId="1" AcceptedAnswerId="23714" CreationDate="2018-01-10T17:22:47.287" Score="4" ViewCount="6848" Body="&lt;p&gt;Sites localized versions are setup using &lt;em&gt;Base URL&lt;/em&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;— http://{baseUrl}/en/&#xA;— http://{baseUrl}/fr/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But &lt;code&gt;{baseUrl}&lt;/code&gt; variables are not transformed using &lt;code&gt;craft.app.sites.getAllSites()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.getAllSites() %}&#xA;{% for site in sites %}&#xA;    {{ site.baseUrl }}&#xA;    // → outputs http://{baseUrl}/locale/ instead of http://mywebsite.com/en/&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas &lt;code&gt;baseUrl&lt;/code&gt; are set from general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'aliases' =&amp;gt; array(&#xA;    'basePath' =&amp;gt; '/mywebsite.com/htdocs/',&#xA;    'baseUrl'  =&amp;gt; 'http://www.mywebsite.com/'&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-02-01T19:17:55.277" Title="Craft 3: how can I set dynamic Base URL in sites setting?" Tags="&lt;localization&gt;&lt;config&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23441" PostTypeId="2" ParentId="21857" CreationDate="2018-01-10T18:39:42.197" Score="2" Body="&lt;p&gt;I'm using Craft as a headless CMS, so I wanted full control over the JSON it was returning. I didn't figure out how to do this with Element API, but it's very simple to write your own plugin that turns entries into JSON. Craft already includes the code to look up entries, so it's easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A basic controller might look something like:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyCustomPlugin_SomeResourceController {&#xA;&#xA;    public function actionWidgets() {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $widgetEntries = $criteria-&amp;gt;section(&quot;resources&quot;)-&amp;gt;type(&quot;widget&quot;)-&amp;gt;find();&#xA;&#xA;        // map entries to PHP objects&#xA;        $widgetObjects = array_map(function($entry) {&#xA;            return [&#xA;                &quot;name&quot; =&amp;gt; $entry-&amp;gt;title&#xA;            ];&#xA;        }, $widgetEntries);&#xA;&#xA;        $this-&amp;gt;returnJson([&#xA;            &quot;widgets&quot; =&amp;gt; $widgetObjects,&#xA;            &quot;anotherThing&quot; =&amp;gt; &quot;somethingElse&quot;&#xA;        ]);&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the actual app, I'm combining several different types of entries into one endpoint, so I extracted the reading and formatting into services, which I combine in various controller actions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably, Element API has some other features that I'm missing out on, but I haven't noticed. &lt;/p&gt;&#xA;" OwnerUserId="7225" LastActivityDate="2018-01-10T18:39:42.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23442" PostTypeId="2" ParentId="23432" CreationDate="2018-01-10T20:33:41.587" Score="1" Body="&lt;p&gt;This isn't a direct answer but one possible path if an easier option doesn't surface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sprout Import&lt;/strong&gt; supports importing content into a Matrix field and multiple imports can be created to handle multiple locales while still matching things back to the parent entry.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Example of &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/special-data-types/importing-matrix-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;importing content to a Matrix field&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Example of &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/special-data-types/importing-multiple-languages&quot; rel=&quot;nofollow noreferrer&quot;&gt;importing content for multiple locales&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Example of how to &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import/docs/seed-data/faker-and-fake-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;generate a JSON Import file in your Craft templates&lt;/a&gt;. While this example uses fake data, you could update the loop to output the content you need to re-import.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's likely you'll have a handful of relationships in your content that you'll need to make sure resolve correctly as well if you re-import your content, so depending on how your content is set up there may be a few more tricky parts to work through. But this is one possible path if other options seem like the may require a lot of manual steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be sure to test this in a development environment and make the appropriate backups before modifying any live content. &lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-10T20:33:41.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23443" PostTypeId="1" CreationDate="2018-01-10T21:30:06.837" Score="1" ViewCount="49" Body="&lt;p&gt;I'm in the midst of setting up a bilingual website. English and Welsh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up the locales in my settings (en and cy_gb)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My directories have the necessary folders for each language, with each containing their respective index.php and htaccess files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's general config file is changed. Basically I have followed the steps in the Craft docs. My site loads and clicking links loads them fine, but when I add a cy to the URL, I get a Craft 404 page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I maybe missing? Do I need to add something to the templates themselves? Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;General config&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;// Base site URL&#xA;'siteUrl' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'https://site.domain.net/',&#xA;    'cy_gb' =&amp;gt; 'https://site.domain.net/cy/'&#xA;&#xA;), &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/cy_gb/index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;//Tell Craft to serve the Welsh content&#xA;define('CRAFT_LOCALE', 'cy_gb');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/en/index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;//Tell Craft to serve the English content&#xA;define('CRAFT_LOCALE', 'en');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7841" LastActivityDate="2018-01-13T00:11:46.963" Title="Having trouble with Bilingual URLs" Tags="&lt;localization&gt;&lt;url&gt;&lt;language&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23444" PostTypeId="1" CreationDate="2018-01-10T22:02:49.187" Score="1" ViewCount="39" Body="&lt;p&gt;Hope you guys can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to create a search feature on a craft commerce site that will allow the user to search for products in this principle: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Product Type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Width +- value &lt;/p&gt;&#xA;&#xA;&lt;p&gt;height +- value &lt;/p&gt;&#xA;&#xA;&lt;p&gt;length +- value &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Front Door &lt;/p&gt;&#xA;&#xA;&lt;p&gt;100cm +- 10cm (90cm - 110cm) width&lt;/p&gt;&#xA;&#xA;&lt;p&gt;300cm +- 100cm (200cm - 310cm) height&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10cm +- 4cm (6cm - 14cm) length &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be using parameters just not sure how to write the query for this&lt;/p&gt;&#xA;" OwnerUserId="7842" LastActivityDate="2018-01-10T22:02:49.187" Title="Commerce filter with width, height and length with tolerance" Tags="&lt;plugin-craftcommerce&gt;&lt;search&gt;&lt;filter&gt;&lt;products&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23445" PostTypeId="2" ParentId="21662" CreationDate="2018-01-10T22:51:59.910" Score="1" Body="&lt;p&gt;Not necessarily Craft Commerce per se, but you could use Charge 2 to integrate with Stripe with Craft. In Charge 2, configuring Stripe Checkout to use Bitcoin is trivial, but could also be made to work with Stripe.js, which is where the deep integration with Craft CMS comes into play.  &lt;/p&gt;&#xA;" OwnerUserId="7586" LastActivityDate="2018-01-10T22:51:59.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23446" PostTypeId="2" ParentId="23426" CreationDate="2018-01-10T22:58:26.777" Score="2" Body="&lt;p&gt;Adding my comment as an answer because it fixed my issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I traced the issue to a deprecation warning involving &lt;code&gt;$HTTP_RAW_POST_DATA&lt;/code&gt; being populated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the line &lt;code&gt;always_populate_raw_post_data = -1&lt;/code&gt; to my &lt;code&gt;fpm_app.conf&lt;/code&gt; which solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="7832" LastActivityDate="2018-01-10T22:58:26.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23448" PostTypeId="2" ParentId="5447" CreationDate="2018-01-11T04:10:39.153" Score="1" Body="&lt;p&gt;I don't have the code handy, but a simple workaround might be to setup Redactor to use just one of the tags (either &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt;) and then replace these tags on the fly within your Twig templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; with &lt;code&gt;&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/pre&amp;gt;&lt;/code&gt; with &lt;code&gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2018-01-11T04:10:39.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23449" PostTypeId="2" ParentId="23434" CreationDate="2018-01-11T04:16:06.853" Score="1" Body="&lt;p&gt;It is stored in 4 decimal places because some currencies have more than 2 decimal places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We round before multiplication because we need don't store any value on the line item in a number of decimal places larger than the base currency. This allows us to add up line items without creating new cents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you suggest this could be changed to &lt;code&gt;CommerceCurrencyHelper::round($this-&amp;gt;qty * $this-&amp;gt;salePrice);&lt;/code&gt; but this would be a breaking change for other users. We will consider it for Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't recommend using &lt;code&gt;&amp;gt; 2&lt;/code&gt; decimal places to accomplish your &quot;12 for 6.99&quot; offer, rather make a discount adjuster that reduces the regular price of line item with a discount if &lt;code&gt;qty modulo 12 = 0&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-01-11T04:16:06.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23452" PostTypeId="1" AcceptedAnswerId="23453" CreationDate="2018-01-11T10:20:33.497" Score="1" ViewCount="93" Body="&lt;p&gt;I'm using Ben Croker's Entry Count plugin in my News channel but have noticed a huge performance hit, I know its probably down to how I am loading the entries in to my template so I am looking for some help on that please. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The News Channel where it is being used has tens of thousands of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server logs highlighted this query &lt;a href=&quot;https://pastebin.com/02uF0Mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.com/02uF0Mat&lt;/a&gt; taking up to 3 minutes to complete, therefore maxing the CPU and crashing the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key &quot;trending-news&quot; %}                                  &#xA;    {% set countedEntries = craft.entryCount.entries.section('news').limit(4) %}&#xA;&#xA;    {% for entry in countedEntries %}                       &#xA;        &amp;lt;p&amp;gt;{{ entry.postDate.format('jS F Y') }}&amp;lt;br/&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }} &amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;                       &#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I think this code is loading thousands of news entries and then displaying only 4, is there a way I can just load the top 4 only? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Massive thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-01-11T11:15:17.477" Title="Entry Count plugin performance / template optimisation" Tags="&lt;entry&gt;&lt;performance&gt;&lt;eager-loading&gt;&lt;count&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23453" PostTypeId="2" ParentId="23452" CreationDate="2018-01-11T10:51:53.137" Score="1" Body="&lt;p&gt;This is untested since I don't have time to load the plugin, so please comment if there is a syntax error but changing &lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count/blob/master/entrycount/services/EntryCountService.php#L38&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get all records from DB ordered by count descending&#xA;$entryCountRecords = EntryCountRecord::model()-&amp;gt;findAll(array(&#xA;    'order'=&amp;gt;'count desc'&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To something like the following should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntries($limit = null)&#xA;{&#xA;    $where = [&#xA;        'order' =&amp;gt; 'count desc' &#xA;    ];&#xA;    if($limit !== null){&#xA;        $where['limit'] = $limit;&#xA;    }&#xA;    // get all records from DB ordered by count descending&#xA;    $entryCountRecords = EntryCountRecord::model()-&amp;gt;findAll($where);&#xA;   ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countedEntries = craft.entryCount.entries(4).section('news').limit(4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: you include a limit to the query that fetches all entries to load the same amount like the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Maybe you have to change &lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count/blob/master/entrycount/variables/EntryCountVariable.php#L26&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getEntries($limit = null)&#xA;{&#xA;    return craft()-&amp;gt;entryCount-&amp;gt;getEntries($limit);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-11T11:15:17.477" LastActivityDate="2018-01-11T11:15:17.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23454" PostTypeId="2" ParentId="23436" CreationDate="2018-01-11T12:47:13.580" Score="3" Body="&lt;p&gt;If you would use a custom plugin you can create this function in your (I know it's deprecated but I don't know a better name) &lt;code&gt;PluginVariable&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function createSiteQuery(): Query&#xA;{&#xA;    return (new Query())&#xA;        -&amp;gt;select(['id', 'groupId', 'name', 'handle', 'language', 'primary', 'hasUrls', 'baseUrl', 'sortOrder'])&#xA;        -&amp;gt;from(['{{%sites}}']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.plugin-handle.createSiteQuery().orderby({'whatever': 'you want'}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And attach as many parameters to the query as you like... If you would like to fetch only sites with a specific language you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.plugin-handle.createSiteQuery().where('language = &quot;en&quot;').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have the full power of &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-db-query.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii2 Query class&lt;/a&gt;. You can group your sites as you like, change the order. You'll receive a single &lt;code&gt;SiteRecord&lt;/code&gt; or multiple &lt;code&gt;SiteRecords&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-records-site.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Class reference&lt;/a&gt; and you can display whatever information you like in the frontend. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are free to change the site names in your frontend with a static array map in your php code as well. Create a map with &lt;code&gt;siteHandle =&amp;gt; &quot;new display name&quot;&lt;/code&gt; and do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.plugin-handle.displayCustomSiteName(site.handle) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-12T15:41:32.457" LastActivityDate="2018-01-12T15:41:32.457" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23455" PostTypeId="2" ParentId="23440" CreationDate="2018-01-11T13:11:54.990" Score="1" Body="&lt;p&gt;You have to use aliases in order to make that work &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-concept-aliases.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your config (just a snipped from us, we don't insert the links and folders manually and use the &lt;code&gt;$_SERVER&lt;/code&gt; variables to generate them) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;    'assetPath' =&amp;gt; $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR,&#xA;    'assetUrl'  =&amp;gt; $server . 'assets/',&#xA;    'basePath'  =&amp;gt; $publicPath . DIRECTORY_SEPARATOR,&#xA;    'baseUrl'   =&amp;gt; $server,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can insert something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@assetPath/general&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as your base volume path or for your sites&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@baseUrl/en/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;those aliases will be parsed automatically&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-11T13:11:54.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23456" PostTypeId="2" ParentId="23408" CreationDate="2018-01-11T13:26:48.580" Score="0" Body="&lt;p&gt;If anyone stumbles onto this, i gave up looking for a solution and created my own plugin, to get you started, someone else with the same problem posted some sample code here that returns json from a db query : &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21857/with-element-api-can-i-combine-two-entry-types-into-a-json-object-keyed-by-typ&quot;&gt;With Element API, can I combine two entry types into a JSON object, keyed by type?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4936" LastActivityDate="2018-01-11T13:26:48.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23457" PostTypeId="1" AcceptedAnswerId="23458" CreationDate="2018-01-11T14:38:34.527" Score="1" ViewCount="24" Body="&lt;p&gt;I was trying to follow &lt;a href=&quot;https://craftcms.com/docs/templating/filters#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; from stack overflow to loop through a list of entries and output them by a custom dropdown field&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('resource').find() %}&#xA;{% set allEntriesByCat = allEntries|group('entry.resourceType') %}&#xA;{% for cat, entriesInCat in allEntriesByCat %}&#xA;    &amp;lt;h2&amp;gt;{{cat}}&amp;lt;/h2&amp;gt;&#xA;    {% for entry in entriesInCat %}&#xA;        &amp;lt;article class=&quot;resource&quot;&amp;gt;&#xA;            &amp;lt;h3 class=&quot;resource__name&quot;&amp;gt;&amp;lt;a class=&quot;resource__link&quot; href=&quot;{{entry.resourceLink}}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;div class=&quot;resource__content&quot;&amp;gt;{{entry.resourceContent}}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if I do that, I get the error: &lt;code&gt;Internal Server Error&#xA;Craft\EntryModel and its behaviors do not have a method or closure named &quot;entry&quot;.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7785" LastEditorUserId="5557" LastEditDate="2018-01-11T14:58:24.033" LastActivityDate="2018-01-11T14:58:24.033" Title="error when trying to loop through grouped entries according to dropdown field" Tags="&lt;categories&gt;&lt;forloop&gt;&lt;group&gt;&lt;drop-down&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23458" PostTypeId="2" ParentId="23457" CreationDate="2018-01-11T14:56:02.003" Score="1" Body="&lt;p&gt;You have to remove the &lt;code&gt;entry&lt;/code&gt; from your &lt;code&gt;entry.resourceType&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntriesByCat = allEntries|group('resourceType') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will work&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-11T14:56:02.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23459" PostTypeId="1" CreationDate="2018-01-11T16:04:43.257" Score="1" ViewCount="373" Body="&lt;p&gt;I have images in matrix block &#xA;I want to display in grid format &#xA;Each raw will have three column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images 1   images 2  image2&#xA;Images 4  images4  image 4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to used batch filter but did not work with matrix block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for block in entry.profilematrix %}&#xA;{% switch block.type %}&#xA;&#xA;{% case &quot;profilebuilder&quot; %}&#xA;&#xA;{% set debfilter = block.department %}&#xA;&#xA;        {# use the variable to filter the entries #}&#xA;&#xA;        {% if block.department == craft.request.lastSegment   %}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;                 {% for image in block.uploadImageProfile %} &#xA;&#xA;&#xA;&#xA;&#xA;             {% endfor %}&#xA;&#xA;        {% endif %}&#xA;&#xA; {% endfor %}&#xA;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7524" LastEditorUserId="7524" LastEditDate="2018-01-15T10:12:44.393" LastActivityDate="2018-01-15T10:31:02.023" Title="Display images in Matrix block in grid view" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23461" PostTypeId="1" CreationDate="2018-01-11T16:43:27.993" Score="1" ViewCount="606" Body="&lt;p&gt;I'm getting SSL errors when developing using .dev as a domain name. I believe it's because browsers are now automatically forwarding these to HTTPS://.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to get around this with Craft? I can change the extension but Craft requires .dev for local development I believe.&lt;/p&gt;&#xA;" OwnerUserId="7850" LastActivityDate="2018-01-11T21:33:25.387" Title=".dev local development" Tags="&lt;https&gt;&lt;ssl&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23462" PostTypeId="2" ParentId="23461" CreationDate="2018-01-11T16:49:47.093" Score="3" Body="&lt;p&gt;Yea Google bought .dev a few years back and now chrome forces https on all .dev domains.  I switched to using .test which has been reserved.  So far, so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.engineering/use-a-dev-domain-not-anymore-95219778e6fd&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.engineering/use-a-dev-domain-not-anymore-95219778e6fd&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6302" LastActivityDate="2018-01-11T16:49:47.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23463" PostTypeId="2" ParentId="23461" CreationDate="2018-01-11T16:50:56.673" Score="1" Body="&lt;p&gt;If you are using &lt;a href=&quot;https://laravel.com/docs/master/valet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laravel Valet&lt;/a&gt;, the newest version takes care of that. You may either change the domain with &lt;code&gt;valet domain test&lt;/code&gt;, or better: automatically secure your project it with &lt;code&gt;valet secure&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's very smooth.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2018-01-11T16:50:56.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23464" PostTypeId="1" CreationDate="2018-01-11T16:56:43.893" Score="1" ViewCount="456" Body="&lt;p&gt;I'm using the Patrol plugin to force https in the domain, but I also need to force www into the URL. When I do that with some htaccess rewrite rules I found online I get an error when I try to load the site that there's too many redirects happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my htaccess code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;RewriteRule ^(.*)/$ /$1 [L,R=301]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this was the code to force WWW that I was trying unsuccessfully to use that resulted in the &quot;too many redirects&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;#force www in URL&#xA;RewriteCond %{HTTPS_HOST} !^www\.adacore\.com&#xA;RewriteRule (.*) https://www.adacore.com/$1 [R=301,L]&#xA;&#xA;RewriteRule ^(.*)/$ /$1 [L,R=301]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how or if the Patrol plugin (&lt;a href=&quot;https://github.com/selvinortiz/craft.patrol&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/selvinortiz/craft.patrol&lt;/a&gt;) factors into the htaccess file to be honest. Any idea what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2018-01-11T18:30:04.370" Title="How do I force www in URL along with the Patrol plugin to force https" Tags="&lt;htaccess&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23465" PostTypeId="2" ParentId="23464" CreationDate="2018-01-11T18:06:36.163" Score="2" Body="&lt;p&gt;This is how our default &lt;code&gt;.htaccess&lt;/code&gt; with https redirect and forced &lt;code&gt;www.&lt;/code&gt; for all our projects looks like. So if you have the url &lt;code&gt;example.com&lt;/code&gt; you'll get redirected to &lt;code&gt;https://www.example.com&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;    RewriteCond %{HTTP_HOST} !^www\. [NC]&#xA;    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]&#xA;    RewriteCond %{HTTPS} !=on&#xA;    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;Action application/x-httpd-php70 /cgi-sys/php70-fcgi-starter.fcgi&#xA;AddType application/x-httpd-php70 .php .php70&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-11T18:30:04.370" LastActivityDate="2018-01-11T18:30:04.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23466" PostTypeId="1" CreationDate="2018-01-11T18:55:14.823" Score="1" ViewCount="464" Body="&lt;p&gt;We have multiple people working on a craft site using Vagrant and Virtual Box for our local server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am running MacOS Sierra, and everything works as expected. A couple of our other developers have updated to run High Sierra, and when they would pull down the git repo for the project this error shows up:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;include(/vagrant/app/craft/app/vendor/composer/../twig/twig/lib/Twig/Source.php): failed to open stream: No such file or directory&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This happens when Vagrant is up and running successfully, gulp is watching, and all the user is trying to do is connect to localhost:3000 through their browser. These computers had successfully worked on the project in the past before updating their OS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We tried doing a fresh pull down of the repo on a computer that had never worked on the project (but also using High Sierra) and we get the same exact error. So the only thing we know that is different between my computer (which works as expected) and the others is that mine is running Sierra and the others are running High Sierra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've tried searching online for this issue, but haven't found anybody posting similar enough problems. Also, I am posting this here since it is a Craft CMS project, so if I should switch this to a different stack exchange, let me know. Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SETUP INFO:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;config.vm.box = &quot;ubuntu/trusty32&quot;&#xA;config.vm.box_url = &quot;https://vagrantcloud.com/ubuntu/boxes/trusty32&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Tools:&#xA;Vagrant, Virtual Box, Gulp, rsync installed through homebrew&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if there is anything specific about our setup that you'll need to see to be more helpful.&lt;/p&gt;&#xA;" OwnerUserId="7323" LastEditorUserId="7323" LastEditDate="2018-01-11T19:10:53.700" LastActivityDate="2018-05-11T20:54:46.380" Title="PHP warning with composer on MacOS High Sierra: Failed to open stream" Tags="&lt;error-message&gt;&lt;php&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23467" PostTypeId="2" ParentId="23466" CreationDate="2018-01-11T19:08:54.077" Score="1" Body="&lt;p&gt;It sounds like you're running into this recent Composer autoloading bug: &lt;a href=&quot;https://github.com/composer/composer/issues/6977&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/composer/composer/issues/6977&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chances are if you &lt;code&gt;composer self-update&lt;/code&gt;, the issue will go away.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-01-11T19:20:42.433" LastActivityDate="2018-01-11T19:20:42.433" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23468" PostTypeId="1" AcceptedAnswerId="23469" CreationDate="2018-01-11T19:43:26.420" Score="1" ViewCount="126" Body="&lt;p&gt;Is it possible to change the display of the related entries field, to include extra info (hoping to add thumbnail, because otherwise these entries are damn hard to identify!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't &lt;em&gt;think&lt;/em&gt; they are quite the same as a standard table view and therefore hookable by &lt;code&gt;defineAdditionalEntryTableAttributes&lt;/code&gt;&#xA;Or can you override the normal view of the field type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gwgX9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gwgX9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7048" LastActivityDate="2018-01-11T20:42:11.403" Title="Possible to change view of related entries field?" Tags="&lt;control-panel&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23469" PostTypeId="2" ParentId="23468" CreationDate="2018-01-11T20:23:02.927" Score="2" Body="&lt;p&gt;Easy task: you can create your own relations field and use that instead. &#xA;Take a look at the default &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-fields-entries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries field&lt;/a&gt; here is the php code for it &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/fields/Entries.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do is changing the template that should be rendered so you'll end up with something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyCustomRelationField extends BaseRelationField&#xA;{&#xA;    // Static&#xA;    // =========================================================================&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public static function displayName(): string&#xA;    {&#xA;        return Craft::t('app', 'My awesome field');&#xA;    }&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    protected static function elementType(): string&#xA;    {&#xA;        return Entry::class;&#xA;    }&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public static function defaultSelectionLabel(): string&#xA;    {&#xA;        return Craft::t('app', 'Add an entry');&#xA;    }&#xA;&#xA;    /**&#xA;     * @var string Template to use for field rendering&#xA;     */&#xA;    protected $inputTemplate = 'path/to/your/custom/template';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the &lt;code&gt;$inputTemplate&lt;/code&gt; is the template that gets rendered in the cp so you'll take the default one &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/templates/_includes/forms/elementSelect.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; as your base and change the parts you need&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;elements&quot;&amp;gt;&#xA;    {% for element in elements %}&#xA;        {% include &quot;_elements/element&quot; with {&#xA;            context: 'field',&#xA;            size: (viewMode == 'large' ? 'large' : 'small')&#xA;        } %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to something you like. Because the default content in this include is generated &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/View.php#L1473&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Take that as a reference what you have to change/include in your own template (or hook) together with your icon/thumbnail &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-11T20:42:11.403" LastActivityDate="2018-01-11T20:42:11.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23470" PostTypeId="2" ParentId="23400" CreationDate="2018-01-11T20:34:16.473" Score="1" Body="&lt;p&gt;I've finally found this shame fault. I created a variable named footer to control the layout – that's not that good in combination with a field named footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for stealing your time...&lt;/p&gt;&#xA;" OwnerUserId="7146" LastActivityDate="2018-01-11T20:34:16.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23471" PostTypeId="2" ParentId="23461" CreationDate="2018-01-11T21:33:25.387" Score="4" Body="&lt;p&gt;This seems missing from the other answers, so I feel the need to emphasize it here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft does not require .dev for local development.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your local URL can be anything you want, Craft does not care. There is no requirement whatsoever on using a &lt;code&gt;.dev&lt;/code&gt; domain. That being said, it is recommended that you use a &lt;a href=&quot;https://craftcms.com/support/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;dev-sounding&quot;&lt;/a&gt; URL, in order to avoid the licensing nag warning. And even if you're getting the warning, it won't have any negative impact on the capabilities your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other answers already address what to do if you &lt;em&gt;do&lt;/em&gt; use a &lt;code&gt;.dev&lt;/code&gt; URL, so I won't cover it here. You may also want to read &lt;a href=&quot;https://craftcms.stackexchange.com/a/23193/45&quot;&gt;this helpful answer&lt;/a&gt; on a related question.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-11T21:33:25.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23472" PostTypeId="2" ParentId="4557" CreationDate="2018-01-11T23:13:25.653" Score="2" Body="&lt;p&gt;If your search page uses a query string, it's possible to enable search tracking from directly within Google Analytics. More details on Site Search [here].(&lt;a href=&quot;https://support.google.com/analytics/answer/1012264?hl=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://support.google.com/analytics/answer/1012264?hl=en&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dh84f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dh84f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-11T23:13:25.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23473" PostTypeId="1" CreationDate="2018-01-11T23:49:58.260" Score="1" ViewCount="47" Body="&lt;p&gt;I'm newish to Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im building a plugin for a client, one of their forms needs to post inputted data to an api then return a result to a hidden text area before the email if fired off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built the form and plugin with event, only problem is this event fires with every form i have on the site now. is it possible to target a form handle in the event ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('amForms_submissions.onBeforeSendEmail', function (Event $event) {&#xA;    $params = $event-&amp;gt;params();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7854" LastEditorUserId="57" LastEditDate="2018-01-12T14:35:36.303" LastActivityDate="2018-01-12T14:35:36.303" Title="Craft Form Event - Target a Single Form" Tags="&lt;plugin-development&gt;&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23474" PostTypeId="2" ParentId="23473" CreationDate="2018-01-12T05:42:50.697" Score="1" Body="&lt;p&gt;The following code fires the onBeforeEmailSubmission event (&lt;a href=&quot;https://github.com/am-impact/amforms/blob/master/services/AmForms_SubmissionsService.php#L351&quot; rel=&quot;nofollow noreferrer&quot;&gt;link)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Fire an 'onBeforeEmailSubmission' event&#xA;$event = new Event($this, array(&#xA;    'email'      =&amp;gt; $notificationEmail,&#xA;    'submission' =&amp;gt; $submission,&#xA;));&#xA;$this-&amp;gt;onBeforeEmailSubmission($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you'll have access to the &lt;code&gt;$submission&lt;/code&gt; and to the &lt;code&gt;$email&lt;/code&gt; as array keys in your &lt;code&gt;$params&lt;/code&gt; variable. In order to get the form you have to &lt;a href=&quot;https://github.com/am-impact/amforms/blob/master/models/AmForms_SubmissionModel.php#L65&quot; rel=&quot;nofollow noreferrer&quot;&gt;do&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$submission = $params['submission'];&#xA;$form = $submission-&amp;gt;getForm();&#xA;if($form-&amp;gt;handle === 'whatever'){&#xA;     // do something&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-12T05:42:50.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23476" PostTypeId="1" AcceptedAnswerId="23719" CreationDate="2018-01-12T11:09:44.607" Score="2" ViewCount="3830" Body="&lt;p&gt;I have a series of tasks lined up in the queue to run but they are just marking one as in progress and then sitting there and not executing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried updating the DB table &quot;queue&quot; by doing the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Changing the &lt;code&gt;failed&lt;/code&gt; field to 1 and &lt;code&gt;dateFailed&lt;/code&gt; to NOW() thus marking the task as failed then clicking the retry option. This just puts the task back into the same routine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Changing both &lt;code&gt;dateReserved&lt;/code&gt; and &lt;code&gt;timeUpdated&lt;/code&gt; to NULL thus resetting the task and it go back into pending but this also doesn't help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to debug the cause of this but getting lost in the code as it seems the QueueController is setting everything as it should be but then either not getting a response and updating the progress or it's failing silently somewhere along the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached my queue logs below for reference but I can't see anything unless I am missing something glaringly obvious!?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I asked on the #craft3 Slack channel and got some help but nothing worked. Hopefully, we can find a solution on here and share with others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.screencast.com/t/mqGDMkDT&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP Screenshot&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.screencast.com/t/bDEkWVCE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database Screenshot&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pastebin.com/kXMm8QJ6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Queue.log&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7857" LastEditorUserId="57" LastEditDate="2019-10-14T18:24:51.083" LastActivityDate="2019-10-14T18:24:51.083" Title="How can I troubleshoot why my queue of tasks in stuck in Craft 3?" Tags="&lt;craft3&gt;&lt;tasks&gt;&lt;stalled-tasks&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23477" PostTypeId="1" CreationDate="2018-01-12T13:41:12.557" Score="1" ViewCount="340" Body="&lt;p&gt;We have a very simple development process, and I believe this process has messed up the license.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;app-client.local.mycompany.com.br =&amp;gt; developer environment (intranet only)&#xA;app-client.qa.mycompany.com.br =&amp;gt; quality insurance environment (openshift)  (intranet only)&#xA;app-client.hom.mycompany.com.br =&amp;gt; client test environment (openshift) (intranet only,client access via vpn)&#xA;something.com.br =&amp;gt; client website&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;local/qa/hom&lt;/code&gt; I'm using &quot;environment = dev&quot;, but somehow &lt;code&gt;local&lt;/code&gt; is working but &lt;code&gt;qa&lt;/code&gt; and &lt;code&gt;hom&lt;/code&gt; is not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database is a copy =&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;from &lt;code&gt;local&lt;/code&gt; to &lt;code&gt;qa/hom&lt;/code&gt; when is a website in development&lt;/li&gt;&#xA;&lt;li&gt;from &lt;code&gt;prod&lt;/code&gt; to &lt;code&gt;local/qa/hom&lt;/code&gt; when it is an already made website&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It means every environment has its own database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to proceed to use dev licensing at &lt;code&gt;local/qa/hom&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="7790" LastEditorUserId="45" LastEditDate="2018-01-12T14:02:14.177" LastActivityDate="2018-01-12T17:19:29.653" Title="How to use license in different environments" Tags="&lt;craft3&gt;&lt;multi-environment&gt;&lt;license&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23479" PostTypeId="1" AcceptedAnswerId="23485" CreationDate="2018-01-12T15:01:19.713" Score="1" ViewCount="80" Body="&lt;p&gt;Is it possible to automatically apply Craft CMS updates when they become available? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I have to go into the CPanel and apply updates with the one-click option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I can do this with a cron job?&lt;/p&gt;&#xA;" OwnerUserId="7160" LastActivityDate="2018-01-12T16:24:08.807" Title="Apply updates automatically when available" Tags="&lt;updates&gt;&lt;auto-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23480" PostTypeId="1" CreationDate="2018-01-12T15:38:34.703" Score="1" ViewCount="62" Body="&lt;p&gt;I didn't create our website but it's been set up for me and I just use the CMS that was created for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I'm being alerted by all kinds of website graders that I need meta tags created. I know how to do alt image tags, and the SEO section of my craft CMS has a section for &lt;code&gt;SEO TITLE, SEO DESCRIPTION, and SEO KEYWORD&lt;/code&gt; but no where does it give me a place for meta tags...and if it did, I wouldn't know how to create one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to have the programmer who set up my site do it?&lt;/p&gt;&#xA;" OwnerUserId="7858" LastEditorUserId="5557" LastEditDate="2018-01-12T15:57:05.027" LastActivityDate="2018-01-12T23:38:50.300" Title="Does a programmer have to creates meta tags? I'm the end user (not a programmer)" Tags="&lt;meta&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23481" PostTypeId="2" ParentId="23480" CreationDate="2018-01-12T15:44:58.510" Score="1" Body="&lt;p&gt;Yes, you will most probably need a programmer if meta tags do not exist in generated html.&lt;/p&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2018-01-12T15:44:58.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23482" PostTypeId="2" ParentId="23443" CreationDate="2018-01-12T15:49:30.217" Score="1" Body="&lt;p&gt;Looking at the code you posted looks like you should change &lt;code&gt;/cy_gb/index.php&lt;/code&gt; to &lt;code&gt;/cy/index.php&lt;/code&gt;. &lt;code&gt;/cy/&lt;/code&gt; is the actual subfolder you are requesting here: &lt;code&gt;https://site.domain.net/cy/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2018-01-12T15:49:30.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23483" PostTypeId="2" ParentId="23479" CreationDate="2018-01-12T16:06:50.590" Score="2" Body="&lt;p&gt;It's typically bad practice to allow auto-updates -- at least in a production environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, to update Craft, you're required to download the new files (click &quot;Download&quot; on the update page and it gives you a zip file), and then replace them in your codebase. So right now, no you wouldn't be able to do this with a Cron Job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 may be a different story, though.&lt;/p&gt;&#xA;" OwnerUserId="6710" LastActivityDate="2018-01-12T16:06:50.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23484" PostTypeId="2" ParentId="23480" CreationDate="2018-01-12T16:09:05.277" Score="1" Body="&lt;p&gt;Maybe your programmer forgot to include it. Out of the box there are no settings for &lt;code&gt;Meta&lt;/code&gt; or &lt;code&gt;Seo&lt;/code&gt; information in Craft so if you have a section for it, someone has probably created it in order to include it in your templates (unless you did it yourself?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did you install any plugins or did someone else create any plugins for that? Like I said maybe the team forgot it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in general yes: you actually need a little bit knowledge to include meta tags to your page. You don't really need to be a programmer since it's just a little bit copy pasting with Twig but you have to have access to your template files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is just an example so you can't use it - it's just an example how the the thing you need to include could eventually looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if seoKeywords is defined %}&#xA;    &amp;lt;meta name=&quot;keywords&quot; lang=&quot;{{ craft.locale }}&quot; content=&quot;{{ seoKeywords }}&quot;/&amp;gt;&#xA;{% else %}&#xA;    {% set seoKeywords = secondredSEO.getKeywords(_context) %}&#xA;    {% if seoKeywords %}&#xA;        &amp;lt;meta name=&quot;keywords&quot; lang=&quot;{{ craft.locale }}&quot; content=&quot;{{ seoKeywords }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if seoDescription is defined %}&#xA;    &amp;lt;meta name=&quot;description&quot; content=&quot;{{ seoDescription }}&quot;/&amp;gt;&#xA;{% else %}&#xA;    {% set seoDescription = secondredSEO.getDescription(_context) %}&#xA;    {% if seoDescription %}&#xA;        &amp;lt;meta name=&quot;description&quot; content=&quot;{{ seoDescription }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you feel confident enough to do it yourself we can help you. Just explain us the structure of your seo section and we can provide the code you have to paste into your layout. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-12T16:09:05.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23485" PostTypeId="2" ParentId="23479" CreationDate="2018-01-12T16:24:08.807" Score="2" Body="&lt;p&gt;Of course you can, but it's going to be a little bit tricky since you have to be logged in or you have to find a way how to login with an automatic request.&#xA;Like others said, it's a dangerous things and I would not suggest to auto update since something can eventually break and you'll not notice it before your customers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a controller that uses the &lt;code&gt;user&lt;/code&gt; service to login with admin credentials&lt;/li&gt;&#xA;&lt;li&gt;Redirect to &lt;code&gt;admin/updates/go/craft&lt;/code&gt; &amp;lt;- this will start the update&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Making an update for Craft 2 is actually just visiting the &lt;code&gt;admin/updates/go/craft&lt;/code&gt; everything else is automatic&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-12T16:24:08.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23486" PostTypeId="1" AcceptedAnswerId="23490" CreationDate="2018-01-12T16:25:45.913" Score="1" ViewCount="170" Body="&lt;p&gt;I'm using a route to use a different template, but whatever I try the page remains unchanged, my structure is set as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;entry url format: {slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;entry template: _pages/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want an entry's slug to use a different template - would this possibly be affecting the route being followed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the entry 'home' to use the 'index' template (and not the '_home' template which exists at _pages/_home)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've cleared my cache and updated indexes&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="5654" LastEditDate="2018-01-12T16:45:33.123" LastActivityDate="2018-01-12T21:02:55.750" Title="Can you use Routes on Structure entries" Tags="&lt;structure&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23487" PostTypeId="1" AcceptedAnswerId="23492" CreationDate="2018-01-12T16:36:36.073" Score="1" ViewCount="162" Body="&lt;p&gt;I'm struggling to find a solution for a clients request to be given complete flexibility to create new sections and pages from within Craft. Essentially I would create a series of generic page templates which the admin could then use to build out the site and I can use the Navee plugin to provide a way to create a custom navigation. But this does not change the URL of the entry of course. I suppose what I need is a version of the ExpressionEngine Pages module for Craft. Is there such a thing?&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="45" LastEditDate="2018-01-12T17:26:58.147" LastActivityDate="2018-01-12T19:53:08.637" Title="Equivalent of &quot;EE Pages&quot; module in Craft?" Tags="&lt;url&gt;&lt;navigation&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23488" PostTypeId="2" ParentId="23487" CreationDate="2018-01-12T16:53:46.723" Score="3" Body="&lt;p&gt;A common approach is to create a Structure for the pages, and use a &lt;a href=&quot;https://nystudio107.com/blog/creating-a-content-builder-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content Builder&lt;/a&gt; where you can use Matrix blocks of various types to allow the client to build out the pages as they see fit in the Structure.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-01-12T17:31:41.503" LastActivityDate="2018-01-12T17:31:41.503" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23489" PostTypeId="2" ParentId="23477" CreationDate="2018-01-12T17:19:29.653" Score="1" Body="&lt;p&gt;A few pre-requisites:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A Craft purchase/edition is tied to the &lt;code&gt;craft/config/license.key&lt;/code&gt; file that is in place at the time the purchase is made and wherever that file goes, the purchase/edition will follow.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A &lt;code&gt;craft/config/license.key&lt;/code&gt; file can only be tied to one &quot;public&quot; domain at a time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft license validation doesn't run on &quot;non-public&quot; domains and you're able to trial the different editions of Craft for as long as you want on non-public domains.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/license-enforcement#how-do-we-determine-craft-is-running-on-a-public-domain&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will treat &lt;code&gt;app-client.local.mycompany.com.br&lt;/code&gt; as a &quot;non-public&quot; domain, because it has one of the keywords we're looking for in its own segment in the subdomain.  You can see a list of those keywords here in number 4 of the previous link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of those domains Craft treats as &quot;public&quot; because they don't match any of the rules in that link, so license validation will run on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't say exactly what you're issue is, but if you purchased Craft on the development domain and you're using that same &lt;code&gt;license.key&lt;/code&gt; file on the three other public domains, you're probably getting a warning in the Control Panel saying that license is already in use on another domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since they are all for the same &quot;site&quot;, you can either tell everyone that has access to the Control Panel to ignore the message and to &lt;em&gt;not&lt;/em&gt; transfer the license away from the production domain, or you can change your &lt;code&gt;qa&lt;/code&gt; and &lt;code&gt;hom&lt;/code&gt; domains so Craft treats them as &quot;non-public&quot; and license validation won't run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More related reading: &lt;a href=&quot;https://craftcms.com/support/license-key-info&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/license-key-info&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-12T17:19:29.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23490" PostTypeId="2" ParentId="23486" CreationDate="2018-01-12T17:44:09.340" Score="1" Body="&lt;p&gt;You know you can do things like this in your root entry  template to load it dynamically based on slug or entry type &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;  'pages/_custom/' ~ page.slug ~ '.twig',&#xA;  'pages/_entrytypes/' ~ page.type ~ '.twig',&#xA;  'pages/_generic.twig' ]&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-12T17:44:09.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23491" PostTypeId="2" ParentId="23480" CreationDate="2018-01-12T19:21:47.487" Score="3" Body="&lt;p&gt;Metadata is an important part of a website. If you are getting poor scores from website graders and don't see any place on your site to add that information it likely wasn't implemented by the team that built your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's good you've noticed this and it's worth taking the time to set up a way to manage the metadata on your site. The best way to do this in a comprehensive and maintainable way is with an SEO plugin. Once you have things setup, you should no longer need the assistance of a programmer to manage the majority of your SEO needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft, at this point in time, there are two good SEO options that are very comprehensive in the types of metadata they manage:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My firm is behind Sprout SEO, so my preference is with it, but SEOmatic is made by a respectable developer who I would recommend as well so it's really a matter of your preference on which one works best for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With either plugin, once you have it setup, you can focus on your content and the SEO plugins will worry about generating and outputting the metadata you need on your pages. If you decide to refine or grow your SEO strategy, both plugins also have ways to give you additional control over customizing the metadata further, but that's probably something that can be left for another time in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Leveraging a plugin, it will likely take a developer 2-4 hours to implement a good SEO baseline on your site. For a custom or more advanced implementation, additional planning and implementation will be required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please take this estimate with a grain of salt as every custom website is unique and if your original developer didn't set up any metadata that could be a signal that the rest of the project also has some non-standard things in the setup that would take the next developer more time to figure out. If you have a large site or advanced content, it can also take longer to customize metadata for special considerations, specialized content types, or your particular goals.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-01-12T23:38:50.300" LastActivityDate="2018-01-12T23:38:50.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23492" PostTypeId="2" ParentId="23487" CreationDate="2018-01-12T19:53:08.637" Score="3" Body="&lt;p&gt;There are a few different ways to do this but first I'd recommend stepping away from the idea of doing it like EE. Craft has a lot of flexibility in how the content model can be implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft, if you want a Pages channel with custom slugs, the simplest way is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new Section called &lt;em&gt;Pages&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Set the Entry URL Format value to &lt;code&gt;{slug}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;By setting the URL Format to just &lt;code&gt;{slug}&lt;/code&gt; you now have the freedom to create any URLs you want in that section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next questions to ask are:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;How many variations will I have in the page layouts for these generic pages?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;To manage variations you can create multiple Entry Types within a Section. This will allow you to have a one-column page and a two-column page, or whatever variations you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But be careful as you add Entry Types. If you have a layout that will only be used once, you may want to consider making that entry a Single or Global or handling it in some other way. I find, that if you add more than 4 or 5 Entry Types it can get very confusing for users as to what they match up to in the templates. Make sure your Entry Types have clear concepts they map to and if you start getting too many, consider your alternatives or how to break up your single Pages channel into multiple, more focused channels.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;How do I want to manage these pages in the navigation?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;While you can use a Structure Section in Craft to both manage pages and navigation around those pages, be careful how far you take this. Craft uses infinite scrolling in the CP so long structure sections are hard to manage in a way that you can see the structure without just searching for what you want to find. Additionally, often parts of the structure can be delegated to other Channels and you'll be right back where you started with needing to find a way to manage navigation across multiple Sections of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a plugin like Navee or even a separate Structure Section called 'Navigation' for Navigation has its benefits. When a Structure section doubles as navigation, any change to a slug can change multiple page URLs of children entries and create a need to also manage those updates in SEO and redirects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By separating the content from the navigation users can update content without breaking navigation or changing URLs. This also gives clients more room to change their mind about how navigation works (as they often do) while putting less pressure on a developer for the need to re-architect several things when those changes happen.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-01-12T19:53:08.637" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23493" PostTypeId="2" ParentId="23486" CreationDate="2018-01-12T21:02:55.750" Score="0" Body="&lt;p&gt;What does each line actually do assuming thats in _entry.twig?&#xA;and assuming the templates reside in the /pages directory? A brief overview of the functionality would be invaluable :)&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2018-01-12T21:02:55.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23494" PostTypeId="2" ParentId="23476" CreationDate="2018-01-12T22:33:51.557" Score="7" Body="&lt;p&gt;I typically just truncate (delete all of the rows) the &lt;code&gt;queue&lt;/code&gt; table if something goes wrong with a task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I delete all of the files in &lt;code&gt;storage/logs/&lt;/code&gt; and I try to reproduce the problem. If it still happens, then I look in &lt;code&gt;queue.log&lt;/code&gt; and &lt;code&gt;web.log&lt;/code&gt; to see what the issue is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually searching on &lt;code&gt;[error]&lt;/code&gt; finds what I'm looking for pretty easily. Occasionally I have to browse through the file to find the actual problem, but that's why I delete the log files before I do it, so there isn't as much to wade through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relevant articles I wrote since this answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Robust queue job handling in Craft CMS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zen and the Art of Craft CMS Log File Reading&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2019-10-09T17:39:05.150" LastActivityDate="2019-10-09T17:39:05.150" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23495" PostTypeId="2" ParentId="23443" CreationDate="2018-01-13T00:11:46.963" Score="1" Body="&lt;p&gt;Thank you for your reply, but I finally figured out the issue. It was a permissions problem on the .htaccess in the cy folder. I deleted the one in there and uploaded a fresh one and it all seemed to slot into place.&lt;/p&gt;&#xA;" OwnerUserId="7841" LastActivityDate="2018-01-13T00:11:46.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23496" PostTypeId="1" AcceptedAnswerId="23499" CreationDate="2018-01-13T08:48:59.817" Score="1" ViewCount="589" Body="&lt;p&gt;I can call predefined image transforms no problem - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$image-&amp;gt;getUrl('small')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but cropped mobile transforms need to use the image asset's set focal point (from the Image Editor). I can't find any example of how to use this feature in code? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the only way to use this focal point is setting a new transform array in PHP? (i.e. the preset values are ignored).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be good if there was an option to use the Image Focal point in the Transform setup (UI).&lt;/p&gt;&#xA;" OwnerUserId="1084" LastEditorUserId="57" LastEditDate="2018-01-15T01:39:30.153" LastActivityDate="2018-01-15T12:28:32.697" Title="Image transform with focal point - in Element API" Tags="&lt;image-transforms&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23497" PostTypeId="1" CreationDate="2018-01-13T21:57:29.533" Score="1" ViewCount="134" Body="&lt;p&gt;I'm trying to have this include be updated by the option I choose in my dropdown.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'subnav_programs.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My dropdown is called entry.dropSubsection&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put &lt;code&gt;{% include '{{ entry.dropSubsection }}' %}&lt;/code&gt; in my html file but it keeps giving me errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to find the template “{{ entry.dropSubsection }}”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="45" LastEditDate="2018-01-13T22:27:15.750" LastActivityDate="2018-01-13T22:27:15.750" Title="Use value of a dropdown field for an `include`" Tags="&lt;drop-down&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23498" PostTypeId="2" ParentId="23497" CreationDate="2018-01-13T22:25:07.617" Score="3" Body="&lt;p&gt;You don't need to (more specifically, you &lt;em&gt;can't&lt;/em&gt;) nest Twig tags within other Twig tags. Ditch the inner Twig tag and its respective quotes, and just pass the variable directly into the outer Twig tag...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include entry.dropSubsection %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That being said, I'm not sure this will achieve exactly what you're looking for. You may need to append &lt;code&gt;.value&lt;/code&gt; as well...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include entry.dropSubsection.value %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-13T22:25:07.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23499" PostTypeId="2" ParentId="23496" CreationDate="2018-01-13T22:39:45.877" Score="3" Body="&lt;p&gt;Focal Points apply to the Asset itself; that way the same Focal Point can be used with any transform, and it'll still keep the same point of interest centered when the image is transformed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should use the Focal Point automatically, you shouldn't have to do anything other than set it in the image editor.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-13T22:39:45.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23502" PostTypeId="1" AcceptedAnswerId="25261" CreationDate="2018-01-15T08:55:35.080" Score="2" ViewCount="997" Body="&lt;p&gt;Is it possible to show different entries on different subsites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I can show different versions of the same entry (e.g. translations), but I want entry 1 to show on site 1, entry 2 on site 1, entry 3 on site 2, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I have different user accounts for the admin for each site, is it also possible to only show the entries for site 1 in the cms of site 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In total I'd like to create around 30 subsites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update - site setup&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with only 1 locale. I have one primary (default) site, the rest is in the same group, all on a different base URL and handle.&lt;/p&gt;&#xA;" OwnerUserId="7867" LastEditorUserId="7867" LastEditDate="2018-01-15T16:18:05.970" LastActivityDate="2018-03-19T15:39:29.287" Title="Multisite Craft 3, different entries on different sites" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23503" PostTypeId="2" ParentId="23459" CreationDate="2018-01-15T10:31:02.023" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% for batch in block.images|batch(3) %}&#xA;  &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;  {% for image in batch %}&#xA;    &amp;lt;div class=&quot;column&quot;&amp;gt;&#xA;      &amp;lt;img src=&quot;{{ image.url }}&quot; alt=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2018-01-15T10:31:02.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23504" PostTypeId="2" ParentId="20723" CreationDate="2018-01-15T10:35:37.040" Score="1" Body="&lt;p&gt;You might just have to do it yourself :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;group = 'groupHandle';&#xA;$categories = $criteria-&amp;gt;find();&#xA;$sortedCategories = [];&#xA;&#xA;foreach ($categories as $category) {&#xA;  if (!isset($sortedCategories[$category-&amp;gt;level]) {&#xA;    $sortedCategories[$category-&amp;gt;level] = [];&#xA;  }&#xA;  $sortedCategories[$category-&amp;gt;level][] = $category;&#xA;}&#xA;var_dump($sortedCategories);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTE: I haven't tested this code, but in theory it should do the trick :)&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2018-01-15T10:35:37.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23505" PostTypeId="2" ParentId="23496" CreationDate="2018-01-15T12:28:32.697" Score="1" Body="&lt;p&gt;Ok i found out you need to set the crop height also (as well as width), then it worked.&lt;/p&gt;&#xA;" OwnerUserId="1084" LastActivityDate="2018-01-15T12:28:32.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23509" PostTypeId="2" ParentId="15522" CreationDate="2018-01-15T16:47:12.310" Score="8" Body="&lt;p&gt;As of Craft 3 (Tested using &lt;a href=&quot;https://github.com/craftcms/cms/releases/tag/3.0.0-RC5&quot; rel=&quot;noreferrer&quot;&gt;RC5&lt;/a&gt;) you can do it like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do view.registerJsFile(&quot;path/to/script.js&quot;, {&quot;async&quot;:&quot;async&quot;, &quot;defer&quot;:&quot;defer&quot;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-web-view.html#registerJsFile()-detail&quot; rel=&quot;noreferrer&quot;&gt;Documentation for Yii's view.registerJsFile()&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2018-01-15T16:47:12.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23510" PostTypeId="1" AcceptedAnswerId="23527" CreationDate="2018-01-15T16:58:02.757" Score="1" ViewCount="222" Body="&lt;p&gt;I have come across an issue whilst using the &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retour plugin&lt;/a&gt; for Craft similar to the question raised &lt;a href=&quot;https://craftcms.stackexchange.com/questions/22006/redirects-with-craft-and-nginx&quot;&gt;here&lt;/a&gt; but this is a redirect with a URL using the .htm extension and not .php.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why this would not work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="57" LastEditDate="2018-01-15T21:13:34.647" LastActivityDate="2018-01-17T06:57:25.500" Title="Retour Redirects with Craft and nginx" Tags="&lt;nginx&gt;&lt;plugin-retour&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23511" PostTypeId="1" AcceptedAnswerId="26012" CreationDate="2018-01-15T19:44:21.227" Score="1" ViewCount="237" Body="&lt;p&gt;I'm trying to import posts using the Feed Me plugin. I'd like to make a dynamic URL so that I can access the feed from a Cron job or from elsewhere in the CP. It says in the docs that I can use environment variables inside the Feed URL, but it isn't working for me. Am I using them the wrong way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Feed URL (not working):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://some-url.com/{{issueNumber}}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from environment variables, is there some other way to pass variables into Feed Me? The client won't have direct access to the Feed Me plugin and therefore won't be able to manually edit the URL each time.&lt;/p&gt;&#xA;" OwnerUserId="7260" LastActivityDate="2018-05-04T14:06:22.223" Title="Using a dynamic url with Feed Me" Tags="&lt;plugin-development&gt;&lt;plugin-feedme&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23513" PostTypeId="1" CreationDate="2018-01-15T21:45:05.367" Score="2" ViewCount="214" Body="&lt;p&gt;I am looking for a plug-in that would allow me to add a site wide announcement banner to the top of a page. Much like the one in the image below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EyrCz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EyrCz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft and have gotten my site up and running but can't seem to figure out a simple way to do this. &lt;/p&gt;&#xA;" OwnerUserId="7870" LastEditorUserId="57" LastEditDate="2018-01-15T23:12:44.857" LastActivityDate="2018-01-16T01:35:29.467" Title="Site wide announcement banner" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23514" PostTypeId="1" CreationDate="2018-01-16T00:10:12.940" Score="2" ViewCount="131" Body="&lt;p&gt;I have a pretty specific set up: posts get created via rss feeds and images are not attached to the specific posts, so instead in the entry template I use an image from a related entry. When I try to use the related entry's image as the SEO image and merge it with SEOmatic, it does not merge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone ever tried doing this with SEOmatic? This is the code I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('episode') %}&#xA;   {% set relatedPodcastImage = craft.entries.section('podcastChannel').relatedTo(entry).albumCoverPicture.first().getUrl('large') %}&#xA;      {% set seomaticMeta = seomaticMeta | merge(&#xA;            { og:&#xA;                  {&#xA;                  title: entry.title,&#xA;          description: entry.podcastDescription,&#xA;                  image: relatedPodcastImage&#xA;                  }&#xA;            },&#xA;        { twitter:&#xA;                  {&#xA;                  title: entry.title,&#xA;                  description: entry.podcastDescription,&#xA;                  image: relatedPodcastImage&#xA;                  }&#xA;            }&#xA;      ) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7223" LastActivityDate="2018-01-16T02:00:43.767" Title="SEOmatic not merging fields from a related entry" Tags="&lt;templating&gt;&lt;entries&gt;&lt;relatedto&gt;&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23515" PostTypeId="2" ParentId="23513" CreationDate="2018-01-16T01:35:29.467" Score="3" Body="&lt;p&gt;You don't need a plugin for this task. You are free to do whatever you like in your templates. There is a template folder in your Craft directory where your html/twig files live and you are free to create the html you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to have a site wide banner, just include the required html in your layout template and that's basically it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is not made for non-developers so if you are going to create a site with craft you should have basic knowledge in html/css to write your layout at least.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to read the &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; or some other tutorials &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-16T01:35:29.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23516" PostTypeId="2" ParentId="23514" CreationDate="2018-01-16T02:00:43.767" Score="2" Body="&lt;p&gt;Make sure you're not doing this inside of a &lt;code&gt;{% block %}&lt;/code&gt; or you will run into Twig Processing Order / Scoping issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some good examples of doing that here: &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Twig SEO Meta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-16T02:00:43.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23517" PostTypeId="1" AcceptedAnswerId="23520" CreationDate="2018-01-16T06:54:47.483" Score="1" ViewCount="38" Body="&lt;p&gt;Let's say I have an existing event called &quot;My Event&quot; on a Solspace calendar called &quot;Social&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to reassign &quot;My Event&quot; to a different calendar eg: &quot;Sports&quot; - without deleting &quot;My Event&quot; from &quot;Social&quot; &amp;amp; recreating it on &quot;Sport&quot; ?&lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2018-01-16T16:10:42.077" Title="Is it possible to reassign an existing event from one Solspace Calendar to another ?" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23519" PostTypeId="1" CreationDate="2018-01-16T14:57:54.683" Score="2" ViewCount="69" Body="&lt;p&gt;I have an entry that is currently password protected and I am looking for a way to give access to this entry to non-craft users temporarily access either by a token or something else. Anyone know how I can accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="45" LastEditDate="2018-01-16T17:23:31.557" LastActivityDate="2018-01-16T17:30:55.517" Title="Temporarily access to an entry" Tags="&lt;security&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23520" PostTypeId="2" ParentId="23517" CreationDate="2018-01-16T16:10:42.077" Score="2" Body="&lt;p&gt;This currently isn't built into Calendar, but if your calendars use the same fields, you should be able to manually adjust the &lt;code&gt;calendarID&lt;/code&gt; column in the &lt;code&gt;craft_calendar_events&lt;/code&gt; database table. Otherwise, you'll have to delete the event and create it again for the correct calendar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometime in the future we plan on seeing if we can add the option to allow changing of calendars. The issue for us is that each calendar is able to have a different field layout and tabs, etc, so it complicates things. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-01-16T16:10:42.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23521" PostTypeId="2" ParentId="23519" CreationDate="2018-01-16T17:30:55.517" Score="3" Body="&lt;p&gt;You can share a temporary link to an unpublished entry by clicking on the &quot;Share&quot; button, right next to the &quot;Live Preview&quot; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lRwDZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lRwDZ.png&quot; alt=&quot;&amp;quot;Share&amp;quot; button in Craft 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UOBVJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UOBVJ.png&quot; alt=&quot;&amp;quot;Share&amp;quot; button in Craft 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This creates a link with a token that will expire automatically. The length of time that the token lasts for can be controlled with the &lt;a href=&quot;https://craftcms.com/docs/config-settings#defaultTokenDuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;defaultTokenDuration&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-16T17:30:55.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23522" PostTypeId="1" CreationDate="2018-01-16T20:00:08.380" Score="1" ViewCount="473" Body="&lt;p&gt;I have a site-specific module in my modules directory that's being loaded in &lt;code&gt;config/app.php&lt;/code&gt;. Since it won't be used elsewhere I am not storing the module in an external repository.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I added a &lt;code&gt;composer.json&lt;/code&gt; file to load some dependencies for the module and ran &lt;code&gt;composer update&lt;/code&gt;, it created a new vendor directory inside the module directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can have a &lt;code&gt;composer.json&lt;/code&gt; inside that module directory, but have the dependencies loaded in the main vendor directory?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I doing something totally wrong here?&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2019-05-03T00:56:55.010" Title="How do I load composer dependencies for a Yii module that's in my site repo?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23523" PostTypeId="2" ParentId="23522" CreationDate="2018-01-17T00:03:17.990" Score="3" Body="&lt;p&gt;With a little nudge from Brad, here's the answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the module's composer dependencies taken into account in the parent site's composer dependencies, you need to add the module in the parent's composer.json, both as a require and as a repository with the path type, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  ... a bunch of stuff from the default composer.json goes here ...&#xA;  &quot;require&quot;: {&#xA;    &quot;php&quot;: &quot;&amp;gt;=7.0.0&quot;,&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.0-RC5&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &quot;roave/security-advisories&quot;: &quot;dev-master&quot;,&#xA;    &quot;modules/modulename&quot;: &quot;dev-master&quot; &amp;lt;-- add your module here (package name)&#xA;  },&#xA;  ... more stuff goes here ...&#xA;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;modules/modulename&quot; &amp;lt;--- and add it here (package path)&#xA;    }&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14" LastEditorUserId="5193" LastEditDate="2019-05-03T00:56:55.010" LastActivityDate="2019-05-03T00:56:55.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23524" PostTypeId="5" CreationDate="2018-01-17T00:09:29.927" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-01-17T00:09:29.927" LastActivityDate="2018-01-17T00:09:29.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23525" PostTypeId="4" CreationDate="2018-01-17T00:09:29.927" Score="0" Body="Questions related to Craft 3 Yii Module Development" OwnerUserId="14" LastEditorUserId="14" LastEditDate="2018-01-17T17:25:54.717" LastActivityDate="2018-01-17T17:25:54.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23526" PostTypeId="1" AcceptedAnswerId="23602" CreationDate="2018-01-17T00:57:37.290" Score="2" ViewCount="1070" Body="&lt;p&gt;I've had a few users on our site have trouble resetting their password. They go through our &quot;Forget password&quot; flow on the front-end of our site, receive the reset email, which allows them to create a new password. But when they try sign in, they receive the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eaMRu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eaMRu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21352/invalid-verification-code-please-login-or-reset-your-password&quot;&gt;this thread&lt;/a&gt;, I thought the issue might have been our email parsing… but here's the weird thing… same thing happens when I grab the reset link directly from the control panel using this dialog then pasting it directly in a different (signed-out) browser:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FzUZQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FzUZQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting the exact same error every time I try it with either method (this was definitely working a few months ago on the same server, PHP version, etc).  Any ideas? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="352" LastActivityDate="2019-08-29T16:21:53.447" Title="Getting &quot;Invalid verification code.&quot; on password reset" Tags="&lt;error-message&gt;&lt;password&gt;&lt;hash&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23527" PostTypeId="2" ParentId="23510" CreationDate="2018-01-17T06:57:25.500" Score="1" Body="&lt;p&gt;Retour only works if the 404 actually is handled by Craft; my guess is that your Nginx config somehow is not passing along the 404 to Craft.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-17T06:57:25.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23529" PostTypeId="1" AcceptedAnswerId="23531" CreationDate="2018-01-17T16:06:37.827" Score="1" ViewCount="899" Body="&lt;p&gt;I'm trying to grab a specific image to display that is located in assets. I tried using &lt;code&gt;{% set image = craft.assets.filename('image_filename.jpg') %}&lt;/code&gt; but I get the error &quot;An unknown image object was used.&quot; I also tried referring to one of the asset sources which I saw as a solution in another post related to my question: &lt;code&gt;{% set image = craft.assets.source('my_images') %}&lt;/code&gt; but I'm not sure how that would help me grab a specific image. &lt;code&gt;{% set image = craft.assets.images[0] %}&lt;/code&gt; just grabs an image from any of the asset sources if I change the index number. What am I doing wrong here?? Thanks in advance!  &lt;/p&gt;&#xA;" OwnerUserId="7706" LastActivityDate="2018-01-17T17:35:21.723" Title="Display a specific image from assets" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23530" PostTypeId="1" CreationDate="2018-01-17T16:39:40.573" Score="1" ViewCount="225" Body="&lt;p&gt;I'm trying to add a hidden input with Sprout forms and Sprout fields but I can't dynamically add a value to the input attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a custom form template in &lt;code&gt;craft/templates/_forms/field.html&lt;/code&gt; in which I have the following code for the hidden field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set name = field.handle is defined ? field.handle : null %}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ name }}&quot; value=&quot;{{ settings.value }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This now returns whatever value I put into the 'Hidden Field Value' input in the form builder in Craft, but if I put any dynamic data in there, e.g. &lt;code&gt;{{ craft.request.path }}&lt;/code&gt; (which is also the placeholder text), I get the same literal string back: &quot;{{ craft.request.path }}&quot;. I've also tried with single braces, as I read that this might be the correct syntax, but I get the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually, I am wanting to set the value to &lt;code&gt;{{ entry.title }}&lt;/code&gt;. I read that I need to add this to my template to be able to access non-global variables &lt;code&gt;{% do craft.sproutForms.addFieldVariables({ entry: entry }) %}&lt;/code&gt; - does this go in the entry template just before the form, or in the form template. I get an error saying &lt;code&gt;Variable &quot;entry&quot; does not exist&lt;/code&gt; if I put it in the form template so I'm guessing it goes in the entry template.&lt;/p&gt;&#xA;" OwnerUserId="7021" LastActivityDate="2018-01-17T16:39:40.573" Title="Can't dynamically add value to hidden input Sprout field" Tags="&lt;plugins&gt;&lt;form&gt;&lt;field&gt;&lt;plugin-sproutforms&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23531" PostTypeId="2" ParentId="23529" CreationDate="2018-01-17T17:35:21.723" Score="2" Body="&lt;p&gt;You can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% image = craft.assets.id(x).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where x is the ID of your element. You can see the ids of your elements in your cp. There is a little wheel icon below your asset sources where you can define which attributes to display. Just check the selectbox for id&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can learn more about fetching entries with &lt;code&gt;ElementCriteriaModels&lt;/code&gt; in the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#parameter-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem was: you did not fetch the element. You prepared your database query but you need to execute it with &lt;code&gt;first()&lt;/code&gt; or &lt;code&gt;find()&lt;/code&gt; because&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-17T17:35:21.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23532" PostTypeId="1" AcceptedAnswerId="23533" CreationDate="2018-01-17T23:21:20.210" Score="1" ViewCount="209" Body="&lt;p&gt;Is there any way to add to the fields shown on the 'Account' tab on the user account screen?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can add fields via the layout designer, but these appear as seperate tabs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to add &quot;middle name(s)&quot; as a field next to &quot;First Name&quot; and &quot;Last Name&quot; if possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X09e8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X09e8.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="567" LastEditorUserId="567" LastEditDate="2018-01-18T03:46:04.540" LastActivityDate="2018-01-24T19:15:54.533" Title="Can I add fields to the User &gt; Account screen?" Tags="&lt;users&gt;&lt;field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23533" PostTypeId="2" ParentId="23532" CreationDate="2018-01-18T00:04:16.267" Score="2" Body="&lt;p&gt;User content fields can only be customized within the additional tabs, configured in the field layout interface. Users are a built-in custom Element Type, and have some non-configurable fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is likely a measure taken by the Craft authors to isolate and protect important fields from being lost among other custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to create front-end form that rearranges these fields, if the UX of the admin is unworkable for your users!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit (1/24/2018): In &lt;a href=&quot;https://craftcms.com/changelog#2-6-3005&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.6.3005&lt;/a&gt;, the authors have added support for multiple tabs in the User edit screen. This doesn't change our ability to customize the first page, but allows you to add more tabs to organize the remainder of your fields. ✌️&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-01-24T19:15:54.533" LastActivityDate="2018-01-24T19:15:54.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23534" PostTypeId="1" AcceptedAnswerId="23548" CreationDate="2018-01-18T07:40:48.807" Score="1" ViewCount="139" Body="&lt;p&gt;I am trying to do this. Have a structure url like so: /{id}-{slug} and /{parent.id}/{id}-{slug}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the slug on the url but I only for SEO, I want craft to ignore the slug and only go for the ID. So even though it is /{id}-{slug} for craft it would be /{id} and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the recommended approach? Advanced routing? Manually remove the -{slug} and search by {id} on the template? Any other way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4941" LastActivityDate="2018-09-24T05:20:14.723" Title="Advanced routing" Tags="&lt;url&gt;&lt;routes&gt;&lt;slug&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23535" PostTypeId="1" CreationDate="2018-01-18T09:59:39.190" Score="3" ViewCount="186" Body="&lt;p&gt;I've been updating a number of my plugins for Craft 3 lately; part of that process has been to create entirely separate repositories/projects to accommodate the differences between Craft 2.x &amp;amp; 3.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious to know how other developers maintain two plugins where the core functionality is essentially the same code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe having both plugins refer to the same dependancies via composer? (But still have two repos/projects)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps keep everything on one repo/project and simply have two versions of the plugin in there. Although that may conflict with Craft 3's plugin store; as half the files int he repo are redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to know how others are dealing with their plugin upgrades and if there are any 'official' practices to resolve this. &lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="57" LastEditDate="2018-01-18T20:45:36.173" LastActivityDate="2018-01-18T20:45:36.173" Title="Craft 3 plugin backwards compatibility and maintenance for 2.x" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23536" PostTypeId="2" ParentId="23535" CreationDate="2018-01-18T10:29:56.017" Score="2" Body="&lt;p&gt;As far as I know most people create a new branche in the existing git repo for the plugin. Unless you create an API with many external calls you won't be able to maintain one &quot;core&quot; file that can be used by both versions because of the differences between Yii and Yii2. Thus creating a composer dependency for shared files is out of the question for most plugins. That's only possible if the code can be used outside of Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My company migrates all important plugins for Craft 3 in a new branche in the same repo but we don't really update the Craft 2 code and only do bugfixes when it's necessary. It would be too expensive to update the old version when you compare the benefits &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can handle it the way you like. There is no official guideline or a official &quot;best practice&quot; method. Like everything else in the software industry there are advantages and disadvantages and you have to find a way that fits your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are going to maintain your Craft 2 support and if you want to continue to work for v2 plugins you'll need to migrate every new feature to your v3 version as well which can take quite a lot of time. If you are going to create future projects only with Craft 3 you might want to stop your development for v2 plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore Craft 3 is more powerful so there will be features that are really easy to implement while it takes much more effort to do the same thing in Craft 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It depends what your company offers. Do you only sell &quot;sites&quot; I suggest to continue only with Craft 3 - if you sell plugins there might be people who refuse to use Craft 3 for whatever reasons or they need to include some new features so they still buy your Craft 2 plugin. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-18T10:35:49.740" LastActivityDate="2018-01-18T10:35:49.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23537" PostTypeId="1" CreationDate="2018-01-18T13:39:34.723" Score="1" ViewCount="94" Body="&lt;p&gt;I'm creating a site that works now at www.mysite.com/public/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to get to drop the /public off the url so it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.mysite.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7167" LastEditorUserId="14" LastEditDate="2018-01-18T13:50:18.850" LastActivityDate="2018-01-18T13:50:18.850" Title="Making a base url without /public" Tags="&lt;server&gt;&lt;nginx&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23538" PostTypeId="2" ParentId="23537" CreationDate="2018-01-18T13:49:14.383" Score="1" Body="&lt;p&gt;This is not so much a Craft question as a web server question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directory structure of Craft is intended for the web server to have the public (or web in Craft 3) directory configured as the document root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a configuration setting you’ll find in your Apache, Nginx or other web server documentation.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2018-01-18T13:49:14.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23540" PostTypeId="1" AcceptedAnswerId="23541" CreationDate="2018-01-18T16:52:20.023" Score="1" ViewCount="51" Body="&lt;p&gt;I have an issue with categories with different levels:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a group of categories which have a structure like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First form:&#xA;1.0 Group –&#xA;1.1 Subgroup –&#xA;1.2 Items in subgroup&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second form:&#xA; - 1.0 Group –&#xA;   1.1 Items in Group&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some groups are subgroups in others aren't. But I need to list all the items, regardless if they are in a subgroup or not. How can I adress them correctly. Can I do an if statement like: if there is no 1.2 level, take the 1.1 level and treat it like a 1.2 level?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-01-18T18:28:26.380" Title="Entries from different category levels brought together" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23541" PostTypeId="2" ParentId="23540" CreationDate="2018-01-18T18:28:26.380" Score="2" Body="&lt;p&gt;What you want is the categories that do not have descendants. I would loop over all the categories, and skip the ones with descendants. The test to skip is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not category.hasDescendants %} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Documentation for &lt;a href=&quot;https://craftcms.com/docs/templating/categorymodel#hasDescendants&quot; rel=&quot;nofollow noreferrer&quot;&gt;hasDescendants&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-01-18T18:28:26.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23542" PostTypeId="2" ParentId="23535" CreationDate="2018-01-18T20:41:05.553" Score="4" Body="&lt;p&gt;This seems to be the common pattern emerging amongst developers in the same position...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single repo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft-(pluginname)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Containing multiple branches:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v1 (your old Craft 2 version)&#xA;v2 (your new Craft 3 version)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are a handful of variations to this, but that's it in a nutshell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt; *&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-notes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/doublesecretagency/craft-cpcss&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/doublesecretagency/craft-cpcss&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/marionnewlevant/craft-snitch&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marionnewlevant/craft-snitch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/carlcs/craft-deleteentryversions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/carlcs/craft-deleteentryversions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* P&amp;amp;T has mentioned that they didn't prefix their own repos with &lt;code&gt;craft-&lt;/code&gt;, since the repo is owned by &lt;code&gt;craftcms&lt;/code&gt;. But they said they would have, if they were a 3rd party developer.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people have prefixed their repos with &lt;code&gt;craft3-&lt;/code&gt;, but that has been discouraged by the folks at P&amp;amp;T. It would force you to abandon this repo (or leave the name confusing) when Craft 4 is eventually released.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-18T20:41:05.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23543" PostTypeId="1" CreationDate="2018-01-18T22:28:58.267" Score="1" ViewCount="233" Body="&lt;p&gt;I'm trying to loop through images that are eager-loaded inside matrix block, but I can't get the images inside a matrix field handle to loop and show each individual image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The loop I have loops the correct amount of times (based on how many images there are in each matrix block), but it just shows the first image of the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the set up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section handle: products&#xA;Matrix field handle: imageTextSections&#xA;Block type handle: sectionBlock&#xA;Field handle: sectionBlockImages&#xA;Field type: Assets&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to loop through images that are eager-loaded inside matrix block, but I can't get the images inside a matrix field to loop and show each individual image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The loop I have loops the correct amount of times (based on how many images there are in each matrix block), but it just shows the first image of the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the set up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section handle: products&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix field handle: imageTextSections&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Block type handle: sectionBlock&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field handle: sectionBlockImages&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field type: Assets&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = entry.imageTextSections.find({&#xA;    with: [&#xA;        'sectionBlock:sectionBlockImages'&#xA;    ]&#xA;}) %}&#xA;&#xA;{% for block in blocks %}&#xA;...&#xA;&#xA;{% for images in block.sectionBlockImages %}&#xA;    {% set image = block.sectionBlockImages[0] ?? null %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figured that the following would work, but I get an error stating that the AssetFileModel.0 is not defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for images in block.sectionBlockImages %}&#xA;    {% set image = images[0] ?? null %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any guidance would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5958" LastActivityDate="2018-01-19T07:36:08.587" Title="Looping through an assets field type within a matrix field that's eager loaded" Tags="&lt;matrix&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23544" PostTypeId="1" AcceptedAnswerId="23561" CreationDate="2018-01-18T22:47:20.040" Score="1" ViewCount="280" Body="&lt;p&gt;I would like to prevent the 'Activate Your Account' w/link from being sent when users first registers via a front-end public registration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I need activation to happen manually via an Admin.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;em&gt;temporarily&lt;/em&gt; blocked this by commenting it out in &lt;code&gt;/craft/app/controllers/UsersController.php&lt;/code&gt; &#xA;Obviously I do not want to go to production with this, so how can I disable via a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in question appears on line 1049:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//&#xA;        if ($verifyNewEmail)&#xA;        {&#xA;            // Temporarily set the unverified email on the UserModel so the verification email goes to the&#xA;            // right place&#xA;            $originalEmail = $user-&amp;gt;email;&#xA;            $user-&amp;gt;email = $user-&amp;gt;unverifiedEmail;&#xA;&#xA;            if ($isNewUser)&#xA;            {&#xA;                // Send the activation email&#xA;                // $emailSent = craft()-&amp;gt;users-&amp;gt;sendActivationEmail($user);&#xA;                $emailSent = true; // *** NOT TRUE, BUT HACKED ***&#xA;            }&#xA;            else&#xA;            {&#xA;                // Send the standard verification email&#xA;                $emailSent = craft()-&amp;gt;users-&amp;gt;sendNewEmailVerifyEmail($user);&#xA;            }&#xA;&#xA;            if (!$emailSent)&#xA;            {&#xA;                craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('User saved, but couldn’t send verification email. Check your email settings.'));&#xA;            }&#xA;&#xA;            // Put the original email back into place&#xA;            $user-&amp;gt;email = $originalEmail;&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3614" LastActivityDate="2018-01-19T22:08:00.207" Title="Prevent Activation Email on creation - Wait for Admin Approval" Tags="&lt;activation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23545" PostTypeId="2" ParentId="23543" CreationDate="2018-01-19T07:36:08.587" Score="2" Body="&lt;p&gt;Eager loading an Assets field simply means that instead of &lt;code&gt;block.sectionBlockImages&lt;/code&gt; returning an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, it'll return an array. This means that you can't do stuff like &lt;code&gt;block.sectionBlockImages.first()&lt;/code&gt;, but have to use brackets notation – i.e. &lt;code&gt;block.sectionBlockImages[0]&lt;/code&gt; to access the first Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looping over the field would look exactly the same, though. So you'll need to change this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for images in block.sectionBlockImages %}&#xA;    {% set image = block.sectionBlockImages[0] ?? null %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.sectionBlockImages %}&#xA;    &amp;lt;img src=&quot;{{ image.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and you should be good.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-01-19T07:36:08.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23548" PostTypeId="2" ParentId="23534" CreationDate="2018-01-19T10:49:55.310" Score="2" Body="&lt;p&gt;I'd probably setup the following routes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'blog/*/*' =&amp;gt; 'blog/entry',&#xA;'blog/*' =&amp;gt; 'blog/entry',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then on the entry template I'd get the last segment and &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/split.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;split it&lt;/a&gt; to get the ID like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segment = craft.request.lastSegment | split('-') %}&#xA;{% set id = segment[0] %}&#xA;{% set entry = craft.entries.id(id).first %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should work for either of your {id}-{slug} examples. Though in practice I'd probably fetch the entry using the slug and not the ID as I think it looks prettier and I don't like IDs in URLs.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-01-19T10:49:55.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23549" PostTypeId="2" ParentId="23190" CreationDate="2018-01-19T10:58:25.177" Score="1" Body="&lt;p&gt;Well, I started by removing unwanted orders over a month old and that's got the commerce_orders table down to 10 MB. Whether it's a coincidence I'm not sure, but now the searchindex and elements tables are down to 10 MB each also.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-01-19T10:58:25.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23550" PostTypeId="2" ParentId="22394" CreationDate="2018-01-19T11:00:11.793" Score="1" Body="&lt;p&gt;The answer looks to be &quot;Not if you're using the Legacy gateway&quot; that all my clients seem to be using.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-01-19T11:00:11.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23551" PostTypeId="2" ParentId="22847" CreationDate="2018-01-19T12:55:33.950" Score="0" Body="&lt;p&gt;Maybe this is a stupid idea (correct me if so) but why don't you use a shared folder through Dropbox, Spideroak or Tresorit to synch the assets?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2018-01-19T12:55:33.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23553" PostTypeId="1" AcceptedAnswerId="23563" CreationDate="2018-01-19T15:33:55.730" Score="2" ViewCount="239" Body="&lt;p&gt;Switching over to a new server and using PHP 7.0 (and 7.1) everything looked to be fine until I tried to view an order PDF within an email from Craft Commerce. Even using the email template provided by the plugin. The error is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No block-level parent found. Not good.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't remember which DOM-PDF issue thread I came across it in, but the solution is to remove &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from the document. Does anyone know of a more elegant solution? I don't think it's my server.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-02-15T09:29:39.227" Title="PHP 7.0 and 7.1 PDF error with Craft Commerce orders" Tags="&lt;plugin-craftcommerce&gt;&lt;dompdf&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23555" PostTypeId="1" AcceptedAnswerId="23557" CreationDate="2018-01-19T17:57:27.073" Score="1" ViewCount="181" Body="&lt;p&gt;Channels:&#xA;  Photographers&#xA;  Photos - entries field handle &quot;photographers&quot;&#xA;         - categories field handle &quot;category&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;url structure where segment 2 is the photographer slug and segment 3 is the photo category slug:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;domain.com/photographers/john-doe/food&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the photographers detail page I need to pull up the photos entries that are related to that photographer and in the category determined by segment 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set at the top of the page and used in a couple of different spots&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set segment variables so we can use shorthand #}&#xA;{% set segment_2 = craft.request.getSegment(2) %}&#xA;{% set segment_3 = craft.request.getSegment(3) %}&#xA;&#xA;{# get related photo entries #}&#xA;{% set photos = craft.entries.section('photos').relatedTo(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then where I want the photos to display I have the following code which outputs 2 entries from the photos channel. These are both related to the current photographer but in different categories. Only the one entry that is both related to the photographer and the current category should be output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# set currentCategory to category id from segment 3 #}&#xA;  {% set currentCategory = craft.categories.slug(segment_3).first() %}&#xA;&#xA;  {% set photos = photos.relatedTo(currentCategory.id) %}&#xA;&#xA;  {% for photo in photos %}&#xA;    {{ photo.title }} &amp;lt;br&amp;gt;&#xA;  {%endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to combine and filter these relations. Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-08-01T13:08:56.907" Title="Get Related Entries and then filter those by specific category in url segment" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23556" PostTypeId="1" AcceptedAnswerId="23562" CreationDate="2018-01-19T18:54:11.713" Score="1" ViewCount="195" Body="&lt;p&gt;I've searched around and other solutions don't seem to be working I must be missing something obvious&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what i'm doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myVar = '' %}&#xA;{% for block in entry.matrixComponent %}&#xA;     {% if block.type == &quot;matixBlockType&quot; %}&#xA;          {% set myVar = block.matrixBlockField.ids() %}&#xA;     {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to work when I dump myVar I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(1) {&#xA;  [0]=&amp;gt;&#xA;  string(5) &quot;10032&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is indeed the id I'm looking for. I then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.id not in myVar %}&#xA;    &amp;lt;div&amp;gt; {{ entry.id }} {{ Title }} not in myVar &amp;lt;/div&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;div&amp;gt; {{ entry.id }} {{ Title }} is in myVar {{ myVar }} &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It lists out my posts in the matrix component, and where the entry.id matches myVar it still says not in myVar even though it would seem to me that it should have excluded it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why it is listing the entry that matches myVar's Id&lt;/p&gt;&#xA;" OwnerUserId="7838" LastEditorUserId="57" LastEditDate="2018-01-19T22:53:54.770" LastActivityDate="2018-01-19T23:03:30.563" Title="filter entries by id retrieved from matrix block entry" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23557" PostTypeId="2" ParentId="23555" CreationDate="2018-01-19T19:16:13.073" Score="1" Body="&lt;p&gt;So I solved this with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# &#xA;   // loop through related photos&#xA;   // and loop through related category photos&#xA;   // set photoId = to common id in both loops&#xA;  #}&#xA;  {% set photoId = &quot;&quot; %}&#xA;  {% for photo in photos %}&#xA;    {% for catPhoto in photos.relatedTo(currentCategory.id) %}&#xA;      {% if photo.id == catPhoto.id %}&#xA;&#xA;        {% set photoId = catPhoto.id %}&#xA;        {# {% set photoId = photoId|merge([catPhoto.id]) %} #}&#xA;      {% endif %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the following outputs the entry in question&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for photo in craft.entries.section('photos').id(photoId).find() %}&#xA;  // output entry related to photographer and category here&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-01-19T19:16:13.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23558" PostTypeId="1" AcceptedAnswerId="23559" CreationDate="2018-01-19T19:25:54.403" Score="1" ViewCount="199" Body="&lt;p&gt;I'm trying to target the first matrix block and changing the structure of the HTML, but nesting an IF statement within the loop but it's actually not doing anything, instead it's just displaying both the same. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;accordion&quot; role=&quot;tablist&quot; class=&quot;accordion-vt&quot;&amp;gt;&#xA;{% for block in entry.contentMatrix %}&#xA;{% if entry.contentMatrix.first %}&#xA;&#xA;  &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;card-header&quot; role=&quot;tab&quot; id=&quot;headingOne&quot;&amp;gt;&#xA;      &amp;lt;h1 class=&quot;mb-0&quot;&amp;gt;&#xA;        &amp;lt;a data-toggle=&quot;collapse&quot; href=&quot;#collapseOne&quot; role=&quot;button&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;collapseOne&quot;&amp;gt;&#xA;          {{ block.contentTitle }}&#xA;        &amp;lt;/a&amp;gt;&#xA;      &amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;collapseOne&quot; class=&quot;collapse show&quot; role=&quot;tabpanel&quot; aria-labelledby=&quot;headingOne&quot; data-parent=&quot;#accordion&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;        {{ block.contentDescription }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  {% else %}&#xA;&#xA;  &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;card-header&quot; role=&quot;tab&quot; id=&quot;headingOne&quot;&amp;gt;&#xA;      &amp;lt;h1 class=&quot;mb-0&quot;&amp;gt;&#xA;        &amp;lt;a data-toggle=&quot;collapse&quot; href=&quot;#collapseOne&quot; role=&quot;button&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;collapseOne&quot;&amp;gt;&#xA;          {{ block.contentTitle }}&#xA;        &amp;lt;/a&amp;gt;&#xA;      &amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div id=&quot;collapseOne&quot; class=&quot;collapse&quot; role=&quot;tabpanel&quot; aria-labelledby=&quot;headingOne&quot; data-parent=&quot;#accordion&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;        {{ block.contentDescription }}&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-01-20T12:05:27.970" Title="Changing first matrix block" Tags="&lt;templating&gt;&lt;entry&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23559" PostTypeId="2" ParentId="23558" CreationDate="2018-01-19T21:30:22.687" Score="2" Body="&lt;p&gt;Your condition &lt;code&gt;{% if entry.contentMatrix.first %}&lt;/code&gt; will check if there exists a block in your field or not, it does not check if your current block is the first or not. Since there is one the condition will always become true. What you want to do is to check if you are in the first loop or not so I would suggest you to do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for key, block in entry.contentMatrix %}&#xA;    {% if key == 0 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or something like that &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-20T12:05:27.970" LastActivityDate="2018-01-20T12:05:27.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23561" PostTypeId="2" ParentId="23544" CreationDate="2018-01-19T22:08:00.207" Score="1" Body="&lt;p&gt;Thanks to @BradBell - I just needed to use the Admin setting.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Seems like you just want to uncheck &quot;Verify Email Addresses?&quot; under &gt;Settings-&gt;Users-&gt;Settings&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3614" LastActivityDate="2018-01-19T22:08:00.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23562" PostTypeId="2" ParentId="23556" CreationDate="2018-01-19T23:03:30.563" Score="0" Body="&lt;p&gt;If I do a similar test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myVar = ['10032'] %}&#xA;&#xA;{{ dump(myVar) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gives:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array (size=1)&#xA;  0 =&amp;gt; string '10032' (length=5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just like yours.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryId = 10032 %}&#xA;&#xA;{% if entryId not in myVar %}&#xA;    {{ entryId }} not in myVar&#xA;{% else %}&#xA;    {{ entryId }} is in myVar&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10032 is in myVar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As expected.  Changing &lt;code&gt;entryId&lt;/code&gt; to something other than 10032 gives the expected &quot;is not in myVar&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;is in myVar {{ myVar }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will cause an array to string conversion error because you're telling Twig to output an array to the browser and it doesn't know how.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-19T23:03:30.563" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23563" PostTypeId="2" ParentId="23553" CreationDate="2018-01-20T09:06:33.613" Score="2" Body="&lt;p&gt;I came across the same issue yesterday. After a bit of reading and trial and error I found the most elegant way for now is to remove the white space between these elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&#xA;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&#xA;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I achieved this by adding comments &lt;code&gt;&amp;lt;!--  --&amp;gt;&lt;/code&gt; between to remove the white space&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;!--&#xA;--&amp;gt;&amp;lt;head&amp;gt;&#xA;&amp;lt;/head&amp;gt;&amp;lt;!--&#xA;--&amp;gt;&amp;lt;body&amp;gt;&#xA;&amp;lt;/body&amp;gt;&amp;lt;!--&#xA;--&amp;gt;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I piked this up from this thread initially. &#xA;&lt;a href=&quot;https://github.com/barryvdh/laravel-dompdf/issues/389&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barryvdh/laravel-dompdf/issues/389&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the proper solution might be to enable the html5 parser, but I think this might be a config setting within the DomPDF? Would this fall ino the Craft Commerce files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;&quot;enable_html5_parser&quot; =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2018-01-20T09:12:30.580" LastActivityDate="2018-01-20T09:12:30.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23565" PostTypeId="1" CreationDate="2018-01-20T15:50:34.177" Score="1" ViewCount="266" Body="&lt;p&gt;I inherited a Craft site which uses phpdotenv (which I'm unfamiliar with) and which I now have to make multi-lingual (&lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/localization-guide&lt;/a&gt;) with an added es and fr locale on top of the english language site.&#xA;The question is regarding the setup on MAMP which seems to never find the .env file.&#xA;On my production server in /es/index.php this works:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Composer autoload&#xA;require_once('../../vendor/autoload.php');&#xA;&#xA;// DotEnv&#xA;try {&#xA;    $dotenv = new Dotenv\Dotenv('../../');&#xA;    $dotenv-&amp;gt;required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS']);&#xA;} catch (Exception $e) {&#xA;    exit('Could not find a .env file.');&#xA;}&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the spanish content&#xA;define('CRAFT_LOCALE', 'es');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the same code on my local MAMP install will not find the .env file no matter what path I enter into the new dotenv statement....&#xA;Anyone have any idea or suggestion? Truly stumped here.&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="9" LastEditDate="2018-01-20T23:46:55.623" LastActivityDate="2018-01-21T10:22:22.973" Title="phpdotenv with multi-lang Craft setup on MAMP" Tags="&lt;localization&gt;&lt;multi-environment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23566" PostTypeId="1" AcceptedAnswerId="23573" CreationDate="2018-01-20T17:24:16.170" Score="1" ViewCount="2140" Body="&lt;p&gt;I'm currently trying to get my URL's to be like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;category/brand/offer/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category has a title &lt;/li&gt;&#xA;&lt;li&gt;Brand has a 'shortName' property.&lt;/li&gt;&#xA;&lt;li&gt;Offer has a title&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My plan is to have it so that it goes something like &lt;strong&gt;fashion/asos/50-off&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri}/offers/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried quite a few variations but can't seem to get it right, still loads a 404 page or throws an error in the dashboard when trying to save entries again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be brilliant!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Offer entries are related via the relatedBrand entry field.&lt;/li&gt;&#xA;&lt;li&gt;Offer has not category related to it.&lt;/li&gt;&#xA;&lt;li&gt;Brands have a category field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2018-01-21T13:01:59.623" LastActivityDate="2018-01-21T20:12:41.033" Title="Entry URL Format" Tags="&lt;entries&gt;&lt;url&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23567" PostTypeId="2" ParentId="23565" CreationDate="2018-01-20T23:39:14.473" Score="3" Body="&lt;p&gt;Some troubleshooting steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure a &lt;code&gt;vendor/&lt;/code&gt; folder exists two levels up from &lt;code&gt;es/&lt;/code&gt;. If not, you need to run &lt;code&gt;composer install&lt;/code&gt; in your terminal from the directory that contains a &lt;code&gt;composer.json&lt;/code&gt; file. (If you don’t have Composer installed, see its &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;installation instructions&lt;/a&gt;.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure a &lt;code&gt;.env&lt;/code&gt; file exists two levels up from &lt;code&gt;es/&lt;/code&gt;. It probably won’t, as you’re not supposed to include your &lt;code&gt;.env&lt;/code&gt; file in the Git repo. You can copy it from production, or from &lt;code&gt;.env.example&lt;/code&gt; if that exists. Then fill it in with working credentials for your local environment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Matt Stauffer wrote a great article explaining how to get phpdotenv running with Craft 2: &lt;a href=&quot;https://mattstauffer.com/blog/environment-specific-configuration-for-craftcms-using-phpdotenv/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mattstauffer.com/blog/environment-specific-configuration-for-craftcms-using-phpdotenv/&lt;/a&gt; Probably a good idea to read through that just to get an idea of how it’s all supposed to work (and what the advantages are).&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-01-20T23:39:14.473" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23568" PostTypeId="1" AcceptedAnswerId="23569" CreationDate="2018-01-21T02:04:15.097" Score="1" ViewCount="98" Body="&lt;p&gt;So I have a Commerce product template page that grabs products something like this (segment 3 is the category slug):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(craft.request.getSegment(3)).first() %}&#xA;&#xA;{% set product = craft.commerce.products({&#xA;    relatedTo: category,&#xA;    status: 'live',&#xA;}).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I need this page to 404 if the category slug isn't in a collection of categories that are chosen in a global field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in myGlobal.liveCategories %}&#xA;    These categories, like this one {{ category.title }}, are the only categories that are allowed right now&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I want to filter &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(craft.request.getSegment(3)).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;against my global category field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myGlobal.liveCategories&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so that only the &lt;code&gt;category&lt;/code&gt; that gets passed to my product loop is a valid category in the global set. Here is what I'm trying to accomplish, but this code block doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(craft.request.getSegment(3)).first() %}&#xA;&#xA;{% if category not in myGlobal.liveCategories %}&#xA;    {% redirect 404 %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume I have to do some twig filtering, or create arrays and combine, ...or something. &lt;/p&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2018-01-21T08:15:46.060" Title="Filtering category objects in a template?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23569" PostTypeId="2" ParentId="23568" CreationDate="2018-01-21T08:05:54.707" Score="1" Body="&lt;p&gt;You can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set ids = myGlobal.liveCategories.ids() %}&#xA;{% set category = craft.categories.slug(craft.request.getSegment(3)).id(ids).first() %} &#xA;{% if category %} &#xA;    The category is valid &#xA;{% else %} &#xA;    No slug found, or the category is not in the list &#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: you grab all the ids from your allowed categories and search for them in your query. If a category is found it is one of the allowed categories. If not the category is another one or the there is no element with a matching slug. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-21T08:15:46.060" LastActivityDate="2018-01-21T08:15:46.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23570" PostTypeId="2" ParentId="23565" CreationDate="2018-01-21T10:14:29.623" Score="3" Body="&lt;p&gt;My current setup for multilingual sites:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;as Brandon said, make sure there is a &lt;code&gt;vendor/&lt;/code&gt; folder at project root level (there should be one in this case otherwise the site wouldn't run).&lt;/li&gt;&#xA;&lt;li&gt;extract the &lt;code&gt;phpdotenv&lt;/code&gt; part of the code from your base &lt;code&gt;index.php&lt;/code&gt; and put it into an &lt;code&gt;env.php&lt;/code&gt; that you create at the same level as your main &lt;code&gt;index.php&lt;/code&gt; file.&lt;/li&gt;&#xA;&lt;li&gt;require this new file at the top of your main &lt;code&gt;index.php&lt;/code&gt; using &lt;code&gt;require_once 'env.php';&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;check that this more modular install is running fine (it should since you have only abstracted the &lt;code&gt;phpdotenv&lt;/code&gt; part)&lt;/li&gt;&#xA;&lt;li&gt;in your &lt;code&gt;fr/&lt;/code&gt; and &lt;code&gt;es/&lt;/code&gt; locales folders, just copy your main &lt;code&gt;index.php&lt;/code&gt;, change the relative paths (the require once and the craft folder) and define your Craft locale.&lt;/li&gt;&#xA;&lt;li&gt;you should be set&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is a rough draft of what you should get to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;public/env.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Composer autoload (assuming '/vendor' is at the root and this is in '/public'&#xA;require_once('../vendor/autoload.php');&#xA;&#xA;// DotEnv&#xA;try {&#xA;  $dotenv = new Dotenv\Dotenv(dirname(__DIR__));&#xA;  $dotenv-&amp;gt;load();&#xA;  $dotenv-&amp;gt;required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS']);&#xA;} catch (Exception $e) {&#xA;  exit('Could not find a .env file.');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;public/index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;// require 'env.php' only once&#xA;require_once 'env.php';&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../craft';&#xA;&#xA;// Tell Craft to serve the French content&#xA;define('CRAFT_LOCALE', 'en');&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;public/fr/index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;// require 'env.php' only once&#xA;require_once '../env.php';&#xA;&#xA;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the French content&#xA;define('CRAFT_LOCALE', 'fr');&#xA;&#xA;// Do not edit below this line&#xA;$path = rtrim($craftPath, '/').'/app/index.php';&#xA;&#xA;if (!is_file($path))&#xA;{&#xA;    if (function_exists('http_response_code'))&#xA;    {&#xA;        http_response_code(503);&#xA;    }&#xA;&#xA;    exit('Could not find your craft/ folder. Please ensure that &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;$craftPath&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is set correctly in '.__FILE__);&#xA;}&#xA;&#xA;require_once $path;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;phpdotenv and composer are an integral part of Craft3 as well as of all modern PHP apps so it's worth getting familiar with. Basically just dependency management for PHP (Composer) and putting all your sensitive info in a file not committed to repo (phpdotenv).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2018-01-21T10:22:22.973" LastActivityDate="2018-01-21T10:22:22.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23571" PostTypeId="1" AcceptedAnswerId="23572" CreationDate="2018-01-21T16:19:04.057" Score="3" ViewCount="1166" Body="&lt;p&gt;Is it possible to auto enable/install a plugin through config (or another way) rather than having to do this through the database?&lt;/p&gt;&#xA;" OwnerUserId="5470" LastActivityDate="2018-01-23T03:34:01.033" Title="Auto enable/install plugin through config" Tags="&lt;plugins&gt;&lt;config&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23572" PostTypeId="2" ParentId="23571" CreationDate="2018-01-21T19:09:10.790" Score="3" Body="&lt;p&gt;The short answer is no. The long answer is sortof, if you’re running Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since plugins are technically &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-structure-modules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;modules&lt;/a&gt; in Craft 3, you should be able to bootstrap a plugin onto the application just like any other module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, update &lt;code&gt;config/app.php&lt;/code&gt; with these &lt;code&gt;modules&lt;/code&gt; and &lt;code&gt;bootstrap&lt;/code&gt; sub-arrays:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    'modules' =&amp;gt; [&#xA;        'contact-form' =&amp;gt; function() {&#xA;            $plugin = Craft::$app-&amp;gt;plugins-&amp;gt;createPlugin('contact-form');&#xA;            $plugin-&amp;gt;setSettings([&#xA;                'toEmail' =&amp;gt; 'foo@bar.baz',&#xA;            ]);&#xA;            return $plugin;&#xA;        }&#xA;    ],&#xA;&#xA;    'bootstrap' =&amp;gt; [&#xA;        'contact-form',&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form&lt;/a&gt; as an example. For a different plugin, replace all of the &lt;code&gt;'contact-form'&lt;/code&gt; strings with the right plugin handle, and change the settings array to whatever the plugin is expecting. (You can find which settings keys the plugin supports by checking its Settings model – usually either &lt;code&gt;src/Settings.php&lt;/code&gt; or &lt;code&gt;src/models/Settings.php&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some caveats off the top of my head, though:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft won’t know that the plugin is installed, so it will still look like an uninstalled plugin in Settings → Plugins.&lt;/li&gt;&#xA;&lt;li&gt;You won’t be able to edit the plugin’s settings in the Control Panel; only from &lt;code&gt;config/app.php&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;You won’t be able to update the plugin from the Control Panel; only via &lt;code&gt;composer update&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the plugin has an &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/plugin-migrations.md#install-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;install migration&lt;/a&gt;, you will need to manually duplicate it as &lt;a href=&quot;https://github.com/craftcms/docs/blob/master/en/content-migrations.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;content migrations&lt;/a&gt;. And whenever you update the plugin, you’ll need to check if it added any new migrations, and manually duplicate those as content migrations as well. (Any migrations that were there at the time you first installed the plugin, besides the Install migration, can be ignored.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want to be able to install a plugin &lt;em&gt;programmatically&lt;/em&gt;, but don’t mind if the plugin ends up getting a row in the &lt;code&gt;plugins&lt;/code&gt; DB table, that’s easy. Just create a new &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/content-migrations.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;content migration&lt;/a&gt;, with the following &lt;code&gt;safeUp()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function safeUp()&#xA;{&#xA;    Craft::$app-&amp;gt;plugins-&amp;gt;installPlugin('plugin-handle');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you just need to run the migration on each of your environments. You can either do that from Utilities → Migrations in the Control Panel, or by running the following CLI command:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;./craft migrate/up&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe worth noting that you can also install plugins directly from the terminal, using this command:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;./craft install/plugin &amp;lt;plugin-handle&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-01-23T03:34:01.033" LastActivityDate="2018-01-23T03:34:01.033" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23573" PostTypeId="2" ParentId="23566" CreationDate="2018-01-21T20:12:41.033" Score="5" Body="&lt;p&gt;There are two ways you can set that up, depending on whether you want Brand entries to have a similar URI format (just without the 3rd segment), e.g. &lt;code&gt;category/brand&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you do, edit your Brands section, and give it the following Entry URI Format:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.first().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{category.one().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then edit your Offers section, and give it the following Entry URI Format:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{relatedBrand.first().uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{relatedBrand.one().uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Basically you’re telling Craft when defining an offer entry’s URI, to start with its related brand’s URI, and then tack on the offer’s slug as an additional segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my assumption is wrong, and you don’t want to give brands a similar URI format, then just build the whole thing out from your Offers section:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{relatedBrand.first().category.first().uri}/{relatedBrand.first().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{relatedBrand.one().category.one().uri}/{relatedBrand.one().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(I’m also assuming that the brands’ category field’s handle is &lt;code&gt;category&lt;/code&gt;. If not, replace &lt;code&gt;category&lt;/code&gt; with the real handle.)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Brand has a 'shortName' property.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If that is a custom field that you would like to use instead of the brand entries’ slugs, just replace &lt;code&gt;slug&lt;/code&gt; with &lt;code&gt;shortName&lt;/code&gt; where appropriate.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-01-21T20:12:41.033" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23575" PostTypeId="1" AcceptedAnswerId="23594" CreationDate="2018-01-22T10:57:32.547" Score="1" ViewCount="221" Body="&lt;p&gt;I've installed the &lt;strong&gt;Retour&lt;/strong&gt; plugin and have been able to get most of my redirects working, but have now run into a situation where the old site had multi-level category hierarchy eg: /category/category-slug/sub-category-slug url structure and the new site only has a single level eg: /news/category/category-slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I create a Regex to grab the last segment off the url, if there is more than one level of category, to use for my redirect ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like if there was only one level then the following would do: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/category/* to /news/category/$1&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips or ideas ? &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2018-01-23T13:19:17.677" Title="How do I redirect from a legacy category URL to a new catgory URL using Retour" Tags="&lt;redirect&gt;&lt;plugin-retour&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23576" PostTypeId="1" AcceptedAnswerId="23577" CreationDate="2018-01-22T11:57:19.300" Score="1" ViewCount="1379" Body="&lt;p&gt;I have a page on one of my sites which requires entries to show even if the entry is disabled, but just greyed out. Is there a way I can disable an entry and make it still show up on my webpage? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using {% if not entry.enabled %} but it doesn't show up either way. Also I'd rather it showed up in the order its laid out in the admin, not before or after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field I am trying to display is an entries field which is taking data from another Structure and is disabled in that Structure, not the one which it is being called into. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway of doing so?&lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2018-01-22T12:21:00.240" Title="Show Disabled Entries" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23577" PostTypeId="2" ParentId="23576" CreationDate="2018-01-22T12:21:00.240" Score="2" Body="&lt;p&gt;You need to include a &lt;code&gt;status(null)&lt;/code&gt; to the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to search for disabled entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set enties = craft.entries.status(null).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have a &lt;code&gt;RelationField&lt;/code&gt; you would just add it before you fetch the entries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntries = entry.myAwesomeField.status(null).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-22T12:21:00.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23578" PostTypeId="1" CreationDate="2018-01-22T14:04:47.433" Score="2" ViewCount="255" Body="&lt;p&gt;For a website I'm building for a client I've build a navigation where on hover an image changes dynamically to the image assigned to the entry. See this page for a better understanding: &lt;a href=&quot;http://sandmandance.com/dev/projects/performance&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sandmandance.com/dev/projects/performance&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all works fine but at first page load the images are only loading when hovering over the navigation which causes a small glitch. What I'd like to do (and seems like the easiest solution) is to load all the assets on page load using Eager-Loading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thing is.. I can't seem to combine it with relatedTo(category). So in short; how can I combine Eager-Loading and relatedTo(category) in a way it works?&lt;/p&gt;&#xA;" OwnerUserId="5155" LastActivityDate="2018-01-22T16:39:42.313" Title="Combine Eager-Loading and relatedTo(category)" Tags="&lt;relatedto&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23579" PostTypeId="1" AcceptedAnswerId="23593" CreationDate="2018-01-22T14:54:44.870" Score="1" ViewCount="160" Body="&lt;p&gt;I've been trying to simply sync an addition to a matrix field building block from my local dev server to the live environment database by doing a SQL dump of the &quot;craft_fields&quot; table. I now have the same entry appearing in the remote database, however in the CP fields setup the additional field is not showing up in that particular matrix field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Or in other words: How can I optimize the workflow without having to do everything twice, in each CP (dev/live), for each field added later in the project's process? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually adding fields in both CPs is very prone to errors …&lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2018-01-23T13:10:15.397" Title="Database: Syncing &quot;craft_fields&quot; table through SQL dumps not possible?" Tags="&lt;matrix&gt;&lt;database&gt;&lt;field&gt;&lt;migration&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23580" PostTypeId="2" ParentId="23578" CreationDate="2018-01-22T15:14:16.397" Score="1" Body="&lt;p&gt;I usually like to use the &lt;code&gt;.find()&lt;/code&gt; method and then you can pass in an object in your twig with criteria for the query. This is an example of eager-loading and relatedTo.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.find({&#xA;    section: 'articles',&#xA;    with: ['featuredImage'],&#xA;    limit: 4,&#xA;    relatedTo: category&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know if this helps at all otherwise I'd be happy to dig into your use case more.&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="4668" LastEditDate="2018-01-22T16:39:42.313" LastActivityDate="2018-01-22T16:39:42.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23582" PostTypeId="1" CreationDate="2018-01-22T16:40:52.500" Score="1" ViewCount="160" Body="&lt;p&gt;Is there a way to change the default rounding behaviour of Craft Commerce? Here in Switzerland we always round to 5 cents, so amounts like 9.99 or 9.22 don't really exist. Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;9.99 must be rounded to 10.00&lt;/li&gt;&#xA;&lt;li&gt;9.98 must be rounded to 10.00&lt;/li&gt;&#xA;&lt;li&gt;9.97 must be rounded to 9.95&lt;/li&gt;&#xA;&lt;li&gt;9.96 must be rounded to 9.95&lt;/li&gt;&#xA;&lt;li&gt;9.95 must stay the same&lt;/li&gt;&#xA;&lt;li&gt;9.94 must be rounded to 9.95&lt;/li&gt;&#xA;&lt;li&gt;9.93 must be rounded to 9.95&lt;/li&gt;&#xA;&lt;li&gt;9.92 must be rounded to 9.90&lt;/li&gt;&#xA;&lt;li&gt;9.91 must be rounded to 9.90&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Product Prices&lt;/strong&gt;&lt;br&gt;&#xA;The product prices we enter manually do follow the guidelines mentioned above, so we never get &quot;odd&quot; prices when putting products to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shipping Costs&lt;/strong&gt;&lt;br&gt;&#xA;Shipping costs are also no problem (it's either free or fixed price shipping).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Taxes&lt;/strong&gt;&lt;br&gt;&#xA;Taxes are a problem for us since we use a tax rate of 7.7% which can lead to &quot;odd&quot; tax amounts (and this leads to &quot;odd&quot; total amounts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Discounts&lt;/strong&gt;&lt;br&gt;&#xA;Discounts can also be a problem since they also sometimes lead to &quot;odd&quot; numbers (i.e. a 10% coupon on 14.85 is giving a discount result of -1.49 instead of -1.50).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there any way to change the rounding behaviour (either globally or for taxes only)? On the frontend part I think we could achieve that with the Twig filter &quot;number_format&quot;, but we need the correct amounts also in the backend.&lt;/p&gt;&#xA;" OwnerUserId="7897" LastEditorUserId="7897" LastEditDate="2018-01-24T03:09:43.423" LastActivityDate="2018-01-24T03:09:43.423" Title="Craft Commerce: Custom Rounding (for taxes and discounts)" Tags="&lt;plugin-craftcommerce&gt;&lt;rounding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23583" PostTypeId="1" CreationDate="2018-01-22T17:30:42.233" Score="1" ViewCount="115" Body="&lt;p&gt;I'm dealing with tag localization on an English/Spanish site and have figured out that if I create a new tag, both En and Es elements are created by default, which would be O.K. if I never had to filter tags for locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I discovered that if I &lt;em&gt;manually&lt;/em&gt; delete the duplicate element from the other locale, they do only show in their respective locales, which is ideal for this. Is there a way to do this via the admin UI?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have made the tags field on my entries non-translatable, but what would stop Craft from creating duplicate elements for the other locale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Also, if I update a tag, the other locale version that I deleted is &lt;strong&gt;recreated automatically&lt;/strong&gt; :/&lt;/p&gt;&#xA;" OwnerUserId="7625" LastEditorUserId="57" LastEditDate="2018-01-23T00:26:31.100" LastActivityDate="2018-01-23T00:26:31.100" Title="Tag Localization: how to create a tag without translation fallback version?" Tags="&lt;localization&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23584" PostTypeId="2" ParentId="23583" CreationDate="2018-01-22T21:50:24.280" Score="1" Body="&lt;p&gt;OK, so this isn't quite how i expected it to work, but it does so far. I won't post code, because you just need the right process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you're creating tags for a dual locale site of English (en) and Spanish (es)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a TagModel for first locale (en)&lt;/li&gt;&#xA;&lt;li&gt;Set attributes and content for first en version&lt;/li&gt;&#xA;&lt;li&gt;Save it&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Load a new instance of a TagModel by &lt;strong&gt;loading the tag you just saved&lt;/strong&gt; by id, but specify the &lt;strong&gt;other locale&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tag_es = craft()-&amp;gt;tags-&amp;gt;getTagById($tag_en-&amp;gt;id, &quot;es&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assign the es title, content and attributes (regenerate the slug, too!)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Save the es tag with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tags-&amp;gt;saveTag($tag_es)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, Tag Manager should keep them separated by locale, and you can query them by locale, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom line is, you have to create alternate locale versions by essentially cloning the original Tag Model while specifying the new locale string, then reassign the content and just save it. Again, not what I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Check your results in the database. Don't believe the Tag Manager — it only shows data from one locale for some reason.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastEditorUserId="7625" LastEditDate="2018-01-22T22:23:50.320" LastActivityDate="2018-01-22T22:23:50.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23585" PostTypeId="1" CreationDate="2018-01-22T22:32:37.850" Score="5" ViewCount="2015" Body="&lt;p&gt;Is there any way to get &lt;strong&gt;Craft 3&lt;/strong&gt; to display 404.html and 503.html for the 404 and 503 pages while in devMode, as it did in Craft 2, rather than returning the entire Yii 2 error stack?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, we have to bring a site temporarily offline (by way of toggle in the general settings tab) to add features, and we have to put it into dev mode for debug. We want the site to show the branded 503 page to the public instead of the stack page.&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="57" LastEditDate="2018-01-23T00:27:52.403" LastActivityDate="2019-04-18T19:52:26.847" Title="Craft 3 404 and 503 pages in devMode" Tags="&lt;craft3&gt;&lt;404&gt;&lt;yii&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23586" PostTypeId="2" ParentId="23579" CreationDate="2018-01-23T00:18:25.070" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Manually adding fields in both CPs is very prone to errors …&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, but probably less error prone that the method you're doing now. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field information is stored in more than the &lt;code&gt;craft_fields&lt;/code&gt; table.  For example, most field content is saved in &lt;code&gt;craft_content&lt;/code&gt;, but Matrix fields get their entire own tables to store Matrix content, which has dynamic rows and columns based on Matrix field settings and Matrix data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But even then &lt;code&gt;craft_matrixblocks&lt;/code&gt; and &lt;code&gt;craft_matrixblocktypes&lt;/code&gt; might change depending on what has been done.  And data might have been added to &lt;code&gt;craft_relations&lt;/code&gt; if the Matrix field had any relational fields in it (Users, Entries, Assets, Categories, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a complicated problem (moving schema and data changes in Craft between environments) that &lt;a href=&quot;https://craftcms.com/news/craft-3-content-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content Migrations&lt;/a&gt; in the upcoming Craft 3 takes a baby step towards solving and one we hope to address long-term in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some further reading: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10/whats-the-best-practice-for-handling-data-migration-and-organization-across-dev/15#15&quot;&gt;What&amp;#39;s the best practice for handling data migration and organization across development environments?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-23T00:18:25.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23587" PostTypeId="1" AcceptedAnswerId="23589" CreationDate="2018-01-23T08:48:49.177" Score="8" ViewCount="4920" Body="&lt;p&gt;I'm using Craft 3 RC and I am logged as an admin. How can I display the Yii debug toolbar on front-end and Control Panel requests? By default, I don't see this toolbar.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2019-11-06T22:19:08.940" Title="Craft 3: how to show the Yii Debug Toolbar?" Tags="&lt;craft3&gt;&lt;debugging&gt;&lt;yii&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23588" PostTypeId="1" AcceptedAnswerId="23592" CreationDate="2018-01-23T09:11:53.630" Score="2" ViewCount="3868" Body="&lt;p&gt;I use the &lt;code&gt;@web&lt;/code&gt; alias in the configuration of the base URLs of the sites (following &lt;a href=&quot;https://docs.craftcms.com/v3/config/#aliases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 documentation&lt;/a&gt;). The &lt;code&gt;@web&lt;/code&gt; alias allows a shortcut  to the URL of the folder that contains the &lt;code&gt;index.php&lt;/code&gt; file loaded for the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I loop through &lt;code&gt;craft.app.sites.getAllSites&lt;/code&gt; using Twig, the value of baseUrl still prints &lt;code&gt;@web&lt;/code&gt; in the URL, instead of transform it in its original URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, I could get the original URL using &lt;code&gt;{{ craft.app.sites.currentSite.baseUrl ~ site.uri | replace({ '@web': '' }) }}&lt;/code&gt;. But this seems a very dirty solution that will probably not always work.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2020-01-28T09:28:34.510" LastActivityDate="2020-01-28T09:28:34.510" Title="Craft 3: with Base URL of site set up using @web alias, how to display the original URL in Twig templates?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23589" PostTypeId="2" ParentId="23587" CreationDate="2018-01-23T09:17:14.627" Score="9" Body="&lt;p&gt;There are two checkboxes in your user settings, go to your admin account -&gt; preferences &lt;code&gt;index.php?p=admin/myaccount&lt;/code&gt; and check the boxes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is covered in detail in the &lt;a href=&quot;https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Profiling your Website with Craft CMS 3’s Debug Toolbar&lt;/a&gt; article&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="819" LastEditDate="2018-07-17T21:26:34.487" LastActivityDate="2018-07-17T21:26:34.487" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="23590" PostTypeId="1" AcceptedAnswerId="23591" CreationDate="2018-01-23T12:16:35.250" Score="1" ViewCount="1307" Body="&lt;p&gt;I am new to Craft 3 and never set up a local environment with composer, bitbucket and gulp. So I dived into all these things to get my hands on Craft 3. At the moment I am using a shared hosting without a ssh access so I have to deploy my site by using FTP Upload. Is it correct that I just need to upload the entire Craft folder with all its subcategories (/vendors, /config, /modules etc. etc.) after development to the production server and then just to adapt the .env file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a little bit curious about this, since it is recommended not to upload some of the sensitive folders with access to a repo. I know that this due to the fact that nobody should see your logins public. This does not apply for the production server? If I point my subdomain to the /web folder with its index.php on the production server everything should be fine? Just want to be sure.&lt;/p&gt;&#xA;" OwnerUserId="7900" LastEditorUserId="57" LastEditDate="2018-01-23T19:13:10.690" LastActivityDate="2018-01-23T19:13:10.690" Title="Development – deployment environment" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23591" PostTypeId="2" ParentId="23590" CreationDate="2018-01-23T12:57:04.247" Score="5" Body="&lt;p&gt;So the way I'd recommend doing it is that you use &lt;code&gt;.gitignore&lt;/code&gt; to exclude your &lt;code&gt;/vendor&lt;/code&gt; directory from the repo; a good starter &lt;code&gt;.gitignore&lt;/code&gt; file can be found here: &lt;a href=&quot;https://github.com/nystudio107/craft-scripts/blob/master/example.gitignore&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts/blob/master/example.gitignore&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'll work on it in local dev, update Craft/plugins in local dev, and on deploy to production have it do &lt;code&gt;composer install&lt;/code&gt; to update your &lt;code&gt;/vendor&lt;/code&gt; dir to match what is is your &lt;code&gt;composer.lock&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; covers this in the &lt;strong&gt;DEPLOYING CRAFT CMS&lt;/strong&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also might want to get a workflow set up for syncing the database and assets as per the &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt; article.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-23T12:57:04.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23592" PostTypeId="2" ParentId="23588" CreationDate="2018-01-23T13:00:03.757" Score="4" Body="&lt;p&gt;So luckily for us, Brandon recently added the &lt;code&gt;alias()&lt;/code&gt; Twig function. It should show up in Craft CMS 3 RC7. You can see the discussion about it here: &lt;a href=&quot;https://github.com/craftcms/cms/issues/2327&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2327&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-23T13:00:03.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23593" PostTypeId="2" ParentId="23579" CreationDate="2018-01-23T13:10:15.397" Score="2" Body="&lt;p&gt;You might want to develop a workflow where you have one database (usually &lt;code&gt;live&lt;/code&gt; production or &lt;code&gt;staging&lt;/code&gt;) where all changes are made, and then sync down the database/assets from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding this concept of which server is the &quot;source of truth&quot; will greatly simplify keeping things in sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt; are a collection of shell scripts that help you do just that. All of this is discussed in detail in the article &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-23T13:10:15.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23594" PostTypeId="2" ParentId="23575" CreationDate="2018-01-23T13:19:17.677" Score="3" Body="&lt;p&gt;Despite having used regex's for years, I still almost never get them right from memory. A great tool for testing them out is: &lt;a href=&quot;https://regexr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://regexr.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you'll need to use is a capture group. Something like this for the source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/category/(.*$)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then the resulting URI would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/news/category/$1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each set of &lt;code&gt;()&lt;/code&gt; is a capture group; they are numbered sequentially, so &lt;code&gt;$1&lt;/code&gt; will output the first capture group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go to &lt;a href=&quot;https://regexr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://regexr.com/&lt;/a&gt; it will even explain every part of the regex, and what it does:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aaKBV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aaKBV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-01-23T13:19:17.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23595" PostTypeId="1" CreationDate="2018-01-23T13:41:43.260" Score="1" ViewCount="221" Body="&lt;p&gt;Is it possible to create a plugin that overrides a control panel template, and still be able to update Craft normally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to achieve:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a custom field with information on every asset in the assets panel. I want to see this custom field when I upload / select an asset in an entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template I want to customize:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/16Wnj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/16Wnj.jpg&quot; alt=&quot;template&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7901" LastEditorUserId="45" LastEditDate="2018-01-23T18:04:25.540" LastActivityDate="2018-01-23T18:15:44.303" Title="Overriding native CP template (without hacking the core)" Tags="&lt;assets&gt;&lt;plugins&gt;&lt;control-panel&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23597" PostTypeId="1" AcceptedAnswerId="23599" CreationDate="2018-01-23T17:14:56.427" Score="1" ViewCount="234" Body="&lt;p&gt;I have a PDF folder within assets and having trouble accessing the file path once chosen by the user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get something like an image from assets within a matrix I do something like this which works: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'image' =&amp;gt; $block-&amp;gt;image[0]-&amp;gt;url,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried similar code however it seems url is not available? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'downloadablePDF' =&amp;gt; $block-&amp;gt;downloadablePdf[0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to return the URL so that I can pass the URL to a React Component to make the pdf downloadable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my full code to fetch data from a matrix block: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function articles($array) {&#xA;    $articles = [];&#xA;    foreach ($array as $block) {&#xA;        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;            case 'article':&#xA;                $articles[] = [&#xA;                    'heading' =&amp;gt; (string) $block-&amp;gt;heading,&#xA;                    'subheading' =&amp;gt; $block-&amp;gt;subheading,&#xA;                    'text' =&amp;gt; (string) $block-&amp;gt;text,&#xA;                    'backgroundImage' =&amp;gt; (isset($block-&amp;gt;backgroundImage)) ? $block-&amp;gt;backgroundImage[0]-&amp;gt;url : '',&#xA;                    'downloadablePDF' =&amp;gt; $block-&amp;gt;downloadablePdf[0],&#xA;                    'videoUrl' =&amp;gt; (isset($block-&amp;gt;videoUrl)) ? $block-&amp;gt;videoUrl : '',&#xA;                    'linkUrl' =&amp;gt; (isset($block-&amp;gt;linkUrl)) ? $block-&amp;gt;linkUrl : '',&#xA;                    'size' =&amp;gt; (isset($block-&amp;gt;size)) ? $block-&amp;gt;size-&amp;gt;value : '',&#xA;                    'style' =&amp;gt; (isset($block-&amp;gt;style)) ? $block-&amp;gt;style-&amp;gt;value : '',&#xA;                    'verticalTextAlignment' =&amp;gt; (isset($block-&amp;gt;verticalTextAlignment)) ? $block-&amp;gt;verticalTextAlignment-&amp;gt;value : '',&#xA;                ];&#xA;            break;&#xA;        }&#xA;    }&#xA;    return $articles;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7337" LastEditorUserId="7337" LastEditDate="2018-01-23T17:37:31.607" LastActivityDate="2018-01-23T18:05:54.613" Title="Get PDF file from Assets Folder - Element API" Tags="&lt;assets&gt;&lt;plugin-elementapi&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23598" PostTypeId="1" CreationDate="2018-01-23T17:22:24.090" Score="1" ViewCount="53" Body="&lt;p&gt;I'm migrating some posts from Wordpress, and the posts on Wordpress have the images within a rich text field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to reference the image separately to the rest of the rich text field - below the image there is usually one or two lines of text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. Reference the image in my Twig separately to the rest of the rich text field, or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. Somehow split the rich text field so that the image url becomes an asset within Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Feed Me to import the data into Craft and WP All Export to export the data out of Wordpress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7425" LastActivityDate="2018-05-04T14:01:31.230" Title="How can I reference images separately within a rich text field?" Tags="&lt;templating&gt;&lt;assets&gt;&lt;richtext&gt;&lt;migration&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23599" PostTypeId="2" ParentId="23597" CreationDate="2018-01-23T18:05:54.613" Score="3" Body="&lt;p&gt;You have to check if your matrix element has a block or not with the code &lt;code&gt;$block-&amp;gt;downloadablePdf[0]-&amp;gt;url&lt;/code&gt; you'll access the first element in your matrix but when there is no it will throw an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'downloadablePDF' =&amp;gt; $block-&amp;gt;downloadablePdf[0]? $block-&amp;gt;downloadablePdf[0]-&amp;gt;getUlr() : ''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will check if there is an asset and return the url or an empty string if there is no asset&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-23T18:05:54.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23600" PostTypeId="2" ParentId="23595" CreationDate="2018-01-23T18:15:44.303" Score="1" Body="&lt;p&gt;Unless I'm mistaken, it looks like you don't actually need to override that whole template. It sounds like you really just want to &lt;strong&gt;add a column (or multiple columns) to the assets index view&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The modal that you're showing is using the same logic as the main assets index view. So it's simply a matter of adding your own custom columns to that, and then selecting those columns to be included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#defineAdditionalAssetTableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;defineAdditionalAssetTableAttributes&lt;/a&gt; hook allows you to create new columns for your assets index. You'll still need to select those columns via the UI in the control panel (which is super easy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably also need to use the &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#getAssetTableAttributeHtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;getAssetTableAttributeHtml&lt;/a&gt; hook, which allows you to customize how your column's data is displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using both of these hooks together will allow you to add whatever additional columns you'd like to the asset index view. And once you've selected your new custom columns, the exact same columns will appear in the modal view (like in your screenshot).&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-23T18:15:44.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23601" PostTypeId="1" CreationDate="2018-01-23T19:49:01.933" Score="1" ViewCount="539" Body="&lt;p&gt;I'm trying to display results from a search. I want to display the categories represented by the search results and the entry count for that category. Think of how Amazon's &quot;refine results&quot; sidebar works, something like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Results listing&lt;/strong&gt;&#xA;  ...&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;&#xA;  &lt;br&gt;Planning and Funding (9)&lt;br&gt;&#xA;  Design (19)&lt;br&gt;&#xA;  etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can easily get the count of &lt;em&gt;ALL ENTRIES&lt;/em&gt; in each category with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('resourceCategories') %}&#xA;  {% set entryCount = craft.entries.relatedTo(category).total() %}&#xA;  ... do something...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I want to get counts for ONLY the returned search results. I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resourceEntries = craft.entries(queryParams).section('and, not organizations, not presentersAndAuthors') %}&#xA;{% for category in craft.categories.group('resourceCategories') %}&#xA; {% set entryCount = resourceEntries.relatedTo(category).total() %}&#xA;  ... do something...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get the count for ALL entries (the same results as the top example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea as to what am I missing or not understanding?&lt;/p&gt;&#xA;" OwnerUserId="7491" LastEditorUserId="7491" LastEditDate="2018-01-23T20:47:10.330" LastActivityDate="2018-01-23T20:47:10.330" Title="Category counts for query results" Tags="&lt;categories&gt;&lt;search&gt;&lt;relatedto&gt;&lt;query&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23602" PostTypeId="2" ParentId="23526" CreationDate="2018-01-23T20:24:41.223" Score="2" Body="&lt;p&gt;In case anyone makes the same silly mistake I did, I had a conditional on the sign-in page that redirected folks to the page they were on before signing in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a password reset, it was trying to redirect back to the Set Password screen with the reset token, resulting in the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just adjusted the conditional so it ignored the referrer URL if it was a control panel action. Problem solved.&lt;/p&gt;&#xA;" OwnerUserId="352" LastActivityDate="2018-01-23T20:24:41.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23603" PostTypeId="1" AcceptedAnswerId="23609" CreationDate="2018-01-23T20:39:40.797" Score="2" ViewCount="980" Body="&lt;p&gt;How do I allow logged in users to change their user photo on the front end in Craft 3? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am creating an &quot;Edit Profile&quot; page and I followed the answer to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1011/allow-user-to-change-or-delete-their-photo-for-their-profile-from-the-front-end&quot;&gt;this question&lt;/a&gt; for Craft 2 to create a form updating to Craft 3 syntax where necessary (code below). When I submit the form, the text/textarea fields get updated, but the image does not. Can anyone point me in the direction as to how to get this working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;        {{ redirectInput('users') }}&#xA;&#xA;        {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;        {% endmacro %}&#xA;&#xA;        {% from _self import errorList %}&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;        {% if currentUser.getPhoto != '' %}&#xA;            &amp;lt;img src=&quot;{{ currentUser.getPhoto.getUrl }}&quot; alt=&quot;&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;        {% endif %}&#xA;        &amp;lt;input type=&quot;file&quot; id=&quot;userPhoto&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot;&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;firstName&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;lastName&quot; name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;bio&quot;&amp;gt;Bio&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea id=&quot;bio&quot; name=&quot;fields[bio]&quot;&amp;gt;{{ currentUser.bio }}&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&amp;lt;br&amp;gt;&#xA;&#xA;        {% if account is defined %}&#xA;            {{ errorList(account.getErrors('password')) }}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7902" LastActivityDate="2018-01-24T05:24:02.797" Title="Craft 3: Upload user photo from front end" Tags="&lt;users&gt;&lt;craft3&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23604" PostTypeId="1" CreationDate="2018-01-23T22:08:25.377" Score="1" ViewCount="226" Body="&lt;p&gt;I'm trying to use different entry types for certain categories. My category group is called &lt;code&gt;categories&lt;/code&gt;, and the slug for Features is &lt;code&gt;features&lt;/code&gt;. I have the category group pointed to &lt;code&gt;categories/_entry&lt;/code&gt;. As for as I can tell, I've got it set up right. I think their might just be something wrong with my switch code. This is my code in &lt;code&gt;categories/_entry&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = entry.categories.first %}&#xA;{% switch categories.slug %}&#xA;    {% case 'features' %}&#xA;        {% include 'categories/_feature.html' %}    &#xA;    {% case 'news' %}&#xA;        {% include 'categories/_news.html' %}&#xA;    {% default %}&#xA;        {% include 'categories/_news.html' %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7411" LastActivityDate="2020-05-16T01:26:11.220" Title="Switch entry type based on the category" Tags="&lt;categories&gt;&lt;category&gt;&lt;switch&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23605" PostTypeId="2" ParentId="23604" CreationDate="2018-01-24T00:38:19.763" Score="1" Body="&lt;p&gt;The above isn't too clear, but what I was trying to do is use different templates for  different category landing pages. It works with the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch category.slug %}&#xA;    {% case 'features' %}&#xA;        {% include 'categories/_features.html' %}   &#xA;    {% case 'news' %}&#xA;        {% include 'categories/_news.html' %}&#xA;    {% default %}&#xA;        {% include 'categories/_news.html' %}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7411" LastActivityDate="2018-01-24T00:38:19.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23606" PostTypeId="2" ParentId="23582" CreationDate="2018-01-24T01:18:26.233" Score="1" Body="&lt;p&gt;The rounding you are talking about is for cash. The rounding is to nearest 5c because it is likely the smallest denomination in circulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Online, with electronic transactions, the base will always be whole cents (or localised equivalent.) Credit Card and electronic purchases can always transaction in these minor units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce doesn't have the ability to round to cash-based values (likely to be used in POS), but you are welcome to make a feature request here: &lt;a href=&quot;http://feedback.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://feedback.craftcms.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-01-24T01:18:26.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23607" PostTypeId="1" AcceptedAnswerId="23608" CreationDate="2018-01-24T01:31:27.443" Score="1" ViewCount="180" Body="&lt;p&gt;I have a channel with an entry type which has a simple dropdown for &lt;code&gt;{region}&lt;/code&gt; and an entries fieldtype which links to a channel of destinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the URL format for the channel to be &lt;code&gt;/region/destination/slug&lt;/code&gt;. If I do &lt;code&gt;/{region}/{destination.url}/{slug}&lt;/code&gt; the output is &lt;code&gt;/region-name//entry-slug&lt;/code&gt;, i.e. nothing is output for the destination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I have where I currently have &lt;code&gt;{destination.url}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2018-01-24T02:51:58.880" Title="Setting channel url format to include value of entries fieldtype URL" Tags="&lt;url&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23608" PostTypeId="2" ParentId="23607" CreationDate="2018-01-24T02:51:58.880" Score="4" Body="&lt;p&gt;It needs to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{destination.first().slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if this is for Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{destination.one().slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-01-24T02:51:58.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23609" PostTypeId="2" ParentId="23603" CreationDate="2018-01-24T05:24:02.797" Score="1" Body="&lt;p&gt;The field name used for the user photo has changed to &lt;code&gt;photo&lt;/code&gt;, so the bare minimum change to make this work is modifying&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;input type=&quot;file&quot; id=&quot;userPhoto&quot; name=&quot;userPhoto&quot; value=&quot;Upload&quot;&amp;gt;&lt;/code&gt;&lt;br&gt;&#xA;to be&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;input type=&quot;file&quot; id=&quot;userPhoto&quot; name=&quot;photo&quot; value=&quot;Upload&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably want to use transforms, when outputting that image, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I'd stick with &lt;code&gt;currentUser.photo&lt;/code&gt; or &lt;code&gt;currentUser.getPhoto()&lt;/code&gt;, instead of using a hybrid &lt;code&gt;currentPhoto.getPhoto&lt;/code&gt;, but that might just be me.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-01-24T05:24:02.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23610" PostTypeId="1" AcceptedAnswerId="23622" CreationDate="2018-01-24T08:29:58.593" Score="11" ViewCount="3827" Body="&lt;p&gt;In Craft 2.x you have the option of setting the top-level entries URL format for a structure section separately from nested entries i.e. &lt;code&gt;top-level/{slug}&lt;/code&gt; and &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in Craft 3 the same URL format is applied for all entries within the structure section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means if you use &lt;code&gt;top-level/{parent.uri}/{slug}&lt;/code&gt; it works fine for a top-level entry but then nested entries have the first segment duplicated, e.g. top-level/top-level/some-parent/the-slug. How does one achieve the same level of URL formatting for structure entries in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="2197" LastEditorUserId="57" LastEditDate="2018-01-24T22:36:29.397" LastActivityDate="2018-01-24T22:37:05.927" Title="{parent.uri}/{slug}" Tags="&lt;control-panel&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23611" PostTypeId="1" AcceptedAnswerId="23612" CreationDate="2018-01-24T09:01:43.797" Score="2" ViewCount="125" Body="&lt;p&gt;I have a Craft CMS installation in which there will be other data imported into the db (via Cronjob). It's data from a Weatherstation which will be displayed without further editing in the Control Panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to display this data via Twig bypassing the Control Panel all-together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in special.db.section('xyz') %}&#xA;  {{ entry.value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My first thought would be to do this via the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API Plugin&lt;/a&gt; and then use JavaScript to display this data. But maybe that's not necessary?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2018-01-24T22:38:10.430" LastActivityDate="2018-01-24T22:38:10.430" Title="Display non Craft CMS data with Twig" Tags="&lt;templating&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23612" PostTypeId="2" ParentId="23611" CreationDate="2018-01-24T09:40:00.320" Score="3" Body="&lt;p&gt;You can create a custom plugin to fetch the data. &lt;a href=&quot;http://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; is a good place to create your basic files/folders. Then you'll insert this function in your &lt;code&gt;PluginVariable&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getData($table){&#xA;    return craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('*')&#xA;        -&amp;gt;from($table)&#xA;        -&amp;gt;where('some Conditions)&#xA;        -&amp;gt;queryAll();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in your template &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.pluginName.getData('xyz') %}&#xA;    {{ entry.someField }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: this only works when the table prefix is the same as your craft tables. So before your &lt;code&gt;from($table)&lt;/code&gt; Craft will automatically include a &lt;code&gt;$tablePrefix&lt;/code&gt; (usually craft_) you can either name your custom tables &lt;code&gt;craft_&lt;/code&gt; as well or change the prefix before your query &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$oldPrefix = craft()-&amp;gt;db-&amp;gt;tablePrefix;&#xA;craft()-&amp;gt;db-&amp;gt;tablePrefix = '';&#xA;// handle your queries&#xA;craft()-&amp;gt;db-&amp;gt;tablePrefix = $oldPrefix;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-24T09:40:00.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23613" PostTypeId="1" AcceptedAnswerId="23614" CreationDate="2018-01-24T11:26:42.480" Score="1" ViewCount="27" Body="&lt;p&gt;I would like to know how I can output Craft Commerces Stripes Publishable Key, which I define under Payment Methods, in a template? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value I set is settings[publishableKey].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;br&gt;&#xA;Stefan &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2018-01-24T11:50:36.937" Title="How I can output Craft Commerces Stripes Publishable Key in a template" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23614" PostTypeId="2" ParentId="23613" CreationDate="2018-01-24T11:50:36.937" Score="1" Body="&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart.paymentMethod.class == 'Stripe' %}&#xA;    {{ cart.paymentMethod.settings.publishableKey }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="480" LastActivityDate="2018-01-24T11:50:36.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23615" PostTypeId="1" CreationDate="2018-01-24T14:26:04.650" Score="1" ViewCount="202" Body="&lt;p&gt;I have two Craft CMS 3 websites using Vagrant/Homestead &amp;amp; VirtualBox as the local server. Both were on RC1, and when trying to update to RC7 I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\base\ErrorException: unlink(/home/vagrant/sites/craft-site/storage/runtime/compiled_templates/1d/1d7666988f766c26d98233e048a41c263069493e993709f9ed7989e8bdfcce48.php): Permission denied in /home/vagrant/sites/craft-site/vendor/yiisoft/yii2/helpers/BaseFileHelper.php:347&#xA;Stack trace:&#xA;#0 /home/vagrant/sites/craft-site/vendor/yiisoft/yii2/helpers/BaseFileHelper.php(347): ::unlink()&#xA;#1 /home/vagrant/sites/craft-site/vendor/craftcms/cms/src/helpers/FileHelper.php(101): yii\helpers\BaseFileHelper::removeDirectory()&#xA;#2 /home/vagrant/sites/craft-site/vendor/craftcms/cms/src/helpers/FileHelper.php(409): craft\helpers\FileHelper::removeDirectory()&#xA;#3 /home/vagrant/sites/craft-site/vendor/craftcms/cms/src/web/Application.php(544): craft\helpers\FileHelper::clearDirectory()&#xA;#4 /home/vagrant/sites/craft-site/vendor/craftcms/cms/src/web/Application.php(165): craft\web\Application-&amp;gt;_processUpdateLogic()&#xA;#5 /home/vagrant/sites/craft-site/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest()&#xA;#6 /home/vagrant/sites/craft-site/web/index.php(21): craft\web\Application-&amp;gt;run()&#xA;#7 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same error happens whether I update through the admin or through composer. It happened to both of my sites as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still learning development with Craft and PHP, but is this error telling me that I don't have permission rights to remove these files or is it something else?&lt;/p&gt;&#xA;" OwnerUserId="7323" LastEditorUserId="5275" LastEditDate="2018-01-24T15:19:02.250" LastActivityDate="2018-01-24T15:19:02.250" Title="Updating Craft 3 from RC1 to RC7 throws ErrorException" Tags="&lt;error-message&gt;&lt;craft3&gt;&lt;updates&gt;&lt;composer&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23616" PostTypeId="1" CreationDate="2018-01-24T16:18:53.590" Score="1" ViewCount="41" Body="&lt;p&gt;Does Sprout SEO work with Neo fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to create multiple fallbacks within a custom formatted element metadata field in Sprout, so I could just use one Sprout SEO field with element metadata for multiple significantly different sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.comparisonPageBodyText %}{{ object.comparisonPageBodyText | striptags }}{% else %}{{ object.body | striptags }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried this, and it doesn't appear to work with Neo fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, my ultimate thing would be something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If comparisonPageBodyText exists, use the first 160 characters&lt;/li&gt;&#xA;&lt;li&gt;else use the first 160 characters of the first body matrix block&lt;/li&gt;&#xA;&lt;li&gt;else use the section default&lt;/li&gt;&#xA;&lt;li&gt;else use the site default&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It would be amazing if we could structure the logic inside the gui instead of writing twig, but ultimately this would be fine if I could get it to work.&lt;/p&gt;&#xA;" OwnerUserId="5891" LastActivityDate="2018-01-24T16:18:53.590" Title="Custom format for Sprout SEO 3 Element Metadata" Tags="&lt;plugin-sproutseo&gt;&lt;plugin-neo&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23617" PostTypeId="1" CreationDate="2018-01-24T16:24:06.190" Score="1" ViewCount="52" Body="&lt;p&gt;Something strange going on with the user listings in the CP. Using craft v2.6.2794 and social logins v 1.2.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the social logins plugin for craft 2 and just updated it to the latest version. It creates a social login and a user and from the social login listing I can browse to the user profile. However when I try to view the user in the listing page it does not show up even after searching or listing as last created but it is there.&#xA;Any ideas. There are over 21k users in the db.&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="3404" LastEditDate="2018-01-24T16:31:47.210" LastActivityDate="2018-01-24T16:31:47.210" Title="User not showing in the user list in the CP but has profile after social login?" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;plugin-social-login&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23618" PostTypeId="1" AcceptedAnswerId="23619" CreationDate="2018-01-24T16:35:51.160" Score="1" ViewCount="149" Body="&lt;p&gt;I'm new to Craft and I'm trying to figure out how to place a form within an entry using a Solspace Freeform field.  Specifically I need to pass the form handle into the render tag to place that form on a particular page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;formHandlefromfreeformfield&quot;).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="57" LastEditDate="2018-01-24T22:44:46.407" LastActivityDate="2018-01-24T22:44:46.407" Title="Pass field handle from to render tag using Freeform field" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23619" PostTypeId="2" ParentId="23618" CreationDate="2018-01-24T17:26:22.293" Score="1" Body="&lt;p&gt;Is &lt;a href=&quot;https://solspace.com/craft/freeform/docs/fieldtypes/#templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; what you are looking for? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myFreeformfieldname.render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-24T17:26:22.293" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23621" PostTypeId="1" AcceptedAnswerId="23623" CreationDate="2018-01-24T18:14:43.743" Score="1" ViewCount="166" Body="&lt;p&gt;Regarding the Image Transforms and the handling of its files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a config setting that controls the location (file path) of the Image Transform Files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default there is automatically created a new folder which bases it name of the transform-behavior name from the CP (or the code) i.e. &lt;code&gt;_crop1920x1440&lt;/code&gt; in the same directory as the original image is located.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to store all the transformed images in one place i.e. &lt;code&gt;/assets/transforms&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5186" LastEditorUserId="57" LastEditDate="2018-01-24T22:45:47.057" LastActivityDate="2018-01-24T22:52:58.863" Title="Image Transform Files Path" Tags="&lt;image-transforms&gt;&lt;configuration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23622" PostTypeId="2" ParentId="23610" CreationDate="2018-01-24T22:37:05.927" Score="19" Body="&lt;p&gt;To pull off the same functionality in Craft 3, you could use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{entry.last().uri}/{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-24T22:37:05.927" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23623" PostTypeId="2" ParentId="23621" CreationDate="2018-01-24T22:52:58.863" Score="1" Body="&lt;p&gt;Not currently, but feel free to make a feature request!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-24T22:52:58.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23624" PostTypeId="1" CreationDate="2018-01-25T04:45:43.583" Score="1" ViewCount="78" Body="&lt;p&gt;I am using Redactor 1.0.1 plugin in Craft 3, When copy/paste from any website into WYSISWG boxes, hidden HTML is included. How do I remove that?&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="57" LastEditDate="2018-01-25T15:12:38.567" LastActivityDate="2018-01-25T15:12:38.567" Title="How to remove hidden HTML from Radactor editor in CrafCMS 3" Tags="&lt;redactor&gt;&lt;editor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23625" PostTypeId="1" CreationDate="2018-01-25T04:52:52.887" Score="0" ViewCount="1485" Body="&lt;p&gt;I am running the latest version of Homestead, and have installed Mcrypt, but I am getting an error that it is not installed while trying to update a site.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php7.0-mcrypt is already the newest version (7.0.27-1+ubuntu16.04.1+deb.sury.org+1).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the php version I am running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP 7.2.0-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Nov 30 2017 13:58:33) ( NTS )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have rebooted the VM and still get the same result. Is there something else I am missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-01-25T04:52:52.887" Title="Why doesn't Craft think the Mcrypt extension is installed?" Tags="&lt;mcrypt&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23626" PostTypeId="2" ParentId="23624" CreationDate="2018-01-25T06:56:51.030" Score="1" Body="&lt;p&gt;If it's only for you, you can activate/use the &lt;a href=&quot;https://imperavi.com/redactor/examples/source/&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt; plugin to switch the view. That way no html is generated when you paste something &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/paste/#setting-pastePlainText&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; option can help you too. There is also a &lt;a href=&quot;https://imperavi.com/redactor/docs/callbacks/paste/#callback-paste&quot; rel=&quot;nofollow noreferrer&quot;&gt;paste&lt;/a&gt; callback you can use to change the inserted html &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-25T06:56:51.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23627" PostTypeId="2" ParentId="23277" CreationDate="2018-01-25T10:45:59.727" Score="1" Body="&lt;p&gt;Here is the workaround I've resorted to using in the meantime.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Initiate the hash in which we'll store matching submissions. #}&#xA;{% set matchingSubmissions = [] %}&#xA;&#xA;{#&#xA;    Loop through all submissions, checking if the specified field&#xA;    matches the desired value.&#xA;#}&#xA;{% for submission in submissions if submission.fieldWithValue == '123' %}&#xA;&#xA;    {# If the field matches, add it to the hash #}&#xA;    {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Count the size of the resulting hash and save it. #}&#xA;{% set submissionCount = matchingSubmissions|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-01-25T10:45:59.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23628" PostTypeId="1" AcceptedAnswerId="23635" CreationDate="2018-01-25T12:33:19.060" Score="1" ViewCount="1185" Body="&lt;p&gt;I have a main domain, &lt;code&gt;www.mycompany.com&lt;/code&gt;, which has several groups of sites, which are available in several languages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.mycompany.com/international&#xA;&#xA;www.mycompany.com/sales/en&#xA;www.mycompany.com/sales/fr&#xA;&#xA;www.mycompany.com/customers/en&#xA;www.mycompany.com/customers/fr&#xA;&#xA;etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once visitor access to &lt;code&gt;www.mycompany.com&lt;/code&gt;, he will be auto-redirected to a Site version depending on his IP (probably using a third-party plugin like &lt;a href=&quot;https://superbig.co/plugins/country-redirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Country Redirect&lt;/a&gt;, once &lt;a href=&quot;https://craftcms.stackexchange.com/a/23438/131&quot;&gt;available for Craft 3&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that when I set up the Sites, Craft force to set a primary Site. So I choose the &lt;code&gt;www.mycompany.com/international&lt;/code&gt; version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when Site is saved, the Base URL is displayed as &lt;code&gt;www.mycompany.com&lt;/code&gt; instead of &lt;code&gt;www.mycompany.com/international&lt;/code&gt;, and all URLs in this one are now like &lt;code&gt;www.mycompany.com/my-slug&lt;/code&gt; instead of &lt;code&gt;www.mycompany.com/international/my-slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This probably can be solved by pre-checking all links, adding the slug inside the URL if current Site id is the &lt;code&gt;www.mycompany.com/international&lt;/code&gt; version, then adding a routing rule for all &lt;code&gt;/international/*&lt;/code&gt; requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it sounds a bit tricky in the some cases, so I wondered if there was a cleaner way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-01-25T16:07:59.340" Title="Craft 3 with Multi-Site: how to not set a primary site, or add a first segment to all primary site URLs?" Tags="&lt;localization&gt;&lt;url&gt;&lt;craft3&gt;&lt;routes&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23630" PostTypeId="1" AcceptedAnswerId="23631" CreationDate="2018-01-25T14:45:01.510" Score="1" ViewCount="1416" Body="&lt;p&gt;I am following the documentation for Craft 2 &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; to create an entry form on the front end of my website. The form appears correctly on the front end but when I submit it, I get the following error: &#xA;&quot;Page not found.&#xA;Caused by: Invalid Route – yii\base\InvalidRouteException&#xA;Unable to resolve the request: entries/saveEntry&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;news/{slug}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;title&quot;&amp;gt;Title&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;body&quot;&amp;gt;Body&amp;lt;/label&amp;gt;&#xA;    &amp;lt;textarea id=&quot;body&quot; name=&quot;fields[body]&quot; rows=&quot;20&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know where I am going wrong here? The user I am currently using to submit the form is an admin. I realize that the docs I'm following are for Craft 2 but I could not find this form in the Craft 3 docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated and thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7902" LastActivityDate="2018-01-25T14:55:07.340" Title="Craft 3: Front End Entry Form" Tags="&lt;craft3&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23631" PostTypeId="2" ParentId="23630" CreationDate="2018-01-25T14:55:07.340" Score="5" Body="&lt;p&gt;Craft 3 uses snake-case paths instead of camelCase paths&#xA;Your action parameter must be &lt;code&gt;entries/save-entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its all stated in the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/changes-in-craft-3.md#request-params&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: generally a good idea is to inspect the html in your cp form and copy it to your frontend. You'll be able to solve 90% of your issues that way &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-25T14:55:07.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23633" PostTypeId="1" AcceptedAnswerId="23634" CreationDate="2018-01-25T15:25:21.157" Score="2" ViewCount="51" Body="&lt;p&gt;We are building a React application for a client, where we are using Craft as the API/Backend. I am building the API as a custom Craft plugin, which will return specific JSON data to React, dependent upon the action route it requests. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was a way that anyone has managed to prevent the default Entry properties from being included in the response, as it just adds a lot of unnecessary clutter. I have included a visual example at the bottom of this question to further clarify what I mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did try to research if this was answered already, and found this link &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12513/ignore-fields-in-search-index/13495#13495&quot;&gt;Ignore fields in search index&lt;/a&gt;&#xA;I did see it was back in 2016, so was hoping something has changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = &quot;journeys&quot;;&#xA;$journeys = $criteria-&amp;gt;find();&#xA;&#xA;$responseObj = new \stdClass;&#xA;$responseObj-&amp;gt;journeyOne = $journeys[0];&#xA;$this-&amp;gt;returnJson($responseObj);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WSpRr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WSpRr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I literally won't be using any of these, as I only require the data from my custom fields(which haven't been created yet).&lt;/p&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="125" LastEditDate="2018-01-25T16:14:51.367" LastActivityDate="2018-01-25T16:14:51.367" Title="Excluding properties from returned ElementModel in plugin" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23634" PostTypeId="2" ParentId="23633" CreationDate="2018-01-25T15:50:13.027" Score="4" Body="&lt;p&gt;Unfortunately this is one of Crafts disadvantages, you'll always fetch all fields in your &lt;code&gt;craft_content&lt;/code&gt; table no matter if you need those or not, thus it's always a bit slow and query heavy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 introduces a way to solve that issue since it loops the field layout and only fetches the values you need and not all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway: you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get an array of all fields in craft_content (note: that only works for fields&#xA;// with a record in `craft_content` so you won't fetch relations with that&#xA;$attributes = $journeys[0]-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;$this-&amp;gt;returnJson([&#xA;    'title'                 =&amp;gt; $journeys[0]-&amp;gt;getTitle(),&#xA;    'myCustomField'         =&amp;gt; $attributes['myCustomField'],&#xA;    'myAwesomeField'        =&amp;gt; $attributes['myAwesomeField'],&#xA;    'anotherField'          =&amp;gt; $attributes['anotherField'],&#xA;    'idsOfARelationField'   =&amp;gt; $journeys[0]-&amp;gt;relationFieldHandle-&amp;gt;ids()&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way you can define which values you need and return them in an array. If you don't need all the other values just leave them empty. If you only want to fetch all custom fields you can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;returnJson($attributes);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure if you'll receive the title that way, you need to try. Othewise - if you need the title and if it's not included&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$attributes['title'] = $journes[0]-&amp;gt;getTitle();&#xA;$this-&amp;gt;returnJson($attributes);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;solves that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: by the way if you only need the first element you can do &lt;code&gt;$criteria-&amp;gt;first()&lt;/code&gt; instead of &lt;code&gt;$criteria-&amp;gt;find();&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-25T16:05:02.733" LastActivityDate="2018-01-25T16:05:02.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23635" PostTypeId="2" ParentId="23628" CreationDate="2018-01-25T16:07:59.340" Score="1" Body="&lt;p&gt;It looks like you forgot to setup &lt;code&gt;siteUrl&lt;/code&gt; in config/general.php for your sites.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteUrl' =&amp;gt; [&#xA;    'landing' =&amp;gt; 'https://www.mycompany.com/international',&#xA;    'sales-en' =&amp;gt; 'https://www.mycompany.com/sales/en',&#xA;    'sales-fr' =&amp;gt; 'https://www.mycompany.com/sales/fr',&#xA;    ...&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-01-25T16:07:59.340" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23636" PostTypeId="1" CreationDate="2018-01-25T17:19:10.740" Score="1" ViewCount="389" Body="&lt;p&gt;I'm pretty new to Craft and PHP, and I am needing to design a page in Craft (powered by a plugin) which will pass a variable in a querystring (or equivalent in Craft) to the PHP code in the plugin.&lt;br&gt;&#xA;In my case, it would be a username (e.g. jsmith) to pass to the plugin PHP code, which would query an XML file for a node having 'jsmith' as the username value.&lt;br&gt;&#xA;My first question is - in Craft, can I use a querystring like:&#xA;?username=jsmith&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or would I need to use something more Craft-specific?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is - can Craft (Twig template) pass to the PHP plugin by including the PHP file (service)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help in this&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2018-05-25T23:35:37.277" Title="Passing Querystring Variable to PHP Code in Plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;&lt;craft3&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23637" PostTypeId="1" AcceptedAnswerId="23640" CreationDate="2018-01-25T18:02:38.153" Score="2" ViewCount="402" Body="&lt;p&gt;Let's say I created a section called, &quot;Answers&quot;. In a custom plugin, I want to create an entry that should show up under the &quot;Answers&quot; tab in the CP entries page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $entry = new EntryModel();&#xA;  // How do I say, save this entry into the &quot;Answers&quot; channel?&#xA;  $saveIt = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Urlio.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Urlio.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have literally been reading Craft docs for the past hour, and have gotten nowhere.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-01-26T20:48:07.507" Title="Creating a new entry in a specific section" Tags="&lt;plugin-development&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23638" PostTypeId="1" CreationDate="2018-01-25T19:31:28.283" Score="0" ViewCount="204" Body="&lt;p&gt;I just installed the Craft 3 RC on MAMP - the install process executed without error and I can see all of the Craft files in the directory I specified and the .env file was updated with database info. However, when I try to run setup it throws an error ( The requested URL /cr3.dev/admin was not found on this server. ). I then deleted the entire directory and ran the Composer install again, but same issue when I try to run the Craft install process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MAMP server is working fine - an existing Craft 2 install works perfectly and just to be sure I created a new test directory with a single index.html file and that worked as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize this is not much info, but hoping someone has some ideas to guide me along!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="45" LastEditDate="2018-01-25T23:58:46.910" LastActivityDate="2018-01-25T23:58:46.910" Title="Craft 3 RC install on MAMP Issue" Tags="&lt;mamp&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23639" PostTypeId="2" ParentId="23636" CreationDate="2018-01-25T21:43:14.987" Score="1" Body="&lt;p&gt;If you have a URL like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mysite.com?username=jsmith&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can retrieve it from your plugin via &lt;code&gt;craft()-&amp;gt;request-&amp;gt;getQuery('username');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here: &lt;a href=&quot;https://craftcms.com/classreference/services/HttpRequestService#getQuery-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/classreference/services/HttpRequestService#getQuery-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My second question is - can Craft (Twig template) pass to the PHP plugin by including the PHP file (service)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not actually following this question, but we generally try to keep to one question per post.  I'd suggest posting a new one for that with some additional details of exactly what you're trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would also suggest giving the official plugin documentation a read-though: &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-25T21:43:14.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23640" PostTypeId="2" ParentId="23637" CreationDate="2018-01-25T21:50:07.793" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryModel&lt;/a&gt; you have has a &lt;a href=&quot;https://craftcms.com/docs/templating/entrymodel#sectionId&quot; rel=&quot;nofollow noreferrer&quot;&gt;sectionId&lt;/a&gt; property you can set.  i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $entry = new EntryModel();&#xA; $entry-&amp;gt;sectionId = 1;&#xA; $saveIt = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that there are other properties you'll need to set for it to pass validation.  So, if &lt;code&gt;$saveIt&lt;/code&gt; is false after calling &lt;code&gt;saveEntry($entry)&lt;/code&gt;, then call &lt;code&gt;$entry-&amp;gt;getErrors()&lt;/code&gt; to get an array of validation errors to fix.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-01-26T20:48:07.507" LastActivityDate="2018-01-26T20:48:07.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23641" PostTypeId="1" AcceptedAnswerId="23745" CreationDate="2018-01-26T01:00:36.820" Score="1" ViewCount="164" Body="&lt;p&gt;Is there a way to conditionally display a table column heading if the table field row has been entered? i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if my table has up to 3 columns&#xA;and I fill in ALL the fields like this I'd see&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;ch1 | ch2 | ch3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;a   |  b  |  c&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but, if I only fill in 2 columns without conditionals I'd see this&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;ch1 | ch2 | ch3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;a   |  b  |  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to conditionally only show the column headings/rows populated like this:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;ch1 | ch2 |&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;a   |  b  |  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible?&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2018-02-04T08:54:19.267" Title="Conditionally show table column headings" Tags="&lt;conditional&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23642" PostTypeId="1" AcceptedAnswerId="23651" CreationDate="2018-01-26T03:39:08.710" Score="1" ViewCount="70" Body="&lt;p&gt;Hokay, this is a big one. Thanks in advance for anyone that has a look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m trying to get &lt;a href=&quot;https://codecanyon.net/item/premium-stock-market-widgets-js-php/19714578&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; widget working on a Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The install documentation is pretty simple, I've hosted it here: &lt;a href=&quot;http://brycekirk.com/documentation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://brycekirk.com/documentation/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also installed &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Business Logic&lt;/a&gt;. Within that plugin, I've created a folder called &lt;code&gt;vendor&lt;/code&gt; and and moved the &lt;code&gt;psmw&lt;/code&gt; folder into it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've then initialized it in &lt;code&gt;BusinessLogicPlugin.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;    require_once 'vendor/psmw/init.php';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and added into &lt;code&gt;/variables/BusinessLogicVariable.php&lt;/code&gt;, I've added the path to the shortcode functions, and a test one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function shortcode($optional = null)&#xA;{&#xA;    require_once(CRAFT_PLUGINS_PATH.'businesslogic/vendor/psmw/shortcode.php');&#xA;    shortcode(['type' =&amp;gt; 'spark', 'symbol' =&amp;gt; 'AAPL', 'template' =&amp;gt; 'line', 'color' =&amp;gt; 'blue']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then called it in my template with &lt;code&gt;{{ craft.businessLogic.shortcode }}&lt;/code&gt;. It's generating HTML and JS, but not displaying the ticker, and I'm getting a &lt;code&gt;jQuery is not defined&lt;/code&gt; error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there's something wrong with the logic behind how I'm loading in the plugin and its assets, I just can't figure out what it is. Any gesture in the right direction would be much appreciated! I can provide more info if needed.&lt;/p&gt;&#xA;" OwnerUserId="7411" LastEditorUserId="45" LastEditDate="2018-01-26T04:13:39.607" LastActivityDate="2018-01-26T22:27:37.300" Title="Widget initialized in Business Logic plugin not loading" Tags="&lt;plugins&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23643" PostTypeId="2" ParentId="23642" CreationDate="2018-01-26T04:15:42.363" Score="1" Body="&lt;p&gt;Sounds like you haven't loaded jQuery on that page. You'll need to make sure that jQuery is loaded &lt;em&gt;before&lt;/em&gt; your &lt;code&gt;{{ craft.businessLogic.shortcode }}&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-01-26T04:15:42.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23645" PostTypeId="1" CreationDate="2018-01-26T13:10:45.897" Score="1" ViewCount="140" Body="&lt;p&gt;I am trying to do the following with craft.entries but I think it may not be possible without a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 9 categories with related entries on all of them. I would like to get the latest articles (postDate) for each one the categories and then group by category and only show only the seven latest articles, one for each category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works but it fetches 100 articles each time (I can reduce it but still its not ideal)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestArticles = craft.entries.section('articles').relatedTo({element: selectedCategories, field: 'journalismMainCategory'}).order('postDate desc').find() %}&#xA;{% set groupedArticles = latestArticles|group('journalismMainCategory.first.id')|slice(0,7) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried the following but I cannot get it to sort by date or group the category properly. It retrieves the latest article for each category, but in the order of the category (and not by post date)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set selectedCategories = [98, 100, 2412, 2408, 2410, 2414, 2416, 55332, 55333] %}&#xA;&#xA;{% for category in selectedCategories %}&#xA;       {% set stilesArticles = stilesArticles|merge([craft.entries.section('articles').relatedTo({element: selectedCategories[loop.index0], field: 'journalismMainCategory'}).limit(1).first]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how something like this can be done without a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4941" LastActivityDate="2018-01-26T14:45:33.330" Title="Select query question" Tags="&lt;entries&gt;&lt;ordering&gt;&lt;sorting&gt;&lt;group&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23646" PostTypeId="2" ParentId="23645" CreationDate="2018-01-26T13:26:12.003" Score="1" Body="&lt;p&gt;Why don't you use the prepared &lt;code&gt;ElementCriteriaModel&lt;/code&gt; in the category and change the query?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('whatever') %}&#xA;    {% set articles = category.journalismMainCategory.limit(7).order('postDate').find() %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;category.journalismMainCategory&lt;/code&gt; contains an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; that will fetch all related entries you can include a limit, change the sort order and execute it, so you'll receive 7 articles with the correct order for each of your categories&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: link to the &lt;a href=&quot;https://craftcms.com/docs/entries-fields#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-26T14:45:33.330" LastActivityDate="2018-01-26T14:45:33.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23647" PostTypeId="1" AcceptedAnswerId="23650" CreationDate="2018-01-26T15:48:23.583" Score="1" ViewCount="59" Body="&lt;p&gt;Should the &lt;code&gt;/admin/resources/assetthumbs/{assetid}/200&lt;/code&gt; be accessible without being logged in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve just noticed I can access thumbnails that way, and with some fiddling even let it generate huge images for me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is on v2.6.3002.&lt;/p&gt;&#xA;" OwnerUserId="646" LastEditorUserId="57" LastEditDate="2018-01-26T19:48:22.963" LastActivityDate="2018-01-26T19:48:22.963" Title="Admin resources are accessible without being logged in" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23648" PostTypeId="1" AcceptedAnswerId="23649" CreationDate="2018-01-26T15:50:49.890" Score="1" ViewCount="178" Body="&lt;p&gt;I'm trying to import an ExpressionEngine blog into Craft. I've set up an xml feed on the EE site and limited it to two entries for testing purposes. Once it's working will import everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I&quot;m having is that when I run the import it fails and the feed me logs aren't helpful. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EE Blog: Finished database backup&#xA;EE Blog: Starting database backup&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's all I get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done field mapping and set a unique identify for existing elements (there should be none at this point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sent a support email to feedme via the CP two days ago but haven't gotten a response.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-01-26T16:50:05.337" Title="Feedme Fails - logs not helpful" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23649" PostTypeId="2" ParentId="23648" CreationDate="2018-01-26T16:50:05.337" Score="2" Body="&lt;p&gt;Check to make sure your &lt;strong&gt;Primary Element&lt;/strong&gt; field in the initial setup is the entry element and not the top level in your xml file, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;root&amp;gt;&#xA; &amp;lt;article&amp;gt;&amp;lt;/article&amp;gt;&#xA; &amp;lt;article&amp;gt;&amp;lt;/article&amp;gt;&#xA;&amp;lt;/root&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;article&lt;/code&gt; should be the &lt;strong&gt;Primary Element&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2018-01-26T16:50:05.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23650" PostTypeId="2" ParentId="23647" CreationDate="2018-01-26T19:48:07.827" Score="1" Body="&lt;p&gt;In Craft 2, this is expected behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, we &quot;fixed&quot; it by using an Asset's UID instead of its ID, which makes it harder to guess.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-26T19:48:07.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23651" PostTypeId="2" ParentId="23642" CreationDate="2018-01-26T22:27:37.300" Score="1" Body="&lt;p&gt;I'm not sure if this will help anyone in the future, but I was able to get it working. Basically, I needed to have the plugin folder &lt;code&gt;psmw&lt;/code&gt; both in &lt;code&gt;plugins/businesslogic/vendor&lt;/code&gt; and at the &lt;code&gt;root&lt;/code&gt; of my project. The PHP was executed within the plugin, while the CSS and JS was referenced from the &lt;code&gt;root&lt;/code&gt;, since you can't point to assets within the plugin folder from a Craft template. May not be the sexiest method, but it works.&lt;/p&gt;&#xA;" OwnerUserId="7411" LastActivityDate="2018-01-26T22:27:37.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23652" PostTypeId="1" CreationDate="2018-01-26T23:16:24.410" Score="1" ViewCount="230" Body="&lt;p&gt;I'm trying to reuse a dropdown field inside of a matrix. I've already created a field which has hundreds of dropdown values. I want to be able to select from this dropdown field for each item of a matrix. So instead of having to re create this field for each matrix block, is there a way I can copy/paste a field to a matrix field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="6995" LastActivityDate="2018-01-26T23:31:14.330" Title="Is it possible to use an existing field into a matrix?" Tags="&lt;matrix&gt;&lt;field&gt;&lt;fieldtypes&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23653" PostTypeId="2" ParentId="23652" CreationDate="2018-01-26T23:31:14.330" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/benjamminf/craft-neo/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;neo&lt;/a&gt; Plugin or you can copy and paste the field settings manually from one field to your matrix field in your database interface. In your &lt;code&gt;craft_fields&lt;/code&gt; table there is a column &lt;code&gt;settings&lt;/code&gt; you can search for your field handle and copy the settings to your new field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll not be able to do this without a custom plugin or copy pasting the values via SQL in any way &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-26T23:31:14.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23654" PostTypeId="1" AcceptedAnswerId="23655" CreationDate="2018-01-27T09:37:08.697" Score="1" ViewCount="67" Body="&lt;p&gt;I have created an infinite loop by crossreferencing two includes to each other. On one page. My aim is to load pop up layers on a page (teachers and instruments) and have links to each other.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#      include: _layer_instrument      #}&#xA;&amp;lt;a   href=&quot;javascript:void(0)&quot; onclick = &#xA;&quot;document.getElementById('{{teacher}}').style.display='block'; &#xA;document.getElementById('fade').style.display='block'&quot;&amp;gt;&#xA;                        {{ teacher.title }}&amp;lt;/a&amp;gt; &#xA;{% include &quot;includes/_layer_teacher&quot; %} &#xA;&#xA;{#     include: _layer_teacher         #}&#xA;&amp;lt;a   href=&quot;javascript:void(0)&quot; onclick = &#xA;&quot;document.getElementById('{{instrument}}').style.display='block'; &#xA;document.getElementById('fade').style.display='block'&quot;&amp;gt;&#xA;                        {{ instrument.title }}&amp;lt;/a&amp;gt; &#xA;{% include &quot;includes/_layer_instrument&quot; %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use ajax to not load the includes until they are needed?&lt;/p&gt;&#xA;" OwnerUserId="7812" LastEditorUserId="7812" LastEditDate="2018-01-27T10:09:51.597" LastActivityDate="2018-01-27T10:09:51.597" Title="load include not until its needed" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23655" PostTypeId="2" ParentId="23654" CreationDate="2018-01-27T09:53:03.697" Score="2" Body="&lt;p&gt;You can create a custom plugin with &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; and check the box for &lt;code&gt;Controllers&lt;/code&gt; but leave the name blank. Copy the downloaded files into your &lt;code&gt;path/to/craft/craft/plugins/&amp;gt;&amp;gt;nameofyourplugin&amp;lt;&amp;lt;/&lt;/code&gt; directory and install it in your cp. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'll insert a function like this in your controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRenderTemplate(){&#xA;    $id = craft()-&amp;gt;request-&amp;gt;getParam('id');&#xA;    // do some checks if the id is valid or not here...&#xA;&#xA;    $html = '';&#xA;    $success = false;&#xA;    $message = '';&#xA;&#xA;    if($entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($id)){&#xA;        // as example to render different templates based on entry type&#xA;        $entryType = $entry-&amp;gt;getType()-&amp;gt;handle; &#xA;        $html = craft()-&amp;gt;templates-&amp;gt;render('path/to/your/template/' . $entryType, array(&#xA;            'entry' =&amp;gt; $entry&#xA;        ));&#xA;        if($html){&#xA;            $success = true;&#xA;        }&#xA;    }else{&#xA;        $message = Craft::t('could not find entry with id ' . $id);&#xA;    }&#xA;&#xA;    $this-&amp;gt;returnJson([&#xA;        'message'   =&amp;gt; $message,&#xA;        'success'   =&amp;gt; $success,&#xA;        'html'      =&amp;gt; $html&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your Javascript could be this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.load-instrument').click(function(){&#xA;    var data = {&#xA;        action: &quot;pluginname/actionRenderTemplate&quot;,&#xA;        id: $(this).data('id')&#xA;    };&#xA;    $.ajax({&#xA;        type: &quot;post&quot;,&#xA;        url: '',&#xA;        data: data,&#xA;        success: function(data){&#xA;            if(data.success === true){&#xA;                $(&quot;#idOfYourDiv&quot;).html(data.html);&#xA;            }else{&#xA;                // display error messages here&#xA;            }&#xA;        },&#xA;        error: function (XMLHttpRequest, textStatus) {&#xA;            console.log(&quot;Status: &quot; + textStatus);&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I would recommend you to read the &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; about &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controllers&lt;/a&gt; and about &lt;a href=&quot;https://craftcms.com/docs/plugins/templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;templates&lt;/a&gt; to fully understand what you have to do here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: your html could be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;button data-id=&quot;{{instrument.id}}&quot; class=&quot;load-instrument&quot; value=&quot;click me&quot;&amp;gt;Click me&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-27T10:00:39.600" LastActivityDate="2018-01-27T10:00:39.600" CommentCount="27" ContentLicense="CC BY-SA 3.0" />
  <row Id="23656" PostTypeId="1" CreationDate="2018-01-27T10:42:55.703" Score="2" ViewCount="130" Body="&lt;p&gt;How can I wrap a div around certain neo fields based on what appears before or after them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I want to wrap a container div around a set of items (text based objects) only at the start and end of these objects but whenever they appear. Sometimes they might have one item other times they migjt have several.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started with this but I am a little stuck&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentBuilder3.level(1) %}&#xA;      {% set type = block.type.handle %}&#xA;      {% set nextType = (not loop.last ? type) %}&#xA;      {% set prevType = (not loop.last ? type) %}&#xA;&#xA;      {% if type in ['heading', 'body', 'downloads', 'textLinks' ]  %}&#xA;       {{ nextType }} :: {{ prevType }} this is a first child&#xA;        &amp;lt;div class=&quot;max-w-2xl // min-w-75 // mx-auto //  //// px-6 // border //&quot;&amp;gt;&#xA;      {% endif %}&#xA;&#xA;{% if prevType in ['heading', 'body', 'downloads', 'textLinks'] %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code currently wraps a div around each instance of the array not one around the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;br&gt;&#xA;After Marions helpful answer, I was unable to solve exactly with her method, but it did put me on the right tracks to solve it like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set inTheDiv = false %}&#xA;{% set nextType = null %}&#xA;{% set prevType = null %}&#xA;&#xA;{% for block in entry.contentBuilder3.level(1) %}&#xA;  {% set type = block.type.handle %}&#xA;  {% set nextType = (not loop.last ? block.next.type.handle) %}&#xA;  {% set prevType = (not loop.first ? block.prev.type.handle) %}&#xA;  {% set fullWidth = block.fullWidth|default() %}&#xA;  {% set textBlockArray = ['heading', 'body', 'downloads', 'textLinks', 'pullQuote', 'callToActionText'] %}&#xA;&#xA;  {% if type in textBlockArray and nextType in textBlockArray and prevType not in textBlockArray %}&#xA;    &amp;lt;div class=&quot;mx-auto // max-w-2xl border border-red //// py-4&quot;&amp;gt;&#xA;  {% endif %}&#xA;&#xA;  {% switch type %}&#xA;&#xA;    {# BLOCK TYPES CONTNET/TEXT #}&#xA;    {% case 'heading' %}&#xA;      {{ sectionSpacing }}&#xA;    {% include '_includes/matrix3/heading' %}&#xA;&#xA;    {% case 'body' %}&#xA;      {% include '_includes/matrix3/body' %}&#xA;&#xA;    {% case 'pullQuote' %}&#xA;      {% include '_includes/matrix3/pullQuote' %}&#xA;&#xA;    {% case 'downloads' %}&#xA;      {% include '_includes/matrix3/downloads' %}&#xA;&#xA;    {% case 'textLinks' %}&#xA;      {% include '_includes/matrix3/textLinks' %}&#xA;&#xA;    {% case 'callToActionText' %}&#xA;      {% include '_includes/matrix3/callToActionText' %}&#xA;&#xA;    {% case 'quote' %}&#xA;      {% include '_includes/matrix3/quote' %}&#xA;&#xA;    {# LAYOUT BLOCKS #}&#xA;    {% case 'tabbedContent' %}&#xA;      &amp;lt;div class=&quot;-mx-6 //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/tabbedContent' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case 'tiles' %}&#xA;      &amp;lt;div class=&quot;{% if fullWidth == true %}-mx-6{% else %}mx-auto // max-w-4xl flex{% endif %} //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/tiles' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case 'tileWithImage' %}&#xA;      &amp;lt;div class=&quot;{% if fullWidth == true %}-mx-6{% else %}mx-auto // max-w-2xl{% endif %} //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/tileWithImage' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case 'textWithImage' %}&#xA;      &amp;lt;div class=&quot;mx-auto // max-w-2xl //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/textWithImage' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case 'textWithVideo' %}&#xA;      {% include '_includes/matrix3/textWithVideo' %}&#xA;&#xA;    {% case 'textWithText' %}&#xA;      {% include '_includes/matrix3/textWithText' %}&#xA;&#xA;&#xA;    {% case 'statistics' %}&#xA;      {% include '_includes/matrix3/statistics' %}&#xA;&#xA;    {# MEDIA BLOCKS #}&#xA;    {% case 'image' %}&#xA;      {% include '_includes/matrix3/image' %}&#xA;&#xA;    {% case 'video' %}&#xA;      {% include '_includes/matrix3/video' %}&#xA;&#xA;    {% case 'mediaGrid' %}&#xA;      &amp;lt;div class=&quot;{{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/mediaGrid' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {# CTA BLOCKS #}&#xA;    {% case 'callToActionFull' %}&#xA;      &amp;lt;div class=&quot;-mx-6 //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/callToActionFull' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case 'callOutBlock' %}&#xA;      &amp;lt;div class=&quot;-mx-6 //// {{ block.sectionSpacing }}&quot;&amp;gt;&#xA;        {% include '_includes/matrix3/callOutBlock' %}&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;  {% endswitch %}&#xA;&#xA;  {% if type in textBlockArray and nextType not in textBlockArray and prevType in textBlockArray %}&#xA;    &amp;lt;/div&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="130" LastEditDate="2018-01-29T20:38:12.830" LastActivityDate="2018-01-29T20:38:12.830" Title="Wrapping divs around a group of neo blocks" Tags="&lt;templating&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23657" PostTypeId="1" CreationDate="2018-01-27T12:51:12.307" Score="1" ViewCount="147" Body="&lt;p&gt;I need to reference an image in a rich text field separately to the text. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I can't just use {{entry.body}} I need to be able to do {{entry.body.image}} or something comparable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do something like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully my question makes sense, I am new to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7425" LastActivityDate="2018-01-28T00:37:41.470" Title="How can I reference images in a rich text field?" Tags="&lt;templating&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23658" PostTypeId="2" ParentId="23657" CreationDate="2018-01-27T13:16:23.007" Score="1" Body="&lt;p&gt;Sounds like you are coming from something like WordPress. In Craft there are asset fields where you can relate assets to your text. Together with matrix fields you can create a powerful layout rather than inserting everything into one huge wysiwyg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to fetch images in html editors you'll need a plugin for that. It's not possible in Craft per default because it's not really the intended way &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-28T00:37:41.470" LastActivityDate="2018-01-28T00:37:41.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23659" PostTypeId="1" AcceptedAnswerId="23661" CreationDate="2018-01-28T18:51:52.797" Score="2" ViewCount="166" Body="&lt;p&gt;I want to generate a list of  events that are related to a specific festival and that are related to a specific category. This goal sits alongside some others that are inspiring me to attempt this in a single template and to do so via building params that are then passed to Craft entries tag. Using Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the base params - these return a fine result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set base criteria for event query #}&#xA;{% set params = {&#xA;    section : 'events',&#xA;    orderBy : 'eventStartDateTime asc',&#xA;    relatedTo: [&#xA;        { element: entry.id }&#xA;    ],&#xA;    limit: null&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next here are the params to try and get the events associated with a specific festival entry and that are related to a specific category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Segment 4 is about categories #}&#xA;{% if craft.app.request.getSegment(4) %}&#xA;    {# segment 4 is the category slug #}&#xA;    {% set cat = craft.app.request.getSegment(4) %}&#xA;    {% set relationParam = {&#xA;        relatedTo: ['and',&#xA;            { targetElement: cat },&#xA;            { element: entry.id }&#xA;        ]&#xA;    }%}  &#xA;&#xA;    {% set params = params|merge(relationParam) %}&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am seeing in this second scenario is I am not getting results filtered by the category. Feel like I am close but missing something, likely fundamental.&lt;/p&gt;&#xA;" OwnerUserId="329" LastActivityDate="2018-01-28T19:50:41.143" Title="Trying to build params to be able find entries related to an entry and that are related to a specific category" Tags="&lt;craft3&gt;&lt;params&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23660" PostTypeId="2" ParentId="23656" CreationDate="2018-01-28T19:22:08.143" Score="3" Body="&lt;p&gt;I always think of this sort of thing as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Finite-state_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;finite state machine&lt;/a&gt;. Your states are whether or not you are in the div, and for each block, you change state or not depending on what state you are currently in, and what that block type is. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# initial state: not in the div #}&#xA;{% set inTheDiv = false %}&#xA;&#xA;{% for block in blocks %}&#xA;  {# should this block be inside the div? #}&#xA;  {% set isInsideBlock = block.type.handle in ['heading', 'body', 'downloads', 'textLinks'] %}&#xA;&#xA;  {% if isInsideBlock and not inTheDiv %}&#xA;    {# state change to inTheDiv #}&#xA;    &amp;lt;div&amp;gt;&#xA;    {% set inTheDiv = true %}&#xA;  {% endif %}&#xA;  {% if not isInsideBlock and inTheDiv %}&#xA;    {# state change to not inTheDiv #}&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% set inTheDiv = false %}&#xA;  {% endif %}&#xA;&#xA;  ... output your block stuff here&#xA;{% endfor %}&#xA;&#xA;{# done with blocks, so close the div if necessary #}&#xA;{% if inTheDiv %}&#xA;  &amp;lt;/div&amp;gt;&#xA;  {% set inTheDiv = false %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The whole finite state machine may seem like overkill, but you can handle a lot of complexity this way.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-01-28T19:22:08.143" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23661" PostTypeId="2" ParentId="23659" CreationDate="2018-01-28T19:50:41.143" Score="1" Body="&lt;p&gt;I think the answer you’re looking for is &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8734/craft-entries-related-on-a-category-page&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;relatedTo&lt;/code&gt; method accepts a &lt;code&gt;CategoryModel&lt;/code&gt;, not the &lt;code&gt;title&lt;/code&gt;(slug) of a category.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="291" LastActivityDate="2018-01-28T19:50:41.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23662" PostTypeId="1" CreationDate="2018-01-28T20:21:06.650" Score="1" ViewCount="40" Body="&lt;p&gt;I am new to using twig and I do not understand how this line of code works. If you could explain that would be wonderful! thanks:)&lt;/p&gt;&#xA;" OwnerUserId="7917" LastActivityDate="2018-01-28T20:36:51.787" Title="what does {% set order = 'pin desc, postDate desc' %} do?" Tags="&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23663" PostTypeId="2" ParentId="23662" CreationDate="2018-01-28T20:29:32.443" Score="2" Body="&lt;p&gt;Craft uses the the template engine &lt;a href=&quot;https://twig.symfony.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;twig&lt;/a&gt; and there is a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/set.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;set&lt;/a&gt; tag that is the same as it's php equivalent for &lt;code&gt;$order = 'pin...'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you just set/declare a variable - in this case you set the string.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="45" LastEditDate="2018-01-28T20:36:51.787" LastActivityDate="2018-01-28T20:36:51.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23664" PostTypeId="1" CreationDate="2018-01-29T09:11:42.433" Score="1" ViewCount="258" Body="&lt;p&gt;I am trying to make the URLs translatable according to the language selected for the site.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="57" LastEditDate="2018-01-29T17:43:33.903" LastActivityDate="2019-02-25T23:30:03.930" Title="How to make URLs translatable in Craft 3" Tags="&lt;localization&gt;&lt;url&gt;&lt;craft3&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23665" PostTypeId="2" ParentId="446" CreationDate="2018-01-29T12:37:23.897" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://www.simplemachines.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simple Machines Forum&lt;/a&gt; (SMF) is pretty good as far as forums go, comparing favorably to PHPBB. I've used Craft's bootstrapping capability to integrate Craft templates into SMF templates pretty easily:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// Bootstrap Craft&#xA;$craft = include '/path/to/craft/app/bootstrap.php';&#xA;&#xA;// Save the output of the specified Craft template&#xA;$header = $craft-&amp;gt;templates-&amp;gt;render('includes/header');&#xA;&#xA;// Show the saved output&#xA;echo $header;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I guess that holds for any PHP-based forum, of course.&lt;/p&gt;&#xA;&lt;p&gt;It doesn't cover SSO, though.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-01-29T12:37:23.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23666" PostTypeId="1" CreationDate="2018-01-29T15:37:21.270" Score="3" ViewCount="268" Body="&lt;p&gt;As a web design shop we would like to license Craft not for ourselves but for our customers who run and own the future websites. How do we do that?&lt;/p&gt;&#xA;" OwnerUserId="5082" LastEditorUserId="57" LastEditDate="2018-01-29T17:44:42.213" LastActivityDate="2018-01-29T17:50:58.453" Title="How to license Craft for my customer?" Tags="&lt;license&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23667" PostTypeId="2" ParentId="23666" CreationDate="2018-01-29T17:35:08.490" Score="0" Body="&lt;p&gt;??? You either purchase the license on the client's behalf and bill the client for the cost or have the client purchase the license themselves. I'm  not sure what you're confused about. The license is attached to a domain.&lt;/p&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2018-01-29T17:35:08.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23668" PostTypeId="2" ParentId="23666" CreationDate="2018-01-29T17:50:58.453" Score="2" Body="&lt;p&gt;Who &quot;owns&quot; a Craft license is very loosely defined as far as &lt;a href=&quot;https://pixelandtonic.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pixel &amp;amp; Tonic&lt;/a&gt; (the creators of &lt;a href=&quot;https://craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft&lt;/a&gt;) is concerned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Craft purchase/edition is tied to the &lt;code&gt;craft/config/license.key&lt;/code&gt; file that is in place at the time a purchase is made and wherever that file goes, the purchase/edition will follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to that, a &lt;code&gt;license.key&lt;/code&gt; file can only ever be tied to one public domain at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as you give your client that &lt;code&gt;license.key&lt;/code&gt; file and don't use it for other clients or projects, they &quot;own&quot; it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How the license gets paid for is more up to you and your client.  i.e. either you purchase it and bill the client as a line-item on an invoice or have them purchase it directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some relevant reading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/license-key-info&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/license-key-info&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/license-enforcement&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/license-enforcement&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-01-29T17:50:58.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23670" PostTypeId="1" CreationDate="2018-01-29T22:50:06.363" Score="1" ViewCount="119" Body="&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'stories';&#xA;$criteria-&amp;gt;search = $this-&amp;gt;query;&#xA;$criteria-&amp;gt;order = $this-&amp;gt;orderSql();&#xA;$criteria-&amp;gt;limit = 1000;&#xA;$criteria-&amp;gt;visibility = $this-&amp;gt;checkVisibility();&#xA;$criteria-&amp;gt;thisIsAGuide = ':empty:';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need help adding a relatedTo criteria to help pull related entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current search scope is searching on entries (&quot;Story&quot;).&#xA;The entry(&quot;Story&quot;) contains an entry (&quot;channel&quot;). &#xA;That channel has a category(&quot;brandCategories&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to return stories that contain entries that have a matching brandCategory.&#xA;That brandCategory is getting pulled from a GET var of &quot;&amp;amp;brands%5B%5D={{categoryId}}&lt;/p&gt;&#xA;" OwnerUserId="3614" LastActivityDate="2018-01-29T22:59:13.627" Title="RelatedTo in plugin based search" Tags="&lt;search&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23671" PostTypeId="2" ParentId="23670" CreationDate="2018-01-29T22:59:13.627" Score="2" Body="&lt;p&gt;You can create 2 queries, first you pull all the channel entries, that are related to your &lt;code&gt;bandCategory&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;relatedTo = $bandCategory;&#xA;$criteria-&amp;gt;section = 'channel';&#xA;$relatedChannelEntries = $criteria-&amp;gt;ids();&#xA;&#xA;// then continue your code &#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'stories';&#xA;$criteria-&amp;gt;search = $this-&amp;gt;query;&#xA;$criteria-&amp;gt;order = $this-&amp;gt;orderSql();&#xA;$criteria-&amp;gt;limit = 1000;&#xA;$criteria-&amp;gt;visibility = $this-&amp;gt;checkVisibility();&#xA;$criteria-&amp;gt;thisIsAGuide = ':empty:';&#xA;// and search only for entries that are related to channel entries that are related to your band&#xA;$criteria-&amp;gt;relatedTo = $relatedChannelEntries;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-29T22:59:13.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23674" PostTypeId="1" CreationDate="2018-01-30T11:05:39.177" Score="1" ViewCount="558" Body="&lt;p&gt;I have created some entries for type single but now I am not able to update their slug even I have updated the title&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="57" LastEditDate="2018-01-30T23:48:21.290" LastActivityDate="2018-01-30T23:48:21.290" Title="Unable to update slug in Craft 3 for single enteries" Tags="&lt;entry&gt;&lt;craft3&gt;&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23675" PostTypeId="2" ParentId="23674" CreationDate="2018-01-30T11:21:08.660" Score="1" Body="&lt;p&gt;You have to change the URI format in your section for the specific language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to &lt;code&gt;settings -&amp;gt; sections -&amp;gt; your single section&lt;/code&gt;, there you'll have a table below and you can insert the URI format you like for every site.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-30T11:21:08.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23676" PostTypeId="1" AcceptedAnswerId="23678" CreationDate="2018-01-30T11:39:52.320" Score="1" ViewCount="619" Body="&lt;p&gt;I'd like to create a field of type Dropdown/Table (or even use a field from a plugin like color-swatches) and have it available when selecting a matrix block element field type:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/srkX0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/srkX0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, it's for creating a field containing a set of color values, a palette.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know whether or not this is a common approach and what solutions do you usually give to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-01-30T11:47:52.410" LastActivityDate="2018-01-30T16:58:34.337" Title="Use a custom field type in Matrix Blocks - Craft 3" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23677" PostTypeId="1" CreationDate="2018-01-30T15:21:36.580" Score="1" ViewCount="730" Body="&lt;p&gt;We just created an entry and hit save.  When we go to the front end of site we get a popup error that reads: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to&#xA;  int&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does this mean and how do I troubleshoot it&lt;/p&gt;&#xA;" OwnerUserId="7922" LastActivityDate="2018-01-30T17:49:40.040" Title="Why am I getting error: Object of class Craft\ElementCriteriaModel could not be converted to int" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23678" PostTypeId="2" ParentId="23676" CreationDate="2018-01-30T16:27:28.933" Score="2" Body="&lt;p&gt;I'm not sure what it has to do with a matrix - you can use every field normally and inside a matrix, there is no restriction - but I usually create a custom field type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how to create Plugins in the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/plugin-intro.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; all available fields in Craft extends the base &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Field.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Field&lt;/a&gt; class&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are function like &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Field.php#L279&quot; rel=&quot;nofollow noreferrer&quot;&gt;getInputHtml&lt;/a&gt; where you define the html that should be displayed while you create your entry/category and the function &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Field.php#L345&quot; rel=&quot;nofollow noreferrer&quot;&gt;serializeValue&lt;/a&gt; that defines which value should be saved into the db. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should take a look at the default Craft &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;fields&lt;/a&gt; to get used to it. Change the values you need and create your own field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However: I think the most common approach is to look what Pixel and Tonic does and understand how it works. Then you can create custom fields via Plugin or Module&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&#xA;You can see how to register custom fields &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/field-types.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. As you can see they say the same &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You can refer to Craft’s own field classes for examples&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-01-30T16:58:34.337" LastActivityDate="2018-01-30T16:58:34.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23679" PostTypeId="1" AcceptedAnswerId="26661" CreationDate="2018-01-30T16:39:35.970" Score="3" ViewCount="639" Body="&lt;p&gt;I need to create a few hundred entries at once.  I used the Import plugin for Craft 2 to create these entries from a CSV file.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do the same for Craft 3?  I do not see a plugin for this capability on the Craft 3 plugin page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-23T14:47:06.120" Title="How can I import a large number of new entries into Craft 3" Tags="&lt;craft3&gt;&lt;import&gt;&lt;plugin-import&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23680" PostTypeId="1" CreationDate="2018-01-30T17:44:52.883" Score="1" ViewCount="530" Body="&lt;p&gt;I'm trying to set up a multisite with Craft 3, and the client wants a set up with URLs that look like &lt;code&gt;foo.client.com&lt;/code&gt;, with &lt;code&gt;foo.client.com/2018&lt;/code&gt; and &lt;code&gt;foo.client.com/2019&lt;/code&gt;. Right now, my &lt;code&gt;index.php&lt;/code&gt; file looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch(explode('/', $_SERVER['REQUEST_URI'])[1]) {&#xA;  case '2018':&#xA;    define('CRAFT_SITE', 'twentyEighteen');&#xA;    break;&#xA;  default:&#xA;    define('CRAFT_SITE', 'default');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This correctly changes the site if I go to &lt;code&gt;/2018&lt;/code&gt;, but the problem is that Craft is looking for templates at &lt;code&gt;templates/2018/xx/xx&lt;/code&gt; instead of &lt;code&gt;templates/xx/xx&lt;/code&gt;.. So when I go to &lt;code&gt;foo.client.com/2018&lt;/code&gt; I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template not found: 2018&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the back-end I have the &lt;code&gt;twentyEighteen&lt;/code&gt; site defined and the site base URL is set to &lt;code&gt;http://foo.client.com/2018/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this should work because they even use &lt;code&gt;/en&lt;/code&gt; and &lt;code&gt;/nl&lt;/code&gt; as examples in the &lt;a href=&quot;https://craftcms.com/docs/localization-guide&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2 Localization Guide&lt;/a&gt;, and Craft 3 multisites work similarly.&lt;/p&gt;&#xA;" OwnerUserId="2295" LastActivityDate="2018-01-30T17:44:52.883" Title="Craft 3 Multisite: Template not found" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23681" PostTypeId="2" ParentId="23677" CreationDate="2018-01-30T17:49:40.040" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; is an object that prepares your queries. For example when you do &lt;code&gt;craft.entries&lt;/code&gt; you'll receive an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; where you can insert ids, sections, relations and many other attributes until you finally &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#fetching-the-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;fetch&lt;/a&gt; your entries with &lt;code&gt;find()&lt;/code&gt;, &lt;code&gt;first()&lt;/code&gt; or &lt;code&gt;ids()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have a relation field attached to the entry the values of these fields are objects of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt; too, so you have a ready to use query that can be executed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This class has an &lt;code&gt;iterator&lt;/code&gt; interface, that means the method &lt;code&gt;find()&lt;/code&gt; is executed when you loop through it, that being said &lt;code&gt;for image in entry.images&lt;/code&gt; does actually &lt;code&gt;for image in entry.images.find()&lt;/code&gt;. Thus many people think &lt;code&gt;entry.images&lt;/code&gt; contains an array of elements rather than one single element. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So - for future reference - when you ever receive an error like&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to XXX&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's likely you treated your &lt;code&gt;ElementCriteriaModel&lt;/code&gt; as an array or element or string or whatever the error explains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your special case it was just a syntax error: change &lt;code&gt;gridImages.length&lt;/code&gt; to &lt;code&gt;gridImages|length&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-01-30T17:49:40.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23682" PostTypeId="2" ParentId="23679" CreationDate="2018-01-30T18:08:21.790" Score="5" Body="&lt;p&gt;One option is to create a Craft 2 site, import the entries there, and then upgrade that site to Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-01-30T18:08:21.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23683" PostTypeId="1" AcceptedAnswerId="23684" CreationDate="2018-01-30T19:09:43.923" Score="3" ViewCount="1848" Body="&lt;p&gt;When you create a Plain Text field it asks if you want to allow line breaks, but they are ignored when output in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to have to use a rich text field just to enable editors to add a simple line break, but is that my only option?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-09-26T21:43:54.067" Title="Enable line breaks in plain text fields" Tags="&lt;plaintext&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23684" PostTypeId="2" ParentId="23683" CreationDate="2018-01-30T19:38:52.350" Score="4" Body="&lt;p&gt;You can still use plain text, you just need to use a filter after &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.text | nl2br  }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="7426" LastEditDate="2018-09-26T21:43:54.067" LastActivityDate="2018-09-26T21:43:54.067" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23685" PostTypeId="1" CreationDate="2018-01-30T19:58:34.543" Score="1" ViewCount="103" Body="&lt;p&gt;So I'm trying to setup my first Craft installation on Digital Ocean. I'm bound to use Craft version 2.0.2535 since I'll be duplicating a site using this (so I cannot use Craft 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spun up a new Droplet on DigitalOcean. I've set up Apache, PHP and Mysql and verified it all works. After copying the the Craft files and resolved all the issues regarding rights to folders, I was finally ready to run the installer, I get this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notice: Undefined property: Craft\WebApp::$urlManager in&#xA;  /var/www/craft/app/controllers/BaseController.php on line 37&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Fatal error: Uncaught Error: Call to a member function&#xA;  getRouteParams() on null in&#xA;  /var/www/craft/app/controllers/BaseController.php:37 Stack trace: #0&#xA;  /var/www/craft/app/framework/web/CController.php(308):&#xA;  Craft\BaseController-&gt;getActionParams() #1&#xA;  /var/www/craft/app/framework/web/CController.php(286):&#xA;  CController-&gt;runAction(Object(CInlineAction)) #2&#xA;  /var/www/craft/app/framework/web/CController.php(265):&#xA;  CController-&gt;runActionWithFilters(Object(CInlineAction), NULL) #3&#xA;  /var/www/craft/app/framework/web/CWebApplication.php(282):&#xA;  CController-&gt;run('renderError') #4&#xA;  /var/www/craft/app/framework/base/CErrorHandler.php(331):&#xA;  CWebApplication-&gt;runController('templates/rende...') #5&#xA;  /var/www/craft/app/framework/base/CErrorHandler.php(289):&#xA;  CErrorHandler-&gt;render('error', Array) #6&#xA;  /var/www/craft/app/etc/errors/ErrorHandler.php(149):&#xA;  CErrorHandler-&gt;handleError(Object(CErrorEvent)) #7&#xA;  /var/www/craft/app/framework/base/CErrorHandler.php(131):&#xA;  Craft\ErrorHandler-&gt;handleError(Object(CErrorEvent)) #8&#xA;  /var/www/craft/app/framework/base/CAp in&#xA;  /var/www/craft/app/controllers/BaseController.php on line 37&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I honestly have no idea on what can be wrong. Any pointers would be very welcome...&lt;/p&gt;&#xA;" OwnerUserId="7924" LastActivityDate="2018-01-30T20:30:03.167" Title="Undefined property: Craft\WebApp::$urlManager in /var/www/craft/app/controllers/BaseController.php on line 37" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23686" PostTypeId="1" AcceptedAnswerId="23690" CreationDate="2018-01-30T20:24:05.017" Score="2" ViewCount="112" Body="&lt;p&gt;I'm trying to figure out how to set the size of a marker on a map.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;  zoom: 6,&#xA;  markerOptions: {&#xA;    icon: 'https://www.mysite.com/images/map/marker.png',&#xA;    scaledSize: 'new google.maps.Size(20,20)'&#xA;  },&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It pulls in my marker file correctly, but I don't know what the correct option is to make it scale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a 40px square image, but I want it to show at 20px, so it doesn't look like garbage on a retina screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help?&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2021-01-01T06:57:21.913" Title="Smart Map - setting an icon size" Tags="&lt;plugin-smartmap&gt;&lt;google-maps&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23687" PostTypeId="2" ParentId="23685" CreationDate="2018-01-30T20:30:03.167" Score="2" Body="&lt;p&gt;You're probably running PHP v. 7.0 or higher on your DigitalOcean box; Craft CMS didn't have PHP 7.0 compatibility &lt;a href=&quot;https://pixelandtonic.com/blog/php-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;until Craft 2.4.2697&lt;/a&gt;, which is why it chokes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Downgrading your PHP version to 5.6 or 5.4 should resolve your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also beware of your MySQL version – &lt;a href=&quot;https://craftcookbook.net/recipes/making-craft-play-nicely-with-mysql-5-7-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2 has issues on MySQL 5.7&lt;/a&gt;; ideally you should make sure your droplet uses 5.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also – I'd look into upgrading the install to the latest and greatest Craft 2.x, if not Craft 3. A lot of good stuff has happened since 2014 ;)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-01-30T20:30:03.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23688" PostTypeId="1" AcceptedAnswerId="23689" CreationDate="2018-01-31T04:03:11.500" Score="1" ViewCount="206" Body="&lt;p&gt;My template has this line that I want to update from a field in craft: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.formBuilder2.getFormByHandle('schoolTrip') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want 'schoolTrip' to be replaceable by a plain text field in craft. My plain text field is named 'formName'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.formBuilder2.getFormByHandle('block.formName') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;just gives me errors.&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="45" LastEditDate="2018-01-31T04:28:48.760" LastActivityDate="2018-01-31T04:38:36.643" Title="Pass variable in Twig tag" Tags="&lt;templating&gt;&lt;form&gt;&lt;plugin-formbuilder2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23689" PostTypeId="2" ParentId="23688" CreationDate="2018-01-31T04:29:31.090" Score="2" Body="&lt;p&gt;It's giving you errors because you put the variable in quotes. Ditch the quotes and try it like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.formBuilder2.getFormByHandle(entry.formName) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-01-31T04:38:36.643" LastActivityDate="2018-01-31T04:38:36.643" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23690" PostTypeId="2" ParentId="23686" CreationDate="2018-01-31T06:37:53.087" Score="2" Body="&lt;p&gt;As of Smart Map &lt;strong&gt;v2.4.2&lt;/strong&gt;, it is now possible to build more elaborate markers using a nested syntax for the &lt;code&gt;markerOptions&lt;/code&gt; value. Try something like this...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;  zoom: 6,&#xA;  markerOptions: {&#xA;    icon: {&#xA;      url: 'https://www.mysite.com/images/map/marker.png',&#xA;      scaledSize: 'new google.maps.Size(20,20)'&#xA;    }&#xA;  }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:57:21.913" LastActivityDate="2021-01-01T06:57:21.913" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23691" PostTypeId="2" ParentId="21966" CreationDate="2018-01-31T06:43:14.450" Score="2" Body="&lt;p&gt;Turns out, there was a bug in Smart Map which made this impossible. Fortunately, it's now fixed!&lt;/p&gt;&#xA;&lt;p&gt;As of Smart Map &lt;strong&gt;v2.4.2&lt;/strong&gt;, it is possible to build more elaborate markers using a nested syntax for the &lt;code&gt;markerOptions&lt;/code&gt; value. Try something like this...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = {&#xA;    markerOptions: {&#xA;        icon: {&#xA;            url: '/path/to/svg/file',&#xA;            scaledSize: 'new google.maps.Size(50,50)'&#xA;        }&#xA;    }&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T06:56:27.333" LastActivityDate="2021-01-01T06:56:27.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23694" PostTypeId="1" CreationDate="2018-01-31T13:36:09.473" Score="3" ViewCount="286" Body="&lt;p&gt;I currently have this working for a single range of numbers, but I can’t figure it out for multiple ranges. I currently have it set up like this for one range, and it works. &lt;code&gt;myFieldHandle: ['and', '&amp;gt; 0', '&amp;lt; 10']&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7928" LastActivityDate="2018-01-31T22:44:53.380" Title="Search for entries where a field value is between multiple ranges of numbers" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23695" PostTypeId="1" CreationDate="2018-01-31T14:41:02.203" Score="1" ViewCount="317" Body="&lt;p&gt;I'm loading multiple matrix blocks from multiple entries to the homepage if the date is today or in the future. So far this works but now I'm trying to sort the blocks by date and limit the output to 10 dates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I'm currently using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('projects') %}&#xA;&#xA;  {% for block in entry.agendav2 %}&#xA;&#xA;    {% if block.Datum &amp;gt;= now %}&#xA;&#xA;      {% switch block.type %}&#xA;&#xA;        {% case 'Datum' %}&#xA;&#xA;          &amp;lt;table class=&quot;agenda_item&quot;&amp;gt;&#xA;            &amp;lt;tr&amp;gt;&#xA;              &amp;lt;td class=&quot;table_title performance-date table_col-2-3&quot;&amp;gt;{{ block.Datum|date(&quot;d.m.Y&quot;) }}&amp;lt;/th&amp;gt;&#xA;                &amp;lt;td class=&quot;table_title event-location table_col-1-3&quot;&amp;gt;{{ block.locatie }}&amp;lt;/th&amp;gt;&#xA;              &amp;lt;/tr&amp;gt;&#xA;            &amp;lt;tr&amp;gt;&#xA;              &amp;lt;td class=&quot;performance-title table_col-2-3&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.globalTitle }}&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;              &amp;lt;td class=&quot;event-title table_col-1-3&quot;&amp;gt;&amp;lt;a target=&quot;_blank&quot; href=&quot;{{ block.eventUrl }}&quot;&amp;gt;{{ block.evenement }}&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&#xA;            &amp;lt;/tr&amp;gt;&#xA;          &amp;lt;/table&amp;gt;&#xA;&#xA;      {% endswitch %}&#xA;&#xA;    {% endif %}   &#xA;&#xA;  {% endfor %}  &#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Right now it's loading every upcoming date per entry like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry 1: 31-01-2018 &lt;/li&gt;&#xA;&lt;li&gt;Entry 1: 01-02-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 1: 02-03-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 2: 30-01-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 2: 06-02-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 2: 03-03-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 3: 23-01-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 3: 25-01-2018&lt;/li&gt;&#xA;&lt;li&gt;Entry 3: 08-03-2018&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5155" LastEditorUserId="130" LastEditDate="2018-02-03T07:37:24.967" LastActivityDate="2018-02-06T11:18:51.040" Title="Sort matrix blocks by date and limit to 10 entries" Tags="&lt;ordering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23696" PostTypeId="1" AcceptedAnswerId="23697" CreationDate="2018-01-31T15:36:35.593" Score="3" ViewCount="217" Body="&lt;p&gt;Does anyone know how to achieve the following in Twig with Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sections&#xA;&lt;strong&gt;locations&lt;/strong&gt; and &lt;strong&gt;trainings&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find all the entries from &lt;strong&gt;locations&lt;/strong&gt; which has a relation to &lt;strong&gt;trainings&lt;/strong&gt; and a datetime field value from &lt;strong&gt;trainings&lt;/strong&gt; has to be after now.&lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2018-01-31T15:37:28.633" LastActivityDate="2018-01-31T15:48:59.037" Title="Find entries from related section after certain date" Tags="&lt;entries&gt;&lt;relations&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23697" PostTypeId="2" ParentId="23696" CreationDate="2018-01-31T15:37:25.953" Score="4" Body="&lt;p&gt;You’d first get all the relevant entries of your “trainings” section, or better get just their IDs as that’s way better on performance.&#xA;Then on another element query you set the &lt;code&gt;relatedTo&lt;/code&gt; parameter to only get entries related to these entry IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set trainingsEntriesIds = craft.entries({&#xA;    section: 'trainings',&#xA;    postDate: '&amp;gt;= ' ~ 'now'|date('c'),&#xA;}).ids() %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'locations',&#xA;    relatedTo: {&#xA;        targetElement: trainingsEntriesIds,&#xA;        field: 'entriesFieldHandle'&#xA;    },&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-01-31T15:48:59.037" LastActivityDate="2018-01-31T15:48:59.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23698" PostTypeId="2" ParentId="23695" CreationDate="2018-01-31T16:45:50.470" Score="3" Body="&lt;p&gt;Your &lt;code&gt;entry.agendav2&lt;/code&gt; is not an array of elements but a &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; so you can include both properties in your query &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.agendav2.limit(10).order('Datum') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's basically it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: you can search for entries in the future with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Datum('&amp;gt;= ' ~ 'now'|date('c')) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like stated here &lt;a href=&quot;https://craftcms.stackexchange.com/a/23697/5557&quot;&gt;https://craftcms.stackexchange.com/a/23697/5557&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we discussed the issue in my comments I came up with this solution&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrixBlocks = craft.yourPluginHandle.getSortedMatrixBlocks() %}&#xA;{% for matrix in matrixBlocks %}&#xA;    ...&#xA;    {{ matrix.datum }}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And insert this in your PluginVariable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSortedMatrixBlocks(){&#xA;    // the id of your matrix field&#xA;    $matrixFieldId = 61;&#xA;&#xA;    // check your database for your matrix field table and insert your Datum field column&#xA;    // it will be a string like field_{blockHandle}_{fieldHandle}&#xA;    // for me it is&#xA;    $matrixFieldDatum = 'field_test_datum';&#xA;&#xA;    // lowercase handle of your field&#xA;    $matrixFieldHandle = 'matrixfield';&#xA;    $matrixIds = craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;        -&amp;gt;select('craft_matrixblocks.id')&#xA;        -&amp;gt;from('matrixblocks')&#xA;        -&amp;gt;where('craft_matrixblocks.fieldId = :fieldId', ['fieldId' =&amp;gt; $matrixFieldId])&#xA;        -&amp;gt;limit(10)&#xA;        -&amp;gt;join('matrixcontent_'.$matrixFieldHandle, 'craft_matrixblocks.id = craft_matrixcontent_' . $matrixFieldHandle . '.elementId')&#xA;        -&amp;gt;order($matrixFieldDatum . ' ASC')&#xA;        -&amp;gt;queryColumn();&#xA;&#xA;    $allMatrixBlocks = [];&#xA;    foreach ($matrixIds as $id){&#xA;        $allMatrixBlocks[] = craft()-&amp;gt;matrix-&amp;gt;getBlockById($id);&#xA;    }&#xA;&#xA;    return $allMatrixBlocks;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-06T11:18:51.040" LastActivityDate="2018-02-06T11:18:51.040" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23700" PostTypeId="1" AcceptedAnswerId="23716" CreationDate="2018-01-31T18:00:50.390" Score="1" ViewCount="1618" Body="&lt;p&gt;Our server is generating lots of emails that follow this template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;subject&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lfd on host.foo.com: Excessive resource usage: foo (24056 (Parent PID:16356))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;body&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Time:         Wed Jan 31 11:31:20 2018 -0500&#xA;Account:      foo&#xA;Resource:     Virtual Memory Size&#xA;Exceeded:     556 &amp;gt; 512 (MB)&#xA;Executable:   /opt/cpanel/ea-php71/root/usr/bin/php-cgi&#xA;Command Line: /opt/cpanel/ea-php71/root/usr/bin/php-cgi /home/foo/public_html/index.php&#xA;PID:          24056 (Parent PID:16356)&#xA;Killed:       No&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sometimes I can attribute these to image transforms, but other times they appear somewhat randomly. I received 13 in a row earlier today. I've seen this type of email from several servers that run Craft sites. I've researched excessive resource emails in general, but the answer always seems to be &quot;just add it to csf.pignore&quot; - which I don't want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm wondering if anyone knows what Craft process may be generating this type of email. I don't think that we're doing anything out of the ordinary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2018-02-01T23:33:04.813" Title="Excessive resource usage / virtual memory size" Tags="&lt;server&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23701" PostTypeId="1" CreationDate="2018-01-31T19:24:24.490" Score="0" ViewCount="383" Body="&lt;p&gt;Hi does anyone know how to keep the email notifications from going to spam folder? &lt;/p&gt;&#xA;" OwnerUserId="7932" LastActivityDate="2018-02-12T20:34:39.907" Title="Freeform email notifications going to spam" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23702" PostTypeId="1" CreationDate="2018-01-31T21:44:47.333" Score="1" ViewCount="99" Body="&lt;p&gt;Is it currently possible to create a section or category that shares the same entries across multiple sites? I can currently create a section, and once I save an entry, it is propagated to all sites.  However, those entries are then unique to each site.  I'm looking for a way to share a section's entries across multiple sites so that if an entry is modified, those changes are shared and reflected across all sites.&lt;/p&gt;&#xA;" OwnerUserId="1096" LastActivityDate="2018-01-31T21:44:47.333" Title="How can I create a section or category in Craft 3 that shares its entries (i.e. not multi-site)?" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23704" PostTypeId="1" AcceptedAnswerId="23707" CreationDate="2018-01-31T22:41:47.180" Score="1" ViewCount="29" Body="&lt;p&gt;I have an asset field (craft\fields\Asset), how do I figure out which Sources it can use? (Which of the Sources boxes are checked)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for Craft 3, and I'd like to do it in twig (I have the asset field in twig)&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="57" LastEditDate="2018-02-01T23:34:59.507" LastActivityDate="2018-02-01T23:34:59.507" Title="which Sources of asset field are checked" Tags="&lt;craft3&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23705" PostTypeId="2" ParentId="23694" CreationDate="2018-01-31T22:44:53.380" Score="3" Body="&lt;p&gt;I'm not sure if you can do this in the same query but you can use two queries, one for each range, and then merge them, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set range1 = craft.entries({myFieldHandle: ['and', '&amp;gt; 0', '&amp;lt; 10']}) %}&#xA;{% set range2 = craft.entries({myFieldHandle: ['and', '&amp;gt; 20', '&amp;lt; 30']}) %}&#xA;{% set entries = range1 |merge(range2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2018-01-31T22:44:53.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23706" PostTypeId="2" ParentId="20915" CreationDate="2018-01-31T23:26:38.377" Score="5" Body="&lt;p&gt;The documentation posts this link:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upgrading from Craft 2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mijingo has a tutorial: &lt;a href=&quot;https://mijingo.com/lessons/upgrade-to-craft-cms-3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Upgrading Craft 2 to Craft 3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a hangout on the topic on Straight Up Craft: &lt;a href=&quot;https://straightupcraft.com/events/migrating-a-website-with-plugins-from-craft-2-to-craft-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Migrating a website with plugins from Craft 2 to Craft 3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the time of this posting, I have not seen any good documentation on how Plugin Developers should approach migrating their plugins.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="9" LastEditDate="2018-11-02T14:33:24.130" LastActivityDate="2018-11-02T14:33:24.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23707" PostTypeId="2" ParentId="23704" CreationDate="2018-02-01T07:08:37.360" Score="2" Body="&lt;p&gt;You can get all available sources with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field.getSourceOptions()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which returns you an array of all sources, no matter if they are selected or not (just to get the ids and such)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;field.sources&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you'll receive an array if you selected several sources or a string (&lt;code&gt;*&lt;/code&gt;) if all are selected. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-01T07:08:37.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23708" PostTypeId="1" CreationDate="2018-02-01T11:13:14.210" Score="1" ViewCount="114" Body="&lt;p&gt;I'm trying to add tabs into my Craft Site and have just noticed that when you add an anchor point, the anchor ID doesn't actually show up in the URL as it would a normal site, however I need this anchor to be able to target certain tabs in the menu. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way or plugin that forces to anchor to be added to the url?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysite.com/tabs#anchor1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysite.com/tabs#anchor2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mysite.com/tabs#anchor3&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2018-02-01T13:10:11.940" LastActivityDate="2018-02-01T18:17:12.727" Title="Force Anchor ID into page URL" Tags="&lt;url&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23709" PostTypeId="1" AcceptedAnswerId="23717" CreationDate="2018-02-01T12:46:27.953" Score="1" ViewCount="551" Body="&lt;p&gt;I'm attempting to upgrade my Craftsite from 2 to 3, which I have done so, however I seem to be getting a few deprecation errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The first error is:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The auto-generated validation key stored at&#xA;  /Users/User/My-Site/craft/storage/runtime/validation.key has been&#xA;  deprecated. Copy its value to the “securityKey” config setting in&#xA;  config/general.php.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To which I assumed I should just add 'securityKey' =&gt; 'xxxxxx', but the error hasn't gone. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The second error is:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The environmentVariables config setting has been renamed to aliases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which to be honest im not sure how to fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? &lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2018-05-29T11:47:25.920" Title="Issue upgrading Craft 2 to 3" Tags="&lt;error-message&gt;&lt;craft3&gt;&lt;error&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23710" PostTypeId="1" AcceptedAnswerId="23751" CreationDate="2018-02-01T13:21:54.793" Score="4" ViewCount="5730" Body="&lt;p&gt;Does anybody successfully implemented a language switch run Craft 3? Trying the Craft 2 variant slightly adjusted but still running into issues: Invalid site handle: nl&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% set otherLocales = craft.app.i18n.siteLocaleIds|without(craft.locale) %}&#xA;{% for locale in otherLocales %}&#xA;   {% set localeEntry = craft.entries.id(entry.id).locale(locale).one() %}&#xA;    {#  set localeCategory = craft.categories.group('worksCat').locale(locale).first #}&#xA;    {% if localeEntry.locale is defined and localeEntry.locale == locale %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ localeEntry.getUrl() }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;/{{ craft.app.i18n.getLocaleById(locale) }}.svg&quot;  {{ craft.app.i18n.getLocaleById(locale).nativeName }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% else %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ localeCategory.getUrl() }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;/{{ craft.app.i18n.getLocaleById(locale) }}.svg&quot; &amp;gt; {{ craft.app.i18n.getLocaleById(locale).nativeName }}&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="57" LastEditDate="2018-02-05T20:03:05.347" LastActivityDate="2019-08-24T20:37:36.637" Title="Craft 3 language switcher" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23711" PostTypeId="2" ParentId="19371" CreationDate="2018-02-01T15:25:50.903" Score="3" Body="&lt;p&gt;Picking this up with another project, it looks like the problem was me not specifying a template path as the 'setPasswordPath' config setting. Instead, I was passing a route. I was doing this because I wanted to use the same password template to handle everything to do with passwords. This isn't possible, by the looks of it, because the controller is looking for the existence of a file (as opposed to a template being returned from a route or URI).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as I changed it to a strict template path everything worked fine, and the following line in UsersController.php no longer returns false:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;templates-&amp;gt;doesTemplateExist($templatePath))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this is solved.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-02-01T15:25:50.903" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23712" PostTypeId="1" AcceptedAnswerId="23735" CreationDate="2018-02-01T15:45:02.997" Score="1" ViewCount="97" Body="&lt;p&gt;Not every item in my store is available to buy online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to classify these items in Craft Commerce?&#xA;(So that the 'Buy' button can be swapped for 'Enquire')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are multiple product categories this applies to.&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-02-02T23:23:17.003" Title="Best way to define non-purchasable products?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23713" PostTypeId="2" ParentId="23708" CreationDate="2018-02-01T18:17:12.727" Score="1" Body="&lt;p&gt;Craft CMS does absolutely nothing to your front end code, and there's literally nothing in Craft that would make anchor links – i.e. &lt;code&gt;&amp;lt;a href=&quot;/tabs#anchor1&quot;&amp;gt;Click&amp;lt;/a&amp;gt;&lt;/code&gt; – in your front end markup behave in any other way than normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is probably somewhere in your front end code (either in your Twig/markup or possibly in your JavaScript).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-02-01T18:17:12.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23714" PostTypeId="2" ParentId="23440" CreationDate="2018-02-01T19:07:04.920" Score="8" Body="&lt;p&gt;So as of &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#300-rc7---2018-01-23&quot; rel=&quot;noreferrer&quot;&gt;Craft CMS 3 RC7&lt;/a&gt;, they added a new &lt;code&gt;alias()&lt;/code&gt; Twig function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you can do is something like this in your &lt;code&gt;general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;    '@basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH'),&#xA;    '@baseUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or whatever/however you want to set them). These aliases can be used in sites’ Base URL settings, volumes’ Base URL settings, and Local volumes’ File System Path settings in the AdminCP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then in your templates, you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ alias('@baseUrl') }}&#xA;{{ alias('@baseUrl/assets/img/' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To resolve the alias there. I changed &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment&quot; rel=&quot;noreferrer&quot;&gt;Craft 3 Multi-Environment&lt;/a&gt; to leverage aliases in this way (rather than having them in the &lt;code&gt;.custom&lt;/code&gt; config), and it's documented in detail in the &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment#asset-volumes-and-aliases&quot; rel=&quot;noreferrer&quot;&gt;Asset Volumes and Aliases&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do not need to be using Craft 3 Multi-Environment to utilize them in the same way, this is just a live example that's handy to point to.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2018-02-01T19:17:55.277" LastActivityDate="2018-02-01T19:17:55.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23715" PostTypeId="2" ParentId="23701" CreationDate="2018-02-01T23:22:56.050" Score="0" Body="&lt;p&gt;You can find what is putting those emails in SPAM (your email client, SPAM software on your email server, etc.) and white-list the Freeform emails by email address, subject, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, there are some great tips here (DKIM, SPF, etc.) you can use to help ensure reliably email delivery through code that lessens the chances of SPAM filters thinking the email is SPAM in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-01T23:22:56.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23716" PostTypeId="2" ParentId="23700" CreationDate="2018-02-01T23:33:04.813" Score="0" Body="&lt;p&gt;It appears those emails are being generated by something called &lt;a href=&quot;https://www.interserver.net/tips/kb/disable-lfd-excessive-resource-usage-alert/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Config Server Firewall&lt;/a&gt; running on your server.  I don't know if your host gives you access to configure settings in it, but it looks like they have allocated you 512M of memory and you're exceeding that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can hit that easy enough with image transforms and spikes/surges in traffic can amplify that effect.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-01T23:33:04.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23717" PostTypeId="2" ParentId="23709" CreationDate="2018-02-01T23:41:25.020" Score="2" Body="&lt;p&gt;Those aren't so much errors as deprecation messages, meaning you should fix them sometime before Craft 4 comes out where they'll be going away and become real errors for you. :)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To which I assumed I should just add 'securityKey' =&gt; 'xxxxxx', but the error hasn't gone.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They won't go away automatically.  Go to &lt;code&gt;yoursite.com/admin/utilities/deprecation-errors&lt;/code&gt;, then you can click the &quot;x&quot; for the message on the far right to clear it.  It won't come back again if it has been fixed.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The environmentVariables config setting has been renamed to aliases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You'll want to convert your old environmentVariable to use the new aliases syntax.  You can see examples of that here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/configuration.html#aliases&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/configuration.html#aliases&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="258" LastEditDate="2018-05-29T11:47:25.920" LastActivityDate="2018-05-29T11:47:25.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23719" PostTypeId="2" ParentId="23476" CreationDate="2018-02-02T10:28:35.187" Score="0" Body="&lt;p&gt;I solved this by updating my dev environment. I was running into these queue issues on my local vagrant setup and it was simply running so slow and timing out on each request for some reason. This was even with the suggested settings changed and checked as per &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt; (I blame the substandard laptop work have given me which grinds.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've moved the system to a much better solution (GCP Instance) and the queue cleared in no time! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, no one else experiences this but this was what solved it for me so thought I best share.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help in the mean time though.&lt;/p&gt;&#xA;" OwnerUserId="7857" LastActivityDate="2018-02-02T10:28:35.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23720" PostTypeId="1" AcceptedAnswerId="23724" CreationDate="2018-02-02T12:53:49.147" Score="1" ViewCount="2329" Body="&lt;p&gt;I am struggling with the definition of CRAFT_BASE_PATH and CRAFT_VENDOR_PATH in web/index.php:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My absolute URLs are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/home/xxx/public_html/craft/ (not publicly accessible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;home/xxx/public_html/web/ (publicly accessible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2018-02-02T15:14:59.670" Title="Craft 3: Struggling with CRAFT_BASE_PATH and CRAFT_VENDOR_PATH" Tags="&lt;config&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23721" PostTypeId="1" AcceptedAnswerId="23723" CreationDate="2018-02-02T13:00:56.103" Score="3" ViewCount="566" Body="&lt;p&gt;I want to do something similar to &lt;a href=&quot;https://craftcms.stackexchange.com/a/14526/6844&quot;&gt;this&lt;/a&gt; answer but for Craft 3 (eg. render some custom HTML in the Entry editing screen). I can't work out how to do this with the changed Craft 3 hooks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should this be registered as an event now? What class/event ID should I be using to add code to &lt;code&gt;cp.entries.edit.details&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm new to Craft plugin dev so a little unclear how to proceed here)&lt;/p&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2018-02-02T14:44:43.060" Title="Writing a plugin that triggers on a Control Panel Template Hook?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23722" PostTypeId="1" AcceptedAnswerId="23788" CreationDate="2018-02-02T14:27:38.877" Score="1" ViewCount="164" Body="&lt;p&gt;I have a asset field where I would like to save the images in dynamic folders.&#xA;The upload folder should be parsed for the Dropdown field values in a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a normal Dropdown field it works with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.dropdownFieldHandle }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but for a Dropdown field in a Matrix field i can't get it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is very appreciated. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="6061" LastEditorUserId="57" LastEditDate="2018-02-02T23:02:53.667" LastActivityDate="2018-02-09T12:49:09.010" Title="Dynamic asset subfolder path for Craft Commerce" Tags="&lt;assets&gt;&lt;plugin-craftcommerce&gt;&lt;upload&gt;&lt;subfolder&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23723" PostTypeId="2" ParentId="23721" CreationDate="2018-02-02T14:44:43.060" Score="5" Body="&lt;p&gt;Figured it out after browsing some existing plugins' source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook('cp.entries.edit.details', function(array &amp;amp;$context) {&#xA;    return '&amp;lt;a href=&quot;#&quot; class=&quot;btn&quot;&amp;gt;My Button!&amp;lt;/a&amp;gt;';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2018-02-02T14:44:43.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23724" PostTypeId="2" ParentId="23720" CreationDate="2018-02-02T15:14:59.670" Score="3" Body="&lt;p&gt;You should almost never have to change these from the default settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is make sure your webserver points to your server root properly (in your case, &lt;code&gt;/home/xxx/public_html/web/&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default Craft 3 install has &lt;code&gt;web/&lt;/code&gt; as the server root, with Craft and all of it's files/folders in the root directory. If you don't change anything, the &lt;code&gt;index.php&lt;/code&gt; that ships with Craft will &quot;just work&quot; once you've pointed the webserver at the web root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, it sounds like you're saying that you've moved all of Craft into a &lt;code&gt;craft/&lt;/code&gt; directory that sits alongside the &lt;code&gt;web/&lt;/code&gt; directory. Assuming you've moved &lt;em&gt;everything&lt;/em&gt; into that folder, you'd do something like this in your &lt;code&gt;index.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Project root path&#xA;$root = dirname(__DIR__).'/craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-02T15:14:59.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23725" PostTypeId="1" CreationDate="2018-02-02T17:42:38.103" Score="2" ViewCount="346" Body="&lt;p&gt;I want to assign a wildcard domain to every entry from a specific type. For instance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;client.example.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;client&lt;/code&gt; is the slug of an entry. Is that possible? If yes, how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7943" LastActivityDate="2021-02-25T16:13:08.810" Title="Wildcard subdomain for posts" Tags="&lt;routes&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23726" PostTypeId="2" ParentId="19248" CreationDate="2018-02-02T17:43:43.040" Score="2" Body="&lt;p&gt;In your plugin's &lt;code&gt;composer.json&lt;/code&gt;, add the service to &lt;code&gt;extra.components&lt;/code&gt; to make it available on the plugin instance. You should see the predefined service already listed there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might need to empty the vendor folder of your craft website and reinstall your composer dependencies as Craft appears to cache this information.&lt;/p&gt;&#xA;" OwnerUserId="5710" LastActivityDate="2018-02-02T17:43:43.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23727" PostTypeId="1" CreationDate="2018-02-02T19:31:46.367" Score="1" ViewCount="97" Body="&lt;p&gt;Is there a way to manually change the URI for an entry?&#xA;for instance where is this stored in the database (is it?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to update one that is: &lt;code&gt;/vacancies&lt;/code&gt;  to &lt;code&gt;/vacancies-1444&lt;/code&gt; for example&#xA;the 1444 never got added to the URI when created by an API entry creation and &lt;code&gt;/vacancies&lt;/code&gt; is the root of a list of vacancies.&lt;/p&gt;&#xA;" OwnerUserId="6790" LastEditorUserId="57" LastEditDate="2018-02-02T22:51:05.037" LastActivityDate="2018-05-04T00:32:39.463" Title="How can I manually update the URI of an entry?" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23728" PostTypeId="1" AcceptedAnswerId="23755" CreationDate="2018-02-02T19:48:19.953" Score="2" ViewCount="274" Body="&lt;p&gt;After running composer and then initiating craft setup I keep getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Username: [admin]&#xA;Email: abc@test.com&#xA;Password:&#xA;Confirm:&#xA;Site name: test&#xA;Site URL: test.com&#xA;Site language: [en-US]&#xA;Installing Craft...&#xA;&#xA;Exception 'craft\errors\MigrationException' with message 'An error occurred while executing the &quot;craft\migrations\Install migration: Error while sending QUERY packet. PID=25472'&#xA;&#xA;in /vendor/craftcms/cms/src/db/MigrationManager.php:267&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My MySQL version is 5.7.18-0ubuntu0.16.04.1.&lt;/p&gt;&#xA;" OwnerUserId="5407" LastEditorUserId="57" LastEditDate="2018-02-02T21:14:55.900" LastActivityDate="2018-02-05T16:26:59.053" Title="Craft 3 Ubuntu installation error via composer setup" Tags="&lt;mysql&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23731" PostTypeId="2" ParentId="23727" CreationDate="2018-02-02T22:53:32.180" Score="1" Body="&lt;p&gt;For most cases, it should be as simple as updating the slug for that entry to &lt;code&gt;vacancies-1444&lt;/code&gt; on the entry edit page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is assuming it's not in a Structured Section and you haven't defined some custom URI rules where the last segment of the URI isn't &lt;code&gt;{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-02T22:53:32.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23732" PostTypeId="2" ParentId="19275" CreationDate="2018-02-02T22:59:50.077" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Backup your DB.&lt;/li&gt;&#xA;&lt;li&gt;I updated the CMS on my live site to the newest version. &lt;/li&gt;&#xA;&lt;li&gt;download the newest version of Craft and replace &lt;code&gt;craft/app&lt;/code&gt; with the new &lt;code&gt;craft/app&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7445" LastEditorUserId="5557" LastEditDate="2018-02-12T15:48:42.797" LastActivityDate="2018-02-12T15:48:42.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23733" PostTypeId="2" ParentId="23722" CreationDate="2018-02-02T23:05:37.977" Score="2" Body="&lt;p&gt;If you have an Asset field outside of Matrix and you want to set its &quot;Upload Location&quot; to be a dynamic value of Dropdown field inside of a separate Matrix field, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.matrixFieldHandle.type('matribBlockHandleTheFieldLivesIn').first().dropdownFieldHandle.value }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-02-07T02:21:57.173" LastActivityDate="2018-02-07T02:21:57.173" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23734" PostTypeId="2" ParentId="23725" CreationDate="2018-02-02T23:11:04.110" Score="3" Body="&lt;p&gt;It’s definitely possible. Here’s the gist:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Forget the whole subdomain idea, and start by getting everything working using a URI format like &lt;code&gt;/client/&amp;lt;slug&amp;gt;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Make all subdomain traffic get routed to the same server/virtual host.&lt;/li&gt;&#xA;&lt;li&gt;Make Craft &lt;em&gt;think&lt;/em&gt; that subdomain requests actually had a URI in the format of &lt;code&gt;/client/&amp;lt;slug&amp;gt;&lt;/code&gt;, so it will route the request the way it did in step 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How you go about the second step depends on whether you’re on Nginx or Apache.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For &lt;strong&gt;Nginx&lt;/strong&gt;, add &lt;code&gt;default_server&lt;/code&gt; to the server config’s &lt;code&gt;listen&lt;/code&gt; directive:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen 80 default_server;&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For &lt;strong&gt;Apache&lt;/strong&gt;, create a &lt;a href=&quot;http://httpd.apache.org/docs/2.0/vhosts/examples.html#default&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;_default_&lt;/code&gt; virtual host definition&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost _default_:*&amp;gt;&#xA;    // ...&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Exact details depend on your hosting environment so you may need to do some of your own googling here. You’ll likely need to restart the webserver before changes take effect, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have all subdomain traffic routing to the same place, add something like this to your index.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$domainParts = explode('.', $_SERVER['HTTP_HOST']);&#xA;&#xA;if (count($domainParts) === 3)&#xA;{&#xA;    $slug = $domainParts[0];&#xA;&#xA;    // Fake Craft into thinking the URI was actually /clients/&amp;lt;SLUG&amp;gt;/uri/...&#xA;&#xA;    // Nginx:&#xA;    $_REQUEST['REQUEST_URI'] = &quot;/clients/$slug&quot;.($_REQUEST['REQUEST_URI'] ?? '');&#xA;&#xA;    // Apache:&#xA;    $_GET['p'] = &quot;clients/$slug/&quot;.($_GET['p'] ?? '');&#xA;}&#xA;&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place, your &lt;code&gt;client.domain.tld&lt;/code&gt; requests should start serving those client entry pages!&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-02-02T23:11:04.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23735" PostTypeId="2" ParentId="23712" CreationDate="2018-02-02T23:23:17.003" Score="1" Body="&lt;p&gt;We use either booleans (i.e. switches) or dropdowns for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have, e.g. an &lt;code&gt;availableForSale&lt;/code&gt; boolean we check in our template logic.  We have a sort of 'main' tab for these critical product fields (and note you can also add such a field to your variants so that for variant products you can selectively enable/disable on a per variant basis).  In your case you might choose to have 3 options - Available For Sale, Enquiries Only, Not available.  Booleans make for nice simple looking template logic, but probably use values is a better way to go if you anticipate anything beyond basic available/not available complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(We use a similar but more complex field for shipping, which can be set to: Free Shipping, Can't Be Shipped, Post Shipping, Courier Only Shipping etc.  Although Commerce's now has it's own shipping category system you can and probably should use for that too, depending on how you implement your shipping).&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-02-02T23:23:17.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23736" PostTypeId="2" ParentId="4119" CreationDate="2018-02-03T00:32:30.733" Score="2" Body="&lt;p&gt;I had the problems that I used tabs in my plugins. In one of those tabs I save settings in general and in antoher tabs I save the FieldLayout. Here is the adapted method prepSettings()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function prepSettings($settings)&#xA;{&#xA;&#xA;    $postedFieldLayout = craft()-&amp;gt;request-&amp;gt;getParam('fieldLayout') ? craft()-&amp;gt;request-&amp;gt;getParam('fieldLayout') : array();&#xA;    $requiredFields = craft()-&amp;gt;request-&amp;gt;getParam('requiredFields') ? craft()-&amp;gt;request-&amp;gt;getParam('requiredFields') : array();&#xA;&#xA;    if($postedFieldLayout){&#xA;&#xA;        // Delete the old field layout&#xA;        craft()-&amp;gt;fields-&amp;gt;deleteLayoutsByType('Foo');&#xA;&#xA;        // Save the field layout&#xA;        $fieldLayout = craft()-&amp;gt;fields-&amp;gt;assembleLayout($postedFieldLayout, $requiredFields, true);&#xA;        $fieldLayout-&amp;gt;type = 'Foo';&#xA;        craft()-&amp;gt;fields-&amp;gt;saveLayout($fieldLayout);&#xA;    }&#xA;&#xA;    return $settings;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the controller you prefer&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldLayout = craft()-&amp;gt;fields-&amp;gt;getLayoutByType('Foo');&#xA;// dont foget to add'em as an parameter in renderLayout&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the model include&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getFieldLayout()&#xA;{&#xA;    return craft()-&amp;gt;fields-&amp;gt;getLayoutByType('Foo');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The content block in my tabs layout&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method='post' action='' accept-charset='UTF-8' data-saveshortcut data-confirm-unload&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type='hidden' name='action' value='plugins/savePluginSettings'&amp;gt;&#xA;    &amp;lt;input type='hidden' name='pluginClass' value='FooPluginClass'&amp;gt;&#xA;&#xA;    &amp;lt;section id='fields'&amp;gt;&#xA;        {% include &quot;_includes/fieldlayoutdesigner&quot; with {&#xA;            fieldLayout: fieldLayout&#xA;        } only %}&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;     &amp;lt;div class='buttons'&amp;gt;&#xA;        &amp;lt;input class='btn submit' type='submit' value='{{ 'Save'|t }}'&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6225" LastActivityDate="2018-02-03T00:32:30.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23737" PostTypeId="1" CreationDate="2018-02-03T04:42:18.307" Score="1" ViewCount="36" Body="&lt;p&gt;I've been getting annoyed at one small problem I can't solve with the Craft Shortlist Plugin. It seems that I have got everything to work but no matter what I do, the {{ item.title }} just won't display the entry title that was added the list the default list.&#xA;All the functionality seems to be working no problem but I just simply can't get the item title to appear.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Code Used to display my list&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lists = craft.shortlist.lists %}&#xA;&#xA;{% if lists is empty %}&#xA;    &amp;lt;p&amp;gt;You have no lists at the moment.&amp;lt;/p&amp;gt;&#xA;{% else %}&#xA;&#xA;{% for list in lists %}&#xA;    &amp;lt;h1&amp;gt;{{ list.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% if list.items is empty %}&#xA;        &amp;lt;p&amp;gt;This list is empty&amp;lt;/p&amp;gt;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for item in list.items %}&#xA;                &amp;lt;p&amp;gt;{{ item.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ item.removeActionUrl }}&quot;&amp;gt;remove&amp;lt;/a&amp;gt;&#xA;                {{ item.id }} &amp;lt;strong&amp;gt;{{ item.title }}&amp;lt;/strong&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Code used to give my entries add and remove buttons&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('locations') %}&#xA;  {% set item = craft.shortlist.item(entry.id) %}&#xA;  &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;  {% if item.inList %}&#xA;      &amp;lt;a href=&quot;{{ item.removeActionUrl }}&quot;&amp;gt;Remove from Favourites&amp;lt;/a&amp;gt;&#xA;  {% else %}&#xA;      &amp;lt;a href=&quot;{{ item.addActionUrl }}&quot;&amp;gt;Add to Favourites&amp;lt;/a&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would really appreaciate the help on this one so let me know if more detail is needed.&lt;/p&gt;&#xA;" OwnerUserId="6338" LastEditorUserId="5557" LastEditDate="2018-02-03T07:08:27.357" LastActivityDate="2018-02-03T07:08:27.357" Title="Shortlist plugin item title not showing" Tags="&lt;entries&gt;&lt;plugin-shortlist&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23738" PostTypeId="1" AcceptedAnswerId="23739" CreationDate="2018-02-03T15:19:56.787" Score="3" ViewCount="1651" Body="&lt;p&gt;With v2 of the Element API plugin, I'm having issues with working out how to return entries that are in a particular category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the slug in the API route but can't work out what the query should be in the transformer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I be doing this query in a total different way?  I keep thinking I've just gone down the wrong way to do it completely.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v1/category/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'elementsPerPage' =&amp;gt; 30,&#xA;            'criteria' =&amp;gt; [&#xA;              'section' =&amp;gt; 'posts',&#xA;              'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; ***category slug($slug)***],&#xA;            ],&#xA;            'transformer' =&amp;gt; function(Entry $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'id' =&amp;gt; (int) $entry-&amp;gt;id,&#xA;                    'slug' =&amp;gt; $entry-&amp;gt;slug,&#xA;                    'postDate' =&amp;gt; $entry-&amp;gt;postDate&#xA;                ];&#xA;            },&#xA;            'pretty' =&amp;gt; true&#xA;        ];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7872" LastEditorUserId="57" LastEditDate="2018-02-04T01:04:50.137" LastActivityDate="2018-02-04T01:04:50.137" Title="Element API display entries by category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23739" PostTypeId="2" ParentId="23738" CreationDate="2018-02-03T15:51:36.557" Score="2" Body="&lt;p&gt;Your &lt;code&gt;targetElement&lt;/code&gt; needs to be the category object or the ID of your category.&#xA;So if the id of your category is 5 you need&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; 5],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really want to be able to fetch your category by slug (which I would not suggest since your slug can be changed in the cp but the ID can't, if someone changes the slug by accident your entire logic will break) you can create an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; to search for the category with the slug and insert the object there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;slug = $slug; &#xA;$category = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And inside your array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-03T15:58:45.400" LastActivityDate="2018-02-03T15:58:45.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23740" PostTypeId="2" ParentId="12999" CreationDate="2018-02-03T23:51:58.447" Score="0" Body="&lt;pre&gt;&lt;code&gt;public function runStep($step)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the $step starts from 0 btw&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And be sure to return true in all tasks, if everything works fine&lt;/p&gt;&#xA;" OwnerUserId="6225" LastActivityDate="2018-02-03T23:51:58.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23741" PostTypeId="1" AcceptedAnswerId="23742" CreationDate="2018-02-03T23:57:54.040" Score="1" ViewCount="593" Body="&lt;p&gt;Can any help simplify this js/twig code? The code links to some tabs that show floorplans of the property being sold. The specified aria-controls refers to a supertable field called &lt;code&gt;floorLevel&lt;/code&gt; that has the &lt;code&gt;loop.index&lt;/code&gt; included, so for example if I put &lt;code&gt;[aria-controls='{{ row.floorLevel }}{{ loop.index }}']&lt;/code&gt; it would output those names. I got it working so that when the user clicks on the tab it also changes the separate information about the measurements, but I couldn’t find of a less manual way of doing it, but I’m sure there must be an easier way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ukiMX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ukiMX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includejs %}&#xA;{% for row in entry.floorplans.limit(1) %}&#xA;$( &quot;[aria-controls='groundFloor1']&quot; ).on( &quot;click&quot;, function() {&#xA;  $( &quot;#dimsTarget1&quot; ).addClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget2&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget3&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget4&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget5&quot; ).removeClass( &quot;is-active&quot; );&#xA;});&#xA;{% endfor %}&#xA;{% for row in entry.floorplans.limit(1) %}&#xA;$( &quot;[aria-controls='firstFloor2']&quot; ).on( &quot;click&quot;, function() {&#xA;  $( &quot;#dimsTarget2&quot; ).addClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget1&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget3&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget4&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget5&quot; ).removeClass( &quot;is-active&quot; );&#xA;});&#xA;{% endfor %}&#xA;{% for row in entry.floorplans.limit(1) %}&#xA;$( &quot;[aria-controls='secondFloor3']&quot; ).on( &quot;click&quot;, function() {&#xA;  $( &quot;#dimsTarget3&quot; ).addClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget1&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget2&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget4&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget5&quot; ).removeClass( &quot;is-active&quot; );&#xA;});&#xA;{% endfor %}&#xA;{% for row in entry.floorplans.limit(1) %}&#xA;$( &quot;[aria-controls='thirdFloor4']&quot; ).on( &quot;click&quot;, function() {&#xA;  $( &quot;#dimsTarget4&quot; ).addClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget1&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget2&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget3&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget5&quot; ).removeClass( &quot;is-active&quot; );&#xA;});&#xA;{% endfor %}&#xA;{% for row in entry.floorplans.limit(1) %}&#xA;$( &quot;[aria-controls='basement5']&quot; ).on( &quot;click&quot;, function() {&#xA;  $( &quot;#dimsTarget5&quot; ).addClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget1&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget2&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget3&quot; ).removeClass( &quot;is-active&quot; );&#xA;  $( &quot;#dimsTarget4&quot; ).removeClass( &quot;is-active&quot; );&#xA;});&#xA;{% endfor %}&#xA;{% endincludejs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5975" LastActivityDate="2018-02-04T00:46:54.913" Title="Simplify Twig/JS loop code" Tags="&lt;templating&gt;&lt;loop&gt;&lt;includejs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23742" PostTypeId="2" ParentId="23741" CreationDate="2018-02-04T00:35:11.893" Score="4" Body="&lt;p&gt;You can select elements by class and give your html elements custom data attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this is your clickable html element with the corresponding div&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;button data-id=&quot;dimsTarget4&quot; class=&quot;myButton&quot;&amp;gt;&#xA;&amp;lt;div class=&quot;myContainer&quot; id=&quot;dimsTarget4&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your jquery could be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.myButton').click(function(){&#xA;    var containerId = $(this).data('id');&#xA;    $('.myContainer').removeClass( &quot;is-active&quot; );&#xA;    $('#'+containerId).addClass( &quot;is-active&quot; );&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that's basically it. You'll remove the class from all your divs and add it to the one specified in your &lt;code&gt;data-id&lt;/code&gt; attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't need any twig elements in your JavaScript (which is much better) and define everything in your twig template. That way your Javascript will behave independently. When you change your html you won't need to change your Javascript that much and you can reuse the code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I just used the button as an example. You can insert whatever class name or html element you like. Since you didn't mention the structure of your html I decided to use a button &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-04T00:46:54.913" LastActivityDate="2018-02-04T00:46:54.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23743" PostTypeId="1" AcceptedAnswerId="23744" CreationDate="2018-02-04T04:35:15.820" Score="1" ViewCount="225" Body="&lt;p&gt;I'm stuck on implementing AMP templates with category-based URLs as I can't find a way to route the different entry types in the Routes function in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel title Articles that has two entry types (Lists and Articles) with a URL format &lt;code&gt;{businessCategory.first.slug}/{slug}&lt;/code&gt; that uses a primary category for the first segment of the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried &lt;code&gt;*/slug/amp&lt;/code&gt; as a route in the CP but then I can't change the AMP template for each entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7949" LastEditorUserId="57" LastEditDate="2018-02-04T06:22:05.363" LastActivityDate="2018-02-04T06:22:05.363" Title="Setting up routes for AMP template with category-based urls" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23744" PostTypeId="2" ParentId="23743" CreationDate="2018-02-04T05:09:49.943" Score="1" Body="&lt;p&gt;You don't strictly need to change the AMP template for each entry type; you can just load the entry in your AMP template via the slug in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out how I did it here: &lt;a href=&quot;https://nystudio107.com/blog/google-amp-should-you-care#implementing-amp-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Implementing AMP in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-04T05:09:49.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23745" PostTypeId="2" ParentId="23641" CreationDate="2018-02-04T08:54:19.267" Score="0" Body="&lt;p&gt;This works for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set showCol1 = false %}&#xA;{% set showCol2 = false %}&#xA;{% set showCol3 = false %}&#xA;{% set showCol4 = false %}&#xA;{% set showCol5 = false %}&#xA;&#xA;&#xA;{% for row in entry.fieldname %}&#xA;{% if row.col1|length %}{% set showCol1 = true %}{% endif %}&#xA;{% if row.col2|length %}{% set showCol2 = true %}{% endif %}&#xA;{% if row.col3|length %}{% set showCol3 = true %}{% endif %}&#xA;{% if row.col4|length %}{% set showCol4 = true %}{% endif %}&#xA;{% if row.col5|length %}{% set showCol5 = true %}{% endif %}&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;table&amp;gt;&#xA;&amp;lt;thead&amp;gt;&#xA;    &amp;lt;tr&amp;gt;&#xA;        {% if showCol1 %}&amp;lt;th&amp;gt;Col 1&amp;lt;/th&amp;gt;{% endif %}&#xA;        {% if showCol2 %}&amp;lt;th&amp;gt;Col 2&amp;lt;/th&amp;gt;{% endif %}&#xA;        {% if showCol3 %}&amp;lt;th&amp;gt;Col 3&amp;lt;/th&amp;gt;{% endif %}&#xA;        {% if showCol4 %}&amp;lt;th&amp;gt;Col 4&amp;lt;/th&amp;gt;{% endif %}&#xA;        {% if showCol5 %}&amp;lt;th&amp;gt;Col 5&amp;lt;/th&amp;gt;{% endif %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;&amp;lt;/thead&amp;gt;&#xA;{% for row in entry.fieldname %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        {% if showCol1 %}&amp;lt;td&amp;gt;{{ row.col1 }}&amp;lt;/td&amp;gt;{% endif %}&#xA;        {% if showCol2 %}&amp;lt;td&amp;gt;{{ row.col2 }}&amp;lt;/td&amp;gt;{% endif %}&#xA;        {% if showCol3 %}&amp;lt;td&amp;gt;{{ row.col3 }}&amp;lt;/td&amp;gt;{% endif %}&#xA;        {% if showCol4 %}&amp;lt;td&amp;gt;{{ row.col4 }}&amp;lt;/td&amp;gt;{% endif %}&#xA;        {% if showCol5 %}&amp;lt;td&amp;gt;{{ row.col5 }}&amp;lt;/td&amp;gt;{% endif %}&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2018-02-04T08:54:19.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23746" PostTypeId="1" CreationDate="2018-02-04T13:52:30.463" Score="1" ViewCount="86" Body="&lt;p&gt;Is there a way to choose the font family in rich text field? I want to have the option to choose from 2 or 3 font families in the rich text field. Is that possible in craft?&lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-02-04T13:57:28.457" Title="Font family choice in rich text" Tags="&lt;richtext&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23747" PostTypeId="2" ParentId="23746" CreationDate="2018-02-04T13:57:28.457" Score="4" Body="&lt;p&gt;That depends on the RTE you're using and what kind of features it supports. With the default Redactor, it should be possible via the configs in craft/config/redactor/ folder.&#xA;Peronally I don't think a content-editor should have that ability. This should be handled with classes or different fields/elements. They can really mess up your site.&lt;/p&gt;&#xA;" OwnerUserId="7950" LastActivityDate="2018-02-04T13:57:28.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23748" PostTypeId="2" ParentId="22312" CreationDate="2018-02-04T17:48:54.703" Score="1" Body="&lt;p&gt;The answer by &lt;a href=&quot;https://craftcms.stackexchange.com/users/3535/tom-bauer&quot;&gt;Tom Bauer &lt;/a&gt;given to my question &lt;a href=&quot;https://craftcms.stackexchange.com/a/16999/5307&quot;&gt;here&lt;/a&gt; should be of help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not far off. You need to set a variable and count the blocks in your neo loop. Then use if statements in the loop depending on the counter variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is you add a columnWidth dropdown field, and give them the option to choose between 2 or 3, the values are the css (2=col-sm-6, 3=col-sm-4.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your code code look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block blockContent %}    &#xA;{% for block in entry.body %}&#xA;{% switch block.type.handle %}&#xA;{% case 'serviceItem' %}&#xA;&#xA;&amp;lt;div class=&quot;{{ block.columnWidth }} margin-20 wow fadeInUp&quot; data-wow-delay=&quot;0.4s&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;text-center margin-20&quot;&amp;gt;&amp;lt;i class=&quot;fa {{ block.mainTitle }} fa-4x black&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&#xA;  {{ block.text }}&#xA;  &amp;lt;a class=&quot;more&quot; href=&quot;#&quot;&amp;gt;LEARN MORE&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endswitch %}&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5307" LastActivityDate="2018-02-04T17:48:54.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23749" PostTypeId="1" AcceptedAnswerId="23750" CreationDate="2018-02-05T02:33:23.117" Score="1" ViewCount="166" Body="&lt;p&gt;In Craft 3, one of my 'User' fields is an assets type field with one selectable asset ('profilePicture').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have routing setup to load my template when a url looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.com/person/firstname-lastname&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template I am getting the appropriate user with: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set secondSegment = craft.request.getSegment(2) %}&#xA;&#xA;{% set people = craft.users.group('family') %}&#xA;&#xA;{% for person in people %}&#xA;    {% set personName = person.firstName|lower ~ &quot;-&quot; ~ person.lastName|lower %}&#xA;    {% if secondSegment == personName %}&#xA;        {% set currentUser = person %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All that works - I can query most fields, but I can't work out how to get my asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.myTextField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;None of these work (returns nothing and no error):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.profilePicture[0].url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = currentUser.profilePicture.first() %}&#xA;&#xA;{% if asset %}&#xA;    {{ asset.getUrl }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in currentUser.profilePicture %}&#xA;    {{ asset.getUrl }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="567" LastActivityDate="2018-02-05T09:10:34.867" Title="How to return asset from custom user field" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23750" PostTypeId="2" ParentId="23749" CreationDate="2018-02-05T09:10:34.867" Score="1" Body="&lt;p&gt;You have to make sure you enabled the option &lt;code&gt;Assets in this volume have public urls&lt;/code&gt; in your volume settings at &lt;code&gt;/admin/settings/assets/volumes/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This checkbox is disabled by default thus your &lt;code&gt;getUrl()&lt;/code&gt; function will always return an empty string/null.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-05T09:10:34.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23751" PostTypeId="2" ParentId="23710" CreationDate="2018-02-05T09:29:43.837" Score="14" Body="&lt;p&gt;The concept of localization has changed in Craft 3, there are not only &lt;code&gt;locales&lt;/code&gt; anymore - now you have different sites and site groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example without multisite - only different locals&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get all available sites for an entry with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set supportedSites = entry.getSupportedSites %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return you an array of all supported sites for the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for siteForEntry in entry.getSupportedSites %}&#xA;    {# get the site #}&#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}&#xA;    {# check if it's the current site #}&#xA;    {% if site.id == entry.siteId %}&#xA;        active site = {{ site.id }} {{ site.language }} &#xA;    {% else %}&#xA;        {# if it's not the current site, get the entry for this site #}&#xA;        {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;        link to site with id {{ entryForOtherSite.siteId }} &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ site.language }} - {{ entryForOtherSite.title }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you take a look at your &lt;code&gt;/admin/utilities/deprecation-errors&lt;/code&gt; you'll see many records because all your &lt;code&gt;locale&lt;/code&gt; functions will do this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function locale(string $value)&#xA;{&#xA;    Craft::$app-&amp;gt;getDeprecator()-&amp;gt;log('ElementQuery::locale()', 'The “locale” element query param has been deprecated. Use “site” or “siteId” instead.');&#xA;    $this-&amp;gt;site($value);&#xA;&#xA;    return $this;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They tell you: &quot;This function is deprecated, use &quot;site&quot; instead&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example with multisite - different sites and locales&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are going to have multiple different sites with multiple locales you can manage each site in one group and insert all the locales for these sites in each group. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- Site group A&#xA;    - language A (siteId 1)&#xA;    - Language B (siteId 2)&#xA;- Site group B&#xA;    - Language A (siteId 3)&#xA;    - Language C (siteId 4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Example if the user is in site group A you want to show only language A and language B but not Language C even if the entry exists in all sites.&#xA;So you can grab the group of the current site and loop through all sites of the group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentSite = craft.app.sites.currentSite %}&#xA;{% for siteInGroup in currentSite.getGroup.getSites() %}&#xA;    {% if siteInGroup.id == entry.siteId %}&#xA;        active site = {{ siteInGroup.id }}{{ siteInGroup.language }}&#xA;    {% else %}&#xA;        {% set entryForOtherSite = craft.entries.id(entry.id).site(siteInGroup).one() %}&#xA;        link to site {{ entryForOtherSite.siteId }} &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ siteInGroup.language }} - {{ entryForOtherSite.title }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-05T16:12:08.620" LastActivityDate="2018-02-05T16:12:08.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23752" PostTypeId="1" AcceptedAnswerId="23764" CreationDate="2018-02-05T09:52:34.903" Score="4" ViewCount="1036" Body="&lt;p&gt;I have setup a Craft 3 multi-site with the following configuration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vR8NL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vR8NL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what I really want is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A3L1R.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A3L1R.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I want to have a 'default' &lt;strong&gt;&lt;a href=&quot;http://localhost:8888&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888&lt;/a&gt;&lt;/strong&gt; so I can always &lt;strong&gt;redirect&lt;/strong&gt; to /en or /es based on the browser language, but I don't want to add it as a site in the CMS through the admin panel, because I end up with a third unwanted version &lt;strong&gt;for each entry&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the way to go?&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="57" LastEditDate="2018-02-05T20:06:36.220" LastActivityDate="2018-02-06T15:52:56.117" Title="Craft 3 Multi-site with no &quot;default&quot; site" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23753" PostTypeId="1" CreationDate="2018-02-05T14:58:43.240" Score="1" ViewCount="220" Body="&lt;p&gt;We launched a site for a scientific publication and they use subscript and superscript in lots of their content. Now they'd like to use in entry titles too..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can set the entry title to be a custom field, but that field would be a rich text field in this case, which is far far far from ideal for a title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this plugin to add sub/superscript &lt;a href=&quot;https://github.com/elliotlewis/Redactor-Extras&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/elliotlewis/Redactor-Extras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking to fix this without having to use a rich text field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers are greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2018-02-06T13:23:26.250" Title="Superscript in entry title" Tags="&lt;redactor&gt;&lt;titles&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23754" PostTypeId="2" ParentId="23753" CreationDate="2018-02-05T15:19:58.870" Score="1" Body="&lt;p&gt;You can create different Redactor Fields with different settings/plugins. The easiest solution would be to create a redactor field only with your sub/superscript options so users can only insert those 2 things and no other html elements (bold, italic and so on).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can search for an existing plugin or create your own to disable line breaks as well&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-05T15:19:58.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23755" PostTypeId="2" ParentId="23728" CreationDate="2018-02-05T16:26:59.053" Score="2" Body="&lt;p&gt;[SOLVED] By upping wait_timeout from 10 to 100 in my.cnf - seems to have fixed the issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initial google searches for &quot;Error while sending QUERY packet&quot; led me to increase max_allowed_packet size, but this didn't fix the problem alone. &#xA;Note, I'm not sure if both timeout and packet size need to be increased or just timeout nevertheless I have increased both and it works now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another side note on my server setup, the server I had problem with was a default Vesta CP ubuntu/mysql configuration. I had no problem installing Craft 3 on a different ubuntu 16 configured by Serverpilot.io.&lt;/p&gt;&#xA;" OwnerUserId="5407" LastActivityDate="2018-02-05T16:26:59.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23756" PostTypeId="2" ParentId="23352" CreationDate="2018-02-05T16:39:14.897" Score="2" Body="&lt;p&gt;It looks like one of two things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its possible that you are not actually injecting your accesstokem with the following string&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'https://api.instagram.com/v1/tags/search?q=mnbasel&amp;amp;access_token={access-token}'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe it should be :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`https://api.instagram.com/v1/tags/search?q=mnbasel&amp;amp;access_token=${access-token}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you still get the oauth error, you may need to ensure that your access token has the correct scope in instagrams dev&lt;/p&gt;&#xA;" OwnerUserId="7953" LastActivityDate="2018-02-05T16:39:14.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23757" PostTypeId="2" ParentId="16833" CreationDate="2018-02-05T17:30:12.683" Score="1" Body="&lt;p&gt;The following is a very straightforward variable to put within your own plugin's variables/variables.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function getCommerceAddressById($id)&#xA;{&#xA;    return craft()-&amp;gt;commerce_addresses-&amp;gt;getAddressById($id);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case you use it to return just the addresses you need.&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="57" LastEditDate="2018-02-05T20:04:26.027" LastActivityDate="2018-02-05T20:04:26.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23758" PostTypeId="1" CreationDate="2018-02-05T17:58:43.740" Score="1" ViewCount="138" Body="&lt;p&gt;I'm beginning with Craft/Twig and am developing a plugin that gets data from a Restful XML feed, and I've successfully tested it on my template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below, I have the working plugin code and a sample of the XML structure.  The actual data feed will return anywhere from a few to several hundred 'INTELLCONT' nodes per user ('Record').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to improve readability, is it possible to paginate this feed data?  Would I implement it from the plugin (php) side or rather the (twig) template side?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I have so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;h1&amp;gt;test&amp;lt;/h1&amp;gt;&#xA;    {% set name_var = 'john-smith' %}&#xA;        {{ craft.aifeed.XmlVariable(name_var) }}   &#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP Code (plugin):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;    class AiFeedVariable&#xA;    {&#xA;            public function XmlVariable($optional = null)&#xA;        {&#xA;    $url = &quot;test_bb.xml&quot;;  &#xA;&#xA;    $xml = simplexml_load_file($url);&#xA;&#xA;    $xml-&amp;gt;registerXPathNamespace('a','http://www.digitalmeasures.com/schema/data');//&#xA;    $xml-&amp;gt;registerXPathNamespace('dmd','http://www.digitalmeasures.com/schema/data-metadata');&#xA;&#xA;    $secondary_user_id = $optional;&#xA;    $xml_report_abbrev_bb = $xml-&amp;gt;xpath('//a:Record[@username=&quot;'.$secondary_user_id.'&quot;]');&#xA;&#xA;    if($xml_report_abbrev_bb){&#xA;        echo '&amp;lt;br&amp;gt;CONTYPE is...'.$xml_report_abbrev_bb[0]-&amp;gt;INTELLCONT-&amp;gt;CONTYPE;&#xA;        echo '&amp;lt;br&amp;gt;termId is...'.$xml_report_abbrev_bb[0]['termId'].'&amp;lt;br&amp;gt;';&#xA;        echo '&amp;lt;br&amp;gt;surveyId is...'.$xml_report_abbrev_bb[0]-&amp;gt;attributes('dmd',true)['surveyId'].'&amp;lt;br&amp;gt;';&#xA;&#xA;        $dmd_fields = $xml_report_abbrev_bb[0]-&amp;gt;children('dmd',true);&#xA;&#xA;        echo '&amp;lt;br&amp;gt;dmd:IndexEntry is...'.$dmd_fields[0]-&amp;gt;attributes()['indexKey'].'&amp;lt;br&amp;gt;';&#xA;&#xA;&#xA;    } else {&#xA;        echo 'XPath query failed b';  &#xA;    }&#xA;&#xA;     }&#xA;    } &#xA;&#xA;&#xA;    ?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The XML file (test_bb.xml)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&#xA;&amp;lt;Data xmlns=&quot;http://www.digitalmeasures.com/schema/data&quot; xmlns:dmd=&quot;http://www.digitalmeasures.com/schema/data-metadata&quot; dmd:date=&quot;2012-01-03&quot;&amp;gt;&#xA;    &amp;lt;Record userId=&quot;148&quot; username=&quot;john-smith&quot; termId=&quot;4&quot; dmd:surveyId=&quot;12&quot;&amp;gt;&#xA;        &amp;lt;dmd:IndexEntry indexKey=&quot;D&quot; entryKey=&quot;Dylan&quot; text=&quot;Dylan&quot;/&amp;gt;&#xA;        &amp;lt;INTELLCONT id=&quot;14&quot; dmd:originalSource=&quot;54TEX&quot; dmd:lastModified=&quot;2017-04-18T10:54:29&quot; dmd:startDate=&quot;2011-01-01&quot; dmd:endDate=&quot;2011-12-31&quot;&amp;gt;&#xA;            &amp;lt;CONTYPE&amp;gt;Sales Tools&amp;lt;/CONTYPE&amp;gt;&#xA;            &amp;lt;CONTYPEOTHER&amp;gt;Sales History&amp;lt;/CONTYPEOTHER&amp;gt;&#xA;        &amp;lt;/INTELLCONT&amp;gt;&#xA;    &amp;lt;/Record&amp;gt;&#xA;&amp;lt;/Data&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="6879" LastEditDate="2018-02-06T17:18:05.207" LastActivityDate="2018-02-06T17:18:05.207" Title="Paginate Results from Restful XML Feed" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;php&gt;&lt;pagination&gt;&lt;xml&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23761" PostTypeId="1" CreationDate="2018-02-06T09:31:03.210" Score="3" ViewCount="1457" Body="&lt;p&gt;I have a question regarding how to set up Craft 3 RC8 to send e-mails through a corporate GMail account.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;My website's MX records are pointed at GMail through Cloudflare&lt;/li&gt;&#xA;&lt;li&gt;I tried setting this up when my website was on Craft 2.6. I set that up and my e-mail got blocked. I unblocked it through GSuite admin account and switched back to php.&lt;/li&gt;&#xA;&lt;li&gt;When sending through PHP mail, my e-mails get sent into spam.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So I need help on whether how to get my e-mails sent through GMail without my account getting banned, or how to make the e-mails sent through PHP not go into spam.&lt;/p&gt;&#xA;" OwnerUserId="7957" LastEditorUserId="7957" LastEditDate="2018-02-06T10:27:10.770" LastActivityDate="2018-11-19T21:10:22.970" Title="Setting up Craft's registration e-mails to be sent through GMail" Tags="&lt;craft3&gt;&lt;emails&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23762" PostTypeId="1" CreationDate="2018-02-06T11:47:09.243" Score="0" ViewCount="99" Body="&lt;p&gt;I've got a pretty complex relatedTo situation and I can't figure out if it's possible in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Admin users have a field called &quot;Admin Location&quot; which is a Category field type, and may have more than one Category selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regular users have a Matrix field called &quot;Property Applications&quot; which contains a sub-field of &quot;Property&quot; which is an Entry type. That Entry itself has a &quot;Property Location&quot; field - which is a Category field type with the same source categories as the Admin Location field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given admin user, who has their Admin Location field set to one or more locations, I want to list all Users who have a Property in that same location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This involves going through a Matrix, to an Entry, and then using the Entry's Category field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had tried this, but I am not getting results that I should if it were working as I wanted&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set adminLocation = currentUser.adminLocation %}&#xA;{% set users = craft.users.relatedTo({&#xA;    element: adminLocation,&#xA;    field: 'propertyApplications.property.propertyLocation'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-02-06T11:47:09.243" Title="Complex Relations" Tags="&lt;relations&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23763" PostTypeId="2" ParentId="23753" CreationDate="2018-02-06T13:23:26.250" Score="1" Body="&lt;p&gt;A simple option for you would just be to use unicode superscript characters in your &lt;code&gt;title&lt;/code&gt;s:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://jrgraphix.net/r/Unicode/2070-209F&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jrgraphix.net/r/Unicode/2070-209F&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://lingojam.com/SuperscriptGenerator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://lingojam.com/SuperscriptGenerator&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-06T13:23:26.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23764" PostTypeId="2" ParentId="23752" CreationDate="2018-02-06T13:26:46.457" Score="6" Body="&lt;p&gt;This can be done in 3 main steps.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Get the site subdirectories working&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First just get the &lt;code&gt;/en/&lt;/code&gt; and &lt;code&gt;/es/&lt;/code&gt; subdirectory working:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create &lt;code&gt;en/&lt;/code&gt; and &lt;code&gt;es/&lt;/code&gt; subfolders in your webroot&lt;/li&gt;&#xA;&lt;li&gt;Each subfolder should have its own &lt;code&gt;index.php&lt;/code&gt; file and &lt;code&gt;.htaccess&lt;/code&gt; file (if using Apache).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming you used the &lt;a href=&quot;https://github.com/craftcms/craft&quot; rel=&quot;noreferrer&quot;&gt;craftcms/craft&lt;/a&gt; project as a starting point, update the &lt;code&gt;define('CRAFT_BASE_PATH'...&lt;/code&gt; line in each of the &lt;code&gt;index.php&lt;/code&gt; files to:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__, 2));&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Update your English site’s Base URL to include the &lt;code&gt;/en/&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At this point, if you point your browser directly to &lt;code&gt;/en/&lt;/code&gt;, the English site should work as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Create a redirect script in the webroot’s index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create an &lt;code&gt;index.php&lt;/code&gt; file in your webroot (alongside the &lt;code&gt;en/&lt;/code&gt; and &lt;code&gt;es/&lt;/code&gt; subfolders). This script will be responsible for redirecting the request to the correct subfolder, based on the requested URI and language.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Bootstrap Craft -------------------------------------------------------------&#xA;&#xA;// Set path constants&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');&#xA;&#xA;// Load Composer's autoloader&#xA;require_once CRAFT_VENDOR_PATH.'/autoload.php';&#xA;&#xA;// Load dotenv?&#xA;if (file_exists(CRAFT_BASE_PATH.'/.env')) {&#xA;    (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&#xA;}&#xA;&#xA;// Load Craft (but don't run)&#xA;define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;/** @var \craft\web\Application $app */&#xA;$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';&#xA;&#xA;// Custom Logic ----------------------------------------------------------------&#xA;&#xA;// find a site language that matches the browser's requested language&#xA;$siteLanguages = $app-&amp;gt;i18n-&amp;gt;getSiteLocaleIds();&#xA;$language = $app-&amp;gt;request-&amp;gt;getPreferredLanguage($siteLanguages);&#xA;&#xA;// find the first site that uses that language&#xA;foreach ($app-&amp;gt;sites-&amp;gt;getAllSites() as $site) {&#xA;    if ($site-&amp;gt;language === $language) {&#xA;        // found it&#xA;        break;&#xA;    }&#xA;}&#xA;&#xA;// figure out where to redirect this request now&#xA;$url = (function() use ($app, $site) {&#xA;    $uri = $app-&amp;gt;request-&amp;gt;getPathInfo();&#xA;&#xA;    // see if we have an exact URI/language match&#xA;    if ($element = $app-&amp;gt;elements-&amp;gt;getElementByUri($uri, $site-&amp;gt;id, true)) {&#xA;        return $element-&amp;gt;getUrl();&#xA;    }&#xA;&#xA;    // see if we have an exact URI match in any other site&#xA;    foreach ($app-&amp;gt;sites-&amp;gt;getAllSites() as $otherSite) {&#xA;        if ($otherSite !== $site) {&#xA;            if ($otherSiteElement = $app-&amp;gt;elements-&amp;gt;getElementByUri($uri, $otherSite-&amp;gt;id, true)) {&#xA;                // found one! now see if the element is also available in the requested site&#xA;                if ($element = $otherSiteElement::find()-&amp;gt;id($otherSiteElement-&amp;gt;id)-&amp;gt;siteId($site-&amp;gt;id)-&amp;gt;one()) {&#xA;                    return $element-&amp;gt;getUrl();&#xA;                }&#xA;                // otherwise we'll just ignore the browser language&#xA;                return $otherSiteElement-&amp;gt;getUrl();&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    // no element matches. we'll just redirect to the same URI in the requested site.&#xA;    return \craft\helpers\UrlHelper::siteUrl($uri, null, null, $site-&amp;gt;id);&#xA;})();&#xA;&#xA;// redirect to the URL&#xA;$app-&amp;gt;response-&amp;gt;redirect($url)-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that in place, you should be able to start testing the redirects by pointing your browser to &lt;code&gt;/index.php?p=some/uri&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Redirect nonlocalized requests to the webroot’s index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we want to get all requests that don’t start with &lt;code&gt;en/&lt;/code&gt; or &lt;code&gt;es/&lt;/code&gt; to be routed to an &lt;code&gt;index.php&lt;/code&gt; file in your web root. If you’re using Apache, you can do that with &lt;code&gt;mod_rewrite&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Send requests missing en/ or es/ to index.php&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(en|es) [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now everything should work!&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-02-06T15:52:56.117" LastActivityDate="2018-02-06T15:52:56.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23765" PostTypeId="1" AcceptedAnswerId="23767" CreationDate="2018-02-06T16:47:33.733" Score="1" ViewCount="192" Body="&lt;p&gt;I have a &lt;code&gt;towns&lt;/code&gt; entry with a matrix field: &lt;code&gt;townAlbums&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matrix field has just one block type: &lt;code&gt;photoAlbum&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one block type has two basic text fields (the important one being &lt;code&gt;albumName&lt;/code&gt; and one asset field for uploading images to the gallery: &lt;code&gt;albumPhotos&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the Default Upload Location for this matrix subfield &lt;code&gt;albumPhotos&lt;/code&gt; to be dynamic, taking both the parent entry slug (slug of the town entry) and the name of the album: &lt;code&gt;albumName&lt;/code&gt;. I'm not sure how to accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Desired url:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I be entering for my Default Upload Location?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-02-07T00:36:46.510" Title="Default Upload Location needs matrix field and entry info... How?" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23766" PostTypeId="2" ParentId="23761" CreationDate="2018-02-06T23:59:16.870" Score="2" Body="&lt;p&gt;I'm not sure how your email address got blocked, but Craft 3 uses the same SMTP &lt;code&gt;smtp.gmail.com&lt;/code&gt; server and settings that Craft 2 uses when you choose to send email via &quot;Gmail&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/mail/transportadapters/Gmail.php#L91-L97&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/mail/transportadapters/Gmail.php#L91-L97&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sending email through PHPMail/sendmail is notoriously unreliable and I wouldn't recommend it on production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there are quite a few steps you can take to help ensure your email doesn't get treated as SPAM: &lt;a href=&quot;https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-06T23:59:16.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23767" PostTypeId="2" ParentId="23765" CreationDate="2018-02-07T00:36:46.510" Score="3" Body="&lt;p&gt;If your desired URL is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The the &quot;Upload Location&quot; for the setup you described would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;towns/{owner.slug}/{albumName}/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming &lt;code&gt;towns&lt;/code&gt; is just hard-coded since you're referencing &lt;code&gt;town-slug&lt;/code&gt; in the next segment.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-07T00:36:46.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23768" PostTypeId="1" AcceptedAnswerId="23809" CreationDate="2018-02-07T14:53:03.967" Score="1" ViewCount="156" Body="&lt;p&gt;I'm trying to append a string to the end of all rich text links. Is there an already existing plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="7706" LastEditDate="2018-02-12T16:30:01.857" LastActivityDate="2018-02-13T15:20:42.207" Title="Append a string to the end of all rich text links" Tags="&lt;redactor&gt;&lt;string&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23769" PostTypeId="1" AcceptedAnswerId="23783" CreationDate="2018-02-07T17:30:36.353" Score="3" ViewCount="154" Body="&lt;p&gt;I want to select all children of all entries that fulfil specified relation parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this, but I think .isDescendantOf only supports single entry. Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parents = craft.entries.section('training').level('1').relatedTo(relationParam) %}&#xA;{% set children= craft.entries.section('training').isDescendantOf(parents).eventDate('&amp;gt;= ' ~ now).order('startDate DESC') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I thought giving more background to this might help, as possibly an entirely new approach will be necessary. Consider this setup in Craft CMS&#xA;&lt;a href=&quot;https://i.stack.imgur.com/SGOre.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SGOre.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I have a 2 level structure, where top level is a big matrix describing an event and has quite a big classification section where multiple categories are selected. Then it's children are specific instances of that event with their own date and location. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to force my client to repeat categorization on each of the lvl2 entries since they've already done it on lvl1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I select all lvl2 entries that have parents fulfilling specific relation param?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2018-02-08T13:13:59.610" LastActivityDate="2018-02-08T20:11:46.470" Title="Find structure entries which parents relate to other entries" Tags="&lt;entries&gt;&lt;relations&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23770" PostTypeId="1" AcceptedAnswerId="23771" CreationDate="2018-02-07T20:14:10.440" Score="1" ViewCount="118" Body="&lt;p&gt;I'm currently running a Craft 2 site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought there was a quick place to check my plugins to tell if they are ready for 3.0?&lt;/p&gt;&#xA;" OwnerUserId="3660" LastEditorUserId="45" LastEditDate="2018-02-07T21:08:17.137" LastActivityDate="2018-02-07T21:08:17.137" Title="In Craft 2, check if plugin is available for Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23771" PostTypeId="2" ParentId="23770" CreationDate="2018-02-07T20:34:57.973" Score="4" Body="&lt;p&gt;click the updates link in the footer and you should see this at the bottom of the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KMwUd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KMwUd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-02-07T20:34:57.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23772" PostTypeId="1" CreationDate="2018-02-07T22:33:32.670" Score="1" ViewCount="131" Body="&lt;p&gt;Does anyone know if it's possible to validate the size of an attachment for Sprout Forms file upload? I'd like to limit attachments to a maximum file size.&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2018-02-08T07:28:48.203" Title="Validate attachments for file size?" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23773" PostTypeId="1" CreationDate="2018-02-08T00:11:39.073" Score="1" ViewCount="308" Body="&lt;p&gt;I'm new to Craft.  I've been trying to wrap my head around how to design the concept of Events and Event Registrations.  Currently I have both Events and Event Registrations as their own Sections as Channels.  An Event Registration has an Entry field to tie it back to an Event.  Our admins will create an Event, but we want the public to be able to register for an event via a form.  I'm using the guest-entries plugin and am very close to getting this all tied together, but am unsure how to pass the reference to the Event in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can pass it in via the url &lt;code&gt;http://example.demo/register.html?eventId=99&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what do I reference so that the correct info will be sent to identify the Event entry when the form is submitted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I can send it via a hidden field, but am not sure what value to send:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set eventId = craft.request.getParam('eventId') %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[event]&quot; value=&quot;{{ eventId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone sees a better way to design this, I would be open to other ideas.&lt;/p&gt;&#xA;" OwnerUserId="7962" LastEditorUserId="7962" LastEditDate="2018-02-08T01:35:05.867" LastActivityDate="2018-02-08T02:49:32.473" Title="How to reference an entry field in a guest user form?" Tags="&lt;entries&gt;&lt;form&gt;&lt;guest-entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23774" PostTypeId="2" ParentId="23773" CreationDate="2018-02-08T02:49:32.473" Score="2" Body="&lt;p&gt;So, I found the answer after much digging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to this answer &lt;a href=&quot;https://craftcms.stackexchange.com/a/9831/7962&quot;&gt;https://craftcms.stackexchange.com/a/9831/7962&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that the entries field type has to be referenced with an additional set of brackets.  My form now works after changing my input to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[event][]&quot; value=&quot;{{ eventId }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7962" LastActivityDate="2018-02-08T02:49:32.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23775" PostTypeId="2" ParentId="23772" CreationDate="2018-02-08T07:23:08.363" Score="1" Body="&lt;p&gt;I'm not sure if that's possible since I never used Sproud Forms but you can easily create a custom field type with the additional validation rule.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin&lt;/a&gt; you can use &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; for that and install it&lt;/li&gt;&#xA;&lt;li&gt;Create a new &lt;a href=&quot;https://craftcms.com/docs/plugins/field-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Field&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Just extend the basic &lt;code&gt;AssetsFieldType&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class myNewAssetField extends AssetsFieldType{&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a look at the default validation rules for &lt;a href=&quot;https://craftcms.com/classreference/fieldtypes/BaseElementFieldType&quot; rel=&quot;nofollow noreferrer&quot;&gt;BaseElementFieldType&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function validate($value)&#xA;{&#xA;    $errors = array();&#xA;&#xA;    if ($this-&amp;gt;allowLimit &amp;amp;&amp;amp; ($limit = $this-&amp;gt;getSettings()-&amp;gt;limit) &amp;amp;&amp;amp; is_array($value) &amp;amp;&amp;amp; count($value) &amp;gt; $limit)&#xA;    {&#xA;        if ($limit == 1)&#xA;        {&#xA;            $errors[] = Craft::t('There can’t be more than one selection.');&#xA;        }&#xA;        else&#xA;        {&#xA;            $errors[] = Craft::t('There can’t be more than {limit} selections.', array('limit' =&amp;gt; $limit));&#xA;        }&#xA;    }&#xA;&#xA;    if ($errors)&#xA;    {&#xA;        return $errors;&#xA;    }&#xA;    else&#xA;    {&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Copy the function above in your new class and include something like this somewhere&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($value as $assetId){&#xA;    $asset = craft()-&amp;gt;assets-&amp;gt;getFileById($assetId);&#xA;    if($asset-&amp;gt;size &amp;gt;= 10){ // insert your size here&#xA;        $errors[] = Craft::t('Your file is too large');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It took me about 5 minutes to create this new field type to allow the validation of file sizes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to make it look pretty and create a setting to dynamically set the individual max file size for each field you can include the function &lt;a href=&quot;https://github.com/pixelandtonic/Craft-Release/blob/master/app/fieldtypes/BaseElementFieldType.php#L101&quot; rel=&quot;nofollow noreferrer&quot;&gt;getSettingsHtml&lt;/a&gt; in your new class and change add your new value (for example maxSize) you can then grab the new size with &lt;code&gt;$this-&amp;gt;getSettings()-&amp;gt;maxSize&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-08T07:28:48.203" LastActivityDate="2018-02-08T07:28:48.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23776" PostTypeId="1" AcceptedAnswerId="23777" CreationDate="2018-02-08T08:41:15.603" Score="1" ViewCount="152" Body="&lt;p&gt;I'm trying to create somewhat of a clever search for which only searches through certain pages of my site. At the moment, it can search those pages, but instead of the result returning the page name, I want it to return a field within the matrix field which the search query can be found in.&lt;/p&gt;&#xA;&lt;p&gt;As an example below, if a user were to search for &lt;em&gt;&lt;strong&gt;Lorem Ipsum&lt;/strong&gt;&lt;/em&gt;, I want it to return the page name as well as the matrix field title.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;This is my title&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Desired result:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Page Name: This is my title&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So far, the code I have can be found here, but I'm unsure how to access to exact matrix field title and add it to the query.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('q') %}&#xA;{% set entries = craft.entries.search(query).order('score').section(['pageOne', 'pageTwo', 'pageThree']) %}&#xA;&#xA;{% if entries|length %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;a href=&amp;quot;{{ entry.url }}&amp;quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is this possible to achieve?&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-02-09T07:05:45.260" Title="Search and link to Entries Matrix Field" Tags="&lt;matrix&gt;&lt;search&gt;&lt;field&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23777" PostTypeId="2" ParentId="23776" CreationDate="2018-02-08T09:43:34.147" Score="2" Body="&lt;p&gt;I assume, that title is a subfield of a matrix field, because title is a reserved name in craft. So as far as I understand your Question, you want to get some results out of a matrix field thats in one of your pages ('pageOne', 'pageTwo', 'pageThree'). That means you have to loop over this field as well. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries|length %}&#xA;   {% for entry in entries %}&#xA;       {% for block in entry.matrixFieldHandle %}&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }} - {{ block.matrixTitle }}&amp;lt;/a&amp;gt;&#xA;       {% endfor %}&#xA;   {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7525" LastEditorUserId="6795" LastEditDate="2018-02-09T07:05:45.260" LastActivityDate="2018-02-09T07:05:45.260" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23779" PostTypeId="1" CreationDate="2018-02-08T14:54:26.430" Score="1" ViewCount="815" Body="&lt;p&gt;I've had to manually do an SQL call to the get correct results but I was hoping there would be a tidier way of achieving this in Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = ( new Query() )&#xA;-&amp;gt;select('craft_content.title, craft_entries.id, ( 3959 * acos( cos( radians(' . $latitude . ') ) * cos( radians( field_clubLatitude ) ) * &#xA;            cos( radians( field_clubLongitude ) - radians(' . $longitude . ') ) + sin( radians(' . $latitude . ') ) * &#xA;            sin( radians( field_clubLatitude ) ) ) ) AS distance')&#xA;-&amp;gt;from( 'craft_elements' )&#xA;-&amp;gt;where('field_clubLongitude != &quot;&quot; and field_clubLatitude != &quot;&quot;')&#xA;-&amp;gt;join( 'LEFT JOIN', 'craft_entries', 'craft_elements.id = craft_entries.id' )&#xA;-&amp;gt;join( 'LEFT JOIN', 'craft_content', 'craft_elements.id = craft_content.elementId' )&#xA;-&amp;gt;andHaving('distance &amp;lt; 100')&#xA;-&amp;gt;orderBy('distance')&#xA;-&amp;gt;limit(3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6424" LastActivityDate="2018-04-09T22:34:53.337" Title="Anyway to extend Craft Entry query search in Craft 3" Tags="&lt;entry&gt;&lt;craft3&gt;&lt;element&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23780" PostTypeId="1" CreationDate="2018-02-08T14:54:43.877" Score="0" ViewCount="69" Body="&lt;p&gt;Is there any obvious reason why a client is not able to access live preview or an offline site? I've tested the login myself and it works OK. The client has tried using IE on a PC and Chrome and Safari on a Mac.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2018-02-08T14:54:43.877" Title="Client not able to access live preview or offline site" Tags="&lt;live-preview&gt;&lt;system-status&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23782" PostTypeId="1" AcceptedAnswerId="23785" CreationDate="2018-02-08T18:40:46.833" Score="1" ViewCount="395" Body="&lt;p&gt;I have a front end save entry form which users can attach photos too, it all works fine unless a photo with the same filename is saved, in this instance the entry saves but the asset field is just left blank, can't find anything in the docs,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or a point in the right direction appreciated!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;addCompanyForm&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ csrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;7&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;&#xA;  &amp;lt;input id=&quot;title&quot; type=&quot;text&quot; name=&quot;title&quot;&amp;gt;&#xA;  &amp;lt;input id=&quot;companyLogo&quot; type=&quot;file&quot; name=&quot;fields[companyLogo]&quot; accept=&quot;.png, .jpg&quot;&amp;gt;&#xA;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6907" LastEditorUserId="6907" LastEditDate="2018-02-08T19:52:12.597" LastActivityDate="2018-02-09T07:33:51.777" Title="Craft 3 front end form file uploads not saving if filename exists?" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23783" PostTypeId="2" ParentId="23769" CreationDate="2018-02-08T20:11:46.470" Score="2" Body="&lt;p&gt;Yes, it looks like the &lt;code&gt;descendantOf&lt;/code&gt; param doesn’t accept an array of element models or array of element IDs. Here’s what you can do in Twig to work around the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution does trigger an additional query for every parent entry matching your &lt;code&gt;relatedTo&lt;/code&gt; criteria. But as it’s only fetching the &lt;code&gt;ids&lt;/code&gt; column, it might not perform too bad actually, depends on the amount of matching parent entries though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set idsParam = [] %}&#xA;{% for parent in parents %}&#xA;    {% set idsParam = idsParam|merge(parent.getDescendants().ids()) %}&#xA;{% endfor %}&#xA;&#xA;{% set children = craft.entries({&#xA;    section: 'training',&#xA;    ids: idsParam,&#xA;    eventDate: '&amp;gt;= ' ~ now|date('U'),&#xA;    order: 'startDate DESC',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-08T20:11:46.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23784" PostTypeId="2" ParentId="23779" CreationDate="2018-02-08T21:07:31.327" Score="1" Body="&lt;p&gt;The &quot;proper&quot; way to access the element query that gets generated is through a plugin via the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/elements/db/ElementQuery.php#L79-L85&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQuery's &lt;code&gt;query&lt;/code&gt; and &lt;code&gt;subquery&lt;/code&gt;&lt;/a&gt; properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like you're doing a Haversine algorithm to calculate distance between a latitude and longitude.  There's are some similar plugins that already do this you can use as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;a href=&quot;https://github.com/ethercreative/simplemap/blob/v3/src/services/MapService.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ethercreative/simplemap/blob/v3/src/services/MapService.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-08T21:07:31.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23785" PostTypeId="2" ParentId="23782" CreationDate="2018-02-09T07:33:51.777" Score="1" Body="&lt;p&gt;That's a bug. The Asset wasn't saved because it would not be validated due to conflicting filenames. Thankfully, it's &lt;a href=&quot;https://github.com/craftcms/cms/commit/8ca98621a49f2650ee0f15ae9dc6a6fb1c9df145&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixed now&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-02-09T07:33:51.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23786" PostTypeId="1" CreationDate="2018-02-09T08:58:26.063" Score="1" ViewCount="84" Body="&lt;p&gt;Has anyone experience with the &lt;a href=&quot;https://github.com/Studiosaurus/contactformrequiredfields&quot; rel=&quot;nofollow noreferrer&quot;&gt;ContactFormRequiredFields&lt;/a&gt; plugin? It works fine until the send button is pressed. It brings up an &quot;Undefined variable: formEntry&quot; error. When I look into the plugin I see that &quot;formEntry&quot; is connected to &quot;formId&quot;. But what goes wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        ...&#xA;&#xA;        $formId = craft()-&amp;gt;request-&amp;gt;getPost('formId');&#xA;        $formId = craft()-&amp;gt;security-&amp;gt;validateData($formId);&#xA;&#xA;        /**&#xA;         * Get the form entry using the ID&#xA;         */&#xA;        if ($formId)&#xA;        {&#xA;            $formEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($formId);&#xA;        }&#xA;&#xA;        ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#0  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/etc/web/WebApp.php(693): CApplication-&amp;gt;handleError(8, &quot;Undefined variable: formEntry&quot;, &quot;/var/www/vhosts/tonartmusikschule.at/httpdocs/craft/plugins/cont...&quot;, &#xA;#1  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/plugins/contactformrequiredfields/ContactFormRequiredFieldsPlugin.php(48): Craft\WebApp-&amp;gt;handleError(8, &quot;Undefined variable: formEntry&quot;, &quot;/var/www/vhosts/tonartmusikschule.at/httpdocs/craft/plugins/cont...&quot;, 48, ...)&#xA;#2  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/base/CComponent.php(567): Craft\ContactFormRequiredFieldsPlugin-&amp;gt;Craft\{closure}(Craft\ContactFormEvent)&#xA;#3  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/plugins/contactform/services/ContactFormService.php(73): CComponent-&amp;gt;raiseEvent(&quot;onbeforesend&quot;, Craft\ContactFormEvent)&#xA;#4  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/plugins/contactform/controllers/ContactFormController.php(139): Craft\ContactFormService-&amp;gt;onBeforeSend(Craft\ContactFormEvent)&#xA;#5  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ContactFormController-&amp;gt;actionSendMessage()&#xA;#6  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(array(&quot;p&quot; =&amp;gt; &quot;anmeldung_index&quot;))&#xA;#7  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(CInlineAction)&#xA;#8  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(CInlineAction, array())&#xA;#9  /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run(&quot;sendMessage&quot;)&#xA;#10 /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/etc/web/WebApp.php(836): CWebApplication-&amp;gt;runController(&quot;contactForm/sendMessage&quot;)&#xA;#11 /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#12 /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#13 /var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/index.php(62): CApplication-&amp;gt;run()&#xA;#14 /var/www/vhosts/tonartmusikschule.at/httpdocs/public/index.php(19): require_once(&quot;/var/www/vhosts/tonartmusikschule.at/httpdocs/craft/app/index.ph...&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7812" LastEditorUserId="7812" LastEditDate="2018-02-12T09:47:32.780" LastActivityDate="2018-02-14T16:59:57.307" Title="Contact Form Required Fields Plugin – formEntry error" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23787" PostTypeId="2" ParentId="20539" CreationDate="2018-02-09T10:34:08.373" Score="2" Body="&lt;p&gt;I've done this by adding my button to activeButtons and adding my inline tag to activeButtonsState after adding button in init function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In below example, cite is the tag and citebtn is the button's name.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init: function()&#xA;{&#xA;    ...&#xA;    if($.inArray(&quot;citebtn&quot;, this.opts.activeButtons) &amp;lt; 0) {&#xA;        this.opts.activeButtons.push(&quot;citebtn&quot;);&#xA;        this.opts.activeButtonsStates.cite = &quot;citebtn&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7972" LastEditorUserId="7972" LastEditDate="2018-02-09T14:52:42.257" LastActivityDate="2018-02-09T14:52:42.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23788" PostTypeId="2" ParentId="23722" CreationDate="2018-02-09T12:49:09.010" Score="1" Body="&lt;p&gt;I gave up my project to dynamically upload assets through matrix field dropdown values where the asset field is outside of the matrix field.&#xA;I actually just wanted to save assets in a logical structure.&#xA;I now save my craft commerce assets like this: product category/manufacturer/productionyear&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.categoryFieldHandle.first.slug }}/{{ object.dropdownFieldHandle }}/{{ object.dropdownFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe this helps someone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Brad Bell thanks for helping.&lt;/p&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2018-02-09T12:49:09.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23789" PostTypeId="1" CreationDate="2018-02-09T16:51:30.887" Score="1" ViewCount="269" Body="&lt;p&gt;I dumped from Craft my database from server A and am trying to install it to a fresh copy of Craft on server B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got Craft up and running, and when I try importing my Craft SQL file in PHPmyAdmin, I get an error every time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/kyJb3oO.png&quot; alt=&quot;craft error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I need to setup in Craft regarding asset files before my import will work?&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="57" LastEditDate="2018-02-09T18:12:47.583" LastActivityDate="2018-07-16T03:55:14.817" Title="Importing a Craft database error" Tags="&lt;database&gt;&lt;mysql&gt;&lt;import&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23790" PostTypeId="2" ParentId="23789" CreationDate="2018-02-09T16:54:23.803" Score="2" Body="&lt;p&gt;MySQL exports only include the tables, not the database settings. You need to create a database first, open it and then import the tables.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-09T16:54:23.803" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23791" PostTypeId="2" ParentId="18112" CreationDate="2018-02-09T20:32:39.207" Score="0" Body="&lt;p&gt;You can integrate with&lt;a href=&quot;https://vipparcel.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vip Parcel&lt;/a&gt; if you are interested in better discount rates on USPS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially if you are sending small packages domestically or internationally, the service they offer is unbeatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can upload batches in XML uploads, integrate your e-bay account, schedule pick-ups, create accounts and sub-accounts and fill out custom forms for international. It's great. &lt;/p&gt;&#xA;" OwnerUserId="7976" LastEditorUserId="5012" LastEditDate="2018-02-21T14:10:05.360" LastActivityDate="2018-02-21T14:10:05.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23792" PostTypeId="1" AcceptedAnswerId="23798" CreationDate="2018-02-10T00:49:57.497" Score="1" ViewCount="122" Body="&lt;p&gt;I have an invoice that is sent to stripe to be paid. When the thanks.html is shown, I would like the invoices section's invoicePaid dropdown field to change from &quot;No&quot; to &quot;Yes&quot; using the charge.onCharge hook.&#xA;I tried the following( and variations ) without success.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {&#xA;    craft()-&amp;gt;on('charge.onCharge', function(Event $event) {&#xA;        craft()-&amp;gt;on('entries.onSaveEntry', function(Event $event ){&#xA;&#xA;            //Is the entry in the section 'invoices'?&#xA;            if ($event-&amp;gt;params['entry']-&amp;gt;section == 'invoices') {&#xA;&#xA;            //Replace values&#xA;            $event-&amp;gt;params['entry']-&amp;gt;getContent()-&amp;gt;invoicePaid = 'Yes';&#xA;            }&#xA;        });&#xA;&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong, or is there a better way to go about this?&lt;/p&gt;&#xA;" OwnerUserId="7968" LastActivityDate="2018-02-16T21:09:37.620" Title="How do I edit a dropdown field in the charge.onCharge hook?" Tags="&lt;plugins&gt;&lt;plugin-charge&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23794" PostTypeId="1" CreationDate="2018-02-10T06:21:38.697" Score="1" ViewCount="38" Body="&lt;p&gt;I'm adding content to a site that has been set up in Craft. However, it's been set up so that in one section, any link created has the label &quot;How this works&quot;. It's a bit unwieldy as it means I can't use the actual information I want to send people to as the link for example: &#xA;&quot;Spend less money&quot; as the link rather than body text that says &quot;Spend less money&quot; with a link underneath that says &quot;How this works&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can change this behaviour without getting the site designer to change it in template files?&lt;/p&gt;&#xA;" OwnerUserId="7979" LastActivityDate="2018-02-10T09:34:52.737" Title="Changing the label on links" Tags="&lt;link&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23795" PostTypeId="2" ParentId="23794" CreationDate="2018-02-10T09:34:52.737" Score="1" Body="&lt;p&gt;This is highly dependant on how the fields and templates are set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't say how you are creating the link. Craft makes no assumptions as to how you are going to be entering content. It's entirely down to the developer to set up the fields and templates according to your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have a text field specifically for entering the link? If there is no accompanying field to add a title then it's most likely you will need to add one and then modify the template to output that field in the title attribute of the link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are adding a link within a Rich Text field then you should be able to edit it from within there. Though if this were the case I don't know why you would have a default value being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, it should be a very minor task for a developer to fix.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-02-10T09:34:52.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23796" PostTypeId="1" CreationDate="2018-02-10T09:55:50.743" Score="1" ViewCount="138" Body="&lt;p&gt;In my shop, I have two different kinds of products.type items and my products have variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one of products type, I would like to show the note field in the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My product types are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;products &lt;/li&gt;&#xA;&lt;li&gt;options&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For product type options, I don't want to show the note field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set this up? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried this without success.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in cart.lineItems %}&#xA;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateLineItem&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;lineItemId&quot; value=&quot;{{ item.id }}&quot;&amp;gt;&#xA;&#xA;{% if product.type('products') %}&#xA;&amp;lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Productsort&quot;  name=&quot;note&quot; value=&quot;{{ item.note }}&quot; required&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;input class=&quot;form-control&quot; type=&quot;submit&quot; class=&quot;button&quot; value=&quot;Bijwerken&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="57" LastEditDate="2018-02-10T19:42:09.017" LastActivityDate="2018-02-10T19:42:09.017" Title="Notes field only for certain product types" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23797" PostTypeId="2" ParentId="23796" CreationDate="2018-02-10T11:45:33.203" Score="1" Body="&lt;p&gt;I think you can do something like;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if product.type('products') %}&#xA;    code to show notes field&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the product model docs here &lt;a href=&quot;https://craftcommerce.com/docs/product-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/product-model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The note attribute &lt;em&gt;is&lt;/em&gt; part of the lineitem model so you should be able to show it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/line-item-model#note&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/line-item-model#note&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following should work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in order.lineitems %}&#xA;    {{ item.note }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could try naming your input field like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Productsort&quot;  name=&quot;item[note]&quot; value=&quot;{{ item.note }}&quot; required&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd need to test this though. I've done something along these lines but can't remember exactly what I did.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-02-10T13:02:16.837" LastActivityDate="2018-02-10T13:02:16.837" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23798" PostTypeId="2" ParentId="23792" CreationDate="2018-02-10T18:00:26.303" Score="2" Body="&lt;p&gt;In your current example, you are not actually saving an entry. You are just setting up an &lt;code&gt;onSaveEntry&lt;/code&gt; event listener. To save the entry you will need to actually save the entry using the [saveEntry][1] method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I'm not exactly sure what your setup is — but some variation on the following should work for you.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the CMS, add a field called 'invoiceID', which you will use to store the invoice entryId to the charge (or 'invoiceEntryId' or whatever you want to call it).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add the 'invoiceId' field to the charge field layout in charge-&gt;settings-&gt;fields.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the charge form, add the 'invoiceId' field to your form (this assumes that you are making the charge from the invoice entry page, otherwise you will need to use a reference to the invoice entry id through whatever relationship you have set up):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[invoiceId]&quot; value=&quot;{{ entry.id }}&quot;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In your plugin, add the onCharge event to grab the 'invoiceId' from the charge event, then retrieve, update, and save the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('charge.onCharge', function(Event $event) {&#xA;&#xA;    // get the charge model&#xA;    $charge = $event-&amp;gt;params['charge'];&#xA;&#xA;    // retrieve the invoiceId (aka entryId) saved on the charge model&#xA;    $entryId = $charge-&amp;gt;invoiceId;&#xA;&#xA;    // uncomment to test, if needed&#xA;    //LogicPlugin::log('Invoice ID: '.$charge-&amp;gt;invoiceId, LogLevel::Info);&#xA;&#xA;    // get the invoice entry from the invoiceId&#xA;    $entry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;    // update the invoicePaid field (in this case I'm using a switch)&#xA;    $entry-&amp;gt;getContent()-&amp;gt;invoicePaid = '1';&#xA;&#xA;    // save the entry&#xA;    $success = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&#xA;    // log errors&#xA;    if (!$success) {&#xA;        LogicPlugin::log('Couldn’t save the entry &quot;'.$entry-&amp;gt;title.'&quot;', LogLevel::Error);&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="784" LastEditorUserId="784" LastEditDate="2018-02-16T21:09:37.620" LastActivityDate="2018-02-16T21:09:37.620" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23799" PostTypeId="2" ParentId="633" CreationDate="2018-02-12T10:06:26.020" Score="1" Body="&lt;p&gt;Was looking for an answer and came up with an noob alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the paginated page (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{entry.url}}/p{{pageInfo.currentPage}}&quot;&amp;gt;{{entry.title}}&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will parse the page segment as the last segment of the entry. I first tried to use getSegment, but page numbers are seen as pagination url's and therefore ignored as segments. So, on the entry page if it's a paginated section for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/{{entry.section.handle}}/p{{craft.request.getPageNum()}}&quot;&amp;gt;back&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastActivityDate="2018-02-12T10:06:26.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23800" PostTypeId="1" AcceptedAnswerId="23819" CreationDate="2018-02-12T10:06:56.697" Score="1" ViewCount="376" Body="&lt;p&gt;I would like to trigger a custom javascript function after an element in a matrix block was moved in the matrix but I'm not sure how to attach the event without changing the &lt;code&gt;MatrixInput.js&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've tried the easy way with attaching element handler in my plugins &lt;code&gt;init()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Garnish.$doc.on('dragStop', '.matrixblock &amp;gt; .actions &amp;gt; .move', this.onMoveEnd.bind(this))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But of course that did not work. The &lt;code&gt;Craft.MatrixInput&lt;/code&gt; contains a the function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;this.blockSort = new Garnish.DragSort($blocks, {&#xA;    handle: '&amp;gt; .actions &amp;gt; .move',&#xA;    axis: 'y',&#xA;    filter: $.proxy(function() {&#xA;        // Only return all the selected items if the target item is selected&#xA;        if (this.blockSort.$targetItem.hasClass('sel')) {&#xA;            return this.blockSelect.getSelectedItems();&#xA;        }&#xA;        else {&#xA;            return this.blockSort.$targetItem;&#xA;        }&#xA;    }, this),&#xA;    collapseDraggees: true,&#xA;    magnetStrength: 4,&#xA;    helperLagBase: 1.5,&#xA;    helperOpacity: 0.9,&#xA;    onSortChange: $.proxy(function() {&#xA;        this.blockSelect.resetItemOrder();&#xA;    }, this)&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone please tell me how to extend this without breaking Craft updates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accessing this event with &lt;code&gt;Craft.MatrixInput.blockSort&lt;/code&gt; to attach something does not work either and I'm not sure how I can make use of the &lt;code&gt;this.trigger('dragStop');&lt;/code&gt; &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/develop/src/BaseDrag.js#L256&quot; rel=&quot;nofollow noreferrer&quot;&gt;event&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to dig into &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/develop/src/Garnish.js#L563&quot; rel=&quot;nofollow noreferrer&quot;&gt;Garnish events&lt;/a&gt; to attach the handlers, but I'm not sure how. &lt;code&gt;Garnish.on&lt;/code&gt; does not work, &lt;code&gt;Garnish.Drag.on&lt;/code&gt; either, &lt;code&gt;Garnish.Base&lt;/code&gt; returns a function but &lt;code&gt;Garnish.Base()&lt;/code&gt; returns undefined. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-12T10:23:10.317" LastActivityDate="2018-02-12T21:38:53.127" Title="Craft 3 - custom callback after Garnish onDragStop" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;craft3&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23801" PostTypeId="1" CreationDate="2018-02-12T11:49:46.983" Score="0" ViewCount="410" Body="&lt;p&gt;What files does Craft store in &lt;code&gt;craft/storage/runtime/temp&lt;/code&gt; folder.&#xA;And what is the purpose of it.&#xA;And how to stop it form getting huge.&lt;/p&gt;&#xA;" OwnerUserId="7341" LastEditorUserId="5557" LastEditDate="2018-08-20T21:50:26.787" LastActivityDate="2018-08-20T21:50:26.787" Title="What files does Craft store in &quot;craft/storage/runtime/temp&quot;" Tags="&lt;cache&gt;&lt;storage&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23802" PostTypeId="1" CreationDate="2018-02-12T12:56:11.180" Score="1" ViewCount="55" Body="&lt;p&gt;I am currently working with craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a &lt;code&gt;filter&lt;/code&gt; with a dropdown list that will only display the images, that are related to the selected dropdown. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;select&amp;gt;&#xA;        {% for option in entry.selection.options %}&#xA;            &amp;lt;option&amp;gt;{{ option.value }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;    {% for image in entry.bild %}&#xA;        &amp;lt;div class=&quot;col s12 m6 l4&quot;&amp;gt;&#xA;            &amp;lt;a data-fancybox=&quot;gallery-{{entry.slug}}&quot; href=&quot;{{ image.url }}&quot;&amp;gt;&amp;lt;img width=&quot;100%&quot; src=&quot;{{ image.url }}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7982" LastEditorUserId="5012" LastEditDate="2018-02-16T19:32:58.677" LastActivityDate="2018-02-16T19:32:58.677" Title="Show Images via Dropdown dynamically" Tags="&lt;assets&gt;&lt;drop-down&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23803" PostTypeId="2" ParentId="23801" CreationDate="2018-02-12T13:19:26.947" Score="1" Body="&lt;p&gt;The easiest thing is to look it up. Craft CMS is usually really self-explaining So when you take a look at your folders in &lt;code&gt;craft/storage/runtime/temp&lt;/code&gt; you'll see the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/assets &amp;lt;- for example cached thumbnails/preview icons and all those things&#xA;/cache&#xA;/compiled_templates &amp;lt;- templates that have cache tags, that should only compiled once... for example static pages that does not change that much&#xA;/HTML &amp;lt;-- mostly some json objects&#xA;/logs &amp;lt;-- well seems obvious&#xA;/state &amp;lt;-- Yii.CSecurityManager.validationkey a json object&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;compiled_templates&lt;/code&gt; folder could become huge when you messed around with &lt;code&gt;cache&lt;/code&gt; tags too much or if you have a really large site.&#xA;&lt;code&gt;assets&lt;/code&gt; will grow when you insert many assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of this folder is to make Craft CMS faster because it does not have to generate HTML, thumbnails and so on with every page refresh, instead it uses already generated files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How big is this folder for you? Does it require too much space?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-12T13:19:26.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23804" PostTypeId="1" AcceptedAnswerId="23807" CreationDate="2018-02-12T13:52:16.663" Score="10" ViewCount="4319" Body="&lt;p&gt;I have created custom plugin in Craft 3 and want send email to receiver or site email when user submits a form.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="57" LastEditDate="2018-02-12T21:42:36.587" LastActivityDate="2019-02-23T18:19:32.947" Title="How to send email from Craft 3 custom plugin?" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23805" PostTypeId="1" CreationDate="2018-02-12T13:55:07.957" Score="0" ViewCount="50" Body="&lt;p&gt;I want to add a 301 redirect plugin to a Craft CMS 2.6 website. I only have user permission as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please give me steps on how to add my redirects to the back-end of the site?&lt;/p&gt;&#xA;" OwnerUserId="7983" LastEditorUserId="57" LastEditDate="2018-02-12T21:39:18.483" LastActivityDate="2018-02-12T21:41:49.760" Title="how to add a plugin?" Tags="&lt;plugin-development&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23806" PostTypeId="1" AcceptedAnswerId="23810" CreationDate="2018-02-12T14:16:52.523" Score="4" ViewCount="5563" Body="&lt;p&gt;I'm trying to manually install a plugin &lt;a href=&quot;https://github.com/jmx2inc/picpuller-for-craft3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pic Puller&lt;/a&gt; for Craft 3 Beta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My shared hosting won't allow enabling of &lt;code&gt;allow_url_fopen&lt;/code&gt; so it can't be done via the plugin store within the dashboard. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any docs I checked are telling me to add the plugin files to &lt;code&gt;/craft/plugins/&lt;/code&gt; but I'm not seeing this directory in Craft 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding it to the &lt;code&gt;/modules/&lt;/code&gt; directory but this didn't work for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7984" LastEditorUserId="5012" LastEditDate="2018-02-16T20:51:13.430" LastActivityDate="2018-02-16T20:51:13.430" Title="Manual Plugin installation on Craft 3" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23807" PostTypeId="2" ParentId="23804" CreationDate="2018-02-12T14:30:27.193" Score="18" Body="&lt;h3&gt;Edit: After the migration to Craft 3.1.x you should rather use this Code&lt;/h3&gt;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * @param string                            $html&#xA; * @param string                            $subject&#xA; * @param array|string|\craft\elements\User $mail&#xA; *&#xA; * @return bool&#xA; */&#xA;public function sendMail(string $html, string $subject, $mail): bool&#xA;{&#xA;    return Craft::$app&#xA;        -&amp;gt;getMailer()&#xA;        -&amp;gt;compose()&#xA;        -&amp;gt;setTo($mail)&#xA;        -&amp;gt;setSubject($subject)&#xA;        -&amp;gt;setHtmlBody($html)&#xA;        -&amp;gt;send();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3&gt;Edit: this is my old answer, valid for Craft 3.0.x&lt;/h3&gt;&#xA;&lt;p&gt;This is my code to send emails in Craft 3. Let me know if you have any questions.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;use craft\mail\Message;&#xA;&#xA;/**&#xA; * @param $html&#xA; * @param $subject&#xA; * @param null $mail&#xA; * @param array $attachments&#xA; * @return bool&#xA; */&#xA;private function sendMail($html, $subject, $mail = null, array $attachments = array()): bool&#xA;{&#xA;    $settings = Craft::$app-&amp;gt;systemSettings-&amp;gt;getSettings('email');&#xA;    $message = new Message();&#xA;&#xA;    $message-&amp;gt;setFrom([$settings['fromEmail'] =&amp;gt; $settings['fromName']]);&#xA;    $message-&amp;gt;setTo($mail);&#xA;    $message-&amp;gt;setSubject($subject);&#xA;    $message-&amp;gt;setHtmlBody($html);&#xA;    if (!empty($attachments) &amp;amp;&amp;amp; \is_array($attachments)) {&#xA;&#xA;        foreach ($attachments as $fileId) {&#xA;            if ($file = Craft::$app-&amp;gt;assets-&amp;gt;getAssetById((int)$fileId)) {&#xA;                $message-&amp;gt;attach($this-&amp;gt;getFolderPath() . '/' . $file-&amp;gt;filename, array(&#xA;                    'fileName' =&amp;gt; $file-&amp;gt;title . '.' . $file-&amp;gt;getExtension()&#xA;                ));&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    return Craft::$app-&amp;gt;mailer-&amp;gt;send($message);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-02-23T18:19:32.947" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="23809" PostTypeId="2" ParentId="23768" CreationDate="2018-02-12T14:36:51.437" Score="1" Body="&lt;p&gt;I found a way to use the &lt;a href=&quot;https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr&quot; rel=&quot;nofollow noreferrer&quot;&gt;RetconHTML&lt;/a&gt; plugin for what I wanted. I just utilized the Attr filter and it worked the way I wanted. I had to also remove the way Retcon would add spaces to appended strings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.paragraph | retconAttr('a', { href : '?some_text' ~ entry.title|kebab }, false) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By including &lt;code&gt;false&lt;/code&gt;, it adds to the already existing href, rather than overwriting it. &lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="7706" LastEditDate="2018-02-13T15:20:42.207" LastActivityDate="2018-02-13T15:20:42.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23810" PostTypeId="2" ParentId="23806" CreationDate="2018-02-12T14:37:11.653" Score="7" Body="&lt;p&gt;You have to create the folder where you want to include your plugins by yourself. There are no requirements how you name it. Let's say you want to create the folder &lt;code&gt;plugins&lt;/code&gt; in your Craft folder, then you have to include the plugin in your &lt;code&gt;composer.json&lt;/code&gt; like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;   &quot;php&quot;: &quot;&amp;gt;=7.0.0&quot;,&#xA;   ....&#xA;   &quot;namespace/pluginhandle&quot;: &quot;your version&quot;,&#xA;   &quot;secondred/form-builder&quot;: &quot;^1.0&quot; (&amp;lt;--- example how it could look like)&#xA;},&#xA;&quot;repositories&quot;: [&#xA;{&#xA;  &quot;type&quot;: &quot;path&quot;,&#xA;  &quot;url&quot;: &quot;plugins/yourPluginFolderName&quot;&#xA;},&#xA;{&#xA;  &quot;type&quot;: &quot;path&quot;,   &#xA;  &quot;url&quot;: &quot;plugins/form-builder&quot; (&amp;lt;--- example how it could look like)&#xA;},&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll need access to your server via ssh and do &lt;code&gt;composer update&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-12T14:37:11.653" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23812" PostTypeId="1" AcceptedAnswerId="23826" CreationDate="2018-02-12T16:42:10.523" Score="1" ViewCount="453" Body="&lt;p&gt;How do you guys handle different paths between local and production environments regarding css and js files in your template twig files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am following the tutorials of nystudio107, which are simply awesome but can't see how this is be solved even in his pre-ready and configured craft3 download packages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in local dev I'd like to keep the css and js files separated from each other and unminified for better debugging. On production the files are combined and minified with gulp and moved to a /dist/css – /dist/js folder, which then does not matches the layout path I set in the twig files. Do you ran into similar problems and use a performant solution or do you hardcode the paths to the files on production environment?&lt;/p&gt;&#xA;" OwnerUserId="7900" LastActivityDate="2018-02-13T13:15:01.610" Title="Handling path to assets (css, js) between local and production environment" Tags="&lt;assets&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23813" PostTypeId="1" CreationDate="2018-02-12T17:48:32.653" Score="1" ViewCount="192" Body="&lt;p&gt;I'm trying to speed up this page: &lt;a href=&quot;http://planned2perfection.co.uk/what-we-do&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://planned2perfection.co.uk/what-we-do&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes it has a lot of images but I think it's TTFB that's the issue here. It's built with Structures which I'm thinking could be the bottle neck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that something which will improve in Craft 3? Any tips of what I can do to help improve it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&quot;grid__col-sizer&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;grid__gutter-sizer&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-item&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-item__inner {% if entry.type.handle == 'image' %}grid-item--image{% endif %}&quot;&amp;gt;&#xA;      {% if entry.type.handle == 'image' %}&#xA;      {% for image in entry.image %}&#xA;      {# Build the markup for the media queries with the image dimensions. #}&#xA;      {% set firstMediaQueryWidth = 320 %}&#xA;      {% set firstMediaQueryHeight = ( image.getHeight('galleriesThumb') / ( image.getWidth('galleriesThumb') / firstMediaQueryWidth ) ) %}&#xA;      {% set secondMediaQueryWidth = 282 %}&#xA;      {% set secondMediaQueryHeight = ( image.getHeight('galleriesThumb') / ( image.getWidth('galleriesThumb') / secondMediaQueryWidth ) ) %}&#xA;      {% set thirdMediaQueryWidth = 330 %}&#xA;      {% set thirdMediaQueryHeight = ( image.getHeight('galleriesThumb') / ( image.getWidth('galleriesThumb') / thirdMediaQueryWidth ) ) %}&#xA;      {% set fourthMediaQueryWidth = 382 %}&#xA;      {% set fourthMediaQueryHeight = ( image.getHeight('galleriesThumb') / ( image.getWidth('galleriesThumb') / fourthMediaQueryWidth ) ) %}&#xA;      {% set firstMediaQueryData = firstMediaQueryData ~ &quot;.open-pop[href=\&quot;#item-p#{ pageNum }#{ loopIndex }\&quot;] img { width: #{firstMediaQueryWidth}px; height: #{firstMediaQueryHeight|round}px }&quot; %}&#xA;      {% set secondMediaQueryData = secondMediaQueryData ~ &quot;.open-pop[href=\&quot;#item-p#{ pageNum }#{ loopIndex }\&quot;] img { width: #{secondMediaQueryWidth}px; height: #{secondMediaQueryHeight|round}px }&quot; %}&#xA;      {% set thirdMediaQueryData = thirdMediaQueryData ~ &quot;.open-pop[href=\&quot;#item-p#{ pageNum }#{ loopIndex }\&quot;] img { width: #{thirdMediaQueryWidth}px; height: #{thirdMediaQueryHeight|round}px }&quot; %}&#xA;      {% set fourthMediaQueryData = fourthMediaQueryData ~ &quot;.open-pop[href=\&quot;#item-p#{ pageNum }#{ loopIndex }\&quot;] img { width: #{fourthMediaQueryWidth}px; height: #{fourthMediaQueryHeight|round}px }&quot; %}&#xA;      &amp;lt;style&amp;gt;&#xA;         @media screen and (min-width: 500px) {&#xA;         {{firstMediaQueryData|raw}}&#xA;         }&#xA;         @media screen and (min-width: 990px) {&#xA;         {{secondMediaQueryData|raw}}&#xA;         }&#xA;         @media screen and (min-width: 1200px) {&#xA;         {{thirdMediaQueryData|raw}}&#xA;         }&#xA;         @media screen and (min-width: 1600px) {&#xA;         {{fourthMediaQueryData|raw}}&#xA;         }&#xA;      &amp;lt;/style&amp;gt;&#xA;      &amp;lt;a href=&quot;#item-p{{ pageNum }}{{ loopIndex }}&quot; class=&quot;open-pop&quot;&amp;gt;&#xA;         &amp;lt;div class=&quot;grid-item__image&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;image-block-thumb&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;img class=&quot;lazyload&quot; src=&quot;data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&quot; data-src=&quot;{{ image.getUrl('galleriesThumb')}}&quot; alt=&quot;{{ image.title}}&quot; /&amp;gt;&#xA;            &amp;lt;noscript&amp;gt;&#xA;               &amp;lt;img src=&quot;{{ image.getUrl('galleriesThumb')}}&quot; alt=&quot;{{ image.title}}&quot; /&amp;gt;&#xA;            &amp;lt;/noscript&amp;gt;&#xA;            {% endfor %}&#xA;         &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;      {% if entry.shortDescription is not empty %}&#xA;      &amp;lt;div class=&quot;block-short-description&quot;&amp;gt;{{ entry.shortDescription }}&amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;      {% endif %}&#xA;      {% if entry.type.handle == 'video' %}&#xA;      &amp;lt;div class=&quot;video-container&quot;&amp;gt;&#xA;         &amp;lt;div id=&quot;myElement-{{ entry.mediaId }}&quot; class=&quot;video&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;script&amp;gt;&#xA;         var playerInstance = jwplayer(&quot;myElement-{{ entry.mediaId }}&quot;);&#xA;         playerInstance.setup({&#xA;         file: &quot;//content.jwplatform.com/videos/{{ entry.mediaId }}-{{ entry.mediaType }}&quot;,&#xA;         image:&quot;http://content.jwplatform.com/thumbs/{{ entry.mediaId }}-480.jpg&quot;,&#xA;                        stretching:&quot;fill&quot;,&#xA;                        preload: &quot;none&quot;,&#xA;             mediaid: &quot;{{ entry.mediaId }}&quot;,&#xA;             logo: {&#xA;                hide: true,&#xA;            },&#xA;         });&#xA;      &amp;lt;/script&amp;gt;&#xA;      {% if entry.shortDescription is not empty %}&#xA;      &amp;lt;div class=&quot;block-short-description&quot;&amp;gt;{{ entry.shortDescription }}&#xA;      &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;      {% endif %}&#xA;      {% if entry.type.handle == 'text' %}&#xA;      &amp;lt;div class=&quot;block-text {% if entry.quote %}block-quote{% endif %}&quot;&amp;gt;{{ entry.textArea }}&amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;   &amp;lt;/div&amp;gt;&#xA;   &amp;lt;div id=&quot;item-p{{ pageNum }}{{ loopIndex }}&quot; class=&quot;white-popup mfp-hide&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;white-popup__inner&quot;&amp;gt;&#xA;         &amp;lt;div class=&quot;img-container&quot;&amp;gt;&#xA;            {% if entry.type.handle == 'image' %}&#xA;            {% if images.getWidth() &amp;lt; images.getHeight() %}&#xA;            &amp;lt;img src=&quot;{{ images.url ('galleriesLargePortrait') }}&quot; alt=&quot;{{ images.title }}&quot;&amp;gt;&#xA;            {% if entry.description is not empty %} &#xA;            &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;               {{ entry.description }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;            {% else %}&#xA;            {% if entry.category.first.slug == 'venues' %}&#xA;            &amp;lt;img src=&quot;{{ images.url ('galleriesLargeVenues') }}&quot; alt=&quot;{{ images.title }}&quot;&amp;gt;&#xA;            {% else %}&#xA;            &amp;lt;img src=&quot;{{ images.url ('galleriesLarge') }}&quot; alt=&quot;{{ images.title }}&quot;&amp;gt;&#xA;            {% endif %}&#xA;            {% if entry.description is not empty %}   &#xA;            &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;               {{ entry.description }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;            {% endif %}&#xA;            {% endif %}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;           &amp;lt;/div&amp;gt;&#xA;           &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2018-02-12T18:54:13.983" Title="Improving page performance issue" Tags="&lt;structure&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23814" PostTypeId="2" ParentId="23813" CreationDate="2018-02-12T18:48:12.983" Score="2" Body="&lt;p&gt;I'm not 100% sure if your images causing all the trouble because other pages without any images are really slow (compared to how fast they should be) as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there is an issue with your server performance overall or you have something in your other layout templates that are causing trouble or you use some &quot;not so well designed&quot; plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that you can always see what DB queries are happening in a given request by enabling &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dev Mode&lt;/a&gt; and checking your browser’s Javascript console, where all DB queries for the current request will be logged, ordered by how long they took. If you don't understand what they mean - maybe you could share your results here after you removed the parts you don't want us to see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the issue is DB related you should be able to find it really quickly. However over all you should really avoid all these &lt;code&gt;style&lt;/code&gt; tags and use proper css classes. That's usually bad practice and can slow your page down as well since you have to create/render so many tags every single time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another good idea might be to lazy load your images. I know you use a front-end based lazy load but I mean a server based lazy load like many other pages. So you load about 10-15 elements during the creation of the DOM and the rest after the client scrolls down with Ajax. Your DOM is really huge, I didn't count the number of elements you fetch but if you halve them and notice a high performance boost you should really give it a try. If you wan't I can create the script/plugin for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last question: how did you structure your backend? Are all those images/texts/videos custom entries that you relate with your page?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-12T18:54:13.983" LastActivityDate="2018-02-12T18:54:13.983" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23815" PostTypeId="1" CreationDate="2018-02-12T18:56:30.370" Score="1" ViewCount="360" Body="&lt;p&gt;I'm creating a user profile form on the front-end of our website. I've removed all template code and replaced it with the &lt;a href=&quot;https://craftcms.com/docs/templating/user-profile-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation code&lt;/a&gt; from the Craft website. I updated the docs code to reflect fields that we're using, rather than the example fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon clicking the Save Profile button, the next thing I get is this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;**Bad Request**&#xA;&#xA;POST param “redirect” was invalid.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've changed the redirect action input to multiple values, but none work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft 2.6.3008.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update: Here's the form:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account/profile?m=updated&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;firstName&quot;&amp;gt;First Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;firstName&quot; name=&quot;firstName&quot; value=&quot;{{ currentUser.firstName }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;lastName&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;lastName&quot; name=&quot;lastName&quot; value=&quot;{{ currentUser.lastName }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The form is located at account/profile. I'm asking it to return to the same template, just with a parameter appended to the address to verify the form was updated.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2018-02-12T20:21:09.240" LastActivityDate="2018-02-13T14:51:48.400" Title="Bad Request POST param “redirect” was invalid" Tags="&lt;user-profile&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23816" PostTypeId="1" CreationDate="2018-02-12T19:19:11.917" Score="1" ViewCount="627" Body="&lt;p&gt;I need to make a &quot;keywords&quot; field on a front-end &lt;a href=&quot;https://craftcms.com/docs/templating/entry-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry form&lt;/a&gt; that can create tags in the cms (Craft 2).  I am fully aware of existing tickets regarding this issue like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1171/how-to-add-a-tags-field-to-an-entry-form&quot;&gt;Brandon Kelly's&lt;/a&gt; but they're a little too ambiguous for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the classic tag field where you type a word, press spacebar, and a new tag appears, etc.  I am aware that when my form submits, despite what's visual on the page, the submitted html needs to look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldName]&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldName][]&quot; value=&quot;{tag 1 id}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldName][]&quot; value=&quot;{tag 2 id}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[fieldName][]&quot; value=&quot;{tag 3 id}&quot;&amp;gt;&#xA;// etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've looked into many jquery plugins and they don't output this html pattern. Instead, they all basically create a single hidden input field with all your tags entered in the value attribute separated by commas like &lt;code&gt;value=&quot;tag1, tag2, tag3, etc&quot;&lt;/code&gt;, (&lt;a href=&quot;https://github.com/aehlke/tag-it&quot; rel=&quot;nofollow noreferrer&quot;&gt;tag-it&lt;/a&gt; is one exception but it is outdated, buggy, and it always prints the tag's text in the value).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure how this all should work, but I'm guessing I need to write custom ajax so that when a tag is created, an ajax call uses the &lt;code&gt;createTag&lt;/code&gt; action to create the tag in the database before the form submits, since the &lt;code&gt;saveEntry&lt;/code&gt; form submission itself won't create the tag but merely link an existing tag to that entry.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, just as it's shown in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1171/how-to-add-a-tags-field-to-an-entry-form&quot;&gt;Brandon's original answer&lt;/a&gt;, my js adds the hidden input formatted correctly in the successful response. If the user deletes a tag, I have to use the jquery plugin's &lt;code&gt;removeTag&lt;/code&gt; callback (or whatever the callback is) to then remove that hidden input.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, where I'm getting confused is on these points:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When a user deletes a tag on the front-end (let's say they made a typo), the js deletes the hidden input in the html, but the tag is already created in the database. Do I need to then somehow delete that tag in the database via ajax or just let my db rack up a bunch of unusable tags?&lt;/li&gt;&#xA;&lt;li&gt;Is it better to just do away with the hidden input approach, use a plugin to accept the comma-separated tags from one hidden input and do all the creating/checking for existing tags/etc on a &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt; as Ben seems to suggest in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13125/plugin-tags-field-for-front-end-entry-form&quot;&gt;this ticket&lt;/a&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer up actual examples of what they did to handle tags on the front end? Maybe also some suggestions of solid jquery plugins in 2018 (many seem janky and not up to date)?  And is my process of thinking outlined above incorrect in any way (I have very little idea what I'm doing)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current examples online are either for listing out &lt;em&gt;existing&lt;/em&gt; tags the user can choose from with checkboxes or a multiselect (which is usually not the case on a form), or just showing some basic ajax. Any help and clarification would be greatly appreciated (and hopefully help someone else down the line).&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-02-13T16:36:46.903" Title="Help with tags input field on a front-end entry form" Tags="&lt;tags&gt;&lt;frontend-form&gt;&lt;entry-form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23817" PostTypeId="2" ParentId="23701" CreationDate="2018-02-12T20:34:39.907" Score="1" Body="&lt;p&gt;Email that is sent from your server is often marked as spam, this is not anything to do with either Craft or Freeform but with the fact that the server you use may not be trusted by email providers. Read the article Brad recommended for some background info. Then do yourself a favour and use a transactional email service to deal with all the hassle for you, sending email from their servers. A lot of them are free for smaller use. I use Postmark, you can easily implement it in Craft, see &lt;a href=&quot;https://postmarkapp.com/support/article/1019-use-postmark-to-send-emails-from-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://postmarkapp.com/support/article/1019-use-postmark-to-send-emails-from-craft&lt;/a&gt; &#xA;I've also used Sendgrid in Craft with succes (with a little help from this page &lt;a href=&quot;https://mediasurgery.co.uk/video-episodes/craft/make-sure-those-crucial-emails-get-delivered-with-craft-cms-and-sendgrid&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mediasurgery.co.uk/video-episodes/craft/make-sure-those-crucial-emails-get-delivered-with-craft-cms-and-sendgrid&lt;/a&gt;). Others include Mailgun, Sparkpost, or just Google 'transactional email service' for others.&lt;/p&gt;&#xA;" OwnerUserId="7988" LastActivityDate="2018-02-12T20:34:39.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23818" PostTypeId="2" ParentId="23815" CreationDate="2018-02-12T21:26:20.067" Score="2" Body="&lt;p&gt;&lt;strong&gt;UPDATE and final answer&lt;/strong&gt;: The culprit was having the general config setting &lt;code&gt;validateUnsafeRequestParams =&amp;gt; true&lt;/code&gt; and not having my redirect value hashed (&lt;code&gt;{{ 'account/profile' | hash }}&lt;/code&gt;). I had completely forgotten I had that setting turned on. Mijingo has a good explainer of how this setting works: &lt;a href=&quot;https://mijingo.com/blog/hashing-redirect-params-in-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mijingo.com/blog/hashing-redirect-params-in-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll still use the flash notice below for this particular case, but now I know what this error message comes from.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My goal was that I was trying to redirect the form back to the same template, only with an appended parameter on the URL so I could write an update notice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never found out why I got the error, but ultimately it didn't matter as I found a better way of creating that notice through this answer &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15600/get-post-data-after-submitting-user-profile-form-for-success-message?rq=1&quot;&gt;here&lt;/a&gt;. Just by adding this to my template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.session.getFlash('notice') == 'User saved.'|t %}&#xA;  &amp;lt;p&amp;gt;Success message!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2018-02-13T14:51:48.400" LastActivityDate="2018-02-13T14:51:48.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23819" PostTypeId="2" ParentId="23800" CreationDate="2018-02-12T21:38:53.127" Score="3" Body="&lt;p&gt;Garnish’s Base class introduces its own concept of events, that is separate from DOM events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s how you’d set up the listener:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-javascript prettyprint-override&quot;&gt;&lt;code&gt;// get the Craft.MatrixInput object&#xA;var matrix = $('.matrix-field').data('matrix');&#xA;&#xA;// attach a handler to its block sorter's sortChange event&#xA;matrix.blockSort.on('sortChange', function() {&#xA;    // event handler...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-02-12T21:38:53.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23820" PostTypeId="2" ParentId="23805" CreationDate="2018-02-12T21:41:49.760" Score="1" Body="&lt;p&gt;You need access to the server your Craft site is installed on to install the plugin code in the &lt;code&gt;craft/plugins&lt;/code&gt; folder.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to that, you will need administrator access to the Craft Control Panel to access Settings-&gt;Plugins in order to install any plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely, you'll need to contact the administrator of your site or whomever developed/still maintains it to progress.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-12T21:41:49.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23821" PostTypeId="2" ParentId="23816" CreationDate="2018-02-12T22:47:26.717" Score="2" Body="&lt;p&gt;First of all generally it's a really good idea to check how Pixel and Tonic has handled all the things. I know many people tend to dislike this hint but it's the best thing you can do. The developers are really good, they make good and useful comments and - at least for Craft 3 - they take care of the PHP Doc (in Craft 2 too but not as well) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run into issues/trouble the first thing I usually do is do dig into the well documented source code and check what they did.&#xA;As far as I can see in your question you already started to do that too which is great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm just too paranoid but you should &lt;strong&gt;never&lt;/strong&gt; delete or insert something without checking it and of course you should not leave tags in your DB either. Your page could become slow if you don't remove them. The best thing to do: check if the tag is used in your controller and delete it if it has no relations/uses after the jQuery remove callback. That leads me to my next hint: many people try to avoid a custom controller but mostly it's so much easier to use Crafts/Yiis power instead of trying to avoid work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like you already stated you could spend multiple hours to search for a good jQuery plugin to avoid 2-3 lines of php code or you can just extend the &lt;code&gt;EntriesController&lt;/code&gt;, copy the save function and include a few lines to deserialize the tag input. I don't really use jQuery (only angular) so I can't suggest you a plugin for that but as soon as you create a custom controller you are free enough to use the plugin you like and not the one that avoids php. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - what I would suggest is the following. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find a jQuery plugin that has the following callbacks &lt;code&gt;afterInsert&lt;/code&gt; to upload the tag via ajax, &lt;code&gt;afterRemove&lt;/code&gt; so you can delete tags and maybe something that allows autocomplete &lt;/li&gt;&#xA;&lt;li&gt;Create a function to search for tags in your controller, this is for autocomplete. You'll want to return an array of possible tags that match your users input &lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;code&gt;saveTag&lt;/code&gt; function in your controller, check if the tag already exists, if so return the ID if not create a new one and return the ID. If the tag is created via autocomplete you won't need an additional Ajax request since you'll fetch the ID with the tag name &lt;/li&gt;&#xA;&lt;li&gt;Insert the ID in a hidden input &lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;code&gt;deleteTag&lt;/code&gt; function and check if the tag is used somewhere. This part is mostly copy paste. You want to take a look how Pixel and Tonic did it and copy the functionality with minor changes here and there to fit your needs&lt;/li&gt;&#xA;&lt;li&gt;Copy the entries save function and insert it in your controller. At the beginning of this function you could &lt;code&gt;explode&lt;/code&gt; the single, comma sparated hidden input into an array and that's basically it. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's the way I handled it the last time - only with angularjs instead of jQuery &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-12T22:59:01.057" LastActivityDate="2018-02-12T22:59:01.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23822" PostTypeId="1" AcceptedAnswerId="23824" CreationDate="2018-02-12T23:22:10.680" Score="1" ViewCount="421" Body="&lt;p&gt;I have a search page where a user can check about 20 different checkboxes, where these checkboxes all relate to tags I have set up inside of Craft. I would like to perform the following search query:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all of the tags selected, I would like to return a list of entries that have ALL of these tags. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The user clicks the checkboxes, &quot;SCC&quot; and &quot;HVT&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A query should be performed that returns only the entries that have the tags, &quot;SCC&quot; AND &quot;HVT&quot;. I have been reading Craft docs for the past 3 hours, and am not grasping this concept at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is hardcoded, but I was just experimenting, and it does not work at all:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('journalArticles').relatedTo('and', { targetElement: 'SCC' }, { targetElement: 'HPV' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do not want to use a plugin if I don't have to.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-02-13T09:04:28.413" Title="Get Entries That Match ALL of the tags specified" Tags="&lt;tags&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23823" PostTypeId="2" ParentId="22088" CreationDate="2018-02-13T02:18:44.017" Score="4" Body="&lt;ul&gt;&#xA;&lt;li&gt;Make sure your fonts are TTF.&lt;/li&gt;&#xA;&lt;li&gt;If you're loading them by remote URL, make sure the &lt;code&gt;isRemoteEnabled&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If you're changing weights, make sure to use the named weights in your CSS (&lt;code&gt;normal&lt;/code&gt;, &lt;code&gt;bold&lt;/code&gt;) rather than numeric weights.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(These are limitations of the underlying DOMPDF library, which is used in Printmaker 1.x. The next release of Printmaker, for Craft 3, uses a much nicer rendering engine, which will eliminate these limitations.)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="689" LastActivityDate="2018-02-13T02:18:44.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23824" PostTypeId="2" ParentId="23822" CreationDate="2018-02-13T08:57:59.763" Score="2" Body="&lt;p&gt;&lt;strong&gt;Short version&lt;/strong&gt;&lt;br&gt;&#xA;change the title into an id and it will work&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('journalArticles').relatedTo(&#xA;    'and', &#xA;    { targetElement: &amp;gt;&amp;gt;idOfYourElement&amp;lt;&amp;lt; }, &#xA;    { targetElement: &amp;gt;&amp;gt;idOfYourElement&amp;lt;&amp;lt; }) &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Long version&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It looks a little bit nasty (I never do these kind of things in twig because I don't like the syntax and prefer PHP for many reasons) but here you can see a working example for a twig search form&lt;/p&gt;&#xA;&lt;p&gt;first your html: it could be like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA;    {# loop all your tags and display a checkbox for each one #}&#xA;    {# Important: insert the id of your tag as value not the title #}&#xA;    {% for tag in craft.tags.group('default') %}&#xA;        &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;selectedTags[]&amp;quot; value=&amp;quot;{{ tag.id }}&amp;quot;&amp;gt;{{ tag.title }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;br&amp;gt;&#xA;    &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;submit&amp;quot; name=&amp;quot;submit&amp;quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And your twig&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set isSubmitted = craft.request.getParam('submit') %}&#xA;{% if isSubmitted %}&#xA;    {# get all selected input ids #}&#xA;    {% set allRelatedTags = craft.request.getParam('selectedTags') %}&#xA;    &#xA;    {# proceed only if the user selected at least one tag #}&#xA;    {% if allRelatedTags %}&#xA;        {# build your related to array #}&#xA;        {% set relations = ['and'] %}&#xA;    &#xA;        {# inlcude an additional 'targetElement' for each selected tag #}&#xA;        {% for tag in allRelatedTags %}&#xA;            {% set relations =  relations|merge([{targetElement: tag}])%}&#xA;        {% endfor %}&#xA;        &#xA;        {# search for entries with the related parameters #}&#xA;        {% for entry in craft.entries.relatedTo(relations).find() %}&#xA;            {{ entry.title }}&amp;lt;br&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The reason why your code did not work is quite simple as you can see in the &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;relatedTo documentation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In its simplest form, you can pass in one of these things to it:&lt;/p&gt;&#xA;&lt;p&gt;An AssetFileModel, CategoryModel, EntryModel, UserModel, or TagModel object&lt;/p&gt;&#xA;&lt;p&gt;An element’s ID&lt;/p&gt;&#xA;&lt;p&gt;An array of element objects and/or IDs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;you inserted the not unique title which could be everything. So all you have to do is to insert the id of your element instead of the title... that's it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-02-13T09:04:28.413" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23825" PostTypeId="1" CreationDate="2018-02-13T09:09:11.563" Score="1" ViewCount="32" Body="&lt;p&gt;I have a plugin that is creating a custom field. I am using the &lt;code&gt;modifyUserSortableAttributes&lt;/code&gt; method to make my field appear in the columns available for the Users Table and wanted to be able to sort and filter by this column. The field values is stored as a simple alphanumeric string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More on hook/method at &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#modifyUserSortableAttributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/hooks-reference#modifyUserSortableAttributes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Call in plugin code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineAdditionalUserTableAttributes()&#xA;{&#xA;    return array(&#xA;        'institution' =&amp;gt; &quot;Institution&quot;&#xA;    );&#xA;}&#xA;&#xA;public function modifyUserSortableAttributes(&amp;amp;$attributes)&#xA;{&#xA;    $attributes['institution'] = Craft::t('Institution');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I use this method whilst I can add the requisite column to my User table in the admin area and sort the fields alphabetically in ascending order I cannot sort the table by descending order. No errors turning up in the console or site logs. Any suggestions on resolving or debugging greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-04-14T23:32:21.003" Title="Getting `modifyUserSortableAttributes` to work during plugin development" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23826" PostTypeId="2" ParentId="23812" CreationDate="2018-02-13T13:15:01.610" Score="1" Body="&lt;p&gt;If you are using Craft 3 Multi-Environment then you can add environment specific aliases to those assets in your &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment/blob/master/config/general.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;general config file&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Live (production) environment&#xA;'live' =&amp;gt; [&#xA;    // Craft defined config settings&#xA;    'allowUpdates' =&amp;gt; false,&#xA;    'backupOnUpdate' =&amp;gt; false,&#xA;    'devMode' =&amp;gt; false,&#xA;    'enableTemplateCaching' =&amp;gt; true,&#xA;    'isSystemOn' =&amp;gt; true,&#xA;    // Aliases parsed in sites’ settings, volumes’ settings, and Local &#xA;    volumes’ settings&#xA;    'aliases' =&amp;gt; [&#xA;      '@assetPath' =&amp;gt; '/dist/'&#xA;    ],&#xA;    // Custom site-specific config settings&#xA;    'custom' =&amp;gt; [&#xA;&#xA;    ]&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in your templates you can use &lt;code&gt;{{ alias('@assetPath/js/' }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, while I've called the alias assetPath, you can name it anything you like.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-02-13T13:15:01.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23827" PostTypeId="1" AcceptedAnswerId="23846" CreationDate="2018-02-13T13:25:14.907" Score="2" ViewCount="802" Body="&lt;p&gt;I have a structure that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Experiment ( Level 1)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cages (Level 2)&lt;/li&gt;&#xA;&lt;li&gt;Animals (Level 3)&lt;/li&gt;&#xA;&lt;li&gt;Measurement (Level 4)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am outputting this information into some inline JSON like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mice = craft.entries({&#xA;    'section' : 'experiments',&#xA;    'level' : 3,&#xA;    'descendantOf' : entry.id,&#xA;}) %}&#xA;&#xA;&amp;lt;script&amp;gt;&#xA;  var data = [&#xA;    {% for mouse in mice %}&#xA;    {&#xA;      &quot;Cage&quot;: &quot;{{ mouse.parent.title }}&quot;,&#xA;      &quot;Mouse&quot;: &quot;{{ mouse.title }}&quot;,&#xA;      &quot;measurements&quot;: [&#xA;        {% for data in mouse.children.order('postDate') %}&#xA;        {&#xA;          &quot;Date&quot;: &quot;{{ data.postDate| date(&quot;d-M&quot;) }}&quot;,&#xA;          &quot;Weight(g)&quot;: &quot;{{ data.weight }}&quot;,&#xA;          &quot;Length&quot;: &quot;{{ data.length }}&quot;,&#xA;          &quot;Depth&quot;: &quot;{{ data.depth }}&quot;,&#xA;          &quot;Tumor Volume&quot;: {{ data.tumourVolume }}&#xA;        }{% if not loop.last %}, {% endif %}&#xA;        {% endfor %}&#xA;      ]&#xA;    }{% if not loop.last %}, {% endif %}&#xA;    {% endfor %}&#xA;  ];&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is ok until entries start to increase, the TTFB begins to add up significantly - I am wondering if there is a way to eager load this sort of structure? The entries are very dynamic so caching isn't an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3839" LastEditorUserId="125" LastEditDate="2018-02-14T10:19:28.050" LastActivityDate="2018-02-14T10:19:28.050" Title="Eager-Loading child elements in a multi-level structure section" Tags="&lt;structure&gt;&lt;eager-loading&gt;&lt;children&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23829" PostTypeId="1" CreationDate="2018-02-13T14:48:58.410" Score="3" ViewCount="100" Body="&lt;p&gt;I'm currently Authenticating users via OAuth and Social Login by Dukt. I have Facebook app all set up and running as well as Twitter. The user gets redirected, asked to Authorise but when it returns back to the Craft website the user hasn't been created or exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current setup is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Connected Facebook to OAuth&lt;/li&gt;&#xA;&lt;li&gt;Connected Facebook with Social Login&lt;/li&gt;&#xA;&lt;li&gt;Activated my Facebook app so it's &quot;Live&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My questions are as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I haven't got a config file for the user, do we need to create this?&lt;/li&gt;&#xA;&lt;li&gt;Do you need to add &quot;Fields&quot; to the &quot;User&quot; in Craft CP such as Username/Email? If so - which ones are the defaults for social login?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-02-13T14:48:58.410" Title="Dukt Social Plugin Not Creating User" Tags="&lt;users&gt;&lt;registration&gt;&lt;plugin-duktoauth&gt;&lt;plugin-social-login&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23831" PostTypeId="1" CreationDate="2018-02-13T15:23:07.387" Score="1" ViewCount="579" Body="&lt;p&gt;Is there a simple way to handle returned or partially returned orders in Craft Commerce?&#xA;I'm building a site for a shop that has to deal with a lot of returned orders (woman's dresses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very common situation would be: &#xA;- A customer orders a product in 3 different sizes&#xA;- The customer returns 2 of those sizes and keeps the correct size&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good way to handle this in Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since all the items in the shop have a limited stock it's a lot of manual work to go to every individual single item and change the stock quantity for every returned item. Is the possible to re-add the returns items to the stock in an easier way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to partially refund and order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the total revenue overview on the dashboard displays the total amount of all orders and doesn't keep track of refunded items. Can this be changed?&lt;/p&gt;&#xA;" OwnerUserId="7989" LastActivityDate="2018-11-16T23:20:31.590" Title="Craft Commerce returned orders stock and refund handling" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23832" PostTypeId="2" ParentId="23816" CreationDate="2018-02-13T16:29:54.463" Score="2" Body="&lt;p&gt;I don't have any example code to offer, as I've never had a need to do something like this, but the way I see it there are 2 basic approaches:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use Javascript on form submission to first create the tags with an AJAX call.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a custom plugin controller to handle the tag creation before passing the call on to it to the entry controller. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Either way I would use Javascript to manipulate the tag field before submitting, for example by converting &lt;code&gt;fieldName=&quot;tag1, tag2, tag3&quot;&lt;/code&gt; to &lt;code&gt;fields[fieldName][]=tag1&amp;amp;fields[fieldName][]=tag2&amp;amp;fields[fieldName][]=tag3&lt;/code&gt;&#xA;That way regardless which jQuery plugin you use, you're guaranteed to receive the right fields in the controller. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you want to handle deletion of unused tags, you can simply do that with a custom plugin listening for the &lt;code&gt;entry.onAfterSave&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure that I've said anything that is new to you here, but you're not really asking a concrete question either. If you need to use tags then this is the process that I would follow, otherwise you might consider a simpler solution to whatever problem it is that you're trying to solve using tags, as my feeling is that they were intended for use in the CP rather than the front-end.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2018-02-13T16:36:46.903" LastActivityDate="2018-02-13T16:36:46.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23833" PostTypeId="1" AcceptedAnswerId="23835" CreationDate="2018-02-13T17:11:08.460" Score="1" ViewCount="62" Body="&lt;p&gt;I've got a client who would like to be able to assign a notification recipient for each entry where a form appears. I would imagine that a new form needs to be created for each recipient, but is there a way to take the form handle, add it to an entry then output that form on a page? Or is there a better way to do it?&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="57" LastEditDate="2018-02-13T23:41:26.000" LastActivityDate="2018-02-13T23:41:26.000" Title="Solspace FreeForm assign notifications recipient in entry" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23834" PostTypeId="1" CreationDate="2018-02-13T18:36:31.447" Score="1" ViewCount="250" Body="&lt;p&gt;SugarCRM has a REST API, and Craft boasts its ability to integrate with almost anything that has an API; however, I am working on a site that uses Sprout Forms, which doesn't mention anything in their docs about integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way, in addition to emails and saved entries, for Craft to push Sprout Form data to SugarCRM?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this isn't possible, if there another contact form solution that will integrate this way?&lt;/p&gt;&#xA;" OwnerUserId="7991" LastEditorUserId="57" LastEditDate="2018-02-13T23:39:55.910" LastActivityDate="2018-03-23T22:13:25.683" Title="How do I push contact form data to SugarCRM? (currently using Sprout Forms)" Tags="&lt;plugin-sproutforms&gt;&lt;integration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23835" PostTypeId="2" ParentId="23833" CreationDate="2018-02-13T20:24:31.983" Score="1" Body="&lt;p&gt;Not sure if I understood the question correctly but why don't you make use of the &lt;a href=&quot;https://solspace.com/craft/freeform/docs/fieldtypes/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform Forms Field&lt;/a&gt; if you want to attach a form per entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myFreeformfieldname is defined and entry.myFreeformfieldname is not empty %}&#xA;    &amp;lt;h3&amp;gt;{{ entry.myFreeformfieldname.name }}&amp;lt;/h3&amp;gt;&#xA;    {{ entry.myFreeformfieldname.render() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-13T20:24:31.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23836" PostTypeId="1" CreationDate="2018-02-13T22:12:22.573" Score="1" ViewCount="73" Body="&lt;p&gt;I'm using a category group and routes to serve up entries on landing pages with a URL structure like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.domain.com/properties/retail/freestanding&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code works, but I am wondering if there's a better way to write it (dry it up).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allProperties = craft.entries.section('propertiesSection') %}&#xA;{% set cat = craft.request.getSegment(2) %}&#xA;{% set subcat = craft.request.lastSegment %}&#xA;&#xA;{% set retail = craft.categories.group('properties').craft.categories.slug('retail-properties') %}&#xA;&#xA;{% if subcat == &quot;freestanding&quot; %}&#xA;    {% set entries = allProperties.relatedTo([ {targetElement: freestanding } ]) %}&#xA;{% endif %}&#xA;&#xA;{% if subcat == &quot;storefront&quot; %}&#xA;    {% set entries = allProperties.relatedTo([ {targetElement: storefront } ]) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.... and so on&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries|length %}&#xA;    {{ entry.title }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="57" LastEditDate="2018-02-13T23:45:34.557" LastActivityDate="2018-04-15T22:36:12.440" Title="Categories Structure for Landing Pages" Tags="&lt;category&gt;&lt;slug&gt;&lt;segments&gt;&lt;getsegment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23837" PostTypeId="2" ParentId="23825" CreationDate="2018-02-13T22:29:11.463" Score="1" Body="&lt;p&gt;The underlying issue you're running into is this, which is an issue on both Craft 2 and 3 currently: &lt;a href=&quot;https://github.com/craftcms/cms/issues/859&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/859&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't think of a clean way to work around it, either.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-13T22:29:11.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23839" PostTypeId="1" AcceptedAnswerId="23840" CreationDate="2018-02-13T23:29:07.050" Score="1" ViewCount="324" Body="&lt;p&gt;A long time ago &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16491/does-twigs-addglobal-exist-in-craft&quot;&gt;I asked how I could utilise the getGlobal method in Craft 2.x&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know how best to do this in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2018-02-14T16:12:35.420" LastActivityDate="2018-02-14T16:12:35.420" Title="Defining TwigExtension globals in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23840" PostTypeId="2" ParentId="23839" CreationDate="2018-02-13T23:29:07.050" Score="2" Body="&lt;p&gt;There are two ways to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add this in your plugin/module main init function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      $twig = Craft::$app-&amp;gt;view-&amp;gt;getTwig(null, ['safe_mode' =&amp;gt; false]);&#xA;      $twig-&amp;gt;addGlobal('foo', 'bar');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's it. You can call 'foo' in your template like this &lt;code&gt;{{ foo }} // Output 'bar'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2 (best)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the root of your plugin/module directory, create a folder called 'twigextensions' if you don't already have one. Create a new file where you're going to define your globals. &lt;code&gt;MyGlobals.php&lt;/code&gt; for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the very top of your main plugin/module file, you need to add this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use modules\myawesomemodile\twigextensions\MyGlobals;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... remembering to amend the plugin/module name, and the name of the file you created. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then add the following to the same file. Only this needs to be inside your main init function: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;view-&amp;gt;registerTwigExtension(new MyGlobals());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lastly, in your new MyGlobals.php file. Add the following. Again changning the plugin/module names where appropriate. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\myawesomemodule\twigextensions;&#xA;&#xA;use modules\myawesomemodule\MyAwesomeModule;&#xA;&#xA;use Craft;&#xA;&#xA;class MyGlobals extends \Twig_Extension implements \Twig_Extension_GlobalsInterface&#xA;{&#xA;&#xA;    public function getGlobals()&#xA;    {&#xA;        return array(&#xA;            'foo' =&amp;gt; 'bar',&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's it. Like before, you can call 'foo' in your template like this &lt;code&gt;{{ foo }} // Output 'bar'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I don't understand the technical reasons as to why one is better than the other. I prefer &lt;strong&gt;Option 2&lt;/strong&gt; because it permits me to add multiple globals. However, my old post was answered by &lt;a href=&quot;https://craftcms.stackexchange.com/users/1098/mats-mikkel-rummelhoff&quot;&gt;Mats Mikkel Rummelhoff&lt;/a&gt;; who goes into this in a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16491/does-twigs-addglobal-exist-in-craft#answer-16492&quot;&gt;little more detail&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-02-13T23:29:07.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23841" PostTypeId="2" ParentId="23831" CreationDate="2018-02-14T02:19:39.623" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce 2 now supports partial refunds for payment gateways that support partial refunds.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Partial refunds on Commerce is definitely on our radar... it's the 8th most requested feature here: &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, it's pretty impractical right now in Commerce 1 with our reliance on the &lt;a href=&quot;https://omnipay.thephpleague.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Omnipay&lt;/a&gt;  ibrary for all of our payment gateways. They support the &quot;lowest common denominator&quot; and since many of the gateways they support don't support partial refunds, they don't support it at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upcoming Commerce 2 makes Onmipay an optional requirement... meaning that it's much easier to write a plugin for an arbitrary gateway and add support for the ones that support partial refunds.  For example, the 1st party Commerce 2 &lt;a href=&quot;https://stripe.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stripe&lt;/a&gt; plugin implements it and can be used as an example for other payment gateway plugis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of that doesn't help you now, though. You can always do a partial refund directly with the gateway if they support it (Stripe, Sagepay, etc.), but the downside is that won't sync back to Commerce 1 so order totals/inventory/etc. won't be updated on our end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the payment gateway has callback hooks for that type of thing, you can write a plugin that helps alleviate some of these issues, but none of it is a really clean solution.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-11-16T23:20:31.590" LastActivityDate="2018-11-16T23:20:31.590" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23842" PostTypeId="1" AcceptedAnswerId="23843" CreationDate="2018-02-14T03:38:09.820" Score="1" ViewCount="39" Body="&lt;p&gt;My blog has different post types, e.g. full blog post, quick status, quote, image post, how would I go about it? Is the logical way to setup a single Matrix Field with each block representing a different post type? Is there a better way of doing it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stating the obvious for clarity. A full blog post would have the usual stuff (title, body, image). Status has just content without a title, it's just a quick note. Quote has text and quote author and link, again no title.&lt;/p&gt;&#xA;" OwnerUserId="5004" LastActivityDate="2018-02-14T05:42:00.203" Title="How do I setup my fields for a tumblr-like blog" Tags="&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23843" PostTypeId="2" ParentId="23842" CreationDate="2018-02-14T05:42:00.203" Score="3" Body="&lt;p&gt;I definitely would avoid using a Matrix field to add each of these types, as they'd all belong to a single entry, which isn't what you want to do (it’d get really unwieldy, really fast!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're looking to do is use different &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry types&lt;/a&gt; in your blog settings. Each entry type can have a different field layout, so you could then switch between each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s a &lt;a href=&quot;http://www.kristengrote.com/blog/wrapping-your-head-around-craft-sections-and-entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog article&lt;/a&gt; that covers the exact thing you’re trying to do.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2018-02-14T05:42:00.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23845" PostTypeId="2" ParentId="23585" CreationDate="2018-02-14T09:44:02.703" Score="0" Body="&lt;p&gt;Another option is to check the response code directly in your config/general.php file. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'devMode' =&amp;gt; http_response_code() == 200,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suspect this &quot;solution&quot; will make peoples toes curl; as it's a bit hacky and probably won't work in all cases. So I'd recommend using this only in your dev environments. &lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2018-02-14T14:15:39.103" LastActivityDate="2018-02-14T14:15:39.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23846" PostTypeId="2" ParentId="23827" CreationDate="2018-02-14T10:18:06.230" Score="3" Body="&lt;p&gt;To use eager-loading for the child elements add &lt;code&gt;'children'&lt;/code&gt; to the &lt;code&gt;with&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mice = craft.entries({&#xA;    section: 'experiments',&#xA;    level: 3,&#xA;    descendantOf: entry.id,&#xA;    with: ['children', {order: 'postDate asc'}],&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-14T10:18:06.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23847" PostTypeId="1" AcceptedAnswerId="23848" CreationDate="2018-02-14T14:07:05.973" Score="1" ViewCount="68" Body="&lt;p&gt;I have set up two sections for two different kinds of events. On one page I want to differentiate between them on the other page I want to list them all. How do I organise that best on the back end and how do I call it best in the template?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;big events&lt;/li&gt;&#xA;&lt;li&gt;small events&lt;/li&gt;&#xA;&lt;li&gt;overview for all events&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-02-14T14:21:05.273" Title="best approach to call entries from two different sections" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23848" PostTypeId="2" ParentId="23847" CreationDate="2018-02-14T14:21:05.273" Score="2" Body="&lt;p&gt;You can create one section called &lt;code&gt;events&lt;/code&gt; with the different &lt;a href=&quot;https://craftcms.com/docs/sections-and-entries#entry-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;entryTypes&lt;/a&gt; &lt;code&gt;small&lt;/code&gt; and &lt;code&gt;big&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll fetch all events with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('events')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when you want to fetch only small events you'll do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('events').type('small')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the same for the big one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However you can call entries from multiple sections too&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(['smallEvents', 'bigEvents'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suggest you to read the &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; these &lt;a href=&quot;https://straightupcraft.com/articles/cheat-sheet-craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cheet Sheets&lt;/a&gt; are a good place to learn templating too&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-14T14:21:05.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23849" PostTypeId="2" ParentId="23834" CreationDate="2018-02-14T14:26:50.547" Score="1" Body="&lt;p&gt;At the time of this posting, I don't know of any out of the box SugarCRM integration with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Craft is quite capable of integrating with almost anything, the intro section in their docs also states that it's a CMS for people who build custom websites. There are millions of potential products with REST APIs and millions of different needs in how companies need to interface with those APIs. Any specific integration will likely require some additional effort to make happen. Craft's ability to integrate with anything comes via the power and flexibility they give developers to extend the CMS for custom scenarios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms also provides several ways that it can be adapted to custom scenarios and extended to interface with other services. Each service is different and I am not familiar with SugarCRM so your mileage may vary, but here are some of the tools Sprout Forms makes available to you to customize how Forms are submitted:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/template-overrides&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; allow you to customize how your base Sprout Forms templates are formatted. In the case the endpoint you are submitting to has a particular format that fields names need to comply with, you can adjust that here.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/payload-forwarding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Payload Forwarding&lt;/a&gt; allows you to submit your form to a third-party URL instead of to Craft. In the settings area you can choose whether your data is saved to Craft or whether you want to trigger emails from Craft or if you just want to offload everything and send your form submission to a third party.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Fields&lt;/a&gt; integrates with Sprout Forms and provides a Hidden and Invisible Field if you want to include things like API Keys in your request but not have them presented to the user in the form.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;While a lot can be done with the above integration options, each situation is different and we've also run into scenarios where we needed to create a small plugin to help handle and hand off the data between Sprout Forms and another system. We have plans to improve the flexibility of these types of integrations even more as we get upgraded to Craft 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless there is a large need for a specific integration (like SugarCRM), it's likely that you won't find a specific plugin addressing the issue and that you'll be at some level custom development territory. If you do see integrations for specific platforms, it's also worth asking: how likely is it that the developer who created this plugin has enough clients using it that they will actually update the plugin in the future?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience, specific integrations often require project-specific budgets and are best handled in direct client relationships and it's important to communicate with clients and help them understand that these types of integrations may also require additional maintenance and update costs down the road that are specific to their needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We often help clients with small projects where someone needs to extend Craft or a plugin to integrate with a new third-party system and while our plugins support some integrations publicly, they support a lot more integrations privately as those private integrations often solve a specific client's needs and we need to be clear with those client's using them that they will only receive updates if someone can cover the development costs to maintain them.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-02-14T14:26:50.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23850" PostTypeId="1" AcceptedAnswerId="23897" CreationDate="2018-02-14T16:17:22.183" Score="1" ViewCount="588" Body="&lt;p&gt;Is there an equivalent to &lt;code&gt;Yoast's&lt;/code&gt; real-time content analysis for Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at &lt;code&gt;SEOmatic&lt;/code&gt; and &lt;code&gt;Sprout&lt;/code&gt;, but neither of them have the handy traffic light system that &lt;code&gt;Yoast&lt;/code&gt; has on WP (despite both are looking to be great for everything else SEO related).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to get my company to switch from WP to Craft (for the bigger projects at least), but my director considers the traffic light check-list to be an important time saver for non-techies/clients to post quality content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This feature will clinch the deal! Help me Craft Stack Exchange Kenobi, your my only(ish) hope.&lt;/p&gt;&#xA;" OwnerUserId="8000" LastEditorUserId="5012" LastEditDate="2018-02-16T19:32:38.433" LastActivityDate="2018-02-17T04:02:03.037" Title="Yoast-like real-time content analysis" Tags="&lt;plugins&gt;&lt;plugin-sproutseo&gt;&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23852" PostTypeId="2" ParentId="23786" CreationDate="2018-02-14T16:59:57.307" Score="2" Body="&lt;p&gt;The plugin expects the the ID of the entry you are using to build the form fields to be submitted along with the form so it is available as a request variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should include the ID of the entry you are using to build the form’s fields when you are submitting to the &lt;code&gt;contactForm/sendMessage&lt;/code&gt; controller. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.entries({&#xA;    section: 'forms',&#xA;    slug: 'contact-form',&#xA;}).first() %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;formId&quot; value=&quot;{{ form.id|hash }}&quot; /&amp;gt;&#xA;    ...&#xA;    {# Loop through the form fields here #}&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Send&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above assumes you have a section with the handle &lt;em&gt;forms&lt;/em&gt; and the slug of the entry you want is &lt;em&gt;contact-form&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a more robust solution that provides the form builder and validation out of the box, you might consider checking out &lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform&lt;/a&gt; from Solspace.&lt;/p&gt;&#xA;" OwnerUserId="93" LastActivityDate="2018-02-14T16:59:57.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23853" PostTypeId="2" ParentId="23850" CreationDate="2018-02-14T17:15:36.047" Score="1" Body="&lt;p&gt;Since Craft is mainly build for developers why don't you create your own plugin? From my experience Craft is a time saver all over the place and when you compare the time you need to build a complex non blog site with Craft and WP - Craft will win for sure unless you are going to build sites for less than 100$ with existing themes without writing a single line of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know Yoast and I don't really know other SEO Plugins because we made a private real time analysis tool for our customers but I know even when we consider the time we spend for this plugin, all our sites consume less time and effort with Craft than with WP. With the experience I collected within the last 3 Years I can say it's not worth to use this CMS if you are going to solve every problem with an existing plugin like for WP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii2&lt;/a&gt; + &lt;a href=&quot;https://github.com/craftcms/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft3&lt;/a&gt; have awesome and very powerful tools to extend the system however you like. There are so many great features and opportunities to customize nearly every aspect of the system within a really short amount of time and effort without loosing much performance or risk security issues. Due to it's well considered API you can create complex frontend logic really fast with plugins and &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-structure-modules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt; modules. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your director think the initial time loss is not worth it or if your company does not has the developers you need to create such a plugin it's not a good idea to move to Craft in the first place (at least that's my opinion) because as I said there are not that much plugins for Craft as there are for WP since it's so easy to solve problems and the group of customers is usually totally different &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;within a quick search: maybe &lt;a href=&quot;https://www.webtexttool.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;webtexttool&lt;/a&gt; is something you want?&lt;a href=&quot;https://github.com/iNalgiev/webtexttool&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/iNalgiev/webtexttool&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-14T17:21:04.090" LastActivityDate="2018-02-14T17:21:04.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23854" PostTypeId="1" AcceptedAnswerId="23902" CreationDate="2018-02-14T21:23:47.433" Score="1" ViewCount="1299" Body="&lt;p&gt;I've just installed Craft 3 RC with Composer. Everything went fine. I moved the contents of the &lt;strong&gt;web&lt;/strong&gt; directory to the public_html folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;domain.com/admin&lt;/em&gt;&#xA;and&#xA;&lt;em&gt;domain.com&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both give blank screens. Where should I start my troubleshooting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folder structure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.composer&#xA;craft&#xA;  config&#xA;  modules&#xA;  storage&#xA;  etc...&#xA;public_html&#xA;  /cpresources&#xA;  .htaccess&#xA;  index.php&#xA;  web.config&#xA;  test.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I add an index.html to the public_html folder, I can access it via domain.com, but I cannot access domain.com/test.php from public_html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Ben&lt;/p&gt;&#xA;" OwnerUserId="4992" LastEditorUserId="4992" LastEditDate="2018-02-15T21:49:05.677" LastActivityDate="2018-04-12T04:21:06.320" Title="Blank screen for /admin and public site with Craft 3" Tags="&lt;craft3&gt;&lt;install&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23855" PostTypeId="2" ParentId="23836" CreationDate="2018-02-14T21:47:37.370" Score="1" Body="&lt;p&gt;If you category is related to your entry there is no need to fetch the category via url segment. This method is slower and will need more resources since you'll do the work twice for no reason.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.relationFieldHandle&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will contain an &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; with a ready to use query to fetch the related elements. So &lt;code&gt;entry.relationFieldHandle.first()&lt;/code&gt; will return the category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get all entries, that are related to the category of your current entry you should do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryIds = entry.fieldHandle.ids() %}&#xA;{% set relatedEntries = craft.entries.relatedTo(categoryIds).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your code could be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = entry.fieldHandle.first() %}&#xA;{% set relatedEntries = craft.entries.section('propertiesSection').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's basically it. Note: you don't need to fetch the category to get the related entries, you only need the id. That's why I used &lt;code&gt;.ids()&lt;/code&gt; in the first example instead of &lt;code&gt;.first()&lt;/code&gt; or &lt;code&gt;.find()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-14T21:47:37.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23856" PostTypeId="2" ParentId="2423" CreationDate="2018-02-15T00:03:21.593" Score="11" Body="&lt;p&gt;And for those needing this for Craft 3...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Set (previously called 'add'):&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getSession()-&amp;gt;set($key, $value);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Get&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getSession()-&amp;gt;get($key);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2020-04-09T10:04:55.177" LastActivityDate="2020-04-09T10:04:55.177" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23858" PostTypeId="1" AcceptedAnswerId="29932" CreationDate="2018-02-15T07:47:59.143" Score="1" ViewCount="1596" Body="&lt;p&gt;How can sync the schema (fields + categories + tags + sections) from development to staging and live? Or should I do it manually?&#xA;Is there any support to make migration script instead of do it from the webpage&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-02-15T17:15:30.713" LastActivityDate="2020-06-04T19:48:49.943" Title="What is the best practice in Craft 3 to sync schema between environments?" Tags="&lt;database&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23859" PostTypeId="1" AcceptedAnswerId="23863" CreationDate="2018-02-15T09:09:31.903" Score="4" ViewCount="415" Body="&lt;p&gt;Is there any best practice how to import info Craft 3 data from external source, or should I backtrack it from the database?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-02-15T17:16:44.927" LastActivityDate="2018-02-15T17:16:44.927" Title="Database structure for Craft 3 to import from external source?" Tags="&lt;database&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23860" PostTypeId="2" ParentId="23553" CreationDate="2018-02-15T09:29:39.227" Score="2" Body="&lt;p&gt;This should be fixed as of Commerce 1.2.1354&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/changelog#build1354&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/changelog#build1354&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-02-15T09:29:39.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23861" PostTypeId="2" ParentId="23858" CreationDate="2018-02-15T09:58:24.473" Score="3" Body="&lt;p&gt;See the answer above: project config. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;You should check out Andrew Welch's post about it:&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;&lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&lt;/a&gt;&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;&lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt;&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps.: Sorry, Andrew!&lt;/p&gt;&#xA;" OwnerUserId="5905" LastEditorUserId="5905" LastEditDate="2020-06-04T19:48:49.943" LastActivityDate="2020-06-04T19:48:49.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23862" PostTypeId="1" AcceptedAnswerId="23864" CreationDate="2018-02-15T10:13:31.350" Score="2" ViewCount="45" Body="&lt;p&gt;I'm relatively new to craft, but thanks to this board I am making great progress :-) But here is my first question, which is not answered in here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to get the count of entries of a certain section, which have been published &lt;strong&gt;since the last visit of a user&lt;/strong&gt;. I'm pretty sure I have to somehow use a cookie for this, but am completely unaware of how to do this in combination with twig :(&lt;/p&gt;&#xA;" OwnerUserId="8002" LastActivityDate="2018-02-15T21:04:01.367" Title="Get count of new entries since last visit" Tags="&lt;entries&gt;&lt;count&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23863" PostTypeId="2" ParentId="23859" CreationDate="2018-02-15T10:27:23.420" Score="3" Body="&lt;p&gt;I think you have to know what you need and what you want to achieve.&#xA;You need to decide if you want to add &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-types.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;elements&lt;/a&gt; or &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-db-active-record.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;records&lt;/a&gt; because there is a huge difference between those two types of objects and how you need to import and implement them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Elements&lt;/strong&gt;&lt;br&gt;&#xA;Pros:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it does not take a lot of time to make them manageable for clients&lt;/li&gt;&#xA;&lt;li&gt;they can use all Craft features (relation fields, lists, edit forms....)&lt;/li&gt;&#xA;&lt;li&gt;they are really flexible&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Cons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;you'll need a little bit of time to dig into the concept if you are totally new to Craft&lt;/li&gt;&#xA;&lt;li&gt;they'll have a record in your &lt;code&gt;elements&lt;/code&gt; table so for larger projects you'll have to pay attention at your performance&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Records&lt;/strong&gt;&lt;br&gt;&#xA;Pros&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;easy to handle&lt;/li&gt;&#xA;&lt;li&gt;it does not require much time to create/import records since they are standalone and have no requirements&lt;/li&gt;&#xA;&lt;li&gt;Yii's activerecord object is really powerful and intuitive in searching records&lt;/li&gt;&#xA;&lt;li&gt;they don't create a massive overhead in your db&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Cons&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you are going to make your records editable to users/customers in the cp you'll need to create everything on your own (templates/forms....) because they have no field layout and it's a mess to redefine them as elements to use Craft features... I did it once, it was not funny&lt;/li&gt;&#xA;&lt;li&gt;You are not able to use Craft relations by default and have to create custom relation tables if you are going to do fancy stuff&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After you decided what to use, you have to decide how you would like to proceed. You can create a custom element type or use an existing one (entries, categories) and how complex it needs to be. But without more information from your site it's hard to give any further advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest everyone to create a custom plugin for imports to handle them. Due to Crafts/Yii2's plugin management and services it's totally trivial to create a data import because everything is really easy to understand and to manage. You can create a custom controller to fetch the data you need, set the values of your elements/records and use their &lt;code&gt;save&lt;/code&gt; functions. The rest happens nearly automatically&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-15T10:27:23.420" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23864" PostTypeId="2" ParentId="23862" CreationDate="2018-02-15T10:57:58.077" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/nystudio107/craft-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;cookies&lt;/a&gt; Plugin (or &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;for Craft 2&lt;/a&gt;)  to store the value of the timestamp when the users has visited the page for the last time. Or you can create your custom code like explained in the question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/648/prescribed-way-to-set-cookies-from-plugin-or-twig&quot;&gt;How to set a cookie&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the current timestamp like it's stated in the &lt;a href=&quot;https://craftcms.com/docs/templating/datetime#see-also&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentTimestamp = now|date('U') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And store the cookie like &lt;a href=&quot;https://github.com/nystudio107/craft-cookies#setting-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;explained&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set the cookie using 'set' variable #}&#xA;{% do craft.cookies.set( NAME, VALUE, DURATION, PATH, DOMAIN, SECURE, HTTPONLY) %}&#xA;{% set yourTimeStamp = getCookie( NAME ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll search for entries &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2083/fetch-all-entries-with-dateupdated-after-a-given-time&quot;&gt;after the specific date&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newEntries = craft.entries.postDate('&amp;gt;= ' ~ yourTimeStamp)|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="784" LastEditDate="2018-02-15T21:04:01.367" LastActivityDate="2018-02-15T21:04:01.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23865" PostTypeId="1" CreationDate="2018-02-15T12:38:47.667" Score="1" ViewCount="79" Body="&lt;p&gt;I am new to Craft and a client asked us to take over a site as the previous service provider abandoned them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now just trying to get up and running on a Windows server in a test environment before deploying to a production server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After restoring the mySQL db and getting it up and running via IIS the admin works, but the public site gives an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Server Error&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Craft\EntryModel and its behaviors do not have a method or closure&#xA;  named &quot;placeCategory&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does this imply we don't have the latest db of the site or all the files (or both)? Not sure what this error means or where to start troubleshooting.&lt;/p&gt;&#xA;" OwnerUserId="8003" LastEditorUserId="3951" LastEditDate="2018-02-21T21:30:24.037" LastActivityDate="2018-02-21T21:30:24.037" Title="Trying to restore a Craft instance for a customer who was abandoned" Tags="&lt;install&gt;&lt;installation&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23866" PostTypeId="1" CreationDate="2018-02-15T12:47:39.097" Score="1" ViewCount="153" Body="&lt;p&gt;I am currently transfering a live website to Craft CMS. I am trying to keep all URLs of pages and images exactly the same as the live version, because of all the pages and images cached in Google. Current URL's are, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.website.com/projects/projectname-1/pictures/picture.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.website.com/projects/projectname-1/pictures/picture.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;strong&gt;projectname-1&lt;/strong&gt; and &lt;strong&gt;picture.jpg&lt;/strong&gt; are variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft CMS I made a &lt;strong&gt;structure&lt;/strong&gt; called &lt;strong&gt;projects&lt;/strong&gt;. The slug/uri of the entries are setup so that they are the same as the original URL (for example www.website.com/projects/projectname-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made an Asset source with the file system path set as &lt;strong&gt;projects/&lt;/strong&gt; and asset url as &lt;strong&gt;/projects/&lt;/strong&gt;. When creating an entry within the projects structure, I made it so that when you're adding the images (custom field), it created the subfolder like: projects/{slug}/. The filenames of the images I am uploading are the exact same name as the live version. This all together works, because I am recreating all the same URLs: nice! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, here comes the problem. I also made a &lt;strong&gt;Single&lt;/strong&gt; for the projects (www.website.com/projects/) page. When I create an index.twig file in craft/templates/projects/index.twig, I get a 404 error when visiting the URL. &lt;strong&gt;This is because I also have a folder called projects in my public_html.&lt;/strong&gt; So, my question is: how do I also show craft/templates/projects/index.twig on my projects Single, while also keeping the original URLs intact (thus at the same time having a /projects/ folder in my public_html).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it makes sense, thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ET&lt;/p&gt;&#xA;" OwnerUserId="7532" LastEditorUserId="7532" LastEditDate="2018-02-15T15:33:05.240" LastActivityDate="2018-02-16T12:26:13.167" Title="404 error if folder in public_html has same name as folder in craft/templates" Tags="&lt;templating&gt;&lt;url&gt;&lt;404&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23867" PostTypeId="2" ParentId="23866" CreationDate="2018-02-15T13:02:20.550" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;This is because the 'projects' folder exists in both public_html and craft/templates, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No this simply means that you have no entry with the slug &lt;code&gt;projects&lt;/code&gt; as soon as you create an entry with the given slug it will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also define a &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;route&lt;/a&gt; in a &lt;a href=&quot;https://craftcms.com/docs/routing#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;config&lt;/a&gt; file &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'projects ' =&amp;gt; 'projects/index.twig',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Generally your template path structure has nothing to do with your url structure. You should define which template should apply for which url route in your CP in the element settings or via config file or &lt;a href=&quot;https://craftcms.com/docs/plugins/hooks-reference#registerSiteRoutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;{&#xA;    return array(&#xA;        'projects' =&amp;gt; 'projects/index.twig'&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-15T13:02:20.550" CommentCount="26" ContentLicense="CC BY-SA 3.0" />
  <row Id="23868" PostTypeId="1" CreationDate="2018-02-15T16:50:35.990" Score="2" ViewCount="277" Body="&lt;p&gt;I would like to have the ability to include a custom option in the field layout designer field settings. There is already a plugin for Craft 2 that uses this feature &lt;a href=&quot;https://github.com/benjamminf/craft-relabel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relabel for Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kUebl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUebl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I would like to include a behavior like this in Craft 3 too but I can't find a way to solve this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FieldLayoutDesigner is initialized &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/dist/js/Craft.js#L13566&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and the settings are created with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;initTab: function($tab) {&#xA;    if (this.settings.customizableTabs) {&#xA;        var $editBtn = $tab.find('.tabs .settings'),&#xA;            $menu = $('&amp;lt;div class=&quot;menu&quot; data-align=&quot;center&quot;/&amp;gt;').insertAfter($editBtn),&#xA;            $ul = $('&amp;lt;ul/&amp;gt;').appendTo($menu);&#xA;&#xA;        $('&amp;lt;li&amp;gt;&amp;lt;a data-action=&quot;rename&quot;&amp;gt;' + Craft.t('app', 'Rename') + '&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;').appendTo($ul);&#xA;        $('&amp;lt;li&amp;gt;&amp;lt;a data-action=&quot;delete&quot;&amp;gt;' + Craft.t('app', 'Delete') + '&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;').appendTo($ul);&#xA;&#xA;        new Garnish.MenuBtn($editBtn, {&#xA;            onOptionSelect: $.proxy(this, 'onTabOptionSelect')&#xA;        });&#xA;    }&#xA;&#xA;    // Don't forget the fields!&#xA;    var $fields = $tab.children('.fld-tabcontent').children();&#xA;&#xA;    for (var i = 0; i &amp;lt; $fields.length; i++) {&#xA;        this.initField($($fields[i]));&#xA;    }&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't see any triggers or other options to extend the content. Can someone please point me to the right direction how to include a custom button properly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think waiting for the &lt;code&gt;click&lt;/code&gt; event on the wheel icon and wait until the DOM menu is created to attach a custom button might not be the best and intended idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-16T07:59:43.437" Title="Craft 3 js - extend the field layout designer field settings" Tags="&lt;craft3&gt;&lt;javascript&gt;&lt;garnish&gt;&lt;field-layout-designer&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23869" PostTypeId="1" CreationDate="2018-02-15T17:49:59.857" Score="2" ViewCount="818" Body="&lt;p&gt;Where only users in Active Directory can login to the Craft Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="7524" LastEditorUserId="57" LastEditDate="2018-02-15T23:53:07.437" LastActivityDate="2018-05-17T01:18:49.747" Title="How to use LDAP for authentication in Craft CP (back end)" Tags="&lt;authentication&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23870" PostTypeId="1" CreationDate="2018-02-15T19:27:16.200" Score="1" ViewCount="3843" Body="&lt;p&gt;What's the best way to redirect to a trailing slash in Nginx with Craft CMS? I've seen some advice for Apache .htaccess, etc, but not Nginx. For those curious, here's why I might want to do this: &lt;a href=&quot;https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;To slash or not to slash&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NYStudio107&lt;/a&gt; &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;recommendations&lt;/a&gt; advise removing the trailing slash, but since we were formerly on Wordpress and had a trailing slash to begin with, I want to be consistent with the past history in Google Analytics.&lt;/p&gt;&#xA;" OwnerUserId="5891" LastEditorUserId="5891" LastEditDate="2018-02-15T19:48:27.607" LastActivityDate="2018-02-15T23:23:34.967" Title="Trailing slashes with Nginx and Craft" Tags="&lt;redirect&gt;&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23871" PostTypeId="2" ParentId="23870" CreationDate="2018-02-15T19:27:16.200" Score="3" Body="&lt;p&gt;After some digging, there appear to be two ways that avoid hitting the admin and url query strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first, (and apparently better one, as '&lt;a href=&quot;https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/&quot; rel=&quot;nofollow noreferrer&quot;&gt;if is evil&lt;/a&gt;' according to nginx) uses location handlers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 301 Redirect for trailing slash&#xA;location ~ ^([^.\?]*[^/])$ {&#xA;  try_files $uri @addslash;&#xA;}&#xA;&#xA;# 301 Redirect for trailing slash&#xA;location @addslash {&#xA;  return 301 $uri/$is_args$args;&#xA;}&#xA;&#xA;# Root directory location handler&#xA;location / {&#xA;    try_files $uri/index.html $uri $uri/ /index.php?$query_string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second, more evil one that uses an if statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($request_uri !~ &quot;^/admin&quot;)&#xA;{&#xA;    rewrite ^([^.\?]*[^/])$ $1/$is_args$args permanent;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I included the context of the root location handler in the first solution so that you can combine it with your existing root location handling setup. I'm currently leaning on a lot of NYStudio's work (a truly incredible contributor to the open source ecosystem of Craft) with FastCGI, location handlers for foreign languages, etc and both of these solutions work with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first also works with query strings, if a user visits a URL either with or without a trailing slash. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This: www.domain.com/page?string=234&lt;/li&gt;&#xA;&lt;li&gt;Will go to this: www.domain.com/page/?string=234&lt;/li&gt;&#xA;&lt;li&gt;And this: www.domain.com/page&lt;/li&gt;&#xA;&lt;li&gt;Will go to this: www.domain.com/page/&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Interestingly, if you use query_string instead of is_args for the return url, it will rewrite it wrong. Only is_args worked in my experience. &lt;/p&gt;&#xA;" OwnerUserId="5891" LastEditorUserId="5891" LastEditDate="2018-02-15T23:23:34.967" LastActivityDate="2018-02-15T23:23:34.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23872" PostTypeId="2" ParentId="23870" CreationDate="2018-02-15T19:37:28.583" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt; has an example setup that does this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L60&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L60&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 301 Redirect URLs with trailing /'s as per https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html&#xA;rewrite ^/(.*)/$ /$1 permanent;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is working on the nystudio107.com site, if you go here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...the redirected URL will be this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;andrew@kotak ~ $ curl -I https://nystudio107.com/blog/&#xA;HTTP/1.1 301 Moved Permanently&#xA;Server: nginx/1.13.6&#xA;Date: Thu, 15 Feb 2018 19:39:49 GMT&#xA;Content-Type: text/html&#xA;Location: https://nystudio107.com/blog&#xA;Connection: keep-alive&#xA;Set-Cookie: abtest=green;Path=/;Max-Age=86400;secure; SameSite=strict&#xA;Strict-Transport-Security: max-age=15768000; includeSubDomains; preload&#xA;X-Frame-Options: SAMEORIGIN&#xA;X-XSS-Protection: 1; mode=block&#xA;X-Content-Type-Options: nosniff&#xA;Referrer-Policy: no-referrer-when-downgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-15T19:37:28.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23874" PostTypeId="2" ParentId="23869" CreationDate="2018-02-16T00:03:52.960" Score="2" Body="&lt;p&gt;There's a feature request &lt;a href=&quot;https://github.com/craftcms/cms/issues/1471&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that would allow custom login forms for the Craft Control Panel login page you might want to add a comment to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, there is a &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#userSession-onBeforeAuthenticate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;userSession.onBeforeAuthenticate&lt;/code&gt;&lt;/a&gt; event a plugin can listen to to perform any 3rd party authentication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how a similar plugin did this for front-end LDAP logins here: &#xA; &lt;a href=&quot;https://github.com/thepitagroup/adldap_craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thepitagroup/adldap_craftcms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-16T00:03:52.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23875" PostTypeId="2" ParentId="23868" CreationDate="2018-02-16T07:59:43.437" Score="1" Body="&lt;p&gt;If someone has a better approach to solve that please tell me because my method right now fells really wrong and like a hack that might be troublesome in the future. I would like to accept the answer of someone else - until then I'll use the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;onKeyDown: function(ev){&#xA;    ev.preventDefault();&#xA;    var btn = $(ev.target);&#xA;    if(btn.data('menubtn')){&#xA;        var menu = btn.data('menubtn');&#xA;        var options = menu.menu.$menuList;&#xA;        if(options.find('.myClass').length === 0){&#xA;            options.append('&amp;lt;li&amp;gt;&amp;lt;a class=&quot;myClass&quot; data-action=&quot;myCustomDataAction&quot;&amp;gt;Another Button wuhu ^.^&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;')&#xA;        }&#xA;    }&#xA;},&#xA;init: function () {&#xA;    var e = this;&#xA;    var icons = $(&quot;.settings.icon&quot;);&#xA;    $.each(icons, function(index, item){&#xA;        var menuBtn = $(item).data('menubtn');&#xA;        if(menuBtn){&#xA;            var $menu = menuBtn.menu;&#xA;            $menu.on('show', $.proxy(e, 'onShowMenu'));&#xA;            e.addListener($(item), 'mousedown', 'onKeyDown');&#xA;        }&#xA;    });&#xA;    // add the event listener&#xA;    Garnish.$doc.on('click', '.myClass[data-action=&quot;myCustomDataAction&quot;]', this.showHoverMenu.bind(this));&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-16T07:59:43.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23876" PostTypeId="1" CreationDate="2018-02-16T11:46:37.853" Score="1" ViewCount="2913" Body="&lt;p&gt;I'm trying to output the full asset URL. Using Craft 3.0.0-RC7.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;.env&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ASSETS_BASE_PATH=/Users/user/code/sitename/web&#xA;ASSETS_BASE_URL=http://sitename.test&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;config/volumes.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'siteAssets' =&amp;gt; [&#xA;    'path' =&amp;gt; getenv('ASSETS_BASE_PATH') . '/assets/images',&#xA;    'url' =&amp;gt; getenv('ASSETS_BASE_URL') . '/assets/images',&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;&#xA;{{ entry.socialSharingImage.one.getUrl('socialSharing') }}&#xA;&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;&#xA;/index.php?p=actions/assets/generate-transform&amp;amp;amp;transformId=58&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you see, no site url at the start. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the &lt;code&gt;getUrl()&lt;/code&gt; method returns the path. Prepending it with &lt;code&gt;{{ siteURL }}&lt;/code&gt; creates two &lt;code&gt;/&lt;/code&gt;'s e.g. &lt;code&gt;http://sitename.test//asseturl.jpg&lt;/code&gt;. Same results in dev and production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-05-30T09:10:12.527" Title="Get full url of asset, not just the path" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23877" PostTypeId="2" ParentId="23866" CreationDate="2018-02-16T12:26:13.167" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/routing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Should Craft handle this request in the first place?&#xA;  It’s important to keep in mind that Craft doesn’t actually get involved for every request that touches your server – only requests that go to your index.php file.&#xA;  The .htaccess file that comes with Craft will redirect all would-be 404 requests over to index.php behind the scenes, which is why Craft is able to respond to URLs that don’t point to any actual folder/file in your web root. But if you point your browser directly at a file that does exist &lt;strong&gt;(such as a front-end image URL)&lt;/strong&gt;, Apache is going to serve that file directly. Craft won’t be summoned for that.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Lets begin ( i have set up a testenviroment to test all this below ):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have resources at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;www.website.com/assets/img/projects/{slug}/image.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want your urls to look like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;www.website.com/projects/{slug}/image.jpg&lt;/code&gt; but this gives you an actual &lt;strong&gt;404&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft tries to follow all the routing steps, but since your assets setup in the Craft CP isn't a route, it will give you a &lt;strong&gt;404&lt;/strong&gt; correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you change the CPfield &quot;url to your folder&quot; from &quot;/projects/&quot; to &quot;/assets/img/projects/&quot; it will give you the file, so my question would be, is craft not pointing back to the &quot;public_html&quot; folder here when your CPfield is set to &quot;/project/&quot;??&lt;/p&gt;&#xA;" OwnerUserId="6623" LastActivityDate="2018-02-16T12:26:13.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23878" PostTypeId="1" AcceptedAnswerId="23935" CreationDate="2018-02-16T13:54:48.190" Score="0" ViewCount="370" Body="&lt;p&gt;I've got ajax working on a page but if the number of articles is not exactly 3 (this is the pagination limit) then the remaining 1 or 2 entries do not get loaded. I'm not sure why or how to resolve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;a href=&quot;https://craftcms.stackexchange.com/a/9868/193&quot;&gt;this post&lt;/a&gt; as a guide to my code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My js code is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# set current url so we can page with the correct entries #}&#xA;  {% set current_url = &quot;improve-your-club/topic/&quot; ~ craft.request.getSegment(3) %}&#xA;&#xA;  $(function () {&#xA;&#xA;      // load the first page of entries&#xA;      var page = 1;&#xA;&#xA;      // set this equal to pagination number&#xA;      var count = 3;&#xA;&#xA;      // Get the total count that we set above&#xA;      var totalCount = $(&quot;#totalRelatedCount&quot;).val();&#xA;&#xA;      $('#loadMore').click (function (e) {&#xA;          e.preventDefault();&#xA;&#xA;          if(count &amp;lt; totalCount){&#xA;            $('#loading').fadeIn();&#xA;&#xA;            $.get( &quot;/{{ current_url }}/p&quot;+page , function( data ) {&#xA;&#xA;              $( &quot;.remaining .feat-box-container&quot; ).append( data );&#xA;&#xA;              // this won't hide why not?&#xA;              $('#loading').fadeOut();&#xA;&#xA;              // increase page&#xA;              page++;&#xA;&#xA;              // Increment count by 3 entries&#xA;              count = (count) + 3;&#xA;&#xA;              // Check if count is greater than or equal to the total count. If so hide the load more button. &#xA;                if(count &amp;gt;= totalCount){&#xA;                    $(&quot;#loadMore&quot;).fadeOut();&#xA;                    console.log('count is larger than total count');&#xA;                }&#xA;&#xA;            });&#xA;          }// endif&#xA;&#xA;      });&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've recorded a gif showing that the page only loads the first 6 entries despite there being 8 entries available to load - dropbox link to gif (too large to upload here) &lt;a href=&quot;https://www.dropbox.com/s/79datzwa2qktpi0/ajax.gif?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/79datzwa2qktpi0/ajax.gif?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** link to pastebin with full template** &lt;a href=&quot;https://pastebin.com/cNUJW4xr&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.com/cNUJW4xr&lt;/a&gt;&#xA;removed google tags from this template but otherwise intact&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2018-02-16T14:22:09.363" LastActivityDate="2018-02-21T00:25:39.603" Title="Ajax pagination not loading last entries if not equal to pagination number" Tags="&lt;ajax&gt;&lt;pagination&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23879" PostTypeId="1" CreationDate="2018-02-16T15:11:55.273" Score="1" ViewCount="1024" Body="&lt;p&gt;We have a single installation of Craft that is live and with lots of users and lead generation going. Now the client would like to have a staging environment where we can prepare new pages, or add scripts and test them before going live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about staging in PHP, where you modify a file(s) and when it works on the test server, you copy it over and overwrite the file(s) in production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But can this be done in a cms like craft where the database is also affected? &#xA;Like we create in staging a new template, in the craft admin backend we create the article, with the form (we use Formbuilder). Then when the client is happy can I just 'push a button' and have it live in production? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess i have to copy template, and affected database tables over to the production server, but how to know what DB tables have been modified ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peter&lt;/p&gt;&#xA;" OwnerUserId="8007" LastActivityDate="2018-02-17T02:21:07.957" Title="Clarification how staging site works" Tags="&lt;multi-environment&gt;&lt;environments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23880" PostTypeId="2" ParentId="23858" CreationDate="2018-02-16T15:27:01.280" Score="1" Body="&lt;p&gt;If you're looking to sync only configuration you shouldn't use the database sync in the article suggested by Otto - that will also bring over content and users and such - unless you intend to create your fields on production and then pull those into dev (which seems like a strange workflow).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to do actual schema syncing in Craft 3 that I'm aware of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Writing your own content migrations (using the Craft PHP API to create fields/sections etc by hand)&lt;/li&gt;&#xA;&lt;li&gt;Use the architect plugin (currently under development) to sync your config by exporting it to json, then importing it on your other environments. &lt;a href=&quot;https://github.com/Pennebaker/craft-architect&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Pennebaker/craft-architect&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For Craft 2 there's also Schematic (&lt;a href=&quot;https://github.com/nerds-and-company/schematic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nerds-and-company/schematic&lt;/a&gt;) but there's no word on a release for Craft 3 yet.&lt;/p&gt;&#xA;" OwnerUserId="8008" LastActivityDate="2018-02-16T15:27:01.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23881" PostTypeId="1" AcceptedAnswerId="23893" CreationDate="2018-02-16T15:31:16.057" Score="1" ViewCount="128" Body="&lt;p&gt;I am trying to add a MySQL stored procedure to the database on plugin install in Craft 3.  I currently have an install migration calling a function from the safeUp method. In this function I am using &lt;code&gt;Craft::$app-&amp;gt;getDb()-&amp;gt;createCommand(&quot; DELIMITER $$ CREATE PROCEDURE ...&quot;)-&amp;gt;execute()&lt;/code&gt;. However this does not seem to do the trick.&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="57" LastEditDate="2018-02-16T19:15:20.867" LastActivityDate="2018-02-16T22:40:22.957" Title="Install MySQL stored procedure to database on plugin install in Craft 3" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;craft3&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23882" PostTypeId="1" AcceptedAnswerId="23891" CreationDate="2018-02-16T15:44:07.400" Score="2" ViewCount="885" Body="&lt;p&gt;I tried to install &quot;Field Manager&quot; Plugin and get following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;symfony/console v3.4.4 requires php ^5.5.9|&amp;gt;=7.0.8 -&amp;gt; your PHP version (7.2.1) overridden by &quot;config.platform.php&quot; version (7.0) does not satisfy that requirement.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theres is no config.platform.php anywhere and i have PHP 7.2.1 installed. How can i fix that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Ok, config.platform.php refers to composer.json entry. I changed it to 7.2 and could install it via command line. Possibly worked via CP too.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2018-02-16T16:14:19.897" LastActivityDate="2018-02-16T19:29:03.177" Title="Plugin Installation Error in Craft 3 / PHP Version" Tags="&lt;plugins&gt;&lt;craft3&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23883" PostTypeId="1" CreationDate="2018-02-16T16:25:08.643" Score="0" ViewCount="502" Body="&lt;p&gt;I can connect to a Craft 3 site just fine using Laravel Valet, but when I attempt to get a Craft 2 site working with it, it gives me this in the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[exception.CDbException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Visiting the site with the /index.php?p=admin portion appended to the url gives this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft can’t connect to the database with the credentials in craft/config/db.php.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I 100% have the correct db credentials, as the Craft 3 site is using the same ones and is running just fine at sitename.test&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'http://example.test' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'root',&#xA;    'password' =&amp;gt; 'thecorrectpw',&#xA;    'database' =&amp;gt; 'dbname',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea what could be going on? I would like to keep using Valet as it makes my life easier, but I am going to fling my laptop out the window into the city streets in about an hour or so if I cant get this working =)&lt;/p&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="57" LastEditDate="2018-02-16T19:30:32.950" LastActivityDate="2018-02-16T19:30:32.950" Title="1045 Can't Connect To DB with Laravel Valet" Tags="&lt;valet&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23884" PostTypeId="1" AcceptedAnswerId="23886" CreationDate="2018-02-16T16:33:19.730" Score="2" ViewCount="172" Body="&lt;p&gt;To replace my current CMS I will need to have parts of pages change without the whole page change. As I'm looking at using matrix blocks for building pages, it would seem to be easy for an editor to schedule matrix blocks...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this or a better approach?&lt;/p&gt;&#xA;" OwnerUserId="5641" LastActivityDate="2018-02-16T17:38:46.377" Title="Has anyone come up with a solution where matrix blocks can be scheduled and expire?" Tags="&lt;matrix&gt;&lt;postdate&gt;&lt;expiration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23886" PostTypeId="2" ParentId="23884" CreationDate="2018-02-16T17:36:16.037" Score="1" Body="&lt;p&gt;The simplest solution would probably to just have two normal Date fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start Date&lt;/li&gt;&#xA;&lt;li&gt;End Date&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And then in Twig, just show blocks that fall between those dates.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-02-16T17:36:16.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23887" PostTypeId="2" ParentId="23884" CreationDate="2018-02-16T17:38:46.377" Score="2" Body="&lt;p&gt;Yes you can definitely do this. The huge advantage of Craft is it's ability to customize nearly everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a &lt;code&gt;date&lt;/code&gt; field in your matrix block and check if the current date &lt;code&gt;{{ now|date }}&lt;/code&gt; is lower than the date specified in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the condition is true, you'll display the matrix block if not you can either just hide it or you could create a &lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt; with a &lt;a href=&quot;https://craftcms.com/docs/plugins/variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;template variable &lt;/a&gt; to delete the block. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;matrix-&amp;gt;deleteBlockType($yourBlock);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-16T17:38:46.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23888" PostTypeId="2" ParentId="22685" CreationDate="2018-02-16T17:40:56.647" Score="2" Body="&lt;p&gt;I ran into the same problem where if a page was 'disabled', I didn't want it to show in my footer navigation. The recommended answer didn't work for me. The link still showed up. The following worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntry = craft.entries.id(entryId).first() %}&#xA;&#xA;{% if myEntry %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;example.com&quot;&amp;gt;Example&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7445" LastActivityDate="2018-02-16T17:40:56.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23890" PostTypeId="1" AcceptedAnswerId="23919" CreationDate="2018-02-16T18:30:51.757" Score="2" ViewCount="218" Body="&lt;p&gt;I have a Glossary channel on my site, with Term and Definition fields. I would like Terms to display their definitions throughout the site...whenever so assigned by the content editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have Rich Text fields allowing editors to create &lt;em&gt;links&lt;/em&gt; from Terms to their Definitions by using Link to an Entry. This is not great in terms of UX as it forces sends site visitors to the main Glossary index page to view the Definitions; I'd like to implement a hover text for the Terms that shows the Definition right there, wherever the visitor is reading. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I filter these rich text fields in the templates to check for links to Glossary entries and output a hover text instead of a link? I haven't written any custom plugins or filters (yet), so I'm looking for pointers in the right direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other approaches that might solve my problem are welcome. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help.&lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2020-12-07T15:18:27.760" Title="How to output a Rich Text Link to an Entry as a tooltip?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;redactor&gt;&lt;filter&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23891" PostTypeId="2" ParentId="23882" CreationDate="2018-02-16T19:29:03.177" Score="3" Body="&lt;p&gt;Usually when you see that error, Craft was &lt;code&gt;composer install/update&lt;/code&gt;'d on one environment with say, PHP 7.2.  Composer then pulls in the highest supported dependencies for that environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;composer.lock&lt;/code&gt; file is pushed to a different environment with say, PHP 7.1, creating a conflict the next time Composer needs to run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this to force Composer to use the lowest common denominator for all of your environments: &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/composer.json#L34-L36&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/craft/blob/master/composer.json#L34-L36&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-16T19:29:03.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23892" PostTypeId="1" AcceptedAnswerId="23894" CreationDate="2018-02-16T20:00:48.300" Score="1" ViewCount="85" Body="&lt;p&gt;I have created a test category called &lt;strong&gt;test&lt;/strong&gt; inside the &lt;strong&gt;what-we-do&lt;/strong&gt; category group. There are three files at play&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first has a line of code that generates the query string on button click&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cat in categories %}&#xA;    &amp;lt;li class=&quot;vr&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}?category={{ cat | kebab }}&quot; class=&quot;btn btn_plain mix-btn_noWidth&quot;&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second takes the query string formats it and passes it to the list template. The code looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.queryStringWithoutPath %}&#xA;    {% set categoryQueryString = craft.request.QueryStringWithoutPath| replace({&quot;category=&quot; : &quot;&quot;}) %} &#xA;{% else %}&#xA;    {% set categoryQueryString = &quot;&quot; %}        &#xA;{% endif %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% include '_includes/snippets/blog/list.html.twig' with {category : categoryQueryString} %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the list code looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sections = 'blogPosts' %}&#xA;{% paginate craft.entries.section(sections).relatedTo(craft.categories.slug('what-we-do/' ~ category|default)).limit(limit) as pageInfo, pageEntries %}&#xA;&#xA;{% for entry in pageEntries %}&#xA;    {% if entry['listingPageText']|default %}&#xA;        {% set content = entry.listingPageText %}&#xA;    {% endif %}&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ content }} &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% end for %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This section seems to be working when I dump it but I am not seeing any of my entries rendered&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(sections).relatedTo(craft.categories.slug('what-we-do/' ~ category|default)).limit(limit) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if there is something simple i'm missing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(sections).relatedTo(category|default).limit(limit) as pageInfo,pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get the posts to appear but it does not filter by category it just defaults and renders all the blog posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that's because I have to pass the full category url what-we-do/test assuming the category name is test. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I really need is it to show the blogposts that are of category test inside the category group what-we-do&lt;/p&gt;&#xA;" OwnerUserId="7838" LastActivityDate="2018-02-17T00:55:41.043" Title="Use query string with relatedTo() with categories inside a category group" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23893" PostTypeId="2" ParentId="23881" CreationDate="2018-02-16T22:40:22.957" Score="1" Body="&lt;p&gt;After further investigation Yii handles the &lt;code&gt;DELIMITER ;;&lt;/code&gt; in the &lt;code&gt;createCommand()&lt;/code&gt; method. I just had to remove the opening and closing DELIMITER syntax and execute the &lt;code&gt;Craft::$app-&amp;gt;getDb()-&amp;gt;createCommand(&quot;CREATE PROCEDURE ( ... )&quot;)-&amp;gt;execute()&lt;/code&gt; for it to install.  &lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2018-02-16T22:40:22.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23894" PostTypeId="2" ParentId="23892" CreationDate="2018-02-17T00:37:51.897" Score="1" Body="&lt;p&gt;&lt;code&gt;craft.categories&lt;/code&gt; will return you an object of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.categories.slug('what-we-do/' ~ category|default)&lt;/code&gt; sets an attribute of this object, but it does not fetch the elements yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/relations#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;parameter&lt;/a&gt; needs to be an element, a list of elements, an array and some other staff but it can't handle a query (which the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; is) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to fetch the element(s) before you pass it to the function with &lt;code&gt;first()&lt;/code&gt;, &lt;code&gt;ids()&lt;/code&gt;, &lt;code&gt;last()&lt;/code&gt; or &lt;code&gt;find()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section(sections).relatedTo(craft.categories.slug('what-we-do/' ~ category|default).first())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Btw: just as an additional note &lt;code&gt;{{ cat | kebab }}&lt;/code&gt; will print the title in kebab case. Mostly that will be the slug but if the user changes the title or the slug or inserts something completely different from the beginning, your logic will break &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-17T00:55:41.043" LastActivityDate="2018-02-17T00:55:41.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23896" PostTypeId="2" ParentId="23879" CreationDate="2018-02-17T02:21:07.957" Score="1" Body="&lt;p&gt;I am new to craftcms and webdev. Therefore I am unable to tell you an exact route, but this can definitely be solved, I already read about it. This guy has excellent tutorials about craftcms and development and these two topics could solve your question. Just give it a spin and read through:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8010" LastActivityDate="2018-02-17T02:21:07.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23897" PostTypeId="2" ParentId="23850" CreationDate="2018-02-17T04:02:03.037" Score="0" Body="&lt;p&gt;Have you seen the &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/06.-SEOmetrics-Content-Analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmetrics Content Analysis&lt;/a&gt;? There's a video of it in action on that page too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently working on SEOmatic for Craft 3; let me know what this &quot;traffic light&quot; does, and I can have a look at doing it!&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-17T04:02:03.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23898" PostTypeId="1" CreationDate="2018-02-17T04:16:16.857" Score="2" ViewCount="78" Body="&lt;p&gt;I'm creating a line up listing page for a festival, across 4 nights. Acts are listed, per day, sorted by a &lt;code&gt;date&lt;/code&gt; field in order of a start &lt;code&gt;time&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I'm having is that midnight until 3am is still considered the night of an event but my &lt;code&gt;time&lt;/code&gt; field obviously considers it otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. an act is performing on the Friday morning at 1am but I need to list this at the &lt;em&gt;end&lt;/em&gt; of the Thursday acts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the user adds it to the CMS on the Thursday but it appears at the start of the day instead of the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, I just need any acts that appear between &lt;code&gt;00:00&lt;/code&gt; and &lt;code&gt;03:00&lt;/code&gt; at the top of a list e.g&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Thursday&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Act 1&lt;/strong&gt; - 1am - 2am&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Act 2&lt;/strong&gt; - 12am - 1am&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Act 3&lt;/strong&gt; - 11pm - 12am&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Act 4&lt;/strong&gt; - 10pm - 11pm&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;etc&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;This is the code I have so far&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;whatDateAreTheyPerforming&lt;/code&gt; is a date field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;startTime&lt;/code&gt; and &lt;code&gt;endTime&lt;/code&gt; are time fields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('lineUp').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).find() %}&#xA;&#xA;{% for category in categories %}&#xA;&#xA;  {# Fetch all of the entries related to this category #}&#xA;  {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;  {# Group entries by date and order by start time #}&#xA;  {% for date, entries in entries.order('whatDateAreTheyPerforming', 'time(startTime) desc')|&#xA;  group('whatDateAreTheyPerforming') %}&#xA;    &amp;lt;div&amp;gt;&#xA;&#xA;      &amp;lt;h3&amp;gt;DAY HERE - {{ date | date('l') }} &amp;lt;span&amp;gt;{{ date | date('jS') }}&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;      &amp;lt;ul&amp;gt;&#xA;&#xA;        {% for entry in entries %}&#xA;&#xA;        &amp;lt;li&amp;gt;&#xA;          &amp;lt;h4&amp;gt;{{ entry.title }} &#xA;              &amp;lt;span&amp;gt;{{ entry.whatDateAreTheyPerforming | date('l') }} - {{ entry.startTime | date('G:i') }} - {{ entry.endTime | date('G:i') }}&amp;lt;/span&amp;gt;&#xA;          &amp;lt;/h4&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endfor %}&#xA;&#xA;      &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- col --&amp;gt;&#xA;  {% endfor %} &#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this makes sense, any guidance will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="4823" LastEditDate="2018-02-17T04:23:07.433" LastActivityDate="2018-02-22T11:17:45.450" Title="Show time ordered entries from midnight at end of loop" Tags="&lt;ordering&gt;&lt;order&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23899" PostTypeId="1" CreationDate="2018-02-17T12:50:13.077" Score="2" ViewCount="195" Body="&lt;p&gt;I want site members to login and create products in Craft Commerce, so the products they create should only be visible to them on the back-end, e.g,  user (A) should login and view his products in Craft Commerce, user (B) logs in and only see his products.  How can I achieve this in Craft Commerce?&lt;/p&gt;&#xA;" OwnerUserId="8011" LastEditorUserId="57" LastEditDate="2018-02-17T21:31:38.460" LastActivityDate="2018-06-27T01:07:15.640" Title="How can you allow users to create products in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23900" PostTypeId="1" CreationDate="2018-02-17T12:54:22.943" Score="2" ViewCount="296" Body="&lt;p&gt;I'm currently using &lt;a href=&quot;https://github.com/ethercreative/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEO by EtherCreative&lt;/a&gt; on Craft 2, one of my pages needs a custom title and description injected into it like this on the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In some cases, you will not have access to an SEO field, but will want&#xA;  to set the page title &amp;amp; description. You can do this by creating a&#xA;  custom SEO object using the function below:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.seo.custom('The Page Title', 'The page description', $includeDefaultTitleSuffix)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Mine seems to be throwing errors or not doing anything like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set seo = craft.seo.custom('Discount codes and vouchers for {{ query }}', 'You searched for {{ query }}. Check out the latest live {{ query }} discount codes &amp;amp; voucher codes for {{ &quot;now&quot;|date(&quot;m&quot;) }} {{ &quot;now&quot;|date(&quot;Y&quot;) }} only at Vouchertoday.uk') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="57" LastEditDate="2018-02-17T21:33:14.637" LastActivityDate="2018-02-20T00:41:53.847" Title="Setting a Plugin Object" Tags="&lt;plugins&gt;&lt;seo&gt;&lt;plugin-seo&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23902" PostTypeId="2" ParentId="23854" CreationDate="2018-02-17T20:15:08.973" Score="2" Body="&lt;p&gt;What you'll want to do is change the &lt;code&gt;CRAFT_BASE_PATH&lt;/code&gt; in your &lt;strong&gt;index.php&lt;/strong&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look for line 7, and change this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(&quot;__DIR__&quot;));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname('./'));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had this issue as well, being used to doing the same thing with Craft 2, changing the $craftPath variable.&lt;/p&gt;&#xA;" OwnerUserId="6265" LastActivityDate="2018-02-17T20:15:08.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23903" PostTypeId="2" ParentId="23876" CreationDate="2018-02-17T21:21:58.250" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Prepending it with &lt;code&gt;{{ siteURL }}&lt;/code&gt; creates two &lt;code&gt;/&lt;/code&gt;'s e.g.  &lt;code&gt;http://sitename.test//asseturl.jpg&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It would do that if you've defined your site URL (either in Settings-&gt;Sites-&gt;Base URL or using the &lt;code&gt;CRAFT_SITE&lt;/code&gt; PHP constant) with a trailing slash at the end of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;code&gt;http://sitename.test/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing it to &lt;code&gt;http://sitename.test&lt;/code&gt; would work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-17T21:21:58.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23904" PostTypeId="2" ParentId="23899" CreationDate="2018-02-17T21:30:51.010" Score="1" Body="&lt;p&gt;User/User Group permissions don't apply to Product Types in Commerce like they do to Sections in Craft, so I'm not seeing any easy way to pull this off in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a feature request here you might want to comment on if you think this should be the case: &lt;a href=&quot;https://github.com/craftcms/commerce/issues/174&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/174&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do this from a front-end template/product admin section if you wanted, but not sure if that would be a valid use-case for you.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-03-28T23:52:14.947" LastActivityDate="2018-03-28T23:52:14.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23906" PostTypeId="1" CreationDate="2018-02-18T23:54:52.537" Score="1" ViewCount="546" Body="&lt;p&gt;I have a Craft 3 multi-site site - &lt;code&gt;/&lt;/code&gt; for the main site, &lt;code&gt;/site1/&lt;/code&gt; for site1, etc. I have a template &lt;code&gt;templates/foo.twig&lt;/code&gt;, and &lt;code&gt;/foo&lt;/code&gt; hits it for the main site, but &lt;code&gt;/site1/foo&lt;/code&gt; does &lt;strong&gt;not&lt;/strong&gt; hit it for site1. I think it should. What am I doing wrong?&lt;/p&gt;&#xA;&lt;p&gt;I am trying to get case &lt;code&gt;4&lt;/code&gt; of the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/routing.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Routing&lt;/a&gt; algorithm to work with multiple sites:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;Does the URI match a template?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Finally, Craft will check if the URI is a valid template path. If it is, Craft will return the matched template. Note: if any of the URI segments begin with an underscore (_), Craft will return a 404. Craft hides from direct access any template path segments that begin with an underscore.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-02-19T08:14:38.393" Title="Craft 3 multi-site route to template (no entry)" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23907" PostTypeId="1" CreationDate="2018-02-19T07:16:37.587" Score="1" ViewCount="627" Body="&lt;p&gt;I am trying to configure NGINX to serve a craft 2 site.  I am getting the requests being routed through &lt;code&gt;index.php&lt;/code&gt; for template url's but not for any admin routes which are redirecting to &lt;code&gt;index.php?p=/admin/**/*&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming this has more to do with my NGINX config than craft as I have the following option enabled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; 'true',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any craft related reason that admin URL's would redirect that way whereas template url's wouldn't?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is my nginx config:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;listen 80 default_server;&#xA;listen [::]:80 default_server ipv6only=on;&#xA;&#xA;index index.html index.htm index.php;&#xA;&#xA;server_name _;&#xA;&#xA;error_log  off;&#xA;access_log off;&#xA;&#xA;root /code/public;&#xA;&#xA;charset utf-8;&#xA;&#xA;&#xA;location / {&#xA;    try_files $uri/index.html $uri $uri/ /index.php?$query_string;&#xA;}&#xA;&#xA;location ~ [^/]\.php(/|$) {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass php:9000;&#xA;    fastcgi_index index.php;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;    fastcgi_param PATH_INFO $fastcgi_path_info;&#xA;    include fastcgi_params;&#xA;}&#xA;&#xA;# Disable reading of Apache .htaccess files&#xA;location ~ /\.ht {&#xA;    deny all;&#xA;}&#xA;&#xA;# Misc settings&#xA;sendfile off;&#xA;client_max_body_size 100m;&#xA;&#xA;# 404 error handler&#xA;error_page 404 /index.php?$query_string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just deployed this same app to AWS elastic beanstalk and am running into the same issue with Apache.  This leads me to think maybe it's not related to nginx?&lt;/p&gt;&#xA;" OwnerUserId="4320" LastEditorUserId="4320" LastEditDate="2018-02-19T18:03:51.120" LastActivityDate="2018-02-19T18:29:49.010" Title="Nginx config for craft working for everything but admin url's" Tags="&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23908" PostTypeId="2" ParentId="23906" CreationDate="2018-02-19T08:14:38.393" Score="1" Body="&lt;p&gt;I don’t think it has something to do with URI to template routing. It should just work once you have your sites setup correctly in Craft and in server configurations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do to test correct site setup in Craft is to request the page using the query string:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://example.com/site1/?p=foo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-02-19T08:14:38.393" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23909" PostTypeId="2" ParentId="23900" CreationDate="2018-02-19T09:02:16.907" Score="1" Body="&lt;p&gt;You can't automatically expand variables inside strings in Twig as you would normally do in PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you have to concatenate your strings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seo = craft.seo.custom('Discount codes and vouchers for ' ~ query, 'You searched for ' ~ query ~ '. Check out the latest live ' ~ query ~ ' discount codes &amp;amp; voucher codes for ' ~ now|date('m') ~ ' ' ~ now|date('Y') ~ ' only at Vouchertoday.uk') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="57" LastEditDate="2018-02-20T00:41:53.847" LastActivityDate="2018-02-20T00:41:53.847" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23910" PostTypeId="2" ParentId="23898" CreationDate="2018-02-19T09:23:00.607" Score="1" Body="&lt;p&gt;I -think- one of the neatest ways to go about this is to introduce a &quot;Show as last in list&quot; lightswitch-field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently working on a similar project (festival line-up) where I also needed this; here's the approach I went with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I'll be going for two fields: &lt;code&gt;eventTime&lt;/code&gt; (date/time-field) and &lt;code&gt;showAsLastInList&lt;/code&gt; (lightswitch-field)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').showAsLastInList('NOT 1').orderBy('eventTime ASC').all %}&#xA;&#xA;{% for date, eventsByDate in events|group('eventTime|date(&quot;Y-m-d&quot;)') %}&#xA;    {% set additionalEvents = craft.entries.section('events').eventTime(date).showAsLastInList('1').orderBy('eventTime ASC').all %}&#xA;    &amp;lt;div class=&quot;program__dateline&quot; data-filter-dateline&amp;gt;{{ date|date('l j. F')|capitalize }}&amp;lt;/div&amp;gt;&#xA;    {% for event in eventsByDate|merge(additionalEvents) %}&#xA;       {# PRINT YOUR HTML HERE #}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not exactly pretty, but I can't really think of another way to achieve this without creating a custom plugin for it.&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4465" LastEditDate="2018-02-19T09:45:15.357" LastActivityDate="2018-02-19T09:45:15.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23911" PostTypeId="2" ParentId="4553" CreationDate="2018-02-19T10:57:45.660" Score="17" Body="&lt;p&gt;In Craft 3 this is a cinch:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PluginController extends Controller&#xA;{&#xA;    // Disable CSRF validation for the entire controller &#xA;    public $enableCsrfValidation = false;&#xA;&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the Yii2 docs for more control over inividual actions:&#xA;&lt;a href=&quot;https://github.com/yiisoft/yii2/blob/master/docs/guide/security-best-practices.md#avoiding-csrf&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/yiisoft/yii2/blob/master/docs/guide/security-best-practices.md#avoiding-csrf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="365" LastEditDate="2018-10-24T12:25:09.250" LastActivityDate="2018-10-24T12:25:09.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23913" PostTypeId="2" ParentId="23898" CreationDate="2018-02-19T15:03:40.927" Score="1" Body="&lt;p&gt;You could use the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse&lt;/a&gt; plugin to store the actual date of the event into a dedicated field (hidden in the CP). So for example store &lt;em&gt;2018-02-20 02:00&lt;/em&gt; for an event with a &lt;code&gt;whatDateAreTheyPerforming&lt;/code&gt; date set to &lt;em&gt;2018-02-19&lt;/em&gt;. Then use the Preparse field’s value for sorting within your groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code should work to compute the date string with Preparse:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set actualDate = entry.whatDateAreTheyPerforming|date('Y-m-d')&#xA;    ~ entry.startTime|date(' H:i:s') %}&#xA;&#xA;{%- set isTomorrow = actualDate|date('G') &amp;lt; 5 %}&#xA;{%- set actualDate = isTomorrow ? actualDate|date_modify('+1 day') : actualDate %}&#xA;&#xA;{{- actualDate|date('Y-m-d H:i:s') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don’t want to use Preparse, another simple approach would be to simply loop twice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Output events after 05:00 #}&#xA;{% for entry in entries if entry.startTime|date('G') &amp;gt;= 5 %}&#xA;{% endfor %}&#xA;&#xA;{# Output events before 05:00 #}&#xA;{% for entry in entries if entry.startTime|date('G') &amp;lt; 5 %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-02-22T11:17:45.450" LastActivityDate="2018-02-22T11:17:45.450" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23914" PostTypeId="2" ParentId="23907" CreationDate="2018-02-19T18:29:49.010" Score="1" Body="&lt;p&gt;Try adding specific location for admin &amp;amp; cpresources in the nginx config&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ^~ /admin {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;}&#xA;location ^~ /cpresources {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;before&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ~ [^/]\.php(/|$) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2018-02-19T18:29:49.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23916" PostTypeId="1" CreationDate="2018-02-19T19:37:57.993" Score="1" ViewCount="155" Body="&lt;p&gt;I have a request to extend an existing &quot;advanced search&quot; form (multiple fields, including keyword and a categories dropdown) so that entries with a category that matches the keyword input are returned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's say my entries are all book authors, and among various entry fields like their bio and their published books, there's also a Topic category, and authors may be associated with 0-n categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And let's say I have an author Jane Smith, and one of her selected Topic categories is Poetry, but for some reason the word &quot;poetry&quot; does not exist in her bio or any of her book titles or for that matter anywhere at all in her main entry, but rather only as that category selection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I modify my search so that anyone typing &quot;poetry&quot; into the keyword search field (rather than picking it from the Topics dropdown menu field) will get back Jane Smith as one of their results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still pretty new to Craft, but I feel like there has to be some way. If not via clever query construction on the results template, then maybe by some kind of way to automatically replicate the text of the author's topic categories into an entry field that's never displayed to users, just only exists to get that text into a place where it's picked up by the search index? Would be grateful for any thoughts. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Existing search (this is followed by a bunch more Twig that merges these results with results of other entry types but I don't know that any of that is relevant here):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profileParams = {&#xA;    section: 'profiles',&#xA;    search: {&#xA;        query: 'title:' ~ query ~ ' OR ' ~ &#xA;                     'position:' ~ query ~ ' OR ' ~ &#xA;                     'jobTitle:' ~ query ~ ' OR ' ~ &#xA;                     'institution:' ~ query,&#xA;        subLeft: true,&#xA;        subRight: true&#xA;    },&#xA;    order: 'score',&#xA;    limit: null&#xA;} %}&#xA;&#xA;[...]&#xA;&#xA;{% set profileEntries = craft.entries( profileParams ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7748" LastEditorUserId="7748" LastEditDate="2018-02-20T00:46:53.023" LastActivityDate="2018-02-20T00:46:53.023" Title="How to include search results where keyword input exists only as a category title?" Tags="&lt;categories&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23918" PostTypeId="2" ParentId="23916" CreationDate="2018-02-19T21:28:59.743" Score="1" Body="&lt;p&gt;It's hard to say how you could include it since we don't know the rest of your search. Generally the best idea to search is with php and not with twig but you could grab all categories with the title (or whatever field it should be) with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryIds = craft.categories.title(&quot;Your search term&quot;).ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can fetch all entries that are related to these categories with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(categoryIds).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However: if you just follow this &lt;a href=&quot;https://craftcms.com/docs/searching#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; category titles are included in your search. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-19T21:28:59.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23919" PostTypeId="2" ParentId="23890" CreationDate="2018-02-19T23:19:24.987" Score="3" Body="&lt;p&gt;Not really a craft solution — but easiest might be jquery/ajax. Since you know the base URI, you can just create a selector for the route, and work from there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;a[href*='route/to/definitions/']&quot;).each(function(){&#xA;    var $element = $(this);&#xA;&#xA;    // ajax load content and place content in DOM somewhere&#xA;    $.get( $element.attr('href'), function(data) {&#xA;        $element.attr('data-definition') = data;&#xA;    });&#xA;&#xA;    // click handler to prevent default link behavior&#xA;    $element.on('click', function(event){&#xA;        event.preventDefault()&#xA;    });&#xA;&#xA;    // hover handler to display/hide definition&#xA;    $element.hover(displayDefinition, hideDefinition);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also potentially do a search/replace in twig, but it is not nearly as easy to manipulate as in js.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2018-02-19T23:19:24.987" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23920" PostTypeId="1" AcceptedAnswerId="24148" CreationDate="2018-02-20T00:03:40.277" Score="2" ViewCount="786" Body="&lt;p&gt;In Craft 3, I've got a service function that I'm passing either an 'entry' or 'category' element into. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know how to differentiate between the possible element types; This kinda of works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getElementType($element) {&#xA;  if ( isset($element-&amp;gt;group) ) {&#xA;    return = 'category';&#xA;  } else if (isset($element-&amp;gt;section)) {&#xA;    return = 'entry';        &#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I can't help but feel this is unreliable and hacky. Is there a better way to check an elements elementType?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2021-02-01T08:47:44.857" Title="How to check an elements elementType" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;elementtype&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23921" PostTypeId="2" ParentId="23920" CreationDate="2018-02-20T00:16:39.893" Score="1" Body="&lt;p&gt;I just discovered &lt;code&gt;getElementTypeById()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This pretty much does the trick: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  public function getElementType($element) {&#xA;&#xA;    $elementType = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementTypeById($element-&amp;gt;id);&#xA;&#xA;    if (strpos($elementType, 'Category') !== false) {&#xA;      return 'category';&#xA;    } else if (strpos($elementType, 'Entry') !== false) {&#xA;      return 'entry';&#xA;    }&#xA;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-02-20T00:16:39.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23922" PostTypeId="1" AcceptedAnswerId="23928" CreationDate="2018-02-20T00:49:28.773" Score="1" ViewCount="159" Body="&lt;p&gt;I would like to use the &lt;a href=&quot;https://cloudinary.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cloudinary&lt;/a&gt; service on Craft CMS assets tag. Also I would like to use AI tags, so I would like to store it on the Assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible to do it, or it is better to create a new section type, which has Asset, and I am decorating the extra fields what I needed?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-02-20T01:39:06.200" LastActivityDate="2018-11-02T18:40:30.340" Title="Assets management" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23924" PostTypeId="1" CreationDate="2018-02-20T07:26:41.327" Score="1" ViewCount="351" Body="&lt;p&gt;I am using a lot of translation with the |t / |translate filter. But the client wants to be able to edit those translations in the admin panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I thought about different ways to achieve that. Please drop your opinion.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new filter, refering to a table under the globals in admin panel. Never did that, but should be possible, right?&lt;/li&gt;&#xA;&lt;li&gt;Try to get and edit the translation arrays in the phps in the translation folder (dont know how thats possible)&lt;/li&gt;&#xA;&lt;li&gt;Don't use the |t filter at all. Instead maybe a matrix field type with 2  fields: one not translateable with the origin language and one translatable text field that is translateable. &lt;strong&gt;Disadvantage&lt;/strong&gt;: instead of the convinient |filter I have write code to get the right translation. Also: what about performance?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2018-02-20T07:37:56.230" Title="Best practise to use translate in admin panel" Tags="&lt;localization&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23925" PostTypeId="2" ParentId="23924" CreationDate="2018-02-20T07:32:40.300" Score="1" Body="&lt;p&gt;You could try if the &lt;a href=&quot;https://github.com/boboldehampsink/translate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Translate plugin for Craft CMS&lt;/a&gt; could help you out. You can use this plugin as a base for you own and save the values in a custom table and use the registerTranslateSources hook to return the values from your table&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would be some kind of mix between options 1 and option 2. Both are totally possible. I created such a plugin for my company too. Collect all uses of &lt;code&gt;|t&lt;/code&gt; and check if there is a language fallback in the plugin translation file or if there is one in the default Craft translation file. If not you can mark the word as &quot;untranslated&quot; if yes save the record as translated. In your cp you'll display all your records with the hint if they are translated or not&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-20T07:37:56.230" LastActivityDate="2018-02-20T07:37:56.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23926" PostTypeId="2" ParentId="17447" CreationDate="2018-02-20T10:12:26.370" Score="1" Body="&lt;p&gt;You have to add this setting:&#xA;&lt;code&gt;imageUpload: true&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;    $('.editor').redactor({&#xA;        s3: 's3upload.php',&#xA;        fileUpload: true,&#xA;        imageUpload: true,&#xA;&#xA;        buttons: ['format', 'bold', 'italic', 'underline', 'deleted',&#xA;                  'lists', 'outdent', 'indent',&#xA;                  'image', 'file', 'link', 'alignment', 'horizontalrule', 'source'],&#xA;&#xA;        &quot;plugins&quot;:[&quot;source&quot;],&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8022" LastEditorUserId="3951" LastEditDate="2018-02-21T21:30:01.447" LastActivityDate="2018-02-21T21:30:01.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23927" PostTypeId="1" CreationDate="2018-02-20T16:47:52.067" Score="1" ViewCount="40" Body="&lt;p&gt;I'm developing a bio section for a client. Every bio is linked to another bio creating a chain of bios. The order of this chain should be random. The schema would be as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bios: Bio a, Bio b, Bio c, Bio d&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Links: a-b, a-c, a-d, b-a, b-c, b-d, c-a, c-b, c-d, d-a, d-b, d-c&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible example would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Anna is born in England...&quot; (Bio a)&#xA;&quot;Anna met Bob during summer...&quot; (Link a-b)&#xA;&quot;Bob works a taxi-driver...&quot; (Bio b)&#xA;&quot;On this evening Bob met Charles...&quot; (Link b-c)&#xA;&quot;Charles ...&quot; (Bio c) and so on..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This schema generates a ton of possibilities. Currently there are 4 bios, but later on there will be probably 10. I know how to hard-code this, but it's a ton of &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;elseif&lt;/code&gt; and not really flexible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm flexible regarding the entry and field side, what ever fits best. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you code this? Any help appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here how it should look in the end:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/npSlJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/npSlJ.png&quot; alt=&quot;Bio Chain Example 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you navigate to &quot;Biography&quot; it generates a bio chain, if you click &quot;shuffle&quot; it generates a new one. I made different approaches so far, but all seem to involve to much code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my latest:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// set all bios &amp;amp; pick one randomly, assume it's Luka's &#xA;{% set allBios = craft.entries.section('biography') %}&#xA;{% set bioA = allBios.order('RAND()').limit(1).first() %} &#xA;{{bioA.text}}&#xA;&#xA;// Chose a random link connecting Luka to another member&#xA;// every bio has matrix fields holding the bio link texts&#xA;{% set linkA = bioA.biographyLink.type(&quot;bioLink&quot;).order('RAND()').limit(1).first() %}&#xA;{{linkA.bioLink}}&#xA;&#xA;// every matrix bio link has one tag to identify what connection it is&#xA;{% set tags = linkA.linkTag.first() %}&#xA;{% for tag in tags %}&#xA;&#xA;  // is it connecting Luka with Nemanja?&#xA;  {% if tag == &quot;con-luka-nemi&quot; %}&#xA;    // display bio Nemanja&#xA;    // pick random bio link Nemanja-?&#xA;    // display picked link&#xA;&#xA;      // search for next bio based on the chosen link above&#xA;      {% if tag == &quot;link-nemi-emma&quot; %}&#xA;        // diplay bio Emma&#xA;        // pick random bio link Emma-?&#xA;        // display picked link&#xA;&#xA;          // is it connecting Emma with Guillaume?&#xA;          {% if tag == &quot;link-emma-guillaume&quot; %}&#xA;            // display bio Guillaume&#xA;            // pick random bio link Guillaume&#xA;            // display picked link&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You see the problem, this generates many &lt;code&gt;ifs&lt;/code&gt; and is only 4 levels deep, at the end there will be 10 bios.&lt;/p&gt;&#xA;" OwnerUserId="7037" LastEditorUserId="7037" LastEditDate="2018-02-21T08:36:22.567" LastActivityDate="2018-02-21T08:36:22.567" Title="chain of random entries based on relations" Tags="&lt;templating&gt;&lt;entries&gt;&lt;structure&gt;&lt;conditional&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23928" PostTypeId="2" ParentId="23922" CreationDate="2018-02-20T18:08:18.187" Score="1" Body="&lt;p&gt;Found the answer in the craft cms 3 documentation on github:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/assets.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/assets.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the assets I can add fields, which could hold the information what I need!&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="9" LastEditDate="2018-11-02T18:40:30.340" LastActivityDate="2018-11-02T18:40:30.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23930" PostTypeId="1" CreationDate="2018-02-20T19:30:30.793" Score="1" ViewCount="41" Body="&lt;p&gt;In my project, I have a reference to XMLReader in a plugin; however, I get this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Class 'Craft\XMLReader' not found&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the code which calls it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$reader = new XMLReader();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can XMLReader be used within Craft, or can there be a customization which would allow it?  Thanks&lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="5557" LastEditDate="2018-03-01T09:15:34.167" LastActivityDate="2018-03-01T09:15:34.167" Title="Using XMLReader With Plugin" Tags="&lt;plugin-development&gt;&lt;php&gt;&lt;xml&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23931" PostTypeId="2" ParentId="23930" CreationDate="2018-02-20T19:42:29.833" Score="1" Body="&lt;p&gt;You need to be in the correct namespace try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$reader = new \XMLReader();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5311/class-craft-stdclass-not-found&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-20T19:42:29.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23932" PostTypeId="1" CreationDate="2018-02-20T20:42:26.777" Score="3" ViewCount="5777" Body="&lt;p&gt;I'm trying to build an array of values from 4 entries so I can lay them out in a comparison chart. I figured the best way to do this would be to add all of the values to a nested array. So I've set this up...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plandata = {&#xA;        'membership-type' : {&#xA;            'title' : 'Membership Type',&#xA;            'url' : '',&#xA;            'price' : '',&#xA;            'items' : []&#xA;        }&#xA;    }&#xA; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I'm iterating through a field and trying to add them to the items portion like so...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for amenity in entry.availableAmenities %}&#xA;    {% set plandata.membership-type.items = plandata.membership-type.items|merge(amenity.title) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I am getting a Template Error:  Unexpected token &quot;punctuation&quot; of value &quot;.&quot; (&quot;end of statement block&quot; expected).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me any insight as to what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="8026" LastEditorUserId="130" LastEditDate="2018-02-21T18:11:37.300" LastActivityDate="2018-02-21T18:11:37.300" Title="Unexpected token &quot;punctuation&quot; of value &quot;.&quot; (&quot;end of statement block&quot; expected)" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23933" PostTypeId="1" CreationDate="2018-02-20T21:27:10.620" Score="1" ViewCount="1459" Body="&lt;p&gt;I'm trying to create a download button which will allow the user to quickly download all assets in an entries image gallery. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've started by adding each image url into an array stored in a data attr of the button. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;button data-zip-download='[{% for imageUrl in entry.collectionImages %}&quot;{{imageUrl.url}}&quot;{% if not loop.last %},{% endif %}{% endfor %}]'&amp;gt;Download Gallery&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've then tried to get these URL's using jQuery, and zipping/downloading the zip with &lt;a href=&quot;https://stuk.github.io/jszip/&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSZip.js&lt;/a&gt; and &lt;a href=&quot;https://github.com/eligrey/FileSaver.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;FileSaver.js&lt;/a&gt;. Although through a bit of research I think I've found this is generally achieved through PHP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if anyone on here has had a similar situation and has an idea of how I can achieve this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not too experienced with ajax but have also read that ajax is necessary to get this working via jQuery. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far my JavaScript looks as so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('[data-zip-download]').each(function(){&#xA;var $this = $(this),&#xA;    urls = $this.data('zip-download'),&#xA;    files = [],&#xA;    zip = new JSZip();&#xA;&#xA;&#xA;for (var i = 0; i &amp;lt; urls.length; i++) {&#xA;    files.push(urls[i]);&#xA;};&#xA;&#xA;zip.file(files);&#xA;&#xA;$this.on('click', function(){&#xA;    zip.generateAsync({type:&quot;blob&quot;}).then(function (blob) { // 1) generate the zip file&#xA;        saveAs(blob, &quot;gallery.zip&quot;); // 2) trigger the download&#xA;    }, function (err) {&#xA;        $this.text(err);&#xA;    });&#xA;});&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This however only creates a corrupted zip file as I imagine I need to actually load those images via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose it would be ideal to simply use a craft/twig function if such a thing exists, although anything that works would be great haha.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for not having much knowledge on this specific need, really hoping someone out there can help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7611" LastEditorUserId="5557" LastEditDate="2018-03-01T09:15:25.977" LastActivityDate="2018-03-02T19:04:19.103" Title="How can I create a zip file containing all assets from an entry gallery?" Tags="&lt;templating&gt;&lt;image&gt;&lt;ajax&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23934" PostTypeId="2" ParentId="23932" CreationDate="2018-02-20T23:51:38.383" Score="3" Body="&lt;p&gt;I see three problems here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of them is the &lt;code&gt;-&lt;/code&gt; in &lt;code&gt;membership-type&lt;/code&gt;. &lt;code&gt;plandata.membership-type&lt;/code&gt; does not mean the membership-type field of plandata, but more something like &lt;code&gt;(plandata.membership) minus (type)&lt;/code&gt;. So you will either want to use &lt;code&gt;membershipType&lt;/code&gt; or &lt;code&gt;membership_type&lt;/code&gt;, or the less readable twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;attribute&lt;/a&gt; function: &lt;code&gt;attribute(plandata, 'membership-type')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem is that the twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; filter operates on arrays, and you are passing it a string. This won't work: &lt;code&gt;|merge(amenity.title)&lt;/code&gt;, this will: &lt;code&gt;|merge([amenity.title])&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third problem is that the twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/set.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;set&lt;/a&gt; assigns values to variables, and &lt;code&gt;plandata.membershipType.items&lt;/code&gt; is not a variable. The only way (in twig) to &quot;assign&quot; to a field of an array is with the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge&lt;/a&gt; filter. So you will need something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# create your amenityTitles array #}&#xA;{% set amenityTitles = [] %}&#xA;{% for amenity in entry.availableAmenities %}&#xA;  {% set amenityTitles = amenityTitles|merge([amenity.title]) %}&#xA;{% endfor %}&#xA;&#xA;{# merge those amenityTitles with membershipType (somehow preexisting) #}&#xA;{% set membershipType = membershipType | merge({items: amenityTitles})}&#xA;&#xA;{# merge that membershipType with plandata #}&#xA;{% set plandata = plandata | merge({membershipType: membershipType}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you can figure out a less deeply nested structure than that &lt;code&gt;plandata&lt;/code&gt; you will probably be happier given the limitations of twig.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-02-20T23:51:38.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23935" PostTypeId="2" ParentId="23878" CreationDate="2018-02-21T00:25:39.603" Score="1" Body="&lt;p&gt;This is just a math/logic error caused by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Increment count by 3 entries&#xA;count = (count) + 3;&#xA;&#xA;if (count &amp;gt;= totalCount) {&#xA;    $(&quot;#loadMore&quot;).fadeOut();&#xA;    console.log('count is larger than total count');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a &lt;code&gt;totalCount&lt;/code&gt; of 4.  If &lt;code&gt;count&lt;/code&gt; was initially 3, then it will now be 6 and greater than &lt;code&gt;totalCount&lt;/code&gt; and you bail, never loading the remainder of the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;100% untested, but something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;&#xA;  // load the first page of entries&#xA;  var page = 1;&#xA;&#xA;  // set this equal to pagination number&#xA;  var count = 3;&#xA;&#xA;  // Get the total count that we set above&#xA;  var totalCount = $(&quot;#totalRelatedCount&quot;).val();&#xA;&#xA;  var diff = totalCount;&#xA;&#xA;  $('#loadMore').click (function (e) {&#xA;      e.preventDefault();&#xA;&#xA;      console.log('count is ' + count);&#xA;      console.log('total count is ' + totalCount);&#xA;&#xA;      if (diff &amp;gt; 0) {&#xA;        $('#loading').fadeIn();&#xA;&#xA;        $.get( &quot;/{{ current_url }}/p&quot;+page , function( data ) {&#xA;&#xA;          $( &quot;.remaining .feat-box-container&quot; ).append( data );&#xA;&#xA;          // this won't hide why not?&#xA;          $('#loading').fadeOut();&#xA;&#xA;          // increase page&#xA;          page++;&#xA;&#xA;          diff = totalCount % count;&#xA;&#xA;          if (diff === 0) {&#xA;              $(&quot;#loadMore&quot;).fadeOut();&#xA;              console.log('count is larger than total count');&#xA;          } else {&#xA;              // Increment count by 3 entries&#xA;              count = count + diff;&#xA;          }&#xA;&#xA;        });&#xA;      }&#xA;&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-21T00:25:39.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23936" PostTypeId="2" ParentId="23933" CreationDate="2018-02-21T03:45:06.700" Score="2" Body="&lt;p&gt;I would recommend that you do this in php/plugin vs javascript. If you aren't familiar with writing plugins, you can start with the &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;BusinessLogic Plugin&lt;/a&gt; — which is a great little plugin template, all set up with example controller, variables, and service file with example actions, methods, etc. Just drop in into your plugins folder, and activate, and you should be good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple ways to set this up.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a form, plugin action, and pass urls or a gallery reference ID in a hidden form input field.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;set up an HTML form (w/ your download/submit button)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;add your custom action to your form (i.e. &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;businessLogic/downloadZip&quot;&amp;gt;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;add a hidden form input, and encode urls as a comma-separated list, or encode a gallery reference ID (i.e. &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;galleryid&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;add a form action handler to your plugins controller file&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;lookup the urls (if not already provided)&lt;/li&gt;&#xA;&lt;li&gt;generate the zip file and initiate download&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a custom route, encoded with gallery ID reference&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;add a route to your config/routes.php file&lt;/li&gt;&#xA;&lt;li&gt;set up your route action in your plugin's controller file with the gallery ID encoded as part of the route (i.e. 'downloads/gallery/13')&lt;/li&gt;&#xA;&lt;li&gt;lookup urls using the gallery reference ID, generate zip, and initiate download&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The advantage of using a custom route is that you can then just link to it from anywhere, or email the link to your client, without having to use a form. So, I would probably recommend using a route, unless you need to protect access for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To set up the plugin form action or route handler — have a look at the examples in the BusinessLogic plugin, which provides examples/instructions for both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To grab the the URLs in your plugin method — you can use crafts built-in methods, as described in the &lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements#fetching-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create the zip — doing a quick google search should come back with some good examples (like &lt;a href=&quot;http://makitweb.com/how-to-create-and-download-a-zip-file-with-php/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; that has a sample HTML form and the php zip code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that will get you started — let me know if you get stuck, and I might be able to help further.&lt;/p&gt;&#xA;" OwnerUserId="784" LastActivityDate="2018-02-21T03:45:06.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23937" PostTypeId="2" ParentId="23898" CreationDate="2018-02-21T04:00:24.120" Score="1" Body="&lt;p&gt;Thanks for the answers! I ended up using the advice found in this article that I have found to be endlessly useful - &lt;a href=&quot;https://www.webstoemp.com/blog/manipulating-craft-elementcriteriamodel-with-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manipulating Craft's ElementCriteriaModel objects with Twig&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gathering an array of ids of entries that pass the conditional, as well as another array of ones that don't. Then outputting them separately which allowed me to tweak the time order to &lt;code&gt;time(startTime) asc&lt;/code&gt; in the &lt;code&gt;postMidnight&lt;/code&gt; entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('lineUp').ids() %}&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).find() %}&#xA;&#xA;{% for category in categories %}&#xA;&#xA;  {# Fetch all of the entries related to this category #}&#xA;  {% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;    {# Group entries by date and order by start time #}&#xA;    {% for date, entries in entries.order('whatDateAreTheyPerforming', 'time(startTime) desc')|&#xA;  group('whatDateAreTheyPerforming') %}&#xA;        &amp;lt;div&amp;gt;&#xA;&#xA;            &amp;lt;h3&amp;gt;{{ date | date('l') }} &amp;lt;span&amp;gt;{{ date | date('jS') }}&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;            {# Arrays to store the IDs of the entries as we find them #}&#xA;            {% set postMidnightIDs = [] %}&#xA;            {% set preMidnightIDs = [] %}&#xA;&#xA;            &amp;lt;ul&amp;gt;&#xA;&#xA;                {% for entry in entries %}&#xA;                    {% if entry.startTime &amp;gt;= entry.startTime|date_modify('00:00') and entry.endTime &amp;lt;= entry.endTime|date_modify('05:00') %}&#xA;                       {% set postMidnightIDs = postMidnightIDs|merge([entry.id]) %}&#xA;                       {# Or of course you could output the data here but I like to keep building and output separately for clarity #}&#xA;                   {% else %}&#xA;                       {% set preMidnightIDs = preMidnightIDs|merge([entry.id])  %}&#xA;                   {% endif %}&#xA;                {% endfor %}&#xA;&#xA;                {% set postMidnightIDsString = postMidnightIDs|join(', ') %}&#xA;                {% set preMidnightIDsString = preMidnightIDs|join(', ')  %}&#xA;&#xA;                {# Entries that appear between midnight and 5am #}&#xA;                {% for entry in craft.entries.section('lineUp').id(postMidnightIDsString).order('time(startTime) asc').find() %}&#xA;&#xA;                    {# Created a macro to avoid code duplication #}&#xA;                    {{ macros.lineUpItem(entry.artistLogo, entry.title, entry.url, entry.whatDateAreTheyPerforming, entry.startTime, entry.endTime, entry.sponsor) }}&#xA;&#xA;                {% endfor %}&#xA;&#xA;                {# Entries that appear between 5am and midnight #}&#xA;                {% for entry in craft.entries.section('lineUp').id(preMidnightIDsString).order('time(startTime) desc').find() %}&#xA;&#xA;                    {{ macros.lineUpItem(entry.artistLogo, entry.title, entry.url, entry.whatDateAreTheyPerforming, entry.startTime, entry.endTime, entry.sponsor) }}&#xA;&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&amp;lt;!-- col --&amp;gt;&#xA;    {% endfor %} &#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="4823" LastEditDate="2018-02-21T05:20:36.543" LastActivityDate="2018-02-21T05:20:36.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23938" PostTypeId="1" AcceptedAnswerId="23941" CreationDate="2018-02-21T06:50:26.823" Score="1" ViewCount="217" Body="&lt;p&gt;I would like to add the URL of the channel entry I have selected (atm 2 channels are available to choose from), so I would like a url like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;summerhouses&lt;/strong&gt;/product1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;greehnouses&lt;/strong&gt;/product2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how would I modify the code below to achieve this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below just shows: /product1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}&#xA;{% for entry in row %}&#xA;    &amp;lt;h2 class=&quot;product-card-title&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.getUrl }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;span class=&quot;product-card-desc&quot;&amp;gt;Product Description&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;product-card-price&quot;&amp;gt;{{ entry.price }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2018-02-21T13:55:23.617" Title="Include the URL of a related entry field" Tags="&lt;entry&gt;&lt;url&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23939" PostTypeId="1" AcceptedAnswerId="23942" CreationDate="2018-02-21T13:09:38.247" Score="1" ViewCount="598" Body="&lt;p&gt;I'd like to retrieve the name of a section based on a url segment. Normally I would use {{entry.section.name}}, but this doesn't work, since there is no entry available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got this working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section(craft.request.getSegment(1)).first %}&#xA;&#xA;&amp;lt;h2&amp;gt;{{entry.section.name}}&amp;lt;/h2&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means that I first have to get an entry and then reverse retrieve the section it belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there no direct way to get the section name based on a url?&lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2018-02-21T14:08:52.240" Title="Get the section name based on a url segment" Tags="&lt;url&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23941" PostTypeId="2" ParentId="23938" CreationDate="2018-02-21T13:55:23.617" Score="1" Body="&lt;p&gt;Try this - using {{ entry.section }} and {{ entry.slug }}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}&#xA;{% for entry in row %}&#xA;    &amp;lt;h2 class=&quot;product-card-title&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.section}}/{{ entry.slug }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;span class=&quot;product-card-desc&quot;&amp;gt;Product Description&amp;lt;/span&amp;gt;&#xA;    &amp;lt;span class=&quot;product-card-price&quot;&amp;gt;{{ entry.price }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-02-21T13:55:23.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23942" PostTypeId="2" ParentId="23939" CreationDate="2018-02-21T14:08:52.240" Score="3" Body="&lt;p&gt;Do you mean&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.sections.getSectionByHandle(craft.request.getSegment(1)) %}&#xA;{{ section.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-21T14:08:52.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23943" PostTypeId="1" AcceptedAnswerId="23944" CreationDate="2018-02-21T15:01:49.207" Score="1" ViewCount="652" Body="&lt;p&gt;When I delete an asset in the CP, the asset/file will be deleted, but it is still shown in the assets list (without thumb).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue can't be solved with the &quot;Update asset index&quot; function. (There is also the file listed: &quot;Missing file&quot;!)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;yii\base\ErrorException: unlink(/Applications/MAMP/htdocs/xxxxxxxx/storage/runtime/assets/sources/108.png): No such file or directory in /Applications/MAMP/htdocs/xxxxxxxx/vendor/yiisoft/yii2/helpers/BaseFileHelper.php:407&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5274" LastEditorUserId="5557" LastEditDate="2018-02-21T15:23:29.350" LastActivityDate="2018-02-21T15:56:16.963" Title="Craft 3 RC 11: Deleting Assets Issue" Tags="&lt;assets&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2018-02-23T15:08:48.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="23944" PostTypeId="2" ParentId="23943" CreationDate="2018-02-21T15:31:59.837" Score="1" Body="&lt;p&gt;This looks to have been fixed a few hours ago:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/2463&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2463&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could apply the fix yourself for an immediate solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/commit/30db5af5b596e267db136a218209a65cc9fde36e&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/30db5af5b596e267db136a218209a65cc9fde36e&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8029" LastActivityDate="2018-02-21T15:31:59.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23945" PostTypeId="2" ParentId="23943" CreationDate="2018-02-21T15:56:16.963" Score="1" Body="&lt;p&gt;Problem is related to the issue Luke pointed out but in a different location within the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change line 1060 in file /craft/vendor/craftcms/cms/src/services/AssetTransforms.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!FileHelper::unlink($file)) {&#xA;    Craft::warning(&quot;Unable to delete the file \&quot;{$file}\&quot;.&quot;, __METHOD__);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (file_exists($file) &amp;amp;&amp;amp; !FileHelper::unlink($file)) {&#xA;    Craft::warning(&quot;Unable to delete the file \&quot;{$file}\&quot;.&quot;, __METHOD__);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7892" LastActivityDate="2018-02-21T15:56:16.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23948" PostTypeId="1" AcceptedAnswerId="23965" CreationDate="2018-02-21T20:29:22.010" Score="1" ViewCount="584" Body="&lt;p&gt;Having successfully installed Craft 3 via composer – all seems fine but on each load of the admin dashboard I get a notice on red bg: &#xA;'An unknown error occurred' need I worry about this? couldn't see anything obvious in the logs – all else seems fine – using php 7.0.0 / Mamp Pro and used the line below when setting up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PATH=&quot;/Applications/MAMP/bin/php/php7.0.0/bin:$PATH&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or is a fresh install required?&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2018-02-22T23:20:29.790" Title="Craft 3 dashboard error" Tags="&lt;craft3&gt;&lt;dashboard&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23950" PostTypeId="1" AcceptedAnswerId="23951" CreationDate="2018-02-21T22:14:09.583" Score="1" ViewCount="446" Body="&lt;p&gt;I'm outputting an element criteria model in a Craft 2 plugin of some entries in a channel.  I noticed that when I fetch the entries the standard template way &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('channelHandle') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am then able to do something like the following to refine the number of entries with the lightswitch turned on: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set refinedEntries = entries.customLightswitchField(1)|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I fetch my entries in my plugin, output them into the template, then try refining it as above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// plugin&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'channelHandle';&#xA;$entries = $criteria-&amp;gt;find();&#xA;return $entries;&#xA;&#xA;// template&#xA;{% set entries = craft.myPlugin.fetch() %}&#xA;{% set refinedEntries = entries.customLightswitchField(1)|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...I then get an &lt;code&gt;Array to string conversion&lt;/code&gt; PHP notice.  I'm also not able to use things like &lt;code&gt;.first()&lt;/code&gt; like I normally would.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behavior?  Am I missing something when returning an element criteria model through a plugin?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-02-21T22:17:48.897" Title="Returning ElementCriteriaModel of entries via plugin" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23951" PostTypeId="2" ParentId="23950" CreationDate="2018-02-21T22:17:48.897" Score="2" Body="&lt;p&gt;Of course this is the expected behavior because you don't return an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; from your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do &lt;code&gt;return $criteria-&amp;gt;find();&lt;/code&gt; so you'll return an array of entries but not an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; if you want to return the object instead of the entries you have to do &lt;code&gt;return $criteria&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as you use the &lt;code&gt;find()&lt;/code&gt; method Craft builds a query based on your &lt;code&gt;ElementCriteriaModel&lt;/code&gt;, executes it and returns you an array of elements or null.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-21T22:17:48.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23952" PostTypeId="2" ParentId="14502" CreationDate="2018-02-21T22:50:57.347" Score="1" Body="&lt;p&gt;There's also a really good answer explained in this ticket. Similar explanation but this made it click for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/a/23951/4433&quot;&gt;https://craftcms.stackexchange.com/a/23951/4433&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-02-21T22:50:57.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23954" PostTypeId="1" AcceptedAnswerId="23955" CreationDate="2018-02-22T02:03:22.030" Score="2" ViewCount="823" Body="&lt;p&gt;Is there a way or a plugin that allows you to add columns and change columns heading from within the entry? Instead of defining column heading while creating the table field. It would be nice to have the ability to add/delete columns and have the table be dynamic. &lt;/p&gt;&#xA;" OwnerUserId="6995" LastActivityDate="2018-03-15T01:57:35.703" Title="Adding Columns to a table" Tags="&lt;custom-fieldtype&gt;&lt;custom-field&gt;&lt;table-field&gt;&lt;plugin-supertable&gt;&lt;table&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23955" PostTypeId="2" ParentId="23954" CreationDate="2018-02-22T06:22:42.430" Score="4" Body="&lt;p&gt;With the &lt;a href=&quot;http://plugins.supercooldesign.co.uk/plugin/table-maker/licence&quot; rel=&quot;nofollow noreferrer&quot;&gt;supercool&lt;/a&gt; table maker you can create dynamic tables. Is this what you are looking for? &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-22T06:22:42.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23956" PostTypeId="1" AcceptedAnswerId="23957" CreationDate="2018-02-22T09:04:17.067" Score="1" ViewCount="647" Body="&lt;p&gt;How to fetch Elements with a complex DB query?&#xA;E.g. with some nested AND/OR conditions or just apply two conditions to one field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example my Elements have a field &lt;code&gt;eventDate&lt;/code&gt;. I want to fetch all Elements where &lt;code&gt;eventDate&lt;/code&gt; is &lt;code&gt;NULL&lt;/code&gt; or equals &quot;1900-01-01&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard way to build Element Criteria is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;eventDate = '=...';&#xA;$models = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't provide an ability to apply several conditions for same field. Is it possible at all without assembling huge queries manually?&lt;/p&gt;&#xA;" OwnerUserId="3318" LastEditorUserId="5557" LastEditDate="2018-02-22T10:01:59.207" LastActivityDate="2018-02-22T10:07:33.307" Title="How to build complex Element Criteria?" Tags="&lt;elementcriteriamodel&gt;&lt;query&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23957" PostTypeId="2" ParentId="23956" CreationDate="2018-02-22T10:00:55.853" Score="1" Body="&lt;p&gt;You can apply conditions within the same field but you can't create conditions for multiple fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8992/how-to-show-entries-which-are-live-between-dates-regardless-of-postdate-or-expir&quot;&gt;Here&lt;/a&gt; are some great examples&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria-&amp;gt;expiryDate = 'or, :empty:, =' . $yourDateValue;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However you can't combine conditions for multiple fields. So you can't say &lt;code&gt;Where (fieldX = 4 OR FieldY = 5)&lt;/code&gt; you would have to create an sql object based on your &lt;code&gt;ElementCriteriaModel&lt;/code&gt; and use Yii's great &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/de/database.query-builder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Query Builder&lt;/a&gt; for that and use the &lt;a href=&quot;http://www.yiiframework.com/doc/api/1.1/CDbCommand#orWhere-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;OrWhere&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-22T10:07:33.307" LastActivityDate="2018-02-22T10:07:33.307" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23958" PostTypeId="1" AcceptedAnswerId="23966" CreationDate="2018-02-22T11:02:09.233" Score="1" ViewCount="394" Body="&lt;p&gt;It's easy to know if a product has a valid Sale applied to it with product.defaultVariant.onSale - but how do you know &lt;em&gt;which&lt;/em&gt; Sales are being applied to the product? How do you output that the product is currently part of a specific named sale, and any associated content you might want to show?&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2018-02-22T20:51:03.763" LastActivityDate="2021-05-27T08:00:18.893" Title="How do you show which Sale a product has applied in Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23959" PostTypeId="1" CreationDate="2018-02-22T14:19:45.870" Score="1" ViewCount="36" Body="&lt;p&gt;I'm a bit stumped with this one and wonder if anyone else has come across it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've a site live which is using the 'Formerly' plugin amongst others, since a recent update the site has gone offline twice in the last week do to the formerly plugin needing to make changes to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't think this could happen on it's own? It's like the plugins migration wants to run on it's own at weird intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to debug this, anyone else had this issue?&lt;/p&gt;&#xA;" OwnerUserId="375" LastActivityDate="2018-02-22T14:38:25.553" Title="Migrations running on their own causing site down" Tags="&lt;plugins&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23960" PostTypeId="2" ParentId="23959" CreationDate="2018-02-22T14:38:25.553" Score="1" Body="&lt;p&gt;Plugin Migrations run as soon as &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/de/database.migration&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt; finds a new file. So as soon as there is a new file in your migration folder Craft starts to migrate it the next time someone triggers Craft tasks (usually by entering the CP). When you hit the &lt;code&gt;Update&lt;/code&gt; button in your CP there could be that chance that a plugin makes an update -&gt; pulls those migration files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you mean with &quot;how to debug this&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to remove the task, you can clear the task table and get rid of it. You can take a look at the plugins migration folder and see if there are any new files.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-22T14:38:25.553" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23961" PostTypeId="2" ParentId="23958" CreationDate="2018-02-22T15:28:56.350" Score="1" Body="&lt;p&gt;Thanks to Mike Pepper on the Slack chat, this is the answer. A bit disappointing that we need to go through hoops like this, but it works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set productSales = [] %}&#xA;{% set allSales     = craft.commerce.getSales() %}&#xA;&#xA;{% for sale in allSales if product.id in sale.productIds or product.typeId in sale.productTypeIds %}&#xA;    {% set productSales = productSales|merge([sale]) %}&#xA;{% endfor %}&#xA;&#xA;{% for sale in productSales if product.defaultVariant.onSale %}&#xA;    &amp;lt;div class=&quot;sale&quot;&amp;gt;&#xA;        &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;{{ sale.name }}&amp;lt;/b&amp;gt; - {{ sale.description }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-02-22T15:28:56.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23962" PostTypeId="1" CreationDate="2018-02-22T16:01:14.870" Score="1" ViewCount="288" Body="&lt;p&gt;I'm trying to work out if the following is possible in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I have a single entry, I want to theoretically tag it as a 'blog' and 'about', both of which are sections&#xA;I want to then have that entry displayed within both the blog, and the about sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can tell an entry is constrained to it's parent section. But is this possible using tags or something similar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally a craft2 answer, as the site is being developed in craft 2, with the plan to upgrade to craft3 in the summer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tim&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I need to describe the problem more, with an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have an entry called 'Meet the team', and two sections 'England' and 'U.S.A', the country sections act like normal structure sections - but the Staff Team entry is applicable to both sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible when displaying the England entries to display the Staff Team entry in addition to the USA entries to display the Staff Team entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site in development is planning on having many of these types of pages - so a hard-coded solution to 'get' the post isn't possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of describing it is the Wordpress way, of having 1 page in multiple categories, so each category shows that page.&lt;/p&gt;&#xA;" OwnerUserId="8039" LastEditorUserId="8039" LastEditDate="2018-02-23T09:58:29.597" LastActivityDate="2018-02-23T09:58:29.597" Title="Entry within multiple sections" Tags="&lt;entries&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23963" PostTypeId="2" ParentId="23086" CreationDate="2018-02-22T21:40:56.037" Score="1" Body="&lt;p&gt;You could have them make a one-time payment, then generate a gift code that can be redeemed when a user fills out the subscription payment form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did that by creating a plugin and utilizing the charge.onCharge event, it makes sure it was a gift code purchase, then generates a code that is stored in the charge's coupon code table and you can either have it send an email with the code to person who is to redeem it or just display it on the screen.&lt;/p&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2018-02-22T21:40:56.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23964" PostTypeId="2" ParentId="23962" CreationDate="2018-02-22T23:03:31.827" Score="1" Body="&lt;p&gt;When it's only for frontend: you can search for entries from different sections with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set entries = craft.entries.section(['blog', 'about', 'foo']).find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns you all enabled/active entries from all the sections with the handle blog, about or foo. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-22T23:03:31.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23965" PostTypeId="2" ParentId="23948" CreationDate="2018-02-22T23:20:29.790" Score="0" Body="&lt;p&gt;If you're running MAMP (and even if you're not, but it's common you are) and you're getting this error when connecting to Craft's web services:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;cURL error 35: Unknown SSL protocol error in connection to craftcms.com:443&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then you're running an older version of MAMP and you need to upgrade to the latest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The older versions are trying to connect over https using an older SSL protocol (TLS 1.0) that is no longer supported.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-22T23:20:29.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23966" PostTypeId="2" ParentId="23958" CreationDate="2018-02-23T01:34:10.530" Score="3" Body="&lt;p&gt;The real answer is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for sale in variant.sales %}&#xA;&#xA;    {% sale.description %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2021-05-27T08:00:18.893" LastActivityDate="2021-05-27T08:00:18.893" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23967" PostTypeId="1" AcceptedAnswerId="23968" CreationDate="2018-02-23T03:12:56.353" Score="1" ViewCount="878" Body="&lt;p&gt;I'm making a Craft 3 plugin to read a CSV file and insert the data as Categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; to scaffold my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't access &lt;code&gt;craft()&lt;/code&gt; in my controller (ImportCsvController.php).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My controller action:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function actionDoSomething()&#xA;    {&#xA;      $categoriesGroups = craft()-&amp;gt;categories-&amp;gt;getAllGroups();&#xA;      return json_encode(&quot;hi&quot;);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My namespacing:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;&#xA;namespace workyard\csvtocategoryimporter\controllers;&#xA;use workyard\csvtocategoryimporter\Csvtocategoryimporter;&#xA;use craft\web\Controller;&#xA;use Craft;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The error message:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Call to undefined function workyard\csvtocategoryimporter\controllers\craft()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas why I can't access craft(). Do I have to &quot;use&quot; something in the namespace section?&lt;/p&gt;&#xA;" OwnerUserId="8041" LastActivityDate="2018-02-23T03:22:09.720" Title="Craft 3 - Can't access the craft() in plugin controller" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23968" PostTypeId="2" ParentId="23967" CreationDate="2018-02-23T03:22:09.720" Score="5" Body="&lt;p&gt;&lt;code&gt;craft()&lt;/code&gt; is gone in Craft 3; instead you will be accessing &lt;code&gt;Craft::$app-&amp;gt;&lt;/code&gt; for most things. I'd suggest generating your Craft 3 plugin scaffolding at &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;, and if you leave code comments on, it'll give you some hints on how to do stuff like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article might also be helpful to you: &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;noreferrer&quot;&gt;So You Wanna Make a Craft 3 Plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-02-23T03:22:09.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23969" PostTypeId="1" CreationDate="2018-02-23T07:05:27.123" Score="2" ViewCount="882" Body="&lt;p&gt;I am new to Craft CMS.  Please tell me about how can I save data into database in Craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have searched a lot of results about my query but nothing give advantage to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8043" LastEditorUserId="57" LastEditDate="2018-02-23T21:14:17.370" LastActivityDate="2020-03-30T09:34:44.273" Title="Simple save data to db in Craft CMS" Tags="&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23970" PostTypeId="2" ParentId="23969" CreationDate="2018-02-23T08:00:54.693" Score="4" Body="&lt;p&gt;I suggest you to read about the &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii Query Builder&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()&#xA;    -&amp;gt;insert('mytablename', array(&#xA;        'field1'    =&amp;gt; 'foo',&#xA;        'field2'    =&amp;gt; 'bar'&#xA;    ));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use &lt;a href=&quot;http://www.yiiframework.com/doc/guide/1.1/en/database.ar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Active Records&lt;/a&gt; in &lt;a href=&quot;https://craftcms.com/docs/plugins/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$record = new Record();&#xA;$record-&amp;gt;field1 = 'foo';&#xA;$record-&amp;gt;field2 = 'bar';&#xA;$record-&amp;gt;save();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use Craft Elements (entries/categories/tags)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$attributes = [&#xA;   'section'   =&amp;gt; $yourSectionId,&#xA;   'entryType' =&amp;gt; $yourEntryTypeId,&#xA;   'field1'    =&amp;gt; 'foo',&#xA;   'field2'    =&amp;gt; 'bar'&#xA;];&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttributes($attributes);&#xA;craft()-&amp;gt;entries()-&amp;gt;saveEntry($entry); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-23T08:00:54.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23971" PostTypeId="1" CreationDate="2018-02-23T11:23:09.597" Score="1" ViewCount="147" Body="&lt;p&gt;When I install the Craft Commerce plugin on Craft CMS, I found an error &quot;unknown error occurred&quot;.  Please tell me about this error and how to fix it. I will be very thankful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a lot of google search on it but nothing useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again.&lt;/p&gt;&#xA;" OwnerUserId="8043" LastEditorUserId="57" LastEditDate="2018-02-23T21:16:27.263" LastActivityDate="2018-02-23T21:16:27.263" Title="Unknown error occured?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23972" PostTypeId="2" ParentId="23971" CreationDate="2018-02-23T12:57:52.097" Score="1" Body="&lt;p&gt;it is simple ! only edit php.ini file which is in your xampp folder . increase msql connection time and increase cache i.e limit size and that solve.&lt;/p&gt;&#xA;" OwnerUserId="8043" LastActivityDate="2018-02-23T12:57:52.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23973" PostTypeId="1" AcceptedAnswerId="23974" CreationDate="2018-02-23T14:13:13.347" Score="1" ViewCount="108" Body="&lt;p&gt;I have a Smart Map setup and &lt;a href=&quot;https://missionthriftstore.com/store/find&quot; rel=&quot;nofollow noreferrer&quot;&gt;installed it on a site&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The section averages 300 page views per day according to Google Analytics, but Google API is maxing out the 2500 requests on the free plan. I've bumped up to a paid plan, but does anyone know why there are so many requests?&lt;/p&gt;&#xA;" OwnerUserId="7059" LastActivityDate="2021-01-01T06:58:43.773" Title="High amount of API calls from Smart Map" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23974" PostTypeId="2" ParentId="23973" CreationDate="2018-02-23T17:52:06.803" Score="2" Body="&lt;p&gt;Drawing the map is multiple API calls. And interacting with the map uses additional API calls.&lt;/p&gt;&#xA;&lt;p&gt;I opened the Inspector (in Firefox here), and you can see a ton of calls to maps.google.com - see all the file calls &lt;code&gt;vt?pb...&lt;/code&gt; - each one is a block of the map background.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p84zR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p84zR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And then, as you drag the map around, zoom, etc, it's making additional calls to get the portions of the map it doesn't have. And you can see them pop-up in the inspector.&lt;/p&gt;&#xA;&lt;p&gt;So, a bunch of calls to draw the map, and more as you change your view of the map.&lt;/p&gt;&#xA;&lt;p&gt;You could try the static image map &lt;code&gt;{{ craft.smartMap.img(locations, options) }}&lt;/code&gt; instead of the standard &lt;code&gt;{{ craft.smartMap.map(locations, options) }}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Alternative ideas, disable 'zoomable' and/or 'scrollable' in your map settings (&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/customizing-the-map-in-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;more about those options here&lt;/a&gt;) - less interaction = less api calls.&lt;/p&gt;&#xA;&lt;p&gt;The static map loads a lot less API resources, but takes a longer to generate (and just isn't as good).&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="45" LastEditDate="2021-01-01T06:58:43.773" LastActivityDate="2021-01-01T06:58:43.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23975" PostTypeId="1" AcceptedAnswerId="23976" CreationDate="2018-02-23T18:00:24.690" Score="0" ViewCount="349" Body="&lt;p&gt;I've been a long time user of Mamp Pro, but I'm getting an error using v3 with Craft3, due to needing to update to Mamp Pro 4, however after some hrs trying to update to Mamp 4, I can't get mySQL to start and therefore wondered what alternatives to Mamp other devs use – which isn't overly complex?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2018-02-23T19:11:42.093" Title="Alternatives to Mamp Pro – which works with Craft CMS" Tags="&lt;craft3&gt;&lt;mysql&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23976" PostTypeId="2" ParentId="23975" CreationDate="2018-02-23T18:18:37.267" Score="4" Body="&lt;p&gt;I'd highly recommend you check out &lt;a href=&quot;https://laravel.com/docs/5.6/valet&quot; rel=&quot;noreferrer&quot;&gt;Laravel Valet&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an article on it that may be useful to you as well: &lt;a href=&quot;https://medium.com/@jalendport/running-craft-cms-3-on-laravel-valet-6df61e5193fd&quot; rel=&quot;noreferrer&quot;&gt;Running Craft CMS 3 on Laravel Valet&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-02-23T19:11:42.093" LastActivityDate="2018-02-23T19:11:42.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23977" PostTypeId="2" ParentId="23145" CreationDate="2018-02-23T21:22:53.713" Score="5" Body="&lt;p&gt;Turns out the &lt;code&gt;general.php&lt;/code&gt; file had the following line (&lt;a href=&quot;https://craftcms.com/docs/config-settings#errorTemplatePrefix&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt;) in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'errorTemplatePrefix' =&amp;gt; &quot;_errors/&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once I'd created the proper folder and files, all worked as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;a href=&quot;https://twitter.com/CraftCMS/status/967144907541397504&quot; rel=&quot;noreferrer&quot;&gt;@CraftCMS Twitter person&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-02-23T21:22:53.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23979" PostTypeId="1" AcceptedAnswerId="23984" CreationDate="2018-02-24T12:06:09.387" Score="2" ViewCount="392" Body="&lt;p&gt;I want to output a list of all orders of all customers, including customers first name and last name. But can't get these two elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have now is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastOrders = craft.commerce.orders.find() %}&#xA;{% for order in pastOrders %}&#xA;    {% for item in order.lineItems %}&#xA;    &amp;lt;tr&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ order.id }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ craft.commerce.customer.firstName }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ craft.commerce.customer.lastName }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ item.description }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ order.email }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ item.options.evenement }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ item.note }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{order.orderStatus.name}}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;td&amp;gt;{{ order.datePaid.localeDate() }}&amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as you may guess, I've got an error in both fields firstName lastName&lt;/p&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2018-02-25T07:52:00.663" Title="Fetching Customer firstName lastName" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23980" PostTypeId="1" CreationDate="2018-02-24T12:12:07.293" Score="1" ViewCount="24" Body="&lt;p&gt;I have a relationship field within my member profile. It allows users to connect to each other, i can list those that currentUser is connected to, but i need to list all other members that are connected to currentUser, i.e. a reverse relationship. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this, but it just lists those that the currentUser is connected to, not the reverse, where am i going wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myReverseConnections = craft.users.relatedTo(currentUser) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4936" LastActivityDate="2018-02-24T12:27:33.363" Title="List users connected to me" Tags="&lt;users&gt;&lt;relations&gt;&lt;user-profile&gt;&lt;relatedto&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23981" PostTypeId="2" ParentId="23980" CreationDate="2018-02-24T12:27:33.363" Score="1" Body="&lt;p&gt;Solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set myReverseConnections = craft.users.relatedTo({&#xA;        targetElement: currentUser,&#xA;        field: 'yourCustomRelationshipField'&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4936" LastActivityDate="2018-02-24T12:27:33.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23982" PostTypeId="2" ParentId="23979" CreationDate="2018-02-24T14:17:24.367" Score="1" Body="&lt;p&gt;I never used Craft commerce so this answer could be totally wrong but just from looking at the docs the &lt;a href=&quot;https://craftcommerce.com/docs/order-model#customerid&quot; rel=&quot;nofollow noreferrer&quot;&gt;Order Model&lt;/a&gt; has the attribute &lt;code&gt;customerId&lt;/code&gt; and the &lt;code&gt;customer&lt;/code&gt; attribute that stores the &lt;a href=&quot;https://craftcommerce.com/docs/customer-model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Customer Model&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/order-model#customerid&quot; rel=&quot;nofollow noreferrer&quot;&gt;customerId&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The customer record for this order. You can also use customer to get the customer model which can tell you which craft user made the order, as well as access the addresses for this customer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;customer model&lt;/code&gt; contains a &lt;a href=&quot;https://craftcommerce.com/docs/customer-model#user&quot; rel=&quot;nofollow noreferrer&quot;&gt;user&lt;/a&gt; attribute that stores the default Craft &lt;a href=&quot;https://craftcms.com/docs/templating/usermodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Model&lt;/a&gt; or null&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/customer-model#user&quot; rel=&quot;nofollow noreferrer&quot;&gt;user&lt;/a&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Returns a User Model if the customer is logged in, or null if the customer is a guest.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So theoretically you should do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set customer = order.customer %}&#xA;{% if customer is not null %}&#xA;    {% set user = customer.user %}&#xA;    {% if user is not null %}&#xA;        {{ user.firstName }} {{ user.lastName }}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-24T14:17:24.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23983" PostTypeId="2" ParentId="16077" CreationDate="2018-02-24T22:20:26.530" Score="3" Body="&lt;p&gt;Came across this same situation myself. Was able to resolve with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$entry-&amp;gt;entriesFieldWithDisabledEntry-&amp;gt;status(null)-&amp;gt;first()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3380" LastActivityDate="2018-02-24T22:20:26.530" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23984" PostTypeId="2" ParentId="23979" CreationDate="2018-02-25T07:52:00.663" Score="3" Body="&lt;p&gt;Not all orders will necessarily have a craft user associated with the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all orders must have a billing address, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;order.billingAddress.firstName&lt;/code&gt; and &lt;code&gt;order.billingAddress.lastName&lt;/code&gt; will get you what you need.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-02-25T07:52:00.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23985" PostTypeId="1" AcceptedAnswerId="23988" CreationDate="2018-02-25T15:41:33.513" Score="1" ViewCount="59" Body="&lt;p&gt;I'm currently trying to make my navigation be not included on my index page due to my loading a different style of page - but - include it on every other page. My current layout looks like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exclusions = ['index'] %}&#xA;{% if craft.request.firstSegment not in exclusions  %}&#xA;    {% include '_navigation' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this seems to not work on my &lt;strong&gt;&quot;index.html&quot;&lt;/strong&gt; page. Do I need to set it a title? or set an exclusion name here?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-02-26T04:19:11.693" Title="Exclude a block from appearing on a specific page" Tags="&lt;blocks&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23986" PostTypeId="2" ParentId="17692" CreationDate="2018-02-25T18:21:43.487" Score="1" Body="&lt;p&gt;The reason this happens is Craft has a default limit of 100 for all ElementCriteriaModel objects (this includes assets, categories, entries, tags, and users, &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel#creating-an-elementCriteriaModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;also relations&lt;/a&gt; as you encountered). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't made terribly clear in the documentation, but you can see it under &lt;a href=&quot;https://craftcms.com/classreference/models/ElementCriteriaModel#defineAttributes-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;the defineAttributes() method on the ElementCriteriaModel class reference page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you discovered, adding a &lt;code&gt;.limit(null)&lt;/code&gt; parameter overrides that limit.&lt;/p&gt;&#xA;" OwnerUserId="7748" LastEditorUserId="5557" LastEditDate="2018-02-25T18:39:46.803" LastActivityDate="2018-02-25T18:39:46.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23987" PostTypeId="1" CreationDate="2018-02-25T22:58:55.003" Score="1" ViewCount="420" Body="&lt;p&gt;I’m experimenting with the CraftQL plugin and React with Craft 3, and I’m really liking the similar syntax to standard Twig element queries, and the fact I don't need to manually configure API endpoints as I would if I was to set up a REST API using the ElementAPI plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not certain how I can cache data using this approach to prevent unnecessary database calls, and the scalability of such a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a REST API I'd be able to cache the endpoints using Nginx or Varnish, but this doesn't seem to be an option using GraphQL. There seem to be several options for GraphQL application-level caching in the Node ecosystem (e.g. &lt;a href=&quot;https://github.com/apollographql/apollo-cache-control&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/apollographql/apollo-cache-control&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any options for caching database queries using the Yii Query Caching functionality (&lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-caching-data.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.yiiframework.com/doc-2.0/guide-caching-data.html&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or any other techniques that may help an implementation like this scale?&lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2018-03-15T15:58:50.993" Title="What are my caching options when using CraftQL and React?" Tags="&lt;cache&gt;&lt;plugin-elementapi&gt;&lt;yii&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23988" PostTypeId="2" ParentId="23985" CreationDate="2018-02-26T04:10:07.183" Score="2" Body="&lt;p&gt;You can check against the Entry Type as well. &#xA;I would try to validate it with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exclusions = ['home'] %}    &#xA;{% if entry.type not in exclusions %}&#xA;....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7815" LastEditorUserId="7815" LastEditDate="2018-02-26T04:19:11.693" LastActivityDate="2018-02-26T04:19:11.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23991" PostTypeId="1" CreationDate="2018-02-26T13:58:13.503" Score="1" ViewCount="160" Body="&lt;p&gt;I have a local, staging and production setup (Craft 2.6.3011).&#xA;My local site is having a problem with transforms that seems to be related to the mobile detect plugin (I am using Mikkel Rummelhoff's &lt;a href=&quot;https://github.com/mmikkel/Detect-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Detect Plugin&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Detect code I'm using in my template is: &lt;code&gt;{% set isMobile = craft.detect.isMobile ? '1' : '0' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The home page has four images that 404 with transform urls.&#xA;If I look at the response I see the following errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig_Error_Runtime&#xA;Neither the property &quot;detect&quot; nor one of the methods &quot;detect()&quot;, &quot;getdetect()&quot;/&quot;isdetect()&quot; or &quot;__call()&quot; exist and have public access in class &quot;Craft\CraftVariable&quot; in &quot;_includes/header.html&quot; at line 102. (/mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php:660)&#xA;&#xA;#0 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(64): Twig_Template-&amp;gt;getAttribute(Object(Craft\CraftVariable), 'detect', Array, 'any', false, false)&#xA;#1 /mylocaldevpath/craft/storage/runtime/compiled_templates/f6/f671e04469d81f0dfda61111136d722fb954e341b7543ce8baa919e43343b4ae.php(244): Craft\BaseTemplate-&amp;gt;getAttribute(Object(Craft\CraftVariable), 'detect', Array)&#xA;#2 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_81873f0b87bd6a678f4bf938ed6516d87c5b9a4339fc9d6dfcf337b2f069a6f9-&amp;gt;doDisplay(Array, Array)&#xA;#3 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#4 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#5 /mylocaldevpath/craft/storage/runtime/compiled_templates/12/129e9e7cc1b6a86df018442a329dd1d6e1f7d9c31cb94b7b01ae6cfeff6f2ebd.php(198): Twig_Template-&amp;gt;display(Array)&#xA;#6 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_11ee36b35600746e068e6dd5ace4c2797e2ec35ca7d474eb36bb37f7250bd707-&amp;gt;doDisplay(Array, Array)&#xA;#7 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#8 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#9 /mylocaldevpath/craft/storage/runtime/compiled_templates/fe/fe5ea1b61c6d52fa030f7f1d75b2b4568bab6dfe912af74613b657eed595f6fe.php(43): Twig_Template-&amp;gt;display(Array, Array)&#xA;#10 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_455d61df868203e0a6669f803e3d1b9e9a10f94ed6abe1e14ec8e1bee9d1c1e1-&amp;gt;doDisplay(Array, Array)&#xA;#11 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#12 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#13 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template-&amp;gt;display(Array)&#xA;#14 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Environment.php(363): Twig_Template-&amp;gt;render(Array)&#xA;#15 /mylocaldevpath/craft/app/services/TemplatesService.php(256): Twig_Environment-&amp;gt;render('404', Array)&#xA;#16 /mylocaldevpath/craft/app/controllers/BaseController.php(74): Craft\TemplatesService-&amp;gt;render('404', Array)&#xA;#17 /mylocaldevpath/craft/app/controllers/TemplatesController.php(213): Craft\BaseController-&amp;gt;renderTemplate('404', Array)&#xA;#18 /mylocaldevpath/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController-&amp;gt;actionRenderError()&#xA;#19 /mylocaldevpath/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#20 /mylocaldevpath/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#21 /mylocaldevpath/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#22 /mylocaldevpath/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('renderError')&#xA;#23 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(368): CWebApplication-&amp;gt;runController('templates/rende...')&#xA;#24 /mylocaldevpath/craft/app/etc/errors/ErrorHandler.php(281): CErrorHandler-&amp;gt;renderError()&#xA;#25 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(351): Craft\ErrorHandler-&amp;gt;renderError()&#xA;#26 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(218): CErrorHandler-&amp;gt;renderException()&#xA;#27 /mylocaldevpath/craft/app/etc/errors/ErrorHandler.php(145): CErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#28 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(131): Craft\ErrorHandler-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#29 /mylocaldevpath/craft/app/framework/base/CApplication.php(750): CErrorHandler-&amp;gt;handle(Object(CExceptionEvent))&#xA;#30 [internal function]: CApplication-&amp;gt;handleException(Object(Craft\HttpException))&#xA;#31 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the plugin code from my template and rename the 'detect' plugin folder then I just get the 404s with no useful response. I have checked permissions for assets (macOS - MAMP Pro) and these seem fine. I can see the source images for the transforms but it always 404s the transform url.&#xA;This is a multilingual site in 9 languages and works 100% perfect apart from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="5275" LastEditDate="2018-02-26T19:25:26.227" LastActivityDate="2018-02-26T19:25:26.227" Title="Local dev issue with transform and detect plugin" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23992" PostTypeId="1" CreationDate="2018-02-26T15:42:58.253" Score="1" ViewCount="305" Body="&lt;p&gt;I'm wanting to have the order of my elements within a template dynamic so that the user whilst in a template of page can reorder the modules as they please. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See screenshot for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/26tAi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/26tAi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the entries of the home page where I am editing content, could I reorder the &quot;Hero Detail Body&quot; to appear above the &quot;Hero Detail Heading&quot;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thoughts were no as within the Sections site, the components display order are defined for the template / tab there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="7337" LastEditorUserId="5557" LastEditDate="2018-03-01T09:15:18.800" LastActivityDate="2018-03-01T09:15:18.800" Title="Craft CMS - Dynamic Order Field Layout In Sections" Tags="&lt;sections&gt;&lt;ordering&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23993" PostTypeId="2" ParentId="23992" CreationDate="2018-02-26T16:07:32.667" Score="2" Body="&lt;p&gt;Correct, there's no way out of the box to reorder fields on the fly in the Entry editor. If you're comfortable with Craft plugin development though I'm sure it's possible to extend Craft and add the ability to do what you want to do. It's also possible that someone has already developed a plugin that achieves this but I personally don't know of any off the top of my head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems in your case that if you want to be able to rearrange fields in the Entry editor, your best solution is to put those fields inside a Matrix field. When you have created several fields inside a Matrix field, those &quot;sub-fields&quot; are then arrangeable in whichever order you prefer in the Entry editor. If you've never used Matrix fields before, here's the documentation link so you can read up on it: &lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/matrix-fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another alternative would be to use the &lt;a href=&quot;https://github.com/benjamminf/craft-neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo&lt;/a&gt; field - if you decide to use Neo, you can just reference your currently existing fields and then add only the Neo field to the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps to answer your question. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-02-26T16:07:32.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23994" PostTypeId="2" ParentId="23992" CreationDate="2018-02-26T16:24:11.977" Score="1" Body="&lt;p&gt;I'm not sure if there is already a plugin for that but you can create one. It's not that hard because you can re-arrange the field layout in the &lt;code&gt;cp.entries.edit&lt;/code&gt; hook &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook(&#xA;    'cp.entries.edit',&#xA;    function(&amp;amp;$context) {&#xA;        $layout = craft()-&amp;gt;fields-&amp;gt;getLayoutById(id of your new field layout);&#xA;        $context['section']-&amp;gt;getEntryTypes()[0]-&amp;gt;fieldLayout = $layout;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can create a form to save a new field Layout based on the old one and stores those values in a custom database table. Based on the old field layout Id you'll return a new one for the correct user&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-26T16:24:11.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23995" PostTypeId="2" ParentId="23991" CreationDate="2018-02-26T16:44:07.950" Score="1" Body="&lt;p&gt;Such a klutz: My local basePath was incorrect.&#xA;Detect plugin was a red-herring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All solved&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-02-26T16:44:07.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23996" PostTypeId="2" ParentId="5313" CreationDate="2018-02-26T16:57:14.640" Score="1" Body="&lt;p&gt;Use macros in your &lt;strong&gt;variables.html&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro myMacro(param1, param2) %}&#xA;  {{param1}} / {{param2}}&#xA;{% endmacro %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Put this in your &lt;strong&gt;layout.html&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% import 'folder/to/variables' as helpers %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then in your partials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{helpers.myMacro(param1, param2)}}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8051" LastActivityDate="2018-02-26T16:57:14.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23997" PostTypeId="2" ParentId="23067" CreationDate="2018-02-26T17:25:38.387" Score="1" Body="&lt;p&gt;From the action you are currently posting to a controller &lt;a href=&quot;https://craftcms.com/docs/plugins/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example shows that in your case it would be looking for a plugin called &quot;Freeform&quot; with a controller named &quot;api&quot; and then within that controller there would need to be a &quot;form&quot; action.  If this isn't there then the page will return a 404 or error as it cannot find the route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be able to create the same thing without using jQuery with something like &lt;a href=&quot;https://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery&quot;&gt;this method&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8052" LastEditorUserId="5557" LastEditDate="2018-02-26T19:28:01.847" LastActivityDate="2018-02-26T19:28:01.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23998" PostTypeId="1" AcceptedAnswerId="24000" CreationDate="2018-02-26T19:36:15.293" Score="1" ViewCount="2601" Body="&lt;p&gt;I want to add a Comodo Trust Logo to a Craft CMS website page per the instructions below:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Install Code Snippets&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please insert the following two snippets of HTML&#xA;code into your webpage document. You will need to repeat the process&#xA;for each web page you wish to display the TrustLogo.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;//&amp;lt;![CDATA[&#xA;var tlJsHost = ((window.location.protocol == &amp;quot;https:&amp;quot;) ? &amp;quot;https://secure.comodo.com/&amp;quot; : &amp;quot;http://www.trustlogo.com/&amp;quot;);&#xA;document.write(unescape(&amp;quot;%3Cscript src='&amp;quot; + tlJsHost + &amp;quot;trustlogo/javascript/trustlogo.js' type='text/javascript'%3E%3C/script%3E&amp;quot;));&#xA;//]]&amp;gt;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How do I access the Craft CMS code in order to add the above JS?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="8055" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-02-26T23:45:50.783" Title="How do I add html code to a page" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23999" PostTypeId="2" ParentId="23998" CreationDate="2018-02-26T20:02:37.260" Score="2" Body="&lt;p&gt;Find the appropriate template in your &lt;code&gt;craft/templates&lt;/code&gt; folder, and add it there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it to appear on every page, you'll likely put it in a &lt;code&gt;_layout&lt;/code&gt; or shared footer template.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-02-26T20:02:37.260" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24000" PostTypeId="2" ParentId="23998" CreationDate="2018-02-26T20:02:41.323" Score="3" Body="&lt;p&gt;To edit the HTML code for your Craft site you're going to want to edit the appropriate template file in your Craft install. If you're running on Craft 2 your template files can be found in &lt;code&gt;.craft/templates/&lt;/code&gt;; if you're on Craft 3 your templates are found in &lt;code&gt;./templates/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to look in the Craft control panel and see which twig template the section containing the entry (or page) you're trying to edit references. You'll find that info if you try to edit the respective section in &lt;code&gt;Settings &amp;gt; Sections&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will mention as well, if you're looking to include some code that belongs in the HEAD of the html, you'll probably find that in a &quot;master&quot; twig template that contains the &lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/code&gt;. Once you find the twig template specified in the section settings in the Craft control panel, most of the time you'll see an &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/extends.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% extends %}&lt;/code&gt; tag&lt;/a&gt; which links back to that &quot;base&quot; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps! I'd recommend maybe reading through the Craft docs, starting with &lt;a href=&quot;https://craftcms.com/docs/templating-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Templating Overview&lt;/a&gt;. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-02-26T20:02:41.323" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24001" PostTypeId="1" CreationDate="2018-02-27T00:00:23.520" Score="1" ViewCount="333" Body="&lt;p&gt;I just cloned a production site to run in a local environment to test and make sure the site was compatible with PHP7 in preparation for a production server upgrade. For the most part, it seems to have migrated without any issue, except for when I try to check for updates, I get the error: &lt;code&gt;Craft is unable to determine if an update is available at this time.&lt;/code&gt; Similarly, the edition button at the bottom of the dashboard gives the error: &lt;code&gt;Craft is unable to fetch edition info at this time.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried deleting my license key and clearing caches to no avail, but then I checked logs and noticed this error had been showing up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018/02/26 23:50:58 [error] [application] Error in Craft\Et::phoneHome. Message: [curl] 35: Unknown SSL protocol error in connection to elliott.craftcms.com:443  [url] https://elliott.craftcms.com/actions/elliott/app/checkForUpdates&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can’t seem to find any other mention of this issue on StackExchange or elsewhere - any ideas? Thanks so much in advance.&lt;/p&gt;&#xA;" OwnerUserId="8057" LastEditorUserId="5275" LastEditDate="2018-03-01T15:27:58.477" LastActivityDate="2018-04-30T15:57:24.157" Title="Craft unable to determine if an update is available?" Tags="&lt;error-message&gt;&lt;error&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24002" PostTypeId="2" ParentId="19179" CreationDate="2018-02-27T01:14:15.920" Score="1" Body="&lt;p&gt;This is how I re-created &lt;a href=&quot;http://www.newsweek.com/business&quot; rel=&quot;nofollow noreferrer&quot;&gt;Businessweek category page&lt;/a&gt;. It's not perfect, but you can start from there:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% paginate craft.entries.section('news').relatedTo(category).limit(17) as pageInfo, paginatedEntries %}&#xA;{% set firstTwo = paginatedEntries|slice(0,2) %}&#xA;{% set secondThree = paginatedEntries|slice(3,3) %}&#xA;{% set lastFour = paginatedEntries|slice(6,10) %}&#xA;&#xA;&amp;lt;div class=&quot;row sub-section-1&quot;&amp;gt;&#xA;    {# Batch of 2 columns #}&#xA;    {% for entry in firstTwo %}&#xA;        &amp;lt;div class=&quot;col-lg-6&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;summary&quot;&amp;gt;{{ entry.summary }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row sub-section-2&quot;&amp;gt;&#xA;    {# Batch of 3 columns #}&#xA;    {% for entry in secondThree %}&#xA;        &amp;lt;div class=&quot;col-lg-6&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;summary&quot;&amp;gt;{{ entry.summary }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row sub-section-3&quot;&amp;gt;&#xA;    {# Rest of entries #}&#xA;    {% for entry in lastFour %}&#xA;        &amp;lt;article class=&quot;col-lg-12&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;summary&quot;&amp;gt;{{ entry.summary }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8059" LastEditorUserId="3951" LastEditDate="2018-03-02T15:41:44.017" LastActivityDate="2018-03-02T15:41:44.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24003" PostTypeId="1" AcceptedAnswerId="24006" CreationDate="2018-02-27T02:07:07.897" Score="1" ViewCount="640" Body="&lt;p&gt;I have a Category element, &lt;code&gt;locations&lt;/code&gt;, which I am trying to update programatically through a Craft 3 plugin that reads data from a CSV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;locations&lt;/code&gt; category has a Field Layout: &lt;code&gt;latitude&lt;/code&gt; (Number), &lt;code&gt;longitude&lt;/code&gt; (Number), &lt;code&gt;nearbyLocations&lt;/code&gt; (Categories).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am having trouble updating a locations' &lt;code&gt;nearbyLocations&lt;/code&gt; field&lt;/strong&gt;. &lt;em&gt;I am inserting an array of Categories&lt;/em&gt; into the &lt;code&gt;nearbyLocations&lt;/code&gt; field on the &lt;code&gt;setFieldValues()&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A TypeError gets thrown deep in the bowels of Craft:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft\helpers\StringHelper::toLowerCase() must be of the type string, &#xA;  array given, called in &#xA;  /home/vagrant/code/vendor/craftcms/cms/src/helpers/Db.php on line 448&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Below is my code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;$new_nearby_locations is an array of Category elements.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$new_nearby_locations = [];&#xA;foreach ($nearby_locations_slugs_from_csv as $nearby_location_slug) {&#xA;  $nearby_location = Category::find()&#xA;                    -&amp;gt;slug($nearby_location_slug)&#xA;                    -&amp;gt;one();&#xA;&#xA;  if (!is_null($nearby_location)) {&#xA;      array_push($new_$nearby_locations, $nearby_location);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update $category's field values.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$category = Category::find()-&amp;gt;slug($slug)-&amp;gt;one();&#xA;$category-&amp;gt;setFieldValues([&#xA;    'latitude' =&amp;gt; $new_latitude, // previously defined&#xA;    'longitude' =&amp;gt; $new_longitude, // previously defined        &#xA;    'nearbyLocations' =&amp;gt; $new_nearby_locations&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Save the changes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt; Craft::$app-&amp;gt;elements-&amp;gt;saveElement($category);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am suspicious that updating &lt;code&gt;nearbyLocations&lt;/code&gt; by inserting an array of Category elements is wrong. If so, what is the right format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I doing something else wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8041" LastEditorUserId="3951" LastEditDate="2018-03-02T15:41:59.297" LastActivityDate="2018-03-02T15:41:59.297" Title="Craft 3 - How do you programatically update a field type that is a Category?" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24006" PostTypeId="2" ParentId="24003" CreationDate="2018-02-27T05:50:30.690" Score="1" Body="&lt;p&gt;You should insert an array of ids - not an array of elements - in order to make it work. That's basically it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$new_$nearby_locations[] = $nearby_location-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(that's usually better than array push too)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But your error message sounds more like your slug is an Array or something like this. Do you change any other fields somewhere? &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-27T06:03:47.907" LastActivityDate="2018-02-27T06:03:47.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24007" PostTypeId="1" CreationDate="2018-02-27T10:31:05.360" Score="1" ViewCount="538" Body="&lt;p&gt;I have a site that currently uses a structure where we have a parent entry and children under it. On the parent page we have entries that have been created with matrix blocks. The structure is as follows below in the screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vvk3v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vvk3v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On each parent page we want the ability to filter by the child entries under it. So far we have got it working well with a little fiddling but the only issue is that its showing entries for other nested children not related to the parent entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for instance the result we want is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bedroom furniture(parent page)&#xA; - Beds&#xA; - Bedroom storage&#xA; - etc&#xA; - etc&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what we are seeing is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bedroom furniture(parent page)&#xA; - Bed&#xA; - Armchairs&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filters on the page should only be the child entries that belong under that parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is the code we have got in the algolia plugin when indexing the commerce product:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;            'indexName' =&amp;gt; 'allProducts',&#xA;            'elementType' =&amp;gt; 'Commerce_Product',&#xA;            'transformer' =&amp;gt; function(Commerce_ProductModel $product) {&#xA;&#xA;                $typesCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;                    'section' =&amp;gt; 'products',&#xA;                    'relatedTo' =&amp;gt; [&#xA;                        'targetElement' =&amp;gt; $product,&#xA;                        'field' =&amp;gt; 'productBlock.product',&#xA;                    ]&#xA;                ]);&#xA;&#xA;                $types = array_map(function($el) {&#xA;                  return [&#xA;                    'title' =&amp;gt; $el-&amp;gt;title,&#xA;                    'id' =&amp;gt; $el-&amp;gt;id,&#xA;                    'level' =&amp;gt; $el-&amp;gt;level,&#xA;                  ];&#xA;                }, $typesCriteria-&amp;gt;find());&#xA;                $typesByLevel = [];  &#xA;&#xA;                foreach ($types as $type) {&#xA;                  $typesByLevel['types.level' . $type['level']][] = $type;                   &#xA;                }                &#xA;&#xA;                $variantAmount = count($variants);&#xA;&#xA;                return array_merge([&#xA;                    'title' =&amp;gt; $title,&#xA;                    'id' =&amp;gt; $product-&amp;gt;id,&#xA;                    'frontImage' =&amp;gt; $fm,&#xA;                    'type' =&amp;gt; $product-&amp;gt;type-&amp;gt;name,&#xA;                    'types' =&amp;gt; $types,&#xA;                    'designer' =&amp;gt; $designer,&#xA;                    'brand' =&amp;gt; $brand,&#xA;                    'price' =&amp;gt; $totalPrice,&#xA;                    'productPrice' =&amp;gt; $product-&amp;gt;defaultVariant-&amp;gt;price,&#xA;                    'material' =&amp;gt; $product-&amp;gt;variantMaterials[0]-&amp;gt;title,&#xA;                    'url' =&amp;gt; $url,&#xA;                    'variants' =&amp;gt; $variantAmount,&#xA;                    'isInWishlist' =&amp;gt; craft()-&amp;gt;like-&amp;gt;isLike($product-&amp;gt;id),&#xA;                    'quickViewJson' =&amp;gt; $mergedProductData,&#xA;                ], $typesByLevel);&#xA;            }&#xA;        ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code indexes the product and creates the levels in Algolia and we have this result in algolia below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qjnuB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qjnuB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/YZwNL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YZwNL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gets the level but we need the level that is associated with the parent page only not from all other areas of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the parent page we then get the parent structure Id and do disjunctive faceting with js on that page the get the filters that belong to that page like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if( $('#product-search-config').length ){&#xA; // type gets the entry.id&#xA;        const type = $('#product-search-config').data('type');&#xA;&#xA;            searchProducts.addWidget({&#xA;              init: function(data) {&#xA;                console.log(data)&#xA;              },&#xA;              getConfiguration: function() {&#xA;                return {&#xA;                  disjunctiveFacets: ['types'],&#xA;                  disjunctiveFacetsRefinements: {&#xA;                    'types.level1.id': [type],&#xA;                  }&#xA;                };&#xA;              }&#xA;            });&#xA;&#xA;    };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This needs to only find the filter relating to that parent as you see in the menu above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this be done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5033" LastActivityDate="2018-02-27T10:31:05.360" Title="How can I filter with facets in algolia with nested structures?" Tags="&lt;entries&gt;&lt;structure&gt;&lt;php&gt;&lt;filtering&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="24008" PostTypeId="1" AcceptedAnswerId="24009" CreationDate="2018-02-27T14:11:20.477" Score="3" ViewCount="1581" Body="&lt;p&gt;In multi-site is it possible to access entries between sites in the templates.  Like a feed?   ie. entry &quot;a&quot; on site &quot;A&quot; shows up in an index on site &quot;B&quot;, and links back to the entry on site A, not a duplicate of the entry on site &quot;B&quot;?  &lt;/p&gt;&#xA;" OwnerUserId="519" LastEditorUserId="57" LastEditDate="2018-02-27T22:32:17.720" LastActivityDate="2019-01-18T11:01:36.913" Title="Craft 3 multisite - are entries accessible between sites?" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24009" PostTypeId="2" ParentId="24008" CreationDate="2018-02-27T14:33:45.677" Score="5" Body="&lt;p&gt;Yes it is. Just include the site id of the the site in your query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set siteId = 2&#xA;set entries = craft.entries.section('foo').site(siteId).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you want to get the current entry for another site&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set currentEntrySiteB = craft.entries.id(entry.id).site(2).one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to search for disabled entries (for example in CP templates) for other sites you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.id(entry.id).site(2).enabledForSite(false).one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-27T15:56:11.253" LastActivityDate="2018-02-27T15:56:11.253" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24010" PostTypeId="1" AcceptedAnswerId="24011" CreationDate="2018-02-27T14:43:16.893" Score="1" ViewCount="418" Body="&lt;p&gt;Is there a way to pick a folder from an asset field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is to render a dynamic gallery from an asset folder (which is on S3) instead of selecting all images inside a folder by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use case:&#xA;In an asset field, I select folder 'XYZ' and render a gallery from all images which are inside. If a user uploads a new image to the folder 'XYZ', the gallery will be updated automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem: &#xA;Currently, I can only handpick the images from a folder. If someone uploads a new image, he/she also has to pick the new image in the asset field. So it is not dynamic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7762" LastActivityDate="2018-02-27T17:00:10.880" Title="Asset Field: Select a folder instead of all images" Tags="&lt;assets&gt;&lt;image&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24011" PostTypeId="2" ParentId="24010" CreationDate="2018-02-27T15:51:20.007" Score="1" Body="&lt;p&gt;You can create a new field with these functions. Note: this is a very basic example, you would usually want to do this with a template but I don't have much time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class FolderAssetField extends Field {&#xA;    // Static Methods&#xA;    // =========================================================================&#xA;&#xA;    public $folderId;&#xA;&#xA;    /**&#xA;     * Returns the display name of this class.&#xA;     *&#xA;     * @return string The display name of this class.&#xA;     */&#xA;    public static function displayName(): string{&#xA;        return 'Folder';&#xA;    }&#xA;&#xA;    /**&#xA;     * @param $value&#xA;     * @param ElementInterface|null $element&#xA;     * @return string&#xA;     */&#xA;    public function getInputHtml($value, ElementInterface $element = null): string&#xA;    {&#xA;        $allFileModels = \craft\records\VolumeFolder::find()-&amp;gt;all();&#xA;        $string = 'select a folder&amp;lt;br&amp;gt;&amp;lt;select name=&quot;' . $this-&amp;gt;handle .  '&quot;&amp;gt;';&#xA;        /** @var VolumeFolder $folder */&#xA;        foreach ($allFileModels as $folder){&#xA;            $selected = ((int)$value === $folder-&amp;gt;id)? 'selected=&quot;selected' : '';&#xA;            $string .= '&amp;lt;option ' . $selected .  ' value=&quot;' . $folder-&amp;gt;id . '&quot;&amp;gt;' . $folder-&amp;gt;name .  '&amp;lt;/option&amp;gt;';&#xA;        }&#xA;        $string .= '&amp;lt;/select&amp;gt;';&#xA;&#xA;        return $string;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your field will then contain the &lt;code&gt;folderId&lt;/code&gt; of the selected folder. You can then  get all assets for this folder with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/** @var AssetQuery $assetQuery */&#xA;$assetQuery = \craft\elements\Asset::find();&#xA;$assets = $assetQuery-&amp;gt;folderId($value)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in Twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set assets = craft.assets.folderId(entry.fieldHanlde).all() %}&#xA;{% for file in assets %}&#xA;    {{ file.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use the &lt;code&gt;normalizeValue&lt;/code&gt; function to prepare this Query. The &lt;a href=&quot;https://github.com/craftcms/redactor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor&lt;/a&gt; plugin has some &lt;a href=&quot;https://github.com/craftcms/redactor/blob/v1/src/Field.php#L220&quot; rel=&quot;nofollow noreferrer&quot;&gt;good examples here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-27T17:00:10.880" LastActivityDate="2018-02-27T17:00:10.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24012" PostTypeId="2" ParentId="24001" CreationDate="2018-02-27T22:28:01.563" Score="1" Body="&lt;p&gt;There's a 99% chance you're running old version of MAMP that needs to be upgraded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The host that &lt;a href=&quot;https://elliott.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://elliott.craftcms.com&lt;/a&gt; lives on recently dropped support for TLS 1.0, which what your stack is trying to connect with.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-02-27T22:28:01.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24013" PostTypeId="1" CreationDate="2018-02-27T22:33:17.923" Score="1" ViewCount="34" Body="&lt;p&gt;I've come across an issue where typing the URL e.g www.sitename.com///about will still load the about template, but not fill the page with the content. Is this an issue for google finding the appropriate pages in google searches? And how can I get these pages to no longer exist or result in a redirect to the correct URL www.sitename.com/about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any assistance &lt;/p&gt;&#xA;" OwnerUserId="7611" LastActivityDate="2018-03-30T02:40:29.643" Title="Adding multiple slashes after the site URL breaks the current entry, but still loads the template" Tags="&lt;url&gt;&lt;redirect&gt;&lt;seo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24014" PostTypeId="2" ParentId="24013" CreationDate="2018-02-28T02:20:16.553" Score="1" Body="&lt;p&gt;Are you getting the About template or the layout template it extends?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a test with a local site I have running, I was able to trigger a 404 for any bad requests by putting &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%  redirect 404 %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;inside the &lt;code&gt;main&lt;/code&gt; block in the &lt;code&gt;_layout&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works in my case because that block is overridden on every request. If it's not, something has gone wrong and I need to exit out since the layout template should never render on its own.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-02-28T02:20:16.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24016" PostTypeId="1" AcceptedAnswerId="24017" CreationDate="2018-02-28T13:51:06.020" Score="1" ViewCount="34" Body="&lt;p&gt;In A&amp;amp;M Forms, I'd like to show a custom field on the Submissions page in the control panel to make it easier to quickly reference the submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;img src=&quot;https://i.stack.imgur.com/ZE3dz.png&quot; alt=&quot;![enter image description here&quot;&gt;]&lt;a href=&quot;https://i.stack.imgur.com/ZE3dz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7059" LastActivityDate="2018-02-28T14:23:20.500" Title="Show custom field on Submissions page in CP" Tags="&lt;plugin-amforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24017" PostTypeId="2" ParentId="24016" CreationDate="2018-02-28T14:23:20.500" Score="1" Body="&lt;p&gt;You can click on the wheel icon below &lt;code&gt;Volunteer&lt;/code&gt; and check if the field is available there, if not you can modify the &lt;code&gt;ElementType&lt;/code&gt; and change it's &lt;code&gt;defineAvailableTableAttributes&lt;/code&gt; function in order to add the field/fields you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how this plugin was build but I made several custom &lt;code&gt;ElementTypes&lt;/code&gt; in Craft 2 with or without a custom layout and it works every time the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/classreference/elementtypes/EntryElementType#defineAvailableTableAttributes-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the function for Craft entries. You can then set these values in the &lt;a href=&quot;https://craftcms.com/classreference/elementtypes/EntryElementType#getTableAttributeHtml-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getTableAttributeHtml&lt;/a&gt; function&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-02-28T14:23:20.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24019" PostTypeId="1" CreationDate="2018-01-10T16:40:00.447" Score="2" ViewCount="513" Body="&lt;p&gt;I've been using element-api for simple lazy-loading of things like blog posts, etc and now want to create a simple 'Postcode lookup' by utilising a custom filter (provided by the Simple Map plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple Map provides a custom field that uses the Google Maps API for address data and geolocation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: How would I call the custom Simple Map filter using the 'criteria' settings in element-api so that I can pass through a postcode (via a javascript call to the api/customer-search.json?postcode=M25ND) and return results based on the custom field filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;    &quot;php&quot;: &quot;&amp;gt;=7.0.0&quot;,&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.0-RC1&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &quot;roave/security-advisories&quot;: &quot;dev-master&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;1.0.0.1&quot;,&#xA;    &quot;craftcms/element-api&quot;: &quot;^2.5&quot;,&#xA;    &quot;ether/simplemap&quot;: &quot;^3.1&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;element-api&lt;/strong&gt;&#xA;&lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/element-api&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;simple map&lt;/strong&gt; &lt;a href=&quot;https://github.com/ethercreative/simplemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ethercreative/simplemap&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below will return entries that are within 100 miles of the location provided:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.map({&#xA;    location: 'M2 5ND',&#xA;    country: 'GB',&#xA;    radius: 100,&#xA;    unit: 'mi'&#xA;}).orderBy('distance').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.. and the simple look up in my element-api.php file currently returns all 'customer' entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;use craft\elements\Entry;&#xA;&#xA;// https://github.com/ethercreative/simplemap&#xA;// https://github.com/craftcms/element-api&#xA;&#xA;return [&#xA;    'defaults' =&amp;gt; [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'elementsPerPage' =&amp;gt; 9,&#xA;        'pageParam' =&amp;gt; 'pg',&#xA;        'resourceKey' =&amp;gt; 'entries',&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;            return [&#xA;                'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                'map' =&amp;gt; $entry-&amp;gt;map,&#xA;            ];&#xA;        },&#xA;    ],&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/customer-search.json' =&amp;gt; [&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'customers',&#xA;                'type' =&amp;gt; 'customer',&#xA;                // how to include map({}) filtering of results?&#xA;            ],&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm struggling to do is combine the two. As far as I can tell; element-api criteria only works with the parameters listed here: &lt;a href=&quot;https://craftcms.com/docs/templating/craft.entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/craft.entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any direction you can provide.&lt;/p&gt;&#xA;" OwnerUserId="7839" OwnerDisplayName="Andy Stones" LastActivityDate="2018-02-28T16:00:31.650" Title="Craft CMS combining element-api and Simple Map plugin" Tags="&lt;php&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24020" PostTypeId="2" ParentId="24019" CreationDate="2018-02-28T15:45:49.947" Score="2" Body="&lt;p&gt;It should work the same way because the &lt;code&gt;modifyElementsQuery&lt;/code&gt; should be fired no matter where the &lt;code&gt;ElementQuery&lt;/code&gt; object is build so you could insert the same array in your element-api endpoint as you insert in your &lt;code&gt;CraftVariables&lt;/code&gt; &lt;code&gt;entries&lt;/code&gt; function to  build the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/elements/db/EntryQuery.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntryQuery&lt;/a&gt; since they both use &lt;a href=&quot;https://github.com/yiisoft/yii2/blob/master/framework/BaseYii.php#L543&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yiis configure&lt;/a&gt; function to build the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/customer-search.json' =&amp;gt; [&#xA;        'criteria' =&amp;gt; [&#xA;            'map' =&amp;gt; [&#xA;                'location' =&amp;gt; 'M2 5ND',&#xA;                'country' =&amp;gt; 'GB',&#xA;                'radius' =&amp;gt;  100,&#xA;                'unit' =&amp;gt; 'mi'&#xA;            ],&#xA;            'orderBy' =&amp;gt; 'distance'&#xA;        ],&#xA;    ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should theoretically build the same object like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.map({&#xA;    location: 'M2 5ND',&#xA;    country: 'GB',&#xA;    radius: 100,&#xA;    unit: 'mi'&#xA;}).orderBy('distance') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-02-28T16:00:31.650" LastActivityDate="2018-02-28T16:00:31.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24021" PostTypeId="1" AcceptedAnswerId="24030" CreationDate="2018-02-28T15:56:06.083" Score="2" ViewCount="175" Body="&lt;p&gt;Is it possible to do the following in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to set up course information as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) have a &lt;strong&gt;courseType&lt;/strong&gt; which contains default values for that type of course - name (i.e. 3 hour skills, full day masterclass etc), price, capacity, trainers etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) have a &lt;strong&gt;course&lt;/strong&gt; which has a &lt;strong&gt;courseType&lt;/strong&gt; entry filed among other details such as details of the course, equipment used, etc. The &lt;strong&gt;course&lt;/strong&gt; will also have fields for price, trainers &amp;amp; capacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to have the &lt;strong&gt;course&lt;/strong&gt; price, trainers &amp;amp; capacity fields filled with the value of the &lt;strong&gt;courseType&lt;/strong&gt; selected when it is chosen in the CP new course page? These &lt;strong&gt;course&lt;/strong&gt; fields should then be able to be overridden if required on a course by course basis.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be very welcome - I'm new to craft and can find any examples like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8063" LastEditorUserId="5557" LastEditDate="2018-03-01T09:15:04.423" LastActivityDate="2018-03-01T09:15:04.423" Title="Using values from one entry as default values in another?" Tags="&lt;entries&gt;&lt;field&gt;&lt;entries-field&gt;&lt;default&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24022" PostTypeId="2" ParentId="22679" CreationDate="2018-02-28T16:09:00.007" Score="2" Body="&lt;p&gt;I've had the same problem. You can do it by creating a custom plugin that returns image transform info. Look here =&gt; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/22517/get-a-defined-image-transforms-width-and-height-in-front-end-template&quot;&gt;Get a defined image-transform&amp;#39;s width and height in front-end template&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2018-02-28T16:09:00.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24023" PostTypeId="1" AcceptedAnswerId="24027" CreationDate="2018-02-28T16:45:47.343" Score="1" ViewCount="434" Body="&lt;p&gt;I am performing a query from within a plugin like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = $journeyTitle;&#xA;$response = $criteria-&amp;gt;find();&#xA;$attributes = $response[0]-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;var_dump($attributes);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The dump gives me the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(7) {&#xA;  [&quot;id&quot;]=&amp;gt;&#xA;  string(1) &quot;3&quot;&#xA;  [&quot;elementId&quot;]=&amp;gt;&#xA;  string(1) &quot;3&quot;&#xA;  [&quot;locale&quot;]=&amp;gt;&#xA;  string(5) &quot;en_us&quot;&#xA;  [&quot;title&quot;]=&amp;gt;&#xA;  string(7) &quot;Armenia&quot;&#xA;  [&quot;lifeBeforeColumnOne&quot;]=&amp;gt;&#xA;  NULL&#xA;  [&quot;lifeBeforeColumnTwo&quot;]=&amp;gt;&#xA;  NULL&#xA;  [&quot;tester&quot;]=&amp;gt;&#xA;  string(12) &quot;fdsfsdfdsfsd&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone ever used Super Table Before, and know why this would be showing up null? I would REALLY like to use this on my project, but am not really sure on how to proceed with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here is a screenshot of the entry that you see outputted within the dump:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qeIY7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qeIY7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-02-28T21:34:15.603" Title="SuperTable Field returning null" Tags="&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24024" PostTypeId="1" AcceptedAnswerId="24031" CreationDate="2018-02-28T18:54:32.560" Score="1" ViewCount="255" Body="&lt;p&gt;Most websites have three distinct types of page.&#xA;List of items&#xA;Item&#xA;Special layout of items / content&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A list of entries require a list view. Craft lets us do this with singles - eg blog index page. But we can also just use a template and custom route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the pros and cons of each?&#xA;The pros of single index style pages is that I can then build a navigation structure that has an entry link to the single.  Beyond that are there any other reasons why one over the other? &lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-03-01T08:55:15.420" Title="Singles or routes solution" Tags="&lt;routes&gt;&lt;navigation&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24027" PostTypeId="2" ParentId="24023" CreationDate="2018-02-28T21:26:32.860" Score="2" Body="&lt;p&gt;The reason the attribute for your Super Table is null is because the field is an element, which doesn't have 'simple' content. You'll find this is the exact same case for any other element like an Entries field, or a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the reason for this is that this simply fetches the content from the actual &lt;code&gt;craft_content&lt;/code&gt; table. Being complex (relational) data, there's technically nothing in the content table. Getting the content is a little more complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Super Table (and other elements), when querying the field's content on an attached element, you'll get an ElementCriteriaModel (for Craft 2) returned, which allows you to do all sorts of things when outputting the content of a Super Table (limit, order, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_dump($response[0]-&amp;gt;lifeBeforeColumnOne);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will output the ElementCriteriaModel, which will be not overly useful for actual content output. In addition, you'll want to call &lt;code&gt;find()&lt;/code&gt; on the criteria (just like you're doing above in your code to fetch the entries) to return an array of &lt;code&gt;SuperTable_BlockModel&lt;/code&gt;'s.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$blocks = $response[0]-&amp;gt;lifeBeforeColumnOne-&amp;gt;find();&#xA;&#xA;foreach ($blocks as $block) {&#xA;    var_dump($block-&amp;gt;featuredImage);&#xA;    var_dump($block-&amp;gt;textContent);&#xA;    var_dump($block-&amp;gt;source);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then output the content by targeting the inner fields'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also find this slightly related conversation useful - &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4348/getting-all-content-including-matrix-fields-from-an-entrymodel/4552#4552&quot;&gt;Getting all content, including Matrix fields from an EntryModel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also an example of this sort of functionality on the docs - &lt;a href=&quot;https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples#fetching-content-from-a-super-table-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples#fetching-content-from-a-super-table-field&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastEditorUserId="632" LastEditDate="2018-02-28T21:34:15.603" LastActivityDate="2018-02-28T21:34:15.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24028" PostTypeId="2" ParentId="10159" CreationDate="2018-02-28T21:31:52.540" Score="1" Body="&lt;p&gt;There are a few templating examples via the documentation - &lt;a href=&quot;https://verbb.io/craft-plugins/super-table/docs/guides/templating-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/super-table/docs/guides/templating-examples&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as @carlcs states, I believe the issue is that you're checking &lt;code&gt;{% if block.type == &quot;innhold&quot; %}&lt;/code&gt; which will fail, as a SuperTableBlock doesn't have an attribute &lt;code&gt;type&lt;/code&gt; at all, unlike Matrix.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-02-28T21:31:52.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24030" PostTypeId="2" ParentId="24021" CreationDate="2018-03-01T07:50:35.220" Score="1" Body="&lt;p&gt;First of all I would like to leave a few links for you. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; is a page where you can create your &quot;starting&quot; files. It creates an empty Plugin, with all the required files/functions with example codes for routing and services....&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Docs&lt;/a&gt; about Craft Plugin developement&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then to the code: you'll need to insert a function like this in your &lt;a href=&quot;https://craftcms.com/docs/plugins/setting-things-up#your-primary-plugin-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin's primary class&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook('cp.entries.edit', function(&amp;amp;$context) {&#xA;    if ($context['sectionHandle'] === 'course') {&#xA;        // you can get these from a config file or you could create&#xA;        // plugin settings, I'll just insert an array here, it's faster&#xA;        $config = [&#xA;            'entryTypeOne'     =&amp;gt; [&#xA;                'title'         =&amp;gt; 'A title',&#xA;                'body'          =&amp;gt; 'some information',&#xA;                'relationField' =&amp;gt; [1, 2, 4] //&amp;lt;-- array of element ids&#xA;            ],&#xA;            'anotherEntryType' =&amp;gt; [&#xA;                'title'         =&amp;gt; 'Another title',&#xA;                'body'          =&amp;gt; 'some more information',&#xA;                'relationField' =&amp;gt; [] //&amp;lt;-- array of element ids&#xA;            ]&#xA;        ];&#xA;&#xA;        /** @var \Craft\EntryModel $entry */&#xA;        $entry = $context['entry'];&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes($config[$entry-&amp;gt;getType()-&amp;gt;handle]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However: unfortunately you can't set default values when the user changes the entry type with this method, thus we'll need another &quot;hack&quot;.&#xA;As you can see in the &lt;a href=&quot;https://github.com/benjamminf/craft-relabel/blob/master/relabel/resources/js/Relabel.js#L120&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relabel Plugin&lt;/a&gt; Craft provides ways to change default functions. You can insert this javascript&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.EntryTypeSwitcher.prototype.onTypeChange =  function(ev)&#xA;{&#xA;    this.$spinner.removeClass('hidden');&#xA;&#xA;    Craft.postActionRequest('entries/switchEntryType', Craft.cp.$container.serialize(), $.proxy(function(response, textStatus) {&#xA;        this.$spinner.addClass('hidden');&#xA;&#xA;        if (textStatus == 'success')&#xA;        {&#xA;            var fieldsPane = this.$fields.data('pane');&#xA;            fieldsPane.deselectTab();&#xA;            this.$fields.html(response.paneHtml);&#xA;            fieldsPane.destroy();&#xA;            this.$fields.pane();&#xA;            Craft.initUiElements(this.$fields);&#xA;&#xA;            Craft.appendHeadHtml(response.headHtml);&#xA;            Craft.appendFootHtml(response.footHtml);&#xA;&#xA;            // Update the slug generator with the new title input&#xA;            if (typeof slugGenerator != &quot;undefined&quot;)&#xA;            {&#xA;                slugGenerator.setNewSource('#title');&#xA;            }&#xA;        }&#xA;    }, this));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To change the default behavior when someone changes the entry type. All you have to do is to change the destination of the script &#xA;from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest('entries/switchEntryType'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest('yourpluginhandle/controllername/switchEntryType'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll take the default &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/controllers/EntriesController.php#L350&quot; rel=&quot;nofollow noreferrer&quot;&gt;EntriesController&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSwitchEntryType()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $entry = $this-&amp;gt;_getEntryModel();&#xA;    $this-&amp;gt;enforceEditEntryPermissions($entry);&#xA;    $this-&amp;gt;_populateEntryModel($entry);&#xA;&#xA;    $variables['sectionId'] = $entry-&amp;gt;sectionId;&#xA;    $variables['entry'] = $entry;&#xA;    $variables['showEntryTypes'] = true;&#xA;&#xA;    $this-&amp;gt;_prepEditEntryVariables($variables);&#xA;&#xA;    $paneHtml = craft()-&amp;gt;templates-&amp;gt;render('_includes/tabs', $variables) .&#xA;        craft()-&amp;gt;templates-&amp;gt;render('entries/_fields', $variables);&#xA;&#xA;    $this-&amp;gt;returnJson(array(&#xA;        'paneHtml' =&amp;gt; $paneHtml,&#xA;        'headHtml' =&amp;gt; craft()-&amp;gt;templates-&amp;gt;getHeadHtml(),&#xA;        'footHtml' =&amp;gt; craft()-&amp;gt;templates-&amp;gt;getFootHtml(),&#xA;    ));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And do exactly the same like in the first function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttributes($config[$entry-&amp;gt;getType()-&amp;gt;handle]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately if you want to take care of all use cases you have to overwrite another function. When someone is trying to create an entry via an &lt;code&gt;ElementEditor&lt;/code&gt;(the thing that pops up when you click on &quot;new entry&quot;) in a relation field. It works exactly the same like my first method and it's the same like &lt;a href=&quot;https://github.com/benjamminf/craft-relabel/blob/master/relabel/resources/js/Relabel.js#L120&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-01T08:37:18.017" LastActivityDate="2018-03-01T08:37:18.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24031" PostTypeId="2" ParentId="24024" CreationDate="2018-03-01T08:47:56.273" Score="2" Body="&lt;p&gt;I would like to offer another solution: We always  have a structured section &lt;code&gt;pages&lt;/code&gt; where our clients can insert all the pages they want to show. It's a structured section because the menu is generated by this structure and they have certain options in these entries if they should appear in the menu/footermenu and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different Entry Types in this section have different templates, sometimes when it's required we create special field types to choose different templates as well. When the client wants to insert an &quot;overview&quot; page to display &lt;code&gt;news&lt;/code&gt; he/she creates a new entry in our &lt;code&gt;pages&lt;/code&gt; section with the entry type &lt;code&gt;news&lt;/code&gt; that has a special template that fetches all latest entries in the &lt;code&gt;news&lt;/code&gt; section and renders them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way we don't need to create a special rule and we don't need to create a single page -&gt; thus we don't need to offer a special menu plugin. From the feedback we got from our clients they prefer this method because they have everything they need in this structured section and they don't need to create a separate menu or something like that. Dragging/moving these entries causes the menu to change and due to Craft it's very intuitive. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it's required, we restrict the number of times certain entry types can be used. For example we only need one &lt;code&gt;news&lt;/code&gt; overview or one &lt;code&gt;login&lt;/code&gt; page. It does not make sense to create 3-4 different login pages so as soon as our client selects this entry type it disappears from the list and he/she can only create another &lt;code&gt;login&lt;/code&gt; page after the first was deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested: this is our default template for entries in the &lt;code&gt;pages&lt;/code&gt; section&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends [&#xA;    'pages/_custom/' ~ entry.slug ~ '.twig',&#xA;    'pages/_entrytypes/' ~ entry.type ~ '.twig',&#xA;    'pages/_generic.twig'&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft/Twig takes the first template that is found. &lt;code&gt;_generic&lt;/code&gt; is the default content template&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-01T08:55:15.420" LastActivityDate="2018-03-01T08:55:15.420" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24032" PostTypeId="1" CreationDate="2018-03-01T08:57:15.417" Score="0" ViewCount="37" Body="&lt;p&gt;I have a site that serves German content. Now we have an admin that wants to have the backend in English. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've added English in the locales. This works fine for standard Craft things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in Craft Commerce all of the products are now in two languages. Is there a way to turn off the language for Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked into product types, but you can't just turn off a language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is, that this admin is also the CEO of that shop.&lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="57" LastEditDate="2018-03-01T20:18:25.287" LastActivityDate="2018-03-01T20:18:25.287" Title="Is there a way to turn off a language in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;language&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24033" PostTypeId="1" CreationDate="2018-03-01T09:58:47.057" Score="1" ViewCount="43" Body="&lt;p&gt;I couldn't find this anywhere so I thought I would post the answer. How do you limit the output of a navigation element to a specific entry type. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is explicitly for the navigation element - I only want to show a specific entry type in a navigation element.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="6614" LastEditDate="2018-03-01T14:29:16.847" LastActivityDate="2018-03-01T14:29:16.847" Title="How to limit navigation by entry type" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24034" PostTypeId="2" ParentId="24033" CreationDate="2018-03-01T09:58:47.057" Score="1" Body="&lt;p&gt;Both of these work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sectionNamePages = craft.entries.section('sectionName').type('entryTypeA').level(1) %}&#xA;{% for page in sectionNamePages %}&#xA;    &amp;lt;li class=&quot;{{ page.id == entry.id ? 'active' }}&quot;&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&#xA;{% set sectionNamePages = craft.entries.section('sectionName').level(1) %}&#xA;{% for page in sectionNamePages.type('entryTypeA') %}&#xA;    &amp;lt;li class=&quot;{{ page.id == entry.id ? 'active' }}&quot;&amp;gt;{{ page.getLink() }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2018-03-01T09:58:47.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24035" PostTypeId="2" ParentId="19601" CreationDate="2018-03-01T14:22:59.283" Score="1" Body="&lt;p&gt;I just set up a Norwegian (default) / English multi-site myself, without touching a single config file or adding files/directories (apart from the actual translation-file containing strings in different languages) to the project.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the backend, I added the sites Norwegian with path &lt;code&gt;@web&lt;/code&gt; (and saying that it is the main site) and English with path &lt;code&gt;@web/en&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then I configured my sections and fields to my liking, i.e. determining which ones should support localization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And that was it - I see Norwegian content when accessing &lt;a href=&quot;http://site.test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.test&lt;/a&gt; and English content when accessing &lt;a href=&quot;http://site.test/en&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.test/en&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4465" LastActivityDate="2018-03-01T14:22:59.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24036" PostTypeId="1" AcceptedAnswerId="24037" CreationDate="2018-03-01T15:40:17.703" Score="1" ViewCount="217" Body="&lt;p&gt;We're using the &lt;a href=&quot;https://github.com/pixelandtonic/DigitalProducts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Products&lt;/a&gt; plugin from Pixel and Tonic to sell 6 different types of products. I've set up a macro with matching icons for each of the product types (image, video, etc). On our user account page, I want to show recent purchases with the icon of the product type underneath it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, I would write &lt;code&gt;{{ icons.image }}&lt;/code&gt; or &lt;code&gt;{{ icons.video}}&lt;/code&gt; to call the icon macro. But the variable needs to be dynamic if I want to display it under a dynamic list of products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to make it dynamic, of course, I need to be able to inject different macro variables &lt;code&gt;image&lt;/code&gt;, &lt;code&gt;video&lt;/code&gt;, &lt;code&gt;etc&lt;/code&gt; when they're called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the &lt;code&gt;{{ attribute() }}&lt;/code&gt; function, which looks like the preferred way of accessing dynamic attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ attribute(icons, license.product.type) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Illegal offset type in isset or empty&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I researched a bit and found that I could try &lt;code&gt;{{ attribute(icons, license.product.type[0]) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that led to this error: &lt;code&gt;Property &quot;Craft\DigitalProducts_ProductTypeModel.0&quot; is not defined.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, basically now I'm stuck. My lack of PHP knowledge may be holding me back here.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2018-03-01T15:58:00.583" Title="Dynamic Macro Variable" Tags="&lt;macro&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24037" PostTypeId="2" ParentId="24036" CreationDate="2018-03-01T15:58:00.583" Score="3" Body="&lt;p&gt;The better approach would be to pass the icon as a parameter to your macro. So I would do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro renderIcon(type) %}&#xA;    {% switch type %}&#xA;        {% case 'video' %}&#xA;            {% include 'video.twig' %}&#xA;        {% case 'audio' %}&#xA;            {% include 'audio.twig' %}&#xA;        {% default %}&#xA;            {% include '_generic.twig.twig' %}&#xA;    {% endswitch %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your template you can do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'macro.twig' as icon %}&#xA;{{ icon.renderIcon(product.getType().handle) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-01T15:58:00.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24040" PostTypeId="1" CreationDate="2018-03-01T23:39:52.993" Score="2" ViewCount="302" Body="&lt;p&gt;Here's some code from Craft Commerce's examples:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; accept-charset=&quot;UTF-8&quot; class=&quot;ui form validate&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot; /&amp;gt;&#xA;&#xA;    [...]&#xA;&#xA;    {% set countries = craft.commerce.countries %}&#xA;    {% if countries|length &amp;gt; 1 %}&#xA;        &amp;lt;div class=&quot;field{% if model and model.getErrors('countryId') %} error{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;label&amp;gt;{{ &quot;Country&quot;|t }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;select name=&quot;{{ modelName }}[countryId]&quot; class=&quot;ui fluid dropdown&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot;&amp;gt;{{ &quot;Choose Country&quot;|t }}&amp;lt;/option&amp;gt;&#xA;                {% for country in countries %}&#xA;                    {% set optionValue = (model ? model.countryId : '') %}&#xA;                    &amp;lt;option value=&quot;{{ country.id }}&quot;{% if country.id == optionValue %} selected=&quot;selected&quot;{% endif %}&amp;gt;{{ country.name }}&amp;lt;/option&amp;gt;&#xA;                    &amp;lt;div class=&quot;item&quot; data-value=&quot;&quot;&amp;gt;{{ country.name }}&amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/select&amp;gt;&#xA;            {% if model and model.getErrors('countryId') %}&#xA;                &amp;lt;span class=&quot;error&quot;&amp;gt;{{ model.getErrors('countryId')|join }}&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    [...]&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wonder if it's somehow possible to work with the country code (e.g. US, CH...) instead of the country id of Craft Commerce (1..256). So basically, countryId vs. countryIso? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find any information in the docs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be a small detail, but when using form autofill with programs like 1password, it won't be able to fill in the country automatically when using an id vs. a country code. &lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="367" LastEditDate="2018-03-03T09:14:07.997" LastActivityDate="2018-03-03T09:14:07.997" Title="Commerce: Is there a way to use a countries dropdown with iso codes (US, CH etc) instead of ids?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24041" PostTypeId="1" CreationDate="2018-03-02T02:49:23.093" Score="1" ViewCount="330" Body="&lt;p&gt;I'm struggling to think of a way to create a family tree hierarchy in Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using categories and structures, but run into the problem of needing child nodes to have two parent nodes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sijdH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sijdH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, what's the best way of achieving this?&lt;/p&gt;&#xA;" OwnerUserId="567" LastEditorUserId="567" LastEditDate="2018-03-02T09:00:28.993" LastActivityDate="2018-03-02T14:34:41.970" Title="How can I create a family tree hierarchy in Craft?" Tags="&lt;structure&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24042" PostTypeId="2" ParentId="24041" CreationDate="2018-03-02T09:15:01.450" Score="3" Body="&lt;p&gt;I can't think of an easy and clean way to visualize this kind of structure in a default list. So if you want to be able to display the structure from your diagram dynamically you'll have much work to calculate the positions correctly in a clear way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would suggest you to use easy Craft methods. You could create an entries field to relate your children with all the upper level parents, in your case you would have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parent 1 - no relation&#xA;Parent 2 - no relation&#xA;    Child - related to [Parent 1, Parent 2]&#xA;        Grand Child - related To [ Child ]&#xA;    Sub Parent 1 - related to [Parent 1, Parent 2]&#xA;    Sub Parent 2 - related to [Parent 1, Parent 2]&#xA;         Grand Child 1 - related To [Sub Parent 1, Sub Parent 2]&#xA;         Grand Child 2 - related To [Sub Parent 1, Sub Parent 2]&#xA;         Grand Child 3 - related To [Sub Parent 1, Sub Parent 2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can get each parent of an entry with &lt;code&gt;entry.fieldHandle.find()&lt;/code&gt;&#xA;and you can iterate through the tree. But this will only work well when don't mix trees.. So when you have a Parent 3 and 4 with another tree like in the diagram and one of those entries can be the parent of one of the grand children in the first tree you could have trouble (performance wise) to iterate to the beginning. You can collect &lt;code&gt;all&lt;/code&gt; parents with no problem but if you have 5+ levels you'll need many queries and it could take a lot of time in Craft2 with default &lt;code&gt;ElementCriteriaModels&lt;/code&gt;. But that's always the case in those NxN tree connections&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see any issues as long as your trees are separated from each other and as long as you use custom code to fetch the entries.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-02T14:34:41.970" LastActivityDate="2018-03-02T14:34:41.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24043" PostTypeId="2" ParentId="24041" CreationDate="2018-03-02T11:12:35.913" Score="1" Body="&lt;p&gt;Create a regular channel where the entries have a relationship to the parent and not the child.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that each child can have any number of parents and each parent can be related to as many children as needed.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-03-02T11:12:35.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24044" PostTypeId="1" AcceptedAnswerId="24047" CreationDate="2018-03-02T12:54:32.790" Score="2" ViewCount="607" Body="&lt;p&gt;So I've got a &lt;code&gt;{% nav %}&lt;/code&gt; I'm trying to create with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in craft.entries.section('pages') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My issue is that I've got a top-level page that has been disabled but has some enabled child/sub pages (second-level). So the code above doesn't display the disabled top-level page but it &lt;strong&gt;is&lt;/strong&gt; showing all the enabled children of that disabled page. I've tried wrapping different parts of the &lt;code&gt;{% nav %}&lt;/code&gt; code with a conditional but that seems to interfere with the &lt;code&gt;{% ifchildren %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, is this the default Craft functionality? If so, what's the best way to solve this problem? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-03-02T13:47:57.380" LastActivityDate="2018-03-05T11:44:15.607" Title="How do I hide children of a disabled parent in a nav?" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;children&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24045" PostTypeId="2" ParentId="24044" CreationDate="2018-03-02T13:36:51.870" Score="1" Body="&lt;p&gt;Try wrapping the &lt;code&gt;{% ifchildren %}&lt;/code&gt; block with this &lt;code&gt;{% if page.enabled %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav page in craft.entries.section('pages') %}&#xA;&amp;lt;li&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% if page.enabled %}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PS: I also fixed two typos in your original code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you could filter out the entries that you want, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('products').level(1) %}&#xA;{{ entries | length | inspect }}&#xA;{% set enabledPages = [] %}&#xA;{% for entry in entries %}&#xA;  {% if entry.enabled %}&#xA;    {% set enabledPages = enabledPages | merge([entry]) %}&#xA;    {% if entry.hasDescendants %}&#xA;      {% set enabledPages = enabledPages | merge(entry.children) %}&#xA;    {% endif %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# !! and then the stuff from above without the if page.enabled test #}&#xA;&#xA;{% nav page in craft.entries.section('pages') %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ page.url }}&quot;&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;{% children %}&amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7847" LastEditorUserId="7847" LastEditDate="2018-03-05T11:44:15.607" LastActivityDate="2018-03-05T11:44:15.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24046" PostTypeId="2" ParentId="24040" CreationDate="2018-03-02T14:44:36.580" Score="1" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countries = craft.commerce.countries %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for country in countries %}&#xA;    &amp;lt;li&amp;gt;{{ country.iso }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-02T14:44:36.580" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24047" PostTypeId="2" ParentId="24044" CreationDate="2018-03-02T14:58:11.007" Score="3" Body="&lt;p&gt;This is an example of our &quot;quick and dirty&quot; menu macro we used in older projects. It's recursive so it can have as many levels as you want and will only fetch enabled entries. For mobile devices the parent entry is rendered in the &quot;child&quot; menu as well because otherwise you won't be able to access parent entries with children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks a bit overwhelming at first, because we had many things to consider but it's relative easy &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!--&#xA;menuCategory: [mainmenu/footermenu/topmenu/descendants]&#xA;currentPage: the current entry of the loop&#xA;includeStartPage: bool if the start page should be included to the menu&#xA;level: current level, integer&#xA;parent: parent entry if there is one&#xA;original: the original current entry from craft&#xA;showParentPage: if the parent page should appear in current menu level for mobile devices&#xA;--&amp;gt;&#xA;{% macro menu(menuCategory, currentPage, includeStartpage, level = 1, parent = null, original = null, showParentPage = null) %}&#xA;    {% set originalPage = (original)? original : currentPage %}&#xA;    {% set activeClass = '' %}&#xA;    {% if original is not null and currentPage is not null and original.parent is not null %}&#xA;        {% if original.parent.id == currentPage.id %}&#xA;            {% set activeClass = &quot;active&quot; %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;ul class=&quot;{{ activeClass }} {% if parent == null %}clearfix{% endif %}&quot; data-level=&quot;{{ level }}&quot;&amp;gt;&#xA;        {% if includeStartpage %}&#xA;            {% set startseite = craft.entries.section('homepage').first() %}&#xA;            &amp;lt;li {% if currentPage.id == startseite.id %}class=&quot;active&quot; {% endif %}&amp;gt;&#xA;                &amp;lt;a  href=&quot;{{ startseite.url }}&quot; title=&quot;{{ startseite.title }}&quot;&amp;gt;{{ startseite.title|raw }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        {% if showParentPage and parent%}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a  href=&quot;{{ parent.url }}&quot; title=&quot;{{ parent.title }}&quot;&amp;gt;{{ parent.title|raw }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;!-- you can leave that actually these are just the function to fetch the different entries&#xA;        for the different menu types&#xA;        if you have only one type just do set entries = craft.entries.section('pages').find()&#xA;        --&amp;gt;&#xA;        {% switch menuCategory %}&#xA;            {% case 'mainmenu' %}&#xA;                {% set entries = craft.entries.section('pages') %}&#xA;            {% case 'topmenu' %}&#xA;                {% set entries = craft.entries.section('pages').showInHeaderMenu('1') %}&#xA;            {% case 'footermenu' %}&#xA;                {% set entries = craft.entries.section('pages').showInFooterMenu('not 0') %}&#xA;            {% case 'descendants' %}&#xA;                {% set entries = parent.getChildren() %}&#xA;        {% endswitch %}&#xA;&#xA;        {% for page in entries %}&#xA;            &amp;lt;!-- macro to get the different urls for different entries...&#xA;            we have sometimes links to external pages so you could use page.getUrl() as well --&amp;gt;&#xA;            {% set url = _self.getUrl(page) %}&#xA;            {% set target = _self.getTarget(page) %}&#xA;            {% set title = page.title %}&#xA;            {% set class = &quot;&quot; %}&#xA;&#xA;            {% switch page.type.handle %}&#xA;                {% case 'internalLink' %}&#xA;                    {% set title = page.linkName %}&#xA;                {% case 'externalLink' %}&#xA;                    {% set title = page.linkName %}&#xA;                {% default %}&#xA;            {% endswitch %}&#xA;&#xA;            {% if (originalPage.getUrl == url|trim and not page.hasDescendants)  %}&#xA;                {% set class = &quot;active&quot; %}&#xA;            {% endif %}&#xA;&#xA;&#xA;            {# Check if entry has descendants #}&#xA;            {% if not page.hasDescendants or (menuCategory == &quot;footermenu&quot; or menuCategory == &quot;topmenu&quot;) %}&#xA;                {# List navigation item if entry has NO child entries #}&#xA;                &amp;lt;li class=&quot;{{ class }}&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ url|trim }}&quot; title=&quot;{{ title }}&quot; {{ target }}&amp;gt;{{ title|raw }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;&#xA;            {% elseif menuCategory == &quot;mainmenu&quot; or menuCategory == &quot;descendants&quot; %}&#xA;                {# List navigation item if entry does have children #}&#xA;                &amp;lt;li&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; class=&quot;{{ class }}&quot; title=&quot;{{ title }}&quot;&amp;gt;{{ title|raw }}&amp;lt;/a&amp;gt;&#xA;                    {% set includeParent = (page.type.handle != 'pageWithoutContent')? true : false %}&#xA;                    {{ _self.menu('descendants', page, false, level+1, page, originalPage, includeParent ) }}&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use it with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import '_macros/menu.twig' as menu %}&#xA;&amp;lt;nav id=&quot;mainmenu&quot; class=&quot;inline&quot;&amp;gt;&#xA;    {{ menu.menu('mainmenu', entry, true) }}&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can remove all the &lt;code&gt;entry.getType().handle&lt;/code&gt; checks. We have the entry types &lt;code&gt;pageWithoutContent&lt;/code&gt; so they will only appear in the menu as &quot;placeholders&quot; to open sub menus, but if the entry type is a page with content the entry must appear in the sub menu as well to make it clickable for mobile devices. These pages need to have an &lt;code&gt;active&lt;/code&gt; when they appear as &quot;parents&quot; but not as &quot;children&quot;. You can see a working example of this menu &lt;a href=&quot;http://www.baunach-allianz.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;https://www.cdu-landtag.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-02T16:34:09.030" LastActivityDate="2018-03-02T16:34:09.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24048" PostTypeId="1" AcceptedAnswerId="25615" CreationDate="2018-03-02T16:02:57.127" Score="1" ViewCount="233" Body="&lt;p&gt;I am using &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; to create my image transforms. I am on a category page and I want to list all of the products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a quick &lt;code&gt;.with(['cf_shop_assets'])&lt;/code&gt; optimization and wanted to continue with the image transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frankly, I don't know where to start? &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set products = craft.commerce.products.relatedTo(category).with(['cf_shop_assets']) %}&#xA;{% if products|length %}&#xA;    &amp;lt;div class=&quot;shop_container block listing_format&quot;&amp;gt;&#xA;        {% for product in products %}&#xA;&#xA;        {% set variants = product.variants %}&#xA;        {% set variant = product.defaultVariant %}&#xA;&#xA;        &amp;lt;div class=&quot;shop_item&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;more_info&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ product.url }}&quot;&amp;gt;&#xA;                    {% set image = product.cf_shop_assets[0] ?? null %}&#xA;                    {% if image|length %}&#xA;                        {% set transformedImage = craft.imager.transformImage(image, {&#xA;                            width: 300,&#xA;                            quality: 90,&#xA;                            format: 'jpg',&#xA;                            bgColor: '#EFEFDE',&#xA;                            effects: { sharpen: true }&#xA;                        }) %}&#xA;                        &amp;lt;figure&amp;gt;&#xA;                            &amp;lt;img src=&quot;{{ transformedImage.url }}&quot; class=&quot;image_full_width&quot; width=&quot;{{ transformedImage.width }}&quot; height=&quot;{{ transformedImage.height }}&quot; alt=&quot;{{ image.title }} {{ gl_meta.cf_altText }}&quot; /&amp;gt;&#xA;                        &amp;lt;/figure&amp;gt;&#xA;                    {% endif %}&#xA;                    &amp;lt;h2&amp;gt;{{ product.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            […]&#xA;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code works, but it only saves about 5 queries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would somebody be so kind to show me how to eager load Imager transforms? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need Imager because I don't want to use transparent PNGs. There's no native way to transform a PNG to JPG and adding a background color. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible? &lt;/p&gt;&#xA;" OwnerUserId="367" LastEditorUserId="3951" LastEditDate="2018-03-05T18:02:30.270" LastActivityDate="2018-04-11T18:16:35.957" Title="Eager load Imager transforms in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;eager-loading&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24050" PostTypeId="2" ParentId="20643" CreationDate="2018-03-02T18:29:59.733" Score="1" Body="&lt;p&gt;Check out this plugin, it allows you to add text (instructions) as a field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/thomasthesecond/EntryInstructions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thomasthesecond/EntryInstructions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2018-03-02T18:29:59.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24051" PostTypeId="2" ParentId="23933" CreationDate="2018-03-02T19:04:19.103" Score="2" Body="&lt;p&gt;There's actually a Craft CMS 2 plugin that I've used before (with PDFs) that will create a zip from assets: &lt;a href=&quot;https://github.com/boboldehampsink/zipassets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/zipassets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not 100% sure it would work for your use case, but it should.&lt;/p&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2018-03-02T19:04:19.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24053" PostTypeId="1" CreationDate="2018-03-02T19:50:00.283" Score="1" ViewCount="176" Body="&lt;p&gt;The full message is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;SQLSTATE[42S22]: Column not found: 1054 Unknown column&#xA;'fields.translationMethod' in 'field list' &#xA;The SQL being executed was:     &#xA;SELECT fields.id, fields.dateCreated, fields.dateUpdated, fields.groupId,&#xA;fields.name, fields.handle, fields.context, fields.instructions,  &#xA;fields.translationMethod, fields.translationKeyFormat, fields.type, fields.settings &#xA;FROM craft_fields fields WHERE fields.context='global'&#xA;ORDER BY fields.name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In looking at the database I only see the &lt;code&gt;translatable&lt;/code&gt; column. How can I go about fixing this?&lt;/p&gt;&#xA;" OwnerUserId="8070" LastActivityDate="2018-03-02T19:50:00.283" Title="In upgrading from Craft 2 to Craft 3 I'm getting a SQL error saying the translationMethod column is missing" Tags="&lt;database&gt;&lt;craft3&gt;&lt;updating&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2018-03-05T22:36:45.577" ContentLicense="CC BY-SA 3.0" />
  <row Id="24054" PostTypeId="1" CreationDate="2018-03-02T20:06:22.953" Score="1" ViewCount="535" Body="&lt;p&gt;I'm deploying my Craft 3 application to an ec2 instance using elastic beanstalk. When I navigate to &quot;/admin/install&quot;, I get the following error:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fRCpw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fRCpw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I ssh into my ec2 instance to check the 404 logs, the stack trace I get is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2018-03-02 11:47:03&#xA;  [192.195.80.235][-][-][error][yii\web\HttpException:404]&#xA;  yii\web\NotFoundHttpException: Template not found: robots.txt in&#xA;  /var/app/current/vendor/craftcms/cms/src/controllers/TemplatesController.php:69&#xA;  Stack trace: 0 [internal function]:&#xA;  craft\controllers\TemplatesController-&gt;actionRender('robots.txt',&#xA;  Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1 /var/app/current/vendor/yiisoft/yii2/base/InlineAction.php(57):&#xA;  call_user_func_array(Array, Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2 /var/app/current/vendor/yiisoft/yii2/base/Controller.php(157):&#xA;  yii\base\InlineAction-&gt;runWithParams(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3 /var/app/current/vendor/craftcms/cms/src/web/Controller.php(74):&#xA;  yii\base\Controller-&gt;runAction('render', Array) 4&#xA;  /var/app/current/vendor/yiisoft/yii2/base/Module.php(528):&#xA;  craft\web\Controller-&gt;runAction('render', Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;5 /var/app/current/vendor/craftcms/cms/src/web/Application.php(237):&#xA;  yii\base\Module-&gt;runAction('templates/rende...', Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;6 /var/app/current/vendor/yiisoft/yii2/web/Application.php(103):&#xA;  craft\web\Application-&gt;runAction('templates/rende...', Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;7 /var/app/current/vendor/craftcms/cms/src/web/Application.php(226):&#xA;  yii\web\Application-&gt;handleRequest(Object(craft\web\Request))&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;8 /var/app/current/vendor/yiisoft/yii2/base/Application.php(386):&#xA;  craft\web\Application-&gt;handleRequest(Object(craft\web\Request))&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;9 /var/app/current/web/index.php(21): yii\base\Application-&gt;run()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;10 {main}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2018-03-02 11:47:03 [192.195.80.235][-][-][info][application] $_GET =&#xA;  [&#xA;      'p' =&gt; 'robots.txt' ]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is this happening and how can I fix it?&lt;/p&gt;&#xA;" OwnerUserId="8041" LastActivityDate="2018-03-02T20:32:25.207" Title="Can't install Craft 3 when deploying to AWS EC2 instance - Template not found: install Template not found: install" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24055" PostTypeId="2" ParentId="24054" CreationDate="2018-03-02T20:32:25.207" Score="1" Body="&lt;p&gt;I suggest you to read the documentation about how to install &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/installation.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft&lt;/a&gt; there is no such install process anymore. You just need to follow these steps, install it via composer, run the setup &lt;code&gt;./craft setup&lt;/code&gt; and you are done. So there is no &lt;code&gt;admin/install&lt;/code&gt; anymore like in Craft 2&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-02T20:32:25.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24056" PostTypeId="1" AcceptedAnswerId="24138" CreationDate="2018-03-03T12:39:20.927" Score="1" ViewCount="151" Body="&lt;p&gt;Standard 10 dollars off discount setup.  Although it says it is applied, it doesn't give me any kind of a discount.  None of the discounts work, I've made multiple and tried different options but it still doesn't work.  Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2WI6M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2WI6M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZkTNl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZkTNl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GPgSf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GPgSf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RFEsw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RFEsw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/srY8u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/srY8u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5621" LastEditorUserId="5621" LastEditDate="2018-03-05T17:15:54.530" LastActivityDate="2018-03-11T05:28:25.547" Title="Discount Code applies to cart successfully but doesn't do anything. Am I missing something?" Tags="&lt;plugin-craftcommerce&gt;&lt;debugging&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24057" PostTypeId="2" ParentId="7202" CreationDate="2018-03-03T19:19:54.773" Score="1" Body="&lt;p&gt;I had the same issue. In our case it were the i18n and the vendor files that were being excluded by a too restrictive gitignore file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Never use the default gitignore from Craft 3 on a Craft 2 setup. :-)&lt;/p&gt;&#xA;" OwnerUserId="4747" LastActivityDate="2018-03-03T19:19:54.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24058" PostTypeId="1" CreationDate="2018-03-03T20:36:49.620" Score="1" ViewCount="83" Body="&lt;p&gt;I've used expression engine but not Craft. I am looking for a CMS more flexible than WordPress. I need to have admins enter location or addresses of meetings and then allow site users search for locations close to them or close to a specific address. Part of the use case is that meeting locations would be posted if the meeting is open or just a contact if the meeting is closed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would Craft be a good CMS for this? What about the geo stuff?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="5557" LastEditDate="2018-03-04T18:00:12.833" LastActivityDate="2018-03-04T18:00:12.833" Title="Craft and lat/long search" Tags="&lt;geo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24059" PostTypeId="2" ParentId="24058" CreationDate="2018-03-03T23:22:13.530" Score="2" Body="&lt;p&gt;Yes, Craft would be a great solution for that!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the proximity search feature, check out the &lt;a href=&quot;https://www.doublesecretagency.com/plugins/smart-map&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; plugin. (Disclaimer: I'm the author.) It allows you to input addresses for each location, then your users can conduct a search to find the closest locations.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-03T23:22:13.530" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24060" PostTypeId="1" AcceptedAnswerId="24065" CreationDate="2018-03-04T06:02:10.980" Score="3" ViewCount="395" Body="&lt;p&gt;I know it's possible, using &lt;code&gt;modifyEntrySortableAttributes&lt;/code&gt;, to sort the CP entries table by a custom field, when that field is a number, string, date/time, or bool. Would it be possible to sort a CP table by category? If not, is there another hook, or some other way I could implement this functionality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;Sorting by number, string, date/time, bool:&lt;br&gt;&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13472/in-craft-2-5-how-can-you-sort-the-entry-index-page-by-a-custom-field&quot;&gt;In Craft 2.5, how can you sort the entry index page by a custom field?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7406" LastEditorUserId="7406" LastEditDate="2018-03-04T16:10:03.357" LastActivityDate="2018-03-04T17:52:01.457" Title="Sort CP Entries by Category" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;categories&gt;&lt;plugins&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24061" PostTypeId="1" CreationDate="2018-03-04T11:01:43.867" Score="5" ViewCount="1872" Body="&lt;p&gt;We currently have a Drupal site. What are the advantages and disadvantages of moving to Craft and Craft Commerce.&#xA;Why would someone choose Craft Commerce over Drupal Commerce.&lt;/p&gt;&#xA;" OwnerUserId="8072" LastActivityDate="2020-09-26T13:22:26.977" Title="Craft Vs Drupal?" Tags="&lt;ecommerce&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24062" PostTypeId="2" ParentId="24061" CreationDate="2018-03-04T15:32:45.267" Score="10" Body="&lt;p&gt;If you are a php developer Craft will be the more interesting option because it uses the great Yii framework that provides many good tools. A few years ago we decided to drop our custom CMS development and we chose another one to create our sites. It took us all in all about 6 months to compare about 15 different systems. We compared Craft vs Drupal as well and it was an easy choice.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The development is super fast. If you don't have some kind of &amp;quot;default&amp;quot; website (design that everyone else uses with no functionality) you are really flexible. Due to &lt;a href=&quot;https://twig.symfony.com/&quot; rel=&quot;noreferrer&quot;&gt;Twig&lt;/a&gt; and Pixel and Tonics implementation, as well as the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt;, you can create dynamic pages in no time. &lt;strong&gt;Edit&lt;/strong&gt;: I know since Drupal 8 it uses Twig as well, but the Query builder is not that good in my opinion. It's easier to fetch/search entries in Craft than in Drupal&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs/matrix-fields&quot; rel=&quot;noreferrer&quot;&gt;Matrix fields&lt;/a&gt; - if you don't go the wordpress way and provide only one huge html editor this is the most incredible feature for customers. We evaluated the experience from customers point of view and no other system was so logical and easy to understand for our customers as Craft. We don't need to provide any classes/workshops/tutorials or support anymore because it's so intuitive. Our company doesn't need as much customer support as with Drupal =&amp;gt; we save time and costs.&lt;/li&gt;&#xA;&lt;li&gt;Yii / &lt;a href=&quot;https://github.com/yiisoft/yii2&quot; rel=&quot;noreferrer&quot;&gt;Yii2&lt;/a&gt;. If you are a real php developer and not only a designer and if the framework matters Yii is an advantage as well because it's easier to understand and faster (at least Yii2) we made many benchmarks and Yii2/Craft has a better performance than Drupal. It provides better options to extend the system with Plugins so you'll save a lot of time as well. All in all you'll be able to create more sites with Craft than with Drupal (of course only if you are a developer. Designers who only download plugins will be slower since Craft was made for developers.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/pixelandtonic/garnishjs&quot; rel=&quot;noreferrer&quot;&gt;Garnish.js&lt;/a&gt; / Craft.js - once you get used to it Garnish.js is an awesome javascript library from Pixel and Tonic that provides many features to customize Craft and your entire CMS. You are able to overwrite/extend nearly every single javascript function. So if you would like to change something for your customer you'll be able to do that. Drupal doesn't allow it in that way. You are free to change every single Ajax request. If you want to overwrite the code that is returned when you change certain options, just do &lt;code&gt;Craft.PackageName.prototype.FunctionName = function(){...}&lt;/code&gt; and you can gain full control of all behaviors without breaking updates.&lt;/li&gt;&#xA;&lt;li&gt;Craft Commerce is really flexible as well. You can customize the system and the templates however you like. If you would like to change the behavior you can create a custom controller and extend the things you require. Everything is build OOP thus you can create your own models and save them. There are really no restrictions.&lt;/li&gt;&#xA;&lt;li&gt;It's build with MVC pattern and OOP... I don't think there is much more to explain. Drupal isn't - I don't really like it. It's a mess in terms of speed. You have to remember all the functions, it's not intuitive. If you don't know how to do certain things in Craft or if you don't know certain functions you can always do &lt;code&gt;Craft::$app-&amp;gt;&lt;/code&gt; and it shows you all the possibilities you have. Drupal doesn't work as good. If you don't know how to do certain things you can be 100% sure you can always look into their source code. It's so intuitive you know where to look things up. Their code is clean and easy to understand with many commentaries and PHPDocs.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now some disadvantages&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you are no developer you could have a hard time because there are way less plugins. So people who just want to download all the things they need without a plan what they actually do (I know many companies in my region that use EE, WP and Drupal because of that) won't be happy with Craft.&lt;/li&gt;&#xA;&lt;li&gt;There are no themes. For me this is actually an advantage because I don't like all those pages that look exactly like all others but some people might see it as a disadvantage. So there is no &amp;quot;ready to download, one click and I can sell it&amp;quot; button for Craft.&lt;/li&gt;&#xA;&lt;li&gt;The community is a little bit &amp;quot;smaller&amp;quot; you can receive help here at stack exchange really fast and most questions are answered. That's not the problem but here as well: if you need a developer there are less people for Craft than for Drupal. If you have any troubles or issues with Craft commerce - depending on the question and the situation - it could take a little bit longer for you to receive help. The developers at Pixel and Tonic do a great job and they are looking at stackexchange every day but when there is too much work it could eventually take a few days until someone responses.&lt;/li&gt;&#xA;&lt;li&gt;The documentation: Crafts/Craft Commerce online documentation is not so good. Most things are not explained online. Many features are not even on their website. I would say most of their documentation is in their code. It's up to you to decide whether this is good or bad. I think it's good the way it is, because every function has a detailed description how to use it and what it does. As soon as you have a good IDE it's absolutely awesome to use Craft because they explained everything very good, autocomplete and phpdocs work like a charm. But then again: if you are no developer and want to have an online documentation for non developers it could be troublesome without stack exchange.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit: TL/DR&lt;/strong&gt;&lt;br&gt;&#xA;As a developer Craft will be your choice otherwise Drupal might be easier.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-04T17:01:07.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24063" PostTypeId="1" CreationDate="2018-03-04T16:58:10.047" Score="1" ViewCount="257" Body="&lt;p&gt;Using cpanel, apache. All requirements are met for Craft. On a typical default set up I believe that the public_html is user:nobody. What should the &lt;code&gt;../craft&lt;/code&gt; folder owner and group be? With what permissions? What about sub folders?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I  getting 403 forbidden with &lt;code&gt;0744&lt;/code&gt; and &lt;code&gt;0774&lt;/code&gt; permissions.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="57" LastEditDate="2018-03-05T06:39:27.750" LastActivityDate="2018-03-05T06:39:27.750" Title="What is the typical owner:group for Craft files and folders?" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24064" PostTypeId="2" ParentId="24063" CreationDate="2018-03-04T17:38:29.180" Score="1" Body="&lt;p&gt;It really depends on your hosting environment, but the article &lt;a href=&quot;https://nystudio107.com/blog/hardening-craft-cms-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hardening Craft CMS Permissions&lt;/a&gt; might be useful to you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-04T17:38:29.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24065" PostTypeId="2" ParentId="24060" CreationDate="2018-03-04T17:42:57.890" Score="2" Body="&lt;p&gt;This is probably not the answer you are looking for but it works. You can change the &lt;code&gt;Craft.BaseElementIndex&lt;/code&gt;and the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/resources/js/craft.js#L2081&quot; rel=&quot;nofollow noreferrer&quot;&gt;updateElements&lt;/a&gt; function. All you have to do is to change the destination path to a custom controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.BaseElementIndex.prototype.updateElements = function()&#xA;{&#xA;    // Ignore if we're not fully initialized yet&#xA;    if (!this.initialized)&#xA;    {&#xA;        return;&#xA;    }&#xA;&#xA;    this.setIndexBusy();&#xA;&#xA;    var params = this.getViewParams();&#xA;&#xA;    Craft.postActionRequest('yourPluginHandle/controllerName/getElements', params, $.proxy(function(response, textStatus)&#xA;    {&#xA;        this.setIndexAvailable();&#xA;&#xA;        if (textStatus == 'success')&#xA;        {&#xA;            this._updateView(params, response);&#xA;        }&#xA;        else&#xA;        {&#xA;            Craft.cp.displayError(Craft.t('An unknown error occurred.'));&#xA;        }&#xA;&#xA;    }, this));&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can create a custom controller that extends the &lt;code&gt;ElementIndexController&lt;/code&gt; and can use it's &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/controllers/ElementIndexController.php#L102&quot; rel=&quot;nofollow noreferrer&quot;&gt;function&lt;/a&gt; that calls the private function &lt;code&gt;_getElementResponseData&lt;/code&gt;. All the elements that should be displayed are received in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$responseData['html'] = $this-&amp;gt;_elementType-&amp;gt;getIndexHtml(&#xA;    $this-&amp;gt;_criteria,&#xA;    $disabledElementIds,&#xA;    $this-&amp;gt;_viewState, &amp;lt;-- this is the important variable&#xA;    $this-&amp;gt;_sourceKey,&#xA;    $this-&amp;gt;_context,&#xA;    $includeContainer,&#xA;    $showCheckboxes&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sort order is defined &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/elementtypes/BaseElementType.php#L203&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($sortableAttributes)&#xA;{&#xA;    $order = (!empty($viewState['order']) &amp;amp;&amp;amp; isset($sortableAttributes[$viewState['order']])) ? $viewState['order'] : ArrayHelper::getFirstKey($sortableAttributes);&#xA;    $sort  = (!empty($viewState['sort']) &amp;amp;&amp;amp; in_array($viewState['sort'], array('asc', 'desc'))) ? $viewState['sort'] : 'asc';&#xA;&#xA;    $criteria-&amp;gt;order = preg_replace('/^(.*?)(?:\s+(?:asc|desc))?(,.*)?$/i', &quot;$1 {$sort}$2&quot;, $order);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can easily see it checks if the &lt;code&gt;$viewState['order']&lt;/code&gt; is empty or not. This variable is defined in your controller so all you have to do is to check if your javascript returns a &lt;code&gt;order&lt;/code&gt; variable, get the field by handle and check if the field handle is &lt;code&gt;instance of BaseRelationField&lt;/code&gt;. If so, you'll unset the variable in the &lt;code&gt;$viewState&lt;/code&gt; and change the &lt;code&gt;$criteria&lt;/code&gt; by yourself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the query is executed in &lt;code&gt;BaseElementType.php&lt;/code&gt; so you have to implement a way to sort by eager loading elements (which I doubt is possible by default) or you can create a custom &lt;code&gt;element type&lt;/code&gt; just for this case and overwrite the entire &lt;code&gt;getIndexHtml()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might sound like a lot of work and effort but honestly it can be done in 5-10 minutes... I've done the same once within no time. It's 99% copy paste. Maybe someone  has a better answer but since there is no real event or hook I'm not sure if there is a real clean way to do this. Of course this is only for Craft 2. In Craft 3 it's much easier since there are more events and hooks and you can replace classes more easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to overwrite the entire &lt;code&gt;BaseElementIndex&lt;/code&gt; class with &lt;a href=&quot;http://www.yiiframework.com/forum/index.php/topic/28979-how-to-override-yii-core-classes/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii&lt;/a&gt; or &lt;a href=&quot;https://stackoverflow.com/questions/11254106/yii-how-to-override-extend-core-file&quot;&gt;this&lt;/a&gt;. But I never did that so I can't give much advice&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-04T17:52:01.457" LastActivityDate="2018-03-04T17:52:01.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24066" PostTypeId="1" CreationDate="2018-03-05T00:30:24.797" Score="0" ViewCount="39" Body="&lt;p&gt;Is there a way to switch entry type dynamically depending on the selection of a field value on a entry page? For instance, could I have a structure for motorized transportation and then have a dropdown that has the values car and motorcycle. If &quot;car&quot; is selected then an entry page would be presented that gets number of doors, if &quot;motorcycle&quot; is select then an entry page is selected that gets engine cc's?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-05T00:30:24.797" Title="Switch entry type depending on entry field" Tags="&lt;entry-form&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24067" PostTypeId="1" CreationDate="2018-03-05T02:01:03.750" Score="2" ViewCount="2714" Body="&lt;p&gt;I need to arbitrarily query entries based on the values of various fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have an entry type called &quot;Widgets&quot; I can grab them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$widgets = Entry::find()-&amp;gt;section('widget')-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now what if widgets have a field called &quot;widgetColor&quot; and I want to select all with a value of &quot;blue&quot; in that field?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I query for those entries?&lt;/li&gt;&#xA;&lt;li&gt;Also, how can I query for any entry with no value in that field?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've tried my best to figure it out using the documentation and it seems like method such as &lt;code&gt;where&lt;/code&gt; only apply to certain data, such as the title and slug, which are not custom fields on the entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8074" LastActivityDate="2018-03-05T07:49:31.440" Title="How do you query entries by field values?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24068" PostTypeId="1" CreationDate="2018-03-05T02:08:14.130" Score="1" ViewCount="88" Body="&lt;p&gt;I enabled the three API's at Google:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Google Maps JavaScript API&lt;/p&gt;&#xA;&lt;p&gt;Google Maps Geocoding API&lt;/p&gt;&#xA;&lt;p&gt;Google Static Maps API&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I get a static map OK. All I get with the dynamic map is a &amp;quot;Loading Map...&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('groups').limit(5).find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{ entry.url }}&amp;quot;&amp;gt;{{ entry.title }} , {{ entry.address }}, {{ craft.smartMap.map(entry.address) }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-05T22:20:43.123" Title="Smart Map - Static map displays fine, dynamic map does not" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24069" PostTypeId="1" CreationDate="2018-03-05T02:23:27.783" Score="1" ViewCount="320" Body="&lt;p&gt;I would like to migrate content from external source to my Section model. So I have to create Entries manually. Is there any better way to do this beside this snippet from the documentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new Entry();&#xA;$entry-&amp;gt;sectionId = 10;&#xA;$entry-&amp;gt;typeId = 1;&#xA;$entry-&amp;gt;fieldLayoutId = $entry-&amp;gt;getType()-&amp;gt;fieldLayoutId;&#xA;$entry-&amp;gt;authorId = 5;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;title = &quot;Hello World!&quot;;&#xA;$entry-&amp;gt;setFieldValues([&#xA;    'body' =&amp;gt; &quot;&amp;lt;p&amp;gt;I can’t believe I literally just called this “Hello World!”.&amp;lt;/p&amp;gt;&quot;,&#xA;]);&#xA;$success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;if (!$success) {&#xA;    Craft::error('Couldn’t save the entry &quot;'.$entry-&amp;gt;title.'&quot;', __METHOD__);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;reference: &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-elements.html#saveElement()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-services-elements.html#saveElement()-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a factory method, or a Builder to properly create the object. Using EntityController is not an option, because I would like to use it from CommandLine interface.&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="7986" LastEditDate="2018-03-05T06:34:32.423" LastActivityDate="2018-03-06T07:13:23.907" Title="How to create manually an Entry from command line" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24070" PostTypeId="1" CreationDate="2018-03-05T04:01:31.380" Score="1" ViewCount="88" Body="&lt;p&gt;I have addresses in my structure using the smart map address zip field. The Smart Map plugin looks up the Lat/Long just fine and checking independently the values seem to be correct. If I enter anything less than a full address (street, city, state, zip) even though the lat/long is there the map does not display properly, I either get a map of the world or a blue box.&lt;/p&gt;&#xA;&lt;p&gt;I am a noobie so I am sure it is something I have not done correctly.&lt;/p&gt;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Zip: 90210&lt;/p&gt;&#xA;&lt;p&gt;Lat: 34.10300320&lt;/p&gt;&#xA;&lt;p&gt;Long: -118.41046840&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in craft.entries.section('groups').limit(5).find() %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{ entry.url }}&amp;quot;&amp;gt;{{ entry.title }} , {{ entry.address }}, {{ craft.smartMap.img(entry.address) }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I click drag:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Sw6TI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sw6TI.jpg&quot; alt=&quot;Living large in Beverly Hills...&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When the map renders:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GBsf6.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GBsf6.jpg&quot; alt=&quot;Lost in the big wide world...&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-05T04:01:31.380" Title="Smart Map - displaying pin in center of zip code" Tags="&lt;plugin-smartmap&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24071" PostTypeId="2" ParentId="24067" CreationDate="2018-03-05T06:21:54.193" Score="5" Body="&lt;p&gt;You can do the same like with the section, if the query param exists in the field layout &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$widgets = Entry::find()-&amp;gt;widgetColor('blue')-&amp;gt;text(':notempty:')-&amp;gt;anotherField(':empty:')-&amp;gt;section('widget')-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will search for entries where &lt;code&gt;widgetColor&lt;/code&gt; is blue, &lt;code&gt;text&lt;/code&gt; is not empty/null and &lt;code&gt;anotherField&lt;/code&gt; is empty/null &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: just for people who like to understand the behavior&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to explain you the &lt;code&gt;where&lt;/code&gt; parameter in the &lt;code&gt;ElementQuery&lt;/code&gt;. The &lt;code&gt;where&lt;/code&gt; function uses the Yii2 Query function directly and works directly at the database layer. When you take a look at your &lt;code&gt;content&lt;/code&gt; table you'll see all custom fields have a certain prefix (if you didn't change it) so your &lt;code&gt;widgetColor&lt;/code&gt; column will look like &lt;code&gt;field_widgetColor&lt;/code&gt; when you do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;where-&amp;gt;(['widgetColor' =&amp;gt; 'blue');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it will query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;where `content`.`widgetColor` = `blue`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which will throw an error since the column name is &lt;code&gt;field_widgetColor&lt;/code&gt;. The &lt;code&gt;__set&lt;/code&gt; function in the &lt;code&gt;Yii/component&lt;/code&gt;/ &lt;code&gt;QueryBuilder&lt;/code&gt; class will set magic property that exists because of the field handle in your field layout... Or to keep it simple: you can access any &quot;magic&quot; property with the same name like an existing field handle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;widgetColor($property)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will call the &lt;code&gt;__set&lt;/code&gt; function that calls a wrapper that will wrap/attach the field content prefix (&lt;code&gt;field_&lt;/code&gt;) to the &lt;code&gt;where&lt;/code&gt; function. Thus you can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;where-&amp;gt;(['field_widgetColor' =&amp;gt; 'blue');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;where-&amp;gt;([Craft::$app-&amp;gt;getFields()-&amp;gt;oldFieldColumnPrefix . 'widgetColor' =&amp;gt; 'blue');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-05T07:49:31.440" LastActivityDate="2018-03-05T07:49:31.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24072" PostTypeId="1" CreationDate="2018-03-05T08:08:24.293" Score="1" ViewCount="71" Body="&lt;p&gt;I need to create variants for my entries ( the entry type is &lt;code&gt;Product&lt;/code&gt; but I'm not on Craft Commerce ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variants have a number of features. Those features may change between products ( ex. variants of a product have the feature 'pressure' while others doesn't ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two ideas, each with pro and cons, I would like to know if anyone else ever solved a similar situation in a smarter way.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use a Matrix of Super tables, where each block represents a variant and each &quot;column&quot; of a block can be active or not.&lt;/li&gt;&#xA;&lt;li&gt;Create an entry type for variants, then associate those variants to product via an entry field type.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6817" LastEditorUserId="57" LastEditDate="2018-03-06T00:29:30.713" LastActivityDate="2018-03-06T00:29:30.713" Title="Creating variants" Tags="&lt;field&gt;&lt;variants&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24073" PostTypeId="1" AcceptedAnswerId="24074" CreationDate="2018-03-05T14:50:46.097" Score="1" ViewCount="758" Body="&lt;p&gt;I'm unable to transfer a site over to my development server because I keep getting problems with disk space. Space is actually fine, it's the number of inodes being used up. Using cPanel I get an error when using file manager to view the sessions folder, so I think that's the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following command, which I think is the one for counting the number of files in a directory:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ls | wc -l&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It looks like there are over 300,000 files in there. How safe is it to delete the entire directory?&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-03-05T14:54:16.187" Title="Is it safe to remove the craft/storage/runtime/sessions folder?" Tags="&lt;session&gt;&lt;storage&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24074" PostTypeId="2" ParentId="24073" CreationDate="2018-03-05T14:54:16.187" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/folder-structure#craft-storage&quot; rel=&quot;nofollow noreferrer&quot;&gt;Docs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;runtime/ – Pretty much everything in here is there for caching and logging purposes. Nothing that Craft couldn’t live without, if the folder happened to get deleted.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It is safe to delete it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-05T14:54:16.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24076" PostTypeId="1" AcceptedAnswerId="24077" CreationDate="2018-03-05T19:23:31.400" Score="2" ViewCount="236" Body="&lt;p&gt;I'm using a single template to display entries from several structures. Each structure has a cooresponding global field that is an entries field. I use this to display related entries as a sidebar. These fields are named sidebars.[structure handle]Sidebar, so fore example my blog sidebar global field would be sidebar.blogSidebar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coding the sidebar manually works fine, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in sidebars.blogSidebar %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm trying to dynamically set the related entries field, and it isn't working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sidebar = &quot;sidebars.&quot; ~ entry.section.handle ~&quot;Sidebar&quot; %}&#xA;{% for block in sidebar %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code doesn't output anything. If i just output {{ sidebar }}, it shows what I expect, ex: sidebars.blogSidebar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I manually add it to the for loop {% for block in sidebars.blogSidebar %}, it works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a different way to concatenate the name to make this work?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="323" LastEditDate="2018-03-05T23:24:42.663" LastActivityDate="2018-03-05T23:24:42.663" Title="Specify a field dynamically using section handle" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24077" PostTypeId="2" ParentId="24076" CreationDate="2018-03-05T19:28:42.967" Score="1" Body="&lt;p&gt;I don't think your approach makes sense but you can use twigs &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Attribute&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in attribute(sidebar, entry.section.handle ~&quot;Sidebar&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-05T19:28:42.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24078" PostTypeId="1" AcceptedAnswerId="24080" CreationDate="2018-03-05T21:53:31.857" Score="2" ViewCount="20" Body="&lt;p&gt;I have a _layout which includes a contact button:&#xA;&lt;code&gt;{% include '_contact-button' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This creates a small contact button in the bottom right of every page that when clicked expands into a contact form. I would like this to be on every page of the site except the Contact page as it has it's own contact form. Is there a way in the contact template to not include _contact-button while still using _layout? Something like &lt;code&gt;{% dontInclude '_contact-button' %}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2018-03-05T22:30:18.480" Title="How to slightly alter _layout for one specific page?" Tags="&lt;templating&gt;&lt;include&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24079" PostTypeId="2" ParentId="24068" CreationDate="2018-03-05T22:19:07.817" Score="1" Body="&lt;p&gt;It's possible that some other JavaScript (unrelated to Smart Map) is throwing an error, and Smart Map never gets a chance to load the map. Loading a dynamic map is intentionally done late in the process, so that it doesn't interfere with other scripts you may have running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The static map is simply loaded as a remote image, so no JavaScript is required.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-05T22:19:07.817" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24080" PostTypeId="2" ParentId="24078" CreationDate="2018-03-05T22:30:18.480" Score="2" Body="&lt;p&gt;Try putting it inside of a simple block as the default value...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block contactButton %}&#xA;    {% include '_contact-button' %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on your one-off page, override that block with emptiness...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block contactButton '' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Untested, but that should do the trick!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-05T22:30:18.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24081" PostTypeId="1" AcceptedAnswerId="24082" CreationDate="2018-03-05T23:47:28.123" Score="8" ViewCount="5046" Body="&lt;p&gt;How is logging handled in Craft 3? There's nothing mentioned in &lt;a href=&quot;https://github.com/craftcms/docs&quot; rel=&quot;noreferrer&quot;&gt;the docs&lt;/a&gt; at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of the below exist.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft::log() &lt;/li&gt;&#xA;&lt;li&gt;MyPlugin::log()&lt;/li&gt;&#xA;&lt;li&gt;MyPlugin::$plugin-&gt;log()&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing any logging in any of the other plugins I've got on this site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Halp!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2019-07-01T13:09:56.050" Title="Plugin logging in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24082" PostTypeId="2" ParentId="24081" CreationDate="2018-03-05T23:54:28.140" Score="12" Body="&lt;p&gt;You can use &lt;code&gt;Craft::getLogger()-&amp;gt;log($message, $level, $category = 'application')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It uses the &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-log-logger.html&quot; rel=&quot;noreferrer&quot;&gt;Yii2 logger&lt;/a&gt;, you can change the &lt;code&gt;$category&lt;/code&gt; to your plugin handle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: You can use the &quot;short&quot; syntax as well &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft.html&quot; rel=&quot;noreferrer&quot;&gt;class reference&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::warning($message, $category);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::info($message, $category);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-06T00:00:58.050" LastActivityDate="2018-03-06T00:00:58.050" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24084" PostTypeId="2" ParentId="24069" CreationDate="2018-03-06T07:13:23.907" Score="1" Body="&lt;p&gt;This is the best answer so far. Basically the easiest way is to use array, and map everything there. The saveElement function will the the rest. You can update fields, tags, categories, matrixTables etc. The given example is matrix-data only, but again the same logic could be used everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/21864/how-to-save-matrix-data-programmatically-in-craft-3/21865#21865&quot;&gt;How to save Matrix data programmatically in Craft 3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only missing point is the &quot;merge&quot; functionality but I guess it has to be done manually after using the toArray() function first&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2018-03-06T07:13:23.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24085" PostTypeId="1" AcceptedAnswerId="24086" CreationDate="2018-03-06T10:48:11.453" Score="1" ViewCount="111" Body="&lt;p&gt;I am working on a custom plugin which gets some entry data using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;order('postDate asc');&#xA;$criteria-&amp;gt;dateUpdated = array('and', '&amp;gt;=' . $this-&amp;gt;dateFrom-&amp;gt;format(DateTime::MYSQL_DATETIME), '&amp;lt;=' . $this-&amp;gt;dateTo-&amp;gt;format(DateTime::MYSQL_DATETIME));&#xA;$criteria-&amp;gt;limit('null');&#xA;&#xA;$responses = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The returned entries contain a relationship to entries in another channel. In this case, the relationship field is named 'video'. So when looping through &lt;code&gt;$responses&lt;/code&gt; I can see that &lt;code&gt;$response-&amp;gt;video&lt;/code&gt; is an array containing the sourceElement id and field id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to get the complete entry data for the related entry returned in the same query rather than needing to perform an additional query?&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="5557" LastEditDate="2018-03-06T11:02:02.153" LastActivityDate="2018-03-06T11:05:39.783" Title="How to get related entry data using ElementCriteriaModel in a plugin" Tags="&lt;elementcriteriamodel&gt;&lt;eager-loading&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24086" PostTypeId="2" ParentId="24085" CreationDate="2018-03-06T10:52:08.670" Score="2" Body="&lt;p&gt;This is called &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eager Loading&lt;/a&gt; you have to do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;order('postDate asc');&#xA;$criteria-&amp;gt;dateUpdated = array('and', '&amp;gt;=' . $this-&amp;gt;dateFrom-&amp;gt;format(DateTime::MYSQL_DATETIME), '&amp;lt;=' . $this-&amp;gt;dateTo-&amp;gt;format(DateTime::MYSQL_DATETIME));&#xA;$criteria-&amp;gt;limit('null');&#xA;&#xA;// ========== start change ===============&#xA;$criteria-&amp;gt;with = ['video'];&#xA;// ========== end change  ================&#xA;&#xA;$responses = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: One of the most important things when working with Craft.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I can see that $response-&gt;video is an array containing the sourceElement id and field id.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, no and no. Many people believe this, or many other things, but that is not true. Your &lt;code&gt;$response-&amp;gt;video&lt;/code&gt; will contain an object of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt;. &lt;code&gt;$respose-&amp;gt;video&lt;/code&gt; is exactly the same type of object like &lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus you can do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$videos = $response-&amp;gt;video-&amp;gt;order('')-&amp;gt;limit(2)-&amp;gt;find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-06T11:05:39.783" LastActivityDate="2018-03-06T11:05:39.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24087" PostTypeId="1" CreationDate="2018-03-06T11:06:43.290" Score="1" ViewCount="160" Body="&lt;p&gt;Been rolling around with this for the last 36hrs trying to decide most useful option. The dilemma is how to preserve a structure and use categories - or not. Below is my structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Food (section structure)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;fruit (branch parent)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;apples (entry)&lt;/li&gt;&#xA;&lt;li&gt;pears&lt;/li&gt;&#xA;&lt;li&gt;oranges&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bread (branch parent)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;wholemeal&lt;/li&gt;&#xA;&lt;li&gt;white&lt;/li&gt;&#xA;&lt;li&gt;bloomer&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Goal:&#xA;Part of the goal here is to use the structure in the admin panel so that entrie are reflected like the above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The branch parent contains contains a description of that branches content. So 'fruit' and 'bread' are what i call branch parents ( possibly even root parents etc)&#xA;The branch parent content can be either stored as its own entry type at the top of the branch in the structure, and preserve the admin structural view. Or I can store the branch description as a field in the category for the entries in the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I store the branch description as an entry type at the top of the branch structure, I cant use the category urls because they will conflict with the branch:&#xA;e..g category url = 'food/fruit'&#xA;entry type url 'food/fruit-1'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I ditch the top of the branch parent entry type then the admin for that section is just a flat list - it loses is hierarchical structure and a little bit of its meaning and find-ability for admins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I could just turn off the category urls and render the structure in templates without categories but it doesn't feel right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How have others solved / implemented this?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-03-06T11:06:43.290" Title="Structure parent root - entry type or category urls?" Tags="&lt;categories&gt;&lt;structure&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24088" PostTypeId="1" CreationDate="2018-03-06T15:14:33.680" Score="1" ViewCount="2928" Body="&lt;p&gt;I've been running an installation Craft CMS 3.0.0-RC13 for some time with no problems. However, now I cannot install new plugins nor can I remove any that are currently installed. I keep getting the same (or similar) error. The full response is included below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer remove [package]&#xA;&#xA;composer clear-cache&#xA;&#xA;composer update &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Almost seems like Composer has been corrupted or something. I'm assuming that the information about &quot;php version does not satisfy...&quot; is related to the bad package because I didn't alter anything about my php configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yqhxn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yqhxn.png&quot; alt=&quot;Screenshot of the persistent error message&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Composer was unable to install the updates.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Error: An error occurred&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Output: Loading composer repositories with package information&#xA;  Updating dependencies Your requirements could not be resolved to an&#xA;  installable set of packages.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Problem 1&#xA;  - The requested package am-impact/amnav could not be found in any version, there may be a typo in the package name. Problem 2&#xA;  - symfony/intl v3.3.7 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.8 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.9 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.0 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.10 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.11 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.12 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.13 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.14 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.1 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.2 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.3 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.15 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.4 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.3.16 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - symfony/intl v3.4.5 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1) overridden by &quot;config.platform.php&quot; version&#xA;  (7.0) does not satisfy that requirement.&#xA;  - Installation request for roave/security-advisories dev-master#3df94834c80037130b533703df4672785b6ea112 -&gt; satisfiable by&#xA;  roave/security-advisories[dev-master].&#xA;  - newism/craft3-fields 0.0.10 requires symfony/intl ^3.3 -&gt; satisfiable by symfony/intl[v3.4.5, v3.3.16, v3.4.4, v3.3.15, v3.4.3,&#xA;  v3.4.2, v3.4.1, v3.3.14, v3.3.13, v3.3.12, v3.3.11, v3.3.10, v3.4.0,&#xA;  v3.3.9, v3.3.8, v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.3, v3.3.2,&#xA;  v3.3.1, v3.3.0].&#xA;  - symfony/intl v3.3.6 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.5 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.4 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.3 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.2 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.1 conflicts with roave/security-advisories[dev-master].&#xA;  - symfony/intl v3.3.0 conflicts with roave/security-advisories[dev-master].&#xA;  - Installation request for newism/craft3-fields ^0.0.10 -&gt; satisfiable by newism/craft3-fields[0.0.10].&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Potential causes:&#xA;  - A typo in the package name&#xA;  - The package is not available in a stable-enough version according to your minimum-stability setting see for more details.&#xA;  - It's a private package and you forgot to add a custom repository to find it&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Read for further common problems. Running update with --no-dev does&#xA;  not mean require-dev is ignored, it just means the packages will not&#xA;  be installed. If dev requirements are blocking the update you have to&#xA;  resolve those problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7913" LastActivityDate="2018-07-04T22:36:30.400" Title="How To Fix &quot;Error: Composer was unable to install the updates.&quot;" Tags="&lt;plugins&gt;&lt;craft3&gt;&lt;error&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24089" PostTypeId="1" AcceptedAnswerId="24090" CreationDate="2018-03-06T15:58:41.760" Score="1" ViewCount="636" Body="&lt;p&gt;I´m using for the first time Guest Entries plugin to collect some info and some files from users, great! All it´s going great, the site admin will see all the info that the clients sends and the files from each one, but i would like to know if there is a way to download the assets from a specific entry, so keep it simple to download the assets sended by some specific user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zgQWd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zgQWd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this plugin does, but it doesn´t work.&#xA;&lt;a href=&quot;https://github.com/Hambrook/AssetLinks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Hambrook/AssetLinks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this one too, but it downloads the assets of a entire source.&#xA;&lt;a href=&quot;https://github.com/mattstauffer/craftcms-DownloadAssets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mattstauffer/craftcms-DownloadAssets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8082" LastEditorUserId="5557" LastEditDate="2018-03-06T16:05:01.353" LastActivityDate="2018-03-06T16:15:39.590" Title="Download files in Assets fields" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24090" PostTypeId="2" ParentId="24089" CreationDate="2018-03-06T16:15:39.590" Score="1" Body="&lt;p&gt;Change the javascript of the &lt;a href=&quot;https://github.com/Hambrook/AssetLinks/blob/master/resources/js/assetlinks.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;asset&lt;/a&gt; file to something like this and it will work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function(){&#xA;    $(&quot;.field .input .elementselect .element:not(.linked)&quot;).each(function(){&#xA;        var $this = $(this);&#xA;        if (!$this.data(&quot;url&quot;)) { return false; }&#xA;        var $a = $(&quot;&amp;lt;a class='icon'&amp;gt; &amp;lt;/a&amp;gt;&quot;)&#xA;            .attr(&quot;href&quot;, $this.data(&quot;url&quot;))&#xA;            .attr(&quot;title&quot;, &quot;Download&quot;)&#xA;            .addClass(&quot;download&quot;)&#xA;            .addClass(&quot;sharebtn&quot;)&#xA;            .addClass(&quot;icon&quot;)&#xA;            .attr('download', $this.data('label'))&#xA;            .appendTo($this);&#xA;        $this&#xA;            .addClass(&quot;linked&quot;)&#xA;            .prepend($a);&#xA;    })&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-06T16:15:39.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24092" PostTypeId="1" AcceptedAnswerId="24093" CreationDate="2018-03-06T19:08:54.087" Score="1" ViewCount="449" Body="&lt;p&gt;I currently am developing a plugin to gather XML restful data. &#xA;At one point in the file, I need to reference another PHP file, which will process various data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a test, the code in the included file should return output, as well (see code below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to utilize the following code, but it doesn't work.  There is no error message, but again there is no data output.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::import('plugins.aifeed.resources.Date_Formatting');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been looking &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21512/using-craftimport-to-include-external-resource-into-the-craft-namespace/21521#&quot;&gt;here&lt;/a&gt;, but it wasn't clear to me how or if the 'included' file could be utilized.&#xA;Thanks for any leads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in Variables folder:&#xA;AiFeedVariable.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AiFeedVariable&#xA;{&#xA;        public function XmlVariable($optional = null)&#xA;    {&#xA;....&#xA;$strSampleDate = '2015-12-23';&#xA;&#xA;Craft::import('plugins.aifeed.resources.Date_Formatting');&#xA;&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in Resources folder:&#xA;DateFormatting.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class DateFormatting&#xA;{&#xA;$strDate_A=$strSampleDate;&#xA;echo '$strDate_A test...'.$strDate_A.'&amp;lt;br&amp;gt;';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="5557" LastEditDate="2018-03-06T19:27:43.697" LastActivityDate="2018-03-06T19:57:42.813" Title="Include PHP file in plugin" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24093" PostTypeId="2" ParentId="24092" CreationDate="2018-03-06T19:21:13.630" Score="2" Body="&lt;p&gt;You can simply load the file normally via php &lt;a href=&quot;http://php.net/manual/en/function.require-once.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;require once &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require_once( __DIR__ . '/resources/DateFormatting.php');&#xA;$dataFormatter = new DateFormatting();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From your plugins init function or where ever you would like to call it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope your &lt;code&gt;DateFormatting&lt;/code&gt; is not like you posted it because it has no functions. Btw &lt;code&gt;Craft::import()&lt;/code&gt; has the advantage that you can import entire folders and it loads the class only to Yiis classmap which means that it is only loaded when you need it and not until then. If you want to use the file for sure, require once is the better way since Craft/Yii does the same in the very end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Never mind, Yii uses &lt;code&gt;include&lt;/code&gt; and not &lt;code&gt;require_once&lt;/code&gt;, sry for the wrong info here. However... today the difference is not that big issue. &lt;a href=&quot;https://stackoverflow.com/a/186386/5604055&quot;&gt;Comparison include vs require_once&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-06T19:57:42.813" LastActivityDate="2018-03-06T19:57:42.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24094" PostTypeId="2" ParentId="24088" CreationDate="2018-03-06T19:43:45.647" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Problem 1 - The requested package am-impact/amnav could not be found in any version, there may be a typo in the package name.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;am-impact/amnav isn't a valid Craft 3 plugin, so you need to move that reference from your&lt;/code&gt;composer.json` file. You can see the full list of Craft 3 plugins here: &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.craftcms.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;symfony/intl v3.3.7 requires php ^5.5.9|&gt;=7.0.8 -&gt; your PHP version (7.0.27-1~dotdeb+8.1)...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All of those usually happen when you run a &lt;code&gt;composer update/install&lt;/code&gt; on environment A that has higher library versions than environment B and you deploy the &lt;code&gt;composer.lock&lt;/code&gt; file to environment B and try to run &lt;code&gt;composer update&lt;/code&gt; again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can force Composer to use a &quot;lowest common denominator&quot; across all environments like so: &lt;a href=&quot;https://github.com/pixelandtonic/craftcom/blob/develop/composer.json#L31-L33&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/craftcom/blob/develop/composer.json#L31-L33&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Installation request for roave/security-advisories dev-master#3df94834c80037130b533703df4672785b6ea112 -&gt; satisfiable by roave/security-advisories[dev-master]. - newism/craft3-fields 0.0.10 requires symfony/intl ^3.3&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can either remove &lt;code&gt;roave/security-advisories&lt;/code&gt; from your &lt;code&gt;composer.json&lt;/code&gt; file, remove &lt;code&gt;newism/craft3-fields&lt;/code&gt; from it or wait for the author of the &lt;code&gt;craft3-fields&lt;/code&gt; plugin to bump their symfony dependencies to a higher version that doesn't trigger &lt;code&gt;roave/security-advisories&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that after making changes to your &lt;code&gt;composer.json&lt;/code&gt;, you'll need to run &lt;code&gt;composer update&lt;/code&gt; from terminal from your project's root.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-06T19:43:45.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24095" PostTypeId="1" CreationDate="2018-03-06T20:39:31.407" Score="1" ViewCount="255" Body="&lt;p&gt;I've had a weird problem come up lately. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll be working in the admin site of my site, click on a link to an entry or field or whatever, and get redirected to /admin/install and I get a &quot;Page Not Found&quot; error. From that point on, I can't get to that page anymore. I can still go back and navigate to other pages. I've even tried logging out and logging back in, but that doesn't fix it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am, however, able to fix it by clearing all browser data (I'm using Chrome). This leads me to believe that it's some sort of local storage issue. However, I can't seem to narrow it down more than that. I've tried clearing out the cookies for just my site and that doesn't do the trick. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure what to look at next. I know this is pretty open-ended, but what else can I do to troubleshoot this issue? I'm more than happy to provide whatever additional information might be helpful.&lt;/p&gt;&#xA;" OwnerUserId="3709" LastActivityDate="2018-03-06T20:39:31.407" Title="Random redirects to /admin/install" Tags="&lt;redirect&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24096" PostTypeId="2" ParentId="22126" CreationDate="2018-03-06T20:56:04.347" Score="1" Body="&lt;p&gt;For anyone experiencing this issue, what solved it for me was deleting the craft application files and replacing them with the ones from the same release version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems one of them got corrupted at some point. &lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2018-03-06T20:56:04.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24098" PostTypeId="2" ParentId="22701" CreationDate="2018-03-06T21:15:21.697" Score="1" Body="&lt;p&gt;A super simple process would be to just use a single Structure called &quot;Pages&quot;, similar to what Paul said, (or whatever you want). Just attach a &lt;code&gt;lightswitch&lt;/code&gt; field to it like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s3MvA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s3MvA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your markup you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{# Get top-level entries in pages structure (exclude home page)  #}&#xA;{% set pages = craft.entries.section( 'pages' ).id( 'not 1' ).level( 1 ).hideFromNavigation( 'not 1' ).includeInTopNavigation( 1 ) %}&#xA;    {# Loop through top-level entries #}&#xA;    {% for page in pages %}&#xA;        &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ page.getUrl }}&quot;&amp;gt;&#xA;                {{ page.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The screenshot/code is from Craft 2 but the same concept applies to 3 as well.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2018-03-06T21:15:21.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24099" PostTypeId="1" AcceptedAnswerId="24100" CreationDate="2018-03-06T21:32:12.190" Score="1" ViewCount="368" Body="&lt;p&gt;We have to update the Asset after the SAVE_ON event, and the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not seems to be working (it is getting timed out). So what is the best pratice to update the Asset after the save, which event should we use for example auto-tagging?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we are trying to save the entry, it is working like charm, maybe we should query the asset parent first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update some additional findings:&lt;/strong&gt;&#xA;It's turned out it is not so easy to re-save the assets after the SAVE_ON. We need to add additional parameters - based on the class rules:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$rules[] = [['newLocation'], 'required', 'on' =&amp;gt; [self::SCENARIO_CREATE, self::SCENARIO_FILEOPS]];&#xA;$rules[] = [['tempFilePath'], 'required', 'on' =&amp;gt; [self::SCENARIO_CREATE, self::SCENARIO_REPLACE]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously the goal is to just add some tags/category to the image (eg: getting back the tags data from cloudanary auto tagging interface via the filesystem, so we are not able to use the before save event).&#xA;So if we are simply trying to save the &lt;code&gt;$asset&lt;/code&gt; it is not going to work, because we do not have newLocation either the tempFilePath is old as well. Instead we have to change the scenario, and save the asset after that (the idea was coming after checking the &lt;code&gt;ElementController&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element-&amp;gt;setScenario(Element::SCENARIO_LIVE);&#xA;$element-&amp;gt;setFieldValue('fieldHandle', $ids);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do not have better idea for Asset save (specially because the asset itself was saved, and only the fields has to be updated), but this solution is working like charm, and the same logic is applied on the CP. If only the fields are getting updated the &lt;code&gt;ElementController&lt;/code&gt; is getting called otherwise the &lt;code&gt;AssetController&lt;/code&gt;. Hopes it helps for future reference&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="7986" LastEditDate="2018-03-07T07:16:00.027" LastActivityDate="2018-03-07T07:16:00.027" Title="How can I add programmatically a Tag after SAVE_ON event in case of Assets types" Tags="&lt;assets&gt;&lt;entry&gt;&lt;tags&gt;&lt;element&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24100" PostTypeId="2" ParentId="24099" CreationDate="2018-03-06T21:53:55.110" Score="3" Body="&lt;p&gt;A Tag field is like every other relation field. Just insert an array of ids in the field and save the element&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element-&amp;gt;setFieldValue('fieldHandle', [1,2,3,4,5,6]);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to get the current ids and add one, just do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ids = $element-&amp;gt;getFieldValue('fieldHandle')-&amp;gt;ids();&#xA;$ids[] = 'yourNewTagId';&#xA;$element-&amp;gt;setFieldValue('fieldHandle', $ids);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To Create a new Tag do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tag = new Tag();&#xA;$tag-&amp;gt;title = &quot;your new tag name&quot;;&#xA;$tag-&amp;gt;groupId = 1;&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($tag);&#xA;&#xA;// and add it to the element&#xA;$element = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById(2);&#xA;$ids = $element-&amp;gt;getFieldValue('fieldHandle')-&amp;gt;ids();&#xA;$ids[] = $tag-&amp;gt;id;&#xA;$element-&amp;gt;setFieldValue('fieldHandle', $ids);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm using the &lt;code&gt;setFieldValue&lt;/code&gt; directly instead of the magic &lt;code&gt;__get&lt;/code&gt; and &lt;code&gt;__set&lt;/code&gt; methods for a better performance.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-06T22:01:35.023" LastActivityDate="2018-03-06T22:01:35.023" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="24102" PostTypeId="1" CreationDate="2018-03-07T00:06:14.743" Score="0" ViewCount="49" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When users visit the site only some of the images on the page show. Checking Chrome dev tools shows that the missing images are failing with &quot;server unavailable&quot; errors. The image is there if you go to it directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to be random. Images show sometimes but not others. I have erased the cache, rebuilt the search index and the asset list. No change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client says that the site sometime fails completely but I have yet to witness this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have VPNed from various locations and it seems to be the same no matter where I'm coming from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hosting company says the only error they see is &quot;image missing&quot; and the DB connection is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2018-06-05T04:14:59.657" Title="Images missing, service unavailable" Tags="&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24104" PostTypeId="1" CreationDate="2018-03-07T02:49:04.277" Score="1" ViewCount="1665" Body="&lt;p&gt;I am currently trying to save a new entry with &lt;code&gt;craft()-&amp;gt;elements-&amp;gt;saveElement()&lt;/code&gt;, as I want to avoid triggering the &lt;code&gt;onBeforeSave&lt;/code&gt; and &lt;code&gt;onAfterSave&lt;/code&gt; events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run my script, it returns a successful entry id, but there is no entry in the admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;$entry-&amp;gt;sectionId = $sectionId;&#xA;$entry-&amp;gt;typeId = $entryTypeId;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;authorId = 1;&#xA;&#xA;$success = craft()-&amp;gt;elements-&amp;gt;saveElement($entry, false);&#xA;&#xA;if ($success) {&#xA;    echo $entry-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7928" LastActivityDate="2018-10-25T19:19:26.673" Title="Programmatically create new entry with saveElement" Tags="&lt;entrymodel&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24105" PostTypeId="2" ParentId="24102" CreationDate="2018-03-07T03:04:12.163" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The hosting company says the only error they see is &quot;image missing&quot; and the DB connection is fine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That seems suspicious to me.  Assuming the 503 Service Unavailable status code is initiated in Craft, it will do that in two common occurrences for front-end requests.  One is when Craft is in the middle of being updated, and the other is when it is having problems connecting to the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A look through the Craft logs as well as your web server access logs should help verify this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-07T03:04:12.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24107" PostTypeId="1" CreationDate="2018-03-07T06:23:24.487" Score="1" ViewCount="71" Body="&lt;p&gt;Can I get anyone to confirm the thumbs for assets used in CP are stored under craft/storage/runtime/assets/thumbs/? Is there a way to define a custom folder for that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's Craft 2 btw.&lt;/p&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2018-03-07T07:27:17.313" Title="Asset thumbs path" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24108" PostTypeId="2" ParentId="24107" CreationDate="2018-03-07T07:27:17.313" Score="2" Body="&lt;p&gt;As you can see &lt;a href=&quot;https://craftcms.com/docs/folder-structure#craft-storage&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;runtime&lt;/strong&gt;/ – Pretty much everything in here is there for caching and logging purposes. Nothing that Craft couldn’t live without, if the folder happened to get deleted.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;assets&lt;/strong&gt;/ – Stores image thumbnails, resized file icons, and copies of images stored on remote asset sources, to save Craft an HTTP request when it needs the images to generate new thumbnails or transforms.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can't think of a clean way to do this without changing too much and having much effort. The function, that returns the path is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns the path to the craft/storage/runtime/assets/thumbs/ folder.&#xA; *&#xA; * @return string The path to the craft/storage/runtime/assets/thumbs/ folder.&#xA; */&#xA;public function getAssetsThumbsPath()&#xA;{&#xA;    $path = $this-&amp;gt;getAssetsPath().'thumbs/';&#xA;    IOHelper::ensureFolderExists($path);&#xA;    return $path;&#xA;}&#xA;&#xA;/**&#xA; * Returns the path to the craft/storage/runtime/assets/ folder.&#xA; *&#xA; * @return string The path to the craft/storage/runtime/assets/ folder.&#xA; */&#xA;public function getAssetsPath()&#xA;{&#xA;    $path = $this-&amp;gt;getRuntimePath().'assets/';&#xA;    IOHelper::ensureFolderExists($path);&#xA;    return $path;&#xA;}&#xA;&#xA;/**&#xA; * Returns the path to the craft/storage/runtime/ folder.&#xA; *&#xA; * @return string The path to the craft/storage/runtime/ folder.&#xA; */&#xA;public function getRuntimePath()&#xA;{&#xA;    $path = $this-&amp;gt;getStoragePath().'runtime/';&#xA;    IOHelper::ensureFolderExists($path);&#xA;&#xA;    if (!IOHelper::fileExists($path.'.gitignore'))&#xA;    {&#xA;        IOHelper::writeToFile($path.'.gitignore', &quot;*\n!.gitignore\n\n&quot;, true);&#xA;    }&#xA;&#xA;    return $path;&#xA;}&#xA;&#xA; /**&#xA; * Returns the path to the craft/storage/ folder.&#xA; *&#xA; * @return string The path to the craft/storage/ folder.&#xA; */&#xA;public function getStoragePath()&#xA;{&#xA;    return CRAFT_STORAGE_PATH;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you can change the &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt; but everything in there is pretty much hard coded&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-07T07:27:17.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24110" PostTypeId="2" ParentId="4661" CreationDate="2018-03-07T09:02:15.173" Score="2" Body="&lt;p&gt;I get this from time to time. I'm not sure of the specific errors in the logs as it hasn't happened for a while. But when it does then switching MAMP to use the same PHP for all hosts (so not FastCGI), load the site, then switch back to use FastCGI seems to magically &quot;fix&quot; it.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-03-07T09:02:15.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24111" PostTypeId="2" ParentId="23920" CreationDate="2018-03-07T10:36:52.713" Score="2" Body="&lt;p&gt;There’s no dedicated method on elements, but you can use &lt;a href=&quot;http://php.net/manual/en/function.get-class.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;get_class()&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;switch (get_class($element)) {&#xA;    case Entry::class:&#xA;        // it’s an entry&#xA;        break;&#xA;&#xA;    case Category::class:&#xA;        // it’s a category&#xA;        break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-03-12T09:36:53.407" LastActivityDate="2018-03-12T09:36:53.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24114" PostTypeId="2" ParentId="22300" CreationDate="2018-03-07T13:22:00.950" Score="2" Body="&lt;p&gt;The answer on &lt;a href=&quot;https://craftcms.stackexchange.com/a/1333/6817&quot;&gt;the previous question&lt;/a&gt; is a little bit off - you &lt;strong&gt;do not&lt;/strong&gt; want to use &lt;code&gt;json_encode&lt;/code&gt; to save the field. Just use the actual array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$tableValue = [&#xA;  [&#xA;    &quot;col1&quot;: &quot;Product #1&quot;,&#xA;    &quot;col2&quot;: &quot;5&quot;,&#xA;    &quot;col3&quot;: &quot;10&quot;,&#xA;    &quot;col4&quot;: &quot;15&quot;&#xA;  ],&#xA;  [&#xA;    &quot;col1&quot;: &quot;Product #2&quot;,&#xA;    &quot;col2&quot;: &quot;7&quot;,&#xA;    &quot;col3&quot;: &quot;14&quot;,&#xA;    &quot;col4&quot;: &quot;21&quot;&#xA;  ],&#xA;  [&#xA;    &quot;col1&quot;: &quot;Product #3&quot;,&#xA;    &quot;col2&quot;: &quot;7&quot;,&#xA;    &quot;col3&quot;: &quot;14&quot;,&#xA;    &quot;col4&quot;: &quot;21&quot;&#xA;  ]&#xA;];&#xA;&#xA;$entry-&amp;gt;setContentFromPost(array(&#xA;  'tableField'=&amp;gt; $tableValue,&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that 'col1', 'col2', etc, refer to locations in the table. The handle of the table column is not used.&lt;/p&gt;&#xA;" OwnerUserId="251" LastEditorUserId="8814" LastEditDate="2018-10-03T06:48:12.093" LastActivityDate="2018-10-03T06:48:12.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24115" PostTypeId="1" AcceptedAnswerId="24117" CreationDate="2018-03-07T13:47:48.773" Score="2" ViewCount="65" Body="&lt;p&gt;Haven't updated since version 2.6.2949 - are there any potential negative consequences of not updating? If so, what are they? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8091" LastEditorUserId="57" LastEditDate="2018-03-07T18:30:27.433" LastActivityDate="2018-03-07T18:30:27.433" Title="Why should I update Craft CMS?" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24116" PostTypeId="1" AcceptedAnswerId="24118" CreationDate="2018-03-07T14:08:05.817" Score="2" ViewCount="897" Body="&lt;p&gt;What is the difference between &lt;code&gt;siteUrl&lt;/code&gt; and &lt;code&gt;baseUrl&lt;/code&gt; in Craft 3? Is there any? &lt;/p&gt;&#xA;" OwnerUserId="7546" LastEditorUserId="57" LastEditDate="2018-03-07T18:31:30.297" LastActivityDate="2018-03-07T18:31:30.297" Title="What is the difference between siteUrl and baseUrl?" Tags="&lt;craft3&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24117" PostTypeId="2" ParentId="24115" CreationDate="2018-03-07T14:16:03.150" Score="5" Body="&lt;p&gt;No software is perfect. Like any other well-managed software project, Craft CMS is regularly updated with new features, improvements and bug fixes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Occasionally, the changes will relate to a specific security issue that has been discovered in the software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By not updating, you are missing out on the new features, improvements and bug fixes that make Craft CMS better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't update when a new security issue is patched, then you are leaving your site at risk of exploitation of the security vulnerability. Depending on the nature of the specific vulnerability, that could mean a threat to your site, your business, the web server that your site is running on or all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this applies to all software, not just Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.com/changelog&quot; rel=&quot;noreferrer&quot;&gt;Craft CMS changelog&lt;/a&gt; is a good resource to see what changes are included in each update.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2018-03-07T14:16:03.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24118" PostTypeId="2" ParentId="24116" CreationDate="2018-03-07T14:29:18.957" Score="1" Body="&lt;p&gt;When you take a look into Craft you'll see this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /**&#xA; * @var string|string[] The base URL to the site(s). If set, it will take precedence over the Base URL settings in Settings → Sites → [Site Name].&#xA; *&#xA; * This can be set to a string, which will override the primary site’s base URL only, or an array with site handles used as the keys.&#xA; *&#xA; * The URL(s) must begin with either `http://`, `https://`, or `//` (protocol-relative).&#xA; */&#xA;public $siteUrl&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the &lt;code&gt;baseUrl&lt;/code&gt; is what you insert in your site settings, the &lt;code&gt;siteUrl&lt;/code&gt; can overwrite these values from your config&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Site.php&lt;/code&gt; (model) has a this function as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Overrides the base URL while keeping track of the original one.&#xA; *&#xA; * @param string $baseUrl&#xA; *&#xA; * @return void&#xA; */&#xA;public function overrideBaseUrl(string $baseUrl)&#xA;{&#xA;    $this-&amp;gt;originalBaseUrl = (string)$this-&amp;gt;baseUrl;&#xA;    $this-&amp;gt;baseUrl = rtrim($baseUrl, '/').'/';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is called in the Site service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$site-&amp;gt;overrideBaseUrl($generalConfig-&amp;gt;siteUrl);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-07T14:29:18.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24119" PostTypeId="1" CreationDate="2018-03-07T19:54:27.803" Score="1" ViewCount="519" Body="&lt;p&gt;I'm stumped on a basic concept for looping images. I'm using the plugin ImageOptimize with Imgix and Amazon S3. The code below works but only shows one image (when there's more for that field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the code below, how are you suppose to loop through the assets without showing the different srcset image sizes?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set optimizedImages = entry.clientWork.one().imgixTransforms %}        &#xA;&#xA;    &amp;lt;picture&amp;gt;&#xA;        &amp;lt;source srcset=&quot;{{ optimizedImages.srcsetWebP() }}&quot; &#xA;            sizes=&quot;100vw&quot;&#xA;            type=&quot;image/webp&quot; /&amp;gt;&#xA;&#xA;        &amp;lt;img src=&quot;{{ optimizedImages.src() }}&quot;&#xA;            srcset=&quot;{{ optimizedImages.srcset() }}&quot;&#xA;            sizes=&quot;100vw&quot; /&amp;gt;&#xA;    &amp;lt;/picture&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7387" LastEditorUserId="57" LastEditDate="2018-03-07T20:07:31.783" LastActivityDate="2018-03-17T16:03:33.923" Title="Using ImageOptimize, how do you loop through photos?" Tags="&lt;craft3&gt;&lt;image-transforms&gt;&lt;responsive-images&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24120" PostTypeId="2" ParentId="24119" CreationDate="2018-03-07T20:40:20.690" Score="3" Body="&lt;p&gt;So the OptimizedImages field in &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageOptimize&lt;/a&gt; is added to your asset as a field (just like Entries can have fields), because it's added to your Asset Volume layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd iterate through the images the same way you would iterate through any assets in Craft. I'm a little unclear on what part you're stuck on here? If you could clarify, I could help you more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say we have an Asset's field with a handle of &lt;code&gt;heroImages&lt;/code&gt;, to output all of those images we'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for heroImage in entry.heroImages.all() %}&#xA;    &amp;lt;img src=&quot;{{ heroImage.url }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So then let's say you have an OptimizedImages field with a handle of &lt;code&gt;optimizedImages&lt;/code&gt; that's in your Asset Volume's layout, so it becomes a field that's in your Assets. Then we could just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for heroImage in entry.heroImages.all() %}&#xA;    &amp;lt;img src=&quot;{{ heroImage.optimizedImages.src() }}&quot; srcset=&quot;{{ heroImage.optimizedImages.srcset() }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it'll output all of the same images as in the previous example, but using an optimized &lt;code&gt;srcset&lt;/code&gt; of the images.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-17T16:03:33.923" LastActivityDate="2018-03-17T16:03:33.923" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24121" PostTypeId="1" CreationDate="2018-03-08T06:25:25.243" Score="2" ViewCount="692" Body="&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;: I'm trying to get User Photo URL WITHOUT any transforms, but none of those options seems to work:&#xA;(some of it prints the url with some transform)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;user.photo&#xA;user.getPhoto()&#xA;user.getPhoto('original')&#xA;user.getPhotoUrl()&#xA;user.getPhotoUrl('original')&#xA;user.photoUrl()&#xA;user.photoUrl('original')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no DOCs for this yet on the craft 3 site.&#xA;Anyone know?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7332" LastEditorUserId="5275" LastEditDate="2018-03-08T16:06:16.060" LastActivityDate="2018-03-08T16:06:16.060" Title="How to get user's photo url without transform?" Tags="&lt;users&gt;&lt;craft3&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24122" PostTypeId="2" ParentId="8607" CreationDate="2018-03-08T07:26:03.057" Score="1" Body="&lt;p&gt;what I did is instead of using a Matrix I simply use a Asset field type and Restrict allowed file types of only Image and Video in the field settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you loop through the asset field in the entry do a switch on the element 'kind' to determine if it's a video or an image and output the tag accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the sample code I wrote for my project where I populate a homepage slider called 'Swipey' with images or video.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% for block in entry.homepageslider %}&#xA;&#xA;    {% for hero in block.heroimage %}&#xA;&#xA;      {% set imgURL = hero.url %}&#xA;      &amp;lt;div class=&quot;swiper-slide&quot;&amp;gt;&#xA;        &amp;lt;div style=&quot;position:absolute; top:40px; left:40px; color:#ffffff; &quot;&amp;gt;&#xA;          &amp;lt;div style=&quot;font-size:30px; line-height:.9em; text-align: left; margin:0; padding:0; &quot;&amp;gt; {{ block.category }} &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div style=&quot;font-size:70px; line-height:.9em; text-align: left; margin:0; padding:0; &quot;&amp;gt; {{ block.title }} &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% switch hero.kind %}&#xA;&#xA;          {% case &quot;image&quot; %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ block.url }}&quot;&amp;gt;&#xA;              &amp;lt;img src=&quot;{{  imgURL }}&quot; /&amp;gt;&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;          {% case &quot;video&quot; %}&#xA;            &amp;lt;video width=&quot;100%&quot; height=&quot;100%&quot; preload= &quot;true&quot; loop = &quot;loop&quot; muted&amp;gt;&#xA;              &amp;lt;source src=&quot;{{  imgURL }}&quot; type=&quot;video/mp4&quot;&amp;gt;&#xA;              Your browser does not support the video tag.&#xA;            &amp;lt;/video&amp;gt;&#xA;&#xA;        {% endswitch %}&#xA;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8095" LastActivityDate="2018-03-08T07:26:03.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24123" PostTypeId="1" AcceptedAnswerId="24124" CreationDate="2018-03-08T10:21:11.593" Score="1" ViewCount="463" Body="&lt;p&gt;Following situation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a inline-block title with a background gradient applied. So in order that the background always starts from the left, each line will have to be spanned by a span tag. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Welcome to&amp;lt;br /&amp;gt; &#xA;our site&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should become this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;Welcome to&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; &#xA;&amp;lt;span&amp;gt;our site&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've started with this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.heroTitle|nl2br }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm stuck.&lt;br&gt;&#xA;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2018-03-08T10:38:12.540" Title="Wrap each line with a span tag" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24124" PostTypeId="2" ParentId="24123" CreationDate="2018-03-08T10:38:12.540" Score="1" Body="&lt;p&gt;You can split your text &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set text = block.heroTitle|nl2br %}&#xA;{% set splited = text|split('&amp;lt;br /&amp;gt;')%}&#xA;{% for part in splited %}&#xA;    &amp;lt;span&amp;gt;{{ part }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need you can use the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/trim.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;trim&lt;/a&gt; filter as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;{{ part|trim }}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-08T10:38:12.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24125" PostTypeId="1" CreationDate="2018-03-08T10:58:21.880" Score="1" ViewCount="331" Body="&lt;p&gt;I have switched the field of the SEOmatic plugin to translateable. All the SEO Titles are taken from the entry title. After changing to translateable I can see the translated fields in the SEO Title field but I need to save the entry again to see that on the website. Until then, the title is just in one language. Why is that? Is there any way to automate that, since I have a hundreds of entries and I dont want to do that manually.&lt;/p&gt;&#xA;" OwnerUserId="6840" LastActivityDate="2018-03-08T12:25:24.000" Title="Re-Saving neccessary?" Tags="&lt;entries&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24126" PostTypeId="2" ParentId="24125" CreationDate="2018-03-08T12:25:24.000" Score="2" Body="&lt;p&gt;I'm not entirely sure &lt;em&gt;why&lt;/em&gt; you need to resave all the entries but I do know &lt;em&gt;how&lt;/em&gt; you can do it quickly and easily. I'd recommend using the &lt;a href=&quot;https://github.com/TopShelfCraft/Walk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Walk plugin&lt;/a&gt; by Michael Rog to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin is pretty well-documented in the repository README, but I'll outline the steps here for you as well:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Download the plugin folder, drop it in &lt;code&gt;/craft/plugins&lt;/code&gt;, and install the plugin in the Craft CP.&lt;/li&gt;&#xA;&lt;li&gt;Add the &lt;code&gt;yiic&lt;/code&gt; file from the repository into the base folder of your Craft install (next to the &lt;code&gt;craft&lt;/code&gt; folder).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Open your terminal, &lt;code&gt;cd&lt;/code&gt; to your Craft install, and run the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php yiic walk entries --section=blog --limit=null entries.save&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Obviously replace&lt;/em&gt; &lt;code&gt;blog&lt;/code&gt; &lt;em&gt;with the name of your section.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hopefully that does the trick for you! Let me know if you have any questions...&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-08T12:25:24.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24127" PostTypeId="2" ParentId="24121" CreationDate="2018-03-08T14:41:54.777" Score="3" Body="&lt;p&gt;According to the &lt;a href=&quot;https://github.com/craftcms/cms/blob/cf85fae8b84c7329e70ea96753ebb53d897f26fc/src/elements/User.php#L951-L970&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 source code&lt;/a&gt;, &lt;code&gt;User::getPhotoUrl() has been deprecated. Use getPhoto() to access the photo asset (if there is one), and call its getUrl() method to access the photo URL.&lt;/code&gt; &lt;em&gt;(Also mentioned in the &lt;a href=&quot;https://github.com/craftcms/cms/blob/2e05ca4fa899e4e922562286767061b4ec9fe12b/CHANGELOG-v3.md#deprecated-12&quot; rel=&quot;nofollow noreferrer&quot;&gt;changelog&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So assuming you've set &lt;code&gt;user&lt;/code&gt; to something already in your template, the correct way to get the photo in Craft 3 is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ user.photo.url() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-08T14:41:54.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24128" PostTypeId="1" CreationDate="2018-03-08T17:00:51.813" Score="2" ViewCount="37" Body="&lt;p&gt;I have a site with English and French locales. One of the fields we have assigned to our entries is an asset field.  Currently when an admin adds a new entry, all the English content will carry over to the French locale except for the file selected in that asset field.  Ideally, I'd like for the English asset field contents to carry over to the French asset field and only change if the admin changes it in the French locale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried a variety of settings but haven't had any luck.  Any direction would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6703" LastEditorUserId="5275" LastEditDate="2018-03-10T08:03:57.400" LastActivityDate="2018-03-10T08:03:57.400" Title="Carry over asset field content to other locales" Tags="&lt;entries&gt;&lt;assets&gt;&lt;localization&gt;&lt;assets-field&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24129" PostTypeId="1" AcceptedAnswerId="24142" CreationDate="2018-03-08T18:41:45.423" Score="1" ViewCount="3326" Body="&lt;p&gt;I'm new to Craft and I'm stumbling at the first hurdle for Craft 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting &quot;Variable &quot;entry&quot; does not exist.&quot; and I'm certain it's something so simple I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Install craft 3 via composer &lt;/li&gt;&#xA;&lt;li&gt;Add a Single section called &quot;Homepage&quot; (URI: &quot;/&quot; | template: &quot;index&quot;)&lt;/li&gt;&#xA;&lt;li&gt;Add &quot;templates/index.twig&quot; - test it with basic markup; displays correctly&lt;/li&gt;&#xA;&lt;li&gt;Add plain text field to homepage section (&quot;homepageHeader&quot;)&lt;/li&gt;&#xA;&lt;li&gt;Fill out homepageHeader in control panel and save.&lt;/li&gt;&#xA;&lt;li&gt;Change template to literally only &quot;{{entry.homepageHeader}}&quot;&lt;/li&gt;&#xA;&lt;li&gt;Error above after page refresh&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I must be missing something VERY simple. What is it?&lt;/p&gt;&#xA;" OwnerUserId="8000" LastActivityDate="2018-03-09T11:43:54.367" Title="Error: &quot;Variable &quot;entry&quot; does not exist&quot; on basic template" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24130" PostTypeId="1" AcceptedAnswerId="24131" CreationDate="2018-03-08T18:46:21.940" Score="0" ViewCount="119" Body="&lt;p&gt;I'm building a coursework site and have a Course section, who's entries will be courses containing work that the client will assign to users. I built in both the work itself (different &quot;lessons&quot; sections), and fields for the info page that will be displayed to all users of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use two different templates with the same entry? I need to be able to link to the course.url for the info page, as well as the course.url for the work page within the different templates that use info from the courses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have all of the course entries urls going to the info page template. Do I need to create a separate section for course work? &lt;/p&gt;&#xA;" OwnerUserId="6138" LastActivityDate="2018-03-08T19:46:20.917" Title="How can I use two different templates for a single entry?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;url&gt;&lt;sections&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24131" PostTypeId="2" ParentId="24130" CreationDate="2018-03-08T19:46:20.917" Score="1" Body="&lt;p&gt;You do not need to create a separate section for course work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to have is two different urls, that both display the same entry, but in two different ways, with two different templates. So for example &lt;code&gt;/course-slug&lt;/code&gt; will be the url for info page for the entry with slug &lt;code&gt;course-slug&lt;/code&gt;, and &lt;code&gt;/course-slug/lesson&lt;/code&gt; will be the url for the work page for the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of this as two different routes, you have set one of those routes up in the course section. You can set up a second one as a &lt;a href=&quot;https://craftcms.com/docs/routing#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic route&lt;/a&gt;. You want to route &lt;code&gt;[slug]/lesson&lt;/code&gt; (uri) to &lt;code&gt;_work&lt;/code&gt; (template) (or whatever your template is). Then in the &lt;code&gt;_work.twig&lt;/code&gt; template, you will need to fetch the entry from the slug:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('course').slug(slug).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check if no entry is set, and if not &lt;code&gt;{% exit 404 %}&lt;/code&gt;. And then proceed as normal.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-03-08T19:46:20.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24132" PostTypeId="1" CreationDate="2018-03-08T19:50:31.507" Score="0" ViewCount="13" Body="&lt;p&gt;One of the pages in the menu header is called Order Online, which takes users to a separate website.  I want to change the link where it takes users to but when I went to the backend of the site, the page is not listed under pages, nor is it listed under entries.  I have no idea where it is listed!&lt;/p&gt;&#xA;" OwnerUserId="8098" LastActivityDate="2018-03-08T20:03:23.770" Title="Page is Not listed in Backend" Tags="&lt;entries&gt;&lt;link&gt;&lt;menu&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24133" PostTypeId="1" AcceptedAnswerId="24135" CreationDate="2018-03-08T20:01:44.397" Score="1" ViewCount="295" Body="&lt;p&gt;I'm trying to rearrange the matrix block order using a frontend form.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If I use JavaScript to change the order of inputs in the DOM will this change the order in the backend after form submission?&lt;/li&gt;&#xA;&lt;li&gt;How do you include the correct value for image fields, is this using the image id?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have a reduced test case of what I came up with below, anyone see where I'm going wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;   {{ getCsrfInput() }}&#xA;   &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;   &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;viewentry/{slug}&quot;&amp;gt;&#xA;   &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;   &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock]&quot; /&amp;gt;&#xA;&#xA;   {% for block in entry.galleryBlock %}&#xA;&#xA;       {% switch slide.type %}&#xA;&#xA;       {% case 'landscape' %}&#xA;            {# block 1 #}&#xA;            {% set image = block.image[0] ?? null %}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][landscape]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;        {% case 'portrait' %}&#xA;            {# block 2 #}&#xA;            {% set image = block.image[0] ?? null %}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][portrait]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="6064" LastEditorUserId="6064" LastEditDate="2018-03-08T20:08:16.983" LastActivityDate="2018-03-08T20:30:34.150" Title="How to rearrange the order of blocks of a single matrix field using a frontend form?" Tags="&lt;matrix&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24134" PostTypeId="2" ParentId="24132" CreationDate="2018-03-08T20:03:23.770" Score="1" Body="&lt;p&gt;Since you said this “page” is merely a link to an external site, you’re not going to see it in the Entries section of the Control Panel. Most likely this page/link is being setup either in some menu plugin (e.g. A&amp;amp;M Nav) or in your Twig templates (in your master/layout template or some included template specific to the menu or nav).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-08T20:03:23.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24135" PostTypeId="2" ParentId="24133" CreationDate="2018-03-08T20:30:34.150" Score="2" Body="&lt;p&gt;Your sort order will change according to your HTML, so when you change your html, the sort order will change. You can use certain Javascript libraries to move your containers in your DOM, when you save the entry, your related entries will change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for every relation field in Craft, you only have to insert an array of ids to relate the elements.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][landscape]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is wrong because you insert the id of an image, not an array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[galleryBlock][{{ block.id }}][landscape][]&quot; value=&quot;{{ image.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is the correct way&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-08T20:30:34.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24136" PostTypeId="1" AcceptedAnswerId="24137" CreationDate="2018-03-09T01:36:19.977" Score="2" ViewCount="878" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of my templates has up to 6 fields that should each go into the same markup. Here's an example with a &lt;code&gt;courseDesign&lt;/code&gt; field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.courseDesign|length %}&#xA;  &amp;lt;section class=&quot;col-xl mb-3&quot;&amp;gt;&#xA;    &amp;lt;h2 id=&quot;courseDesign&quot;&amp;gt;Course Design&amp;lt;/h2&amp;gt;&#xA;    {{ entry.courseDesign }}&#xA;  &amp;lt;/section&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This worked fine when I wrote each section out like this. However, once I also added a table of contents/nav, I decided to refactor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now have a &lt;code&gt;courseFields&lt;/code&gt; array, and I'm adding each field to it if it exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set courseFields = {} %}&#xA;{% if entry.courseDesign %}&#xA;  {% set courseFields = courseFields|merge({ &quot;courseDesign&quot;: { handle: &quot;courseDesign&quot;, title: &quot;Course Design&quot; } }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My navigation macro works perfectly, because it's only interacting with the objects in the &lt;code&gt;courseFields&lt;/code&gt; array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My problem:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to iterate through my fields and get the actual content from them using a macro. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use {{ entry.handle }} in my macro, even when &lt;code&gt;handle&lt;/code&gt; is a valid field handle, I get the runtime error &lt;code&gt;Variable &quot;entry&quot; does not exist.&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set courseField = &quot;entry.&quot; ~handle %}&#xA;{{ courseField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that produces a string: &quot;entry.courseDesign&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I access &lt;code&gt;entry&lt;/code&gt; from my macro? Should I be going about this a different way?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2018-03-09T02:05:37.077" LastActivityDate="2018-03-09T07:19:36.780" Title="How can I iterate through an array of field handles for an entry?" Tags="&lt;templating&gt;&lt;field&gt;&lt;variable&gt;&lt;array&gt;&lt;macro&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24137" PostTypeId="2" ParentId="24136" CreationDate="2018-03-09T02:22:19.043" Score="4" Body="&lt;p&gt;I figured it out! I ditched the macro and just included the following in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in courseFields %}&#xA;&#xA;  &amp;lt;section class=&quot;col-xl mb-3&quot;&amp;gt;&#xA;    &amp;lt;h2 id=&quot;{{ field.handle }}&quot;&amp;gt;{{ field.title }}&amp;lt;/h2&amp;gt;&#xA;    {{ entry[field.handle] }}&#xA;  &amp;lt;/section&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2018-03-09T02:22:19.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24138" PostTypeId="2" ParentId="24056" CreationDate="2018-03-09T02:34:46.420" Score="1" Body="&lt;p&gt;The reason for the discount not being applied is that nearly all your products have not been marked as promotable (by looking at your database):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot: &lt;a href=&quot;http://jmp.sh/3FAK6NH&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jmp.sh/3FAK6NH&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No sales or discounts can be applied to a non-promotable product.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="340" LastEditDate="2018-03-11T05:28:25.547" LastActivityDate="2018-03-11T05:28:25.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24139" PostTypeId="2" ParentId="23761" CreationDate="2018-03-09T06:19:05.927" Score="1" Body="&lt;p&gt;I had the same problems earlier. I now use Mailjet for SMTP purposes. They offer 6000 mails per month and all mails will be delivered. Also you can check per mail what happened? &lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2018-03-09T06:19:05.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24140" PostTypeId="2" ParentId="24136" CreationDate="2018-03-09T07:12:25.360" Score="2" Body="&lt;p&gt;Just as an additional note: instead of creating your fields array in your template you can use Craft functions&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set layout = entry.getFieldLayout() %}&#xA;{#&#xA;    you can either output all tabs or check for a specific tab where all&#xA;    your &quot;frontend&quot; form/output fields live&#xA;    so you could create a &quot;frontend&quot; tab in your fieldLayoutDesigner&#xA;    If you just want to display all fields do&#xA;    for field in layout.getFields() directly&#xA;#}&#xA;{% for tab in layout.tabs %}&#xA;    {# you can either output all#}&#xA;    {{ tab.name }}&#xA;    {% if tab.name == &quot;Frontend&quot; %}&#xA;        {% for field in tab.getFields %}&#xA;            {% switch field.className() %}&#xA;                {# different templates for different field types #}&#xA;                {% case &quot;craft\\fields\\PlainText&quot; %}&#xA;                    &amp;lt;section class=&quot;col-xl mb-3&quot;&amp;gt;&#xA;                        &amp;lt;h2 id=&quot;{{ field.handle }}&quot;&amp;gt;{{ entry.getFieldValue(field.handle) }}&amp;lt;/h2&amp;gt;&#xA;                        {{ entry.getFieldValue(field.handle) }}&#xA;                    &amp;lt;/section&amp;gt;&#xA;                {% case &quot;craft\\fields\\Assets&quot; %}&#xA;                    {% set asset = entry.getFieldValue(field.handle).one() %}&#xA;                    {% if asset %}&#xA;                        &amp;lt;img src=&quot;{{ asset.getUrl() }}&quot; alt=&quot;{{ asset.title }}&quot; class=&quot;&quot; &amp;gt;&#xA;                    {% endif %}&#xA;            {% endswitch %}&#xA;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit you can also list all fields for your frontend in a certain group and do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in layout.getFields %}&#xA;    {% if field.groupId == X %}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to group all your fields so you won't need that much work and it's easier to change things via CP&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to gain access to field values by string you can/should use the &lt;code&gt;Element-&amp;gt;getFieldByValue($handle)&lt;/code&gt; function. Twigs &lt;code&gt;element-&amp;gt;handle&lt;/code&gt; could be explained as a &quot;slower&quot; redirect to that function but it fetches the field layout first and checks if the field is actually in the layout and if the field exists. In the end, the function above is executed so you can use it directly as well&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-09T07:19:36.780" LastActivityDate="2018-03-09T07:19:36.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24142" PostTypeId="2" ParentId="24129" CreationDate="2018-03-09T11:43:54.367" Score="4" Body="&lt;p&gt;In order to set an entry as your &quot;homepage&quot; entry you have to leave the &lt;code&gt;uri&lt;/code&gt; in the section completely blank. It does not work when you insert a &lt;code&gt;/&lt;/code&gt; because this route does not fetch the correct element thus Craft is not able to provide the &lt;code&gt;entry&lt;/code&gt; variable in your twig template &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-09T11:43:54.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24143" PostTypeId="1" CreationDate="2018-03-09T13:49:43.860" Score="3" ViewCount="111" Body="&lt;p&gt;On a website I will be setting up there will be different ranges/types of products.&#xA;Basically purchased from different departments within the organisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can filter the products in different ways - either by a category or product type of whatever. &#xA;But is there any way to change where the confirmation email goes to.&#xA;E.g. All confirmation emails go to finance@domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if a item is purchased from Category A/Product Type A the confirmation email also goes to deptA@domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An item purchased from Category B/Product Type B - the confirmation email goes to deptB@domain.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this functionality easily achievable or will some sort of plugin be required?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2021-04-23T07:32:57.883" Title="Craft Commerce - Different confirmation email address for different product types or category" Tags="&lt;plugin-craftcommerce&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24144" PostTypeId="1" CreationDate="2018-03-09T16:47:17.380" Score="1" ViewCount="29" Body="&lt;p&gt;I have created a localized site with 9 locales for a client in craft v2.6. They are now requesting us to create a user group for each locale so they can assign editors for each of those regions. When a user creates a new entry they want the new entry to be enabled only for the preferred locale for that user instead of the default enabled locales that are set in the section setting. Is it possible to override a section’s settings based on user group permissions? I know this is a strange request and I don't believe it is doable but wanted to see if anyone had any thoughts on this.&lt;/p&gt;&#xA;" OwnerUserId="8102" LastEditorUserId="8102" LastEditDate="2018-03-09T17:05:03.930" LastActivityDate="2018-05-08T23:48:35.867" Title="Can user group permissions be used to override entry section locale settings?" Tags="&lt;users&gt;&lt;localization&gt;&lt;sections&gt;&lt;user-groups&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24145" PostTypeId="1" CreationDate="2018-03-09T16:59:04.170" Score="1" ViewCount="162" Body="&lt;ul&gt;&#xA;&lt;li&gt;Using Craft 3 RC14 &lt;/li&gt;&#xA;&lt;li&gt;System status is set to off&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Wondering if anyone has approached the same problem as I did. If there is a way to use &lt;strong&gt;element api&lt;/strong&gt; while the system status is disabled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to check the app's status within the element api using &lt;code&gt;\Craft::$app-&amp;gt;isSystemOn&lt;/code&gt; and it does display &lt;strong&gt;true&lt;/strong&gt; when the status is enabled, on the other hand it doesn't even go to the element.api and returns 503.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to keep the status disabled as during the development I don't want any search engine to crawl the content of the website before the actual launch date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there way to set the status on the api end or any other solution that would make my api active while the website is disabled?&lt;/p&gt;&#xA;" OwnerUserId="8103" LastActivityDate="2018-03-09T16:59:04.170" Title="Craft 3 Element Api when system status is disabled" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;system-status&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24146" PostTypeId="1" AcceptedAnswerId="24147" CreationDate="2018-03-09T17:13:41.343" Score="2" ViewCount="416" Body="&lt;p&gt;I have a matrix with a field to set a Entries URL. Unfortunately the entry is not being returned, only an empty object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my field settings below and element api code.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See below for the response within the json. I get an empty object? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is no data coming through? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q3W89.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q3W89.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fetching the data within a function like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KqzZP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KqzZP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fl0u0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fl0u0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code from my Element API:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function panelsMatrix($array) {&#xA;    $panelBlocks = [];&#xA;    foreach ($array as $block) {&#xA;        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;            case 'panel':&#xA;                $panelBlocks[] = [&#xA;                    'heading' =&amp;gt; (string) $block-&amp;gt;heading,&#xA;                    'text' =&amp;gt; (string) $block-&amp;gt;text,&#xA;                    'image' =&amp;gt; $block-&amp;gt;image[0]-&amp;gt;url,&#xA;                    'imagePosition' =&amp;gt; $block-&amp;gt;imagePosition,&#xA;                    'textBaseColour' =&amp;gt; $block-&amp;gt;textBaseColour,&#xA;                    'textHorizontalAlignment' =&amp;gt; $block-&amp;gt;textHorizontalAlignment,&#xA;                    'textVerticalAlignment' =&amp;gt; $block-&amp;gt;textVerticalAlignment,&#xA;                    'imageOffsetX' =&amp;gt;$block-&amp;gt;imageOffsetX,&#xA;                    'imageOffsetY' =&amp;gt;$block-&amp;gt;imageOffsetY,&#xA;                    'backgroundColour' =&amp;gt; $block-&amp;gt;backgroundColour,&#xA;                    'subPageDirect' =&amp;gt; $block-&amp;gt;subPageDirect-&amp;gt;first()&#xA;                ];&#xA;            break;&#xA;        }&#xA;    }&#xA;    return $panelBlocks;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7337" LastEditorUserId="7337" LastEditDate="2018-03-12T11:16:23.677" LastActivityDate="2018-03-12T11:21:49.697" Title="Element API Fetch Entries URL Within Matrix" Tags="&lt;matrix&gt;&lt;plugin-elementapi&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24147" PostTypeId="2" ParentId="24146" CreationDate="2018-03-09T17:44:55.603" Score="1" Body="&lt;p&gt;That's because you don't actually fetch the entry. In order to receive the entry you have to execute your &lt;code&gt;ElementCriteriaModel&lt;/code&gt; with &lt;code&gt;first()&lt;/code&gt; or &lt;code&gt;find()&lt;/code&gt; otherwise Craft tries to json encode a query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $block-&amp;gt;subPageDirect-&amp;gt;first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should read the docs about &lt;a href=&quot;https://craftcms.com/docs/relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; and the &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Criteria Model&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Btw stack exchange has a wonderful syntax highlighting please add your code directly the next time and not in a screenshot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function panelsMatrix($array) {&#xA;    $panelBlocks = [];&#xA;    foreach ($array as $block) {&#xA;        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;            case 'panel':&#xA;                $relatedEntries =  $block-&amp;gt;subPageDirect-&amp;gt;first();&#xA;                $attributes = $relatedEntries? $relatedEntries-&amp;gt;getAttributes() : [];&#xA;&#xA;                $panelBlocks[] = [&#xA;                    'heading' =&amp;gt; (string) $block-&amp;gt;heading,&#xA;                    'text' =&amp;gt; (string) $block-&amp;gt;text,&#xA;                    'image' =&amp;gt; $block-&amp;gt;image[0]-&amp;gt;url,&#xA;                    'imagePosition' =&amp;gt; $block-&amp;gt;imagePosition,&#xA;                    'textBaseColour' =&amp;gt; $block-&amp;gt;textBaseColour,&#xA;                    'textHorizontalAlignment' =&amp;gt; $block-&amp;gt;textHorizontalAlignment,&#xA;                    'textVerticalAlignment' =&amp;gt; $block-&amp;gt;textVerticalAlignment,&#xA;                    'imageOffsetX' =&amp;gt;$block-&amp;gt;imageOffsetX,&#xA;                    'imageOffsetY' =&amp;gt;$block-&amp;gt;imageOffsetY,&#xA;                    'backgroundColour' =&amp;gt; $block-&amp;gt;backgroundColour,&#xA;                    'subPageDirect' =&amp;gt; $attributes&#xA;                ];&#xA;            break;&#xA;        }&#xA;    }&#xA;    return $panelBlocks;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-12T11:21:49.697" LastActivityDate="2018-03-12T11:21:49.697" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24148" PostTypeId="2" ParentId="23920" CreationDate="2018-03-09T18:16:49.837" Score="2" Body="&lt;p&gt;You can also use the PHP function &lt;a href=&quot;http://php.net/manual/en/function.is-a.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;is_a()&lt;/code&gt;&lt;/a&gt; in addition to the PHP function &lt;a href=&quot;http://php.net/manual/en/function.get-class.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;get_class()&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a bit different as it also matches classes which have the class as one of its parents, e.g. an element class that extends &lt;code&gt;craft\elements\User&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (is_a($element, 'craft\elements\User')) {&#xA;    // Do stuff&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (is_a($element, craft\elements\User::class)) {&#xA;    // Do stuff&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1021" LastEditorUserId="125" LastEditDate="2018-03-12T09:34:18.753" LastActivityDate="2018-03-12T09:34:18.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24150" PostTypeId="1" CreationDate="2018-03-09T19:59:33.990" Score="0" ViewCount="186" Body="&lt;p&gt;When building a site locally and linking to entries in redactor fields, all of the links are being saved in the database with links to my local dev server (&lt;a href=&quot;http://mysite.test/path/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mysite.test/path/&lt;/a&gt;). Is there a config setting or any way to have these links be dynamic and use the {siteUrl} path instead of being hard-coded to the dev url?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2018-03-09T19:59:33.990" Title="Redactor entry links to dev server" Tags="&lt;redactor&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24151" PostTypeId="2" ParentId="21514" CreationDate="2018-03-09T21:23:47.193" Score="2" Body="&lt;p&gt;I just figured out how to do this. It was vexing me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, Craft is awesome and has provided support for &lt;a href=&quot;https://craftcms.com/docs/reference-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reference Tags&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write your Markdown like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[link text]({entry:20})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the Twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.markdown|parseRefs|markdown }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reference Tags support more than just entries, but this was the bit that I needed.&lt;/p&gt;&#xA;" OwnerUserId="3954" LastEditorUserId="3954" LastEditDate="2018-03-13T13:04:26.770" LastActivityDate="2018-03-13T13:04:26.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24152" PostTypeId="1" AcceptedAnswerId="24153" CreationDate="2018-03-09T21:59:51.997" Score="1" ViewCount="127" Body="&lt;p&gt;I have a fruit Link it field that I use to allow users to choose an entry and have that page redirect to the chosen entry.  Not sure of the syntax to use to pass that link it field to the redirect field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect &quot;{{ block.redirect.url }}&quot;  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="57" LastEditDate="2018-03-09T23:21:27.817" LastActivityDate="2018-03-09T23:21:27.817" Title="How to pass variable to Redirect tag" Tags="&lt;templating&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24153" PostTypeId="2" ParentId="24152" CreationDate="2018-03-09T22:15:21.173" Score="2" Body="&lt;p&gt;Does this work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect block.redirect.url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know Linkit but this would be the correct twig syntax at least. For normal entry fields you would do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% redirect block.redirect.one.url %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-09T22:15:21.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24154" PostTypeId="2" ParentId="24143" CreationDate="2018-03-09T23:06:21.737" Score="0" Body="&lt;p&gt;Should be pretty doable with a small plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd want to listen to something like the &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete&quot; rel=&quot;nofollow noreferrer&quot;&gt;onOrderComplete&lt;/a&gt; event, then loop through the line items making note of which product types the line items belong to, adding email address to an array to send to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then at the end, you can loop through your email address sending the appropriate emails out to each of the users.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-09T23:06:21.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24155" PostTypeId="2" ParentId="24144" CreationDate="2018-03-09T23:18:16.047" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to override a section’s settings based on user group permissions?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's nothing native in Craft that would allow you to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could do something like write a plugin that listened to the &lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeSaveEntry&lt;/a&gt; event and simulate it by enabling/disabling it for various locales based on the current user's permissions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-09T23:18:16.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24156" PostTypeId="1" AcceptedAnswerId="24168" CreationDate="2018-03-10T00:13:43.273" Score="1" ViewCount="130" Body="&lt;p&gt;On the template for choosing shipping method, I need to be able to remove/hide some shipping methods from being shown, based on the shipping zone that has been set by Craft, which is based on the address entered, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Postie for live Fedex rates, along with a couple of custom shipping methods, but Postie adds its live rates to the array of shipping methods regardless of the shipping zone, so I end up with my custom method, plus the Fedex methods, when I just want the custom one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to evaluate shippingZone that is set for this cart, and if it is zone A or B, not how any Fedex methods, else, show them. I just need access to the shippingZone to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like so: &lt;a href=&quot;https://d.pr/i/JCmTiT&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://d.pr/i/JCmTiT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to get it?&lt;/p&gt;&#xA;" OwnerUserId="4911" LastActivityDate="2018-03-12T17:29:04.623" Title="Commerce: Is shippingZone available as a variable on the shipping method selection template?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24160" PostTypeId="1" AcceptedAnswerId="24173" CreationDate="2018-03-10T14:34:51.170" Score="3" ViewCount="4308" Body="&lt;p&gt;I came across an interesting issue. I'm using Craft CMS 3.0.0-RC14 and non of my image paths are showing but the title and the file name does.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = nav.navLogo.one() %}&#xA;{{image.title}} // works&#xA;{{image.fileName}} // works&#xA;{{image.getUrl()}} // no output, not even error&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas ?&lt;/p&gt;&#xA;" OwnerUserId="6561" LastEditorUserId="57" LastEditDate="2018-03-12T21:04:48.250" LastActivityDate="2018-05-23T02:41:55.737" Title="Craft 3 image asset getUrl() not showing" Tags="&lt;craft3&gt;&lt;image&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24161" PostTypeId="1" AcceptedAnswerId="24162" CreationDate="2018-03-10T23:02:12.003" Score="1" ViewCount="2575" Body="&lt;p&gt;Installed using composer. No issues. Installed in /craft directory. Used the command line setup with what seemed like no issues. Moved my files from /craft/web to /public_html. When I try to get the site I get a 500 error. I CAN get &lt;a href=&quot;http://domain.com/phpinfo.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domain.com/phpinfo.php&lt;/a&gt;. What could be the issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit&lt;/em&gt;&#xA;I changed file permission of index.php to 644 and now get a different page with the same error. The first page is the standard cpanel 500 error with formatting. The second error page is a less formatted 500 page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This page isn’t working&#xA;  67.227.155.172 is currently unable to handle this request. HTTP ERROR 500&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="5557" LastEditDate="2018-03-10T23:29:18.927" LastActivityDate="2018-03-10T23:29:18.927" Title="500 Internal Server Error after moving index.php" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24162" PostTypeId="2" ParentId="24161" CreationDate="2018-03-10T23:24:31.253" Score="2" Body="&lt;p&gt;You have to change your Craft path accordingly. When you move your &lt;code&gt;web&lt;/code&gt; folder, you have to edit your index.php obviously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your php file does not magically know where your vendor folder is&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-10T23:24:31.253" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24163" PostTypeId="1" CreationDate="2018-03-11T19:55:13.290" Score="0" ViewCount="631" Body="&lt;p&gt;A couple questions...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How do these dynamic searches work? A excellent example is found at &lt;a href=&quot;https://www.mcmaster.com/#standard-socket-head-screws/=1bxdrjl&quot; rel=&quot;nofollow noreferrer&quot;&gt;McMaster Carr website&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Is there any search plugin like that for Craft? I did not see any.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-11T20:32:10.710" Title="Search with dynamic results" Tags="&lt;search&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24164" PostTypeId="2" ParentId="24163" CreationDate="2018-03-11T20:20:35.750" Score="1" Body="&lt;p&gt;You don't really need a &quot;search&quot; plugin for that. Craft has a brilliant Query Builder so it can be done really easily. Furthermore there is the &lt;code&gt;Element Api&lt;/code&gt; which provides a JSON endpoint. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to read the docs about &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;Searching in Craft&lt;/a&gt; and about &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/templating/querying-elements/index.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Queries in Templates&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wan't to search for entries containing these words, a specific &lt;code&gt;length&lt;/code&gt; and a &lt;code&gt;threadSize&lt;/code&gt; you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.threadSize('and, &amp;gt;0, &amp;lt;80).length('and, &amp;gt;10, &amp;lt;100).search({&#xA;    query: 'socket head screws',&#xA;    subLeft: true,&#xA;    subRight: true                &#xA;}).limit(10).all() %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's basically it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For advanced searches I would recommend to create a custom plugin. It's totally easy to search things in Craft so the need of a &quot;default&quot; plugins is not really high and it's faster to create a custom plugin than to find one that fits all your specific needs.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-11T20:32:10.710" LastActivityDate="2018-03-11T20:32:10.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24165" PostTypeId="1" CreationDate="2018-03-11T21:14:07.047" Score="1" ViewCount="453" Body="&lt;p&gt;I'm having trouble to load an ttf and a woff file in Craft 3. I'm getting an error 500. The files exists and when trying to access it via the browser it shows: Twig Syntax Error – Twig_Error_Syntax Unexpected character &quot;&quot; for both of the files. Any suggestions ?&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2018-03-12T12:11:05.447" Title="Error 500 on ttf and woff files" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="24166" PostTypeId="1" CreationDate="2018-03-12T01:02:02.753" Score="4" ViewCount="2185" Body="&lt;p&gt;I am new to Craft. I have done some ajax in the distant past. I have searched this forum and see lots of issues with ajax but it seems that there are a lot of different approaches. Craft docs have very little on Ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if there is a clear tutorial on doing ajax within craft. I have an address field set up and would like to click a button to retrieve all entries in a certain state and replace currently displayed data with the new data.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-12T07:50:47.393" Title="Basic ajax - how to?" Tags="&lt;craft3&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24167" PostTypeId="2" ParentId="24166" CreationDate="2018-03-12T07:50:47.393" Score="8" Body="&lt;p&gt;There is no real difference between a &quot;normal&quot; ajax request and an ajax request in Craft. You just leave the url blank, and insert an action parameter for your &lt;a href=&quot;https://craftcms.com/docs/routing&quot; rel=&quot;noreferrer&quot;&gt;route&lt;/a&gt;. Craft 3 uses &lt;code&gt;snake-case&lt;/code&gt; routes instead of &lt;code&gt;camelCase&lt;/code&gt;. So when you want to access your plugin you would do. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action = &quot;plugin-handle/controller-name/function-name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I full example as a CP request is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {&#xA;    action: 'form-builder/setting/get-settings-for-site',&#xA;    siteId: siteId&#xA;};&#xA;// include csrf token&#xA;var tokenName = Craft.csrfTokenName;&#xA;data[tokenName] = Craft.csrfTokenValue;&#xA;$.ajax({&#xA;    type: &quot;post&quot;,&#xA;    url: '',&#xA;    data: data,&#xA;    success: function (response) {&#xA;            ...&#xA;    },&#xA;    error: function (XMLHttpRequest, textStatus) {&#xA;        console.log(&quot;Status: &quot; + textStatus);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would access my &lt;code&gt;Form-builder&lt;/code&gt; plugin. The controller is &lt;code&gt;SettingsController&lt;/code&gt; and the action &lt;code&gt;actionGetSettingsForSite&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-12T07:50:47.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24168" PostTypeId="2" ParentId="24156" CreationDate="2018-03-12T08:00:43.550" Score="1" Body="&lt;p&gt;If postie plugin can't add zone support, then you will need to limit the selections options on the front end and need the zones available in twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Postie implementing it would be the first preferance, as there would be no backend validation if you just hid the options in twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There currently is no &lt;code&gt;craft.commmerce.shippingZones&lt;/code&gt; twig variable. You would need to expose it with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating a plugin at the &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pluginfactory.io&lt;/a&gt; with a variable class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the variable class within the plugin add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllShippingZones()&#xA;{&#xA;  return craft()-&amp;gt;commerce_shippingZones-&amp;gt;getAllShippingZones();&#xA;}&#xA;&#xA;public function matchZoneAndAddress($zone, Commerce_AddressModel $address)&#xA;{&#xA;    if ($zone-&amp;gt;countryBased)&#xA;    {&#xA;        $countryIds = $zone-&amp;gt;getCountryIds();&#xA;&#xA;        if (in_array($address-&amp;gt;countryId, $countryIds))&#xA;        {&#xA;            return true;&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        $states = [];&#xA;        $countries = [];&#xA;        $stateAbbrs = [];&#xA;        $stateNames = [];&#xA;        foreach ($zone-&amp;gt;states as $state)&#xA;        {&#xA;            $states[] = $state-&amp;gt;id;&#xA;            $stateNames[] = $state-&amp;gt;name;&#xA;            $stateAbbrs[] = $state-&amp;gt;abbreviation;&#xA;            $countries[] = $state-&amp;gt;countryId;&#xA;        }&#xA;&#xA;        if ($countries){&#xA;            array_filter($countries);&#xA;        }&#xA;        if ($stateNames){&#xA;            array_filter($stateNames);&#xA;        }&#xA;        if ($stateAbbrs){&#xA;            array_filter($stateAbbrs);&#xA;        }&#xA;&#xA;        $countryAndStateMatch = (in_array($address-&amp;gt;countryId, $countries) &amp;amp;&amp;amp; in_array($address-&amp;gt;stateId, $states));&#xA;        $countryAndStateNameMatch = (in_array($address-&amp;gt;countryId, $countries) &amp;amp;&amp;amp; $this-&amp;gt;_inArrayCaseinsensitive($address-&amp;gt;getStateText(), $stateNames));&#xA;        $countryAndStateAbbrMatch = (in_array($address-&amp;gt;countryId, $countries) &amp;amp;&amp;amp; $this-&amp;gt;_inArrayCaseinsensitive($address-&amp;gt;getStateAbbreviation(), $stateAbbrs));&#xA;&#xA;        if ($countryAndStateMatch || $countryAndStateNameMatch || $countryAndStateAbbrMatch)&#xA;        {&#xA;            return true;&#xA;        }&#xA;    }&#xA;&#xA;    return false;&#xA;}&#xA;&#xA;/**&#xA; * @param $needle&#xA; * @param $haystack&#xA; * @return bool&#xA; */&#xA;private function _inArrayCaseinsensitive($needle, $haystack) {&#xA;    return in_array(strtolower($needle), array_map('strtolower', $haystack), false);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would allow you to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set doesMatch = craft.yourPlugin.matchZoneAndAddress(zone, cart.shippingAddress) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To determine if an address is within a zone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2018-03-12T17:29:04.623" LastActivityDate="2018-03-12T17:29:04.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24169" PostTypeId="1" AcceptedAnswerId="24171" CreationDate="2018-03-12T08:34:23.567" Score="1" ViewCount="99" Body="&lt;p&gt;We are  trying out some features of the new Craft update and are wondering how ready for use the current version is and if any of you guys are already using it outside a testing environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if not, is there a clear signal of the development team on when to switch to the newer version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7398" LastEditorUserId="57" LastEditDate="2018-03-12T21:02:53.653" LastActivityDate="2018-03-12T21:02:53.653" Title="When is Craft 3 ready for commercial use" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24170" PostTypeId="1" CreationDate="2018-03-12T09:11:27.790" Score="0" ViewCount="70" Body="&lt;p&gt;On one of our sites that runs the Sprout SEO plugin we recently keep getting a HTTP 500 Error on the redirect + when I'm trying to create a new redirect as a 404 Page redirect or even updating an existing Redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a server sided issue or could this be resolved due to some settings changes?&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2018-03-12T09:11:27.790" Title="Keep getting HTTP 500 errors Sprout SEO" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24171" PostTypeId="2" ParentId="24169" CreationDate="2018-03-12T09:44:16.857" Score="2" Body="&lt;p&gt;The full release is only 23 days so I would suggest that it's time to start looking: &lt;a href=&quot;https://craftcms.com/news/craft-3-launch-faq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/news/craft-3-launch-faq&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6051" LastActivityDate="2018-03-12T09:44:16.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24172" PostTypeId="2" ParentId="24165" CreationDate="2018-03-12T12:11:05.447" Score="1" Body="&lt;p&gt;My issue was that the assets files were in the same folder as the twig template files. Moving the files to the &lt;code&gt;web&lt;/code&gt; folder solved the issue.&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2018-03-12T12:11:05.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24173" PostTypeId="2" ParentId="24160" CreationDate="2018-03-12T12:13:22.253" Score="7" Body="&lt;p&gt;The solution is to enable &quot;assets for this source have public URLs&quot; in the volume settings.&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2018-03-12T12:13:22.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24176" PostTypeId="1" AcceptedAnswerId="24179" CreationDate="2018-03-12T16:39:31.403" Score="0" ViewCount="402" Body="&lt;p&gt;What is the content of &lt;code&gt;templatecachequeries&lt;/code&gt; table for in Craft 3? Especially the column &lt;code&gt;query&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And is it normal to have a lot of entries (+5000) even on a smaller medium sized page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or it is because of badly used &lt;code&gt;{{% cache %}}&lt;/code&gt; tag? How does it relate?&lt;/p&gt;&#xA;" OwnerUserId="7546" LastEditorUserId="57" LastEditDate="2018-03-12T21:20:15.693" LastActivityDate="2018-04-11T22:54:19.377" Title="What is the table `templatecachequeries` for?" Tags="&lt;database&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24177" PostTypeId="1" CreationDate="2018-03-12T19:31:29.690" Score="1" ViewCount="122" Body="&lt;p&gt;I have chosen to append all title tags with the site name on my site (see screenshot). However, none of my title tags are being updated when I click update. All title tags are appended with &quot;- Site Name&quot; and have appeared that way prior to adding the Sprout Plugin. I've tried changing the character, but nothing is updating the title tags. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there somewhere else in Craft that allows for management of title tags that I'm missing? Thanks for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V91Fq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V91Fq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8109" LastActivityDate="2018-03-12T19:31:29.690" Title="Sprout SEO Plugin - Title Tags Not Appearing Correctly" Tags="&lt;plugin-sproutseo&gt;&lt;seo&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24178" PostTypeId="1" AcceptedAnswerId="24184" CreationDate="2018-03-12T20:29:16.300" Score="2" ViewCount="69" Body="&lt;p&gt;I'm trying to validate my form before the charge.js is triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've decided to drop submit button in favour of a standard button and then use valid() method to process submit, so this is what I have now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;charge-form&quot;&amp;gt;&#xA;&amp;lt;!-- some fields here !--&amp;gt;&#xA;&amp;lt;input id=&quot;submit&quot; type=&quot;button&quot; value=&quot;Subscribe&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;&amp;lt;script&amp;gt;&#xA;  $(&quot;#charge-form&quot;).validate();&#xA;  $(&quot;#charge-form&quot;).charge();&#xA;  $(&quot;#submit&quot;).click(function() {&#xA;    if ($(&quot;#charge-form&quot;).valid()) {&#xA;        $(&quot;#charge-form&quot;).submit();&#xA;    }&#xA;  })&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Validation works, and when testing the conditional statement with console.log it also works properly, but when actually used it gives $form.get(...).submit is not a function in the console in charge.js&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FNxBs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FNxBs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did anyone make jQuery Validate work with Charge?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2018-03-13T10:38:53.300" Title="jQuery Validate with Charge plugin" Tags="&lt;plugin-charge&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24179" PostTypeId="2" ParentId="24176" CreationDate="2018-03-12T22:27:48.617" Score="1" Body="&lt;p&gt;There's a great article here that goes in-depth on the &lt;code&gt;{% cache %}&lt;/code&gt; template tag and the pros and cons of its usage I'd suggest reading: &#xA;&lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template caching has pretty much remained identical to how it works in Craft 2 for Craft 3 so the article is still relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth linking to the official Craft docs on the subject: &lt;a href=&quot;https://craftcms.com/docs/templating/cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/templating/cache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-12T22:27:48.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24180" PostTypeId="2" ParentId="22126" CreationDate="2018-03-13T03:12:25.703" Score="1" Body="&lt;p&gt;The issue for me here was mod_security. Once that was adjusted w/ the host, all was well again.&lt;/p&gt;&#xA;" OwnerUserId="442" LastActivityDate="2018-03-13T03:12:25.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24181" PostTypeId="1" AcceptedAnswerId="24182" CreationDate="2018-03-13T07:36:30.237" Score="1" ViewCount="44" Body="&lt;p&gt;We are using a masonry grid, with 3 image sizes (different heights). The images are (one of) the banner image(s) from the news entries. We played around with &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8630/transform-different-image-if-specific-id-or-order&quot;&gt;this&lt;/a&gt;, however this doesn't work as we need to limit the image output - per entry - to only one. Running on the latest Craft 3 version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we, randomly, have one out of three image transforms, applied to the banner image of each entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    &amp;lt;div class=&quot;content&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;grid-items js-isotope js-grid-items&quot;&amp;gt;&#xA;            {% for entry in craft.entries.section('news').limit(10).all()  %}&#xA;            {% set image = entry.bannerImage.one() %}&#xA;            &amp;lt;div class=&quot;grid-item js-isotope-item js-grid-item&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img alt=&quot;&quot;  src=&quot;{{ image.getUrl( 'masonryLarge' )}}&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;card-block&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;card-posted&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ entry.author }}&amp;lt;/a&amp;gt; on {{ entry.postDate | date('M d, Y') }}&amp;lt;/div&amp;gt;&#xA;                        &amp;lt;h4 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;                        &amp;lt;div class=&quot;card-text&quot;&amp;gt;Lorem ipsum dolor sit amet, consect etur adipiscing elit. Mauris vel auctorol est. Integer nunc ipsum...&amp;lt;/div&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;card-read-more&quot;&amp;gt;Continue&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The transforms are: masonryLarge, masonryMedium &amp;amp; masonrySmall&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5557" LastEditDate="2018-03-13T07:56:43.127" LastActivityDate="2018-03-13T07:56:43.127" Title="Random transforms" Tags="&lt;craft3&gt;&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24182" PostTypeId="2" ParentId="24181" CreationDate="2018-03-13T07:53:02.000" Score="3" Body="&lt;p&gt;You can use Twigs &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/random.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Random&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ random(['masonryLarge', 'masonryMedium', 'masonrySmall']) }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you could do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(10).all()  %}&#xA;    {% set image = entry.bannerImage.one() %}&#xA;    &amp;lt;div class=&quot;grid-item js-isotope-item js-grid-item&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;item&quot;&amp;gt;&amp;lt;img alt=&quot;&quot;  src=&quot;{{ image.getUrl( random(['masonryLarge', 'masonryMedium', 'masonrySmall']) )}}&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;card-block&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;card-posted&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ entry.author }}&amp;lt;/a&amp;gt; on {{ entry.postDate | date('M d, Y') }}&amp;lt;/div&amp;gt;&#xA;                &amp;lt;h4 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h4&amp;gt;&#xA;                &amp;lt;div class=&quot;card-text&quot;&amp;gt;Lorem ipsum dolor sit amet, consect etur adipiscing elit. Mauris vel auctorol est. Integer nunc ipsum...&amp;lt;/div&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;card-read-more&quot;&amp;gt;Continue&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can use Twigs &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/cycle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cycle&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(10).all()  %}&#xA;    {% set transform = cycle(['masonryLarge', 'masonryMedium', 'masonrySmall'], loop.index0) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-13T07:53:02.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24184" PostTypeId="2" ParentId="24178" CreationDate="2018-03-13T10:38:53.300" Score="2" Body="&lt;p&gt;Silly me, this has nothing to do with charge.js, one simply can't have a button with an id=&quot;submit&quot; as weird things will happen - &lt;a href=&quot;https://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript&quot;&gt;see this thread&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;button&quot; id=&quot;otherThanSubmit&quot;&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this works fine&lt;/p&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2018-03-13T10:38:53.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24185" PostTypeId="1" CreationDate="2018-03-13T10:40:23.857" Score="4" ViewCount="573" Body="&lt;p&gt;I've been experimenting with Craft 3 and Multi Sites and feel like I'm missing something...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My organisation has a main homepage and multiple sub-sites. I have a Single Section called 'home' that creates the main site homepage. I want each sub-site to have an individual homepage too. Each sub-site should only be able to edit their own homepage entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I enable the 'home' Single Section across all sub-sites then they can all edit the main site homepage entry. The 'Propagate entries across all enabled sites?' option isn't available for Single Sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I achieve this? :|&lt;/p&gt;&#xA;" OwnerUserId="8113" LastActivityDate="2018-03-13T16:21:07.487" Title="Multi sites: how to give each site a home single entry?" Tags="&lt;multi-site&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24187" PostTypeId="1" AcceptedAnswerId="24189" CreationDate="2018-03-13T11:13:26.973" Score="1" ViewCount="471" Body="&lt;p&gt;Is there a way to get all available image transforms in a template?&#xA;I would like to generate the &lt;code&gt;srcset&lt;/code&gt; for responsive images programmatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of creating a macro for that but haven't found any information about how to loop over all the registered image transforms.&lt;/p&gt;&#xA;" OwnerUserId="5366" LastEditorUserId="5275" LastEditDate="2018-03-13T19:58:14.397" LastActivityDate="2018-04-20T13:11:23.493" Title="Get all available asset transforms" Tags="&lt;assets&gt;&lt;image-transforms&gt;&lt;macro&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24188" PostTypeId="1" CreationDate="2018-03-13T12:12:32.687" Score="1" ViewCount="79" Body="&lt;p&gt;Just wrapping up my first multi-language Craft 2.x site, and the last localization issue we're having is the password reset process. I can't find a way to localize:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The email which is triggered by the &quot;forgot password&quot; form.&lt;/li&gt;&#xA;&lt;li&gt;The language which the user will be see to when clicking the email's &quot;reset&quot; link.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are some inconsistencies here because when I have my user set to, for example, Canadian French as their preferred locale, the subject of the email is localized, but the body is not (naturally, since there's no place to actually translate the body text anywhere that I can find), and when the link is visited, the form is in English (even though the link resides in my &lt;code&gt;/fr/&lt;/code&gt; directory, where the config file sets my local to  &lt;code&gt;fr_ca&lt;/code&gt;, and the user in question has &lt;code&gt;fr_ca&lt;/code&gt; as their preferred locale).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution here?&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-03-13T12:12:32.687" Title="How to localize password emails and password change form?" Tags="&lt;control-panel&gt;&lt;localization&gt;&lt;password&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24189" PostTypeId="2" ParentId="24187" CreationDate="2018-03-13T12:16:59.347" Score="2" Body="&lt;h3&gt;Craft 3 PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$transforms = Craft::$app-&amp;gt;getAssetTransforms()-&amp;gt;getAllTransforms();&#xA;foreach($allTransforms as $transform){&#xA;    echo $asset-&amp;gt;getUrl($transform-&amp;gt;handle);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Craft 3 Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTransforms = craft.app.getAssetTransforms.getAllTransforms() %}&#xA;{% for transform in allTransforms %}            &#xA;    {{ asset.getUrl(transform.handle) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Craft 2 PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allTansforms = craft()-&amp;gt;assetTransforms-&amp;gt;getAllTransforms();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Craft 2 Twig&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You'll need a plugin for this because you don't have access to that component&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTransforms = craft.pluginHandle.getAllAssetTransforms %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your &lt;code&gt;PluginVariable&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllAssetTransforms(){&#xA;    return craft()-&amp;gt;assetTransforms-&amp;gt;getAllTransforms();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-20T13:11:23.493" LastActivityDate="2018-04-20T13:11:23.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24190" PostTypeId="2" ParentId="24185" CreationDate="2018-03-13T12:32:35.973" Score="1" Body="&lt;p&gt;It's well explained in your section settings in the CP: there is a table with the settings for each site with a hint to leave the field blank if it should be the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have a different entry as the homepage for another site create a new single section for that site.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Single Entry 1&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-----------------------------------------------------&#xA;| site              | url            | template     |&#xA;-----------------------------------------------------&#xA;| english, disabled |                |              |&#xA;| german, enabled   |                | index.twig   |&#xA;-----------------------------------------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Single Entry 2&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-----------------------------------------------------&#xA;| site              | url            | template     |&#xA;------------------------------------------------------&#xA;| english, enabled  |                | index.twig    |&#xA;| german, disabled  |                |               |&#xA;------------------------------------------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way users won't be able to edit the homepage entry from other sites.&#xA;Another approach would be to limit the site permissions for your editors so they'll only be able to edit the elements which are connected to their site.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-13T16:21:07.487" LastActivityDate="2018-03-13T16:21:07.487" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24193" PostTypeId="2" ParentId="6511" CreationDate="2018-03-13T16:41:23.887" Score="0" Body="&lt;p&gt;This should be what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.section not same as('Homepage') %}Blabla {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8114" LastActivityDate="2018-03-13T16:41:23.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24194" PostTypeId="1" CreationDate="2018-03-13T18:51:40.687" Score="1" ViewCount="29" Body="&lt;p&gt;Yesterday, things worked fine with SproutSeo 2. I replaced two images for default pages in that plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today, some entries aren't picking up images correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some sections have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;meta property='og:image' -- Still maps to the correct content image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;meta property='og:image:secure_url' is also showing, but this does not map to the image. Instead, it maps to the default image for that section (ie not for the particular post, but for the index in that section) and in others, it maps to an image that is NOT the default image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the craft template set to pick up the default image or to place in a featured image. This is done as in this example: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/sprout-seo-2/overriding-images&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/sprout-seo-2/overriding-images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have an override for ogImage. The problem is that I don't know a way to set the og:image:secure_url property. (I can't say I've ever noticed this property before today) I can't find an override to use within the template. I don't see a setting in the SproutSEO panel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I override og:image:secure_url or make it go away or whatever else I need to do so that the correct images get matched? (Ideally before I LMS over this hiccup)&lt;/p&gt;&#xA;" OwnerUserId="7150" LastActivityDate="2018-03-13T18:51:40.687" Title="New problem on old implementation of SproutSeo with og:image:secure_url" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24195" PostTypeId="1" AcceptedAnswerId="24197" CreationDate="2018-03-13T19:05:16.713" Score="1" ViewCount="202" Body="&lt;p&gt;Is it possible to 'group' search logic in the &lt;code&gt;craft.entries.search&lt;/code&gt; query? I need to do the following: &lt;code&gt;[a OR b OR c]  AND  [d OR e]  AND  [x OR y OR z]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8116" LastActivityDate="2018-03-14T10:15:24.397" Title="Search query: grouping and merging multiple searches" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24197" PostTypeId="2" ParentId="24195" CreationDate="2018-03-13T20:34:08.440" Score="1" Body="&lt;p&gt;You can combine &lt;code&gt;OR&lt;/code&gt;s within the same column but you can't easily combine multiple columns with an &lt;code&gt;OR&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.yourFieldHandle('OR, x, y, z').anotherFieldHandle('OR, d, e')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-13T20:34:08.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24198" PostTypeId="1" AcceptedAnswerId="24199" CreationDate="2018-03-13T21:21:39.800" Score="1" ViewCount="618" Body="&lt;p&gt;I know this is a basic question, but i never use Craft this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to show a section ( list of items ) in the frontend but only available for admin users ( that are already logged in the control panel ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can achieve this restriction from the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8082" LastActivityDate="2018-03-13T22:11:11.713" Title="How to restrict access to some section in front-end for admin user only?" Tags="&lt;users&gt;&lt;frontend&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24199" PostTypeId="2" ParentId="24198" CreationDate="2018-03-13T21:33:32.303" Score="1" Body="&lt;p&gt;One option is to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.admin ?? false %}&#xA;&#xA;    ...this code can only be seen by admins...&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;currentUser&lt;/code&gt; is a &lt;a href=&quot;https://craftcms.com/docs/templating/global-variables#currentUser&quot; rel=&quot;nofollow noreferrer&quot;&gt;Global Variable&lt;/a&gt; on which you can pass the &lt;code&gt;admin&lt;/code&gt; &lt;a href=&quot;https://craftcms.com/docs/templating/usermodel#admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;property&lt;/a&gt;. &lt;code&gt;??&lt;/code&gt; is a null-coalescing operator which returns &lt;code&gt;false&lt;/code&gt; if the &lt;code&gt;currentUser&lt;/code&gt; (if there is one) is not an admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to show this section to anyone logged in to the &lt;code&gt;admin&lt;/code&gt; or &lt;code&gt;client&lt;/code&gt; account in Craft Client, I'd recommend doing the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser ?? false %}&#xA;&#xA;    ...this code can only be seen by admins...&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, this says if the current user is logged in, display the contents. Since the only ones with logins are you and the client, this will only display the content to you!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you'd like for the whole page to only display for certain users (for any unaccepted visitors it will throw a Craft 403 error page), you can add something like this to the top of your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requirePermission &quot;permissionHandle&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(You can find a full list of permissions &lt;a href=&quot;https://craftcms.com/docs/templating/requirepermission&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend the &lt;code&gt;accessCp&lt;/code&gt; permission handle if you're wanting to block everyone but the client and admin accounts for Craft Client.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-03-13T22:11:11.713" LastActivityDate="2018-03-13T22:11:11.713" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24200" PostTypeId="1" CreationDate="2018-03-14T01:42:17.653" Score="1" ViewCount="78" Body="&lt;p&gt;I'm receiving an array with empty values when trying to get visitor info using the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map plugin&lt;/a&gt; and its &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/visitor-geolocation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Visitor Geolocation&lt;/a&gt; feature. I'm using MaxMind's free trial ($5 worth of queries) since FreeGeoIp.net is not recommended and I've double checked the plugin settings and cleared all caches. Looking at the MaxMind account there are no queries logged and my map/debug output has empty location values via PHP (&lt;a href=&quot;https://www.dropbox.com/s/wd8irryxs1qpv7q/Screenshot%202018-03-13%2020.35.09.png?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;screenshot&lt;/a&gt;). Working locally on a .dev domain, running Craft 3 RC and tried FreeGeoIp.net as well but to no avail.&lt;/p&gt;&#xA;&lt;p&gt;Twig:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set visitor = craft.smartMap.visitor %}&#xA;{% if visitor %}&#xA;  &amp;lt;pre&amp;gt;{{ dump(visitor) }}&amp;lt;/pre&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; array(8) {&#xA;  [&amp;quot;ip&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;city&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;state&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;zipcode&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;country&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;latitude&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;longitude&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;  [&amp;quot;coords&amp;quot;]=&amp;gt;&#xA;  bool(false)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7756" LastEditorUserId="45" LastEditDate="2021-01-01T07:01:29.420" LastActivityDate="2021-01-01T07:01:29.420" Title="Visitor array has empty values with Smart Map plugin (using MaxMind)" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24201" PostTypeId="1" AcceptedAnswerId="24208" CreationDate="2018-03-14T08:21:31.377" Score="1" ViewCount="1046" Body="&lt;p&gt;I've been using &lt;a href=&quot;https://craftcms.com/docs/templating/eager-loading-elements#eager-loading-elements-related-to-matrix-blocks&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; to eager load images, stored in an Assets field which is located in a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My query looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('project')&#xA;.with(['projectMatrix.imageBlock:imageFile']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;projectMatrix&lt;/code&gt; is a Matrix field, &lt;code&gt;imageBlock&lt;/code&gt; is a Matrix block type and &lt;code&gt;imageFile&lt;/code&gt; is an Asset field inside &lt;code&gt;imageBlock&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do I reference the that image in my templates?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;&#xA;{% set matrixImage = entry.projectMatrix.type('imageBlock')[0].imageFile[0] ?? null %}&#xA;&#xA;...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is always be &lt;code&gt;null&lt;/code&gt;, when eager loaded&lt;/p&gt;&#xA;" OwnerUserId="5086" LastEditorUserId="5086" LastEditDate="2018-03-14T08:27:42.893" LastActivityDate="2018-03-14T19:34:22.960" Title="Eager-Loading Assets in Matrix" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;eager-loading&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24203" PostTypeId="1" AcceptedAnswerId="24205" CreationDate="2018-03-14T09:30:40.960" Score="1" ViewCount="463" Body="&lt;p&gt;Is it possible to link to the product from the shopping cart?&#xA;Something like &lt;code&gt;{{ item.url }}&lt;/code&gt; within &lt;code&gt;cart.lineItems&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using &lt;code&gt;{{ product.url }}&lt;/code&gt; looping through &lt;code&gt;craft.commerce.products&lt;/code&gt; I am getting a list with all product entries.&lt;/p&gt;&#xA;" OwnerUserId="8088" LastEditorUserId="5557" LastEditDate="2018-03-14T09:36:21.187" LastActivityDate="2018-03-14T22:10:38.993" Title="Link to the product from the shopping cart" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24204" PostTypeId="2" ParentId="24203" CreationDate="2018-03-14T09:41:10.647" Score="2" Body="&lt;pre&gt;&lt;code&gt;{{ item.purchasable.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should do it. &lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="57" LastEditDate="2018-03-14T22:10:38.993" LastActivityDate="2018-03-14T22:10:38.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24205" PostTypeId="2" ParentId="24203" CreationDate="2018-03-14T09:47:41.347" Score="1" Body="&lt;p&gt;From the &lt;a href=&quot;https://craftcommerce.com/support/accessing-product-info-from-order&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in order.lineItems %}&#xA;    {% set variant = item.purchasable %}&#xA;    {% set product = variant.product %}&#xA;    &amp;lt;li&amp;gt;{{ product.getUrl() }} - {{ variant.sku }} ({{ item.qty }})&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-14T09:47:41.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24206" PostTypeId="2" ParentId="24195" CreationDate="2018-03-14T10:15:24.397" Score="1" Body="&lt;p&gt;Thanks Robin, that answers my question. I also emailed Craft support – posting Brad's response below for posterity, which suggests other ways to approach this.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Robin is correct here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/24195/search-query-grouping-and-merging-multiple-searches&quot;&gt;Search query: grouping and merging multiple searches&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you're looking for more complex, you might be able to pull it off with a plugin that listened to the onBuildElementsQuery event (&lt;a href=&quot;https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery&lt;/a&gt;) or possibly through an external search service like Algolia. There's a Craft integration for the latter here: &lt;a href=&quot;https://transition.topshelfcraft.com/software/craft/searchplus/overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://transition.topshelfcraft.com/software/craft/searchplus/overview&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Thanks again&lt;/p&gt;&#xA;&lt;p&gt;Gavin&lt;/p&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-14T10:15:24.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24207" PostTypeId="1" AcceptedAnswerId="24210" CreationDate="2018-03-14T18:04:06.363" Score="2" ViewCount="127" Body="&lt;p&gt;I am setting attributes on my record using a models' attributes (that has validated successfully). I cannot figure out why the values aren't assigned. I can manually assign each one but that's redundant.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set attributes&#xA;// Massive assignment will only be made for fields which have passed some explicit validation rule.&#xA;if ($model-&amp;gt;validate())&#xA;{&#xA;    $purchaseRecord-&amp;gt;setAttributes($model-&amp;gt;getAttributes());&#xA;    var_dump($model-&amp;gt;snipInvoiceNumber); // works&#xA;    var_dump($purchaseRecord-&amp;gt;snipInvoiceNumber); // null value&#xA;    $purchaseRecord-&amp;gt;snipInvoiceNumber = $model-&amp;gt;snipInvoiceNumber; // works&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;Per comments on this thread I looped through and set the attributes individually. Anyone have insight on why setAttributes didn't work? &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/8884/save-contact-form-data-to-database&quot;&gt;Save contact form data to database&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I used instead of setAttributes (plural).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($model-&amp;gt;getAttributes() as $key =&amp;gt; $value ) {&#xA;    $purchaseRecord-&amp;gt;setAttribute($key, $value);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="57" LastEditDate="2018-03-14T22:28:25.443" LastActivityDate="2018-03-14T22:28:25.443" Title="Model values assignment issue" Tags="&lt;models&gt;&lt;attribute&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24208" PostTypeId="2" ParentId="24201" CreationDate="2018-03-14T19:34:22.960" Score="4" Body="&lt;p&gt;The reason this doesn't work is because &lt;code&gt;.type('image')&lt;/code&gt; won't work with eager loading. Eager loading removes the ability to use &lt;code&gt;ElementCriteriaModel&lt;/code&gt; methods.&lt;/p&gt;&#xA;&lt;p&gt;From the docs:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When the assets aren’t eager-loaded, entry.assetsField gives you an ElementCriteriaModel that is preconfigured to return the related assets once they’re requested (e.g. when first() is called).&lt;/p&gt;&#xA;&lt;p&gt;However when the assets are eager-loaded, entry.assetsField gets overwritten with an array of the eager-loaded assets. So first(), find(), and other ElementCriteriaModel methods are not available. Instead you must stick to the standard array syntaxes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As a work around, you could use a for loop to match only Matrix blocks of a particular type instead:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.projectMatrix if block.type == 'imageBlock' %}&#xA;  {% set matrixImage = block.imageFile[0] %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you only want the first image block type:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.projectMatrix if block.type == 'imageBlock' %}&#xA;  {% if loop.index == 1 %}&#xA;    {% set matrixImage = block.imageFile[0] %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-03-14T19:34:22.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24209" PostTypeId="1" AcceptedAnswerId="24216" CreationDate="2018-03-14T21:21:14.287" Score="1" ViewCount="79" Body="&lt;p&gt;I'm trying to create an jQuery/Ajax script to import data from a Wordpress API service and want to import the WP tags into my database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works as expected when I loop through the data and send it to &lt;code&gt;/actions/tags/createTag&lt;/code&gt; but I'd like to keep the original tag IDs in order to be able to import the posts later and keep the relationship with their tags (Craft automatically assigns a &lt;em&gt;length+1&lt;/em&gt; ID to new tags).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way I can do this?&lt;/p&gt;&#xA;" OwnerUserId="7208" LastActivityDate="2018-03-16T11:05:16.430" Title="Ajax - Create tag with custom ID programatically" Tags="&lt;ajax&gt;&lt;tags&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24210" PostTypeId="2" ParentId="24207" CreationDate="2018-03-14T21:34:44.873" Score="2" Body="&lt;p&gt;There is a second parameter  in your &lt;code&gt;setAttributes()&lt;/code&gt; function. This parameter is true per default and checks if the attribute is &lt;code&gt;safe&lt;/code&gt; so you either have to declare all safe attributes in your records rules or you set the parameter to false. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-14T21:34:44.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24211" PostTypeId="1" CreationDate="2018-03-15T01:51:14.253" Score="0" ViewCount="316" Body="&lt;p&gt;I created a form on the frontend that allows users to upload their profile photos:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users/{{ currentUser.username }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;photo&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;upload&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Serialization of 'Closure' is not allowed from /Users/rain/dev/valet/tr3ndsideas/vendor/yiisoft/yii2-queue/src/serializers/PhpSerializer.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to fix this problem?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="5557" LastEditDate="2018-03-15T09:06:05.787" LastActivityDate="2018-03-16T03:25:34.033" Title="Serialization of 'Closure' is not allowed" Tags="&lt;users&gt;&lt;form&gt;&lt;upload&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24212" PostTypeId="2" ParentId="23954" CreationDate="2018-03-15T01:57:35.703" Score="2" Body="&lt;p&gt;I used the method described here: &quot;A User-Friendly Table Field&quot; &lt;a href=&quot;http://www.drivesimplicity.com/blog/a-user-friendly-table-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.drivesimplicity.com/blog/a-user-friendly-table-field&lt;/a&gt; -- instruct the user to leave columns that he/she doesn't want blank and to use the first row as his/her column headings. I've found that it works quite well! &lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2018-03-15T01:57:35.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24213" PostTypeId="1" CreationDate="2018-03-15T14:01:17.253" Score="1" ViewCount="736" Body="&lt;p&gt;I'm using element API to pull JSON, and I have it working pretty well with a matrix field, but I need to pull a single column out of a table field inside of the matrix, and I don't even know where to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're using this as a headless way to pull data into a game, and I need to pull the flavor text, and just have it output one field in the table, not everything.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/locations/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'locations', 'slug' =&amp;gt; $slug],&#xA;            'pretty' =&amp;gt; true,&#xA;            'one' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function (craft\elements\Entry $entry) {&#xA;                $bodyBlocks = [];&#xA;                foreach ($entry-&amp;gt;dataMatrix as $block) {&#xA;                    switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                        case 'theData':&#xA;                            $bodyBlocks[] = [&#xA;                                'zone' =&amp;gt; $block-&amp;gt;zone,&#xA;                                'zoneName' =&amp;gt; $block-&amp;gt;zoneName,&#xA;                                'alternateZone' =&amp;gt; $block-&amp;gt;alternateZone,&#xA;                                'zoneBanner' =&amp;gt; $block-&amp;gt;zoneBanner,&#xA;                                'backgroundAsset' =&amp;gt; $block-&amp;gt;backgroundAsset,&#xA;                                'propAsset' =&amp;gt; $block-&amp;gt;propAsset,&#xA;                                'flavorText' =&amp;gt; $block-&amp;gt;flavorText,&#xA;                            ];&#xA;                            break;&#xA;                    }&#xA;                }&#xA;                return [&#xA;                    'data' =&amp;gt; $bodyBlocks,&#xA;                ];&#xA;            }&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is currently giving me this output for the table field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;flavorText&quot;: [&#xA;            {&#xA;                &quot;col1&quot;: &quot;1&quot;,&#xA;                &quot;col2&quot;: &quot;Arbitrary flavor text here&quot;,&#xA;                &quot;col3&quot;: &quot;&quot;,&#xA;                &quot;title&quot;: &quot;1&quot;,&#xA;                &quot;text&quot;: &quot;Arbitrary flavor text here&quot;,&#xA;                &quot;icon&quot;: &quot;&quot;&#xA;            }&#xA;        ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All I want is the stuff in the 'text' field, nothing else. There is no documentation anywhere on how to deal with Table Fields in the Element API, much less how to do it within a matrix. I'm also not sure how to loop through fields inside of a matrix that require loops to pull the data normally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea how I can get this output?&lt;/p&gt;&#xA;" OwnerUserId="4554" LastEditorUserId="4554" LastEditDate="2018-03-15T14:07:04.717" LastActivityDate="2018-03-15T15:25:06.553" Title="Element API -- getting table data from a matrix" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24214" PostTypeId="2" ParentId="24213" CreationDate="2018-03-15T14:54:23.003" Score="1" Body="&lt;p&gt;The table field contains an array of all columns, I don't really see where you problem is since you could just do &lt;code&gt;data[0].flavorText[0].text&lt;/code&gt; in your template and as you already explained you can see the direct output so you can just address the index in the array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$block-&amp;gt;flavorText[0]-&amp;gt;text &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will return you the text within the first column&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the values from all columns you'll have to loop through them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$values = [];&#xA;foreach($block-&amp;gt;flavorText as $column){&#xA;    $values[] = $column['text'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-15T15:25:06.553" LastActivityDate="2018-03-15T15:25:06.553" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24215" PostTypeId="1" CreationDate="2018-03-15T15:05:43.277" Score="1" ViewCount="100" Body="&lt;p&gt;I'm trying to create a jQuery/Ajax script to import data from a Wordpress API service and want to import the WP categories and tags into my database. I've managed to import the tags using an Ajax call to &lt;code&gt;/actions/tags/createTag&lt;/code&gt;, is there any endpoint that does the same with categories?&lt;/p&gt;&#xA;" OwnerUserId="7208" LastActivityDate="2018-03-15T15:16:33.657" Title="Ajax - How to create a Category through actionTrigger" Tags="&lt;categories&gt;&lt;ajax&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24216" PostTypeId="2" ParentId="24209" CreationDate="2018-03-15T15:09:35.057" Score="0" Body="&lt;p&gt;You'll need to create a new table/record to store the data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class IdRecord extends BaseRecord&#xA;{&#xA;    /**&#xA;     * Returns the name of the database table the model is associated with (sans table prefix). By convention,&#xA;     * tables created by plugins should be prefixed with the plugin name and an underscore.&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getTableName()&#xA;    {&#xA;        return 'ids';&#xA;    }&#xA;&#xA;    /**&#xA;     * Returns an array of attributes which map back to columns in the database table.&#xA;     *&#xA;     * @access protected&#xA;     * @return array&#xA;     */&#xA;    protected function defineAttributes()&#xA;    {&#xA;        return array(&#xA;            'oldId'   =&amp;gt; AttributeType::Number,&#xA;            'newId' =&amp;gt; AttributeType::Number&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Create a new Controller and store with the record&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCreateTag()&#xA;{&#xA;    $this-&amp;gt;requireLogin();&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;    $tag = new TagModel();&#xA;    $tag-&amp;gt;groupId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('groupId');&#xA;    $tag-&amp;gt;getContent()-&amp;gt;title = trim(craft()-&amp;gt;request-&amp;gt;getRequiredPost('title'));&#xA;    $oldId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('oldId');&#xA;&#xA;    if (craft()-&amp;gt;tags-&amp;gt;saveTag($tag))&#xA;    {&#xA;&#xA;        $tagMap = new IdRecord();&#xA;        $tagMap-&amp;gt;oldId = $oldId;&#xA;        $tagMap-&amp;gt;newId =  $tag-&amp;gt;id;&#xA;        $tagMap-&amp;gt;save();&#xA;        $this-&amp;gt;returnJson(array(&#xA;            'success' =&amp;gt; true,&#xA;            'id'      =&amp;gt; $tag-&amp;gt;id&#xA;        ));&#xA;    }&#xA;    else&#xA;    {&#xA;        $this-&amp;gt;returnJson(array(&#xA;            'success' =&amp;gt; false&#xA;        ));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you are saving your entries you'll do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new EntryModel();&#xA;// ... set your content&#xA;$oldId = 'number of your old WP tag id';&#xA;$tag = IdRecord::model()-&amp;gt;find('oldId = :oldId',[&#xA;    'oldId' =&amp;gt; $oldId&#xA;]);&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('yourTagFieldHandle', $tag-&amp;gt;newId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; to create your boilerplate.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Edit&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Another approach. If you receive the title of the tags as an array like &lt;code&gt;['tag1', 'tag2', 'tag3']&lt;/code&gt; would be something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ids = [];&#xA;foreach($tagTitles as $tagTitle){&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Tag);&#xA;    $criteria-&amp;gt;title = 'your Tag Title';&#xA;    $tag = $criteria-&amp;gt;first();&#xA;    if($tag){&#xA;        $ids[] = $tag-&amp;gt;id;&#xA;    }&#xA;}&#xA;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('yourFieldHandle', $ids);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-16T11:05:16.430" LastActivityDate="2018-03-16T11:05:16.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24217" PostTypeId="2" ParentId="24215" CreationDate="2018-03-15T15:16:33.657" Score="1" Body="&lt;p&gt;Of course there is, otherwise we would not be able to store categories in Craft. The controller that handles categories is called &lt;code&gt;CategoriesController&lt;/code&gt; and it contains the function &lt;code&gt;actionSaveCategory&lt;/code&gt; so you route will be &lt;code&gt;actions/categories/saveCategory&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create/save a user you have the &lt;code&gt;UsersController&lt;/code&gt;.. You may guess the function is &lt;code&gt;actionSaveUser&lt;/code&gt; =&gt; &lt;code&gt;actions/users/saveUser&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the same for every element in Craft. &lt;code&gt;EntriesController&lt;/code&gt;, &lt;code&gt;actionSaveEntry&lt;/code&gt; =&gt; &lt;code&gt;actions/entries/saveEntry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this all has nothing to do with an endpoint or an API, it's just basic Craft code&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-15T15:16:33.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24219" PostTypeId="1" CreationDate="2018-03-15T16:34:15.447" Score="1" ViewCount="320" Body="&lt;p&gt;I tried following the installation instructions here: &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/installation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/installation.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run &lt;code&gt;composer install craftcms/commerce&lt;/code&gt;, it says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Invalid argument craftcms/commerce. Use &quot;composer require craftcms/commerce&quot; instead to add packages to your composer.json.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I then ran &lt;code&gt;composer require craftcms/commerce&lt;/code&gt;, and it says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[InvalidArgumentException]   Could not find package craftcms/commerce&#xA;  at any version for your minimum-stability (alpha). Check the package&#xA;  spelling or your mini   mum-stability&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have added &lt;code&gt;&quot;craftcms/commerce&quot;:&quot;@alpha&quot;&lt;/code&gt; in the require field in &lt;code&gt;composer.json&lt;/code&gt; also changed minimum stability to alpha &lt;code&gt;(&quot;minimum-stability&quot;: &quot;alpha&quot;)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it still is not working. Any thoughts? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8126" LastEditorUserId="9" LastEditDate="2018-11-02T18:37:55.577" LastActivityDate="2018-11-02T18:37:55.577" Title="How can I install Craft Commerce 2 alpha release?" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24220" PostTypeId="2" ParentId="24219" CreationDate="2018-03-15T16:51:01.323" Score="2" Body="&lt;p&gt;You have to contact P&amp;amp;T (at support@craftcms.com) directly to get installation instructions.&lt;/p&gt;&#xA;" OwnerUserId="28" LastActivityDate="2018-03-15T16:51:01.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24221" PostTypeId="2" ParentId="24219" CreationDate="2018-03-15T16:52:14.087" Score="1" Body="&lt;p&gt;As far as I know, there are no public releases of Commerce 2 (for Craft 3) yet. According to the &lt;a href=&quot;https://craftcms.com/news/craft-3-launch-faq&quot; rel=&quot;nofollow noreferrer&quot;&gt;official launch faq&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;When will Commerce 2 be released?&lt;/strong&gt; We will release Commerce 2 Beta on April 4 alongside Craft 3 GA. If you need access to Commerce 2&#xA;  beforehand, or you are a plugin developer hoping to get started on a&#xA;  Commerce integration, get in touch for advanced access. We expect the&#xA;  beta will last about three to six months.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looks like the GitHub repo you linked to is where they're compiling the docs in preparation for April 4th. If you want access to the &lt;code&gt;alpha&lt;/code&gt; version or whatever, looks like you should contact Pixel &amp;amp; Tonic for pre-release access.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-15T16:52:14.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24222" PostTypeId="1" AcceptedAnswerId="24223" CreationDate="2018-03-15T17:46:31.910" Score="1" ViewCount="115" Body="&lt;p&gt;I'm unable to get custom fields to output using Solspace Calendar on Craft3. I am not getting any errors indicating that the field does not exist, it's just not outputting. The field is a Redactor type.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set event = craft.calendar.event(segment2, {targetDate: occurrenceDate}) %}&#xA;&#xA;{% if event %}&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-sm-12 col-md-9&quot;&amp;gt;&#xA;        &amp;lt;h2&amp;gt;{{ event.title }}&amp;lt;/h2&amp;gt; {# THIS OUTPUTS #}&#xA;        {{ event.eventDescription }} {# THIS CUSTOM FIELD DOES NOT OUTPUT AND THERE ARE NO ERRORS #}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I tried using the field handles that are in the Solspace Calendar templates (location and description), but neither of those output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event['location'] is defined %}&#xA;    &amp;lt;tr&amp;gt;&#xA;        &amp;lt;th&amp;gt;Location&amp;lt;/th&amp;gt;&#xA;        &amp;lt;td&amp;gt;&#xA;            {{ event.location }}&#xA;        &amp;lt;/td&amp;gt;&#xA;    &amp;lt;/tr&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n5unz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n5unz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2018-03-15T18:20:04.853" LastActivityDate="2018-03-15T18:52:03.290" Title="Solspace Calendar: custom fields not outputting" Tags="&lt;custom-field&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24223" PostTypeId="2" ParentId="24222" CreationDate="2018-03-15T18:52:03.290" Score="2" Body="&lt;p&gt;This is a known issue and will be resolved in Beta 4 coming out today (March 15, 2018). Sorry for the trouble.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-03-15T18:52:03.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24224" PostTypeId="1" CreationDate="2018-03-15T20:00:21.767" Score="0" ViewCount="142" Body="&lt;p&gt;I built up a form at the frontend to allow users to upload their avatars,my code looks like below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users/{{ currentUser.username }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    ...some other fields&#xA;    &amp;lt;input type=&quot;file&quot; name=&quot;photo&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;upload&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I got error 'Serialization of 'Closure' is not allowed' from '/Users/rain/dev/valet/tr3ndsideas/vendor/yiisoft/yii2-queue/src/serializers/PhpSerializer.php' . Any idea please &lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-16T03:23:14.307" Title="Serialization of 'Closure' is not allowed when upload image" Tags="&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2018-03-16T23:31:28.560" ContentLicense="CC BY-SA 3.0" />
  <row Id="24226" PostTypeId="1" CreationDate="2018-03-15T22:11:09.077" Score="1" ViewCount="47" Body="&lt;p&gt;What do I need to do in order to enable &lt;code&gt;Image Edit&lt;/code&gt; option for Assets stored in Amazon S3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TV0vc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TV0vc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7182" LastEditorUserId="57" LastEditDate="2018-03-16T19:02:41.897" LastActivityDate="2018-03-16T19:02:41.897" Title="Enabling Assets Image Edit Option for Assets in Amazon S3" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24227" PostTypeId="2" ParentId="15050" CreationDate="2018-03-15T22:13:23.017" Score="1" Body="&lt;p&gt;Maybe an edge case, but if you're using the Kint logging/dumping extension for Craft in your console command, be careful. I got the undefined index SERVER_NAME error trying to to save an entry and output success/fail:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d(craft()-&amp;gt;entries-&amp;gt;saveEntry($entryModel)); --&amp;gt; SERVER_NAME index error&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This fixed it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$save_result = craft()-&amp;gt;entries-&amp;gt;SaveEntry($entryModel);&#xA;d($save_result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that saved someone a few minutes.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastActivityDate="2018-03-15T22:13:23.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24228" PostTypeId="2" ParentId="24226" CreationDate="2018-03-15T23:03:47.350" Score="2" Body="&lt;p&gt;The issue was with Imagik configuration. GD worked fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fully remove Imagik, and reinstalled with it with default settings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;brew remove php71-imagik &amp;amp;&amp;amp; brew services restart php71 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7182" LastEditorUserId="57" LastEditDate="2018-03-16T19:02:32.190" LastActivityDate="2018-03-16T19:02:32.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24229" PostTypeId="1" AcceptedAnswerId="25267" CreationDate="2018-03-15T23:14:18.977" Score="1" ViewCount="211" Body="&lt;p&gt;I'm trying to set up shipping rates the client used prior to Craft Commerce. So for example, if the cart total dollar amount is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.01-$35.00 rate = $21&#xA;35.01- $170 rate = $39&#xA;170.01-$275 rate = $44, etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is this currently doable or will the client have to switch to a per item or weight-based shipping cost?&lt;/p&gt;&#xA;" OwnerUserId="649" LastEditorUserId="57" LastEditDate="2018-03-16T19:03:12.897" LastActivityDate="2018-03-19T20:39:18.943" Title="Can I set shipping rates based on order value?" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24230" PostTypeId="2" ParentId="24224" CreationDate="2018-03-16T03:23:14.307" Score="0" Body="&lt;p&gt;I found the problem which is because of a package called &quot;Scout&quot;. I just update it and everything seems to be fine now.&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-16T03:23:14.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24231" PostTypeId="2" ParentId="24211" CreationDate="2018-03-16T03:25:34.033" Score="1" Body="&lt;p&gt;I found the problem which is because of a plugin called &quot;Scout&quot;. I just update it and everything seems to be fine now.&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-16T03:25:34.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24232" PostTypeId="1" CreationDate="2018-03-16T13:06:10.960" Score="3" ViewCount="661" Body="&lt;p&gt;Is there a default.json file for the html purifier settings in Craft? Now we can configure this I want to extend to include the stripping on non-breaking spaces. However, I don't want to just extend my requirements and not replace the default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand I would create a new json file in &lt;code&gt;craft/config/htmlpurifier&lt;/code&gt; and this file would contain the following;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;AutoFormat.RemoveEmpty.RemoveNbsp&quot;: true,&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this all that is required?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-04-15T19:36:00.327" Title="Default settings for HTML purifier and how to extend it" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24233" PostTypeId="1" AcceptedAnswerId="28328" CreationDate="2018-03-16T13:16:54.870" Score="1" ViewCount="544" Body="&lt;p&gt;I'm using Heroku to host a Craft 3 site, and it's working fine, apart from the fact that Craft isn't able to write to the &lt;code&gt;/storage&lt;/code&gt; folder (or anywhere else, for that matter). Consequently, the Database Backup utility doesn't work and nor is Craft able to write logs. I'm keen to fix both these issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone managed to solve this problem on Heroku? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="328" LastEditDate="2018-03-16T15:16:59.313" LastActivityDate="2018-11-06T18:32:13.133" Title="Getting Craft's storage folder to work on Heroku" Tags="&lt;craft3&gt;&lt;storage&gt;&lt;heroku&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24235" PostTypeId="1" CreationDate="2018-03-16T16:14:51.523" Score="1" ViewCount="531" Body="&lt;p&gt;I've successfully joined a table to the elements table, however I can't can't seem to add a property so I can use it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the error &lt;strong&gt;Setting unknown property when trying to join table&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()&#xA;    -&amp;gt;addSelect(['craft_event_instances.instance_datetime'])&#xA;    -&amp;gt;leftJoin('craft_event_instances', '`craft_event_instances`.`entryId` = `elements`.`id`')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6424" LastActivityDate="2019-02-28T13:30:15.383" Title="Setting unknown property when trying to join table" Tags="&lt;element&gt;&lt;join&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24236" PostTypeId="2" ParentId="24235" CreationDate="2018-03-16T17:05:35.220" Score="1" Body="&lt;p&gt;You can't set a property of an &lt;code&gt;element&lt;/code&gt; in Craft that does not exists in the field layout, as a behavior or as a public/private attribute in the object. Craft/Yii2 will throw an exception because the property &lt;code&gt;instance_datetime&lt;/code&gt; probably does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to attach a custom value you have to either create a new &lt;code&gt;element&lt;/code&gt; or you have to store this information somewhere else. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Edit&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You could the following as well to fetch your values and store them into a new array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = Entry::find();&#xA;$columns = $query&#xA;    -&amp;gt;addSelect('craft_event_instances.instance_datetime')&#xA;    -&amp;gt;innerJoin('craft_event_instances', 'craft_event_instances.entryId = elements.id')&#xA;    -&amp;gt;createCommand()&#xA;    -&amp;gt;queryAll();&#xA;$yourCustomValues = [];&#xA;foreach($columns as $key =&amp;gt; $column){&#xA;    $yourCustomValues[$column['id']] = $column['instance_datetime'];&#xA;    unset($columns[$key]['instance_datetime']);&#xA;}&#xA;$elements = $query-&amp;gt;populate($columns);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-16T17:46:02.893" LastActivityDate="2018-03-16T17:46:02.893" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24237" PostTypeId="2" ParentId="24232" CreationDate="2018-03-16T19:13:49.937" Score="2" Body="&lt;p&gt;Craft won't merge your HTML Purifier config settings with the default ones, but the default ones are &lt;a href=&quot;https://github.com/craftcms/cms/blob/master-v2/src/fieldtypes/RichTextFieldType.php#L554-L560&quot; rel=&quot;nofollow noreferrer&quot;&gt;pretty simple&lt;/a&gt;, so I'd just include them with yours.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;AutoFormat.RemoveEmpty.RemoveNbsp&quot;: true,&#xA;    &quot;Attr.AllowedFrameTargets&quot;: [&quot;_blank&quot;],&#xA;    &quot;HTML.AllowedComments&quot;: [&quot;pagebreak&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-16T19:13:49.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24238" PostTypeId="2" ParentId="24233" CreationDate="2018-03-16T21:12:03.893" Score="1" Body="&lt;p&gt;Not super familiar with Heroku, but some Googling suggests and if you want to keep anything on a permanent (non-ephemeral) file system, most people use S3 for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the &lt;code&gt;CRAFT_STORAGE_PATH&lt;/code&gt; PHP constant for both Craft 2 and 3, but it's currently assuming local file-system based paths and making it cloud based would cause a big performance hit anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're probably better off solving this with plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically things like this for logs: &lt;a href=&quot;https://github.com/ostark/craft-stderr-logger&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ostark/craft-stderr-logger&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And database backup plugins that have the option to write to S3.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-16T21:12:03.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24240" PostTypeId="1" AcceptedAnswerId="24241" CreationDate="2018-03-16T22:54:49.620" Score="0" ViewCount="255" Body="&lt;p&gt;I am trying to hide our website's admin directory from public view as best as possible and have read the &lt;a href=&quot;https://craftcms.com/support/securing-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Securing Craft&lt;/a&gt; article. I am pleased at how easy it is to make a directory that isn't easy to guess using the cpTrigger setting in the config file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My next thought was to disallow the directory on the robot.txt file, keeping crawlers from indexing the login page. The obvious issue with that is that now the &quot;hidden&quot; admin directory is in public view from our robot.txt file, not exactly what I want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something in the metatags or HTML of the Craft admin pages that blocks crawlers from indexing the admin pages? I was hoping to see the following on the admin pages:&#xA;    &#xA;But they are not present. Is there a reason we would not want these by default on the Craft admin pages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise on the best practice here, perhaps I am overthinking things, or there is another way altogether to accomplish this.&lt;/p&gt;&#xA;" OwnerUserId="8137" LastActivityDate="2018-03-17T00:40:39.630" Title="Hiding Craft's admin folder from search engines" Tags="&lt;admin&gt;&lt;security&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24241" PostTypeId="2" ParentId="24240" CreationDate="2018-03-17T00:06:14.170" Score="2" Body="&lt;p&gt;So if you follow best practices, the &lt;code&gt;craft/&lt;/code&gt; directory should just never be in the public webserver root to begin with. And if it's not, search engines are never going to be able to index it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directories should look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;craft/&#xA;public/&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, they are side by site, and Craft is never in the public web server directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's admin/login pages already send the &lt;code&gt;x-robots-tag: none&lt;/code&gt; header, which tells Google et al not to index those pages. &lt;a href=&quot;https://developers.google.com/search/reference/robots_meta_tag&quot; rel=&quot;nofollow noreferrer&quot;&gt;Learn More&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wjxh2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wjxh2.png&quot; alt=&quot;Craft Admin Login page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created many Craft sites over the years, all of them still have &lt;code&gt;/admin&lt;/code&gt; as the AdminCP trigger, none of them have been indexed, and I've had zero security breaches/brute force attacks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't mean it can't/won't happen, but security through obscurity only gets you so far anyway. Put the &lt;code&gt;craft/&lt;/code&gt; directory out of the public root, follow the advice in &lt;a href=&quot;https://nystudio107.com/blog/hardening-craft-cms-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hardening Craft CMS Permissions&lt;/a&gt; and sleep well at night. &lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-17T00:40:39.630" LastActivityDate="2018-03-17T00:40:39.630" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24243" PostTypeId="1" CreationDate="2018-03-17T13:18:33.190" Score="1" ViewCount="85" Body="&lt;p&gt;I understand why it is happening, but I'd like some help figuring a way around it. I suppose its probably a plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using weight based shipping calculations and its all fine. Except when I have a product using the free shipping field. I have a min shipping charge of $15, and that still gets applied even though there is 1 product in the cart and it has free shipping checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to iterate over all cart items, and if all of them have free shipping checked, to zero out the shipping charge, or, effectively, circomvent the minimum shipping fee setting.&lt;/p&gt;&#xA;" OwnerUserId="4911" LastActivityDate="2018-03-17T13:18:33.190" Title="1 free shipping item in cart, minimum shipping fee still applied" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25243" PostTypeId="1" CreationDate="2018-03-17T13:59:24.513" Score="3" ViewCount="2581" Body="&lt;p&gt;I'm just wondering why don't you guys compile all the cpresources into 1 .js and 1 .css file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now this folder is gigantic :D &#xA;cfr: &lt;a href=&quot;https://i.imgur.com/Oksr5Kn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.imgur.com/Oksr5Kn.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2018-03-17T16:00:58.223" Title="Why is the cpresources folder so big?" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25244" PostTypeId="1" CreationDate="2018-03-17T14:41:07.800" Score="0" ViewCount="281" Body="&lt;p&gt;I'm currently trying to get all entries which belong to a section which is related to that category. e.g.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Category&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Brand&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Offer&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Offer belongs to a brand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brand has a category field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('offers').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently trying the above, but returns nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- EDIT --&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The offer entries belong to a brand, a brand section belongs to a category. I'm trying to fetch all offers of all the brands which belong to a category.&lt;/p&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2018-03-18T12:41:08.863" LastActivityDate="2018-03-18T12:41:08.863" Title="Get Entries from Section related to a category" Tags="&lt;entries&gt;&lt;categories&gt;&lt;sections&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25245" PostTypeId="2" ParentId="25243" CreationDate="2018-03-17T15:05:01.610" Score="6" Body="&lt;p&gt;Craft CMS 3 uses &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/guide-structure-assets.html&quot; rel=&quot;noreferrer&quot;&gt;Yii2 Asset Bundles&lt;/a&gt; for AdminCP resources. This lets it handle dependencies such as certain scripts not loading before jQuery, for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that many Craft CMS 3 components need to publish JS/CSS resources to work, as do third party plugins. Some system needs to manage these things, and their dependencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining it all into one isn’t practical, since different pages require different resources, and plugins may add resources in arbitrarily. If you really did combine &lt;em&gt;everything&lt;/em&gt; needed for the AdminCP backend, it’d be slow to build (and that build would have to be done dynamically as other components add/remove resources), and not very useful, especially with http/2 and multiple streams. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the way it works now is a vast improvement over Craft 2.x, where every AdminCP static resource request went through the &lt;code&gt;index.php&lt;/code&gt;, and this was slow to load, and could not be cached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just ignore the &lt;code&gt;cpresources/&lt;/code&gt; directory; consider it a cache that you don't need to worry about.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-17T16:00:58.223" LastActivityDate="2018-03-17T16:00:58.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25246" PostTypeId="1" AcceptedAnswerId="25248" CreationDate="2018-03-17T19:38:36.150" Score="1" ViewCount="685" Body="&lt;p&gt;I’m looking for a little help with Custom Mapping for the Search Plus plugin. I think(?) I'm getting pretty close, but stuck on something (and I do front end web design, so this is just over my head) I’m using &lt;a href=&quot;https://transition.topshelfcraft.com/software/craft/searchplus/usage/hooks-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://transition.topshelfcraft.com/software/craft/searchplus/usage/hooks-events&lt;/a&gt; as a reference and used &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; to create the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per the instructions in the documentation above, I’ve added this to the bottom of the plugin :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function searchPlus_addAlgoliaMapping()&#xA;{&#xA;    $ret = [];&#xA;    $ret['name'] = 'GHCC Staff Mapping2';&#xA;    $ret['handle'] = 'GHCC_Staff2';&#xA;    $ret['description'] = 'Mapping for Staff Page';&#xA;    $ret['method'] = 'example.testMapping';&#xA;    return $ret;&#xA;}&#xA;&#xA;public function testMapping(element)&#xA;{&#xA;    $ret = [];&#xA;&#xA;    $ret['objectID'] = $entry-&amp;gt;id;&#xA;    $ret['title'] = $entry-&amp;gt;title;&#xA;    $ret['activityId'] = $entry-&amp;gt;id;&#xA;    $ret['id'] = $entry-&amp;gt;id;&#xA;    $ret['slug'] = $entry-&amp;gt;slug;&#xA;    $ret['url'] = $entry-&amp;gt;url;&#xA;    $ret['uri'] = '/' . $entry-&amp;gt;uri;&#xA;&#xA;return $ret;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But am getting an error: &lt;code&gt;syntax error, unexpected ')', expecting variable (T_VARIABLE)&lt;/code&gt; referencing line 186  &lt;code&gt;public function testMapping(element)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was wondering if anyone had any tips&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!  &lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2018-03-22T21:33:20.357" LastActivityDate="2018-09-06T16:03:18.420" Title="syntax error, expecting variable (T_VARIABLE) in Search Plus Custom Mapping" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25247" PostTypeId="1" AcceptedAnswerId="25251" CreationDate="2018-03-17T21:11:08.617" Score="2" ViewCount="275" Body="&lt;p&gt;I have entries using the Smart Map address field. I need to get just the entries that have a combination of city and state (city = &amp;quot;Beverly Hills&amp;quot; AND state = &amp;quot;CA&amp;quot;). I am currently only trying to get simpler search state working and only then will I move to state/city. I can get a &amp;quot;fuzzy&amp;quot; that to my understanding will get everything that has &amp;quot;CA&amp;quot; in any of the fields using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set meetings = craft.entries.section('meetings').search('address:' ~ 'CA') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But I want to understand how to create a more specific search that specifically finds 'CA' in address.state.&lt;/p&gt;&#xA;&lt;p&gt;When I try:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set meetings = craft.entries.section('meetings').search('address.state:' ~ 'CA') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the search returns nothing. No errors either.&lt;/p&gt;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do I search specifically in a field like address.state?&lt;/li&gt;&#xA;&lt;li&gt;Extending this question, how do I search address.state AND address.city?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="45" LastEditDate="2021-01-01T07:05:01.453" LastActivityDate="2021-01-01T07:05:01.453" Title="Smart Map - How to search by a field in address?" Tags="&lt;search&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25248" PostTypeId="2" ParentId="25246" CreationDate="2018-03-17T23:35:52.597" Score="2" Body="&lt;p&gt;That is a typo in the &lt;a href=&quot;https://transition.topshelfcraft.com/software/craft/searchplus/usage/hooks-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin's documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function testMapping(element)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function testMapping($element)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;since &lt;code&gt;$element&lt;/code&gt; is a PHP variable.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-17T23:35:52.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25249" PostTypeId="1" CreationDate="2018-03-18T00:28:38.240" Score="1" ViewCount="179" Body="&lt;p&gt;I'm trying to achieve one pretty simple thing, but putting it into my dynamic nav is making it a little difficult. I want to have a little number of the total amount of entries in my channel &quot;listings&quot; and keep it on one of the links &quot;Our Properties&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QJV0Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QJV0Z.png&quot; alt=&quot;What the main Nav has to look like&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have this code that is displaying the total amount of entries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set totalListings = craft.entries.section('listings').total() %}&#xA;{{ totalListings }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I make this work: {% if link == &quot;properties&quot; single entry %} {{ totalListings}} {% endif %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set menu = craft.entries.section('navigation') %}&#xA;&amp;lt;ul&amp;gt; &#xA;    {% nav link in menu.all %}&#xA;        &amp;lt;li {% if craft.app.request.absoluteUrl == link.addentry[0].url %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;           &amp;lt;a href=&quot;{{ link.addentry[0].url }}&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6586" LastEditorUserId="6586" LastEditDate="2018-03-18T01:07:01.770" LastActivityDate="2018-03-18T02:14:54.030" Title="Dynamic Navigation with Condition to check slug" Tags="&lt;conditional&gt;&lt;navigation&gt;&lt;forloop&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25250" PostTypeId="2" ParentId="25249" CreationDate="2018-03-18T02:14:54.030" Score="1" Body="&lt;p&gt;Got it to work! I don't know why I made it so complicated in my head, but I ended up using the link id to match with the properties link.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav link in menu.all %}&#xA;    &amp;lt;li {% if craft.app.request.absoluteUrl == link.addentry[0].url %} class=&quot;active&quot;{% endif %}&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ link.addentry[0].url }}&quot;&amp;gt;{{ link.title }}{% if link.id == 15 %}&amp;lt;span class=&quot;exposant&quot;&amp;gt;{% set totalListings = craft.entries.section('listings').total() %}{{ totalListings }}&amp;lt;/span&amp;gt;{% endif %}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If someone can show me how to get it by slug that would be awesome! Thanks &amp;amp; hope this will help someone in the future.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-03-18T02:14:54.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25251" PostTypeId="2" ParentId="25247" CreationDate="2018-03-18T06:31:56.187" Score="2" Body="&lt;p&gt;It's more &amp;quot;filtering&amp;quot; than &amp;quot;searching&amp;quot;, but take a look at this...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Filtering entries by subfield value&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Set a &lt;code&gt;filter&lt;/code&gt; parameter when creating your element criteria model...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    filter: {&#xA;        city: 'Beverly Hills',&#xA;        state: 'CA'&#xA;    }&#xA;} %}&#xA;&#xA;{% set meetings = craft.entries.address(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T07:02:27.383" LastActivityDate="2021-01-01T07:02:27.383" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25252" PostTypeId="2" ParentId="22473" CreationDate="2018-03-18T21:29:30.313" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Additionally, it appears I cannot use the loop to save a variable to use outside of it&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is really a separate question. Answering it anyway: you need to give the variable some value before the loop, and then it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set img = null %} {# initial value #}&#xA;&#xA;{% for block in entry.pageContent %}&#xA;  {% if block.type == 'images' %}&#xA;    {% if not img %}&#xA;      {% set img = block.images[0] ?? null %}&#xA;    {% endif %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# img will be the first image of first 'images' block, or null #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-03-18T21:29:30.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25253" PostTypeId="1" AcceptedAnswerId="25255" CreationDate="2018-03-18T23:06:53.380" Score="1" ViewCount="2203" Body="&lt;p&gt;I am starting to play with writing a plugin in Craft 3.0. I have followed the following &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/plugin-intro.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;page&lt;/a&gt;. I used &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin Factory&lt;/a&gt; to create my plugin structure (very nice). My folder structure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/craft&#xA;/craft/vendor/recoveryfinder/nav&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I uploaded the files and folders created bt the pluginfactury to /craft/vendor/recoveryfinder/nav folder. My additions to the craft project composer.json look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;  &quot;prefer-stable&quot;: true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@composer dump-autoload -o&quot;,&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ]&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;./vendor/recoveryfinder/nav&quot;&#xA;    }&#xA;  ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I went to the terminal logged in as the user that owns the files and change location to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/craft&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I then ran:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;composer require recoveryfinder/nav&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The output I am getting is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Using version ^0.9.0 for recoveryfinder/nav&#xA;./composer.json has been updated&#xA;Loading composer repositories with package information&#xA;Updating dependencies (including require-dev)&#xA;Package operations: 1 install, 0 updates, 0 removals&#xA;&#xA;&#xA;  [RuntimeException]&#xA;  Package recoveryfinder/nav cannot install to &quot;/home/recoveryfinder/craft/vendor/recoveryfinder/nav&quot; inside its source at &quot;/home/recoveryfinder/craft/&#xA;  vendor/recoveryfinder/nav&quot;&#xA;&#xA;&#xA;require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [&amp;lt;packages&amp;gt;]...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have not modified in any way the files created by pluginfactory.io.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers as to what I did wrong?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-19T00:01:09.993" Title="Problem installing plugin via path repository" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25254" PostTypeId="2" ParentId="25253" CreationDate="2018-03-18T23:28:21.367" Score="2" Body="&lt;p&gt;The composer adds all necessary files into the vendor directory. You should never implement files there on your own so you should create a &lt;code&gt;plugins&lt;/code&gt; folder next to your vendor folder and insert the files there. Your path parameter will then be &lt;code&gt;/plugins/recoveryfinder/nav&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-18T23:28:21.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25255" PostTypeId="2" ParentId="25253" CreationDate="2018-03-19T00:01:09.993" Score="3" Body="&lt;p&gt;The article I wrote &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;So You Wanna Make a Craft 3 Plugin?&lt;/a&gt; may help you in terms of figuring out how to properly set up a &quot;host&quot; website to run your plugin development from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR your repo shouldn't point to your site's vendor directory, it should point to wherever that plugin exists on your local dev environment.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-19T00:01:09.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25256" PostTypeId="1" CreationDate="2018-03-19T01:10:18.393" Score="3" ViewCount="1193" Body="&lt;p&gt;Learning how to create plugins. I want to do a select query in an existing table in the Craft database, build navigation HTML and then return that HTML using a variable. I can see how to set up my own variable using the *Variable.php file. In the docs I don't see how querying database tables is done with any of the sections of the plugin found &lt;a href=&quot;https://github.com/craftcms/docs#plugin-development&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing that I would use a class in the Craft classes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so then...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I put my logic for querying the table in my method to return the variable value, in my primary plugin class or somewhere else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which classes would I use?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="57" LastEditDate="2018-03-19T17:52:30.747" LastActivityDate="2018-11-18T18:04:14.157" Title="Example of Craft 3.0 plugin - querying an existing table" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25258" PostTypeId="1" AcceptedAnswerId="25260" CreationDate="2018-03-19T10:33:34.950" Score="2" ViewCount="219" Body="&lt;p&gt;I would like to select just the children of any given main category (eg. Accessories, Stomps in the picture), regardless of segments in my URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to understand why the code below won't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z84Mf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z84Mf.png&quot; alt=&quot;I would like to select just the children of any given main category (eg. Accessories, Stomps&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just won't work. Why?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryGroup = craft.categories.group('productTypes').descendantOf('accessories') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for category in categoryGroup %}&#xA;        &amp;lt;li class=&quot;category&quot;&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;    &#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7667" LastEditorUserId="5557" LastEditDate="2018-03-19T11:46:22.463" LastActivityDate="2018-03-19T11:46:22.463" Title="Get category children" Tags="&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25259" PostTypeId="1" AcceptedAnswerId="25264" CreationDate="2018-03-19T10:59:42.807" Score="1" ViewCount="514" Body="&lt;p&gt;My frontend template displays the assets that have been uploaded to Craft. I could create a series of asset transforms within that template to create a range of thumbnail sizes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not too sure about the way this works but am I correct in thinking that every transform generates a new asset, to be more efficient with storage could I not reuse the transformed assets that the Control Panel creates? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I inspect the Assets panel in the backend and it has a url &lt;code&gt;http://localhost:8888/index.php?p=admin/actions/assets/generate-thumb&amp;amp;amp;uid=219035f4-92ae-41d6-ad95-0f6a4c38faa9&amp;amp;amp;width=30&amp;amp;amp;height=30&amp;amp;amp;v=1521142167&lt;/code&gt; I could pass the UID of the image to that url or may be instead match the sizes the CP creates would this reuse the same images instead of adding to my S3 storage?&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-03-19T19:19:22.867" Title="Get control panel asset thumbnails into a frontend template" Tags="&lt;control-panel&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25260" PostTypeId="2" ParentId="25258" CreationDate="2018-03-19T11:14:49.970" Score="2" Body="&lt;p&gt;Because the &lt;code&gt;descendantOf&lt;/code&gt; function expects a parameter of type &lt;code&gt;ElementInterface&lt;/code&gt; or an integer&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /**&#xA; * Sets the [[descendantOf]] property.&#xA; *&#xA; * @param int|ElementInterface|null $value The property value&#xA; *&#xA; * @return static self reference&#xA; */&#xA;public function descendantOf($value);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll have to insert the ID of your &lt;code&gt;accessories&lt;/code&gt; element or the element itself&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% accessories = craft.categories.title('accessories').first() %}&#xA;{% set categoryGroup = craft.categories.group('productTypes').descendantOf(accessories) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-19T11:14:49.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25261" PostTypeId="2" ParentId="23502" CreationDate="2018-03-19T15:39:29.287" Score="1" Body="&lt;p&gt;For future reference, this was fixed in &lt;a href=&quot;https://github.com/craftcms/cms/commit/a3cc52f0f13b3bd7288e599571adf5da0d70cc69&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.0-RC15&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Added the “Propagate entries across all enabled sites?” section setting. If disabled, entries will only be associated with the site they were created on.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7867" LastActivityDate="2018-03-19T15:39:29.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25262" PostTypeId="2" ParentId="25256" CreationDate="2018-03-19T18:03:19.607" Score="3" Body="&lt;p&gt;A great place to start with this is over on &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Select &quot;Craft CMS Plugin Version 3.x&quot; and check any plugin components you'd like to include, and it will build out the plugin scaffolding for you with ample comments and some examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For accessing database content, Craft heavily relies on the framework it uses, Yii 2.  The &quot;Working with Databases&quot; docs are a good place to start: &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/start-databases#working-with-databases&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/guide/2.0/en/start-databases#working-with-databases&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will go over how to retrieve data using Active Record (Craft's &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/records&quot; rel=&quot;nofollow noreferrer&quot;&gt;AR classes&lt;/a&gt;) and Query Builder for direct database access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do that data access from your plugin's Variable class, but a more common pattern is for the Variable class to have a wrapper method that calls a &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/services.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Service class&lt;/a&gt; method that returns the value to the Variable, then back to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see Craft's Service classes here: &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/services&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/tree/develop/src/services&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in case it's not obvious yet, the Craft source code itself is a great place to look for examples of how to do things in your plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="132" LastEditDate="2018-11-18T18:04:14.157" LastActivityDate="2018-11-18T18:04:14.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25263" PostTypeId="1" AcceptedAnswerId="25265" CreationDate="2018-03-19T18:41:57.857" Score="1" ViewCount="48" Body="&lt;p&gt;I created my own class file that I include in one of my Craft Services files. Is there any way I can access the craft instance inside of this file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, inside my Craft service I create a new instance of my class like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$wally = new Wally();&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside of the actual Wally class file, I'd like to be able to create a variable in my constructor that gives me access to stuff like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For further clarification:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Wally {&#xA;   function __construct($craftInstance) {&#xA;      $this-&amp;gt;craft = $craftInstance;&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it sounds like I don't know what I'm doing, I probably don't. Any help would be appreciated. Using Craft 2.6 btw.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-03-19T19:59:06.440" Title="Pass Craft Instance to A Vendor PHP File" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25264" PostTypeId="2" ParentId="25259" CreationDate="2018-03-19T19:19:22.867" Score="2" Body="&lt;p&gt;There's actually a really easy way to achieve this (Craft 3 only).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply do this in your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ image.thumbUrl(int) }}&quot;&amp;gt;&#xA;&#xA;{# int is a number that represents the width/height #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The asset thumbnails are stored in &lt;code&gt;/storage/runtime/assets/thumbs/&lt;/code&gt;, so no, they won't be taking up space in your S3 bucket (whereas some local testing inclines me to think that images generated via transforms are stored in your Asset Volume, wherever it's located).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-19T19:19:22.867" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25265" PostTypeId="2" ParentId="25263" CreationDate="2018-03-19T19:53:49.257" Score="2" Body="&lt;p&gt;You don't need to pass anything in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function &lt;code&gt;craft()&lt;/code&gt; is just a public function that returns the static app. It does not matter if you call it inside a plugin or somewhere else. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft; //&amp;lt;----- added namespace&#xA;class Wally {&#xA;   function __construct() {&#xA;      $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't want to be in the same namespace you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Wally {&#xA;   function __construct() {&#xA;      $criteria = \Craft\craft()-&amp;gt;elements-&amp;gt;getCriteria(\Craft\ElementType::Entry);&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really want to save the app in an extra variable for whatever reasons you would do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new Wally(craft());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-19T19:59:06.440" LastActivityDate="2018-03-19T19:59:06.440" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="25266" PostTypeId="1" AcceptedAnswerId="25330" CreationDate="2018-03-19T20:03:29.837" Score="1" ViewCount="108" Body="&lt;p&gt;When I upload an 8-bit transparent png, it gets distorted. Is there any way to fix that?&lt;/p&gt;&#xA;" OwnerUserId="7931" LastActivityDate="2018-03-23T08:53:32.477" Title="8-bit png's get distorted when you upload them" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25267" PostTypeId="2" ParentId="24229" CreationDate="2018-03-19T20:39:18.943" Score="1" Body="&lt;p&gt;Within Commerce Settings -&gt; Shipping Methods you can set within the rules of that method, the 'Minimum Order Total Price' and the 'Maximum Order Total Price' and an associated shipping cost, so yes, it is possible to recreate your clients existing setup.&lt;/p&gt;&#xA;" OwnerUserId="7213" LastActivityDate="2018-03-19T20:39:18.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25268" PostTypeId="1" AcceptedAnswerId="25271" CreationDate="2018-03-19T21:40:57.010" Score="2" ViewCount="282" Body="&lt;p&gt;Is it possible to set up and manage stock in Craft Commerce even if a product stock goes into the negative? The current commerce project I'm working on is open to the public so anyone can add items to a cart but only registered and approved members will have the ability to submit carts as orders. What I would like to be able to do is keep out of stock products available in the store so that they can be added to carts and orders. The orders are manually processed so an out of stock item just means that further production is needed. Tracking negative stock would also help guide production because it would give insight into how many of a given product is needed at any given moment in time.&lt;/p&gt;&#xA;" OwnerUserId="561" LastActivityDate="2018-03-19T23:55:21.030" Title="Craft Commerce Negative Stock" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;&lt;stock&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25269" PostTypeId="2" ParentId="2028" CreationDate="2018-03-19T22:29:59.213" Score="1" Body="&lt;p&gt;It's 2018, and as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2028/how-do-i-set-up-craft-to-send-emails-from-my-local-mamp-virtual-host-x-dev-envir#comment29567_2031&quot;&gt;Masiorama&lt;/a&gt; mentioned, MandrillApp is no longer available for free. As a Windows user, the general &quot;Get PHP Mail to work on localhost&quot; solution detailed &lt;a href=&quot;https://stackoverflow.com/a/33333766/999556&quot;&gt;here&lt;/a&gt; worked for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: It requires a Gmail address, and that you paste your Gmail password into the &lt;code&gt;php.ini&lt;/code&gt; file of your localhost server. Basically, you need to configure &lt;code&gt;sendmail&lt;/code&gt; on localhost to use your Gmail account's SMTP service.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-03-19T22:29:59.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25270" PostTypeId="1" AcceptedAnswerId="25274" CreationDate="2018-03-19T22:31:50.430" Score="2" ViewCount="182" Body="&lt;p&gt;Using the following filter will return all the entries for 'CA'. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    filter: {&#xA;        state: 'CA'&#xA;    }&#xA;} %}&#xA;&#xA;{% set meetings = craft.entries.address(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say that I get 10 returns for 'CA':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Los Angeles&#xA;Los Angeles&#xA;Los Angeles&#xA;San Diego&#xA;San Diego&#xA;San Diego&#xA;San Diego&#xA;San Diego&#xA;San Diego&#xA;Modesto&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I go about one getting 3 results returned for each unique value for City? I only want to list each city once rather than 3 Los Angeles, 16 San Diego's and 1 Modesto. Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Los Angeles&#xA;San Diego&#xA;Modesto&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It could also be helpful to have them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3 Los Angeles&#xA;6 San Diego&#xA;1 Modesto&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am building a navigation by state with a list of cities under each state. To look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CA&#xA;   Los Angeles&#xA;   San Diego&#xA;   Modesto&#xA;KS&#xA;   Wichita&#xA;   Kansas City&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="45" LastEditDate="2021-01-01T07:02:58.670" LastActivityDate="2021-01-01T07:03:45.510" Title="Getting unique values from Smart Map addresses" Tags="&lt;craft3&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25271" PostTypeId="2" ParentId="25268" CreationDate="2018-03-19T23:55:21.030" Score="1" Body="&lt;p&gt;Commerce does not have a back-ordering (negative stock) counter at the moment. To allow ordering of more items that you have on hand, you would need to either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) enable the 'unlimited stock' option on the variant which would not track the stock and allow orders of an unlimited number of variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Choose an arbitrarily high stock count to allow ordering above what you have on hand. For example, if you have 32 items on hand, make the stock value 2032, allowing for the stock to drop below 2000 would let you know the number of back-orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either of these might not be ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third option could be using option 1 with a plugin that listens to the &lt;code&gt;onOrderVariant&lt;/code&gt; event and updating your own stock counter within your own database tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We hope to have features like back-ordering in future versions of Craft Commerce, and you can vote for such features here: &lt;a href=&quot;https://craftcms.uservoice.com/forums/295386-commerce/suggestions/7817436-pos-and-inventory-management&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.uservoice.com/forums/295386-commerce/suggestions/7817436-pos-and-inventory-management&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-19T23:55:21.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25272" PostTypeId="1" AcceptedAnswerId="25758" CreationDate="2018-03-20T00:26:38.833" Score="1" ViewCount="406" Body="&lt;p&gt;PHP 7.0.28 / MySQL 5.6.38 / Craft Pro 3.0.0-RC13&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While trying to update I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: An error occurred&#xA;&#xA;Output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- The requested package codeception/codeception could not be found in any version, there may be a typo in the package name.&#xA;Problem 2&#xA;- The requested package codeception/mockery-module could not be found in any version, there may be a typo in the package name.&#xA;Problem 3&#xA;- The requested package codeception/specify could not be found in any version, there may be a typo in the package name.&#xA;Problem 4&#xA;- The requested package codeception/verify could not be found in any version, there may be a typo in the package name.&#xA;&#xA;Potential causes:&#xA;- A typo in the package name&#xA;- The package is not available in a stable-enough version according to your minimum-stability setting&#xA;see for more details.&#xA;- It's a private package and you forgot to add a custom repository to find it&#xA;&#xA;Read for further common problems.&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My composer.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/cms&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;  &quot;version&quot;: &quot;3.0.0-RC13&quot;,&#xA;  &quot;keywords&quot;: [&#xA;    &quot;cms&quot;,&#xA;    &quot;craftcms&quot;,&#xA;    &quot;yii2&quot;&#xA;  ],&#xA;  &quot;homepage&quot;: &quot;https://craftcms.com&quot;,&#xA;  &quot;license&quot;: &quot;proprietary&quot;,&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;    &quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues?state=open&quot;,&#xA;    &quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;    &quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;    &quot;docs&quot;: &quot;https://github.com/craftcms/docs&quot;,&#xA;    &quot;rss&quot;: &quot;https://github.com/craftcms/cms/releases.atom&quot;&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;php&quot;: &quot;&amp;gt;=7.0.0&quot;,&#xA;    &quot;ext-curl&quot;: &quot;*&quot;,&#xA;    &quot;ext-dom&quot;: &quot;*&quot;,&#xA;    &quot;ext-json&quot;: &quot;*&quot;,&#xA;    &quot;ext-mbstring&quot;: &quot;*&quot;,&#xA;    &quot;ext-openssl&quot;: &quot;*&quot;,&#xA;    &quot;ext-pcre&quot;: &quot;*&quot;,&#xA;    &quot;ext-pdo&quot;: &quot;*&quot;,&#xA;    &quot;ext-zip&quot;: &quot;*&quot;,&#xA;    &quot;composer/composer&quot;: &quot;~1.5.2&quot;,&#xA;    &quot;craftcms/oauth2-craftid&quot;: &quot;~1.0.0&quot;,&#xA;    &quot;craftcms/plugin-installer&quot;: &quot;~1.5.0&quot;,&#xA;    &quot;craftcms/server-check&quot;: &quot;~1.1.0&quot;,&#xA;    &quot;creocoder/yii2-nested-sets&quot;: &quot;~0.9.0&quot;,&#xA;    &quot;danielstjules/stringy&quot;: &quot;~3.1.0&quot;,&#xA;    &quot;elvanto/litemoji&quot;: &quot;^1.3.1&quot;,&#xA;    &quot;enshrined/svg-sanitize&quot;: &quot;~0.8.2&quot;,&#xA;    &quot;guzzlehttp/guzzle&quot;: &quot;~6.3.0&quot;,&#xA;    &quot;league/flysystem&quot;: &quot;~1.0.35&quot;,&#xA;    &quot;league/oauth2-client&quot;: &quot;~2.2.1&quot;,&#xA;    &quot;mikehaertl/php-shellcommand&quot;: &quot;~1.2.5&quot;,&#xA;    &quot;pixelandtonic/imagine&quot;: &quot;~0.7.1.2&quot;,&#xA;    &quot;seld/cli-prompt&quot;: &quot;~1.0.3&quot;,&#xA;    &quot;twig/twig&quot;: &quot;~2.4.4&quot;,&#xA;    &quot;yiisoft/yii2&quot;: &quot;~2.0.14.2&quot;,&#xA;    &quot;yiisoft/yii2-debug&quot;: &quot;~2.0.10&quot;,&#xA;    &quot;yiisoft/yii2-swiftmailer&quot;: &quot;~2.1.0&quot;,&#xA;    &quot;yiisoft/yii2-queue&quot;: &quot;~2.0.1&quot;,&#xA;    &quot;zendframework/zend-feed&quot;: &quot;~2.8.0&quot;,&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.0-RC15&quot;,&#xA;    &quot;bugsnag/bugsnag&quot;: &quot;v3.9.0&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;1.0.1&quot;,&#xA;    &quot;dolphiq/redirect&quot;: &quot;1.0.15&quot;,&#xA;    &quot;nystudio107/craft-cookies&quot;: &quot;1.1.9&quot;,&#xA;    &quot;superbig/craft3-bugsnag&quot;: &quot;2.0.0&quot;,&#xA;    &quot;superbig/craft3-templateselect&quot;: &quot;2.0.0&quot;,&#xA;    &quot;topshelfcraft/supersort&quot;: &quot;3.0.1&quot;&#xA;  },&#xA;  &quot;require-dev&quot;: {&#xA;    &quot;codeception/codeception&quot;: &quot;~2.3.3&quot;,&#xA;    &quot;codeception/mockery-module&quot;: &quot;~0.2.2&quot;,&#xA;    &quot;codeception/specify&quot;: &quot;~0.4.6&quot;,&#xA;    &quot;codeception/verify&quot;: &quot;~0.3.3&quot;&#xA;  },&#xA;  &quot;provide&quot;: {&#xA;    &quot;bower-asset/bootstrap&quot;: &quot;3.3.* | 3.2.* | 3.1.*&quot;,&#xA;    &quot;bower-asset/jquery&quot;: &quot;3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable&quot;,&#xA;    &quot;bower-asset/inputmask&quot;: &quot;~3.2.2 | ~3.3.5&quot;,&#xA;    &quot;bower-asset/punycode&quot;: &quot;1.3.*&quot;,&#xA;    &quot;bower-asset/yii2-pjax&quot;: &quot;~2.0.1&quot;&#xA;  },&#xA;  &quot;suggest&quot;: {&#xA;    &quot;ext-imagick&quot;: &quot;Adds support for more image processing formats and options.&quot;,&#xA;    &quot;ext-iconv&quot;: &quot;Adds support for more character encodings than PHP’s built-in mb_convert_encoding() function, which Craft will take advantage of when converting strings to UTF-8.&quot;,&#xA;    &quot;ext-intl&quot;: &quot;Adds rich internationalization support.&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;craft\\&quot;: &quot;src/&quot;&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="57" LastEditDate="2018-04-19T21:32:27.137" LastActivityDate="2018-04-19T21:32:51.603" Title="Composer Error Updating Craft CMS 3 from RC13 to 14/15" Tags="&lt;php&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25273" PostTypeId="1" CreationDate="2018-03-20T01:10:23.923" Score="1" ViewCount="1467" Body="&lt;p&gt;I built up a plugin and inside the plugin I created the relation between Entry and Section using ActiveRecord, like below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In SectionRecord :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SectionRecord extends ActiveRecord&#xA;{&#xA;    public static function tableName()&#xA;    {&#xA;        return '{{sections}}';&#xA;    }&#xA;&#xA;    public function getEntries()&#xA;    {&#xA;        return $this-&amp;gt;hasMany(EntryRecord::className(),['id' =&amp;gt; 'sectionId']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In EntryRecord file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class EntryRecord extends ActiveRecord&#xA;{&#xA;    public static function tableName()&#xA;    {&#xA;        return '{{entries}}';&#xA;    }&#xA;&#xA;    public function getSection()&#xA;    {&#xA;        return $this-&amp;gt;hasOne(SectionRecord::className(),['sectionId' =&amp;gt; 'id']);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At last in controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$hub = SectionRecord::findOne(['handle'=&amp;gt;'hub']);&#xA;dd($hub-&amp;gt;entries);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to get section which is working, but when I wanna fetch entries under that section, showed me an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unknown Property – yii\base\UnknownPropertyException&#xA;Getting unknown property: raintestplugin\test\records\SectionRecord::sectionId&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-20T05:53:27.320" Title="Relational query get error &quot;Getting unknown property&quot;" Tags="&lt;relations&gt;&lt;database&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25274" PostTypeId="2" ParentId="25270" CreationDate="2018-03-20T04:43:08.033" Score="3" Body="&lt;p&gt;You'd actually need to retrieve all of the entries to count them in this way. Once you've got the complete collection, it would simply be a matter of looping through them and adding everything up.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1. Get all entries in California.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {&#xA;    filter: {&#xA;        state: 'CA'&#xA;    }&#xA;} %}&#xA;&#xA;{% set meetings = craft.entries.address(params).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Loop through those entries. Build a new array based on the results.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set stateMeetings = {} %}&#xA;    &#xA;{% for meeting in meetings %}&#xA;&#xA;    {% set city = meeting.address.city %}&#xA;&#xA;    {% if stateMeetings[city] is defined %}&#xA;        {% set cityTotal = stateMeetings[city] + 1 %}&#xA;    {% else %}&#xA;        {% set cityTotal = 1 %}&#xA;    {% endif %}&#xA;&#xA;    {% set stateMeetings = stateMeetings|merge{(city):cityTotal} %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. By the time that's all done, you'll have a neat associative array, where each key is a different city, and the value of each represents how many times it was found.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &amp;quot;Los Angeles&amp;quot;: 3,&#xA;    &amp;quot;San Diego&amp;quot;: 6,&#xA;    &amp;quot;Modesto&amp;quot;: 1,&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You'll definitely want to cache all of that... it'll be a pretty expensive process.&lt;/p&gt;&#xA;&lt;p&gt;To be honest, I'd actually recommend doing all of this work in a plugin (or module). It's a fairly easy thing to achieve with a &lt;strong&gt;template hook&lt;/strong&gt;. This kind of heavy merging is ill-fitted for Twig, but much simpler in PHP.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T07:03:45.510" LastActivityDate="2021-01-01T07:03:45.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25275" PostTypeId="2" ParentId="25273" CreationDate="2018-03-20T05:53:27.320" Score="1" Body="&lt;p&gt;Because the property &lt;code&gt;sectionId&lt;/code&gt; does not exist in the sections table. All models in Craft have the property &lt;code&gt;id&lt;/code&gt; as their primary key not - for example - &lt;code&gt;sectionId&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-20T05:53:27.320" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25276" PostTypeId="1" AcceptedAnswerId="25277" CreationDate="2018-03-20T10:58:41.870" Score="1" ViewCount="186" Body="&lt;p&gt;I am using CraftCMS 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beside the admins, I have 2 user groups: Employees and Editors. As admin I can activate pending Editor accounts by clicking on 'Activate account' in the corresponding user account. However, this button is not available for non-admins (Employees), even if the non-admin has all permissions of the user module. I understand that there is no way to make this button available for non-admins in control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Is there a way to make this action ('Activate account') available for Employees through a frontend form? Ultimately I want Employees to be able to activate pending Editors manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I want to do the same as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23544/prevent-activation-email-on-creation-wait-for-admin-approval&quot;&gt;Jeremy A&lt;/a&gt; but with non-admins.&lt;/p&gt;&#xA;" OwnerUserId="5851" LastActivityDate="2018-03-21T15:12:14.893" Title="Manual user activation for non-admins" Tags="&lt;users&gt;&lt;admin&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25277" PostTypeId="2" ParentId="25276" CreationDate="2018-03-20T11:20:19.707" Score="2" Body="&lt;p&gt;Generally best practice is to look into the source code and see what happens in the function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Manually activates a user account.  Only admins have access.&#xA; *&#xA; * @return null&#xA; */&#xA;public function actionActivateUser()&#xA;{&#xA;    $this-&amp;gt;requireAdmin();&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $userId = craft()-&amp;gt;request-&amp;gt;getRequiredPost('userId');&#xA;    $user = craft()-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;&#xA;    if (!$user)&#xA;    {&#xA;        $this-&amp;gt;_noUserExists($userId);&#xA;    }&#xA;&#xA;    if (craft()-&amp;gt;users-&amp;gt;activateUser($user))&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setNotice(Craft::t('Successfully activated the user.'));&#xA;    }&#xA;    else&#xA;    {&#xA;        craft()-&amp;gt;userSession-&amp;gt;setError(Craft::t('There was a problem activating the user.'));&#xA;    }&#xA;&#xA;    $this-&amp;gt;redirectToPostedUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important part is &lt;code&gt;$this-&amp;gt;requireAdmin();&lt;/code&gt;. Copy the function into a custom controller and remove that line and you are generally done. You can even hook into the CP template and include this the button on your own.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I wrote a plugin that uses above method. It is accessed via a controller. I just changed the line that requires the user to be an admin. Then I just put a button somewhere in the CP that uses this controller action.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- $this-&amp;gt;requireAdmin();&#xA;&#xA;+ if (!craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;can('accessPlugin-MyNewPlugin')) {&#xA;+    throw new HttpException(403, Craft::t(&quot;You don’t have the required permissions for this operation.&quot;));&#xA;+ }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5851" LastEditDate="2018-03-21T15:12:14.893" LastActivityDate="2018-03-21T15:12:14.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25278" PostTypeId="1" AcceptedAnswerId="25279" CreationDate="2018-03-20T14:16:33.900" Score="1" ViewCount="612" Body="&lt;p&gt;This is a really basic question but I have had trouble finding an answer, or documentation on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to place a test order with a default Craft Commerce installation? I'm unable to get past the payment page while using the default 'dummy' payment method. I would like to test the order process, including confirmation page, email confirmation, order history, etc.&lt;/p&gt;&#xA;" OwnerUserId="5357" LastActivityDate="2018-03-20T14:44:28.653" Title="Placing a Test Order (Craft Commerce)" Tags="&lt;plugin-craftcommerce&gt;&lt;ordering&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25279" PostTypeId="2" ParentId="25278" CreationDate="2018-03-20T14:44:28.653" Score="2" Body="&lt;p&gt;If you are using the example templates, the dummy gateway should be enough to submit an order. Are you displaying any error flash message from the payment controller?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;flash&quot;&amp;gt;{{ craft.session.getFlash('notice') }}&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;flash&quot;&amp;gt;{{ craft.session.getFlash('error') }}&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The dummy gateway also expects a credit card that ends in an even number in order return a success:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/payment-gateways#dummy-gateway&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/payment-gateways#dummy-gateway&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-20T14:44:28.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25280" PostTypeId="1" AcceptedAnswerId="25284" CreationDate="2018-03-20T15:43:11.137" Score="2" ViewCount="1897" Body="&lt;p&gt;We have set up a Craft 3 installation with composer to serve as boilerplate for a number of upcoming projects. The installation sits in a private git repository and the plan is to clone it when we start a new project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works fine, but since new projects will spawn from the boilerplate, the Security Key is the same for all of them - which probably is a bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to assign a new security key when we clone the boilerplate for a new project? Are there other security considerations to take into account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8146" LastActivityDate="2018-03-20T21:30:20.777" Title="Security Key and Boilerplate" Tags="&lt;craft3&gt;&lt;security&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25281" PostTypeId="1" CreationDate="2018-03-20T19:58:38.760" Score="1" ViewCount="714" Body="&lt;p&gt;Is there a social sharing plugin ready for Craft 3? There is no listing in the new plugin store nor do the V2 offer a revision.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2018-04-08T21:36:47.570" Title="Social sharing plugin for Craft 3" Tags="&lt;plugin-social-login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25283" PostTypeId="1" AcceptedAnswerId="25292" CreationDate="2018-03-20T21:26:44.937" Score="1" ViewCount="311" Body="&lt;p&gt;I'm working on project where I would like to directly embed PDFs onto web pages. We'll be using Google's PDF viewer as the embed tool and implementing via a macro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the macro as it stands now: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro pdfEmbed(pdfLink, width=&quot;580&quot;, height=&quot;480&quot;) %}&#xA;&#xA;    &amp;lt;iframe src=&quot;https://drive.google.com/viewerng/viewer?embedded=true&amp;amp;url={{ pdfLink }}&quot; width=&quot;{{width}}px&quot; height=&quot;{{height}}px&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For SEO purposes, I'd like to set a rel=&quot;canonical&quot; on the PDF to point to the entry on which the PDF is embedded so Google knows to index the parent page and not the PDF. From what I've read, the general best practice for how to do this with embedded PDFs is via HTTP headers. See here for more detail: &lt;a href=&quot;https://moz.com/blog/how-to-advanced-relcanonical-http-headers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://moz.com/blog/how-to-advanced-relcanonical-http-headers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling with how to implement it in practice. I think the best method would be to use &lt;code&gt;{% header %}&lt;/code&gt; tag within the macro but I'm not sure if there's a way to target that at just PDF files? If that doesn't work, .htaccess could be an option but then I lose the ability to dynamically set the canonical on the PDF based on the URL of the entry that houses the PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to do this in Craft? I’m running a Craft 3 site FYI. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2018-03-21T03:02:48.543" LastActivityDate="2018-03-21T18:38:48.237" Title="How Do I Add a rel=&quot;canonical&quot; HTTP Header to Embedded PDF Files?" Tags="&lt;entry&gt;&lt;macro&gt;&lt;seo&gt;&lt;pdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25284" PostTypeId="2" ParentId="25280" CreationDate="2018-03-20T21:30:20.777" Score="5" Body="&lt;p&gt;You can run the &lt;code&gt;craft setup/security-key&lt;/code&gt; console command after cloning the repo.  That'll generate a security key for that Craft install and put it in the local &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or for that matter, &lt;code&gt;craft setup&lt;/code&gt; will run the whole setup process (database credeitials, security key, etc.).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there other security considerations to take into account?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Keep your &lt;code&gt;craft/config/license.key&lt;/code&gt; out of the repo so that a new one is generated for each cloned site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-20T21:30:20.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25286" PostTypeId="2" ParentId="25281" CreationDate="2018-03-20T21:54:20.283" Score="1" Body="&lt;p&gt;Here are the social media plugins I see on &lt;a href=&quot;https://plugins.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.craftcms.com&lt;/a&gt; (which is the public version of the plugin store).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sharing related:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/boscho87/facebook-connector&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boscho87/facebook-connector&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Rias500/craft-notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft-notifications&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Rias500/craft-telegram-notification-channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft-telegram-notification-channel&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Integrations that don't appear to deal with sharing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/bymayo/craft-dribbble&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bymayo/craft-dribbble&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/dukt/facebook&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/facebook&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/dukt/social&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/social&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/dukt/social-github&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/social-github&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/dukt/social-linkedin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/social-linkedin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/dukt/twitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dukt/twitter&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-20T21:54:20.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25287" PostTypeId="1" CreationDate="2018-03-20T23:22:00.460" Score="0" ViewCount="108" Body="&lt;p&gt;I think my question is simple but may fall outside of the scope of this forum. What is best practices when writing and debugging Craft plugins? Obviously, one way to do so is to create a account on a server, write the code, upload and install it and then trigger the code using twig in a web page. Uggg...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good (hopefully free, open source) way to write and debug plug in code for Craft, perhaps locally?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-20T23:27:14.447" Title="Writing and debugging Craft plugins" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25288" PostTypeId="2" ParentId="25287" CreationDate="2018-03-20T23:27:14.447" Score="1" Body="&lt;p&gt;I'm not really sure what this has to do with Craft because it's the same process with every single PHP file... You download xampp/wampp/lampp or whatever you want, install it, open it, activate your apache and MySQL, copy your project into your &lt;code&gt;htdocs&lt;/code&gt; folder, create your database at &lt;code&gt;localhost/phpmyadmin&lt;/code&gt; and start to create your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway when you use a good IDE it makes absolutely no difference whether you create it locally or not since a good IDE will upload/download/compare your files on the server automatically. You don't have to upload all your files with programs like Filezilla or something like that &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-20T23:27:14.447" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25289" PostTypeId="2" ParentId="22660" CreationDate="2018-03-21T07:58:02.920" Score="2" Body="&lt;p&gt;For anyone from the future, this worked for me utilizing Ubuntu 16.0.4 with PHP7.2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo phpenmod pdo_mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it says it cant find the package, install this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php7.2-mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Check your active php.ini file for this line(&lt;em&gt;my active .ini was located n /etc/php/7.2/apache2/php.ini&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;extension=pdo_mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it has a semicolon before it, remove it, and then save. For good measure, run this again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo phpenmod pdo_mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Restart apache. Good day.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-03-21T07:58:02.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25290" PostTypeId="2" ParentId="23397" CreationDate="2018-03-21T08:06:37.170" Score="3" Body="&lt;p&gt;This looks like a well visited question, its easy as something like this with apache2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;        ServerAdmin webmaster@localhost&#xA;        DocumentRoot /var/www/html/web/&#xA;&#xA;        &amp;lt;Directory /var/www/html/web/&amp;gt;&#xA;           Options FollowSymLinks&#xA;           AllowOverride None&#xA;           Require all granted&#xA;        &amp;lt;/Directory&amp;gt;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just a sample vhost file, but the real important part here is that you have the &lt;strong&gt;web&lt;/strong&gt; folder set as your document root. This of course wont help anyone not using apache.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-03-21T08:06:37.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25292" PostTypeId="2" ParentId="25283" CreationDate="2018-03-21T15:00:16.667" Score="2" Body="&lt;p&gt;So the problem you're running into is all about context. Twig operates in the context of the http request for the parent page; so any headers you add via Twig will be added to the page http header, which is not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could be done server-side, as the article you reference mentions. But it becomes a bit more involved when we're dealing with dynamic content, which presumably we are if a CMS is in the mix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because what you need is something that will intercept the http requests for documents you want to affect the header of, and then set it based on the dynamic page where it's coming from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could accomplish this via a plugin by writing a controller that sets the headers and then returns the actual file. Then in your Twig code, you'd link to the controller not the PDF file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; for Craft CMS 3, you can use the built in &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&quot; rel=&quot;nofollow noreferrer&quot;&gt;seomatic.helper.seoFileLink()&lt;/a&gt; function to do all of this for you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-21T18:38:48.237" LastActivityDate="2018-03-21T18:38:48.237" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25293" PostTypeId="1" AcceptedAnswerId="25304" CreationDate="2018-03-21T15:21:15.420" Score="1" ViewCount="33" Body="&lt;p&gt;I have a site with multiple locales.  I have some entries that will have some basic fields such as title, description, etc and also an asset field.  The asset field is translatable so I could have an English PDF and a French PDF for the entry.  We often copy over entries and I have noticed when we do it will copy over the English asset but not the French asset.  Often times some admins are not aware they have to go back and re-add the French asset which is causing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if this is by design, a bug or ideally is there any setting or workaround I could do to fix the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing this in the admin panel when editing an entry and clicking on the arrow on save and selecting save as new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6703" LastActivityDate="2018-03-21T20:27:54.590" Title="Not all assets copied over when copying an entry from admin panel" Tags="&lt;assets&gt;&lt;localization&gt;&lt;admin&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25294" PostTypeId="1" CreationDate="2018-03-21T15:58:33.280" Score="1" ViewCount="102" Body="&lt;p&gt;I hadn't seen this asked, so I thought I'd broach the subject.&lt;br&gt;&#xA;I would like to copy fields into a new field group, and then add/delete a few of those fields from the new group, to save time of building one again from scratch.&#xA;Does Craft have a way to do this?&lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="5557" LastEditDate="2018-08-20T21:49:06.993" LastActivityDate="2018-08-20T21:49:06.993" Title="Populate Field Group With Fields From Another Field Group" Tags="&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25295" PostTypeId="1" AcceptedAnswerId="25296" CreationDate="2018-03-21T16:04:38.413" Score="1" ViewCount="397" Body="&lt;p&gt;How can I compare the results of currentUser and entry.author on an entry page?&#xA;I've tried the following, but none of these get a positive result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if  currentUser == 'entry.author.id' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set author %}{{ entry.author.id }}{% endset %}&#xA;{{ author }}&#xA;{% if currentUser.id == '{{ author }}' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I'm aiming to provide a way for the author of an entry to be presented with a form to edit the entry)&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2018-03-21T16:55:15.803" Title="How to compare currentUser with entry.author?" Tags="&lt;author&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25296" PostTypeId="2" ParentId="25295" CreationDate="2018-03-21T16:17:29.683" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.id == entry.author.id %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When using quotation marks, it means that it's a string in Twig. What you want to do is compare the value of the actual variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;code&gt;currentUser&lt;/code&gt; is a UserModel, so you need to get the id property to compare it with &lt;code&gt;entry.author.id&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2018-03-21T16:55:15.803" LastActivityDate="2018-03-21T16:55:15.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25297" PostTypeId="2" ParentId="25294" CreationDate="2018-03-21T16:22:38.960" Score="2" Body="&lt;p&gt;No, there's nothing built into Craft that lets you do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note though, that you can reuse fields across sections in Craft. Field groups is just an organizational layer on top of fields to make it easier to add a group of fields to a section, and to be able to find fields more easily. It doesn't give any additional meaning to the fields. So you can't have a field with the same handle in different field groups, and it doesn't make sense to duplicate a field that's actually used across sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to duplicate fields (because they're actually suppose to be different fields), I highly recommend the Field Manager plugin by Verbb (&lt;a href=&quot;https://github.com/verbb/field-manager/tree/craft-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2&lt;/a&gt; and &lt;a href=&quot;https://github.com/verbb/field-manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3&lt;/a&gt; versions available) which makes it super easy do to this, and in general provides a much better interface to manage fields.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-03-21T16:22:38.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25298" PostTypeId="1" CreationDate="2018-03-21T17:12:08.900" Score="1" ViewCount="637" Body="&lt;p&gt;I am trying to make a grid of blocks using Twig. I have different types of blocks so I am using a conditional to test the block type and render different components per block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am having is I want to batch my blocks (columns) in twos so that I can have two blocks per row, so I can do &lt;code&gt;{% for row in entry.curatedContentBlocks|batch(2) if row.type == 'halfWidthBlock' %}&lt;/code&gt;, add a row and then nest &lt;code&gt;{% for block in row %}&lt;/code&gt; and add my block styles. This should work but when I try to test the block type with &lt;code&gt;row.type&lt;/code&gt;, I get an error saying &lt;code&gt;Key &quot;type&quot; for array with keys &quot;0, 1&quot; does not exist.&lt;/code&gt;. I'm thinking this is something to do with the &lt;code&gt;batch&lt;/code&gt; filter returning an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the following code is the closest I've gotten, but I am still getting an error saying &lt;code&gt;Key &quot;1&quot; for array with keys &quot;2, 3&quot; does not exist.&lt;/code&gt;. Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for i, row in entry.curatedContentBlocks|batch(2) if row[i].type == 'halfWidthBlock' %}&#xA;  &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      {% for block in row %}&#xA;        &amp;lt;div class=&quot;text-center c6 med-c12 push-top-double&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;section fill-grey-light rounded&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;c12 grid-center&quot;&amp;gt;&#xA;              &amp;lt;h3&amp;gt;{{ block.titleText }}&amp;lt;/h3&amp;gt;&#xA;              {% if block.ctaUrl|length and block.ctaText|length %}&#xA;                &amp;lt;a href=&quot;{{ block.ctaUrl }}&quot; class=&quot;btn push-top&quot;&amp;gt;&#xA;                  {{ block.ctaText }}&#xA;                &amp;lt;/a&amp;gt;&#xA;              {% endif %}&#xA;            &amp;lt;/div&amp;gt; &amp;lt;!-- .c --&amp;gt;&#xA;          &amp;lt;/div&amp;gt; &amp;lt;!-- .section --&amp;gt;&#xA;        &amp;lt;/div&amp;gt; &amp;lt;!-- .c --&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/div&amp;gt; &amp;lt;!-- .row --&amp;gt;&#xA;  &amp;lt;/div&amp;gt; &amp;lt;!-- .wrapper --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7021" LastActivityDate="2018-03-21T19:22:15.940" Title="Use Twig's batch filter with conditional" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;loop&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25300" PostTypeId="1" AcceptedAnswerId="25302" CreationDate="2018-03-21T18:25:43.270" Score="1" ViewCount="44" Body="&lt;p&gt;It seems that some of our users are uploading filenames with foreign characters...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q4dBF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q4dBF.png&quot; alt=&quot;uploaded files&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any way to prevent this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to keep the filenames to all English letters (plus numbers, dash &amp;amp; underscore).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If relevant, this is for Craft 2.)&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-21T19:58:27.403" Title="Prevent foreign characters in filenames?" Tags="&lt;assets&gt;&lt;upload&gt;&lt;files&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25301" PostTypeId="2" ParentId="25298" CreationDate="2018-03-21T19:22:15.940" Score="1" Body="&lt;p&gt;I don't think you can test a conditional against a batch set like this. I think it's testing each batched set against the conditional instead of each item inside the batched sets which is what you're going for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would just create a new set of filtered matrix blocks and then batch the result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set onlyHalfWidthBlocks = [] %}&#xA;&#xA;{% for block in entry.curatedContentBlocks if block.type == 'halfWidthBlock' %}&#xA;  {% set onlyHalfWidthBlocks = onlyHalfWidthBlocks|merge([block]) %}&#xA;{% endfor %}&#xA;&#xA;{% for row in onlyHalfWidthBlocks|batch(2) %}&#xA;  &amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      {% for block in row %}&#xA;        {# ... block code here ... #}&#xA;      {% endfor %}&#xA;    &amp;lt;/div&amp;gt; &amp;lt;!-- .row --&amp;gt;&#xA;  &amp;lt;/div&amp;gt; &amp;lt;!-- .wrapper --&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-03-21T19:22:15.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25302" PostTypeId="2" ParentId="25300" CreationDate="2018-03-21T19:38:32.247" Score="2" Body="&lt;p&gt;Cant you just use &lt;code&gt;preg_replace(&quot;/[^A-Za-z0-9 ]/&quot;, '', $stuff)&lt;/code&gt; for this? Seems that will strip away anything that isnt a number or a letter from the english alphabet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT ---------&#xA;Challenge accepted ;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyAssetFilename($filename){&#xA;    return preg_replace(&quot;/[^A-Za-z0-9-]/&quot;, '', $filename);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Something according to the above strips out all unwanted characters using the hook if you place it in a plugins main class file. The above preg_replace should also keep dashes e.t.c.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way you might be able to approach the sanitation of filenames is listening to the &lt;code&gt;onBeforeSaveAsset&lt;/code&gt; method and then using &lt;code&gt;craft()-&amp;gt;assets-&amp;gt;renameFile()&lt;/code&gt; once you have sanitized it. Not sure which one is better. Both should work.  &lt;/p&gt;&#xA;" OwnerUserId="7540" LastEditorUserId="7540" LastEditDate="2018-03-21T19:58:27.403" LastActivityDate="2018-03-21T19:58:27.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25303" PostTypeId="2" ParentId="5268" CreationDate="2018-03-21T19:44:30.393" Score="1" Body="&lt;p&gt;The one thing i will add onto Jamie's answer is that if you want to create a user's only section you'll probably want to use &lt;code&gt;{% requireLogin %}&lt;/code&gt; and/or &lt;code&gt;{% requirePermission &quot;somePermission&quot; %}&lt;/code&gt; as these will stop anyone that isnt logged in to your site or any user that doesnt have your selected permission from viewing your template. &lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-21T19:44:30.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25304" PostTypeId="2" ParentId="25293" CreationDate="2018-03-21T20:27:54.590" Score="1" Body="&lt;p&gt;Im hesitant to say that this is by design because iam not entirely sure what you mean. Instead i'll explain something i think is comparible that happend to us. We have an entry channel with entries which act as the companies of users on the website. When we saved a company profile in Dutch, fields such as the description or company info would not pull across. We fixed this by listening to the onSaveEntry event and simply pulling the fields across manually. This isnt a very pretty or portable way to do it - but this was an incredibly case and website specific feature - we only wanted entries in this website and even just in this section to have this 'copying' feature. From memory the script looked something like the below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One word of advise i would issue if of advice i would give is if you are working with other content editors is to listen to the &lt;code&gt;cp.entries.edit.right-pane&lt;/code&gt; hook and build a small interface that allows them to select the locale and copy over the current locale to the new locale. The script below has one downside which is that it essentially sterilizes the localization function for craft for the affected entries - which in this projects case was crucial - but in yours probably isnt. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if anything is unclear. One word of notice - if you are working with a relations field which is what a pdf should be. Relations should be copied over IF you are using something like 'Save as a new entry'. If this isnt happening you've probably found a bug. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;        $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;        // Does the entry section equal our companies section channel? &#xA;        if (craft()-&amp;gt;isLocalized() &amp;amp;&amp;amp; $entry-&amp;gt;sectionId == 2) {&#xA;&#xA;                // What locales are there? &#xA;                foreach (craft()-&amp;gt;i18n-&amp;gt;getSiteLocales() as $locale)&#xA;                {&#xA;                    // Is this a foreign locale&#xA;                    if ($locale != $entry-&amp;gt;locale)&#xA;                    {&#xA;                        // Get an entry that belongs to this with a sep locale, setup a model and save it. &#xA;                        $otherLocaleEntry = craft()-&amp;gt;elements-&amp;gt;getElementById($entry-&amp;gt;id, ElementType::Entry, $locale-&amp;gt;__toString());&#xA;                        if ($otherLocaleEntry)&#xA;                        {&#xA;                            $otherLocaleEntry-&amp;gt;getContent()-&amp;gt;myFieldsStuff = $entry-&amp;gt;getContent()-&amp;gt;myFieldsStuff;&#xA;&#xA;&#xA;                            craft()-&amp;gt;entries-&amp;gt;saveEntry($otherLocaleEntry);&#xA;                        }&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-21T20:27:54.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25305" PostTypeId="1" AcceptedAnswerId="25307" CreationDate="2018-03-21T20:30:50.750" Score="1" ViewCount="1288" Body="&lt;p&gt;Using &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21864/how-to-save-matrix-data-programmatically-in-craft-3&quot;&gt;this&lt;/a&gt; answer on how to save data on Craft 3, I want to save also an asset field, but I cannot find out how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works for a Category field using the ids of the categories but not with ids of Assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\elements\Entry;&#xA;use craft\elements\MatrixBlock;&#xA;&#xA;// Figure out the section &amp;amp; entry type&#xA;$section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('news');&#xA;$entryTypes = $section-&amp;gt;getEntryTypes();&#xA;$entryType = reset($entryTypes);&#xA;&#xA;// Create an entry&#xA;$entry = new Entry([&#xA;    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;    'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;    'fieldLayoutId' =&amp;gt; $entryType-&amp;gt;fieldLayoutId,&#xA;    'authorId' =&amp;gt; 1,&#xA;    'title' =&amp;gt; 'My Entry',&#xA;    'slug' =&amp;gt; 'my-entry',&#xA;    'postDate' =&amp;gt; new DateTime(),&#xA;]);&#xA;&#xA;// search categories and retrieve therir ids&#xA;$categorySlugs = ['cat1','cat2','cat3'];&#xA;$craftCategoryIds = [];&#xA;foreach ($categorySlugs as $cs) {&#xA;    $craftCategoryIds[] = Category::find()-&amp;gt;wpSlug($cs)-&amp;gt;one()-&amp;gt;id;&#xA;}&#xA;&#xA;// get a an asset to be used as a featureImage&#xA;$featureImageId = Asset::find()-&amp;gt;myField('123')-&amp;gt;one()-&amp;gt;id;&#xA;&#xA;// Set the custom field values (including Matrix)&#xA;$fieldValues = [&#xA;    'summary' =&amp;gt; 'Some &quot;summary&quot; custom field value...',&#xA;    'categories' =&amp;gt; $craftCategoryIds, // &amp;lt;-- this works, categories are assigned&#xA;    'featuredImage' =&amp;gt; $featureImageId, // &amp;lt;-- doesn't work, featured image is not set&#xA;    'matrixField' =&amp;gt; [&#xA;        'new1' =&amp;gt; [&#xA;            'type' =&amp;gt; 'blockTypeHandle',&#xA;            'fields' =&amp;gt; [&#xA;                    // the block's custom field values...&#xA;            ],&#xA;        ],&#xA;        'new2' =&amp;gt; [&#xA;            'type' =&amp;gt; 'blockTypeHandle',&#xA;            'fields' =&amp;gt; [&#xA;                    // the block's custom field values...&#xA;            ],&#xA;        ],&#xA;    ],&#xA;]);&#xA;&#xA;$entry-&amp;gt;setFieldValues($fieldValues)&#xA;&#xA;// Save the entry&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2018-03-21T22:03:50.600" Title="How to save Asset field of an Entry programmatically in Craft 3" Tags="&lt;plugin-development&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25306" PostTypeId="1" AcceptedAnswerId="25309" CreationDate="2018-03-21T21:03:34.430" Score="1" ViewCount="674" Body="&lt;p&gt;I tried to reload the iframe window using JS but haven't had any luck getting the lp-iframe iframe element, I was thinking I could do it using the Window.Craft object but not sure how?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;setTimeout(()=&amp;gt;{&#xA;  var iframe = document.querySelector('.lp-iframe');&#xA;  iframe.contentWindow.location.reload();&#xA;}, 5000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-03-21T22:35:47.907" Title="How can I reload the Live Preview Iframe window using JS" Tags="&lt;javascript&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25307" PostTypeId="2" ParentId="25305" CreationDate="2018-03-21T22:03:50.600" Score="2" Body="&lt;p&gt;That's because you have to insert an array of ids rather than a single id&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftCategoryIds&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is an array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$featureImageId&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is an integer. Even if you have just a single element you need to insert an array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'featuredImage' =&amp;gt; [$featureImageId]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will work&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-21T22:03:50.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25308" PostTypeId="1" AcceptedAnswerId="25312" CreationDate="2018-03-21T22:03:58.797" Score="2" ViewCount="56" Body="&lt;p&gt;My Sprout Report I just set up is not rendering the &quot;options&quot; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results and options template both exists, and have been copied from the examples directory that came with Sprout Forms. This options template is rendered on the build in &quot;Users and User Groups&quot; report - but not on mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference is my report has a data source of &quot;Custom Twig Template&quot; as opposed to &quot;Users&quot; - but that shouldn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/reports/docs/custom-reports/custom-twig-template-report&quot; rel=&quot;nofollow noreferrer&quot;&gt;The docs&lt;/a&gt; and the built in examples aren't shedding any light on the situation. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c8wbv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c8wbv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="6007" LastEditDate="2018-10-16T07:47:02.500" LastActivityDate="2018-10-16T07:47:02.500" Title="Options not rendering on Sprout Reports report" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25309" PostTypeId="2" ParentId="25306" CreationDate="2018-03-21T22:08:55.217" Score="2" Body="&lt;p&gt;All you need to do is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.livePreview.updateIframe(true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to update the Live Preview iFrame&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-21T22:35:47.907" LastActivityDate="2018-03-21T22:35:47.907" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25310" PostTypeId="2" ParentId="24200" CreationDate="2018-03-21T22:32:40.447" Score="2" Body="&lt;p&gt;Was using the MaxMind free trial and I didn't have the Web Service set correctly in the Smart Map plugin settings. It needed to be set to GeoIP2 City.&lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2018-03-21T22:32:40.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25311" PostTypeId="1" CreationDate="2018-03-21T22:59:01.793" Score="1" ViewCount="495" Body="&lt;p&gt;I made a modal for login at homepage and put &lt;code&gt;{%requireLogin%}&lt;/code&gt; tag in &quot;User Profile&quot; page.&#xA;My &lt;code&gt;general.php&lt;/code&gt; file looks like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;        // Base site URL&#xA;        'siteUrl' =&amp;gt; null,&#xA;&#xA;        // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;        'devMode' =&amp;gt; true,&#xA;        'loginPath' =&amp;gt; '/',&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope to prevent users to go to &quot;User Profile&quot; page without login and redirect them to homepage. But the issue is when I login on the homepage, the browser gives an error &lt;code&gt;redirected you too many times.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to do that please? Many thanks!!&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-22T20:14:35.263" Title="how to set loginPath in config file" Tags="&lt;redirect&gt;&lt;login&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25312" PostTypeId="2" ParentId="25308" CreationDate="2018-03-22T02:13:54.573" Score="2" Body="&lt;p&gt;It looks like the issue here is that the Results Template and Options Template include the file extension &lt;code&gt;.twig&lt;/code&gt;. Removing the extension &lt;code&gt;.twig&lt;/code&gt; should get things working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_reports/dealer-export/options&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've added it to our list to improve this functionality in the future. We should be able to strip off the extension behind the scenes or do what we need to do with it regardless of whether you add it or not. Sprout Reports does loop through and check for all supported extension types for your site on the back end when no extension is provided.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-03-22T02:13:54.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25313" PostTypeId="1" AcceptedAnswerId="25314" CreationDate="2018-03-22T03:15:23.553" Score="1" ViewCount="50" Body="&lt;p&gt;Is is possible to set the &quot;section id&quot; manually by using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::$app-&amp;gt;sections-&amp;gt;saveSection($section);&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we specify the id of a section in an &lt;code&gt;$section&lt;/code&gt; array ?&lt;/p&gt;&#xA;" OwnerUserId="8099" LastEditorUserId="5012" LastEditDate="2018-03-26T10:01:32.510" LastActivityDate="2018-03-26T10:01:32.510" Title="specifying section id manually while saving section" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25314" PostTypeId="2" ParentId="25313" CreationDate="2018-03-22T06:57:06.007" Score="1" Body="&lt;p&gt;No you can't. Craft will throw an exception when you insert an id that does not exist into the form. Is there a certain reason for your question? Maybe we could provide help on that. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-22T06:57:06.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25317" PostTypeId="1" AcceptedAnswerId="25320" CreationDate="2018-03-22T13:51:11.477" Score="1" ViewCount="221" Body="&lt;p&gt;I have a matrix table field that I want to render on a page. I've tried a few different things and nothing is working. I tried switch and elseif, but those weren't working. I'm no longer getting errors, but now - even though I have content in the fields - nothing shows up on the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like it must be a templating error but I can't see what it could be. Any help would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.comparisonChart %} &#xA;{% if block.type == 'compareChartHeadingBlock' %}&#xA;  &amp;lt;h3&amp;gt;{{ block.compareChartHeading }}&amp;lt;/h3&amp;gt;  &#xA;{% endif %}&#xA;&#xA;{% if block.type == 'compareChartTwoBlock' %}&#xA;    {% for row in block.compareChartTwo %}  &#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;box1-3 {{ row.empty }}&quot;&amp;gt;{{ row.chartTwoLeft }}&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;{{ row.chartTwoAgree }} {{ row.chartTwoDisagree }} {{ row.chartTwoSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;box1-3 {{ row.empty }}&quot;&amp;gt;{{ row.chartTwoRight }}&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;     {% endfor %}&#xA;  {% endif %}&#xA;&#xA;&#xA;  {% if block.type == 'compareChartThreeBlock' %}&#xA;    {% for row in block.compareChartThree %}  &#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;{{ row.chart3Left }}&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;{{ row.chart3LeftAgree }} {{ row.chart3LeftDisagree }} {{ row.chart3LeftSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;{{ row.chart3Center }}&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;{{ row.chart3RightAgree }} {{ row.chart3RightDisagree }} {{ row.chart3RightSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;{{ row.chart3Right }}l&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;  {% endif %}     &#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the matrix field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L3flP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L3flP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5384" LastActivityDate="2018-03-22T18:29:29.680" Title="Matrix Table Content not showing" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25318" PostTypeId="1" CreationDate="2018-03-22T15:11:51.383" Score="2" ViewCount="434" Body="&lt;p&gt;So I have an include file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;noscript&amp;gt;&#xA;  &amp;lt;img&#xA;    src=&quot;{{ srcImage }}&quot;&#xA;    alt=&quot;{{ alt }}&quot;&#xA;  /&amp;gt;&#xA;&amp;lt;/noscript&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am including like standard:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_includes/partials/image-noscript' %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but for some reason it is generating the code like so…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;noscript&amp;gt;&#xA;  &amp;amp;lt;img&#xA;    src=&quot;http://plowmancraven-v4.loc/imager/uploads/images/general/3172/PC-Enviro-Generic-London-shutterstock_370946690_3488bcae28a5a46889970c4f238b0c7c.jpg&quot;&#xA;    alt=&quot;PC Enviro Generic London&quot;&#xA;  /&amp;amp;gt;&#xA;&amp;lt;/noscript&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: Here are some of the things I have tried but nothing has solved this issue yet.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- include '_includes/partials/image-noscript' -%}&#xA;{% autoescape false %}{% include '_includes/partials/image-noscript' %}{% endautoescape %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;inside the included file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;noscript&amp;gt;&amp;lt;img src=&quot;{{ srcImage }}&quot; alt=&quot;{{ alt }}&quot; /&amp;gt;&amp;lt;/noscript&amp;gt;&#xA;&#xA;{% spaceless %}&amp;lt;noscript&amp;gt;&amp;lt;img src=&quot;{{ srcImage }}&quot; alt=&quot;{{ alt }}&quot; /&amp;gt;&amp;lt;/noscript&amp;gt;{% endspaceless %}&#xA;&#xA;{% autoescape false %}&#xA;&amp;lt;noscript&amp;gt;&#xA;  &amp;lt;img&#xA;    src=&quot;{{ srcImage }}&quot;&#xA;    alt=&quot;{{ alt }}&quot;&#xA;  /&amp;gt;&#xA;&amp;lt;/noscript&amp;gt;&#xA;{% endautoescape %}&#xA;&#xA;{% autoescape false %}&amp;lt;noscript&amp;gt;{% endautoescape %}&#xA;{% autoescape false %}&#xA;  &amp;lt;img&#xA;    src=&quot;{{ srcImage }}&quot;&#xA;    alt=&quot;{{ alt }}&quot;&#xA;  /&amp;gt;&#xA;{% endautoescape %}&#xA;{% autoescape false %}&amp;lt;/noscript&amp;gt;{% endautoescape %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2018-03-26T11:54:39.340" LastActivityDate="2018-07-24T10:03:16.503" Title="Twig include with noscript tag rendered as a string and not code" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25319" PostTypeId="2" ParentId="25318" CreationDate="2018-03-22T15:23:31.493" Score="4" Body="&lt;p&gt;It's escaping the text in the default (html) context, which should not be happening for a template you &lt;code&gt;include&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this is due to a larger issue, as templates that are included should not be escaped in this manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can change the escaping strategy using block tags around the code, though:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% autoescape false %}&#xA;{% endautoescape %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;cf: &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/autoescape.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;autoescape&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-22T15:23:31.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25320" PostTypeId="2" ParentId="25317" CreationDate="2018-03-22T18:29:29.680" Score="1" Body="&lt;p&gt;First, make sure you have &lt;a href=&quot;https://craftcms.com/docs/config-settings#devMode&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode&lt;/a&gt; enabled so any errors will be show. Then, I would consider writing the template code in a way that will ensure something will output when looping through the block types to help troubleshoot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Loop through each block #}&#xA;{% for block in entry.comparisonChart %}&#xA;    {# Output templating based on the block type #}&#xA;    {% switch block.type %}&#xA;        {% case &quot;compareChartHeadingBlock&quot; %}&#xA;            &amp;lt;h3&amp;gt;{{ block.compareChartHeading }}&amp;lt;/h3&amp;gt;  &#xA;&#xA;        {% case &quot;compareChartTwoBlock&quot; %}&#xA;            {% for row in block.compareChartTwo %}  &#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                  &amp;lt;div class=&quot;box1-3 {{ row.empty }}&quot;&amp;gt;{{ row.chartTwoLeft }}&amp;lt;/div&amp;gt;&#xA;                  &amp;lt;div class=&quot;{{ row.chartTwoAgree }} {{ row.chartTwoDisagree }} {{ row.chartTwoSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                  &amp;lt;div class=&quot;box1-3 {{ row.empty }}&quot;&amp;gt;{{ row.chartTwoRight }}&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% else %}&#xA;                Compare chart two has no content&#xA;            {% endfor %}&#xA;&#xA;        {% case 'compareChartThreeBlock' %}&#xA;            {% for row in block.compareChartThree %}  &#xA;                &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;&#xA;                        {{ row.chart3Left }}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;{{ row.chart3LeftAgree }} {{ row.chart3LeftDisagree }} {{ row.chart3LeftSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;{{ row.chart3Center }}&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;{{ row.chart3RightAgree }} {{ row.chart3RightDisagree }} {{ row.chart3RightSeparate }}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    &amp;lt;div class=&quot;box1-5 {{ row.empty }}&quot;&amp;gt;{{ row.chart3Right }}l&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% else %}&#xA;                Compare chart three has no content&#xA;            {% endfor %}&#xA;&#xA;        {% default %}&#xA;            {# The message below will be displayed if the type doesn’t match those handled above #}&#xA;            This {{ block.type }}’s templating has not been handled&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{# If the Matrix has no blocks, output a message #}&#xA;{% else %}&#xA;    This Matrix has no content&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An approach like the above should help narrow where the problem is occuring. If you do get error messages, please post them as it can help identify where the problem is occuring as well.&lt;/p&gt;&#xA;" OwnerUserId="93" LastActivityDate="2018-03-22T18:29:29.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25321" PostTypeId="2" ParentId="1255" CreationDate="2018-03-22T18:55:33.463" Score="2" Body="&lt;p&gt;You can do it like that     &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// return an associative array with the asset source handle as key&#xA;$assetSources = craft()-&amp;gt;assetSources-&amp;gt;getPublicSources('handle');&#xA;$assetSource = $assetSources['yourAssetSrcHandle'];&#xA;$assetFolder = craft()-&amp;gt;assets-&amp;gt;getRootFolderBySourceId($assetSource-&amp;gt;id);&#xA;$assetFolder-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also find weird that there is no direct method to get this from an asset source handle...&lt;/p&gt;&#xA;" OwnerUserId="7557" LastActivityDate="2018-03-22T18:55:33.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25322" PostTypeId="2" ParentId="1255" CreationDate="2018-03-22T19:03:13.577" Score="2" Body="&lt;p&gt;Another approach is to inspect the sidebar element in the control panel using your browser. The screenshot below shows a &lt;em&gt;media&lt;/em&gt; folder (id 9) that’s nested under a parent folder (id 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xngS3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xngS3.png&quot; alt=&quot;screenshot of the CP sidebar’s folder element&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="93" LastActivityDate="2018-03-22T19:03:13.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25323" PostTypeId="2" ParentId="585" CreationDate="2018-03-22T19:20:34.913" Score="3" Body="&lt;p&gt;We had the same problem using ckeditor for our WYSIWYG. &#xA;There was nothing to upload images from the redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we created a controller action to handle the upload and save the image file into one of our Craft asset source folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete code, the payload response is adapted to what ckeditor is expecting but you can use the first part for any generic asset upload.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionImageUpload() {&#xA;    $yourInputName = 'upload';&#xA;    $yourAssetSrcHandle = 'yourAssetSrcHandle';&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $uploadedFile = UploadedFile::getInstanceByName($yourInputName);&#xA;    $assetSources = craft()-&amp;gt;assetSources-&amp;gt;getPublicSources('handle');&#xA;    $assetSource = $assetSources[$yourAssetSrcHandle];&#xA;    $assetFolder = craft()-&amp;gt;assets-&amp;gt;getRootFolderBySourceId($assetSource-&amp;gt;id);&#xA;&#xA;    $response = craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;      $uploadedFile-&amp;gt;tempName,&#xA;      $uploadedFile-&amp;gt;name,&#xA;      $assetFolder-&amp;gt;id,&#xA;      AssetConflictResolution::KeepBoth&#xA;    );&#xA;&#xA;    if ($response-&amp;gt;isSuccess())&#xA;    {&#xA;      $fileId = $response-&amp;gt;getDataItem('fileId');&#xA;      $file = craft()-&amp;gt;assets-&amp;gt;getFileById($fileId);&#xA;&#xA;      $this-&amp;gt;returnJson([&#xA;        'uploaded' =&amp;gt; 1,&#xA;        'fileName' =&amp;gt; $file-&amp;gt;filename,&#xA;        'url' =&amp;gt; $file-&amp;gt;getUrl(),&#xA;        'error' =&amp;gt; null,&#xA;      ]);&#xA;&#xA;    } else {&#xA;      $this-&amp;gt;returnJson([&#xA;        'uploaded' =&amp;gt; 0,&#xA;        'error' =&amp;gt; [&#xA;          'message' =&amp;gt; 'Upload failed'&#xA;        ],&#xA;      ]);&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case you are using this for a WYSIWYG look at (and update) your HTML purifier config if the image tag is stripped from the field when saving it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps saving someone's time ;)&#xA;Cheers&lt;/p&gt;&#xA;" OwnerUserId="7557" LastActivityDate="2018-03-22T19:20:34.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25324" PostTypeId="2" ParentId="25311" CreationDate="2018-03-22T20:14:35.263" Score="1" Body="&lt;p&gt;OK, no one answered....I have to take another way to do which is to put a piece of code like this into user-profile page&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not currentUser %}&#xA;  {% redirect '/' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and take out &lt;code&gt;loginPath&lt;/code&gt; setting in config file.&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-22T20:14:35.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25325" PostTypeId="1" CreationDate="2018-03-22T21:46:01.413" Score="2" ViewCount="4475" Body="&lt;p&gt;I scoured the the web to the ends of earth and couldn't find any info on how to install Craft 3 on my VPS. The package I downloaded is unconventional in many ways. Any ideas how to get Craft running?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, why can't Craft 3 be installed like Wordpress?&lt;/p&gt;&#xA;" OwnerUserId="8154" LastActivityDate="2019-02-21T05:12:19.880" Title="Install Craft 3 on Web Server" Tags="&lt;craft3&gt;&lt;install&gt;&lt;hosting&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25326" PostTypeId="2" ParentId="25325" CreationDate="2018-03-22T21:50:58.730" Score="1" Body="&lt;p&gt;The Craft 3 docs are still abit rough around the edges if you are starting out with craft they can seem abit intimidating. Anyway the best place for you to start is here -&gt; &lt;a href=&quot;https://www.youtube.com/watch?v=f5PxBmx74V8&amp;amp;t=125s&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=f5PxBmx74V8&amp;amp;t=125s&lt;/a&gt;. Its a tutorial by Ryan from Mijingo - Crafts official training partner. Seems like the best place to start :). &lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-22T21:50:58.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25327" PostTypeId="2" ParentId="25325" CreationDate="2018-03-22T22:05:39.227" Score="4" Body="&lt;p&gt;While Craft 3 is still in beta, the only way to install it is via Composer. If you’re unfamiliar with Composer, it’s a package manager (like npm) that attempts to make installing and updating PHP libraries easy via terminal commands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an abbreviated form of the steps found in the Craft docs on &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/installation.md#1-install-composer&quot; rel=&quot;nofollow noreferrer&quot;&gt;installing Craft 3&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Download Composer on your VPS (&lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;instructions here&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Create a new Craft project - &lt;code&gt;composer create-project -s RC craftcms/craft PATH&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ensure the web server is pointing to the right directory and that your database is setup.&lt;/li&gt;&#xA;&lt;li&gt;Point your browser to &lt;code&gt;http://website-url.com/index.php?p=admin&lt;/code&gt; to complete the setup process.&lt;/li&gt;&#xA;&lt;li&gt;With that, you should be running the latest RC of Craft!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'd recommend checking out the &lt;a href=&quot;https://github.com/craftcms/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 docs&lt;/a&gt; and also Ryan Irelan's fantastic videos on &lt;a href=&quot;https://mijingo.com/lessons/installing-composer-craft-cms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Installing Composer&lt;/a&gt; and &lt;a href=&quot;https://mijingo.com/lessons/installing-craft-cms-3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Installing Craft 3&lt;/a&gt;. If you have any more questions about the process, don't hesitate to ping me in the comments or post a message in the Craft CMS Slack group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Pixel &amp;amp; Tonic has mentioned they're hoping to include a .zip download (similar to the Craft 2 installation process) when they fully release Craft 3 on April 4th. Till then, Composer is the only way to download &amp;amp; setup Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-22T22:05:39.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25328" PostTypeId="2" ParentId="25325" CreationDate="2018-03-22T23:04:10.017" Score="6" Body="&lt;p&gt;Here's a tutorial on setting up your first Craft CMS 3 project. I'm a little sad that it didn't come up in any Google searches :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-22T23:04:10.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25329" PostTypeId="2" ParentId="25325" CreationDate="2018-03-23T00:59:17.333" Score="1" Body="&lt;p&gt;yea, craft is little bit tricky when it comes to installation. As craft 3 is based on yii 2.0 [installation of yii 2.0 and craft is similar]. if you have previous experience in working with yii 2 then it should not be problem. Any Way lets make this easier for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets follow this&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Composer on your server&lt;/li&gt;&#xA;&lt;li&gt;then Run composer create-project -s RC craftcms/craft PATH[your web root path] for creating craft 3 project&lt;/li&gt;&#xA;&lt;li&gt;then edit web server configuration file i.e httpd.conf for apache or nginx.conf file for nginx [this totally depends on your server configuration] change the document root and directory path to craft's web folder. save and restart web server.&lt;/li&gt;&#xA;&lt;li&gt;Now go to your domain/admin and you should see craft 3 installation page. &lt;/li&gt;&#xA;&lt;li&gt;Also Craft 3 doesnot have default template to display anything so you need to create one after you finish your installation so that it will display something when you open your primary domain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8099" LastActivityDate="2018-03-23T00:59:17.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25330" PostTypeId="2" ParentId="25266" CreationDate="2018-03-23T08:53:32.477" Score="1" Body="&lt;p&gt;The fix for distorted 8bit png's is to install imagick on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running whm/cpanel and there were some hoops to jump through to get it installed. I installed it in terminal and then in WHM, I had to enable it for PHP.&lt;/p&gt;&#xA;" OwnerUserId="7931" LastActivityDate="2018-03-23T08:53:32.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25331" PostTypeId="1" CreationDate="2018-03-23T10:20:20.423" Score="1" ViewCount="261" Body="&lt;p&gt;I am trying to fill in lat/lng data in the &lt;a href=&quot;https://github.com/ethercreative/simplemap&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simple Map&lt;/a&gt; field of an entry through a plugin. All information from entry is saved except for Simple Map. Apparently I am doing something wrong there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new Entry(); // use craft\elements\Entry;&#xA;$entry-&amp;gt;.... // set fields&#xA;...&#xA;$entry-&amp;gt;setFieldValues([&#xA;    'otherFields' =&amp;gt; $value,&#xA;     ...&#xA;    'mySimpleMapFieldName' =&amp;gt; [&#xA;       'lat' =&amp;gt; 52.27, //$location['lat'],&#xA;       'lng' =&amp;gt; 0.51 //$location['lng'],&#xA;]);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7378" LastEditorUserId="57" LastEditDate="2018-03-23T18:20:51.763" LastActivityDate="2018-05-23T14:04:52.147" Title="Craft 3 add Simple Map in entry through plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-simplemap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25332" PostTypeId="1" AcceptedAnswerId="25333" CreationDate="2018-03-23T12:17:12.580" Score="1" ViewCount="342" Body="&lt;p&gt;I am writing an API which directly connects to Craft database and retrieves data.  I need to get the categories hierarchy.  But I can not find how parent and child categories are related in the database, therefore I can't write an SQL query to retrieve it. &#xA;Can anyone help with this?&lt;/p&gt;&#xA;" OwnerUserId="7341" LastEditorUserId="57" LastEditDate="2018-03-23T18:45:58.677" LastActivityDate="2018-03-23T18:45:58.677" Title="How are parent and child categories related in Craft database?" Tags="&lt;categories&gt;&lt;database&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25333" PostTypeId="2" ParentId="25332" CreationDate="2018-03-23T12:58:54.580" Score="1" Body="&lt;p&gt;As of Craft 2 all information about Parent - Child relations are stored in the &lt;code&gt;craft_structureelements&lt;/code&gt; table. But it's not like a hierarchy (child has the parent id) so it can be quite confusing at the first moment. &#xA;When you take a look into the &lt;code&gt;ElementService&lt;/code&gt; you'll see the following how the &lt;code&gt;getChildren()&lt;/code&gt; parameter from your &lt;code&gt;ElementCriteriaModel&lt;/code&gt; is converted into a &lt;code&gt;Query&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($criteria-&amp;gt;descendantOf)&#xA;{&#xA;    $query-&amp;gt;andWhere(&#xA;        array('and',&#xA;            'structureelements.lft &amp;gt; :descendantOf_lft',&#xA;            'structureelements.rgt &amp;lt; :descendantOf_rgt',&#xA;            'structureelements.root = :descendantOf_root'&#xA;        ),&#xA;        array(&#xA;            ':descendantOf_lft'  =&amp;gt; $criteria-&amp;gt;descendantOf-&amp;gt;lft,&#xA;            ':descendantOf_rgt'  =&amp;gt; $criteria-&amp;gt;descendantOf-&amp;gt;rgt,&#xA;            ':descendantOf_root' =&amp;gt; $criteria-&amp;gt;descendantOf-&amp;gt;root&#xA;        )&#xA;    );&#xA;&#xA;    if ($criteria-&amp;gt;descendantDist)&#xA;    {&#xA;        $query-&amp;gt;andWhere('structureelements.level &amp;lt;= :descendantOf_level',&#xA;            array(':descendantOf_level' =&amp;gt; $criteria-&amp;gt;descendantOf-&amp;gt;level + $criteria-&amp;gt;descendantDist)&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;ancestorDist&lt;/code&gt; is the &lt;code&gt;level&lt;/code&gt; of the child. If you only want to have direct children you can ignore that part. &lt;code&gt;$criteria-&amp;gt;descendantOf&lt;/code&gt; is actually the &lt;code&gt;BaseElementModel&lt;/code&gt; of your current element -&gt; &lt;code&gt;$element-&amp;gt;getChildren&lt;/code&gt; . &lt;code&gt;$criteria-&amp;gt;descendantOf-&amp;gt;rgt&lt;/code&gt; is the value in &lt;code&gt;craft_structureelements&lt;/code&gt; for the certain Id. Imagine &lt;code&gt;element&lt;/code&gt; is your current element - your &lt;code&gt;where&lt;/code&gt; could be like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WHERE [....] AND (structureelements.lft &amp;lt; element.lft AND structureelements.rgt &amp;gt; element.rgt AND structureelements.root = element.root) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the &lt;code&gt;getParent()&lt;/code&gt; function will be treated with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($criteria-&amp;gt;ancestorOf)&#xA;{&#xA;    $query-&amp;gt;andWhere(&#xA;        array('and',&#xA;            'structureelements.lft &amp;lt; :ancestorOf_lft',&#xA;            'structureelements.rgt &amp;gt; :ancestorOf_rgt',&#xA;            'structureelements.root = :ancestorOf_root'&#xA;        ),&#xA;        array(&#xA;            ':ancestorOf_lft'  =&amp;gt; $criteria-&amp;gt;ancestorOf-&amp;gt;lft,&#xA;            ':ancestorOf_rgt'  =&amp;gt; $criteria-&amp;gt;ancestorOf-&amp;gt;rgt,&#xA;            ':ancestorOf_root' =&amp;gt; $criteria-&amp;gt;ancestorOf-&amp;gt;root&#xA;        )&#xA;    );&#xA;&#xA;    if ($criteria-&amp;gt;ancestorDist)&#xA;    {&#xA;        $query-&amp;gt;andWhere('structureelements.level &amp;gt;= :ancestorOf_level',&#xA;            array(':ancestorOf_level' =&amp;gt; $criteria-&amp;gt;ancestorOf-&amp;gt;level - $criteria-&amp;gt;ancestorDist)&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-23T12:58:54.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25334" PostTypeId="1" AcceptedAnswerId="25335" CreationDate="2018-03-23T13:22:57.617" Score="2" ViewCount="350" Body="&lt;p&gt;I am developing a plugin to add custom column to entries table for which I am using &lt;code&gt;EVENT_REGISTER_TABLE_ATTRIBUTES&lt;/code&gt; and &lt;code&gt;EVENT_SET_TABLE_ATTRIBUTE_HTML&lt;/code&gt; and code example is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Element::class, &#xA;    Element::EVENT_REGISTER_TABLE_ATTRIBUTES, &#xA;    function(craft\events\RegisterElementTableAttributesEvent $e) {&#xA;        return array(&#xA;            'foo' =&amp;gt; &quot;Foo&quot;,&#xA;            'bar' =&amp;gt; &quot;Bar&quot;,&#xA;        );&#xA;});&#xA;Event::on(&#xA;    Entry::class, &#xA;    Element::EVENT_SET_TABLE_ATTRIBUTE_HTML, &#xA;    function(craft\events\SetElementTableAttributeHtmlEvent $e) {&#xA;        if ($e-&amp;gt;attribute === 'foo') {&#xA;            return 'bar';&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, its not working. Could anyone please help what I am mistaking here. &lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2018-03-23T13:41:59.167" Title="EVENT_REGISTER_TABLE_ATTRIBUTES not working in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25335" PostTypeId="2" ParentId="25334" CreationDate="2018-03-23T13:34:56.790" Score="3" Body="&lt;p&gt;You don't need to return anything in an event. As you can see how the Event is triggert&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::trigger(static::class, self::EVENT_REGISTER_TABLE_ATTRIBUTES, $event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It does not expect any return value. So you don't add something by returning an array. Instead you'll have to manipulate the properties of your &lt;code&gt;event&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you take a look at your &lt;code&gt;RegisterElementTableAttributesEvent&lt;/code&gt; it contains the following property&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @var array List of registered table attributes for the element type.&#xA; */&#xA;public $tableAttributes = [];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to add attributes you have to do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Element::class,&#xA;    Element::EVENT_REGISTER_TABLE_ATTRIBUTES,&#xA;    function(craft\events\RegisterElementTableAttributesEvent $e) {&#xA;        $e-&amp;gt;tableAttributes['foo'] = [&#xA;            'label' =&amp;gt; &quot;Foo&quot;&#xA;        ];&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's the same for your &lt;code&gt;SetElementTableAttributeHtmlEvent&lt;/code&gt;. It has the properties &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Properties&#xA;// =========================================================================&#xA;&#xA;/**&#xA; * @var array|null The table attribute associated with this event.&#xA; */&#xA;public $attribute;&#xA;&#xA;/**&#xA; * @var string|null The HTML to represent a table attribute.&#xA; */&#xA;public $html;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can &lt;code&gt;var_dump&lt;/code&gt; the &lt;code&gt;$event&lt;/code&gt; to see the current properties to get to know which structure you have to include. Usually you would do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Entry::class,&#xA;    Element::EVENT_SET_TABLE_ATTRIBUTE_HTML,&#xA;    function(craft\events\SetElementTableAttributeHtmlEvent $e) {&#xA;        if($e-&amp;gt;attribute === 'foo'){&#xA;            $e-&amp;gt;html = 'FOOOOO';&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-23T13:41:59.167" LastActivityDate="2018-03-23T13:41:59.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25336" PostTypeId="1" AcceptedAnswerId="25337" CreationDate="2018-03-23T14:12:49.863" Score="1" ViewCount="54" Body="&lt;p&gt;I need to write a conditional that determines if events actually exist in a calendar. I only want to display an option in the the select dropdown IF the calendar has events:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set calendars = craft.calendar.calendars({&#xA;    limit: 100,&#xA;    order: &quot;name&quot;,&#xA;    sort: &quot;asc&quot;&#xA;}) %}&#xA;&#xA;{% set events = craft.calendar.events({&#xA;    calendarId: calendar.id&#xA;}) %}&#xA;&#xA;{% for calendar in calendars %}&#xA;&#xA;    {# determine what the URL should look like based on the current URL structure #}&#xA;&#xA;    {% if segment1 == '' %}&#xA;        {% set urlPart = &quot;month/calendar/&quot; ~ calendar.handle ~ &quot;/&quot; ~ month.date.format('Y/m') ~ &quot;#1&quot; %}&#xA;    {% elseif segment3 is not empty and segment4 is not empty %}&#xA;        {% set urlPart = &quot;month/calendar/&quot; ~ calendar.handle ~ &quot;/&quot; ~ segment4 ~ &quot;/&quot; ~ segment5 ~ &quot;#2&quot; %}&#xA;    {% else %}&#xA;        {% set urlPart = &quot;month/calendar/&quot; ~ calendar.handle ~ &quot;/&quot; ~ segment2 ~ &quot;/&quot; ~ segment3 ~ &quot;#3&quot; %}&#xA;    {% endif %}&#xA;&#xA;    {# I need a conditional here that outputs an option only IF there are events in the calendar #}&#xA;&#xA;    {% if events %}&#xA;        &amp;lt;option value=&quot;{{ siteUrl }}cal/{{ urlPart }}&quot;{% if segment3 == calendar.handle %} selected=&quot;selected&quot;{% endif %}&amp;gt;&#xA;            {{ calendar.name }} - {{ calendar.event.occurrenceCount }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I expanded this out so you can see everything. Unfortunately, this is still outputting all calendars even if the calendar has no events.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2018-03-23T14:31:19.180" LastActivityDate="2018-03-23T14:43:39.840" Title="How to determine if there are events in a calendar?" Tags="&lt;conditional&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25337" PostTypeId="2" ParentId="25336" CreationDate="2018-03-23T14:20:05.940" Score="3" Body="&lt;p&gt;Looking at the &lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.events/#param-calendar&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; you can search for &lt;code&gt;events&lt;/code&gt; for a certain &lt;code&gt;calander&lt;/code&gt; by including the &lt;code&gt;id&lt;/code&gt; or the &lt;code&gt;handle&lt;/code&gt; in your query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set calendars = craft.calendar.calendars({&#xA;    limit: 100,&#xA;    order: &quot;name&quot;,&#xA;    sort: &quot;asc&quot;&#xA;}) %}&#xA;&#xA;{% for calendar in calendars %}&#xA;    {% set events = craft.calendar.events({&#xA;        calendarId: calendar.id&#xA;    }) %}&#xA;&#xA;    {% if events|length %}&#xA;        // there are events&#xA;    {% else %}&#xA;        // calendar has no events&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-23T14:43:39.840" LastActivityDate="2018-03-23T14:43:39.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25338" PostTypeId="1" AcceptedAnswerId="25339" CreationDate="2018-03-23T15:43:28.570" Score="1" ViewCount="125" Body="&lt;p&gt;I'm using this &lt;a href=&quot;https://craftcms.com/support/entry-type-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;support article&lt;/a&gt; as a guide and I'm stuck on what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an &quot;events&quot; section, and I would like to use a different template for one the entries.  I've created a new entry type in the &quot;events&quot; section and gave it the handle &quot;summerpreview.&quot;  I created a template in the &quot;events&quot; subfolder: &quot;_types&quot; entitled: &quot;summerpreview.html.&quot;  That template uses the include tag: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;events/_types/&quot; ~ summerpreview.html %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've created an entry inside the &quot;events&quot; section using the &quot;summer preview&quot; entry type and gave it the slug of &quot;summerpreview.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?  The entry pulls using the default &quot;events&quot; template and not the &quot;summerpreview.&quot;  What do I need to do for this event to use &quot;summerpreview&quot; template?&lt;/p&gt;&#xA;" OwnerUserId="7121" LastActivityDate="2018-03-23T16:49:50.457" Title="Using multiple Templates per section" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25339" PostTypeId="2" ParentId="25338" CreationDate="2018-03-23T16:49:50.457" Score="3" Body="&lt;p&gt;You need to allow the &lt;code&gt;entry.type&lt;/code&gt; value to be part of the &lt;code&gt;include&lt;/code&gt; path...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;events/_types/&quot; ~ entry.type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since your &lt;code&gt;entry.type&lt;/code&gt; is &quot;summerpreview&quot;, that will be parsed out like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;events/_types/summerpreview&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With Craft, you don't need to specify the &lt;code&gt;.html&lt;/code&gt; extension, so this include should work perfectly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a side note... I'd recommend turning on &lt;code&gt;devMode&lt;/code&gt; locally. It would have thrown an error, telling you that &lt;code&gt;summerpreview&lt;/code&gt; is not a legitimate variable.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;What Dev Mode Does&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-23T16:49:50.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25340" PostTypeId="1" CreationDate="2018-03-23T18:11:16.473" Score="1" ViewCount="573" Body="&lt;p&gt;Is there a way to disable non-primary sites on a multisite setup so that users are redirected to a 503 template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see any configurations that allow me to to this. All sites are either disabled or live. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-06-24T06:53:34.867" Title="Disabling individual sites on a Craft 3 multisite" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25341" PostTypeId="1" CreationDate="2018-03-23T19:24:57.300" Score="1" ViewCount="92" Body="&lt;p&gt;I have a customer that wants to modify the order confirmation email.  I set up a new Entry for order confirmation to include a content block that goes to the email/email_confirmation file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I check in the browser or preview it works perfectly. When I actually send the email it doesn’t appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) It works in the browser with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.basicContentBlocks %}&#xA;// html code&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) The Commerce plugin only seems to read from information in Commerce.  I tried to pull in the data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set emailEntry = craft.entries.section('emailConfirmation') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3) I tried making a global variable that used the email confirmation entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set emailBlock = craft.globals.getSetByHandle('emailBlock') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems the email is loaded and sent before the entry information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a work around to allow customers to add information or pictures from the CMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help,&lt;/p&gt;&#xA;" OwnerUserId="8157" LastActivityDate="2018-08-20T23:01:20.253" Title="add text or image to Craft Commerce confirmation email through the CMS" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25342" PostTypeId="2" ParentId="25341" CreationDate="2018-03-23T20:46:16.750" Score="1" Body="&lt;p&gt;Even though the emailConfirmation was only one entry it was an array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set emailEntry = craft.entries.section('emailConfirmation').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;setting up the entry to the html was similar to what I thought, but I didn't include the &quot;.first()&quot; so I wasn't getting what I expected.&lt;/p&gt;&#xA;" OwnerUserId="8157" LastActivityDate="2018-03-23T20:46:16.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25343" PostTypeId="2" ParentId="23834" CreationDate="2018-03-23T22:05:27.390" Score="2" Body="&lt;p&gt;I was able to accomplish this by grabbing &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Business Logic&lt;/a&gt;, stripping out most of the examples, and simply listening for a form submission:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('sproutForms.onSaveEntry', function (Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $content = $entry-&amp;gt;getContent()-&amp;gt;getAttributes();&#xA;&#xA;    // Let's not pass fields we don't need&#xA;    $fields = array();&#xA;    $ignore = array('id', 'slug', 'title', 'handle', 'locale', 'element', 'elementId');&#xA;&#xA;    foreach ($content as $field =&amp;gt; $value)&#xA;    {&#xA;        if(!in_array($field, $ignore))&#xA;        {&#xA;            $fields[$field] = $value;&#xA;        }&#xA;    }&#xA;&#xA;    $fields = http_build_query($fields);&#xA;    $ch = curl_init('https://url-to-sugar.crm/index.php?entryPoint=WebToLeadCapture');&#xA;    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);&#xA;&#xA;    $response = curl_exec($ch);&#xA;    curl_close($ch);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just created an init function &lt;a href=&quot;https://github.com/lindseydiloreto/craft-businesslogic/blob/master/businesslogic/BusinessLogicPlugin.php#L6&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the plugin&lt;/a&gt; and added this there. I didn't need to use an API because the data is only flowing in one direction. I just used curl to push the data.&lt;/p&gt;&#xA;" OwnerUserId="7991" LastEditorUserId="57" LastEditDate="2018-03-23T22:13:25.683" LastActivityDate="2018-03-23T22:13:25.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25344" PostTypeId="1" CreationDate="2018-03-23T22:23:12.447" Score="1" ViewCount="61" Body="&lt;p&gt;I am using the import plugin by Bob Oldehampsink to load entries. I have 47 fields that I'm uploading. The import shows as uploaded successfully in the admin and the file is my assets but the entries do not load.  If I reduce the number of fields the entry appears as it should. I can't find any errors related to the plugin. Any ideas as to what might be going wrong?&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-03-26T21:33:46.420" Title="Import Plugin Entries Not Loading" Tags="&lt;plugins&gt;&lt;import&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25345" PostTypeId="2" ParentId="25331" CreationDate="2018-03-24T12:14:54.333" Score="1" Body="&lt;p&gt;I think what you are running into is the getField() method on #147 of the MapService. What this does is return a model based on whether this is an existing record or a post request and if neither return an empty model. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( &#xA;        // Is this a Post request and isnt there a console request AND is there a value&#xA;        !\Craft::$app-&amp;gt;request-&amp;gt;isConsoleRequest&#xA;        &amp;amp;&amp;amp; \Craft::$app-&amp;gt;request-&amp;gt;isPost&#xA;        &amp;amp;&amp;amp; $value&#xA;    ) {&#xA;&#xA;        // Create a new map model with the $value param - creating a model that takes the $value into account&#xA;        $model = new Map($value);&#xA;    } else if ($record) {&#xA;&#xA;        // Is there a record? Create a model that takes these record params into account&#xA;        $model = new Map($record-&amp;gt;getAttributes());&#xA;    } else {&#xA;&#xA;        // We havent got a post request.or a record. This is what is happening to your input. &#xA;        $model = new Map();&#xA;    }&#xA;EDIT---------------------------------------------&#xA;If you Edit $model = new Map(); TO $model = new Map($value); Your above code works fine. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure as to the inner workings of Simple Map - have only used the C2 version. The best way to fix this for the long term is probably to create an issue on SimpleMap's github page. My recommendation is to replace the above else{} method, with what i described below. Maybe there is some way to get around this that doesnt involve source edits - like i said i dont know Simple map inside out - i might just be missing something obvious. In case there isn't i would recommend fixing the MapService with something like the below: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;else {&#xA;&#xA;    Didnt meet the satisfied conditions. Is $value an array and does it exist? &#xA;    if(!$value || !is_array($value)){&#xA;&#xA;        // Not happy with this input - create a blank map. &#xA;        $model = new Map();&#xA;    } &#xA;&#xA;        We're happy with the sended value - it isnt a post request. Lets take the value into account&#xA;        $model = new Map($value);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I ran the above code with your example and it ran just fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it goes without saying that it is a terrible idea to just edit just your MapService file with the above code as a permanent solution as that will give you instability/incompatibility problems. What i would recommend is editing the method temporarily to test if this solves your problem - just to make sure. If it does it's probably wise to open an issue. Either if it does or doesn't - probably smart to open a github issue to see what the devs themselves say. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S - your code example is missing one array brackets at the end - probably smart to edit that before pasting it back.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope i was able to help in someway :)&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-24T12:14:54.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25347" PostTypeId="1" AcceptedAnswerId="25352" CreationDate="2018-03-24T14:48:43.200" Score="1" ViewCount="789" Body="&lt;p&gt;I am attempting to get a specific entries id from within a specific section. I have looked around, and clearly have not found anything yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, lets say we have a section called &quot;Stories&quot;, which is a &lt;em&gt;structure&lt;/em&gt;. Inside of &quot;Stories&quot; there is a specific entry named, &quot;Story One&quot; that I would like to retrieve the id of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can pretty much get as far as getting the contents of the Stories structure via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle('stories');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important piece here, is that I want to find the &quot;Story One&quot; entry id. Reason being is that it looks like you can't do relatedTo queries via the title of an entry, but you need the id.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-03-25T13:19:10.237" Title="How to get specific entries id" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25348" PostTypeId="1" AcceptedAnswerId="25349" CreationDate="2018-03-24T17:54:02.527" Score="3" ViewCount="303" Body="&lt;p&gt;Just starting with plugin development. I modified the code from pluginfactory.io for a custom tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function navHTML()&#xA;{&#xA;    $result = '&amp;lt;h2&amp;gt;Hello again&amp;lt;/h2&amp;gt;';&#xA;    return $result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I am getting output. The issue is the html tags are being converted to alt characters. Here is the actual source of my index page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;h2&amp;amp;gt;Testing&amp;amp;lt;/h2&amp;amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;IT looks like Craft or Twig is converting the tags to alt characters. I need to create an unordered list html using the plugin. How do I prevent Craft or Twig from converting the HTML to alt characters?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-03-24T18:15:09.510" Title="Craft or Twig converting html tags to alt characters" Tags="&lt;craft3&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25349" PostTypeId="2" ParentId="25348" CreationDate="2018-03-24T18:15:09.510" Score="4" Body="&lt;p&gt;You need to make sure that you're returning the &lt;code&gt;raw&lt;/code&gt; version of the HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2, it looks like this...&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return TemplateHelper::getRaw($result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, it looks like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return Template::raw($result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're doing this in Craft 3, you need to also be sure that you are loading the &lt;code&gt;Template&lt;/code&gt; helper class at the top:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\helpers\Template;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-24T18:15:09.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25350" PostTypeId="1" CreationDate="2018-03-24T23:09:45.483" Score="2" ViewCount="444" Body="&lt;p&gt;I have been looking through answers here at stackexchange but somehow can't figure out what i am missing. I simply want to upload an asset to a specific asset folder in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;I do get an error: &lt;code&gt;Call to a member function getTempName() on null&lt;/code&gt;&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot, much appreciated&#xA;&lt;s&gt;&#xA;this is my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;assetLinks/upload/UploadFile&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;file&quot; name=&quot;file[]&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Upload file&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AssetLinks_UploadController extends BaseController&#xA;{&#xA;&#xA;    public function actionUploadFile()&#xA;    {&#xA;        // Get info about the uploaded file&#xA;        $file = UploadedFile::getInstanceByName('fileInputName');&#xA;        $tempFilePath = $file-&amp;gt;getTempName();&#xA;&#xA;        // Find the target folder&#xA;        $folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;            'sourceId' =&amp;gt; 1,&#xA;            'path' =&amp;gt; 'uploads/documents/',&#xA;        ));&#xA;&#xA;        // Turn the file into a managed asset within that folder&#xA;        craft()-&amp;gt;assets-&amp;gt;insertFileByLocalPath(&#xA;            $file-&amp;gt;getTempName(),&#xA;            $file-&amp;gt;getName(),&#xA;            $folder-&amp;gt;id,&#xA;            AssetConflictResolution::KeepBoth&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading through the docs and some other examples and decided to go for an AJAX File upload, which of course lead to new problems :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AssetLinks_UploadController extends BaseController&#xA;{&#xA;&#xA;  protected $valid_extensions = array('jpg', 'jpeg', 'png', 'pdf');&#xA;  protected $assetSourceId = 1;&#xA;  public function actionUploadFile()&#xA;  {&#xA;      $this-&amp;gt;requireAjaxRequest();&#xA;      $errors = array();&#xA;      $success = array();&#xA;      foreach ($_FILES['files']['error'] as $key =&amp;gt; $error)&#xA;      {&#xA;          if (!$error)&#xA;          {&#xA;              $filename = $_FILES['file']['name'][$key];&#xA;              $file = $_FILES['file']['tmp_name'][$key];&#xA;              $filenamePieces = explode('.', $filename);&#xA;              $extension = end($filenamePieces);&#xA;              if (!in_array($extension, $this-&amp;gt;valid_extensions))&#xA;              {&#xA;                  $errors[] = &quot;$filename has an invalid extension.&quot;;&#xA;                  continue;&#xA;              }&#xA;&#xA;              $uploadDir = craft()-&amp;gt;assetSources-&amp;gt;getSourceById($this-&amp;gt;uploadAssetSourceId)-&amp;gt;settings['path'];&#xA;              $uploadDir = str_replace('{basePath}', craft()-&amp;gt;config-&amp;gt;get('environmentVariables')['basePath'], $uploadDir);&#xA;              if (move_uploaded_file($file, $uploadDir . $filename))&#xA;              {&#xA;                  IOHelper::deleteFile($file);&#xA;                  $file = $uploadDir . $filename;&#xA;                  $fileModel = new AssetFileModel();&#xA;                  $fileModel-&amp;gt;sourceId = $this-&amp;gt;assetSourceId;&#xA;                  $fileModel-&amp;gt;folderId = $this-&amp;gt;assetFolderId;&#xA;                  $fileModel-&amp;gt;filename = IOHelper::getFileName($filename);&#xA;                  $fileModel-&amp;gt;kind = IOHelper::getFileKind(IOHelper::getExtension($filename));&#xA;                  $fileModel-&amp;gt;size = filesize($file);&#xA;                  $fileModel-&amp;gt;dateModified = IOHelper::getLastTimeModified($file);&#xA;                  craft()-&amp;gt;assets-&amp;gt;storeFile($fileModel);&#xA;                  $success[] = &quot;$filename was saved.&quot;;&#xA;              }&#xA;              else&#xA;              {&#xA;                  $errors[] = &quot;$filename was unable to be saved.&quot;;&#xA;                  continue;&#xA;              }&#xA;          }&#xA;      }&#xA;      $this-&amp;gt;returnJSON(compact('errors', 'success'));&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this is the form and Ajax post:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = 'Asset Links' %}&#xA;&#xA;{% set content %}&#xA;&#xA;&#xA;  &amp;lt;form class=&quot;upload&quot;  method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    &amp;lt;input  type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;assetLinks/upload/UploadFile&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input class=&quot;file btn&quot; type=&quot;file&quot; name=&quot;file&quot;&amp;gt;&#xA;    &amp;lt;button data-icon=&quot;upload&quot; class=&quot;uploadfile btn submit&quot; type=&quot;submit&quot;&amp;gt;Upload file&amp;lt;/button&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;  &amp;lt;div style=&quot;margin-top:20px&quot; id=&quot;output&quot; /&amp;gt;&#xA;&#xA;&#xA;{% endset %}&#xA;&#xA;&#xA;{% set js %}&#xA;    $(function() {&#xA;      $(&quot;form&quot;).submit(function() {&#xA;        var url = '/actions/assetLinks/upload',&#xA;          files = $(this).find(&quot;[name=file]&quot;)[0].files,&#xA;          formdata = new FormData(),&#xA;          file,&#xA;          reader;&#xA;&#xA;        for (var i = 0; i &amp;lt; files.length; i++) {&#xA;          file = files[i];&#xA;          if (window.FileReader) {&#xA;            reader = new FileReader();&#xA;            reader.readAsDataURL(file);&#xA;          }&#xA;          formdata.append(&quot;files[]&quot;, file);&#xA;        }&#xA;&#xA;        $(&quot;#output&quot;).html(&quot;Uploading...&quot;);&#xA;&#xA;      $.ajax({&#xA;        type: &quot;POST&quot;,&#xA;        url: url,&#xA;        data: formdata,&#xA;        processData: false,&#xA;          contentType: false,&#xA;        success: function(json) {&#xA;          window.json = json;&#xA;          console.log(json);&#xA;&#xA;          var errors = json['errors'],&#xA;              success = json['success'],&#xA;              html = &quot;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;&quot; + errors.length + &quot; errors, &quot; + success.length + &quot; successfully uploaded&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&quot;;&#xA;&#xA;              $(&quot;#output&quot;).html(html);&#xA;        },&#xA;        error: function (xhr, ajaxOptions, thrownError) {&#xA;          alert(&quot;ERROR: &quot; + xhr.status + &quot; &quot; + thrownError);&#xA;        }&#xA;      });&#xA;&#xA;        return false;&#xA;      });&#xA;    })&#xA;{% endset %}&#xA;{% includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in wich i run into a 404, &#xA;&lt;code&gt;http://test.test/actions/assetLinks/upload 404 (Not Found)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it seems like i am addressing the wrong controller url ?&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-03-25T22:11:07.833" LastActivityDate="2018-12-21T03:03:35.753" Title="Uploading an Asset from a custom CP-Tab in Craft 2.x" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;assets&gt;&lt;assetfilemodel&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25351" PostTypeId="2" ParentId="25350" CreationDate="2018-03-25T13:05:03.983" Score="1" Body="&lt;p&gt;Cant you just do as described in the craft docs?  -&gt; &lt;a href=&quot;https://craftcms.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/assets-fields#uploading-files-from-front-end-entry-forms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-25T13:05:03.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25352" PostTypeId="2" ParentId="25347" CreationDate="2018-03-25T13:19:10.237" Score="3" Body="&lt;p&gt;Correct me if iam wrong but cant you just use the ElementCriteriaModel. Essentially because you are looking for an element type using that will give you much more flexibility - bassicly it is a query builder on roids. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;&#xA;    // Enter in params. here you can enter your sectionId&#xA;    $criteria-&amp;gt;section = 'stories';&#xA;    $criteria-&amp;gt;title   = 'Story One';&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return an array of all the entries that match this criteria. Ofcourse because this is craft you can thus enter a whole lot of other params and do some fancy stuff e.t.c.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add two links at the bottom that are good reads on the subject:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/docs/plugins/working-with-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/docs/plugins/working-with-elements&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-25T13:19:10.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25353" PostTypeId="2" ParentId="25350" CreationDate="2018-03-25T22:55:49.007" Score="0" Body="&lt;p&gt;use $allowAnonymous feature in your controller to allow your function to work if you are not logged in when uploading[just assuming you are trying to upload this as logged off user.]&lt;/p&gt;&#xA;" OwnerUserId="8099" LastActivityDate="2018-03-25T22:55:49.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25354" PostTypeId="1" AcceptedAnswerId="25355" CreationDate="2018-03-26T02:27:32.487" Score="1" ViewCount="221" Body="&lt;p&gt;My plugin structure was created by &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the plugin factory&lt;/a&gt;. I have a setting called ulStateClass and I have been able to change the value of that setting in the Setting for the plug in. Looking at the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/plugin-settings.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0 Docs page&lt;/a&gt; for settings I see the example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// From your main plugin class:&#xA;$foo = $this-&amp;gt;getSettings()-&amp;gt;foo;&#xA;&#xA;// From elsewhere:&#xA;$foo = \ns\prefix\Plugin::getInstance()-&amp;gt;getSettings()-&amp;gt;foo;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My namespace is recoveryfinder\craftnav&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my services php file I have the following to test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;echo \recoveryfinder\craftnav::getInstance()-&amp;gt;getSettings()-&amp;gt;ulStateClass;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error Class 'recoveryfinder\craftnav' not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Making progress with Craft and enjoying it. I am guessing that this is a misuse or misunderstanding of namespaces? How Do I correct this?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2019-01-10T23:11:38.340" Title="Trouble accessing setting" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;settings&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25355" PostTypeId="2" ParentId="25354" CreationDate="2018-03-26T02:38:19.367" Score="2" Body="&lt;p&gt;Little bit confused with your question, if you want to access your settings then you can do craft::$app-&gt;plugins-&gt;getPlugin('handle')-&gt;getSettings()-&gt;foo;&lt;/p&gt;&#xA;" OwnerUserId="8099" LastActivityDate="2018-03-26T02:38:19.367" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25356" PostTypeId="2" ParentId="25340" CreationDate="2018-03-26T05:02:51.203" Score="1" Body="&lt;p&gt;Seems like this is something you'd do from your .htaccess file or public index.php files for each of the non-primary sites you define.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you have a &lt;code&gt;public_html/index.php&lt;/code&gt; for your English primary site and a &lt;code&gt;public_html/de/index.php&lt;/code&gt; for your German site, your German one would just &lt;code&gt;header(&quot;Location: http://mysite.com/503&quot;);&lt;/code&gt; to redirect.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-26T05:02:51.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25357" PostTypeId="1" CreationDate="2018-03-26T09:46:07.537" Score="1" ViewCount="545" Body="&lt;p&gt;I am at the very early stages of using CractCMS but I'm keen to get off to the correct start, writing notes as I go along etc but I cannot figure this issue out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have setup the Multi-Environment Configs to allow me to use, dev, staging and production sites, staging and production appear to work correctly but development site is causing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's something to do with the .env file and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ENVIRONMENT=&quot;production&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change that to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ENVIRONMENT=&quot;dev&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The development site will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can't understand is, both staging and production work so why not development?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought by using db.php and general.php I could do away with .env? Other than this line I can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my General.php code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;// Global settings&#xA;'*' =&amp;gt; [&#xA;    // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;    'defaultWeekStartDay' =&amp;gt; 1,&#xA;&#xA;    // Enable CSRF Protection (recommended)&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;&#xA;    // Whether &quot;index.php&quot; should be visible in URLs&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;    // Control Panel trigger word&#xA;    'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;&#xA;    // The secure key Craft will use for hashing and encrypting data&#xA;    'securityKey' =&amp;gt; '*******************************',&#xA;],&#xA;&#xA;// Dev environment settings&#xA;'dev' =&amp;gt; [&#xA;&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; null,&#xA;&#xA;&#xA;&#xA;    'basePath' =&amp;gt; '@webroot/cpresources',&#xA;&#xA;    'baseUrl'  =&amp;gt; 'https://mydomain.test',&#xA;],&#xA;&#xA;// Staging environment settings&#xA;'staging' =&amp;gt; [&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; null,&#xA;&#xA;    'basePath' =&amp;gt; '@webroot/cpresources',&#xA;&#xA;    'baseUrl'  =&amp;gt; 'https://staging.mydomain.co.uk',&#xA;],&#xA;&#xA;// Production environment settings&#xA;'production' =&amp;gt; [&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; null,&#xA;&#xA;    'basePath' =&amp;gt; '@webroot/cpresources',&#xA;&#xA;    'baseUrl'  =&amp;gt; 'https://mydomain.co.uk',&#xA;],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my db.php code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;'*' =&amp;gt; array(&#xA;    'tablePrefix' =&amp;gt; '',&#xA;    'driver' =&amp;gt; 'mysql',&#xA;    'schema' =&amp;gt; 'public',&#xA;),&#xA;'dev' =&amp;gt; [&#xA;    // Base site URL&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'myusername',&#xA;    'password' =&amp;gt; '*************',&#xA;    'database' =&amp;gt; 'mydatabasename',&#xA;],&#xA;'staging' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'myusername',&#xA;    'password' =&amp;gt; '*************',&#xA;    'database' =&amp;gt; 'craft_cms_staging',&#xA;),&#xA;'production' =&amp;gt; array(&#xA;    'server' =&amp;gt; 'localhost',&#xA;    'user' =&amp;gt; 'myusername',&#xA;    'password' =&amp;gt; '*',&#xA;    'database' =&amp;gt; 'craft_cms_production',&#xA;),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now before anyone says anything about uploading db.php and general.php to git etc because of passwords, I have put both these files in the .gitignore file. I felt this was the best option but if I'm wrong, please explain?&lt;/p&gt;&#xA;" OwnerUserId="8163" LastActivityDate="2018-03-26T11:30:15.603" Title="Multi-Environment Configs in CraftCMS 3" Tags="&lt;craft3&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25358" PostTypeId="2" ParentId="25357" CreationDate="2018-03-26T11:30:15.603" Score="1" Body="&lt;p&gt;For anyone interested, I had set web/index.php to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why both staging and production were working was due to me using the same username and password for the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I had changed this to dev, it now works so I no longer need the .env file.&lt;/p&gt;&#xA;" OwnerUserId="8163" LastActivityDate="2018-03-26T11:30:15.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25359" PostTypeId="1" CreationDate="2018-03-26T12:02:18.840" Score="1" ViewCount="78" Body="&lt;p&gt;I am not sure this is the right place to ask this question but I really need to know it, but I couldn't ask it on the plugin's Github as this is not an issue. I am new on Craft CMS and my client need SEOmatic installed on it. I have configured everything but I couldn't understand the need of &lt;code&gt;Search Targets and Search Query Input&lt;/code&gt; in &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/03a.-Configuring-SEO-Site-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Site Meta Section&lt;/a&gt;. It would be very helpful if someone helps me out for this with some real-life examples.&lt;/p&gt;&#xA;" OwnerUserId="8164" LastActivityDate="2018-03-26T18:48:53.273" Title="What are Search Targets and Search Query Input in seomatic?" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25360" PostTypeId="1" CreationDate="2018-03-26T13:23:45.977" Score="1" ViewCount="50" Body="&lt;p&gt;Suppose there are three Entries:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry One&lt;/li&gt;&#xA;&lt;li&gt;Section One&lt;/li&gt;&#xA;&lt;li&gt;Channel One&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I need to get &lt;code&gt;Section One&lt;/code&gt; in result when I search &lt;strong&gt;Sect&lt;/strong&gt;. Is this possible ? I am using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search(query) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get the results. But keyword &lt;code&gt;sect&lt;/code&gt; doesn't return any result.&lt;/p&gt;&#xA;" OwnerUserId="8164" LastActivityDate="2018-03-26T13:36:10.190" Title="How to get a result from search even if the search query contains a part of title?" Tags="&lt;entries&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25361" PostTypeId="2" ParentId="25360" CreationDate="2018-03-26T13:36:10.190" Score="2" Body="&lt;p&gt;Like stated in the &lt;a href=&quot;https://craftcms.com/docs/searching&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; you have to place &lt;code&gt;*&lt;/code&gt; around your search term&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries({&#xA;    search: {&#xA;        query: '*sect*',&#xA;        subLeft: true,&#xA;        subRight: true                &#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: it would be easier to help you if you show us your &lt;code&gt;query&lt;/code&gt; variable&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-26T13:36:10.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25362" PostTypeId="1" AcceptedAnswerId="25363" CreationDate="2018-03-26T15:02:27.817" Score="1" ViewCount="369" Body="&lt;p&gt;I am performing the following query, which returns me an array of matrix blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;relatedTo = array(someCoolId, anotherCoolId);&#xA;$relatedStories = $criteria-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When looping through this array, I was wondering if it was possible to access the handle of the matrix block that I am currently in. Reason being is I would like to retrieve this as a string, and perform some type of work on it.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-03-26T16:33:44.823" Title="Get the handle of a Matrix block" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25363" PostTypeId="2" ParentId="25362" CreationDate="2018-03-26T15:18:40.063" Score="3" Body="&lt;p&gt;You can grab the &lt;code&gt;handle&lt;/code&gt; of an element that has different types (&lt;code&gt;entries&lt;/code&gt;, &lt;code&gt;matrix&lt;/code&gt;) with &lt;code&gt;getType()-&amp;gt;handle&lt;/code&gt; for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$handle = $entry-&amp;gt;getType()-&amp;gt;handle&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::MatrixBlock);&#xA;$criteria-&amp;gt;relatedTo = array(someCoolId, anotherCoolId);&#xA;$relatedStories = $criteria-&amp;gt;find();&#xA;foreach ($relatedStories as $block){&#xA;    $handle = $block-&amp;gt;getType()-&amp;gt;handle;&#xA;    switch ($handle){&#xA;        case 'foo':&#xA;            break;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what you mean exactly so I'll just insert some random code parts until something is correct.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get the parent element -&amp;gt; the owner of that block.&#xA;$parent = $block-&amp;gt;getOwner()&#xA;&#xA;// get the field that relates both elements&#xA;$field = craft()-&amp;gt;fields-&amp;gt;getFieldById($block-&amp;gt;fieldId);&#xA;$fieldHandle = $field-&amp;gt;handle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-03-26T16:33:44.823" LastActivityDate="2018-03-26T16:33:44.823" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25364" PostTypeId="1" AcceptedAnswerId="25366" CreationDate="2018-03-26T16:07:58.467" Score="2" ViewCount="721" Body="&lt;p&gt;I renamed a channel section and Craft (2.6.3012) is trying to resave all the entries therein (about 500 entries, many with up to 10 localized versions). I'm constantly getting this error (in &lt;code&gt;/craft/storage/runtime/logs/phperrors.log&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[26-Mar-2018 15:53:40 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 43 bytes) in C:\server\project_x\craft\app\helpers\ModelHelper.php on line 95&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the thing... in &lt;code&gt;php.ini&lt;/code&gt;, the &lt;code&gt;memory_limit&lt;/code&gt; setting is set to &lt;code&gt;512M&lt;/code&gt;. Not the &lt;code&gt;256M&lt;/code&gt; one would expect from the error. In Craft's &lt;code&gt;admin/utils/phpinfo&lt;/code&gt; page, it shows that PHP does indeed have a limit of 512Mb, but the process still hits a mysterious memory limit at 256MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running locally on XAMPP, PHP 5.6.24 (switching to PHP 7 prevents me from being able to login for some reason), and this is just part of setting up a site, so I don't care about performance or advisable settings with this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-11-06T11:46:19.723" Title="Resaving Entries hitting a mysterious memory limit" Tags="&lt;memory&gt;&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25366" PostTypeId="2" ParentId="25364" CreationDate="2018-03-26T16:28:47.277" Score="5" Body="&lt;p&gt;Most likely you'll need to add this line to the Craft config file (&lt;code&gt;craft/config/general.php&lt;/code&gt;)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'phpMaxMemoryLimit' =&amp;gt; '512M',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#phpmaxmemorylimit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2 docs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#phpmaxmemorylimit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 docs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5261" LastEditDate="2018-11-06T11:46:19.723" LastActivityDate="2018-11-06T11:46:19.723" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25367" PostTypeId="2" ParentId="25359" CreationDate="2018-03-26T18:48:53.273" Score="2" Body="&lt;p&gt;This has to do with Google Structured Data and how your site appears in search results. If you use these fields, your site will show a custom search box in Google Search results, like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nM698.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nM698.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the &lt;code&gt;Search Target&lt;/code&gt; is a URL where you'd want any search queries to get directed to. So in the example above for Pinterest and a custom search for &quot;Pizza&quot;, the &lt;code&gt;Search Target&lt;/code&gt; might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pinterest.com/search?q={search_term_string}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;Search Query Input&lt;/code&gt; basically just tells Google what the placeholder is that you used in the &lt;code&gt;Search Target&lt;/code&gt;. So in our example it would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;search_term_string&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd recommend reading &lt;a href=&quot;https://developers.google.com/search/docs/data-types/sitelinks-searchbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;this &#xA;page&lt;/a&gt; from the Google Search docs in order to better understand what &lt;code&gt;Search Targets&lt;/code&gt; and the &lt;code&gt;Search Query Input&lt;/code&gt; are.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-26T18:48:53.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25368" PostTypeId="2" ParentId="25344" CreationDate="2018-03-26T21:33:46.420" Score="1" Body="&lt;p&gt;I was able to get to the bottom of this and the problem was that 2 columns in my CSV file had the same name. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a similar problem check the &quot;craft_import_log&quot; table in your database. You will find the error reporting for the import plugin there. The error I received was &quot;Columns and data did not match, could be due to malformed CSV row.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran my CSV through an online checker and it informed me that there were duplicate column headings. Renaming one of the columns fixed my issue.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-03-26T21:33:46.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25369" PostTypeId="1" CreationDate="2018-03-26T23:42:57.510" Score="1" ViewCount="208" Body="&lt;p&gt;The list of entries I need to grab is available here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://arcresources.mediaroom.com/api/newsfeed_releases/list.php?format=json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each &lt;em&gt;individual&lt;/em&gt; entry is available at a unique URL, by adding an ID, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://arcresources.mediaroom.com/api/newsfeed_releases/get.php?format=json?id=n&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there some way to get FeedMe to create entries for every ID from the list URL, using the get URL? &lt;/p&gt;&#xA;" OwnerUserId="7411" LastEditorUserId="7411" LastEditDate="2018-03-27T20:06:19.263" LastActivityDate="2018-05-04T14:09:15.457" Title="Use FeedMe with a dynamic URL" Tags="&lt;json&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25370" PostTypeId="1" CreationDate="2018-03-26T23:52:19.417" Score="1" ViewCount="102" Body="&lt;p&gt;How I can add data to craft commerce stripe product while ordering, Actually I have used stripe webhooks so need meta data to identify the products&lt;/p&gt;&#xA;" OwnerUserId="8126" LastActivityDate="2018-06-25T20:04:08.433" Title="How I am supposed to send product data to stripe for web hooks?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25371" PostTypeId="1" CreationDate="2018-03-27T02:03:25.757" Score="1" ViewCount="246" Body="&lt;p&gt;I've got a wordpress site that is live and am building a craft site to replace it on a subdomain and am having a strange issue that I've never had with any other craft sites I've built. Sometimes when images are uploaded the craft site the upload fails and I get a 500 error which crashes everything on the server including the live wordpress site. This has happened several times and the only way I can fix it is by asking Bluehost support to clear the server's temp folder for me. They have told me that for some reason images are being saved in there and aren't getting cleared which is causing the error. It seemes to be happening randomly, some days it happens every time I try to upload, other days it happens only after a few hours. I've looked through both Craft's error logs and my server error logs and can't make anything out. I've been troubleshooting several causes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Incorrectly defining the image directory?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Initially I was storing images in a public folder and pointing craft to it with &quot;../assets&quot; because index.php is in a subdomain folder. Then I put the assets folder in the subdomain folder and it seemed to be working fine, till it crashed again. So I don't think this would be causing the issue&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Multiple users on the same account? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've enlisted a handful of people to help me port over content from the wordpress site to the new craft site and I tend to get these 500 errors when we're all uploading stuff together. However there have been times when we can work for over an hour without any problems.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Some conflict with Wordpress or other old files?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm not super familiar with PHP, could some server-side configuration be screwing all of this up? I've also got lots of old sites on the server from past developers that I have no idea what they do. I'm planning on wiping them all after this craft site is up.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;I've configured something wrong in Craft? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Maybe?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks guys&lt;/p&gt;&#xA;" OwnerUserId="7212" LastActivityDate="2018-03-27T08:44:09.043" Title="Uploaded images are saving to the server's temp folder and throwing 500 errors" Tags="&lt;assets&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25372" PostTypeId="2" ParentId="25371" CreationDate="2018-03-27T08:04:04.487" Score="3" Body="&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;Crappy shared web hosting?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That would be my guess. It seems imprudent to be developing a site on the same host as a live site, it has to share the (probably already stretched) resources available on a shared host and there isn't enough juice to run everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution? Get a $5 VPS, and see how it runs there. In my experience a properly configured $5 VPS will out-perform shared / managed hosting costing 5x the price. Most VPS can be billed by the hour/minute, so if you don't like it just cancel and you'll be charged only a few pennies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I would recommend &lt;a href=&quot;https://www.linode.com/?r=5abaf1a88420eaf3475e707ae7fa5ef6c251e118&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linode&lt;/a&gt; + &lt;a href=&quot;https://serverpilot.io/a/4bdbbdca4403&quot; rel=&quot;nofollow noreferrer&quot;&gt;Serverpilot&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both services can be cancelled without notice, so there's really no tie-in or big gamble.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastEditorUserId="3679" LastEditDate="2018-03-27T08:44:09.043" LastActivityDate="2018-03-27T08:44:09.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25373" PostTypeId="1" CreationDate="2018-03-27T11:37:37.487" Score="3" ViewCount="1081" Body="&lt;p&gt;I'm working on a plugin in Craft 3 that is fetching a file reference (URL) via an API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to fetch the file and save it locally as an Asset. I've tried to do this via &lt;code&gt;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement()&lt;/code&gt; but am getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;New Location cannot be blank.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this issue or where to dig a bit deeper to resolve?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole &lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-07-02T17:53:29.263" Title="Saving asset programatically, eg via API" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25374" PostTypeId="2" ParentId="25373" CreationDate="2018-03-27T11:43:14.727" Score="3" Body="&lt;p&gt;Not an answer directly to your question but a general function to upload an asset in PHP. In my case &lt;code&gt;$file&lt;/code&gt; is an uploaded file in the &lt;code&gt;$_FILES&lt;/code&gt; array. You can &lt;a href=&quot;https://stackoverflow.com/questions/3938534/download-file-to-server-from-url&quot;&gt;download a file per url&lt;/a&gt; and insert it's &lt;code&gt;tmp_name&lt;/code&gt; and &lt;code&gt;name&lt;/code&gt; manually&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Upload a file&#xA; *&#xA; * @param $file&#xA; * @return int|null|string&#xA; * @throws \Throwable&#xA; * @throws \craft\errors\ElementNotFoundException&#xA; * @throws \yii\base\Exception&#xA; */&#xA;public function uploadImage($file)&#xA;{&#xA;    $assets = Craft::$app-&amp;gt;getAssets();&#xA;    $folderId = 1; //&amp;lt;- insert your folder id&#xA;&#xA;    /** @var \craft\models\VolumeFolder $folder */&#xA;    $folder = $assets-&amp;gt;findFolder(['id' =&amp;gt; $folderId]);&#xA;&#xA;    $asset = new Asset();&#xA;    $asset-&amp;gt;tempFilePath = $file['tmp_name'];&#xA;    $asset-&amp;gt;filename = $file['name'];&#xA;    $asset-&amp;gt;newFolderId = $folder-&amp;gt;id;&#xA;    $asset-&amp;gt;volumeId = $folder-&amp;gt;volumeId;&#xA;    $asset-&amp;gt;avoidFilenameConflicts = true;&#xA;    $asset-&amp;gt;setScenario(Asset::SCENARIO_CREATE);&#xA;&#xA;    $result = Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($asset);&#xA;&#xA;    // In case of error, let user know about it.&#xA;    if ($result === false) {&#xA;        throw new Exception('Error while upload asset');&#xA;    }&#xA;&#xA;    return $asset-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-27T11:43:14.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25375" PostTypeId="1" CreationDate="2018-03-27T12:43:00.300" Score="1" ViewCount="188" Body="&lt;p&gt;Is it possible to fulfil orders partially? For instance when only two of four products are in stock, would it be possible to ship the two items immediately?&lt;/p&gt;&#xA;" OwnerUserId="8167" LastEditorUserId="340" LastEditDate="2018-03-28T23:08:21.017" LastActivityDate="2018-03-28T23:08:21.017" Title="Partial Order Fulfillment" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;workflow&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25376" PostTypeId="2" ParentId="25370" CreationDate="2018-03-27T14:41:02.300" Score="1" Body="&lt;p&gt;If this is Commerce 2, you're probably looking for the &lt;a href=&quot;https://github.com/craftcms/commerce-stripe/blob/master/src/gateways/Gateway.php#L81&quot; rel=&quot;nofollow noreferrer&quot;&gt;buildGatewayRequest&lt;/a&gt; event. From the transaction property set on that event, you should be able to get the Order and all the products.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2018-03-27T16:55:51.593" LastActivityDate="2018-03-27T16:55:51.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25377" PostTypeId="1" AcceptedAnswerId="25948" CreationDate="2018-03-27T15:15:35.433" Score="2" ViewCount="591" Body="&lt;p&gt;I found this question &quot;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2556/404-page-not-showing&quot;&gt;404 Page Not Showing&lt;/a&gt;&quot; asked 3 years ago that the person who asked figured it out but didn't really expand on how they did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have basically the same issue, craft doesn't load the 404 error ever, it simply loads the template with nothing.&#xA;&lt;a href=&quot;https://footwearoutfitters.net/123&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://footwearoutfitters.net/123&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't edited any .htaccess files&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Routes is left unmodified, both in the CP and the file itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if I setup my entries incorrectly for the URI, anyone have ideas or think of somewhere else I could give info on to help this along?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my .htaccess folder in the public&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;  RewriteEngine On&#xA;&#xA;  # Send would-be 404 requests to Craft&#xA;  RewriteCond %{REQUEST_FILENAME} !-f&#xA;  RewriteCond %{REQUEST_FILENAME} !-d&#xA;  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;  RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2018-03-27T15:31:19.823" LastActivityDate="2018-05-01T17:04:18.393" Title="404 error page not loading" Tags="&lt;404-page&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25378" PostTypeId="1" CreationDate="2018-03-27T15:28:32.913" Score="2" ViewCount="4317" Body="&lt;p&gt;I am creating a calendar for displaying films and their screening times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have a quite convoluted mechanism of retrieving data from the &quot;films&quot; channel, where I have a supertable for &quot;filmScreenings&quot;, which contain values for &quot;theater&quot; for name of the theater and &quot;starts&quot; which is a datetime for when the screening starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to create a multidimensional array for storing the films and screenings per theater. This is what I would like to accomplish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;screeningsForTheater  = {&#xA;  &quot;Theater 1&quot; : [&#xA;    { &quot;film&quot; : &quot;Movie 1&quot;, &quot;starts&quot; : &quot;09:00&quot; },&#xA;    { &quot;film&quot; : &quot;Movie 2&quot;, &quot;starts&quot; : &quot;11:30&quot; },&#xA;    { &quot;film&quot; : &quot;Movie 3&quot;, &quot;starts&quot; : &quot;13:30&quot; }&#xA;  ],&#xA;  &quot;Theater 2&quot; : [&#xA;    { &quot;film&quot; : &quot;Movie 4&quot;, &quot;starts&quot; : &quot;09:30&quot; },&#xA;    { &quot;film&quot; : &quot;Movie 5&quot;, &quot;starts&quot; : &quot;11:00&quot; },&#xA;    { &quot;film&quot; : &quot;Movie 6&quot;, &quot;starts&quot; : &quot;13:00&quot; },&#xA;    { &quot;film&quot; : &quot;Movie 7&quot;, &quot;starts&quot; : &quot;21:00&quot; }&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From here on I would be able to loop screenings displaying films and their screenings in the correct column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Theater 1         Theater 2&#xA;Movie 1, 09:00    Movie 4, 09:30&#xA;Movie 2, 11:30    Movie 5, 11:30&#xA;Movie 3, 13:30    Movie 6, 13:00&#xA;                  Movie 7, 21:00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the twig-code for trying to create this kind of array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set screeningsForTheater = {} %}&#xA;&#xA;{% for film in films %}&#xA;  {% for screening in film.screenings %}&#xA;&#xA;  {% set starts = screening.starts %}&#xA;  {% set ends = &quot;calc starts + length in minutes&quot; %}&#xA;&#xA;  {% set screeningsForTheater = screeningsForTheater | merge(&#xA;    { &#xA;      (screening.theater.label) : [&#xA;        { &quot;film&quot; : film.title, &quot;url&quot; : film.url, &quot;starts&quot; : starts, &quot;ends&quot; : ends, &quot;length&quot; : film.length }&#xA;      ] &#xA;    }&#xA;  ) %}&#xA;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What happens is that the values for keys &quot;Theater 1&quot; and &quot;Theater 2&quot; are being replaced as the loop progresses. In the end I have an array that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;screeningsForTheater = {&#xA;  &quot;Theater 1&quot; : [{ &quot;film&quot; : &quot;Movie 3&quot; ... }],&#xA;  &quot;Theater 2&quot; : [{ &quot;film&quot; : &quot;Movie 7&quot; ... }]&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I cant quite understand how to correctly push screenings into screeningsForTheater[theater] - any help you could offer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running Craft 2.6 if it has anything to do with Twig syntax.&lt;/p&gt;&#xA;" OwnerUserId="8169" LastActivityDate="2018-03-29T15:04:05.480" Title="Merge a multidimensional array" Tags="&lt;templating&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25379" PostTypeId="1" AcceptedAnswerId="25380" CreationDate="2018-03-27T15:50:37.630" Score="1" ViewCount="186" Body="&lt;p&gt;Is there a way to restrict the list of countries available in the checkout shipping address select menu to the countries assigned in the shipping zones? &lt;/p&gt;&#xA;" OwnerUserId="649" LastActivityDate="2018-03-27T16:05:24.037" Title="Limit countries shown in checkout shipping to countries assigned in shipping zones settings?" Tags="&lt;plugin-craftcommerce&gt;&lt;shipping&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25380" PostTypeId="2" ParentId="25379" CreationDate="2018-03-27T16:05:24.037" Score="1" Body="&lt;p&gt;You would need to either &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Delete all the countries you don't use within your site in &lt;code&gt;commerce &amp;gt; settings &amp;gt; countries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Simply hide them in twig with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allowedCountryIds = [1,3,4,6,7] %}&#xA;{% for key, country in craft.commerce.countriesList %}&#xA;  {% if key in allowedCountryIds %}&#xA;    &amp;lt;option value=&quot;{{ key }}&quot;&amp;gt;{{ option }}&amp;lt;/option&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-27T16:05:24.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25381" PostTypeId="2" ParentId="25375" CreationDate="2018-03-27T16:07:26.187" Score="1" Body="&lt;p&gt;There is nothing stopping you from shipping what you want whenever, but there is no way to mark a line item as shipped. You would need to have custom fields on your order to track partial shipments, and if you wanted, a 'partially shipped' order status to be able to easily see partially shipped orders in the order index page.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-27T16:07:26.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25382" PostTypeId="1" AcceptedAnswerId="25384" CreationDate="2018-03-27T16:26:12.193" Score="1" ViewCount="33" Body="&lt;p&gt;I am building a pagination layout limiting the content to 10 because, well, it makes sense to break down large amounts of content to smaller chunks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as there is so much, a user might want to toggle how many they want to see. But because the pagination limit is done in the twig variables, is there a built in method for updating this on user interactions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard CraftCMS pagination code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(10) as pageInfo, pageItems %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-03-27T18:02:34.193" Title="Allowing the user to update a CraftCMS pagination limit with listing filter options" Tags="&lt;forloop&gt;&lt;pagination&gt;&lt;loop&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25383" PostTypeId="1" AcceptedAnswerId="25389" CreationDate="2018-03-27T17:35:42.537" Score="1" ViewCount="50" Body="&lt;p&gt;When testing the indexing configuration, it would be nice to specifically target a testing index. I obviously don't want to disrupt the live data while I make some configuration adjustments. In Algolia, I can clone an index, and rename it something like &lt;code&gt;mydata_test&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to target different indices from different environments?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-03-28T09:43:00.627" Title="Search Plus: Target different indices from different environments" Tags="&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25384" PostTypeId="2" ParentId="25382" CreationDate="2018-03-27T18:02:34.193" Score="2" Body="&lt;p&gt;You could create a form/a link with the limit and add the parameter in your &lt;code&gt;$_GET&lt;/code&gt; request or as a &lt;a href=&quot;https://craftcms.com/docs/templating/craft.request#segments&quot; rel=&quot;nofollow noreferrer&quot;&gt;segment&lt;/a&gt; to your url. This is just an example how to use it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;How many Entries would you like to get?&#xA;&amp;lt;a href=&quot;/?limit=10&quot;&amp;gt;10&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;/?limit=20&quot;&amp;gt;20&amp;lt;/a&amp;gt;&#xA;&amp;lt;a href=&quot;/?limit=30&quot;&amp;gt;30&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can fetch this parameter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set limit = craft.request.getQuery('limit', 10) %}&#xA;{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(limit) as pageInfo, pageItems %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you have to attach this parameter to your paginate links as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}?limit={{ limit }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are definitely better solutions but they require more time and more effort and a plugin/php but this would be the easiest solution &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-27T18:02:34.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25385" PostTypeId="2" ParentId="20520" CreationDate="2018-03-27T19:51:11.723" Score="2" Body="&lt;p&gt;Could you please let us know where do you output the &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt;tag?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% do craft.sproutSeo.meta({&lt;/code&gt; tag need to be called before the &lt;code&gt;optimize&lt;/code&gt; tag. I'll give you a basic example of how you can do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that you have a &lt;code&gt;_layout&lt;/code&gt; where you have the html &lt;code&gt;head&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    {% block head %}&#xA;        {% sproutseo 'optimize' %}&#xA;        ...&#xA;        ...&#xA;    {% endblock %}&#xA;    ...&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;section/_entry&lt;/code&gt; (extends your layout) When you need to override something with the &lt;code&gt;do craft.sproutSeo.meta&lt;/code&gt; you may need to call it before the &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt; so you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% set title = entry.title ~ &quot; - Blog&quot; %}&#xA;&#xA;{% block head %}&#xA;&#xA;    {% set cardEntryImage = craft.imager.transformImage(entry.blogHeaderImage.first(), { width: 1920, ratio: 16/9 }) %}&#xA;    {% do craft.sproutSeo.meta({&#xA;        ogImage: siteUrl ~ cardEntryImage.getUrl(),&#xA;        ogImageSecure: siteUrl ~ cardEntryImage.getUrl(),&#xA;        ogImageHeight: cardEntryImage.getHeight(),&#xA;        ogImageWidth: cardEntryImage.getWidth(),&#xA;        ogImageType: cardEntryImage.getMimeType(),&#xA;        twitterImage: siteUrl ~ cardEntryImage.getUrl()&#xA;    }) %}&#xA;    {{ parent() }}&#xA;&#xA;    ...&#xA;    ...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Best,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Andre L&lt;/p&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="115" LastEditDate="2018-03-28T07:21:27.727" LastActivityDate="2018-03-28T07:21:27.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25386" PostTypeId="1" CreationDate="2018-03-27T20:44:07.740" Score="1" ViewCount="497" Body="&lt;p&gt;I'm using Laravel Valet with Craft 3 (Craft 3.0.0-RC13) and Sequel Pro. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get Craft to update. I just get a warning sign and a message saying that it couldn't back up the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I looked at my log file, it contained the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;FROM &lt;code&gt;craft_info&lt;/code&gt;&#xA;  2018-03-27 09:54:43 [127.0.0.1][1][-][error][craft\controllers\UpdaterController::actionBackup] Error backing up the database: The shell command &quot;mysqldump --defaults-extra-file=&quot;/Users/richardclark/Sites/lorindafontainefarris/storage/runtime/temp/my.cnf&quot; --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file=&quot;/Users/richardclark/Sites/lorindafontainefarris/storage/backups/lorinda-fontaine-farris_180327_135443_jfivi9ibwf_v3.0.0-rc16.1.sql&quot; lorindafontainefarris &amp;amp;&amp;amp; mysqldump --defaults-extra-file=&quot;/Users/richardclark/Sites/lorindafontainefarris/storage/runtime/temp/my.cnf&quot; --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=lorindafontainefarris.craft_assetindexdata --ignore-table=lorindafontainefarris.craft_assettransformindex --ignore-table=lorindafontainefarris.craft_cache --ignore-table=lorindafontainefarris.craft_sessions --ignore-table=lorindafontainefarris.craft_templatecaches --ignore-table=lorindafontainefarris.craft_templatecachecriteria --ignore-table=lorindafontainefarris.craft_templatecacheelements lorindafontainefarris &gt;&gt; &quot;/Users/richardclark/Sites/lorindafontainefarris/storage/backups/lorinda-fontaine-farris_180327_135443_jfivi9ibwf_v3.0.0-rc16.1.sql&quot;&quot; failed with exit code 127: sh: mysqldump: command not found&#xA;  2018-03-27 09:54:43 [127.0.0.1][1][-][info][application] $_GET = [&#xA;      'p' =&gt; 'admin/actions/updater/backup'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried adding a PATH reference to my export &lt;code&gt;PATH=$PATH:~/.local/bin/mysqldump&lt;/code&gt; in the &lt;code&gt;.bash_profile&lt;/code&gt; file, but that didn't seem to do anything. Do I have to add something to the &lt;code&gt;CraftValetDriver&lt;/code&gt; file, or is my PATH reference incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Richard&lt;/p&gt;&#xA;" OwnerUserId="8170" LastEditorUserId="5557" LastEditDate="2018-03-27T20:48:50.390" LastActivityDate="2018-04-27T16:40:56.727" Title="Craft 3 wont update in Laravel Valet development enviornment" Tags="&lt;database&gt;&lt;craft3&gt;&lt;updating&gt;&lt;valet&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25387" PostTypeId="2" ParentId="25378" CreationDate="2018-03-28T07:16:08.670" Score="3" Body="&lt;p&gt;Ok, I managed to figure it out following directions on this page:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4360/creating-dynamic-array-and-set-keys&quot;&gt;Creating dynamic array and set keys&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filmData = { &quot;film&quot; : film.title, &quot;url&quot; : film.url, &quot;starts&quot; : starts, &quot;ends&quot; : ends, &quot;length&quot; : film.length } %}&#xA;&#xA;{% if not attribute(screeningsForTheater, screening.theater.label) is defined %}&#xA;&#xA;    {% set screeningsForTheater = screeningsForTheater | merge({ (screening.theater.label) : [filmData] }) %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set otherFilms = attribute(screeningsForTheater, screening.theater.label) %}&#xA;    {% set otherFilms = otherFilms | merge([filmData]) %}&#xA;    {% set screeningsForTheater = screeningsForTheater|merge({ (screening.theater.label) : otherFilms }) %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I realized I had to create another level to the array by including the date of the screening. This was the format needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;screenings = {&#xA;  &quot;22.3.2018&quot; : {&#xA;    &quot;Theater 1&quot; : {&#xA;      &quot;Movie 1&quot; : { ... },&#xA;      &quot;Movie 2&quot; : { ... }&#xA;    },&#xA;    &quot;Theater 2&quot; : {&#xA;      &quot;Movie 3&quot; : { ... },&#xA;      &quot;Movie 4&quot; : { ... }&#xA;    }&#xA;  },&#xA;  &quot;23.3.2018&quot; : {&#xA;    &quot;Theater 1&quot; : {&#xA;      &quot;Movie 5&quot; : { ... },&#xA;      &quot;Movie 6&quot; : { ... }&#xA;    },&#xA;    &quot;Theater 2&quot; : {&#xA;      &quot;Movie 7&quot; : { ... },&#xA;      &quot;Movie 8&quot; : { ... }&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I spent some time trying to create this kind of array using twig, but couldn't get the merge to work correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then created a plugin and a templateVariable to do the search and array stuff using PHP, which was a lot more comfortable, and got this working in no time.&lt;/p&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="8169" LastEditDate="2018-03-29T15:04:05.480" LastActivityDate="2018-03-29T15:04:05.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25389" PostTypeId="2" ParentId="25383" CreationDate="2018-03-28T09:43:00.627" Score="1" Body="&lt;p&gt;You could check your config for an environment variable and change the name of the index that's searched depending on what environment you're in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my SearchPlus integration the index name is set as a data attribute on the search component, so it's possible to vary the index based on the environment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set indexName = 'myindex_test' %}&#xA;&#xA;{% if craft.config.craftEnv == 'production' %}&#xA;    {% set indexName = 'myindex_live' %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;div class=&quot;searchplus&quot; data-index-name=&quot;{{ indexName }}&quot;&amp;gt;&#xA;...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The search JavaScript reads in the data attributes on initialisation and sets up the Algolia index based on the value of &lt;code&gt;data-index-name&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I'm using this with Craft 2. I understand that you can access config values in Craft 3 via &lt;code&gt;craft.app.config.general.&amp;lt;value&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8173" LastActivityDate="2018-03-28T09:43:00.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25392" PostTypeId="1" CreationDate="2018-03-28T11:41:55.997" Score="1" ViewCount="168" Body="&lt;p&gt;This is almost a duplicate of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7194/order-entries-by-category-field/7196?noredirect=1#comment33302_7196&quot;&gt;this question&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a section which I want to sort by category field. But the categories are not mandatory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I apply &lt;code&gt;|group('refSorter.first().title')&lt;/code&gt; it will throw an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Key &quot;type&quot; for array with keys &quot;0, 1, 2, 3, and so on&quot;&#xA;  does not exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I did a workaround with a conditional statement but I guess there is a DRYer solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set refList = craft.entries.section('referenz') %}&#xA;{% set refCategories = craft.categories.group('referenzRubrik').relatedTo(refList) %}&#xA;&#xA; {% for category in refCategories %}&#xA;&#xA;    &amp;lt;h2&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {# testing if there is a category slug for preventing a error when no category is asigned #}&#xA;&#xA;    {% if category.slug == 'kantone' %}&#xA;&#xA;      {% for item in refList.relatedTo(category).order('title')|group('refSorter.first().title') %}&#xA;          {# this is beeing sorted via category title fields #}&#xA;      {% endfor %}&#xA;&#xA;    {% else %}&#xA;&#xA;      {% for item in refList.relatedTo(category).order('title') %}&#xA;        {# this is beeing sorted via entry title fields #}&#xA;      {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The must be a better way right?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2018-03-28T11:41:55.997" Title="Order Entries by Category Fields (with fallback)" Tags="&lt;categories&gt;&lt;relations&gt;&lt;ordering&gt;&lt;sorting&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25393" PostTypeId="1" AcceptedAnswerId="25396" CreationDate="2018-03-28T13:03:46.483" Score="2" ViewCount="374" Body="&lt;p&gt;I have a client who started a Craft CMS site with another developer. I guess the other developer quit, and now the client wants me to make some changes to the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site was created with Composer (which I haven't used before), and I'm stumped on how to get it installed on my local machine using MAMP. I ran Composer to install the dependencies, but there isn't a &quot;Craft&quot; folder and a &quot;Public&quot; folder like I'm used to seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a screenshot of the file structure.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Rk1GG.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rk1GG.jpg&quot; alt=&quot;file-structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any advice on how to get this site installed locally so I can make the changes requested?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!!&lt;/p&gt;&#xA;" OwnerUserId="8176" LastEditorUserId="45" LastEditDate="2018-03-28T15:18:11.500" LastActivityDate="2018-03-28T17:00:12.413" Title="Copy a Craft 3 site to my local machine (MAMP)" Tags="&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25395" PostTypeId="2" ParentId="25386" CreationDate="2018-03-28T13:14:40.550" Score="1" Body="&lt;p&gt;I believe we were conversing via Medium yesterday on this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question, I know for a fact your PATH reference is incorrect. The path to mysqldump is never &lt;code&gt;~/.local/bin/mysqldump&lt;/code&gt;; mine is located at &lt;code&gt;/usr/local/bin/mysqldump&lt;/code&gt; (I'm using MariaDB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;BUT&lt;/em&gt;&lt;/strong&gt; since you said on Medium that you're using MySQL (instead of MariaDB or another database option), you should use this instead: &lt;code&gt;export PATH=&quot;/usr/local/mysql/bin:$PATH&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you add that to your &lt;code&gt;.bash_profile&lt;/code&gt; and either &lt;a href=&quot;https://stackoverflow.com/a/4608197/4914302&quot;&gt;source the file&lt;/a&gt; or quit and relaunch terminal, &lt;code&gt;mysqldump&lt;/code&gt; should be working.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-03-28T13:14:40.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25396" PostTypeId="2" ParentId="25393" CreationDate="2018-03-28T13:26:57.330" Score="4" Body="&lt;p&gt;From what I see in your screenshot, it looks like you stumbled upon a &lt;a href=&quot;https://github.com/craftcms/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 installation&lt;/a&gt;, in which case neither a &lt;code&gt;Craft&lt;/code&gt; nor &lt;code&gt;Public&lt;/code&gt; folder exist.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Craft 3 specific&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; folder is now called &lt;code&gt;web&lt;/code&gt;, so that's where you should point your MAMP documentroot (or whatever that's called in MAMP). The Craft code is now located in composer's &lt;code&gt;vendor&lt;/code&gt; folder, that should magically appear after running &lt;code&gt;composer install&lt;/code&gt;. Craft's source would then be in &lt;code&gt;vendor/craftcms/cms&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about the overall structure of a Craft CMS 3 project in the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Frontend build tools and JS dependencies (package.json, webpack.mix.js)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Further more, I see that &lt;a href=&quot;https://laravel.com/docs/5.6/mix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laravel Mix&lt;/a&gt; is used for frontend (js, css) automization, meaning that you have to install JS dependencies by running &lt;code&gt;npm install&lt;/code&gt; or &lt;code&gt;yarn install&lt;/code&gt;, after which you can use the command defined in &lt;code&gt;package.json&lt;/code&gt; to run Mix. I guess this is something like &lt;code&gt;npm run watch&lt;/code&gt; (when developing) or &lt;code&gt;npm run prod&lt;/code&gt; before you push anything to production.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Modules&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;And: I see a &lt;code&gt;modules&lt;/code&gt; folder, that would most likely mean that a custom module was used for this specific site. Modules are a (poorly documented ;)) Craft 3 way of extending your site without building a plugin and trying to get that to work through composer. They are essentially a wrapper for Yii2's modules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's very possible that the Module is just vestigial, however, since that folder is created by default if you do &lt;code&gt;composer create-project -s RC craftcms/craft PATH&lt;/code&gt;. You can read more about Modules in the &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Environment settings&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Last but not least: copy &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt; and use that to set credentials for your environment (db settings and stuff).&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="819" LastEditDate="2018-03-28T13:56:36.483" LastActivityDate="2018-03-28T13:56:36.483" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25397" PostTypeId="1" CreationDate="2018-03-28T14:22:04.267" Score="1" ViewCount="253" Body="&lt;p&gt;I want to utilise the Category field type but with the ability to choose from multiple category sources (as with Entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noted in &lt;code&gt;cms/src/fields/Categories.php&lt;/code&gt; that &lt;code&gt;$this-&amp;gt;allowMultipleSources&lt;/code&gt; is set to false. What is the simplest way of changing this to true without changing the source file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I create a custom field that essentially just extends the original Category field but with &lt;code&gt;$this-&amp;gt;allowMultipleSources&lt;/code&gt; set to true?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-11-02T18:42:20.303" Title="Multiple Category Sources Field" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;craft3&gt;&lt;field&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25398" PostTypeId="2" ParentId="25397" CreationDate="2018-03-28T15:10:36.737" Score="1" Body="&lt;p&gt;Isnt this possible with the &lt;code&gt;modifyCategorySources&lt;/code&gt; hook?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#modifyentrysources-modifycategorysources-modifyassetsources-modifyusersources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#modifyentrysources-modifycategorysources-modifyassetsources-modifyusersources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming you are using C3 by the namespace you mentioned. Correct me if this is wrong :). &lt;/p&gt;&#xA;" OwnerUserId="7540" LastEditorUserId="9" LastEditDate="2018-11-02T18:42:20.303" LastActivityDate="2018-11-02T18:42:20.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25399" PostTypeId="2" ParentId="25386" CreationDate="2018-03-28T16:03:59.817" Score="1" Body="&lt;p&gt;I don’t know if the following will help with Valet, but I ran into the same problem today with my local Homebrew dev server. Despite having &lt;code&gt;/usr/local/bin&lt;/code&gt; in my PATH and mysqldump working just fine on the command line the backup task would fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checking the PHP info page revealed that Apache was running with a PATH setting of &lt;code&gt;/usr/bin:/bin:/usr/sbin:/sbin&lt;/code&gt;. So there’s your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After trying various different approaches for setting envvars and getting nowhere I eventually found that setting the PATH via the Apache launch daemon file did the job, per &lt;a href=&quot;https://stackoverflow.com/a/6834024/1777801&quot;&gt;this SO thread&lt;/a&gt; and &lt;a href=&quot;https://gist.github.com/srayhunter/5208619&quot; rel=&quot;nofollow noreferrer&quot;&gt;this gist&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my setup this meant editing &lt;code&gt;/usr/local/opt/httpd/homebrew.mxcl.httpd.plist&lt;/code&gt; and adding the following within the main &lt;code&gt;&amp;lt;dict&amp;gt;&lt;/code&gt; tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;key&amp;gt;EnvironmentVariables&amp;lt;/key&amp;gt;&#xA;  &amp;lt;dict&amp;gt;&#xA;   &amp;lt;key&amp;gt;PATH&amp;lt;/key&amp;gt;&#xA;   &amp;lt;string&amp;gt;/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin&amp;lt;/string&amp;gt;&#xA;  &amp;lt;/dict&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After adding that and running &lt;code&gt;brew services restart httpd&lt;/code&gt; my PATH finally updated and the export task started working.&lt;/p&gt;&#xA;" OwnerUserId="3327" LastActivityDate="2018-03-28T16:03:59.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25400" PostTypeId="2" ParentId="25397" CreationDate="2018-03-28T16:17:26.207" Score="1" Body="&lt;p&gt;Got there in the end and very simply through:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Craft;&#xA;use craft\fields\BaseRelationField;&#xA;use craft\elements\Category;&#xA;&#xA;class Categories extends BaseRelationField&#xA;{&#xA;&#xA;    public static function displayName(): string&#xA;    {&#xA;        return Craft::t('app', 'Categories (multiple)');&#xA;    }&#xA;&#xA;    protected static function elementType(): string&#xA;    {&#xA;        return Category::class;&#xA;    }&#xA;&#xA;    public static function defaultSelectionLabel(): string&#xA;    {&#xA;        return Craft::t('app', 'Add a category');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So simple&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-03-28T16:17:26.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25403" PostTypeId="1" AcceptedAnswerId="25415" CreationDate="2018-03-28T20:18:34.367" Score="1" ViewCount="361" Body="&lt;p&gt;Short story: I need your help sending value from dropdown selection as data to controller so my div updates with the filtered entries based on the selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story and code: I have a listing of entries in my template as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('live').find() %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I can filter those results with a field handle by updating the first line above with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('live').hostSite('weDo').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I'd like to filter that listing of entries with a dropdown list that contains the available field handles, ie 'weDo, 'theyDo':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;select class=&quot;filter&quot;&amp;gt;&#xA;    &amp;lt;option value=&quot;all&quot;&amp;gt;all sites&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;weDo&quot;&amp;gt;sites we host&amp;lt;/option&amp;gt;&#xA;    &amp;lt;option value=&quot;theyDo&quot;&amp;gt;sites they host&amp;lt;/option&amp;gt;&#xA;&amp;lt;/select&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to do this with Ajax and a controller I set up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;**Javascript**&#xA;// Add an event listener for filter clicks&#xA;$(function () {&#xA;    $('body').on('change', 'select.filter', onFilterClick);&#xA;});&#xA;&#xA;// Event handler for the filter click&#xA;function onFilterClick (e)&#xA;{&#xA;    e.preventDefault();&#xA;    var data = this.value;&#xA;&#xA;    $.ajax({&#xA;        method: 'get',&#xA;        url: 'actions/websiteListing/checkStatus',&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;    })&#xA;    .success(function(data) {&#xA;        $('.livelisting').html(data);&#xA;    })&#xA;    .error(function(data) {&#xA;        console.log('error', data);&#xA;    }); &#xA;}&#xA;**Controller**&#xA;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class WebsiteListingController extends BaseController&#xA;{&#xA;    protected $allowAnonymous = true;&#xA;&#xA;    public function actionCheckStatus()&#xA;    {&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;        $criteria-&amp;gt;section('live');&#xA;        $criteria-&amp;gt;hostSite = 'weDo';&#xA;        $criteria-&amp;gt;limit = null;&#xA;&#xA;        $entries = $criteria-&amp;gt;find();&#xA;&#xA;        foreach ($criteria as $entry) {&#xA;            echo $entry-&amp;gt;title . '&amp;lt;br&amp;gt;';&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know the ajax is pretty trashy, but the url to the controller file is working correctly because when I make a selection from the dropdown menu, my div.livelisting is replaced by the single entry available with the field handle of 'weDo'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's where your help is needed!&lt;/strong&gt; The 'weDo' value in my controller needs the data sent from Ajax. Thanks for your expertise.&lt;/p&gt;&#xA;" OwnerUserId="8181" LastEditorUserId="8181" LastEditDate="2018-03-28T20:29:29.663" LastActivityDate="2018-03-29T15:29:28.150" Title="Filter entries by ajax to controller" Tags="&lt;ajax&gt;&lt;filter&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25404" PostTypeId="1" CreationDate="2018-03-28T21:26:22.883" Score="1" ViewCount="19" Body="&lt;p&gt;Users with permissions to limited sections can still “link to an entry” in any section from within the WYSIWYG (Redactor) editor.  I'm using Craft 2 with a Rich Text (Redactor) field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or is there a way to fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some screenshots of the flow of what I'm talking about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ELJX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ELJX.jpg&quot; alt=&quot;Go to Entries and the sections are limited but if you link to an entry, you can see all sections&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6936" LastActivityDate="2018-03-28T21:26:22.883" Title="Section permissions are ignored when linking to an entry" Tags="&lt;redactor&gt;&lt;sections&gt;&lt;permissions&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25406" PostTypeId="2" ParentId="25375" CreationDate="2018-03-28T23:08:10.533" Score="1" Body="&lt;p&gt;To expand on Luke's answer a bit...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have implemented our own, pretty decent partial order fulfillment system.  In essence it is a matrix field (actually might be a SuperTable, but same same really) - on its own tab on the order, and a bunch of code that listens to &lt;code&gt;onOrderSaveHandler&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's super custom to our own processes so I haven't cleaned it up or made it a released plugin, I'm just presenting it here for info and inspiration (feel free to ask any questions though!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/urM4O.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/urM4O.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a bunch of different events that trigger different order statuses and emails, depending on what is chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1hfxc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1hfxc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a simple a tick-box system that lets you nominate what specific products are being updated in this update.  (Tick-boxes built with lj_dynamicfields plugin - &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lewisjenkins/craft-lj-dynamicfields&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, basically each time an order is saved, we check if there are any new events (and each time an event is added we increment a counter in the db to keep track of this).  If there are, we then action the event.  The processing is pretty complex and unique to us, but it does things like build tracking emails for shipments if needed, or trigger refund stuff, or raise/add to a ticket in our customer helpdesk system (we use Freshdesk) if we need to communicate anything more complex than a basic shipment or whatever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each update is saved to the order, so the matrix itself is both the entry mechanism for updates, and forms a log of events on the order (they are time/dated of course).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the order is finalised, i.e. the last thing is sent or cancelled or whatever, the processor sends the last update and ticks the 'complete' box and the order is marked as complete in commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example from a real order - in this case it's a one item order, but the system is fine with single or many items orders of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qzeim.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qzeim.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works really well for us.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could be improved further (and I might do this when I port it to Commerce 2) - by having an individual status field for each item within the order, and separating out back end notes from customer notes (we only have customer notes here, order notes are currently elsewhere).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, we have a separate system for just throwing in a tracking number without these events if the order is just fulfilled immediately from stock (as most are of course - on that first Notes &amp;amp; Simple Shipping tab..) - so these 'In Progress Events' are only used for  more complex things when really needed, and default order processing is kept as simple as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will say the integration to a ticketing system is a bit genius and really a whole big thing in and of itself that we use extensively elsewhere - it makes for a really easy to track order communication system...and is tied to the order status (ticket is closed when order is, etc) - but the basic connection is just one field with a ticket ID, if one has been created. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, to make all this really work, you also need all your email templates, and of course templates for your customer to see all this in their account etc., assuming you are going the accounts route.  It IS a fair chunk of work, but it has an absolutely massive impact on our efficiency - we spend just seconds on things that used to take minutes, with hand drafted emails etc etc - it's a major time (and thus money) saver.  I reckon we save an hour a day with it, on average.&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-03-28T23:08:10.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25407" PostTypeId="1" AcceptedAnswerId="25409" CreationDate="2018-03-28T23:51:57.453" Score="1" ViewCount="129" Body="&lt;p&gt;I see the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/front-end-address-lookup/&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs here&lt;/a&gt; about getting the lat/long of an address from a zip code, city, etc. I am having issues getting the map to render from this info. My code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.smartMap.visitor.ip != '' %}&#xA;    {% set locations = craft.smartMap.visitor.coords %}&#xA;{% else %}&#xA;    {% set locations = craft.smartMap.lookupCoords(90210) %}&#xA;{% endif %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Undefined index: fieldId&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How do I convert the lat/long result into one of the &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/render-a-map-in-twig/&quot; rel=&quot;nofollow noreferrer&quot;&gt;correct location types&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="45" LastEditDate="2021-01-01T07:06:52.437" LastActivityDate="2021-01-01T07:06:52.437" Title="Using front end lookup for map display" Tags="&lt;craft3&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25408" PostTypeId="2" ParentId="25407" CreationDate="2018-03-29T01:07:54.180" Score="0" Body="&lt;p&gt;Actually you can check google map api directly other than using map plugins&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-03-29T01:07:54.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25409" PostTypeId="2" ParentId="25407" CreationDate="2018-03-29T05:52:57.070" Score="1" Body="&lt;p&gt;Let me start with a minor side note... You'll want to change the first line to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.smartMap.visitor.ip %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's better to test against a &quot;falsey&quot; IP address, instead of explicitly testing for an empty string. I believe the IP address would resolve to &lt;code&gt;false&lt;/code&gt; if nothing was found. Either way, a general &quot;falsey&quot; check will work as expected here.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It's not currently possible to convert a raw set of coordinates into a more complex object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, you could fairly easily do it using the built-in &lt;code&gt;smartMap&lt;/code&gt; JavaScript object...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get visitor's coordinates #}&#xA;{% if craft.smartMap.visitor.ip %}&#xA;    {% set coords = craft.smartMap.visitor.coords %}&#xA;    {% set jsCoords = 'smartMap.coords(' ~ coords[0] ~ ', ' ~ coords[1] ~ ')' %}&#xA;{% else %}&#xA;    {% set coords = craft.smartMap.lookupCoords(90210) %}&#xA;    {% set jsCoords = 'smartMap.coords(' ~ coords['lat'] ~ ', ' ~ coords['lng'] ~ ')' %}&#xA;{% endif %}&#xA;&#xA;{# Blank map #}&#xA;{{ craft.smartMap.map([], options) }}&#xA;&#xA;{# Add visitor marker #}&#xA;{% js %}&#xA;    smartMap.createMarker('visitor-marker', {&#xA;        position: {{ jsCoords }},&#xA;        map: smartMap.map['smartmap-mapcanvas-1'],&#xA;    });&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; I fixed a bug in v3.0.5 which makes this even easier.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-03-29T18:55:38.420" LastActivityDate="2018-03-29T18:55:38.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25410" PostTypeId="1" AcceptedAnswerId="25422" CreationDate="2018-03-29T11:13:12.237" Score="1" ViewCount="592" Body="&lt;p&gt;When i load my fonts with &lt;code&gt;@font-face&lt;/code&gt; trough the &lt;code&gt;/templates/&lt;/code&gt; folder, I get these errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Failed to decode downloaded font: &amp;lt;URL&amp;gt;&#xA;OTS parsing error: Failed to convert WOFF 2.0 font to SFNT&#xA;OTS parsing error: incorrect file size in WOFF header&#xA;DevTools failed to parse SourceMap: http://crafttest.test/assets/css/css.css.map&#xA;OTS parsing error: prep: table overruns end of file&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if I put the fonts in the /public/ folder they work perfectly. What my question is, is the bad practice to put them there, and why is it throwing these errors in the /templates/ folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also: it's not a wrong url issue, tried changing it, and got a 404.&lt;/p&gt;&#xA;" OwnerUserId="8184" LastEditorUserId="5557" LastEditDate="2018-03-29T19:48:32.780" LastActivityDate="2018-03-29T23:19:02.427" Title="Custom font issue" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25411" PostTypeId="1" AcceptedAnswerId="25412" CreationDate="2018-03-29T11:15:51.767" Score="1" ViewCount="278" Body="&lt;p&gt;Is it possible to eagerLoad fields in categories?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this code;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markets = craft.categories.group({&#xA;  section: 'markets',&#xA;  with: ['bannerImage']&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which for some reason is throwing an error;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;mb_convert_case() expects parameter 1 to be string, array given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this a bug or something bad in my code? Removing the with call and it renders fine.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="45" LastEditDate="2018-03-29T13:47:56.780" LastActivityDate="2018-03-29T13:47:56.780" Title="Eager loading fields within categories" Tags="&lt;categories&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25412" PostTypeId="2" ParentId="25411" CreationDate="2018-03-29T11:35:01.600" Score="3" Body="&lt;p&gt;This is basically just a syntax error. What you are doing is: searching for entries in the group &lt;code&gt;section: 'markets', with: ['bannerImage']&lt;/code&gt; but what you want is searching for categories in the group &lt;code&gt;markets&lt;/code&gt; with the field &lt;code&gt;bannerImage&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set markets = craft.categories.group('markets').with(['bannerImage']).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;group&lt;/code&gt; parameter in your &lt;code&gt;CategoryQuery&lt;/code&gt; defined which group(s) you want to select. The &lt;code&gt;with&lt;/code&gt; parameter your eager-loading elements. Btw: &lt;code&gt;Categories&lt;/code&gt; have no &lt;code&gt;section&lt;/code&gt; property&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-03-29T11:35:01.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25413" PostTypeId="2" ParentId="17315" CreationDate="2018-03-29T11:59:25.970" Score="1" Body="&lt;p&gt;So if i understand your question correctly what you are trying to achieve is to get used data of a user that is trying to log in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's login controller will call the userSessionService-&gt;login() method which in turn will call the loginByUserId method. This method has two events attached to it - the onBeforeLogin and the onLogin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- onBeforeLogin is called before anything is really created.&#xA;-- onLogin is called if the login was succesfull. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you listed to the onLogin method you get the param username. Craft will already have validated this username and logged it in - so you know it is good. You can then call&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;users-&amp;gt;getUserByUsernameOrEmail($yourUsernameVar);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which will return a populated UserModel. Hope it helps in some way&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-03-29T11:59:25.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25415" PostTypeId="2" ParentId="25403" CreationDate="2018-03-29T13:49:25.663" Score="1" Body="&lt;p&gt;I did a little more research on Ajax and found a solution. I updated my Ajax such that the data line looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    method: 'get',&#xA;    url: 'actions/websiteListing/checkStatus',&#xA;    data: {filter: data},&#xA;    headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my controller, I was able to pass that data by adding $filter to the first line and including that for my 3rd $criteria line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCheckStatus($filter)&#xA;{&#xA;    $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $criteria-&amp;gt;section = ('live');&#xA;    $criteria-&amp;gt;hostSite = $filter;&#xA;    $criteria-&amp;gt;limit = null;&#xA;&#xA;    $entries = $criteria-&amp;gt;find();&#xA;&#xA;    foreach ($criteria as $entry) {&#xA;        echo $entry-&amp;gt;title . '&amp;lt;br&amp;gt;';&#xA;    }&#xA;    die();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8181" LastEditorUserId="8181" LastEditDate="2018-03-29T15:29:28.150" LastActivityDate="2018-03-29T15:29:28.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25416" PostTypeId="1" AcceptedAnswerId="25420" CreationDate="2018-03-29T15:56:00.247" Score="2" ViewCount="1707" Body="&lt;p&gt;Craft 3 now supports PostgreSQL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this a very general question, but:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have absolutely no experience with PostgreSQL&lt;/li&gt;&#xA;&lt;li&gt;I don't know when should I use it instead of MySQL&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To quote &lt;a href=&quot;https://github.com/craftcms/cms/issues/832&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bob Olde Hampsink&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;PostgreSQL is the most innovative and hot database engine at the&#xA;  moment. It has better UTF-8 support and better overall performance.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Also, for example, on Heroku it is much cheaper to host with Postgres&#xA;  than with MySQL. Thus it becomes more attractive for people to pick a&#xA;  CMS/framework with Postgres support.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there another good reasons to know, to choose one instead of the other when starting a new project? For example, in general what would be the gains in terms of performance, compared to MySQL?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2018-03-30T07:44:16.903" LastActivityDate="2018-03-30T07:44:16.903" Title="Craft 3 : What are the advantages to use PostgreSQL and when should I use it instead of MySQL?" Tags="&lt;database&gt;&lt;craft3&gt;&lt;postgresql&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25418" PostTypeId="1" CreationDate="2018-03-29T16:08:40.650" Score="1" ViewCount="51" Body="&lt;p&gt;I am looking to use a matrix field for my site navigation that has some dropdowns. Using a table field within a matrix field seems like it would work but I don't know how to access the table inside the matrix field in my template. Is this possible. &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-03-29T16:20:07.883" Title="Can you store a table field within a matrix field?" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25419" PostTypeId="2" ParentId="25418" CreationDate="2018-03-29T16:20:07.883" Score="1" Body="&lt;p&gt;I figured it out. You can do it. Here is my example. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in mainNavigation.navigationLink %}&#xA;            &amp;lt;a class=&quot;navbar-item {{ block.className }}&quot; href=&quot;{{ block.linkUrl }}&quot;&amp;gt;&#xA;                {{ block.linkName }}&#xA;            &amp;lt;/a&amp;gt;&#xA;&#xA;                {% if block.childLinks | length %}&#xA;                &amp;lt;div class=&quot;navbar-dropdown is-boxed&quot;&amp;gt;&#xA;                    {% for row in block.childLinks %}&#xA;                        &amp;lt;a class=&quot;navbar-item&quot; href=&quot;&quot;&amp;gt;{{ row.childLinkName }}&amp;lt;/a&amp;gt;&#xA;                     {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                 {% endif %}&#xA;&#xA;&#xA;        {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-03-29T16:20:07.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25420" PostTypeId="2" ParentId="25416" CreationDate="2018-03-29T16:22:31.260" Score="4" Body="&lt;p&gt;This isn't actual first-hand experience talking, but from what I've read, Postgres will start to see gains when we're talking about very large data sets, either in terms of the size of the columns, or the number of rows in a particular table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the quote above, Postgres also has some other nicities as well. The downside is that there is less tooling around Postgres than there is MySQL, so while you'll be able to find GUI clients, they aren't there in quantity or quality compared to MySQL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have had &lt;a href=&quot;https://devmode.fm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode.fm&lt;/a&gt; up and running with Craft 3 and Postgres since day 1, in part to get &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt; working with it (which it does) since it's a supported database type by Craft now, and then also in part just to kick the tires.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can tell you is that everything &quot;just works&quot; from a Craft POV. I haven't had any issues at all with the Craft APIs, and since I do the database syncing with &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt;, the tooling hasn't matter either (but the editor I user is PhpStorm, which can connect to Postgres databases anyway).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will most likely have to learn a bit about about Postgres handles access permissions, because it's quite different from MySQL, but that's not so bad really.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After using it for a while, my conclusion is that it works fine; but on a small site like &lt;a href=&quot;https://devmode.fm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode.fm&lt;/a&gt;, it probably makes absolutely no difference. Because it doesn't have any large db columns or massive numbers of rows of the like. You'd never notice the difference from a frontend/AdminCP POV in terms of which db driver you're using, which is a testament to the work that P&amp;amp;T and the Yiisoft folks have done.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-03-29T20:29:02.157" LastActivityDate="2018-03-29T20:29:02.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25422" PostTypeId="2" ParentId="25410" CreationDate="2018-03-29T23:19:02.427" Score="1" Body="&lt;p&gt;You should put your site's assets (images, CSS, fonts, etc.) in your site's public HTML folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you put them into Craft's &lt;code&gt;templates&lt;/code&gt; folder, then not only will you invoke Craft/PHP overhead when trying to serve those files (which will be significant instead of having your web server serve them directly), but &quot;bad things&quot; can happen when PHP tries to serve them (like you've discovered).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-03-29T23:19:02.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25424" PostTypeId="1" CreationDate="2018-03-31T20:20:07.333" Score="2" ViewCount="166" Body="&lt;p&gt;I migrated a site with over 500 posts from Wordpress to Craft 2.6 recently but came across this problem: the WP site used to set post's urls as &lt;code&gt;https://mysite.com/{slug}&lt;/code&gt; while the new blog is (correctly) saving them to &lt;code&gt;https://mysite.com/blog/{slug}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, a lot of the post entries have great SEO positiong and I don't want to lose that, what is the best way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="7208" LastActivityDate="2018-04-03T03:09:44.760" Title="Change posts url without losing SEO positioning" Tags="&lt;url&gt;&lt;seo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25425" PostTypeId="2" ParentId="25424" CreationDate="2018-03-31T21:31:39.940" Score="3" Body="&lt;p&gt;Use a plugin like &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retour&lt;/a&gt; to do a 301 redirect.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-31T21:31:39.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25426" PostTypeId="2" ParentId="23710" CreationDate="2018-03-31T21:33:49.513" Score="3" Body="&lt;p&gt;If you're using &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; for Craft CMS 3, there's a built-in function that will make it super easy to do: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;seomatic.helper.getLocalizedUrls(URI, SITE_ID)&lt;/code&gt;&lt;/strong&gt; - Return a list of localized URLs for a given &lt;code&gt;URI&lt;/code&gt; that are in the &lt;code&gt;SITE_ID&lt;/code&gt; site's group. Both &lt;code&gt;URI&lt;/code&gt; and &lt;code&gt;SITE_ID&lt;/code&gt; are optional, and will use the current request's &lt;code&gt;URI&lt;/code&gt; and the current site's &lt;code&gt;SITE_ID&lt;/code&gt; if omitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-03-31T21:33:49.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25427" PostTypeId="1" AcceptedAnswerId="25430" CreationDate="2018-04-01T05:04:09.173" Score="8" ViewCount="1992" Body="&lt;p&gt;In Craft 2, it was possible to have your plugin log to a separate file. For example, it would record items to a &lt;code&gt;myplugin.log&lt;/code&gt; file. You would simply be able to do it like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;MyPlugin::log('Lorem ipsum');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I can't seem to figure out how this would be done in Craft 3. I've seen &lt;a href=&quot;https://craftcms.stackexchange.com/a/24082/45&quot;&gt;this answer&lt;/a&gt;, which demonstrates how to log items in Craft 3 in general. But that just dumps items into the shared &lt;code&gt;web.log&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I log items to &lt;code&gt;myplugin.log&lt;/code&gt; in Craft 3?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2020-02-12T20:59:15.393" Title="Craft 3 plugins - Logging in a separate *.log file" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;logs&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25428" PostTypeId="1" AcceptedAnswerId="25429" CreationDate="2018-04-01T08:07:16.463" Score="1" ViewCount="28" Body="&lt;p&gt;I am having trouble getting images by name. &lt;code&gt;craft.assets.first()&lt;/code&gt; function in assets gives the proper output of one image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try &lt;code&gt;craft.assets.filename('flag.jpg')&lt;/code&gt;, craft shows the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Same with other functions of assets. Please help me solve this error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="8186" LastEditorUserId="5557" LastEditDate="2018-04-01T09:47:07.380" LastActivityDate="2018-04-01T09:47:07.380" Title="Error using assets operations" Tags="&lt;templating&gt;&lt;assets&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25429" PostTypeId="2" ParentId="25428" CreationDate="2018-04-01T08:53:40.920" Score="2" Body="&lt;p&gt;Please read the docs about &lt;a href=&quot;https://craftcms.com/docs/templating/elementcriteriamodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementCriteriaModel&lt;/a&gt; &lt;code&gt;craft.assets&lt;/code&gt; returns you an element of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt; so you can define criteria for your search. In order to fetch the elements you have to do &lt;code&gt;first()&lt;/code&gt;, &lt;code&gt;find()&lt;/code&gt;, &lt;code&gt;last()&lt;/code&gt; or certain other functions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.assets.filename('flag.jpg').first()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-01T08:53:40.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25430" PostTypeId="2" ParentId="25427" CreationDate="2018-04-01T09:31:07.517" Score="10" Body="&lt;h3&gt;Edit 2&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I came up with a far far far better approach after a little brainstorming. I'll keep my old answer here but you should probably just use the first snipped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your main Pluginfile.php&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public static function log($message){&#xA;    Craft::getLogger()-&amp;gt;log($message, \yii\log\Logger::LEVEL_INFO, 'your-plugin-handle');&#xA;}&#xA;&#xA;public function init(){&#xA;    $fileTarget = new \craft\log\FileTarget([&#xA;        'logFile' =&amp;gt; __DIR__ . '/pluginName.log', // &amp;lt;--- path of the log file&#xA;        'categories' =&amp;gt; ['your-plugin-handle'] // &amp;lt;--- categories in the file&#xA;    ]);&#xA;    // include the new target file target to the dispatcher&#xA;    Craft::getLogger()-&amp;gt;dispatcher-&amp;gt;targets[] = $fileTarget;&#xA;    ....&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: &lt;code&gt;categories&lt;/code&gt; is an array of all categories that should be in the log file. You usually want to allow only categories of your own plugin (you have to use an unique identifier in case certain other developers try to add the same category). Whenever you want to log something with the Craft/Yii &lt;code&gt;log&lt;/code&gt; method that match one of your given categories in the array it will be logged in your file as well.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Old answer&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Create this file somewhere in your plugin&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;FileTarget&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class FileTarget extends \yii\log\FileTarget{&#xA;&#xA;    // an array of categories that should be logged&#xA;    // note: your target receives all `Yii::log()` messages&#xA;    // but you can filter them with this array&#xA;    // if you want to track all messages of type 'application' as well&#xA;    // just include it in the array&#xA;    public $categories = ['a-category-that-you-would-like-to-log']; //&amp;lt;- usually your plugin handle or something&#xA;&#xA;    // set the file path&#xA;    public function setLogFile($path = __DIR__){&#xA;        // I'm lazy so I just use the current location since it's in my 'src/' folder anyway &#xA;        // you can use Crafts default folders or whatever you like&#xA;        $this-&amp;gt;logFile = $path . '/test.log';&#xA;        return $this;&#xA;    }&#xA;&#xA;    // Optional -&amp;gt; a callback that formats your messages&#xA;    // remove this function if there is&#xA;    // no formatting needed or if you want to use the default&#xA;    public function formatMessage($message)&#xA;    {&#xA;        list($text, $level, $category, $timestamp) = $message;&#xA;        $level = 'Your fancy plugin Name';&#xA;&#xA;        if ($category == 'a-category-that-you-would-like-to-log') {&#xA;            return date('Y-m-d H:i:s', $timestamp) . &quot; [$level][$category] $text&quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;In your Plugin main file&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public static $_fileTarget;&#xA;&#xA;public static function log($message){&#xA;    if(self::$_fileTarget === null){&#xA;        /** @var FileTarget _fileTarget */&#xA;        self::$_fileTarget = Craft::createObject('namespace\pluginhandle\filetarget');&#xA;        // set the path&#xA;        self::$_fileTarget-&amp;gt;setLogFile();&#xA;        // include your target to the current dispatcher targets &#xA;        // -&amp;gt; all messages are tracked in your target as well. &#xA;        Craft::getLogger()-&amp;gt;dispatcher-&amp;gt;targets[] = self::$_fileTarget;&#xA;    }&#xA;&#xA;    // just use the default Craft/Yii logging method but with your category&#xA;    Craft::getLogger()-&amp;gt;log($message, \yii\log\Logger::LEVEL_INFO, 'a-category-that-you-would-like-to-log');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Usage&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Plugin::log('Lorem ipsum');&#xA;Craft::getLogger()-&amp;gt;log('Lorem ipsum', \yii\log\Logger::LEVEL_INFO, 'a-category-that-you-would-like-to-log');&#xA;Craft::info('Lorem ipsum', 'a-category-that-you-would-like-to-log');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe we could create a feature/pull request in order to create this feature by default. So every Plugin receives it's own category (by plugin handle) and if these categories are recognized the logger logs them in a separate file&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Edit (thanks Andrew for mentioning it):&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Note with this method I just add an additional &lt;code&gt;target&lt;/code&gt; to the dispatcher that creates log files. So you'll insert 2 messages: one in the default &lt;code&gt;storage/logs&lt;/code&gt; folder together with all the other requests and one in you custom log folder thus you are still able to use the great Yii2 Debug Toolbar and you can ask clients to hand over their plugin related logs to see what's going on&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-01T16:49:36.380" LastActivityDate="2018-04-01T16:49:36.380" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25431" PostTypeId="1" CreationDate="2018-04-01T14:12:10.447" Score="2" ViewCount="657" Body="&lt;p&gt;I have 2 almost identical websites. Both have almost the same layout but different colors (so different CSS file). They share most of the same templates and assets (images, css, js, videos, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site A has two languages NL and FR.&#xA;Site B has only one language FR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both sites have their own TLD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I set this up in Craft 3? I have tried various ways, but I don't seem to be able to find the right solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about creating two separate web folders, one for site A and one for site B. With subfolders for nl and fr in the webfolder for site A.&#xA;That works, but than I have the problem that I cannot share my assets because they belong to different webfolders.&#xA;And if I want to share a product channel for example, when I upload a product image, I want to use that same image in both sites. How will that work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the baseUrl is a mystery to me. If I use @web/nl and @web/fr for site A and @web for site B, the @web gives the correct TLD as output, but the template from site B (which uses @web) are always loaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to forgo to separate web folders, it totaly goes wrong...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please give a working example?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-04-01T14:25:18.270" Title="Craft 3 multi-lingual multi-sites setup with shared assets" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25432" PostTypeId="2" ParentId="25431" CreationDate="2018-04-01T14:25:18.270" Score="4" Body="&lt;p&gt;You could create 2 site groups. One group for site A and one group for site B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sitegroup A will contain contain 2 sites, the other one only one site.&#xA;Your setup will look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SiteGroup A&#xA;    - Site A - language NL&#xA;    - Site A - language Fr&#xA;SiteGroup B&#xA;    - Site B - language Fr&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's imagine your &lt;code&gt;Site A - language Fr&lt;/code&gt; is your primary site. So it will have the base url &lt;code&gt;/&lt;/code&gt;. Your &lt;code&gt;Site A - language NL&lt;/code&gt; have the base url &lt;code&gt;/nl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;Site B - language Fr&lt;/code&gt; will have the url &lt;code&gt;whatever.you.like.fr&lt;/code&gt;.&#xA;You don't need multiple &lt;code&gt;web&lt;/code&gt; folders at all because Craft will route every request to &lt;code&gt;web/index.php&lt;/code&gt; and sets the &lt;code&gt;currentSite&lt;/code&gt; depending on the url structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have multiple ways to setup your asset structure. You can either create multiple &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/asset-bundles.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Bundles&lt;/a&gt; in a plugin and load the assets you need or you can just check in your template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentSite.id == 1 %}&#xA;    load these assets&#xA;{% else %}&#xA;    load other assets&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-01T14:25:18.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25433" PostTypeId="2" ParentId="11687" CreationDate="2018-04-02T12:50:39.000" Score="2" Body="&lt;p&gt;Just for future reference, Craft 3 is a little different with the currency filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.price|currency('CAD', stripZeros = true) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-04-02T12:50:39.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25434" PostTypeId="1" AcceptedAnswerId="25487" CreationDate="2018-04-02T17:46:51.393" Score="1" ViewCount="106" Body="&lt;p&gt;&lt;strong&gt;Environment&lt;/strong&gt;&lt;br&gt;&#xA;Craft: 2.6.3013 (Personal)&lt;br&gt;&#xA;MAMP Pro: 4.4.1&lt;br&gt;&#xA;PHP: 7.0.12 (CGI Mode)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Behavior&lt;/strong&gt;&lt;br&gt;&#xA;After logging into the CP, and following a relatively short period of time, the session expires unexpectedly and Craft requests a login. Attempting to log in fails and immediately returns to the login modal; however, simply refreshing the page re-establishes the session, but again for only the limited period of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at &lt;code&gt;/craft/storage/runtime/sessions&lt;/code&gt; I see that Craft is creating a number of sessions, some of them being zero bytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempted Solutions&lt;/strong&gt;&lt;br&gt;&#xA;I've tried the following, based on other users' past experiences and solutions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In general.php: &lt;code&gt;'requireMatchingUserAgentForSession' =&amp;gt; false&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;In general.php: &lt;code&gt;'overridePhpSessionLocation' =&amp;gt; true&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;In php.ini: &lt;code&gt;session.auto_start = 0&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Permissions set to 777 for &lt;code&gt;/craft/storage/runtime&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;In MAMP, enable/disable &quot;Xdebug (Debugger)&quot; PHP extension&lt;/li&gt;&#xA;&lt;li&gt;Lastly, tested in both PHP 7.0.12 and 5.6.32 without CGI mode&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Next Steps?&lt;/strong&gt;&lt;br&gt;&#xA;Does it appear that I've missed anything in my previous steps? I've been using Craft 2 for a couple of years in a variety of environments--MAMP 3 / Vagrant / Docker--and haven't experienced this before. The issue isn't a showstopper, but certainly an annoyance, and I would be grateful for thoughts on what to try next.&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2018-04-05T13:59:17.280" Title="Craft 2 CP session expires unexpectedly, requires repeated login" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;session&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25435" PostTypeId="1" AcceptedAnswerId="25436" CreationDate="2018-04-02T19:45:31.550" Score="1" ViewCount="465" Body="&lt;p&gt;Can someone tell me why I am going crazy and cannot figure this simple relatedTo issue out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have a categories section called Case Studies and several categories within. I am trying to filter the results to show all entries within a specific category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('caseStudies').relatedTo('municipal').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;won't show any results but using the ID will.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('caseStudies').relatedTo(422).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried all sorts of slugs and nothing is showing. Why can I not figure this out. someone please point out my obvious mistake...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My entry field is called 'caseStudyCategory'&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-04-02T20:32:32.703" Title="cannot get relatedTo by slug only ID" Tags="&lt;categories&gt;&lt;category&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25436" PostTypeId="2" ParentId="25435" CreationDate="2018-04-02T19:57:18.823" Score="3" Body="&lt;p&gt;It does not work because the function does not accept slugs. Not sure what to answer here. It only accepts objects of type &lt;code&gt;Element&lt;/code&gt; and ids as identifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the magic here&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($elements as $element) {&#xA;if (is_numeric($element)) {&#xA;    $relElementIds[] = $element;&#xA;} else if ($element instanceof ElementInterface) {&#xA;    $relElementIds[] = $element-&amp;gt;id;&#xA;} else if ($element instanceof ElementQueryInterface) {&#xA;    foreach ($element-&amp;gt;ids() as $id) {&#xA;        $relElementIds[] = $id;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are all kind of things that the &lt;code&gt;relatedTo&lt;/code&gt; can use/work with. If you want to get a relation by slug you have to fetch the element first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.relatedTo(craft.categories.slug('municipal').one())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-02T20:32:32.703" LastActivityDate="2018-04-02T20:32:32.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25437" PostTypeId="1" AcceptedAnswerId="25452" CreationDate="2018-04-02T22:18:02.193" Score="2" ViewCount="949" Body="&lt;p&gt;Please see the attached screenshot. On heavy tasks the queue is cancelled. Where do I set the timeout or remove it completely?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fzDoy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fzDoy.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2019-03-25T07:54:27.373" Title="Queue Exec Time" Tags="&lt;tasks&gt;&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25438" PostTypeId="1" AcceptedAnswerId="25440" CreationDate="2018-04-02T23:10:16.477" Score="1" ViewCount="47" Body="&lt;p&gt;I've been looking around at numerous posts but can't seem to find a solution that works without constant work arounds. I'm looking to show posts split by days they were posted similar to www.producthunt.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today, Yesterday -&gt; Sunday. Then displaying the date posted e.g. 31st March from then on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different to most questions as this is showing live posts set out by different worded days instead of numerical. I can't seem to find a way of doing this without repeating the same code block for 7 days then a generic by date loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible in Craft?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2018-04-03T08:50:43.747" LastActivityDate="2018-04-03T08:50:43.747" Title="Split posts by days similar to Product hunt" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25440" PostTypeId="2" ParentId="25438" CreationDate="2018-04-03T01:12:42.997" Score="2" Body="&lt;p&gt;This seems like a good use case for Craft's &lt;code&gt;group&lt;/code&gt; filter. I'd recommend reading &lt;a href=&quot;https://craftcms.com/support/entry-archive&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; to get a better understanding of how it's used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not quite sure what your code looks like but I'll pull this from the above mentioned support article for explanation purposes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog').limit(null) %}&#xA;&#xA;{% for month, entries in allEntries | group(&quot;postDate|date('F')&quot;) %}&#xA;    &amp;lt;h3&amp;gt;{{ month }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entries %}&#xA;            &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So obviously you'd need to adapt this code to your setup, for example, switch out the month grouping for a per-day grouping. Then what I would do is wrap it in a conditional that only works if the postDate is more than three days older than today's date. Then you could use a similar query as the above to display the first three sections individually, (i.e. one for &quot;Today&quot;, one for &quot;Yesterday&quot;, and one for the day of the week of the third day).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might not be the best way (curious to see any other answers that might show up), but just the first thought that came to mind from a quick perusal of your question.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-04-03T01:12:42.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25441" PostTypeId="1" AcceptedAnswerId="25443" CreationDate="2018-04-03T03:01:04.473" Score="2" ViewCount="838" Body="&lt;p&gt;I've written a plugin that imports a CSV and creates entries from that for a client. I'm wanting to redirect them to the entries listing page after (i.e. /admin/entries/tvListings) and show a flash message saying &quot;X TV listings imported.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is a 2 parter:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do you set flash data in Craft 3.&lt;/li&gt;&#xA;&lt;li&gt;Is there a default flash key that'll show as soon as I land on the entries listing page?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-04-04T20:59:10.040" Title="Showing A Flash Message On Admin Entries Listing (Craft 3)" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25442" PostTypeId="2" ParentId="25424" CreationDate="2018-04-03T03:09:44.760" Score="5" Body="&lt;p&gt;Migrating Redirects should not be thought of as a one-time event but a process that includes a step where you make sure Redirects are in place and working.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;A rough redirect strategy&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a snapshot of where your old website stands. This can be a combination of using tools like Google Analytics, Screaming Frog, moz.com, raventools.com, or one of many other services that do similar things. The main goal of this step is to understand where your current website ranks and what errors your current website has. Whatever you do in this step, you're going to do it again after you launch and by understanding your baseline before you make significant changes you'll have a better picture of what may need correcting after you launch the new site.&lt;/li&gt;&#xA;&lt;li&gt;Identify all the URLs that are changing and decide which ones you want to redirect. Often this is all of them. Sometimes, you might choose to clean things up or just focus on key pages. Redirects can be managed in various places. The easiest place to manage them may be via a plugin like &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/getting-started/redirects&quot; rel=&quot;noreferrer&quot;&gt;Sprout SEO&lt;/a&gt; or &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;noreferrer&quot;&gt;Retour&lt;/a&gt; however managing them via the &lt;code&gt;.htaccess&lt;/code&gt; file or some other lower level configuration is also an option.  A good way to consider which URLs need redirected is to look at your analytics data. You can filter Google Analytics data and get a list of all pages that have been visited in the past year ordered by page views to get a fairly accurate list of what's important that you should be caring about.&lt;/li&gt;&#xA;&lt;li&gt;Get redirects in place. If you have a few redirects, adding them manually may be fairly straightforward. If you have lots, consider using regex patterns in your redirects. If a group of pages changes their URLs in the same way, you can likely write a single rule to match all of their URL patterns and forward those old pages to the new ones. I've given a more specific example of this below.&lt;/li&gt;&#xA;&lt;li&gt;Once you go live, be sure to test your redirects (see notes below) and take another snapshot of your site and monitor the site for unexpected behavior. Google Search Console and various tools like the ones mentioned above can help you monitor the site for errors and make sure no big issues were accidentally introduced. Sprout SEO can help you capture all 404 Redirects and an admin can convert any pages that were missed into 301 Redirects. When you do find issues, be sure to address them as quickly as you can. The longer you let them sit, the more likely search engines will think they are the norm.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;A few additional notes on redirects&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are different types of redirects. If you set a redirect to be a 301 redirect, that rule will get cached in your user's browsers. If you happen to make a mistake and try to change your redirect, the only way a user that hit your last redirect will get rid of it is if they clear their browser cache. For this reason, I recommend starting out with 302 redirects and testing all redirects as 302s. If the redirects work as expected, you can then update them to 301 redirects to signal to search engines that your changes are permanent and reduce the change that you create a scenario where incorrect rules get accidentally cached in user's browsers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have several redirects that follow the same pattern, you can use regexes to simplify the number of redirects you need. The following example is an .htaccess redirect that will match all incoming &lt;code&gt;article/{slug}&lt;/code&gt; URLs and redirect them to a new blog section (the term used in regexes for matching patterns within parentheses is &lt;code&gt;Capturing Groups&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteRule ^/article/(.*)$ /blog/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your case, since the previous URL was very broad &lt;code&gt;{slug}&lt;/code&gt; it may be challenging to find a pattern that matches your old URLs that doesn't also match all of your new URLS or new pages on your site. In this case, you may need to be more explicit in which URLs you are redirecting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do need to import 500 URLs, Sprout SEO Redirects can be converted from CSV and imported via Sprout Import.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-04-03T03:09:44.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25443" PostTypeId="2" ParentId="25441" CreationDate="2018-04-03T06:12:15.563" Score="6" Body="&lt;p&gt;To show a message &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getSession()-&amp;gt;setNotice($message);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To show an error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;session-&amp;gt;setError($message);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no &quot;default&quot; key that is always shown or something like that. You just use the function and set a message -&gt; the next time the user visits &lt;em&gt;any&lt;/em&gt; page the message is shown.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-04T20:59:10.040" LastActivityDate="2018-04-04T20:59:10.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25444" PostTypeId="1" AcceptedAnswerId="25445" CreationDate="2018-04-03T10:14:05.833" Score="1" ViewCount="115" Body="&lt;p&gt;I am new to the concept of Twig templates and I can’t get it right from the documentation … What I am trying to achieve is to have a reusable Blogroll snippet that outputs entries in different contexts: ALL entries on the homepage and then according to the entry’s category in other areas of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a file &lt;code&gt;blogroll.html&lt;/code&gt; in &lt;code&gt;templates/macros&lt;/code&gt; containing my blogroll code which works fine if used directly in a template (simplified the HTML here):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro blogroll(entry) %}&#xA;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;  &amp;lt;h2&amp;gt;{{ entry.title }}&amp;lt;/h2&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;index.html&lt;/code&gt; for the homepage I try inserting it with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;blogroll&quot;&amp;gt;&#xA;{% for entry in craft.entries.section('blog').limit(15).find() %}&#xA;{% for entry in entries %}&#xA;  {% import &quot;macros/blogroll&quot; as blogroll %}&#xA;  {{ blogroll.blogroll }}&#xA;{% endfor %}&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my category related templates I filter for the &lt;code&gt;category&lt;/code&gt; first and try to insert it this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(category) %}&#xA;{% for entry in entries %}&#xA;  {% import &quot;macros/blogroll&quot; as blogroll %}&#xA;{{ blogroll.blogroll }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In both cases I get a &lt;code&gt;Impossible to access an attribute (&quot;url&quot;) on a null variable.&lt;/code&gt; error though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints where I am not getting the concept right or screw something up while passing the variable?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2018-04-03T10:19:36.510" Title="Macro for entry loop causing 'null' variable template error" Tags="&lt;entries&gt;&lt;category&gt;&lt;loop&gt;&lt;macro&gt;&lt;null&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25445" PostTypeId="2" ParentId="25444" CreationDate="2018-04-03T10:19:36.510" Score="2" Body="&lt;p&gt;Your &lt;code&gt;blogroll&lt;/code&gt; can be treated as a PHP function. In order to use functions you have to pass the required parameters. In your case your &lt;code&gt;blogroll&lt;/code&gt; expects the parameter &lt;code&gt;entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ blogroll.blogroll(entry) }}&#xA;or&#xA;{{ blogroll.blogroll(category) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will work&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-03T10:19:36.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25449" PostTypeId="1" CreationDate="2018-04-03T19:10:52.370" Score="1" ViewCount="449" Body="&lt;p&gt;I'm looking for a simple way to save form data to a database and be able to access that information. I'm not sure if I should use the custom fields or an entry (or a custom table) and if creating a module is the way to go or another easy way to have my form post submit handled with PHP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping for a simple example of a module for Craft but I'm not finding it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of an example, I'd like to add and edit books in my library:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Book Type:&#xA;BookTitle - 50 characters&#xA;BookAuthor - 50 characters&#xA;BookSummary - 300 characters&#xA;Pages - Integer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8195" LastEditorUserId="45" LastEditDate="2018-04-03T19:23:57.393" LastActivityDate="2018-07-03T22:29:07.193" Title="Looking for a simple way to add/update information records with CraftCMS" Tags="&lt;craft3&gt;&lt;craft-features&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25450" PostTypeId="1" AcceptedAnswerId="25451" CreationDate="2018-04-03T19:36:10.463" Score="4" ViewCount="1327" Body="&lt;p&gt;I have a matrix field with two different block types and I want create a conditional to check if one of the blocks is not empty show it and if it is show the other.  This is not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.page.type('text, intro') %}&#xA;    {% if block.type.text != &quot;&quot; %}&#xA;        &amp;lt;h3&amp;gt;{{ block.text }}&amp;lt;/h3&amp;gt;&#xA;    {% else %}&#xA;        {{ block.intro }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="331" LastEditDate="2018-04-03T19:57:23.590" LastActivityDate="2018-04-03T19:57:23.590" Title="How to check if matrix block type is empty or not" Tags="&lt;matrix&gt;&lt;conditional&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25451" PostTypeId="2" ParentId="25450" CreationDate="2018-04-03T19:53:27.777" Score="5" Body="&lt;p&gt;You can fetch the number of entries for the first type, check if you receive an empty array if so fetch matrix blocks of type B&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocksTypeOne = entry.matrixFieldHandle.type('blockTypeHandle1').find() %}&#xA;{% if blocksTypeOne|length %}&#xA;     // blocks with type A exists&#xA;{% else %}&#xA;    {% set blocksWithTwo = entry.matrixFieldHandle.type('blockTypeHandle2').find()&#xA;    // do something with them&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-03T19:53:27.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25452" PostTypeId="2" ParentId="25437" CreationDate="2018-04-03T20:57:22.433" Score="4" Body="&lt;p&gt;Before you push the job to the queue you can specify the &lt;code&gt;ttr&lt;/code&gt; (time to reserve) in order to prevent the job being cancelled after 300 seconds (the default).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;queue-&amp;gt;ttr(3600);&#xA;Craft::$app-&amp;gt;queue-&amp;gt;push($myJob);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can make your Job class implement &lt;code&gt;RetryableJobInterface&lt;/code&gt; and then give it its own &lt;code&gt;getTtr()&lt;/code&gt; method. &#xA;See the &lt;a href=&quot;https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/retryable.md#retryablejobinterface&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs that explain this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SomeJob extends \craft\queue\BaseJob implements RetryableJobInterface&#xA;{&#xA;    public function getTtr()&#xA;    {&#xA;        return 3600;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or via configuration &lt;code&gt;config/app.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'components' =&amp;gt; [&#xA;        'queue' =&amp;gt; [&#xA;            'ttr' =&amp;gt; 600,&#xA;        ],&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, you can also achieve this using the provided &lt;a href=&quot;https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/retryable.md#event-handlers&quot; rel=&quot;nofollow noreferrer&quot;&gt;event handlers&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2019-03-25T07:54:27.373" LastActivityDate="2019-03-25T07:54:27.373" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25453" PostTypeId="1" CreationDate="2018-04-03T23:10:32.910" Score="0" ViewCount="146" Body="&lt;p&gt;I have two entry types in a same structure, I want to get some values from these two types in a same page. Is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('businessProfile').type(['type1','type2]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the &lt;code&gt;entry.type&lt;/code&gt; still shows only one type. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-07-03T10:26:34.247" Title="How can I show multiple entry types in the same page" Tags="&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25454" PostTypeId="1" AcceptedAnswerId="25472" CreationDate="2018-04-03T23:55:12.207" Score="1" ViewCount="252" Body="&lt;p&gt;I have a Craft 3 site. For some reason the &lt;strong&gt;before&lt;/strong&gt; filter isn't working when pulling entries from a channel, but &lt;strong&gt;after&lt;/strong&gt; does. This is not a data issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = &quot;2 months ago&quot;|date() %}&#xA;{% set end = &quot;next week&quot;|date() %}&#xA;&#xA;{% set listings = craft.entries({&#xA;    section: &quot;tvListings&quot;,&#xA;    limit: null,&#xA;    with: &quot;channel&quot;,&#xA;    before: end&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For clarity the dates result in: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start: Feb 4, 2018&lt;/li&gt;&#xA;&lt;li&gt;End: Apr 9, 2018&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And one of the example entries is definitely in that date range (April 2nd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1dc9F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1dc9F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I ditch the &quot;before&quot; and go &quot;after: start&quot; it does work. If I try to say &quot;give me all entries before Apr 9, 2018&quot;, the &quot;Thunderbirds are go&quot; (or any other listings) do not show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely I'm not doing something super stupid right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft 3.0.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I've started pulling apart the CMS to debug. EntryQuery-&gt;beforePrepare() builds the query that filters by date. Although the props before and after are set, once they're passed through Db::parseDateParam() it mutilates the dates and somehow comes out with &quot;2017-12-31 11:00:00&quot; for both - so no bloody wonder it's not working. If this is a date format thing for those props I'll update the answer. &lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2018-04-04T21:39:58.863" LastActivityDate="2018-04-04T23:21:10.950" Title="Craft 3 entries &quot;before&quot; not working" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25455" PostTypeId="2" ParentId="25453" CreationDate="2018-04-04T07:57:02.257" Score="1" Body="&lt;p&gt;And just to make sure: you are iterating over the results, right? because it actually should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('businessProfile').type(['type1','type2]).all() %}&#xA;{% for entry in entries %} ...&#xA;... Here {{entry.type}} should be different&#xA;{% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2018-04-04T07:57:02.257" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25457" PostTypeId="1" AcceptedAnswerId="25458" CreationDate="2018-04-04T13:39:11.393" Score="1" ViewCount="268" Body="&lt;p&gt;I just updated a Craft 2 site to Craft 3, everything pretty much works except for this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Redactor plugin not found: imagePosition&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since Redactor is now installed via the plugin store, how do I go about rectifying this issue?&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-04-04T13:52:54.070" Title="Redactor plugin not found: imagePosition Craft 3" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25458" PostTypeId="2" ParentId="25457" CreationDate="2018-04-04T13:52:54.070" Score="2" Body="&lt;p&gt;The reason you get the error is probably that you had the &lt;a href=&quot;https://github.com/picdorsey/craft-redactorimageposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor Image Position plugin&lt;/a&gt; installed in Craft 2. If the plugin was available for Craft 3, you'd just need to update to it. But since it's not available, you're kinda out of luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To remove the error message though, you only need to remove &lt;code&gt;'imagePosition'&lt;/code&gt; from the list of enabled plugins in your redactor config files, they're located at &lt;code&gt;config/redactor&lt;/code&gt; and works the same as in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-04T13:52:54.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25460" PostTypeId="1" CreationDate="2018-04-04T14:04:37.473" Score="0" ViewCount="1060" Body="&lt;p&gt;I just upgraded a Craft 2 site to 3, and am getting this error from one of my matrix blocks. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This field’s Volume configuration is invalid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This what it looks like in backend:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bm8BM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bm8BM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oddly enough, I went into settings and resaved the field, not touching anything else, and now I can atleast see the images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BY0Ym.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BY0Ym.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cant save the entry now, and am greeted with the same error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This field’s Volume configuration is invalid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;** Updated Volume Assets Screenshot **&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Mhqnr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mhqnr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="7292" LastEditDate="2018-04-04T14:32:24.150" LastActivityDate="2018-04-04T14:32:24.150" Title="Craft 3 This field’s Volume configuration is invalid" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25461" PostTypeId="1" AcceptedAnswerId="25463" CreationDate="2018-04-04T14:48:24.900" Score="1" ViewCount="142" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client receives an email with order details that include the customer shipping address. On a couple of occasions, though, the shipping details do not show. Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The email is delivered without an issue.&lt;/li&gt;&#xA;&lt;li&gt;The customer shipping address is missing.&lt;/li&gt;&#xA;&lt;li&gt;The customer email still makes it through. Not sure why just the&#xA;email comes through but could be a fluke.&lt;/li&gt;&#xA;&lt;li&gt;The order form does not allow the user to complete the transaction&#xA;without a shipping address.&lt;/li&gt;&#xA;&lt;li&gt;Neither the commerce nor the craft log files show anything amiss.&lt;/li&gt;&#xA;&lt;li&gt;Viewing the confirmation email source reveals nothing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The customer confirmed that they entered all their details. The customer also confirmed that they are using standard Chrome and that they checked all their details before placing the order. They also attempted the same transaction a second time at the request of the client and they could not get past the address screen without entering a shipping address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2018-04-04T15:13:35.840" Title="Customer info missing from email" Tags="&lt;plugin-craftcommerce&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25462" PostTypeId="1" AcceptedAnswerId="25464" CreationDate="2018-04-04T15:05:52.390" Score="1" ViewCount="150" Body="&lt;p&gt;I am looking to see if there is an easy way or already a plugin available that would replicate the entries structure layout.  I plan on creating a plugin that would allow an admin to mass update a select set of fields.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice it does an ajax call to index.php?p=admin/actions/elementIndex/getElements to get the first 50 entries and then subsequent calls to get more as you get near the end of the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see one of 3 potential ways to do it and wondering which way would be ideal.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Try and call this same ajax call as it returns the html and do some manipulation to the html to add additional functionality I need.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find methods that are being called from craft core and copy them into my plugin and modify as needed then do similar ajax call to my plugin.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Just write my own custom code to grab what I need.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am leaning on number 2 as the ideal scenario but have not looking to see if this  is unreasonable as it may be tied to a lot of different areas of the core code.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking to get some opinions as I am guessing others have already gone down this road.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE with more info&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to mimic the entries admin structure layout page for a specific section.  Once I mimic it I will add a little different functionality to it.  So currently you can select multiple entries and mass update the status or delete those entries and that is it.  I plan to add some additional options to change some custom fields that are associated with that section.  So if I am in the admin and I go to /admin/entries/meetings and meetings is a section with a type of structure I would see the tree layout of all the meetings in my case it is 5 levels deep.  There are 3 custom fields that change monthly and when they change about 30% of the meetings setup need to be changed.  The idea is they could select all of them that need these 3 fields updated and can do a mass update.  Currently they have to go into each meeting and make the change which is very time consuming.  Hope that makes more sense.&lt;/p&gt;&#xA;" OwnerUserId="6703" LastEditorUserId="6703" LastEditDate="2018-04-04T16:12:26.130" LastActivityDate="2018-04-04T16:45:53.207" Title="Replicate entries structure in admin" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;structure&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25463" PostTypeId="2" ParentId="25461" CreationDate="2018-04-04T15:13:35.840" Score="1" Body="&lt;p&gt;Are you setting the &lt;code&gt;requireShippingAddressAtCheckout&lt;/code&gt; and &lt;code&gt;requireShippingMethodSelectionAtCheckout&lt;/code&gt; config variables to &lt;code&gt;true&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/configuration#requireshippingaddressatcheckout&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/configuration#requireshippingaddressatcheckout&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-04-04T15:13:35.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25464" PostTypeId="2" ParentId="25462" CreationDate="2018-04-04T16:45:53.207" Score="1" Body="&lt;p&gt;Seems like you want to create a custom &lt;code&gt;Element&lt;/code&gt; or you would like to extend the existing &lt;code&gt;Entry&lt;/code&gt; Element.&#xA;It is all stated in the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-types.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; You can see how to create custom actions as well &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-action-types.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-types.md#index-page&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is stated how to create a custom index page &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends '_layouts/elementindex' %}&#xA;{% set title = 'Products' %}&#xA;{% set elementType = 'ns\\prefix\\elements\\Product' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then extend the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/src/js/BaseElementIndex.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;BaseElementIndex&lt;/a&gt; in order to change Javascript functionality&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.elementIndex = Craft.createElementIndex('{{ elementType|e(&quot;js&quot;) }}', $('#main'), {&#xA;    context:        '{{ context }}',&#xA;    storageKey:     'elementindex.{{ elementType }}',&#xA;    criteria:       Craft.defaultIndexCriteria&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can as well make use of certain &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/updating-plugins.md#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;events&lt;/a&gt; like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function($event){&#xA;    // resave all other elements&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-04T16:45:53.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25465" PostTypeId="1" AcceptedAnswerId="25468" CreationDate="2018-04-04T17:08:48.393" Score="1" ViewCount="344" Body="&lt;p&gt;Here we go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set state = craft.categories.group('locations').level(1).title(entry.title).one() %}&#xA;{% set solution = craft.categories.group('institutionSolutions').title(entry.parent.title).one() %}&#xA;{% set entries = craft.entries.section('institutions').relatedTo('and', state, solution).limit(4) %}&#xA;&#xA;   {% for entry in entries %}&#xA;       {{ entry.title }}&#xA;   {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following code does work as expected in Craft 2. According to the docs in Craft 3 we have to use the array brackets. So this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('institutions').relatedTo('and', state, solution).limit(4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will become to this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('institutions').relatedTo(['and', state, solution).limit(4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as a result I see the following message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;array_merge(): Argument #2 is not an array&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? :(&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2018-04-04T20:51:08.323" Title="Argument #2 is not an array" Tags="&lt;craft3&gt;&lt;array&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25466" PostTypeId="1" CreationDate="2018-04-04T18:18:11.610" Score="0" ViewCount="154" Body="&lt;p&gt;I have a controller which is eventually going to be set up for POSTs and GETs, but the weird thing is I can only access it through &lt;code&gt;localhost/index.php?p=actions/twoFA/get&lt;/code&gt; where twoFA is my plugin handle and get is an action method in my controller. How can I make it so that it behaves like all the examples online where I could go to &lt;code&gt;localhost/actions/twoFA/get&lt;/code&gt;? What's happening? Also, my &lt;code&gt;actionTrigger&lt;/code&gt; is set to &lt;code&gt;actions&lt;/code&gt; and I have not set up any site routes in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I have decided to make this work a little differently, and I therefore do not need any help.&lt;/p&gt;&#xA;" OwnerUserId="8197" LastEditorUserId="8197" LastEditDate="2018-04-04T20:50:45.637" LastActivityDate="2018-11-02T18:48:27.347" Title="How should I fix an odd action URL?" Tags="&lt;plugin-development&gt;&lt;request&gt;&lt;elementaction&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-04-04T22:30:22.340" ContentLicense="CC BY-SA 3.0" />
  <row Id="25467" PostTypeId="2" ParentId="25466" CreationDate="2018-04-04T20:37:21.433" Score="1" Body="&lt;p&gt;In Craft 3 the csrf token validation in the &lt;code&gt;general.php&lt;/code&gt; config is set to true by default. In order to request your controller with post requests you have to turn it off or include the token&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set csrfTokenName = craft.app.config.general.csrfTokenName %}         &#xA;{% set csrfToken = craft.app.request.csrfToken %}     &#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;{{ csrfTokenName }}&quot; value=&quot;{{ csrfToken }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="9" LastEditDate="2018-11-02T18:48:27.347" LastActivityDate="2018-11-02T18:48:27.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25468" PostTypeId="2" ParentId="25465" CreationDate="2018-04-04T20:51:08.323" Score="1" Body="&lt;p&gt;When you are going to apply an &lt;code&gt;and&lt;/code&gt; in your &lt;code&gt;relatedTo&lt;/code&gt; in Craft 3 it expects the following arguments to be arrays with the structure like &lt;a href=&quot;https://docs.craftcms.com/v2/relations.html#passing-multiple-relation-criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft&#xA;    .entries&#xA;    .section('institutions')&#xA;    .relatedTo(['and', &#xA;        {element: state}, // &amp;lt;- or targetElement / sourceElement&#xA;        {element: solution}&#xA;    ])&#xA;    .limit(4) &#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-04T20:51:08.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25469" PostTypeId="1" AcceptedAnswerId="25470" CreationDate="2018-04-04T21:08:03.077" Score="1" ViewCount="219" Body="&lt;p&gt;Tried to update to new version. Website and admin went down, error message states &quot;Undefined class constant 'Client'&quot;. How to solve this message?&lt;/p&gt;&#xA;" OwnerUserId="7892" LastActivityDate="2018-04-04T21:14:17.627" Title="Undefined class constant 'Client'" Tags="&lt;craft3&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-04-04T21:29:24.827" ContentLicense="CC BY-SA 3.0" />
  <row Id="25470" PostTypeId="2" ParentId="25469" CreationDate="2018-04-04T21:14:17.627" Score="1" Body="&lt;p&gt;This will be a bug in a plugin you've got installed on that site that is trying to reference the &lt;a href=&quot;https://craftcms.com/news/craft-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;non-existent (as of a few hours ago) Craft Client edition&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look in your &lt;code&gt;craft/storage/logs&lt;/code&gt; folder for that error, then you'll be able to see which plugin is causing it in the stack trace leading up to the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll then need to contact the plugin developer and share the stack trace with them so they can get it fixed for their next release.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-04T21:14:17.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25471" PostTypeId="2" ParentId="25449" CreationDate="2018-04-04T21:18:07.773" Score="1" Body="&lt;p&gt;Based on the information in the comments I'll provide an example how to save elements in Craft. I'll just show an example with an existing element type &lt;code&gt;Entry&lt;/code&gt;. You can see how to create a custom element type well documented in the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-types.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll create a new &lt;code&gt;section&lt;/code&gt; in your CP and add the required fields to the layout. In your case you'll need &lt;code&gt;title&lt;/code&gt; (Booktitle), &lt;code&gt;author&lt;/code&gt; (BookAuthor), &lt;code&gt;summary&lt;/code&gt; (BookSummary) and &lt;code&gt;pages&lt;/code&gt; (Pages)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get the section and the entrytype&#xA;// when you know your section id and entrytype id you don't&#xA;// need this. You can get the Ids by looking at the URL in the&#xA;// when you edit them&#xA;$section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('books');&#xA;$entryType = reset($section-&amp;gt;getEntryTypes());&#xA;// Create an entry&#xA;$entry = new Entry([&#xA;    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;    'typeId' =&amp;gt; $entryType-&amp;gt;id, // or insert the required type id manually&#xA;    'fieldLayoutId' =&amp;gt; $entryType-&amp;gt;fieldLayoutId,&#xA;    'authorId' =&amp;gt; 1,&#xA;    'title' =&amp;gt; 'A cool title of a book',&#xA;    'slug' =&amp;gt; 'a-cool-title-of-a-book', // &amp;lt;- not required&#xA;]);&#xA;&#xA;$entry-&amp;gt;setFieldValues([&#xA;    'author' =&amp;gt; 'Me and Myself',&#xA;    'summary' =&amp;gt; 'it was awesome',&#xA;    'pages' =&amp;gt; 9000&#xA;]);&#xA;&#xA;// Save the entry&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&#xA;// in case there is something wrong..&#xA;$errors = $entry-&amp;gt;getErrors();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you are going to create your custom element type without a field layout your code could look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$book = new Book([&#xA;    'title' =&amp;gt; 'A cool title of a book',&#xA;    'author' =&amp;gt; 'Me and Myself',&#xA;    'summary' =&amp;gt; 'it was awesome',&#xA;    'pages' =&amp;gt; 9000&#xA;]);&#xA;// Save the entry&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($book);&#xA;&#xA;// in case there is something wrong..&#xA;$errors = $book-&amp;gt;getErrors();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-04T21:18:07.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25472" PostTypeId="2" ParentId="25454" CreationDate="2018-04-04T21:52:29.293" Score="2" Body="&lt;p&gt;This is down to lacking documentation. Before/after are supposed to &lt;a href=&quot;https://docs.craftcms.com/v3/element-query-params/entry-query-params.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;take  &quot;DateTime|string&quot; as a parameter&lt;/a&gt; in the ElementQuery. &lt;strong&gt;The format is not documented&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &quot;Y-m-d H:i:s&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set start = &quot;2 months ago&quot;|date(&quot;Y-m-d H:i:s&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Behind the scenes in building the query the CMS was replacing any dates I sent through with &quot;2017-12-31 11:00:00&quot; (no idea where this came from). After realising this I spelled out the before/after in format &quot;Y-m-d H:i:s&quot; and the dates started working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pixel and Tonic - Can you please update the docs to include the available date formats - or at least throw an error if it's not valid.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2018-04-04T23:21:10.950" LastActivityDate="2018-04-04T23:21:10.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25473" PostTypeId="1" CreationDate="2018-04-04T22:04:19.543" Score="1" ViewCount="510" Body="&lt;p&gt;Tried the 1 Click Update and it bombed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on domain.com/admin/utlities/updates url I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig Runtime Error – Twig_Error_Runtime&#xA;Variable &quot;CraftPersonal&quot; does not exist.&#xA;1. in /vendor/craftcms/cms/src/templates/_layouts/basecp.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then on the domain.com/admin/dashboard url:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig Runtime Error – Twig_Error_Runtime&#xA;Variable &quot;CraftClient&quot; does not exist.&#xA;1. in /vendor/craftcms/cms/src/templates/_components/widgets/RecentEntries/body.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The CP is now unusuable&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-04-04T22:04:19.543" Title="Craft3: 1 Click update - broken site" Tags="&lt;craft3&gt;&lt;error&gt;&lt;updates&gt;&lt;auto-updates&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ClosedDate="2018-04-04T22:33:12.957" ContentLicense="CC BY-SA 3.0" />
  <row Id="25476" PostTypeId="1" CreationDate="2018-04-05T02:26:32.067" Score="1" ViewCount="671" Body="&lt;p&gt;So i copied the craft files onto my server. Web directory went into my public folder. I type in my address, I get the Craft service unavailable page, good so far. &#xA;I cant get to the installer. &lt;a href=&quot;http://HOSTNAME/index.php?p=admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://HOSTNAME/index.php?p=admin&lt;/a&gt; takes me to url/admin not found on the server. &#xA;What can I look for to see why Im not getting to the install directory.? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="4929" LastActivityDate="2018-05-09T01:48:42.920" Title="Installing Craft 3 without composer" Tags="&lt;craft3&gt;&lt;install&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25478" PostTypeId="1" AcceptedAnswerId="25479" CreationDate="2018-04-05T07:51:23.523" Score="1" ViewCount="175" Body="&lt;p&gt;Running craft cms 2 as a backend with react as the front end I am able to create a cart via an ajax post request to &lt;code&gt;actions/commerce/cart/updateCart&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure how to then update that cart. Every request to &lt;code&gt;updateCart&lt;/code&gt; creates a new cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to pass to &lt;code&gt;updateCart&lt;/code&gt; for it to update instead of create a new cart?&lt;/p&gt;&#xA;" OwnerUserId="8200" LastEditorUserId="-1" LastEditDate="2018-04-05T09:23:37.923" LastActivityDate="2018-04-05T09:23:37.923" Title="update existing cart via ajax creates new cart" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25479" PostTypeId="2" ParentId="25478" CreationDate="2018-04-05T08:17:10.110" Score="1" Body="&lt;h3&gt;Craft 3&lt;/h3&gt;&#xA;&lt;p&gt;This is how Craft Commerce fetches the Card&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if ($orderNumber = $request-&amp;gt;getBodyParam('orderNumber')) {&#xA;    // Get the cart from the order number&#xA;    $cart = Order::find()-&amp;gt;number($orderNumber)-&amp;gt;isCompleted(false)-&amp;gt;one();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You have to include an &lt;code&gt;orderNumber&lt;/code&gt; parameter&lt;/p&gt;&#xA;&lt;h3&gt;Craft 2&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;$number = $this-&amp;gt;_getSessionCartNumber();&#xA;&#xA;if ($cart = $this-&amp;gt;_getCartRecordByNumber($number))&#xA;{&#xA;    $this-&amp;gt;_cart = Commerce_OrderModel::populateModel($cart);&#xA;}&#xA;else&#xA;{&#xA;    $this-&amp;gt;_cart = new Commerce_OrderModel;&#xA;    $this-&amp;gt;_cart-&amp;gt;number = $number;&#xA;}&#xA;&#xA;/**&#xA; * @return mixed|string&#xA; */&#xA;private function _getSessionCartNumber()&#xA;{&#xA;    $cookieId = $this-&amp;gt;cookieCartId;&#xA;    $cartNumber = craft()-&amp;gt;userSession-&amp;gt;getStateCookieValue($cookieId);&#xA;&#xA;    if (!$cartNumber)&#xA;    {&#xA;        $cartNumber = md5(uniqid(mt_rand(), true));&#xA;        $configInterval = craft()-&amp;gt;config-&amp;gt;get('cartCookieDuration', 'commerce');&#xA;        $interval = new DateInterval($configInterval);&#xA;        $cartExpiry = date_create('@0')-&amp;gt;add($interval)-&amp;gt;getTimestamp();&#xA;        craft()-&amp;gt;userSession-&amp;gt;saveCookie($cookieId, $cartNumber, $cartExpiry);&#xA;    }&#xA;&#xA;    return $cartNumber;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think you'll have to change the cookie&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-04-05T08:24:04.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25480" PostTypeId="1" AcceptedAnswerId="25485" CreationDate="2018-04-05T10:49:56.487" Score="2" ViewCount="1633" Body="&lt;p&gt;Okay, I am here because I would like to have a site in the following structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://site.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://site.com&lt;/a&gt;  (default english version)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://site.com/ko&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://site.com/ko&lt;/a&gt; (korean)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://site.com/pt&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://site.com/pt&lt;/a&gt; (portuguese)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to use &lt;strong&gt;ONE&lt;/strong&gt; uploads folder to store all of the assets for all 3 languages(plus any additional languages added after), use all of the same templates, and use all of the same css and js files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current directory structure is the craft 3 default(I used the cli installer, which is great). Here is the important pieces of what my directory looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-templates&#xA;- web&#xA;   - dist&#xA;      - js&#xA;      - css&#xA;   - uploads&#xA;   - ko&#xA;   - pt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lets say I have the following templates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- home.html&#xA;- newsroom.html&#xA;- whitepapers.html&#xA;- help.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would expect to be able to visit each in the following manner:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(Home)&#xA;- https://site.com&#xA;- https:///site.com/ko&#xA;- https://site.com/pt&#xA;&#xA;(Newsroom)&#xA;- https://site.com/newsroom&#xA;- https:///site.com/ko/newsroom&#xA;- https://site.com/pt/newsroom&#xA;&#xA;...etc hopefully you get the picture.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this at all possible with Craft 3? I keep running into issues where each languages site is trying to pull in the uploads or css/js assets from within their respective folders:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a9toR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9toR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, here is the sites config in general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;        'siteUrl' =&amp;gt; [&#xA;          'default' =&amp;gt; 'https://site.test',&#xA;          'korean' =&amp;gt; 'https://site.test/ko',&#xA;          'brazil' =&amp;gt; 'https://site.test/pt'&#xA;        ],&#xA;        'devMode' =&amp;gt; true,&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SOLUTION&lt;/strong&gt;&#xA;For anyone visiting this in the future, here are the updates to my config that solved the problem. Please refer to this after you have read Robin and Jolle's answers, they are both very helpful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;        'siteUrl' =&amp;gt; [&#xA;          'default' =&amp;gt; 'http://site.test',&#xA;          'korean' =&amp;gt; 'http://site.test/ko',&#xA;          'brazil' =&amp;gt; 'http://site.test/bz'&#xA;        ],&#xA;        'aliases' =&amp;gt; [&#xA;            'basePath' =&amp;gt; '/Users/dzuz/localhost/site/web',&#xA;            'baseUrl'  =&amp;gt; 'http://site.test/',&#xA;        ],&#xA;        'devMode' =&amp;gt; true,&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="7292" LastEditDate="2018-04-06T12:00:08.420" LastActivityDate="2018-04-06T12:00:08.420" Title="Craft 3 Multi Language Setup" Tags="&lt;multi-site&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25481" PostTypeId="1" AcceptedAnswerId="25482" CreationDate="2018-04-05T10:52:29.990" Score="2" ViewCount="348" Body="&lt;p&gt;I'm used to writing Twig 1 syntax, and since switching to Craft 3 (which uses Twig 2) I keep getting lots of deprecation errors in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any reference material that provides the Twig syntax I should be using instead for Craft 3 sites?&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2018-04-05T10:52:29.990" Title="Craft 3 - Fixing deprecation errors" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25482" PostTypeId="2" ParentId="25481" CreationDate="2018-04-05T10:52:29.990" Score="2" Body="&lt;p&gt;Yes, with the launch of Craft 3, Pixel and Tonic have provided some &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#twig-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; on switching from Craft 2 syntax to Craft 3. &lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2018-04-05T10:52:29.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25483" PostTypeId="2" ParentId="25476" CreationDate="2018-04-05T12:07:29.627" Score="0" Body="&lt;p&gt;HOSTNAME should be substitued for your server hostname e.g.:&#xA;&lt;a href=&quot;http://myproject.test/index.php?p=admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://myproject.test/index.php?p=admin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6157" LastActivityDate="2018-04-05T12:07:29.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25484" PostTypeId="1" AcceptedAnswerId="25489" CreationDate="2018-04-05T13:12:51.773" Score="2" ViewCount="47" Body="&lt;p&gt;I have a plugin which is used to send a notification email when certain events happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to watch the contents of a Matrix field attached to a User, and when a Lightswitch field inside the Matrix is 'on', flip another Lightswitch field on the same matrix block. Here's the simplified code I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.onBeforeSaveUser', function(Event $event) {&#xA;    foreach ($user-&amp;gt;getContent()-&amp;gt;myMatrixField as $matrixBlock) {&#xA;        if($matrixBlock-&amp;gt;firstLightswitch){&#xA;            $matrixBlock-&amp;gt;secondLightswitch = '1';&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting the following error though:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property “Craft\MatrixBlockModel.secondLightswitch” is not defined&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's very definitely defined. I presume I'm trying to set the field incorrectly, but can't find out how.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-04-05T14:09:22.763" Title="Amending a lightswitch field value inside a matrix, from a plugin?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25485" PostTypeId="2" ParentId="25480" CreationDate="2018-04-05T13:50:27.187" Score="4" Body="&lt;p&gt;First of all you should remove all &quot;language&quot; subfolders from your &lt;code&gt;web&lt;/code&gt; directory because your web server will route directly in those instead of your default &lt;code&gt;web/index.php&lt;/code&gt;. Craft will determinate the &lt;code&gt;CurrentSite&lt;/code&gt; depending on your url not on the location of the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second: make sure to insert an array with &lt;code&gt;aliases&lt;/code&gt; in your &lt;code&gt;config/general.php&lt;/code&gt; &#xA;I'll show a &quot;complex&quot; solution for multiple asset sources for multiple sites. If your site shares the same resources you'll just need the first array element but I want to show the concept&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$publicPath = realpath(dirname(__DIR__) . '/web');&#xA;// ....&#xA;'aliases' =&amp;gt; [&#xA;    'assetPath1'    =&amp;gt; $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder1' . DIRECTORY_SEPARATOR,&#xA;    'assetPath2'    =&amp;gt; $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder2' . DIRECTORY_SEPARATOR,&#xA;    //....&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should &lt;strong&gt;never&lt;/strong&gt; access those files with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;`{{ siteUrl }}/assets/folder1/jquery.js`&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because this will use the current site url and append the structure. Therefore you have the &lt;code&gt;alias&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;`{{ alias('assetPath1') }}/assets/folder1/jquery.js`&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can do some fancy stuff like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;`{{ alias('assetPath' ~ currentSite.id) }}/assets/folder1/jquery.js`&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or whatever identifier you like to access your asset files dynamically. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-05T13:50:27.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25486" PostTypeId="1" CreationDate="2018-04-05T13:55:08.390" Score="1" ViewCount="26" Body="&lt;p&gt;The question is admin (backend only), not Twig : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where to Manage &quot;copy from&quot; site when adding new website and add section to this website. The &quot;Copyfrom&quot; takes place in the background after activating the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When adding a new (multilanguage) website and setting the section to that language it copies data to this new website or language.&#xA;I did a test and exported the &quot;content&quot; table as csv to see what happens.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When adding a new website, it copys the structure to that language  (more lines in csv)&lt;/li&gt;&#xA;&lt;li&gt;When activating a section on the new website it copies the content to that language (more lines in csv from that section)Looks logical so far....But &quot;What&quot; determens the &quot;copyFrom&quot; content ?Introducing a new language now copies always &quot;German&quot; content.I really want to choose that part (when adding the Sections).  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is the structure in websites:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;website.at  websiteAt   de-AT    &lt;a href=&quot;https://website.at/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://website.at/&lt;/a&gt;        website.eu&lt;br&gt;&#xA;website.com websiteCom  en-US    &lt;a href=&quot;http://website-comdev.nl/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website-comdev.nl/&lt;/a&gt;  website.eu&lt;br&gt;&#xA;website.de  websiteDe   de-DE    &lt;a href=&quot;https://website.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://website.de/&lt;/a&gt;        website.eu&lt;br&gt;&#xA;website.eu  websiteEu   en     V &lt;a href=&quot;https://website.eu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://website.eu/&lt;/a&gt;        website.eu&lt;br&gt;&#xA;website.fr  websiteFr   fr       &lt;a href=&quot;https://website.fr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://website.fr/&lt;/a&gt;        website.eu&lt;br&gt;&#xA;website.nl  websiteNl   nl-NL    &lt;a href=&quot;https://website.nl/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://website.nl/&lt;/a&gt;        website.eu&lt;br&gt;&#xA;website.sk  websiteSk   sk-SK    &lt;a href=&quot;https://www.website.sk/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.website.sk/&lt;/a&gt;    website.eu&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:  If i add website.zz and activate the section, the content is filled with german content (? maybe the first in the list). I want to manage the copyFrom and now we don't know wich default content is taken by introducing a new website/language.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="57" LastEditDate="2018-04-06T04:02:51.940" LastActivityDate="2018-04-06T04:02:51.940" Title="Multi-language, how Craft determines the CopyFrom after adding website and Section" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;sections&gt;&lt;language&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25487" PostTypeId="2" ParentId="25434" CreationDate="2018-04-05T13:59:17.280" Score="1" Body="&lt;p&gt;Resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This ended up being an issue with, so far as I can tell, my env variables--specifically a misconfiguration with the &lt;code&gt;basePath&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2018-04-05T13:59:17.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25488" PostTypeId="2" ParentId="25480" CreationDate="2018-04-05T14:01:33.513" Score="4" Body="&lt;p&gt;Use aliases, by first defining them in your general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;        'siteUrl' =&amp;gt; [&#xA;          'default' =&amp;gt; 'https://site.test',&#xA;          'korean' =&amp;gt; 'https://site.test/ko',&#xA;          'brazil' =&amp;gt; 'https://site.test/pt'&#xA;        ],&#xA;        'devMode' =&amp;gt; true,&#xA;        'aliases' =&amp;gt; [&#xA;            '@baseUrl' =&amp;gt; 'http://site.test',&#xA;        ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your templates you can now use {{ alias('@baseUrl') }}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;{{ alias('@baseUrl') }}/ui/vendor/enquire/enquire.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info, see &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft3-multi-environment&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7988" LastEditorUserId="7988" LastEditDate="2018-04-05T14:36:26.727" LastActivityDate="2018-04-05T14:36:26.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25489" PostTypeId="2" ParentId="25484" CreationDate="2018-04-05T14:09:22.763" Score="4" Body="&lt;p&gt;You have to do: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$matrixBlock-&amp;gt;getContent()-&amp;gt;setAttribute('secondLightswitch', '1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can only &lt;strong&gt;get&lt;/strong&gt; attributes via magic methods but you can't &lt;strong&gt;set&lt;/strong&gt; them&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-05T14:09:22.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25490" PostTypeId="1" AcceptedAnswerId="25491" CreationDate="2018-04-05T14:27:41.140" Score="1" ViewCount="379" Body="&lt;p&gt;I am looking for suggestion on how to setup a resource section on a site I'm building. Here is the structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resources - Index&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry type of resources&#xA;Webinars &#xA;-Webinar Entry (template for a single webinar)&#xA;-Webinar Index (all webinars)&#xA;Whitepapers&#xA;-Whitepaper Entry (template for a single whitepaper)&#xA;-Whitepaper Index (all whitepapers)&#xA;Ebooks&#xA;-Ebook Entry (template for a single ebook)&#xA;-Ebook Index (all ebooks)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was originally thinking to this as a channel, but how to I create indexes for the entry types: webinars, whitepapers, and ebooks?&lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-04-05T14:55:13.850" Title="Channel Section with individual entry template and index templates?" Tags="&lt;craft3&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25491" PostTypeId="2" ParentId="25490" CreationDate="2018-04-05T14:55:13.850" Score="2" Body="&lt;p&gt;The way I've done this in previously is in your templates have a directory titled &lt;code&gt;Resources&lt;/code&gt; and inside that directory another directory titled &lt;code&gt;_types&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the &lt;code&gt;_types&lt;/code&gt; directory I will have the code to output the content based on the entry type. I would name each of those templates &lt;code&gt;ENTRY-TYPE-HANDLE.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The on your Resources index user the following:&#xA;&lt;code&gt;{% include &quot;resources/_types/&quot; ~ entry.type %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2018-04-05T14:55:13.850" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25493" PostTypeId="1" CreationDate="2018-04-05T17:00:06.720" Score="1" ViewCount="349" Body="&lt;p&gt;I'm currently doing some work on our new website, and I have water up to my chest. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to create a top navigation bar (dropdown) based on entries in CraftCSM to create the menu. I'm thinking only to have one level in the dropdown menus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have so far. I've also attached the css for this, cause it might have somthing to do with that one too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both menus appear at the same time, and only one of the dropdowns appear. Should be several more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J6RNh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J6RNh.jpg&quot; alt=&quot;Dropdown Menu&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Regards a &quot;Total Craft newbie&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;topnav&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                &amp;lt;nav class=&quot;menu&quot;&amp;gt;&#xA;                    {% set menu = craft.entries.section('menu') %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;&#xA;                        &amp;lt;div class=&quot;dropdown&quot;&amp;gt;&#xA;                            {% nav link in menu %}&#xA;&#xA;&#xA;                            &amp;lt;li&amp;gt;&#xA;                                &amp;lt;div class=&quot;dropdown-content&quot;&amp;gt;&#xA;                                    {% if link.relatedEntry|length %}&#xA;&#xA;                                    &amp;lt;a href=&quot;{{ link.relatedEntry[0].url }}&quot; class=&quot;dropdown-content&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt; {% else %}&#xA;                                    &amp;lt;a href=&quot;{{ link.customURL }}&quot; class=&quot;dropdown-content&quot;&amp;gt;{{ link.title }}&amp;lt;/a&amp;gt; {% endif %} {% ifchildren %}&#xA;&#xA;                                    &amp;lt;ul&amp;gt;&#xA;                                        &amp;lt;div class=&quot;dropdown-content&quot;&amp;gt;&#xA;                                            {% children %}&#xA;                                        &amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;/ul&amp;gt;&#xA;&#xA;                                    {% endifchildren %}&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/li&amp;gt;&#xA;                            {% endnav %}&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                &amp;lt;/nav&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;CSS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.topnav {&#xA;    background-color: rgba(40,168,221,1);&#xA;    height: 50px;&#xA;    font-family: 'Titillium Web', sans-serif;&#xA;    position: fixed;&#xA;    width: 100%;&#xA;    z-index: 4;&#xA;}&#xA;&#xA;.topnav .menu {&#xA;    float: left;&#xA;    font-size: 12px;&#xA;}&#xA;&#xA;.topnav .menu ul {&#xA;    list-style: none;&#xA;    padding: 0px;&#xA;    margin: 0px;&#xA;}&#xA;&#xA;.topnav .menu ul li {&#xA;    float: left;&#xA;}&#xA;&#xA;.topnav .title {&#xA;    color: white;&#xA;    line-height: 50px;&#xA;    float: left;&#xA;    font-size: 15px;&#xA;    font-weight: bold;&#xA;}&#xA;&#xA;.topnav .menu ul li a {&#xA;    text-transform: uppercase;&#xA;    margin-left: 15px;&#xA;    margin-right: 15px;&#xA;    padding-top: 15px;&#xA;    padding-bottom: 2px;&#xA;    text-decoration: none;&#xA;    color: white;&#xA;    font-size: 13px;&#xA;    line-height: 20px;&#xA;    display: inline-block;&#xA;}&#xA;&#xA;.topnav .menu ul li a:hover {&#xA;    border-bottom: solid 3px #ffffff;&#xA;}&#xA;&#xA;.topnav .menu ul li a:last-of-type {&#xA;    padding-right: 0px;&#xA;}&#xA;&#xA;.topnav .menu .dropbtn {&#xA;    background-color: rgba(40,168,221,1);&#xA;    color: white;&#xA;    padding: 16px;&#xA;    font-size: 16px;&#xA;    border: none;&#xA;}&#xA;&#xA;.topnav .menu .dropdown ul li a {&#xA;    position: relative;&#xA;    display: inline-block;&#xA;    float: left;&#xA;}&#xA;&#xA;.topnav .menu .dropdown:hover ul li a {&#xA;    border-bottom: solid 3px #ffffff;&#xA;}&#xA;&#xA;.topnav .menu .dropdown:last-of-type ul li a {&#xA;    padding-right: 0px;&#xA;}&#xA;.topnav .menu .dropdown-content ul li a{&#xA;    display: none;&#xA;    position: absolute;&#xA;    background-color: rgba(40,168,221,1);&#xA;    min-width: 160px;&#xA;    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);&#xA;    z-index: 1;&#xA;}&#xA;&#xA;/* Show the dropdown menu on hover */&#xA;.topnav .menu .dropdown:hover .dropdown-content ul li a{&#xA;    display: block;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8203" LastEditorUserId="57" LastEditDate="2018-05-08T00:25:04.887" LastActivityDate="2018-05-08T00:25:04.887" Title="Navbar in Craft CMS" Tags="&lt;navigation&gt;&lt;css&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25495" PostTypeId="1" AcceptedAnswerId="25535" CreationDate="2018-04-05T22:52:34.107" Score="1" ViewCount="297" Body="&lt;p&gt;Is it possible to include the entry position (Structure) via the Entry Type Title Format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the current format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;published in {postDate|date('F')} {postDate|date('Y')}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which renders: published-in-april-2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is what we need it to render:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;number-3-published-in-april-2018&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could create an actual Number field called “numberTitle”, attach it to the Entry Type, and set the Entry Type’s title to be dynamically generated using the template “{numberTitle}”, but why does this need to be done manually?&#xA;You would think that the entries in a Section have a natural order in sequence or maybe they don't?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the EntryVersion Model cannot deliver could Twig offer a solution?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2018-04-07T22:41:08.690" LastActivityDate="2018-04-08T12:50:48.320" Title="Structure entry position in url" Tags="&lt;url&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25497" PostTypeId="1" AcceptedAnswerId="26067" CreationDate="2018-04-06T00:34:15.560" Score="1" ViewCount="175" Body="&lt;p&gt;Trying to template a matrix field that contains the use of categories. I am not a dev but trying to get this working.  This is my attempted but what I get back is something like this instead of the result.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{{%content}}&quot;;s:12:&quot;customFields&quot;;N;s:9:&quot;inReverse&quot;;b:0;s:7:&quot;asArray&quot;;b:0;s:2:&quot;id&quot;;N;s:3:&quot;uid&quot;;N;s:10:&quot;fixedOrder&quot;;b:0;s:6:&quot;status&quot;;a:1:{i:0;s:7:&quot;enabled&quot;;}s:8:&quot;archived&quot;;b:0;s:11:&quot;dateCreated&quot;;N;s:11:&quot;dateUpdate&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is my code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('bizlist').limit(10) %}&#xA;  {% for entry in entries %}&#xA;{{ entry.title }}&amp;lt;br /&amp;gt;&#xA;     {% for block in entry.cityList %}&#xA;{{ block.bizName }}&#xA;     {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-08T18:19:29.733" Title="Matrix fields using Categories" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25498" PostTypeId="2" ParentId="25495" CreationDate="2018-04-06T07:33:05.147" Score="0" Body="&lt;p&gt;You can include the level &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;number {level} published in {postDate|date('F')} {postDate|date('Y')}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-06T07:33:05.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25499" PostTypeId="2" ParentId="25493" CreationDate="2018-04-06T08:34:18.177" Score="1" Body="&lt;p&gt;There is nothing that I can see in your CSS that hides the dropdown in the first place. Also I hope you don't mind me saying but your CSS seems over-complicated. To hide / show the drop down you could just use something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.dropdown { &#xA;  height: 0; &#xA;  visibility: hidden; /* Display: none; is bad for accessibility. */&#xA;}&#xA;&#xA;.dropdown:hover,&#xA;/* Don't forget a focus state! */&#xA;.dropdown:focus {&#xA;  height: auto;&#xA;  visibility: initial;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There's no need to over specify your styles, it needlessly complicates things and adds bloat to your code, making it harder to debug for one.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-04-06T08:34:18.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25500" PostTypeId="1" CreationDate="2018-04-06T08:37:14.637" Score="2" ViewCount="741" Body="&lt;p&gt;Hi I have user registration form with multiple custom fields. They all work fine except for the field I have as a checkbox. It returns an error of 'my-field' is invalid. Any ideas anyone? code below (field in question is towards the bottom)...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; class=&quot;login-form&quot;&amp;gt;&#xA;            {{ getCsrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ url('collection/') }}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;h3&amp;gt;Register&amp;lt;/h3&amp;gt;&#xA;&#xA;&#xA;            &amp;lt;p&amp;gt;To browse our collection please register your information below.&amp;lt;/p&amp;gt;&#xA;&#xA;            &amp;lt;p&amp;gt;Already registered? &amp;lt;a href=&quot;#login-modal&quot; class=&quot;toggle-modal-trigger&quot;&amp;gt;Login&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#xA;&#xA;            {{ entry.contentBeforeForm }}&#xA;&#xA;            {% macro errorList(errors) %}&#xA;                {% if errors %}&#xA;                    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                        {% for error in errors %}&#xA;                            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endif %}&#xA;            {% endmacro %}&#xA;&#xA;            {% from _self import errorList %}&#xA;&#xA;&#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;firstName&quot;&amp;gt;First name&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;firstName&quot; type=&quot;text&quot; name=&quot;firstName&quot; {%- if account is defined %} value=&quot;{{ account.firstName }}&quot;{% endif %} placeholder=&quot;First name&quot;&amp;gt;&#xA;            {{ account is defined and account ? errorList(account.getErrors('firstName')) }}&#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;lastName&quot;&amp;gt;Last name&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;lastName&quot; type=&quot;text&quot; name=&quot;lastName&quot; {%- if account is defined %} value=&quot;{{ account.lastName }}&quot;{% endif %} placeholder=&quot;Last name&quot;&amp;gt; &#xA;            {{ account is defined and account ? errorList(account.getErrors('lastName')) }} &#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;company&quot;&amp;gt;Company&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;company&quot; type=&quot;text&quot; name=&quot;fields[company]&quot; {%- if account is defined %} value=&quot;{{ account.company }}&quot;{% endif %} placeholder=&quot;Company&quot;&amp;gt;  &#xA;            {{ account is defined and account ? errorList(account.getErrors('company')) }} &#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;phone&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;phone&quot; type=&quot;text&quot; name=&quot;fields[phone]&quot; {%- if account is defined %} value=&quot;{{ account.phone }}&quot;{% endif %} placeholder=&quot;Phone&quot;&amp;gt;&#xA;            {{ account is defined and account ? errorList(account.getErrors('phone')) }}&#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;username&quot;&amp;gt;Username&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot; {%- if account is defined %} value=&quot;{{ account.username }}&quot;{% endif -%} placeholder=&quot;Username&quot;&amp;gt;&#xA;&#xA;            {% if account is defined %}&#xA;                {{ errorList(account.getErrors('username')) }}&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; {%- if account is defined %} value=&quot;{{ account.email }}&quot;{% endif %} placeholder=&quot;Email&quot;&amp;gt;&#xA;&#xA;            {% if account is defined %}&#xA;                {{ errorList(account.getErrors('email')) }}&#xA;            {% endif %}&#xA;&#xA;&#xA;            &amp;lt;h4&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;            {% if account is defined %}&#xA;                {{ errorList(account.getErrors('password')) }}&#xA;            {% endif %}&#xA;&#xA;            {# HERE IS THE FIELD CAUSING THE ERROR #}&#xA;            &amp;lt;label&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; id=&quot;termsAgreement&quot; name=&quot;fields[termsAgreement]&quot; {%- if account is defined %}value=&quot;1&quot; checked{% endif %}&amp;gt;&#xA;             I agree to terms and conditions above&#xA;            &amp;lt;/label&amp;gt;&#xA;            {{ account is defined and account ? errorList(account.getErrors('termsAgreement')) }}&#xA;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;&#xA;        &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8206" LastActivityDate="2018-04-11T07:05:54.053" Title="User registration form with checkbox field" Tags="&lt;users&gt;&lt;field&gt;&lt;registration&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25502" PostTypeId="1" AcceptedAnswerId="25503" CreationDate="2018-04-06T09:32:16.040" Score="1" ViewCount="61" Body="&lt;p&gt;I set up a form structure with a matrix. Now I would like to call the entries one by one. My first idea was to loop through them, but the outcome is that the entries are displayed alltogether. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tryed to call them simply by the slug. Since there are just 4 of them. Not very dynamic though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I call the sets of matrix contents one by one? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.entries({section: 'registration', slug: 'form_1',}) .first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Didn't work. Still alltogether.&lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-04-06T11:38:28.200" Title="call matrix entries" Tags="&lt;matrix&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25503" PostTypeId="2" ParentId="25502" CreationDate="2018-04-06T11:38:28.200" Score="2" Body="&lt;p&gt;In order to get all elements from an &lt;code&gt;ElementCriteriaModel&lt;/code&gt; you need to call the &lt;code&gt;find()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set form = craft.entries({section: 'registration'}).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can them access those with normal array indexes &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-06T11:38:28.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25504" PostTypeId="1" AcceptedAnswerId="25552" CreationDate="2018-04-06T12:45:03.887" Score="4" ViewCount="2641" Body="&lt;p&gt;I'm trying to setup Craft 3 on a shared host. It succeeds when I place all files in the public directory and then go to /web. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I move the craft files to the folder /private_html/craft and the web files in /public_html it won't work (error 500). Do I need to edit the index.php file after all (not mentioned in the installation docs)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried setting the index.php lines to ../private_html/craft/vendor and ../private_html/craft/.env, but no luck. I get the feeling the index.php needs a pointer where the craft folder resides?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Set path constants&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'../private_html/craft/vendor');&#xA;&#xA;// Load Composer's autoloader&#xA;require_once CRAFT_VENDOR_PATH.'../private_html/craft/vendor/autoload.php';&#xA;&#xA;// Load dotenv?&#xA;if (file_exists(CRAFT_BASE_PATH.'../private_html/craft/.env')) {&#xA;    (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&#xA;}&#xA;&#xA;// Load and run Craft&#xA;define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;$app = require CRAFT_VENDOR_PATH.'../private_html/craft/vendor/craftcms/cms/bootstrap/web.php';&#xA;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="37" LastEditDate="2018-08-06T07:21:11.893" LastActivityDate="2018-08-06T07:21:11.893" Title="Set up Craft 3 when the craft folder is above public_html on shared hosting" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25506" PostTypeId="1" AcceptedAnswerId="25507" CreationDate="2018-04-06T12:46:30.133" Score="0" ViewCount="375" Body="&lt;p&gt;Now Craft 3 is available as a download, do you need to use composer for any part of upgrading a Craft 2 site to Craft 3 (if Craft 3 has been downloaded)?&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="57" LastEditDate="2018-04-09T22:36:41.687" LastActivityDate="2018-04-09T22:36:41.687" Title="Update Craft 2 to 3?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25507" PostTypeId="2" ParentId="25506" CreationDate="2018-04-06T12:52:53.920" Score="2" Body="&lt;p&gt;Detailed instructions are now provided here: &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-04-06T12:52:53.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25510" PostTypeId="1" AcceptedAnswerId="25516" CreationDate="2018-04-06T17:27:14.883" Score="1" ViewCount="256" Body="&lt;p&gt;I have a Craft site with a Client license. After the recent license transition to Solo/Pro, a red banner appears along the top that reads &quot;You’re running Craft Client with a Craft Pro license. [Resolve].&quot; Hitting &quot;resolve&quot; displays the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1voUu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1voUu.png&quot; alt=&quot;Craft Solo - Pro Screen&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt;&#xA;So, if I reinstall as pro, is that a new $299 charge (plus the annual $59)? Will &quot;reinstalling&quot; result in system downtime and/or data loss?&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-04-06T21:07:14.103" Title="Client License Transition to Solo/Pro" Tags="&lt;craft-pro&gt;&lt;license&gt;&lt;pricing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25511" PostTypeId="1" AcceptedAnswerId="25512" CreationDate="2018-04-06T17:33:16.180" Score="1" ViewCount="1035" Body="&lt;p&gt;Currently trying to get the date filter to display 'April' instead of concatenated version 'Apr'. My code below is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ now|date(&quot;M, Y&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-04-06T17:52:34.463" Title="Display Full Month Name" Tags="&lt;templating&gt;&lt;entries&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25512" PostTypeId="2" ParentId="25511" CreationDate="2018-04-06T17:40:46.413" Score="4" Body="&lt;p&gt;Try using this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ now|date(&quot;F, Y&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find the format strings for the date filter: &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://php.net/manual/en/function.date.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2018-04-06T17:52:34.463" LastActivityDate="2018-04-06T17:52:34.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25513" PostTypeId="1" CreationDate="2018-04-06T18:19:15.820" Score="0" ViewCount="473" Body="&lt;p&gt;I'm trying to get pagination and cache to work together but it's failing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key&#xA;   craft.request.path ~ '/p' ~ craft.request.getPageNum&#xA;   for 2 hours %}&#xA;&#xA;{% paginate topicEntries.limit(10)as pageInfo, topicEntries %}&#xA;&#xA;  {% for topic in topicEntries %}&#xA;&#xA;      more code here&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endcache %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use this I get a template error that Variable pageInfo does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if I put the opening cache tag below the paginate tag. The first page shows 10 entries, but each page after that only displays 1 entry per page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate topicEntries.limit(10)as pageInfo, topicEntries %}&#xA; {% cache globally using key&#xA;    craft.request.path ~ '/p' ~ craft.request.getPageNum&#xA;    for 2 hours %}&#xA;&#xA;  {% for topic in topicEntries %}&#xA;&#xA;      more code here&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I need to know is how to cache paginated entries so it's 10 per page and when a new entry is added the cache is cleared correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="130" LastEditDate="2018-04-09T22:25:30.230" LastActivityDate="2018-04-10T19:20:16.497" Title="Cache and Pagination not working" Tags="&lt;templating&gt;&lt;cache&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25514" PostTypeId="1" CreationDate="2018-04-06T18:57:19.160" Score="2" ViewCount="453" Body="&lt;p&gt;I am using SEOmatic helper class to get localizedUrls which is making life much easier! I would like to only display the localizedurl if the current entry is enable on that site. Below is what I have, has anyone successful done this for craft 3? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentSite = craft.app.sites.currentSite %}&#xA;&#xA;{% set currentSiteLanguage = currentSite['language'] %}&#xA;&#xA;{% set localizedUrlsArray = seomatic.helper.getLocalizedUrls() %}&#xA;&#xA;&#xA;{% for localizedUrls in localizedUrlsArray %}&#xA;&#xA;{% if currentSiteLanguage != localizedUrls['language'] %}&#xA;&#xA;    {% if entry is defined %}&#xA;&#xA;        {% if entry.enabledForSite %}&#xA;&#xA;            &amp;lt;a href=&quot;{{ localizedUrls['url'] }}&quot;&amp;gt; {{ localizedUrls['language'] }}&amp;lt;/a&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;a href=&quot;{{ localizedUrls['url'] }}&quot;&amp;gt; {{ localizedUrls['language'] }}&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="8185" LastEditDate="2018-04-06T19:22:37.237" LastActivityDate="2018-05-09T18:49:54.860" Title="Struggling with language switcher for Craft 3" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25515" PostTypeId="1" AcceptedAnswerId="25539" CreationDate="2018-04-06T19:38:26.877" Score="0" ViewCount="132" Body="&lt;p&gt;I have a channel of entries that are being pulled into a single. I then  want to group the entries by a dropdown field called dealStatus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working correctly, however the grouping is not outputting the order correctly. I expect the order of the groups to be in the same order that the dropdown field has them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;InMarket&#xA;postBid&#xA;closing&#xA;closed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead the groups are getting output in this order&lt;/p&gt;&#xA;&#xA;&lt;p&gt;postBid&#xA;inMarket&#xA;closing&#xA;closed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the groups ordered the same as the dropdown field option order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allDeals = craft.entries.section('deals').relatedTo(entry) %}&#xA;{% set allDealsByStatus = allDeals|group('dealStatus') %}&#xA;&#xA;{% for status, entriesInStatus in allDealsByStatus %}&#xA;    &amp;lt;li class=&quot;accordion-item {% if loop.index ==&quot;1&quot; %}is-active{% endif %}&quot; data-accordion-item&amp;gt;&#xA;      &amp;lt;!-- Accordion tab title --&amp;gt;&#xA;      &amp;lt;a href=&quot;#&quot; class=&quot;accordion-title&quot;&amp;gt;&#xA;      {{ status }}&#xA;      &amp;lt;i class=&quot;arrow right&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;!-- /.arrow right --&amp;gt;&#xA;      &amp;lt;/a&amp;gt;&#xA;&#xA;      &amp;lt;!-- Accordion tab content: it would start in the open state due to using the `is-active` state class. --&amp;gt;&#xA;      &amp;lt;div class=&quot;accordion-content&quot; data-tab-content&amp;gt;&#xA;        &amp;lt;ul class=&quot;no-bullet market-content&quot;&amp;gt;&#xA;          {% for entry in entriesInStatus %}&#xA;            &amp;lt;li&amp;gt;&#xA;              &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;http://via.placeholder.com/120x60/eaeaea?text=logo here&quot; alt=&quot;&quot; class=&quot;market-logo&quot;&amp;gt;&#xA;&#xA;                &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;&#xA;                &amp;lt;img src=&quot;/assets/img/next.svg&quot; alt=&quot;&quot; class=&quot;go-icon&quot;&amp;gt;&#xA;              &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&amp;lt;!-- /.no-bullet --&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is on Craft 3.0.1&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2018-04-06T20:08:49.210" LastActivityDate="2018-04-08T19:17:42.380" Title="Grouping by select - keep order of options" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25516" PostTypeId="2" ParentId="25510" CreationDate="2018-04-06T21:07:14.103" Score="1" Body="&lt;p&gt;Disregard -- this was directly addressed by the 2.6.3015 update that was just released. The message no longer appears.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-04-06T21:07:14.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25517" PostTypeId="1" CreationDate="2018-04-06T22:17:10.997" Score="0" ViewCount="562" Body="&lt;p&gt;Please help me build my sandwich locator maker :)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have 3 categories, breads, meats, condiments  &lt;/li&gt;&#xA;&lt;li&gt;I have a &lt;strong&gt;Section&lt;/strong&gt; called &lt;em&gt;subShops&lt;/em&gt; with a matrix field.&lt;/li&gt;&#xA;&lt;li&gt;My matrix field is called &lt;em&gt;sandwichBuilder&lt;/em&gt;, &lt;strong&gt;fields:&lt;/strong&gt; breads, meats, condiments&lt;/li&gt;&#xA;&lt;li&gt;This matrix field is my entry I use for building the sandwiches that the &lt;em&gt;suShops&lt;/em&gt; offer.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to keep my Categories to make it easy for structure and searching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I build my query so that I can find all entries using a category of bread (over 200 sub categories for bread)?&lt;/strong&gt;  I want the ability to only show those subShops that carry a certain breads based on URL segments (&lt;a href=&quot;http://example.com/breads/spelt&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/breads/spelt&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, this above url example would list all the subShops that carry spelt bread, so it would display each group including - &lt;strong&gt;subShop, bread and typical meats that go best with spelt&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried various ways and many hours trying to figure it out but with unusual results.  My code below is my baseline, but need some help from anyone willing to offer examples.  This is a pet project and I do plan on sharing the code when complete.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.relatedTo(sanwiches).all() %}&#xA;&#xA;{% for entry in entries %}&#xA;{{ entry.title }}&#xA;&#xA;{% for row in entry.matrixA %}&#xA; {% for option in row.matrixB %}&#xA;    {{ option }}&#xA;    {% endfor %}&#xA; {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-04-07T21:54:55.777" Title="Categories Related To Matrix Fields" Tags="&lt;matrix&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25518" PostTypeId="1" CreationDate="2018-04-06T23:18:58.517" Score="2" ViewCount="205" Body="&lt;p&gt;I am busy reworking a reasonably large website that is already in Craft. The production site is updated with new content several times a day. My current work is an interface redesign. I have a local machine environment, and then a dev environment on the same server set up at the ISP alongside the live production one. The dev will function more as a test server - I can refresh from the production server a few times to test my update process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My rework on the local dev environments starts with an exact site copy, and will involve mostly template changes. However I suspect I might need to do some database tweaks. In the meantime the live site will undergo a number of content changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how best to deploy those database tweaks to the live dev and then production servers. My current strategy is to write down what changes I made in local dev and then manually make them on the main dev or live server. These seems a bit dumb unless it is just one or two. I can't copy the whole database because then I would overwrite content changes and I can't put a hold on content changes because my work is likely to take a week or three.&lt;/p&gt;&#xA;" OwnerUserId="695" LastActivityDate="2018-04-07T00:32:13.090" Title="How to transfer Craft configuration changes separate from web conent" Tags="&lt;database&gt;&lt;config&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25519" PostTypeId="2" ParentId="25518" CreationDate="2018-04-07T00:32:13.090" Score="3" Body="&lt;p&gt;What you need to do is develop some kind of workflow; the workflow that I use is described in the &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are other equally valid ways to do it as well. It's really a combination of some tooling, and then just a workflow methodology that you're going to use to keep things in sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing things down and trying to then re-apply the changes is problematic, because it human error often rears its ugly head when you try to do things that way.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-07T00:32:13.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25520" PostTypeId="1" AcceptedAnswerId="25527" CreationDate="2018-04-07T02:26:58.327" Score="1" ViewCount="124" Body="&lt;p&gt;What is the best way to handle 20,000 simple records?  The records need to be searchable and linked to categories.  What is the best way to handle so many records when each records or entry would be a simple phrase 5-10 words max.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of categories but thinking 20k anything has to be thought out.  Since categories may or may not be most efficient, any ideas or way that you have done this in the past before with success?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-04-07T15:04:57.007" Title="Best way to handle large amount of records" Tags="&lt;categories&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25521" PostTypeId="2" ParentId="25517" CreationDate="2018-04-07T05:07:24.287" Score="1" Body="&lt;p&gt;You have to insert your matrix field into the rated to param like &lt;a href=&quot;https://docs.craftcms.com/v2/relations.html#going-through-matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('subShops').relatedTo({&#xA;    targetElement: sandwich, &#xA;    field: 'sandwichBuilder.breads' &#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-07T21:48:00.037" LastActivityDate="2018-04-07T21:48:00.037" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25522" PostTypeId="1" AcceptedAnswerId="25563" CreationDate="2018-04-07T09:12:43.607" Score="2" ViewCount="541" Body="&lt;p&gt;It mentions developers can use it for personal usage. Does that include &lt;strong&gt;commercial&lt;/strong&gt; usage as well? It seems so, but am not sure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few small personal sideprojects running with some Adsense and Affiliate links (currently on CodeIgniter, etc.). &lt;/p&gt;&#xA;" OwnerUserId="185" LastEditorUserId="57" LastEditDate="2018-04-09T23:28:43.457" LastActivityDate="2018-04-09T23:28:43.457" Title="Craft CMS solo licence" Tags="&lt;license&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25523" PostTypeId="1" CreationDate="2018-04-07T10:32:47.930" Score="0" ViewCount="29" Body="&lt;p&gt;I'm looking to set a 'score' property on my &quot;category&quot; field, this will be done by calculating how many entries are within that category similar to a 'Trending' feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to set a property by doing a sum something like entry.count x 0.4 and then setting the field with the result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-04-07T10:32:47.930" Title="Setting an Entry field using sum" Tags="&lt;categories&gt;&lt;entry&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25524" PostTypeId="2" ParentId="25522" CreationDate="2018-04-07T11:07:42.493" Score="-1" Body="&lt;p&gt;I believe that you may only use it this way if you are a developer and the site is promoting your development services. So in a sense yes it is commercial but I think the use case you describe would fall outside the permitted use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't represent P&amp;amp;T, so it may be worth contacting them directly for clarification.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-07T11:07:42.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25525" PostTypeId="1" CreationDate="2018-04-07T11:18:56.697" Score="2" ViewCount="389" Body="&lt;p&gt;I need to set a bunch of variables to feed my html head metas. Most of the time the page is directly related to an entry but i also have pages for each user with a route that look like 'equipe/user.username':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getSegment(1) == 'equipe' and craft.request.getSegment(2) is defined %}&#xA;    {% set user = craft.users.username(craft.request.segment(2)).first()%}&#xA;    {% set title = user.username %}&#xA;    {% set description = user.description %}&#xA;    {% set resume = user.resume %}&#xA;    {% set url = siteUrl~'equipe/'~user.username %}&#xA;    {% for asset in user.imageHeader %}&#xA;        {% set imageUrl = asset.getUrl('header') %}&#xA;        {{ imageUrl }}&#xA;    {% endfor %}&#xA;{% else %}&#xA;    {% set title = entry.title %}&#xA;    {% set description = entry.description %}&#xA;    {% set resume = entry.resume %}&#xA;    {% set url = entry.url %}&#xA;    {% for asset in entry.imageHeader %}&#xA;        {% set imageUrl = asset.getUrl('header') %}&#xA;        {{ imageUrl }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;{{ imageUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works fine except for the imageUrl variable. it behave like a local variable. I can retrieve the value just after it is set, but not outside of the for loop... any idea why ? &lt;/p&gt;&#xA;" OwnerUserId="6295" LastEditorUserId="6295" LastEditDate="2018-04-07T13:06:52.817" LastActivityDate="2018-04-07T13:06:52.817" Title="variable inside for loop is empty outside the loop" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25526" PostTypeId="2" ParentId="25525" CreationDate="2018-04-07T11:23:33.363" Score="3" Body="&lt;p&gt;I found the solution to the issue... indeed it behave like a local variable ! if i want to use it outside of the for loop it seems that i have to set it before with something like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageUrl = '' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6295" LastActivityDate="2018-04-07T11:23:33.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25527" PostTypeId="2" ParentId="25520" CreationDate="2018-04-07T15:04:57.007" Score="2" Body="&lt;p&gt;In sake of performance it would be better to create a custom field type and one or two record(s). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can store your information/records in a separate table and link them with their ID to a category. Craft CMS will create a record in at least 4 tables for every elements and it has to join those tables to populate it. So an additional amount of 20k will decrease your performance for sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's better to create a separate table rather than using categories for this task. You can combine your records with other elements with an normal Query like Craft does it with it's  ElementCriteriaModel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's going to be much more work if you are not used to Craft but it will help you in the future as a good practice &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-07T15:04:57.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25529" PostTypeId="1" AcceptedAnswerId="25530" CreationDate="2018-04-07T21:56:53.777" Score="1" ViewCount="820" Body="&lt;p&gt;By base.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block searchLogic %}                                &#xA;{% endblock %}                &#xA;&#xA;{% block meetingDisplay %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My index.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;base.html&quot; %}&#xA;&#xA;{% block searchLogic %}&#xA;{% include 'logic/anonVisitor.logic' %}&#xA;{% endblock %}&#xA;&#xA;{% block meetingDisplay %}&#xA;Some html code&#xA;{% for meeting in meetings %}&#xA;{% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My anonVisitor.logic file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# More code that works, I just removed it for clarity #}&#xA;{% set meetings = craft.entries.section('meetings').address(params).limit(25).order('distance').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I try to use the variable meetings in the block &quot;meetingDisplay&quot; in the index.html file. For some reason the variable &quot;meetings&quot; is no longer available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to seperate my logic blocks and my html blocks into separate files for manageability and reuse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this logic worked before I broke the code and html using the extends and includes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make variables set in an include be available in a block?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-05-07T22:48:20.347" Title="Using a variable that was set in a previous include" Tags="&lt;craft3&gt;&lt;include&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25530" PostTypeId="2" ParentId="25529" CreationDate="2018-04-07T22:34:23.523" Score="2" Body="&lt;p&gt;So what you're running into is Twig scoping rules, which is discussed at length in the article &lt;a href=&quot;https://nystudio107.com/blog/twig-processing-order-and-scope&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Processing Order &amp;amp; Scope&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TL;DR is that a variable is only available in the context in which it is defined. Since you're setting the &lt;code&gt;meetings&lt;/code&gt; variable in a file you included, that variable exists only in the context of the &lt;code&gt;anonVisitor.logic&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, variables defined in a parent context are available to any child templates that are included, but you can't &lt;em&gt;change&lt;/em&gt; the values in the child templates, because you're given a copy of the context that goes away when the child templates are done rendering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is leverage &lt;code&gt;extends&lt;/code&gt; and &lt;code&gt;embed&lt;/code&gt;, because templates that &lt;code&gt;extends&lt;/code&gt; other templates have the same context as the parent that they &lt;code&gt;extends&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-07T22:34:23.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25531" PostTypeId="1" AcceptedAnswerId="25532" CreationDate="2018-04-07T23:08:19.267" Score="0" ViewCount="752" Body="&lt;p&gt;Sorry, rusty at PHP and learning Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = craft::$app-&amp;gt;GeneralConfig-&amp;gt;siteUrl();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? I want to build a URL for some links in a plugin.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-04-08T00:58:54.837" Title="Getting unknown property: craft\web\Application::GeneralConfig" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25532" PostTypeId="2" ParentId="25531" CreationDate="2018-04-08T00:58:54.837" Score="1" Body="&lt;p&gt;Please use a proper IDE or take a look into the source code to get to know the functions of the class. As you can see in the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-applicationtrait.html#getConfig()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;class reference&lt;/a&gt; the function is called &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getConfig() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However - in order to create urls you should use the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-urlhelper.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;UrlHelper&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-08T00:58:54.837" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25533" PostTypeId="1" CreationDate="2018-04-08T04:44:19.420" Score="1" ViewCount="55" Body="&lt;p&gt;I'm using Heroku and every time I push changes to Heroku, the plugins installed from the plugin store get removed. Do I need to add them to my composer file manually?&lt;/p&gt;&#xA;" OwnerUserId="8211" LastActivityDate="2018-05-08T18:48:35.760" Title="Plugins get removed after publishing to Heroku" Tags="&lt;plugins&gt;&lt;heroku&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25535" PostTypeId="2" ParentId="25495" CreationDate="2018-04-08T12:50:48.320" Score="0" Body="&lt;p&gt;If your structure only has one level, you can use a title format like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Number {{ craft.entries.order('lft desc').positionedBefore(object).total()+1 }} published in {postDate|date('F')} {postDate|date('Y')}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works when you create new entries, they'll get their current position in the title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that this number won't get updated if you sort the stucture, since you'd need to resave all entries affected by the move, to update their title and slug. You can do this by creating a custom plugin (or module, if you're using Craft 3), listen to the appropriate events (for instance &lt;code&gt;Element.EVENT_AFTER_MOVE_IN_STRUCTURE&lt;/code&gt; in Craft 3), and resave all entries. This could be a quite resource intensive operation if you have a lot of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also get the number in Twig with the same code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.entries({ order: 'lft desc', positionedBefore: entry }).total() + 1 }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This number will always be the updated number in the position, since the query is executed at runtime, instead of when an entry is saved. If you want to show this number to the enduser, I'd recommend this approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to show the number in the control panel, I'd recommend looking into the ability to add custom columns to Craft's element indexes instead of having it in the title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe if you provide more information on the use-case, we can provide even more insight into possible solutions.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-08T12:50:48.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25536" PostTypeId="1" CreationDate="2018-04-08T14:39:24.377" Score="0" ViewCount="761" Body="&lt;p&gt;I've today upgraded from PHP 5.6 to 7.2 so that I could upgrade to Craft 3.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After needing to install a lot of updates, the craft server check is completely green and says everything should be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm getting the following issue despite correct settings in the .env file. I've checked that the user/pass works for the mysql database and it all seems fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An Error occurred while handling another error:&#xA;ReflectionException: Class craft\db\mysql\Schema does not exist in /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php:428&#xA;Stack trace:&#xA;#0 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(428): ReflectionClass-&amp;gt;__construct('craft\\db\\mysql\\...')&#xA;#1 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(364): yii\di\Container-&amp;gt;getDependencies('craft\\db\\mysql\\...')&#xA;#2 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\db\\mysql\\...', Array, Array)&#xA;#3 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\db\\mysql\\...', Array, Array)&#xA;#4 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/db/Connection.php(824): yii\BaseYii::createObject(Array)&#xA;#5 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/db/Connection.php(341): yii\db\Connection-&amp;gt;getSchema()&#xA;#6 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(223): craft\db\Connection-&amp;gt;tableExists('{{%info}}', false)&#xA;#7 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/services/Sites.php(1001): craft\web\Application-&amp;gt;getIsInstalled()&#xA;#8 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/services/Sites.php(380): craft\services\Sites-&amp;gt;_loadAllSites()&#xA;#9 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Component.php(180): craft\services\Sites-&amp;gt;setCurrentSite(NULL)&#xA;#10 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component-&amp;gt;__set('currentSite', NULL)&#xA;#11 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\services\Sites), Array)&#xA;#12 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#13 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#14 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\services\\...', Array, Array)&#xA;#15 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\services\\...', Array, Array)&#xA;#16 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)&#xA;#17 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('sites', true)&#xA;#18 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(289): yii\base\Module-&amp;gt;get('sites', true)&#xA;#19 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(983): craft\web\Application-&amp;gt;get('sites')&#xA;#20 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Request.php(914): craft\web\Application-&amp;gt;getSites()&#xA;#21 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Request.php(161): craft\web\Request-&amp;gt;_getCurrentSite()&#xA;#22 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request-&amp;gt;init()&#xA;#23 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#24 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#25 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Reque...', Array, Array)&#xA;#26 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Reque...', Array, Array)&#xA;#27 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/config/app.web.php(41): yii\BaseYii::createObject(Array)&#xA;#28 [internal function]: {closure}()&#xA;#29 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#30 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#31 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#32 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#33 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(289): yii\base\Module-&amp;gt;get('request', true)&#xA;#34 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(74): craft\web\Application-&amp;gt;get('request')&#xA;#35 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(499): yii\di\ServiceLocator-&amp;gt;__get('request')&#xA;#36 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(115): yii\web\ErrorHandler-&amp;gt;shouldRenderSimpleHtml()&#xA;#37 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(156): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#38 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#39 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(71): yii\base\ErrorHandler-&amp;gt;handleException(Object(yii\base\ErrorException))&#xA;#40 [internal function]: craft\web\ErrorHandler-&amp;gt;handleException(Object(yii\base\ErrorException))&#xA;#41 {main}&#xA;Previous exception:&#xA;yii\base\ErrorException: include(/var/www/shanehudson.net/codebase/craft/vendor/composer/../craftcms/cms/src/db/mysql/Schema.php): failed to open stream: No such file or directory in /var/www/shanehudson.net/codebase/craft/vendor/composer/ClassLoader.php:444&#xA;Stack trace:&#xA;#0 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler-&amp;gt;handleError(2, 'include(/var/ww...', '/var/www/shaneh...', 444)&#xA;#1 /var/www/shanehudson.net/codebase/craft/vendor/composer/ClassLoader.php(444): craft\web\ErrorHandler-&amp;gt;handleError(2, 'include(/var/ww...', '/var/www/shaneh...', 444, Array)&#xA;#2 /var/www/shanehudson.net/codebase/craft/vendor/composer/ClassLoader.php(444): include()&#xA;#3 /var/www/shanehudson.net/codebase/craft/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/var/www/shaneh...')&#xA;#4 [internal function]: Composer\Autoload\ClassLoader-&amp;gt;loadClass('craft\\db\\mysql\\...')&#xA;#5 [internal function]: spl_autoload_call('craft\\db\\mysql\\...')&#xA;#6 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(428): ReflectionClass-&amp;gt;__construct('craft\\db\\mysql\\...')&#xA;#7 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(364): yii\di\Container-&amp;gt;getDependencies('craft\\db\\mysql\\...')&#xA;#8 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\db\\mysql\\...', Array, Array)&#xA;#9 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\db\\mysql\\...', Array, Array)&#xA;#10 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/db/Connection.php(824): yii\BaseYii::createObject(Array)&#xA;#11 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/db/Connection.php(341): yii\db\Connection-&amp;gt;getSchema()&#xA;#12 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(223): craft\db\Connection-&amp;gt;tableExists('{{%info}}', false)&#xA;#13 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/services/Sites.php(1001): craft\web\Application-&amp;gt;getIsInstalled()&#xA;#14 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/services/Sites.php(380): craft\services\Sites-&amp;gt;_loadAllSites()&#xA;#15 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Component.php(180): craft\services\Sites-&amp;gt;setCurrentSite(NULL)&#xA;#16 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component-&amp;gt;__set('currentSite', NULL)&#xA;#17 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\services\Sites), Array)&#xA;#18 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#19 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#20 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\services\\...', Array, Array)&#xA;#21 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\services\\...', Array, Array)&#xA;#22 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)&#xA;#23 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('sites', true)&#xA;#24 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(289): yii\base\Module-&amp;gt;get('sites', true)&#xA;#25 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(983): craft\web\Application-&amp;gt;get('sites')&#xA;#26 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Request.php(914): craft\web\Application-&amp;gt;getSites()&#xA;#27 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Request.php(161): craft\web\Request-&amp;gt;_getCurrentSite()&#xA;#28 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request-&amp;gt;init()&#xA;#29 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#30 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#31 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Reque...', Array, Array)&#xA;#32 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Reque...', Array, Array)&#xA;#33 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/config/app.web.php(41): yii\BaseYii::createObject(Array)&#xA;#34 [internal function]: {closure}()&#xA;#35 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#36 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#37 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#38 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#39 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(289): yii\base\Module-&amp;gt;get('request', true)&#xA;#40 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application-&amp;gt;get('request')&#xA;#41 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(104): yii\web\Application-&amp;gt;getRequest()&#xA;#42 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Application.php(273): craft\web\Application-&amp;gt;bootstrap()&#xA;#43 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(90): yii\base\Application-&amp;gt;init()&#xA;#44 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application-&amp;gt;init()&#xA;#45 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#46 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/src/web/Application.php(82): yii\base\Application-&amp;gt;__construct(Array)&#xA;#47 [internal function]: craft\web\Application-&amp;gt;__construct(Array)&#xA;#48 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#49 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Appli...', Array, Array)&#xA;#50 /var/www/shanehudson.net/codebase/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Appli...', Array, Array)&#xA;#51 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(249): yii\BaseYii::createObject(Array)&#xA;#52 /var/www/shanehudson.net/codebase/craft/vendor/craftcms/cms/bootstrap/web.php(42): require('/var/www/shaneh...')&#xA;#53 /var/www/shanehudson.net/codebase/craft/web/index.php(20): require('/var/www/shaneh...')&#xA;#54 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="633" LastActivityDate="2018-04-08T14:39:24.377" Title="ReflectionException since upgrading to PHP 7.2" Tags="&lt;craft3&gt;&lt;php&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25538" PostTypeId="2" ParentId="25533" CreationDate="2018-04-08T18:05:22.677" Score="2" Body="&lt;p&gt;This is the way Heroku works with its &lt;a href=&quot;https://devcenter.heroku.com/articles/dynos#isolation-and-security&quot; rel=&quot;nofollow noreferrer&quot;&gt;ephemeral file system&lt;/a&gt;. Anything written by the webapp (which includes plugins installed via Composer) after the fact can be wiped out at any time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you must ship it on Heroku, you probably should check all of &lt;code&gt;vendor/&lt;/code&gt; into the repo, so that it's part of the actual deployment, and not added post facto.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-08T18:05:22.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25539" PostTypeId="2" ParentId="25515" CreationDate="2018-04-08T19:17:42.380" Score="1" Body="&lt;p&gt;The group filter loops through the passed elements in the order that they are returned by your query and builds the groups array in the order that it encounters the values being grouped. So there’s no predictable way to control what order the array keys are ordered. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to loop through all entries by dealStatus in a fixed order you could replace your &lt;code&gt;for&lt;/code&gt; loop with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for status in [‘InMarket’,’postBid’,’closing’,’closed’] %}&#xA;    {% if allDealsByStatus[status] is defined %}&#xA;&#xA;        {% set entriesInStatus = allDealsByStatus[status] %}&#xA;&#xA;        {# your list output code here #}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="153" LastActivityDate="2018-04-08T19:17:42.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25540" PostTypeId="1" CreationDate="2018-04-08T23:35:30.903" Score="2" ViewCount="245" Body="&lt;p&gt;In Craft 2, we could set a cookie like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;saveCookie()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and that would make it a &lt;em&gt;state&lt;/em&gt; cookie. &lt;a href=&quot;https://craftcms.stackexchange.com/q/13881/45&quot;&gt;This thread&lt;/a&gt; describes it pretty well. Essentially, you would end up with a cookie whose name began with a hashed string.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;b72b7553c36d6600e9aeb6c40513deb8&lt;strong&gt;MyCookie&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, it seems like that behavior has been largely removed in Craft 3. When I try to save a cookie now, I do it more like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$cookie = new Cookie();&#xA;$cookie-&amp;gt;name = $cookieName;&#xA;$cookie-&amp;gt;value = $cookieValue;&#xA;$cookie-&amp;gt;expire = time() + $lifespan;&#xA;Craft::$app-&amp;gt;getResponse()-&amp;gt;getCookies()-&amp;gt;add($cookie);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... which &lt;em&gt;doesn't&lt;/em&gt; create a state cookie. The cookie name is very simple.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;MyCookie&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, that doesn't bother me. But I worry about compatibility issues with the Craft 2 version of my plugin. It's somewhat important that cookies from the old system are recognized when Craft is upgraded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the solution for this?&lt;/strong&gt; How do I ensure that my old cookies are recognized properly, and/or continue saving this data using the original hashed format?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-04-10T05:43:46.850" Title="Craft 3: Recognize cookies created in Craft 2" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25541" PostTypeId="2" ParentId="25476" CreationDate="2018-04-09T00:02:28.907" Score="1" Body="&lt;p&gt;Had missed copying over a hidden .env file. Once I copied over to server, install completed. Thanks to all who commented.. &lt;/p&gt;&#xA;" OwnerUserId="4929" LastActivityDate="2018-04-09T00:02:28.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25542" PostTypeId="1" CreationDate="2018-04-09T00:34:59.543" Score="1" ViewCount="1662" Body="&lt;p&gt;I just installed Craft CMS 3 and I tried logging in as my admin user but it's not working. I enter the correct login information and nothing happens. I tried the reset password option but never got the email for some reason. Anyone have any ideas what is going on?&lt;/p&gt;&#xA;" OwnerUserId="8212" LastEditorUserId="57" LastEditDate="2018-12-17T04:41:01.817" LastActivityDate="2020-11-18T13:49:27.840" Title="Can't login after installing Craft CMS 3" Tags="&lt;users&gt;&lt;emails&gt;&lt;login&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25543" PostTypeId="1" AcceptedAnswerId="26031" CreationDate="2018-04-09T01:53:02.123" Score="0" ViewCount="49" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt; Our Craft 2 site has been working for years. Now I want to upgrade to Craft 3. On a test machine, I have been having problems with the upgrade process. I have tried 3 classes of things: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Craft 3 from scratch. This is working, but I'd really like to bring the old database along.&lt;/li&gt;&#xA;&lt;li&gt;Install Craft 3 and the old database, and try to do the upgrade.&lt;/li&gt;&#xA;&lt;li&gt;Just duplicate the old Craft 2 system with the old database, to get something to work.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; Anything I do with the old database (#2 or #3, above) is likely to cause Apache2 to go berserk, using up all memory and swap and bringing the system to a nearly complete halt. Not every page does this, but, for example, the CP Entries page does this when it attempts to list entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't been able find any errors in logs, though I'm not especially adept at that.  Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-06T01:33:47.193" Title="Craft causing Apache2 to max out memory and swap" Tags="&lt;apache&gt;&lt;upgrades&gt;&lt;memory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25544" PostTypeId="2" ParentId="6627" CreationDate="2018-04-09T03:51:00.440" Score="0" Body="&lt;p&gt;I was having similar issues and was able to add some additional fields per the documentation Brad had mentioned. However, I found this &lt;a href=&quot;https://github.com/craftcms/contact-form/issues/72&quot; rel=&quot;nofollow noreferrer&quot;&gt;post&lt;/a&gt; and it helped me print out the name and email address into the body of the email. Hope this helps someone.&lt;/p&gt;&#xA;" OwnerUserId="8213" LastActivityDate="2018-04-09T03:51:00.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25545" PostTypeId="1" AcceptedAnswerId="25557" CreationDate="2018-04-09T06:57:45.570" Score="0" ViewCount="523" Body="&lt;p&gt;Is there an easy way to return the total number of entries in a Super Table within a Matrix field?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-04-09T15:57:55.217" Title="Matrix Field Count Records" Tags="&lt;matrix&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25546" PostTypeId="2" ParentId="6627" CreationDate="2018-04-09T07:49:23.957" Score="0" Body="&lt;p&gt;@Clint Hubbard jr If you need the email and the fromName in the html message body this can also be done without an extra plugin, using jQuery. Insert two extra hidden fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;body_name&quot;type=&quot;hidden&quot; name=&quot;message[Name]&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;body_email&quot;type=&quot;hidden&quot; name=&quot;message[Email]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use the standard fields in the contact form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; required &amp;gt;&#xA;&amp;lt;input id=&quot;fromEmail&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; required &amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then jQuery:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;$(&quot;#fromName&quot;).change(function() {&#xA;var myText = document.getElementById(&quot;fromName&quot;).value;&#xA;    $('#body_name').val(myText);&#xA;});&#xA;$(&quot;#fromEmail&quot;).change(function() {&#xA;    var myText = document.getElementById(&quot;fromEmail&quot;).value;&#xA;    $('#body_email').val(myText);&#xA;});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastActivityDate="2018-04-09T07:49:23.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25547" PostTypeId="2" ParentId="23139" CreationDate="2018-04-09T08:41:32.680" Score="4" Body="&lt;p&gt;I had to download the CA certificate for curl : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://curl.haxx.se/docs/caextract.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://curl.haxx.se/docs/caextract.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And added it to php.ini to get the plugin store working on my local dev env.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;curl.cainfo = &quot;x:\path\cacert.pem&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[IIS windows as local dev env]&lt;/p&gt;&#xA;" OwnerUserId="721" LastEditorUserId="721" LastEditDate="2018-04-10T06:19:32.123" LastActivityDate="2018-04-10T06:19:32.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25548" PostTypeId="1" CreationDate="2018-04-09T09:02:42.687" Score="0" ViewCount="211" Body="&lt;p&gt;I have 2 x sites with base URLs set to &lt;code&gt;@web/en/&lt;/code&gt; and &lt;code&gt;@web/de/&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For client entries in a &quot;Clients&quot; section, I have a template at &lt;code&gt;templates/clients/_entry.twig&lt;/code&gt; which I want to use for both sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should the Entry URI Format be set to in the Clients section... eg should it be &lt;code&gt;clients/{slug}&lt;/code&gt; for both sites? Or should the base url be included in these dynamically somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(New to localisation so please excuse me if I'm doing this totally wrong!)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE: if I set the URI to &lt;code&gt;clients/{slug}&lt;/code&gt; and view &lt;code&gt;en/clients/clientname&lt;/code&gt; I get this error... &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Warning: chdir(): No such file or directory (errno 2) in&#xA;  /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line&#xA;  145&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Warning:&#xA;  require(/Users/jamesgreig/Repos/hoskins-craft/web/en/index.php):&#xA;  failed to open stream: No such file or directory in&#xA;  /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line&#xA;  147&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Fatal error: require(): Failed opening required&#xA;  '/Users/jamesgreig/Repos/hoskins-craft/web/en/index.php'&#xA;  (include_path='.:/usr/local/Cellar/php@7.1/7.1.16/share/pear') in&#xA;  /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line&#xA;  147&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="5275" LastEditDate="2018-04-10T05:23:24.917" LastActivityDate="2018-04-10T05:23:24.917" Title="Confused by template and URI settings for multi-lingual sites" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25549" PostTypeId="2" ParentId="7091" CreationDate="2018-04-09T09:10:07.053" Score="0" Body="&lt;p&gt;I do the same thing for an app, I generate a json when changed are made during the day in craft cms. This is being done in a custom plugin ran by a cronjob. The app then checks if there is a new json on launch and downloads it. I then visualise everything from that json. Images are being synced aswel.&lt;/p&gt;&#xA;" OwnerUserId="6857" LastActivityDate="2018-04-09T09:10:07.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25550" PostTypeId="1" AcceptedAnswerId="27114" CreationDate="2018-04-09T10:12:11.610" Score="2" ViewCount="1239" Body="&lt;p&gt;I've configured Redis to handle cache and sessions for Craft 3, and while cache configuration is working as expected, I had to disable session configuration due to the below error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It fails on the method &lt;em&gt;getAssetBundleFlashes&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other settings (e.g. for PHP) that may be required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Redis component config in &lt;em&gt;config/app.php&lt;/em&gt; for Yii 2 (yes I've added the yii2-redis package to my composer file too).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'components' =&amp;gt; [&#xA;        'redis' =&amp;gt; [&#xA;            'class' =&amp;gt; yii\redis\Connection::class,&#xA;            'hostname' =&amp;gt; getenv('REDIS_HOSTNAME'),&#xA;            'port' =&amp;gt; 6379,&#xA;            'database' =&amp;gt; 0,&#xA;        ],&#xA;        'session' =&amp;gt; [&#xA;            'class' =&amp;gt; yii\redis\Session::class,            &#xA;        ],&#xA;        'cache' =&amp;gt; [&#xA;            'class' =&amp;gt; yii\redis\Cache::class,&#xA;        ],&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An Error occurred while handling another error:&#xA;yii\base\UnknownMethodException: Calling unknown method: yii\redis\Session::getAssetBundleFlashes() in /srv/craft/vendor/yiisoft/yii2/base/Component.php:300&#xA;Stack trace:&#xA;#0 /srv/craft/vendor/craftcms/cms/src/web/View.php(896): yii\base\Component-&amp;gt;__call('getAssetBundleF...', Array)&#xA;#1 /srv/craft/vendor/craftcms/cms/src/web/View.php(818): craft\web\View-&amp;gt;registerAssetFlashes()&#xA;#2 /srv/craft/vendor/yiisoft/yii2/views/errorHandler/exception.php(526): craft\web\View-&amp;gt;endBody()&#xA;#3 /srv/craft/vendor/yiisoft/yii2/base/View.php(336): require('/srv/craft/vend...')&#xA;#4 /srv/craft/vendor/yiisoft/yii2/base/View.php(254): yii\base\View-&amp;gt;renderPhpFile('/srv/craft/vend...', Array)&#xA;#5 /srv/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(266): yii\base\View-&amp;gt;renderFile('/srv/craft/vend...', Array, Object(craft\web\ErrorHandler))&#xA;#6 /srv/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(126): yii\web\ErrorHandler-&amp;gt;renderFile('@yii/views/erro...', Array)&#xA;#7 /srv/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(156): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\UnknownMethodException))&#xA;#8 /srv/craft/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\UnknownMethodException))&#xA;#9 /srv/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(71): yii\base\ErrorHandler-&amp;gt;handleException(Object(yii\base\UnknownMethodException))&#xA;#10 [internal function]: craft\web\ErrorHandler-&amp;gt;handleException(Object(yii\base\UnknownMethodException))&#xA;#11 {main}&#xA;Previous exception:&#xA;yii\base\UnknownMethodException: Calling unknown method: yii\redis\Session::getAssetBundleFlashes() in /srv/craft/vendor/yiisoft/yii2/base/Component.php:300&#xA;Stack trace:&#xA;#0 /srv/craft/vendor/craftcms/cms/src/web/View.php(896): yii\base\Component-&amp;gt;__call('getAssetBundleF...', Array)&#xA;#1 /srv/craft/vendor/craftcms/cms/src/web/View.php(818): craft\web\View-&amp;gt;registerAssetFlashes()&#xA;#2 /srv/craft/storage/runtime/compiled_templates/0b/0b226b9457e83d59f4ca4ab9c0a794a8e7489d0fa5850859e4263059d8eeeb71.php(63): craft\web\View-&amp;gt;endBody()&#xA;#3 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_dcb3cad6f26dfdd9b0c18a08e2464625842a6825bf5d95797cfd4aff7f9d3ba1-&amp;gt;doDisplay(Array, Array)&#xA;#4 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#5 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#6 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#7 /srv/craft/storage/runtime/compiled_templates/92/928ab9c5030f542894551fd742424701943b57966d99233b0de96b7fd7dbc7fa.php(40): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#8 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_566de35bd43d5ce1cf719a311929c2acf2baa3debb31cbeb7c6967ed2e3324cd-&amp;gt;doDisplay(Array, Array)&#xA;#9 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#10 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#11 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#12 /srv/craft/storage/runtime/compiled_templates/df/df104a4367ddd257c886d6ca86296f015495978d68f657dc29d28b6b8d55ad76.php(94): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#13 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_9f1f09a6b58c9f64d0f79651ec01d22c48213d3eb6b8317580edaa5e0f09bc62-&amp;gt;doDisplay(Array, Array)&#xA;#14 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#15 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#16 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#17 /srv/craft/storage/runtime/compiled_templates/b9/b93d72fd3873b8f06d39c6630e8e2d8fcfadfd6798468d109266fec4e37c1dfe.php(32): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#18 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_19451c5d966903f571459e857efabdca189708bebe8e4a3b3611e8d1061509a9-&amp;gt;doDisplay(Array, Array)&#xA;#19 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#20 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#21 /srv/craft/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#22 /srv/craft/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#23 /srv/craft/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#24 /srv/craft/vendor/craftcms/cms/src/web/View.php(305): Twig_Environment-&amp;gt;render('dashboard/_inde...', Array)&#xA;#25 /srv/craft/vendor/craftcms/cms/src/web/View.php(352): craft\web\View-&amp;gt;renderTemplate('dashboard/_inde...', '[&amp;lt;span class=&quot;s...')&#xA;#26 /srv/craft/vendor/craftcms/cms/src/web/Controller.php(113): craft\web\View-&amp;gt;renderPageTemplate('dashboard/_inde...', '[&amp;lt;span class=&quot;s...')&#xA;#27 /srv/craft/vendor/craftcms/cms/src/controllers/DashboardController.php(135): craft\web\Controller-&amp;gt;renderTemplate('dashboard/_inde...', Array)&#xA;#28 [internal function]: craft\controllers\DashboardController-&amp;gt;actionIndex()&#xA;#29 /srv/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#30 /srv/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#31 /srv/craft/vendor/craftcms/cms/src/web/Controller.php(74): yii\base\Controller-&amp;gt;runAction('index', Array)&#xA;#32 /srv/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('index', Array)&#xA;#33 /srv/craft/vendor/craftcms/cms/src/web/Application.php(238): yii\base\Module-&amp;gt;runAction('dashboard/index', Array)&#xA;#34 /srv/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&amp;gt;runAction('dashboard/index', Array)&#xA;#35 /srv/craft/vendor/craftcms/cms/src/web/Application.php(227): yii\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#36 /srv/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#37 /srv/craft/web/index.php(30): yii\base\Application-&amp;gt;run()&#xA;#38 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7336" LastActivityDate="2018-11-27T15:18:07.127" Title="Craft CMS 3 - Redis Sessions cause error" Tags="&lt;craft3&gt;&lt;cache&gt;&lt;session&gt;&lt;redis&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25551" PostTypeId="1" AcceptedAnswerId="25786" CreationDate="2018-04-09T10:46:47.683" Score="1" ViewCount="85" Body="&lt;p&gt;I have Craft running locally, the latest 2.x branch. When I change the server to run PHP 7 instead of 5.x, the local Craft frontend still works, but I can't login to the backend. It says &quot;Invalid username or password&quot;, even after doing the reset password process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to prep a site for upgrading to Craft 3, but if I can't even get Craft 2.x running on PHP 7... :-/&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-04-20T09:30:33.480" Title="After switching from PHP 5 to 7 for a local 2.x install, I can't login" Tags="&lt;php&gt;&lt;login&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25552" PostTypeId="2" ParentId="25504" CreationDate="2018-04-09T12:25:24.077" Score="5" Body="&lt;p&gt;Finally figured out how to edit this index.php file if you're not able to point your document root to the web folder, or if you are forced to put craft in the folder private_html that shared hosters tend to use (or any other given structure above root)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the index.php file you only need to edit this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your index.php file resides in public_html, &lt;code&gt;__DIR__&lt;/code&gt; will be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/hostname.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To point the index.php to the hidden craft folder, above root, in my case I had to add the folders after the CRAFT_BASE_PATH:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__).'/private_html/craft');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastActivityDate="2018-04-09T12:25:24.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25553" PostTypeId="1" CreationDate="2018-04-09T14:50:04.920" Score="1" ViewCount="110" Body="&lt;p&gt;I'm trying to include different markup if a blog post is featured.&#xA;This is done via a Lightswitch. If there's is no featured entry then the latest entry uses this different markup instead.&#xA;The rest of the entries follow this but need to exclude showing the featured entry if it is shown above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is something like what I'm trying to achieve &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featured = craft.entries.section('blog').featured(1).limit(1) %}&#xA;{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}&#xA;{% for entry in entriesOnPage %}&#xA;    {% if entry is featured or loop.first and not featured|length %}&#xA;&#xA;       [markup A]&#xA;&#xA;    {% else %}&#xA;&#xA;       [markup B excluding featured item]&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="331" LastEditDate="2018-04-09T15:11:39.113" LastActivityDate="2018-04-09T15:11:39.113" Title="If featured or latest entry" Tags="&lt;loop&gt;&lt;lightswitch&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25554" PostTypeId="2" ParentId="25553" CreationDate="2018-04-09T15:09:24.133" Score="1" Body="&lt;p&gt;You could try this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featured = craft.entries.section('blog').featured(1).count() %}&#xA;{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}&#xA;{% for index, entry in entriesOnPage %}&#xA;    {# entry is featured or it's the first entry and there are no other&#xA;    featured entries #}&#xA;    {% if entry.featured or (index == 0 and featured == 0) %}&#xA;        [markup A]&#xA;    {% else %}&#xA;        [markup B excluding featured item]&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-09T15:09:24.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25555" PostTypeId="2" ParentId="25553" CreationDate="2018-04-09T15:10:23.160" Score="0" Body="&lt;p&gt;Based on the docs of the lightswitch field can't you just to this? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}&#xA;{% for entry in entriesOnPage %}&#xA;{% if entry.featured or loop.first and not entry.featured %}&#xA;&#xA;This entry is featured. &#xA;&#xA;{% else %}&#xA;&#xA;Entry isnt featured&#xA;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2018-04-09T15:10:23.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25556" PostTypeId="2" ParentId="25514" CreationDate="2018-04-09T15:40:31.393" Score="1" Body="&lt;p&gt;I think I might finally have it working. If someone has a more elegant way to handle the index, tag and category I would love to see it! &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;!-- entry --&amp;gt;&#xA;        {% if entry is defined %}&#xA;&#xA;            {% for siteForEntry in entry.getSupportedSites %}&#xA;&#xA;                {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}&#xA;&#xA;                {% if site.id != entry.siteId %}&#xA;&#xA;                    {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;&#xA;                    {% if entryForOtherSite is not null %}&#xA;&#xA;                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ site.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;                    {% endif %}&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;!-- category --&amp;gt;&#xA;        {% elseif category is defined %}&#xA;&#xA;            {% set currentSite = craft.app.sites.currentSite %}&#xA;&#xA;            {% set sites = craft.app.sites.getAllSites() %}&#xA;&#xA;            {% for site in sites %}&#xA;&#xA;                {% if site.id != currentSite.id %}&#xA;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ site.baseUrl }}blog/category/{{craft.request.getLastSegment()}}&quot;&amp;gt;{{ site.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;!-- index and tags --&amp;gt;&#xA;        {% else %}&#xA;&#xA;            {% set currentSite = craft.app.sites.currentSite %}&#xA;&#xA;            {% set sites = craft.app.sites.getAllSites() %}&#xA;&#xA;            {% for site in sites %}&#xA;&#xA;                {% if site.id != currentSite.id %}&#xA;&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ site.baseUrl }}{% for segment in craft.request.getSegments() %}{{segment}}/{% endfor %}&quot;&amp;gt;{{ site.name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&#xA;                {% endif %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="8185" LastEditDate="2018-04-09T18:39:50.580" LastActivityDate="2018-04-09T18:39:50.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25557" PostTypeId="2" ParentId="25545" CreationDate="2018-04-09T15:57:55.217" Score="2" Body="&lt;p&gt;You mean how many rows the table has?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ matrixblock.superTableFieldHandle|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or the number of blocks of a matrix field?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ parent.matrixFieldHandle|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the number of blocks for each row&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.superTableMatrix %}&#xA;    {{ row.matrix|length %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-09T15:57:55.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25558" PostTypeId="1" CreationDate="2018-04-09T16:14:16.510" Score="1" ViewCount="191" Body="&lt;p&gt;Does anyone think there will be an automatic update from 2-3? Or as the file structure is different do you think it'll be unlikely?&lt;/p&gt;&#xA;" OwnerUserId="8214" LastEditorUserId="5275" LastEditDate="2018-04-09T16:33:04.480" LastActivityDate="2018-04-11T08:22:08.717" Title="Craft 3 automatic update" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;auto-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25559" PostTypeId="2" ParentId="25558" CreationDate="2018-04-09T16:25:22.360" Score="2" Body="&lt;p&gt;As far as I know, there are no plans for an automatic update from Craft 2 to Craft 3. I'd suggest following the instructions from the docs to perform the update manually: &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-04-09T16:25:22.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25560" PostTypeId="2" ParentId="13852" CreationDate="2018-04-09T18:45:55.517" Score="3" Body="&lt;p&gt;Further to Ben’s answer, it may be inconvenient to &lt;code&gt;set&lt;/code&gt; and &lt;code&gt;replace&lt;/code&gt; every time the partial with the CSRF token is required, in which case the replacing can instead be done in one go for each page’s content in the layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_some_partial.twig:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    ${getCsrfInput}&#xA;    # ...&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;some_page.twig:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block content %}&#xA;    {% include '_some_partial.twig' %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.twig:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block('content')|replace({'${getCsrfInput}': getCsrfInput()})|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="975" LastActivityDate="2018-04-09T18:45:55.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25562" PostTypeId="2" ParentId="17677" CreationDate="2018-04-09T21:29:02.867" Score="23" Body="&lt;p&gt;In Craft 3 this is now &lt;code&gt;{{ craft.app.request.absoluteUrl }}&lt;/code&gt; — for those who land here from a search and want to avoid using the deprecation notice to update it!&lt;/p&gt;&#xA;" OwnerUserId="6275" LastActivityDate="2018-04-09T21:29:02.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25563" PostTypeId="2" ParentId="25522" CreationDate="2018-04-09T22:19:17.320" Score="3" Body="&lt;p&gt;According to Pixel &amp;amp; Tonic:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can I use Craft Solo for client work?&lt;/p&gt;&#xA;&lt;p&gt;Technically yes, however, we don’t recommend it. Craft Solo is meant to be a solution for developers to get to know Craft and create one-off sites for themselves and their friends. We do not recommend giving admin access to non-developers and therefore strongly recommend that any professional work is done on Craft Pro. This ensures the best experience for everyone.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So as long as you're ok with everyone having admin access (and no branding and no developer support), it's fine, including for commercial usage.&lt;/p&gt;&#xA;" OwnerUserId="130" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-04-09T22:19:17.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25564" PostTypeId="1" AcceptedAnswerId="25569" CreationDate="2018-04-09T23:02:32.290" Score="1" ViewCount="188" Body="&lt;p&gt;I realized Craft 3 generates its own thumbnails and does not use Cloudinary to do this on the CP. My question is, how and where should I modify the JavaScript code, or what is the best practice to use external generator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is really just utilize the query string of Cloudinary instead of doing this on Craft side...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So somehow I would like to overwrite this call, and change it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SITE/cpresources/4c875891/thumb-30x30.jpg?v=1522966431&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I also would like to avoid the generate thumbnail:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://tr3nds.test/index.php?p=admin/actions/assets/generate-thumb&amp;amp;uid=7b78d4ed-9c3d-4193-89c0-f20e0d3c35be&amp;amp;width=30&amp;amp;height=30&amp;amp;v=1523244927&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-04-12T05:12:20.100" LastActivityDate="2018-04-12T05:12:20.100" Title="Cloudinary thumbnail creation for assets" Tags="&lt;filesystem&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25565" PostTypeId="1" AcceptedAnswerId="25568" CreationDate="2018-04-09T23:24:33.130" Score="1" ViewCount="502" Body="&lt;p&gt;I'm sure I'm doing something wrong here, but I'm at a loss as to what. I'm using Craft 3. My travel entry has 7 fields, one of those being a matrix field. My matrix has two blocks, &lt;code&gt;postText&lt;/code&gt; and &lt;code&gt;postImage&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the bit of code I'm working with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.mainPost.all() %}&#xA;  {% if block.type == &quot;postImage&quot; %}&#xA;    {% set image = block.image.one() %}&#xA;        {% if image %}&#xA;            &amp;lt;img src=&quot;{{ image.getUrl('summaryImage')}}&quot; alt=&quot;&quot;&amp;gt;&#xA;        {% endif %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an entry that has two images in the Matrix field. When I load the page, both images load. The documentation states that using &lt;code&gt;.one()&lt;/code&gt; &lt;em&gt;&quot;Returns the first matching element&quot;&lt;/em&gt;. I have to assume that I'm not understanding the ElementCriteriaModel or Assets or the way Matrix works or something.&lt;/p&gt;&#xA;" OwnerUserId="895" LastEditorUserId="5275" LastEditDate="2018-04-11T16:43:32.973" LastActivityDate="2018-04-11T16:43:32.973" Title="block.image.one() shows more than one image" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25566" PostTypeId="1" CreationDate="2018-04-09T23:44:50.023" Score="1" ViewCount="1963" Body="&lt;p&gt;I've been Googling around all day looking for answers to this, but I'm actually stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so basically I installed Craft 3 via Composer into a subdomain on my development server (apache). Everything ran successfully, there are no error logs, and the database has been populated with all of the tables. The problem is that if I go to &lt;code&gt;http://craft.domain.com/index.php?p=admin&lt;/code&gt; (or &lt;code&gt;/index/admin&lt;/code&gt; or &lt;code&gt;/admin&lt;/code&gt; or &lt;code&gt;/&lt;/code&gt;) all I get is a &lt;em&gt;500 Internal server error&lt;/em&gt;, and not one with the fancy craft background either. It does say &lt;code&gt;email webmaster@craft.domain.com...&lt;/code&gt; on the error screen so I know SOMETHING's clicking, but I can't work my way around this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried installing Craft once before manually by extracting the zip, uploading all the files, and then changing the &lt;code&gt;.env&lt;/code&gt; file, and I got a similar result. I still wasn't able to access the admin OR the install page, and that's why I ended up trying it all through Composer instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running the latest version of Apache, PHP 7, MYSQL with InnoDB; I run a ton of wordpress and laravel sites on this server without issue so I'm not clear on what makes Craft so different. I have WHM and shell access. Open to all suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Directory structure looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/home/username/public_html/craft (this is also the subdomain path)&#xA;  - config&#xA;  - modules&#xA;  - storage&#xA;  - templates&#xA;  - vendor&#xA;  - web&#xA;  - (and then the composer/env files)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Directory permissions are 775, the rest of the files are default Craft 3 installation. I've also made sure my PHP 7 memory limit is at 128MB (it was set to 32MB for some reason).&#xA;Thank you for any advice in advance! &lt;/p&gt;&#xA;" OwnerUserId="8216" LastEditorUserId="57" LastEditDate="2018-04-12T05:13:58.860" LastActivityDate="2018-04-13T22:46:25.837" Title="Successfully installed Craft 3 via Composer but can't access site or admin" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25567" PostTypeId="2" ParentId="25542" CreationDate="2018-04-10T00:10:22.617" Score="1" Body="&lt;p&gt;It was a permission issue. I used the command below on the entire craft folder to get this to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo chmod -R 777 craft/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The logs were saying that it didn't have permissions to open many files.&lt;/p&gt;&#xA;" OwnerUserId="8212" LastActivityDate="2018-04-10T00:10:22.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25568" PostTypeId="2" ParentId="25565" CreationDate="2018-04-10T00:13:12.957" Score="3" Body="&lt;p&gt;Yes you're correct, &lt;code&gt;one()&lt;/code&gt; will get the first matching element. However, in your code you're not asking for the first image block, but rather the first image from each image block (because each image field can have multiple images attached to it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure is basically something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry          &amp;lt;- 1. The entry&#xA;  mainPost     &amp;lt;- 2. The matrix field&#xA;    postImage  &amp;lt;- 3. The matrix field's block&#xA;      image    &amp;lt;- 4. The field inside the matrix field's block&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We want to get the first result from #3 but you're currently only asking for the first result from #4. (It is probably a good idea to also ask for the first result from #4 as well btw.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think something like the following would work in your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.mainPost.type(&quot;postImage&quot;).limit(1).all() %}&#xA;  {% set image = block.image.one() %}&#xA;  {% if image %}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl('summaryImage')}}&quot; alt=&quot;&quot;&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: looks like you actually need to use &lt;code&gt;limit()&lt;/code&gt; instead of &lt;code&gt;one()&lt;/code&gt; when querying for the block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2: tacked on the &lt;code&gt;all()&lt;/code&gt; to fix the deprecation!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-04-10T00:55:24.440" LastActivityDate="2018-04-10T00:55:24.440" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25569" PostTypeId="2" ParentId="25564" CreationDate="2018-04-10T00:29:12.643" Score="2" Body="&lt;p&gt;You can catch the &lt;code&gt;EVENT_GET_ASSET_THUMB_URL&lt;/code&gt; event in your plugin and return the &lt;code&gt;$event-&amp;gt;url&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Event::on(Assets::class, Assets::EVENT_GET_ASSET_THUMB_URL, function(GetAssetThumbUrlEvent $event) {&#xA;            $event-&amp;gt;url = $this-&amp;gt;thumbUrl($event);&#xA;        });&#xA;&#xA;   protected function thumbUrl($event)&#xA;      {&#xA;           return &quot;{$this-&amp;gt;cloudinary_ulr}/image/upload/w_{$event-&amp;gt;width},h_{$event-&amp;gt;height}/{$event-&amp;gt;asset-&amp;gt;filename}&quot;;&#xA;      }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8217" LastActivityDate="2018-04-10T00:29:12.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25570" PostTypeId="2" ParentId="25540" CreationDate="2018-04-10T05:43:46.850" Score="2" Body="&lt;p&gt;After a lot of trial &amp;amp; error, it turns out this is &lt;strong&gt;not possible&lt;/strong&gt;. (At least, not by me.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to retrieve the raw Craft 2 cookie data using the following code...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Generate hash of Craft 2 cookie&#xA;private function _getCraft2CookieHash()&#xA;{&#xA;    $newBasePath = Craft::$app-&amp;gt;getBasePath();&#xA;    $oldBasePath = str_replace('vendor/craftcms/cms/src', 'app', $newBasePath);&#xA;    $appId = sprintf('%x',crc32($oldBasePath.'Craft'));&#xA;    return md5('Yii.Craft\UserSessionService.'.$appId);&#xA;}&#xA;&#xA;// Get existing Craft 2 cookie data&#xA;public function getExistingCookieData()&#xA;{&#xA;    // Get name of Craft 2 cookie&#xA;    $craft2CookieHash = $this-&amp;gt;_getCraft2CookieHash();&#xA;    $craft2CookieName = $craft2CookieHash.'MyCookie';&#xA;&#xA;    // If Craft 2 cookie exists&#xA;    if (isset($_COOKIE[$craft2CookieName])) {&#xA;&#xA;        // Get value of Craft 2 cookie&#xA;        $cookieValue = $_COOKIE[$craft2CookieName];&#xA;&#xA;        /**&#xA;         * THIS IS WHERE IT ALL FELL APART&#xA;         * The cookie data is too highly encoded.&#xA;         */&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was able to correctly determine the hash which makes up part of the Craft 2 cookie's name. Keep in mind, &lt;strong&gt;this only works if the site's folder structure did not change.&lt;/strong&gt; The docs give you &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;two different ways&lt;/a&gt; to upgrade the site from Craft 2, and this hash-detection logic will only work if you choose to &quot;keep your current directory structure&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, things really fell apart when trying to get the actual &lt;em&gt;data&lt;/em&gt; from the cookie. The data is encoded in some very complex ways. In Craft 2, it uses a complicated function called &lt;code&gt;computeHMAC&lt;/code&gt; which goes way beyond my understanding of security. There is no equivalent function in Craft 3 (and if there was, it would probably operate quite differently).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sadly, I have to throw in the towel and admit defeat here. Backwards engineering the &lt;code&gt;computeHMAC&lt;/code&gt; function is more than my puny brain can handle. :(&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-04-10T05:43:46.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25571" PostTypeId="1" AcceptedAnswerId="25573" CreationDate="2018-04-10T08:00:04.347" Score="3" ViewCount="465" Body="&lt;p&gt;This used to work in Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro richText(macroParam) %}&#xA;  {{ macroParam |striptags('&amp;lt;br&amp;gt;&amp;lt;p&amp;gt;&amp;lt;li&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;a&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;i&amp;gt;')|raw }}&#xA;{% endmacro %}&#xA;&#xA;{# include the richtext macro on multiple occasion into another macro #}    &#xA;{% macro memberMolecule( entryParam ) %}&#xA;  {{ _self.richText(entryParam.body) }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now in Craft 3 this causes the error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;richText&quot;) on a string variable&#xA;  (&quot;path/to/file/with/the/macro&quot;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I have to rewrite this for Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2018-04-12T05:16:02.410" LastActivityDate="2018-04-12T05:16:02.410" Title="Macro _self no longer possible in Craft 3" Tags="&lt;craft3&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25572" PostTypeId="1" CreationDate="2018-04-10T08:09:59.647" Score="1" ViewCount="413" Body="&lt;p&gt;I am a beginner. I just install it on a server and also on localhost. But facing the same problem.&#xA;I set it &lt;a href=&quot;http://www.example.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.com/&lt;/a&gt; but I go to this URL it shows me the directory but when I go to &lt;a href=&quot;http://www.example.com/web&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.com/web&lt;/a&gt; it goes to the default template.&#xA;I want to access default template on &lt;a href=&quot;http://www.example.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.com&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8218" LastEditorUserId="57" LastEditDate="2018-04-12T05:36:58.010" LastActivityDate="2018-04-12T05:36:58.010" Title="How to set base URL on the installation of Craft CMS on server" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25573" PostTypeId="2" ParentId="25571" CreationDate="2018-04-10T08:12:56.987" Score="4" Body="&lt;p&gt;You have to import the macro &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# include the richtext macro on multiple occasion into another macro #}    &#xA;{% macro memberMolecule( entryParam ) %}&#xA;    {% import _self as macro %}&#xA;    {{ macro.richText(entryParam.body) }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-10T08:12:56.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25574" PostTypeId="1" AcceptedAnswerId="25584" CreationDate="2018-04-10T08:15:56.983" Score="1" ViewCount="1077" Body="&lt;p&gt;I'm trying to figure out how to load a template file and pass it as a variable to another template file while it is being included. In some sense I want to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'component/footer', with 'component/nav' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know I can't do that directly, but in the twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; there is an example showing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$template = $twig-&amp;gt;load('some_template.twig');&#xA;$twig-&amp;gt;display('template.twig', array('template' =&amp;gt; $template));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do the same thing with Craft's twig support? &lt;/p&gt;&#xA;" OwnerUserId="7464" LastEditorUserId="5557" LastEditDate="2018-04-10T13:37:51.833" LastActivityDate="2018-04-10T14:03:21.940" Title="Twig function to load templates into variable?" Tags="&lt;templating&gt;&lt;include&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25575" PostTypeId="1" AcceptedAnswerId="25576" CreationDate="2018-04-10T08:39:04.707" Score="1" ViewCount="189" Body="&lt;p&gt;I'm currently working on creating a full-sized Edit Page for my own Element Type.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a &lt;code&gt;elementSelectField&lt;/code&gt; and wanted to know if you guys have some advise or good articles to read on that matter. Right now I'm crawling my way through the craft code for reverence and i am not sure if I'm doing this correctly :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set section = craft.app.sections.getSectionByHandle('days') %}&#xA;{% set elementType = craft.app.elements.getElementTypeByRefHandle('Entry') %}&#xA;&#xA;{{ forms.elementSelectField({&#xA;        label: 'Day'|t('app'),&#xA;        instructions: 'The day the cookie belongs to'|t('app'),&#xA;        id: 'day',&#xA;        name: 'day',&#xA;        elementType: elementType,&#xA;        selectionLabel: &quot;Choose a day&quot;|t('app'),&#xA;        sources: ['section:'~section.id],&#xA;        criteria: '',&#xA;        elements: elementType,&#xA;        viewMode: 'list',&#xA;        limit: 1,&#xA;    })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is Ok? Sending the form to my controller and dumping it there, the &lt;code&gt;selectfield&lt;/code&gt;'s value array contains only the choosen entry's id.&lt;/p&gt;&#xA;" OwnerUserId="8219" LastEditorUserId="250" LastEditDate="2018-04-11T16:48:06.057" LastActivityDate="2018-04-11T16:48:06.057" Title="Element Type: Edit Page fields" Tags="&lt;plugin-development&gt;&lt;sections&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25576" PostTypeId="2" ParentId="25575" CreationDate="2018-04-10T08:50:51.377" Score="1" Body="&lt;p&gt;Yes this is correct. The best documentation you can find is the source code, so looking at it is usually the way to go. Craft stores all relations with an &lt;strong&gt;array&lt;/strong&gt; of element ids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have a &lt;code&gt;BaseRelationField&lt;/code&gt; in your elements field layout you'll store the value - even if it's a single value - like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element-&amp;gt;setFieldValue('day', [1]); //&amp;lt;- note, always pass an array&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or the faster variant) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldsLocation = Craft::$app-&amp;gt;getRequest()-&amp;gt;getParam('fieldsLocation', 'fields');&#xA;$element-&amp;gt;setFieldValuesFromRequest($fieldsLocation);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't use a field layout and store your relations in a custom table/column you'll have to find a way that fits your requirements&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-10T08:50:51.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25578" PostTypeId="1" AcceptedAnswerId="25697" CreationDate="2018-04-10T10:06:51.393" Score="0" ViewCount="739" Body="&lt;p&gt;I try to install Craft 3 but I encounter an issue at the very beginning.&#xA;I uploaded the CMS via FTP and completed manually the .env file. When I try to run the installation, I get stuck at the account creation (the second step…) I want to create my account but the next button is doing nothing.&#xA;I get an error 400 &quot;Bad Request // Unable to verify your data submission.&quot; When I send the form to create the admin account (POST to &lt;a href=&quot;http://mywebsite.com/web/index.php?p=admin/actions/install/validate-account&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mywebsite.com/web/index.php?p=admin/actions/install/validate-account&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server meet the requirements of Craft CMS (runned the server check and was ok). The DB connection is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to delete and reupload all the CMS but nothing changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I'm unable to install Craft :| I saw some topics of the same issue but they're all unanswered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the corresponding logs :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            2018-04-13 06:05:42 [2a02:a03f:3c1f:a00:6826:543f:275d:d8d5][-][-][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /home/MyWebsite/www/vendor/yiisoft/yii2/web/Controller.php:166&#xA;            Stack trace:&#xA;            #0 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Controller.php(53): yii\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;            #1 /home/MyWebsite/www/vendor/yiisoft/yii2/base/Controller.php(155): craft\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;            #2 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Controller.php(74): yii\base\Controller-&amp;gt;runAction('validate-accoun...', Array)&#xA;            #3 /home/MyWebsite/www/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('validate-accoun...', Array)&#xA;            #4 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Application.php(238): yii\base\Module-&amp;gt;runAction('install/validat...', Array)&#xA;            #5 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Application.php(446): craft\web\Application-&amp;gt;runAction('install/validat...', Array)&#xA;            #6 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Application.php(410): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;            #7 /home/MyWebsite/www/vendor/craftcms/cms/src/web/Application.php(147): craft\web\Application-&amp;gt;_processInstallRequest(Object(craft\web\Request))&#xA;            #8 /home/MyWebsite/www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;            #9 /home/MyWebsite/www/web/index.php(21): yii\base\Application-&amp;gt;run()&#xA;            #10 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8221" LastEditorUserId="8221" LastEditDate="2018-04-13T13:14:32.760" LastActivityDate="2018-04-16T11:39:58.590" Title="Craft 3 installation issue on account creation" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25579" PostTypeId="1" CreationDate="2018-04-10T10:41:58.580" Score="1" ViewCount="520" Body="&lt;p&gt;I'm a relative newbie to Craft CMS / Solspace Freeform. I'm trying to implement a form which will capture some basic details and send to an email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done the setup correctly (from what I can see) however when I go into email notifications I can only see database entry templates and no email notification templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I test my form it submits the data to the submission page on Craft but no email is ever sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a contact form and related template setup by someone prior to me on the website which I know emails to a specified email address, but I can't seem to get mine working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8222" LastEditorUserId="57" LastEditDate="2018-04-12T05:20:49.803" LastActivityDate="2019-01-21T06:02:30.177" Title="Solspace Freeform email notifications" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25580" PostTypeId="1" AcceptedAnswerId="25581" CreationDate="2018-04-10T12:07:28.283" Score="1" ViewCount="33" Body="&lt;p&gt;I'm trying to use this slightly differently:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19730/how-do-i-omit-similar-content-in-a-for-loop-based-on-the-first-letter-in-title&quot;&gt;How do I omit similar content in a for loop based on the first letter in title?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a for loop with several entries. One field is a drop-down with a bunch of vendors listed, and the user can select only one. I want a list of vendors that have been selected in the entries so that somebody can click on the vendor and see only the entries associated with that vendors. Clear as mud?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If no vendor is in any entries, then it should not be on the list.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vendorArray = [] %}&#xA;&#xA;{% for entry in craft.entries.section('orderBook').order('vendor').all() %}&#xA;  {% if entry.vendor not in vendorArray %}&#xA;    {% set vendorArray = vendorArray|merge([entry.vendor]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{% for link in vendorArray %}&#xA;  &amp;lt;a href=&quot;{{ siteUrl }}{{ link }}&quot;&amp;gt;{{ link }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above link shows this working with only using the first letter of a field. I  want to use the entire field. I removed the filter |first and then I start to get duplicate vendors. I think the solution has something to do with the operator &quot;not in&quot;, but I'm a noob so not too sure.&lt;/p&gt;&#xA;" OwnerUserId="6441" LastActivityDate="2018-04-10T12:16:24.143" Title="Omitting repeated content in a for loop" Tags="&lt;forloop&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25581" PostTypeId="2" ParentId="25580" CreationDate="2018-04-10T12:16:24.143" Score="2" Body="&lt;p&gt;Currently you are trying to compare objects with each other and of course they are always different since they have a different reference. &lt;code&gt;entry.vendor&lt;/code&gt; is not a single selected value but the &lt;code&gt;field&lt;/code&gt; with all it's options and possible values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please try &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('orderBook').order('vendor').all() %}&#xA;    {% if entry.vendor.value not in vendorArray %}&#xA;        {% set vendorArray = vendorArray|merge([entry.vendor.value]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-10T12:16:24.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25582" PostTypeId="1" AcceptedAnswerId="25583" CreationDate="2018-04-10T13:21:36.453" Score="1" ViewCount="457" Body="&lt;p&gt;I want to call an action via an ajax call with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    url: Craft.getActionUrl(_this.options.updateRestockAction),&#xA;    method: 'POST',&#xA;    headers: headers,&#xA;    data: data,&#xA;    success: function(data) {&#xA;        console.log(data);&#xA;    },&#xA;    error: function(jqXHR, textStatus) {&#xA;        console.log('error');&#xA;    },&#xA;    complete: function(jqXHR, textStatus) {&#xA;        console.log('complete');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My action is being called successfully. However, I can't find out how to return data to the success callback. Any idea how to do this? I'm using Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8224" LastEditorUserId="250" LastEditDate="2018-04-11T16:48:49.557" LastActivityDate="2018-04-11T16:48:49.557" Title="How to return data to an ajax succes callback" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25583" PostTypeId="2" ParentId="25582" CreationDate="2018-04-10T13:51:19.817" Score="2" Body="&lt;p&gt;As Robin mentions, your controller needs to return an object of type Response, and in your case you probably want to return it with the format set to json. There's a helper method in Craft's &lt;code&gt;Controller&lt;/code&gt; class, &lt;code&gt;asJson&lt;/code&gt;, which is handy for this. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyControllerAction()&#xA;{&#xA;    $result = ['my' =&amp;gt; 'data'];&#xA;    return $this-&amp;gt;asJson($result);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should give you back an object for &lt;code&gt;data&lt;/code&gt; with a key of &lt;code&gt;my&lt;/code&gt; with value &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-10T13:51:19.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25584" PostTypeId="2" ParentId="25574" CreationDate="2018-04-10T14:03:21.940" Score="3" Body="&lt;p&gt;You can't do it exactly like that in Twig. But there're different approaches that'd do the same thing depending on exactly what you're trying to achieve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, you could parse the template into a variable, and then pass the variable to your include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set nav %}&#xA;    {% include 'component/nav' %}&#xA;{% endset %}&#xA;&#xA;{% include 'component/footer' with { nav: nav } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, you could just pass in the template name as a string, and parse it inside the component/footer template. In you base template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'component/footer' with { navTemplateName: 'component/nav' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside component/footer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include navTemplateName %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What approach suits your use case depends on whether or not the scope that component/nav is parsed in, matters.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-10T14:03:21.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25585" PostTypeId="1" AcceptedAnswerId="25596" CreationDate="2018-04-10T14:40:48.307" Score="2" ViewCount="771" Body="&lt;p&gt;My hoster has i public html folder where all websites are lying. Different Websites are separeted by subfolders. Should i upload all Craft3 installation files to this public html folder and point the webserver to the /web folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should i upload only the /web folder to my webhoster's public html folder and place all other files ABOVE, like it's explained in the &lt;a href=&quot;https://docs.craftcms.com/v2/installing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2 installation guide&lt;/a&gt;? &#xA;If yes, how do i configure the craft path in the index.php file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for a explanation!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2018-04-11T06:28:14.100" Title="Craft 3 upload path on webserver" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25587" PostTypeId="1" CreationDate="2018-04-10T15:12:02.183" Score="1" ViewCount="175" Body="&lt;p&gt;I am trying to create a form that allows users to rate a restaurant (which is another section) by creating a &quot;userRatings&quot; section entry. userRatings has three fields: a dropdown field called ratings, a users field called user, and an entry field called restaurants. The form is on the entry page for a restaurant. Here is what my form looks like now: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  {{ getCsrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;viewentry/{slug}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;userRatings&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;9&quot;&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;text&quot; id=&quot;user&quot; name=&quot;ratings&quot; value=&quot;{{currentUser}}&quot; style=&quot;display:none;&quot; readonly&amp;gt;&#xA;&#xA;  &amp;lt;input type=&quot;text&quot; id=&quot;restaurant&quot; name=&quot;restaurant&quot; value=&quot;{{entry}}&quot; style=&quot;display:none;&quot; readonly&amp;gt;&#xA;&#xA;  &amp;lt;label for=&quot;ratings&quot;&amp;gt;Rate This Restaurant&amp;lt;/label&amp;gt;&#xA;  &amp;lt;select id=&quot;ratings&quot; name=&quot;ratings&quot;&amp;gt;&#xA;      {% for option in entry.ratings.options %}&#xA;        &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{option.label}}&amp;lt;/option&amp;gt;&#xA;      {% endfor %}&#xA;  &amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;input class=&quot;button&quot; type=&quot;submit&quot; value=&quot;Rate&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The select list successfully pulls in the options from the &quot;ratings&quot; dropdown field, and I have two text boxes that are recording the current user and the restaurant that the user is trying to rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, when the form submits, it goes back to the same page with no errors, but nothing is saved on the back-end. Any help or suggestions would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8225" LastActivityDate="2018-04-10T15:12:02.183" Title="Front End New Entry Form" Tags="&lt;form&gt;&lt;frontend&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25591" PostTypeId="2" ParentId="25513" CreationDate="2018-04-10T19:20:16.497" Score="3" Body="&lt;p&gt;Based on the code you posted on pastebin, it seems like the problem is that you have your pagination outside of the cache tags (assuming this was the case when you had caching implemented). And, I'm assuming that inside your &lt;code&gt;{% include &quot;_includes/pagination&quot; %}&lt;/code&gt; you're trying to access &lt;code&gt;pageInfo&lt;/code&gt;, which is created by the pagination tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this work, and be able to implement efficient caching, you need to include your pagination inside your cache tags. In fact, I would also include the logic that creates the &lt;code&gt;topicEntries&lt;/code&gt; element criteria above where you have the pagination tag today, inside the cache tag, as it creates DB queries and is directly related to the content you want to cache. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overall structure of your code should then be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum for 2 hours %}&#xA;    &amp;lt;ul class=&quot;feat-box-container&quot;&amp;gt;&#xA;        {#  lots of code to get topicEntries #}&#xA;&#xA;        {% paginate topicEntries.limit(10) as pageInfo, topicEntries %}&#xA;&#xA;        {% for topic in topicEntries %}&#xA;            {# code that outputs list items #}&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% include &quot;_includes/pagination&quot; %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-10T19:20:16.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25592" PostTypeId="1" CreationDate="2018-04-10T20:17:31.727" Score="1" ViewCount="245" Body="&lt;p&gt;I know that static text translations in still possible but where you put those translations has changed. According to the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#static-translation-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; the folder structure should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;translations/&#xA;  en-US/&#xA;    app.php&#xA;     site.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but what I can't figure out is where exactly do I put the translations folder. Does it go in the craftcms in vendor?&lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-04-10T21:15:17.707" Title="Translating Static Text in Craft3" Tags="&lt;localization&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25593" PostTypeId="1" CreationDate="2018-04-10T20:37:36.553" Score="1" ViewCount="254" Body="&lt;p&gt;I'm having trouble with additional message fields in my Craft Contact Form using Craft 3 and the Pixel &amp;amp; Tonic Contact Form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added two additional fields by splitting up the message field as described in the plugin documentation. If all the fields are filled in, everything goes smoothly. But if the form is submitted with any blank required fields, I get a PHP error &quot;Array to string conversion.&quot; Live example at &lt;a href=&quot;http://striveforfive.creativeforthepeople.org/contact&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://striveforfive.creativeforthepeople.org/contact&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: The code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if entry.formCopy|length %}{{ entry.formCopy }}{% endif %}&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;form class=&quot;contact-form&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            {{ csrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; class=&quot;form-control&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;            {{ redirectInput('contact-ty') }}&#xA;&#xA;            &amp;lt;input id=&quot;from-name&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot; placeholder=&quot;your name&quot;&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;            &amp;lt;input id=&quot;from-email&quot; class=&quot;form-control&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot; placeholder=&quot;your email&quot;&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;            &amp;lt;input id=&quot;affiliation&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;message[Affiliation]&quot; value=&quot;&quot; placeholder=&quot;your school / organization / home locations&quot;&amp;gt;&#xA;&#xA;            &amp;lt;select id=&quot;position&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;message[Position]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;option value=&quot;&quot; selected disabled&amp;gt;your position&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option&amp;gt;Educator / Care Giver&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option&amp;gt;Family Child Care Provider&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option&amp;gt;Center Director&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option&amp;gt;Student Teacher&amp;lt;/option&amp;gt;&#xA;                &amp;lt;option&amp;gt;Other&amp;lt;/option&amp;gt;&#xA;            &amp;lt;/select&amp;gt;&#xA;&#xA;            &amp;lt;textarea rows=&quot;5&quot; cols=&quot;40&quot; id=&quot;message&quot; class=&quot;form-control&quot; name=&quot;message[body]&quot; placeholder=&quot;your message&quot;&amp;gt;{{ message.message ?? '' }}&amp;lt;/textarea&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;            &amp;lt;input id=&quot;bluebeard&quot; name=&quot;bluebeard&quot; type=&quot;text&quot;&amp;gt;&#xA;&#xA;            &amp;lt;input id=&quot;contact-submit&quot; type=&quot;submit&quot; class=&quot;btn btn-outline-primary&quot; value=&quot;Send&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8229" LastEditorUserId="57" LastEditDate="2018-04-12T05:40:20.750" LastActivityDate="2018-04-13T16:59:03.797" Title="PHP Exception for errors on Craft Contact Form with additional fields" Tags="&lt;craft3&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25595" PostTypeId="2" ParentId="25592" CreationDate="2018-04-10T21:15:17.707" Score="1" Body="&lt;p&gt;Just put it on the same level as where the other folders reside, just like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;config/...&#xA;storage/&#xA;templates/&#xA;vendor/...&#xA;web/...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="185" LastActivityDate="2018-04-10T21:15:17.707" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25596" PostTypeId="2" ParentId="25585" CreationDate="2018-04-10T21:22:18.973" Score="3" Body="&lt;p&gt;Only upload the /web folder to the /public_html folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other folders should be one level lower so they're not publicly accessible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I'm also wondering why not everything resides in a nice clean /craft folder anymore. Now the craft directories are listed amongst a bunch of other stuff on a lowerlevel directory. It's probably the only one really strange architectural choice. I guess P&amp;amp;T is not using WHM/Cpanel etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway: do not upload anything except /web in your public folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do it like this, the index will work correctly out of the box, since it'll be looking for the /app and all folders one level lower then the /public_html by default. &lt;/p&gt;&#xA;" OwnerUserId="185" LastActivityDate="2018-04-10T21:22:18.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25597" PostTypeId="1" AcceptedAnswerId="25600" CreationDate="2018-04-10T23:34:46.900" Score="4" ViewCount="4360" Body="&lt;p&gt;I'm trying to port a Craft 2 plugin to Craft 3, and don't seem smart enough to work out the namespaces. I've stripped out everything except what the docs recommend, but keep getting &lt;em&gt;Cannot declare class kr37\Calendar37\Calendar37, because the name is already in use&lt;/em&gt;  Thank you in advance for any suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Folder structure&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;composer.json&#xA;src/Plugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace kr37\Calendar37;&#xA;&#xA;class Calendar37 extends \craft\base\Plugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        // Custom initialization code goes here...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;composer.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;kr37/calendar37&quot;,&#xA;  &quot;description&quot;: &quot;Event calendar with unrestricted repetition&quot;,&#xA;  &quot;version&quot;: &quot;3.0.18046&quot;,&#xA;  &quot;type&quot;: &quot;craft-plugin&quot;,&#xA;  &quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.1&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;kr37\\calendar\\&quot;: &quot;src/&quot;&#xA;    }&#xA;  },&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;???&quot;&#xA;  },&#xA;  &quot;extra&quot;: {&#xA;    &quot;handle&quot;: &quot;calendar37&quot;,&#xA;    &quot;name&quot;: &quot;Calendar&quot;,&#xA;    &quot;developer&quot;: &quot;???&quot;,&#xA;    &quot;developerUrl&quot;: &quot;???&quot;,&#xA;    &quot;hasSettings&quot;: &quot;true&quot;,&#xA;    &quot;hasCpSection&quot;: &quot;true&quot;&#xA;  }&#xA;}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-04-11T05:51:30.557" LastActivityDate="2018-04-11T05:51:30.557" Title="Cannot declare class because the name is already in use" Tags="&lt;plugins&gt;&lt;craft3&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25599" PostTypeId="1" AcceptedAnswerId="26105" CreationDate="2018-04-11T05:05:57.430" Score="1" ViewCount="31" Body="&lt;p&gt;I have issue with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getNameReplacementInFolder(string $originalFilename, int $folderId): string&#xA;{&#xA;    $folder = $this-&amp;gt;getFolderById($folderId);&#xA;&#xA;    if (!$folder) {&#xA;        throw new InvalidArgumentException('Invalid folder ID: '.$folderId);&#xA;    }&#xA;&#xA;    $volume = $folder-&amp;gt;getVolume();&#xA;    $fileList = $volume-&amp;gt;getFileList((string)$folder-&amp;gt;path, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem if I am using an external filesystem the getFileList is a very heavy API call for the external filesystem. It would be much easier to check the filename in the Asset database, than to check it on the filesystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to avoid this call? Also if the flysystem driver is poorly written it could stuck in case of huge files or folders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I badly need solution for disable this call - we can take care the indivudual file nameing, or to tweak it or change it for the database call&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2018-05-10T18:20:52.247" Title="Issue with validator getNameReplacementInFolder" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25600" PostTypeId="2" ParentId="25597" CreationDate="2018-04-11T05:49:59.137" Score="8" Body="&lt;p&gt;At this point, after much playing around it seems to be working (at least on to the next bit of debugging).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, it was mostly changes to composer.json, followed by &#xA;&lt;code&gt;&#xA;composer remove kr37/calendar37&#xA;composer require kr37/calendar37&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;src/Plugin.php became src/Calendar37.php&lt;/li&gt;&#xA;&lt;li&gt;Added &lt;code&gt;&quot;class&quot;: &quot;kr37\\calendar37\\Calendar37&quot;&lt;/code&gt; to the &lt;code&gt;&quot;extra&quot;&lt;/code&gt; part of composer.json&lt;/li&gt;&#xA;&lt;li&gt;Corrected the &lt;code&gt;autoload &quot;psr-4&quot;&lt;/code&gt; to &lt;code&gt;&quot;kr37\\calendar37\\&quot;: &quot;src/&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Made sure that all the names matched up just right.&lt;/li&gt;&#xA;&lt;li&gt;This error, &quot;&lt;em&gt;because the name is already in use&lt;/em&gt;,&quot; should really be &quot;&lt;em&gt;because the name doesn't match up&lt;/em&gt;.&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-04-11T05:49:59.137" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25601" PostTypeId="2" ParentId="25585" CreationDate="2018-04-11T06:28:14.100" Score="0" Body="&lt;p&gt;You can place it in a dedicated craft folder or a private_html folder with composer, but then you have to edit the index.php file a bit to make it work. See &lt;a href=&quot;https://craftcms.stackexchange.com/questions/25504/setup-craft-3-when-de-craft-folder-is-above-public-html-on-shared-hosting&quot;&gt;Setup Craft 3 when de craft folder is above public_html on shared hosting&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="421" LastActivityDate="2018-04-11T06:28:14.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25602" PostTypeId="2" ParentId="25500" CreationDate="2018-04-11T07:05:54.053" Score="4" Body="&lt;p&gt;Just in case anyone else has this issue i got it working with these modifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the hidden field was required for the possibility of null values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myCustomField]&quot; value=&quot;no&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It also required the extra [] brackets after the field name in the checkbox option (as checkbox fields are an array).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;name=&quot;fields[myCustomField][]&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my code thats working:&#xA;    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[termsAgreement]&quot; value=&quot;no&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; id=&quot;termsAgreement&quot; name=&quot;fields[termsAgreement][]&quot; value=&quot;yes&quot;&amp;gt;&#xA;&#xA;             I agree to terms and conditions above&#xA;            &amp;lt;/label&amp;gt;&#xA;            {{ account is defined and account ? errorList(account.getErrors('termsAgreement')) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8206" LastActivityDate="2018-04-11T07:05:54.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25603" PostTypeId="1" AcceptedAnswerId="25627" CreationDate="2018-04-11T07:10:55.537" Score="1" ViewCount="30" Body="&lt;p&gt;working with the &lt;a href=&quot;https://transition.topshelfcraft.com/software/craft/shortlist/overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortlist plugin&lt;/a&gt; for Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to set the return URL after someone adds an item to their shortlist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i assume thats what this parameter is for...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ item.addActionUrl({ 'return' : 'my-page-i-want-to-go-to' }) }}&quot;&amp;gt;add item&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however that takes the user to a 404 page with the url of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mydomain.com/index.php/actions/shortlist/item/my-page-i-want-to-go-to&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;any ideas?&lt;/p&gt;&#xA;" OwnerUserId="8206" LastActivityDate="2018-04-12T02:10:38.237" Title="Shortlist return URL" Tags="&lt;plugin-shortlist&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25604" PostTypeId="2" ParentId="25558" CreationDate="2018-04-11T08:22:08.717" Score="1" Body="&lt;p&gt;Not going to happen. There is a multitude of reasons, but the biggest one would be breaking changes, including templates. Allowing an auto-update that would likely break the site would be reckless.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-04-11T08:22:08.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25605" PostTypeId="1" AcceptedAnswerId="25701" CreationDate="2018-04-11T08:22:53.547" Score="2" ViewCount="62" Body="&lt;p&gt;I use Sprout Email on a website to send transactional email (about 15 different types).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website gets now translated to 3 languages (DE/FR/EN). It is all fine, but of course, also the transactional emails need to be in three languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Sprout Email does not really support localization, it is still somehow possible by adding 3 &quot;Email Body&quot; fields to the email field layout:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;emailBodyDe&lt;/li&gt;&#xA;&lt;li&gt;emailBodyFr&lt;/li&gt;&#xA;&lt;li&gt;emailBodyEn&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the mail template, I can then chose which body to use. All good so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = object.locale %}&#xA;{% set emailBody = email.htmlEmailBodyDe %}&#xA;{% set emailSubject = email.subjectLine %}&#xA;{% switch locale %}&#xA;    {% case &quot;fr&quot; %}&#xA;        {% set emailBody = email.htmlEmailBodyDe %}&#xA;        {# ... set subject!? ... #}&#xA;    {% case &quot;en&quot; %}&#xA;        {% set emailBody = email.htmlEmailBodyEn %}&#xA;        {# ... set subject!? ... #}&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't translate the subject line. There is just one fixed field in Sprout Email for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions how I can also make the subject field multi-language?&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="57" LastEditDate="2018-04-12T05:32:45.317" LastActivityDate="2018-04-17T20:14:50.330" Title="Sprout Email Plugin and Multilanguage. How to translate SubjectLine?" Tags="&lt;localization&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25606" PostTypeId="2" ParentId="25572" CreationDate="2018-04-11T11:08:49.950" Score="1" Body="&lt;p&gt;Create a new web server to host your Craft project. Its document root should point to your public HTML folder. If you’re using Craft’s Composer starter project, then it is the web/ directory by default, but it can be renamed to anything you want as long as your web server is configured to point to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your web host already has a public HTML folder setup to for you that you cannot rename, then you can just copy the contents of Craft’s web folder to it and use your host’s default public HTML folder.&lt;/p&gt;&#xA;" OwnerUserId="8235" LastActivityDate="2018-04-11T11:08:49.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25607" PostTypeId="1" CreationDate="2018-04-11T13:38:51.477" Score="1" ViewCount="218" Body="&lt;p&gt;I'm working on a plugin that hooks into Craft's Guest Entries plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to send a confirmation mail after an entry has been saved. This works nicely so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to catch any errors in the mail service. This works nicely so far. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function mailHandler($from, $to, $subject, $text)&#xA;{&#xA;    try&#xA;    {&#xA;        $message = new \craft\mail\Message;&#xA;&#xA;        $message-&amp;gt;setFrom($from);&#xA;        $message-&amp;gt;setTo($to);&#xA;        $message-&amp;gt;setSubject($subject);&#xA;        $message-&amp;gt;setTextBody($text);&#xA;&#xA;        Craft::$app-&amp;gt;mailer-&amp;gt;send($message);&#xA;    }&#xA;    catch (\Exception $e)&#xA;    {&#xA;        echo \Craft::$app-&amp;gt;view-&amp;gt;renderTemplate('error', ['error' =&amp;gt; 'Test']);&#xA;        die();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are two problems I'm facing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I have to &quot;stop&quot; the controller action, that's why I need the &lt;code&gt;die&lt;/code&gt;. This seems dirty though, is there any other way I could stop the controller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If I do it like this, my error template is rendered, but without any CSS. What am I missing there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a ton for your help!&lt;/p&gt;&#xA;" OwnerUserId="8236" LastEditorUserId="57" LastEditDate="2018-04-13T05:01:49.083" LastActivityDate="2018-04-13T05:07:12.927" Title="How to render template instead of throwing an error?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25608" PostTypeId="1" AcceptedAnswerId="25614" CreationDate="2018-04-11T13:57:29.743" Score="1" ViewCount="249" Body="&lt;p&gt;It's easy enough update the order status from the frontend using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/orders/updateStatus&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;orderId&quot; value=&quot;{{ order.id }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;orderStatusId&quot; value=&quot;{{ order.orderStatus.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm wanting to add a message to go with the status. Any pointers? It looks like the message is part of the Order History model, not the Order Status model.&lt;/p&gt;&#xA;" OwnerUserId="167" LastActivityDate="2018-04-11T17:55:39.503" Title="How to save Order Status Message in Craft Commerce using frontend form" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25609" PostTypeId="1" AcceptedAnswerId="25610" CreationDate="2018-04-11T14:00:55.367" Score="2" ViewCount="76" Body="&lt;p&gt;I'm trying to suppress display of expired events (events that occurred in the past) on the Solspace month calendar. I'm using the out-of-the-box templates included with Solspace Calendar for Craft. Initially, I thought that there would be a start and end range for the calendar.month function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.calendar.month({&#xA;    date: targetDate,&#xA;    calendar: calendarHandle,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But looking at the documentation, there are no parameters to pass. (&lt;a href=&quot;https://solspace.com/craft/calendar/docs/calendar.month/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/docs/calendar.month/&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I looked at what is happening, and it seems that the start and end should be set on the event object (&lt;a href=&quot;https://solspace.com/craft/calendar/docs/event/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/docs/event/&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the month template, the event object is called here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in day.events %}&#xA;    {% include &quot;cal/layouts/_event.html&quot; %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is what is returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set classes = &quot;&quot; %}&#xA;{% set classes = classes ~ (event.allDay ? &quot; all_day&quot;) %}&#xA;&#xA;{% if event.multiDay %}&#xA;    {% set classes = classes ~ &quot; multi_day&quot; %}&#xA;    {% set classes = classes ~ (day.containsDate(event.startDate) ? &quot; first_day&quot;) %}&#xA;    {% set classes = classes ~ (day.containsDate(event.endDate) ? &quot; last_day&quot;) %}&#xA;{% endif %}&#xA;&#xA;{% set style = &quot;&quot; %}&#xA;    {% if event.multiDay or event.allDay %}&#xA;        {% set style %}&#xA;    style=&quot;background-color: {{ event.calendar.lighterColor }} !important;&#xA;        border-color: {{ event.calendar.color }} !important;&quot;&#xA;    {% endset %}&#xA;{% endif %}&#xA;&#xA;{% if event.startDate.format('U') &amp;gt; now|date('U') %}&#xA;&#xA;&amp;lt;div class=&quot;event tips{{ classes }}&quot;{{ style }} data-toggle=&quot;popover&quot;&amp;gt;&#xA;        {% if event.multiDay %}&#xA;            &amp;lt;a href=&quot;{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}&quot;&#xA;    style=&quot;color: {{ event.calendar.contrastColor }} !important;&quot;&amp;gt;&#xA;                {% autoescape false %}&#xA;                    {{ day.containsDate(event.startDate) or day.containsDate(event.endDate) ? event.title : &quot;&amp;amp;nbsp;&quot;|raw }}&#xA;                {% endautoescape %}&#xA;            &amp;lt;/a&amp;gt;&#xA;        {% else %}&#xA;            {% if not event.allDay %}&#xA;                &amp;lt;span class=&quot;calendar-color&quot; style=&quot;background-color: {{ event.calendar.color }};&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;            {% endif %}&#xA;                &amp;lt;a href=&quot;{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}&quot;&#xA;                {% if event.allDay %}style=&quot;color: {{ event.calendar.contrastColor }};&quot;{% endif %}&amp;gt;&#xA;                    {{ event.title }}&#xA;                &amp;lt;/a&amp;gt;&#xA;        {% endif %}&#xA;&#xA;    {% include &quot;cal/layouts/_event_popover.html&quot; %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume this is where I would set a date range, but I'm not really clear where I would set it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I managed to get this working by wrapping the event output in a conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.startDate.format('U') &amp;gt; now|date('U') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added this to the code above.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2018-04-11T14:30:41.477" LastActivityDate="2018-04-11T14:32:31.803" Title="How to suppress display of expired entries in Solspace month calendar?" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25610" PostTypeId="2" ParentId="25609" CreationDate="2018-04-11T14:32:31.803" Score="2" Body="&lt;p&gt;The solution is to wrap the event output in a conditional that compares the event startdate to now. I've updated the question to reflect this.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-04-11T14:32:31.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25613" PostTypeId="1" CreationDate="2018-04-11T16:31:07.000" Score="2" ViewCount="191" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Now I know the cause of my problem, I have appended to the original question title to try and help other people stumbling across the same issue.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have a pending support ticket open with P&amp;amp;T on this, but just wondering if anyone else has had a similar experience and might be able to point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a development site running happily on Craft 2.6.3013. As a first foray into Craft 3 I thought I would upgrade it to Craft 3 in a dedicated folder and DB of my local setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All seemed to go fine. I worked through and eliminated deprecation errors in my 2 well developed templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But one of the templates utilises a Matrix field with 2 block types -- &lt;code&gt;subsection&lt;/code&gt; and &lt;code&gt;item&lt;/code&gt; -- and only &lt;code&gt;subsection&lt;/code&gt; rows are publishing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 20 rows originally in the field (in its singles entry) are all there in the back end, and their respective types show up as they should there: 5 for &lt;code&gt;subsection&lt;/code&gt; and 15 for &lt;code&gt;item&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a simplified front end loop of: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for row in entry.timeline.all() %}&#xA;        &amp;lt;li&amp;gt;{{ row.type }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…only produces the following outcome:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;subsection&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;subsection&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;subsection&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;subsection&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;subsection&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2018-04-18T08:17:22.297" LastActivityDate="2018-04-18T08:21:38.583" Title="Missing Matrix row types on output after upgrade to Craft 3 (subsetting and cloning ElementQueries)" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;elementcriteriamodel&gt;&lt;block-types&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25614" PostTypeId="2" ParentId="25608" CreationDate="2018-04-11T17:55:39.503" Score="1" Body="&lt;p&gt;Updating an order from the front end would not be possible unless the user has update/manage order permissions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the message it is simply a &lt;code&gt;message&lt;/code&gt; post param that you send along with the status ID.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-04-11T17:55:39.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25615" PostTypeId="2" ParentId="24048" CreationDate="2018-04-11T18:16:35.957" Score="3" Body="&lt;p&gt;Eager loading is used to reduce the number of database queries. Imager doesn't store any data in the database, it's completely file-based, so it's not relevant to use eager-loading in relation to it.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-04-11T18:16:35.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25616" PostTypeId="1" AcceptedAnswerId="25621" CreationDate="2018-04-11T19:00:21.903" Score="1" ViewCount="75" Body="&lt;p&gt;I have a controller action which returns JSON with a rendered template.  This template uses date picker form fields.  How can the date picker JS be initialized since the html is returned through JSON. I would have thought since the date picker field includes the necessary JS within {%js%} tag during template render it would be initialized. Could it be the timing of render vs adding the template html to the DOM? (Craft 3)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = $this-&amp;gt;getView();&#xA;&#xA;$html = $view-&amp;gt;renderTemplate('_modal',['values' =&amp;gt; $values, 'siteId' =&amp;gt; $siteId]);&#xA;$headHtml = $view-&amp;gt;getHeadHtml();&#xA;&#xA;return $this-&amp;gt;asJson(['html' =&amp;gt; $html, 'headHtml' =&amp;gt; $headHtml]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2018-04-11T19:05:34.693" LastActivityDate="2018-04-11T19:37:33.100" Title="How to initiate a date picker when template is loaded remotely from controller action" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25617" PostTypeId="1" CreationDate="2018-04-11T19:25:07.743" Score="1" ViewCount="431" Body="&lt;p&gt;I installed Craft CMS 3.0.1 locally on MAMP (Apache/PHP7.0.22), but when I want to do a backup of the database it says:&#xA;&quot;There was a problem backing up your database. Please check the Craft logs. Back-up van database&quot;.&#xA;I cound not find any logs that pin pointed the problem. How does this happen? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2018-04-11T19:29:18.163" Title="Back-up doesn't work in Craft CMS 3 on MAMP locally" Tags="&lt;craft3&gt;&lt;database&gt;&lt;mamp&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25618" PostTypeId="2" ParentId="25617" CreationDate="2018-04-11T19:29:18.163" Score="2" Body="&lt;p&gt;I have just run into a similar problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is what fixed it but try creating an Envvars file as per jonlivingstone's comment here &lt;a href=&quot;https://github.com/craftcms/cms/issues/2364&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2364&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I had done that my backup ran. I then had to switch MAMP out of FastCGI mode otherwise I got a 500 error at the end of the update process.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-11T19:29:18.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25619" PostTypeId="1" AcceptedAnswerId="25620" CreationDate="2018-04-11T19:30:57.933" Score="1" ViewCount="582" Body="&lt;p&gt;When I try to perform an update from Craft 2 to Craft 3 I am getting a 500 error at, what appears to be, the end of the process. No other info is given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using MAMP Pro V4 for Mac.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-13T13:33:37.940" Title="Getting HTTP 500 error at end of update process when going from Craft 2 to Craft 3 with MAMP" Tags="&lt;craft3&gt;&lt;error&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25620" PostTypeId="2" ParentId="25619" CreationDate="2018-04-11T19:32:26.553" Score="3" Body="&lt;p&gt;Try switching MAMP out of Fast CGI mode. Go to the PHP Tab and select &quot;Identical PHP Version for all hosts (Module mode)&quot;. Restart the servers and then. Then run the update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can normally switch back to Fast CGI mode at this point and it will continue to work OK. But if you do run into this, or a file upload problem, it's worth changing to Module mode temporarily as it often fixes whatever is causing the issue.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-04-13T13:33:37.940" LastActivityDate="2018-04-13T13:33:37.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25621" PostTypeId="2" ParentId="25616" CreationDate="2018-04-11T19:37:33.100" Score="2" Body="&lt;p&gt;Since your controller returns json you'll probably have a Javascript function that calls this controller so you can initialize it at the moment you receive the html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides that you can as well include Javascript in your &lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;registerJs&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-view.html#registerJs()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;class&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-11T19:37:33.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25622" PostTypeId="1" AcceptedAnswerId="25624" CreationDate="2018-04-11T19:53:22.963" Score="1" ViewCount="186" Body="&lt;p&gt;I love Craft CMS and use it for nearly every site I build. There isn't a better tool (in my opinion) for managing custom data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And using a matrix field as content builder solves the majority of my client's publishing needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But with so drag and drop page building tools on the market, I find that sometimes clients expect to find the same drag and drop page layout ability within Craft as they would find in Squarespace or Weebly or Mail Chimp Templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than educating a client that Craft is not a layout tool and there are times when you use different tools for different jobs, what solutions do you suggest?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to accomplish minimally viable layout with becoming very dependent on plugins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there are way to use a 3rd party page builder and embed the content in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is best not to even try?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you approached handling client's layout expectations within Craft CMS?&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2018-04-11T20:58:43.857" Title="How to handle client expectations regarding page building and layout within Craft" Tags="&lt;matrix&gt;&lt;content&gt;&lt;blocks&gt;&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25623" PostTypeId="1" CreationDate="2018-04-11T19:58:39.820" Score="1" ViewCount="402" Body="&lt;p&gt;Okay...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New iteration of an old challenge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to embed a chart on each of my entry pages.  I am currently looking at either &lt;code&gt;amcharts&lt;/code&gt; or &lt;code&gt;chartsjs&lt;/code&gt;. I can embed the chart using &lt;code&gt;{% set myJs %}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want Craft to provide the years and values for the chart.  How do I template this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached a sample.  In the sample, Category corresponds with Year and Column-1 corresponds with Amount&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it best to draw from a table field in Craft or individual fields for each Year/Value combination?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly, how do I light it up / template it to get Craft to loop through items and spit out the values to drive the chart?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;    &#xA;        chart created with amCharts | amCharts&#xA;        &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;!-- amCharts javascript sources --&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://www.amcharts.com/lib/3/amcharts.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://www.amcharts.com/lib/3/serial.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://www.amcharts.com/lib/3/themes/light.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;!-- amCharts javascript code --&amp;gt;&#xA;    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;        AmCharts.makeChart(&quot;chartdiv&quot;,&#xA;            {&#xA;                &quot;type&quot;: &quot;serial&quot;,&#xA;                &quot;categoryField&quot;: &quot;category&quot;,&#xA;                &quot;dataDateFormat&quot;: &quot;YYYY-MM-DD&quot;,&#xA;                &quot;startDuration&quot;: 1,&#xA;                &quot;theme&quot;: &quot;light&quot;,&#xA;                &quot;categoryAxis&quot;: {&#xA;                    &quot;gridPosition&quot;: &quot;start&quot;,&#xA;                    &quot;parseDates&quot;: true&#xA;                },&#xA;                &quot;chartCursor&quot;: {&#xA;                    &quot;enabled&quot;: true&#xA;                },&#xA;                &quot;chartScrollbar&quot;: {&#xA;                    &quot;enabled&quot;: true&#xA;                },&#xA;                &quot;trendLines&quot;: [],&#xA;                &quot;graphs&quot;: [&#xA;                    {&#xA;                        &quot;fillAlphas&quot;: 1,&#xA;                        &quot;id&quot;: &quot;AmGraph-1&quot;,&#xA;                        &quot;title&quot;: &quot;graph 1&quot;,&#xA;                        &quot;type&quot;: &quot;column&quot;,&#xA;                        &quot;valueField&quot;: &quot;column-1&quot;&#xA;                    }&#xA;                ],&#xA;                &quot;guides&quot;: [],&#xA;                &quot;valueAxes&quot;: [&#xA;                    {&#xA;                        &quot;id&quot;: &quot;ValueAxis-1&quot;,&#xA;                        &quot;title&quot;: &quot;Axis title&quot;&#xA;                    }&#xA;                ],&#xA;                &quot;allLabels&quot;: [],&#xA;                &quot;balloon&quot;: {},&#xA;                &quot;titles&quot;: [&#xA;                    {&#xA;                        &quot;id&quot;: &quot;Title-1&quot;,&#xA;                        &quot;size&quot;: 15,&#xA;                        &quot;text&quot;: &quot;Chart Title&quot;&#xA;                    }&#xA;                ],&#xA;                &quot;dataProvider&quot;: [&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-01&quot;,&#xA;                        &quot;column-1&quot;: 8&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-02&quot;,&#xA;                        &quot;column-1&quot;: 16&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-03&quot;,&#xA;                        &quot;column-1&quot;: 2&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-04&quot;,&#xA;                        &quot;column-1&quot;: 7&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-05&quot;,&#xA;                        &quot;column-1&quot;: 5&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-06&quot;,&#xA;                        &quot;column-1&quot;: 9&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-07&quot;,&#xA;                        &quot;column-1&quot;: 4&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-08&quot;,&#xA;                        &quot;column-1&quot;: 15&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-09&quot;,&#xA;                        &quot;column-1&quot;: 12&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-10&quot;,&#xA;                        &quot;column-1&quot;: 17&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-11&quot;,&#xA;                        &quot;column-1&quot;: 18&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-12&quot;,&#xA;                        &quot;column-1&quot;: 21&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-13&quot;,&#xA;                        &quot;column-1&quot;: 24&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-14&quot;,&#xA;                        &quot;column-1&quot;: 23&#xA;                    },&#xA;                    {&#xA;                        &quot;category&quot;: &quot;2014-03-15&quot;,&#xA;                        &quot;column-1&quot;: 24&#xA;                    }&#xA;                ]&#xA;            }&#xA;        );&#xA;    &amp;lt;/script&amp;gt;&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    &amp;lt;div id=&quot;chartdiv&quot; style=&quot;width: 100%; height: 400px; background-color: #FFFFFF;&quot; &amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-04-12T13:40:30.623" Title="How do I template a JS Chart driven by table and field inputs?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25624" PostTypeId="2" ParentId="25622" CreationDate="2018-04-11T20:58:43.857" Score="2" Body="&lt;p&gt;This question comes up in support tickets every so often from client users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We like to say that Craft fills the space between where WordPress ends and Enterprise begins. It's meant for designers and developers to build bespoke websites for clients. That would include Squarespace-like website building services as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your design, technical, and business requirements exceed what Squarespace can offer then they naturally exceed what a drag/drop website builder can provide. If there's anything a client wishes for in the control panel then they can ask their agency or developers about feasibility. Craft is extensible enough to make most thing possible; it's just a matter of effort and cost.&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2018-04-11T20:58:43.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25625" PostTypeId="1" CreationDate="2018-04-11T21:20:12.377" Score="1" ViewCount="53" Body="&lt;p&gt;I using Solspace Calendar on Craft 2. (I can upgrade for Craft 3 soon.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to add time for the recurring date?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5f2Lm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5f2Lm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My english not so good, sorry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks your help.&lt;/p&gt;&#xA;" OwnerUserId="8241" LastEditorUserId="57" LastEditDate="2018-04-13T04:06:25.537" LastActivityDate="2018-06-12T10:05:17.623" Title="How to add time for repeats date with Solspace Calendar" Tags="&lt;solspace&gt;&lt;plugin-calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25626" PostTypeId="1" CreationDate="2018-04-11T23:04:26.563" Score="1" ViewCount="120" Body="&lt;p&gt;For a week-long schedule, I'm trying to group events that occur on the same day, and also fall into one of two classifications— they are free if a pass is purchased or not included in the pass.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set passEvents = craft.entries.section(&quot;event&quot;).eventForwardPass(&quot;No&quot;).find() %}&#xA;{% for date, entries in passEvents | group(&quot;eventStartDate|date('F d, Y')&quot;) %}&#xA;&#xA;    &amp;lt;p&amp;gt;ONLY list Non-Forward Pass events.&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;h2&amp;gt;{{date}}&amp;lt;/h2&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% for entry in passEvents %}&#xA;&#xA;          &amp;lt;li&amp;gt;{{ entry.title }}- {{entry.eventStartDate}}&amp;lt;/li&amp;gt;&#xA;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm only showing the date next to the title to verify when the code works properly. The problem I'm having is this code seems to return all entries that match the 'set' criteria under each date, rather than just the entries that match the 'set' criteria for that particular date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm basing the code off of examples that would normally group by month or year. It seems like I'm asking for the right things, but obviously, the results tell me, that I'm asking for the wrong thing on the loop.&lt;/p&gt;&#xA;" OwnerUserId="3346" LastActivityDate="2018-04-12T08:44:15.597" Title="Grouping by Date (Day) Not Working Correctly" Tags="&lt;datetime&gt;&lt;group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25627" PostTypeId="2" ParentId="25603" CreationDate="2018-04-12T02:10:38.237" Score="1" Body="&lt;p&gt;As mentioned in the comments on the Question, the solution here is to enclose your desired path with a &lt;code&gt;url()&lt;/code&gt; function like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ item.addActionUrl({ 'return' : url('my-page-i-want-to-go-to') }) }}&quot;&amp;gt;add item&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;url()&lt;/code&gt; function will take your current &lt;a href=&quot;https://craftcms.com/support/site-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;SiteURL&lt;/a&gt; and append the provided path. You can view the offical documentation about &lt;code&gt;url()&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/v2/templating/functions.html#url&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-04-12T02:10:38.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25628" PostTypeId="2" ParentId="23854" CreationDate="2018-04-12T04:21:06.320" Score="1" Body="&lt;p&gt;Thank you so much @4midori, this worked for me (installed Craft3 without Composer):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', ('/home/pathToCraftFolder/craft'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8059" LastActivityDate="2018-04-12T04:21:06.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25629" PostTypeId="2" ParentId="25566" CreationDate="2018-04-12T05:32:51.003" Score="1" Body="&lt;p&gt;On the public_html/index.php file, try replacing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', ('/home/pathToCraftFolder/craft'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The structure of my folders is as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/home/username/&lt;br&gt;&#xA;  - public_html, or just html / this is where the content of your web folder goes  &lt;br&gt;&#xA;  - config&lt;br&gt;&#xA;  - modules&lt;br&gt;&#xA;  - storage&lt;br&gt;&#xA;  - templates&lt;br&gt;&#xA;  - vendor&lt;br&gt;&#xA;  - (and then the composer/env files)&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the index.php file (which can be found under /home/username/public_html/index.php),you'd replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; define('CRAFT_BASE_PATH', ('/home/pathToCraftFolder/'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you only have access to the public_html folder or would like to install craft3 on a subfolder this is how you can structure it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on your public_html (/home/username/public_html),&#xA;create a craft subfolder((/home/username/public_html/craft)), then send your craft3 web folder into the public_html. It should look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/home/username/public_html/&lt;br&gt;&#xA;               -index.php&lt;br&gt;&#xA;               -web.config&lt;br&gt;&#xA;               -.htaccess&lt;br&gt;&#xA;               /craft/&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your index.php file, replace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; define('CRAFT_BASE_PATH', ('/home/pathToCraftFolder/craft'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="8059" LastEditorUserId="8059" LastEditDate="2018-04-13T22:46:25.837" LastActivityDate="2018-04-13T22:46:25.837" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25630" PostTypeId="2" ParentId="20366" CreationDate="2018-04-12T08:42:52.063" Score="1" Body="&lt;p&gt;I've managed to do this with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    {% include '_partial/wish-list-fields' %}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userWishListMatrix][{{ block.id }}][type]&quot; value=&quot;null&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Remove&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;wish-list-fields&lt;/code&gt; partial include hidden inputs showing all the fields already there. e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[userWishListMatrix][{{ block.id }}][fields][itemProperties][0][col1]&quot; value=&quot;{{ row.property }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It repeats itself which I know doesn't seem terribly efficient but i dunno :-/ It works!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, I'm on &lt;a href=&quot;/questions/tagged/craft3&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;craft3&amp;#39;&quot; rel=&quot;tag&quot;&gt;craft3&lt;/a&gt; so things may be a little different (although most likely just the &lt;code&gt;save-user&lt;/code&gt; / &lt;code&gt;saveUser&lt;/code&gt; action).&lt;/p&gt;&#xA;" OwnerUserId="4208" LastActivityDate="2018-04-12T08:42:52.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25631" PostTypeId="2" ParentId="25626" CreationDate="2018-04-12T08:44:15.597" Score="2" Body="&lt;p&gt;Figured it out. I actually asked for all entries for the group, rather than just the entries (events) that matched the date. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set passEvents = craft.entries.section(&quot;event&quot;).eventForwardPass(&quot;Yes&quot;).status('live','pending').order('eventStartDate').find() %}&#xA;{% for date, events in passEvents|group('eventStartDate') %}&#xA;&#xA;    &amp;lt;h3&amp;gt;{{date}}&amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for entry in events %}&#xA;        &amp;lt;article class=&quot;none&quot;&amp;gt;&#xA;            &amp;lt;section class=txt&amp;gt;&#xA;               {% if entry.eventLinkOverride == 1 %}&#xA;                  &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.eventLink }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                {% else %}&#xA;                   &amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;                {% endif %}&#xA;&#xA;            &amp;lt;/section&amp;gt;&#xA;        &amp;lt;/article&amp;gt;&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3346" LastActivityDate="2018-04-12T08:44:15.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25632" PostTypeId="1" CreationDate="2018-04-12T12:08:19.103" Score="0" ViewCount="645" Body="&lt;p&gt;I want to create order via code in Craft Commerce. How can I achieve that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8244" LastEditorUserId="57" LastEditDate="2018-04-13T04:09:30.897" LastActivityDate="2018-04-13T04:09:30.897" Title="Create order programmatically in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25633" PostTypeId="2" ParentId="25632" CreationDate="2018-04-12T13:18:03.037" Score="2" Body="&lt;p&gt;First of all, it's important to know what version(s) of Craft and Commerce you're referring to. The code used in this answer applies to Craft 3, with Commerce 2-beta. Code for Craft 2 and Commerce 1 would look different, but the logic is similar.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I would start by looking at Commerce's codebase on Github (or in your plugins folder, if it's Craft 2), and more specifically the &lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/src/controllers/OrdersController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;OrdersController&lt;/a&gt;, and even more specifically the &lt;code&gt;actionSaveOrder&lt;/code&gt; and &lt;code&gt;_setOrderFromPost&lt;/code&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks to me like you need to do two things:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Get an Order model:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Find an existing order by ID&#xA;$order = Commerce::getInstance()-&amp;gt;orders-&amp;gt;getOrderById($orderId);&#xA;&#xA;// ... Or create a new one&#xA;$order = new Order; # Don't forget to place use craft\commerce\elements\Order above your class&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Populate the model (untested)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you have an order model, you have to populate all the fields that matter. Status, addresses, I think you'd best start on an individual order page in the admin to see what fields are needed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$order-&amp;gt;isCompleted = true;&#xA;$order-&amp;gt;billingAddressId = 4;&#xA;$order-&amp;gt;gatewayId = 7;&#xA;... etc (includes creating and adding line items for your order)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Save the order and show why it doesn't work magically the first time around ;)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is where the fun starts, which might depend on your definition of fun.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($order)) {&#xA;    var_dump($order-&amp;gt;errors);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-12T13:18:03.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25634" PostTypeId="2" ParentId="25593" CreationDate="2018-04-12T13:24:37.827" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I think this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for error in errors %}&#xA;    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;... is where the error originates.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I memory serves me right, &lt;code&gt;errors&lt;/code&gt; is an array like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    ['fieldHandle' =&amp;gt; ['Something went terribly wrong!', 'Really, two errors in ONE FIELD?']],&#xA;    ['orderFieldHandle' =&amp;gt; 'I AM REQUIRED, y\'all!'],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;In which case &lt;code&gt;{{ error }}&lt;/code&gt; would dictate Twig (and therefore PHP) to&#xA;  echo an array (&lt;code&gt;['fieldHandle' =&amp;gt; ['Something went terribly wrong!',&#xA;  'Really, two errors in ONE FIELD?']]&lt;/code&gt;), resulting in the error you&#xA;  mentioned.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;You can fix this, by using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldHandle, fieldErrors in errors %}&#xA;    &amp;lt;li&amp;gt;{{ fieldHandle }}: {{ fieldErrors |join(', ') }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My original answer was not what caused the error (so, apparently, errors was not what I thought it was).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of error is caused by an array being echoed by PHP, and not a string. In this case, the cause of the problem is {{ message.message ?? '' }}, which turned into an array because it contains multiple field values.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2018-04-13T16:59:03.797" LastActivityDate="2018-04-13T16:59:03.797" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25635" PostTypeId="2" ParentId="25623" CreationDate="2018-04-12T13:40:30.623" Score="2" Body="&lt;p&gt;I would definitely go for either a table field, or a &lt;a href=&quot;https://github.com/verbb/super-table&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt; field if you need more options and/or field types. In my experience, it's easiest to create charts from tabular data. With your table field in place, you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set js %}&#xA;    // ... A whole bunch of code&#xA;&#xA;    &quot;dataProvider&quot;: [&#xA;        {% for row in entry.tableFieldHandle %}&#xA;        {&#xA;            &quot;category&quot;: &quot;{{ row.categoryColumnHandle.first().title }}&quot;, {# I assumed a Super Table field with a category relation in the category column)&#xA;            &quot;column-1&quot;: {{ row.valueColumnHandle }},&#xA;        },&#xA;        {% endfor %}&#xA;    ]&#xA;&#xA;    // All the rest&#xA;{% endset %}&#xA;{% includeJs js %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-12T13:40:30.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25636" PostTypeId="1" CreationDate="2018-04-12T14:13:34.850" Score="1" ViewCount="633" Body="&lt;p&gt;If a user has permission to publish on multiple sites, he by default publishes to all of them. If he wants to exclude some sites, he needs to go in each one and turn off the post for that site. This is ok if you have several sites, but on +100 sites it is a very time consuming task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It occured to me that we could use one user account for publishing on one site and another for publishing on multiple sites, but again, if you don't want to publish on all 100+ sites, you still have to invest a lot of time to disable the post for unwanted sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this field type plugin, but i am not sure if it can accomplish what I want.&#xA;&lt;a href=&quot;https://github.com/eastslopestudio/craft3-sites-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/eastslopestudio/craft3-sites-field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think something like a list with checkboxes would be ideal for this (like the one in user permissions for Sites) with the current Site being automaticaly initially checked. Or a multi select field maybe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is something like that doable? &#xA;If not with core Craft then maybe with a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any advice!&lt;/p&gt;&#xA;" OwnerUserId="3545" LastActivityDate="2019-08-26T11:26:36.557" Title="Craft 3 multi site publish options" Tags="&lt;craft3&gt;&lt;entry&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25637" PostTypeId="1" CreationDate="2018-04-12T14:51:30.580" Score="1" ViewCount="130" Body="&lt;p&gt;I’m having an issue with resaving a matrix block on users from a front end form. The problem is that after resaving the block and the page reloading. The styling on the page breaks until reload.  When opening the web console, a number of errors are returned that I’m pretty sure shouldn’t be in the front end:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/c4SYQci.png&quot; alt=&quot;Imgur: web console errors&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I may have found the code in the craftcms vendor files that is causing this to happen. It is located in craftcms/cms/src/elements/MatrixBlock.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commenting out the following code seems to stop all of the errors and on reload the page is fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function afterDelete()&#xA;{&#xA;&#xA;    if (!Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsConsoleRequest()) {&#xA;        // Tell the browser to forget about this block&#xA;        $session = Craft::$app-&amp;gt;getSession();&#xA;        $session-&amp;gt;addAssetBundleFlash(MatrixAsset::class);&#xA;        $session-&amp;gt;addJsFlash('Craft.MatrixInput.forgetCollapsedBlockId('.$this-&amp;gt;id.');');&#xA;    }&#xA;&#xA;    parent::afterDelete();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apart from this, I can’t seem to get any further into cracking the issue. Does anyone have any ideas? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8246" LastEditorUserId="57" LastEditDate="2018-04-13T04:12:27.177" LastActivityDate="2018-04-24T20:28:03.770" Title="Craft 3 - Resaving Matrix from frontend causing issues (Craft is not defined)" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="0" ClosedDate="2018-04-25T16:45:37.290" ContentLicense="CC BY-SA 3.0" />
  <row Id="25638" PostTypeId="1" AcceptedAnswerId="25640" CreationDate="2018-04-12T15:01:40.460" Score="0" ViewCount="19" Body="&lt;p&gt;I'm new to Craft and am trying to set up a condition that will compare the value of a category (entry.position).  However, I get this error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object of class Craft\ElementCriteriaModel could not be converted to string&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure how to do a textual comparison.  The 'position' field is, in my case, a category.  How would a comparison be achieved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry_pos = entry.position %}&#xA;{#   {%  craft.categories.slug('position') %} #}                 &#xA;{{ entry_pos }}&#xA;&#xA;{% if entry.position != 'staff' %}&#xA;    {% if entry.UBFUserName != '' %}&#xA;        {% set name_var = entry.UBFUserName %}&#xA;            {{ craft.aitest.AiTestVariable(name_var) }}&#xA;        {% else %}&#xA;    {% endif %}      &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="57" LastEditDate="2018-04-13T04:13:43.317" LastActivityDate="2018-04-13T04:13:43.317" Title="Compare Value to Category Title In Template" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25639" PostTypeId="1" CreationDate="2018-04-12T15:34:23.003" Score="1" ViewCount="127" Body="&lt;p&gt;In the CraftCMS (3.0.2) control panel &gt; Calendar &gt; Month, when I click on one of my events I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template not found: therapy-wellness/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I deconstructed the link and found that it's trying to pass the calendar name and the entry URL title to the _entry template. Eg.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/calendar-name/my-event-url-title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously the issue is that the template to handle this request does not exist, but I'm not clear on when this stopped working or what to do about it?&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-07-12T20:52:58.223" Title="Solspace Calendar (2.0.0-b9) returning template not found error in CP" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25640" PostTypeId="2" ParentId="25638" CreationDate="2018-04-12T15:35:54.443" Score="2" Body="&lt;p&gt;Your &lt;code&gt;entry_pos&lt;/code&gt; is an &lt;a href=&quot;https://docs.craftcms.com/v2/templating/elementcriteriamodel.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Criteria Model&lt;/a&gt;. You want to get the first (and probably only) category from this ElementCriteriaModel, and then compare its title to &lt;code&gt;'staff'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry_pos = entry.position.first %}&#xA;{% if entry_pos.title == 'staff' %}&#xA;  ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you an error if there is no &lt;code&gt;entry.position.first&lt;/code&gt;, as &lt;code&gt;entry_pos&lt;/code&gt; will be &lt;code&gt;null&lt;/code&gt;, so you should defend against that somehow. One possility is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry_pos and entry_pos.title == 'staff' %} ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another is to use twigs useful &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#other-operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;null-coalescing operator&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if (entry_pos.title ?? '') == 'staff' %} ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With Craft 3, you will use &lt;code&gt;one&lt;/code&gt; instead of &lt;code&gt;first&lt;/code&gt;, but otherwise everything is the same.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-04-12T15:35:54.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25641" PostTypeId="1" AcceptedAnswerId="25648" CreationDate="2018-04-12T15:46:02.647" Score="1" ViewCount="297" Body="&lt;p&gt;I am currently developing my first website using Craft 3 and I'm loving it overall. I seem to have a small issue that I can't quite figure out. When I go to the updates section in the admin panel, I am proposed multiple updates to Craft and 2 of my plugins (see screenshot). However, I can't figure out how to actually do these updates! According &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/updating.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;to this page in the docs&lt;/a&gt;, a button should appear at the top of the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried via composer : &lt;code&gt;composer update craftcms/craft&lt;/code&gt;, but it says 'Package &quot;craftcms/craft&quot; listed for update is not installed'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I've tried : &lt;code&gt;composer update craftcms/cms&lt;/code&gt; and that gives 'Nothing to install or update'. Same thing if I try to update plugins such as redactor that way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h9ewW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h9ewW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had started out on RC14 and I was able to update to RC15 properly via the button, but since then, the button no longer shows. Since I am new to Craft, I am not sure which log would contain pertinent information for the problem. I will be glad to share some logs if necessary. If it changes anything, I purchased a Pro license before the license changes on Apr 04. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if this is a noob question, any help is appreciated! &lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="8165" LastEditDate="2018-04-12T16:53:08.570" LastActivityDate="2018-04-12T21:49:46.987" Title="Can't update past CraftCMS 3 RC15" Tags="&lt;craft3&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25642" PostTypeId="1" CreationDate="2018-04-12T17:39:23.167" Score="1" ViewCount="445" Body="&lt;p&gt;This should have been easy. But, I am dorking something up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to point FeedMe to a local file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Finder, the file is located under &lt;code&gt;/Users/shellyar/Desktop&lt;/code&gt;.  I also tried `file:////Users/shellyar/Desktop'.  Neither worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VSx4g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VSx4g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2018-04-12T17:52:03.367" LastActivityDate="2018-05-04T13:59:40.307" Title="Point a plugin into to a local file" Tags="&lt;craft3&gt;&lt;url&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25643" PostTypeId="2" ParentId="25636" CreationDate="2018-04-12T19:11:11.830" Score="1" Body="&lt;p&gt;It sounds like this is something that could be done &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;using a module&lt;/a&gt;. You could use the sites field type to select the sites you want to enable the entry for, and then listen to the beforeSave event to enable the selected sites (and disable all others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would listen for, and act on, this event in your module's &lt;code&gt;init&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beforeSave event gets called for &lt;strong&gt;every&lt;/strong&gt; site the entry gets saved for, so it could be something like (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Entry::class, Entry::EVENT_BEFORE_SAVE, function (ModelEvent $event) {&#xA;    // Get the entry from the event&#xA;    $entry = $event-&amp;gt;sender;&#xA;&#xA;    if (&#xA;        $entry-&amp;gt;type-&amp;gt;id == 1 // &amp;lt;-- Section type ID for entry&#xA;        &amp;amp;&amp;amp; !in_array(&#xA;            $entry-&amp;gt;siteId,&#xA;            $entry-&amp;gt;getFieldValue('visibleOnSites')&#xA;        )&#xA;    ) {&#xA;        $entry-&amp;gt;enabledForSite = false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This assumes that entries are enabled for every site by default, and that propagation for this section is active.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-12T19:11:11.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25644" PostTypeId="1" CreationDate="2018-04-12T19:11:40.393" Score="1" ViewCount="421" Body="&lt;p&gt;I am trying to use some Twig code to sort entries by a date field that is contained within a Venti field. Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allWorkshops = [] %}&#xA;{% for entry in craft.entries.section('workshop') %}&#xA;&#xA;            {% set event = craft.venti.getEventById(entry.id) %}    {# get the Venti array for each entry #}    &#xA;&#xA;            {% set eventDate = event.startDate %}  {# get the Venti date field #}&#xA;&#xA;&#xA;            {% set allWorkshops = allWorkshops|merge({ &#xA;                    'eventDate' : event.startDate,&#xA;                    'name' : entry.title                    &#xA;                }) %}                               {# merge combined date and title into array #}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% for item in allWorkshops|sort %}&#xA;  &amp;lt;div&amp;gt;{{ item }}&amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works, except that the array 'allWorkshops' only contains the last item from the &quot;entry&quot; loop. Obviously 'allWorkshops' is getting overwritten for each iteration of the loop, but I do not understand why, given that it is defined outside the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any enlightenment!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-04-12T22:47:32.123" Title="Using Merge filter" Tags="&lt;merge&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25645" PostTypeId="2" ParentId="25644" CreationDate="2018-04-12T19:31:49.783" Score="2" Body="&lt;p&gt;What your merge filter does now, is merge the new object with the previous one, thus overriding the values for both keys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allWorkshops = allWorkshops|merge([{ &#xA;    'eventDate' : event.startDate,&#xA;    'name' : entry.title                    &#xA;}]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Merging your existing array with a new array containing one object.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-12T19:31:49.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25646" PostTypeId="1" CreationDate="2018-04-12T21:11:12.087" Score="1" ViewCount="87" Body="&lt;p&gt;I am trying to develop an email commerce site that is easy for customers to navigate. The way that I would like to do it is so that I have a range of different parent categories and that when a customer clicks in this it opens a page where the different child categories are displayed with image tiles. When a customer clicks onto this tile it will then bring up the products in that child category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible at all and if so what is the best way to go about making it operate in this way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any help in advance &lt;/p&gt;&#xA;" OwnerUserId="8248" LastEditorUserId="57" LastEditDate="2018-04-13T04:22:23.190" LastActivityDate="2018-04-13T05:39:11.280" Title="Commerce categories issue" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25647" PostTypeId="2" ParentId="1250" CreationDate="2018-04-12T21:28:26.283" Score="0" Body="&lt;p&gt;On a related task, if you want to just empty out a section or type, delete queries in the &lt;code&gt;entries&lt;/code&gt; table matching on &lt;code&gt;sectionId&lt;/code&gt; or &lt;code&gt;typeId&lt;/code&gt; fields. This  also cascades. Then you can keep your other sections, especially singles, which otherwise force you to delete and recreate the section to restore the single type entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: After doing this and batch importing data, I noticed the slugs were generated as duplicates (added integer on the end). Sure enough, &lt;code&gt;elements_i18n&lt;/code&gt; wasn't cleared out like &lt;code&gt;entries&lt;/code&gt; and &lt;code&gt;elements&lt;/code&gt; tables. So you'll have to change the query to delete rows from both tables or use the first method above and somehow filter for the sectionId you want.&lt;/p&gt;&#xA;" OwnerUserId="7625" LastEditorUserId="7625" LastEditDate="2018-04-13T04:40:50.047" LastActivityDate="2018-04-13T04:40:50.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25648" PostTypeId="2" ParentId="25641" CreationDate="2018-04-12T21:49:46.987" Score="3" Body="&lt;p&gt;As a silly mistake, I had set the &lt;code&gt;allowUpdates&lt;/code&gt; config setting to false...hope this helps anyone making the same silly mistake. &lt;/p&gt;&#xA;" OwnerUserId="8165" LastActivityDate="2018-04-12T21:49:46.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25649" PostTypeId="1" AcceptedAnswerId="25656" CreationDate="2018-04-12T21:51:47.923" Score="0" ViewCount="80" Body="&lt;p&gt;Running a number of development sites on MAMP Pro and repeatedly receive this alert when attempting to update. Updates are consciously being performed nonsimultaneously, but that does not seem to prevent the system alert. What triggers this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;It looks like someone is currently performing a system update.&#xA;&#xA;Only continue if you’re sure that’s not the case.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2018-04-13T04:27:40.210" Title="Multiple dev sites" Tags="&lt;craft3&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25650" PostTypeId="2" ParentId="25644" CreationDate="2018-04-12T22:47:32.123" Score="0" Body="&lt;p&gt;The problem, as noted by Paul Verheul, is that the key:values created in each loop overwrites the previous one. The solution is to save each iteration as an object in a new array. The code now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allWorkshops = [] %} &#xA;{% set workshop = [] %}&#xA;&#xA;{% set workshops = craft.entries.section('workshop') %} {# get entries #}   &#xA;&#xA;    {% for entry in workshops %}&#xA;&#xA;                {% set event = craft.venti.getEventById(entry.id) %}    {# get the Venti array for each entry #}    &#xA;&#xA;                {% set workshop = {&#xA;                        'eventDate' : event.startDate,&#xA;                        'eventTitle' : entry.title                  &#xA;                    } %}&#xA;&#xA;                {% set allWorkshops = allWorkshops|merge([ workshop ]) %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {% for item in allWorkshops|sort %}  {# sort items by eventDate #}&#xA;        &amp;lt;div&amp;gt;{{item.eventDate}} {{item.eventTitle}}&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also came across this answer which was in response to a different question but same basic issue: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14255/create-an-object-of-objects-with-merge?rq=1&quot;&gt;Create an object of objects with merge&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-04-12T22:47:32.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25651" PostTypeId="1" CreationDate="2018-04-13T00:06:24.320" Score="1" ViewCount="59" Body="&lt;p&gt;Editing an index page that displays all entries within a structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything displays fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I add a category to a few entries and add &lt;code&gt;{% if category | length %}&lt;/code&gt;and everything disappears as if no entries had a category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get no twig errors, so I presume my code is okay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is, just in case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          {% set entries = craft.entries.section('fellows').relatedTo(category) %}&#xA;      {% if category | length %}&#xA;        {% if entries | length %}&#xA;          {% for entry in entries %}&#xA;            {% for matrixBlock in entry.fellowsEntry %}&#xA;              {% if matrixBlock.type == 'entryContent' %}&#xA;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;portfolio-view bio&quot;&amp;gt; &#xA;                    &amp;lt;div class=&quot;portfolio-index inner bio m-white col-md-12&quot;&amp;gt;&#xA;                        {% for image in matrixBlock.fellowImage %} &#xA;                           &amp;lt;img src=&quot;{{ image.getUrl('sq300x300') }} &quot; alt=&quot;&quot; class=&quot;image-portfolio&quot;&amp;gt;&#xA;                         {% endfor %} &#xA;                        &amp;lt;h3 class=&quot;name text-center p22-ltp&quot;&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;hr&amp;gt;&#xA;                        &amp;lt;h3 class=&quot;org text-center p22-ltp&quot;&amp;gt;{{ matrixBlock.organization }} &amp;lt;/h3&amp;gt;&#xA;                        &amp;lt;hr&amp;gt;&#xA;                        {{ category }}&#xA;                    &amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt; &#xA;&#xA;             {% endif %}&#xA;          {% endfor %} &#xA;        {% endfor %}   &#xA;      {% endif %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-04-13T00:51:08.880" Title="Why are my entries disappearing when {% if category | length %} is added?" Tags="&lt;structure&gt;&lt;filter&gt;&lt;category&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25652" PostTypeId="1" AcceptedAnswerId="25657" CreationDate="2018-04-13T00:09:16.840" Score="1" ViewCount="753" Body="&lt;p&gt;Just tried to run the auto-update to v3.0.0 and it failed catastrophically with the message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error: file_put_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now my control panel page has a &quot;Finish Up&quot; button that doesn't seem to do anything (the styling on the page is completely broken).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to recover from this, if it's even possible, as the docs don't seem to have any useful information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Brad's instructions below (thanks Brad!), I found that my composer.json file had the version set to 3.0.0-RC5 (I guess the RC4 backup is the most recent after all--I thought I was on a later version).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried running &lt;code&gt;composer update&lt;/code&gt; but now I'm getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Problem 1&lt;/code&gt;&#xA;&lt;code&gt;&#xA;- Installation request for craftcms/cms 3.0.0-RC5 -&amp;gt; satisfiable by craftcms/cms[3.0.0-RC5].&#xA;- Conclusion: remove roave/security-advisories dev-master&#xA;- craftcms/cms 3.0.0-RC5 requires yiisoft/yii2 ~2.0.13.0 -&amp;gt; satisfiable by yiisoft/yii2[2.0.13, 2.0.13.1, 2.0.13.2, 2.0.13.3].&#xA;- yiisoft/yii2 2.0.13 conflicts with roave/security-advisories[dev-master].&#xA;- yiisoft/yii2 2.0.13.1 conflicts with roave/security-advisories[dev-master].&#xA;- yiisoft/yii2 2.0.13.2 conflicts with roave/security-advisories[dev-master].&#xA;- yiisoft/yii2 2.0.13.3 conflicts with roave/security-advisories[dev-master].&#xA;- Installation request for roave/security-advisories dev-master -&amp;gt; satisfiable by roave/security-advisories[dev-master].&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried setting my version to RC4 in &lt;code&gt;composer.json&lt;/code&gt; but got the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I just remove &lt;code&gt;roave/security-advisories&lt;/code&gt; from composer.json and try again?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please excuse my ignorance--I have approximately zero experience with Composer.&lt;/p&gt;&#xA;" OwnerUserId="8205" LastEditorUserId="8205" LastEditDate="2018-04-13T23:30:07.300" LastActivityDate="2018-04-13T23:30:07.300" Title="Failed upgrade to 3.0.0" Tags="&lt;craft3&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25653" PostTypeId="2" ParentId="25651" CreationDate="2018-04-13T00:51:08.880" Score="1" Body="&lt;p&gt;My &lt;code&gt;Category URL Formats&lt;/code&gt; was set-up incorrectly. Or rather, I needed to go to &lt;code&gt;{handle}/{slug}&lt;/code&gt; to see the proper result. &lt;/p&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-04-13T00:51:08.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25654" PostTypeId="1" CreationDate="2018-04-13T02:17:29.177" Score="1" ViewCount="776" Body="&lt;p&gt;I'm having a strange problem on a recent craft install. The plugin store doesn't load, and only reports &quot;Page not found&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've tried another craft install on the same system, and it's working fine.&lt;/li&gt;&#xA;&lt;li&gt;I tried replacing all core craft files with freshly downloaded 3.0.2 files.&lt;/li&gt;&#xA;&lt;li&gt;I've cleared caches, ran updates, loosened all permissions to 777 and everything in between.&lt;/li&gt;&#xA;&lt;li&gt;I've tried two different browsers with cache cleared.&lt;/li&gt;&#xA;&lt;li&gt;I have only 2 plugins installed: Redactor and Position Fieldtype — but I have those on another install as well and that install is fine.&lt;/li&gt;&#xA;&lt;li&gt;The logs in /storage/logs don't show any errors. I tail them, and nothing is reported.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Aside from the plugin page, all other craft systems work. Even the backups can run and save locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I can try to either diagnose or solve? Feel like I've hit a wall. Any advice is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7801" LastActivityDate="2018-04-13T03:48:42.607" Title="Plugin Store: Page not found" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-04-13T04:34:40.533" ContentLicense="CC BY-SA 3.0" />
  <row Id="25655" PostTypeId="2" ParentId="25654" CreationDate="2018-04-13T03:48:42.607" Score="1" Body="&lt;p&gt;Solved. There is a bug. When the setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;omitScriptNameInUrls' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is set to &quot;false&quot; in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/config/general.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Plugin Store doesn't load. Switching that setting to &lt;strong&gt;true&lt;/strong&gt; will fix it.&lt;/p&gt;&#xA;" OwnerUserId="7801" LastActivityDate="2018-04-13T03:48:42.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25656" PostTypeId="2" ParentId="25649" CreationDate="2018-04-13T04:27:40.210" Score="0" Body="&lt;p&gt;At the beginning of an update, one of the things that Craft does is set to the &lt;code&gt;maintenance&lt;/code&gt; column in the &lt;code&gt;craft_info&lt;/code&gt; in the database to &lt;code&gt;1&lt;/code&gt; to indicate that it's in maintenance mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the other things it does at the beginning of an update is to check and see if that column is &lt;em&gt;already&lt;/em&gt; set to one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That can happen under two, maybe three circumstances.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Someone else is updating the site at nearly the exact same time, but was slightly faster than you to do so.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There was a a previous update attempted, but some fatal error happened and that column never got set back to &lt;code&gt;0&lt;/code&gt; properly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some plugin is (incorrectly) setting that column to &lt;code&gt;1&lt;/code&gt; for its own purposes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-13T04:27:40.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25657" PostTypeId="2" ParentId="25652" CreationDate="2018-04-13T04:54:23.073" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Error: file_put_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Whatever user:group PHP is running as on your server doesn't have the permissions to write to &lt;code&gt;/car/www/html/craftcms&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft will only do a backup during updating if &lt;code&gt;mysqldump&lt;/code&gt; or &lt;code&gt;pg_dump&lt;/code&gt; is available to PHP (by default), or if your custom &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#$backupCommand-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;backupCommand&lt;/a&gt; config setting executes successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Craft can't make a backup during updating, it will halt the update process and prompt you asking what you'd like to do with one of the options being to continue without making a backup.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm not sure how to recover from this,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To restore the Craft files to the previous version, you can open your project's &lt;code&gt;composer.json&lt;/code&gt; file, find the &lt;code&gt;craftcms/cms&lt;/code&gt; line, set the version to the pre-update attempt version, then run &lt;code&gt;composer update&lt;/code&gt; from the command line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there were no database migrations that ran during the update attempt, that should be all you need to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there &lt;em&gt;were&lt;/em&gt; database migrations that ran, you'll probably get an message when you try to access the Control Panel saying that you can't backtrack to that version of Craft because now the database is out of sync with the files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only practical way around that is to restore from a pre-update attempt database backup.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-13T04:54:23.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25658" PostTypeId="2" ParentId="25607" CreationDate="2018-04-13T05:07:12.927" Score="2" Body="&lt;p&gt;You can see common patterns for this in Craft's own controllers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/controllers/EntriesController.php#L499-L507&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/master/src/controllers/EntriesController.php#L499-L507&lt;/a&gt;, if there's a problem, you can catch the error, set it on a route variable and &lt;code&gt;return null&lt;/code&gt; so the original template can display it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getSession()-&amp;gt;setError(Craft::t('app', 'Couldn’t duplicate entry.'));&#xA;&#xA;// Send the original entry back to the template, with any validation errors on the clone&#xA;$entry-&amp;gt;addErrors($clone-&amp;gt;getErrors());&#xA;Craft::$app-&amp;gt;getUrlManager()-&amp;gt;setRouteParams([&#xA;    'entry' =&amp;gt; $entry&#xA;]);&#xA;&#xA;return null;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't want to let the original template handle the error, then you should be able to do something like this from your controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;renderTemplate('error', ['error' =&amp;gt; 'Test']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-13T05:07:12.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25659" PostTypeId="2" ParentId="25646" CreationDate="2018-04-13T05:39:11.280" Score="1" Body="&lt;p&gt;This is absolutely possible with Craft &amp;amp; Commerce.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you would set up your categories group - say, Product categories.  You can add custom fields to these categories, for example an image field for an image that represents the category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you'd enter your category data - categories are inherently hierarchical (well, taxonomical really) - so it's easy to set up Parent -&gt; Child structures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you would add a categories field as a custom field to your products when setting them up in Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when you enter your products you can choose which category (or categories) the product should be in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you would set up templates to actually display all this: probably one template to display the parent categories list, another to display which user chosen sub-category is required, and then finally templates for your product grid and most likely another for your actual product pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like a bit of a process spelled out like that, but if you step through setting up the fields and entering some data, and then start with very simple templates to just list out the things at each stage, you will find it is quite easy to set all this up - the only complexity really comes from the design angle -&gt; i.e. making it look and work nicely!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck with it!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-04-13T05:39:11.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25660" PostTypeId="1" CreationDate="2018-04-13T07:12:37.893" Score="0" ViewCount="635" Body="&lt;p&gt;I am developing a Craft 3 plugin and would need to add a new method like &#xA;&lt;code&gt;&#xA;{% for item in craft.entries.section('sectionName').birthday('XYZ123').all() %}&#xA;&lt;/code&gt;&#xA;According to doc &lt;a href=&quot;https://docs.craftcms.com/v3/element-types.html#element-query-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/element-types.html#element-query-class&lt;/a&gt;, I am using following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File: &lt;code&gt;/by/prefix/element/Birthdate.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;    &amp;lt;?php&#xA;    namespace by\prefix\elements;&#xA;    use craft\base\Element;&#xA;    use craft\elements\db\ElementQueryInterface;&#xA;    use by\prefix\elements\db\BirthdateQuery;&#xA;    class Birthdate extends Element&#xA;    {&#xA;        public $birthdate;&#xA;        public static function find(): ElementQueryInterface&#xA;        {&lt;br&gt;&#xA;            return new BirthdateQuery(static::class);&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File: &lt;code&gt;/by/prefix/element/db/BirthdateQuery.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;    &amp;lt;?php&#xA;    namespace by\tariffsinfo\elements\db;&#xA;    use craft;&#xA;    use craft\db\Query;&#xA;    use craft\elements\db\ElementQuery;&#xA;    use craft\helpers\Db;&#xA;    use by\tariffsinfo\elements\BirthdateElement;&#xA;    class BirthdateQuery extends ElementQuery&#xA;    {&#xA;        public $birthdate;&#xA;        public function birthdate($value)&#xA;        {&lt;br&gt;&#xA;            return $value;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I am getting error message: &#xA;&lt;code&gt;Calling unknown method: craft\elements\db\EntryQuery::birthdate()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help what am I doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2018-04-13T09:47:26.713" Title="Craft 3 Plugin: Unable to add a new method to EntryQuery" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25661" PostTypeId="1" CreationDate="2018-04-13T08:13:26.427" Score="2" ViewCount="508" Body="&lt;p&gt;Recently, I developed a Craft 3 website. Its working perfectly on development server. But after deploying to another server, I am getting 504 error for home and all front end pages while Craft dashboard is working perfectly. I looked into logs but didn't find anything related to it.&lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2019-06-07T15:16:10.793" Title="504 error on home page of Craft 3 website" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25662" PostTypeId="2" ParentId="25661" CreationDate="2018-04-13T08:45:42.683" Score="3" Body="&lt;p&gt;This is kind of hard to debug without any logs, but because 504 is a gateway timeout error, I would start by checking if your site uses any &lt;strong&gt;external&lt;/strong&gt; services, other servers it tries to reach (only from within your templates, because the admin works fine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could be anything from Google's geolocation API to an external image service, that can not be reached because of server settings on either side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything in your server logs, or could you activate logging for your server to get more details?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-13T08:45:42.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25663" PostTypeId="1" AcceptedAnswerId="25696" CreationDate="2018-04-13T08:49:04.400" Score="1" ViewCount="60" Body="&lt;p&gt;I made a language picker, it works in one language but not in other. I want to get the current page of other locale. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.i18n.getCurrentLocale() %}&#xA;&#xA; {% switch locale %}&#xA;&#xA;  {% case 'en_us' %}&#xA;   &amp;lt;a href=&quot;{{ craft.entries.id(entry.id).locale('de').first().url }}&quot;&amp;gt;Deutsch&#xA;  {% case 'de' %}&#xA;   &amp;lt;a href=&quot;{{ craft.entries.id(entry.id).locale('en_us').first().url}}&quot;&amp;gt;English&#xA;&#xA; {% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works in first case but not the second. What am i doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I forget to update the locale template in other language. Problem is solved, my mistake.&lt;/p&gt;&#xA;" OwnerUserId="656" LastEditorUserId="656" LastEditDate="2018-04-13T09:51:11.390" LastActivityDate="2018-04-15T10:03:27.813" Title="Problem with switch statement in language picker - [Solved]" Tags="&lt;templating&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="7" ClosedDate="2018-04-16T23:14:29.567" ContentLicense="CC BY-SA 3.0" />
  <row Id="25664" PostTypeId="2" ParentId="25625" CreationDate="2018-04-13T09:29:29.290" Score="1" Body="&lt;p&gt;I don't think it's possible at all to set a different time for each recurrance. In that case, you'd have to add each date and time as a separate calendar entry.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-13T09:29:29.290" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25666" PostTypeId="2" ParentId="25660" CreationDate="2018-04-13T09:41:34.327" Score="1" Body="&lt;p&gt;You know you don't add a new function to Crafts &lt;code&gt;EntryQuery&lt;/code&gt; you create a custom &lt;code&gt;Element&lt;/code&gt; type with a custom &lt;code&gt;Query&lt;/code&gt; and add a function to that one. By the way you should probably fix your &lt;code&gt;namespaces&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use by\prefix\elements\db\BirthdateQuery;&#xA;use by\tariffsinfo\elements\BirthdateElement;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to use your function you'll have to do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BirthdateElement::find()-&amp;gt;birthdate('whatever');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To search for a custom field in an entries &lt;code&gt;FieldLayout&lt;/code&gt; you just need to call the parameter by handle... So when you include a field into the layout with the handle &lt;code&gt;birthday&lt;/code&gt; you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.birthday('whatever').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you want to search for your custom element type in your frontend you'll have to include a function to Twig like Craft does&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns a new EntryQuery instance.&#xA; *&#xA; * @param mixed $criteria&#xA; * @return EntryQuery&#xA; */&#xA;public function birthdays($criteria = null): BirthdateQuery&#xA;{&#xA;    $query = BirthdateElement::find();&#xA;    if ($criteria) {&#xA;        Craft::configure($query, $criteria);&#xA;    }&#xA;&#xA;    return $query;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can access it via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set birthdates = craft.pluginName.birthdays.id(2).birthdate('whatever').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-13T09:47:26.713" LastActivityDate="2018-04-13T09:47:26.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25667" PostTypeId="1" CreationDate="2018-04-13T11:20:46.983" Score="1" ViewCount="37" Body="&lt;p&gt;I just introduced a new (2nd) locale to my site. It now seems I can easily set up translated versions for &quot;single&quot; and &quot;channel&quot; pages that I set up new. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;old entries&lt;/em&gt;, which existed &lt;strong&gt;prior to introducing the new locale&lt;/strong&gt;, are not translatable however:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The little (green) dot after the language switch in these entries’ individual editor is only a grey circle instead of a green one like with the newly setup pages. If I click the new language I get a native &quot;Page not found&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set the specific legacy pages to be fully translatable though in the Sections settings, set them to be available in both locales but I get the feeling that &lt;strong&gt;Craft is not able to handle &quot;legacy&quot; singles &amp;amp; entries that were introduced during a one-locale setup of the page, is that correct?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way of working around the hassle of having to delete all the pre-multi-locale pages and re-setting them up to have them available in both locales (which would solve my problem but is a pain with so many pages/entries)?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastEditorUserId="5948" LastEditDate="2018-04-16T09:11:32.907" LastActivityDate="2018-04-16T09:11:32.907" Title="Craft 2: New locale introduction not affecting old entries" Tags="&lt;entries&gt;&lt;localization&gt;&lt;settings&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25668" PostTypeId="1" AcceptedAnswerId="25669" CreationDate="2018-04-13T12:36:19.793" Score="7" ViewCount="2200" Body="&lt;p&gt;How do I take advantage of the new .env files? I want to setup a local and production environment in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know how to do this or know of any docs out there explaining it ?&lt;/p&gt;&#xA;" OwnerUserId="7147" LastActivityDate="2018-04-13T12:53:10.603" Title="How to set up multi-env in Craft 3 with .env files?" Tags="&lt;craft3&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25669" PostTypeId="2" ParentId="25668" CreationDate="2018-04-13T12:46:43.580" Score="9" Body="&lt;p&gt;These are the two approaches I usually choose from:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Option 1: the 'default' Craft 3 way&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a .env file for every environment you create, and add it to your .gitignore file (if it's not yet in it). In this file, you put all environment-specific details;&lt;/li&gt;&#xA;&lt;li&gt;Craft, by default, will recognize and use those details.&lt;/li&gt;&#xA;&lt;li&gt;In your Craft config files, you can use the ENVIRONMENT as defined in your .env file to adjust the settings for one specific environment. So, the config that applies all the time is set in an array with the key '*', and the config that's specifically for the &lt;code&gt;dev&lt;/code&gt; environment, is in the array that has the 'dev' key (If you use the &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/config/general.php&quot; rel=&quot;noreferrer&quot;&gt;default general config file&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Option 2: &lt;a href=&quot;https://github.com/nystudio107/craft-multi-environment&quot; rel=&quot;noreferrer&quot;&gt;the .env.php way&lt;/a&gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;One of the reasons this approach exists, is that the makers of PHP dotenv (used in option 1) 'warn against using it in production' (as quoted from the README of option 2). The method as linked in the title uses a PHP file and some minor alterations to your config and index files to let you maintain a multi environment build.&lt;/p&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2018-04-13T12:53:10.603" LastActivityDate="2018-04-13T12:53:10.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25670" PostTypeId="1" CreationDate="2018-04-13T13:32:20.513" Score="2" ViewCount="161" Body="&lt;p&gt;I have a nav set up which works find but I need to limit the number of top level links to the first 5 in the loop (right now we have 9 plus oodles of children links!). Have tried various flavours of loop.index etc but have run out of ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s my basic nav code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set ppages = craft.entries.section('productPages').level('&amp;lt;=2') %}&#xA;&#xA;&amp;lt;ul id=&quot;submenu&quot; class=&quot;submenu&quot;&amp;gt;&#xA;  {% nav page in ppages %}&#xA;    &amp;lt;li class=“top-level&quot;&amp;gt;&#xA;      {{ page.getLink() }}&#xA;  {% ifchildren %}&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% children %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-04-13T18:13:55.027" Title="How do you limit the number of items that show up in a navigation?" Tags="&lt;entries&gt;&lt;structure&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25671" PostTypeId="2" ParentId="25670" CreationDate="2018-04-13T13:32:20.513" Score="2" Body="&lt;p&gt;If this is a Craft 2 project, unfortunately there's not a super clean way to do that. You'd have to get the last top-level item in the nav you want to show, and add a bunch of conditions in the code to make sure the entry you're outputting isn't after that 5th entry.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{# get the 5th top-level page #}&#xA;{% set fifthElement = craft.entries()&#xA;    .section('productPages')&#xA;    .level(1)&#xA;    .nth(4) %}&#xA;&#xA;{# get all the pages #}&#xA;{% set ppages = craft.entries()&#xA;    .section('productPages')&#xA;    .level('&amp;lt;=2')&#xA;    .find() %}&#xA;&#xA;{# now display the nav, but only output HTML for entries that are&#xA;   within the first 5 top-level entries #}&#xA;&#xA;&amp;lt;ul id=&quot;submenu&quot; class=&quot;submenu&quot;&amp;gt;&#xA;{% nav page in ppages %}&#xA;    {% if page.lft &amp;lt; fifthElement.rgt %}&#xA;      &amp;lt;li class=“top-level&quot;&amp;gt;&#xA;        {{ page.getLink() }}&#xA;    {% endif %}&#xA;  {% ifchildren %}&#xA;    {% if page.lft &amp;lt; fifthElement.rgt %}&amp;lt;ul&amp;gt;{% endif %}&#xA;    {% children %}&#xA;    {% if page.lft &amp;lt; fifthElement.rgt %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;  {% endifchildren %}&#xA;    {% if page.lft &amp;lt; fifthElement.rgt %}&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 it would be quite a bit simpler, though, as you have the power to modify the element query however you want. So we can first get the 5th top-level entry’s &lt;code&gt;rgt&lt;/code&gt; value, and then when running our main &lt;code&gt;ppages&lt;/code&gt; query, only get the ones whose &lt;code&gt;lft&lt;/code&gt; value is less than that 5th entry’s &lt;code&gt;rgt&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{# get the 5th top-level page #}&#xA;{% set fifthElement = craft.entries()&#xA;    .section('productPages')&#xA;    .level(1)&#xA;    .nth(4) %}&#xA;&#xA;{# get all the pages that are within the first 5 top-level pages #}&#xA;{% set ppages = craft.entries()&#xA;    .section('productPages')&#xA;    .level('&amp;lt;=2')&#xA;    .andWhere(['&amp;lt;', 'lft', fifthElement.rgt])&#xA;    .all() %}&#xA;&#xA;{# now output the navigation normally #}&#xA;&#xA;&amp;lt;ul id=&quot;submenu&quot; class=&quot;submenu&quot;&amp;gt;&#xA;  {% nav page in ppages %}&#xA;    &amp;lt;li class=“top-level&quot;&amp;gt;&#xA;      {{ page.getLink() }}&#xA;  {% ifchildren %}&#xA;    &amp;lt;ul&amp;gt;&#xA;      {% children %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you’re unfamiliar with these &lt;code&gt;lft&lt;/code&gt; and &lt;code&gt;rgt&lt;/code&gt; values, they are attributes of structured entries, which define their position within the structure, using the “Nested Set” model. The easiest way to think of it is, your structure section is like an XML file, and each of the entries are nodes within it. Each entry has a opening tag and a closing tag on different lines, and &lt;code&gt;lft&lt;/code&gt; and &lt;code&gt;rgt&lt;/code&gt; are those line numbers.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;1 &amp;lt;top_entry&amp;gt;&#xA;2   &amp;lt;nested_entry&amp;gt;&#xA;3   &amp;lt;/nested_entry&amp;gt;&#xA;4 &amp;lt;/top_entry&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So when we do &lt;code&gt;{% if page.lft &amp;lt; fifthElement.rgt %}&lt;/code&gt;, we are saying &lt;em&gt;“make sure that this node’s ‘opening tag’ comes before the fifth element’s ‘closing tag’”&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-04-13T18:13:55.027" LastActivityDate="2018-04-13T18:13:55.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25672" PostTypeId="2" ParentId="25639" CreationDate="2018-04-13T19:27:09.103" Score="1" Body="&lt;p&gt;Have you checked what values you have for the calendar(s) under the Site Settings: &lt;strong&gt;Event URI Format&lt;/strong&gt; &amp;amp; &lt;strong&gt;Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible you might have something incorrect there. Perhaps the Template path inside the &lt;em&gt;Event URI Format&lt;/em&gt; area, instead of a proper value like &lt;code&gt;/calendar_demo/event/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-04-13T19:27:09.103" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25673" PostTypeId="1" AcceptedAnswerId="25675" CreationDate="2018-04-13T21:31:35.640" Score="1" ViewCount="313" Body="&lt;p&gt;Here is my templating...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% if entry.programImage %}&#xA;        &amp;lt;img src=&quot;{{ entry.programImage.one().getUrl() }}&quot; alt=&quot;&quot;/&amp;gt;&#xA;      {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The field &lt;code&gt;programImage&lt;/code&gt; is NOT required.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image does display for entries that have it.&lt;br&gt;&#xA;It throws an ERROR for those that do not.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ERROR message is as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impossible to invoke a method (&quot;getUrl&quot;) on a null variable.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-04-14T17:33:49.893" Title="How do you template an IF statement to avoid an error if an image is not assigned" Tags="&lt;templating&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25674" PostTypeId="1" CreationDate="2018-04-13T21:40:28.233" Score="1" ViewCount="315" Body="&lt;p&gt;I have a channel with categories and an entries field. I need to first group all entries by their category. This is working fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('publicationsChannel') %}&#xA;{% set relatedCats = craft.categories.relatedTo(entries) %}&#xA;&#xA;{% for category in relatedCats %}&#xA;   {{ category.title }}&#xA;&#xA;  {% for entry in relatedEntries %}&#xA;    {# this list of entries needs to be grouped by the regionCountry field #}&#xA;    {{ entry.title }} &amp;lt;br&amp;gt;&#xA;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However what I now need to do is take the list of entries and further organize them according to a relationship field handle regionCountry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are only 3 entries in that channel Canada, US, UK and they need to be grouped in that order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to wrap my head around the logic needed to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need finally is.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Category 1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Canada&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;US&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;UK&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Category 2&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;Canada&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;US&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;UK&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 1&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;entry 2&#xA;etc...&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2018-04-13T22:23:27.180" LastActivityDate="2018-04-16T15:35:50.590" Title="Group entries by Category and then in each category by related entry field" Tags="&lt;templating&gt;&lt;categories&gt;&lt;craft3&gt;&lt;entries-field&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25675" PostTypeId="2" ParentId="25673" CreationDate="2018-04-13T21:59:28.620" Score="2" Body="&lt;p&gt;You're close...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set programImage = entry.programImage.one() %}&#xA;{% if programImage %}&#xA;    &amp;lt;img src=&quot;{{ programImage.getUrl() }}&quot; alt=&quot;&quot;/&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You get the the asset model (or null), then check if you actually have it, then finally use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's essentially the same in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-04-13T21:59:28.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25676" PostTypeId="2" ParentId="25673" CreationDate="2018-04-13T22:02:39.100" Score="1" Body="&lt;p&gt;&lt;code&gt;entry.programImage&lt;/code&gt; does not contain the image. It is a prepared query to fetch the database row and populate the model. In order to gain the model/the asset you have to do &lt;code&gt;entry.programImage.one()&lt;/code&gt; which will return the element or null. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.programImage.one() %}&#xA;   ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to make sure to check if the field is even in the layout you have to do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.programImage is defined and entry.programImage is not empty %}&#xA;    {% set asset = entry.programImage.one %}&#xA;    {% if asset is not null %}&#xA;       You have an image&#xA;    {% endif %}&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-13T22:02:39.100" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25678" PostTypeId="2" ParentId="25674" CreationDate="2018-04-13T22:26:27.693" Score="1" Body="&lt;p&gt;If you do like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entries &quot;countries&quot; have two fields for relations, category and entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then for every category in CategoryGroupA you can loop over the entries related to it (countries) and for every country loop over the related entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('CategoryGroupA') %}&#xA;&#xA;{% for category in categories %}&#xA;&#xA;    //Print Category here (Catregory 1, 2 etc.)&#xA;&#xA;    {% set countries = craft.entries.relatedTo(category) %}&#xA;&#xA;    {% for country in countries %}&#xA;&#xA;         //Print entries here (Canada, US, UK etc.)&#xA;&#xA;        {% set entries= craft.entries.relatedTo(country) %}&#xA;&#xA;        {% for entry in entries %}&#xA;            //And here you get entry 1, 2, 3 etc..&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example the entry &quot;Canada&quot;, in the category field it would be related to &quot;Category 1&quot; and &quot;Category 2&quot;. And in the Entries field it would be related to &quot;Entry 1&quot; and &quot;Entry 2&quot;.&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-04-13T22:26:27.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25681" PostTypeId="2" ParentId="25673" CreationDate="2018-04-14T13:11:30.423" Score="1" Body="&lt;p&gt;I ran into the same problem a couple of days ago (Craft newbie). I wanted to make it obvious that the image was missing, so I uploaded an image asset for the &quot;No image&quot; case. Then in the template, I used this for the src attribute on the image tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{(entry.programImage.one() ?? craft.assets.id(47).one()).getUrl()}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's using the null coalescing operator &lt;strong&gt;??&lt;/strong&gt;, so if entry.programImage.one() is &lt;em&gt;not&lt;/em&gt; &lt;strong&gt;null&lt;/strong&gt;, it gets returned and if it &lt;em&gt;is&lt;/em&gt; &lt;strong&gt;null&lt;/strong&gt; it loads a specific image asset (my 'no image' picture, represented by id 47). Then it does a getUrl on which ever image is selected.&lt;/p&gt;&#xA;" OwnerUserId="8233" LastActivityDate="2018-04-14T13:11:30.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25682" PostTypeId="1" AcceptedAnswerId="25802" CreationDate="2018-04-14T13:53:19.007" Score="0" ViewCount="117" Body="&lt;p&gt;I am trying to insert records into the same entry using FeedMe with Matrix and Table for one of the fields.  My table field is a plain text.  So I have one programLevel, one program and a field that collects many text entry lists in a Table field.  No matter what I do, depending on the structure of the JSON.  I either overwrite the record already there or it gets 2 entries into the Matrix field but combines all the plain text entries into the Table field (code below).  Not sure what I am doing wrong here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I end up with 2 Matrix entries but a combined Table field called Lists.  Basically, Test text 1, Test text 2, Test text 3, etc in the Table field for both Matrix records in the entry. Is there a proper way to get this formatted correctly please?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    {&#xA;        &quot;title&quot;:&quot;Test Entry&quot;,&#xA;        &quot;programs&quot;: [&#xA;            {&#xA;                &quot;programLevel&quot;:&quot;Alpha&quot;,&#xA;                &quot;program&quot;:&quot;Vector1&quot;,&#xA;                &quot;listItems&quot;: [&#xA;                    &quot;Test text 1&quot;,&#xA;                    &quot;Test text 2&quot;&#xA;                ]&#xA;            },&#xA;            {&#xA;                &quot;programLevel&quot;:&quot;Beta&quot;,&#xA;                &quot;program&quot;:&quot;Vector1&quot;,&#xA;                &quot;listItems&quot;: [&#xA;                    &quot;Test text 3&quot;,&#xA;                    &quot;Test text 4&quot;&#xA;                ]&#xA;            }  &#xA;        ]&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="6619" LastEditDate="2018-04-14T21:28:42.657" LastActivityDate="2018-04-22T18:37:13.973" Title="Help with FeedMe JSON" Tags="&lt;json&gt;&lt;plugin-feedme&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25683" PostTypeId="1" CreationDate="2018-04-14T15:41:54.467" Score="1" ViewCount="408" Body="&lt;p&gt;How can I filter a &lt;code&gt;for loop&lt;/code&gt; based on the value of a field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;filterByValue&lt;/code&gt;, but I do not know how to construct the statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is NOT a category field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for line in craft.entries.section('docs').filterByVale('account: 05').all() %}&#xA;    &amp;lt;a href=&quot;{{ line.url }}&quot;&amp;gt;{{line.lineItemTitle}} ({{line.lineItemTitle}})&amp;lt;/a&amp;gt;, &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5557" LastEditDate="2018-04-14T16:01:51.003" LastActivityDate="2018-04-14T16:08:04.513" Title="How can I filter a for loop based on the value of a field?" Tags="&lt;templating&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25684" PostTypeId="2" ParentId="25683" CreationDate="2018-04-14T16:01:01.237" Score="2" Body="&lt;p&gt;You don't filter a &lt;code&gt;loop&lt;/code&gt; but you can attach certain criteria in your &lt;code&gt;ElementQuery&lt;/code&gt;. &lt;code&gt;craft.entries&lt;/code&gt; returns you an object of type &lt;code&gt;EntryQuery&lt;/code&gt; (&lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-queries.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to docs&lt;/a&gt;). You can search for specific entries based on different criterias by calling magic methods or function in your &lt;code&gt;Query&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;section('docs')&lt;/code&gt; will return only entries in the section &lt;code&gt;docs&lt;/code&gt;. You can attach any field handle that is in your field layout as well.. In your case &lt;code&gt;account('05')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for line in craft.entries.section('docs').account('05').all() %}&#xA;     &amp;lt;a href=&quot;{{ line.url }}&quot;&amp;gt;{{line.lineItemTitle}} ({{line.lineItemTitle}})&amp;lt;/a&amp;gt;, &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to search for multiple values you can include them as array or comma separated string.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries&#xA;    .section(['section1', 'section2')&#xA;    .account('and, &amp;gt;=5, &amp;lt;=10')&#xA;    .anotherField('or, 3, 5')&#xA;    .someThingElse(['or' ,3 , 5])&#xA;    .all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see all available syntax examples in the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-db.html#parseParam()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;DB::parseParam()&lt;/a&gt; function&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-14T16:08:04.513" LastActivityDate="2018-04-14T16:08:04.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25685" PostTypeId="2" ParentId="25673" CreationDate="2018-04-14T17:33:49.893" Score="2" Body="&lt;p&gt;I talk about this type of &quot;defensive coding&quot; extensively in the &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt; article, if it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TL;DR is that the null coalescing operator is your friend:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;{% set image = entry.someImage.first() ?? someGlobal.defaultImage.first() ?? null %}&#xA;{% if image and image.kind == &quot;image&quot; %}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-14T17:33:49.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25686" PostTypeId="1" AcceptedAnswerId="25687" CreationDate="2018-04-14T18:08:36.520" Score="1" ViewCount="99" Body="&lt;p&gt;Writing a plugin and creating some links. Trying to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = craft::$app-&amp;gt;urlManager-&amp;gt;createUrl(['', 'state' =&amp;gt; 'KS']);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to create a URL. I am expecting:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://test.com/index.php?state=KS&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://test.com/index.php?state=KS&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://test.com/index.php?p=actions&amp;amp;state=KS&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://test.com/index.php?p=actions&amp;amp;state=KS&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That results in the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;HTTP 404 – Not Found – yii\web\NotFoundHttpException&#xA;  Template not found: actions&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is the p=actions that is being added to the url? I am a bit confused by this.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-04-14T18:28:03.983" Title="createUrl adding p=actions" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25687" PostTypeId="2" ParentId="25686" CreationDate="2018-04-14T18:28:03.983" Score="2" Body="&lt;p&gt;&lt;code&gt;craft::$app-&amp;gt;urlManager-&amp;gt;createUrl&lt;/code&gt; will always return an action url because in the end this function does &lt;code&gt;return UrlHelper::actionUrl($route, $params);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to create a basic site url so you need to do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UrlHelper::url('', ['state' =&amp;gt; 'KR'] )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-14T18:28:03.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25688" PostTypeId="1" CreationDate="2018-04-14T19:15:54.400" Score="0" ViewCount="54" Body="&lt;p&gt;I did a straight lift of the Craft3 &lt;a href=&quot;https://docs.craftcms.com/v3/templating/examples/search-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search Form example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &quot;works.&quot;  There are no errors.  But, it is not showing all results. I can type &lt;code&gt;F&lt;/code&gt; and it works. I type &lt;code&gt;F-&lt;/code&gt; and it works.  I type &lt;code&gt;F-15&lt;/code&gt; and it does NOT work, even though the &lt;code&gt;F&lt;/code&gt; and &lt;code&gt;F-&lt;/code&gt; searches included &lt;code&gt;F-15&lt;/code&gt; in the results. Any search with &lt;code&gt;F-XX&lt;/code&gt;, &lt;code&gt;H-XX&lt;/code&gt;, &lt;code&gt;MQ-XX&lt;/code&gt; (where XX is a number such as 4, 9, 15,16 or 22)  fails to display the appropriate results.  It gets stranger.  &lt;code&gt;C-XX&lt;/code&gt;, &lt;code&gt;A-XX&lt;/code&gt;, &lt;code&gt;RC-XX&lt;/code&gt;, and &lt;code&gt;HC-XX&lt;/code&gt; WORK!!! And, these are the title fields. So, I can't figure out what is throwing things off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My search input is ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;form action=&quot;{{ url('search/results') }}&quot;&amp;gt;&#xA;&amp;lt;ul class=&quot;menu right&quot;&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;input type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;button type=&quot;submit&quot; class=&quot;button&quot;&amp;gt;Go&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Search Results are a straight lift from the Craft3 example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PPjOl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PPjOl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-04-14T19:15:54.400" Title="Search results missing items" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25689" PostTypeId="1" AcceptedAnswerId="25693" CreationDate="2018-04-14T19:45:01.457" Score="1" ViewCount="394" Body="&lt;h2&gt;Basic info&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have a structure with a handle &lt;code&gt;about&lt;/code&gt;. &lt;/li&gt;&#xA;&lt;li&gt;The Entry URI format is &lt;code&gt;about/{slug}&lt;/code&gt;. EDIT: also tried it with just &lt;code&gt;{{ slug }}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;I created a child page called &quot;Privacy Policy&quot; with the slug &lt;code&gt;privacy-policy&lt;/code&gt;. It has a parent of the page &quot;About SAFS&quot; (slug &lt;code&gt;about-safs&lt;/code&gt;). &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;I can only access the page at &lt;code&gt;mysite.com/about/about-safsprivacy-policy&lt;/code&gt;. If I go to &lt;code&gt;mysite.com/about/privacy-policy&lt;/code&gt;, I get a 404.&lt;/strong&gt; &lt;/li&gt;&#xA;&lt;li&gt;If I include &lt;code&gt;{{ entry.slug }}&lt;/code&gt; in the template, it prints &lt;code&gt;privacy-policy&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Edit: This is my Settings &gt; Sections &gt; About after changing slug to just &lt;code&gt;{ slug }&lt;/code&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0IcAl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0IcAl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Why is the parent's slug being inserted into the URI, and how do I change that?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Possibly relevant info&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;All the top-level pages in the About structure display on a single page, using this template for the entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.level == 1 %}&#xA;  {% redirect siteUrl|trim ~ 'about#' ~ entry.slug %}&#xA;{% else %}&#xA;&#xA;  {# normal template #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the About index template, I include:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set link = siteUrl ~ &quot;/about&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: I also tried removing the redirect from the template, and I'm getting the same routing issue for the &lt;code&gt;privacy-policy&lt;/code&gt; entry.&lt;/p&gt;&#xA;" OwnerUserId="5449" LastEditorUserId="5449" LastEditDate="2018-04-14T21:21:05.150" LastActivityDate="2018-04-14T21:51:20.963" Title="Why is the parent slug showing up in the child slug in a structure?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;structure&gt;&lt;routing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25690" PostTypeId="1" CreationDate="2018-04-14T20:05:41.407" Score="1" ViewCount="54" Body="&lt;p&gt;I apologize for the seemingly vague title, but I honestly don't know the best way to state this problem succinctly!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is within the context of a particular section's entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I want to happen:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to loop through a list of variables that call different Entry elementCriteriaModels and for each iteration of this loop I want to get the section's handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How I tried to make it happen:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Get related entries from a number of different sections&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set towns = craft.entries.section('towns').relatedTo(county) %}&#xA;{% set citizens = craft.entries.section('inductees').relatedTo(county) %}&#xA;{% set events = craft.entries.section('events').relatedTo(county) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Make a list of those elementCriteriaModel objects&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set arrayOfSections = [&#xA;    towns,&#xA;    citizens,&#xA;    events&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Loop through that list and try to get the section handle of whatever the first entry is of each section&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in arrayOfSections %}&#xA;    {% set sectionHandle = section.first().getSection() %}&#xA;    {{ sectionHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What actually happens&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error: &quot;Impossible to invoke a method (&quot;getSection&quot;) on a null variable.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to do the same thing on an object that is outside of that &lt;code&gt;arrayOfSections&lt;/code&gt; list, it works just fine!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why am I even trying to do this??&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a huge part of this template that repeats itself over and over. If I can successfully loop through these related sections in this way that problem will be fixed. I've thought about turning this into a macro, but I'd still have to call this macro nearly half a dozen times and manually feed in the desired section each time...&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-04-14T21:13:39.560" Title="Different behavior when looping through a list of variables" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25691" PostTypeId="2" ParentId="25689" CreationDate="2018-04-14T20:59:09.787" Score="1" Body="&lt;p&gt;Please take a look into your section. In Craft 2 there are two fields: Uri format parent and URI format child. You probably included the parent slug into the child input&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional note: it's not a good way to rebuild your links manually. You should always use the &lt;code&gt;getUrl()&lt;/code&gt; function unless you have a really good reason for it &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-14T20:59:09.787" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25692" PostTypeId="2" ParentId="25690" CreationDate="2018-04-14T21:08:22.193" Score="1" Body="&lt;p&gt;Make sure your &lt;code&gt;section.first()&lt;/code&gt; returns an element. The error occurs because &lt;code&gt;section.first()&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt; =&gt; no element was found with your criteria. And the value &lt;code&gt;null&lt;/code&gt; has no function &lt;code&gt;getSection&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - keep in mind your &lt;code&gt;sectionHandle&lt;/code&gt; variable is not the handle of the section, but the &lt;code&gt;SectionModel&lt;/code&gt;thus your code as it is currently is not really performant&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-14T21:13:39.560" LastActivityDate="2018-04-14T21:13:39.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25693" PostTypeId="2" ParentId="25689" CreationDate="2018-04-14T21:51:20.963" Score="3" Body="&lt;p&gt;Pretty sure that the &lt;code&gt;ResaveElements&lt;/code&gt; task just hadn't run yet - my queue was stuck. Once I cleared the stuck items, the issue resolved on its own!&lt;/p&gt;&#xA;" OwnerUserId="5449" LastActivityDate="2018-04-14T21:51:20.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25694" PostTypeId="1" CreationDate="2018-04-15T08:00:40.637" Score="1" ViewCount="19" Body="&lt;p&gt;In the footer there is a column showing the images of the most recent entries. How do you prevent the image from the main entry itself to be shown?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you test an url segment against the title or slug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This cannot be too complicated, but I am not able to find an example to get me started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Added Code&lt;/strong&gt; (thank you Robin)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set recents = craft.entries.section('sectionName').id('not ' ~ entry.id).all() %}&#xA;{% for entry in recents %}&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ entry.carousel.one().getUrl('footerThumbs') }}&quot; class=&quot;img-responsive&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;One more question:&lt;/strong&gt;&#xA;How do you limited the output using the &lt;code&gt;elementCriteriaModel&lt;/code&gt;? Invoking Limit(x) on the array is not possible. &lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2018-04-15T21:08:16.730" LastActivityDate="2018-04-15T21:08:16.730" Title="Not showing the entry somewhere else on the same page" Tags="&lt;templating&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25695" PostTypeId="2" ParentId="25694" CreationDate="2018-04-15T09:28:17.980" Score="1" Body="&lt;p&gt;You can exclude the current entry from your query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% recents = craft.entries.id('not ' ~ entry.id).find() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-15T09:28:17.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25696" PostTypeId="2" ParentId="25663" CreationDate="2018-04-15T10:03:27.813" Score="1" Body="&lt;p&gt;I forget to update locale template code with the same switch statement. Now problem solved.&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2018-04-15T10:03:27.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25697" PostTypeId="2" ParentId="25578" CreationDate="2018-04-16T11:39:58.590" Score="0" Body="&lt;p&gt;Hello and thanks Brad !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was actually using Firefox. When I tried to install Craft 3 via Chrome (which has never gone to the website before) the issue was solved and I could access to the next page. Should be a cache issue !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Olivier.&lt;/p&gt;&#xA;" OwnerUserId="8221" LastActivityDate="2018-04-16T11:39:58.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25698" PostTypeId="1" AcceptedAnswerId="25699" CreationDate="2018-04-16T11:47:24.143" Score="4" ViewCount="618" Body="&lt;p&gt;Working in Craft 3, I have a requirement to restrict user access (in the CP) &lt;strong&gt;&lt;em&gt;per Entry&lt;/em&gt;&lt;/strong&gt; rather than &lt;strong&gt;&lt;em&gt;per Section&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case Users in Craft will belong to Department (Channel) and Resources (Channel). They should only be able to administer the Entries in those Channels for which they are responsible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose the ideal would be to create a User Group per Department and then be able to &lt;strong&gt;select the individual Entries within the Department &amp;amp; Resources Channels&lt;/strong&gt; here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SWzsv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SWzsv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible via a Module/Plugin and if so can anyone provide any pointers on how to get started? I presume I'd need to loop through all Entries in the Channels and output them in this list to be selectable and then have access permissions applied. Any examples or pointers would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions or workarounds also welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3481" LastActivityDate="2018-06-19T12:29:46.643" Title="Restrict Permissions Per Entry Rather Than Per Section" Tags="&lt;permissions&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25699" PostTypeId="2" ParentId="25698" CreationDate="2018-04-16T12:48:19.473" Score="4" Body="&lt;p&gt;There is a way - it's actually quite easy but you need to dig deep into Craft 3 to do it. In general: there is only one single Javascript function that fetches all elements for all index pages&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;updateElements: function() {&#xA;    // Ignore if we're not fully initialized yet&#xA;    if (!this.initialized) {&#xA;        return;&#xA;    }&#xA;&#xA;    this.setIndexBusy();&#xA;&#xA;    var params = this.getViewParams();&#xA;&#xA;    Craft.postActionRequest(this.settings.updateElementsAction, params, $.proxy(function(response, textStatus) {&#xA;        this.setIndexAvailable();&#xA;&#xA;        if (textStatus === 'success') {&#xA;            this._updateView(params, response);&#xA;        }&#xA;        else {&#xA;            Craft.cp.displayError(Craft.t('app', 'An unknown error occurred.'));&#xA;        }&#xA;&#xA;    }, this));&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see: the route is a variable in the &lt;code&gt;defaults&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;updateElementsAction: 'element-indexes/get-elements'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to change this route you'll have to overwrite it in a JS file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.BaseElementIndex.defaults.updateElementsAction = 'your-awesome-plugin-route';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not let's take a look at the controller: After certain other functions the final call that searches for all elements is the following &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/ElementIndexesController.php#L379&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementIndexController line 379&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$responseData['html'] = $elementType::indexHtml(&#xA;    $this-&amp;gt;_elementQuery,  // &amp;lt;-- this is the important part&#xA;    $disabledElementIds,&#xA;    $this-&amp;gt;_viewState,&#xA;    $this-&amp;gt;_sourceKey,&#xA;    $this-&amp;gt;_context,&#xA;    $includeContainer,&#xA;    $showCheckboxes&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All you have to do is to extend this Controller, build a custom one, link the route to your custom controller and change the &lt;code&gt;$this-&amp;gt;_elementQuery&lt;/code&gt;. You can include your custom search parameters, include hidden content fields, create custom relation fields for groups and search for elements related to this user group or whatever you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems a little bit tricky at first but it's actually pretty easy. I've done it several times&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-16T12:48:19.473" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25700" PostTypeId="1" CreationDate="2018-04-16T13:08:20.873" Score="0" ViewCount="98" Body="&lt;p&gt;I have my two locales set up as described in the official documentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to translate my pages and fields in the CP as supposed to and have two versions ready in the backend, both with a green dot behind them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I try to access any page &lt;em&gt;apart from the homepage&lt;/em&gt; in my 2nd locale in the frontend I get a 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;DE&lt;/code&gt; is my first locale, placed within the &lt;code&gt;/public/&lt;/code&gt; folder. &#xA;&lt;code&gt;EN&lt;/code&gt; is my second locale, placed within the &lt;code&gt;/public/en/&lt;/code&gt; folder with the &lt;code&gt;index.php&lt;/code&gt; referring to &lt;code&gt;../../craft&lt;/code&gt; as shown in the official docs and the same &lt;code&gt;.htaccess&lt;/code&gt; copied from the parent &lt;code&gt;/public/&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, this is my &lt;code&gt;general.php&lt;/code&gt; setup for the local development server, where I can not see any obvious mistakes yet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.develop' =&amp;gt; array(&#xA;  'rootUrl' =&amp;gt; 'http://deque.develop:8888/',&#xA;'siteUrl' =&amp;gt; array(&#xA;    'de' =&amp;gt; 'http://deque.develop:8888/',&#xA;    'en' =&amp;gt; 'http://deque.develop:8888/en/',&#xA;  ),&#xA;  'environmentVariables' =&amp;gt; array(&#xA;  'baseUrl'  =&amp;gt; 'http://deque.develop:8888',&#xA;  'basePath' =&amp;gt; 'http://deque.develop:8888',&#xA;  'devMode' =&amp;gt; true,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did not write the &lt;code&gt;/en/&lt;/code&gt; in any of the CP settings, only have the correct translations for the URL string there, so that should be no issue. The URLs are rendered fine and as supposed in the Frontend anyway. It’s just that a 404 is displayed for any English pages instead of the actual content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft’s log file I could only find this hinting at something:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018/04/13 12:52:20 [error] [exception.Craft\HttpException.404] Craft\HttpException in /Users/Tobias/Development/deque_2018/craft/app/controllers/TemplatesController.php:72&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any hints where I might be making a mistake?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2018-04-16T14:22:37.713" Title="Craft 2: Locale throwing 404 in frontend" Tags="&lt;localization&gt;&lt;config&gt;&lt;frontend&gt;&lt;404&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25701" PostTypeId="2" ParentId="25605" CreationDate="2018-04-16T13:49:02.850" Score="1" Body="&lt;p&gt;First, we'll be adding native support for localization in Craft 3. This is a bit trickier in Craft 2 right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two thoughts. You could set up 3 different emails (each managed in a different language) to be triggered off the same event. Not ideal, but an option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from that, Sprout Email does run the &lt;code&gt;subjectLine&lt;/code&gt; field through &lt;code&gt;renderObjectTemplate&lt;/code&gt; so you could use a field in whatever is triggering your event as a dynamic variable for the Subject Line.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-04-17T20:14:50.330" LastActivityDate="2018-04-17T20:14:50.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25702" PostTypeId="2" ParentId="25700" CreationDate="2018-04-16T14:22:37.713" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;However, when I try to access any page apart from the homepage in my&#xA;  2nd locale in the frontend I get a 404 error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could it be, that as a result of your settings, URL's for &lt;code&gt;/en&lt;/code&gt; do not get rewritten correctly? I don't know how you redirect SEO-friendly urls, but most of the times (at least in my life) if accessing all pages but the homepage fails, it has something to do with URL rewriting.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-16T14:22:37.713" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25703" PostTypeId="2" ParentId="25674" CreationDate="2018-04-16T15:35:50.590" Score="2" Body="&lt;p&gt;I figured this out in part with @syversen answer, but it need some tweaking&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the simplified working code. This &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countries = craft.entries.section('countries') %}&#xA;{% set publications = craft.entries.section('publicationsChannel') %}&#xA;{% set categories = craft.categories.group('documentCategory') %}&#xA;&#xA;{% for category in categories %}&#xA;{# list categories #}&#xA;  &amp;lt;h4&amp;gt;{{ category.title }}&amp;lt;/h4&amp;gt;&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {# inside categories list countries #}&#xA;    {% for country in countries %}&#xA;      &amp;lt;li&amp;gt;&#xA;      {{ country.title }}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {# finally output entries that are in the category and country #}&#xA;          {% set relatedEntries = publications.relatedTo([&#xA;          'and',&#xA;          {targetElement: category},&#xA;          {targetElement: country, field: 'regionCountry'}&#xA;          ]) %}&#xA;&#xA;            {% for entry in relatedEntries %}&#xA;              &amp;lt;li&amp;gt; {{ entry.title }} &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}{# end categories #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-04-16T15:35:50.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25704" PostTypeId="1" CreationDate="2018-04-16T16:09:36.973" Score="0" ViewCount="63" Body="&lt;p&gt;When installing a plugin from the plugin store I get a popup telling me:&#xA;&quot;The git command requires the command line developer tools. Would you like to install the tools now?&quot;&#xA;&quot;Choose Install to continue. Chose Get Xcode to install Xcode and the command line developer tools from the app store.&quot;&#xA;Options are &quot;Get Xcode&quot;, &quot;Not now&quot; and &quot;Install&quot;&#xA;I tried just clicking Install, and it seems to have worked but I got another prompt like above at the end. So I don't know if something will fail sometime down the line or not.&#xA;After installing on my local Mamp setup it's not obvious which files I need to upload to the live server as there isn't a plugin folder. I only installed 2 plugins and 12 folders in the Vendor folder showed updated files in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't use git, I don't use the command line and I didn't install Composer and I don't really want to in the future either. I just want to keep things simple. Does this mean that I won't be able to use Craft now unless I become a command line expert?&#xA;Even the Mijingo video tutorials which have been really easy to follow in the past have started to be full of complicated command line stuff.&#xA;I have a rubbish memory and only use a few keyboard shortcuts as I can't remember more than 3 or 4, so remembering all those command line options isn't going to happen.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-04-16T17:43:23.230" Title="Query when installing plugins" Tags="&lt;plugins&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-04-17T03:42:40.560" ContentLicense="CC BY-SA 3.0" />
  <row Id="25705" PostTypeId="2" ParentId="25704" CreationDate="2018-04-16T17:43:23.230" Score="1" Body="&lt;p&gt;Going to mark this as off-topic (Craft issues should be posted to &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues&lt;/a&gt;, which I realize is a bit ironic to tell you considering you said you don’t want to use Git, but you don’t &lt;em&gt;need&lt;/em&gt; to use Git to open a GitHub account).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, the issue is that Craft 3 uses Composer behind the scenes to install plugins and update itself right now. So even though you don’t need to directly interface with Composer now that the zip option is available, the system you are running on must at least be able to run Composer. And Git is a requirement of Composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this and other reasons, we are planning on making Craft 3 less reliant on Composer in a future update.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After installing on my local Mamp setup it's not obvious which files I need to upload to the live server as there isn't a plugin folder.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You need to upload the entire &lt;code&gt;vendor/&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does this mean that I won't be able to use Craft now unless I become a command line expert?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As long as your system is capable of running Composer (which it sounds like you’ve taken care of), no you shouldn’t need to run any commands from the terminal yourself.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Even the Mijingo video tutorials which have been really easy to follow in the past have started to be full of complicated command line stuff.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Up until the Craft 3 GA launch on April 4, the only way to install Craft 3 was via the terminal. Now that a zip download is available from &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com&lt;/a&gt;, that’s not the case anymore.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-04-16T17:43:23.230" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25706" PostTypeId="1" AcceptedAnswerId="25707" CreationDate="2018-04-16T18:16:46.767" Score="4" ViewCount="2174" Body="&lt;p&gt;In Craft 2 you could creat a query with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;select()&lt;/code&gt; .... etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in Craft 3 there is no &lt;code&gt;select()&lt;/code&gt; Method in &lt;code&gt;Craft::$app-&amp;gt;db-&amp;gt;createCommand()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I overlooking something?&lt;/p&gt;&#xA;" OwnerUserId="8219" LastActivityDate="2018-04-16T18:26:20.460" Title="Craft 3: Get Data from a custom Table via createCommand()" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;database&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25707" PostTypeId="2" ParentId="25706" CreationDate="2018-04-16T18:26:20.460" Score="9" Body="&lt;p&gt;You can use either an &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/db-active-record&quot; rel=&quot;noreferrer&quot;&gt;activeRecord&lt;/a&gt;  for it &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$customer = Customer::find() &#xA;    -&amp;gt;where(['id' =&amp;gt; 123]) &#xA;    -&amp;gt;one();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or a &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/db-query-builder&quot; rel=&quot;noreferrer&quot;&gt;query&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$rows = (new \craft\db\Query()) &#xA;    -&amp;gt;select(['id', 'email']) &#xA;    -&amp;gt;from('user') &#xA;    -&amp;gt;where(['last_name' =&amp;gt; 'Smith']) &#xA;    -&amp;gt;limit(10)&#xA;     -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-16T18:26:20.460" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25708" PostTypeId="1" CreationDate="2018-04-16T21:16:53.283" Score="1" ViewCount="164" Body="&lt;p&gt;does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the Freeform plugin to send entries from a &quot;Contact Us&quot; form to a CRM that needs to receive the e-mails in utf-8 but they are coming in as ASCII. Is there a way to change this in either the plugin or in Craft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="8228" LastActivityDate="2018-05-17T18:19:31.767" Title="How to send e-mails using utf-8?" Tags="&lt;emails&gt;&lt;plugin-freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25709" PostTypeId="1" AcceptedAnswerId="25711" CreationDate="2018-04-17T06:38:53.293" Score="1" ViewCount="79" Body="&lt;p&gt;I am new to craft and I need help to understand how plugins work.&#xA;I am trying inject these functions to the &lt;code&gt;CraftVariable&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.plugin.exampleFunction(test).hide(&quot;noTitle&quot;) %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.plugin.exampleFunction(test)&lt;/code&gt; is working perfectly &#xA;but &lt;code&gt;.hide()&lt;/code&gt; is not. Can anybody tell me how to call this function?&lt;/p&gt;&#xA;" OwnerUserId="8262" LastEditorUserId="5557" LastEditDate="2018-04-17T07:06:45.590" LastActivityDate="2018-04-17T07:22:24.403" Title="Plugin development Craft CMS 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25710" PostTypeId="2" ParentId="25708" CreationDate="2018-04-17T06:42:43.630" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$message = craft()-&amp;gt;templates-&amp;gt;render('path/to/file/', $someVariables);&#xA;&#xA;$email = new EmailModel();&#xA;&#xA;$email-&amp;gt;fromEmail = $adminEmail;&#xA;$email-&amp;gt;replyTo = $adminEmail;&#xA;$email-&amp;gt;sender = $adminEmail;&#xA;$email-&amp;gt;fromName = craft()-&amp;gt;getSiteName();&#xA;$email-&amp;gt;toEmail = $mail;    &#xA;$email-&amp;gt;subject = $subject;&#xA;$email-&amp;gt;htmlBody = $message;  // &amp;lt;-- this is html and it will be send as utf8&#xA;&#xA;craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-17T06:42:43.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25711" PostTypeId="2" ParentId="25709" CreationDate="2018-04-17T07:22:24.403" Score="3" Body="&lt;p&gt;Based on the discussion you'll need to implement a &lt;code&gt;fetch&lt;/code&gt; function similar like Craft does it with the &lt;code&gt;ElementCriteriaModel&lt;/code&gt; / &lt;code&gt;ElementQuery&lt;/code&gt;. So you'll return some kind of search object until you execute the &lt;code&gt;.find()&lt;/code&gt;/&lt;code&gt;fetch()&lt;/code&gt; (or whatever you like to call it) function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ClassName{&#xA;&#xA;    /** @var array $_searchObjects */&#xA;    private $_searchObjects;&#xA;&#xA;    /**&#xA;     * @param $something&#xA;     *&#xA;     * @return $this&#xA;     */&#xA;    public function exampleFunction($something){&#xA;        $this-&amp;gt;_searchObjects = ['test', 'insert', 'your', 'array', 'here'];&#xA;&#xA;        return $this;&#xA;    }&#xA;&#xA;    /**&#xA;     * @param $string&#xA;     *&#xA;     * @return $this&#xA;     */&#xA;    public function hide($string){&#xA;        // filter your elements&#xA;        $this-&amp;gt;_searchObjects = ...//&#xA;&#xA;        return $this;&#xA;    }&#xA;&#xA;    /**&#xA;     * @return array&#xA;     */&#xA;    public function find(){&#xA;        return $this-&amp;gt;_searchObjects;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use it like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elements = craft.plugin.exampleFunction.find() %}&#xA;{% set filterElements = craft.plugin.exampleFunction.hide('something').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-17T07:22:24.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25712" PostTypeId="2" ParentId="11545" CreationDate="2018-04-17T09:46:17.097" Score="2" Body="&lt;p&gt;I was running into the same issue, struggling with it and it turns out that the official documentation is a bit misleading (no offense) when it comes to the &lt;code&gt;.htaccess&lt;/code&gt; file, because it just mentions to copy it: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can not just copy the &lt;code&gt;.htaccess&lt;/code&gt; but you have to change the &lt;code&gt;RewriteBase&lt;/code&gt; parameter according to your folder structure in the &lt;code&gt;/public&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the &lt;code&gt;.htaccess&lt;/code&gt; file in the &lt;code&gt;/public&lt;/code&gt; folder should start like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /&#xA;&#xA;    (...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within your &lt;code&gt;/public/es&lt;/code&gt; folder you should have the following in the &lt;code&gt;.htaccess&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteBase /es/&#xA;&#xA;    (...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; —&gt; The RewriteBase in the &lt;code&gt;.htaccess&lt;/code&gt; has to be changed according to the folder setup of the locales&lt;/p&gt;&#xA;" OwnerUserId="5948" LastEditorUserId="5948" LastEditDate="2018-04-17T09:53:44.810" LastActivityDate="2018-04-17T09:53:44.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25713" PostTypeId="1" AcceptedAnswerId="25714" CreationDate="2018-04-17T10:18:26.640" Score="1" ViewCount="555" Body="&lt;p&gt;I have a blog setup with a Categories, Archive and Tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my _layout template I've been using the following to pull in SEO titles from fields, or Page/Category Titles is that's not been defined.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% set seoTitle = entry.seoTitle %}&#xA;    {% set seoDescription = entry.seoDescription %}&#xA;    {% set seoImage = entry.seoImage %}&#xA;    {% set seoType = entry.seoType %}&#xA;    {% set title = entry.title %}&#xA;    {% set url = entry.url %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% if category is defined %}&#xA;    {% set seoTitle = category.title %}&#xA;    {% set seoDescription = category.title %}&#xA;    {% set seoImage = category.seoImage %}&#xA;    {% set seoType = category.seoType %}&#xA;    {% set title = category.title %}&#xA;    {% set url = category.url %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;title&amp;gt;{{ siteName }} - {% if seoTitle is not empty %}{{ seoTitle }}{% else %}{{ title }}{% endif %}&amp;lt;/title&amp;gt;&#xA;&amp;lt;meta name=&quot;description&quot; content=&quot;{% if seoDescription is defined %}{{ seoDescription }}{% else %}{{ title }}{% endif %}&quot;/&amp;gt;&#xA;{% if url is defined %}&amp;lt;link rel=&quot;home&quot; href=&quot;{{ url }}&quot; /&amp;gt;{% endif %}&#xA;&amp;lt;meta name=&quot;twitter:card&quot; content=&quot;summary&quot; /&amp;gt;&#xA;{% if url is defined %}&amp;lt;meta property=&quot;og:url&quot; content=&quot;{{ url }}&quot; /&amp;gt;{% endif %}&#xA;&amp;lt;meta property=&quot;og:title&quot; content=&quot;{% if seoTitle is not empty %}{{ seoTitle }}{% else %}{{ title }}{% endif %}&quot; /&amp;gt;&#xA;&amp;lt;meta property=&quot;og:description&quot; content=&quot;{% if seoDescription is defined %}{{ seoDescription }}{% else %}{{ title }}{% endif %}&quot; /&amp;gt;&#xA;{% if seoImage is defined %}&#xA;    {% for image in seoImage %}&#xA;        &amp;lt;meta property=&quot;og:image&quot; content=&quot;{{ image.getUrl()}}&quot; /&amp;gt;&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How should I approach this for the archive and tag pages as simply doing something like the below doesn't work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if tag is defined %}&#xA;{% set seoTitle = tag.title %}&#xA;....&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2018-04-17T17:36:16.440" LastActivityDate="2018-04-17T17:36:16.440" Title="SEO titles/descriptions for tags and archive pages" Tags="&lt;tags&gt;&lt;seo&gt;&lt;layout&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25714" PostTypeId="2" ParentId="25713" CreationDate="2018-04-17T11:19:05.620" Score="5" Body="&lt;p&gt;The better approach in my opinion is to declare the variables in the corresponding templates rather than in the &lt;code&gt;_layout&lt;/code&gt; template&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Layout.twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if seoTitle is not defined or seoTitle is empty %}&#xA;    {% set seoTitle = config.seoTitle %} &amp;lt;-- fallback if nothing is defined&#xA;{% endif %}&#xA;&amp;lt;title&amp;gt;{{ siteName }} - {{ seoTitle }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;_entry.twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout' %}&#xA;{% set seoTitle = entry.seoTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;_category.twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout' %}&#xA;{% set seoTitle = category.seoTitle %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;_someOtherTemplates.twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout' %}&#xA;{% set seoTitle = 'Some hard coded strings....' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and so on. That way you can define &lt;code&gt;seoTags&lt;/code&gt; based on custom properties as well otherwise it would be difficult to determinate tags on dynamic template routes without an entry or a category&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-17T11:19:05.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25715" PostTypeId="1" AcceptedAnswerId="25722" CreationDate="2018-04-17T12:25:35.230" Score="1" ViewCount="95" Body="&lt;p&gt;Well the issue is simple, I have a multi-user backoffice, where they use the same section and entry type to create a new entry.  The problem is when the current user (not the admin) tries to add an entry in the entries field, it display the list of all other users entries, but this is not the case when viewing the section from the dashboard.  The current user (except for the admin who sees all) only sees his own entries. Can I somehow make the entry field display the current user's only list of entries to chose from?&lt;/p&gt;&#xA;" OwnerUserId="6603" LastEditorUserId="57" LastEditDate="2018-04-17T17:39:29.623" LastActivityDate="2018-04-17T17:41:41.653" Title="How to display in the CP only the current user's entries?" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25716" PostTypeId="1" CreationDate="2018-04-17T13:10:00.250" Score="1" ViewCount="285" Body="&lt;p&gt;I'm passing entry fields into a macro and I'd like to be able to get a string of the field handle&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myMacro(entry.field1)&#xA;myMacro(entry.field2)&#xA;&#xA;{% macro myMacro(entry) %}&#xA;  {# I want a string of 'field1' here #}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3614" LastActivityDate="2018-04-17T13:22:42.447" Title="Templating - Get a string of the entry's field handle" Tags="&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25717" PostTypeId="2" ParentId="25716" CreationDate="2018-04-17T13:22:42.447" Score="2" Body="&lt;p&gt;You won't be able to do it that way because &lt;code&gt;entry.field2&lt;/code&gt; will return you the normalized field value and there is no way to trace back some object|string|variable to an unknown entry with an unknown field handle. You need to pass the handle as a second parameter in your macro&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro myMacro(field, fieldHandle) %}&#xA;    {{ fieldHandle }}&#xA;{% endmacro %}&#xA;&#xA;myMacro(entry.field2, 'field2').&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also pass the entry and a field handle instead of the field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro myMacro(element, fieldHandle) %}&#xA;    {{ fieldHandle }}&#xA;    {% set value = element.getFieldValue(fieldHandle) %}&#xA;{% endmacro %}&#xA;&#xA;myMacro(entry, 'field2').&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-17T13:22:42.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25718" PostTypeId="1" CreationDate="2018-04-17T14:32:41.333" Score="1" ViewCount="2474" Body="&lt;p&gt;Using Ampps on Windows, I'm trying to install a fresh Craft 3.0 and I've followed the steps and everything seems to be working. Until the very last step, where Craft says &quot;Oops something went wrong&quot;. Checking the console log I see the ajax call gets a 500 internal server error as response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that the database is getting filled up with tables etc so it seems Craft has a working connection to the database. I also tried to set devmode to True in general.php. When doing that I get the following when trying to access mysite.local/admin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An Error occurred while handling another error:&#xA;yii\web\ServerErrorHttpException: The info table is missing its row in D:\Git\festningen\vendor\craftcms\cms\src\base\ApplicationTrait.php:494&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it a permission error? I can access files and folders in the web directory, and htaccess file looks normal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried setting permissions on the folders, giving the users group full permissions. With no luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastActivityDate="2019-03-28T16:57:50.633" Title="Installing Craft 3 - Internal server error" Tags="&lt;craft3&gt;&lt;error&gt;&lt;install&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25719" PostTypeId="2" ParentId="25718" CreationDate="2018-04-17T14:56:24.383" Score="2" Body="&lt;p&gt;I have had a similar issue when using MAMP on OSX. The &quot;solution&quot; was to switch MAMP to use Module mode (all hosts use the same PHP version) rather than FastCGI mode (where you can run different PHP versions per host).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no clue why, but switching it allows the installation to complete. I am then able to switch it back to Fast CGI mode and everything works (although the issue sometimes occurs when installing/updating plugins).&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-17T14:56:24.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25720" PostTypeId="2" ParentId="25718" CreationDate="2018-04-17T16:03:32.503" Score="1" Body="&lt;p&gt;I managed to get it to work. Seems like it was the &lt;code&gt;max_execution_time&lt;/code&gt; being set to 30 that was way too low... &lt;/p&gt;&#xA;" OwnerUserId="2162" LastActivityDate="2018-04-17T16:03:32.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25721" PostTypeId="2" ParentId="25708" CreationDate="2018-04-17T17:33:02.743" Score="1" Body="&lt;p&gt;Craft 2 uses &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHPMailer&lt;/a&gt; for its email sending library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does have a public &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L47&quot; rel=&quot;nofollow noreferrer&quot;&gt;CharSet&lt;/a&gt; property that Craft &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/services/EmailService.php#L286&quot; rel=&quot;nofollow noreferrer&quot;&gt;explicitly sets&lt;/a&gt; to &lt;code&gt;UTF-8&lt;/code&gt; when sending emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, they have logic that overwrites our &lt;code&gt;UTF-8&lt;/code&gt; value in certain circumstances... namely when no 8-bit characters are involved in the body setting it to &lt;code&gt;us-ascii&lt;/code&gt;: &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2453-L2458&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2453-L2458&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure of a good resolution as this seems like undesired behavior in the PHPMailer library to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, the upcoming Craft 3 has ditched PHPMailer in favor of &lt;a href=&quot;https://swiftmailer.symfony.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Swift Mailer&lt;/a&gt; where it is much more customizable.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-17T17:33:02.743" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25722" PostTypeId="2" ParentId="25715" CreationDate="2018-04-17T17:41:41.653" Score="0" Body="&lt;p&gt;Craft currently doesn't have the concept of &quot;read&quot; permissions for elements (entries, tags, categories, etc.)... technically any user that has access to the Control Panel has read access to every Craft element whether there is a nice UI way to access them or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to comment/vote on this feature request though, which would enable what you're looking for: &lt;a href=&quot;https://github.com/craftcms/cms/issues/887&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/887&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-17T17:41:41.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25723" PostTypeId="1" CreationDate="2018-04-17T19:01:28.410" Score="2" ViewCount="365" Body="&lt;p&gt;Locally in a MAMP environment Craft CMS/Contact Form plugin works great! But for some reason in production on a actual live server on the internet it fails to successfully send any emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is because of the way email is handled by Craft? In Settings &gt; Email, I set the transport type up to Gmail instead of the default Sendmail. But still no luck.&lt;/p&gt;&#xA;" OwnerUserId="7147" LastEditorUserId="57" LastEditDate="2018-04-17T21:20:18.830" LastActivityDate="2018-06-16T22:46:44.000" Title="Craft CMS contact form plugin works locally but not in production?" Tags="&lt;plugins&gt;&lt;craft3&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25724" PostTypeId="1" CreationDate="2018-04-17T20:03:39.227" Score="2" ViewCount="418" Body="&lt;p&gt;I am porting a Shopify &quot;multi-site&quot; to CraftCMS using Commerce and I need to be able to add subscriptions to the shopping cart (customers can subscribe to a monthly box), together with other products. &#xA;Ideally I would have the subscription as a payment variant of a given product, so I can offer the same product for a reduced price if a customer subscribes to it.&#xA;(Single box vs. Monthly box)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone implemented something similar? Any hint or advise on how you'd go for this? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit, just for this question viewers's information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vdTDH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vdTDH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-05-02T07:47:24.703" LastActivityDate="2018-11-23T15:58:59.027" Title="Craft Commerce 2: Adding subscriptions to cart" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25725" PostTypeId="2" ParentId="25613" CreationDate="2018-04-17T20:12:08.010" Score="1" Body="&lt;p&gt;Turns out my issue is because I am running 2 loops through &lt;code&gt;entry.timeline&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A &lt;em&gt;subset&lt;/em&gt; of the field with only &lt;code&gt;subsection&lt;/code&gt; blocks to generate a table of contents&lt;/li&gt;&#xA;&lt;li&gt;The entire field contents with a mixture of both &lt;code&gt;subsection&lt;/code&gt; and &lt;code&gt;item&lt;/code&gt; block types.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Craft 2 was totally OK with me defining a subset and &lt;em&gt;then&lt;/em&gt; looping through the entire set, but with Craft 3, if the subset is defined first, it seems to &lt;strong&gt;persist&lt;/strong&gt; when the second loop runs, even if the scope of the second loop is defined differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my current solution is to have a template structured like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch the entire set first even though it will run second #}&#xA;{% set timelineItems = entry.timeline.all() %}&#xA;&#xA;{# Fetch the subset second even though it will run first #}&#xA;{% set tocItems = entry.timeline.type('subsection').all() %}&#xA;&#xA;{% for item in tocItems %}&#xA;    {# do subsetted ToC stuff #}&#xA;{% endfor %}&#xA;&#xA;{% for row in timelineItems %}&#xA;    {# do entire timeline stuff #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/craftcms/cms/issues/2160&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2160&lt;/a&gt; for more background, and &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#cloning-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;cloning element queries&lt;/a&gt; in the docs.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2018-04-18T08:21:38.583" LastActivityDate="2018-04-18T08:21:38.583" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25726" PostTypeId="2" ParentId="25723" CreationDate="2018-04-17T21:19:49.037" Score="1" Body="&lt;p&gt;There's a support article here you can help use to debug email deliver issues: &lt;a href=&quot;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TL/DR is, use a transaction email provider like Postmark, Mailgun, etc. and make sure you've got DKIM/SPF and DMARC all setup properly as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-17T21:19:49.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25727" PostTypeId="1" CreationDate="2018-04-18T09:25:20.270" Score="1" ViewCount="4242" Body="&lt;p&gt;Im trying to put my  code in a included theme.js file. It wont recognize my variables anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working in .rain file within the html code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;  jQuery(document).ready(function(){&#xA;    var uspicon1 = &quot;{{ theme.usp_1_icon }}&quot;;&#xA;    var uspicon2 = &quot;{{ theme.usp_2_icon }}&quot;;&#xA;    var uspicon3 = &quot;{{ theme.usp_3_icon }}&quot;;&#xA;    var uspicon4 = &quot;{{ theme.usp_4_icon }}&quot;;&#xA;    jQuery('.icon1').addClass(uspicon1);&#xA;    jQuery('.icon2').addClass(uspicon2);  &#xA;    jQuery('.icon3').addClass(uspicon3);  &#xA;    jQuery('.icon4').addClass(uspicon4); &#xA;  });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not working with an include .js file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  jQuery(document).ready(function(){&#xA;    var uspicon1 = &quot;{{ theme.usp_1_icon }}&quot;;&#xA;    var uspicon2 = &quot;{{ theme.usp_2_icon }}&quot;;&#xA;    var uspicon3 = &quot;{{ theme.usp_3_icon }}&quot;;&#xA;    var uspicon4 = &quot;{{ theme.usp_4_icon }}&quot;;&#xA;    jQuery('.icon1').addClass(uspicon1);&#xA;    jQuery('.icon2').addClass(uspicon2);  &#xA;    jQuery('.icon3').addClass(uspicon3);  &#xA;    jQuery('.icon4').addClass(uspicon4); &#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Practicly the same without the script tags. I tested a console.log() and it works fine. I'm guessing it wont recognize my {{ variables }} in .js file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody know what the syntax is?&lt;/p&gt;&#xA;" OwnerUserId="8266" LastActivityDate="2018-04-18T09:34:38.433" Title="Twig variables wont work in an include js file?" Tags="&lt;templating&gt;&lt;variable&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25728" PostTypeId="2" ParentId="25727" CreationDate="2018-04-18T09:34:38.433" Score="4" Body="&lt;p&gt;There is no &quot;syntax&quot; for it since you don't parse these files with PHP.&#xA;You'll have to declare your variables inside a twig file&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;First Approach&lt;/h1&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    var myVariable = {{ theme|json_encode|raw }}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Javascript&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(document).ready(function(){&#xA;    var uspicon1 = myVariable.usp_1_icon;&#xA;    var uspicon2 = myVariable.usp_2_icon;&#xA;    var uspicon3 = myVariable.usp_3_icon;&#xA;    var uspicon4 = myVariable.usp_4_icon;&#xA;    jQuery('.icon1').addClass(uspicon1);&#xA;    jQuery('.icon2').addClass(uspicon2);  &#xA;    jQuery('.icon3').addClass(uspicon3);  &#xA;    jQuery('.icon4').addClass(uspicon4); &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Second Approach&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Or you move your Javascript inside a Twig file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% js %}&#xA;jQuery(document).ready(function(){&#xA;    var uspicon1 = &quot;{{ theme.usp_1_icon }}&quot;;&#xA;    var uspicon2 = &quot;{{ theme.usp_2_icon }}&quot;;&#xA;    var uspicon3 = &quot;{{ theme.usp_3_icon }}&quot;;&#xA;    var uspicon4 = &quot;{{ theme.usp_4_icon }}&quot;;&#xA;    jQuery('.icon1').addClass(uspicon1);&#xA;    jQuery('.icon2').addClass(uspicon2);&#xA;    jQuery('.icon3').addClass(uspicon3);&#xA;    jQuery('.icon4').addClass(uspicon4);&#xA;});&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can as well attach the attributes in your html - that makes it much easier&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Third Approach&lt;/h1&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;icon4&quot; data-icon=&quot;{{theme.usp_4_icon}}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Javascript&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var element = jQuery('.icon4')&#xA;element.addClass(element.data('class'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-18T09:34:38.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25729" PostTypeId="1" CreationDate="2018-04-18T10:20:33.490" Score="1" ViewCount="137" Body="&lt;p&gt;As the official documentation does not give any hints on this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering &lt;strong&gt;how to serve the correct localization of my website according to the user’s language preference and/or browser/OS language&lt;/strong&gt; with Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From other platforms/plugins I know that this is done through user agent detection, e.g. if the browser/OS is English you’ll get the EN, if it’s Spanish you’ll get the ES version of the content, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The project I am working on has DE as the primary locale and the language switcher shall only appear subtly within the footer. Non-German visitors should automatically get the EN version without having to interact with any interface element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I implement this?&lt;/p&gt;&#xA;" OwnerUserId="5948" LastActivityDate="2018-04-18T14:37:39.107" Title="Craft 2: Serve language / locale i18n according to user agent" Tags="&lt;localization&gt;&lt;language&gt;&lt;switch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25731" PostTypeId="1" AcceptedAnswerId="25734" CreationDate="2018-04-18T13:43:20.343" Score="2" ViewCount="1035" Body="&lt;p&gt;Instead of a standard 404 error page, I want to send 404s to the homepage and can't seem to get this working right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add &lt;code&gt;{% redirect '/' %}&lt;/code&gt; in my 404.html template, that works except it gives a 302 found code instead of a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change it to &lt;code&gt;{% redirect '/' 404 %}&lt;/code&gt; I get the correct 404 code but just a white screen instead of the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried adding &lt;code&gt;ErrorDocument 404 /&lt;/code&gt; to the .htaccess file, but that doesn't take effect as I think the Craft 404 mechanism overrides that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? Thanks. &lt;/p&gt;&#xA;" OwnerUserId="135" LastActivityDate="2018-04-18T14:33:33.543" Title="How to show homepage for 404 errors" Tags="&lt;redirect&gt;&lt;404&gt;&lt;404-page&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25732" PostTypeId="2" ParentId="13836" CreationDate="2018-04-18T13:45:22.107" Score="1" Body="&lt;p&gt;I came here for the same reason as @Plasticated. Please mention, that there's also a release of the Entries Subset plugin (as suggested by @André) for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see Github: &lt;a href=&quot;https://github.com/nfourtythree/craft3-entriessubset&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries Subset plugin for Craft CMS 3.x&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT:&lt;/em&gt;&lt;br&gt;&#xA;I recently tried to &lt;code&gt;composer require&lt;/code&gt; the plugin as stated in the README file which resulted in an error. Instead don't use Composer to install that plugin as documented currently. You have to buy it using Craft's new plugin store. I already created an &lt;a href=&quot;https://github.com/nfourtythree/craft3-entriessubset/issues/4&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue for fixing the README&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT 2:&lt;/em&gt;&lt;br&gt;&#xA;Alright, the author has added his plugin to Packagist, therefore the installation will work without hazzle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long story, short&lt;/strong&gt;&lt;br&gt;&#xA;Try using &lt;a href=&quot;https://github.com/nfourtythree/craft3-entriessubset&quot; rel=&quot;nofollow noreferrer&quot;&gt;the plugin&lt;/a&gt;. You can install it using Composer:&lt;br&gt;&#xA;&lt;code&gt;composer require nfourtythree/entriessubset&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3792" LastEditorUserId="3792" LastEditDate="2018-04-19T11:50:16.483" LastActivityDate="2018-04-19T11:50:16.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25733" PostTypeId="1" CreationDate="2018-04-18T14:07:00.093" Score="1" ViewCount="702" Body="&lt;p&gt;I am use a load more button in place of pagination. I just using jquery and ajax using this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18167/show-more-entries-on-click&quot;&gt;post&lt;/a&gt; as a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is how to hide the button when there is no more posts to show. I thought I could do this with pagination but its not working out.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my blog index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% paginate craft.entries.section('blog').limit(2) as pageInfo, blogEntries %}&#xA;&#xA;        &amp;lt;div id=&quot;post-output&quot;&amp;gt;&#xA;&#xA;            {% for entry in blogEntries %}&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% if pageInfo.nextUrl %}&#xA;&#xA;            &amp;lt;button id=&quot;more-button&quot; data-page=&quot;{{craft.request.getPageNum()}}&quot; data-batch=&quot;2&quot;&amp;gt;Load More&amp;lt;/button&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import $ from 'jquery';&#xA;&#xA;$(&quot;#more-button&quot;).on('click', function () {&#xA;var btn = $(this),&#xA;    page = btn.data('page'),&#xA;    batch = btn.data('batch'),&#xA;    offset = page * batch,&#xA;    newPage = page + 1;&#xA;&#xA;loadPosts(offset, batch);&#xA;// set the buttons page attribute to the new page it is on.&#xA;btn.data('page',newPage);&#xA;&#xA;console.log('page');&#xA;console.log(newPage);&#xA;});&#xA;&#xA;function loadPosts (offset, limit) {&#xA;$.get('/ajax/posts', { offset:offset, limit:limit }, function (data) {&#xA;    var postOutput = $('#post-output');&#xA;    postOutput.append(data);&#xA;});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is the ajax/_posts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set offset = craft.app.request.getParam('offset') %}&#xA;{% set limit = craft.app.request.getParam('limit') %}&#xA;{% set moreitems = craft.entries.section('blog').limit(limit).offset(offset).all() %}&#xA;&#xA;{% for entry in moreitems %}&#xA;&amp;lt;article&amp;gt;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-07-18T17:57:54.710" Title="When to hide show more button" Tags="&lt;ajax&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25734" PostTypeId="2" ParentId="25731" CreationDate="2018-04-18T14:33:33.543" Score="4" Body="&lt;p&gt;&lt;code&gt;404&lt;/code&gt; isn’t a valid redirect status code, which is why &lt;code&gt;{% redirect '/' 404 %}&lt;/code&gt; isn’t working correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you want to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first issue a 301 or 302 redirect to the homepage&lt;/li&gt;&#xA;&lt;li&gt;then serve the homepage, but with a 404 status&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I’m understanding you correctly, even if you could pull it off (maybe doable with a query string or something stored on the session), that would be bad for a couple reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the actual not-found resource is returning the wrong status code (301/302 instead of 404)&lt;/li&gt;&#xA;&lt;li&gt;now the homepage (a valid resource) is also returning the wrong status code (404 instead of 200)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The biggest issue is the 2nd one, as it would have devastating SEO consequences. Any time Google hits a missing resource and is redirected back to the homepage, it will start remembering that your homepage doesn’t exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better solution would be to keep the URL pointed at the missing resource (so no redirect response), but to just render your homepage via the 404 template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should be as simple as creating a &lt;code&gt;404.html&lt;/code&gt; template with this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% include &quot;index&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or whatever your actual homepage template is called.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a Homepage Single section, you may need to pass that in as well:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% include &quot;index&quot; with {&#xA;    entry: craft.entries.section('homepage').one()&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(replace &lt;code&gt;.one()&lt;/code&gt; with &lt;code&gt;.first()&lt;/code&gt; if this is for Craft 2.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-04-18T14:33:33.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25735" PostTypeId="2" ParentId="25729" CreationDate="2018-04-18T14:37:39.107" Score="2" Body="&lt;p&gt;You could accomplish this before your PHP is executed as redirects listening for the accept_language header (&lt;em&gt;both are untested from my part&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;APACHE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine on&#xA;RewriteCond %{HTTP:Accept-Language} (de) [NC]&#xA;RewriteRule .* http://example.com/de/ [R,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NGINX&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;map $http_accept_language $lang {&#xA;  default en;&#xA;  ~de de;&#xA;}&#xA;&#xA;location ~* &quot;/&quot; {&#xA;  return 302 https://example.com/$lang;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2018-04-18T14:37:39.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25736" PostTypeId="1" AcceptedAnswerId="25737" CreationDate="2018-04-18T14:55:47.490" Score="3" ViewCount="1105" Body="&lt;p&gt;I was wondering what people who are developing on Windows 10 are using as webserver environment in 2018? I have had ok results previously using ampps, but I'm having a lot of problems with Craft 3 as of lately. With 500 internal server errors etc. Also, I'm developing on several PCs, syncing the projects with Git.&lt;/p&gt;&#xA;&lt;p&gt;A friend of mine recommended Laravel Valet and homestead, but he's on Mac. And installation on Windows seems to be a lot trickier. I've tried Mamp too, but have really bad experience with that one.&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="5193" LastEditDate="2021-01-19T20:46:05.473" LastActivityDate="2021-03-02T19:37:12.567" Title="Craft 3 - Recommended development environment for Windows?" Tags="&lt;craft3&gt;&lt;server&gt;&lt;environments&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25737" PostTypeId="2" ParentId="25736" CreationDate="2018-04-18T15:34:04.897" Score="1" Body="&lt;p&gt;First of all, I am also a Mac user. But these should be available for Windows too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start reading about virtualization. So, you won't install the web server directly on your machine but on a virtual box installed on your machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good starting point could be &lt;a href=&quot;https://www.vagrantup.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;vagrant&lt;/a&gt; (which is becoming a bit antiquated more and more, but which is still worth a try since it's working like a charm).&lt;br&gt;&#xA;What's getting more and more into many developers' focus is &lt;a href=&quot;https://www.docker.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;docker&lt;/a&gt;. Many of my customers have been introducing it in their developer teams the last years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. It's a lot to read though… &lt;/p&gt;&#xA;" OwnerUserId="3792" LastActivityDate="2018-04-18T15:34:04.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25738" PostTypeId="1" CreationDate="2018-04-18T16:37:06.353" Score="0" ViewCount="26" Body="&lt;p&gt;I am looking at setting the currency of a guest site visitor. I have the look up and currency retrieval working OK based on the individuals IP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem i seem to face is how to cache the currency per site visitor and not set it for the whole site/all visitors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A dump of craft-&gt;session shows no unique guest ids available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should i set a cookie for current user (IP address) and compare with cached IP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any slaps around the head welcome :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-04-18T16:37:06.353" Title="How to cache location per guest in craft cache via plugin" Tags="&lt;cache&gt;&lt;cookies&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25739" PostTypeId="1" AcceptedAnswerId="25744" CreationDate="2018-04-18T19:03:36.270" Score="4" ViewCount="1164" Body="&lt;p&gt;Looking for the solution to searching entries in one section that are related to multiple categories and match number field criteria. This is for a used auto website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Categories:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Make/Model/Trim:&lt;/strong&gt; Nested category levels for better searching a leveling of vehicles. Category example: Chevrolet -&gt; Malibu -&gt; LS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Transmission:&lt;/strong&gt; Automatic and Manual&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Class:&lt;/strong&gt; Coupe, Sedan, SUV, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fields:&lt;/strong&gt;&#xA;Price - number field with up to 2 decimal places.&#xA;Year - 4 digit number no punctuation or decimal places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The search bar fields:&lt;/strong&gt;&#xA;Make&#xA;Model&#xA;Transmission&#xA;Class&#xA;Minimum Year&#xA;Maximum Year&#xA;Minimum Price&#xA;Maximum Price&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current search form submits a url such as:&#xA;&lt;a href=&quot;http://examplesite.com/search?make=chevrolet&amp;amp;model=malibu&amp;amp;transmission=automatic&amp;amp;min-year=2007&amp;amp;max-year=2017&amp;amp;min-price=3000&amp;amp;max-price=20000&amp;amp;class=sedan&quot; rel=&quot;noreferrer&quot;&gt;http://examplesite.com/search?make=chevrolet&amp;amp;model=malibu&amp;amp;transmission=automatic&amp;amp;min-year=2007&amp;amp;max-year=2017&amp;amp;min-price=3000&amp;amp;max-price=20000&amp;amp;class=sedan&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether or not a search field was used it still applies at empty field to the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read every Craft CMS Multi search page and SO question on this as well as the new Craft CMS 3 documentation. I can't seem to find solution to the categories part first off and then a decent way to handle the number criteria. Also, I am planning on paginating the entries (causes a separate issue of not being able to use loop.last, which I can solve with some loop counters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current search page code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set make = craft.app.request.getParam('make') %}&#xA;{% set model = craft.app.request.getParam('model') %}&#xA;{% set transmission = craft.app.request.getParam('transmission') %}&#xA;{% set class = craft.app.request.getParam('class') %}&#xA;&#xA;{% set minYear = craft.app.request.getParam('min-year') %}&#xA;{% set maxYear = craft.app.request.getParam('max-year') %}&#xA;{% set minPrice = craft.app.request.getParam('min-price') %}&#xA;{% set maxPrice = craft.app.request.getParam('max-price') %}&#xA;&#xA;{% set makeCat = make ? craft.categories.group('makeModelTrim').slug(make).find() %}&#xA;{% set modelCat = model ? craft.categories.group('makeModelTrim').slug(model).find() %}&#xA;{% set transmissionCat = transmission ? craft.categories.group('transmission').slug(transmission).find() %}&#xA;{% set classCat = class ? craft.categories.group('class').slug(class).find() %}&#xA;&#xA;{% set makeParam = makeCat ? {targetElement: ['and']|merge(makeCat)} %}&#xA;{% set modelParam = modelCat ? {targetElement: ['and']|merge(modelCat)} %}&#xA;{% set transmissionParam = transmissionCat ? {targetElement: ['and']|merge(transmissionCat)} %}&#xA;{% set classParam = classCat ? {targetElement: ['and']|merge(classCat)} %}&#xA;&#xA;{% set relationParams = [makeParam, modelParam, transmissionParam, classParam]|filter %}&#xA;&#xA;{% set entries = craft.entries({section: 'vehicles',relatedTo: relationParams ? ['and']|merge(relationParams) : null}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works but is kinda wonky. I would like the related entries to match all of the given categories but it currently pulls vehicles that match any of the categories. If Chevrolet and Automatic transmission are given criteria, both Chevrolets and Automatics are pulled which is not what I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to add the min/max year and price to the related to parameters? If so then that would solve the next issue of sorting through the entries though it's difficult to paginate the entries if I have to throw out some retrieved ones after the fact. When I try to convert the set entries to paginate with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({section: 'vehicles',relatedTo: relationParams ? ['and']|merge(relationParams) : null}).limit(12) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem to work though I can get the count of pageEntries and it will return some number. But what I'm currently doing is the former setting of the entries to the related parameters then running this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for vehicle in pageEntries if minYear|length and minYear &amp;lt;= vehicle.year and maxYear|length and maxYear &amp;gt;= vehicle.year and minPrice|length and minPrice &amp;lt;= vehicle.price and maxPrice|length and maxPrice &amp;gt;= vehicle.price %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which doesn't work. I'm guessing that my if statements aren't in order or can't be used that way. I could have a complicated if/else or case scenario to handle whether min/max price and year have been set rather than checking it in the for loop, though I'm not certain what's best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure someone reading this has a simple solution to multi category and multi field entry searching. And if it's possible to eliminate the the empty parameters in the url, that would be helpful as well. I currently have empty options with no values set holding the place of the select drop-downs until a value is selected.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-11-06T00:50:09.587" Title="Craft 3 Multi Category and Field Search" Tags="&lt;entries&gt;&lt;categories&gt;&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25741" PostTypeId="1" CreationDate="2018-04-18T22:49:29.517" Score="0" ViewCount="25" Body="&lt;p&gt;Require a little help with removing the pre-parsed text from Dukt's &lt;code&gt;{{ twitterTweetButton() }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;  {{ twitterTweetButton({&#xA;                        text: &quot;some text&quot;,&#xA;                        target: &quot;_blank&quot;&#xA;                    }) }}&quot;&amp;gt;&amp;lt;i class=&quot;fa fa-twitter&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not work....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs specify the following Twig functions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;text&lt;/code&gt; — Pre-populated text highlighted in the Tweet composer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;url&lt;/code&gt; — URL included with the Tweet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;hashtags&lt;/code&gt; — A comma-separated list of hashtags to be appended to&#xA;default Tweet text.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;via&lt;/code&gt; — Attribute the source of a Tweet to a Twitter username.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;related&lt;/code&gt; — A comma-separated list of accounts related to the content&#xA;of the shared URI.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;size&lt;/code&gt; — Set to large to display a larger button.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;lang&lt;/code&gt; — A supported Twitter language code. Loads text components in&#xA;the specified language. Note: does not affect the text of the cited&#xA;Tweet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;dnt&lt;/code&gt; — When set to true, the Tweet and its embedded page do not&#xA;influence Twitter targeting including suggested accounts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2018-04-19T00:07:16.070" LastActivityDate="2018-04-19T00:07:16.070" Title="Tweaking the Tweet Follow Button" Tags="&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25742" PostTypeId="2" ParentId="25741" CreationDate="2018-04-18T23:24:24.727" Score="1" Body="&lt;p&gt;This is what the function currently does&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function tweetButton($options = [])&#xA;{&#xA;    $dataAttributes = $this-&amp;gt;getOptionsAsDataAttributes($options);&#xA;&#xA;    $html = '&amp;lt;a class=&quot;twitter-share-button&quot; href=&quot;https://twitter.com/share&quot;'.$dataAttributes.'&amp;gt;Tweet&amp;lt;/a&amp;gt;';&#xA;&#xA;    return $html;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it returns an &lt;code&gt;a&lt;/code&gt; tag rather than a link. You should remove your outer tag but you can't place your custom text. You would have to use a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/replace.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;string replace function&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ twitterTweetButton()|replace({'&amp;gt;Tweet&amp;lt;':' &amp;gt;my custom text&amp;lt;' }) }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-18T23:29:38.843" LastActivityDate="2018-04-18T23:29:38.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25743" PostTypeId="1" CreationDate="2018-04-19T00:44:11.253" Score="1" ViewCount="80" Body="&lt;p&gt;Here's the breakdown:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;» &lt;code&gt;structure&lt;/code&gt; with two &lt;code&gt;categories&lt;/code&gt;. Each category has +10 entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;» Template is &lt;code&gt;structure&lt;/code&gt; / &lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;_entryview.html&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to show two links and a description of both categories on the &lt;code&gt;/structure/&lt;/code&gt; URL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the &lt;code&gt;/structure/index/&lt;/code&gt; page, I'd like to show the &lt;code&gt;entries&lt;/code&gt; for each category — all using the same &lt;code&gt;index&lt;/code&gt; template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I can pull the &lt;code&gt;{category.title}&lt;/code&gt;s and the &lt;code&gt;{entry.title}&lt;/code&gt; ... but it's the same on both pages (&lt;code&gt;structure/&lt;/code&gt; and &lt;code&gt;structure/category&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('fellowsCat') %}&#xA;&#xA; &amp;lt;ul&amp;gt;&#xA;  {% nav category in craft.categories&#xA;    .group('fellowsCat')&#xA;    .limit(11)&#xA;    %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt; &#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;{% set entries = craft.entries({&#xA;  section:  'fellows',&#xA;  relatedTo:  craft.categories('fellowsCat'),&#xA;})&#xA;%}&#xA;&#xA;&#xA;{# ___________________________&#xA;this is where things fall apart. &#xA;If I'm on /structure/ I don't want to see entries. &#xA;If I'm on /structure/category, I do. &#xA;_____________________________&#xA;#}&#xA;&#xA;&#xA;{% if craft.categories is not null %}&#xA;&#xA;  {% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;  &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;&#xA;{% else %}&#xA;nothing to see&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suspect there's something with the &lt;code&gt;{% if craft.categories is not null %}&lt;/code&gt; line that would do the job, but I can't figure it out. &lt;/p&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-07-18T19:58:46.673" Title="How to hide {{ entry.title }} on a {structure} page but show it on a {structure}/{category-slug} page" Tags="&lt;templating&gt;&lt;entry&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25744" PostTypeId="2" ParentId="25739" CreationDate="2018-04-19T03:06:11.270" Score="7" Body="&lt;p&gt;Solved this by merging the search parameters together for both the multiple categories and the number fields if they were set in the url parameters. This solves the loop.last pagination problem as well. Here is the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# set base params #}&#xA;{% set params = {&#xA;    section: 'vehicles',&#xA;    limit: null&#xA;} %}&#xA;{% set relatedParams = ['and'] %}&#xA;&#xA;{# add category parameters if they exist #}&#xA;{% if craft.app.request.getParam('make') %}&#xA;    {% set category = craft.categories.group('makeModel').slug(craft.app.request.getParam('make')).one() %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:category }]) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('model') %}&#xA;    {% set category = craft.categories.group('makeModel').slug(craft.app.request.getParam('model')).one() %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:category }]) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('transmission') %}&#xA;    {% set category = craft.categories.group('transmission').slug(craft.app.request.getParam('transmission')).one() %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:category }]) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('body') %}&#xA;    {% set category = craft.categories.group('class').slug(craft.app.request.getParam('body')).one() %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement:category }]) %}&#xA;{% endif %}&#xA;&#xA;{# add number fields with greater/lesser than comparisons #}&#xA;{% if craft.app.request.getParam('min-year') %}&#xA;    {% set minYear = craft.app.request.getParam('min-year') %}&#xA;    {% set params = params|merge({'year':'&amp;gt;=' ~ minYear}) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('max-year') %}&#xA;    {% set maxYear = craft.app.request.getParam('max-year') %}&#xA;    {% set params = params|merge({'year':'&amp;lt;=' ~ maxYear}) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('min-price') %}&#xA;    {% set minPrice = craft.app.request.getParam('min-price') %}&#xA;    {% set params = params|merge({'price':'&amp;gt;=' ~ minPrice}) %}&#xA;{% endif %}&#xA;{% if craft.app.request.getParam('max-price') %}&#xA;    {% set maxPrice = craft.app.request.getParam('max-price') %}&#xA;    {% set params = params|merge({'price':'&amp;lt;=' ~ maxPrice}) %}&#xA;{% endif %}&#xA;&#xA;{# add relatedParams to params #}&#xA;{% if relatedParams|length &amp;gt; 1 %}&#xA;    {% set params = params|merge({'relatedTo':relatedParams}) %}&#xA;{% endif %}&#xA;&#xA;{# perform search #}&#xA;{% paginate craft.entries(params).limit(12) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe all the code is Craft 3 compliant as well. Searching looks for all parameters to be met so this works well for product searches.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-04-19T03:06:11.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25745" PostTypeId="1" AcceptedAnswerId="25747" CreationDate="2018-04-19T04:22:12.070" Score="3" ViewCount="184" Body="&lt;p&gt;We have a Craft Pro (Craft CMS 2.6.3004) website that has a number of aliases on the URL. For the purpose of this the main URL is awesome.zone which has an alias of myawesomesite.com. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently it has started showing the &quot;The license location at config/license.key belongs to myawesomesite.com&quot; when logged into the admin panel of awesome.zone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xrbgK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xrbgK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evidently it was registered on the Alias initially, so I went to transfer the domain, but Craft won't do it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft is unable to transfer your license to this domain at this time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What's changed recently that my license is suddenly complaining (but has been fine for 2 years) and how do I fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-04-19T04:47:45.167" Title="Craft is unable to transfer your license to this domain at this time" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25746" PostTypeId="2" ParentId="13531" CreationDate="2018-04-19T04:38:15.340" Score="1" Body="&lt;p&gt;I came across this question in a search while trying to access Imager in an Element API transformer function in Craft 3. Things have changed a bit so I thought I would post some details in case anyone else is trying to do the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing, you need to make Imager available to your Element API functions like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use aelvan\imager\variables\ImagerVariable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, within your transformer, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(Entry $entry) {&#xA;    $imager = new ImagerVariable();&#xA;    $photos = [];&#xA;&#xA;    foreach ($entry-&amp;gt;thumbnailImage.all() as $image) {&#xA;        $imageOptions = array(&#xA;            'width' =&amp;gt; 300,&#xA;            'height' =&amp;gt; 300,&#xA;            'mode' =&amp;gt; 'crop',&#xA;            'position' =&amp;gt;  $image-&amp;gt;getFocalPoint(),&#xA;        );&#xA;&#xA;        $transformedImage = $imager-&amp;gt;transformImage($image, $imageOptions);&#xA;        $photos[] = $transformedImage-&amp;gt;getUrl();&#xA;    }&#xA;&#xA;    return [&#xA;        'id' =&amp;gt; $entry-&amp;gt;id,&#xA;        'thumbnail' =&amp;gt; $photos&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="57" LastEditDate="2018-04-19T04:50:02.177" LastActivityDate="2018-04-19T04:50:02.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25747" PostTypeId="2" ParentId="25745" CreationDate="2018-04-19T04:47:45.167" Score="2" Body="&lt;p&gt;With the launch of &lt;a href=&quot;https://craftcms.com/news/introducing-craft-id&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft ID&lt;/a&gt;, you can no longer transfer a license to a new domain directly from a Craft installation.  You can create a Craft ID account and from there, you can manage all of your Craft licenses, orders and download order receipts for previous orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will also allow you to transfer the licenses that you own to other domains.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-19T04:47:45.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25748" PostTypeId="1" AcceptedAnswerId="25769" CreationDate="2018-04-19T08:45:54.243" Score="2" ViewCount="1068" Body="&lt;p&gt;I am based in the UK Where we format dates for 17th May 2018 like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;17/5/18&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible for the Craft Control Panel to use a specified format when listing entries' post date / expiry date etc?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2020-02-07T09:30:52.670" Title="Control Panel Date Format" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25749" PostTypeId="1" AcceptedAnswerId="25750" CreationDate="2018-04-19T08:47:56.283" Score="1" ViewCount="162" Body="&lt;p&gt;I'm trying to call an action from my main class in Craft 3. This is working fine with my services like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AbandonedCart::$plugin-&amp;gt;serviceExample-&amp;gt;serviceMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried to do something similar for my action but it doesn't work and I can't find any solution to it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AbandonedCart::$plugin-&amp;gt;actionExample-&amp;gt;actionFunction();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;Sam&lt;/p&gt;&#xA;" OwnerUserId="8224" LastActivityDate="2018-04-19T08:56:53.660" Title="Calling action from main class init()" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25750" PostTypeId="2" ParentId="25749" CreationDate="2018-04-19T08:56:53.660" Score="1" Body="&lt;p&gt;You need to call your &lt;code&gt;setComponents&lt;/code&gt; function before you are trying to access your components otherwise - logically - they are not defined&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    self::$plugin = $this;&#xA;&#xA;    // define the components / services&#xA;    $this-&amp;gt;setComponents(&#xA;        [&#xA;            'serviceExample' =&amp;gt; ServiceExample::class&#xA;        ];&#xA;    );&#xA;&#xA;    // access them&#xA;    $this-&amp;gt;serviceExample-&amp;gt;serviceMethod();&#xA;    // if it's easier for you to remember you can as well use the longer/slower syntax&#xA;    AbandonedCart::$plugin-&amp;gt;serviceExample-&amp;gt;serviceMethod();&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-19T08:56:53.660" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25751" PostTypeId="1" CreationDate="2018-04-19T09:08:05.407" Score="2" ViewCount="58" Body="&lt;p&gt;Good day!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;strong&gt;Craft CMS 3&lt;/strong&gt;, I'm tring to configure the replacement of tags for markdown via replace, everything works except for the tag &lt;code&gt;{{ loop.index }}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please tell me how to properly configure to work correctly &lt;code&gt;{{ loop.index }}&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.markdownContent|markdown&#xA;&#xA; |replace('&amp;lt;p&amp;gt;', '&amp;lt;p class=&quot;section__paragraph text&quot;&amp;gt;')&#xA; |replace('&amp;lt;h2&amp;gt;', '&amp;lt;h2 class=&quot;section__title title&quot;&amp;gt;')&#xA; |replace('&amp;lt;a ', '&amp;lt;a class=&quot;link link-color&quot;')&#xA; |replace('&amp;lt;ul&amp;gt;', '&amp;lt;ul class=&quot;attention&quot;&amp;gt;')&#xA; |replace('&amp;lt;li&amp;gt;', '&amp;lt;li class=&quot;attention__item&quot;&amp;gt;&amp;lt;p class=&quot;attention__text&quot;&amp;gt;')&#xA; |replace('&amp;lt;/li&amp;gt; ', '&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;')&#xA; |replace('&amp;lt;ol&amp;gt;', '&amp;lt;ol class=&quot;remark list&quot;&amp;gt;')&#xA; |replace('&amp;lt;li&amp;gt;', '&amp;lt;li class=&quot;remark__item item&quot;&amp;gt;&amp;lt;p class=&quot;remark__text&quot;&amp;gt;&amp;lt;span class=&quot;remark__label&quot;&amp;gt;{{ loop.index }}&amp;lt;/span&amp;gt;')&#xA; |replace('&amp;lt;/li&amp;gt; ', '&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;')|raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can you advise other ways of realizing this task.&lt;/p&gt;&#xA;" OwnerUserId="8271" LastEditorUserId="57" LastEditDate="2018-04-19T17:50:56.903" LastActivityDate="2018-04-19T17:50:56.903" Title="Why does loop.index not work with replace?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25752" PostTypeId="2" ParentId="25751" CreationDate="2018-04-19T09:21:37.930" Score="2" Body="&lt;p&gt;Twig output tags won't work inside of Twig output tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be using &lt;code&gt;'&amp;lt;li class=&quot;remark__item item&quot;&amp;gt;&amp;lt;p class=&quot;remark__text&quot;&amp;gt;&amp;lt;span class=&quot;remark__label&quot;&amp;gt;'~loop.index~'&amp;lt;/span&amp;gt;'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overall approach seems a bit heavy-handed though.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-04-19T09:21:37.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25753" PostTypeId="2" ParentId="25751" CreationDate="2018-04-19T09:21:44.943" Score="2" Body="&lt;p&gt;You are using &lt;code&gt;{{ ... }}&lt;/code&gt; echo syntax within &lt;code&gt;{{ ... }}&lt;/code&gt; to return a variable. Use string concatenation instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'&amp;lt;span class=&quot;remark__label&quot;&amp;gt;' ~ loop.index ~ '&amp;lt;/span&amp;gt;'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-04-19T09:21:44.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25754" PostTypeId="1" CreationDate="2018-04-19T10:21:23.873" Score="0" ViewCount="103" Body="&lt;p&gt;Prompt please both in the field {{ block.markdownContent|markdown|raw }} replace and add classes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt; replace by: &amp;lt;p class=&quot;section__paragraph text&quot;&amp;gt;&#xA;&amp;lt;h2&amp;gt; replace by:      &amp;lt;h2 class=&quot;section__title title&quot;&amp;gt;&#xA;&amp;lt;ul&amp;gt; replace by:      &amp;lt;ul class=&quot;attention&quot;&amp;gt;&#xA;&amp;lt;li&amp;gt; replace by:      &amp;lt;li class=&quot;attention__item&quot;&amp;gt; and add within the tag &amp;lt;li class=&quot;attention__item&quot;&amp;gt; тег &amp;lt;p class=&quot;attention__text&quot;&amp;gt;&#xA;&#xA;Provided that the listed list of &amp;lt;ol&amp;gt; is to be replaced:&#xA;&amp;lt;ol&amp;gt; replace by:     &amp;lt;ul class=&quot;remark list&quot;&amp;gt;&#xA;&amp;lt;li&amp;gt; replace by:     &amp;lt;li class=&quot;remark__item item&quot;&amp;gt;&#xA;add:&#xA;&amp;lt;p class=&quot;remark__text&quot;&amp;gt;&amp;lt;span class=&quot;remark__label&quot;&amp;gt;1&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Html code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Numbered list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;section&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;section__wr&quot;&amp;gt;&#xA;            &amp;lt;h2 class=&quot;section__title title&quot;&amp;gt;Simple text&amp;lt;/h2&amp;gt;&#xA;&#xA;            &amp;lt;ul class=&quot;remark list&quot;&amp;gt;&#xA;                &amp;lt;li class=&quot;remark__item item&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;remark__label&quot;&amp;gt;1&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;p class=&quot;remark__text text&quot;&amp;gt;Simple text&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;                &amp;lt;li class=&quot;remark__item item&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;remark__label&quot;&amp;gt;2&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;p class=&quot;remark__text text&quot;&amp;gt;Simple text&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simple list:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;section&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;section__wr&quot;&amp;gt;&#xA;            &amp;lt;h2 class=&quot;section__title title&quot;&amp;gt;Simple text&amp;lt;/h2&amp;gt;&#xA;&#xA;            &amp;lt;ul class=&quot;attention&quot;&amp;gt;&#xA;                &amp;lt;li class=&quot;attention__item&quot;&amp;gt;&#xA;                    &amp;lt;p class=&quot;attention__text&quot;&amp;gt;Simple text&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;                &amp;lt;li class=&quot;attention__item&quot;&amp;gt;&#xA;                    &amp;lt;p class=&quot;attention__text&quot;&amp;gt;Simple text&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rUJhR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rUJhR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8271" LastActivityDate="2018-04-20T08:35:51.297" Title="How can I add and replace classes in the markdown field?" Tags="&lt;templating&gt;&lt;replace&gt;&lt;markdown&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25755" PostTypeId="1" CreationDate="2018-04-19T12:26:23.533" Score="0" ViewCount="122" Body="&lt;p&gt;I have update the craft version from 3.0.2 to 3.0.3.1, after that Login Page Logo and Site Icon gives 404 path error. I have checked file permissions also but it is not creating link in cpresources folder while it is showing url in frontend. In local its working fine.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="7450" LastEditDate="2018-04-19T12:47:35.777" LastActivityDate="2018-04-19T22:32:52.047" Title="Login Page Logo and Site Icon gives 404 in Craft 3" Tags="&lt;craft3&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-04-30T22:32:55.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="25757" PostTypeId="1" AcceptedAnswerId="25778" CreationDate="2018-04-19T14:19:22.623" Score="0" ViewCount="225" Body="&lt;p&gt;i'm facing 404 errors for images related files in the control panel&#xA;like users photo, Login Page Logo, site Icon... etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for user photo for example i can edit the image, and i see it normally, but it is not visible on the my account page when craft try to reach &#xA;&lt;a href=&quot;http://domaine.org/craft/cpresources/102e2477/thumb-100x100.jpg?v=1524146432&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domaine.org/craft/cpresources/102e2477/thumb-100x100.jpg?v=1524146432&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cpresources rights are 755&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help welcome :)&lt;/p&gt;&#xA;" OwnerUserId="6295" LastActivityDate="2018-04-19T22:33:36.480" Title="404 errors on cpresources images" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-04-30T22:32:24.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="25758" PostTypeId="2" ParentId="25272" CreationDate="2018-04-19T14:29:47.000" Score="1" Body="&lt;p&gt;Fixed this on several installations by changing the PHP and Yii versions to match what the system was running. It seemed to get out of sync now and then so had to keep on top of it at first on all of the Craft 3 installations. Once it's handled it doesn't pose a problem in the future.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="57" LastEditDate="2018-04-19T21:32:51.603" LastActivityDate="2018-04-19T21:32:51.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25759" PostTypeId="2" ParentId="16942" CreationDate="2018-04-19T14:37:33.217" Score="1" Body="&lt;p&gt;I wasn't able to relate the entries back based on another entry using it in a field. I believe there would be a way to do this if you cycled through all of those relating entries and that field and filtered out the ones that matched to current entry. We ended up using categories instead and relations work much better in there!&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-04-19T14:37:33.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25760" PostTypeId="2" ParentId="22475" CreationDate="2018-04-19T15:02:17.593" Score="1" Body="&lt;p&gt;The example given by Robin didn't work for me. The action param needs to be a param of the actionIndex function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionIndex($action){&#xA;...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2018-04-19T15:02:17.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25762" PostTypeId="2" ParentId="25733" CreationDate="2018-04-19T15:40:25.570" Score="1" Body="&lt;p&gt;Here is what I did in my blog index: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% paginate craft.entries.section('blog').limit(1) as pageInfo, blogEntries %}&#xA;&#xA;        &amp;lt;div id=&quot;post-output&quot;&amp;gt;&#xA;&#xA;            {% for entry in blogEntries %}&#xA;                &amp;lt;article&amp;gt;&#xA;                    &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p&amp;gt;Posted on {{ entry.postDate.format('F d, Y') }}&amp;lt;/p&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;Continue reading&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% set numOfpages = pageInfo.totalPages %}&#xA;&#xA;        &amp;lt;button id=&quot;more-button&quot; data-page=&quot;{{craft.app.request.pageNum()}}&quot; data-batch=&quot;1&quot; data-total=&quot;{{ numOfpages}}&quot;&amp;gt;Load More&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in my javascript: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(&quot;#more-button&quot;).on('click', function () {&#xA;var btn = $(this),&#xA;    page = btn.data('page'),&#xA;    batch = btn.data('batch'),&#xA;    total = btn.data('total'),&#xA;    offset = page * batch,&#xA;    newPage = page + 1;&#xA;&#xA;console.log(newPage);&#xA;console.log(total);&#xA;&#xA;if ( newPage &amp;lt;= total ) {&#xA;&#xA;    loadPosts(offset, batch);&#xA;    // set the buttons page attribute to the new page it is on.&#xA;    btn.data('page',newPage);&#xA;}&#xA;&#xA;if ( newPage == total ) {&#xA;    $('#more-button').hide();&#xA;}&#xA;&#xA;});&#xA;&#xA;function loadPosts (offset, limit) {&#xA;$.get('/ajax/posts', { offset:offset, limit:limit }, function (data) {&#xA;    var postOutput = $('#post-output');&#xA;    postOutput.append(data);&#xA;});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-04-19T15:40:25.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25763" PostTypeId="2" ParentId="21709" CreationDate="2018-04-19T16:16:14.863" Score="2" Body="&lt;p&gt;We created a plugin to help solve this problem:&#xA;&lt;a href=&quot;https://github.com/Firstborn/Craft-CMS-Environment-Settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Firstborn/Craft-CMS-Environment-Settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin allows you to specify different configurations per environment on a single asset source.&lt;/p&gt;&#xA;" OwnerUserId="5230" LastActivityDate="2018-04-19T16:16:14.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25764" PostTypeId="2" ParentId="15190" CreationDate="2018-04-19T16:18:48.910" Score="2" Body="&lt;p&gt;We created a plugin to help solve this problem:&#xA;&lt;a href=&quot;https://github.com/Firstborn/Craft-CMS-Environment-Settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Firstborn/Craft-CMS-Environment-Settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin allows you to specify different configurations per environment on a single asset source.&lt;/p&gt;&#xA;" OwnerUserId="5230" LastActivityDate="2018-04-19T16:18:48.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25765" PostTypeId="1" AcceptedAnswerId="25784" CreationDate="2018-04-19T16:20:37.140" Score="1" ViewCount="259" Body="&lt;p&gt;I am using SEOmatic on Craft 2 and want to give the user the ability to customize the Title field of Facebook's OpenGraph Title. For example, instead of showing just the Title, add a &quot;How To&quot; before the title is displayed. &lt;a href=&quot;https://i.stack.imgur.com/ccgc5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ccgc5.png&quot; alt=&quot;Article title only&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;vs. &lt;a href=&quot;https://i.stack.imgur.com/TDoew.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TDoew.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this without using a custom field and have the &quot;How To&quot; only display only on when the article is shared on Facebook? &lt;/p&gt;&#xA;" OwnerUserId="8228" LastActivityDate="2018-04-20T07:56:13.053" Title="Customization Facebook OpenGraph Title" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25766" PostTypeId="2" ParentId="10884" CreationDate="2018-04-19T16:21:47.273" Score="1" Body="&lt;p&gt;We created a plugin to help solve this problem:&#xA;&lt;a href=&quot;https://github.com/Firstborn/Craft-CMS-Environment-Settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Firstborn/Craft-CMS-Environment-Settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plugin allows you to specify different configurations per environment on a single asset source.&lt;/p&gt;&#xA;" OwnerUserId="5230" LastActivityDate="2018-04-19T16:21:47.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25769" PostTypeId="2" ParentId="25748" CreationDate="2018-04-19T17:48:38.467" Score="4" Body="&lt;p&gt;&lt;strong&gt;Craft 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Date/Time formatting in the Control Panel is based on what locale you're using when you're viewing the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have &lt;code&gt;eb_gb&lt;/code&gt; as a locale defined under Settings-&gt;Sites-&gt;Locales, then you can go to your user account settings and set your &quot;Preferred Locale&quot; settings to &quot;British English&quot; and you'll get the DD/MM/YYYY format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The locale you're site is currently set to and the language your viewing the Control Panel in are now separate concepts.  If you go to your user account, click &quot;Preferences&quot;, you'll see a &quot;Language&quot; dropdown, which controls the date/time formatting of the Control Panel for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to set this globally for users that haven’t yet set their preferred language then you can use the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#defaultcplanguage&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;defaultCpLanguage&lt;/code&gt;&lt;/a&gt; config setting. This is also useful when migrating a site from Craft 2.x to 3.x as all existing users won’t have set that preference and it will default to &lt;code&gt;en-US&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="144" LastEditDate="2020-02-07T09:30:52.670" LastActivityDate="2020-02-07T09:30:52.670" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="25770" PostTypeId="2" ParentId="25743" CreationDate="2018-04-19T18:13:31.263" Score="1" Body="&lt;p&gt;Figured it out. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set categories = craft.categories.group('fellowsCat') %}&#xA;&#xA; &amp;lt;ul&amp;gt;&#xA;  {% nav category in craft.categories&#xA;    .group('fellowsCat')&#xA;    %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;      {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;          {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;      {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt; &#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;&#xA;&#xA;{# --- this is the key line here ---#}&#xA;{% if category is defined %}&#xA;&#xA;{% set entries = craft.entries({&#xA;  relatedTo:  category,&#xA;&#xA;})&#xA;%}&#xA;&#xA;{% if craft.entries.relatedTo(category) %} &#xA;&#xA;&#xA;      {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;  &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;     {% else %} &#xA;    nothing to see&#xA;     {% endif %} &#xA;     {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-04-19T18:13:31.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25772" PostTypeId="1" AcceptedAnswerId="25774" CreationDate="2018-04-19T21:26:37.347" Score="4" ViewCount="572" Body="&lt;p&gt;I'm using Craft 3 and I would like to do the following thing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a start date and an end date filed in entry, is it possible to get entries that are between these two dates in PHP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="57" LastEditDate="2018-04-19T23:03:30.913" LastActivityDate="2018-04-19T23:03:30.913" Title="How to get entries between a time" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25773" PostTypeId="1" AcceptedAnswerId="25904" CreationDate="2018-04-19T21:45:33.887" Score="1" ViewCount="33" Body="&lt;p&gt;I'm trying to create a list of countries with a sublist of territories per country based on their existence in the same record. The following is shorthand pseudocode to illustrate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    locations =&amp;gt;&#xA;         United States =&amp;gt;&#xA;             California&#xA;             Massachusettes&#xA;             New York&#xA;         France =&amp;gt;&#xA;             Lille&#xA;             Marseille&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% set allEntries = craft.entries.section('projects').limit(2000) %}&#xA;   {% set countries = allEntries|group('country') %}&#xA;   {% set country_arr ={} %}&#xA;&#xA;   {% for country, entriesInCountry in countries %}&#xA;&#xA;       {% if not attribute(country_arr, country) is defined %}&#xA;&#xA;         {# Add country to list, if unique #}&#xA;&#xA;         {% set country_arr = country_arr | merge([country]) %} &#xA;&#xA;       {% endif %}&#xA;&#xA;       {% for entry in entriesInCountry %}&#xA;&#xA;          {# Somehow add the entry.state here as a property or sub-object of the country, if unique #}&#xA;&#xA;       {% endfor %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="413" LastActivityDate="2018-04-27T21:11:59.847" Title="Create structured object from query results" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25774" PostTypeId="2" ParentId="25772" CreationDate="2018-04-19T21:47:08.063" Score="4" Body="&lt;pre&gt;&lt;code&gt;Entry::find()-&amp;gt;startDate('&amp;gt;='. $someTime).endTime('&amp;lt;='.$someOtherTime).all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those variables can be timestamps, DateTimes or a correctly formated time string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some variants of these filters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()&#xA;    -&amp;gt;variantOne('&amp;lt;=' .  Db::prepareDateForDb(new \DateTime())) &amp;lt;-- DateTime object&#xA;    -&amp;gt;variantTwo('&amp;lt;=' . time())  &amp;lt;-- as timestamp&#xA;    -&amp;gt;variantThree('&amp;lt;=' . (new \DateTime())-&amp;gt;format('U')) &amp;lt;-- timestamp as well&#xA;    -&amp;gt;variant(['and', '&amp;lt;=' . time() , '&amp;gt;=' . time() - 3600]) &amp;lt;-- entries within the last hour&#xA;    -&amp;gt;validString(['or', '&amp;gt;=' . (new DateTime())-&amp;gt;format('Y-m-d H:i:s'), '&amp;lt;= ' . time()])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-19T22:55:09.110" LastActivityDate="2018-04-19T22:55:09.110" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25775" PostTypeId="1" AcceptedAnswerId="25776" CreationDate="2018-04-19T22:00:47.927" Score="2" ViewCount="635" Body="&lt;p&gt;I'm looking to customize the CKEditor (rich text field) to restrict my client to only these buttons: h2, p, bold, italic, underline, link &amp;amp; unordered list.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-04-19T22:00:47.927" Title="How to add a button or format style in Craft 3 CKEditor (rich text field)" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;richtext&gt;&lt;ckeditor5&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25776" PostTypeId="2" ParentId="25775" CreationDate="2018-04-19T22:00:47.927" Score="3" Body="&lt;p&gt;I asked the question on the Slack channel &amp;amp; got my answer. Thank you @kenyonkowal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to customize your rich text editor is to use &lt;strong&gt;Redactor&lt;/strong&gt; instead of CKeditor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to add a config file to the config folder, i.e. &lt;code&gt;config/redactor/basic.json&lt;/code&gt; and then in that you would put&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;formatting&quot;: [&quot;p&quot;, &quot;h2&quot;],&#xA;&quot;buttons&quot;: [&quot;formatting&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;underline&quot;, &quot;link&quot;, &quot;ul&quot;],&#xA;&quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can edit add or remove a lot more, here's a link to the documentation:&#xA;&lt;a href=&quot;https://imperavi.com/redactor/docs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/docs/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-04-19T22:00:47.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25777" PostTypeId="2" ParentId="25755" CreationDate="2018-04-19T22:32:52.047" Score="1" Body="&lt;p&gt;This has been fixed for the next release. Only affects environments where the web server is not sending missing resource requests (like &lt;code&gt;/cpresources/XXXXXX/logo.svg&lt;/code&gt;) to &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-04-19T22:32:52.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25778" PostTypeId="2" ParentId="25757" CreationDate="2018-04-19T22:33:36.480" Score="1" Body="&lt;p&gt;This has been fixed for the next release. Only affects environments where the web server is not sending missing resource requests (like &lt;code&gt;/cpresources/XXXXXX/logo.svg&lt;/code&gt;) to &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-04-19T22:33:36.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25779" PostTypeId="1" CreationDate="2018-04-20T01:32:18.523" Score="0" ViewCount="39" Body="&lt;p&gt;I am on Craft 2.6.3015 and have Freeform 1.3.0 installed. I'm trying to update to the latest Freeform Lite 1.8.7 but it consistently fails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try on my local environment I just get the message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft was unable to install this update :(&#xA;  The site has been restored to the state it was in before the attempted update.&#xA;  There was a problem updating your database.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But on my remote server it deleted two thirds of the tables in the db.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually have 7 similar sites where I have done this same update no problem but this one site fails every time. I'm not sure what the difference could be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if I can get my hands on an intermediate version of Freeform to try updating to if that would help?&lt;/p&gt;&#xA;" OwnerUserId="8273" LastActivityDate="2018-06-23T04:50:03.790" Title="Freeform Lite update on Craft 2 deleted tables" Tags="&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25780" PostTypeId="1" AcceptedAnswerId="25783" CreationDate="2018-04-20T02:22:07.297" Score="1" ViewCount="436" Body="&lt;p&gt;I have an endpoint created and I am getting the groupID but I am unable to get all the categories associated with the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have right now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categoriesGroup = Craft::$app-&amp;gt;categories-&amp;gt;getGroupById($catId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to get an array of entries from that.&lt;/p&gt;&#xA;" OwnerUserId="3652" LastEditorUserId="57" LastEditDate="2018-04-24T03:49:10.740" LastActivityDate="2018-04-24T03:49:10.740" Title="Get all Categories with getGroupById in Element API plugin - Craft 3" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25782" PostTypeId="1" CreationDate="2018-04-20T04:13:30.650" Score="1" ViewCount="77" Body="&lt;p&gt;I am actually doing on page SEO for a Craft site. I created 4 new pages. I have no idea how to publish them, put the links into a block on the home page, add an image to the content, and add to the menu via a dropdown. Is this all possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am well versed in WP but not Craft.&lt;/p&gt;&#xA;" OwnerUserId="8275" LastActivityDate="2018-04-21T14:16:58.060" Title="Not a Craft CMS designer and need help" Tags="&lt;link&gt;&lt;menu&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25783" PostTypeId="2" ParentId="25780" CreationDate="2018-04-20T05:06:29.757" Score="2" Body="&lt;pre&gt;&lt;code&gt;$categories = Category::find()-&amp;gt;groupId($id)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-20T06:55:08.273" LastActivityDate="2018-04-20T06:55:08.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25784" PostTypeId="2" ParentId="25765" CreationDate="2018-04-20T07:56:13.053" Score="1" Body="&lt;p&gt;Referring to &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, you can try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set og = seomaticMeta.og %}&#xA;{% set og = og | merge({'title': 'How to: ' ~ seomaticMeta.og.title}) %}&#xA;{% set seomaticMeta = seomaticMeta | merge({'og': og}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3684" LastActivityDate="2018-04-20T07:56:13.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25785" PostTypeId="2" ParentId="25754" CreationDate="2018-04-20T08:35:51.297" Score="1" Body="&lt;p&gt;I would rather recommend to stick to semantic HTML and &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; elements for your ordered lists. This not only makes showing the numbers easier, it really should be done out of accessibility reasons and it’s good practice in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of good solutions to modify the way numbers are displayed in ordered lists using CSS, if you are not happy with the way they are shown by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can recommend using &lt;code&gt;display: table-row;&lt;/code&gt; for it. Example code: &lt;a href=&quot;https://stackoverflow.com/a/23947414&quot;&gt;https://stackoverflow.com/a/23947414&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here’s some example code for formatting &lt;code&gt;content: counter();&lt;/code&gt; in pseudo elements: &lt;a href=&quot;https://craftcms.stackexchange.com/a/1781/125&quot;&gt;https://craftcms.stackexchange.com/a/1781/125&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-04-20T08:35:51.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25786" PostTypeId="2" ParentId="25551" CreationDate="2018-04-20T09:30:33.480" Score="1" Body="&lt;p&gt;Turns out that it was a PHP configuration issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under Windows, the paths in &lt;code&gt;php.ini&lt;/code&gt; need to include a drive letter (eg. &lt;code&gt;c:\xampp\php7\&lt;/code&gt;). By default they're root-relative (eg. &lt;code&gt;\xampp\php7&lt;/code&gt;). When I originally installed XAMPP with PHP 5.x, it adjusted the paths automatically. But when I manually copied the PHP 7 folder into XAMPP to set it up for version switching, I overlooked the path discrepancy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, it was the inability of PHP 7 to set sessions that was causing the odd behavior.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-04-20T09:30:33.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25787" PostTypeId="1" CreationDate="2018-04-20T10:32:20.170" Score="0" ViewCount="29" Body="&lt;p&gt;I have a Structure Section:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sub 1&lt;/li&gt;&#xA;&lt;li&gt;Sub 2 &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;About&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;List item&lt;/li&gt;&#xA;&lt;li&gt;List item&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Info&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I link the «Home»-Entry in a Structured Section to the «Sub 1»-Entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8277" LastActivityDate="2018-04-20T10:38:27.880" Title="How can I Link a category entry to a Subsite?" Tags="&lt;craft3&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25788" PostTypeId="2" ParentId="25787" CreationDate="2018-04-20T10:38:27.880" Score="2" Body="&lt;pre&gt;&lt;code&gt;{% set home = craft.entries.section('pages').one() %}&#xA;{% set sub1 = home.getChildren().one() %}&#xA;link: &amp;lt;a href=&quot;{{ sub1.getUrl() }}&quot;&amp;gt;{{ sub.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-20T10:38:27.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25789" PostTypeId="2" ParentId="25782" CreationDate="2018-04-20T12:44:01.233" Score="4" Body="&lt;p&gt;Craft often requires a different approach than Wordpress, but can be just as easy and powerful to use when set up correctly. The big unknown in your situation is how your content architecture and templates are set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Content architecture and template decisions in Craft are custom from site to site and designed by the firm that created or maintains the website. To help further with you question, we'd need to understand how your sections and navigation are set up, if your sections have URLs, what assumptions your templates are designed to make about the content they output, and so on. Getting training from the firm who built the site or hiring a consultant to walk you through your site and give you a tour of how things work could be helpful in your situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few resources that could help you get started:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/features/matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Feature Videos&lt;/a&gt; - Short videos on how key features in Craft work&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/training&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft Training&lt;/a&gt; - Free, weekly intro training&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://mijingo.com/products/screencasts/craft-cms-3-tutorials/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo Video Course&lt;/a&gt; - Overview of building a site in Craft&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you are in the situation where you are looking for a consultant or firm to work with, there are a couple of Craft professional listings and job directories. At the time of this post:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft - Jobs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://straightupcraft.com/professionals&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Up Craft - Professionals&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.workwithcraft.com/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Work With Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.workwithcraft.com/professionals&quot; rel=&quot;nofollow noreferrer&quot;&gt;Work With Craft - Professionals&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/partners&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS Partners&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Slack #jobs channel&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-04-21T14:16:58.060" LastActivityDate="2018-04-21T14:16:58.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25790" PostTypeId="1" AcceptedAnswerId="25791" CreationDate="2018-04-20T13:28:31.630" Score="1" ViewCount="50" Body="&lt;p&gt;I have an entry id in that I am storing in a variable that I would like to access outside of this for statement, is there a way I can &quot;stash&quot; it somewhere? I want to do another query based on tags but make sure I exclude this entry id. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in manualPost.all() %}&#xA;&#xA;    {% set manualPostID = entry.id %}&#xA;&#xA;    {% if entry.blogHero|length %}&#xA;&#xA;        {% set optimizedImages = entry.blogHero.one().optimizedimages %}&#xA;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&amp;lt;img src=&quot;{{ optimizedImages.src() }}&quot;srcset=&quot;{{ optimizedImages.srcset() }}&quot;sizes=&quot;100vw&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="130" LastEditDate="2018-04-24T10:27:51.817" LastActivityDate="2018-04-24T10:27:51.817" Title="stashing variables?" Tags="&lt;templating&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25791" PostTypeId="2" ParentId="25790" CreationDate="2018-04-20T13:52:26.187" Score="3" Body="&lt;p&gt;Twig doesn't let you stash variables for access elsewhere; rather every variable has a well defined scope. So what you'd have to do is store that &lt;code&gt;id&lt;/code&gt; in a variable that has a global context, so other templates you &lt;code&gt;include&lt;/code&gt; can access it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://nystudio107.com/blog/twig-processing-order-and-scope&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Processing Order &amp;amp; Scope&lt;/a&gt; article for more info on this.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-20T13:52:26.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25794" PostTypeId="1" AcceptedAnswerId="25801" CreationDate="2018-04-20T22:35:21.793" Score="0" ViewCount="914" Body="&lt;p&gt;I have a series of checkbox like so:&#xA;&lt;code&gt;&#xA;       &amp;lt;fieldset data-role=&quot;controlgroup&quot;&amp;gt;&#xA;        {% for option in craft.fields.getFieldByHandle('area').getFieldType.options %}&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;area[]&quot; value=&quot;{{ option.value }}&quot; class=&quot;bg-white h-4 w-4 tickbox template_filters&quot; /&amp;gt;&#xA;            &amp;lt;label&amp;gt;{{ option.label }}&amp;lt;/label&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/fieldset&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to the user to be able to select multiple but only pass through as a single parameter in a query string.&#xA;At the moment selecting multiple results in:&#xA;&lt;code&gt;http://localhost:8080/directories/case-studies/?area=africa&amp;amp;area=europe&amp;amp;area=asia&lt;/code&gt;&#xA;Naturally this only filters my results on the last query (asia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I accomplish a search on all three either merging the queries before submission i.e &lt;code&gt;?area=africa,europe,asia&lt;/code&gt;OR to keep all versions but append the results to merge the query strings?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-04-22T16:41:05.813" Title="Filtering search with checkboxes multiple param querystring" Tags="&lt;search&gt;&lt;checkboxes&gt;&lt;querystring&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25795" PostTypeId="1" AcceptedAnswerId="25796" CreationDate="2018-04-20T22:58:53.197" Score="1" ViewCount="497" Body="&lt;p&gt;Is it possible to query the current entry or category element via a Craft 3 plugin/module?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the 2.6 era, I would use a hook. The Craft 3 iteration of a hook looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentElement;&#xA;&#xA;Craft::$app-&amp;gt;getView()-&amp;gt;hook('someHook', function(array &amp;amp;$context) {&#xA;  if (isset($context['entry'])) {&#xA;    $currentElement = $context['entry'];&#xA;  } else if (isset($context['category'])) {&#xA;    $currentElement = $context['category'];&#xA;  }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With an accompanying Twig snippet in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook 'someHook' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if there is a cleaner practice to accomplish the same goal? I find relying on Twig snippet reduces the flexibility of my plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've noticed the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOMatic&lt;/a&gt; plugin is able to append entry specific data without any hooks in the template. I can't figure out how, but it gives me hope. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-04-23T01:22:26.687" Title="Getting current entry element via plugin in Craft 3 without a hook" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25796" PostTypeId="2" ParentId="25795" CreationDate="2018-04-21T03:09:02.930" Score="2" Body="&lt;p&gt;Check out &lt;code&gt;Craft::$app-&amp;gt;getElements()-&amp;gt;getElementByUri()&lt;/code&gt; -- or you might also use &lt;code&gt;Craft::$app-&amp;gt;getUrlManager()-&amp;gt;getMatchedElement()&lt;/code&gt; depending on your use case.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your friendly neighborhood SEOmatic author :)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-04-23T01:22:26.687" LastActivityDate="2018-04-23T01:22:26.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25797" PostTypeId="2" ParentId="25794" CreationDate="2018-04-21T06:21:59.777" Score="0" Body="&lt;p&gt;You can create the link with Javascript and redirect via &lt;code&gt;window.location&lt;/code&gt; when you press on the button instead of submitting the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did something similar a few days ago &lt;a href=&quot;http://thaff.secondred-elab.selfip.org/stellensuche#ansicht-list;seite-1;sortierung-publishDate&quot; rel=&quot;nofollow noreferrer&quot;&gt;working example &lt;/a&gt;  it's still in progress - so there is no mobile version yet - but I create a new link each time the user interacts with the page in order to provide the functionally to go back and forward. The url is created with Javascript I just append a hash instead of leaving the page (I hate page reloads instead of a clean smooth ajax solution for this use case) &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-21T06:21:59.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25798" PostTypeId="1" CreationDate="2018-04-21T08:48:34.847" Score="0" ViewCount="402" Body="&lt;p&gt;I recently had to run a couple of migrations to move entries from one structure to the other, but had problems when running the migration PHP script being able to get environment variables e.g. DB and stuff in .env. In the end I temporarily replaced my &lt;code&gt;craft/config/db.php&lt;/code&gt; and hard coded my DB on local so I could run the script, however this isn't really ideal but did the job. It seemed the script couldn't get the DB environment variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering what should I be including in my bootstrap migration scripts going forward in order to utilise the environment variables properly. I used a version of the script here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/4433/move-entry-from-one-structure-to-another-with-parenting/&quot;&gt;Move entry from one structure to another with parenting&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slightly modified to take an array of ids, as well as mapping the old and new entry types as an arry, so it could be done in one go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I essentially tried copying most of the beginning portion of the &lt;code&gt;index.php&lt;/code&gt; like this and transplanting it into my migration script&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Composer: https://getcomposer.org/doc/&#xA;require_once('../vendor/autoload.php');&#xA;&#xA;// PHP dotenv: https://github.com/vlucas/phpdotenv&#xA;if (!getenv('APP_SECRETS'))&#xA;{&#xA;    $root_dir = dirname(dirname(__FILE__));&#xA;    if (file_exists($root_dir . '/.env'))&#xA;    {&#xA;        Dotenv::load($root_dir);&#xA;        Dotenv::required(array('APP_SECRETS', 'CRAFT_ENVIRONMENT'));&#xA;    }&#xA;}&#xA;define('CRAFT_ENVIRONMENT', getenv('CRAFT_ENVIRONMENT'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, no matter what I just got a &lt;code&gt;die()&lt;/code&gt; error from &lt;code&gt;craft/local/db.php&lt;/code&gt; saying the path to the file containing the DB crendentials (secrets.json) couldn't be found, so it seems the environment variables weren't available at runtime. &lt;code&gt;APP_SECRETS&lt;/code&gt; is the path to the json file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas, what I'm missing for environment variables to be loaded in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-04-21T11:38:47.560" LastActivityDate="2018-07-01T11:23:14.377" Title="bootstrap.php how to include environment variables for multi-environment configuration?" Tags="&lt;migration&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25800" PostTypeId="1" AcceptedAnswerId="25811" CreationDate="2018-04-22T15:12:24.650" Score="0" ViewCount="431" Body="&lt;p&gt;I haven't seen any answers specifically addressing this. While I did find a workaround, there's a bit of a gap in knowledge or guidance on this one, it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm developing a plugin as prescribed in the &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-intro.html#composerjson&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Docs&lt;/a&gt;, where my plugins folder is outside of my Craft folder:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;  &quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;  &quot;prefer-stable&quot;: true,&#xA;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;../dev/craft-campaignmonitor-transactional&quot;&#xA;    }&#xA;  ]&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working great! After seeing a bunch of code work I ran &lt;code&gt;composer require&lt;/code&gt; in my plugin to add a required package there, and it installed in my &lt;code&gt;vendor&lt;/code&gt; directory for my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter what I tried, though, I kept getting &quot;Class not found&quot; errors for that package's class when I tried to use it in my plugin code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only when I ran &lt;code&gt;composer require&lt;/code&gt; on the package in my &lt;strong&gt;Craft&lt;/strong&gt; directory did it work in my plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can understand why this is happening...but should I be able to work on a plugin outside the Craft directory and keep vendor packages out of the Craft directory until I'm ready to install it? Or is this a necessary workaround while in development?&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2018-04-23T11:20:15.627" Title="plugin dev with vendor packages" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25801" PostTypeId="2" ParentId="25794" CreationDate="2018-04-22T16:41:05.813" Score="2" Body="&lt;p&gt;You can do this by getting all the params in the url that have the same name and joining them into a single string which you can use in your Twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this code is untested but is based on something I've recently done. This example only uses categories but it's possible to expand it to search custom fields and/or add a free text search too.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all the area params and join them into a comma delimited string %}&#xA;{% set areaQuery = craft.request.getParam('area') | join(',')  %}&#xA;&#xA;&#xA;{# build the search query #}&#xA;{% set relatedParams = ['and'] %}&#xA;&#xA;&#xA;{% set areas = craft.categories.group('areas').slug( areaQuery | split(',') ).find() %}&#xA;{% for area in areas %}&#xA;    {% set relatedParams = relatedParams|merge([{ targetElement: area }]) %}&#xA;{% endfor %}&#xA;&#xA;&#xA;{# execute the search and get a resultset of entries #}&#xA;{% set entries = craft.entries.relatedTo(relatedParams).order('score') %}&#xA;&#xA;{# output your entries #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-22T16:41:05.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25802" PostTypeId="2" ParentId="25682" CreationDate="2018-04-22T18:37:13.973" Score="0" Body="&lt;p&gt;Thank you Verbb for fixing this up. The answer can be found here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/verbb/feed-me/issues/298&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/feed-me/issues/298&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-04-22T18:37:13.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25804" PostTypeId="2" ParentId="25800" CreationDate="2018-04-22T19:13:34.143" Score="1" Body="&lt;p&gt;You should not do that at all. The entire process to install plugins via composer instead of the old way is to avoid this conflict. Imagine two of your plugins require the same class/library so you'll end up with a &lt;code&gt;class already declared&lt;/code&gt; exception. Instead you can insert your requirements into the composer json of your plugin, run the &lt;code&gt;composer update&lt;/code&gt; command for your Craft composer json and you are fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All dependencies will be loaded into the correct &lt;code&gt;vendor&lt;/code&gt; folder. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-22T19:13:34.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25805" PostTypeId="1" AcceptedAnswerId="25807" CreationDate="2018-04-22T19:32:30.500" Score="1" ViewCount="47" Body="&lt;p&gt;This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set entries = craft.entries({&#xA;                section: 'listing',&#xA;                listinglatitudenumber: '&amp;gt;=' ~ pluginResults.latmin&#xA;            }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I need to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set entries = craft.entries({&#xA;                section: 'listing',&#xA;                listinglatitudenumber: 'and', '&amp;gt;=' ~ pluginResults.latmin, '&amp;lt;=' ~ pluginResults.latmax&#xA;            }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I cannot for the life of me figure out the correct syntax for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying many different combos for the 'and' statement based on other answers I have seen in the Craft Stack Exchange but have not been successful. I have not been able to find any docs on this type of query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="8278" LastEditorUserId="8278" LastEditDate="2018-04-22T19:35:48.943" LastActivityDate="2018-04-22T20:22:09.053" Title="ANDing criteria in craft.entries" Tags="&lt;craft.entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25806" PostTypeId="2" ParentId="25805" CreationDate="2018-04-22T19:35:24.457" Score="1" Body="&lt;p&gt;You need to separate your criterias with commas&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;listinglatitudenumber: 'and, ' ~  '&amp;gt;=' ~ pluginResults.latmin ~ ', &amp;lt;=' ~ pluginResults.latmin, &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-22T20:00:13.300" LastActivityDate="2018-04-22T20:00:13.300" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25807" PostTypeId="2" ParentId="25805" CreationDate="2018-04-22T20:22:09.053" Score="0" Body="&lt;p&gt;As per:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/22593/query-entries-between-two-values?rq=1&quot;&gt;Query entries between two values&lt;/a&gt;&#xA;I found that enclosing the query string that I had with [ ] to make it a sub-array, works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set entries = craft.entries({&#xA;            section: 'listing',&#xA;            listinglatitudenumber: ['and', '&amp;gt;=' ~ pluginResults.latmin, '&amp;lt;=' ~ pluginResults.latmax]&#xA;        }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8278" LastActivityDate="2018-04-22T20:22:09.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25808" PostTypeId="1" CreationDate="2018-04-22T20:30:08.230" Score="1" ViewCount="248" Body="&lt;p&gt;I'm working on upgrading an existing Craft 2.6 site to Craft 3.0.3.1 on my development server with official documentation that was &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#if-you-want-to-keep-your-current-directory-structure&quot; rel=&quot;nofollow noreferrer&quot;&gt;provided&lt;/a&gt;. I keep running into an Internal Server Error. I checked the logs and I'm looking to get pointed in the right direction if anyone has any tips. I checked other questions on this, and haven't seen anything specific to this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[22-Apr-2018 20:23:26 UTC] An Error occurred while handling another &#xA;&#xA;error:&#xA;yii\base\UnknownPropertyException: Setting unknown property: craft\config\DbConfig::initSQLs in /var/www/craft/vendor/yiisoft/yii2/base/BaseObject.php:163&#xA;Stack trace:&#xA;#0 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\BaseObject-&amp;gt;__set('initSQLs', Array)&#xA;#1 /var/www/craft/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\config\DbConfig), Array)&#xA;#2 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(99): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#3 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(135): craft\services\Config-&amp;gt;getConfigSettings('db')&#xA;#4 /var/www/craft/vendor/craftcms/cms/src/config/app.php(203): craft\services\Config-&amp;gt;getDb()&#xA;#5 [internal function]: {closure}()&#xA;#6 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#7 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#8 /var/www/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#9 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('db', true)&#xA;#10 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(318): yii\base\Module-&amp;gt;get('db', true)&#xA;#11 /var/www/craft/vendor/yiisoft/yii2/base/Application.php(499): craft\web\Application-&amp;gt;get('db')&#xA;#12 /var/www/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(600): yii\base\Application-&amp;gt;getDb()&#xA;#13 /var/www/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(222): craft\web\Application-&amp;gt;getIsDbConnectionValid()&#xA;#14 /var/www/craft/vendor/craftcms/cms/src/services/Deprecator.php(60): craft\web\Application-&amp;gt;getIsInstalled()&#xA;#15 /var/www/craft/vendor/craftcms/cms/src/config/GeneralConfig.php(673): craft\services\Deprecator-&amp;gt;log('environmentVari...', 'The environment...')&#xA;#16 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(99): craft\config\GeneralConfig-&amp;gt;__construct(Array)&#xA;#17 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(145): craft\services\Config-&amp;gt;getConfigSettings('general')&#xA;#18 /var/www/craft/vendor/craftcms/cms/src/config/app.web.php(19): craft\services\Config-&amp;gt;getGeneral()&#xA;#19 [internal function]: {closure}()&#xA;#20 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#21 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#22 /var/www/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#23 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#24 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(318): yii\base\Module-&amp;gt;get('request', true)&#xA;#25 /var/www/craft/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application-&amp;gt;get('request')&#xA;#26 /var/www/craft/vendor/craftcms/cms/src/web/Controller.php(78): yii\web\Application-&amp;gt;getRequest()&#xA;#27 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('render-error', Array)&#xA;#28 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(267): yii\base\Module-&amp;gt;runAction('templates/rende...', Array)&#xA;#29 /var/www/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(108): craft\web\Application-&amp;gt;runAction('templates/rende...')&#xA;#30 /var/www/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(156): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\UnknownPropertyException))&#xA;#31 /var/www/craft/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\UnknownPropertyException))&#xA;#32 /var/www/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(71): yii\base\ErrorHandler-&amp;gt;handleException(Object(yii\base\UnknownPropertyException))&#xA;#33 [internal function]: craft\web\ErrorHandler-&amp;gt;handleException(Object(yii\base\UnknownPropertyException))&#xA;#34 {main}&#xA;Previous exception:&#xA;yii\base\UnknownPropertyException: Setting unknown property: craft\config\DbConfig::initSQLs in /var/www/craft/vendor/yiisoft/yii2/base/BaseObject.php:163&#xA;Stack trace:&#xA;#0 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\BaseObject-&amp;gt;__set('initSQLs', Array)&#xA;#1 /var/www/craft/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\config\DbConfig), Array)&#xA;#2 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(99): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#3 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(135): craft\services\Config-&amp;gt;getConfigSettings('db')&#xA;#4 /var/www/craft/vendor/craftcms/cms/src/config/app.php(203): craft\services\Config-&amp;gt;getDb()&#xA;#5 [internal function]: {closure}()&#xA;#6 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#7 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#8 /var/www/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#9 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('db', true)&#xA;#10 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(318): yii\base\Module-&amp;gt;get('db', true)&#xA;#11 /var/www/craft/vendor/yiisoft/yii2/base/Application.php(499): craft\web\Application-&amp;gt;get('db')&#xA;#12 /var/www/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(600): yii\base\Application-&amp;gt;getDb()&#xA;#13 /var/www/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(222): craft\web\Application-&amp;gt;getIsDbConnectionValid()&#xA;#14 /var/www/craft/vendor/craftcms/cms/src/services/Deprecator.php(60): craft\web\Application-&amp;gt;getIsInstalled()&#xA;#15 /var/www/craft/vendor/craftcms/cms/src/config/GeneralConfig.php(673): craft\services\Deprecator-&amp;gt;log('environmentVari...', 'The environment...')&#xA;#16 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(99): craft\config\GeneralConfig-&amp;gt;__construct(Array)&#xA;#17 /var/www/craft/vendor/craftcms/cms/src/services/Config.php(145): craft\services\Config-&amp;gt;getConfigSettings('general')&#xA;#18 /var/www/craft/vendor/craftcms/cms/src/config/app.web.php(19): craft\services\Config-&amp;gt;getGeneral()&#xA;#19 [internal function]: {closure}()&#xA;#20 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#21 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#22 /var/www/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#23 /var/www/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#24 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(318): yii\base\Module-&amp;gt;get('request', true)&#xA;#25 /var/www/craft/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application-&amp;gt;get('request')&#xA;#26 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(107): yii\web\Application-&amp;gt;getRequest()&#xA;#27 /var/www/craft/vendor/yiisoft/yii2/base/Application.php(273): craft\web\Application-&amp;gt;bootstrap()&#xA;#28 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(93): yii\base\Application-&amp;gt;init()&#xA;#29 /var/www/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application-&amp;gt;init()&#xA;#30 /var/www/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#31 /var/www/craft/vendor/craftcms/cms/src/web/Application.php(85): yii\base\Application-&amp;gt;__construct(Array)&#xA;#32 [internal function]: craft\web\Application-&amp;gt;__construct(Array)&#xA;#33 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#34 /var/www/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Appli...', Array, Array)&#xA;#35 /var/www/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Appli...', Array, Array)&#xA;#36 /var/www/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(249): yii\BaseYii::createObject(Array)&#xA;#37 /var/www/craft/vendor/craftcms/cms/bootstrap/web.php(42): require('/var/www/craft/...')&#xA;#38 /var/www/public/index.php(14): require('/var/www/craft/...')&#xA;#39 {main}&#xA;$_SERVER = [&#xA;    'REDIRECT_STATU&#xA;S' =&amp;gt; '200',&#xA;    'HTTP_HOST' =&amp;gt; 'homeaidoc.test',&#xA;    'HTTP_CONNECTION' =&amp;gt; 'keep-alive',&#xA;    'HTTP_UPGRADE_INSECURE_REQUESTS' =&amp;gt; '1',&#xA;    'HTTP_USER_AGENT' =&amp;gt; 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36',&#xA;    'HTTP_ACCEPT' =&amp;gt; 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',&#xA;    'HTTP_ACCEPT_ENCODING' =&amp;gt; 'gzip, deflate',&#xA;    'HTTP_ACCEPT_LANGUAGE' =&amp;gt; 'en-US,en;q=0.9',&#xA;    'HTTP_COOKIE' =&amp;gt; 'YII_CSRF_TOKEN=d84a6a7469791b5a01aa759647795df386aa7292s%3A81%3A%221ctj6EdpYYbzJgTL8duqMe5BRaYB0QEIxQZCPZzZ%7Cdf07c76fcbed073a07511bd5e063e3567f042e1d%22%3B; 1031b8c41dfff97a311a7ac99863bdc5_username=e910b225ebf1bd323b2e632b610bc5b29d0ca26665a484ee6e037738c1a43e63a%3A2%3A%7Bi%3A0%3Bs%3A41%3A%221031b8c41dfff97a311a7ac99863bdc5_username%22%3Bi%3A1%3Bs%3A9%3A%22homeaidoc%22%3B%7D; __stripe_mid=9e5a2844-086d-4ba9-8344-5d1358d2ed5e; CRAFT_CSRF_TOKEN=fdcfb3a08e59d1514a73ab02b732715a56eebd731d04018430f87e4ceeab268ca%3A2%3A%7Bi%3A0%3Bs%3A16%3A%22CRAFT_CSRF_TOKEN%22%3Bi%3A1%3Bs%3A40%3A%22gqlZV4dhqH9VxXItR7_TkDzV1mLlYWrpxt8B_amI%22%3B%7D; 6c228aef999c7557f40c51680fd797c2username=2956940bf1a165db1f4950fc46ebe6f9b80651b4s%3A64%3A%225fcd775cdc3be4989c0a2e2d0a919d386291f6abczo5OiJob21lYWlkb2MiOw%3D%3D%22%3B; CraftSessionId=9mhet7l9ps64j7c7jtmvvr75qc; __stripe_sid=71a94e68-68bd-4676-8023-6291dc3f0532; 6c228aef999c7557f40c51680fd797c2=7d06e757b13921230209a5bd10fdc29eb1cae5c5s%3A400%3A%22dfe5bef72d444908a70f64cb5589282e5fdd9e35YTo2OntpOjA7czo5OiJob21lYWlkb2MiO2k6MTtzOjMyOiJJTVNYUnNkdHYwUXF1R1hoRzJ%2BenE0S3AyX1FlR2NIayI7aToyO3M6MzY6ImQ1NjM3YzZmLTE5MDItNGNjMS1iYzQyLTM3YTRiNGI2MTNhMiI7aTozO2k6MDtpOjQ7czoxMjE6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IEludGVsIE1hYyBPUyBYIDEwXzEzXzQpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS82Ni4wLjMzNTkuMTE3IFNhZmFyaS81MzcuMzYiO2k6NTthOjA6e319%22%3B',&#xA;    'PATH' =&amp;gt; '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',&#xA;    'SERVER_SIGNATURE' =&amp;gt; '&amp;lt;address&amp;gt;Apache/2.4.29 (Ubuntu) Server at homeaidoc.test Port 80&amp;lt;/address&amp;gt;&#xA;',&#xA;    'SERVER_SOFTWARE' =&amp;gt; 'Apache/2.4.29 (Ubuntu)',&#xA;    'SERVER_NAME' =&amp;gt; 'homeaidoc.test',&#xA;    'SERVER_ADDR' =&amp;gt; '192.168.33.10',&#xA;    'SERVER_PORT' =&amp;gt; '80',&#xA;    'REMOTE_ADDR' =&amp;gt; '192.168.33.1',&#xA;    'DOCUMENT_ROOT' =&amp;gt; '/var/www/public',&#xA;    'REQUEST_SCHEME' =&amp;gt; 'http',&#xA;    'CONTEXT_PREFIX' =&amp;gt; '',&#xA;    'CONTEXT_DOCUMENT_ROOT' =&amp;gt; '/var/www/public',&#xA;    'SERVER_ADMIN' =&amp;gt; 'webmaster@localhost',&#xA;    'SCRIPT_FILENAME' =&amp;gt; '/var/www/public/index.php',&#xA;    'REMOTE_PORT' =&amp;gt; '58251',&#xA;    'REDIRECT_URL' =&amp;gt; '/admin',&#xA;    'REDIRECT_QUERY_STRING' =&amp;gt; 'p=admin',&#xA;    'GATEWAY_INTERFACE' =&amp;gt; 'CGI/1.1',&#xA;    'SERVER_PROTOCOL' =&amp;gt; 'HTTP/1.1',&#xA;    'REQUEST_METHOD' =&amp;gt; 'GET',&#xA;    'QUERY_STRING' =&amp;gt; 'p=admin',&#xA;    'REQUEST_URI' =&amp;gt; '/admin',&#xA;    'SCRIPT_NAME' =&amp;gt; '/index.php',&#xA;    'PHP_SELF' =&amp;gt; '/index.php',&#xA;    'REQUEST_TIME_FLOAT' =&amp;gt; 1524428606.937,&#xA;    'REQUEST_TIME' =&amp;gt; 1524428606,&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="731" LastActivityDate="2018-05-23T02:04:44.253" Title="Upgrade 2 to 3 Using Current Directory Structure" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25810" PostTypeId="2" ParentId="25808" CreationDate="2018-04-23T01:07:51.453" Score="1" Body="&lt;p&gt;This exactly what happened. Thank you for your help! This is the line that I added: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was updating my sever environment and needed this for Craft 2.6 to work with MySQL 5.5 and higher. It was a work around that the Pixel &amp;amp; Tonic team provided awhile back. Thanks for pointing me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="731" LastActivityDate="2018-04-23T01:07:51.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25811" PostTypeId="2" ParentId="25800" CreationDate="2018-04-23T01:22:17.903" Score="0" Body="&lt;p&gt;I figured it out. &lt;code&gt;composer update&lt;/code&gt; in my Craft directory was not seeing the new required package in my plugin's composer.json file. I'm assuming this was based on specified versions or not bumping the version so that it would update the plugin package.&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="187" LastEditDate="2018-04-23T11:20:15.627" LastActivityDate="2018-04-23T11:20:15.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25812" PostTypeId="1" AcceptedAnswerId="25814" CreationDate="2018-04-23T03:10:39.357" Score="0" ViewCount="577" Body="&lt;p&gt;I took the manual install route, unzipped the latest Craft version, and edited the .env file with my database settings, but when I direct my browser to &lt;code&gt;/craft/web/index.php&lt;/code&gt; I get a plain page with &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft requires PHP 7.0 or later. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have Bluehost Shared Site and have tried setting my PHP version to 7, but that justs adds a PHP 7 handler to my &lt;code&gt;.htaccess&lt;/code&gt; file.  When I check the PHP version through the console it still says 5.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the composer route, and added &lt;code&gt;--ignore-platform-reqs&lt;/code&gt;, but when I get to the &lt;code&gt;./craft setup&lt;/code&gt; step I get the exact same message. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just not sure what to do from here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8283" LastEditorUserId="5557" LastEditDate="2018-04-24T08:29:53.340" LastActivityDate="2018-04-24T08:29:53.340" Title="'Craft requires PHP 7.0 or later'" Tags="&lt;php&gt;&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25813" PostTypeId="2" ParentId="25736" CreationDate="2018-04-23T05:56:51.413" Score="1" Body="&lt;p&gt;Virtualization is a good idea. This way you can easily replicate your environment on different machines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend using Docker as well. I personally use &lt;a href=&quot;https://github.com/LaraDock/laradock&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laradock&lt;/a&gt; as development environment. But you could use other or build your own. Which I don't recommend for beginners. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is how to start:&#xA;Install Docker, install Docker Compose, download Laradock, configure it and start MySQL and Nginx/Apache. PHP starts automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: When you set up your DB connection in Craft's config remember it is not &lt;code&gt;localhost&lt;/code&gt; but &lt;code&gt;mysql&lt;/code&gt;. Because this is the name of the running MySQL container. &lt;/p&gt;&#xA;" OwnerUserId="5851" LastActivityDate="2018-04-23T05:56:51.413" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25814" PostTypeId="2" ParentId="25812" CreationDate="2018-04-23T10:01:17.337" Score="2" Body="&lt;p&gt;I'm afraid Craft 3 requires PHP 7. &lt;a href=&quot;https://docs.craftcms.com/v3/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/requirements.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 will work with older PHP versions  (5.3 to 7.1.x) so you could fall back to using that. &lt;a href=&quot;https://docs.craftcms.com/v2/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/requirements.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, I'd say you would need a different host in order to run Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-23T10:01:17.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25815" PostTypeId="1" CreationDate="2018-04-23T12:09:35.723" Score="1" ViewCount="722" Body="&lt;p&gt;I can't have a mess of craft stuff at the root of my server so I try to use the following directory structure, with craft files and folders gathered in a craft directory :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA;-- config&#xA;-- modules&#xA;-- storage&#xA;-- vendor&#xA;-- etc...&#xA;www&#xA;-- index.php&#xA;-- web.config&#xA;-- etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This structure gives me a 500 error.&#xA;I assume I can change a path variable somewhere, but I just can't find where. Any ideas ?&lt;/p&gt;&#xA;" OwnerUserId="7564" LastActivityDate="2018-05-23T13:04:52.277" Title="What changes are needed if I change directory structure?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25816" PostTypeId="2" ParentId="25815" CreationDate="2018-04-23T12:23:55.900" Score="1" Body="&lt;p&gt;You have to define the path to Craft in your &lt;code&gt;www/index.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', __DIR__ . '/../craft/' ); // &amp;lt;- in your case something like this&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The constant &lt;code&gt;CRAFT_BASE_PATH&lt;/code&gt; must point to your &lt;code&gt;/craft&lt;/code&gt; folder     &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-23T12:23:55.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25817" PostTypeId="2" ParentId="25815" CreationDate="2018-04-23T12:30:47.357" Score="1" Body="&lt;p&gt;You should not be placing Craft at the root of your server, ideally you would place it one level above the &lt;em&gt;Web Root&lt;/em&gt; directory, i.e. the one your domain name resolves to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, depending on your server OS you would need something like &lt;code&gt;var/www/example.com/craft/&lt;/code&gt; and &lt;code&gt;var/www/example.com/www/&lt;/code&gt; where &lt;code&gt;var/www/example.com/www/&lt;/code&gt; is the Web Root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to add, this is the structure Craft is configured to expect, out-of-the-box, but with the publicly acceesible folder being &lt;code&gt;public_html/&lt;/code&gt; rather than &lt;code&gt;www/&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-04-23T12:30:47.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25818" PostTypeId="1" AcceptedAnswerId="25819" CreationDate="2018-04-23T12:56:33.623" Score="0" ViewCount="60" Body="&lt;pre&gt;&lt;code&gt;public function actionMyPluginActionControllerIndex(){&#xA;    $this-&amp;gt;myPluginActionController($myVariable);&#xA;    return something;&#xA;}&#xA;&#xA;public function actionMyPluginActionController($myVariable)&#xA;{&#xA;    return something;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is giving me the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{&quot;error&quot;: &quot;Missing required parameters&quot;: myVariable&quot;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did exactly this with a craft 2 plugin, but somehow this doesn's seems to work in craft 3 anymore, what am i missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help will be appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="6623" LastActivityDate="2018-04-23T13:03:21.813" Title="Posting from controller to controllers with parameter gives an error" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25819" PostTypeId="2" ParentId="25818" CreationDate="2018-04-23T13:03:21.813" Score="0" Body="&lt;p&gt;You receive this error because &lt;code&gt;actionMyPluginActionController&lt;/code&gt; expects a variable in it's parameters. You'll have to declare a default value &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyPluginActionController($myVariable = null)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or you need to declare something in your &lt;code&gt;actionMyPluginActionControllerIndex&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyPluginActionControllerIndex(){&#xA;    $myVariable = 'foo';&#xA;    $this-&amp;gt;myPluginActionController($myVariable);&#xA;    return something;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unless you deactivated error messages/warnings on global level (via web config, dev mode off or something else), there is no way this would work in Craft 2 by default &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-23T13:03:21.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25821" PostTypeId="1" CreationDate="2018-04-23T14:51:18.377" Score="2" ViewCount="414" Body="&lt;p&gt;I have a Craft 3 plugin that renders a portion of an entry after save in order to index the resulting information. The plugin needs full access to the Twig extensions on the site to render the template, however several plugins that add such extensions check:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if( Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsSiteRequest() )&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result not all Twig extensions load when &lt;code&gt;renderTemplate&lt;/code&gt; is called from the control panel. I set the template mode using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_SITE)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that only updates the path to the template. Is it possible to render the template as if it were a site request?&lt;/p&gt;&#xA;" OwnerUserId="6709" LastActivityDate="2018-04-25T16:12:40.023" Title="Craft 3 – Render template as if it were a site request" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25822" PostTypeId="1" AcceptedAnswerId="25823" CreationDate="2018-04-23T15:30:28.947" Score="1" ViewCount="461" Body="&lt;p&gt;What would be the Craft 3 / Yii 2.0 version of&lt;br&gt;&#xA;&lt;code&gt;craft()-&amp;gt;urlManager-&amp;gt;setRouteVariables(array('calupdateResponse' =&amp;gt; $out));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't work (it doesn't complain, either):  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$urlManager = new UrlManager;&#xA;$urlManager-&amp;gt;setRouteParams(['calupdateResponse' =&amp;gt; $out]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-04-23T15:36:57.003" Title="Updating plugin to Craft 3: craft()-&gt;urlManager-&gt;setRouteVariables?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25823" PostTypeId="2" ParentId="25822" CreationDate="2018-04-23T15:36:57.003" Score="2" Body="&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getUrlManager()-&amp;gt;setRouteParams(['calupdateResponse' =&amp;gt; $out]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All &lt;code&gt;Components&lt;/code&gt; should be treated as singletons, don't create a new instance of them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: you can also do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;urlManager-&amp;gt;setRouteParams(['calupdateResponse' =&amp;gt; $out]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it is considered as &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/coding-guidelines.md#app-component-getters&quot; rel=&quot;nofollow noreferrer&quot;&gt;bad practice&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: most parts of Craft 3 are working with Craft 2 as well... &lt;code&gt;craft()&lt;/code&gt; is just a mapper for &lt;code&gt;Craft::$app&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-23T15:36:57.003" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25825" PostTypeId="1" CreationDate="2018-04-23T19:01:17.307" Score="1" ViewCount="926" Body="&lt;p&gt;I upgraded a Craft 2 project to Craft 3 and am working on updating some template quirks. One I am having trouble with involves the following element query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set scriptsAboutToExpire = craft.entries({&#xA;    section: 'scripts',&#xA;    order: 'expirationDate asc',&#xA;    expirationDate: [ 'and', '&amp;gt;=' ~ now, '&amp;lt;=' ~ now|date_modify('+2 weeks') ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This worked great in Craft 2. It grabs all &lt;code&gt;script&lt;/code&gt; entries whose &lt;code&gt;expirationDate&lt;/code&gt; field is two weeks away from today's date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However now after upgrading to Craft 3 I am getting the following error when viewing that template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP Recoverable Error – yii\base\ErrorException&#xA;Object of class DateTime could not be converted to string&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a highlight on this line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(isset($context[&quot;now&quot;]) || array_key_exists(&quot;now&quot;, $context) ? $context[&quot;now&quot;] : (function () { throw new Twig_Error_Runtime('Variable &quot;now&quot; does not exist.', 10, $this-&amp;gt;source); })())), 2 =&amp;gt; (&quot;&amp;lt;=&quot; . twig_date_modify_filter($this-&amp;gt;env, (isset($context[&quot;now&quot;]) || array_key_exists(&quot;now&quot;, $context) ? $context[&quot;now&quot;] : (function () { throw new Twig_Error_Runtime('Variable &quot;now&quot; does not exist.', 10, $this-&amp;gt;source); })()), &quot;+2 weeks&quot;))))), &quot;method&quot;);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried updating all &lt;code&gt;.localeDate()&lt;/code&gt; filters to &lt;code&gt;|date('short')&lt;/code&gt; but that had no effect.&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2020-11-18T16:26:47.877" Title="Craft 3: Error &quot;variable now does not exist&quot;" Tags="&lt;craft3&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25826" PostTypeId="2" ParentId="25825" CreationDate="2018-04-23T19:30:15.720" Score="2" Body="&lt;p&gt;You need to convert the &lt;code&gt;DateTime&lt;/code&gt; object via &lt;a href=&quot;https://craftcms.com/docs/3.x/dev/filters.html#date&quot; rel=&quot;nofollow noreferrer&quot;&gt;Filter&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; now|date('U') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or via function&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;now.format('U')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will format the date as a UNIX timestamp which is sufficient for querying. MySQL datetime format will work too: &lt;code&gt;date('Y-m-d H:i:s')&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;More info can be found in the &lt;a href=&quot;https://craftcms.com/docs/3.x/upgrade.html#currency-formatting&quot; rel=&quot;nofollow noreferrer&quot;&gt;upgrade documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2020-11-18T16:26:47.877" LastActivityDate="2020-11-18T16:26:47.877" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25827" PostTypeId="1" AcceptedAnswerId="25828" CreationDate="2018-04-23T21:33:12.753" Score="1" ViewCount="121" Body="&lt;p&gt;When I am on the categories index (admin/categories), is there a Garnish event that fires when you select a different category group in the sidebar? I want to add some custom JS after the AJAX request completes and the elements have been added to the page.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2018-04-23T22:15:00.823" Title="Garnish event when changing category group" Tags="&lt;categories&gt;&lt;javascript&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25828" PostTypeId="2" ParentId="25827" CreationDate="2018-04-23T21:49:16.393" Score="1" Body="&lt;pre&gt;&lt;code&gt;Craft.elementIndex.on('selectSource', function(){&#xA;     alert('changed the source');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;Craft.elementIndex&lt;/code&gt; contains the plugin for all index pages, that means all entries as well as users and categories. There is an &lt;code&gt;updateElements&lt;/code&gt; event as well..&lt;/p&gt;&#xA;&lt;p&gt;Here is a full list&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;afterInit&lt;/p&gt;&#xA;&lt;p&gt;selectSource&lt;/p&gt;&#xA;&lt;p&gt;selectSite&lt;/p&gt;&#xA;&lt;p&gt;updateElements&lt;/p&gt;&#xA;&lt;p&gt;selectionChange&lt;/p&gt;&#xA;&lt;p&gt;enableElements&lt;/p&gt;&#xA;&lt;p&gt;disableElements&lt;/p&gt;&#xA;&lt;p&gt;afterAction&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-04-23T22:15:00.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25829" PostTypeId="1" AcceptedAnswerId="25831" CreationDate="2018-04-24T02:34:09.083" Score="1" ViewCount="90" Body="&lt;p&gt;I see the following in BaseRelationField:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function settingsAttributes(): array&#xA;{&#xA;    $attributes = parent::settingsAttributes();&#xA;    $attributes[] = 'sources';&#xA;    $attributes[] = 'source';&#xA;    $attributes[] = 'targetSiteId';&#xA;    $attributes[] = 'viewMode';&#xA;    $attributes[] = 'limit';&#xA;    $attributes[] = 'selectionLabel';&#xA;    $attributes[] = 'localizeRelations';&#xA;&#xA;    return $attributes;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The comments for the properties say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   /**&#xA;     * @var string|string[]|null The source keys that this field can relate elements from (used if [[allowMultipleSources]] is set to true)&#xA;     */&#xA;    public $sources = '*';&#xA;&#xA;    /**&#xA;     * @var string|null The source key that this field can relate elements from (used if [[allowMultipleSources]] is set to false)&#xA;     */&#xA;    public $source;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the case of the single source. What would that string look like? What is that string referring to? A table name? In ID in a particular table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like the BaseRelationField is extended by Entries field and Users field and the sources are Entry structures and Administration groups respectively. If I wanted to set one as s static value what would that be?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-04-24T06:08:42.780" Title="What is $source and $sources in BaseRelationField?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25830" PostTypeId="2" ParentId="25779" CreationDate="2018-04-24T03:46:16.113" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But on my remote server it deleted two thirds of the tables in the db.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That sounds like some update failure happened, Craft tried to roll-back and restore the database from its pre-update attempt database backup because &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#restoreDbOnUpdateFailure&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#restoreDbOnUpdateFailure&lt;/a&gt; is set to &lt;code&gt;true&lt;/code&gt;, then &lt;em&gt;plot twist&lt;/em&gt; another failure happened before it could restored and left the database in an inconsistent state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are tons of reasons an update might fail to go through, and nearly as many for why a restore would fail, but a good place to start would be your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; files as well as your web server's log files.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-24T03:46:16.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25831" PostTypeId="2" ParentId="25829" CreationDate="2018-04-24T06:08:42.780" Score="1" Body="&lt;p&gt;In case of the element type &lt;code&gt;Asset&lt;/code&gt; sources are the available volumes. In case of &lt;code&gt;Category&lt;/code&gt; the available sources are the different groups. Sources for &lt;code&gt;Entry&lt;/code&gt; are your sections, &lt;code&gt;Tag&lt;/code&gt; have the different sets/groups as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains an array or the type &lt;code&gt;section&lt;/code&gt;, &lt;code&gt;folder&lt;/code&gt;, &lt;code&gt;group&lt;/code&gt; and the ID of the corresponding model, separated with an &lt;code&gt;:&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldById(&amp;gt;&amp;gt;your field id&amp;lt;&amp;lt;);&#xA;Craft::dd($field-&amp;gt;sources);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get to know how it looks like. It could be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(1) {&#xA;  [0]=&amp;gt; string(10) &quot;section:16&quot;&#xA;  [1]=&amp;gt; string(10) &quot;section:18&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or for an &lt;code&gt;Asset&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(1) {&#xA;  [0]=&amp;gt; string(8) &quot;folder:1&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-24T06:08:42.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25833" PostTypeId="1" AcceptedAnswerId="25835" CreationDate="2018-04-24T15:26:26.153" Score="0" ViewCount="585" Body="&lt;p&gt;This code worked fine in Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').limit(3) %}&#xA; {% set extraEntries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').offset(3) %}&#xA; {% if extraEntries | length %}&#xA;    //do some stuff&#xA; {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, &lt;code&gt;{{ extraEntries | length }}&lt;/code&gt; is giving a value a 1 even when there are no entries. For example, &lt;code&gt;{% for e in extraEntries %}&amp;gt;&amp;gt;&amp;gt;{{e}}{%endfor%}&lt;/code&gt; doesn't output anything. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="5557" LastEditDate="2018-04-24T15:58:43.863" LastActivityDate="2018-04-24T16:13:34.857" Title="Twig: length giving 1 on empty array?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25834" PostTypeId="2" ParentId="22568" CreationDate="2018-04-24T15:43:11.763" Score="0" Body="&lt;p&gt;What you could do is to use the &lt;code&gt;entries.onSaveEntry&lt;/code&gt; to override the ajax response of the EntriesController for your specific entry section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;actionSaveEntry&lt;/code&gt; from the EntriesController save the entry and immediately send back an ajax response so it is pretty harmless to do that. And if there is an error during the saving your code won't be called so Craft will follow its normal flow.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onSaveEntry', function (Event $event) {&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $section = $entry-&amp;gt;section-&amp;gt;handle;&#xA;&#xA;    if ($section == 'Your specific section') {&#xA;&#xA;       if (craft()-&amp;gt;request-&amp;gt;isAjaxRequest() &amp;amp;&amp;amp; !craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;          $return['success']   = true;&#xA;          $return['id']        = $entry-&amp;gt;id;&#xA;          $return['title']     = $entry-&amp;gt;title;&#xA;          $return['comment']     = $entry-&amp;gt;comment; // whatever you want&#xA;&#xA;          $return['authorUsername']      = $entry-&amp;gt;getAuthor()-&amp;gt;username;&#xA;          $return['dateCreated'] = DateTimeHelper::toIso8601($entry-&amp;gt;dateCreated);&#xA;          $return['dateUpdated'] = DateTimeHelper::toIso8601($entry-&amp;gt;dateUpdated);&#xA;          $return['postDate']    = ($entry-&amp;gt;postDate ? DateTimeHelper::toIso8601($entry-&amp;gt;postDate) : null);&#xA;&#xA;          craft()-&amp;gt;controller-&amp;gt;returnJson($return);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="7557" LastActivityDate="2018-04-24T15:43:11.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25835" PostTypeId="2" ParentId="25833" CreationDate="2018-04-24T15:56:38.203" Score="1" Body="&lt;p&gt;Because &lt;code&gt;extraEntries&lt;/code&gt; is not an array of elements but an object of type &lt;code&gt;EntryQuery&lt;/code&gt; in order to fetch the entries you have to do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set extraEntries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').offset(3).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It was actually the same in Craft 2 but the class had an &lt;code&gt;iterable&lt;/code&gt; and &lt;code&gt;countable&lt;/code&gt; interface, so when you do &lt;code&gt;|length&lt;/code&gt; it actually does &lt;code&gt;.total()&lt;/code&gt; (to execute the command and fetch the number of rows) These automatic mechanisms are removed/deprecated now thus you have to know what kind of object you use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you take a look at your cp you'll see a bunch of deprecated warnings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to read the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-queries.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-24T16:13:34.857" LastActivityDate="2018-04-24T16:13:34.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25836" PostTypeId="1" AcceptedAnswerId="25837" CreationDate="2018-04-24T17:08:05.303" Score="0" ViewCount="790" Body="&lt;p&gt;I have a channel called 'projects'. &#xA;This channel has two &lt;code&gt;entries fields&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;relatedThemes&lt;/li&gt;&#xA;&lt;li&gt;relatedAreas&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I want to do is perform a search query which filters all projects where the &lt;code&gt;relatedThemes&lt;/code&gt; field has an entry with a certain &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured out how to search custom fields. Here's an example of a filter with a plain text field with a handle &lt;code&gt;test&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'projects'&#xA;}).search('test:testValue') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns all project entries where the &lt;code&gt;test&lt;/code&gt; field has the &lt;code&gt;testValue&lt;/code&gt; value, as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't seem to make this work with an entries field. I thought I could do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'projects'&#xA;}).search('entriesfield.id:relatedThemesID') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important thing is that I &lt;strong&gt;&lt;em&gt;can't actually use template logic&lt;/em&gt;&lt;/strong&gt;, because the query is to be used in the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;element api&lt;/a&gt; (for Craft 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not a backend dev, so I test the &lt;code&gt;criteria&lt;/code&gt; array in templates first and then convert it to php. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the correct criteria array for the test text field would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;  'section' =&amp;gt; 'projects',&#xA;  'test' =&amp;gt; 'testValue'&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8292" LastActivityDate="2018-04-24T18:12:39.793" Title="Get all entries with linked entry in entries field" Tags="&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;&lt;query&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25837" PostTypeId="2" ParentId="25836" CreationDate="2018-04-24T18:07:25.537" Score="1" Body="&lt;p&gt;Have you read the docs about &lt;a href=&quot;https://docs.craftcms.com/v2/relations.html#the-relatedTo-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; 'projects', &#xA;    'test' =&amp;gt; 'testValue' &#xA;    'relatedTo' =&amp;gt; id&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just replace &lt;code&gt;id&lt;/code&gt; with the ID of your element &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to filter a specific field you have to include it as an array &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'relatedTo' =&amp;gt; [&#xA;    'sourceElement' =&amp;gt; id,&#xA;    'field' =&amp;gt; 'fieldHandle'&#xA;] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-24T18:12:39.793" LastActivityDate="2018-04-24T18:12:39.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25840" PostTypeId="1" AcceptedAnswerId="25867" CreationDate="2018-04-24T21:38:30.900" Score="1" ViewCount="655" Body="&lt;p&gt;I have a categories field on an entry that can have one or many children. I am able to output everything - but would like to restrict the field a bit more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a child has been selected, I do not want to show the parent. In my example, I only want to show &quot;child&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible, that I might only choose &quot;parent&quot; and I only want that to show. Or, is there a different way I should go about doing this? Thank you for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MgvWR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MgvWR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for service in entry.servies %}&#xA;   {% set subCategories = craft.categories.descendantOf(service) %}&#xA;&#xA;   {% if subCategories|length %}&#xA;       ...&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that will show the child category if it's selected or not. I would only like to show the &quot;Child&quot; category if it was actually selected. Otherwise, show the &quot;parent&quot; category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE/SOLUTION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I want to thank Robin for your help. I tried different variations and was unsuccessful. I ended up taking my existing category and making it a structure. This gave me the flexibility that I needed.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-04-26T01:17:44.570" LastActivityDate="2020-02-29T07:47:20.980" Title="How can I show the child category and not it's parent - but other times show it's parent?" Tags="&lt;categories&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25841" PostTypeId="2" ParentId="25840" CreationDate="2018-04-24T22:27:46.480" Score="1" Body="&lt;p&gt;You can change the sort order in your &lt;code&gt;CategoryQuery&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set child = entry.getFieldValue('servies').orderBy('level DESC').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns the category of the deepest level -&gt; the child. If no child is selected you'll receive the parent&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-24T22:27:46.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25842" PostTypeId="1" CreationDate="2018-04-25T01:17:05.427" Score="0" ViewCount="178" Body="&lt;p&gt;We have a page where a user may use one form to login to their Craft account on the front end - and one form where they can create and account. See the page here: &lt;a href=&quot;https://www.cadex.com/shop/account/login/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cadex.com/shop/account/login/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the template code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;div class=&quot;login&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;Login To Your Account&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;div class=&quot;intro&quot;&amp;gt;&#xA;                Please login to your account below.&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            {% if craft.request.getSegment(3) == &quot;logged-out&quot; %}&#xA;                &amp;lt;div class=&quot;confirmMsg remove&quot;&amp;gt;You have been logged out of your account.&amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            {% if craft.request.getSegment(3) == &quot;password&quot; %}&#xA;                &amp;lt;div class=&quot;confirmMsg remove&quot;&amp;gt;Your password has been successfully reset.&amp;lt;/div&amp;gt;&#xA;            {% endif %}&#xA;&#xA;            &amp;lt;form id=&quot;loginForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;                {% if errorMessage is defined %}&#xA;                    &amp;lt;div class=&quot;errorMsg&quot;&amp;gt;{{ errorMessage }}&amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;                {{ getCsrfInput() }}&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Email &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input placeholder=&quot;Email&quot; name=&quot;loginName&quot; value=&quot;&quot; data-parsley-type=&quot;email&quot; data-parsley-required=&quot;true&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input type=&quot;password&quot; placeholder=&quot;Password&quot; name=&quot;password&quot; value=&quot;&quot; data-parsley-required=&quot;true&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;footer&amp;gt;&#xA;                    &amp;lt;button type=&quot;submit&quot;&amp;gt;Login&amp;lt;/button&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ siteUrl }}account/reset-request&quot;&amp;gt;Forgot Password?&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/footer&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;create&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;Don't Have An Account?&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;div class=&quot;intro&quot;&amp;gt;&#xA;                Create an account below and benefit from quicker checkouts, order histories and more!&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;form id=&quot;createForm&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;                {% macro errorList(errors) %}&#xA;                    {% if errors %}&#xA;                            {% for error in errors %}&#xA;                                &amp;lt;div class=&quot;errorMsg&quot;&amp;gt;{{ error }}&amp;lt;/div&amp;gt;&#xA;                            {% endfor %}&#xA;                    {% endif %}&#xA;                {% endmacro %}&#xA;                {% from _self import errorList %}&#xA;&#xA;                {% if account is defined %}&#xA;                    {{ errorList(account.getErrors('email')) }}&#xA;                {% endif %}&#xA;&#xA;                {% if account is defined %}&#xA;                    {{ errorList(account.getErrors('password')) }}&#xA;                {% endif %}&#xA;&#xA;                {{ getCsrfInput() }}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ siteUrl }}account/signup-sent&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Email &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input id=&quot;signupEmail&quot; name=&quot;email&quot; placeholder=&quot;Email&quot; value=&quot;&quot; data-parsley-type=&quot;email&quot; data-parsley-required=&quot;true&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Confirm Email &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input id=&quot;confirmEmail&quot; placeholder=&quot;Confirm Email&quot; value=&quot;&quot; data-parsley-type=&quot;email&quot; data-parsley-required=&quot;true&quot; data-parsley-equalto=&quot;#signupEmail&quot; data-parsley-equalto-message=&quot;Both emails must match&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input name=&quot;password&quot; id=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;Password&quot; value=&quot;&quot; data-parsley-required=&quot;true&quot; data-parsley-minlength=&quot;6&quot; data-parsley-minlength-message=&quot;Password must be 6 characters or longer&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;input&quot;&amp;gt;&#xA;                    &amp;lt;label&amp;gt;Confirm Password &amp;lt;span&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;                    &amp;lt;input name=&quot;confirmPassword&quot; id=&quot;confirmPassword&quot; type=&quot;password&quot; placeholder=&quot;Confirm Password&quot; value=&quot;&quot; data-parsley-required=&quot;true&quot; data-parsley-equalto=&quot;#password&quot; data-parsley-equalto-message=&quot;Both passwords must match&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[accountReceiveEmails]&quot; value=&quot;&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;checkbox&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[accountReceiveEmails][]&quot; value=&quot;yes&quot; id=&quot;emailOptin&quot;&amp;gt;&#xA;                    &amp;lt;label for=&quot;emailOptin&quot;&amp;gt;&amp;lt;span class=&quot;checkbox&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;Yes, I would also like to receive offers, discounts and news for Cadex products by email.&amp;lt;/label&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;footer&amp;gt;&#xA;                    &amp;lt;button&amp;gt;Create Account&amp;lt;/button&amp;gt;&#xA;                &amp;lt;/footer&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The login form posts to: &lt;code&gt;users/login&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The create an account form posts to: &lt;code&gt;users/saveUser&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page has been working fine for the last year since the site launched and people have been creating accounts. However, sometime in the last 7 days something changed. We were alerted to the fact that users could not create accounts. When attempting to fill out the Create Account form, what happens now is an error gets returned for the Login form (try creating an account with any creds and see on the page url above). In the Craft logs, the following happens as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-04-24 17:36:31&#xA;&#xA;Level   warning&#xA;Category    application&#xA;Message tried to log in unsuccessfully.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it seems like suddenly the Create form is posting to &lt;code&gt;login&lt;/code&gt;? There aren't any other errors we can see to explain this in the server logs or client-side. There have been no updates to any code, plugins or Craft during this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oddly though, it looks like the correct data is getting posted. This is from the Craft logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$_POST=array (&#xA;'CRAFT_CSRF_TOKEN' =&amp;gt; 'PGqJcG8ibNiBV8tNAeXsUl~2U2W7e9YHVo0YxaN6'&#xA;'action' =&amp;gt; 'users/saveUser'&#xA;'redirect' =&amp;gt; 'https://www.cadex.com/shop/account/signup-sent'&#xA;'email' =&amp;gt; 'test1@coalescentdesign.com'&#xA;'password' =&amp;gt; REDACTED&#xA;'confirmPassword' =&amp;gt; 'password'&#xA;'fields' =&amp;gt;&#xA;array (&#xA;'accountReceiveEmails' =&amp;gt; ''&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Further, we have a staging version of this website where this issue does not happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas anyone on what could be causing such unusual behaviour?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Is it possible Craft forces this post? We found this in `craft/app/services/HttpRequestService.php`:&#xA;&#xA;$loginPath = trim(craft()-&amp;gt;config-&amp;gt;getLocalized('loginPath'), '/');&#xA;...&#xA;if ($this-&amp;gt;_path == $loginPath)&#xA;{&#xA;$this-&amp;gt;_actionSegments = array('users', 'login');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And our login path is set to: &lt;code&gt;account/login'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still puzzled though... why was this working - and still works in staging?&lt;/p&gt;&#xA;" OwnerUserId="781" LastEditorUserId="781" LastEditDate="2018-04-26T16:07:43.367" LastActivityDate="2018-04-26T16:07:43.367" Title="saveUser form action posting elsewhere?" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25843" PostTypeId="2" ParentId="25821" CreationDate="2018-04-25T07:00:04.350" Score="1" Body="&lt;p&gt;I suspect not without manually manipulating the path before the Request class is initialised. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible alternative solution would be to use Guzzle to call the front-end URL rather than the CP URL, which will render the template with &lt;code&gt;getIsSiteRequest&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt;, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$client = new \GuzzleHttp\Client();&#xA;$response = $client-&amp;gt;request('get', 'http://url/front-end-template');&#xA;$body = $response-&amp;gt;getBody();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would also be possible to create your own controller which fetches the template and to hit it with a front-end action request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$response = $client-&amp;gt;request('get', 'http://url/actions/plugin/controller/action');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2018-04-25T16:12:40.023" LastActivityDate="2018-04-25T16:12:40.023" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25844" PostTypeId="1" AcceptedAnswerId="25845" CreationDate="2018-04-25T11:01:56.063" Score="0" ViewCount="185" Body="&lt;p&gt;On a Craft site that uses the Dukt Twitter plugin I have started seeing SQL errors when saving certain entries that use Twitter data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x93\xB8co...' for column 'keywords' at row 1. The SQL statement executed was: INSERT INTO `craft_searchindex` (`elementId`, `attribute`, `fieldId`, `locale`, `keywords`) VALUES (:elementId, :attribute, :fieldId, :locale, :keywords) ON DUPLICATE KEY UPDATE `keywords` = :keywords. Bound with :elementId='10', :attribute='field', :fieldId='111', :locale='en_gb', :keywords=' lots of keywords here... '&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within the keywords field is an emoji character that actually shows up when Twig throws the error. I've been researching the issue and it appears to be related to the collation of the DB tables and 4 byte UTF-8 characters, currently all the DB tables are &lt;code&gt;utf8_unicode_ci&lt;/code&gt;, potentially changing this to something like &lt;code&gt;utf8mb4&lt;/code&gt; should work in theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what doesn't make sense is the same collation is being used on our staging environment and the error does not occur when saving and its the exact same data. Initially I thought this was due to the schema of the database being different, but I tried recreating my local DB with the same schema matching our staging and re-importing the tables, but the error still happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm slightly confused as what the key difference is with our staging environment compared to local dev. Looking at our hosting provider, it seems the MySQL version if 5.6, where as on my local dev its 5.7.22, so this is a key area potentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it does raise the overall question as what is the best course of action for emoji support on Craft 2, should all the tables be changed to &lt;code&gt;utf8mb4&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-04-25T12:00:41.637" LastActivityDate="2018-06-24T13:53:29.077" Title="Craft 2.6 incorrect string value SQL error for 4 byte UTF-8 characters when saving entries" Tags="&lt;mysql&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25845" PostTypeId="2" ParentId="25844" CreationDate="2018-04-25T12:06:42.950" Score="0" Body="&lt;p&gt;So it looks like our Craft site had an older version of the Dukt Twitter plugin installed. In a newer version it looks like the Twitter keywords have been handled better with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;return StringHelper::encodeMb4($keywords);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is similar to the same work done in the Craft core files for emojis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/1627&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1627&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updating the plugin seems to have solved the issue saving on my local development environment, so not a direct answer, but a better solution than messing around with the the DB schema/collation.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-04-25T13:00:07.600" LastActivityDate="2018-04-25T13:00:07.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25846" PostTypeId="1" CreationDate="2018-04-25T12:16:08.997" Score="2" ViewCount="924" Body="&lt;p&gt;i wanted update a new installed craft3 and got this message:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uvU5l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvU5l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a look in the web.log file. The first line from today gives an error:&#xA;2018-04-25 03:39:23 [85.7.133.198][-][-][error][yii\base\InvalidConfigException] yii\base\InvalidConfigException: Unsupported DB driver value:  in /home/velolade/craft3/vendor/craftcms/cms/src/config/DbConfig.php:187&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's wrong here?&#xA;Thank you in advance for help!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2018-10-27T05:00:25.927" Title="Craft 3 update failure" Tags="&lt;craft3&gt;&lt;database&gt;&lt;updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25847" PostTypeId="1" CreationDate="2018-04-25T12:53:36.073" Score="1" ViewCount="117" Body="&lt;p&gt;Does anyone have any experience with adding file uploads to the add to cart forms on product pages within commerce? I've seen some examples of users &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15412/craft-commerce-upload-file-field-in-order?utm_medium=organic&amp;amp;utm_source=google_rich_qa&amp;amp;utm_campaign=google_rich_qa&quot;&gt;attaching them to orders&lt;/a&gt; (didn't work for me), but I'm looking to give customers the ability to attach per each line item.&lt;/p&gt;&#xA;" OwnerUserId="8297" LastActivityDate="2018-11-02T18:55:26.850" Title="Adding file uploads to commerce product line items?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25848" PostTypeId="2" ParentId="25847" CreationDate="2018-04-25T14:10:58.813" Score="1" Body="&lt;p&gt;You will not be able to upload an asset into a line item at Commerce 1 or 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only 2 options are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Upload the asset to an order custom field(s). Submit a new question with your code if this is not working for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Upload the asset anywhere else, (including optionally the order), and then put the URL of the asset into the line items &lt;code&gt;options&lt;/code&gt; data. See &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="9" LastEditDate="2018-11-02T18:55:26.850" LastActivityDate="2018-11-02T18:55:26.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25849" PostTypeId="1" AcceptedAnswerId="25852" CreationDate="2018-04-25T14:17:44.723" Score="1" ViewCount="350" Body="&lt;p&gt;I seem to be missing the users panel in the CMS. Any idea where it could have gone? For adding new users, groups etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DKw6M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DKw6M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am a bit confused, and new to craft. So, sorry if this is painfully obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank-you&lt;/p&gt;&#xA;" OwnerUserId="8299" LastActivityDate="2018-04-25T14:51:17.140" Title="Missing Users tab in CMS" Tags="&lt;users&gt;&lt;admin&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25850" PostTypeId="1" CreationDate="2018-04-25T14:44:08.033" Score="1" ViewCount="324" Body="&lt;p&gt;I'm having the following layout on a page: a messages page that shows events and news that are grouped in a section called messages. The page starts with current events, then upcoming events and finishes with all messages (old events and news). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The queries i need to run:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Current events&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;section &lt;strong&gt;messages&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;entry type &lt;strong&gt;event&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;where &lt;strong&gt;startdate is = or &amp;lt; now&lt;/strong&gt; (starting today or earlier)&lt;/li&gt;&#xA;&lt;li&gt;and &lt;strong&gt;enddate is = or &gt; now&lt;/strong&gt; (ending today or later)&lt;/li&gt;&#xA;&lt;li&gt;ordered by &lt;strong&gt;startdate&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Upcoming events&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;section &lt;strong&gt;messages&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;entry type &lt;strong&gt;event&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;where &lt;strong&gt;startdate is &gt; now&lt;/strong&gt; (starting later than today)&lt;/li&gt;&#xA;&lt;li&gt;ordered by &lt;strong&gt;startdate&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All messages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;section &lt;strong&gt;messages&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;entry type &lt;strong&gt;all&lt;/strong&gt; (event and news)&lt;/li&gt;&#xA;&lt;li&gt;that exclude &lt;strong&gt;current events&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;and exclude &lt;strong&gt;upcoming events&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;with &lt;strong&gt;pagination&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My current code where some parts are working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Current events&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section(&quot;messages&quot;).type(&quot;event&quot;).orderBy('startDate asc').all() %}&#xA;{% for entry in entries %}&#xA;  {% if entry.startDate &amp;lt; now and entry.endDate &amp;gt; now  %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Upcoming events&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('messages').type(&quot;event&quot;).orderBy('startDate asc').all() %}&#xA;{% for entry in entries %}&#xA;  {% if entry.startDate &amp;gt; now %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;  {% endif %}          &#xA;{% endfor %}&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All messages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section(&quot;messages&quot;).limit(9) as pageInfo, pageEntries %}&#xA;{% for entry in pageEntries %}&#xA;  &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;ul&amp;gt;&#xA;  {% for page, url in pageInfo.getPrevUrls(5) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;    &amp;lt;li&amp;gt;{{ pageInfo.currentPage }}&amp;lt;/li&amp;gt;&#xA;  {% for page, url in pageInfo.getNextUrls(5) %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Two questions i have:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do i query current events so startDate is &amp;lt; AND =? And endDate is &gt; AND =?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how do i query all messages (news and events), excluding current and upcoming events but with past events?&lt;/p&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2018-05-26T21:39:54.100" Title="Query section entries based on start/end date and type" Tags="&lt;query&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25851" PostTypeId="2" ParentId="25849" CreationDate="2018-04-25T14:47:40.717" Score="0" Body="&lt;p&gt;Are you logged in with a Super Admin account or a different account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your user/group permissions you may or may not have access to the Users section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log in as a Super Admin and check the permissions for the group/account that you had originally logged in as.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-04-25T14:47:40.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25852" PostTypeId="2" ParentId="25849" CreationDate="2018-04-25T14:51:17.140" Score="3" Body="&lt;p&gt;Based on your screenshot, you're using the &lt;code&gt;Personal&lt;/code&gt; version of Craft, which only allows for one user, which is why you won't see a Users section in the sidebar or the Settings screen. If you upgrade your install to &lt;code&gt;Client&lt;/code&gt; or &lt;code&gt;Pro&lt;/code&gt; you'll see those Users sections appear &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth a note, in Craft 3 and the latest version of Craft 2, the editions have been renamed to &lt;code&gt;Solo&lt;/code&gt; and &lt;code&gt;Pro&lt;/code&gt;. &lt;code&gt;Solo&lt;/code&gt; is just like &lt;code&gt;Personal&lt;/code&gt;: only one user allowed, whereas &lt;code&gt;Pro&lt;/code&gt; allows for more than one user.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-04-25T14:51:17.140" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25853" PostTypeId="1" CreationDate="2018-04-25T15:13:08.053" Score="1" ViewCount="51" Body="&lt;p&gt;I got this kind of object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\RichTextData Object&#xA;(&#xA;    [_pages:Craft\RichTextData:private] =&amp;gt; &#xA;    [_rawContent:Craft\RichTextData:private] =&amp;gt; &#xA;    Standard Rate:  Cancellation policy is 24 hours prior to 11.00am &#xA;        on day of arrival.&#xA;&#xA;    [content:protected] =&amp;gt; &#xA;    Standard Rate:  Cancellation policy is 24 hours prior to 11.00am &#xA;        on day of arrival.&#xA;&#xA;    [charset:protected] =&amp;gt; UTF-8&#xA; )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone help me to get the text out from this ?&lt;/p&gt;&#xA;" OwnerUserId="8300" LastEditorUserId="57" LastEditDate="2018-04-28T18:37:14.203" LastActivityDate="2018-04-28T18:37:14.203" Title="Getting properties out from the Craft text object" Tags="&lt;richtext&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25854" PostTypeId="2" ParentId="25853" CreationDate="2018-04-25T15:25:16.457" Score="2" Body="&lt;p&gt;This Object has a &lt;code&gt;__toString&lt;/code&gt; function that executes &lt;code&gt;return $this-&amp;gt;content;&lt;/code&gt;. &#xA;If you are in a template just do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can call the function &lt;code&gt;getParsedContent&lt;/code&gt; as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.getParsedContent() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In PHP&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$text = $object-&amp;gt;getParsedContent();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-25T15:25:16.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25855" PostTypeId="1" AcceptedAnswerId="25869" CreationDate="2018-04-25T15:32:10.273" Score="1" ViewCount="604" Body="&lt;p&gt;First time I'm going to use Ajax with Craft CMS therefore I'm still confused how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need is this, when I click on a specified link  in the front, I need the CMS to load some entry/entries and display the data in a popup on the same page of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CSS for the popup is ready, the HTML too (static for now, not twig template) the backoffice also is ready.  The only thing I need is how to get the entries (basic explanation if possible) with ajax (It seems to be the best solution) and load them into the page then show them in a popup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any link(s) to help in my task or someone to explain those first steps please ?&lt;/p&gt;&#xA;" OwnerUserId="6603" LastEditorUserId="57" LastEditDate="2018-04-28T18:55:50.997" LastActivityDate="2018-04-28T18:55:50.997" Title="Load new entry(s) in the same page with ajax as a popup" Tags="&lt;templating&gt;&lt;ajax&gt;&lt;craft.entries&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25856" PostTypeId="1" CreationDate="2018-04-25T15:46:47.777" Score="0" ViewCount="75" Body="&lt;p&gt;When &lt;code&gt;isSystemOn =&amp;gt; false&lt;/code&gt; in the general config; and the user is &lt;strong&gt;not&lt;/strong&gt; logged in. Going to the homepage does not redirect users to the 503 template (holding page). All other pages redirect as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal behaviour or a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'm using Craft CMS 3.0.3.1&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-04-25T15:46:47.777" Title="No redirect to 503 from the homepage when system is off" Tags="&lt;craft3&gt;&lt;redirect&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25858" PostTypeId="1" AcceptedAnswerId="25861" CreationDate="2018-04-25T17:01:04.203" Score="1" ViewCount="170" Body="&lt;p&gt;I'm working on a multilingual website (Spanish and English, default is Spanish). I'm using the SEOmatic plugin, and I see that it generates this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;alternate&quot; hreflang=&quot;es&quot; href=&quot;http://localhost:8888/cmml/contacto&quot; /&amp;gt;&#xA;&amp;lt;link rel=&quot;alternate&quot; hreflang=&quot;en&quot; href=&quot;http://localhost:8888/cmml/en/contact-us&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'm wondering if, instead of linking to the home page in an alternate language is there a way to link to the same resource in the alternate language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an &lt;em&gt;easy&lt;/em&gt; way to achieve this? Thanks folks.&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="5275" LastEditDate="2018-04-28T18:43:08.050" LastActivityDate="2018-04-28T18:43:08.050" Title="Dynamic link to same entry but in alternate language" Tags="&lt;localization&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25859" PostTypeId="1" CreationDate="2018-04-25T17:39:16.757" Score="0" ViewCount="236" Body="&lt;p&gt;In ExpressionEngine it was possible to have fields side by side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vgcmQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vgcmQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when creating a entry you had all options (for example for an image) in one row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WFw93.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WFw93.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to do that in Craft&lt;/p&gt;&#xA;" OwnerUserId="8301" LastActivityDate="2018-04-25T17:50:06.120" Title="Fields (Matrix) side by side?" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;field&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25860" PostTypeId="2" ParentId="25859" CreationDate="2018-04-25T17:50:06.120" Score="2" Body="&lt;p&gt;I think the easiest way to replicate this behaviour, is to use the &lt;a href=&quot;https://github.com/verbb/super-table&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table plugin&lt;/a&gt;. It lets you create all of Craft's fields within table rows.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-04-25T17:50:06.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25861" PostTypeId="2" ParentId="25858" CreationDate="2018-04-25T18:38:20.213" Score="2" Body="&lt;p&gt;Both SEOmatic for Craft 2 and SEOmatic for Craft 3 have built-in functions to give you these URLs. I'm not sure which you are using so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 2: &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#getlocalizedurls&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&amp;amp;-Functions#getlocalizedurls&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 3: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-04-25T18:38:20.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25862" PostTypeId="1" CreationDate="2018-04-25T18:46:03.613" Score="3" ViewCount="442" Body="&lt;p&gt;I'm not sure if this is a bug or I'm doing this wrong. I have an asset volume called &quot;Blog Images&quot; and there is a custom required field called Image alt text. If I add images in assets section I'm required to put something in for the alt text, that's good because that what I intended. But I'm using a matrix block that has an asset field that looks to this volume and I am able to upload and image to this volume and not add anything in this field. What am I doing wrong? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I should mention this is using Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="57" LastEditDate="2018-04-28T18:43:56.880" LastActivityDate="2019-09-04T13:39:44.923" Title="Required alt text field in assets" Tags="&lt;assets&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25864" PostTypeId="1" AcceptedAnswerId="25865" CreationDate="2018-04-25T22:46:33.713" Score="1" ViewCount="491" Body="&lt;p&gt;Trying to display the author photo of the entry (it's there for sure).  The Craft 2 way I used &lt;strong&gt;entry.author.photoUrl&lt;/strong&gt; but that is not working so I tried &lt;strong&gt;entry.author.photo.url&lt;/strong&gt; and that does not show anything and no error or warnings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is what I am doing correct?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-04-28T18:45:17.457" Title="Craft 3 Author Photo" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25865" PostTypeId="2" ParentId="25864" CreationDate="2018-04-25T23:17:57.910" Score="4" Body="&lt;pre&gt;&lt;code&gt;{{ entry.getAuthor().getPhoto().getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/elements/User.php#L1180&quot; rel=&quot;nofollow noreferrer&quot;&gt;function&lt;/a&gt;. Of course if the author has no photo you'll receive nothing (but an exception). Furthermore this function returns the URL not a HTML tag. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2018-04-28T18:45:17.457" LastActivityDate="2018-04-28T18:45:17.457" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25866" PostTypeId="2" ParentId="23076" CreationDate="2018-04-26T00:08:25.800" Score="3" Body="&lt;p&gt;Go into the Plugins Sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and install the plugin with the name &lt;strong&gt;Redactor&lt;/strong&gt;&lt;a href=&quot;https://i.stack.imgur.com/dlpwO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dlpwO.png&quot; alt=&quot;Redactor Plugin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And everything will be back to normal.&lt;/p&gt;&#xA;" OwnerUserId="8304" LastActivityDate="2018-04-26T00:08:25.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25867" PostTypeId="2" ParentId="25840" CreationDate="2018-04-26T01:18:40.373" Score="1" Body="&lt;p&gt;Instead of a category, try creating each service within a structure. Then use an &lt;code&gt;entries&lt;/code&gt; field to establish the relationship within the CP.&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-04-26T01:18:40.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25868" PostTypeId="1" CreationDate="2018-04-26T02:13:23.853" Score="1" ViewCount="124" Body="&lt;p&gt;ENVIRONMENT: Craft 2, Sprout SEO 3.4.2, Bob Olde Hampsink's &quot;Tag Manager&quot; plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site has a bunch of articles organized by category and tags, and I've got a template for showing articles by tag (ex: &lt;a href=&quot;https://www.therapyinphiladelphia.com/tips/tag/employment/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.therapyinphiladelphia.com/tips/tag/employment/&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Sprout SEO I've &quot;Enabled Meta Details fields&quot; and attached them to Craft's TAGS using the Tag Manager plugin. This allows me to insert custom metadata for each TAG just like I would on a normal Craft entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in theory the &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt; template tag on my &quot;articles by tag&quot; template should pick up the custom values entered into the Sprout SEO meta details fields for the tag... just like it would for a normal entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However it's not picking up anything, it just reverts to the Globals set under Sprout SEO's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To debug I've done a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Under Sprout SEO &gt; Settings &gt; Advanced &gt; Enabled custom metadata variable (giving it the name &lt;code&gt;metadata&lt;/code&gt;), and&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;turned on Craft's dev mode and echoed &lt;code&gt;{{ dump(metadata) }}&lt;/code&gt; into the template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The output of &lt;code&gt;{{ dump(metadata) }}&lt;/code&gt; shows the Globals set under Sprout SEO's settings and not the custom metadata entered into the Tag Manager for the selected tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried using the &lt;code&gt;{% do craft.sproutSeo.meta() %}&lt;/code&gt; function to manually override the automatic output of the &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt; template tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # ARTICLES BY TAG TEMPLATE&#xA; #}&#xA;&#xA;{% sproutseo 'optimize' %}&#xA;&#xA;    {% do craft.sproutSeo.meta({ &#xA;      section: 'Self Help Tips',&#xA;      title: tag.title,&#xA;      description: metadata.metaDescription|striptags|slice(0, 150),&#xA;      canonical: craft.request.url,&#xA;      ogTitle: tag.title,&#xA;      ogType: 'article',&#xA;      ogUrl: craft.request.url,&#xA;      ogImage: metaImage.url(),&#xA;      ogImageWidth: metaImage.width,&#xA;      ogImageHeight: metaImage.height,&#xA;      ogImageType: metaImage.mimeType,&#xA;      ogSiteName: siteName,&#xA;      ogDescription: metadata.description,&#xA;      twitterCard: 'summary',&#xA;      twitterSite: '@twitteruser',&#xA;      twitterCreator: '@twitteruser',&#xA;      twitterTitle: tag.title,&#xA;      twitterDescription: meta.search.description,&#xA;      twitterUrl: craft.request.url,&#xA;      twitterImage: metaImage.url()&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works if I enter hardcoded strings in, but the &lt;code&gt;metadata&lt;/code&gt; variable in the template doesn't pick up the custom metadata entered for the tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug? Is the Sprout SEO plugin only set up to work with ENTRIES, and not TAGS?&lt;/p&gt;&#xA;" OwnerUserId="4932" LastActivityDate="2018-06-30T01:23:02.363" Title="Sprout SEO 3 with Craft Tags" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25869" PostTypeId="2" ParentId="25855" CreationDate="2018-04-26T08:06:34.790" Score="3" Body="&lt;p&gt;First: you need to create a Plugin, I suggest you to use &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; to create your boilerplate and read the docs about &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/introduction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin development&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need an ajax Request that could look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#a-button').click(function(){&#xA;    var data = {&#xA;        entryIds: [1,2,3,4], // &amp;lt;- insert the id(s) of the entries you want to render&#xA;        action: 'pluginName/controllerName/renderTemplate', // &amp;lt;-- route to your controller&#xA;        templatePath: 'path/to/template'&#xA;    };&#xA;    $.ajax({&#xA;        type: &quot;post&quot;,&#xA;        url: '',&#xA;        data: data,&#xA;        success: function (response) {&#xA;            if(response.success === true){&#xA;                $('#a-container').html(response.html);&#xA;            }else{&#xA;                alert(response.message);&#xA;            }&#xA;        },&#xA;        error: function (XMLHttpRequest, textStatus) {&#xA;            console.log(&quot;Status: &quot; + textStatus);&#xA;        }&#xA;    });    &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll insert this function in your controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @throws \Craft\Exception&#xA; */&#xA;public function actionRenderTemplate()&#xA;{&#xA;    $success = false;&#xA;    $message = Craft::t('Could not find template path');&#xA;    $html = '';&#xA;&#xA;    // check for a template path&#xA;    if ($templatePath = craft()-&amp;gt;request-&amp;gt;getParam('templatePath')) {&#xA;        // check for entry ids&#xA;        if($entryIds = craft()-&amp;gt;request-&amp;gt;getParam('ids')){&#xA;            // fetch all entries with the ids&#xA;            $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;            $criteria-&amp;gt;id = $entryIds;&#xA;            $elements = $criteria-&amp;gt;find();&#xA;&#xA;            // render the template&#xA;            $html = craft()-&amp;gt;templates-&amp;gt;render($templatePath, ['elements' =&amp;gt; $elements]);    &#xA;            $success = true;&#xA;        }else{&#xA;            $message = Craft::t('Could not find required entry id parameter');&#xA;        }&#xA;    }&#xA;&#xA;    // return as json&#xA;    $this-&amp;gt;returnJson(&#xA;        [&#xA;            'success' =&amp;gt; $success,&#xA;            'message' =&amp;gt; $message,&#xA;            'html'    =&amp;gt; $html&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-26T08:06:34.790" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25871" PostTypeId="1" AcceptedAnswerId="25873" CreationDate="2018-04-26T13:22:15.470" Score="2" ViewCount="88" Body="&lt;p&gt;To test a service method, I'm executing it in my init function. The method adds a row to the database table with a mail address and variant id:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;waitingListService-&amp;gt;add(7, 'email@mailserver.com');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I refresh a page in the control page to execute the plugin init function 2, or sometimes 3 rows are being added to the database table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the default behaviour and if not, how can I fix it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;Sam&lt;/p&gt;&#xA;" OwnerUserId="8224" LastActivityDate="2018-04-26T14:09:52.320" Title="Plugin init function executed more than once" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25872" PostTypeId="1" CreationDate="2018-04-26T13:52:44.290" Score="1" ViewCount="214" Body="&lt;p&gt;Craft 3 version 3.0.4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When logging into the admin panel on Craft3 for some reason I'm getting a Yii2 PHP Warning for missing icons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Warning – yii\base\ErrorException&#xA;file_get_contents(&amp;lt;pathtocraft&amp;gt;/craft/vendor/craftcms/cms/src/icons/c.svg): failed to open stream: No such file or directory&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason this icons folder is not being generated when installing craft3 via composer. This is currently happening on craftcms/cms/src/web/Application.php at line 363 where it tries to load the Yii logo.&lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2018-05-26T18:39:53.750" Title="Craft 3 icons not found in craftcms/cms/src/icons" Tags="&lt;yii&gt;&lt;svg&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25873" PostTypeId="2" ParentId="25871" CreationDate="2018-04-26T14:09:52.320" Score="3" Body="&lt;p&gt;The &lt;code&gt;init&lt;/code&gt; function should only trigger once for each instance. So when you do something like &lt;code&gt;new Plugin&lt;/code&gt; it is executed multiple times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But keep in mind that it is executed in &lt;strong&gt;every&lt;/strong&gt; request. So when you are in the CP there are many different ajax calls (every time when you reload entries at the index page for example). You'll create a new row for each of those requests&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to disable your function you can check &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = Craft::$app-&amp;gt;getRequest();&#xA;if (!$request-&amp;gt;getIsAjax() &amp;amp;&amp;amp; !$request-&amp;gt;getIsConsoleRequest()) {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-26T14:09:52.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25874" PostTypeId="2" ParentId="25846" CreationDate="2018-04-26T14:15:59.983" Score="0" Body="&lt;p&gt;Is the DB_DRIVER line set in your .env file? You may need to run the &lt;code&gt;./craft setup&lt;/code&gt; script.&lt;/p&gt;&#xA;" OwnerUserId="7928" LastActivityDate="2018-04-26T14:15:59.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25875" PostTypeId="1" CreationDate="2018-04-26T15:27:31.403" Score="0" ViewCount="211" Body="&lt;p&gt;Having an issue where the &quot;Update Order Status...&quot; menu option is not available on order list pages. This is true both for admins and for users who have permissions set to manage commerce orders. Any ideas as to what might cause this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4468" LastActivityDate="2018-04-27T06:28:25.637" Title="Update Order Status action missing" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-05-05T21:51:04.723" ContentLicense="CC BY-SA 3.0" />
  <row Id="25877" PostTypeId="1" CreationDate="2018-04-26T16:49:28.137" Score="1" ViewCount="572" Body="&lt;p&gt;I am unable to change my password, as an admin in the CP of Craft.&#xA;I tried resetting it but it did not work.&lt;/p&gt;&#xA;" OwnerUserId="8309" LastEditorUserId="5557" LastEditDate="2018-04-26T17:04:01.663" LastActivityDate="2018-05-30T23:12:19.323" Title="Unable to change password" Tags="&lt;admin&gt;&lt;password&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25878" PostTypeId="1" AcceptedAnswerId="26009" CreationDate="2018-04-26T17:52:42.623" Score="2" ViewCount="890" Body="&lt;p&gt;Developing plugin for Craft 3, I want to add extra property to Assets (data being pulled from other table)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to pull in the data by extending element query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;            ElementQuery::class,&#xA;            ElementQuery::EVENT_AFTER_PREPARE,&#xA;            function(CancelableEvent $e) {&#xA;                if ($e-&amp;gt;sender-&amp;gt;elementType == 'craft\\elements\\Asset')&#xA;                {&#xA;                    $e-&amp;gt;sender-&amp;gt;query-&amp;gt;addSelect('linkstats.downloads');&#xA;&#xA;                    $subQuery = (new Query())&#xA;                        -&amp;gt;select('assetId, SUM(downloads) AS downloads')&#xA;                        -&amp;gt;from('{{%my_plugin_table}}')&#xA;                        -&amp;gt;groupBy('assetId');&#xA;&#xA;                    $e-&amp;gt;sender-&amp;gt;query-&amp;gt;leftJoin(&#xA;                        ['linkstats' =&amp;gt; $subQuery], 'assets.id = linkstats.assetId'&#xA;                    );&#xA;                }&#xA;            }&#xA;        );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when trying to display the asset I get error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Setting unknown property: craft\elements\Asset::downloads&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Question, how do I register this new property/attribute for Assets? I cannot find any event to do that, is it possible at all?&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2018-05-04T13:58:04.017" Title="Add custom attribute to standard element from plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;attribute&gt;&lt;element&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25879" PostTypeId="2" ParentId="25872" CreationDate="2018-04-26T17:55:23.247" Score="1" Body="&lt;p&gt;Gitignore had a line for &lt;code&gt;Icon?&lt;/code&gt; which was causing the icon folder to not show up in git commit. &lt;/p&gt;&#xA;" OwnerUserId="4256" LastActivityDate="2018-04-26T17:55:23.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25881" PostTypeId="1" AcceptedAnswerId="25883" CreationDate="2018-04-26T19:28:32.850" Score="1" ViewCount="113" Body="&lt;p&gt;On the menu below I need to change the class on the li from dropdown-submenu to dropdown-item for those entries that don't have children.  Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('services') %}&#xA;                       {% nav page in pages %}&#xA;           &amp;lt;li class=&quot;dropdown-submenu&quot;&amp;gt; &#xA;                {{ page.getLink() }}&#xA;&#xA;                {% ifchildren %}&#xA;                   &amp;lt;ul class=&quot;dropdown-menu&quot; aria-labelledby=&quot;dropdownMenuLink&quot;&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7328" LastActivityDate="2018-04-26T21:14:26.873" Title="Conditional statement for nav tag when no children" Tags="&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25882" PostTypeId="2" ParentId="25878" CreationDate="2018-04-26T20:13:33.313" Score="0" Body="&lt;p&gt;You can use the &lt;code&gt;asArray()&lt;/code&gt; function in order to gain the raw query result and populate the entry on your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just take a look at the &lt;code&gt;ElementQuery-&amp;gt;populate()&lt;/code&gt; function, copy it to you own service and attach your custom &lt;code&gt;Behavior&lt;/code&gt; you can see how this works &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-behaviors#attaching-behaviors&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyBehavior extends Behavior { &#xA;&#xA;    public $prop1; &#xA;    private $_prop2;&#xA;&#xA;    public function getProp2() {&#xA;        return $this-&amp;gt;_prop2; &#xA;    } &#xA;&#xA;    public function setProp2($value) { &#xA;         $this-&amp;gt;_prop2 = $value;&#xA;    }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just include all values for the element in your custom behavior. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is to change &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/elements/db/ElementQuery.php#L2055&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; piece of code from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element = new $class($row);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element = new $class();&#xA;$element-&amp;gt;attachBehavior('myBehavior1', new MyBehavior);&#xA;Craft::configure($element, $row);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your custom service. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-26T20:13:33.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25883" PostTypeId="2" ParentId="25881" CreationDate="2018-04-26T21:14:26.873" Score="0" Body="&lt;p&gt;Have you tried something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;{{ page.getChildren()|length == 0 ? 'dropdown-item' : 'dropdown-submenu' }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, I suspect you could use {% ifchildren %} in concert with a variable to set the style. In this case, we set the variable to a non-null value if there are children. Then we can use the null-coalescing operator to substitute 'dropdown-item' if there are no children. Like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listclass = null %}&#xA;{% ifchildren %}&#xA;    {% set listclass = 'dropdown-submenu' %}&#xA;{% endifchildren% }&#xA;&amp;lt;li class=&quot;{{ listclass ?? 'dropdown-item' }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8233" LastActivityDate="2018-04-26T21:14:26.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25884" PostTypeId="2" ParentId="25850" CreationDate="2018-04-26T21:22:11.740" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found the solution for my first question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For current events my working solution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;  .section('messages')&#xA;  .type('event')&#xA;  .startDate('&amp;lt;= ' ~ now|date('c'))&#xA;  .endDate('&amp;gt;= ' ~ now|date('c'))&#xA;  .orderBy('startDate asc')&#xA;  .all()&#xA;%}&#xA;&#xA;{% for entry in entries %}&#xA;  &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For upcoming events a simpler solution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;  .section('messages')&#xA;  .type('event')&#xA;  .startDate('&amp;gt; ' ~ now|date('c'))&#xA;  .orderBy('startDate asc')&#xA;  .all()&#xA;%}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to get my second question working. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to query all messages (type: news and events) and exclude current and upcoming events. The output: all messages of type news and all messages of type events that happened in the past. Including pagination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be a combination of this i think:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set news = craft.entries()&#xA;  .section('messages')&#xA;  .type('news')&#xA;  .all()&#xA;%}&#xA;&#xA;{% set events = craft.entries()&#xA;  .section('messages')&#xA;  .type('event')&#xA;  .startDate('&amp;lt; ' ~ now|date('c'))&#xA;  .endDate('&amp;lt; ' ~ now|date('c'))&#xA;  .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Together combined with ordering by post date and pagination. Help! :-)&lt;/p&gt;&#xA;" OwnerUserId="8298" LastEditorUserId="8298" LastEditDate="2018-04-26T21:29:59.513" LastActivityDate="2018-04-26T21:29:59.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25885" PostTypeId="1" AcceptedAnswerId="25886" CreationDate="2018-04-26T21:40:50.173" Score="3" ViewCount="633" Body="&lt;p&gt;I've built a front end user registration form and everything is working well with it except that it's not showing errors for my custom fields. They're set as required in the CP, but the form submits even if they aren't filled in. When the standard required fields aren't filled in the for returns an error but none for the custom fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand first and last name can't be required. In the example below my custom required fields are participantPhone and participantCity.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;form-group signup-form&quot;&amp;gt;&#xA;      {{ csrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;      {{ redirectInput('sign-up-ty') }}&#xA;&#xA;      {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;          &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;              &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;      {% endmacro %}&#xA;&#xA;      {% from _self import errorList %}&#xA;&#xA;      &amp;lt;input id=&quot;username&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;username&quot; {%- if user is defined %} value=&quot;{{ user.username }}&quot;{% endif -%} placeholder=&quot;username&quot;&amp;gt;&#xA;&#xA;      {% if user is defined %}&#xA;        {{ errorList(user.getErrors('username')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;input id=&quot;firstName&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;firstName&quot; {%- if user is defined %} value=&quot;{{ user.firstName }}&quot;{% endif -%} placeholder=&quot;first name&quot;&amp;gt;&#xA;&#xA;      &amp;lt;input id=&quot;lastName&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;lastName&quot; {%- if user is defined %} value=&quot;{{ user.lastName }}&quot;{% endif -%} placeholder=&quot;last name&quot;&amp;gt;&#xA;&#xA;      &amp;lt;input id=&quot;email&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;email&quot;{%- if user is defined %} value=&quot;{{ user.email }}&quot;{% endif %} placeholder=&quot;email&quot;&amp;gt;&#xA;&#xA;      {% if user is defined %}&#xA;        {{ errorList(user.getErrors('email')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;input id=&quot;password&quot; class=&quot;form-control&quot; type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;password&quot;&amp;gt;&#xA;&#xA;      {% if user is defined %}&#xA;        {{ errorList(user.getErrors('password')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;input id=&quot;participantPhone&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[participantPhone]&quot; {%- if user is defined %} value=&quot;{{ user.participantPhone }}&quot;{% endif -%} placeholder=&quot;phone&quot;&amp;gt;&#xA;&#xA;      {% if user is defined %}&#xA;        {{ errorList(user.getErrors('participantPhone')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;input id=&quot;participantCity&quot; class=&quot;form-control&quot; type=&quot;text&quot; name=&quot;fields[participantCity]&quot; {%- if user is defined %} value=&quot;{{ user.participantCity }}&quot;{% endif -%} placeholder=&quot;city&quot;&amp;gt;&#xA;&#xA;      {% if user is defined %}&#xA;        {{ errorList(user.getErrors('participantCity')) }}&#xA;      {% endif %}&#xA;&#xA;      &amp;lt;input id=&quot;register-button&quot; class=&quot;btn btn-outline-primary&quot; type=&quot;submit&quot; value=&quot;Register&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8229" LastActivityDate="2019-05-07T19:37:29.213" Title="Craft 3 User Registration form errors not showing for custom fields" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25886" PostTypeId="2" ParentId="25885" CreationDate="2018-04-26T21:51:14.237" Score="2" Body="&lt;p&gt;From the code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Don't validate required custom fields if it's public registration&#xA;if (!$thisIsPublicRegistration) {&#xA;    $user-&amp;gt;setScenario(Element::SCENARIO_LIVE);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have to create a custom controller &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-26T21:51:14.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25888" PostTypeId="1" AcceptedAnswerId="25902" CreationDate="2018-04-27T00:46:13.560" Score="1" ViewCount="884" Body="&lt;p&gt;I've imported a craft install and its database from a production site to make some changes to it. I've set it up to work locally in MAMP but whenever I go to example.local it keeps redirecting me to example.com. I'm using a multi-environment config so I'm not sure where it could be going wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;&#xA;// Applies to all enviroments&#xA;'*' =&amp;gt; array(&#xA;&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; null,&#xA;&#xA;    // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)&#xA;    'environmentVariables' =&amp;gt; array(),&#xA;&#xA;    // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;    'defaultWeekStartDay' =&amp;gt; 0,&#xA;&#xA;    // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;&#xA;    // Whether &quot;index.php&quot; should be visible in URLs (true, false, &quot;auto&quot;)&#xA;    'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;&#xA;    // Control Panel trigger word&#xA;    'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;    // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;    'devMode' =&amp;gt; false,&#xA;&#xA;    // Preserve Image’s Colour Profiles &#xA;    'preserveImageColorProfiles' =&amp;gt; true&#xA;&#xA;),&#xA;&#xA;// Applies just to local dev server&#xA;'.local' =&amp;gt; array(&#xA;    // Site URL&#xA;    'siteUrl' =&amp;gt; &quot;http://example.local:8888/&quot;,&#xA;&#xA;    // Devmode&#xA;    'devMode' =&amp;gt; true,&#xA;&#xA;    // Turn off timeout&#xA;    'userSessionDuration' =&amp;gt; false,&#xA;&#xA;    // Image assets paths&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '',&#xA;        'baseUrl'  =&amp;gt; 'http://example.local:8888/',&#xA;    )&#xA;),&#xA;&#xA;// Applies to production site&#xA;'.com' =&amp;gt; array(&#xA;    // Site URL&#xA;    'siteUrl' =&amp;gt; &quot;http://example.com/&quot;,&#xA;    // Devmode&#xA;    'devMode' =&amp;gt; false,&#xA;&#xA;    // Image assets paths&#xA;    'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; '',&#xA;        'baseUrl'  =&amp;gt; 'http://example.com/',&#xA;    )&#xA;)&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my current .htaccess&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;RewriteEngine On&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="2158" LastEditorUserId="2158" LastEditDate="2018-04-27T18:57:08.303" LastActivityDate="2018-04-27T20:03:00.737" Title="Local MAMP site keeps redirecting to live production site" Tags="&lt;config&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25889" PostTypeId="1" CreationDate="2018-04-27T03:34:26.683" Score="0" ViewCount="41" Body="&lt;p&gt;I want my &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; to show a &lt;em&gt;single&lt;/em&gt; tag representing all &quot;active&quot; entries ( &quot;active&quot; using a custom lightswitch field in the entry: &lt;code&gt;fellowStatus&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each tag is a year (e.g. 2014, 2010, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. if there are no &quot;active&quot; entries with the tag &lt;code&gt;2017&lt;/code&gt;, it should not display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code block below spits out only tags where entries are &quot;active&quot; &#xA;BUT...&#xA;It spits out duplicates of each tag depending on how many entries are using it. (e.g. It displays 8 instances of &lt;code&gt;2015&lt;/code&gt; instead of 1)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;{% for entry in craft.entries.section('fellows').limit(null) %}&#xA;&#xA;  {% set tags = craft.tags.relatedTo(entry).limit(1).find() %}&#xA;  {% set active = entry.fellowStatus %}&#xA;&#xA;    {% if entry.fellowStatus == 0 %}&#xA;&#xA;      {% for tag in tags %}&#xA;          &amp;lt;li&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ tag }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-04-30T18:33:48.380" Title="My `for` loop has fallen...and it can't get up" Tags="&lt;tags&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25890" PostTypeId="2" ParentId="25875" CreationDate="2018-04-27T06:28:25.637" Score="1" Body="&lt;p&gt;This sounds like a bug. Please submit a issue at &lt;a href=&quot;http://github.com/craftcms/commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://github.com/craftcms/commerce&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-04-27T06:28:25.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25891" PostTypeId="1" AcceptedAnswerId="25935" CreationDate="2018-04-27T07:29:13.420" Score="1" ViewCount="896" Body="&lt;p&gt;Why do I have to activate the PHP functions: &amp;quot;proc_open&amp;quot; and &amp;quot;proc_close&amp;quot; to backup the database?&lt;/p&gt;&#xA;&lt;p&gt;I got the error logs:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[error][yii\base\Exception] yii\base\Exception: Could not create backup: proc_open() has been disabled for security reasons in /home/velolade/craft3veloladen_daten/vendor/craftcms/cms/src/controllers/UtilitiesController.php:383&lt;/p&gt;&#xA;&lt;p&gt;[error][yii\base\Exception] yii\base\Exception: Could not create backup: proc_close() has been disabled for security reasons in /home/velolade/craft3veloladen_daten/vendor/craftcms/cms/src/controllers/UtilitiesController.php:383&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;After activating these functions in my hoster's PHP settings, it worked.&#xA;Is this a security problem for my website?&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-04-30T23:57:17.020" Title="Craft 3 Database Backup" Tags="&lt;craft3&gt;&lt;database&gt;&lt;security&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25892" PostTypeId="1" CreationDate="2018-04-27T08:39:46.933" Score="1" ViewCount="184" Body="&lt;h1&gt;Problem&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I have a problem on a local Valet setup: the locale URL segment is appearing twice in URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg from a page at URL of &lt;code&gt;en/about/approach&lt;/code&gt;, &lt;code&gt;{{ url('about/approach')}}&lt;/code&gt; outputs &lt;code&gt;https://website.test/en/en/about/approach&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And you only get the correct URL if outputting this from &lt;code&gt;/about/approach&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guessing I've missed something obvious but no idea what... thanks!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Setup&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Base URLs are set to &lt;code&gt;@web/en/&lt;/code&gt; and &lt;code&gt;@web/de/&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;web&lt;/code&gt; folder we have two index files, eg &lt;code&gt;de/index.php&lt;/code&gt; and &lt;code&gt;en/index.php&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running &lt;code&gt;valet which&lt;/code&gt; reports &lt;code&gt;This site is served by [CraftValetDriver].&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;general.php&lt;/code&gt; I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'test' =&amp;gt; [&#xA;// Base site URL&#xA;'siteUrl' =&amp;gt; 'http://website.test'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Entry URI Format for the Pages section is &lt;code&gt;{parent.slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Contents of /web/en/index.php:&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;/**&#xA; * Craft www bootstrap file&#xA; */&#xA;&#xA;// Set path constants&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__, 2));&#xA;define('CRAFT_SITE', 'english');&#xA;define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');&#xA;&#xA;$root = dirname(__DIR__).'/en';&#xA;&#xA;// Load Composer's autoloader&#xA;require_once CRAFT_VENDOR_PATH.'/autoload.php';&#xA;&#xA;// Load dotenv?&#xA;if (file_exists(CRAFT_BASE_PATH.'/.env')) {&#xA;    (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&#xA;}&#xA;&#xA;// Load and run Craft&#xA;define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';&#xA;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Contents of /web/index.php:&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;/**&#xA; * Craft web bootstrap file&#xA; */&#xA;&#xA;// Set path constants&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');&#xA;&#xA;// Load Composer's autoloader&#xA;require_once CRAFT_VENDOR_PATH.'/autoload.php';&#xA;&#xA;// Load dotenv?&#xA;if (file_exists(CRAFT_BASE_PATH.'/.env')) {&#xA;    (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&#xA;}&#xA;&#xA;// Load and run Craft&#xA;define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';&#xA;$app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="125" LastEditDate="2018-04-27T14:46:22.710" LastActivityDate="2018-04-27T14:46:22.710" Title="Locale URL segment being duplicated, eg https://website.test/en/en/" Tags="&lt;localization&gt;&lt;craft3&gt;&lt;multi-site&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25893" PostTypeId="1" AcceptedAnswerId="25898" CreationDate="2018-04-27T09:30:09.633" Score="1" ViewCount="297" Body="&lt;p&gt;I've recently updated a site from Craft 2 to 3. I'm getting this error after login in to the admin regarding Sprout Forms which was installed in my Craft 2 install.&#xA;What can I do to get the back-end functioning again? The front-end is fine apart from the pages which contained sprout forms, which I've removed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error Info: Array&#xA;(&#xA;    [0] =&amp;gt; 42S22&#xA;    [1] =&amp;gt; 1054&#xA;    [2] =&amp;gt; Unknown column 'sproutforms_forms.saveData' in 'field list'&#xA;)&#xA;↵&#xA;Caused by: PDOException&#xA;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sproutforms_forms.saveData' in 'field list'&#xA;in (path)/vendor/yiisoft/yii2/db/Command.php at line 1258&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2018-05-01T00:00:19.270" LastActivityDate="2018-08-31T11:49:41.377" Title="Database Exception with Sprout Forms after updating to Craft 3" Tags="&lt;craft3&gt;&lt;database&gt;&lt;error&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25894" PostTypeId="2" ParentId="25892" CreationDate="2018-04-27T10:32:38.640" Score="3" Body="&lt;p&gt;Your issue is that the &lt;code&gt;@web&lt;/code&gt; alias resolves to this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The URL to the folder that contains the &lt;strong&gt;index.php&lt;/strong&gt; file that was loaded for the request&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now that you’re serving your English site from web/en/index.php, &lt;code&gt;@web&lt;/code&gt; will already resolve to &lt;a href=&quot;http://website.test/en&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website.test/en&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alias &lt;code&gt;@web/en&lt;/code&gt; you are using for your site’s base URL does therefore resolve to &lt;a href=&quot;http://website.test/en/en&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website.test/en/en&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can fix it be using &lt;code&gt;@web&lt;/code&gt; for your base URLs, or what I would rather recommend is to serve all your sites from a single web/index.php file (which is possible &lt;a href=&quot;https://github.com/craftcms/cms/commit/8e78482&quot; rel=&quot;nofollow noreferrer&quot;&gt;now in Craft 3&lt;/a&gt;). With this change &lt;code&gt;@web&lt;/code&gt; will always refer to &lt;a href=&quot;http://website.test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://website.test&lt;/a&gt; and you need to use &lt;code&gt;@web/en&lt;/code&gt; again in your site settings.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-04-27T10:32:38.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25896" PostTypeId="1" AcceptedAnswerId="25900" CreationDate="2018-04-27T12:47:26.840" Score="1" ViewCount="203" Body="&lt;p&gt;I am running on the latest version of Craft (Craft CMS 2.6.3015).  I have a blog entry, which has a Rich Text editor for the body field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I do not have an image or file upload field in the WYSIWYG editor, please see the screenshot below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kgb8V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kgb8V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried adding &quot;image&quot; to the array in &lt;code&gt;/craft/config/redactor/Standard.json&lt;/code&gt; but it has no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked the storage folder and all folders have correct permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is the button and how can I add it?&lt;/p&gt;&#xA;" OwnerUserId="6004" LastEditorUserId="57" LastEditDate="2018-05-01T00:01:51.473" LastActivityDate="2018-05-01T00:01:51.473" Title="How can I get the image picker on the WYSIWYG editor?" Tags="&lt;redactor&gt;&lt;image&gt;&lt;richtext&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25897" PostTypeId="1" CreationDate="2018-04-27T13:54:31.543" Score="1" ViewCount="789" Body="&lt;p&gt;I am using Craft Commerce v2 plugin with Craft CMS v3 with one of my site which basically sells kid products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a subscription website and ones some parent subscribe for any kids package, they will charge for a month ( recurring every month ) and then we will send kids package every week for that month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if Craft Commerce is able to handle recurring payments and subscription / membership thing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me out, what's the possible and best solution for this.&lt;/p&gt;&#xA;" OwnerUserId="6730" LastEditorUserId="57" LastEditDate="2018-05-01T00:09:04.123" LastActivityDate="2018-11-02T18:53:32.723" Title="Subscription with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;&lt;ecommerce&gt;&lt;member&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25898" PostTypeId="2" ParentId="25893" CreationDate="2018-04-27T14:21:11.523" Score="2" Body="&lt;p&gt;This issue is often caused if you don't first update Sprout Forms to v2.5.1 before the upgrade to Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If something goes wrong with a plugin installation you can usually disable or remove it in the &lt;code&gt;plugins&lt;/code&gt; table in the db. To disable it you can set the column &lt;code&gt;plugins.enabled&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; in the row for the plugin you wish to disable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going a step farther you can delete the plugin's row from the &lt;code&gt;plugins&lt;/code&gt; table and remove any related tables in the database that relate to that plugin. Be sure to backup your database before editing it directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, be sure to reach out to support for the respective developer and let them know what steps they can take to recreate the problem. You can contact Sprout support at: sprout@barrelstrengthdesign.com&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-08-31T11:49:41.377" LastActivityDate="2018-08-31T11:49:41.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25899" PostTypeId="2" ParentId="25896" CreationDate="2018-04-27T14:26:11.127" Score="1" Body="&lt;p&gt;The simplest method would be to change your Redactor Config to &lt;code&gt;Default&lt;/code&gt; in the rich text field settings. Should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8Ikyz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Ikyz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-04-27T14:26:11.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25900" PostTypeId="2" ParentId="25896" CreationDate="2018-04-27T15:41:36.383" Score="1" Body="&lt;p&gt;I needed to create an asset source in order to use the image upload functionality.  Once an asset source was created the button displayed.&lt;/p&gt;&#xA;" OwnerUserId="6004" LastActivityDate="2018-04-27T15:41:36.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25901" PostTypeId="1" AcceptedAnswerId="25903" CreationDate="2018-04-27T19:56:31.900" Score="3" ViewCount="445" Body="&lt;p&gt;Is it possible to limit the title field in an entry?  As with other fields I can adjust so that it only takes a certain amount of characters.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="57" LastEditDate="2018-05-01T00:03:17.457" LastActivityDate="2018-05-01T00:03:17.457" Title="Title field character length" Tags="&lt;entry&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25902" PostTypeId="2" ParentId="25888" CreationDate="2018-04-27T20:03:00.737" Score="1" Body="&lt;p&gt;There was a rule in my .htaccess to remove www that was redirecting to the live production site. Once I removed that I needed to delete my browser cache.&lt;/p&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2018-04-27T20:03:00.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25903" PostTypeId="2" ParentId="25901" CreationDate="2018-04-27T20:37:04.927" Score="4" Body="&lt;p&gt;You can create a custom validation at the &lt;code&gt;EVENT_BEFORE_SAVE&lt;/code&gt; event&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Entry::class,&#xA;    Entry::EVENT_BEFORE_SAVE,&#xA;    function(ModelEvent $event){&#xA;        /** @var Entry $entry */&#xA;        $entry = $event-&amp;gt;sender;&#xA;        // you can check for the section and the type&#xA;&#xA;        $model = DynamicModel::validateData(['title' =&amp;gt; $entry-&amp;gt;title], [&#xA;            [['title'], 'string', 'max' =&amp;gt; 2, 'message'=&amp;gt;'{attribute} should not be longer than 2 characters']&#xA;        ]);&#xA;        if($model-&amp;gt;hasErrors()){&#xA;            $entry-&amp;gt;addErrors($model-&amp;gt;getErrors());&#xA;            $event-&amp;gt;isValid = false;&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can leave remove the &lt;code&gt;message&lt;/code&gt; attribute if you don't want to use a custom error message, I just wanted to provide a full example how to validate data in Yii2. That way you can define whatever rule you want&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-27T20:37:04.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25904" PostTypeId="2" ParentId="25773" CreationDate="2018-04-27T21:11:59.847" Score="1" Body="&lt;p&gt;Definitely not the most efficient way to do this (it'd be cleaner and more efficient with PHP), but assuming you have  &quot;projects&quot; section that has a &quot;country&quot; Plain Text field and it also had a &quot;state&quot; Plain Text field and you wanted to group projects by country and then state, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countryArr = {} %}&#xA;&#xA;{# grab all projects #}&#xA;{% set allEntries = craft.entries.section('projects').limit(null) %}&#xA;&#xA;{# group them by country #}&#xA;{% set countries = allEntries|group('country') %}&#xA;&#xA;{# Build the nested array structure #}&#xA;{% for country, projects in countries %}&#xA;    {# if it's a new country, add it to our structure #}&#xA;    {% if countryArr[country] is not defined %}&#xA;        {% set countryArr = countryArr|merge({(country):[]}) %}&#xA;    {% endif %}&#xA;&#xA;    {# loop through all of the projects in that country #}&#xA;    {% for project in projects %}&#xA;        {# see if we have a record for the state yet #}&#xA;        {% if project.state not in countryArr[country] %}&#xA;            {# because twig isn't great with multidimensional arrays #}&#xA;            {% set tempArr = countryArr[country] %}&#xA;            {% set tempArr = tempArr|merge([project.state]) %}&#xA;&#xA;            {# merge back into our main structure indexed by country #}&#xA;            {% set countryArr = countryArr|merge({(country):tempArr})  %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;{# output our structure #}&#xA;{% for country, projects in countryArr %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        &amp;lt;li&amp;gt;{{ country }}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for project in projects %}&#xA;                    &amp;lt;li&amp;gt;{{ project }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-27T21:11:59.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25905" PostTypeId="1" AcceptedAnswerId="25909" CreationDate="2018-04-27T23:52:10.953" Score="1" ViewCount="240" Body="&lt;p&gt;I'm trying to dynamically create an element query in PHP where the custom field criteria come from an array of strings. Something like this...?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$users = User::find();&#xA;$users-&amp;gt;group($groupList);&#xA;&#xA;foreach ($criteria as $key =&amp;gt; $value) {&#xA;    // Each key value is the handle for a custom field and the&#xA;    // field value used as criteria&#xA;    $users-&amp;gt;$key($value);&#xA;}&#xA;&#xA;$users-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I use a custom field name in a string as a parameter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; If I don't chain the criteria, I also get a deprecation error when I iterate over &lt;code&gt;$users&lt;/code&gt;...Is there a better way to do that, too?&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="57" LastEditDate="2018-05-01T00:10:02.700" LastActivityDate="2018-05-01T00:10:02.700" Title="How to create an element query in PHP with custom field names in variables?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;elementcriteriamodel&gt;&lt;php&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25906" PostTypeId="1" AcceptedAnswerId="25962" CreationDate="2018-04-28T08:38:51.970" Score="0" ViewCount="279" Body="&lt;p&gt;Making first steps with Craft CMS, and it's great, but there is one thing i can't figure out:&lt;/p&gt;&#xA;&lt;p&gt;When trying to add a new entry with a rather complex set of fields (including matrix) there is an error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Failed to load Twig template &amp;quot;_includes/field&amp;quot;, index &amp;quot;764771142&amp;quot;: cache is corrupted.&lt;/p&gt;&#xA;&lt;p&gt;in E:\craft\playground\vendor\craftcms\cms\src\templates_includes\field.html&#xA;line 17:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% if instructions or input %}&#xA;    {% embed &amp;quot;_includes/forms/field&amp;quot; with {&#xA;        label: field.name|t('site')|e,&#xA;        translatable: translatable,&#xA;        siteId: siteId,&#xA;        required: (not static ? required : false),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Editing existing entries works fine.&lt;/p&gt;&#xA;&lt;p&gt;Running 3.0.4&lt;/p&gt;&#xA;&lt;p&gt;Clear Cache Tool has run, and i also delete the cache files in &lt;code&gt;/storage&lt;/code&gt;. No custom field types.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for ideas.&lt;/p&gt;&#xA;" OwnerUserId="8315" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-05-02T09:35:20.827" Title="Failed to load Twig template &quot;_includes/field&quot;, index &quot;764771142&quot;: cache is corrupted" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25907" PostTypeId="1" AcceptedAnswerId="25931" CreationDate="2018-04-28T10:08:17.577" Score="2" ViewCount="385" Body="&lt;p&gt;Is there a clean way to alter the cartArray that is returned when updating the cart through ajax? Which is defined in the BaseFrontEndController Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example by using a module? In this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15033/override-a-model-method-via-plugin&quot;&gt;Override a model method via plugin&lt;/a&gt;, Yii 2 &lt;em&gt;dependency injection&lt;/em&gt; support is mentioned, but I feel like I need someone to point me into the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="8272" LastActivityDate="2018-04-30T20:36:11.583" Title="Overriding BaseFrontEndController in Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25908" PostTypeId="2" ParentId="25907" CreationDate="2018-04-28T12:37:43.803" Score="1" Body="&lt;p&gt;The most easiest solution in Your case is to create a custom Controller that extends the default &lt;code&gt;BaseFrontEndController&lt;/code&gt; to call that one. The issue for Dependency Injection is the following piece of code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when you do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$container-&amp;gt;set('craft\controllers\EntriesController', [&#xA;    'class' =&amp;gt; 'prefix\namespace\controllers\FooController'&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You would overwrite the default &lt;code&gt;EntriesController&lt;/code&gt; with your custom one and the function &lt;code&gt;createControllerByID&lt;/code&gt; would do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (is_subclass_of($className, 'yii\base\Controller')) {&#xA;    $controller = Yii::createObject($className, [$id, $this]);&#xA;    // $controller is now my custom prefix\namespace\controllers\FooController instead of the default&#xA;&#xA;    // but the line below -&amp;gt; get_class($controller) === $className won't match&#xA;    return get_class($controller) === $className ? $controller : null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you'll receive an exception, it will work with most other classes/services/components that are created with &lt;code&gt;Yii::createObject&lt;/code&gt; but not with Controllers. To change that behavior you would have to replace the &lt;code&gt;createControllerByID&lt;/code&gt; in &lt;code&gt;yii\base\Module&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just do as &lt;a href=&quot;https://craftcms.stackexchange.com/a/15034/5557&quot;&gt;Brad Bell&lt;/a&gt; already said and create a custom controller.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-28T12:37:43.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25909" PostTypeId="2" ParentId="25905" CreationDate="2018-04-28T12:52:20.033" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;Craft::configure()&lt;/code&gt; for that.. imagine your array looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = [&#xA;    'age' =&amp;gt; ['and', '&amp;gt;=30', '&amp;lt;=50'],&#xA;    'enabled' =&amp;gt; false&#xA;    'status' =&amp;gt; null,&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = User::find();&#xA;Craft::configure($query, $criteria);&#xA;&#xA;$users = $query-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can just use the parameter based syntax instead of the functional one &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$users-&amp;gt;$key = $value;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll receive a deprecated error when you don't fetch your users. Your so called &lt;code&gt;$users&lt;/code&gt; variable hast actually nothing to do with &lt;code&gt;users&lt;/code&gt; it's a really bad name because one might think &lt;code&gt;users&lt;/code&gt; store information about a list of users but that's not the case. &lt;code&gt;$users&lt;/code&gt; is a &lt;code&gt;Query&lt;/code&gt; that looks for &lt;code&gt;elements&lt;/code&gt; with the type &lt;code&gt;craft\elements\user&lt;/code&gt; in your database. You'll receive your list of &lt;code&gt;users&lt;/code&gt; when you execute your &lt;code&gt;Query&lt;/code&gt; with &lt;code&gt;one()&lt;/code&gt;, &lt;code&gt;all()&lt;/code&gt; or something like that.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-28T12:57:34.890" LastActivityDate="2018-04-28T12:57:34.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25910" PostTypeId="1" AcceptedAnswerId="25911" CreationDate="2018-04-28T15:50:50.137" Score="1" ViewCount="644" Body="&lt;p&gt;I have a template that outputs some JSON formatted data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've built a simple module that needs to get the contents of that template, decode the JSON data, and return it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I need to use &lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render('path/to/template')&lt;/code&gt;, but when I do, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Call to undefined function modules\importjsonmodule\twigextensions\craft()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only explanation I can think of is that &lt;code&gt;craft()&lt;/code&gt; cannot be used in a module in the way it can in a plugin. Is that the case? If so, is there any way I can access the Templates service from within a module?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7759" LastActivityDate="2018-04-28T16:22:21.723" Title="Return the contents of a template from a custom Twig function in a module?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25911" PostTypeId="2" ParentId="25910" CreationDate="2018-04-28T16:22:21.723" Score="4" Body="&lt;p&gt;There is no &lt;code&gt;craft()&lt;/code&gt; function in Craft 3 and there are no Modules in Craft 2.&#xA;You probably mix the two different versions.&lt;/p&gt;&#xA;&lt;h3&gt;Craft 3&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('/path/to/template');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Of course you need to be in the correct namespace. You have to either &lt;code&gt;use Craft&lt;/code&gt; or do &lt;code&gt;\Craft&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Craft 2&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;render('path/to/template')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-04-28T16:22:21.723" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25912" PostTypeId="1" AcceptedAnswerId="25913" CreationDate="2018-04-28T19:57:29.260" Score="1" ViewCount="72" Body="&lt;p&gt;Creating a plugin that contains a custom field. I need to have some custom html for the settings of the field. I have the following in my field class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function getSettingsHtml()&#xA;{&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate(&quot;src/templates/settings.html&quot;, [&#xA;        'field' =&amp;gt; $this,&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a &quot;settings.html&quot; in &quot;src/templates&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="5557" LastEditDate="2018-04-28T20:07:46.800" LastActivityDate="2018-04-28T20:07:46.800" Title="Unable to render a plugin template" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25913" PostTypeId="2" ParentId="25912" CreationDate="2018-04-28T20:06:57.623" Score="2" Body="&lt;p&gt;Please read the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/updating-plugins.md#rendering-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; (or &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/templates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;) about how to render plugin templates. It's all well explained there . You don't need to define &lt;code&gt;src/templates&lt;/code&gt; but your plugin handle&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`plugin-handle/settings.html`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-28T20:06:57.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25914" PostTypeId="1" AcceptedAnswerId="25915" CreationDate="2018-04-28T20:34:07.707" Score="1" ViewCount="472" Body="&lt;p&gt;I have been trying to get my head wrapped around Migrations in Craft 3 and find myself struggling with added a new section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have managed to add a new volume, but not a section. Here’s where I have got to so far…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace craft\contentmigrations;&#xA;&#xA;use Craft;&#xA;use craft\db\Migration;&#xA;&#xA;/**&#xA; * m180428_195138_test migration.&#xA; */&#xA;class m180428_195138_test extends Migration&#xA;{&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function safeUp()&#xA;    {&#xA;&#xA;      if (is_null(Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeByHandle(&quot;newvolume&quot;))) {&#xA;        $volume = new \craft\volumes\Local([&#xA;          &quot;name&quot; =&amp;gt; &quot;New volume&quot;,&#xA;          &quot;handle&quot; =&amp;gt; &quot;newvolume&quot;,&#xA;          &quot;hasUrls&quot; =&amp;gt; true,&#xA;          &quot;url&quot; =&amp;gt; &quot;@web/images/newvolume&quot;,&#xA;          &quot;path&quot; =&amp;gt; &quot;@webroot/images/newvolume&quot;&#xA;        ]);&#xA;&#xA;        Craft::$app-&amp;gt;volumes-&amp;gt;saveVolume($volume);&#xA;      }&#xA;&#xA;&#xA;      if (is_null(Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle(&quot;awesomeNews&quot;))) {&#xA;        $section = new \craft\models\Section([&#xA;          'name' =&amp;gt; 'Awesome News',&#xA;          'handle' =&amp;gt; 'awesomeNews',&#xA;          'type' =&amp;gt; 'Channel',&#xA;          'siteSettings' =&amp;gt; [&#xA;              new \craft\models\Section_SiteSettings([&#xA;                  'siteId' =&amp;gt; Craft::$app-&amp;gt;sites-&amp;gt;getPrimarySite()-&amp;gt;id,&#xA;                  'enabledByDefault' =&amp;gt; true,&#xA;                  'hasUrls' =&amp;gt; true,&#xA;                  'uriFormat' =&amp;gt; 'foo/{slug}',&#xA;                  'template' =&amp;gt; 'foo/_entry',&#xA;              ]),&#xA;          ]&#xA;        ], true);&#xA;&#xA;        Craft::$app-&amp;gt;sections-&amp;gt;saveSection($section);&#xA;&#xA;      }&#xA;&#xA;&#xA;    }&#xA;&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function safeDown()&#xA;    {&#xA;&#xA;      $newvolume = Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeByHandle(&quot;newvolume&quot;);&#xA;      if (!is_null($newvolume)) {&#xA;        Craft::$app-&amp;gt;volumes-&amp;gt;deleteVolumeById($newvolume-&amp;gt;id);&#xA;      }&#xA;&#xA;      $awesomeNews = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle(&quot;awesomeNews&quot;);&#xA;      if (!is_null($awesomeNews)) {&#xA;        Craft::$app-&amp;gt;volumes-&amp;gt;deleteSectionById($awesomeNews-&amp;gt;id);&#xA;      }&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The migration states it has been successful, however, I only see the new volume, not the section. I have tried to execute this with only the block relating to the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if it is possible to create a new section with Migrations? If it is, any idea what may be wrong with the above?&lt;/p&gt;&#xA;" OwnerUserId="3611" LastEditorUserId="3611" LastEditDate="2018-04-29T06:55:34.230" LastActivityDate="2018-05-01T04:55:17.870" Title="Add new section in Craft 3 Migrations" Tags="&lt;craft3&gt;&lt;migration&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25915" PostTypeId="2" ParentId="25914" CreationDate="2018-04-28T21:02:48.720" Score="1" Body="&lt;p&gt;The easiest solution for this by far is to just run the &lt;code&gt;$model-&amp;gt;getErrors()&lt;/code&gt; function in order to see what's wrong.. Then you'll see the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Type is invalid.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Take a look at your &lt;code&gt;Section&lt;/code&gt; model&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const TYPE_CHANNEL = 'channel';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;change &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'type' =&amp;gt; 'Channel',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'type' =&amp;gt; 'channel',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even better&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'type' =&amp;gt; Section::TYPE_CHANNEL,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also: every &lt;code&gt;save&lt;/code&gt; function returns a variable of type &lt;code&gt;boolean&lt;/code&gt; if it was successful or not. You should &lt;strong&gt;always&lt;/strong&gt; check for those values.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2018-05-01T04:55:17.870" LastActivityDate="2018-05-01T04:55:17.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25916" PostTypeId="1" AcceptedAnswerId="25917" CreationDate="2018-04-28T21:29:18.103" Score="4" ViewCount="2866" Body="&lt;p&gt;Trying to get the currently logged in user's groups. Trying to get at that by using the user ID. I am currently testing as Admin - user number 1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getUser()-&amp;gt;id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns a user ID (11) that does not exist in the Users table. The Users table has ID's of 1, 20, 21.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get user ID or more specifically, the currently logged in user's groups?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-04-28T21:34:43.187" Title="Getting info on the currently logged in user" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25917" PostTypeId="2" ParentId="25916" CreationDate="2018-04-28T21:34:43.187" Score="12" Body="&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getUser()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns only the user service/component. You should read the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-users.html&quot; rel=&quot;noreferrer&quot;&gt;docs&lt;/a&gt; about that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is the current Identity&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-28T21:34:43.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25919" PostTypeId="2" ParentId="25914" CreationDate="2018-04-29T07:04:52.067" Score="2" Body="&lt;p&gt;As documentation for Migrations is pretty slim, here is the working code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace craft\contentmigrations;&#xA;&#xA;use Craft;&#xA;use craft\db\Migration;&#xA;&#xA;/**&#xA; * m180428_195138_test migration.&#xA; */&#xA;class m180428_195138_test extends Migration&#xA;{&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function safeUp()&#xA;    {&#xA;&#xA;&#xA;      if (is_null(Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeByHandle(&quot;newvolume&quot;))) {&#xA;        $volume = new \craft\volumes\Local([&#xA;          &quot;name&quot; =&amp;gt; &quot;New volume&quot;,&#xA;          &quot;handle&quot; =&amp;gt; &quot;newvolume&quot;,&#xA;          &quot;hasUrls&quot; =&amp;gt; true,&#xA;          &quot;url&quot; =&amp;gt; &quot;@web/images/newvolume&quot;,&#xA;          &quot;path&quot; =&amp;gt; &quot;@webroot/images/newvolume&quot;&#xA;        ]);&#xA;&#xA;        $success = Craft::$app-&amp;gt;volumes-&amp;gt;saveVolume($volume);&#xA;&#xA;      }&#xA;&#xA;      if (is_null(Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle(&quot;awesomeNews&quot;))) {&#xA;        $section = new \craft\models\Section([&#xA;          &quot;name&quot; =&amp;gt; &quot;Awesome News&quot;,&#xA;          &quot;handle&quot; =&amp;gt; &quot;awesomeNews&quot;,&#xA;          &quot;type&quot; =&amp;gt; \craft\models\Section::TYPE_CHANNEL,&#xA;          &quot;siteSettings&quot; =&amp;gt; [&#xA;              new \craft\models\Section_SiteSettings([&#xA;                  &quot;siteId&quot; =&amp;gt; Craft::$app-&amp;gt;sites-&amp;gt;getPrimarySite()-&amp;gt;id,&#xA;                  &quot;enabledByDefault&quot; =&amp;gt; true,&#xA;                  &quot;hasUrls&quot; =&amp;gt; true,&#xA;                  &quot;uriFormat&quot; =&amp;gt; &quot;foo/{slug}&quot;,&#xA;                  &quot;template&quot; =&amp;gt; &quot;foo/_entry&quot;,&#xA;              ]),&#xA;          ]&#xA;        ]);&#xA;&#xA;        $success = Craft::$app-&amp;gt;sections-&amp;gt;saveSection($section);&#xA;&#xA;        $errors = $section-&amp;gt;getErrors();&#xA;        foreach ($errors as $error) {&#xA;          echo $error[0];&#xA;        }&#xA;&#xA;      }&#xA;&#xA;      return $success;&#xA;&#xA;    }&#xA;&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function safeDown()&#xA;    {&#xA;&#xA;      $newvolume = Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeByHandle(&quot;newvolume&quot;);&#xA;      if (!is_null($newvolume)) {&#xA;        $success = Craft::$app-&amp;gt;volumes-&amp;gt;deleteVolumeById($newvolume-&amp;gt;id);&#xA;      }&#xA;&#xA;      $awesomeNews = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle(&quot;awesomeNews&quot;);&#xA;      if (!is_null($awesomeNews)) {&#xA;        $success = Craft::$app-&amp;gt;sections-&amp;gt;deleteSectionById($awesomeNews-&amp;gt;id);&#xA;      }&#xA;&#xA;      return $success;&#xA;&#xA;    }&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This includes the error checking when creating the new section and the &lt;code&gt;save&lt;/code&gt; functions are assigned to a variable which are returned at the end.&lt;/p&gt;&#xA;" OwnerUserId="3611" LastActivityDate="2018-04-29T07:04:52.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25920" PostTypeId="1" CreationDate="2018-04-29T17:08:28.403" Score="2" ViewCount="227" Body="&lt;p&gt;Is it possible to bulk save user entries to force an onSaveEntry event. I added a new custom preparse field to Users, but need to trigger a save event to propagate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regular sections can reindex by saving the Section title (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/18448/bulk-resave-entries-to-trigger-onsaveentry-event/18449#18449&quot;&gt;Bulk resave entries to trigger onSaveEntry event&lt;/a&gt;) but it doesn't seem like that's possible with Users? Any known workarounds or obvious tricks I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2018-04-29T17:08:28.403" Title="Bulk resave user entries to trigger onSaveEntry event" Tags="&lt;users&gt;&lt;onsaveentry&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25922" PostTypeId="2" ParentId="11611" CreationDate="2018-04-29T22:34:33.830" Score="7" Body="&lt;p&gt;For Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::$app-&amp;gt;config-&amp;gt;general-&amp;gt;{var name}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="855" LastActivityDate="2018-04-29T22:34:33.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25924" PostTypeId="1" AcceptedAnswerId="25938" CreationDate="2018-04-30T08:34:14.253" Score="1" ViewCount="65" Body="&lt;p&gt;As the title suggests, is it possible to pass an entry ID in order to set a parent for the submitted entry?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastEditorUserId="5557" LastEditDate="2018-04-30T10:56:27.953" LastActivityDate="2018-05-01T05:04:41.323" Title="Guest Entries plugin - set parent entry if using section" Tags="&lt;guest-entries&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25926" PostTypeId="1" CreationDate="2018-04-30T12:48:36.307" Score="1" ViewCount="483" Body="&lt;p&gt;We have some navigation links being translated via the /translations folder but the client needs the ability to change them too...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to make the translations editable from the control panel?&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-05-02T18:17:58.433" Title="Way for clients to edit translation file(s) in control panel?" Tags="&lt;localization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25928" PostTypeId="2" ParentId="25926" CreationDate="2018-04-30T14:17:34.610" Score="3" Body="&lt;p&gt;I would say the most cleanest way is to handle all translations via Yii2 &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-i18n-dbmessagesource&quot; rel=&quot;nofollow noreferrer&quot;&gt;DbMessageSource&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could say you want to store all translations into the database instead of files.&#xA;There is an &lt;code&gt;MessageSource::EVENT_MISSING_TRANSLATION&lt;/code&gt; event in which you can store all translations into your new database table. As soon as Craft recognizes a new translation you'll have the chance to insert the new record&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code snipped from our translation plugin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    MessageSource::class,&#xA;    MessageSource::EVENT_MISSING_TRANSLATION,&#xA;    function(MissingTranslationEvent $event) {&#xA;        if ($event-&amp;gt;message) {&#xA;            $message = Translate::getInstance()-&amp;gt;getTranslation()-&amp;gt;addMissingTranslation($event-&amp;gt;category, $event-&amp;gt;message, $event-&amp;gt;language);&#xA;            if ($message instanceof Message) {&#xA;                $event-&amp;gt;translatedMessage = $message-&amp;gt;translation;&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Your DbMessageSource class could look like this&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class DbMessageSource extends \yii\i18n\DbMessageSource&#xA;{&#xA;    public $fallback = [];&#xA;    public $useMultiSiteTranslationFeature = false;&#xA;    protected $fallbackClass;&#xA;&#xA;    /**&#xA;     * Return something for everything which is requested&#xA;     *&#xA;     * @param string $name&#xA;     *&#xA;     * @return mixed|null&#xA;     */&#xA;    public function __get($name)&#xA;    {&#xA;        try {&#xA;            return parent::__get($name);&#xA;        } catch (\Exception $e) {&#xA;            return null;&#xA;        }&#xA;    }&#xA;&#xA;    /**&#xA;     * @param string $name&#xA;     * @param mixed  $value&#xA;     */&#xA;    public function __set($name, $value)&#xA;    {&#xA;        try {&#xA;            parent::__set($name, $value);&#xA;        } catch (\Exception $e) {&#xA;            $this-&amp;gt;$name = $value;&#xA;        }&#xA;    }&#xA;&#xA;    public function translateFallback($category, $message, $language)&#xA;    {&#xA;        if ($this-&amp;gt;useMultiSiteTranslationFeature &amp;amp;&amp;amp; Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsSiteRequest()) {&#xA;            $this-&amp;gt;useMultiSiteTranslationFeature = false;&#xA;            $translated = $this-&amp;gt;translate($category, $message, $language);&#xA;            $this-&amp;gt;useMultiSiteTranslationFeature = true;&#xA;            if ($translated) {&#xA;                return $translated;&#xA;            }&#xA;        }&#xA;        if (count($this-&amp;gt;fallback) === 0) {&#xA;            return false;&#xA;        }&#xA;        if (!$this-&amp;gt;fallbackClass) {&#xA;            $this-&amp;gt;fallbackClass = \Yii::createObject($this-&amp;gt;fallback);&#xA;        }&#xA;&#xA;        return $this-&amp;gt;fallbackClass-&amp;gt;translate($category, $message, $language);&#xA;    }&#xA;&#xA;    protected function loadMessages($category, $language)&#xA;    {&#xA;        if ($this-&amp;gt;useMultiSiteTranslationFeature &amp;amp;&amp;amp; Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsSiteRequest()) {&#xA;            $category .= '_' . Craft::$app-&amp;gt;getSites()-&amp;gt;currentSite-&amp;gt;handle;&#xA;        }&#xA;&#xA;        if ($this-&amp;gt;enableCaching) {&#xA;            $key = [&#xA;                __CLASS__,&#xA;                $category,&#xA;                $language,&#xA;            ];&#xA;            $messages = $this-&amp;gt;cache-&amp;gt;get($key);&#xA;            if ($messages === false) {&#xA;                $messages = $this-&amp;gt;loadMessagesFromDb($category, $language);&#xA;                $this-&amp;gt;cache-&amp;gt;set($key, $messages, $this-&amp;gt;cachingDuration);&#xA;            }&#xA;&#xA;            return $messages;&#xA;        }&#xA;&#xA;        return $this-&amp;gt;loadMessagesFromDb($category, $language);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rest is common Craft work to create create a custom form/list for your new CP section or you create an element type and let Craft handle everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the picture below: all translatable strings from all sources/categories/plugins are recognized and our customers are able to change all translations in all plugins into all languages. Even if the creator of the plugin never wanted to include certain translations into certain languages&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RO3zz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RO3zz.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-04-30T14:28:13.690" LastActivityDate="2018-04-30T14:28:13.690" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25930" PostTypeId="2" ParentId="25889" CreationDate="2018-04-30T18:33:48.380" Score="1" Body="&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;: grab all entries that match your criteria&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;: grab all Tags related to your entries&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryIds = Entry::find()&#xA;    -&amp;gt;yourTagField(':notempty:')&#xA;    -&amp;gt;fellowStatus('1')&#xA;    -&amp;gt;section('fellows')&#xA;    -&amp;gt;ids();&#xA;$tagsRelatedToEntries = Tag::find()&#xA;    -&amp;gt;relatedTo($entryIds)&#xA;    -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries&#xA;    .section('fellows')&#xA;    .fellowStatus('1')&#xA;    .yourTagField(':notempty:')&#xA;    .ids() &#xA;%}&#xA;{% set tags = craft.tags.relatedTo(entryIds).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-04-30T18:33:48.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25931" PostTypeId="2" ParentId="25907" CreationDate="2018-04-30T20:36:11.583" Score="0" Body="&lt;p&gt;Based on Robin's advice I've come to this solution...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off I created simple plugin at &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; called Commerce Adjustments. Within the src folder I created a folder called 'controllers' and in that folder a file 'CartController.php' containing the following code. Now the CartArray can be adjusted and will be returned when updating the cart (/commerce-adjustments/cart/update-cart).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace commerceadjustments\controllers;&#xA;&#xA;use Craft;&#xA;use craft\commerce\elements\Order;&#xA;&#xA;use craft\commerce\controllers\CartController as Commerce_CartController;&#xA;&#xA;class CartController extends Commerce_CartController&#xA;{&#xA;    protected function cartArray(Order $cart): array&#xA;    {&#xA;        $data = [];&#xA;        $data['id'] = $cart-&amp;gt;id;&#xA;        $data['number'] = $cart-&amp;gt;number;&#xA;        $data['couponCode'] = $cart-&amp;gt;couponCode;&#xA;        $data['itemTotal'] = $cart-&amp;gt;getItemTotal();&#xA;        $data['itemSubtotal'] = $cart-&amp;gt;getItemSubtotal();&#xA;        $data['totalPaid'] = $cart-&amp;gt;getTotalPaid();&#xA;        $data['email'] = $cart-&amp;gt;getEmail();&#xA;        $data['isCompleted'] = $cart-&amp;gt;isCompleted;&#xA;        $data['dateOrdered'] = $cart-&amp;gt;dateOrdered;&#xA;        $data['datePaid'] = $cart-&amp;gt;datePaid;&#xA;        $data['currency'] = $cart-&amp;gt;currency;&#xA;        $data['paymentCurrency'] = $cart-&amp;gt;paymentCurrency;&#xA;        $data['lastIp'] = $cart-&amp;gt;lastIp;&#xA;        $data['message'] = $cart-&amp;gt;message;&#xA;        $data['returnUrl'] = $cart-&amp;gt;returnUrl;&#xA;        $data['cancelUrl'] = $cart-&amp;gt;cancelUrl;&#xA;        $data['orderStatusId'] = $cart-&amp;gt;orderStatusId;&#xA;        $data['shippingMethod'] = $cart-&amp;gt;shippingMethodHandle;&#xA;        $data['shippingMethodId'] = $cart-&amp;gt;getShippingMethodId();&#xA;        $data['paymentMethodId'] = $cart-&amp;gt;gatewayId;&#xA;        $data['customerId'] = $cart-&amp;gt;customerId;&#xA;        $data['isPaid'] = $cart-&amp;gt;getIsPaid();&#xA;        $data['totalQty'] = $cart-&amp;gt;getTotalQty();&#xA;        $data['pdfUrl'] = $cart-&amp;gt;getPdfUrl() ? $cart-&amp;gt;getPdfUrl('ajax') : '';&#xA;        $data['isEmpty'] = $cart-&amp;gt;getIsEmpty();&#xA;        $data['itemSubtotal'] = $cart-&amp;gt;getItemSubtotal();&#xA;        $data['totalWeight'] = $cart-&amp;gt;getTotalWeight();&#xA;        $data['totalPrice'] = $cart-&amp;gt;getTotalPrice();&#xA;&#xA;        $data['availableShippingMethods'] = $cart-&amp;gt;getAvailableShippingMethods();&#xA;&#xA;        $data['shippingAddressId'] = $cart-&amp;gt;shippingAddressId;&#xA;        if ($cart-&amp;gt;getShippingAddress()) {&#xA;            $data['shippingAddress'] = $cart-&amp;gt;shippingAddress-&amp;gt;attributes;&#xA;        } else {&#xA;            $data['shippingAddress'] = null;&#xA;        }&#xA;&#xA;        $data['billingAddressId'] = $cart-&amp;gt;billingAddressId;&#xA;        if ($cart-&amp;gt;getBillingAddress()) {&#xA;            $data['billingAddress'] = $cart-&amp;gt;billingAddress-&amp;gt;attributes;&#xA;        } else {&#xA;            $data['billingAddress'] = null;&#xA;        }&#xA;&#xA;        $lineItems = [];&#xA;        foreach ($cart-&amp;gt;lineItems as $lineItem) {&#xA;            $lineItemData = [];&#xA;            $lineItemData['id'] = $lineItem-&amp;gt;id;&#xA;            $lineItemData['price'] = $lineItem-&amp;gt;price;&#xA;            $lineItemData['saleAmount'] = $lineItem-&amp;gt;saleAmount;&#xA;            $lineItemData['salePrice'] = $lineItem-&amp;gt;salePrice;&#xA;            $lineItemData['qty'] = $lineItem-&amp;gt;qty;&#xA;            $lineItemData['weight'] = $lineItem-&amp;gt;weight;&#xA;            $lineItemData['length'] = $lineItem-&amp;gt;length;&#xA;            $lineItemData['height'] = $lineItem-&amp;gt;height;&#xA;            $lineItemData['width'] = $lineItem-&amp;gt;width;&#xA;            $lineItemData['total'] = $lineItem-&amp;gt;total;&#xA;            $lineItemData['qty'] = $lineItem-&amp;gt;qty;&#xA;            $lineItemData['snapshot'] = $lineItem-&amp;gt;snapshot;&#xA;            $lineItemData['note'] = $lineItem-&amp;gt;note;&#xA;            $lineItemData['orderId'] = $lineItem-&amp;gt;orderId;&#xA;            $lineItemData['purchasableId'] = $lineItem-&amp;gt;purchasableId;&#xA;            $lineItemData['taxCategoryId'] = $lineItem-&amp;gt;taxCategoryId;&#xA;            $lineItemData['shippingCategoryId'] = $lineItem-&amp;gt;shippingCategoryId;&#xA;            $lineItemData['onSale'] = $lineItem-&amp;gt;getOnSale();&#xA;            $lineItemData['options'] = $lineItem-&amp;gt;options;&#xA;            $lineItemData['optionsSignature'] = $lineItem-&amp;gt;getOptionsSignature();&#xA;            $lineItemData['subtotal'] = $lineItem-&amp;gt;getSubtotal();&#xA;            $lineItemData['total'] = $lineItem-&amp;gt;getTotal();&#xA;            $lineItems[$lineItem-&amp;gt;id] = $lineItemData;&#xA;        }&#xA;        $data['lineItems'] = $lineItems;&#xA;        $data['totalLineItems'] = count($lineItems);&#xA;&#xA;        $adjustments = [];&#xA;        foreach ($cart-&amp;gt;adjustments as $adjustment) {&#xA;            $adjustmentData = [];&#xA;            $adjustmentData['id'] = $adjustment-&amp;gt;id;&#xA;            $adjustmentData['type'] = $adjustment-&amp;gt;type;&#xA;            $adjustmentData['name'] = $adjustment-&amp;gt;name;&#xA;            $adjustmentData['description'] = $adjustment-&amp;gt;description;&#xA;            $adjustmentData['amount'] = $adjustment-&amp;gt;amount;&#xA;            $adjustmentData['sourceSnapshot'] = $adjustment-&amp;gt;sourceSnapshot;&#xA;            $adjustmentData['orderId'] = $adjustment-&amp;gt;orderId;&#xA;            $adjustments[$adjustment-&amp;gt;type][] = $adjustmentData;&#xA;        }&#xA;        $data['adjustments'] = $adjustments;&#xA;        $data['totalAdjustments'] = count($adjustments);&#xA;&#xA;        if ($cart-&amp;gt;getErrors()) {&#xA;            $data['errors'] = $cart-&amp;gt;getErrors();&#xA;        }&#xA;&#xA;        // remove un-needed base element attributes&#xA;        $remove = ['archived', 'cancelUrl', 'lft', 'level', 'rgt', 'slug', 'uri', 'root'];&#xA;        foreach ($remove as $r) {&#xA;            unset($data[$r]);&#xA;        }&#xA;&#xA;        return $data;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8272" LastActivityDate="2018-04-30T20:36:11.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25932" PostTypeId="1" CreationDate="2018-04-30T22:00:55.763" Score="0" ViewCount="433" Body="&lt;p&gt;I am trying to use the &lt;strong&gt;FeedMe&lt;/strong&gt; plugin to append data to existing entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My existing entries have a field that is a unique ID.  It is named &lt;code&gt;Line Id&lt;/code&gt;.   They also have a blank field named &lt;code&gt;Program Justification&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;.csv&lt;/code&gt; file I am importing has only 2 fields &lt;code&gt;Line Id&lt;/code&gt; and &lt;code&gt;Program Justification&lt;/code&gt;.   They should sync with the existing entries.  But, FeedMe keeps throwing an &lt;strong&gt;error&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*justAPAF Justification: Unable to match an existing element. Have you set a unique identifier for [&quot;lineId&quot;] and does this have a value? - Element.php:104*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do not know what I am doing wrong.  I use &lt;code&gt;Line Id&lt;/code&gt; as a unique identifier in multiple database, data parsing and data visualization tools with no issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure this is a simple 30 second explanation - but it has stopped me cold in my tracks for 5 days now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-02T22:36:32.470" Title="I just can't get FeedMe to work" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25933" PostTypeId="2" ParentId="25877" CreationDate="2018-04-30T22:44:32.053" Score="1" Body="&lt;p&gt;If the email address &lt;strong&gt;is not&lt;/strong&gt; yours, follow &lt;a href=&quot;https://craftcms.stackexchange.com/questions/22594/reset-the-password-of-an-admin-account&quot;&gt;these instructions...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the email address &lt;strong&gt;is&lt;/strong&gt; yours, then your local system probably isn't sending out email. Follow &lt;a href=&quot;https://craftcms.stackexchange.com/a/13966/45&quot;&gt;these instructions&lt;/a&gt; to manually set the password.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-04-30T22:44:32.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25934" PostTypeId="2" ParentId="25868" CreationDate="2018-04-30T23:04:16.030" Score="1" Body="&lt;p&gt;For any Elements that do not have URLs, like Tags or Users, you'll need to tell Sprout SEO what metadata to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, be sure that the &lt;code&gt;do craft.sproutSeo.meta&lt;/code&gt; tag comes before the &lt;code&gt;{% sproutseo 'optimize' %}&lt;/code&gt; tag. The do tag prepares the metadata for the optimize tag to process:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({ &#xA;  section: 'Self Help Tips',&#xA;  title: tag.title,&#xA;  description: metadata.metaDescription|striptags|slice(0, 150),&#xA;  canonical: craft.request.url,&#xA;  ogTitle: tag.title,&#xA;  ogType: 'article',&#xA;  ogUrl: craft.request.url,&#xA;  ogImage: metaImage.url(),&#xA;  ogImageWidth: metaImage.width,&#xA;  ogImageHeight: metaImage.height,&#xA;  ogImageType: metaImage.mimeType,&#xA;  ogSiteName: siteName,&#xA;  ogDescription: metadata.description,&#xA;  twitterCard: 'summary',&#xA;  twitterSite: '@twitteruser',&#xA;  twitterCreator: '@twitteruser',&#xA;  twitterTitle: tag.title,&#xA;  twitterDescription: meta.search.description,&#xA;  twitterUrl: craft.request.url,&#xA;  twitterImage: metaImage.url()&#xA;}) %}&#xA;&#xA;{% sproutseo 'optimize' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We do have on our list to simplify this scenario and allow you to add an Element Metadata field to the field layout and just pass the &lt;code&gt;elementId&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutSeo.meta({ &#xA;      elementId: 123&#xA;}) %}&#xA;&#xA;{% sproutseo 'optimize' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-04-30T23:04:16.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25935" PostTypeId="2" ParentId="25891" CreationDate="2018-04-30T23:57:17.020" Score="2" Body="&lt;p&gt;Craft uses MySQL's native &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;mysqldump&lt;/a&gt; and PostgreSQL's &lt;a href=&quot;https://www.postgresql.org/docs/10/static/app-pgdump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;pg_dump&lt;/a&gt; binaries to create database backups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for PHP to be able to execute those binaries, it needs to be able to run the &lt;code&gt;proc_open&lt;/code&gt; and &lt;code&gt;proc_close&lt;/code&gt; PHP commands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would not consider it a security issue, but if you were really concerned about it, you can &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#$backupOnUpdate-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;prevent Craft from making backups on update&lt;/a&gt; and/or specify your own &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#$backupCommand-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;backup logic&lt;/a&gt; bypassing Craft's default implementation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-04-30T23:57:17.020" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25936" PostTypeId="2" ParentId="25897" CreationDate="2018-05-01T00:08:36.050" Score="1" Body="&lt;p&gt;Commerce 2, currently in beta, does support subscriptions, but right now it's only when using the &lt;a href=&quot;https://github.com/craftcms/commerce-stripe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce Stripe payment gateway plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using a different payment gateway that supports subscriptions, you'll have to write a custom Craft/Commerce plugin and you can use the Commerce Stripe one as a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant Commerce subscription documentation lives here: &#xA; &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/subscriptions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/subscriptions.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2018-11-02T18:53:32.723" LastActivityDate="2018-11-02T18:53:32.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25937" PostTypeId="1" CreationDate="2018-05-01T01:53:30.010" Score="1" ViewCount="192" Body="&lt;p&gt;Essentially I'm moving a static HTML site into Craft. I've created a new plugin for the site and have gotten a good chunk of it working however I'm having an issue where audio files won't play. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site is supposed to have music auto-playing and looping (it's a site for kids before you start judging me), and it works correctly on the static site, however nothing plays in my Craft instance and when I go to the direct URL for the audio file it won't play in browser either but doesn't give me a 404. If I &quot;Save As&quot; it does then download correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code is very simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;audio autoplay loop&amp;gt;&#xA;        &amp;lt;source src=&quot;{{ resourceUrl('somesite/audio/some_theme_full.ogg') }}&quot; type=&quot;audio/ogg&quot;&amp;gt;&#xA;        &amp;lt;source src=&quot;{{ resourceUrl('somesite/audio/some_theme_full.mp3') }}&quot; type=&quot;audio/mpeg&quot;&amp;gt;&#xA;&amp;lt;/audio&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The src generates correctly as e.g &lt;a href=&quot;http://site.local/cpresources/somesite/audio/some_theme_full.mp3?d=1513706441&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://site.local/cpresources/somesite/audio/some_theme_full.mp3?d=1513706441&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be wonderful!&lt;/p&gt;&#xA;" OwnerUserId="8323" LastEditorUserId="5557" LastEditDate="2018-05-01T10:25:08.097" LastActivityDate="2018-05-01T11:25:31.683" Title="Audio file won't play using resourceUrl inside plugin" Tags="&lt;templating&gt;&lt;resources&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25938" PostTypeId="2" ParentId="25924" CreationDate="2018-05-01T05:04:41.323" Score="2" Body="&lt;p&gt;The Guest Entries plugin checks for a &lt;code&gt;parentId&lt;/code&gt; value in POST and passes that on to &lt;code&gt;saveElement&lt;/code&gt;, so that should be all you need to do: &lt;a href=&quot;https://github.com/craftcms/guest-entries/blob/v2/src/controllers/SaveController.php#L216&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/guest-entries/blob/v2/src/controllers/SaveController.php#L216&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-01T05:04:41.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25939" PostTypeId="1" CreationDate="2018-05-01T06:39:41.917" Score="2" ViewCount="341" Body="&lt;p&gt;I get the following error upon submit of the contact form (Pixel and Tonic's version).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;proc_open() has been disabled for security reasons&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Using Craft 3.0.5 and Contact Form 2.1.1. Email is being sent by Sendmail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Client's website host are not willing to enable &lt;code&gt;proc_open&lt;/code&gt;. Is anyone aware of a simple way around this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the Stack Trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\base\ErrorException: proc_open() has been disabled for security reasons in /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:296&#xA;Stack trace:&#xA;#0 /home/blahblah/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler-&amp;gt;handleError(2, 'proc_open() has...', '/home/blahblah/...', 296)&#xA;#1 [internal function]: craft\web\ErrorHandler-&amp;gt;handleError(2, 'proc_open() has...', '/home/blahblah/...', 296, Array)&#xA;#2 /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(296): proc_open('/usr/sbin/sendm...', Array, Array)&#xA;#3 /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(58): Swift_Transport_StreamBuffer-&amp;gt;establishProcessConnection()&#xA;#4 /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(126): Swift_Transport_StreamBuffer-&amp;gt;initialize(Array)&#xA;#5 /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php(52): Swift_Transport_AbstractSmtpTransport-&amp;gt;start()&#xA;#6 /home/blahblah/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(67): Swift_Transport_SendmailTransport-&amp;gt;start()&#xA;#7 /home/blahblah/vendor/yiisoft/yii2-swiftmailer/src/Mailer.php(151): Swift_Mailer-&amp;gt;send(Object(Swift_Message))&#xA;#8 /home/blahblah/vendor/yiisoft/yii2/mail/BaseMailer.php(263): yii\swiftmailer\Mailer-&amp;gt;sendMessage(Object(craft\mail\Message))&#xA;#9 /home/blahblah/vendor/craftcms/cms/src/mail/Mailer.php(159): yii\mail\BaseMailer-&amp;gt;send(Object(craft\mail\Message))&#xA;#10 /home/blahblah/vendor/craftcms/contact-form/src/Mailer.php(100): craft\mail\Mailer-&amp;gt;send(Object(craft\mail\Message))&#xA;#11 /home/blahblah/vendor/craftcms/contact-form/src/controllers/SendController.php(51): craft\contactform\Mailer-&amp;gt;send(Object(craft\contactform\models\Submission))&#xA;#12 [internal function]: craft\contactform\controllers\SendController-&amp;gt;actionIndex()&#xA;#13 /home/blahblah/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#14 /home/blahblah/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#15 /home/blahblah/vendor/craftcms/cms/src/web/Controller.php(76): yii\base\Controller-&amp;gt;runAction('', Array)&#xA;#16 /home/blahblah/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('', Array)&#xA;#17 /home/blahblah/vendor/craftcms/cms/src/web/Application.php(272): yii\base\Module-&amp;gt;runAction('contact-form/se...', Array)&#xA;#18 /home/blahblah/vendor/craftcms/cms/src/web/Application.php(520): craft\web\Application-&amp;gt;runAction('contact-form/se...', Array)&#xA;#19 /home/blahblah/vendor/craftcms/cms/src/web/Application.php(256): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#20 /home/blahblah/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#21 /home/blahblah/web/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#22 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8324" LastEditorUserId="57" LastEditDate="2018-05-08T00:24:14.073" LastActivityDate="2018-07-07T01:43:29.227" Title="proc_open error with the Contact Form" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25940" PostTypeId="2" ParentId="25937" CreationDate="2018-05-01T10:29:33.117" Score="1" Body="&lt;p&gt;I think the cleanest way to solve your issue is to create a new &lt;code&gt;Asset&lt;/code&gt; for each of your audio files and relate it to your entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;audio autoplay loop&amp;gt;&#xA;    {% set audioFiles = entry.assetFieldHandle.all() %}&#xA;    {% for asset in audioFiles %}&#xA;        &amp;lt;source src=&quot;{{ asset.getUrl() }}&quot; type=&quot;{{ asset.getMimeType() }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/audio&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-01T11:25:31.683" LastActivityDate="2018-05-01T11:25:31.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25941" PostTypeId="1" AcceptedAnswerId="25942" CreationDate="2018-05-01T13:58:08.737" Score="2" ViewCount="489" Body="&lt;p&gt;I'm trying to loop through a matrix field that has a few different types of fields in it and different orders. I want to first the first field of a certain type and output only that. Here is what I have so far. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.blogPostMainSection.all() %}&#xA;&#xA;{% if block.type == &quot;blogText&quot; %}&#xA;&#xA;    {% set articleText =  block.blogArticleText %}&#xA;&#xA;        {% if articleText | length &amp;gt; 100 %}&#xA;&#xA;            {% set articleTextTrim = block.blogArticleText|slice(0, 100) ~ '...' %}&#xA;&#xA;            {{articleTextTrim | striptags}}&#xA;&#xA;        {% else %}&#xA;&#xA;            {{articleText | striptags}}&#xA;&#xA;        {% endif %}&#xA;&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-05-01T14:25:49.123" Title="Loop through matrix field find first block of a type" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25942" PostTypeId="2" ParentId="25941" CreationDate="2018-05-01T14:08:18.423" Score="4" Body="&lt;pre&gt;&lt;code&gt;{% set myFirstMatrixBlockWithType = entry.blogPostMainSection.type('blogText').one() %}&#xA;&#xA;{{ myFirstMatrixBlockWithType.articleText }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind &lt;code&gt;entry.blogPostMainSection&lt;/code&gt; is &lt;strong&gt;not&lt;/strong&gt; an array of blocks but a &lt;code&gt;Query&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-01T14:25:49.123" LastActivityDate="2018-05-01T14:25:49.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25943" PostTypeId="1" AcceptedAnswerId="25945" CreationDate="2018-05-01T14:54:38.217" Score="1" ViewCount="269" Body="&lt;p&gt;Does anyone know how to make the dropdown field translatable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a site which has both English and German languages, but whenever I set up a dropdown field it only ever appears in English and I don't have an option for the German version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I'm needing this to work as a dropdown on the German site also and not through templating &lt;code&gt;{{ &quot;word&quot; | t }}&lt;/code&gt; as I need the client to have total control of this feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated — thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5vW8r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5vW8r.png&quot; alt=&quot;Screenshot of the dropdown menu field in CraftCMS&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8327" LastEditorUserId="8327" LastEditDate="2018-05-01T16:13:21.600" LastActivityDate="2018-05-01T16:13:21.600" Title="Translatable dropdown menu" Tags="&lt;craft3&gt;&lt;field&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25944" PostTypeId="1" CreationDate="2018-05-01T15:01:27.777" Score="3" ViewCount="116" Body="&lt;p&gt;I'm using the WP All Export plugin to get posts out of Wordpress, and Feed Me to import to Craft 3. Problem I'm having is I can get a great XML feed out of the WP All Export plugin, but post &quot;Content&quot; fields lose formatting so all comes out as one blob – no paragraph tags etc... Anyone lend a hand?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="57" LastEditDate="2018-05-01T18:15:00.833" LastActivityDate="2018-07-31T13:02:28.547" Title="Preserve formatting when exporting from Wordpress" Tags="&lt;craft3&gt;&lt;import&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25945" PostTypeId="2" ParentId="25943" CreationDate="2018-05-01T15:01:42.620" Score="1" Body="&lt;p&gt;It does it per default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('_includes/forms/select', [&#xA;        'name' =&amp;gt; $this-&amp;gt;handle,&#xA;        'value' =&amp;gt; $value,&#xA;        'options' =&amp;gt; $this-&amp;gt;translatedOptions(), //&amp;lt;-- here are your translated options&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you need to insert your translations into your translation files for the &lt;code&gt;site&lt;/code&gt; category&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function translatedOptions(): array&#xA;{&#xA;    $translatedOptions = [];&#xA;&#xA;    if ($this-&amp;gt;options) {&#xA;        foreach ($this-&amp;gt;options as $option) {&#xA;            $translatedOptions[] = [&#xA;                'label' =&amp;gt; Craft::t('site', $option['label']),&#xA;                'value' =&amp;gt; $option['value']&#xA;            ];&#xA;        }&#xA;    }&#xA;&#xA;    return $translatedOptions;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-01T15:01:42.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25946" PostTypeId="1" CreationDate="2018-05-01T15:57:36.967" Score="1" ViewCount="582" Body="&lt;p&gt;I'm building out a Craft 3 plugin and can't see who to pass variables with redirection from a controller. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a controller that I want to pass back to the defined redirect value along with a variable, eg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;return $this-&amp;gt;redirectToPostedUrl( ['order' =&amp;gt; $order ] );&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, trying to access the order variable within my template is returning empty. The order object definitely exists before the redirection as it can be accessed from within my controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions appreciated - I'm sure am overlooking something quite straightforward!&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2021-02-08T22:28:17.323" Title="Plugin Development (Craft 3): Pass variables with redirection" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;redirect&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25947" PostTypeId="1" AcceptedAnswerId="25949" CreationDate="2018-05-01T16:35:24.563" Score="2" ViewCount="578" Body="&lt;p&gt;I have a front-end form with two date fields. After upgrading to Craft 3 and implementing what I believe to be all the changes concerning front-end forms in Craft 3 I am experiencing some odd behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The odd behavior&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I enter manually or use jQuery UI Datepicker plugin to enter a desired date into any of the date fields associated with this front-end form (this is the only front-end form on the site currently), the date gets saved one day behind. E.g. if I enter 2018-05-01 it gets saved as 2018-04-30. &lt;em&gt;However&lt;/em&gt;, if I go to the admin area and add a new block to this matrix field it saves correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I changed when upgrading from Craft 2 to 3 is the following:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ getCsrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ csrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also checked and confirmed that I am using the most up-to-date version of jQuery UI to rule out the datepicker as the culprit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a gist of the form: &lt;a href=&quot;https://gist.github.com/swthate/08152aefe2c481cd792fc156a9ea1bc6&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/swthate/08152aefe2c481cd792fc156a9ea1bc6&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: fields/inputs in question are on line 38 and line 49 of the gist (&lt;code&gt;lotMixDate&lt;/code&gt; and &lt;code&gt;lotExpireDate&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-05-01T17:34:13.650" Title="Date fields saving the wrong date from front-end form" Tags="&lt;templating&gt;&lt;datetime&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25948" PostTypeId="2" ParentId="25377" CreationDate="2018-05-01T17:04:18.393" Score="2" Body="&lt;p&gt;So my issue was very simple to solve once I paid better attention. The 404 was loading perfectly fine the whole time, my problem was that in my 404 file I had it as {% block content %} and not {% block main %} as I had specified in my layout.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-05-01T17:04:18.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25949" PostTypeId="2" ParentId="25947" CreationDate="2018-05-01T17:27:46.597" Score="4" Body="&lt;p&gt;You need to include a &lt;code&gt;timezone&lt;/code&gt; parameter to your form in order to get the correct one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;postDate[timezone]&quot; value=&quot;America/Los_Angeles&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't include something like this in your frontend chances are high you'll receive the wrong time because it adds/subtracts a certain amount of hours. As soon as you include a valid &lt;a href=&quot;http://php.net/manual/en/timezones.europe.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;timezone&lt;/a&gt; it will calculate the correct time. Otherwise it will be set to the default system timezone which may differ from your local&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-01T17:34:13.650" LastActivityDate="2018-05-01T17:34:13.650" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25951" PostTypeId="1" AcceptedAnswerId="25952" CreationDate="2018-05-01T18:22:38.580" Score="2" ViewCount="463" Body="&lt;p&gt;I'm unable to update or install plugins in Craft 3.&#xA;Running in macOS via MAMP, PHP 7.0.8.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: The &quot;https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8&quot; file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:&#xA;error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version&#xA;Failed to enable crypto&#xA;failed to open stream: operation failed&#xA;&#xA;Output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Package operations: 8 installs, 0 updates, 0 removals&#xA;  - Installing psr/cache (1.0.1): Downloading (connecting...)Downloading (failed)&#xA;Downloading (connecting...)&#xA;Downloading (failed)&#xA;Downloading (connecting...)&#xA;Downloading (failed)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone run into this situation or have any suggestions as to how to get around it?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2018-05-01T20:28:39.213" Title="Can't update or install plugins locally, macOS" Tags="&lt;updates&gt;&lt;composer&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25952" PostTypeId="2" ParentId="25951" CreationDate="2018-05-01T20:28:39.213" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your local OpenSSL setup is trying to connect with an older, insecure TLS 1.0 protocol, which Github (and a lot of other sites) no longer support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you update it to use TLS 1.2, the error will go away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on something like MAMP/WAMP, etc. then updating to the latest version of their software is usually enough to resolve this issue.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-01T20:28:39.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25953" PostTypeId="1" AcceptedAnswerId="25955" CreationDate="2018-05-01T21:03:27.017" Score="0" ViewCount="330" Body="&lt;p&gt;I'm looking to use a Craft3 installation as a bridge app to synch a client's contacts from their CRM server to their Email Service Provider, via respective APIs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll be storing their contacts as users in Craft. They have four contact lists with numbers (there may be some overlap) totaling:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;12,000 contacts&lt;/li&gt;&#xA;&lt;li&gt;55,000 contacts&lt;/li&gt;&#xA;&lt;li&gt;23,000 contacts&lt;/li&gt;&#xA;&lt;li&gt;22,000 contacts&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is storing these in Craft as users a realistic option? We'll be editing/adding new users in small batches on a daily basis, slicing them off the full list on the source side by last updated date, and then filtering records to push to the destination using the Craft API.&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2018-05-02T06:56:12.873" Title="How many users can Craft handle?" Tags="&lt;users&gt;&lt;database&gt;&lt;records&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25954" PostTypeId="1" CreationDate="2018-05-01T21:58:52.070" Score="1" ViewCount="1041" Body="&lt;p&gt;I'm building a search form with filters. This is one of the filters.&#xA;I would like to use the parameter &quot;agent&quot; and have it search a text field called &quot;listingAgent&quot; and &quot;coListingAgent&quot; to check for a match either place.  I tried the code below, but can't seem to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set getAgent = craft.request.getParam('agent') %}&#xA;    {% if getAgent %}&#xA;        {% set params = params|merge({ 'listingAgent':getAgent, 'coListingAgent':getAgent }) %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;additional info:&#xA;I noticed that setting the params twice (like below) is looking for a match in both fields. I am looking for a match in either field. Does anyone know how to go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set getAgent = craft.request.getParam('agent') %}&#xA;    {% if getAgent %}&#xA;        {% set params = params|merge({'listingAgent':getAgent}) %}&#xA;        {% set params = params|merge({'coListingAgent':getAgent}) %}&#xA;    {% endif %}&#xA;&#xA;{% set entries = craft.entries(params).search() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="3723" LastEditDate="2018-05-03T21:17:06.370" LastActivityDate="2018-05-04T11:12:17.227" Title="Search Multiple Fields Same Parameter" Tags="&lt;search&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25955" PostTypeId="2" ParentId="25953" CreationDate="2018-05-02T05:14:18.603" Score="3" Body="&lt;p&gt;It depends more on how you are going to create and display them. I had to import 20k elements this weekend and I had to be careful to store them step by step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your server/hardware - you can't just insert 10k elements in one request. There is a function &lt;code&gt;App::maxPowerCaptain()&lt;/code&gt; to disable the timeout but I still faced overflow errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And of course you can't display so many users in one single page without using a pagination or Ajax&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides that - Craft is able to handle such an amount of elements if you can do it in your code as well &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-02T06:56:12.873" LastActivityDate="2018-05-02T06:56:12.873" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25956" PostTypeId="1" CreationDate="2018-05-02T07:28:14.183" Score="1" ViewCount="310" Body="&lt;p&gt;When I import using JSON with FeedMe Pro and need to import more records into an entry that has a Matrix field. I find it deletes the previous and adds the new data only.  Is there anyway to append to the Matrix field leaving the previous data intact?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-06-01T08:21:43.663" Title="FeedMe Pro Import JSON" Tags="&lt;craft3&gt;&lt;json&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25957" PostTypeId="1" AcceptedAnswerId="26239" CreationDate="2018-05-02T08:09:41.147" Score="0" ViewCount="334" Body="&lt;p&gt;I’ve set up a new Ubuntu 18.04 server, but can not get Craft 3 to run on it - despite it passing the &lt;a href=&quot;https://github.com/craftcms/server-check&quot; rel=&quot;nofollow noreferrer&quot;&gt;Server test script&lt;/a&gt; with flying colours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the server setup is OK as PHPmyAdmin is running on this server (though that has its own issues with PHP7.2, it does at least run).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don’t want to use Composer as it is not the right choice for our use case; so I’ve downloaded the zip and used that. It won’t install via the browser as whenever I go to /admin/install it claims a 404 error (going to index.php?p=admin redirects to /admin/install).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to the root of the site it claims an Internal Server Error. I can’t see any information in the /storage/logs files, nor in the /var/www/project/logs folder that Apache is configured to dump logs into when hitting the Internal Server Error. There are log entries - and I had issues with - permissions writing to files. Specifically to do with Yii2 file mutex and fopen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone got any pointers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apache is running as the default www-data user and group, the site files are owned by a user belonging to that group, and I’ve 774’d everything recursively.&lt;/p&gt;&#xA;" OwnerUserId="219" LastEditorUserId="57" LastEditDate="2018-05-14T23:21:17.067" LastActivityDate="2018-05-21T08:00:44.597" Title="Craft 3 not running on Ubuntu 18.04" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25958" PostTypeId="2" ParentId="25956" CreationDate="2018-05-02T08:10:20.703" Score="1" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/21864/how-to-save-matrix-data-programmatically-in-craft-3&quot;&gt;How to save Matrix data programmatically in Craft 3&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll &lt;a href=&quot;https://stackoverflow.com/questions/19758954/get-data-from-json-file-with-php&quot;&gt;fetch your data&lt;/a&gt; loop each row and fetch the element / create a new element if none exists&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('news');&#xA;$entryTypes = $section-&amp;gt;getEntryTypes();&#xA;$entryType = reset($entryTypes);&#xA;foreach ($jsonData as $row) {&#xA;    // try to fetch an element&#xA;    $element = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($row['id']);&#xA;    // no element exists, create a new one&#xA;    if ($element === null) {&#xA;        $element = new Entry(&#xA;            [&#xA;                'sectionId'     =&amp;gt; $section-&amp;gt;id,&#xA;                'typeId'        =&amp;gt; $entryType-&amp;gt;id,&#xA;                'fieldLayoutId' =&amp;gt; $entryType-&amp;gt;fieldLayoutId,&#xA;                'authorId'      =&amp;gt; 1,&#xA;                'title'         =&amp;gt; 'My Entry',&#xA;                'slug'          =&amp;gt; 'my-entry',&#xA;                'postDate'      =&amp;gt; new DateTime(),&#xA;            ]&#xA;        );&#xA;    }&#xA;    // get the field by handle&#xA;    /** @var \craft\fields\Matrix $field */&#xA;    $field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('matrix');&#xA;&#xA;    // get the existing matrix blocks&#xA;    $existingMatrix = $element-&amp;gt;getFieldValue('matrix');&#xA;&#xA;    // serialize the data&#xA;    $serializedMatrix = $field-&amp;gt;serializeValue($existingMatrix, $element);&#xA;&#xA;   // loop your json matrix blocks&#xA;    foreach ($row['yourMatrixBlocks'] as $key =&amp;gt; $block) {&#xA;        // append your new Matrix fields&#xA;        $serializedMatrix['new' . $key] = [&#xA;            'type'   =&amp;gt; 'block',&#xA;            'fields' =&amp;gt; [&#xA;                'field' =&amp;gt; $block['field']&#xA;            ],&#xA;        ];&#xA;    }&#xA;&#xA;    // set the new field value&#xA;    $element-&amp;gt;setFieldValue('matrix', $serializedMatrix);&#xA;    $success = Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($element);&#xA;&#xA;    // display errors - just in Case&#xA;    if($success === false){&#xA;        Craft::dd($element-&amp;gt;getErrors());    &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-02T08:16:22.197" LastActivityDate="2018-05-02T08:16:22.197" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="25959" PostTypeId="1" CreationDate="2018-05-02T08:10:28.777" Score="1" ViewCount="183" Body="&lt;p&gt;I'm having a page that shows entries from two sections: news and events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page has the following layout:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All current event entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Current event entry 1&lt;/li&gt;&#xA;&lt;li&gt;Current event entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All upcoming event entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Upcoming event entry 1&lt;/li&gt;&#xA;&lt;li&gt;Upcoming event entry 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All news entries and all past event entries combined including pagination&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;News entry 1&lt;/li&gt;&#xA;&lt;li&gt;Past event entry 2&lt;/li&gt;&#xA;&lt;li&gt;Past event entry 3&lt;/li&gt;&#xA;&lt;li&gt;News entry 4&lt;/li&gt;&#xA;&lt;li&gt;News entry 5&lt;/li&gt;&#xA;&lt;li&gt;Past event entry 6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To query the current events i use the following query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;  .section('events')&#xA;  .startDate('&amp;lt;= ' ~ now|date('c'))&#xA;  .endDate('&amp;gt;= ' ~ now|date('c'))&#xA;  .orderBy('startDate asc')&#xA;  .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To query the upcoming events i use the following query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;  .section('events')&#xA;  .startDate('&amp;gt; ' ~ now|date('c'))&#xA;  .orderBy('startDate asc')&#xA;  .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to query all the news and past event entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The query should include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Query all entries from section news&lt;/li&gt;&#xA;&lt;li&gt;Query all events from section events where entry.endDate &amp;lt; now&lt;/li&gt;&#xA;&lt;li&gt;Sort all entries by post date&lt;/li&gt;&#xA;&lt;li&gt;Limit to 9 and include pagination&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I came this far with the query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries()&#xA;  .section(['events','news'])&#xA;  .limit(9)&#xA;  .orderBy('postDate asc')&#xA;  as pageInfo, pageEntries&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is missing: checking the event entries to see if the endDate &amp;lt; now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't just add .endDate('&amp;lt; ' ~ now|date('c')) to the query. That would hide all the news entries, ofcourse. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did search and read a lot of posts on stackexchange. Couldn't find a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone that could help me with this?&lt;/p&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2018-06-01T11:21:42.953" Title="Query entries from two sections, check date field for one section and include pagination" Tags="&lt;query&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25960" PostTypeId="2" ParentId="25798" CreationDate="2018-05-02T08:16:09.273" Score="1" Body="&lt;p&gt;So debugging this a bit, it looks like its to do with the namespace declaration on the original template I was using for the migration. Basically when declaring &lt;code&gt;namespace Craft&lt;/code&gt; this causes problems with loading the environment variables that were previously being masked by the &lt;code&gt;die()&lt;/code&gt; error, as I was including Bootstrap too early.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught Error: Class 'Craft\Dotenv' not found&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my case, the phpdotnev stuff is going to need to appear before including Bootstrap otherwise Craft isn't going to be able to connect to the DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving the vendor and environment variables stuff up before loading the bootstrap file from the Craft folder, seems to work. This a test file I have now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;// Avoid errors when running through console&#xA;$_SERVER['HTTP_HOST'] = 'example.craft.localdev';&#xA;$_SERVER['REQUEST_URI'] = '/index.php';&#xA;&#xA;// Get the root dir so we can run migrations without worrying about path&#xA;$root_dir = dirname(dirname(__FILE__));&#xA;&#xA;// We need to load in phpdotenv stuff before initialising bootstrap.php, otherwise you won't be able to connect to the DB&#xA;require_once($root_dir . '/vendor/autoload.php');&#xA;&#xA;// If APP_SECRETS is not set, load in .env file&#xA;if (!getenv('APP_SECRETS'))&#xA;{&#xA;    $envFile = '.env';&#xA;&#xA;    if (file_exists($root_dir . '/' . $envFile))&#xA;    {&#xA;        // PHP dotenv: https://github.com/vlucas/phpdotenv&#xA;        $dotenv = new \Dotenv\Dotenv($root_dir);&#xA;        $dotenv-&amp;gt;load();&#xA;        $dotenv-&amp;gt;required(['APP_SECRETS', 'CRAFT_ENVIRONMENT']);&#xA;    }&#xA;    else&#xA;    {&#xA;        die(&quot;$envFile does not exist.&quot;);&#xA;    }&#xA;}&#xA;&#xA;// Set the Craft environment with the value set in .env&#xA;define('CRAFT_ENVIRONMENT', getenv('CRAFT_ENVIRONMENT'));&#xA;&#xA;// Initialize Craft without letting it take over the whole request&#xA;$app = require $root_dir . '/craft/app/bootstrap.php';&#xA;&#xA;// Set Craft to Craft Personal so we don't get any errors about Client/Pro-only components not being available&#xA;$app-&amp;gt;getInfo()-&amp;gt;edition = 0;&#xA;&#xA;// CUSTOM CODE FOR MIGRATIONS AND OTHER CRAFT RELATED STUFF GOES BELOW THIS LINE&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This then appears to be using the proper environment variables. I tested by editing my &lt;code&gt;db.php&lt;/code&gt; file to break one of the variables being pulled from &lt;code&gt;secrets.json&lt;/code&gt; to cause the DB connection error and it does appear to be work, as the try and catch statement is responding appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if there will be an issue not having the namespace Craft declared or not, but I appear to be able to interact with Craft through &lt;code&gt;$app&lt;/code&gt; still. Would this be correct?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-07-01T11:23:14.377" LastActivityDate="2018-07-01T11:23:14.377" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="25961" PostTypeId="2" ParentId="21864" CreationDate="2018-05-02T08:24:13.747" Score="10" Body="&lt;p&gt;Just an additional note:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to append certain elements to your matrix field instead of overwriting them all you have to do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/** @var \craft\fields\Matrix $field */&#xA;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('matrixField');&#xA;&#xA;// get the existing matrixField Value, keep in mind, this is a Query and not an array&#xA;$existingMatrixQuery = $element-&amp;gt;getFieldValue('matrixField');&#xA;&#xA;// serialize the data in order to get an array like Brandon Kelly&#xA;// created in his answer&#xA;$serializedMatrix = $field-&amp;gt;serializeValue($existingMatrixQuery, $element);&#xA;&#xA;// append the new blocks to the existing array&#xA;$serializedMatrix['new1'] = [&#xA;    'type' =&amp;gt; 'blockTypeHandle',&#xA;    'fields' =&amp;gt; [&#xA;        // the block's custom field values...&#xA;    ]&#xA;];&#xA;&#xA;$element-&amp;gt;setFieldValue('matrixField', $serializedMatrix);&#xA;&#xA;// Save the entry&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($element);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="45" LastEditDate="2019-09-01T05:50:42.120" LastActivityDate="2019-09-01T05:50:42.120" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25962" PostTypeId="2" ParentId="25906" CreationDate="2018-05-02T09:35:20.827" Score="0" Body="&lt;p&gt;Additional info: This error occurs only when devMode=true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Restricting image upload to a single folder &lt;code&gt;{owner.filmtitle|kebab}&lt;/code&gt; possibly caused the error, replacing the folder template helped: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if owner.filmtitle %}{owner.filmtitle|kebab}{%else%}default{%endif%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nevertheless i don't understand why the former version caused the error, and the error message is very misleading.&lt;/p&gt;&#xA;" OwnerUserId="8315" LastActivityDate="2018-05-02T09:35:20.827" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25963" PostTypeId="1" CreationDate="2018-05-02T09:43:09.163" Score="1" ViewCount="249" Body="&lt;p&gt;I recently tried to install Craft Commerce onto Craft 3. I installed the plugin via the plugin store and added in the templates folder which I downloaded straight from &lt;a href=&quot;https://craftcommerce.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/&lt;/a&gt; and also tried the one from &lt;a href=&quot;https://github.com/craftcms/commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I did so, the pages seemed to work OK, but I can't view any products. I don't think I've got the right templates/shop folder, but I'm also not sure how to get the correct version for Craft3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what my products page currently outputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eUHTU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eUHTU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0/5 of the example products are displayed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did try to follow the installation guide on the website, but it seems to only work for Craft2.&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2018-05-02T09:57:09.667" LastActivityDate="2018-05-02T09:57:09.667" Title="Craft 3 / Craft Commerce Installation - Can't see products" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25964" PostTypeId="2" ParentId="25959" CreationDate="2018-05-02T10:49:11.633" Score="1" Body="&lt;p&gt;Found the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First get entries from section events as ID's and check endDate &amp;lt; now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventsIds = craft.entries()&#xA;  .section('events')&#xA;  .endDate('&amp;lt; ' ~ now|date('c'))&#xA;  .ids()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then get entries from section news as ID's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set newsIds = craft.entries()&#xA;  .section('news')&#xA;  .ids()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then merge those two together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = eventsIds|merge(newsIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then paginate by id, set orderBy postDate and limit to 9:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries()&#xA;  .id(entryIds)&#xA;  .orderBy('postDate desc')&#xA;  .limit(9)&#xA;  as pageInfo, pageEntries&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2018-05-02T10:49:11.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25965" PostTypeId="1" AcceptedAnswerId="25993" CreationDate="2018-05-02T10:57:40.497" Score="0" ViewCount="2055" Body="&lt;p&gt;Working on a Wordpress migration at the moment, and all the post URLs are &lt;a href=&quot;http://sitename.com/post-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sitename.com/post-url&lt;/a&gt;, and I need to redirect them to their new home at &lt;a href=&quot;http://sitename.com/article/entry-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sitename.com/article/entry-url&lt;/a&gt;. It's difficult because there obviously isn't a catch-all URL segment I can use because all posts use first segment. I could go the .htaccess route but there are &gt;2k posts so that would be monstrous. There's a good Redirect Manager plugin where you can set a catch all template and then handle redirect in there, but I'd have to separately write a bunch of Route exceptions for other pages on the site. Anyone think of a good approach?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="1109" LastEditDate="2018-05-02T21:39:50.653" LastActivityDate="2018-05-03T15:22:42.180" Title="Best approach for these redirects" Tags="&lt;craft3&gt;&lt;redirect&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25966" PostTypeId="2" ParentId="25965" CreationDate="2018-05-02T11:06:47.910" Score="0" Body="&lt;p&gt;You can use Yii2 routing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        UrlManager::class,&#xA;        UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;        function(RegisterUrlRulesEvent $event) {&#xA;&#xA;        $event-&amp;gt;rules[] = [&#xA;            'pattern' =&amp;gt; '/&amp;lt;route:\S+&amp;gt;',&#xA;            'route'   =&amp;gt; 'controller/to/redirect'&#xA;        ];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your Controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionRedirect($route){&#xA;    if($entry = Entry::find()-&amp;gt;oldUrl($route)-&amp;gt;one()){ //&amp;lt;- insert your criteria to mach old with new URLs&#xA;        return $this-&amp;gt;redirect($entry-&amp;gt;getUrl());&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-02T11:11:57.927" LastActivityDate="2018-05-02T11:11:57.927" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25967" PostTypeId="1" AcceptedAnswerId="25985" CreationDate="2018-05-02T11:17:31.367" Score="0" ViewCount="60" Body="&lt;p&gt;I have an issue creating a new locale, I already have two set up 'en_gb' and 'en_au' and have added a third 'fr'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added the new locale to general.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'.com' =&amp;gt; array(&#xA;  'siteUrl' =&amp;gt; array(&#xA;        'en_gb' =&amp;gt; 'https://xxx.com/',&#xA;        'en_au' =&amp;gt; 'https://xxx.com/au/',&#xA;        'fr' =&amp;gt; 'https://xxx.com/fr/'&#xA;    ),&#xA;  'devMode' =&amp;gt; false&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And have enabled that locale on the section with exactly the same settings as the others:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K7d0i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K7d0i.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I switch to the French locale on an entry I can live preview without a problem, but when I actually publish the page and visit it the entry cannot be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm well and truly stumped on why I can't access the published page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating the locale I did have issues with failed tasks re-saving entries which I spent a lot of time trying to debug with &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide&lt;/a&gt; without luck and with less hair. Would this be a cause considering the locale shows on an entry and the live preview works?&lt;/p&gt;&#xA;" OwnerUserId="526" LastActivityDate="2018-05-03T09:11:29.690" Title="Creating a new locale on craft 2, entries won't load" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25968" PostTypeId="2" ParentId="25944" CreationDate="2018-05-02T11:32:53.047" Score="3" Body="&lt;p&gt;Just needed to save each entry and formatting corrects itself.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-05-02T11:32:53.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25971" PostTypeId="2" ParentId="25954" CreationDate="2018-05-02T14:06:02.067" Score="1" Body="&lt;p&gt;You have two different options. You can either use Crafts &lt;a href=&quot;https://docs.craftcms.com/v2/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;search&lt;/a&gt; so your string would be &lt;code&gt;listingAgent:*searchterm* OR coListingAgent:*searchterm*&lt;/code&gt; or &lt;code&gt;listingAgent:searchterm OR coListingAgent:searchterm&lt;/code&gt; if it should be an exact search&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = craft.entries()&#xA;    .search({&#xA;        query: 'listingAgent:*' ~ getAgent ~ '* OR  coListingAgent:*' ~ getAgent  ~ '*',&#xA;        subLeft: true,&#xA;        subRight: true&#xA;    })&#xA;    .all() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or you query correctly for the field values but I would prefer to do that in PHP instead of Twig&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-03T08:43:04.833" LastActivityDate="2018-05-03T08:43:04.833" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="25973" PostTypeId="1" AcceptedAnswerId="26072" CreationDate="2018-05-02T15:18:40.367" Score="1" ViewCount="464" Body="&lt;p&gt;Craft Version: 3.0.4&lt;br&gt;&#xA;Web Server: Apache + Nginx proxy &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently I've been working on a couple of Craft 3 projects for deployment on my institution's web servers. In the past, I've successfully launched numerous Craft 2 projects without server-specific issues, save for needing to set the Apache &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; header as follows in .htaccess (because it wasn't already configured by httpd.conf):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;SetEnv HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my initial attempts to deploy Craft 3 to the same servers (and using the same &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; configuration in .htaccess), I ran into odd behavior when trying to log in: initially the login process would fail silently (i.e. submitting username/password would process but remain on the login page), but if I were to then immediately refresh the login page a logged-in session would be established and Craft would load the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the CP loaded, Craft would throw an error (&quot;An unknown error occurred&quot;) and subsequent attempts to navigate through the CP would throw the same error and content such as lists of entries would not appear. Further investigation of network request showed that &lt;code&gt;/actions&lt;/code&gt; (POST, GET) requests were failing with &lt;code&gt;400 Bad Request&lt;/code&gt;, with a response of &lt;code&gt;&quot;Request must accept JSON in response&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, before I happened upon actual bad request response details, the folks at Craft thought the issue might pertain to an inconsistent use of HTTPS, or something specific to the use of the Nginx proxy server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a test, however, I added &lt;code&gt;application/json&lt;/code&gt; to the &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; header as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;SetEnv HTTP_ACCEPT text/html,application/xhtml+xml,application/xml,application/json;q=0.9,*/*;q=0.8&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low and behold, I was then able to successfully log in and navigate the CP. All of the POST and GET requests to &lt;code&gt;/actions&lt;/code&gt; responded successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, however, I've ended up in spot where saving an entry successfully commits the change to the database but renders the raw JSON response of the POST request on the page rather than returning to the entry's edit page. Here's an example of what I see in the browser when saving an entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&quot;success&quot;:true,&quot;id&quot;:15107,&quot;title&quot;:&quot;test&quot;,&quot;slug&quot;:&quot;test&quot;,&quot;cpEditUrl&quot;:&quot;https://my.domain.com/operations/entries/generalPages/15107-test&quot;,&quot;authorUsername&quot;:&quot;admin&quot;,&quot;dateCreated&quot;:&quot;2018-05-02T10:08:10-05:00&quot;,&quot;dateUpdated&quot;:&quot;2018-05-02T10:08:10-05:00&quot;,&quot;postDate&quot;:null}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The url in the browser remains on the entry such that if I refresh the page, I'm returned to the entry in the CP and see the updated content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I'm stuck and not sure if the &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; header is configured incorrectly, or if the Nginx proxy server is indeed interfering with the requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance for thoughts/assistance.&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2018-05-04T13:28:44.467" LastActivityDate="2018-06-08T02:24:29.750" Title="When saving an Entry, I receive a JSON response rather than returning to the Entry's edit page" Tags="&lt;craft3&gt;&lt;server&gt;&lt;json&gt;&lt;nginx&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25974" PostTypeId="1" AcceptedAnswerId="26008" CreationDate="2018-05-02T15:45:52.057" Score="1" ViewCount="336" Body="&lt;p&gt;I recently started a new Craft 3 project and am having some trouble with Feed Me. I haven't had this problem in the past with Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Feed URL I'm using is giving me this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Unable to reach assets/data/clients.xml. Message: cURL error 6: Could not resolve host: assets (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to use the siteUrl it seems like that isn't resolving either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Unable to reach {siteUrl}assets/data/clients.xml. Message: cURL error 6: Could not resolve host: %7BsiteUrl%7Dassets (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file exists at that location and is accessible through the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="7260" LastActivityDate="2018-05-04T13:57:47.787" Title="Feed Me relative paths" Tags="&lt;craft3&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25975" PostTypeId="1" CreationDate="2018-05-02T17:45:56.207" Score="1" ViewCount="167" Body="&lt;p&gt;I have a website that uses Craft Commerce and I'm trying to add a language menu that points to the localised version of each product variant as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set variantID = craft.request.getParam('variant') %}&#xA;  {% set locales = craft.i18n.getSiteLocales() %}&#xA;&#xA;  {% for locale in locales %}&#xA;     {% set localisedEntryUrl = craft.commerce.variants.id(variantID).locale(locale.id).first().url() %}&#xA;     {{ localisedEntryUrl }}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that the code above always produces the variant url for one language. eg.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/en/shop/ornaments/melisa?variant=9356&#xA;/en/shop/ornaments/melisa?variant=9356&#xA;/en/shop/ornaments/melisa?variant=9356&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;whereas I would expect something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/en/shop/ornaments/melisa?variant=9356&#xA;/de/shop/ornaments/melisa?variant=9356&#xA;/es/shop/ornaments/melisa?variant=9356&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-06-02T09:31:28.787" Title="Is there a way to get the URL of the localised version of a product variant?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25976" PostTypeId="2" ParentId="25926" CreationDate="2018-05-02T18:17:58.433" Score="0" Body="&lt;p&gt;check out Enupal Translate, you can enable an option to allow Enupal Translate handle the translations folder of the plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://enupal.com/en/craft-plugins/translate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enupal Translate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2018-05-02T18:17:58.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25977" PostTypeId="2" ParentId="25965" CreationDate="2018-05-02T19:52:20.423" Score="0" Body="&lt;p&gt;The redirect manager is probably your better bet. I like Retour - &lt;a href=&quot;https://github.com/nystudio107/retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/retour&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Retour makes a list of all the urls that get 404 errors (and how many times each gets hit). Then you can click through and say URL A =&gt; URL B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently moved a WP site to craft. I exported a sitemap from wordpress, and then clicked through all the pages so they'd show up in the list. Had a spreadsheet of new URLs on another window... And then went to town updating. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing a catch-all for redirects, and then writing exceptions to that seems like trouble.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2018-05-02T19:52:20.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25978" PostTypeId="1" CreationDate="2018-05-02T20:37:27.893" Score="0" ViewCount="354" Body="&lt;p&gt;I'm building a property search form and searching by different types of fields in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I get a list of the unique cities in the entries section to declare my form options?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm stuck on searching by square feet.  (see # sf # section in my code) My plan is to let the user select from a few different ranges of square footage. What I was trying to accomplish below is if my search parameter is &quot;sf=1&quot;, the field buildingSQFT is searched for numbers in between 10000 and 20000. I would then set up different ranges based on the parameter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is a good way to do this.  Your input has to how to best accomplish this is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.request.isAjax %}&#xA;{# set base params #}&#xA;&#xA;{% set params = {&#xA;    section: 'propertiesSection',&#xA;    limit: null&#xA;} %}&#xA;&#xA;{% set relatedParams = ['and'] %}&#xA;&#xA;{# status #}&#xA;    {% if craft.request.getParam('status') %}&#xA;        {% set status = craft.categories.group('propertyStatus').slug(craft.request.getParam('status')) %}&#xA;        {% set relatedParams = relatedParams|merge([{ targetElement:status }]) %}&#xA;    {% endif %}&#xA;&#xA;&#xA;{# city #}&#xA;    {% set city = craft.request.getParam('city') %}&#xA;    {% if city %}&#xA;        {% set params = params|merge({'city':city}) %}&#xA;    {% endif %}&#xA;&#xA;{# sf #}&#xA;    {% set sf = craft.request.getParam('sf') %}&#xA;    {% if sf == &quot;1&quot; %}&#xA;        {% set params = params|merge({'buildingSQFT':range(10000,20000)}) %}&#xA;    {% endif %}&#xA;&#xA;    {# add relatedParams to params #}&#xA;    {% if relatedParams|length &amp;gt; 1 %}&#xA;        {% set params = params|merge({'relatedTo':relatedParams}) %}&#xA;    {% endif %}                &#xA;&#xA;    {% set entries = craft.entries(params).search() %}&#xA;&#xA;    {% if entries|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-05-03T08:59:39.427" Title="Searching Number Field To See If It Falls In A Range" Tags="&lt;search&gt;&lt;number&gt;&lt;range&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25979" PostTypeId="2" ParentId="25932" CreationDate="2018-05-02T22:36:32.470" Score="1" Body="&lt;p&gt;I believe we figured this out over Slack, but the issue here was that you need to actually import your &lt;code&gt;Line Id&lt;/code&gt; column into your &lt;code&gt;lineId&lt;/code&gt; field, otherwise Feed Me doesn't know anything about that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The checkbox to tell Feed Me to use a certain field's value to match existing elements on is one half of the problem - you've already correctly chosen &lt;code&gt;Line Id&lt;/code&gt;. The issue is you need the other half - what data in your feed is supposed to match up with &lt;code&gt;Line Id&lt;/code&gt; and &lt;code&gt;lineId&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose a less confusing UI would be to have an accompanying dropdown field near those checkboxes to say which bit of data in your feed should you be comparing with.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-02T22:36:32.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25980" PostTypeId="1" CreationDate="2018-05-02T22:43:58.977" Score="1" ViewCount="225" Body="&lt;p&gt;I'm having trouble making updates using composer on a new CraftCMS 3 install. This was working at one point as I was able to require a local repository for plugin development purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any composer usage (&quot;composer info&quot;, &quot;composer update&quot;, &quot;composer list&quot;, etc.) yields the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[UnexpectedValueException]                                                                             &#xA;Package cebe/markdown's source key should be specified as {&quot;type&quot;: ..., &quot;url&quot;: ..., &quot;reference&quot;: ...}, {&quot;type&quot;:&quot;git&quot;,&quot;url&quot;:&quot;https:\/\/github.com\/cebe\/markdown.git&quot;,&quot;reference&quot;:null} given. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My (abbreviated) installed.json is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;{&#xA;    &quot;name&quot;: &quot;cebe/markdown&quot;,&#xA;    &quot;version&quot;: &quot;1.1.2&quot;,&#xA;    &quot;version_normalized&quot;: &quot;1.1.2.0&quot;,&#xA;    &quot;source&quot;: {&#xA;        &quot;type&quot;: &quot;git&quot;,&#xA;        &quot;url&quot;: &quot;https://github.com/cebe/markdown.git&quot;,&#xA;        &quot;reference&quot;: null&#xA;    },&#xA;    &quot;dist&quot;: {&#xA;        &quot;type&quot;: &quot;zip&quot;,&#xA;        &quot;url&quot;: &quot;https://api.github.com/repos/cebe/markdown/zipball/&quot;,&#xA;        &quot;reference&quot;: null,&#xA;        &quot;shasum&quot;: &quot;&quot;&#xA;    },&#xA;    &quot;require&quot;: {&#xA;        &quot;lib-pcre&quot;: &quot;*&quot;,&#xA;        &quot;php&quot;: &quot;&amp;gt;=5.4.0&quot;&#xA;    },&#xA;    &quot;require-dev&quot;: {&#xA;        &quot;cebe/indent&quot;: &quot;*&quot;,&#xA;        &quot;facebook/xhprof&quot;: &quot;*@dev&quot;,&#xA;        &quot;phpunit/phpunit&quot;: &quot;4.1.*&quot;&#xA;    },&#xA;    &quot;time&quot;: &quot;2017-07-16 21:13:23&quot;,&#xA;    &quot;bin&quot;: [&#xA;        &quot;bin/markdown&quot;&#xA;    ],&#xA;    &quot;type&quot;: &quot;library&quot;,&#xA;    &quot;extra&quot;: {&#xA;        &quot;branch-alias&quot;: {&#xA;            &quot;dev-master&quot;: &quot;1.1.x-dev&quot;&#xA;        }&#xA;    },&#xA;    &quot;installation-source&quot;: &quot;dist&quot;,&#xA;    &quot;autoload&quot;: {&#xA;        &quot;psr-4&quot;: {&#xA;            &quot;cebe\\markdown\\&quot;: &quot;&quot;&#xA;        }&#xA;    },&#xA;    &quot;notification-url&quot;: &quot;https://packagist.org/downloads/&quot;,&#xA;    &quot;license&quot;: [&#xA;        &quot;MIT&quot;&#xA;    ],&#xA;    &quot;authors&quot;: [&#xA;        {&#xA;            &quot;name&quot;: &quot;Carsten Brandt&quot;,&#xA;            &quot;email&quot;: &quot;mail@cebe.cc&quot;,&#xA;            &quot;homepage&quot;: &quot;http://cebe.cc/&quot;,&#xA;            &quot;role&quot;: &quot;Creator&quot;&#xA;        }&#xA;    ],&#xA;    &quot;description&quot;: &quot;A super fast, highly extensible markdown parser for PHP&quot;,&#xA;    &quot;homepage&quot;: &quot;https://github.com/cebe/markdown#readme&quot;,&#xA;    &quot;keywords&quot;: [&#xA;        &quot;extensible&quot;,&#xA;        &quot;fast&quot;,&#xA;        &quot;gfm&quot;,&#xA;        &quot;markdown&quot;,&#xA;        &quot;markdown-extra&quot;&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been staring at this all afternoon and could use a fresh set of eyes. Anyone have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4163" LastActivityDate="2018-05-16T14:33:24.040" Title="Can't use composer with CraftCMS 3" Tags="&lt;composer&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25981" PostTypeId="2" ParentId="25980" CreationDate="2018-05-03T02:29:03.077" Score="1" Body="&lt;p&gt;All of the references in the source key were missing from my old installed.json file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure what caused the issue but I corrected by installing a new instance of Craft and copying the installed.json into the version of the file that was causing problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now able to run composer commands again.&lt;/p&gt;&#xA;" OwnerUserId="4163" LastActivityDate="2018-05-03T02:29:03.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25982" PostTypeId="2" ParentId="25978" CreationDate="2018-05-03T08:00:16.037" Score="0" Body="&lt;p&gt;Try using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = params|merge({'buildingSQFT': '&amp;gt;= 10000 and &amp;lt;= 20000'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8332" LastActivityDate="2018-05-03T08:00:16.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25983" PostTypeId="2" ParentId="25978" CreationDate="2018-05-03T08:54:19.390" Score="1" Body="&lt;p&gt;Remember: all parameters in your &lt;code&gt;Query&lt;/code&gt; are set to &lt;code&gt;null&lt;/code&gt; by default. They won't be parsed into an &lt;code&gt;SQL&lt;/code&gt; statement until they have a valid value (not &lt;code&gt;&quot;&quot;&lt;/code&gt;, not &lt;code&gt;NULL&lt;/code&gt; not &lt;code&gt;0&lt;/code&gt;) so you can just pass &lt;code&gt;null&lt;/code&gt; values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set range = null %}&#xA;{% switch craft.request.getParam('sf') %}&#xA;    {% case '1' %}&#xA;        {% range = ['and', '&amp;gt;=10000', '&amp;lt;=20000'] %}&#xA;    {% case '2' %}&#xA;        {% range = ['and', '&amp;gt;=20000', '&amp;lt;=30000'] %}&#xA;{% endswitch %}&#xA;&#xA;{% set query = craft.entries&#xA;    .city(craft.request.getParam('city')) // &amp;lt;-- if city is null, nothing happens&#xA;    .buildingSQFT(range)&#xA;    .section('propertiesSection')&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind &lt;code&gt;query&lt;/code&gt; is currently only a &lt;code&gt;Query&lt;/code&gt; and not an array of entries. You can still attach your parameters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getParam('status') %}&#xA;    {% set status = craft.categories.group('propertyStatus').slug(craft.request.getParam('status').one()) %}&#xA;&#xA;    {% do query.relatedTo(['and', {targetElement: status.id}]) %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% set entries = query.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-03T08:59:39.427" LastActivityDate="2018-05-03T08:59:39.427" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25984" PostTypeId="2" ParentId="25975" CreationDate="2018-05-03T08:56:14.963" Score="1" Body="&lt;p&gt;Try using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variantID = craft.request.getParam('variant') %}&#xA;{% set locales = craft.i18n.getSiteLocaleIds() %}&#xA;&#xA;{% for locale in locales %}&#xA;    {% if variantID is defined %}&#xA;        {% set localisedEntryUrl = craft.commerce.variants.id(variantID).locale(locale).first %}&#xA;        {% if localeEntry.locale == locale %}&#xA;            {{ localisedEntryUrl.getUrl() }}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8332" LastActivityDate="2018-05-03T08:56:14.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25985" PostTypeId="2" ParentId="25967" CreationDate="2018-05-03T09:11:29.690" Score="1" Body="&lt;p&gt;Is the &lt;code&gt;/fr/&lt;/code&gt; directory created in your public_html folder?&#xA;&lt;a href=&quot;https://docs.craftcms.com/v2/localization-guide.html#step-5-set-up-the-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/localization-guide.html#step-5-set-up-the-files&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe try making a totally new entry for all 3 locales.&lt;/p&gt;&#xA;" OwnerUserId="8332" LastActivityDate="2018-05-03T09:11:29.690" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25986" PostTypeId="1" CreationDate="2018-05-03T10:00:39.703" Score="1" ViewCount="64" Body="&lt;p&gt;it is possible to do like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$users = Entry::find()&#xA;  -&amp;gt;userLevel('&amp;gt;3')&#xA;  -&amp;gt;or group('admin')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in database level,the sql will go like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;select * from users&#xA;  where users.userLevel &amp;gt; 3 or users.group='admin'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many many thanks!!&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-06-02T11:35:14.980" Title="How to get entries with or" Tags="&lt;entry&gt;&lt;entrymodel&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25987" PostTypeId="2" ParentId="25986" CreationDate="2018-05-03T10:47:36.173" Score="1" Body="&lt;p&gt;Yes but not like you tried it. You have to work on Yii2 level and not with Crafts Query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// prefix for content column tables&#xA;// if you want to select fields in the field layout do&#xA;// $prefix . 'fieldHandle'&#xA;$prefix = Craft::$app-&amp;gt;getContent()-&amp;gt;contentTable . '.' . Craft::$app-&amp;gt;getFields()-&amp;gt;oldFieldColumnPrefix; &#xA;&#xA;$user = User::find()&#xA;    -&amp;gt;andWhere(&#xA;        new OrCondition(&#xA;            ['&amp;gt;','users.userLevel', 3],&#xA;            ['=', 'users.group', 'admin'] &#xA;        )&#xA;    )&#xA;    -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However: keep in mind this SQL will likely produce errors because there is neither a &lt;code&gt;users.group&lt;/code&gt; column nor a &lt;code&gt;users.userLevel&lt;/code&gt; column in the database&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as an example for more complex search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$prefix = Craft::$app-&amp;gt;getContent()-&amp;gt;contentTable . '.' . Craft::$app-&amp;gt;getFields()-&amp;gt;oldFieldColumnPrefix;&#xA;$criteria = [&#xA;    'where'     =&amp;gt; new OrCondition(&#xA;        [&#xA;            [&#xA;                'between',&#xA;                $prefix . 'startDate',&#xA;                Db::prepareDateForDb($startDateDb),&#xA;                Db::prepareDateForDb($endDate)&#xA;            ],&#xA;            new AndCondition(&#xA;                [&#xA;&#xA;                    ['=', $prefix . 'recurring', 1],&#xA;                    ['&amp;lt;=', $prefix . 'startDate', $startDateDb-&amp;gt;format('Y-m-d H:i:s')]&#xA;                ]&#xA;            )&#xA;        ]&#xA;    ),&#xA;    'orderBy'   =&amp;gt; ['startDate' =&amp;gt; SORT_ASC],&#xA;    'sectionId' =&amp;gt; 10,&#xA;];&#xA;&#xA;$query = Entry::find();&#xA;\Craft::configure($query, $criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-03T10:53:20.813" LastActivityDate="2018-05-03T10:53:20.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25990" PostTypeId="1" CreationDate="2018-05-03T13:16:36.923" Score="1" ViewCount="107" Body="&lt;p&gt;So my 1. file is &amp;quot;_overview-topicTeaser.twig&amp;quot; which is within a matrix:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'modules/module-squareteaser/_module-squareteaser' with {&#xA;  squareTeasers: block.topicTeaserItems.all(),&#xA;  squareteaserHeadline: block.topicTeaserItems.one().entryTopicHeadline&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And my 2. file is &amp;quot;_module-squareteaser.twig&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&amp;quot;squareteaser__wrapper _parent-3-child&amp;quot;&amp;gt;&#xA;      {% for item in squareTeasers %}&#xA;&#xA;        {% include 'modules/module-squareteaser/_module-squareteaser-item' with {&#xA;          headline: squareteaserHeadline&#xA;        } %}&#xA;&#xA;      {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So i am looping in the 2. file the file &amp;quot;_module-squareteaser-item.twg&amp;quot; and want to put out the &amp;quot;squareteaserHeadline&amp;quot; in the frontend. But it always gives me the same headline from my first teaser in the loop, makes sense to me cause i am using the &amp;quot;one()&amp;quot; when i include the variable &amp;quot;squareteaserHeadline&amp;quot; in the first file.  But if i delete the &amp;quot;one()&amp;quot; i get nothing... so how do i get all teasers whith their own headline?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/969BO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/969BO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-06-02T14:37:07.257" Title="Get the variables of a loop from an include file" Tags="&lt;craft3&gt;&lt;loop&gt;&lt;include&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25991" PostTypeId="2" ParentId="25990" CreationDate="2018-05-03T13:47:47.140" Score="1" Body="&lt;p&gt;Can't you fetch all the blocks with &lt;code&gt;block.topicTeaserItems.all()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include 'modules/module-squareteaser/_module-squareteaser' with {&#xA;  squareTeasers: block.topicTeaserItems.all()&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you display the headlines with &lt;code&gt;item.entryTopicHeadline&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;squareteaser__wrapper _parent-3-child&quot;&amp;gt;&#xA;  {% for item in squareTeasers %}&#xA;    {% include 'modules/module-squareteaser/_module-squareteaser-item' with {&#xA;      headline: item.entryTopicHeadline&#xA;    } %}&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A simplified version would look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;squareteaser__wrapper _parent-3-child&quot;&amp;gt;&#xA;    {% for item in block.topicTeaserItems.all() %}&#xA;        {{ item.entryTopicHeadline }}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-03T14:13:06.397" LastActivityDate="2018-05-03T14:13:06.397" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25992" PostTypeId="1" CreationDate="2018-05-03T14:04:39.877" Score="1" ViewCount="152" Body="&lt;p&gt;I have the P&amp;amp;T Amazon S3 plugin.   It's connected to my S3 bucket.  It stores a few test .PDF files.   It is working.  I am able to access the files - and the URL is that of my S3 bucket - i.e., &lt;code&gt;my-bucket-name.s3.amazonaws.com/filename.pdf&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a CloudFront distribution.   It is deployed and enabled.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added my CloudFront &lt;code&gt;Distribution ID&lt;/code&gt; to the &lt;code&gt;CloudFront Distribution ID&lt;/code&gt; field in the plugin.   &lt;strong&gt;Do I need to add the distribution's Domain Name to any of the plugin's settings?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I know if the image is being accessed through CloudFront?&lt;/strong&gt;  The URL has not changed - i.e., - i.e., &lt;code&gt;my-bucket-name.s3.amazonaws.com/filename.pdf&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can access the .PDFs in my S3 bucket using the CloudFront domain name -- i.e., &lt;code&gt;cloud-front-domain-name.cloudfront.net/filename.pdf&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2018-05-03T14:36:31.150" LastActivityDate="2020-01-27T20:18:28.380" Title="How do you setup CloudFront in P&amp;T S3 plugin &amp; how do you know if it works?" Tags="&lt;assets&gt;&lt;plugins&gt;&lt;s3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25993" PostTypeId="2" ParentId="25965" CreationDate="2018-05-03T15:22:42.180" Score="0" Body="&lt;p&gt;Someone else suggested I used the existing 404 template, and do a lookup/redirect. Not tried it yet but I think this should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set path = craft.app.request.segments|first %}&#xA;{% set article = craft.entries.section('articles').slug(path).one() %}&#xA;{% if article %}&#xA;    {% redirect article.url 301 %}&#xA;{% else %}&#xA;    Page Not Found&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-05-03T15:22:42.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25994" PostTypeId="2" ParentId="25992" CreationDate="2018-05-03T16:43:52.370" Score="1" Body="&lt;p&gt;Okay -- this was easy -- I was taking the instructions too literally.  You have to replace the S3 URL with the CloudFront URL.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-03T16:43:52.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25997" PostTypeId="1" CreationDate="2018-05-03T19:37:44.003" Score="1" ViewCount="174" Body="&lt;p&gt;I currently implemented a fixed position edit button in the front-end when a user is logged in based on this &quot; &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7104/get-entry-edit-link-in-twig&quot;&gt;Get Entry Edit Link in Twig&lt;/a&gt; &quot; Is there a version of this link, but to Clear Cache?&lt;/p&gt;&#xA;" OwnerUserId="3677" LastActivityDate="2018-07-03T09:26:34.210" Title="Front-end link to Clear Cache?" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25998" PostTypeId="1" CreationDate="2018-05-03T20:39:03.123" Score="0" ViewCount="802" Body="&lt;p&gt;First time user here, can any please provide information on how to best implement the GTM tag container?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to hard code it? Or is the only way to add a plugin?&lt;/p&gt;&#xA;" OwnerUserId="8337" LastEditorUserId="45" LastEditDate="2018-05-05T21:52:30.513" LastActivityDate="2018-05-05T21:52:30.513" Title="How to set up Google Tag Manager correctly" Tags="&lt;frontend&gt;&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25999" PostTypeId="1" CreationDate="2018-05-04T00:15:43.837" Score="2" ViewCount="1066" Body="&lt;p&gt;I have a list of categories that I am listing out, grouping by alphabet.  The issue is the list goes A H B C D E...and so on.  Why would it go in that order?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('programs') %}&#xA;&#xA;{% set categoriesGroup = categories|group('title|slice(0, &#xA;1)|replace(&quot;/[^a-zA-Z]/&quot;, &quot;0-9&quot;) | upper') %} &#xA;&amp;lt;ul&amp;gt;&#xA;{% for letter, categoriesInGroup in categoriesGroup %}&#xA;{{ letter }}&#xA;{% for category in categoriesInGroup %}&#xA;  &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-06-03T02:37:21.913" Title="Group and Sort Alphabetically" Tags="&lt;craft3&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26000" PostTypeId="2" ParentId="25999" CreationDate="2018-05-04T02:21:13.330" Score="4" Body="&lt;p&gt;Seems I needed to put in the order filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('programs').order('title') %}&#xA;&#xA;{% set categoriesGroup = categories|group('title|slice(0, &#xA;1)|replace(&quot;/[^a-zA-Z]/&quot;, &quot;0-9&quot;) | upper') %} &#xA;&amp;lt;ul&amp;gt;&#xA;{% for letter, categoriesInGroup in categoriesGroup %}&#xA;{{ letter }}&#xA;{% for category in categoriesInGroup %}&#xA;  &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-04T02:21:13.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26001" PostTypeId="2" ParentId="25997" CreationDate="2018-05-04T08:15:54.233" Score="1" Body="&lt;p&gt;Please read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/24166/basic-ajax-how-to/24167#24167&quot;&gt;this&lt;/a&gt; to get to know how to create a basic ajax request&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And change the route to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;action: 'utilities/clear-caches-perform-action',&#xA;caches: '*'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-04T08:15:54.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26002" PostTypeId="1" AcceptedAnswerId="26004" CreationDate="2018-05-04T08:54:57.050" Score="1" ViewCount="593" Body="&lt;p&gt;I'm trying to get all Entries that are from a specific Entry Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Section is &quot;Site&quot;.&#xA;Which has 3 different Entry Types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to get all Entries from the Entry Type &quot;Program&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to reach my goal with &lt;code&gt;Craft::$app-&amp;gt;sections-&amp;gt;&lt;/code&gt; or &lt;code&gt;Craft::$app-&amp;gt;elements-&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8219" LastEditorUserId="57" LastEditDate="2018-05-07T23:35:32.120" LastActivityDate="2018-05-07T23:35:32.120" Title="Get Entries from a specific Entry Type" Tags="&lt;plugin-development&gt;&lt;sections&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26003" PostTypeId="1" AcceptedAnswerId="26006" CreationDate="2018-05-04T09:23:29.903" Score="0" ViewCount="415" Body="&lt;p&gt;I am trying to get a custom field value on &lt;code&gt;entries.onBeforeSaveEntry&lt;/code&gt;, event.  So I can perform some action depending on the value of that field.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.onBeforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;    $entry-&amp;gt;publishOnMobileApp;  //publishOnMobileApp is the field handle&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;publishOnMobileApp;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft\MultiOptionsFieldData Object ( &#xA;    [_options:Craft\MultiOptionsFieldData:private] =&amp;gt; &#xA;Array ( [0] =&amp;gt; Craft\OptionData Object &#xA;( &#xA;    [label] =&amp;gt; Yes [value] =&amp;gt; yes [selected] =&amp;gt; )&#xA;)&#xA;   [storage:ArrayObject:private] =&amp;amp;gt; Array()&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure how exactly I can access just the value of the field (which is &quot;yes&quot; in this case) so I can perform a check.&lt;/p&gt;&#xA;" OwnerUserId="7341" LastEditorUserId="57" LastEditDate="2018-05-07T23:37:41.027" LastActivityDate="2018-05-07T23:37:41.027" Title="Get custom field value on entries.onBeforeSaveEntry event" Tags="&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26004" PostTypeId="2" ParentId="26002" CreationDate="2018-05-04T10:01:28.537" Score="3" Body="&lt;pre&gt;&lt;code&gt;$entries = Entry::find()-&amp;gt;section('sectionHandle')-&amp;gt;type(['yourTypeHandle'])-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-04T10:01:28.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26006" PostTypeId="2" ParentId="26003" CreationDate="2018-05-04T12:35:34.317" Score="1" Body="&lt;p&gt;Please take a look at the &lt;a href=&quot;https://docs.craftcms.com/v2/dropdown-fields.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; it's the same in PHP as in Twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($entry-&amp;gt;getFieldValue('publishOnMobileApp')-&amp;gt;options as $option){&#xA;    if($option-&amp;gt;selected){&#xA;         // $option-&amp;gt;label is selected&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-04T12:35:34.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26007" PostTypeId="2" ParentId="25998" CreationDate="2018-05-04T12:42:47.587" Score="1" Body="&lt;p&gt;Not sure what you want to know: everything you need is in the &#xA;&lt;a href=&quot;https://developers.google.com/tag-manager/quickstart&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quick Start Guide&lt;/a&gt;. Just copy the two pieces in your layout and you are done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft you are totally free to do everything you want in your frontend templates. The system won't restrict you at all&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-04T12:42:47.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26008" PostTypeId="2" ParentId="25974" CreationDate="2018-05-04T13:57:47.787" Score="2" Body="&lt;p&gt;This is fixed in &lt;a href=&quot;https://github.com/verbb/feed-me/releases/tag/3.0.0-beta.10&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.0-beta.10&lt;/a&gt;. Additionally, there's no longer the concept of environment variables in Craft, instead we now have aliases. So instead of using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{siteUrl}assets/data/clients.xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;@web/assets/data/clients.xml&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-04T13:57:47.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26009" PostTypeId="2" ParentId="25878" CreationDate="2018-05-04T13:58:04.017" Score="3" Body="&lt;p&gt;Another approach is to use the following event to attach a behavior&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Asset::class, Asset::EVENT_DEFINE_BEHAVIORS, &#xA;function(DefineBehaviorsEvent $event) {&#xA;    $event-&amp;gt;behaviors[] = MyBehavior::class;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;The behavior could look like&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyBehavior extends Behavior { &#xA;    public $downloads; &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way you won't receive an exception and can access your property via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$asset = Assets::find()-&amp;gt;all();&#xA;$asset-&amp;gt;downloads;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can as well manipulate the value of &lt;code&gt;downloads&lt;/code&gt; in the &lt;code&gt;Behaviors&lt;/code&gt; init function in order to return the file or something like this&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-04T13:58:04.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26010" PostTypeId="2" ParentId="25642" CreationDate="2018-05-04T13:59:40.307" Score="2" Body="&lt;p&gt;This is fixed in &lt;a href=&quot;https://github.com/verbb/feed-me/releases/tag/3.0.0-beta.10&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.0-beta.10&lt;/a&gt;. Additionally you can use the concept of aliases in your URL for all sorts of variables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;@web/assets/data/clients.xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which would be related to your web root.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-04T13:59:40.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26011" PostTypeId="2" ParentId="23598" CreationDate="2018-05-04T14:01:31.230" Score="1" Body="&lt;p&gt;There is currently no native way to achieve this with Feed Me, short of writing your own PHP middle-man script which would parse the HTML, extract just the images, and append it to you XML/JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do plan on adding hooks later (potentially with examples) for this sort of scenario, as its quite common, but will not be until at least Feed Me 3.1.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-04T14:01:31.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26012" PostTypeId="2" ParentId="23511" CreationDate="2018-05-04T14:06:22.223" Score="2" Body="&lt;p&gt;There's currently no method to parse variables into the feed itself through this, or any means. Typically, we approach this as feeds being third-party, or otherwise non-editable. How would you see utilising &lt;code&gt;issueNumber&lt;/code&gt; to work in this scenario?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the concept of aliases in your URL if that helps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, you could also make use of the (undocumented) &lt;code&gt;Datatype::EVENT_AFTER_FETCH_FEED&lt;/code&gt; event to perform any parsing on the feed once its been fetched?&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-04T14:06:22.223" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26013" PostTypeId="2" ParentId="25369" CreationDate="2018-05-04T14:09:15.457" Score="1" Body="&lt;p&gt;There's currently no way to achieve this with Feed Me. A single feed would represent a collection of items to be imported as elements/entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method your could consider is setting up a feed for a single entry, then use the optional &lt;code&gt;url&lt;/code&gt; parameter when calling it via the direct feed URL. This overrides the URL used in your feed settings with the one you provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is described &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/trigger-import-via-cron&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/trigger-import-via-cron&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-05-04T14:09:15.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26014" PostTypeId="1" AcceptedAnswerId="26015" CreationDate="2018-05-04T14:11:31.017" Score="1" ViewCount="617" Body="&lt;p&gt;I'm trying to update a checkbox field of an entry through a plugin service. I tried two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Get the field values with &lt;code&gt;$entry-&amp;gt;fieldHandle-&amp;gt;getOptions()&lt;/code&gt;, then manipulating the resulting array, then set the value with &lt;code&gt;$entry-&amp;gt;fieldHandle-&amp;gt;setOptions()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$contact = Entry::find()&#xA;    -&amp;gt;id(...)&#xA;    -&amp;gt;one();&#xA;$newsletters = $contact-&amp;gt;contactNewsletterSubscriptions-&amp;gt;getOptions();&#xA;$newsletters[$index]-&amp;gt;selected = false;&#xA;$contact-&amp;gt;contactNewsletterSubscriptions-&amp;gt;setOptions($newsletters);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($contact);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(where $index is the array index of the setting I want to change)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; this didn't work (no error message, changes just didn't get saved)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;If I make a var_dump of &lt;code&gt;$contact&lt;/code&gt;, the field contactNewsletterSubscriptions is showed as string. I played around with json_decode and serialize to get the right formatting (it looks exactly as when doing a var_dump):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newsletterSubscriptions = json_decode($contact-&amp;gt;contactNewsletterSubscriptions-&amp;gt;serialize());&#xA;$index = array_search($newsletterName, $newsletterSubscriptions);&#xA;unset($newsletterSubscriptions[$index]);&#xA;$contact-&amp;gt;contactNewsletterSubscriptions = (string)json_encode(array_values($newsletterSubscriptions))&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;-&gt; doesn't work either; value gets saved as string; if I later call getOptions() on the field I'm getting &quot;Call to a member function getOptions() on string&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can change the status of a checkbox from selected = true to selected = false?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards.&lt;/p&gt;&#xA;" OwnerUserId="8339" LastEditorUserId="57" LastEditDate="2018-05-07T23:50:27.853" LastActivityDate="2018-05-07T23:50:27.853" Title="Update checkbox value through plugin (Craft 3)" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26015" PostTypeId="2" ParentId="26014" CreationDate="2018-05-04T14:55:59.700" Score="2" Body="&lt;p&gt;You need to set the field value, not the options&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setFieldValue('fieldHandle' [&#xA;    'value1', 'value2'&#xA;});&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to change the values, the easiest method is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$allOptions = $entry-&amp;gt;getFieldValue('fieldHandle');&#xA;$selected = [];&#xA;foreach($allOptions as $option){&#xA;    if($option-&amp;gt;selected){&#xA;         $selected[] = $option-&amp;gt;value;&#xA;    }&#xA;}&#xA;// unset a value&#xA;unset($selected[1]);&#xA;// add another value&#xA;$selected[] = 'anotherValue';&#xA;$entry-&amp;gt;setFieldValue('fieldHandle', $selected);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;edit&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Another approach - a little bit less code and more general since it's the same for every single field in Craft - but more resource heavy&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('handle);&#xA;$selected = $field-&amp;gt;serializeValue($entry-&amp;gt;getFieldValue('handle'), $entry);&#xA;$selected[] = 'anotherValue';&#xA;$entry-&amp;gt;setFieldValue('handle', $selected);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-05T10:38:15.817" LastActivityDate="2018-05-05T10:38:15.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26017" PostTypeId="1" CreationDate="2018-05-04T17:28:06.110" Score="2" ViewCount="874" Body="&lt;p&gt;This thread &lt;a href=&quot;https://craftcms.stackexchange.com/questions/11366/export-craft-data/11375?noredirect=1#comment34104_11375&quot;&gt;Export Craft Data&lt;/a&gt; leads me to add a new question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is a good Craft 3 export plugin?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know several for imports, for example the FeedMe plugin is doing a great job, but nothing to export data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Export buttons for all views in CP. (Columns can be defined) &lt;/li&gt;&#xA;&lt;li&gt;related entries/categories can be included in the export &lt;/li&gt;&#xA;&lt;li&gt;in an extra view you can prepare templates of exports (like in the Wordpress plugin WPAllExport)&lt;/li&gt;&#xA;&lt;li&gt;It should also be possible to define a path where it exports the data on a regular basis&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(And I think you can imagine much more benefits...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And NO, the ElementAPI Plugin does not fit my needs. It has to be Client-Usable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We created a lot of web applications where we always implement some kind of export. If there is nothing out there I am really thinking of creating a plugin. Is there anyone else out there willing to support an ideal &lt;strong&gt;Export Plugin&lt;/strong&gt; (and is also willing to pay for a Pro Version ) &lt;/p&gt;&#xA;" OwnerUserId="6225" LastEditorUserId="57" LastEditDate="2018-05-07T23:48:44.207" LastActivityDate="2018-05-07T23:48:44.207" Title="Are there any alternatives to the deprecated Export plugin?" Tags="&lt;plugins&gt;&lt;craft3&gt;&lt;json&gt;&lt;csv&gt;&lt;export&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26018" PostTypeId="2" ParentId="26017" CreationDate="2018-05-04T17:35:10.480" Score="1" Body="&lt;p&gt;Assuming you want to export to a CSV, I'd recommend trying the Sprout Reports plugin...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/reports&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/craft-plugins/reports&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-05-04T17:35:10.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26019" PostTypeId="1" CreationDate="2018-05-04T18:54:24.313" Score="0" ViewCount="13" Body="&lt;p&gt;Each of my entries has a table with budget projections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I loop through related entries.   &lt;strong&gt;But, how can I loop through and bring in the related table?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my table for the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set field = craft.app.fields.getFieldByHandle('budgetProjections') %}&#xA;    &amp;lt;table width=&quot;100%&quot;&amp;gt;&#xA;        &amp;lt;tr&amp;gt;&#xA;&#xA;            {% for column in field.settings.columns %}&#xA;                &amp;lt;th&amp;gt;{{ column.heading }}&amp;lt;/th&amp;gt;&#xA;            {% endfor %}&#xA;&#xA;        &amp;lt;/tr&amp;gt;&#xA;        {% for row in entry.budgetProjections %}&#xA;        &amp;lt;tr&amp;gt;    &#xA;            &amp;lt;td&amp;gt;{{ row.col1 }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col2 }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col3 }}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col4 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col5 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col6 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col7 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col8 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col9 | number_format (0,'.',',')}}&amp;lt;/td&amp;gt;&#xA;            &amp;lt;td&amp;gt;{{ row.col10 | number_format (0,'.',',') }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;/tr&amp;gt;          &#xA;        {% endfor %}&#xA;    &amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my loop for related entries.  It creates a button and link for each related entry.  &lt;strong&gt;But now, I want to pull in the related table.  How do I do that?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set related = entry.relatedBudgetItems.all() %}&#xA;    {% if related %}&#xA;&#xA;    &amp;lt;p&amp;gt; {% for item in related %}&#xA;&#xA;        &amp;lt;a href=&quot;{{ item.getUrl() }}&quot; class=&quot;button primary radius&quot;&amp;gt;&amp;lt;i&amp;gt;{{ item.title}} ({{ item.lineItem }})-  &amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/p&amp;gt;   &#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-04T18:54:24.313" Title="How can I pull in a related table?" Tags="&lt;templating&gt;&lt;relatedto&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26020" PostTypeId="1" AcceptedAnswerId="27407" CreationDate="2018-05-04T19:32:02.303" Score="1" ViewCount="836" Body="&lt;p&gt;I want to setup an assets feed using the &lt;code&gt;FeedMe&lt;/code&gt; plug-in.  Everything is well documented, but the documentation for assets is still TBA. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I previously created and updated entries using &lt;code&gt;FeedMe&lt;/code&gt;.  Now, I want to add a PDF asset to each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My PDFs are already uploaded to an S3 bucket assigned to the asset field I want to &lt;code&gt;FeedMe&lt;/code&gt; to update.  But, I can take them down and start clean if that works best.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-08-22T18:10:37.847" Title="How do I setup an assets feed using the FeedMe plugin?" Tags="&lt;plugins&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26021" PostTypeId="1" AcceptedAnswerId="26027" CreationDate="2018-05-04T19:58:50.470" Score="2" ViewCount="835" Body="&lt;p&gt;I am building a feed using Element API. I am currently looping through Matrix blocks to get various data (based on the help from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13118/how-do-you-use-the-element-api-plugin-to-output-matrix-blocks-for-an-entry?rq=1&quot;&gt;this post&lt;/a&gt;). One of the matrix blocks contains a Super Table field, with various fields inside of that. Here is the relevant section of my Element API config file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(Entry $entry) {&#xA;  $contentBlocksArray = [];&#xA;&#xA;     foreach ($entry-&amp;gt;contentBlocks as $block){&#xA;       switch($block-&amp;gt;type-&amp;gt;handle) {&#xA;&#xA;         case 'introText':&#xA;           $contentBlocksArray[] = [&#xA;             'introText' =&amp;gt; [&#xA;               'body' =&amp;gt; $block-&amp;gt;body,&#xA;             ]&#xA;            ];&#xA;            break;&#xA;&#xA;          case 'twoColumnText':&#xA;             $contentBlocksArray[] = [&#xA;               'twoColumnText' =&amp;gt; [&#xA;                  'columnTextBlocks' =&amp;gt; [&#xA;                      'icon' =&amp;gt; $block-&amp;gt;icon,&#xA;                      'text' =&amp;gt; $block-&amp;gt;text&#xA;                  ]&#xA;                ]&#xA;              ];&#xA;              break;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first case in this switch works as expected. 'introText' is the Matrix box and 'body' is a plaintext field inside that block. The second case is where I'm having trouble. 'twoColumnText' is the Matrix block and 'columnTextBlocks' is a Super Table field with two plaintext fields. The api returns a response, but both 'icon' and 'text' = null. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried calling some of the functions as demonstrated in Super Tables docs &lt;a href=&quot;https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but no luck. I am by no means a php / laravel / etc developer, so I might be missing something that would be obvious to such a developer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect it's something similar to retrieving images where I have to loop through the Super Table fields, but I don't know what that syntax would look like. &lt;/p&gt;&#xA;" OwnerUserId="8340" LastEditorUserId="8340" LastEditDate="2018-05-04T20:10:10.120" LastActivityDate="2018-08-30T14:31:44.910" Title="Using Element API to output Super Table fields" Tags="&lt;plugin-elementapi&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26022" PostTypeId="1" CreationDate="2018-05-05T10:57:50.343" Score="1" ViewCount="31" Body="&lt;p&gt;I have implemented an if/else statement and when I add the information to the 'else' part it outputs three duplicates of the same content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calling the if statement to check if the user is signed in here more andless.&#xA;If they are they will get a booking form which shows up fine and only one of them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for user in craft.users.groups('nomad') %}&#xA;{% if user.isCurrent %}&#xA;&amp;lt;div class=&quot;wrapper&quot;&amp;gt;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    {% for entry in craft.entries.section('studios').search(studio) %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[studioEmail]&quot; value=&quot;{{ entry.email &#xA;    }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; &#xA;    value=&quot;amForms/submissions/saveSubmission&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;bookingForm&quot;&amp;gt;&#xA;&#xA;    {# Optional: Redirect URL. Will redirect to current page by default. #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;booking-form/thank-you&quot;&amp;gt;&#xA;&#xA;    {{ craft.amForms.displayAntispam() }}&#xA;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-firstName&quot; class=&quot;sr-only&quot;&amp;gt;First &#xA;     Name&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fields-firstName&quot; &#xA;      name=&quot;fields[firstName]&quot; autocomplete=&quot;off&quot; placeholder=&quot;First Name&quot; &#xA;     value=&quot;{{ currentUser.firstName }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-lastName&quot; class=&quot;sr-only&quot;&amp;gt;Last Name&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fields-lastName&quot; &#xA;               name=&quot;fields[lastName]&quot; autocomplete=&quot;off&quot; placeholder=&quot;Last &#xA;               Name&quot; value=&quot;{{ currentUser.lastName }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-mobileNumber&quot; class=&quot;sr-only&quot;&amp;gt;Mobile Number&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fields-mobileNumber&quot; name=&quot;fields[mobileNumber]&quot; autocomplete=&quot;off&quot; placeholder=&quot;Mobile Number&quot; value=&quot;{{ currentUser.mobileNumber }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-startDate&quot; class=&quot;sr-only&quot;&amp;gt;Start &#xA;                Date&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fields-startDate&quot; &#xA;                name=&quot;fields[startDate]&quot; autocomplete=&quot;off&quot; placeholder=&quot;start &#xA;        Date&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-endDate&quot; class=&quot;sr-only&quot;&amp;gt;End Date&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fields-endDate&quot; name=&quot;fields[endDate]&quot; &#xA;                autocomplete=&quot;off&quot; placeholder=&quot;End Date&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;input__wrapper&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;fields-studio&quot; class=&quot;sr-only&quot;&amp;gt;Studio&amp;lt;/label&amp;gt;&#xA;                &amp;lt;select name=&quot;fields[studio]&quot; id=&quot;fields-studio&quot;&amp;gt;&#xA;                    {% for entry in craft.entries.section('studios').find() %}&#xA;                        &amp;lt;option value=&quot;{{ entry.title }}&quot;&#xA;&#xA;                        {% if studio == entry.title %}&#xA;                                selected=&quot;selected&quot;&#xA;                        {% endif %}&#xA;&#xA;&#xA;                        &amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/select&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then this is the else statement. I think I might need to add something to the     {% else %}. Though I don't see why it would be outputting three duplicates of the same content in the first place.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% else %}&#xA;  &amp;lt;section class=&quot;form__wrapper&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;content__form_wrapper sign-up_wrapper&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Become a Digital Nomad and join the community&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;You need to be a member to rent a desk, it will only take a moment of   &#xA;    your and you will be on your way.&amp;lt;/p&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;{{ siteUrl }}users/sign-up&quot; class=&quot;&quot;&amp;gt;Sign Up&amp;lt;/a&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help :)&lt;/p&gt;&#xA;" OwnerUserId="8342" LastActivityDate="2018-05-05T15:27:29.893" Title="Else statement outputting three bits of content" Tags="&lt;users&gt;&lt;current-user&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26023" PostTypeId="1" AcceptedAnswerId="26037" CreationDate="2018-05-05T13:18:20.823" Score="1" ViewCount="924" Body="&lt;p&gt;I've got 12 pending tasks, and can't get rid of the first stuck one.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;CP-&amp;gt;Utilities-&amp;gt;Clear Caches&lt;/code&gt; doesn't seem to help.  &lt;/li&gt;&#xA;&lt;li&gt;In the database, in &lt;code&gt;craft_queue&lt;/code&gt; there were five rows, the first one seeming to be the stuck one. I deleted all of those&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Still the first task is stuck, and by now there are 14 tasks waiting.&lt;br&gt;&#xA;I see that &lt;code&gt;craft_templatecachequeries&lt;/code&gt; has over 11,000 rows. Would those be helpful to delete?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-05-06T01:06:17.373" LastActivityDate="2018-05-07T13:16:07.380" Title="In Craft 3, how to clear stuck &quot;Deleting Stale Template Caches&quot;" Tags="&lt;craft3&gt;&lt;stalled-tasks&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26024" PostTypeId="2" ParentId="26022" CreationDate="2018-05-05T15:27:29.893" Score="1" Body="&lt;p&gt;In Craft there are several so called &lt;a href=&quot;https://docs.craftcms.com/v2/templating/global-variables.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;global variables&lt;/a&gt; one of them is the &lt;code&gt;currentUser&lt;/code&gt; thus you can check if someone is logged in with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %} &#xA;&#xA;{% else %} &#xA;&#xA;{% endif %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't need to loop a user array &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-05T15:27:29.893" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26025" PostTypeId="2" ParentId="22546" CreationDate="2018-05-05T16:17:28.860" Score="1" Body="&lt;p&gt;Algolia changed their index quotas, requiring records to be no larger than 10kb for the Community Edition plan. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue was solved by upgrading my to the Essential plan, and creating a custom mapping with the Search Plus plugin, to make sure I kept the record size only as large as it needed to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was experiencing issues particularly with Commerce products that had variants and other custom fields. &lt;/p&gt;&#xA;" OwnerUserId="6265" LastActivityDate="2018-05-05T16:17:28.860" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26026" PostTypeId="2" ParentId="22546" CreationDate="2018-05-05T16:49:53.443" Score="1" Body="&lt;p&gt;As the first answer states, the reason why this is happening is Algolia changed the maximum record size on the free plan. When syncing the index, at some point you are likely getting a 400 error from a specific entry causing the index sync to stop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can upgrade to essential to essentially get an increased record size threshold. However from the code side, you can implement a few measures to help avoid this error altogether.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Truncate the returned output for fields that are typically large, so when Algolia maps it, it takes a limited value.&lt;/li&gt;&#xA;&lt;li&gt;Chunk/split larger records into parts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://discourse.algolia.com/t/spliting-long-text-to-records/3832/4&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://discourse.algolia.com/t/spliting-long-text-to-records/3832/4&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-05-05T16:49:53.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26027" PostTypeId="2" ParentId="26021" CreationDate="2018-05-05T19:00:15.433" Score="3" Body="&lt;p&gt;Here is a solution I found. Define an empty array, then loop over it, providing whatever keys you want to return from the Super Table fields. Simply by looping over &lt;code&gt;$block-&amp;gt;columnTextBlocks&lt;/code&gt; (the handle of my Super Table field), Element API returns the information for the fields within the Super Table. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; case 'twoColumnText':&#xA;&#xA;    $SuperTableRows = [];&#xA;&#xA;    foreach ($block-&amp;gt;columnTextBlocks as $row){&#xA;        $SuperTableRows[] = [&#xA;            'fieldHandle1' =&amp;gt; $row-&amp;gt;fieldHandle1,&#xA;            'fieldHandle2' =&amp;gt; $row-&amp;gt;fieldHandle2,&#xA;            'fieldHandle3' =&amp;gt; $row-&amp;gt;fieldHandle3&#xA;        ];&#xA;    }&#xA;&#xA;    $contentBlocksArray[] = [&#xA;        'twoColumnText' =&amp;gt; [&#xA;            'columnTextBlocks' =&amp;gt; $SuperTableRows,&#xA;        ]&#xA;    ];&#xA;&#xA;break;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need additional information about the Super Table fields, such as Placeholder text, field id's, etc. you can add a generic call to the Super Table field like so (using the same names as my previous code example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$contentBlocksArray[] = [&#xA;    'twoColumnText' =&amp;gt; [&#xA;        'generic' =&amp;gt; $block-&amp;gt;columnTextBlocks,&#xA;        'columnTextBlocks' =&amp;gt; $SuperTableRows,&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now in Element API, the &quot;generic&quot; object includes a customFields array for each field within the Super Table. This only becomes available when you loop over the Super Table field, otherwise it would be &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some pictures of what the data from Element API looks like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9LsVT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9LsVT.png&quot; alt=&quot;Return Super Table fields data from Element API&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x7nza.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x7nza.png&quot; alt=&quot;Complete field data from Super Table field item in Element API&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simplified version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(Entry $entry) {&#xA;   $SuperTableRows = [];&#xA;&#xA;   foreach ($entry-&amp;gt;superTableFieldHandle as $row){&#xA;     $SuperTableRows[] = [&#xA;       'fieldHandle1' =&amp;gt; $row-&amp;gt;fieldHandle1,&#xA;       'fieldHandle2' =&amp;gt; $row-&amp;gt;fieldHandle2&#xA;     ];&#xA;   }&#xA;&#xA;&#xA;   return [&#xA;     'SuperTableRows' =&amp;gt; $SuperTableRows&#xA;   ];&#xA; },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8340" LastEditorUserId="8340" LastEditDate="2018-08-30T14:31:44.910" LastActivityDate="2018-08-30T14:31:44.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26028" PostTypeId="1" CreationDate="2018-05-05T21:28:01.147" Score="2" ViewCount="994" Body="&lt;p&gt;This is my first Craft website, and after trying out Craft 2 I decided it would be a good idea to have move my site to Craft 3 for longevity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used to the free Contact Form plugin and managed to make AJAX work perfectly with Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the same code does not work with Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a simple contact form at the bottom of &lt;a href=&quot;https://haydentomas.co.uk&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://haydentomas.co.uk&lt;/a&gt; where the AJAX works perfectly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used exactly the same code on a Craft 3 install at &lt;a href=&quot;https://letsdocode.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://letsdocode.com&lt;/a&gt;. The error messages come up correctly if you don't fill in the form properly, and I do get an email if it does get filled in. But I cannot make the form success message appear when it has been completed successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the JS I have an success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function(response) {&#xA;    if (response.success) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Statement that holds some HTML that appears on an id and also another statement that hides the form completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not work and I am wondering if there is a change in Craft 3 that means I have to change the code slightly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My else statement works perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My JS is below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;script&amp;gt;&#xA;    $('form').submit(function(ev) {&#xA;      // Prevent the form from actually submitting&#xA;      ev.preventDefault();&#xA;      var formData = new FormData($(this)[0]);&#xA;      // Send it to the server&#xA;      $.ajax('/', {    &#xA;        url:  '/',&#xA;        data: formData,&#xA;        type: 'POST',&#xA;        async: false,&#xA;        cache: false,&#xA;        contentType: false,&#xA;        processData: false,&#xA;        success: function(response) {&#xA;        if (response.success) {&#xA;          document.getElementById(&quot;notice&quot;).innerHTML = '&amp;lt;h2&amp;gt;Success!&amp;lt;/h2&amp;gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&amp;lt;div class=&quot;6u&quot;&amp;gt;&amp;lt;img class=&quot;monkey&quot; src=&quot;https://haydentomas.co.uk//images/monkey.svg&quot;/&amp;gt; &amp;lt;/div&amp;gt;&amp;lt;div class=&quot;6u&quot;&amp;gt;&amp;lt;p&amp;gt;Thank you for your message&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;I will get back to you as soon as possible, usually within 24 hours&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Talk soon! Hayden&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;';&#xA;          // $('form')[0].reset();&#xA;          document.getElementById(&quot;form&quot;).style.display = &quot;none&quot;;&#xA;        } else {&#xA;            // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;            // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;            document.getElementsByName('fromName')[0].placeholder='Name is required';&#xA;            document.getElementsByName('fromEmail')[0].placeholder='Email is required';&#xA;            document.getElementsByName('message')[0].placeholder='Message is required';&#xA;            }&#xA;          }&#xA;          });&#xA;      });&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My form is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;form&quot;&amp;gt;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;CRAFT_CSRF_TOKEN&quot; value=&quot;p_O1wR-QVP9G9WpcPZ90Fl4K82X8kOvZ33FAXa7fej9HSTOMW4zC_GWWsVDAVlvkr_TjeheMVdsk15JD5C8D-CSrFP0Ehb9kCoyHF42u_37Myy_akFOwXWJprfT4KWOqpzUhWd6r0ib9QLr7G2cDBUtxDH9JgIF3alyLyHuZhZXAO_eR79zoCVniIzlieZZi0FOsLQhYQxSpOVuzLDdFAg7P2U7zQBUXSJ1dnNXapMuyTUjLcuu3sJNFLzwozOcOGqo1K9kGRSTxXU2_bF4FctCHwoxe-gXSCLBcBRDzN1s9S7c9yNWZ6etHMC_7qxNXf31luALE9sgZ9dcy92c6gJaS2xggume9EOKnd4dLNMkRmiTEZeaIXTLvsXG5yplOqvNJ6aVhhW5XXpmRzh1ayJNXFGm7zuRHxDfOjFYmaVRmP0lJEK3tNCc_yowjrcDn8A_B4Z2JnGAx2hdvViDeVuQvnVEsajowmAp__gJ_FlRrm7gPlCRyYTzJLtSTls2fnDkCoB7b-9v6FURVfpmjRSyZfGqWVgRDpBV0xVo9dRc=&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;b72e5e9e85a0ff7d840441aa540d6d32c6d554d22c025c8fc4dc8e0804c9475fcontact/thanks&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-name&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-email&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="57" LastEditDate="2018-05-08T00:17:48.727" LastActivityDate="2020-01-10T04:29:14.917" Title="Contact Form AJAX not working in Craft 3" Tags="&lt;craft3&gt;&lt;ajax&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26029" PostTypeId="1" CreationDate="2018-05-05T21:37:46.210" Score="1" ViewCount="276" Body="&lt;p&gt;I've inherited a Craft 2 site to do maintenance. I don't yet have access to production server. I need to grab the production server DB to run locally on my machine. When I click &quot;Backup Database&quot; from the sites cms back-end, it doesn't appear to download a local &lt;code&gt;.sql&lt;/code&gt; file. I assume it's backing up as a file on the actual server. How can I download that backup locally?&lt;/p&gt;&#xA;" OwnerUserId="7445" LastActivityDate="2018-05-09T21:51:48.173" Title="Save out Backup Database to local file" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26030" PostTypeId="1" AcceptedAnswerId="26032" CreationDate="2018-05-05T23:45:49.790" Score="1" ViewCount="692" Body="&lt;p&gt;I have searched for a couple hours for help on this. No luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the docs &lt;a href=&quot;https://docs.craftcms.com/v3/asset-bundles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first two passes were unsuccessful so I deleted everything and started over. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I created a plugin scaffolding with a single controller and successfully registered that plugin. I did not edit anything in that plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I created the file &quot;FooBundle.php&quot; in the following folder structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recoveryfinder&#xA;--myPlugin&#xA;  --src&#xA;    --FooBundle.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3) I edited the contents of FooBundle.php to be exactly the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace ns\prefix;&#xA;&#xA;use craft\web\AssetBundle;&#xA;use craft\web\assets\cp\CpAsset;&#xA;&#xA;class MyPluginAsset extends AssetBundle&#xA;{&#xA;    public function init()&#xA;    {&#xA;        // define the path that your publishable resources live&#xA;        $this-&amp;gt;sourcePath = '@ns/prefix/resources';&#xA;&#xA;        // define the dependencies&#xA;        $this-&amp;gt;depends = [&#xA;            CpAsset::class,&#xA;        ];&#xA;&#xA;        // define the relative path to CSS/JS files that should be registered with the page&#xA;        // when this asset bundle is registered&#xA;        $this-&amp;gt;js = [&#xA;            'script.js',&#xA;        ];&#xA;&#xA;        $this-&amp;gt;css = [&#xA;            'styles.css',&#xA;        ];&#xA;&#xA;        parent::init();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lastly I added the following line after my {% extends &quot;base.html&quot; %} in my index.html. My first two lines of index.html look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;base.html&quot; %}&#xA;{% do view.registerAssetBundle(&quot;ns\\prefix\\FooBundle&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I refresh my site index page I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ReflectionException&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Class ns\prefix\FooBundle does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="8071" LastEditDate="2018-05-06T13:49:05.703" LastActivityDate="2018-05-06T13:49:05.703" Title="Trouble getting an asset bundle registered" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26031" PostTypeId="2" ParentId="25543" CreationDate="2018-05-06T01:33:47.193" Score="1" Body="&lt;p&gt;I sent the Craft 2 database to Pixel and Tonic, and Brad kindly updated it for me.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-06T01:33:47.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26032" PostTypeId="2" ParentId="26030" CreationDate="2018-05-06T05:58:51.967" Score="1" Body="&lt;p&gt;Because your &lt;code&gt;FooBundle&lt;/code&gt; has the classname &lt;code&gt;MyPluginAsset&lt;/code&gt;rename your class to &lt;code&gt;FooBundle&lt;/code&gt; and it should work (if your namespace is correct, since your information are not really detailed as always)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs are not supposed to be a place for copy paste but a source for information. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-06T06:04:14.077" LastActivityDate="2018-05-06T06:04:14.077" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26033" PostTypeId="1" AcceptedAnswerId="26034" CreationDate="2018-05-06T09:58:14.640" Score="1" ViewCount="188" Body="&lt;p&gt;Trying to add entries in a visual array on my homepage.&#xA;Problem is that I need a special class on the last item in every row.&lt;br&gt;&#xA;&lt;em&gt;col_last&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to get my head around how to automate this, in order to avoid &quot;special entries&quot; for these. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.entries.section('services').orderBy('postDate asc').all() %}&#xA;    &amp;lt;div class=&quot;clear bottommargin-sm&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col_one_third *col_last*&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;feature-box fbox-small fbox-plain&quot; data-animate=&quot;fadeIn&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;fbox-icon&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;i class=&quot;icon-{{ item.serviceIcon }}&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;h3&amp;gt;{{ item.title }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ item.serviceTagline }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8346" LastEditorUserId="57" LastEditDate="2018-05-08T00:26:05.147" LastActivityDate="2018-05-08T00:26:05.147" Title="Add style on every third entry" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26034" PostTypeId="2" ParentId="26033" CreationDate="2018-05-06T10:37:20.807" Score="4" Body="&lt;p&gt;You can &lt;code&gt;cycle&lt;/code&gt; your &lt;code&gt;loop.index0&lt;/code&gt; property if you really need to add a class &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ cycle(['first', 'second', 'last'], loop.index0) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the other elements don't need a class insert an empty value &lt;code&gt;''&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can as well check for a specific value of your &lt;code&gt;loop.index0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if you just want to add certain style attributes you can use the &lt;a href=&quot;https://css-tricks.com/how-nth-child-works/&quot; rel=&quot;nofollow noreferrer&quot;&gt;nth&lt;/a&gt; selector &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-06T10:37:20.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26037" PostTypeId="2" ParentId="26023" CreationDate="2018-05-07T13:16:07.380" Score="3" Body="&lt;p&gt;The answer was, to delete the first row of the &lt;code&gt;queue&lt;/code&gt; table &lt;em&gt;in the correct database&lt;/em&gt;.&lt;br&gt;&#xA;Also, it helped to increase &lt;code&gt;max_execution_time&lt;/code&gt; in /etc/php/7.1/apache2/php.ini&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-07T13:16:07.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26038" PostTypeId="1" CreationDate="2018-05-07T15:45:05.600" Score="2" ViewCount="1765" Body="&lt;p&gt;I'm trying to get the same features I had in Craft 2 in Craft 3 redactor field.&#xA;This is the code I had in config/redactor/standard.json:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;],&#xA;    &quot;plugins&quot;: [&quot;fullscreen&quot;,&quot;table&quot;,&quot;video&quot;],&#xA;    &quot;formatting&quot;: [&quot;p&quot;],&#xA;    formattingAdd: {&#xA;        &quot;heading&quot;: {&#xA;            title: 'Heading',&#xA;            args: ['h2']&#xA;        },&#xA;        &quot;sub-heading&quot;: {&#xA;            title: 'Sub-Heading',&#xA;            args: ['h3']&#xA;        },&#xA;        &quot;sub-sub-heading&quot;: {&#xA;            title: 'Sub-sub-Heading',&#xA;            args: ['h4']&#xA;        },&#xA;        &quot;add-attr&quot;: {&#xA;            title: 'Make a link a button',&#xA;            args: ['div', { 'class': 'button' }]&#xA;        }&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Craft 3 changes page says:&#xA;&quot;All strings must use double quotes rather than single quotes&quot; and that &quot;All object properties (the config setting names) must be wrapped in double quotes&quot;.&#xA;I've tried changing them all and I still get an error. I've looked on the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imperavi Redactor docs pages&lt;/a&gt;, but they don't use double quotes and their examples are not in the same format as the craft plugin uses. Some more examples would be useful.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-05-09T08:19:09.360" Title="Redactor 3 config code" Tags="&lt;redactor&gt;&lt;plugin-redactorstyles&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26039" PostTypeId="2" ParentId="24081" CreationDate="2018-05-07T15:53:50.083" Score="2" Body="&lt;p&gt;&lt;code&gt;web.log&lt;/code&gt; is incredibly verbose, I agree. I think Andrew Welch is right that you should use the Yii2 Debug Toolbar for elaborate stuff, but if you just need some one-line logs to get your bearings in a method, I'd set up the log statement like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::info(&quot;hello!&quot;, __METHOD__);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That second parameter will categorize your call with the method you're calling the log function from. Then, to filter it out from all the rest of &lt;code&gt;web.log&lt;/code&gt;, you can run a tail command with a filter on it. Assuming you've got a Unix shell, something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;tail -f web.log | grep &quot;YourMethodName&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now as you execute your commands and trigger the log statements, you'll only see those that are coming from the method you're debugging.&lt;/p&gt;&#xA;" OwnerUserId="5341" LastActivityDate="2018-05-07T15:53:50.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26040" PostTypeId="1" AcceptedAnswerId="26045" CreationDate="2018-05-07T16:23:28.737" Score="1" ViewCount="36" Body="&lt;p&gt;I have an &lt;code&gt;index page&lt;/code&gt; for articles in a &lt;code&gt;section&lt;/code&gt;.  Call the section &quot;dogs.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I template to output the name of the &lt;code&gt;section&lt;/code&gt;?&lt;/strong&gt;  This is &lt;code&gt;not&lt;/code&gt; an entry, but an index page.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-07T18:04:49.423" Title="How do I print the name of the Section on an index page" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26041" PostTypeId="1" CreationDate="2018-05-07T16:42:28.540" Score="1" ViewCount="1111" Body="&lt;p&gt;I'm on Craft 3 and I've just switched some of my asset sources to S3. I'm developing on a local instance, and it all seems to be working. However, I needed to reconnect a couple images in my homepage single entry because I changed the path to one of the subfolders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I save the entry after selecting the images I want to use from my new S3 volume, I get an error page with the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;fopen({my local root}/craft/storage/runtime/assets/tempuploads/user_1/my-file.jpeg):&#xA;  failed to open stream: No such file or directory&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I opened up the tempuploads folder and (as expected) only 2 of the 3 images I wanted to change were in there. Ok. So I manually added the third image, thinking it was a fluke and tried again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got the error again, but for a different image. I went back to the folder and only 1 image was in there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems there's something wonky going on with the temp upload process. Has anyone run across this before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\base\ErrorException: fopen(/Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/storage/runtime/assets/tempuploads/user_1/home-video-still.jpeg): failed to open stream: No such file or directory in /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php:181&#xA;Stack trace:&#xA;#0 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler-&amp;gt;handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181)&#xA;#1 [internal function]: craft\web\ErrorHandler-&amp;gt;handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181, Array)&#xA;#2 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php(181): fopen('/Users/ahall/Pr...', 'rb')&#xA;#3 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Filesystem.php(196): League\Flysystem\Adapter\Local-&amp;gt;readStream('user_1/home-vid...')&#xA;#4 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(173): League\Flysystem\Filesystem-&amp;gt;readStream('user_1/home-vid...')&#xA;#5 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(187): craft\base\FlysystemVolume-&amp;gt;getFileStream('user_1/home-vid...')&#xA;#6 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1387): craft\base\FlysystemVolume-&amp;gt;saveFileLocally('user_1/home-vid...', '/Users/ahall/Pr...')&#xA;#7 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1224): craft\elements\Asset-&amp;gt;_relocateFile()&#xA;#8 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Asset-&amp;gt;afterSave(false)&#xA;#9 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Assets.php(187): craft\services\Elements-&amp;gt;saveElement(Object(craft\elements\Asset))&#xA;#10 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Assets.php(402): craft\services\Assets-&amp;gt;moveAsset(Object(craft\elements\Asset), Object(craft\models\VolumeFolder))&#xA;#11 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Assets-&amp;gt;afterElementSave(Object(craft\elements\MatrixBlock), false)&#xA;#12 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/MatrixBlock.php(395): craft\base\Element-&amp;gt;afterSave(false)&#xA;#13 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\MatrixBlock-&amp;gt;afterSave(false)&#xA;#14 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Matrix.php(683): craft\services\Elements-&amp;gt;saveElement(Object(craft\elements\MatrixBlock), false, true)&#xA;#15 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Matrix.php(646): craft\services\Matrix-&amp;gt;saveField(Object(craft\fields\Matrix), Object(craft\elements\Entry))&#xA;#16 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Matrix-&amp;gt;afterElementSave(Object(craft\elements\Entry), false)&#xA;#17 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Entry.php(987): craft\base\Element-&amp;gt;afterSave(false)&#xA;#18 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Entry-&amp;gt;afterSave(false)&#xA;#19 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/controllers/EntriesController.php(539): craft\services\Elements-&amp;gt;saveElement(Object(craft\elements\Entry))&#xA;#20 [internal function]: craft\controllers\EntriesController-&amp;gt;actionSaveEntry()&#xA;#21 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#22 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#23 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Controller.php(76): yii\base\Controller-&amp;gt;runAction('save-entry', Array)&#xA;#24 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('save-entry', Array)&#xA;#25 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module-&amp;gt;runAction('entries/save-en...', Array)&#xA;#26 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(522): craft\web\Application-&amp;gt;runAction('entries/save-en...', Array)&#xA;#27 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(258): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#28 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#29 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/web/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#30 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3900" LastEditorUserId="3900" LastEditDate="2018-05-10T15:50:20.373" LastActivityDate="2018-05-10T16:20:43.520" Title="Craft 3 error on upload fopen() tempuploads &quot;failed to open stream: No such file or directory&quot;" Tags="&lt;craft3&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26042" PostTypeId="2" ParentId="26038" CreationDate="2018-05-07T16:55:08.703" Score="1" Body="&lt;p&gt;i have tested it with the latest Craft 3 version and it works if everything is in double quotes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;format&quot;,&quot;bold&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;],&#xA;    &quot;plugins&quot;: [&quot;fullscreen&quot;,&quot;table&quot;,&quot;video&quot;],&#xA;    &quot;formatting&quot;: [&quot;p&quot;],&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;heading&quot;: {&#xA;            &quot;title&quot;: &quot;Heading&quot;,&#xA;            &quot;args&quot;: [&quot;h2&quot;]&#xA;        },&#xA;        &quot;sub-heading&quot;: {&#xA;            &quot;title&quot;: &quot;Sub-Heading&quot;,&#xA;            &quot;args&quot;: [&quot;h3&quot;]&#xA;        },&#xA;        &quot;sub-sub-heading&quot;: {&#xA;            &quot;title&quot;: &quot;Sub-sub-Heading&quot;,&#xA;            &quot;args&quot;: [&quot;h4&quot;]&#xA;        },&#xA;        &quot;add-attr&quot;: {&#xA;            &quot;title&quot;: &quot;Make a link a button&quot;,&#xA;            &quot;args&quot;: [&quot;div&quot;, { &quot;class&quot;: &quot;button&quot; }]&#xA;        }&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe it was only a typo?&lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2018-05-07T16:55:08.703" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26044" PostTypeId="1" AcceptedAnswerId="26047" CreationDate="2018-05-07T17:51:17.167" Score="1" ViewCount="192" Body="&lt;p&gt;I apologize if this has been asked or addressed already, but I have a question concerning Element Queries. The docs show two possible ways: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chained Methods&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries()&#xA;    .section('news')&#xA;    .limit(10) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Batch-set Parameters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries({&#xA;    section: 'news',&#xA;    limit: 10&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The examples shown above (from the docs) obviously accomplish the exact same thing--but what is the difference, if any?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is my assumption that the batch-set way of querying elements allows for more options, is that true? And does either way have an effect on performance?&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-05-07T18:59:07.633" Title="Difference between chained and batch element queries?" Tags="&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26045" PostTypeId="2" ParentId="26040" CreationDate="2018-05-07T18:04:49.423" Score="2" Body="&lt;pre&gt;&lt;code&gt;{{ craft.app.getSections().getSectionByHandle('dogs').name }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-07T18:04:49.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26047" PostTypeId="2" ParentId="26044" CreationDate="2018-05-07T18:43:22.113" Score="3" Body="&lt;h3&gt;general&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The first way creates an object of type &lt;code&gt;EntryQuery&lt;/code&gt;, you then call the 2 &lt;strong&gt;functions&lt;/strong&gt; &lt;code&gt;section&lt;/code&gt; and &lt;code&gt;limit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PHP you would do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = Entry::find()-&amp;gt;section('news')-&amp;gt;limit(10);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second creates an array &lt;code&gt;section =&amp;gt; 'news', 'limit' =&amp;gt; 10&lt;/code&gt; you then call &lt;code&gt;Yii2::configure($query, $array)&lt;/code&gt; with your &lt;code&gt;EntryQuery&lt;/code&gt; which does: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function configure($object, $properties)&#xA;{&#xA;    foreach ($properties as $name =&amp;gt; $value) {&#xA;        $object-&amp;gt;$name = $value;&#xA;    }&#xA;&#xA;    return $object;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you &lt;strong&gt;don't&lt;/strong&gt; call functions but define the &lt;strong&gt;properties&lt;/strong&gt; directly. In PHP it would look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = Entry::find();&#xA;Craft::configure($query, ['section' =&amp;gt; 'news', 'limit' =&amp;gt; 10]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Performance&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Because of the above it's &lt;strong&gt;important&lt;/strong&gt; what you do. The first way calls &lt;strong&gt;functions&lt;/strong&gt; the second way calls &lt;strong&gt;properties&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your comparison the first way is a little bit faster because you didn't attach functions that requires the use of &lt;code&gt;magic methods&lt;/code&gt; =&gt; &lt;code&gt;__call&lt;/code&gt; (in the &lt;code&gt;ElementQueryBehavior&lt;/code&gt;) as soon as you search/filter for custom fields the &lt;code&gt;Craft::configure&lt;/code&gt; way will always be a little bit faster because it can set the values directly instead of using the resource heavy &lt;a href=&quot;http://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;__call&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// faster&#xA;$query = Entry::find()&#xA;    -&amp;gt;section('news')&#xA;    -&amp;gt;limit(10)&#xA;&#xA;// slower&#xA;$query = Entry::find();&#xA;Craft::configure($query, [&#xA;    'section' =&amp;gt; 'news', &#xA;    'limit' =&amp;gt; 10&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Against&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// slower&#xA;$query = Entry::find()&#xA;    -&amp;gt;section('news')&#xA;    -&amp;gt;limit(10)&#xA;    -&amp;gt;multiselect('test')&#xA;    -&amp;gt;subline('foo');&#xA;&#xA;// faster&#xA;$query = Entry::find();&#xA;Craft::configure($query, [&#xA;    'section' =&amp;gt; 'news',&#xA;    'limit' =&amp;gt; 10,&#xA;    'multiselect' =&amp;gt; 'test',&#xA;    'subline' =&amp;gt; 'foo'&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Conclusion&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Keep in mind when I say &quot;slower&quot; or &quot;faster&quot; I'm talking about a few milliseconds (when I run the last example 1000 times its 511ms vs 497ms) so in the end it does not really matter. If it's really important in terms of speed: as soon as you use the &lt;code&gt;__call&lt;/code&gt; method because you need to change properties in the &lt;code&gt;ElementQueryBehavior&lt;/code&gt; you would prefer to use &lt;code&gt;Craft::configure&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides that: there is absolutely no difference between those two.. There are no hidden &quot;benefits&quot; you don't have more options, you can't do something &quot;better&quot;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-07T18:59:07.633" LastActivityDate="2018-05-07T18:59:07.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26049" PostTypeId="1" AcceptedAnswerId="26434" CreationDate="2018-05-07T21:03:32.437" Score="1" ViewCount="110" Body="&lt;p&gt;We are using PayPal standard as an option for payments which works in the main currency (GBP) but not in any of the others eg (CAD). We're seeing in the plugin logs for craft commerce:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Forced] Item bag total price does not equal the orders totalPrice, some payment gateways will complain.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what could be wrong? It seems that this is a problem with PayPal adding up the totals and seeing they are wrong? but this is all done on craft side so not too sure.&lt;/p&gt;&#xA;" OwnerUserId="5838" LastEditorUserId="5838" LastEditDate="2018-05-16T09:08:21.820" LastActivityDate="2018-06-05T19:42:20.247" Title="PayPal Currency - Item bag total price does not equal the orders totalPrice, some payment gateways will complain" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26051" PostTypeId="1" CreationDate="2018-05-07T22:58:27.013" Score="2" ViewCount="665" Body="&lt;p&gt;I'm using Craft 3, and I'm struggling to make sense of how to address the following. (I've not had need to venture into a third URL segment before.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a url of the form: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;served by a template: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories/_entry&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware that the 'entry' variable gets set automatically. So far so basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I also want to address urls of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories/{slug}/{variable}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…where &lt;code&gt;variable&lt;/code&gt; is used to fetch content from a specific Matrix row in the entry that matches &lt;code&gt;slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important that &lt;code&gt;variable&lt;/code&gt; forms a third segment addressable as its own page, and not just a URL query parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried 2 approaches:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Getting segment 3 and then using it in a &lt;strong&gt;conditional&lt;/strong&gt; inside of &lt;code&gt;stories/_entry&lt;/code&gt;:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set seg3 = craft.app.request.getSegment(3) %}&#xA;{% if seg3|length %}&#xA;    {% include 'partials/extract' %}&#xA;{% else %}&#xA;    {% include 'partials/story' %}&#xA;{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…but when seg3 is not empty Craft says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Template not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Setting a &lt;strong&gt;route&lt;/strong&gt; to a different template:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories/{slug}/{*}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…is processed by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories/_extract&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…in which, as a basic test I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% block meta %}&#xA;    &amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…but Craft then reports a Twig runtime error, saying: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;entry&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seg2 = craft.app.request.getSegment(2) %}&#xA;{% for entry in craft.entries.section('stories').slug(seg2).all() %}&#xA;    {% block meta %}&#xA;        &amp;lt;title&amp;gt;{{ entry.title }}&amp;lt;/title&amp;gt;&#xA;    {% endblock %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…but that makes no difference.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is my approach 2 definition of &lt;code&gt;entry&lt;/code&gt; wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does a non-empty value in segment 3 cause approach 1 to fail?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm obviously missing something fundamental here. Any pointers much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastActivityDate="2018-05-11T08:42:50.970" Title="Template logic to address a third URL segment" Tags="&lt;templating&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26052" PostTypeId="2" ParentId="26028" CreationDate="2018-05-08T00:17:12.410" Score="1" Body="&lt;p&gt;Contact Form 2 (for Craft 3), still returns a JSON encoded &lt;code&gt;success: true&lt;/code&gt; response on successful submission, but Craft 3 by default will only respond with JSON if &lt;code&gt;$request-&amp;gt;getAcceptsJson()&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt; on a request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L64-L66&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L64-L66&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately that ends up hitting the Yii 2 method &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-request#getAcceptableContentTypes()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;getAcceptableContentTypes&lt;/a&gt; which checks the &lt;code&gt;$_SERVER['HTTP_ACCEPT']&lt;/code&gt; server variable for the key &lt;code&gt;application/json&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So most likely your server is not configured to return &lt;code&gt;application/json&lt;/code&gt; as a valid &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; content-type.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="-1" LastEditDate="2020-01-10T04:29:14.917" LastActivityDate="2020-01-10T04:29:14.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26053" PostTypeId="1" CreationDate="2018-05-08T00:21:31.460" Score="1" ViewCount="826" Body="&lt;p&gt;I followed the document to create a migration, add a schema version, install migration and add schema codes into &lt;code&gt;Install.php&lt;/code&gt;. Last I run the migrate up command, but no table is created. Anyone could tell me what is going wrong please?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-05-08T21:47:08.110" Title="how to create a new table in database" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;table&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26054" PostTypeId="2" ParentId="25939" CreationDate="2018-05-08T00:23:52.330" Score="1" Body="&lt;p&gt;I'm about 99% sure that if you swap from using &lt;code&gt;sendmail&lt;/code&gt; to SMTP, or almost any of the other mail transports in the &quot;Mail Adaptors&quot; category in the Craft 3 Plugin Store (SES, Postmark, Mandrill), they won't end up going through &lt;code&gt;proc_open&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-08T00:23:52.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26055" PostTypeId="1" AcceptedAnswerId="26060" CreationDate="2018-05-08T08:12:50.350" Score="3" ViewCount="492" Body="&lt;p&gt;I am setting up a vagrant development environment and I was wondering if it is possible to somehow pass the installation configuration when running &lt;code&gt;./craft setup&lt;/code&gt; command to avoid any user interaction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checking the help output of the &lt;code&gt;setup/index&lt;/code&gt; says --interactive: boolean, 0 or 1 (whether to run the command interactively.). When executing &lt;code&gt;./craft setup --interactive 0&lt;/code&gt; nothing happens. Am I doing something wrong? I tried searching for an explanation and usages of &lt;code&gt;setup&lt;/code&gt; parameters but to no avail. &lt;/p&gt;&#xA;" OwnerUserId="8326" LastEditorUserId="8326" LastEditDate="2018-05-09T17:50:01.397" LastActivityDate="2018-05-09T17:50:01.397" Title="Automated Craft 3 installation" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26056" PostTypeId="1" AcceptedAnswerId="26059" CreationDate="2018-05-08T11:36:23.853" Score="1" ViewCount="331" Body="&lt;p&gt;I have a plugin with custom elements that can be sorted on a handful of fields in my CP element index page. I can get the DATECREATED displaying correctly that Craft generates automatically but I cannot sort by it. I am getting an ambiguous column error in SQL and not sure how I am supposed to include these native columns so they can be sorted like in the CP entries section. The other field, SCORE, is an example of one of my fields that I adjust the html display a bit (add a '%' sign) when it's rendered and sorting doesn't seem to work. Anybody with some tips? I tried referencing the craft app EntryElementType file but still could not quite figure it out. Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineSortableAttributes()&#xA;{&#xA;    $attributes = array(&#xA;        'id'            =&amp;gt; Craft::t('ID'), &#xA;        'userId'        =&amp;gt; Craft::t('User'), &#xA;        'testId'        =&amp;gt; Craft::t('Test ID'),  &#xA;        'score'         =&amp;gt; Craft::t('Score'), // no errors but not sorting properly&#xA;        'dateCreated'   =&amp;gt; Craft::t('Date Created'), &#xA;    );&#xA;&#xA;    return $attributes;&#xA;}&#xA;&#xA;/**&#xA; * Returns the attributes that can be shown/sorted by in table views.&#xA; *&#xA; * @param string|null $source&#xA; * @return array&#xA; */&#xA;public function defineAvailableTableAttributes()&#xA;{&#xA;    $attributes = array(&#xA;        'id'                =&amp;gt; Craft::t('ID'), &#xA;        'userId'            =&amp;gt; Craft::t('User'), &#xA;        'testId'            =&amp;gt; Craft::t('Test'), &#xA;        'results'           =&amp;gt; Craft::t('Results'), &#xA;        'score'             =&amp;gt; Craft::t('Score'), &#xA;        'ipAddress'         =&amp;gt; Craft::t('IP Address'), &#xA;        'dateCreated'       =&amp;gt; Craft::t('Date Created'), &#xA;    );&#xA;&#xA;    return $attributes;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error for dateCreated (when trying to sort by the field) is below. When trying to sort by SCORE I don't notice an error but the order doesn't seem to change, so I'm not terribly sure what's not quite right there. Maybe something to do with sorting on fields where I customize the html output?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CDbException&#xA;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `ts`.* FROM `craft_elements` `elements` JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id JOIN `craft_testcenter_submissions` `ts` ON ts.id = elements.id WHERE (elements_i18n.locale = :locale) AND (elements.archived = 0) GROUP BY `elements`.`id` ORDER BY `dateCreated` ASC LIMIT 50. Bound with :locale='en_us' (/volume1/storage/___/HTML/01/craft/app/framework/db/CDbCommand.php:543)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my modifyElementsQuery&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)&#xA;{&#xA;    $query&#xA;        -&amp;gt;addSelect('ts.*')&#xA;        -&amp;gt;join('testcenter_submissions ts', 'ts.id = elements.id');&#xA;&#xA;    if ($criteria-&amp;gt;userId)&#xA;    {&#xA;        $query-&amp;gt;andWhere(DbHelper::parseParam('ts.userId', $criteria-&amp;gt;userId, $query-&amp;gt;params));&#xA;    }&#xA;&#xA;    if ($criteria-&amp;gt;testId)&#xA;    {&#xA;        $query-&amp;gt;andWhere(DbHelper::parseParam('ts.testId', $criteria-&amp;gt;testId, $query-&amp;gt;params));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3362" LastEditorUserId="3362" LastEditDate="2018-05-08T13:10:07.047" LastActivityDate="2018-05-08T13:37:15.653" Title="Custom element index page (cp) sortable on dateCreated?" Tags="&lt;plugin-development&gt;&lt;element&gt;" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="26057" PostTypeId="1" AcceptedAnswerId="26058" CreationDate="2018-05-08T11:48:37.613" Score="1" ViewCount="341" Body="&lt;p&gt;I want to programmatically get all the values contained in a field of type &lt;strong&gt;category&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing this on &lt;code&gt;Elements::EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I dump &lt;code&gt;$event-&amp;gt;element-&amp;gt;getFieldValue('productTheme')&lt;/code&gt; I get the field but I did't find how to go from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My final goal is to have the categories from the category field in an array (not all the categories in the category group, but only those selected in the field).&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-05-09T06:58:01.990" LastActivityDate="2018-05-09T06:58:01.990" Title="Craft 3 - Programatically get all the values contained in a field of type category" Tags="&lt;categories&gt;&lt;craft3&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26058" PostTypeId="2" ParentId="26057" CreationDate="2018-05-08T11:54:07.823" Score="1" Body="&lt;p&gt;Your field contains an object of type &lt;code&gt;ElementQuery&lt;/code&gt; in order to get all &lt;code&gt;Categories&lt;/code&gt; you'll need to execute it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$categories = $element-&amp;gt;getfieldValue('productTheme')-&amp;gt;all();&#xA;$categoryTitles = [];&#xA;for($categories as $category){&#xA;    $categoryTitles[] = $category-&amp;gt;title;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please read the &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-08T11:54:07.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26059" PostTypeId="2" ParentId="26056" CreationDate="2018-05-08T13:37:15.653" Score="1" Body="&lt;p&gt;The issue was in the &lt;code&gt;modifyElementsQuery&lt;/code&gt; function. When you select all columns &lt;code&gt;addSelect('*')&lt;/code&gt; to the query your &lt;code&gt;SQL&lt;/code&gt; will select the &lt;code&gt;dateCreated&lt;/code&gt; and &lt;code&gt;dateUpdated&lt;/code&gt; columns of your custom table as well. &#xA;As soon as you want to order by one of those columns the database does not know which &lt;code&gt;dateCreated&lt;/code&gt; should be sorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to select only the unique attribute columns in your custom element table. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To debug your &lt;code&gt;score&lt;/code&gt; sorting issue the best thing is to go into &lt;code&gt;craft/app/elementtypes/BaseElementType.php&lt;/code&gt; and check the function &lt;code&gt;getIndexHtml&lt;/code&gt;. You can &lt;code&gt;var_dump&lt;/code&gt; the results of the following variables&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Combine them, accounting for the possibility that $order could contain multiple values,&#xA;// and be defensive about the possibility that the first value actually has &quot;asc&quot; or &quot;desc&quot;&#xA;&#xA;// typeId             =&amp;gt; typeId [sort]&#xA;// typeId, title      =&amp;gt; typeId [sort], title&#xA;// typeId, title desc =&amp;gt; typeId [sort], title desc&#xA;// typeId desc        =&amp;gt; typeId [sort]&#xA;&#xA;$criteria-&amp;gt;order = preg_replace('/^(.*?)(?:\s+(?:asc|desc))?(,.*)?$/i', &quot;$1 {$sort}$2&quot;, $order);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and compare the output with default Entry fields.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-08T13:37:15.653" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26060" PostTypeId="2" ParentId="26055" CreationDate="2018-05-08T16:06:15.340" Score="3" Body="&lt;p&gt;The command line syntax for install without user input should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;./craft install --interactive=0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a great article describing just such an automated approach &lt;a href=&quot;https://medium.com/@timknight/moving-from-mamp-to-valet-for-craft-cms-3-and-everything-else-587cfee5cf4c&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="8326" LastEditDate="2018-05-09T09:31:08.860" LastActivityDate="2018-05-09T09:31:08.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26061" PostTypeId="1" AcceptedAnswerId="26075" CreationDate="2018-05-08T16:13:09.413" Score="1" ViewCount="164" Body="&lt;p&gt;is it possible to specify the Redactor config file when creating a Redactor field programmatically? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping I could do something like the following but have had no success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$bodyField = $fields&amp;gt;createField([&#xA;    'type' =&amp;gt; 'craft\\redactor\\Field',&#xA;    'groupId' =&amp;gt; 1,&#xA;    'name' =&amp;gt; 'Body',&#xA;    'handle' =&amp;gt; 'body',&#xA;    'settings' =&amp;gt; [&#xA;       'redactorConfig' =&amp;gt; 'Simple.json'&#xA;    ]&#xA;]);&#xA;&#xA;$fields-&amp;gt;saveField($bodyField);     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="6624" LastEditDate="2018-05-08T16:59:55.277" LastActivityDate="2018-05-09T09:17:22.323" Title="Specify Redactor config in migration" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;php&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26062" PostTypeId="1" AcceptedAnswerId="26064" CreationDate="2018-05-08T16:19:55.873" Score="2" ViewCount="55" Body="&lt;p&gt;I'm reviewing the code on a project that has the following defined in the main &lt;code&gt;config.php&lt;/code&gt; as a boolean:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cache =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the docs this doesn't seem to be referenced anywhere. Does the config option exist in Craft 2? I'm not seeing any documentation that states it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know others like &lt;code&gt;cacheMethod&lt;/code&gt; and &lt;code&gt;cacheDuration&lt;/code&gt; do.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-05-08T16:53:57.663" Title="Does the Craft config var &quot;cache&quot; exist?" Tags="&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26063" PostTypeId="1" CreationDate="2018-05-08T16:51:50.680" Score="1" ViewCount="41" Body="&lt;p&gt;I'm new using Craft, I have a table type field display on one of my template but I need to display row 2 and 7 in different places of the page how can display only those two rows.&lt;/p&gt;&#xA;" OwnerUserId="8353" LastActivityDate="2018-05-08T16:56:24.320" Title="I have a table type field that I need to access to rows individually" Tags="&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26064" PostTypeId="2" ParentId="26062" CreationDate="2018-05-08T16:53:57.663" Score="1" Body="&lt;p&gt;I don't believe this is a valid configuration value. You will use the cache as a tag in your twig files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% for element in entry.hugeField %}&#xA;        {{ element.nestedAsset.first().url }}&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The cache is most effective at nested queries in matrix fields or asset fields or category fields. Do not use the cache for plain text fields or those that can be accessed in linear time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would just delete that line from your &lt;code&gt;config.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-05-08T16:53:57.663" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26065" PostTypeId="2" ParentId="26061" CreationDate="2018-05-08T16:55:58.593" Score="1" Body="&lt;p&gt;Maybe you should take a look what the function &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-fields.html#createField()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;createField&lt;/a&gt; does&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Creates a field with a given config.&lt;/p&gt;&#xA;&lt;p&gt;return    &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-fieldinterface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft\base\FieldInterface&lt;/a&gt;  The field&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It only creates a PHP object but does not save the field at all.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getFields()-&amp;gt;saveField($field);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;is what you want&lt;/p&gt;&#xA;&lt;p&gt;This is what the &lt;code&gt;FieldsController&lt;/code&gt; does to store a new field&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSaveField()&#xA;{&#xA;    $this-&amp;gt;requirePostRequest();&#xA;&#xA;    $fieldsService = Craft::$app-&amp;gt;getFields();&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $type = $request-&amp;gt;getRequiredBodyParam('type');&#xA;&#xA;    $field = $fieldsService-&amp;gt;createField([&#xA;        'type' =&amp;gt; $type,&#xA;        'id' =&amp;gt; $request-&amp;gt;getBodyParam('fieldId'),&#xA;        'groupId' =&amp;gt; $request-&amp;gt;getRequiredBodyParam('group'),&#xA;        'name' =&amp;gt; $request-&amp;gt;getBodyParam('name'),&#xA;        'handle' =&amp;gt; $request-&amp;gt;getBodyParam('handle'),&#xA;        'instructions' =&amp;gt; $request-&amp;gt;getBodyParam('instructions'),&#xA;        'translationMethod' =&amp;gt; $request-&amp;gt;getBodyParam('translationMethod', Field::TRANSLATION_METHOD_NONE),&#xA;        'translationKeyFormat' =&amp;gt; $request-&amp;gt;getBodyParam('translationKeyFormat'),&#xA;        'settings' =&amp;gt; $request-&amp;gt;getBodyParam('types.'.$type),&#xA;    ]);&#xA;&#xA;    if (!$fieldsService-&amp;gt;saveField($field)) {&#xA;        Craft::$app-&amp;gt;getSession()-&amp;gt;setError(Craft::t('app', 'Couldn’t save field.'));&#xA;&#xA;        // Send the field back to the template&#xA;        Craft::$app-&amp;gt;getUrlManager()-&amp;gt;setRouteParams([&#xA;            'field' =&amp;gt; $field&#xA;        ]);&#xA;&#xA;        return null;&#xA;    }&#xA;&#xA;    Craft::$app-&amp;gt;getSession()-&amp;gt;setNotice(Craft::t('app', 'Field saved.'));&#xA;&#xA;    return $this-&amp;gt;redirectToPostedUrl($field);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-05-08T16:55:58.593" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26066" PostTypeId="2" ParentId="26063" CreationDate="2018-05-08T16:56:24.320" Score="1" Body="&lt;p&gt;&lt;code&gt;{{ entry.myTableField[1] }}&lt;/code&gt; and &lt;code&gt;{{ entry.myTableField[6] }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also might want to check to make sure they exist.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.myTableField[1] is defined and entry.myTableField[1] is not empty %}&#xA;     {{entry.myTableField[1]}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-05-08T16:56:24.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26067" PostTypeId="2" ParentId="25497" CreationDate="2018-05-08T18:15:43.620" Score="2" Body="&lt;p&gt;Is &lt;code&gt;bizName&lt;/code&gt; your categories field?  Try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in block.bizName.all() %}&#xA;   {{ category.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="5557" LastEditDate="2018-05-08T18:19:29.733" LastActivityDate="2018-05-08T18:19:29.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26069" PostTypeId="2" ParentId="26053" CreationDate="2018-05-08T21:47:08.110" Score="2" Body="&lt;p&gt;Not sure I'm following 100%, but in Craft 3, you can add the code necessary to create the new table in your plugin's &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-migrations.html#install-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Install migration&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will run every time someone does a fresh installation of your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the people that already have your plugin installed, you need to &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-migrations.html#creating-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a migration&lt;/a&gt; that also creates the table.  The code for the table creation will be very similar in both places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the latter, in order for Craft to know a plugin has a new migration is wants to run, you'll need to bump your plugin's &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-migrations.html#executing-migrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;schema version number&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-08T21:47:08.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26070" PostTypeId="1" CreationDate="2018-05-08T23:46:17.600" Score="1" ViewCount="45" Body="&lt;p&gt;In my plugin's field types I am extending the &lt;code&gt;BaseRelationField&lt;/code&gt;.  How do you activate the &quot;&lt;em&gt;Add Element&lt;/em&gt;&quot; button that shows in the Element Selector modal when the element is double clicked?&lt;/p&gt;&#xA;" OwnerUserId="331" LastActivityDate="2018-05-08T23:46:17.600" Title="How do you include an &quot;Add element&quot; button to the element selector modal" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;fieldtypes&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26071" PostTypeId="1" AcceptedAnswerId="26073" CreationDate="2018-05-09T00:56:28.917" Score="0" ViewCount="169" Body="&lt;p&gt;I realize this is a very general question but is there a way to sort a matrix field? So not alphabetically but a very certain order.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-09T03:33:50.187" Title="Sorting Matrix Field" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26072" PostTypeId="2" ParentId="25973" CreationDate="2018-05-09T02:00:46.543" Score="2" Body="&lt;p&gt;IMO, the issue is with this line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SetEnv HTTP_ACCEPT text/html,application/xhtml+xml,application/xml,application/json;q=0.9,*/*;q=0.8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With ACCEPT headers set to a fixed value, it's impossible for Craft 3 to distinguish between Json and HTML requests. This must have been a necessity with the nginx proxy setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest removing this line from Apache and configure nginx to pass through the original request headers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use proxy_pass, trying adding this line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    ...&#xA;    proxy_pass_request_headers on;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR, if you prefer a more direct approach&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    ...&#xA;    proxy_set_header Accept $http_accept;&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8357" LastActivityDate="2018-05-09T02:00:46.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26073" PostTypeId="2" ParentId="26071" CreationDate="2018-05-09T03:33:50.187" Score="1" Body="&lt;p&gt;I had not seen this before, but it's the solution to my problem as I was dealing with grouping.  See link below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19046/group-entries-by-section&quot;&gt;Group entries by section&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-09T03:33:50.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26074" PostTypeId="2" ParentId="26038" CreationDate="2018-05-09T08:19:09.360" Score="4" Body="&lt;p&gt;After several iterations I came up with this that works. But still puzzled as when to use [ ] or { }.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;html&quot;,&quot;undo&quot;,&quot;format&quot;,&quot;bold&quot;,&quot;lists&quot;,&quot;link&quot;,&quot;file&quot;],&#xA;    &quot;plugins&quot;: [&quot;fullscreen&quot;,&quot;table&quot;,&quot;video&quot;],&#xA;    &quot;formatting&quot;: [&quot;p&quot;],&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;heading&quot;: {&#xA;            &quot;title&quot;: &quot;Heading&quot;,&#xA;            &quot;api&quot;: &quot;module.block.format&quot;,&#xA;            &quot;args&quot;: {&#xA;                &quot;tag&quot;: &quot;h2&quot;&#xA;            }&#xA;        },&#xA;        &quot;sub-heading&quot;: {&#xA;            &quot;title&quot;: &quot;Sub-Heading&quot;,&#xA;            &quot;api&quot;: &quot;module.block.format&quot;,&#xA;            &quot;args&quot;: {&#xA;                &quot;tag&quot;: &quot;h3&quot;&#xA;            }&#xA;        },&#xA;        &quot;sub-sub-heading&quot;: {&#xA;            &quot;title&quot;: &quot;Sub-sub-Heading&quot;,&#xA;            &quot;api&quot;: &quot;module.block.format&quot;,&#xA;            &quot;args&quot;: {&#xA;                &quot;tag&quot;: &quot;h4&quot;&#xA;            }&#xA;        },&#xA;        &quot;add-attr&quot;: {&#xA;            &quot;title&quot;: &quot;Make a link a button&quot;,&#xA;            &quot;api&quot;: &quot;module.block.format&quot;,&#xA;            &quot;args&quot;: {&#xA;                &quot;tag&quot;: &quot;div&quot;,&#xA;                &quot;class&quot;: &quot;button&quot;&#xA;            }&#xA;        }&#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-05-09T08:19:09.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26075" PostTypeId="2" ParentId="26061" CreationDate="2018-05-09T09:17:22.323" Score="1" Body="&lt;p&gt;I wanted to follow up on this for anyone else who might encounter the same issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem was trying to set the redactor config within a programatically generated Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you need to use the &lt;code&gt;typesettings&lt;/code&gt; keyword, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fields-&amp;gt;createField([&#xA;        'type' =&amp;gt; 'craft\\fields\\Matrix',&#xA;        'groupId' =&amp;gt; 1,&#xA;        'name' =&amp;gt; 'Content Builder',&#xA;        'handle' =&amp;gt; 'contentBuilder',&#xA;        'blockTypes' =&amp;gt; [&#xA;            'new1' =&amp;gt; [&#xA;                'name' =&amp;gt; 'Text Block',&#xA;                'handle' =&amp;gt; 'textBlock',&#xA;                'instructions' =&amp;gt; 'A rich text content block',&#xA;                'fields' =&amp;gt; [&#xA;                    'new1' =&amp;gt; [&#xA;                        'type' =&amp;gt; 'craft\\redactor\\Field',&#xA;                        'name' =&amp;gt; 'Rich Text',&#xA;                        'handle' =&amp;gt; 'richText',                            &#xA;                        'typesettings' =&amp;gt; [&#xA;                            'redactorConfig' =&amp;gt; 'Simple.json'&#xA;                        ]&#xA;                    ]&#xA;                ]&#xA;            ]&#xA;       ]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6624" LastActivityDate="2018-05-09T09:17:22.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26076" PostTypeId="1" AcceptedAnswerId="26077" CreationDate="2018-05-09T11:15:24.947" Score="1" ViewCount="122" Body="&lt;p&gt;I'm trying to get some data with eager loading, which results in more queries than before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way to tune down the number of queries as low as possible? As you can see i only need the posBrandKey (text) and id values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;limit = null;&#xA;$criteria-&amp;gt;group = 'productBrand';&#xA;$criteria-&amp;gt;with = array('posBrandKey');&#xA;&#xA;$brands = array();&#xA;foreach ($criteria as $entry) {&#xA;    $key = $entry-&amp;gt;posBrandKey;&#xA;    $brands[$key] = $entry-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to have the best performance possible, this is one of the many queries I call in the same script.&lt;/p&gt;&#xA;" OwnerUserId="8332" LastActivityDate="2018-05-09T11:29:33.493" Title="Correctly using eager loading in Plugin development" Tags="&lt;plugin-development&gt;&lt;performance&gt;&lt;queries&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26077" PostTypeId="2" ParentId="26076" CreationDate="2018-05-09T11:29:33.493" Score="3" Body="&lt;p&gt;Eager loading only works when your field is a &lt;code&gt;RelationField&lt;/code&gt; it does not work with &lt;code&gt;Text&lt;/code&gt; fields. If you goal is to reduce the length of the queries and to maximize your performance you could fetch the raw rows instead of populating the elements.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;$criteria-&amp;gt;status = null;&#xA;$criteria-&amp;gt;limit = null;&#xA;$criteria-&amp;gt;group = 'productBrand';&#xA;&#xA;// create a query&#xA;$query = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;// select only the rows you want/need&#xA;$query-&amp;gt;select('elements.id as id, content.field_posBrandKey as posBrandKey');&#xA;$brands = [];&#xA;// execute it&#xA;$rows = $query-&amp;gt;queryAll();&#xA;&#xA;foreach($rows as $row){&#xA;    $brands[$row['posBrandKey']] = $row['id'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-09T11:29:33.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26078" PostTypeId="1" AcceptedAnswerId="26079" CreationDate="2018-05-09T12:43:21.127" Score="2" ViewCount="84" Body="&lt;p&gt;I've made a projects structure with inside a couple of projects. On the homepage people can fill in a matrix with either a project or a textblock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm capable of looping through the detail pages in the order that they've been made in the Projects section. I can't however make them loop in the order the client orders his Matrix. I'm capable of finding the current detail page I'm on by using relatedTo(entry) however I'm uncapable of using getPrev / getNext. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set source = craft.entries.id(2).first().projectList.type('project').entries.relatedTo(entry) %}&#xA;&#xA;{% for collection in source %}&#xA;&#xA;{% for project in collection.projectEntry %}&#xA;&#xA;    &amp;lt;p&amp;gt;{{project}}&amp;lt;/p&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns the current project I'm visiting. Even when using getPrev(entry) or getPrev(source) in there it keeps on returning my current project instead of the prev/next&lt;/p&gt;&#xA;" OwnerUserId="8359" LastEditorUserId="8359" LastEditDate="2018-05-09T12:49:11.873" LastActivityDate="2018-05-09T13:15:19.690" Title="Previous/Next button to next item in Matrix" Tags="&lt;entries&gt;&lt;matrix&gt;&lt;structure&gt;&lt;loop&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26079" PostTypeId="2" ParentId="26078" CreationDate="2018-05-09T13:15:19.690" Score="1" Body="&lt;p&gt;In order to get previous or next elements in Craft you have to pass the current criteria in the elements &lt;code&gt;getPrev&lt;/code&gt; function. In your case&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria  = craft.entries.id(2).first().projectList.type('project')&#xA;&#xA;{% set prev = collection.getPrev(criteria)  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-09T13:15:19.690" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26080" PostTypeId="1" AcceptedAnswerId="26082" CreationDate="2018-05-09T16:49:25.527" Score="2" ViewCount="130" Body="&lt;p&gt;I upgraded to Redactor 2.0.1 on Craft Pro 3.0.6, and now I'm getting this error anytime I try to edit an entry that uses Redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;InvalidConfigException('Redactor plugin not found: '.$plugin);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have disabled and re-enabled the plugin to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be greatly appreciated. I'm unsure how to make it happy, and I haven't found anything in my Google/StackExchange searching.&lt;/p&gt;&#xA;" OwnerUserId="8360" LastActivityDate="2018-05-09T17:50:59.567" Title="Cannot edit entries after Redactor 2.0.1 upgrade" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26082" PostTypeId="2" ParentId="26080" CreationDate="2018-05-09T17:50:59.567" Score="1" Body="&lt;p&gt;I have an unfair advantage since I got to look at your logs from your support ticket, but here's the error from the logs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[error][yii\base\InvalidConfigException] yii\base\InvalidConfigException: Redactor plugin not found: source&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you look at the &lt;a href=&quot;https://github.com/craftcms/redactor/blob/v2/CHANGELOG.md#removed&quot; rel=&quot;nofollow noreferrer&quot;&gt;Changelog for Redactor 2.0.0&lt;/a&gt;, you'll see the &quot;Source&quot; plugin is no longer needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upgrade from Redactor 1.x to 2.0 should have tried to clean up any &lt;code&gt;craft/config/redactor/*.json&lt;/code&gt; config files you might have removing references to the &quot;Source&quot; plugin, but something might have went wrong (permission errors are the most common cause of that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, if you update those Redactor config files, the error should go away.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-09T17:50:59.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26083" PostTypeId="1" CreationDate="2018-05-09T19:10:03.133" Score="2" ViewCount="229" Body="&lt;p&gt;This is from a template that worked in Craft 2, but doesn't in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.type('publications').orderBy(&quot;postDate desc&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;entries.count() outputs 80&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for cat in allCats %}&#xA;    {% set catEntries = entries.relatedTo(cat) %}&#xA;    {% if catEntries | length or cat.slug==&quot;all&quot; or cat.slug==&quot;toutes&quot; %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ cat.url }}&quot; {% if category is defined and cat.slug == category.slug %}class=&quot;current&quot;{% endif %}&amp;gt;{{ cat.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This iterates through all categories with correct entries associated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, entries.count() outputs 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like entries is getting set to the last value instead of just passing the resulting object to the variable.  This is not how it worked before.  Is there a way to reset this ?&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-05-09T21:01:51.270" Title="Entries object getting reset after a relatedTo query" Tags="&lt;templating&gt;&lt;entries&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26084" PostTypeId="1" AcceptedAnswerId="26086" CreationDate="2018-05-09T19:49:09.937" Score="2" ViewCount="58" Body="&lt;p&gt;I'm looking for a shorter way of writing this check. If the user visits the search page, apply the 3 column to the search-block, else use the 5 column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentPage = 'search' %}&#xA;{% if currentPage == &quot;search&quot; %}&#xA;   {% for project in pageEntries %}&#xA;      {% include '_partials/search-block' with {&#xA;         extraClasses: '3col'                    &#xA;         } &#xA;      %}&#xA;   {% endfor %}&#xA;{% else %}&#xA;   {% for project in pageEntries %}&#xA;      {% include '_partials/search-block' with {&#xA;         extraClasses: '5col'                    &#xA;         } &#xA;      %}&#xA;   {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2018-05-09T20:26:22.533" Title="Check if page is Search, use different classes" Tags="&lt;conditional&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26085" PostTypeId="1" AcceptedAnswerId="26100" CreationDate="2018-05-09T20:02:53.437" Score="0" ViewCount="208" Body="&lt;p&gt;I am trying to exclude terms in my search when using the element api. I have successfully managed to include terms and search them by fields in my entries. I would now like to be able to exclude different terms in those fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case 'recipeIngredients' is a matrix field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my criteria search so far : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Get search query text&#xA;$searchQuery = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('searchQuery');&#xA;//Search in either title or ingredients&#xA;if ($searchQuery) $criteria['search'] = &quot;title:'&quot;.$searchQuery.&quot;' OR recipeIngredients:'&quot;.$searchQuery.&quot;'&quot;;&#xA;&#xA;//Get excluded ingredients query&#xA;$excludedQuery = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('xq');&#xA;if ($excludedQuery) {&#xA;    if (!isset($criteria['search'])) {&#xA;        $criteria['search'] = '';&#xA;    } else {&#xA;        $criteria['search'] = $criteria['search'].' AND ';&#xA;    }&#xA;    $criteria['search'] = $criteria['search'].&quot;recipeIngredients: not '&quot;.$excludedQuery.&quot;'&quot;;&#xA;}&#xA;&#xA;//Get result count&#xA;$count = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam( 'count' );&#xA;$count = $count ? $count : 10;//Default to ten if no parameter&#xA;&#xA;return [&#xA;    'elementType'     =&amp;gt; Entry::class,&#xA;    'criteria'        =&amp;gt; $criteria,&#xA;    'elementsPerPage' =&amp;gt; $count,&#xA;    'transformer'     =&amp;gt; function ( Entry $entry ) {&#xA;        return [&#xA;            'name'      =&amp;gt; $entry-&amp;gt;title,&#xA;            'url'        =&amp;gt; $entry-&amp;gt;url,&#xA;            //'json_url'    =&amp;gt; UrlHelper::url( &quot;recipe/{$entry-&amp;gt;id}.json&quot; ),&#xA;            'picture_url' =&amp;gt; $entry-&amp;gt;recipeImage-&amp;gt;one()-&amp;gt;getUrl(),&#xA;            'portions'   =&amp;gt; (float)$entry-&amp;gt;recipePortions,&#xA;            'time'       =&amp;gt; [&#xA;                'total' =&amp;gt; (float)$entry-&amp;gt;recipeTotalTime&#xA;            ]&#xA;        ];&#xA;    },&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out if I should be trying to append the excluded terms to the search query, and my syntax is wrong, or if there is another criteria property available to exclude results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the &lt;a href=&quot;https://github.com/craftcms/docs/blob/v3/en/element-queries.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQuery&lt;/a&gt; page mentionned in the &lt;a href=&quot;https://github.com/craftcms/element-api#criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; no longer exists. I assume, it's &lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, but I'm not certain. &lt;/p&gt;&#xA;" OwnerUserId="8165" LastActivityDate="2018-05-10T15:57:28.130" Title="ElementAPI : Excluding terms from search criteria" Tags="&lt;search&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26086" PostTypeId="2" ParentId="26084" CreationDate="2018-05-09T20:26:22.533" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set class = (currentPage == &quot;search&quot;)? '5col' : '3col' %} &#xA;{% for project in pageEntries %}&#xA;     {% include '_partials/search-block' with { &#xA;        extraClasses: class&#xA;     } %} &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-09T20:26:22.533" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26087" PostTypeId="2" ParentId="26083" CreationDate="2018-05-09T20:37:16.403" Score="1" Body="&lt;p&gt;Based on the bug report found here (&lt;a href=&quot;https://github.com/craftcms/cms/issues/2160&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2160&lt;/a&gt;), I am now creating a variable that contains all of the items prior to filtering it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.type('publications').orderBy(&quot;postDate desc&quot;) %}&#xA;{% set allEntries = entries.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can then use entries to filter through the available categories and then use allEntries to loop through all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand I could also have used clone() to get a copy to work from in my category loop. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catEntries = clone(entries).relatedTo(cat) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3524" LastEditorUserId="3524" LastEditDate="2018-05-09T21:01:51.270" LastActivityDate="2018-05-09T21:01:51.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26088" PostTypeId="2" ParentId="26029" CreationDate="2018-05-09T21:51:48.173" Score="1" Body="&lt;p&gt;If you're in the Craft 2 control panel, and you click on &lt;em&gt;Backup Database&lt;/em&gt;, it should always store a .sql file in &lt;code&gt;craft/storage/backups&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the &lt;em&gt;Download Backup&lt;/em&gt; box checked, then also your browser should download a .zip file containing that .sql file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other notes:&lt;br&gt;&#xA;It appears to work the same in Craft 3&lt;br&gt;&#xA;If you do &lt;em&gt;Clear Caches&lt;/em&gt; first, you may get a significantly smaller file.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-09T21:51:48.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26089" PostTypeId="1" AcceptedAnswerId="26090" CreationDate="2018-05-10T06:45:44.820" Score="1" ViewCount="56" Body="&lt;p&gt;Today I updated my craft to latest version Craft V 2.6.3015 by following &lt;a href=&quot;https://docs.craftcms.com/v2/updating.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this url&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got it updated successfully and now my Craft version is 2.6.3015 which is latest of Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After updating the Craft setup, I tested the site, and one of the page is giving an exception as mentioned below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Exception thrown in Make a Payment. Exception: CException: Alias &quot;ext.alpha&quot; is &gt;invalid. Make sure it points to an existing PHP file and the file is readable. in C:\path\craft\app\framework\YiiBase.php:324&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Please help me to get rid of the error.  I checked that the Craft is not having any extension named alpha.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Stack trace:&#xA;&#xA;#0 C:\path\craft\app\framework\validators\CValidator.php(174): YiiBase::import('ext.alpha', true)&#xA;#1 C:\path\craft\app\framework\base\CModel.php(287): CValidator::createValidator('ext.alpha', Object(Craft\BarclaycardEpdq_PaymentModel), Array, Array)&#xA;&amp;gt;#2 C:\path\craft\app\framework\base\CModel.php(260): CModel-&amp;gt;createValidators()&#xA;&amp;gt;#3 C:\path\craft\app\framework\base\CModel.php(158): CModel-&amp;gt;getValidators()&#xA;&amp;gt;#4 C:\path\craft\app\models\BaseModel.php(501): CModel-&amp;gt;validate(NULL, true)&#xA;&amp;gt;#5 C:\path\craft\plugins\barclaycardepdq\services\BarclaycardEpdq_ApiService.php(213): Craft\BaseModel-&amp;gt;validate()&#xA;&amp;gt;#6 C:\path\craft\plugins\barclaycardepdq\services\BarclaycardEpdq_ApiService.php(64): Craft\BarclaycardEpdq_ApiService-&amp;gt;callBarclaycard('Craft\\Barclayca...', Array, 'https://site...', 'payByAlias')&#xA;&amp;gt;#7 C:\path\craft\plugins\rhp\controllers\Rhp_PaymentsController.php(129): Craft\BarclaycardEpdq_ApiService-&amp;gt;makePaymentByAlias(Array)&#xA;&amp;gt;#8 C:\path\craft\app\framework\web\actions\CInlineAction.php(49): Craft\Rhp_PaymentsController-&amp;gt;actionMakeAPayment()&#xA;&amp;gt;#9 C:\path\craft\app\framework\web\CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;&amp;gt;#10 C:\path\craft\app\framework\web\CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;&amp;gt;#11 C:\path\craft\app\framework\web\CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;&amp;gt;#12 C:\path\craft\app\framework\web\CWebApplication.php(282): CController-&amp;gt;run('makeAPayment')&#xA;&amp;gt;#13 C:\path\craft\app\etc\web\WebApp.php(836): CWebApplication-&amp;gt;runController('rhp/payments/ma...')&#xA;&amp;gt;#14 C:\path\craft\app\etc\web\WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;&amp;gt;#15 C:\path\craft\app\framework\base\CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;&amp;gt;#16 C:\path\craft\app\index.php(73): CApplication-&amp;gt;run()&#xA;&amp;gt;#17 C:\path\index.php(13): require_once('C:\\path\\...')&#xA;&amp;gt;#18 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8362" LastEditorUserId="57" LastEditDate="2018-05-10T13:58:38.457" LastActivityDate="2018-05-10T13:58:38.457" Title="Craft 2: Exception: CException: Alias &quot;ext.alpha&quot; is invalid" Tags="&lt;craft-pro&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26090" PostTypeId="2" ParentId="26089" CreationDate="2018-05-10T07:34:41.683" Score="1" Body="&lt;p&gt;Please download below extension and put alpha.php file in your craft extension folder:&#xA;&lt;a href=&quot;https://www.yiiframework.com/extension/alpha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/extension/alpha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck..!!&lt;/p&gt;&#xA;" OwnerUserId="8363" LastActivityDate="2018-05-10T07:34:41.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26091" PostTypeId="2" ParentId="26089" CreationDate="2018-05-10T07:49:52.207" Score="0" Body="&lt;p&gt;Well, I tried to find a solution for the above-mentioned issue with Google and also connected to Craft community on Slack but could not find any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer from @Ankit Sompura fixed my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step -1 :&lt;/strong&gt; following &lt;a href=&quot;https://www.yiiframework.com/extension/alpha&quot; rel=&quot;nofollow noreferrer&quot;&gt;the link&lt;/a&gt; and locate &lt;strong&gt;Downloads&lt;/strong&gt; on right hand side, and click on the link &lt;code&gt;alpha-1.0.tgz&lt;/code&gt; which will get that tgz file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step- 2:&lt;/strong&gt; After extracting the file you will get &lt;code&gt;alpha.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step- 3:&lt;/strong&gt; And place the &lt;code&gt;alpha.php&lt;/code&gt; file into &lt;code&gt;Craft/app/extensions/&lt;/code&gt; and you are done.&#xA;Check the page again and the error will be fixed.&lt;/p&gt;&#xA;" OwnerUserId="8362" LastActivityDate="2018-05-10T07:49:52.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26093" PostTypeId="2" ParentId="26051" CreationDate="2018-05-10T12:14:19.163" Score="4" Body="&lt;p&gt;I would suggest you look into using Craft's Advanced Routing functionality to accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, add the following to your &lt;code&gt;config/routes.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'stories/&amp;lt;slug:\w+&amp;gt;/?&amp;lt;option:\w+&amp;gt;?' =&amp;gt; ['template' =&amp;gt; '_extract'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will then populate the &lt;code&gt;_extract&lt;/code&gt; template with the twig variable &lt;code&gt;{{ slug }}&lt;/code&gt; and also the &lt;code&gt;{{ option }}&lt;/code&gt; variable, if it exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your twig template you can grab the entry and check for the existence of the option variable thus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set entry = craft.entries.section('stories').slug(slug).one() %}&#xA;&#xA;    {% if entry %}&#xA;            &amp;lt;h1&amp;gt;Entry title is: {{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h2&amp;gt;Slug is: {{ slug }} &amp;lt;/h2&amp;gt;&#xA;&#xA;    {% if option is defined %}&#xA;            &amp;lt;h3&amp;gt;Option is: {{ option }}&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd recommend reading the docs on Advanced routing as it's quite a powerful feature: &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/routing.html#advanced-routing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="6624" LastEditDate="2018-05-11T08:42:50.970" LastActivityDate="2018-05-11T08:42:50.970" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26095" PostTypeId="1" AcceptedAnswerId="26096" CreationDate="2018-05-10T13:13:14.860" Score="0" ViewCount="484" Body="&lt;p&gt;I'm attempting to set up ajax filtering for entries using jquery. I'm setting variables in my js based on form field values. The js is triggerd when there's a change in a form field and then the ajax query is fired. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#speciesID, #sex, #site, #ageGroup').change(&#xA;    function(){&#xA;        var speciesVal = $('#speciesID').val();&#xA;        var sexVal = $('#sex').val();&#xA;        var locationVal = $('#location').val();&#xA;        var ageVal = $('#ageGroup').val();&#xA;&#xA;        /* make the ajax call with .ajax */&#xA;        $.ajax({&#xA;            type: 'get',&#xA;            url: '/our-services/adopt',&#xA;            data: {species: speciesVal, sex: sexVal, location: locationVal, age: ageVal},&#xA;            processData: true,&#xA;            success: function(result){$( &quot;.petSearchResult&quot; ).html( result ).show();}&#xA;        })&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having two issues with this approach. 1) The filtering doesn't work; the query returns all entries, regardless of filter data values. 2) The query returns only the entry titles as HTML. When I set the the ajax datatype to 'json' the query returns nothing. I've looked over a number of SE threads related to using ajax to query entries but so far have not been able to piece together a solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the base Twig template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;Template: adopt&#xA;#}&#xA;{% extends craft.app.request.isAjax ? &quot;includes/_petSearch&quot; : &quot;_layout&quot; %}&#xA;{% block content %}&#xA;&amp;lt;form id=&quot;adoptablePets&quot;&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;speciesID&quot;&amp;gt;SPECIES&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;select class=&quot;frmInput&quot; name=&quot;speciesID&quot; id=&quot;speciesID&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Dog&quot;&amp;gt;Dog&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Cat&quot;&amp;gt;Cat&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Rabbit&quot;&amp;gt;Rabbit&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Horse&quot;&amp;gt;Horse&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Small&amp;amp;amp;Furry&quot;&amp;gt;Small&amp;amp;amp;Furry&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Pig&quot;&amp;gt;Pig&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Reptile&quot;&amp;gt;Reptile&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Bird&quot;&amp;gt;Bird&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Barnyard&quot;&amp;gt;Barnyard&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Other than Dog and Cat&quot;&amp;gt;Other than Dog and Cat&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;sex&quot;&amp;gt;SEX&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;select class=&quot;frmInput&quot; name=&quot;sex&quot; id=&quot;sex&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Male&quot;&amp;gt;Male&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Female&quot;&amp;gt;Female&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;age&quot;&amp;gt;AGE&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;select class=&quot;frmInput&quot; name=&quot;age&quot; id=&quot;age&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Over 1 year old&quot;&amp;gt;Over 1 year old&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Under 1 year old&quot;&amp;gt;Under 1 year old&amp;lt;/option&amp;gt;&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div&amp;gt;&#xA;        &amp;lt;label for=&quot;location&quot;&amp;gt;LOCATION&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;        &amp;lt;select class=&quot;frmInput&quot; name=&quot;location&quot; id=&quot;location&quot;&amp;gt;&#xA;            &amp;lt;option value=&quot;&quot; selected=&quot;selected&quot;&amp;gt;All&amp;lt;/option&amp;gt;&#xA;            &amp;lt;option value=&quot;Adoption Center West&quot;&amp;gt;Adoption Center West&amp;lt;/option&amp;gt;&#xA;            {#&amp;lt;option value=&quot;com&quot;&amp;gt;Animals in the Community&amp;lt;/option&amp;gt;#}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{# petSearch non-ajax results #}&#xA;{% set entries = craft.entries.section( 'adoptablePetSearch' ).all() %}&#xA;    {% for entry in entries %}&#xA;        &amp;lt;div&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.petName }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt; {{ entry.sex }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;{{ entry.species }}&amp;lt;/p&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;{# petSearch ajax results #}&#xA;    {% block ajaxContent %}&#xA;        &amp;lt;div class=&quot;petSearchResult&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    {% endblock %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the ajax template with the block to update:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;template: _petSearch&#xA;#}&#xA;&#xA;{% block ajaxContent %}&#xA;&amp;lt;h1&amp;gt;false&amp;lt;/h1&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1077" LastEditorUserId="1077" LastEditDate="2018-05-10T14:50:09.430" LastActivityDate="2018-05-10T15:07:03.243" Title="Ajax query filter for entries" Tags="&lt;ajax&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26096" PostTypeId="2" ParentId="26095" CreationDate="2018-05-10T15:07:03.243" Score="2" Body="&lt;p&gt;You need to fetch your URL parameters via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = craft.app.getRequest().getQueryParam('location') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can then include the parameter to your &lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Query&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section( 'adoptablePetSearch' )&#xA;    .location(location)&#xA;    .all() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-10T15:07:03.243" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26098" PostTypeId="1" AcceptedAnswerId="26133" CreationDate="2018-05-10T15:25:48.840" Score="3" ViewCount="1804" Body="&lt;p&gt;In updating a plugin for Craft 3, at one point I also renamed it, and at various times did things in the wrong order. At this point, Craft shows the old, unwanted plugin, but&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it is not in &lt;code&gt;composer.json&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;it is not in the &lt;code&gt;craft_plugins&lt;/code&gt; table&lt;/li&gt;&#xA;&lt;li&gt;none of its tables are in the database&lt;/li&gt;&#xA;&lt;li&gt;its files have been deleted from craft/vendor/ns/plugin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the CP Plugins page, if I click &lt;em&gt;Remove&lt;/em&gt;, composer updates and says it is successfully removed, but it still shows up under plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does Craft still know of its existence? Do I need to put it back into composer to do a &lt;code&gt;composer remove&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-05-10T16:03:01.693" LastActivityDate="2018-05-13T00:06:19.753" Title="Unable to delete plugin" Tags="&lt;plugins&gt;&lt;uninstall&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26099" PostTypeId="1" CreationDate="2018-05-10T15:47:59.367" Score="1" ViewCount="85" Body="&lt;p&gt;I have set up a number of discounts using Craft Commerce. Those discounts apply to specific groups of users and types of products. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to know inside the template, if a discount is going to be applied without checking the product type or user group of the current user?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-11T03:43:35.007" Title="Is there a way to know if a discount is going to be applied on a product?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26100" PostTypeId="2" ParentId="26085" CreationDate="2018-05-10T15:57:28.130" Score="1" Body="&lt;p&gt;Here is what I ended up changing my code to exclude search items. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Get excluded ingredients query&#xA;$excludedQuery = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('xq');&#xA;if ($excludedQuery) {&#xA;    if (!isset($criteria['search'])) {&#xA;        $criteria['search'] = '';&#xA;    } else {&#xA;        $criteria['search'] = $criteria['search'].' ';&#xA;    }&#xA;    $criteria['search'] = $criteria['search'].&quot;-title:'&quot;.$excludedQuery .&quot;' -recipeIngredients:'&quot;.$excludedQuery .&quot;' &quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8165" LastActivityDate="2018-05-10T15:57:28.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26101" PostTypeId="1" CreationDate="2018-05-10T16:01:55.267" Score="1" ViewCount="256" Body="&lt;p&gt;Using Craft 2. Here's my code, which sends the email fine if I remove the attachment part. Can anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = new EmailModel();&#xA;$email-&amp;gt;toEmail = $toEmail;&#xA;$email-&amp;gt;cc = $ccEmail;&#xA;$email-&amp;gt;bcc = $bccEmail;&#xA;$email-&amp;gt;subject = $subject;&#xA;$email-&amp;gt;body = $body;&#xA;//$email-&amp;gt;attachments = $attachments;&#xA;&#xA;$attachments = [&#xA;  ['path'=&amp;gt;'http://website.localhost/img/uploads/nameoffile.pdf',&#xA;  'name'=&amp;gt;'afile',&#xA;  'encoding'=&amp;gt;'base64',&#xA;  'type'=&amp;gt;'application/pdf']&#xA;];&#xA;if (!empty($attachments)) {&#xA;  foreach ($attachments as $attachment) {&#xA;    if ($attachment) {&#xA;      $email-&amp;gt;addAttachment($attachment['path'], $attachment['name'], 'base64', $attachment['type']);&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;if ($email-&amp;gt;getErrors()) {&#xA;  throw new Exception('there are errors'); // exception not returned&#xA;} &#xA;&#xA;// SEND THE MAIL&#xA;if (craft()-&amp;gt;email-&amp;gt;sendEmail($email)) return true;&#xA;else throw new Exception('not sent'); // returns this exception&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-05-10T16:32:38.087" LastActivityDate="2018-05-10T21:59:54.417" Title="Sending attachments within a plugin" Tags="&lt;plugin-development&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26102" PostTypeId="2" ParentId="26041" CreationDate="2018-05-10T16:20:43.520" Score="1" Body="&lt;p&gt;I was able to fix the issue by manually uploading my images to the new S3 location via the AWS console and refreshing my asset indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like it was just getting confused with the old local asset connections. Hopefully it's not indicative of an underlying problem with my setup.&lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2018-05-10T16:20:43.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26103" PostTypeId="1" AcceptedAnswerId="26106" CreationDate="2018-05-10T18:02:54.823" Score="1" ViewCount="2031" Body="&lt;p&gt;Yii's &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#named-parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;named parameters&lt;/a&gt; are available in the template. For example, for the following route configuration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'post/&amp;lt;post_id:\d+&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'post-entry'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value of &lt;code&gt;post_id&lt;/code&gt; in my template for the request &lt;code&gt;post/3&lt;/code&gt; will be &lt;code&gt;3&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;strong&gt;how can I access it from PHP&lt;/strong&gt;, for example from the &lt;code&gt;Craft::app -&amp;gt; getRequest()&lt;/code&gt; ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I don't mean queryString parameters. QueryString parameters can be accessed using &lt;code&gt;getParam('paramName')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-05-11T09:07:02.997" LastActivityDate="2018-05-11T23:46:26.020" Title="Get a named parameter value from request" Tags="&lt;craft3&gt;&lt;params&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26104" PostTypeId="2" ParentId="26103" CreationDate="2018-05-10T18:13:33.260" Score="3" Body="&lt;p&gt;It is passed as a parameter to your function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionView($post_id){&#xA;    Craft::dd($post_id);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: your parameter &lt;strong&gt;must&lt;/strong&gt; have the &lt;strong&gt;same&lt;/strong&gt; name like defined in your route. You can't access it with &lt;code&gt;public function actionView($postId)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-10T18:13:33.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26105" PostTypeId="2" ParentId="25599" CreationDate="2018-05-10T18:20:52.247" Score="2" Body="&lt;p&gt;Not the &quot;best&quot; solution but if you really want to &quot;disable&quot; it you are free to overwrite the class via Dependency Injection and Service Locators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can overwrite the service with your custom one that extends Crafts service and &quot;remove&quot; the function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$container-&amp;gt;set('craft\services\Assets', [&#xA;    'class' =&amp;gt; 'prefix\namespace\services\MyCustomAwesomeAssetService'&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since this function is only really needed in the &lt;code&gt;AssetLocationValidator&lt;/code&gt; you can as well replace it with your custom validation&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-10T18:20:52.247" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26106" PostTypeId="2" ParentId="26103" CreationDate="2018-05-10T18:23:16.323" Score="3" Body="&lt;p&gt;If you want to explicitly grab them from PHP, this should also work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$result = Craft::$app-&amp;gt;getRequest()-&amp;gt;resolve();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there, you could grab &lt;code&gt;$result[1]&lt;/code&gt;, which should be an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'variables' =&amp;gt; array(&#xA;        'post_id' =&amp;gt; 3,&#xA;    ,&#xA;    'template' =&amp;gt; 'post-entry',&#xA;    'p' =&amp;gt; 'post/3',&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-05-11T23:46:26.020" LastActivityDate="2018-05-11T23:46:26.020" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26107" PostTypeId="1" AcceptedAnswerId="26108" CreationDate="2018-05-10T19:25:07.833" Score="1" ViewCount="952" Body="&lt;p&gt;I am trying to accomplish targeting but wondering if there is a way to combine these two? I took a look around and in the Craft 3 docs but I am a bit turned around on this, really would appreciate some help with it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parts = craft.categories.group('part').slug( urlSlug2 ) %}&#xA;{% set models = craft.categories.group('model').slug( urlSlug3 ) %}&#xA;&#xA;{% set entries1 = craft.entries.section('flightcompany').relatedTo({&#xA;    targetElement: parts, &#xA;    field: 'partsModels.part' &#xA;}).limit(5).all() %}&#xA;&#xA;{% set entries2 = craft.entries.section('flightcompany').relatedTo({&#xA;    targetElement: models, &#xA;    field: 'partsModels.model' &#xA;}).limit(5).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-18T23:26:01.507" Title="Combining Multiple Relation" Tags="&lt;craft3&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26108" PostTypeId="2" ParentId="26107" CreationDate="2018-05-10T19:29:45.697" Score="5" Body="&lt;p&gt;You might have seen &lt;a href=&quot;https://docs.craftcms.com/v2/relations.html#the-relatedto-param&quot; rel=&quot;nofollow noreferrer&quot;&gt;Passing Multiple Relation Criteria&lt;/a&gt;  in the docs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('flightcompany').relatedTo([&#xA;    'and',&#xA;    { targetElement: models, field: 'partsModels.model' },&#xA;    { targetElement: parts, field: 'partsModels.part' }&#xA;]).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can as well take a look at the &lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html#param-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;Db::parseParam&lt;/a&gt; the &lt;code&gt;and|or&lt;/code&gt; syntax is the same for this field&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-18T23:26:01.507" LastActivityDate="2018-05-18T23:26:01.507" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26109" PostTypeId="1" AcceptedAnswerId="26113" CreationDate="2018-05-10T19:58:04.980" Score="0" ViewCount="26" Body="&lt;p&gt;Can you relate an entry to entries in two or more different channel/sections?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-10T21:52:21.863" Title="Can you relate entries from more than 1 section?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26110" PostTypeId="1" CreationDate="2018-05-10T19:59:19.990" Score="2" ViewCount="180" Body="&lt;p&gt;I'm needing to add a dynamically added dropdown input field for my form, as is commonly done with javascript.  How would this be possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, there may be more than 1 dropdown desired by the user, and I need a link or button that would create any additional desired dropdown inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2021-04-25T04:32:42.413" Title="Add Dynamic Elements In Forms" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26111" PostTypeId="2" ParentId="26110" CreationDate="2018-05-10T20:08:24.980" Score="0" Body="&lt;p&gt;You need to create a custom Field Type or you can use &lt;a href=&quot;https://github.com/lewisjenkins/craft-lj-dynamicfields&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamicfields&lt;/a&gt; in order to gain dynamic inputs. Or is it just about hiding/showing specific values in Javascript and not really about Craft at all?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-10T20:08:24.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26113" PostTypeId="2" ParentId="26109" CreationDate="2018-05-10T21:52:21.863" Score="3" Body="&lt;p&gt;Yes, you can. When creating an entires field the Sources option is where you select which sections you'd like to be able to select entries from. See &lt;a href=&quot;https://docs.craftcms.com/v3/entries-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entries Fields in the docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-05-10T21:52:21.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26114" PostTypeId="2" ParentId="26101" CreationDate="2018-05-10T21:59:54.417" Score="1" Body="&lt;p&gt;Craft 2 uses the &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHPMailer&lt;/a&gt; library to send emails and the first thing its &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2776-L2778&quot; rel=&quot;nofollow noreferrer&quot;&gt;addAttachment()&lt;/a&gt; method does is take the first &lt;code&gt;$path&lt;/code&gt; parameter that's passed in and run PHP's &lt;code&gt;is_file()&lt;/code&gt; on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;is_file()&lt;/code&gt; won't work on URLs like you're passing in, it expects the file to be on the local file system, so you'll need to download it locally and pass in that path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It won't show up on the model as an error using &lt;code&gt;$email-&amp;gt;getErrors()&lt;/code&gt; because the library catches the exception, does some internal logging and returns false.  Craft doesn't have a change to add that particular error back on its EmailModel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-10T21:59:54.417" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26116" PostTypeId="2" ParentId="26099" CreationDate="2018-05-11T03:43:35.007" Score="1" Body="&lt;p&gt;Discounts can only be determined if the item is added to the cart. This is what separates a discount from a sale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A discount is actually not matched with the product but the line item as it sits on the order (with all of its context like the order's customer, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can determine if something is on sale with &lt;code&gt;variant.onSale&lt;/code&gt; returning true or false.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-05-11T03:43:35.007" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26117" PostTypeId="1" AcceptedAnswerId="26301" CreationDate="2018-05-11T06:08:12.617" Score="1" ViewCount="631" Body="&lt;p&gt;&lt;strong&gt;Usage Scenario&lt;/strong&gt;&lt;br&gt;&#xA;One organization with branches in several cities. Most of the events in one city are only advertised to that one city, but some of the larger events in any given city will be advertised for the other cities. While the different branches are similar, some have many offerings (categories), and some just a few. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What we used to do&lt;/strong&gt;&lt;br&gt;&#xA;In Craft 2, we had one single URL shared by all the cities, one large set of categories which mapped to the drop-down menus, and entries as events that fall into the categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What we want to do&lt;/strong&gt;&lt;br&gt;&#xA;Individual URLs for the different cities, focusing on the offerings in that city, but a few from other cities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dilemma / Question&lt;/strong&gt;&lt;br&gt;&#xA;Since we don't need multiple versions of the events entries, it seems that we need very little of the multi-site functionality. Just needing to call different templates with different navigation and css, depending on the request URL.&lt;br&gt;&#xA;In&lt;br&gt;&#xA;Settings &gt; Sections &gt; Events --&gt; Site Settings&lt;br&gt;&#xA;is it necessary to &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;switch on all the light switches, and  &lt;/li&gt;&#xA;&lt;li&gt;check &lt;em&gt;Propagate entries across all enabled sites?&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It seems this might triple the size of the database.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-25T16:04:42.003" Title="Craft 3 multisite - best practice to minimize confusion and database size?" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26120" PostTypeId="1" AcceptedAnswerId="26121" CreationDate="2018-05-11T10:12:13.553" Score="1" ViewCount="983" Body="&lt;p&gt;I'm writing a module that needs to grab the path of a file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can use &lt;code&gt;{{ alias('@webroot') }}&lt;/code&gt; in the templates to get the root web folder. Is there a way I can do this in module/plugin land?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been looking for PHP constants or similar, and landed on &lt;code&gt;$fullpath = CRAFT_BASE_PATH . '/web/' . $filename;&lt;/code&gt; which doesn't feel great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4123" LastEditorUserId="4123" LastEditDate="2018-05-18T10:01:58.253" LastActivityDate="2018-05-18T10:01:58.253" Title="How can I use aliases in a module / plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26121" PostTypeId="2" ParentId="26120" CreationDate="2018-05-11T10:20:52.747" Score="6" Body="&lt;p&gt;Would it be an option for you to use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::getAlias('@webroot');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-aliases#resolving-aliases&quot; rel=&quot;noreferrer&quot;&gt;Yii2 Aliases&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-11T10:20:52.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26122" PostTypeId="1" AcceptedAnswerId="26123" CreationDate="2018-05-11T10:48:00.967" Score="2" ViewCount="153" Body="&lt;p&gt;Is it possible to define an aspect ratio / set a max height on an image transform, without using a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say the width is fixed to 600px, but the height can be any value up to 800px?&lt;/p&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="7356" LastEditDate="2018-05-11T10:59:31.517" LastActivityDate="2018-05-11T11:06:51.327" Title="Set max-height on image transforms?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26123" PostTypeId="2" ParentId="26122" CreationDate="2018-05-11T11:06:51.327" Score="3" Body="&lt;p&gt;You can pass an array instead of the image-transform handle to the &lt;code&gt;getUrl()&lt;/code&gt; function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transform = {&#xA;    'width' =&amp;gt; 600,&#xA;    'height' =&amp;gt; (asset.getWidth() &amp;lt;= 800)? asset.getWidth() : 800&#xA;} %}&#xA;{{ asset.getUrl(transform) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-11T11:06:51.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26124" PostTypeId="2" ParentId="21881" CreationDate="2018-05-11T12:03:23.393" Score="3" Body="&lt;p&gt;Here is a working example using mPDF 6.1.  Thanks to Mats Mikkel Rummelhoff for pointing me in the right direction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the event you need is amForms_submissions.onBeforeEmailConfirmSubmission. This event contains the confirmation email, so you can add your attachment straight to it. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;    require_once __DIR__ . '/vendor/autoload.php';&#xA;    //If you want to attach to the submission email, use: onBeforeEmailSubmission&#xA;    craft()-&amp;gt;on('amForms_submissions.onBeforeEmailConfirmSubmission', function (Event $event) {&#xA;&#xA;        //Grab the params out of the event. From this you can get the submission and the associated form.&#xA;        $params = $event-&amp;gt;params;&#xA;        $submission = $params['submission'];&#xA;        $form = $submission-&amp;gt;getForm();&#xA;&#xA;        //This bit is pretty much straight out of the getSubmissionEmailBody method in the AMForms_SubmissionsServerice&#xA;        $variables = array(&#xA;                'tabs' =&amp;gt; $form-&amp;gt;getFieldLayout()-&amp;gt;getTabs(),&#xA;                'form' =&amp;gt; $form,&#xA;                'submission' =&amp;gt; $submission&#xA;            );&#xA;        //Get HTML using template. The default amforms email template is a good starting point and can be found in: craft/plugins/amforms/templates/_display/templates/email.twig&#xA;        $html = craft()-&amp;gt;templates-&amp;gt;render('_amforms/attachment', $variables);&#xA;&#xA;        //Create the mPDF object.&#xA;        $mpdf = new \mPDF();&#xA;        //Feed in the HTML.&#xA;        $mpdf-&amp;gt;WriteHTML($html);&#xA;        //Output the PDF as a string.&#xA;        $data = $mpdf-&amp;gt;Output('', 'S');&#xA;        //Grab the EmailModel from the event params.&#xA;        $email = $params['email'];&#xA;        //Add the PDF string as an attachment and specify a file name.&#xA;        $email-&amp;gt;addStringAttachment($data,'Email Attachemnt.pdf');&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8370" LastActivityDate="2018-05-11T12:03:23.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26125" PostTypeId="1" AcceptedAnswerId="26126" CreationDate="2018-05-11T21:22:11.147" Score="2" ViewCount="158" Body="&lt;p&gt;I am not sure why, but I cannot seem to get the short name/handle/slug of a matrix field that is a category field.  I need to get it's slug.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.matrixField %}&#xA;&#xA; {{ row.matrixChild.slug }}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="6619" LastEditDate="2018-05-11T21:29:35.307" LastActivityDate="2018-05-11T22:33:09.337" Title="Matrix Field Slug Output" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;slug&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26126" PostTypeId="2" ParentId="26125" CreationDate="2018-05-11T21:38:08.207" Score="2" Body="&lt;p&gt;That is returning an &lt;code&gt;ElementQuery&lt;/code&gt;. I'm assuming you only need to get the first category. You need to use &lt;code&gt;.one&lt;/code&gt; to get the category element.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.matrixField.all() %}&#xA;    {{ row.matrixChild.one.slug }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wish to display more than one category you can use a &lt;code&gt;{% nav %}&lt;/code&gt; or &lt;code&gt;{% for %}&lt;/code&gt; to loop through them. See the &lt;a href=&quot;https://docs.craftcms.com/v3/categories-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;category docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-05-11T22:33:09.337" LastActivityDate="2018-05-11T22:33:09.337" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26127" PostTypeId="1" CreationDate="2018-05-12T07:43:36.357" Score="2" ViewCount="533" Body="&lt;p&gt;Trying to search through a Matrix field, currently I am using conditionals to accomplish this, but if it's faster would like to limit the results to only what I need.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.matrixField.search(matrixChild1:&quot;mykeyword&quot;) %}&#xA;&#xA;{% set getResults = row.matrixChild1.one.slug %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could not find much on this, I know a search() parametered can be used in Matrix but after all my trying still nothing.  Hopefully it's possible?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-12T09:59:11.800" Title="Search Through Matrix Field" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26128" PostTypeId="2" ParentId="26127" CreationDate="2018-05-12T09:59:11.800" Score="1" Body="&lt;p&gt;Please take a look at the &lt;a href=&quot;https://docs.craftcms.com/v2/searching.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; there are so many examples how to search here at stack exchange and it's well explained in the docs. I posted the same answer multiple times within the last days &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.matrixField.search(&quot;mykeyword&quot;).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I already said a few times too &quot;looping through queries is still deprecated&quot;. Please fetch your results with &lt;code&gt;.all()&lt;/code&gt; or &lt;code&gt;.one()&lt;/code&gt;. There is no reason to fill your logs with deprecated warnings - you won't have any benefits &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-12T09:59:11.800" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26129" PostTypeId="1" CreationDate="2018-05-12T13:33:20.267" Score="1" ViewCount="49" Body="&lt;p&gt;Can I use official logo and images on my foreign site about Craft CMS? Are there any promo materials in good quality?&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2018-05-14T23:10:45.313" LastActivityDate="2018-05-14T23:10:45.313" Title="Use official logo and images on my site" Tags="&lt;promotions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26130" PostTypeId="2" ParentId="26129" CreationDate="2018-05-12T13:59:27.357" Score="1" Body="&lt;p&gt;Yes, I believe this is perfectly acceptable. As long as you are not pretending to &lt;em&gt;be&lt;/em&gt; Craft CMS or Pixel &amp;amp; Tonic, then you shouldn’t run into any legal issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They even made their brand assets available for use...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://craftcms.com/brand-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/brand-assets&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you still have questions, send an email to support@craftcms.com. &lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-05-12T13:59:27.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26131" PostTypeId="1" AcceptedAnswerId="26132" CreationDate="2018-05-12T19:53:40.247" Score="1" ViewCount="333" Body="&lt;p&gt;I have a custom asset bundle defined in my plugin. My plugin has a controller. The controller has a action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Handle a request going to our plugin's index action URL,&#xA; * e.g.: actions/entries-by-group/entries-by-group&#xA; *&#xA; * @return mixed&#xA; * @throws \yii\base\InvalidConfigException&#xA; */&#xA;public function actionIndex()&#xA;{&#xA;    $this-&amp;gt;view-&amp;gt;registerAssetBundle(EntriesByGroupAssets::class);&#xA;    $result = 'Welcome to the EntriesByGroupController actionIndex() method';&#xA;&#xA;    return $result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, I am trying to register my asset bundle. I am getting the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ReflectionException&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Class recoveryfinder\entriesbygroup\assets\EntriesByGroupAssets does&#xA;  not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My namespaces are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace recoveryfinder\entriesbygroup\controller;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in the asset bundle file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace recoveryfinder\entriesbygroup\assets;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My plugin is in a folder called (note the hyphens):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;vendor\recoveryfinder\entries-by-group\src\controllers\EntriesByGroupController.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It seems that when code gets to ClassLoader::LoadClass I get the error referenced above - class does not exist. It looks to me like ClassLoader is using the namespace as the path spec (without the hyphens) rather than the actual location (with the hyphens).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must need to set paths in my plugin? If not what is wrong here?&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-05-12T20:31:02.260" Title="Trouble finding my custom asset bundle" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26132" PostTypeId="2" ParentId="26131" CreationDate="2018-05-12T20:03:52.107" Score="2" Body="&lt;p&gt;The autoloader won't load files in the folder &lt;code&gt;assets&lt;/code&gt; as already stated it is all explained &lt;a href=&quot;https://docs.craftcms.com/v3/asset-bundles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Your asset bundles should be in a folder called &lt;code&gt;resources&lt;/code&gt; otherwise Yii won't register them in its classmap automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your namespaces must represent your folder structure. The namespace &lt;code&gt;ns\prefix\controller&lt;/code&gt; must be for a file in &lt;code&gt;vendor\ns\prefix\src\controller&lt;/code&gt; so your namespace &lt;code&gt;ns\prefix\assets&lt;/code&gt; will search for a file in &lt;code&gt;...vendor\ns\prefix\src\assets&lt;/code&gt; but you have to include the resource on your own via &lt;a href=&quot;http://php.net/manual/de/function.require-once.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;require_once&lt;/a&gt; since Yii won't so it because you are in the wrong folder &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest solution would be to create a folder &lt;code&gt;resources&lt;/code&gt; and use the namespace &lt;code&gt;ns\prefix\src\resources&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can - like stated in the docs - use your plugin root path as well &lt;code&gt;recoveryfinder\entriesbygroup&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-12T20:31:02.260" LastActivityDate="2018-05-12T20:31:02.260" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26133" PostTypeId="2" ParentId="26098" CreationDate="2018-05-13T00:06:19.753" Score="6" Body="&lt;p&gt;Although I'm not in favor of the nuclear option in international politics, it works very fine and simply this case. Brad's suggestion of deleting the &lt;code&gt;craft/vendor&lt;/code&gt; folder and &lt;code&gt;composer.lock&lt;/code&gt; and then running&lt;br&gt;&#xA;&lt;code&gt;composer update&lt;/code&gt;&lt;br&gt;&#xA;solved the problem immediately. Now I appreciate composer.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-05-13T00:06:19.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26134" PostTypeId="2" ParentId="13957" CreationDate="2018-05-13T08:53:00.527" Score="1" Body="&lt;p&gt;The easiest way to do this is to create an array of tag ids for tags that should be active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would use a comma to separate multiple tags in your query string since the browser interprets a plus sign as a space. For example, if your tags were &quot;New Videos&quot; and &quot;Maths&quot; the url would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;domain.com/learning/resources?tags=New+Videos,Maths&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, get the &quot;tags&quot; query parameter and make an array splitting each tag at a comma:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tagsQuery = craft.app.request.getParam('tags')|split(',') %}&#xA;&#xA;{# tagsQuery = [&quot;New Videos&quot;,&quot;Maths&quot;] #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Search your tag group for matching titles and return an array of ids. This assumes you have a tag group with the handle &quot;tags&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set activeTags = tagsQuery ? craft.tags.group('tags').title(tagsQuery).ids() : null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it's a simple matter of testing if the tag.id is in the activeTags array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in craft.tags.relatedTo(resourceTags) %}&#xA;  {{ tag.title }}&#xA;&#xA;  {# Use a conditional #}&#xA;  {% if item.id in activeTags %}active{% endif %}&#xA;&#xA;  {# or an output tag with a conditional #}&#xA;  {{ item.id in activeTags ? 'active' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-05-13T08:53:00.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26135" PostTypeId="1" CreationDate="2018-05-13T10:48:12.700" Score="1" ViewCount="103" Body="&lt;p&gt;Is it possible to reduce and increase prices on all products at one time by a specified amount or percentage without having to manually do every product. That must be visible to the customer and not just run as a promotion as this doesn't appear to display the cheaper price on the product tile.&lt;/p&gt;&#xA;" OwnerUserId="8248" LastEditorUserId="57" LastEditDate="2018-05-24T22:51:19.910" LastActivityDate="2018-05-24T23:07:25.750" Title="Is there a way to change prices" Tags="&lt;plugin-craftcommerce&gt;&lt;pricing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26136" PostTypeId="1" CreationDate="2018-05-13T15:06:21.290" Score="2" ViewCount="2134" Body="&lt;p&gt;I am running Craft CMS 3 and Commerce 2 on a virtual machine composed of Centos 7, Apache 2.4, PHP 7.2 and MySQL 5.7.22. It seems almost impossible working with the control panel with such huge response times:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms/admin/dashboard&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms/admin/dashboard&lt;/a&gt; takes 2.6s to load. (500ms on localhost MAMP)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://craftcms/admin/settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms/admin/settings&lt;/a&gt; takes 3s to load (350ms on localhost MAMP).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've tried the following stuff:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;assigned php &lt;code&gt;memory_limit&lt;/code&gt; to 512M in &lt;code&gt;php.ini&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;connecting to MySQL using &lt;code&gt;127.0.0.1&lt;/code&gt; instead of &lt;code&gt;localhost&lt;/code&gt; (&lt;code&gt;.env&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;set &lt;code&gt;HostnameLookup Off&lt;/code&gt; in apache &lt;code&gt;httpd.conf&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;set &lt;code&gt;ServerName 10.10.0.20&lt;/code&gt; in apache &lt;code&gt;httpd.conf&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;accessing the page via &lt;code&gt;10.10.0.20&lt;/code&gt; instead of virtual host &lt;code&gt;craftcms&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;removed usage of &lt;code&gt;.htaccess&lt;/code&gt; file following this &lt;a href=&quot;https://nystudio107.com/blog/stop-using-htaccess-files-no-really&quot; rel=&quot;nofollow noreferrer&quot;&gt;guide&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;unloaded unnecessary apache modules&lt;/li&gt;&#xA;&lt;li&gt;disabling cgi apache module&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Looking at the network statistic the TTFB takes 4.28s and whole page loads in 5.01s. I am assuming it's the configuration issue since when running MAMP on windows everything responds a lot quicker. Any ideas what I should be looking at or is this performance as intended?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What strikes me the most is that phpmyadmin responds very quickly. I tried running a standalone (non-Craft) page with and without PHP. Page with PHP loaded cca 20ms longer. I would assume PHP doesn't cause mentioned problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;craftcms.conf:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;    DocumentRoot &quot;/opt/webroot/craftcms/web/&quot;&#xA;    ServerName craftcms&#xA;    ErrorLog &quot;/var/log/httpd/craftcms-error_log&quot;&#xA;    CustomLog &quot;/var/log/httpd/craftcms-access_log&quot; combined&#xA;&#xA;    &amp;lt;Directory &quot;/opt/webroot/craftcms/web/&quot;&amp;gt;&#xA;        Options FollowSymLinks&#xA;        AllowOverride None &#xA;&#xA;        ## Removes index.php from Craft URLs ##&#xA;        &amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;            RewriteEngine On&#xA;            # Send would-be 404 requests to Craft&#xA;            RewriteCond %{REQUEST_FILENAME} !-f&#xA;            RewriteCond %{REQUEST_FILENAME} !-d&#xA;            RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;            RewriteRule ^(.+) /index.php?p=$1 [QSA,L]&#xA;        &amp;lt;/IfModule&amp;gt;&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Update: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After disabling unnecessary apache modules responses are a lot faster. I also tried using worker and even MPM, changes in timings were neglectable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft3 debug toolbar shows the following critical timings when loading settings page:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;11:43:00.140  1098.4 ms   craft\web\twig\Template::display    settings&lt;/li&gt;&#xA;&lt;li&gt;11:43:00.154  1083.8 ms   craft\web\twig\Template::display    →_layouts/cp&lt;/li&gt;&#xA;&lt;li&gt;11:43:00.374  863.6 ms    craft\web\twig\Template::display    →→_layouts/basecp&lt;/li&gt;&#xA;&lt;li&gt;11:43:00.375  862.4 ms    craft\web\twig\Template::display    →→→_layouts/base&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is output of same data on localhost:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;11:52:46.713  124.0 ms    craft\web\twig\Template::display    settings&lt;/li&gt;&#xA;&lt;li&gt;11:52:46.716  121.4 ms    craft\web\twig\Template::display    →_layouts/cp&lt;/li&gt;&#xA;&lt;li&gt;11:52:46.743  94.4 ms craft\web\twig\Template::display    →→_layouts/basecp&lt;/li&gt;&#xA;&lt;li&gt;11:52:46.743  93.9 ms craft\web\twig\Template::display    →→→_layouts/base&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The difference in timings is quite big.&lt;/p&gt;&#xA;" OwnerUserId="8326" LastEditorUserId="57" LastEditDate="2020-04-17T03:46:50.347" LastActivityDate="2021-02-19T14:35:06.933" Title="Slow performance/Long response times" Tags="&lt;performance&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26137" PostTypeId="2" ParentId="26136" CreationDate="2018-05-13T18:30:22.250" Score="2" Body="&lt;p&gt;So something is definitely wrong; you should be seeing response times of around &lt;code&gt;300-500ms&lt;/code&gt; or so. What I'd suggest doing is profiling things on the Craft side as per the &lt;a href=&quot;https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Profiling your Website with Craft CMS 3’s Debug Toolbar&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll at least be able to see exactly what the bottlenecks are from a Craft perspective, and then see how much overhead is being added by the webserver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you find that it's slow on the Craft end of things, you may consider making sure that you are properly utilizing the &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;cache tag&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-05-13T18:30:22.250" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26138" PostTypeId="1" CreationDate="2018-05-13T18:52:22.513" Score="1" ViewCount="382" Body="&lt;p&gt;I have currently the problem, that I can't use the same asset in different entries as featured image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro Version: 3.0.9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My setup is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Volumes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Local, Base URL: &lt;code&gt;@web/uploads&lt;/code&gt;, Type: Local, File Path: &lt;code&gt;@webroot/uploads&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Created Fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Featured Image, Type: Asset, Limit: 1, Volume: Local&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Created Section:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Articles, Type Channel, Added &lt;code&gt;Featured Image&lt;/code&gt; to the post type&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now I have uploaded some dummy images. (e.g. Image 1, Image 2, Image 3)&#xA;After this I have created some article entries.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Article 1 - Image 1&lt;/li&gt;&#xA;&lt;li&gt;Article 2 - Image 2&lt;/li&gt;&#xA;&lt;li&gt;Article 3 - Image 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Backend Preview:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LuV51.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LuV51.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frontend Preview:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aIu1K.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aIu1K.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I change the &lt;code&gt;Article 1 - Featured Image&lt;/code&gt; from &lt;code&gt;Image 1&lt;/code&gt; to &lt;code&gt;Image 2&lt;/code&gt; it looks good in the backend but not in the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Backend Preview:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/u4lXu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u4lXu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frontend Preview:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/E8O5G.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E8O5G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frontend snippet to show the entries is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set latestArticles = craft.entries({section: 'articles', limit: 6}).orderBy('id desc').all() %}&#xA;&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row card-columns&quot;&amp;gt;&#xA;&#xA;    {% for entry in latestArticles %}&#xA;&#xA;        {% set asset = entry.featuredImage.one() %}&#xA;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card mb-4 box-shadow&quot;&amp;gt;&#xA;                &amp;lt;img class=&quot;card-img-top&quot; src=&quot;{{ asset.getUrl('thumb') }}&quot;  alt=&quot;{{ entry.title }}&quot; style=&quot;height: 225px; width: 100%; display: block;&quot; data-holder-rendered=&quot;true&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                    &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h5&amp;gt;&#xA;                    &amp;lt;p class=&quot;card-text&quot;&amp;gt;&#xA;                        {{ entry.teaser|length &amp;gt; 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}&#xA;                    &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;div class=&quot;d-flex justify-content-between align-items-center&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;btn-group&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn btn-sm btn-outline-secondary&quot;&amp;gt;Read more...&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;small class=&quot;text-muted&quot;&amp;gt;9 mins&amp;lt;/small&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The question is now the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it an user handling?! :D&lt;/li&gt;&#xA;&lt;li&gt;Is it not possible to assign one image to multiple entries?&lt;/li&gt;&#xA;&lt;li&gt;Is there any workaround? (please don't tell me, to upload the image again ;) ) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="57" LastEditDate="2018-05-14T23:13:17.483" LastActivityDate="2018-05-14T23:13:17.483" Title="How to use an asset as featured image in different entries" Tags="&lt;entries&gt;&lt;assets&gt;&lt;craft3&gt;&lt;assets-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26140" PostTypeId="2" ParentId="26138" CreationDate="2018-05-13T19:33:08.463" Score="1" Body="&lt;p&gt;You can assign an image to as many entries as you like; what's happening is for some reason, Craft appears to be unable to generate the appropriate image transform. It's very likely some kind of local dev environment setup issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For whatever reason, it's unable to access the AssetsController to generate the transformed image on the frontend, as seen in that &lt;code&gt;404&lt;/code&gt; url.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-05-13T19:33:08.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26141" PostTypeId="2" ParentId="26138" CreationDate="2018-05-13T20:53:16.247" Score="1" Body="&lt;p&gt;With the new hints from Andrew (thanks!), I found a good workaround for me based on this answer: &lt;a href=&quot;https://craftcms.stackexchange.com/a/21205/8348&quot;&gt;https://craftcms.stackexchange.com/a/21205/8348&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installing the following plugin:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The updated Frontend Snippet is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in latestArticles %}&#xA;&#xA;        {% set asset = entry.featuredImage.one() %}&#xA;&#xA;        {% set transformedImage = craft.imager.transformImage(asset.url, {height: 225}) %}&#xA;&#xA;        &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card mb-4 box-shadow&quot;&amp;gt;&#xA;                &amp;lt;img class=&quot;card-img-top&quot; src=&quot;{{ transformedImage.getUrl() }}&quot;  alt=&quot;{{ entry.title }}&quot; style=&quot;height: 225px; width: 100%; display: block;&quot; data-holder-rendered=&quot;true&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                    &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h5&amp;gt;&#xA;                    &amp;lt;p class=&quot;card-text&quot;&amp;gt;&#xA;                        {{ entry.teaser|length &amp;gt; 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}&#xA;                    &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;div class=&quot;d-flex justify-content-between align-items-center&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;btn-group&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;btn btn-sm btn-outline-secondary&quot;&amp;gt;Read more...&amp;lt;/a&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;small class=&quot;text-muted&quot;&amp;gt;9 mins&amp;lt;/small&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2018-05-13T20:53:16.247" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26143" PostTypeId="1" CreationDate="2018-05-14T13:59:00.407" Score="1" ViewCount="261" Body="&lt;p&gt;I have a rich text (redactor field) that I'm using striptags on to remove the html markup from the front end. However I noticed for links it whips out the link and the text in between. Is this something I can fix with a regular expression? Can you even do that with a twig filter? If so does anyone have an example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set articleText = myFirstMatrixBlockWithType.blogArticleText %}&#xA;{% if articleText | length &amp;gt; 200 %}&#xA;    {% set articleTextTrim = articleText | slice(0, 200) ~ '...' %}&#xA;    {{ articleTextTrim | striptags }}&#xA;{% else %}&#xA;    {{ articleText | striptags }} &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="5557" LastEditDate="2018-05-14T14:06:31.277" LastActivityDate="2018-05-14T15:02:34.597" Title="striptags but leave link test in between" Tags="&lt;templating&gt;&lt;richtext&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26144" PostTypeId="1" CreationDate="2018-05-14T14:58:58.547" Score="1" ViewCount="158" Body="&lt;p&gt;Receiving the standard error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft\MatrixBlockModel and its behaviors do not have a method or&#xA;  closure named &quot;sectionArticles&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The problem is that this error doesn't make sense. Here is why:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have a newsletter template with the block 'sectionArticles'&lt;/li&gt;&#xA;&lt;li&gt;It lists entries from 3 different sections&lt;/li&gt;&#xA;&lt;li&gt;These 3 sections do not have a block 'sectionArticles' nor a reference to it in their templates.&lt;/li&gt;&#xA;&lt;li&gt;If I click on a link that leads to the url for these entries, I receive the above error&lt;/li&gt;&#xA;&lt;li&gt;If I copy and paste the url into a new tab everything is fine&lt;/li&gt;&#xA;&lt;li&gt;This only recently started happening. In other words, old issues of the newsletter are fine&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is code for referring template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.connectionsContent %}&#xA;  {% switch block.type %}&#xA;    {% case &quot;connectionsTextOnly&quot; %}&#xA;      &amp;lt;div class=&quot;{{ block.backgroundColor }} page-section&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;          {% set asset = block.sectionImage.first() %}&#xA;          {% if asset %}&#xA;            &amp;lt;div class=&quot;large-3 medium-4 small-12 columns large-push-9 medium-push-8&quot;&amp;gt;&#xA;              &amp;lt;img src=&quot;{{ asset.url }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;large-9 medium-8 small-12 columns large-pull-3 medium-pull-4&quot;&amp;gt;&#xA;          {% else %}&#xA;            &amp;lt;div class=&quot;small-12 columns&quot;&amp;gt;&#xA;          {% endif %}&#xA;              {{ block.sectionText }}&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% default %}&#xA;      {% set entries = block.sectionArticles %}&#xA;      {% if entries | length %}&#xA;        &amp;lt;div class=&quot;{{ block.backgroundColor }} page-section article-grid&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;row large-up-4 medium-up-2&quot; data-equalizer data-equalize-on=&quot;medium&quot;&amp;gt;&#xA;            {% for entry in entries %}&#xA;              {% if entry.section.handle == &quot;news&quot; %}&#xA;                {% include 'news/_includes/feed' %}&#xA;              {% elseif entry.section.handle == &quot;pages&quot; %}&#xA;                {% include 'pages/_includes/feed' %}&#xA;              {% elseif entry.section.handle == &quot;events&quot; %}&#xA;                {% include 'events/_includes/feed' %}&#xA;              {% endif %}&#xA;            {% endfor %}&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      {% endif %}&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The feed templates are just links and display fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The errors occurs on the events/_entry, news/_entry and pages/_entry templates. There is no references of the block 'sectionArticles' in those templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing: the error only happens on scheduled entries, where the Post Date is in the future, after the Post Date has arrived.&lt;/p&gt;&#xA;" OwnerUserId="6830" LastEditorUserId="6830" LastEditDate="2018-05-15T20:58:32.533" LastActivityDate="2018-07-16T01:42:36.450" Title="Internal Server Error: missing method or closure" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;error-message&gt;&lt;error&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26145" PostTypeId="2" ParentId="26143" CreationDate="2018-05-14T15:02:34.597" Score="1" Body="&lt;p&gt;Actually, excluding certain tags from being removed is built into the &lt;code&gt;striptags&lt;/code&gt; &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/striptags.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ articleTextTrim | striptags('&amp;lt;a&amp;gt;') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-05-14T15:02:34.597" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26146" PostTypeId="2" ParentId="25957" CreationDate="2018-05-14T18:45:48.770" Score="0" Body="&lt;p&gt;When I had this problem previously, it was the permissions for the index.php that wasn't set to 644. Hope that works for you&lt;/p&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2018-05-14T18:45:48.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26147" PostTypeId="1" CreationDate="2018-05-14T19:23:13.350" Score="1" ViewCount="2375" Body="&lt;p&gt;I'm very new to craft and I'm having trouble finding an answer to my question (I've scoured the questions on here - but the only answers appear to be for plugins).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to submit a form to an action in a controller - which will be inside a Module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this form in a template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;site/say&quot;&amp;gt;&#xA;    &amp;lt;input class=&quot;btn submit&quot; type=&quot;submit&quot; value=&quot;submit me&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to get it to go to this controller (which is in modules/controllers/SiteController):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace app\controllers;&#xA;&#xA;use yii\web\Controller;&#xA;&#xA;class SiteController extends Controller&#xA;{&#xA;    // ...existing code...&#xA;&#xA;    public function actionSay($message = 'Hello')&#xA;    {&#xA;        die('in say action');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm constantly getting a 404 - I've tried different variations for the value of action, e.g. actions/site/say.&#xA;Do I need to add a route somewhere like in Laravel? &#xA;Really, really stuck on this, any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8380" LastActivityDate="2018-05-14T20:10:12.400" Title="How to call Controller in Module?" Tags="&lt;form&gt;&lt;controller&gt;&lt;elementaction&gt;&lt;classes&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26148" PostTypeId="1" AcceptedAnswerId="26149" CreationDate="2018-05-14T19:48:31.393" Score="1" ViewCount="242" Body="&lt;p&gt;I would like to use another plugin from my own plugin. What is the best way to do this. Right now I am doing something like this, but there should be a better way than to explicitly call the service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getModule('mobile-detect')-&amp;gt;mobileDetectService&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am really looking for is the service container where I do not have to know anything just the plugin what should have been loaded...?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-05-14T23:22:31.720" LastActivityDate="2018-05-14T23:22:31.720" Title="Use a plugin from another plugin in Craft 3" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26149" PostTypeId="2" ParentId="26148" CreationDate="2018-05-14T19:56:06.610" Score="3" Body="&lt;p&gt;You can call the main plugin class directly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MobileDetect::$plugin-&amp;gt;mobileDetectService&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know this plugin, maybe the class is wrong but that's the syntax you can use &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-14T19:56:06.610" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26150" PostTypeId="2" ParentId="26147" CreationDate="2018-05-14T19:59:08.163" Score="3" Body="&lt;p&gt;You need to include your module handle to the route&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;module-handle/site/say&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also should use the correct namespace instead of &lt;code&gt;app/controllers&lt;/code&gt; I suggest you to read the documentation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can as well define a &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#routing-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;route&lt;/a&gt; if you like&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-14T20:10:12.400" LastActivityDate="2018-05-14T20:10:12.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26151" PostTypeId="1" AcceptedAnswerId="26247" CreationDate="2018-05-14T20:03:43.327" Score="1" ViewCount="175" Body="&lt;p&gt;Craft Pro 3.0.7&lt;br/&gt;Notifications Plugin 1.0.6&lt;br/&gt;PHP 7.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In trying to send notifications for new entries that have a checkbox field, we get this error in the logs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2018-05-14 09:19:32&#xA;  [192.168.10.1][1][-][error][UnexpectedValueException]&#xA;  UnexpectedValueException: Error at offset 0 of 2 bytes in&#xA;  /home/path/to/vendor/yiisoft/yii2-queue/src/serializers/PhpSerializer.php:32&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This manifests as the notification getting stuck in queue, never releasing, always showing progress bar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing only the checkbox field from this section, the notifications work as expected without any errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I read, serialization errors may result from encoding problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else can I try to resolve this? Where else can I look?&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2018-05-21T16:08:44.080" Title="What Might Be Causing This Serialization Error?" Tags="&lt;php&gt;&lt;serialization&gt;&lt;queue&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26152" PostTypeId="1" AcceptedAnswerId="26153" CreationDate="2018-05-14T21:32:49.830" Score="1" ViewCount="919" Body="&lt;p&gt;Is it possible to query elements of type &lt;code&gt;MatrixBlock&lt;/code&gt; in Twig like other elements? You can get entries with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.all() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something similar available for Matrix blocks? &lt;/p&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="5557" LastEditDate="2018-05-14T23:09:17.077" LastActivityDate="2018-05-14T23:26:26.217" Title="Craft query Matrix blocks in twig" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26153" PostTypeId="2" ParentId="26152" CreationDate="2018-05-14T23:05:35.997" Score="2" Body="&lt;p&gt;Yes you can. &lt;code&gt;craft.entries&lt;/code&gt; returns an object of type &lt;code&gt;EntryQuery&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a function &lt;code&gt;matrixBlocks&lt;/code&gt; in the &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/web/twig/variables/CraftVariable.php#L288&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftVariable&lt;/a&gt; that returns an object of type &lt;code&gt;MatrixBlockQuery&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of them have nearly the same functionality  since they extend the &lt;code&gt;ElementQuery&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allMatrixBlocks = craft.matrixBlocks.all() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-14T23:26:26.217" LastActivityDate="2018-05-14T23:26:26.217" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26154" PostTypeId="1" CreationDate="2018-05-15T06:35:00.560" Score="1" ViewCount="276" Body="&lt;p&gt;My question is this, &lt;strong&gt;I want to join a matrix table to a query and look for certain values in it&lt;/strong&gt;.  I am using this example below.  I have 2 matrix fields partsModels.model and partsModels.parts. I need to make sure that all the criteria is met before looping through any of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.andWhere(['like', 'content.fields_myFieldHandle', 'foo']).all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that Robin supplied &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26152/craft-query-matrix-blocks-in-twig/26153?noredirect=1#comment34376_26153&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="6619" LastEditDate="2018-05-16T06:34:57.043" LastActivityDate="2018-05-16T06:34:57.043" Title="Join Matrix Fields To Query Using andWhere" Tags="&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26155" PostTypeId="1" CreationDate="2018-05-15T06:40:04.150" Score="1" ViewCount="574" Body="&lt;p&gt;As default Craft has only &lt;code&gt;First Name&lt;/code&gt; and &lt;code&gt;Last Name&lt;/code&gt; as required. Is it possible to set more as this two fields as required fields? And is it also possible to set custom Fields as required too?&lt;/p&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="7347" LastEditDate="2018-05-17T20:26:28.123" LastActivityDate="2018-05-17T20:26:28.123" Title="Craft Commerce — Billing / Shipping Address validation / required Fields" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26156" PostTypeId="2" ParentId="26155" CreationDate="2018-05-15T06:42:17.947" Score="3" Body="&lt;p&gt;It will be possible in the next release (commerce 2-beta.5):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/commerce/issues/342&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/342&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-05-15T06:42:17.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26157" PostTypeId="2" ParentId="26155" CreationDate="2018-05-15T06:50:39.540" Score="3" Body="&lt;p&gt;Address validation is, in Commerce v1 at least, generally handled via a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'll assume you already have a business logic plugin on the go, but if not head over to &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt; and use that to generate your plugin skeleton).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you basically need to add a listener to &lt;code&gt;onBeforeSaveAddress&lt;/code&gt; and do your validation in that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your plugins &lt;code&gt;init&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft()-&amp;gt;on('commerce_addresses.onBeforeSaveAddress',&#xA;        [&#xA;            craft()-&amp;gt;businessLogic_logic,&#xA;            'onBeforeSaveAddressHandler'&#xA;        ]&#xA;    ); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then the actual handler in my case this is in my &lt;code&gt;BusinessLogic_LogicService&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function onBeforeSaveAddressHandler($event){&#xA;&#xA;    $address = $event-&amp;gt;params['address'];&#xA;&#xA;    if(!$address-&amp;gt;firstName){&#xA;        $address-&amp;gt;addError('firstName','First name must not be empty');&#xA;        $event-&amp;gt;performAction = false;&#xA;    }&#xA;    ...etc, anything else you want really&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...that's the essence of it really.  You can do any validation you like, and just add errors as you need them and set &lt;code&gt;$event-&amp;gt;performAction = false;&lt;/code&gt; to stop the dodgy address being saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....and looks like Luke is creating something easier for V2, but this is at least effective and works for now!&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-05-15T06:50:39.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26159" PostTypeId="1" CreationDate="2018-05-15T10:32:38.717" Score="2" ViewCount="83" Body="&lt;p&gt;Is it possible to have both the standard price and sale price visible on the items tiles on a website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have both prices visible and wanted to know if this was doable .&lt;/p&gt;&#xA;" OwnerUserId="8248" LastEditorUserId="57" LastEditDate="2018-05-24T22:51:40.290" LastActivityDate="2018-05-24T23:05:14.067" Title="Sales prices on items" Tags="&lt;plugin-craftcommerce&gt;&lt;pricing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26160" PostTypeId="1" AcceptedAnswerId="26176" CreationDate="2018-05-15T10:37:15.837" Score="1" ViewCount="100" Body="&lt;p&gt;I'm checking &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Element API&quot;&gt;Element API&lt;/a&gt;'s performance to decide if it's a good idea to replace my own custom API with &lt;strong&gt;Element API&lt;/strong&gt;. Right now, when fetching the related items (Via fields or matrix elements), my API creates a unique joined query with all the right criteria and executes it at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Element API is able to use all the nice methods from Craft, maybe the question is related to Craft structure itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using MySQL´s &lt;strong&gt;SHOW STATUS LIKE 'Com_Select'&lt;/strong&gt; but it was not really useful.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-05-15T23:51:29.597" Title="Does Craft do joined calls or multiple ones when fetching the related items? [Element API]" Tags="&lt;plugin-elementapi&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26161" PostTypeId="1" AcceptedAnswerId="26164" CreationDate="2018-05-15T12:49:44.497" Score="1" ViewCount="300" Body="&lt;p&gt;My goal is to order an element query of Matrix blocks by a custom field. Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\mymodule\services;&#xA;&#xA;use Craft;&#xA;use yii\base\Component;&#xA;use craft\elements\MatrixBlock;&#xA;&#xA;class MyService extends Component&#xA;{&#xA;    public function myFunction()&#xA;    {&#xA;        $blocks = MatrixBlock::find()&#xA;            -&amp;gt;type('myBlockType')&#xA;            -&amp;gt;orderBy(???)&#xA;            -&amp;gt;all();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit to show working Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is showing how I used this to sort by a custom date field)&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$blocks = MatrixBlock::find()&#xA;    -&amp;gt;type('blockType')&#xA;    -&amp;gt;fieldId($fieldId)&#xA;    -&amp;gt;where(['&amp;gt;', 'content.field_blockType_fieldHandle', new \yii\db\Expression('NOW()')])&#xA;    -&amp;gt;orderBy(['content.field_blockType_fieldHandle' =&amp;gt; SORT_ASC])&#xA;    -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2018-05-18T14:52:59.647" LastActivityDate="2018-05-18T14:52:59.647" Title="Craft 3: When querying for Matrix blocks in a plugin, how do you sort by a custom field?" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26162" PostTypeId="2" ParentId="25957" CreationDate="2018-05-15T13:04:42.313" Score="1" Body="&lt;p&gt;When I had this problem previously, it was the permissions for the index.php that wasn't set to 644. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another issue I had once was my database password had some characters that wasn't accepted. Instead of getting errors, I just got a blank page saying Internal Server Error. Once I changed the password to omit weird characters, it worked perfectly. Wasted a ton of hours trying to figure that out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2018-05-15T13:04:42.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26164" PostTypeId="2" ParentId="26161" CreationDate="2018-05-15T15:04:22.453" Score="3" Body="&lt;pre&gt;&lt;code&gt;-&amp;gt;orderBy('fieldHandle')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;orderBy(['fieldHandle' =&amp;gt; SORT_DESC])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you have to make sure the field is sortable, otherwise it won't work&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-15T15:04:22.453" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26165" PostTypeId="1" AcceptedAnswerId="26177" CreationDate="2018-05-15T15:39:24.123" Score="1" ViewCount="1150" Body="&lt;p&gt;Have read this &lt;a href=&quot;https://nystudio107.com/blog/creating-optimized-images-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;, but still having issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3.0.4&#xA;Imager 2.0.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = block.image.one() %}&#xA;{% set focalPoint = image.focalPoint | default(&quot;50% 50%&quot;) %}&#xA;&#xA;{# &#xA;  // set transform for floated images&#xA;  // override in full width&#xA;#}&#xA;{% set transformedImages = craft.imager.transformImage(image,&#xA;    [&#xA;        { width: 400, ratio: 4/3, jpegQuality: 85 },&#xA;        { width: 640, ratio: 4/3, jpegQuality: 85 },&#xA;    ],&#xA;    {&#xA;        format: 'jpg',&#xA;        allowUpscale: false,&#xA;        mode: 'crop',&#xA;        jpegQuality: 80,&#xA;        interlace: true,&#xA;        position: focalPoint,&#xA;    }&#xA;) %}&#xA;&#xA;&#xA;{# determine if image floats or not #}&#xA;{% if block.imageFormat == &quot;left&quot; %}&#xA;  {% set imageClass = &quot;floated-left&quot; %}&#xA;{% elseif block.imageFormat == &quot;right&quot; %}&#xA;    {% set imageClass = &quot;floated-right&quot; %}&#xA;{% else %}&#xA;    {# full width #}&#xA;    {% set imageClass = &quot;full-width&quot; %}&#xA;{% endif %}&#xA;{# end floats or not #}&#xA;&#xA;{# full width image here #}&#xA;{% if block.imageFormat == &quot;fullWidth&quot; %}&#xA;&#xA;{% else %}&#xA;{# floated images here #}&#xA;  &amp;lt;img &#xA;    src=&quot;{{ craft.imager.base64Pixel(16, 9) }}&quot; &#xA;    sizes=&quot;(max-width: 640px) 640w, (min-width:641px) 400w&quot; &#xA;    srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot; &#xA;    class=&quot;{{ imageClass }}&quot;&#xA;    &amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I expect to happen is that at widths smaller than 640px an image with a width of 640px is served up, at widths 641px and larger and image of 400pxs is served up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However at large widths I see the 640px width image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The outputted code on the front end is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img &#xA;  src=&quot;data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2716%27%20height%3D%279%27%20style%3D%27background%3Atransparent%27%2F%3E&quot;&#xA;&#xA;  sizes=&quot;(max-width: 640px) 640w, (min-width:641px) 400w&quot; &#xA;&#xA;  srcset=&quot;/imager\uploads\32\love-letters-in-pink-hearts_4460x4460-1_d5a1008e3f8fb9f7c44fa92474183c3e.jpg 400w, /imager\uploads\32\love-letters-in-pink-hearts_4460x4460-1_3edaa49114a08f6f3438bb6daad2e68a.jpg 600w, /imager\uploads\32\love-letters-in-pink-hearts_4460x4460-1_7c3d51f40436135917e37f29c276802d.jpg 640w&quot;&#xA;&#xA;  class=&quot;floated-left&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what I'm doing wrong. Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-05-16T17:27:30.427" Title="responsive image and srcset with Imager" Tags="&lt;craft3&gt;&lt;plugin-imager&gt;&lt;responsive-images&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26166" PostTypeId="1" AcceptedAnswerId="26168" CreationDate="2018-05-15T16:15:45.797" Score="2" ViewCount="376" Body="&lt;p&gt;How can I add a css class directly to the INPUT tag generated by {{ input|raw }} from the accessible template of the sprout form plugin? I do not wish to add the class to a surrounding div.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up looping through the form fields, which works almost but lacks the field types:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my field.html. It seems I cant get the field.type thus it defaults to text for all fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- do craft.sproutForms.addFieldVariables(_context) -%}&#xA;&#xA;{%- set label            = field.name ?? null %}&#xA;{%- set name             = field.handle ?? null %}&#xA;{%- set type             = field.type ?? 'text' %}&#xA;{%- set required         = field.required is defined and field.required ? true : false %}&#xA;&#xA;{%- set id               = renderingOptions.id ?? name %}&#xA;{%- set class            = renderingOptions.class ?? name %}&#xA;{%- set value            = entry is not empty ? entry.getFieldValue(name) : null %}&#xA;{%- set errors           = entry is not empty ? entry.getErrors(name) : null %}&#xA;&#xA;&#xA;{%- namespace field.getNamespace() -%}&#xA;    {%- if field.isPlainInput() -%}&#xA;&#xA;        {{ input|raw }}&#xA;&#xA;    {%- else %}&#xA;&#xA;        {% if label -%}&#xA;            &amp;lt;div class=&quot;heading&quot;&amp;gt;&#xA;                {% if label -%}&#xA;&#xA;                        &amp;lt;label{% if name %} for=&quot;{{ name }}&quot;{% endif %}&amp;gt;&#xA;                            {{- label|raw|t('sprout-forms') -}}&#xA;                        &amp;lt;/label&amp;gt;&#xA;&#xA;                {%- endif -%}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif -%}&#xA;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;col-md-4&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;{{type}}&quot; name=&quot;{{name}}&quot; class=&quot;{{class}}&quot; {%- if required %} required{% endif -%}&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% include &quot;errors&quot; with {&#xA;            errors: errors,&#xA;            name: name&#xA;        } %}&#xA;&#xA;    {%- endif -%}&#xA;{%- endnamespace -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the tab.html which calls uses the field.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- for tab in tabs -%}&#xA;&#xA;    {%- set layoutFields = tab.getFields() %}&#xA;&#xA;    &amp;lt;section class=&quot;tab&quot;&amp;gt;&#xA;&#xA;    {% set fieldOptions = {  &#xA;        &quot;class&quot;: &quot;form-control&quot;,&#xA;        &quot;errorClass&quot;: &quot;has-error&quot;,&#xA;        &quot;data&quot;: {&#xA;            &quot;hidden&quot;: &quot;false&quot;,&#xA;        }&#xA;    } %}&#xA;&#xA;    {% for field in layoutFields -%}&#xA;        {{- craft.sproutForms.displayField(form, field, fieldOptions) }}&#xA;    {%- endfor %}&#xA;&#xA;    &amp;lt;/section&amp;gt;&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is all based on the default &quot;accessible&quot; template from the plugin. While I know I could put the fields manually in the template, I would prefer to learn how this is actually done &quot;nicely&quot;. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7751" LastEditorUserId="57" LastEditDate="2018-05-15T23:55:55.837" LastActivityDate="2018-05-15T23:55:55.837" Title="Craft 3 / Sprout Forms Bootstrap field classes" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26168" PostTypeId="2" ParentId="26166" CreationDate="2018-05-15T19:53:16.017" Score="2" Body="&lt;p&gt;In Craft 3, you can do this by overriding the field inputs directly, and you shouldn't have to add any logic to the form, tab, or fields templates. We're still working on getting the docs updated to properly show this.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Custom Form Templates&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;To override field inputs in Sprout Forms, you can enable Form Overrides in your settings.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sprout Forms-&gt;Settings-&gt;General-&gt;Default Form Templates-&gt;Custom&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here you can define an override folder in your front-end templates. Let's say you set your default templates to &lt;code&gt;_forms&lt;/code&gt;. This means your override templates will exist in &lt;code&gt;templates/_forms&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have that in place, you can place a &lt;code&gt;fields&lt;/code&gt; folder within that folder that contains a field override:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/_forms/fields/dropdown/input.html&#xA;templates/_forms/fields/email/input.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do this for all the fields where you wish to modify the base input HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good place to start may be to copy the code for the specific field you wish to override from Sprout Forms itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms/tree/v3/src/templates/_formtemplates/fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-forms/tree/v3/src/templates/_formtemplates/fields&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Making Your Form Templates into a Plugin&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you like the templates you've created and wish to reuse them on more than one project, you can take what you've done above and wrap it in a plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating a Form Template integration will display your Form Templates in the dropdown list of Templates to choose from. The template files themselves would then be managed in your plugin instead of in your project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of how to create an integration in Sprout Forms with the AccessibleTemplates Form Templates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms/blob/v3/src/integrations/sproutforms/formtemplates/AccessibleTemplates.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-forms/blob/v3/src/integrations/sproutforms/formtemplates/AccessibleTemplates.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integration is really just a way to tell Sprout Forms where your form templates are and makes it easier for content editors to select in the Craft UI.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-05-15T20:01:39.677" LastActivityDate="2018-05-15T20:01:39.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26170" PostTypeId="1" CreationDate="2018-05-15T20:25:34.770" Score="1" ViewCount="49" Body="&lt;p&gt;I have a situation where &lt;a href=&quot;https://github.com/craftcms/cms/issues/812&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix within Matrix&lt;/a&gt; would be ideal, but instead we've ended up with a Matrix row that has pairs of fields up to a maximum of 6:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;quote1&#xA;attribution1&#xA;…&#xA;quoteN&#xA;attributionN&#xA;…&#xA;quote6&#xA;attribution6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rather than work through each pair…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if matrixBlock.quote1|length %} {# quote 1 stuff #} {% endif %}&#xA;…&#xA;{% if matrixBlock.quote6|length %} {# quote 6 stuff #} {% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…I thought I might be able to use a variable reference to numbers 1 to 6:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set quotes = [1, 2, 3, 4, 5, 6] %}&#xA;&#xA;{% for n in quotes %}&#xA;    {% set nText = 'quote' ~ n %}&#xA;    {% set nCite = 'attribution' ~ n %}&#xA;&#xA;    &amp;lt;blockquote&amp;gt;&#xA;        {{ matrixBlock.nText|md }}&#xA;        &amp;lt;cite&amp;gt;{{ matrixBlock.nCite }}&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…but although &lt;code&gt;{{ dump(nText) }}&lt;/code&gt; confirms the reference string is being parsed correctly, the string is clearly invalid as a field reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get this done to achieve a nice terse template (not the end of the world if I can't)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sense that Twig's &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/attribute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;attribute&lt;/a&gt; function might help, but I can't join the dots.&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2018-05-16T13:38:49.487" LastActivityDate="2018-05-16T13:38:49.487" Title="Using variable references to fields in a template" Tags="&lt;templating&gt;&lt;variable&gt;&lt;array&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26172" PostTypeId="2" ParentId="26170" CreationDate="2018-05-15T20:47:27.797" Score="1" Body="&lt;p&gt;Figured it out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for n in [1, 2, 3, 4, 5, 6] %}&#xA;    {% if attribute(matrixBlock, 'quote' ~ n)|length %}&#xA;    &amp;lt;blockquote&amp;gt;&#xA;        {{ attribute(matrixBlock, 'quote' ~ n) }}&#xA;        &amp;lt;cite&amp;gt;{{ attribute(matrixBlock, 'attribution' ~ n) }}&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2018-05-15T20:52:38.427" LastActivityDate="2018-05-15T20:52:38.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26173" PostTypeId="2" ParentId="1773" CreationDate="2018-05-15T20:53:52.937" Score="33" Body="&lt;p&gt;In Craft 3 you can get the env using the &lt;code&gt;getenv()&lt;/code&gt; function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set env = getenv('ENVIRONMENT') %}&#xA;&#xA;{% if env == 'dev' %}&#xA;    hello dev&#xA;{% else %}&#xA;    hello world&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or via the app’s config service:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set env = craft.app.config.env %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There's a bit more information about the .env file in the docs for &lt;a href=&quot;https://docs.craftcms.com/v3/config/environments.html&quot; rel=&quot;noreferrer&quot;&gt;Environmental Configuration&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2020-07-14T21:32:21.987" LastActivityDate="2020-07-14T21:32:21.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26174" PostTypeId="2" ParentId="15701" CreationDate="2018-05-15T21:43:02.730" Score="13" Body="&lt;p&gt;For those coming here using Craft 3, it's now &lt;code&gt;Craft::$app-&amp;gt;getConfig()-&amp;gt;general-&amp;gt;devMode&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6275" LastActivityDate="2018-05-15T21:43:02.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26176" PostTypeId="2" ParentId="26160" CreationDate="2018-05-15T23:51:29.597" Score="2" Body="&lt;p&gt;As &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26160/does-craft-do-joined-calls-or-multiple-ones-when-fetching-the-related-items-el#comment34380_26160&quot;&gt;Robin&lt;/a&gt; mentioned in a comment, this is exactly what &lt;a href=&quot;https://docs.craftcms.com/v2/templating/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; was designed for... bringing in related elements in a single element query call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above link shows how to do it from Twig, but you can do it from PHP as well: &lt;a href=&quot;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/examples-of-eager-loading-elements-in-twig-and-php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-15T23:51:29.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26177" PostTypeId="2" ParentId="26165" CreationDate="2018-05-16T07:09:46.940" Score="1" Body="&lt;p&gt;It looks like the &lt;code&gt;sizes&lt;/code&gt; attribute needs to be tweaked. Absolute image sizes need to be specified in &lt;code&gt;px&lt;/code&gt; units, not &lt;code&gt;w&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ craft.imager.base64Pixel(16, 9) }}&quot; &#xA;     sizes=&quot;(min-width:641px) 400px, 100vw&quot; &#xA;     srcset=&quot;{{ craft.imager.srcset(transformedImages) }}&quot; &#xA;     class=&quot;{{ imageClass }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The way the browser reads &lt;code&gt;sizes&lt;/code&gt; is left to right and picks the first match. So the assumption would be that if the viewport width isn't greater or equal to 641px, then it must be smaller than 641px. So there's no need for &lt;code&gt;(max-width: 640px)&lt;/code&gt;. The last value is the default size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternately, this could be expressed by declaring the smallest viewport size to largest like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sizes=&quot;(max-width:640px) 100vw, 400px&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, instead of saying &quot;when the viewport is smaller than 640px, use the 640px image&quot;, e.g. &lt;code&gt;(max-width: 640px) 640px&lt;/code&gt;, what you probably want is &lt;code&gt;100vw&lt;/code&gt;. I'm assuming the image doesn't always stay 640px even when the screen gets smaller. If your design is responsive, the image will scale down with the screen width. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;100vw&lt;/code&gt; means that when your viewport is 400px wide or smaller, the browser can now choose to download the 400px wide image version. Or if the viewport is 640px wide, the 640px wide image is a better match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example on Codepen: &lt;a href=&quot;https://codepen.io/alexroper/pen/VxGgLj&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://codepen.io/alexroper/pen/VxGgLj&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possible reason you're not seeing the 400px size is if you're using a hi-dpi, &quot;Retina&quot; display or similar 4k monitor. The browser picks the best image to display from the available ones in &lt;code&gt;srcset&lt;/code&gt;. If you specified the target image size as 400px (CSS reference pixels), but you're display is 2x &quot;Retina&quot; display, the browser will favor using the higher resolution image. The high pixel density of a 2x display can fit 800 pixels in a 400-pixel space. 640px isn't as large as 800px, but it's better than 400px so the browser would choose that image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So even tho an iPhone 5 has a screen size of 320 × 568 in css reference pixels, the physical pixels are double that (640×1136). Safari will prefer to download the higher res 640px image over the 400px one in the img tag example above.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-05-16T17:27:30.427" LastActivityDate="2018-05-16T17:27:30.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26178" PostTypeId="2" ParentId="26170" CreationDate="2018-05-16T07:33:33.837" Score="1" Body="&lt;p&gt;You can also use the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;subscript syntax&lt;/a&gt; which is slightly more terse. And to iterate over a sequence of numbers, you can use the &lt;code&gt;..&lt;/code&gt; operator instead of listing the whole array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for n in 1..6 %}&#xA;    {% if matrixBlock['quote' ~ n]|length %}&#xA;    &amp;lt;blockquote&amp;gt;&#xA;        {{ matrixBlock['quote' ~ n] }}&#xA;        &amp;lt;cite&amp;gt;{{ matrixBlock['attribution' ~ n] }}&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;/blockquote&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-05-16T07:33:33.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26179" PostTypeId="2" ParentId="22242" CreationDate="2018-05-16T11:21:11.860" Score="2" Body="&lt;p&gt;I had this problem and the cause was that I was doing this in the base template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.carts.cart %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I should be doing the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if cart is not defined %}&#xA;    {% set cart = craft.commerce.carts.cart %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason behind is that the &lt;code&gt;cart&lt;/code&gt; object in &lt;code&gt;cart.getError&lt;/code&gt; function was always being initialized instead of getting the &lt;code&gt;cart&lt;/code&gt; from the POST response.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastActivityDate="2018-05-16T11:21:11.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26180" PostTypeId="2" ParentId="15226" CreationDate="2018-05-16T12:47:35.223" Score="1" Body="&lt;p&gt;Here's what I ended up doing. Despite having the format of DD/MM/YYYY on the front-end the Craft model actually stores the date in YYYY-MM-DD. Given the main the reason for wanting to perform server side validation is to check certain parts of the date i.e. year, you can create an array out of the string. You'll want to do a check to make sure the date string is a valid date, otherwise you'll get PHP errors with undefined offsets if trying to access array parts that aren't there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;$value&lt;/code&gt; - original date string submitted on the form, stored as YYYY-MM-DD by Craft&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;isValidDate&lt;/code&gt; - Perform a check on the string value to ensure its a valid date value. &lt;code&gt;DateTime::createFromFormat&lt;/code&gt; would return a date value if true, if it doesn't match the specified format, its false.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;$dateOfBirth&lt;/code&gt; - Using &lt;code&gt;explode()&lt;/code&gt; create an array of the date string, accessible in parts as &lt;code&gt;[0]&lt;/code&gt;, &lt;code&gt;[1]&lt;/code&gt;, &lt;code&gt;[2]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if($value != '')&#xA;{&#xA;    $isValidDate = DateTime::createFromFormat('Y-m-d', $value);&#xA;&#xA;    if($isValidDate)&#xA;    {&#xA;        $dateOfBirth = explode('-', $value);&#xA;        $dobYear = $dateOfBirth[0];&#xA;        $dobMonth = $dateOfBirth[1];&#xA;        $dobDay = $dateOfBirth[2];&#xA;&#xA;        // Further validation on date parts can occur here.&#xA;    }&#xA;    else &#xA;    {&#xA;        // Not a valid date&#xA;    }   &#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-05-16T12:47:35.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26182" PostTypeId="2" ParentId="25980" CreationDate="2018-05-16T14:33:24.040" Score="1" Body="&lt;p&gt;I had the same issue, and was able to get composer working again by deleting the &lt;code&gt;vendor/composer/installed.json&lt;/code&gt; file. The file was re-created (and each package’s source refererence field re-populated) when I ran &lt;code&gt;composer update&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8356" LastActivityDate="2018-05-16T14:33:24.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26183" PostTypeId="1" AcceptedAnswerId="26222" CreationDate="2018-05-16T17:13:59.893" Score="1" ViewCount="231" Body="&lt;p&gt;I hope someone has an example or something similar they have done in Craft before.  Her is what I have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Structure:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section -&gt; &lt;strong&gt;Flight Company&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Name -&gt; &lt;strong&gt;Plane Details&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Block: &lt;strong&gt;Plane Model and Part&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix Fields -&gt; &lt;strong&gt;Model, Part&lt;/strong&gt; (field type: Category)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am needing to perform this match example (preferable in crafts.entries query)before looping through the records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example match needed:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Model = Cessna&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part = Propx45&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to match both those conditions before looping through the results later on in the page.  I need to make sure all the Flight Company's match that criteria before outputing the Title of the Flight Company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How best to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="57" LastEditDate="2018-05-18T23:25:43.490" LastActivityDate="2018-05-22T22:33:31.347" Title="Match Matrix Fields Before Looping Through Results" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26184" PostTypeId="2" ParentId="26144" CreationDate="2018-05-17T01:08:16.477" Score="1" Body="&lt;p&gt;Thanks everyone for taking a look. I forgot that I had implemented something on the receiving templates that allowed you to navigate between articles from the newsletter, if the referral url was the newsletter. After I implemented the text only block, I forgot to change this to ignore those blocks.&lt;/p&gt;&#xA;" OwnerUserId="6830" LastActivityDate="2018-05-17T01:08:16.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26185" PostTypeId="1" AcceptedAnswerId="26186" CreationDate="2018-05-17T08:35:44.863" Score="1" ViewCount="75" Body="&lt;p&gt;I would like to create a field / a way to relate a certain Matrix Block to another Element. Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry A contains a Matrix Field &lt;code&gt;matrix&lt;/code&gt; and has several blocks. I want to relate one of those blocks to Entry B&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-17T08:35:44.863" Title="How to create a Matrix Relation field / relate Matrix Blocks to other Elements" Tags="&lt;plugin-development&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26186" PostTypeId="2" ParentId="26185" CreationDate="2018-05-17T08:35:44.863" Score="2" Body="&lt;p&gt;The &lt;code&gt;BaseRelationField&lt;/code&gt; is able to relate all elements - even Matrix Blocks but it's a little bit tricky because in order to display everything properly you need to define &lt;code&gt;sources&lt;/code&gt; but Matrix Blocks have no sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first we need to make sure our Matrix Blocks have a valid source, otherwise this Javascript check messes all up&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var $sources = this._getSourcesInList(this.getSourceContainer());&#xA;&#xA;// No source, no party.&#xA;if ($sources.length === 0) {&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And nothing works So we need the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    MatrixBlock::class,&#xA;    MatrixBlock::EVENT_REGISTER_SOURCES,&#xA;    function(RegisterElementSourcesEvent $event) {&#xA;        if (empty($event-&amp;gt;sources)) {&#xA;            $event-&amp;gt;sources[] = [&#xA;                'key'         =&amp;gt; 'MySource',&#xA;                'label'       =&amp;gt; 'All Matrixes',&#xA;                'defaultSort' =&amp;gt; 'elements.id',&#xA;                'data'        =&amp;gt; [&#xA;                    'handle' =&amp;gt; 'matrix'&#xA;                ],&#xA;                'criteria'    =&amp;gt; [&#xA;                    'typeId' =&amp;gt; 21,&#xA;                    'fieldId' =&amp;gt; 70 // &amp;lt;-- this is the matrix field of Entry A otherwise the values won't be populated&#xA;                ]&#xA;            ];&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to display an identifier we need to set the &lt;code&gt;title&lt;/code&gt; attribute to the block, otherwise all we see is an id.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    MatrixBlockQuery::class,&#xA;    MatrixBlockQuery::EVENT_AFTER_POPULATE_ELEMENT,&#xA;    function(PopulateElementEvent $event){&#xA;        $element = $event-&amp;gt;element;&#xA;        if($element-&amp;gt;getType()-&amp;gt;handle === 'person'){ //&amp;lt;-- make it is the correct matrix block&#xA;            try{&#xA;                $element-&amp;gt;title = $element-&amp;gt;getFieldValue('firstName') . ' ' . $element-&amp;gt;getFieldValue('lastName');&#xA;            }catch(Exception $exception){&#xA;                // whatever you need&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since Matrix Blocks usually have no table attributes we need to define them as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    MatrixBlock::class,&#xA;    MatrixBlock::EVENT_REGISTER_TABLE_ATTRIBUTES,&#xA;    function($event) {&#xA;        $event-&amp;gt;tableAttributes['id'] = ['label' =&amp;gt; 'ID'];&#xA;        $event-&amp;gt;tableAttributes['email'] = ['label' =&amp;gt; 'Email'];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that you can use the normal &lt;code&gt;BaseRelationField&lt;/code&gt; and extend it like you are used to for custom element types&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-17T08:35:44.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26187" PostTypeId="1" CreationDate="2018-05-17T08:55:17.077" Score="-1" ViewCount="750" Body="&lt;p&gt;How to create website using Craft CMS admin Control Panel. I want to create a single home page using Entries, Section, Fields, Category, Assets, Tag.&lt;/p&gt;&#xA;" OwnerUserId="8390" LastEditorUserId="57" LastEditDate="2018-05-17T18:55:24.180" LastActivityDate="2018-05-17T18:55:24.180" Title="How to create website using Craft CMS" Tags="&lt;craft-features&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2018-05-23T20:18:00.297" ContentLicense="CC BY-SA 4.0" />
  <row Id="26189" PostTypeId="2" ParentId="26187" CreationDate="2018-05-17T12:27:34.450" Score="2" Body="&lt;p&gt;You probably don't have any templates. You first need to have templates that render the info you are editing in the admin panel. &lt;a href=&quot;https://docs.craftcms.com/v3/twig-primer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this section&lt;/a&gt;, templates in CraftCMS are introduced, you may also want to refer to Twig, which is the template engine used in CraftCMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your questions I am guessing you are (I may be wrong) new to web development. If you want to learn more about web development you should go with HTML5. When you know HTML5, you will be able to code your own templates in Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;strong&gt;just want a single page&lt;/strong&gt; you should use something less powerful than CraftCMS, I think that creating a &lt;a href=&quot;https://pages.github.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;github personal page&lt;/strong&gt;&lt;/a&gt; for yourself is the fastest, easiest and more fascinating way for a beginner.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-05-17T13:35:56.397" LastActivityDate="2018-05-17T13:35:56.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26190" PostTypeId="1" AcceptedAnswerId="26191" CreationDate="2018-05-17T13:27:56.673" Score="1" ViewCount="28" Body="&lt;p&gt;I'm looking for shorter way of doing this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;dog dog dog&lt;/p&gt;&#xA;&#xA;&lt;p&gt;––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cat cat cat&lt;/p&gt;&#xA;&#xA;&lt;p&gt;––––––––––––––––––––––––––&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hamster hamster hamster&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have to run 3 independent loops to group pet types together, and insert a line rule between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I group pet types together and separate using a line rule?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      {% for pet in entries %}&#xA;            {% if pet.kind == 'dog' %}&#xA;                {% include '_partials/animalOrgChart' with {&#xA;                  title: pet.title,&#xA;                  subTitle: pet.jobTitle,&#xA;                  img: pet.headshot|length ? pet.headshot[0],                      &#xA;                  url: pet.url,&#xA;                  portrait: true&#xA;                } %}&#xA;            {% endif %}&#xA;      {% endfor %}&#xA;    &amp;lt;hr class=&quot;line&quot; /&amp;gt; &#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;          {% for pet in entries %}&#xA;                {% if pet.kind == 'cat' %}&#xA;                    {% include '_partials/animalOrgChart' with {&#xA;                      title: pet.title,&#xA;                      subTitle: pet.jobTitle,&#xA;                      img: pet.headshot|length ? pet.headshot[0],                      &#xA;                      url: pet.url,&#xA;                      portrait: true&#xA;                    } %}&#xA;                {% endif %}&#xA;          {% endfor %}&#xA;        &amp;lt;hr class=&quot;line&quot; /&amp;gt; &#xA;   &amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;          {% for pet in entries %}&#xA;                {% if pet.kind == 'hamster' %}&#xA;                    {% include '_partials/animalOrgChart' with {&#xA;                      title: pet.title,&#xA;                      subTitle: pet.jobTitle,&#xA;                      img: pet.headshot|length ? pet.headshot[0],                      &#xA;                      url: pet.url,&#xA;                      portrait: true&#xA;                    } %}&#xA;                {% endif %}&#xA;          {% endfor %}&#xA;        &amp;lt;hr class=&quot;line&quot; /&amp;gt; &#xA;   &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7446" LastActivityDate="2018-05-17T13:46:18.090" Title="Loop through all entry types, separate each group type by line rule (hr)" Tags="&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26191" PostTypeId="2" ParentId="26190" CreationDate="2018-05-17T13:46:18.090" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://docs.craftcms.com/v3/templating/filters.html#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group&lt;/a&gt; filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('pets').all() %}&#xA;{% set allEntriesByType = allEntries|group('type') %}&#xA;{% for type, pets in allEntriesByType %}&#xA;&#xA;     All Pets of Type {{ type }}&#xA;&#xA;     {% for pet in pets %}&#xA;         {% include '_partials/animalOrgChart' with {&#xA;             title: pet.title,&#xA;             subTitle: pet.jobTitle,&#xA;             img: pet.headshot|length ? pet.headshot[0],                      &#xA;             url: pet.url,&#xA;             portrait: true&#xA;         } %}        &#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;hr class=&quot;line&quot; /&amp;gt; &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-17T13:46:18.090" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26192" PostTypeId="1" CreationDate="2018-05-17T14:05:14.650" Score="1" ViewCount="159" Body="&lt;p&gt;We have web site with CraftCMS Pro 2.6.2930. Due to development of new site, we set test web server (Centos/Apache/mariaDB) in our local network and migrated whole site there for testing (2.6.2993 with trial license). Site is working, but logins to craft admin webpage are rejected (log in button is greyed out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For migration i have followed this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13982/migration-of-craft-cms-from-one-host-to-another&quot;&gt;Migration of Craft CMS from one host to another&lt;/a&gt; (we deleted license.key file)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft/storage/runtime/logs shows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2018/05/17 13:45:58 [warning] [application]  tried to log in unsuccessfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site content is migrated successfully. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I've already tried this and it isn't working: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13781/reset-password-with-mysql/13966#13966&quot;&gt;Reset password with MySQL&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: It seems my problem is very similar to this one &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1855/control-panel-access-greyed-out-button&quot;&gt;Control Panel access. Greyed out button&lt;/a&gt; since i see (almost the same) errors&lt;/p&gt;&#xA;" OwnerUserId="8391" LastActivityDate="2018-06-21T09:10:04.093" Title="Login grayed out, logins rejected" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26193" PostTypeId="1" AcceptedAnswerId="26195" CreationDate="2018-05-17T15:26:32.093" Score="1" ViewCount="68" Body="&lt;p&gt;Folks, this has to be easier than I've made it. In a front-end template, how do you grab a state abbreviation from a customer's address in Craft Commerce?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{$ set addresses = craft.commerce.customer.addresses $}&#xA;{% for address in addresses %}&#xA;  &amp;lt;-- this is where I want to show the abbreviation --&amp;gt;&#xA;  {{ address.state.abbreviation }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2018-05-17T18:30:51.030" Title="How to render a state abbreviation in Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26194" PostTypeId="1" AcceptedAnswerId="26197" CreationDate="2018-05-17T16:37:39.853" Score="1" ViewCount="5733" Body="&lt;p&gt;I have created an s3 bucket in aws and added the correct permissions and user group etc. I have added the below policy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Version&quot;: &quot;2012-10-17&quot;,&#xA;    &quot;Statement&quot;: [&#xA;        {&#xA;            &quot;Sid&quot;: &quot;VisualEditor0&quot;,&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:PutObject&quot;,&#xA;                &quot;s3:GetObjectAcl&quot;,&#xA;                &quot;s3:GetObject&quot;,&#xA;                &quot;s3:ListAllMyBuckets&quot;,&#xA;                &quot;s3:ListBucket&quot;,&#xA;                &quot;s3:DeleteObject&quot;,&#xA;                &quot;s3:GetBucketLocation&quot;,&#xA;                &quot;s3:PutObjectAcl&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: &quot;*&quot;&#xA;        },&#xA;        {&#xA;            &quot;Sid&quot;: &quot;VisualEditor1&quot;,&#xA;            &quot;Effect&quot;: &quot;Allow&quot;,&#xA;            &quot;Action&quot;: [&#xA;                &quot;s3:ListBucket&quot;,&#xA;                &quot;s3:GetBucketLocation&quot;&#xA;            ],&#xA;            &quot;Resource&quot;: &quot;arn:aws:s3:::bucketname&quot;&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I uploaded the assets from a local folder via ftp to the bucket using transmit ftp client which was fine. I have then set the bucket up on craft cms as an asset source. I can upload files to s3 via the cms fine with no issues and view the image fine but when I try to access an image on the front end that was uploaded via the ftp I get access denied error 403:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Error&amp;gt;&#xA;&amp;lt;Code&amp;gt;AccessDenied&amp;lt;/Code&amp;gt;&#xA;&amp;lt;Message&amp;gt;Access Denied&amp;lt;/Message&amp;gt;&#xA;&amp;lt;RequestId&amp;gt;96E15AB155C47209&amp;lt;/RequestId&amp;gt;&#xA;&amp;lt;HostId&amp;gt;&#xA;our-hist-id-here&#xA;&amp;lt;/HostId&amp;gt;&#xA;&amp;lt;/Error&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit here&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after some research I found out that you needed to add the policy directly to the bucket. You used to have to create a policy away from the bucket page itself in the IAM area but now(I think) it needs to be in the bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a policy issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5033" LastEditorUserId="5033" LastEditDate="2018-05-21T03:31:47.320" LastActivityDate="2018-05-21T03:31:47.320" Title="Why do I get Access denied on s3 asset source images?" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26195" PostTypeId="2" ParentId="26193" CreationDate="2018-05-17T18:30:51.030" Score="1" Body="&lt;p&gt;I received an answer on Slack from Stephen Callendar.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set addresses = craft.commerce.customer.addresses %}&#xA;{% for address in addresses %}&#xA;  {% if address.getState() %}&#xA;    {{ address.getState().abbreviation }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2018-05-17T18:30:51.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26196" PostTypeId="1" CreationDate="2018-05-17T20:16:09.627" Score="1" ViewCount="46" Body="&lt;p&gt;To me, I have a large dataset of 2,000 - 2,400 entries.  It's a static dataset.  I only need to update a few fields annually. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plan to use &lt;code&gt;channels&lt;/code&gt;.   &lt;strong&gt;But, how should I organize the channels?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1&lt;/strong&gt;  The entries can easily be divided between &lt;code&gt;development&lt;/code&gt; and &lt;code&gt;production&lt;/code&gt;.  Each &lt;code&gt;production&lt;/code&gt; entry has a corresponding &lt;code&gt;development&lt;/code&gt; entry.  This makes it easy to setup related records. This would result in roughly 1,000 to 1,200 entries in each channel.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2&lt;/strong&gt;&#xA;The entries can also easily be divided between 4 entities.  &lt;code&gt;Entity 1&lt;/code&gt;, &lt;code&gt;Entity 2&lt;/code&gt;, &lt;code&gt;Entity 3&lt;/code&gt; and &lt;code&gt;Entity 4&lt;/code&gt;.   This would result in 4 channels of roughly 500-600 entries per entity.  So, the &lt;code&gt;development&lt;/code&gt; and &lt;code&gt;production&lt;/code&gt; relationships would exist within in the same channel.  (I think - assume - this does not present any challenges.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which channel structure might be easier to build out and manage?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks    &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-05-18T11:10:35.893" Title="How should I organize/structure my channel sections?" Tags="&lt;sections&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26197" PostTypeId="2" ParentId="26194" CreationDate="2018-05-17T20:25:35.183" Score="2" Body="&lt;p&gt;I'm not really an AWS expert, but I think if you want to allow public access to an S3 bucket, then it should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Sid&quot;: &quot;PublicReadGetObject&quot;,&#xA;    &quot;Effect&quot;: &quot;Allow&quot;,&#xA;    &quot;Principal&quot;: &quot;*&quot;,&#xA;    &quot;Action&quot;: &quot;s3:GetObject&quot;,&#xA;    &quot;Resource&quot;: &quot;arn:aws:s3:::bucketname/*&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-17T20:25:35.183" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26198" PostTypeId="1" AcceptedAnswerId="26220" CreationDate="2018-05-17T22:45:04.427" Score="1" ViewCount="38" Body="&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set query = {} %}&#xA;&#xA;     {% if not craft.request.getParam('q')|length %}&#xA;          {#.. key, value pairing .. #}&#xA;          {% set query = query | merge({(key):(value)}) %}&#xA;     {% else %}&#xA;          {% set query = craft.request.getParam('q') %}&#xA;     {% endif %}&#xA;&#xA;     {% set queryStr = query|join(' OR ') %}&#xA;&#xA;     {% do craft.sproutForms.addFieldVariables({ queryStr: queryStr }) %}   &#xA;&#xA;     {{ craft.sproutForms.displayForm('requestcsv') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I add {{queryStr}} to my hidden field in requestcsv, it doesn't populate. I can output {{queryStr}} on the page, and even so, it doesn't get passed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing in order to be able to pass this string to a hidden field? {{queryStr}} is just a plain string.&lt;/p&gt;&#xA;" OwnerUserId="413" LastActivityDate="2018-05-18T19:58:04.157" Title="addFieldVariables not functioning with string data" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26199" PostTypeId="1" AcceptedAnswerId="26200" CreationDate="2018-05-17T22:56:04.140" Score="3" ViewCount="210" Body="&lt;p&gt;Seeing as there currently isn't a way of deleting / managing tags in Craft3, I was wondering if someone could point me to where in the database these tags are stored so I can delete them manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;Looks like tag management through the CMS is also on the agenda for version 3 as seen in this git issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/820&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/820&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6893" LastEditorUserId="6893" LastEditDate="2018-05-20T21:20:00.227" LastActivityDate="2018-05-20T21:20:00.227" Title="Where are tags stored in the database?" Tags="&lt;database&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26200" PostTypeId="2" ParentId="26199" CreationDate="2018-05-18T00:44:57.217" Score="4" Body="&lt;p&gt;Tags are Elements and are stored in multiple places in the database, so editing the db directly may not be as easy as just finding the Tags you want and deleting them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tag itself is stored in multiple places including the tables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;content&#xA;elements&#xA;elements_sites&#xA;tags&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll find the Tag Name that you recognize in the &lt;code&gt;content&lt;/code&gt; table in the &lt;code&gt;title&lt;/code&gt; column. However, the only way to delete the references to a given tag in all of the tables would be to delete it by it's Element ID in the &lt;code&gt;elements&lt;/code&gt; table, which would cascade through the other tables and clean them up as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quite possible to do via the db directly, but probably not advisable or convenient in many situations. Be sure to backup your database before you try, if you dare.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the case this must be done manually, you could consider the following steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Export all tags from the db into a CSV file. Select all the ones you wish to delete. Use your spreadsheet to combine all the Element IDs of the tags you want to delete into a comma-delimited list. Then return to your database program and delete all the Tags by their Element IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DELETE FROM elements&#xA;WHERE id IN (1, 3, 5, 7, 9);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-05-18T03:17:01.970" LastActivityDate="2018-05-18T03:17:01.970" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26202" PostTypeId="1" CreationDate="2018-05-18T04:33:24.417" Score="2" ViewCount="4246" Body="&lt;p&gt;I created a Vue component. And in this component, I use axios to send post request when it's mounted, CSRF token also included, but still got 400 status. Anyone know why?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="57" LastEditDate="2018-05-18T19:24:52.177" LastActivityDate="2018-05-18T19:24:52.177" Title="Axios post function got 400 bad request" Tags="&lt;ajax&gt;&lt;csrf&gt;&lt;vue&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26203" PostTypeId="2" ParentId="26202" CreationDate="2018-05-18T05:28:24.493" Score="3" Body="&lt;p&gt;Just found the solution:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;npm install qs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qs from 'qs'&#xA;&#xA;...&#xA;const actions = {&#xA;    auth({ commit }, { email, password }) {&#xA;&#xA;        axios.post('url', qs.stringify({&#xA;            your token data here&#xA;        })).then((res) =&amp;gt; {&#xA;            console.log(res.data)&#xA;        }).catch((err) =&amp;gt; {&#xA;            console.log(err)&#xA;        })&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-05-18T05:28:24.493" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26204" PostTypeId="1" AcceptedAnswerId="26205" CreationDate="2018-05-18T07:11:12.097" Score="1" ViewCount="82" Body="&lt;p&gt;In Craft CMS is it possible to add a Secion, Entries in basic/simple HTML page instead of Twig template? &lt;/p&gt;&#xA;" OwnerUserId="8390" LastEditorUserId="57" LastEditDate="2018-05-18T19:26:07.173" LastActivityDate="2018-05-18T19:26:07.173" Title="Is it possible to add a Section, Entries in basic/simple HTML page instead of Twig template?" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26205" PostTypeId="2" ParentId="26204" CreationDate="2018-05-18T07:36:52.777" Score="2" Body="&lt;p&gt;You can't add a Section in Twig either. You have to use PHP in order to create logic. Html is only used to display things on you page but it does not include logic nor is it able to fetch elements (working with databases) Twig is a template engine, you could describe it as a middleman between HTML and PHP it is able to fetch elements and uses a limited amount of PHP to display them &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't be able to work with Craft properly without using Twig at all unless you modify many things with PHP&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like mentioned in the other thread Craft might not be the correct  CMS for you &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-18T07:43:54.357" LastActivityDate="2018-05-18T07:43:54.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26206" PostTypeId="2" ParentId="26204" CreationDate="2018-05-18T07:38:44.400" Score="1" Body="&lt;p&gt;Yes, it is possible, but it generally doesn't make much sense because the purpose of CraftCMS, is to allow anybody to easily change the content of what is in the template without having to use actual HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your template to be plain HTML, you can do so by creating an HTML file under the &lt;code&gt;templates/&lt;/code&gt; folder and pointing to it in your section settings. For example, for &lt;code&gt;templates/terms.html&lt;/code&gt; you'd set your section template as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bNx7O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bNx7O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Did you have the chance to read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26187/how-to-create-website-using-craft-cms/26189#26189&quot;&gt;my answer here&lt;/a&gt;? Do you have any questions about what I said? &lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-05-18T07:45:05.833" LastActivityDate="2018-05-18T07:45:05.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26207" PostTypeId="1" CreationDate="2018-05-18T10:02:44.770" Score="1" ViewCount="608" Body="&lt;p&gt;one of our clients requested us to create a global webshop for their business. We have little experience with webshops and as we are avid fans of Craft, we'd like to start on this project with Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be built with Commerce 1.x as their current site is based on Craft 2 and an update to Craft 3 is not possible at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are a bit broad and is based on our little experience we have with Magento: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;how far does Craft Commerce go when a user puts an order?&lt;/strong&gt;&#xA;- The user buys something on the website&#xA;- The order is sent to the Payment gateway&#xA;- When the payment is processed, the gateway sends a confirmation back.&#xA;- &lt;strong&gt;What does Craft do next? Does it automatically set a new order status &quot;paid&quot;? It creates an order, but does it handle cancelations or order credit notes?&lt;/strong&gt;&#xA;Or does Craft Commerce quits when the order is created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Magento has some sort of built-in bookkeeping, but how far does Craft go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What gateway is best for global/international payments?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-05-21T03:21:21.393" Title="Craft Commerce payment gateway: general info requested" Tags="&lt;plugin-craftcommerce&gt;&lt;payment&gt;&lt;tax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26208" PostTypeId="1" CreationDate="2018-05-18T10:21:30.197" Score="1" ViewCount="97" Body="&lt;p&gt;I'm going through(learning) class reference &lt;a href=&quot;https://docs.craftcms.com/api/v2/fieldtypes/TableFieldType.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;TableFieldType in Craft 2&lt;/a&gt; and I'm having trouble pulling out the value from a table field and save it as variable. I'm not sure I've started with the right approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the piece of code I'm working on where contact details are saved to the table field. The problem starts when I need to get the email address value from that table field and use it further on.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    craft()-&amp;gt;on('guestEntries.success', function (GuestEntriesEvent $event)&#xA;    {&#xA;&#xA;        /** @var EntryModel $entryModel */&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;&#xA;        if($entryModel-&amp;gt;getSection()-&amp;gt;handle === &quot;orderId&quot;)&#xA;        {&#xA;&#xA;          $emailSettings = craft()-&amp;gt;email-&amp;gt;getSettings();&#xA;          $email         = new EmailModel;&#xA;          $emailAddress = '';&#xA;&#xA;          // Questionable, not complete block of code &#xA;          // Get value of &quot;emailAddress&quot; singleline type column from the &quot;contactDetails&quot; table field type&#xA;          foreach ($entryModel-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $fieldLayout)&#xA;          {&#xA;            $field = $fieldLayout-&amp;gt;getField();&#xA;&#xA;            if ($field-&amp;gt;getFieldType()-&amp;gt;getName() == Craft::t('Table'))&#xA;            {&#xA;&#xA;              foreach ($entryModel-&amp;gt;{$field-&amp;gt;myHandle}-&amp;gt; ??? as $input)&#xA;              {&#xA;                 $emailAddress = $input-&amp;gt;???;&#xA;              } &#xA;            }&#xA;          }&#xA;&#xA;          $email-&amp;gt;toFirstName = $entryModel-&amp;gt;getAuthor()-&amp;gt;firstName;&#xA;          $email-&amp;gt;toLastName  = $entryModel-&amp;gt;getAuthor()-&amp;gt;lastName;&#xA;&#xA;          // Test if email address from &quot;contactDetails&quot; table field is present&#xA;          $email-&amp;gt;toEmail     = !empty($emailAddress) ? $emailAddress : $entryModel-&amp;gt;getAuthor()-&amp;gt;email;&#xA;&#xA;          $email-&amp;gt;fromEmail   = $emailSettings['emailAddress'];&#xA;          $email-&amp;gt;replyTo     = $emailSettings['emailAddress'];&#xA;          $email-&amp;gt;sender      = $emailSettings['emailAddress'];&#xA;          $email-&amp;gt;fromName    = craft()-&amp;gt;config-&amp;gt;get('siteName');&#xA;          $email-&amp;gt;subject     = craft()-&amp;gt;config-&amp;gt;get('siteName') . &quot; - New order received&quot;;&#xA;          $email-&amp;gt;body        = &quot;...&quot;;&#xA;          craft()-&amp;gt;email-&amp;gt;sendEmail($email);&#xA;&#xA;        }&#xA;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-05-18T11:33:35.263" LastActivityDate="2018-05-18T11:33:35.263" Title="How do I access table field type value?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26209" PostTypeId="2" ParentId="26208" CreationDate="2018-05-18T10:57:32.893" Score="1" Body="&lt;p&gt;You can grab the content of a field for an element with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myTableField = $entry-&amp;gt;getContent()-&amp;gt;getAttribute('fieldHandle');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can modify the variable and send it back with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getContent()-&amp;gt;setAttribute('fieldHandle', $myTableField);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since you are probably in an event you should make sure your entry has the correct type and the correct section&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getSection()-&amp;gt;handle === 'mySectionHandle' &amp;amp;&amp;amp; $entry-&amp;gt;getType()-&amp;gt;handle === 'typeHandle'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to change every table field and not just a certain one you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($entry-&amp;gt;getFieldLayout()-&amp;gt;getFields() as $field){&#xA;    if($field::class === 'insert the class of the field here'){&#xA;        $table = $entry-&amp;gt;getContent()-&amp;gt;getAttribute($field-&amp;gt;handle);&#xA;   } &#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-18T11:03:12.110" LastActivityDate="2018-05-18T11:03:12.110" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26210" PostTypeId="2" ParentId="26196" CreationDate="2018-05-18T11:10:35.893" Score="2" Body="&lt;p&gt;Some of this depends on what the content is for each item. If all these pages are essentially the same sort of thing, but they differ in how you're categorising them - it's just one channel, and you can use Categories to organise them. Given that it seems you could categorise your content either by &quot;production / development&quot; and also by &quot;Entity 1 / 2 / 3 / 4&quot; it sounds like you may be better creating two Category Groups (&quot;Entities&quot; and &quot;Status&quot;), then creating a Category Field for each, which you add to your Entry Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's not really enough to go on in terms of what content you have to advise much more clearly than that though.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-05-18T11:10:35.893" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26211" PostTypeId="1" CreationDate="2018-05-18T13:13:50.160" Score="1" ViewCount="75" Body="&lt;p&gt;I have a site where users can add entries of an entry type/section called Listings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to limit the number of Listings to a maximum of three per user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another CMS I did this by writing a plugin that got triggered when a new Entry was created. This plugin determined the number of existing Entries for a given user and if the maximum was reached, the plugin cancelled the creation of a new entry and instead showed a message that the user had reached their maximum limit of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not to say that this is the best way to do it, or do it in Craft, but I am new to Craft CMS and have been looking for a hook or event that is triggered when a new entry is created, but I don't seem to be able to find anything like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also done a fair bit of searching on this topic and cant seem to find any Stack questions or posts on the net....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions much appreciated.....&lt;/p&gt;&#xA;" OwnerUserId="8278" LastActivityDate="2018-05-18T14:17:40.223" Title="How to limit number of entries to a given user/user group" Tags="&lt;entry&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26212" PostTypeId="1" CreationDate="2018-05-18T14:13:18.213" Score="1" ViewCount="17" Body="&lt;p&gt;I am running into an anomaly when trying to use FeedMe to update existing fields.  My data source is a &lt;code&gt;CSV&lt;/code&gt; file.  I have a &lt;code&gt;unique ID&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used FMP to create the entries.  Now, I want to update a &lt;code&gt;table&lt;/code&gt; in each entry with annual sales data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FMP is set to update existing elements.  My &lt;code&gt;unique ID&lt;/code&gt; (Line ID) exists in both the entries to be updated and the source &lt;code&gt;CSV&lt;/code&gt; file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have aligned the source CSV file fields to the target entry table fields.  The data preview looks good, with the value for each year correctly aligned.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also reduced the # of fields being updated to just the table fields and unique ID. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FMP runs the feed with no errors.  But, &lt;strong&gt;the output value for each year in the table is no longer correctly aligned with the assigned year in FMP setup.&lt;/strong&gt;  I thought at first it was a templating error on my part, but the values are misaligned in the CP entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-12-26T21:08:06.590" Title="Possible FeedMePro Anomaly When Trying to Update Table" Tags="&lt;plugins&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26213" PostTypeId="2" ParentId="26211" CreationDate="2018-05-18T14:17:40.223" Score="1" Body="&lt;p&gt;You might want to take a look at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/25901/title-field-character-length/25903#25903&quot;&gt;this&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your condition will be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$author = Craft::$app-&amp;gt;getUsers()-&amp;gt;getIdentity();&#xA;$numberOfEntriesByUser = Entry::find()-&amp;gt;sectionId($entry-&amp;gt;getSection()-&amp;gt;id)-&amp;gt;authorId($author-&amp;gt;id)-&amp;gt;count();&#xA;if($numberOfEntriesByUser){&#xA;    $event-&amp;gt;isValid = false &#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should make sure the author is not an admin or &lt;code&gt;Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsCpRequest()&lt;/code&gt; is false otherwise you won't be able to save new entries as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind to check for a current user as well. There won't be a user for cronjobs / other public post request &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-18T14:17:40.223" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26214" PostTypeId="2" ParentId="18537" CreationDate="2018-05-18T14:37:15.630" Score="1" Body="&lt;p&gt;Digging up an old question here but in order to display the title (and other field data) for Commerce products you need to use &lt;code&gt;{{ item.element.title }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to James Greig for that tip.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-05-21T07:44:37.617" LastActivityDate="2018-05-21T07:44:37.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26215" PostTypeId="1" CreationDate="2018-05-18T17:28:46.520" Score="0" ViewCount="77" Body="&lt;p&gt;Every entry in a section has a table.  The table depicts sales over 7 years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want to create an &lt;code&gt;index page&lt;/code&gt; that lists the title of each entry and the sales for each entry in the section.&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to loop through the table fields to template the table for each entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to loop through the titles of each entry to create an index page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But, how do I create an index page that loops through the table data for each entry?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple index loop: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in craft.entries.section('widgets').all() %}&#xA;    &amp;lt;li&amp;gt;{{ item.title }}&amp;lt;/li&amp;gt;        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The entry table format is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set field = craft.app.fields.getFieldByHandle('budgetTable') %}   &#xA;&#xA;        &amp;lt;table id=&quot;apaf&quot; class=&quot;table table-striped table-bordered&quot; style=&quot;width:100%&quot;&amp;gt;&#xA;            &amp;lt;thead &amp;gt;&#xA;                &amp;lt;tr&amp;gt;&#xA;                    {% for column in field.settings.columns %}&#xA;                    &amp;lt;th scope=&quot;col&quot; style=&quot;font-weight: bold;&quot;&amp;gt;{{ column.heading }}&amp;lt;/th&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/tr&amp;gt;    &#xA;            &amp;lt;/thead&amp;gt;     &#xA;&#xA;            &amp;lt;tbody&amp;gt;&#xA;                {% for row in entry.budgetTable %}&#xA;                &amp;lt;tr&amp;gt;    &#xA;&#xA;                    &amp;lt;th scope=&quot;row&quot; style=&quot;font-weight: bold;&quot;&amp;gt;{{ row.widgetTitle }}&amp;lt;/th&amp;gt;&#xA;&#xA;                &amp;lt;/tr&amp;gt;          &#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/tbody&amp;gt;          &#xA;        &amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2018-05-18T20:54:33.280" LastActivityDate="2018-05-18T20:54:33.280" Title="How do I create an index page that loop through the table fields of its entries?" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;table-field&gt;&lt;table&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26216" PostTypeId="1" AcceptedAnswerId="26221" CreationDate="2018-05-18T18:49:25.650" Score="1" ViewCount="217" Body="&lt;p&gt;I have the following code where I'm pulling entries related to another entry which works fine. However I also want to limit the entries returned on a category page and thus am merging in a relatedTo: category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However on the category page it is returning all entries related to that category, not limited to the category AND the related entry&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myStation = getCookie('myStation') %}&#xA;{% set relatedStation = craft.entries.id(myStation) %}&#xA;&#xA;&#xA;{# set pagination/categories #}&#xA;{% set params = { section: 'blog', limit: 6, offset: 1, relatedTo: relatedStation } %}&#xA;{% if category is defined %}&#xA;  {% set params = params | merge({ relatedTo: category }) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries(params) %}&#xA;{% paginate entries as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see the &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs includes&lt;/a&gt; 'and' (bottom of the page) but I'm not sure how to get that in there using merge. Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2018-05-18T21:08:13.600" LastActivityDate="2018-05-18T23:01:08.053" Title="Merging Multiple Relations as params" Tags="&lt;relatedto&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26217" PostTypeId="1" AcceptedAnswerId="26265" CreationDate="2018-05-18T18:49:39.790" Score="0" ViewCount="3148" Body="&lt;p&gt;I have a section called &quot;events&quot; in which I have a table field that contains dates and times of these events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to order my events by date and within each day by time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of mergin an array that contains only the basic stuff and the Id to output the rest of the entry. (yes! I will cache the template). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how far I got, but I am struggling on how to first order by date, and then within a day, by time. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('events').limit(null) %}&#xA;&#xA;{% set dates = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;    {% set table = entry.cf_dates_table %}&#xA;&#xA;    {% for row in table if row.startDate %}&#xA;        {% set dates = dates|merge(&#xA;            [{&#xA;                'startDate': row.startDate,&#xA;                'startTime': row.startTime|date('G:i'),&#xA;                'endTime': row.endTime|date('G:i'),&#xA;                'id': entry.id,&#xA;                'uniqueId': entry.id ~ '-' ~ loop.index,&#xA;            }]&#xA;        )%}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;&#xA;&amp;lt;div id=&quot;list_container&quot;&amp;gt;&#xA;    {% for date in dates|sort() %}&#xA;        {{ date.startDate|date('l, d. F') }} {{ date.startTime }} – {{ date.endTime }}, {{ date.id }}&amp;lt;br /&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could imagine grouping the array by the day and then sort them within each day. But I can't get it to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody point me into the right direction?&lt;br&gt;&#xA;Is this a viable approach? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;br&gt;&#xA;Stefan&lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2018-05-22T19:52:27.013" Title="Order twig array by date and time" Tags="&lt;array&gt;&lt;sorting&gt;&lt;group&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26219" PostTypeId="1" AcceptedAnswerId="26226" CreationDate="2018-05-18T19:07:45.210" Score="1" ViewCount="38" Body="&lt;p&gt;I'm working on a website that was developed by someone else before me, I added a new section and template, I uploaded all my files, created my new section and field and created my first entry everything was looking good, I decided to add a second entry to ensure that everything is working, but when I preview the entry Craft is showing both entries on one page instead of creating separate page for the entries. Please, can someone tell what is the reason for that I'm new using Craft below is the code that I wrote for the new template? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;layout/_layout&quot; %}&#xA;&#xA;{% block breadcrumbs %}&#xA;    {% include 'includes/_Breadcrumbs' with { 'currentTitle' : entry.title } %}&#xA;{% endblock %}&#xA;&#xA;{% block content %}&#xA;&#xA;    {% for entry in craft.entries.section('newContent') %}&#xA;&#xA;        {% include 'includes/_pageTitle' %}&#xA;&#xA;        {# Top Content Section 1 #}&#xA;        &amp;lt;div class=&quot;ContentBox section-one&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;Container&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;flex&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;flex-content&quot;&amp;gt;&#xA;                        {% for block in entry.Headline %}&#xA;                            &amp;lt;h2 class=&quot;content-title Content-header&quot;&amp;gt;&#xA;                                {{ block.headline }}&#xA;                            &amp;lt;/h2&amp;gt;&#xA;                            {% if block.subHeadline %}&#xA;                                &amp;lt;h4 class=&quot;content-subtitle subHeader&quot;&amp;gt;{{ block.subHeadline }}&amp;lt;/h4&amp;gt;&#xA;                            {% endif %}&#xA;                        {% endfor %}&#xA;                        {% if entry.leadInText %}&#xA;                            {{ entry.leadInText }}&#xA;                        {% endif %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;!-- Sidebar section --&amp;gt;&#xA;                    &amp;lt;div class=&quot;aside sidebar&quot;&amp;gt;&#xA;                        {% include 'includes/_asideBox' %}&#xA;                    &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;!-- End sidebar section --&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {# Start Sections 2 - 5 #}&#xA;        {% for block in entry.newContentMatrix %}&#xA;            {% switch block.type %}&#xA;&#xA;                {% case &quot;twoColumnSection&quot; %}&#xA;                    {% include 'includes/_sectionTwo' %}&#xA;&#xA;                {# Section 3 #}&#xA;                {% case &quot;paragraphSection&quot; %}&#xA;                    {% include 'includes/_paragraphSection' %}&#xA;&#xA;                {# Double list Section #}&#xA;                {% case &quot;listSection&quot; %}&#xA;                    {% include 'includes/_listSection' %}&#xA;&#xA;                {# Section 4 #}&#xA;                {% case &quot;miniFormSection&quot; %}&#xA;                    {% include 'includes/_miniFormSection' %}&#xA;&#xA;                {# Call to action Banner #}&#xA;                {% case &quot;callToActionBanner&quot; %}&#xA;                    {% include 'includes/_callToAction' %}&#xA;&#xA;            {% endswitch %}&#xA;        {% endfor %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;    {% includeJsFile &quot;/public/ui/js/accodion-menu.js&quot; %}&#xA;    {% includeJsFile &quot;/public/ui/js/SideNavTrigger.Js&quot; %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8353" LastEditorUserId="8353" LastEditDate="2018-05-19T20:03:13.633" LastActivityDate="2018-05-19T20:38:22.800" Title="New entry showing under old one" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26220" PostTypeId="2" ParentId="26198" CreationDate="2018-05-18T19:58:04.157" Score="1" Body="&lt;p&gt;The value you place in your Hidden Field settings gets treated as a template and whatever values you pass o the &lt;code&gt;addFieldVariables&lt;/code&gt; method are treated as the object that gets parsed by that template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like, when you load an Entry page in Craft, Craft provides the &lt;code&gt;entry&lt;/code&gt; variable to the template, when we process the Hidden Field settings, Sprout Forms provides the &lt;code&gt;addFieldVariables&lt;/code&gt; variables to that template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Craft knows it is giving you an Entry and names it's variable &lt;code&gt;entry&lt;/code&gt;, Sprout Forms doesn't really know what you might be giving it, so it names the variable available to your settings template a generic term: &lt;code&gt;object&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can access these values using Object Syntax, in the same way you can using the Title Format behavior for Sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.variableName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or in your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.queryStr }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In some cases, you can also use a shorthand to output the value with a single curly brace: &lt;code&gt;{queryStr}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-05-18T19:58:04.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26221" PostTypeId="2" ParentId="26216" CreationDate="2018-05-18T21:58:13.643" Score="3" Body="&lt;p&gt;Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myStation = getCookie('myStation') %}&#xA;{% set relatedStation = craft.entries.id(myStation) %}&#xA;&#xA;{% set params = { section: 'blog', limit: 6, offset: 1, relatedTo: relatedStation } %}&#xA;&#xA;{% if category is defined %}&#xA;    {% set params = params|merge({relatedTo: ['and',&#xA;        { element: relatedStation },&#xA;        { element: category }&#xA;    ]}) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries(params) %}&#xA;{% paginate entries as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The trick with &lt;code&gt;merge&lt;/code&gt; is that it will always &lt;em&gt;replace&lt;/em&gt; matching keys that it finds.  So you need to tell it to replace it with the proper &lt;code&gt;and&lt;/code&gt; syntax.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-05-18T23:01:08.053" LastActivityDate="2018-05-18T23:01:08.053" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26222" PostTypeId="2" ParentId="26183" CreationDate="2018-05-18T23:27:45.953" Score="2" Body="&lt;p&gt;&lt;strong&gt;Updated Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out the original answer only works if you've got an single instance of a Matrix Block on the entry.  If you have multiple, it will search through all of them and return results for any block that has &lt;em&gt;any&lt;/em&gt; of the relations you're looking for, in spite of the inclusion of &lt;code&gt;and&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of the next &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#309---2018-05-22&quot; rel=&quot;nofollow noreferrer&quot;&gt;post-3.0.9&lt;/a&gt; release, you'll be able to get relational matches from individual Matrix Block instances using a method like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set targetModel = craft.categories.id(5).one() %}&#xA;{% set targetPart = craft.categories.id(20).one() %}&#xA;&#xA;{# be sure and set the field ID of the Matrix field you're interested in here %}&#xA;{% set entryIds = craft.matrixBlocks.fieldId(55).relatedTo(['and',&#xA;        { targetElement: targetModel, field: 'model' },&#xA;        { targetElement: targetPart, field: 'part' },&#xA;    ])&#xA;    .select(['ownerId'])&#xA;    .distinct()&#xA;    .column()&#xA;%}&#xA;&#xA;&#xA;{% set entries = craft.entries.id(entryIds).all() %}&#xA;&#xA;{# display the results #}&#xA;Total: {{ entries|length }}&amp;lt;br&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Answer&lt;/strong&gt;&#xA;Assuming the setup in your question, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# These are just two examples, but get the relevant target model and part categories however you want #}&#xA;&#xA;{# resolve to the &quot;Cessna&quot; category #}&#xA;{% set targetModel = craft.categories.id(4).one() %}&#xA;&#xA;{# resolve to the &quot;Propx45&quot; category #}&#xA;{% set targetPart = craft.categories.id(6).one() %}&#xA;&#xA;{% set entries = craft.entries.section('flightCompany').relatedTo(['and',&#xA;    { targetElement: targetModel, field: 'planeDetails.model' },&#xA;    { targetElement: targetPart, field: 'planeDetails.part' },&#xA;]).all() %}&#xA;&#xA;{# display the results #}&#xA;Total: {{ entries|length }}&amp;lt;br&amp;gt;&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for entry in entries %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant &quot;relations&quot; part of the docs: &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/relations.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-05-22T22:33:31.347" LastActivityDate="2018-05-22T22:33:31.347" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26223" PostTypeId="1" AcceptedAnswerId="26224" CreationDate="2018-05-19T11:43:03.687" Score="1" ViewCount="45" Body="&lt;p&gt;I'm trying to get the category title to render within the following object but it's just returning it as the static string instead of the {{ category.title }} actually rendering.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seo = craft.seo.custom(&#xA;    'Welcome back, {{ category.title }}',&#xA;    'Test Meta Description!'&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-05-20T21:40:27.780" Title="Including Entry Property in Object" Tags="&lt;entries&gt;&lt;category&gt;&lt;plugin-seo&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26224" PostTypeId="2" ParentId="26223" CreationDate="2018-05-19T12:02:57.913" Score="3" Body="&lt;p&gt;You want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seo = craft.seo.custom(&#xA;    'Welcome back, ' ~ category.title ~ ', Test Meta Description!'&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or even more clear (to me anyway):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seo = craft.seo.custom(&#xA;    &quot;Welcome back, #{category.title}, Test Meta Description!&quot;&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More here: &lt;a href=&quot;https://twitter.com/nystudio107/status/938018528527036416?s=21&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twitter.com/nystudio107/status/938018528527036416?s=21&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-05-20T21:40:27.780" LastActivityDate="2018-05-20T21:40:27.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26225" PostTypeId="1" CreationDate="2018-05-19T20:08:28.727" Score="2" ViewCount="3098" Body="&lt;p&gt;I'm unclear as to the best way to deploy a Craft CMS 3 site. I'm looking for some best practices and guidance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using Rocketeer to deploy the code from my local environment to my staging site. When I do this I get a ServiceUnavailableHttpException. Do I need to install Craft again once it's been deployed to my staging environment? I don't think I need to but I can't figure out why I'm getting this error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the past, I've run Craft 2 sites successfully by installing once on each environment and then gitignoring the common files that I want to share. I have a hook in my Rocketeer file that creates symlinks to the common files/directories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've thought about taking a similar approach with my Craft 3 site but am unclear as how I would do that now that the the core craft files are required within composer. Move all the core packages to require-dev in my composer file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Who can help steer me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4163" LastActivityDate="2018-05-19T22:38:04.390" Title="What is the best way to deploy a Craft CMS 3 site?" Tags="&lt;craft3&gt;&lt;best-practice&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26226" PostTypeId="2" ParentId="26219" CreationDate="2018-05-19T20:38:22.800" Score="1" Body="&lt;p&gt;Craft will inject the current entry by default in your template. All you have to do is to remove this loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('newContent') %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you are fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently you are fetching all entries within your section. If you don't want to display them all but only the current you should not do that &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-19T20:38:22.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26228" PostTypeId="2" ParentId="26225" CreationDate="2018-05-19T22:38:04.390" Score="4" Body="&lt;p&gt;At the risk of offering a &quot;link answer&quot;, the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; has a section on &lt;strong&gt;DEPLOYING CRAFT CMS&lt;/strong&gt; that should be useful to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never heard of Rocketeer, but popular ways to handle deployments are via &lt;a href=&quot;http://buddy.works/&quot; rel=&quot;nofollow noreferrer&quot;&gt;buddy.works&lt;/a&gt;, &lt;a href=&quot;https://forge.laravel.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laravel Forge&lt;/a&gt; and the like. We talk a lot about this on the &lt;a href=&quot;https://devmode.fm/episodes/website-deployment-without-tears&quot; rel=&quot;nofollow noreferrer&quot;&gt;Website Deployment without Tears&lt;/a&gt; episode of &lt;a href=&quot;https://devmode.fm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode.fm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-05-19T22:38:04.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26229" PostTypeId="1" CreationDate="2018-05-20T02:58:19.257" Score="1" ViewCount="512" Body="&lt;p&gt;I receive the following error message: Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory and am not entirely too sure what I need to do to connect to this database.  I'm not sure if it's a MAMP error or a Craft setup error as well.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ♥ ~/development/craft3local/install/craft setup&#xA;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] localhost&#xA;Database port: [3306] 8889&#xA;Database username: [root] root&#xA;Database password: &#xA;Database name: craft3local&#xA;Database table prefix: &#xA;Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using MAMP, not the Pro version.  My port is 8889 confirmed from the start page info and checking the ports section of the setup. I have also tried creating a different user for the database and it also did not work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="8395" LastEditorUserId="45" LastEditDate="2018-05-20T05:36:12.493" LastActivityDate="2018-05-20T05:36:12.493" Title="Craft 3 Setup: Testing Database Credentials Failed" Tags="&lt;craft3&gt;&lt;setup&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26232" PostTypeId="1" CreationDate="2018-05-20T08:18:00.290" Score="0" ViewCount="55" Body="&lt;p&gt;ex) original HTML source code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;exhibit/data&quot; type=&quot;application/jsonp&quot; href=&quot;https://spreadsheets.google.com/feeds/list/~~~~/od6/public/basic?alt=json-in-script&quot; ex:converter=&quot;googleSpreadsheets&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;~~~~~&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;td valign=&quot;top&quot; padding=&quot;0.5em&quot;&amp;gt;&#xA;    &amp;lt;span style=&quot;text-alight:left;&quot; ex:content=&quot;.label&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&#xA;    &amp;lt;b&amp;gt;Aired: &amp;lt;/b&amp;gt;&amp;lt;span ex:content=&quot;.start&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&#xA;    &amp;lt;b&amp;gt;Genre: &amp;lt;/b&amp;gt;&amp;lt;span ex:content=&quot;.genre&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&#xA;&amp;lt;/td&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see .label, .start, and .genrem but on Craft CMS they are errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I create code with no errors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error message is,&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internal Server Error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unexpected token &quot;punctuation&quot; of value &quot;.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*The error message displays like this on my PC's XAMPP&#xA;craft/templates/index,html&#xA;&lt;a href=&quot;https://i.stack.imgur.com/OfidZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OfidZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ref image on google spreadsheet,&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lPkH5.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lPkH5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5003" LastEditorUserId="5003" LastEditDate="2018-05-22T04:26:14.687" LastActivityDate="2018-05-22T12:29:17.907" Title="How to create any code from google spreadsheet like {.label} by Craft CMS" Tags="&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26233" PostTypeId="1" CreationDate="2018-05-20T08:29:42.713" Score="1" ViewCount="1106" Body="&lt;p&gt;I have a Matrix field and I want to be able to filter by it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I want to get all entries that has &lt;code&gt;matrixField.field1Type.value = {some value}.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="8399" LastEditorUserId="57" LastEditDate="2018-05-21T00:15:31.983" LastActivityDate="2018-05-21T00:15:31.983" Title="How can I filter by Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26234" PostTypeId="2" ParentId="26233" CreationDate="2018-05-20T08:38:38.247" Score="1" Body="&lt;p&gt;You can query Matrix blocks like you are used to with all other elements&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blocks = element.matrixFieldHandle.type('typeHandle').field('some value').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind your &lt;code&gt;field&lt;/code&gt; should be a valid field handle within your block type &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-20T08:51:51.330" LastActivityDate="2018-05-20T08:51:51.330" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26235" PostTypeId="1" CreationDate="2018-05-20T09:10:09.290" Score="1" ViewCount="154" Body="&lt;p&gt;I am trying to create a seamless user login interaction with a modal form using ajax. Let's say I have a navigation template &lt;code&gt;_navigation.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;&#xA;    {% if currentUser %}&#xA;    {{ currentUser }}&#xA;    — &amp;lt;a href=&quot;{{ url('shop/customer') }}&quot;&amp;gt;{{ &quot;My Orders&quot;|t }}&amp;lt;/a&amp;gt;&#xA;    — &amp;lt;a href=&quot;{{ url('shop/customer/addresses') }}&quot;&amp;gt;{{ &quot;My Addresses&quot;|t }}&amp;lt;/a&amp;gt;&#xA;    — &amp;lt;a href=&quot;{{ url('shop/customer/cards') }}&quot;&amp;gt;{{ &quot;My Cards&quot;|t }}&amp;lt;/a&amp;gt;&#xA;    — &amp;lt;a href=&quot;{{ logoutUrl }}&quot;&amp;gt;Logout&amp;lt;/a&amp;gt;&#xA;    {% else %}&#xA;      &amp;lt;a href=&quot;&quot; data-toggle=&quot;modal&quot; data-target=&quot;#loginModal&quot;&amp;gt;{{ &quot;Login&quot;|t }}&amp;lt;/a&amp;gt;&#xA;    — &amp;lt;a href=&quot;&quot; data-toggle=&quot;modal&quot; data-target=&quot;#registerModal&quot;&amp;gt;{{ &quot;Register&quot;|t }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After successful login I would like to refresh the view by loading the template again (using &lt;a href=&quot;http://api.jquery.com/load/&quot; rel=&quot;nofollow noreferrer&quot;&gt;jquery.load()&lt;/a&gt;). Since the template is &quot;hidden&quot; I can't access it. If I make the template &quot;visible&quot; all works, but naturally I would like the template to stay &quot;hidden&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="8326" LastEditorUserId="8326" LastEditDate="2018-05-20T09:33:03.170" LastActivityDate="2018-05-20T09:33:03.170" Title="Refresh &quot;hidden&quot; template after login with ajax" Tags="&lt;templating&gt;&lt;ajax&gt;&lt;login&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="26236" PostTypeId="1" CreationDate="2018-05-20T18:40:20.763" Score="1" ViewCount="109" Body="&lt;p&gt;I want to build the ability for the user to be able to filter by certain categories when browsing an existing category. As well as this I would like the user to be able to control the ordering of products (order by price, title, sale) and perhaps (tbc) the ability to choose how many products are shown. Finally, some products depending on the limit will have pagination for both the unfiltered results but also the filtered results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filters currently are brand and life-stage but there could be others depending on the growth of the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have these all working with Craft in isolation I am really unsure of the best way to pull these together so that they all work in harmony. Currently if you filter on a brand and then change the order the brand is lost and goes back to the main category view. This is because I am using query-strings to filter the brands, life-stage, ordering and limit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on the best way to tackle this from a front-end approach and also templating approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should perhaps add that the ability to filter by categories (brands etc) sits in a different location to the order function. So this might make things slightly more tricky as perhaps form could work to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-05-20T18:40:20.763" Title="Filters using multiple query strings with pagination and Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;categories&gt;&lt;filter&gt;&lt;querystring&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26237" PostTypeId="2" ParentId="26207" CreationDate="2018-05-21T02:28:42.527" Score="2" Body="&lt;p&gt;&lt;strong&gt;How far does Craft Commerce go when a user puts an order?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When an order is paid in full it is marked as complete and gets a default order status that you can configure, after that a store admin would move the order to another status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An order can also be completed if the payment gateway 'authorizes' the full amount of the order, allowing a store admin to 'capture' that payment at a later time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But does it handle cancelations or order credit notes?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cancellations of an order are a manual process. You would usually perform these steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Refund the transaction&lt;/li&gt;&#xA;&lt;li&gt;Change the order status to a status you set up like 'cancelled'.&lt;/li&gt;&#xA;&lt;li&gt;Have an email automatically go to the customer notifying them of the cancellation based on the order status.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Or does Craft Commerce quits when the order is created?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what you mean here, but you can manage the order in the CP after the order is completed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Magento has some sort of built-in bookkeeping, but how far does Craft go?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce does not keep any type of accounting ledger, it simply allows you to manage order and take payments on those orders. Most developer build a custom sql query to export data to their accounting system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What gateway is best for global/international payments?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce allows a single store with a single currency for all prices entered into that store for products / discounts / taxes etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have your products be manually translated for other regions since they are multi-locale aware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Commerce does have the ability to accept payment in currencies other than your primary currency so that your customer gets charged in a currency they expect to show up on their credit card statement - but you control the conversion ratio yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be best to find the right payment gateway to use that supports the currencies/global regions for payments and then find out the level of support for that gateway in Craft Commerce. We always suggest Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-05-21T03:21:21.393" LastActivityDate="2018-05-21T03:21:21.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26239" PostTypeId="2" ParentId="25957" CreationDate="2018-05-21T08:00:44.597" Score="0" Body="&lt;p&gt;The problem turned out to be a missing vitally important step in the set-up of Apache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default a fresh install of Ubuntu 18.04 has the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Directory /var/www&amp;gt;&#xA;    AllowOveride None&#xA;&amp;lt;/Directory&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it needs to be AllowOverride All - or else your .htaccess files are not read. That was why I was getting 502 errors in the root url and 404 errors everywhere else.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-05-21T08:00:44.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26240" PostTypeId="2" ParentId="2019" CreationDate="2018-05-21T10:23:50.267" Score="2" Body="&lt;p&gt;Craft 3 now uses a job queue powered by the &lt;a href=&quot;https://github.com/yiisoft/yii2-queue&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii2 Queue Extension&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some info in &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#background-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 Docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6526" LastActivityDate="2018-05-21T10:23:50.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26241" PostTypeId="1" CreationDate="2018-05-21T10:42:15.747" Score="2" ViewCount="145" Body="&lt;p&gt;I am looking to queue my form submissions to be processed in the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to only keep user data in the system/database as long as required. This will mean keeping it to debug it if something goes wrong in the processing (SMTP error to send the email, store in database/google sheet, etc) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a bonus I figure queuing should mean faster success responses to users (rather than waiting for whatever processing is required), and can also throttle the processing if a form gets hit with lots of submissions in a short period (such as a competition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for clarification if:&lt;br&gt;&#xA;1. Using the Craft Job queues is best for this.&lt;br&gt;&#xA;2. If should just use the default queue, or better to have a separate queue&lt;/p&gt;&#xA;" OwnerUserId="6526" LastEditorUserId="6526" LastEditDate="2018-05-21T13:41:52.547" LastActivityDate="2018-05-21T13:41:52.547" Title="Is the Craft Queue suitable for processing form submissions?" Tags="&lt;form&gt;&lt;queue&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26242" PostTypeId="1" CreationDate="2018-05-21T11:36:56.467" Score="1" ViewCount="137" Body="&lt;p&gt;Can’t believe this is the first time I’ve had to do this, but I need to search a field inside a matrix and I can’t find any documentation on this. Craft 2 if that matters. I had hoped something like &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft.entries.search('matrixField:field:value')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;would work but doesn’t seem to. Anyone help me out?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-05-21T13:16:43.180" Title="Searching Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26244" PostTypeId="2" ParentId="26242" CreationDate="2018-05-21T13:16:43.180" Score="1" Body="&lt;p&gt;As far as I know (please correct me if I missed something) you can only search for the entire matrix by &lt;code&gt;matrixField:value&lt;/code&gt; and not certain fields within your matrix since the table &lt;code&gt;searchindexes&lt;/code&gt; only contains the id of the matrix field itself, not the id of the field inside the matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However: you could create a &lt;code&gt;Query&lt;/code&gt; from your &lt;code&gt;ElementCriteriaModel&lt;/code&gt; in PHP via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$command = craft()-&amp;gt;elements-&amp;gt;buildElementsQuery($criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Join your matrixblock table as well as your matrixblock content table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$command-&amp;gt;join(&quot;your matrixTable&quot;, &quot;matrixTable.ownerId = elements.id&quot;);&#xA;$command-&amp;gt;join(&quot;your matrixContentTable&quot;, &quot;matrixContentTable.elementId = matrixTable.id&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And search for your field with a &lt;code&gt;where&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$command-&amp;gt;andWhere('MyAwesomeField LIKE %whatever%');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-21T13:16:43.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26245" PostTypeId="1" CreationDate="2018-05-21T15:21:00.930" Score="1" ViewCount="498" Body="&lt;p&gt;I'm attempting to update a craft 2 site to craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following these instructions, I used composer to install Craft:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#if-you-want-your-directory-structure-to-resemble-a-new-craft-3-project%E2%80%A6&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html#if-you-want-your-directory-structure-to-resemble-a-new-craft-3-project%E2%80%A6&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have got to the stage where I go to the domain.com/admin but I am getting the error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The requested URL /admin was not found on this server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help - at a dead end I am sure its something v simple!&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-05-21T15:43:30.850" Title="Craft 2 -&gt; 3 Update /admin 404" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;404&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26246" PostTypeId="2" ParentId="26245" CreationDate="2018-05-21T15:43:30.850" Score="1" Body="&lt;p&gt;Is a lot of potential reasons for what issue may be. Is Craft handling the 404 error? If not, it could be your server is not pointing to the web/index.php properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can check that just putting a die('hello world'); at the top of your index file at least.&lt;/p&gt;&#xA;" OwnerUserId="6526" LastActivityDate="2018-05-21T15:43:30.850" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26247" PostTypeId="2" ParentId="26151" CreationDate="2018-05-21T16:08:44.080" Score="1" Body="&lt;p&gt;Update the Notifications plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Craft Support:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Ultimately Yii/Craft is using PHP's serialize() method to do the&#xA;  serialization, which has always had quirks with serializing different&#xA;  types of objects, especially the more complex those objects are.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We try to only serialize simple objects and primitive data structures&#xA;  (arrays, strings, bools, etc.) to try and minimize those issues as&#xA;  much as possible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From The Developer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notifications are no longer queued as this causes a lot of issues with&#xA;  serialization. Will find a better solution for this in the future.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Prior to version 1.1.0, the Notifications plugin was attempted to serialize &lt;em&gt;the entire entry&lt;/em&gt; to place it in queue.&lt;/p&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2018-05-21T16:08:44.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26248" PostTypeId="1" AcceptedAnswerId="26249" CreationDate="2018-05-21T16:33:44.560" Score="3" ViewCount="287" Body="&lt;p&gt;In some of our plugins, we have added multi-site support. For the most part, things are working fine but I'm feeling a bit confused about the correct way to set the &lt;code&gt;currentSite&lt;/code&gt; in the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the front-end, I would expect &lt;code&gt;currentSite&lt;/code&gt; could be determined from the Base URL matching that of the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the backend, since all admin behavior is managed from the same base domain, there is nothing specific about the request that would indicate the request is for a certain site so using something like &lt;code&gt;Craft::$app-&amp;gt;getSites()-&amp;gt;currentSite&lt;/code&gt; seems to always give back the same answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Craft define the &lt;code&gt;currentSite&lt;/code&gt; on backend requests? What role should a plugin take in defining the &lt;code&gt;currentSite&lt;/code&gt;? Should we go as far as creating the variable for current site itself or could we just set the current site using something like &lt;code&gt;Craft::$app-&amp;gt;getSites()-&amp;gt;setCurrentSite()&lt;/code&gt; and expect Craft to do several things for us?  Should we expect different behavior of the &lt;code&gt;currentSite&lt;/code&gt; variable when working with Elements vs other components?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understandably, these are some broad questions. I'm mostly just looking for a better framework to understand what assumptions Craft makes about multi-site on the CP side of things and how we can best plan our code to take advantage of what is already there instead of reinventing the wheel.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-05-22T04:49:32.653" Title="What is the proper way to set `currentSite` in a CP template when managing multi-site stuff in Craft 3?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26249" PostTypeId="2" ParentId="26248" CreationDate="2018-05-21T16:52:43.873" Score="3" Body="&lt;p&gt;Maybe this is some kind of broad answer too but when you take a look at your CP requests you'll see: the &lt;code&gt;siteHandle&lt;/code&gt; is mostly passed as a variable in nearly every request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the URL routes the last segment is always the &lt;code&gt;siteHandle&lt;/code&gt;: By default, the current site will be used in every query but as soon as Craft recognizes a bodyParam &lt;code&gt;siteId&lt;/code&gt;/&lt;code&gt;criteria['siteId']&lt;/code&gt; (for example in your baseElementIndex) or in the URL route it uses that site for all &lt;code&gt;ElementQueries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your CP there is no such a thing like &lt;code&gt;currentSite&lt;/code&gt; (at least it is not really used for important logic) instead the current site is determined like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for siteId in groupSiteIds %}&#xA;    {% if siteId == entry.siteId %} &#xA;        // currentSite = entry.siteId&#xA;    {% else %}&#xA;        // not the current site&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I started I used the same method to check for a parameter &lt;code&gt;siteId&lt;/code&gt; within the bodyParam &lt;code&gt;criteria&lt;/code&gt;. My plugin routes are always something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;rules[] = [&#xA;    'pattern' =&amp;gt; 'form-builder/elements/&amp;lt;action:&amp;gt;/&amp;lt;id:\d+&amp;gt;/&amp;lt;siteHandle:\w+&amp;gt;',&#xA;    'route' =&amp;gt; 'form-builder/element/&amp;lt;action&amp;gt;',&#xA;    'defaults' =&amp;gt; [&#xA;        'id' =&amp;gt; null,&#xA;        'siteHandle' =&amp;gt; Craft::$app-&amp;gt;getSites()-&amp;gt;getPrimarySite()-&amp;gt;handle,&#xA;        'action'    =&amp;gt; 'index'&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if no &lt;code&gt;siteHandle&lt;/code&gt; is passed I use the &lt;code&gt;Craft::$app-&amp;gt;getSites()-&amp;gt;getPrimarySite()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;craft\controllers\EntriesController&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionEditEntry(string $sectionHandle, int $entryId = null, int $draftId = null, int $versionId = null, string $siteHandle = null, Entry $entry = null): Response&#xA;if ($siteHandle !== null) {&#xA;    $variables['site'] = Craft::$app-&amp;gt;getSites()-&amp;gt;getSiteByHandle($siteHandle);&#xA;&#xA;    if (!$variables['site']) {&#xA;        throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;later on, when there is really nothing at all it just assumes the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (empty($variables['site'])) {&#xA;    /** @noinspection PhpUnhandledExceptionInspection */&#xA;    $variables['site'] = Craft::$app-&amp;gt;getSites()-&amp;gt;getCurrentSite();&#xA;&#xA;    if (!in_array($variables['site']-&amp;gt;id, $variables['siteIds'], false)) {&#xA;        $variables['site'] = Craft::$app-&amp;gt;getSites()-&amp;gt;getSiteById($variables['siteIds'][0]);&#xA;    }&#xA;&#xA;    $site = $variables['site'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;TL:DR&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't use the &lt;code&gt;currentSite&lt;/code&gt; that much in the CP, it is determined by the current &lt;code&gt;element.siteId&lt;/code&gt; or the &lt;code&gt;siteMenu&lt;/code&gt; (in js). As soon as you enter the CP the selected site in the menu will be stored in your Javascript session, when you click on &lt;code&gt;create new entry&lt;/code&gt; you'll get routed to the site that is specified in your session. I think it's best to manage it the same way&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="57" LastEditDate="2018-05-22T04:49:32.653" LastActivityDate="2018-05-22T04:49:32.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26250" PostTypeId="2" ParentId="21982" CreationDate="2018-05-21T18:18:21.147" Score="2" Body="&lt;p&gt;You would just enter &lt;code&gt;{ parent? parent.slug : '' }/{ slug }&lt;/code&gt; in the &quot;Category URI Format&quot; Field in the Craft3 CP and it will recognize nested categories&lt;/p&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2018-05-21T18:18:21.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26252" PostTypeId="1" AcceptedAnswerId="26253" CreationDate="2018-05-21T21:38:25.183" Score="1" ViewCount="170" Body="&lt;p&gt;I moved from Craft 2 to 3 but some of the plugins I used at one-time and are no longer compatible with Craft 3.  Those old plugins are now ghosts.  Meaning they are listed in the database and some have their own tables.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to best get rid of old Craft 2 plugins?&lt;/p&gt;&#xA;" OwnerUserId="6619" LastEditorUserId="6619" LastEditDate="2018-05-21T22:11:47.790" LastActivityDate="2018-05-21T22:25:22.303" Title="Updated To Craft 3, How To Delete Craft 2 Plugins" Tags="&lt;plugins&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26253" PostTypeId="2" ParentId="26252" CreationDate="2018-05-21T22:25:22.303" Score="2" Body="&lt;p&gt;It partially depends on the plugin. The one guarantee you have is that there will be a row in the &lt;code&gt;plugins&lt;/code&gt; table. Go ahead and delete that row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some plugins create 3rd party tables. For &lt;em&gt;most&lt;/em&gt; of those plugins, it's probably safe to just delete those tables as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can't go back in time, but... the &lt;em&gt;best&lt;/em&gt; solution would have been to remove those plugins &lt;em&gt;before&lt;/em&gt; updating. Virtually all Craft 2 plugins did a good job cleaning up after themselves in the database.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Based on your comment...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Form Builder 2, AmForms, Hacksaw, Shortener&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Form Builder 2&lt;/strong&gt; - Not very familiar with this, but looks like it has 5 tables. Probably safe to delete them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;AmForms&lt;/strong&gt; - Another one with 5 tables. Probably safe to delete these as well.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Hacksaw&lt;/strong&gt; - No DB tables&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shortener&lt;/strong&gt; - No DB tables&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-05-21T22:25:22.303" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26254" PostTypeId="2" ParentId="26192" CreationDate="2018-05-22T08:43:17.960" Score="1" Body="&lt;p&gt;Resolved! So, the console clearly showed which files were broken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've downloaded those files again from production server, and uploaded on my test server. Login succeed without any problems now!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it has something to do with transfer mode (auto, binary, text etc) when transferring files via FTP. Transfer mode should be on auto, otherwise files might get corrupted which can cause all kind of (weird) problems. Thanks to Brad for help!&lt;/p&gt;&#xA;" OwnerUserId="8391" LastActivityDate="2018-05-22T08:43:17.960" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26256" PostTypeId="2" ParentId="26232" CreationDate="2018-05-22T12:29:17.907" Score="1" Body="&lt;p&gt;You need to use valid html/twig in your templates. Your “HTML Source Code” is not valid html. Removing the &lt;code&gt;.&lt;/code&gt; from the beginning of your attributes i.e.: &lt;code&gt;&amp;lt;span ex:content=&quot;genre&quot;&amp;gt;&lt;/code&gt; should resolve the error, but it still wont be good html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best option, IMHO, is to start with a good solid foundation of valid html and work up from there.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-05-22T12:29:17.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26257" PostTypeId="1" AcceptedAnswerId="26259" CreationDate="2018-05-22T13:10:46.957" Score="2" ViewCount="1136" Body="&lt;p&gt;I am looking for some assistance with the Element API plugin. I need to filter on the &lt;code&gt;bannerPageCategories&lt;/code&gt; field which is a multi select checkbox field. The value will be passed via a querystring value. I can filter on a field with a single value but how do I do this for fields which has an array of values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions will be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample code and json response is below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Json Response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {&#xA;      title:&quot;Test Banner 4&quot;,&#xA;      url:&quot;http://localhost:8888/banners/test-banner-4&quot;,&#xA;      jsonUrl:&quot;http://localhost:8888/api/banners/17&quot;,&#xA;      content:&quot;Test.&quot;, &#xA;       page-categories:[&#xA;       {&#xA;         label:&quot;ADSL&quot;,&#xA;         value:&quot;adsl&quot;,&#xA;         selected:true&#xA;       },&#xA;       {&#xA;        label:&quot;Fibre&quot;,&#xA;        value:&quot;fibre&quot;,&#xA;        selected:true&#xA;       }&#xA;    ],&#xA;   campaignId:&quot;sHKJJK&quot;,&#xA;   targetUrl:&quot;http://xyx.xaws.co.za&quot;,&#xA;   image1:&quot;//xyx.xaws.co.za/dev/images/banners/banner-lg.png&quot;,&#xA;   image2:&quot;//xyx.xaws.co.za/dev/images/banners/banner-md.png&quot;,&#xA;   image3:&quot;//xyx.xaws.co.za/dev/images/banners/banner-sm.png&quot;,&#xA;   date_published:&quot;2018-05-22T14:06:05+02:00&quot;,&#xA;   date_modified:&quot;2018-05-22T14:06:05+02:00&quot;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'api/banners' =&amp;gt; function () {&#xA;        \Craft::$app-&amp;gt;response-&amp;gt;headers-&amp;gt;set('Access-Control-Allow-Origin', '*');&#xA;        $target = \Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('target');&#xA;        $campaign = \Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('campaign');&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'banners',&#xA;                'bannerPageCategories' =&amp;gt; $target,&#xA;                'campaignId' =&amp;gt; $campaign              &#xA;            ],&#xA;            'transformer' =&amp;gt; function (Entry $entry) {&#xA;                $image1 = $entry-&amp;gt;image1-&amp;gt;first();&#xA;                $image2 = $entry-&amp;gt;image2-&amp;gt;first();&#xA;                $image3 = $entry-&amp;gt;image3-&amp;gt;first();&#xA;&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'jsonUrl' =&amp;gt; UrlHelper::url(&quot;api/banners/{$entry-&amp;gt;id}&quot;),&#xA;                    'content' =&amp;gt; $entry-&amp;gt;htmlcontent,&#xA;                    'page-categories' =&amp;gt; $entry-&amp;gt;bannerPageCategories,&#xA;                    'campaignId' =&amp;gt; $entry-&amp;gt;campaignId,&#xA;                    'targetUrl' =&amp;gt; $entry-&amp;gt;targetUrl,&#xA;                    'image1' =&amp;gt; $image1 ? $image1-&amp;gt;url : null,&#xA;                    'image2' =&amp;gt; $image2 ? $image2-&amp;gt;url : null,&#xA;                    'image3' =&amp;gt; $image3 ? $image3-&amp;gt;url : null,&#xA;                    'date_published' =&amp;gt; $entry-&amp;gt;postDate-&amp;gt;format(\DateTime::ATOM),&#xA;                    'date_modified' =&amp;gt; $entry-&amp;gt;dateUpdated-&amp;gt;format(\DateTime::ATOM),&#xA;                ];&#xA;            },&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="8020" LastEditorUserId="57" LastEditDate="2018-05-22T18:20:18.357" LastActivityDate="2018-05-22T18:20:18.357" Title="Element API - Filter on a value from a multi value field" Tags="&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26258" PostTypeId="2" ParentId="26257" CreationDate="2018-05-22T13:38:42.323" Score="1" Body="&lt;p&gt;The value is stored as a serialized array in your database, in your case your would have to filter for the &lt;strong&gt;string&lt;/strong&gt; &lt;code&gt;&quot;[&quot;adsl&quot;,&quot;fibre&quot;]&quot;&lt;/code&gt; (the order is the same like you specified in the field)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can as well insert an array &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;['and',  '*adsl*', '*fibre*']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;['or',  '*adsl*', '*fibre*']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-22T13:38:42.323" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26259" PostTypeId="2" ParentId="26257" CreationDate="2018-05-22T13:47:01.460" Score="2" Body="&lt;p&gt;When you wrap your term in asterisks, e.g. &lt;code&gt;*news*&lt;/code&gt;, the generated SQL for this query parameter uses a &lt;code&gt;LIKE&lt;/code&gt; operator for the &lt;code&gt;ANDWHERE&lt;/code&gt; condition is uses (see &lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html#param-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Queries&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that the values for the Select field don’t overlap (&lt;code&gt;sportnews&lt;/code&gt; and &lt;code&gt;news&lt;/code&gt; both matching &lt;code&gt;*news*&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'bannerPageCategories' =&amp;gt; &quot;*{$target}*&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-05-22T14:07:15.703" LastActivityDate="2018-05-22T14:07:15.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26260" PostTypeId="1" CreationDate="2018-05-22T16:36:53.130" Score="0" ViewCount="108" Body="&lt;p&gt;The client is using PayPal Express for the payment gateway. When orders are placed, Paypal shows the ID for the order, not the Order Number. Is there somewhere I can change that?&lt;/p&gt;&#xA;" OwnerUserId="649" LastActivityDate="2018-07-22T05:11:25.643" Title="How do I send PayPal the Craft Commerce Order Number?" Tags="&lt;plugin-craftcommerce&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26261" PostTypeId="1" AcceptedAnswerId="26262" CreationDate="2018-05-22T17:06:34.140" Score="3" ViewCount="1400" Body="&lt;p&gt;Just migrating a site from 2 to 3 and stuck on this little call, cannot find anything in the docs at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix field, Entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.featuredProjectLink.getUrl() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cannot for the life of me find the equivalent/new way in the docs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;TIA&lt;/p&gt;&#xA;" OwnerUserId="2236" LastEditorUserId="57" LastEditDate="2018-05-22T18:20:46.400" LastActivityDate="2018-05-22T18:20:46.400" Title="Craft CMS 3 - Entries field, getURL" Tags="&lt;entries&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26262" PostTypeId="2" ParentId="26261" CreationDate="2018-05-22T18:09:58.350" Score="5" Body="&lt;p&gt;&lt;code&gt;entry.featuredProjectLink&lt;/code&gt; is not an element or an array of elements, it is an object of type &lt;code&gt;MatrixQuery&lt;/code&gt; in order to fetch elements you have to use the &lt;code&gt;.one()&lt;/code&gt; or &lt;code&gt;.all()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.featuredProjectLink.one().getUrl() }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html&quot; rel=&quot;noreferrer&quot;&gt;Element Queries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;noreferrer&quot;&gt;Relations&lt;/a&gt; -&gt; the &quot;Going Through Matrix&quot; part is the thing you want&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-22T18:09:58.350" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26264" PostTypeId="1" AcceptedAnswerId="26271" CreationDate="2018-05-22T19:17:17.307" Score="1" ViewCount="339" Body="&lt;p&gt;We have many country websites on different continents. In the CP we group the sites, where the group has the name of the continent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we want to group the sites in the templates in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this, but it is not giving back the group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allSites = craft.app.sites.getAllSites() %}&#xA;{% set allGroups = allSites|group('allSites.group') %}&#xA;&#xA;{% for group, countriesInGroup in allGroups %}&#xA;    {{ group }} &amp;lt;br&amp;gt;&#xA;    {% for country in countriesInGroup %}&#xA;        {{country.language}} &amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope somebody can point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4892" LastEditorUserId="45" LastEditDate="2018-05-22T19:37:06.843" LastActivityDate="2018-06-30T12:34:59.783" Title="Group Sites by Groups" Tags="&lt;localization&gt;&lt;filter&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26265" PostTypeId="2" ParentId="26217" CreationDate="2018-05-22T19:52:27.013" Score="0" Body="&lt;p&gt;Thanks to brad I got the whole thing working. &#xA;Here's the stripped down code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;&#xA;    Get all Dates from within the table field in the section veranstaltungen&#xA;    ------------------------------------------------------------------------&#xA;    We have a section called veranstaltungen with a table field that contains dates and times&#xA;    In order to get all occurences of the dates wihin the table field, we first get all of the&#xA;    table dates and attach the entry to each table date.&#xA;    Then we sort this array (dates) first by day and within a day by time.&#xA;&#xA;    This is a simple Calendar without the need for a plugin.&#xA;&#xA;#}&#xA;{% set entries = craft.entries({&#xA;    section: 'veranstaltungen',&#xA;    with: [&#xA;        'cf_veranstaltungs_cat',&#xA;        'cf_veranstaltungsDatum_table',&#xA;        'cf_veranstaltung_asset',&#xA;        'cf_veranstaltungsLinks_table',&#xA;        'cf_veranstaltungs_assets',&#xA;        'cf_coVeranstalter_user'&#xA;    ],&#xA;&#xA;    relatedTo : relation_param,&#xA;    authorId: veranstalter_param|trim,&#xA;&#xA;    limit: null&#xA;}) %}&#xA;&#xA;{#&#xA;    The dates Array will contain all occurences of the entries - we will order it first by date and then by time&#xA;#}&#xA;{% set dates = [] %}&#xA;&#xA;{% for entry in entries %}&#xA;&#xA;    {% set table = entry.cf_veranstaltungsDatum_table %}&#xA;&#xA;    {% for row in table if row.startDate %}&#xA;        {% set dates = dates|merge(&#xA;            [{&#xA;                'date': row.startDate|date('Y-m-d'),&#xA;                'time': row.startTime|date('G'),&#xA;                'startDate': row.startDate,&#xA;                'startTime': row.startTime|date('G:i'),&#xA;                'endTime': row.endTime|date('G:i'),&#xA;                'entry': entry,&#xA;                'links': entry.cf_veranstaltungsLinks_table,&#xA;                'image': entry.cf_veranstaltung_asset,&#xA;                'files': entry.cf_veranstaltungs_assets,&#xA;                'categories': entry.cf_veranstaltungs_cat ?? null,&#xA;                'categoryColor': entry.cf_veranstaltungs_cat[0].cf_veranstaltungsCatColor ?? null,&#xA;                'categoryIcon': entry.cf_veranstaltungs_cat[0].cf_veranstaltungsIcon_asset.first.url ?? null,&#xA;                'author': entry.author,&#xA;                'coVeranstalter': entry.cf_coVeranstalter_user,&#xA;                'id': entry.id,&#xA;            }]&#xA;        ) %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&#xA;&#xA;{#&#xA;    ------------------------&#xA;    Veranstaltungen Listing&#xA;    ------------------------&#xA;#}&#xA;&#xA;&amp;lt;div id=&quot;list_container&quot;&amp;gt;&#xA;&#xA;    {% set datesSortedByDay = dates|group('date')|supersort('ksort', 'date') %}&#xA;    {% for key, day in datesSortedByDay %}&#xA;&#xA;        &amp;lt;h2&amp;gt;{{ key|date('l, d. F') }}&amp;lt;/h2&amp;gt;&#xA;&#xA;        {% for date in day|supersort('sort', 'time') %}&#xA;            {% include &quot;veranstaltungen/_common_tableDates&quot; %}&#xA;        {% endfor %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Crazy what you can do with twig! &lt;/p&gt;&#xA;" OwnerUserId="367" LastActivityDate="2018-05-22T19:52:27.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26266" PostTypeId="1" AcceptedAnswerId="26315" CreationDate="2018-05-22T23:36:13.140" Score="0" ViewCount="1151" Body="&lt;p&gt;I want to override the admin/users page template when a plug in is installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detail:&#xA;On the user page domain.com/admin/user all the groups are listed in the sidebar area. I get this from the \vender\craftcms\cms\src\templates_layouts\cp.html file. I want to install/use use a custom template for the user page using a plug in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the basics of overriding a admin template through a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit - More detail:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a plugin that creates a new controller exactly the way that is proposed in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/25698/restrict-permissions-per-entry-rather-than-per-section&quot;&gt;this post&lt;/a&gt;. The controller does two things (maybe more later):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) On entries page it displays all the entries to a logged in user that was posted by them and others from their same group. It does not display entries that were posted by users in other groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) On user page it displays only users from their own group. It does not display any other users from other groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the users page all the groups are listed here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jhzyS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jhzyS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not make sense to display all the groups here as the logged in user can only see or edit users in their own group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to change what is displayed in the group listing area.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="8071" LastEditDate="2018-05-26T22:04:13.713" LastActivityDate="2018-05-27T00:47:33.187" Title="Basics of overriding an admin page template - Craft 3" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26268" PostTypeId="2" ParentId="24160" CreationDate="2018-05-23T02:41:55.737" Score="1" Body="&lt;p&gt;I'd like to add to this post another possible solution if your &quot;Assets for this source have public URLs&quot; is turned on, but images are still not showing. I had my wires crossed in how I have the Base URL of the overall site set in relation to the Base URL in the Assets volume. In my particular case, the following settings finally got things working and all the images show up with getUrl() as they should. Hopefully this is helpful to others banging their heads trying to figure this out!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Assets/Volume:&lt;/strong&gt;&#xA;Base URL = &lt;strong&gt;/images&lt;/strong&gt;&#xA;File System Path = &lt;strong&gt;/images&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Settings/Sites:&lt;/strong&gt;&#xA;Base URL = &lt;strong&gt;@web/&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8303" LastActivityDate="2018-05-23T02:41:55.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26269" PostTypeId="2" ParentId="26260" CreationDate="2018-05-23T04:14:25.123" Score="1" Body="&lt;p&gt;Commerce V1 - You can use a hooks for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/hooks-reference#commerce_modifygatewayrequestdata&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/hooks-reference#commerce_modifygatewayrequestdata&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/hooks-reference#commerce_modifypaymentrequest&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/hooks-reference#commerce_modifypaymentrequest&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...basically, start by dumping all the data to look at what is being sent, then modify it as you need.  Here's an example of something similar (I truncate the data to make sure it fits the gateway's limits):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function commerce_modifyGatewayRequestData($data,$type,$transaction){&#xA;&#xA;        # Dump the data to see what is there....&#xA;        BusinessLogicPlugin::log(&quot;commerce_modifyGatewayRequestData&quot;); &#xA;        BusinessLogicPlugin::log(&quot;data&quot;);&#xA;        BusinessLogicPlugin::log($data);&#xA;        BusinessLogicPlugin::log(&quot;type&quot;);&#xA;        BusinessLogicPlugin::log($type);&#xA;        BusinessLogicPlugin::log(&quot;transaction&quot;);&#xA;        BusinessLogicPlugin::log($transaction);&#xA;&#xA;        # TRUNCATE any over-sized data eWay might not like....&#xA;        # Data limits come from here: https://eway.io/api-v3/#direct-connection&#xA;&#xA;       if(isset($data['Customer']['FirstName']))&#xA;        $data['Customer']['FirstName'] = substr($data['Customer']['FirstName'], 0, 49);&#xA;&#xA;       ... etc&#xA;&#xA;      return $data;&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-05-23T04:14:25.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26271" PostTypeId="2" ParentId="26264" CreationDate="2018-05-23T06:51:39.170" Score="2" Body="&lt;p&gt;You can use the Site component&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$groups = Craft::$app-&amp;gt;getSites()-&amp;gt;getAllGroups();&#xA;foreach ($groups as $group){&#xA;    echo $group-&amp;gt;name;&#xA;    foreach ($group-&amp;gt;getSites() as $site){&#xA;        echo $site-&amp;gt;name;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groups = craft.app.getSites().getAllGroups() %}&#xA;{% for group in groups %}&#xA;    {{ group.name }}&#xA;    {% for site in group.getSites() %}&#xA;        {{ site.name }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="4892" LastEditDate="2018-06-30T12:34:59.783" LastActivityDate="2018-06-30T12:34:59.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26273" PostTypeId="1" CreationDate="2018-05-23T14:35:01.277" Score="5" ViewCount="400" Body="&lt;p&gt;I'm trying to index some asset volumes that I'm creating in a migration. These are local volumes which may already contain files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping to avoid the step where I have to manually update the asset indices after creating volumes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code does not seem to perform the index, am I missing a step? I've studied the controller used by Utilities but I can't see where I'm going wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $volumeId = Craft::$app-&amp;gt;volumes-&amp;gt;getVolumeByHandle('myVolume')-&amp;gt;id;&#xA;&#xA;    $indexer = Craft::$app-&amp;gt;getAssetIndexer();&#xA;&#xA;    $sessionId = $indexer-&amp;gt;getIndexingSessionid();&#xA;&#xA;    $indexer-&amp;gt;processIndexForVolume($sessionId,$volumeId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated&lt;/p&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="210" LastEditDate="2018-12-13T18:57:32.450" LastActivityDate="2019-01-30T00:42:29.833" Title="Update Asset Index in Migration" Tags="&lt;craft3&gt;&lt;php&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26274" PostTypeId="1" CreationDate="2018-05-23T17:24:39.983" Score="0" ViewCount="38" Body="&lt;p&gt;is it possible to place my privacy notice and cookies policy in the footer menu?  Is there one and how do I do it?&lt;/p&gt;&#xA;" OwnerUserId="8407" LastActivityDate="2018-05-24T22:16:22.587" Title="How can I place links at the bottom of the site?" Tags="&lt;menu&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26275" PostTypeId="1" CreationDate="2018-05-23T18:44:41.430" Score="0" ViewCount="21" Body="&lt;p&gt;I am an end user and see there is a 3.0 version. Can I upgrade for free and what steps do I need to take to do that?&lt;/p&gt;&#xA;" OwnerUserId="8407" LastActivityDate="2018-05-24T22:25:43.373" Title="How can I upgrade to version 3.0 as a user?" Tags="&lt;upgrades&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26277" PostTypeId="1" CreationDate="2018-05-23T19:26:04.160" Score="1" ViewCount="41" Body="&lt;p&gt;I have a development system with MAMP and gulp and my localhost version of my website was running fine.  I upgraded MAMP from 3.5.2 to 4.4.1.  When I restarted MAMP it said it needed to upgrade the database, which I let it do.  Now when I try to start the website, it just spins at the localhost:6002 (for example) website address and the site will never launch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to chase down this problem.&lt;/p&gt;&#xA;" OwnerUserId="3660" LastActivityDate="2018-05-23T20:12:19.473" Title="Development system with MAMP won't run after MAMP upgrade?" Tags="&lt;mamp&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26278" PostTypeId="2" ParentId="26275" CreationDate="2018-05-23T19:26:57.397" Score="1" Body="&lt;p&gt;Upgrade instructions are found &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, although i wouldn't recommend it as an end user. You want to backup your database in case something goes wrong, change file paths/content, etc. Even if you have the access and knowledge to run the scripts, you should have a developer do this for you.&lt;/p&gt;&#xA;" OwnerUserId="8191" LastActivityDate="2018-05-23T19:26:57.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26279" PostTypeId="1" CreationDate="2018-05-23T19:54:06.790" Score="1" ViewCount="577" Body="&lt;p&gt;I am writing an importer that pulls from a separate MySQL database into Craft 3, and for the most part it's been quite simple to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I set myself up for some complication by having a Super Table field inside a Matrix field, which required some acrobatics to retrieve the field information to use when saving the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below &lt;em&gt;does&lt;/em&gt; work, but I wanted to check if it could be simpler, or if there are any obvious problems with this approach. It could also be helpful to someone else trying to achieve the same thing, as I didn't find anything similar when searching around.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get our &quot;quotes&quot; Super Table field (inside &quot;mediaBlocks&quot; matrix field)&#xA;if (empty($this-&amp;gt;superTableQuotesField)) {&#xA;    $mediaBlockField = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('mediaBlocks');&#xA;    $blockTypes = Craft::$app-&amp;gt;getMatrix()-&amp;gt;getBlockTypesByFieldId($mediaBlockField-&amp;gt;id);&#xA;    foreach($blockTypes as $blockType) {&#xA;        if ($blockType-&amp;gt;handle=='quotes') {&#xA;            $matrixFields = Craft::$app-&amp;gt;fields-&amp;gt;getFieldsByLayoutId($blockType-&amp;gt;fieldLayoutId);&#xA;            // Cache this for future use&#xA;            $this-&amp;gt;superTableQuotesField = SuperTable::$plugin-&amp;gt;service-&amp;gt;getBlockTypesByFieldId($matrixFields[0]-&amp;gt;id);&#xA;        }&#xA;    }&#xA;}&#xA;// For some reason we couldn't find the Super Table field&#xA;if (empty($this-&amp;gt;superTableQuotesField)) {&#xA;    Craft::warning('Could not find Super Table field for quotes in mediaBlocks!');&#xA;    return [];&#xA;}&#xA;&#xA;$blockType = $this-&amp;gt;superTableQuotesField[0]; // There will only ever be one SuperTable_BlockType&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... then a for loop with &lt;code&gt;$q++&lt;/code&gt; on each item from the other db:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$related_quotes['new'.$q] = [&#xA;    'type' =&amp;gt; $blockType-&amp;gt;id,&#xA;    'fields' =&amp;gt; [&#xA;        'quote'         =&amp;gt; $quote,&#xA;        'personName'    =&amp;gt; $personName,&#xA;        'personCompany' =&amp;gt; $personCompany,&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... and then if any found, merge with matrix array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!empty($related_quotes)) {&#xA;    $i++;&#xA;    $media_blocks = array_merge(['new'.$i =&amp;gt; [&#xA;        'type' =&amp;gt; 'quotes',&#xA;        'fields' =&amp;gt; [&#xA;            'quotes' =&amp;gt; $related_quotes,&#xA;        ]&#xA;    ]], $media_blocks);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For comparison, this is the (much simpler) code I'm using to find the &lt;code&gt;$blockType&lt;/code&gt; for a Super Table field when it's not an embedded field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get our Super Table field&#xA;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('quotes');&#xA;$blockTypes = SuperTable::$plugin-&amp;gt;service-&amp;gt;getBlockTypesByFieldId($field-&amp;gt;id);&#xA;$blockType = $blockTypes[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... but since this is inside a Matrix field, it doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a snapshot of what the field looks like in CP:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LzT4a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LzT4a.png&quot; alt=&quot;quotes super table field in mediaBlock matrix field&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6275" LastEditorUserId="6275" LastEditDate="2018-05-23T21:02:56.603" LastActivityDate="2018-05-23T21:02:56.603" Title="Finding Super Table field in matrix field" Tags="&lt;craft3&gt;&lt;plugin-supertable&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26281" PostTypeId="2" ParentId="26277" CreationDate="2018-05-23T20:12:19.473" Score="1" Body="&lt;p&gt;The ports were changed to 7888 and 8888 and I needed to set them back to what I was currently using.&lt;/p&gt;&#xA;" OwnerUserId="3660" LastActivityDate="2018-05-23T20:12:19.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26282" PostTypeId="1" AcceptedAnswerId="28941" CreationDate="2018-05-23T21:30:45.110" Score="1" ViewCount="56" Body="&lt;p&gt;I'm currently getting the following error when matching on an entry field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Offers Test: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: integer ~~ unknown LINE 3: WHERE &quot;id&quot; LIKE $1 ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. The SQL being executed was: SELECT &quot;structureId&quot; FROM &quot;sections&quot; WHERE &quot;id&quot; LIKE '%' LIMIT 1 - Schema.php:664&lt;/code&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have two channels one is called &quot;Brands&quot; and the other &quot;Offers&quot;. Offers has an Entry field which I'm trying to match on this field, see the below image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yi3PD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yi3PD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-26T21:06:21.157" Title="SQL Error (Feed Me) when matching entries" Tags="&lt;entries&gt;&lt;plugin-feedme&gt;&lt;postgresql&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26284" PostTypeId="2" ParentId="22701" CreationDate="2018-05-24T04:50:54.847" Score="1" Body="&lt;p&gt;CraftCMS doesn't come with such functionality by default. In Craft 2, we had some nice plugins but not available in Craft 3 so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can achieve this by Categories with &quot;Category Tree&quot; plugin which adds drag n drop to categories with full control from admin and its very easy to pull your category group at front-end.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categorytree.getTree() %}&#xA;{% for category in categories %}&#xA;  &amp;lt;ul&amp;gt;&#xA;     &amp;lt;li&amp;gt;{{ category.model.slug }}&amp;lt;/li&amp;gt;&#xA;     {% if category.children is defined %}&#xA;       &amp;lt;ul&amp;gt;&#xA;         {% for category in category.children %}&#xA;           &amp;lt;li&amp;gt;{{ category.model.slug }}&amp;lt;/li&amp;gt;&#xA;         {% endfor %}&#xA;      &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA; &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reference Link:&#xA;&lt;a href=&quot;https://github.com/pdaleramirez/category-tree&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pdaleramirez/category-tree&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7300" LastEditorUserId="7300" LastEditDate="2018-05-24T04:58:05.160" LastActivityDate="2018-05-24T04:58:05.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26285" PostTypeId="1" AcceptedAnswerId="26286" CreationDate="2018-05-24T06:44:07.640" Score="1" ViewCount="146" Body="&lt;p&gt;Updating a plugin from Craft 2 to Craft 3, so this logic used to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin has a field-type which is a button. When clicked, the button does stuff depending upon another field. That handle(ID) of that other field must be passed to the button's javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field's class seems to register the js correctly. When the page loads, it gives a popup with the correct info.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var startDateFieldHandle = 'fields-startDate';&#xA;alert( 'startDateFieldHandle = '+startDateFieldHandle);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Above that is&#xA;&lt;code&gt;&amp;lt;script src=&quot;http://f.dev/cpresources/6991e452/occurrencesField.js?v=1527142206&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&#xA;which pulls in the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(document).ready(function(){&#xA;    $(&quot;#fields-cal37_choose_dates_button&quot;).click( function() { &#xA;        alert('Clicked the button');&#xA;...&#xA;        var start_date = new Date( jQuery(&quot;#&quot;+startDateFieldHandle).val() );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The alerts happen in the correct sequence, but nevertheless my guess is that because &lt;code&gt;&amp;lt;script cpresources&amp;gt;&lt;/code&gt; bit occurs earlier on the page than where &lt;code&gt;startDateFieldHandle&lt;/code&gt; is set, that somehow it still isn't set when the button is clicked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see, using &lt;code&gt;Craft::$app-&amp;gt;View-&amp;gt;registerJs($js);&lt;/code&gt; that there is any way to say &quot;put this first.&quot;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It did used to work under Craft 2. Any tips? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;At present, I'm seeing in &lt;code&gt;occurrencesField.js&lt;/code&gt; that as soon as I reference the startDateFieldHandle variable in any way, such as &lt;code&gt;alert(startDateFieldHandle);&lt;/code&gt; the script quits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in the Firefox console, I'm getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery.Deferred exception: startDateFieldHandle is not defined @http://f.test/cpresources/6d6f7137/occurrencesField.js?v=1527518592:101:2&#xA;l/&amp;lt;/e@http://f.test/cpresources/61c13c0c/jquery.js?v=1527049453:1:29794&#xA;l/&amp;lt;/t&amp;lt;@http://f.test/cpresources/61c13c0c/jquery.js?v=1527049453:1:30109&#xA; undefined  jquery.js:1:31365&#xA;Double-instantiating a menu button on an element garnish.js:1:2512&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-05-28T14:46:40.060" LastActivityDate="2018-05-28T14:46:40.060" Title="Plugin field-type not getting javascript variable?" Tags="&lt;plugin-development&gt;&lt;javascript&gt;&lt;custom-fieldtype&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26286" PostTypeId="2" ParentId="26285" CreationDate="2018-05-24T07:20:41.410" Score="2" Body="&lt;p&gt;Keep in mind Craft parses the html of your field, it won't be used directly, thus the ID of your field can't be &lt;code&gt;&quot;#&quot;+startDateFieldHandle&lt;/code&gt;unless you ignored Crafts methods or modified it in another way. Your fields ID will be more like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id=&quot;fields-{{the id you specified}}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you should make sure you used the correct selector like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jQuery(&quot;#fields-&quot;+startDateFieldHandle)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;usually your order should be fine.. If you want to pass certain variables to Javascript you should do that in Twig because &lt;code&gt;Craft::$app-&amp;gt;View-&amp;gt;registerJs($js);&lt;/code&gt; won't pass variables in a global scope (you can't access them in your JS files in certain cases).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However you should avoid using those globals in Craft. It's better to create a custom &lt;code&gt;Garnish&lt;/code&gt; object for the logic&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;registerJs('new Garnish.MyAwesomeField(id, options)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will make sure everything is initialized and ready to use&#xA;Your js could look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Garnish.MyAwesomeField = Garnish.Base.extend(&#xA;    {&#xA;        $theOtherField: null,&#xA;        $field: null,&#xA;        options: {},&#xA;        init: function (fieldId, settings) {&#xA;            this.options = $.extend({}, Garnish.MyAwesomeField.defaults, settings);&#xA;            this.$theOtherField = $('#' + this.options.fieldSelector + this.options.theOtherFieldHandle);&#xA;            this.$field = $('#' + this.options.fieldSelector + fieldId);&#xA;            this.addListener(this.$field, 'click', $.proxy(this, 'clickEvent'));&#xA;        },&#xA;        clickEvent: function(){&#xA;            alert( this.$theOtherField.val() );&#xA;&#xA;        }&#xA;    },&#xA;    {&#xA;        defaults:{&#xA;            fieldSelector: 'fields-',&#xA;            otherFieldHandle: ''&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-24T07:32:58.583" LastActivityDate="2018-05-24T07:32:58.583" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="26288" PostTypeId="1" CreationDate="2018-05-24T15:14:55.447" Score="1" ViewCount="52" Body="&lt;pre&gt;&lt;code&gt;      {% set allCVs = entry.profileCv.all() %}&#xA;      {% set cvEntries = [] %}&#xA;&#xA;      {% for item in allCVs %}&#xA;        {% set fromMonth = item.fromMonth.value %}&#xA;        {% set fromYear = item.fromYear %}&#xA;        {% set toMonth = item.untilToday ? now|date('n') : item.toMonth.value %}&#xA;        {% set toYear = item.untilToday ? now|date('Y') : item.toYear %}&#xA;        {% set fromMonth = fromMonth|length == 1 ? '0' ~ fromMonth : fromMonth %}&#xA;        {% set toMonth = toMonth|length == 1 ? '0' ~ toMonth : toMonth %}&#xA;        {% set cvEntries = cvEntries|merge([{&#xA;        sortKey: toYear|default(fromYear) ~ '.' ~ toMonth|default(fromMonth) ~ '-' ~ fromYear ~ '.' ~ fromMonth,&#xA;        fromMonth: fromMonth,&#xA;        fromYear: fromYear,&#xA;        toMonth: toMonth,&#xA;        toYear: item.untilToday ? now|date('Y') : item.toYear,&#xA;        type: item.experienceType,&#xA;        label: item.label,&#xA;        untilToday: item.untilToday&#xA;        }]) %}&#xA;      {% endfor %}&#xA;&#xA;&#xA;      {% for item in cvEntries|supersort('sortAs', '{sortKey}') %}&#xA;        {% include 'profile/_profile-cv-row' with {&#xA;        from: {&#xA;        month: item.fromMonth,&#xA;        year: item.fromYear&#xA;        },&#xA;        to: {&#xA;        month: item.toMonth,&#xA;        year: item.toYear&#xA;        },&#xA;        untilToday: item.untilToday|default(0),&#xA;        type: item.experienceType,&#xA;        label: item.label,&#xA;        description: item.description,&#xA;        trainer: item.trainer,&#xA;        certificationTitle: item.certification.one().title is defined ? item.certification.one().title : 'title',&#xA;        certificationDescription: item.certification.one().certificationDescription is defined ? item.certification.one().certificationDescription : 'description',&#xA;        } %}&#xA;      {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what i want to do is to let supertsort sort my matrix blocks depending on the the data from &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;sortKey: toYear|default(fromYear) ~ '.' ~ toMonth|default(fromMonth) ~ '-' ~ fromYear ~ '.' ~ fromMonth,&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i get the errors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Key &quot;experienceType&quot; for array with keys &quot;sortKey, fromMonth, fromYear, toMonth, toYear, type, label, untilToday&quot; does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Key &quot;description&quot; for array with keys &quot;sortKey, fromMonth, fromYear, toMonth, toYear, type, label, untilToday&quot; does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Key &quot;trainer&quot; for array with keys &quot;sortKey, fromMonth, fromYear, toMonth, toYear, type, label, untilToday&quot; does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i delete all this 3 from my second loop, there is no error anymore, but of course missing data in the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea whats wrong?&lt;/p&gt;&#xA;" OwnerUserId="5847" LastActivityDate="2018-05-24T15:14:55.447" Title="SuperSort Matrix Block sort by Year / Month / Now Data" Tags="&lt;matrix&gt;&lt;blocks&gt;&lt;plugin-supersort&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26289" PostTypeId="1" CreationDate="2018-05-24T19:24:04.880" Score="1" ViewCount="440" Body="&lt;p&gt;As part of the new GDPR requirements in europe I've used cookiebot to show visitors what cookies we use on our site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's managed to show us what all but 1 cookie is used for. The cookie is called TS# and in their example stores this information:&#xA;0ei8sug22mj561h32e087mb5f2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cookiebot report doesn’t mention CraftSessionId which has this data:&#xA;p2q9d364sf2abu1mmd5vi8rd54&lt;/p&gt;&#xA;&#xA;&lt;p&gt;May be a coincidence but they're both 26 characters long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what the TS# cookie is used for, if it is a Craft CMS cookie?&lt;/p&gt;&#xA;" OwnerUserId="8414" LastActivityDate="2018-05-24T22:27:21.000" Title="Cookiebot finding TS# cookie" Tags="&lt;cookies&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26290" PostTypeId="1" CreationDate="2018-05-24T20:26:30.167" Score="1" ViewCount="633" Body="&lt;p&gt;Having installed Craft 3 using Composer, I'm attempting to run the Craft setup. Everytime I try, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Testing database credentials... failed: SQLSTATE[HY000] [1044] Access denied for user 'xxx'@'%' to database 'xxx'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where xxx is the correct username and db name.&#xA;Obviously, it can't connect to the database for some reason. I have also attempted the entire install manually without Composer and get the same issue with not connecting to the db. I have also tried manually editing the .env file with the correct details after installing with Composer. No joy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the error, I would expect the user to read: user 'xxx'@'localhost' given that I specified localhost as the server. I'm not sure why it specifies '@' instead but I suspect that is a clue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that port 3306 is used as the default TCP/IP port and that simply not specifying a port will not lead it to use Unix Socket instead. I raise this as I believe it may also be a clue to the issue - I can connect to the database using Querious (mysql database software) but only if I specify using Unix Socket instead of TCP/IP and leave the socket path blank (this using an SSH tunnel). My knowledge in this area is very shaky but I thought it might be worth mentioning in case it helps. I'm using Serverpilot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can shine a light?&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2018-05-25T19:06:32.777" Title="Problem connecting to MySQL db on installing Craft 3" Tags="&lt;database&gt;&lt;installation&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26291" PostTypeId="2" ParentId="15413" CreationDate="2018-05-24T21:05:26.230" Score="1" Body="&lt;p&gt;For anyone wanting to do this in Craft 3 there are a couple changes to the code you need to add to getSettingsHtml().&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'myImageSelectConfig' =&amp;gt; array(&#xA;            'id'                 =&amp;gt; 'myImage',&#xA;            'name'               =&amp;gt; 'myImage',&#xA;            'jsClass'            =&amp;gt; 'Craft.AssetSelectInput',&#xA;            'elementType'        =&amp;gt; 'craft\\elements\\Asset',&#xA;            'elements'           =&amp;gt; $this-&amp;gt;getSettings()['myImage'] &amp;amp;&amp;amp; count($this-&amp;gt;getSettings()['myImage']) ? [Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($this-&amp;gt;getSettings()['myImage'][0])] : null,&#xA;            'sources'            =&amp;gt; array('folder:2'),&#xA;            'criteria'           =&amp;gt; array('kind' =&amp;gt; array('image'), 'localeEnabled' =&amp;gt; null),&#xA;            'limit'              =&amp;gt; 1,&#xA;            'viewMode'           =&amp;gt; 'table',&#xA;            'selectionLabel'     =&amp;gt; Craft::t('app','Add image'),&#xA;        )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8415" LastActivityDate="2018-05-24T21:05:26.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26292" PostTypeId="2" ParentId="26274" CreationDate="2018-05-24T22:16:22.587" Score="2" Body="&lt;p&gt;It's impossible to give step-by-step instructions since every Craft site is unique and built differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front-end templates for your site live in the &lt;code&gt;craft/templates&lt;/code&gt; folder on your server.  You can change the look and layout of your site by editing those files, which are a combination of Twig and HTML.  Thanks like JavaScript, CSS files, images and assets will typically live in your site's public HTML folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a list of learning resources to help get you up to speed on Craft and some links at the end in case you need help finding a developer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Craft Official Docs &amp;amp; Support&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS docs&lt;/a&gt; - The official Craft CMS documentation&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Slack group&lt;/a&gt; - The Craft development team is in Slack every day along with 6,000+ other Craft developers and users from all over the world.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com&quot;&gt;Craft Stack Exchange&lt;/a&gt; - You obviously found this one, but it is generally the best place to ask &quot;how do I&quot; type questions.&lt;/li&gt;&#xA;&lt;li&gt;Official support email at support@craftcms.com&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Learn Craft&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://mijingo.com/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mijingo Craft Tutorials&lt;/a&gt; - Mijingo is our official education and training partner. They have a number of excellent free and paid resources for Craft CMS &amp;amp; Craft Commerce. Ryan Irelan, Mijingo's founder, also offers customized training online or on-site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://tutsplus.com/courses/search/Craft+CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tuts+ Tutorials&lt;/a&gt; - Not official but very good and low cost (most are $9).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Professional Services&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/partners&quot; rel=&quot;nofollow noreferrer&quot;&gt;Partner Match&lt;/a&gt; - If you need implementation help for Craft, we can match you with one of our Craft Service Partners or Craft Experts. We work with enterprise level partners, freelancers, and everyone in between.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-24T22:16:22.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26293" PostTypeId="2" ParentId="26275" CreationDate="2018-05-24T22:25:43.373" Score="1" Body="&lt;p&gt;There's a support article here worth reading that discusses the things you should consider before updating to Craft 3, especially if you are an end user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/support/should-we-update-to-craft-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/should-we-update-to-craft-3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-24T22:25:43.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26294" PostTypeId="2" ParentId="26289" CreationDate="2018-05-24T22:27:21.000" Score="1" Body="&lt;p&gt;Craft doesn't natively set a cookie named &lt;code&gt;TS#&lt;/code&gt;, so it's either coming from something in your front-end templates or possibly from a plugin you've got installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read about the &lt;code&gt;CraftSessionId&lt;/code&gt; cookie and all other cookies that Craft uses by default here: &lt;a href=&quot;https://craftcms.com/support/how-does-craft-use-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/how-does-craft-use-cookies&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-24T22:27:21.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26295" PostTypeId="2" ParentId="26159" CreationDate="2018-05-24T23:05:14.067" Score="2" Body="&lt;p&gt;Yes simple use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{variant.price}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{variant.salePrice}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-05-24T23:05:14.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26296" PostTypeId="2" ParentId="26135" CreationDate="2018-05-24T23:07:25.750" Score="1" Body="&lt;p&gt;Yes simply add a sale with no product conditions which will apply to all products. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-05-24T23:07:25.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26297" PostTypeId="1" AcceptedAnswerId="26299" CreationDate="2018-05-25T10:26:20.033" Score="1" ViewCount="412" Body="&lt;p&gt;I have installed the Calendar plugin and I'd like to search across event entries from this plugin and from channel/section entries across the base Craft 3 site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am getting the usual Limit-Array error when trying to paginate the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a method for paginating multiple search results in Craft 3? I haven't come across a way to do this in any current questions or Craft 3 Docs.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-05-25T12:42:58.160" Title="Paginate search results after combining sections in Craft 3" Tags="&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26299" PostTypeId="2" ParentId="26297" CreationDate="2018-05-25T12:42:58.160" Score="2" Body="&lt;p&gt;I doubt this is possible in Twig by default because you have two different Element types, thus you'll need to different instances of the ElementQuery to populate all models correctly. I think you'll need to create your own pagination. That being said &lt;code&gt;Element::find()-&amp;gt;all()&lt;/code&gt; will throw an error &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Cannot instantiate abstract class craft\base\Element&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus you'll have to Query for your elements in your own&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get all possible element ids&#xA;$sectionId = X;&#xA;$query = (new Query())&#xA;    -&amp;gt;select('elements.id')&#xA;    -&amp;gt;from('{{%elements}}')&#xA;    -&amp;gt;leftJoin('{{%elements_sites}}', 'elements_sites.elementId = elements.id')&#xA;    -&amp;gt;leftJoin('{{%entries}}', 'entries.id = elements.id')&#xA;    -&amp;gt;where(new OrCondition([&#xA;        ['=', 'entries.sectionId', $sectionId], &amp;lt;-- your section Id&#xA;        ['is', 'entries.sectionId', null],&#xA;    ]))&#xA;    -&amp;gt;andWhere(new OrCondition([&#xA;        ['=', 'elements.type', \craft\elements\Entry::class],&#xA;        ['=', 'elements.type', YourCalenderClassComesHere],&#xA;    ]))&#xA;    -&amp;gt;andWhere(['elements_sites.siteId' =&amp;gt; 1])&#xA;    -&amp;gt;limit(10)&#xA;    -&amp;gt;offset(0)&#xA;    -&amp;gt;column();&#xA;&#xA;// populate entry by Id&#xA;foreach ($query as $elementId){&#xA;    $element = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($elementId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-25T12:42:58.160" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26300" PostTypeId="1" AcceptedAnswerId="26305" CreationDate="2018-05-25T15:18:12.970" Score="1" ViewCount="398" Body="&lt;p&gt;I am building a plugin and in that plugin I am trying to grab all entries including disabled ones.  My structure is a single entry as the parent and then it will have multiple levels of children.  Currently I am grabbing the main parent with this code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%   set events = craft.entries.section('events').first() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I am doing nested for loops to work my way down such as the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for event in events.children() %}&#xA;   {% for day in event.children %}&#xA;      {% for session in day.children() %}&#xA;      {% endfor %}&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works just fine but the issue is it will not return the disabled entries.  I have noticed the status(null) when you are doing a find but I have not figured out a way to do it with the for loops.  I intend to keep the relationship structure in the ui so I am not looking to just get a random ordered list of all entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated and I am open if there is a more efficient solution.&lt;/p&gt;&#xA;" OwnerUserId="8417" LastActivityDate="2018-05-25T17:27:16.303" Title="Get all entries for a structure section including disabled" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26301" PostTypeId="2" ParentId="26117" CreationDate="2018-05-25T15:51:33.730" Score="1" Body="&lt;p&gt;Thank you very much, Robin and Clive. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I think there are better answers than what I have written here, such as &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10403/multi-site-multi-domain?noredirect=1&amp;amp;lq=1&quot;&gt;this&lt;/a&gt; but they didn't appear to me after writing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it might benefit anyone, it's clear there are many ways to do this. My setup does not use Craft's &quot;multi-site&quot; capabilities, but has three urls pointing to the same index.php. It functions more or less as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Folder Structure&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft/config/sitedata.php&#xA;craft/templates/_genericPageTemplate.html&#xA;               /mifc/_navigation.html&#xA;                    /local.css&#xA;               /migr/_navigation.html&#xA;                    /local.css&#xA;               /miwy/_navigation.html&#xA;                    /local.css&#xA;public_html/index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Main Page Template&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now starts with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set domain = craft.app.request.ServerName %}  &#xA;{% set siteUrl = '//' ~ domain ~ '/' %}  &#xA;{% set env = getenv('ENVIRONMENT') %}  &#xA;{% set sitesData = craft.app.config.getConfigFromFile('sitedata')[env] %}  &#xA;{% set siteData = sitesData[domain] %}  &#xA;{% set categoriesToDisplay = siteData.nativeCategoryIds|merge(siteData.sharedCategoryIds) %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and later brings in the css and navigation depending on site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel='stylesheet' id='localCss'  href='/{{siteData.handle}}/local.css' type='text/css' media='all' /&amp;gt;&#xA;...&#xA;{% include siteData.handle~'/_navigation.html' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Config File&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;{% set sitesData = craft.app.config.getConfigFromFile('sitedata')[env] %}&lt;/code&gt;&lt;br&gt;&#xA;the page template references &lt;code&gt;craft/config/sitedata.php&lt;/code&gt; which contains stuff specific to each site, both for production and development:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;/**&#xA; * Return an array indexed by locale code&#xA; */&#xA;&#xA;return [&#xA;   'production' =&amp;gt; [&#xA;        'site1.org' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'mifc',&#xA;            'nameInMenus'           =&amp;gt; 'Fort Collins',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Fort Collins Meditation &amp;amp; Modern Buddhism',&#xA;            'url'                   =&amp;gt; 'site1.org',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Fort Collins and the Surrounding Areas',&#xA;            'topNativeCategoryIds'  =&amp;gt; [194,195,220],&#xA;            'nativeCategoryIds'     =&amp;gt; [194,198,10,11,14,196,7,1775,2476,5,4,9,6,8,267,2073,195,63,66,67,20,70,71,220,12,221,222,1688,223],&#xA;            'topSharedCategoryIds'  =&amp;gt; [13,60],&#xA;            'sharedCategoryIds'     =&amp;gt; [13,60],&#xA;        ],&#xA;        'site2.org' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'migr',&#xA;            'nameInMenus'           =&amp;gt; 'Greeley',&#xA;            'url'                   =&amp;gt; 'site2.org',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Greeley Meditation &amp;amp; Modern Buddhism',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism in Greeley',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Greeley',&#xA;            'topNativeCategoryIds'  =&amp;gt; [197],&#xA;            'nativeCategoryIds'     =&amp;gt; [197,3112,58,61,2940,59,62,60],&#xA;            'topSharedCategoryIds'  =&amp;gt; [198,67,13],&#xA;            'sharedCategoryIds'     =&amp;gt; [198,10,11,14,67,13],&#xA;            'eventsCategoryIds'     =&amp;gt; [60,198,10,11,14,67,13],&#xA;        ],&#xA;        'site3.org' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'miwy',&#xA;            'nameInMenus'           =&amp;gt; 'Wyoming',&#xA;            'url'                   =&amp;gt; 'site3.org',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Wyoming Meditation &amp;amp; Modern Buddhism',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism in Wyoming',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Wyoming',&#xA;            'topNativeCategoryIds'  =&amp;gt; [3151],&#xA;            'nativeCategoryIds'     =&amp;gt; [3151,2969,65,64,68,69,72],&#xA;            'topSharedCategoryIds'  =&amp;gt; [198,60,13],&#xA;            'sharedCategoryIds'     =&amp;gt; [198,10,11,14,60,13],&#xA;            'eventsCategoryIds'     =&amp;gt; [60,198,10,11,14,67,13],&#xA;        ],&#xA;    ],&#xA;    'dev' =&amp;gt; [&#xA;        'f.dev' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'mifc',&#xA;            'nameInMenus'           =&amp;gt; 'Fort Collins',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Fort Collins Meditation &amp;amp; Modern Buddhism',&#xA;            'url'                   =&amp;gt; 'f.dev',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Fort Collins and the Surrounding Areas',&#xA;            'topNativeCategoryIds'  =&amp;gt; [194,195,220],&#xA;            'nativeCategoryIds'     =&amp;gt; [194,198,10,11,14,196,7,1775,2476,5,4,9,6,8,267,2073,195,63,66,67,20,70,71,220,12,221,222,1688,223],&#xA;            'topSharedCategoryIds'  =&amp;gt; [13,60],&#xA;            'sharedCategoryIds'     =&amp;gt; [13,60],&#xA;        ],&#xA;        'g.dev' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'migr',&#xA;            'nameInMenus'           =&amp;gt; 'Greeley',&#xA;            'url'                   =&amp;gt; 'g.dev',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Greeley Meditation &amp;amp; Modern Buddhism',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism in Greeley',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Greeley',&#xA;            'topNativeCategoryIds'  =&amp;gt; [197],&#xA;            'nativeCategoryIds'     =&amp;gt; [197,3112,58,61,2940,59,62,60],&#xA;            'topSharedCategoryIds'  =&amp;gt; [198,67,13],&#xA;            'sharedCategoryIds'     =&amp;gt; [198,10,11,14,67,13],&#xA;            'eventsCategoryIds'     =&amp;gt; [60,198,10,11,14,67,13],&#xA;        ],&#xA;        'w.dev' =&amp;gt; [&#xA;            'live'                  =&amp;gt; true,&#xA;            'handle'                =&amp;gt; 'miwy',&#xA;            'nameInMenus'           =&amp;gt; 'Wyoming',&#xA;            'url'                   =&amp;gt; 'w.dev',&#xA;            'siteTitleSuffix'       =&amp;gt; 'Wyoming Meditation &amp;amp; Modern Buddhism',&#xA;            'titleMainBig'          =&amp;gt; 'Meditation &amp;amp; Buddhism in Wyoming',&#xA;            'titleSmallerSecondLine'=&amp;gt; 'Heruka Buddhist Center in Wyoming',&#xA;            'topNativeCategoryIds'  =&amp;gt; [3151],&#xA;            'nativeCategoryIds'     =&amp;gt; [3151,2969,65,64,68,69,72],&#xA;            'topSharedCategoryIds'  =&amp;gt; [198,60,13],&#xA;            'sharedCategoryIds'     =&amp;gt; [198,10,11,14,60,13],&#xA;            'eventsCategoryIds'     =&amp;gt; [60,198,10,11,14,67,13],&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Feel free to point out any mistakes, etc, in this way of doing things.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-05-25T16:04:42.003" LastActivityDate="2018-05-25T16:04:42.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26302" PostTypeId="1" CreationDate="2018-05-25T16:37:08.350" Score="1" ViewCount="94" Body="&lt;p&gt;I'm attempting to query for all assets associated with a specific form submission like this, where 'submission' has been set based on a URL parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in submission.fieldMetadata %}&#xA;    {% if field.type == &quot;file&quot; %}&#xA;        {% set assetId = attribute(submission, field.handle) %}&#xA;        {% set assets = craft.assets.id(assetId).all() %}&#xA;           {% for asset in assets %}&#xA;                {% if asset %}&#xA;                    {% if asset.kind == &quot;image&quot; %}&#xA;                        &amp;lt;img src='{{ asset.url }}'&amp;gt;&#xA;                    {% endif %}&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code returns all site assets rather than just the assets associated with the submission. All other fields associated with the submission are returned correctly. Is this a bug or is my template incorrect?&lt;/p&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2018-06-30T14:24:56.730" Title="Solspace Freeform query for submission assets returns all site assets" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26305" PostTypeId="2" ParentId="26300" CreationDate="2018-05-25T17:27:16.303" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').first() %} &#xA;{% for event in events.children().status(null).find() %}&#xA;   {% for day in event.children().status(null).find() %}&#xA;      {% for session in day.children().status(null).find() %}&#xA;      {% endfor %}&#xA;   {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;event.children()&lt;/code&gt; does not return an array of elements but an object of type &lt;code&gt;ElementCriteriaModel&lt;/code&gt; the same as &lt;code&gt;craft.entries&lt;/code&gt; thus you can append whatever you want until you execute it with &lt;code&gt;find()&lt;/code&gt; or &lt;code&gt;first()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-25T17:27:16.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26306" PostTypeId="2" ParentId="26290" CreationDate="2018-05-25T19:06:32.777" Score="1" Body="&lt;p&gt;Thanks for your help Brad. After going round and round in circles, deleting the database and setting up a new one sorted it. Ah the mysteries!&lt;/p&gt;&#xA;" OwnerUserId="4060" LastActivityDate="2018-05-25T19:06:32.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26307" PostTypeId="1" AcceptedAnswerId="26311" CreationDate="2018-05-25T21:48:43.447" Score="1" ViewCount="150" Body="&lt;p&gt;To be more specific I would like to add an &quot;update cart&quot; button so that the visitor can adjust the quantity of multiple cart items without having to click on &quot;update&quot; for each cart item.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-27T00:00:35.420" Title="Is it possible to update multiple cart items?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26308" PostTypeId="1" CreationDate="2018-05-25T21:51:38.787" Score="4" ViewCount="1115" Body="&lt;p&gt;In Craft 2, services were auto-loaded when using the &lt;code&gt;craft()-&amp;gt;plugin_serviceName-&amp;gt;myMethodName()&lt;/code&gt; signature, but it seems like there's a catch in Craft 3, when using the new &lt;code&gt;MyPlugin::getInstance()-&amp;gt;myServiceName-&amp;gt;myMethod()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a business-logic plugin using a local &lt;code&gt;path&lt;/code&gt; repository in my project's &lt;code&gt;composer.json&lt;/code&gt;, and there are a rash of problems that come of this, mainly to do with creating + renaming services, as the service locator seems to cache them pretty aggressively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I ensure these changes are picked up right away?&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2019-12-05T14:57:04.933" Title="How do I &quot;register&quot; a service in a Craft 3 plugin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;php&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26309" PostTypeId="2" ParentId="26308" CreationDate="2018-05-25T21:51:38.787" Score="5" Body="&lt;p&gt;It turns out there's a handy method for manually registering your services, or in Yii2 parlance, just &quot;components&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace example\myplugin;&#xA;&#xA;use example\myplugin\services\Example as ExampleService;&#xA;&#xA;use Craft;&#xA;use craft\base\Plugin as BasePlugin;&#xA;&#xA;class MyPlugin extends BasePlugin&#xA;{&#xA;    public static $plugin;&#xA;&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;        $this-&amp;gt;setComponents([&#xA;            'example' =&amp;gt; ExampleService::class&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, somewhere else in your plugin, your service is immediately available as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::$plugin-&amp;gt;example-&amp;gt;myMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…where &lt;code&gt;example&lt;/code&gt; is the key in the hash of classes you passed to &lt;code&gt;$this-&amp;gt;setComponents()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-05-25T21:51:38.787" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26311" PostTypeId="2" ParentId="26307" CreationDate="2018-05-26T02:56:22.407" Score="1" Body="&lt;p&gt;Not at the moment, you can submit a feature request for the feature here: &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-05-26T02:56:22.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26312" PostTypeId="1" CreationDate="2018-05-26T08:01:06.033" Score="1" ViewCount="345" Body="&lt;p&gt;I can't backup database, the log says :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[error][yii\base\Exception] yii\base\Exception: Could not create&#xA;  backup: The shell command &quot;mysqldump {{...blablabla...}} failed with&#xA;  exit code -1. in&#xA;  /home/user/craft/vendor/craftcms/cms/src/controllers/UtilitiesController.php:38&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any ideas what error -1 means ?&lt;/p&gt;&#xA;" OwnerUserId="7564" LastEditorUserId="45" LastEditDate="2018-05-26T16:56:31.333" LastActivityDate="2018-05-26T16:56:31.333" Title="Craft 3 : Can't backup database (&quot;failed with exit code -1&quot;)" Tags="&lt;craft3&gt;&lt;database&gt;&lt;back-up&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26313" PostTypeId="1" AcceptedAnswerId="26314" CreationDate="2018-05-26T17:16:28.983" Score="1" ViewCount="85" Body="&lt;p&gt;I'm looking to only display the top level parent categories on my Template, but unfortunately, everything I try seems to error out and still display all of the children categories as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set categories = craft.categories.group('discounts') %}&#xA;        {% for category in categories.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-05-26T18:56:26.387" Title="Only display the first tier of categories" Tags="&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26314" PostTypeId="2" ParentId="26313" CreationDate="2018-05-26T18:56:26.387" Score="2" Body="&lt;p&gt;You can filter &lt;code&gt;elements&lt;/code&gt; based on their hierarchy level with the &lt;code&gt;level&lt;/code&gt; attribute&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories.level(1).all() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will only show top tier categories&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in categories.level(2).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;only all the first tier children of all first tier categories (so tier 2) and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Additional note&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also search for descendants elements&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;element.getDescendants(1) //&amp;lt;-- include the level based on the parents level&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the parameter  &lt;code&gt;1&lt;/code&gt; it is the same as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;element.getChildren()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-05-26T18:56:26.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26315" PostTypeId="2" ParentId="26266" CreationDate="2018-05-26T23:06:18.773" Score="2" Body="&lt;p&gt;There are multiple ways to achieve your goal, I think the most elegant one is to overwrite the default route &lt;code&gt;/users&lt;/code&gt; with your custom one and replace the &lt;code&gt;elementType&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things you need to do&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change the default route to your template&lt;/li&gt;&#xA;&lt;li&gt;Copy the default template and change it's element type&lt;/li&gt;&#xA;&lt;li&gt;Create a custom element type that extends &lt;code&gt;craft/elements/User&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can change the route of all &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#plugin-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;navigation&lt;/a&gt;  bar items (modifyCpNav)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Cp::class, &#xA;    Cp::EVENT_REGISTER_CP_NAV_ITEMS, &#xA;    function(RegisterCpNavItemsEvent $event){&#xA;        // the 4th element is the &quot;User&quot;, you can change the URL to your&#xA;        // custom template instead of the default template&#xA;        // I suggest you to loop all `navItems` and find &#xA;        // the correct user instead of assuming it's the 4th&#xA;        // Craft::dd($event-&amp;gt;navItems);&#xA;        $event-&amp;gt;navItems[4]['url'] = 'path/to/template/user';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then just copy the Craft &lt;code&gt;templates/user/index&lt;/code&gt; template in your plugin to create an &lt;a href=&quot;https://docs.craftcms.com/v3/element-types.html#index-page&quot; rel=&quot;nofollow noreferrer&quot;&gt;index page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if CraftEdition != CraftPro %}&#xA;    {% exit 404 %}&#xA;{% endif %}&#xA;&#xA;{% requirePermission 'editUsers' %}&#xA;&#xA;{% extends &quot;_layouts/elementindex&quot; %}&#xA;{% set title = &quot;Users&quot;|t('app') %}&#xA;// changes start&#xA;// replace the elementType with your custom element type&#xA;{% set elementType = 'prefix\\namespace\\elements\\User' %}&#xA;// changes end&#xA;{% block actionButton %}&#xA;    {% if currentUser.can('registerUsers') %}&#xA;        &amp;lt;a class=&quot;btn submit add icon&quot; href=&quot;{{ url('users/new') }}&quot;&amp;gt;{{ &quot;New user&quot;|t('app') }}&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your &lt;code&gt;src/elements&lt;/code&gt; folder create a new User class to overwrite the &lt;a href=&quot;https://docs.craftcms.com/v3/element-types.html#sources&quot; rel=&quot;nofollow noreferrer&quot;&gt;sources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class User extends \craft\elements\User{ //&amp;lt;-- extend the default User element&#xA;&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    protected static function defineSources(string $context = null): array&#xA;    {&#xA;        $sources = [&#xA;            [&#xA;                'key' =&amp;gt; '*',&#xA;                'label' =&amp;gt; Craft::t('app', 'All users'),&#xA;                'criteria' =&amp;gt; ['status' =&amp;gt; null],&#xA;                'hasThumbs' =&amp;gt; true&#xA;            ]&#xA;        ];&#xA;&#xA;        // Overwrite the sources / usergroups...&#xA;        // usually Craft will search for usergroups at this place..&#xA;        // just leave it empty, so you'll only see the &quot;default&quot; group&#xA;&#xA;        return $sources;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't forget to &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#element-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;register&lt;/a&gt; your element&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL/DR&lt;/strong&gt;&lt;br&gt;&#xA;You could as well just hide the other sources via CSS/Javascript - but I would not suggest it, since everyone is able to see the other groups with minor Javascript skills&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-05-27T00:47:33.187" LastActivityDate="2018-05-27T00:47:33.187" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26316" PostTypeId="2" ParentId="26307" CreationDate="2018-05-27T00:00:35.420" Score="1" Body="&lt;p&gt;If you're still using Commerce V1 - MultiAdd can do this - &lt;a href=&quot;https://github.com/verbb/multi-add&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/multi-add&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-05-27T00:00:35.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26318" PostTypeId="2" ParentId="23831" CreationDate="2018-05-28T09:47:37.333" Score="1" Body="&lt;p&gt;For Commerce 1, you may use the &lt;a href=&quot;https://superbig.co/plugins/refund&quot; rel=&quot;nofollow noreferrer&quot;&gt;Refund&lt;/a&gt; plugin with Stripe and Authorize.net.&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2018-05-28T09:47:37.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26320" PostTypeId="1" CreationDate="2018-05-28T22:55:48.907" Score="1" ViewCount="582" Body="&lt;p&gt;I am looking for the best way of installing a fresh craft 3 project and making it a git repo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 1:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first creating an empty new git repo&lt;/li&gt;&#xA;&lt;li&gt;clone the empty repo to my pc using sourcetree&lt;/li&gt;&#xA;&lt;li&gt;try and install craft through commandline in that folder&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The issue is that craft says the folder isn't empty (which is true because there is a hidden git file inside of the folder of course) and I want craft to be installed in the root of that folder and not in a subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 2:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I installed a local craft project using command line with success&lt;/li&gt;&#xA;&lt;li&gt;then I created a remote repo&lt;/li&gt;&#xA;&lt;li&gt;then used git commands (&lt;a href=&quot;https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/&lt;/a&gt;) to push the project to the remote repo&lt;/li&gt;&#xA;&lt;li&gt;If I then clone the repo to my pc I can't get craft to work, I adjusted the env file and ran composer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have been messing around so long just to get the craft project up and running in combination with a repo that I need help. I have managed this before but with a lot of detour so I am guessing there is a much better and faster way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain what the best practices are for creating a craft project in a repo?&lt;/p&gt;&#xA;" OwnerUserId="8423" LastEditorUserId="4246" LastEditDate="2019-04-01T05:27:17.247" LastActivityDate="2019-04-01T05:27:17.247" Title="Craft 3 installation in git repository" Tags="&lt;craft3&gt;&lt;install&gt;&lt;setup&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26321" PostTypeId="2" ParentId="1311" CreationDate="2018-05-29T02:34:35.093" Score="1" Body="&lt;p&gt;I found another workaround which works quite well: I create a user group where users can only edit their entries.&lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2018-05-29T02:34:35.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26322" PostTypeId="2" ParentId="19871" CreationDate="2018-05-29T02:53:55.630" Score="3" Body="&lt;p&gt;I'd be inclined to use the public methods for this.&#xA;$user-&gt;detail-&gt;getRawContent();&#xA;or&#xA;$user-&gt;detail-&gt;getParsedContent();&#xA;etc.&lt;/p&gt;&#xA;" OwnerUserId="4616" LastActivityDate="2018-05-29T02:53:55.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26324" PostTypeId="1" AcceptedAnswerId="26333" CreationDate="2018-05-29T14:17:10.547" Score="1" ViewCount="595" Body="&lt;p&gt;I need to create a hidden form field and populate the previous and current URL can someone tell me how I can do that in Craft.&lt;/p&gt;&#xA;" OwnerUserId="8353" LastEditorUserId="57" LastEditDate="2018-05-30T00:38:29.087" LastActivityDate="2018-05-30T00:43:16.487" Title="How I can capture previous and current URL to a hidden form field" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26325" PostTypeId="1" AcceptedAnswerId="26367" CreationDate="2018-05-29T15:31:11.283" Score="1" ViewCount="182" Body="&lt;p&gt;I am moving a client site from my staging VPS to my clients preferred hosting. All of Crafts requirements check out just fine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP Version 7.0.29&#xA;MySQL Version   10.2.12-MariaDB-log&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when going to either admin or main homepage I get the following warning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Wrong parameter count for class_alias()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file it is pointing to is &lt;code&gt;/craft/app/vendor/twig/twig/lib/Twig/LoaderInterface.php(57)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I possibly missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My VPS has the following settings:&#xA;PHP Version 5.6.36&#xA;MySQL Version   5.6.39&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2018-05-31T19:24:38.397" Title="Receiving PHP Warning on move to Production" Tags="&lt;php&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26326" PostTypeId="1" CreationDate="2018-05-29T16:40:46.437" Score="3" ViewCount="168" Body="&lt;p&gt;So I've got this which accurately gives me the desired relation block within my matrix, but how do I actually get the Entry object from a relation field?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$project = Entry::find()-&amp;gt;id($projectId)-&amp;gt;one();&#xA;&#xA;foreach ($project-&amp;gt;location as $locations) {&#xA;        if ($locations-&amp;gt;getType()-&amp;gt;name === 'Locations') {&#xA;            // Grab a building from the block. &#xA;            // Right now this just returns the relation table ID, I'd like the actual Entry object with it's attributes.&#xA;            $buildings = $locations-&amp;gt;buildings;&#xA;        }&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8425" LastActivityDate="2018-08-28T06:00:55.020" Title="Get the related entry from an Entries field in a Matrix block within a plugin craft 3" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26327" PostTypeId="1" CreationDate="2018-05-29T16:57:35.000" Score="2" ViewCount="206" Body="&lt;p&gt;I've got a matrix block that most pages on my site are built from, and one of its blocks is a Solspace Freeform form field. I want to be able to cache the entire output of the matrix, but that makes Freeform see all form submissions as spam, since their hash gets cached too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried &lt;a href=&quot;https://github.com/benjamminf/craft-nocache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/benjamminf/craft-nocache&lt;/a&gt; but couldn't get that to work as the whole matrix (including the form) gets cached outside of the &lt;code&gt;{% nocache %}&lt;/code&gt; tag. So then I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyIncludesForm = entry.body.type('form') | length &amp;gt; 0 %}&#xA;{% cache globally using key craft.request.path unless bodyIncludesForm %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... which seems to work, but that &lt;code&gt;entry.body.type('form')&lt;/code&gt; call adds 32 queries which kind of defies the point of the caching!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to get round this, without turning off Freeform's spam check?&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2018-05-29T16:57:35.000" Title="Caching matrix that contains Freeform field" Tags="&lt;cache&gt;&lt;plugin-freeform&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26328" PostTypeId="1" CreationDate="2018-05-29T19:20:47.670" Score="1" ViewCount="20" Body="&lt;p&gt;We've been working on a sneaker shop and the product overview page is only showing the products that are in stock. Now the client also wants to show some selected products on the overview even if there is no stock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show only the products with stock we've added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hasVariant: {&#xA;    hasStock: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to select products that have stock and products that don't have stock but where &lt;code&gt;showWhenNoStock&lt;/code&gt; is true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;May be good to know &lt;code&gt;showWhenNoStock&lt;/code&gt; is a field on the main product not the variant.&lt;/p&gt;&#xA;" OwnerUserId="5222" LastEditorUserId="57" LastEditDate="2018-05-30T00:45:29.277" LastActivityDate="2018-05-30T00:45:29.277" Title="Select products that have stock and products where showWhenNoStock is true" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26330" PostTypeId="1" AcceptedAnswerId="26335" CreationDate="2018-05-29T20:26:34.220" Score="2" ViewCount="136" Body="&lt;p&gt;I'm reading the docs for the Sprout Form plugin and looking at how I can custom classes to the actual form elements i.e. &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; etc. I can see that there is the rendering options route, but I was hoping to achieve this on a global basis, rather than having to reference individual field handles due to multiple forms. I can add some custom classes through the custom template method, but it still doesn't give you full access to the actual form elements themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have form styling already, but it relies on CSS classes on the relative form elements, I can add CSS rules that also target the Sprout Forms HTML but I'd rather keep the class stuff consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I need to write my own plugin for this? I've looked at the API and while it shows how to hook into the various field types. All seem to require using &lt;code&gt;$renderingOptions&lt;/code&gt;. It looks like I could achieve this if I was outputting each field with &lt;code&gt;displayField()&lt;/code&gt; manually, but I'm attempting to make this as user friendly as possible and trying to keep it in templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because its Craft 2, I don't believe I can individually override any of the field types with my templates/_sproutforms/ folder, though in Craft 3 this does appear possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I was just to write my own plugin that hooked into the various fields such as &lt;code&gt;SproutFormsPlainTextField&lt;/code&gt; and added my own CSS class(es), would this be the best way? Testing this out, I modified the &lt;code&gt;SproutFormsPlainTextField.php&lt;/code&gt; within the integrations folder at &lt;code&gt;sproutforms\integrations\sproutforms\fields&lt;/code&gt; and added my own array for the &lt;code&gt;class&lt;/code&gt; and it does work, but I'd imagine I'd need to do this as my own plugin, rather than modifying sproutforms directly. What's the best way to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;/**&#xA; * Class SproutFormsPlainTextField&#xA; *&#xA; * @package Craft&#xA; */&#xA;class SproutFormsPlainTextField extends SproutFormsBaseField&#xA;{&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getType()&#xA;    {&#xA;        return 'PlainText';&#xA;    }&#xA;&#xA;    /**&#xA;     * @param FieldModel $field&#xA;     * @param mixed      $value&#xA;     * @param array      $settings&#xA;     * @param array      $renderingOptions&#xA;     *&#xA;     * @return \Twig_Markup&#xA;     */&#xA;    public function getInputHtml($field, $value, $settings, array $renderingOptions = null)&#xA;    {&#xA;        // My own CSS classes required for CSS styling&#xA;        $renderingOptions = array(&#xA;            'class' =&amp;gt; 'input text'&#xA;        );&#xA;&#xA;        $this-&amp;gt;beginRendering();&#xA;&#xA;        $rendered = craft()-&amp;gt;templates-&amp;gt;render(&#xA;            'plaintext/input',&#xA;            array(&#xA;                'name'             =&amp;gt; $field-&amp;gt;handle,&#xA;                'value'            =&amp;gt; $value,&#xA;                'field'            =&amp;gt; $field,&#xA;                'settings'         =&amp;gt; $settings,&#xA;                'renderingOptions' =&amp;gt; $renderingOptions&#xA;            )&#xA;        );&#xA;&#xA;        $this-&amp;gt;endRendering();&#xA;&#xA;        return TemplateHelper::getRaw($rendered);&#xA;    }&#xA;&#xA;    /**&#xA;     * @return string&#xA;     */&#xA;    public function getTemplatesPath()&#xA;    {&#xA;        return craft()-&amp;gt;path-&amp;gt;getPluginsPath() . 'sproutforms/templates/_components/fields/';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would this be the best way?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-05-29T21:41:25.853" LastActivityDate="2018-05-30T03:54:31.997" Title="Craft 2 - Adding custom CSS classes to Sprout Form fields on a global basis" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26331" PostTypeId="1" CreationDate="2018-05-29T22:53:27.313" Score="1" ViewCount="22" Body="&lt;p&gt;I am running an app project, which consists of three &quot;components&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The app itself&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Laravel API serving the data for the app&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Marketing website based on Craft CMS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I plan to extend the Craft CMS website with landing pages for all records of the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example there should be a new url like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://example.com/more-about-{slug}&#xA;https://example.com/more-about-tarifa&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Craft system should not know about the available slugs / landing pages. Craft should only take this slug, call the API to fetch the information (content, images, ...) and show it in a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone of you give me some advice how you would realize this?&lt;/p&gt;&#xA;" OwnerUserId="8428" LastEditorUserId="57" LastEditDate="2018-05-30T00:48:08.453" LastActivityDate="2018-05-30T00:48:08.453" Title="How to structure such a plugin?" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26332" PostTypeId="2" ParentId="25846" CreationDate="2018-05-30T00:30:21.957" Score="1" Body="&lt;p&gt;The original poster solved this in a follow-up comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After checking the log file - see my other question -, i activated the php functions &quot;proc_open&quot; and &quot;proc_close&quot; at my hoster's php settings and it worked. I'm not sure if i can leave these settings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;proc_open&lt;/code&gt; and &lt;code&gt;proc_close&lt;/code&gt; are required if you want Craft 3 to automatically backup your database because it uses the native &lt;code&gt;mysqldump&lt;/code&gt; and &lt;code&gt;pg_dump&lt;/code&gt; binaries to perform the backup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for whatever reason, you can't enable those methods, your options are to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-backupcommand&quot; rel=&quot;nofollow noreferrer&quot;&gt;backupCommand&lt;/a&gt; config setting to &lt;code&gt;false&lt;/code&gt;. This will prevent Craft from performing database backups and you'll be responsible for manually creating them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-backupcommand&quot; rel=&quot;nofollow noreferrer&quot;&gt;backCommand&lt;/a&gt; config setting to some other script or service that can perform a backup without using those disabled methods.  Craft will respect whatever is set in this config setting.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-30T00:30:21.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26333" PostTypeId="2" ParentId="26324" CreationDate="2018-05-30T00:43:16.487" Score="2" Body="&lt;p&gt;In the context of Craft 3,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;referrerUrl&quot; value=&quot;{{ craft.app.request.getReferrer()&quot; /&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;currentUrl&quot; value=&quot;{{ craft.app.request.getAbsoluteUrl() }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see other methods off of the &lt;code&gt;web/Request&lt;/code&gt; object you can use here: &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-request.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-web-request.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-30T00:43:16.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26334" PostTypeId="1" AcceptedAnswerId="26337" CreationDate="2018-05-30T03:43:58.347" Score="1" ViewCount="171" Body="&lt;p&gt;It looks like the craft/app folder is no longer in the Craft download.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been using v.3.0.9 from the site and through composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I missing something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is causing a bit of trouble with step 4 in the install process:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Download the latest version of Craft from &lt;a href=&quot;https://craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;craftcms.com&lt;/a&gt;, and copy its craft/app/ folder into happylager/craft/.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8429" LastEditorUserId="45" LastEditDate="2018-05-30T04:04:55.503" LastActivityDate="2018-05-30T04:08:36.217" Title="Can't see any craft/app folder" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26335" PostTypeId="2" ParentId="26330" CreationDate="2018-05-30T03:54:31.997" Score="1" Body="&lt;p&gt;You are correct. This is quite easy now in Sprout Forms for Craft 3 but is more of a challenge in Craft 2 because we can't easily give you access to the &lt;code&gt;input&lt;/code&gt; html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your options in Craft 2 include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use Sprout Forms to override the field wrapper in the &lt;code&gt;field.html&lt;/code&gt; file and then update your CSS to target input fields within the parent tag (i.e. &lt;code&gt;div.my-class input&lt;/code&gt; instead of &lt;code&gt;input.my-class&lt;/code&gt;. This will be the most maintainable option.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Target each individual field you wish to add a custom class to using rendering options. As you mentioned, the limitation here is that it's not very maintainable for multiple forms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;While I can't recommend it, if you are planning to upgrade to Craft 3 and choose to hack the core while you remain on Craft 2, the easiest place to do so may be right in the template files (instead of in the PHP classes). You can find the Sprout Forms input field template files in &lt;code&gt;sproutforms/templates/_components/fields/*&lt;/code&gt;. You would need to update each individual template file with the classes you want. This option would be maintainable with the caveat that you'd need to remember that each time you update Sprout Forms you may overwrite your changes. If you go this route, it's probably best to manage your project in a git repository so you can recover any changes you might overwrite during an update.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you did want to do this as your own plugin, you would not be able to modify the existing fields. You would need to create a new &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/customization/custom-front-end-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom field&lt;/a&gt; to replace each existing custom field, and you would see both your custom fields and the default custom fields in the dropdown. This is maintainable in a general sense, but creates a lot of overhead for creating the duplicate fields with slightly different classes and will make the user interface feel like it has twice as many fields in the UI.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I expect you've considered this option, but updating to Craft 3 will have many benefits on top of greater control in Sprout Forms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-05-30T03:54:31.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26336" PostTypeId="2" ParentId="26326" CreationDate="2018-05-30T04:00:17.757" Score="2" Body="&lt;p&gt;figured this one out on my own, so to get all of the related objects, I just needed to change the above query to &lt;code&gt;$buildings = $location-&amp;gt;buildings-&amp;gt;all();&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8425" LastActivityDate="2018-05-30T04:00:17.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26337" PostTypeId="2" ParentId="26334" CreationDate="2018-05-30T04:08:36.217" Score="2" Body="&lt;p&gt;I'm inferring from that last line that you're trying to install the &lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Happy Lager&lt;/a&gt; demo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that demo is currently &lt;em&gt;only compatible with Craft 2&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;app&lt;/code&gt; folder was removed in Craft 3. And the demo has not yet been updated for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you really want to play with the Happy Lager demo, you'll need to download Craft 2. Or visit &lt;a href=&quot;https://demo.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;demo.craftcms.com&lt;/a&gt;, which will spin up a full copy of the demo for you.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-05-30T04:08:36.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26338" PostTypeId="1" CreationDate="2018-05-30T05:02:47.807" Score="1" ViewCount="192" Body="&lt;p&gt;When I get an Entry Object that has been set, I notice all of my fields except the Category fields are available to me. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[_behaviors:yii\base\Component:private] =&amp;gt; Array&#xA;    (&#xA;        [customFields] =&amp;gt; craft\behaviors\ContentBehavior Object&#xA;            (&#xA;                [adjustedRemainingLife] =&amp;gt; 100%&#xA;                [adjustedRemainingYears] =&amp;gt; 116&#xA;                [answerSets] =&amp;gt; [{&quot;col3&quot;:&quot;Paving and curbs are less than 3 years old, and in good condition. No repairs are needed, preventative maintenance &quot;,&quot;col1&quot;:&quot;Paving and curbs are in good condition, and only require routine maintenance - 90%&quot;,&quot;col2&quot;:&quot;Minor repairs and patching are required, not exceeding 30% of value -\r\n60%&quot;,&quot;col4&quot;:&quot;Significant repairs are needed to as much as 60% of value. - 30%&quot;,&quot;col5&quot;:&quot;All or majority of systems should be replaced - 0%&quot;}]&#xA;                [groundsQuestions] =&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;groundsQuestions&lt;/code&gt; is my category field, I figure if it isn't flowing through, there must be some way to get that value in a plugin?&lt;/p&gt;&#xA;" OwnerUserId="8425" LastEditorUserId="57" LastEditDate="2018-05-30T21:23:50.813" LastActivityDate="2018-05-30T21:23:50.813" Title="Is there a way to get categories relating to a specific entry within a plugin?" Tags="&lt;plugin-development&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26339" PostTypeId="2" ParentId="23876" CreationDate="2018-05-30T09:10:12.527" Score="3" Body="&lt;p&gt;You can slice the / from the end of {{ siteUrl }} and combine it with getUrl relative path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;{{ siteUrl|slice(0,-1) }}{{ entry.fieldName.one().getUrl('kafel620') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will produce expected path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;http://site.local/assets/images/ramPamPam/headers/_kafel620/tagiatelle.jpg&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5817" LastActivityDate="2018-05-30T09:10:12.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26341" PostTypeId="1" CreationDate="2018-05-30T16:33:37.310" Score="1" ViewCount="199" Body="&lt;p&gt;I'm working on a site that is available in multiple languages and I would like to build a language switcher that will work for both category pages and single entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft v2 that was possible but once I switched to Craft v3, I can't find a way to do get the current category page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For single entries I do the following (simplified):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for siteForEntry in entry.getSupportedSites %}       &#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}        &#xA;    {% if site.id == entry.siteId %}&#xA;        &amp;lt;li class=&quot;language-selection--active-language&quot;&amp;gt;&#xA;           &amp;lt;a href=&quot;#&quot;&amp;gt;{{ site.language }} &amp;lt;/a&amp;gt; &#xA;        &amp;lt;/li&amp;gt;&#xA;    {% else %}            &#xA;        {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;            &amp;lt;li class=&quot;{% if site.id == entry.siteId %} language-selection--active-language{% endif %} &quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ site.language }} &amp;lt;/a&amp;gt;&#xA;             &amp;lt;/li&amp;gt;&#xA;        {% endif %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do the same thing for categories?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-31T09:18:58.363" Title="Is there a way to get supportedSites for a category page?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26342" PostTypeId="2" ParentId="26338" CreationDate="2018-05-30T17:21:18.127" Score="1" Body="&lt;p&gt;Since &lt;code&gt;groundsQuestions&lt;/code&gt; is a category field, calling it will return an element query on which you can call &lt;code&gt;one()&lt;/code&gt;, &lt;code&gt;all()&lt;/code&gt;, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$groundsQuestions = $entry-&amp;gt;groundsQuestions-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-05-30T17:21:18.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26343" PostTypeId="1" CreationDate="2018-05-30T21:10:32.637" Score="1" ViewCount="430" Body="&lt;p&gt;Does anyone know or have a solution for a live search filter on the frontend for Craft.  I can muscle through putting something together but if you have used something that is friendly enough, would like to see the solution for Craft.&lt;/p&gt;&#xA;" OwnerUserId="6619" LastActivityDate="2018-05-31T19:03:42.287" Title="Filter Search Craft 3" Tags="&lt;craft3&gt;&lt;jquery&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26344" PostTypeId="2" ParentId="1319" CreationDate="2018-05-30T21:32:24.047" Score="1" Body="&lt;p&gt;Small update for Craft3 in the syntax :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories().all() %}&#xA;{% nav category in categories %}&#xA;    &amp;lt;li class=&quot;nav-menu-item {{ craft.app.request.getSegment(2) == category.slug ? 'nav-menu-item-current' : '' }}{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PS. Is there any other way to achieve this ? Going through craft.app is apparently frowned upon : &lt;a href=&quot;https://docs.craftcms.com/v3/templating/global-variables.html#craft-app&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/templating/global-variables.html#craft-app&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5311" LastActivityDate="2018-05-30T21:32:24.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26345" PostTypeId="1" CreationDate="2018-05-30T23:03:29.927" Score="1" ViewCount="146" Body="&lt;p&gt;Now I have a &quot;gallery image&quot; field which allows users to upload multiple images, and some &quot;single-upload image field&quot; in matrix block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;single-upload image field&quot;, I want to force users to choose images only from the &quot;gallery image&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, I want to create a custom asset source called &quot;gallery image&quot;. So with this source selected, I can limit the source of &quot;single-upload image field&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea to achieve this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-09-04T14:00:52.427" Title="How can I create a new asset source?" Tags="&lt;assets&gt;&lt;sources&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26347" PostTypeId="2" ParentId="23710" CreationDate="2018-05-31T08:04:03.033" Score="5" Body="&lt;p&gt;Little addition with a fallback to the homepage and check if entry exist.&#xA;currentSite is a global variable already defined in craft3 &lt;a href=&quot;https://docs.craftcms.com/v3/templating/global-variables.html#currentsite&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/templating/global-variables.html#currentsite&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for site in currentSite.group.sites %}&#xA;    &amp;lt;li class=&quot;{% if currentSite.id == site.id %} is-active{% endif %}&quot;&amp;gt;&#xA;      {% set url = alias(site.baseUrl) %}&#xA;      {% if entry is defined %}&#xA;        {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;        {% if entryForOtherSite %}&#xA;          {% set url = entryForOtherSite.getUrl() %}&#xA;        {% endif %}&#xA;      {% endif %}&#xA;      &amp;lt;a href=&quot;{{ url }}&quot;&amp;gt;{{ site.name }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2018-05-31T08:04:03.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26349" PostTypeId="2" ParentId="26341" CreationDate="2018-05-31T09:18:58.363" Score="1" Body="&lt;p&gt;It turns out that &lt;code&gt;getSupportedSites()&lt;/code&gt; returns different results for categories and standard entries so an additional check needs to take place. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution below has been tested with a single group with multiple languages, and it works, although I hope there's a better solution than this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the current page is a category then assign it to the entry variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = category %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Retrieve all supported sites for the current entry #}&#xA;{% set supportedSites = entry.getSupportedSites %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for siteForEntry in supportedSites %}&#xA;  {% if siteForEntry | length == 1 %}&#xA;    {# category #}&#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry) %}&#xA;    {% set entryForOtherSite = craft.categories.id(entry.id).site(site).one() %}&#xA;  {% elseif siteForEntry | length == 2 %}&#xA;    {# standard entry #}&#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}&#xA;    {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;  {% endif %}&#xA;&#xA;  {% if site.id == entry.siteId %}&#xA;      {# This is the current language, mark it as active and don't retrieve its url #}&#xA;      &amp;lt;li class=&quot;current&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{site.language}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% else %}&#xA;      {# if it's not the current site, get the entry for this site #}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{site.language}}&amp;lt;/a&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-31T09:18:58.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26350" PostTypeId="1" AcceptedAnswerId="26362" CreationDate="2018-05-31T09:29:38.553" Score="1" ViewCount="85" Body="&lt;p&gt;I would like to retrieve all available discounts for an eshop using the Craft Commerce v2.&#xA;In Craft Commerce v1, I could use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.discounts.all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I can't find an equivalent method for Commerce v2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please help?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-05-31T17:12:00.327" Title="Is there a way to retrieve discounts for a product in Craft Commerce v2?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26351" PostTypeId="1" CreationDate="2018-05-31T09:55:01.993" Score="1" ViewCount="142" Body="&lt;p&gt;Craft CMS version 3.0.9 (updated from 3.0.1 to try and fix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a layout field in a matrix box with the radio buttons field type with the options &lt;code&gt;normal (default), full, left, right&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When saving the entry with the radio button as full, left or right it stays at the default &lt;code&gt;normal&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This functionality was working in Craft CMS 2, doesn’t seem to work since the update to 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on how to fix this? &lt;/p&gt;&#xA;" OwnerUserId="8438" LastActivityDate="2018-05-31T14:55:20.410" Title="Radio buttons in matrix field not saving" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;saveentry&gt;&lt;onsaveentry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26352" PostTypeId="1" AcceptedAnswerId="26353" CreationDate="2018-05-31T10:20:22.710" Score="1" ViewCount="344" Body="&lt;p&gt;I am working in Craft 3 with the Commerce 2 plugin. I am trying to create new subscription plan there. But I am not able to do so because I don't have any Payment Gateway Installed that supports subscription. I tried to find it in Plugin store but not luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest me any Payment plugin that support subscriptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8440" LastEditorUserId="57" LastEditDate="2018-05-31T17:13:15.550" LastActivityDate="2018-05-31T17:13:15.550" Title="Craft Commerce 2: Subscription Payment Gateway" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26353" PostTypeId="2" ParentId="26352" CreationDate="2018-05-31T10:54:06.430" Score="2" Body="&lt;p&gt;According to the Commerce 2 docs, &lt;a href=&quot;https://github.com/craftcms/commerce-docs/blob/v2/en/subscriptions.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;the only first-party gateway that currently supports subscriptions is Stripe&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, according to the Commerce 2 docs, &lt;a href=&quot;https://github.com/craftcms/commerce-docs/blob/v2/en/payment-gateways.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Stripe plugin is available for free on the plugin store&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2018-05-31T10:54:06.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26354" PostTypeId="1" AcceptedAnswerId="26373" CreationDate="2018-05-31T14:00:22.813" Score="2" ViewCount="78" Body="&lt;p&gt;I'm working in a form with five fields, but I'm only receiving the content in the comments field; I'm not getting anything from the other four, please check my code&#xA;below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-container&quot;&amp;gt;&#xA;    &amp;lt;h3 class=&quot;aside-form__title&quot;&amp;gt;{{ block.contactFormHeadline }}&amp;lt;/h3&amp;gt;&#xA;    {% macro errorList(errors) %}&#xA;    {% if message is defined %}&#xA;        {% if errors %}&#xA;            {% for error in errors %}&#xA;                &amp;lt;small class=&quot;error&quot;&amp;gt;{{ error }}&amp;lt;/small&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;    {% from _self import errorList %}&#xA;    &amp;lt;form method=&quot;POST&quot; action=&quot;&quot;&amp;gt;&#xA;        {{ getCsrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{% if message is defined %}{{ message.fromName }}{% endif %}&quot; placeholder=&quot;Full Name&quot;&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;email&quot; name=&quot;fromEmail&quot; id=&quot;from-email&quot; class=&quot;form-control&quot; placeholder=&quot;Email&quot; value=&quot;{% if message is defined %}{{ message.fromEmail }}{% endif %}&quot;&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;text&quot; name=&quot;message[Company]&quot; id=&quot;company&quot; class=&quot;form-control&quot; placeholder=&quot;Company Name&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;input id=&quot;phone&quot; type=&quot;text&quot; name=&quot;message[Phone]&quot; value=&quot;&quot; Placeholder=&quot;Phone Number&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;            &amp;lt;textarea rows=&quot;3&quot; cols=&quot;30&quot; id=&quot;message&quot; name=&quot;message&quot; placeholder=&quot;Comments&quot;&amp;gt;{% if message is defined %}{{ message.message }}{% endif %}&amp;lt;/textarea&amp;gt;&#xA;            {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;         &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; class=&quot;Btn mini-form&quot; value=&quot;Submit&quot;&amp;gt;&#xA;         &amp;lt;/div&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;sales&quot; id=&quot;sales&quot; class=&quot;hidden&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8353" LastEditorUserId="8353" LastEditDate="2018-05-31T15:47:59.833" LastActivityDate="2018-06-01T00:56:00.623" Title="Contact form plugin only sending the content of the textarea?" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26355" PostTypeId="2" ParentId="26302" CreationDate="2018-05-31T14:22:34.540" Score="1" Body="&lt;p&gt;The following template code resolved this issue for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in submission.fieldMetadata %}&#xA;     {% if field.type == &quot;file&quot; %}&#xA;        {% set assetIds = attribute(submission, field.handle).value %}&#xA;        {% if assetIds %}&#xA;           {% for assetId in assetIds %}&#xA;              {% set asset = craft.assets.id(assetId).one() %}&#xA;              {% if asset %}&#xA;                 {% if asset.kind == &quot;image&quot; %}&#xA;                    &amp;lt;img src=&quot;{{ asset.url }}&quot; /&amp;gt;&#xA;                 {% else %}&#xA;                    &amp;lt;a href=&quot;{{ asset.url }}&quot;&amp;gt;{{ asset.filename }}&amp;lt;/a&amp;gt;&#xA;                 {% endif %}&#xA;              {% endif %}&#xA;           {% endfor %}&#xA;        {% endif %}&#xA;&#xA;     {% else %}&#xA;        {{ attribute(submission, field.handle) }}&#xA;     {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1077" LastActivityDate="2018-05-31T14:22:34.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26357" PostTypeId="2" ParentId="26351" CreationDate="2018-05-31T14:55:20.410" Score="2" Body="&lt;p&gt;Steps to fix:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change the radio button default to an alternative option.&lt;/li&gt;&#xA;&lt;li&gt;Go to entry and remove the matrix block.&lt;/li&gt;&#xA;&lt;li&gt;Save entry&lt;/li&gt;&#xA;&lt;li&gt;Readd the matrix block.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You should be able to correctly save the block, a long process but I couldn’t figure out what was going on.&lt;/p&gt;&#xA;" OwnerUserId="8438" LastActivityDate="2018-05-31T14:55:20.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26358" PostTypeId="1" AcceptedAnswerId="26360" CreationDate="2018-05-31T15:35:15.727" Score="3" ViewCount="1178" Body="&lt;p&gt;Here is what I am doing, but it's not working:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'macros/global' as macros %}&#xA;{{ macros sizedImage(image, alt, 't600X450', 600, 450, link, 'someClass') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The I have a macro file with code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro sizedImage(img, alt, transform, declaredWidth, declaredHeight, link, class) %}&#xA;...bunch of code...&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not clear from Craft's documentation what I should be doing differently. I did note that macros have to be included in the template where they are called, instead of a parent template, and that is fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I get is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Twig Syntax Error – Twig_Error_Syntax&#xA;  Unexpected token &quot;name&quot; of value &quot;sizedImage&quot; (&quot;end of print statement&quot; expected).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2018-05-31T16:07:15.023" Title="Just how do Macros work in Craft 3?" Tags="&lt;craft3&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26359" PostTypeId="1" CreationDate="2018-05-31T15:42:33.853" Score="1" ViewCount="622" Body="&lt;p&gt;I'm trying to upgrade a v2 site to v3 and have done the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Verified that my server meets the v3 requirements using the Craft Server Check.&lt;/li&gt;&#xA;&lt;li&gt;Followed steps 1-3 on &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Followed the directions on &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I go to my control panel's URL, I get the following error: &quot;An internal server error occurred.&quot; There's nothing in my server's &quot;error.log&quot; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a test, I even created a fresh install of v2 on a new server instance, imported my site's data, and tried upgrading that, and I still get the server error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, I'm running Apache 2.4, Ubuntu 16.04, PHP 7.0.30, and MySQL v5.7.22.&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2018-06-01T01:39:43.373" Title="Upgrading from v2 to v3 results in internal server errors" Tags="&lt;craft3&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26360" PostTypeId="2" ParentId="26358" CreationDate="2018-05-31T16:07:15.023" Score="5" Body="&lt;p&gt;To answer your title question... macros in Craft 3 work exactly the same as they do in Craft 2. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem you are hitting is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ macros sizedImage...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seems like a straightforward typo. I'm assuming you meant to write it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ macros.sizedImage...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For that reason (among others), I would recommend &lt;em&gt;not&lt;/em&gt; naming your imported macros as &quot;macros&quot;. It just invites confusion, and leads to silly typos like this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I often name them &quot;render&quot; (though you can truly name them anything) because it's more obvious what's happening.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'macros/global' as render %}&#xA;{{ render.sizedImage... }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-05-31T16:07:15.023" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26362" PostTypeId="2" ParentId="26350" CreationDate="2018-05-31T17:12:00.327" Score="0" Body="&lt;p&gt;This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.commerce.discounts.getAllDiscounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.commerce.discounts&lt;/code&gt; is a reference to &lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/src/services/Discounts.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;services/Discounts&lt;/code&gt;&lt;/a&gt;, so you've got access to all of the public methods in there, of which &lt;code&gt;getAllDiscounts()&lt;/code&gt; is one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-05-31T17:12:00.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26363" PostTypeId="1" AcceptedAnswerId="26364" CreationDate="2018-05-31T17:16:36.797" Score="0" ViewCount="213" Body="&lt;p&gt;I have a dev server and a production server, they are on two different databases. The editors will only be logging into the production space to add content. I'm looking for an easy (but still manual) way to export content. I rather not do an entire database dump every time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts? &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-05-31T17:30:29.407" Title="Importing/Exporting, but not everything" Tags="&lt;import&gt;&lt;export&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26364" PostTypeId="2" ParentId="26363" CreationDate="2018-05-31T17:30:29.407" Score="0" Body="&lt;p&gt;You don't wish to just pull down the production environment to your development server? This is how we solve this problem at work, by only editing the production server's database and then pulling it when it is updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are quality scripts for syncing environments from the command line. You can simply run &lt;code&gt;./pull_db.sh&lt;/code&gt; and it will do everything for you.&#xA;&lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also new craft 3 plugins for export/import but I have not had much success so far.&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-05-31T17:30:29.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26366" PostTypeId="2" ParentId="26343" CreationDate="2018-05-31T19:03:42.287" Score="1" Body="&lt;p&gt;maybe this article will help! &lt;a href=&quot;https://nystudio107.com/blog/autocomplete-search-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/autocomplete-search-with-the-element-api-vuejs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-05-31T19:03:42.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26367" PostTypeId="2" ParentId="26325" CreationDate="2018-05-31T19:24:38.397" Score="2" Body="&lt;p&gt;So Brad tracked down the issue being Twig needs at least PHP 5.2.7 to run. As of 1.34, the minimum requirement was bumped to PHP 5.3.3. Craft bumped up Twig to 1.35 in version 2.6.3001&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/1.x/intro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/1.x/intro.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My clients server was actually running 5.3.29. The server default was 7, bumping it up to php 5.4 fixed the site.&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2018-05-31T19:24:38.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26368" PostTypeId="1" AcceptedAnswerId="26433" CreationDate="2018-05-31T19:27:06.857" Score="1" ViewCount="165" Body="&lt;p&gt;I am having the hardest time allowing a user to delete their profile photo with Craft3. I have tried to follow this thread's answers : &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1011/allow-user-to-change-or-delete-their-photo-for-their-profile-from-the-front-end&quot;&gt;Allow user to change or delete their photo for their profile from the front end&lt;/a&gt;. But it is not working. I guess because some stuff has changed since Craft2.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my twig code : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;profile-image&quot;&amp;gt;&#xA;    {% if isEditable %}&#xA;        &amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;            {{ csrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;            {{ redirectInput('profil/'~currentUser.id) }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;            {% macro errorList(errors) %}&#xA;                {% if errors %}&#xA;                    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                        {% for error in errors %}&#xA;                            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                        {% endfor %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endif %}&#xA;            {% endmacro %}&#xA;&#xA;            {% from _self import errorList %}&#xA;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;deleteUserPhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;&#xA;            {% if account is defined %}{{ errorList(account.getErrors('deleteUserPhoto')) }}{% endif %}&#xA;&#xA;            &amp;lt;div&amp;gt;&#xA;                &amp;lt;a class=&quot;change-profile-photo-btn&quot; href=&quot;javascript:void(0);&quot;&amp;gt;&#xA;                    &amp;lt;img class=&quot;circle&quot; src=&quot;{{ user.getThumbUrl(250) }}&quot;&#xA;                         alt=&quot;{{ user.friendlyName }}&quot;/&amp;gt;&#xA;                    &amp;lt;div class=&quot;overlay waves-effect waves-light waves-circle&quot;&amp;gt;&#xA;                        &amp;lt;span&amp;gt;Modifier ma photo de profil&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;input id=&quot;profilePhotoInput&quot; type=&quot;file&quot; name=&quot;photo&quot; accept=&quot;image/*&quot;&amp;gt;&#xA;        &amp;lt;/form&amp;gt;&#xA;&#xA;        &amp;lt;a href=&quot;javascript:void(0);&quot;&#xA;           class=&quot;delete-profile-photo-btn btn btn-floating btn-large waves-effect waves-light coriandr-red tooltipped&quot;&#xA;           data-position=&quot;bottom&quot; data-delay=&quot;500&quot; data-tooltip=&quot;Supprimer ma photo de profil&quot;&amp;gt;&amp;lt;i&#xA;                    class=&quot;material-icons&quot;&amp;gt;delete&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;&#xA;    {% else %}&#xA;        &amp;lt;img class=&quot;circle&quot; src=&quot;{{ user.getThumbUrl(250) }}&quot; alt=&quot;{{ user.friendlyName }}&quot;/&amp;gt;&#xA;    {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the Javascript code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.delete-profile-photo-btn').on('click', function () {&#xA;    var deleteUserPhotoInput = $(&quot;#deleteUserPhotoInput&quot;);&#xA;    deleteUserPhotoInput.val('1');&#xA;    deleteUserPhotoInput.parents(&quot;form&quot;).submit();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this code, I get no errors, and the profile image doesn't delete. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then decided to try and reverse engineer the admin panel and see how it was done there. I came up with the following form : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;deleteUserPhotoForm&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&#xA;      accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/delete-user-photo&quot;&amp;gt;&#xA;    {{ redirectInput('profil/'~currentUser.id) }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the Javascript : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var form = $('#deleteUserPhotoForm');&#xA;&#xA;var data = form.serialize();&#xA;userFormAjaxCall(data, function (status, resp, xhr) {&#xA;    console.log(status);&#xA;    console.log(resp);&#xA;    window.location.reload(true);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this code, it seems to work, but I get this error message (not sure what the equivalent in english is). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible de trouver le modèle “users/_photo”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is the cleanest and simplest way I can allow a user to delete their profile photo? &lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="8165" LastEditDate="2018-05-31T19:32:58.747" LastActivityDate="2018-06-05T18:44:59.043" Title="Deleting a user's profile photo via frontend in Craft3" Tags="&lt;assets&gt;&lt;users&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26369" PostTypeId="1" CreationDate="2018-05-31T20:37:33.997" Score="6" ViewCount="174" Body="&lt;p&gt;Is it possible to create a matrix block with no fields? I'm using matrix as a page builder and have several scenarios where certain matrix blocks simply act as true/false checks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, my &lt;em&gt;Horizontal Rule block&lt;/em&gt; simply adds an '&amp;lt; hr &gt;' tag to the page. No fieldtype is needed for this block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can add a dummy text field to the block that does nothing, but this is not too elegant. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5233" LastActivityDate="2020-11-15T04:40:15.883" Title="Create matrix block with no fields" Tags="&lt;matrix&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26370" PostTypeId="2" ParentId="26369" CreationDate="2018-05-31T20:53:36.213" Score="1" Body="&lt;p&gt;I tend to design my matrix block at a slightly higher level. I would have a text block with the rich text editor that allows you to enter a &lt;code&gt;&amp;lt;hr/&amp;gt;&lt;/code&gt; tag. You can obviously also use this for all other text on the page, no need for multiple text style blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would add new block types for rich media components like galleries, videos, widgets, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is not exactly what you are looking for, maybe someone else will have an approach that works for your scenario. &lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-05-31T20:53:36.213" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26371" PostTypeId="1" AcceptedAnswerId="26381" CreationDate="2018-05-31T22:53:22.067" Score="2" ViewCount="69" Body="&lt;p&gt;&lt;em&gt;Note: this question pertains to Craft 2 Pro. Craft 3 is not currently an option.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What I need to do&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have some stand-alone utilities that don't need to exist within the Craft framework, so I would really rather not have to go down the road of learning how to develop Craft extensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is that these stand-alone utilities do their thing, and then redirect the user to various Craft entries, and I need some way to send arbitrary status messages from the standalone utilities that can then be displayed by the Craft templates.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Example Scenario&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We are using a external utility for online fundraising. The user starts on a page that exists as a Craft entry ('Donate'), proceeds to the external utility's web space, and is sent back to the Craft site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If something goes wrong in the transaction, I need to be able to display any number of error messages to the user, &lt;em&gt;on the original Craft entry&lt;/em&gt;, allowing the user to try the donation again. I don't want to create multiple copies of the original Craft entry, one for each possible error message. That seems like an unreasonable duplication of effort and data, and a nightmare in the making if any changes need to be made to what the user sees.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What I hoped would be possible&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The external utilities exist on the same domain, so I hoped I might be able to use PHP's &lt;code&gt;$_SESSION&lt;/code&gt; variable to set the status message, and then have the Twig template display the message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on what I found, it seems that Twig (at least in Craft 2) doesn't have access to &lt;code&gt;$_SESSION&lt;/code&gt; without editing the Craft application code to create a new global variable corresponding to &lt;code&gt;$_SESSION&lt;/code&gt;. I want to avoid editing Craft application code to ensure that nothing gets clobbered by updates to Craft.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What to do?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How can I send arbitrary external messages to a Craft entry so that they can be displayed by the Twig template? I don't think I know Craft well enough to know all the possibilities, and so I am not even sure how to search well for what other people have done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that writing my own extension isn't the answer to this because I haven't figured out how to do that, yet!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update!&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I went ahead with what was recommended in the &quot;accepted answer&quot; below, and it has worked. Here are the steps that I took:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a custom route in &lt;code&gt;config/routes.php&lt;/code&gt; that looks like this:&lt;br&gt;&#xA;&lt;code&gt;'(?:[-a-zA-Z0-9@:%_\+.~#?&amp;amp;\/=]+\/)+error/(\d+)' =&amp;gt; '_entry',&lt;/code&gt;&lt;br&gt;&#xA;This matches any URI that ends with &lt;code&gt;/error/&lt;/code&gt; and a number, and will capture the number as a variable. For an explanation of the regex, &lt;a href=&quot;https://regex101.com/r/vRCB7a/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;here it is on regex101.com&lt;/a&gt;.&lt;br&gt;&#xA;&lt;strong&gt;Note:&lt;/strong&gt; The version on regex101.com needs one of the forward slashes escaped, but that slash in &lt;code&gt;config/routes.php&lt;/code&gt; should &lt;em&gt;not&lt;/em&gt; be escaped.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a macro that will look up and return the correct error message by using a &lt;code&gt;switch&lt;/code&gt; statement on the error number, which will be captured in the &lt;code&gt;matches&lt;/code&gt; variable. The macro looks like this:  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro show_error(error_id) %}&#xA;  {% switch error_id %}&#xA;    {% case 10072 %} Error: bad transaction, please try again&#xA;    {% default %} Error: error message not found&#xA;  {% endswitch %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Add code at the beginning of &lt;code&gt;_entry&lt;/code&gt; to detect if the &lt;code&gt;matches&lt;/code&gt; variable exists, and then:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;look up what entry &lt;em&gt;would have been&lt;/em&gt; loaded by the CraftCMS engine, if this weren't a custom route: &lt;code&gt;{% set entry = craft.entries.uri(matches[0]).first() %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;save the error message to a variable, using the previously defined macro: &lt;code&gt;{% set error_message = show_error(matches[1]) %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Display the error message at the appropriate place in the template:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if error_message is defined and error_message|length %}&#xA;  &amp;lt;div class=&quot;error&quot;&amp;gt;{{ error_message }}&amp;lt;/div&amp;gt;&#xA;{% endif %}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Result:&lt;/strong&gt; I can append &lt;code&gt;/error/123&lt;/code&gt; to any entry's URI, and the &lt;code&gt;_entry&lt;/code&gt; template will be able to integrate the externally-chosen error message in an internal template.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6987" LastEditorUserId="6987" LastEditDate="2018-08-02T20:47:03.470" LastActivityDate="2018-08-02T20:47:03.470" Title="Can I send a status message from an external (standalone) PHP script to the Craft engine?" Tags="&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26373" PostTypeId="2" ParentId="26354" CreationDate="2018-06-01T00:56:00.623" Score="2" Body="&lt;p&gt;When using multiple fields, you'll need to use &lt;code&gt;message[body]&lt;/code&gt; for the main message field's &lt;code&gt;name&lt;/code&gt; attribute. Passing just &lt;code&gt;message&lt;/code&gt; as the name for your main text field will clobber your other custom fields that precede it, as will custom fields, if they appear after it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the only fix you'll need in this case is to the “Comments” &lt;code&gt;textarea&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;textarea name=&quot;message[body]&quot;&amp;gt;Your initial text&amp;lt;/textarea&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-01T00:56:00.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26374" PostTypeId="2" ParentId="26359" CreationDate="2018-06-01T01:39:43.373" Score="2" Body="&lt;p&gt;After doing some more digging in &lt;code&gt;storage/logs&lt;/code&gt;, it turns out that the permissions were incorrect on the &quot;cpresources&quot; director. Once I fixed those, the upgrade progressed as normal.&lt;/p&gt;&#xA;" OwnerUserId="737" LastActivityDate="2018-06-01T01:39:43.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26375" PostTypeId="1" AcceptedAnswerId="26376" CreationDate="2018-06-01T02:18:13.373" Score="1" ViewCount="67" Body="&lt;p&gt;&lt;strong&gt;When I try to load the demo site in my browser I get the following error:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imgur.com/8jVvweN&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/8jVvweN&lt;/a&gt; &quot;Your connection is not secure&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have added the following to my hosts file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;127.0.0.7        happylager.dev&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;and this to my &lt;code&gt;httpd-vhosts.conf&lt;/code&gt; file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;    DocumentRoot C:/xampp/htdocs/HappyLager/public/&#xA;    ServerName happylager.dev&#xA;    ServerAlias http://happylager.dev&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Content of .htaccess files:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The &lt;code&gt;.htaccess&lt;/code&gt; file in the public folder contains:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The &lt;code&gt;.htaccess&lt;/code&gt; file in the craft folder contains:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;deny from all&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;XAMPP versioning information:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PHP Version 7.04&lt;/li&gt;&#xA;&lt;li&gt;phpMyAdmin version 4.5.1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This error occured during step 7 and 8 on this page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/pixelandtonic/HappyLager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/HappyLager&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rebooted as well just in case. When I try to resolve 'happylager.dev' or '&lt;a href=&quot;http://happylager.dev&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://happylager.dev&lt;/a&gt;' the error still persists. The virtual hosts resolve other names without error. Any idea what I might not be considering? Any help will be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6228" LastActivityDate="2018-06-01T04:48:23.130" Title="HappyLager Demo Site Forcing 'https://' on XAMPP" Tags="&lt;config&gt;&lt;installation&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26376" PostTypeId="2" ParentId="26375" CreationDate="2018-06-01T04:18:47.957" Score="3" Body="&lt;p&gt;The issue here is actually the use of the TLD .dev. Google now owns that extension and in Chrome (which later, other browsers including Safari and Firefox enforced) it now forces the URL to go over SSL. If you don’t want to deal with all that self-signed certificate stuff to get SSL working locally, your best bet is to just switch the extension to something like .test and it should work just fine. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2018-06-01T04:48:23.130" LastActivityDate="2018-06-01T04:48:23.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26377" PostTypeId="1" CreationDate="2018-06-01T06:38:54.250" Score="1" ViewCount="313" Body="&lt;p&gt;As of now I am using Craft's image transform to render images according to the size.  If this still appears low quality even Image Transform setting with qulity &quot;Maximum&quot;.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastActivityDate="2018-08-31T16:23:16.380" Title="Image quality get low in Craft 3 after applying image transform" Tags="&lt;craft3&gt;&lt;image-transforms&gt;&lt;image&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26378" PostTypeId="1" CreationDate="2018-06-01T09:24:48.763" Score="1" ViewCount="215" Body="&lt;p&gt;Morning folks. First time doing multi-environment in Craft 3, and separate installations for staging and production is a bit overkill for this particular project. Instead I just want to show a few new bits in templates on the staging subdomain until sign-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Staging domain (&lt;a href=&quot;https://staging.adddress.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://staging.adddress.com&lt;/a&gt;) is pointed at the production 'public' directory. So in Craft 2, I'd just let the 'staging' key in my config.php set all the necessary environment variables. But in Craft 3 don't I need to load the correct .env first? Since it's all the same installation, is there a way to switch to .env.staging when on the staging subdomain? Is that the correct/best approach? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-06-01T10:16:37.010" Title="Multi environment-lite" Tags="&lt;craft3&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26379" PostTypeId="2" ParentId="26378" CreationDate="2018-06-01T10:16:37.010" Score="1" Body="&lt;p&gt;Alright, so turns out all I need to do is comment out the following line in index.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I can use config.php keys, same way I did in Craft 2. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;    // My default/production variables&#xA;    'devMode' =&amp;gt; false,&#xA;    etc...&#xA;],&#xA;// Local&#xA;'address.test' =&amp;gt; [&#xA;    // Local variables&#xA;    'devMode' =&amp;gt; true,&#xA;    etc...&#xA;]&#xA;// Staging&#xA;'staging.address.com' =&amp;gt; [&#xA;    // Staging variables&#xA;    'devMode' =&amp;gt; true,&#xA;    etc...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to Luke James for the assist on Slack.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-06-01T10:16:37.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26380" PostTypeId="2" ParentId="12736" CreationDate="2018-06-01T11:45:13.230" Score="2" Body="&lt;p&gt;For Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCheckStatus()&#xA;{&#xA;    $this-&amp;gt;requireAcceptsJson();&#xA;&#xA;    $response = [&#xA;        'status' =&amp;gt; 'open'&#xA;    ];&#xA;&#xA;    return $this-&amp;gt;asJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7199" LastEditorUserId="57" LastEditDate="2018-06-01T20:02:01.957" LastActivityDate="2018-06-01T20:02:01.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26381" PostTypeId="2" ParentId="26371" CreationDate="2018-06-01T11:56:18.273" Score="2" Body="&lt;p&gt;Probably the easiest way to do this would be to add another segment to your URI.&#xA;i.e /bla/bla/bla/message-1&#xA;Then in your template, read the segment and display the appropriate message.&#xA;You could do it all in the template with a switch or conditional or the segment could be the entry slug for the message and you can pull from Craft entries.&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2018-06-01T11:56:18.273" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26382" PostTypeId="1" AcceptedAnswerId="26383" CreationDate="2018-06-01T15:48:51.820" Score="1" ViewCount="506" Body="&lt;p&gt;How would I get the global variables associated to other sites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in an instance where I have three websites under the group &lt;code&gt;languages&lt;/code&gt; for the English, Spanish, and French versions. I have specified &lt;code&gt;companyInformation&lt;/code&gt; globals that contain: phone, address, and logo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a template I would like:&#xA;- Loop through all sites under the group &lt;code&gt;languages&lt;/code&gt;&#xA;- Get &lt;code&gt;companyInformation&lt;/code&gt; global values for each of the sites&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2018-06-01T20:50:47.263" Title="Get globals from other sites" Tags="&lt;templating&gt;&lt;localization&gt;&lt;globals&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26383" PostTypeId="2" ParentId="26382" CreationDate="2018-06-01T19:27:45.707" Score="1" Body="&lt;p&gt;The function is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSetByHandle(string $globalSetHandle, int $siteId = null)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you can grab all the siteIds you want and loop through them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for siteId in sites %}&#xA;    {% set setForSiteId = craft.app.getGlobals().getSetByHandle('handle', siteId) %} &#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-01T20:50:47.263" LastActivityDate="2018-06-01T20:50:47.263" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26384" PostTypeId="1" AcceptedAnswerId="26385" CreationDate="2018-06-01T21:48:21.293" Score="1" ViewCount="212" Body="&lt;p&gt;I've made a new plugin for Craft 3 using &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;, including everything possible just in case I needed it. Now that my project is coming to a close I'm going back through to take out what I didn't end up needing (I now realize this was not the wisest way). I can't seem to take out the Settings and Control Panel sections, even though my &lt;code&gt;composer.json&lt;/code&gt; has:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&quot;extra&quot;: {&#xA;  &quot;hasCpSettings&quot;: false,&#xA;  &quot;hasCpSection&quot;: false,&#xA;}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not redeclaring those as &lt;code&gt;true&lt;/code&gt; anywhere else...is there something else I should do to remove those parts?&lt;/p&gt;&#xA;" OwnerUserId="7260" LastActivityDate="2018-06-01T22:24:33.253" Title="Remove a Control Panel Section" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26385" PostTypeId="2" ParentId="26384" CreationDate="2018-06-01T22:24:33.253" Score="2" Body="&lt;p&gt;Craft itself is caching this data. Once you've removed those lines from your &lt;code&gt;composer.json&lt;/code&gt; file, you'll also need to remove them from the cached &lt;code&gt;plugins.php&lt;/code&gt; file in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open this file...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;/vendor/craftcms/plugins.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then find your plugin. Remove the relevant lines from there, and save the file.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For this reason I actually recommend declaring &lt;code&gt;hasCpSettings&lt;/code&gt; and &lt;code&gt;hasCpSection&lt;/code&gt; the &quot;old fashioned way&quot;... within your plugin's main PHP file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it's possible to declare those values via PHP as well. And if you declare them via PHP, they won't get cached in Craft's &lt;code&gt;plugins.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsection&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsection&lt;/a&gt;&#xA;  &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsettings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsettings&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-01T22:24:33.253" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26386" PostTypeId="1" AcceptedAnswerId="26387" CreationDate="2018-06-02T11:34:54.933" Score="1" ViewCount="27" Body="&lt;p&gt;I'm trying to display how long til a certain post expires depending on a date/time field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Expires in 13 days.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My field is currently displayed by doing &lt;code&gt;{{ entry.expiration }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just don't know how I would just display the days remaining until this date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-06-02T14:16:39.820" Title="Displaying how long til post expires" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26387" PostTypeId="2" ParentId="26386" CreationDate="2018-06-02T12:38:44.817" Score="3" Body="&lt;p&gt;Your &lt;code&gt;entry.expiration&lt;/code&gt; is actually an object of type DateTime thus you'll have the full power of PHPs &lt;a href=&quot;http://php.net/manual/en/datetime.diff.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateDiff&lt;/a&gt; functionality &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$interval = $datetime1-&amp;gt;diff($datetime2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Twig this is something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set difference = now.diff(entry.expiration) %} &#xA;{{ difference.format('%R%a days') }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;now&lt;/code&gt; should be the current date &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-02T14:16:39.820" LastActivityDate="2018-06-02T14:16:39.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26388" PostTypeId="1" AcceptedAnswerId="26390" CreationDate="2018-06-02T13:42:04.690" Score="1" ViewCount="104" Body="&lt;p&gt;I'm trying to make it so that if an entry image does not exist, then fall back to the category image that the entry belongs to. Right now this isn't working and is receiving an error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set feature = entry.brandFeature.one() %}&#xA;{% set featureUrl = feature ? feature.url : entry.category.one().categoryImage.getUrl() %}&#xA;&amp;lt;div class=&quot;jumbotron category-jumbotron&quot; style=&quot;background-image:url({{ featureUrl }})&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the error that craft is returning:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Calling unknown method: craft\elements\db\AssetQuery::getUrl()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-06-02T14:58:46.097" Title="Falling back to Parent Category if no asset exists" Tags="&lt;entries&gt;&lt;assets&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26390" PostTypeId="2" ParentId="26388" CreationDate="2018-06-02T14:58:46.097" Score="2" Body="&lt;pre&gt;&lt;code&gt;entry.brandFeature.one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is correct, you'll access the asset field and execute the &lt;code&gt;one()&lt;/code&gt; function in order to fetch the asset.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.category.one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is correct too. You'll &lt;strong&gt;fetch&lt;/strong&gt; the first category of your categories field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.category.one().categoryImage&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will access the &lt;code&gt;categoryImage&lt;/code&gt; asset field of your category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then you do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;categoryImage.getUrl()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you try to get the url from the field value but you don't actually grab the asset that might be stored in the category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;categoryImage.one().getUrl()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However - keep in mind there could be entries without a category. Then you'll receive an error as well. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-02T14:58:46.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26391" PostTypeId="1" AcceptedAnswerId="26392" CreationDate="2018-06-02T15:42:46.873" Score="1" ViewCount="38" Body="&lt;p&gt;I am trying to build an &lt;code&gt;Index&lt;/code&gt; page and assign a specific &lt;code&gt;card&lt;/code&gt; template to the &lt;code&gt;3rd entry&lt;/code&gt; and only the &lt;code&gt;3rd entry&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.entries.section('posts').all() %}&#xA;&#xA;{% for cardC in items.offset(2).limit(1) %}&#xA;&#xA;    &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;card card-raised card-background&quot; style=&quot;background-image: url('{{ cardC.postImage.one().getUrl() }}')&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                &amp;lt;h6 class=&quot;card-category text-info&quot;&amp;gt;Marketing&amp;lt;/h6&amp;gt;&#xA;                &amp;lt;h3 class=&quot;card-title&quot;&amp;gt;{{ cardC.title }}&amp;lt;/h3&amp;gt;&#xA;                &amp;lt;p class=&quot;card-description&quot;&amp;gt;&#xA;                   {{ cardC.introParagraph }}&#xA;                &amp;lt;/p&amp;gt;&#xA;                &amp;lt;a href=&quot;&quot; class=&quot;btn btn-warning btn-round&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;material-icons&quot;&amp;gt;subject&amp;lt;/i&amp;gt; Read Case Study&#xA;                &amp;lt;/a&amp;gt;&#xA;                &amp;lt;a href=&quot;&quot; class=&quot;btn btn-white btn-just-icon btn-link&quot; title=&quot;&quot; rel=&quot;tooltip&quot; data-original-title=&quot;Save to Pocket&quot;&amp;gt;&#xA;                    &amp;lt;i class=&quot;fa fa-get-pocket&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried &lt;code&gt;{% for cardC in items.nth(3 )%}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following &lt;code&gt;**error message**&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to invoke a method (&quot;offset&quot;) on an array.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I created the &lt;code&gt;set&lt;/code&gt; because I need to apply templates for the other entries, etc. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="45" LastEditDate="2018-06-02T16:18:33.543" LastActivityDate="2018-06-02T21:20:05.913" Title="How do I target the 3rd entry and only that entry?" Tags="&lt;templating&gt;&lt;entry&gt;&lt;index&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26392" PostTypeId="2" ParentId="26391" CreationDate="2018-06-02T16:17:27.210" Score="2" Body="&lt;p&gt;As soon as you apply &lt;code&gt;.all()&lt;/code&gt;, the variable you're working with becomes an array. Which means that the &lt;code&gt;.offset(2)&lt;/code&gt; needs to be applied &lt;em&gt;before&lt;/em&gt; you convert it into an array.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @andrew.welch points out in the comments, it's as easy as grabbing the third item in your array...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;items[2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ultimately, it looks like you want something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cardC = items[2] %}&#xA;&#xA;{% if cardC %}&#xA;&#xA;    {# ... the rest of your code #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL ANSWER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once it's an array, you'll need to use the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig syntax&lt;/a&gt; instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;items[2:1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which translates to: &quot;get third item (0-based index), limit of one&quot;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-06-02T21:20:05.913" LastActivityDate="2018-06-02T21:20:05.913" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26393" PostTypeId="1" AcceptedAnswerId="26394" CreationDate="2018-06-02T16:42:48.917" Score="1" ViewCount="32" Body="&lt;p&gt;This is for an &lt;code&gt;index page&lt;/code&gt; (again).  I want to list the 10 most recent articles.  There is a field &lt;code&gt;postImage&lt;/code&gt;.  It is not required.  If it exists, I want to use &lt;code&gt;postImage&lt;/code&gt;.  If not, I want to use a default image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant code is under the &lt;code&gt;img&lt;/code&gt; tag.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:  &lt;strong&gt;Impossible to invoke a method (&quot;getUrl&quot;) on a null variable.&lt;/strong&gt;.  I can verify that 7 of the first 10 entries do have a &lt;code&gt;postImage&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% for item in craft.entries.section('posts').limit(10) %}&#xA;                              {% set pic = item.postImage.one().getUrl() %}&#xA;                              {% if loop.index is divisible by(2) %}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                        &amp;lt;div class=&quot;card card-plain card-blog&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;col-md-5&quot;&amp;gt;&#xA;                                    &amp;lt;div class=&quot;card-header card-header-image&quot;&amp;gt;&#xA;                                        &amp;lt;a href=&quot;#pablito&quot;&amp;gt;&#xA;&#xA;                                            &amp;lt;img class=&quot;img img-raised&quot; src=&quot;{% if pic %}{{ pic }}{% else %}assets/img/office2.jpg&#xA;                                                {% endif %}&#xA;                                            &quot;&amp;gt;    &#xA;&#xA;                                        &amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                                &amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&#xA;                                    &amp;lt;h6 class=&quot;card-category text-info&quot;&amp;gt;Enterprise&amp;lt;/h6&amp;gt;&#xA;                                    &amp;lt;h3 class=&quot;card-title&quot;&amp;gt;&#xA;                                        &amp;lt;a href=&quot;{{ item.url }}&quot;&amp;gt;{{ item.title }}&amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;/h3&amp;gt;&#xA;                                    &amp;lt;p class=&quot;card-description&quot;&amp;gt;&#xA;                                       {{ item.introParagraph }}&#xA;                                        &amp;lt;a href=&quot;{{ item.url }}&quot;&amp;gt; Read More &amp;lt;/a&amp;gt;&#xA;                                    &amp;lt;/p&amp;gt;&#xA;                                    &amp;lt;p class=&quot;author&quot;&amp;gt;&#xA;                                        by&#xA;                                        &amp;lt;a href=&quot;&quot;&amp;gt;&#xA;                                            &amp;lt;b&amp;gt;x&amp;lt;/b&amp;gt;&#xA;                                        &amp;lt;/a&amp;gt;, 2 days ago&#xA;                                    &amp;lt;/p&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;&#xA;                        {% else %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are 2 &lt;code&gt;if&lt;/code&gt; / &lt;code&gt;else&lt;/code&gt; statements.   Only the 1 associated with the &lt;code&gt;img&lt;/code&gt; tag is relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-04T11:18:01.790" Title="Trying to template a post's image on an index page with a default image if it does not exist" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26394" PostTypeId="2" ParentId="26393" CreationDate="2018-06-02T17:10:01.200" Score="1" Body="&lt;p&gt;Drop the &lt;code&gt;getUrl()&lt;/code&gt; from the &lt;code&gt;set&lt;/code&gt; and everything works.  &lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5557" LastEditDate="2018-06-04T11:18:01.790" LastActivityDate="2018-06-04T11:18:01.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26395" PostTypeId="1" CreationDate="2018-06-02T21:47:57.623" Score="3" ViewCount="197" Body="&lt;p&gt;Our application seems to be crashing periodically, on a seemingly unknown cadence. Sometimes it goes down once every few days, and sometimes (like today, when I'm at the end of my rope) it goes down 30 times a day or so. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When hitting the site on the frontend, the user gets a message saying that the site is unavailable; the maintenance mode error message. When we visit the admin panel, we are prompted to update two of our plugins, &lt;a href=&quot;https://github.com/lukeholder/craft-geo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Geo&lt;/a&gt; and &lt;a href=&quot;https://github.com/A-P/Embedder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedder&lt;/a&gt;. After performing the updates the site comes back online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the craft logs before the site goes down, we're hit with a bunch of 404 errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level       error&#xA;Category    exception.Craft\HttpException.404&#xA;Message     Craft\HttpException in /var/www/vhosts/production/craft/app/controllers/TemplatesController.php:72&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;these range from requests trying to hit /wp-admin and other random pages&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it looks like the site goes down, because then we get hit with 503s:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Level       error&#xA;Category    exception.Craft\HttpException.503&#xA;Message     Craft\HttpException in /var/www/vhosts/production/craft/app/etc/web/WebApp.php:971&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When we hit /admin, the logs show the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;******************************************************************************************************&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Preparing to update embedder.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Finished preparing to update embedder.&#xA;&#xA;******************************************************************************************************&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Starting to update the database.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] The plugin &quot;Embedder&quot; wants to update the database.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Running migrations...&#xA;2018/06/02 20:52:43 [info] [application] [Forced] No new migration(s) found for the plugin Embedder. Your system is up-to-date.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Taking the site out of maintenance mode.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] The plugin &quot;Embedder&quot; is done updating the database.&#xA;&#xA;******************************************************************************************************&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Starting to clean up after the update.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Clearing the update cache.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Flushing update info from cache.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Finished Updater.&#xA;2018/06/02 20:52:43 [info] [application] [Forced] Finished cleaning up after the update.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I don't think this is related to those two plugins; I think either Craft is getting out of sync somehow, or something is up with our cloud database. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone run into this issue before? What would be forcing the plugin migrations to initiate again and again, to make updates to the same database?&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2019-04-18T15:10:28.053" Title="Craft periodically goes down due to plugin migrations" Tags="&lt;plugins&gt;&lt;performance&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26396" PostTypeId="2" ParentId="23056" CreationDate="2018-06-03T02:53:15.287" Score="15" Body="&lt;p&gt;I gave everything a try, but the only thing that worked for me was ensuring &quot;Allow network access to MySQL&quot; was ticked in MAMP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot: &lt;a href=&quot;http://c42.co/Ur30EJ&quot; rel=&quot;noreferrer&quot;&gt;http://c42.co/Ur30EJ&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/XMGlN.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XMGlN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-06-03T02:53:15.287" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26397" PostTypeId="1" CreationDate="2018-06-03T08:57:09.570" Score="1" ViewCount="316" Body="&lt;p&gt;I'm trying to setup different mail settings per environment. Here is my mail component that I'm defining in &lt;code&gt;config/app.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'components' =&amp;gt; [&#xA;    'mailer' =&amp;gt; function() {&#xA;        // Get the stored email settings&#xA;        $settings = Craft::$app-&amp;gt;systemSettings-&amp;gt;getEmailSettings();&#xA;&#xA;        // Override the transport adapter class&#xA;        $settings-&amp;gt;transportType = craft\mail\transportadapters\Smtp::class;&#xA;&#xA;        // Override the transport adapter settings&#xA;        $settings-&amp;gt;transportSettings = [&#xA;            'host'              =&amp;gt; 'localhost',&#xA;            'port'              =&amp;gt; '1025',&#xA;            'useAuthentication' =&amp;gt; false,&#xA;            'encryptionMethod'  =&amp;gt; null,&#xA;            'timeout'           =&amp;gt; '10',&#xA;        ];&#xA;&#xA;        return craft\helpers\MailerHelper::createMailer($settings);&#xA;    },&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I ensure this only applies to development environments? Multi-environment doesn't seem to work like it does for &lt;code&gt;config/general.php&lt;/code&gt; and there's no multi-environment example in the &lt;a href=&quot;https://docs.craftcms.com/v3/configuration.html#application-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;relevant documentation&lt;/a&gt;. Brandon's Github comment &lt;a href=&quot;https://github.com/craftcms/cms/issues/1344#issuecomment-277767746&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; suggests that this is possible. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="599" LastActivityDate="2019-03-20T15:16:09.913" Title="How to do multi-environment app config (config/app.php)?" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26399" PostTypeId="1" CreationDate="2018-06-03T15:16:28.350" Score="1" ViewCount="507" Body="&lt;p&gt;Having an issue with using the event \craft\elements\User::EVENT_AFTER_SAVE in a plug in. I am adding a new user to a group. My goal is to have the newly added user automatically added to the same user group as the logged in user. This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    \craft\elements\User::class,&#xA;    \craft\elements\User::EVENT_AFTER_SAVE,&#xA;    function(ModelEvent  $event) {&#xA;        if (Craft::$app-&amp;gt;getUser()-&amp;gt;getIsAdmin() == false){&#xA;            $loggedInUser = Craft::$app-&amp;gt;getUser();&#xA;            $userGroupUser = new UserGroup_User();&#xA;            $userGroupUser-&amp;gt;groupId = $loggedInUser-&amp;gt;getIdentity()-&amp;gt;getGroups()[0]['id'];&#xA;            $userGroupUser-&amp;gt;userId = $event-&amp;gt;sender-&amp;gt;id;&#xA;            $result = $userGroupUser-&amp;gt;insert();&#xA;         }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have put a breakpoint on the code after the if statement and then checked the users table - the new user is not in the users table yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect that the new user would be in the table at this point. Is this transaction being saved and executed later? If so is there something I can do to force the transaction to save the new user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible a bug?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not get any error messages. Why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I should also mention that the usergroup has permission to add users in their own usergroup.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="8071" LastEditDate="2018-06-03T15:22:17.473" LastActivityDate="2018-06-06T08:14:40.187" Title="Problem with \craft\elements\User::EVENT_AFTER_SAVE" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26401" PostTypeId="1" CreationDate="2018-06-04T09:07:25.300" Score="3" ViewCount="704" Body="&lt;p&gt;I'm new to Craft 3 and I need help getting the web root to point to /web.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure it out. If I use the url &quot;mysite.com/web&quot; everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be gratefully received.&lt;/p&gt;&#xA;" OwnerUserId="8461" LastEditorUserId="8637" LastEditDate="2018-08-02T05:00:01.117" LastActivityDate="2018-08-02T05:00:01.117" Title="help setting up web root to point to /web" Tags="&lt;craft3&gt;&lt;config&gt;&lt;install&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26402" PostTypeId="1" CreationDate="2018-06-04T09:17:38.997" Score="1" ViewCount="454" Body="&lt;p&gt;We will build two Pages with two different domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to use the multi-site feature of Craft 3 so we only need one backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see on YouTube a Video from Mijingo - &quot;Multi-Site in Craft 3&quot; and he use two domains in one backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we use one licence or need we two licences for this?&lt;/p&gt;&#xA;" OwnerUserId="8460" LastEditorUserId="57" LastEditDate="2018-06-04T22:37:10.057" LastActivityDate="2018-06-04T22:42:15.650" Title="Multi-Site Licence" Tags="&lt;craft3&gt;&lt;license&gt;&lt;multi-domain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26403" PostTypeId="1" AcceptedAnswerId="26419" CreationDate="2018-06-04T12:03:52.243" Score="9" ViewCount="3666" Body="&lt;p&gt;How do image focal points work in Craft 3? I see the dot in the CP, but I'm unable to set the focus.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastEditorUserId="50" LastEditDate="2019-09-24T14:27:26.907" LastActivityDate="2019-09-24T14:27:26.907" Title="How do image focal points work in Craft 3?" Tags="&lt;image-transforms&gt;&lt;craft-pro&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26404" PostTypeId="1" CreationDate="2018-06-04T13:44:15.743" Score="1" ViewCount="345" Body="&lt;p&gt;I have a a few pages outside of a structure but I want to display a breadcrumb for it as part of a structure. I am currently setting the parent page like so:&#xA;&lt;code&gt;{% set parent = craft.entries.section('pages').slug('phone-directory')&lt;/code&gt; %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ parent.ancestors }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I loop through to get the ancestors it is only getting the current parent not all ancestors? Any idea how to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure is&lt;br&gt;&#xA;Staff&lt;br&gt;&#xA; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Phone Directory&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am trying to do this, is the 3rd level pages are either category pages or is a single with some specific routes. I want to manually set the real parent in the template, so I can get the ancestors for the breadcrumb trail as though it is part of the same section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I manually set the parent entry in the template and get the ancestors from this entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**** &lt;strong&gt;UPDATED&lt;/strong&gt; ****&lt;br&gt;&#xA;This is an update on the above to show my exact code and what isn't working and How I expect it work...If anyone ca shed some light?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by default I am getting my breadcrumbs like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.section.handle != 'homepage' %}&#xA;{% set crumbs =  parent.ancetors ?? entry.ancestors|default([]) %}&#xA;{% set crumbDivider = '&amp;lt;li&amp;gt;&amp;lt;span class=&quot;mx-3 text-grey text-xs&quot;&amp;gt;/&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;' %}&#xA;&amp;lt;nav class=&quot;mb-8 mx-6&quot;&amp;gt;&#xA;  &amp;lt;ul class=&quot;list-reset flex flex-wrap items-center text-grey-dark text-sm&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;mr-3 text-xs text-grey-light&quot;&amp;gt;You are in:&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% for crumb in crumbs %}&#xA;    {{ crumbDivider|raw }}&#xA;    &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    {{ crumbDivider|raw }}&#xA;    &amp;lt;li class=&quot;text-grey-darker&quot;&amp;gt;{{ entry.title ?? category.title }}&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works as expect for normal standard entries. For example, within my Pages structure I have a parent of News with a Child of Internal News and on the Internal News page, the breadcrumb is reflected as;&#xA;&lt;code&gt;Home / News / SWH Internal News&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on the news entry pages I want the breadcrumb to read as follows;&#xA;&lt;code&gt;Home / News / SWH Internal News / {{ Entry Title }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought by setting the parent on the news/_entry.html template to the SWH Internal News page like so;&#xA;&lt;code&gt;{% set parent = craft.entries.section('pages').slug('archive') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would then give me the ancestors of &lt;code&gt;News / SWH Internal News&lt;/code&gt; but instead it only outputs SWH Internal News.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2018-06-06T12:54:42.927" LastActivityDate="2018-06-06T14:45:31.510" Title="Getting ancestors for manually set parent in template" Tags="&lt;templating&gt;&lt;parents&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26405" PostTypeId="1" CreationDate="2018-06-04T14:41:34.090" Score="1" ViewCount="23" Body="&lt;p&gt;Is it possible to override/disregard the postDate for all entries in a section so that they are visible on the frontend even if this date is in the future?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise I could add a dedicated date field — but keen to avoid this if possible as the fields for this entry are already quite complicated!&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-06-04T15:00:03.750" Title="Override the postDate for entries so their URL works on the frontend?" Tags="&lt;frontend&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26406" PostTypeId="2" ParentId="26405" CreationDate="2018-06-04T15:00:03.750" Score="1" Body="&lt;p&gt;You can add &lt;code&gt;status(null)&lt;/code&gt; in your ElementQuery in order to fetch all items or you add &lt;code&gt;status(['pending', 'enabled'])&lt;/code&gt; to pull all entries, that are not disabled and not expired&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-04T15:00:03.750" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26407" PostTypeId="1" AcceptedAnswerId="26424" CreationDate="2018-06-04T15:28:48.020" Score="3" ViewCount="295" Body="&lt;p&gt;Situation: I have a matrix with about 10 block types, 3 of which have a certain field. I want to check if the current block has that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field in question is a dropdown with values in all 3 options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{{ attribute(block, 'backgroundColor') is defined ? 'true' : 'false' }}&lt;/code&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;=&gt;  returns &lt;code&gt;true&lt;/code&gt; for all blocks&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{% if block.backgroundColor|length %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;=&gt; errors out with &lt;code&gt;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;backgroundColor&quot;.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;{% if block.backgroundColor is defined %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;=&gt; same error as above&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="5206" LastEditorUserId="5206" LastEditDate="2018-06-05T11:38:31.157" LastActivityDate="2018-06-05T11:53:38.920" Title="Check if a field a included in a Matrix block" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26408" PostTypeId="2" ParentId="26401" CreationDate="2018-06-04T15:30:50.530" Score="4" Body="&lt;p&gt;You need to configure your webserver/virtualhost to point to the /web directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For apache you have &lt;code&gt;DocumentRoot: your_disk_path/web&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For nginx you have &lt;code&gt;root: your_disk_path/web&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2018-06-04T15:30:50.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26409" PostTypeId="2" ParentId="26399" CreationDate="2018-06-04T15:40:38.807" Score="1" Body="&lt;p&gt;I don't know what your specific error is, but whenever I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;\craft\elements\User::class,&#xA;\craft\elements\User::EVENT_AFTER_SAVE,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to provide the next parameter with a &lt;code&gt;\yii\base\Event&lt;/code&gt; callback, not a &lt;code&gt;\craft\events\ModelEvent&lt;/code&gt; one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe that's your case as well ?&#xA; You can also use &lt;code&gt;\yii\base\ModelEvent&lt;/code&gt;, but not the craft one, as the craft ModelEvent does not extend &lt;code&gt;\yii\base\Event&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2018-06-04T15:40:38.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26410" PostTypeId="1" AcceptedAnswerId="26420" CreationDate="2018-06-04T16:04:21.053" Score="1" ViewCount="126" Body="&lt;p&gt;I am trying to change all rgb colours in a bit of text/content. I have the RegEx working here in php using preg_replace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;preg_replace(&quot;/#[a-zA-Z0-9]{6}|rgb\((?:\s*\d+\s*,){2}\s*[\d]+\)|rgba\((\s*\d+\s*,){3}[\d\.]+\)|hsl\(\s*\d+\s*(\s*\,\s*\d+\%){2}\)|hsla\(\s*\d+(\s*,\s*\d+\s*\%){2}\s*\,\s*[\d\.]+\)/&quot;, &quot;*****&quot;, $input_lines);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.phpliveregex.com/p/oc2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.phpliveregex.com/p/oc2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But cannot seem to get it working in craft template code am trying is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set svg_image = '&#xA;#ffffff&#xA;#ffffffasdf&#xA;asdf#ffffff&#xA;rgba(170,221,255,0.59)&#xA;rgba(170,221,255,0.59)asdf&#xA;rgb(0, 0, 0)&#xA;rgb(33, 44,66)&#xA;rgb(0,0,0)asdf&#xA;rgba(170,221,255,0.59dsaf)&#xA;' %} &#xA;&#xA;{% set svg_image_output = svg_image|replace({ '/#[a-zA-Z0-9]{6}|rgb\\((?:\\s*\\d+\\s*,){2}\\s*[\\d]+\\)|rgba\\((\\s*\\d+\\s*,){3}[\\d\\.]+\\)|hsl\\(\\s*\\d+\\s*(\\s*\\,\\s*\\d+\\%){2}\\)|hsla\\(\\s*\\d+(\\s*,\\s*\\d+\\s*\\%){2}\\s*\\,\\s*[\\d\\.]+\\)/': '****' }) %}&#xA;{{ svg_image_output | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have:&#xA; - added double-escaped '\' as the docs suggest in v2&#xA; - started with / and ended with /&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems in the docs that if this is done it works like preg_replace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5838" LastActivityDate="2018-06-04T23:09:17.577" Title="Craft 3 RegEx problem" Tags="&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26412" PostTypeId="1" CreationDate="2018-06-04T19:08:52.440" Score="1" ViewCount="115" Body="&lt;p&gt;I'm trying to set a variable within my templates which does the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If this field is empty then use another field instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have 2x Fields called &lt;code&gt;affiliateUrl&lt;/code&gt; and &lt;code&gt;offerLink&lt;/code&gt;, if offerLink is empty, then use the affiliateUrl instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current code I'm running is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set affiliateLink = relatedEntry.offerLink ? relatedEntry.affiliateLink : relatedEntry.affiliateUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error Code:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Calling unknown method: craft\elements\Entry::affiliateLink()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The rest of the code is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set affiliateLink = relatedEntry.offerLink ? relatedEntry.affiliateLink : relatedEntry.affiliateUrl %}&#xA;&#xA;&#xA;        {% if relatedEntry.offerCode is empty %}&#xA;          &amp;lt;div class=&quot;utility-vertical-align&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ affiliateLink }}&quot; target=&quot;_blank&quot; class=&quot;btn btn-voucher btn-lg btn-block&quot;&amp;gt;Get This Offer&amp;lt;i class=&quot;material-icons float-sm-right&quot;&amp;gt;chevron_right&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;div class=&quot;utility-vertical-align&quot;&amp;gt;&#xA;            &amp;lt;pre&amp;gt;&#xA;                window.aPopunder = [&#xA;                    ['{{ relatedEntry.offerLink }}']&#xA;                ];&#xA;            &amp;lt;/pre&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ relatedEntry.url }}&quot; target=&quot;_blank&quot; class=&quot;btn btn-voucher btn-lg btn-block&quot; onclick=&quot;$.popunder(this);&quot;&amp;gt;Reveal Code &amp;amp; Visit&amp;lt;i class=&quot;material-icons&quot;&amp;gt;chevron_right&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2018-06-04T19:22:07.007" LastActivityDate="2018-06-04T20:09:38.617" Title="Set Variable if Current Field is Empty" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26413" PostTypeId="2" ParentId="26412" CreationDate="2018-06-04T20:09:38.617" Score="1" Body="&lt;p&gt;Required a different operator &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set affiliateLink = relatedEntry.offerLink ?? relatedEntry.affiliateUrl %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-06-04T20:09:38.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26414" PostTypeId="1" AcceptedAnswerId="26417" CreationDate="2018-06-04T21:06:43.607" Score="1" ViewCount="114" Body="&lt;p&gt;I'm trying to write my first CraftCMS-Plugin.&#xA;It should behave like the &quot;Entries&quot; field, so I inherit from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to allow the user to select existing entries.&#xA;They should just add &quot;news&quot; to the &quot;team&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The user visits his team&lt;/li&gt;&#xA;&lt;li&gt;There are no news assigned to the team yet&lt;/li&gt;&#xA;&lt;li&gt;He clicks the &quot;add&quot; button&lt;/li&gt;&#xA;&lt;li&gt;A new News-Entry is generated (see Screenshot, i like the Quick-Add widget)&lt;/li&gt;&#xA;&lt;li&gt;The News-Entry is automatically &quot;linked&quot; to the Team&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I just don't know how to start.&#xA;The field is already in place and it inherits from &quot;Entries&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I &quot;move&quot; the &quot;Quick-Add&quot; Button from the &quot;Select-Modal&quot; (see screen) to my Field-Type. It seems to just trigger a POST-Request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JGwFA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JGwFA.png&quot; alt=&quot;Quick-Add Button in Select-Modal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an event i can trigger manually or how does this work, how can I hook in?&lt;/p&gt;&#xA;" OwnerUserId="8410" LastActivityDate="2018-06-04T22:21:41.400" Title="Sub-Entries: Adding new Entries on Entries field" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26415" PostTypeId="1" CreationDate="2018-06-04T21:32:47.947" Score="1" ViewCount="285" Body="&lt;p&gt;I have a simple &lt;code&gt;for loop&lt;/code&gt; to get the names of countries from a category.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for name in country %} {{ name.title }} {% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is typically returns the name of 1 country.  But, some entries are associated with more than one country.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Belgium Czech Republic Denmark Greece Netherlands Norway Portugal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I template for an entry that returns 2-N country names by adding &lt;code&gt;&quot;,&quot;&lt;/code&gt; between each country and &lt;code&gt;&quot;and&quot;&lt;/code&gt; before the last country?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I want to output:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Belgium, Czech Republic, Denmark, Greece, Netherlands, Norway and Portugal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-04T22:27:27.150" Title="How do I add commas to an output that returns a list of names?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26416" PostTypeId="2" ParentId="26415" CreationDate="2018-06-04T21:52:27.760" Score="1" Body="&lt;p&gt;You can use &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;loop variables&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set i = country|length %} // number of total items&#xA;{% set indexLast = i - 2 %}  // index of the last comma&#xA;{% for name in country %}&#xA;    {% if loop.last and i &amp;gt; 1 %} and {% endif %}{{ name.title }}{%if i &amp;gt; 2 and loop.index0 &amp;lt; indexLast  %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if there is more than one item and it is the last iteration: add an &lt;code&gt;and&lt;/code&gt; at the beginning&lt;/li&gt;&#xA;&lt;li&gt;if there are more than 2 items (otherwise it's only one &lt;code&gt;and&lt;/code&gt;) and the current loop index is smaller than &lt;code&gt;count - 2&lt;/code&gt; ( it should display nothing in the last iteration and only an &lt;code&gt;and&lt;/code&gt; before the last)-&gt; display a comma &lt;code&gt;,&lt;/code&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-04T22:27:27.150" LastActivityDate="2018-06-04T22:27:27.150" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26417" PostTypeId="2" ParentId="26414" CreationDate="2018-06-04T22:21:41.400" Score="1" Body="&lt;p&gt;The thing you are talking about is a &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/src/js/BaseElementEditor.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft.BaseElementEditor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a working example within all &lt;code&gt;ElementIndex&lt;/code&gt; js &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/assets/cp/src/js/EntryIndex.js#L199&quot; rel=&quot;nofollow noreferrer&quot;&gt;files&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.createElementEditor(this.elementType, {&#xA;    hudTrigger: this.$newCategoryBtnGroup,&#xA;    elementType: 'craft\\elements\\Category',&#xA;    siteId: this.siteId,&#xA;    attributes: {&#xA;        groupId: groupId&#xA;    },&#xA;    onBeginLoading: $.proxy(function() {&#xA;        this.$newCategoryBtn.addClass('loading');&#xA;    }, this),&#xA;    onEndLoading: $.proxy(function() {&#xA;        this.$newCategoryBtn.removeClass('loading');&#xA;    }, this),&#xA;    onHideHud: $.proxy(function() {&#xA;        this.$newCategoryBtn.removeClass('inactive').text(newCategoryBtnText);&#xA;    }, this),&#xA;    onSaveElement: $.proxy(function(response) {&#xA;        // Make sure the right group is selected&#xA;        var groupSourceKey = 'group:' + groupId;&#xA;&#xA;        if (this.sourceKey !== groupSourceKey) {&#xA;            this.selectSourceByKey(groupSourceKey);&#xA;        }&#xA;&#xA;        this.selectElementAfterUpdate(response.id);&#xA;        this.updateElements();&#xA;    }, this)&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it could look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var button = $('#yourButton');&#xA;Craft.createElementEditor('craft\\elements\\Entry', {&#xA;    hudTrigger: button ,&#xA;    elementType: 'craft\\elements\\Entry',&#xA;    siteId: this.siteId,&#xA;    attributes: {&#xA;        sectionId: 1, // &amp;lt;-- insert your section id here&#xA;        typeId: 1 //&amp;lt;-- important, insert your valid type id otherwise it won't work&#xA;    },&#xA;    onBeginLoading: $.proxy(function() {&#xA;        button.addClass('loading');&#xA;    }, this),&#xA;    onEndLoading: $.proxy(function() {&#xA;        button.removeClass('loading');&#xA;    }, this),&#xA;    onHideHud: $.proxy(function() {&#xA;        button.removeClass('inactive').text('New Entry');&#xA;    }, this),&#xA;    onSaveElement: $.proxy(function(response) {&#xA;        // insert the id of the saved element to hidden input&#xA;    }, this)&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-04T22:21:41.400" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26418" PostTypeId="2" ParentId="26402" CreationDate="2018-06-04T22:42:15.650" Score="1" Body="&lt;p&gt;If the two different domains are for the same &quot;site&quot;, i.e. they have common things between them you can share, then yes - you can use one license for them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft's multi-site functionality isn't really designed for sites that have completely content that don't have anything in common in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related documentation: &lt;a href=&quot;https://docs.craftcms.com/v3/sites.html#app&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/sites.html#app&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-04T22:42:15.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26419" PostTypeId="2" ParentId="26403" CreationDate="2018-06-04T22:47:37.770" Score="6" Body="&lt;p&gt;Focal points are used mainly for when Asset transforms (i.e. cropping) are performed in Craft.  They tell Craft where it should focus on the image when performing these actions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-04T22:47:37.770" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26420" PostTypeId="2" ParentId="26410" CreationDate="2018-06-04T23:09:17.577" Score="2" Body="&lt;p&gt;You were close!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just don't use the Twig hash/array syntax when using the &lt;code&gt;|replace&lt;/code&gt; filter if you want Craft to process it as regex.  This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set svg_image_output = svg_image|replace('/#[a-zA-Z0-9]{6}|rgb\\((?:\\s*\\d+\\s*,){2}\\s*[\\d]+\\)|rgba\\((\\s*\\d+\\s*,){3}[\\d\\.]+\\)|hsl\\(\\s*\\d+\\s*(\\s*\\,\\s*\\d+\\%){2}\\)|hsla\\(\\s*\\d+(\\s*,\\s*\\d+\\s*\\%){2}\\s*\\,\\s*[\\d\\.]+\\)/', '****') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-04T23:09:17.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26421" PostTypeId="1" AcceptedAnswerId="26472" CreationDate="2018-06-05T01:01:35.877" Score="1" ViewCount="905" Body="&lt;p&gt;I create a new filed type and attached it to entries. Now I need to get the entry id which the field is attached to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;$this-&amp;gt;element&lt;/code&gt; in my field class, but got an error said that I'm calling an unknown property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to do that please?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-06-08T00:36:04.753" Title="How can I get entry id in field" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26422" PostTypeId="2" ParentId="26421" CreationDate="2018-06-05T02:53:30.857" Score="1" Body="&lt;p&gt;It may depend on where in the request you need to access the element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to access the element in a Field class on your Entry Edit page, the &lt;code&gt;getInputHtml&lt;/code&gt; method may be useful:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    // $element stuff&#xA;&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('my-plugin/field',&#xA;    [&#xA;        'field' =&amp;gt; $this,&#xA;&#xA;        // make the Element available in your field's input template&#xA;        'element' =&amp;gt; $element&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to access the element in a Field class after the Element is saved there is the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-field.html#method-afterelementsave&quot; rel=&quot;nofollow noreferrer&quot;&gt;afterSaveElement&lt;/a&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function afterElementSave(ElementInterface $element, bool $isNew)&#xA;{&#xA;    parent::afterElementSave($element, $isNew);&#xA;&#xA;    // $element stuff&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: The Entry ID may not exist while a new entry is being created. Accessing the Element via the &lt;code&gt;afterElementSave&lt;/code&gt; ensures that the Entry has been saved and has an ID.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-06-06T13:35:26.790" LastActivityDate="2018-06-06T13:35:26.790" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26423" PostTypeId="1" CreationDate="2018-06-05T11:40:34.910" Score="1" ViewCount="2612" Body="&lt;p&gt;We've just switched server for one of our sites and I am now encountering a MySql error on one of our plugins. The MySql version on the new server is 5.7 and throws an error as a field has no default value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we now need to adjust our db model and records to add Null when we define the attributes to any fields that don't have a default value set?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strange thing is when I look at the database table some fields have been set up with 'Allow Null' set and others haven't and these fields are exactly the same type for example in both model and record file I have these 2 fields one has been set to Allow Null the other hasn't??&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'profession' =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;'city'       =&amp;gt;  array(AttributeType::Name, 'maxLength' =&amp;gt; 255, 'required' =&amp;gt; false),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas or suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running latest craft 2.6.3016 on php 7.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2018-06-05T11:59:50.567" Title="MySql 5.7 error - field doesn't have a default value" Tags="&lt;plugin-development&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26424" PostTypeId="2" ParentId="26407" CreationDate="2018-06-05T11:53:38.920" Score="3" Body="&lt;p&gt;In certain cases Twig is unable to recognize the correct object oriented syntax with magic properties so &lt;code&gt;{% if object.property is defined %}&lt;/code&gt; will still produce an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;code&gt;{% if block['backgroundColor'] is defined %}&lt;/code&gt; it seems strange and would usually considered as wrong syntax (PHP wise) but it works in Twig&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-05T11:53:38.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26425" PostTypeId="2" ParentId="26423" CreationDate="2018-06-05T11:59:50.567" Score="3" Body="&lt;p&gt;The &lt;code&gt;STRICT_TRANS_TABLES&lt;/code&gt; mode was added to the default SQL mode in MySQL 5.7.5 and is likely causing the error to be thrown:&lt;br&gt;&#xA;&lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either disable &lt;code&gt;STRICT_TRANS_TABLES&lt;/code&gt; mode in your database (there are plenty of articles explaining how), or add default values to your fields (which I would recommend).&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-06-05T11:59:50.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26426" PostTypeId="1" CreationDate="2018-06-05T13:14:44.503" Score="1" ViewCount="72" Body="&lt;p&gt;I have a component that accepts both hardcoded objects and entry queries. This allows us to have components that can be used independent of the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hardcode include:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_components/callToAction' with {&#xA;    headline: 'Hardcode call to CTA Headline',&#xA;    body: 'Hardcode call to CTA',&#xA;    items: [&#xA;      { name: 'item1'},&#xA;      { name: 'item2'} &#xA;    ]&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db include:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_components/callToAction' with {&#xA;    entry: entry.callToAction&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Component:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set component = {&#xA;  headline: headline ?? entry.headline ?? null,&#xA;  body: body ?? entry.body ?? null,&#xA;  items: items ?? entry.items ?? null&#xA;} %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ component.headline }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;{{ component.body }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% for item in component.items %}&#xA;  {{ item.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both those work fine, but with Craft 3 we're getting deprecation errors for not using &lt;code&gt;.all()&lt;/code&gt; when it is an element query which is drastically increasing our db queries on the pages that use several of these components.&lt;/p&gt;&#xA;" OwnerUserId="3614" LastEditorUserId="3614" LastEditDate="2018-06-06T11:48:19.287" LastActivityDate="2018-06-06T12:10:54.390" Title="For loop that can accept array and element query without throwing .all deprecation error" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26427" PostTypeId="1" CreationDate="2018-06-05T14:28:19.060" Score="2" ViewCount="137" Body="&lt;p&gt;I am making a plugin where I have about 10 tabs at the top.  Depending on the admin users privileges they may see a subset of 1-5 or 6-10 and super admins can see all 10.  The issue I am running into is I built the logic to show appropriate tabs for the user based on their privilege and it works fine.  What I now want to do is include that into an include file so I don't have the 60 lines of code on each of the 10 pages in the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can put it into the main layout template in _layouts/cp but my logic is checking some variables that are set on each page of the plugin.  So if I put it in there none of my variables are set yet so the tabs don't show as nothing will match.  Example _layouts/cp template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if user.superAdmin == &quot;no&quot; %}&#xA;  {% if color == &quot;red&quot; %}&#xA;    {% if usercolor != &quot;red&quot; %}&#xA;      {% redirect redirectUrl %}&#xA;    {% else %}&#xA;      {% set tabs = { &#xA;       red: {label: &quot;red&quot;, url: url('admin/pluginname')},&#xA;       darkred: {label: &quot;dark red&quot;, url: url('admin/pluginname/darkred')}&#xA;       } %}&#xA;    {% endif %}&#xA; {% else %}&#xA;    {% if usercolor != &quot;blue&quot; %}&#xA;       {% redirect redirectUrl %}&#xA;    {% else %}&#xA;      {% set tabs = { &#xA;       blue: {label: &quot;blue&quot;, url: url('admin/pluginname/blue')},&#xA;       darkblue: {label: &quot;dark blue&quot;, url: url('admin/pluginname/darkblue')}&#xA;       } %}&#xA;    {% endif %}&#xA; {% endif %}&#xA;{% else %}&#xA;      {% set tabs = { &#xA;       red: {label: &quot;red&quot;, url: url('admin/pluginname')},&#xA;       darkred: {label: &quot;dark red&quot;, url: url('admin/pluginname/darkred')},&#xA;       blue: {label: &quot;blue&quot;, url: url('admin/pluginname/blue')},&#xA;       darkblue: {label: &quot;dark blue&quot;, url: url('admin/pluginname/darkblue')&#xA;       } %}&#xA;{% endif %}&#xA;&#xA;{% set block('content') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In each template file I will set what color the user is associated to and it should give a different set of tabs.  Example of template file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set redirectUrl = &quot;/admin/pluginname/darkblue&quot; %}&#xA;&#xA;{% set color = &quot;darkred&quot; %}&#xA;&#xA;{% set usercolor = user.userColor %}&#xA;&#xA;{% extends &quot;_layouts/cp&quot; %}&#xA;&#xA;{% set selectedTab = &quot;darkred&quot; %}&#xA;&#xA;{% set content %}&#xA;&#xA;{% endset %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I move all my tab logic in the layout file and put it just below the extends _layout/cp the tabs work fine but not when it is in the layouts file.  I am sure there is an easy fix that I am just missing something but any help would be appreciated.  Not the end of the world if I have to have the tab logic within each template file but not ideal for any future changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8417" LastEditorUserId="8417" LastEditDate="2018-06-05T18:01:18.540" LastActivityDate="2018-06-05T18:01:18.540" Title="Add CP Tab content into include file" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;control-panel&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26431" PostTypeId="1" CreationDate="2018-06-05T18:09:54.547" Score="1" ViewCount="461" Body="&lt;p&gt;when following the information for &lt;a href=&quot;https://docs.craftcms.com/v3/configuration.html#redis&quot; rel=&quot;nofollow noreferrer&quot;&gt;enabling Redis in Craft 3&lt;/a&gt;, my site just refreshes to a blank screen with a &quot;Internal server error&quot; generic message. Reviewing the server logs reveals:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ReflectionException: Class yii\redis\Cache does not exist in /storage/path/www/staging_html/vendor/yiisoft/yii2/di/Container.php:428&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Talking with my hosting provider (Arcustech), informs me that Redis is indeed running and php-redis is installed. The details I entered into &lt;code&gt;config\app.php&lt;/code&gt; were&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;'components' =&amp;gt; [&#xA;    'cache' =&amp;gt; [&#xA;        'class' =&amp;gt; yii\redis\Cache::class,&#xA;        'defaultDuration' =&amp;gt; 86400,&#xA;        'redis' =&amp;gt; [&#xA;            'hostname' =&amp;gt; 'localhost',&#xA;            'port' =&amp;gt; 6379,&#xA;            'database' =&amp;gt; 0,&#xA;        ],&#xA;    ],&#xA;  ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any light that could be shone onto my predicament would be amazing.&#xA;thanks!&lt;/p&gt;&#xA;" OwnerUserId="6086" LastEditorUserId="57" LastEditDate="2018-06-05T23:05:04.583" LastActivityDate="2018-06-06T13:36:05.257" Title="Craft 3 Redis configuration error" Tags="&lt;cache&gt;&lt;php&gt;&lt;redis&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26432" PostTypeId="2" ParentId="26404" CreationDate="2018-06-05T18:24:59.543" Score="2" Body="&lt;p&gt;As @Robin Schambach said, you need to loop through the ancestors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.section('pages').slug('phone-directory') %}&#xA;{% for ancestor in parent.getAncestors() %}&#xA;    {{ ancestor.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This won't output the Phone Directory entry since you're just looping through its ancestors. So to complete the breadcrumbs you'll need to add &#xA;&lt;code&gt;{{ parent.title }}&lt;/code&gt; after the loop.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-06-05T18:24:59.543" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26433" PostTypeId="2" ParentId="26368" CreationDate="2018-06-05T18:44:59.043" Score="1" Body="&lt;p&gt;The input name has changed from &quot;deleteUserPhoto&quot; to &quot;deletePhoto&quot; in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my updated working Twig code if anyone needs it : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    {{ redirectInput('profil/'~currentUser.id) }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;deletePhoto&quot; id=&quot;deleteUserPhotoInput&quot; value=&quot;&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input id=&quot;profilePhotoInput&quot; type=&quot;file&quot; name=&quot;photo&quot; accept=&quot;image/*&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my Javascript code : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.delete-profile-photo-btn').on('click', function () {&#xA;    var deleteUserPhotoInput = $(&quot;#deleteUserPhotoInput&quot;);&#xA;    deleteUserPhotoInput.val('1');&#xA;    deleteUserPhotoInput.parents(&quot;form&quot;).submit();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8165" LastActivityDate="2018-06-05T18:44:59.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26434" PostTypeId="2" ParentId="26049" CreationDate="2018-06-05T19:42:20.247" Score="0" Body="&lt;p&gt;Luke very helpfully got back to me to sort the problem, but in case it helps anyone else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The immediate fix is to disable sending the item bag (cart information to PayPal) and using it purely to change the payment amount. But I will attempt to explain in full below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You disable the cart info being sent to PayPal in your commerce.php settings with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'sendCartInfoToGateways' =&amp;gt; false&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Strangely this is the first time we have seen this issue. But it is due to the following in Commerce:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce stores all values in the system in a single base store currency. This means the cart, the discounts, shipping, and anywhere a currency amount is stored is stored as the default base currency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The payment currency feature is purely designed to allow the charging of the order price in a different currency. The feature allows the customer to know the exact amount to be charged to their card in the currency of their card - without any surprise conversion rate determined by their bank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paypal, when it receives the cart information (line item prices etc) is being supplied amounts in that base currency from commerce. Paypal adds up the cart amounts and compares it to the amount that we want to charge the customer in the chosen payment currency. Obviously, the amount we are changing is in the other currency differs from this total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first the thought might come as a solution to convert the line items amounts to the other currency for PayPal, but this doesn't work; we do the conversion of the totalPrice of the order for the payment currency feature, and converting each line item and adding them up would usually come up with a different total due to rounding.&lt;/p&gt;&#xA;" OwnerUserId="5838" LastActivityDate="2018-06-05T19:42:20.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26435" PostTypeId="2" ParentId="26399" CreationDate="2018-06-05T23:55:55.253" Score="0" Body="&lt;p&gt;I have worked on this for days now. &#xA;Using either:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;\yii\base\Event&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ElementEvent&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Seems to register the event and it fires after a new user is entered.&#xA;That's a good tip though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code currently looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(ElementEvent  $event) {&#xA;        if (Craft::$app-&amp;gt;getUser()-&amp;gt;getIsAdmin() == false){&#xA;            $loggedInUser = Craft::$app-&amp;gt;getUser();&#xA;            $userGroupUser = new UserGroup_User();&#xA;            $loggedInUserGroup = $loggedInUser-&amp;gt;getIdentity()-&amp;gt;getGroups()[0]['id'];&#xA;            $newUserId =  $event-&amp;gt;element['id'];&#xA;            $userGroupUser-&amp;gt;groupId = $loggedInUserGroup;&#xA;            $userGroupUser-&amp;gt;userId = $newUserId;&#xA;            $result = $userGroupUser-&amp;gt;save();&#xA;         }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Things I know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The code fires when I add a new user. I know this by placing a&#xA;breakpoint on any line in the callback function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The callback code will NOT add a new row in the usergroups_users&#xA;table for the brand new entered user. Let's say that user name is&#xA;&quot;Test1&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After I allow the entry process to finish Test1 now shows up in the users table as a user with ID #50. The brand new &quot;Test1&quot; does not show up in the usergroups_uers table even though the callback code executed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next if I change the callback code to use the user ID (50) of the newest user (Test1) that I just entered and then go and create a new user called test &quot;Test2&quot; the callback function will create a record for user &quot;Test1&quot; (user ID 50) will be entered into the usergroups_users table. I will see that record if I examine the usergroups_user table.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(ElementEvent  $event) {&#xA;        if (Craft::$app-&amp;gt;getUser()-&amp;gt;getIsAdmin() == false){&#xA;            $userGroupUser = new UserGroup_User();&#xA;            $userGroupUser-&amp;gt;groupId = 1;&#xA;            $userGroupUser-&amp;gt;userId = 50;&#xA;            $result = $userGroupUser-&amp;gt;save();&#xA;         }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's like the insert for the usergroups_users is silently failing if the user was just entered. It could also be that something was not committed???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to Craft so it could be a noobie error but this one has me stumped.&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2018-06-05T23:55:55.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26436" PostTypeId="1" AcceptedAnswerId="26438" CreationDate="2018-06-06T00:36:14.183" Score="1" ViewCount="481" Body="&lt;p&gt;I'm looking for a way to list all the enabled sites for a given entry. &#xA; I couldn't find some sort of &lt;code&gt;getEnabledSites&lt;/code&gt; method that's similar to the available &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-entry.html#method-getsupportedsites&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;getSupportedSites&lt;/code&gt;&lt;/a&gt;.  The latter only returns the &lt;code&gt;siteId&lt;/code&gt; and &lt;code&gt;enabledByDefault&lt;/code&gt; properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm doing this within the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-06-06T05:28:44.787" Title="Craft 3: get enabled sites of an entry" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26438" PostTypeId="2" ParentId="26436" CreationDate="2018-06-06T05:28:44.787" Score="2" Body="&lt;p&gt;Totally untested but this should work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$enabledSiteIds = (new Query())&#xA;    -&amp;gt;select('siteId')&#xA;    -&amp;gt;from('{{%elements_sites}}')&#xA;    -&amp;gt;where([&#xA;        'enabled' =&amp;gt; true,&#xA;        'elementId' =&amp;gt; $elementId&#xA;    ])&#xA;    -&amp;gt;column();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might want to join the &lt;code&gt;elements&lt;/code&gt; and &lt;code&gt;entries&lt;/code&gt; table in order to gain only elements where &lt;code&gt;elements.enabled&lt;/code&gt; is true too (and check the expiry date), otherwise you'll receive disabled entries&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-06T05:28:44.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26441" PostTypeId="2" ParentId="18348" CreationDate="2018-06-06T06:27:13.700" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% if block.checkboxFieldHandle.contains('someChkbxValue') %}&#xA;&amp;lt;p&amp;gt;Executed!&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;actual for Craft v2.x and v3.x&lt;/p&gt;&#xA;" OwnerUserId="5587" LastActivityDate="2018-06-06T06:27:13.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26442" PostTypeId="2" ParentId="26399" CreationDate="2018-06-06T07:41:56.663" Score="0" Body="&lt;p&gt;I'm not sure what your issue is, the following Code works as expected. Of course you should check if the element is an instance of &lt;code&gt;craft\elements\User&lt;/code&gt; and the user is not already in the group.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    craft\services\Elements::class,&#xA;    craft\services\Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(craft\events\ElementEvent  $event) {&#xA;            $userGroupUser = new craft\records\UserGroup_User();&#xA;            $userGroupUser-&amp;gt;groupId = 1;&#xA;            $userGroupUser-&amp;gt;userId = $event-&amp;gt;element-&amp;gt;getId();&#xA;            if(!$userGroupUser-&amp;gt;save()){&#xA;                Craft::error('Could not save group ' . Json::encode($userGroupUser-&amp;gt;getErrors()));&#xA;            }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-06T08:14:40.187" LastActivityDate="2018-06-06T08:14:40.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26443" PostTypeId="1" AcceptedAnswerId="26445" CreationDate="2018-06-06T09:57:31.467" Score="1" ViewCount="138" Body="&lt;p&gt;I'm trying to create a new plugin for my website in Craft CMS 3, just to do some really basic stuff, like parsing an XML file from an external site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created it using the plugin creator at &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; as per the craft docs. I have only included the controller and variable components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added it in to my composer.json file, run the composer require command and it has successfully been added to the plugins list with my craft install. However, when I go try and install it from the plugins page, I get this error:&#xA;&quot;The use statement with non-compound name 'Craft' has no effect in /var/www/html/[websitename]/plugins/[websitename]/src/[websitename].php at line 15&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the code that has been generated looks like (website name redacted):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;11 namespace \[websitename];&#xA;12  &#xA;13 use \[websitename]\variables\[websitename]Variable;&#xA;14  &#xA;15 use Craft;&#xA;16 use craft\base\Plugin;&#xA;17 use craft\services\Plugins;&#xA;18 use craft\events\PluginEvent;&#xA;19 use craft\web\UrlManager;&#xA;20 use craft\web\twig\variables\CraftVariable;&#xA;21 use craft\events\RegisterUrlRulesEvent;&#xA;22  &#xA;23 use yii\base\Event;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea what is happening here? I've tried reading the plugin docs but I can't see what is going wrong. I assume the plugin creator is generating files correctly, I've used it several times for Craft 2, but this is my first attempt at a Craft 3 plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Jai.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastActivityDate="2018-06-06T11:41:36.080" Title="Exception on trying to install Craft CMS 3 plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26444" PostTypeId="1" CreationDate="2018-06-06T11:06:51.837" Score="1" ViewCount="44" Body="&lt;p&gt;I have a form with a checkbox field. I want the options of the checkbox to be pulled from an entry field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My custom field template is below but it wont pass validation. I guess this is because Sprout looks for the option values to validate but as they are populated from an entry it wont pass??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment the example below is successfully displaying the entry data as options in the checkbox, it just wont allow me to submit the form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if handle == &quot;checkboxes1&quot; %}&#xA;&#xA;        &amp;lt;div&#xA;                {%- if id %} id=&quot;{{ id }}&quot;{% endif %}&#xA;                {%- if class %} class=&quot;{{ class }}&quot;{% endif %}&amp;gt;&#xA;&#xA;            {% if name is defined and (name|length &amp;lt; 3 or name|slice(-2) != '[]') %}&#xA;                &amp;lt;input type=&quot;hidden&quot; aria-hidden=&quot;true&quot; name=&quot;{{ name }}&quot; value=&quot;&quot;&amp;gt;&#xA;            {% endif %}             &#xA;&#xA;                {% for date in entry.eventOccurrences %}                            &#xA;&#xA;                &amp;lt;label for=&quot;checkboxes1-{{ loop.index }}&quot;&amp;gt;&#xA;&#xA;&#xA;                        &amp;lt;input type=&quot;checkbox&quot;&#xA;                        data-value=&quot;{{ date.date }}&quot;&#xA;                                {%- if name %} name=&quot;checkboxes1&quot;{% endif %}&#xA;                                {%- if id %} id=&quot;checkboxes1-{{ loop.index }}&quot;{% endif %}&#xA;                                {%- if value %} value=&quot;value-{{ loop.index }}&quot;{% endif %}&#xA;                        &amp;gt;&#xA;&#xA;                        &amp;amp;nbsp;{{ date.date }}||&#xA;&#xA;                &amp;lt;/label&amp;gt;&#xA;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-06-07T12:30:46.370" Title="Sprout Forms: Populate checkbox field options with entry data" Tags="&lt;plugin-sproutforms&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26445" PostTypeId="2" ParentId="26443" CreationDate="2018-06-06T11:41:36.080" Score="3" Body="&lt;p&gt;Please remove the first &lt;code&gt;\&lt;/code&gt; and include a vendor directory&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;11 namespace [package]\[websitename];&#xA;12 &#xA;13 use [package]\[websitename]\variables\[websitename]Variable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The namespace must always consist the package and the plugin name &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-intro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/plugin-intro.html#primary-plugin-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is an example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace ns\prefix; // &amp;lt;-- see: ns\prefix, not only prefix&#xA;&#xA;class Plugin extends \craft\base\Plugin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-06T11:41:36.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26446" PostTypeId="2" ParentId="26426" CreationDate="2018-06-06T12:03:15.187" Score="1" Body="&lt;p&gt;Instead of trying to loop through an object (your Query) you could just execute it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set component = {&#xA;    headline: headline ?? entry.headline ?? null,&#xA;    body: body ?? entry.body ?? null,&#xA;    items: items ?? entry.items.all() ?? null&#xA;} %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ component.headline }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;{{ component.body }}&amp;lt;/p&amp;gt;&#xA;&#xA;{% for item in component.items %}&#xA;    {{ item.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or if that doesn't fit your case, you can do it before&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedEntry = entry.callToAction.one() %}&#xA;{% include '_components/callToAction' with {&#xA;    entry: relatedEntry,&#xA;    items: relatedEntry.items.all()&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could as well check if your variable is an object of type &lt;code&gt;EntryQuery&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if className(entry) == 'craft\elements\db\EntryQuery' %}&#xA;    {% set entry = entry.one() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: since you had multiple of these deprecated errors I wasn't exactly sure which one you wanted to &quot;solve&quot; and which one is &quot;intended&quot;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-06T12:10:54.390" LastActivityDate="2018-06-06T12:10:54.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26447" PostTypeId="1" CreationDate="2018-06-06T12:20:44.993" Score="2" ViewCount="414" Body="&lt;p&gt;I'm trying to query entries in a section where the (activities) entry has an item in a matrix field timeSlots -&gt; timeSlot -&gt; startDate.&#xA;The startDate must be &gt;= NOW().&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query = Entry::find()-&amp;gt;section('activities');&#xA;&#xA;// something like &#xA;// $query-&amp;gt;where('timeSlots.*.startDate &amp;gt;= NOW()');&#xA;&#xA;$activities = $query-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2018-06-22T12:11:58.050" Title="Element Query matrixfields where" Tags="&lt;matrix&gt;&lt;query&gt;&lt;elementquery&gt;&lt;join&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26448" PostTypeId="2" ParentId="26447" CreationDate="2018-06-06T12:46:11.080" Score="3" Body="&lt;p&gt;You need to &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/db-query-builder#join&quot; rel=&quot;nofollow noreferrer&quot;&gt;join&lt;/a&gt; the &lt;code&gt;matrixblocks&lt;/code&gt; and the specific content table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$query-&amp;gt;join('{{%matrixblocks}}, 'matrixblocks.ownerId = elements.id);&#xA;$query-&amp;gt;join('{{%matrixcontent_your_table_name}}, 'matrixcontent_your_table_name.elementId = matrixblocks.id);&#xA;$query-&amp;gt;andWhere([&#xA;    '&amp;gt;=', &#xA;    'matrixcontent_your_table_name.name-of-the-column', &#xA;    new Expression('NOW()')&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: if you have multiple blocks with the same field handle you'll need to wrap all those in a &lt;code&gt;new OrCondition&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$now = new Expression('NOW()');&#xA;$query-&amp;gt;andWhere(&#xA;    new OrCondition([&#xA;        ['&amp;gt;=', 'column1', $now],&#xA;        ['&amp;gt;=', 'column2', $now],&#xA;        ['&amp;gt;=', 'column3', $now],&#xA;    ])&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit2: I would suggest you to only fetch ids in that query because it's likely to have more results when you join these tables&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-06T12:57:15.960" LastActivityDate="2018-06-06T12:57:15.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26449" PostTypeId="2" ParentId="26345" CreationDate="2018-06-06T13:05:06.747" Score="1" Body="&lt;p&gt;Of course, just create a new asset source (settings &gt; volumes &gt; new volume) &#xA;then in your image field select 'Restrict uploads to a single folder' in your field and then select the asset source you just created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/icjm1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/icjm1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-06-06T13:05:06.747" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26450" PostTypeId="2" ParentId="26431" CreationDate="2018-06-06T13:36:05.257" Score="1" Body="&lt;p&gt;Turns out it was a beginners mistake, thank you to Robin in the comments above for setting me on the right track. All that was required to install was the Yii2 library, once this was done all worked as expected. &lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2018-06-06T13:36:05.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26451" PostTypeId="1" AcceptedAnswerId="26456" CreationDate="2018-06-06T13:41:19.443" Score="2" ViewCount="679" Body="&lt;p&gt;Client is coming from WP and is used to Elementor (&lt;a href=&quot;https://elementor.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://elementor.com/&lt;/a&gt;). Can create own rows, columns, etc. in content. Is there a visual editor for Craft 3? Client hasn't specifically requested but think they'd like more than just rich text.&lt;/p&gt;&#xA;" OwnerUserId="230" LastEditorUserId="57" LastEditDate="2018-06-06T20:27:24.903" LastActivityDate="2018-06-06T20:27:24.903" Title="Visual editor for Craft 3" Tags="&lt;craft3&gt;&lt;editor&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26452" PostTypeId="2" ParentId="26404" CreationDate="2018-06-06T14:45:31.510" Score="2" Body="&lt;p&gt;After much help and direction form @RobinSchambach (much appreciated). I have resolved this as follows;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currentPage = craft.entries.section('pages').slug('archive').first() %}&#xA;{% set currentAncestors = currentPage.getAncestors.find() %}&#xA;{% set crumbs = currentAncestors|merge([currentPage]) %}&#xA;&#xA;{% if entry is defined and entry.section.handle != 'homepage' %}&#xA;{% set object = crumbs ?? entry.ancestors  %}&#xA;{% set crumbs =  object %}&#xA;{% set crumbDivider = '&amp;lt;li&amp;gt;&amp;lt;span class=&quot;mx-3 text-grey text-xs&quot;&amp;gt;/&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;' %}&#xA;&amp;lt;nav class=&quot;mb-8 mx-6&quot;&amp;gt;&#xA;  &amp;lt;ul class=&quot;list-reset flex flex-wrap items-center text-grey-dark text-sm&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;mr-3 text-xs text-grey-light&quot;&amp;gt;You are in:&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% for crumb in crumbs %}&#xA;    {{ crumbDivider|raw }}&#xA;    &amp;lt;li&amp;gt;{{ crumb.getLink() }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    {{ crumbDivider|raw }}&#xA;    &amp;lt;li class=&quot;text-grey-darker&quot;&amp;gt;{{ entry.title ?? category.title }}&amp;lt;/li&amp;gt;&#xA;  &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/nav&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-06-06T14:45:31.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26453" PostTypeId="2" ParentId="26451" CreationDate="2018-06-06T16:54:33.273" Score="2" Body="&lt;p&gt;Yes, you will have to define the elements that the client will manage for a page.&#xA;If you watch the &lt;a href=&quot;https://craftcmsassets.craftcdn.com/images/homepage/live-features-video1.mp4&quot; rel=&quot;nofollow noreferrer&quot;&gt;video in craftcms.com landing page&lt;/a&gt; you can see how that would look like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The elements on the left are the fields that you would define (from a field type) and then you would add them to a Craft section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;strong&gt;rich text&lt;/strong&gt; you have &lt;a href=&quot;https://github.com/craftcms/redactor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor&lt;/a&gt; field type, which you can add to your Craft instance when installing the &lt;strong&gt;Redactor&lt;/strong&gt; plugin in the plugin store.&lt;/p&gt;&#xA;" OwnerUserId="7347" LastEditorUserId="7347" LastEditDate="2018-06-06T17:43:29.413" LastActivityDate="2018-06-06T17:43:29.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26454" PostTypeId="1" AcceptedAnswerId="26455" CreationDate="2018-06-06T17:32:13.737" Score="1" ViewCount="520" Body="&lt;p&gt;I have several custom routes defined on the &lt;code&gt;routes.php&lt;/code&gt; and, as usual, I am resolving the value of the template's &lt;code&gt;entry&lt;/code&gt; in the Twig template when it is not defined (which is when it doesn't match a Craft Route) but I'd like to do it somewhere else before it reaches the template because I want to &lt;strong&gt;remove the logic in Twig&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I add a method to be executed before last Craft's &lt;code&gt;renderTemplate($template, $variables)&lt;/code&gt; in which I would resolve and add $entry to $variables when it's not defined? What's the way to go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you :)&lt;/p&gt;&#xA;" OwnerUserId="7347" LastActivityDate="2018-06-06T18:13:18.767" Title="Resolving the $entry variable for custom routes somewhere but a Twig template" Tags="&lt;routes&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26455" PostTypeId="2" ParentId="26454" CreationDate="2018-06-06T17:59:14.460" Score="5" Body="&lt;p&gt;Alright, if you didn't already create a custom plugin I suggest you to visit &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt; to create the boilerplate. Let's assume your plugin handle is &lt;code&gt;awesome-plugin&lt;/code&gt;, just for testing purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You create a controller with the name &lt;code&gt;RouteController&lt;/code&gt; that contains the function &lt;code&gt;actionMyAwesomeRoute&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;In summary:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;handle&lt;/em&gt;: &lt;code&gt;awesome-plugin&lt;/code&gt;&lt;br&gt;&#xA;&lt;em&gt;controller&lt;/em&gt;: &lt;code&gt;RouteController&lt;/code&gt;&lt;br&gt;&#xA;&lt;em&gt;function&lt;/em&gt;: &lt;code&gt;actionMyAwesomeRoute&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All routes in Craft are defined via &lt;code&gt;plugin-handle/controller-name/function-name&lt;/code&gt; without the &quot;required&quot; parts - and in &lt;code&gt;snake-case&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means your route will be &lt;code&gt;awesome-plugin/route/my-awesome-route&lt;/code&gt; (remove &quot;Controller&quot; and &quot;action&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said: you can register your routes in your Plugins main init function&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Defining the routes&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;&#xA;    Event::on(&#xA;        UrlManager::class,&#xA;        UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;        function(RegisterUrlRulesEvent $event) {&#xA;            // easy route for demonstration&#xA;            $event-&amp;gt;rules[] = [&#xA;                'pattern' =&amp;gt; '/some-nice-url',&#xA;                'route'   =&amp;gt; 'awesome-plugin/route/my-awesome-route'&#xA;            ];&#xA;            // when you visit www.example.com/some-nice-url your function will be executed&#xA;&#xA;            // more complex example if you are not interested&#xA;            // skip that and don't think about it&#xA;            $event-&amp;gt;rules[] = [&#xA;                'pattern' =&amp;gt; 'my-fancy-route/&amp;lt;action:&amp;gt;/&amp;lt;id:\d+&amp;gt;/&amp;lt;siteHandle:\w+&amp;gt;', &#xA;                'route' =&amp;gt; 'awesome-plugin/route/&amp;lt;action&amp;gt;', &#xA;                'defaults' =&amp;gt; [&#xA;                    'id' =&amp;gt; null, &#xA;                    'siteHandle' =&amp;gt; null, &#xA;                    'action' =&amp;gt; 'index'&#xA;                ]&#xA;            ];&#xA;            // you can visit this route via www.example.com/my-fancy-route&#xA;            // this way, your actionIndex will be called&#xA;            // when you do www.example.com/my-fancy-route/foo&#xA;            // Craft tries to call the actionFoo in your Controller&#xA;            // www.example.com/my-fancy-route/bar -&amp;gt; actionBar&#xA;&#xA;            // when you do www.example.com/my-fancy-route/edit/5&#xA;            // your actionEdit will be called and Craft passes 5 as a parameter&#xA;&#xA;            // www.example.com/my-fancy-route/save-entry/9/siteOne&#xA;            // will call actionSaveEntry(9, 'siteOne');&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Your Controller&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionMyAwesomeRoute(){&#xA;    $variables = // define whatever you want&#xA;&#xA;    return $this-&amp;gt;renderTemplate('path/to/template', $variables);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;More complex examples, skip that if you don't need it&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// www.example.com/my-fancy-route/show-entry/9/siteOne&#xA;public function actionShowEntry($id = null, $siteHandle = null){&#xA;    // $id will be 9, $siteHandle 'siteOne' since those parameters&#xA;    // are passed via URL, otherwise they are both null&#xA;    $entry = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($id, $siteHandle);&#xA;&#xA;    return $this-&amp;gt;renderTemplate('path/to/template',  ['entry' =&amp;gt; $entry]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Just a little bit more complex stuff&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You could actually use the default route and inject it with another parameter as well. So When you have an existing route to an entry like &lt;code&gt;news/2018/feb/awesome-news/&lt;/code&gt; you can as well visit this entry with &lt;code&gt;news/2018/feb/awesome-news/fooBar&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;rules[] = [&#xA;    'pattern' =&amp;gt; '/&amp;lt;route:\S+&amp;gt;/&amp;lt;something:\S+&amp;gt;',&#xA;    'route'   =&amp;gt; 'awesome-plugin/route/catch-all'&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your Controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionCatchAll($route, $something){&#xA;    $entry = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementByUri($route);&#xA;    if ($entry instanceof Entry) {&#xA;        $section = $event-&amp;gt;getSection();&#xA;        $siteSettings = $section-&amp;gt;getSiteSettings();&#xA;        foreach ($siteSettings as $site) {&#xA;            if ((int) $site-&amp;gt;siteId === (int) $entry-&amp;gt;siteId) {&#xA;                $templatePath = $site-&amp;gt;template; // the template path for the entry&#xA;                return $this-&amp;gt;renderTemplate(&#xA;                    $templatePath,&#xA;                        [&#xA;                            'entry'     =&amp;gt; $entry,&#xA;                            'whatever'  =&amp;gt; $something&#xA;                        ]&#xA;                    );&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    return Craft::$app-&amp;gt;runAction(Craft::$app-&amp;gt;getRequest()-&amp;gt;getFullPath());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-06T18:13:18.767" LastActivityDate="2018-06-06T18:13:18.767" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26456" PostTypeId="2" ParentId="26451" CreationDate="2018-06-06T18:21:05.360" Score="3" Body="&lt;p&gt;If you are looking for &quot;drag and drop&quot; I would use matrix blocks. You can define text block, image block, video block, etc that would be available in Elementor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you don't get as much out of the box as a plugin, but you are able to define exactly what is available to the client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy coding :)&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-06-06T18:21:05.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26458" PostTypeId="1" AcceptedAnswerId="26460" CreationDate="2018-06-06T19:04:00.767" Score="2" ViewCount="47" Body="&lt;p&gt;I would like to extend the adminCP via plugin to not only show the first related item, but every related item in the list (like categories, or tags etc...) Right now the adminCP is showing only 1 item in the table view&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LvBKT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LvBKT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2018-06-06T20:13:28.063" Title="How can I extend admincp to show all related category not only the first one on the AdminCP list view?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26459" PostTypeId="1" CreationDate="2018-06-06T19:19:33.663" Score="1" ViewCount="168" Body="&lt;p&gt;I am looking to query entries by a field value. The value will be a dynamic variable but i cannot get any results showing with hardcoded state. This is the code i have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $entries = Entry::find()&#xA;  -&amp;gt;section('locations')&#xA;  //-&amp;gt;locationStates('missouri')&#xA;  -&amp;gt;orderBy('title asc')&#xA;  -&amp;gt;where(['field_locationStates' =&amp;gt; 'missuori'])&#xA;  -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have looked at the other relevant answers and at the element query docs but i am getting nothing returning when i search with the field-type. I have also tried looping through the entries and accessing the fields like so &lt;code&gt;$locationEntry-&amp;gt;locationStates&lt;/code&gt;. Is it because the field-type is a multi-select that its causing some issues? &#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8470" LastEditorUserId="8470" LastEditDate="2018-06-06T19:27:30.953" LastActivityDate="2018-06-06T19:27:30.953" Title="How do you query entries by field value for multi-select field type?" Tags="&lt;craft3&gt;&lt;custom-fieldtype&gt;&lt;elementquery&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2018-06-06T20:56:53.900" ContentLicense="CC BY-SA 4.0" />
  <row Id="26460" PostTypeId="2" ParentId="26458" CreationDate="2018-06-06T20:13:28.063" Score="2" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#gettableattributesforsource&quot; rel=&quot;nofollow noreferrer&quot;&gt;getTableAttributesForSource&lt;/a&gt; event&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Entry::class, &#xA;    Element::EVENT_SET_TABLE_ATTRIBUTE_HTML, &#xA;    function(SetElementTableAttributeHtmlEvent $event) {&#xA;    // field: + your field id, you can as well grab all Fields of type &#xA;    // BaseRelationField and collect those ids in an array to get all&#xA;    if ($event-&amp;gt;attribute === 'field:2') { &#xA;        /** @var Entry $entry */&#xA;        $entry = $event-&amp;gt;sender;&#xA;&#xA;        // just a quick example to fetch the titles for all related fields&#xA;        $event-&amp;gt;html = implode(', ', $entry-&amp;gt;getFieldValue('relation')-&amp;gt;select('title')-&amp;gt;column());&#xA;&#xA;        // Prevent other event listeners from getting invoked&#xA;        $event-&amp;gt;handled = true;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the function that renders the usual table html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTableAttributeHtml($value, ElementInterface $element): string&#xA;{&#xA;    if ($value instanceof ElementQueryInterface) {&#xA;        $element = $this-&amp;gt;_all($value)-&amp;gt;one();&#xA;    } else {&#xA;        $element = $value[0] ?? null;&#xA;    }&#xA;&#xA;    if ($element) {&#xA;        return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('_elements/element', [&#xA;            'element' =&amp;gt; $element&#xA;        ]);&#xA;    }&#xA;&#xA;    return '';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-06T20:13:28.063" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26461" PostTypeId="2" ParentId="26447" CreationDate="2018-06-06T21:17:12.730" Score="3" Body="&lt;p&gt;When joining the tables you get more results like you mentioned in Edit2.&#xA;First pick distinct ids, to use later on in the main query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$timeSlotIds = Entry::find()&#xA;    -&amp;gt;section('activities')&#xA;    -&amp;gt;innerJoin('matrixblocks', 'matrixblocks.ownerId = elements.id AND (SELECT enabled FROM elements WHERE matrixblocks.id = elements.id) = 1')&#xA;    -&amp;gt;innerJoin('matrixcontent_timeslots', 'matrixcontent_timeslots.elementId = matrixblocks.id')&#xA;    -&amp;gt;where([&#xA;        '&amp;lt;=', &#xA;        'matrixcontent_timeslots.field_timeSlot_startDate', &#xA;        new Expression('NOW()')&#xA;    ])&#xA;    -&amp;gt;andWhere([&#xA;        '&amp;gt;=', &#xA;        'matrixcontent_timeslots.field_timeSlot_endDate', &#xA;        new Expression('NOW()')&#xA;    ])&#xA;    -&amp;gt;distinct()&#xA;    -&amp;gt;ids();&#xA;&#xA;$query = Entry::find()&#xA;  -&amp;gt;section('activities');&#xA;  -&amp;gt;where(['in', 'elements.id', $timeSlotIds])&#xA;  -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7199" LastEditorUserId="7199" LastEditDate="2018-06-22T12:11:58.050" LastActivityDate="2018-06-22T12:11:58.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26462" PostTypeId="1" CreationDate="2018-06-07T03:21:34.770" Score="2" ViewCount="58" Body="&lt;p&gt;I'm trying to create an archive of PDF newsletters in Craft 3. I want to create a list of entries sorted by month and year. Then each year would appear separately. Finally, I want each asset within the entry to be linked to the month name for download. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get each entry to output by month - but it is not separating by year. I'm also not certain how to call just the asset in this loop. Would it be better to link to an entry and then show the asset there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# all entries sorted by year/month   #}&#xA;{% set allEntries = craft.entries.section('sectionName').limit(null).orderBy('postDate desc') %}&#xA;&#xA;&#xA;  {% for year, entriesInYear in allEntries.all() | group(&quot;postDate.year&quot;) %}&#xA;      &amp;lt;div class=&quot;w-col w-col-medium-3 w-col-3&quot; data-mh=&quot;years&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ year }}&amp;lt;/h3&amp;gt;&#xA;&#xA;        {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot; ) %}&#xA;&#xA;            {% for entry in entries %}&#xA;                {% for asset in entry.file %}&amp;lt;a href=&quot;{{ asset.getUrl }}&quot; class=&quot;w-inline-block&quot;&amp;gt;&#xA;                {% endfor %}&#xA;            {% endfor %} &#xA;&#xA;                {{ month }}&amp;lt;/a&amp;gt; &#xA;&#xA;        {% endfor %}&#xA;&#xA;      &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;div class=&quot;w-col w-col-medium-3 w-col-3&quot; data-mh=&quot;years&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&#xA;&amp;lt;a href=&quot;/media/newsletter-06-2018.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt;             &amp;lt;a href=&quot;/media/newsletter-06-2017.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt;             &amp;lt;a href=&quot;/media/newsletter-06-2016.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt; &#xA;&#xA;June&amp;lt;/a&amp;gt; &#xA;&#xA;&amp;lt;a href=&quot;/media/newsletter-05-2018.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt;             &amp;lt;a href=&quot;/media/newsletter-05-2017.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt;             &amp;lt;a href=&quot;/media/newsletter-05-2016.pdf&quot; class=&quot;w-inline-block&quot;&amp;gt; &#xA;&#xA;May&amp;lt;/a&amp;gt; &#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="877" LastEditDate="2018-06-08T02:47:44.023" LastActivityDate="2018-06-08T02:47:44.023" Title="Creating an archive with linked asset" Tags="&lt;craft3&gt;&lt;archives&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26463" PostTypeId="1" AcceptedAnswerId="26539" CreationDate="2018-06-07T12:20:11.910" Score="4" ViewCount="571" Body="&lt;p&gt;I have a number of assets resources all set to upload to the same amazon s3 bucket. Two of my four assets resources show &quot;An unknown error occurred&quot; twice when I view them in &lt;code&gt;/admin/assets&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PrBWz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PrBWz.png&quot; alt=&quot;an unknown error occurred&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The files in the folder do not show up. In the logs the following error appears: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error: Call to a member function format() on null in /apps/cms/craft/app/helpers/AssetsHelper.php:81&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I click Upload files I can upload files, but they do not show up once the upload has finished (no files are shown). They do get uploaded to s3 though. The message &quot;an unknown error occurred&quot; appears again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subfolders in that same folder show up perfectly and have all of their content visible and it is possible to upload new images without a hitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the top level folders to work again? What could cause this?&lt;/p&gt;&#xA;" OwnerUserId="327" LastEditorUserId="6981" LastEditDate="2018-06-09T04:37:26.397" LastActivityDate="2019-10-11T18:11:13.607" Title="&quot;An unknown error occurred&quot; in assets screen" Tags="&lt;assets&gt;&lt;s3&gt;&lt;filesystem&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26464" PostTypeId="2" ParentId="26444" CreationDate="2018-06-07T12:30:46.370" Score="1" Body="&lt;p&gt;The best way to debug a form field using custom HTML is to output the field you want via the default &lt;code&gt;displayForm&lt;/code&gt; tag and copy the code from there as a starting point:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Output your checkboxes field here and look at the code generated #}&#xA;{{ craft.sproutForms.displayForm('yourFormWithACheckbox') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Test with the default code that is output as your custom HTML and if that works, adjust from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, we recommend using custom HTML with caution as it can increase the complexity of the code on the front-end a great deal.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-06-07T12:30:46.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26466" PostTypeId="1" CreationDate="2018-06-07T15:17:45.097" Score="1" ViewCount="360" Body="&lt;p&gt;I'm wondering what kind of performance I should expect from Craft 3's Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a (clever) structure, where I have matrix field which contains a superTable field.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Matrix&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Row (block type)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Column (superTable)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Style (dropdown)&lt;/li&gt;&#xA;&lt;li&gt;Image (an asset)&lt;/li&gt;&#xA;&lt;li&gt;Text (redactor)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The idea being that I can add rows, and inside the rows I can add a number of columns and fill the column with an image and/or text. From this I create a bootstrap grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is that editing entries get really slow if and when the entry has larger amount of rows and columns. On the worst page I have 24 rows and loading the page makes 362 db queries and takes well over 10 seconds to load all redactor fields. This is way too slow to be usable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/puLKCJh.png&quot; alt=&quot;Control Panel debugger&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/EU0Q3bh.png&quot; alt=&quot;Chrome debugger&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I started again from an empty page, which has fields for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;title&lt;/li&gt;&#xA;&lt;li&gt;categories&lt;/li&gt;&#xA;&lt;li&gt;hero image&lt;/li&gt;&#xA;&lt;li&gt;ingress/description&lt;/li&gt;&#xA;&lt;li&gt;and a button to add rows&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;An empty page creates 116 db queries. Every time I add a new row it adds 9 db queries. Every new column adds 3 db queries. So 10 new rows would create at least 90 new db queries, which is beginning to be problematic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is this the amount of db queries that I should expect, ie. is this normal? Is there something fundamentally wrong in the way I created the fields for the page using matrix and a superTable? What can I do to improve the performance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Running Craft 3.0.10.2 on Windows/IIS and MariaDB)&lt;/p&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="57" LastEditDate="2018-06-07T19:03:57.960" LastActivityDate="2018-06-07T19:03:57.960" Title="Craft 3 CP performance" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26467" PostTypeId="1" CreationDate="2018-06-07T15:20:12.427" Score="1" ViewCount="49" Body="&lt;p&gt;I am trying to load some options in to a checkbox list from another entry so that a user and save select them form a checkbox list but I am unable to save the Entry Form with their selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created the &lt;code&gt;registeredOccurances&lt;/code&gt; checkbox field in the Section, it has no options set as I want to set them on the entry form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[registeredOccurances]&quot; value=&quot;&quot;&amp;gt;    &#xA;    {# Load rows from SuperTable in to checkbox list #}&#xA;    {% for block in entry[dateFieldHandle] %}&#xA;        &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; value=&quot;{{ loop.index }}&quot; name=&quot;fields[registeredOccurances][]&quot;&amp;gt; {{ block.date }}&amp;lt;/label&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if entry is defined %}&#xA;        &amp;lt;p&amp;gt;{{ dump(entry.getErrors()) }}&amp;lt;/p&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The dump is outputting the below, can someone help to interpret it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;array(1) { [&quot;registeredOccurances&quot;]=&amp;gt; array(1) { [0]=&amp;gt; string(33) &quot;Registered Occurances is invalid.&quot; } }&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help :)&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-06-07T17:28:12.690" Title="Entry Form: Populate checkbox list from another entry and save options in entry" Tags="&lt;entry&gt;&lt;checkboxes&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26468" PostTypeId="2" ParentId="26466" CreationDate="2018-06-07T16:41:33.697" Score="3" Body="&lt;p&gt;Is this a problem with only the dashboard, or the front-end also? Although this is a bad answer, waiting a few seconds to load the dashboard shouldn't be a huge deal. You will only need to access it a few times while editing content. On the other hand, there are ways to improve the front-end performance such as &lt;a href=&quot;https://docs.craftcms.com/v2/templating/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eager Loading&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can approach this conceptually by creating a simpler data model. In my opinion, super table inside of a matrix is a sign that you are doing something wrong. There is a reason that matrix in matrix is not supported, probably because of this performance issues like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also extend the dashboard or something to implement eager loading or cut down on db queries but I don't think it is worth the effort. Maybe you can mention something to Pixel and Tonic and they will improve this in a later version of craft.&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-06-07T16:41:33.697" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26469" PostTypeId="2" ParentId="26467" CreationDate="2018-06-07T17:28:12.690" Score="1" Body="&lt;p&gt;Could this be a reserved word? Generally I access fields using &lt;code&gt;entry.registeredOccurances&lt;/code&gt; is there a reason you are using &lt;code&gt;fields[registeredOccurances]&lt;/code&gt; and &lt;code&gt;entry[dateFieldHandle]&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6981" LastActivityDate="2018-06-07T17:28:12.690" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26470" PostTypeId="1" AcceptedAnswerId="26550" CreationDate="2018-06-07T21:01:04.167" Score="2" ViewCount="162" Body="&lt;p&gt;I followed the instructions in the docs at &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#user-photos&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#user-photos&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can browse the User Photos in the User Photos Asset Volume in the Control Panel. However, the User Photos are not linked to their respective User Accounts. I noticed that in the C3 &lt;code&gt;craft_users&lt;/code&gt; table the &lt;code&gt;photoId&lt;/code&gt; col is NULL. I can add an asset ID manually and the User Photo displays in the User Account in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can upload new User Photos in User Accounts in the Users section of the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I link the original Craft 2 User Photos to the User Accounts (ca. 100) in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2020-11-02T19:44:23.610" Title="Craft 2 to Craft 3 upgrade: User Photos not migrated to User Accounts" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;users&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26471" PostTypeId="1" CreationDate="2018-06-07T21:33:08.617" Score="1" ViewCount="202" Body="&lt;p&gt;I am working on a plugin for Craft 3 that will add new matrix data to users profile and keep the old/current data that is in the matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been looking at these but they are for Craft 2 so maybe that's the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9996/updating-user-profile-matrix-block-with-plugin&quot;&gt;Updating user profile matrix block with plugin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9054/creating-a-matrix-entry-with-a-plugin?rq=1&quot;&gt;Creating a matrix entry with a plugin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The below is what I have tried but getting the error &quot;Class 'controllers\MatrixBlockModel' &lt;strong&gt;not found&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$member_id = Craft::$app-&amp;gt;getUser()-&amp;gt;getId();&#xA;$dateCreated = date('Y-m-d H:i:s');&#xA;&#xA;$block = new MatrixBlockModel();&#xA;$block-&amp;gt;fieldId = 77;&#xA;$block-&amp;gt;ownerId = $member_id; //Users ID&#xA;$block-&amp;gt;typeId = 11; //Block Types ID&#xA;$block-&amp;gt;ownerLocale = 'en_us';&#xA;$block-&amp;gt;sortOrder = 1;&#xA;&#xA;$block-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;    'fileDownloaded' =&amp;gt; 'fileDownloadedxxxxprotectedlinks_links',&#xA;    'manufacturer' =&amp;gt; 'manufacturerxxxxprotectedlinks_links',&#xA;    'date' =&amp;gt;  $dateCreated,&#xA;));&#xA;&#xA;$success = Craft::$app-&amp;gt;matrix-&amp;gt;saveBlock($block);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\MatrixBlock;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5838" LastEditorUserId="5838" LastEditDate="2018-06-08T07:41:49.160" LastActivityDate="2018-06-08T07:41:49.160" Title="Updating user profile matrix block with plugin (Craft 3)" Tags="&lt;plugin-development&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26472" PostTypeId="2" ParentId="26421" CreationDate="2018-06-08T00:36:04.753" Score="0" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;Way one:&lt;/em&gt;&lt;/strong&gt;&#xA;Inside the field class, there is a &lt;code&gt;inputTemplateVariables&lt;/code&gt; function with two params, like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function inputTemplateVariables($value = null, ElementInterface $element = null): array&#xA;{&#xA;     $vars = parent::inputTemplateVariables($value, $element);&#xA;&#xA;     $settings = $this-&amp;gt;getSettings();&#xA;&#xA;     //here you can get element&#xA;     $entryId = $element-&amp;gt;id;&#xA;&#xA;     return $vars;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Way two:&lt;/em&gt;&lt;/strong&gt;&#xA;In your plugin's main file, put codes below into &lt;code&gt;init()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook('cp.entries.edit.details', function (&amp;amp;$context) &#xA;{&#xA;&#xA;     //here you can also get the element id&#xA;     //you can save it into session and use it anywhere you need&#xA;     $id = $context['entry']['id'];&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-06-08T00:36:04.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26474" PostTypeId="1" CreationDate="2018-06-08T07:09:51.970" Score="1" ViewCount="303" Body="&lt;p&gt;I'm new to commerce but almost I've cracked all I need to my project but one piece still left.&#xA;I can't display order shipping address. I've tried &#xA;&lt;strong&gt;{{ order.shippingAddressId(shippingAddress) }}&lt;/strong&gt;&#xA;but it giving me order referance number. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;From documentation:&#xA;shippingAddressId #&#xA;The id of the linked shipping address. You can get the shipping address model with the shippingAddress attribute.&#xA;shippingAddress #&#xA;This returns the address model from the database for the current shippingAddressId OR the caches address if the order is complete.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help...&lt;/p&gt;&#xA;" OwnerUserId="8472" LastActivityDate="2018-06-08T16:39:51.387" Title="Commerce - how to display order address in email to customer?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26475" PostTypeId="2" ParentId="26470" CreationDate="2018-06-08T08:10:11.760" Score="1" Body="&lt;p&gt;The migration should have taken care of that. The only scenario where it's not a bug I can imagine is if you ran the migration on a staging server that did not have the actual user photo files and then pushed the DB to live server. If that's not the case, can you get in touch via support@craftcms.com?&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-06-08T08:10:11.760" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26477" PostTypeId="1" AcceptedAnswerId="26478" CreationDate="2018-06-08T12:00:26.107" Score="2" ViewCount="553" Body="&lt;p&gt;I have a Craft 2 site running commerce who have a small issue with the stripe gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;a href=&quot;https://checkout.stripe.com/checkout.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://checkout.stripe.com/checkout.js&lt;/a&gt; instead of the standard stripe markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JS looks like this (inside the standard commerce/payments/pay form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var handler = StripeCheckout.configure({&#xA;    key: '{{ cart.paymentMethod.settings.publishableKey ?? '' }}',&#xA;    image: '',&#xA;    locale: 'auto',&#xA;    token: function(token) {&#xA;        // You can access the token ID with `token.id`.&#xA;        var stripeToken = token.id;&#xA;        // Get the token ID to your server-side code for use.&#xA;        document.getElementById('stripe-token').value = stripeToken;&#xA;        document.getElementById('payment-form').submit();&#xA;    }&#xA;});&#xA;&#xA;document.getElementById('paymentButton').addEventListener('click', function(evt) {&#xA;    // Open Checkout with further options:&#xA;    handler.open({&#xA;        name: '{{ siteName }}',&#xA;        email: '{{ cart.email }}',&#xA;        currency: '{{ cart.paymentCurrency }}',&#xA;        description: 'Membership',&#xA;        amount: {{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true,format=false) * 100 }}&#xA;    });&#xA;    evt.preventDefault();&#xA;});&#xA;&#xA;// Close Checkout on page navigation:&#xA;window.addEventListener('popstate', function() {&#xA;    handler.close();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Currently, in some cases, the card is declined, but the popup from stripe acts as if everything is ok. You get a green check-mark when submitting, and then the checkout page just reloads instead of going to the order overview. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking on network and console in Chrome, and cant see any responses or error messages. And in the basic checkout page from commerce I dont see any error array for the payment gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? On test mode I can reproduce this using card number 4000000000000341. The cart looks like this in the CP:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gqyID.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gqyID.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually when the card gets declined there is a notification in the stripe popup. But not in this case. And as you can see from the picture Craft is well aware that the payment got declined. Is there any way for me to notify the customer of this? Instead of just having the checkout page reload?&lt;/p&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="57" LastEditDate="2018-06-08T21:53:27.377" LastActivityDate="2018-06-08T21:53:27.377" Title="Stripe checkout, card declined but no frontend error" Tags="&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26478" PostTypeId="2" ParentId="26477" CreationDate="2018-06-08T12:58:51.037" Score="5" Body="&lt;p&gt;As usual it is just me being stupid.&#xA;The error is accessible with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set error = craft.session.getFlash('error') %}&#xA;{{ error }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe it will help some other people.&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-06-08T12:58:51.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26479" PostTypeId="1" AcceptedAnswerId="26480" CreationDate="2018-06-08T13:03:02.367" Score="2" ViewCount="375" Body="&lt;p&gt;I'm working on a site that has recently migrated from Craft v2 with Commerce v1 to Craft v3 with Commerce v2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Commerce v1 I was able to update the cart via Ajax and get a data object with the state of the cart as a response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After updating to Craft Commerce v2 the ajax requests fail, returning &lt;code&gt;Status 302 - Redirect&lt;/code&gt; instead of the data object, although the changes to the cart are successful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can add one or more products or change their quantity via Ajax, however, I need the data object in order to properly update the state of the cart without reloading the page.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm running Craft &lt;code&gt;v3.0.10.2&lt;/code&gt; with Craft Commerce from &lt;code&gt;dev-develop&lt;/code&gt; commit &lt;code&gt;1db58f6&lt;/code&gt; on a machine running PHP &lt;code&gt;v7.1.12&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The action I'm using is &lt;code&gt;commerce/cart/update-cart&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The method of all requests is &lt;code&gt;POST&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Any form data should to be ok since the cart updates succesfully&lt;/li&gt;&#xA;&lt;li&gt;All requests are sent with the following headers:&#xA;&lt;code&gt;&#xA;Content-Type: application/x-www-form-urlencoded; charset=UTF-8&#xA;X-Requested-With: XMLHttpRequest&#xA;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm I missing anything new in CC2? Any help would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-06-08T13:08:55.363" Title="302 redirect when updating the cart via Ajax using Craft Commerce 2" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26480" PostTypeId="2" ParentId="26479" CreationDate="2018-06-08T13:08:55.363" Score="5" Body="&lt;p&gt;The function contains this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($request-&amp;gt;getAcceptsJson()) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus you'll need to set the &lt;code&gt;dataType&lt;/code&gt; in your ajax request to &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;text/json&lt;/code&gt; in order to not get redirected. If you didn't set it correctly Craft will treat it as a normal post request instead of an &lt;a href=&quot;http://api.jquery.com/jquery.ajax/&quot; rel=&quot;noreferrer&quot;&gt;ajax&lt;/a&gt; request &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-08T13:08:55.363" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26481" PostTypeId="1" AcceptedAnswerId="26482" CreationDate="2018-06-08T13:37:38.110" Score="4" ViewCount="1190" Body="&lt;p&gt;The option for opening a link in the Redactor WYSIWYG no longer includes a field for opening it in a new tab? I haven't been able to find any docs that indicate any options for the Redactor config file to add this back in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OfPJp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OfPJp.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-06-08T13:53:13.893" Title="Craft 3 Redactor Link no longer has target option" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;wysiwyg&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26482" PostTypeId="2" ParentId="26481" CreationDate="2018-06-08T13:53:13.893" Score="12" Body="&lt;p&gt;Add the &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/link/#s-linknewtab&quot; rel=&quot;noreferrer&quot;&gt;linkNewTab&lt;/a&gt; config option to the Redactor config you're using:&#xA;So, that would become something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [...],&#xA;    &quot;plugins&quot;: [...],&#xA;    &quot;linkNewTab&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-06-08T13:53:13.893" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26483" PostTypeId="1" CreationDate="2018-06-08T13:59:32.430" Score="2" ViewCount="960" Body="&lt;p&gt;In Craft 2 there used to be a &lt;code&gt;Nested Entries&lt;/code&gt; field, but this is not available in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can do &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt; in the &lt;code&gt;Entry URI Format&lt;/code&gt; field, but if I want it to be appended by something static it doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;code&gt;static/{parent.uri}/{slug}&lt;/code&gt; doesn't work because children uri sets to &lt;code&gt;static/static/parent/child&lt;/code&gt; (edited)&lt;/p&gt;&#xA;" OwnerUserId="3652" LastEditorUserId="3652" LastEditDate="2018-06-08T14:11:51.897" LastActivityDate="2019-07-30T00:53:48.547" Title="Nested Entries in Craft 3" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;structure&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26484" PostTypeId="2" ParentId="26483" CreationDate="2018-06-08T14:10:44.333" Score="8" Body="&lt;p&gt;I kind of found a work around, but doesn't seem like it's the correct way to be doing this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri ? parent.uri : 'static'}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3652" LastActivityDate="2018-06-08T14:10:44.333" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26485" PostTypeId="1" CreationDate="2018-06-08T16:02:48.690" Score="1" ViewCount="1447" Body="&lt;p&gt;I'm developing my first website on Craft 3 and I'm essentially a front-end designer so my PHP/MySQL/AJAX knowledge is extremely limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I installed the Contact Form plugin as explained here &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt; and used the code example on the page (minus the redirectInput).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;        {{ redirectInput('contact/thanks') }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-name&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-email&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{{ message.subject ?? '' }}&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{{ message.message ?? '' }}&amp;lt;/textarea&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I submit my form, the page reloads then zwoooosh, nothing happens! I can't tell if I'm not receiving the email or if it's not even being sent. I checked pretty much everywhere for similar issues but can't tell what's happening or not happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't install any mail server on Ubuntu, I don't even know if that is necessary. I checked my Spam folder... I'm a bit lost at this point!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would... help!&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2018-06-08T16:20:45.837" Title="Contact Form Plugin - Not sending/receiving emails?" Tags="&lt;craft3&gt;&lt;emails&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26486" PostTypeId="1" AcceptedAnswerId="26492" CreationDate="2018-06-08T16:18:23.607" Score="2" ViewCount="2319" Body="&lt;p&gt;I'm getting an error when trying to access an endpoint over ssl in FeedMe. eg &lt;a href=&quot;https://jsonplaceholder.typicode.com/posts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://jsonplaceholder.typicode.com/posts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is&#xA;&lt;code&gt;cURL error 35: SSL connect error&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error reported in web.log is&#xA;&lt;code&gt;[verbb\feedme\base\PluginTrait::error] Test: Unable to reach https://jsonplaceholder.typicode.com/posts. Message: cURL error 35: SSL connect error (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried running curl directly from commandline on the server and it runs fine:&#xA;&lt;code&gt;curl https://jsonplaceholder.typicode.com/posts&lt;/code&gt; prints the JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;PHP: 7.2.5&lt;/code&gt;&#xA;&lt;code&gt;cURL: 7.19.7&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8387" LastActivityDate="2018-06-08T21:59:07.340" Title="FeedMe SSL error - cURL error 35: SSL connect error" Tags="&lt;plugin-feedme&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26487" PostTypeId="2" ParentId="26485" CreationDate="2018-06-08T16:20:45.837" Score="1" Body="&lt;p&gt;Welcome to Craft!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention you haven't configured any kind of mail server—this is almost certainly the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few mailer adapters for Craft, the availability of which will depend on whether you're using Craft 2 or Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, the easiest route will probably be to use the built-in SMTP method, configured in the &lt;code&gt;Settings -&amp;gt; Email&lt;/code&gt; screen of the Admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend checking out &lt;a href=&quot;https://mailgun.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mailgun&lt;/a&gt; or &lt;a href=&quot;http://sendgrid.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sendgrid&lt;/a&gt; as third-party services that handle mail delivery—this way, you're not responsible for maintaining your own mail server. Both offer generous free tiers that should cover most use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each should provide you with some SMTP credentials you can drop into Craft's settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware: some ISPs will block SMTP traffic over the standard port. If you still have trouble sending mail, look at the docs for your chosen provider and see if they support sending over an alternate port.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-08T16:20:45.837" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26488" PostTypeId="1" AcceptedAnswerId="26490" CreationDate="2018-06-08T16:27:46.040" Score="1" ViewCount="251" Body="&lt;p&gt;Just updated Craft 2.6.3002 to 2.6.3017 and am getting the following error in the CP &amp;amp; front-end: &lt;code&gt;Call to undefined function Craft\mb_convertOcase()&lt;/code&gt; &lt;code&gt;/craft/app/helpers/StringHelper.php(558)&lt;/code&gt;. On line 558 of this file, I have &lt;code&gt;return mb_convert_case($string, MB_CASE_UPPER, static::UTF8);&lt;/code&gt;. Where is &lt;code&gt;O&lt;/code&gt; coming from?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot of error &amp;amp; stack trace: &lt;a href=&quot;https://i.stack.imgur.com/GqZkh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GqZkh.png&quot; alt=&quot;Screenshot of error &amp;amp; stack trace&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-06-08T16:48:45.330" LastActivityDate="2018-06-08T17:55:40.830" Title="Error: Call to undefined function Craft\mb_convertOcase() after updating to 2.6.3017" Tags="&lt;updating&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-06-13T19:36:13.423" ContentLicense="CC BY-SA 4.0" />
  <row Id="26489" PostTypeId="2" ParentId="26474" CreationDate="2018-06-08T16:39:51.387" Score="2" Body="&lt;p&gt;Sounds like &lt;code&gt;order.shippingAddress&lt;/code&gt; is all you need!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orderAddress = order.shippingAddress %}&#xA;&#xA;{{ orderAddress.firstName }}&#xA;{{ orderAddress.lastName }}&#xA;{{ orderAddress.address1 }}&#xA;{# ...etc! #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-08T16:39:51.387" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26490" PostTypeId="2" ParentId="26488" CreationDate="2018-06-08T17:55:40.830" Score="1" Body="&lt;p&gt;I performed a manual upgrade as documented at &lt;a href=&quot;https://docs.craftcms.com/v2/updating.html#manually-updating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/updating.html#manually-updating&lt;/a&gt; and the error automagically disappeared. Therefore, it looks like there was a glitch in the One-click Updating in this particular case.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-06-08T17:55:40.830" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26492" PostTypeId="2" ParentId="26486" CreationDate="2018-06-08T21:59:07.340" Score="1" Body="&lt;p&gt;Most likely the &lt;a href=&quot;https://secure.php.net/manual/en/book.curl.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP curl&lt;/a&gt; version that's on your box is trying to connect to the endpoint using an older SSL protocol (TLS 1.0, 1.1, etc.) and the endpoint requires something higher (TLS 1.2, 1.3, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.techstacks.com/2010/03/3-common-causes-of-unknown-ssl-protocol-errors-with-curl.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://blog.techstacks.com/2010/03/3-common-causes-of-unknown-ssl-protocol-errors-with-curl.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The command line version of &lt;code&gt;curl&lt;/code&gt; is probably using a newer protocol.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-08T21:59:07.340" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26493" PostTypeId="1" AcceptedAnswerId="26498" CreationDate="2018-06-09T15:16:29.697" Score="2" ViewCount="427" Body="&lt;p&gt;Does anybody know of a collection or library of Yii Modules online?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand how easy they can be moved from one application to another, are we going to see something similar to the plugin store for modules within Craft? :O&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2018-06-09T23:19:31.020" Title="Yii Modules in Craft, samples?" Tags="&lt;yii&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26494" PostTypeId="1" CreationDate="2018-06-09T17:21:46.020" Score="2" ViewCount="76" Body="&lt;p&gt;I have implemented the standard search form at:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v2/templating/search-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/search-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and added fuzzy searching:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;search: {&#xA;    query: query,&#xA;    subLeft: true,&#xA;    subRight: true&#xA;}&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as per:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/searching.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this works well for finding entries using a single search word, even if it is misspelled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I need to be able to find entries that contain more than one search term, eg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Toronto AND French&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for that I get &quot;No results found&quot; in search results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Searching for &quot;Toronto French&quot; will result in &quot;Your search for “Toronto French” didn’t return any results.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/searching.html&lt;/a&gt;&#xA;Does describe an OR search:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;salty OR dog  containing either “salty” or “dog” (or both).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I do not seem to be able to find a way to AND...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much thanks ahead of time......&lt;/p&gt;&#xA;" OwnerUserId="8278" LastEditorUserId="8278" LastEditDate="2018-06-09T18:58:36.773" LastActivityDate="2018-06-11T18:09:22.680" Title="ANDing search terms" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26497" PostTypeId="1" AcceptedAnswerId="26509" CreationDate="2018-06-09T23:04:27.967" Score="2" ViewCount="919" Body="&lt;p&gt;Just upgraded a website for the first time to Craft 3.&#xA;I had a matrix field called bodyContent which is basically my page builder.&#xA;Issue is not when creating new pages it the only blocks it seems to pick up are the Redactor Field Blocks - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plain text, fields not nothing else display on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my template pages if I try to find the number of blocks - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.bodyContent|length }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It displays say only 2 if there are 2 rich text fields - it seems to ignore the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other blocks are generic headers, plain text fields, assets fields for images/documents etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I view the entry int he CMS all the blocks are still there - though they don't display in Live Preview either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really not sure even where to start with this one.  Tried resaving the Matrix Field etc but no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit - &#xA;After some more searching thinking it may be related to this:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/25613/missing-matrix-row-types-on-output-after-upgrade-to-craft-3-subsetting-and-clon&quot;&gt;Missing Matrix row types on output after upgrade to Craft 3 (subsetting and cloning ElementQueries)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Existing Code block for outputting the matrix field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if matrixfield is not defined %}&#xA;        {% set matrixfield=entry.bodyContent %}&#xA;    {% endif %}&#xA;    {{ matrixfield|length }}&#xA;    {% for block in matrixfield.all() %}&#xA;        {{ block.type }}&#xA;        {% include &quot;includes/matrix-blocks/&quot; ~ block.type %}   &#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folliwing coments below that can use Elementquery.getRawSql() i tried the following:&#xA;Ok - on outputting: &lt;code&gt;{{ entry.bodyContent.getRawSql() }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`SELECT `elements`.`id`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`slug`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, `matrixblocks`.`fieldId`, `matrixblocks`.`ownerId`, `matrixblocks`.`ownerSiteId`, `matrixblocks`.`typeId`, `matrixblocks`.`sortOrder`, `content`.`id` AS `contentId`, `content`.`field_heading_size`, `content`.`field_heading_heading`, `content`.`field_text_text`, `content`.`field_image_caption`, `content`.`field_image_position`, `content`.`field_video_videoUrl`, `content`.`field_gallery_layout`, `content`.`field_gallery_galleryType`, `content`.`field_textImageSection_sectionHeading`, `content`.`field_textImageSection_imageColumnPosition`, `content`.`field_textImageSection_imageFullHeight`, `content`.`field_textImageSection_text`, `content`.`field_textImageSection_imageColumnWidth`, `content`.`field_textImageSection_lightboxOnImage`, `content`.`field_staticBlock_staticBlock`, `content`.`field_plainTextHtml_plainTextHtml` FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId` FROM `craft_elements` `elements` INNER JOIN `craft_matrixblocks` `matrixblocks` ON `matrixblocks`.`id` = `elements`.`id` INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id` INNER JOIN `craft_matrixcontent_bodycontent` `content` ON `content`.`elementId` = `elements`.`id` WHERE (`matrixblocks`.`fieldId`='16') AND (`matrixblocks`.`ownerId`='109') AND (`matrixblocks`.`typeId`='3') AND (`elements_sites`.`siteId`=1) AND (`content`.`siteId`=1) AND (`elements`.`archived`=FALSE) ORDER BY `matrixblocks`.`sortOrder`) `subquery` INNER JOIN `craft_matrixblocks` `matrixblocks` ON `matrixblocks`.`id` = `subquery`.`elementsId` INNER JOIN `craft_elements` `elements` ON `elements`.`id` = `subquery`.`elementsId` INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId` INNER JOIN `craft_matrixcontent_bodycontent` `content` ON `content`.`id` = `subquery`.`contentId` ORDER BY `matrixblocks`.`sortOrder`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Near the end of that I notice a bit&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AND (`matrixblocks`.`typeId`='3')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that only pulling in the block of 1 type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;In my header I had been pulling in a meta description with the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.bodyContent|length %}&#xA;   {% set customdescription = entry.bodyContent.type('text').one()|striptags|slice(0, 155) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which was manipulating for the code below. I resolved by using the clone option in my header like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodycontent = entry.bodyContent %}&#xA;{% if bodycontent|length %}&#xA;   {% set customdescription = clone(bodycontent).type('text').one()|striptags|slice(0, 155) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="622" LastEditDate="2018-06-11T05:59:55.980" LastActivityDate="2018-06-11T06:38:01.537" Title="Matrix field not displaying all blocks on Craft 3 Upgrade" Tags="&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="26498" PostTypeId="2" ParentId="26493" CreationDate="2018-06-09T23:19:31.020" Score="2" Body="&lt;p&gt;In the context of Craft CMS, Modules typically would be used for adding functionality to the website itself. As such, you'd use it for things that are specific to that project. Check out the article &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt; for details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also generate your module scaffolding via &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-06-09T23:19:31.020" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26499" PostTypeId="1" AcceptedAnswerId="26523" CreationDate="2018-06-10T01:25:24.863" Score="1" ViewCount="276" Body="&lt;p&gt;I have a fresh LAMP instance based on a bitnami image on AWS. All server requirements are met for Craft 2, but I'm getting a 500 error when trying to hit the site:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;site.com is currently unable to handle this request. HTTP ERROR 500&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Seeing this in the error log:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Uncaught Error: Call to a member function run() on integer&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've done separate db tests for pdo and mysqli -- connectivity seems fine. Permissions all look correct (774). Any thoughts on what could be causing?&lt;/p&gt;&#xA;" OwnerUserId="8476" LastActivityDate="2018-06-12T03:53:07.367" Title="500 Error on AWS bitnami instance" Tags="&lt;error-message&gt;&lt;install&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26500" PostTypeId="1" CreationDate="2018-06-10T02:56:29.690" Score="1" ViewCount="265" Body="&lt;p&gt;I'm building a system which should have two parts CMS using craft cms 2.6.x. and Yii2 for logical modules and administration. I want to login to CMS directly once the user has logged into yii2 system. How can I do that? I can pass uid which in craft_user table. I need to build an API function but where shall I start? &#xA;Plus is this a good practice or there is something else I can do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;" OwnerUserId="8477" LastActivityDate="2018-06-10T06:32:02.643" Title="API Authentication for Craft CMS" Tags="&lt;authentication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26501" PostTypeId="2" ParentId="26500" CreationDate="2018-06-10T06:32:02.643" Score="2" Body="&lt;p&gt;You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple custom changes when you want to drop the native Craft user registration and replace it with Yii2 (less powerful) user registration. (what's wrong about Crafts one?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have certain reasons why you are not going to use existing ways? I can't think of a &quot;fast and easy&quot; way to achieve your goal, especially if you are new to Craft because it's a lot of work to drop existing login/registration mechanisms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example how to register users with Craft methods &lt;a href=&quot;https://docs.craftcms.com/v3/templating/examples/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/templating/examples/user-registration-form.html&lt;/a&gt; you can include the permission to give them CP access and redirect them there &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-10T06:32:02.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26502" PostTypeId="1" CreationDate="2018-06-10T17:49:37.783" Score="2" ViewCount="1440" Body="&lt;p&gt;How do you make breadcrumbs in your Twig templates for Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I found examples only for Craft 2&lt;/p&gt;&#xA;" OwnerUserId="8479" LastEditorUserId="57" LastEditDate="2018-06-11T18:30:12.887" LastActivityDate="2019-04-15T01:57:11.257" Title="Breadcrumbs for Craft 3" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26503" PostTypeId="1" CreationDate="2018-06-10T18:17:08.070" Score="1" ViewCount="221" Body="&lt;p&gt;I am currently building an intranet for a client and one of their requirements is that staff must update their passwords every 90 days. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I would need to build a plugin for this, but what would be best to way to approach this? I was hoping it might work whereby this was set 90 days after the last password change, rather than a fixed date for every user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-06-10T18:56:16.950" Title="Enforce password change every 90 days (3 months)" Tags="&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26504" PostTypeId="2" ParentId="26503" CreationDate="2018-06-10T18:56:16.950" Score="2" Body="&lt;pre&gt;&lt;code&gt;$date90DaysAgo = (new \DateTime())-&amp;gt;modify('90 days ago')-&amp;gt;format('Y-m-d H:i:s');&#xA;foreach(\craft\elements\User::find()-&amp;gt;lastPasswordChangeDate('&amp;lt;='.$date90DaysAgo)-&amp;gt;all() as $user){&#xA;    Craft::$app-&amp;gt;getUsers()-&amp;gt;sendPasswordResetEmail($user);&#xA;    $user-&amp;gt;newPassword = // generate some temp password, so the user can't login with his/her anymore&#xA;    $user-&amp;gt;setScenario(User::SCENARIO_PASSWORD);&#xA;    Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;get the date 90 days ago, find all users where &lt;code&gt;lastPasswordChangeDate&lt;/code&gt; is smaller than this date, send them a new password reset email and change their password to something else, so they can't login anymore.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-10T18:56:16.950" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26505" PostTypeId="1" CreationDate="2018-06-11T00:07:17.467" Score="1" ViewCount="46" Body="&lt;p&gt;I would like to add a second default template field for each section's Site Settings, via plugin. Where would I look to see how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I access this value in my plugin's code? How would I parse the template path to use to render an entry?&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2018-06-11T00:07:17.467" Title="Add a second template field in section settings via plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugins&gt;&lt;control-panel&gt;&lt;settings&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26506" PostTypeId="1" CreationDate="2018-06-11T00:10:34.477" Score="2" ViewCount="392" Body="&lt;p&gt;I would like to add a button to the edit entry screen, only for already saved entries, alongside the &quot;Share&quot; button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When clicked, I'd like to call my plugin's controller action and post the entry ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where would I look to see how to do this?&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2019-01-20T19:21:47.177" Title="Add a button to the entry edit screen via plugin" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;control-panel&gt;&lt;controller&gt;&lt;editing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26507" PostTypeId="2" ParentId="26506" CreationDate="2018-06-11T00:40:55.213" Score="1" Body="&lt;p&gt;Not sure if you can put it next to the Share button, but check out the &lt;strong&gt;Triggers&lt;/strong&gt; feature of Button Box...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/supercool/buttonbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/supercool/buttonbox&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can create a &quot;Triggers&quot; field, which is just a button that hooks up to JS. Then use the JS to ping your Controller via AJAX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The button exists as a &lt;em&gt;field&lt;/em&gt;, so you could just put that field at the top of your field layout. It's not well documented, but it's really easy to do.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-11T00:40:55.213" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26508" PostTypeId="2" ParentId="26502" CreationDate="2018-06-11T02:04:22.320" Score="4" Body="&lt;p&gt;When it comes to creating breadcrumbs, I can only offer advice when doing so within a structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 still has &lt;code&gt;.ancestors&lt;/code&gt; available on an entry so you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set breadcrumbs = entry.ancestors.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then check the length and loop through the ancestors for the structure entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if breadcrumbs|length %}&#xA;    &amp;lt;ul class=&quot;breadcrumbs&quot;&amp;gt;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% for crumb in breadcrumbs %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ crumb.url }}&quot;&amp;gt;{{ crumb.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;li&amp;gt;{{ entry.title }}&amp;lt;/li&amp;gt;&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then just add a little CSS to style as you choose.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;style&amp;gt;&#xA;  .breadcrumbs {&#xA;    list-style: none;&#xA;    padding: 0;&#xA;    margin: 0;&#xA;  }&#xA;&#xA;  .breadcrumbs li { display: inline; }&#xA;  .breadcrumbs li+li:before {&#xA;    padding: 8px;&#xA;    color: black;&#xA;    content: &quot;\000BB&quot;;&#xA;  }&#xA;&amp;lt;/style&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would use &lt;code&gt;&amp;amp;raquo;&lt;/code&gt; between each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Home » First Article » Another Article » Grandchild Article&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2018-06-11T10:11:16.177" LastActivityDate="2018-06-11T10:11:16.177" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26509" PostTypeId="2" ParentId="26497" CreationDate="2018-06-11T06:38:01.537" Score="2" Body="&lt;p&gt;If you manipulate your query somewhere else in the code those properties will not reset after you execute it. You'll either reset the properties (for example &lt;code&gt;query.typeId(null).all()&lt;/code&gt; or you need the &lt;code&gt;clone&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#cloning-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;function&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-11T06:38:01.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26511" PostTypeId="1" AcceptedAnswerId="26512" CreationDate="2018-06-11T09:29:39.993" Score="3" ViewCount="680" Body="&lt;p&gt;In a Matrix block field of a &quot;page&quot; entry, I'm using an &lt;code&gt;Entries field&lt;/code&gt; to manually select a list of &quot;article&quot; entries to the &quot;page&quot; entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I query an &quot;article&quot; entry, is it possible to query its &quot;parent&quot; page entry that's connected using the above method or do I have to use categories?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW it'd be appreciated if the solution is written for the Element API plugin or PHP code if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: edited question to be more accurate by adding the Matrix details.  Also, the correct query would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()-&amp;gt;section('page')-&amp;gt;relatedTo([&#xA;    'targetElement' =&amp;gt; $article,&#xA;    'field' =&amp;gt; 'articleSections.articles'&#xA;])-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="4646" LastEditDate="2018-06-11T12:23:06.803" LastActivityDate="2018-06-11T12:27:43.527" Title="Craft 3 Element API: Query the &quot;parent&quot; entry of a &quot;child&quot; entry with Matrix blocks connected by an 'Entries' field" Tags="&lt;craft3&gt;&lt;relations&gt;&lt;plugin-elementapi&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26512" PostTypeId="2" ParentId="26511" CreationDate="2018-06-11T09:43:27.467" Score="3" Body="&lt;pre&gt;&lt;code&gt;$page = Entry::find()&#xA;    -&amp;gt;relatedTo([&#xA;        'targetElement' =&amp;gt; $article, &#xA;        'field'         =&amp;gt; 'articleSections.articles' &#xA;    ])&#xA;    -&amp;gt;section('page')-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please read the docs about &lt;a href=&quot;https://docs.craftcms.com/v3/element-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQueries&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the Element API Creates an &lt;code&gt;ElementQuery&lt;/code&gt; from your &lt;code&gt;criteria&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;criteria =&amp;gt; [&#xA;    'sectionId' =&amp;gt; 4,&#xA;    'typeId'    =&amp;gt; 1&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the same as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()-&amp;gt;sectionId(4)-&amp;gt;typeId(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-11T12:27:43.527" LastActivityDate="2018-06-11T12:27:43.527" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26513" PostTypeId="1" AcceptedAnswerId="26530" CreationDate="2018-06-11T09:53:05.597" Score="1" ViewCount="70" Body="&lt;p&gt;For example, an endpoint to retrieve all the languages available on the website&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [   &#xA;   'languages' =&amp;gt; function () {&#xA;&#xA;            $sites = Craft::$app-&amp;gt;getSites()-&amp;gt;getAllGroups();&#xA;&#xA;            $languages = Craft::$app-&amp;gt;getSites()-&amp;gt;getSitesByGroupId($sites[array_search('Languages', $sites)]['id']);&#xA;&#xA;            Craft::dd($languages); // output this in a nice json&#xA;&#xA;            return $languages;&#xA;        },&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or an endpoint to retrieve all the available sections&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'sections' =&amp;gt; function () {&#xA;&#xA;            $sections = Craft::$app-&amp;gt;getSections()-&amp;gt;getAllSections();&#xA;&#xA;            Craft::dd($sections); // output this in a nice json&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-06-12T15:32:06.090" Title="Can I output custom or specific data (Not related to an elementType) on Element API?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26514" PostTypeId="1" AcceptedAnswerId="26519" CreationDate="2018-06-11T12:07:42.687" Score="1" ViewCount="642" Body="&lt;p&gt;Is it possible to auto-generate PDF preview images with Craft 3 transforms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or are there any Craft 3 plugins that do this? I see a few Craft 2 versions.&lt;/p&gt;&#xA;" OwnerUserId="5838" LastEditorUserId="57" LastEditDate="2018-06-11T18:48:16.387" LastActivityDate="2019-01-10T08:48:10.593" Title="Generate previews of PDF files (Craft 3)" Tags="&lt;craft3&gt;&lt;pdf&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26515" PostTypeId="1" AcceptedAnswerId="26526" CreationDate="2018-06-11T12:29:25.550" Score="2" ViewCount="973" Body="&lt;p&gt;So I'm trying to get my Matrix as JSON with the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS Element API&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use Craft\elements\Entry;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/sites' =&amp;gt; [&#xA;            'elementType' =&amp;gt; craft\elements\Entry::class,&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'sites'],&#xA;            'elementsPerPage' =&amp;gt; 1,&#xA;            'transformer' =&amp;gt; function(Entry $entry) {&#xA;                $matrixBlocks =[];&#xA;                foreach ($entry-&amp;gt;contentMatrix as $block) {&#xA;                    switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                        case 'sectionTitleBlock':&#xA;                            $matrixBlocks[] = [&#xA;                                'content' =&amp;gt; $block-&amp;gt;sectionTitleBlock&#xA;                            ];&#xA;                            break;&#xA;                    }&#xA;                }&#xA;                return [&#xA;                    'matrix' =&amp;gt; $matrixBlocks,&#xA;                ];&#xA;            },&#xA;            'paginate' =&amp;gt; false,&#xA;            'pretty' =&amp;gt; true,&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message im getting is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;error&quot;: {&#xA;      &quot;code&quot;: 2,&#xA;      &quot;message&quot;: &quot;Invalid argument supplied for foreach()&quot;&#xA;    }&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think the problem is that &lt;code&gt;$entry-&amp;gt;contentMatrix&lt;/code&gt; is giving me a MatrixBlockQuery Element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;$sectionTitleBlock is a normal text field&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8219" LastEditorUserId="57" LastEditDate="2018-06-11T18:50:35.437" LastActivityDate="2018-06-12T11:40:46.170" Title="Element API: Get Matrix Content" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26517" PostTypeId="1" CreationDate="2018-06-11T15:01:44.863" Score="1" ViewCount="1387" Body="&lt;p&gt;for last weeks really I try to install composer, but it keeps complaining about SSL-problems. I searched everywhere on Google and found lots of people having the same problems, but for some reason they found solutions which don't work here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really need to install composer, 'cause I like to use Craft 3, but whatever I try, it's not working. There is no composer-forum, and I guess all you guys needed to use composer to install Craft 3 too, so I hope somebody here can help. I'm really out of ideas at the moment...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SETUP VIA WINDOWS INSTALLER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Download and run windows installer Composer 1.6.5: &lt;a href=&quot;https://getcomposer.org/download/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/download/&lt;/a&gt; &#xA;I see the path is pointing to the right php.exe (and the same php I use on wamp server). I don't use a proxy.&lt;/li&gt;&#xA;&lt;li&gt;Running &lt;code&gt;composer&lt;/code&gt; after install shows me composer is installed.&lt;/li&gt;&#xA;&lt;li&gt;Running &lt;code&gt;composer diagnose&lt;/code&gt; however shows me a &lt;code&gt;WARNING&lt;/code&gt; after &lt;code&gt;https connectivity to packagist&lt;/code&gt;: &lt;strong&gt;The &lt;a href=&quot;https://packagist.org/packages.json&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://packagist.org/packages.json&lt;/a&gt; file could not be downloaded: SSL operation failed with code 1.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;So in php I checked if php_openssl is enabled and it is.&lt;/li&gt;&#xA;&lt;li&gt;I also have this in my &lt;code&gt;php.ini&lt;/code&gt; file, pointing to a cacert.pem certificate, downloaded from &lt;a href=&quot;http://curl.haxx.se/ca/cacert.pem&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://curl.haxx.se/ca/cacert.pem&lt;/a&gt; :&#xA;&lt;code&gt;openssl.cafile=&quot;C:\caCertificates\cacert.pem&quot;&#xA;openssl.capath=&quot;C:\caCertificates\&quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Running &lt;code&gt;php --ini&lt;/code&gt; on cmdline I verified it's definitely the edited &lt;code&gt;php.ini&lt;/code&gt; file that is active on command line/composer use (C:\wamp64\bin\php\php7.1.16)&lt;/li&gt;&#xA;&lt;li&gt;I turned firewall off &lt;/li&gt;&#xA;&lt;li&gt;I even uninstalled wamp-server with all php-stuff and installed a complete fresh, updated, install of Wamp server (3.1.3 64b)&lt;/li&gt;&#xA;&lt;li&gt;But &lt;code&gt;composer diagnose&lt;/code&gt; keeps throwing the warning, and composer is not working.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SETUP VIA PHP INSTALLER&lt;/strong&gt;&lt;br/&gt;&#xA;Than I tried the php-install script I found on getcomposer.org and run this from command line:&lt;br/&gt;&#xA;&lt;code&gt;php -r &quot;copy('https://getcomposer.org/installer', 'composer-setup.php');&quot;&#xA;php -r &quot;if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;&quot;&#xA;php composer-setup.php&#xA;php -r &quot;unlink('composer-setup.php');&quot;&lt;/code&gt;&lt;br&gt;&#xA; - It returns with:&lt;br/&gt;&#xA;&lt;code&gt;Installer verified. All settings correct for using Composer. Downloading...&#xA;Composer (version 1.6.5) successfully installed to: C:\proj-folder\test\composer.phar&lt;/code&gt;&lt;Br/&gt;&#xA; - But when I run &lt;code&gt;composer diagnose&lt;/code&gt; in that test-folder it's still throwing the warning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW I tried above with administrative rights too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand this has something to do with SSLv3, but whatever I tried, nothing seems to fix the issue. And again I tried a lot of things that worked for other people having this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm out of ideas and composer obviously is not really helpful in showing a clue to what's the problem here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anybody here that can help me with this, or give me some direction on where to look? This is taking a lot of time and effort last weeks without luck and I'd like to start building websites with Craft 3 using composer!! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8483" LastEditorUserId="8483" LastEditDate="2018-06-30T18:58:27.407" LastActivityDate="2018-07-30T19:02:37.430" Title="Solved: Unable to get composer running to install CraftCMS" Tags="&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26518" PostTypeId="2" ParentId="26494" CreationDate="2018-06-11T18:09:22.680" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;This section has about 30 fields I would like a user to be able to search for any text in any field, so I wont know the field names ahead of time. The user will not know the handles of the fields so that is not an option unfortunately.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think this is going to be possible natively.  Maybe if the 30 fields were all relational (entries, users, tags, categories, etc.), you could pull it off with some multi-step &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;relation&lt;/a&gt; queries, but it wouldn't be pretty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; that implemented its own custom search logic or there are some existing plugins that integrate with external search providers like &lt;a href=&quot;https://github.com/joshuabaker/craft-algolia&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algolia&lt;/a&gt; that might do what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-11T18:09:22.680" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26519" PostTypeId="2" ParentId="26514" CreationDate="2018-06-11T18:49:08.967" Score="1" Body="&lt;p&gt;Craft 3 doesn't do this natively and I'm not seeing any existing &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 plugins&lt;/a&gt; that would do this, so at the moment, you'd need to write your own.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-11T18:49:08.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26521" PostTypeId="1" CreationDate="2018-06-11T21:04:55.137" Score="2" ViewCount="30" Body="&lt;p&gt;I'm trying to emulate what Assets does, in which a thumbnail of the asset is shown along side the title of the asset. When I alter the _toString() method of the model, what I get is the URL instead of the image (the URL is being added to the data-label attribute of the containing div).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to accomplish what I'm after?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jtTx7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jtTx7.png&quot; alt=&quot;The Element Type&amp;#39;s title is displayed, but no image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6788" LastActivityDate="2018-06-12T15:18:04.130" Title="Is it possible to include a thumbnail in an element type index view?" Tags="&lt;plugin-development&gt;&lt;elementtype&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26522" PostTypeId="1" AcceptedAnswerId="27080" CreationDate="2018-06-11T21:29:36.703" Score="1" ViewCount="108" Body="&lt;p&gt;Based on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13089/filter-sprout-forms-entries-based-on-field-value-using-parameters&quot;&gt;this very helpful question&lt;/a&gt; I'm trying to filter the display of Sprout Form entries based on the value of a form field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, my form handle is 'reportHazardDeficiency' and my field name is 'company'. My template has &lt;code&gt;craft.sproutForms.entries.formHandle( 'reportHazardDeficiency' ).company( 4 )&lt;/code&gt; and I get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database Exception – yii\db\Exception Unknown column 'reportHazardDeficiency.field_company' in 'where clause'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running craft3 and Sprout Form trial version 3.0.0-beta.16.&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-07-28T14:58:38.340" Title="Filter Sprout Form entries throwing error" Tags="&lt;craft3&gt;&lt;filter&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26523" PostTypeId="2" ParentId="26499" CreationDate="2018-06-12T03:53:07.367" Score="2" Body="&lt;p&gt;So, turns out the issue was with the &lt;code&gt;$app = require 'bootstrap.php';&lt;/code&gt; line in app/index.php.  There was another directory for smarty template engine that was getting pulled from for the bootstrap file.  After removing that conflicting file, the issue was resolved.  Strange issue, but hopefully can help if anyone bumps into this in the future...&lt;/p&gt;&#xA;" OwnerUserId="8476" LastActivityDate="2018-06-12T03:53:07.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26524" PostTypeId="1" AcceptedAnswerId="26525" CreationDate="2018-06-12T08:58:19.077" Score="3" ViewCount="271" Body="&lt;p&gt;I'm trying to setup some Global fields in a migration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the SuperTable Field from verbb which is similar to a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to add several rows during migration but can't seem to get the combination right in order to set the field values.  Can someone help me out, what I've got so far is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $globalSet = Craft::$app-&amp;gt;globals-&amp;gt;getSetByHandle(&quot;myGlobals&quot;);  &#xA;&#xA;   $globalSet-&amp;gt;setFieldValues([&#xA;            'siteName' =&amp;gt; &quot;The Website&quot;,&#xA;            'siteCustom' =&amp;gt; [&#xA;                'new1' =&amp;gt; [&#xA;                    'type' =&amp;gt; 'superTableBlockType',&#xA;                    'fields' =&amp;gt; [&#xA;                        'firstField' =&amp;gt; &quot;some value&quot;,&#xA;                        'secondField' =&amp;gt; &quot;some other value&quot;&#xA;                    ]&#xA;                ]&#xA;            ]&#xA;        ]&#xA;   );&#xA;&#xA;   Craft::$app-&amp;gt;globals-&amp;gt;saveSet($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6624" LastActivityDate="2018-10-03T13:17:27.297" Title="Set SuperTableFields programatically" Tags="&lt;matrix&gt;&lt;php&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26525" PostTypeId="2" ParentId="26524" CreationDate="2018-06-12T09:11:20.367" Score="1" Body="&lt;p&gt;So it looks like you must get the correct block type in order for this to create new rows in the SuperTable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First get the block type using the &lt;code&gt;SuperTable&lt;/code&gt; service:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       //you'll need to reference this in your code&#xA;       use verbb\supertable\SuperTable;&#xA;&#xA;       $field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('siteCustom');&#xA;       $blockType = SuperTable::$plugin-&amp;gt;service-&amp;gt;getBlockTypesByFieldId($field-&amp;gt;id)[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use that same blockType id to set the type field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       $globalSet = Craft::$app-&amp;gt;globals-&amp;gt;getSetByHandle(&quot;myGlobals&quot;);  &#xA;&#xA;       $globalSet-&amp;gt;setFieldValues([&#xA;              'siteName' =&amp;gt; &quot;The Website&quot;,&#xA;              'siteCustom' =&amp;gt; [&#xA;                   'new1' =&amp;gt; [&#xA;                          'type' =&amp;gt; $blockType-&amp;gt;id,&#xA;                          'fields' =&amp;gt; [&#xA;                              'firstField' =&amp;gt; &quot;some value&quot;,&#xA;                              'secondField' =&amp;gt; &quot;some other value&quot;&#xA;                           ]&#xA;                   ]&#xA;               ]&#xA;       ]);&#xA;&#xA;       Craft::$app-&amp;gt;globals-&amp;gt;saveSet($globalSet);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to add more than one value to &lt;code&gt;siteCustom&lt;/code&gt; you can do so with the same syntax, just make sure you increment the number after &lt;code&gt;new&lt;/code&gt; each time (so &lt;code&gt;new2&lt;/code&gt;, &lt;code&gt;new3&lt;/code&gt;, and so on).&lt;/p&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="8814" LastEditDate="2018-10-03T13:17:27.297" LastActivityDate="2018-10-03T13:17:27.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26526" PostTypeId="2" ParentId="26515" CreationDate="2018-06-12T11:40:46.170" Score="2" Body="&lt;p&gt;In order to get all related items from a &lt;code&gt;BaseRelationField&lt;/code&gt; you'll need this syntax&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;getFieldValue('contentMatrix')-&amp;gt;all() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus your loop will be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach($entry-&amp;gt;getFieldValue('contentMatrix')-&amp;gt;all() as $block){&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-12T11:40:46.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26527" PostTypeId="1" AcceptedAnswerId="26577" CreationDate="2018-06-12T11:46:20.277" Score="2" ViewCount="216" Body="&lt;p&gt;I am attempting to replicate the example from &lt;a href=&quot;https://docs.craftcms.com/v3/templating/filters.html#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/templating/filters.html#group&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am unable to access the &lt;code&gt;{{ year }}&lt;/code&gt; in the first for loop inside the h2 element. It just shows up as an empty string. Anyone have an idea whats going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('weeklyDigests').all() %}&#xA;{% set allEntriesByYear = allEntries|group('postDate.year') %}&#xA;&#xA;{% for year, entriesInYear in allEntriesByYear %}&#xA;   &amp;lt;h2&amp;gt;{{ year }}&amp;lt;/h2&amp;gt;&#xA;&#xA;   &amp;lt;ul&amp;gt;&#xA;&#xA;   {% for entry in entriesInYear %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;   {% endfor %}&#xA;&#xA;   &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-06-15T23:41:40.863" Title="Craft 3 Docs Group Filter Not Working" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26528" PostTypeId="1" CreationDate="2018-06-12T15:04:07.540" Score="1" ViewCount="74" Body="&lt;p&gt;I´m using &lt;strong&gt;Guest Entries&lt;/strong&gt; to add to db some info filled by users, including some attach files. Everything works great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now i have to send an email with all the info and files that user send, i´m already using &lt;strong&gt;Postmaster&lt;/strong&gt; plugin to send a notificacion, it works, but it doesn´t send the attached files ( i mean, i don´t know how to do it ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this with the plugin or another way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="57" LastEditDate="2018-06-12T23:44:01.787" LastActivityDate="2018-07-12T23:55:51.140" Title="Send e-mail notificacion ( including attached files ) after user send information with Guest Entries" Tags="&lt;emails&gt;&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26529" PostTypeId="2" ParentId="26521" CreationDate="2018-06-12T15:18:04.130" Score="1" Body="&lt;p&gt;&lt;em&gt;(Hopefully it is okay for me to answer my own question)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;strong&gt;ElementType&lt;/strong&gt; file, the &lt;strong&gt;getSources&lt;/strong&gt; method needs to have the &lt;em&gt;hasThumbs&lt;/em&gt; key set, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSources($context = null)&#xA;{&#xA;    $sources = array(&#xA;        '*' =&amp;gt; array(&#xA;            'label'    =&amp;gt; Craft::t('All assets'),&#xA;            'hasThumbs' =&amp;gt; true,&#xA;        )&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your &lt;strong&gt;Model&lt;/strong&gt; file you have to have a &lt;strong&gt;getThumbUrl&lt;/strong&gt; method defined, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getThumbUrl()&#xA;{&#xA;    return $this-&amp;gt;thumbnailUrl;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a small thumbnail next to the title of your element, as seen in the screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ojalP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ojalP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/elementtypes/BaseElementType.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft 2 Class Reference&lt;/a&gt; helped put this together for me.&lt;/p&gt;&#xA;" OwnerUserId="6788" LastActivityDate="2018-06-12T15:18:04.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26530" PostTypeId="2" ParentId="26513" CreationDate="2018-06-12T15:32:06.090" Score="2" Body="&lt;p&gt;Indeed as &lt;a href=&quot;https://craftcms.stackexchange.com/users/5557/robin-schambach&quot;&gt;@robin&lt;/a&gt; pointed out, I couldn't figure out a nice way to making custom data outputs with Element API (Not related to a ElementType, like available Sites/Languages or available sections). What I did was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom module&lt;/a&gt;, in this module I was able to register routes like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        Event::on(&#xA;            UrlManager::class,&#xA;            UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;            function (RegisterUrlRulesEvent $event) {&#xA;&#xA;                $event-&amp;gt;rules['api/languages'] = '/endpoints/endpoints/languages';&#xA;            }&#xA;        );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in the action of the module. (Still is a rough version, also needs to handle possible errors and that kind of stuff)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionLanguages()&#xA;{&#xA;    $sites = Craft::$app-&amp;gt;getSites()-&amp;gt;getAllGroups();&#xA;&#xA;    $languages = Craft::$app-&amp;gt;getSites()-&amp;gt;getSitesByGroupId($sites[array_search('Languages', $sites)]['id']);&#xA;&#xA;    return $this-&amp;gt;asJson($this-&amp;gt;formatApiResponse($languages));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know if it's the nicest way (Still open to suggestions) but this gave me the freedom I needed to enhance my Element API end-points.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-06-12T15:32:06.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26531" PostTypeId="1" AcceptedAnswerId="26533" CreationDate="2018-06-12T15:39:09.530" Score="2" ViewCount="1177" Body="&lt;p&gt;Updating a plugin to Craft 3 (also changed its name). I know this is probably something very simple, like capitalization, but can anyone point out what's wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firefox console shows a 404 for&lt;br&gt;&#xA;&lt;code&gt;http://f.test/index.php?p=admin/actions/dryCalendar/calendarOccurrencesField/generateAjaxMiniCalendar&lt;/code&gt;&lt;br&gt;&#xA;and then&lt;br&gt;&#xA;&lt;code&gt;Type error: Response is null&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So perhaps Craft is getting the request, but &lt;code&gt;$this-&amp;gt;returnJson($response);&lt;/code&gt; isn't terminating the request, i.e. Craft continues to try to find a page to match?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My files are set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DryCalendar.php&#xA;controllers/DryCalendar_CalendarOccurrencesFieldController.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;//namespace kr37\drycalendar\controllers;&#xA;use Craft;&#xA;use craft\base\Controller;&#xA;class DryCalendar_CalendarOccurrencesFieldController extends BaseController&#xA;{&#xA;    public function actionGenerateAjaxMiniCalendar() {&#xA;        ...&#xA;        $this-&amp;gt;returnJson($response);    &#xA;    }   &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in my Garnish js is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.postActionRequest(                   &#xA;    'dryCalendar/calendarOccurrencesField/generateAjaxMiniCalendar', &#xA;    data, &#xA;    function(response) {&#xA;         ...&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="3690" LastEditDate="2018-06-12T18:17:34.967" LastActivityDate="2018-06-12T18:35:06.510" Title="Craft 3 Controller giving 404" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;controller&gt;&lt;404&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26532" PostTypeId="1" AcceptedAnswerId="26549" CreationDate="2018-06-12T16:10:54.343" Score="2" ViewCount="48" Body="&lt;p&gt;I've hacked this together to create an event archive listing, and although it works, I'm wondering if it's 'correct' or could be done more succinctly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastEvents = craft.entries.section('eventsEntry').orderBy('eventDate') %}&#xA;   {% for date, entries in pastEvents | group(&quot;pastEvents.eventDate|date('Y')&quot;) %}&#xA;        &amp;lt;h4&amp;gt;{{ date }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% for event in pastEvents.all() if event.eventDate &amp;lt;= now %}&#xA;                &amp;lt;li&amp;gt;&#xA;                    {{ event.eventDate|date('d/m/y') }}&#xA;                    {{ event.title }}&#xA;                &amp;lt;/li&amp;gt;                   &#xA;                {% endfor %} &#xA;            &amp;lt;/ul&amp;gt;   &#xA;   {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2018-06-13T18:43:22.277" Title="Template for event archive" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26533" PostTypeId="2" ParentId="26531" CreationDate="2018-06-12T18:30:05.763" Score="4" Body="&lt;p&gt;Craft 3 action routes are &lt;code&gt;snake-case&lt;/code&gt; rather than &lt;code&gt;camelCase&lt;/code&gt; thus your route needs to be &lt;code&gt;plugin-handle/controller-handle/function-name&lt;/code&gt; instead of &lt;code&gt;pluginHandle/controllerName/functionName&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your Controllers namespace must be &lt;code&gt;prefix\namespace\name\controllers&lt;/code&gt; so in your case it could be &lt;code&gt;kr37\drycalendar\controllers&lt;/code&gt; not Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you don't need to include your plugin name to the classname anymore. Your controller name can be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CalendarOccurrencesFieldController&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your action will then be &lt;code&gt;drycalendar/calendar-occurrences-field/generate-ajax-mini-calendar&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind you'll have to create &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26454/resolving-the-entry-variable-for-custom-routes-somewhere-but-a-twig-template/26455#26455&quot;&gt;routes&lt;/a&gt; of you don't use the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#action-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;action&lt;/a&gt; parameter in your request. Currently you are trying to access your controller via cp/site route, not via action route&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-12T18:35:06.510" LastActivityDate="2018-06-12T18:35:06.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26534" PostTypeId="1" AcceptedAnswerId="26535" CreationDate="2018-06-12T21:16:23.540" Score="3" ViewCount="113" Body="&lt;p&gt;Dumb question, but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I purchased a plugin when using Craft 2 and now I'm trying to input the license for it in Craft 3. There's an input for the license key when I go to settings -&gt; plugins, but the submit for it says &quot;buy now&quot; and tries to put the plugin in my cart. How do I give Craft 3 the license?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oOsqe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oOsqe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3900" LastEditorUserId="57" LastEditDate="2018-06-22T20:57:30.403" LastActivityDate="2018-06-22T20:57:30.403" Title="Switching plugin license from Craft 2 to Craft 3" Tags="&lt;craft3&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26535" PostTypeId="2" ParentId="26534" CreationDate="2018-06-12T21:28:39.747" Score="2" Body="&lt;p&gt;That's a question for the plugin developer. If the plugin isn't purchased through the plugin store, then each developer is responsible for generating Craft 3 licenses on their own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably safe to say that your Craft 2 license number is not going to match your Craft 3 license number. Contact the plugin's developer for more information.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-12T21:28:39.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26536" PostTypeId="2" ParentId="26534" CreationDate="2018-06-12T21:30:03.263" Score="1" Body="&lt;p&gt;Ah, I figured it out. My plugin's old license key wasn't long enough to satisfy the key input. This box is expecting a license in the exact format it shows - with 6 sets of 4 numbers (my old key only had 5 sets). Once you've input that many numbers the button changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I scoured my plugin's documentation and found that I need to request a Craft3 compatible key. &lt;/p&gt;&#xA;" OwnerUserId="3900" LastEditorUserId="3900" LastEditDate="2018-06-22T14:45:36.093" LastActivityDate="2018-06-22T14:45:36.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26537" PostTypeId="2" ParentId="26528" CreationDate="2018-06-12T23:43:41.740" Score="1" Body="&lt;p&gt;Instead of using the &lt;a href=&quot;https://github.com/objectivehtml/Postmaster-for-Craft-CMS&quot; rel=&quot;nofollow noreferrer&quot;&gt;Postmaster plugin&lt;/a&gt;, which appears abandoned and hasn't been updated since 2016, you could write a &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple plugin&lt;/a&gt; that listened to the &lt;a href=&quot;https://github.com/craftcms/guest-entries#the-aftersaveentry-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;afterSaveEntry&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That plugin could grab any info from the submitted Entry model, including uploads/attachments, and manually compose and send an email out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of how to do that in code in the &lt;a href=&quot;https://github.com/craftcms/contact-form/blob/v2/src/Mailer.php#L65-L103&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form&lt;/a&gt; plugin.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-12T23:43:41.740" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26539" PostTypeId="2" ParentId="26463" CreationDate="2018-06-13T07:53:37.300" Score="2" Body="&lt;p&gt;I got an emailed response from Andris from P&amp;amp;T: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That indicates that at some point Craft was unable to index a file,&#xA;  leaving some corrupt data. If you look at craft_assetfiles table,&#xA;  you'll notice that at least one entry has the dateModified column set&#xA;  to null. Removing those should fix the issue for you. Probably the&#xA;  best way to remove them would be to actually delete the records from&#xA;  the craft_elements table, that have the matching IDs. The cascading&#xA;  delete should remove all related records.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Please do make backups before tampering with the database, though!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Deleting the records fixed the issues. &lt;/p&gt;&#xA;" OwnerUserId="327" LastActivityDate="2018-06-13T07:53:37.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26540" PostTypeId="1" AcceptedAnswerId="26542" CreationDate="2018-06-13T09:30:23.420" Score="1" ViewCount="436" Body="&lt;p&gt;I'm a Craft beginner, so forgive me if this is an easy question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an intro animation, that I'd only like to show on the first visit to the site, so that it doesn't load again when the user navigates back to the homepage after visiting other pages. Then I'd like it to expire when a user closes their browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to use secure cookies via the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies Plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The id of the intro animation is &lt;code&gt;id=&quot;preloader&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put &lt;code&gt;{{ setSecureCookie('intro-animation') }}&lt;/code&gt; above the html tag and &lt;code&gt;{{ getSecureCookie('intro-animation') }}&lt;/code&gt; with the preloader section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how I do I set it up to only show the intro animation on first visit?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastEditorUserId="5557" LastEditDate="2018-06-13T12:56:29.063" LastActivityDate="2018-06-13T12:56:29.063" Title="How to set cookie to only show intro animation once per session" Tags="&lt;cookies&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26541" PostTypeId="1" AcceptedAnswerId="26571" CreationDate="2018-06-13T09:45:55.173" Score="2" ViewCount="279" Body="&lt;p&gt;Is there a way to retrieve and loop through all the available tax rates that have been set up in Commerce 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had thought I could loop through the adjusters like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for adjustment in cart.adjustments %}&#xA;    {{ adjustment.name }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In fact, I'm doing this on one site with no problems but having just tried the same thing on another project I am running into errors. I'm guessing because no adjustments exist unless there is actually a cart object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to retrieve its value in order to display the price including tax on my product page template. For this particular case I only have 1 tax rate, so there is no problem with regionality. I figured that I could loop through the adjuster, check the name and retrieve the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's another way to do this I'm all ears!&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="57" LastEditDate="2018-11-28T04:48:31.783" LastActivityDate="2018-11-28T04:48:31.783" Title="How to get all available tax rates in a Commerce site?" Tags="&lt;plugin-craftcommerce&gt;&lt;adjusters&gt;&lt;tax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26542" PostTypeId="2" ParentId="26540" CreationDate="2018-06-13T10:07:57.533" Score="1" Body="&lt;p&gt;You could try something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set vidAlreadyPlayed = getSecureCookie('intro-animation') %}&#xA;        {% if not vidAlreadyPlayed %}&#xA;            {{ setSecureCookie('intro-animation', 'hey', now | date_modify(&quot;+60 seconds&quot;).timestamp ) }}&#xA;            &amp;lt;h1&amp;gt;No cookie set&amp;lt;/h1&amp;gt;&#xA;            &amp;lt;!-- do your animation logic here --&amp;gt;&#xA;        {% else %}&#xA;          &amp;lt;!-- do something else --&amp;gt;&#xA;          &amp;lt;h1&amp;gt;Cookie set already&amp;lt;/h1&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3941" LastEditorUserId="3941" LastEditDate="2018-06-13T11:18:41.663" LastActivityDate="2018-06-13T11:18:41.663" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="26543" PostTypeId="1" AcceptedAnswerId="26544" CreationDate="2018-06-13T12:29:45.270" Score="0" ViewCount="78" Body="&lt;p&gt;I have two sites. Everytime I add global field content (slogan for example) it adds the same to the second site, and vice-versa. Anyone has any idea how to stop that?&lt;/p&gt;&#xA;" OwnerUserId="1086" LastEditorUserId="5557" LastEditDate="2018-06-13T12:57:21.807" LastActivityDate="2018-06-13T13:35:15.743" Title="Global field duplicated" Tags="&lt;craft3&gt;&lt;globals&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26544" PostTypeId="2" ParentId="26543" CreationDate="2018-06-13T13:35:15.743" Score="1" Body="&lt;p&gt;In order to change the content for each site individually you need to set the field settings accordingly to &quot;translatable for each site&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise the content for each site will be the same &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-13T13:35:15.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26545" PostTypeId="1" AcceptedAnswerId="26546" CreationDate="2018-06-13T13:44:25.183" Score="2" ViewCount="249" Body="&lt;p&gt;The goal is to show a word when date field qualifies for &lt;em&gt;tomorrow&lt;/em&gt; or &lt;em&gt;today&lt;/em&gt; instead of numeric date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting and calling variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set deliveryDate = order.deliveryDate %}&#xA;{% set tomorrow = now|date_modify(&quot;+ 1 day&quot;) %}&#xA;&#xA;{% if deliveryDate == tomorrow %}&#xA;  {% set deliveryDate = &quot;tomorrow&quot; %}&#xA;{% elseif deliveryDate == now %}&#xA;  {% set deliveryDate = &quot;today&quot; %}&#xA;{% else %}&#xA;  {% set deliveryDate = deliveryDate|date(&quot;d.m.Y&quot;) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;em&gt;date field&lt;/em&gt; has selected value of tomorrow whereas the first statement should be truthy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think I'm comparing two objects with the same values but different classes?&#xA;I had figured it out by formatting the date objects to strings using &lt;a href=&quot;https://docs.craftcms.com/v2/templating/datetime.html#day&quot; rel=&quot;nofollow noreferrer&quot;&gt;day()&lt;/a&gt; filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why is THAT happening on the first place? &lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2018-06-13T13:59:12.183" Title="Comparing date field object with global variable &quot;now&quot; gives unexpected result" Tags="&lt;datetime&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26546" PostTypeId="2" ParentId="26545" CreationDate="2018-06-13T13:59:12.183" Score="2" Body="&lt;p&gt;&lt;code&gt;now&lt;/code&gt; represents the current &lt;code&gt;DateTime&lt;/code&gt; so unless you specify exactly the correct time in your field the condition &lt;code&gt;deliveryDate == now&lt;/code&gt; will never become true. If the user visits the page one second earlier or one second later the condition will fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: if your date is &lt;code&gt;2018-06-13 12:00:00&lt;/code&gt; and &lt;code&gt;now&lt;/code&gt; is &lt;code&gt;2018-06-13 12:00:01&lt;/code&gt; both of your conditions will always fail. &lt;code&gt;now|date_modify(&quot;+ 1 day&quot;)&lt;/code&gt; will result in &lt;code&gt;2018-06-14 12:00:01&lt;/code&gt; and &lt;code&gt;12:00:00&lt;/code&gt; is not &lt;code&gt;12:00:01&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you'll need to equalize the time or format it differently&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if deliveryDate.modify('midnight') == tomorrow.modify('midnight') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if deliveryDate.format('Y.m.d') == tomorrow.format('Y.m.d') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can read more about it in the &lt;a href=&quot;http://php.net/manual/en/function.date.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-13T13:59:12.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26547" PostTypeId="1" AcceptedAnswerId="26548" CreationDate="2018-06-13T16:08:35.273" Score="2" ViewCount="78" Body="&lt;p&gt;I am seeing warning icons on drop down fields like this&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KvtsC.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KvtsC.jpg&quot; alt=&quot;Drop down with warnings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does this come from?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-06-13T16:35:41.427" Title="warning icon on fields" Tags="&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26548" PostTypeId="2" ParentId="26547" CreationDate="2018-06-13T16:35:41.427" Score="4" Body="&lt;p&gt;This warning appears when the content column type of the current selected field is different than the new one -&gt; you'll lose all the information that is currently stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: changing from number to text won't be a huge problem but changing from text to date will result in a data loss &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-13T16:35:41.427" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26549" PostTypeId="2" ParentId="26532" CreationDate="2018-06-13T18:43:22.277" Score="1" Body="&lt;p&gt;Instead of grabbing &lt;em&gt;all&lt;/em&gt; entries in the &lt;code&gt;eventsEntry&lt;/code&gt; section, then filtering by the current date/time, you could do the filtering on the database side first, so you're returning only the entries you're interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pastEvents = craft.entries.section('eventsEntry').eventdate('&amp;lt;= ' ~ now|atom) %}&#xA;&#xA;{% for date, entries in pastEvents | group(&quot;pastEvents.eventdate|date('Y')&quot;) %}&#xA;    &amp;lt;h4&amp;gt;{{ date }}&amp;lt;/h4&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for event in pastEvents.all() %}&#xA;            &amp;lt;li&amp;gt;&#xA;                {{ event.eventdate|date('d/m/y') }}&#xA;                {{ event.title }}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-13T18:43:22.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26550" PostTypeId="2" ParentId="26470" CreationDate="2018-06-13T20:19:30.887" Score="1" Body="&lt;p&gt;I solved the problem by adding the following (missing) step to the &lt;strong&gt;Performing the Upgrade&lt;/strong&gt; section of the docs at &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Copy your old &lt;code&gt;craft/storage/userphotos/&lt;/code&gt; over to your new project's &lt;code&gt;storage/userphotos/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-06-13T20:19:30.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26551" PostTypeId="1" CreationDate="2018-06-13T20:20:07.803" Score="1" ViewCount="275" Body="&lt;p&gt;By default, if we use cyrillic in the names of entries, the slug is also created in сyrillic. This is not good. And here we need transliteration such as б → b, д → d, etc.&lt;/p&gt;&#xA;&lt;p&gt;By the way, if we create for example a new section in сyrillic, the handle, Entry URI Format and Template is created almost correctly, the exception is the characters 'Ь' and 'Ъ' - they are replaced by a space.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ldeZZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ldeZZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ok, in general.php add&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'limitAutoSlugsToAscii' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to replace characters according to ASCII character mapping. Now slug in entries should be created correctly, but again a new problem with the characters 'Ь' and 'Ъ', they are not converted.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CSjZA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CSjZA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;in general.php add&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'customAsciiCharMappings' =&amp;gt; [&#xA;    ' ' =&amp;gt; ['ь', 'Ь', 'ъ', 'Ъ'],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and we get the same result as when creating a new section - space.&lt;/p&gt;&#xA;&lt;p&gt;Tried this variant:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'customAsciiCharMappings' =&amp;gt; [&#xA;    '' =&amp;gt; ['ь', 'Ь', 'ъ', 'Ъ'],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;does not work&lt;/p&gt;&#xA;&lt;p&gt;In the correct convertation there should be no spaces or replacement, 'Ь' and 'Ъ' should be removed (Мальчик → malchik). How to remove these spaces?&lt;/p&gt;&#xA;" OwnerUserId="8479" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-07-14T00:11:05.013" Title="Custom ASCII character mappings" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26552" PostTypeId="2" ParentId="16798" CreationDate="2018-06-13T20:39:23.280" Score="1" Body="&lt;p&gt;I also wanted to contribute to the answer to this so a total beginner like myself could get further insight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this snippet of javascript (vue):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new Vue({&#xA;    el: '#content',&#xA;    data: {&#xA;        message: 'Hello Vue.js!'&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll need to make sure you stay within the scope of &lt;code&gt;#content&lt;/code&gt; for the &lt;code&gt;data&lt;/code&gt; attribute to get picked up correctly. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;    ${ message }  // Hello Vue.js!&#xA;&amp;lt;/div&amp;gt; &#xA;&#xA;&amp;lt;div id=&quot;content&quot; role=&quot;main&quot;&amp;gt;&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;${ message }  // will not work &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-06-15T13:08:17.627" LastActivityDate="2018-06-15T13:08:17.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26553" PostTypeId="2" ParentId="26551" CreationDate="2018-06-13T23:22:44.527" Score="1" Body="&lt;p&gt;Ignoring &lt;code&gt;customAsciiCharMappings&lt;/code&gt; for the moment, Craft uses &lt;a href=&quot;https://github.com/danielstjules/Stringy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stringy&lt;/a&gt; for this type of thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The have some special logic for German and Bulgarian character replacements and it looks like those particular characters will only get replaced if the locale of the site you're currently editing is &lt;code&gt;bg&lt;/code&gt;: &lt;a href=&quot;https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php#L1874-L1877&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php#L1874-L1877&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-13T23:22:44.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26554" PostTypeId="1" AcceptedAnswerId="26558" CreationDate="2018-06-13T23:38:58.137" Score="2" ViewCount="313" Body="&lt;p&gt;I've built lots of Craft 2 plugins that catch Sprout Forms submissions and integrate with external services (CRM's etc). It was easy, you'd make a plugin and catch the event going:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('sproutForms.onSaveEntry', function(SproutForms_OnSaveEntryEvent $event) {&#xA;    // Hand submission off to your service to do some rad stuff.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in Craft 3, that events functionality appears to be more complicated. All the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/events-and-hooks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Events &amp;amp; Hooks area in the Sprout Documentation&lt;/a&gt; just show &quot;Example needed.&quot; in all the places where code samples would usually be. The &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#events&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 plugin docs on events&lt;/a&gt; show a new system for registering and intercepting events - but my coffee deficient mind is struggling to figure out how to map that to Craft3/Sprout Forms 3.0.0-beta.17.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone built a Craft 3 plugin that works with Sprout Forms Beta yet? I'm even struggling to find examples of any event integration in plugins at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Halp!!!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-06-15T13:33:00.433" Title="Intercepting Sprout Forms &quot;onSaveEntry&quot; Event In Craft 3 Plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26555" PostTypeId="1" AcceptedAnswerId="26566" CreationDate="2018-06-14T00:46:39.720" Score="2" ViewCount="62" Body="&lt;p&gt;Each entry in &lt;code&gt;posts&lt;/code&gt; has a field called &lt;code&gt;value&lt;/code&gt;.  &lt;code&gt;Value&lt;/code&gt; is a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For a &lt;code&gt;category&lt;/code&gt;, how can I return the entry with the highest value?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not for Craft Commerce.  Value represents a budget figure.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I return the top 3 entries (based on value)?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-14T19:46:53.330" Title="How can I return the entry with the highest value?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26556" PostTypeId="2" ParentId="11490" CreationDate="2018-06-14T01:02:38.013" Score="1" Body="&lt;p&gt;There is an open-source Craft 2.x plugin for Algolia:&lt;br&gt;&#xA;&lt;a href=&quot;https://github.com/joshuabaker/craft-algolia&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/joshuabaker/craft-algolia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used it, but it would be a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2018-06-14T01:02:38.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26557" PostTypeId="1" CreationDate="2018-06-14T01:08:29.167" Score="1" ViewCount="2558" Body="&lt;p&gt;Upon running the update tool in the Craft CMS, I get this error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Error: file_put_contents(path/to/file/composer.json): failed to open stream: Permission denied&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What permissions are causing this error? Is it simply the case of changing the perms on the composer.json file? If so, what should they be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8471" LastEditorUserId="57" LastEditDate="2018-06-14T23:31:40.833" LastActivityDate="2018-06-14T23:31:40.833" Title="Can't update Craft 3, permissions issue" Tags="&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26558" PostTypeId="2" ParentId="26554" CreationDate="2018-06-14T02:55:42.367" Score="2" Body="&lt;p&gt;I've updated the Sprout docs with &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/events-and-hooks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;examples of Craft 3 events and hooks&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the Form Entry Element extends the &lt;code&gt;craft\base\Element&lt;/code&gt; class and also supports the same after the base element save event: &lt;code&gt;EVENT_AFTER_SAVE&lt;/code&gt;. In your primary plugin class &lt;code&gt;init&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use barrelstrength\sproutforms\elements\Entry;&#xA;use yii\base\Event;&#xA;use Craft;&#xA;&#xA;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, function(Event $event) {&#xA;        if (Craft::$app-&amp;gt;request-&amp;gt;isSiteRequest)&#xA;        {&#xA;            // A Form Entry Element has been saved from a Front-end Form Submission&#xA;            Craft::dd($event-&amp;gt;sender);&#xA;        }&#xA;&#xA;        if (Craft::$app-&amp;gt;request-&amp;gt;isCpRequest)&#xA;        {&#xA;            // A Form Entry Element has been updated from the Control Panel&#xA;&#xA;            Craft::dd($event-&amp;gt;sender);&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can access the specific Form Entry Element being submitted via the &lt;code&gt;$event-&amp;gt;sender&lt;/code&gt; property.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-06-15T13:33:00.433" LastActivityDate="2018-06-15T13:33:00.433" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26560" PostTypeId="2" ParentId="26557" CreationDate="2018-06-14T12:51:06.043" Score="1" Body="&lt;p&gt;Here are the required Craft 3 file permissions: &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html#step-2-set-the-file-permissions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/installation.html#step-2-set-the-file-permissions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-06-14T12:51:06.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26561" PostTypeId="1" AcceptedAnswerId="26638" CreationDate="2018-06-14T12:55:30.653" Score="2" ViewCount="220" Body="&lt;p&gt;I am currently building an intranet. I have created a password reset and a set password form that is used on the front-end. However, admin users get redirected to the 'Craft' set password form. is there anyway possible to make all users use the front-end set password form for consistency? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-06-21T19:02:06.493" Title="Set Password form - use front-end template for admin users" Tags="&lt;admin&gt;&lt;password&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26562" PostTypeId="1" AcceptedAnswerId="26573" CreationDate="2018-06-14T16:27:43.030" Score="2" ViewCount="632" Body="&lt;p&gt;On a website upgraded to Craft 3 - having issues pulling events by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error Is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Calling unknown method: craft\behaviors\ElementQueryBehavior::eventDate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Error occurs on the last line of my code below.&#xA;I'm done alot of searching but unable to find the correct method I should be using now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% if (category is defined) and (category is not empty) %}&#xA;    {% set params = { section: 'events', orderBy: 'eventDate', relatedTo: category } %}&#xA;    {% else %}&#xA;    {% set params = { section: 'events', orderBy: 'eventDate' } %}&#xA;    {% endif %}          &#xA;    {% set j = 0 %}&#xA;    {# Retrieve all of the events for the month, and group them by day #}&#xA;    {% set groupedEvents = craft.entries(params).eventDate('and', '&amp;gt;= ' ~ startdate, '&amp;lt;= ' ~ enddate) | group('eventDate|date(&quot;Y-m-d&quot;)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&#xA;Ok think found the issue - needed square brackets.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEvents = craft.entries(params).eventDate(['and', '&amp;gt;= ' ~ startdate, '&amp;lt;= ' ~ enddate]) | group('eventDate|date(&quot;Y-m-d&quot;)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="622" LastEditDate="2018-06-14T19:41:43.477" LastActivityDate="2018-06-15T04:29:55.637" Title="Craft 3 - Searching by date field - Calling unknown method: craft\behaviors\ElementQueryBehavior" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26563" PostTypeId="1" CreationDate="2018-06-14T17:40:44.547" Score="1" ViewCount="102" Body="&lt;p&gt;Having an issue with Live Preview scrolling to the top of the page in the preview area on every update made (even title field). Narrowed it down to it &lt;em&gt;not&lt;/em&gt; being a browser issue as it works plum good on another site. Here’s the error I’m seeing in console with the site giving me the issues. Can anyone point me in the right direction? Please and thanks&lt;img src=&quot;https://i.stack.imgur.com/r3FNt.png&quot; alt=&quot;![enter image description here&quot;&gt;]&lt;a href=&quot;https://i.stack.imgur.com/r3FNt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2018-06-14T18:05:37.083" Title="Why is Live Preview scrolling to the top of page after every change?" Tags="&lt;craft3&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26564" PostTypeId="2" ParentId="26563" CreationDate="2018-06-14T18:05:37.083" Score="1" Body="&lt;p&gt;Figured it out. The issue was related to Font Awesome 5's SVG replacement with JS method but specifically &lt;a href=&quot;https://fontawesome.com/how-to-use/performance-and-security#async-loading-indicators&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asynchronous Loading Indicators&lt;/a&gt;. Once I stopped using this async stuff all is peachy again.&lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2018-06-14T18:05:37.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26565" PostTypeId="1" AcceptedAnswerId="26568" CreationDate="2018-06-14T19:21:21.133" Score="2" ViewCount="85" Body="&lt;p&gt;I'm working on a site that I did not build. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first party contact form stopped submitting so I updated Craft and all plugins. All went smoothly but the form is still not  submitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checked the templates and compared to the docs and it appears that it should work (was previously). Any recommendations on how to better troubleshoot?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;form-container&quot;&amp;gt;&#xA;  {% from _self import errorList %}&#xA;&#xA;  &amp;lt;form id=&quot;contact-form&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/careers/apply-now#form-thanks&quot;&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;form-element&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;fromName&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;fromName&quot; type=&quot;text&quot; name=&quot;message[fromName]&quot; placeholder=&quot;Your Name&quot; value=&quot;&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;        &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-element&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;fromEmail&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;fromEmail&quot; type=&quot;text&quot; name=&quot;fromEmail&quot; placeholder=&quot;Your Email&quot; value=&quot;&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;        &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;      &amp;lt;div class=&quot;form-element&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;phoneNumber&quot;&amp;gt;Phone&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;phoneNumber&quot; type=&quot;text&quot; name=&quot;message[phoneNumber]&quot; placeholder=&quot;Your Phone Number&quot; value=&quot;&quot;&amp;gt;&#xA;        {{ message is defined and message ? errorList(message.getErrors('phoneNumber')) }}&#xA;        &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-element&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;position&quot;&amp;gt;Position&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;position&quot; type=&quot;text&quot; name=&quot;message[position]&quot; placeholder=&quot;Position of Interest&quot; value=&quot;&quot; /&amp;gt;&#xA;      &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-element&quot;&amp;gt;&#xA;      &amp;lt;label class=&quot;button&quot; for=&quot;attachment&quot;&amp;gt;Attach Resume&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input type=&quot;file&quot; id=&quot;attachment&quot; name=&quot;attachment&quot; /&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;subject&quot; value=&quot;Career Form Submission&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;nothanks&quot; id=&quot;nothanks&quot; value=&quot;&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-element submit&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;&#xA;  &amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-06-14T21:20:28.240" Title="P&amp;T Contact Form not submitting Craft 2" Tags="&lt;error&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26566" PostTypeId="2" ParentId="26555" CreationDate="2018-06-14T19:46:53.330" Score="1" Body="&lt;p&gt;Sounds like you're looking for a combination of the &lt;code&gt;orderBy&lt;/code&gt; and &lt;code&gt;relatedTo&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/element-query-params/entry-query-params.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry query params&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may put you on the right track?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topThree = craft.entries({&#xA;  section: 'posts',&#xA;  relatedTo: { targetElement: myCategory },&#xA;  orderBy: 'myBudgetValueField desc',&#xA;  limit: 3&#xA;}).all %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, for just the entry with the highest value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topFigure = craft.entries({&#xA;  section: 'posts',&#xA;  relatedTo: { targetElement: myCategory },&#xA;  orderBy: 'myBudgetValueField desc'&#xA;}).one %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this depends on &lt;code&gt;myBudgetValueField&lt;/code&gt; being a number or some other easily-sortable value. If you need to format the value, I'd recommend storing it in the unit for comparison, and then visually treating it when you output it (i.e. store &lt;code&gt;300000&lt;/code&gt;, even if you eventually need to output &lt;code&gt;$300,000&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-14T19:46:53.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26567" PostTypeId="1" CreationDate="2018-06-14T21:01:41.777" Score="0" ViewCount="56" Body="&lt;p&gt;I am a Craft newbie, and I'm currently making a few custom templates, learning Twig, etc.&lt;br&gt;&#xA;My question is: in including a form in my template code, how would the form be coded (Twig or HTML)?  Is there a good tutorial/reference on forms used in this way?  Also, how would I reference my php code (which is within my plugin)?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The form will be an log-in authentication, and the plugin contains the code to verify that the user exists in Active Directory (LDAP).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll sketch out the way my website is laid out.  There are only a handful of users who actually log in to CraftCMS in order to make changes to content on the website.&lt;br&gt;&#xA;However, the login form I'm making here is not to log in to Craft, but to gain access to one page of the website.  I will need to create a form page template and have it submit to my php code (plugin) somehow.   &lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="6879" LastEditDate="2018-06-19T16:48:21.803" LastActivityDate="2018-06-19T16:48:21.803" Title="Form in Front End Template Reference Plugin for LDAP" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;form&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26568" PostTypeId="2" ParentId="26565" CreationDate="2018-06-14T21:20:28.240" Score="1" Body="&lt;p&gt;This sounds like a problem with your &lt;strong&gt;email configuration&lt;/strong&gt;, not the form plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check your site wide email settings, specifically check the &quot;Protocol&quot;. If you are using &quot;PHP Mail&quot;, you're gonna have a lot of problems. The best option is &quot;SMTP&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FcGta.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FcGta.png&quot; alt=&quot;Protocol dropdown menu&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several SMTP services to choose from. We've been using Mailgun for several years, and are very happy with them.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-14T21:20:28.240" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26569" PostTypeId="1" CreationDate="2018-06-14T23:34:38.923" Score="2" ViewCount="438" Body="&lt;p&gt;I need to add an &quot;attachment&quot; to an email sent by Craft CMS 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used a custom &quot;Module&quot; for this with a &quot;Model&quot;, &quot;Service&quot;, &quot;Record&quot; and &quot;Controller&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some research but did not find any clear answers on how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to send a email with an attachment?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---- Update -----&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I need to do&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Person A &#xA;Fill the form with file a file ( like doc, pdf etc... )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prepare the email with the custom &quot;module&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Do I have to upload the file somehow on the server before do the attachement in the email ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Send the email with the file in attachement to Person B&lt;/p&gt;&#xA;" OwnerUserId="8494" LastEditorUserId="8494" LastEditDate="2018-06-15T04:13:48.973" LastActivityDate="2019-11-18T05:13:37.507" Title="Craft 3 attachment email" Tags="&lt;craft3&gt;&lt;emails&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26570" PostTypeId="2" ParentId="26569" CreationDate="2018-06-14T23:50:09.813" Score="2" Body="&lt;p&gt;Assuming what you're trying to attach is on the local filesystem, you can see an example of this here: &lt;a href=&quot;https://github.com/pixelandtonic/craftnet/blob/master/src/orders/OrderBehavior.php#L160-L182&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/craftnet/blob/master/src/orders/OrderBehavior.php#L160-L182&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, you'd just use &lt;a href=&quot;https://www.yiiframework.com/extension/yiisoft/yii2-swiftmailer/doc/api/2.2/yii-swiftmailer-message#attachContent()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;attachContent&lt;/a&gt;, but there is also an &lt;a href=&quot;https://www.yiiframework.com/extension/yiisoft/yii2-swiftmailer/doc/api/2.2/yii-swiftmailer-message#attach()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;attach&lt;/a&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;attachContent($pdf, [&#xA;    'fileName' =&amp;gt; $filename,&#xA;    'contentType' =&amp;gt; 'application/pdf',&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="6392" LastEditDate="2019-11-18T05:13:37.507" LastActivityDate="2019-11-18T05:13:37.507" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26571" PostTypeId="2" ParentId="26541" CreationDate="2018-06-15T00:09:31.780" Score="2" Body="&lt;p&gt;&lt;strong&gt;Commerce 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTaxRates = craft.commerce.taxRates.allTaxRates() %}&#xA;&#xA;{% for taxRate in allTaxRates %}&#xA;    {{ taxRate.name }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;taxRate&lt;/code&gt; will be an instance of &lt;code&gt;craft\commerce\models\TaxRate&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Commerce 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking to get all of the tax rates setup in Commerce from a template, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allTaxRates = craft.commerce.getTaxRates() %}&#xA;&#xA;{% for taxRate in allTaxRates %}&#xA;    {{ taxRate.name }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;taxRate&lt;/code&gt; will be an instance of &lt;code&gt;Commerce_TaxRateModel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-11-28T04:33:58.870" LastActivityDate="2018-11-28T04:33:58.870" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26572" PostTypeId="1" AcceptedAnswerId="26574" CreationDate="2018-06-15T03:50:17.647" Score="2" ViewCount="67" Body="&lt;p&gt;If I can get entries in a category like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a entries from another site like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionSlug').site('siteSlug').all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to combine them and get entries from another site in a certain category. The following isn't working for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').site('siteSlug').all() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5641" LastActivityDate="2018-06-15T09:42:12.737" Title="Can I get entries related to one category from a specific site?" Tags="&lt;templating&gt;&lt;entries&gt;&lt;categories&gt;&lt;relatedto&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26573" PostTypeId="2" ParentId="26562" CreationDate="2018-06-15T04:29:55.637" Score="2" Body="&lt;p&gt;Was missing the square brackets &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set groupedEvents = craft.entries(params).eventDate(['and', '&amp;gt;= ' ~ startdate, '&amp;lt;= ' ~ enddate]) | group('eventDate|date(&quot;Y-m-d&quot;)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastActivityDate="2018-06-15T04:29:55.637" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26574" PostTypeId="2" ParentId="26572" CreationDate="2018-06-15T09:42:12.737" Score="1" Body="&lt;p&gt;Relations don't work with a slug. You'll need to insert an &lt;code&gt;ElementQuery&lt;/code&gt; an &lt;code&gt;Element&lt;/code&gt; or the ID of an &lt;code&gt;Element&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section('sectionHandle')&#xA;    .relatedTo(category)&#xA;    .site('siteHandle')&#xA;    .all() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this will only work in certain cases where all category ids are the same for both sites. You'll need to to fetch the category from the other site at first if these are different &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-15T09:42:12.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26575" PostTypeId="1" CreationDate="2018-06-15T11:36:58.397" Score="1" ViewCount="193" Body="&lt;p&gt;I have Neo fields in my entries which I want to be populated by a JSON feed pulled in through Feed Me, im using elementApi top create the JSON feed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Feed Me setup runs fine and there are no errors. My issue is that I'm un-able to map the Neo Fields when it comes to the configuration screen (where you select the Feed Element from your fields to map with the JSON fields), because I am only seeing the top-level of the Neo fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated &lt;/p&gt;&#xA;" OwnerUserId="7714" LastActivityDate="2018-12-26T21:03:47.480" Title="Feed Me plugin not mapping Neo fields" Tags="&lt;plugin-feedme&gt;&lt;plugin-neo&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26576" PostTypeId="2" ParentId="23360" CreationDate="2018-06-15T17:05:47.717" Score="1" Body="&lt;p&gt;I think I’ve got this working using the &lt;a href=&quot;https://github.com/nystudio107/cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cookies plugin developed by nystudio107&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic concept is that you grab a randomised array of entry IDs on the first page and store that in a cookie. You then use that array of IDs on all subsequent pages by setting the entries parameter &lt;code&gt;fixedOrder&lt;/code&gt; to true. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get random array of entry IDs from cookie #}&#xA;{% set entryIds = craft.cookies.getSecure('entryIds') %}&#xA;&#xA;{# If it's the first page or there are no entry IDs #}&#xA;{% if craft.request.getPageNum() == 1 or not entryIds %}&#xA;&#xA;  {# Get a fresh array of randomised entry IDs and set the cookie #}&#xA;  {% set entryIds = craft.entries.order('RAND()').limit(null).ids() %}&#xA;  {% do craft.cookies.setSecure('entryIds', entryIds|join(',')) %}&#xA;&#xA;{% else %}&#xA;  {% set entryIds = entryIds|split(',') %}&#xA;{% endif %}&#xA;&#xA;{# Paginate using the randomised entry IDs in a fixed order, limiting to 15 per page #}&#xA;{% paginate craft.entries.id(entryIds).fixedOrder(true).limit(15) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8495" LastActivityDate="2018-06-15T17:05:47.717" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26577" PostTypeId="2" ParentId="26527" CreationDate="2018-06-15T23:41:40.863" Score="1" Body="&lt;p&gt;You were close!  In Craft 3, &lt;code&gt;postDate&lt;/code&gt; is a full PHP &lt;a href=&quot;https://secure.php.net/manual/en/class.datetime.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateTime object&lt;/a&gt;, so it'd need to be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntriesByYear = allEntries|group('postDate|date(&quot;Y&quot;)') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-15T23:41:40.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26578" PostTypeId="1" AcceptedAnswerId="26579" CreationDate="2018-06-16T09:06:52.293" Score="2" ViewCount="209" Body="&lt;p&gt;I'd like to Restrict access to Element API endpoint by the current user's group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible Using Craft 2?&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-06-16T09:24:41.700" Title="Restrict access to Element API endpoint" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26579" PostTypeId="2" ParentId="26578" CreationDate="2018-06-16T09:24:41.700" Score="2" Body="&lt;p&gt;Yes it is you can see here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1087/check-user-is-in-user-group-custom-user-permissions&quot;&gt;how to check permissions &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the &lt;a href=&quot;https://docs.craftcms.com/api/v2/services/UserSessionService.html#getUser-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;current user&lt;/a&gt; with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentUser = craft()-&amp;gt;userSession-getUser();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can check the same conditions like in the example link. If the conditions are false you can return an empty array instead of your endpoints &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(!$currentUser-&amp;gt;isInGroup('groupHandle')) {&#xA;    return [];&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please make sure to check if the current user is not null &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-16T09:24:41.700" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26580" PostTypeId="1" CreationDate="2018-06-16T16:37:24.950" Score="1" ViewCount="47" Body="&lt;p&gt;Coming to Craft after years with EE, I feel like a newbie again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I painfully managed to built and install a basic plugin for craft3 with composer, (with a little help from the docs and &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;NYstudio107's tutorial&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, the plugin does nothing, and to keep going, I would need to understand how to translate a pattern commonly used in EE.&#xA;Get some data from a template, process it and return it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get tag data and parameters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$data_to_process = ee()-&amp;gt;TMPL-&amp;gt;tagdata;&#xA;$process_param = ee()-&amp;gt;TMPL-&amp;gt;fetch_param('parameter');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output content to template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ee()-&amp;gt;return_data = $processed_data;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ho do you do such things in craft ?&lt;/p&gt;&#xA;" OwnerUserId="7564" LastActivityDate="2018-06-16T17:34:27.587" Title="Plugin development : from ExpressionEngine to Craft" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26581" PostTypeId="2" ParentId="26580" CreationDate="2018-06-16T17:34:27.587" Score="1" Body="&lt;p&gt;If you want to render a template in Craft 3 you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('path/to/template', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to return/render a template within your Controller action you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;renderTemplate('path/to/template', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to render a plugin template you'll need to attach your plugins handle to your path&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 'plugin-handle/path/to/template'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-16T17:34:27.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26582" PostTypeId="1" AcceptedAnswerId="26591" CreationDate="2018-06-17T20:15:07.563" Score="1" ViewCount="94" Body="&lt;p&gt;I am working on a client site and trying to upload the following plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/guest-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/guest-entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directions instructed me to install the app via composer in my project folderj via composer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use composer to install the plugin into a random folder, then FTP upload the same into my client's craft plugins folder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="7167" LastActivityDate="2018-06-18T19:45:56.610" Title="FTP Plugin Not Showing Up" Tags="&lt;plugins&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26583" PostTypeId="1" AcceptedAnswerId="26672" CreationDate="2018-06-17T22:23:19.120" Score="3" ViewCount="627" Body="&lt;p&gt;I have a relationship between users and 'locations', and I'm using the code below to output some markers for a map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all works fine except for two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'm repeating a couple of 'for' loops. When I try not to repeat&#xA;them, the 'markers' and 'markerInfo' return 'undefined'.&lt;/li&gt;&#xA;&lt;li&gt;Within markerInfo, I'd like to list the names (e.g. 'user.firstName') of the users related to that location, but when I try, I get a list of ALL users that have a relationship with ANY location.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In plain language, what I'm trying to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find me all the users who are part of the 'family' group.&lt;/li&gt;&#xA;&lt;li&gt;Find me all the locations which are related to those users and plot each&#xA;one (but only once for each location).&lt;/li&gt;&#xA;&lt;li&gt;For each location, give me a list of the users that have a relationship with it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My &lt;em&gt;source elements&lt;/em&gt; are entries in the section 'locations', with the&#xA;field 'relatedPeople'. &lt;/li&gt;&#xA;&lt;li&gt;My &lt;em&gt;target elements&lt;/em&gt; are 'users' (from the group&#xA;'family').&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I make this more performant (not repeat things), and get a list of users per location within 'markerInfo'?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set people = craft.users.group('family') %}&#xA;&#xA;{% set markers %}&#xA;    {%- for person in people.all() -%}&#xA;        {% set relatedPlaces = craft.entries.section('locations').relatedTo({&#xA;            targetElement: person,&#xA;            field: 'relatedPeople'&#xA;        }) %}&#xA;        {%- for place in relatedPlaces.all() -%}&#xA;        ['{{ place.location.address }}', {{ place.location.lat }},{{ place.location.lng }}],&#xA;        {%- endfor -%}&#xA;    {%- endfor -%}&#xA;{% endset %}&#xA;&#xA;{% set markerInfo %}    &#xA;    {%- for person in people.all() -%}&#xA;        {% set relatedPlaces = craft.entries.section('locations').relatedTo({&#xA;            targetElement: person,&#xA;            field: 'relatedPeople'&#xA;        }) %}&#xA;        {%- for place in relatedPlaces.all() -%}&#xA;        ['&amp;lt;div class=&quot;info_content&quot;&amp;gt;' + '&amp;lt;h5&amp;gt;{{ place.title|e('js') }}&amp;lt;/h5&amp;gt;' + '{% if place.startDate|length %}{{ place.startDate | date('M Y') }}{% endif %}{% if place.startDate|length and place.finishDate|length%} to {% endif %}{% if place.finishDate|length %}{{ place.finishDate | date('M Y') }}{% endif %}' + '&amp;lt;/div&amp;gt;'],&#xA;        {%- endfor -%}&#xA;    {%- endfor -%}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="567" LastActivityDate="2018-12-18T09:11:30.500" Title="Reverse relationships with entries and users" Tags="&lt;users&gt;&lt;relatedto&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26584" PostTypeId="1" AcceptedAnswerId="26607" CreationDate="2018-06-18T09:15:46.347" Score="1" ViewCount="269" Body="&lt;p&gt;I have created a new Category on a Craft 3 website but it will not load the template specified. Have other categories all working fine and can't get this one working at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Category Config below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1h9e1.png]&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1h9e1.png]&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect this to load my template &lt;code&gt;/pupil-of-the-month/index.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the below image in my templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cqQCp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cqQCp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I click on the category url - &lt;code&gt;http://local.domain.com/pupil-of-the-month/class/p1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a not found error - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template not found: pupil-of-the-month/class&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is this Category not following the template specified in the admin settings?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2018-06-19T15:42:35.510" Title="Category not loading template" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26585" PostTypeId="1" AcceptedAnswerId="26589" CreationDate="2018-06-18T10:27:36.957" Score="2" ViewCount="780" Body="&lt;p&gt;I’d like to use Craft as a headless CMS for my mobile app (via the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; plugin). However, in addition to reading data, I’d also like to write data back to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like this is typically done using an &lt;a href=&quot;https://docs.craftcms.com/v3/templating/examples/entry-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Form&lt;/a&gt; on the front-end. Is writing to Craft possible without using Craft’s front-end though (e.g. native inputs in the app that send data via the API instead of a web view with an entry form)? If not, could this be accomplished by forking the Element API and adding that functionality somehow?&lt;/p&gt;&#xA;" OwnerUserId="8498" LastActivityDate="2018-06-18T16:47:44.690" Title="Write to Craft via Element API" Tags="&lt;plugin-elementapi&gt;&lt;frontend-form&gt;&lt;entry-form&gt;&lt;app&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26588" PostTypeId="2" ParentId="26584" CreationDate="2018-06-18T16:34:04.640" Score="1" Body="&lt;p&gt;The template path specified in the admin should point to a single file, not a directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;index&lt;/code&gt; files are only loaded when the Craft router falls all the way through element URIs and starts to look in your templates folder—in your case, that would be &lt;code&gt;local.domain.com/pupil-of-the-month&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect the confusion lies in that the router &lt;em&gt;does&lt;/em&gt; eagerly look inside a directory for &lt;code&gt;index.*&lt;/code&gt; templates in some narrow cases (as stated above), but that the pattern is not adopted by Category/Section/Tag settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the official &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Routing Docs&lt;/a&gt; for more information about the process Craft uses to resolve the template for a request.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-18T16:34:04.640" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26589" PostTypeId="2" ParentId="26585" CreationDate="2018-06-18T16:47:44.690" Score="1" Body="&lt;p&gt;I'd caution against trying to adapt the ElementAPI plugin for this purpose, as it was designed to be read-only—it's basically a wrapper around Craft's &lt;code&gt;ElementQuery&lt;/code&gt; interface, which does not handle write operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In lieu of that, you might take a look at the &lt;a href=&quot;https://github.com/markhuot/craftql&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftQL plugin&lt;/a&gt;, by Mark Huot. It supports sophisticated queries (reading), as well as mutations (writing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, if the scope of the content you need to update is relatively narrow (i.e. you know what section and fields you need to use), I'd recommend reading through the &lt;a href=&quot;https://docs.craftcms.com/v3/plugin-intro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin docs&lt;/a&gt;, and determining whether it's something you could build on your own, with a simple Controller and supporting Service(s)!&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-18T16:47:44.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26591" PostTypeId="2" ParentId="26582" CreationDate="2018-06-18T19:45:56.610" Score="3" Body="&lt;p&gt;If you FTP up the entire &lt;code&gt;vendor&lt;/code&gt; folder, all of the same libraries should be available. Make sure it is properly installed locally, first.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-18T19:45:56.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26592" PostTypeId="1" CreationDate="2018-06-18T20:49:52.960" Score="1" ViewCount="706" Body="&lt;p&gt;I have a front end user registration form, and I want users to receive a set password email after they've been activated manually in the back end by an admin. When they submit the user registration form, their account shouldn't be automatically activated, so I've checked the &quot;verify email addresses&quot; option in the user settings. However, with this setting enabled, a new user automatically receives an email to activate their account. Is there a way to prevent this account activation email from being sent when the user is first created in the system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can prevent the initial account activation email from being sent, I can add a trigger to a custom module that sends the set password email after the user is activated by an admin, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        Users::class,&#xA;        Users::EVENT_AFTER_ACTIVATE_USER,&#xA;        function (Event $event) {&#xA;            $users = Craft::$app-&amp;gt;getUsers();&#xA;            $users-&amp;gt;sendActivationEmail($event-&amp;gt;user);&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would allow me to have the set password email sent at the appropriate time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, how can I have a front end registered user receive a set password email only after their account has been activated manually by an admin?&lt;/p&gt;&#xA;" OwnerUserId="5290" LastActivityDate="2019-05-27T22:04:28.100" Title="How can I prevent an account activation email from being sent to an unverified user who registered via a front end registration form?" Tags="&lt;craft3&gt;&lt;users&gt;&lt;emails&gt;&lt;activation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26593" PostTypeId="2" ParentId="26592" CreationDate="2018-06-18T21:20:26.080" Score="1" Body="&lt;p&gt;After a little more work, I came up with this approach that works-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I unchecked the verify email addresses option in the user settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I added another trigger in my custom module- on before user save- that sets the new user's status to pending. The two triggers combined produce the functionality I'm looking for: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        User::class,&#xA;        User::EVENT_BEFORE_SAVE,&#xA;        function (Event $event) {&#xA;            if($event-&amp;gt;isNew) {&#xA;                $event-&amp;gt;sender-&amp;gt;pending = true;&#xA;            }&#xA;        }&#xA;    );&#xA;&#xA;    Event::on(&#xA;        Users::class,&#xA;        Users::EVENT_AFTER_ACTIVATE_USER,&#xA;        function (Event $event) {&#xA;            $users = Craft::$app-&amp;gt;getUsers();&#xA;            $users-&amp;gt;sendActivationEmail($event-&amp;gt;user);&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5290" LastActivityDate="2018-06-18T21:20:26.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26594" PostTypeId="1" CreationDate="2018-06-18T22:17:15.570" Score="1" ViewCount="898" Body="&lt;p&gt;I am having some trouble when trying to create a new Entry in Craft3 via PHP. In Craft 2, I was able to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  $entry = new EntryModel();&#xA;  $entry-&amp;gt;getContent()-&amp;gt;title = $name;&#xA;  $entry-&amp;gt;getContent()-&amp;gt;answer = $answer;&#xA;  $handle = &quot;nameOfTheSectionIWantToSaveIn&quot;;&#xA;  $entry-&amp;gt;sectionId = craft()-&amp;gt;sections-&amp;gt;getSectionByHandle($handle)-&amp;gt;id;&#xA;  $save = craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before asking, I took some time to read through the &lt;a href=&quot;https://docs.craftcms.com/api/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft3 Class Reference&lt;/a&gt; and came across the namespace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft\elements&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have come to the conclusion(could be wrong) that I need to use something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\Entry;&#xA;$entry = new Entry();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I am a little confused as to where I go from here. I checked the available &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-entry.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Entry Public Methods&lt;/a&gt; and could not find a method like getContent(), which was used in Craft2. I did see a getContentTable(), but not sure if thats what I am looking for.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-06-18T22:17:15.570" Title="Create an Entry With PHP in CraftCMS3" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26595" PostTypeId="1" AcceptedAnswerId="26596" CreationDate="2018-06-19T07:16:47.043" Score="3" ViewCount="352" Body="&lt;p&gt;I would like to add a custom field for order by on the drop down menu on admin CP. How can I do it, is there any event for this in Craft 3? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a plugin related question, we are using custom plugin to customize our application&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-06-21T05:58:36.900" LastActivityDate="2018-06-26T19:45:14.730" Title="How can I add custom field to order by on the admin CP in Craft 3?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26596" PostTypeId="2" ParentId="26595" CreationDate="2018-06-19T07:40:32.393" Score="3" Body="&lt;p&gt;You can take a look at this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/5029/set-custom-sort-order-for-index-pages-in-the-cp&quot;&gt;Set custom sort order for index pages in the CP?&lt;/a&gt; for Craft 2 and see &lt;a href=&quot;https://docs.craftcms.com/v3/updating-plugins.html#modifyentrysortableattributes-modifycategorysortableattributes-modifyassetsortableattributes-modifyusersortableattributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;updating Plugins for Craft 3&lt;/a&gt; in the docs&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// Old:&#xA;public function modifyEntrySortableAttributes(&amp;amp;$attributes)&#xA;{&#xA;    $attributes['id'] = Craft::t('ID');&#xA;}&#xA;&#xA;// New:&#xA;use craft\base\Element;&#xA;use craft\elements\Entry;&#xA;use craft\events\RegisterElementSortOptionsEvent;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(Entry::class, Element::EVENT_REGISTER_SORT_OPTIONS, function(RegisterElementSortOptionsEvent $event) {&#xA;    $event-&amp;gt;sortOptions['id'] = \Craft::t('app', 'ID');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind your field must be sortable via SQL&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="45" LastEditDate="2018-06-26T19:45:14.730" LastActivityDate="2018-06-26T19:45:14.730" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26597" PostTypeId="1" CreationDate="2018-06-19T07:53:04.623" Score="1" ViewCount="234" Body="&lt;p&gt;How can I change the domain in the generated &lt;code&gt;{{ link }}&lt;/code&gt; in a system email, other than the primary domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a multi domain setup in craft3, and it works fine everywhere, except ... for the system messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when a user registers using a front-end entry form on a domain other than my primary domain, they receive the correct email, generated by the following template (Admin -&gt; Email Settings -&gt; System Messages):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hey {{user.friendlyName}},&#xA;&#xA;Thanks for creating an account with {{siteName}}! To activate your account, click the following link:&#xA;&#xA;{{link}}&#xA;&#xA;If you were not expecting this email, just ignore it.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;The &lt;code&gt;{{ siteName }}&lt;/code&gt; is rendered correctly in the email, but the &lt;code&gt;{{ link }}&lt;/code&gt; still points to the primary domain, something like this: &lt;code&gt;https://myprimaryandhtusthewrongdomain/actions/users/set-password?code=nicecode&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the mailgun adapter to send the mails btw&lt;/p&gt;&#xA;" OwnerUserId="8500" LastEditorUserId="8500" LastEditDate="2018-06-19T08:06:44.353" LastActivityDate="2018-06-25T23:48:22.470" Title="Multisite system messages: change domain in {{ link }}, other than primary domain" Tags="&lt;craft3&gt;&lt;emails&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26598" PostTypeId="1" CreationDate="2018-06-19T11:24:36.550" Score="1" ViewCount="272" Body="&lt;p&gt;I am experiencing a very weird issue. I have a simple user registration form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;addTeacherForm&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[schoolId][]&quot; value=&quot;{{ currentUser.id }}&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;groups[]&quot; value=&quot;3&quot; /&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;username&quot;&amp;gt;Username &amp;lt;span class=&quot;text-danger&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;username&quot; required /&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;         &amp;lt;label for=&quot;email&quot;&amp;gt;E-mailadres &amp;lt;span class=&quot;text-danger&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;email&quot; type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;email&quot; required /&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;password&quot;&amp;gt;Password &amp;lt;span class=&quot;text-danger&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; class=&quot;form-control&quot; name=&quot;password&quot; required /&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;button type=&quot;submit&quot; class=&quot;btn btn-primary btn-submit float-right&quot;&amp;gt;&#xA;            Docent toevoegen&#xA;        &amp;lt;/button&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an event listener for the form submit and I submit the form using ajax. This code works perfectly most of the time, but sometimes (like 20% of the time) I get a 403 forbidden error in the console. When I comment out the hidden groups[] input field I don't experience this issue at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also worth noting that even though I get this error the user is created but doesn't get added to the group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm starting to think this is a craft 3 issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I somehow solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2018-06-19T13:42:39.137" Title="Ajax User registration sometimes forbidden 403 error" Tags="&lt;ajax&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2018-06-26T04:16:55.560" ContentLicense="CC BY-SA 4.0" />
  <row Id="26599" PostTypeId="2" ParentId="26598" CreationDate="2018-06-19T11:49:39.943" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I somehow solve this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes by creating a custom Controller. Because the default &lt;code&gt;UsersController&lt;/code&gt; does the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Don't validate required custom fields if it's public registration&#xA;if (!$thisIsPublicRegistration) {&#xA;    $user-&amp;gt;setScenario(Element::SCENARIO_LIVE);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;without &lt;code&gt;SCENARIO_LIVE&lt;/code&gt; custom fields won't be stored&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-19T11:49:39.943" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26600" PostTypeId="2" ParentId="25698" CreationDate="2018-06-19T12:29:46.643" Score="3" Body="&lt;p&gt;I had a similar problem where I needed to manage national and regional users groups where regional users should only see their own content. I didn’t like the idea of overriding the whole &lt;code&gt;ElementIndexesController&lt;/code&gt; controller as most of its properties and methods are private and that could impede upgrades to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to have this work by using &lt;code&gt;ElementQuery::EVENT_BEFORE_PREPARE&lt;/code&gt; in my site module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regional content is assigned a region category with an attribute (numeroRegion) that match the last 2 characters of the regional group handle (ex.: &quot;01&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I’m using the Collections plugin to filter and map the groups.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($user &amp;amp;&amp;amp; $user-&amp;gt;id &amp;amp;&amp;amp; !$user-&amp;gt;identity-&amp;gt;admin &amp;amp;&amp;amp; $request-&amp;gt;getIsCpRequest()) {&#xA;  Event::on(ElementQuery::class, ElementQuery::EVENT_BEFORE_PREPARE, function(Event $event) use ($user) {&#xA;&#xA;    if ($event-&amp;gt;sender-&amp;gt;elementType === 'craft\elements\Entry') {&#xA;        $userGroups = Collections::$plugin-&amp;gt;collectionsService-&amp;gt;collect(Craft::$app-&amp;gt;userGroups-&amp;gt;getGroupsByUserId($user-&amp;gt;id));&#xA;      $isNational = $userGroups-&amp;gt;filter(function($group) {&#xA;        return (int)$group-&amp;gt;id === 1;&#xA;      })-&amp;gt;isNotEmpty();&#xA;&#xA;      if (!$isNational) {&#xA;        $userRegionGroups = $userGroups-&amp;gt;map(function($group) {&#xA;          return substr($group-&amp;gt;handle, -2);&#xA;        });&#xA;        $regions = Category::find()-&amp;gt;numeroRegion($userRegionGroups)-&amp;gt;all();&#xA;        Craft::configure($event-&amp;gt;sender, [&#xA;          'relatedTo' =&amp;gt; [&#xA;            'element' =&amp;gt; $regions&#xA;          ]&#xA;        ]);&#xA;      }&#xA;    }&#xA;  });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: it works, but this is my first attempt at this kind of hack, and it may have side effects I haven’t noticed yet.&lt;/p&gt;&#xA;" OwnerUserId="3633" LastActivityDate="2018-06-19T12:29:46.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26602" PostTypeId="1" AcceptedAnswerId="26615" CreationDate="2018-06-19T12:35:37.163" Score="2" ViewCount="74" Body="&lt;p&gt;I'm using Solspace plugin. I've related each event to a show. I want to get the event with its related show (Entry type).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'v tried (Among others):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$calendarEvent = Event::find([&#xA;            'id' =&amp;gt; $id,&#xA;        ])-&amp;gt;with(['shows'])-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, that gives me the event(✅) but in the show, I don't get the entry per se but I get like an unexecuted query. Looks something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {&#xA;            &quot;id&quot;: 22,&#xA;            &quot;url&quot;: null,&#xA;            &quot;title&quot;: &quot;The Way You Sound&quot;,&#xA;            &quot;slug&quot;: &quot;the-way-you-sound&quot;,&#xA;            &quot;start&quot;: &quot;2018-12-14T18:00:00+00:00&quot;,&#xA;            &quot;end&quot;: &quot;2018-12-14T20:00:00+00:00&quot;,&#xA;            &quot;allDay&quot;: false,&#xA;            &quot;multiDay&quot;: false,&#xA;            &quot;repeats&quot;: true,&#xA;            &quot;readableRepeatRule&quot;: &quot;Weekly on Friday, starting from Dec 14, 2018, forever&quot;,&#xA;            &quot;calendar&quot;: {&#xA;                &quot;id&quot;: 1,&#xA;                &quot;name&quot;: &quot;Shows&quot;,&#xA;                &quot;handle&quot;: &quot;default&quot;&#xA;            },&#xA;            &quot;site&quot;: {&#xA;                &quot;id&quot;: &quot;1&quot;,&#xA;                &quot;name&quot;: &quot;English&quot;,&#xA;                &quot;handle&quot;: &quot;default&quot;,&#xA;                &quot;language&quot;: &quot;en-US&quot;&#xA;            },&#xA;            &quot;editable&quot;: false,&#xA;            &quot;enabled&quot;: true,&#xA;            &quot;backgroundColor&quot;: &quot;#C0BE11&quot;,&#xA;            &quot;borderColor&quot;: &quot;#868900&quot;,&#xA;            &quot;textColor&quot;: &quot;black&quot;,&#xA;&#xA;    ======&amp;gt; &quot;show&quot;: {&#xA;                &quot;editable&quot;: false,&#xA;                &quot;orderBy&quot;: {&#xA;                    &quot;relations.sortOrder&quot;: 4&#xA;                },&#xA;                  ...&#xA;                &quot;join&quot;: [&#xA;                    [&#xA;                        &quot;INNER JOIN&quot;,&#xA;                        &quot;{{%relations}} relations&quot;, [&#xA;                            &quot;and&quot;,&#xA;                            &quot;[[relations.targetId]] = [[elements.id]]&quot;,&#xA;                            {&#xA;                                &quot;relations.sourceId&quot;: &quot;22&quot;,&#xA;                                &quot;relations.fieldId&quot;: &quot;42&quot;&#xA;                            },&#xA;                            [&#xA;                                &quot;or&quot;,&#xA;                                {&#xA;                                    &quot;relations.sourceSiteId&quot;: null&#xA;                                },&#xA;                                {&#xA;                                    &quot;relations.sourceSiteId&quot;: &quot;1&quot;&#xA;                                }&#xA;                            ]&#xA;                        ]&#xA;                    ]&#xA;                ],&#xA;                &quot;having&quot;: null,&#xA;                &quot;union&quot;: null&#xA;            }&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-06-20T15:32:42.383" Title="Eager load elements from Solspace Plugin" Tags="&lt;plugin-development&gt;&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26603" PostTypeId="1" AcceptedAnswerId="27689" CreationDate="2018-06-19T12:45:34.597" Score="1" ViewCount="110" Body="&lt;p&gt;I have an instance of BaseJob that I occasionally queue up that involves reading an XML file from another server. However, requests to that server are rate-limited, and so occasionally it will fail with an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't mind this in terms of the logic of how it works - I just request another version a while later. However, every time it fails, it adds a message into the &quot;Failed&quot; tab in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to prevent/override this? I have tried suppressing errors in the job, I've tried wrapping the whole thing within a try/catch block, but nothing seems to work - whenever it fails, it is logged in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastActivityDate="2018-09-13T13:56:31.257" Title="How to prevent &quot;Failed&quot; errors in job scheduler in Craft CMS 3?" Tags="&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26604" PostTypeId="2" ParentId="26598" CreationDate="2018-06-19T13:42:39.137" Score="0" Body="&lt;p&gt;I found out that this has been an issue since December 2017: &lt;a href=&quot;http://github.com/craftcms/cms/issues/2194&quot; rel=&quot;nofollow noreferrer&quot;&gt;github.com/craftcms/cms/issues/2194&lt;/a&gt; .I hope they fix it soon. For now I'll go back to craft 2&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2018-06-19T13:42:39.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26606" PostTypeId="1" CreationDate="2018-06-19T15:26:48.967" Score="1" ViewCount="195" Body="&lt;p&gt;I'm using Solspace Calendar for events, I also have a standard channel for reviews. What I need is the ability to connect the review with the event. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solspace offers &quot;Calendar Events&quot; custom type field to do that, however, when I use it and attach an event to it this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reviews = craft.entries.section('reviews').relatedTo(event) %}&#xA;{% if reviews|length %}&#xA;   {% for review in reviews %}&#xA;      &amp;lt;h5&amp;gt;{{review.title}}&amp;lt;/h5&amp;gt;&#xA;      &amp;lt;p&amp;gt;{{review.description|nl2br}}&amp;lt;/p&amp;gt;&#xA;   {% endfor %}&#xA;{% else %}&#xA;   &amp;lt;p&amp;gt;There are no reviews yet&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;isn't working, and I have the same code working for a standard entry. How do I use relatedTo on custom fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works on a different page with entry present&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reviews = craft.entries.section('reviews').relatedTo(entry) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doens't work when event present&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reviews = craft.entries.section('reviews').relatedTo(event) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've made sure that: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the event is fetched, and I'm successfully accessing it via code above&lt;/li&gt;&#xA;&lt;li&gt;there are indeed reviews with this event attached&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fijv6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fijv6.png&quot; alt=&quot;reviews in admin&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2018-06-20T06:41:02.487" LastActivityDate="2018-06-20T07:23:18.513" Title="Relating to Solspace Calendar Events" Tags="&lt;relations&gt;&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26607" PostTypeId="2" ParentId="26584" CreationDate="2018-06-19T15:42:35.510" Score="0" Body="&lt;p&gt;Discovered what the issues was - it was my actual Category Names - the Class names which I had called, P1, P2, P3, P4 etc, which had a slug of p1, p2 etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft was picking those up as page numbers - and trying to route for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discovered it when I had created an entry in a Structure with the title P1 which wasn't loading either.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2018-06-19T15:42:35.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26608" PostTypeId="1" CreationDate="2018-06-19T18:27:58.370" Score="1" ViewCount="989" Body="&lt;p&gt;For the last weeks I've tried installing composer, but without any luck. I've really tried aaa  looott, and how frustrating it is, it's just not working with SSLv3 for some strange reason.&#xA;This was the thread I opened: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26517/unable-to-get-composer-running-to-install-craftcms?noredirect=1#comment34840_26517&quot;&gt;Unable to get composer running to install CraftCMS&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I had to give up, at least for now, to be able to use Composer and had to decide to switch to manually setup craft, which I just did. But now I'm having a problem installing plugins. The Plugin store isn't working and it probably uses composer in the back (?). I've found a question here about how to manually install plugins without the plugin store, but... it also uses composer. Which isn't working here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another way of installing plugins manually?&lt;/p&gt;&#xA;" OwnerUserId="8483" LastActivityDate="2018-06-30T18:55:27.813" Title="How to install plugin without composer?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26609" PostTypeId="2" ParentId="26606" CreationDate="2018-06-19T20:59:46.207" Score="1" Body="&lt;p&gt;You can use them the same way like you are used to everywhere else. All relation fields extend the same &lt;code&gt;BaseRelationField&lt;/code&gt; so their logic is totally equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either pass an element, an element id or an &lt;code&gt;ElementQuery&lt;/code&gt;/&lt;code&gt;ElementCriteriaModel&lt;/code&gt; but not a string to the function. If you want to fetch all related elements of an event you'll need to fetch the event first &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-19T20:59:46.207" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26610" PostTypeId="2" ParentId="26606" CreationDate="2018-06-20T07:23:18.513" Score="1" Body="&lt;p&gt;After experimenting with syntax a bit I made it work, looks like it needs an id, but it doesn't work with the event as an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set reviews = craft.entries.section('reviews').relatedTo(event.id) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2018-06-20T07:23:18.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26611" PostTypeId="2" ParentId="15212" CreationDate="2018-06-20T07:36:34.573" Score="1" Body="&lt;p&gt;Had the same issue. In my case there was no phperrors.log (according to Brandon, it will only exist if there have been any fatal PHP errors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error was instead logged to storage/logs/web.log, but even easier, you can view the error in the CP. Craft (as of version 3.0.12) does not show it to the user (hopefully that will change, see &lt;a href=&quot;https://github.com/craftcms/cms/issues/3012&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3012&lt;/a&gt;), but currently you can show the errors (as advised by Brandon) by opening your browser's dev tools network tab before running the asset index utility, and keep track of the Ajax requests that get logged when the utility is running (XHR tab). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case the error was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Malformed UTF-8 characters, possibly incorrectly encoded.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I fixed it by running this on the files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;convmv  -r -f windows-1252 -t UTF-8 .&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2018-06-20T07:36:34.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26612" PostTypeId="2" ParentId="11152" CreationDate="2018-06-20T08:33:58.830" Score="1" Body="&lt;p&gt;Maybe it's an ugly solution but I wanted to keep using only the siteUrl variable, so I added this to my _layout.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if '/fr/' in siteUrl %}&#xA;  {% set siteUrl = siteUrl|slice(length, -3) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the siteUrl will return the URL defined in the settings, without the &quot;fr/&quot;.&lt;/p&gt;&#xA;" OwnerUserId="8504" LastActivityDate="2018-06-20T08:33:58.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26613" PostTypeId="1" CreationDate="2018-06-20T11:58:00.730" Score="1" ViewCount="489" Body="&lt;p&gt;I have a webshop where you can get free shipping when the minimum total order price is €150.&#xA;Product prices are set up so they include VAT (21%).&#xA;VAT is removed when orders are shipped outside the Netherlands.&#xA;In most scenarios shipping cost calculation is not a problem but there is one VAT-related  specific scenario where it is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's begin with the scenario that works as expected: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) User buys product(s) which include VAT and the total order amount is  €151. Shipping address is inside EU so he is correctly eligible for free shipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets go to the scenario where it does not work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) User buys the same product(s) as above and the total order amount is again €151. User is again eligible for free shipping but this time shipping is outside the Netherlands. That means that VAT is being excluded and therefore the final amount that user has to pay is below €150 and therefore he should pay for the shipping. But this is not happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that system reads the 'total order price' as the total amount of the order before the tax reduction is applied. Therefore, according to the system user is eligible for free shipping. Though this is not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Is there any way to make system look at the &quot;final&quot; total amount so the shipping calculation is correct?&lt;/p&gt;&#xA;" OwnerUserId="7378" LastActivityDate="2018-07-23T07:08:32.760" Title="Craft Commerce Shipping Total Order Price rule" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;shipping&gt;&lt;tax&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26614" PostTypeId="2" ParentId="10812" CreationDate="2018-06-20T14:10:47.120" Score="10" Body="&lt;h2&gt;Update for Craft 3:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To get the same output as Mike's path above, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$volumePath = $asset-&amp;gt;getVolume()-&amp;gt;settings['path'];&#xA;$folderPath = $asset-&amp;gt;getFolder()-&amp;gt;path;&#xA;$assetFilePath = Yii::getAlias($volumePath) . $folderPath . $asset-&amp;gt;filename;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7260" LastEditorUserId="7260" LastEditDate="2018-06-20T15:47:30.567" LastActivityDate="2018-06-20T15:47:30.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26615" PostTypeId="2" ParentId="26602" CreationDate="2018-06-20T15:32:42.383" Score="1" Body="&lt;p&gt;Currently Calendar does not support eager loading, but it's much more likely the Craft 3 version will in the future, as we refactored a lot of code and tried to somewhat &quot;normalize&quot; the code to work more natively with Craft than we did in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-06-20T15:32:42.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26616" PostTypeId="1" CreationDate="2018-06-20T19:34:19.907" Score="1" ViewCount="449" Body="&lt;p&gt;I’m experimenting with the Element API plugin and working with querying the tags of the assets that appear in matrix blocks in a set of entries. Essentially I’m hoping to be able to use a tag in a query string to return a list of entries where any asset with that tag appears. I’ve gotten as far as returning all of the information I need, but I’m having trouble figuring out how (or whether I can?) use a search function GET request to retrieve the list of entries I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where I am:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/projects.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'pretty' =&amp;gt; true,&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'projects',&#xA;            'type' =&amp;gt; 'projectDetail',&#xA;        ],&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;            $relatedAssets = [];&#xA;            foreach ($entry-&amp;gt;projectDetailMatrix as $block) {&#xA;                $image = '';&#xA;                $id = '';&#xA;                $tags = [];&#xA;                $asset = $block-&amp;gt;imageSelection[0];&#xA;                if (!is_null($block-&amp;gt;imageSelection)) {&#xA;                    $image = $asset-&amp;gt;getUrl();&#xA;                    $id = $asset-&amp;gt;id;&#xA;                    foreach ($asset-&amp;gt;tags as $tag) {&#xA;                        $tags[] = $tag-&amp;gt;slug;&#xA;                    }&#xA;                    $relatedAssets[] = [&#xA;                        'assetUrl' =&amp;gt; $image,&#xA;                        'assetId' =&amp;gt; $id,&#xA;                        'assetTags' =&amp;gt; $tags&#xA;                    ];&#xA;                }&#xA;            }&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                'relatedAssets' =&amp;gt; $relatedAssets,&#xA;            ];&#xA;        },&#xA;    ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's what I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;data&quot;: [&#xA;        {&#xA;            &quot;title&quot;: &quot;Project1&quot;,&#xA;            &quot;url&quot;: &quot;http://site.dev/project1&quot;,&#xA;            &quot;relatedAssets&quot;: [&#xA;                {&#xA;                    &quot;assetUrl&quot;: &quot;//site.dev/uploads/image1.png&quot;,&#xA;                    &quot;assetId&quot;: &quot;12&quot;,&#xA;                    &quot;assetTags&quot;: [&#xA;                        &quot;red&quot;,&#xA;                        &quot;dark&quot;&#xA;                    ]&#xA;                },&#xA;                {&#xA;                    &quot;assetUrl&quot;: &quot;//site.dev/uploads/image2.png&quot;,&#xA;                    &quot;assetId&quot;: &quot;13&quot;,&#xA;                    &quot;assetTags&quot;: [&#xA;                        &quot;red&quot;&#xA;                    ]&#xA;                }&#xA;            ]&#xA;        },&#xA;        {&#xA;            &quot;title&quot;: &quot;Project2&quot;,&#xA;            &quot;url&quot;: &quot;http://site.dev/project2&quot;,&#xA;            &quot;relatedAssets&quot;: [&#xA;                {&#xA;                    &quot;assetUrl&quot;: &quot;//site.dev/uploads/image3.jpg&quot;,&#xA;                    &quot;assetId&quot;: &quot;14&quot;,&#xA;                    &quot;assetTags&quot;: [&#xA;                        &quot;blue&quot;,&#xA;                        &quot;dark&quot;&#xA;                    ]&#xA;                },&#xA;            ]&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my end goal would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/api/projects.json?t=dark&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returning the Project entries whose matrix content includes an asset with the tag &quot;dark&quot;. Is this possible, or too much of a rabbit hole at this point? Any pointers appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8508" LastActivityDate="2018-06-20T19:34:19.907" Title="Element API plugin: searching and working with nested objects" Tags="&lt;craft3&gt;&lt;php&gt;&lt;elementcriteriamodel&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26617" PostTypeId="1" AcceptedAnswerId="26619" CreationDate="2018-06-20T21:12:39.093" Score="2" ViewCount="237" Body="&lt;p&gt;Our users are getting logged out after 1 day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a setting that changes how long users’ sessions will last?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="4169" LastEditDate="2018-06-21T09:04:42.980" LastActivityDate="2018-06-21T09:04:42.980" Title="Is it possible to change the amount of time a user stays logged in for?" Tags="&lt;users&gt;&lt;config&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26619" PostTypeId="2" ParentId="26617" CreationDate="2018-06-20T22:49:32.963" Score="3" Body="&lt;p&gt;Yes! The setting is called &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-usersessionduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;userSessionDuration&lt;/code&gt;&lt;/a&gt;, and you can set it in your &lt;code&gt;general.php&lt;/code&gt; config file, on a per-environment basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-confighelper.html#method-durationinseconds&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's an explanation&lt;/a&gt; of the values that you can use for the setting—for posterity: integers (in seconds), a PHP duration expression, an initialized &lt;code&gt;DateInterval&lt;/code&gt; object, or &lt;code&gt;0&lt;/code&gt; for &quot;indefinite.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The link above points to the Craft 3 documentation, but &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#usersessionduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;the same setting&lt;/a&gt; is available in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-20T22:49:32.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26620" PostTypeId="1" AcceptedAnswerId="26621" CreationDate="2018-06-21T00:42:29.023" Score="1" ViewCount="10" Body="&lt;p&gt;I need to assign a # 1-N for each entry that is returned -- i.e., 1, 2, 3, 4, ....   (This is for a sort plugin.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I template for that?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-21T01:40:59.117" Title="Assign a number 1-N for each entry that is returned" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26621" PostTypeId="2" ParentId="26620" CreationDate="2018-06-21T01:40:59.117" Score="1" Body="&lt;p&gt;If you're in the context of a Twig loop, you have access to the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;loop&lt;/code&gt; variable&lt;/a&gt;, which has a number of “magic” properties set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set posts = craft.entries({ section: 'posts' }).all %}&#xA;{% for post in posts %}&#xA;  Post #{{ loop.index }} is named: {{ post.title }}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-06-21T01:40:59.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26622" PostTypeId="1" CreationDate="2018-06-21T04:54:46.773" Score="1" ViewCount="237" Body="&lt;pre&gt;&lt;code&gt;$blocks = MatrixBlock::find()-&amp;gt;relatedTo($entry)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above returns the correct blocks but all fields are returned as NULL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read over at &lt;a href=&quot;https://github.com/craftcms/cms/issues/1789&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub&lt;/a&gt; that we need to specify a fieldId param but can't seem to figure out how.  The below e.g. doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$blocks = MatrixBlock::find()-&amp;gt;relatedTo($entry)-&amp;gt;fieldId([33])-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help anyone?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-06-21T05:27:01.173" Title="Matrix block fields returning NULL when using MatrixBlock query" Tags="&lt;matrix&gt;&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;query&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26623" PostTypeId="2" ParentId="26622" CreationDate="2018-06-21T05:27:01.173" Score="1" Body="&lt;p&gt;The right Field ID to add is the &lt;code&gt;Matrix&lt;/code&gt; field id as defined in the &lt;code&gt;Fields&lt;/code&gt; section.  Do not use the ids of the matrix block fields.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-06-21T05:27:01.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26625" PostTypeId="1" AcceptedAnswerId="26626" CreationDate="2018-06-21T08:15:49.877" Score="1" ViewCount="126" Body="&lt;p&gt;I'm working on porting a Yii2 component to Craft CMS as a plugin.&#xA;This Yii2 component provides a debug bar custom panel that I'd like to enable&#xA;in Craft CMS too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In classic Yii2 applications, this is done by adding an entry to the &#xA;&lt;code&gt;modules.debug.panels&lt;/code&gt; configuration directive:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'bootstrap' =&amp;gt; ['debug'],&#xA;'modules' =&amp;gt; [&#xA;    'debug' =&amp;gt; [&#xA;        'class' =&amp;gt; 'yii\\debug\\Module',&#xA;        'panels' =&amp;gt; [&#xA;            'elasticsearch' =&amp;gt; [&#xA;                'class' =&amp;gt; 'my\\namespace\\DebugPanel',&#xA;            ],&#xA;        ],&#xA;    ],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, Craft 3 seems to hardcode this configuration in the&#xA;&lt;code&gt;craft\web\Application::debugBootstrap()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to add a custom panel to the debugbar in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="7715" LastActivityDate="2020-10-05T10:53:54.780" Title="How to add a custom panel to the debug bar?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;debugging&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26626" PostTypeId="2" ParentId="26625" CreationDate="2018-06-21T08:15:49.877" Score="2" Body="&lt;p&gt;I'm not sure this is the proper way to do it but I got this working.&lt;/p&gt;&#xA;&lt;p&gt;I used the &lt;code&gt;Yii\Application::EVENT_BEFORE_REQUEST&lt;/code&gt; event in my plugin's&#xA;&lt;code&gt;init()&lt;/code&gt; method:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace my\namespace;&#xA;&#xA;use craft\base\Plugin;&#xA;use craft\web\Application;&#xA;&#xA;class MyPlugin extends Plugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        Event::on(&#xA;            Application::class, &#xA;            Application::EVENT_BEFORE_REQUEST, &#xA;            function() {&#xA;                /** @var \yii\debug\Module */&#xA;                $debugModule = Craft::$app-&amp;gt;getModule('debug');&#xA;                &#xA;                $debugModule-&amp;gt;panels['mycustompanel'] = new DebugPanel(['module' =&amp;gt; $debugModule]);&#xA;            }&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;At first, I thought about using the &lt;code&gt;yii\base\Controller::EVENT_BEFORE_ACTION&lt;/code&gt;&#xA;event, but in order to work, the Yii2 component needed to add some routes  and&#xA;the &lt;code&gt;EVENT_BEFORE_ACTION&lt;/code&gt; event occurs after routing has been done.&lt;/p&gt;&#xA;&lt;p&gt;Any other event I could think of occurred too early, before Craft had called&#xA;the &lt;code&gt;craft\web\Application::debugBootstrap()&lt;/code&gt; method.&lt;/p&gt;&#xA;&lt;p&gt;So far it works but if anyone has a suggestion on the proper way to do it, I'm all hears.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit 10/05/2020&lt;/strong&gt;: it looks like I was almost there. I was just missing the &lt;code&gt;id&lt;/code&gt; property in the Panel's constructor parameter. Without it, clicking your panel name in the collapsed debug bar won't open straight away on your panel's tab.&lt;/p&gt;&#xA;&lt;p&gt;It's also important to check that the Debug module is loaded before adding your panel to it. Otherwise users having the debug bar disabled would get errors.&lt;/p&gt;&#xA;&lt;p&gt;I found out by looking at the code in Ben Croker's &lt;a href=&quot;https://github.com/putyourlightson/craft-elements-panel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Panel&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    Application::class,&#xA;    Application::EVENT_BEFORE_REQUEST,&#xA;    function () {&#xA;        /** @var \yii\debug\Module */&#xA;        $debugModule = Craft::$app-&amp;gt;getModule('debug');&#xA;&#xA;        if ($debugModule) {&#xA;            $debugModule-&amp;gt;panels['mycustompanel'] = new DebugPanel([&#xA;                'id'     =&amp;gt; 'mycustompanel',&#xA;                'module' =&amp;gt; $debugModule,&#xA;            ]);&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7715" LastEditorUserId="7715" LastEditDate="2020-10-05T10:53:54.780" LastActivityDate="2020-10-05T10:53:54.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26627" PostTypeId="1" CreationDate="2018-06-21T10:20:29.927" Score="1" ViewCount="262" Body="&lt;p&gt;Coming from a Yii2 background, I am accustomed to doing things in an MVC way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up a demo Craft CMS application to have a play around with. I've created a &quot;singles&quot; page (homepage) and got it displaying data. What I want to know is, how do I pass custom variables to the view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have a function that fetches tweets from my Twitter account, I would like this data to be displayed on the homepage. In Yii2 I would normally do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace app\controllers;&#xA;&#xA;use yii\web\Controller;&#xA;use app\services\TwitterFeedService;&#xA;&#xA;class SiteController extends Controller&#xA;{&#xA;    public function index()&#xA;    {&#xA;        $twitterFeed = TwitterFeedService::getTweets();&#xA;&#xA;        return $this-&amp;gt;render('index', [&#xA;            'twitterFeed' =&amp;gt; $twitterFeed,&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But since there is no controller or action for my homepage at the moment, I am not sure how I would go about doing this in Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="8511" LastActivityDate="2018-06-21T14:50:55.107" Title="Pass custom variable to view" Tags="&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26628" PostTypeId="1" CreationDate="2018-06-21T12:31:11.570" Score="1" ViewCount="143" Body="&lt;p&gt;I have a multi-level structure in Craft that is being used for navigation. As part of this I have a few different entry types, but each entry that links to a page has a entry-field of singlePage. At the moment the load times are stupid and I am trying to optimise the whole navigation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below I have pasted the code to the full navigation, but I think the part that is blowing up is the loop over the pages/single entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nav entry in entry.descendants %}&#xA;{% set page = entry.singleEntry[0] ?? null %}&#xA;    &amp;lt;li class=&quot;mb-2&quot;&amp;gt;&#xA;        {% if page is not null %}&amp;lt;a href=&quot;{{ page.url() }}&quot; class=&quot;text-sm text-white hover:text-lime&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul class=&quot;ml-4 my-2 list-reset&quot;&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried to eager load this like so;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation = craft.entries({&#xA;    section: 'navigation',&#xA;    limit: null,&#xA;    with: [&#xA;      'children',&#xA;      'descendants',&#xA;      'singleEntry'&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whilst this is coming back as;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(index):2754 Profiling Summary Report&#xA;13:25:22.385 (index):2755 Time:   14.12897s&#xA;13:25:22.386 (index):2756 Memory: 58,940Kb&#xA;13:25:22.386 (index):2757 Total Queries: 178&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Load times are nearly mostly between 12-14 seconds. &#xA;This is a reduced page with just the navigation on it too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I optimise further for better results? &#xA;What are the issues in my code? It must be poorly written, but having re-written it twice I am no better to solving this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key &quot;navMega&quot; for 1 year %}&#xA;&amp;lt;div class=&quot;relative hidden lg:block w-full z-50&quot; data-controller=&quot;mega-menu&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;sitecontainer&quot;&amp;gt;&#xA;    &amp;lt;nav class=&quot;pb-4&quot;&amp;gt;&#xA;    {% for entry in navigation.level(1) %}&#xA;      {% if loop.first %}&#xA;        &amp;lt;ul class=&quot;list-reset flex justify-between&quot;&amp;gt;&#xA;        &amp;lt;li class=&quot;pr-6 // border-r border-white-25&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ siteUrl() }}&quot; class=&quot;hover:text-lime {% if craft.request.firstSegment == '' %}text-lime{% else %}text-white{% endif %}&quot; data-action=&quot;mouseover-&amp;gt;mega-menu#close&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;w-5 // h-5 // fill-current // mr-2&quot;&amp;gt;&#xA;              {% include '_includes/svg/icon-home.svg' %}&#xA;              &amp;lt;span class=&quot;alt&quot;&amp;gt;Home&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;        &amp;lt;li class=&quot;pl-4 pr-8 // {% if not loop.last %}border-r border-white-25{% endif %}&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;#&quot; class=&quot;text-white hover:text-lime flex items-center font-semibold&quot;&#xA;            data-action=&quot;click-&amp;gt;mega-menu#open&quot;&#xA;            data-next=&quot;{{ entry.title|kebab }}&quot;&amp;gt;&#xA;              {{ entry.title }}&#xA;            {%- if (entry.hasDescendants or entry.type == 'contact' or 'directories') -%}&#xA;            &amp;lt;div class=&quot;ml-1 w-3 h-3 fill-current /// mt-1 flex flex-col justify-center&quot;&amp;gt;&#xA;              {% include '_includes/svg/icon-chevron.svg' %}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {%- endif -%}&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;        {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;    {% endfor %}&#xA;&#xA;&#xA;{% for entry in navigation.level(1) %}&#xA;    {% switch entry.type %}&#xA;&#xA;      {% case 'contact' %}&#xA;      &amp;lt;div id=&quot;{{ entry.title|kebab }}&quot; class=&quot;mt-10 hidden absolute pin-x bg-petrol p-4 z-10&quot; data-target=&quot;mega-menu.menu&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;max-w-4xl flex flex-wrap pt-6 px-8 mx-auto&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;flex flex-col pr-12 mb-12 flex-1&quot;&amp;gt;&#xA;            &amp;lt;h3 class=&quot;mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6&quot;&amp;gt;&#xA;                {{ entry.title }}&#xA;            &amp;lt;/h3&amp;gt;&#xA;&#xA;          &amp;lt;div class=&quot;flex flex-wrap justify-between&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;w-1/2 pr-12 text-white leading-normal&quot;&amp;gt;&#xA;               &amp;lt;a href=&quot;mailto:{{ companyInformation.email }}&quot; class=&quot;text-lime hover:text-white text-lg mb-6 inline-block&quot;&amp;gt;{{ companyInformation.email }}&amp;lt;/a&amp;gt;&#xA;&#xA;              {% if entry.body|length %}&#xA;                &amp;lt;div class=&quot;article&quot;&amp;gt;&#xA;                {{ entry.body }}&#xA;                &amp;lt;/div&amp;gt;&#xA;              {% endif %}&#xA;&#xA;              &amp;lt;p class=&quot;text-xs&quot;&amp;gt;&#xA;                ‘{{ siteName }}’ is a trading division of Judd and Judd Ltd, a company registered in England and Wales, registered number 8082403. Registered office: Suite 2, Douglas House, 32-34 Simpson Road, Fenny Stratford, Buckinghamshire, MK1 1BA, United Kingdom.&#xA;              &amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;pl-12&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;text-white mb-6&quot;&amp;gt;&#xA;                {% include '_includes/social/follow' %}&#xA;              &amp;lt;/div&amp;gt;&#xA;&#xA;{#             {% if entry.relatedContent|length %}&#xA;              {% for entry in entry.relatedContent %}&#xA;              {% if loop.first %}&amp;lt;ul class=&quot;list-reset&quot;&amp;gt;{% endif %}&#xA;                  &amp;lt;li class=&quot;text-white mb-2&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;text-white hover:text-lime&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                  &amp;lt;/li&amp;gt;&#xA;              {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;              {% endfor %}&#xA;            {% endif %} #}&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      {% case &quot;directories&quot; %}&#xA;      &amp;lt;div id=&quot;{{ entry.title|kebab }}&quot; class=&quot;mt-10 hidden absolute pin-x bg-petrol p-4 z-10&quot; data-target=&quot;mega-menu.menu&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;flex flex-wrap pt-6 px-8 mx-auto&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;flex flex-col pr-12 mb-12 flex-1&quot;&amp;gt;&#xA;              &amp;lt;h3 class=&quot;mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6&quot;&amp;gt;&#xA;                  {{ entry.title }}&#xA;              &amp;lt;/h3&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;flex flex-wrap justify-between&quot;&amp;gt;&#xA;              &amp;lt;div class=&quot;pr-12 text-white leading-normal&quot;&amp;gt;&#xA;                {% if entry.body|length %}&#xA;                  {{ entry.body }}&#xA;                {% endif %}&#xA;&#xA;{#                 {% if entry.relatedContent|length %}&#xA;                  {% for entry in entry.relatedContent %}&#xA;                  {% if loop.first %}&amp;lt;ul class=&quot;list-reset&quot;&amp;gt;{% endif %}&#xA;                      &amp;lt;li class=&quot;text-white mb-2 {% if loop.last %}mt-6 pt-4 border-t border-petrol-light{% endif %}&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;text-white hover:text-lime text-sm&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                      &amp;lt;/li&amp;gt;&#xA;                  {% if loop.last %}&amp;lt;/ul&amp;gt;{% endif %}&#xA;                  {% endfor %}&#xA;                {% endif %} #}&#xA;              &amp;lt;/div&amp;gt;&#xA;&#xA;              &amp;lt;div class=&quot;pl-6 flex-1 flex flex-wrap&quot;&amp;gt;&#xA;                &amp;lt;h3 class=&quot;mb-2 text-lg text-white mb-6 w-full&quot;&amp;gt;Latest Updates&amp;lt;/h3&amp;gt;&#xA;                {% for entry in directories %}&#xA;                  {% set logo = entry.logo[0] ?? null %}&#xA;                  &amp;lt;article class=&quot;flex /// w-1/2 px-6 mb-6&quot;&amp;gt;&#xA;                  &amp;lt;div class=&quot;flex items-center justify-center w-32 bg-white p-2&quot;&amp;gt;&#xA;                    {% if logo|length %}&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                      &amp;lt;div class=&quot;text-center&quot;&amp;gt;&#xA;                        {% include '_includes/partials/logo' with { classes: 'p-2 bg-white w-full' } %}&#xA;                      &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/a&amp;gt;&#xA;                    {% else %}&#xA;                      {% include '_includes/directories/articleImage' %}&#xA;                    {% endif %}&#xA;                  &amp;lt;/div&amp;gt;&#xA;                  &amp;lt;div class=&quot;pl-4 /// flex-1 flex flex-col justify-center&quot;&amp;gt;&#xA;                    &amp;lt;h3 class=&quot;mb-2&quot;&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;text-lime hover:text-blue text-lg font-semibold&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;                    &amp;lt;p class=&quot;text-sm mb-0 text-petrol-light&quot;&amp;gt;{{ entry.section }}&amp;lt;/p&amp;gt;&#xA;                  &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/article&amp;gt;&#xA;                {% endfor %}&#xA;              &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;&#xA;      {% default %}&#xA;      &amp;lt;div id=&quot;{{ entry.title|kebab }}&quot; class=&quot;mt-10 hidden absolute pin-x bg-petrol p-4 z-10&quot; data-target=&quot;mega-menu.menu&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;flex flex-wrap pt-6 px-8 mx-auto&quot;&amp;gt;&#xA;          {% for entry in entry.children %}&#xA;            &amp;lt;div class=&quot;flex flex-col pr-12 mb-12 flex-1&quot;&amp;gt;&#xA;                &amp;lt;h3 class=&quot;mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6&quot;&amp;gt;&#xA;                    {{ entry.title }}&#xA;                &amp;lt;/h3&amp;gt;&#xA;                &amp;lt;ul class=&quot;ml-4 list-reset&quot;&amp;gt;&#xA;                {% nav entry in entry.descendants %}&#xA;                {% set page = entry.singleEntry[0] ?? null %}&#xA;                    &amp;lt;li class=&quot;mb-2&quot;&amp;gt;&#xA;                        {% if page is not null %}&amp;lt;a href=&quot;{{ page.url() }}&quot; class=&quot;text-sm text-white hover:text-lime&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;{% endif %}&#xA;                        {% ifchildren %}&#xA;                            &amp;lt;ul class=&quot;ml-4 my-2 list-reset&quot;&amp;gt;&#xA;                                {% children %}&#xA;                            &amp;lt;/ul&amp;gt;&#xA;                        {% endifchildren %}&#xA;                    &amp;lt;/li&amp;gt;&#xA;                {% endnav %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;           {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      {% endswitch %}&#xA;    {% endfor %}&#xA;    &amp;lt;/nav&amp;gt;&#xA;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-06-21T12:31:11.570" Title="Eager Loading Entries - Creating a Navigation from a structure" Tags="&lt;navigation&gt;&lt;performance&gt;&lt;eager-loading&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26629" PostTypeId="1" CreationDate="2018-06-21T12:51:14.630" Score="1" ViewCount="194" Body="&lt;p&gt;I am new on Craft CMS and it's the first CMS I am trying. Hey guys, I apologies is this question was asked before. I went through lot of articles and I didn't get anything helpful yet. I added  in home.html, made changes to var.scss and home.scss so that the background color of the  can be gray.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I open the project in the browser the  is not displaying but it's visible during inspection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this problem?&lt;/p&gt;&#xA;" OwnerUserId="8512" LastActivityDate="2018-06-21T14:32:44.570" Title="Changes made in home page not displaying" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26631" PostTypeId="1" AcceptedAnswerId="26632" CreationDate="2018-06-21T14:03:29.540" Score="2" ViewCount="20" Body="&lt;p&gt;Does the following mean that &lt;em&gt;both&lt;/em&gt; columns or the &lt;em&gt;combination&lt;/em&gt; of columns needs to be unique?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function defineIndexes()&#xA;{&#xA;    return [&#xA;        ['columns' =&amp;gt; ['productId', 'productTypeId'], 'unique' =&amp;gt; true],&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2018-06-21T14:03:29.540" Title="What do multiple columns of a record being set to unique mean?" Tags="&lt;records&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26632" PostTypeId="2" ParentId="26631" CreationDate="2018-06-21T14:03:29.540" Score="3" Body="&lt;p&gt;It means that no combination of those two columns can be the same in the table stated in the &lt;code&gt;getTableName()&lt;/code&gt; of your record.&lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2018-06-21T14:03:29.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26633" PostTypeId="1" AcceptedAnswerId="26637" CreationDate="2018-06-21T14:17:47.847" Score="1" ViewCount="132" Body="&lt;p&gt;Is there a way to specify in Craft 3 which hashing algorithm should passwords use?&#xA;I know craft 3 uses PHP's &lt;code&gt;password_hash()&lt;/code&gt; function, my question is: is there a way of modifying the 2nd and 3rd parameter of that function via a craft config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find a way of doing this without using a separate/custom column in the users table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8435" LastEditorUserId="57" LastEditDate="2018-06-21T18:49:17.933" LastActivityDate="2018-06-21T18:56:44.953" Title="Change Craft 3 password algorithm" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26634" PostTypeId="2" ParentId="26629" CreationDate="2018-06-21T14:32:44.570" Score="1" Body="&lt;p&gt;Have you read &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14397/craft-loading-scss-references-rather-than-css&quot;&gt;this&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SCSS needs to be compiled and the page is loaded with the compiled CSS files, the SCSS references are used only for easier debugging and development. Seeing a change during inspection, does not necessarily mean that the CSS file changed, maybe there was a compilation error or something.&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2018-06-21T14:32:44.570" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26635" PostTypeId="2" ParentId="26627" CreationDate="2018-06-21T14:50:55.107" Score="1" Body="&lt;p&gt;Try reading &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;return $this-&amp;gt;render('index', ['twitterFeed' =&amp;gt; $twitterFeed]);&lt;/code&gt; is correct in craft 3 you just need to do some custom routing in order to reroute the homepage to your controller/action.&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2018-06-21T14:50:55.107" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26636" PostTypeId="1" CreationDate="2018-06-21T14:58:04.640" Score="1" ViewCount="71" Body="&lt;p&gt;Here's the whole picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to make an API endpoint which should output everything from an entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function transform(Entry $entry)&#xA;    {&#xA;&#xA;        return $entry-&amp;gt;getAttributes();&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That outputs every field on the entry. But, in the fields containing related items like &lt;code&gt;categories&lt;/code&gt; or &lt;code&gt;header_images&lt;/code&gt;, In the response I got,looks like the query without being executed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    ...&#xA;    &quot;from&quot;: null,&#xA;    &quot;groupBy&quot;: null,&#xA;    &quot;join&quot;: [&#xA;        [&#xA;            &quot;INNER JOIN&quot;,&#xA;            &quot;{{%relations}} relations&quot;, [&#xA;                &quot;and&quot;,&#xA;                &quot;[[relations.targetId]] = [[elements.id]]&quot;,&#xA;                {&#xA;                    &quot;relations.sourceId&quot;: &quot;35&quot;,&#xA;                    &quot;relations.fieldId&quot;: &quot;15&quot;&#xA;                },&#xA;                [&#xA;                    &quot;or&quot;,&#xA;                    {&#xA;                        &quot;relations.sourceSiteId&quot;: null&#xA;                    },&#xA;                    {&#xA;                        &quot;relations.sourceSiteId&quot;: &quot;4&quot;&#xA;                    }&#xA;                ]&#xA;            ]&#xA;        ]&#xA;    ]&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found out that doing &lt;code&gt;-&amp;gt;all()&lt;/code&gt;, I get the correct response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function transform(Entry $entry)&#xA;    {&#xA;        $attributes = $entry-&amp;gt;getAttributes();&#xA;&#xA;        $attributes['categories'] = $entry-&amp;gt;categories-&amp;gt;all();&#xA;&#xA;        $attributes['header_image'] = $entry-&amp;gt;header_image-&amp;gt;all();&#xA;&#xA;        foreach ($attributes['header_image'] as $key =&amp;gt; $image) {&#xA;            $attributes['header_image'][$key] = $image-&amp;gt;toArray();&#xA;            $attributes['header_image'][$key]['folder'] = $image-&amp;gt;getVolume();&#xA;        }&#xA;&#xA;        return $attributes;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But of course that limits me cause I have to know the field handle (header_image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;First: is there a smart/better way to get the related?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea I got to solve this is: Loop through all the fields, and if the type is &lt;code&gt;Asset&lt;/code&gt; or &lt;code&gt;Category&lt;/code&gt;, do the &lt;code&gt;-&amp;gt;all()&lt;/code&gt;. But I cannot get the type of the field. I'm trying stuff like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        $fields = $entry-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&#xA;        foreach ($fields as $field) {&#xA;            $field-&amp;gt;getContentColumnType(); //Or something&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But well, doesn't really work.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-06-21T14:58:04.640" Title="Check the field type of all the attributes of an entry" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;plugin-elementapi&gt;&lt;entries-field&gt;&lt;query&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26637" PostTypeId="2" ParentId="26633" CreationDate="2018-06-21T18:56:44.953" Score="0" Body="&lt;p&gt;The 3rd parameter for the hash cost you can control via the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-blowfishhashcost&quot; rel=&quot;nofollow noreferrer&quot;&gt;blowfishHashCost&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2nd parameter (for the algorithm) is a bit more difficult because it's not exposed via a config setting. I assume you want to use PASSWORD_ARGON2I since that and PASSWORD_BCRYPT &#xA; (the default) are the only two options: &lt;a href=&quot;https://secure.php.net/manual/en/function.password-hash.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://secure.php.net/manual/en/function.password-hash.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to create a custom &lt;a href=&quot;https://docs.craftcms.com/v3/configuration.html#application-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;Application Config&lt;/a&gt; component that overrode Craft's &lt;code&gt;security&lt;/code&gt; component with your own Security class.  Your own class could extend Craft's an overwrite just the &lt;code&gt;hashPassword&lt;/code&gt; method, or any others that you might need to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-21T18:56:44.953" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26638" PostTypeId="2" ParentId="26561" CreationDate="2018-06-21T19:02:06.493" Score="2" Body="&lt;p&gt;Not without hacking up some core files, unfortunately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the logic Craft 2 uses to determine which set password template to render for a given request here: &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/controllers/UsersController.php#L1702-L1720&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop-v2/src/controllers/UsersController.php#L1702-L1720&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, if a user has &quot;accessCp&quot; permissions (which admins certainly do), then they're going to get the Control Panel set password template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-21T19:02:06.493" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26639" PostTypeId="1" AcceptedAnswerId="26641" CreationDate="2018-06-21T19:57:57.453" Score="1" ViewCount="44" Body="&lt;p&gt;I'm designing a donation form right now for what will be a Craft Commerce site, and I want to collect the donator's billing name, address, etc in the product form which adds the donation to the cart. Will &lt;code&gt;commerce/cart/updateCart&lt;/code&gt; accept &lt;code&gt;billingAddress&lt;/code&gt; parameters when posted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I would simply test this, but I've not even started the build phase yet, and don't want to include the address fields on the donation form in my design if it won't be possible.)&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-06-22T00:20:44.797" Title="Can I add a billing address while updating the cart?" Tags="&lt;plugin-craftcommerce&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26641" PostTypeId="2" ParentId="26639" CreationDate="2018-06-22T00:20:44.797" Score="2" Body="&lt;p&gt;Yes, you can submit all updates to the cart in the one controller action &lt;code&gt;commerce/cart/update-cart&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-06-22T00:20:44.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26642" PostTypeId="1" AcceptedAnswerId="26643" CreationDate="2018-06-22T08:48:05.867" Score="5" ViewCount="797" Body="&lt;p&gt;Installing a Craft 3 plugin via Composer is pretty simple. You require the package, update Composer, and install it via the CMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My circumstances require that our company use a private Module on all projects. But installing the package via Composer always puts the Module into the default &lt;code&gt;vendor&lt;/code&gt; directory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I install a module into the modules folder?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-06-22T09:08:48.410" Title="How can I install modules with Composer?" Tags="&lt;craft3&gt;&lt;composer&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26643" PostTypeId="2" ParentId="26642" CreationDate="2018-06-22T08:48:05.867" Score="6" Body="&lt;p&gt;Craft Plugins require that a &lt;code&gt;&quot;type&quot;:&quot;craft-plugin&quot;&lt;/code&gt; property is defined in each &lt;code&gt;composer.json&lt;/code&gt; file. Composer refers to this to help manage and install the plugin. Craft Modules do not currently have this support. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see all package types that Composer Installer supports &lt;a href=&quot;https://github.com/composer/installers#current-supported-package-types&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. There is still a way to achieve what you're trying to do though...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/oomphinc/composer-installers-extender&quot; rel=&quot;noreferrer&quot;&gt;Composer Installers Extender&lt;/a&gt; allows you to create your own custom package type. So we could create &lt;code&gt;craft-module&lt;/code&gt; ourselves. Just make sure your module has this &lt;code&gt;&quot;type&quot;:&quot;craft-module&quot;&lt;/code&gt; in it's &lt;code&gt;composer.json&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can define some &lt;code&gt;extra&lt;/code&gt; settings that tell Composer to put the modules into the modules directory. Incorporate the following into your projects &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;  &quot;oomphinc/composer-installers-extender&quot;: &quot;^1.1&quot;,&#xA;  &quot;vendorname/modulename&quot;: &quot;dev-master&quot;&#xA;},&#xA;&quot;autoload&quot;: {&#xA;  &quot;psr-4&quot;: {&#xA;    &quot;modules\\&quot;: &quot;modules/&quot;,&#xA;    &quot;modules\\modulename\\&quot;: &quot;modules/modulename/module/&quot;&#xA;  }&#xA;},&#xA;&quot;extra&quot;: {&#xA;  &quot;installer-types&quot;: [&quot;craft-module&quot;],&#xA;  &quot;installer-paths&quot;: {&#xA;    &quot;modules/{$name}&quot;: [&quot;type:craft-module&quot;]&#xA;  }&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Make sure your module no longer exists in your vendor directory as you may be hit with some potential conflict warnings.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2018-06-22T09:08:48.410" LastActivityDate="2018-06-22T09:08:48.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26644" PostTypeId="1" CreationDate="2018-06-22T12:02:26.820" Score="1" ViewCount="51" Body="&lt;p&gt;I am building my first Craft blog, and can't figure out how to get the CSS styling to apply to pagination beyond the main blog index page. When I click through subsequent blog pages, the URL adds 'p2', 'p3', etc. as expected, and all of the HTML content and links are there and work fine. But no styling beyond the first page. Any ideas? Here is my pagination code in my main blog index.html:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Pagination and home page link #}&#xA;&amp;lt;div class=&quot;blog-nav&quot;&amp;gt;&#xA;    {% if pageInfo.prevUrl %}&#xA;        &amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot; class=&quot;blog-nav-link&quot;&amp;gt;Prev&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% if pageInfo.nextUrl %}&#xA;        &amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot; class=&quot;blog-nav-link&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;a href=&quot;../index.html&quot; class=&quot;blog-nav-link&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8303" LastActivityDate="2018-06-23T15:58:16.637" Title="Styling Subsequent Pages in Craft Pagination" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26645" PostTypeId="1" AcceptedAnswerId="26647" CreationDate="2018-06-22T15:19:00.993" Score="1" ViewCount="225" Body="&lt;p&gt;Can I get all the fields of a section? For example, I have channel events, I want the fields in that section, but not related to any specific event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know all the fields (not the values), before actually executing the query.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastEditorUserId="57" LastEditDate="2018-06-22T20:58:27.273" LastActivityDate="2018-06-22T20:58:27.273" Title="Get the fields (fieldLayout) of the section. Not the entry" Tags="&lt;entries&gt;&lt;elementcriteriamodel&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26646" PostTypeId="1" AcceptedAnswerId="26648" CreationDate="2018-06-22T15:21:35.490" Score="2" ViewCount="186" Body="&lt;p&gt;I am able to successfully create new entries with PHP when I am using basic field values that are Rich Text or Plain Text fields, but am unsure how to add Tags to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my entry already has a field called 'tags' on it, and I thought that maybe it wanted an array of strings like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setFieldValues([&#xA;   'tags' =&amp;gt; array('someCoolTag', 'tagasaurus rex')&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I admit I do not really understand how tags work behind the scenes, and would like to correct that. Any help is great.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-06-22T15:34:10.033" Title="Add Tags to a Newly Created Entry With PHP in Craft 3" Tags="&lt;craft3&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26647" PostTypeId="2" ParentId="26645" CreationDate="2018-06-22T15:23:36.783" Score="1" Body="&lt;p&gt;You can't get the fields from a section since sections have no field layout. Sections have several entry types and those are responsible for the fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entryType-&amp;gt;getFieldLayout()-&amp;gt;getFields();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can get all types in a section with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$section-&amp;gt;getEntryTypes();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-22T15:23:36.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26648" PostTypeId="2" ParentId="26646" CreationDate="2018-06-22T15:34:10.033" Score="2" Body="&lt;p&gt;Tags are normal Elements like &lt;code&gt;Entries&lt;/code&gt;, &lt;code&gt;Categories&lt;/code&gt;, &lt;code&gt;Users&lt;/code&gt; and so on.. In order to relate a &lt;code&gt;Tag&lt;/code&gt; to another element, you need to insert the array of those elements like you are used to with every other field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existingTag = Tag::find()-&amp;gt;title('whatever')-&amp;gt;one();&#xA;&#xA;$tag = new Tag();&#xA;$tag-&amp;gt;groupId = 1; //&amp;lt;-- insert your group id here&#xA;$tag-&amp;gt;title = &quot;something&quot;;&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($tag);&#xA;&#xA;$entry-&amp;gt;setFieldValues([&#xA;   'tags' =&amp;gt; [$tag-&amp;gt;id, $existingTag-&amp;gt;id]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-22T15:34:10.033" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26649" PostTypeId="1" AcceptedAnswerId="26652" CreationDate="2018-06-22T16:06:19.273" Score="5" ViewCount="2678" Body="&lt;p&gt;I am getting this depreciation messages.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the example below, &lt;strong&gt;the depreciation message refers to the 2nd &lt;code&gt;loop&lt;/code&gt; &lt;code&gt;for flag in country&lt;/code&gt;&lt;/strong&gt;.  The message appears anytime I have a loop within a loop.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I template this to avoid the deprecation message?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('posts').all() %}&#xA;&#xA;{% for first in entries[0:1] %}&#xA;&#xA;{% set country = first.countryName %}&#xA;&#xA;{% for flag in country %} &#xA;&amp;lt;span class=&quot;flag-icon flag-icon-{{ flag.countryCode }}&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;span&amp;gt;{{ first.title }}&amp;lt;/span&amp;gt;&#xA;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-22T19:08:57.153" Title="How do I clear deprecation errors for looping through element queries?" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26650" PostTypeId="1" CreationDate="2018-06-22T18:18:35.383" Score="1" ViewCount="48" Body="&lt;p&gt;I have 2 plugins I created that store similar data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin 1: &lt;code&gt;id, name, panel_id, price&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin 2: &lt;code&gt;id, name, test_id, price&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to attach my plugin data to an entry, and I need to make sure they can only select one Panel or Test. I want to know if there is a way to add them as a source for Entries as a new field. Or can I create a similar custom fieldtype to be used for both plugins and have that kind of validation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft V2.6&lt;/p&gt;&#xA;" OwnerUserId="8517" LastEditorUserId="8517" LastEditDate="2018-06-22T19:30:31.063" LastActivityDate="2018-06-22T19:30:31.063" Title="Custom Pluging Entries FieldType" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26651" PostTypeId="2" ParentId="26650" CreationDate="2018-06-22T19:06:56.907" Score="1" Body="&lt;p&gt;You can use a &lt;a href=&quot;https://docs.craftcms.com/v3/element-types.html#relations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relation Field&lt;/a&gt; for each of your element types and include a custom js rule so if one of them has a value, the other one can't be selected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more difficult way would be to extend the field and the &lt;code&gt;ElementSelectModal&lt;/code&gt; and the &lt;code&gt;ElementIndex&lt;/code&gt; to select multiple element types but this is going to be a little bit more tricky since you'll need a custom controller to fetch all elements and can't rely on the &lt;code&gt;ElementsController&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-22T19:06:56.907" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26652" PostTypeId="2" ParentId="26649" CreationDate="2018-06-22T19:08:57.153" Score="5" Body="&lt;p&gt;What about using the &lt;code&gt;all()&lt;/code&gt; function as well? Your field doesn't contain an array, it contains the same type of object like &lt;code&gt;craft.entries&lt;/code&gt; provides.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for flag in country.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't appear because you have a loop in a loop it appears because you treat and object as an array&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-22T19:08:57.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26653" PostTypeId="1" AcceptedAnswerId="26654" CreationDate="2018-06-22T19:50:49.233" Score="2" ViewCount="268" Body="&lt;p&gt;I have a guest entry form that's working fine. I'm using Craft-supplied code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;  {% if errors %}&#xA;    {% for error in errors %}&#xA;      {{ error }}{% if not loop.last %}, {% endif %} &#xA;    {% endfor %}&#xA;  {% endif %}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it works fine - field by field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;  &amp;lt;p class=&quot;help alert&quot;&amp;gt;{{ errorList(entry.getErrors('title')) }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to check if there are any errors (and error in any field) so I can display a notification at the top of the page: &quot;There were some problems with your submission&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if errorList(entry.getErrors())|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2018-06-22T20:02:20.827" Title="Check for errors (any) on guest entry form (Craft 3)" Tags="&lt;error&gt;&lt;guest-entries&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26654" PostTypeId="2" ParentId="26653" CreationDate="2018-06-22T19:57:12.527" Score="2" Body="&lt;p&gt;You can use this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.hasErrors() %}&#xA;    Render a message here&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-06-22T20:02:20.827" LastActivityDate="2018-06-22T20:02:20.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26656" PostTypeId="1" AcceptedAnswerId="26657" CreationDate="2018-06-22T21:59:02.927" Score="2" ViewCount="34" Body="&lt;p&gt;I am creating a mad libs type of global. My global set is actually called &lt;code&gt;madLibs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within that set, is a matrix field - that can have unlimited blocks. Each block only has two fields. &lt;code&gt;actualRole&lt;/code&gt; and &lt;code&gt;pretendRole&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have is working - but sometimes I might get the &lt;code&gt;actualRole&lt;/code&gt; from one matrix, and the &lt;code&gt;pretendRole&lt;/code&gt; from another. Ideally, I'd like to get the same fields from the same random matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all of the matrix blocks for the global set #}&#xA;{% set globalSet = craft.globals.getSetByHandle('madLibs') %}&#xA;&#xA;{% if globalSet|length %}&#xA;&#xA;    {# Find out how many matrix blocks exist #}&#xA;    {% set madLibsCount = globalSet.madLib|length %} // 2&#xA;&#xA;    {# Generate a random array key. Remember array is zero based #}&#xA;    {% set range = range(0, (madLibsCount - 1)) %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ globalSet.madLib[random(range)].actualRole }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ globalSet.madLib[random(range)].pretendRole }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sometimes, this is happening:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ globalSet.madLib[0].actualRole }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;{{ globalSet.madLib[1].pretendRole }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would really like to have this each time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ globalSet.madLib[0].actualRole }}&amp;lt;/h1&amp;gt;&#xA;&amp;lt;p&amp;gt;{{ globalSet.madLib[0].pretendRole }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-06-22T22:11:36.060" Title="How can I get the same random array key?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26657" PostTypeId="2" ParentId="26656" CreationDate="2018-06-22T22:11:36.060" Score="2" Body="&lt;p&gt;You need to create a common reference to the random number you are creating. Otherwise, you are getting a random number twice - and it's just luck that they show up as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all of the matrix blocks for the global set #}&#xA;{% set globalSet = craft.globals.getSetByHandle('madLibs') %}&#xA;&#xA;{% if globalSet|length %}&#xA;&#xA;    {# Find out how many matrix blocks exist #}&#xA;    {% set madLibsCount = globalSet.madLib|length %} // 2&#xA;&#xA;    {# Generate a random array key. Remember array is zero based #}&#xA;    {% set range = range(0, (madLibsCount - 1)) %}&#xA;&#xA;    {# Capture a single (random) number #}&#xA;    {% set key = random(range) %}&#xA;&#xA;    &amp;lt;h1&amp;gt;{{ globalSet.madLib[key].actualRole }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ globalSet.madLib[key].pretendRole }}&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-06-22T22:11:36.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26658" PostTypeId="2" ParentId="26583" CreationDate="2018-06-23T08:22:09.980" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% set people = craft.users.group('family').ids() %}&#xA;{% set relatedPlaces = craft.entries.section('locations').relatedTo({&#xA;    targetElement: person,&#xA;    field: 'relatedPeople'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Grab all the ids from your users, then find all locations related to those. This way you don't need multiple loops and get each location once and not multiple times &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-23T08:22:09.980" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26659" PostTypeId="1" CreationDate="2018-06-23T10:06:32.640" Score="1" ViewCount="210" Body="&lt;p&gt;Had a quick search online and I can't find a way to disable entry versioning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? There's some plugins that do this but I'm hoping there's some config I can set somewhere?&lt;/p&gt;&#xA;" OwnerUserId="5470" LastActivityDate="2018-06-23T11:29:06.017" Title="Disable entry versioning" Tags="&lt;config&gt;&lt;configuration&gt;&lt;entry-versions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26660" PostTypeId="2" ParentId="26659" CreationDate="2018-06-23T11:29:06.017" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aFQG1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aFQG1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;No need for a plugin, just don't check this option&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-06-23T11:29:06.017" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26661" PostTypeId="2" ParentId="23679" CreationDate="2018-06-23T14:47:06.120" Score="1" Body="&lt;p&gt;Use either the FeedMe or FeedMePro plugin for Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-23T14:47:06.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26662" PostTypeId="2" ParentId="22186" CreationDate="2018-06-23T15:55:53.163" Score="2" Body="&lt;p&gt;I had a similar issue...my Craft3 blog pagination was losing the link to my &lt;em&gt;main.css&lt;/em&gt; file after the first page, so all content would show but styling disappeared after the main blog index page. As suggested above, I now have my css.main in &lt;code&gt;/web/css/main.css&lt;/code&gt;, and all of the pagination and styling works perfectly.&lt;/p&gt;&#xA;" OwnerUserId="8303" LastEditorUserId="8303" LastEditDate="2018-06-23T16:06:09.620" LastActivityDate="2018-06-23T16:06:09.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26663" PostTypeId="2" ParentId="26644" CreationDate="2018-06-23T15:58:16.637" Score="1" Body="&lt;p&gt;For those who might stumble upon this with a similar issue, the answer ended up being quite simple...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made sure that my css.main was located in a public directory, in my case /web/css/main.css, and all of the pagination and styling works perfectly.&lt;/p&gt;&#xA;" OwnerUserId="8303" LastActivityDate="2018-06-23T15:58:16.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26664" PostTypeId="1" AcceptedAnswerId="26665" CreationDate="2018-06-24T08:19:59.413" Score="3" ViewCount="407" Body="&lt;p&gt;I have around 200 hundred users for an intranet setup on the Craft Users section all as pending status. Is there a way to send an activation email en-mass to all pending users? Rather than having to run through each user one at a time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is set to change over and each user will need to verify their account and set their password, but they've been added to the system in advance and need to be sent an activation email out of hours so that they Intranet system changes overnight and they have an email waiting for them the next day they step into the office.&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2020-01-16T14:19:01.833" Title="Sending activation emails to all pending users" Tags="&lt;users&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26665" PostTypeId="2" ParentId="26664" CreationDate="2018-06-24T08:33:36.607" Score="5" Body="&lt;pre&gt;&lt;code&gt;foreach(\craft\elements\User::find()-&amp;gt;status('pending')-&amp;gt;all() as $user){ &#xA;    Craft::$app-&amp;gt;getUsers()-&amp;gt;sendActivationEmail($user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fetch all pending users and send them the mail &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-24T08:33:36.607" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26666" PostTypeId="1" AcceptedAnswerId="26700" CreationDate="2018-06-24T13:34:28.260" Score="2" ViewCount="261" Body="&lt;p&gt;I have a Craft 2 project which is using an older version of the FeedMe plugin 1.x. In order to use a specific XML feed this site uses, a custom XML feed service was implemented with a custom feed type available to select from the feed type option in Craft FeedMe back-end, but this involved directly editing the FeedMe plugin files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is because a specific authentication mechanism is required before being able to interact with the feed in the form of a unique token passed by the Authorization HTTP header obtained from a separate auth endpoint first. This is then added to the feed request via curl, so its authenticated and returns data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current implementation added an additional service within &lt;code&gt;feedme/services/&lt;/code&gt; which extends &lt;code&gt;FeedMe_FeedXMLService&lt;/code&gt; to handle the token authorisation part and added an additional enum type, record type, model type. In theory could a separate plugin be created that provides the service without having to modify the core plugin? Or could the approach be different given the changes with the 2.x version of the plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks v2.x has changed quite a bit looking at the core plugin files with potentially more options for customisation, but I'm not sure if the implementation we have is possible to move to 2.x easily.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-06-26T13:23:34.690" LastActivityDate="2018-06-27T06:57:17.017" Title="Using FeedMe 2.x with a custom authentication mechanism" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26667" PostTypeId="1" CreationDate="2018-06-24T14:13:25.823" Score="1" ViewCount="29" Body="&lt;p&gt;Is it possible to create a custom data source that does not include end user options? I have tried not including the getOptionsHtml(), returning null, returning an empty string, and just return and the all fail.&lt;/p&gt;&#xA;" OwnerUserId="7823" LastActivityDate="2018-07-09T14:28:37.517" Title="Custom data source without options - Sprout Forms" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26668" PostTypeId="1" AcceptedAnswerId="26759" CreationDate="2018-06-24T20:08:28.033" Score="1" ViewCount="172" Body="&lt;p&gt;I have some 'Flip PDF' generated folders that I need only logged in users to be able to access. If I put them in templates I get the problem that the .jpg images &lt;code&gt;500&lt;/code&gt;. Is there a way of allowing .jpg images to be served from within the templates folder? This isn't as simple as using an 'internal assets' plugin and adding them manually as all of the flip pdf JS is created automatically and I don't want to have to edit it every time a new one needs to be uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've searched high and low for the answer to this over the last few weeks as well as asking on slack but I've had no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: maybe there's a .htaccess file I can add in the template sub directory that will prevent images being loaded in the normal 'craft' way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The folder structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA;templates&#xA;    emag&#xA;        july-2018&#xA;            files&#xA;                mobile&#xA;                    *.jpg&#xA;                mobile-ext&#xA;                    *.jpg&#xA;                thumb&#xA;                    *.jpg&#xA;                    etc.&#xA;            mag&#xA;                javascript&#xA;                    *.js (loads fine)&#xA;                index.html &amp;lt;--- the 'magazine' that needs the jpg's&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The contents inside 'july-2018' is what the software gives me. All works fine, except for the .jpg images.&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="4242" LastEditDate="2018-06-24T20:45:48.883" LastActivityDate="2018-07-02T16:11:59.797" Title="Flip PDF embed inside templates" Tags="&lt;templating&gt;&lt;image&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26669" PostTypeId="2" ParentId="15251" CreationDate="2018-06-25T04:30:24.870" Score="10" Body="&lt;p&gt;Filtering a list of entries is quite simple. Here's an example from one of our sites:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for job in craft.entries({&#xA;    section: 'jobs',&#xA;    applicationsClose: &quot;&amp;gt;= &quot; ~ (now|date('Y-m-d')),&#xA;    internalExternal: 'external',&#xA;}) %}&#xA;&#xA;    ...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we define the section we're looking in and then filter by two custom fields: &lt;code&gt;applicationsClose&lt;/code&gt; and &lt;code&gt;internalExternal&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2018-06-25T04:30:24.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26672" PostTypeId="2" ParentId="26583" CreationDate="2018-06-25T10:43:29.393" Score="2" Body="&lt;p&gt;With help from Robin (getting the ids), &lt;a href=&quot;https://straightupcraft.com/articles/introduction-to-relations-and-reverse-relations-in-craft-cms-with-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; from Straight Up Craft, and a bit of trial and error, I ended up solving my issue with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set people = craft.users.group('family').ids() %}&#xA;{% set relatedPlaces = craft.entries.section('locations').relatedTo({&#xA;    targetElement: people,&#xA;    field: 'relatedPeople'&#xA;}) %}&#xA;&#xA;{% set markers = '' %}&#xA;{% set markerInfo = '' %}   &#xA;&#xA;{%- for place in relatedPlaces.all() -%}&#xA;    {% set relatedPeople = craft.users.group('family').relatedTo(place) %}&#xA;    {%- set markers -%}&#xA;        {% if not loop.first %}{{ markers }}{% endif %} ['{{ place.location.address }}', {{ place.location.lat }},{{ place.location.lng }}],&#xA;    {%- endset -%}&#xA;    {%- set markerInfo -%}&#xA;        {% if not loop.first %}{{ markerInfo }}{% endif %} ['&amp;lt;div class=&quot;info_content&quot;&amp;gt;' + '&amp;lt;h5&amp;gt;{{ place.title|e('js') }}&amp;lt;/h5&amp;gt;' + '{%- for person in relatedPeople -%}{{ person.firstName }} {{ person.lastName }}&amp;lt;br&amp;gt;{%- endfor -%}' + '&amp;lt;/div&amp;gt;'],&#xA;    {%- endset -%}&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="567" LastActivityDate="2018-06-25T10:43:29.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26674" PostTypeId="2" ParentId="22719" CreationDate="2018-06-25T15:36:03.657" Score="1" Body="&lt;p&gt;I had this same issue. We needed to send a contact information form to MailChimp only if the person opted in to receive e-mails. However, the information would always be sent even if the opt-in box was left unchecked. No idea why. I ended up hiding the opt-in box and then added a &quot;yes or no&quot; field that conveyed whether or not the user wanted to receive e-mails. Hope that help and makes sense! &lt;/p&gt;&#xA;" OwnerUserId="8228" LastActivityDate="2018-06-25T15:36:03.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26676" PostTypeId="1" AcceptedAnswerId="26677" CreationDate="2018-06-25T16:39:55.347" Score="0" ViewCount="124" Body="&lt;p&gt;I want to export my entries to CSV or JSON.  Craft 2 had a plugin.  I can't find one for Craft 3.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I reached out to the Craft community on Slack.  They suggested I try the Craft 3 plugin Beam.&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told it should be trivia. But, the &lt;a href=&quot;https://superbig.co/plugins/beam&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation on Beam&lt;/a&gt; is light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the example provided in the Beam documentation to export to CSV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% spaceless %}&#xA;{% set options = {&#xA;header: ['Email', 'Name'],&#xA;rows: [&#xA;      [ 'test@example.com', 'John Doe' ],&#xA;      [ 'another+test@example.com', 'Jane Doe' ],&#xA;      [ 'third+test@example.com', 'Trond Johansen' ], &#xA;]&#xA;} %}&#xA;{{ craft.beam.csv(options) }}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want the &lt;code&gt;header&lt;/code&gt; to be the field names used in an entry and the &lt;code&gt;rows&lt;/code&gt; to be values for each entry in my &lt;code&gt;posts&lt;/code&gt; section.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't use a loop in the option settings.  &lt;strong&gt;So, how do I set the options to loop through the entries fields and values?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-06-25T16:55:56.937" Title="How can I loop through my entries to export them using Beam?" Tags="&lt;templating&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26677" PostTypeId="2" ParentId="26676" CreationDate="2018-06-25T16:55:56.937" Score="4" Body="&lt;p&gt;This is what I ended up doing... obviously remove anything that is specific to your project. But this essentially will export all fields and entries from a passed in &lt;code&gt;sectionHandle&lt;/code&gt; as a URL Param.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# @var craft \craft\web\twig\variables\CraftVariable #}&#xA;{# @var section \craft\models\Section #}&#xA;{% requireLogin %}&#xA;{% spaceless %}&#xA;&#xA;    {# Set the section from the optional sectionHandle param, defaulting to 'answers' #}&#xA;    {% set section = 'answers' %}&#xA;    {% set sectionHandle = craft.app.request.getParam('sectionHandle') %}&#xA;    {% if sectionHandle | length %}&#xA;        {% set section = sectionHandle %}&#xA;    {% endif %}&#xA;&#xA;    {# Get all of the fields from the layout for the CSV header #}&#xA;    {% set csvHeader = [] %}&#xA;    {% set fields = craft.sections.sectionByHandle(section).getEntryTypes()[0].getFieldLayout().getFields() %}&#xA;    {% for field in fields %}&#xA;        {% set csvHeader = csvHeader | merge([field.name]) %}&#xA;    {% endfor %}&#xA;&#xA;    {# Get all of the entry content for the CSV data #}&#xA;    {% set csvData = [] %}&#xA;    {% set entries = craft.entries.section(section).all() %}&#xA;    {% for entry in entries %}&#xA;        {% set csvRow = [] %}&#xA;        {% for field in fields %}&#xA;            {% set csvRow = csvRow | merge([entry[field.handle]]) %}&#xA;        {% endfor %}&#xA;        {% set csvData = csvData | merge([csvRow]) %}&#xA;    {% endfor %}&#xA;&#xA;    {# Output the data as a CSV file #}&#xA;    {% set options = {&#xA;        header: csvHeader,&#xA;        rows: csvData&#xA;    } %}&#xA;    {{ craft.beam.csv(options) }}&#xA;{% endspaceless %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...enjoy. This is what was used (with a few additions) in the project: &lt;a href=&quot;https://nystudio107.com/blog/post-mortem-linkedin-talent-intelligence-experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;Post-Mortem: LinkedIn Talent Intelligence Experience&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-06-25T16:55:56.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26679" PostTypeId="1" CreationDate="2018-06-25T19:44:08.517" Score="1" ViewCount="312" Body="&lt;p&gt;So I'm having this entry (a product) that contains a selectbox field with two values:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reserved&lt;/li&gt;&#xA;&lt;li&gt;Available&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By default this field is set to 'Available', but when the user lands on a certain page (a thank you page after &quot;ordering&quot; this product with the entry id as a querystring in the URL), I'd like to change the value of that selectbox to 'Reserved'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone can put me in the right direction on this one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2018-07-26T08:00:57.930" Title="How do I change the value of a select box field of a certain entry through the front-end?" Tags="&lt;frontend&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26680" PostTypeId="1" AcceptedAnswerId="26697" CreationDate="2018-06-25T21:33:20.690" Score="1" ViewCount="165" Body="&lt;p&gt;Curious if anyone has ever run into this before or may know what's going on here. I'm using the execWidget plugin (&lt;a href=&quot;https://github.com/marionnewlevant/craft-exec_widget&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marionnewlevant/craft-exec_widget&lt;/a&gt;) to run a script from Craft's dashboard that does a composer install when the lock file has changed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the configuration for the plugin: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;return [&#xA;  '*' =&amp;gt; [&#xA;  ],&#xA;  'local' =&amp;gt; [&#xA;    'commands' =&amp;gt; [&#xA;      'composer install' =&amp;gt; '../scripts/ed-day_composer.sh',&#xA;      'pull assets from production' =&amp;gt; '../scripts/pull_assets.sh',&#xA;    ]&#xA;  ],&#xA;  'staging' =&amp;gt; [&#xA;    'commands' =&amp;gt; [&#xA;      'composer install' =&amp;gt; '../scripts/ed-day_composer.sh',&#xA;      'push everything production' =&amp;gt; '../scripts/push_all.sh',&#xA;    ]&#xA;  ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the composer install script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/bash&#xA;&#xA;# Get the directory of the currently executing script&#xA;DIR=&quot;$(dirname &quot;${BASH_SOURCE[0]}&quot;)&quot;&#xA;&#xA;# Include files&#xA;INCLUDE_FILES=(&#xA;            &quot;common/defaults.sh&quot;&#xA;            &quot;.env.sh&quot;&#xA;            &quot;common/common_env.sh&quot;&#xA;            &quot;common/common_db.sh&quot;&#xA;            )&#xA;for INCLUDE_FILE in &quot;${INCLUDE_FILES[@]}&quot;&#xA;do&#xA;    if [ -f &quot;${DIR}/${INCLUDE_FILE}&quot; ]&#xA;    then&#xA;        source &quot;${DIR}/${INCLUDE_FILE}&quot;&#xA;    else&#xA;        echo &quot;File ${DIR}/${INCLUDE_FILE} is missing, aborting.&quot;&#xA;        exit 1&#xA;    fi&#xA;done&#xA;&#xA;(cd &quot;${LOCAL_ROOT_PATH}/craft&quot;; HOME=${LOCAL_HOME} composer install)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a returned 127 error from the queue.log and the scrip does not actually work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-06-25 14:10:12 [50.200.203.190][1][-][info][craft\queue\QueueLogBehavior::beforeExec]  [45] ExecWidget Task (attempt: 1) - Started&#xA;2018-06-25 14:10:12 [50.200.203.190][1][-][info][marionnewlevant\execwidget\jobs\ExecWidgetTask::log] executing ../scripts/ed-day_composer.sh&#xA;2018-06-25 14:10:12 [50.200.203.190][1][-][info][marionnewlevant\execwidget\jobs\ExecWidgetTask::log] returned 127&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on testing I've done, I'm almost certain the issue is with composer because I get a success error message when I remove just the composer part of the line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Composer works when SSHing in. Any idea what might be causing the issue?&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2018-06-25T22:03:23.980" LastActivityDate="2018-06-26T16:12:06.910" Title="Composer Issue When Doing exec From a Plugin" Tags="&lt;plugins&gt;&lt;php&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26681" PostTypeId="1" AcceptedAnswerId="26709" CreationDate="2018-06-25T21:46:50.887" Score="1" ViewCount="47" Body="&lt;p&gt;Redactor fields are failing to display for my client and I'm stumped as to what might be happening. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They work fine for me and I haven't heard reports from any of the other 10+ CMS users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems OS/browser specific, because the person that reached out is on a brand new computer running the latest version of Windows 10 and Chrome. When I asked them to test in Firefox everything worked fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more technical details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The site is running Craft 2.6.3017&lt;/li&gt;&#xA;&lt;li&gt;Chrome 67.0.3396.87&lt;/li&gt;&#xA;&lt;li&gt;Windows NT 10.0; Win64; x64&lt;/li&gt;&#xA;&lt;li&gt;AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It sounds like it could be related to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26476/redactor-rich-text-field-issue-occurs-in-craft-2-6-3017&quot;&gt;this question&lt;/a&gt;, but it's not quite the same. Has anyone else heard reports of this? &lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2018-06-27T20:45:47.597" Title="Redactor field doesn't display" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26682" PostTypeId="1" CreationDate="2018-06-25T21:57:59.450" Score="1" ViewCount="362" Body="&lt;p&gt;Trying to get all entries related to a particular blog category to output to the page. Right now I just get the correct URL for any category and a blank page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also my categories are entered into a matrix field as one of the matrix blocks. I use a single matrix field to capture all of the content for each blog entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &lt;code&gt;categories/_category.html&lt;/code&gt; template code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Fetch all of the entries related to this category #}&#xA;{% set category = craft.categories.slug('') %}&#xA;{% set entries = craft.entries.relatedTo(category) %}&#xA;&#xA;{# Output them #}&#xA;{% for entry in entries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried plugging in particular category slugs into the &lt;code&gt;craft.categories.slug('')&lt;/code&gt; but no help. I'm following advice from &lt;a href=&quot;https://craftcms.com/support/entries-related-to-category&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/entries-related-to-category&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15842/category-entries&quot;&gt;Category Entries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what is missing?&lt;/p&gt;&#xA;" OwnerUserId="8303" LastEditorUserId="142" LastEditDate="2019-02-08T17:46:23.093" LastActivityDate="2019-02-08T17:46:23.093" Title="Can't Output Entries from Particular Blog Categories" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26683" PostTypeId="2" ParentId="26682" CreationDate="2018-06-25T22:09:17.507" Score="1" Body="&lt;p&gt;First you'll need to know what you are currently doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.slug()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will return a CategoryQuery with no property attached to it. So when you execute this query you'll fetch all categories. Your so called &lt;code&gt;category&lt;/code&gt; variable is no category but a query that needs to be executed in order to do something&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.relatedTo(category)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same thing again: it will return an EntryQuery with all entries that related to any category in any field. So as long as an entry has a relation to what every category it will match. Then again &lt;code&gt;entries&lt;/code&gt; is not an array of entries but a query that needs to be executed via &lt;code&gt;all()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you loop through this query it is executed as well but with a deprecated warning because this way is not supported anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are in a category page you'll likely have the &lt;code&gt;catetory&lt;/code&gt; variable already injected as superglobal in your template. So there is already a category you have access to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.relatedTo(category).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please make sure there are entries that are related to your current category &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-25T22:09:17.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26686" PostTypeId="1" AcceptedAnswerId="26689" CreationDate="2018-06-25T22:55:11.370" Score="2" ViewCount="197" Body="&lt;p&gt;I am trying to write a Commerce 2 adjuster that will apply a discount on all items from a specific type if a customer bought a specific item with another product type in the last year as well as a minimum price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's my first attempt and I'm already stuck trying to retrieve the order history from a specific user.  I can't find anything in the Commerce 2 docs. That's what I have so far. Please be gentle :-)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace craft\commerce\adjusters;&#xA;&#xA;use Craft;&#xA;use craft\commerce\base\AdjusterInterface;&#xA;use craft\commerce\elements\Order;&#xA;use craft\commerce\models\OrderAdjustment;&#xA;&#xA;class FriendDiscount implements AdjusterInterface&#xA;{&#xA;&#xA;    // get the current user and check if the discount condition is true&#xA;    public function checkIfDonated()&#xA;    {&#xA;        $user = Craft::$app-&amp;gt;getUser();&#xA;        if ($user) {&#xA;            // check if user bought line item with product type 'typeA' in the last 365 days and spent at least 100$ on it, then return true&#xA;            return true;&#xA;        }&#xA;        return [];&#xA;    }&#xA;&#xA;    public function adjust(Order $order): array&#xA;    {&#xA;&#xA;        $friendAdjuster = new OrderAdjustment();&#xA;&#xA;        // apply discount if checkIfDonated() returned true&#xA;        if ($this-&amp;gt;checkIfDonated() == true) {&#xA;            // apply discount only on items with the product type 'typeB'&#xA;            $friendAdjuster-&amp;gt;type = &quot;Discount&quot;;&#xA;            $friendAdjuster-&amp;gt;name = &quot;-14$ Off&quot;;&#xA;            $friendAdjuster-&amp;gt;description = &quot;-14$&quot;;&#xA;            $friendAdjuster-&amp;gt;amount = -14;&#xA;            $friendAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;            return [$friendAdjuster];&#xA;        }&#xA;        return [];&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2018-06-25T23:50:47.123" LastActivityDate="2018-06-28T15:48:11.940" Title="Getting previous order history in a Commerce 2 adjuster" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugins&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26688" PostTypeId="2" ParentId="26597" CreationDate="2018-06-25T23:48:22.470" Score="1" Body="&lt;p&gt;This is currently expected behavior due to this bit of code, which explicitly passes in the primary site ID when generating those link URLs for a user:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/services/Users.php#L1079-L1081&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/services/Users.php#L1079-L1081&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reasoning is that even on a multi-site setup, users are all &quot;global&quot; (i.e. not defined per site).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you feel this is a bug or produces undesired behavior, feel free to &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;create an issue&lt;/a&gt; where it can be further discussed.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-06-25T23:48:22.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26689" PostTypeId="2" ParentId="26686" CreationDate="2018-06-26T01:22:32.133" Score="2" Body="&lt;p&gt;The method to check the previous orders would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function checkIfDonated($order)&#xA;{&#xA;&#xA;    $email = $order-&amp;gt;getEmail();&#xA;&#xA;    if (!$email) {&#xA;        return false;&#xA;    }&#xA;&#xA;    $orders = Plugin::getInstance()-&amp;gt;getOrders()-&amp;gt;getOrdersByEmail($email);&#xA;&#xA;    $didDonate = false;&#xA;    foreach ($orders as $previousOrder) {&#xA;        foreach ($previousOrder-&amp;gt;getLineItems() as $lineItem) {&#xA;            $purchable = $lineItem-&amp;gt;getPurchasable();&#xA;            if ($purchable &amp;amp;&amp;amp; $purchable instanceof \craft\commerce\elements\Variant &amp;amp;&amp;amp; $purchasable-&amp;gt;getProduct()-&amp;gt;getType()-&amp;gt;handle == 'typeA') {&#xA;                $didDonate = true;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    return $didDonate;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That above assumes you want to look at all orders made by anyone with that email address. You could add additional guards after the email check to see if they are logged in as a user etc. Hope that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, don't forget to pass the order to the method: &lt;code&gt;if ($this-&amp;gt;checkIfDonated($order) == true)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to add the Plugin import: &lt;code&gt;use craft\commerce\Plugin;&lt;/code&gt; to the top of the adjuster class.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-06-28T15:48:11.940" LastActivityDate="2018-06-28T15:48:11.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26690" PostTypeId="2" ParentId="26679" CreationDate="2018-06-26T07:03:23.013" Score="1" Body="&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&lt;p&gt;You can check for certain URL parameters via&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set param = craft.app.getRequest().getParam('id') %}&#xA;{% if param is not null %}&#xA;    {% set entry = craft.app.getElements().getElementById(param) %}&#xA;    {# insert your new field value! not the label, the value/handle&#xA;    {% do entry.setFieldValue('fieldHandle', 'Reserved') %}&#xA;    {% do craft.app.getElements().saveElement(entry) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However I would not recommend doing this in Twig&lt;/p&gt;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&lt;p&gt;You can see how to use &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/variables.html#app&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Variables&lt;/a&gt; and create your boilerplate at &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.myAwesomePlugin.saveEntry(entry, {fieldHandle: 'yourValue'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And your function could be&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;public function saveEntry($entry, $attributes = []){&#xA;    $entry-&amp;gt;getContent()-&amp;gt;setAttributes($attributes);&#xA;    craft()-&amp;gt;entries-&amp;gt;saveEntry($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That's just a &amp;quot;quick&amp;quot; version, I suggest you to take a look at &lt;code&gt;EntriesController&lt;/code&gt; to see how Craft handles it in detail&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-06-26T07:41:37.250" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26692" PostTypeId="1" AcceptedAnswerId="26743" CreationDate="2018-06-26T10:18:20.453" Score="2" ViewCount="6458" Body="&lt;p&gt;For the last 3 days i've been trying to install Craft CMS 3 on my server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using 1&amp;amp;1 internet, have FTP uploaded all the files, changed the permissions for the folders and files to the right level and made sure everything is pointing in the right place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's worth noting i've installed Craft CMS 2 on this exact server for years with no issues at all. I also successfully installed Craft CMS 3 locally with no issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going to mydomainname.com shows a craft error page with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HTTP 503 – Service Unavailable - craft\web\ServiceUnavailableHttpException&#xA;&#xA;throw new ServiceUnavailableHttpException();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rVNyN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rVNyN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going to /admin/install or index.php?p=admin doesn't work it just gives me an Apache Error screen with 500 Internal Server Error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cMq82.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cMq82.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried using ssh and attempted to install composer but have been unsuccessful at that as my server doesn't seem to want to allow me to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get a website live asap and don't really know what I can do next! I'm not hugely experienced with servers etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3556" LastEditorUserId="3556" LastEditDate="2018-06-26T10:53:03.713" LastActivityDate="2019-07-31T21:27:21.277" Title="Craft 3: 500 Internal Server Error when trying to install on server" Tags="&lt;craft3&gt;&lt;server&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26693" PostTypeId="1" CreationDate="2018-06-26T10:43:17.333" Score="1" ViewCount="38" Body="&lt;p&gt;My client has an English blog but wants a few of the posts to be available in German too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I set things up so that the German version of the blog shows the German version of a post where available, but otherwise defaults to the English version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If “Propagate entries across all enabled sites?” is turned off, the German blog is effectively empty and they don't want to copy/paste all the old posts over from English to German if it can be avoided)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URLS are using a /en or /de prefix.&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-06-26T10:43:17.333" Title="Multilingual blog, but only for some entries in a section, otherwise default to English" Tags="&lt;craft3&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26696" PostTypeId="1" CreationDate="2018-06-26T15:45:53.687" Score="1" ViewCount="43" Body="&lt;p&gt;I am using the Many to Many plugin and wondering if the below is possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel called Model ID. Model ID is then related to two other sections, Memory and SSD. I want to be able to link entries from Memory to entries in SSD via the Many To Many Field within Model ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a picture, edited, to show the field layout and the information I have within the Model ID entry. The information within the entry is what I need to pull in to my Memory and SSD section but can not figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I am missing something very simple that might not be in the read me document for the plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks John &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4HgYt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4HgYt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8351" LastActivityDate="2018-09-21T14:21:35.720" Title="Many To Many Plugin Template Help" Tags="&lt;plugins&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26697" PostTypeId="2" ParentId="26680" CreationDate="2018-06-26T16:12:06.910" Score="1" Body="&lt;p&gt;The problem seems to be tied to Composer not having the correct permissions. Will work with our IT team to update so Composer can write appropriately when initiated from Craft. &lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2018-06-26T16:12:06.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26699" PostTypeId="2" ParentId="20495" CreationDate="2018-06-26T19:43:40.247" Score="1" Body="&lt;p&gt;Late to the table but... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been working on a Craft 2 site for a client that need to be able to combine a large amount of modules on each page (A matrix with 25+ blocks and counting). I found myself adding lots of complicated fields and then manually copying the information to staging and live... Tedious and dumb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After trying several json-field import/export plugins with undesirable results (and one complete crash) I finally found &lt;strong&gt;&lt;a href=&quot;https://github.com/Firstborn/Craft-CMS-Migration-Manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-CMS-Migration-Manager&lt;/a&gt;&lt;/strong&gt;. It simply uses Crafts (Or Yii's) &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/migrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;builtin migration scripts&lt;/a&gt; to keep your database up to sync. Works like a charm!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugins seems to be &lt;a href=&quot;https://github.com/Firstborn/Craft-Migration-Manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;available for Craft 3&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin will generate migration files for you that you can review and commit to your repository. You then deploy to staging and/or live sites where you will be able to run them through the plugin or through the command line if you prefer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the migrations fails it will automatically rollback to the previous db.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like the most solid way to keep your databases in sync, and you will have all relevant changes to the db committed to your repository.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy migrating!&lt;/p&gt;&#xA;" OwnerUserId="8442" LastActivityDate="2018-06-26T19:43:40.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26700" PostTypeId="2" ParentId="26666" CreationDate="2018-06-26T19:44:12.840" Score="1" Body="&lt;p&gt;So, here's what I've found after after some research. It is certainly possible to create your own datatypes. Support for it, looks to have been added since around 2.0.1. Previously, the feed type field wasn't able to have custom types as it was a fixed list, but with hooks it is now possible. There is a great plugin that shows how to add custom data types here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/surprisehighway/craft-feedmehelper&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/surprisehighway/craft-feedmehelper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do need a Pro license to use custom data types however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the documentation for data types is currently TBA on Verbb's website: &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/developers/data-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/developers/data-types&lt;/a&gt;, so this is going off looking through the code of both the helper plugin and FeedMe itself. Hopefully that will be added at some point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to add your own data/feed type is to call the &lt;code&gt;registerFeedMeDataTypes()&lt;/code&gt; function in a plugin, register the datatype:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerFeedMeDataTypes()&#xA;{&#xA;    return array(&#xA;        new MyCustomFeedMeDataType(),&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;You'd import the &lt;code&gt;MyCustomFeedMeDataType&lt;/code&gt; class, with &lt;code&gt;Craft::import&lt;/code&gt; in the plugin &lt;code&gt;init()&lt;/code&gt; function&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your datatype class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MyCustomFeedMeDataType extends BaseFeedMeDataType&#xA;{&#xA;   // Custom data type stuff here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The datatype should then appear in the feed type dropdown within the FeedMe feeds section in Craft for selection. By default it will use part of the class name for the field label/value, you can also set a specific name, according to this pull request:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/verbb/feed-me/pull/172&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/feed-me/pull/172&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quick and reasonably simple in the end, but certainly provides better custom integration options for my project now!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps other Craft CMS folk!&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-06-27T06:57:17.017" LastActivityDate="2018-06-27T06:57:17.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26702" PostTypeId="2" ParentId="26682" CreationDate="2018-06-27T01:04:25.113" Score="1" Body="&lt;p&gt;So I finally solved this, and wanted to post the answer here for anyone that stumbles on this similar issue. All of the content for each of my blog entries is input through a single matrix field. I also included a block in that field to hold all of the entry categories, and most of my entries have multiple categories. I could not get those entries to output to the front end, no matter what I tried, until I took the categories out and made them a separate field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I now have a matrix field for my blog entry main body content, images, and videos...and a separate field for categories. Once I did that, I was able output all blog entries related to any category, and switch among the different categories to get a new summary of entries based on the category picked. There may be some way to get the previous method to work, but I sure could not solve it. In any case - all is working as planned.&lt;/p&gt;&#xA;" OwnerUserId="8303" LastActivityDate="2018-06-27T01:04:25.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26703" PostTypeId="1" CreationDate="2018-06-27T02:29:21.770" Score="1" ViewCount="54" Body="&lt;p&gt;I have a site which has multiple menus e.g. primary and utility. I've built the menus via sections and the entry type for those sections has a title and a entry field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This site requires me to show a secondary nav which shows the top level page and it's children as well as highlighting the current page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written this below which works but seem overly complicated for what I'm trying to achieve, being new to Craft I was hoping someone could check this is ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site structure is similar to this:&#xA;- home&#xA;- page 1&#xA;-- child page 1&#xA;-- child page 2&#xA;- page 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now say I was on page 1, I need to display the following:&#xA;Page 1 - Child Page 1 - Child Page 2&#xA;The same applies if I was on Child Page 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have currently:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set showNav = false %}&#xA;{% set entryInNavigation = craft.entries.section(['primaryNavigation', 'utilityNavigation']).relatedTo(entry).one() %}&#xA;{% if entryInNavigation %}&#xA;    {% set hasDescendants = entryInNavigation.getDescendants().with('relatedEntry').all() %}&#xA;    {% if hasDescendants|length %}&#xA;        {% set showNav = true %}&#xA;    {% else %}&#xA;        {% set getParentsChildren = entryInNavigation.parent().children.with('relatedEntry').all() %}&#xA;        {% if getParentsChildren|length %}&#xA;            {% set showNav = true %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% else %}&#xA;    {% set showNav = false %}&#xA;{% endif %}&#xA;&#xA;{% if showNav %}&#xA;    &amp;lt;ul class=&quot;secondary-nav&quot;&amp;gt;&#xA;    {% if hasDescendants|length %}&#xA;        {% for entryInNav in hasDescendants %}&#xA;            &amp;lt;li class=&quot;secondary-nav__item&quot;&amp;gt;&amp;lt;a class=&quot;secondary-nav__link {% if entryInNav.relatedEntry[0].id == entry.id %}secondary-nav__link--active{% endif %}&quot; href=&quot;{{ entryInNav.relatedEntry[0].url }}&quot;&amp;gt;{{ entryInNav.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    {% else %}&#xA;        {% if getParentsChildren|length %}&#xA;            {% for entryInNav in getParentsChildren %}&#xA;                &amp;lt;li class=&quot;secondary-nav__item&quot;&amp;gt;&amp;lt;a class=&quot;secondary-nav__link {% if entryInNav.relatedEntry[0].id == entry.id %}secondary-nav__link--active{% endif %}&quot; href=&quot;{{ entryInNav.relatedEntry[0].url }}&quot;&amp;gt;{{ entryInNav.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8171" LastActivityDate="2018-06-27T02:29:21.770" Title="Is this an ok approach to building a secondary navigation?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;navigation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26704" PostTypeId="2" ParentId="26668" CreationDate="2018-06-27T09:33:08.500" Score="2" Body="&lt;p&gt;You'll need to create custom route to access those files. This is just an example of a custom route in my current module, so you need to find a pattern that matches the one you receive from the tool&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;rules[] = [&#xA;    'pattern' =&amp;gt; '/userfiles/&amp;lt;fileType:\w+&amp;gt;/&amp;lt;fileName:\S+&amp;gt;',&#xA;    'route'   =&amp;gt; 'thaff/profile/get-file'&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your Controller action could be something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionGetFile($view, $fileName)&#xA;{&#xA;    // create an alias to your folderpath $view should be thumb/mobile-ext or mobile depending on the route&#xA;    $localPath = Craft::getAlias('@yourFolderAlias') . DIRECTORY_SEPARATOR . $view;&#xA;&#xA;    // you can include several checks if the image should be visible for the current user or not...&#xA;&#xA;    $resp = Craft::$app-&amp;gt;getResponse();&#xA;    $resp-&amp;gt;headers-&amp;gt;set('Content-Type' /*, insert your mime-type here */);&#xA;    $resp-&amp;gt;format = Response::FORMAT_RAW;&#xA;    // check if the file exists&#xA;    if ($localPath &amp;amp;&amp;amp; file_exists($localPath . $fileName)) {&#xA;        // open the file&#xA;        $handle = fopen($localPath . $fileName, 'rb');&#xA;        // send the result to your response object&#xA;        $resp-&amp;gt;stream = $handle;&#xA;        // send the response and close the file&#xA;        $resp-&amp;gt;send();&#xA;        @fclose($handle);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: this is just a little code snipped of my current project and I removed many conditional checks so it's easier to read. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-27T09:33:08.500" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26705" PostTypeId="1" CreationDate="2018-06-27T13:20:02.200" Score="1" ViewCount="27" Body="&lt;p&gt;I just finished the structure of a new site, now I am faced with the problem: &quot;regions&quot;. I thought I can use categories for routing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I need:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;example.com/REGION/LANGUAGE/about-us&#xA;  &lt;br&gt;or&lt;br&gt;&#xA;  example.com/fr/en/about-us in reality -&gt; frensh region, english language&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First problem: Localize all content and get the language parameter in the URL - CHECK, this is done (i got &lt;code&gt;example.com/en/about-us&lt;/code&gt; - quite easy)&lt;/li&gt;&#xA;&lt;li&gt;Second problem is, how to get the category (top level) into the routing (not done, I am struggling with this)&lt;/li&gt;&#xA;&lt;li&gt;Third problem - and maybe biggest problem - how could I switch the both parameters, because any URL-part is placed AFTER the language parameter. So I would get &lt;br/&gt;&#xA;&lt;code&gt;example.com/LANGUAGE/REGION/about-us&lt;/code&gt;&lt;br/&gt;&#xA;if I complete the second problem and not &lt;br/&gt;&#xA;&lt;code&gt;example.com/REGION/LANGUAGE/about-us&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;&#xA;This has to be possible with craft or a workaround, but I do not get it. Maybe someone has a solution or a hint for this in other CMS I solved this structure, but in Craft....well....not yet&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8529" LastEditorUserId="5557" LastEditDate="2018-06-27T13:27:50.563" LastActivityDate="2018-06-27T13:27:50.563" Title="Route manipulating - set regioncode before language-code" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;routing&gt;&lt;multi-site&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26706" PostTypeId="1" CreationDate="2018-06-27T14:21:34.907" Score="1" ViewCount="139" Body="&lt;p&gt;I'm reading through the Craft docs in relation to the AssetFileModel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the &lt;code&gt;getPath()&lt;/code&gt; method, this reads in theory that it should return the full path to the asset relative to the root, with any sub directories etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v2/models/AssetFileModel.html#getPath-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v2/models/AssetFileModel.html#getPath-detail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet this doesn't to appear to be the case, I seem to be getting &lt;code&gt;/filename.ext&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If however I was to use &lt;code&gt;folderPath()&lt;/code&gt; this then provides the subfolder name configured in the relevant S3 asset source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/master-v2/src/models/AssetFileModel.php#L384&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/master-v2/src/models/AssetFileModel.php#L384&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct? Is &lt;code&gt;getPath()&lt;/code&gt; meant to behave this way with S3 asset sources?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-06-27T14:53:42.770" LastActivityDate="2018-10-29T03:01:02.450" Title="getPath() does not return subfolder for S3 asset source" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26708" PostTypeId="1" AcceptedAnswerId="26733" CreationDate="2018-06-27T17:49:23.743" Score="2" ViewCount="385" Body="&lt;p&gt;I've installed Imager in a Craft 3 site and everything looks fine except my PNGs are fuzzy. I've set &lt;code&gt;'pngCompressionLevel' =&amp;gt; 0,&lt;/code&gt; because I'm using Optipng and &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#pngcompressionlevel-int&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt; say to do this. The PNGs have transparency. Here's a screenshot of the two (left is the normal asset, right is the asset after sent through Imager).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HGDUA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HGDUA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template code mostly looks like this (a lot of it is originally refactored in a reusable macro):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set logos = entry.partners.all() -%}&#xA;{% for logo in logos -%}&#xA;   {%- set sizes = craft.imager.transformImage(logo, [{ width: 150 }], {&#xA;      format: 'png',&#xA;      mode: 'crop',&#xA;      allowUpscale: false,&#xA;      interlace: true,&#xA;      pngCompressionLevel: 0&#xA;   }) -%}&#xA;&#xA;   &amp;lt;img src=&quot;{{ sizes[0].url }}&quot; &#xA;        sizes=&quot;100vw&quot; &#xA;        srcset=&quot;{{ craft.imager.srcset(sizes) }}&quot; &#xA;        width=&quot;150&quot;&amp;gt;&#xA;{%- endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The HTML it produces is below. I'm only using one resize width for these logos since they are small, but my macro is setup to accommodate other images with larger srcsets.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;/imager/partners/acme-2018_12345.png&quot;&#xA;     sizes=&quot;100vw&quot;&#xA;     srcset=&quot;/imager/partners/acme-2018_12345.png 150w&quot;&#xA;     width=&quot;150&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried taking out the different config settings like &lt;code&gt;mode&lt;/code&gt;, &lt;code&gt;allowUpscale&lt;/code&gt;, and &lt;code&gt;interlace&lt;/code&gt; but they have no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-06-29T08:27:23.013" Title="How to make PNGs crisp using Imager + Optipng and Craft 3?" Tags="&lt;craft3&gt;&lt;image-transforms&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26709" PostTypeId="2" ParentId="26681" CreationDate="2018-06-27T20:45:47.597" Score="1" Body="&lt;p&gt;Turns out the issue was caused by a js error being thrown by an ad blocking plugin the user had installed on his browser. &lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2018-06-27T20:45:47.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26710" PostTypeId="1" AcceptedAnswerId="26747" CreationDate="2018-06-27T21:11:52.277" Score="1" ViewCount="132" Body="&lt;p&gt;I'm having an issue with the login-page and since this is my first Craft website, I'm a little unsure of where to begin to look. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When attempting to log in to the admin interface, my username/password is rejected only with the message &quot;An unknown error occured&quot;. The same goes for trying the &quot;Forgot your password?&quot; function.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, the only change recently made was running the auto-update to the latest version (2.X) last week. Have not logged back in since, so this could very well be the culprit. The front end loads just fine. I do have a couple of plugins installed, but not sure how I can deactivate them without using the admin interface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some log files in the /craft folder where I can start to look? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated. &lt;/p&gt;&#xA;" OwnerUserId="8533" LastActivityDate="2018-06-29T20:24:23.963" Title="Locked out of the admin interface" Tags="&lt;admin&gt;&lt;error&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26711" PostTypeId="1" AcceptedAnswerId="26715" CreationDate="2018-06-27T23:26:53.453" Score="0" ViewCount="303" Body="&lt;p&gt;I want to order my search results by the post date (not the created on date).  And, this did not work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entries|length %}&#xA;    {% for post in entries.groupBy('postDate') %}&#xA;        {% include 'partials/card-standard-4' %}&#xA;    {% endfor %}                            &#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Your search for “{{ query }}” didn’t return any results.&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2018-07-01T00:23:23.223" LastActivityDate="2018-07-01T00:23:23.223" Title="How can I order search results by the post date?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26714" PostTypeId="2" ParentId="26668" CreationDate="2018-06-28T04:08:48.410" Score="2" Body="&lt;p&gt;Please note that the way you have this structured, all of your static resources such as images, JavaScripts, CSS, etc. are going to be run through PHP and Craft before being served up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is going to be quite inefficient; static resources such as images, JavaScript, CSS, etc. (anything that &lt;em&gt;doesn't&lt;/em&gt; have Twig code inside of it) shouldn't be served up from the &lt;code&gt;templates/&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather, they should be in your web root. I would reconsider the way you have your static resources located in &lt;code&gt;templates/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-06-28T04:08:48.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26715" PostTypeId="2" ParentId="26711" CreationDate="2018-06-28T05:18:12.463" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.orderBy('foo').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is an &lt;code&gt;orderBy&lt;/code&gt; property you can use on the query &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-28T05:18:12.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26716" PostTypeId="1" AcceptedAnswerId="26717" CreationDate="2018-06-28T07:59:27.043" Score="1" ViewCount="125" Body="&lt;p&gt;the plugin I'm currently working on has to store user inputs which might contain 4 byte unicode characters like emojis. MySQL is not able to handle this with a utf-8 charset. It works if the charset of my tables is set to &lt;code&gt;utf8mb4&lt;/code&gt; and if I add &lt;code&gt;'charset' =&amp;gt; 'utf8mb4'&lt;/code&gt; to &lt;code&gt;config/db.php&lt;/code&gt;. Since the file &lt;code&gt;config/db.php&lt;/code&gt; does not belong to my plugin, but to the installation of Craft itself, I'd like to not modify it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, I can convert the inputs with &lt;code&gt;StringHelper::encodeMb4()&lt;/code&gt; but then I would have to do that at every place where something from the outside enters my tables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any pragmatic way of handling this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Greetings Jus&lt;/p&gt;&#xA;" OwnerUserId="8534" LastActivityDate="2018-06-28T08:19:37.940" Title="Use utf8mb4 for database operations" Tags="&lt;plugin-development&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26717" PostTypeId="2" ParentId="26716" CreationDate="2018-06-28T08:19:37.940" Score="1" Body="&lt;p&gt;Crafts &lt;code&gt;ActiveRecord&lt;/code&gt; has a function &lt;code&gt;beforeSave&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function beforeSave($insert)&#xA;{&#xA;    foreach ($this-&amp;gt;fields() as $attribute) {&#xA;        $this-&amp;gt;$attribute = Db::prepareValueForDb($this-&amp;gt;$attribute);&#xA;    }&#xA;&#xA;    // Prepare the values&#xA;    $now = Db::prepareDateForDb(new \DateTime());&#xA;&#xA;    if ($this-&amp;gt;getIsNewRecord()) {&#xA;        if ($this-&amp;gt;hasAttribute('dateCreated')) {&#xA;            $this-&amp;gt;dateCreated = $now;&#xA;        }&#xA;&#xA;        if ($this-&amp;gt;hasAttribute('uid')) {&#xA;            $this-&amp;gt;uid = StringHelper::UUID();&#xA;        }&#xA;    }&#xA;&#xA;    if ($this-&amp;gt;hasAttribute('dateUpdated')) {&#xA;        $this-&amp;gt;dateUpdated = $now;&#xA;    }&#xA;&#xA;    return parent::beforeSave($insert);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can overwrite this method and include your &lt;code&gt;StringHelper::encodeMb4()&lt;/code&gt; into it so every time &lt;code&gt;$record-&amp;gt;save()&lt;/code&gt; is executed your string will be converted &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-28T08:19:37.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26718" PostTypeId="1" AcceptedAnswerId="26719" CreationDate="2018-06-28T12:30:12.807" Score="2" ViewCount="31" Body="&lt;p&gt;To be more specific, I would like to know if an entry is a Single or part of a Structure or Channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.type&lt;/code&gt; seems to return the name of the single or section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to retrieve this information for every entry?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2018-06-28T12:42:38.943" Title="Is there a way to retrieve the type of an entry?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26719" PostTypeId="2" ParentId="26718" CreationDate="2018-06-28T12:42:38.943" Score="3" Body="&lt;p&gt;The structure type is stored in the section, not in the entry type. &lt;code&gt;entry.type&lt;/code&gt; doesn't return the name, it returns the entry type as an object&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set structureType = entry.getSection().type %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will return a string that can have the following values. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const TYPE_SINGLE = 'single';&#xA;const TYPE_CHANNEL = 'channel';&#xA;const TYPE_STRUCTURE = 'structure';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-28T12:42:38.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26721" PostTypeId="1" AcceptedAnswerId="26724" CreationDate="2018-06-28T13:28:14.050" Score="1" ViewCount="146" Body="&lt;p&gt;I was wondering if it was possible to use an alias inside a field in the Admin panel. For example, I have a global section called &quot;Navigation&quot; which contains a matrix called &quot;Links&quot;. This matrix allows the client to create links for their navigation bar. Inside each matrix block, is a field called &quot;Link Url&quot; where the client can put in a link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now the client is hardcoding urls for the production site, so my links don't work on my dev environment. I would like to rectify this, with some type of elegant solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7292" LastEditorUserId="6007" LastEditDate="2019-01-15T12:06:12.657" LastActivityDate="2019-01-15T12:06:12.657" Title="Using Aliases inside Admin Panel for fields" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26722" PostTypeId="1" AcceptedAnswerId="26723" CreationDate="2018-06-28T15:54:17.063" Score="2" ViewCount="1030" Body="&lt;p&gt;re: macros I'm trying to use one for an SVG sprite. But I'm not sure what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;macros template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro icon(iconId) %}&#xA;    &amp;lt;svg class=&quot;icon icon-{{ iconId }}&quot; role=&quot;img&quot; title=&quot;{{ iconId }}&quot;&amp;gt;&#xA;        &amp;lt;use xlink:href=&quot;{{ url('/assets/images/icons.svg#' ~ iconId) }}&quot;&amp;gt;&amp;lt;/use&amp;gt;&#xA;    &amp;lt;/svg&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my layout template I have this &lt;code&gt;{% import '_macros' as macros %}&lt;/code&gt; and in an another template this &lt;code&gt;{{ macros.icon(&quot;SIGNAL&quot;) }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the site i get a twig runtime error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Accessing Twig_Template attributes is forbidden.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and it highlights the line where I extend the layout template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure why this isn't working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without a macro this code works fine. but I want the macro so I don't have to type it out all the time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;svg class=&quot;icon&quot; height=&quot;0&quot; width=&quot;0&quot;&amp;gt;&#xA; &amp;lt;use xlink:href=&quot;/assets/images/icons.svg#SIGNAL&quot; /&amp;gt;&#xA;&amp;lt;/svg&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2018-07-01T00:31:24.967" LastActivityDate="2018-07-01T00:31:24.967" Title="Craft 3 and Macros" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26723" PostTypeId="2" ParentId="26722" CreationDate="2018-06-28T16:14:36.033" Score="3" Body="&lt;p&gt;This is a change in how macros work in Twig 2.0, not a Craft CMS issue (though Craft 3 did signal a move to Twig 2.x).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As of Twig 2.0, macros imported in a file are not available in child&#xA;  templates anymore (via an include call for instance). You need to&#xA;  import macros explicitly in each file where you are using them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/1.x/deprecated.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/1.x/deprecated.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is also documented in the Craft CMS 3 docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#twig-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#twig-2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...so just import the macro again in the child template.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-06-28T16:14:36.033" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26724" PostTypeId="2" ParentId="26721" CreationDate="2018-06-28T17:18:24.253" Score="1" Body="&lt;p&gt;A good approach would be to use the &lt;code&gt;UrlHelper&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-urlhelper.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;class&lt;/a&gt; it has a function &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-urlhelper.html#method-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;UrlHelper::url()&lt;/a&gt; that is available in Twig and will return the correct URL for a certain path. So you could ask your client to not insert the entire URL, only the path -&amp;gt; instead of &lt;code&gt;example.com/entries&lt;/code&gt; -&amp;gt; &lt;code&gt;entries&lt;/code&gt; or you can include a custom Twig function/behavior that strips the domain before you use the &lt;code&gt;{{ url('entries') }}&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;Anyway: to be honest I would create a different approach in the first place. Creating static URLs in a text field is usually not a good thing. I'm always a fan of the&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;protect clients against themselves&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;philosophy so you may want to consider to create a custom field type with autosuggestion or something. SEO wise it could be a bad idea if you clients are able to insert whatever they want and you output too many dead links. Maybe a Relation field could be something for you?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-06-28T17:18:24.253" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26725" PostTypeId="2" ParentId="12474" CreationDate="2018-06-28T19:12:31.753" Score="4" Body="&lt;p&gt;This is the syntax for Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-06-28T19:12:31.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26726" PostTypeId="2" ParentId="6580" CreationDate="2018-06-28T19:12:46.283" Score="10" Body="&lt;p&gt;This is the syntax for Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-06-28T19:12:46.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26728" PostTypeId="1" CreationDate="2018-06-28T20:16:37.343" Score="1" ViewCount="109" Body="&lt;p&gt;I am trying to create a carousel where each slide will have a title, subtitle, and maybe a summary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can create a carousel like this with a set number of slides. &#xA;I would like to create one where if an image is added the subsequent fields(title, subtitle, and summary) would be made available for that slide. This way I could have as many slides as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this may be accomplishable with Neo since it allows me to go three layers deep into a matrix. Sadly due to the project constraints, we cannot use any Matrix plugins like Neo or Supertables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to accomplish this without the use of a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now we are using Craft 2. If this is not possible in Craft 2 I would be interested to know if it would be possible in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is this possible with the limitations set forth&lt;/li&gt;&#xA;&lt;li&gt;How would this be accomplished&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7838" LastEditorUserId="57" LastEditDate="2018-07-01T00:37:25.547" LastActivityDate="2018-09-19T15:00:59.220" Title="Carousel with text using Matrix blocks" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26729" PostTypeId="1" AcceptedAnswerId="26773" CreationDate="2018-06-28T23:23:08.827" Score="1" ViewCount="610" Body="&lt;p&gt;&lt;a href=&quot;http://sanderson.brycekirk.com/floor-plans/1-bedroom-1-bathroom/f123-f148-f248&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://sanderson.brycekirk.com/floor-plans/1-bedroom-1-bathroom/f123-f148-f248&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page displays a floor plan, of which there are many. Currently, within each floorplan entry, you add the floors it is on, along with the image of each floor:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4gQAL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4gQAL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I'm using a for loop to display a big button for each available floor, as you can see on the linked page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem: I want to add disabled buttons for each floor the floorplan &lt;em&gt;isn't&lt;/em&gt; on, but I can't figure out how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logic should be something like this (&quot;floors&quot; is the name of the matrix field, &quot;floor&quot; is the block type handle):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IF '1' exists in entry.floors.floor.floorNumber&#xA;    Show the big selectable '1' button&#xA;ELSE &#xA;    Show the disabled '1' button&#xA;&#xA;IF '2' exists in entry.floors.floor.floorNumber&#xA;    Show the big selectable '2' button&#xA;ELSE &#xA;    Show the disabled '2' button&#xA;&#xA;etc for 3 and 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems like their should be some straightforward solution, but I've had no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current code for displaying the floor number buttons:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for floor in entry.floors.all() %}&#xA;{% if floor.type.handle == 'floor' %}&#xA;    &amp;lt;li class=&quot;tabs-title {% if loop.first %}is-active{% endif %}&quot;&amp;gt;&amp;lt;a href=&quot;#panel{{ floor.floorNumber }}&quot; {% if loop.first %}aria-selected=&quot;true&quot;{% endif %}&amp;gt;&amp;lt;img src=&quot;{{ siteUrl }}assets/img/{{ floor.floorNumber }}.png&quot; alt=&quot;{{ floor.floorNumber }}&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Floor matrix:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/M7J9J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M7J9J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7411" LastEditorUserId="57" LastEditDate="2018-07-01T00:38:43.550" LastActivityDate="2018-07-03T06:08:17.257" Title="Check if a value exists in a Matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26730" PostTypeId="1" AcceptedAnswerId="26744" CreationDate="2018-06-29T05:21:32.653" Score="1" ViewCount="176" Body="&lt;p&gt;Brand new Craft user.  Second day playing with it, and so far, loving it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the Solo license allows a Freelancer to roll off personal (for her own use) implementations for free -- even if those sites have a commercial purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand this to mean I may power more than one site for free under the terms of the Solo license.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Does this Solo licence freedom extend to paid plugins?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I want to purchase the commercial Enupal Backup plugin.  I would like to use it on my &lt;em&gt;two&lt;/em&gt; Solo-licensed Craft websites.  Can I do it, or must I purchase the plugin twice?&lt;/p&gt;&#xA;" OwnerUserId="8537" LastActivityDate="2018-06-29T17:42:37.767" Title="Commercial Plugins and Solo Licensing?" Tags="&lt;plugins&gt;&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26732" PostTypeId="1" CreationDate="2018-06-29T08:01:37.963" Score="1" ViewCount="57" Body="&lt;p&gt;I have migrated a website that uses Craft CMS over to a new server. The instructions that I followed were outlines in this post: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13982/migration-of-craft-cms-from-one-host-to-another/26694#26694&quot;&gt;Migration of Craft CMS from one host to another&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The domain name in question is : glosenterprise.co.uk - this is how its meant to look. Here is a screenshot of how it is looking on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h4PzQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h4PzQ.png&quot; alt=&quot;Glos Enterprise&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am completely new to Craft CMS but to me it looks as though its not pulling in the theme that was created for the live site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything obvious that I missing or a direction that people can point me in?&lt;/p&gt;&#xA;" OwnerUserId="8530" LastEditorUserId="45" LastEditDate="2018-06-29T16:16:40.800" LastActivityDate="2018-08-30T11:00:01.833" Title="Migration to new server, left with default theme?" Tags="&lt;templating&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26733" PostTypeId="2" ParentId="26708" CreationDate="2018-06-29T08:27:23.013" Score="3" Body="&lt;p&gt;Unfortunately, resizing images always tends to make them a little bit blurry, especially if the size that it's resized from isn't very big. But, here's a few things you can try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Make sure you're using the Imagick image driver in Craft, that gives you alot more options to play with (&lt;code&gt;'imageDriver' =&amp;gt; 'imagick'&lt;/code&gt; in your general config).&lt;/li&gt;&#xA;&lt;li&gt;Try playing around with the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/#resizefilter-string&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;resizeFilter&lt;/code&gt; config setting&lt;/a&gt;. This is the algorithm used to resize the image. Some are good for photos, some are good for illustrations. Some give the resized image a &quot;softer&quot; look, some a &quot;harder&quot; one.&lt;/li&gt;&#xA;&lt;li&gt;Make sure &lt;code&gt;smartResizeEnabled&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt; (it's the default), as this does a lot of up and down scaling to create a file that has a smaller filesize.&lt;/li&gt;&#xA;&lt;li&gt;Consider running the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/#sharpen-bool&quot; rel=&quot;nofollow noreferrer&quot;&gt;sharpen&lt;/a&gt; or &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/#unsharpmask-array&quot; rel=&quot;nofollow noreferrer&quot;&gt;unsharpmask&lt;/a&gt; effects on the transform. It might give undesired results if the image is too blurry, or the sharpen is too heavy, but it could be useful to just add a little bit more sharpness in the end.&lt;/li&gt;&#xA;&lt;li&gt;AFAIK, optipng shouldn't be doing anything to the image that would impact the visual quality of it. But, just to eliminate that, make sure you try without any post optimization tools also.&lt;/li&gt;&#xA;&lt;li&gt;Also, make sure that the image is actually displayed in the size that you've intended it to be (150px), and that you don't have any CSS rules on it that would result in it being treated as an GPU accelerated layer (transforms, etc). That blurs things like crazy. But, you can easily test if that's the case by opening the transformed image in a separate browser/application.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-06-29T08:27:23.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26734" PostTypeId="5" CreationDate="2018-06-29T08:28:33.947" Score="0" Body="" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2018-06-29T08:28:33.947" LastActivityDate="2018-06-29T08:28:33.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26735" PostTypeId="4" CreationDate="2018-06-29T08:28:33.947" Score="0" Body="Questions related to the Imager plugin for Craft. " OwnerUserId="141" LastEditorUserId="141" LastEditDate="2018-06-29T08:28:33.947" LastActivityDate="2018-06-29T08:28:33.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26737" PostTypeId="1" CreationDate="2018-06-29T09:46:34.613" Score="3" ViewCount="65" Body="&lt;p&gt;I have a low-budget project where would like to migrate an academic website to Craft. The website contains 15000 proverbs about women in different cultures that can be searched, (&lt;a href=&quot;http://www.womeninproverbsworldwide.com/the-proverbs/search/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.womeninproverbsworldwide.com/the-proverbs/search/index.php&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I consider making each proverb an entry. Will search perform fast enough with 15000 entries or should I consider a different approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for sharing your opinion!&lt;/p&gt;&#xA;" OwnerUserId="6388" LastEditorUserId="6388" LastEditDate="2018-06-29T13:53:54.180" LastActivityDate="2018-06-29T13:53:54.180" Title="Craft 3: Search in 15000 entries" Tags="&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26738" PostTypeId="2" ParentId="26737" CreationDate="2018-06-29T10:02:16.313" Score="1" Body="&lt;p&gt;Craft can handle such an amount of elements really well but you could get in trouble when you are going to import them all at once without changing your web server config or using certain importers since it will extend the defaults max_execution_time. So you'll have to import them step by step or via queue (or via import plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a job center with about 60.000 elements currently and everything works smooth&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-29T10:02:16.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26739" PostTypeId="1" AcceptedAnswerId="26740" CreationDate="2018-06-29T13:39:12.607" Score="1" ViewCount="56" Body="&lt;p&gt;I created a custom FieldType that gathers data from 2 different Models. I was able to successfully display it as a Drop Down. My problem now is that there are tooo many records on my array and I would like to have a search instead similar to what craft already has implemented on the Tags Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current template is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {%- set class = [&#xA;    'select',&#xA;    (class is defined ? class : null)&#xA;    ]|filter|join(' ') %}&#xA;&#xA;    {% set selectedValue = (value is defined ? value : null)  %}&#xA;&#xA;    &amp;lt;div class=&quot;{{ class }}&quot;&amp;gt;&#xA;        &amp;lt;select {%- if name is defined %} name=&quot;{{ name }}&quot;{% endif %}&amp;gt;&#xA;    {% if value is not null %}&#xA;    {% set selectedValue = value.id %}&#xA;    {% endif %}&#xA;    {% else %}&#xA;    &amp;lt;option value=&quot;0&quot; &amp;gt; &amp;lt;/option&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% for test in tests %}&#xA;    {% set optionValue = test.id %}&#xA;    &amp;lt;option value=&quot;{{test.id}}&quot; {% if optionValue == selectedValue %} selected{% endif %}&amp;gt;Test - {{ test.name }}: {{ test.price }}&amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/select&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any way I can make it similar to the &lt;code&gt;craft/app/templates/_components/fieldtypes/Tags/input.html&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8517" LastEditorUserId="5557" LastEditDate="2018-06-29T13:56:43.257" LastActivityDate="2018-06-29T14:05:02.273" Title="Input Tags Template for my Custom FieldType" Tags="&lt;templating&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26740" PostTypeId="2" ParentId="26739" CreationDate="2018-06-29T14:05:02.273" Score="2" Body="&lt;p&gt;You could use &lt;a href=&quot;https://select2.org/getting-started/basic-usage&quot; rel=&quot;nofollow noreferrer&quot;&gt;Select2&lt;/a&gt; to search in a select field &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function() {&#xA;    $('.my-custom-awesome-select-class').select2();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All you need to do is to include the js file via asset bundle or register it in your view directly and execute the JS code &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-29T14:05:02.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26742" PostTypeId="1" CreationDate="2018-06-29T16:18:43.623" Score="1" ViewCount="117" Body="&lt;p&gt;In my Craft 2 plugin my initial init function looked like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    if(!extension_loaded('imagick')) {&#xA;        PdfThumbnailerPlugin::log(&quot;imagick library not found - cannot make pdf thumbnails&quot; , LogLevel::Warning);&#xA;        return;&#xA;    }&#xA;&#xA;    craft()-&amp;gt;on('entries.saveEntry', function(Event $event) {&#xA;         craft()-&amp;gt;pdfThumbnailer_saveEntry-&amp;gt;setThumb($event);&#xA;    });&#xA;&#xA;    craft()-&amp;gt;on('assets.saveAsset', function(Event $event) {&#xA;        PdfThumbnailerPlugin::log(&quot;on save asset&quot;);&#xA;        craft()-&amp;gt;pdfThumbnailer_saveAsset-&amp;gt;checkAsset($event);&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I cannot understand (due to lack of devchops) or find an example of how to call my functions (which were in service files) in Craft3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the constants used in the new style 'listener' but have no idea what or where these are referenced in the v3 docs. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Register our site routes&#xA;    Event::on(&#xA;        UrlManager::class,&#xA;        UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;        function (RegisterUrlRulesEvent $event) {&#xA;            $event-&amp;gt;rules['siteActionTrigger1'] = 'pdfthumbnailer/save-entry';&#xA;            $event-&amp;gt;rules['siteActionTrigger2'] = 'pdfthumbnailer/save-asset';&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My plugin in craft 2 would create a thumbnail from the first page of a PDF asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;SO i eventually made some progress with :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Pdfthumbnailer::$plugin-&amp;gt;SaveEntry-&amp;gt;setThumb($event);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Except this kept saying it could not find service method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Getting unknown property: joomkit\pdfthumbnailer\Pdfthumbnailer::SaveEntry &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It turns out that the method 'SaveEntry' only was found when named 'saveEntry'. Why would this be the case? (excuse pun)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2018-07-02T11:34:45.137" LastActivityDate="2018-07-02T11:34:45.137" Title="Plugin migration - calling services help" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26743" PostTypeId="2" ParentId="26692" CreationDate="2018-06-29T16:22:12.160" Score="4" Body="&lt;p&gt;The 503 error on the home page usually indicates that Craft can't connect to the database. That's to be expected when performing a fresh installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The internal server error could be a typo or other misconfiguration in the &lt;code&gt;/web/.htaccess&lt;/code&gt; file. You can troubleshoot this by renaming the &lt;code&gt;.htaccess&lt;/code&gt; file so Apache doesn't use it, then in &lt;code&gt;/config/general.php&lt;/code&gt; set&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'omitScriptNameInUrls' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;index.php?p=admin&lt;/code&gt; should work then and you can sort out the &lt;code&gt;.htaccess&lt;/code&gt; url rewrites later.&lt;/p&gt;&#xA;" OwnerUserId="593" LastEditorUserId="57" LastEditDate="2018-07-01T00:44:23.443" LastActivityDate="2018-07-01T00:44:23.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26744" PostTypeId="2" ParentId="26730" CreationDate="2018-06-29T17:42:37.767" Score="1" Body="&lt;p&gt;Technically, that's up to each individual plugin developer. But realistically, the &lt;em&gt;vast&lt;/em&gt; majority of commercial plugins are only valid for a single site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's a paid plugin, you'll probably need to pay for it on each site independently.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;&quot;I may power more than one site for free under the terms of the Solo license.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's important to realize that you're actually working with &lt;em&gt;multiple&lt;/em&gt; licenses in this case... they just all happen to be Solo (aka free). Each site has its own license, you are not sharing a Solo license across multiple sites.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-06-29T17:42:37.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26745" PostTypeId="1" AcceptedAnswerId="26746" CreationDate="2018-06-29T18:21:56.460" Score="3" ViewCount="1128" Body="&lt;p&gt;I am making a super simple language switcher. And I was wondering if there is a way to get the baseUrl for a site by id or handle, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;navbar-item&quot; href=&quot;{{baseUrl.german}}&quot;&amp;gt;&amp;lt;img class=&quot;circular-square&quot; src=&quot;/images/global/german.png&quot; alt=&quot;Germany Flag&quot; /&amp;gt;DE&amp;lt;span class=&quot;sr-only&quot;&amp;gt;Deutsch&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to avoid doing is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a class=&quot;navbar-item&quot; href=&quot;/de&quot;&amp;gt;&amp;lt;img class=&quot;circular-square&quot; src=&quot;/images/global/german.png&quot; alt=&quot;Germany Flag&quot; /&amp;gt;DE&amp;lt;span class=&quot;sr-only&quot;&amp;gt;Deutsch&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or is that just how to you do? &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-06-29T18:40:24.573" Title="Can you get the baseUrl for site by handle or id?" Tags="&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26746" PostTypeId="2" ParentId="26745" CreationDate="2018-06-29T18:40:24.573" Score="5" Body="&lt;pre&gt;&lt;code&gt;{% set site = craft.app.getSites().getSiteById(1) %}&#xA;{% set site = craft.app.getSites().getSiteByHandle('handle') %}&#xA;{{ site.baseUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I would rather suggest you to grab the entries URL for a certain site in your language switcher&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryInOtherSite = craft.entries.id(entry.id).siteId(2).one() %}&#xA;{{ entry.getUrl() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why you even ask this question since everything is well documented &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23710/craft-3-language-switcher&quot;&gt;here&lt;/a&gt; since you &quot;answered&quot; that question&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-06-29T18:40:24.573" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26747" PostTypeId="2" ParentId="26710" CreationDate="2018-06-29T20:24:23.963" Score="1" Body="&lt;p&gt;I don't have enough rep to comment, but I can answer a few of your questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft logs are located in /craft/storage/runtime/logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you have a backup of the database before you uninstall the plugins. Depending on the plugin you could experience data loss.&#xA;To remove the plugins you can go to the /craft/plugins directory and delete the folders. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind if you do this it will not allow the plugin to clean up after itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also found this which may help avoid the clean up issue. &lt;a href=&quot;https://github.com/khalwat/uninstall&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/khalwat/uninstall&lt;/a&gt;. It is a tool that allows you to uninstall plugins via the cli.&lt;/p&gt;&#xA;" OwnerUserId="7838" LastActivityDate="2018-06-29T20:24:23.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26748" PostTypeId="2" ParentId="26742" CreationDate="2018-06-30T03:09:48.247" Score="1" Body="&lt;p&gt;I can't answer the question fully without seeing your plugin code, but I'd suggest you generate your plugin scaffolding with &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; to see how it all fits together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also helpful to look at a existing plugin that works; here's one I wrote that's pretty simple, and should be easy to follow: &lt;a href=&quot;https://github.com/nystudio107/craft-fastcgicachebust&quot; rel=&quot;nofollow noreferrer&quot;&gt;FastCGI Cache Bust&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roughly, you'd do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PluginClass::getInstance()-&amp;gt;serviceName-&amp;gt;methodName();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you do it the pluginfactory.io way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PluginClass::$plugin-&amp;gt;serviceName-&amp;gt;methodName();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-06-30T03:09:48.247" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26749" PostTypeId="1" CreationDate="2018-06-30T04:15:31.887" Score="1" ViewCount="139" Body="&lt;p&gt;What is the best practice for the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Client site running CraftCMS (v3) is in production. Updates are needed which require additions or modifications to the data structure / schema of the site (new sections, fields, etc.). Taking a remote dump of the database for local development is not a realistic option as the client makes regular updates to the website in production. Particularly for new additions, is there a way to easily make those updates in production after I've completed them in my development environment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real scenario: I'm adding a new section (a blog) to add to an existing Craft site. I will be working in the development environment for several days, making many additions to the data structure / schema, which I'd prefer not to have to replicate via the admin UI in production once I'm ready to deploy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: I do &lt;strong&gt;not&lt;/strong&gt; want to sync the entire databases - just the structure.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5940" LastActivityDate="2018-06-30T10:57:59.110" Title="Managing sections and field updates between environments" Tags="&lt;database&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26750" PostTypeId="2" ParentId="26749" CreationDate="2018-06-30T10:57:59.110" Score="1" Body="&lt;p&gt;You could use &lt;a href=&quot;https://github.com/Pennebaker/craft-architect&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Pennebaker/craft-architect&lt;/a&gt; to export your new sections/entry types/fields from your development environment once you're done, and then import them (without content) to production.&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-06-30T10:57:59.110" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26751" PostTypeId="2" ParentId="26517" CreationDate="2018-06-30T18:47:29.580" Score="1" Body="&lt;p&gt;&lt;strong&gt;Yes, after lots of trying I finally found the solution!! It was ESET causing the problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today, after re-installing PHP7 from scratch (so not using wamp and its contents anymore to make sure it's not wamp setup causing these problems) and reinstalling composer again I found that even that didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I figured it really should be in some anti-virus or other blocking tool. And I only use ESET Internet Security. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I tried disabling both ESET firewall as well as ESET anti-virus several times before and it didn't solve the mystery of the composer connectionproblems.&#xA;So I took a closer look at ESET advanced settings more deeply now and it seems that eventhough I thought I turned everything in ESETs scans and blocks completely off (and that's exactly what ESET displays!), there happens to be a SSL-scan that wasn't turned off by that so still actively preventing composer to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say scanning SSL communication by ESET shouldn't cause any problems anyhow, just some milliseconds delay or whatever, but it obviously was completely blocking composer from reaching packagist through ssl. Turning off the SSL scan made composer reach packagist with https immediately, so finally this solves the mystery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For people coming here with the same problem with composer and SSL and use ESET too, if you set up php and composer correctly then you should try this on ESET to solve the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Enter ESET advanced setup (via rightclick menu on ESET icon)&lt;/li&gt;&#xA;&lt;li&gt;Open up 'Web and email', and then the 'SSL/TLS' tab&lt;/li&gt;&#xA;&lt;li&gt;Click the 'edit'-link after 'List of SSL/TLS filtered applications' (a dialog opens)&lt;/li&gt;&#xA;&lt;li&gt;Check if the php.exe composer is using is in the list and if it does: make sure the scan action is set to 'ignore'. That prevents ESET from scanning the traffic via SSL from php.exe. Perhaps you could also add some certificate to the 'List of known certificates' here, but I solved it this way instead.&lt;/li&gt;&#xA;&lt;li&gt;If php.exe is not in the list you should get a dialog window when running&#xA;a composer command like 'composer diagnose' that needs ssl with packagist and ESET shows a dialog box for the new connection: set it to IGNORE. Scan will result in composer throwing warnings and having no connection with packagist.&lt;/li&gt;&#xA;&lt;li&gt;If php.exe is not in the list and you don't get the ESET dialog window for the new connection when running 'composer diagnose' either you probably don't have the 'SSL/TLS protocol filtering mode' in ESET (under 'web and email'/SSL/TLS tab in advanced settings) set to interactive mode. Set it to interactive mode than.&lt;/li&gt;&#xA;&lt;li&gt;If none of the above worked you could also choose to fully turn off all SSL/TLS protocol filtering in ESET by just switching it off in 'web and email' --&gt; SSL/TLS --&gt; Enable SSL/TLS protocol filtering. Then ESET isn't scanning any SSL anymore.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps more people having the same issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thisone really caused me headages for last weeks because it hold me back from switching to craft 3. So I'm really excited I finally got an answer to this now!! Finally it's time to move to the more important stuff!&lt;/p&gt;&#xA;" OwnerUserId="8483" LastActivityDate="2018-06-30T18:47:29.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26752" PostTypeId="2" ParentId="26608" CreationDate="2018-06-30T18:55:27.813" Score="1" Body="&lt;p&gt;Alright. Guess the conclusion to my question is that with Craft 3 it isn't realisticly possible to use the plugin store without composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily I finally found the problem composer had in connecting to packagist via ssl. Just in case other people have problems with composer too and are running ESET, this might help: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26517/unable-to-get-composer-running-to-install-craftcms/26751#26751&quot;&gt;unable-to-get-composer-running-to-install-craftcms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8483" LastActivityDate="2018-06-30T18:55:27.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26753" PostTypeId="2" ParentId="26706" CreationDate="2018-07-01T00:20:14.940" Score="1" Body="&lt;p&gt;Seems to be working as expected for me.  I've got an Asset Source setup with an S3 bucket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the root of the bucket, there is a &lt;code&gt;test1&lt;/code&gt; folder and in it is a &lt;code&gt;test2&lt;/code&gt; folder... i.e. &lt;code&gt;root/test1/test2/&lt;/code&gt;.  From there, I put a &lt;code&gt;test.jpg&lt;/code&gt; file inside of &lt;code&gt;test2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do this from a template (where ID is the Asset ID for &lt;code&gt;test.jpg&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = craft.assets.id(13).first() %}&#xA;&#xA;{{ image.getPath() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;test1/test2/test.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-01T00:20:14.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26754" PostTypeId="2" ParentId="26732" CreationDate="2018-07-01T09:03:16.473" Score="1" Body="&lt;p&gt;As written in the other comment. There were files from the fresh installation of Craft that I needed to delete. Once removed the template shown as intended. &lt;/p&gt;&#xA;" OwnerUserId="8530" LastActivityDate="2018-07-01T09:03:16.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26755" PostTypeId="2" ParentId="13982" CreationDate="2018-07-01T15:26:14.180" Score="4" Body="&lt;p&gt;The accepted answer is a good one, but I thought I'd add something as food for thought. If you set up your workflow such that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All of your Craft CMS project is checked into a git repo and deploy it as discussed in the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; article&lt;/li&gt;&#xA;&lt;li&gt;You use &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft-Scripts&lt;/a&gt; (or the like) to sync down your db and assets (or you put your assets in an S3 bucket) as discussed in the &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt; article&lt;/li&gt;&#xA;&lt;li&gt;You use a provisioning like Forge to spin up a new VPS as discussed in the &lt;a href=&quot;https://nystudio107.com/blog/web-hosting-for-agencies-freelancers&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Agencies &amp;amp; Freelancers Should Do Web Hosting&lt;/a&gt; article&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...you can become a Digital Nomad. I realize it seems like a lot of tooling, but the payoff is exactly the question being answered here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set things up in this manner, it's trivial to move to a new VPS because all of the ingredients that go into making the website are neatly compartmentalized, and can be deployed without any hassle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Future-you will thank you for setting things up so that not only is your day to day workflow easier and more fault-tolerant, but also when you move to a new VPS, that's trivial as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you're at it, set up backups as per the &lt;a href=&quot;https://nystudio107.com/blog/mitigating-disaster-via-website-backups&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mitigating Disaster via Website Backups&lt;/a&gt; article too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aesop was wise; it's an &lt;a href=&quot;http://read.gov/aesop/052.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ant &amp;amp; grasshopper&lt;/a&gt; thing.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-01T15:26:14.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26756" PostTypeId="1" CreationDate="2018-07-01T16:14:59.753" Score="2" ViewCount="66" Body="&lt;p&gt;I am trying to implement multi currency to my payment gateway plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to get converted price of the line item. Each item from &lt;em&gt;Omnipay\Common\Item&lt;/em&gt; has the price of non converted, main price of the item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This cause trouble because my payment gateway adds the line items and matches sum of all individual items to total sum of paid amount.&lt;/p&gt;&#xA;" OwnerUserId="656" LastActivityDate="2018-08-03T05:01:42.833" Title="Need to access each item's converted price from payment gateway" Tags="&lt;plugin-craftcommerce&gt;&lt;omnipay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26757" PostTypeId="1" CreationDate="2018-07-01T17:02:49.357" Score="1" ViewCount="270" Body="&lt;p&gt;I'm doing the Craft 3 upgrade and I can't figure out how to connect our Google Cloud Storage. Back with Craft 2 I used a &lt;code&gt;Google Access Key&lt;/code&gt; and &lt;code&gt;Access Secret Key&lt;/code&gt;. Now I am asked for a &lt;code&gt;Project ID&lt;/code&gt; and the &lt;code&gt;Contents of the access key file&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reviewing the plugin's README I read about getting the &lt;em&gt;Service Account Credentials JSON&lt;/em&gt;. Which after a search, I found were generated through (Google's Identify Platform, IAM)[&lt;a href=&quot;https://developers.google.com/identity/protocols/OAuth2ServiceAccount]&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developers.google.com/identity/protocols/OAuth2ServiceAccount]&lt;/a&gt; which allowed me to create a Service Account for the project and I downloaded a JSON file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went to enter my &lt;strong&gt;Project ID&lt;/strong&gt; and the &lt;strong&gt;contents of the JSON&lt;/strong&gt;, thinking this would solve it, but I keep getting a permissions error. Despite going through the project permissions and the created account permissions. I've tried with Legacy owner permissions and still nothing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[IAM USER] does not have storage.bucket.list permission to access project [PROJECT # ID]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I missing anything or are these not the right credentials?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2018-08-31T19:57:38.403" Title="How to configure Google Cloud Storage in Craft v3?" Tags="&lt;craft3&gt;&lt;upgrades&gt;&lt;storage&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26758" PostTypeId="1" AcceptedAnswerId="26801" CreationDate="2018-07-02T07:49:10.387" Score="1" ViewCount="368" Body="&lt;p&gt;I recently installed &lt;a href=&quot;https://verbb.io/craft-plugins/comments/features&quot; rel=&quot;nofollow noreferrer&quot;&gt;Verbbs Comments plugin&lt;/a&gt; on my Craft site, which seems all well and good except that I can't toggle the comment replies. ('2 comments' when clicked does nothing)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.imgur.com/sZ3ifxX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.imgur.com/sZ3ifxX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything else works fine but that. I'm currently using the sample &lt;a href=&quot;https://github.com/verbb/comments/blob/craft-2/examples/comments-style.css&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/verbb/comments/blob/craft-2/examples/standard/standard.html#L17&quot; rel=&quot;nofollow noreferrer&quot;&gt;JS&lt;/a&gt; which was provided on their website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried the AJAX version provided on this page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://verbb.io/craft-plugins/comments/docs/feature-tour/example-css-js&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/comments/docs/feature-tour/example-css-js&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not trying to override anything on this plugin, just want to get the sample up and running. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, no error in console.&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6007" LastEditDate="2019-04-29T12:59:51.460" LastActivityDate="2019-04-29T12:59:51.460" Title="Verbb Comments plugin - Can't see comment replies" Tags="&lt;javascript&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26759" PostTypeId="2" ParentId="26668" CreationDate="2018-07-02T08:01:24.247" Score="1" Body="&lt;p&gt;My solution&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To keep the ‘index.html’ file of the magazines inside templates as per usual&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Store the other assets inside a private directory outside of the public folder&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Write a plugin that would look for requests to these files and serve them from the private place instead.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I began by wireframing the plugin; I created a new folder inside craft/plugins named ‘magazineassets’. Inside this folder I added another folder named ‘controllers’ and a file named ‘MagazineAssetsPlugin.php’.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd plugins&#xA;mkdir magazineassets magazineassets/controllers magazineassets/MagazineAssetsPlugin.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MagazineAssets.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MagazineAssetsPlugin extends BasePlugin&#xA;{&#xA;    public function getName()&#xA;    {&#xA;            return 'Magazine Assets';&#xA;    }&#xA;&#xA;    public function getVersion()&#xA;    {&#xA;        return '1.0';&#xA;    }&#xA;&#xA;    public function registerSiteRoutes()&#xA;    {&#xA;        return [&#xA;            'members/magazine/(?P&amp;lt;issue&amp;gt;.*)/(?P&amp;lt;folder&amp;gt;.*)/(?P&amp;lt;file&amp;gt;.*)' =&amp;gt; ['action' =&amp;gt; 'magazineAssets/getMagAsset'],&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once this was written, I went into the website’s admin panel and enabled the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method of interest here is the ‘registerSiteRoutes’ one. What this does is looks for any requests to members/magazine/[issue]/[folder]/[file] and ‘sends’ them to a controller that we haven’t written yet…&#xA;MagazineAssetsController.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(stored inside the, earlier created, ‘controllers’ folder)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class MagazineAssetsController extends BaseController&#xA;{&#xA;    public function init()&#xA;    {&#xA;        if (!craft()-&amp;gt;plugins-&amp;gt;getPlugin('MagazineAssets'))&#xA;            throw new Exception('Couldn\'t find the Magazine Assets Plugin!');&#xA;    }&#xA;&#xA;    public function actionGetMagAsset(array $variables = [])&#xA;    {&#xA;        $path = craft()-&amp;gt;config-&amp;gt;get('environmentVariables')['internalAssetsPath'].'magazines'.DIRECTORY_SEPARATOR.$variables['issue'].DIRECTORY_SEPARATOR.$variables['folder'].DIRECTORY_SEPARATOR.$variables['file'];&#xA;&#xA;        if (IOHelper::fileExists($path)) {&#xA;                $content = IOHelper::getFileContents($path);&#xA;                craft()-&amp;gt;request-&amp;gt;sendFile($path, $content, ['forceDownload' =&amp;gt; false]);&#xA;        } else {&#xA;            die('file not found at: '.$path);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The method of interest here is the ‘actionGetMagAsset’ function which matches the ‘action’ that we are now routing to via the ‘registerSiteRoutes()’ plugin method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s no doubt in my mind that there’s probably some fancy way of writing that path using some baked in CraftCMS methods but I a) wasn’t certain what they are and b) wanted to be very rigid and certain that I definitely had the right path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The path begins using a config setting (at config/general.php) that I already had thanks to another plugin that I was already using followed by ‘/magazines/[issue]/[folder]/[file]’ (sound familiar?). The config is below but I guess I could have just as easily written it as if I didn’t have the config or didn’t want it…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    $path = CRAFT_BASE_PATH.&quot;../files/&quot;.'magazines'.DIRECTORY_SEPARATOR.$variables['issue'].DIRECTORY_SEPARATOR.$variables['folder'].DIRECTORY_SEPARATOR.$variables['file'];&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My config/general.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    return [&#xA;        //etc.&#xA;        'environmentVariables' =&amp;gt; [&#xA;            'internalAssetsPath' =&amp;gt; CRAFT_BASE_PATH . &quot;../files/&quot;,&#xA;        ]&#xA;    ];&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then used Craft’s built in InputOutput helper class to display the file if it exists and tested via the front-end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Boom! All working now. Assets are loaded from the files folder, my file structure is like this (simplified obviously):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft&#xA;    plugins&#xA;        magazineassets&#xA;            controllers&#xA;                MagazineAssetsController.php&#xA;            MagazineAssetsPlugin.php&#xA;    templates&#xA;            members&#xA;                magazine&#xA;                    july-2018&#xA;                        mag&#xA;                            index.html &amp;lt;--- the magazine that needs the assets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yeah, okay, but the magazine is still public!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right you are, it took two seconds to fix that. Into craft/templates/members/magazine/july-2018/mag/index.html I went and simply added…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requireLogin %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…to the top of the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this post helps anyone who faces a similar conundrum.&lt;/p&gt;&#xA;" OwnerUserId="4242" LastEditorUserId="4242" LastEditDate="2018-07-02T16:11:59.797" LastActivityDate="2018-07-02T16:11:59.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26760" PostTypeId="1" CreationDate="2018-07-02T08:02:33.460" Score="1" ViewCount="57" Body="&lt;p&gt;I'm new to Craft CMS, and was wondering if it is possible to migrate a Craft CMS website to a test domain, to do redesign work, before moving the update site back to the live domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and will this effect any license?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;looking forward to hearing from you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kindest regards&#xA;Anrich Vigus&lt;/p&gt;&#xA;" OwnerUserId="8542" LastActivityDate="2018-07-02T14:22:08.367" Title="Migrate to a test site" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26762" PostTypeId="2" ParentId="19248" CreationDate="2018-07-02T11:38:05.057" Score="0" Body="&lt;p&gt;Just came across this issue with pluginfactory.io plugin scaffold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turns out that the service method name was only called when starting with a lowercase. Not clear enough if it applies here but might help someone.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-07-02T11:38:05.057" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26763" PostTypeId="1" CreationDate="2018-07-02T12:46:05.930" Score="-1" ViewCount="54" Body="&lt;p&gt;The Craft CMS I am using doesn't want to publish the blogs I am writing. Why?&lt;/p&gt;&#xA;" OwnerUserId="8543" LastEditorUserId="5557" LastEditDate="2018-07-02T13:59:59.230" LastActivityDate="2018-07-02T14:18:05.130" Title="Entry does not publish" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-07-02T18:03:47.490" ContentLicense="CC BY-SA 4.0" />
  <row Id="26765" PostTypeId="2" ParentId="26763" CreationDate="2018-07-02T14:18:05.130" Score="1" Body="&lt;p&gt;You'll need to speak to the developer of your site. Craft is more a system for building a CMS than a CMS itself. Consequently there are a thousand ways your site could be put together and even more reasons why something may not be working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can get some more information then there are many people who, I am sure, would be happy to help. It's just not possible to answer your question with the information provided.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-02T14:18:05.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26766" PostTypeId="2" ParentId="26760" CreationDate="2018-07-02T14:22:08.367" Score="1" Body="&lt;p&gt;Yes it's possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may get a notice that the licence key is in use on another domain if your testing domain is publicly accessible (rather than running on your local machine). But the site will continue to work just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can't do is run 2 &quot;live&quot; sites with the same key. That's a violation of the licence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, by going to &lt;a href=&quot;https://id.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://id.craftcms.com/&lt;/a&gt; you can manage the licences for any Craft sites you have.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-02T14:22:08.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26767" PostTypeId="1" AcceptedAnswerId="26768" CreationDate="2018-07-02T17:03:15.583" Score="1" ViewCount="409" Body="&lt;p&gt;In Craft2, I have structures that each have a landing page/homepage for that structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the structure's URI format is &quot;liver/{slug}&quot;, how do I make the 'landing page' entry have a URI of only &quot;liver/&quot;, with no slug? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is important since I want users visiting the liver/about-us page to be able to remove 'about-us'...and land on the liver homepage (not get a 404).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand routing very well-- from what I have gleaned I cannot see how to make routing associate a given URI with a given entry-- I only understand how to associate it with a template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18190/can-i-use-a-structure-without-slugs&quot;&gt;this question&lt;/a&gt;, except that I want these landing pages to have dashboard entries and use the same template as all the other pages...not be an index-type page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I have seen answers regarding adding a site homepage to a structure, but this is not a site homepage- these landing pages do not live at the site domain root...they live at the root of each structure's URI. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help. &lt;/p&gt;&#xA;" OwnerUserId="5264" LastActivityDate="2018-07-02T17:13:01.820" Title="How can I set a landing page for a structure with no slug?" Tags="&lt;url&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26768" PostTypeId="2" ParentId="26767" CreationDate="2018-07-02T17:13:01.820" Score="2" Body="&lt;p&gt;You can create change the &lt;code&gt;uri&lt;/code&gt; pattern for your structured section to something like &lt;code&gt;{ parent.uri }/{ slug }&lt;/code&gt; and create an additional entry type &lt;code&gt;landing-page&lt;/code&gt;. Your landing page will have the slug &lt;code&gt;liver&lt;/code&gt; and all entries below that will have the URI &lt;code&gt;liver/{slug}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can load different templates based on the entry type and if the type is your landing page, you'll display all children&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another Approach is to use a &lt;code&gt;template&lt;/code&gt; path directly and insert the template &lt;code&gt;liver.twig&lt;/code&gt; in your templates folder&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-02T17:13:01.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26769" PostTypeId="1" AcceptedAnswerId="26771" CreationDate="2018-07-02T17:50:06.367" Score="1" ViewCount="253" Body="&lt;p&gt;I'm having trouble trying to output assets from an Assets field that's within a Matrix block, using Imager. The code below is only outputting the first image that has been added, over and over for each asset, rather outputting each different asset. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did try changing &lt;code&gt;{% set logo = block.logos.first() %}&lt;/code&gt; to &lt;code&gt;{% set logo = block.logos.all() %}&lt;/code&gt;, but that gave me an internal server error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.modules.all() %}&#xA;&#xA;  {% if block.type == &quot;logosBlock&quot; %}&#xA;&#xA;    {% for image in block.logos %}&#xA;&#xA;        &amp;lt;div class=&quot;logo-child&quot;&amp;gt;&#xA;&#xA;          {% set logo = block.logos.first() %}&#xA;          {% set transformedImage = craft.imager.transformImage(logo, { width: 312, height: 200, }) %}&#xA;          &amp;lt;img src=&quot;{{ transformedImage.url }}&quot; alt=&quot;{{ logo.title }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;      {% endfor %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="179" LastEditorUserId="57" LastEditDate="2018-07-02T22:49:21.533" LastActivityDate="2018-07-02T22:49:21.533" Title="Output assets within a matrix block using Imager and Craft 3" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26770" PostTypeId="2" ParentId="25373" CreationDate="2018-07-02T17:53:29.263" Score="1" Body="&lt;p&gt;I ran into this problem too, and isolated it to AssetLocationValidator.php on line 110 or so.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// If nothing has changed, just null-out the newLocation attribute&#xA;if (!$hasNewFolderId &amp;amp;&amp;amp; !$hasNewFilename) {&#xA;    $model-&amp;gt;$attribute = null;&#xA;&#xA;    return;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the problem is, having a null newLocation throws a validation error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution was to set the folderId as 0, and the newFolderId as the destination folder.  This keeps the &quot;null out the newLocation...&quot; from firing, and keeps the newLocation populated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$asset = new Asset();&#xA;$asset-&amp;gt;tempFilePath = $tempPath;&#xA;$asset-&amp;gt;filename = $filename;&#xA;$asset-&amp;gt;folderId = 0;&#xA;$asset-&amp;gt;newFolderId = $folder-&amp;gt;id;&#xA;$asset-&amp;gt;volumeId = $folder-&amp;gt;volumeId;&#xA;$asset-&amp;gt;avoidFilenameConflicts = true;&#xA;$asset-&amp;gt;setScenario(Asset::SCENARIO_CREATE);&#xA;&#xA;$result = Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2018-07-02T17:53:29.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26771" PostTypeId="2" ParentId="26769" CreationDate="2018-07-02T18:01:44.630" Score="2" Body="&lt;p&gt;Why do you try to fetch the image multiple times? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.logos %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will fetch the images and loop them &lt;code&gt;{% set logo = block.logos.first() %}&lt;/code&gt; -&gt; will fetch the first image again and again.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in block.logos %}&#xA;    {% set transformedImage = craft.imager.transformImage(image, { width: 312, height: 200, }) %}&#xA;    &amp;lt;img src=&quot;{{ transformedImage.url }}&quot; alt=&quot;{{ logo.title }}&quot;&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should work&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-02T18:01:44.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26772" PostTypeId="1" AcceptedAnswerId="26782" CreationDate="2018-07-02T23:38:42.603" Score="2" ViewCount="2601" Body="&lt;p&gt;I am trying to update an entry's title in a Craft 3 module after an entry is saved. I cannot use EVENT_BEFORE_SAVE_ELEMENT because the title gets updated after this. If I use EVENT_AFTER_SAVE_ELEMENT to update the title and then do &lt;code&gt;saveElement&lt;/code&gt; the event gets called again and I get into an infinite loop. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) {&#xA;    if ($event-&amp;gt;element instanceof \craft\elements\Entry) {&#xA;        if ($element-&amp;gt;section-&amp;gt;id == 1 &amp;amp;&amp;amp; $element-&amp;gt;typeId == 1) {&#xA;            $element = $event-&amp;gt;element;&#xA;            $newTitle = &quot;new title&quot;; // logic goes here&#xA;            $element-&amp;gt;title = $newTitle;&#xA;            Craft::$app-&amp;gt;elements-&amp;gt;saveElement($element); // causes loop&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3843" LastEditorUserId="3843" LastEditDate="2018-07-02T23:44:39.560" LastActivityDate="2018-07-03T16:56:47.987" Title="How to saveElement in EVENT_AFTER_SAVE_ELEMENT without infinite loop" Tags="&lt;craft3&gt;&lt;events&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26773" PostTypeId="2" ParentId="26729" CreationDate="2018-07-03T06:08:17.257" Score="1" Body="&lt;p&gt;You can check if certain elements match for your Query via &lt;code&gt;exists()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.floors.type('floor').floorNumber(1).exists()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns true or false. However keep in mind &lt;code&gt;entry.floors&lt;/code&gt; returns an element of type &lt;code&gt;Query&lt;/code&gt; and you'll append the parameters &lt;code&gt;type&lt;/code&gt; and &lt;code&gt;floorNumber&lt;/code&gt; to the Query. These properties won't reset magically since you call the object by reference and not by value thus you'll either need to reset them&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do entry.floors.type(null).floorNumber(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or you don't use the object directly and &lt;a href=&quot;https://docs.craftcms.com/v3/templating/functions.html#clone-object&quot; rel=&quot;nofollow noreferrer&quot;&gt;clone/copy&lt;/a&gt; it instead &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set exists = clone(entry.floors).type('floor').floorNumber(1).exists() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-03T06:08:17.257" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26774" PostTypeId="2" ParentId="26758" CreationDate="2018-07-03T08:58:39.393" Score="2" Body="&lt;p&gt;I remember having to modify the javascript and templates quite extensively to get it working. Take a look at the code and find out what needs fixing. If you're using Bootstrap you can modify the template so that it uses Bootstraps buttons and dropdowns, and that's how I got it working nicely.&lt;/p&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="8169" LastEditDate="2018-07-04T05:43:07.327" LastActivityDate="2018-07-04T05:43:07.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26775" PostTypeId="1" CreationDate="2018-07-03T09:39:23.847" Score="1" ViewCount="876" Body="&lt;p&gt;So i am developing a site on Mamp Pro locally.&#xA;All good.&#xA;Its version controlled with github.&#xA;When deployed to staging server it was fine initially.&#xA;Last Friday deployed again and now i keep getting fatal errors: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Stack trace:&#xA;#0 /home/mywebpath/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response-&amp;gt;sendHeaders()&#xA;#1 /home/mywebpath/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response-&amp;gt;send()&#xA;#2 /home/mywebpath/vendor/craftcms/cms/src/web/ErrorHandler.php(156): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#3 /home/mywebpath/vendor/yiisoft/yii2/base/ErrorHandler.php(262): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#4 [internal function]: yii\base\ErrorHandler-&amp;gt;handleFatalError()&#xA;#5 {main}&#xA;  thrown in /home/mywebpath/vendor/yiisoft/yii2/web/Response.php on line 366&#xA;[02-Jul-2018 20:59:04 UTC] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /home/mywebpath/vendor/composer/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52&#xA;[02-Jul-2018 20:59:04 UTC] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /home/mywebpath/vendor/craftcms/cms/src/i18n/Locale.php on line 822&#xA;[02-Jul-2018 20:59:04 UTC] PHP Fatal error:  Uncaught yii\web\HeadersAlreadySentException: Headers already sent. in /home/mywebpath/vendor/yiisoft/yii2/web/Response.php:366&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am going to do a vanilla setup on the server just to test but if anyone has any ideas or similar experience do share any resolutions/ideas.&#xA;thx&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-07-03T10:18:50.000" Title="Random Fatal errors header already sent" Tags="&lt;debugging&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26776" PostTypeId="2" ParentId="26775" CreationDate="2018-07-03T10:18:50.000" Score="1" Body="&lt;p&gt;Solved: this turned out to be a WHM/CPanel bug that was loading imagick module twice.&#xA;Known fixes were found here: &lt;a href=&quot;https://forums.cpanel.net/threads/php-warning-module-already-loaded-in-unknown-on-line-0.612735/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://forums.cpanel.net/threads/php-warning-module-already-loaded-in-unknown-on-line-0.612735/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-07-03T10:18:50.000" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26778" PostTypeId="1" CreationDate="2018-07-03T11:30:16.343" Score="2" ViewCount="88" Body="&lt;p&gt;I'm currently working on a new Craft CMS website for my company. We're using Elastic Beanstalk for hosting, which means that saving assets to file on the server isn't really viable- they get overwritten by code deployments- so I'm planning to have them saved to S3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I or other developers are working on the site locally, uploading to S3 is both unnecessary and difficult (the company handles a &lt;em&gt;lot&lt;/em&gt; of sensitive data so individual access to any of our AWS services is heavily ring-fenced). It would be preferable in development to just upload images to file locally and keep them out of version control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I'd like to be able to change the root asset location depending on the environment. I've done similar things in Rails and Express apps, but am very new to Craft and PHP in general and am not sure where to begin. The official AWS integration seems to assume that you want everything going into S3 all the time. Does anyone have any experience of using different upload locations for different environments?&lt;/p&gt;&#xA;" OwnerUserId="8547" LastActivityDate="2020-08-27T11:57:36.817" Title="Uploading assets to different locations based on environment" Tags="&lt;assets&gt;&lt;multi-environment&gt;&lt;s3&gt;&lt;aws&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26779" PostTypeId="1" AcceptedAnswerId="26781" CreationDate="2018-07-03T11:57:40.350" Score="2" ViewCount="350" Body="&lt;p&gt;In the following route configuration i want to make the height segment optional.&#xA;So that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/images/400/200/placeholder.png&lt;/li&gt;&#xA;&lt;li&gt;/images/400/placeholder.png&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;are both possible with one route.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;rules['/images/&amp;lt;width:\d+&amp;gt;/&amp;lt;height:\d+&amp;gt;/&amp;lt;imageName:([-\w.]+)&amp;gt;'] = 'module-name/image';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried the answer from this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8568/is-it-possible-to-define-optional-route-segments&quot;&gt;Is it possible to define optional route segments?&lt;/a&gt; but couldnt bring it to work.&lt;/p&gt;&#xA;" OwnerUserId="8219" LastActivityDate="2018-07-03T16:23:22.917" Title="Make segment in the middle of a route optional" Tags="&lt;craft3&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26780" PostTypeId="1" AcceptedAnswerId="26786" CreationDate="2018-07-03T15:42:40.563" Score="1" ViewCount="99" Body="&lt;p&gt;I have an Asset field where the first image is used as a big 'feature' and then the rest are used as support further down the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I add .limit(1) to the for loop for the 'feature' image it effects the for loop further down the page by also only showing 1 image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('abstractionProjects').type('abstractionProjects').all() %}&#xA;{% for projectPanels in entries %}&#xA;&#xA;    Some HTML...&#xA;&#xA;    {% for asset in projectPanels.projectImages.limit(1) %}&#xA;      &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    Some HTML.....&#xA;    More HTML...&#xA;&#xA;    {% for thumbs in projectPanels.projectImages.offset(1) %}&#xA;      &amp;lt;div&amp;gt;&#xA;          &amp;lt;img src=&quot;{{ thumbs.url('projectPageThumbs') }}&quot; alt=&quot;{{ thumbs.title }}&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ thumbs.url('projectPageFullSize') }}&quot; class=&quot;gallery&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    More HTML...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the .limit(1) from the first loop all the images are shown in both loops :/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2018-07-03T19:09:16.970" Title=".limit(1) on asset field loop is effecting another loop on same page" Tags="&lt;assets&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26781" PostTypeId="2" ParentId="26779" CreationDate="2018-07-03T16:23:22.917" Score="3" Body="&lt;p&gt;Your regex is going to become more complex and potentially less specific if you try to address both scenarios in a single route as the height and width parameters match numbers and the final segment of your URL matches any characters that would be found in a URL segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be easier to handle this as two rules, the more specific one first:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'/images/&amp;lt;width:\d+&amp;gt;/&amp;lt;height:\d+&amp;gt;/&amp;lt;imageName:([-\w.]+)&amp;gt;'&#xA;'/images/&amp;lt;width:\d+&amp;gt;/&amp;lt;imageName:([-\w.]+)&amp;gt;'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Making this two rules you get around needing to matching both a number OR other characters in the third segment. If the second and third segment are numbers and the fourth segment is present, your first rule will match. If the third segment is not a number and there is no fourth segment, your second rule will match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, with two rules you can easily test if &lt;code&gt;height&lt;/code&gt; exists or not in your controller or template. If you combine that third segment into a compound rule, you may need additional logic in your template to sort out what value you are working with.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-03T16:23:22.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26782" PostTypeId="2" ParentId="26772" CreationDate="2018-07-03T16:56:47.987" Score="3" Body="&lt;p&gt;I got this working by using the EVENT_BEFORE_SAVE_ELEMENT and adding the asset to the entry asset field 'pdfThumbnailImage' by using the setFieldValue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $entry-&amp;gt;setFieldValue('pdfThumbnailImage', [$assetId]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You dont need to save the element - leave this out&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Craft::$app-&amp;gt;elements-&amp;gt;saveElement($element); // causes loop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-07-03T16:56:47.987" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26784" PostTypeId="2" ParentId="20342" CreationDate="2018-07-03T18:06:30.110" Score="1" Body="&lt;p&gt;Craft won't allow any anonymous entry creation at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use something like the &lt;a href=&quot;https://github.com/craftcms/guest-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries&lt;/a&gt; plugin that simulates an &quot;anonymous&quot; entry because you select a user account ahead of time to assign all anonymously created entries to.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-03T18:06:30.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26786" PostTypeId="2" ParentId="26780" CreationDate="2018-07-03T18:48:53.810" Score="1" Body="&lt;p&gt;Yes, this is actually the intended behaviour, and one that changed when going from Craft 2 to Craft 3. You can read more about it in the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Changes in Craft 3 article in the docs&lt;/a&gt;. &lt;code&gt;projectImages&lt;/code&gt; in this case which is an Asset field (I assume), returns an ElementQuery when you access it with &lt;code&gt;projectPanels.projectImages&lt;/code&gt;. The field doesn't automatically return a new model when accessed, it returns the reference to the one and same query. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workaround is to either reset the parameters you need to reset, like &lt;code&gt;limit()&lt;/code&gt; in this case, or use clone as described in that article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ie, either something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in projectPanels.projectImages.limit(1).all() %}&#xA;   ...&#xA;{% endfor %}&#xA;&#xA;{% for thumbs in projectPanels.projectImages.limit(null).offset(1).all() %}&#xA;   ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in clone(projectPanels.projectImages).limit(1).all() %}&#xA;   ...&#xA;{% endfor %}&#xA;&#xA;{% for thumbs in clone(projectPanels.projectImages).offset(1).all() %}&#xA;   ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have stumbled on this quite a few times myself alreadym, it's a bit confusing. Hope this helps though. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="5557" LastEditDate="2018-07-03T19:09:16.970" LastActivityDate="2018-07-03T19:09:16.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26787" PostTypeId="2" ParentId="26778" CreationDate="2018-07-03T19:02:22.967" Score="1" Body="&lt;p&gt;AFAIK, you can't change the type of your volume based on your environment. But if having a separate S3 account/bucket for dev could work for you, you can configure this with a volume.php config file. Check out &lt;a href=&quot;https://docs.craftcms.com/v3/configuration.html#overriding-volume-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;this section in the docs about configuration&lt;/a&gt; for the gist on how to use it, and the section about &lt;a href=&quot;https://github.com/craftcms/aws-s3#per-environment-configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;per environment configuration&lt;/a&gt; in the readme for the AWS-S3 plugin for the specifics for that type of volume. &lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-07-03T19:02:22.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26788" PostTypeId="1" CreationDate="2018-07-03T22:51:05.130" Score="0" ViewCount="39" Body="&lt;p&gt;**How can I modify this to orderBy the # of entries and then limit to the top 3? **   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for categoryName in craft.categories.group('markets') %}&#xA;    {% set numofEntries = craft.entries.section('posts').relatedTo(categoryName).total() %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ categoryName.url }}&quot;&amp;gt;{{ categoryName.title }} &amp;lt;sup&amp;gt;({{numofEntries}})&amp;lt;/sup&amp;gt; &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2018-07-04T00:03:12.077" LastActivityDate="2018-07-04T00:49:13.167" Title="How can count and then order by the # of entries assigned to a category; and then limit to only the top 3?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26789" PostTypeId="1" CreationDate="2018-07-03T23:29:12.767" Score="2" ViewCount="48" Body="&lt;p&gt;I have a category group named &lt;code&gt;country&lt;/code&gt;.   Each entry in &lt;code&gt;posts&lt;/code&gt; is assigned to a &lt;code&gt;country&lt;/code&gt; and a &lt;code&gt;dollar value&lt;/code&gt;.  &lt;code&gt;dollar value&lt;/code&gt; is a field, NOT a table cell.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a country's given page (i.e., a category page), I want to sum the total value across all entries assigned to a given country by year (date posted) across all years for which there are entries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help...&lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-08-03T06:02:16.673" Title="How can I sum value across entries assigned to a category for a given year across multiple years?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26790" PostTypeId="2" ParentId="26788" CreationDate="2018-07-04T00:49:13.167" Score="1" Body="&lt;p&gt;Ideally you'd do this from a custom plugin so you could write some queries directly against the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking to do this from a template, this should work, albeit it's not very efficient.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryArr = {} %}&#xA;&#xA;{# Store the slug as the key in an array and the total number as the value #}&#xA;{% for categoryName in craft.categories.group('markets') %}&#xA;    {% set entryArr = entryArr|merge({(categoryName.slug): craft.entries.section('posts').relatedTo(categoryName).total()}) %}&#xA;{% endfor %}&#xA;&#xA;{# Sort the array by the descending value maintaining the keys #}&#xA;{% set entryArr = entryArr|sort|reverse %}&#xA;&#xA;{# Grab the first 3 values from the array #}&#xA;{% set entryArr = entryArr|slice(0, 3) %}&#xA;&#xA;{# print them off #}&#xA;{% for slug, number in entryArr %}&#xA;    {% set categoryName = craft.categories.slug(slug).one() %}&#xA;    {{ categoryName.title }} - ({{number}})&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-04T00:49:13.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26791" PostTypeId="1" CreationDate="2018-07-04T01:10:27.593" Score="1" ViewCount="44" Body="&lt;p&gt;I setup my archive using the Craft &lt;a href=&quot;https://craftcms.com/support/entry-archive&quot; rel=&quot;nofollow noreferrer&quot;&gt;demo&lt;/a&gt;.  I have a page for each year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use &lt;a href=&quot;https://www.kunkalabs.com/mixitup/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MixItUp&lt;/a&gt;,(think Isotope) to allow a user to filter entries by month. There are simple hard coded buttons for each month.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I loop through the entries and create a button for only those months that have entries?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update.  I have a loop that pulls all the entries for a given year.  I then use MixItUp (think Isotope) to filter the entries by month.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a button for each month that triggers MixItUp.  I want to make the creation of these buttons dynamic.  That is, I want to create a loop that generates a button for only those months that contain entries and create a class with the month's name that corresponds with the month in the class names of the entry cards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any given year, the loop would create 1-12 buttons.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for month that has &amp;gt; 0 entries %}&#xA;&#xA;&amp;lt;button type=&quot;button&quot; class=&quot;btn btn-outline-secondary btn-lg&quot;   data-mixitup-control data-filter=&quot;.February&quot;&amp;gt;Feb&amp;lt;/button&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qXwSH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qXwSH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="5490" LastEditDate="2018-07-06T13:06:58.330" LastActivityDate="2018-07-06T13:06:58.330" Title="List only those months that have entries" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26792" PostTypeId="1" AcceptedAnswerId="26793" CreationDate="2018-07-04T02:31:51.013" Score="1" ViewCount="376" Body="&lt;p&gt;I have an entry with a Matrix field, inside this field I have a Super Table as block type.  My fields data looks like below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;title&quot; =&amp;gt; &quot;test1&quot;&#xA;&quot;matrixHandle&quot; =&amp;gt; array:2 [&#xA;  0 =&amp;gt; array:2 [&#xA;    &quot;type&quot; =&amp;gt; &quot;sponsorshipRow&quot;&#xA;    &quot;fields&quot; =&amp;gt; array:2 [&#xA;      &quot;sectionTitle&quot; =&amp;gt; &quot;blablabla&quot;&#xA;      &quot;superTableHandle&quot; =&amp;gt; array:5 [&#xA;        0 =&amp;gt; array:3 [&#xA;          &quot;fields&quot; =&amp;gt; array:10 [&#xA;            &quot;relatedArticle&quot; =&amp;gt; 325051&#xA;            ...&#xA;          ]&#xA;        ]&#xA;        1 =&amp;gt; [...]&#xA;  1 =&amp;gt; [...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I loop these fields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($fields as $key =&amp;gt; $value) {&#xA;    $entry-&amp;gt;setFieldValue($key, $value);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And last, I save the entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But every data is saved except for the super table block. The super table block is not even created. Any idea please?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="57" LastEditDate="2018-07-04T20:41:35.917" LastActivityDate="2018-07-04T20:41:35.917" Title="How to save a Matrix with Super Table in it" Tags="&lt;plugin-development&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26793" PostTypeId="2" ParentId="26792" CreationDate="2018-07-04T04:16:22.160" Score="1" Body="&lt;p&gt;In the super table array, there has to be a type there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;superTableHandle&quot; =&amp;gt; array:5 [&#xA;    0 =&amp;gt; array:3 [&#xA;      &quot;type&quot; =&amp;gt; 1//the field's id&#xA;      &quot;fields&quot; =&amp;gt; array:10 [&#xA;        &quot;relatedArticle&quot; =&amp;gt; 325051&#xA;        ...&#xA;      ]&#xA;    ]&#xA;    1 =&amp;gt; [...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For me, this id is 1. It can be found in database by running this SQL&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;select * from supertableblocktypes;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I ran the code below before and found out the field's id is 81 which is not working for me, I don't know why&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dd(Craft::$app-&amp;gt;fields-&amp;gt;getFieldByHandle('matrixHandle')-&amp;gt;blockTypeFields);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-07-04T04:16:22.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26794" PostTypeId="2" ParentId="26756" CreationDate="2018-07-04T04:53:44.567" Score="1" Body="&lt;p&gt;At the moment there is no multi-currency support built into Commerce. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning, all prices in the system are stored in a single currency. This includes products, shipping, taxes, sales, discounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We DO have a multi-currency payments feature that allows a customer to pay in another currency (so they are charged an expected amount and get no surprises with their banks own conversion ratio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue you are hitting above is that the price of the products is never converted. The items in the 'item bag' can only exist in the primary currency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to not send the item bag to the gateway and only have them charge the amount. You can do this with the setting: &lt;code&gt;sendCartInfoToGateways&lt;/code&gt; &lt;a href=&quot;https://craftcommerce.com/docs/configuration#sendcartinfotogateways&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/configuration#sendcartinfotogateways&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to try and get clever and convert the line items prices to the differing payment currency, the amount to be paid would work out to be different to the converted total, due to rounding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we move to full multi-currency support, this issue would go away since the line items would be converted first (along with discounts etc), and the total would be a sum of those amounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-07-04T04:53:44.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26795" PostTypeId="2" ParentId="26789" CreationDate="2018-07-04T05:17:15.270" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% amount = craft.entries&#xA;   .postDate(['and', '&amp;gt;=' someDate, '&amp;lt;=' ~ someOtherTime])&#xA;   .select('dollar')&#xA;   .relatedTo(category)&#xA;   .sum()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop through all years and sum the value &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-04T05:17:15.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26796" PostTypeId="2" ParentId="26791" CreationDate="2018-07-04T06:20:47.843" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% set date = (date()).modify('first day of january 00:00:00') %}&#xA;{% for month in 1..12 %}&#xA;    {% set endOfMonth = clone(date).modify('last day of this month') %}&#xA;        {% set exists= craft.entries&#xA;            .postDate(['and', '&amp;gt;=' ~ date.format('-.m-d H:i:s'), '&amp;lt;=' ~ endOfMonth.format('Y-m-d H:i:s') ])&#xA;            .exists()&#xA;        %}&#xA;&#xA;    {% do date.modify('first day of next month') %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;loop all months and check if there are entries in this month or not&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-04T06:20:47.843" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26797" PostTypeId="1" AcceptedAnswerId="26802" CreationDate="2018-07-04T07:42:42.023" Score="5" ViewCount="2443" Body="&lt;p&gt;How do I capture user events in Craft 3? I looked at the documentation but couldn't figure it out. I need to capture after user registration events and after user save events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I tried, I know it's not correct but I think I'm pretty close&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_AFTER_USER_SAVE,&#xA;    function (PluginEvent $event) {&#xA;        // do something&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5619" LastEditorUserId="57" LastEditDate="2018-07-04T20:56:03.733" LastActivityDate="2018-12-18T16:14:48.790" Title="User events in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;events&gt;&lt;usermodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26798" PostTypeId="1" CreationDate="2018-07-04T09:14:13.350" Score="5" ViewCount="475" Body="&lt;p&gt;How to achieve autocompletion for Craft 3 for PHP inside Visual Studio Code?&#xA;I mean, what is required (like installing PHP locally, folder structure etc.) if at all possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume many people who develop PHP are using PHPStorm for this. Also as I recall there are even instructions on how to get autocompletion for Craft 3 inside PHPStorm here: &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;.&#xA;As I'm trying to build some plugins I would prefer setting up an environment that works for me with autocompletion without having to look up everything and playing the guessing game. Out of preference I would like to use Visual Studio Code for this, so currently I'm somewhat stuck as I don't know if it is possible to get a similar kind of autocompletion like in PHPStorm inside Visual Studio Code for Craft 3 and also how to achieve it.&#xA;If someone could point me in a direction, I would be more than happy!&lt;/p&gt;&#xA;" OwnerUserId="5855" LastEditorUserId="5855" LastEditDate="2018-07-05T07:43:46.207" LastActivityDate="2018-07-05T07:43:46.207" Title="Autocomplete for Visual Studio Code for plugin development" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;php&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26801" PostTypeId="2" ParentId="26758" CreationDate="2018-07-04T18:38:09.153" Score="2" Body="&lt;p&gt;I found that making a slight modification to the comments.html made this work perfectly, the answer I found can be located here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/verbb/comments/blob/b05fd384bfbc9caed5f69df4dc72da991fef9c47/comments/templates/_forms/templates/comment.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/comments/blob/b05fd384bfbc9caed5f69df4dc72da991fef9c47/comments/templates/_forms/templates/comment.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2018-07-04T18:38:09.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26802" PostTypeId="2" ParentId="26797" CreationDate="2018-07-04T21:05:53.467" Score="11" Body="&lt;p&gt;There aren't specific User element save events in Craft 3, but you can listen to &lt;code&gt;EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt; and check if the element is a user like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(\craft\services\Elements::class, \craft\services\Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) {&#xA;    if ($event-&amp;gt;element instanceof \craft\elements\User) {&#xA;        // Do your thing.&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For user activation, there's &lt;code&gt;EVENT_AFTER_VERIFY_EMAIL&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(\craft\services\Users::class, \craft\services\Users::EVENT_AFTER_VERIFY_EMAIL, function(UserEvent $event) {&#xA;    $user = $event-&amp;gt;user&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-04T21:05:53.467" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26806" PostTypeId="1" CreationDate="2018-07-05T12:27:46.437" Score="2" ViewCount="606" Body="&lt;p&gt;In the example from the documentation on Craft 3 '&lt;strong&gt;Video Embedder&lt;/strong&gt;' plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}&#xA;&#xA;{% if embed | length %}&#xA;    &amp;lt;iframe src=&quot;{{ embed }}&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone please give me full (i.e. total beginner!) instructions on how to get the URL to load. &lt;/p&gt;&#xA;" OwnerUserId="5872" LastEditorDisplayName="user1080" LastEditDate="2019-02-01T09:18:09.857" LastActivityDate="2019-02-01T09:18:09.857" Title="Embedding video using Craft 3 'Video Embedder' plugin" Tags="&lt;plugins&gt;&lt;embed&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26807" PostTypeId="1" CreationDate="2018-07-05T12:27:52.343" Score="1" ViewCount="545" Body="&lt;p&gt;I have recently migrated a website to the live server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the craft/config/general.php my 'devMode' is set to false. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the backend of the website I am not seeing the yellow and black banner to say its in dev mode but on the frontend each meta title is starting with [devmode]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reece&lt;/p&gt;&#xA;" OwnerUserId="8530" LastActivityDate="2018-07-16T13:53:02.690" Title="'devMode' enabled on the frontend yet its set to false" Tags="&lt;devmode&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26809" PostTypeId="2" ParentId="26806" CreationDate="2018-07-05T13:49:01.930" Score="1" Body="&lt;p&gt;Worked it out - just needed to use the right syntax, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set embed = craft.videoEmbedder.getEmbedUrl(entry.videoEmbed) %}&#xA;&#xA;{% if embed | length %}&#xA;&amp;lt;div class=&quot;embed-responsive embed-responsive--mb-l embed-responsive-16by9&quot;&amp;gt;&amp;lt;iframe src=&quot;{{ embed }}&quot; width=&quot;100%&quot; height=&quot;600&quot; frameborder=&quot;0&quot; webkitallowfullscreen mozallowfullscreen allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2018-07-05T13:49:01.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26810" PostTypeId="2" ParentId="26807" CreationDate="2018-07-05T15:44:46.290" Score="1" Body="&lt;p&gt;Probably you are using SEOmatic; it has its own setting for the local environment you're using; check out this docs here: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic/tree/develop#plugin-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic/tree/develop#plugin-settings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-05T15:44:46.290" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26811" PostTypeId="1" AcceptedAnswerId="26824" CreationDate="2018-07-05T15:46:03.907" Score="2" ViewCount="160" Body="&lt;p&gt;I'm looking to have a Dynamic 'Reply To' for a notification when an entry is saved from a form submissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the below which is what the field is named in my form, but it seems it's not allowed? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{email}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tkgxu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tkgxu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="115" LastEditDate="2018-07-27T16:26:31.540" LastActivityDate="2019-02-21T13:32:15.767" Title="Using Dynamic values in the Reply To field in Sprout Forms Notifications" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26813" PostTypeId="1" AcceptedAnswerId="26815" CreationDate="2018-07-05T16:36:36.780" Score="2" ViewCount="293" Body="&lt;p&gt;In my plugin I am registering a callback for &lt;code&gt;Elements::EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt; event. Previously, in Craft2, I could access the URL of the saved entry from the &lt;code&gt;$event&lt;/code&gt; parameter passed into the callback, like so: &lt;code&gt;$event-&amp;gt;params['entry']-&amp;gt;getUrl()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I can't figure out how to get a reference to the entry in the Event model in Craft 3. If I &lt;code&gt;var_dump($event)&lt;/code&gt; I can see the data I want nested deep inside a private property which I cannot access. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I access the entry data from the event in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="2274" LastActivityDate="2018-07-07T16:48:24.193" Title="How to get an entry url from EVENT_AFTER_SAVE_ELEMENT callback?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26814" PostTypeId="1" CreationDate="2018-07-05T16:36:56.890" Score="1" ViewCount="418" Body="&lt;p&gt;I've been bumping into a field limit when attempting to mirgrate fields in, which is a massive limitation for the way the site was originally set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read a bunch of other threads where it's suggested changing the table to barracuda and dynamic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added this to the mysql conf:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;innodb_file_per_table=1&#xA;innodb_file_format = Barracuda&#xA;innodb_log_file_size = 512M&#xA;innodb_strict_mode = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I've ran &lt;code&gt;ALTER TABLE craftcms.craft_content ROW_FORMAT=DYNAMIC&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've confirmed that this has all been updated in &lt;code&gt;INNODB_SYS_TABLES&lt;/code&gt; and &lt;code&gt;GLOBAL_VARIABLES&lt;/code&gt; in the information_schema, but it doesn't seem to make any difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a test to see when I hit the limit, I've added a load of test plain text fields - the result is 219 custom fields:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;125 TEXT&lt;/li&gt;&#xA;&lt;li&gt;51 VARCHAR(255)&lt;/li&gt;&#xA;&lt;li&gt;37 TINYINT(1)&lt;/li&gt;&#xA;&lt;li&gt;4 VARCHAR(2000)&lt;/li&gt;&#xA;&lt;li&gt;1 TINYINT(2)&lt;/li&gt;&#xA;&lt;li&gt;1 DECIMAL(3,1)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I appreciate that refactoring some of the data structure is the way forward, but given that migrating the data won't be an easy task, I'd obviously prefer if there's some database solution to mitigate this issue quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3912" LastActivityDate="2018-07-05T16:36:56.890" Title="Cannot add more fields - SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large" Tags="&lt;database&gt;&lt;error&gt;&lt;limit&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26815" PostTypeId="2" ParentId="26813" CreationDate="2018-07-05T17:06:11.253" Score="3" Body="&lt;p&gt;Check out the definition of the &lt;code&gt;ElementEvent&lt;/code&gt; that you're passed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ElementEvent extends Event&#xA;{&#xA;    // Properties&#xA;    // =========================================================================&#xA;&#xA;    /**&#xA;     * @var ElementInterface|null The element model associated with the event.&#xA;     */&#xA;    public $element;&#xA;&#xA;    /**&#xA;     * @var bool Whether the element is brand new&#xA;     */&#xA;    public $isNew = false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can access the element (in your case, presumably an &lt;code&gt;Entry&lt;/code&gt;) via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;element&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure to check for &lt;code&gt;null&lt;/code&gt;, and depending on how you set up the event listener, that the element is of the type of you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you want only listen to &lt;code&gt;all&lt;/code&gt; elements that are saved, you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;        function (ElementEvent $event) {&#xA;            Craft::debug(&#xA;                'Elements::EVENT_AFTER_SAVE_ELEMENT',&#xA;                __METHOD__&#xA;            );&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but if you only care about &lt;code&gt;Entry&lt;/code&gt; elements, you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        Entry::class,&#xA;        Entry::EVENT_AFTER_SAVE,&#xA;        function (ModelEvent $event) {&#xA;            Craft::debug(&#xA;                'Entry::EVENT_AFTER_SAVE',&#xA;                __METHOD__&#xA;            );&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-07-07T16:48:24.193" LastActivityDate="2018-07-07T16:48:24.193" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26816" PostTypeId="1" AcceptedAnswerId="26817" CreationDate="2018-07-05T17:13:19.457" Score="1" ViewCount="20" Body="&lt;p&gt;I have a macro that can take up to six parameters which serve to populate nav links. The parameters are basically grouped into twos, with someone needing to pass in both a link and a title to make a nav link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my current code, which works as intended, but is not very DRY.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro mobileNav(navLink1, navTitle1, options={}) %}&#xA;&#xA;{% import _self as self %}&#xA;&#xA;  {% set options = {&#xA;    navLink2: null,&#xA;    navTitle2: null,&#xA;    navLink3: null,&#xA;    navTitle3: null,&#xA;    navClass: '',&#xA;    navItemClass: ''&#xA;&#xA;  }| merge(options) %}&#xA;&#xA;  &amp;lt;nav {% if options.navClass | length %}class=&quot;{{ options.navClass }}&quot;{% endif %}&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;&#xA;      {% if navLink1 | length %}&#xA;        &amp;lt;li {% if options.navItemClass | length %}class=&quot;{{ options.navItemClass }}&quot;{% endif %}&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ navLink1 }}&quot;&amp;gt;{{ navTitle1 }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {% if options.navLink2 | length %}&#xA;        &amp;lt;li {% if options.navItemClass | length %}class=&quot;{{ options.navItemClass }}&quot;{% endif %}&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ options.navLink2 }}&quot;&amp;gt;{{ options.navTitle2 }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;&#xA;      {% if options.navLink3 | length %}&#xA;        &amp;lt;li {% if options.navItemClass | length %}class=&quot;{{ options.navItemClass }}&quot;{% endif %}&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ options.navLink3 }}&quot;&amp;gt;{{ options.navTitle3 }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;  &amp;lt;/nav&amp;gt;&#xA;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to DRY it out and have one list element where the number associated with the parameter dynamically increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this (with the flexibility to an argument being passed via options as well):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% if navLink(a number between 1 &amp;amp; 3 that is passed in) | length %}&#xA;        &amp;lt;li {% if options.navItemClass | length %}class=&quot;{{ options.navItemClass }}&quot;{% endif %}&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ navLink(a number between 1 &amp;amp; 3 that is passed in) }}&quot;&amp;gt;{{ navTitle(a number between 1 &amp;amp; 3 that is passed in) }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;      {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I haven't been able to figure out how to make it work though. Any help would be appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2018-07-05T20:47:41.080" LastActivityDate="2018-07-05T20:48:18.940" Title="How to Update an If Rule Based on Different Parameters Passed to a Macro?" Tags="&lt;macro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26817" PostTypeId="2" ParentId="26816" CreationDate="2018-07-05T17:41:28.823" Score="2" Body="&lt;p&gt;Why don't you pass an array as a parameter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro mobileNav([&#xA;    {url: '/1', title: 'Foo'},&#xA;    {url: '/2', title: 'Bar'},&#xA;    {url: '/3', title: 'FooBar'},&#xA;], {} ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your macro..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in items %}&#xA;    {% if item.title is defined and item.title is not empty and item.url is defined and item.title is not empty %}&#xA;         // ... output something&#xA;         &amp;lt;a href=&quot;{{ item.url }}&quot;&amp;gt;{{ item.title }}&amp;lt;/a&amp;gt;&#xA;         {{ items|length &amp;lt;= 3? 'less than 4' : 'more than 3 are passed' }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-07-05T20:48:18.940" LastActivityDate="2018-07-05T20:48:18.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26818" PostTypeId="1" CreationDate="2018-07-05T22:56:17.253" Score="2" ViewCount="60" Body="&lt;p&gt;Database Exception: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'n2-cr_matrixcontent_column1_locale_fk'; check that column/key exists&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error I am receiving when attempting to update the database for the new version of craft. I've checked for that specific table and confirmed that it doesn't exist. How do I prevent it from trying to drop it or otherwise fix this problem?&lt;/p&gt;&#xA;" OwnerUserId="8561" LastActivityDate="2018-07-11T23:16:04.167" Title="Craft 2 -&gt; 3 Upgrade Error" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26819" PostTypeId="1" AcceptedAnswerId="26820" CreationDate="2018-07-06T00:08:47.030" Score="1" ViewCount="467" Body="&lt;p&gt;In the order template, this error shows up in the generated PDFs when adding standard JPG images.  We're running Commerce 1.2.x on PHP70.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could be related to this &lt;a href=&quot;https://github.com/dompdf/dompdf/issues/1118&quot; rel=&quot;nofollow noreferrer&quot;&gt;dompdf issue&lt;/a&gt;, but how do we fix it in Craft Commerce?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-07-06T02:16:46.317" Title="Commerce PDF error: Image not found or type unknown" Tags="&lt;plugin-craftcommerce&gt;&lt;image&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26820" PostTypeId="2" ParentId="26819" CreationDate="2018-07-06T02:16:46.317" Score="3" Body="&lt;p&gt;Try setting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'pdfAllowRemoteImages' =&amp;gt; true,&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in your commerce.php config file.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-07-06T02:16:46.317" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26821" PostTypeId="1" CreationDate="2018-07-06T06:12:17.963" Score="1" ViewCount="35" Body="&lt;p&gt;I'm trying to find using &lt;a href=&quot;https://docs.craftcms.com/v2/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft search&lt;/a&gt; &quot;bitly&quot; urls in body rich-text field in articles. It's for generation of list of popular articles.&#xA;So if query is a link (like &quot;&lt;a href=&quot;http://bit.ly/1eZFQMY&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://bit.ly/1eZFQMY&lt;/a&gt;&quot;) search doesn't find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried &quot;fuzzy&quot; search and all methods listed on &lt;a href=&quot;https://docs.craftcms.com/v2/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft search&lt;/a&gt; page.&lt;/p&gt;&#xA;" OwnerUserId="8563" LastActivityDate="2018-07-06T18:33:14.960" Title="Search for href parameter in rich text field" Tags="&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26822" PostTypeId="1" AcceptedAnswerId="26828" CreationDate="2018-07-06T09:34:44.060" Score="1" ViewCount="61" Body="&lt;p&gt;I have a field in a channel called &quot;weight&quot; where the user can set a number between 0-1000. On page load I want to generate a random number between 0 and &quot;weight&quot; for each entry, and then sort the entries based on these numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this with Craft 2/Twig?&lt;/p&gt;&#xA;" OwnerUserId="8564" LastEditorUserId="57" LastEditDate="2018-07-06T18:18:26.643" LastActivityDate="2018-07-06T18:18:26.643" Title="weighted random order" Tags="&lt;random&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26824" PostTypeId="2" ParentId="26811" CreationDate="2018-07-06T13:04:24.820" Score="3" Body="&lt;p&gt;Ran into the same issue, asked the support team, and they confirmed it's a bug. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Workaround is to comment out this line:&#xA;&lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-base/blob/v2/src/app/email/elements/NotificationEmail.php#L481&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-base/blob/v2/src/app/email/elements/NotificationEmail.php#L481&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried it and it works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They said it would be fixed in an upcoming release.&lt;/p&gt;&#xA;" OwnerUserId="8565" LastActivityDate="2018-07-06T13:04:24.820" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26825" PostTypeId="1" AcceptedAnswerId="26826" CreationDate="2018-07-06T16:12:52.550" Score="4" ViewCount="3918" Body="&lt;p&gt;I've been playing around with Craft 3.0 and am just about to develop a site using it. First thing I see when testing my frontpage template is &quot;Internal server error&quot;, styled as a Craft error box. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is simple, where is the log file for Craft 3.0? So I can see exactly what might be causing this?&lt;/p&gt;&#xA;" OwnerUserId="2162" LastEditorUserId="57" LastEditDate="2018-07-06T18:34:49.813" LastActivityDate="2018-07-06T18:34:49.813" Title="Craft CMS 3.0 - Log file?" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;logs&gt;&lt;logging&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26826" PostTypeId="2" ParentId="26825" CreationDate="2018-07-06T16:49:12.377" Score="4" Body="&lt;p&gt;Based on the &lt;a href=&quot;https://docs.craftcms.com/v3/directory-structure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;official documentation&lt;/a&gt; the log files are under &lt;code&gt;/storage/logs&lt;/code&gt; and look for the &lt;code&gt;web.log&lt;/code&gt; file especially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't find anything check your webserver logs.&lt;/p&gt;&#xA;" OwnerUserId="8566" LastActivityDate="2018-07-06T16:49:12.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26827" PostTypeId="2" ParentId="26825" CreationDate="2018-07-06T17:28:28.183" Score="2" Body="&lt;p&gt;If you want to view the logs in the control panel in Craft 3, like was possible in Craft 2, then you will need to use this plugin: &lt;a href=&quot;https://github.com/ethercreative/logs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Logs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="179" LastActivityDate="2018-07-06T17:28:28.183" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26828" PostTypeId="2" ParentId="26822" CreationDate="2018-07-06T18:17:33.120" Score="1" Body="&lt;p&gt;Would be a lot cleaner/more efficient to do this from a custom plugin in PHP, but if you want to do it from a template, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryArr = {} %}&#xA;&#xA;{# Grab all of the entries in the section #}&#xA;{% set entries = craft.entries.section('news').find() %}&#xA;&#xA;{# Loop through them generating a random number between 0 and the weight custom field #}&#xA;{% for entry in entries %}&#xA;    {% set entryArr = entryArr|merge({(entry.slug): random(range(0, entry.weight))}) %}&#xA;{% endfor %}&#xA;&#xA;{# Sort the array by the ascending value maintaining the keys #}&#xA;{% set entryArr = entryArr|sort %}&#xA;&#xA;{# print them off #}&#xA;&amp;lt;ul&amp;gt;&#xA;{% for slug, randomNumber in entryArr %}&#xA;    {% set entry = craft.entries.slug(slug).first() %}&#xA;    &amp;lt;li&amp;gt;{{ entry.title }} - Max Range: {{ entry.randomNumber }} - Random Number: {{ randomNumber }}&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-06T18:17:33.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26829" PostTypeId="2" ParentId="26821" CreationDate="2018-07-06T18:33:14.960" Score="1" Body="&lt;p&gt;Before Craft saves any keywords in the &lt;code&gt;craft_searchindex&lt;/code&gt; table in the database, that content goes through a normalization process, including things like removing punctuation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the link &quot;&lt;a href=&quot;http://bit.ly/1eZFQMY&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://bit.ly/1eZFQMY&lt;/a&gt;&quot; will actually get normalized to &lt;code&gt;http bit ly 1ezfqmy&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really wanted to find all entries with bitly URLs in them, then using &lt;code&gt;&quot;http bit ly&quot;&lt;/code&gt; should work.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-06T18:33:14.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26830" PostTypeId="1" CreationDate="2018-07-07T09:23:42.347" Score="1" ViewCount="118" Body="&lt;p&gt;Hi has anyone come across this before. It seems like a hack attempt on the site from a bot trying to access it as a wordpress site. This is obviously causing loads of errors in the log files bloating them and making it hard to find any real logs. Is there anything we can do in craft or on the server to block these attempts?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastActivityDate="2018-07-08T21:42:27.307" Title="wp-login.php bloating log files every 20-30 seconds" Tags="&lt;logs&gt;&lt;logging&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26831" PostTypeId="1" CreationDate="2018-07-07T12:24:44.170" Score="1" ViewCount="42" Body="&lt;p&gt;I’m working on implementing this plugin: &lt;a href=&quot;https://github.com/aelvan/mailchimp-subscribe-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/mailchimp-subscribe-craft&lt;/a&gt;&#xA;I’m wondering: How can I accomplish to test if an address is on the list before it gets added? And on top of that return different results: you’ve already subscribed/you were added to the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;That's my current status&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if mailchimpSubscribe is defined %}&#xA;    {% if (not mailchimpSubscribe.success) and (mailchimpSubscribe.errorCode) %}&#xA;        {# display error message #}&#xA;    {% elseif craft.mailchimpSubscribe.checkIfSubscribed(mailchimpSubscribe.values.email, 'list-ID') %}&#xA;        {# display that the address is already added #}&#xA;    {% elseif (mailchimpSubscribe.success) %}&#xA;        {# display success message #}&#xA;    {% endif %}&#xA;{% else %}&#xA;    {# display default form #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Logically there can only be an error or already added output and no simple success because of if the form gets submitted the address is already submitted when the page reloads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question: &lt;strong&gt;How can I accomplish to test if an address is on the list before it gets added?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7146" LastEditorUserId="7146" LastEditDate="2018-07-09T17:01:57.463" LastActivityDate="2018-07-09T17:01:57.463" Title="How to test if a address is on a list before it gets added? (MailChimp Subscribe Plugin)" Tags="&lt;templating&gt;&lt;plugin-mailchimpsubscribe&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26832" PostTypeId="1" AcceptedAnswerId="26835" CreationDate="2018-07-07T14:36:39.437" Score="1" ViewCount="353" Body="&lt;p&gt;I'm getting a deprecation error from not using &lt;code&gt;.all()&lt;/code&gt; to query my elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is usually very easy to fix because Craft normally tells you which template and line to add the &lt;code&gt;.all()&lt;/code&gt; to.  However, when looking at the origin, I see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/Users/Me/Sites/Project/vendor/twig/twig/lib/Twig/Extension/Core.php:577&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is pointing to something in Twig's vendor library, which I obviously don't want to fix for updating reasons.  Does anyone know what this is referring to in my templates?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="57" LastEditDate="2018-07-08T23:25:12.870" LastActivityDate="2018-07-08T23:25:12.870" Title="Craft 3 Deprecation Error from Twig/Extension/Core.php. How to fix?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26833" PostTypeId="1" CreationDate="2018-07-07T16:19:54.377" Score="1" ViewCount="67" Body="&lt;p&gt;I'm using the Craft &lt;code&gt;group&lt;/code&gt; filter to group events by day:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set week = craft.calendar.events({&#xA;  dateRangeStart: 'today',&#xA;  dateRangeEnd: '3 days'&#xA;}) %}&#xA;&#xA;{% set weekByDay = week|group('startDate|date(&quot;l&quot;)') %}&#xA;&#xA;{% for day, eventsInDay in weekByDay %}&#xA;&#xA;  &amp;lt;h1&amp;gt;{{ day }}&amp;lt;/h1&amp;gt;&#xA;&#xA;  {% for event in eventsInDay %}&#xA;    &amp;lt;h2&amp;gt;{{ event.title }}&amp;lt;/h2&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I go about including events that are happening - but not necessarily starting - during each day? &lt;/p&gt;&#xA;" OwnerUserId="576" LastActivityDate="2018-07-07T16:19:54.377" Title="Group by weekday and ongoing in Solspace Calendar" Tags="&lt;plugin-solspacecalendar&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26834" PostTypeId="2" ParentId="26830" CreationDate="2018-07-07T16:51:40.593" Score="3" Body="&lt;p&gt;So what I do is I just redirect anything requesting a WordPress-ish thing to WordPress.com (that's what they are looking for, after all...). You can see how to do that here if you're using Nginx:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L67&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L67&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-07T16:51:40.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26835" PostTypeId="2" ParentId="26832" CreationDate="2018-07-07T19:50:44.937" Score="2" Body="&lt;p&gt;I figured out the issue.  I was trying to get a single image from a matrix block by &lt;code&gt;block.image|first&lt;/code&gt; instead of &lt;code&gt;block.image.one()&lt;/code&gt;. The code was in a macro that was used on several templates so those templates got this error.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-07-07T19:50:44.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26836" PostTypeId="1" CreationDate="2018-07-08T12:28:04.613" Score="1" ViewCount="52" Body="&lt;ul&gt;&#xA;&lt;li&gt;I have a Matrix with an entry field.&lt;/li&gt;&#xA;&lt;li&gt;I have a Loop which is looping entries out of a section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Goal: The entries from the matrix should not appear in the loop of the section.  So the Matrix defines Starred Member Profiles and the loop trough the section is a teamlist, but the two starred profiles should not appear in there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried something like this but i stuck right now... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the profiles which are in the matrix #}&#xA;{% set highlightProfiles = entry.highlightProfiles.all() %}&#xA;&#xA;{% for profile in highlightProfiles %}&#xA;&#xA; {# Just a test to see the ID of each single entry #}&#xA; {{ profile.hightlightProfileTeaser.one().id() }} &#xA;&#xA; {% set highlightProfileSingleIds = profile.hightlightProfileTeaser.all().ids() %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# set something up for the entry ids which should not join in the endloop #}&#xA;{% set highlightProfileIdsString = highlightProfileSingleIds | join(', not ') %}&#xA;&#xA;{% set teamMembers = craft.entries({&#xA; section: 'profiles',&#xA; limit: 50 &#xA;}) %}&#xA;&#xA;{% set allProfilesWithOutHighlights = teamMembers.id('and, not '~highlightProfileIdsString).orderBy('title asc') %}&#xA;{% for member in allOtherMembers.orderBy('title asc').all()  %}&#xA; {{ member.title }} {{ member.id() }} {{ loop.index }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5847" LastActivityDate="2018-07-08T12:41:52.790" Title="Entries from matrix should not appear in loop" Tags="&lt;matrix&gt;&lt;entry&gt;&lt;loop&gt;&lt;join&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26837" PostTypeId="2" ParentId="26836" CreationDate="2018-07-08T12:41:52.790" Score="3" Body="&lt;p&gt;You are on the right track, to “collect” the entry IDs you have to use the &lt;code&gt;merge&lt;/code&gt; filter in your Matrix loop though.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set highlightProfileSingleIds = [] %}&#xA;&#xA;{% for profile in highlightProfiles %}&#xA;    {% set ids = profile.hightlightProfileTeaser.ids() %}&#xA;    {% set highlightProfileSingleIds = highlightProfileSingleIds|merge(ids) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-07-08T12:41:52.790" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26838" PostTypeId="2" ParentId="26830" CreationDate="2018-07-08T21:18:29.100" Score="1" Body="&lt;p&gt;We've done the redirect route in &lt;a href=&quot;https://craftcms.stackexchange.com/a/26834/1016&quot;&gt;Andrew's answer&lt;/a&gt; before and while it keeps some script kiddies out, it can also cause less &quot;savvy&quot; ones to think you actually have a valid WP installation and continue to hit you as well, which doesn't really solve the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nginx is so efficient that we were using a few MBps in our outgoing bandwidth just to redirect a couple offenders before I realized what was hitting our server so hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best option is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Detect the attempt / 404 it&lt;/li&gt;&#xA;&lt;li&gt;Block it at the firewall level after they don't get the hint.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While we use nginx, you can also do some of this on apache. Use:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.nginx.com/blog/rate-limiting-nginx/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rate limiting&lt;/a&gt;. Excessive bots will get detected pretty quickly here.&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;a href=&quot;https://easyengine.io/tutorials/nginx/fail2ban/&quot; rel=&quot;nofollow noreferrer&quot;&gt;fail2ban&lt;/a&gt; to subsequently block those repeated attempts. &lt;/li&gt;&#xA;&lt;li&gt;When you create a &lt;code&gt;location&lt;/code&gt; block in nginx, just tell it to &lt;a href=&quot;https://docs.nginx.com/nginx/admin-guide/monitoring/logging/&quot; rel=&quot;nofollow noreferrer&quot;&gt;log&lt;/a&gt; this sort of junk in another file. Then point fail2ban at that log file. This approach works great especially if you have multiple virtual hosts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Going down the rabbit hole even more, &lt;a href=&quot;https://www.modsecurity.org/about.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ModSecurity&lt;/a&gt; is a super complex beast and not for the faint of heart, but it's common among the big hosting providers to help keep the &quot;riff raff&quot; out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://guides.wp-bullet.com/block-wp-login-brute-force-attacks-with-cloudflare-page-rule/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CloudFlare&lt;/a&gt;, &lt;a href=&quot;https://www.stackpath.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;StackPath&lt;/a&gt; and &lt;a href=&quot;https://www.incapsula.com/pricing-and-plans.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inscapsula&lt;/a&gt; can also help in this aspect with their web application firewalls if you're willing to let them handle your DNS. These services handle the request before it even gets to your server.&lt;/p&gt;&#xA;" OwnerUserId="1016" LastEditorUserId="1016" LastEditDate="2018-07-08T21:42:27.307" LastActivityDate="2018-07-08T21:42:27.307" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26839" PostTypeId="1" CreationDate="2018-07-09T03:09:41.267" Score="0" ViewCount="41" Body="&lt;p&gt;Has anyone made it possible to edit entries directly in the admin area (i.e. /admin/entries/{section}) without having to go into each individual entry?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've built a voucher system that the users need to quickly be able to tick off a number of vouchers as i.e. a family comes in - not having to open five voucher entries and tick off one at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jQcAT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jQcAT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having a light switch field where this &quot;Voucher Status&quot; field is would be perfect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not possible, even adding a button that I could trigger an ajax action on would be fine - I'm just not sure how to go about that either. I haven't tried to customise the admin area of Craft before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-07-09T03:09:41.267" Title="Editing Entries In-line In Admin Area" Tags="&lt;admin&gt;&lt;custom&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26840" PostTypeId="1" AcceptedAnswerId="26841" CreationDate="2018-07-09T05:46:20.013" Score="0" ViewCount="546" Body="&lt;p&gt;I have a search results page set up like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchResults = craft.entries(queryParams) %}&#xA;{% paginate searchResults as pageInfo, pageEntries %}&#xA;&#xA;{% if pageEntries|length %}&#xA;  {% for yacht in pageEntries %}&#xA;    {% set prevEntry = item.prev %}&#xA;    {% set nextEntry = item.next %}&#xA;    &amp;lt;a href=&quot;{{ item.url }}&#xA;    {% if nextEntry or prevEntry %}?{%endif%}&#xA;    {% if nextEntry %}next={{nextEntry}}{%endif%}&#xA;    {% if prevEntry and nextEntry %}&amp;amp;{% endif %}&#xA;    {% if prevEntry %}prev={{prevEntry}}{%endif%}&quot;&#xA;    &amp;gt;Link&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works fine except that it outputs the entry title of the next and previous entries. If I do &lt;code&gt;nextEntry.url&lt;/code&gt; or &lt;code&gt;prevEntry.url&lt;/code&gt; (or &lt;code&gt;slug&lt;/code&gt;) I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;url&quot;) on a null variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is that?&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2018-07-09T05:53:25.330" Title="Impossible to access an attribute (&quot;url&quot;) on a null variable in search results" Tags="&lt;elementcriteriamodel&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26841" PostTypeId="2" ParentId="26840" CreationDate="2018-07-09T05:53:25.330" Score="1" Body="&lt;p&gt;You should check if there is a next and previous element. Most likely you reach the end or the beginning of your list and there is no element thus these variables are null so you receive an exception when you try to grab attributes from &lt;code&gt;null&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-09T05:53:25.330" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26843" PostTypeId="2" ParentId="26667" CreationDate="2018-07-09T14:28:37.517" Score="1" Body="&lt;p&gt;A &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/reports/custom-data-sources.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Custom Data Source&lt;/a&gt; does not require any settings. If desired, you could create a Data Source that only had a title and did whatever logic and queries that you wanted behind the scenes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2, &lt;code&gt;getOptionsHtml&lt;/code&gt; returns null by default and shouldn't need to be set to anything in your Custom Data Source if that is desired:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getOptionsHtml()&#xA;{&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3, the default is to not display any settings also:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-09T14:28:37.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26844" PostTypeId="1" CreationDate="2018-07-09T15:17:20.637" Score="1" ViewCount="155" Body="&lt;p&gt;I am using Craft 3 with the default Craft 3 user registration form. Whenever I register I get an empty email. If I go to the cms and manually click on 'send activation email' I get a correct activation email like it should be. What could be causing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no errors in the error logs, the test mail is working just fine, all the other emails like the forgot password email is also working fine.&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2018-07-09T15:17:20.637" Title="User Registration Form: Empty Email" Tags="&lt;craft3&gt;&lt;emails&gt;&lt;user-profile&gt;&lt;registration&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26846" PostTypeId="1" CreationDate="2018-07-10T10:04:33.110" Score="1" ViewCount="375" Body="&lt;p&gt;I can retrieve only the image title from the below code, I can't see why the image URL is showing as empty? its a global handle 'brand' and asset field 'logo':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = brand.logo.one %}&#xA;&#xA;&amp;lt;a href=&quot;/&quot;&amp;gt;&#xA;    &amp;lt;img class=&quot;logo&quot; src=&quot;{{ image.getUrl() }} alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;&amp;lt;/a&amp;gt;    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="57" LastEditDate="2018-07-10T17:58:31.867" LastActivityDate="2021-01-21T15:21:27.347" Title="Getting image url from globals asset field" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26847" PostTypeId="2" ParentId="26846" CreationDate="2018-07-10T10:30:44.533" Score="2" Body="&lt;p&gt;Thanks to Andrew Fairlie for pointing out I need to make sure Assets in this volume have public URLs set&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2018-07-10T10:30:44.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26849" PostTypeId="1" AcceptedAnswerId="26874" CreationDate="2018-07-10T19:01:35.023" Score="2" ViewCount="559" Body="&lt;p&gt;I'm a UX designer with some front end skills (though a complete novice with server config and Craft). I'm hoping someone can help me with something that seems rather basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt; &#xA;Mac Book Pro running High Sierra (10.13.5).&#xA;Using MAMP 4.4.1 (free version)&#xA;PHP 7.2.1, MySQL, and Craft 3.&#xA;The site loads in a browser when I visit: &lt;a href=&quot;http://localhost:8888/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My craft files are here: Macintosh HD/Applications/MAMP/htdocs/.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template file in question is here: Macintosh HD/Applications/MAMP/htdocs/templates/_layouts/base.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the base.html file, in the head section, I am attempting to link to several CSS files. Here's the entire head section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;&#xA;    {% block head %}&#xA;      &amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;&#xA;      &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;      &amp;lt;title&amp;gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&amp;lt;/title&amp;gt;&#xA;      &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&amp;gt;&#xA;      {% css %}&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ siteUrl }}src/css/typeplate.css&quot;&amp;gt;&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ siteUrl }}src/css/grid.css&quot;&amp;gt;&#xA;        &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{{ siteUrl }}src/css/screen.css&quot;&amp;gt;&#xA;      {% endcss %}&#xA;    {% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The CSS files in question are here: Macintosh HD/Applications/MAMP/htdocs/src/css.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Problem:&lt;/strong&gt;&#xA;When I load the home page, the CSS does not load. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things I've Tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've tried removing the siteURL bit, and just hardcoding things&#xA;instead (like this: &lt;a href=&quot;http://localhost/src/css/typeplate.css&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/src/css/typeplate.css&lt;/a&gt;), and I&#xA;get 404 errors for the 3 css files under the network tab in Chrome developer tools.&lt;/li&gt;&#xA;&lt;li&gt;I've tried removing the {% css } brackets around the stylesheet links, and the network tab in Chrome dev tools just tells me &quot;failed&quot; when the links are hard coded. When the links have {{ siteUrl}} in them, I can see the browser looking for the files at www.mywebsite.com/src/css/typeplate.css. But the files aren't currently there - this is a local dev site only.&lt;/li&gt;&#xA;&lt;li&gt;I've tried changing the dev siteUrl in general.php from &quot;null&quot; to&#xA;&quot;&lt;a href=&quot;http://localhost/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/&lt;/a&gt;&quot;, and the web page stops loading altogether.&lt;/li&gt;&#xA;&lt;li&gt;I've tried different hard coded URL's, like&#xA;(../src/css/typeplate.css).&lt;/li&gt;&#xA;&lt;li&gt;I've searched StackExchange for similar problems, but I can't seem to make sense of any of the answers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? Thank you so much in advance.&lt;/p&gt;&#xA;" OwnerUserId="8562" LastActivityDate="2018-07-13T02:31:59.210" Title="CSS will not load Craft 3 + MAMP" Tags="&lt;craft3&gt;&lt;css&gt;&lt;mamp&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26851" PostTypeId="1" CreationDate="2018-07-11T10:30:25.933" Score="2" ViewCount="124" Body="&lt;p&gt;This code for linking to a category page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;href=&quot;/products/?category={{ category.slug }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Generates this URL:  &lt;code&gt;www.website.com/products/?category=category-name&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please tell me how to code links in menus (etc) that will produce URLs without the &lt;code&gt;?category=&lt;/code&gt; string being included in the URL.  So that the URL would become: &lt;code&gt;www.website.com/products/category-name&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for your help - it is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastEditorUserId="57" LastEditDate="2018-07-11T23:10:00.150" LastActivityDate="2018-07-12T08:48:42.037" Title="How to create clean URLs for category strings?" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26852" PostTypeId="1" AcceptedAnswerId="26857" CreationDate="2018-07-11T11:03:19.147" Score="1" ViewCount="62" Body="&lt;p&gt;I would like to build a send activation email form on front-end, for users who didn't get or accidentaly delete the activation email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can call the &lt;code&gt;users/send-activation-email&lt;/code&gt; action to achieve this, but this action only accept a &lt;code&gt;userId&lt;/code&gt; as parameter, not the &lt;code&gt;email&lt;/code&gt; address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I can't load unverified users from the front-end, it seems that I can't get the &lt;code&gt;id&lt;/code&gt; of the current unverified user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could write a plugin for this, but I was wondering if there's any way to achieve this without?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of non-working send activation email form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/send-activation-email&quot;&amp;gt;&#xA;    {{ redirectInput('') }}&#xA;    &amp;lt;input type=&quot;email&quot; name=&quot;email&quot; required&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-07-11T15:34:12.467" Title="How can I get the id of an unverified user on front-end?" Tags="&lt;craft3&gt;&lt;users&gt;&lt;activation&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26853" PostTypeId="2" ParentId="26851" CreationDate="2018-07-11T13:01:39.773" Score="2" Body="&lt;p&gt;First thing you'll need to do is set up a route that ensures anything for /products/category-name gets routed to the correct template. You can do this from the control panel or via &lt;code&gt;craft/config/routes.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do this in your routes.php file you'd need something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    'products/(.*?)' =&amp;gt; 'products/index',&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is telling Craft that for any url that contains &lt;code&gt;products/any-characters&lt;/code&gt; it should use the &lt;code&gt;products/index&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, on that template, grab the segment that is the category slug&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catSegment = craft.request.segment(2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll then need to get the category that has that slug&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.categories.slug(catSegment).first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You then have a category model you can work with and can use a craft entries tag with a category criteria using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.entries.relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Loop through &lt;code&gt;products&lt;/code&gt; to output your products.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-07-12T08:48:42.037" LastActivityDate="2018-07-12T08:48:42.037" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="26854" PostTypeId="1" CreationDate="2018-07-11T13:48:26.850" Score="1" ViewCount="131" Body="&lt;p&gt;This is the scenario: I need the translations strings in both Twig and JS (For React). Of course I'm covered in the &lt;a href=&quot;https://craftcms.com/support/static-translations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig part.&lt;/a&gt;, and I don't want to maintain two different files (php and json). So I've created a custom module, where I can read the files, like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getTranslations($language, $translationsFileName = 'site')&#xA;{&#xA;    if (file_exists(CRAFT_BASE_PATH . '/translations/' . $language . '/' . $translationsFileName . '.php')) {&#xA;        return require_once(CRAFT_BASE_PATH . '/translations/' . $language . '/' . $translationsFileName . '.php');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.translations.getTranslations(craft.locale) | json_encode | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works, but, is this a good way? Is there a default Craft/Yii way?&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-07-11T13:48:26.850" Title="Access array from the static translation file" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26855" PostTypeId="1" AcceptedAnswerId="26856" CreationDate="2018-07-11T14:23:55.403" Score="1" ViewCount="475" Body="&lt;p&gt;This is a followup question to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20381/plugin-settings-per-site-locale/20382&quot;&gt;this question&lt;/a&gt; which asked about the possibility of per-site plugin config for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a plugin author and have had a feature request for allowing my plugin to have different settings based on the current site. Looking at the above question, it sounds like this used to be possible in Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'flagName' =&amp;gt; [&#xA;        'de' =&amp;gt; 'Bundesflagge',&#xA;        'fr' =&amp;gt; 'Tricolore',&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't work in Craft 3, alas (throws an error). I could write something into my plugin's admin area to loop through known sites and output config per-site but this seems like something Craft should be able to do out-of-the-box (especially given the above method used to be valid). Does anyone know if there's a good way to do this in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2019-12-09T12:46:05.967" Title="Plugin settings per site / locale (Craft 3)" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26856" PostTypeId="2" ParentId="26855" CreationDate="2018-07-11T15:14:05.517" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/2028&quot; rel=&quot;nofollow noreferrer&quot;&gt;There is no native support for this&lt;/a&gt;, you can follow my approach and create a custom table for it to store the settings for each site&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way is to return a different array depending on the current site in your config file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(Craft::$app-&amp;gt;getSites()-&amp;gt;getCurrentSite()-&amp;gt;handle === X){&#xA;    return ['flagName' =&amp;gt; 'Tricolore'];&#xA;} else {&#xA;    return ['flagName' =&amp;gt; 'Bundesflagge'];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$array = [&#xA;    'de' =&amp;gt; [&#xA;        'flagName' =&amp;gt; 'Bundesflagge'&#xA;    ],&#xA;    'fr' =&amp;gt; [&#xA;        'flagName' =&amp;gt; 'Tricolore'&#xA;    ]&#xA;];&#xA;&#xA;return $array[Craft::$app-&amp;gt;getSites()-&amp;gt;getCurrentSite()-&amp;gt;handle];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-07-11T15:31:05.187" LastActivityDate="2018-07-11T15:31:05.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26857" PostTypeId="2" ParentId="26852" CreationDate="2018-07-11T15:34:12.467" Score="2" Body="&lt;p&gt;You can get the user by email&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users.status(null).email(&quot;a@b.de&quot;).one() %}&#xA;{{ user.id?? 'no user found' }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-11T15:34:12.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26858" PostTypeId="2" ParentId="26806" CreationDate="2018-07-11T15:37:49.610" Score="1" Body="&lt;p&gt;Unfortunately, it has causes a big PHP error if 'empty'...If you don’t have any content (i.e. it’s an optional field for someone to add a video embed to the page and the user chooses not to embed a video) it triggers a big PHP error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Embed\Exceptions\InvalidUrlException&#xA;&#xA;&amp;lt;url&amp;gt; malformed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2018-07-11T15:37:49.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26860" PostTypeId="1" CreationDate="2018-07-11T16:00:54.540" Score="2" ViewCount="720" Body="&lt;p&gt;I am running Freeform 1.9.0 and I have a small plugin that is supposed to save user submission id's to a custom user field. The plugin returns error when it runs after a new user submits a form though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the error&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Call to a member function getContent() on null&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is the code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on(&#xA;        &quot;freeform_submissions.onAfterSave&quot;,&#xA;        function (Event $event) {&#xA;            $submission = $event-&amp;gt;params[&quot;model&quot;];&#xA;            $isNew    = $event-&amp;gt;params[&quot;isNew&quot;];&#xA;&#xA;            $submissionId = $submission-&amp;gt;id;&#xA;&#xA;            $user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;&#xA;            $user-&amp;gt;getContent()-&amp;gt;submissionID = $submission-&amp;gt;getId();&#xA;            $success = craft()-&amp;gt;users-&amp;gt;saveUser($user);&#xA;&#xA;            if (!craft()-&amp;gt;users-&amp;gt;saveUser($user))&#xA;            {&#xA;                $errors = $user-&amp;gt;getErrors();&#xA;            }&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8580" LastActivityDate="2018-07-11T18:33:04.070" Title="Q: Call to member function on null - Freeform (Solspace)" Tags="&lt;php&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26861" PostTypeId="2" ParentId="26818" CreationDate="2018-07-11T16:01:40.080" Score="1" Body="&lt;p&gt;For reference to anyone else that might have this problem. Some of the tables in my database did not have foreign keys in the specific Craft format. This occurred when table changes were done manually without knowing about this extra detail.&#xA;Shout out to Brad Bell with Craft support for catching and fixing the problem.&lt;/p&gt;&#xA;" OwnerUserId="8561" LastEditorUserId="57" LastEditDate="2018-07-11T23:16:04.167" LastActivityDate="2018-07-11T23:16:04.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26862" PostTypeId="2" ParentId="26860" CreationDate="2018-07-11T18:33:04.070" Score="1" Body="&lt;p&gt;Please read the article &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;handling errors gracefully in Craft &lt;/a&gt; it will explain to code defensively and what to do in those scenarios. Your &lt;code&gt;$user&lt;/code&gt; variable is &lt;code&gt;null&lt;/code&gt; and you can't execute functions on &lt;code&gt;null&lt;/code&gt; variables &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-11T18:33:04.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26863" PostTypeId="1" CreationDate="2018-07-12T05:09:34.420" Score="3" ViewCount="209" Body="&lt;p&gt;In the Control Panel, when users are selecting an image for the asset field, the thumbnails are too small in the popping up image modal. Is there any way to make the images bigger?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lfvEQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lfvEQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-07-16T04:57:13.127" Title="In the CP, How to make images bigger when the users select images?" Tags="&lt;plugin-development&gt;&lt;control-panel&gt;&lt;cp-dashboard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26864" PostTypeId="2" ParentId="26863" CreationDate="2018-07-12T05:43:13.533" Score="2" Body="&lt;p&gt;You can change the view at the top right corner&#xA;There is also a setting in your asset fields what the default view should be &#xA;&lt;a href=&quot;https://i.stack.imgur.com/0JuSs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0JuSs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-07-12T07:14:23.823" LastActivityDate="2018-07-12T07:14:23.823" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26865" PostTypeId="1" AcceptedAnswerId="26869" CreationDate="2018-07-12T07:10:57.507" Score="1" ViewCount="155" Body="&lt;p&gt;I updated a Craft 2.6 installation to the latest 2.6.x and suddenly I get an error when saving a user's profile on the frond end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mb_detect_encoding() expects parameter 1 to be string, array given&#xA;/data/sites/web/boumaticdevbuthostcom/subsites/corporate-web.boumatic.dev.buthost.com/craft/app/vendor/elvanto/litemoji/src/LitEmoji.php(108)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, nowhere on that page has an emoji been inserted in any input fields or anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope somebody can help me with this as it is an urgent issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just tracked down the problem to this input field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[gdprPermissionsList][permissionSales][type]&quot; value=&quot;permissionInfo&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is quite weird as it does the exact same thing as 3 other fields on that page which work fine.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2018-07-12T11:14:38.653" LastActivityDate="2018-07-12T11:15:27.820" Title="Emoji mb_detect_encoding() error when updating to latest Craft 2.6.x" Tags="&lt;error&gt;&lt;bug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26866" PostTypeId="1" CreationDate="2018-07-12T10:09:36.963" Score="2" ViewCount="1053" Body="&lt;p&gt;I would like to detect if a header in the current request is present and obtain its value, directly within a Twig template. &#xA;I know that &lt;code&gt;craft.app.request&lt;/code&gt; gives access to a few variables like &lt;code&gt;isAjax&lt;/code&gt; that directly check the headers content, but I haven't found a method to directly retrieve a specific header.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this be achieved in some way? (preferably not by writing a plugin)&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2018-07-12T17:46:01.490" Title="From a Twig template, how to retrieve the content of a HTTP header in the current request?" Tags="&lt;craft3&gt;&lt;request&gt;&lt;https&gt;&lt;headers&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26867" PostTypeId="1" AcceptedAnswerId="26870" CreationDate="2018-07-12T11:02:15.947" Score="1" ViewCount="311" Body="&lt;p&gt;I have a simple Craft 3 website, with products that are organised in categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please tell me how to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the the individual product pages (_entry.html) display a 'breadcrumb' menu that includes the parent category name/url (I've followed the few examples posted here - they don't work).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also be able to simply display the name of the parent category of the product in text (e.g. to use as part of the h1 title for the product page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for your help - it is very much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2018-07-12T19:42:40.250" Title="How to display the parent category on an entry page?" Tags="&lt;category&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26868" PostTypeId="1" CreationDate="2018-07-12T11:14:04.400" Score="0" ViewCount="119" Body="&lt;p&gt;Is it still possible to install all of Craft 3 in a public folder? Like you could with Craft 2. If it is, how do I do it?&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2018-07-12T11:14:04.400" Title="Install Craft 3 in public folder" Tags="&lt;install&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26869" PostTypeId="2" ParentId="26865" CreationDate="2018-07-12T11:15:27.820" Score="1" Body="&lt;p&gt;Solved it. The problem was with this field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[gdprPermissionsList][permissionSales][fields][lastChangedDate][date]&quot; value=&quot;{{ now|date(&quot;m/d/Y&quot;) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;[date]&lt;/code&gt; part was to much and it saved the value in Craft as a literal string: &lt;code&gt;{&quot;date&quot;:&quot;07\/11\/2018&quot;}&lt;/code&gt; instead of the formatted date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one of the Craft updates that throws an error, maybe because it ses it as an object/array due to the curly brackets or maybe because that string has an emoji shortcut in it?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-07-12T11:15:27.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26870" PostTypeId="2" ParentId="26867" CreationDate="2018-07-12T11:55:05.370" Score="1" Body="&lt;p&gt;Assuming your categories are accessible from a Categories field called 'productCategory', and you only have 1 category assigned to each product, you can display the name of the parent category with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.productCategory.one() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can loop through multiple Categories with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in entry.productCategory.all() %}&#xA;    {{ category.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And to get the category link for your breadcrumb, you could use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.productCategory.one().slug }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="7356" LastEditDate="2018-07-12T19:42:40.250" LastActivityDate="2018-07-12T19:42:40.250" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26871" PostTypeId="2" ParentId="26866" CreationDate="2018-07-12T12:36:59.953" Score="3" Body="&lt;p&gt;By checking the code, I could find a method named &lt;code&gt;getHeaders()&lt;/code&gt; that will return all the headers of the current request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to retrieve the content of the &lt;code&gt;foo&lt;/code&gt; header, just use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set headers = craft.app.request.getHeaders() %}&#xA;{% set fooHeader = headers['foo'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3570" LastEditorUserId="57" LastEditDate="2018-07-12T17:46:01.490" LastActivityDate="2018-07-12T17:46:01.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26873" PostTypeId="1" AcceptedAnswerId="26919" CreationDate="2018-07-12T21:19:04.007" Score="2" ViewCount="311" Body="&lt;p&gt;Following &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16218/sprout-forms-how-to-link-to-individual-entries-on-the-front-end&quot;&gt;Sprout Forms -- How to link to individual entries on the front-end&lt;/a&gt; I found code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set formEntryId = craft.request.getSegment(2) %}&#xA;{% set entry = craft.sproutForms.getEntryById(formEntryId) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it doesn't have any field data. Including &lt;code&gt;{{ dump(entry) }}&lt;/code&gt; in my template shows &lt;code&gt;object(barrelstrength\sproutforms\elements\Entry)&lt;/code&gt; with a lot of structure but no user entered values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was actually hoping to reuse my custom form templates (Sprout Forms &gt; Settings &gt; General &gt; Default Form Templates) so it'll cycle through all the field templates like when the user filled in the form but I just want to show values if the form has already been submitted.&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-10-22T23:52:14.357" Title="Display/edit Sprout Form entry in front end" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26874" PostTypeId="2" ParentId="26849" CreationDate="2018-07-13T02:31:59.210" Score="2" Body="&lt;p&gt;After some searching, I decided to move my src/ folder into the web/ folder, since Craft seems to be looking only there and not at anything above that directory. Then, my CSS links were updated to relative paths like this: src/css/typeplate.css. And that worked.&lt;/p&gt;&#xA;" OwnerUserId="8562" LastActivityDate="2018-07-13T02:31:59.210" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26876" PostTypeId="1" AcceptedAnswerId="26879" CreationDate="2018-07-13T11:38:18.167" Score="4" ViewCount="691" Body="&lt;p&gt;When creating plugins on my local I need to run composer update to make sure everything is in sync. In order to make sure the client has the same vendor and plugin folders, I then upload them to the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want make sure that when running &lt;code&gt;composer update&lt;/code&gt; that Craft does not make changes to the database. If so, I need to make sure I also send the latest database to prod as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've made a cli tool to easily sync environments, and I would like to add a command that takes care of this edge case as well.&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-07-13T19:43:37.097" Title="Does composer update make changes to the SQL database" Tags="&lt;plugin-development&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26877" PostTypeId="1" CreationDate="2018-07-13T12:52:57.143" Score="1" ViewCount="8482" Body="&lt;p&gt;I would like to select the second position in the array below. The problem is that this number is automatically changed. So I try to do this with .index function from Twig but I can not figure it out. Can someone help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;array (&#xA;  7296680 =&gt; &#xA;  array (&#xA;    ...&#xA;  ),&#xA;  7296635 =&gt; &#xA;  array (&#xA;     ...&#xA;    'url' =&gt; 'vesten',&#xA;    'title' =&gt; 'Vesten',&#xA;  ),&#xA;)&lt;/p&gt;&#xA;" OwnerUserId="8583" LastActivityDate="2018-07-13T14:00:11.010" Title="How do I target the second item in an array with Twig?" Tags="&lt;templating&gt;&lt;array&gt;&lt;index&gt;&lt;position&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26878" PostTypeId="2" ParentId="26877" CreationDate="2018-07-13T13:14:08.583" Score="1" Body="&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; you can do &lt;code&gt;{{ myarray[1] }}&lt;/code&gt; or even &lt;code&gt;{{ myarray.1 }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more convoluted way would be to loop through the items and on the second pass, get the value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set secondValue = null %}&#xA;{% for value in myArray %}&#xA;    {% if loop.index == 1 %}&#xA;        {% set secondValue = value %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-13T13:14:08.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26879" PostTypeId="2" ParentId="26876" CreationDate="2018-07-13T13:48:34.620" Score="5" Body="&lt;p&gt;No, running &lt;code&gt;composer update&lt;/code&gt; will not – by itself – result in any changes to your database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you run &lt;code&gt;composer update&lt;/code&gt;, all that happens is that Composer downloads updated versions for all your installed packages (i.e. Craft, plugins and other dependencies), before writing a manifest of your currently installed packages to the &lt;code&gt;composer.lock&lt;/code&gt; file. Full stop; Craft isn't actually involved in this process at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, sometimes an updated version of Craft (or a plugin) might need to change something in the database, in order to function. This is called a &quot;migration&quot;, and is distributed with the package in question as a &quot;migration file&quot;, containing the database queries necessary to perform the update that the new version of the package needs. &lt;strong&gt;In terms of updating core code or plugins, running these migrations is the only thing that will end up actually updating your database.&lt;/strong&gt; You do have to run them at some point, because if there are pending migrations on your site's file system (i.e. migrations that have been downloaded but not run yet) your site will be &lt;strong&gt;unavailable&lt;/strong&gt; until those migrations have been run (important – note that if you're updating Craft or a plugin through the Control Panel and not using the command line/Composer directly, Craft will attempt to auto-run any migrations for you, after Composer finishes downloading the new packages).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to run pending migrations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Visit the control panel in a browser, and click the prompt(s)&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Execute the following from your command line (this should be run from the root directory for your project, i.e. where your &lt;code&gt;composer.json&lt;/code&gt; file resides):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;./craft migrate/up&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The above command is safe to run even if there aren't actually any migrations pending, so if you're writing some sort of update/sync script, it could easily be tacked on at the end to make sure that any pending migrations that might be included with the updated code, are run (if you sync up the database instead, this won't be necessary as long as you've run the migrations locally).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to the above – while your strategy for keeping Composer dependencies on the live server updated certainly works, it seems a bit unnecessary and/or convoluted to have to sync the database from local to production. I'd advise to either just run the migrate command in case there are migrations, or even follow what is generally considered the best practice for dealing with Composer dependencies: don't commit the actual dependencies (i.e. your &lt;code&gt;/vendor&lt;/code&gt; folder) to version control, only the &lt;code&gt;composer.lock&lt;/code&gt; file, and run &lt;code&gt;composer install&lt;/code&gt; &lt;strong&gt;on the server&lt;/strong&gt;, after the latest version has been deployed. Here's how a very simple deploy script could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /path/to/host/root&#xA;git pull origin production&#xA;composer install --no-interaction --prefer-dist --optimize-autoloader&#xA;./craft migrate/up&#xA;echo &quot;&quot; | sudo -S service php7.0-fpm reload&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-13T19:43:37.097" LastActivityDate="2018-07-13T19:43:37.097" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26880" PostTypeId="2" ParentId="26877" CreationDate="2018-07-13T14:00:11.010" Score="2" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;slice&lt;/a&gt; filter but it will return an array, so you either have to loop the result or access the first index&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in array|slice(1, 1) %}&#xA;    {{ dump(item) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-13T14:00:11.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26881" PostTypeId="1" CreationDate="2018-07-13T23:19:35.797" Score="1" ViewCount="276" Body="&lt;p&gt;I've developed an app which fetches data from an API based on &lt;strong&gt;Laravel 5.5&lt;/strong&gt;. The marketing landingpage of the app is based on Craft CMS Version 3. The marketing website and the API and the databases of both systems are running on the same server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to generate landingpages for each row of table X of the Laravel database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;www.website.com/awesome-landingpage-about-{slug}&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best approach to realize this? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I don't want to fetch the data directly from Laravel's database&lt;/li&gt;&#xA;&lt;li&gt;I don't want to synchronize the Craft CMS database with the Laravel (add/remove the rows from the laravel's database as entries to Craft)&lt;/li&gt;&#xA;&lt;li&gt;It would be awesome to be able to have an entry-type &quot;Landingpage&quot; where we can optionally create a landingpage, referencing to an ID of the laravel table and add additional content for the landingpages. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Would be a JSON-API from Laravel to Craft CMS Plugin a good performant idea?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;One option would be to use a Dynamic Route and just fetch the data from 127.0.0.1 (because same server) from the template file? Or is there a smarter way in Craft CMS?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/duV0o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/duV0o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8428" LastActivityDate="2018-07-14T04:14:58.727" Title="How to develop plugin/module to build landingpage upon fetched JSON-data" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26883" PostTypeId="1" CreationDate="2018-07-14T00:51:49.120" Score="1" ViewCount="117" Body="&lt;p&gt;Is there anything akin to a presave event or postsave event where we can make a call to TaxJar API to get calculate and report sales tax? I find the integrated tax system impractical at the moment. I would like to create a plugin that can access the existing tax api platforms, but need to know the best insertion points for this.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2018-07-14T22:02:03.243" Title="How can we use TaxJar with CraftCommerce?" Tags="&lt;plugin-craftcommerce&gt;&lt;tax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26884" PostTypeId="2" ParentId="26881" CreationDate="2018-07-14T04:14:58.727" Score="4" Body="&lt;p&gt;I'd make a template called &lt;code&gt;landing&lt;/code&gt; that would have various entries/entry types in it where I can add whatever CMS content I want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://www.example.com/landing/landing-page-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a nice content authoring experience, I'd make a custom Element that knows to go out over the wire and fetch the data from the Laravel database via whatever JSON endpoint you've set up in your Laravel app, and a custom Field that is just a simple ElementSelect for my custom Element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way in your Craft CMS entry, you could just click a button to browse the various rows in your remote Laravel db (presenting the information in a nice UI that'd look exactly like you're selecting another Craft entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then on the templating side of things, it'd work like anything else does in Craft. Through the custom Element, you'd have access to all of the data from your remote Laravel db table, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.laravelData.someField }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Bonus points would be awarded for a nice caching layer to keep things performant.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-14T04:14:58.727" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26885" PostTypeId="2" ParentId="23587" CreationDate="2018-07-14T09:32:22.133" Score="5" Body="&lt;p&gt;Craft 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you enabled the debug toolbar in the user profile, but it still does not show on the frontend, AND you are running Craft not locally but on a different host (different IP), try adding this to your config/app.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'local'  =&amp;gt; [&#xA;    'bootstrap' =&amp;gt; ['debug'],&#xA;    'modules' =&amp;gt; [&#xA;        'debug' =&amp;gt; [&#xA;            'class' =&amp;gt; 'yii\debug\Module',&#xA;            // uncomment and adjust the following to add your IP if you are not connecting from localhost.&#xA;            'allowedIPs' =&amp;gt; ['127.0.0.1', '::1', '*.*.*.*'],&#xA;        ]&#xA;    ]&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I added this to the &quot;local&quot; block since I do my development on a remote server - be sure to only enable this for non-public development / staging servers, as it may cause security issues). If you have a static IP use that instead of the wildcards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sources:&#xA;&lt;a href=&quot;https://www.yiiframework.com/extension/yiisoft/yii2-debug&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/extension/yiisoft/yii2-debug&lt;/a&gt; and&#xA;&lt;a href=&quot;https://github.com/yiisoft/yii2-debug/blob/15526e95239fcd53316866f9f32cd5daf3a087e5/src/Module.php#L30&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/yiisoft/yii2-debug/blob/15526e95239fcd53316866f9f32cd5daf3a087e5/src/Module.php#L30&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8431" LastEditorUserId="5557" LastEditDate="2018-07-16T19:44:00.363" LastActivityDate="2018-07-16T19:44:00.363" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26886" PostTypeId="1" AcceptedAnswerId="26923" CreationDate="2018-07-14T14:31:57.073" Score="4" ViewCount="655" Body="&lt;p&gt;I have a problem with using &lt;code&gt;{% cache %}&lt;/code&gt;in Craft 3, although the code runs fine without caching, and it works in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have narrowed the problem down to the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% set upcomingShows = craft.entries.section('shows').orderBy('showTime asc').limit(null).all() %}&#xA;  {% for date, shows in upcomingShows|group(&quot;showTime|date_modify('-3 hours')|date('Y-m-d')&quot;) %}&#xA;    {% for show in shows %}&#xA;      {% set movie = craft.entries.relatedTo({ targetElement: show }).one() %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me the following fatal error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Allowed memory size of 268435456 bytes exhausted (tried to allocate 71002178 bytes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I skip the Twig &lt;code&gt;|group&lt;/code&gt;filter, the cache works again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;  {% set upcomingShows = craft.entries.section('shows').orderBy('showTime asc').limit(null).all() %}&#xA;  {% for shows in upcomingShows %}&#xA;    {% for show in shows %}&#xA;      {% set movie = craft.entries.relatedTo({ targetElement: show }).one() %}&#xA;    {% endfor %}&#xA;  {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I first thought the problem was the &lt;code&gt;relatedTo()&lt;/code&gt; function, but it turns out it's the &lt;code&gt;|group&lt;/code&gt; is what triggers it, without it it works also with the  &lt;code&gt;relatedTo()&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a bug in the cache, or is there a way around it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; After some more testing, it seems like it works &lt;em&gt;either&lt;/em&gt; with the &lt;code&gt;|group&lt;/code&gt; filter or the &lt;code&gt;relatedTo()&lt;/code&gt; function, but not both at the same time.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="5771" LastEditDate="2018-07-17T16:20:16.297" LastActivityDate="2018-07-17T23:16:28.390" Title="Caching in Craft 3 causes out of memory when including grouped for loop" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26887" PostTypeId="2" ParentId="26883" CreationDate="2018-07-14T22:02:03.243" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcommerce.com/docs/events-reference#commerce_orders.onbeforesaveorder&quot; rel=&quot;nofollow noreferrer&quot;&gt;onBeforeSaveOrder&lt;/a&gt; event runs before all of the adjustments are calculated (including taxes), so it seems like that's what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-14T22:02:03.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26888" PostTypeId="1" AcceptedAnswerId="26890" CreationDate="2018-07-15T15:33:43.690" Score="3" ViewCount="201" Body="&lt;p&gt;At the moment I'm converting a website from a different CMS to Craft v3. The 'old' CMS had a convenient way to set a hierarchy for static translations in yaml files so that we could split translations into groups per section on the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  PageNavigation:&#xA;    PrevPage: 'Previous'&#xA;    NextPage: 'Next'&#xA;    GotoPrevPage: &quot;Goto previous page: '{prevPageTitle}'&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I can't find anything like that on the documentation and google search on Craft CMS. At the moment this is what I got instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return array(&#xA;    'PageNavigation.PrevPage' =&amp;gt; 'Previous',&#xA;    'PageNavigation.NextPage'=&amp;gt; 'Next'&#xA;    'PageNavigation.GotoPrevPage' =&amp;gt; &quot;Goto previous page: '{prevPageTitle}'&quot;&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So every translation-item has a group supplied to it as a prefix, followed by a dot and then the translation-itemID. But this gets ugly soon and is not as convinient as what I was used to in the other CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt;&#xA;&lt;strong&gt;Does anybody here perhaps knows if CraftCMS has a better way of setting hierarchy to static translations?&lt;/strong&gt; So to group translation items to sections/elements on the website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt;&#xA;Is there a way in Craft CMS to have a placeholder inside the translation-string being replaced by a variable inside the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the 'old' CMS I could replace a placeholder like {placeholder} inside a translation-string by a dynamic variable inside the template. So a translation string like &quot;Goto previous page: '{prevPageTitle}'&quot; would come out as &quot;Goto previous page: 'all about craft blog title'&quot;. &lt;strong&gt;Is there some functionality build in Craft that could replace a placeholder in the translation-string by a dynamic string?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!!&lt;/p&gt;&#xA;" OwnerUserId="8483" LastEditorUserId="8483" LastEditDate="2018-07-15T16:03:11.650" LastActivityDate="2018-07-15T16:24:57.563" Title="Is there some way to create sections inside static translations? (craft v3)" Tags="&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26889" PostTypeId="1" CreationDate="2018-07-15T15:40:40.737" Score="3" ViewCount="1259" Body="&lt;p&gt;I couldn't find any booking/reservation system for Craft. Is there any? I found questions from 2014, so things could change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there is community-approved booking/reservation service that is commonly used with Craft, but it doesn't have the native plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe it can be done within Craft core? I'm open to ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If you saw a Craft project with booking/reservations feel free to comment it here&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="6229" LastEditorUserId="6229" LastEditDate="2018-07-15T15:46:10.320" LastActivityDate="2020-05-16T21:53:31.280" Title="Is there any Booking/Reservation system for Craft 3?" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26890" PostTypeId="2" ParentId="26888" CreationDate="2018-07-15T16:24:57.563" Score="4" Body="&lt;p&gt;You can include custom translation categories within your &lt;code&gt;config/app.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'modules' =&amp;gt; [&#xA;        'my-module' =&amp;gt; \modules\Module::class,&#xA;    ],&#xA;    'components'    =&amp;gt; [&#xA;        'i18n' =&amp;gt; [&#xA;            'translations' =&amp;gt; [&#xA;                'foo'  =&amp;gt; [&#xA;                    'class'            =&amp;gt; \craft\i18n\PhpMessageSource::class,&#xA;                    'forceTranslation' =&amp;gt; true,&#xA;                    'basePath'         =&amp;gt; '@translations',&#xA;                ],&#xA;            ]&#xA;        ]&#xA;    ]&#xA;    //'bootstrap' =&amp;gt; ['my-module'],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will include the custom group &lt;code&gt;foo&lt;/code&gt; to your app, make sure to change the &lt;code&gt;basePath&lt;/code&gt; variable to a path you like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said your folder structure will look like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-your base path&#xA;|-- en-US&#xA;|-----&amp;gt; foo.php&#xA;|-- de-DE&#xA;|-----&amp;gt; foo.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within these files you can create your custom translations&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'foo' =&amp;gt; 'bar'&#xA;];&#xA;&#xA;&#xA;{{ 'foo'|t('foo') }} -&amp;gt; will now display bar&#xA;{{ 'foo'|t('site') }} -&amp;gt; will still show foo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-15T16:24:57.563" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26892" PostTypeId="1" CreationDate="2018-07-16T03:33:20.743" Score="1" ViewCount="139" Body="&lt;p&gt;For some reason editing images isn't working for me. Specifically saving/replacing. Nothing happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two errors I get in the console are;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://dev.test/index.php?p=admin/actions/assets/save-image 500 (Internal Server Error)&#xA;&#xA;Uncaught TypeError: Cannot read property 'error' of null&#xA;    at s.constructor.&amp;lt;anonymous&amp;gt; (Craft.js:5952)&#xA;    at Object.error (Craft.js:361)&#xA;    at c (jquery.js:3317)&#xA;    at Object.fireWith [as rejectWith] (jquery.js:3447)&#xA;    at l (jquery.js:9274)&#xA;    at XMLHttpRequest.&amp;lt;anonymous&amp;gt; (jquery.js:9514)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2018-07-16T03:33:20.743" Title="Craft 3 Image Editor not Saving/Working" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26893" PostTypeId="2" ParentId="23789" CreationDate="2018-07-16T03:55:14.817" Score="1" Body="&lt;p&gt;This caught me out too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PhpMyAdmin, click Databases tab, click the database you wish to import into, then Import tab.&lt;/p&gt;&#xA;" OwnerUserId="8587" LastActivityDate="2018-07-16T03:55:14.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26894" PostTypeId="2" ParentId="26863" CreationDate="2018-07-16T04:57:13.127" Score="3" Body="&lt;p&gt;If you're running Craft 3, you can click an asset and then hit SHIFT + SPACE to open a Lightbox with the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8x5uw.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8x5uw.jpg&quot; alt=&quot;Craft 3 Asset Lightbox/Modal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5297" LastActivityDate="2018-07-16T04:57:13.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26895" PostTypeId="2" ParentId="26889" CreationDate="2018-07-16T09:28:25.890" Score="1" Body="&lt;p&gt;Whilst one could build a booking system within Craft either with judicious use of Twig, Channels, and Entries or with a custom plugin it doesn't make a huge amount of sense to reinvent the wheel. Especially when booking management systems are deceptively complex when you get past the initial idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be possible to integrate pretty much any third party booking system into Craft with a bit of custom plugin development.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-16T09:28:25.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26897" PostTypeId="1" AcceptedAnswerId="26902" CreationDate="2018-07-16T11:33:24.313" Score="7" ViewCount="3310" Body="&lt;p&gt;I want to uninstall a plugin.&#xA;I disabled it in CP but there is no option to uninstall this plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I go to composer and remove it from the &lt;code&gt;required&lt;/code&gt; section and run &lt;code&gt;composer update&lt;/code&gt;.&#xA;This deals with the files but not the database record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's not clear to me the best way to uninstall a plugin in Craft 3. Thru the interface is fine when it works but when there is no option how do you get rid of it?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2018-07-16T18:41:28.227" LastActivityDate="2018-07-16T18:41:28.227" Title="how to uninstall a plugin when there is no cp option" Tags="&lt;plugins&gt;&lt;uninstall&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26898" PostTypeId="1" AcceptedAnswerId="26901" CreationDate="2018-07-16T12:48:08.640" Score="1" ViewCount="240" Body="&lt;p&gt;I have just deployed my first Craft 3 site to a production server with the following process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Deploying git repo to the server&lt;/li&gt;&#xA;&lt;li&gt;Then running the composer command to download the required files for Craft etc that were ignored from git (from &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Set up database etc&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, when I open the site in the browser it is returning a 503 Service Unavailable error yet the admin side of the site works absolutely fine.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-07-16T14:09:09.050" LastActivityDate="2018-07-16T15:01:21.957" Title="Deploying Craft 3 site to production has working admin but 503 front end" Tags="&lt;craft3&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26899" PostTypeId="1" CreationDate="2018-07-16T13:16:10.550" Score="1" ViewCount="93" Body="&lt;p&gt;We've got a site with several Freeform forms, and my client has noticed that when they use Freeform's &quot;Export CSV&quot; they only get the first 50. That's because you need to select all the submissions, then export them – and if you've not scrolled down several times to force all of the other entries to load in, you'll only get the 50 that were initially shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know a way round this? If you've got hundreds of submissions it feels a bit clunky to have to trigger the AJAXing in of entries before you can export them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're on Craft 2.6.3011, Freeform 1.8.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2018-07-16T17:45:26.317" Title="Export more than 50 Freeform submissions (without a lot of scrolling)" Tags="&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26900" PostTypeId="2" ParentId="26807" CreationDate="2018-07-16T13:53:02.690" Score="1" Body="&lt;p&gt;andrew.welch was right in his comment. it looks as though clearing the cache missed a few pages and still showed 'devMode' - after a couple of days it was no longer appearing.&lt;/p&gt;&#xA;" OwnerUserId="8530" LastActivityDate="2018-07-16T13:53:02.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26901" PostTypeId="2" ParentId="26898" CreationDate="2018-07-16T15:01:21.957" Score="1" Body="&lt;p&gt;&lt;code&gt;isSystemOn&lt;/code&gt; was set to false. IDIOT.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-07-16T15:01:21.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26902" PostTypeId="2" ParentId="26897" CreationDate="2018-07-16T15:01:41.690" Score="8" Body="&lt;p&gt;It isn't possible to uninstall a disabled plugin; you'll need to first enable the plugin, and then the Uninstall option will be available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way to remove a plugin is actually to first Uninstall it. After uninstalling, you can either run &lt;code&gt;composer remove vendor/plugin-handle&lt;/code&gt; from the command line, or select the &quot;Remove&quot; option from the Control Panel (the &quot;Remove&quot; option is available for any plugin that isn't currently installed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do it the other way around – i.e. remove the files before uninstalling the plugin – you're probably going to see some issues.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-16T15:01:41.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26903" PostTypeId="1" CreationDate="2018-07-16T15:01:56.580" Score="1" ViewCount="53" Body="&lt;p&gt;I'm trying to figure out how to set up my relatedTo paramaters to do a category search. Normally it's not a problem but in this case I need something more complex than normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have multiple category groups. Within each group I need to use an &quot;or&quot; condition. So entries are returned if they match any categories in that group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But across the different groups I need to apply an &quot;and&quot; condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. Group 1 is &quot;colours&quot;, Group 2 is &quot;size&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if someone selects:&#xA;Group 1: black, blue&#xA;Group 2: small&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to return any entries that are (black OR blue) AND (small)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting the 'or' condition within a group is no problem but I'm stumped on how I can merge the different sets of parameters together to get the desired results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a truncated version of what I have so far, just showing 2 of my groups.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# clear everything #}&#xA;{% set colourQuery = '' %}&#xA;{% set sizeQuery = '' %}&#xA;&#xA;{# get all the search query parameters #}&#xA;{% set colour = craft.request.getParam('colour') %}&#xA;{% set size = craft.request.getParam('size') %}&#xA;&#xA;{% set colourQuery = colour | join(',') %}&#xA;{% set sizeQuery = size | join(',') %}&#xA;&#xA;{# colour #}&#xA;{% set colourParams = ['or'] %}&#xA;{% set cats = craft.categories.group('colour').slug( colourQuery | split(',') ).find() %}&#xA;{% for cat in cats %}&#xA;    {% set colourParams = colourParams | merge([{ targetElement: cat }]) %}&#xA;{% endfor %}&#xA;&#xA;{# size #}&#xA;{% set sizeParams = ['or'] %}&#xA;{% set cats = craft.categories.group('size').slug( sizeQuery | split(',') ).find() %}&#xA;{% for cat in cats %}&#xA;    {% set sizeParams = sizeParams | merge([{ targetElement: cat }]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I build the criteria... I'm sure this is where I'm going wrong&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# build criteria #}&#xA;{% set relatedParams = [] %}&#xA;&#xA;{% set relatedParams = relatedParams | merge(colourParams) %}&#xA;{% set relatedParams = relatedParams | merge(sizeParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# build criteria #}&#xA;{% set relatedParams = [&#xA;        ['and', colourParams],&#xA;        ['and', sizeParams],&#xA;    ] &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;code&gt;relatedParams&lt;/code&gt; like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products('products').relatedTo(relatedParams).order(sortString).limit(numPerPage) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, my question is how should I join those different paramater arrays in order to get what I need?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-16T19:42:09.030" Title="Returning entries based on Relationships across different category groups using 'and'" Tags="&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26905" PostTypeId="2" ParentId="26899" CreationDate="2018-07-16T17:45:26.317" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/reports&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Reports&lt;/a&gt; is a flexible reporting plugin that allows you to create custom queries and export the results as CSV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a custom report using the default Twig Template or Custom Query reports building a report using Freeform variables in your Twig templates or a MySQL query that queries the report Freeform content table directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to give your users settings, such as which Form to export submissions from, you can add settings to a custom Twig Template report or write a custom integration to define settings and handle your query using PHP.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-16T17:45:26.317" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26907" PostTypeId="2" ParentId="17392" CreationDate="2018-07-16T19:03:14.690" Score="2" Body="&lt;p&gt;A couple of years later, I ran into the same issue. In case there are others looking, it looks like this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for page, url in paginate.getPreviousUrls(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for page, url in paginate.getPrevUrls(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8514" LastEditorUserId="5557" LastEditDate="2018-07-16T19:42:28.367" LastActivityDate="2018-07-16T19:42:28.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26908" PostTypeId="1" CreationDate="2018-07-16T19:09:04.827" Score="1" ViewCount="57" Body="&lt;p&gt;I'm working with images in subfolders, several levels deep, under the Assets parent folder.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-Assets&#xA;--Dept_A&#xA;---Jan15&#xA;--Dept_B&#xA;---Jan15&#xA;---Jan16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've come across this code (below), but it only will find the parent (&quot;Assets&quot;) and the children (&quot;Dept_A&quot; and &quot;Dept_B&quot;).&lt;br&gt;&#xA;I want to loop through all of the subfolders, if possible.  Thanks for any leads.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($assetSources as $source)&#xA;    {&#xA;        $folder = craft()-&amp;gt;assets-&amp;gt;findFolder(array(&#xA;            'sourceId' =&amp;gt; $source-&amp;gt;id,&#xA;            'parentId' =&amp;gt; ':empty:'&#xA;        ));&#xA;&#xA;        $subfolders = craft()-&amp;gt;assets-&amp;gt;findFolders(array(&#xA;            'parentId' =&amp;gt; $folder-&amp;gt;id&#xA;        ));&#xA;&#xA;        $foldersBySource[$source-&amp;gt;id] = $folder;&#xA;        $subfoldersBySource[$source-&amp;gt;id] = $subfolders;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="6879" LastEditDate="2018-07-17T20:29:30.413" LastActivityDate="2018-07-17T20:29:30.413" Title="Find All Levels of Subfolders under Assets" Tags="&lt;assets&gt;&lt;subfolder&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26909" PostTypeId="2" ParentId="26903" CreationDate="2018-07-16T19:42:09.030" Score="2" Body="&lt;p&gt;After some help from @RobinSchambach on the Craft Slack and a bit of trial and error I got to this, truncated for brevity.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# clear everything #}&#xA;    {% set colourQuery = '' %}&#xA;    {% set sizeQuery = '' %}&#xA;&#xA;    {# get all the search query parameters #}&#xA;    {% set colour = craft.request.getParam('colour') %}&#xA;    {% set size = craft.request.getParam('size') %}&#xA;&#xA;&#xA;    {% set colourQuery = colour | join(',') %}&#xA;    {% set sizeQuery = size | join(',') %}&#xA;&#xA;&#xA;    {# colour #}&#xA;    {% set colourParams = ['or'] %}&#xA;    {% set cats = craft.categories.group('colour').slug( colourQuery | split(',') ).find() %}&#xA;    {% for cat in cats %}&#xA;        {% set colourParams = colourParams | merge([{ targetElement: cat }]) %}&#xA;    {% endfor %}&#xA;&#xA;    {# size #}&#xA;    {% set sizeParams = ['or'] %}&#xA;    {% set cats = craft.categories.group('size').slug( sizeQuery | split(',') ).find() %}&#xA;    {% for cat in cats %}&#xA;        {% set sizeParams = sizeParams | merge([{ targetElement: cat }]) %}&#xA;    {% endfor %}&#xA;&#xA;&#xA;&#xA;&#xA;    {# build criteria #}&#xA;    {% set relatedParams = ['and'] %}&#xA;    {% if colourQuery != '' %}&#xA;        {% set relatedParams = relatedParams | merge([{element : colourQuery}]) %}&#xA;    {% endif %}&#xA;&#xA;    {% if sizeQuery != '' %}&#xA;        {% set relatedParams = relatedParams | merge([{element : sizeQuery}]) %}&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key difference is that I'm using the Category IDs rather than their slugs. I'm then passing them as comma delimited strings into the array to build up the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on refining this a bit more but it's now working as expected.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-16T19:42:09.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26910" PostTypeId="1" CreationDate="2018-07-17T03:40:03.983" Score="2" ViewCount="271" Body="&lt;p&gt;I'm trying to call &lt;code&gt;craft\web\View::renderPageTemplate&lt;/code&gt; from within a console controller (also tried from a queue job), but running into all kinds of trouble:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Exception 'Twig_Error_Runtime' with message 'An exception has been thrown during the rendering of a template (&quot;Session does not exist in a console request.&quot;).'&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I discovered the this was due to &lt;code&gt;registerAssetFlashes&lt;/code&gt;: &lt;a href=&quot;https://github.com/craftcms/cms/blob/279116ba4091edc67c92fcbbefc257bb4fe30335/src/web/View.php#L1418&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/279116ba4091edc67c92fcbbefc257bb4fe30335/src/web/View.php#L1418&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;No plugins that register twig functions/filters work&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently I'm doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = Craft::$app-&amp;gt;getView();&#xA;$view-&amp;gt;setTemplateMode($view::TEMPLATE_MODE_SITE);&#xA;$view-&amp;gt;renderPageTemplate($template, $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The end goal is to render a template, cache it, and send the html to a web service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this without everything breaking?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…Or is there another way to do this, or should this be a feature request?&lt;/p&gt;&#xA;" OwnerUserId="314" LastEditorUserId="314" LastEditDate="2018-07-20T12:12:20.407" LastActivityDate="2018-07-20T12:12:20.407" Title="How can I render a page template from a queue job/console controller?" Tags="&lt;console&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26911" PostTypeId="2" ParentId="26910" CreationDate="2018-07-17T03:48:57.820" Score="2" Body="&lt;p&gt;Given that it's &lt;code&gt;craft\web\View.php&lt;/code&gt; I think you're probably out of luck. Though it's only &lt;code&gt;registerAssetFlashes()&lt;/code&gt; that seems to call &lt;code&gt;getSession()&lt;/code&gt;, but I'm expecting more than just that may assume a frontend request. You could always ping a controller endpoint via Guzzle to return the Twig-rendered HTML to you though.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2018-07-17T05:13:20.643" LastActivityDate="2018-07-17T05:13:20.643" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26913" PostTypeId="1" CreationDate="2018-07-17T08:35:03.510" Score="1" ViewCount="70" Body="&lt;p&gt;Is it possible to enforce users to enter their password when changing their data?&#xA;For example when changing their phone number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8590" LastEditorUserId="57" LastEditDate="2018-07-17T20:52:43.073" LastActivityDate="2018-07-18T23:47:14.200" Title="How do I make it required to enter password when changing user data?" Tags="&lt;elevated-session&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26914" PostTypeId="1" CreationDate="2018-07-17T09:09:26.640" Score="1" ViewCount="75" Body="&lt;p&gt;When importing CMYK images into Assets the colour of the image can be shifted dramatically. Often giving a washed out look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prevent this and ensure the image colours are as accurate as possible?&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-07-17T09:12:32.667" LastActivityDate="2018-07-17T09:12:32.667" Title="How can I prevent CMYK image colours being shifted when importing into Assets?" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26915" PostTypeId="2" ParentId="26914" CreationDate="2018-07-17T09:12:04.457" Score="2" Body="&lt;p&gt;It is necessary to add the following lines to your config&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'preserveImageColorProfiles' =&amp;gt; true,&#xA;'preserveCmykColorspace' =&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will ensure that the image colours are retained when imported to Assets. You should also ensure that the images are converted to RGB for output. I do this with the Imager plugin and specify the image should be converted to RGB in my transform options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, ensure that you are using ImageMagick for any transformations by installing it on your server and adding the following to your config.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'imageDriver' =&amp;gt; 'imagick',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-17T09:12:04.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26916" PostTypeId="2" ParentId="26910" CreationDate="2018-07-17T10:15:17.837" Score="1" Body="&lt;p&gt;You need to remove every Twig function like &lt;code&gt;craft.app.getSession()&lt;/code&gt; within your templates and use the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view-&amp;gt;renderTemplate($template, $variables); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;function instead of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view-&amp;gt;renderPageTemplate($template, $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-17T10:15:17.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26917" PostTypeId="1" CreationDate="2018-07-17T10:58:59.067" Score="1" ViewCount="1045" Body="&lt;p&gt;Randomly getting the &quot;Integrity constraint violation&quot;  sql error on saving entry from backend.  There no apparent cause of this at least not that I can see, because the same post saves without errors when I try again.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft version is : 2.6.3017&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the error and Stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db_production`.`craft_relations`, CONSTRAINT `craft_relations_targetId_fk` FOREIGN KEY (`targetId`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `craft_relations` (`fieldId`, `sourceId`, `sourceLocale`, `targetId`, `sortOrder`, `dateCreated`, `dateUpdated`, `uid`) VALUES (:row0_col0, :row0_col1, NULL, :row0_col3, :row0_col4, :row0_col5, :row0_col6, :row0_col7), (:row1_col0, :row1_col1, NULL, :row1_col3, :row1_col4, :row1_col5, :row1_col6, :row1_col7), (:row2_col0, :row2_col1, NULL, :row2_col3, :row2_col4, :row2_col5, :row2_col6, :row2_col7), (:row3_col0, :row3_col1, NULL, :row3_col3, :row3_col4, :row3_col5, :row3_col6, :row3_col7), (:row4_col0, :row4_col1, NULL, :row4_col3, :row4_col4, :row4_col5, :row4_col6, :row4_col7), (:row5_col0, :row5_col1, NULL, :row5_col3, :row5_col4, :row5_col5, :row5_col6, :row5_col7).&#xA;&#xA;[error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db_production`.`craft_relations`, CONSTRAINT `craft_relations_targetId_fk` FOREIGN KEY (`targetId`) REFERENCES `craft_elements` (`id`) ON DELETE CASCADE) in /var/www/mysite.com/craft/app/framework/db/CDbCommand.php:358&#xA;&#xA;Stack trace:&#xA;#0 /var/www/mysite.com/craft/app/etc/db/DbCommand.php(370): CDbCommand-&amp;gt;execute(Array)&#xA;#1 /var/www/mysite.com/craft/app/services/RelationsService.php(74): Craft\DbCommand-&amp;gt;insertAll('craft_relations', Array, Array)&#xA;#2 /var/www/mysite.com/craft/app/fieldtypes/BaseElementFieldType.php(291): Craft\RelationsService-&amp;gt;saveRelations(Object(Craft\FieldModel), Object(Craft\EntryModel), Array)&#xA;#3 /var/www/mysite.com/craft/app/services/ElementsService.php(1608): Craft\BaseElementFieldType-&amp;gt;onAfterElementSave()&#xA;#4 /var/www/mysite.com/craft/app/services/EntriesService.php(176): Craft\ElementsService-&amp;gt;saveElement(Object(Craft\EntryModel))&#xA;#5 /var/www/mysite.com/craft/app/controllers/EntriesController.php(462): Craft\EntriesService-&amp;gt;saveEntry(Object(Craft\EntryModel))&#xA;#6 /var/www/mysite.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&amp;gt;actionSaveEntry()&#xA;#7 /var/www/mysite.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 /var/www/mysite.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 /var/www/mysite.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 /var/www/mysite.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('saveEntry')&#xA;#11 /var/www/mysite.com/craft/app/etc/web/WebApp.php(836): CWebApplication-&amp;gt;runController('entries/saveEnt...')&#xA;#12 /var/www/mysite.com/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /var/www/mysite.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 /var/www/mysite.com/craft/app/index.php(73): CApplication-&amp;gt;run()&#xA;#15 /var/www/mysite.com/public/index.php(15): require_once('/var/www/mysite...')&#xA;#16 {main}&#xA;REQUEST_URI=/admin/entries/blog/new&#xA;HTTP_REFERER=https://mysite.com/admin/entries/blog/new&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anyone ever faced this error? is this a Craft bug?&lt;/p&gt;&#xA;" OwnerUserId="7341" LastEditorUserId="5557" LastEditDate="2018-08-20T21:52:25.187" LastActivityDate="2018-08-20T21:52:25.187" Title="Randomly getting the &quot;Integrity constraint violation&quot; sql error on saving entry" Tags="&lt;database&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26918" PostTypeId="2" ParentId="26522" CreationDate="2018-07-17T13:49:13.673" Score="0" Body="&lt;p&gt;&lt;em&gt;First, As this question is about a beta version of Sprout Forms I'd recommend updating to the latest version as we are actively fixing several minor issues as we work toward a stable release.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, Form Entries support searching for a value via a custom field, however, I think the issue you may be running into relates to Related Entries vs Custom Fields that store their data in the content columns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use syntax like you've shared to query a custom text field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.sproutForms.entries&#xA;  .formHandle('myForm')&#xA;  .customField(&quot;hello&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For relations fields, using the &lt;code&gt;relatedTo&lt;/code&gt; parameter performs a search for relationships:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.sproutForms.entries&#xA;  .formHandle('myForm')&#xA;  .relatedTo(4) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-17T13:49:13.673" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26919" PostTypeId="2" ParentId="26873" CreationDate="2018-07-17T14:07:25.727" Score="1" Body="&lt;p&gt;Sprout Forms improved support of this scenario in v3.0.0-beta.27. You can now use the &lt;code&gt;setEntry&lt;/code&gt; variable to populate the Form Entry Model that you want to use in the Form Templates that you output using the &lt;code&gt;displayForm&lt;/code&gt; tag. See the docs on &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/entries.html#editing-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Editing Entries&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Populate a Front-End form with existing data&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get an instance of the your Form #}&#xA;{% set form = craft.sproutForms.getForm('application') %}&#xA;&#xA;{# Get an instance of the Entry you'll be allowing a user to edit #}&#xA;{% set entry = craft.sproutForms.getEntryById(123) %}&#xA;&#xA;{# Set the `entry` variable so your Form Templates know how to populate the fields with existing values #}&#xA;{% do craft.sproutForms.setEntry(form, entry) %}&#xA;&#xA;{# Output your form as usual #}&#xA;{{ craft.sproutForms.displayForm('application') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I've looked into this and am considering this a bug. I've opened an &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms/issues/131&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; on Github and will update my answer here when we have a fix in place.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-10-22T23:52:14.357" LastActivityDate="2018-10-22T23:52:14.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26920" PostTypeId="2" ParentId="1642" CreationDate="2018-07-17T18:32:30.577" Score="5" Body="&lt;p&gt;FYI, this is how it's done in Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\fields\Matrix;&#xA;use craft\fields\PlainText;&#xA;&#xA;//Create the matrix field &#xA;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;createField([&#xA;    'type' =&amp;gt; Matrix::class,&#xA;    'groupId' =&amp;gt; 1,&#xA;    'name' =&amp;gt; 'My Matrix Field',&#xA;    'handle' =&amp;gt; 'myMatrixField',&#xA;    'settings' =&amp;gt; array (&#xA;        'minBlocks' =&amp;gt; '1',&#xA;        'maxBlocks' =&amp;gt; '',&#xA;        'localizeBlocks' =&amp;gt; false,&#xA;    )&#xA;]);&#xA;&#xA;try {&#xA;    Craft::$app-&amp;gt;getFields()-&amp;gt;saveField($field);&#xA;}&#xA;catch (\Throwable $e){&#xA;    echo $e-&amp;gt;getMessage();&#xA;}&#xA;&#xA;//Set new block type(s) and add sub-fields to it&#xA;$field-&amp;gt;setBlockTypes(array(&#xA;    'new1' =&amp;gt; array(&#xA;        'name' =&amp;gt; &quot;A Block&quot;,&#xA;        'handle' =&amp;gt; &quot;aBlock&quot;,&#xA;        'fields' =&amp;gt; array(&#xA;            'new1' =&amp;gt; array(&#xA;                'type' =&amp;gt; PlainText::class,&#xA;                'name' =&amp;gt; 'First Subfield',&#xA;                'handle' =&amp;gt; 'firstSubfield',&#xA;                'instructions' =&amp;gt; '',&#xA;                'required' =&amp;gt; false,&#xA;                'typesettings' =&amp;gt; array (&#xA;                    'multiline' =&amp;gt; ''&#xA;                )&#xA;            ) &#xA;        )&#xA;    )&#xA;);&#xA;&#xA;//Save field with new block type and sub-fields settings&#xA;try{&#xA;    Craft::$app-&amp;gt;matrix-&amp;gt;saveSettings($field);&#xA;}&#xA;catch(\Throwable $e){&#xA;    echo $this-&amp;gt;failed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8594" LastEditorUserId="8594" LastEditDate="2018-07-19T16:35:18.147" LastActivityDate="2018-07-19T16:35:18.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26922" PostTypeId="2" ParentId="26917" CreationDate="2018-07-17T20:59:03.063" Score="3" Body="&lt;p&gt;It's not a Craft bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error means that the data in your &lt;code&gt;craft_relations&lt;/code&gt; table is out of sync with the data in the your &lt;code&gt;craft_elements&lt;/code&gt; table.  i.e. an ID exists in &lt;code&gt;craft_relations.targetId&lt;/code&gt; that doesn't exist in &lt;code&gt;craft_elements.id&lt;/code&gt; or visa-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it got that way is hard to say, but here are some common causes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Someone manually edits database data without realizing the implications.&lt;/li&gt;&#xA;&lt;li&gt;A database was imported into a MySQL box that only supported the MyISAM storage engine, which doesn't support foreign keys, so all of the foreign keys that Craft relies on to keep data consistent between tables are silently dropped.  If this is the case, you can use &lt;a href=&quot;https://github.com/pixelandtonic/craft-fixfks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/craft-fixfks&lt;/a&gt; to try and restore Craft's foreign keys.&lt;/li&gt;&#xA;&lt;li&gt;A botched import/export script.&lt;/li&gt;&#xA;&lt;li&gt;A plugin behaving poorly.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the context of these two tables, if you want to find all rows that have a value in &lt;code&gt;craft_relations.targetId&lt;/code&gt; that doesn't exist in &lt;code&gt;craft_elements.id&lt;/code&gt;, the SQL would be similar to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM craft_relations r&#xA;LEFT OUTER JOIN craft_elements e&#xA;ON r.targetId = e.id&#xA;WHERE e.id IS NULL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-07-18T19:10:05.910" LastActivityDate="2018-07-18T19:10:05.910" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26923" PostTypeId="2" ParentId="26886" CreationDate="2018-07-17T23:16:28.390" Score="2" Body="&lt;p&gt;After looking through this, it would probably be better off as a &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github issue&lt;/a&gt; than a Stack Exchange post, but answering here for posterity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, this comes down to a &lt;a href=&quot;https://github.com/craftcms/cms/commit/95f62074ebbcdd328b5403320be22e9c9756e3fd&quot; rel=&quot;nofollow noreferrer&quot;&gt;change&lt;/a&gt; we had to make in Craft 3 to fix some other caching issues where we started to serialize element queries when saving them, so that when retrieving them later to determine if a cache should be busted, we would unserialize and execute the saved element query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that serialization requires significantly more memory than not serializing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of your database, with your custom fields and plugins on both &lt;code&gt;shows&lt;/code&gt; and &lt;code&gt;movies&lt;/code&gt; sections, it takes about 1.1MB of memory to save each element query inside of your &lt;code&gt;{% cache %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given your current template code, with the nested &lt;code&gt;for&lt;/code&gt; loops and the number of elements you're accessing in the cache tag, you're looking at about 7,000 element queries that Craft has to track, or 7.7GB of memory - hence the error you're hitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on our list to completely revamp the template caching engine to help mitigate scenarios like this (as well as other template caching issues people have &lt;a href=&quot;https://github.com/craftcms/cms/issues?utf8=%E2%9C%93&amp;amp;q=is%3Aissue+is%3Aopen+cache&quot; rel=&quot;nofollow noreferrer&quot;&gt;come across&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime, you've got a few options.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Revamp your template logic so you're not executing &lt;a href=&quot;https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;O(n2)&lt;/a&gt; database queries.  That could involve pure Twig/templates or a custom plugin where you can grab exactly the data your template needs from PHP/Querybuilder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#cacheelementqueries&quot; rel=&quot;nofollow noreferrer&quot;&gt;cacheElementQueries&lt;/a&gt; config setting to &lt;code&gt;false&lt;/code&gt;. Craft will no long attempt to record/bust template caches, so you can come up with your own logic for busting them (cron job, plugin, etc.).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a plugin like &lt;a href=&quot;https://github.com/mmikkel/CacheFlag-Craft3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cache Flag&lt;/a&gt; (or a similar one).  It also doesn't attempt to save element queries, but provides a way to bust caches based on keywords.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-17T23:16:28.390" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26924" PostTypeId="1" CreationDate="2018-07-17T23:37:51.180" Score="2" ViewCount="91" Body="&lt;p&gt;I grab some values via an element query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries.section('events').status('live,pending').order('postDate asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I need to put them into an array for use in a Craft-styled form field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twig documentation shows how to put text values in an array and merge them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I do this with the results of my element query?&lt;/p&gt;&#xA;" OwnerUserId="4992" LastEditorUserId="4992" LastEditDate="2018-07-17T23:40:50.580" LastActivityDate="2018-07-17T23:40:50.580" Title="What is the correct syntax for using merge to create an array of field values from an element query?" Tags="&lt;templating&gt;&lt;merge&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26925" PostTypeId="2" ParentId="26924" CreationDate="2018-07-17T23:40:09.470" Score="1" Body="&lt;p&gt;Just put the field names in parentheses:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set options = [] %}&#xA;{% for event in events %}&#xA;  {% set options = options|merge({ (event.slug):(event.eventTitle) }) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now I can output them in the format Craft wants for a form field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.selectField({&#xA;  label: &quot;Choose event&quot;|t,&#xA;  name: &quot;eventSlug&quot;,&#xA;  options: options,&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4992" LastActivityDate="2018-07-17T23:40:09.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26926" PostTypeId="2" ParentId="5272" CreationDate="2018-07-18T07:05:30.897" Score="1" Body="&lt;p&gt;I had the same problems after updates by a provider.&#xA;The solution was add a setting called overridePhpSessionLocation and set it to auto. &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#general&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#general&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4775" LastActivityDate="2018-07-18T07:05:30.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26927" PostTypeId="1" CreationDate="2018-07-18T11:06:50.037" Score="3" ViewCount="1337" Body="&lt;p&gt;I want to use Feed Me with Craft to import my old database, but neither Feed Me nor Craft can find &lt;code&gt;mysqldump&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a known problem, and I have successfully added the path to &lt;code&gt;$PATH&lt;/code&gt; and verified that this is set in my &lt;code&gt;.bash_profile&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I execute &lt;code&gt;mysqldump&lt;/code&gt; on the console I get the familiar usage hints. Executing &lt;code&gt;which mysqldump&lt;/code&gt; gives me &lt;code&gt;/usr/local/mysql/bin/mysqldump&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet when I go to &lt;code&gt;Craft &amp;gt; Database &amp;gt; Backup&lt;/code&gt; it fails. In &lt;code&gt;web.log&lt;/code&gt; I find:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2018-07-18 21:01:10 [::1][1][-][error][yii\base\Exception] yii\base\Exception: Could not create backup: The shell command &quot;mysqldump --defaults-extra-file=&quot;/Users/xxx/mysite.com/code/craft/storage/runtime/temp/my.cnf&quot; &#xA;  [snip]&#xA;  _180718_110110_rig2b5xl4z_v3.0.15.sql&quot;&quot; failed with exit code 127: sh: mysqldump: command not found in /Users/xxx/mysite.com/code/craft/vendor/craftcms/cms/src/controllers/UtilitiesController.php:383&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why can I run the command in the terminal but Craft cannot? I've checked the permissions, and they should be ok:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;-rwxr-xr-x   1 root  wheel   4062128 29 Sep  2016 mysqldump*&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8596" LastEditorUserId="5557" LastEditDate="2018-07-18T12:04:19.290" LastActivityDate="2019-07-01T14:22:13.067" Title="Craft 3 cannot find mysqldump command, console works" Tags="&lt;database&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26928" PostTypeId="2" ParentId="26927" CreationDate="2018-07-18T11:35:43.510" Score="4" Body="&lt;p&gt;After a lot of digging I found an &lt;a href=&quot;https://stackoverflow.com/questions/3431858/php-system-calls-and-path-in-os-x&quot;&gt;SO post&lt;/a&gt; which recommended updating the environment variable via PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;putenv(&quot;PATH={$_SERVER[&quot;PATH&quot;]}:/usr/local/mysql/bin&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding that line into &lt;code&gt;craft/config/general.php&lt;/code&gt; before the return statement did the trick for me. Craft does back up and Feed Me runs the feed successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT: Is that a good solution?&lt;/p&gt;&#xA;" OwnerUserId="8596" LastActivityDate="2018-07-18T11:35:43.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26929" PostTypeId="1" CreationDate="2018-07-18T16:11:48.410" Score="1" ViewCount="119" Body="&lt;p&gt;I created a field which uploads an image, and I want it to display it for each of my entries inside my for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the code I should use to do it?&lt;/p&gt;&#xA;" OwnerUserId="8559" LastActivityDate="2018-07-18T16:17:44.693" Title="How to display a featured image in the list of entries" Tags="&lt;templating&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26930" PostTypeId="2" ParentId="26929" CreationDate="2018-07-18T16:17:44.693" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% for element in elements %}&#xA;    {% set asset = element.assetFieldHandle.one() %}&#xA;    {% if asset is not null %}&#xA;        &amp;lt;img src=&quot;{{ asset.getUrl()&quot;&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQueries&lt;/a&gt; and &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#defensive-coding-in-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;how to handle errors&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-18T16:17:44.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26932" PostTypeId="1" CreationDate="2018-07-18T19:36:20.493" Score="1" ViewCount="55" Body="&lt;p&gt;I would like to update an entry after it has expired via a plugin. Is there an event that I can use to do this when using Craft 2? &lt;/p&gt;&#xA;" OwnerUserId="311" LastEditorUserId="57" LastEditDate="2018-07-18T21:37:02.573" LastActivityDate="2018-07-18T21:37:02.573" Title="Is there an event that is triggered when an entry expires?" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;expiration&gt;&lt;expired&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26933" PostTypeId="2" ParentId="26932" CreationDate="2018-07-18T19:54:50.737" Score="1" Body="&lt;p&gt;There is no event for this and it would not be possible via event since no one is executing any scripts. Unless there is a request there is no way for PHP to execute code on its own so you need to create a cronjob or a Craft task and execute your functions when someone visits the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would create a cronjob that executes hourly and search for expired entries in order to find them. You can store a value in a field that is not in the layout of the model to mark it as &quot;handled&quot; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-18T19:54:50.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26936" PostTypeId="2" ParentId="26913" CreationDate="2018-07-18T23:47:14.200" Score="1" Body="&lt;p&gt;Craft has a similar concept in the Control Panel for changing sensitive data like passwords/emails you could model called &lt;a href=&quot;https://craftcms.com/news/new-security-features&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;elevated sessions&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could write a custom plugin and your form could post to an action in a controller in your plugin, which could check if the phone number for that user has changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you'd prompt the user to enter their current password and either do something similar to Craft's &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php#L231-L239&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController-&gt;actionStartElevatedSession&lt;/a&gt;, if you need it to last for period of time, or just validate the password and let it go through once.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-18T23:47:14.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26937" PostTypeId="1" AcceptedAnswerId="26955" CreationDate="2018-07-19T02:41:09.393" Score="1" ViewCount="65" Body="&lt;p&gt;In Craft 3 if you use a &lt;a href=&quot;https://docs.craftcms.com/v3/date-time-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateTime field&lt;/a&gt; and have it set to time only, it still displays as a date in the Control Panel with no time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if it is used as a date and time field, just like entry post date it will only display time if it's on the current day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to modify this format to include the time in the control panel display? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ghBct.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ghBct.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-07-19T19:54:01.910" Title="Include Time In PostDate/DateTime Field Control Panel Display" Tags="&lt;datetime&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26938" PostTypeId="1" AcceptedAnswerId="26941" CreationDate="2018-07-19T07:25:42.927" Score="3" ViewCount="114" Body="&lt;p&gt;I have a website with Craft CMS 2 and this site has 2 diffrent languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no problem with sending e-mail for account activation for each language but when a user tries to activate his/her account via e-mail for my second language which is English they see English mail template but link directs them to my first and default language which is Turkish. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same problem with the &quot;Forgot my password&quot; link. I tried to add array to &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; for each local like &lt;code&gt;siteUrl&lt;/code&gt; but could not take any solution. Always directs to &lt;code&gt;tr&lt;/code&gt; locale after activation from English mail template.&lt;/p&gt;&#xA;" OwnerUserId="8599" LastEditorUserId="5557" LastEditDate="2018-07-19T15:54:58.213" LastActivityDate="2018-07-19T15:54:58.213" Title="User activation success page localization problem" Tags="&lt;users&gt;&lt;activation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26939" PostTypeId="2" ParentId="4653" CreationDate="2018-07-19T07:30:14.440" Score="1" Body="&lt;p&gt;&lt;em&gt;As Brad Bell mentioned in &lt;a href=&quot;https://craftcms.stackexchange.com/a/9629/5437&quot;&gt;this answer&lt;/a&gt;:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be that wherever Apache/PHP is configured to save session files doesn't exist or isn't writable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've got the &lt;a href=&quot;http://buildwithcraft.com/docs/config-settings#overridePhpSessionLocation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;overridePhpSessionLocation&lt;/code&gt;&lt;/a&gt; config setting set to &lt;code&gt;true&lt;/code&gt;, then that will be in &lt;code&gt;craft/storage/runtime/sessions&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2018-07-19T07:30:14.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26940" PostTypeId="1" AcceptedAnswerId="26943" CreationDate="2018-07-19T08:34:42.397" Score="2" ViewCount="45" Body="&lt;p&gt;I can't figure out why Craft won't display my plugin's changelog details as expandable version headers, like it does for other plugins. I assume there's something wrong with the formatting in my CHANGELOG.md file, but I can't spot it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below screenshot is how my CHANGELOG.md renders inside Craft's update utility – notice that the version headers aren't expandable, which means there's no way to actually read the details for each version update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fwDk2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fwDk2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The raw CHANGELOG markdown can be found here: &lt;a href=&quot;https://raw.githubusercontent.com/mmikkel/Retcon-Craft/master/CHANGELOG.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://raw.githubusercontent.com/mmikkel/Retcon-Craft/master/CHANGELOG.md&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;changelogUrl&lt;/code&gt; attribute in the plugin's &lt;a href=&quot;https://raw.githubusercontent.com/mmikkel/Retcon-Craft/master/composer.json&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;composer.json&lt;/code&gt;&lt;/a&gt; file is correct.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-19T10:58:09.990" Title="Why isn't Craft displaying my plugin's changelog details?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26941" PostTypeId="2" ParentId="26938" CreationDate="2018-07-19T08:41:36.453" Score="1" Body="&lt;p&gt;When you register/save the user you need to set their &lt;code&gt;preferredLocale&lt;/code&gt;, so Craft adjusts the verification URL sent with the activation email accordingly. Craft uses the primary locale for a user who doesn’t have a preferred locale set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this using a hidden input field in the registration form, or via a &lt;code&gt;users.beforeSaveUser&lt;/code&gt; event listener.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;preferredLocale&quot; value=&quot;{{ craft.locale }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once your users have a preferred locale set, your localized &lt;code&gt;activateAccountSuccessPath&lt;/code&gt; config should work.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-07-19T08:41:36.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26942" PostTypeId="1" CreationDate="2018-07-19T09:46:52.517" Score="1" ViewCount="1000" Body="&lt;p&gt;SEOmatic vs SEO plugin (&lt;a href=&quot;https://github.com/ethercreative/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ethercreative/seo&lt;/a&gt;) - which one is better? Ignoring the fact that one is paid and one is free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm creating a blog site and I need to also implement SEO related functionalities. &lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="57" LastEditDate="2018-08-23T04:05:45.677" LastActivityDate="2018-08-23T04:05:45.677" Title="Best SEO plugin for Craft CMS - SEOmatic vs SEO plugin" Tags="&lt;seo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26943" PostTypeId="2" ParentId="26940" CreationDate="2018-07-19T10:58:09.990" Score="3" Body="&lt;p&gt;It looks like you have some en dashes &lt;code&gt;–&lt;/code&gt; instead of hyphens &lt;code&gt;-&lt;/code&gt; in your CHANGELOG.md version headings. These are probably causing some parsing issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how there’s also no release date shown in the update utility.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-07-19T10:58:09.990" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26944" PostTypeId="1" CreationDate="2018-07-19T11:46:27.230" Score="1" ViewCount="606" Body="&lt;p&gt;I am trying to send data to my plug-in controller using jquery $.post() method.&#xA;here is my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;testForm&quot;&amp;gt;&#xA;  {{ csrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;test/test&quot;&amp;gt;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Test&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this is my js code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;   window.csrfTokenName = &quot;{{ craft.config.csrfTokenName|e('js') }}&quot;;&#xA;   window.csrfTokenValue = &quot;{{ craft.request.csrfToken|e('js') }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&amp;lt;script&amp;gt;&#xA;$(&quot;#testForm&quot;).submit(function (e) {&#xA;    e.preventDefault();&#xA;    var data = [];&#xA;    data[&quot;test&quot;] = &quot;test&quot;;&#xA;    data[csrfTokenName] = csrfTokenValue;&#xA;    $.post('/', data, function(response) {&#xA;        console.log(response);&#xA;    });&#xA;});&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The console keeps logging &quot;400 Bad Request&quot;.&#xA;What am I doing wrong ?&lt;/p&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2018-07-19T15:46:41.390" Title="Make an Ajax call to plug-in controller" Tags="&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26945" PostTypeId="1" CreationDate="2018-07-19T13:12:54.383" Score="1" ViewCount="1093" Body="&lt;p&gt;I have a problem with my page after upload on server. Currently a enabled devMode and while loading it shows &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;HTTP 503 – Service Unavailable – craft\web\ServiceUnavailableHttpException&lt;/strong&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;whatmore&lt;/strong&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;vendor/yiisoft/yii2/base/Application.php at line 386 – craft\web\Application::handleRequest(craft\web\Request)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;web.log below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][info][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=my_database;port=3306;&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][profile begin][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=my_database;port=3306;&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][profile end][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=my_database;port=3306;&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][error][craft\db\Connection::open] SQLSTATE[HY000] [2002] No such file or directory&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][error][craft\db\Connection::open] SQLSTATE[HY000] [2002] No such file or directory&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][info][yii\web\Session::open] Session started&#xA;  2018-07-19 07:11:06 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][error][yii\web\HttpException:503] craft\web\ServiceUnavailableHttpException in /path/to/public_html/www/vendor/craftcms/cms/src/web/Application.php:507&#xA;  Stack trace:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;0 /home/cluster-sites/3/t/toolmach.co.uk/public_html/www/vendor/craftcms/cms/src/web/Application.php(184): craft\web\Application-&gt;_processInstallRequest(Object(craft\web\Request))&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1 /home/cluster-sites/3/t/toolmach.co.uk/public_html/www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2 /home/cluster-sites/3/t/toolmach.co.uk/public_html/www/web/index.php(21): yii\base\Application-&gt;run()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3 {main}&#xA;  2018-07-19 07:11:07 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][trace][yii\base\View::renderFile] Rendering view file: /path/to/public_html/www/vendor/yiisoft/yii2/views/errorHandler/exception.php&#xA;  2018-07-19 07:11:07 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][trace][yii\base\View::renderFile] Rendering view file: /path/to/public_html/www/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php&#xA;  2018-07-19 07:11:07 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][trace][yii\base\View::renderFile] Rendering view file: /path/to/public_html/www/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php&#xA;  2018-07-19 07:11:07 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][trace][yii\base\View::renderFile] Rendering view file: /path/topublic_html/www/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php&#xA;  2018-07-19 07:11:07 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][trace][yii\base\View::renderFile] Rendering view file: /path/topublic_html/www/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php&#xA;  2018-07-19 07:11:05 [80.55.43.241][-][72baf4994c2e29ee1f32982349aec971][info][application] $_GET = []&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$_POST = []&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$_FILES = []&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8600" LastEditorUserId="57" LastEditDate="2018-07-19T20:02:37.817" LastActivityDate="2018-08-18T21:00:22.507" Title="HTTP 503 – Service Unavailable – craft\web\ServiceUnavailableHttpException" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26946" PostTypeId="2" ParentId="26945" CreationDate="2018-07-19T13:34:54.160" Score="1" Body="&lt;p&gt;This isn't a direct answer to your question, but the first place I'd look is your logs on your server. As an example, I'm running nginx on my server and the logs are located in &lt;code&gt;/var/log/nginx/&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2018-07-19T13:34:54.160" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26947" PostTypeId="1" AcceptedAnswerId="26981" CreationDate="2018-07-19T15:30:58.803" Score="2" ViewCount="136" Body="&lt;p&gt;I am looking for a way to add new locale files or override existing ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically a Craft 3 version of this: &lt;a href=&quot;https://craftcms.com/support/adding-additional-locales&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/adding-additional-locales&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the way described here: &lt;a href=&quot;https://github.com/craftcms/locales&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/locales&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that does not seem to be picked up by Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8601" LastActivityDate="2018-07-20T20:37:05.200" Title="Adding or overriding locales in Craft 3" Tags="&lt;craft3&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26948" PostTypeId="2" ParentId="26944" CreationDate="2018-07-19T15:46:41.390" Score="1" Body="&lt;p&gt;You need to define a route via action param otherwise Craft has no idea where to route the request. Your &lt;code&gt;data&lt;/code&gt; variable only only contains&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = [&#xA;    'test' =&amp;gt; 'test',&#xA;    TOKEN_NAME =&amp;gt; TOKEN_VALUE&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and nothing else&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to include &lt;code&gt;action =&amp;gt; plugin-handle/controller-id/function-name&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a working example at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/24166/basic-ajax-how-to/24167#24167&quot;&gt;basic ajax how to&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-19T15:46:41.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26950" PostTypeId="1" AcceptedAnswerId="26954" CreationDate="2018-07-19T16:24:29.880" Score="2" ViewCount="249" Body="&lt;p&gt;Any idea why this code wouldn’t update/break the cache when new items are created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think perhaps the combination of my code for pagination, cache and the ability to also break for pending entries isn't correct and throwing it off...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # NEWS LISTING TEMPLATE&#xA; # ---------------&#xA; #}&#xA;&#xA;{% extends &quot;_layouts/main&quot; %}&#xA;&#xA;{# Get the most soonest upcoming pending entry for Cache breaking #}&#xA;{% set firstPending = craft.entries({&#xA;  section: 'news',&#xA;  status: 'pending',&#xA;  order: 'postDate asc'&#xA;}).first %}&#xA;{% set cacheUntil = firstPending ? firstPending.postDate : now|date_modify('+1 year') %}&#xA;&#xA;{% set entries = craft.entries({&#xA;  section: 'news',&#xA;  order: 'postDate desc',&#xA;  limit: 6&#xA;}) %}&#xA;&#xA;{# Get the articles and paginate them #}&#xA;{% paginate entries as pageInfo, pageEntries %}&#xA;&#xA;{% block main %}&#xA;{% cache globally using key craft.request.path until cacheUntil %}&#xA;&amp;lt;div class=&quot;sitecontainer&quot;&amp;gt;&#xA;  &amp;lt;h1 class=&quot;border-bottom&quot;&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;  {% for entry in pageEntries %}&#xA;  &amp;lt;article class=&quot;leading-normal mb-8&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;sm:flex sm:items-center mb-8 pb-6 {% if not loop.last %}border-b border-grey-light{% endif %}&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;bg-petrol relative text-lime p-4 sm:w-40&quot;&amp;gt;&#xA;         &amp;lt;time datetime=&quot;{{ entry.postDate|date('Y-m-d H:i:s') }}&quot; class=&quot; text-center mb-0 relative z-30 text-sm&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;mx-auto fill-current w-6 h-6 mb-2&quot;&amp;gt;&#xA;            {% include '_includes/svg/icon-date.svg' %}&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div&amp;gt;&#xA;            {{ helpers.dateFormatted(entry.postDate) }}&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/time&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;p-4 flex-1&quot;&amp;gt;&#xA;        &amp;lt;h2 class=&quot;flex // flex-wrap items-center border-grey // text-base leading-normal font-semibold mb-1&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            {{ entry.title }}&#xA;          &amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h2&amp;gt;&#xA;        &amp;lt;p class=&quot;mb-0 text-base&quot;&amp;gt;&#xA;          &amp;lt;a href=&quot;{{ entry.url }}&quot; class=&quot;arrow font-normal text-lime hover:text-blue&quot;&amp;gt;view news&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/p&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/article&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;{% endcache %}&#xA;&#xA;{% include '_includes/partials/pagination' %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-07-19T19:48:10.613" Title="Cache not invalidating when using pagination with cache" Tags="&lt;cache&gt;&lt;pagination&gt;&lt;pending&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26951" PostTypeId="1" CreationDate="2018-07-19T16:26:45.597" Score="1" ViewCount="24" Body="&lt;p&gt;I have created a Custom FieldType with &lt;code&gt;AttributeType::Mixed&lt;/code&gt; The field actually saves the a Custom Model I created. I'm trying to retrieve all the entries that have my custom model as the field. I'm trying to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&#xA;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;// testOrPanel is the name of my custom fieldtype.&#xA;$criteria-&amp;gt;testOrPanel = ModelHelper::packageAttributeValue($test);&#xA;$entry = $criteria-&amp;gt;first();&#xA;-&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know for a fact that the entry exists and has that value. and I have logged the ModelHelper result and it is exactly what the field has on the db, but it is not working.&#xA;it is resulting in blank.&lt;/p&gt;&#xA;" OwnerUserId="8517" LastActivityDate="2018-07-19T16:26:45.597" Title="Get Entries with a specified. Custom FieldType" Tags="&lt;elementcriteriamodel&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26952" PostTypeId="1" CreationDate="2018-07-19T17:55:58.093" Score="1" ViewCount="27" Body="&lt;p&gt;I'm running Craft 3 with multi-site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working well so far, but my hosting doesn't allow me to create traditional vhosts with their own directories and shared upper filesystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such I have an htaccess at my webroot which rewrites the URL based on the subdomain being used.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foo.website.com -&amp;gt; server/web/foo&#xA;bar.website.com -&amp;gt; server/web/bar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works, but it means the script filenames are actually rendered into the CP URLS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my CP URLs are rendering the server path to the script file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;foo.website.com/foo/admin/...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want Craft to think the CP URL is just &lt;code&gt;foo.website.com/admin&lt;/code&gt; since this loads correctly with the rewrite rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the URL helper, it seems to add the script filename in either way. Is there a way around it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8603" LastActivityDate="2018-07-19T17:55:58.093" Title="Craft 3: Prevent craft adding script filename to URLS" Tags="&lt;craft3&gt;&lt;control-panel&gt;&lt;url&gt;&lt;htaccess&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26953" PostTypeId="1" AcceptedAnswerId="26984" CreationDate="2018-07-19T18:05:02.380" Score="3" ViewCount="312" Body="&lt;p&gt;Craft 3.0.16.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a relationship that is outputting entries, but the entries are not in the order as selected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# not sorting correctly  - **fieldName** is a variable passed via include #}&#xA;{% set relatedEntries = publications.relatedTo(&#xA;  {sourceElement: country, field: fieldName}&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I copied this &lt;a href=&quot;https://docs.craftcms.com/v3/entries-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;code from the documentation&lt;/a&gt; and change field names to work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# copied from docs but template errors #}&#xA;{% set relatedEntries = craft.entries({&#xA;    relatedTo: { sourceElement: country, field: fieldName },&#xA;    orderBy:     &quot;sortOrder&quot;,&#xA;    limit:     null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this throws a database exception error&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sortOrder' in&#xA;  'order clause'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I get related entries to sort on the order as selected in the entries field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;********************UPDATE**********************&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HERE IS THE FULL TEMPLATE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &amp;lt;li class=&quot;accordion-item {#{% if loop.first %}is-active{% endif %}#}&quot; data-accordion-item&amp;gt;&#xA;    &amp;lt;!-- Accordion tab title --&amp;gt;&#xA;    &amp;lt;a href=&quot;#&quot; class=&quot;accordion-title&quot;&amp;gt;&#xA;      {{ categoryTitle  }}&#xA;      &amp;lt;i class=&quot;icon-chevron-right&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;!-- /.arrow right --&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;!-- Accordion tab content: it would start in the open state due to using the `is-active` state class. --&amp;gt;&#xA;    &amp;lt;div class=&quot;accordion-content&quot; data-tab-content&amp;gt;&#xA;&#xA;      {# start tabbed content #}&#xA;      &amp;lt;ul class=&quot;tabs&quot; data-tabs id=&quot;cat-{{ hash }} &quot;&amp;gt;&#xA;&#xA;       {# inside categories list countries #}&#xA;      {% for country in countries.all() %}  &#xA;        &amp;lt;li class=&quot;tabs-title {#{% if loop.first %}is-active{% endif %}#}&quot;&amp;gt;&amp;lt;a href=&quot;#{{ country.slug }}&quot; aria-selected=&quot;true&quot; data-tabs-target=&quot;{{ country.slug }}&quot;&amp;gt;{{ country.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %} {# end countries loop #}&#xA;      &amp;lt;/ul&amp;gt;&#xA;&#xA;&#xA;      &amp;lt;div class=&quot;tabs-content&quot; data-tabs-content=&quot;cat-{{ hash }}&quot;&amp;gt;&#xA;        {% for country in countries.all() %}&#xA;        &amp;lt;div class=&quot;tabs-panel {#{% if loop.first %}is-active{% endif %}#}&quot; id=&quot;{{ country.slug }}&quot;&amp;gt;&#xA;          &amp;lt;ul class=&quot;no-bullet pubs full-width&quot;&amp;gt;&#xA;&#xA;            {# finally output entries that are in the category and country #}&#xA;&#xA;            {# not sorting correctly #}&#xA;            {% set relatedEntries = publications.relatedTo(                   {sourceElement: country, field: fieldName}&#xA;            ) %}&#xA;&#xA;            {# error about method ('all') on an array #}&#xA;            {# {% set relatedEntries = country[fieldName].all() %} #}&#xA;&#xA;            {# &#xA;            // copied from docs but template errors&#xA;            {% set relatedEntries = craft.entries({&#xA;                relatedTo: { sourceElement: country, field: fieldName },&#xA;                orderBy:     &quot;sortOrder&quot;,&#xA;                limit:     null&#xA;            }) %} #}&#xA;&#xA;&#xA;&#xA;            {% for entry in relatedEntries.all() %}&#xA;&#xA;              {% for block in entry.Documents.all() %}&#xA;                {% if block.externalLink|length %}&#xA;                  {# use external link field #}&#xA;                  {% set link = block.externalLink %}&#xA;                {% else %}&#xA;                  {# use uploaded file #}&#xA;                  {% set link = block.pdfOrFile.one().url ?? null%}&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ link }}&quot; target=&quot;_blank&quot;&amp;gt;&#xA;                  &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;                  &amp;lt;div class=&quot;icon-holder&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;/assets/img/next.svg&quot; alt=&quot;&quot; class=&quot;go-icon&quot;&amp;gt;&#xA;                  &amp;lt;/div&amp;gt;&amp;lt;!-- /.icon-holder --&amp;gt;&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;              {% endfor %}{#end link #}&#xA;&#xA;              {% else %}&#xA;              {# output nothing for no results #}&#xA;            {% endfor %}&#xA;&#xA;          &amp;lt;/ul&amp;gt;&amp;lt;!-- /.no-bullet pubs --&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;      {# end tabbed content #}      &#xA;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!--accordion content--&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2018-07-24T13:15:14.873" LastActivityDate="2018-07-24T14:44:07.207" Title="Related Entries not sorting correctly" Tags="&lt;entries-field&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26954" PostTypeId="2" ParentId="26950" CreationDate="2018-07-19T19:38:45.900" Score="2" Body="&lt;p&gt;One issue I'm seeing, is that you're currently using &lt;code&gt;craft.request.path&lt;/code&gt; as your cache &lt;code&gt;key&lt;/code&gt; – however, that property doesn't actually include the pagination segment (i.e. the &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;pageTrigger&lt;/code&gt;&lt;/a&gt;; &lt;code&gt;p2&lt;/code&gt;, &lt;code&gt;p3&lt;/code&gt; or the like), which means that you're currently going to see the same, cached content across all of your pages, because you're caching &lt;code&gt;globally&lt;/code&gt; using an identical key (i.e. the root URI of your paginated template).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 2, AFAIK there's no single property or method on the &lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-httprequestservice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;HttpRequestService&lt;/a&gt; that will give you the full URL including the pagination segment – so you'll need to append the pagination number using &lt;code&gt;craft.request.getPageNum()&lt;/code&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.request.path ~ craft.request.getPageNum() until cacheUntil %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Craft 3, there's &lt;code&gt;craft.app.request.getFullPath()&lt;/code&gt;, which does include the pagination segment – so the following should do the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache globally using key craft.app.request.getFullPath() until cacheUntil %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as your solution for breaking the cache whenever &quot;pending&quot; entries are published, I'm not sure, but I'm not seeing any problems with it, at a glance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why you're not seeing the cache cleared when you create new entries, is probably because your second &lt;code&gt;craft.entries&lt;/code&gt; query (the one that actually fetches the entries) is &lt;em&gt;outside&lt;/em&gt; your &lt;code&gt;{% cache %}&lt;/code&gt; tag (this would be a performance issue as well; your current code isn't really caching anything, except a bit of not too demanding Twig code). You should probably move the second &lt;code&gt;craft.entries&lt;/code&gt; query, the &lt;code&gt;{% paginate %}&lt;/code&gt; tag and the &lt;code&gt;{% include '_includes/partials/pagination' %}&lt;/code&gt; statement &lt;em&gt;inside&lt;/em&gt; the &lt;code&gt;{% cache %}&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you might want to re-think having a default cache duration of 1 year – that's a &lt;em&gt;long&lt;/em&gt; time, and if your site builds up a lot of pages, it could balloon your database and possibly cause issues with stalled &lt;code&gt;Deleting state template caches&lt;/code&gt; tasks. My advice would be to keep the duration to something sane like 1 month, max – there's little point in keeping year-old caches around, normally :)&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-19T19:48:10.613" LastActivityDate="2018-07-19T19:48:10.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26955" PostTypeId="2" ParentId="26937" CreationDate="2018-07-19T19:54:01.910" Score="2" Body="&lt;p&gt;There's a plugin for Craft 2 that did this called &lt;a href=&quot;https://github.com/pixelandtonic/BigDates&quot; rel=&quot;nofollow noreferrer&quot;&gt;BigDates&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of 7/19/2018, it's been ported to Craft 3 on the v2 branch, but not tested or added to the Plugin Store yet, so there might still be some issues: &lt;a href=&quot;https://github.com/pixelandtonic/BigDates/tree/v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/BigDates/tree/v2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-19T19:54:01.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26956" PostTypeId="2" ParentId="22729" CreationDate="2018-07-19T21:42:51.637" Score="1" Body="&lt;p&gt;You could just create javascript/jQuery validation for your form(s). And whenever the form is submitted or the submit button clicked, validate your fields however you like, and don't submit if they're invalid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This avoids a trip to the server, so it's also faster and a better UX for users. Of course it wouldn't provide any server side validation, or admin validation. But if all you care about is people not submitting orders without a phone number, it should suffice... And much easier than creating a plugin if you're not already familiar with plugin development.&lt;/p&gt;&#xA;" OwnerUserId="8604" LastActivityDate="2018-07-19T21:42:51.637" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26958" PostTypeId="1" AcceptedAnswerId="26960" CreationDate="2018-07-20T07:48:34.700" Score="2" ViewCount="386" Body="&lt;p&gt;I'm building a plugin in which I would like to use a vendor library, but just adding it to the plugin's composer.json file doesn't seem to be enough to get it installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works when I run composer update in the plugin's root dir but I was hoping there would be a way to have it automatically installed when the plugin is installed?&lt;/p&gt;&#xA;" OwnerUserId="7577" LastEditorUserId="57" LastEditDate="2018-07-20T20:09:50.103" LastActivityDate="2018-07-20T20:09:50.103" Title="Require vendors in custom plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26959" PostTypeId="1" AcceptedAnswerId="26961" CreationDate="2018-07-20T08:24:52.820" Score="2" ViewCount="137" Body="&lt;p&gt;The &lt;code&gt;currentUser.unverifiedEmail&lt;/code&gt; variable, which is public, is always empty on front end even after email change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought it was a bug. I contacted Craft support about this, and here is Brad's answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That's expected behavior... the default UserQuery (which is what {{&#xA;  currentUser }} is) only grabs a small subset of columns in it's select&#xA;  to avoid exposing potentially sensitive user account information&#xA;  throughout the system.&#xA;  &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/elements/db/UserQuery.php#L310-L325&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you want anything outside of that, you'll have to query for the&#xA;  data directly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried this custom query:&#xA;&lt;code&gt;{{ craft.users.id(currentUser.id).one().unverifiedEmail }}&lt;/code&gt;.&#xA;But even after requesting an email change, the value remain empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to make this query from Twig?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="5557" LastEditDate="2018-07-20T08:53:36.957" LastActivityDate="2018-07-20T08:53:36.957" Title="How to get the unverifiedEmail value of a user after a change email request?" Tags="&lt;craft3&gt;&lt;users&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26960" PostTypeId="2" ParentId="26958" CreationDate="2018-07-20T08:33:52.787" Score="1" Body="&lt;p&gt;When you include the library as required in your composer file, Craft will automatically download the package and install it in the global &lt;code&gt;vendor&lt;/code&gt; directory rather than in your plugin directory (since both are inside the &lt;code&gt;vendor&lt;/code&gt; folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't have to include it and you don't have to take care for certain other plugins that require the same one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process is done while running &lt;code&gt;composer install &amp;gt;&amp;gt;yourplugin&amp;lt;&amp;lt;&lt;/code&gt; or &lt;code&gt;composer update&lt;/code&gt; so everytime you make a Craft update it will search for new required libraries in your plugin but it won't do it during the installation of your plugin since every library should already exist - unless you add the dependency after your composer action -&gt; &lt;code&gt;composer update&lt;/code&gt; will solve it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-20T08:33:52.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26961" PostTypeId="2" ParentId="26959" CreationDate="2018-07-20T08:41:09.760" Score="2" Body="&lt;p&gt;You need to select the value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set user = craft.users&#xA;    .id(currentUser.id)&#xA;    .addSelect(['users.unverifiedEmail'])&#xA;    .one()&#xA;%}&#xA;{{ user.unverifiedEmail }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-20T08:41:09.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26962" PostTypeId="1" AcceptedAnswerId="26963" CreationDate="2018-07-20T10:15:28.083" Score="2" ViewCount="86" Body="&lt;p&gt;Up till now, all my craft sites were single language. When including CSS and JS files from &lt;code&gt;web&lt;/code&gt; folder, i used to use &lt;code&gt;{{siteUrl}}&lt;/code&gt; variable, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src='{{siteUrl}}/plugins/jquery.js'&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Such path was rendered to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src='http://website.com/plugins/jquery.js'&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunetly, on multilanguage websites, where different languages have different url path (site.com and site.com/en), &lt;code&gt;{{siteUrl}}&lt;/code&gt; variable changes and paths to these files are incorrectly rendered, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src='http://website.com/en/plugins/jquery.js'&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What variable can i use that will give me path to web folder - regardless of currently used language?&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="57" LastEditDate="2018-07-20T20:12:25.580" LastActivityDate="2018-07-20T20:12:25.580" Title="Including CSS and JS files on multilanguage sites" Tags="&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26963" PostTypeId="2" ParentId="26962" CreationDate="2018-07-20T10:27:36.740" Score="3" Body="&lt;p&gt;Use the alias instead &lt;code&gt;{{ alias('@web') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will always point to your &lt;code&gt;web&lt;/code&gt; directory &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-20T10:27:36.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26964" PostTypeId="1" AcceptedAnswerId="27069" CreationDate="2018-07-20T10:34:43.693" Score="2" ViewCount="81" Body="&lt;p&gt;I am creating a Craft 3 plugin. It seems to work fine when editing regular entries but when I open a revision the JS I'm injecting using the below doesn't appear on the page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view-&amp;gt;registerJs($js, View::POS_HEAD);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does work on regular entries. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="8606" LastActivityDate="2018-07-27T17:30:23.933" Title="Craft 3 Field Plugin not firing $view-&gt;registerJs in entry versions" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26965" PostTypeId="1" AcceptedAnswerId="26978" CreationDate="2018-07-20T10:40:28.513" Score="7" ViewCount="9629" Body="&lt;p&gt;I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;in /Applications/MAMP/htdocs/craft/vendor/craftcms/cms/src/web/Application.php at line 498&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;in /Applications/MAMP/htdocs/craft/vendor/craftcms/cms/src/web/Application.php at line 175 – craft\web\Application::_processInstallRequest(craft\web\Request)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;in /Applications/MAMP/htdocs/craft/vendor/yiisoft/yii2/base/Application.php at line 386 – craft\web\Application::handleRequest(craft\web\Request)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;in /Applications/MAMP/htdocs/craft/web/index.php at line 21 – yii\base\Application::run()&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8607" LastEditorUserId="5557" LastEditDate="2018-07-20T16:28:10.240" LastActivityDate="2020-09-10T20:03:41.893" Title="HTTP 503 – Service Unavailable – craft\web\ServiceUnavailableHttpException [installation]" Tags="&lt;installation&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26966" PostTypeId="1" AcceptedAnswerId="26982" CreationDate="2018-07-20T10:41:42.033" Score="5" ViewCount="4084" Body="&lt;p&gt;Using Craft 3 and recently installed the &lt;a href=&quot;https://github.com/supercool/tablemaker&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/supercool/tablemaker&lt;/a&gt; plugin.&#xA;When I try to update Craft via the Control panel now I am getting the following error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error: An error occurred&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Output: Loading composer repositories with package information &#xA;  Updating dependencies &#xA;  Your requirements could not be resolved to an installable set of packages.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Problem 1&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;Installation request for craftcms/cms 3.0.16.1 -&gt; satisfiable by craftcms/cms[3.0.16.1].&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;craftcms/cms 3.0.16.1 requires twig/twig ^2.5.0 -&gt; satisfiable by twig/twig[v2.5.0] but these conflict with your requirements or minimum-stability.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Problem 2&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;supercool/tablemaker 2.0.1 requires craftcms/cms ^3.0.0-RC1 -&gt; satisfiable by craftcms/cms[3.0.16.1].&lt;/li&gt;&#xA;  &lt;li&gt;supercool/tablemaker 2.0.1 requires craftcms/cms ^3.0.0-RC1 -&gt; satisfiable by craftcms/cms[3.0.16.1].&lt;/li&gt;&#xA;  &lt;li&gt;craftcms/cms 3.0.16.1 requires twig/twig ^2.5.0 -&gt; satisfiable by twig/twig[v2.5.0] but these conflict with your requirements or minimum-stability.&lt;/li&gt;&#xA;  &lt;li&gt;Installation request for supercool/tablemaker 2.0.1 -&gt; satisfiable by supercool/tablemaker[2.0.1].&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;  &quot;keywords&quot;: [&#xA;    &quot;craft&quot;,&#xA;    &quot;cms&quot;,&#xA;    &quot;craftcms&quot;,&#xA;    &quot;project&quot;&#xA;  ],&#xA;  &quot;license&quot;: &quot;MIT&quot;,&#xA;  &quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;  &quot;type&quot;: &quot;project&quot;,&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;    &quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;    &quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;    &quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;    &quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;    &quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.15&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;v2.4.0&quot;,&#xA;    &quot;verbb/image-resizer&quot;: &quot;2.0.3&quot;,&#xA;    &quot;verbb/super-table&quot;: &quot;2.0.7&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.1.2&quot;,&#xA;    &quot;ether/simplemap&quot;: &quot;3.3.3&quot;,&#xA;    &quot;doublesecretagency/craft-cpcss&quot;: &quot;2.1.0&quot;,&#xA;    &quot;doublesecretagency/craft-cpjs&quot;: &quot;2.1.0&quot;,&#xA;    &quot;mikestecker/craft-videoembedder&quot;: &quot;1.0.9&quot;,&#xA;    &quot;topshelfcraft/wordsmith&quot;: &quot;3.0.2&quot;,&#xA;    &quot;xpertbot/craft-wheelform&quot;: &quot;1.9.0&quot;,&#xA;    &quot;cebe/markdown&quot;: &quot;1.1.2&quot;,&#xA;    &quot;composer/ca-bundle&quot;: &quot;1.1.1&quot;,&#xA;    &quot;composer/composer&quot;: &quot;1.6.3&quot;,&#xA;    &quot;composer/semver&quot;: &quot;1.4.2&quot;,&#xA;    &quot;composer/spdx-licenses&quot;: &quot;1.4.0&quot;,&#xA;    &quot;craftcms/oauth2-craftid&quot;: &quot;1.0.0.1&quot;,&#xA;    &quot;craftcms/plugin-installer&quot;: &quot;1.5.2&quot;,&#xA;    &quot;craftcms/server-check&quot;: &quot;1.1.1&quot;,&#xA;    &quot;creocoder/yii2-nested-sets&quot;: &quot;0.9.0&quot;,&#xA;    &quot;danielstjules/stringy&quot;: &quot;3.1.0&quot;,&#xA;    &quot;davechild/textstatistics&quot;: &quot;1.0.1&quot;,&#xA;    &quot;doctrine/lexer&quot;: &quot;v1.0.1&quot;,&#xA;    &quot;egulias/email-validator&quot;: &quot;2.1.4&quot;,&#xA;    &quot;elvanto/litemoji&quot;: &quot;1.4.0&quot;,&#xA;    &quot;embed/embed&quot;: &quot;v3.3.3&quot;,&#xA;    &quot;enshrined/svg-sanitize&quot;: &quot;0.8.2&quot;,&#xA;    &quot;erusev/parsedown&quot;: &quot;1.7.1&quot;,&#xA;    &quot;erusev/parsedown-extra&quot;: &quot;0.7.1&quot;,&#xA;    &quot;ezyang/htmlpurifier&quot;: &quot;v4.10.0&quot;,&#xA;    &quot;guzzlehttp/guzzle&quot;: &quot;6.3.3&quot;,&#xA;    &quot;guzzlehttp/promises&quot;: &quot;v1.3.1&quot;,&#xA;    &quot;guzzlehttp/psr7&quot;: &quot;1.4.2&quot;,&#xA;    &quot;icanboogie/inflector&quot;: &quot;v1.4.4&quot;,&#xA;    &quot;justinrainbow/json-schema&quot;: &quot;5.2.7&quot;,&#xA;    &quot;league/flysystem&quot;: &quot;1.0.45&quot;,&#xA;    &quot;league/oauth2-client&quot;: &quot;2.2.1&quot;,&#xA;    &quot;lsolesen/pel&quot;: &quot;0.9.6&quot;,&#xA;    &quot;masterminds/html5&quot;: &quot;2.3.0&quot;,&#xA;    &quot;mikehaertl/php-shellcommand&quot;: &quot;1.2.5&quot;,&#xA;    &quot;mofodojodino/profanity-filter&quot;: &quot;1.3.0&quot;,&#xA;    &quot;mundschenk-at/php-typography&quot;: &quot;v6.1.5&quot;,&#xA;    &quot;paragonie/random_compat&quot;: &quot;v2.0.14&quot;,&#xA;    &quot;pixelandtonic/imagine&quot;: &quot;v0.7.1.3&quot;,&#xA;    &quot;psr/http-message&quot;: &quot;1.0.1&quot;,&#xA;    &quot;psr/log&quot;: &quot;1.0.2&quot;,&#xA;    &quot;seld/cli-prompt&quot;: &quot;1.0.3&quot;,&#xA;    &quot;seld/jsonlint&quot;: &quot;1.7.1&quot;,&#xA;    &quot;seld/phar-utils&quot;: &quot;1.0.1&quot;,&#xA;    &quot;swiftmailer/swiftmailer&quot;: &quot;v6.0.2&quot;,&#xA;    &quot;symfony/console&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/debug&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/filesystem&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/finder&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/polyfill-mbstring&quot;: &quot;v1.8.0&quot;,&#xA;    &quot;symfony/process&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;tcb13/substringy&quot;: &quot;1.0.0&quot;,&#xA;    &quot;twig/twig&quot;: &quot;v2.4.8&quot;,&#xA;    &quot;yiisoft/yii2&quot;: &quot;2.0.15.1&quot;,&#xA;    &quot;yiisoft/yii2-bootstrap&quot;: &quot;2.0.8&quot;,&#xA;    &quot;yiisoft/yii2-composer&quot;: &quot;2.0.6&quot;,&#xA;    &quot;yiisoft/yii2-debug&quot;: &quot;2.0.13&quot;,&#xA;    &quot;yiisoft/yii2-queue&quot;: &quot;2.0.2&quot;,&#xA;    &quot;yiisoft/yii2-swiftmailer&quot;: &quot;2.1.1&quot;,&#xA;    &quot;zendframework/zend-escaper&quot;: &quot;2.6.0&quot;,&#xA;    &quot;zendframework/zend-feed&quot;: &quot;2.8.0&quot;,&#xA;    &quot;zendframework/zend-stdlib&quot;: &quot;3.2.0&quot;,&#xA;    &quot;ether/seo&quot;: &quot;v3.2.8&quot;,&#xA;    &quot;pennebaker/craft-architect&quot;: &quot;2.2.9&quot;,&#xA;    &quot;verbb/feed-me&quot;: &quot;3.0.0-beta.15&quot;,&#xA;    &quot;supercool/tablemaker&quot;: &quot;2.0.1&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@composer dump-autoload -o&quot;,&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="622" LastEditorUserId="622" LastEditDate="2018-07-20T22:44:51.520" LastActivityDate="2018-07-27T11:44:48.167" Title="Composer was unable to install the updates" Tags="&lt;updates&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26967" PostTypeId="1" AcceptedAnswerId="26968" CreationDate="2018-07-20T11:31:36.337" Score="2" ViewCount="86" Body="&lt;p&gt;My plugin is sort of an extension for the Craft Commerce, where I need to provide custom data on the craft commerce orders page.&lt;br&gt;&#xA;So I'm wondering is there a way to listen for an event, which fires when an admin navigates to the Orders page?&lt;br&gt;&#xA;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="6956" LastEditorUserId="6956" LastEditDate="2018-07-22T18:05:58.403" LastActivityDate="2018-07-22T18:05:58.403" Title="Craft 2: Is there a hook for Craft Commerce Orders admin page?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26968" PostTypeId="2" ParentId="26967" CreationDate="2018-07-20T11:37:35.787" Score="1" Body="&lt;p&gt;Ok, I got a solution. In my plugin's &lt;code&gt;init&lt;/code&gt; function I've done the following hook:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;templates-&amp;gt;hook('cp.commerce.order.edit.main-pane', function (&amp;amp;$context) { ... }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there is more 'elegant' solution, please shoot.&lt;br&gt;&#xA;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="6956" LastEditorUserId="6956" LastEditDate="2018-07-20T11:45:49.233" LastActivityDate="2018-07-20T11:45:49.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26970" PostTypeId="1" CreationDate="2018-07-20T14:19:27.480" Score="1" ViewCount="69" Body="&lt;p&gt;I currently have a Craft Commerce site where the product url is setup like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{productCategory.level(1).first().slug}/{productCategory.level(2).first().slug}/{productCategory.level(3).first().slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this gives an example url of &lt;code&gt;category1/category2/category3/my-product&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all works fine. What I'd like to do is add an optional segment onto the end of this url, so for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;category1/category2/category3/my-product/optional-thing&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like the current urls to continue working, but if you add the extra &lt;code&gt;optional-thing&lt;/code&gt; segment to the url you also get the same product. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately this is so that I can preselect a variant in a carousel on the product detail page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried doing this with routes, but so far I've been unsuccessful. Is this the right approach or is there a better, more Commerce specific way?&lt;/p&gt;&#xA;" OwnerUserId="142" LastActivityDate="2018-07-20T14:19:27.480" Title="Add optional segment to Craft Commerce product Url" Tags="&lt;plugin-craftcommerce&gt;&lt;routes&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26971" PostTypeId="2" ParentId="20133" CreationDate="2018-07-20T14:54:54.760" Score="3" Body="&lt;p&gt;Following from Brad's answer (I'm not able to comment) I had to escape the backslashes to avoid JSON decode error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Version for Youtube and Vimeo&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;HTML.SafeIframe&quot;: true,&#xA;    &quot;URI.SafeIframeRegexp&quot;: &quot;%^(https?:)?//(www\\.youtube(?:-nocookie)?\\.com/embed/|player\\.vimeo\\.com/video/)%&quot;,&#xA;    &quot;Attr.AllowedFrameTargets&quot;: [&quot;_blank&quot;],&#xA;    &quot;HTML.AllowedComments&quot;: [&quot;pagebreak&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or just YouTube&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;HTML.SafeIframe&quot;: true,&#xA;    &quot;URI.SafeIframeRegexp&quot;: &quot;%^(https?:)?//(www\\.youtube(?:-nocookie)?\\.com/embed/)%&quot;,&#xA;    &quot;Attr.AllowedFrameTargets&quot;: [&quot;_blank&quot;],&#xA;    &quot;HTML.AllowedComments&quot;: [&quot;pagebreak&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6526" LastActivityDate="2018-07-20T14:54:54.760" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26972" PostTypeId="1" CreationDate="2018-07-20T16:02:28.593" Score="3" ViewCount="445" Body="&lt;p&gt;I want to load a .css file &lt;strong&gt;only&lt;/strong&gt; in a certain page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the magic code I need?&lt;/p&gt;&#xA;" OwnerUserId="8559" LastEditorUserId="57" LastEditDate="2018-07-20T20:27:46.037" LastActivityDate="2020-08-15T11:14:57.110" Title="Load a specific file/CSS only in a certain page" Tags="&lt;templating&gt;&lt;css&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26974" PostTypeId="1" AcceptedAnswerId="26993" CreationDate="2018-07-20T16:27:09.430" Score="5" ViewCount="868" Body="&lt;p&gt;I am trying to filter using categories. I have to filters type and size, in the url.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/products.html?size=medium,large&amp;amp;type=polo-shirt,jeans&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my template, I am doing the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sizes = craft.app.request.getQueryParam('size') %}&#xA;{% set types = craft.app.request.getQueryParam('type') %}&#xA;&#xA;{% set relationParam = ['and'] %}&#xA;&#xA;{# type #}&#xA;{% if types %}&#xA;  {% for i in types|split(&quot;,&quot;) %}&#xA;    {% set type = craft.categories.group('types').slug(i) %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: type }]) %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;{# sizes #}&#xA;{% if sizes %}&#xA;  {% for i in sizes|split(&quot;,&quot;) %}&#xA;    {% set size = craft.categories.group('sizes').slug(i) %}&#xA;    {% set relationParam = relationParam|merge([{ targetElement: size }]) %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;{# Avoid passing an array with `['and']` only #}&#xA;{% if relationParam|length &amp;lt; 2 %}&#xA;  {% set relationParam = '' %}&#xA;{% endif %}&#xA;&#xA;{% set entries = craft.entries({&#xA;    section: 'products',&#xA;    relatedTo:  relationParam&#xA;}) %}&#xA;&#xA;&amp;lt;div class=&quot;listings-container&quot;&amp;gt;&#xA;  {% if entries|length %}&#xA;    {% for entry in entries %}&#xA;        {% include &quot;partials/_listing.html&quot; %}&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I click on “medium” in sizes, it shows all products that have the category “medium”&lt;/li&gt;&#xA;&lt;li&gt;I then, click on “large” in sizes, it shows one result because it’s searching for products that have all 2 categories (“medium”, “large”)&lt;/li&gt;&#xA;&lt;li&gt;I then click on &quot;polo-shirt&quot; in types, this now shows all products that have all 3 categories (“medium”, “large&quot;, &quot;polo-shirt&quot;)&lt;/li&gt;&#xA;&lt;li&gt;I then click on “jeans” in sizes, this now shows no results as its trying to find products that have all 4 categories (“medium”, “large&quot;, &quot;polo-shirt&quot;, &quot;jeans&quot;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I am trying to achieve is find all the products that are “medium” or “large&quot; sizes and of &quot;polo-shirt&quot; or “jeans” types&lt;/p&gt;&#xA;" OwnerUserId="8597" LastEditorUserId="57" LastEditDate="2018-07-20T20:25:55.193" LastActivityDate="2018-07-22T14:25:46.257" Title="Filtering multiple categories with URL queries" Tags="&lt;categories&gt;&lt;relations&gt;&lt;filter&gt;&lt;relatedto&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26976" PostTypeId="2" ParentId="26972" CreationDate="2018-07-20T16:29:35.417" Score="3" Body="&lt;p&gt;You can register your file with Twig at the place you need it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.getView().registerCssFile(alias('@assetUrl') ~ '/path/to/css') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-20T16:29:35.417" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26977" PostTypeId="2" ParentId="26972" CreationDate="2018-07-20T18:16:35.417" Score="3" Body="&lt;p&gt;You can check a specific URL segment. For example if you need to load some CSS on the About page and that URL is yoursite.com/about you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.app.request.segments|first == 'about' %}&#xA;    {# Load CSS #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also check by &lt;code&gt;entry.id&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined and entry.id == '123' %}&#xA;    {# Load CSS #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Replace &quot;123&quot; with the &lt;code&gt;id&lt;/code&gt; of the entry you'd like to load the CSS for.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-07-20T21:31:44.337" LastActivityDate="2018-07-20T21:31:44.337" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26978" PostTypeId="2" ParentId="26965" CreationDate="2018-07-20T19:41:07.690" Score="7" Body="&lt;p&gt;Very likely it cannot connect to the database; that's typically what the &lt;code&gt;503&lt;/code&gt; error is about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://httpstatuses.com/503&quot; rel=&quot;noreferrer&quot;&gt;https://httpstatuses.com/503&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...so check the credentials in your &lt;code&gt;.env&lt;/code&gt; file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This video may help you: &lt;a href=&quot;https://www.youtube.com/watch?v=SqSp-CvKwJM&amp;amp;t=5s&quot; rel=&quot;noreferrer&quot;&gt;Installing Craft CMS v3 with MAMP Pro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and also a discussion of local development environments we had here might be of interest as well: &lt;a href=&quot;https://devmode.fm/episodes/shootout-at-the-local-dev-corral&quot; rel=&quot;noreferrer&quot;&gt;Shootout at the Local Dev Corral&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-20T19:41:07.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26979" PostTypeId="1" CreationDate="2018-07-20T19:57:36.913" Score="2" ViewCount="1320" Body="&lt;p&gt;I try to run Craft on my local Windows server and I keep getting message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can’t run Craft CMS :(&#xA;  Your server doesn’t meet the following requirements to run Craft CMS:&#xA;  The Mcrypt extension is required.&#xA;  Please talk to your host/IT department about upgrading your server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried installing Mcrypt, but I am having no luck... Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="8610" LastEditorUserId="57" LastEditDate="2018-07-20T20:29:03.613" LastActivityDate="2018-07-31T20:39:27.700" Title="Can’t run Craft CMS on my local machine, keep getting message &quot;The Mcrypt extension is required&quot;" Tags="&lt;mcrypt&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26980" PostTypeId="2" ParentId="26979" CreationDate="2018-07-20T20:32:23.450" Score="4" Body="&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of &lt;a href=&quot;https://craftcms.com/changelog#2-7-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2.7.0&lt;/a&gt;, Craft 2 can run on PHP 7.2.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You're probably trying to install Craft 2 using PHP 7.2 (which doesn't have mycrypt installed by default), which isn't supported (see here: &lt;a href=&quot;https://docs.craftcms.com/v2/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/requirements.html&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your options are to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use Craft 3, which supports PHP 7.2 and doesn't use mcrypt.&lt;/li&gt;&#xA;&lt;li&gt;Install mcrypt on PHP 7.2, but you'll probably run into other issues as well.&lt;/li&gt;&#xA;&lt;li&gt;Stay on Craft 2 and drop down to PHP 7.1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-07-31T20:39:27.700" LastActivityDate="2018-07-31T20:39:27.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26981" PostTypeId="2" ParentId="26947" CreationDate="2018-07-20T20:37:05.200" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I've tried the way described here: &lt;a href=&quot;https://github.com/craftcms/locales&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/locales&lt;/a&gt; but that does not seem to be picked up by Craft 3.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Haven't actually tested this, but looking at the code I think it should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to disable the intl extension from being loaded on your box (usually done in php.ini) because if Craft sees that's available, it will use that automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not available, it falls back to &lt;code&gt;config/locales&lt;/code&gt;, which is where you should be able to put your &quot;custom&quot; locale.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-20T20:37:05.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26982" PostTypeId="2" ParentId="26966" CreationDate="2018-07-20T23:14:26.800" Score="6" Body="&lt;p&gt;You'll need to remove every required packages besides the plugins you installed and &lt;code&gt;craftcms/cms&lt;/code&gt; as well as &lt;code&gt;vlucas/phpdotenv&lt;/code&gt;, clear your vendor folder and run &lt;code&gt;composer update&lt;/code&gt; again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For whatever reasons sometimes all required packages by Craft end up in your custom &lt;code&gt;composer.json&lt;/code&gt; which causes these errors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to take a look at all your plugins and cut them from your list to another one. Remove all entries except the two above and paste the plugins again &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-20T23:14:26.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26984" PostTypeId="2" ParentId="26953" CreationDate="2018-07-21T06:55:32.153" Score="3" Body="&lt;p&gt;When you include templates and pass multiple different variables to them with different types that may have a different field layout it is required to &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#defensive-coding-in-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;code defensively&lt;/a&gt; and check for variable types. Actually you should &lt;strong&gt;never&lt;/strong&gt; print something without further checking. Anything bad that could happen will happen. Especially in such a case&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if country[fieldhandle] is defined and country[fieldhandle] is not empty and  %}&#xA;    {% for element in country.getFieldValue(fieldhandle).all() %}&#xA;        {{ element.title }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may as well include a &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tests.html#instance-of&quot; rel=&quot;nofollow noreferrer&quot;&gt;instance of&lt;/a&gt; check&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if element.getFieldValue(fieldHandle) is instance of('craft\\elements\\db\\ElementQuery') %}&#xA;    {% set relatedElements = element.getFieldValue(fieldHandle).all() %}&#xA;{% else %}&#xA;    // eager loading, the result is an array, no need to fetch it&#xA;    {% set relatedElements = element.getFieldValue(fieldHandle) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-07-24T14:44:07.207" LastActivityDate="2018-07-24T14:44:07.207" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26985" PostTypeId="2" ParentId="26942" CreationDate="2018-07-21T15:22:41.337" Score="3" Body="&lt;p&gt;&lt;strong&gt;Bias warning:&lt;/strong&gt; I am the author of &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; for Craft CMS 3, so I'm obviously not impartial here. However, what I'd suggest you do is install the both, and try them out. You can do that pretty easily with the Craft Plugin Store.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you will find that &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; has many features that aren't available elsewhere, but depending on your needs, that may not matter to you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-21T15:22:41.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26986" PostTypeId="1" AcceptedAnswerId="26997" CreationDate="2018-07-21T20:15:49.513" Score="1" ViewCount="314" Body="&lt;p&gt;I'm going on 5 days of banging my head on my desk here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm simply not getting how to install it on my production server. I have Craft working beautifully locally...but getting it to my server is a whole other matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have ssh'd into my VPS, then run 'wget '&lt;a href=&quot;https://craftcms.com/latest-v3.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/latest-v3.zip&lt;/a&gt;'' and unzipped it to try and get it running as just a barebones install. So now I'm going through the install instructions, and am running into an error when running the './craft setup/security-key' step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Warning:  Module 'Phar' already loaded in Unknown on line 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft requires PHP 7.0 or later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a phpinfo file and it's returning PHP Version 7.0.30.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why I'm getting this error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2018-07-22T16:11:54.907" Title="Manually creating Security Key gives PHP error" Tags="&lt;craft3&gt;&lt;install&gt;&lt;security&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26987" PostTypeId="1" AcceptedAnswerId="26989" CreationDate="2018-07-22T00:51:02.027" Score="3" ViewCount="464" Body="&lt;p&gt;Adding products to the cart throws a page not found (404) error that has this header;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Page not found.&#xA;↵&#xA;Caused by: Invalid Route – yii\base\InvalidRouteException&#xA;Unable to resolve the request: commerce/cart/updateCart&#xA;in /Users/a/Sites/ae-dev/vendor/yiisoft/yii2/base/Controller.php at line 128&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Very strange. Anyone encounter this issue?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2018-07-24T17:00:12.443" Title="commerce/cart/updateCart throws page not found" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26988" PostTypeId="2" ParentId="26986" CreationDate="2018-07-22T02:00:35.143" Score="0" Body="&lt;p&gt;Try &lt;code&gt;php craft setup/security-key&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2018-07-22T02:00:35.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26989" PostTypeId="2" ParentId="26987" CreationDate="2018-07-22T02:38:28.877" Score="3" Body="&lt;p&gt;Based on your tag, I assume you're using Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Controller &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#request-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;actions in Craft 3 use &lt;code&gt;kebab-case&lt;/code&gt;&lt;/a&gt;, now, so your action should be &lt;code&gt;commerce/cart/update-cart&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-07-23T21:51:23.130" LastActivityDate="2018-07-23T21:51:23.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26990" PostTypeId="1" CreationDate="2018-07-22T07:58:08.903" Score="1" ViewCount="88" Body="&lt;p&gt;What is your usual setup for blogpost/article matrix field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Header &lt;/li&gt;&#xA;&lt;li&gt;Richfield &lt;/li&gt;&#xA;&lt;li&gt;Quote (author+text) &lt;/li&gt;&#xA;&lt;li&gt;Image(asset, position, description)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8519" LastActivityDate="2018-07-22T17:57:44.737" Title="Your usual setup for blogpost matrix field" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-09-07T16:06:16.447" ContentLicense="CC BY-SA 4.0" />
  <row Id="26991" PostTypeId="2" ParentId="26987" CreationDate="2018-07-22T08:16:31.423" Score="1" Body="&lt;p&gt;Ah, my bad—not as simple as copy-pasting from Commerce 1 (duh). Some aspects have changed, like kebab-case and {{ redirectInput('shop/cart') }}&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2018-07-24T17:00:12.443" LastActivityDate="2018-07-24T17:00:12.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26992" PostTypeId="2" ParentId="22444" CreationDate="2018-07-22T12:56:11.037" Score="1" Body="&lt;p&gt;So the answer is to test the cookie for a name with username in it, and pass if it exists. You could also check for an exactly 32 digit alphanumeric cookie name I guess.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (&#xA; req.http.Cookie ~ &quot;username&quot; # Craft sessions have the word username in them&#xA;)&#xA;{&#xA;    return (pass);&#xA;}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="100" LastActivityDate="2018-07-22T12:56:11.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26993" PostTypeId="2" ParentId="26974" CreationDate="2018-07-22T13:03:36.037" Score="7" Body="&lt;p&gt;The issue with your current code is that you're looping over each type/size category, creating a parameter in your &lt;code&gt;relatedTo&lt;/code&gt; query for &lt;em&gt;each one&lt;/em&gt;. This means that you're currently creating a query that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo([&#xA;    'and',&#xA;    { targetElement: 1 },&#xA;    { targetElement: 2 },&#xA;    { targetElement: 3 },&#xA;    { targetElement: 4 }&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which, combined with the &lt;code&gt;AND&lt;/code&gt;, means that Craft will only return entries that have all of these relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do, is to &lt;em&gt;collect the IDs for each category group in an array, and add those arrays to the &lt;code&gt;relatedTo&lt;/code&gt; query&lt;/em&gt; – i.e. create a query that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo([&#xA;    'and',&#xA;    { targetElement: [1, 2] },&#xA;    { targetElement: [3, 4] }&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above query would solve your issue, because whenever Craft isn't given an &lt;code&gt;and&lt;/code&gt; or &lt;code&gt;or&lt;/code&gt;, it assumes &lt;code&gt;or&lt;/code&gt;. This means that the above query is exactly the same as the below:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo([&#xA;    'and',&#xA;    { targetElement: ['or', 1, 2] },&#xA;    { targetElement: ['or', 3, 4] }&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, the above query is saying: give me all entries that have a relation matching either the target element 1 OR 2, AND a relation matching either the target element 3 or 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how the Twig to create a query like the above could look:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Create the base query #}&#xA;{% set query = craft.entries({ section: 'products' }) %}&#xA;&#xA;{% set relatedTo = [] %}&#xA;&#xA;{% set types = craft.app.request.getQueryParam('type')|split(',')|filter %}&#xA;{% if types %}&#xA;    {% set relatedTo = relatedTo|merge([{&#xA;        targetElement: craft.categories({ group: 'types', slug: types }).ids()&#xA;    }]) %}&#xA;{% endif %}&#xA;&#xA;{% set sizes = craft.app.request.getQueryParam('size')|split(',')|filter %}&#xA;{% if sizes %}&#xA;    {% set relatedTo = relatedTo|merge([{&#xA;        targetElement: craft.categories({ group: 'sizes', slug: sizes }).ids()&#xA;    }]) %}&#xA;{% endif %}&#xA;&#xA;{% if relatedTo|length &amp;gt; 1 %}&#xA;    {% set relatedTo = ['and']|merge(relatedTo) %}&#xA;{% endif %}&#xA;&#xA;{% set entries = query.relatedTo(relatedTo ? relatedTo : null).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code should work for all the below use cases:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;/products (returns all product entries)&lt;/li&gt;&#xA;&lt;li&gt;/products?type=polo-shirt (returns all polo shirts)&lt;/li&gt;&#xA;&lt;li&gt;/products?type=polo-shirt&amp;amp;size=small (returns all small polo shirts)&lt;/li&gt;&#xA;&lt;li&gt;/products?type=polo-shirt,jeans&amp;amp;size=small (returns all small polo shirts and jeans)&lt;/li&gt;&#xA;&lt;li&gt;/products?type=polo-shirt,jeans&amp;amp;size=small,medium (returns all small and medium polo shirts and jeans)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that the usage of &lt;code&gt;ids()&lt;/code&gt; over &lt;code&gt;all()&lt;/code&gt; in a few places (such as in the &lt;code&gt;craft.categories&lt;/code&gt; queries to get the type and size categories) – this is a performance tweak (it's more effective to just pull the IDs than the entire model).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if you want to use pagination, just amend the final line to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate query.relatedTo(relatedTo ? relatedTo : null).limit(10) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; I originally typed out a completely different answer to this question, but after some helpful discussion with @Robin Schambach on Slack, we arrived on the above, IMO much better solution. Cheers Robin!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-22T14:25:46.257" LastActivityDate="2018-07-22T14:25:46.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26994" PostTypeId="1" AcceptedAnswerId="26999" CreationDate="2018-07-22T14:16:50.140" Score="2" ViewCount="40" Body="&lt;p&gt;I'm creating a custom twig filter in Craft 3 and am struggling with a really simple thing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.backgroundImage.one() | filter }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my filter, I would like to validate that I am being passed an asset.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$asset instanceof Asset)&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What should I be checking the object against? Asset or something different?&lt;/p&gt;&#xA;" OwnerUserId="7946" LastEditorUserId="5557" LastEditDate="2018-07-22T17:04:09.893" LastActivityDate="2018-07-22T17:56:12.713" Title="How can I validate that I am passing an Asset into my custom twig filter?" Tags="&lt;twigextension&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26995" PostTypeId="1" CreationDate="2018-07-22T14:33:12.057" Score="1" ViewCount="217" Body="&lt;p&gt;I'm updating a site from Craft 2 to Craft 3 and can't find the equivalent of the '&lt;a href=&quot;https://github.com/pixelandtonic/CategorySources&quot; rel=&quot;nofollow noreferrer&quot;&gt;Category Sources&lt;/a&gt;' plugin? It's really useful when it comes to restricting the source for related entries by the category the entry belongs to. Does anybody know of an alternative solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8616" LastActivityDate="2018-07-22T17:11:55.353" Title="Category Sources for Craft 3?" Tags="&lt;craft3&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26996" PostTypeId="2" ParentId="26994" CreationDate="2018-07-22T14:58:14.403" Score="2" Body="&lt;p&gt;Assuming you're using Craft 3, this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (\get_class($asset) !== 'craft\elements\Asset) {&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-22T15:20:52.590" LastActivityDate="2018-07-22T15:20:52.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26997" PostTypeId="2" ParentId="26986" CreationDate="2018-07-22T16:11:54.907" Score="3" Body="&lt;p&gt;Well then. Apparently my shell user was using a different version of php than my domain. I was still at 5.6 on my shell user. I was all sorts of confused because I had a phpinfo.php file setup at my domain showing PHP 7.0, and in the web hosting domain panel, I had 7.0 chosen. Finally wrote to support and they sent directions on how to change it. Once I updated that, the security key was created just fine.&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2018-07-22T16:11:54.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26998" PostTypeId="2" ParentId="26995" CreationDate="2018-07-22T16:46:03.053" Score="2" Body="&lt;p&gt;There's a Craft 3 port of Category Sources in the &lt;a href=&quot;https://github.com/pixelandtonic/CategorySources/tree/v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;v2&lt;/code&gt; branch&lt;/a&gt; for the repo. It doesn't appear to be published to &lt;a href=&quot;https://packagist.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Packagist&lt;/a&gt; and the Plugin Store, which means you'll need to add the URL for the plugin's Git repository to your project's &lt;code&gt;composer.json&lt;/code&gt; file in order for Composer to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add the following to the root of your &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;repositories&quot;: {&#xA;    &quot;craftcms/category-sources&quot;: {&#xA;        &quot;type&quot;: &quot;git&quot;,&#xA;        &quot;url&quot;: &quot;git@github.com:pixelandtonic/CategorySources.git&quot;,&#xA;        &quot;trunk-path&quot;: &quot;v2&quot;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might also need to add the following to &lt;code&gt;composer.json&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;&quot;prefer-stable&quot;: true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can do &lt;code&gt;composer require craftcms/category-sources&lt;/code&gt; to actually download the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I haven't tested this plugin myself, and the fact that it isn't released probably means it's not completely ready for primetime (it might not even work at all, with recent versions of Craft 3). Proceed with caution; you might also want to get in touch with Pixel &amp;amp; Tonic to hear if the plugin is likely to get a proper release anytime soon.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-22T17:11:55.353" LastActivityDate="2018-07-22T17:11:55.353" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26999" PostTypeId="2" ParentId="26994" CreationDate="2018-07-22T17:56:12.713" Score="3" Body="&lt;p&gt;Actually, you had your code just right imo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\Asset;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!$asset instanceof Asset) {&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-22T17:56:12.713" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27000" PostTypeId="2" ParentId="26990" CreationDate="2018-07-22T17:57:44.737" Score="1" Body="&lt;p&gt;Something like this: &lt;a href=&quot;https://nystudio107.com/blog/creating-a-content-builder-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating a Content Builder in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-22T17:57:44.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27001" PostTypeId="1" CreationDate="2018-07-22T18:15:59.597" Score="0" ViewCount="701" Body="&lt;p&gt;I’m trying to move a local Craft 3 site to a local server (hosted on 1&amp;amp;1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website itself runs fine, but for some reason I can only access the admin panel when the &lt;code&gt;web/cpresources&lt;/code&gt; folder has permissions set to &lt;code&gt;777&lt;/code&gt;, which I obviously don’t want. (&lt;strong&gt;EDIT&lt;/strong&gt;: It also seems to work with &lt;code&gt;755&lt;/code&gt;, but the folder probably shouldn't be executable by everone, right?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other folders where Craft needs write access are set to &lt;code&gt;744&lt;/code&gt;, as per the install instructions, and as long as &lt;code&gt;web/cpresoures&lt;/code&gt; are &lt;code&gt;755&lt;/code&gt;, everything else seems to work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea what can be the issue and a possible solution here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I don’t know which user PHP runs under, but as a standard web hosting setup, I would guess it should be able to write to the file system without open access for everyone, and again everything else seems to be working like normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It only&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to get the user by running this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = posix_getpwuid(posix_geteuid())['name'];&#xA;$echo $username;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reported user is the same as my account, meaning php should run as the same user that owns the files.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="5771" LastEditDate="2018-07-23T09:14:02.350" LastActivityDate="2018-07-23T09:14:02.350" Title="Craft 3 admin panel only accessible when web/cpresources is exectuable for everyone" Tags="&lt;craft3&gt;&lt;permissions&gt;&lt;configuration&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27003" PostTypeId="1" CreationDate="2018-07-23T01:27:16.017" Score="0" ViewCount="40" Body="&lt;p&gt;I've been building frontend pages for non-admin users with layouts matching the rest of the enduser site. For the &quot;Set Password&quot; page, I was able to build the form and set it up via the setPasswordPath config, no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in addition to all my necessary frontend styles, this page also brings in a number of admin-side styles and scripts that greatly interfere with the layouts. Since any users seeing this custom page won't have admin access, these included files are certainly unneeded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside of hacking the core, is there a more friendly way to exclude admin-level content on this non-admin page?&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-07-23T18:40:24.643" Title="Craft 3 Custom Set Password Styles" Tags="&lt;craft3&gt;&lt;users&gt;&lt;password&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27004" PostTypeId="2" ParentId="19747" CreationDate="2018-07-23T03:28:41.023" Score="3" Body="&lt;p&gt;I've written up an article with some basic examples of content migrations in Craft 3: &lt;a href=&quot;https://medium.com/@mikethehud/craft-cms-3-content-migration-examples-3a377f6420c3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/@mikethehud/craft-cms-3-content-migration-examples-3a377f6420c3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As others have stated I just read through the code base / api docs (&lt;a href=&quot;https://docs.craftcms.com/api/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/&lt;/a&gt;) to find out what methods and services to use to save specific things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="8617" LastActivityDate="2018-07-23T03:28:41.023" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27005" PostTypeId="1" AcceptedAnswerId="27006" CreationDate="2018-07-23T06:22:33.280" Score="1" ViewCount="93" Body="&lt;p&gt;I need to add a separator if there are a multiple of types. How can this be done in a for loop? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for type in entry.buildType %}{{ type }}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The outcome is similar to a breadcrumb nav, with an added &quot;/&quot;, however the separator should only be placed in between - not for the last.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2018-07-23T06:52:09.647" Title="Add conditional in a for loop" Tags="&lt;conditional&gt;&lt;forloop&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27006" PostTypeId="2" ParentId="27005" CreationDate="2018-07-23T06:32:23.483" Score="3" Body="&lt;pre&gt;&lt;code&gt;{% for type in entry.buildType %}&#xA;{{ type }}&#xA;{% if not loop.last %}/{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-07-23T06:52:09.647" LastActivityDate="2018-07-23T06:52:09.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27007" PostTypeId="2" ParentId="26613" CreationDate="2018-07-23T07:08:32.760" Score="1" Body="&lt;p&gt;The current rule for the total in Commerce 1 is in &lt;code&gt;craft/plugins/commerce/models/Commerce_ShippingRuleModel.php&lt;/code&gt; starting at line 214: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($this-&amp;gt;minTotal &amp;amp;&amp;amp; $this-&amp;gt;minTotal &amp;gt; $order-&amp;gt;itemTotal)&#xA;{&#xA;    return false;&#xA;}&#xA;if ($this-&amp;gt;maxTotal &amp;amp;&amp;amp; $this-&amp;gt;maxTotal &amp;lt;= $order-&amp;gt;itemTotal)&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try changing it to use totalPrice and see if that resolves the issue for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($this-&amp;gt;minTotal &amp;amp;&amp;amp; $this-&amp;gt;minTotal &amp;gt; $order-&amp;gt;totalPrice)&#xA;{&#xA;    return false;&#xA;}&#xA;if ($this-&amp;gt;maxTotal &amp;amp;&amp;amp; $this-&amp;gt;maxTotal &amp;lt;= $order-&amp;gt;totalPrice)&#xA;{&#xA;    return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If we were to go ahead and change it in core, it would be a breaking change for other users. The only way around that is to make a new setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it resolves the issue for you, I will look into making the new setting.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-07-23T07:08:32.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27008" PostTypeId="1" CreationDate="2018-07-23T08:28:07.093" Score="1" ViewCount="556" Body="&lt;p&gt;Can I reset admin password using console CLI interface? Didn't see anything like that when I run the &lt;code&gt;craft&lt;/code&gt; file directly and it displayed list of commands.&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="57" LastEditDate="2018-07-23T19:13:24.730" LastActivityDate="2018-10-21T22:00:27.487" Title="Reset admin account password using command line interface" Tags="&lt;password&gt;&lt;console&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27010" PostTypeId="1" AcceptedAnswerId="27014" CreationDate="2018-07-23T15:16:38.063" Score="2" ViewCount="680" Body="&lt;p&gt;I am creating a new multi-lingual site and &lt;a href=&quot;http://docs.craftcms.com/v3/sites.html#guide-setting-up-a-new-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;the documentation does not explain the difference&lt;/a&gt; between the options in the translation method dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zlmf2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zlmf2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is different for each of these and when is it recommended to choose the from the options?&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="9" LastEditDate="2018-08-01T14:37:38.787" LastActivityDate="2018-08-07T17:02:16.827" Title="What is the difference between the Translation Methods when creating a new site" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;documentation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27011" PostTypeId="1" AcceptedAnswerId="27170" CreationDate="2018-07-23T15:53:20.580" Score="2" ViewCount="124" Body="&lt;p&gt;I have a craft2 site running quite happily with 8 languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed recently that a dropdown selection of category entries is not working when the locale is changed to chinese (locale = 'zh').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the list of countries to search on does not  render fully - only some countries are shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the real world example&#xA;&lt;a href=&quot;https://seafarerhelp.org/en/seafarers-directory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://seafarerhelp.org/en/seafarers-directory&lt;/a&gt;&#xA;&lt;a href=&quot;https://seafarerhelp.org/zh/seafarers-directory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://seafarerhelp.org/zh/seafarers-directory&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;check out the search country dropdown. It is using this template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set countries = craft.categories({&#xA;    group: 'locations',&#xA;    limit: null,&#xA;    level: 1,&#xA;    order:['title asc']&#xA;   })&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In english we get the full list.&#xA;In Chinese (select the locale) we get only a handful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other countries seem fine. I am stumped. Have looked for oddities in structure but can find none. Ironically this area of the site is not translated but this doesn't present any problem with other locales/languages&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-08-04T16:51:47.463" Title="Craft 2 categories locale issue" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27013" PostTypeId="1" AcceptedAnswerId="27019" CreationDate="2018-07-23T16:35:58.167" Score="4" ViewCount="120" Body="&lt;p&gt;I need to set an asset field's dynamic subfolder path to the User ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is within a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix a field in a User profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting it to &lt;code&gt;{currentUser.id}&lt;/code&gt;, &lt;code&gt;{owner.author.id}&lt;/code&gt;, &lt;code&gt;{object.author.id}&lt;/code&gt; results in an invalid path message when trying to upload to the asset field.&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-07-23T20:11:49.687" Title="Asset dynamic subfolder for User Matrix" Tags="&lt;matrix&gt;&lt;user-profile&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27014" PostTypeId="2" ParentId="27010" CreationDate="2018-07-23T16:59:36.547" Score="5" Body="&lt;h3&gt;Not translatable&lt;/h3&gt;&#xA;&lt;p&gt;The field will always have the same value for each site&lt;/p&gt;&#xA;&lt;h3&gt;Translate for each site&lt;/h3&gt;&#xA;&lt;p&gt;Easy: the field can have a different value for each of your sites. Create 10 sites, all can have different content&lt;/p&gt;&#xA;&lt;h3&gt;Translate for each site group&lt;/h3&gt;&#xA;&lt;p&gt;Every site group can have a different value, create 10 site that are all in the same group, all elements will have the same value, create a site in another group -&amp;gt; that one can have a different value than the other 10&lt;/p&gt;&#xA;&lt;h3&gt;Translate for each language&lt;/h3&gt;&#xA;&lt;p&gt;Create 10 sites, all in the same language, all will have the same content, no matter what group they are in. Create another site in another language  -&amp;gt; this one can have different content&lt;/p&gt;&#xA;&lt;h3&gt;Custom&lt;/h3&gt;&#xA;&lt;p&gt;You can define custom behaviors&lt;br&gt;&#xA;&lt;strong&gt;edit&lt;/strong&gt;  a few more words about this&lt;/p&gt;&#xA;&lt;p&gt;There will appear an &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;below that option and Craft will actually do this&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;if ($field-&amp;gt;getTranslationKey($siteElement) === $field-&amp;gt;getTranslationKey($element)) {&#xA;    // Copy the master element's value over&#xA;    $siteElement-&amp;gt;setFieldValue($field-&amp;gt;handle, $element-&amp;gt;getFieldValue($field-&amp;gt;handle));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which basically means: it will render both object templates (the original element, and the element for all other sites) and injects the &lt;code&gt;element&lt;/code&gt; into the template..&lt;/p&gt;&#xA;&lt;p&gt;For example if you have something like &lt;code&gt;{ title }&lt;/code&gt; in your template, Craft will render those templates, and will compare them. If the titles are the same, the field is translatable and may contain a different value for all sites, if the titles are equally, the content of your field will be equally as well.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-08-07T17:02:16.827" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27015" PostTypeId="2" ParentId="27003" CreationDate="2018-07-23T18:40:24.643" Score="1" Body="&lt;p&gt;This was a complication due to using the same browser for different user testings. Once all semblance of my admin user session/cookies were absent, the admin styles and scripts no longer appeared on this page.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-07-23T18:40:24.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27016" PostTypeId="1" AcceptedAnswerId="27018" CreationDate="2018-07-23T18:51:21.383" Score="1" ViewCount="278" Body="&lt;p&gt;Here's an odd one: I have a site with many users, only a few of them admins. Any admin user can login either via the /admin control panel or through a frontend login, which follows &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the example from the documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any non-admin users will be rebuffed on either login with an &quot;Invalid username or password&quot; message. Even more odd, if an admin user attempts to &quot;Login as&quot; a non-admin user from the control panel, it simply takes them back to the dashboard with a &quot;Logged In&quot; message, but keeps them logged in as their original admin role.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what maybe to look for or test?&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-07-23T19:40:17.237" Title="Craft 3: Non-Admin Users Can't Login" Tags="&lt;craft3&gt;&lt;login&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27017" PostTypeId="2" ParentId="27008" CreationDate="2018-07-23T19:16:37.463" Score="1" Body="&lt;p&gt;There's not a native Craft console command that could do that, but plugins can supply there own console commands, so you can write a plugin that added a command to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 plugin docs: &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/introduction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/introduction.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 plugin docs: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/plugin-guide.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can generate plugin boilerplate for both versions here: &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and there's even a &quot;Console Commands&quot; checkbox you can tick.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-23T19:16:37.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27018" PostTypeId="2" ParentId="27016" CreationDate="2018-07-23T19:40:17.237" Score="1" Body="&lt;p&gt;I should've realized that this was a plugin issue, that changes everything. Thanks for the lead, Brad.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-07-23T19:40:17.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27019" PostTypeId="2" ParentId="27013" CreationDate="2018-07-23T20:11:49.687" Score="3" Body="&lt;p&gt;You should be using &lt;code&gt;{{currentUser.id}}&lt;/code&gt; instead of &lt;code&gt;{currentUser.id}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is that double curly brace syntax works on the global scope, while single curly brace syntax tries to resolve itself on the current element. &lt;a href=&quot;https://docs.craftcms.com/v2/assets-fields.html#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relevant documentation.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-07-23T20:11:49.687" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27020" PostTypeId="2" ParentId="20123" CreationDate="2018-07-23T21:18:13.733" Score="3" Body="&lt;p&gt;Typically, the desire for a private plugin is for a one-off client project, where the client owns the custom plugin. If that's the case here, I'd consider just changing the plugin over to be a module, and making it part of the project itself (checked into git, and all that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.: &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's actually pretty easy to convert a plugin over to being a module. FWIW!&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-23T21:18:13.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27021" PostTypeId="1" CreationDate="2018-07-23T23:36:52.963" Score="3" ViewCount="88" Body="&lt;p&gt;I'm working on a project using Craft CMS for the first time, so far so good, however i'm stumped on how to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a button on each entry in a structure that states you have read the follow article. When you click you have read the article, it reflects on your account page that you have read the follow article(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this makes sense, but it's almost like a LMS, you learn about something on the page you click you have completed the stage then move on to the next stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8619" LastEditorUserId="5557" LastEditDate="2018-07-24T17:21:47.027" LastActivityDate="2018-07-24T17:41:11.027" Title="Entry Tracker to see who has completed the course" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27022" PostTypeId="2" ParentId="27021" CreationDate="2018-07-23T23:56:12.660" Score="2" Body="&lt;p&gt;I'd add an Entries field in your User field layout called &lt;code&gt;Articles Read&lt;/code&gt; or such. Then whenever they click that they've read a particular article, I'd add the &lt;code&gt;id&lt;/code&gt; of article entry that they've read to that field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd do that probably via a custom plugin, but you could also do it with a simple form that passes the correct data to the the &lt;code&gt;actionUrl('users/save-user')&lt;/code&gt; UsersController&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-23T23:56:12.660" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27023" PostTypeId="1" AcceptedAnswerId="27024" CreationDate="2018-07-24T01:04:02.833" Score="3" ViewCount="169" Body="&lt;p&gt;I'm having difficulties following the install instructions found at &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/installation.html&lt;/a&gt;. I've ssh'd into my server, and I'm running composer to install Craft, as directed in step 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I've run Composer, the instructions say I can probably safely skip steps 2 and 3. Awesome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 4: Create a database... now wait, when installing Craft via Composer, it gave me the option of running setup from the terminal - which I did. And during this, it asked for database driver, server or IP name, database name, etc. All stuff I needed to know way before I got to step 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 5. Setup a webserver. Guessing these instructions are specific for local installs? Perhaps this should be made clearer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 6. Run the Setup Wizard. Again... didn't I do this in step one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After running setup from Step 1, it finished with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; save the first user ... done&#xA;&amp;gt; save the email settings ... done&#xA;*** installed Craft successfully (time: 3.718s)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks to me as if everything is as should be. According to the instructions, I should be able to access my new Craft site from my web browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MFK8U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MFK8U.png&quot; alt=&quot;Screen Shot showing a listing of files and directories&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not so much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been having a &lt;em&gt;lot&lt;/em&gt; of issues getting Craft 3 to run (if you look at my post history, I've asked like 3 or 4 questions over the last few days related to installation). I don't think I'm that stupid (but I've been proven wrong before!), so I'm not sure why this has been so challenging to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone possibly explain where I'm going wrong? &lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2018-07-24T01:42:44.383" Title="Install instructions" Tags="&lt;craft3&gt;&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27024" PostTypeId="2" ParentId="27023" CreationDate="2018-07-24T01:42:44.383" Score="3" Body="&lt;p&gt;If that's what you see when you go to the URL, then you probably don't have the server root set properly. It should point to the &lt;code&gt;web/&lt;/code&gt; directory, not the project root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more helpful Craft setup info can be found here: &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically you do the install in local dev, and then have some kind of a deployment process to deploy it to your staging/production servers.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-24T01:42:44.383" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27026" PostTypeId="1" AcceptedAnswerId="27029" CreationDate="2018-07-24T14:18:32.140" Score="2" ViewCount="30" Body="&lt;p&gt;I have an archive of exhibitions with entries grouped by year. The order of the groups should be descending, the order of the entries within the group should be ascending.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: The order of the years should be 2018, 2017, 2016, …&#xA;The entries within the group 2018 should start with the first exhibition of the year and end with the last one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set archive = craft.entries.section(&quot;exhibitions&quot;).order('dateStart desc').dateEnd('&amp;lt;' ~ now).limit(null)  %}&#xA;{% set archiveGrouped = archive|group('dateStart.year') %}&#xA;{% for year, entriesInYear in archiveGrouped %}&#xA;&amp;lt;div&amp;gt;&#xA;    &amp;lt;h2 class=&quot;year&quot;&amp;gt;{{ year }}&amp;lt;/h2&amp;gt;&#xA;    {% for entry in entriesInYear %}&#xA;    &amp;lt;div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the link to the Website: &lt;a href=&quot;https://kunsthausbaselland.ch/en/ausstellungen&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://kunsthausbaselland.ch/en/ausstellungen&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess there is an easy solution for this. But I couldn’t figure it out and found nothing in the docs.&lt;/p&gt;&#xA;" OwnerUserId="4040" LastActivityDate="2018-07-24T17:54:55.163" Title="Change order within grouped archive" Tags="&lt;entries&gt;&lt;group&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27027" PostTypeId="1" AcceptedAnswerId="27031" CreationDate="2018-07-24T14:34:40.417" Score="3" ViewCount="372" Body="&lt;p&gt;All my forms on sprout form won't use the redirect they get assigned via the Form builder. Whenever a form is succesfully submited it redirects to my homepage instead of my thank-you page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;form__regular&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; id=&quot;contact-form&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sprout-forms/entries/save-entry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ form.redirectUri }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even if I write the redirect URL manually it keeps redirecting me to the homepage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can get the redirect to work is when I let sprout forms render the fields.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastEditorUserId="3848" LastEditDate="2018-07-25T09:17:59.673" LastActivityDate="2018-07-30T13:49:26.593" Title="Sprout Form redirect after submit not working correctly" Tags="&lt;form&gt;&lt;plugin-sproutforms&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27028" PostTypeId="2" ParentId="27021" CreationDate="2018-07-24T17:41:11.027" Score="1" Body="&lt;p&gt;In addition to Andrews answer just a little example how to store information for a user via custom plugin. There are many resources how to create a plugin, &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;so [if] you wanna make a Craft 3 plugin&lt;/a&gt; you should read those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You form could look like this&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;plugin/controller/function&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Submit&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your controller&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionSave():Response&#xA;{&#xA;    $user = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;    if($user === null){&#xA;        // error, no user is logged in&#xA;        // handle it somehow&#xA;    }&#xA;&#xA;    // check for a valid entry id&#xA;    $newId = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('entryId');&#xA;    if($newId === null){&#xA;        // error, no entry id provided...&#xA;    }&#xA;&#xA;    // get the existing entries and add the new one to the array&#xA;    $existingIds = $user-&amp;gt;getFieldValue('fieldHandle')-&amp;gt;ids();&#xA;    $existingIds[] = $newId;&#xA;&#xA;    // set the new value and store the element&#xA;    $user-&amp;gt;setFieldValue('fieldHandle', $existingIds);&#xA;    if(!Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user)){&#xA;        // could not save user due to validation errors, do something about it&#xA;    }&#xA;&#xA;    // everything was successful, render a template or redirect or whatever you need&#xA;    return $this-&amp;gt;renderTemplate('some/path', ['message' =&amp;gt; 'hooooray']);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-24T17:41:11.027" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27029" PostTypeId="2" ParentId="27026" CreationDate="2018-07-24T17:54:55.163" Score="2" Body="&lt;p&gt;Assuming the &lt;em&gt;years&lt;/em&gt; are currently rendered in the correct (descending) order, an easy way to make sure the entries are rendered in ascending order would be to simply &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/reverse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;reverse&lt;/code&gt;&lt;/a&gt; the &lt;code&gt;entriesInYear&lt;/code&gt; array, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&#xA;{% for entry in entriesInYear|reverse %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-24T17:54:55.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27031" PostTypeId="2" ParentId="27027" CreationDate="2018-07-25T02:12:41.670" Score="2" Body="&lt;p&gt;In Craft 3, Form redirect values must use the &lt;code&gt;hash&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ form.redirectUri|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's mentioned in passing in the docs &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#request-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without that &lt;code&gt;hash&lt;/code&gt; filter, you'll get redirected to the home page as you are experiencing.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-07-30T13:49:26.593" LastActivityDate="2018-07-30T13:49:26.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27032" PostTypeId="1" AcceptedAnswerId="27035" CreationDate="2018-07-25T09:20:11.110" Score="2" ViewCount="156" Body="&lt;p&gt;I'm fairly new to using macros and haven't found anything online regarding this — sorry if this is a possible duplicate post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a macro with 7 possible parameters but on different templates I want to add to the default classes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro button(label, link, width , classes, colours, textclasses, alignment) %}&#xA;  &amp;lt;a href=&quot;{{ link }}&quot; class=&quot;btn {{ width|default('w5') }} {{ colours|default('bg-tdgreen white') }} {{ classes|default('flex pa2 pa3-ns ph3 tc lh-solid f7 f6-ns link underline-hover z-999 br2 mv3 tracked-more') }} {{ alignment|default('center') }}&quot;&amp;gt;&#xA;    &amp;lt;p class=&quot;ttu center mv0 {{ textclasses|default('') }}&quot;&amp;gt;{{ label }}&amp;lt;/p&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way of doing this without having to set a variable with all the defaults in it and tacking on new classes? For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set buttonClasses = &quot;absolute w5-ns l-50 tc pa2 pa3-ns ph3 br2 z-max link white f6 flex mt--18 mt--25-ns underline-hover tracked-more&quot; %}&#xA;  {% if buttonPosition == 'above' %}&#xA;    {% set buttonClasses = buttonClasses ~ &quot; top-0&quot; %}&#xA;  {% endif %}&#xA;{{ macros.button(block.ctaText, block.ctaLink.one().url, &quot;&quot;, buttonClasses) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;— Thanks&lt;/p&gt;&#xA;" OwnerUserId="8327" LastActivityDate="2018-07-25T11:36:11.730" Title="Adding to default classes in a macro" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;macro&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27033" PostTypeId="1" CreationDate="2018-07-25T09:32:45.750" Score="2" ViewCount="170" Body="&lt;p&gt;I'm building a simple contact form plugin and I would like to be able to provide a default form that the developer can include in his own template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most plugins I've seen provide the controller and all the code to process a submitted form but you still have to create your own form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I tried 2 methods, using a hook and a template variable.&#xA;While both work I was wondering if there wasn't a better/cleaner method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downside of using a hook is that you can't pass variables to the template (or am I wrong?) and the template variable feels like a misuse of the functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't there a way to use the existing twig import function? Maybe by registering a namespace twig path in the plugin?(&lt;a href=&quot;https://symfony.com/doc/current/templating/namespaced_paths.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://symfony.com/doc/current/templating/namespaced_paths.html&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="7577" LastEditorUserId="7577" LastEditDate="2018-07-25T09:42:06.853" LastActivityDate="2018-07-25T16:36:07.127" Title="Using a template from a plugin" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27034" PostTypeId="1" AcceptedAnswerId="27039" CreationDate="2018-07-25T09:34:38.730" Score="2" ViewCount="304" Body="&lt;p&gt;I have set up a Craft 3 site on shared hosting. When I try to update Craft or install plugins via the CP, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &quot;&lt;a href=&quot;https://composer.craftcms.com/packages.json&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://composer.craftcms.com/packages.json&lt;/a&gt;&quot; file could not be&#xA;  downloaded: allow_url_fopen must be enabled in php.ini&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;allow_url_fopen cannot be enabled on this hosting &amp;amp; there is no SSH access&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are my options for updating Craft &amp;amp; installing/updating plugins in this scenario?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only option to avoid CMS access temporarily, copy down the live database, do any updating locally and then upload the file changes &amp;amp; update the live database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="135" LastActivityDate="2018-07-25T18:34:59.360" Title="Craft 3 updates &amp; plugins without allow_url_fopen or SSH" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;manual-updates&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27035" PostTypeId="2" ParentId="27032" CreationDate="2018-07-25T11:36:11.730" Score="2" Body="&lt;p&gt;Tons of ways to skin this cat; a simple option is to use &lt;a href=&quot;https://stackoverflow.com/questions/7704253/how-to-concatenate-strings-in-twig&quot;&gt;string concatenation&lt;/a&gt;, which could look like the below example. Note that I'm actually creating a new variable for &lt;code&gt;classes&lt;/code&gt; at the top of the macro, which IMO helps clean up the markup a little bit and also makes it a bit more clear what's going on – you can continue to do this logic &quot;inline&quot; if you want to, of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the &lt;code&gt;default&lt;/code&gt; filter has been omitted from the Twig statement rendering the &lt;code&gt;classes&lt;/code&gt; variable; it's redundant now because the &lt;code&gt;classes&lt;/code&gt; variable will always be set.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro button(label, link, width, classes, colours, textclasses, alignment) %}&#xA;    {% set classes = 'flex pa2 pa3-ns ph3 tc lh-solid f7 f6-ns link underline-hover z-999 br2 mv3 tracked-moreflex pa2 pa3-ns ph3 tc lh-solid f7 f6-ns link underline-hover z-999 br2 mv3 tracked-more' ~ (classes ? ' ' ~ classes) %}&#xA;    &amp;lt;a href=&quot;{{ link }}&quot; class=&quot;btn {{ width|default('w5') }} {{ colours|default('bg-tdgreen white') }} {{ classes }} {{ alignment|default('center') }}&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;ttu center mv0 {{ textclasses|default('') }}&quot;&amp;gt;{{ label }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important bit is the &lt;code&gt;... ~ (classes ? classes)&lt;/code&gt; part, which basically appends the &lt;code&gt;classes&lt;/code&gt; macro parameter to the default classnames, if the parameter is set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A variation on the above solution, and – in my opinion – maybe a bit cleaner, is to use an array that is joined (i.e. flattened to a string):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro button(label, link, width, classes, colours, textclasses, alignment) %}{% macro button(label, link, width, classes, colours, textclasses, alignment) %}&#xA;    {% set classes = ['flex pa2 pa3-ns ph3 tc lh-solid f7 f6-ns link underline-hover z-999 br2 mv3 tracked-moreflex pa2 pa3-ns ph3 tc lh-solid f7 f6-ns link underline-hover z-999 br2 mv3 tracked-more', classes]|filter|join(' ') %}&#xA;    ...&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, in the above the &lt;code&gt;classes&lt;/code&gt; &lt;em&gt;variable&lt;/em&gt; is an array containing the default classes and whatever was passed in the &lt;code&gt;classes&lt;/code&gt; &lt;em&gt;parameter&lt;/em&gt;. The array is piped through the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/filters.html#filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;filter&lt;/code&gt;&lt;/a&gt; Twig filter, which removes any null/undefined values (i.e. it removes the &lt;code&gt;classes&lt;/code&gt; parameter value if one wasn't set), and finally &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/join.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;join(' ')&lt;/code&gt;&lt;/a&gt; which merges the two array values together with a space (which means it's now a string and you can do &lt;code&gt;{{ classes }}&lt;/code&gt; to print the whole thing).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-25T11:36:11.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27036" PostTypeId="2" ParentId="27033" CreationDate="2018-07-25T16:36:07.127" Score="1" Body="&lt;p&gt;You can include a property to your form called &lt;code&gt;$templatePath&lt;/code&gt; and users can insert whatever they want in this path with a default value to your own template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When someone executed your &lt;code&gt;render()&lt;/code&gt; function you check if the template file exists in the public template path, if so render it, it not render one of your plugin templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the validation fails, you want to include the validated data with errors to the url manager, so you can access it later. During your &lt;code&gt;render()&lt;/code&gt; function you can check if there is data and if it matches your current form element, if so render the data in your url manager instead of the element to display errors. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-25T16:36:07.127" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27037" PostTypeId="1" AcceptedAnswerId="27045" CreationDate="2018-07-25T17:09:30.693" Score="1" ViewCount="793" Body="&lt;p&gt;Knowing that all other actions besides update-cart has been deprecated I'm curious what needs to be passed with the action to remove a line item from the cart using a button as opposed to &lt;code&gt;check a checkbox &amp;gt; update cart&lt;/code&gt; (essentially removing a click for the user). &#xA;The same would apply for +/- buttons/inputs for adding/removing from quantity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see in the example templates there's a checkbox input with &lt;code&gt;name=&quot;lineItems[{{ item.id }}][remove]&quot;&lt;/code&gt;. Is it as simple as changing the input to a submit (or button submit) using the same name tag contents? Would this then also carry over to be posted via ajax in the same way as an update-cart action?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a long question. Trying to wrap my head around the changes as I'm just getting into Craft 3 and Commerce 2...&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2018-07-25T17:17:54.880" LastActivityDate="2018-07-26T00:45:13.410" Title="Craft Commerce 2 — Remove Line Item (and other actions)" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27038" PostTypeId="1" CreationDate="2018-07-25T18:19:04.930" Score="1" ViewCount="62" Body="&lt;p&gt;I have a site with projects which each has a projects structure with an associated category and a number of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL is set as &lt;code&gt;projects/{projectCat.first.slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the structure first for a set of thumbnails for each project (easy - no problem) and then for a gallery page with full size images. Both pages will have the same set of images.&#xA;The URL for the first is &lt;code&gt;.com/projects/category/project-name&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I have been able to do it is to make the links from the thumbnail page using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/projects/gallery/{{ category.slug }}/{{ entry.slug }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then using routing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/projects/gallery/slug/slug to projects/gallery/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works but if I have a project in two or more categories with the same name it doesn't take account of the category in the URL and is also a bit messy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="8632" LastEditorUserId="57" LastEditDate="2018-07-25T21:14:24.257" LastActivityDate="2018-10-30T11:00:28.900" Title="Craft 2 use different template for the same structure" Tags="&lt;templating&gt;&lt;structure&gt;&lt;category&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27039" PostTypeId="2" ParentId="27034" CreationDate="2018-07-25T18:34:59.360" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the only option to avoid CMS access temporarily, copy down the live database, do any updating locally and then upload the file changes &amp;amp; update the live database?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Pretty much.  You'll want to lock the version of PHP in your composer.json file to whatever your production PHP version is so you don't pull in dependencies locally running a higher version of PHP that you deploy live.  You can do that like so:  &lt;a href=&quot;https://github.com/pixelandtonic/craftnet/blob/develop/composer.json#L46-L50&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/craftnet/blob/develop/composer.json#L46-L50&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;allow_url_fopen&lt;/code&gt; is a Composer requirement... there are several issues in their repo of people running into this: &lt;a href=&quot;https://github.com/composer/composer/issues?utf8=%E2%9C%93&amp;amp;q=is%3Aissue+allow_url_fopen&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/composer/composer/issues?utf8=%E2%9C%93&amp;amp;q=is%3Aissue+allow_url_fopen&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-25T18:34:59.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27040" PostTypeId="1" AcceptedAnswerId="27042" CreationDate="2018-07-25T18:50:25.803" Score="2" ViewCount="74" Body="&lt;p&gt;I have the user submitting to a function that adds entries to a field called completed. It basically adds entries to each user showing the admin who has completed what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out how to display a message on the front end that states if the user has completed the article. I need the message to stay on the front end for each entry that's been completed.&lt;/p&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-07-25T19:14:20.570" Title="Display Backend User Entries on Front end" Tags="&lt;craft3&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27041" PostTypeId="2" ParentId="390" CreationDate="2018-07-25T19:10:09.183" Score="1" Body="&lt;p&gt;This is something I discuss in the &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#handling-exceptions-on-the-frontend&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt; article, not just for 404s, but for a number of different status codes/errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual templating code then ends up looking something like this for &lt;code&gt;error.twig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# @var craft \craft\web\twig\variables\CraftVariable #}&#xA;{% set entry = craft.entries.section(&quot;genericError&quot;).one() %}&#xA;&#xA;{% extends &quot;_layouts/errors&quot; %}&#xA;&#xA;{% block _inline_css %}&#xA;    &amp;lt;style&amp;gt;&#xA;        {{ source (&quot;errors/error_critical.min.css&quot;, ignore_missing = true) }}&#xA;    &amp;lt;/style&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use a separate layout template for all of the errors (because they mostly look the same, an image and a message coming from a Single), so here is the &lt;code&gt;errors.twig&lt;/code&gt; layout:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# The layout template for error pages #}&#xA;{# @var craft \craft\web\twig\variables\CraftVariable #}&#xA;{% extends &quot;_layouts/site&quot; %}&#xA;&#xA;{% block main %}&#xA;&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;bg-white flex flex-wrap mt-30 md:mt-85 xl:mt-85&quot;&#xA;             id=&quot;properties&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;w-full mt-45 md:mt-120 xl:mt-180 text-center&quot;&amp;gt;&#xA;                &amp;lt;img src=&quot;{{ entry.errorImage.one().url }}&quot;/&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;    &amp;lt;section&amp;gt;&#xA;        &amp;lt;div class=&quot;bg-white flex flex-wrap&quot; id=&quot;properties&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;w-full my-45 md:my-120 xl:my-180&quot;&amp;gt;&#xA;                &amp;lt;h3 class=&quot;text-center font-surv-disp font-normal text-ss-blue-dark text-24 md:text-30 lg:text-38 mb-45&quot;&amp;gt;&#xA;                    {{ entry.errorMessage }}&#xA;                &amp;lt;/h3&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;{% endblock %}&#xA;&#xA;{% block _inline_js %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which just displays the generic information, and extends the overall &lt;code&gt;site.twig&lt;/code&gt; layout.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-25T19:10:09.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27042" PostTypeId="2" ParentId="27040" CreationDate="2018-07-25T19:14:20.570" Score="2" Body="&lt;p&gt;Assuming &lt;code&gt;completed&lt;/code&gt; is an Entries field, and you want to test if a particular entry has been added to the currently logged in user's &lt;code&gt;completed&lt;/code&gt; field, something like this'd work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set isEntryCompleted = currentUser and entry.id in currentUser.completed.ids() %}&#xA;&#xA;{% if isEntryCompleted %}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea here is to first check if &lt;code&gt;currentUser&lt;/code&gt; is set (it'll be &lt;code&gt;null&lt;/code&gt; if the current user isn't logged in), and then pull an array of all selected entries' IDs with &lt;code&gt;currentUser.completed.ids()&lt;/code&gt;. Finally you can use the &lt;code&gt;in&lt;/code&gt; operator to check if a particular entry's ID is in that array.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-25T19:14:20.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27043" PostTypeId="1" CreationDate="2018-07-25T20:45:01.580" Score="1" ViewCount="538" Body="&lt;p&gt;I know there are similar questions here, but I don't see a definitive answer, nor one that works for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've generated a plugin via pluginfactory.io, which has some controllers and a single service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can call the controllers in the CP without issue - if I just return a 'Hello world' from any of the controller methods, it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I follow the example supplied in the code comments (for the service file) inside of my controller action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPluginName::$plugin-&amp;gt;importer-&amp;gt;exampleService()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an exception:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unknown Property – yii\base\UnknownPropertyException&#xA;  Getting unknown property: amphibian\mypluginname\MyPluginName::Importer&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have a service file called &lt;code&gt;Importer&lt;/code&gt; in my &lt;code&gt;services&lt;/code&gt; folder, with a class name of &lt;code&gt;Importer&lt;/code&gt;, and a method named &lt;code&gt;exampleService()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;extra&lt;/code&gt; section of my &lt;code&gt;composer.json&lt;/code&gt; file lists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;components&quot;: {&#xA;    &quot;importer&quot;: &quot;amphibian\\mypluginname\\services\\Importer&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What else am I missing?&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-07-26T10:27:50.217" Title="Unable to call a service method from controller in my custom plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;controller&gt;&lt;services&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27044" PostTypeId="1" CreationDate="2018-07-25T21:18:35.130" Score="1" ViewCount="1100" Body="&lt;p&gt;I'm adjusting the maxUploadFileSize in Craft, to 50MB.&lt;br&gt;&#xA;In following the post below, I made several adjustments to both: php.ini and craft/config/general.php.&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/3263480/upload-max-size-in-php&quot;&gt;https://stackoverflow.com/questions/3263480/upload-max-size-in-php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I adjusted settings in php.ini:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;upload_max_filesize &#xA;post_max_size&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In general.php (craft/config), the following was already set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &quot;http://&quot; );&#xA;  define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');&#xA;  define('BASEPATH',       realpath(CRAFT_BASE_PATH . '/../') . '/');&#xA;&#xA; return array(&#xA;&#xA;  '*' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;        'siteUrl'  =&amp;gt; SITE_URL,&#xA;        'basePath' =&amp;gt; BASEPATH,&#xA;        'maxUploadFileSize' =&amp;gt; 62914560,&#xA;        ),&#xA;  ),&#xA;  'dev' =&amp;gt; array(&#xA;    'devMode' =&amp;gt; true,&#xA;  )&#xA;&#xA;&#xA; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that that is around 62MB, but I keep receiving an error message saying that there is a 16MB limit on files.  All other files great than 2MB and less than 16MB now are upload-able.&lt;br&gt;&#xA;Can anyone make a suggestion as to why the standard CraftCMS default of 16MB is now in place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any leads&lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="6879" LastEditDate="2018-07-26T20:22:05.247" LastActivityDate="2019-05-31T21:23:15.247" Title="Adjusting Max File Size - Stuck at 16M After Adjusting general.php" Tags="&lt;upload&gt;&lt;limit&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="27045" PostTypeId="2" ParentId="27037" CreationDate="2018-07-26T00:45:13.410" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it as simple as changing the input to a submit (or button submit)&#xA;  using the same name tag contents?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would this then also carry over to be posted via ajax in the same way&#xA;  as an update-cart action?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything can be done on a single line item basis to the update-cart acton, just use the new param names.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-07-26T00:45:13.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27048" PostTypeId="2" ParentId="22916" CreationDate="2018-07-26T11:16:51.480" Score="1" Body="&lt;p&gt;Not really a solution, I know, but in the absence of any support from the developer on this there may be a workaround.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I've been developing using planIntervals of only 1 day so I can see what's going on. As noted in your question, it never updates to the correct currentPeriodEnd, but it does seem to be updating. It looks like it updates to the end of the next but last payment taken. Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got three payments taken for this subscriber:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-07-26&#xA;2018-07-25&#xA;2018-07-24&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the last payment being on 26 July, currentPeriodEnd should be 27 July. It isn't. It's outputting 26 Jul, the period end of the next to last payment. Or maybe the actual date the last payment was taken. I'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than fix this, I'm probably just going to test for the subscription being active and adding the planInterval to the currentPeriodEnd. But only if more than the initial payment has been made.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if charge.subscription.status == &quot;active&quot; %}&#xA;&#xA;    {% if charge.payments | length &amp;gt; 1 %}&#xA;        {% set paymentEnd = charge.subscription.currentPeriodEnd | date_modify(&quot;+1 day&quot;) %}&#xA;    {% else %}&#xA;        {% set paymentEnd = charge.subscription.currentPeriodEnd %}&#xA;    {% endif %}&#xA;&#xA;    {{ paymentEnd | date('j M Y') }}&amp;lt;br&amp;gt;&#xA;    {% set daysToRenewal = date(paymentEnd).diff(now).days %}&#xA;    {{ daysToRenewal }} days to renewal&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&#xA;    {# Send email to subscriber if exactly 28 days to go #}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-07-26T11:27:51.317" LastActivityDate="2018-07-26T11:27:51.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27049" PostTypeId="2" ParentId="9793" CreationDate="2018-07-26T12:30:32.260" Score="3" Body="&lt;p&gt;This is a very old question, but thanks to this example I was able to build quickly a profile picture form using Craft 3 and jQuery File Upload plugin (thank you!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action value and file input name have changed. You should write it like this now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;image-upload&quot; type=&quot;file&quot; name=&quot;photo&quot; style=&quot;display: none;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-07-26T12:30:32.260" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27050" PostTypeId="1" AcceptedAnswerId="27052" CreationDate="2018-07-26T13:33:26.273" Score="3" ViewCount="183" Body="&lt;p&gt;This is on Centos 7.5 using a vmware local vm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installed Apache, MariaDB 10.2, PHP 7.1 (Remi) in that order&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logged in as root, no sudo or su&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installed composer 1.6.5 without issue&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;cd /var/www/html&#xA;  composer create-project craftcms/craft .&#xA;  ./craft setup&#xA;  No errors or warnings after confirming &quot;yes&quot; to &quot;Install Craft now?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I had the same problem trying to install from the archive manually but I figured I might have done something wrong so I set up a clean new LAMP VM and used only composer. I appreciate any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Directory contents below&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[root@localhost html]# ll&#xA;  total 128&#xA;  -rw-r--r--  1 root root    387 Jul 17 13:37 composer.json&#xA;  -rw-r--r--  1 root root 100025 Jul 26 15:02 composer.lock&#xA;  drwxr-xr-x  3 root root     88 Jul 17 13:37 config/&#xA;  -rwxr-xr-x  1 root root    577 Jul 17 13:37 craft*&#xA;  -rw-r--r--  1 root root    330 Jul 17 13:37 craft.bat&#xA;  -rw-r--r--  1 root root    926 Jul 26 15:06 .env&#xA;  -rw-r--r--  1 root root    875 Jul 17 13:37 .env.example&#xA;  -rw-r--r--  1 root root     31 Jul 17 13:37 .gitignore&#xA;  drwxr-xr-x  2 root root     24 Jul 17 13:37 modules/&#xA;  drwxr-xr-x  4 root root     51 Jul 26 15:02 storage/&#xA;  drwxr-xr-x  2 root root     40 Jul 17 13:37 templates/&#xA;  drwxr-xr-x 28 root root   4096 Jul 26 15:02 vendor/&#xA;  drwxr-xr-x  3 root root     77 Jul 17 13:37 web/&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8637" LastActivityDate="2018-07-26T14:08:44.880" Title="No index.php file created during install using composer" Tags="&lt;install&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27051" PostTypeId="1" AcceptedAnswerId="27167" CreationDate="2018-07-26T14:02:41.893" Score="2" ViewCount="1812" Body="&lt;p&gt;I’m using the Contact Form plugin to submit a form that can also upload files via Ajax. The problem ist that instead of a success (&lt;code&gt;200&lt;/code&gt;) I get a status code of &lt;code&gt;302&lt;/code&gt;. But I receive the resulting mail properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything worked fine when I hadn’t set everything up for the file upload. I serialized the form data, expected json, success (&lt;code&gt;200&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;dataType: 'json',&#xA;data: $(this).serialize(),&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I switched to this to enable receiving files, things went south (&lt;code&gt;302&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const formData = new FormData(this.form);&#xA;&#xA;$.post({&#xA;    url: '/index.php',&#xA;    data: formData,&#xA;    type: 'POST',&#xA;    cache: false,&#xA;    contentType: false,&#xA;    processData: false,&#xA;&#xA;    success: response =&amp;gt; {&#xA;        if (response.success) {&#xA;            this.showSuccess();&#xA;        } else {&#xA;            this.showError();&#xA;        }&#xA;    },&#xA;    error: (xhr) =&amp;gt; {&#xA;        // FIXME: This is a workaround because for some reason Craft returns a 302, even though everything works&#xA;        //        fine. See stackoverflow question here and fix if there is a solution.&#xA;        if (xhr.status === 302) {&#xA;        this.showSuccess();&#xA;        } else {&#xA;        this.showError();&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I’m on Craft 3.0.15 and set up SMTP in Settings -&gt; EMail. I tried it locally (using MAMP) and on my hosted server. Both give me the &lt;code&gt;302&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint would be much appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Mark&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2018-08-04T13:19:24.300" Title="Contact Form sent via Ajax with file upload returns 302 instead of 200 status code" Tags="&lt;craft3&gt;&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27052" PostTypeId="2" ParentId="27050" CreationDate="2018-07-26T14:08:44.880" Score="3" Body="&lt;p&gt;Your index.php file should be found under the &lt;code&gt;web&lt;/code&gt; directory. All of the other files and folders installed by composer are considered to be above the root which is recommended for security reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Place all of your css, js, images, etc into the &lt;code&gt;web&lt;/code&gt; folder and create your twig files in the &lt;code&gt;templates&lt;/code&gt; folder and you shouldn't need to edit your index.php file, but &lt;code&gt;web&lt;/code&gt; is essentially where it lives. This folder can be renamed to public, httpdocs, or anything you wish. It will be used by your set up as the public root of the domain. I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2018-07-26T14:08:44.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27053" PostTypeId="1" CreationDate="2018-07-26T14:28:12.787" Score="3" ViewCount="843" Body="&lt;p&gt;I've had to continue with a Craft CMS install somebody else did, now trying to make sense of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A client bought a PRO licence, but the CMS seems to still have a SOLO installed. Is there anyway to convert one to another without having down time in the site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no option to upgrade the CMS once you bought the PRO license.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: worth noting that clicking &quot;reactivate&quot; results in a &quot;Craft has successfully been upgraded&quot; but does not result in the removal of the &quot;trial&quot; message in the bottom or in added functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6wqLv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6wqLv.png&quot; alt=&quot;solo/pro&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8639" LastEditorUserId="57" LastEditDate="2018-07-26T18:07:12.670" LastActivityDate="2018-07-26T18:07:12.670" Title="Convert CMS from SOLO version to PRO" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27054" PostTypeId="1" AcceptedAnswerId="27070" CreationDate="2018-07-26T14:48:48.707" Score="2" ViewCount="417" Body="&lt;p&gt;I'm using Craft 3 and have created a section (channel type) for my project entries. At the bottom of each project page I have my Prev and Next Project buttons. How do I target the first and last project entry based upon the post date? I want to add some space between the buttons when they're together, but dispense with it on the first and last entries because.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my current code from my project _entry template for the buttons:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set params = {section: 'projectEntries', order: 'postDate desc', limit: null} %}&#xA;{% set entry_prev = entry.getPrev(params) %}&#xA;{% set entry_next = entry.getNext(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the buttons I'm using an if statement to show the next or prev URLs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To target the first entry I've tried using : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.entries.section('projectEntries').order('postDate desc').one() %}&#xA;    show alt button code&#xA;{% else %}&#xA;    show regular button code&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which shows my alt button code, but shows it on every project page, instead of just on the first entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Richard  &lt;/p&gt;&#xA;" OwnerUserId="8170" LastEditorUserId="57" LastEditDate="2018-07-26T18:06:21.190" LastActivityDate="2018-07-27T19:39:21.093" Title="Targeting the first entry item" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sections&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27055" PostTypeId="2" ParentId="27053" CreationDate="2018-07-26T15:22:38.727" Score="4" Body="&lt;p&gt;“Reactivate” is the button you are looking for. Try checking for updates so Craft gets updated license info – the Trial badge sholud go away once Craft realizes that it’s licensed to run Pro. (If not, please contact support@craftcms.com and send in your &lt;code&gt;config/license.key&lt;/code&gt; file, and we’ll sort it out.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-07-26T15:22:38.727" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27056" PostTypeId="2" ParentId="27051" CreationDate="2018-07-26T18:03:54.547" Score="0" Body="&lt;p&gt;My guess would be this check is failing: &lt;a href=&quot;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L60-L62&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L60-L62&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($request-&amp;gt;getAcceptsJson()) {&#xA;    return $this-&amp;gt;asJson(['errors' =&amp;gt; $submission-&amp;gt;getErrors()]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it falls through to this redirect because Craft thinks it's a non-AJAX POST: &lt;a href=&quot;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L77&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/blob/v2/src/controllers/SendController.php#L77&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting your &lt;code&gt;contentType&lt;/code&gt; to &lt;code&gt;application/json&lt;/code&gt; instead of &lt;code&gt;false&lt;/code&gt; should resolve it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-26T18:03:54.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27057" PostTypeId="1" CreationDate="2018-07-26T21:07:29.900" Score="1" ViewCount="46" Body="&lt;p&gt;I am trying to create a Sub Task with Craft 2 that uses a task class. I have created some generic code to explain my setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parent Task Class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Downloadxml_ParentTask extends BaseTask{&#xA;    //typical defineSettings(), getDescription(), etc&#xA;&#xA;    public function runStep(){&#xA;        craft()-&amp;gt;downloadxml_fooCalc-&amp;gt;getFooCalc();&#xA;        return true;    &#xA;     }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sub Task Class&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Downloadxml_ChildTask extends Downloadxml_ParentTask{&#xA;&#xA;    //No defineSettings(), getDescription(), etc &#xA;    //since we inherit from parent class&#xA;&#xA;    public function runStep(){&#xA;        craft()-&amp;gt;downloadxml_barCalc-&amp;gt;getBarCalc();&#xA;        return true;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Related Main Task runner:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class Downloadxml_GetAllXmlTask extends BaseTask{&#xA;//typical defineSettings(), getDescription(), etc&#xA;    public function runStep(){&#xA;    $settings = array(&#xA;        'foo' =&amp;gt; 'yub',&#xA;        'bar' =&amp;gt; 'nub',&#xA;    );&#xA;    $message = 'Preparing Bar for Calc';&#xA;    return $this-&amp;gt;runSubTask('Downloadxml_Child' $message, $settings);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Calling the task to run from Console Command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class DownloadxmlCommand extends BaseCommand&#xA;{&#xA;&#xA;    public function actionGenerateXMLForDownload() &#xA;    {&#xA;        craft()-&amp;gt;downloadxml_taskCreateService-&amp;gt;createDownloadTask();&#xA;        craft()-&amp;gt;downloadxml_taskCreateService-&amp;gt;runAllTasks();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin service the Command is calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class Downloadxml_TaskCreateService extends BaseApplicationComponent&#xA;{&#xA;    public function createDownloadTask()&#xA;    {&#xA;        $message = &quot;Starting XML Download&quot;;&#xA;        $settings = array();&#xA;        craft()-&amp;gt;tasks-&amp;gt;createTask('Downloadxml_GetAllXml', $message, $settings);&#xA;    }&#xA;    public function runAllTasks() {&#xA;&#xA;        // Run tasks&#xA;        if (!craft()-&amp;gt;tasks-&amp;gt;isTaskRunning())&#xA;        {&#xA;            $task = craft()-&amp;gt;tasks-&amp;gt;getNextPendingTask();&#xA;&#xA;            if ($task)&#xA;            {&#xA;                craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run the &lt;code&gt;Downloadxml_GetAllXmlTask&lt;/code&gt; task, I get an error of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fatal error: Class 'Craft\Downloadxml_ParentTask' not found in &amp;lt;location of Main Task Runner&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am doing this is to try and keep my codebase DRY as to not have the same code for the settings for each task class. I have several classes like this, and they are failing the same way. Looking through core, it doesn't immediately appear clear to me as to why this isn't inheriting properly and working as expected. Currently running Craft 2.6.2967.&lt;/p&gt;&#xA;" OwnerUserId="8640" LastEditorUserId="8640" LastEditDate="2018-07-27T15:25:29.310" LastActivityDate="2018-07-27T15:25:29.310" Title="Subclassing BaseTask Class" Tags="&lt;plugin-development&gt;&lt;plugins&gt;&lt;tasks&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27058" PostTypeId="2" ParentId="27044" CreationDate="2018-07-26T21:15:42.723" Score="1" Body="&lt;p&gt;My guess is that your php &lt;code&gt;upload_max_filesize&lt;/code&gt; is set to 16M, you'll need to adjust that.&lt;/p&gt;&#xA;" OwnerUserId="8425" LastActivityDate="2018-07-26T21:15:42.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27059" PostTypeId="1" AcceptedAnswerId="27061" CreationDate="2018-07-27T00:11:10.787" Score="2" ViewCount="170" Body="&lt;p&gt;I've been searching and trying things for a few days now, but I feel like I'm spinning my wheels. I've got a Python script that reads in a .pptx file, and returns a &lt;a href=&quot;https://docs.python.org/2/tutorial/datastructures.html#dictionaries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dictionary&lt;/a&gt; of slides. I've also tried returning different things from the Python script, even as simple as a Hello World string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity's sake, I just have this code in my &lt;code&gt;onAfterInstall()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$output = shell_exec(&quot;import_ppt.py 'original.pptx' &quot;);&#xA;    var_dump($output);&#xA;var_dump($output);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the filepath, I've also tried &lt;code&gt;&quot;.realpath(dirname(__FILE__)).&quot;/&lt;/code&gt; as well, to no avail. I always get a &lt;code&gt;NULL&lt;/code&gt; return and a PHP warning about not being able to modify headers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in my Python file, I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if __name__ == '__main__':&#xA;import sys&#xA;buildSlideshow(sys.argv[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;buildSlideshow takes one argument, which is the filepath of the powerpoint file, and eventually returns the dictionary of slides and slide content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the error isn't in my Python code, as if I run it in shell I don't have any problems with it and get the result I want. So, my overall question is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is what I'm trying to do a pipe dream, or am I just missing something major? I can't find any docs about CraftxPython, simply searching the word &quot;Python&quot; on this very site brought up no results, and when I tried looking up how to incorporate Python into a Craft 2 plugin, all I got was information on how to create a plugin for Python.&lt;/p&gt;&#xA;" OwnerUserId="8641" LastEditorUserId="8641" LastEditDate="2019-03-11T14:36:00.630" LastActivityDate="2019-03-11T14:36:00.630" Title="Is it possible to create a plugin using Python in Craft 2?" Tags="&lt;plugin-development&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27060" PostTypeId="1" CreationDate="2018-07-27T01:22:53.690" Score="2" ViewCount="365" Body="&lt;p&gt;I have ajax submitting my form everything works except the user image. It works without ajax but not sure why it's not working with ajax. My ajax is and form are shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; id=&quot;profile-form&quot; action=&quot;&quot; class=&quot;form&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;&#xA;    {{ csrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;account&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    {{ redirectInput('my-program/account') }}&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row no-gutters&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-sm-3&quot;&amp;gt;&#xA;            {% if currentUser.getPhoto != '' %}&#xA;                &amp;lt;img src=&quot;{{ currentUser.photo.getUrl }}&quot; alt=&quot;&quot; class=&quot;mx-auto d-block img-fluid&quot; style=&quot;width:150px;&quot;&amp;gt;&#xA;            {% else %}&#xA;                &amp;lt;img src=&quot;http://13.57.33.145/web/cpresources/e68e2d59/images/user.svg?v=1532465642&quot; class=&quot;mx-auto d-block img-fluid&quot; style=&quot;width:120px;&quot;&amp;gt;&#xA;            {% endif %}&#xA;            &amp;lt;input type=&quot;file&quot; id=&quot;userPhoto&quot; name=&quot;photo&quot; value=&quot;Upload&quot;&amp;gt;&#xA;            &amp;lt;div id=&quot;profile-image-upload&quot; class=&quot;text-center&quot;&amp;gt;Change Avatar&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;col-sm-9&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;Name&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;fullName&quot; name=&quot;fields[fullName]&quot; value=&quot;{{ currentUser.fullName }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;Role&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;userRole&quot; name=&quot;&quot; value=&quot;Your Role here&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;company&quot;&amp;gt;company&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;company&quot; name=&quot;fields[company]&quot; value=&quot;{{ currentUser.company }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;email&quot;&amp;gt;email&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&#xA;                &amp;lt;input type=&quot;text&quot; id=&quot;email&quot; name=&quot;fields[email]&quot; value=&quot;{{ currentUser.email }}&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- end row --&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-lg-11 offset-md-0&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;submit&quot; value=&quot;Save Changes&quot; id=&quot;saveProfile&quot; class=&quot;dark-btn&quot;&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&#xA;$(&quot;#profile-form&quot;).submit( function(e) {&#xA;    e.preventDefault();&#xA;    var data = $(this).serialize();&#xA;&#xA;    $.ajax({&#xA;        method: &quot;POST&quot;,&#xA;        url: &quot;users/save-user&quot;,&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'},&#xA;        success: function(data, response){&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8619" LastEditorUserId="57" LastEditDate="2018-07-27T13:47:42.203" LastActivityDate="2018-07-27T13:47:42.203" Title="Ajax not updating user image" Tags="&lt;craft3&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27061" PostTypeId="2" ParentId="27059" CreationDate="2018-07-27T02:23:31.357" Score="2" Body="&lt;p&gt;I think you're going to have a bad time if you attempt to do this. Probably a better way would be to use &lt;a href=&quot;https://github.com/PHPOffice/PHPPresentation&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHPPresentation&lt;/a&gt; to read in the &lt;code&gt;.pptx&lt;/code&gt; files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integration is certainly possible between server-side languages, but you're going to have to jump through a good deal of hoops that you could more easily just avoid by writing your plugin in PHP.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-27T02:23:31.357" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27062" PostTypeId="1" CreationDate="2018-07-27T07:20:38.593" Score="3" ViewCount="583" Body="&lt;p&gt;My provider upgraded to PHP7 and deleted all files outside of the public folder, where I had the system files (...). Is it possible to find out from the database which version (of Craft 2) I need to restore the website?&lt;/p&gt;&#xA;" OwnerUserId="6388" LastActivityDate="2018-07-27T13:42:32.560" Title="Craft version number in database?" Tags="&lt;database&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27063" PostTypeId="2" ParentId="27062" CreationDate="2018-07-27T07:30:36.680" Score="2" Body="&lt;p&gt;I think I've already found it: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`craft_info` (`id`, `**version**`, `schemaVersion`, `edition`, `siteName`, `siteUrl`, `timezone`, `on`, `maintenance`, `dateCreated`, `dateUpdated`, `uid)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can download the correct version from this great service: &lt;a href=&quot;https://craftcms.com/support/download-previous-versions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/download-previous-versions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6388" LastEditorUserId="57" LastEditDate="2018-07-27T13:42:32.560" LastActivityDate="2018-07-27T13:42:32.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27064" PostTypeId="2" ParentId="27060" CreationDate="2018-07-27T07:36:47.720" Score="1" Body="&lt;p&gt;You can't just upload files via serialized form data by default with jQuery. I suggest you to create a new &lt;code&gt;FormData&lt;/code&gt; instead and &lt;code&gt;append&lt;/code&gt; the files from your input, so you need to grab them first &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a good guide &lt;a href=&quot;https://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple file uploads&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-27T07:36:47.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27066" PostTypeId="1" AcceptedAnswerId="27067" CreationDate="2018-07-27T14:50:42.080" Score="2" ViewCount="492" Body="&lt;p&gt;This project has a lot of user stuff. I need to display display different sections based on if the current user is in a field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better/faster way than looping through and checking if every user matched the current user?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for approve in entry.docsApprovedBy.all() %}&#xA;   {% if approve.id == currentUser.id %}...{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-07-27T14:58:48.097" Title="Is there a way to check if entry is selected in relationship?" Tags="&lt;craft3&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27067" PostTypeId="2" ParentId="27066" CreationDate="2018-07-27T14:58:48.097" Score="2" Body="&lt;p&gt;You should read the docs about &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;relations&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;relatedEntries = craft.entries.relatedTo({targetElement: currentUser, field: 'docsApprovedBy'}).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-27T14:58:48.097" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27068" PostTypeId="2" ParentId="26811" CreationDate="2018-07-27T16:25:52.703" Score="1" Body="&lt;p&gt;Dynamic values work in Sprout Forms as of Sprout Forms v3.0.0-beta.21.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can target any value that is being submitted by your form using the shorthand syntax from your example &lt;code&gt;{email}&lt;/code&gt; or object syntax &lt;code&gt;{{ object.email }}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-27T16:25:52.703" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27069" PostTypeId="2" ParentId="26964" CreationDate="2018-07-27T17:30:23.933" Score="2" Body="&lt;p&gt;This is by design. Revisions are not meant to be editable.&lt;/p&gt;&#xA;" OwnerUserId="8606" LastActivityDate="2018-07-27T17:30:23.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27070" PostTypeId="2" ParentId="27054" CreationDate="2018-07-27T17:36:07.903" Score="2" Body="&lt;p&gt;The conditional &lt;code&gt;{% if craft.entries.section('projectEntries').order('postDate desc').one() %}&lt;/code&gt; basically just tests if the &lt;code&gt;craft.entries.section&lt;/code&gt; query returns an entry or not. Obviously, that would evaluate to &lt;code&gt;true&lt;/code&gt; on every entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you probably want to test if the first entry returned by the above query is the &lt;em&gt;same as the current entry&lt;/em&gt;. A good way to do that, is to compare the entry IDs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEntry = craft.entries.section('projectEntries').order('postDate desc').one() %}&#xA;&#xA;{% if entry.id == firstEntry.id %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To test for the &lt;em&gt;last&lt;/em&gt; entry, you could do something like this (notice that the only difference from the above query is that the sort order is reversed):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastEntry = craft.entries.section('projectEntries').order('postDate asc').one() %}&#xA;&#xA;{% if entry.id == lastEntry.id %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If, however, you have access to the &lt;code&gt;entry_prev&lt;/code&gt; and &lt;code&gt;entry_next&lt;/code&gt; variables within the Twig block that renders the buttons, you can avoid extra database queries altogether by simply checking if those variables are &lt;code&gt;null&lt;/code&gt; or not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry_prev %}&#xA;    {# No previous entry; the current entry must be the first #}&#xA;    ...&#xA;{% elseif not entry_next %}&#xA;    {# No next entry; the current entry must be the last #}&#xA;    ...&#xA;{% else %}&#xA;    {# The current entry is neither the first nor last #}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you can't use the &lt;code&gt;entry_prev&lt;/code&gt; and &lt;code&gt;entry_next&lt;/code&gt; variables, a more optimized way to do it than pulling the first and last entries would be to do something like the below – note the use of &lt;code&gt;ids()&lt;/code&gt; instead of &lt;code&gt;all()&lt;/code&gt;; this is an optimization due to it being cheaper to just pull the entry IDs instead of the full entry models:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntryIds = craft.entries.section('projectEntries').order('postDate desc').ids() %}&#xA;&#xA;{% set firstEntryId = allEntryIds|first %}&#xA;{% set lastEntryId = allEntryIds|last %}&#xA;&#xA;{% if entry.id == firstEntryId %}&#xA;    {# The current entry is the first one #}&#xA;    ...&#xA;{% elseif entry.id == lastEntryId %}&#xA;    {# The current entry is the last one #}&#xA;    ...&#xA;{% else %}&#xA;    {# The current entry is neither the first nor the last #}&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-07-27T19:39:21.093" LastActivityDate="2018-07-27T19:39:21.093" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27071" PostTypeId="1" AcceptedAnswerId="27113" CreationDate="2018-07-27T18:28:31.557" Score="3" ViewCount="78" Body="&lt;p&gt;I've got a directory download feature running on the Printmaker Plugin, that's including some odd spaces and blank pages. Live example at: &lt;a href=&quot;https://correctionstocollegeca.org/directory-download&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://correctionstocollegeca.org/directory-download&lt;/a&gt;. Everything is great until the last couple pages, where entries get spaced out one per page, and the last page is blank. Any ideas for fixing the spacing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set html %}&#xA;  &amp;lt;html&amp;gt;&#xA;        &amp;lt;head&amp;gt;&#xA;            &amp;lt;link href=&quot;https://correctionstocollegeca.org/css/doc.css&quot; rel=&quot;stylesheet&quot;/&amp;gt;&#xA;        &amp;lt;/head&amp;gt;&#xA;        &amp;lt;body&amp;gt;&#xA;            &amp;lt;img src=&quot;https://correctionstocollegeca.org/assets/globals/ctcca-logo.png&quot; style=&quot;width: 200px;&quot;&amp;gt;&#xA;            &amp;lt;h1 style=&quot;line-height:0.8;margin-top:8px;&quot;&amp;gt;{{ entry.displayTitle }}&amp;lt;/h1&amp;gt;&#xA;&#xA;            {% if craft.request.getParam('type') is not null %}&#xA;&#xA;                        {# Get search parameters from the URL query string #}&#xA;                        {% set query = craft.request.getParam('type') %}&#xA;&#xA;                        {# Start an array of search parameters (relationParam) with 'and' to match ALL categories #}&#xA;                        {% set relationParam = ['and'] %}&#xA;&#xA;                        {# Find categories that match the slugs in your query string... #}&#xA;                        {% for querySlug in query %}&#xA;                                {% set category = craft.categories.group('programTypes').slug(querySlug) %}&#xA;&#xA;                                {# And merge them into the relationParam array. #}&#xA;                                {% set relationParam = relationParam|merge([{ targetElement: category }]) %}&#xA;                        {% endfor %}&#xA;&#xA;                        {# Avoid passing an array with `['and']` only #}&#xA;                        {% if relationParam|length &amp;lt; 2 %}&#xA;                            {% set relationParam = '' %}&#xA;                        {% endif %}&#xA;&#xA;                        {% set searchParams = {&#xA;                            relatedTo:  relationParam,&#xA;                            section: 'colleges'&#xA;                        } %}&#xA;&#xA;                        {# Find your entries #}&#xA;                        {% set programs = craft.entries(searchParams).order('title') %}    &#xA;&#xA;                {% elseif craft.request.getParam('facility') is not null %}&#xA;&#xA;                        {% set query = craft.entries.slug(craft.request.getParam('facility')) %}&#xA;                        {% set programs =  craft.entries.section('colleges').relatedTo(query).order('title') %}&#xA;                        {% set indicatorQuery = craft.request.getParam('facility') %}&#xA;&#xA;                {% elseif craft.request.getParam('keyword') is not null %}&#xA;&#xA;                        {% set query = craft.request.getParam('keyword') %}&#xA;                        {% set programs =  craft.entries.section('colleges').search(query).order('score') %}&#xA;&#xA;                {% elseif craft.request.getParam('featured') is not null %}&#xA;&#xA;                        {% set featured = craft.request.getParam('featured') %}&#xA;                        {% set featuredPrograms =  craft.entries.id(featured) %}&#xA;                        {% set programs = craft.entries.section('colleges').order('title').id('and, not ' ~ featured | join(', not '))%}&#xA;&#xA;                {% elseif craft.request.getParam('featuredFacility') is not null %}&#xA;&#xA;                        {% set featuredFacility = craft.entries.slug(craft.request.getParam('featuredFacility')) %}&#xA;                        {% set featuredPrograms =  craft.entries.section('colleges').relatedTo(featuredFacility).order('title') %}&#xA;                        {% set featuredIds = featuredPrograms.ids() %}&#xA;                        {% set programs = craft.entries.section('colleges').order('title').id('and, not ' ~ featuredIds | join(', not ')) %}&#xA;&#xA;                {% else %}&#xA;&#xA;                        {% set programs = craft.entries.section('colleges').order('title') %}&#xA;&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;!-- Query Indicator --&amp;gt;&#xA;                {% set queryString = craft.request.getQueryString() %}&#xA;                {% if craft.request.getParam('type') is not null %}&#xA;                    &amp;lt;br&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&#xA;                        This is a subset of the full directory filtered to show only&#xA;                        {% if query|length == 1 %}&#xA;                            {% for slug in query %}&#xA;                                {% for indicator in craft.categories.slug(slug) %}&#xA;                                    {{ indicator.title|lower }}s.&#xA;                                {% endfor %}&#xA;                            {% endfor %}&#xA;                        {% elseif  queryString == &quot;p=directory-download&amp;amp;type%5B%5D=prison-program&amp;amp;type%5B%5D=jail-program&quot; %}&#xA;                            prison and jail programs.&#xA;                        {% elseif  queryString == &quot;p=directory-download&amp;amp;type%5B%5D=prison-program&amp;amp;type%5B%5D=campus-program&quot; %}&#xA;                            prison and campus programs.&#xA;                        {% elseif  queryString == &quot;p=directory-download&amp;amp;type%5B%5D=prison-program&amp;amp;type%5B%5D=jail-program&amp;amp;type%5B%5D=campus-program&quot; %}&#xA;                            prison, jail and campus programs.&#xA;                        {% elseif  queryString == &quot;p=directory-download&amp;amp;type%5B%5D=jail-program&amp;amp;type%5B%5D=campus-program&quot; %}&#xA;                            jail and campus programs.&#xA;                        {% endif %}&#xA;                    &amp;lt;/p&amp;gt;{{ entry.sortedDirectoryExplanation }}&#xA;&#xA;                {% elseif craft.request.getParam('keyword') is not null %}&#xA;                    &amp;lt;br&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&#xA;                        This is a subset of the full directory filtered by &#xA;                            &amp;lt;span class=&quot;label filter-label&quot;&amp;gt;the keyword: &quot;{{ query }}.&quot;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;/p&amp;gt;{{ entry.sortedDirectoryExplanation }}&#xA;&#xA;                {% elseif craft.request.getParam('facility') is not null %}&#xA;                    &amp;lt;br&amp;gt;&#xA;                    &amp;lt;p&amp;gt;&#xA;                        This is a subset of the full directory showing only programs operating in&#xA;                        {% for slug in indicatorQuery %}&#xA;                            {% for indicator in craft.entries.slug(slug) %}&#xA;                                &amp;lt;span class=&quot;label filter-label&quot;&amp;gt;{{ indicator.title }}.&amp;lt;/span&amp;gt;&#xA;                            {% endfor %}&#xA;                        {% endfor %}&#xA;                    &amp;lt;/p&amp;gt;{{ entry.sortedDirectoryExplanation }}&#xA;&#xA;                {% endif %}&amp;lt;!-- /Query Indicator --&amp;gt;&#xA;&#xA;            &amp;lt;br&amp;gt;&#xA;            &amp;lt;table style=&quot;table-layout: fixed; width:100%;&quot; &amp;gt;&#xA;                {% for program in programs %}&#xA;                    &amp;lt;tr&amp;gt;&#xA;                        &amp;lt;td colspan=&quot;3&quot; style=&quot;width:33%;border:1px solid #bbb;padding-left:10px;padding-right:10px;&quot; valign=&quot;top&quot;&amp;gt;&#xA;                            &amp;lt;h2&amp;gt;{{ program.displayTitle }}&amp;lt;span class=&quot;no-wrap&quot;&amp;gt;&#xA;                                {% for type in program.programTypes %}&#xA;                                    {% if type.slug == 'prison-program' %}&#xA;                                        &amp;lt;img src=&quot;https://correctionstocollegeca.org/assets/globals/p-symbol.png&quot; style=&quot;width:18px;margin-right:5px;&quot;&amp;gt;&#xA;                                    {% elseif type.slug == 'jail-program' %}&#xA;                                        &amp;lt;img src=&quot;https://correctionstocollegeca.org/assets/globals/j-symbol.png&quot; style=&quot;width:18px;margin-right:5px;&quot;&amp;gt;&#xA;                                    {% elseif type.slug == 'campus-program' %}&#xA;                                        &amp;lt;img src=&quot;https://correctionstocollegeca.org/assets/globals/c-symbol.png&quot; style=&quot;width:18px;margin-right:5px;&quot;&amp;gt;&#xA;                                    {% endif %}&#xA;                                {% endfor %}&amp;lt;/span&amp;gt;&#xA;                            &amp;lt;/h2&amp;gt;&#xA;                            &amp;lt;p class=&quot;directory-location&quot;&amp;gt;{{ program.programLocation }}&amp;lt;/p&amp;gt;&#xA;                            {% if ( program.programWebsite | length ) or ( program.programFacebook| length ) %}&#xA;                                &amp;lt;p class=&quot;directory-links&quot;&amp;gt;{% if program.programWebsite|length %}&amp;lt;a href=&quot;//{{ program.programWebsite }}&quot;&amp;gt;{{ program.programWebsite }}&amp;lt;/a&amp;gt;{% endif %}{% if ( program.programWebsite | length ) and ( program.programFacebook| length ) %} | {% endif %}{% if program.programFacebook|length %}&amp;lt;a href=&quot;{{ program.programFacebook }}&quot;&amp;gt;facebook&amp;lt;/a&amp;gt;{% endif %}&amp;lt;/p&amp;gt;&#xA;                            {% endif %}&#xA;                            &amp;lt;table style=&quot;table-layout: fixed; width:100%;&quot;&amp;gt;&#xA;                                &amp;lt;tr&amp;gt;&#xA;                                    &amp;lt;td style=&quot;width: 33%;&quot; valign=&quot;top&quot;&amp;gt;&#xA;                                        &amp;lt;p style=&quot;font-size:14px;margin-bottom:-2px;&quot;&amp;gt;&amp;lt;b&amp;gt;Operating In&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&#xA;                                        {{ program.operatingIn }}&#xA;                                    &amp;lt;/td&amp;gt;&#xA;                                    &amp;lt;td style=&quot;width: 33%;&quot; valign=&quot;top&quot;&amp;gt;&#xA;                                        &amp;lt;p style=&quot;font-size:14px;margin-bottom:-2px;&quot;&amp;gt;&amp;lt;b&amp;gt;Programs Offered&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&#xA;                                        {{ program.programsOffered }}&#xA;                                    &amp;lt;/td&amp;gt;&#xA;                                    &amp;lt;td style=&quot;width: 33%;word-break:break-all; word-wrap:break-word;&quot; valign=&quot;top&quot;&amp;gt;&#xA;                                        &amp;lt;p style=&quot;font-size:14px;margin-bottom:-2px;&quot;&amp;gt;&amp;lt;b&amp;gt;Contacts&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&#xA;                                        {{ program.programContacts }}&#xA;                                    &amp;lt;/td&amp;gt;&#xA;                                &amp;lt;/tr&amp;gt;&#xA;                            &amp;lt;/table&amp;gt;&#xA;                        &amp;lt;/td&amp;gt;&#xA;                    &amp;lt;/tr&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/table&amp;gt;&#xA;        &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;{% endset %}&#xA;{% set settings = { &#xA;    orientation : 'portrait' &#xA;} %}&#xA;&#xA;{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}&#xA;&#xA;{{ pdf.output }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8229" LastActivityDate="2018-07-31T17:54:55.947" Title="Printmaker PDF includes odd spaces and blank page" Tags="&lt;plugin-printmaker&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27072" PostTypeId="1" AcceptedAnswerId="27075" CreationDate="2018-07-27T18:39:38.483" Score="5" ViewCount="1386" Body="&lt;p&gt;Currently I am sorting a category template with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'featured desc, postDate desc'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works as expected. But I would like to sort it first on the featured field, then on the score. Such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'featured desc, score'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this throws an error. Can someone explain why that is and how I might achieve what I'm looking for? The first search is good for bringing featured posts to the top, but if there are none or maybe one, the rest of the results are not all that relevant. Ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7491" LastActivityDate="2018-07-27T19:59:05.980" Title="Order by score and another field" Tags="&lt;entries&gt;&lt;categories&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27073" PostTypeId="2" ParentId="27071" CreationDate="2018-07-27T19:13:33.817" Score="1" Body="&lt;p&gt;I have a hunch the issues you're seeing with the extra spacing and blank pages on your website are being caused by the indentation and new lines (after the &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag for example) in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I &lt;em&gt;think&lt;/em&gt; you could solve that is wrapping your html code in a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/spaceless.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig &lt;strong&gt;spaceless&lt;/strong&gt; tag&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set html %}&#xA;&#xA;  {% spaceless %}&#xA;&#xA;    &amp;lt;html&amp;gt;&#xA;      &amp;lt;head&amp;gt;&#xA;        ...&#xA;      &amp;lt;/head&amp;gt;&#xA;&#xA;      &amp;lt;body&amp;gt;&#xA;        ...&#xA;      &amp;lt;/body&amp;gt;&#xA;    &amp;lt;/html&amp;gt;&#xA;&#xA;  {% endspaceless %}&#xA;&#xA;{% endset %}&#xA;&#xA;&#xA;{% set settings = { &#xA;  orientation : 'portrait' &#xA;} %}&#xA;&#xA;{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}&#xA;&#xA;{{ pdf.output }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any extra whitespace &lt;em&gt;between&lt;/em&gt; the html tags inside that &lt;code&gt;{% spaceless %}&lt;/code&gt; tag is going to be removed in the final product and you don't have to sacrifice code indenting in your template to accomplish it &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps, let me know how it goes!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-07-27T19:13:33.817" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27074" PostTypeId="2" ParentId="27071" CreationDate="2018-07-27T19:33:58.277" Score="1" Body="&lt;p&gt;It's very difficult to give a &quot;canonical&quot; answer to this issue, without actually playing around with the code, because it could be a combination of things that produce the unwanted spaces and page breaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've experienced similar problems, and in my case I solved it by some careful use of different &lt;a href=&quot;https://css-tricks.com/almanac/properties/p/page-break/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSS page-break properties&lt;/a&gt;. Your mileage may vary, though.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-27T19:33:58.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27075" PostTypeId="2" ParentId="27072" CreationDate="2018-07-27T19:59:05.980" Score="8" Body="&lt;p&gt;I assume you're using &lt;code&gt;.search()&lt;/code&gt; – a common mistake is to try to combine &lt;a href=&quot;https://docs.craftcms.com/v3/searching.html#ordering-results-by-score&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;orderBy('score')&lt;/code&gt;&lt;/a&gt; with custom fields, which doesn't work because the &lt;code&gt;score&lt;/code&gt; attribute isn't an actual field, but a computed value that Craft &quot;injects&quot; into the element model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand you correctly, you want to render any &quot;featured&quot; entries at the top of the search results. You could achieve this by doing two separate search queries, before merging the results, with the featured entries at the beginning of the entry results array. Assuming &lt;code&gt;featured&lt;/code&gt; is a Lightswitch field, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchQuery = craft.entries.search('foo').orderBy('score') %}&#xA;{% set featuredEntries = searchQuery.featured('1').all() %}&#xA;{% set notFeaturedEntries = searchQuery.featured('not 1').all() %}&#xA;&#xA;{% set allEntries = featuredEntries|merge(notFeaturedEntries) %}&#xA;&#xA;{% for entry in allEntries %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to use pagination, the above won't fly – in which case you could opt to just collect the entry IDs and do a third query to pull the full entry models for a paginated result set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set featuredEntryIds = searchQuery.featured('1').ids() %}&#xA;{% set notFeaturedEntryIds = searchQuery.featured('not 1').ids() %}&#xA;{% set allEntryIds = featuredEntryIds|merge(notFeaturedEntryIds) %}&#xA;&#xA;{% paginate searchQuery.featured(null).limit(10).id(allEntryIds).fixedOrder(true) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An alternative approach to the above is to just have a single query, and use the &lt;code&gt;group&lt;/code&gt; filter to sort out the featured entries from the non-featured ones:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.search('foo').orderBy('score').all()|group('featured') %}&#xA;{% set featuredEntries = entries['1'] ?? [] %}&#xA;{% set notFeaturedEntries = entries[''] ?? [] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you're using Craft 2, be sure to replace the &lt;code&gt;orderBy&lt;/code&gt; parameter with &lt;code&gt;order&lt;/code&gt;. Using &lt;code&gt;order&lt;/code&gt; in Craft 3 will still work, but the parameter is deprecated and will &lt;em&gt;not&lt;/em&gt; work in Craft 4.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-07-27T19:59:05.980" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27076" PostTypeId="2" ParentId="22769" CreationDate="2018-07-27T20:10:47.413" Score="1" Body="&lt;p&gt;You can also add it to the &lt;code&gt;cart.lineItems[].options&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; &amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasables[{{ purchasable.id }}][id]&quot; value=&quot;{{ purchasable.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;number&quot; name=&quot;purchasables[{{ purchasable.id }}][qty]&quot;&amp;gt;&#xA;&#xA;    // custom option&#xA;    &amp;lt;input name=&quot;purchasables[{{ purchasable.id }}][options][giftWrapping]&quot; value=&quot;YES!&quot;&amp;gt;&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8510" LastActivityDate="2018-07-27T20:10:47.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27077" PostTypeId="1" AcceptedAnswerId="27095" CreationDate="2018-07-27T20:31:24.093" Score="3" ViewCount="51" Body="&lt;p&gt;I can't figure out why, but when I'm connected to a memcache server the thumbnail generation process in Assets hangs for long periods of time, the &lt;code&gt;getElements&lt;/code&gt; process throws 403 errors, the generating thumbnails throw 401 errors and then the user is signed out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens in 2 different AWS environments and on my local environment configured using MAMP. In total, three different memcache servers (production, stage, local) have this same thing occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can find in the logs that seems like it could be related is an error message that reads:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tried to restore session from a cookie, but the given login name does not match the given uid.&#xA;UID: LONG_UID_HASH_HERE and loginName: MY_EMAIL_ADDRESS.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm currently running Craft CMS 2.6.3019 (most current version of 2.x at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I also wanted to mention these assets all reside in an Amazon S3 bucket. Thought that might be relevant here, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt; I forced &lt;code&gt;hasThumb()&lt;/code&gt; to always return &lt;code&gt;false&lt;/code&gt; by &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop-v2/src/models/AssetFileModel.php#L309-L321&quot; rel=&quot;nofollow noreferrer&quot;&gt;commenting out these lines&lt;/a&gt;. The thumbnails don't generate 401 errors (because no thumbnails are being generated and the placeholder images are being used instead). And &lt;code&gt;getElements&lt;/code&gt; runs much quicker, but it stills throws 403 errors after clicking around for some time.&lt;/p&gt;&#xA;" OwnerUserId="712" LastEditorUserId="712" LastEditDate="2018-07-27T21:29:40.477" LastActivityDate="2018-07-30T20:27:16.917" Title="Generating thumbnails when using a memcache server for session storage frequently signs users out" Tags="&lt;users&gt;&lt;control-panel&gt;&lt;session&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27079" PostTypeId="2" ParentId="15897" CreationDate="2018-07-28T05:08:26.567" Score="6" Body="&lt;p&gt;In Craft3 you can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Craft;&#xA;use craft\base\Plugin;&#xA;use craft\commerce\models\Address;&#xA;use yii\base\Event;&#xA;&#xA;class Custom extends Plugin&#xA;{&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;&#xA;        Event::on(Address::class, Address::EVENT_BEFORE_VALIDATE, function (Event $event) {&#xA;            $address = $event-&amp;gt;sender;&#xA;            if (empty($address-&amp;gt;address1)) {&#xA;                $address-&amp;gt;addError('address1', Craft::t('app', 'Address Line 1 is required'));&#xA;                $event-&amp;gt;handled = true; // stop other handlers for this event&#xA;            }&#xA;        });&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8510" LastActivityDate="2018-07-28T05:08:26.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27080" PostTypeId="2" ParentId="26522" CreationDate="2018-07-28T14:58:38.340" Score="1" Body="&lt;p&gt;Seems to be working after upgrading to 3.0.0-beta.21. Thanks @Ben!&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-07-28T14:58:38.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27081" PostTypeId="1" AcceptedAnswerId="27086" CreationDate="2018-07-29T09:15:06.457" Score="3" ViewCount="197" Body="&lt;p&gt;I'm using Smart Map in a front end entry form and trying to set the position of a marker as the user enters their address.&lt;/p&gt;&#xA;&lt;p&gt;I can get the lat/lon lookup working but I'm stumped with the marker itself.&lt;/p&gt;&#xA;&lt;p&gt;Here's my JavaScript that's doing the lookup and filling in the lat/lon&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$.post('/actions/smartMap/lookup', data, function(response) {&#xA;    if(response.status = 'OK'){&#xA;        // get lat/lng and populate hidden fields&#xA;        $('.js-address-lat').val(response.results[0].geometry.location.lat);&#xA;        $('.js-address-lng').val(response.results[0].geometry.location.lng);&#xA;&#xA;        // update map (add marker)&#xA;        smartMap.map['smartmap-mapcanvas-1'].setOptions({styles: styles});&#xA;&#xA;        var lat = parseFloat(response.results[0].geometry.location.lat);&#xA;        var lng = parseFloat(response.results[0].geometry.location.lng);&#xA;        var newLatLng = new google.maps.LatLng(lat, lng);&#xA;                &#xA;        smartMap.marker['smartmap-mapcanvas-1.{{ property.id }}.location'].setPosition(newLatLng)&#xA;&#xA;        smartMap.refreshMap(smartmap-mapcanvas-1);&#xA;                &#xA;    } else {&#xA;        alert('No address could be found');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The docs say to reference the marker as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;smartMap.marker['&amp;lt;MAP ID&amp;gt;.&amp;lt;ELEMENT ID&amp;gt;.&amp;lt;FIELD HANDLE&amp;gt;']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With the &lt;code&gt;&amp;lt;ELEMENT ID&amp;gt;&lt;/code&gt; being the ID of the marker's parent element. But what would be? Is that the ID of the entry? I'm trying that but it just seems to lock the browser up and the fields don't save.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="45" LastEditDate="2021-01-01T07:08:14.477" LastActivityDate="2021-01-01T07:08:14.477" Title="Setting the position of a Smart Map marker on the front end" Tags="&lt;javascript&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27082" PostTypeId="1" CreationDate="2018-07-29T14:56:54.943" Score="3" ViewCount="31" Body="&lt;p&gt;Form code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;membersTitle&quot; &amp;gt;&#xA;    &amp;lt;label&amp;gt;Date&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;fields[parent][]&quot;&amp;gt;&#xA;    {% set entries = craft.entries.section('order').level(1) %}&#xA;        {% for entry in entries %}&#xA;            &amp;lt;option value=&quot;{{ entry.id }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to choose Parent from list, and I want to add the element to parent.&lt;/p&gt;&#xA;" OwnerUserId="8643" LastEditorUserId="57" LastEditDate="2018-07-30T21:28:39.600" LastActivityDate="2018-07-30T21:28:39.600" Title="I try to add element to structure, and I want to add to this element parent ID" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27083" PostTypeId="2" ParentId="27082" CreationDate="2018-07-29T15:18:26.883" Score="2" Body="&lt;p&gt;The &lt;code&gt;fields&lt;/code&gt; array may only contain names that represents handles in your &lt;code&gt;fieldLayout&lt;/code&gt; but the &lt;code&gt;parent&lt;/code&gt; attribute is a property of your object rather than a field - you can set it via &lt;code&gt;parentId&lt;/code&gt;. You may want to inspect your CP form in order to see how you need to define attributes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;membersTitle&quot; &amp;gt;&#xA;    &amp;lt;label&amp;gt;Date&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select name=&quot;parentId&quot;&amp;gt;&#xA;        {% for entry in craft.entries.section('order').level(1).find() %}&#xA;            &amp;lt;option value=&quot;{{ entry.id }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-29T15:18:26.883" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27084" PostTypeId="1" AcceptedAnswerId="27196" CreationDate="2018-07-30T03:22:41.037" Score="1" ViewCount="127" Body="&lt;p&gt;I've got an existing service based site that uses Sprout Forms to request quotes. The quote form lives on all services pages in a sidebar (and the submissions have an entries field keeping track of which service the submission came from).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just added some fields into the services entry to allow them to override where the quote form goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YIlXe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YIlXe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I need to make this work. I have a plugin listening for &lt;strong&gt;sproutForms.onBeforeSaveEntry&lt;/strong&gt; events, and when it receives them I'm wanting it to adjust where it sends the notification to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? Is it possible to modify &lt;strong&gt;notificationRecipients&lt;/strong&gt; on an individual event or is this against the form (and in either case how do I do this if I have a &lt;strong&gt;SproutForms_OnBeforeSaveEntryEvent&lt;/strong&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case (as I can live with the former) a code example would be amazing.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-08-07T01:59:19.770" Title="Sprout Forms - Custom Form Notification Recipients With sproutForms.onBeforeSaveEntry" Tags="&lt;plugin-development&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27085" PostTypeId="1" CreationDate="2018-07-30T09:34:52.620" Score="1" ViewCount="268" Body="&lt;p&gt;I downloading craft with Composer, but when i move on example.com/index.php?p=admin nothing happens. In the logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Warning:  require_once(): open_basedir restriction in effect. File(/home/User/web/example.com/vendor/autoload.php) is not within the allowed path(s): (/home/User/web/example.com/public_html:/home/User/tmp) in /home/User/web/example.com/public_html/index.php on line 11&#xA;PHP Warning:  require_once(/home/User/web/example.com/vendor/autoload.php): failed to open stream: Operation not permitted in /home/User/web/example.com/public_html/index.php on line 11&#xA;PHP Fatal error:  require_once(): Failed opening required '/home/User/web/example.com/vendor/autoload.php' (include_path='.:/opt/remi/php70/root/usr/share/pear:/opt/remi/php70/root/usr/share/php:/usr/share/pear:/usr/share/php') in /home/User/web/example.com/public_html/index.php on line 11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastEditorUserId="57" LastEditDate="2018-07-30T21:25:40.037" LastActivityDate="2018-07-30T23:34:26.550" Title="Install Craft on VPS with centos 7 and vestacp" Tags="&lt;installation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27086" PostTypeId="2" ParentId="27081" CreationDate="2018-07-30T09:48:41.730" Score="4" Body="&lt;p&gt;Turns out my code was pretty much working but there was another issue in there that was stopping the map marker updating. I've since resolved it.&#xA;The original form is huge so here's a cut down snippet of the part that does the marker update in case anyone needs it. This cut-down version isn't tested but should be good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, the &quot;parent element ID&quot; to which I referred &lt;em&gt;is&lt;/em&gt; the id of the entry in which your map resides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic location update form (my entry is 'property')&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;property-edit__form&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}    &#xA;    {% if property is defined %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ property.id }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ property.sectionId }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;{{ property.enabled }}&quot;&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/saveEntry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;3&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;me/property/saved&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;div class=&quot;property-edit__map-fields&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;&#xA;            Street Address&#xA;            &amp;lt;input class=&quot;js-address-part&quot; type=&quot;text&quot; name=&quot;fields[location][street1]&quot; value=&quot;{{property.location.street1 ?? ''}}&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;        &amp;lt;label&amp;gt;&#xA;            City&#xA;            &amp;lt;input class=&quot;js-address-part&quot; type=&quot;text&quot; name=&quot;fields[location][city]&quot; value=&quot;{{property.location.city ?? ''}}&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;        &amp;lt;label&amp;gt;&#xA;            County&#xA;            &amp;lt;input class=&quot;js-address-part&quot; type=&quot;text&quot; name=&quot;fields[location][state]&quot; value=&quot;{{property.location.state ?? ''}}&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;        &amp;lt;label&amp;gt;&#xA;            Post Code&#xA;            &amp;lt;input class=&quot;js-address-part&quot; type=&quot;text&quot; name=&quot;fields[location][zip]&quot; value=&quot;{{property.location.zip ?? ''}}&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;        &amp;lt;label&amp;gt;&#xA;            Country&#xA;            &amp;lt;input class=&quot;js-address-part&quot; type=&quot;text&quot; name=&quot;fields[location][country]&quot; value=&quot;{{property.location.country ?? ''}}&quot;&amp;gt;&#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;&#xA;        &amp;lt;input class=&quot;js-address-lat&quot; type=&quot;hidden&quot; name=&quot;fields[location][lat]&quot; value=&quot;{{property.location.lat ?? ''}}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;input class=&quot;js-address-lng&quot; type=&quot;hidden&quot; name=&quot;fields[location][lng]&quot; value=&quot;{{property.location.lng ?? ''}}&quot;&amp;gt;&#xA;&#xA;&#xA;        &amp;lt;div&amp;gt;&amp;lt;button class=&quot;js-address-lookup&quot;&amp;gt;Lookup address&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;div class=&quot;property-edit__map&quot;&amp;gt;&#xA;        {% if property is defined and property.location.hasCoords %}&#xA;&#xA;            {% set options = {&#xA;                height: 300,&#xA;                width: '100%',&#xA;                zoom: 11,&#xA;                markerOptions: {&#xA;                    icon: '/images/map-marker.png'&#xA;                    },&#xA;                } &#xA;            %}&#xA;        {% else %}&#xA;            {% set options = {&#xA;                height: 300,&#xA;                width: '100%',&#xA;                zoom: 4,&#xA;                center: { 'lat': 51.499998 , 'lng': -0.1166662},&#xA;                markerOptions: {&#xA;                    icon: '/images/map-marker.png'&#xA;                    },&#xA;                } &#xA;            %}&#xA;        {% endif %}&#xA;&#xA;        {% if property is defined %}    &#xA;            {{ craft.smartMap.map(property.location, options) }}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot;&amp;gt;  &#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And some Javascript to do the business (using jQuery here).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;&#xA;    $('body').on('click', '.js-address-lookup',  function (event) {&#xA;        event.preventDefault;&#xA;&#xA;        var target = '';&#xA;        $('.js-address-part').each(function(){&#xA;            target += $(this).val() + ',';&#xA;        });&#xA;        var data   = {target: target};&#xA;&#xA;        var csrfTokenName  = &quot;{{ craft.config.get('csrfTokenName') }}&quot;;&#xA;        var csrfTokenValue = &quot;{{ craft.request.getCsrfToken }}&quot;;&#xA;&#xA;        data[csrfTokenName] = csrfTokenValue; // Append CSRF Token to outgoing data&#xA;&#xA;        $.post('/actions/smartMap/lookup', data, function(response) {&#xA;            if(response.status = 'OK'){&#xA;                // get lat/lng and populate hidden fields&#xA;                $('.js-address-lat').val(response.results[0].geometry.location.lat);&#xA;                $('.js-address-lng').val(response.results[0].geometry.location.lng);&#xA;&#xA;                // update map (add marker)&#xA;                var lat = parseFloat(response.results[0].geometry.location.lat);&#xA;                var lng = parseFloat(response.results[0].geometry.location.lng);&#xA;                var newLatLng = new google.maps.LatLng(lat, lng);&#xA;&#xA;                {% if property is defined %}&#xA;                    smartMap.marker['smartmap-mapcanvas-1.{{ property.id }}.location'].setPosition(newLatLng)&#xA;                {% endif %}&#xA;&#xA;                //smartMap.map['smartmap-mapcanvas-1'].setOptions({styles: styles});&#xA;&#xA;                smartMap.map['smartmap-mapcanvas-1'].panTo(newLatLng);&#xA;                smartMap.refreshMap(smartmap-mapcanvas-1);&#xA;&#xA;            } else {&#xA;                alert('No address could be found');&#xA;            }&#xA;        });&#xA;    });&#xA;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-30T09:48:41.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27087" PostTypeId="2" ParentId="27084" CreationDate="2018-07-30T12:35:09.993" Score="1" Body="&lt;p&gt;&lt;em&gt;Based on the event you are referencing, I believe this is a question about Sprout Forms for Craft 2. In Sprout Forms for Craft 3, notifications are handled a differently.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Sprout Forms for Craft 2, the event you'll want to use for this is the &lt;code&gt;SproutForms_OnBeforePopulateEntryEvent&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not able to modify which value gets set directly, so you'll have to swap in the value you want using Craft Object syntax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your &lt;code&gt;notificationRecipients&lt;/code&gt; field, add a value using Craft Object Syntax: &lt;code&gt;{myRecipientsEmail}&lt;/code&gt;. Once you have called &lt;code&gt;sproutForms.onBeforePopulateEntryEvent&lt;/code&gt; you can modify the $_POST data that gets processed when assigning the recipient value and it sure it has the value you want: &lt;code&gt;$_POST['myRecipientsEmail'] = 'so-and-so@website.com'&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-07-30T12:35:09.993" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27088" PostTypeId="1" AcceptedAnswerId="27091" CreationDate="2018-07-30T14:13:22.340" Score="3" ViewCount="1181" Body="&lt;p&gt;I have a task that I want to run, but unfortunately I dont seem to be able to disable mod_gzip/mod_deflate on this server, so that task will not run in the background and causes the site to hang while processing the task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I have set the &quot;runQueueAutomatically&quot; config setting to false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to trigger the task queue to run manually (via a cron job), but I'm not sure how. In Craft CMS 2 I could visit &quot;/index.php?p=actions/tasks/runPendingTasks&quot; as per the docs here &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#runtasksautomatically&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#runtasksautomatically&lt;/a&gt; but I can't find the same action for v3. Have gone through the docs and can't see it anywhere - can someone help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6916" LastEditorUserId="6916" LastEditDate="2018-07-30T14:19:28.023" LastActivityDate="2018-07-30T17:01:38.950" Title="How to manually run pending tasks in Craft CMS 3" Tags="&lt;tasks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27090" PostTypeId="1" CreationDate="2018-07-30T16:03:42.183" Score="2" ViewCount="169" Body="&lt;p&gt;I have an account page for all my users, however i'm running into a small issue with being able to update passwords / emails on the frontend. Any advice on how to do this? I read that updating either of those fields would require checking and verifying the change in your email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8619" LastEditorUserId="5557" LastEditDate="2018-07-30T17:07:08.980" LastActivityDate="2018-08-29T22:00:36.977" Title="frontend account edits" Tags="&lt;craft3&gt;&lt;users&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27091" PostTypeId="2" ParentId="27088" CreationDate="2018-07-30T16:56:31.740" Score="2" Body="&lt;p&gt;Craft 3 default action to run the queue is &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionRun(): Response&#xA;{&#xA;    // Prep the response&#xA;    $response = Craft::$app-&amp;gt;getResponse();&#xA;    $response-&amp;gt;content = '1';&#xA;&#xA;    // Make sure Craft is configured to run queues over the web&#xA;    if (!Craft::$app-&amp;gt;getConfig()-&amp;gt;getGeneral()-&amp;gt;runQueueAutomatically) {&#xA;        return $response;&#xA;    }&#xA;&#xA;    // Make sure the queue isn't already running, and there are waiting jobs&#xA;    $queue = Craft::$app-&amp;gt;getQueue();&#xA;    if ($queue-&amp;gt;getHasReservedJobs() || !$queue-&amp;gt;getHasWaitingJobs()) {&#xA;        return $response;&#xA;    }&#xA;&#xA;    // Attempt to close the connection if this is an Ajax request&#xA;    if (Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsAjax()) {&#xA;        $response-&amp;gt;sendAndClose();&#xA;    }&#xA;&#xA;    // Run the queue&#xA;    $queue-&amp;gt;run();&#xA;&#xA;    return $response;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all you need is &lt;code&gt;Craft::$app-&amp;gt;getQueue()-&amp;gt;run()&lt;/code&gt;. Every Craft 3 project comes with a default module so you can &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt; or if &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;You Wanna Make a Craft 3 Plugin?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-07-30T17:01:38.950" LastActivityDate="2018-07-30T17:01:38.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27092" PostTypeId="1" AcceptedAnswerId="27097" CreationDate="2018-07-30T17:05:55.287" Score="2" ViewCount="193" Body="&lt;p&gt;When a user attempts to reset their password, they're emailed a link -- if they click on this link late, or click on it twice, they're shown the &quot;Oops! Invalid verification code. Please login or reset your password.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any chance this can be sent to a custom template, ala the loginPath or setPasswordPath configs?&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-07-30T21:40:12.887" Title="Invalid Verification Code Customization?" Tags="&lt;login&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27093" PostTypeId="1" CreationDate="2018-07-30T19:10:52.877" Score="2" ViewCount="410" Body="&lt;p&gt;I was recently able to get Craft CMS installed on my local server and I am using MAMP to host locally as I develop the site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have never set up a site on my own, so I was hoping someone could give me some instructions on how I eventually post my site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have a domain registered through DreamHost and I am prepared to set up a managed server or VPS, but how will this work in the end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I would have things set up so that I could push everything to github and the site would update automatically. I've used GitHub pages before, so this is the process I'm most familiar with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8646" LastActivityDate="2018-07-30T20:07:44.797" Title="How to Deploy CraftCMS to Dreamhost w/Github" Tags="&lt;deployment&gt;&lt;workflow&gt;&lt;hosting&gt;&lt;git&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27094" PostTypeId="2" ParentId="27093" CreationDate="2018-07-30T20:07:44.797" Score="1" Body="&lt;p&gt;I'd recommend against DreamHost, FWIW -&gt; &lt;a href=&quot;https://nystudio107.com/blog/web-hosting-for-agencies-freelancers&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Agencies &amp;amp; Freelancers Should Do Web Hosting&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, to do what you want to do, you'll need &lt;em&gt;something&lt;/em&gt; that triggers on that when a push to GitHub or what have you happens. If you use Forge as a provisioner, that comes baked in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, you can use a service like &lt;a href=&quot;http://buddy.works/&quot; rel=&quot;nofollow noreferrer&quot;&gt;buddy.works&lt;/a&gt; or the like to do it for you. This is discussed a bit in the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt; article under the &lt;strong&gt;DEPLOYING CRAFT CMS&lt;/strong&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also discuss it on the &lt;a href=&quot;https://devmode.fm/episodes/website-deployment-without-tears&quot; rel=&quot;nofollow noreferrer&quot;&gt;Website Deployment without Tears&lt;/a&gt; podcast on &lt;a href=&quot;https://devmode.fm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode.fm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...but the general idea is that &lt;em&gt;something&lt;/em&gt; has to receive a notification from GitHub when you push to a particular branch, to kick off the deployment process for you. Here's what my deployment script looks like on Forge: &lt;a href=&quot;https://twitter.com/nystudio107/status/991416047960981506&quot; rel=&quot;nofollow noreferrer&quot;&gt;My deploy script for Forge&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-30T20:07:44.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27095" PostTypeId="2" ParentId="27077" CreationDate="2018-07-30T20:27:16.917" Score="1" Body="&lt;p&gt;My solution to this was to swap memcache for Redis. I realize that doesn't resolve &lt;em&gt;why&lt;/em&gt; memcache wasn't working for us, but swapping it corrected this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My best guess is either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We were caching data to memcache that was too large for it to optimally handle. &lt;/li&gt;&#xA;&lt;li&gt;Memcache was being overwhelmed when asked to cache the thumbnails for images that Craft was generating.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These are completely unfounded, but just some best guesses on what was happening.&lt;/p&gt;&#xA;" OwnerUserId="712" LastActivityDate="2018-07-30T20:27:16.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27096" PostTypeId="2" ParentId="9277" CreationDate="2018-07-30T20:29:01.357" Score="1" Body="&lt;p&gt;For DateTime:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myDate ==&quot;0000-00-00 00:00:00&quot; ? &quot;&quot; : entry.myDate|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Date :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.myDate ==&quot;0000-00-00&quot; ? &quot;&quot; : entry.myDate|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8647" LastEditorUserId="57" LastEditDate="2018-07-30T21:48:50.143" LastActivityDate="2018-07-30T21:48:50.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27097" PostTypeId="2" ParentId="27092" CreationDate="2018-07-30T21:40:12.887" Score="1" Body="&lt;p&gt;There's not a native way I can see to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither of these are clean workarounds, but assuming you're referring to Craft 3, you could either write a plugin that extended Craft's &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/ErrorHandler.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;ErrorHandler&lt;/a&gt; class and overwrote the &lt;code&gt;handleException&lt;/code&gt; class, inspected for that particular error messae and swapped it with one of your own. You'd need to tell Craft to use your ErrorHandler in &lt;code&gt;craft/config/app.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you write a plugin that mimics Craft's &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController&lt;/a&gt;'s &lt;code&gt;setPassword&lt;/code&gt; method doing your own custom logic and have the user related emails point to your plugin's controller instead of the native Craft one.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-30T21:40:12.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27098" PostTypeId="2" ParentId="27090" CreationDate="2018-07-30T21:46:58.170" Score="2" Body="&lt;p&gt;A user changing sensitive fields like passwords and email addresses requires a &quot;elevated session&quot; to do so, which requires them to enter their &lt;em&gt;current&lt;/em&gt; password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the template code to do that here for both Craft 2 and 3: &lt;a href=&quot;https://craftcms.stackexchange.com/a/4715/57&quot;&gt;https://craftcms.stackexchange.com/a/4715/57&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can configure the duration of the elevated session with the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#elevatedsessionduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;elevatedSessionDuration&lt;/a&gt; config setting.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-07-30T21:46:58.170" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27099" PostTypeId="2" ParentId="27085" CreationDate="2018-07-30T23:34:26.550" Score="2" Body="&lt;p&gt;I solved this problem. In /home/User/conf/web/example.com.httpd.conf in string &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php_admin_value open_basedir/home/User/web/example.com/public_html:/home/Userl/tmp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;replace on &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php_admin_value open_basedir /home/User/web/example.com:/home/Userl/tmp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastActivityDate="2018-07-30T23:34:26.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27102" PostTypeId="1" CreationDate="2018-07-31T01:29:56.603" Score="2" ViewCount="136" Body="&lt;p&gt;In my cart (Craft3/Commerce2), I need to show a line item's possible options from a checkbox field called &quot;productOptions&quot;, and allow the user to select the desired options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the &lt;a href=&quot;https://github.com/craftcms/commerce-docs/blob/3728ec51450bcab22509f1a6c04ff66c58c9d4e9/en/adding-to-and-updating-the-cart.md#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Docs&lt;/a&gt;, I can manually test if an item.options exists, but this means hard-coding the list of possible options(35+) into the cart, and keeping that updated as available options change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/update-line-item&quot;&amp;gt;&#xA;    {{ redirectInput('cart') }}&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;lineItemId&quot; value=&quot;{{ item.id }}&quot;&amp;gt;&#xA;    &amp;lt;span {% if item.getFirstError('qty') %}class=&quot;has-error&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot; min=&quot;1&quot; value=&quot;{{ item.qty }}&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;&#xA;&#xA;{#  Manual List of Options to Test if Exists #}&#xA;    {% if item.options.optionOne is defined %}&#xA;        &amp;lt;label class=&quot;checkbox&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;options[optionOne]&quot; checked&amp;gt; Option One &#xA;        &amp;lt;/label&amp;gt;&#xA;    {% endif %}&#xA;    {% if item.options.optionTwo is defined %}&#xA;        &amp;lt;label class=&quot;checkbox&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot; name=&quot;options[optionTwo]&quot; checked&amp;gt; Option Two &#xA;        &amp;lt;/label&amp;gt;&#xA;    {% endif %}&#xA;            ...                     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR, I can output the list of product options available for a given product, and use that to update the cart:            &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#  To access the product options, set a variable &quot;product&quot; #}&#xA;    {% set product = item.purchasable.product %}&#xA;    {% for key, value in product.productOptions %}&#xA;&#xA;        &amp;lt;label class=&quot;checkbox&quot;&amp;gt;&#xA;{#          &amp;lt;input type=&quot;hidden&quot; name=&quot;options[{{ value }}]&quot; value=&quot;&quot;&amp;gt; #}&amp;lt;!-- uncheck it if not checked --&amp;gt;&#xA;            &amp;lt;input type=&quot;checkbox&quot;  name=&quot;options[{{ value }}]&quot; value=&quot;on&quot; &#xA;            {% if item.options.value is defined %}checked{% endif %}&amp;gt; {{ value }} &#xA;        &amp;lt;/label&amp;gt;&#xA;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;Update&quot;/&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't seem to figure out how to test if the checkbox is selected/value ==&quot;on&quot; from the cart array. I know that &#xA;&lt;code&gt;{% if item.options.value is defined %}checked{% endif %}&lt;/code&gt;&#xA;is not the correct way to access this value if it even can be accessed in this for loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help? Many thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8033" LastEditorUserId="8033" LastEditDate="2018-08-02T19:13:54.247" LastActivityDate="2018-08-03T16:10:11.973" Title="How can I show a list of product options as checkboxes in the cart?" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;&lt;craft-pro&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27103" PostTypeId="1" CreationDate="2018-07-31T02:09:41.537" Score="2" ViewCount="72" Body="&lt;p&gt;I'm trying to show the next post that's not in the array of articles &quot;completed&quot;. I have the next articles showing that haven't been completed, however i can't set a limit to just show one article. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here's my code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section(['getStarted', 'rollOut', 'assessAndPrioritize', 'agreeCommit','measureSuccess']).order('stepNumber asc')  %}&#xA;&#xA;    {% set test = currentUser and entry.id not in currentUser.completed.ids()  %}&#xA;&#xA;    {% if test == true %}&#xA;        {{entry.title}}&amp;lt;br&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8619" LastEditorUserId="57" LastEditDate="2018-07-31T21:15:55.937" LastActivityDate="2018-07-31T21:15:55.937" Title="Limit not working" Tags="&lt;entries&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27104" PostTypeId="1" AcceptedAnswerId="27105" CreationDate="2018-07-31T02:58:50.833" Score="3" ViewCount="39" Body="&lt;p&gt;I need display Stores by Region, by example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alabama&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Store X&lt;/li&gt;&#xA;&lt;li&gt;Store Y&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Idaho&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Store A&lt;/li&gt;&#xA;&lt;li&gt;Store B&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I create two channels &lt;strong&gt;Stores&lt;/strong&gt; and &lt;strong&gt;Regions&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In the channel &lt;strong&gt;Stores&lt;/strong&gt; I create a &lt;strong&gt;entries field type&lt;/strong&gt; called &lt;strong&gt;storesRegion&lt;/strong&gt; and check &lt;strong&gt;Regions&lt;/strong&gt; source.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M9rG0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9rG0.png&quot; alt=&quot;craft control panel&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So great! I can create new stores and select where the store is located.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T86xy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T86xy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can display the Regions like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedRegions = craft.entries.section('regions').relatedTo({&#xA;    sourceElement: stores,&#xA;    field: 'storesRegion'&#xA;}) %}&#xA;&#xA;{% for region in relatedRegions %}&#xA;    {{ region }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;good but now I need display all the &lt;strong&gt;Stores&lt;/strong&gt; from each &lt;strong&gt;Region&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is a good example of what I need: &lt;a href=&quot;https://www.apple.com/retail/storelist/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.apple.com/retail/storelist/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is something related with reverse relations?&lt;/p&gt;&#xA;" OwnerDisplayName="user8572" LastEditorDisplayName="user8572" LastEditDate="2018-07-31T05:28:13.193" LastActivityDate="2018-08-02T00:56:24.417" Title="Display Stores by Region with relations" Tags="&lt;relations&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27105" PostTypeId="2" ParentId="27104" CreationDate="2018-07-31T06:37:00.707" Score="2" Body="&lt;p&gt;You could loop all regions and select their corresponding stores&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# you can as well include eager loading here #}&#xA;{% for region in craft.entries.section('regions').storesRegion(':notempty:').all() %}&#xA;    {% set storesForRegion = craft.entries.section('stores').relatedTo({&#xA;        targetElement: region,&#xA;        field: 'storesRegion'&#xA;    }).all() %}&#xA;    {{ region.title }}&#xA;    {% for store in storesForRegion %}&#xA;        {{ store.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to increase your performance you can use &lt;a href=&quot;https://docs.craftcms.com/v2/templating/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; at this point and include &lt;code&gt;with(['storesRegion'])&lt;/code&gt; to your region &lt;code&gt;Query&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-31T06:37:00.707" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27106" PostTypeId="2" ParentId="27103" CreationDate="2018-07-31T06:40:59.490" Score="2" Body="&lt;p&gt;You need to exclude the ids from the beginning.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set excludeIds = currentUser.completed.ids() %}&#xA;{% set entry = craft&#xA;    .entries&#xA;    .section([&#xA;        'getStarted',&#xA;        'rollOut',&#xA;        'assessAndPrioritize',&#xA;        'agreeCommit',&#xA;        'measureSuccess'&#xA;    ])&#xA;    .order({stepNumber: SORT_ASC})&#xA;    .where(['not in', 'elements.id', excludeIds])&#xA;    .one()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.where(['not in', 'elements.id', excludeIds])&lt;/code&gt; will remove all ids in your field from your query.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-07-31T06:40:59.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27107" PostTypeId="1" CreationDate="2018-07-31T08:13:16.900" Score="1" ViewCount="495" Body="&lt;p&gt;I have php70 with nginx on vestacp. My admin panel work when url &lt;code&gt;example.com/index.php?p=admin/dashboard&lt;/code&gt;, but not work &lt;code&gt;example.com/admin/dashboard&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My nginx conf:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;     listen      ip:80;&#xA;     server_name example.com www.example.com;&#xA;     root        /home/User/web/example.com/public_html;&#xA;     index       index.php index.html index.htm;&#xA;     access_log  /var/log/nginx/domains/example.com.log combined;&#xA;     access_log  /var/log/nginx/domains/example.com.bytes bytes;&#xA;     error_log   /var/log/nginx/domains/example.com.error.log error;&#xA;&#xA;     location / {&#xA;        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {&#xA;            expires     max;&#xA;        }&#xA;&#xA;        location ~ [^/]\.php(/|$) {&#xA;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            if (!-f $document_root$fastcgi_script_name) {&#xA;                return  404;&#xA;            }&#xA;&#xA;            fastcgi_pass    127.0.0.1:9002;&#xA;            fastcgi_index   index.php;&#xA;            include         /etc/nginx/fastcgi_params;&#xA;     }&#xA;}&#xA;&#xA;location ~* &quot;/\.(htaccess|htpasswd)$&quot; {&#xA;    deny    all;&#xA;    return  404;&#xA;}&#xA;&#xA;location /vstats/ {&#xA;    alias   /home/User/web/example.com/stats/;&#xA;    include /home/User/conf/web/example.com.auth*;&#xA;}&#xA;&#xA;include     /etc/nginx/conf.d/phpmyadmin.inc*;&#xA;include     /etc/nginx/conf.d/phppgadmin.inc*;&#xA;include     /etc/nginx/conf.d/webmail.inc*;&#xA;&#xA;include     /home/User/conf/web/nginx.example.com.conf*;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2018-07-31T08:31:07.473" LastActivityDate="2018-07-31T16:50:43.220" Title="nginx conf for craft" Tags="&lt;nginx&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27108" PostTypeId="2" ParentId="27107" CreationDate="2018-07-31T08:28:47.013" Score="1" Body="&lt;p&gt;I added a few new lines to conf:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;    listen      ip:80;&#xA;    server_name example.com www.example.com;&#xA;    root        /home/User/web/example.com/public_html;&#xA;    index       index.php index.html index.htm;&#xA;    access_log  /var/log/nginx/domains/example.com.log combined;&#xA;    access_log  /var/log/nginx/domains/example.com.bytes bytes;&#xA;    error_log   /var/log/nginx/domains/example.com.error.log error;&#xA;&#xA;    location / {&#xA;        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {&#xA;            expires     max;&#xA;        }&#xA;&#xA;        location / {&#xA;            try_files $uri/index.html $uri $uri/ /index.php?$query_string;&#xA;        }&#xA;&#xA;        location ~ [^/]\.php(/|$) {&#xA;            try_files $uri $uri/ /index.php?$query_string;&#xA;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;            if (!-f $document_root$fastcgi_script_name) {&#xA;                return  404;&#xA;            }&#xA;&#xA;            fastcgi_pass    127.0.0.1:9002;&#xA;            fastcgi_index   index.php;&#xA;            include         /etc/nginx/fastcgi_params;&#xA;       }&#xA;}&#xA;&#xA;location ~* &quot;/\.(htaccess|htpasswd)$&quot; {&#xA;    deny    all;&#xA;    return  404;&#xA;}&#xA;&#xA;location /vstats/ {&#xA;    alias   /home/User/web/example.com/stats/;&#xA;    include /home/User/conf/web/example.com.auth*;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastActivityDate="2018-07-31T08:28:47.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27109" PostTypeId="1" AcceptedAnswerId="27110" CreationDate="2018-07-31T13:58:33.327" Score="2" ViewCount="51" Body="&lt;p&gt;I'm working on a new checkout process which involves taking the shipping address first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this I am setting sameAddress to 1 in my shippingAddress form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, at a later stage I want to offer the customer the option to change their billing address. I thought I could just present the customer with a new form for billingAddress fields and set sameAddress to 0, or false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't seem to let me override the already stored billing address. It seems that once sameAddress is set, it cannot be unset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried setting a hidden billing address when setting the shipping address but again it's not letting me override that later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there way I can achieve this checkout flow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shipping address info -&gt; shipping method selection -&gt; payment (with option to use a different address for billing)?&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-07-31T15:30:05.473" Title="Override &quot;sameAddress&quot; option when updating cart" Tags="&lt;plugin-craftcommerce&gt;&lt;addresses&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27110" PostTypeId="2" ParentId="27109" CreationDate="2018-07-31T15:09:17.077" Score="1" Body="&lt;p&gt;It &lt;em&gt;is&lt;/em&gt; possible to override sameAddress&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick to doing this is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checkout Step 1: Set your shipping address and use sameAddress1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/checkout/shipping&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddressId&quot; value=&quot;new&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sameAddress&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;      shipping address fields here        &#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Checkout Step 2: Set shipping method as normal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checkout Step 3: Set the billing address, including the shipping address as hidden fields, set sameAddress to 0.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; id=&quot;paymentMethod&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/checkout/payment&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- billing fields --&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;billingAddress[firstName]&quot; value=&quot;{{ cart.billingAddress ? cart.billingAddress.firstName }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;billingAddress[lastName]&quot; value=&quot;{{ cart.billingAddress ? cart.billingAddress.lastName }}&quot;&amp;gt;&#xA;&#xA;    etc.&#xA;    &amp;lt;!-- tell Craft this is a new billing address --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;billingAddressId&quot; value=&quot;new&quot;&amp;gt;&#xA;&#xA;    &amp;lt;!-- hidden shipping address fields --&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[firstName]&quot; value=&quot;{{ cart.shippingAddress.firstName }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[lastName]&quot; value=&quot;{{ cart.shippingAddress.lastName }}&quot;&amp;gt;&#xA;&#xA;    etc.&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-07-31T15:30:05.473" LastActivityDate="2018-07-31T15:30:05.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27111" PostTypeId="2" ParentId="13327" CreationDate="2018-07-31T16:29:53.810" Score="1" Body="&lt;p&gt;Craft now has a &quot;&lt;strong&gt;Clean up HTML?&lt;/strong&gt;&quot; checkbox on Rich Text fields (it's hidden under &quot;Advanced&quot; on the field edit page). I was having problems with Redactor removing whitespace (in my case it was extra spaces that I wanted to add), but I found that unchecking this box fixed them.&lt;/p&gt;&#xA;" OwnerUserId="328" LastActivityDate="2018-07-31T16:29:53.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27112" PostTypeId="2" ParentId="27107" CreationDate="2018-07-31T16:50:43.220" Score="0" Body="&lt;p&gt;Here's an Nginx config that might help you: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-07-31T16:50:43.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27113" PostTypeId="2" ParentId="27071" CreationDate="2018-07-31T17:54:55.947" Score="1" Body="&lt;p&gt;It turns out there was an extra br tag inside the loop. I had intended to use it to add a short space between each entry, but instead they collected at the end of the document and created the long unwanted spacing. Removing that tag fixed it right up!&lt;/p&gt;&#xA;" OwnerUserId="8229" LastActivityDate="2018-07-31T17:54:55.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27114" PostTypeId="2" ParentId="25550" CreationDate="2018-07-31T18:42:34.757" Score="3" Body="&lt;p&gt;@boboldehampsink to the rescue: &lt;a href=&quot;https://github.com/craftcms/cms/issues/3428&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3428&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article covers things really well.&#xA;&lt;a href=&quot;https://nystudio107.com/blog/the-case-of-the-missing-php-session&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/the-case-of-the-missing-php-session&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;php ini config&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Session]&#xA;; http://www.php.net/manual/en/session.configuration.php#ini.session.save-handler&#xA;session.save_handler = redis&#xA;session.save_path = &quot;tcp://127.0.0.1:6379&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;configurable in /../craft/web/index.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('REDIS_HOSTNAME', getenv('REDIS_HOSTNAME') ?: 'localhost');&#xA;ini_set('session.save_handler', 'redis');&#xA;ini_set('session.save_path', 'tcp://'.REDIS_HOSTNAME.':6379');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="314" LastEditorUserId="7336" LastEditDate="2018-11-27T15:18:07.127" LastActivityDate="2018-11-27T15:18:07.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27115" PostTypeId="1" CreationDate="2018-07-31T19:19:52.063" Score="2" ViewCount="410" Body="&lt;p&gt;I have a multi-select field in my work section&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8iCW6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8iCW6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get the values either with the Element api as json or an array of simple values in my template. &lt;/p&gt;&#xA;" OwnerUserId="8649" LastActivityDate="2018-08-01T07:19:59.973" Title="Getting all the values out of a field as array of values" Tags="&lt;templating&gt;&lt;field&gt;&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27116" PostTypeId="1" AcceptedAnswerId="27117" CreationDate="2018-08-01T00:46:15.517" Score="3" ViewCount="558" Body="&lt;p&gt;I'm porting across a multilingual project from Craft2 to Craft3 and have to rebuild the language switcher. I was previously using the &lt;code&gt;.nativeName&lt;/code&gt; method but apparently this is deprecated. I've got a really basic one working for flipping between the English and French versions of my site :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set langSwitcher = craft.app.sites.getAllSites() %}&#xA;&#xA;{% for lang in langSwitcher %}&#xA;   {# Get base URL #}&#xA;   {% set url = alias(lang.baseUrl) %}&#xA;   &amp;lt;a href=&quot;{{url}}&quot;&amp;gt;{{ lang.language }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{{ lang.language }}&lt;/code&gt; is outputting &lt;code&gt;en&lt;/code&gt; &amp;amp; &lt;code&gt;fr&lt;/code&gt; but how do I get it to display the full native language names i.e &lt;code&gt;English&lt;/code&gt; &amp;amp; &lt;code&gt;Francais&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the &lt;code&gt;getDisplayName()&lt;/code&gt; function in the docs but can't seem to get it working properly: &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-i18n-locale.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-i18n-locale.html#public-methods&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2257" LastActivityDate="2018-08-02T08:03:16.977" Title="Getting full native language name in Craft3 language switcher" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27117" PostTypeId="2" ParentId="27116" CreationDate="2018-08-01T07:00:28.173" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;http://awseb-e-f-awsebloa-1f9jh1rryyr2z-94257389.us-west-2.elb.amazonaws.com/api/v3/craft-models-site.html#property-language&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;site.language&lt;/code&gt;&lt;/a&gt; attribute is just a string, i.e. the language code or locale ID, e.g. &lt;code&gt;'en'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the native name you'll need to go through the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-i18n-i18n.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;I18N&lt;/code&gt; service&lt;/a&gt; to pull the actual &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-i18n-locale.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Locale&lt;/a&gt; object via that locale ID:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locale = craft.app.i18n.getLocaleById(lang.language) %}&#xA;&amp;lt;a href=&quot;{{url}}&quot;&amp;gt;{{ locale.nativeName }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; As @Dr_Codswallop mentions in the comments, &lt;code&gt;locale.nativeName&lt;/code&gt; is deprecated in Craft 3, and will be removed completely in Craft 4. &lt;code&gt;locale.displayName&lt;/code&gt; should be used instead.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-08-02T08:03:16.977" LastActivityDate="2018-08-02T08:03:16.977" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27118" PostTypeId="2" ParentId="27115" CreationDate="2018-08-01T07:19:59.973" Score="1" Body="&lt;p&gt;&lt;code&gt;$element-&amp;gt;getFieldValue('handle')&lt;/code&gt; or it's Twig equivalent &lt;code&gt;element.handle&lt;/code&gt; contains an Object of type &lt;code&gt;MultiOptionsFieldData&lt;/code&gt; you can get all possible values via it&lt;code&gt;s&lt;/code&gt;getOptions()` function&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(entry.fieldHandle.getOptions()) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$options = $element-&amp;gt;getFieldValue('handle')-&amp;gt;getOptions();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-01T07:19:59.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27119" PostTypeId="1" CreationDate="2018-08-01T08:00:30.020" Score="2" ViewCount="53" Body="&lt;p&gt;I have a couple of forms that require payload forwarding. The only problem I'm having is that all the content that should be sent through is empty. I can see the form being submitted to the payload lead and is received but it wont share any information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm wondering is this from my end or the leads?&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2019-06-28T22:21:36.743" Title="Sprout Forms Payload Forwarding empty value" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27121" PostTypeId="2" ParentId="27038" CreationDate="2018-08-01T09:03:41.660" Score="1" Body="&lt;p&gt;I finally managed to answer my own question. I changed my routing to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/projects/slug/slug/gallery to projects/gallery/_entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So was able to use a proper absolute link with /gallery added to the end&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.com/projects/category/project/gallery&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the gallery _entry I used the following code to get the entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set projectSlug = craft.request.getSegment(-2) %}&#xA;{% set categorySlug = craft.request.getSegment(-3) %} &#xA;{% set category = craft.categories.slug(categorySlug).first() %}&lt;br&gt;&#xA;{% set entry = craft.entries.section('projects').slug(projectSlug).relatedTo(category).first() %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then worked fine, even if the same named project was used in two different categories&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would still prefer to do this without routing if anyone has any suggestions please? &lt;/p&gt;&#xA;" OwnerUserId="8632" LastActivityDate="2018-08-01T09:03:41.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27122" PostTypeId="1" AcceptedAnswerId="27137" CreationDate="2018-08-01T10:18:05.933" Score="3" ViewCount="315" Body="&lt;p&gt;I have the task of moving a large amount of assets ~50gb from one amazon s3 bucket to another on another AWS account. I've figured out how to copy the files via S3 COPY, but I'm just wondering will it simply be a case of changing the API credentials in Craft to the new bucket? Will this retain all the assets links?&lt;/p&gt;&#xA;" OwnerUserId="526" LastActivityDate="2018-08-01T22:18:03.157" Title="Moving Craft assets from one S3 bucket to another" Tags="&lt;assets&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27123" PostTypeId="1" AcceptedAnswerId="27134" CreationDate="2018-08-01T11:08:23.157" Score="2" ViewCount="387" Body="&lt;p&gt;I have read a number of related threads but am still puzzled what this error actually means or how to fix it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This triggers the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;twitter&quot;&amp;gt;&#xA;&#xA;                {% set tweets = craft.twitter.get('statuses/user_timeline', {count:2}) %}&#xA;&#xA;               {% if tweets %}&#xA;                 &amp;lt;h3 class=&quot;title&quot;&amp;gt;Latest Tweets&amp;lt;/h3&amp;gt;&#xA;                 &amp;lt;div class=&quot;line-orange-l&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&#xA;                  &amp;lt;ul&amp;gt;&#xA;                    {% for tweet in tweets %}&#xA;                    {% set tweetDate = date(tweet.created_at).diff(now).format('%a') %}&#xA;                    {% if tweetDate == 0 %}&#xA;                    {% set tweetTimeAgo = 'today' %}&#xA;                    {% else %}&#xA;                    {% set tweetTimeAgo = tweetDate ~ ' days ago' %}&#xA;                    {% endif %}&#xA;                    &amp;lt;li&amp;gt;&#xA;                       &amp;lt;p&amp;gt;&#xA;                          &amp;lt;i class=&quot;fa fa-twitter&quot; aria-hidden=&quot;true&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;                          {{ tweet.text|autoLinkTweet }}&amp;lt;br&amp;gt;&#xA;                          &amp;lt;a href=&quot;http://twitter.com/{{ tweet.user.screen_name|raw }}&quot; class=&quot;author&quot;&amp;gt;@{{ tweet.user.screen_name|raw }}&amp;lt;/a&amp;gt; /&#xA;                          &amp;lt;span class=&quot;posted&quot;&amp;gt;Posted {{ tweetTimeAgo }}&amp;lt;/span&amp;gt;&#xA;                       &amp;lt;/p&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                  &amp;lt;/ul&amp;gt;&#xA;                  {% endif %}&#xA;                 &amp;lt;/ul&amp;gt;&#xA;              &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would fix this?&lt;/p&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2018-08-01T18:27:36.660" Title="Impossible to access an attribute (&quot;created_at&quot;) on a boolean variable (&quot;1&quot;)" Tags="&lt;createcommand&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27125" PostTypeId="1" CreationDate="2018-08-01T13:53:47.763" Score="0" ViewCount="361" Body="&lt;p&gt;I'm able to get data using API but when I use checkboxField then it only display the blank checkbox without value. In Model,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if($result){&#xA;        if (isset($result-&amp;gt;error)) die($result-&amp;gt;error_message);&#xA;        //convert json data to array&#xA;        $arr = json_decode($result, true);&#xA;&#xA;        //Get project array from API&#xA;        $json = $arr['projects'];&#xA;&#xA;        foreach ($json as $i =&amp;gt; $v){&#xA;&#xA;            return array_merge(parent::defineAttributes(), array(&#xA;                'someField'     =&amp;gt; array(AttributeType::String, 'default' =&amp;gt; $v['name']),&#xA;            ));&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my template, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.checkboxField({&#xA;id: id ~ 'someField',&#xA;class:'nicetext',&#xA;name: name ~ '[someField]',&#xA;value: values.someField,&#xA;checked: value,&#xA;errors: values.getErrors('someField'),&#xA;required: false,}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Need some help. TIA!&lt;/p&gt;&#xA;" OwnerUserId="8652" LastActivityDate="2018-08-02T15:15:54.297" Title="How to display data in field type with dropdown multi select checkbox?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27126" PostTypeId="2" ParentId="27125" CreationDate="2018-08-01T14:41:20.593" Score="1" Body="&lt;p&gt;A checkbox field is just a checkbox, usually checkboxes don't have several values beside true/false or checked/unchecked, Are you sure you don't want to use a &lt;code&gt;select&lt;/code&gt; or &lt;code&gt;multiselect&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.selectField({&#xA;    label: &quot;Some Label&quot;|t,&#xA;    id: id ~ 'someField',&#xA;    name: name ~ '[someField]',&#xA;    options: options, //&amp;lt;-- array [label =&amp;gt; X, value =&amp;gt; y]&#xA;    value: values.someField // &amp;lt;-- not sure what this should be.. usually you want to pass an id&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However - your PHP actually doesn't make much sense. Not sure what your goal is with that code&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-01T14:41:20.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27127" PostTypeId="1" AcceptedAnswerId="27128" CreationDate="2018-08-01T15:19:56.390" Score="2" ViewCount="244" Body="&lt;p&gt;I have a field call &quot;scripts&quot; to house scripts like a marketo form script. This gets added in an entry template, but I need to pass this to the layout (if there is something in the field) and render in the footer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I'm open to ideas or suggestions. &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-08-02T08:46:58.840" Title="pass data to _layout?" Tags="&lt;layout&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27128" PostTypeId="2" ParentId="27127" CreationDate="2018-08-01T16:32:54.127" Score="2" Body="&lt;p&gt;Are you on Craft 3 or 2? In 3, you can use the built-in &lt;code&gt;{% js %} ... {% endjs %}&lt;/code&gt; tag to inject scripts into tags named &lt;code&gt;{{ endBody() }}&lt;/code&gt; or &lt;code&gt;{{ beginBody() }}&lt;/code&gt; that you place wherever you like in your layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When outputting from the entry, also be sure to use the &lt;code&gt;|raw&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/js.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/tags/js.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2 had a similar function: &lt;a href=&quot;https://docs.craftcms.com/v2/templating/includejs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/includejs.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...Or you can just do it all manually with a Twig block - one thing that's a bit annoying about Craft's built-in tags is that they automatically include the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags, which in turn means you won't get JS syntax highlighting in your editor. To do it manually I'd do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;=========================================&#xA;_layout.twig:&#xA;=========================================&#xA;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    {{ block('extraHeadData') }}&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    {{ block('content') }}  &#xA;    {{ block('extraFootData') }}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&#xA;=========================================&#xA;template.twig:&#xA;=========================================&#xA;&#xA;{% extends '_layout' %}&#xA;&#xA;{% block 'content' %}&amp;lt;h1&amp;gt;Hi&amp;lt;/h1&amp;gt;{% endblock %}    &#xA;&#xA;{% block extraHeadData %}&#xA;    &amp;lt;script&amp;gt;console.log('extra stuff in the head if you really need it');&amp;lt;/script&amp;gt;&#xA;{% endblock %}&#xA;&#xA;{% block extraFootData %}&#xA;    &amp;lt;script&amp;gt;alert('hi');&amp;lt;/script&amp;gt;&#xA;    {{ entry.scripts ? entry.scripts|raw }}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit to add: I forgot to mention the one big advantage of using Craft's built-in methods over native Twig blocks is that they can work anywhere in the template regardless of the nesting level or scope of your blocks. For this reason it's usually preferable. (Even if you start with a simple inheritance model where each template &lt;code&gt;@extend&lt;/code&gt;s the layout, when the site grows and you start using shared intermediary templates to keep the code DRY, you can start running into very fiddly scope issues).&lt;/p&gt;&#xA;" OwnerUserId="271" LastEditorUserId="271" LastEditDate="2018-08-02T08:46:58.840" LastActivityDate="2018-08-02T08:46:58.840" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27129" PostTypeId="1" CreationDate="2018-08-01T17:17:10.007" Score="1" ViewCount="175" Body="&lt;p&gt;I tried searching for an answer for my situation but I could not find one. I tried following the steps here &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#preparing-for-the-upgrade&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html#preparing-for-the-upgrade&lt;/a&gt; but whenever I get to the browser step to complete upgrade, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;!/usr/bin/env php&#xA;  Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: craft\console\User::enableSession'&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;in /Users/avalosju/craft/vendor/yiisoft/yii2/base/Component.php:154&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Stack trace:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;0 /Users/avalosju/craft/vendor/craftcms/cms/src/helpers/App.php(372): yii\base\Component-&gt;__get('enableSession')&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1 /Users/avalosju/craft/vendor/craftcms/cms/src/config/app.php(214): craft\helpers\App::logConfig()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2 [internal function]: {closure}()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;4 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&gt;invoke(Object(Closure), Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;5 /Users/avalosju/craft/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;6 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&gt;get('log', true)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;7 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(146): yii\base\Module-&gt;get('log', true)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;8 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(508): craft\console\Application-&gt;get('log')&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;9 /Users/avalosju/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1133): yii\base\Application-&gt;getLog()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;10 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(62): craft\console\Application-&gt;_preInit()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;11 /Users/avalosju/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application-&gt;init()&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;12 /Users/avalosju/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject-&gt;__construct(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;13 /Users/avalosju/craft/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application-&gt;__construct(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;14 /Users/avalosju/craft/vendor/craftcms/cms/src/console/Application.php(53): yii\console\Application-&gt;__construct(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;15 [internal function]: craft\console\Application-&gt;__construct(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;16 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&gt;newInstanceArgs(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;17 /Users/avalosju/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&gt;build('craft\console\A...', Array, Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;18 /Users/avalosju/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&gt;get('craft\console\A...', Array, Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;19 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;20 /Users/avalosju/craft/vendor/craftcms/cms/bootstrap/console.php(31): require('/Users/avalosju...')&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;21 /Users/avalosju/craft/craft(21): require('/Users/avalosju...')&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;22 /Users/avalosju/craft/web/index.php(19): require_once('/Users/avalosju...')&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;23 {main}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8658" LastEditorUserId="5557" LastEditDate="2018-08-01T18:07:49.943" LastActivityDate="2018-08-31T19:01:38.063" Title="Upgrading Craft 2 to Craft 3 Yii Issues" Tags="&lt;upgrades&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27130" PostTypeId="1" CreationDate="2018-08-01T17:37:04.127" Score="2" ViewCount="95" Body="&lt;p&gt;I've got a few categories set up with a few child categories for each. Each one has assets (PDFs) assigned to them, by going into the assets, double clicking, and setting the category field there. So for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category 1&#xA;-- asset 1&#xA;- Sub Category 1&#xA;-- asset 2&#xA;-- asset 3&#xA;&#xA;Category 2&#xA;-- asset 4&#xA;- Sub Category 1&#xA;-- asset 5&#xA;-- asset 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I'm looping through the related assets, using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for category in craft.categories.group('categoryGroup').level(1) %}&#xA;    {% set resources = craft.assets.relatedTo(category).find() %}&#xA;      {% for resource in resources %}&#xA;        {{ resources.title }}&#xA;      {% endfor %}&#xA; {% endfor %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Category 1&#xA;- asset 1&#xA;- asset 2&#xA;- asset 3&#xA;- Sub Category 1&#xA;-- asset 1&#xA;-- asset 2&#xA;-- asset 3&#xA;&#xA;Category 2&#xA;- asset 4&#xA;- asset 5&#xA;- asset 6&#xA;- Sub Category 1&#xA;-- asset 4&#xA;-- asset 5&#xA;-- asset 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which logically makes sense, that it's returning all assets related to the children categories, since those are also related to the parent. But how can I exclude them from the loop, so I only get back the assets that are directly related?&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2018-08-01T18:05:42.307" Title="How to exclude child elements when looping through categories?" Tags="&lt;assets&gt;&lt;categories&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27132" PostTypeId="2" ParentId="27130" CreationDate="2018-08-01T18:05:42.307" Score="1" Body="&lt;p&gt;Rather than preparing multiple queries - you can execute the &lt;code&gt;Query&lt;/code&gt; in your field value &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in craft.categories.group('categoryGroup').level(1).find() %}&#xA;    {% for resource in category.fieldHandle.find() %}&#xA;        {{ resources.title }}&#xA;    {% endfor %}&#xA;{% endfor %&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-01T18:05:42.307" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27133" PostTypeId="2" ParentId="27129" CreationDate="2018-08-01T18:21:02.903" Score="2" Body="&lt;p&gt;The issue appears &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/helpers/App.php#L370&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$isConsoleRequest = Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsConsoleRequest();&#xA;if (!$isConsoleRequest &amp;amp;&amp;amp; !Craft::$app-&amp;gt;getUser()-&amp;gt;enableSession) {&#xA;    return null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For whatever reasons &lt;code&gt;Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsConsoleRequest();&lt;/code&gt; does not return &lt;code&gt;true&lt;/code&gt; -&gt; &lt;code&gt;!false&lt;/code&gt; becomes &lt;code&gt;true&lt;/code&gt; -&gt; it tries to grab the &lt;code&gt;user&lt;/code&gt; which &lt;strong&gt;should&lt;/strong&gt; be an instance of &lt;code&gt;craft\web\User&lt;/code&gt; to have the property &lt;code&gt;enableSession&lt;/code&gt; but since it &lt;strong&gt;is&lt;/strong&gt; a console request you receive &lt;code&gt;craft\console\User&lt;/code&gt; which has not such a property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it's a bug or something&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-01T18:21:02.903" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27134" PostTypeId="2" ParentId="27123" CreationDate="2018-08-01T18:27:36.660" Score="1" Body="&lt;p&gt;That error basically means that you're trying to use the variable &lt;code&gt;tweet&lt;/code&gt; as an object/iterable, but it's actually just a boolean (true/false). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the plugin you're using (i.e. &lt;code&gt;craft.twitter&lt;/code&gt;) is &lt;a href=&quot;https://github.com/dukt/twitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dukt's Twitter plugin&lt;/a&gt;, I think this is just a matter of your syntax being a bit off. The Dukt plugin's &lt;code&gt;craft.twitter.get()&lt;/code&gt; method actually returns a response object where the &#xA;tweet objects are &lt;em&gt;nested&lt;/em&gt; in an array called &lt;code&gt;data&lt;/code&gt;. In other words, you can't loop on the object returned by &lt;code&gt;craft.twitter.get()&lt;/code&gt; directly; you'll need to use the array in that object's &lt;code&gt;data&lt;/code&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set response = craft.twitter.get('statuses/user_timeline', {count:2}) %}&#xA;&#xA;{% if response.success %}&#xA;    {% set tweets = response.data %}&#xA;    {% for tweet in tweets %}&#xA;        {% set tweetDate = date(tweet.created_at).diff(now).format('%a') %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;An error occured:&amp;lt;/p&amp;gt;&#xA;    &amp;lt;pre&amp;gt;{{ response.data|json_encode(constant('JSON_PRETTY_PRINT')) }}&amp;lt;/pre&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above example is lifted from &lt;a href=&quot;https://docs.dukt.net/twitter/v2/craft-twitter.html#get-uri-query-headers-options-enablecache-cacheexpire&quot; rel=&quot;nofollow noreferrer&quot;&gt;the plugin's documentation&lt;/a&gt; (although in the actual docs there's a typo, which could well be the cause for your issue). Note that the example also accounts for Things Going Wrong (tm), which is always a good idea when you're working with a third party API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the plugin you're using is &lt;em&gt;not&lt;/em&gt; Dukt's, you'll need to check your plugin's documentation, to verify you're using it correctly. As a debugging effort, you might also want to try and &lt;a href=&quot;http://twig.sensiolabs.org/doc/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;dump()&lt;/code&gt;&lt;/a&gt; the response object variable to verify that it contains what you think it contains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('statuses/user_timeline', {count:2}) %}&#xA;{{ dump(tweets) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that the &lt;code&gt;dump()&lt;/code&gt; method only works when &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt; is set to &lt;code&gt;true&lt;/code&gt;, and should not be left in production code.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-08-01T18:27:36.660" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27135" PostTypeId="2" ParentId="20070" CreationDate="2018-08-01T19:22:06.783" Score="2" Body="&lt;p&gt;I recently had the same issue and fixed it by using Craft reCaptcha plugin. See: &lt;a href=&quot;https://github.com/aberkie/craft-recaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aberkie/craft-recaptcha&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="170" LastActivityDate="2018-08-01T19:22:06.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27136" PostTypeId="1" AcceptedAnswerId="27143" CreationDate="2018-08-01T21:15:52.100" Score="2" ViewCount="1396" Body="&lt;p&gt;I am experiencing incredibly slow site performance. This extends to loading the control panel (/dashboard, /login).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This only happens when I put the site on to my hosting, locally using MAMP it runs quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done the following which are recommended in other posts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;upped the &lt;code&gt;memory_limit&lt;/code&gt; to &lt;code&gt;512M&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;used &lt;code&gt;(% cache globally using key 'entry-' ~ entry.id %}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;used eager loading for image assets&lt;/li&gt;&#xA;&lt;li&gt;Disabled/enabled plugins&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can someone please help? &lt;/p&gt;&#xA;" OwnerUserId="8597" LastEditorUserId="8597" LastEditDate="2018-08-02T10:18:55.613" LastActivityDate="2018-08-02T10:20:52.157" Title="Craft incredibly slow site performance" Tags="&lt;control-panel&gt;&lt;cache&gt;&lt;performance&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27137" PostTypeId="2" ParentId="27122" CreationDate="2018-08-01T22:18:03.157" Score="3" Body="&lt;p&gt;Yes that’s all you need to do. It also works the same if moving to/from a local directory or Google Cloud Storage, or even a subdirectory of any volume type. The index of file paths is relative to the root of the volume for the source, so if the volume changes it doesn’t matter.&lt;/p&gt;&#xA;" OwnerUserId="178" LastActivityDate="2018-08-01T22:18:03.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27138" PostTypeId="2" ParentId="27104" CreationDate="2018-08-02T00:56:24.417" Score="0" Body="&lt;p&gt;Working Code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for region in craft.entries.section('regions').all() %}&#xA;    {% set storesForRegion = craft.entries.section('stores').relatedTo({&#xA;        targetElement: region,&#xA;        field: 'storesRegion'&#xA;    }).all() %}&#xA;    {% if storesForRegion|length %}&#xA;        {{ region.title }}&#xA;        {% for store in storesForRegion %}&#xA;            &amp;lt;a href=&quot;{{ store.url }}&quot;&amp;gt;&#xA;                {{ store.title }}&#xA;            &amp;lt;/a&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user8572" LastActivityDate="2018-08-02T00:56:24.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27139" PostTypeId="1" AcceptedAnswerId="27140" CreationDate="2018-08-02T07:53:42.393" Score="1" ViewCount="1577" Body="&lt;p&gt;I'm currently developing a module that contains a custom field and I'd like to create a template to be used in the &lt;code&gt;getInputHtml&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try using the &lt;code&gt;Craft::$app-&amp;gt;view-&amp;gt;renderTemplate&lt;/code&gt; method to render a template in the &quot;resources&quot; folder of my module, but Craft does not seem to find the template. How should I specify the path to the template from this module?&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2018-08-02T07:56:08.307" Title="How to render a template from within a module?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27140" PostTypeId="2" ParentId="27139" CreationDate="2018-08-02T07:56:08.307" Score="2" Body="&lt;p&gt;You need to include your template roots &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module#2-the-module-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __construct($id, $parent = null, array $config = [])&#xA;{&#xA;    Craft::setAlias('@modules/sitemodule', $this-&amp;gt;getBasePath());&#xA;    $this-&amp;gt;controllerNamespace = 'modules\sitemodule\controllers';&#xA;&#xA;    // Base template directory&#xA;    Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {&#xA;        if (is_dir($baseDir = $this-&amp;gt;getBasePath().DIRECTORY_SEPARATOR.'templates')) {&#xA;            $e-&amp;gt;roots[$this-&amp;gt;id] = $baseDir;&#xA;        }&#xA;    });&#xA;&#xA;    // Set this as the global instance of this module class&#xA;    static::setInstance($this);&#xA;&#xA;    parent::__construct($id, $parent, $config);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-02T07:56:08.307" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27141" PostTypeId="1" CreationDate="2018-08-02T08:36:04.897" Score="2" ViewCount="416" Body="&lt;p&gt;I have problem with the &lt;code&gt;{% paginate%}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft CMS 3.0.18&lt;/li&gt;&#xA;&lt;li&gt;Channel with 3 Entries -&gt; handle &quot;newsBlog&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% paginate craft.entries.section('newsBlog') as pageInfo, pageEntries %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i open the second Entry in the News-Channel i get following values&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;pageInfo.total&lt;/code&gt;: 3&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pageInfo.currentPage&lt;/code&gt;: 1 -&gt; Why?&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pageInfo.nextUrl&lt;/code&gt;: empty -&gt; Why?&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pageInfo.prevUrl&lt;/code&gt;: empty -&gt; Why?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I did a lot of Craft 2 projects without pagination problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did I do wrong? Thx for help!&lt;/p&gt;&#xA;" OwnerUserId="5301" LastEditorUserId="57" LastEditDate="2018-08-02T17:45:33.007" LastActivityDate="2018-08-02T17:45:33.007" Title="{% paginate %} Tag issue, no prevUrl / nextUrl Data" Tags="&lt;craft3&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27142" PostTypeId="2" ParentId="27141" CreationDate="2018-08-02T08:56:33.993" Score="5" Body="&lt;p&gt;You need to set a &lt;code&gt;limit&lt;/code&gt; on your element query, so Craft knows how many entries you want per page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('newsBlog').limit(1) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;don't&lt;/em&gt; set a limit, &lt;code&gt;{% paginate %}&lt;/code&gt; will return a single page with &lt;em&gt;all&lt;/em&gt; entries, because the default value for &lt;code&gt;limit&lt;/code&gt; in Craft 3 is &lt;code&gt;null&lt;/code&gt; (in Craft 2, the default was &lt;code&gt;100&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-08-02T08:56:33.993" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27143" PostTypeId="2" ParentId="27136" CreationDate="2018-08-02T10:20:52.157" Score="4" Body="&lt;p&gt;It turned out this was the culprit. Craft was doing a deprecationerrors query (&lt;a href=&quot;https://github.com/craftcms/cms/issues/2539&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2539&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning &lt;code&gt;devMode&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; fixed this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps someone...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qaYQk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qaYQk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8597" LastActivityDate="2018-08-02T10:20:52.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27146" PostTypeId="2" ParentId="27125" CreationDate="2018-08-02T14:49:47.323" Score="-1" Body="&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&#xA;After did some research in plugin development it worked for me, twig doesn't seem to accept php array so I pass string first and than explode the string with the returned value. Then in template, for checkbox(need to make different checkbox name to make boxes clickable),&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for check in options %}&#xA;{{ forms.checkboxField({&#xA;    id: id ~ 'someField',&#xA;    class: 'nicetext',&#xA;    name: name ~ '[someField]',&#xA;    value: check,&#xA;    errors: values.getErrors('someField'),&#xA;    required: false,&#xA;    label: check&#xA;}) }}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in model,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$result = array();&#xA;foreach ($json as $key =&amp;gt; $value){&#xA;    $result[] = $value['name'];&#xA;}&#xA;$projects = implode(&quot;,&quot;,$result);&#xA;&#xA;return  array('someField' =&amp;gt; array(AttributeType::Enum, 'default' =&amp;gt; $projects),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8652" LastEditorUserId="8652" LastEditDate="2018-08-02T15:15:54.297" LastActivityDate="2018-08-02T15:15:54.297" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27147" PostTypeId="1" AcceptedAnswerId="27193" CreationDate="2018-08-02T15:29:14.137" Score="2" ViewCount="146" Body="&lt;p&gt;This this might be a bug but want to ask here first in case I'm missing something minor.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Description&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Trying to front edit a Sprout Form entry that was created in the front end. I'm using the same form code with additional &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;###&quot;&amp;gt;&lt;/code&gt; field. But it doesn't save the entry, it creates a new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compared my form fields with plugin backend and think I have everything I need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sprout-forms/entries/save-entry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;handle_name&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;275&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Steps to reproduce&lt;/h3&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create form entry&lt;/li&gt;&#xA;&lt;li&gt;Edit in front end&lt;/li&gt;&#xA;&lt;li&gt;Submit form&lt;/li&gt;&#xA;&lt;li&gt;Original entry is unchanged and there's a new entry&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h3&gt;Additional info&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft version: Craft CMS 3.0.18&lt;/li&gt;&#xA;&lt;li&gt;PHP version: 7.2.1&lt;/li&gt;&#xA;&lt;li&gt;Database driver &amp;amp; version: MySQL 5.6.34&lt;/li&gt;&#xA;&lt;li&gt;Plugins &amp;amp; versions: Sprout Forms 3.0.0-beta.20&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-08-24T02:08:22.107" Title="Sprout Forms - Can't save front end entry edits" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27149" PostTypeId="1" AcceptedAnswerId="27150" CreationDate="2018-08-02T18:19:54.297" Score="2" ViewCount="78" Body="&lt;p&gt;I am currently creating various component entries (under channels). Once created I can then add that specific component to structure (know on my site as a work page). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the work page I have a dynamic field (see &lt;a href=&quot;https://github.com/lewisjenkins/craft-dynamic-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lewisjenkins/craft-dynamic-fields&lt;/a&gt;) that allows a user to scroll through these already created component entries in a dropdown list style. That drop down is a dynamic dropdown generated through LJ dynamic fields with the following code in the CMS.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include '_dynamicfields/sections' ignore missing %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there the included file is as follows...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for channel in craft.entries.section('components') %}&#xA;   { &quot;value&quot;:&quot;{{ channel.id }}&quot; , &quot;label&quot;:&quot;{{ channel | raw }}&quot; }&#xA;   {% if not loop.last %},{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately as of late I'm only seeing the latest 100 entries. I haven't seen any reference in either craft CMS documentation or the LJ Dynamic fields documentation.&lt;/p&gt;&#xA;" OwnerUserId="417" LastEditorUserId="57" LastEditDate="2018-08-02T18:33:37.530" LastActivityDate="2018-08-02T19:55:12.933" Title="LJ Dynamic Fields - Only Seeing Latest 100 entries" Tags="&lt;drop-down&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27150" PostTypeId="2" ParentId="27149" CreationDate="2018-08-02T19:20:46.753" Score="1" Body="&lt;p&gt;By default Craft 2 will only return 100 elements (entries, assets, users, etc.) at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get more than that, you need to use &lt;code&gt;limit(null)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for channel in craft.entries.section('components').limit(null) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This behavior changed in Craft 3 so there is no default limit.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-08-02T19:55:12.933" LastActivityDate="2018-08-02T19:55:12.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27151" PostTypeId="1" CreationDate="2018-08-03T08:49:02.880" Score="6" ViewCount="498" Body="&lt;p&gt;Is there some way I can split the element-api.php file into separate files and import them all? It's getting quite long and unwieldy.&lt;/p&gt;&#xA;" OwnerUserId="8549" LastActivityDate="2019-11-25T19:08:05.037" Title="Is there a way to split the element-api.php file?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27152" PostTypeId="2" ParentId="27151" CreationDate="2018-08-03T09:42:53.090" Score="7" Body="&lt;p&gt;Sure – the &lt;code&gt;element-api.php&lt;/code&gt; config file is just plain ol' PHP, and the functions that make up the individual endpoints (e.g. &lt;code&gt;'news.json' =&amp;gt; function () { ...&lt;/code&gt;) doesn't necessarily have to be declared inside that file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to split up the file would be to create one PHP class per element type or section. You could compose these classes however you'd like, but something like the below would work (this is an example file containing two endpoints for the &lt;code&gt;news&lt;/code&gt; section, and the example assumes that the file is saved under &lt;code&gt;/config/endpoints/News.php&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace config\endpoints;&#xA;&#xA;use craft\elements\Entry;&#xA;use craft\helpers\UrlHelper;&#xA;&#xA;class News {&#xA;&#xA;    public static function index()&#xA;    {&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;            'transformer' =&amp;gt; function(Entry $entry) {&#xA;                ...&#xA;            }&#xA;        ];&#xA;    }&#xA;&#xA;    public static function view($entryId)&#xA;    {&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'criteria' =&amp;gt; ['id' =&amp;gt; $entryId],&#xA;            'one' =&amp;gt; true,&#xA;            'transformer' =&amp;gt; function(Entry $entry) {&#xA;                 ...&#xA;            }&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The next step is to make the file available to the &lt;code&gt;element-api.php&lt;/code&gt; config file. One way to do it, is to simply &lt;code&gt;include()&lt;/code&gt; it at the top of the &lt;code&gt;element-api.php&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;include __DIR__ . '/endpoints/News.php';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can add the endpoints from the &lt;code&gt;News&lt;/code&gt; endpoint class to the config in &lt;code&gt;element-api.php&lt;/code&gt;, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;include __DIR__ . '/endpoints/News.php';&#xA;&#xA;use config\endpoints\News;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        // use an anonymous function to prevent errors when running via cli&#xA;        'news.json' =&amp;gt; function () {&#xA;            return News::index();&#xA;        },&#xA;        'news/&amp;lt;entryId:\d+&amp;gt;.json' =&amp;gt; function ($entryId) {&#xA;            return News::view($entryId);&#xA;        },&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to take this a step further, a much nicer approach than using &lt;code&gt;include()&lt;/code&gt; is to have Composer autoload your endpoint classes by adding the below to your &lt;code&gt;composer.json&lt;/code&gt; file (again, this assumes that the custom endpoint classes live under &lt;code&gt;/config/endpoints/&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;        &quot;config\\endpoints\\&quot;: &quot;config/endpoints&quot;&#xA;    }&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After editing your &lt;code&gt;composer.json&lt;/code&gt; file, make sure to regenerate the autoloader by running the following from your command line (root of project, same directory where you keep your &lt;code&gt;composer.json&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer dump-autoload -o&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, you can strip out the &lt;code&gt;include()&lt;/code&gt; statement(s) in your &lt;code&gt;element-api.php&lt;/code&gt; file, because Composer will autoload all the classes under &lt;code&gt;/config/endpoints&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, to make things super clean you could of course &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a custom Yii Module&lt;/a&gt; (or a Craft plugin) to contain your endpoint classes. This would also avoid having to manually add the classpath to the &lt;code&gt;composer.json&lt;/code&gt; file, for the autoloading.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="8325" LastEditDate="2019-11-25T19:08:05.037" LastActivityDate="2019-11-25T19:08:05.037" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27153" PostTypeId="1" AcceptedAnswerId="27154" CreationDate="2018-08-03T10:40:31.903" Score="1" ViewCount="189" Body="&lt;p&gt;Is there any way to translate this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set shopify = craft.shopify.getProductById({ id: entry.shopifyProduct, fields: 'variants, id' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the Element API? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this, but obviously it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  'endpoints' =&amp;gt; [&#xA;  'api.json' =&amp;gt; [&#xA;  'elementType' =&amp;gt; 'Entry',&#xA;  'criteria' =&amp;gt; [&#xA;    'section' =&amp;gt; product,&#xA;  ],&#xA;  'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;    $shopify = craft()-&amp;gt;shopify-&amp;gt;getProductById({id:$entry-&amp;gt;shopifyProduct});&#xA;&#xA;    return [&#xA;      'id' =&amp;gt; $entry-&amp;gt;id,&#xA;      'title' =&amp;gt; $entry-&amp;gt;title,&#xA;      'url' =&amp;gt; $entry-&amp;gt;url,&#xA;      'shopifyId' =&amp;gt; $entry-&amp;gt;$shopify&#xA;    ];&#xA;  },&#xA;]&#xA; ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7395" LastEditorUserId="57" LastEditDate="2018-08-03T13:06:13.270" LastActivityDate="2018-08-03T13:06:13.270" Title="Element API and Shopify plugin" Tags="&lt;plugins&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27154" PostTypeId="2" ParentId="27153" CreationDate="2018-08-03T10:55:25.767" Score="1" Body="&lt;p&gt;There are some issues with your PHP syntax – I didn't test this (not sure how the data model returned by &lt;code&gt;craft()-&amp;gt;shopify-&amp;gt;getProductById()&lt;/code&gt; looks, and you'll need to verify that &lt;code&gt;$entry-&amp;gt;shopifyProduct&lt;/code&gt; returns a Shopify product ID), but at least the syntax errors should be fixed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api.json' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; [&#xA;                'section' =&amp;gt; 'product',&#xA;            ],&#xA;            'transformer' =&amp;gt; function (EntryModel $entry) {&#xA;                $shopify = craft()-&amp;gt;shopify-&amp;gt;getProductById([ 'id' =&amp;gt; $entry-&amp;gt;shopifyProduct ]);&#xA;                return [&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    'shopifyId' =&amp;gt; $shopify ? $shopify-&amp;gt;id : null,&#xA;                ];&#xA;            },&#xA;        ]&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-08-03T10:55:25.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27156" PostTypeId="1" AcceptedAnswerId="27198" CreationDate="2018-08-03T14:22:03.980" Score="1" ViewCount="104" Body="&lt;p&gt;I have a front-end form to update user's email address, like this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;newEmail&quot;&amp;gt;New email address&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;email&quot; name=&quot;email&quot; value=&quot;&quot; id=&quot;newEmail&quot;&amp;gt;&#xA;&#xA;    &amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&#xA;    &amp;lt;input type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once the form is submitted, Craft send a system message to the user email address, with a confirmation link. Once this link is clicked, the user is redirected to the root URL of the front-end website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the &lt;code&gt;activateAccountSuccessPath&lt;/code&gt;, but whereas it works during account activation, it doesn't works during account email update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'activateAccountSuccessPath' =&amp;gt; array(&#xA;    'en' =&amp;gt; 'my-account',&#xA;    'fr' =&amp;gt; 'mon-compte'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'activateAccountSuccessPath' =&amp;gt; 'my-account'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried to enable / disable the &lt;code&gt;autoLoginAfterAccountActivation&lt;/code&gt; setting, but the redirection is still not working. Even is user is already logged in, or if he is logged out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also checked the Craft logs, but I there's no error, no missing template, etc. ... nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set a custom URI on this link?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-08-07T08:22:41.860" Title="How can I set a custom URI for the confirmation link of account email update from a front-end form?" Tags="&lt;config&gt;&lt;emails&gt;&lt;validation&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27157" PostTypeId="1" AcceptedAnswerId="27159" CreationDate="2018-08-03T15:27:45.467" Score="1" ViewCount="546" Body="&lt;p&gt;Here's what I'm getting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: An error occurred&#xA;&#xA;Output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;  Problem 1&#xA;    - Installation request for craftcms/cms 3.0.18 -&amp;gt; satisfiable by craftcms/cms[3.0.18].&#xA;    - craftcms/cms 3.0.18 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;  Problem 2&#xA;    - craftcms/cms 3.0.18 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;    - pierrestoffe/craft-language-redirector 1.0.2 requires craftcms/cms ^3.0.0-RC1 -&amp;gt; satisfiable by craftcms/cms[3.0.18].&#xA;    - Installation request for pierrestoffe/craft-language-redirector 1.0.2 -&amp;gt; satisfiable by pierrestoffe/craft-language-redirector[1.0.2].&#xA;&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've attempted:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;removing &lt;code&gt;vendors&lt;/code&gt; directory&lt;/li&gt;&#xA;&lt;li&gt;removing &lt;code&gt;composer.lock&lt;/code&gt; file&lt;/li&gt;&#xA;&lt;li&gt;updating via CLI&lt;/li&gt;&#xA;&lt;li&gt;changing craftcms to &lt;code&gt;3.0.18&lt;/code&gt; and running install&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anything else I can try?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2018-08-03T16:02:20.833" Title="Can't update past 3.0.15" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27158" PostTypeId="1" CreationDate="2018-08-03T15:45:51.643" Score="2" ViewCount="133" Body="&lt;p&gt;I need to figure out if there's a way to track the amount of times an asset was downloaded. I need to display this in the back end on the site. I don't need to display it anywhere but on the back end of an admin user.&lt;/p&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-08-03T15:45:51.643" Title="Track downloads on assets" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27159" PostTypeId="2" ParentId="27157" CreationDate="2018-08-03T16:02:20.833" Score="3" Body="&lt;p&gt;I had a similar issue - update your composer.json file as per this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/26966/composer-was-unable-to-install-the-updates&quot;&gt;Composer was unable to install the updates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alot of additional things may have got added to your composer.json file.&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2018-08-03T16:02:20.833" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27160" PostTypeId="2" ParentId="27102" CreationDate="2018-08-03T16:10:11.973" Score="1" Body="&lt;p&gt;&lt;code&gt;{% if item.options.value is defined and item.options.value == 'on' %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-08-03T16:10:11.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27161" PostTypeId="1" AcceptedAnswerId="27162" CreationDate="2018-08-03T19:09:29.860" Score="2" ViewCount="40" Body="&lt;p&gt;I installed Craft Commerce 2 and the templates are in vendor/craftcms/commerce/templates/shop. Is it safe to move these to my craft templates folder like this? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;├── storage&#xA;...&#xA;│   └── runtime&#xA;├── templates&#xA;│   └── shop&#xA;├── vendor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or are they where they are for a reason?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really like the idea of drilling down into the vendor plugin directories to make changes, especially if they can be overwritten by composer during an update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to introduce future problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2018-11-02T18:49:23.810" Title="Is it safe to move Craft Commerce Templates out of Plugin" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27162" PostTypeId="2" ParentId="27161" CreationDate="2018-08-03T19:31:00.107" Score="0" Body="&lt;p&gt;You can copy them into your &lt;code&gt;templates&lt;/code&gt; folder if you want to use them as a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added a mention of that into the installation docs here: &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/installation.html#example-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/installation.html#example-templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2018-11-02T18:49:23.810" LastActivityDate="2018-11-02T18:49:23.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27163" PostTypeId="1" AcceptedAnswerId="27165" CreationDate="2018-08-03T20:27:54.947" Score="3" ViewCount="3726" Body="&lt;p&gt;I have a peculiar situation that is only happening on the root domain and NOT subdomains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, CraftCMS (&lt;em&gt;2.6.3019&lt;/em&gt;) running on Apache with &lt;code&gt;php-fpm&lt;/code&gt; works fine on &lt;code&gt;dev.some-domain.tld&lt;/code&gt; and &lt;code&gt;test.some-domain.tld&lt;/code&gt;, but for &lt;code&gt;www.some-domain.tld&lt;/code&gt; it fails with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In browser:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;No input file specified&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In cPanel Apache log (&lt;code&gt;/usr/local/apache/error_log&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[Fri Aug 03 13:59:12.42352 2018] [proxy_fcgi:error] [pid 31552:tid 132443556343644] [client xxx.xxx.xxx.xxx:55292] AH01071: Got error 'Unable to open primary script: /home/USERNAME/public_html/production/current/html/index.php (No such file or directory)\n'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For identical installations for other subdomains, everything loads up and works great.  There is no difference in &lt;code&gt;.htaccess&lt;/code&gt; or otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only differential that we can figure must be something with how Apache's handling the root document location or permissions for the root domain... but we're not seeing anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For good measure, here's the &lt;code&gt;.htaccess&lt;/code&gt; contents (that are identical on the working subdomains and this failing root domain):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_expires.c&amp;gt;&#xA;    ExpiresActive On&#xA;    ExpiresDefault &quot;access plus 1 year&quot;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_php5.c&amp;gt;&#xA;    php_flag zlib.output_compression on&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA;    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript&#xA;    BrowserMatch ^Mozilla/4 gzip-only-text/html&#xA;    BrowserMatch ^Mozilla/4\.0[678] no-gzip&#xA;    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html&#xA;    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary&#xA;    Header append Vary User-Agent env=!dont-vary&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;    RewriteCond %{HTTP_HOST} !^www\. [NC]&#xA;    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]&#xA;    RewriteCond %{HTTPS} !=on&#xA;    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought that perhaps it was the &lt;code&gt;cgi.fix_pathinfo=1&lt;/code&gt; setting for the &lt;code&gt;php.ini&lt;/code&gt;, but that also didn't resolve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cPanel support is saying it is absolutely a code issue, but we're pretty much convinced it's an Apache / cPanel issue.  It would be nice to have some input on this since this particular incident of &lt;code&gt;No input file specified&lt;/code&gt; does not seem to match the others already found here and elsewhere on the web.&lt;/p&gt;&#xA;" OwnerUserId="8656" LastActivityDate="2018-08-04T02:26:28.593" Title="No input file specified - [proxy_fcgi:error] Got error 'Unable to open primary script: [PATH]/html/index.php (No such file or directory)\n'" Tags="&lt;error-message&gt;&lt;htaccess&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27164" PostTypeId="1" AcceptedAnswerId="27169" CreationDate="2018-08-04T02:10:02.817" Score="5" ViewCount="1162" Body="&lt;p&gt;I must be missing something or not understanding something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to build a module for an install, and I'd like to run the initial migration. So the module initial install migration for the DB lives in &lt;code&gt;/modules/moduleName/migrations/Install.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing I run from the CLI seems to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft migrate/up&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only sees what is in the root &lt;code&gt;/migrations/&lt;/code&gt; folder; seems counter-intuitive to have a migrations folder in my module if I have to manually move them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft migrate/up --plugin=everyVariationOfAPossibleHandleItMightFind&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doesn't work ever, as the module is installed and works, but it isn't a plugin so I guess it doesn't see it somehow (looking in the wrong place in the file system I would bet).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft migrate/up migrationPath=@app/modules/moduleName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft CLI doesn't seem carry that Yii CLI param, so I can't specify a path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? How do others handle custom module migrations in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="5422" LastActivityDate="2018-08-04T16:45:11.700" Title="Running module migrations" Tags="&lt;craft3&gt;&lt;migration&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27165" PostTypeId="2" ParentId="27163" CreationDate="2018-08-04T02:26:28.593" Score="5" Body="&lt;p&gt;It turned out that the problem was from customizing the domain's document root in the userdata files and then the PHP-FPM configuration had not been rebuilt and the service not restarted.  The following resolved the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/scripts/php_fpm_config --rebuild&#xA;/scripts/restartsrv_apache_php_fpm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's interesting since there are a broad variety of issue that seem to cause this &lt;code&gt;No input file specified&lt;/code&gt; issue, but they all mostly revolve around Apache config issues.&lt;/p&gt;&#xA;" OwnerUserId="8656" LastActivityDate="2018-08-04T02:26:28.593" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27167" PostTypeId="2" ParentId="27051" CreationDate="2018-08-04T13:19:24.300" Score="1" Body="&lt;p&gt;Solved it (finally).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First part of the problem (the 302 redirect) was this missing configuration in the ajax call:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$.post({&#xA;  // ...&#xA;  dataType: 'json',&#xA;  // ...&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It tells the server what you expect to get back from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this was fine, but I ran into a second issue. The xhr request stalled in Safari. When that happend and I reloaded the page (causing the request to finally stop), the email was sent anyways. The reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Safari seems to have an issue with this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;const formData = new FormData(formElement);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found a hint here &lt;a href=&quot;https://stackoverflow.com/a/8797289/2342963&quot;&gt;https://stackoverflow.com/a/8797289/2342963&lt;/a&gt; that fixes the issue: appending the data manually to the &lt;code&gt;FormData&lt;/code&gt; instance instead of passing the form element to the constructor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is the working code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;const formData = new FormData();&#xA;&#xA;$.each($('input, textarea, select'), function(i, element) {&#xA;    if (element.files) {&#xA;      $.each(element.files, function(i, file) {&#xA;        formData.append(element.name, file);&#xA;      });&#xA;    } else {&#xA;      formData.append(element.name, element.value);&#xA;    }&#xA;});&#xA;&#xA;$.post({&#xA;    url: '/',&#xA;    data: formData,&#xA;    type: 'POST',&#xA;    cache: false,&#xA;    contentType: false,&#xA;    processData: false,&#xA;    dataType: 'json',&#xA;&#xA;    success: response =&amp;gt; {&#xA;        if (response.success) {&#xA;        // Show success&#xA;        } else {&#xA;        // Show error&#xA;        }&#xA;    },&#xA;    error: () =&amp;gt; {&#xA;        // Show error&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Turns out, it wasn’t a Craft issue after all ¯_(ツ)_/¯&lt;/p&gt;&#xA;" OwnerUserId="1056" LastActivityDate="2018-08-04T13:19:24.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27168" PostTypeId="1" CreationDate="2018-08-04T15:17:23.787" Score="2" ViewCount="142" Body="&lt;p&gt;I just copied my database across from local server to production server. I used Craft's control panel to create a backup. Then I used Sequel Pro to import this into the live server.&#xA;I got this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[ERROR in query 121] The query length of 4327045 bytes is larger than max_allowed_packet size (4194304).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I clicked on 'Continue' and all looks OK on my live site.&#xA;Can someone suggest what this might mean? Should I worry? What should I do?&lt;/p&gt;&#xA;" OwnerUserId="3695" LastEditorUserId="57" LastEditDate="2018-08-05T03:34:55.847" LastActivityDate="2018-08-05T15:28:06.900" Title="Error on import to Craft production db" Tags="&lt;mysql&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27169" PostTypeId="2" ParentId="27164" CreationDate="2018-08-04T16:45:11.700" Score="4" Body="&lt;p&gt;Per the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/#modules-vs-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;Modules vs. Plugins&lt;/a&gt; docs, only plugins get their own migration track. Modules are considered part of the project (like templates and config files), so if there are any DB changes that need to be made for the module to run, those changes should be made via &lt;a href=&quot;https://docs.craftcms.com/v3/content-migrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;content migrations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the module is meant to be reused across multiple projects &lt;em&gt;and&lt;/em&gt; does require DB migrations, then it will be better off as a plugin.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-04T16:45:11.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27170" PostTypeId="2" ParentId="27011" CreationDate="2018-08-04T16:51:47.463" Score="2" Body="&lt;p&gt;This ended up being because not all categories were properly resaved after a new locale was added. Resaving the categories solved it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-04T16:51:47.463" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27171" PostTypeId="1" AcceptedAnswerId="27172" CreationDate="2018-08-04T20:00:02.527" Score="2" ViewCount="58" Body="&lt;p&gt;I hope anyone can help me to get started. I think I have a brain freeze or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a section (structure) that is called &quot;House&quot;.&#xA;I want this section to use a template. In craft/templates/ I have created the folder &quot;house&quot; with the file index.html in it. I have also tried _entry.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I then go my URL (for example): project.com/house it can´t find anything. Could not find the path on the server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something &quot;wrong&quot; on the server that don't allow access to that URL? &lt;/p&gt;&#xA;" OwnerUserId="6532" LastActivityDate="2018-08-04T20:16:16.067" Title="Section and template folder problem" Tags="&lt;sections&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27172" PostTypeId="2" ParentId="27171" CreationDate="2018-08-04T20:16:16.067" Score="2" Body="&lt;p&gt;Whatever template path you decide to go with, make sure you set that in the section’s settings. So if it’s &lt;code&gt;house/_entry.html&lt;/code&gt;, make sure you put &lt;code&gt;house/_entry&lt;/code&gt; in your section settings.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-04T20:16:16.067" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27173" PostTypeId="2" ParentId="27168" CreationDate="2018-08-05T03:40:54.640" Score="1" Body="&lt;p&gt;Your MySQL configuration has its &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet&quot; rel=&quot;nofollow noreferrer&quot;&gt;max_allowed_packet&lt;/a&gt; config setting set to the default 42M (4194304).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a query that executed for database backup that is slightly larger than that (about 44M).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to increase that value in your MySQL config or ask your host if they can do it for you if you want to import the backup without any errors.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="819" LastEditDate="2018-08-05T15:28:06.900" LastActivityDate="2018-08-05T15:28:06.900" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27176" PostTypeId="1" CreationDate="2018-08-05T22:38:17.760" Score="2" ViewCount="245" Body="&lt;p&gt;I have a section called &quot;Musicians&quot; which is already set up and populated.&#xA;It has an unpopulated &quot;Albums&quot; Matrix field which will hold each artist's albums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have exported the albums as a separate JSON file. Now I like to import them into the existing &quot;Musicians&quot; section's Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my three test album entries fail to get added to the corresponding artist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've assigned the correct JSON fields to the matrix, but I'm not sure how to connect each album with the existing artist – adding the artist Title field or title slug in FeedMe doesn't do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample JSON structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{  &#xA;  &quot;title&quot;:&quot;Milyakburra&quot;,&#xA;  &quot;url_title&quot;:&quot;milyakburra&quot;,&#xA;  &quot;album_artist_relate&quot;:[  &#xA;     {  &#xA;        &quot;entry_id&quot;:&quot;2590&quot;,&#xA;        &quot;title&quot;:&quot;Emily Wurramara&quot;,&#xA;        &quot;url_title&quot;:&quot;emily-wurramara&quot;&#xA;     }&#xA;  ],&#xA;  &quot;album_release_date&quot;:&quot;2018-06-01&quot;,&#xA;  &quot;album_description&quot;:&quot;&quot;,&#xA;  &quot;album_tracks_1&quot;:&quot;Lady Blue\nMilyakburra\nNgarrikwujeyinama\nCarry Me Home\nBlack Smoke\nLullaby\nHey Love\nTap Sticks\nYimenda-Papaguneray (Turtle Song)\nBlue Moon, Black Sea\nBlack Boy&quot;,&#xA;  &quot;album_tracks_2&quot;:&quot;&quot;,&#xA;  &quot;album_cover&quot;:&quot;/images/uploads/resources/music/emily-wurramura_milyakburra.jpg&quot;,&#xA;  &quot;album_fishpond_link_id&quot;:&quot;&quot;,&#xA;  &quot;album_amazon_link_id&quot;:&quot;&quot;,&#xA;  &quot;album_itunes_link_album_name&quot;:&quot;milyakburra/1388866633&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;It looks like FeedMe has difficulties finding a match between a musician entry's &lt;code&gt;title&lt;/code&gt; field and the &lt;code&gt;album_artist_relate&lt;/code&gt; title field. If I manually add a new title field at the top of the structure (and rename the existing one to &quot;title2&quot;) FeedMe correctly inserts the data into the matrix.&lt;/p&gt;&#xA;" OwnerUserId="8596" LastEditorUserId="8596" LastEditDate="2018-08-06T00:31:54.197" LastActivityDate="2018-08-06T08:39:15.353" Title="FeedMe: How to import data into the Matrix field of a section?" Tags="&lt;matrix&gt;&lt;import&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27177" PostTypeId="2" ParentId="27176" CreationDate="2018-08-06T08:39:15.353" Score="1" Body="&lt;p&gt;It seems that FeedMe cannot process such JSON objects as it needs them to be cleaner. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up doing a lot of PHP processing of my exported data until it had the below format. With that FeedMe was happy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{  &#xA;  &quot;title&quot;:&quot;Emily Wurramara&quot;,&#xA;  &quot;album&quot;:[  &#xA;     {  &#xA;        &quot;album_release_date&quot;:&quot;2017-02-08&quot;,&#xA;        &quot;album_description&quot;:&quot;&quot;,&#xA;        &quot;album_tracks_1&quot;:&quot;Hey Love&quot;,&#xA;        &quot;album_tracks_2&quot;:&quot;&quot;,&#xA;        &quot;album_cover&quot;:&quot;emily-wurramura_hey-love.jpg&quot;,&#xA;        &quot;album_amazon_link_id&quot;:&quot;&quot;,&#xA;        &quot;album_itunes_link_album_name&quot;:&quot;hey-love-single/1203932967&quot;,&#xA;        &quot;album_title&quot;:&quot;Hey Love (Single)&quot;&#xA;     },&#xA;     {  &#xA;        &quot;album_release_date&quot;:&quot;2017-02-22&quot;,&#xA;        &quot;album_description&quot;:&quot;&quot;,&#xA;        &quot;album_tracks_1&quot;:&quot;Hey Love Me Too&quot;,&#xA;        &quot;album_tracks_2&quot;:&quot;&quot;,&#xA;        &quot;album_cover&quot;:&quot;emily-wurramura_hey-love.jpg&quot;,&#xA;        &quot;album_amazon_link_id&quot;:&quot;&quot;,&#xA;        &quot;album_itunes_link_album_name&quot;:&quot;hey-love-single/1203932967&quot;,&#xA;        &quot;album_title&quot;:&quot;Hey Love (Me Too)&quot;&#xA;     }&#xA;  ]&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8596" LastActivityDate="2018-08-06T08:39:15.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27178" PostTypeId="1" CreationDate="2018-08-06T11:14:50.233" Score="3" ViewCount="897" Body="&lt;p&gt;I have an events section with a custom field of eventDate and it would be very helpful to editors to have them listed in event date order.&#xA;In Craft 2 I used the plugin &lt;a href=&quot;https://github.com/mmikkel/CpSortableCustomColumns-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP Sortable Custom Columns&lt;/a&gt; by Mikkel Rummelhoff but he hasn't ported it to Craft 3 and may not, he says.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would have thought this option would be useful to many people, so has anyone got any suggestions as to how to achieve it, I'm not a plugin developer myself.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2019-06-06T17:50:11.593" Title="How can I sort entries by a custom field in the CP, Craft 3?" Tags="&lt;control-panel&gt;&lt;sorting&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27179" PostTypeId="1" CreationDate="2018-08-06T12:34:20.097" Score="1" ViewCount="28" Body="&lt;p&gt;So, let's assume I have two channels. &lt;code&gt;events&lt;/code&gt; and &lt;code&gt;movies&lt;/code&gt;, being &lt;code&gt;events&lt;/code&gt; the screening time of each movie. In the admin, in the event entry, you can select one movie. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The movie could be disabled. The agenda page, a chronological list of the &lt;code&gt;events&lt;/code&gt; shows up. I want to paginate the events, but only the ones with an enabled &lt;code&gt;movie&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried some stuff (see below), but ended up with the same result: A list of events, and some of them with an empty movie attribute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to exclude the events with no show from the result to paginate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;    section: 'events',&#xA;    with: [&#xA;        ['show', { status: 'live' }],&#xA;    ],&#xA;    limit: 10,&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('events').with('show') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And to paginate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for entry in pageEntries %}&#xA;        &amp;lt;article&amp;gt;&#xA;            {{ entry.show[0].title }}&#xA;        &amp;lt;/article&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;    {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-08-06T12:34:20.097" Title="Paginate entries based on related status" Tags="&lt;pagination&gt;&lt;mysql&gt;&lt;query&gt;&lt;queries&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27180" PostTypeId="1" CreationDate="2018-08-06T13:18:57.633" Score="1" ViewCount="65" Body="&lt;p&gt;I want to allow end-users (registered as users in Craft) to update only specific fields of an entry. I know that only those fields included in the form are being updated; but this isn't secure enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to manipulate the form POST request sent to the 'entries/save-entry' controller so that only specific fields will be updated. I know how to access the onBeforeSave event so that I can manipulate the entry object that will be saved to the database. I already use this to make sure that the user can only update one specific entry (because including the entryId in a hidden form field isn't secure enough).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't find a clever way to include only certain fields. The only way that comes into my mind is to overwrite all fields in the entry object that the user is not allowed to update with the current values from the database. This way is cumbersome because that entry type has so many fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to filter the element so that I can supply an array with field names that will be included in the save process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&#xA;Mischa&lt;/p&gt;&#xA;" OwnerUserId="8339" LastActivityDate="2018-08-06T14:06:35.410" Title="Allow registered end-user to update entry, but limited only to specific fields (Craft 3)" Tags="&lt;saveentry&gt;&lt;onsaveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27181" PostTypeId="2" ParentId="27180" CreationDate="2018-08-06T14:06:35.410" Score="1" Body="&lt;p&gt;You can include a custom &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-behaviors&quot; rel=&quot;nofollow noreferrer&quot;&gt;Behavior&lt;/a&gt; like the &lt;code&gt;ContentBehavior&lt;/code&gt;/ &lt;code&gt;FieldLayoutBehavior&lt;/code&gt; in Craft 3 and handle those by yourself. This way you'll be able to handle permissions by yourself. There are certain &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#control-panel-template-hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Control Panel Hooks&lt;/a&gt; to include custom HTML.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a custom Behavior that's kind of a wrapper for the usual &lt;code&gt;ContentBehavior&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Store &quot;special/extra&quot; fields for those Elements in a custom table&lt;/li&gt;&#xA;&lt;li&gt;Render those extra fields in a custom panel/tab&lt;/li&gt;&#xA;&lt;li&gt;store those new values in your custom Table in beforeSave and afterSave funktions&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But in general creating a custom Element Type would be easier to achieve, since you'll have more possibilities and more freedom to do what you want&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-06T14:06:35.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27182" PostTypeId="1" CreationDate="2018-08-06T14:49:51.380" Score="0" ViewCount="114" Body="&lt;p&gt;I've run into a dead end when trying to create custom URL's for a product type in Commerce 2. I want to create the URL from a custom field -- a Commerce Product field to be exact. This product does not have variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've referenced &lt;a href=&quot;https://craftcms.stackexchange.com/questions/22497/get-the-category-into-the-url-of-the-product-page&quot;&gt;this question here&lt;/a&gt;, but the example did not work for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I've tried with no success: &lt;code&gt;{relatedImage.first().id}&lt;/code&gt;, &lt;code&gt;{relatedImage[0].id}&lt;/code&gt;, &lt;code&gt;{object.relatedImage.first().id}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Craft task manager tries to rerun these products, it just errors out (Failed). And I'm not sure where to find task manager error logs to see if I can get any information from them.&lt;/p&gt;&#xA;" OwnerUserId="2281" LastActivityDate="2018-08-06T14:49:51.380" Title="Custom Commerce product type URL from custom field" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27183" PostTypeId="1" AcceptedAnswerId="27200" CreationDate="2018-08-06T15:52:47.443" Score="1" ViewCount="39" Body="&lt;p&gt;Is there a way (or plugin) to organise headings alphabetically? You can drag and drop to rearrange but if its a contact list for example, being alphabetised is really useful.&lt;a href=&quot;https://i.stack.imgur.com/OzhFX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OzhFX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-08-07T09:48:04.663" Title="Rearrange Headings Alphabetically" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27184" PostTypeId="1" CreationDate="2018-08-06T17:31:20.087" Score="2" ViewCount="377" Body="&lt;p&gt;I am using .env to set environment to local:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# .ENV The environment Craft is currently running in ('dev', 'staging', &#xA;'production', etc.)&#xA; CRAFTENV_CRAFT_ENVIRONMENT=&quot;local&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My general config looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Dev environment settings&#xA;'local' =&amp;gt; [&#xA;    'devMode' =&amp;gt; true,&#xA;&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL')&#xA;&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My staging site is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Staging environment settings&#xA;'staging' =&amp;gt; [&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;&#xA;    // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;    'devMode' =&amp;gt; true,&#xA;&#xA;    'baseUrl'  =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;    'basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH'),&#xA;    'aliases' =&amp;gt; [&#xA;        '@assetBaseUrl' =&amp;gt; getenv('ASSET_BASE_URL'),&#xA;        '@assetBasePath' =&amp;gt; getenv('ASSET_BASE_PATH'),&#xA;        '@baseUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;        '@basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH')&#xA;    ],&#xA;    // Custom site-specific config settings&#xA;    'custom' =&amp;gt; [&#xA;        'craftEnv' =&amp;gt; getenv('CRAFTENV_CRAFT_ENVIRONMENT'),&#xA;        'staticAssetsVersion' =&amp;gt; 1,&#xA;    ]&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why wont my local site show the dev mode settings in CP ?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2018-08-06T17:43:44.323" LastActivityDate="2018-08-06T22:31:59.950" Title="Config for devMode not showing when true" Tags="&lt;config&gt;&lt;multi-environment&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27185" PostTypeId="1" AcceptedAnswerId="27188" CreationDate="2018-08-06T17:34:17.780" Score="2" ViewCount="470" Body="&lt;p&gt;I've never had success using Craft 3 with Commerce 2 beta. I always get an error that &quot;.find()&quot; is not recognized, and &quot;.all()&quot; doesn't work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My latest attempt has given me this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Twig Runtime Error – Twig_Error_Runtime&#xA;  Calling unknown method: craft\commerce\services\Products::type()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The line in question is this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set silentItems = craft.commerce.products.type('silentAuctionItems').find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I delete&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.type('silentAuctionItems').find()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the error doesn't come up, but I don't get any products displaying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've searched through the Commerce documentation, and I can't find anything about this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help you can provide!&lt;/p&gt;&#xA;" OwnerUserId="8176" LastEditorUserId="8176" LastEditDate="2018-08-06T18:54:26.103" LastActivityDate="2018-08-06T19:05:05.793" Title="Getting products with Craft 3 and Craft Commerce 2" Tags="&lt;plugin-craftcommerce&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27186" PostTypeId="2" ParentId="27178" CreationDate="2018-08-06T17:40:23.513" Score="2" Body="&lt;p&gt;A few solutions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Hire someone to create a plugin for you&lt;/li&gt;&#xA;&lt;li&gt;Learn PHP in order to include the ability to sort those fields&lt;/li&gt;&#xA;&lt;li&gt;Create  a feature request and hope Pixel and Tonic will include it&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For those who want to sort entries by custom fields can &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#modifyentrysortableattributes-modifycategorysortableattributes-modifyassetsortableattributes-modifyusersortableattributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;read the docs&lt;/a&gt; in order to get to know how it is possible&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Entry::class, Element::EVENT_REGISTER_SORT_OPTIONS, function(RegisterElementSortOptionsEvent $event) {&#xA;    $event-&amp;gt;sortOptions[] = [&#xA;        'orderBy' =&amp;gt; 'content.field_eventDate', //&amp;lt;-- content. + handle of the field prefixed with field_ to match the database column&#xA;        'label' =&amp;gt; 'My Awesome custom search',// &amp;lt;-- name of the label in the CP&#xA;        'attribute' =&amp;gt; 'field:10' //&amp;lt;--- id of your field&#xA;    ];&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="50" LastEditDate="2018-10-26T22:07:59.950" LastActivityDate="2018-10-26T22:07:59.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27188" PostTypeId="2" ParentId="27185" CreationDate="2018-08-06T19:03:39.243" Score="1" Body="&lt;pre&gt;&lt;code&gt;craft.product.type(x).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will do it, without &lt;code&gt;commerce&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-06T19:03:39.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27189" PostTypeId="2" ParentId="27185" CreationDate="2018-08-06T19:05:05.793" Score="2" Body="&lt;p&gt;I figured out the problem. It should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set silentItems = craft.products.type('silentAuctionItems').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't put .commerce between craft and .products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8176" LastActivityDate="2018-08-06T19:05:05.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27190" PostTypeId="2" ParentId="670" CreationDate="2018-08-06T19:44:40.253" Score="1" Body="&lt;p&gt;I'd prefer to use caching all the time. Since developing with caching disabled can be really confusing when something refuses to work in production with caching enabled. If you develop with caching enabled, you'd probably find issues while developing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better to clear the cache folder if you need to refresh.&lt;/p&gt;&#xA;" OwnerUserId="7950" LastActivityDate="2018-08-06T19:44:40.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27192" PostTypeId="1" AcceptedAnswerId="27217" CreationDate="2018-08-06T21:16:57.077" Score="1" ViewCount="680" Body="&lt;p&gt;How do I embed an image (PNG,SVG or JPG) into a CraftCMS Commerce 2 PDF receipt? I tried importing the svg using an includes. I tried using an img tag and referencing a local file. Nothing seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2021-03-10T12:06:04.683" Title="How can I embed Image into Craft Commerce 2 PDF Receipt" Tags="&lt;plugin-craftcommerce&gt;&lt;dompdf&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27193" PostTypeId="2" ParentId="27147" CreationDate="2018-08-06T21:21:25.590" Score="2" Body="&lt;h3&gt;Craft 3&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This feature is available in Sprout Forms for Craft 3 (since v3.0.0-beta.22). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feature is disabled by default and can be enabled in the Sprout Forms settings.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Craft 2&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This feature exists in Sprout Forms for Craft 2 via the &lt;code&gt;enableEditFormEntryViaFrontEnd&lt;/code&gt; config override. &lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-08-24T02:08:22.107" LastActivityDate="2018-08-24T02:08:22.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27194" PostTypeId="2" ParentId="27119" CreationDate="2018-08-06T21:27:05.873" Score="1" Body="&lt;p&gt;Sprout Forms 3.2.0 added an &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/integrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Integrations API&lt;/a&gt; and the previously named 'Payload Forwarding' is now handled via the Custom Endpoint Integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The new Integrations feature also improves tracking of Integration submissions so you should have more data to help monitor or troubleshoot if any requests are behaving as expected.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;LEGACY ANSWER:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every API you submit data to is different and Payload Forwarding may need to be implemented differently depending on what service you are trying to submit to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, the data that gets forwarded is in the same format that it would be in if you were submitting it to Craft. Many services may require data to be in a different format, so we'd need to know more about where you are trying to submit the data and how to help troubleshoot further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See a brief overview of &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/payload-forwarding.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Payload Forwarding&lt;/a&gt; in the docs. If you need to submit the data in another format, you could consider overriding how the fields are structured in the templates with &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do have on our list to refactor the Payload Forwarding API to make customizing the payload for different services more accessible.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2019-06-28T22:21:36.743" LastActivityDate="2019-06-28T22:21:36.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27195" PostTypeId="2" ParentId="27184" CreationDate="2018-08-06T22:31:59.950" Score="2" Body="&lt;p&gt;The solution was ENVIRONMENT=&quot;local&quot; in .env&#xA;via andrew.welch&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-08-06T22:31:59.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27196" PostTypeId="2" ParentId="27084" CreationDate="2018-08-07T01:59:19.770" Score="1" Body="&lt;p&gt;If your Form has an Entries Relations field that identifies the Entry that you want to get a value from to send your email, you won't need a plugin at all and can target the email in the custom field on that entry. This can even be done for advanced fields such as Super Table as you have in your screenshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the Super Table field in your screenshot, you could access the &lt;code&gt;emailOverride&lt;/code&gt; value like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.relatedEntry.first().superTableField.emailOverride }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to be a bit more defensive, you could even add a conditional to check to make sure the value existed and fallback to another email adddress:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ object.relatedEntry.first().superTableField.emailOverride|length ? object.relatedEntry.first().superTableField.emailOverride : &quot;fallback@email.com&quot; }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: In some cases, when looping or using conditionals your dynamic value in the recipients' field can get quite long. In older versions of Sprout Forms, the Notification Recipients value was stored as a VARCHAR field with 255 characters. If you happen to go over 255 characters in an older version of Sprout Forms, you will want to update to a more recent version of the plugin or update that database column to use the TEXT type to capture your full recipient value.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-08-07T01:59:19.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27197" PostTypeId="2" ParentId="27192" CreationDate="2018-08-07T02:30:20.767" Score="2" Body="&lt;p&gt;The PDF renderer uses DOMPDF, which expects a HTML document to be supplied. See the DOMPDF documentation to see what types of images are supported.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are linking images from a different domain you will need to set the commerce.php config setting of &lt;code&gt;pdfAllowRemoteImages&lt;/code&gt; to true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/commerce/v2/configuration.html#pdfallowremoteimages&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/configuration.html#pdfallowremoteimages&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="9" LastEditDate="2018-11-02T18:51:00.767" LastActivityDate="2018-11-02T18:51:00.767" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27198" PostTypeId="2" ParentId="27156" CreationDate="2018-08-07T08:22:41.860" Score="1" Body="&lt;p&gt;I can't think of a clean way to do this because of this function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionVerifyEmail(): Response&#xA;{&#xA;    // ..&#xA;    // snip &#xA;    // ..&#xA;    if (Craft::$app-&amp;gt;getUsers()-&amp;gt;verifyEmailForUser($userToProcess)) {&#xA;        // ..&#xA;        // snip&#xA;        // ..&#xA;        // Redirect to the site/CP root&#xA;        $url = UrlHelper::url('');  // &amp;lt;---- this is where we are&#xA;        return $this-&amp;gt;redirect($url);  // ALWAYS redirect to root page&#xA;    }&#xA;&#xA;    return $this-&amp;gt;renderTemplate('_special/emailtaken', [&#xA;        'email' =&amp;gt; $userToProcess-&amp;gt;unverifiedEmail&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A clean way to achieve this is: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Handle it entirely on your own -&gt; custom controller + custom service, send the mail manually&lt;/li&gt;&#xA;&lt;li&gt;Create a custom route to you'll only take care about activating them and overwrite the &lt;code&gt;actionVerifyEmail&lt;/code&gt; - unfortunately you can't replace the controller via Dependency Injection&lt;/li&gt;&#xA;&lt;li&gt;Create a feature request and hope Pixel and Tonic will be kind enough to create a config variable / event to overwrite this value&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-07T08:22:41.860" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27199" PostTypeId="1" AcceptedAnswerId="27201" CreationDate="2018-08-07T08:32:43.727" Score="1" ViewCount="518" Body="&lt;p&gt;It is weird that I can delete some entires in the app but some I can't. When selecting specific entry to delete, I don't see the option to delete it. I only have &quot;edit entry&quot; and &quot;view entry&quot;. In some other entries I have the &quot;delete...&quot; option as well.&#xA;Why is that?&lt;/p&gt;&#xA;" OwnerUserId="8677" LastActivityDate="2018-08-07T10:56:18.490" Title="Unable to delete some entries" Tags="&lt;entries&gt;&lt;entry&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27200" PostTypeId="2" ParentId="27183" CreationDate="2018-08-07T09:48:04.663" Score="1" Body="&lt;p&gt;My headings were created alphabetically but Z-A not A-Z, I solved by modifying the dom elements and then clicking save.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var source = document.querySelector('.cs-sidebar .sources');&#xA;var divs = [...document.querySelectorAll('.cs-sidebar .sources .customize-sources-item')];&#xA;divs = divs.slice(0).reverse();&#xA;source.innerHTML = '';&#xA;for(let i = 0; i &amp;lt; divs.length; i++){&#xA;  source.appendChild(divs[i]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-08-07T09:48:04.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27201" PostTypeId="2" ParentId="27199" CreationDate="2018-08-07T10:56:18.490" Score="1" Body="&lt;p&gt;You can define different permissions in Craft CMS, if you are not admin its likely someone restricts your access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you can't delete entries in a section of type single - those entries will always exist&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-07T10:56:18.490" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27202" PostTypeId="1" AcceptedAnswerId="27206" CreationDate="2018-08-07T13:13:11.910" Score="2" ViewCount="737" Body="&lt;p&gt;I have a plugin that wants to set a value for an entries existing matrix field, from a form on the font-end. Think of it like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Movies (matrix field)&#xA;  Movie (matrix block)&#xA;    Name (plain text)&#xA;    votes (plain text)&#xA;  Movie (matrix block)&#xA;    Name (plain text)&#xA;    votes (plain text)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to increment the number of votes when a user clicks a button for a particular movie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried all sorts of methods, but being pretty novice at php I just can't seem to grasp how Craft is storing everything. I just keep getting back an array of ALL fields on the site, rather than the specific ones I'm searching for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All existing SE questions seem to relate to adding new rows, I just want to edit an existing one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normal fields are (from existing code) along the lines of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$currentVotes = $movie-&amp;gt;getFieldValue('votes');&#xA;$movie-&amp;gt;setFieldValue('votes', $currentVotes + 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which seems rather simple. What is the Matrix version of that?&lt;/p&gt;&#xA;" OwnerUserId="7522" LastActivityDate="2018-08-07T16:33:41.177" Title="Get and Set existing matrix field data in a plugin" Tags="&lt;plugin-development&gt;&lt;matrix&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27204" PostTypeId="1" CreationDate="2018-08-07T13:53:42.773" Score="1" ViewCount="85" Body="&lt;p&gt;Lets say i have table field with product technical specification - two columns, one for feature name, one for feature value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feature name (for example - &quot;weight&quot;) needs to be translated across various languages. Feature value needs to always stay the same (for xample - &quot;1kg&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be achieved?&lt;/p&gt;&#xA;" OwnerUserId="8366" LastActivityDate="2018-08-07T14:09:33.753" Title="table field - make one culumn translatable, other common for all languages" Tags="&lt;localization&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27205" PostTypeId="2" ParentId="27204" CreationDate="2018-08-07T14:09:33.753" Score="2" Body="&lt;p&gt;If there’s a predetermined set of feature names, then you could translate them using &lt;a href=&quot;https://docs.craftcms.com/v3/static-translations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;static message translations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for row in entry.myTableField %}&#xA;  &amp;lt;dt&amp;gt;{{ row.featureName|t }}&amp;lt;/dt&amp;gt;&#xA;  &amp;lt;dd&amp;gt;{{ row.featureValue }}&amp;lt;/dd&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If new products will always be introducing new feature names, then that might become impractical, as you’d be constantsly adding new values to your translation file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could set up a custom translation message source + category in &lt;code&gt;config/app.php&lt;/code&gt; that pulls translations in from a separate, translatable Table field on a Global Set, for instance, but that could be overkill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is to use Verbb’s &lt;a href=&quot;https://verbb.io/craft-plugins/super-table/features&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table&lt;/a&gt; plugin, which will let you mark certain fields as translatable.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-07T14:09:33.753" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27206" PostTypeId="2" ParentId="27202" CreationDate="2018-08-07T14:40:50.733" Score="3" Body="&lt;p&gt;Since Matrix blocks are elements as well it's the same&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your form could be&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set movies = entry.movies.all() %}&#xA;{% for movie in movies %}&#xA;    &amp;lt;form&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; value=&quot;plugin/controller/function&quot; name=&quot;action&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; value=&quot;{{ movie.id }}&quot; name=&quot;id&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Vote this movie&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your controller&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionSave(){&#xA;    $id = Craft::$app-&amp;gt;getRequest()-&amp;gt;getRequiredBodyParam('id');&#xA;    $matrixBlock = Craft::$app-&amp;gt;getMatrix()-&amp;gt;getBlockById($id);&#xA;    if($matrixBlock === null){&#xA;        throw new ElementNotFoundException('Could not find Block with ID ' . $id);&#xA;    }&#xA;&#xA;    $matrixBlock-&amp;gt;setFieldValue('votes', $matrixBlock-&amp;gt;getFieldValue('votes')+1);&#xA;    if(!Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($matrixBlock)){&#xA;        // handle an error&#xA;    }&#xA;&#xA;    return $this-&amp;gt;redirectToPostedUrl();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-07T16:33:41.177" LastActivityDate="2018-08-07T16:33:41.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27208" PostTypeId="1" CreationDate="2018-08-07T21:17:06.467" Score="1" ViewCount="663" Body="&lt;p&gt;Inside of a modal window I'm loading a form template via jQuery &lt;code&gt;.load&lt;/code&gt;. For reasons I don't know, the &lt;code&gt;{% js %}&lt;/code&gt; tags that need to come with the form template are not being loaded, even though the &lt;code&gt;{% js %}&lt;/code&gt; tag is placed at the bottom of the loaded partial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the loading code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% js %}&#xA;  MicroModal.init()&#xA;&#xA;  $(document).ready(function() {&#xA;    $('.trigger').click(function() {&#xA;      event.preventDefault();&#xA;&#xA;      MicroModal.show('addressModal');&#xA;      $('.c-modal__content').load('account/profile/billing/add #newAddressForm');&#xA;    });&#xA;  });&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On click a modal will open, retrieve the template, look for the &lt;code&gt;#newAddressForm&lt;/code&gt; ID element, and an address form template  will load within it. The HTML part of the form loads fine, but no JS is brought with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The loaded partial template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; id=&quot;newAddressForm&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/customer-addresses/save&quot;&amp;gt;&#xA;  {{ csrfInput() }}&#xA;&#xA;  {% include &quot;shop/_inc/addresses/form&quot; %}&#xA;&#xA;  &amp;lt;button type=&quot;submit&quot;&amp;gt;Save&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And lastly, the &lt;code&gt;{% include %}&lt;/code&gt; has the form fields and &lt;code&gt;{% js %}&lt;/code&gt; tag inside.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reiterate, the HTML of the form loads fine. The JS does not come with it. I'm not sure if this is an issue with Twig, Craft, or jQuery. Help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2281" LastEditorUserId="2281" LastEditDate="2018-08-09T17:14:52.813" LastActivityDate="2018-08-09T18:26:52.030" Title="Template loads via jQuery .load(), but no {% js %} tags are included" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27209" PostTypeId="1" CreationDate="2018-08-07T21:36:27.427" Score="1" ViewCount="69" Body="&lt;p&gt;We have a site that has relied heavily on the use of matrix fields to act as a content builder for several pages on our site. We are now in the process of localizing the content, and have set up language based site groups to utilize group based translation methods for fields in the matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has worked fine, and would work if the content remained consistent throughout the various sites, but we're now seeing the need to allow for some site specific content in certain places. A product may not be available in a certain region – so promoting it doesn't make sense, or a holiday may only be relevant in the US. Whatever the case may be, matrix fields and their translation methods are proving to be limiting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to reduce the amount of redundant content that needs to be managed (via language based site groups) while allowing content to be flexible enough to target specific regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an idea on how to solve this, but want to get some feedback and see if there are any good alternatives.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a &lt;strong&gt;Homepage&lt;/strong&gt; single entry. We want the US market to display a unique content block in addition to what other English sites show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could create a section called &lt;strong&gt;Content Blocks&lt;/strong&gt; that has an &lt;strong&gt;entry type&lt;/strong&gt; that matches our current matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each entry in &lt;strong&gt;Content Blocks&lt;/strong&gt; would be pulled into the &lt;strong&gt;Homepage&lt;/strong&gt; entry via an entries field. The entries field would act as our list of components – much like in a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default state of the &lt;strong&gt;Content Blocks&lt;/strong&gt; entry would be disabled for each site, and translations would be based on site groups (language). Entries added to a site's &lt;strong&gt;Homepage&lt;/strong&gt; entries field would display each related entry (assuming it was enabled for a given site), allowing translations to be made before content is published.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would require some additional planning from content authors, but could prove to be more flexible and resilient. &lt;strong&gt;Content Blocks&lt;/strong&gt; could be reused between various sections, or toggled between as different holidays occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also see this getting out of control with many unused or poorly named entries living in &lt;strong&gt;Content Blocks&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an added bonus, this setup might allow us to integrate with a 3rd party translation service to import content translations. Something that seemed impossible when dealing with matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are there any unforeseen issues with a setup like this? Specifically thinking about performance.&lt;/li&gt;&#xA;&lt;li&gt;Are there better alternatives or something that we're not thinking about?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4739" LastActivityDate="2018-08-07T21:36:27.427" Title="Idea for matrix alternative for multisite setup. Feedback needed!" Tags="&lt;matrix&gt;&lt;localization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27210" PostTypeId="2" ParentId="10055" CreationDate="2018-08-08T02:27:35.157" Score="3" Body="&lt;p&gt;In craft 3 it appears you can access it by doing the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.systemSettings.email.fromEmail }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2018-08-08T02:27:35.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27213" PostTypeId="1" CreationDate="2018-08-08T15:33:05.397" Score="3" ViewCount="1232" Body="&lt;p&gt;My task queue (is that what it's called?) is filled with literally hundreds of &quot;Deleting Stale Template Caches&quot; and every day there seem to be new ones. Along there are also resaving entries tasks and updating URIs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the amount of tasks, they don't seem to be going down AT ALL. What's the suggestion here?&lt;/p&gt;&#xA;" OwnerUserId="47" LastActivityDate="2019-12-06T03:15:58.713" Title="Tons of Deleting Stale Template caches" Tags="&lt;craft3&gt;&lt;tasks&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27214" PostTypeId="2" ParentId="27213" CreationDate="2018-08-08T15:47:07.187" Score="2" Body="&lt;p&gt;Bump up the PHP Memory limit and max execution time, then change the 0 in the first failed task to 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that go into craft, click the tasks and hit &quot;try again&quot;&lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-08-08T15:47:07.187" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27215" PostTypeId="1" CreationDate="2018-08-08T15:51:25.773" Score="1" ViewCount="33" Body="&lt;p&gt;Is there a way to limit how many columns/fields a user is allowed to drag/add into the form builder. Currently, they are allowed to line up 4 in a row. I would like to limit that to 2. But I would specifically like to restrict the Form Builder so unfortunately fixing this via templates/CSS won't work.&lt;/p&gt;&#xA;" OwnerUserId="3614" LastActivityDate="2018-08-08T15:51:25.773" Title="FreeForm - Limit number of fields/columns in Form Builder" Tags="&lt;plugin-freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27216" PostTypeId="2" ParentId="1439" CreationDate="2018-08-08T19:53:10.080" Score="1" Body="&lt;p&gt;For Craft CMS 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.status('pending, live').section('sectionName').relatedTo(category).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7082" LastActivityDate="2018-08-08T19:53:10.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27217" PostTypeId="2" ParentId="27192" CreationDate="2018-08-08T20:23:11.327" Score="2" Body="&lt;p&gt;Have you tried to use a absolute path without the «/» at the beginning? (or actually a relative one from the webroot…) &lt;code&gt;&amp;lt;img src=&quot;assets/images/site/logo.png&quot; /&amp;gt;&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This did the trick in my case.&lt;/p&gt;&#xA;" OwnerUserId="8682" LastActivityDate="2018-08-08T20:23:11.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27218" PostTypeId="2" ParentId="26395" CreationDate="2018-08-08T21:13:09.257" Score="1" Body="&lt;p&gt;Okay so the site hasn't gone down in 2 days, so fingers crossed that we actually fixed this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Brad's initial comment, we noticed that the &lt;code&gt;schemaVersion&lt;/code&gt; key was missing from that plugin's class file. We went ahead and added one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* this was there */&#xA;public function getVersion()&#xA;{&#xA;  return '1.0.0';&#xA;}&#xA;&#xA;/* We went ahead and added this */&#xA;public function getSchemaVersion()&#xA;{&#xA;  return '1.0.0';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now since the schema version === the current version, it no longer throws errors.&lt;/p&gt;&#xA;" OwnerUserId="218" LastEditorUserId="218" LastEditDate="2019-04-18T15:10:28.053" LastActivityDate="2019-04-18T15:10:28.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27219" PostTypeId="1" AcceptedAnswerId="27221" CreationDate="2018-08-08T21:59:34.210" Score="2" ViewCount="722" Body="&lt;p&gt;I'm just working on a dev site and my Plugin install buttons are gone. I'm not sure how long they've been gone either, I don't really know where to start to debug it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No errors in the console and I have run &lt;code&gt;composer update&lt;/code&gt; to make sure I'm all up to date, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an image of where the 'install' button should be in the plugin store. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kINRd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kINRd.png&quot; alt=&quot;Top corner of a plugin details (where button should be)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-08T22:39:52.043" Title="Plugin Store install buttons are not visible" Tags="&lt;craft3&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27220" PostTypeId="2" ParentId="27213" CreationDate="2018-08-08T22:36:47.470" Score="0" Body="&lt;p&gt;The process for debugging stalled jobs in Craft 3 is 90% the same as debugging stalled tasks in Craft 2.  Still needs to be updated for Craft 3, but you can use this as a starting point: &lt;a href=&quot;https://craftcms.com/support/stuck-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's even a section for the &quot;Deleting Stale Template Caches&quot; task: &lt;a href=&quot;https://craftcms.com/support/stuck-tasks#debugging-stuck-delete-stale-template-caches-tasks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/support/stuck-tasks#debugging-stuck-delete-stale-template-caches-tasks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-08T22:36:47.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27221" PostTypeId="2" ParentId="27219" CreationDate="2018-08-08T22:39:52.043" Score="4" Body="&lt;p&gt;Most likely you have the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#allowupdates&quot; rel=&quot;nofollow noreferrer&quot;&gt;allowUpdates&lt;/a&gt; config setting in your &lt;code&gt;config/general.php&lt;/code&gt; file set to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-08T22:39:52.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27222" PostTypeId="1" CreationDate="2018-08-09T05:41:00.313" Score="1" ViewCount="71" Body="&lt;p&gt;Currently, I am doing this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$responses = array(&#xA;        &quot;E&quot; =&amp;gt; 0,&#xA;        &quot;I&quot; =&amp;gt; 0);&#xA;&#xA;foreach ($_POST as $key =&amp;gt; $value) {&#xA;    if (strlen($value) == 1) {&#xA;        ++$responses[$value];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use craft()-&gt;requests for this? I tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach (craft()-&amp;gt;request-&amp;gt;getPost() as $key =&amp;gt; $value) {&#xA;    if (strlen($value) == 1) {&#xA;        ++$responses[$value];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this did not seem to work.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2018-08-09T09:07:31.303" Title="Is there a safer way to Cycle Through Post Data in Craft" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27223" PostTypeId="2" ParentId="27222" CreationDate="2018-08-09T09:07:31.303" Score="3" Body="&lt;p&gt;I wouldn't consider it as good practice to do what you want, there are good reasons why something like this is not possible by default and why all functions to get all parameters are private.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better way is to send your parameters inside an array and fetch this or you can create an array of all possible parameters and loop it&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$secureParameters = ['A', 'B', 'C'];&#xA;$request = Craft::$app-&amp;gt;getRequest();&#xA;$values = [];&#xA;foreach($secureParameters as $key){&#xA;    $values[$key] = $request-&amp;gt;getBodyParam($key);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really don't care about receiving unexpected parameters and raising exceptions you can also loop your &lt;code&gt;$_POST&lt;/code&gt; directly &lt;code&gt;foreach($_POST as $key =&amp;gt; $v){&lt;/code&gt; and fetch the &lt;code&gt;$request-&amp;gt;getBodyParam($key)&lt;/code&gt; at least&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-09T09:07:31.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27225" PostTypeId="1" AcceptedAnswerId="27256" CreationDate="2018-08-09T11:32:23.873" Score="0" ViewCount="572" Body="&lt;p&gt;In the middle of upgrading a C2 site to C3. Everything went fine, including the step where you visit the control panel to complete the update, and now I’m at the login screen. But when I try to login, it flickers the loading icon for a second then stops doing anything. There’s a jQuery error in the console:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST http://domain.test/index.php?p=admin/actions/users/login 500 (Internal Server Error)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;web.log says this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-08-09 11:09:37 [127.0.0.1][-][-][error][TypeError] TypeError: Argument 1 passed to craft\helpers\StringHelper::toLowerCase() must be of the type string, null given, called in /Users/darylknight/Sites/domain/vendor/craftcms/cms/src/helpers/Db.php on line 450 and defined in /Users/darylknight/Sites/domain/vendor/craftcms/cms/src/helpers/StringHelper.php:738&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea how I could go about debugging this? I upgraded a similar site yesterday with no issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack trace below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-08-09 13:07:26 [127.0.0.1][-][-][error][TypeError] TypeError: Argument 1 passed to craft\helpers\StringHelper::toLowerCase() must be of the type string, null given, called in /Users/user/Sites/domain/vendor/craftcms/cms/src/helpers/Db.php on line 450 and defined in /Users/user/Sites/domain/vendor/craftcms/cms/src/helpers/StringHelper.php:738&#xA;Stack trace:&#xA;#0 /Users/user/Sites/domain/vendor/craftcms/cms/src/helpers/Db.php(450): craft\helpers\StringHelper::toLowerCase(NULL)&#xA;#1 /Users/user/Sites/domain/vendor/craftcms/cms/src/base/Field.php(395): craft\helpers\Db::parseParam('content.field_o...', Array)&#xA;#2 /Users/user/Sites/domain/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1624): craft\base\Field-&amp;gt;modifyElementsQuery(Object(craft\elements\db\UserQuery), Object(craft\elements\db\UserQuery))&#xA;#3 /Users/user/Sites/domain/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1062): craft\elements\db\ElementQuery-&amp;gt;_joinContentTable('craft\\elements\\...')&#xA;#4 /Users/user/Sites/domain/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery-&amp;gt;prepare(Object(craft\db\mysql\QueryBuilder))&#xA;#5 /Users/user/Sites/domain/vendor/yiisoft/yii2/db/Query.php(146): yii\db\QueryBuilder-&amp;gt;build(Object(craft\elements\db\UserQuery))&#xA;#6 /Users/user/Sites/domain/vendor/yiisoft/yii2/db/Query.php(274): yii\db\Query-&amp;gt;createCommand(Object(craft\db\Connection))&#xA;#7 /Users/user/Sites/domain/vendor/craftcms/cms/src/db/Query.php(177): yii\db\Query-&amp;gt;one(NULL)&#xA;#8 /Users/user/Sites/domain/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1193): craft\db\Query-&amp;gt;one(NULL)&#xA;#9 /Users/user/Sites/domain/vendor/craftcms/cms/src/services/Users.php(175): craft\elements\db\ElementQuery-&amp;gt;one()&#xA;#10 /Users/user/Sites/domain/vendor/craftcms/cms/src/controllers/UsersController.php(128): craft\services\Users-&amp;gt;getUserByUsernameOrEmail('daryl@codeknigh...')&#xA;#11 [internal function]: craft\controllers\UsersController-&amp;gt;actionLogin()&#xA;#12 /Users/user/Sites/domain/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#13 /Users/user/Sites/domain/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#14 /Users/user/Sites/domain/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller-&amp;gt;runAction('login', Array)&#xA;#15 /Users/user/Sites/domain/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('login', Array)&#xA;#16 /Users/user/Sites/domain/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('users/login', Array)&#xA;#17 /Users/user/Sites/domain/vendor/craftcms/cms/src/web/Application.php(538): craft\web\Application-&amp;gt;runAction('users/login', Array)&#xA;#18 /Users/user/Sites/domain/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#19 /Users/user/Sites/domain/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#20 /Users/user/Sites/domain/public/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#21 /Users/user/.composer/vendor/laravel/valet/server.php(147): require('/Users/user...')&#xA;#22 {main}&#xA;2018-08-09 13:07:26 [127.0.0.1][-][-][info][application] $_GET = [&#xA;    'p' =&amp;gt; 'admin/actions/users/login'&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2018-08-09T13:08:58.227" LastActivityDate="2018-08-11T08:12:38.173" Title="Upgrading C2 to C3 - TypeError: Argument 1 passed to craft\helpers\StringHelper::toLowerCase() must be of the type string" Tags="&lt;craft3&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2018-08-13T20:26:55.290" ContentLicense="CC BY-SA 4.0" />
  <row Id="27227" PostTypeId="1" CreationDate="2018-08-09T13:45:28.813" Score="1" ViewCount="23" Body="&lt;p&gt;Currently I am using Sprout Email 2.4.7 to send newsletter mailings to mailchimp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to prefill email.fromName, email.fromEmail, email.replyTo with default values so these don't need to be entered every time a new mailing is being set up in the Craft 2 cp section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting this in the email template file does not work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set email.fromName = 'My Company' %}&#xA;{% set email.fromEmail = 'john@doe.com' %}&#xA;{% set email.replyTo = 'john@doe.com' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas how this could be done in a clean way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;" OwnerUserId="7751" LastActivityDate="2018-08-09T13:45:28.813" Title="Sprout Email with Mailchimp" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27229" PostTypeId="2" ParentId="27208" CreationDate="2018-08-09T14:39:28.420" Score="2" Body="&lt;p&gt;In Craft 3, the &lt;code&gt;{% js %}&lt;/code&gt; tag places the javascript code just before the closing &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag in the rendered &lt;code&gt;HTML&lt;/code&gt; document by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the rendered &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag will not be in the &lt;code&gt;#newAddressForm&lt;/code&gt; element, but will be rendered just before the closing &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you are loading the rendered template using jQuery's &lt;code&gt;.load()&lt;/code&gt; function and specifying the &lt;code&gt;#newAddressForm&lt;/code&gt; element, the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag will be excluded from the injected code as it isn’t within the &lt;code&gt;#newAddressForm&lt;/code&gt; element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to inline the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag within the Twig template rather than using the &lt;code&gt;{% js %}&lt;/code&gt; tag to include it. That way you can ensure that the code will be included in the &lt;code&gt;#newAddressForm&lt;/code&gt; element as you need it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details of the &lt;code&gt;{% js %}&lt;/code&gt; tag can be found in the Craft 3 docs: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/js.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/tags/js.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="153" LastEditDate="2018-08-09T18:26:52.030" LastActivityDate="2018-08-09T18:26:52.030" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="27230" PostTypeId="1" AcceptedAnswerId="27232" CreationDate="2018-08-09T15:12:23.573" Score="1" ViewCount="175" Body="&lt;p&gt;I've been trying this for a while now, so might have read this before. Sorry about that, I'm struggling really hard to get this right. At first I tried (wrongly) with the eager load features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two channels: &lt;code&gt;events&lt;/code&gt; and &lt;code&gt;shows&lt;/code&gt;. In the &lt;code&gt;events&lt;/code&gt; you can select a &lt;code&gt;show&lt;/code&gt; with an entry field. The shows items have a category attached. I need to filter the &lt;code&gt;events&lt;/code&gt;, based on the category of the &lt;code&gt;show&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like &lt;code&gt;events with shows where show has category 1&lt;/code&gt;. They told me on the slack channel to join the tables I needed, but cannot manage to do it.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-08-09T20:40:28.463" Title="Joining sections (Channel) to query based on a related item attribute" Tags="&lt;entries&gt;&lt;categories&gt;&lt;mysql&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27231" PostTypeId="1" AcceptedAnswerId="27261" CreationDate="2018-08-09T16:35:11.017" Score="1" ViewCount="96" Body="&lt;p&gt;I am trying to build a query to fetch some entries which I want filter on a table field between multiple values. The table field is &quot;filterTestWidth&quot; and has 1 col named &quot;size&quot; (number type). There are multiple entries with multiple values in col1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.entries({&#xA;    &quot;section&quot;: &quot;catalog&quot;,&#xA;    &quot;filterTestWidth&quot;: [&#xA;        &quot;and&quot;,&#xA;        &quot;&amp;gt; 180&quot;,&#xA;        &quot;&amp;lt; 190&quot;&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunate the Craft manual is limited on this subject. Does anyone know a more detailed article about element criteria?&lt;/p&gt;&#xA;" OwnerUserId="8332" LastEditorUserId="8332" LastEditDate="2018-08-10T08:45:42.970" LastActivityDate="2018-08-11T17:42:17.907" Title="Element criteria with a table field" Tags="&lt;elementcriteriamodel&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27232" PostTypeId="2" ParentId="27230" CreationDate="2018-08-09T20:40:28.463" Score="2" Body="&lt;p&gt;Not sure about doing this in a single query. Referencing this doc page section, &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/relations.html#templating&lt;/a&gt;, you can make use of &lt;code&gt;relatedTo()&lt;/code&gt; by passing in IDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you know the ID of the category already and that ID is &lt;code&gt;1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set showIds = craft.entries.section('shows').relatedTo(1).ids() %}&#xA;&#xA;{% set entries = craft.entries.section('events').relatedTo(showIds).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;relatedTo()&lt;/code&gt; method doesn't care if the IDs are from Entries or Categories, or even Users and Tags. They're all Elements stored in the &lt;code&gt;elements&lt;/code&gt; table so they have unique IDs.&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2018-08-09T20:40:28.463" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27233" PostTypeId="1" AcceptedAnswerId="27236" CreationDate="2018-08-09T22:16:58.630" Score="1" ViewCount="1294" Body="&lt;p&gt;I'm a total Craft newbie, so I hope this question isn't ridiculous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to see a controller / action work in my new module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have src/controllers/ScrapeController.php as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace mycompany\mymodule\controllers;&#xA;&#xA;use craft\web\Controller;&#xA;&#xA;class ScrapeController extends Controller {&#xA;&#xA;    public function actionPush()&#xA;    {&#xA;        return $this-&amp;gt;asJson([&#xA;            'success' =&amp;gt; TRUE,&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I just want to see this URL work: &lt;a href=&quot;http://localhost/my-module/scrape/push&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/my-module/scrape/push&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead I get: &lt;strong&gt;HTTP 404 - Template not found&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I'm missing something really dumb here. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2018-08-10T05:18:49.230" Title="&quot;Template Not Found&quot; error when trying to access a module controller action" Tags="&lt;craft3&gt;&lt;controller&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27234" PostTypeId="1" CreationDate="2018-08-09T23:22:29.260" Score="1" ViewCount="55" Body="&lt;p&gt;I need to figure out how to close out the columns if it equals 12 and then open a new row. I have a Matrix field set up with rows, but it needs to break with a new row if the columns equal 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="8619" LastEditorUserId="57" LastEditDate="2018-08-10T18:10:02.240" LastActivityDate="2018-08-10T18:10:02.240" Title="Close bootstrap row and start a new row Matrix" Tags="&lt;craft3&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27236" PostTypeId="2" ParentId="27233" CreationDate="2018-08-10T05:18:49.230" Score="3" Body="&lt;p&gt;You'll either need to use the action url &lt;code&gt;http://localhost/actions/my-module/scrape/push&lt;/code&gt; since only those will route to controllers by default or create a custom route to your controller &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-10T05:18:49.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27237" PostTypeId="2" ParentId="27234" CreationDate="2018-08-10T08:04:14.390" Score="1" Body="&lt;p&gt;You could track the total used columns in a var and check if its less than 12.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set col_count = 0 %}&#xA;{% for item in items %}&#xA;    {% switch item.type %}&#xA;        {% case &quot;value1&quot; %}&#xA;            {% set col_size = 4 %}&#xA;        {% case &quot;value2&quot; %}&#xA;            {% set col_size = 6 %}&#xA;    {% endswitch %}&#xA;&#xA;    {% if not loop.first and (col_count + col_size) &amp;gt; 12 %}&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% set col_count = 0 %}&#xA;    {% endif %}&#xA;&#xA;    {% if col_count == 0 %}&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% set col_count = col_count + col_size %}&#xA;&#xA;    &amp;lt;div class=&quot;column small-{{ col_size }}&quot;&amp;gt;&#xA;        {{ item.title }}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% if loop.last %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8332" LastActivityDate="2018-08-10T08:04:14.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27241" PostTypeId="1" CreationDate="2018-08-10T18:08:31.893" Score="1" ViewCount="387" Body="&lt;p&gt;Is there a 'latest greatest' tool that I can add that has ongoing logging of disable/enable and delete/update activity of users or entries, etc..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good way to track this information before I add on a logging tool?  In other words, is this information somewhere in the mysql database anyways?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the current dashboard shows information related to entry creation, but, we have some new users that we are training and they have made some mistakes and we need to track those mistakes down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks!&lt;/p&gt;&#xA;" OwnerUserId="1006" LastActivityDate="2018-08-13T03:35:28.327" Title="Can I find log activity of who deleted a user and who edited an entry?" Tags="&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27242" PostTypeId="1" AcceptedAnswerId="27259" CreationDate="2018-08-10T18:29:58.803" Score="3" ViewCount="7060" Body="&lt;p&gt;Is there an available variable for the primary site URL in a multi-site CraftCMS setup? I need a variable that I can attach to my logo that will take the user back to the primary site. I could hard code this, however, the URL needs to be environment aware. For example, on my local environment, the link should be &lt;a href=&quot;https://www.mysite.local&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mysite.local&lt;/a&gt; and when on development, the link should be &lt;a href=&quot;https://www.mysite.dev&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mysite.dev&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="9" LastEditDate="2018-08-13T21:45:56.963" LastActivityDate="2018-08-13T23:00:28.780" Title="How do I get the primary site URL?" Tags="&lt;multi-site&gt;&lt;siteurl&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27243" PostTypeId="2" ParentId="17200" CreationDate="2018-08-10T18:38:06.000" Score="1" Body="&lt;p&gt;Having the need for a similar setup to yourself, I came up with a more efficient example below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('news').status('live').limit(null).ids() %}&#xA;&#xA;{% set parentSlug = craft.request.getSegment(1) %}&#xA;{% set catParent = craft.categories.slug(parentSlug).first() %}&#xA;&#xA;{% set categories = craft.categories.relatedTo({ sourceElement: entryIds }).groupId(1).limit(null).descendantOf(catParent).find() %}&#xA;&#xA;{% nav category in categories %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;a href=&quot;#&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;        {% ifchildren %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endifchildren %}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7177" LastActivityDate="2018-08-10T18:38:06.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27244" PostTypeId="1" AcceptedAnswerId="27283" CreationDate="2018-08-10T18:44:22.677" Score="1" ViewCount="347" Body="&lt;p&gt;I have a structured group of pages in a static channel that I would like to display without &quot;static&quot; in the URL and show the parent URI. This is my structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;patients-visitors&#xA;---- our-stories&#xA;-------- share-your-story&#xA;support-groups&#xA;---- healing-yoga&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of these entries are in a &quot;static&quot; channel. When I roll over the link in the Control Panel, my link look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://www.website.com/static/patient-visitors&#xA;---- https://www.website.com/static/our-stories&#xA;-------- https://www.website.com/static/share-your-story&#xA;https://www.website.com/static/support-groups&#xA;---- https://www.website.com/static/healing-yoga&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want the links to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://www.website.com/patients-visitors&#xA;---- https://www.website.com/patients-visitors/our-stories&#xA;-------- https://www.website.com/patients-visitors/our-stories/share-your-story&#xA;https://www.website.com/support-groups&#xA;---- https://www.website.com/support-groups/healing-yoga&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2018-08-13T17:41:21.530" LastActivityDate="2018-08-13T20:35:40.197" Title="How do I remove segment 1 in my URL AND get the parent URI?" Tags="&lt;structure&gt;&lt;segments&gt;&lt;parents&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27245" PostTypeId="2" ParentId="27242" CreationDate="2018-08-10T18:55:47.677" Score="5" Body="&lt;p&gt;&lt;code&gt;{{ siteUrl }}&lt;/code&gt; should do the trick for you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-10T18:55:47.677" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27246" PostTypeId="1" AcceptedAnswerId="27247" CreationDate="2018-08-10T20:14:13.703" Score="4" ViewCount="581" Body="&lt;p&gt;In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post.  I got this far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gets five posts sharing the current post’s category, &lt;em&gt;including&lt;/em&gt; the current post if it happens to be recently posted.  How do I exclude the current post from the returned results, without just dropping it from the five so I’m only left with four?&lt;/p&gt;&#xA;" OwnerUserId="8690" LastActivityDate="2018-08-16T20:59:02.283" Title="Get related posts excluding current post in Craft 3" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27247" PostTypeId="2" ParentId="27246" CreationDate="2018-08-10T20:32:57.087" Score="7" Body="&lt;p&gt;To exclude the current post use the current post's id with a &lt;em&gt;&quot;not&quot;&lt;/em&gt; clause in the &lt;code&gt;id&lt;/code&gt; query param.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for relatedPost in craft.entries.relatedTo(entry.newsCategory).id('not ' ~ entry.id).limit(5).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastEditorUserId="331" LastEditDate="2018-08-16T20:59:02.283" LastActivityDate="2018-08-16T20:59:02.283" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27248" PostTypeId="1" AcceptedAnswerId="27249" CreationDate="2018-08-10T21:59:07.313" Score="2" ViewCount="1956" Body="&lt;p&gt;I was looking for a way to clear the “template caches” and “compiled templates” from the CLI, as I want to automatically do this after every auto-deploy of the site I've created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this I was looking into the &lt;code&gt;craft&lt;/code&gt; binary and its &lt;code&gt;cache/list&lt;/code&gt; command. However, when running &lt;code&gt;./craft cache/list&lt;/code&gt; it only returns me &lt;code&gt;cache (yii\caching\FileCache)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This felt kind of strange to me, as I was expecting a list similar to the one to be seen in the admin at the URL &lt;code&gt;/admin/utilities/clear-caches&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9Za0X.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Za0X.png&quot; alt=&quot;List of possible caches, as shown in the admin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So hereby I'm wondering if it's possible to clear any of these caches show above from the CLI. Or is the &lt;code&gt;cache/clear&lt;/code&gt; command for something else that I'm not aware of?&lt;/p&gt;&#xA;" OwnerUserId="8691" LastActivityDate="2018-08-10T22:15:38.757" Title="Clear template cache from the CLI?" Tags="&lt;craft3&gt;&lt;cache&gt;&lt;cli&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27249" PostTypeId="2" ParentId="27248" CreationDate="2018-08-10T22:15:38.757" Score="3" Body="&lt;p&gt;Craft-Scripts will do this for you: &lt;a href=&quot;https://github.com/nystudio107/craft-scripts#clear_cachessh&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts#clear_cachessh&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see what it does via the source: &lt;a href=&quot;https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &lt;code&gt;cache/clear&lt;/code&gt; this clear's Yii2's cache... which Craft CMS uses for almost nothing. Template Caches are always in the db, compiled templates are always cached on disk as files, and so on.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-10T22:15:38.757" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27250" PostTypeId="2" ParentId="27241" CreationDate="2018-08-10T23:07:37.747" Score="1" Body="&lt;p&gt;Craft only stores minimum audit information in the database... mainly just when a row was created and last updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on Craft 2, there is a deprecated &lt;a href=&quot;https://github.com/boboldehampsink/auditlog&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audit Log&lt;/a&gt; plugin which might do what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the author has intentions of porting it to Craft 3, but there is a commercial plugin called &lt;a href=&quot;https://github.com/sjelfull/craft-audit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audit&lt;/a&gt; that is in the Craft Plugin Store.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-08-13T03:35:28.327" LastActivityDate="2018-08-13T03:35:28.327" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27251" PostTypeId="1" AcceptedAnswerId="27254" CreationDate="2018-08-11T00:45:58.747" Score="0" ViewCount="41" Body="&lt;p&gt;It doesn't look possible but can you capture partial amounts using the Craft admin panel?  E.g. Authorize $1000, then capture $700.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when performing Captures in the Stripe panel, these transactions do not show in Craft in the Order Transactions box.  This looks like a bug to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last, if we can't perform partial captures in Craft and need to do it in Stripe, how can we mark Orders as paid?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-08-11T04:42:26.197" Title="Commerce Stripe Authorize Only - Capture partial amount in Craft admin panel" Tags="&lt;plugin-craftcommerce&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27252" PostTypeId="2" ParentId="20042" CreationDate="2018-08-11T00:50:13.767" Score="0" Body="&lt;p&gt;Late answer but this is currently possible (Aug 2018).  Make sure you do have your Stripe payment method set to 'Authorize Only (Manually Capture)'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to your order, and you'll find a Capture button in the Transactions box at the bottom.  Just hit that button anytime to charge the card.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-08-11T00:50:13.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27254" PostTypeId="2" ParentId="27251" CreationDate="2018-08-11T04:42:26.197" Score="1" Body="&lt;p&gt;As of Commerce 2.0.0-beta.7,  partial capture is not yet supported. Look out for it in the next release.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-08-11T04:42:26.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27256" PostTypeId="2" ParentId="27225" CreationDate="2018-08-11T08:12:38.173" Score="0" Body="&lt;p&gt;This was a bug fixed in commit &lt;a href=&quot;https://github.com/craftcms/cms/commit/8e75fccb3fddf9490a5db8b360979d374bbceb15&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/8e75fccb3fddf9490a5db8b360979d374bbceb15&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2018-08-11T08:12:38.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27257" PostTypeId="1" CreationDate="2018-08-11T14:46:57.043" Score="0" ViewCount="499" Body="&lt;p&gt;I have a module with a route that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/actions/module/controller/action&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set up a custom route within my module so I can send people to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://localhost/module/controller/action&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft 3, but so far loving it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2018-08-11T16:54:28.770" Title="Removing &quot;action&quot; from a module's route. Is it possible?" Tags="&lt;craft3&gt;&lt;routing&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27258" PostTypeId="2" ParentId="27257" CreationDate="2018-08-11T16:54:28.770" Score="1" Body="&lt;p&gt;Yep, you can add the route in &lt;code&gt;config/routes.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-pho prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    'custom/route' =&amp;gt; 'module/controller/action',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(See &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-11T16:54:28.770" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27259" PostTypeId="2" ParentId="27242" CreationDate="2018-08-11T17:09:41.870" Score="7" Body="&lt;p&gt;You can output the primary site’s Base URL like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ craft.app.sites.primarySite.baseUrl }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;code&gt;craft.app.sites&lt;/code&gt; maps to &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-sites.html&quot; rel=&quot;noreferrer&quot;&gt;craft\services\Sites&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Base URL begins with an &lt;a href=&quot;https://docs.craftcms.com/v3/config/#aliases&quot; rel=&quot;noreferrer&quot;&gt;alias&lt;/a&gt;, you will need to parse it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ alias(craft.app.sites.primarySite.baseUrl) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Altertatively, if you need to link to a sub-page of the primary site (not just its Base URL), you can do that with the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#siteurl-path-params-scheme-siteid&quot; rel=&quot;noreferrer&quot;&gt;siteUrl()&lt;/a&gt; function, which has a &lt;code&gt;siteId&lt;/code&gt; argument.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set primary = craft.app.sites.primarySite %}&#xA;{{ siteUrl('sub/path', siteId=primary.id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that if your primary site’s Base URL contains the &lt;code&gt;@web&lt;/code&gt; alias, that will always just return the host info for the current request. So you may need to replace that with a hard-coded base URL (or use a custom &lt;a href=&quot;https://docs.craftcms.com/v3/config/#aliases&quot; rel=&quot;noreferrer&quot;&gt;alias&lt;/a&gt;) before this works as expected.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-08-13T23:00:28.780" LastActivityDate="2018-08-13T23:00:28.780" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27260" PostTypeId="2" ParentId="27244" CreationDate="2018-08-11T17:12:38.513" Score="2" Body="&lt;p&gt;Edit your section‘s settings (Settings &gt; Sections &gt; [Section Name]), and delete the &lt;code&gt;static/&lt;/code&gt; from the Entry URI Format.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-11T17:12:38.513" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27261" PostTypeId="2" ParentId="27231" CreationDate="2018-08-11T17:42:17.907" Score="0" Body="&lt;p&gt;Table fields in Craft just store their data in a JSON blob in the content table. That means you can't really query them like you would other things, you'd have to load in all of the data, and then filter it out as an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you can certainly do this in Twig, it smacks of a bit too much &quot;business logic&quot; in Twig; so at this point I might be considering one of two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Refactoring it out to a&#xA;&lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin&lt;/a&gt;&#xA;or&#xA;&lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;module&lt;/a&gt;&#xA;that will do the heavy lifting behind the scenes&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Changing the schema I'm using to store the data in something that&#xA;&lt;em&gt;can&lt;/em&gt; be queried, such as moving the data into entries or a matrix block or perhaps a&#xA;&lt;a href=&quot;https://github.com/verbb/super-table&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Or if either of these seems like too much work, or you're not storing a whole lot of data in the Table field, then I'd just do it in Twig by looping through all of the rows in the table, and selecting only the ones that meet my criteria.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-11T17:42:17.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27262" PostTypeId="2" ParentId="10316" CreationDate="2018-08-11T22:09:43.653" Score="1" Body="&lt;p&gt;Well you could prepend the current locale to the redirect string with the craft.locale variable &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{craft.locale}}/thanks?from={fromName}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 the redirect parameters need to be hashed and craft.locale is deprecated so we need to use craft.app.language. So when using the input tag you could do it like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set redirectParam = craft.app.language ~ '/thanks?from={fromName}' %}&#xA;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{redirectParam | hash}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or use the built in helper function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ redirectInput(craft.app.language ~ '/thanks?from={fromName}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;other option would be to prepend the baseUrl of the current site ( craft3 )&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set baseUrl = craft.app.sites.currentSite.baseUrl ? craft.app.sites.currentSite.baseUrl : '/' %}&#xA;&#xA;{{ redirectInput(baseUrl ~ '/thanks?from={fromName}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6642" LastEditorUserId="57" LastEditDate="2018-08-13T03:30:44.203" LastActivityDate="2018-08-13T03:30:44.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27264" PostTypeId="2" ParentId="22951" CreationDate="2018-08-12T03:17:16.683" Score="0" Body="&lt;p&gt;Not exactly a direct answer, but this is where my first search started me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To save a Date/Time field into craft using a jQuery dateTime picker, you can create a small plugin and place this in the &lt;code&gt;init&lt;/code&gt; method of the primay plugin file (Craft 2x).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MyPluginFile.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    craft()-&amp;gt;on('sproutForms.onBeforeSaveEntry', function (Event $event) {&#xA;        if (craft()-&amp;gt;request-&amp;gt;isCpRequest()) {&#xA;            // Entry was saved from within the CP so we can ignore it.&#xA;        } else {&#xA;            if ($event-&amp;gt;params['isNewEntry']) {&#xA;                $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;                // Get the current time zone from the system.&#xA;                date_default_timezone_set(craft()-&amp;gt;timezone);&#xA;&#xA;                $entry-&amp;gt;setContentFromPost(array(&#xA;                    'eventDate' =&amp;gt; date('Y-m-d', strtotime(craft()-&amp;gt;request-&amp;gt;getPost('fields.eventDate'))),&#xA;                    'startTime' =&amp;gt; date('Y-m-d H:i:s', strtotime(craft()-&amp;gt;request-&amp;gt;getPost('fields.startTime'))),&#xA;                    'endTime' =&amp;gt; date('Y-m-d H:i:s', strtotime(craft()-&amp;gt;request-&amp;gt;getPost('fields.endTime'))),&#xA;                ));&#xA;            }&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-08-13T13:42:57.107" LastActivityDate="2018-08-13T13:42:57.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27265" PostTypeId="1" AcceptedAnswerId="27266" CreationDate="2018-08-12T13:41:52.017" Score="1" ViewCount="176" Body="&lt;p&gt;Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?&lt;/p&gt;&#xA;" OwnerUserId="6064" LastActivityDate="2018-08-12T13:57:15.173" Title="Get the location and id of asset volumne" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27266" PostTypeId="2" ParentId="27265" CreationDate="2018-08-12T13:57:15.173" Score="1" Body="&lt;p&gt;Of course it is. You can get the volume as you want, for example&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of if you have an asset&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set asset = craft.assetFieldHandly.one() %}&#xA;{% set volume = asset.getVolume() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And output the information&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ volume.path }}&#xA;{{ volume.id }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if &lt;code&gt;{{ volume.path }}&lt;/code&gt; contains an alias you can do &lt;code&gt;{{ alias(volume.path) }}&lt;/code&gt; to display the resolved path&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-12T13:57:15.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27267" PostTypeId="1" CreationDate="2018-08-12T17:41:02.197" Score="1" ViewCount="185" Body="&lt;p&gt;I use Guest Entries plugin to add information, and I need to send some message to user who filled the form to email. Can you show me an example of how I can do this?&lt;/p&gt;&#xA;" OwnerUserId="8643" LastEditorUserId="57" LastEditDate="2018-08-13T03:32:35.033" LastActivityDate="2018-10-13T23:00:24.053" Title="Guest Entries - How I can send message to user after saving form information" Tags="&lt;plugin-guestentries&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27268" PostTypeId="1" CreationDate="2018-08-13T02:18:36.813" Score="1" ViewCount="54" Body="&lt;p&gt;I'm looking to add the credit card last four digits to my customer's frontend order history.  Stripe is the gateway.  The Stripe transaction object doesn't seem to be available in the Craft Transaction object (the documentation seems to be in line with this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the Commerce CP under Orders, I have see the full Stripe object in the Transactions box and it does have the last4 property that I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to bring that info to the twig templates?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2018-08-13T02:18:36.813" Title="Commerce: reading Stripe object in Craft Transaction model" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;order&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27269" PostTypeId="1" AcceptedAnswerId="27272" CreationDate="2018-08-13T11:48:00.120" Score="2" ViewCount="601" Body="&lt;p&gt;I have an entry which needs to display the previous two entries, and the next two. I see in the docs there's a &lt;code&gt;nextSiblingOf&lt;/code&gt; method. That does nothing in a channel, and in a structure it will only return one entry. I can't see an ability to &quot;offset&quot; the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1: Is this possible in a channel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2: What do I need to do to grab the previous/next two entries in either case?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2018-08-13T12:39:46.220" Title="How to get the previous or next two entries" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27270" PostTypeId="1" AcceptedAnswerId="27271" CreationDate="2018-08-13T12:01:07.513" Score="2" ViewCount="138" Body="&lt;p&gt;I'm trying to plot entries from two different Solspace Calendars and an Entries section on one map, and use different markers for all types. Alll of the events are related to the current Entry through a field set on the Event, and a field set on the Entry. I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;E Waste - Solspace Calendar&lt;/li&gt;&#xA;&lt;li&gt;Community Events - Solspace Calendar&lt;/li&gt;&#xA;&lt;li&gt;Disposal Sites - Craft Entry&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All three of those above have address fields, and I'll be plotting them on a Smart Map. Currently, I'm doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all eWaste events related to material #}&#xA;{% set eWaste = craft.calendar.events({&#xA;calendar: 'eWaste',&#xA;    relatedTo: [ 'or', { targetElement: entry.materialCategory }, { targetElement: entry } ],&#xA;    rangeStart: now|date('Y-m-d'),&#xA;    rangeEnd: now|date_modify('+3 months')&#xA;}) %}&#xA;&#xA;{# Get related sites #}&#xA;{% set sites = craft.entries.section('sites').relatedTo([ 'or', { targetElement: entry.materialCategory }, { targetElement: entry }]) %}&#xA;&#xA;{# Merge events and entries #}&#xA;{% set locations = eWaste|merge( sites ) %}&#xA;&#xA;{{ craft.smartMap.map(locations, options) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gets events from one calendar, and the entries in to a single array so I can plot them on one map, but I can't work out how to differentiate between the types in order to give them different markers. As an example, &lt;code&gt;entry.type&lt;/code&gt; doesn't work, and neither does &lt;code&gt;{% if entry.eventField is defined %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I going about this the wrong way? How do I achieve what I'm after? Will the above approach also work for two different calendars + entries?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2018-08-13T12:16:23.833" Title="How do I differentiate between entries after merging an array?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;plugin-smartmap&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27271" PostTypeId="2" ParentId="27270" CreationDate="2018-08-13T12:16:23.833" Score="4" Body="&lt;p&gt;Not sure if I totally got it but you can check the class of an object via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if element is instance of ('craft\\elements\\Entry') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or via &lt;code&gt;switch&lt;/code&gt; statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% switch className(element) %}&#xA;    {% case 'craft\\elements\\Entry' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-13T12:16:23.833" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27272" PostTypeId="2" ParentId="27269" CreationDate="2018-08-13T12:23:07.290" Score="4" Body="&lt;p&gt;In a channel this would be the next entries where the post date is before and after the current entry’s post date. The element queries for it would look like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries&#xA;    .section('blog')&#xA;    .id('not ' ~ entry.id)&#xA;    .limit(2) %}&#xA;&#xA;{% set prevEntries = clone(query)&#xA;    .postDate('&amp;lt;= ' ~ entry.postDate.timestamp)&#xA;    .order('postDate desc')&#xA;    .all() %}&#xA;&#xA;{% set nextEntries = clone(query)&#xA;    .postDate('&amp;gt;= ' ~ entry.postDate.timestamp)&#xA;    .order('postDate asc')&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your sort the entries by title, something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prevEntries = clone(query)&#xA;    .title('&amp;lt;= ' ~ entry.title)&#xA;    .order('title desc')&#xA;    .all() %}&#xA;&#xA;{% set nextEntries = clone(query)&#xA;    .title('&amp;gt;= ' ~ entry.title)&#xA;    .order('title asc')&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2018-08-13T12:39:46.220" LastActivityDate="2018-08-13T12:39:46.220" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27273" PostTypeId="1" CreationDate="2018-08-13T14:08:50.540" Score="4" ViewCount="477" Body="&lt;p&gt;Struggling a bit here - have created a custom plugin where I want to validate form submission against a predefined model before saving to the database. All pretty straightforward so far …&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I try to use native (Yii 2) validation then a record is saved regardless of whether it is valid or not. For example, if I set the model rules as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function rules()&#xA;    {&#xA;        return [&#xA;            [['formName'], 'required'],&#xA;            [['formName'], 'string', 'min' =&amp;gt; 1, 'max' =&amp;gt; 255, 'skipOnEmpty' =&amp;gt; false]&#xA;        ];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The record is saved, even if &lt;code&gt;$model-&amp;gt;formName&lt;/code&gt; is empty. For example, see the following Controller code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionUpdate()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;        $site = Craft::$app-&amp;gt;getSites()-&amp;gt;getCurrentSite();   &#xA;&#xA;        $formName = $request-&amp;gt;getBodyParam('formName');&#xA;        $formId = $request-&amp;gt;getBodyParam('formId');&#xA;&#xA;        // get ID (if exists)&#xA;&#xA;        if ($formId) {&#xA;            $formRecord = FormRecord::find()&#xA;            -&amp;gt;where(['id'=&amp;gt;$formId])-&amp;gt;one();&#xA;            // if count == null return false&#xA;        } else {&#xA;            $formRecord = new FormRecord;&#xA;        }&#xA;&#xA;        $formRecord-&amp;gt;formName = $formName;&#xA;        $formRecord-&amp;gt;siteId = $site-&amp;gt;id;&#xA;        if ($formRecord-&amp;gt;validate()) {&#xA;        …&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code will always validate - even if the formName is empty.&#xA;This seems a bit crazy to me - am I misunderstanding something about Yii validation rules here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help/thoughts appreciated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2020-08-25T21:02:50.323" Title="Craft 3 Custom Plugin: model validation" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;validation&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27274" PostTypeId="1" CreationDate="2018-08-13T15:19:40.843" Score="1" ViewCount="63" Body="&lt;p&gt;In Craft Commerce 2, we have two shipping categories:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;PostNL, which is one of the Dutch main shipping methods, which we use for packages that fit in the mailbox.&#xA;For this category we use the weight as a measurement, and the consumer pays the whole shipping price based on the total weight of the order.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Shipped by courier, for products that don't fit the mailbox we send them by courier.&#xA;For Courier the shipping costs are different per product per zone and the consumer pays the shipping per product.&#xA;So when we have 10 crates, the consumer pays the shipping cost 10 times.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am looking for a way to add the shipping costs per product per zone and when someone orders a product in both categories only the courier category will fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could think of two routes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;creating multiple shipping categories that fit each product separately; then the question would be how would I set this up best.&lt;/li&gt;&#xA;&lt;li&gt;create a plugin that reads a specific field(s) per product and zone; then the question would be what would be the best place to hook this in.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8601" LastActivityDate="2018-08-13T15:19:40.843" Title="Complex shipping logics" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27275" PostTypeId="1" AcceptedAnswerId="27276" CreationDate="2018-08-13T16:24:12.307" Score="1" ViewCount="307" Body="&lt;p&gt;I am trying to change the label for Craft's form errors. My site local is currently fr_CA, and when I try to submit a form with an error, the error message returned is in french, but the label of the field is in english. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have managed to translate field labels for plugins, such as the Contact Form plugin by P&amp;amp;T, without any issues by using static translations. All I simply did was create a file with the plugin translation category as a name such as 'contact-form.php' and it works flawlessly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, with the forms included in Craft, it doesn't seem to work. For example, with the user registration form, if I submit it without a password, it will come up with an error saying the password needs to have at least 6 characters. Here is the message I receive : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;New Password doit comporter au moins 6 caractères.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The 'New Password' is in english while the rest of the message is in french. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to create a file called 'site.php' or 'app.php' in the translations folder under the right locale, it doesn't translate the 'New Password'. Here is the content of the file : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'New Password' =&amp;gt; 'Nouveau mot de passe'&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's like none of the translations supplied to Craft are being recognized. Has anyone run into this problem or have a solution? &lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="57" LastEditDate="2018-08-13T17:27:39.010" LastActivityDate="2018-08-13T18:53:46.167" Title="Translating Craft form error message labels" Tags="&lt;craft3&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27276" PostTypeId="2" ParentId="27275" CreationDate="2018-08-13T16:57:23.413" Score="2" Body="&lt;p&gt;You can't translate that field. I've tried it too once but it can't be done right now without effort because &lt;code&gt;craft\elements\User&lt;/code&gt;has no &lt;code&gt;attributeLabels()&lt;/code&gt; function in it in order to translate the attribute so all Yii2 does is to change &lt;code&gt;newPassword&lt;/code&gt; to &lt;code&gt;New Password&lt;/code&gt; but it doesn't translate anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either submit a feature request for it or do some hacky stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I submitted a feature request &lt;a href=&quot;https://github.com/craftcms/cms/issues/3196&quot; rel=&quot;nofollow noreferrer&quot;&gt;in their git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; 13.08.2018 &lt;a href=&quot;https://github.com/craftcms/cms/commit/0111023ab679ca53e233ecb300b9faf0e8eb46e0&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; commit changed it, you'll be able to translate those messages now&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-13T18:53:46.167" LastActivityDate="2018-08-13T18:53:46.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27277" PostTypeId="1" AcceptedAnswerId="27278" CreationDate="2018-08-13T17:39:41.897" Score="1" ViewCount="1031" Body="&lt;p&gt;In Craft 2 I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imageGallery.offset(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to exclude the first image, as that is shown higher up in the template.&#xA;I get the depreciation error of:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Looping through element queries directly has been deprecated. Use the&#xA;  all() function to fetch the query results before looping over them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I changed it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imageGallery.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't find any example of how to apply an 'offset' in the Craft 3 docs.&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-08-13T23:52:58.097" Title="How do I use offset in Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27278" PostTypeId="2" ParentId="27277" CreationDate="2018-08-13T18:12:54.293" Score="4" Body="&lt;pre&gt;&lt;code&gt;{% for image in entry.imageGallery.offset(1).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't search for an example &quot;how to apply &lt;code&gt;offset&lt;/code&gt;&quot;. All properties work the same - there is nothing special/ no difference between &lt;code&gt;offset&lt;/code&gt;, &lt;code&gt;limit&lt;/code&gt;, a field value or anything else.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-13T18:12:54.293" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27279" PostTypeId="2" ParentId="27277" CreationDate="2018-08-13T18:17:29.810" Score="3" Body="&lt;p&gt;So after reading Robin's answer, I realized I misread your question entirely... so the below isn't addressing your question exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially deleted it, but I think it may be relevant information anyway, if you decide to eager load elements into your template, or you try to use the same query more than once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have something like &lt;code&gt;entry.imageGallery&lt;/code&gt; you actually have an &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQuery&lt;/a&gt; -- when you invoke the &lt;code&gt;.all()&lt;/code&gt; method on that query, you're returned and array of results... so &lt;code&gt;entry.imageGallery&lt;/code&gt; then changes from being an ElementQuery to a simple array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why you're getting the error message that you are; you're trying to invoke an ElementQuery on what is now an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have a few options here, but I think the best option is to just realize that once you've retrieved these things from the ElementQuery (or even better, have &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eager Loaded&lt;/a&gt; them), they are now an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's treat them like an array, and modify our loop use the Twig slice &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;filter&lt;/a&gt; to use just the items we want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imageGallery | slice(1) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...or you can use the shorthand notation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for image in entry.imageGallery[1:] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-08-13T23:52:58.097" LastActivityDate="2018-08-13T23:52:58.097" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27280" PostTypeId="1" CreationDate="2018-08-13T18:46:01.760" Score="0" ViewCount="1232" Body="&lt;p&gt;I broke permissions in a critical craft install. My solution was to install a new version of the craft, move all of the templates from the old site to the new site and restore the MySQL database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is that craft wants to run the setup installer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone provide me a quick recipe for restoring a craft3 site from backups? I have the database and all of the assets/templates etc.&lt;/p&gt;&#xA;" OwnerUserId="603" LastActivityDate="2018-08-14T22:17:49.080" Title="How do I restore a site from backup" Tags="&lt;craft3&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27281" PostTypeId="1" AcceptedAnswerId="27282" CreationDate="2018-08-13T19:52:14.700" Score="1" ViewCount="91" Body="&lt;p&gt;I have a press release index page that loops through all the press releases. I want to organize them by year. So everything in 2018 will have a header that says 2018 press releases and then all the press releases for 2018 and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I do a conditional that checks the date, or is there something like the | batch but for date? Open to ideas. &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-08-13T19:58:25.103" Title="Batch entries by year?" Tags="&lt;loop&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27282" PostTypeId="2" ParentId="27281" CreationDate="2018-08-13T19:58:25.103" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://docs.craftcms.com/v2/templating/filters.html#group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group&lt;/a&gt; filter&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allEntries = craft.entries.section('blog').all() %}&#xA;&#xA;{% set allEntriesByYear = allEntries|group('postDate.year') %}&#xA;&#xA;{% for year, entriesInYear in allEntriesByYear %}&#xA;    &amp;lt;h2&amp;gt;{{ year }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for entry in entriesInYear %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-13T19:58:25.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27283" PostTypeId="2" ParentId="27244" CreationDate="2018-08-13T20:35:40.197" Score="0" Body="&lt;p&gt;The complete answer is a combination of Brandon's instruction, and additional information/details. To remove the first segment, I just needed to remove 'static/' from the Entry URI Format as Brandon instructed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the parent slug in the hierarchy, I added this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{parent.uri}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, on first observation of the link after I made this update, the link was still not correct. This is because the queue had not yet gone through an updated all of the links in the DB. I have a ton of entries, and this process took nearly 45 minutes.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-08-13T20:35:40.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27284" PostTypeId="1" AcceptedAnswerId="27287" CreationDate="2018-08-13T20:41:56.223" Score="1" ViewCount="196" Body="&lt;p&gt;I'm confused, I have ended up with 2 similar queries in a template after converting them from Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set events = craft.entries()&#xA;    .section('events')&#xA;    .eventDate('&amp;gt;' ~ now|date('Y-m-d H:i:s'))&#xA;    .limit(3)&#xA;    .orderby('eventDate')&#xA;    .all()&#xA;%}&#xA;{% for entry in events %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;    .section('news')&#xA;    .orderBy('postDate desc')&#xA;    .limit('4')&#xA;    .with(['imageGallery'])&#xA;%}&#xA;{% for entry in entries.all() %}&#xA;...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both work without any errors reported but which one is better or correct?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-08-13T21:26:38.433" Title="Where should the .all() be placed in Craft 3" Tags="&lt;craft3&gt;&lt;query&gt;&lt;queries&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27285" PostTypeId="1" CreationDate="2018-08-13T20:58:25.293" Score="1" ViewCount="135" Body="&lt;p&gt;After spending a lot of time solving this for myself I thought I'd share it.&#xA;In my Craft 2 template I had this query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set result = craft.entries({&#xA;    section: 'events',&#xA;    eventDate: ['and', '&amp;lt;' ~ now.w3c(), '&amp;gt; ' ~ now | date_modify('-6 days')],&#xA;    results: ':notempty:',&#xA;    order: 'eventDate desc',&#xA;    with: ['imageGallery'],&#xA;    limit: 3&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-08-13T21:32:43.437" Title="How do multiple date queries differ between Craft 2 and 3" Tags="&lt;datetime&gt;&lt;conditional&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27286" PostTypeId="2" ParentId="27285" CreationDate="2018-08-13T20:58:25.293" Score="3" Body="&lt;p&gt;My Craft 3 version is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set result = craft.entries()&#xA;    .section('events')&#xA;    .eventDate( ['and', '&amp;lt;' ~ now|atom, '&amp;gt;' ~ now|date_modify('-6 days')|atom ] )&#xA;    .results(':notempty:')&#xA;    .orderBy('eventDate desc')&#xA;    .limit(3)&#xA;    .with(['imageGallery'])&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the extra &lt;code&gt;|atom&lt;/code&gt; after the &lt;code&gt;date_modify('-6 days')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="152" LastEditorUserId="9" LastEditDate="2018-08-13T21:32:43.437" LastActivityDate="2018-08-13T21:32:43.437" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27287" PostTypeId="2" ParentId="27284" CreationDate="2018-08-13T21:24:54.373" Score="4" Body="&lt;p&gt;Both approaches are valid. In your first example, you could have moved &lt;code&gt;.all()&lt;/code&gt; into the for-loop; and in the second example, you could have moved &lt;code&gt;.all()&lt;/code&gt; out of the for-loop, and into the &lt;code&gt;{% set entries = ... %}&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until you call &lt;code&gt;.all()&lt;/code&gt;, you are working with an &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry query&lt;/a&gt;, and after you call &lt;code&gt;.all()&lt;/code&gt;, you’re working with an array of the actual entries (the query results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So which approach is &lt;em&gt;better&lt;/em&gt; depends on what else you’re doing in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you need to output the total number of entries, you could do this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entryQuery = craft.entries()&#xA;    .section('news')&#xA;%}&#xA;&#xA;{% for entry in entryQuery.all() %}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;Total: {{ entryQuery.count() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it would result in two database queries getting executed – once to get the entries for the for-loop, and a second query to get the total matching entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know you’re going to need that info, then it would be better to just fetch the entries ahead of time, and check the length of the array instead:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;    .section('news')&#xA;    .all()&#xA;%}&#xA;&#xA;{% for entry in entries %}&#xA;    ...&#xA;{% endfor %}&#xA;&#xA;Total: {{ entries|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regardless of the approach you decide to go with, you might want to make sure you are using semantec variable names. In your two examples you have &lt;code&gt;events&lt;/code&gt; (an array of actual event entries) and &lt;code&gt;entries&lt;/code&gt; (an entry query).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say that if you are not going to call &lt;code&gt;.all()&lt;/code&gt; when defining your &lt;code&gt;entries&lt;/code&gt; variable, then you might want to rename that to either &lt;code&gt;entryQuery&lt;/code&gt; or &lt;code&gt;query&lt;/code&gt;, just so it’s easier to remember what sort of variable you’re working with later on in the template.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entryQuery = craft.entries()&#xA;    .section('news')&#xA;    .orderBy('postDate desc')&#xA;    .limit('4')&#xA;    .with(['imageGallery'])&#xA;%}&#xA;&#xA;{% for entry in entryQuery.all() %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-13T21:24:54.373" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27288" PostTypeId="2" ParentId="27284" CreationDate="2018-08-13T21:26:38.433" Score="2" Body="&lt;p&gt;They are both correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your first example, &lt;code&gt;events&lt;/code&gt; is an &lt;em&gt;array of entries&lt;/em&gt;. In your second example, &lt;code&gt;entries&lt;/code&gt; is an &lt;em&gt;Element Query&lt;/em&gt;. As soon as you apply the &lt;code&gt;.all()&lt;/code&gt; to your Element Query, it &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-db-elementquery.html#method-all&quot; rel=&quot;nofollow noreferrer&quot;&gt;converts that into&lt;/a&gt; an array of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only two things you need to know about &lt;code&gt;.all()&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It must exist (or use &lt;code&gt;.one()&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;It must be last&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-13T21:26:38.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27290" PostTypeId="1" CreationDate="2018-08-14T03:02:07.043" Score="1" ViewCount="338" Body="&lt;p&gt;I have a News channel that's looped on an 'News Index' template. Each news entry is linked to its respective link via &lt;code&gt;{{ entry.url }}&lt;/code&gt;. In my News channel settings, I have the entry URI format to be &lt;code&gt;news/{postDate.year}/{slug}&lt;/code&gt;. However, the &lt;code&gt;{{ entry.url }}&lt;/code&gt; link goes to &lt;code&gt;news/{slug}&lt;/code&gt;. I assumed that if you set the URI format in the channel settings, it would create entry URLs based on the specified URI format. But that doesn't seem to be working. Can someone let me know where I'm going awry?&lt;/p&gt;&#xA;" OwnerUserId="5958" LastEditorUserId="57" LastEditDate="2018-08-14T22:50:18.487" LastActivityDate="2018-08-14T22:50:31.400" Title="Entry URI format with postDate not working" Tags="&lt;craft3&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27292" PostTypeId="1" CreationDate="2018-08-14T09:36:35.040" Score="1" ViewCount="90" Body="&lt;p&gt;I have a multi-page form set up. No matter what I enter on page 1, the form doesn't submit - the page just reloads.&#xA;Looking in devtools - the POST data is there, but seems like Freeform is not recognising it to move to page 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8039" LastActivityDate="2018-08-14T09:36:35.040" Title="Solspace Freeform plugin: Multi page form not going to next page" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27293" PostTypeId="1" AcceptedAnswerId="27295" CreationDate="2018-08-14T10:00:31.987" Score="1" ViewCount="506" Body="&lt;p&gt;This is a single entry page. I have an assets field of imageGallery which allows multiple images to be uploaded but it could also be empty. I want to use the first image at the top of the page (if one exists) then show the rest of the images (if there is more than one) excluding the first one after the bodyText field. I'm also loading a transform named 'gallery' if the original image is larger than the transform. This is the code I have now (simplified for clarity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set titleImage = entry.imageGallery[0] ?? null %}&#xA;&#xA;{% if titleImage|length %}&#xA;    {% if titleImage.getWidth()&amp;gt;titleImage.getWidth('gallery') %}&#xA;        &amp;lt;img src=&quot;{{ titleImage.url('gallery') }}&quot;&#xA;    {% else %}&#xA;        &amp;lt;img src=&quot;{{ titleImage.url }}&quot;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{{ entry.bodyText }}&#xA;&#xA;{% if entry.imageGallery.count() &amp;gt; 1 %}&#xA;    {% for image in entry.imageGallery.offset(1).all() %}&#xA;        {% if image.getWidth()&amp;gt;image.getWidth('gallery') %}&#xA;            &amp;lt;img src=&quot;{{ image.url('gallery') }}&quot;&#xA;        {% else %}&#xA;            &amp;lt;img src=&quot;{{ image.url }}&quot;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How could this be impoved on for faster loading?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-08-14T15:52:43.187" Title="How to speed up a single entry page with Eager Loading" Tags="&lt;performance&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27294" PostTypeId="1" CreationDate="2018-08-14T10:55:25.790" Score="1" ViewCount="56" Body="&lt;p&gt;I need to sort structure section entries belonging to specific category (entries have category field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With default structure list displayed in CP, i see all entries for this structure type section thrown in together. This makes sorting cumbersome because if i want to sort inside specific categpry, all other entries from other categories are in the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, can i display entries only related to specific category in CP?&lt;/p&gt;&#xA;" OwnerUserId="8366" LastActivityDate="2018-08-14T10:55:25.790" Title="Showing entries in CP only for specific category" Tags="&lt;structure&gt;&lt;category&gt;&lt;sorting&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27295" PostTypeId="2" ParentId="27293" CreationDate="2018-08-14T11:12:33.857" Score="3" Body="&lt;p&gt;Disclaimer: While &lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager-loading&lt;/a&gt; will almost always bring down the total number of queries executed, it's important to note that having less queries won't &lt;em&gt;always&lt;/em&gt; equal better performance. When optimising a page with eager-loading, you should take care to observe the actual &lt;em&gt;time&lt;/em&gt; Craft spends on database queries – which is the metric that matters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 3, you should enable the &lt;a href=&quot;https://craftcms.com/features/debug-toolbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Debug Toolbar&lt;/a&gt;, which will tell you exactly how many milliseconds Craft is using for database queries. Eager loading is not a silver bullet, and you should note the time spent on database queries with and without eager loading, to determine if it's actually increasing performance or not. &lt;em&gt;You can enable the debug toolbar from your Craft user's profile page inside the Control Panel.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For Craft 2, you'll need to enable &lt;a href=&quot;https://craftcms.com/support/dev-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;devMode&lt;/code&gt;&lt;/a&gt;, crack open your browser's dev tools console and expand the *Profiling Summary Report*. Unfortunately, AFAIK there's no record of the time spent on queries specifically, but you can gauge it by looking at the &lt;code&gt;Time&lt;/code&gt; property (which will report the total time Craft spent resolving the request, including database queries). Obviously, the lower this number is, the better.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, before worrying about eager loading, you should make sure that your template is properly optimised without it. The most important thing is to make sure that you're not doing multiple, redundant queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the code example above, you're first executing two queries on the &lt;code&gt;entry.imageGallery()&lt;/code&gt; field outside the &lt;code&gt;{% for %}&lt;/code&gt; loop, and then 1 additional query per image inside the &lt;code&gt;{% for %}&lt;/code&gt; loop. In other words, if you added 100 images to the &lt;code&gt;galleryImages&lt;/code&gt; field, you'd execute a total of 102 queries – which is totally unnecessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By caching the array of Assets returned by &lt;code&gt;.all()&lt;/code&gt; to a variable, you can get away with a single query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all images in the field #}&#xA;{% set galleryImages = entry.galleryImages.all() %}&#xA;&#xA;{# Set the `titleImage` to the first image #}&#xA;{% set titleImage = galleryImages[0] ?? null %}&#xA;&#xA;{% if titleImage %}&#xA;    ...&#xA;{% endif %}&#xA;&#xA;{{ entry.bodyText }}&#xA;&#xA;{# Use the |slice filter to remove the first image – i.e. the title image – from the Assets array, and then print the rest of the images #}&#xA;{% set galleryImages = galleryImages|slice(1) %}&#xA;&#xA;{% if galleryImages|length %}&#xA;    {% for image in galleryImages %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note the use of the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/slice.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;|slice&lt;/code&gt;&lt;/a&gt; filter – this is used to remove the first index (i.e. the first image) from the array, after caching it to a variable &lt;code&gt;titleImage&lt;/code&gt;. Don't worry, the &lt;code&gt;|slice&lt;/code&gt; operation won't throw an error, even if the &lt;code&gt;galleryImages&lt;/code&gt; array is empty.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the above optimisation, your X number of queries have been reduced to a single query – and at that point, you probably wouldn't see any performance improvements by adding eager loading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if you wanted to try it – here's how it could be done (this would replace the first line in the above example):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.elements.eagerLoadElements(&#xA;    className(entry),&#xA;    [entry],&#xA;    ['galleryImages']&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above statement should go at the very top of your template – and if you do this, make sure to remove the reference to &lt;code&gt;.all()&lt;/code&gt; in the first line of the first example (by eager loading the Assets field, the &lt;code&gt;entry.galleryImages&lt;/code&gt; property is already an array and hence has no &lt;code&gt;all()&lt;/code&gt; method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the above is probably not useful if you do the optimisations to bring down your query count to 1 – but, it could be useful if you had multiple relational fields you wanted to query, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.elements.eagerLoadElements(&#xA;    className(entry),&#xA;    [entry],&#xA;    ['galleryImages', 'entriesField', 'categoryField']&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more info on eager loading, check out &lt;a href=&quot;https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading&quot; rel=&quot;nofollow noreferrer&quot;&gt;this excellent article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-08-14T15:52:43.187" LastActivityDate="2018-08-14T15:52:43.187" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27296" PostTypeId="1" AcceptedAnswerId="27297" CreationDate="2018-08-14T12:52:26.777" Score="1" ViewCount="327" Body="&lt;p&gt;Suppose a Mtrix field named &lt;code&gt;MyMatrixField&lt;/code&gt; has three blocks called &lt;code&gt;Text&lt;/code&gt;, &lt;code&gt;Images&lt;/code&gt;, and &lt;code&gt;Buttons&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What MySQL query would list the section and title for all entries whose &lt;code&gt;MyMatrixField&lt;/code&gt; field has a &lt;code&gt;Buttons&lt;/code&gt; block in-use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT section, title FROM `craft_entries` WHERE `field_MyMatrixField_Buttons` IS NOT NULL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="57" LastEditDate="2018-08-14T22:46:35.720" LastActivityDate="2020-09-25T18:27:53.613" Title="Find entries that use a specific block in their Matrix field?" Tags="&lt;matrix&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27297" PostTypeId="2" ParentId="27296" CreationDate="2018-08-14T13:16:04.573" Score="2" Body="&lt;p&gt;You can join your matrix table and check for elements with a certain type and your owner id&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft&#xA;    .entries()&#xA;    .section(['your-section'])&#xA;    .leftJoin('{{%matrixblocks}} as matrixblocks', 'matrixblocks.ownerId = entries.id')&#xA;    .andWhere({'matrixblocks.typeId': 1}) &#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;replace the correct section and the correct type id of your blocktype&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-14T15:02:23.867" LastActivityDate="2018-08-14T15:02:23.867" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27298" PostTypeId="2" ParentId="27296" CreationDate="2018-08-14T15:12:04.627" Score="1" Body="&lt;p&gt;Robin's answer set me on the right path. Here's the final code that got me the results I was looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA;  Figure out everywhere the specified block appears.&#xA;  This returns an array where every instance of a block is a new item.&#xA;#}&#xA;{% set entries = craft&#xA;    .entries()&#xA;    .section(['sectionNameHere'])&#xA;    .leftJoin('{{%matrixblocks}} as matrixblocks', 'matrixblocks.ownerId = entries.id')&#xA;    .andWhere({'matrixblocks.typeId': blockIdNumberHere})&#xA;    .status(['enabled', 'disabled'])&#xA;    .all()&#xA;%}&#xA;&#xA;{# Init vars #}&#xA;{% set filteredEntries = [] %}&#xA;&#xA;{#&#xA;  Filter the previous array down so that an entry with the specified block &#xA;  can only appear once.&#xA;#}&#xA;{% for entry in entries %}&#xA;  {# Create a vastly pared-down array for each entry #}&#xA;  {% set filteredEntry = {&#xA;    link: entry.cpEditUrl,&#xA;    title: entry.title&#xA;  } %}&#xA;  {% if filteredEntry not in filteredEntries %}&#xA;    {% set filteredEntries = filteredEntries | merge([filteredEntry]) %}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&#xA;{# Spit out the results #}&#xA;&amp;lt;ol&amp;gt;&#xA;  {% for entry in filteredEntries %}&#xA;    &amp;lt;li&amp;gt;&#xA;      &amp;lt;a href=&quot;{{ entry.link }}&quot; target=&quot;_blank&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    &amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ol&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some remarks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To get the block IDs belonging to a specific matrix field, plug the Matrix field ID into this line: &lt;code&gt;SELECT id, name FROM `craft_matrixblocktypes` WHERE fieldId = ___ ORDER BY `craft_matrixblocktypes`.`sortOrder` ASC`&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The initial code, once working, spit out a line for each instance of a block, instead of one line per entry containing that block. That's why I had to filter the array down before outputting things.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="3904" LastEditDate="2020-04-24T14:06:05.560" LastActivityDate="2020-04-24T14:06:05.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27300" PostTypeId="2" ParentId="27290" CreationDate="2018-08-14T16:48:36.000" Score="1" Body="&lt;p&gt;Craft 3 removed the extended DateTime class, so &lt;code&gt;{postDate.year}&lt;/code&gt; doesn't work with Craft 3. It must be formatted as &lt;code&gt;{postDate|date('Y')}&lt;/code&gt; in the Entry URI format field.&lt;/p&gt;&#xA;" OwnerUserId="5958" LastEditorUserId="57" LastEditDate="2018-08-14T22:50:31.400" LastActivityDate="2018-08-14T22:50:31.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27301" PostTypeId="1" AcceptedAnswerId="27305" CreationDate="2018-08-14T17:44:48.263" Score="1" ViewCount="172" Body="&lt;p&gt;I upgraded to Craft 3 and I went to my payment gateways and I have the old ones in there with no details such as keys. And my only gateway options are Dummy and Manual. I know there were changes such as &lt;code&gt;.commerce&lt;/code&gt; being deprecated in some instances, so was this another change that I missed?  Do I have to buy a plugin for Commerce or make my own now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EpQt9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EpQt9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="57" LastEditDate="2018-08-14T22:53:32.047" LastActivityDate="2018-11-02T18:52:03.850" Title="Upgraded to Craft 3 and lost my Commerce Gateways" Tags="&lt;craft3&gt;&lt;payment-methods&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27303" PostTypeId="2" ParentId="27280" CreationDate="2018-08-14T22:17:49.080" Score="2" Body="&lt;p&gt;If you've copied the Craft files to a new place on the server, then you can either leave the database connection information the same and have it keep on pointing to the current database instance, or edit &lt;code&gt;craft/config/db.php&lt;/code&gt; (or your &lt;code&gt;.env&lt;/code&gt; file if that's how you're setup) to point to a new database instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the new one is a blank database, the Craft installer will want to run.  If you want a copy of your old database on the new one, you'll need to do a database dump from the old one and restore it to the new one.  If you do the latter and you're still getting Craft to prompt to run the installer, then there is something wrong with the database connection settings between Craft/PHP and the database and those should be adjusted.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-14T22:17:49.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27304" PostTypeId="2" ParentId="27267" CreationDate="2018-08-14T22:41:22.560" Score="1" Body="&lt;p&gt;You could do this with a small plugin that listened to the Guest Entries &lt;a href=&quot;https://github.com/craftcms/guest-entries#the-aftersaveentry-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;afterSaveEntry&lt;/a&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logic would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\guestentries\controllers\SaveController;&#xA;use craft\guestentries\events\SaveEvent;&#xA;use yii\base\Event;&#xA;&#xA;// ...&#xA;&#xA;Event::on(SaveController::class, SaveController::EVENT_AFTER_SAVE_ENTRY, function(SaveEvent $e) {&#xA;    // Grab the entry&#xA;    $entry = $e-&amp;gt;entry;&#xA;&#xA;    // Assuming `toEmail` is a custom field on the entry.&#xA;    Craft::$app-&amp;gt;getMailer()-&amp;gt;compose()&#xA;        -&amp;gt;setSubject('Thanks for your submission!')&#xA;        -&amp;gt;setTextBody('You are amazing.')&#xA;        -&amp;gt;setTo($entry-&amp;gt;toEmail)&#xA;        -&amp;gt;send();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can generate Craft 3 boilerplate plugin code using &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and the official Craft 3 Plugin docs are here: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/plugin-guide.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-14T22:41:22.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27305" PostTypeId="2" ParentId="27301" CreationDate="2018-08-14T22:57:18.510" Score="1" Body="&lt;p&gt;Commerce 2 moved all payment gateways to plugins.  You can see the relevant bit in the docs here: &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/payment-gateways.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/payment-gateways.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are currently seven 1st party plugins that add payment gateways and the two most popular, Stripe and PayPal are free.  You can see the table for the remaining in the above link.  All of these are currently in the Plugin Store. 3rd parties can additionally write plugins that work with other payment gateways.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="9" LastEditDate="2018-11-02T18:52:03.850" LastActivityDate="2018-11-02T18:52:03.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27306" PostTypeId="1" AcceptedAnswerId="27310" CreationDate="2018-08-15T08:10:29.690" Score="1" ViewCount="400" Body="&lt;p&gt;404 page doesn't have a title. It shows &quot;| Sitename&quot; in my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft 3 with the &lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic&lt;/a&gt; plugin and would like to set the title in the 404 template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seomaticMeta = seomaticMeta | merge({ seoTitle: '404 page not found' }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives a internal server error, looks like the seomaticMeta object is not available on the 404 page.&lt;/p&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2018-08-15T13:15:12.847" Title="404 page title SEOmatic" Tags="&lt;craft3&gt;&lt;plugin-seomatic&gt;&lt;404-page&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27308" PostTypeId="1" AcceptedAnswerId="27309" CreationDate="2018-08-15T11:14:25.863" Score="1" ViewCount="30" Body="&lt;p&gt;My first question here... maybe one of a few! I've inherited a Craft project recently and don't have much experience with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to allow admin to set a border (and border color) whenever they add an image. Currently, the &lt;code&gt;image&lt;/code&gt; field has a field type of &lt;code&gt;Assets&lt;/code&gt;. I don't want to change the field type (to a &lt;code&gt;Super Table&lt;/code&gt; or similar) because the component is used in so many other places - it would break.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're using Craft 2 but upgrading to 3 presently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone else had to do this before? Any suggestions on how to approach this? Let me know if I can clarify anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bob5v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bob5v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8704" LastActivityDate="2018-08-15T11:22:30.143" Title="How to create a border + border colour field on an image" Tags="&lt;assets&gt;&lt;field&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27309" PostTypeId="2" ParentId="27308" CreationDate="2018-08-15T11:22:30.143" Score="1" Body="&lt;p&gt;It looks like you're using a Matrix block with a field inside a block called Image. Given that information, I'd add a new field to that block called Border. You could either use a colour field, or a dropdown to set your own values. Then maybe something like this on the front end:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.image|length %}&#xA;&amp;lt;img src=&quot;{{ block.image.one.url }}&quot; {% if block.border|length %} class=&quot;bordered border-{{ block.border }}&quot;{% endif %}&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't have any relation to the front end of your site intrinsically, so you could call the field whatever you like.&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2018-08-15T11:22:30.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27310" PostTypeId="2" ParentId="27306" CreationDate="2018-08-15T13:15:12.847" Score="3" Body="&lt;p&gt;So it looks like you're using the old syntax for SEOmatic 1.x for Craft 2.x; here's how you do the same thing in SEOmatic for Craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seomatic.meta.seoTitle(&quot;Some Title&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#twig-templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#twig-templating&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-15T13:15:12.847" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27311" PostTypeId="1" AcceptedAnswerId="27312" CreationDate="2018-08-15T14:11:26.607" Score="1" ViewCount="723" Body="&lt;p&gt;I would like to loop through all the fields of a field layout tab form the current entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is working fine to get the field name and value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fieldLayoutField in entry.getFieldLayout().getFields() if fieldLayoutField.tabId == 50 %}&#xA;    {% set field = craft.app.fields.getFieldById(fieldLayoutField.id) %}&#xA;    Field name: {{ field.name }}&#xA;    Field value: entry[field.handle]&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I need to go a step further, by checking the field type, and then handle something different depending of the type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if field.type == 'dropdown' %}&#xA;    &amp;lt;select&amp;gt;&#xA;        {% for option in field.options %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;&#xA;                {{ option.label }}&#xA;            &amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/select&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As &lt;code&gt;{{ field.type }}&lt;/code&gt; and &lt;code&gt;{{ entry[field.handle].type }}&lt;/code&gt; aren't defined, I can't guess properly when this is, for example, a Plain Text field or a Dropdown field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could guess some fields type, by some checks like bellow, but it sounds very dirty:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;field.columnType&lt;/code&gt;&#xA;returns &lt;code&gt;text&lt;/code&gt; if a Plain Text field.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;field.options | length&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt; if a Dropdown field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For some others, like the Lightswitch field, I don't know exactly how to guess the type properly.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2018-08-15T14:16:48.353" LastActivityDate="2018-08-15T14:19:53.377" Title="How can I get the type of a field using Twig?" Tags="&lt;templating&gt;&lt;field&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27312" PostTypeId="2" ParentId="27311" CreationDate="2018-08-15T14:19:53.377" Score="3" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#classname-object&quot; rel=&quot;nofollow noreferrer&quot;&gt;className&lt;/a&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% switch className(field) %}&#xA;    {% case 'craft\\fields\\PlainText' %}&#xA;    {% case 'craft\\fields\\Dropdown' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-15T14:19:53.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27313" PostTypeId="1" AcceptedAnswerId="27314" CreationDate="2018-08-15T15:57:41.923" Score="2" ViewCount="146" Body="&lt;p&gt;Struggling with syntax here. I'm trying to query entries in the &quot;resources&quot; section, ordered by postDate desc, limit 1 and that also has the lightswitch &quot;featured&quot; as true. Here is what I have.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set featuredEntry = craft.entries({&#xA;            section:            'resources',&#xA;            orderBy:            'postDate desc',&#xA;            limit:              1,&#xA;            where:              {'featured': 1},&#xA;&#xA;        }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also to note I'm on craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-08-15T16:03:48.990" Title="Where to put where() for a query looking for a lightswitch field" Tags="&lt;query&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27314" PostTypeId="2" ParentId="27313" CreationDate="2018-08-15T16:03:23.880" Score="3" Body="&lt;p&gt;You can just query for the field value directly &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/#param-value-syntax&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to use Element Queries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set featuredEntry = craft.entries({&#xA;    section:  ['resources'],&#xA;    orderBy:  {postDate: SORT_DESC},&#xA;    limit:    1,&#xA;    featured: 1,&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-15T16:03:23.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27316" PostTypeId="1" AcceptedAnswerId="27323" CreationDate="2018-08-15T17:37:35.347" Score="3" ViewCount="1226" Body="&lt;p&gt;How do you reset or empty the cart, in Commerce 2? There is no mention of this in the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Commerce 1, it was possible to issue a request to the &lt;code&gt;commerce/cart/removeAllLineItems&lt;/code&gt; action to clear the cart, but this no longer works.&lt;/p&gt;&#xA;" OwnerUserId="6736" LastEditorUserId="4169" LastEditDate="2018-08-17T10:20:45.530" LastActivityDate="2021-03-10T19:33:59.620" Title="How do you reset a cart under Craft Commerce 2?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27318" PostTypeId="2" ParentId="14100" CreationDate="2018-08-15T19:45:23.950" Score="3" Body="&lt;p&gt;Assuming you're running Craft CMS 3, the &lt;a href=&quot;https://github.com/nystudio107/craft-connect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Connect plugin&lt;/a&gt; will let you connect to MSSQL databases (local or remote)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll just need to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require yiisoft/yii2-mssql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...on your Craft CMS project. To be clear, this doesn't add support for MSSQL to Craft itself, it just lets you query MSSQL databases in your Twig templates.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-15T19:45:23.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27319" PostTypeId="1" AcceptedAnswerId="27320" CreationDate="2018-08-15T20:59:12.287" Score="2" ViewCount="229" Body="&lt;p&gt;I have pagination twig component that needs to inject seo links into  of page (rel canonical).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use &lt;code&gt;{% block %}&lt;/code&gt; twig tag for this, but problem is that pagination component is already included in another &lt;code&gt;{% block %}&lt;/code&gt; tag containing main content of page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, im trying to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;layout.twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;{% block seo %}{% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;{% block main %}{% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;page.twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout.twig' %}&#xA;&#xA;{% block main %}&#xA;&#xA;some content..&#xA;{% include 'pagination.twig' %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;pagination.twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;... pagination links&#xA;&#xA;{% block seo %}&#xA;&amp;lt;link href=&quot;url&quot; rel=&quot;canonical&quot;&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When im using this code, block seo is empty. &#xA;Can this be achived some other way?&lt;/p&gt;&#xA;" OwnerUserId="8706" LastEditorUserId="8706" LastEditDate="2018-08-15T23:03:32.767" LastActivityDate="2018-08-15T23:03:32.767" Title="Nesting block tags doesnt work" Tags="&lt;templating&gt;&lt;seo&gt;&lt;blocks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27320" PostTypeId="2" ParentId="27319" CreationDate="2018-08-15T22:40:08.410" Score="2" Body="&lt;p&gt;Unfortunately it’s not possible for an included template to override the contents of a block in the parent template, or its layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You’d need to just override the &lt;code&gt;seo&lt;/code&gt; block from &lt;code&gt;page.twig&lt;/code&gt; do whatever you need to do from there instead.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends 'layout.twig' %}&#xA;&#xA;{% block main %}&#xA;  some content..&#xA;  {% include 'pagination.twig' %}&#xA;{% endblock %}&#xA;&#xA;{% block seo %}&#xA;  &amp;lt;link href=&quot;url&quot; rel=&quot;canonical&quot;&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-15T22:40:08.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27321" PostTypeId="1" AcceptedAnswerId="27322" CreationDate="2018-08-16T00:40:52.920" Score="1" ViewCount="158" Body="&lt;p&gt;I have a controller in the console folder. How can I call this controller via ajax please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to config a route in &lt;code&gt;Routes.php&lt;/code&gt;, and then call this route by jquery &lt;code&gt;Get()&lt;/code&gt; function. But none of these below work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v0/hub-loader/&amp;lt;sheet_id:\d+&amp;gt;' =&amp;gt; 'craftplugin/import-hubs/test',&#xA;'api/v0/hub-loader/&amp;lt;sheet_id:\d+&amp;gt;' =&amp;gt; 'craftplugin/console/controllers/import-hubs/test',&#xA;'api/v0/hub-loader/&amp;lt;sheet_id:\d+&amp;gt;' =&amp;gt; 'craftplugin/console/import-hubs/test',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All these routes return &lt;code&gt;404 page not found error&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-08-16T04:29:17.333" Title="How can I call console controllers" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;controller&gt;&lt;console&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27322" PostTypeId="2" ParentId="27321" CreationDate="2018-08-16T04:29:17.333" Score="1" Body="&lt;p&gt;I found a way to get around this problem by creating a controller which extends the console controller. &#xA;Then I can call the functions in this child controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if anyone knows how to call console controllers directly, please tell me.Thx&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-08-16T04:29:17.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27323" PostTypeId="2" ParentId="27316" CreationDate="2018-08-16T05:28:06.377" Score="5" Body="&lt;p&gt;The &lt;code&gt;commerce/cart/remove-all-line-items&lt;/code&gt; action (or in Craft 2 terms, &lt;code&gt;commerce/cart/removeAllLineItems&lt;/code&gt;) was deprecated (&lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/CHANGELOG.md#300---2020-01-28&quot; rel=&quot;nofollow noreferrer&quot;&gt;and subsequently removed&lt;/a&gt; in Commerce 3), so it's up to you to build a form to explicitly delete all line items:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form method=&amp;quot;post&amp;quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    {{ actionInput('commerce/cart/update-cart') }}&#xA;&#xA;    {% for lineItem in craft.commerce.carts.cart.lineItems %}&#xA;        &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;lineItems[{{ lineItem.id }}][remove]&amp;quot; value=&amp;quot;✓&amp;quot;&amp;gt;&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;button type=&amp;quot;submit&amp;quot;&amp;gt;Empty Cart&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This snippet just loops over the current line items, and outputs a hidden &lt;code&gt;input&lt;/code&gt; element, which sends the proper &lt;code&gt;POST&lt;/code&gt; value to the &lt;code&gt;update-cart&lt;/code&gt; action.&lt;/p&gt;&#xA;&lt;p&gt;It's also possible to give your customer control over which line items are to be removed by changing the &lt;code&gt;input&lt;/code&gt; to a check-box (and providing adequate labeling).&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2021-03-10T19:33:59.620" LastActivityDate="2021-03-10T19:33:59.620" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27324" PostTypeId="1" AcceptedAnswerId="27383" CreationDate="2018-08-16T10:22:34.323" Score="2" ViewCount="44" Body="&lt;p&gt;Basically I’m trying to get en Entry where, either one (or more) of three lightswitches is (are) turned on, or where either categoryOne or categoryTwo is not empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I got so far, but it doesn't seem to work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = [&#xA;    'section' =&amp;gt; 'news',&#xA;    'limit' =&amp;gt; 100,&#xA;    'search' =&amp;gt; ‘lightswitchOne:1 OR lightswitchTwo:1 OR lightswitchThree:1’,&#xA;    'categoryOne' =&amp;gt; ':notempty:’,&#xA;    'categoryTwo’ =&amp;gt; ':notempty:’,&#xA;    'id' =&amp;gt; 'and, not 1, not 2’//Also exclude a couple id's&#xA;];&#xA;$criteriaModel = craft()-&amp;gt;elements-&amp;gt;getCriteria(&quot;Entry&quot;);&#xA;$criteriaModel-&amp;gt;setAttributes($criteria);&#xA;return $criteriaModel-&amp;gt;find();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this is in Craft?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="4907" LastEditDate="2018-08-21T07:36:40.873" LastActivityDate="2018-08-21T07:36:40.873" Title="Plugin, getting an entry when one of multiple category fields and/or lightswitches are not empty/turned on" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27325" PostTypeId="1" CreationDate="2018-08-16T10:32:15.853" Score="2" ViewCount="159" Body="&lt;p&gt;I want to try to learn how I can filter entries by multiple categories. I realise similar questions have been asked in the past, but all the answers are for specific use cases. All I want to do is filter entries by categories from more than one group. I've found code to set up a form that returns the URL with a string, but I understand that the string needs to be converted into an array. That's the part I can't work out how to do.&#xA;So the form is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {# Get the relevant entries #}&#xA;    {% set categoryQuery = craft.app.request.getParam('category') %}&#xA;    {% set categories = craft.categories.group('candidate').slug(categoryQuery) %}&#xA;&#xA;    {# Set the search parameters #} &#xA;    {% set searchParams = {&#xA;        relatedTo: categories,&#xA;        section: 'candidate'&#xA;    } %}&#xA;&#xA;    {# Get the relevant entries #}&#xA;    {% set relevantEntries = craft.entries(searchParams) %}&#xA;&#xA;    &amp;lt;form action=&quot;{{ craft.app.request.absoluteUrl }}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;p&amp;gt;Eye colour&amp;lt;/p&amp;gt;&#xA;&#xA;        {% for category in craft.categories.group('eyeColour').all() %}&#xA;            &amp;lt;input id=&quot;{{category.slug}}&quot; type=&quot;checkbox&quot; name=&quot;category[]&quot;  value=&quot;{{ category.slug }}&quot; {{ category.slug in categoryQuery or categoryQuery == null  ? 'checked'}}&amp;gt;&#xA;            &amp;lt;label for=&quot;{{ category.slug }}&quot; &amp;gt;{{ category.title }}&amp;lt;/label&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;p&amp;gt;Hair colour&amp;lt;/p&amp;gt;&#xA;&#xA;        {% for category in craft.categories.group('hairColour').all() %}&#xA;            &amp;lt;input id=&quot;{{category.slug}}&quot; type=&quot;checkbox&quot; name=&quot;category[]&quot;  value=&quot;{{ category.slug }}&quot; {{ category.slug in categoryQuery or categoryQuery == null  ? 'checked'}}&amp;gt;&#xA;            &amp;lt;label for=&quot;{{ category.slug }}&quot; &amp;gt;{{ category.title }}&amp;lt;/label&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        &amp;lt;p&amp;gt;&amp;lt;button type=&quot;submit&quot;&amp;gt;&#xA;                Search&#xA;        &amp;lt;/button&amp;gt;&amp;lt;/p&amp;gt;               &#xA;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives me a URL like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/?category%5B%5D=blue&amp;amp;category%5B%5D=black&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="5845" LastEditDate="2018-08-17T02:24:23.077" LastActivityDate="2018-08-17T10:46:26.580" Title="How to display entries filtered from more than one category" Tags="&lt;categories&gt;&lt;array&gt;&lt;params&gt;&lt;string&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27326" PostTypeId="1" CreationDate="2018-08-16T10:55:03.123" Score="1" ViewCount="50" Body="&lt;p&gt;I have a plugin that sets the user group based on whether a hidden checkbox has been ticked on the sign up form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin works exactly as I want it to while I'm logged in, but as soon as I log out the form reverts to default behaviour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find anything in Google about plugins misbehaving when someone logs out. Does anyone know what's going on and how I can overcome it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugin code below;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;&#xA;    craft()-&amp;gt;on('users.saveUser', function(Event $event) {&#xA;&#xA;      $user = $event-&amp;gt;params['user']&#xA;&#xA;      if ($event-&amp;gt;params['isNewUser']) {&#xA;&#xA;        $groupPreference = $user-&amp;gt;getContent()-&amp;gt;groupPreference;&#xA;&#xA;        if (in_array(&quot;trade&quot;, $groupPreference)) {&#xA;&#xA;           craft()-&amp;gt;userGroups-&amp;gt;assignUserToGroups($user-&amp;gt;id, 3);&#xA;&#xA;        }&#xA;&#xA;      }&#xA;&#xA;    });&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4931" LastActivityDate="2018-08-24T04:12:40.257" Title="Plugin stops working when logged out" Tags="&lt;plugin-development&gt;&lt;users&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27328" PostTypeId="1" AcceptedAnswerId="27330" CreationDate="2018-08-16T13:22:56.507" Score="2" ViewCount="346" Body="&lt;p&gt;I created a plugin for a client website and I keep getting license issues popping up in the admin panel for it. Not sure what I am doing wrong here. Obviously I have no intention of putting it into the store, I just want to remove this license key issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ku77k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ku77k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7292" LastActivityDate="2018-08-16T14:26:07.117" Title="Plugin I created is asking for a license key" Tags="&lt;plugin-development&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27329" PostTypeId="2" ParentId="27328" CreationDate="2018-08-16T14:14:18.853" Score="0" Body="&lt;p&gt;Maybe you copied some code from another plugin?&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-08-16T14:14:18.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27330" PostTypeId="2" ParentId="27328" CreationDate="2018-08-16T14:26:07.117" Score="5" Body="&lt;p&gt;Craft checks only the &lt;code&gt;handle&lt;/code&gt; of your plugin to detect license mismatches. So when your plugin has the handle &lt;code&gt;importer&lt;/code&gt; and another plugin in the store has the same handle it will mark it. (since importer is already a plugin in the store it's likely the issue)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only ways to solve it&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;change your handle to &lt;code&gt;data-importer&lt;/code&gt; or whatever might be unique&lt;/li&gt;&#xA;&lt;li&gt;make a module out of it&lt;/li&gt;&#xA;&lt;li&gt;(include CSS to remove the message and ignore it)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-16T14:26:07.117" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27331" PostTypeId="1" AcceptedAnswerId="27332" CreationDate="2018-08-16T14:35:54.527" Score="2" ViewCount="589" Body="&lt;p&gt;I want to write a plugin which writes all the order data into a CSV file.&#xA;Unfortunately the documentation for Commerce 2 isn't quite complete yet so I have difficulties to find out how to do the following with a plugin (so I need to use PHP and not Twig).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get an order by ID.&lt;/li&gt;&#xA;&lt;li&gt;Get ordered items.&lt;/li&gt;&#xA;&lt;li&gt;Get the addresses for the order.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Every help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-08-17T10:14:47.393" Title="Craft Commerce 2 - get order data for plugin" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27332" PostTypeId="2" ParentId="27331" CreationDate="2018-08-16T15:21:39.293" Score="3" Body="&lt;pre&gt;&lt;code&gt;$order = \craft\commerce\elements\Order::find()-&amp;gt;id($id)-&amp;gt;one();&#xA;&#xA;if($order)&#xA;{&#xA;  foreach ($order-&amp;gt;getLineItems() as $item) {&#xA;   // $item-&amp;gt;description&#xA;   // $item-&amp;gt;qty&#xA;  }&#xA;&#xA;  $billingAddress = $order-&amp;gt;getBillingAddress();&#xA;  $shippingAddress = $order-&amp;gt;getShippingAddress();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="5366" LastEditDate="2018-08-17T10:14:47.393" LastActivityDate="2018-08-17T10:14:47.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27333" PostTypeId="1" CreationDate="2018-08-16T15:24:54.543" Score="2" ViewCount="195" Body="&lt;p&gt;So I have three light switches on my blog: 'featured', 'required reading' and 'skills'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got the featured section to work with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries&#xA;    .section(['etiquette', 'style','culture','reviews'])&#xA;    .where('featured' == 1)&#xA;    .orderBy('id desc')&#xA;    .limit(4)&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when I went to do the reading section I used this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries&#xA;    .section([&#xA;        'etiquette',&#xA;        'style',&#xA;        'culture'&#xA;    ])&#xA;    .where('requiredReading' == 1)&#xA;    .orderBy('id desc')&#xA;    .limit(12)&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i get all the stories with reading and featured switches on. I checked the database and the required reading field is 0. How can I get just the required reading or can you not use more than one lightswitch?&lt;/p&gt;&#xA;" OwnerUserId="8709" LastEditorUserId="5845" LastEditDate="2018-08-17T18:11:13.747" LastActivityDate="2018-08-17T18:18:51.437" Title="Showing entries for light switch" Tags="&lt;entries&gt;&lt;database&gt;&lt;entry-type&gt;&lt;query&gt;&lt;lightswitch&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-09-07T16:05:54.053" ContentLicense="CC BY-SA 4.0" />
  <row Id="27334" PostTypeId="1" CreationDate="2018-08-16T16:13:41.510" Score="1" ViewCount="257" Body="&lt;p&gt;I'm just starting with plugins and I've downloaded the Business Logic plugin and am trying to call it from my template.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;{{craft()-&amp;gt;businessLogic-&amp;gt;exampleService()}}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the code in the BusinessLogicService.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class BusinessLogicService extends BaseApplicationComponent&#xA;&#xA;{&#xA;&#xA;    /**&#xA;     * This function can literally be anything you want.&#xA;     *&#xA;     * HOW TO USE IT&#xA;     * From any other plugin file, call it like this:&#xA;     *&#xA;     *     craft()-&amp;gt;businessLogic-&amp;gt;exampleService()&#xA;     *&#xA;     */&#xA;    public function exampleService()&#xA;    {&#xA;        return &quot;I've got your data right here!&quot;;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It returns this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unknown &quot;craft&quot; function.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would I call it a different way?&lt;br&gt;&#xA;Thanks for any help with this.&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2018-08-16T17:28:15.663" Title="&quot;Unknown &quot;craft&quot; function&quot; Error in Plugin Service Call" Tags="&lt;plugins&gt;&lt;services&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27335" PostTypeId="1" CreationDate="2018-08-16T16:30:29.610" Score="2" ViewCount="733" Body="&lt;p&gt;On my blog i need a load more button on the bottom of each section that simply loads more posts when clicked. Everything i look at people are using other javascript libraries. I just want to use ajax no external libraries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('news').limit(10) %}&#xA;{% set categories = craft.categories.relatedTo(entry) %}&#xA;&amp;lt;div class=&quot;article-container&quot;&amp;gt;&#xA;&amp;lt;hr /&amp;gt;&#xA;&amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;col-lg-4&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;article-featured-image&quot;&amp;gt;&#xA;            {% for asset in entry.newsFeaturedImage %}&#xA;                 &amp;lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.title }}&quot; class=&quot;mx-auto d-block img-fluid&quot;&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;col-lg-8&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;article-meta&quot;&amp;gt;&#xA;            {% for category in categories %}&#xA;                &amp;lt;small class=&quot;hl-heading-yellow&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;{{ category.title }}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/small&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;div class=&quot;article-title&quot;&amp;gt;&#xA;                &amp;lt;span&amp;gt;{{entry.title}}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;article-excerpt&quot;&amp;gt;&#xA;                {{ entry.newsExcerpt|length &amp;gt; 150 ? entry.newsExcerpt|slice(0, 150) ~ '...' : entry.newsExcerpt  }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;article-url&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{entry.url}}&quot; class=&quot;dark-btn&quot;&amp;gt;Continue Reading&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA;   {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-08-16T17:03:06.153" Title="Ajax Load more Posts" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27336" PostTypeId="2" ParentId="27335" CreationDate="2018-08-16T16:54:24.530" Score="2" Body="&lt;p&gt;First you create a function to send the data to a custom controller&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var offset = 10&#xA;var getElements = function(){&#xA;    var data = new FormData();&#xA;    data.append('offset', offset);&#xA;    data.append('action', 'plugin-name/controller-name/function-name);&#xA;    data.append(window.csrfTokenName, window.csrfToken);&#xA;&#xA;    var xhr = new XMLHttpRequest();&#xA;    xhr.open('POST', '', true);&#xA;    xhr.onload = function () {&#xA;        // check for errors&#xA;        if(this.status === 200){&#xA;            var response = {};&#xA;            try {&#xA;                response = JSON.parse(this.responseText);&#xA;            } catch(error) {&#xA;                throw Error(&quot;server did not return valid JSON: &quot; + this.statusText + ' ' + this.status);&#xA;                return false;&#xA;            }&#xA;            // append your response to the object/container you like&#xA;            offset += response.elements;&#xA;        }&#xA;    }&#xA;    xhr.send(data);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your controller just fetch the entries&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;public function actionGetElements(): Response&#xA;{&#xA;    $offset = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('offset');&#xA;    $query = Entry::find()-&amp;gt;section(['whatever'])-&amp;gt;limit(10)-&amp;gt;offset($offset);&#xA;    $elements = $query-&amp;gt;all();&#xA;    $html = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('path/to/template', [&#xA;        'elements' =&amp;gt; $elements&#xA;    ]);&#xA;    $fetchedElements = \count($elements);&#xA;    $totalElements = $query-&amp;gt;count();&#xA;    return $this-&amp;gt;asJson(&#xA;        [&#xA;            'html' =&amp;gt; $html,&#xA;            'success' =&amp;gt; true,&#xA;            'elements' =&amp;gt; $fetchedElements,&#xA;            // check if the number of fetched element + offset is equal to the number of total elements&#xA;            // if that's the case you can hide the button to load more since there are no more elements&#xA;            'hideButton' =&amp;gt; $fetchedElements + $offset === $totalElements&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Keep in mind to include a &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSRF token&lt;/a&gt; &lt;code&gt;data.append(window.csrfTokenName, window.csrfToken);&lt;/code&gt; and to include an &lt;code&gt;protected $allowAnonymous = [ 'actionGetElements'];&lt;/code&gt; to your controller&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-16T17:03:06.153" LastActivityDate="2018-08-16T17:03:06.153" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27337" PostTypeId="2" ParentId="27334" CreationDate="2018-08-16T17:28:15.663" Score="1" Body="&lt;p&gt;There are multiple issues happening here...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The Twig code should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.businessLogic.exampleVariable() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As noted in that example, Twig can't communicate directly with a Service level method. You'll need to ping the Variable class, and use your Variable method to call the Service method.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Optional...&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;The Business Logic plugin template currently only works with Craft 2. If you're attempting this on a Craft 3 site, several things would need to be changed.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-16T17:28:15.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27339" PostTypeId="1" CreationDate="2018-08-16T20:49:42.680" Score="2" ViewCount="199" Body="&lt;pre&gt;&lt;code&gt;{% set tweets = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended' }) %}&#xA;&#xA;{% for tweet in tweets %}&#xA;    &amp;lt;li&amp;gt;&#xA;&#xA;    {% if tweet.extended_entities.media is defined %}&#xA;        {% for item in tweet.extended_entities.media if item.type == 'photo' %}&#xA;            &amp;lt;img src=&quot;{{ item.media_url }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anything obviously wrong here? I tested the API with a {{ dump(tweets) }} which seems fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17305/is-it-possible-to-get-a-tweet-image-when-using-twitter-plugin/27302?noredirect=1#comment35764_27302&quot;&gt;This&lt;/a&gt; thread describes a similar issue but without a solution.&lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2018-08-17T19:59:14.473" LastActivityDate="2018-08-17T19:59:14.473" Title="Problem pulling Tweets with media using Dukt's Twitter API plugin" Tags="&lt;image&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27340" PostTypeId="2" ParentId="27339" CreationDate="2018-08-16T20:56:02.933" Score="2" Body="&lt;p&gt;The return from &lt;a href=&quot;https://docs.dukt.net/twitter/v2/craft-twitter.html#get-uri-query-headers-options-enablecache-cacheexpire&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.twitter.get()&lt;/code&gt;&lt;/a&gt; is not an array of tweets, but a response object, where the actual tweets are nested in an attribute called &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not tested, but from looking at the plugin docs, something like this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended' }) %}&#xA;&#xA;{% if response.success %}&#xA;    {% for tweet in response.data %}&#xA;        ...&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-08-16T20:56:02.933" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27341" PostTypeId="2" ParentId="15073" CreationDate="2018-08-16T22:51:33.983" Score="2" Body="&lt;p&gt;I fixed it by adding &lt;code&gt;rewrite ^/index.php/(.*) /$1 permanent;&lt;/code&gt; to my server block. This will redirect all urls containing &lt;code&gt;index.php&lt;/code&gt; and something after it to the contents after &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. &lt;code&gt;/index.php/about&lt;/code&gt; will be permanently redirected to &lt;code&gt;/about&lt;/code&gt;. Google knows that if something is permanently redirected its the same content and will only index the redirect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's one drawback though, because &lt;code&gt;index.php&lt;/code&gt; is an actual file you can still access that. So you need to keep &lt;code&gt;Disallow: /index.php&lt;/code&gt; into your &lt;code&gt;robots.txt&lt;/code&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="8711" LastActivityDate="2018-08-16T22:51:33.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27342" PostTypeId="1" CreationDate="2018-08-17T09:07:03.280" Score="0" ViewCount="262" Body="&lt;p&gt;I can't work out how to output &lt;code&gt;&amp;lt;link rel=&quot;alternate&quot;&amp;gt;&lt;/code&gt; for each language variation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any easy way to do this please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="5872" LastActivityDate="2021-05-14T10:04:10.370" Title="How to output &lt;link rel=&quot;alternate&quot;&gt; for each language?" Tags="&lt;language&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27343" PostTypeId="2" ParentId="27325" CreationDate="2018-08-17T10:19:28.607" Score="1" Body="&lt;p&gt;Here's something I've got for filtering news by author and by category. You might be able to re-work it for your needs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a page URL being: &lt;code&gt;http://project.com/news?&amp;amp;cat=CATEGORY&amp;amp;author=NAME&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = {} %}&#xA;&#xA;{% set categoryParam = craft.app.request.getParam('cat') %}&#xA;{% set authorParam = craft.app.request.getParam('author') %}&#xA;&#xA;{% set category = craft.categories.slug(categoryParam) %}&#xA;{% set author = craft.entries.section('team').slug(authorParam).first() %}&#xA;&#xA;{% if category %}&#xA;    {% set query = query|merge(category) %}&#xA;{% endif %}&#xA;&#xA;{% if author %}&#xA;    {% set query = query|merge(author) %}&#xA;{% endif %}&#xA;&#xA;{% if categoryParam and authorParam %}&#xA;&#xA;    {% set results = targetEntries.relatedTo(['and',&#xA;            { targetElement: category },&#xA;            { targetElement: author }&#xA;        ]&#xA;    ).orderBy('postDate desc') %}&#xA;&#xA;    {% set noResultsMessage = &quot;Sorry, there are no articles by &quot; ~ author.title ~ &quot; in that category. Try changing your filters.&quot; %}&#xA;&#xA;{% elseif categoryParam %}&#xA;&#xA;    {% set results = targetEntries.relatedTo(category).orderBy('postDate desc') %}&#xA;    {% set noResultsMessage = &quot;Sorry, there are no articles in that category. Try filtering by a different category.&quot; %}&#xA;&#xA;{% elseif authorParam %}&#xA;&#xA;    {% set results = targetEntries.relatedTo(author).orderBy('postDate desc') %}&#xA;    {% set noResultsMessage = &quot;Sorry, there are no articles by &quot; ~ author.title ~ &quot;. Try filtering by someone else.&quot; %}&#xA;&#xA;{% else %}&#xA;&#xA;    {% set results = targetEntries.orderBy('postDate desc') %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It was written a long time ago, so I'm seeing some places where I can streamline it, but this works for me filtering by two fields. I think the key part for your requirements is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set results = targetEntries.relatedTo(['and',&#xA;    { targetElement: category },&#xA;    { targetElement: author }&#xA;]).orderBy('postDate desc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps in some way.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-08-17T10:46:26.580" LastActivityDate="2018-08-17T10:46:26.580" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27345" PostTypeId="1" AcceptedAnswerId="27349" CreationDate="2018-08-17T14:03:03.283" Score="1" ViewCount="546" Body="&lt;p&gt;I have a section (events) with a Super Table field that has a date field. I am looking for a way to make a request to have the events superior to now. I cannot find how to do it. The event have multiple dates. Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="8636" LastEditorUserId="57" LastEditDate="2018-08-17T18:09:40.207" LastActivityDate="2018-08-17T18:09:40.207" Title="query on Super Table field's date field" Tags="&lt;craft3&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27346" PostTypeId="1" AcceptedAnswerId="27347" CreationDate="2018-08-17T14:14:38.227" Score="2" ViewCount="465" Body="&lt;p&gt;So I have been asked to build a resource center just like hubspot's. (insert rolleyes here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.hubspot.com/resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.hubspot.com/resources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can click into a type, and then click at topic and it creates a url like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.hubspot.com/resources/ebook/advertising&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.hubspot.com/resources/ebook/advertising&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also click a topic and then click type and it will do the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this part pretty much working. In my category template I have done this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Filter by type:&#xA;&#xA;    &amp;lt;a href=&quot;/resources/case-studies/{{category.slug}}&quot;&amp;gt;case studies&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;/resources/ebooks/{{category.slug}}&quot;&amp;gt;ebooks&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;/resources/webinars/{{category.slug}}}&quot;&amp;gt;webinars&amp;lt;/a&amp;gt;&#xA;&#xA;    &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&#xA;&#xA;    &amp;lt;a href=&quot;/resources/whitepapers/{{category.slug}}&quot;&amp;gt;whitepapers&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I have a routes for each type setup like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the URI looks like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;/resources/case-studies/*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loads this template: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;resources/_filtered.html &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in that template filtered I do the filtering like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% set resourceType = craft.request.segment(2) %}&#xA;&#xA;        {% set resourceCatSlug = craft.request.segment(3) %}&#xA;&#xA;        {% set resourceCat = craft.categories.slug(resourceCatSlug).first() %}&#xA;&#xA;        {{resourceType}}&#xA;&#xA;        {{resourceCat}}&#xA;&#xA;        {% set filteredEntries = craft.entries({&#xA;            section:    ['resources'],&#xA;            orderBy:    {postDate: SORT_DESC},&#xA;            type:       resourceType,&#xA;            relatedTo:  resourceCat,&#xA;        }).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works and I planned to do the same method on the resources types to get to the filtered template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But where I'm stuck is it was also requested that you could filter your search even further with a string search. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form class=&quot;control txt-center&quot; action=&quot;{{ url('resources/search/results-filtered') }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;input class=&quot;input margin-auto-left-right display-block is-narrow-field &quot; type=&quot;search&quot; name=&quot;q&quot; placeholder=&quot;Search&quot;&amp;gt;&#xA;&#xA;&amp;lt;button class=&quot;margin-top-1 button is-info&quot; role=&quot;button&quot; type=&quot;submit&quot;&amp;gt; Search the library &amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass entry type and category to my filtered results?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchTerm = craft.app.request.getParam('q') %}&#xA;{% set searchResults = craft.entries.search(searchTerm).section('resources').orderBy('score') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PS, If anyone has a more elegant way to handle this I'm all ears! &lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-08-18T18:00:41.127" Title="Search with string, entry type and category" Tags="&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27347" PostTypeId="2" ParentId="27346" CreationDate="2018-08-17T15:56:29.583" Score="2" Body="&lt;p&gt;Without completely changing your direction and following in Hubspot's footsteps.  From the search box set the query param for the page &lt;code&gt;?q=search-text&lt;/code&gt; then as the page refreshes grab the query &lt;code&gt;{% set query = craft.request.getParam('q') %}&lt;/code&gt;.  Then loop over your filteredEntries results only showing those entries who's title has the query.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for item in filteredEntries %}&#xA;    {% if query in item.title %}&#xA;        …&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#containment-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Containment Operator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also accomplish the filter by textual query in Javascript: &#xA;&lt;a href=&quot;https://stackoverflow.com/questions/27096548/filter-by-search-using-text-found-in-element-within-each-div&quot;&gt;Filter by search using text found in element within each div&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="331" LastEditorUserId="5557" LastEditDate="2018-08-18T18:00:41.127" LastActivityDate="2018-08-18T18:00:41.127" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27348" PostTypeId="2" ParentId="27346" CreationDate="2018-08-17T15:59:28.580" Score="3" Body="&lt;p&gt;A more elegant way to handle it would be to use PHP, rely on a more complex routing system with default values, don't rely on segments but on routing parameters. Use real URLs instead of relative paths and build your URLs dynamically instead of just inserting the string hard coded in order to be able to filter by multiple values without loosing the already set filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - to include your parameters all you need to do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set searchResults = craft.entries&#xA;    .search(searchTerm)&#xA;    .section('resources')&#xA;    .type(resourceType)&#xA;    .orderBy('score') &#xA;    .relatedTo(resourceCat)&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would create a dynamic rule&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$event-&amp;gt;rules[] = [&#xA;    'pattern'  =&amp;gt; '/resources/&amp;lt;type:\S+&amp;gt;/&amp;lt;category:\S+&amp;gt;/&amp;lt;search:[a-zA-Z0-9-]+&amp;gt;',&#xA;    'route'    =&amp;gt; 'module/search/search-elements',&#xA;    'defaults' =&amp;gt; [&#xA;        'type' =&amp;gt; '',&#xA;        'category' =&amp;gt; '',&#xA;        'search' =&amp;gt; '',&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and search in PHP&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionSearchElements(string $type, string $category, string $search)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then create a Twig function/filter in order to change those&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/resources/ebooks/{{category.slug}}&quot;&amp;gt;ebooks&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ getSearchUrl({category: category.slug}) }}&quot;&amp;gt;ebooks&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And build your URL based on your route params + overwrite the new category. It will make it more re-usable and easier to change in the future if you would like to add an additional parameter or need to change the order you only need to change one place instead of many&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-17T15:59:28.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27349" PostTypeId="2" ParentId="27345" CreationDate="2018-08-17T16:31:11.397" Score="2" Body="&lt;p&gt;It's basically the same as &lt;a href=&quot;https://craftcms.stackexchange.com/a/27297/5557&quot;&gt;Find entries that use a specific block in their Matrix field?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the base query and left join your Super Table content row&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft&#xA;    .entries()&#xA;    .section(['your-section'])&#xA;    .leftJoin('{{%supertableblocks}} as supertableblocks', '[[supertableblocks.ownerId]] = [[entries.id]]')&#xA;    .leftJoin('{{%stc_content}} as stc_content', '[[stc_content.elementId]] = [[supertableblocks.id]]')&#xA;    .andWhere(['&amp;gt;=', 'stc_content.field_date', entry.date|date('atom')]) &#xA;    .groupBy('supertableblocks.ownerId')&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: this is untested, maybe you need certain modifications it should just be some kind of guidance. Please keep in mind to replace your actual table and field names. I just used &lt;code&gt;stc_content&lt;/code&gt; as a demonstration as well as &lt;code&gt;stc_content.field_date&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-17T16:31:11.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27350" PostTypeId="1" AcceptedAnswerId="27351" CreationDate="2018-08-17T17:05:31.737" Score="1" ViewCount="52" Body="&lt;p&gt;On my site I have some entries with images. In the entry template I paginate the images like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate entry.images.limit(1) as images %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My homepage is a single random entry and I want to paginate it as well. The Problem is, paginate expects an elementcriteriamodel, not an array. So this doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%&#xA;set project = craft.entries()&#xA;    .section('projects')&#xA;    .orderBy('RAND()')&#xA;    .with([&#xA;        ['images', { withTransforms: 'width' }],&#xA;        ['category']&#xA;    ])&#xA;    .one() %}&#xA;{% paginate project.images.limit(1) as images %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14402/eager-load-and-pagination&quot;&gt;this&lt;/a&gt;, but that somehow doesn't work in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set queryParams = {&#xA;    with:[['images', { withTransforms: 'width' }],['category']]&#xA;}&#xA;%}&#xA;&#xA;{%&#xA;set project = craft.entries(queryParams)&#xA;    .section('projects')&#xA;    .orderBy('RAND()')&#xA;    .one() %}&#xA;&#xA;{% paginate project.images.limit(1) as images %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any solutions?&lt;/p&gt;&#xA;" OwnerUserId="4188" LastActivityDate="2018-08-17T17:20:38.057" Title="Pagination and Entry Model on Homepage" Tags="&lt;elementcriteriamodel&gt;&lt;pagination&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27351" PostTypeId="2" ParentId="27350" CreationDate="2018-08-17T17:20:38.057" Score="5" Body="&lt;p&gt;&lt;code&gt;project.images&lt;/code&gt; is an array because you are eager-loading the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you’re only loading one project entry, you’re not actually gaining anything by eager-loading the images (or category), though. In fact, you’re actually slowing things down a bit. Eager-loading does come with a little bit of overhead, so you should only use it when you’ve got an “n+1” problem, as described on the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html&quot; rel=&quot;noreferrer&quot;&gt;Eager-Loading Entries&lt;/a&gt; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to get this working, just remove the &lt;code&gt;with&lt;/code&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set project = craft.entries()&#xA;    .section('projects')&#xA;    .orderBy('RAND()')&#xA;    .one() %}&#xA;&#xA;{% paginate project.images.limit(1) as images %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this will also affect how you access your category, as &lt;code&gt;project.category&lt;/code&gt; will go from an eager-loaded array, back to a &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/category-queries.html&quot; rel=&quot;noreferrer&quot;&gt;category query&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-17T17:20:38.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27352" PostTypeId="2" ParentId="27333" CreationDate="2018-08-17T18:18:51.437" Score="3" Body="&lt;p&gt;Try rewriting your element query like so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries&#xA;.section(['etiquette','style','culture'])&#xA;.requiredReading(true)&#xA;.orderBy('id desc')&#xA;.limit(12)&#xA;.all()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft you can do queries against fields in this way. The &lt;code&gt;where()&lt;/code&gt; isn't necessary for what you're trying to achieve.&lt;/p&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2018-08-17T18:18:51.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27353" PostTypeId="1" CreationDate="2018-08-17T20:27:02.540" Score="1" ViewCount="115" Body="&lt;p&gt;I am getting an error notice in the Squarebit Charge plugin saying This server doesn't support TLS 1.2. but when I check with the hosting provider (Arcustech, the best!) they assure me that the server does indeed support TLS 1.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, I do not see any errors when I look at a charge detail in the connected Stripe account. This has just recently popped up on a few of my projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sense to anyone?&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-10-15T22:09:29.397" Title="Error declaring TLS Version wrong in Charge plugin" Tags="&lt;plugin-charge&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27354" PostTypeId="2" ParentId="27353" CreationDate="2018-08-17T21:19:26.787" Score="2" Body="&lt;p&gt;Stripe changed up some API URLs, which threw off Charge's legacy method for detecting TLS compatibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The erroneous warning is &lt;a href=&quot;https://twitter.com/TopShelfCraft/status/1051954976036028416&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixed&lt;/a&gt; in &lt;a href=&quot;https://topshelfcraft.com/downloads/Charge-2-2-3.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge 2.2.3&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2018-10-15T22:09:29.397" LastActivityDate="2018-10-15T22:09:29.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27355" PostTypeId="2" ParentId="14981" CreationDate="2018-08-18T07:53:38.347" Score="1" Body="&lt;p&gt;Redis and Memcache are both Key value pair storage, their key =&amp;gt; value stores in memory as opposed to disk-based file caching that make is faster to access compare with accessing data from disk&lt;/p&gt;&#xA;&lt;p&gt;Few Interesting properties of Redis:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Redis can be accessed by all the processes of your applications, possibly running on several nodes (something local memory cannot achieve).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Redis memory storage is quite efficient, and done in a separate process. If the application runs on a platform whose memory is garbage collected (node.js, java, etc ...), it allows handling a much bigger memory cache/store. In practice, very large heaps do not perform well with garbage collected languages.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Redis can persist the data on disk if needed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Redis is a bit more than a simple cache: it provides various data structures, various item eviction policies, blocking queues, pub/sub, atomicity, Lua scripting, etc ...&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Redis can replicate its activity with a master/slave mechanism in order to implement high-availability.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8713" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-08-18T17:53:46.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27356" PostTypeId="1" CreationDate="2018-08-18T16:43:39.397" Score="1" ViewCount="36" Body="&lt;p&gt;I want to get list of entries in my section &lt;code&gt;video&lt;/code&gt; related to my current entry&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for video in craft.entries.section('videos').limit('3').relatedTo({targetElement: entry.title, field: 'talents'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;problem is &lt;code&gt;entry.title&lt;/code&gt; is text, but talents is array.&lt;/p&gt;&#xA;" OwnerUserId="8643" LastEditorUserId="5557" LastEditDate="2018-08-18T17:20:58.963" LastActivityDate="2018-08-18T17:23:12.110" Title="Question about &quot;relatedTo&quot;" Tags="&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27357" PostTypeId="2" ParentId="27356" CreationDate="2018-08-18T17:17:48.253" Score="2" Body="&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; parameter accepts an element, the ID of an element, an array if element ids or an object of type &lt;code&gt;EntryQuery&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is to pass the ID rather than the title&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;targetElement: entry.id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore if you use Craft 3 you might want to execute your query by calling &lt;code&gt;.all()&lt;/code&gt;&#xA;&lt;code&gt;talents&lt;/code&gt; doesn't contain an array. It contains an object of type &lt;code&gt;EntryQuery&lt;/code&gt; that can be executed in order to get an array of elements &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-18T17:23:12.110" LastActivityDate="2018-08-18T17:23:12.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27358" PostTypeId="2" ParentId="5272" CreationDate="2018-08-18T18:33:45.433" Score="1" Body="&lt;p&gt;I had this error, except this solution didn't help. Did some digging and managed to fix using method below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My setup: CRAFT CMS 3, WINDOWS, MAMP PRO 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your craft folder you can find the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft &gt; storage &gt; logs &gt; web.log&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cURL error 60 SSL certificate problem: unable to get local issuer certificate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Go to &lt;a href=&quot;https://curl.haxx.se/docs/caextract.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://curl.haxx.se/docs/caextract.html&lt;/a&gt; and download cacert.pem&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit MAMP PRO php ini file (file &gt; edit template &gt; php &gt; current version your using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;add this to the php.ini file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;;;;;;;&#xA;;CURL&#xA;;;;;;;;&#xA;curl.cainfo = &quot;x:PATH TO YOUR FILE\WHERE YOU SAVED IT\cacert.pem&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has to be an absolute file path. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Save, close and reload your server. &lt;/p&gt;&#xA;" OwnerUserId="8714" LastActivityDate="2018-08-18T18:33:45.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27360" PostTypeId="1" AcceptedAnswerId="27363" CreationDate="2018-08-20T02:43:13.557" Score="2" ViewCount="54" Body="&lt;pre&gt;&lt;code&gt;  {% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %}&#xA;            {% if response.success %}&#xA;            {% for tweet in response.data %}&#xA;            {% if tweet.extended_entities.media is defined %}&#xA;            {% for item in tweet.extended_entities.media if item.type == 'photo' %}&#xA;&#xA;            &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ item.media_url.getUrl('footerThumbs') }}&quot; alt=&quot;&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;            {% endif %}&#xA;            {% endfor %}&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws a Runtime error: Impossible to invoke a method (&quot;getUrl&quot;) on a string variable (&quot;&lt;a href=&quot;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&lt;/a&gt;&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other method is possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Imager plugin:&#xA;{% set externalImage = '&lt;a href=&quot;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&lt;/a&gt;' %}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set transformedImages = craft.imager.transformImage(externalImage, [&#xA;                { width: 200, height: 200 }])&#xA;              %}&#xA;         {% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %}&#xA;            {% if response.success %}&#xA;            {% for tweet in response.data %}&#xA;            {% if tweet.extended_entities.media is defined %}&#xA;            {% for item in tweet.extended_entities.media if item.type == 'photo' %}&#xA;&#xA;            &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ externalImage }}&quot; alt=&quot;&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;            {% endif %}&#xA;            {% endfor %}&#xA;            {% endif %}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="5113" LastEditDate="2018-08-20T20:49:50.080" LastActivityDate="2018-08-22T11:30:22.553" Title="Apply imageTransform on twitter media feed" Tags="&lt;image-transforms&gt;&lt;plugin-imager&gt;&lt;plugin-dukttwitter&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27361" PostTypeId="2" ParentId="23151" CreationDate="2018-08-20T03:22:51.280" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://enupal.com/craft-plugins/stripe-payments&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stripe Payments&lt;/a&gt; is available in the plugin store for Craft CMS 3. We just added support to iDEAL for one-time and recurring payments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best,&lt;/p&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2018-08-20T03:22:51.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27362" PostTypeId="2" ParentId="27360" CreationDate="2018-08-20T09:21:48.393" Score="0" Body="&lt;p&gt;As far as I'm aware it's not possible, because the Twitter feed APIs are fed a URL path to the asset on Twitter's server. So Craft never handles the actual asset to be able to crop it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure the P&amp;amp;T guys or Andrew that usually respond to questions will have a suggestion, but I don't think it's really possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best you can do it crop images in CSS using &lt;code&gt;object-fit: cover&lt;/code&gt; in a div the size you want the image to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the actual error you're getting is because &lt;code&gt;item.media_url&lt;/code&gt;is a string for '&lt;a href=&quot;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg&lt;/a&gt;', so it doesn't have a url to access with &lt;code&gt;.getUrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure if it'll work, but you could try &lt;code&gt;item.media_url('footerThumbs')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-08-20T13:04:19.387" LastActivityDate="2018-08-20T13:04:19.387" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27363" PostTypeId="2" ParentId="27360" CreationDate="2018-08-20T10:15:36.047" Score="2" Body="&lt;p&gt;Craft's built-in transform functionality doesn't support transforming external URLs. You could use my &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager plugin&lt;/a&gt; to do this instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your example, you'd use Imager something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %}&#xA;{% if response.success %}&#xA;    {% for tweet in response.data %}&#xA;        {% if tweet.extended_entities.media is defined %}&#xA;            {% for item in tweet.extended_entities.media if item.type == 'photo' %}&#xA;                {% set transformedImage = craft.imager.transformImage(item.media_url, { width: 200, height: 200 }) %}&#xA;                &amp;lt;div&amp;gt;&amp;lt;img src=&quot;{{ transformedImage.url }}&quot; alt=&quot;&quot;/&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, the essential part is that you need to pick up the url to each item in the loop (&lt;code&gt;item.media_url&lt;/code&gt;, if that's what the twitter plugin returns), and do the transform inside the for loop.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2018-08-22T11:30:22.553" LastActivityDate="2018-08-22T11:30:22.553" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27364" PostTypeId="1" CreationDate="2018-08-20T10:16:48.830" Score="4" ViewCount="1950" Body="&lt;p&gt;I'm building my first Craft 3 site, and having problems getting email to send. I've set it to use Sendmail but when I click the Test button in the CP, I get &quot;There was an error testing your email settings&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know Sendmail isn't the best option but I need something for now until we get something more robust in place. My client doesn't yet have any email set up for this domain, but I assume Sendmail should still be able to create email?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using Sendmail from the command line and that seems to work fine. For each attempt to test from the control panel, I get this error in web.log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-08-20 10:02:55 [86.167.235.31][1][-][error][application] Error sending email: Expected response code 220 but got code &quot;&quot;, with message &quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm on Craft 3.0.19. Any ideas what might be going wrong?&lt;/p&gt;&#xA;" OwnerUserId="5765" LastActivityDate="2020-04-09T10:37:46.703" Title="Sendmail not working on Craft 3" Tags="&lt;craft3&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27365" PostTypeId="1" AcceptedAnswerId="27367" CreationDate="2018-08-20T12:12:11.010" Score="2" ViewCount="239" Body="&lt;p&gt;How would one construct this? I have built a little content builder and wish now to change the layout HTML on the fly when there are more than one matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example below, this is just one section of the builder and the one I would like to change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically 'move' the block.text part above the image every 2nd time in the loop. I have looked at batch and loopindex but having trouble for the last few hours. Can someone please help with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Builder code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;splitImageAndText&quot; %}&#xA;    &amp;lt;div class=&quot;grid-x align-center paddingBottom&quot;&amp;gt;&#xA;        {% set images = block.imagePart %}&#xA;&#xA;        {% if images and images|length %}&#xA;            {% set image = block.imagePart.all() %}&#xA;&#xA;            {# Loop through the images #}&#xA;            {% for image in images.all() %}&#xA;                &amp;lt;div class=&quot;cell medium-6 small-12&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;bg-content&quot; style=&quot;background-image:url('{{ image.getUrl() }}');&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&#xA;        &amp;lt;div class=&quot;cell medium-6 small-12 pull-left&quot;&amp;gt;&#xA;            {{ block.textPart }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2236" LastEditorUserId="5845" LastEditDate="2018-08-20T16:09:21.873" LastActivityDate="2018-08-20T16:09:21.873" Title="Loop index inside a switch content builder" Tags="&lt;matrix&gt;&lt;forloop&gt;&lt;loop&gt;&lt;case&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27366" PostTypeId="2" ParentId="27365" CreationDate="2018-08-20T12:21:56.243" Score="1" Body="&lt;p&gt;I belive you can use {% if loop.index is even %} or {% if loop.index is odd %}&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-08-20T12:21:56.243" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27367" PostTypeId="2" ParentId="27365" CreationDate="2018-08-20T12:55:45.283" Score="1" Body="&lt;p&gt;Building on Syversen's answer of how to achieve this, I'd make that text block a partial template so it's only written once and do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;splitImageAndText&quot; %}&#xA;    &amp;lt;div class=&quot;grid-x align-center paddingBottom&quot;&amp;gt;&#xA;        {% set images = block.imagePart %}&#xA;&#xA;        {% if loop.index is even %}&#xA;            {% include 'partials/text-block' %}&#xA;        {% endif %}&#xA;&#xA;        {% if images and images|length %}&#xA;            {% set image = block.imagePart.all() %}&#xA;&#xA;            {# Loop through the images #}&#xA;            {% for image in images.all() %}&#xA;                &amp;lt;div class=&quot;cell medium-6 small-12&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;bg-content&quot; style=&quot;background-image:url('{{ image.getUrl() }}');&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;&#xA;        {% if loop.index is odd %}&#xA;            {% include 'partials/text-block' %}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way, if you ever need to alter the text block markup, it's only in one location instead of having any repeated markup. So in &lt;code&gt;partials/text-block.twig&lt;/code&gt;, I'd have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;cell medium-6 small-12 pull-left&quot;&amp;gt;&#xA;    {{ block.textPart }}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-20T12:55:45.283" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27368" PostTypeId="2" ParentId="19657" CreationDate="2018-08-20T13:53:57.210" Score="1" Body="&lt;p&gt;Just answering this for anyone that may come across this in the future as I have...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you reuse the group tag?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.group(&amp;lt;catgegory here&amp;gt;) %}&#xA;    ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You have probably resolved it due to the age, but your answer would be helpful.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-20T13:53:57.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27369" PostTypeId="2" ParentId="26728" CreationDate="2018-08-20T14:01:09.863" Score="1" Body="&lt;p&gt;Old ticket, I know, but thought I'd answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I use a channel for carousel slides as clients for me have tended to mix and match them on multiple places on a site or stop using them then reusing them a few months later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way they have a pool of instances of reusable slides that won't disappear. Hopefully saving redoing work they've already done a few months prior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I've understood your question, I'd have a channel with two entry types. &quot;Image slide&quot; or &quot;Text slide&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when they add a new one they can choose if they want one with an image or just text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then depending on how you're constructing your pages you just need a Matrix component type that is named 'carousel' with an entries field with the slides channel selected as it's source or just an entries field on it's on in the page entry types you want this carousel to be. (I'd limit it to three or four for UX purposes).&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-20T14:01:09.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27370" PostTypeId="5" CreationDate="2018-08-20T16:27:10.393" Score="0" Body="" OwnerUserId="4" LastEditorUserId="4" LastEditDate="2018-08-20T16:27:10.393" LastActivityDate="2018-08-20T16:27:10.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27371" PostTypeId="4" CreationDate="2018-08-20T16:27:10.393" Score="0" Body="Questions specific to the Craft 2 version of Craft CMS; avoid using for questions applicable to all or multiple versions." OwnerUserId="4" LastEditorUserId="4" LastEditDate="2018-08-20T16:27:10.393" LastActivityDate="2018-08-20T16:27:10.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27372" PostTypeId="2" ParentId="26942" CreationDate="2018-08-20T18:16:00.673" Score="4" Body="&lt;p&gt;I have used SEOmatic for years on Craft 2, but since it became a paid plugin on Craft 3 I trialled other SEO plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realised the extra work needed to make other plugins have a result like SEOmatic's wasn't worth the time over the extra cost to install SEOmatic and be on my way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd recommend SEOmatic, but if you have the time to make a free SEO plugin do what you need it to do, then go for it.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-20T18:16:00.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27373" PostTypeId="1" AcceptedAnswerId="27374" CreationDate="2018-08-20T18:26:39.383" Score="1" ViewCount="68" Body="&lt;p&gt;I'm debugging an Internal Server Error on a site developed by, well, not me. :p The site has an absolutely enormous Matrix field called &quot;Modules&quot;, and the blocks in said field have so many fields that it reaches some sort of &quot;65,536 char row limit&quot; in the database when trying to add new fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, so the most recent block added to this giant Matrix field causes an internal server error whenever it gets added to an entry. The relevant &lt;code&gt;web.log&lt;/code&gt; line is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-08-20 09:25:06 [127.0.0.1][206][h9dtcm3ad2nb50aie3m6t27be3][error][yii\base\Exception] yii\base\Exception: Invalid field handle: resource2Description in [MyProject]\vendor\craftcms\cms\src\base\Element.php:1932&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This was odd, as the Matrix block in question didn't &lt;em&gt;have&lt;/em&gt; a &quot;Resource 2 Description&quot; field in the backend. It &lt;em&gt;did&lt;/em&gt;, however, have &quot;Resource 1 Description&quot; (and 3 other &quot;Resource 1 ____&quot; fields), and the development pattern I've seen in this site leads me to be nearly certain that at some point, someone tried to add or succeeded in adding a &quot;Resource 2 Description&quot; field (side note: consider this my +1 for Matrix-within-Matrix, and yes, I will be converting this morass to Super Table for the time being).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this led me to poking around the database, trying to figure out why parts of Craft thought this field existed, but it wasn't being shown in the backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I found was that the Matrix block in question, which has a &lt;code&gt;tabId&lt;/code&gt; of &lt;code&gt;3275&lt;/code&gt; as referenced in the &lt;code&gt;craft_fieldlayoutfields&lt;/code&gt; table, has only 4 rows in that table (one for each field seen in the backend):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qDtT3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qDtT3.png&quot; alt=&quot;Screenshot of a MySQL table showing four rows with a tabId of 3275&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I looked up those field IDs in &lt;code&gt;craft_fields&lt;/code&gt;, I saw that they had a common &lt;code&gt;context&lt;/code&gt; column, of &lt;code&gt;matrixBlockType:78&lt;/code&gt;. Querying that table for all rows with that same &lt;code&gt;context&lt;/code&gt;, I found the mystery fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BhWUG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BhWUG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at this point I have two theories about what happened:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Option 1: Craft may have a bug of sorts where, if you try to add fields but hit that previously-mentioned 65,536-char row limit, the fields only get partially added to the database and you end up with a mismatch between tables.&lt;/li&gt;&#xA;&lt;li&gt;Option 2: This site had, at one point, upwards of 15,000 rows in the &lt;code&gt;craft_queue&lt;/code&gt; table, due to some stuck 'Pending image transform' tasks that the developers had ignored during development. This was &quot;resolved&quot; by wiping out the contents of &lt;code&gt;craft_queue&lt;/code&gt; wholesale. I suspect that one of those tasks may have been something to do with saving or updating the fields in the Matrix block.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So the actual question is this: Which of those two scenarios (or some other cause I've not thought of) are more likely to result in mismatching database tables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus question at no extra charge: Which would be wiser, A) Manually (editing the database) &quot;restoring&quot; the missing rows for those fields in &lt;code&gt;craft_fieldlayoutfields&lt;/code&gt;, B) Manually deleting those &quot;extra&quot; rows in &lt;code&gt;craft_fields&lt;/code&gt;, or C) Trying to recreating those fields as normal, through the Craft backend?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="3904" LastEditDate="2018-08-20T20:35:59.193" LastActivityDate="2018-08-20T20:35:59.193" Title="What could the possible causes be for a mismatch between `craft_fields` and `craft_fieldlayoutfields` MySQL tables?" Tags="&lt;matrix&gt;&lt;field&gt;&lt;error-message&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27374" PostTypeId="2" ParentId="27373" CreationDate="2018-08-20T18:46:43.677" Score="2" Body="&lt;p&gt;Craft doesn’t do any field operations in the queue, so it must be the first option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a DB backup first, but it should be safe to delete the rows for fields that are not in the Matrix field’s layout. It also wouldn’t hurt to double-check the &lt;code&gt;matrixcontent_modules&lt;/code&gt; table to make sure it doesn’t have columns for those fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also worth noting, you can shrink the size of the table by going over all the sub-fields and checking their Column Type settings (under Advanced). If it’s possible to select smaller column types, you should do it.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-20T18:46:43.677" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27375" PostTypeId="1" AcceptedAnswerId="27502" CreationDate="2018-08-20T21:11:09.557" Score="1" ViewCount="837" Body="&lt;p&gt;I'm having some trouble passing CSRF-tokens in my js-File in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm setting the values in my template like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and call them in my .js-file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = {id: 100 };&#xA;    data[window.csrfTokenName] = window.csrfTokenValue;&#xA;    $.ajax({&#xA;        type: 'POST',&#xA;        url: href,&#xA;        data: data,&#xA;        success: function(result){&#xA;        },&#xA;        error: function(){&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;before i set the csrf tokens, the server returned an error 400 – bad request – as you would expect.&#xA;now i'm getting a 500 internal server error.&#xA;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site works perfect without the ajax-call so I don't think there's an issue with my templates. Tell me if you need to see more of my code.&lt;/p&gt;&#xA;" OwnerUserId="4188" LastEditorUserId="57" LastEditDate="2018-08-23T04:07:57.033" LastActivityDate="2018-08-28T17:09:27.773" Title="CSRF Protection in AJAX post" Tags="&lt;ajax&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27376" PostTypeId="2" ParentId="1454" CreationDate="2018-08-20T21:35:20.063" Score="3" Body="&lt;p&gt;Better late than never... &lt;strong&gt;Craft 3&lt;/strong&gt; (released April 2018) is &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html#step-1-download-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;fully Composer compliant&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-20T21:35:20.063" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27377" PostTypeId="1" AcceptedAnswerId="27379" CreationDate="2018-08-20T23:40:12.283" Score="2" ViewCount="445" Body="&lt;p&gt;I have an entry with an asset field that has up to 3 assets in it. If I want to load just the second asset in my template code, what's the syntax for this? (can't find any references/examples)&lt;/p&gt;&#xA;" OwnerUserId="4962" LastActivityDate="2020-10-05T18:40:47.707" Title="How to get second asset?" Tags="&lt;assets&gt;&lt;assets-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27379" PostTypeId="2" ParentId="27377" CreationDate="2018-08-21T01:51:13.723" Score="1" Body="&lt;p&gt;Image assets are returned in an array. Let's say you have an assets field with the handle of &lt;code&gt;images&lt;/code&gt;. You can just use bracket notation to get the second item in the array using: &lt;code&gt;entry.images[1]&lt;/code&gt;. So if you wanted to return the URL you could just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.images[1].url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-08-21T01:51:13.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27380" PostTypeId="1" CreationDate="2018-08-21T02:12:48.003" Score="1" ViewCount="47" Body="&lt;p&gt;I have the goal of querying the database once for page info, and then using it to display information on select pages site wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I want to link the the contact page with using a url slug like &quot;contact&quot; (which might change)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thinking is to query for pages, then loop over them in twig and create an object which I can access as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some example code, my question is - is the best Craft like way to do this? Am I missing something that should make this easier?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Query for all the Pages&#xA; #}&#xA;{% set navigation = craft.entries.section('pages').all() %}&#xA;&#xA;{#&#xA; # Create an object to quickly reference pages without making additional DB queries #}&#xA; #}&#xA;{% set pageData = [] %}&#xA;&#xA;{% for item in navigation %}&#xA;    {#&#xA;     # create a dynamic property if one doesn't already exist&#xA;     #}&#xA;    {% if not attribute(pageData, 'pageId' ~ item.id) is defined %}&#xA;        {% set pageData = pageData|merge({ ('pageId' ~ item.id) : {&#xA;        'id':item.id,&#xA;        'slug':item.slug,&#xA;        'url':item.url,&#xA;        'title':item.title} }) %}&#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{#&#xA; # Use the pageData object to reference pages by id as needed&#xA; #}&#xA;&amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{pageData.pageId5.url}}&quot; class=&quot;button small alert&quot;&amp;gt;Request a Bid&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="196" LastActivityDate="2018-08-21T02:49:20.920" Title="Access pages data with fewer queries by creating an object in Twig" Tags="&lt;templating&gt;&lt;navigation&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27381" PostTypeId="2" ParentId="27380" CreationDate="2018-08-21T02:49:20.920" Score="1" Body="&lt;p&gt;So the only database queries in your example will be generated by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set navigation = craft.entries.section('pages').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So creating an additional object doesn't serve the stated purpose of saving db queries. You can just access the &lt;code&gt;navigation&lt;/code&gt; array directly.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-21T02:49:20.920" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27382" PostTypeId="1" CreationDate="2018-08-21T06:08:28.417" Score="1" ViewCount="53" Body="&lt;p&gt;I'm attempting my first Craft plugin and trying to update &lt;a href=&quot;https://github.com/matthewattanasio/Craft-Url-Decoder-Twig-Extension&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/matthewattanasio/Craft-Url-Decoder-Twig-Extension&lt;/a&gt; for Craft 3 and followed the instructions in the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html#loading-your-plugin-into-a-craft-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs for loading plugins&lt;/a&gt; which seemed to work in that the plugin appeared in the control panel, but I also got the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[UnexpectedValueException]&#xA;    Package cakephp/core's source key should be specified as {&quot;type&quot;: ..., &quot;url&quot;: ..., &quot;reference&quot;: ...},&#xA;    {&quot;type&quot;:&quot;git&quot;,&quot;url&quot;:&quot;https://github.com/cakephp/core.git&quot;,&quot;reference&quot;:null} given.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and now when I try to run any more composer commands I get the same error so I'm unable to do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer remove package/name&#xA;composer require package/name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;because I've made some changes to file names and need to update it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin is still showing in the CP but showing old information and when I try to install it, I get a server error.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2018-08-22T00:56:43.067" Title="UnexpectedValueException after loading plugin" Tags="&lt;plugin-development&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27383" PostTypeId="2" ParentId="27324" CreationDate="2018-08-21T07:36:23.413" Score="0" Body="&lt;p&gt;If found the answer. You can use an * operator in the search query to check if a category field is not empty. So the solution in my case was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'search' =&amp;gt; lightswitchOne:1 OR lightswitchTwo:1 OR lightswitchThree:1 OR categoryOne:* OR categoryTwo:*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2018-08-21T07:36:23.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27384" PostTypeId="1" CreationDate="2018-08-21T08:20:02.337" Score="0" ViewCount="42" Body="&lt;p&gt;I've update a Craft 2 site to Craft 2.7.0 but since I did no Ajax(?) calls work; I can't clear caches, backup data bases, open a Matrix field,...&#xA;Anyone got an idea what went wrong?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2018-08-21T09:27:14.913" Title="No more Ajax in the control panel after update to Craft 2.7.0" Tags="&lt;updating&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-08-22T04:40:06.767" ContentLicense="CC BY-SA 4.0" />
  <row Id="27385" PostTypeId="2" ParentId="27384" CreationDate="2018-08-21T09:27:14.913" Score="2" Body="&lt;p&gt;Prob solved; I auto updated to Craft 2.7.0 manually, and - stupid me for waiting that long to do that... - I updated it again manually. Problem solved. Case closed&lt;/p&gt;&#xA;" OwnerUserId="4934" LastActivityDate="2018-08-21T09:27:14.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27386" PostTypeId="1" CreationDate="2018-08-21T12:47:43.937" Score="1" ViewCount="85" Body="&lt;p&gt;Having a problem with the Formerly plugin where it is throwing an error if CSS is passed into the Submission body. Not sure if this is a Craft of a Formerly problem but looking into it further, the issue seems to occur when &lt;code&gt;!&lt;/code&gt; or &lt;code&gt;;&lt;/code&gt; are being passed into the &lt;code&gt;templates-&amp;gt;renderObjectTemplate()&lt;/code&gt; service - this results in an &lt;code&gt;Unexpected character&lt;/code&gt; error being returned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how best to sanitise the input for this method so that form submission doesn't break?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-08-23T09:05:06.560" Title="Special characters in `template-&gt;renderObjectTemplate` method" Tags="&lt;plugin-development&gt;&lt;plugins-formerly&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27387" PostTypeId="1" CreationDate="2018-08-21T14:27:24.443" Score="3" ViewCount="1333" Body="&lt;p&gt;I am having a difficult time understanding how to output even a simple variable using a module. Ultimately I have PHP code that I need to execute to generate a PDF. I managed to do this in V2.5. I'm following all the tutorials that I can find, bu none I feel aren't clear. Any recommendations on the simplest of examples, even if it's just outputting a variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7701" LastActivityDate="2021-03-11T10:29:32.137" Title="Basic Module Tutorial or Example" Tags="&lt;modules&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27388" PostTypeId="2" ParentId="27387" CreationDate="2018-08-21T14:55:42.660" Score="4" Body="&lt;p&gt;I haven't tried this tutorial yet, but having learned a lot about Craft 3 from Andrew Welch's other tutorials, I don't doubt this may have some nuggets of useful information to get you on your way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-21T14:55:42.660" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27389" PostTypeId="1" CreationDate="2018-08-21T15:07:19.900" Score="2" ViewCount="311" Body="&lt;p&gt;Entries can have one of two categories and one tag. &#xA;(People = entries | program = categories | year = tag)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the pages I'd like to display entries related to the category and grouped by tag. However, I don't want the tag to display if there are no entries with that tag and in that category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code works, but it displays empty tags that I'd like hidden. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIds = craft.entries.section('fellows').ids() %}&#xA;{% set tags = craft.tags.relatedTo({ sourceElement: entryIds }).groupId(2).find() | reverse %}&#xA;   {% for tag in tags %}&#xA;      &amp;lt;h3&amp;gt;{{ tag.slug }} {{ category.title }}&amp;lt;/h3&amp;gt;&#xA;          {% for entry in craft.entries({&#xA;                            relatedTo: [&#xA;                              'and',&#xA;                              { targetElement: category },&#xA;                              { targetElement: tag },&#xA;                              ],&#xA;                              limit: (null),&#xA;                              }) %}&#xA;           {% include '_entryblock.twig' %} &#xA;           {% endfor %} &#xA;    {% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This currently displays the following — but I don't want it to display 2018 in Program A or 2017 in Program B since neither of those have entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Program A:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/program-a (category)&#xA;  |__2018 (tag)&#xA;  |__2017&#xA;       |__Bono (entry)&#xA;       |__The Edge&#xA;  |__2016&#xA;       |__Ringo&#xA;       |__Paul  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Program B:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/program-b&#xA;  |__2018&#xA;       |__Chris Martin&#xA;       |__Jonny Buckland&#xA;  |__2017&#xA;  |__2016&#xA;       |__Florence&#xA;       |__The Machine  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2018-08-27T00:34:12.727" Title="How do I hide tags in a category that have no entries?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27391" PostTypeId="1" AcceptedAnswerId="27398" CreationDate="2018-08-21T16:40:40.113" Score="2" ViewCount="402" Body="&lt;p&gt;Checkout / Payment is being handled entirely by a 3rd Party. What would be the correct process to mark an Order as Paid via a custom Craft plugin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Order will already have been converted from a Cart to an Order and assigned an Order Status via a previous step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3rd Party will be calling a series of API endpoints exposed by a custom Craft plugin to process the various steps of the Order. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: For future reference, base on Luke's answer below, this is the code I got to work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$orderNumber = &quot;XXXX-XXXX-XXXX-XXXX&quot;;&#xA;&#xA;$order = craft()-&amp;gt;commerce_orders-&amp;gt;getOrderByNumber($orderNumber);&#xA;&#xA;$transaction = craft()-&amp;gt;commerce_transactions-&amp;gt;createTransaction($order);&#xA;&#xA;$transaction-&amp;gt;status = Commerce_TransactionRecord::STATUS_SUCCESS;&#xA;$transaction-&amp;gt;type = Commerce_TransactionRecord::TYPE_PURCHASE;&#xA;&#xA;craft()-&amp;gt;commerce_transactions-&amp;gt;saveTransaction($transaction);&#xA;&#xA;craft()-&amp;gt;commerce_orders-&amp;gt;updateOrderPaidTotal($order);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="142" LastEditorUserId="142" LastEditDate="2018-08-22T07:21:06.763" LastActivityDate="2020-10-25T16:27:08.423" Title="Mark a Commerce Order as Paid, via a custom plugin" Tags="&lt;plugin-craftcommerce&gt;&lt;payment&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27392" PostTypeId="2" ParentId="27389" CreationDate="2018-08-21T18:17:26.690" Score="1" Body="&lt;p&gt;Here's a good tutorial on how to achieve this: &lt;a href=&quot;https://straightupcraft.com/articles/how-do-i-only-display-a-list-of-categories-that-have-entries-and-hide-empty-categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/how-do-i-only-display-a-list-of-categories-that-have-entries-and-hide-empty-categories&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-21T18:17:26.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27393" PostTypeId="1" AcceptedAnswerId="27394" CreationDate="2018-08-21T19:18:06.767" Score="2" ViewCount="478" Body="&lt;p&gt;I have a multisite setup and and a search bar at the top of each site. Currently it just searches within that site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set theSite = craft.app.request.getSegment(1) %}&#xA;{% paginate craft.entries.search(search).site(theSite).orderBy('score').limit(9) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first segment defines the site.&#xA;I need to expand the searches to include all entries in all sites. Is this possible? I tried variations of getAllSites and just .site but of course those didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If its not possible to search all sites at once I may look at running each search and adding all of the results together.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2019-03-18T21:35:07.877" Title="Search all Sites on Multisite" Tags="&lt;search&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27394" PostTypeId="2" ParentId="27393" CreationDate="2018-08-21T21:35:57.690" Score="1" Body="&lt;p&gt;The Entries Query only allows you to search one site at a time.  Here is the documentation for the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#site&quot; rel=&quot;nofollow noreferrer&quot;&gt;Site Object&lt;/a&gt; or &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#siteid&quot; rel=&quot;nofollow noreferrer&quot;&gt;Site Id&lt;/a&gt; query params.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get each site by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.allSites %}&#xA;{% for site in sites %}&#xA;    …        &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="331" LastActivityDate="2018-08-21T21:35:57.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27395" PostTypeId="1" AcceptedAnswerId="27421" CreationDate="2018-08-21T23:02:56.333" Score="0" ViewCount="1140" Body="&lt;p&gt;When trying to update CraftCMS I'm getting the following errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: An error occurred&#xA;&#xA;Output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- Installation request for craftcms/cms 3.0.21 -&amp;gt; satisfiable by craftcms/cms[3.0.21].&#xA;- craftcms/cms 3.0.21 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;Problem 2&#xA;- craftcms/ckeditor 1.0.0-beta.2 requires craftcms/cms ^3.0.0-RC1 -&amp;gt; satisfiable by craftcms/cms[3.0.21].&#xA;- craftcms/ckeditor 1.0.0-beta.2 requires craftcms/cms ^3.0.0-RC1 -&amp;gt; satisfiable by craftcms/cms[3.0.21].&#xA;- craftcms/cms 3.0.21 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;- Installation request for craftcms/ckeditor 1.0.0-beta.2 -&amp;gt; satisfiable by craftcms/ckeditor[1.0.0-beta.2].&#xA;&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, the following is all OK:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;composer update comes back with &quot;Nothing to Install&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="45" LastEditDate="2018-08-22T04:37:52.130" LastActivityDate="2018-08-23T15:12:30.077" Title="Unable to Update Craft CMS &amp; Plugins" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ClosedDate="2018-09-07T16:09:57.907" ContentLicense="CC BY-SA 4.0" />
  <row Id="27397" PostTypeId="2" ParentId="27382" CreationDate="2018-08-22T00:56:43.067" Score="1" Body="&lt;p&gt;The solution was to replace all references to &lt;code&gt;&quot;reference&quot;:null&lt;/code&gt; with  &lt;code&gt;&quot;reference&quot;:&quot;&quot;&lt;/code&gt; in &lt;code&gt;/craft/vendor/composer/installed.json&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2018-08-22T00:56:43.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27398" PostTypeId="2" ParentId="27391" CreationDate="2018-08-22T05:38:01.090" Score="2" Body="&lt;p&gt;Your best bet would be to create a transaction for the full amount:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$transaction = Plugin::getInstance()-&amp;gt;transactions-&amp;gt;createTransaction($order);&#xA;$transaction-&amp;gt;status = \craft\commerce\records\Transaction::STATUS_SUCCESS;&#xA;$transaction-&amp;gt;type = \craft\commerce\records\Transaction::TYPE_PURCHASE;&#xA;Plugin::getInstance()-&amp;gt;transactions-&amp;gt;saveTransaction($transaction);&#xA;$order-&amp;gt;updateOrderPaidTotal();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-08-22T05:38:01.090" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27399" PostTypeId="1" CreationDate="2018-08-22T09:34:29.750" Score="2" ViewCount="194" Body="&lt;p&gt;I am currently building a website that consist almost entirely of blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are quite a few pages that use the same blocks, but sometimes with slightly different content and not always in the same order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built a matrix field to construct each page out of these blocks and most of these blocks have their own template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in matrix %}&#xA;&#xA;  {% if block.type == 'type1' %}&#xA;    {% include 'type1.twig' %}&#xA;&#xA;  {% elseif block.type == 'type2' %}&#xA;    {% include 'type2.twig' %}&#xA;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some of these blocks however, also have for loops in them accessing matrix fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if it is possible to use {% cache %} tags around my for loop that loops through all the basic blocks, and then within my block templates another {% cache %} tag but with the globally parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in short, can I safely use cache tags inside other cache tags?&lt;/p&gt;&#xA;" OwnerUserId="8722" LastActivityDate="2018-09-23T06:00:43.627" Title="Using {% cache globally %} inside {% cache %}" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27400" PostTypeId="1" AcceptedAnswerId="27589" CreationDate="2018-08-22T11:03:53.867" Score="1" ViewCount="572" Body="&lt;p&gt;I have just tried to log into an old local Craft 3 project that hasn't been worked on in a few months and I'm getting the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;HTTP 400 – Bad Request – yii\web\BadRequestHttpException&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Unable to verify your data submission.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\web\BadRequestHttpException: Unable to verify your data submission. in /Users/user/Development/project/build/vendor/yiisoft/yii2/web/Controller.php:166&#xA;Stack trace:&#xA;#0 /Users/user/Development/project/build/vendor/craftcms/cms/src/web/Controller.php(82): yii\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;#1 /Users/user/Development/project/build/vendor/yiisoft/yii2/base/Controller.php(155): craft\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;#2 /Users/user/Development/project/build/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller-&amp;gt;runAction('login', Array)&#xA;#3 /Users/user/Development/project/build/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('login', Array)&#xA;#4 /Users/user/Development/project/build/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('users/login', Array)&#xA;#5 /Users/user/Development/project/build/vendor/craftcms/cms/src/web/Application.php(538): craft\web\Application-&amp;gt;runAction('users/login', Array)&#xA;#6 /Users/user/Development/project/build/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#7 /Users/user/Development/project/build/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#8 /Users/user/Development/project/build/public/index.php(42): yii\base\Application-&amp;gt;run()&#xA;#9 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The front end of the site fine, the login page at &lt;code&gt;/admin&lt;/code&gt; works and I've restarted MAMP multiple times. I have also locally run &lt;code&gt;composer update&lt;/code&gt; in case there were any issues with my packages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But nothing seems to make it want to successfully sign me in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After more research, a lot of people have had their issues like this resolved by clearing the cache of their browser. I have tried this in three separate browsers all to no improvement.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-09-02T22:32:21.123" LastActivityDate="2019-08-07T02:33:30.993" Title="400 error logging into local Craft 3 project" Tags="&lt;control-panel&gt;&lt;admin&gt;&lt;login&gt;&lt;yii&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27401" PostTypeId="1" AcceptedAnswerId="27405" CreationDate="2018-08-22T14:30:48.633" Score="1" ViewCount="209" Body="&lt;p&gt;Building on this question here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2830/create-line-breaks-from-text-field/2834&quot;&gt;Create line breaks from text field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What approach would be best for breaking a multi line plain text field into multiple single lines to be used as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;{{ textfield.lineOne }}&amp;lt;/span&amp;gt;&#xA;&amp;lt;span&amp;gt;{{ textfield.lineTwo }}&amp;lt;/span&amp;gt;&#xA;&amp;lt;span&amp;gt;{{ textfield.lineThree }}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the moment, my approach is to use a Matrix for the user to be able to add individual lines, but I'd much rather I was able to present the client with a multiline text field and rework them in the template.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-22T17:18:50.867" Title="How to create single lines from a plain text field with line breaks" Tags="&lt;templating&gt;&lt;plaintext&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27402" PostTypeId="1" AcceptedAnswerId="27406" CreationDate="2018-08-22T16:32:08.220" Score="1" ViewCount="15" Body="&lt;p&gt;We have hundreds of entries with the improperly spelled tag &quot;accessibilty&quot; (the third i is missing). A search for &quot;accessibil&lt;strong&gt;i&lt;/strong&gt;ty&quot; will not find them (spelled correctly). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I edited the tag on a record and it seems all the records have updated (in the control panel). That is, the tag is spelled correctly on all records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search however, does not find them. Both in the control panel and using craft.entries.search('accessibility') only return the ONE record that I edited. If I search for the misspelled tag ('accessibilty') I get all the remaining results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've emptied all caches.&lt;/p&gt;&#xA;" OwnerUserId="7491" LastActivityDate="2018-08-22T17:29:08.290" Title="Editing a tag not reflecting on all records.. kindof" Tags="&lt;cache&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27403" PostTypeId="2" ParentId="27401" CreationDate="2018-08-22T16:48:40.930" Score="2" Body="&lt;p&gt;I've made a little macro for this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro splitText(text) %}&#xA;  {% set text = text|nl2br|raw %}&#xA;  {% set text = '&amp;lt;span class=&quot;split_text&quot;&amp;gt;' ~ text|replace('&amp;lt;br /&amp;gt;', '&amp;lt;/span&amp;gt; &amp;lt;span class=&quot;split_text&quot;&amp;gt;') ~ '&amp;lt;/span&amp;gt;' %}&#xA;  {{ text|raw }}&#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may need to tweak it a bit, but this is what worked for me.&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2018-08-22T16:48:40.930" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27405" PostTypeId="2" ParentId="27401" CreationDate="2018-08-22T17:18:50.867" Score="2" Body="&lt;pre&gt;&lt;code&gt;{% set text %}&#xA;    Here is some&#xA;    Text that spans&#xA;    multiple lines&#xA;{% endset %}&#xA;&#xA;{% set textArray = text | split('\n') | filter %}&#xA;&#xA;{% for line in textArray %}&#xA;    &amp;lt;span&amp;gt;{{ line }}&amp;lt;/span&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="31" LastActivityDate="2018-08-22T17:18:50.867" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27406" PostTypeId="2" ParentId="27402" CreationDate="2018-08-22T17:29:08.290" Score="2" Body="&lt;p&gt;That's because your search indexes still contain the wrong word. Please go to your utilities section in your CP and rebuild the search indexes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MlzeH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MlzeH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making changes in the DB directly is sometimes not a good idea if you don't know the consequences it might have. You should have changed the title via CP rather than via DB&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-22T17:29:08.290" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27407" PostTypeId="2" ParentId="26020" CreationDate="2018-08-22T18:10:37.847" Score="2" Body="&lt;p&gt;I believe they've added the documentation you're wanting here: &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/content-mapping/field-types#assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/content-mapping/field-types#assets&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;h1&gt;Assets&lt;/h1&gt;&#xA;&lt;p&gt;Accepts single or multiple values. You should supply the filename only, excluding the full path to the asset, but including the filename. If you're uploading remote assets, you'll need to produce fully-qualified URLs.&lt;/p&gt;&#xA;&lt;h3&gt;Additional Options&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Upload remote asset (choose how to handle existing assets - Replace/Keep/Ignore)&lt;/li&gt;&#xA;&lt;li&gt;Inner-element fields&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Asset&amp;gt;my_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;// Or&#xA;&amp;lt;Assets&amp;gt;&#xA;    &amp;lt;Asset&amp;gt;my_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;    &amp;lt;Asset&amp;gt;my_other_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;&amp;lt;/Assets&amp;gt;&#xA;&#xA;//&#xA;// When selecting upload&#xA;//&#xA;&amp;lt;Asset&amp;gt;http://mydomain.com/my_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;&#xA;// Or&#xA;&amp;lt;Assets&amp;gt;&#xA;    &amp;lt;Asset&amp;gt;http://mydomain.com/my_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;    &amp;lt;Asset&amp;gt;http://mydomain.com/my_other_filename.jpg&amp;lt;/Asset&amp;gt;&#xA;&amp;lt;/Assets&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3904" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-08-22T18:10:37.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27408" PostTypeId="1" CreationDate="2018-08-22T18:36:03.190" Score="1" ViewCount="1250" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6tsDX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6tsDX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm new with Craft CMS and receive this error when I try to install it&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;-------------------ERROR-----------------------------&lt;/p&gt;&#xA;&lt;p&gt;An Error occurred while handling another error:&#xA;yii\web\ServerErrorHttpException: The info table is missing its row in C:\xampp\htdocs\craft\vendor\craftcms\cms\src\base\ApplicationTrait.php:512&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8723" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2020-06-03T11:18:23.800" Title="yii\web\ServerErrorHttpException Craft 3 install" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27410" PostTypeId="1" AcceptedAnswerId="27411" CreationDate="2018-08-22T22:31:12.340" Score="1" ViewCount="82" Body="&lt;p&gt;I would like to trigger an info window in Smart Map using a navigation that lives beside the map. I've managed to figure out how to use the zoomOnMarker function, however, the info window does not pop with this function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a onclick=&quot;smartMap.zoomOnMarker('smartmap-mapcanvas-1', 'smartmap-mapcanvas-1.{{ entry.id }}.address', 15)&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2021-01-01T07:10:29.977" Title="Trigger Info window in Smart Map using external navigation" Tags="&lt;plugin-smartmap&gt;&lt;google-maps&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27411" PostTypeId="2" ParentId="27410" CreationDate="2018-08-22T22:45:19.883" Score="2" Body="&lt;p&gt;When conducting a proximity search, it's common practice to display a list of nearest locations, alongside a map displaying markers of nearest locations.&lt;/p&gt;&#xA;&lt;p&gt;You may want each marker's &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/adding-marker-info-bubbles/&quot; rel=&quot;nofollow noreferrer&quot;&gt;info bubble&lt;/a&gt; to open when clicking on the text link.&lt;/p&gt;&#xA;&lt;p&gt;You'll need a JavaScript function to handle opening the info windows.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;function openInfoWindow(mapId, fieldHandle, entryId) {&#xA;&#xA;    // Prep to open info window&#xA;    var markerName = mapId + '.' + entryId + '.' + fieldHandle;&#xA;    var map        = smartMap.map[mapId];&#xA;    var marker     = smartMap.marker[markerName];&#xA;    var infoWindow = smartMap.infoWindow[markerName];&#xA;&#xA;    // Close all open info windows&#xA;    for (var i in smartMap.infoWindow) {&#xA;        smartMap.infoWindow[i].close();&#xA;    }&#xA;&#xA;    // Open new info window&#xA;    infoWindow.open(map, marker);&#xA;&#xA;    // Zoom to marker&#xA;    var zoomLevel = 6;&#xA;    smartMap.zoomOnMarker(mapId, markerName, zoomLevel);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When you loop through your entries to generate the results list, you can attach an &lt;code&gt;onclick&lt;/code&gt; event which calls your function.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in allEntries %}&#xA;&#xA;    &amp;lt;div onclick=&amp;quot;openInfoWindow('smartmap-mapcanvas-1', 'myAddressField', {{ entry.id }})&amp;quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;p&amp;gt;{{ entry.myAddressField.distance }} miles away&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For more information, check out the documentation for &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/manipulating-the-map-in-javascript/&quot; rel=&quot;nofollow noreferrer&quot;&gt;manipulating the map in JavaScript...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-01T07:10:29.977" LastActivityDate="2021-01-01T07:10:29.977" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27412" PostTypeId="2" ParentId="16760" CreationDate="2018-08-23T00:39:33.077" Score="2" Body="&lt;p&gt;I try to avoid too many plugin dependencies and user exposure to embed code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those reasons my setup has just one input field for YouTube videos, &quot;YouTube ID&quot;, which is the video's ID users copy and paste after they've found the video they're after on YouTube.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is part of a Matrix field that allows users to insert all kinds of components (text, quotes, videos etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It'll take you only a few minutes to set up in the fields, not much code for the Matrix, and gives you a DRY component for videos.&lt;/p&gt;&#xA;" OwnerUserId="8596" LastActivityDate="2018-08-23T00:39:33.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27414" PostTypeId="2" ParentId="27386" CreationDate="2018-08-23T09:05:06.560" Score="1" Body="&lt;p&gt;The has been solved (kinda) - turns out CSS was being passed into the &lt;code&gt;renderObjectTemplate&lt;/code&gt; method for an email template. This meant that Twig was (understandably) trying to process the &lt;code&gt;{&lt;/code&gt; and &lt;code&gt;}&lt;/code&gt; characters as objects which was causing the service to throw a wobble. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have stripped out the CSS for now and will see if there is another way we can pass these characters into the service without breaking it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks @robin on the CraftCMS Slack for help identifying and debugging the problem.&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-08-23T09:05:06.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27417" PostTypeId="1" AcceptedAnswerId="27419" CreationDate="2018-08-23T12:43:34.133" Score="4" ViewCount="1147" Body="&lt;p&gt;When I do &lt;code&gt;composer create-project craftcms/craft&lt;/code&gt;, it will create a &lt;code&gt;web&lt;/code&gt; folder. My webroot is called &lt;code&gt;public_html&lt;/code&gt; though. Can I change this somehow, or should I make a symlink? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or simply don't use composer to install in that case?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastEditorUserId="8325" LastEditDate="2018-08-23T13:49:14.103" LastActivityDate="2018-08-23T16:11:49.957" Title="Craft install via composer: install to public_html?" Tags="&lt;install&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27418" PostTypeId="1" CreationDate="2018-08-23T12:55:36.627" Score="1" ViewCount="93" Body="&lt;p&gt;I'm using Craft Commerce v2 on a Craft 3 Pro website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The checkout process of the shop includes a number of forms such as the ones that visitor can use to add or edit shopping and billing addresses. All the templates are based on the demo templates for Craft Commerce and I haven't created any of those input fields using &lt;code&gt;Settings &amp;gt; Fields&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When an error occurs in one of those forms, an error message is displayed as expected under each input field. However, the error messages are not fully localized. For example, if a field is required and the form is submitted without a value for that field, then the error message appears localised except for the title of the required field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this error message: &lt;code&gt;The field &quot;First Name&quot; must not be empty.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the name of the field, &lt;code&gt;First Name&lt;/code&gt;, is not localized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;code&gt;Το «First Name» δεν μπορεί να είναι κενό.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I localize the &lt;code&gt;«First Name»&lt;/code&gt; part?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastEditorUserId="5881" LastEditDate="2018-09-04T08:25:27.540" LastActivityDate="2018-09-04T08:25:27.540" Title="Is there a way to localise error messages in Craft Commerce 2?" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27419" PostTypeId="2" ParentId="27417" CreationDate="2018-08-23T12:56:29.897" Score="7" Body="&lt;p&gt;You can just rename &lt;code&gt;web/&lt;/code&gt; to &lt;code&gt;public_html/&lt;/code&gt;, or move all the files inside &lt;code&gt;web/&lt;/code&gt; into &lt;code&gt;public_html/&lt;/code&gt;. (Don’t forget to move the &lt;code&gt;.htaccess&lt;/code&gt; and &lt;code&gt;.env&lt;/code&gt; files, if the latter.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as the location of the &lt;code&gt;public_html/&lt;/code&gt; folder is in the same place as the &lt;code&gt;web/&lt;/code&gt; folder was, you don’t need to change anything else.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-project.test/&#xA;├── config/&#xA;├── ...&#xA;└── public_html/&#xA;    ├── index.php&#xA;    └── ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to change the location to something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-project.test/&#xA;├── craft/&#xA;│   ├── config/&#xA;│   └── ...&#xA;└── public_html/&#xA;    ├── index.php&#xA;    └── ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then just make sure that your &lt;code&gt;CRAFT_BASE_PATH&lt;/code&gt; constant points to the right base path (&lt;code&gt;craft/&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// old:&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;&#xA;// new:&#xA;define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-08-23T16:11:49.957" LastActivityDate="2018-08-23T16:11:49.957" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27421" PostTypeId="2" ParentId="27395" CreationDate="2018-08-23T14:01:27.977" Score="1" Body="&lt;p&gt;The original composer file that caused the error above looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;&quot;description&quot;: &quot;Craft CMS&quot;,&#xA;&quot;keywords&quot;: [&#xA;&quot;craft&quot;,&#xA;&quot;cms&quot;,&#xA;&quot;craftcms&quot;,&#xA;&quot;project&quot;&#xA;],&#xA;&quot;license&quot;: &quot;MIT&quot;,&#xA;&quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;&quot;type&quot;: &quot;project&quot;,&#xA;&quot;support&quot;: {&#xA;&quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;&quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;&quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;&quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;&quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;&quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;},&#xA;&quot;require&quot;: {&#xA;&quot;craftcms/cms&quot;: &quot;3.0.13.1&quot;,&#xA;&quot;vlucas/phpdotenv&quot;: &quot;v2.4.0&quot;,&#xA;&quot;craftcms/ckeditor&quot;: &quot;1.0.0-beta.2&quot;,&#xA;&quot;craftcms/redactor&quot;: &quot;2.1.5&quot;,&#xA;&quot;cebe/markdown&quot;: &quot;1.1.2&quot;,&#xA;&quot;composer/ca-bundle&quot;: &quot;1.1.1&quot;,&#xA;&quot;composer/composer&quot;: &quot;1.6.3&quot;,&#xA;&quot;composer/semver&quot;: &quot;1.4.2&quot;,&#xA;&quot;composer/spdx-licenses&quot;: &quot;1.3.0&quot;,&#xA;&quot;craftcms/oauth2-craftid&quot;: &quot;1.0.0.1&quot;,&#xA;&quot;craftcms/plugin-installer&quot;: &quot;1.5.2&quot;,&#xA;&quot;craftcms/server-check&quot;: &quot;1.1.1&quot;,&#xA;&quot;creocoder/yii2-nested-sets&quot;: &quot;0.9.0&quot;,&#xA;&quot;danielstjules/stringy&quot;: &quot;3.1.0&quot;,&#xA;&quot;doctrine/lexer&quot;: &quot;v1.0.1&quot;,&#xA;&quot;egulias/email-validator&quot;: &quot;2.1.4&quot;,&#xA;&quot;elvanto/litemoji&quot;: &quot;1.3.1&quot;,&#xA;&quot;enshrined/svg-sanitize&quot;: &quot;0.8.2&quot;,&#xA;&quot;ezyang/htmlpurifier&quot;: &quot;v4.10.0&quot;,&#xA;&quot;guzzlehttp/guzzle&quot;: &quot;6.3.3&quot;,&#xA;&quot;guzzlehttp/promises&quot;: &quot;v1.3.1&quot;,&#xA;&quot;guzzlehttp/psr7&quot;: &quot;1.4.2&quot;,&#xA;&quot;justinrainbow/json-schema&quot;: &quot;5.2.7&quot;,&#xA;&quot;league/flysystem&quot;: &quot;1.0.44&quot;,&#xA;&quot;league/oauth2-client&quot;: &quot;2.2.1&quot;,&#xA;&quot;mikehaertl/php-shellcommand&quot;: &quot;1.2.5&quot;,&#xA;&quot;paragonie/random_compat&quot;: &quot;v2.0.12&quot;,&#xA;&quot;pixelandtonic/imagine&quot;: &quot;v0.7.1.3&quot;,&#xA;&quot;psr/http-message&quot;: &quot;1.0.1&quot;,&#xA;&quot;psr/log&quot;: &quot;1.0.2&quot;,&#xA;&quot;seld/cli-prompt&quot;: &quot;1.0.3&quot;,&#xA;&quot;seld/jsonlint&quot;: &quot;1.7.1&quot;,&#xA;&quot;seld/phar-utils&quot;: &quot;1.0.1&quot;,&#xA;&quot;swiftmailer/swiftmailer&quot;: &quot;v6.0.2&quot;,&#xA;&quot;symfony/console&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/debug&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/filesystem&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/finder&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/polyfill-mbstring&quot;: &quot;v1.8.0&quot;,&#xA;&quot;symfony/process&quot;: &quot;v3.3.6&quot;,&#xA;&quot;twig/twig&quot;: &quot;v2.4.8&quot;,&#xA;&quot;yiisoft/yii2&quot;: &quot;2.0.15.1&quot;,&#xA;&quot;yiisoft/yii2-bootstrap&quot;: &quot;2.0.8&quot;,&#xA;&quot;yiisoft/yii2-composer&quot;: &quot;2.0.6&quot;,&#xA;&quot;yiisoft/yii2-debug&quot;: &quot;2.0.13&quot;,&#xA;&quot;yiisoft/yii2-queue&quot;: &quot;2.0.2&quot;,&#xA;&quot;yiisoft/yii2-swiftmailer&quot;: &quot;2.1.1&quot;,&#xA;&quot;zendframework/zend-escaper&quot;: &quot;2.6.0&quot;,&#xA;&quot;zendframework/zend-feed&quot;: &quot;2.8.0&quot;,&#xA;&quot;zendframework/zend-stdlib&quot;: &quot;3.2.0&quot;,&#xA;&quot;solspace/craft3-freeform&quot;: &quot;2.2.1&quot;&#xA;},&#xA;&quot;autoload&quot;: {&#xA;&quot;psr-4&quot;: {&#xA;  &quot;modules\\&quot;: &quot;modules/&quot;&#xA;}&#xA;},&#xA;&quot;config&quot;: {&#xA;&quot;optimize-autoloader&quot;: true,&#xA;&quot;platform&quot;: {&#xA;&quot;php&quot;: &quot;7.0&quot;&#xA;}&#xA;},&#xA;&quot;scripts&quot;: {&#xA;&quot;post-root-package-install&quot;: [&#xA;&quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;],&#xA;&quot;post-create-project-cmd&quot;: [&#xA;&quot;@composer dump-autoload -o&quot;,&#xA;&quot;@php craft setup/welcome&quot;&#xA;]&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I removed &quot;enshrined/svg-sanitize&quot;: &quot;0.8.2&quot;, from the list in the compser file, and ran the update. The next error was given for Twig. So I deleted &quot;&quot;twig/twig&quot;: &quot;v2.4.8&quot; from the file, and ran the update again. This time it was successful, and the composer file now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;&quot;description&quot;: &quot;Craft CMS&quot;,&#xA;&quot;keywords&quot;: [&#xA;&quot;craft&quot;,&#xA;&quot;cms&quot;,&#xA;&quot;craftcms&quot;,&#xA;&quot;project&quot;&#xA;],&#xA;&quot;license&quot;: &quot;MIT&quot;,&#xA;&quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;&quot;type&quot;: &quot;project&quot;,&#xA;&quot;support&quot;: {&#xA;&quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;&quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;&quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;&quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;&quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;&quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;},&#xA;&quot;require&quot;: {&#xA;&quot;craftcms/cms&quot;: &quot;3.0.20&quot;,&#xA;&quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;&quot;craftcms/redactor&quot;: &quot;2.1.5&quot;&#xA;},&#xA;&quot;autoload&quot;: {&#xA;&quot;psr-4&quot;: {&#xA;&quot;modules\\&quot;: &quot;modules/&quot;&#xA;}&#xA;},&#xA;&quot;config&quot;: {&#xA;&quot;optimize-autoloader&quot;: true,&#xA;&quot;platform&quot;: {&#xA;&quot;php&quot;: &quot;7.0&quot;&#xA;}&#xA;},&#xA;&quot;scripts&quot;: {&#xA;&quot;post-root-package-install&quot;: [&#xA;&quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;],&#xA;&quot;post-create-project-cmd&quot;: [&#xA;&quot;@composer dump-autoload -o&quot;,&#xA;&quot;@php craft setup/welcome&quot;&#xA;]&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the update seems to remove a lot of the required references in the composer file. I tried doing this on a backup install first before doing the same on the live install.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="6614" LastEditDate="2018-08-23T15:12:30.077" LastActivityDate="2018-08-23T15:12:30.077" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27422" PostTypeId="1" AcceptedAnswerId="27433" CreationDate="2018-08-23T15:43:02.203" Score="1" ViewCount="519" Body="&lt;p&gt;I have quite a simple registration form, something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;        window.csrfTokenName = &quot;{{ craft.config.get('csrfTokenName') }}&quot;;&#xA;        window.csrfTokenValue = &quot;{{ craft.request.getCsrfToken }}&quot;;&#xA;    &amp;lt;/script&amp;gt;&#xA;&#xA;    &amp;lt;form id=&quot;registerUser&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; class=&quot;flex-stack&quot; novalidate @submit.prevent=&quot;userFormValidation()&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;                        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;user/registration-success&quot;&amp;gt;&#xA;&#xA;                        &amp;lt;label for=&quot;username&quot;&amp;gt;{{ &quot;Username (no spaces)&quot;|t }} &amp;lt;em&amp;gt;*&amp;lt;/em&amp;gt;&amp;lt;/label&amp;gt;&#xA;                        &amp;lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot; v-model.lazy.trim=&quot;user.userDetails.userName&quot; :class=&quot;{ 'error-field': usernameHasError }&quot; required&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gets passed to VueJS (which works). There I have the default code I find in every AJAX post on Craft StackExchange:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var data = $('#registerUser').serializeArray();&#xA;&#xA;            //--- Add CSRF token to data&#xA;            data[window.csrfTokenName] = window.csrfTokenValue;&#xA;&#xA;            $.ajax({&#xA;                type: &quot;POST&quot;,&#xA;                data: data,&#xA;                url: &quot;&quot;,&#xA;                success: function(data, response){&#xA;                    console.log(&quot;success&quot;, response, data);&#xA;                },&#xA;                error: function(response) {&#xA;                    console.log(&quot;error&quot;, response);&#xA;                }&#xA;            });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works when the CSRF is disabled in the config, but when enabled, I always get a &lt;strong&gt;bad request, CSRF token invalid error&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong here? There's no Craft caching going on.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-08-24T07:46:48.153" Title="Another AJAX CSRF question" Tags="&lt;form&gt;&lt;ajax&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27423" PostTypeId="2" ParentId="17546" CreationDate="2018-08-23T15:54:22.107" Score="2" Body="&lt;p&gt;This is how I got the errors to show:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if charge is defined and (charge.getErrors or charge.user) %}&#xA;    &amp;lt;div&amp;gt;&#xA;        {% if charge.getErrors %}&#xA;            {% for error in charge.getErrors('general') %}&#xA;                {{ error }}&#xA;            {% endfor %}&#xA;            {% for key, error in charge.getErrors %}&#xA;                {% if key != 'general' %}&#xA;                    {{ error[0] }}&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;        {% if charge.user %}&#xA;            {% for key, error in charge.user.getErrors %}&#xA;                {% if key != 'general' %}&#xA;                    {{ error[0] }}&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then included:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;payment-errors&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before the submit button (as they are loaded using JS)&lt;/p&gt;&#xA;" OwnerUserId="7312" LastActivityDate="2018-08-23T15:54:22.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27425" PostTypeId="1" CreationDate="2018-08-23T18:21:57.203" Score="1" ViewCount="55" Body="&lt;p&gt;I'd like to be able to attach custom JS to a Sprout Form which can be managed in the form builder. I need to add logic that will switch the email address of the recipient based on a choice from a select menu. For example, &quot;Website Issues&quot; goes to &quot;websupport@mywebsite.com&quot;, and &quot;Information&quot; goes to &quot;info@mywebsite.com&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally this JS would be managed at the form builder level so it only loads for that specific form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm in the testing phase of Sprout Forms, so I apologize if I'm missing something obvious.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-08-23T22:34:51.150" Title="Can I add custom JS to Sprout Form?" Tags="&lt;plugin-sproutforms&gt;&lt;javascript&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27427" PostTypeId="2" ParentId="27425" CreationDate="2018-08-23T22:34:51.150" Score="1" Body="&lt;p&gt;You can do this with the default Email Dropdown field (no JS needed!). The Email Dropdown field lets you create a mapping between an item in the dropdown and an email:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Website Issues: websupport@mywebsite.com&#xA;Information: info@mywebsite.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Email Dropdown field obscures those emails in your template. And when you set up your Notification Email, you can reference your Email Dropdown field by its handle in your Recipients setting: &lt;code&gt;{emailDropdownFieldHandle}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case you ever did wish to add JS to your templates, the best way to add it to your template is to use &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-08-23T22:34:51.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27428" PostTypeId="2" ParentId="27408" CreationDate="2018-08-24T04:01:46.697" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The info table is missing its row...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;craft_info&lt;/code&gt; table in the database should only ever have one row in it.  In a fresh Craft installation, then installer should populate the row with the relevant information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're getting that error message, then that table is missing its one row, which would indicate that some other error happened during installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's a Craft generated error, then that underlying message would be in your &lt;code&gt;craft/storage/logs&lt;/code&gt; files.  If it's a web server generated error, that error would be in your web server's error logs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-24T04:01:46.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27429" PostTypeId="2" ParentId="27326" CreationDate="2018-08-24T04:12:40.257" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;When I'm logged into the backend using my admin account and I use the form to sign up a new fake user, it works as desired and assigns the new user to the 'trade' group. If I'm logged out it just assigns the user to the default 'customers' group rather than 'trade'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When you're logged in as an admin and test this for a new fake user, you have all of the necessary permission to perform the operation (including assigning new user/group permissions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're not logged in as any user, you're missing the necessary &quot;Assign user to groups&quot; permissions a logged in user would need.  New users are going into the &quot;customers&quot; group, because presumably in Settings-&gt;Users-&gt;Settings in the Control Panel, you've got front-end registration enabled and you've assigned the default group to be &quot;customers&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, here's a Craft 2 plugin that probably does what you're looking for. &lt;a href=&quot;https://github.com/lindseydiloreto/craft-autoassignusergroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lindseydiloreto/craft-autoassignusergroup&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-24T04:12:40.257" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27430" PostTypeId="2" ParentId="27399" CreationDate="2018-08-24T04:41:42.263" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So in short, can I safely use cache tags inside other cache tags?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can nest &lt;code&gt;{% cache %}&lt;/code&gt; tags and in the majority of cases it's probably safe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some additional reading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9196/what-effect-does-nesting-cache-tags-have&quot;&gt;What effect does nesting cache tags have?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14417/prevent-craftcms-caching-cms-page-with-dynamic-template/14418#14418&quot;&gt;Prevent craftcms caching CMS page with dynamic template&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-24T04:41:42.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27432" PostTypeId="1" CreationDate="2018-08-24T07:22:58.230" Score="1" ViewCount="941" Body="&lt;p&gt;I tried this code, but getting 'unexpected token errors&quot;. Probably something to do using incorrect syntax.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;{% js %}&#xA;    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';&#xA;    smartMap.marker[markerId].setOptions({&#xA;        'icon':       '{{ icon }}'; &#xA;        'scaledSize:' 'new google.maps.Size(32,32)'&#xA;    });&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error in the console&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var markerId = 'smartmap-mapcanvas-1.550.addressInformation';&#xA;smartMap.marker[markerId].setOptions({&#xA;    'icon':       '//d1ado4imyxw3fk.cloudfront.net/html/pin-otto-12.png'; &#xA;    'scaledSize:' 'new google.maps.Size(32,32)'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastEditorUserId="5557" LastEditDate="2018-08-24T07:54:08.017" LastActivityDate="2018-08-24T16:09:31.010" Title="How can I change the size of an individual pin?" Tags="&lt;craft3&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27433" PostTypeId="2" ParentId="27422" CreationDate="2018-08-24T07:46:48.153" Score="1" Body="&lt;p&gt;Thanks to &lt;strong&gt;Robin Schambach&lt;/strong&gt;. The answer was as simple as serialize the form data with the CSRF in there already by using the default &lt;code&gt;{{ getCsrfInput() }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;serializeArray won't produce data in a way Craft CMS will proceed it.&#xA;  It's not a good idea to do that. Besides that why don't you include&#xA;  the token in your form from the beginning? Because this is never the&#xA;  default code you can find in every ajax request – &lt;em&gt;Robin Schambach 14&#xA;  hours ago&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-08-24T07:46:48.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27434" PostTypeId="1" CreationDate="2018-08-24T08:19:48.260" Score="1" ViewCount="11" Body="&lt;p&gt;Before I start to build this store on my own, I would like to ask if anyone can provide some guidelines on the following setup.&#xA;I am trying to build a store with a member area for subscribed members with an annual renewal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to approach this setup? Is there anything I have to consider or be concerned about? Any warning or solution on plugins that I have to consider...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached an image on how I see it. Please comment if there is anything I miss or you have a suggestion on how to build it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance -&#xA;Nermin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EhPcj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EhPcj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8088" LastActivityDate="2018-08-24T08:19:48.260" Title="Shop setup for subscribed members" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27435" PostTypeId="1" AcceptedAnswerId="27436" CreationDate="2018-08-24T08:45:30.653" Score="2" ViewCount="910" Body="&lt;p&gt;I'm making first steps with Twig in Craft. Ok, it's a Twig question. But maybe you can give me the best practice for Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm used to create templates Top-Down, like having a &lt;code&gt;master.html&lt;/code&gt; template that includes &lt;code&gt;footer.html&lt;/code&gt;, &lt;code&gt;header.html&lt;/code&gt;, &lt;code&gt;content.html&lt;/code&gt; etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now Twig and with this Craft suggests I'd rather &lt;code&gt;extend&lt;/code&gt; / inherit parent templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the easy way to start if I simply use &lt;code&gt;{% include &quot;pages/partials/_head.html&quot; %}&lt;/code&gt; – but will this later on, when I start working on the content, somehow prohibit accessing the unique features of &lt;code&gt;extend&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: Should I grasp the logic of &lt;code&gt;extend&lt;/code&gt; first or doesn't it matter?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastEditorUserId="57" LastEditDate="2018-08-24T22:44:20.413" LastActivityDate="2018-08-24T22:44:20.413" Title="Templating basics: extend, include or use?" Tags="&lt;templating&gt;&lt;extends&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27436" PostTypeId="2" ParentId="27435" CreationDate="2018-08-24T08:55:40.747" Score="2" Body="&lt;p&gt;Hmmm I think I've got it already:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_layout.html&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;de&quot;&amp;gt;&#xA;&#xA;{% include &quot;pages/partials/_head.html&quot; %}&#xA;&#xA;&amp;lt;body class=&quot;body&quot;&amp;gt;&#xA;&#xA;{% include &quot;pages/partials/_header.html&quot; %}&#xA;&#xA;    &amp;lt;main class=&quot;main-wrapper&quot;&amp;gt;&#xA;         {% block content %} &#xA;         MAIN CONTENT PLACEHOLDER&#xA;         {% endblock %}&#xA;    &amp;lt;/main&amp;gt;&#xA;&#xA;{% include &quot;pages/partials/_footer.html&quot; %}&#xA;{% include &quot;pages/partials/_jsfooter.html&quot; %}&#xA;&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in a page template, say front.html.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %} &#xA;&#xA;{% block content %} &#xA;FRONT PAGE CONTENT&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-24T08:55:40.747" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27437" PostTypeId="2" ParentId="27435" CreationDate="2018-08-24T08:55:49.970" Score="2" Body="&lt;p&gt;I use &lt;code&gt;extend&lt;/code&gt; for different entry types.&#xA;So i have a master.html with the main html construct and includes page parts like header.html and footer.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then i have a standard.html that extends master.html and include the content templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entry Types with different page structure like projects.html or gallery.html also extend master.html, but can have different content templates included.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2018-08-24T09:01:21.610" LastActivityDate="2018-08-24T09:01:21.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27438" PostTypeId="2" ParentId="27435" CreationDate="2018-08-24T09:23:50.837" Score="3" Body="&lt;p&gt;My setup regarding includes for templates is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll have a 'site' structure that looks at &lt;code&gt;/pages/_entry.twig&lt;/code&gt; for it's template. But I'd have a range of entry types within this structure, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Homepage&lt;/li&gt;&#xA;&lt;li&gt;Contact&lt;/li&gt;&#xA;&lt;li&gt;News&lt;/li&gt;&#xA;&lt;li&gt;Standard content&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then my &lt;code&gt;/pages/_entry.twig&lt;/code&gt; template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout/base.twig&quot; %}&#xA;&#xA;{% block content %}&#xA;    {% include 'pages/' ~ entry.type %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the extending of my base template is sorted for all of them in one place (less repeated code ) and it just includes a file based on the entry type like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/pages&#xA;  -- _entry.twig&#xA;  -- contact.twig&#xA;  -- homepage.twig&#xA;  -- news.twig&#xA;  -- standardContent.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the entry type matches the file name so each entry type has it's own template automagically.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-24T09:23:50.837" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27439" PostTypeId="2" ParentId="27432" CreationDate="2018-08-24T09:40:11.660" Score="1" Body="&lt;p&gt;You already stated the wrong ; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from that, i managed to change the size in one of my projects, where i had to use a bitmap image, this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;marker[id] = new google.maps.Marker({&#xA;    position: region.pos,&#xA;    map: map,&#xA;    icon: {url: imageMarker,&#xA;            size: new google.maps.Size(52, 52),&#xA;            scaledSize: new google.maps.Size(32, 32),&#xA;            anchor: new google.maps.Point(15, 35) // offset&#xA;            }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I didn't use the smartmaps-plugin, but i think that's irelevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The png had a different size, that's the reason &lt;code&gt;size&lt;/code&gt; and &lt;code&gt;scaledSize&lt;/code&gt; have different values)&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-08-24T09:40:11.660" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27440" PostTypeId="1" CreationDate="2018-08-24T10:22:21.037" Score="0" ViewCount="246" Body="&lt;p&gt;I'm trying to make a custom page for setting a new password. I found the following in the docs: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a file called &lt;code&gt;setpassword.twig&lt;/code&gt; in my templates folder but it isn't shown when I click the link in the email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Needs the template to be somewhere else?&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-08-24T10:22:21.037" Title="Craft 3: Custom &quot;Set Password Form&quot; not working" Tags="&lt;craft3&gt;&lt;form&gt;&lt;password&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27441" PostTypeId="1" CreationDate="2018-08-24T10:23:11.603" Score="1" ViewCount="152" Body="&lt;p&gt;I would like to add field and section definitions to versioning. Or at least, have them backed up constantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't been able to find out yet how craft handles this. I'd say it's in the database, but apparently it's not: the database has a &lt;code&gt;uid&lt;/code&gt; column where values like &lt;code&gt;305ed8b6-3519-422f-8436-eca448145656&lt;/code&gt; are stored. This probably refers to some git-ish entries in the file system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is this out of reach for manual save/restore/export/import?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-24T10:36:47.063" Title="Where does Craft store the field definitions?" Tags="&lt;templating&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27442" PostTypeId="2" ParentId="27441" CreationDate="2018-08-24T10:36:47.063" Score="2" Body="&lt;p&gt;Basically look for the tables &quot;craft_fields&quot;, &quot;craft_content&quot; and &quot;craft_sections&quot;.&#xA;For Fields you can use the &quot;Field Manager&quot; Plugin.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-08-24T10:36:47.063" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27443" PostTypeId="1" AcceptedAnswerId="27504" CreationDate="2018-08-24T11:33:50.263" Score="2" ViewCount="2377" Body="&lt;p&gt;I wanted to include some uploaded assets (images) in an entry. The &lt;code&gt;.url&lt;/code&gt; property in twig outputs the proper URL, in my case:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://localhost/craftcms/web/image/photo-2017-04-02-16-20-53-1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/craftcms/web/image/photo-2017-04-02-16-20-53-1.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, that link is broken. Following it leads to a 404 error page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Template not found: image/photo-2017-04-02-16-20-53-1.jpg&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Viewing it in the admin panel preview also displays a broken image sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I disable the Public URL switch in the asset settings, the image display fine in the admin panel, but obviously I cannot use them in public pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't able to find a working fix for this. I tried the multiple-environment config solution from these forums just in case, but it did not help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: here is a screenshot of my Assets volume settings:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/a3bhV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a3bhV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8731" LastEditorUserId="8731" LastEditDate="2018-08-28T17:09:17.410" LastActivityDate="2019-03-11T07:30:44.017" Title="Asset (image) public URL does not work" Tags="&lt;assets&gt;&lt;url&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27444" PostTypeId="1" CreationDate="2018-08-24T14:45:49.113" Score="1" ViewCount="203" Body="&lt;p&gt;Good morning and thank you in advance. Very to new Craft and Twig so I am not sure if I am coding this correctly but need some help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a forms center that has 5 main categories (Members, Finance, Technology, etc, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my members landing page, I only want to display forms that are associated to the members category then order those forms by sub categories. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have got that working, but when I associate a form to another category (say Finance - OTL PALS), the OTL PALS sub category now shows on my members page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oB2Di.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oB2Di.png&quot; alt=&quot;OTL PALS SHOULD NOT SHOW WITH THE TABS. IT IS A FINANCE FROM&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the associated entry image:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WuSAe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WuSAe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code... Not even sure if this is the correct way but it is working for the most part. I am pulling the slug (members) to get a list of form entries. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;section-bg-color&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;container content&quot;&amp;gt;        &#xA;        &amp;lt;div class=&quot;text-center&quot;&amp;gt;&#xA;            &amp;lt;h3&amp;gt;POPULAR FORMS&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {% set categories = craft.categories.group('formLocation') %}&#xA;        {% set projects = craft.entries.section('formCenter').relatedTo(craft.categories.slug(craft.app.request.segments|first)).orderby('title').limit(null) %}&#xA;&#xA;        &amp;lt;div class=&quot;tab-box pills&quot; data-tab-anima=&quot;fade-right&quot;&amp;gt;&#xA;            &amp;lt;ul class=&quot;nav nav-pills nav-center&quot;&amp;gt;&#xA;                {% for category in categories.relatedTo(projects).all() %}&#xA;                    {% if category.level &amp;gt; 1 %}&#xA;                        {% set class = &quot;&quot; %}&#xA;                        {% if loop.index == 2 %}&#xA;                            {% set class = &quot;current-active active&quot; %}&#xA;                        {% endif %}&#xA;                        &amp;lt;li class=&quot;{{ class }}&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}                      &#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% for category in categories.relatedTo(projects).all() %}&#xA;                {% if category.level &amp;gt; 1 %}&#xA;                    {% set class = &quot;&quot; %}&#xA;                    {% if loop.index == 2 %}&#xA;                        {% set class = &quot;active&quot; %}&#xA;                    {% endif %}                    &#xA;                    &amp;lt;div class=&quot;panel {{ class }} fade-right&quot; style=&quot;transition-duration: 300ms; animation-duration: 300ms; transition-timing-function: ease; transition-delay: 0ms;&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;                                &amp;lt;ul class=&quot;list-texts text-left&quot;&amp;gt;&#xA;                                {% for entry in projects.relatedTo(category).all() %}&#xA;                                    {% set file = entry.forms.one() %}&#xA;                                    {% if file|length %}&#xA;                                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ file.getUrl() }}&quot; target=&quot;_blank&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                    {% endif %}&#xA;                                {% endfor %} &#xA;                                &amp;lt;/ul&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;                    &#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;       &#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="8678" LastActivityDate="2018-08-24T14:45:49.113" Title="Categories and Sub Categories" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27445" PostTypeId="1" AcceptedAnswerId="27447" CreationDate="2018-08-24T14:56:39.927" Score="1" ViewCount="101" Body="&lt;p&gt;I have defined an entry for a channel, let's say of persons, to have some fields, let's say &lt;code&gt;firstname&lt;/code&gt;, &lt;code&gt;lastname&lt;/code&gt; and &lt;code&gt;bio&lt;/code&gt;, but no title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I created the first real entry, craft complained it had no slug. Apparently, that's drawn from the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expected I could define the structure of the entry's slug to be pulled from any field, like &lt;code&gt;{firstname}-{lastname}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I didn't find that option in the backend. Am I looking in the wrong place?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-24T15:12:10.787" Title="Channel entry: Slug from field pattern?" Tags="&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27446" PostTypeId="1" AcceptedAnswerId="27457" CreationDate="2018-08-24T15:10:14.827" Score="1" ViewCount="32" Body="&lt;p&gt;I'm posting a lot of newbie questions today, hope that's ok. It will get better!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to add a channel (list/detail) to a structure page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Home &amp;gt; Pages &amp;gt; List Page&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure I'm looking at it the wrong way. I'm used to create this list page as a &quot;real&quot; page in a structure in another CMS (TYPO3) and add the &quot;channel&quot; content as a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe in Craft, you don't do that (create the channels &quot;containing page&quot;) at all? But then again, how do you tell the main site navigation it should link to the channel?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-25T06:24:14.960" Title="Channel content in structure" Tags="&lt;structure&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27447" PostTypeId="2" ParentId="27445" CreationDate="2018-08-24T15:12:10.787" Score="2" Body="&lt;p&gt;Ah I found it: the option to enter the custom slug is displayed when you uncheck the Title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I set&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // don't accept umlauts for slugs&#xA;    'limitAutoSlugsToAscii' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the config.&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-24T15:12:10.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27448" PostTypeId="2" ParentId="27432" CreationDate="2018-08-24T16:09:31.010" Score="3" Body="&lt;p&gt;Looks like there are a couple of notable errors in your JS:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You have a semi-colon at the end of your &lt;code&gt;icon&lt;/code&gt; line. That should be a comma.&lt;/li&gt;&#xA;&lt;li&gt;On the &lt;code&gt;scaledSize&lt;/code&gt; line, you have the colon &lt;em&gt;inside&lt;/em&gt; the quote. That should be outside.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Added per Robin's comment...&lt;/em&gt; Since you're doing this in JS (not Twig), the &lt;code&gt;new google.maps.Size(32,32)&lt;/code&gt; shouldn't be enclosed in quotes. Pass in the JS object directly.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;{% js %}&#xA;    var markerId = 'smartmap-mapcanvas-1.{{ entry.id }}.addressInformation';&#xA;    smartMap.marker[markerId].setOptions({&#xA;        'icon':       '{{ icon }}',&#xA;        'scaledSize': new google.maps.Size(32,32)&#xA;    });&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-24T16:09:31.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27449" PostTypeId="1" AcceptedAnswerId="27450" CreationDate="2018-08-24T18:29:06.350" Score="1" ViewCount="488" Body="&lt;p&gt;My login form  is not redirect like I want it to.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ csrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/login&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;profile&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;loginName&quot;&amp;gt;Username or email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;loginName&quot; type=&quot;text&quot; name=&quot;loginName&quot;&#xA;    value=&quot;{{ craft.app.user.rememberedUsername }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&amp;lt;label&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;rememberMe&quot; value=&quot;1&quot;&amp;gt;&#xA;    Remember me&#xA;&amp;lt;/label&amp;gt;&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Login&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anybody know why?&lt;/p&gt;&#xA;" OwnerUserId="8734" LastActivityDate="2018-08-24T18:35:03.633" Title="Login form redirect not working" Tags="&lt;craft3&gt;&lt;form&gt;&lt;redirect&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27450" PostTypeId="2" ParentId="27449" CreationDate="2018-08-24T18:35:03.633" Score="2" Body="&lt;p&gt;All redirect parameters needs to be hashed in Craft 3. If not, they're completely ignored. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ '/profile' | hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ redirectInput('profile') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-08-24T18:35:03.633" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27452" PostTypeId="2" ParentId="27418" CreationDate="2018-08-24T19:29:35.857" Score="1" Body="&lt;p&gt;User accounts’ First Name field isn’t required, so I’m guessing this is a custom field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can translate your custom field names using &lt;a href=&quot;https://docs.craftcms.com/v3/static-translations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;static message translations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a new file at &lt;code&gt;translations/&amp;lt;Language&amp;gt;/site.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-project.test/&#xA;├── config/&#xA;├── ...&#xA;└── translations/&#xA;    └── &amp;lt;Language&amp;gt;/&#xA;        └── site.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(replace &lt;code&gt;&amp;lt;Language&amp;gt;&lt;/code&gt; with your language ID, e.g. &lt;code&gt;el&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then have it return an array that translates your custom field names.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'First Name' =&amp;gt; 'Ονομα',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-08-24T19:29:35.857" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27453" PostTypeId="1" CreationDate="2018-08-24T21:09:25.600" Score="0" ViewCount="90" Body="&lt;p&gt;I'm running Craft on our shared hosting with PHP 7.2. No SSD. Performance is fine, but working in the backend, I often get hickups of several seconds (!), where nothing happens, everything stalls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what cPanels resources diagram tells us:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5cK7w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5cK7w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So ... something with I/O and I/O Faults.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could this be solved without changing the hosting?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastEditorUserId="57" LastEditDate="2018-08-24T22:52:05.667" LastActivityDate="2018-08-24T22:52:05.667" Title="Craft on a cPanel hosting with CentOS and CloudLinux – I/O faults?" Tags="&lt;performance&gt;&lt;hosting&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27454" PostTypeId="2" ParentId="27342" CreationDate="2018-08-24T22:35:08.697" Score="0" Body="&lt;p&gt;If you're looking to get the locale code for each site's language globally, it'd be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in craft.i18n.getSiteLocales() %}&#xA;    {{ locale }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're in the context of an entry, and you want to get the full URL and locale code for each site that entry is enabled it, it'd be similar to the answer here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/23751/57&quot;&gt;https://craftcms.stackexchange.com/a/23751/57&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Grab the entry #}&#xA;{% set entry = craft.entries.id(2).one() %}&#xA;&#xA;{# loop through all of the supported sites for the entry #}&#xA;{% for siteInGroup in entry.getSupportedSites() %}&#xA;    {% set site = craft.app.sites.getSiteById(siteInGroup['siteId']) %}&#xA;&#xA;    {# Grab the entry for the given site #}&#xA;    {% set entryForSite = craft.entries.id(entry.id).siteId(site.id).one() %}&#xA;&#xA;    {# output the site-specific entry info #}&#xA;    &amp;lt;link rel=&quot;alternate&quot; href=&quot;{{ entryForSite.url }}&quot; hreflang=&quot;{{ site.language }}&quot;&amp;gt;{{ entryForSite.title }}&amp;lt;/link&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-24T22:35:08.697" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27455" PostTypeId="1" CreationDate="2018-08-25T01:07:17.990" Score="1" ViewCount="75" Body="&lt;p&gt;Is there are similar plugin for Craft 3 like &lt;a href=&quot;https://github.com/sathoro/Compressor&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/sathoro/Compressor&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8428" LastActivityDate="2018-08-25T03:19:13.693" Title="Is there a plugin like Compressor for Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27456" PostTypeId="2" ParentId="27455" CreationDate="2018-08-25T03:19:13.693" Score="1" Body="&lt;p&gt;I don't think there's a single plugin, but looking through &lt;a href=&quot;https://plugins.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.craftcms.com&lt;/a&gt; it looks like maybe &lt;a href=&quot;https://github.com/nystudio107/craft-minify&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minify&lt;/a&gt; and &lt;a href=&quot;https://github.com/clubstudioltd/craft-asset-rev&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Rev&lt;/a&gt; would do it together.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-25T03:19:13.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27457" PostTypeId="2" ParentId="27446" CreationDate="2018-08-25T06:24:14.960" Score="1" Body="&lt;p&gt;I finally found out craft allows multiple entry types. So a regular &quot;structure&quot; page can be of type &quot;page&quot; or, eg, of type &quot;listpage&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created the second entry type and gave it a field &lt;code&gt;function&lt;/code&gt; instead of the content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my regular structure page, I did the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# switch between content pages and list pages; if list page, display selected list #}&#xA;&#xA;{% if entry.type == 'listpage' %}&#xA;    &amp;lt;article class=&quot;content-element&quot;&amp;gt;&#xA;        &amp;lt;h1 class=&quot;heading-content-main&quot;&amp;gt;{{entry.title}}&amp;lt;/h1&amp;gt;&#xA;            {% switch entry.function %}&#xA;            {% case &quot;interviews&quot; %}&#xA;                {% include &quot;interviews/_list.html&quot; %}&#xA;            {% case &quot;researchprojects&quot; %}&#xA;                {% include &quot;researchprojects/_list.html&quot; %}&#xA;            {% case &quot;seminars&quot; %}&#xA;                {% include &quot;seminars/_list.html&quot; %}&#xA;            {% endswitch %}&#xA;    &amp;lt;/article&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;article class=&quot;content-element&quot;&amp;gt;&#xA;        &amp;lt;h1 class=&quot;heading-content-main&quot;&amp;gt;{{entry.title}}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;div class=&quot;rte-content w-richtext&quot;&amp;gt;&#xA;            {{entry.richtext}}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Great!&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-25T06:24:14.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27458" PostTypeId="1" AcceptedAnswerId="27459" CreationDate="2018-08-25T10:46:25.793" Score="1" ViewCount="130" Body="&lt;p&gt;My Control Panel has stopped working since upgrading to Craft v2.7.0. in chrome. I get the following JS error no matter what is clicked in the entry fields and no action is taken. So for example if I want to remove and image and click the minus button nothing happens. If I try and add Matrix fields nothing happens. All of these were working prior to the update.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Uncaught TypeError: Cannot read property 'length' of null&#xA;      at n.constructor.getWorkingTaskInfo (cp.js:863)&#xA;      at n.constructor.setTaskInfo (cp.js:832)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm running on PHP 7.0.13 any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2018-08-28T01:07:10.703" LastActivityDate="2018-08-28T01:07:10.703" Title="Craft 2 JS error in CMS since upgrade to 2.7.0" Tags="&lt;control-panel&gt;&lt;upgrades&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27459" PostTypeId="2" ParentId="27458" CreationDate="2018-08-25T12:25:39.570" Score="1" Body="&lt;p&gt;Try reinstalling Craft. I believe there was another report from a user that had similar JS errors. Try replacing the core Craft files in &lt;code&gt;craft/app&lt;/code&gt; and see if that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2.7.1 was also recently released.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-08-25T12:25:39.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27460" PostTypeId="1" AcceptedAnswerId="27461" CreationDate="2018-08-25T17:51:27.173" Score="1" ViewCount="206" Body="&lt;p&gt;I currently have front-end code working for a user to create an entry, add a title (text input) and also relate entries via the entries field type and checkboxes. All on a front-end application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating the entry is fine, but I'm having an issue with the editing of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unable/unsure how to &quot;check&quot; what the previously selected relate entries where. Code for showing entry items...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries.section('exercises') %}&#xA;{% for entry in entries %}&#xA;&amp;lt;li&amp;gt;&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;fields[planItems][]&quot; &#xA;           id=&quot;fields[planItems]&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;{{ entry.title }}&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other fields are fine such as the title field, all you have to add is &lt;code&gt;{%- if entry is defined %} value=&quot;{{ entry.title }}&quot;{% endif -%}&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to get that value so I can add &lt;code&gt;checked&lt;/code&gt; to the previously selected entries?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8739" LastEditorUserId="5557" LastEditDate="2018-08-25T18:13:50.910" LastActivityDate="2018-08-25T18:21:34.240" Title="Edit entry, on the front end, with the entries field" Tags="&lt;entries&gt;&lt;relatedto&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27461" PostTypeId="2" ParentId="27460" CreationDate="2018-08-25T18:09:43.097" Score="3" Body="&lt;p&gt;There is a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#containment-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;in&lt;/a&gt; operator to check if a variable is in a string or an array. Your &lt;code&gt;entries&lt;/code&gt; field actually contains an object of type &lt;code&gt;ElementQuery&lt;/code&gt; instead of an array of elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is to check if the current entry is in the list of selected entries &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set selectedEntries = entry.planItems.ids() %}&#xA;&#xA;{% set entries = craft.entries.section('exercises') %}&#xA;{% for entry in entries %}&#xA;    &amp;lt;li&amp;gt;&#xA;        &amp;lt;input &#xA;            {% if entry.id in selectedEntries %}checked{%endif%}&#xA;            type=&quot;checkbox&quot; &#xA;            name=&quot;fields[planItems][]&quot; &#xA;            value=&quot;{{ entry.id }}&quot;&amp;gt;{{ entry.title }}&#xA;    &amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-25T18:21:34.240" LastActivityDate="2018-08-25T18:21:34.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27462" PostTypeId="1" CreationDate="2018-08-25T23:18:00.927" Score="1" ViewCount="106" Body="&lt;p&gt;It seems like this should be a simple thing, but it's evading me... I have a checkbox field in my entry named &quot;articles_categories&quot;. Just to clarify, these are not actual categories -- they are checkboxes and I cannot modify them at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the option value of the checkbox as an exact search parameter. I'm using pagination, so it needs to pass through paginate. This is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set topic = craft.request.getQuery('topic') %}&#xA;&#xA;{% paginate craft.entries.section('blogArticles').limit(10).search(topic) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The option values are being passed as the topic parameter. For example, '?topic=healthcare',  or '?topic=food-fitness'. I'm getting a different set of results from each query, however, I don't believe that this is set up to return an exact match on the value passed through the search function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need only the articles that have an exact match in that field.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-08-27T05:08:18.260" Title="Search in checkbox field with pagination" Tags="&lt;search&gt;&lt;paginate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27463" PostTypeId="1" AcceptedAnswerId="27464" CreationDate="2018-08-26T06:41:07.053" Score="3" ViewCount="563" Body="&lt;p&gt;I would like to build an alphabetical list of craft entries, but group them by the initials of one field of each entry. Thus, getting some kind of alphabetical index, like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apples&lt;/li&gt;&#xA;&lt;li&gt;Ananas&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;B&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Beer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-26T06:52:34.790" Title="Alphabetical index for a list of entries" Tags="&lt;templating&gt;&lt;filter&gt;&lt;array&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27464" PostTypeId="2" ParentId="27463" CreationDate="2018-08-26T06:41:07.053" Score="8" Body="&lt;p&gt;First, sort all entries by multiple criteria:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get our entries and order by firstname, lastname #}&#xA;{% set allEntries = craft.entries.section('entries').orderBy('lastname asc, firstname asc').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use craft's custom &quot;group&quot; filter (&lt;code&gt;lastname[:1]&lt;/code&gt; picks the first letter):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# group them by the first letter of the last name https://docs.craftcms.com/v3/dev/filters.html#group #}&#xA;{% set allEntriesByGroup = allEntries | group('lastname[:1]') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through that multidimensional array (&lt;code&gt;firstletter, entriesInGroup&lt;/code&gt;) is &lt;code&gt;key -&amp;gt; value&lt;/code&gt; in twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for firstletter, entriesInGroup in allEntriesByGroup %}&#xA;    &amp;lt;h3&amp;gt;{{firstletter}}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for entry in entriesInGroup %}&#xA;       &amp;lt;li&amp;gt;{{entry.lastname}}, {{entry.firstname}}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8325" LastEditorUserId="8325" LastEditDate="2018-08-26T06:52:34.790" LastActivityDate="2018-08-26T06:52:34.790" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27465" PostTypeId="2" ParentId="27462" CreationDate="2018-08-26T07:02:29.893" Score="1" Body="&lt;p&gt;The value is stored as a serialized array in your database,  you would need to filter for the &lt;strong&gt;string&lt;/strong&gt; &lt;code&gt;&quot;[&quot;healthcare&quot;,&quot;food-fitness&quot;]&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your query parameter is an array you just need to prepend an &lt;code&gt;and&lt;/code&gt; parameter to it so it looks like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles_categories(['and',  '*healthcare*', '*food-fitness*'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have only one parameter and want an exact match you need to search for the exact string&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.articles_categories('[&quot;healthcare&quot;]')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-08-27T05:08:18.260" LastActivityDate="2018-08-27T05:08:18.260" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27468" PostTypeId="1" AcceptedAnswerId="27676" CreationDate="2018-08-26T17:46:50.490" Score="2" ViewCount="197" Body="&lt;p&gt;Is there a way to extend (extend, not replace) the default Commerce order templates in the control panel? &#xA;I'd like to display important custom fields in a prominent way on the first tab. (and not tucked away on a second tab as is normal with custom fields)&lt;/p&gt;&#xA;" OwnerUserId="8743" LastActivityDate="2018-09-12T13:15:35.740" Title="Extend a Commerce (v2) order template in the control panel" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27469" PostTypeId="2" ParentId="27389" CreationDate="2018-08-27T00:34:12.727" Score="1" Body="&lt;p&gt;you can use .count() to determine if there is an empty tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;{% set count = craft.entries.section('fellows').relatedTo(category).relatedTo(tag).count() %}&#xA;  {% if count &amp;gt; 0 %}&#xA;     &amp;lt;h3&amp;gt;{{ tag.slug }} {{ category.title }}&amp;lt;/h3&amp;gt;&#xA;         {% for entry in craft.entries({&#xA;                                relatedTo: [&#xA;                                  'and',&#xA;                                  { targetElement: category },&#xA;                                  { targetElement: tag },&#xA;                                  ],&#xA;                                  limit: (null),&#xA;                                  }) %}&#xA;               {% include '_entryblock.twig' %} &#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5587" LastActivityDate="2018-08-27T00:34:12.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27470" PostTypeId="2" ParentId="4281" CreationDate="2018-08-27T13:17:11.913" Score="1" Body="&lt;p&gt;I made another pretty easy solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.redactor | nl2br | replace({'/m3': '/m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;'}) | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It just replaces the units with the coresponding html markup. It works nice :) But you need to know which units are used.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2018-08-28T13:11:31.840" LastActivityDate="2018-08-28T13:11:31.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27471" PostTypeId="1" CreationDate="2018-08-27T13:32:21.220" Score="1" ViewCount="64" Body="&lt;p&gt;Just wondering if anybody has ever used Craft as a platform along with using something like ElectronJS to move a PWA to a native based app for windows or mac?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible I wonder? Has anybody come across any articles about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8739" LastEditorUserId="8739" LastEditDate="2018-08-27T13:59:03.397" LastActivityDate="2018-08-27T15:34:50.587" Title="General question: Has anybody ever used Craft along with ElectronJS to create a native based app?" Tags="&lt;app&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27472" PostTypeId="1" AcceptedAnswerId="27486" CreationDate="2018-08-27T13:56:43.127" Score="5" ViewCount="466" Body="&lt;p&gt;When browsing the assets, there is a &quot;Temporary Uploads&quot; folder. What is it for? Can I disable/hide it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lW6X9.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lW6X9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2019-09-11T21:21:41.610" Title="Temporary Uploads - disable?" Tags="&lt;assets&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27474" PostTypeId="2" ParentId="27471" CreationDate="2018-08-27T15:34:50.587" Score="1" Body="&lt;p&gt;So if you're using Craft as an API service, whether via the ElementAPI or via GraphQL w/the CraftQL plugin, anything you like can talk to it, including a PWA app, a native PWA, an iOS app, whatever.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-27T15:34:50.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27475" PostTypeId="1" CreationDate="2018-08-27T16:20:11.633" Score="3" ViewCount="1501" Body="&lt;p&gt;I have these to arrays that I need to merge into one array, but can't figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('publications').search('nonMembers:0') %}&#xA;&#xA;{% set entries = craft.entries.section('improveYourClub').search('membersExclusive:1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-08-28T21:06:22.667" Title="Merging 2 Entries Array's" Tags="&lt;merge&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27476" PostTypeId="2" ParentId="27475" CreationDate="2018-08-27T16:59:46.680" Score="4" Body="&lt;p&gt;Just a few side notes: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;neither the first &lt;code&gt;entries&lt;/code&gt; variable nor the second &lt;code&gt;entries&lt;/code&gt; variable is an array - both are objects of kind &lt;code&gt;craft\elements\db\EntryQuery&lt;/code&gt; (or &lt;code&gt;craft\ElementCriteriaModel&lt;/code&gt; if it's Craft 2).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.search('nonMembers:0')&lt;/code&gt; can be shortened to &lt;code&gt;nonMembers(0)&lt;/code&gt; (or &lt;code&gt;&quot;0&quot;&lt;/code&gt; or &lt;code&gt;&quot;not 1&quot;&lt;/code&gt; depending on the type) and &lt;code&gt;search('membersExclusive:1')&lt;/code&gt; to &lt;code&gt;membersExclusive(1)&lt;/code&gt; it will increase your performance as well&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So far about that.. You can merge arrays in Twig via &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;|merge&lt;/a&gt; filter&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set values = [1, 2] %}&#xA;&#xA;{% set values = values|merge(['apple', 'orange']) %}&#xA;&#xA;{# values now contains [1, 2, 'apple', 'orange'] #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To address your case specifically, you'll need something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesOne = craft.entries.section('publications').search('nonMembers:0').find() %}&#xA;{% set entriesTwo = craft.entries.section('improveYourClub').search('membersExclusive:1').find() %}&#xA;&#xA;{% set allEntries = entriesOne|merge(entriesTwo) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="45" LastEditDate="2018-08-28T21:06:22.667" LastActivityDate="2018-08-28T21:06:22.667" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="27477" PostTypeId="1" AcceptedAnswerId="27484" CreationDate="2018-08-27T19:23:57.993" Score="2" ViewCount="363" Body="&lt;p&gt;Is there a way in Craft Commerce 2 to have a user-input price as a product variant? In my case, I'm offering several pre-set amounts for a donation product (each is a variant), but I also want to offer a &quot;custom amount&quot; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a native way to do this? Or a way I can accomplish this with a plugin action?&lt;/p&gt;&#xA;" OwnerUserId="63" LastEditorUserId="57" LastEditDate="2018-08-28T05:41:36.610" LastActivityDate="2020-06-09T16:04:36.263" Title="User-determined price for a product variant?" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27479" PostTypeId="1" AcceptedAnswerId="27496" CreationDate="2018-08-27T21:55:27.817" Score="1" ViewCount="375" Body="&lt;p&gt;I am building a site for a client that is effectively a job board with a messaging system.  They want to know who the last person in their office was to view a specific application and to know who/when someone views specific pages/messages.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping for something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set x = users.lastvisitor &#xA;if currentuser != users.last vistor&#xA;insert currentuser &amp;amp; date into users.lastvisitor &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in a direction?  I am new to Craft so don't know how it handles things like this. I am using matrix blocks for the messages, is it possible to add an entry through a query instead of a form?&lt;/p&gt;&#xA;" OwnerUserId="8734" LastActivityDate="2018-08-28T16:21:34.763" Title="How to update a field when a user views a page" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27480" PostTypeId="1" CreationDate="2018-08-27T23:09:30.533" Score="2" ViewCount="480" Body="&lt;p&gt;I'm trying to validate a custom Element in my Craft 3 plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where should I be putting my validation rules?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two classes: one for the &lt;code&gt;Element&lt;/code&gt;, one for the &lt;code&gt;ActiveRecord&lt;/code&gt; (e.g. &lt;code&gt;Invoice&lt;/code&gt; and &lt;code&gt;InvoiceRecord&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the requirements is that one of its field (e.g. &lt;code&gt;number&lt;/code&gt;) has to be unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I override &lt;code&gt;rules()&lt;/code&gt; on the Element, the validation occurs normally but the &lt;code&gt;unique&lt;/code&gt; rule throws an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Call to undefined method Invoice::getDb()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now if I try to add the &lt;code&gt;unique&lt;/code&gt; rule to my Record's &lt;code&gt;rule()&lt;/code&gt; override, it does seem to fail validation and prevent saving the record, but no validation error is thrown (Craft flashes the &quot;saved successfully&quot; message and returns to the element index, but without the new/updated element).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the record's validation is called only in &lt;code&gt;afterSave&lt;/code&gt;, so technically validation has already been done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function afterSave(bool $isNew)&#xA;{&#xA;    if ($isNew) &#xA;    {&#xA;        $record = new InvoiceRecord();&#xA;        $record-&amp;gt;id = $this-&amp;gt;id;&#xA;    } &#xA;    else &#xA;    {&#xA;        $record = InvoiceRecord::findOne($this-&amp;gt;id);&#xA;    }&#xA;&#xA;    $record-&amp;gt;number = $this-&amp;gt;number; // Has to be unique&#xA;&#xA;    $record-&amp;gt;save();&#xA;&#xA;    parent::afterSave($isNew);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I don't understand how to get my validation working for something rather simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find anything about validation in the Craft 3 plugin docs or migration docs from Craft 2, does anybody know?&lt;/p&gt;&#xA;" OwnerUserId="5208" LastEditorUserId="5208" LastEditDate="2018-08-29T17:18:22.530" LastActivityDate="2020-07-11T16:22:47.197" Title="How to validate a unique field in Craft 3 element?" Tags="&lt;plugin-development&gt;&lt;validation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27481" PostTypeId="1" CreationDate="2018-08-27T23:34:01.620" Score="1" ViewCount="83" Body="&lt;p&gt;I'm trying to decide if FeedMe would be a good choice to sync Craft with a fairly large Airtable database (more than 5k records). I'm inclined to say no just on general principle but I've done some quick tests and everything seems to work fairly well. For my next step in testing I wanted to try a larger sample dataset, but I can't figure out to increment the offset parameter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I make a request to Airtable, it returns 100 records, and an offset response that looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;itrEk3iGk6zOddYqC\/recF5XRtrVtf6t0um&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I add that offset as a parameter to a new request, I get the next 100 records and a new offset value. So how do I tell FeedMe to automatically re-run the feed with the new offset parameter?&lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2018-09-04T18:51:13.507" Title="How to increment offset in FeedMe 2.0" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27482" PostTypeId="2" ParentId="27479" CreationDate="2018-08-27T23:44:04.947" Score="1" Body="&lt;p&gt;There's a plugin called &lt;a href=&quot;https://github.com/putyourlightson/craft-entry-count&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Count&lt;/a&gt; that updates a counter record every time a visitor loads a page. You might be able to adapt that plugin to check to see if the user is logged in, and if so, record their user ID to the database instead of incrementing the hit counter. The value is displayed on the Craft entry list dashboard, you would just want to adapt that to display the username instead of the ID.&lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2018-08-27T23:44:04.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27483" PostTypeId="1" AcceptedAnswerId="27485" CreationDate="2018-08-28T00:37:40.937" Score="1" ViewCount="86" Body="&lt;p&gt;I've managed to create a simple plugin for craft and get it into my project. It shows up just fine but I can't make any edits. I've tried editing the original plugin files and updating via composer and that doesn't work, and I've tried to edit the plugin files directly in my craft project and that doesn't seem to work as well. I'm sure there is a simple answer but I'm pretty lost.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-08-28T23:36:14.620" Title="Unable to edit my Craft 3 Plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27484" PostTypeId="2" ParentId="27477" CreationDate="2018-08-28T02:27:01.020" Score="5" Body="&lt;p&gt;Here's how you could accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Create a product variant called 'custom amount' with a zero price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Get the ID of that variant&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) When submitting/adding/updating the item to the cart make sure to post an 'amount' line item option. For docs on that see: &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Create a plugin/module that attaches this listener:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function(LineItemEvent $event) {&#xA;    $lineItem = $event-&amp;gt;lineItem;&#xA;    $purchasable = $lineItem-&amp;gt;getPurchasable();&#xA;    if($purchasable &amp;amp;&amp;amp; $purchasable-&amp;gt;id = ID_OF_VARIANT_HERE)&#xA;    {&#xA;        $amount = $lineItem-&amp;gt;options['amount'] ?? 0;&#xA;        if($amount)&#xA;        {&#xA;            $lineItem-&amp;gt;price = $amount;&#xA;            $lineItem-&amp;gt;salePrice = $amount;&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will set the price to the price of the line item option 'amount' that is submitted.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="129" LastEditDate="2020-06-09T16:04:36.263" LastActivityDate="2020-06-09T16:04:36.263" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27485" PostTypeId="2" ParentId="27483" CreationDate="2018-08-28T03:25:31.190" Score="1" Body="&lt;p&gt;What you need is a &quot;host&quot; project for your plugin, and then use a repository path to point to your plugin as described here: &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin#getting-a-host-craft-3-install-setup&quot; rel=&quot;nofollow noreferrer&quot;&gt;So You Wanna Make a Craft 3 Plugin?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-28T03:25:31.190" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27486" PostTypeId="2" ParentId="27472" CreationDate="2018-08-28T05:35:52.763" Score="5" Body="&lt;p&gt;Each user account gets their own &quot;temporary uploads&quot; folder that by default will be a subfolder under &lt;code&gt;storage/runtime/assets/tempuploads&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several places there this is used in Craft... one example is if an Asset field has its &quot;Upload Location&quot; set to something dynamic based on the value of another field.  When saving a new element, Craft won't know the value of that upload location until after the element is actually saved, so it keeps the uploaded file for the Asset field in the &quot;temporary uploads&quot; folder, then moves it out of there after the element has been successfully saved.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I disable/hide it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't disable it natively, but you'd probably be able to use some CSS to hide it if you really wanted: &lt;a href=&quot;https://github.com/doublesecretagency/craft-cpcss&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/doublesecretagency/craft-cpcss&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-28T05:35:52.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27487" PostTypeId="1" AcceptedAnswerId="27490" CreationDate="2018-08-28T11:00:03.503" Score="1" ViewCount="35" Body="&lt;p&gt;I have the following 1:n relation between two sections:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Source Element: Interview &lt;/li&gt;&#xA;&lt;li&gt;Target Element: Persons&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the CP (only there) I need to be able to identify Interviews by the name of the interviewed persons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the &lt;code&gt;title format&lt;/code&gt; field for the entry type I tried something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{date}-{relation_interview_persons[0][firstname][lastname]} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that's no good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that even a valid approach?&#xA;Of course, we can simply use a custom title and that's it.&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-28T14:31:05.160" Title="CP: Title from relation?" Tags="&lt;templating&gt;&lt;control-panel&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27488" PostTypeId="1" CreationDate="2018-08-28T11:07:39.040" Score="1" ViewCount="68" Body="&lt;p&gt;I have a Craft 3 installation and want to add a tab/app to Facebook like domain.com/facebook&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Facebook sends a post request to the configured secure tab URL. Now when Craft's CSRF protection is enabled, Craft gives an error. If I disable CSRF protection the tab shows up in Facebook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to disable CSRF - what could i do... plugin with a controller to render the template?&lt;/p&gt;&#xA;" OwnerUserId="8499" LastEditorUserId="57" LastEditDate="2018-08-28T23:17:09.600" LastActivityDate="2021-05-25T08:29:13.997" Title="Craft CSRF protection and Facebook Tab" Tags="&lt;csrf&gt;&lt;post&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27489" PostTypeId="1" CreationDate="2018-08-28T14:06:44.637" Score="1" ViewCount="91" Body="&lt;p&gt;I try to get all the products of a certain category which have availableForPurchase set to true. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set criteria = craft.products.type( 'weine' ).relatedTo( cat ).search( 'availableForPurchase:1' ).orderBy( 'reihenfolge' ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't use variants, but I guess I need to check the availability for the default variant. Is this possible in the query?&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-08-28T14:06:44.637" Title="Craft Commerce 2: Get products which are availableForPurchase" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27490" PostTypeId="2" ParentId="27487" CreationDate="2018-08-28T14:31:05.160" Score="2" Body="&lt;p&gt;&lt;code&gt;relation_interview_persons&lt;/code&gt; is not an array of elements but an object of type &lt;code&gt;ElementQuery&lt;/code&gt;. In order to get the results you need to call &lt;code&gt;one()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind chances are high there is no related element if that's the case your code will throw an exception.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set person = object.relation_interview_persons.one() %} {{ person? person.firstname : ''}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;date&lt;/code&gt; is not a field of type text but a Date field that will throw an exception as well since it's an object and no string &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-28T14:31:05.160" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27491" PostTypeId="1" CreationDate="2018-08-28T14:45:26.923" Score="3" ViewCount="112" Body="&lt;p&gt;I'm building an 8-page registration form or application and was hoping to use Solspace's Freeform Pro. I have some experience with it, but not in all of the capacities I'm hoping to use it for on this project. I know that this plugin allows you to &quot;Create&quot; new users, which is one of my major requirements. The other is that the user can come back and edit their application if they need to before reaching the last page and pressing the final &quot;submit&quot; button. I read through the documentation and it said something about data being saved for 3 hours, which would not be enough. Is this possible to do with Freeform? If not, does anyone know of a way to accomplish this? &lt;/p&gt;&#xA;" OwnerUserId="8228" LastActivityDate="2018-08-28T14:45:26.923" Title="Does Freeform Pro save partially completed entries or &quot;drafts&quot;?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27492" PostTypeId="1" AcceptedAnswerId="27783" CreationDate="2018-08-28T14:53:05.063" Score="2" ViewCount="353" Body="&lt;p&gt;I have page where I display some items and there are filters by tag. So I make a list of all tags that are created. Then when the user click on some of the tag, he see only the product with that tag. Now I found out, that some of the tags are not used or written wrong. I want to delete them from the system. I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1115/how-do-i-delete-a-tag&quot;&gt;this&lt;/a&gt; question, that say it is not possible to done it in Craft 2. I am using Craft 3 is it possible to done it in the Craft 3? &lt;/p&gt;&#xA;" OwnerUserId="4109" LastActivityDate="2018-09-21T16:54:51.553" Title="Still not able to manage tags in Craft 3?" Tags="&lt;craft3&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27495" PostTypeId="2" ParentId="27488" CreationDate="2018-08-28T16:15:34.407" Score="1" Body="&lt;p&gt;You can disable the token for a certain controller via &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;...&#xA;Yii::$app-&amp;gt;controller-&amp;gt;enableCsrfValidation = false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or inside a Controller for a certain request&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function beforeAction($action)&#xA;{            &#xA;    if ($action-&amp;gt;id == 'my-method') {&#xA;        $this-&amp;gt;enableCsrfValidation = false;&#xA;    }&#xA;&#xA;    return parent::beforeAction($action);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-web-controller.html#$enableCsrfValidation-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;$enableCsrfValidation&lt;/a&gt; property of &lt;a href=&quot;http://www.yiiframework.com/doc-2.0/yii-web-controller.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;yii\web\Controller&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-28T16:15:34.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27496" PostTypeId="2" ParentId="27479" CreationDate="2018-08-28T16:21:34.763" Score="1" Body="&lt;p&gt;You can do a quick and dirty work around and just store the element in each request via Twig&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set lastVisitor = user.lastvisitor.one() %}&#xA;{% if currentUser != null and currentUser.id != lastVisitor.id %}&#xA;    {# new user -&amp;gt; set the field value of user -&amp;gt; relate the currentUser #}&#xA;    {% do user.setFieldValue('lastVisitor', [currentUser.id]) %}&#xA;    {# save the element #}&#xA;    {% do craft.app.getElements().saveElement(user) %}&#xA;    {% if user.hasErrors %}&#xA;        {# print errors via user.getErrors() %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would not recommend it even if it is possible. Those things are better in PHP than in Twig&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-28T16:21:34.763" CommentCount="17" ContentLicense="CC BY-SA 4.0" />
  <row Id="27497" PostTypeId="1" CreationDate="2018-08-28T16:22:26.950" Score="1" ViewCount="75" Body="&lt;p&gt;I'm getting the following SQL error when trying to simply order related entries in a Matrix block. Anyway around this?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'sortOrder' in order clause is ambiguous. The SQL statement executed was: SELECT &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;type&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;archived&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;dateUpdated&lt;/code&gt;, ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is what's throwing the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set package = craft.entries({&#xA;relatedTo: block,&#xA;order: 'sortOrder'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3830" LastEditorUserId="3830" LastEditDate="2018-08-28T16:39:58.193" LastActivityDate="2018-08-29T15:50:18.350" Title="SQL error when trying to use sortOrder on Matrix related block (Craft 2)" Tags="&lt;matrix&gt;&lt;relations&gt;&lt;ordering&gt;&lt;relatedto&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27498" PostTypeId="1" CreationDate="2018-08-28T16:25:24.297" Score="1" ViewCount="298" Body="&lt;p&gt;I try to get PayPal Express running but have quite some difficulties. &#xA;I use the default templates for testing and can get through the whole checkout and payment process, but then PayPal closes and in the console I see the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http.js:114 PaypalUncaught Error: Request to post http://xxx.local/index.php?p=actions/commerce/payments/complete-payment&amp;amp;commerceTransactionHash=xxx&amp;amp;token=xxx&amp;amp;PayerID=xxx failed with 400 error. &#xA;Correlation id: unknown   &#xA;{&quot;error&quot;: &quot;Es ist nicht möglich, Ihre Dateneingabe zu prüfen.&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message can be translated to: It's not possible to check your data input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my Craft config, I changed the token name, as described here: &lt;a href=&quot;https://github.com/craftcms/commerce-paypal&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce-paypal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what the reason for this could be?&lt;/p&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-09-10T16:31:06.963" Title="Craft Commerce 2: PayPal Express not working - Correlation id: unknown" Tags="&lt;plugin-craftcommerce2&gt;&lt;payment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27499" PostTypeId="2" ParentId="27492" CreationDate="2018-08-28T16:31:42.770" Score="5" Body="&lt;p&gt;Short answer is &quot;no, this still isn't possible&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Longer answer is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Tag Manager plugin from Craft 2 will not be ported.&lt;/li&gt;&#xA;&lt;li&gt;Pixel &amp;amp; Tonic have mentioned the possibility of rolling that functionality into Craft's core.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/issues/820&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/820&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what can you do about it? &lt;strong&gt;Vote up this feature request!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-28T16:31:42.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27500" PostTypeId="1" AcceptedAnswerId="27501" CreationDate="2018-08-28T16:43:20.773" Score="2" ViewCount="53" Body="&lt;p&gt;I think a better way to achieve this would be with Supertable, but for now I'm wondering if there is a way to group the example output &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;W/C: 27 Aug 2018&lt;/strong&gt; {{ block.week }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.5&lt;/strong&gt; {{ block.totalTime }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;W/C: 27 Aug 2018&lt;/strong&gt; {{ block.week }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.5&lt;/strong&gt; {{ block.totalTime }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;W/C: 27 Aug 2018&lt;/strong&gt; {{ block.week }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; {{ block.totalTime }}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;instead like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;W/C: 27 Aug 2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so values from the 'number' field {{ block.totalTime }} &#xA;which share the same value from the 'date' field {{ block.week }}&#xA;are somehow grouped together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from the matrix fields in use below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     {% for block in entry.timeSheet %}&#xA;&#xA;        {% if block.totalTime | length %}&#xA;&#xA;        &amp;lt;strong&amp;gt;W/C: {{ block.week|date('j M Y') }}&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&#xA;        {{ block.totalTime }}&#xA;        {% endif %}{{ not loop.last ? '&amp;lt;hr&amp;gt;' }}&#xA;&#xA;     {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2018-08-28T17:00:20.080" Title="Display matrix block which share the same date field value" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27501" PostTypeId="2" ParentId="27500" CreationDate="2018-08-28T17:00:20.080" Score="2" Body="&lt;p&gt;I think what you're saying is that you only want to output the heading once it's different from the previous heading. So if you have two blocks with the same week, we only show it once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set a variable of &lt;code&gt;week&lt;/code&gt; and check that the current block's week (which I've set as &lt;code&gt;tempWeek&lt;/code&gt; to keep code cleaner) is the same. If it isn't the same, it means we've changed week so display the title and then set week to be this new week.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set week = &quot;&quot; %}&#xA;{% for block in entry.timeSheet %}&#xA;    {% set tempWeek = block.week|date('j M Y') %}&#xA;    {% if tempWeek!=week %}&#xA;        &amp;lt;strong&amp;gt;W/C: {{ block.week|date('j M Y') }}&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&#xA;        {% set week = tempWeek %}&#xA;    {% endif %}&#xA;    {% if block.totalTime | length %}&#xA;        {{ block.totalTime }}&amp;lt;br&amp;gt;&#xA;    {% endif %}&#xA;    {{ not loop.last ? '&amp;lt;hr&amp;gt;' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2284" LastActivityDate="2018-08-28T17:00:20.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27502" PostTypeId="2" ParentId="27375" CreationDate="2018-08-28T17:09:27.773" Score="0" Body="&lt;p&gt;As Robin Schambach suggested I looked through my stack trace.&#xA;The request was fine but php couldn't find the template used on ajax-requests due to a misspelling error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed the misspelling – works like a charm.&lt;/p&gt;&#xA;" OwnerUserId="4188" LastActivityDate="2018-08-28T17:09:27.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27503" PostTypeId="2" ParentId="23113" CreationDate="2018-08-28T17:15:53.917" Score="1" Body="&lt;p&gt;Had very similar issues but no MAMP or WAMP; just vanilla Apache and MySQL 5.7.23 (Had the same error with 8.0.12 too - did not test the solution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It worked for me to type in 127.0.0.1 instead of &lt;em&gt;blank&lt;/em&gt; or &lt;em&gt;localhost&lt;/em&gt; in the terminal window when going through the Craft3 setup steps.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Which database driver are you using? [mysql,pgsql,?]: mysql&#xA;Database server name or IP address: [localhost] 127.0.0.1&#xA;Database port: [3306] &#xA;Database username: [root] &#xA;Database password: &#xA;Database name: craft_test_h828&#xA;Database table prefix: &#xA;Testing database credentials... success!&#xA;Saving database credentials to your .env file... done&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5186" LastEditorUserId="5186" LastEditDate="2018-08-28T18:02:52.520" LastActivityDate="2018-08-28T18:02:52.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27504" PostTypeId="2" ParentId="27443" CreationDate="2018-08-28T17:16:26.223" Score="6" Body="&lt;p&gt;The issue is that your Asset Volume URL is &lt;code&gt;@web/image&lt;/code&gt; but your Asset Volume path is &lt;code&gt;@webroot/assets/art&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that Craft will look for the images on disk (to do transforms, etc.) in &lt;code&gt;web/assets/art&lt;/code&gt; but it will generate URLs for frontend requests that point to &lt;code&gt;http://example.com/image&lt;/code&gt; -- where presumably nothing exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These should probably be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;URL: &lt;code&gt;@web/assets/art&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Path: &lt;code&gt;@webroot/assets/art&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...assuming that the &lt;code&gt;web/assets/art/&lt;/code&gt; directory is where these images live.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-08-28T17:16:26.223" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27505" PostTypeId="1" AcceptedAnswerId="27509" CreationDate="2018-08-28T18:40:31.957" Score="1" ViewCount="29" Body="&lt;p&gt;I am making a custom field that provides granular control of what values will be translated and what values will remain shared across multiple sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of that, I'd prefer to entirely the disable the default translation feature of the field so users cannot accidentally set the field to be translatable (which would defeat its purpose).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4966" LastActivityDate="2018-08-28T19:30:56.583" Title="How do I disable the default translation feature for a custom field?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27506" PostTypeId="1" AcceptedAnswerId="27508" CreationDate="2018-08-28T18:50:42.223" Score="1" ViewCount="412" Body="&lt;p&gt;I'm trying to familiarize myself with the Craft architecture and I can't understand whether I should be extending &lt;code&gt;craft\base\Component&lt;/code&gt; or &lt;code&gt;craft\base\Model&lt;/code&gt; for my business logic models. Component seems like a pretty lean class that only adds a few initialization events to Model.&lt;/p&gt;&#xA;" OwnerUserId="5208" LastActivityDate="2018-08-28T19:24:20.333" Title="What's the difference between a Component and a Model in Craft 3?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;models&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27508" PostTypeId="2" ParentId="27506" CreationDate="2018-08-28T19:24:20.333" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/structure-models&quot; rel=&quot;noreferrer&quot;&gt;Models&lt;/a&gt;  are classes that contains abstractions of the reality, for example you could have the model car that contains the technical information about it, how many wheels it has and it's brand. Models are usually not supposed to contain any logic. So it's just a &quot;container&quot; with information &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-components&quot; rel=&quot;noreferrer&quot;&gt;Components&lt;/a&gt; are more like services that contains business logic to work with your models, for example the service car would handle the logic to let your car model drive and move and such. Components in Yii2 are mostly (not always) treated as singletons while you want to have many different instances of your models &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-28T19:24:20.333" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27509" PostTypeId="2" ParentId="27505" CreationDate="2018-08-28T19:30:56.583" Score="1" Body="&lt;p&gt;You can set the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Field.php#L89&quot; rel=&quot;nofollow noreferrer&quot;&gt;translation method &lt;/a&gt; for each field individually &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function supportedTranslationMethods(): array &#xA;{ &#xA;    return&#xA;    [ &#xA;         self::TRANSLATION_METHOD_NONE &#xA;    ];&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-28T19:30:56.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27511" PostTypeId="2" ParentId="18491" CreationDate="2018-08-28T21:08:49.587" Score="4" Body="&lt;p&gt;In Craft 3 you can use &lt;code&gt;getRawSql()&lt;/code&gt; at the end of the element query. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('blog').getRawSql() %}&#xA;&#xA;{{ entries }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-08-28T21:08:49.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27512" PostTypeId="2" ParentId="27483" CreationDate="2018-08-28T23:36:14.620" Score="1" Body="&lt;p&gt;If anyone needs the help with Xampp here is a link that should help. I had abandoned trying with Homestead as I have a terrible time with the Global and have only been able to get per-project installation to work. So I followed the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html#loading-your-plugin-into-a-craft-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft documentation for plugins&lt;/a&gt; and then set my Xampp up for multiple virtual hosts, here is the best walk-through I've found for multiple virtual hosts with Xampp. As far as I can tell it's the same idea as what Andrew is doing with Homestead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.rechnerhaus.de/en/blog/multiple-virtual-hosts-with-windows-7-and-xampp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.rechnerhaus.de/en/blog/multiple-virtual-hosts-with-windows-7-and-xampp&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-08-28T23:36:14.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27514" PostTypeId="1" AcceptedAnswerId="27515" CreationDate="2018-08-29T01:43:25.613" Score="1" ViewCount="94" Body="&lt;p&gt;In Craft 2, is it possible to query a specific element by ID in Twig?  They aren't mentioned in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying things like these but without success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.commerce.paymentMethods.id(1).name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="4646" LastEditDate="2018-08-29T01:50:00.623" LastActivityDate="2018-08-29T01:58:18.827" Title="Payment Method and Discount elements query by ID in Twig" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;query&gt;&lt;payment-methods&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27515" PostTypeId="2" ParentId="27514" CreationDate="2018-08-29T01:58:18.827" Score="2" Body="&lt;p&gt;Commerce 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set paymentMethod = null %}&#xA;{% for pm in craft.commerce.paymentMethods %}&#xA;    {% if pm.id == 2 %}{% set paymentMethod = pm %}{% endif %}&#xA;{% endfor %}&#xA;&#xA;{{ paymentMethod.name }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Commerce 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ craft.commerce.gateways.getGatewayById(2).name }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-08-29T01:58:18.827" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27516" PostTypeId="1" AcceptedAnswerId="27517" CreationDate="2018-08-29T05:01:33.597" Score="2" ViewCount="782" Body="&lt;p&gt;I have some entries with a multi-select field called &quot;gallery&quot;. We can choose many images to this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a given image, how can I query entries whose &quot;gallery&quot; contains this given image? Thx!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried like this with no success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()&#xA;  -&amp;gt;section($section)&#xA;  -&amp;gt;galleryImages('contains' . $image-&amp;gt;id)&#xA;  -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-08-29T06:03:04.713" Title="How to query entries by field values" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27517" PostTypeId="2" ParentId="27516" CreationDate="2018-08-29T06:03:04.713" Score="3" Body="&lt;p&gt;There is a &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;related to&lt;/a&gt; parameter you can use&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry::find()&#xA;  -&amp;gt;section($section)&#xA;  -&amp;gt;relatedTo(['targetElement' =&amp;gt; $image-&amp;gt;id, 'field' =&amp;gt; 'galleryImages')&#xA;  -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-29T06:03:04.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27518" PostTypeId="1" AcceptedAnswerId="27520" CreationDate="2018-08-29T07:08:51.923" Score="5" ViewCount="619" Body="&lt;p&gt;I want to delete some of the tags that are entered in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there is no way to do that in Control Panel, and there is not a valid plugin that can do this (know that from my &lt;a href=&quot;https://craftcms.stackexchange.com/questions/27492/still-not-able-to-manage-tags-in-craft-3/27499#27499&quot;&gt;previous question&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way to delete tags is in the database. So I found &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1115/how-do-i-delete-a-tag#comment1929_1118&quot;&gt;this&lt;/a&gt; comment. I think this is for CraftCMS 2, but is it still the same and for CraftCMS 3?&lt;/p&gt;&#xA;" OwnerUserId="4109" LastEditorUserId="5845" LastEditDate="2018-08-29T09:05:51.357" LastActivityDate="2018-08-29T09:05:51.357" Title="How to delete tags in Craft CMS 3" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;tags&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27519" PostTypeId="2" ParentId="27518" CreationDate="2018-08-29T07:24:06.110" Score="4" Body="&lt;p&gt;Yes the same still applies. You can either delete it via DB directly in your &lt;code&gt;{{%elements}}&lt;/code&gt; column or you can just run &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Craft::$app-&amp;gt;getElements()-&amp;gt;deleteElementById(x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% do craft.app.getElements().deleteElementById(x) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-29T07:24:06.110" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27520" PostTypeId="2" ParentId="27518" CreationDate="2018-08-29T08:30:15.197" Score="4" Body="&lt;p&gt;I do believe this plugin can help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ethercreative/tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ethercreative/tags&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-08-29T08:30:15.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27521" PostTypeId="1" AcceptedAnswerId="27561" CreationDate="2018-08-29T08:42:02.463" Score="1" ViewCount="44" Body="&lt;p&gt;In Twig, I want to find out if a discount is valid based on start/end date.  startDate and endDate don't seem to exist and I can't inspect the discount object by using the json_encode filter (returns {}).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code used to grab the discount object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set discount = null %}&#xA;{% for d in craft.commerce.discounts %}&#xA;    {% if d.id == 1 %}{% set discount = d %}{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;name, description and enabled variables are available but no startDate/endDate.&lt;/p&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="4646" LastEditDate="2018-08-30T05:20:54.750" LastActivityDate="2018-08-31T22:33:54.217" Title="Commerce 1 find if Discount object is valid based on start/end dates (Twig)" Tags="&lt;templating&gt;&lt;plugin-craftcommerce&gt;&lt;discounts&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27522" PostTypeId="1" AcceptedAnswerId="27524" CreationDate="2018-08-29T12:31:43.860" Score="1" ViewCount="246" Body="&lt;h2&gt;Usecase:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I'm sending out custom emails based on certain events to my users. These users have chosen a certain prefered locale in their profile settings and I'd like for those emails to be in that locale instead of in the locale of the control panel at the time of triggering the events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'm looking for is a way to set the relevant locale before rendering the email template with twig but I cant seem to find a way. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Relevant code&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mailer = craft()-&amp;gt;email;&#xA;$mailToBeSent = new EmailModel();&#xA;&#xA;craft()-&amp;gt;templates-&amp;gt;setTemplatesPath(CRAFT_TEMPLATES_PATH);&#xA;$mailToBeSent-&amp;gt;toEmail = 'some.email@domain.com';&#xA;&#xA;$mailToBeSent-&amp;gt;subject = $subject;&#xA;&#xA;$content = craft()-&amp;gt;templates-&amp;gt;render(&#xA;   '_emails/notification',&#xA;    [&#xA;        'userInfo' =&amp;gt; $this-&amp;gt;generateUserInfo($newUser),&#xA;    ]&#xA;&#xA;);&#xA;&#xA;$mailToBeSent-&amp;gt;htmlBody = $content;&#xA;$mailer-&amp;gt;sendEmail($mailToBeSent);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let me know more information is needed or if something is unclear.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2018-08-29T13:40:33.073" Title="Sending a custom email in the users prefered locale" Tags="&lt;localization&gt;&lt;emails&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27523" PostTypeId="1" CreationDate="2018-08-29T13:03:23.107" Score="0" ViewCount="307" Body="&lt;p&gt;I have my Craft 3 database on a separate server than my Craft webserver (load balancing) and when I use the download database backup function in Craft 3, it doesn't know where to look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't worked with a setup with separate locations for the DB and the site before so it's something new for me to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23290/craft-3-cant-backup-database-mysqldump-command-not-found/23291#23291&quot;&gt;this answer&lt;/a&gt;, I think it's where I'd setup a custom &lt;code&gt;backupCommand&lt;/code&gt; config, but I don't know where to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's on an nginx setup if that helps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-08-29T13:50:58.933" LastActivityDate="2018-08-29T13:50:58.933" Title="Setting up Craft 3 database backup command for a remote database server" Tags="&lt;control-panel&gt;&lt;database&gt;&lt;mysql&gt;&lt;back-up&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27524" PostTypeId="2" ParentId="27522" CreationDate="2018-08-29T13:40:33.073" Score="3" Body="&lt;p&gt;You can translate string in PHP and Twig via translate function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function t($message, $variables = array(), $source = null, $language = null, $category = 'craft')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'my string'|t() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::t('my string');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all you need to do is to wrap every string in your templates within the translate filter and pass the preferred local as an argument. For example &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'my latest news'|t([], null, currentUser.locale) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If no parameter is set, Craft will use &lt;code&gt;craft()-&amp;gt;getLanguage()&lt;/code&gt; by default so you can do the following as well&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$tmpLocale = craft()-&amp;gt;getLanguage();&#xA;$user = craft()-&amp;gt;userSession-&amp;gt;getUser();&#xA;craft()-&amp;gt;setLanguage($user-&amp;gt;locale);&#xA;$content = craft()-&amp;gt;templates-&amp;gt;render(&#xA;   '_emails/notification',&#xA;   [&#xA;       'userInfo' =&amp;gt; $this-&amp;gt;generateUserInfo($newUser),&#xA;   ]&#xA;); &#xA;$craft-&amp;gt;setLanguage($tmpLocale);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-29T13:40:33.073" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27525" PostTypeId="1" AcceptedAnswerId="27530" CreationDate="2018-08-29T15:43:24.120" Score="1" ViewCount="110" Body="&lt;p&gt;The documentation states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Many service methods perform some sort of operation for a given model, such as a CRUD operation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/services.html#model-operation-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Link)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But browsing through existing plugins, I see the CRUD logic is most often done in controllers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best practice here?&lt;/p&gt;&#xA;" OwnerUserId="5208" LastActivityDate="2018-08-29T16:54:23.050" Title="In Craft 3 plugins, should CRUD operations go in Controllers or Services?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27527" PostTypeId="2" ParentId="27480" CreationDate="2018-08-29T15:49:45.937" Score="3" Body="&lt;p&gt;Here's my findings after some experimentation:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Elements and Records are two entirely separate entities. The Element is basically the core Craft database entry, while the Record is the additional database entry in a new table with your custom fields.&lt;/li&gt;&#xA;&lt;li&gt;Validation should always be done on the element if you use the pattern used in the question, because &lt;code&gt;saveElement()&lt;/code&gt; will call validate on the element itself, not the record. If you validate on the record and it fails (&lt;code&gt;$record-&amp;gt;save()&lt;/code&gt; returning false), the phantom element will still be created, but no record will refer to it. Yikes.&lt;/li&gt;&#xA;&lt;li&gt;When validating on the element, some rules such as &lt;code&gt;unique&lt;/code&gt; require access to the database, which is not bound to the element per se. In that case, you should map the &lt;code&gt;targetClass&lt;/code&gt; parameter of the rule to the record class.&lt;/li&gt;&#xA;&lt;li&gt;However that does mess up same-model detection with &lt;code&gt;UniqueValidator&lt;/code&gt;: the validation will fail even if you're editing the current model, saying its unique field is already in use (by itself!).&lt;/li&gt;&#xA;&lt;li&gt;Thankfully, you can use the &lt;code&gt;filter&lt;/code&gt; parameter of the rule to manually ignore the current ID. However, you must make sure not to use that is the ID is null (i.e. when creating a new element), because &lt;code&gt;!=&lt;/code&gt; does not work with &lt;code&gt;NULL&lt;/code&gt; values in SQL (you should be using &lt;code&gt;IS NOT&lt;/code&gt; instead).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Summary: here's how to implement unique validation on the Element class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $rules[] = &#xA;    [ &#xA;        'myField', &#xA;        'unique',&#xA;        'targetClass' =&amp;gt; MyRecord::class,&#xA;        'filter' =&amp;gt; function($query) {&#xA;            if ($this-&amp;gt;id !== null) {&#xA;                $query-&amp;gt;andWhere('`id` != :id', [ 'id' =&amp;gt; $this-&amp;gt;id ] );&#xA;            }&#xA;        }&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's it!&lt;/p&gt;&#xA;" OwnerUserId="5208" LastEditorUserId="5208" LastEditDate="2018-08-29T17:17:56.180" LastActivityDate="2018-08-29T17:17:56.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27528" PostTypeId="2" ParentId="27497" CreationDate="2018-08-29T15:50:18.350" Score="1" Body="&lt;p&gt;So this was me being a bit of a numpty here. I was calling the field the wrong way. Doing the following obeys the sort order from the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in block.hostingPackage %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2018-08-29T15:50:18.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27529" PostTypeId="1" AcceptedAnswerId="27540" CreationDate="2018-08-29T16:54:05.180" Score="1" ViewCount="177" Body="&lt;p&gt;In the middle of a Craft 3 build and the client has requested locales like their Craft 2 multilingual site. I am confused by Craft 3 localisation.&#xA;It appears I have to add a site as a language before I can localise/translate any content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2 the adding of translated content could be done directly in the entry via the panel above the slug field - here all the locales for Craft 2 would appear. (On the right in desktop use)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But despite options of Translation method, site, group, language the old method of swapping between entry content language within the entry on the right hand panel is not there. This makes it difficult to see / swap to what has been translated.  It appears changing language is done in the list view of entries. Am I missing something :( ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a shot of Craft 2: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/NgLrm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NgLrm.jpg&quot; alt=&quot;craft 2 translation UI&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a shot of Craft 3:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/15euW.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/15euW.jpg&quot; alt=&quot;craft3 language UI &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2018-08-29T23:23:05.630" LastActivityDate="2018-08-29T23:37:37.277" Title="Entry translation differences Craft 2 and Craft 3" Tags="&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27530" PostTypeId="2" ParentId="27525" CreationDate="2018-08-29T16:54:23.050" Score="4" Body="&lt;p&gt;Putting aside the term &quot;CRUD&quot; for a moment, it essentially breaks down like this...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If something wants to ping your site, it is (almost) inevitably going to be pinging a Controller.&lt;/li&gt;&#xA;&lt;li&gt;If you want to do something in the database (create, update, delete), you should probably be doing that in a Service.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which raises the question, &lt;em&gt;&quot;how/where to bridge that gap?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is, &lt;em&gt;&quot;it depends.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could keep most of your logic in the Controller, and just move the DB interactions to the Service. Or you could immediately ping a Service method as soon as your Controller is hit. Either way is fine, and it depends heavily on what the site requires, and what you (as the developer) are more comfortable with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, sometimes people bend the rules and put DB interactions directly into the Controller method. While that's frowned upon, there may not be any negative repercussions. So don't worry too much about how other people are handling it... just do what makes sense to you.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-29T16:54:23.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27532" PostTypeId="1" CreationDate="2018-08-29T17:45:39.473" Score="1" ViewCount="239" Body="&lt;p&gt;I've got a staging environment where in need to install Craft 3 in the web root rather than above the root as in normally recommended. Like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my-project.test/web&#xA;    config/&#xA;    storage/&#xA;    templates/&#xA;    vendor/&#xA;    .env&#xA;    .env.example&#xA;    composer.json&#xA;    craft.bat&#xA;    index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to set the correct CRAFT_BASE_PATH for this configuration. I've tried using the full path to the web root with no success in addition to some variations on using &lt;strong&gt;DIR&lt;/strong&gt;. Can anyone point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="1077" LastEditorUserId="1077" LastEditDate="2018-09-07T20:38:14.517" LastActivityDate="2018-09-07T20:38:14.517" Title="Install Craft 3 with craft in web root" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27536" PostTypeId="1" CreationDate="2018-08-29T20:48:37.060" Score="2" ViewCount="1260" Body="&lt;p&gt;When my multisite is set up as @web/site, I cannot access the current site handle from my controllers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getSites()-&amp;gt;currentSite-&amp;gt;handle&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is because my form action defaults to the root site ie @web/actions/controller... rather than @web/site/actions/controller...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get the current site or do I need to pass it into the controller from the form?&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="57" LastEditDate="2020-03-17T16:56:33.520" LastActivityDate="2020-03-17T23:50:41.023" Title="How do I access current site handle in Craft 3 controllers" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27537" PostTypeId="1" AcceptedAnswerId="27539" CreationDate="2018-08-29T22:14:21.487" Score="1" ViewCount="69" Body="&lt;p&gt;I'd like to add very basic metadata to assets (Alttext, Caption..)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed in volumes you can add custom field types – but they're not appearing when editing the entry. I found it can be edited in the assets view, but that's too complicated for editors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If those values should be editable in the entry – should the matrix field type be used?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-08-29T23:17:16.520" Title="Assets metadata: Matrix required?" Tags="&lt;assets&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27538" PostTypeId="2" ParentId="27537" CreationDate="2018-08-29T22:57:46.610" Score="2" Body="&lt;p&gt;You could go for a lightweight content-builder. That would mean that you could and would create a matrix blocktype for each of your content elements i.e. one blocktype for image with all the metadata you could chew on as fields, another for say body with some props too and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would also give your users some neat control over the document flow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would saw it seamlessly together on the template layer. Your Content-Editors will not feel a thing.&lt;/p&gt;&#xA;" OwnerUserId="5186" LastActivityDate="2018-08-29T22:57:46.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27539" PostTypeId="2" ParentId="27537" CreationDate="2018-08-29T23:17:16.520" Score="1" Body="&lt;p&gt;Whenever you see an Asset, Entry, Category, or Tag (really, any type of &quot;Element&quot; in Craft), you can double-click the attached tile (in your case, the Asset thumbnail, in your Entry) to get an element editor modal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes editing resources that are one-away much easier than finding it in its element index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See below for an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KoUb0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KoUb0.png&quot; alt=&quot;An example of an Element HUD in Craft 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Two things to note: first, this does happen to be attached &lt;em&gt;inside&lt;/em&gt; a Matrix field, but that's just coincidental—this same feature is available wherever you have a relation field (including other modals); second, I have no fields assigned to this Volume, so it's showing two standard fields, the Filename and Title. Your fields will appear below these.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-08-29T23:17:16.520" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27540" PostTypeId="2" ParentId="27529" CreationDate="2018-08-29T23:37:37.277" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;It appears I have to add a site as a language before I can localise/translate any content?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. If you want to add a new language, you have to add a new site in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It appears changing language is done in the list view of entries.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Changing the language is a matter of changing the site, which is done via the site dropdown in your 2nd screenshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relevant docs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/sites.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/sites.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/localization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/localization.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have suggestions for enhancements/improvements, feel free to share them here: &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-29T23:37:37.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27542" PostTypeId="1" CreationDate="2018-08-30T12:18:26.577" Score="1" ViewCount="102" Body="&lt;p&gt;I'm using &lt;a href=&quot;https://gist.github.com/williamgomes/5749c8f54936823af15c9f1a45713861&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;this Gist&quot;&gt;this Gist&lt;/a&gt; to rewrite the urls on a localized website running on nginx. It's working fine, except for the account activation links. They are localized as well, but they shouldn't. I'm sure there can be made an exception in the rewrite rule for all urls starting with /actions. But I don't know how. Can anybody help?&lt;/p&gt;&#xA;" OwnerUserId="779" LastActivityDate="2018-08-30T12:18:26.577" Title="Rewrite locale urls on nginx, but not for registration links" Tags="&lt;localization&gt;&lt;registration&gt;&lt;nginx&gt;&lt;frontend-form&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27543" PostTypeId="1" CreationDate="2018-08-30T13:25:17.767" Score="1" ViewCount="35" Body="&lt;p&gt;Is it possible with the modifyEntrySources hook to query a field value against another fields value? Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two fields are present on the entry section this hook targets&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;fieldParentId&lt;/li&gt;&#xA;&lt;li&gt;fieldId&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to be able to query in the entry source definition if the &lt;code&gt;fieldParentId&lt;/code&gt; is the same as the &lt;code&gt;fieldId&lt;/code&gt; to return only those records in the entry list within Craft that match this. I'm not sure this is possible, or if there is a special syntax required within the &lt;code&gt;criteria&lt;/code&gt; array to do it?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-09-02T08:35:00.810" Title="modifyEntrySources hook, comparing two field values" Tags="&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27544" PostTypeId="1" AcceptedAnswerId="27609" CreationDate="2018-08-30T14:35:47.017" Score="1" ViewCount="454" Body="&lt;p&gt;I'm attempting to use a combination of SuperTable and Craft's Matrix to create a reusable Bootstrap 4 Accordion element, but I'm hitting a wall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in entry.contentBuilder.all() %}&#xA;    {% for block in row.components.all() %}&#xA;        {% switch block.type.handle %}&#xA;            {% case 'accordion' %}&#xA;                 &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;                            &amp;lt;div class=&quot;accordion&quot; id=&quot;accordion&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                                    &amp;lt;div class=&quot;card-header&quot; id=&quot;heading{{ loop.index }}&quot;&amp;gt;&#xA;                                        &amp;lt;h5 class=&quot;mb-0&quot;&amp;gt;&#xA;                                            &amp;lt;button class=&quot;btn btn-link&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse{{ loop.index }}&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;collapse{{ loop.index }}&quot;&amp;gt;&#xA;                                                {{ block.accordionTitle }}&#xA;                                            &amp;lt;/button&amp;gt;&#xA;                                        &amp;lt;/h5&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;&#xA;                                    &amp;lt;div id=&quot;collapse{{ loop.index }}&quot; class=&quot;collapse {{ loop.first ? 'show' }}&quot; aria-labelledby=&quot;heading{{ loop.index }}&quot; data-parent=&quot;#accordion&quot;&amp;gt;&#xA;                                        &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                                            {{ block.accordionCopy }}&#xA;                                        &amp;lt;/div&amp;gt;&#xA;                                    &amp;lt;/div&amp;gt;&#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above is obviously producing several &lt;code&gt;container&lt;/code&gt; divs, and not the desired &lt;code&gt;card&lt;/code&gt; divs. I've hit a snag attempting to go several layers deep with &lt;code&gt;for&lt;/code&gt; loop nesting and &lt;code&gt;if&lt;/code&gt; conditionals to get it right, but it's messy and nothings come worked so far. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, the idea is that my SuperTable field contentBuilder is added to the Entry layout, so that a user can create several rows and have content types to pick from. In &lt;code&gt;contentBuilder&lt;/code&gt; is a row (field) called &lt;code&gt;components&lt;/code&gt;, of which &lt;code&gt;accordion&lt;/code&gt; is a Matrix field. None of this would even be necessary if Neo was ported to Craft 3 :/ I'd worked out a perfect content builder with Neo before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="6265" LastActivityDate="2018-09-05T14:35:18.907" Title="Bootstrap 4 Accordion with Matrix (and SuperTable)" Tags="&lt;craft3&gt;&lt;matrix&gt;&lt;plugin-supertable&gt;&lt;bootstrap-craft&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27545" PostTypeId="2" ParentId="27364" CreationDate="2018-08-30T17:17:54.953" Score="2" Body="&lt;p&gt;Most servers (speaking in generalities) won't send mail by themselves anymore. You'll need to use some sort of SMTP service. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;https://sendgrid.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SendGrid&lt;/a&gt; to get you going. I believe they have a free plan. You can choose &lt;code&gt;SMTP&lt;/code&gt; from the mail options from the settings page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choose 'Use Authentication' and from there your username is well, your username and your password is...your password. Use Port 587.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-08-30T17:17:54.953" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27546" PostTypeId="1" CreationDate="2018-08-30T20:21:21.293" Score="3" ViewCount="95" Body="&lt;p&gt;So we are moving to Google App Engine Flexible which means we cannot store sessions on files. So I wanted to know if anyone has been able to make Craft 2 Stateless and how was it accomplished?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8517" LastActivityDate="2018-08-30T20:21:21.293" Title="Can you make Craft 2 Stateless?" Tags="&lt;config&gt;&lt;session&gt;&lt;configuration&gt;&lt;craft2&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27547" PostTypeId="2" ParentId="23710" CreationDate="2018-08-30T20:59:54.907" Score="4" Body="&lt;p&gt;As of today, &lt;strong&gt;Site Switcher&lt;/strong&gt; is now available in the plugin store! *&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was called &quot;Language Link&quot; in Craft 2, but the premise is the same... It allows you to switch between sites while staying on the same page.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set element = (category ?? entry ?? null) %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteSwitcher('english', element) }}&quot;&amp;gt;English&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteSwitcher('spanish', element) }}&quot;&amp;gt;Español&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteSwitcher('french', element) }}&quot;&amp;gt;Français&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteSwitcher('german', element) }}&quot;&amp;gt;Deutsch&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://github.com/doublesecretagency/craft-siteswitcher&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/doublesecretagency/craft-siteswitcher&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;* Disclaimer: I am the author of Site Switcher.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-08-30T20:59:54.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27549" PostTypeId="1" AcceptedAnswerId="27550" CreationDate="2018-08-31T08:11:08.363" Score="4" ViewCount="1436" Body="&lt;p&gt;I am creating custom search based on entries. I need to fetch entries in custom plugin.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastActivityDate="2018-08-31T09:05:31.447" Title="How to fetch entries in custom plugin Craft 3?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27550" PostTypeId="2" ParentId="27549" CreationDate="2018-08-31T09:05:31.447" Score="7" Body="&lt;p&gt;For instance like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = Entry::find()&#xA;    -&amp;gt;section('sectionName')&#xA;    -&amp;gt;orderBy('fieldName')&#xA;    -&amp;gt;limit(null)&#xA;    -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have a look here in the documentation (for the code examples you can toggle Twig and PHP view for code examples):&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you add &lt;code&gt;use craft\elements\Entry;&lt;/code&gt; to the top of your plugin file, you can use the &lt;code&gt;Entry::find()&lt;/code&gt; directly, you don't need the namespace prefix like in the examples in the documentation (for instance &lt;code&gt;\craft\elements\Entry::find();&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2018-08-31T09:05:31.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27552" PostTypeId="1" AcceptedAnswerId="27553" CreationDate="2018-08-31T12:57:29.200" Score="1" ViewCount="335" Body="&lt;p&gt;Is there a way to pull all assets from a volume subfolder id?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('pages').type('genealogy').search('pageType:stake') %}&#xA;{% for entry in entries.all() %}&#xA;    {% if entry.id == x %}&#xA;        get all assets from volume subfolder a&#xA;    {% elseif entry.id == y %}&#xA;        get all assets from volume subfolder b&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3627" LastActivityDate="2018-08-31T13:29:45.890" Title="Pull all assets from a specific volume subfolder id" Tags="&lt;assets&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27553" PostTypeId="2" ParentId="27552" CreationDate="2018-08-31T13:29:45.890" Score="2" Body="&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set assets = craft.assets.volumeId(y).folderId(x).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$assets = Asset::find()-&amp;gt;volumeId(y)-&amp;gt;folderId(x)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-08-31T13:29:45.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27555" PostTypeId="1" CreationDate="2018-08-31T14:43:26.263" Score="1" ViewCount="87" Body="&lt;p&gt;I have a matrix with a block type call pageRelatedContent. A user can add multiple block to their entry. I am trying to put all the pageRelatedContent blocks in one div row. For this example, I have three pageRelatedContent blocks in this entry. My code is generating three separate rows. Its a coding thing that I am missing. Can someone please assist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the rendered HTML:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/moX7s.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/moX7s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the desired output:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XmZKa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XmZKa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code. I can see that it is creating a row for every block, but I can't seem to figure out how to insert all the block in one row.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% case 'pageRelatedContent' %}&#xA;{% set relatedContentBlocks = entry.memberCommunicationsPageContent.type('pageRelatedContent') %}&#xA;{% if entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 1 %}&#xA;    {% set colSize = 12 %}&#xA;{% elseif entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 2 %}&#xA;    {% set colSize = 6 %}&#xA;{% elseif entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 3 %}&#xA;    {% set colSize = 4 %}&#xA;{% endif %}&#xA;    &amp;lt;div class=&quot;section-empty section-item&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;container content&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                {% set relatedBlockInfo = relatedContentBlocks|batch(colSize) %}&#xA;                {% for blocks in relatedBlockInfo %}&#xA;                &amp;lt;div class=&quot;col-md-{{ colSize }}&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;list-group accordion-list&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;list-group-item active-panel&quot;&amp;gt;&#xA;                            &amp;lt;a href=&quot;#&quot; class=&quot;active&quot;&amp;gt; {{ block.relatedContentTitle }}&amp;lt;/a&amp;gt;&#xA;                            &amp;lt;div class=&quot;panel&quot; style=&quot;display: block; height: 182px;&quot;&amp;gt;&#xA;                                &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;                                    &amp;lt;ul class=&quot;list-texts text-left&quot;&amp;gt;&#xA;                                        {% for row in block.relatedLinkInformation %}&#xA;                                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{row.linkUrl }}&quot;&amp;gt;{{ row.linkTitle }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                        {% endfor %}&#xA;                                    &amp;lt;/ul&amp;gt;  &#xA;                                &amp;lt;/div&amp;gt;&#xA;                            &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the matrix information:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nf1kS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nf1kS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8678" LastActivityDate="2018-08-31T18:24:27.233" Title="Inserting Multiple Block Types in one div row" Tags="&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27556" PostTypeId="2" ParentId="26377" CreationDate="2018-08-31T16:23:16.380" Score="1" Body="&lt;p&gt;If the dimensions of the image are being displayed is larger than the transform dimensions it will show pixelation in the image. Just double up the dimensions of the transform image to see if this fixes it.&lt;/p&gt;&#xA;" OwnerUserId="5078" LastActivityDate="2018-08-31T16:23:16.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27558" PostTypeId="2" ParentId="27555" CreationDate="2018-08-31T18:24:27.233" Score="2" Body="&lt;p&gt;It wasn't a CSS issue. Lack of twig knowledge. Here is the final fix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% case 'pageRelatedContent' %}&#xA;{% set relatedContentBlocks = entry.memberCommunicationsPageContent.type('pageRelatedContent') %}&#xA;{% if entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 1 %}&#xA;    {% set colSize = 12 %}&#xA;{% elseif entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 2 %}&#xA;    {% set colSize = 6 %}&#xA;{% elseif entry.memberCommunicationsPageContent.type('pageRelatedContent')|length == 3 %}&#xA;    {% set colSize = 4 %}&#xA;{% endif %}&#xA;    {% set isFirst = not block.getPrev() or block.getPrev().type != 'pageRelatedContent' %}&#xA;        {% if isFirst %}&#xA;            &amp;lt;div class=&quot;section-empty section-item&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;container content&quot;&amp;gt;&#xA;                    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        {% endif %}&#xA;        {% set relatedBlockInfo = relatedContentBlocks|batch(colSize) %}&#xA;        {% for blocks in relatedBlockInfo %}&#xA;        &amp;lt;div class=&quot;col-md-{{ colSize }}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;list-group accordion-list&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;list-group-item active-panel&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;#&quot; class=&quot;active&quot;&amp;gt; {{ block.relatedContentTitle }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;div class=&quot;panel&quot; style=&quot;display: block; height: 182px;&quot;&amp;gt;&#xA;                        &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;                            &amp;lt;ul class=&quot;list-texts text-left&quot;&amp;gt;&#xA;                                {% for row in block.relatedLinkInformation %}&#xA;                                &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{row.linkUrl }}&quot;&amp;gt;{{ row.linkTitle }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                                {% endfor %}&#xA;                            &amp;lt;/ul&amp;gt;  &#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    {% set isLast = not block.getNext() or block.getNext().type !='pageRelatedContent' %}&#xA;        {% if isLast %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8678" LastActivityDate="2018-08-31T18:24:27.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27560" PostTypeId="1" CreationDate="2018-08-31T21:00:57.937" Score="1" ViewCount="200" Body="&lt;p&gt;I need to get two text fields under the same custom form and have it return two different values to be stored in the database.  Right now with what I have, it's storing the same variable for both, which I get why it's happening, but I can't come up with a viable solution to return two values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;setting the field&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{{ forms.textField({&#xA;    label: 'Value 1',&#xA;    instructions: 'test',&#xA;    name: name,&#xA;    style: 'width: 50%',&#xA;    value: value})&#xA;}}&#xA;{{ forms.textField({&#xA;    label: 'Value 2',&#xA;    instructions: 'test',&#xA;    name: name,&#xA;    style: 'width: 50%',&#xA;    value: value})&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Field function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('custom-plugin/cloudinary_field',&#xA;        [&#xA;                'name' =&amp;gt; $this-&amp;gt;handle,&#xA;                'value' =&amp;gt; $value,&#xA;                'field' =&amp;gt; $this,&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I make these two text fields each return a value to be stored in the database?&lt;/p&gt;&#xA;" OwnerUserId="8760" LastActivityDate="2018-08-31T21:00:57.937" Title="Craft CMS 3 create custom field in plugin with two fields returning two values" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;field&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27561" PostTypeId="2" ParentId="27521" CreationDate="2018-08-31T22:33:54.217" Score="1" Body="&lt;p&gt;In Commerce 1, &lt;code&gt;craft.commerce.discounts&lt;/code&gt; will return an array of Commerce_DiscountModel objects of all available discounts.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getAllDiscounts($criteria = [])&#xA;{&#xA;    $records = Commerce_DiscountRecord::model()-&amp;gt;findAll($criteria);&#xA;&#xA;    return Commerce_DiscountModel::populateModels($records);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Commerce_DiscountModel&lt;/code&gt; objects have a &lt;code&gt;dateFrom&lt;/code&gt; and a &lt;code&gt;dateTo&lt;/code&gt; property, which is probably what you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Completely untested, but something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set discount = null %}&#xA;{% for d in craft.commerce.discounts %}&#xA;    {% if d.id == 1 %}&#xA;        {% set discount = d %}&#xA;        {% if discount.dateTo &amp;gt; '2018-01-01 00:00:00' and discount.dateFrom &amp;lt; '2018-12-31 23:59:59' %}&#xA;            Matches!&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-08-31T22:33:54.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27562" PostTypeId="1" CreationDate="2018-09-01T00:17:58.867" Score="1" ViewCount="47" Body="&lt;p&gt;Is there a way to return the number of columns in a table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried {{ entry.tableHandle | length }} but this seems to return the number of rows rather than columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a site with a couple of tables and I'm trying to output the number of columns in a given table to use for my CSS responsive column width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.E. If table was 2 columns, it would output a 2 and I would use that to set column width to 50% etc...&lt;/p&gt;&#xA;" OwnerUserId="5553" LastActivityDate="2018-09-01T01:01:11.123" Title="Is there a way to return the number of columns in a table?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27563" PostTypeId="2" ParentId="27562" CreationDate="2018-09-01T01:01:11.123" Score="1" Body="&lt;p&gt;&lt;code&gt;entry.tableHandle&lt;/code&gt; is an array of all of the rows, and each row is an array with keys that are the column names and values that are the column values &lt;strong&gt;AND&lt;/strong&gt; keys that are &lt;code&gt;col1&lt;/code&gt;, &lt;code&gt;col2&lt;/code&gt;, etc. and values that are the column values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can do &lt;code&gt;entry.tableHandle[0]|keys&lt;/code&gt; to get the keys, &lt;code&gt;entry.tableHandle[0]|keys|length&lt;/code&gt; to get the number of keys, and finally &lt;code&gt;(entry.tableHandle[0]|keys|length)/2&lt;/code&gt; to get the number of columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will want to check first that there is a row in the table - this won't work if there is no row &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-09-01T01:01:11.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27564" PostTypeId="1" CreationDate="2018-09-01T06:33:01.063" Score="1" ViewCount="61" Body="&lt;p&gt;I am very new to Craft and have only been working with it for a few hours. However, I am stuck with something I can't seem to figure out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the basics of templates, of which I have an index.php using &lt;code&gt;% extends &quot;_layout&quot; %&lt;/code&gt; Then I created a new Section with the Section Type set as Single for About. Craft sets the Entry template to about and I have the URL set to be about. Then I create a new template file called about.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the problem comes when I go to view it on localhost/about as I get the following message;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The requested URL /about was not found on this server.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I navigate to index.php/about it is there. I'm confused as to why the architecture of the URL is set up this way as on a normal website you would'nt have index.php/ before every other page on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this fixable?&lt;/p&gt;&#xA;" OwnerUserId="8745" LastEditorUserId="8745" LastEditDate="2018-09-01T06:39:23.657" LastActivityDate="2018-09-01T16:45:51.827" Title="How do I remove the index.php from all URLS in Craft 2 CMS?" Tags="&lt;templating&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27565" PostTypeId="2" ParentId="27564" CreationDate="2018-09-01T11:06:20.600" Score="1" Body="&lt;p&gt;It sounds like you haven't set up your .htaccess file or have failed to rename it. The file in the default set up doesn't have the &lt;code&gt;.&lt;/code&gt; at the start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read &lt;a href=&quot;https://docs.craftcms.com/v2/installing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/installing.html&lt;/a&gt; carefully. The bit concerning htaccess is just before step 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also ensure you're files are in the right place.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-09-01T16:45:51.827" LastActivityDate="2018-09-01T16:45:51.827" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27566" PostTypeId="1" AcceptedAnswerId="27567" CreationDate="2018-09-01T15:40:26.223" Score="1" ViewCount="519" Body="&lt;p&gt;My current code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#header { background-image: url('{{ sitePath }}/assets/toxicomental/header.png'); height: 150px; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still, I don't get the image showing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I do wrong?&lt;/p&gt;&#xA;" OwnerUserId="8762" LastActivityDate="2018-09-01T19:04:21.383" Title="background-image CSS property: how to do it right with Craft?" Tags="&lt;assets&gt;&lt;css&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27567" PostTypeId="2" ParentId="27566" CreationDate="2018-09-01T15:56:08.863" Score="3" Body="&lt;p&gt;There is a function called &lt;code&gt;alias&lt;/code&gt; that returns a defined &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-aliases&quot; rel=&quot;nofollow noreferrer&quot;&gt;alias&lt;/a&gt;. A default alias is &lt;code&gt;@web&lt;/code&gt; and it represents your base url,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;background-image: {{ alias('@web') }}/path/to/image.jpg;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would display the file &lt;code&gt;image.jpg&lt;/code&gt; in &lt;code&gt;web/path/to/&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-01T15:56:08.863" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27568" PostTypeId="2" ParentId="27566" CreationDate="2018-09-01T19:04:21.383" Score="1" Body="&lt;p&gt;You don't &lt;em&gt;need&lt;/em&gt; the domain part at all. Why not use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;background-image: /path/to/image.jpg;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-01T19:04:21.383" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27569" PostTypeId="2" ParentId="27543" CreationDate="2018-09-02T08:35:00.810" Score="1" Body="&lt;p&gt;A workaround solution was to essentially do an criteria on the section, return all the records, use a conditional to find out which records have the same &quot;parent ID&quot; and ID&quot;, stores those in an array and then use the id criteria for the entry source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section = 'theSection';&#xA;$criteria-&amp;gt;limit = null;&#xA;$articles = $criteria-&amp;gt;find();&#xA;&#xA;// For storing matching entries on the conditional below&#xA;$ids = [];&#xA;&#xA;foreach ($entries as $entry)&#xA;{&#xA;     if($entry-&amp;gt;fieldParentId == $entry-&amp;gt;fieldId)&#xA;     {&#xA;         array_push($ids, $entry-&amp;gt;id);&#xA;     }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will then provide a list of ids that match the required criteria, which can then be used for a specific entry source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has performance issues though, because you have to get the entire list of entries first each time.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2018-09-02T08:35:00.810" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27570" PostTypeId="1" CreationDate="2018-09-02T11:19:47.487" Score="1" ViewCount="1015" Body="&lt;p&gt;I try to update my craft3 cms system.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ошибка: An error occurred&#xA;&#xA;Вывод: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- The requested package oneup/contao-security-checker-bundle could not be found in any version, there may be a typo in the package name.&#xA;Problem 2&#xA;- Installation request for craftcms/cms 3.0.22 -&amp;gt; satisfiable by craftcms/cms[3.0.22].&#xA;- craftcms/cms 3.0.22 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;Problem 3&#xA;- craftcms/cms 3.0.22 requires enshrined/svg-sanitize ~0.9.0 -&amp;gt; satisfiable by enshrined/svg-sanitize[0.9.0] but these conflict with your requirements or minimum-stability.&#xA;- craftcms/redactor 2.1.6 requires craftcms/cms ^3.0.0-RC15 -&amp;gt; satisfiable by craftcms/cms[3.0.22].&#xA;- Installation request for craftcms/redactor 2.1.6 -&amp;gt; satisfiable by craftcms/redactor[2.1.6].&#xA;&#xA;Potential causes:&#xA;- A typo in the package name&#xA;- The package is not available in a stable-enough version according to your minimum-stability setting&#xA;see for more details.&#xA;- It's a private package and you forgot to add a custom repository to find it&#xA;&#xA;Read for further common problems.&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Solution I've found is - to remove roave/security-advisories, but I still don't understand how I can do this. Same problems I have with plugin install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Composer File&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;  &quot;keywords&quot;: [&#xA;    &quot;craft&quot;,&#xA;    &quot;cms&quot;,&#xA;    &quot;craftcms&quot;,&#xA;    &quot;project&quot;&#xA;  ],&#xA;  &quot;license&quot;: &quot;MIT&quot;,&#xA;  &quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;  &quot;type&quot;: &quot;project&quot;,&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;    &quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;    &quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;    &quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;    &quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;    &quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.18&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;v2.4.0&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.1.5&quot;,    &#xA;    &quot;dolphiq/craft3-forms&quot;: &quot;1.1.0&quot;,&#xA;    &quot;craftcms/contact-form&quot;: &quot;2.2.2&quot;,&#xA;    &quot;craftcms/guest-entries&quot;: &quot;2.1.3&quot;,&#xA;    &quot;nerds-and-company/schematic&quot;: &quot;4.0.14&quot;,&#xA;    &quot;symfony/yaml&quot;: &quot;v3.3.6&quot;,    &#xA;    &quot;illuminate/contracts&quot;: &quot;v5.5.40&quot;,&#xA;    &quot;illuminate/support&quot;: &quot;v5.5.40&quot;,&#xA;    &quot;nesbot/carbon&quot;: &quot;1.32.0&quot;,&#xA;    &quot;psr/container&quot;: &quot;1.0.0&quot;,&#xA;    &quot;psr/simple-cache&quot;: &quot;1.0.1&quot;,&#xA;    &quot;symfony/translation&quot;: &quot;v3.3.6&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@composer dump-autoload -o&quot;,&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thank for your answers &lt;/p&gt;&#xA;" OwnerUserId="8643" LastEditorUserId="8643" LastEditDate="2018-09-02T12:23:43.703" LastActivityDate="2018-09-02T23:17:47.200" Title="Craft 3 CMS Update Error" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;updates&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27571" PostTypeId="2" ParentId="27570" CreationDate="2018-09-02T12:01:02.053" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Solution I've fount is - remove roave/security-advisories, but I still don't understand how I can do this. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To do that, open up your composer.json file, and remove this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;roave/security-advisories&quot;: &quot;dev-master&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that was the last line within your &lt;code&gt;&quot;require&quot;&lt;/code&gt; object, make sure to delete the comma at the end of the line before it, too.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-09-02T12:01:02.053" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27572" PostTypeId="1" CreationDate="2018-09-02T12:04:29.550" Score="0" ViewCount="39" Body="&lt;p&gt;I was hoping to have my module create a few fields, sections, and entries after the Craft 3 CMS has completed it's installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a callback I can listen to that triggers after the CMS is installed? Or maybe there's a &lt;code&gt;onAfterInstall&lt;/code&gt; equivalent I can run? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been poking around the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/InstallController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;InstallController&lt;/a&gt;, but I'm really not sure what I'm looking for. &lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2018-09-02T12:04:29.550" Title="Is there a callback for post Craft 3 CMS installation I can use?" Tags="&lt;craft3&gt;&lt;installation&gt;&lt;modules&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27573" PostTypeId="2" ParentId="27570" CreationDate="2018-09-02T23:17:47.200" Score="1" Body="&lt;p&gt;Try replacing your &quot;require&quot; section with this in your composer.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.18&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^v2.4.0&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;^2.1.5&quot;,    &#xA;    &quot;dolphiq/craft3-forms&quot;: &quot;^1.1.0&quot;,&#xA;    &quot;craftcms/contact-form&quot;: &quot;^2.2.2&quot;,&#xA;    &quot;craftcms/guest-entries&quot;: &quot;^2.1.3&quot;,&#xA;    &quot;nerds-and-company/schematic&quot;: &quot;^4.0.14&quot;&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, if you have Composer installed from the &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;command line&lt;/a&gt;, run &lt;code&gt;composer update&lt;/code&gt; from your project's root and let it finish.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-02T23:17:47.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27574" PostTypeId="2" ParentId="7032" CreationDate="2018-09-03T02:54:46.127" Score="4" Body="&lt;p&gt;&lt;strong&gt;Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have created your project in GC, navigate to GC Storage.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a bucket. You can only create a bucket containing the domain name if you are able to prove ownership. For example, I (personally) could not create &lt;code&gt;files.craftcms.com&lt;/code&gt; as my bucket. Otherwise it can be anything you'd like. Or check out the &lt;a href=&quot;https://cloud.google.com/storage/docs/naming&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bucket and Object Naming Guidelines&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Navigate to IAM &amp;amp; admin. We'll need to create a Service Account that can be used to give Craft access to the bucket.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Give your Service account a name. For example, &quot;Cloud Storage&quot;. Google will create a service account ID that will look something like &lt;code&gt;cloud-storage@&amp;lt;project-name&amp;gt;.iam.gserviceaccount.com&lt;/code&gt;. For Project Role, (you can filter) but choose &quot;Storage Admin&quot;. You'll also want to select the checkbox labeled, &quot;Furnish a new private key&quot;. Choose &lt;code&gt;json&lt;/code&gt; as the format and click &quot;Save&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A file will be downloaded to your computer - awesome. Next install the &lt;a href=&quot;https://github.com/craftcms/google-cloud&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google Cloud Plugin for Craft&lt;/a&gt;: &lt;code&gt;composer require craftcms/google-cloud&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Once installed, create a new Asset Resource and instead of &quot;Local&quot; choose &quot;Google Cloud Storage&quot; as a volume type.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Give your resource a name. For example, &quot;Images&quot;. If you choose to have public url's use this url: &lt;code&gt;http://storage.googleapis.com/&lt;/code&gt;. Unless you have a specific DNS record set up to serve images from that you want to use, you could do that too. Enter the project ID of your project. You can find that by clicking on your project name - very top (blue) nav bar. For example, it could be &lt;code&gt;my-project&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, remember that &lt;code&gt;.json&lt;/code&gt; file that was downloaded? Open that with your favorite text editor and paste the contents into &quot;Contents of the access key file&quot;. Hit the &quot;Refresh&quot; button, and you should now see the name of your primary bucket. In my case &lt;code&gt;files.mysite.com&lt;/code&gt;. You might also notice that Craft will update the base url to the files: &lt;code&gt;http://storage.googleapis.com/files.mysite.com/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From there, you could create sub-folders in GCS. In my case, I've created one called images. I will update that in the Subfolder input: &lt;code&gt;images&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Save your newly created resource!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-09-03T02:54:46.127" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27575" PostTypeId="1" CreationDate="2018-09-03T08:10:01.610" Score="2" ViewCount="267" Body="&lt;p&gt;I'm trying to get some feedback for the user on registration when the username already exists but I don't know in which object the errors are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the form they provide in the docs:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for the forgot password form if the user doesn't exists in the system, I'm not able the provide the right feedback with this form:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/forgot-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/forgot-password-form.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6843" LastActivityDate="2019-09-27T14:43:23.143" Title="Displaying errors on frontend user forms" Tags="&lt;craft3&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27576" PostTypeId="1" AcceptedAnswerId="27587" CreationDate="2018-09-03T08:30:43.420" Score="1" ViewCount="381" Body="&lt;p&gt;I added support for https for the domain, But only the main page works How to make Сraft make the default site address with https instead of http?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upd: Craft 3 on Vestacp and centos. Only the base url and static resources work, that is, only what is actually available. A craft path produces 404, for example, an example.com/admin&lt;/p&gt;&#xA;" OwnerUserId="635" LastEditorUserId="635" LastEditDate="2018-09-03T18:47:16.343" LastActivityDate="2018-09-04T07:42:40.123" Title="transfer to HTTPS" Tags="&lt;https&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27577" PostTypeId="2" ParentId="10772" CreationDate="2018-09-03T09:30:58.450" Score="1" Body="&lt;p&gt;Sometimes you need the same parent/siblings menu from various POVs (parent or children). Here's what I came up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Parent / Children subnavigation, either from the perspective of the parent or a child #}&#xA;&#xA;{% if entry.level == 1 %}&#xA;  {% set parent = entry %}&#xA;  {% set children = entry.getDescendants().all() %}&#xA;{% elseif entry.level == 2 %}&#xA;  {% set parent = entry.getAncestors().one() %}&#xA;  {% set children = entry.getSiblings().all() %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;h1&amp;gt;&amp;lt;a href=&quot;{{parent.url}}&quot;&amp;gt;{{parent.title}}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for child in children %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{child.url}}&quot;&amp;gt;{{child.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wonder if that's a detour and there's an easier way?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-09-03T09:30:58.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27579" PostTypeId="2" ParentId="27576" CreationDate="2018-09-03T10:08:32.190" Score="2" Body="&lt;p&gt;Change your site url in your config file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add a 301 redirect to your htaccess to send requests for http to https.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect http to https&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !=https&#xA;RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work for you then I suggest doing some Google searching. There are hundreds of guides on how to redirect http to https.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's all you need to do.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-09-03T10:36:33.140" LastActivityDate="2018-09-03T10:36:33.140" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27580" PostTypeId="1" CreationDate="2018-09-03T10:28:47.523" Score="1" ViewCount="552" Body="&lt;p&gt;I am using Contact Form Extensions plugin &lt;a href=&quot;https://github.com/Rias500/craft-contact-form-extensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft-contact-form-extensions&lt;/a&gt; for setting up custom notification email template but not sure what tag would be used for additional fields like &lt;code&gt;Phone&lt;/code&gt;.&#xA;Here is my code sample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Name: {{ submission.fromName }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Company: {{ submission.Company }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Name: {{ submission.fromEmail }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Phone: {{ submission.Phone }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Type of Enquiry: {{ submission.typeOfEnquiry }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Message: {{ submission.message }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help.&lt;/p&gt;&#xA;" OwnerUserId="613" LastEditorUserId="57" LastEditDate="2018-09-06T23:04:36.160" LastActivityDate="2018-09-16T10:14:07.567" Title="Email template issue Craft Contact Form Extensions" Tags="&lt;craft3&gt;&lt;emails&gt;&lt;plugin-contactformextensions&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27581" PostTypeId="1" CreationDate="2018-09-03T10:47:58.857" Score="1" ViewCount="124" Body="&lt;p&gt;I've a list of entries, all with custom dates. &#xA;Is there a way to show entries from a specific year, just using the custom date rather than the posted date?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6882" LastActivityDate="2018-09-10T23:41:57.853" Title="Displaying entries from a specific custom date year" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27583" PostTypeId="1" CreationDate="2018-09-03T13:20:24.157" Score="2" ViewCount="228" Body="&lt;p&gt;What is the best way to use Json-LD schema in the templates for Craft 3? I would like to dynamically load parts of the info. I know about the SEOmatic plugin but looking for a way to do it on my own. &lt;/p&gt;&#xA;" OwnerUserId="8709" LastActivityDate="2018-09-03T13:20:24.157" Title="JsonLD &amp; Schema" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;json&gt;&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27584" PostTypeId="2" ParentId="27400" CreationDate="2018-09-03T16:09:38.107" Score="2" Body="&lt;p&gt;I haven't seen this particular issue but generally I've found that from time to time MAMP doesn't like running Craft in CGI mode, i.e. with different PHP versions per host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try switching it to module mode (under the PHP tab of MAMP Pro). If that works, then try reverting to CGI mode. You may find it continues to work.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-03T16:09:38.107" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27585" PostTypeId="1" CreationDate="2018-09-03T22:15:08.417" Score="1" ViewCount="427" Body="&lt;p&gt;I'm trying to output a list of categories that are &lt;strong&gt;not&lt;/strong&gt; related to a particular entry (in order to show a list of services other than the service related to the current entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this code which lists the category that &lt;strong&gt;is&lt;/strong&gt; related to the current entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% set categories = craft.categories.group('services').relatedTo(entry).all() %}&#xA;  {% nav category in categories %}&#xA;    &amp;lt;li&amp;gt;{{ category.title }}&amp;lt;/li&amp;gt;&#xA;  {% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way of turning this on its head, so that the other, non-related categories are displayed? Something like a &lt;code&gt;notRelatedTo(entry)&lt;/code&gt; parameter?&lt;/p&gt;&#xA;" OwnerUserId="8766" LastActivityDate="2018-09-04T07:32:09.730" Title="Display categories not related to an entry" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27586" PostTypeId="2" ParentId="27585" CreationDate="2018-09-04T07:32:09.730" Score="1" Body="&lt;p&gt;You can grab all ids and exclude them from your query&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set excludeIds = craft.categories.group('services').relatedTo(entry).ids() %}&#xA;{% for category in craft.categories.where(['!=', 'elements.id', excludeIds]).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your relation field is in your entry you can do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set categories = craft&#xA;    .categories&#xA;    .section('services')&#xA;    .where(['!=', 'elements.id', entry.category.ids()])&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-04T07:32:09.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27587" PostTypeId="2" ParentId="27576" CreationDate="2018-09-04T07:42:40.123" Score="1" Body="&lt;p&gt;In example.com.nginx.ssl.conf need to insert:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location / {&#xA;    try_files $uri/index.html $uri $uri/ /index.php?$query_string;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="635" LastActivityDate="2018-09-04T07:42:40.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27588" PostTypeId="1" CreationDate="2018-09-04T09:47:54.580" Score="1" ViewCount="87" Body="&lt;p&gt;I am building a timeline which I want to paginate. For this to be efficient, the timeline entries should be in a linear order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The challenge is that entries before present (BP) have to be in descending order, i.e. going from 10,000 years BP to 1,000 BP, then in ascending order into the present, i.e. 1400 &gt; 1700 &gt; 2000 &gt; 2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After discussing this challenge, a colleague recommended adding a minus to the BP entries' title. So now I auto-generate the titles to become&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;timeline-YYYY (before present)&#xA;timeline+YYYY (present)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The target sort order should then be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;timeline-10000&#xA;timeline-1000&#xA;timeline+1400&#xA;timeline+1700&#xA;timeline+2000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately when I use SuperSort with natural sort order I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;timeline+1400&#xA;timeline+1700&#xA;timeline+2000&#xA;timeline-1000&#xA;timeline-10000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume this is because SuperSort sorts the titles as strings and follows the ASCII character sort order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get my target sort order?&lt;/p&gt;&#xA;" OwnerUserId="8596" LastEditorUserId="8596" LastEditDate="2018-09-04T10:06:48.157" LastActivityDate="2018-09-04T10:06:48.157" Title="How to sort entries of a timeline?" Tags="&lt;ordering&gt;&lt;plugin-supersort&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27589" PostTypeId="2" ParentId="27400" CreationDate="2018-09-04T09:53:27.533" Score="1" Body="&lt;p&gt;After discussions on Craft Slack and with Brandon on GitHub it was noticed that one component in Gulp had a path set to compile some files out into a &lt;code&gt;/web&lt;/code&gt; directory, even after I'd changed my project to use the &lt;code&gt;/public&lt;/code&gt; directory instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think Craft was getting confused between &lt;code&gt;/public&lt;/code&gt; and &lt;code&gt;/web&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also lead to the &lt;code&gt;/public&lt;/code&gt; directory having an out of date &lt;code&gt;/cpresources&lt;/code&gt; directory and the login page was unable to match up the new CRSF token field to the set cookie without the javascript resources.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-04T09:53:27.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27590" PostTypeId="1" AcceptedAnswerId="27603" CreationDate="2018-09-04T10:51:39.883" Score="1" ViewCount="41" Body="&lt;p&gt;How does the Craft CMS cache work? I want to show a certain message if the server date is between x and y. Can I do this by using an Twig if/else statement or is this cached?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set now = &quot;now&quot;|date(&quot;U&quot;) %}&#xA;&#xA;{% set tournamentDates = [&#xA;    1536323400,&#xA;    1536409800,&#xA;    1536971400,&#xA;    1537650000,&#xA;    1537736400&#xA;]&#xA;%}&#xA;&#xA;{% for tournamentTime in tournamentDates %}&#xA;&#xA;  &amp;lt;!-- {{ tournamentTime|date(&quot;d-m-y H:i:s&quot;)}} --&amp;gt;&#xA;&#xA;  {% if ( now &amp;gt; tournamentTime ) and ( now &amp;lt; tournamentTime + 43200 ) %}&#xA;&#xA;    TOURNAMENT IS LIVE&#xA;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8770" LastActivityDate="2018-09-05T07:06:07.467" Title="Caching question" Tags="&lt;templating&gt;&lt;cache&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27591" PostTypeId="1" CreationDate="2018-09-04T10:59:44.573" Score="1" ViewCount="820" Body="&lt;p&gt;Can I install Craft 3 using cPanel instead of composer. Any suggestion or guide on it? I tried find tutorials but found for Craft 2, not for Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8771" LastEditorUserId="57" LastEditDate="2018-09-06T18:39:48.673" LastActivityDate="2018-09-06T18:39:48.673" Title="Installing Craft 3 on Cpanel" Tags="&lt;craft3&gt;&lt;control-panel&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27593" PostTypeId="1" CreationDate="2018-09-04T12:10:33.523" Score="1" ViewCount="129" Body="&lt;p&gt;How can I output the rows and values of a table field using the element api plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I have entries I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;$industries = [];&#xA;foreach ($entry-&amp;gt;industries-&amp;gt;all() as $industry) {&#xA;  $industries[] = $industry-&amp;gt;title;                    &#xA;}&#xA;...&#xA;return [&#xA;    'industries' =&amp;gt; $industries&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but &lt;code&gt;-&amp;gt;all()&lt;/code&gt; doesn't work in the scenario of a table.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2018-09-04T19:07:21.243" Title="Loop over table field in Element API plugin" Tags="&lt;plugin-elementapi&gt;&lt;table-field&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27594" PostTypeId="2" ParentId="27590" CreationDate="2018-09-04T12:13:25.637" Score="1" Body="&lt;p&gt;Using the &lt;a href=&quot;https://docs.craftcms.com/v2/templating/cache.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cache tag,&lt;/a&gt; you can control when the cache will expire. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, the check you are doing will have a different result on a daily basis. You can ask a piece of content to be cached until the end of the day. The first request of the next day will automatically clear the cache and the content will be generated again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can define the cache expiration time like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# The cache should expire at the beginning of each day #}&#xA;{% set cacheExpirationTime = now|date_modify('+1 day')|date('Y-m-d 00:00')|date('c') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use this variable in the cache tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache until cacheExpirationTime %}&#xA;    {# Heavy calculations here #}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please note that if you fetch some content from Craft within the cache tag and this content gets modified, the cache will automatically be cleared before the expiration time.&lt;/p&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2018-09-04T12:13:25.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27597" PostTypeId="1" AcceptedAnswerId="27599" CreationDate="2018-09-04T13:22:45.787" Score="1" ViewCount="55" Body="&lt;p&gt;I have live site with PayPal payment Gateway and works flawless. Problem appears when I want to use also WorldPay.&#xA;Payment is going throught but after payment browser is not redirecting to Order Summary Screen and order doesn't appear as placed order in CP.&#xA;I set up everything as stated in Craft Commerce doc. I really don't know what I can do else :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Orders only appears in ACTIVE CARTwith status REDIRECT.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XT33z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XT33z.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another order is adding to the same order that's the problem to identify what has been bought.&lt;/p&gt;&#xA;" OwnerUserId="8472" LastActivityDate="2018-09-04T14:11:45.187" Title="Worldpay Gateway not redirecting to Customer Order screen on successful transaction" Tags="&lt;worldpay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27598" PostTypeId="1" AcceptedAnswerId="27630" CreationDate="2018-09-04T13:48:00.590" Score="1" ViewCount="412" Body="&lt;p&gt;I have a couple of custom plugins for a site, which I successfully added by using &lt;code&gt;path&lt;/code&gt; repositories in my &lt;code&gt;composer.json&lt;/code&gt; file. However, when I upload the site to my staging server (via FTP - no SSH access or Git on this server), the symlinks in &lt;code&gt;craft/vendor/myvendorname&lt;/code&gt; (which are automatically created during any &lt;code&gt;composer update&lt;/code&gt;) won't upload. Thus, my site breaks, trying to load plugins which it cannot find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can manually upload the actual folders to that location (which is my fix for now), but that's not sustainable on an ongoing basis really.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way I can force Craft (or really Composer I suppose) to recreate those symlinks on the remote server? Or is this a case where I simply need SSH access so I can do it manually?&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-09-11T23:20:17.290" Title="How to recreate symlinks to path-based plugins after moving to live server?" Tags="&lt;plugin-development&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27599" PostTypeId="2" ParentId="27597" CreationDate="2018-09-04T14:11:45.187" Score="1" Body="&lt;p&gt;Are you testing from a local domain or on a remotely accessible server? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is a local domain then the return cannot work since Worldpay doesn't know where 'local' is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a remote server then:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is the site turned 'on'? i.e. do you need to be logged in to view the front end&lt;/li&gt;&#xA;&lt;li&gt;Do you have http auth in place (for instance to stop robots crawling a staging site). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If either of the above is true then it's likely that Worldpay can't get to the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, do you have CSRF protection turned on? Try turning it off. If that solves the problem then you will need to bypass it in some way in order for Worldpay to work.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-04T14:11:45.187" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27601" PostTypeId="2" ParentId="27481" CreationDate="2018-09-04T18:51:13.507" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://twitter.com/engramdes/status/1036031189264392192&quot; rel=&quot;nofollow noreferrer&quot;&gt;Received from the developer on Twitter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There’s no way to handle pagination or offsets automatically yet I’m&#xA;  afraid. You’d have to roll your own solution to handle this at the&#xA;  moment&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've been thinking about creating a plugin that polls the API and triggers a FeedMe task with a custom offset parameter. It would also need to record the status of the task once it's complete and the offset for the next 100 records as well. &lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2018-09-04T18:51:13.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27602" PostTypeId="2" ParentId="27593" CreationDate="2018-09-04T19:07:21.243" Score="1" Body="&lt;p&gt;A table field contains a simple array, you can serialize and unserialize it as it is. So there is no custom action required by your side.&#xA;Just use it in PHP like every other textual field &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-04T19:07:21.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27603" PostTypeId="2" ParentId="27590" CreationDate="2018-09-05T07:06:07.467" Score="1" Body="&lt;p&gt;Yes, you can do that in Twig. Twig compiles down to PHP, which gets executed for every request. Craft doesn't do any inherent caching, you have to explicitly ask it to cache things via the &lt;code&gt;{% cache %}&lt;/code&gt; tag, so the example you posted would work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to learn more about the &lt;code&gt;{% cache %}&lt;/code&gt; tag, check out &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Craft {% cache %} Tag In-Depth&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-05T07:06:07.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27604" PostTypeId="2" ParentId="13185" CreationDate="2018-09-05T07:10:57.897" Score="1" Body="&lt;p&gt;In Craft 3, here's a version that worked for me to change the file name after upload (in a module's &lt;code&gt;init()&lt;/code&gt; function):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;Elements::class,&#xA;Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function (ElementEvent $event) {&#xA;        $asset = $event-&amp;gt;element;&#xA;        if ($event-&amp;gt;isNew &amp;amp;&amp;amp; $asset instanceof craft\elements\Asset) {&#xA;             $newFileName = &quot;something.txt&quot;;&#xA;              Craft::$app-&amp;gt;assets-&amp;gt;moveAsset($asset,$asset-&amp;gt;getFolder(),filter_var($asset-&amp;gt;getFilename(), $newFileName);&#xA;        }&#xA;     }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8431" LastEditorUserId="57" LastEditDate="2018-09-06T18:40:39.527" LastActivityDate="2018-09-06T18:40:39.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27605" PostTypeId="1" AcceptedAnswerId="27607" CreationDate="2018-09-05T09:55:39.000" Score="2" ViewCount="396" Body="&lt;p&gt;We have to migrate a CSV dump from a Drupal commerce shop to Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to import ‘Order Email’ / ‘Username’, ‘Order Date’, ‘Ordered Items’ (Name or ID), ‘Item Price’.&#xA;Address etc. are not relevant. An Order Reference could be generated automatically from us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If these are not enough fields for a Craft Commerce order: Which mandatory fields does an order require in Commerce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know if there is a way to do this? We would of course love to do it with the FeedMe plugin, but that does not seem to be applicable to Craft Commerce orders.&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2018-09-06T23:21:31.310" LastActivityDate="2018-09-06T23:21:31.310" Title="Is it possible to import orders into Craft Commerce?" Tags="&lt;migration&gt;&lt;import&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27606" PostTypeId="2" ParentId="449" CreationDate="2018-09-05T11:34:30.720" Score="7" Body="&lt;p&gt;In Craft 3, &lt;code&gt;{{ _self.getTemplateName() }}&lt;/code&gt; throws an error, but &lt;code&gt;{{ _self }}&lt;/code&gt; does the trick.&lt;/p&gt;&#xA;" OwnerUserId="7919" LastActivityDate="2018-09-05T11:34:30.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27607" PostTypeId="2" ParentId="27605" CreationDate="2018-09-05T13:14:14.003" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/import&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Import&lt;/a&gt; supports importing Craft Commerce Orders on Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't speak to which fields are required off of the top of my head but importing to custom fields, variants, and even custom fields like Matrix on Variant Layouts is possible. Any required fields you don't include will throw an error and tell you they are needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the Orders import format is available in the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/import/orders.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Importer docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Import uses a specific JSON format to perform imports so you will need to convert your CSV export into the appropriate JSON format to import if you choose to go this route.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-09-05T13:14:14.003" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27608" PostTypeId="2" ParentId="27591" CreationDate="2018-09-05T14:24:44.633" Score="2" Body="&lt;p&gt;Here's a Mijingo resource that should help: &lt;a href=&quot;https://mijingo.com/blog/manually-installing-craft-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mijingo.com/blog/manually-installing-craft-3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-05T14:24:44.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27609" PostTypeId="2" ParentId="27544" CreationDate="2018-09-05T14:35:18.907" Score="2" Body="&lt;p&gt;I'd break up the forloops a bit so you're outputting the panel container and the accordion wrapper markup once. Then for each accordion (supertable row) you're outputting that markup as many times as it's needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used Bootstrap JS packages for a long time, so I was a bit thrown by the amount of divs you have. (I use &lt;a href=&quot;https://github.com/Alhadis/Accordion&quot; rel=&quot;nofollow noreferrer&quot;&gt;this accordion&lt;/a&gt; package for how simple it is. It's an oldie, but a goodie and is still being maintained.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Matrix loop of blocks #}&#xA;{% for row in entry.contentBuilder.all() %}&#xA;&#xA;    {% switch block.type.handle %}&#xA;    {% case 'accordion' %}&#xA;&#xA;         &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;             &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;                 &amp;lt;div class=&quot;col-md-12&quot;&amp;gt;&#xA;                     &amp;lt;div class=&quot;accordion&quot; id=&quot;accordion&quot;&amp;gt;&#xA;&#xA;                         {# Supertable loop of accordions #}&#xA;                         {% for block in row.components.all() %}&#xA;&#xA;                             &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                                 &amp;lt;div class=&quot;card-header&quot; id=&quot;heading{{ loop.index }}&quot;&amp;gt;&#xA;                                     &amp;lt;h5 class=&quot;mb-0&quot;&amp;gt;&#xA;                                         &amp;lt;button class=&quot;btn btn-link&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse{{ loop.index }}&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;collapse{{ loop.index }}&quot;&amp;gt;&#xA;                                              {{ block.accordionTitle }}&#xA;                                          &amp;lt;/button&amp;gt;&#xA;                                     &amp;lt;/h5&amp;gt;&#xA;                                 &amp;lt;/div&amp;gt;&#xA;&#xA;                                 &amp;lt;div id=&quot;collapse{{ loop.index }}&quot; class=&quot;collapse {{ loop.first ? 'show' }}&quot; aria-labelledby=&quot;heading{{ loop.index }}&quot; data-parent=&quot;#accordion&quot;&amp;gt;&#xA;                                     &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                                         {{ block.accordionCopy }}&#xA;                                     &amp;lt;/div&amp;gt;&#xA;                                 &amp;lt;/div&amp;gt;&#xA;                             &amp;lt;/div&amp;gt;&#xA;&#xA;                        {% endfor %}&#xA;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-05T14:35:18.907" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27610" PostTypeId="2" ParentId="15703" CreationDate="2018-09-05T18:23:03.253" Score="3" Body="&lt;p&gt;This plugin does it for Craft 3: &lt;a href=&quot;https://github.com/kffein/craft-bulk-edit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/kffein/craft-bulk-edit&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8779" LastEditorUserId="57" LastEditDate="2018-09-06T18:37:38.127" LastActivityDate="2018-09-06T18:37:38.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27612" PostTypeId="1" CreationDate="2018-09-06T03:13:47.650" Score="0" ViewCount="215" Body="&lt;p&gt;For example, in a vuejs component, i send a ajax request to get an article. And in this article, there is a relation field called &lt;code&gt;relatedTopics&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get this article's relatedTopics with something like &lt;code&gt;article.relatedTopics&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-09-07T00:25:05.023" Title="How to get one entry's related stuff in Vuejs component" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;frontend&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27613" PostTypeId="1" CreationDate="2018-09-06T03:27:57.770" Score="1" ViewCount="122" Body="&lt;p&gt;While trying to assign a global CSS class based on the &lt;code&gt;order&lt;/code&gt; of the categories based on the drag and drop in the admin editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The categories I'm using is a single 1 level deep category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like the &lt;code&gt;lft&lt;/code&gt; and &lt;code&gt;rgt&lt;/code&gt; values are the only one that changes when they are moved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears I can just divide the &lt;code&gt;lft&lt;/code&gt; number by &lt;code&gt;2&lt;/code&gt; and I get a sequence of the order (1,2,3,4,5,6).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- for category in relatedCategories -%}&#xA;  &amp;lt;a href=&quot;{{ category.url | default }}&quot;&#xA;    class=&quot;ArticleCard-meta-link ArticleCard-meta-link--{{ category.lft /2 }}&quot;&#xA;  &amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do the values &lt;code&gt;lft&lt;/code&gt; and &lt;code&gt;rgt&lt;/code&gt; get assigned and is this a correct assumption that dividing it will always get an incremental pattern?&lt;/p&gt;&#xA;" OwnerUserId="111" LastActivityDate="2018-09-06T03:27:57.770" Title="Getting the order for categories.lft rgt" Tags="&lt;categories&gt;&lt;order&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27614" PostTypeId="1" CreationDate="2018-09-06T10:39:07.290" Score="1" ViewCount="20" Body="&lt;p&gt;I started building a list of recursive relations: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're in a project, we want to check interviews related to that project, see which persons participated in those related interviews, and then build an ordered list of all those persons – without duplicates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first approach was to combine two loops:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedInterviews = craft.entries.section('interviews').relatedTo(entry).all() %}  &#xA;{% if relatedInterviews %}  &#xA;{% set interviewedpersons = [] %}&#xA;  {% for interview in relatedInterviews %}&#xA;    {% set relatedPersons = craft.entries.section('persons').relatedTo(interview).all() %}&#xA;    {% for person in relatedPersons %}&#xA;      {% set interviewedpersons = interviewedpersons|merge([person]) %}&#xA;    {% endfor %} &#xA;  {% endfor %}&#xA;&#xA;  {% for interviewedperson in interviewedpersons %}&#xA;    &amp;lt;a href=&quot;{{interviewedperson.url}}&quot;&amp;gt;{{interviewedperson.firstname}}{{interviewedperson.lastname}}&amp;lt;/a&amp;gt;{% if loop.last %}{% else %}, {% endif %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In PHP, we would now sort and clear duplicates from &lt;code&gt;interviewedpersons&lt;/code&gt;, but I see in twig the array sorting possibilities are a bit reduced, right? Probably because building such a list is already more of a controller than a view / template thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a better approach to do this double relation, sorting and avoiding duplicates via Craft's Entrymodel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedPersons = craft.entries.section('persons').relatedTo(craft.entries.section('interviews').relatedTo(entry)).orderBy('lastname asc, firstname asc').all() %}&#xA;{% for relatedPerson in relatedPersons %}&#xA;   &amp;lt;a href=&quot;{{relatedPerson.url}}&quot;&amp;gt;{{relatedPerson.firstname}}{{relatedPerson.lastname}}&amp;lt;/a&amp;gt;{% if loop.last %}{% else %}, {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;– much better? I'm pleasantly surprised this works. Do I have to check for empty bits, and will duplicates be removed already?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastEditorUserId="8325" LastEditDate="2018-09-06T10:49:24.137" LastActivityDate="2018-09-06T10:49:24.137" Title="Recursive relations – how to build list properly?" Tags="&lt;templating&gt;&lt;entrymodel&gt;&lt;twigextension&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27615" PostTypeId="1" CreationDate="2018-09-06T12:37:05.877" Score="3" ViewCount="215" Body="&lt;p&gt;I'm asking this outside an entry context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My starting point is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% set field = craft.app.fields.getFieldByHandle('matrixFieldHandle')&#xA;  %}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I print the data of the field, I find nothing related to the fields that &lt;code&gt;matrixFieldHandle&lt;/code&gt; contains.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;matrixFieldHandle&lt;/code&gt; (Matrix field)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Block &lt;code&gt;Log&lt;/code&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Field &lt;code&gt;logValue&lt;/code&gt; (Dropdown field)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know how to print the options in a dropdown field:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2205/how-do-i-output-a-dropdowns-values-if-im-on-a-registration-form-not-tied-to-an&quot;&gt;How do I output a dropdown&amp;#39;s values if I&amp;#39;m on a registration form not tied to an entry?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/18853/how-do-i-print-the-options-in-a-dropdown-field&quot;&gt;How do I print the options in a dropdown field?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But how can I print all these dropdown options when it is set inside a Matrix?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="8325" LastEditDate="2018-09-06T14:57:34.673" LastActivityDate="2019-08-23T14:49:34.530" Title="How to print all possible options of a dropdown field inside of a Matrix field?" Tags="&lt;templating&gt;&lt;matrix&gt;&lt;field&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27619" PostTypeId="1" AcceptedAnswerId="27703" CreationDate="2018-09-06T20:18:49.357" Score="3" ViewCount="223" Body="&lt;p&gt;I am using Sprout Forms on a Craft 3 site and trying to submit my form via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been able to do this many times in Craft 2, but not having much luck with 3 (yet). &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/submitting-a-form-via-ajax.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The docs&lt;/a&gt; look mainly for Craft 2 - is there a better way to find examples for Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what the headers look like that I am sending:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CRAFT_CSRF_TOKEN: &amp;lt;huge string hash&amp;gt;&#xA;action: sprout-forms/entries/save-entry&#xA;redirect: &amp;lt;long redirect hash&amp;gt;&#xA;handle: contact&#xA;fields[fullName]: Damon&#xA;fields[email]: name@test.com&#xA;fields[phone]: 211-111-1111&#xA;fields[message]: Hello.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am always getting a 302 response back - without any error or other indication of what might be missing. If I remove the &lt;code&gt;handle&lt;/code&gt; field, I'll get a 400 error, so I know I'm hitting the correct method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Status Code: 302 Found&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what my js looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    type: 'post',&#xA;    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',&#xA;    cache: false,&#xA;    data: $('#contact-form').serialize(),&#xA;    url: $('input[name=action]').val(),&#xA;    processData: false,&#xA;    dataType: 'json',&#xA;    timeout: 50000&#xA;}).done(function (response) {&#xA;    console.log(response);  // nothing.&#xA;}).fail(function (error) {&#xA;    // Total fail.&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what I am including in my form that is Craft/Sprout specific. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ csrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sprout-forms/entries/save-entry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ form.redirectUri|hash }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-09-06T20:24:25.597" LastActivityDate="2018-09-16T01:05:39.680" Title="Why is Sprout Forms returning 302 for ajax requests?" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27620" PostTypeId="2" ParentId="23360" CreationDate="2018-09-06T21:52:12.710" Score="4" Body="&lt;h2&gt;Why is this happening?&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why am I seeing duplicates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When the database is told to sort by random, the entire list of entries is being sorted into a random order before your required page of items is being sliced out of it. This random sort is fresh and different every time the query is made, so when you ask for page 2, it's starting from a different random order, then slicing out items 10 through 18.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Oddly it doesn't feel like there is enough duplication to make me think my method is wrong. From about 100 entries, showing 9 at a time I might see 1 or 2 duplicates at most.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know how to calculate the exact probability, but I ran a little &lt;a href=&quot;https://gist.github.com/tremby/3652b4fae84554b4c0f7a8c2ccf0d82f&quot; rel=&quot;nofollow noreferrer&quot;&gt;simulation&lt;/a&gt;, and assuming you mean you have 100 entries total and are looking for duplicates in two pages of nine entries each, you'd expect about 1 duplicate.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A solution is to pass in a seed value to &lt;code&gt;RAND()&lt;/code&gt; so that it will use the same random order for each query. I've put '123' below, but I'm using the current day in my project so the order changes each day. You could also choose a randomized seed per user and remember it via a cookie or similar.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries({&#xA;        section: 'customers',&#xA;        limit: 9,&#xA;        orderBy: 'RAND(123)',&#xA;    })&#xA;    as pageInfo, pageEntries&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8781" LastEditorUserId="8782" LastEditDate="2018-09-07T17:12:22.273" LastActivityDate="2018-09-07T17:12:22.273" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27621" PostTypeId="2" ParentId="22220" CreationDate="2018-09-06T22:01:20.803" Score="1" Body="&lt;p&gt;Unlike Element API, the CraftQL plugin makes all CRUD calls available and straight forward. &lt;a href=&quot;https://github.com/markhuot/craftql&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftQL&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="746" LastActivityDate="2018-09-06T22:01:20.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27622" PostTypeId="2" ParentId="27575" CreationDate="2018-09-06T23:03:19.243" Score="1" Body="&lt;p&gt;I just tested this with the user registration for in your link and got the expected behavior when you try to register with a username that already exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rwBxX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rwBxX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things to check.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure you have public registration enabled in the Control Panel under Settings-&gt;Users-&gt;Settings.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you're testing registering a user in your front-end form, make sure you're logged out of your current user account.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-06T23:03:19.243" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27623" PostTypeId="2" ParentId="27612" CreationDate="2018-09-07T00:25:05.023" Score="1" Body="&lt;p&gt;So your AJAX request likely hit an Element API or GraphQL endpoint, which would return the data to you as JSON.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly that endpoint returns is totally up to the endpoint, but realize that it's not a PHP/Twig object that gets returned. It's a JSON-ified representation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for you to get the &lt;code&gt;article.relatedTopics&lt;/code&gt; either the endpoint would need to have resolved the &lt;code&gt;.relatedTopics&lt;/code&gt; and return them as JSON, or it could return an &lt;code&gt;id&lt;/code&gt; or other information that you could use in &lt;em&gt;another&lt;/em&gt; AJAX request to return that data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More reading:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/lazy-loading-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lazy Loading with the Element API &amp;amp; VueJS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/autocomplete-search-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Autocomplete Search with the Element API &amp;amp; VueJS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-graphql-to-make-practical-magic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using VueJS + GraphQL to make Practical Magic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-07T00:25:05.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27624" PostTypeId="1" AcceptedAnswerId="27626" CreationDate="2018-09-07T09:31:50.210" Score="1" ViewCount="116" Body="&lt;p&gt;Using Craft 2 and I have a Matrix Block which can contain a carousel item, which uses JS/jQuery. Because the content editor can add multiple instances of this Matrix Block I can’t  set up these carousels in my js file as I need to create unique names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to get around this I’m putting the JS inline using &lt;code&gt;includeJs&lt;/code&gt; and then in my Block template I set and use a Craft variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What’s bizarre is that this works the first time I hit the page, but then this part of &lt;code&gt;includeJs&lt;/code&gt; isn’t getting loaded/included on the page. Happens both locally and online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the content of my Matrix Block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;tabbedCircles  content  content--pad  {{ block.backgroundColour}}&quot;{% if block.stickyNavId %} id=&quot;{{ block.stickyNavId}}&quot;{% endif %}&amp;gt;&#xA;    &amp;lt;div class=&quot;grid&quot;&amp;gt;&#xA;        {% if block.headline %}&#xA;            &amp;lt;h1 class=&quot;{% if block.headlineAlignment in ['center',] %}center  {% endif %}margin--double--mq&quot;&amp;gt;{{ block.headline}}&amp;lt;/h1&amp;gt;&#xA;        {% endif %}&#xA;        {% set carouselNav = block.headline|kebab  ~ 'Nav' %}&#xA;        {% set carouselContent = block.headline|kebab  ~ 'Content' %}&#xA;&#xA;        &amp;lt;div class=&quot;tabbed__circles__wrapper&quot;&amp;gt;&#xA;        &amp;lt;ul class=&quot;tabbed__circles  margin--double--mq {{ carouselNav }}&quot;&amp;gt;&#xA;            {% for row in block.tabContent %}&#xA;&#xA;            {% set iconStatic = craft.entries({&#xA;                section: 'iconsStatic',&#xA;                with: ['tabbedIconCircles.animationTemplate']&#xA;            }).relatedTo(row) %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;div class=&quot;circle&quot;&amp;gt;&#xA;                    {% for entry in iconStatic %}&#xA;                        {% include &quot;_includes/icon&quot; with {&#xA;                            'name': entry.animationTemplate&#xA;                        } %}&#xA;                    {% endfor %}&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;span class=&quot;text--h3&quot;&amp;gt;{{ row.tabTitle }}&amp;lt;/span&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;ul class=&quot;tabbed__circles__content {{ carouselContent }}&quot;&amp;gt;&#xA;            {% for row in block.tabContent %}&#xA;            {% set iconStatic = craft.entries({&#xA;                section: 'iconsStatic',&#xA;                with: ['tabbedIconCircles.animationTemplate']&#xA;            }).relatedTo(row) %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;figure class=&quot;{% if block.contentIconAlignment == 'iconLeftContentRight' %}content__split__icon{% else %}content__split__icon--reverse{% endif %}&quot;&amp;gt;&#xA;                    {% for entry in iconStatic %}&#xA;                        {% include &quot;_includes/icon&quot; with {&#xA;                            'name': entry.animationTemplate&#xA;                        } %}&#xA;                    {% endfor %}&#xA;                &amp;lt;/figure&amp;gt;&#xA;&#xA;                &amp;lt;div class=&quot;{% if block.contentIconAlignment == 'iconLeftContentRight' %}content__split__copy{% else %}content__split__copy--reverse{% endif %}&quot;&amp;gt;&#xA;                    &amp;lt;h1&amp;gt;{{ row.headline }}&amp;lt;/h1&amp;gt;&#xA;&#xA;                    {{ row.body }}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&#xA;{% set carouselJS %}&#xA;&#xA;///// New Slick Carousel for 2018 Tabbed Circles and Content&#xA;var carouselNav = '.{{ carouselNav }}';&#xA;var carouselContent = '.{{ carouselContent }}';&#xA;if ($(carouselContent).length) {&#xA;&#xA;    $(carouselContent).slick({&#xA;        arrows: false,&#xA;        draggable: false,&#xA;        swipeToSlide: true,&#xA;        autoplay: true,&#xA;        autoplaySpeed: 3000,&#xA;        infinite: true,&#xA;        speed: 500,&#xA;        fade: true,&#xA;        slidesToShow: 1,&#xA;        slidesToScroll: 1,&#xA;        asNavFor: carouselNav,&#xA;    });&#xA;&#xA;    $(carouselNav).slick({&#xA;        mobileFirst: true,&#xA;        arrows: false,&#xA;        autoplay: false,&#xA;        //autoplaySpeed: 7000,&#xA;        draggable: true,&#xA;        slidesToShow: 2,&#xA;        slidesToScroll: 1,&#xA;        infinite: true,&#xA;        asNavFor: carouselContent,&#xA;        centerMode: false,&#xA;        focusOnSelect: true,&#xA;        responsive: [&#xA;            {&#xA;              breakpoint: 500,&#xA;              settings: {&#xA;                slidesToShow: 3,&#xA;              }&#xA;            },&#xA;            {&#xA;              breakpoint: 700,&#xA;              settings: {&#xA;                slidesToShow: 4,&#xA;              }&#xA;            },&#xA;            {&#xA;              breakpoint: 1100,&#xA;              settings: {&#xA;                slidesToShow: 5,&#xA;                slidesToScroll: 'none'&#xA;              }&#xA;            }&#xA;        ]&#xA;    });&#xA;&#xA;    $(carouselNav).on('click', function(){&#xA;        $(carouselContent).slick('slickPause');&#xA;        $(carouselNav).slick('slickPause');&#xA;    });&#xA;};&#xA;{% endset %}&#xA;&#xA;{% includeJs carouselJS %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3830" LastActivityDate="2018-09-07T14:10:59.797" Title="includeJs not consistently working" Tags="&lt;matrix&gt;&lt;javascript&gt;&lt;includejs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27625" PostTypeId="1" CreationDate="2018-09-07T13:57:02.690" Score="1" ViewCount="440" Body="&lt;p&gt;I have a front-end form where logged users can upload and delete their personal files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These users have the strict minimum permissions required to interact with this form. They can only Create, Publish and Delete their own entries in the section where the form create these entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to be able to delete these files from Craft (and not from only the field they're linked in this entry), I have created this custom action in a module:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace modules\mymodule\controllers;&#xA;&#xA;use Craft;&#xA;use craft\web\Controller;&#xA;use craft\elements\Asset;&#xA;&#xA;class DefaultController extends Controller&#xA;{&#xA;&#xA;    public function actionDeleteAsset()&#xA;    {&#xA;        $this-&amp;gt;requireAcceptsJson();&#xA;        $this-&amp;gt;requireLogin();&#xA;&#xA;        $currentUser = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;        if (!$currentUser) {&#xA;            return $this-&amp;gt;asErrorJson(Craft::t('app', 'Only a logged in user can delete an asset.'));&#xA;        } else {&#xA;            $request = Craft::$app-&amp;gt;getRequest();&#xA;            $assetId = $request-&amp;gt;getParam('assetId', '');&#xA;            $asset = Craft::$app-&amp;gt;getAssets()-&amp;gt;getAssetById($assetId);&#xA;&#xA;            if (!empty($asset)) {&#xA;                if (!Craft::$app-&amp;gt;getUser()-&amp;gt;checkPermission('deleteFilesAndFoldersInVolume:' . $asset-&amp;gt;volumeId)) {&#xA;                    return $this-&amp;gt;asErrorJson(Craft::t('app', 'You don\'t have permission to delete this asset.'));&#xA;                } else {&#xA;                    Craft::$app-&amp;gt;getElements()-&amp;gt;deleteElementById($asset-&amp;gt;id, Asset::class);&#xA;                    return $this-&amp;gt;asJson([&#xA;                        'success' =&amp;gt; true&#xA;                    ]);&#xA;                }&#xA;            } else {&#xA;                return $this-&amp;gt;asErrorJson(Craft::t('app', 'This asset does not exists or has already been deleted.'));&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that &lt;code&gt;Craft::$app-&amp;gt;getUser()-&amp;gt;checkPermission('deleteFilesAndFoldersInVolume:' . $asset-&amp;gt;volumeId)&lt;/code&gt;is not entirely appropriate:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I need to add Volume permissions (View volume + Remove files and&#xA;folders) to these users to allow them to delete their assets from the&#xA;front-end form ;&lt;/li&gt;&#xA;&lt;li&gt;By adding these permissions, they have access to&#xA;other users' assets, which is a security problem ;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So how can I check if user has the permissions to delete only his own assets? In other words, this user can only interact with the assets he has uploaded.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-09-25T10:15:27.860" Title="Plugin development: how can I check if user has the permissions to delete only his own assets?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;frontend-form&gt;&lt;delete&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27626" PostTypeId="2" ParentId="27624" CreationDate="2018-09-07T14:10:59.797" Score="2" Body="&lt;p&gt;I’m gonna guess that you’re caching this block of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can’t technically cache an &lt;code&gt;includeJs&lt;/code&gt; tag, because it’s not creating any HTML at that exact spot. It will only work the very first time, before the caching has taken place. Once the cached chunk of HTML is being retrieved from your database, the JS will not be a part of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workaround is to &lt;em&gt;not&lt;/em&gt; cache your &lt;code&gt;includeJs&lt;/code&gt; line. You can either omit it directly (by carefully placing your &lt;code&gt;cache&lt;/code&gt; tags), or use a plugin like No Cache which briefly deactivates the caching for that spot. &lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-09-07T14:10:59.797" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27628" PostTypeId="1" CreationDate="2018-09-07T16:10:41.347" Score="6" ViewCount="1010" Body="&lt;p&gt;I have a setup with multi sites that are separate domains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;site-a.com &lt;/p&gt;&#xA;&#xA;&lt;p&gt;site-b.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to have assets separate for each site, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;site-a.com/images/picture1.jpg&lt;/p&gt;&#xA;&#xA;&lt;p&gt;site-b.com/images/picture2.jpg&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried setting up aliases for each site, but just couldn't get it to work.&#xA;Managed to get only one set of aliases to work, in the general.php file, under '*'.&#xA;But cannot get aliases to be different for each site, like @web for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would i setup the general.php or volumes.php or env.php to have separate assets for each site?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional notes: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the latest version of Craft 3 (Craft CMS 3.0.23.1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP 7.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting &quot;Propagate entries across all enabled sites?&quot; in section is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting &quot;Manage relations on a per-site basis&quot; for asset field is enabled.&lt;/p&gt;&#xA;" OwnerUserId="3545" LastActivityDate="2019-12-17T16:05:04.033" Title="How to setup assets in multi site where each site should have its own assets?" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;multi-site&gt;&lt;multi-domain&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27629" PostTypeId="2" ParentId="22220" CreationDate="2018-09-07T19:44:34.063" Score="2" Body="&lt;p&gt;Piggy-backing off of the other answers here, using GraphQL via the &lt;a href=&quot;https://github.com/markhuot/craftql&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraphQL plugin&lt;/a&gt; is a really nice option, because you don't have to build your own ElementAPI via PHP. You just install the plugin, and away you go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the &lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-graphql-to-make-practical-magic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using VueJS + GraphQL to make Practical Magic&lt;/a&gt; article and the &lt;a href=&quot;https://devmode.fm/episodes/graphql-better-than-all-the-rest&quot; rel=&quot;nofollow noreferrer&quot;&gt;GraphQL: Better than all the REST?&lt;/a&gt; podcast.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-07T19:44:34.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27630" PostTypeId="2" ParentId="27598" CreationDate="2018-09-07T21:14:53.607" Score="2" Body="&lt;p&gt;Symlinks won't transfer over FTP and I'm like 98% sure there isn't a way to get Craft to re-create those symlinks natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd need SSH access to the box with Composer installed in the terminal.  Then you could upload your custom plugins, &lt;code&gt;composer.json&lt;/code&gt; and run &lt;code&gt;composer update&lt;/code&gt; or upload &lt;code&gt;composer.json&lt;/code&gt; and &lt;code&gt;composer.lock&lt;/code&gt; and run &lt;code&gt;composer install&lt;/code&gt; to have the dependencies pulled down and the symlinks re-created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, and this is probably cleaner, you can setup a &lt;code&gt;vcs&lt;/code&gt; type of repository in your &lt;code&gt;composer.json&lt;/code&gt; file, along side your &lt;code&gt;path&lt;/code&gt; repository.  &lt;a href=&quot;https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They'd both point to the same plugin.  When you deploy to production, Composer should see that the &lt;code&gt;path&lt;/code&gt; repo doesn't resolve to a valid path on the production file system and move onto the &lt;code&gt;vcs&lt;/code&gt; repo for the same plugin and pull the files down that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's compatible with private repositories, too: &lt;a href=&quot;https://getcomposer.org/doc/05-repositories.md#using-private-repositories&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/doc/05-repositories.md#using-private-repositories&lt;/a&gt; and you can setup Github access tokens if you'd rather go that way: &lt;a href=&quot;https://www.previousnext.com.au/blog/managing-composer-github-access-personal-access-tokens&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.previousnext.com.au/blog/managing-composer-github-access-personal-access-tokens&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-09-11T23:20:17.290" LastActivityDate="2018-09-11T23:20:17.290" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27633" PostTypeId="2" ParentId="27581" CreationDate="2018-09-08T10:32:30.503" Score="1" Body="&lt;p&gt;I ended up using this code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set upcoming = craft.entries.section('section').order('customDate')%}            &#xA;&#xA;{% for entry in upcoming %} &#xA;    {% if entry.customDate =='2018-10-12' %}    &#xA;        {{entry.title}}         &#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works for now anyway.&lt;/p&gt;&#xA;" OwnerUserId="6882" LastEditorUserId="57" LastEditDate="2018-09-10T23:41:57.853" LastActivityDate="2018-09-10T23:41:57.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27634" PostTypeId="1" AcceptedAnswerId="27735" CreationDate="2018-09-08T13:40:28.577" Score="1" ViewCount="139" Body="&lt;p&gt;I've built a page listing all entries by Character 0-9/A-Z. But unfortunately it's extremely slow loading due to the amount of entries the site has. I'm wondering if I can break out the letters into seperate pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently everything is on&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.../brands/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I'm looking to do is create&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.../brands/a&#xA;.../brands/b&#xA;.../brands/c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm unsure if it's code running to create this or something more in the backend of Craft and how I've created the section. The code currently running the A-Z&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('brands') %}&#xA;      {% set entriesGrouped = entries|group('title|slice(0, 1)|upper|replace(&quot;/[^A-Z]/&quot;, &quot;0-9&quot;)') %}&#xA;&#xA;      {% for letter, entriesInGroup in entriesGrouped %}&#xA;          &amp;lt;h3&amp;gt;{{ letter }}&amp;lt;/h3&amp;gt;&#xA;          &amp;lt;ul class=&quot;store-list&quot;&amp;gt;&#xA;          {% for entry in entriesInGroup %}&#xA;            &amp;lt;li&amp;gt;&#xA;              {% for asset in entry.brandLogo.all() %}&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                  &amp;lt;div class=&quot;retailer-logo&quot;&amp;gt;&#xA;                    &amp;lt;img src=&quot;{{ asset.geturl }}&quot; class=&quot;img-fluid&quot; alt=&quot;{{ entry.title }} Discount Codes &amp;amp; Vouchers&quot;/&amp;gt;&#xA;                  &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;              {% endfor %}&#xA;              &amp;lt;a href=&quot;{{ entry.url }}&quot; title=&quot;{{ entry.title }} Coupon Codes&quot;&amp;gt;{{ entry.title }} Coupons&amp;lt;/a&amp;gt;&#xA;              {% endfor %}&#xA;              &amp;lt;/li&amp;gt;&#xA;          &amp;lt;/ul&amp;gt;&#xA;          &amp;lt;hr&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-09-18T21:44:57.273" Title="A-Z Separate Pages" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sections&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27636" PostTypeId="1" CreationDate="2018-09-08T19:26:55.763" Score="1" ViewCount="270" Body="&lt;p&gt;I have tried to get a number of plugins from the Plugin Store but each time on install, I get the following errors: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Status: Not Found&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Response: {&quot;error&quot;:&quot;Template not found: internal_error.html&quot;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone seen this as well?&lt;/p&gt;&#xA;" OwnerUserId="7167" LastActivityDate="2018-11-10T00:03:10.557" Title="Craft 3 Upddate: Plugin Errors" Tags="&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27637" PostTypeId="2" ParentId="27580" CreationDate="2018-09-08T22:43:56.960" Score="1" Body="&lt;p&gt;I think it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ submission.message.Phone }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4892" LastActivityDate="2018-09-08T22:43:56.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27639" PostTypeId="1" AcceptedAnswerId="27642" CreationDate="2018-09-08T23:48:25.297" Score="3" ViewCount="2200" Body="&lt;p&gt;I set up a basic plugin using &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The package name is &lt;code&gt;kgrote&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin name is &lt;code&gt;siteutilities&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I put it in a subfolder next to my Craft project folder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/site&#xA;|-- craft&#xA;|-- craft-plugins&#xA;  |-- kgrote&#xA;    |-- siteutilities&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I added this to &lt;code&gt;craft/composer.json&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;&quot;prefer-stable&quot;: true,&#xA;&quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;../craft-plugins/kgrote/siteutilities&quot;&#xA;    }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I ran this command in the Craft project folder: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;composer require kgrote/siteutilities&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I got this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Could not find a matching version of package kgrote/siteutilities.&#xA;  Check the package spelling, your version constraint and that the&#xA;  package is available in a stability which matches your&#xA;  minimum-stability (stable).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is the contents of my &lt;code&gt;craft/composer.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.23.1&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &quot;craftcms/aws-s3&quot;: &quot;1.0.8&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.1.6&quot;,&#xA;    &quot;ether/seo&quot;: &quot;3.4.3&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ]&#xA;  },&#xA;  &quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;  &quot;prefer-stable&quot;: true,&#xA;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;../craft-plugins/kgrote/siteutilities&quot;&#xA;    }&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the contents of my plugin &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;name&quot;: &quot;kgrote/site-utilities&quot;,&#xA;    &quot;description&quot;: &quot;Helper functions for this website.&quot;,&#xA;    &quot;type&quot;: &quot;craft-plugin&quot;,&#xA;    &quot;version&quot;: &quot;1.0.0&quot;,&#xA;    &quot;keywords&quot;: [&#xA;        &quot;craft&quot;,&#xA;        &quot;cms&quot;,&#xA;        &quot;craftcms&quot;,&#xA;        &quot;craft-plugin&quot;,&#xA;        &quot;site utilities&quot;&#xA;    ],&#xA;    &quot;support&quot;: {&#xA;        &quot;docs&quot;: &quot;???&quot;,&#xA;        &quot;issues&quot;: &quot;???&quot;&#xA;    },&#xA;    &quot;license&quot;: &quot;MIT&quot;,&#xA;    &quot;authors&quot;: [&#xA;        {&#xA;            &quot;name&quot;: &quot;Kristen Grote&quot;&#xA;        }&#xA;    ],&#xA;    &quot;require&quot;: {&#xA;        &quot;craftcms/cms&quot;: &quot;^3.0.0-RC1&quot;&#xA;    },&#xA;    &quot;autoload&quot;: {&#xA;        &quot;psr-4&quot;: {&#xA;          &quot;kgrote\\siteutilities\\&quot;: &quot;src/&quot;&#xA;        }&#xA;    },&#xA;    &quot;extra&quot;: {&#xA;        &quot;name&quot;: &quot;Site Utilities&quot;,&#xA;        &quot;handle&quot;: &quot;site-utilities&quot;,&#xA;        &quot;hasCpSettings&quot;: false,&#xA;        &quot;hasCpSection&quot;: false,&#xA;        &quot;changelogUrl&quot;: &quot;???&quot;,&#xA;        &quot;class&quot;: &quot;kgrote\\siteutilities\\SiteUtilities&quot;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Don't really know what I'm doing wrong here. How does composer know what &lt;code&gt;kgrote/siteutilities&lt;/code&gt; is if it's not defined in the &lt;code&gt;composer.json&lt;/code&gt; file? Shouldn't that be part of the &lt;code&gt;&quot;repositories&quot;&lt;/code&gt; config setting?&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2018-09-10T00:43:23.457" LastActivityDate="2018-09-10T10:41:29.567" Title="Can't Install Plugin Via Composer" Tags="&lt;plugins&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27640" PostTypeId="1" AcceptedAnswerId="27672" CreationDate="2018-09-09T18:51:02.970" Score="2" ViewCount="35" Body="&lt;p&gt;Probably pure twig:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building an array from nodes taken from a RSS-feed where one of the keys contains a colon which of course breaks everything. Like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Node in feed: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;media:thumbnail url=&quot;stuff I like to get.&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My twig:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for node in feed %}&#xA;        {% set latestArticles = latestArticles|merge([{&#xA;                'timestamp': node.pubDate|atom,&#xA;                'title': node.title,&#xA;                'uri': node.link,&#xA;                'description': node.description,&#xA;                'thumbnail' : node.media:thumbnail,&#xA;            }]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So how do I get &lt;code&gt;media:thumbnail&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried different things but without luck.&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2018-09-09T19:05:52.313" LastActivityDate="2018-09-12T07:43:50.327" Title="Build array from nodes from RSS where keys contain colons" Tags="&lt;templating&gt;&lt;array&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27641" PostTypeId="1" AcceptedAnswerId="27650" CreationDate="2018-09-10T00:46:18.740" Score="1" ViewCount="206" Body="&lt;p&gt;Suddenly getting this strange error every time I try to update Craft or any plugins through the admin;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Status: Internal Server Error&#xA;&#xA;Response: &amp;lt;pre&amp;gt;PHP Fatal Error &amp;amp;#039;yii\base\ErrorException&amp;amp;#039; with message &amp;amp;#039;Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)&amp;amp;#039; &#xA;&#xA;in /Users/a/Sites/askrembla/vendor/composer/composer/src/Composer/DependencyResolver/Solver.php:220&#xA;&#xA;Stack trace:&#xA;#0 [internal function]: yii\base\ErrorHandler-&amp;amp;gt;handleFatalError()&#xA;#1 {main}&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Memory and all that is fine as far as I can tell, so not sure why this error is thrown. Will continue investigating on my end.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2018-09-10T23:42:25.080" Title="Updating plugins from the admin doesn't work" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27642" PostTypeId="2" ParentId="27639" CreationDate="2018-09-10T05:15:19.793" Score="4" Body="&lt;p&gt;From looking at your plugin's &lt;code&gt;composer.json&lt;/code&gt; file, I think you've got the package name wrong – instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require kgrote/siteutilities&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you'll probably want&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require kgrote/site-utilities&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I.e. the plugin folder's name doesn't matter – it's the &lt;code&gt;name&lt;/code&gt; entry in your plugin's &lt;code&gt;composer.json&lt;/code&gt; file that determines the package name.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-09-10T05:15:19.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27643" PostTypeId="1" CreationDate="2018-09-10T08:27:32.380" Score="1" ViewCount="70" Body="&lt;p&gt;I am still new to craft commerce and I have 5 sales, some are flat and others are percent. When i loop through my products, I am trying to get the type of the sale for the current product. How do i get that?&lt;/p&gt;&#xA;" OwnerUserId="8765" LastActivityDate="2018-09-12T14:06:52.700" Title="How to get the name of a product's sale" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27644" PostTypeId="2" ParentId="27639" CreationDate="2018-09-10T10:41:29.567" Score="1" Body="&lt;p&gt;Adding &lt;code&gt;kgrote/siteutilities&lt;/code&gt; to your &quot;require&quot; section in your main composer file then changing your &quot;name&quot; in the plugin composer file to match should help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to update the plugin version number to try to force composer top get the latest versions. I've found it caches in the Vendors directory though. So make the above changes and delete the composer.lock file and the Vendors directory and install everything from scratch.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-10T10:41:29.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27646" PostTypeId="1" AcceptedAnswerId="27669" CreationDate="2018-09-10T16:12:06.010" Score="1" ViewCount="194" Body="&lt;p&gt;I need to check if the first block in a Matrix field matches one of an array of types. Here's a simplified version of my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.newsArticleContent.one().type in ['fullWidthImage', 'imageGroup'] %}&#xA;    yep&#xA;{% else %}&#xA;    nope&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.newsArticleContent.one().type }}&lt;/code&gt; outputs &lt;code&gt;fullWidthImage&lt;/code&gt;, but the above conditional outputs &lt;code&gt;nope&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following outputs &lt;code&gt;yep&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if 'fullWidthImage' in ['fullWidthImage', 'imageGroup'] %}&#xA;    yep&#xA;{% else %}&#xA;    nope&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so I know it's not a problem with the &lt;code&gt;if&lt;/code&gt; statement or the fact that I'm checking the value against an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reason why the value of &lt;code&gt;entry.newsArticleContent.one().type&lt;/code&gt; can't be used in this context?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Thought I should mention that I'm looping through all blocks in the Matrix field later on in the same template. Just in case that's relevant.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="57" LastEditDate="2018-09-11T23:38:33.010" LastActivityDate="2018-09-11T23:38:33.010" Title="Check if the first block in a Matrix field matches one of an array of types" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27647" PostTypeId="2" ParentId="27498" CreationDate="2018-09-10T16:31:06.963" Score="2" Body="&lt;p&gt;The Craft support helped me to figure this out. The problem was, that the CSRF wasn't properly disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my config/general.php I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( !function_exists('isApiRequest') ) {&#xA;    function isApiRequest ()&#xA;    {&#xA;        $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);&#xA;        $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);&#xA;&#xA;        $actions = [&#xA;            'actions/charge/webhook/callback',&#xA;            'actions/commerce/payments/complete-payment',&#xA;&#xA;        ];&#xA;&#xA;        foreach ($actions as $action) {&#xA;            if ( strpos($path, $action) || strpos($query, $action) ) {&#xA;                return true;&#xA;            }&#xA;        }&#xA;&#xA;        return false;&#xA;    }&#xA;}&#xA;&#xA;return [&#xA;&#xA;'*' =&amp;gt; [&#xA;&#xA;    'enableCsrfProtection' =&amp;gt; !isApiRequest(),&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5366" LastActivityDate="2018-09-10T16:31:06.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27648" PostTypeId="1" CreationDate="2018-09-10T16:51:36.923" Score="2" ViewCount="1170" Body="&lt;p&gt;First attempt at making a module. So far all I've done is try to change the namespace of the template that was included with my freshly installed craft 3.0.23.1 project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was following the official docs (&lt;a href=&quot;https://docs.craftcms.com/v3/extend/module-guide.html#set-up-the-basic-file-structure&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/module-guide.html#set-up-the-basic-file-structure&lt;/a&gt;) and spend a few hours trying to figure this out on various searches here and elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the file '/modules/Module.php' I changed&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace banana\modules;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;, then in '/composer.json' changed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;banana\\modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in Terminal, ran the command 'composer dump-autoload -a' in the project folder. Reload the page and I get the error. Other than just doing the setup wizard, i haven't touched any other files in the project.&lt;/p&gt;&#xA;" OwnerUserId="7485" LastActivityDate="2019-02-07T17:11:01.737" Title="Getting a 'ReflectionException' error, &quot;Class modules\Module does not exist' when I change the namespace of my module in Craft 3" Tags="&lt;modules&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27649" PostTypeId="2" ParentId="27648" CreationDate="2018-09-10T17:07:49.130" Score="2" Body="&lt;p&gt;It's a bit difficult without seeing all of your code, but I'm going to guess that you also need to make changes in your &lt;code&gt;config/app.php&lt;/code&gt; to make the namespace changes you're making.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So two things I'd recommend... first, you can generate your module's framework here: &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and second I wrote up a tutorial on creating a module in the &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt; article.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-10T17:07:49.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27650" PostTypeId="2" ParentId="27641" CreationDate="2018-09-10T17:53:40.977" Score="1" Body="&lt;p&gt;Memory is definitely not fine, the error message is very explicit:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Allowed memory size of 134217728 bytes exhausted&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You need to raise your PHP memory limits. Craft requires a minimum of 256MB to run properly.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/requirements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/requirements.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-09-10T17:53:40.977" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27651" PostTypeId="1" AcceptedAnswerId="27670" CreationDate="2018-09-10T20:31:42.393" Score="1" ViewCount="1621" Body="&lt;p&gt;I am receiving the error message &quot;Impossible to invoke a method (&quot;limit&quot;) on an array,&quot; but I don't think I am working with an array! Here is why I think that...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I set an &lt;code&gt;albums&lt;/code&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set albums = craft.entries.section('townAlbums').with(['townPhotoAlbum']).relatedTo(entry) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I loop through that object. I'm not calling &lt;code&gt;.all()&lt;/code&gt;, so this is still an object, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for album in albums %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally within this loop I am grabbing one image from the assets field &lt;code&gt;townPhotoAlbum&lt;/code&gt; to use as a thumbnail or cover image for this album:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set albumCover = album.townPhotoAlbum.limit(1) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is it complaining about using &lt;code&gt;.limit()&lt;/code&gt; on an array when it appears as though I'm still working with an object? Or am I overlooking something woefully obvious?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-09-11T23:44:46.837" Title="Impossible to invoke a method (&quot;limit&quot;) on an array... but it's not an array?" Tags="&lt;entries&gt;&lt;array&gt;&lt;limit&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27652" PostTypeId="2" ParentId="27636" CreationDate="2018-09-10T23:28:40.943" Score="1" Body="&lt;p&gt;&lt;code&gt;internal_error.html&lt;/code&gt; isn't a file that is shipped with Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely what is happening is that you're running into some fatal PHP error (like bumping into your php.ini file's &lt;code&gt;memory_limit&lt;/code&gt; or &lt;code&gt;max_execution_time&lt;/code&gt; setting) and your host has configured &lt;em&gt;all&lt;/em&gt; fatal errors (or anything with a 500 Internal Server Error response code) to redirect to their &lt;code&gt;internal_error.html&lt;/code&gt; template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft doesn't know how to route to that template, so you get the error above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd check Craft's logs at &lt;code&gt;craft/storage/logs&lt;/code&gt; and/or your web server's error logs for the real underlying error.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-10T23:28:40.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27654" PostTypeId="1" CreationDate="2018-09-11T08:54:40.457" Score="1" ViewCount="78" Body="&lt;p&gt;I have a section called &lt;code&gt;stories&lt;/code&gt; and a section called &lt;code&gt;news&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stories&lt;/code&gt; needs to have Russian translations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i set up multisite and Russian language and fields as translation method - for each language&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great - I can view story entry in Russian with the URL prefixed as domain/ru/story&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I only want that content translated not the rest of the site URLs which by default seem to all inherit 'ru'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can for the purposes of this particular project just setup a Russian section for stories and do away with the whole Craft multi site language setup. But I like to keep things crafty if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution to using translations just for a section and leaving the rest of the site in English?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2018-09-11T23:01:15.610" LastActivityDate="2018-09-11T23:01:15.610" Title="Can I partially translate a section?" Tags="&lt;localization&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27655" PostTypeId="1" AcceptedAnswerId="27690" CreationDate="2018-09-11T10:46:42.237" Score="1" ViewCount="773" Body="&lt;p&gt;We want to add a little more structure to our templates directory by adding folders to group templates files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates&#xA;--_macros&#xA;--_views&#xA;--_layouts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In general this works fine but we encountered a problem with the index pages of sections.&#xA;All pages are grouped in the views directory, so in views we could have a folder &quot;articles&quot; and within that a file &quot;_entry.twig&quot; and &quot;index.twig&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the entry to work we change the template path of the section in the backend.&#xA;But there is no place to this for the index file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody an idea how best to handel this? &#xA;Is there a way to tell craft to also look in de _views folder?&lt;/p&gt;&#xA;" OwnerUserId="7577" LastActivityDate="2018-09-14T08:37:49.480" Title="Craft templates in sub directory" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;sections&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27656" PostTypeId="1" CreationDate="2018-09-11T13:25:19.120" Score="1" ViewCount="93" Body="&lt;p&gt;I'm building my first Payment Gateway (offsite gateway) for Commerce 2.  This one is for Moneris.  I'm hitting an error when the page returns the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Argument 1 passed to craft\commerce\services\Transactions::getTransactionByHash() must be of the type string, null given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure I need to do something in completePurchase with the response given, but I don't really understand where to start.  I've looked at Mollie and Paypal Express for exemples and I can't figure it out.  Can anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Post Moneris is sending me back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$_POST = [&#xA;    'response_order_id' =&amp;gt; '85a6df720018874fde293aa3418e7a97',&#xA;    'date_stamp' =&amp;gt; '2018-09-11',&#xA;    'time_stamp' =&amp;gt; '08:37:36',&#xA;    'bank_transaction_id' =&amp;gt; '660186290010010030',&#xA;    'charge_total' =&amp;gt; '88.10',&#xA;    'bank_approval_code' =&amp;gt; '945622',&#xA;    'response_code' =&amp;gt; '027',&#xA;    'iso_code' =&amp;gt; '01',&#xA;    'message' =&amp;gt; 'APPROVED           *                    =',&#xA;    'trans_name' =&amp;gt; 'purchase',&#xA;    'cardholder' =&amp;gt; 'Test Card',&#xA;    'f4l4' =&amp;gt; '4242***4242',&#xA;    'card' =&amp;gt; 'V',&#xA;    'expiry_date' =&amp;gt; '2108',&#xA;    'result' =&amp;gt; '1',&#xA;    'txn_num' =&amp;gt; '3-0_11',&#xA;    'cvd_response_code' =&amp;gt; 'M',&#xA;];&#xA;&lt;/code&gt;&#xA;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-09-14T03:48:03.130" Title="getTransactionByHash() must be of the type string, null given" Tags="&lt;plugin-craftcommerce2&gt;&lt;payment&gt;&lt;omnipay&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27657" PostTypeId="1" AcceptedAnswerId="27665" CreationDate="2018-09-11T13:25:28.233" Score="1" ViewCount="433" Body="&lt;p&gt;I have an asset field in my current project with the handle &lt;code&gt;postImage&lt;/code&gt;, containing multiple image files. In my element-api endpoint, I wish to access the url of the first file only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$imgs = $entry-&amp;gt;postImage;&#xA;$imgUrl = $imgs[0]-&amp;gt;getUrl();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting console error message says:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;500 (Call to a member function getUrl() on string)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looping through the array works fine, but I don't want all image urls, just the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably very easy, but that ties a knot my brain. I don't understand where the array is being converted to a string, can anyone hint me to the solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8146" LastActivityDate="2021-03-01T18:46:24.567" Title="Element-API: Access the first url of an asset array" Tags="&lt;url&gt;&lt;php&gt;&lt;plugin-elementapi&gt;&lt;array&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27658" PostTypeId="1" AcceptedAnswerId="27661" CreationDate="2018-09-11T13:27:25.190" Score="1" ViewCount="101" Body="&lt;p&gt;Looking at the documentation here: &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#users&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/config-settings.html#users&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set &lt;code&gt;loginPath&lt;/code&gt;, &lt;code&gt;invalidUserTokenPath&lt;/code&gt; and &lt;code&gt;setPasswordPath&lt;/code&gt;. However, it appears that there isn't a config option for the forgotten password template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also not mentioned as an option (unlike the other path options mentioned above) on this doc: &lt;a href=&quot;https://docs.craftcms.com/v2/templating/forgot-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/forgot-password-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Forgot to add that I have got it working in the meantime by setting &lt;code&gt;&#xA;{{ url('users/forgotten-password') }}&lt;/code&gt; in my login template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-11T15:07:54.913" Title="Possible to set Forgotten Password path in config?" Tags="&lt;users&gt;&lt;config&gt;&lt;login&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27659" PostTypeId="2" ParentId="27655" CreationDate="2018-09-11T13:52:59.567" Score="1" Body="&lt;p&gt;This is how my templates directory looks for almost every project:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Templates&#xA;--- _layout&#xA;--- includes&#xA;--- partials&#xA;--- site&#xA;--- users&#xA;--- shop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As long as your templates update their 'extend' tag to be &lt;code&gt;{% extends '_layout/base' %}&lt;/code&gt; then Craft understands where that is. Craft is aware of everything in the templates directory, you don't need to set up much config except for things like the users login/password templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main site pages structure is setup in the CMS to look at &lt;code&gt;/site/_index.twig&lt;/code&gt; then all the entry.types within this structure are based on this template and I include the entry type's appropriate template in my site base file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need more details.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-09-11T13:52:59.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27661" PostTypeId="2" ParentId="27658" CreationDate="2018-09-11T15:07:54.913" Score="1" Body="&lt;p&gt;I think that this is because Craft never needs to get there by itself.  It's a page you will always link to in one of your templates.  So in theory, you can simply link directly to your Forgotten password template, like you did already.&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-09-11T15:07:54.913" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27662" PostTypeId="2" ParentId="27655" CreationDate="2018-09-11T15:11:54.617" Score="1" Body="&lt;p&gt;You can't create a url path that goes to a _*** folder.  If you rename your folder without the underscore, it should work.  Folders that uses underscores are kind of protected and can only be used by other templates.&lt;/p&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-09-11T15:11:54.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27663" PostTypeId="1" AcceptedAnswerId="27681" CreationDate="2018-09-11T16:17:30.977" Score="1" ViewCount="312" Body="&lt;p&gt;I wrote a little commerce 2 price adjuster that works fine if i place it in &#xA;&lt;code&gt;/vendor/craftcms/commerce/src/adjusters/FriendsDiscountAdjuster.php&lt;/code&gt; and register it manually in &lt;code&gt;/vendor/craftcms/commerce/src/services/OrderAdjustments.php&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, i wanted to port it to a plugin, but i do fail registering the adjuster to commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I placed the adjuster in my &lt;code&gt;vendor/pluginName/src/adjusters/&lt;/code&gt; folder &#xA;and added it to my plugin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It fails with:&#xA;&lt;code&gt;Cannot declare class craft\commerce\adjusters\FriendsDiscountAdjuster, because the name is already in use&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is my main plugin file Friendsdiscount.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace hendrikeng\friendsdiscount;&#xA;&#xA;use Craft;&#xA;use craft\base\Plugin;&#xA;use craft\services\Plugins;&#xA;use craft\events\PluginEvent;&#xA;use craft\commerce\services\OrderAdjustments;&#xA;use craft\events\RegisterComponentTypesEvent;&#xA;use hendrikeng\friendsdiscount\adjusters\FriendsDiscountAdjuster;&#xA;&#xA;use yii\base\Event;&#xA;&#xA;class Friendsdiscount extends Plugin&#xA;{&#xA;    public static $plugin;&#xA;&#xA;    public $schemaVersion = '1.0.0';&#xA;&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;        Event::on(&#xA;            OrderAdjustments::class,&#xA;            OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS,&#xA;            function(RegisterComponentTypesEvent $event) {&#xA;                $event-&amp;gt;types[] = FriendsDiscountAdjuster::class;&#xA;            }&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the src/adjusters/FriendDiscountAdjuster.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace craft\commerce\adjusters;&#xA;&#xA;use Craft;&#xA;use craft\commerce\base\AdjusterInterface;&#xA;use craft\commerce\elements\Order;&#xA;use craft\commerce\models\OrderAdjustment;&#xA;use craft\commerce\Plugin;&#xA;&#xA;class FriendsDiscountAdjuster implements AdjusterInterface&#xA;{&#xA;  // ...Adjust something&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-09-11T16:54:14.023" LastActivityDate="2018-09-12T16:33:18.687" Title="Using a custom Commerce 2 Adjuster in a Craft Plugin" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27664" PostTypeId="2" ParentId="27353" CreationDate="2018-09-11T16:22:51.443" Score="1" Body="&lt;p&gt;I'm not sure if this is helpful to anyone reading this thread, but I hacked at this a bit and made the Charge_CompatibilityService class testTLS12minimum method echo the message from the exception. It indicated a failure resolving the API host. I commented out line 26 where it sets the $spiBase variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;//\Stripe\Stripe::$apiBase = &quot;&lt;a href=&quot;https://api-tls12.stripe.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://api-tls12.stripe.com&lt;/a&gt;&quot;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume it now falls back on the API host defined in the /vendor folder. This appears to have resolved the issue, though I haven't finished the rest of my Stripe account setup so I haven't confirmed it is working end to end.&lt;/p&gt;&#xA;" OwnerUserId="8792" LastActivityDate="2018-09-11T16:22:51.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27665" PostTypeId="2" ParentId="27657" CreationDate="2018-09-11T17:18:48.067" Score="2" Body="&lt;p&gt;you could use &lt;a href=&quot;http://php.net/manual/en/function.array-values.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;array_values()&lt;/code&gt;&lt;/a&gt; to fetch the first image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;      'transformer' =&amp;gt; function (Entry $entry) {&#xA;        foreach ($entry-&amp;gt;images as $image) {&#xA;          $images[] = $image-&amp;gt;url;&#xA;        }&#xA;        return [&#xA;          'images' =&amp;gt;  array_values($images)[0],&#xA;        ];&#xA;      },&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or use &lt;a href=&quot;http://php.net/manual/en/function.reset.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;reset()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;      'transformer' =&amp;gt; function (Entry $entry) {&#xA;        foreach ($entry-&amp;gt;images as $image) {&#xA;          $images[] = $image-&amp;gt;url;&#xA;        }&#xA;        return [&#xA;          'images' =&amp;gt;  reset($images),&#xA;        ];&#xA;      },&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-09-11T17:23:52.263" LastActivityDate="2018-09-11T17:23:52.263" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27666" PostTypeId="2" ParentId="22537" CreationDate="2018-09-11T20:08:39.500" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/putyourlightson/craft-plugin-uxd&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin UXD&lt;/a&gt; is intended to help you &quot;design&quot; one or more control panel pages in Craft. It is not a complete style guide but provides a set of typography, field and table elements that enables you to quickly design and develop your plugin control panel pages.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the developer, I'll gladly accept pull requests to make it more complete.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-09-11T20:08:39.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27667" PostTypeId="1" CreationDate="2018-09-11T23:11:43.463" Score="2" ViewCount="113" Body="&lt;p&gt;I have two forms on my site, one that you can use to sign up as a registered user that allows you to view content through out the site and participate in steps (tests) etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second form is a form that allows you to just download CERTAIN content on the site rather than view the whole site's content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to figure out how to separate users when signing up, the forms are pretty identical other than 2 options. However if the user wants to come back and register for the site after downloading the content, i need to figure out a way where they can use the same email they used in the past.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I have 2 forms one for registered users and one for kit users&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;registered users form gets FULL access to the site and kit users get access to one page with some downloads.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if user signs up for kit i need to separate the kit users from registered users.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if the user comes back, need to figure out how to let them use the same email they originally used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-09-26T07:36:50.647" Title="Separate User Groups / forms" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;&lt;user-groups&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27668" PostTypeId="1" CreationDate="2018-09-11T23:25:55.117" Score="1" ViewCount="146" Body="&lt;p&gt;I would like to eagerload inverse relation. Business case:&#xA;I have stories, stories are connected to books over relatedBooks field. Now I would like to query those books only which not have any story.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not see any easy way to do it, so I thought that to using eagerload the related stories somehow, and filtering out the nulls&#xA;What also could help is to just using having count somehow&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am not able to do it, because I am not able to lead the relatedBooks(inverse) from books perspective, only from stories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried to use the manyToMany plugin, but it is not helping either, just giving a nice interface&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I know I can query one-by-one but that is silly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(last workaround would be to use hardcoded sql, but I would like to avoid this one:) )&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2018-11-15T20:01:55.347" Title="Eagerload inverse relation" Tags="&lt;relations&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27669" PostTypeId="2" ParentId="27646" CreationDate="2018-09-11T23:37:53.353" Score="1" Body="&lt;p&gt;When you call &lt;code&gt;entry.newsArticleContent.one().type&lt;/code&gt;, what you're getting is an instance of &lt;code&gt;craft\models\MatrixBlockType&lt;/code&gt; (&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/models/MatrixBlockType.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/models/MatrixBlockType.php&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just happens to have a &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/models/MatrixBlockType.php#L93-L96&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;__toString()&lt;/code&gt;&lt;/a&gt; method that will print out the handle when it's requested, but the &lt;code&gt;if&lt;/code&gt; comparison you're doing is using the entire &lt;code&gt;MatrixBlockType&lt;/code&gt; instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.newsArticleContent.one().type.handle  in ['fullWidthImage', 'imageGroup'] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-11T23:37:53.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27670" PostTypeId="2" ParentId="27651" CreationDate="2018-09-11T23:44:46.837" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm not calling .all(), so this is still an object, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.  When you execute the for loop, it will explicitly run the database query and return the array of results.  You're probably getting a deprecation error logged using that syntax as well since Craft wants you to use &lt;code&gt;{% for album in albums.all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here in the docs:  &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#treating-queries-as-arrays&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#treating-queries-as-arrays&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the first results for the album cover, you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set albumCover = album.townPhotoAlbum[0] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-11T23:44:46.837" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27671" PostTypeId="1" CreationDate="2018-09-12T04:10:23.687" Score="1" ViewCount="87" Body="&lt;p&gt;I’m having trouble setting up an additional category listing page from the one I have set with the Category URI Format and Template settings in my Category Site Settings. Specifically, I’m having trouble getting it to work on my site which has two locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one category group called “practices” and one structure section-type called “people.”  I’m trying to create two different pages that each loops through all the entries for a particular category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, domain.com/people/practices/categoryA and domain.com/people/foo/practices/categoryA would both display all the “people” entries that belong to categoryA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my “practices” category group, I have the Category URIs to be people/practices/{slug} and the template to be people/_practices. Everything on this category listing page at domain.com/people/practices/categoryA works as intended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also get the category listing page at domain.com/people/foo/practices/categoryA to work by using the last segment (which would be the category slug) and setting the category object by passing in the category slug like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.app.request.segments|last %}&#xA;{% set category = craft.categories.slug(categorySlug).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this category listing page is throwing an error when I’m using it with my language switcher code, which uses:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;    {% set entry = category %}&#xA;{% endif %}&#xA;&#xA;{% set supportedSites = entry.getSupportedSites %}&#xA;&#xA;&amp;lt;ul&amp;gt;&#xA;{% for siteForEntry in supportedSites %}&#xA;  {% if siteForEntry | length == 1 %}&#xA;&#xA;    {# if category #}&#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry) %}&#xA;    {% set entryForOtherSite = craft.categories.id(entry.id).site(site).one() %}&#xA;&#xA;  {% elseif siteForEntry | length == 2 %}&#xA;    {# if standard entry #}&#xA;    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}&#xA;    {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}&#xA;  {% endif %}&#xA;&#xA;  {% if site.id == entry.siteId %}&#xA;      {# This is the current language, mark it as active and don't retrieve its url #}&#xA;      &amp;lt;li class=&quot;current {{ site.language }}&quot;&amp;gt;{{site.name}}&amp;lt;/li&amp;gt;&#xA;  {% else %}&#xA;      {# if it's not the current site, get the entry for this site #}&#xA;      &amp;lt;li class=&quot;{{ site.language }}&quot;&amp;gt;&amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{site.name}}&amp;lt;/a&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Specifically, I get the “Variable ‘entry’ does not exist” error. I’m not sure why I’m getting this error because I’m setting the “entry” variable with the “category” variable. This works with domain.com/people/practices/categoryA, but it’s not working for the other category listing page. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        {% if category is defined %}&#xA;            {% set entry = category %}&#xA;        {{ entry.id }}&#xA;        {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure what to do. I also set a route so that domain.com/people/foo/practices/{slug} loads the people/_practices template, but it still doesn’t work.&lt;/p&gt;&#xA;" OwnerUserId="5958" LastActivityDate="2018-09-22T04:36:23.083" Title="Setting up multiple category listing pages on site with multiple locales" Tags="&lt;categories&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27672" PostTypeId="2" ParentId="27640" CreationDate="2018-09-12T06:31:33.860" Score="1" Body="&lt;p&gt;As @mats-mikkel-rummelhoff suggested, that data type is an array. So I was able to get the desired value by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'img' : node['media:content'][1]['@url']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks, Mats.&lt;/p&gt;&#xA;" OwnerUserId="524" LastEditorUserId="524" LastEditDate="2018-09-12T07:43:50.327" LastActivityDate="2018-09-12T07:43:50.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27673" PostTypeId="1" CreationDate="2018-09-12T07:38:37.697" Score="1" ViewCount="27" Body="&lt;p&gt;Is it possible to do a reverse relation query in a custom entry source?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v2/plugins/hooks-reference.html#modifyentrysources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/hooks-reference.html#modifyentrysources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two entry sections, one called courses and one called course occurrences. Course occurrences are linked via an entries field called &lt;code&gt;parentCourse&lt;/code&gt;. It easy enough to query course occurrences that don't have a parent course (check if &lt;code&gt;parentCourse&lt;/code&gt; is empty/not empty, but the reverse seems to be a little more complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for the ability to have a custom entry source that lists all the parent course records that &lt;em&gt;don't&lt;/em&gt; have a child record basically, making it a reverse relation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested the &lt;a href=&quot;https://github.com/boboldehampsink/reverserelations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reverse Relations&lt;/a&gt; plugin and it does display the children entries related on the parent so the relation works, but I was wondering if it can be done directly through a criteria query in the &lt;code&gt;modifyEntrySource&lt;/code&gt; hook?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2018-09-12T07:43:51.877" LastActivityDate="2018-09-12T07:43:51.877" Title="modifyEntrySources hook with reverse relations" Tags="&lt;relations&gt;&lt;elementcriteriamodel&gt;&lt;entrymodel&gt;&lt;craft2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27674" PostTypeId="1" CreationDate="2018-09-12T10:04:50.553" Score="1" ViewCount="113" Body="&lt;p&gt;I have taken over a project and Im having a small problem with locales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is running Craft 2.6.3016&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A section has a locale “en” where the english URL format is “en/contact”, and the entry also have the slug “en/contact”…&#xA;So, I would expect this URL to be domain.com/en/contact/en/contact, no? But it is not!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oEC52.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oEC52.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qy8Nq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qy8Nq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When getting the URL with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.entries.section( 'contact' ).first().url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the url is “domain.com/en/en/contact”, this link does not work, but if I change it to “domain.com/en/contact” as I would expect it to be, it works!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what kind of dark magic that messes around with this, but maybe some of you got any ideas? Nothing seems to make any sense here.&#xA;Also note that the “en” folder in the public folder is called “en__” if I change this to “en” the locale stops working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6148" LastEditorUserId="6148" LastEditDate="2018-09-12T10:10:21.527" LastActivityDate="2018-09-14T08:57:39.240" Title="Locales and links not working as intended" Tags="&lt;localization&gt;&lt;url&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27676" PostTypeId="2" ParentId="27468" CreationDate="2018-09-12T13:15:35.740" Score="1" Body="&lt;p&gt;I found the solution in another question:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/23721/writing-a-plugin-that-triggers-on-a-control-panel-template-hook?rq=1&quot;&gt;Writing a plugin that triggers on a Control Panel Template Hook?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this answer we can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook('cp.commerce.order.edit.main-pane', function(array &amp;amp;$context) {&#xA;    return '&amp;lt;a href=&quot;#&quot; class=&quot;btn&quot;&amp;gt;My Button!&amp;lt;/a&amp;gt;';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8743" LastActivityDate="2018-09-12T13:15:35.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27677" PostTypeId="1" AcceptedAnswerId="27680" CreationDate="2018-09-12T13:54:12.920" Score="1" ViewCount="30" Body="&lt;p&gt;I have a Matrix field on Users. In that Matrix field is an Entries field. I need to pull all Entries from that field, regardless of the related Entries status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code returns Users but the Users' &lt;code&gt;anEntryField&lt;/code&gt; only shows the default 'live' entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users({&#xA;    with: [&#xA;        'myMatrixField:blockType.anEntryField'&#xA;    ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I pass status(null) to that field? Or, if it's actually getting all the Entries... how do I &lt;em&gt;show&lt;/em&gt; them all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if&#xA;    user.myMatrixField | length&#xA;    and&#xA;    user.myMatrixField.first().anEntryField.first() | length&#xA;%} ... {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But nothing in that block is executed for users who's anEntryField contains an entry that is disabled or expired.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-09-12T14:55:46.683" Title="How to filter relational field types on their related content's status?" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27678" PostTypeId="2" ParentId="27643" CreationDate="2018-09-12T14:06:52.700" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% for sale in variant.sales %}&#xA;  {{sale.name}}&amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-09-12T14:06:52.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27679" PostTypeId="1" CreationDate="2018-09-12T14:13:56.250" Score="1" ViewCount="112" Body="&lt;p&gt;I have a pretty critical issue with one of my clients websites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site, running Craft CMS 2.7.2 and craft commerce 1.2.1364, uses a event/tickets plugin and uses Mollie as the payment provider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem is the following:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A customer goes to the site, selects an event and adds 2 tickets to their cart. The customer goes through checkout, pays for 2 tickets successfully and returns back to the site, but receives 4 tickets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference between this bugged order and a normal order (that I can tell anyway) is the status updates. A normal order will have only one status update but bugged orders have three updates in the orderhistory (see screenshot)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6vqh1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6vqh1.jpg&quot; alt=&quot;screenshot of a bugged order&quot;&gt;&lt;/a&gt;&#xA;This order has purchased and paid for 7 tickets but has received 14 tickets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem seems to be happening randomly from what I can tell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or information about what the problem could be would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Note: we have contacted the plugin owner but have not yet received a response. We also contacted craft support but awaiting a response decided to ask here as well). If we receive any answer/solution we will post it below.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE: This is the response from Craft support:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi Yoshi,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something in your site setup, or a plugin, is setting the orderStatusId on the order to one that triggers an email. Somehow the status is being set twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is, without seeing the email setup or the plugin, that since the same status is set twice, the emails are sending twice. That makes sense, but my guess is that the emails themselves generate the ticket numbers on send, hence the additional tickets being issued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin developer should have saved the tickets numbers on order complete, and linked them to the order. Then the email could be sent out as many times as needed, without it regenerating multiple ticket numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Luke&lt;/p&gt;&#xA;" OwnerUserId="5363" LastEditorUserId="5363" LastEditDate="2018-09-21T17:34:02.300" LastActivityDate="2018-09-21T17:35:36.837" Title="Some orders recieve double amount of products" Tags="&lt;plugin-craftcommerce&gt;&lt;error&gt;&lt;payment-methods&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27680" PostTypeId="2" ParentId="27677" CreationDate="2018-09-12T14:55:46.683" Score="1" Body="&lt;p&gt;My assumption that the query was not getting all the related entries from withing the Matrix was wrong. The filtering that happens is applied at &lt;em&gt;output&lt;/em&gt; level, and not the query level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to tell craft that you don't care about the status of any linked anEntryField entry as part of the &lt;code&gt;if&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if&#xA;    user.myMatrixField | length&#xA;    and&#xA;    user.myMatrixField.first().anEntryField.status(null).first() | length&#xA;%}&#xA;...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this example the result will be the first myMatrixField block with a status of 'enabled' (that's the default filter), and fetching from that first Matrix result the first related Entry on the anEntryField regardless of the status of that related entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's what I was after.&lt;/p&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-09-12T14:55:46.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27681" PostTypeId="2" ParentId="27663" CreationDate="2018-09-12T16:33:18.687" Score="2" Body="&lt;p&gt;the adjuster had the wrong namespace, changing it to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;namespace hendrikeng\friendsdiscount\adjusters&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fixed the issue&lt;/p&gt;&#xA;" OwnerUserId="5012" LastActivityDate="2018-09-12T16:33:18.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27682" PostTypeId="1" AcceptedAnswerId="27685" CreationDate="2018-09-12T17:00:17.220" Score="1" ViewCount="437" Body="&lt;p&gt;I'm using a transformed image in a context where there's a maximum file size. Is there a way to determine the transformed image's file size in the templates? &lt;code&gt;.size&lt;/code&gt; can't run on the url string&lt;/p&gt;&#xA;" OwnerUserId="5072" LastActivityDate="2018-09-13T19:04:38.810" Title="Is it possible to get a transformed image's file size (bytes, not dimensions)?" Tags="&lt;image-transforms&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27684" PostTypeId="2" ParentId="27682" CreationDate="2018-09-12T17:16:23.337" Score="0" Body="&lt;p&gt;You can do this via:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Named transforms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% someAsset = entry.someAssetField.one() %}&#xA;{% if someAsset | length %}&#xA;    {{ someAsset.getHeight('transformName') }}&#xA;    {{ someAsset.getWidth('transformName') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template transforms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% someAsset = entry.someAssetField.one() %}&#xA;{% if someAsset | length %}&#xA;    {{ someAsset.getHeight(transformConfig) }}&#xA;    {{ someAsset.getWidth(transformConfig) }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-12T17:16:23.337" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27685" PostTypeId="2" ParentId="27682" CreationDate="2018-09-12T18:36:40.467" Score="5" Body="&lt;p&gt;I don't think it's possible to get the file size of an image after it's been transformed with Craft's out-of-the-box image transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the &lt;code&gt;.size&lt;/code&gt; property only works on the original asset file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you did something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = entry.myAssetField.one() %}&#xA;&#xA;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 100,&#xA;    height: 100,&#xA;    quality: 75,&#xA;    position: 'top-center'&#xA;} %}&#xA;&#xA;{% if image %}&#xA;&#xA;  {% do image.setTransform(thumb) %}&#xA;&#xA;  {{ image.width }} x {{ image.height }} = {{ image.size }} bytes&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.height&lt;/code&gt; and &lt;code&gt;.width&lt;/code&gt; properties will show the transformed dimensions (100 x 100), but &lt;code&gt;.size&lt;/code&gt; outputs the original file size, not the transformed size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing this might be a problem for Craft because the transformed image may not have been generated before the template is rendered.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/tree/master#imager_imagemodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager plugin&lt;/a&gt; has a &lt;code&gt;getSize&lt;/code&gt; method that should work. Imager transforms are created before the template is rendered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;getSize($unit='b', $precision='2') [float]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ image.getSize() }} B &#xA;{{ image.getSize('k') }} KB &#xA;{{ image.getSize('m', 10) }} MB &#xA;{{ image.getSize('g', 10) }} GB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="5072" LastEditDate="2018-09-13T19:04:38.810" LastActivityDate="2018-09-13T19:04:38.810" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27686" PostTypeId="1" CreationDate="2018-09-13T07:20:59.977" Score="2" ViewCount="31" Body="&lt;p&gt;I'm very new to Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The company I work for, has their website build with Craft. The website was build by a 3rd party company, Now they gave me the responsibility to give the site a facelift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm struggling to increase the limit of services displaying on the home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have 4 services, but only 3 display. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the back end of Craft Dashboard, I can only assign 3 services, can I increase this to 4?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I can, how can I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking forward to some feedback. &lt;/p&gt;&#xA;" OwnerUserId="8542" LastActivityDate="2018-09-13T07:45:50.607" Title="Craft 2 CMS - How to change Limits in Dashboard" Tags="&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27687" PostTypeId="2" ParentId="27686" CreationDate="2018-09-13T07:45:50.607" Score="1" Body="&lt;p&gt;If the account you're using has admin rights you could do so by going to:&#xA;Settings &gt; Fields &gt; [Field label of your service display] and edit it. On the bottom there should be a input which sets the limit of your displays to 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should only check with the person who build your website if they didnt set the limit in the code to 3. If so he has to change that.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2018-09-13T07:45:50.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27688" PostTypeId="2" ParentId="20365" CreationDate="2018-09-13T11:29:52.323" Score="1" Body="&lt;p&gt;Just tried setting &lt;code&gt;define('COMMERCE_PAYMENT_CURRENCY', 'EUR')&lt;/code&gt; in the index.php file and it works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You just need to use &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ cart.paymentCurrency }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ cart.currency }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2018-09-13T11:29:52.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27689" PostTypeId="2" ParentId="26603" CreationDate="2018-09-13T13:56:31.257" Score="2" Body="&lt;p&gt;I currently cannot see any way of achieving this as the only appropriate event that exists in the &lt;code&gt;yii\queue\Queue&lt;/code&gt; class, &lt;code&gt;afterError&lt;/code&gt;, is called before the job is failed in the &lt;code&gt;handleError&lt;/code&gt; method of &lt;code&gt;craft\queue\Queue&lt;/code&gt;. So your best bet would be to convince P&amp;amp;T that there is a valid use case for adding an extra event that will let you prevent the fail error from appearing.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-09-13T13:56:31.257" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27690" PostTypeId="2" ParentId="27655" CreationDate="2018-09-13T21:34:21.427" Score="3" Body="&lt;p&gt;It sounds like you're wanting to move templates around like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;articles/index.html&#xA;articles/_entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_layouts/articles/index.html&#xA;_layouts/articles/entry.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are three basic ways Craft figures out what template to use based on the URL:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Element routing like &lt;code&gt;articles/_entry.html&lt;/code&gt; (matches a URI in an element's settings, e.g. section or category)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic routes&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#dynamic-routes&quot; rel=&quot;nofollow noreferrer&quot;&gt;URL Rules&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/#template-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template path&lt;/a&gt; routing like &lt;code&gt;articles/index.html&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://docs.craftcms.com/v3/routing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 docs on routing&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a URL like &lt;code&gt;http//example.com/articles&lt;/code&gt; to use the template &lt;code&gt;_layouts/articles/index.html&lt;/code&gt;, you have two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set up a dynamic route or URL rule.&lt;/li&gt;&#xA;&lt;li&gt;Create a Single with the URI set to &lt;code&gt;articles&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Personally, I often create a Single for this like a Blog index page. Then it's easy to control parts of the index page like a header image or custom SEO tags. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;dynamic route&lt;/strong&gt; would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2ka4H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ka4H.png&quot; alt=&quot;dynamic route example screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;strong&gt;URL rules&lt;/strong&gt; would work something like this in &lt;code&gt;config/routes.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'articles' =&amp;gt; ['template' =&amp;gt; '_layouts/articles/index'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A third option that I don't recommend is if you have a structured section called something like &quot;Pages&quot; (or Static Pages or Landing Pages), you could create different Entry Types called &quot;Page&quot; and &quot;Articles Index&quot; just for this. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;├── About Us (Page)&#xA;│   └── Our Team (Page)&#xA;├── Articles (Articles Index)&#xA;├── Services (Page)&#xA;└── Contact (Page)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not a fan of this for a few reasons, but the main one is that you can't point entry types to different templates in Craft so you'll probably have to use Twig includes to create a &quot;routing template&quot; that points the Article Index entry type to a different template. Also,  chances are you will never need more than one Articles index page, and you won't want to drag and drop it's location around the structure because the URLs will become out of sync with the child Article entries.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-09-14T08:37:49.480" LastActivityDate="2018-09-14T08:37:49.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27691" PostTypeId="2" ParentId="27671" CreationDate="2018-09-13T23:41:28.573" Score="1" Body="&lt;p&gt;The reason it's not working is that &lt;code&gt;domain.com/people/foo/practices/categoryA&lt;/code&gt; is not a match for the Category group's URI settings. Only urls that match &lt;code&gt;people/practices/{slug}&lt;/code&gt; are going to have that category variable defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;    {% set entry = category %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... won't define an entry if there's no category defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your People structure is a flat list (no nested children), you could create a &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;URL rules&lt;/a&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'people/&amp;lt;person:{slug}&amp;gt;/practices/&amp;lt;category:{slug}&amp;gt;' =&amp;gt; [&#xA;    'template' =&amp;gt; 'test/4'&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would take a URI like &lt;code&gt;domain.com/people/foo/practices/categoryA&lt;/code&gt; and use the  &lt;code&gt;people/_practices&lt;/code&gt; template and populate variables for &lt;code&gt;person&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ person }}    {# foo #}&#xA;{{ category }}  {# categoryA #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you could make an category query like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.categories().group('practices').slug(category).one() %}&#xA;&#xA;{{ cat.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But personally, I've found it easier to use &lt;strong&gt;query strings&lt;/strong&gt; to filter a list instead of URL segments. You could possibly use a URL like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;domain.com/people/foo?practice=categroyA&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;domain.com/people/foo/practice?cat=categroyA&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or even...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;domain.com/people/practice?person=foo&amp;amp;cat=categroyA&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whichever works the most logically for your use case. Then use &lt;code&gt;craft.app.request&lt;/code&gt; to pull the &quot;categoryA&quot; string from the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categorySlug = craft.app.request.getQueryParam('cat') ?? null %}&#xA;&#xA;{% if categorySlug %}&#xA;  {{ categorySlug }}   {# &quot;categoryA&quot; #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use the &lt;code&gt;categorySlug&lt;/code&gt; string in an entry or category query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cat = craft.categories().group('practices').slug(category).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It's important to note, if you want a variable you set to be available in a layout template (&lt;code&gt;{% extend %}&lt;/code&gt; tag), you need to define it outside of a &lt;code&gt;{% block %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/index&quot; %}&#xA;&#xA;{% set categorySlug = craft.app.request.getQueryParam('cat') ?? null %}&#xA;&#xA;{% block content %}&#xA;  Content...&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;categorySlug&lt;/code&gt; variable should now be available in the &lt;code&gt;_layouts/index&lt;/code&gt; template context as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;  &amp;lt;div class=&quot;language-switcher&quot;&amp;gt;&#xA;    {% if categorySlug is defined %}&#xA;      Yes it is!&#xA;    {% endif %}        &#xA;  &amp;lt;/div&amp;gt;&#xA;&#xA;  {% block content %}&#xA;  {% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-09-22T04:36:23.083" LastActivityDate="2018-09-22T04:36:23.083" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27692" PostTypeId="2" ParentId="27656" CreationDate="2018-09-14T03:03:36.563" Score="1" Body="&lt;p&gt;When you redirect to the gateway's site to accept payment, within the data they receive, they usually ask for the URL to return to after payment is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This URL should point to the &lt;code&gt;PaymentsController::actionCompletePayment()&lt;/code&gt; controller action, but have the param &lt;code&gt;?commerceTransactionHash=YOUR_TRANSACTION_HASH&lt;/code&gt; appended to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the error you are getting is being triggered in &lt;code&gt;PaymentsController::actionCompletePayment()&lt;/code&gt; on line 346:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$hash = Craft::$app-&amp;gt;getRequest()-&amp;gt;getParam('commerceTransactionHash');&#xA;&#xA;$transaction = Plugin::getInstance()-&amp;gt;getTransactions()-&amp;gt;getTransactionByHash($hash);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where it is passing null to &lt;code&gt;getTransactionByHash&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once it is able to get the transaction, it will call your gateway's &lt;code&gt;completePayment&lt;/code&gt; method where you can inspect the request data from your gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-09-14T03:48:03.130" LastActivityDate="2018-09-14T03:48:03.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27693" PostTypeId="1" CreationDate="2018-09-14T08:55:13.607" Score="1" ViewCount="374" Body="&lt;p&gt;So we have built a rather large site for a client, which has multiple regions, locales, user privileges, etc.&#xA;Some time ago the default cache of Craft couldn't cope anymore with keeping track. The cache clearing tasks always stalled so cache wouldn't be deleted anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This triggered us to change the way we cache our pages. Unfortunately, the template cache table in the database is getting to its limits as we haven't found a good way to clear the old caches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We set &lt;code&gt;'cacheElementQueries' =&amp;gt; false,&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every page gets its own cache (unique cachekey) which consists of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is the user logged in yes or no?&lt;/li&gt;&#xA;&lt;li&gt;Which region is the user in? (one of 3 possibilities)&lt;/li&gt;&#xA;&lt;li&gt;Which user type does the user have? (any combination of 3 types possible)&lt;/li&gt;&#xA;&lt;li&gt;The page url&lt;/li&gt;&#xA;&lt;li&gt;The last updated date of the entry (not always used)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We cache everything globally and cache some parts of pages separately, for example: the sidebar of a product page remains the same but the content changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use a combination of &lt;em&gt;coldcache&lt;/em&gt; and &lt;em&gt;cacheflag&lt;/em&gt; plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we create a lot of caches and a lot of them with a certain date in the key, the database table gets cluttered and grows to big in size (max limit for our DB is 1GB and the cache table is reaching 500MB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How can we delete old caches from the DB table?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only two options I can think of now are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set cache duration to a certain time interval (but than all caches are deleted which will make the site slow every interval).&lt;/li&gt;&#xA;&lt;li&gt;Create a plugin that runs every month with a CRON job and checks all of the cache keys and deletes everyone but the latest.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any other ideas out there?&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-09-15T00:58:30.870" Title="Template cache table growing very big, best way to keep it in line?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27694" PostTypeId="2" ParentId="27674" CreationDate="2018-09-14T08:57:39.240" Score="1" Body="&lt;p&gt;If your entry's slug is &lt;code&gt;en/contact&lt;/code&gt; and you need it to show up when you go to the URL &lt;code&gt;domain.com/en/contact/en/contact&lt;/code&gt;, the Section settings for the &lt;strong&gt;Entry URL Format&lt;/strong&gt; should be &lt;code&gt;en/contact/{slug}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Us4vv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Us4vv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you shouldn't need to use the language code prefix (&lt;code&gt;en/&lt;/code&gt;) in Section settings. That should be defined in your &lt;code&gt;config/general.php&lt;/code&gt; file. See the &lt;a href=&quot;https://docs.craftcms.com/v2/localization-guide.html#step-4-define-your-site-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;Define your site URLs&lt;/a&gt; section of the Craft 2 docs on localization.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return array(&#xA;    // ...&#xA;    'siteUrl' =&amp;gt; array(&#xA;        'en' =&amp;gt; 'http://example.com/en/',&#xA;        'no' =&amp;gt; 'http://example.com/no/',&#xA;    ),&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, if you Section's URL settings are &lt;code&gt;contact/{slug}&lt;/code&gt;, these URLs will both work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://example.com/en/contact/en/contact&#xA;http://example.com/no/contact/en/contact&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-09-14T08:57:39.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27695" PostTypeId="2" ParentId="27668" CreationDate="2018-09-14T11:45:41.587" Score="1" Body="&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this case you should use &lt;code&gt;:empty:&lt;/code&gt;, like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set orphanBooks = craft.entries.section('books').relatedStories(':empty:') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL CONTENT&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the documentation, you can query the entries using your field handle: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;TIP&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Most custom fields support element query parameters as well, named&#xA;  after the field handles.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/#executing-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/element-queries/#executing-element-queries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might use &lt;code&gt;:notempty:&lt;/code&gt; as a negative selector, just like in this query: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set products = craft.entries.section('product').productSale(':notempty:') %}&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These SE question and answers might be helpful, too: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/10456/get-entries-not-related-to-categories&quot;&gt;Get entries NOT related to categories&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/452/return-entries-where-field-is-not-empty&quot;&gt;Return entries where field is &amp;quot;not empty&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5905" LastEditorUserId="5905" LastEditDate="2018-09-16T19:24:28.143" LastActivityDate="2018-09-16T19:24:28.143" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27696" PostTypeId="2" ParentId="11532" CreationDate="2018-09-14T12:04:05.260" Score="5" Body="&lt;p&gt;Just an updated version of Marion's answer for Craft CMS 3 since &lt;code&gt;order&lt;/code&gt; and &lt;code&gt;first&lt;/code&gt; are deprecated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = craft.entries.positionedBefore(entry).orderBy('lft desc').one() %}&#xA;&#xA;{% set next = craft.entries.positionedAfter(entry).orderBy('lft asc').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8349" LastActivityDate="2018-09-14T12:04:05.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27697" PostTypeId="1" AcceptedAnswerId="27698" CreationDate="2018-09-14T13:43:38.477" Score="1" ViewCount="33" Body="&lt;p&gt;Is there any way to allow () in asset file names (ex. file(1).txt)? Craft strips it out when it saves. The only way I've found is to change it via ftp and update asset indexes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set convertFilenamesToAscii =&gt; false but that didn't help. &lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-09-14T20:43:56.683" Title="Craft strips out parenthesis in file names." Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27698" PostTypeId="2" ParentId="27697" CreationDate="2018-09-14T20:43:56.683" Score="2" Body="&lt;p&gt;I can't see a way... uploads ultimately get run through &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/helpers/FileHelper.php#L124&quot; rel=&quot;nofollow noreferrer&quot;&gt;FileHelper::sanitizeFileName()&lt;/a&gt;, which has a hard-coded list of disallowed characters in a file name (including parenthesis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/helpers/FileHelper.php#L128-L166&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/helpers/FileHelper.php#L128-L166&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-14T20:43:56.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27700" PostTypeId="1" CreationDate="2018-09-14T23:23:07.053" Score="1" ViewCount="523" Body="&lt;p&gt;I created Search that uses entry slug, but it fails if the slug has more than one dash &quot;-&quot; in it. Has anyone come across this and/or have any ideas for getting around it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to use the slug because they are unique within a section. &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-09-16T20:33:38.027" Title="Search using Slug as query parameter" Tags="&lt;search&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27701" PostTypeId="2" ParentId="27693" CreationDate="2018-09-15T00:49:20.527" Score="1" Body="&lt;p&gt;In addition to what Brad suggested, I'd also do some auditing to see what kind of benefit you're getting out of your caches. You could, for instance, use the &lt;code&gt;for&lt;/code&gt; parameter to cache only for 24 hours or such. No reason to keep a stale cache around that isn't getting hit -&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/cache.html#for&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/tags/cache.html#for&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {% cache using key cacheKey for 1 day %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let unused caches naturally expire after a reasonable period of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do it this way, &lt;em&gt;all&lt;/em&gt; caches will not expire at the same time. In an ideal world, Craft's &lt;code&gt;{% cache %}&lt;/code&gt; tag would allow for incrementing the cache duration based on hits, so things that are getting lots of hits would say in the cache (until otherwise busted), and unused cache entries would expire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is any way to do that currently, tho. So at least using &lt;code&gt;for&lt;/code&gt;, it isn't an all or nothing proposition, and caches will expire individually, 24 hours after they are created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will also say that you may consider using another method of caching, such as &lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;FastCGI Cache&lt;/a&gt; or &lt;a href=&quot;https://supercool.github.io/2015/06/08/making-craft-sing-with-varnish-and-nginx.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Varnish&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-09-15T00:58:30.870" LastActivityDate="2018-09-15T00:58:30.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27703" PostTypeId="2" ParentId="27619" CreationDate="2018-09-16T01:05:39.680" Score="2" Body="&lt;p&gt;First I want to say thank you to the support staff at Sprout for helping me figure out my error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the default install settings/configuration for a Sprout form. Spam protection was enabled in my case and that's what was causing the 302.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to have spam protection enabled, I need to have this inside my &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% hook 'sproutForms.modifyForm' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my form looks like this now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form id=&quot;contact-form&quot; method=&quot;post&quot; class=&quot;main-form&quot; accept-charset=&quot;utf-8&quot;&amp;gt;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;        {% hook 'sproutForms.modifyForm' %}&#xA;        {{ csrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;sprout-forms/entries/save-entry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ form.redirectUri|hash }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;handle&quot; value=&quot;{{ form.handle }}&quot;&amp;gt;&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;&#xA;    &amp;lt;fieldset&amp;gt;&#xA;        {# Get the full name field. #}&#xA;        {% set fullName = form.getField('fullName') %}&#xA;&#xA;        ...&#xA;    &amp;lt;/fieldset&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting a 200 response back and the entry is getting created!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-09-16T01:05:39.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27704" PostTypeId="2" ParentId="27580" CreationDate="2018-09-16T10:14:07.567" Score="1" Body="&lt;p&gt;I just had the same issue and the following worked for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Phone: {{ submission.message['Phone'] }}&amp;lt;/p&amp;gt;&#xA;&amp;lt;p&amp;gt;Message: {{ submission.message['body'] }}&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8803" LastActivityDate="2018-09-16T10:14:07.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27705" PostTypeId="1" CreationDate="2018-09-16T11:04:00.053" Score="2" ViewCount="236" Body="&lt;p&gt;Is there a migration from the “Focal Point Field for Craft“ plugin to the Craft3 native focal point? Or has anyone tried this themselves?&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="57" LastEditDate="2019-04-04T21:03:37.940" LastActivityDate="2019-04-04T21:03:37.940" Title="Migration from “Focal Point Field&quot; for Craft to Native Craft 3 image focal point" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27706" PostTypeId="1" AcceptedAnswerId="27708" CreationDate="2018-09-16T17:36:20.000" Score="1" ViewCount="1804" Body="&lt;p&gt;I was tried to run Craft 3 on a Windows machine, it has shown the multiple errors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An Error occurred while handling another error:&#xA;yii\base\InvalidConfigException: craft\web\Request::cookieValidationKey must be configured with a secret key. in D:\xampp\htdocs\craft\vendor\yiisoft\yii2\web\Request.php:1554&#xA;Stack trace:&#xA;#0 D:\xampp\htdocs\craft\vendor\yiisoft\yii2\web\Request.php(1536): yii\web\Request-&amp;gt;loadCookies()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="57" LastEditDate="2018-09-16T21:17:00.383" LastActivityDate="2018-10-16T22:00:06.180" Title="Craft CMS 3 error in Windows installation process" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27707" PostTypeId="2" ParentId="27700" CreationDate="2018-09-16T20:33:38.027" Score="1" Body="&lt;p&gt;If you know your &lt;strong&gt;q&lt;/strong&gt; variable should be a slug, you can use the &lt;code&gt;.slug&lt;/code&gt; query parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get the requested entry slug from the URL #}&#xA;{% set requestedSlug = craft.app.request.getSegment(3) %}&#xA;&#xA;{# Fetch the entry with that slug #}&#xA;{% set entry = craft.entries()&#xA;    .slug(requestedSlug|literal)&#xA;    .one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#slug&quot; rel=&quot;nofollow noreferrer&quot;&gt;More on how to use this in the Craft 3 docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have personally had some unexpected results using Craft's built-in search. &lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-09-16T20:33:38.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27708" PostTypeId="2" ParentId="27706" CreationDate="2018-09-16T21:19:45.753" Score="1" Body="&lt;p&gt;You'll get that error (regardless of OS) if the &lt;code&gt;SECURITY_KEY&lt;/code&gt; variable isn't set in your &lt;code&gt;.env&lt;/code&gt; file: &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/.env.example#L5&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/craft/blob/master/.env.example#L5&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this step in the install docs: &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html#step-3-set-a-security-key&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/installation.html#step-3-set-a-security-key&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you run the &lt;code&gt;craft setup&lt;/code&gt; terminal command, it will generate that key for you, but depending on how you install Craft, you can also manually set it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-16T21:19:45.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27710" PostTypeId="2" ParentId="27705" CreationDate="2018-09-17T02:14:55.157" Score="2" Body="&lt;p&gt;The inherent problem that you're going to have is that Craft CMS 3 focal points are &lt;em&gt;per asset&lt;/em&gt;, and Focal Point Field is &lt;em&gt;per field&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could have multiple Focal Point Fields that have different Focal Points for the same Asset... and then how would you map them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A migration could be done, but there would have to be some compromise to take the above into account.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-17T02:14:55.157" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27711" PostTypeId="1" CreationDate="2018-09-17T02:34:35.353" Score="1" ViewCount="76" Body="&lt;p&gt;In the CP, when we upload an image with a same name, craft will ask if we wanna keep both or replace.&#xA;So in plugin, is there any way to do the replace? &lt;/p&gt;&#xA;" OwnerUserId="8123" LastActivityDate="2018-09-17T06:21:19.890" Title="Is there any way to replace the asset programatically?" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;image&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27712" PostTypeId="1" AcceptedAnswerId="27721" CreationDate="2018-09-17T05:24:21.470" Score="4" ViewCount="1693" Body="&lt;p&gt;I have following custom fields for users.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;favouriteEntries - 'entry' type field with multiple entries per user&#xA;notificationPreference - Lightswitch field&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My plugin should email notifications to users who follow that entry when there is an update to a particular entry (&lt;code&gt;Entry::EVENT_AFTER_SAVE&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\User;&#xA;&#xA;$users = User::find()-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above code, I can get all user data including &lt;code&gt;notificationPreference&lt;/code&gt; but &lt;code&gt;favouriteEntries&lt;/code&gt;. &lt;code&gt;favouriteEntries&lt;/code&gt; field returns &lt;code&gt;null&lt;/code&gt; even if it has entries for all users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the correct way to get all user data including &lt;code&gt;favouriteEntries&lt;/code&gt; field?&lt;/p&gt;&#xA;" OwnerUserId="7215" LastEditorUserId="57" LastEditDate="2018-09-18T22:42:11.827" LastActivityDate="2020-01-20T22:09:12.780" Title="Craft 3 How to get custom user field values" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27713" PostTypeId="2" ParentId="27711" CreationDate="2018-09-17T06:21:19.890" Score="1" Body="&lt;p&gt;You need to set the scenario &lt;code&gt;SCENARIO_REPLACE&lt;/code&gt; or &lt;code&gt;SCENARIO_CREATE&lt;/code&gt; depending what you like to do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$asset = new \craft\elements\Asset();&#xA;$asset-&amp;gt;tempFilePath = $tmpFilePath;&#xA;&#xA;$asset-&amp;gt;setScenario(\craft\elements\Asset::SCENARIO_REPLACE);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-17T06:21:19.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27715" PostTypeId="1" AcceptedAnswerId="27716" CreationDate="2018-09-17T08:01:37.473" Score="1" ViewCount="127" Body="&lt;p&gt;In Craft CMS, I am using the imageoptimize plugin to optimize images. I have added field imageoptimize &amp;amp; in assets created volume added field in field layout but when I am adding entry it showing me the message 'OptimizedImages fields only work when added to an Asset Volume's layout.'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Craft CMS version 3.024 and ImageOptimize plugin version 1.4.38.&#xA;Why is the field not showing up?&lt;/p&gt;&#xA;" OwnerUserId="8807" LastEditorUserId="57" LastEditDate="2018-09-18T22:41:30.863" LastActivityDate="2018-09-18T22:41:30.863" Title="Using imageoptimize plugin not showing field on entries" Tags="&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27716" PostTypeId="2" ParentId="27715" CreationDate="2018-09-17T13:29:20.703" Score="2" Body="&lt;p&gt;So a &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize#using-the-optimized-images-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;per the documentation&lt;/a&gt;, the &lt;strong&gt;Optimized Images&lt;/strong&gt; field should &lt;em&gt;only&lt;/em&gt; be added to an Asset Volume's layout. You do not need to, and should not add that field to your Section field layouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please verify for me that after doing so, when you double-click on an Asset, you see a display similar to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/nystudio107/craft-imageoptimize/v1/resources/screenshots/image-variant-field.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize/issues/106&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-imageoptimize/issues/106&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Resolution:&lt;/strong&gt; This ended up just being some local config issues with Asset Volumes, and then getting rid of pending stuck Queue jobs. After that, away we go!&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-09-17T15:42:32.490" LastActivityDate="2018-09-17T15:42:32.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27717" PostTypeId="2" ParentId="27634" CreationDate="2018-09-17T14:08:15.853" Score="2" Body="&lt;p&gt;You could use &lt;a href=&quot;https://docs.craftcms.com/v2/templating/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; to speed up things as it is now in your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({&#xA;  section: 'brands',&#xA;  with:    ['brandLogo']&#xA;}.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another alternative I can think of is using a structure instead of a channel, with 0-9 and A-Z as top level entries and your brands already sorted per character underneath. Than you can just call up the correct letter/branch in your template. Switching from channel to structure won't erase your data either if I'm correct. And the eager loading trick will speed up things too here.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2018-09-17T14:15:50.110" LastActivityDate="2018-09-17T14:15:50.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27718" PostTypeId="2" ParentId="23289" CreationDate="2018-09-17T15:27:35.683" Score="2" Body="&lt;p&gt;I know this is a while ago but I ran in to the same issue and thought I'd share the culprit in my particular case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I adjusted the &lt;code&gt;upload_max_filesize&lt;/code&gt; value via a php.ini file from the default 2MB to 10MB, but I misspelled the configuration as &lt;code&gt;upload_max_filesize = 10MB&lt;/code&gt; instead of &lt;code&gt;upload_max_filesize = 10M&lt;/code&gt;. I was seeing the exact same error as the original poster. Once I fixed the setting, changing &lt;code&gt;10MB&lt;/code&gt; to &lt;code&gt;10M&lt;/code&gt;, the error went away.&lt;/p&gt;&#xA;" OwnerUserId="8495" LastActivityDate="2018-09-17T15:27:35.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27719" PostTypeId="1" AcceptedAnswerId="27722" CreationDate="2018-09-17T18:14:23.063" Score="1" ViewCount="131" Body="&lt;p&gt;Folks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to render a state abbreviation in a front end template on Craft CMS? Currently, I have a plain text field that has the full text of a state and I would like to render the standard two letter abbreviation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if eventType.eventState | length %}{{ eventType.eventState }}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would be open to changing the field type (or downloading a plugin) if that makes things easier but don't see an address field or something that on the surface would be conducive to easily filtering down to an abbreviation. &lt;/p&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2018-09-18T06:47:30.163" Title="How to Render a State Abbreviation in Craft CMS?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27720" PostTypeId="1" CreationDate="2018-09-17T20:17:37.970" Score="2" ViewCount="72" Body="&lt;p&gt;My client is looking to, on occasion, assign a recurring Stripe plan to a one-time donor (most donations on this site are one-time). The best way to do this would be to create a customer in Stripe (and save the card token for that customer) on every transaction, so that it would  be a quick and easy process for them to find the customer and assign them a plan without needing to collect any further information from them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the Stripe plugin doesn't save anything, it simply creates a simple one-time charge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use existing actions in the Stripe gateway for Commerce 2 to create customers w/ saved sources during checkout?&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-09-17T20:17:37.970" Title="Creating customer records and saving cards during Stripe checkout?" Tags="&lt;plugin-craftcommerce&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27721" PostTypeId="2" ParentId="27712" CreationDate="2018-09-17T23:53:23.803" Score="4" Body="&lt;p&gt;You should be able to access the custom fields on element\user object. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;getFieldValue('customfieldname');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6694" LastEditorUserId="5557" LastEditDate="2018-09-18T06:12:58.837" LastActivityDate="2018-09-18T06:12:58.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27722" PostTypeId="2" ParentId="27719" CreationDate="2018-09-18T06:47:30.163" Score="3" Body="&lt;p&gt;I don't think there's anything native (and haven't seen a plugin) that does this, but one way to do it is to create a &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/macro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;macro&lt;/a&gt; where you add all the states and their abbreviations to a map. Something like this should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a file called &lt;code&gt;templates/_macros/helpers.html&lt;/code&gt; or the like (abbreviations map shortened in example; you can find a full list &lt;a href=&quot;https://gist.github.com/jimkutter/1370525&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, just need to convert it to Twig object syntax):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro abbreviateState(stateName) %}{% spaceless %}&#xA;&#xA;    {% set abbreviations = {&#xA;        'Alabama': 'AL',&#xA;        'Alaska': 'AK',&#xA;        'Arizona': 'AZ',&#xA;        'Arkansas': 'AR',&#xA;        'California': 'CA',&#xA;        'Colorado': 'CO',&#xA;        'Connecticut': 'CT',&#xA;        ...&#xA;    } %}&#xA;&#xA;    {{ abbreviations[stateName|trim] ?? stateName }}&#xA;&#xA;{% endspaceless %}{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your template (i.e. /templates/entry.html):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Import macro at the top of the template #}&#xA;{% import '_macros/helpers' as helpers %}&#xA;&#xA;{% if eventType.eventState | length %}&#xA;&#xA;    {{ helpers.abbreviateState(eventType.eventState) }}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this solution hinges on the state names being typed properly (exactly the same way as they appear in the macro); if somebody were to write &quot;New york&quot; and you've got &quot;New York&quot; in the macro, a proper abbreviation would not be found and the state name &quot;New york&quot; would simply render as-is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To mitigate this, you might consider opting for a different input field type other than Plain Text, e.g. a Dropdown where you set up all the states as options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're sticking with a Plain Text field, you could also circumvent the specific issue of capitalisation being off by making the state names in the macro map all lowercase, and applying the &lt;code&gt;|lower&lt;/code&gt; filter to the state name when you try to pull the abbreviation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set abbreviations = {&#xA;    'alabama': 'AL',&#xA;    'alaska': 'AK',&#xA;    'arizona': 'AZ',&#xA;    'arkansas': 'AR',&#xA;    'california': 'CA',&#xA;    'colorado': 'CO',&#xA;    'connecticut': 'CT',&#xA;    ...&#xA;} %}&#xA;&#xA;{{ abbreviations[stateName|trim|lower] ?? stateName }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-09-18T06:47:30.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27723" PostTypeId="1" AcceptedAnswerId="27748" CreationDate="2018-09-18T13:20:20.300" Score="1" ViewCount="5602" Body="&lt;p&gt;Having a strange issue - &lt;code&gt;devMode&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt;, if I go to &lt;code&gt;/404&lt;/code&gt;, I get the custom 404 page, which is great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to &lt;code&gt;/something1234567890&lt;/code&gt; (which is definitely not an entry's URL) I get the following exception:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\web\NotFoundHttpException: Template not found: something1234567890&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried adding debugging to my base templates but it looks like it is not getting as far as them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea where I can start trying to debug this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stack trace:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][trace][yii\web\Application::handleRequest] Route requested: 'templates/render'&#xA;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][trace][yii\base\Controller::runAction] Route to run: templates/render&#xA;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][trace][yii\base\InlineAction::runWithParams] Running action: craft\controllers\TemplatesController::actionRender()&#xA;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][trace][nystudio107\seomatic\{closure}] ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION&#xA;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: something1234567890 in /home/vagrant/code/craft-site/vendor/craftcms/cms/src/controllers/TemplatesController.php:70&#xA;2018-09-17 00:36:15 [xxx.xxx.xx.x][-][xxxxxxxxxxxxxxxxx][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: something1234567890 in /home/vagrant/code/craft-site/vendor/craftcms/cms/src/controllers/TemplatesController.php:70&#xA;Stack trace:&#xA;#0 [internal function]: craft\controllers\TemplatesController-&amp;gt;actionRender('something123456...', Array)&#xA;#1 /home/vagrant/code/craft-site/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#2 /home/vagrant/code/craft-site/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#3 /home/vagrant/code/craft-site/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller-&amp;gt;runAction('render', Array)&#xA;#4 /home/vagrant/code/craft-site/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('render', Array)&#xA;#5 /home/vagrant/code/craft-site/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('templates/rende...', Array)&#xA;#6 /home/vagrant/code/craft-site/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&amp;gt;runAction('templates/rende...', Array)&#xA;#7 /home/vagrant/code/craft-site/vendor/craftcms/cms/src/web/Application.php(271): yii\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#8 /home/vagrant/code/craft-site/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#9 /home/vagrant/code/craft-site/public/index.php(22): yii\base\Application-&amp;gt;run()&#xA;#10 {ma    in}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;devMode&lt;/code&gt; toggling works on another Craft 3 site I have, just not this particular one. Maybe it is a database issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried this codebase with a fresh database and still getting the same error, so it must be something to do with my codebase?&lt;/p&gt;&#xA;" OwnerUserId="5470" LastEditorUserId="5470" LastEditDate="2018-09-19T11:10:10.417" LastActivityDate="2020-01-31T23:41:00.420" Title="Template not found 404" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;404&gt;&lt;error-templates&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27724" PostTypeId="2" ParentId="27723" CreationDate="2018-09-18T13:57:07.267" Score="2" Body="&lt;p&gt;Take a look in your general.php config file and see if you're overwriting the &lt;code&gt;errorTemplatePrefix&lt;/code&gt; setting. It might look something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'errorTemplatePrefix' =&amp;gt; &quot;_errors/&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you might need to move the 404.html file into &quot;/templates/_errors/&quot; directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#errortemplateprefix&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs v3&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4119" LastEditorUserId="4119" LastEditDate="2018-09-19T09:06:21.183" LastActivityDate="2018-09-19T09:06:21.183" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27725" PostTypeId="1" AcceptedAnswerId="27738" CreationDate="2018-09-18T14:11:35.280" Score="1" ViewCount="80" Body="&lt;p&gt;In the Craft 3 Class Reference (&lt;a href=&quot;https://docs.craftcms.com/api/v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3&lt;/a&gt;), there are two classes under &lt;code&gt;craft\mail&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mailer&lt;/li&gt;&#xA;&lt;li&gt;Message&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I found that I was able to send an email using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php &#xA;&#xA;use craft\mail\Message;&#xA;&#xA;$message = new Message();&#xA;$message-&amp;gt;setTo('john@doe.com');&#xA;$message-&amp;gt;setSubject(&quot;Hello world.&quot;);&#xA;$message-&amp;gt;setHtmlBody(&quot;Hello world.&quot;);&#xA;$message-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I found in some examples, like &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23804/how-to-send-email-from-craft-3-custom-plugin&quot;&gt;this one&lt;/a&gt;, that the email could be send using &lt;code&gt;Craft::$app-&amp;gt;mailer-&amp;gt;send($message)&lt;/code&gt; instead of &lt;code&gt;$message-&amp;gt;send()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the difference between the &lt;strong&gt;Mailer&lt;/strong&gt; and the &lt;strong&gt;Message&lt;/strong&gt; classes? When should I use one instead of the other?&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-09-18T22:46:58.470" Title="What's the differences between the Mailer and the Message classes?" Tags="&lt;plugin-development&gt;&lt;documentation&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27726" PostTypeId="1" CreationDate="2018-09-18T14:58:04.357" Score="2" ViewCount="75" Body="&lt;p&gt;I was wondering if anyone could give me some advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a client that we are in the process of moving away from a Drupal build to a new Craft build, however, they have a large number of forms created in FormAssembly that sync nicely with Salesforce. Does anyone have experience with Craft/FormAssembly integration specifically rolling their own plugin or using the HTTPS Connector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client doesn't want to have to recreate all the forms, so using a plugin like Freeform isn't really an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other insights greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8811" LastActivityDate="2018-09-18T14:58:04.357" Title="Recommendations on integrating Craft 3 and FormAssembly" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27727" PostTypeId="1" AcceptedAnswerId="27728" CreationDate="2018-09-18T15:24:42.217" Score="1" ViewCount="1755" Body="&lt;p&gt;On &lt;code&gt;/admin/settings/email&lt;/code&gt;, when the &lt;strong&gt;HTML Email Template field&lt;/strong&gt; is set to a valid template, all system messages are sent using it. They inject the content of the messages inside the &lt;code&gt;{% block main %}{{body}}{% endblock %}&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a custom plugin, &lt;code&gt;setHtmlBody&lt;/code&gt; doesn't inject the content inside it. It takes its value as the whole template value instead of only replacing the &lt;code&gt;{{body}}&lt;/code&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php &#xA;&#xA;use craft\mail\Message;&#xA;&#xA;$message = new Message();&#xA;$message-&amp;gt;setTo('john@doe.com');&#xA;$message-&amp;gt;setSubject(&quot;Hello world.&quot;);&#xA;$message-&amp;gt;setHtmlBody(&quot;Hello world.&quot;);&#xA;$message-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I send this email using the custom HTML email template specified in my CP &lt;strong&gt;Email Settings&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could copy-paste the whole file content of my custom template inside the setHtmlBody, but it doesn't seems to be a clean way...&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-09-18T15:54:07.707" Title="How to use the default HTML email template when sending an email from a plugin?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;emails&gt;&lt;classes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27728" PostTypeId="2" ParentId="27727" CreationDate="2018-09-18T15:44:15.060" Score="5" Body="&lt;p&gt;There are different ways&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Extending the E-mail template in your template&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This could be your email template &lt;code&gt;emails/_someMail&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% extends 'path/of/your/layout-same-as-you-inserted-in-your-cp' %}&#xA;&#xA;{% block main %}Hello World{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in your PHP file&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;use craft\mail\Message;&#xA;&#xA;$message = new Message();&#xA;$message-&amp;gt;setTo('john@doe.com');&#xA;$message-&amp;gt;setSubject(&quot;Hello world.&quot;);&#xA;$message-&amp;gt;setHtmlBody(Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('emails/_someMail'));&#xA;$message-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Render the correct template from the beginning&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You can do exactly the same as Craft does in it's function - but I would suggest the first way&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$systemMessage = Craft::$app-&amp;gt;getSystemMessages()-&amp;gt;getMessage('test_email', $message-&amp;gt;language);&#xA;$subjectTemplate = $systemMessage-&amp;gt;subject;&#xA;$textBodyTemplate = $systemMessage-&amp;gt;body;&#xA;&#xA;// Use the site template mode&#xA;$view = Craft::$app-&amp;gt;getView();&#xA;$templateMode = $view-&amp;gt;getTemplateMode();&#xA;$view-&amp;gt;setTemplateMode($view::TEMPLATE_MODE_SITE);&#xA;&#xA;// Use the message language&#xA;$language = Craft::$app-&amp;gt;language;&#xA;if ($message-&amp;gt;language !== null) {&#xA;    Craft::$app-&amp;gt;language = $message-&amp;gt;language;&#xA;}&#xA;&#xA;$settings = Craft::$app-&amp;gt;getSystemSettings()-&amp;gt;getEmailSettings();&#xA;$variables = ($message-&amp;gt;variables ?: []) + [&#xA;        'emailKey' =&amp;gt; $message-&amp;gt;key,&#xA;        'fromEmail' =&amp;gt; $settings-&amp;gt;fromEmail,&#xA;        'fromName' =&amp;gt; $settings-&amp;gt;fromName,&#xA;    ];&#xA;&#xA;// Render the subject and textBody&#xA;$subject = $view-&amp;gt;renderString($subjectTemplate, $variables);&#xA;$textBody = $view-&amp;gt;renderString($textBodyTemplate, $variables);&#xA;&#xA;// Is there a custom HTML template set?&#xA;if (Craft::$app-&amp;gt;getEdition() === Craft::Pro &amp;amp;&amp;amp; Craft::$app-&amp;gt;getMailer()-&amp;gt;template) {&#xA;    $template = Craft::$app-&amp;gt;getMailer()-&amp;gt;template;&#xA;} else {&#xA;    // Default to the _special/email.html template&#xA;    $view-&amp;gt;setTemplateMode($view::TEMPLATE_MODE_CP);&#xA;    $template = '_special/email';&#xA;}&#xA;&#xA;$e = null;&#xA;try {&#xA;    $htmlBody = $view-&amp;gt;renderTemplate($template, array_merge($variables, [&#xA;        'body' =&amp;gt; Template::raw(Markdown::process($textBody)),&#xA;    ]));&#xA;} catch (TemplateLoaderException $e) {&#xA;    // Clean up before throwing&#xA;}&#xA;&#xA;// Set things back to normal&#xA;Craft::$app-&amp;gt;language = $language;&#xA;$view-&amp;gt;setTemplateMode($templateMode);&#xA;&#xA;if ($e !== null) {&#xA;    throw $e;&#xA;}&#xA;&#xA;$message&#xA;    -&amp;gt;setSubject($subject)&#xA;    -&amp;gt;setHtmlBody($htmlBody)&#xA;    -&amp;gt;setTextBody($textBody);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-09-18T15:54:07.707" LastActivityDate="2018-09-18T15:54:07.707" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27729" PostTypeId="2" ParentId="11926" CreationDate="2018-09-18T17:36:40.403" Score="1" Body="&lt;p&gt;If it's any help I made a quick plugin to handle this by way of a Twig extension. &lt;a href=&quot;https://github.com/moresoda/existential&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/moresoda/existential&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use it to test for the existence of a file with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if asset.getUrl() | fileExists %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-18T17:36:40.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27730" PostTypeId="1" AcceptedAnswerId="27731" CreationDate="2018-09-18T18:39:51.930" Score="1" ViewCount="154" Body="&lt;p&gt;I was running a page speed test and it came up that I'm not leveraging browser caching for images and such. I was hoping to use the header tag to solve this. &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/header.html#app&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/tags/header.html#app&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does this go exactly? In the _layout?&lt;/p&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-09-18T19:18:57.360" Title="Where to use {% header %}" Tags="&lt;headers&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27731" PostTypeId="2" ParentId="27730" CreationDate="2018-09-18T19:18:57.360" Score="2" Body="&lt;p&gt;This is something that is best done via server-side config. The reason is that when an image is requested, for instance, your Twig code that sets the header never gets run for that request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how it is done via Nginx here: &lt;a href=&quot;https://github.com/nystudio107/nginx-craft/blob/master/nginx-partials/expires.conf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nginx-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Apache (don't use &lt;code&gt;.htaccess&lt;/code&gt; pls) go here: &lt;a href=&quot;https://github.com/h5bp/server-configs-apache&quot; rel=&quot;nofollow noreferrer&quot;&gt;html5 boilerplate apache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-18T19:18:57.360" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27732" PostTypeId="2" ParentId="27723" CreationDate="2018-09-18T19:21:04.340" Score="3" Body="&lt;p&gt;There's a long discussion of all of this in the &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#handling-exceptions-on-the-frontend&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt; article, if it helps.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-18T19:21:04.340" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27733" PostTypeId="1" AcceptedAnswerId="27739" CreationDate="2018-09-18T21:26:38.577" Score="1" ViewCount="504" Body="&lt;p&gt;So I am coming from WordPress and typically I would typically handle a post by either hooking into the wp_post action and access the $_POST request that way. Now I believe Craft is built on Yii which is an MVC framework but I cannot find any documentation showing how to handle post requests?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or can you point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="8434" LastEditorUserId="57" LastEditDate="2018-09-18T22:49:25.440" LastActivityDate="2018-09-18T22:51:18.977" Title="How to handle form submissions?" Tags="&lt;form&gt;&lt;post&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27734" PostTypeId="1" CreationDate="2018-09-18T21:32:42.323" Score="1" ViewCount="116" Body="&lt;p&gt;I migrated from EE &gt; CraftCMS. The email links in my EE WYGWAM fields were encoded as JS. When we imported to CraftCMS we lost all of those links. They now look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a&amp;gt;joe@schmoe.com&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how I could fix this? Perhaps I can pass my Redactor field through a filter that looks for an email pattern, and use Retcon to rewrap the link?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a solution that does not involve reimporting my data, as it's not an option at this point.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-09-18T21:32:42.323" Title="Redactor has destroyed my mailto links, now what?" Tags="&lt;redactor&gt;&lt;emails&gt;&lt;filtering&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27735" PostTypeId="2" ParentId="27634" CreationDate="2018-09-18T21:44:57.273" Score="2" Body="&lt;p&gt;You can create a &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;route with a URL rule&lt;/a&gt; for these individual pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'brands/&amp;lt;firstLetter:\w{1}&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'brands/index'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming you URL is something like &lt;code&gt;example.com/brands/a&lt;/code&gt; and your template is located at &lt;code&gt;brands/index.twig&lt;/code&gt;. This will also pass a &lt;code&gt;firstLetter&lt;/code&gt; variable from the URL to the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's search parameter&lt;/a&gt; to only search the title field starting with a letter like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.search('title::a*')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about &lt;a href=&quot;https://docs.craftcms.com/v3/searching.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's search syntax&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the number 0-9, combine search queries with an &lt;code&gt;OR&lt;/code&gt; string like &lt;code&gt;title::0* OR title::1* OR title::2* OR&lt;/code&gt;... etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't use a URL like &lt;code&gt;example.com/brands/#&lt;/code&gt; to show numbers, so I'm just going to use the default &lt;code&gt;example.com/brands&lt;/code&gt; to show numbered entries (no &lt;code&gt;firstLetter&lt;/code&gt; in the URL).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting it all together, we get something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if firstLetter is defined %}&#xA;  {% set searchQuery = 'title::' ~ firstLetter ~ '*' %}&#xA;{% else %}&#xA;  {% set searchQuery = '' %}&#xA;  {% for num in 0..9 %}&#xA;    {% set searchQuery = searchQuery ~ 'title::' ~ num ~ '*' ~ (not loop.last ? ' OR ') %}&#xA;  {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% for entry in craft.entries.section('brands')&#xA;    .search(searchQuery)&#xA;    .orderBy('title')&#xA;    .all() %}&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's a simple navigation for these pages.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&#xA;  &amp;lt;a href=&quot;{{ url('brands') }}&quot;&amp;gt;#&amp;lt;/a&amp;gt;&#xA;  {% for letter in 'a'..'z' %}&#xA;    &amp;lt;a href=&quot;{{ url('brands/' ~ letter) }}&quot;&amp;gt;{{ letter|upper }}&amp;lt;/a&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To filter out letters from that list that don't have any entries would be trickier to pull off tho. You could try something like this, but it might not be the most performant.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for letter in 'a'..'z' &#xA;    if craft.entries.section('brands')&#xA;    .search('title::' ~ letter ~ '*')&#xA;    .exists() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another possible option would be to create a plugin for finding distinct first letter entries like this person did:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/10957/273&quot;&gt;https://craftcms.stackexchange.com/a/10957/273&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-09-18T21:44:57.273" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27736" PostTypeId="1" AcceptedAnswerId="27737" CreationDate="2018-09-18T21:54:36.370" Score="2" ViewCount="693" Body="&lt;p&gt;In my Redactor field, I'd like to programmatically wrap all Youtube videos that have been added through Redactor's video plugin with Bootstrap's responsive embed classes. &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17058/if-youtube-in-redactor-then-wrap-in-div/17062&quot;&gt;This answers&lt;/a&gt; how to add a single class, but Bootstrap &lt;a href=&quot;https://getbootstrap.com/docs/4.1/utilities/embed/&quot; rel=&quot;nofollow noreferrer&quot;&gt;requires multiple classes&lt;/a&gt; to be added to the wrapper.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2019-10-09T11:15:50.487" Title="How do I wrap my Youtube video from a Redactor field with Bootstrap's responsive classes?" Tags="&lt;redactor&gt;&lt;classes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27737" PostTypeId="2" ParentId="27736" CreationDate="2018-09-18T21:54:36.370" Score="4" Body="&lt;p&gt;In order to add multiple classes to a video added through Redactor, I'm using the &lt;a href=&quot;https://github.com/mmikkel/Retcon-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon plugin&lt;/a&gt;. This is my solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | retconWrap('iframe', 'div.embed-responsive') | retconAttr( 'div.embed-responsive', { 'class' : 'embed-responsive-16by9' }, false ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are two Retcon filters applied here. The first filter &lt;a href=&quot;https://github.com/mmikkel/Retcon-Craft/wiki/Wrap&quot; rel=&quot;nofollow noreferrer&quot;&gt;retconWrap&lt;/a&gt; wraps matching selectors in whatever you want. In this case, I'm looking for an iframe and wrapping it in 'div.embed-reponsive':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;retconWrap('iframe', 'div.embed-responsive')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second filter, &lt;a href=&quot;https://github.com/mmikkel/Retcon-Craft/wiki/Attr&quot; rel=&quot;nofollow noreferrer&quot;&gt;retconAttr&lt;/a&gt;, looks for 'div.embed-responsive' (the wrapper you just applied) and applies any additional classes. The &quot;false&quot; indicates that you do not want to destroy any existing classes, just concatenate them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;retconAttr( 'div.embed-responsive', { 'class' : 'embed-responsive-16by9' }, false )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This may not be the most elegant solution, but it works. Frankly, I feel like we should be able to pass multiple classes through the retconWrap filter, but I've tried and it doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-09-18T21:54:36.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27738" PostTypeId="2" ParentId="27725" CreationDate="2018-09-18T22:46:58.470" Score="0" Body="&lt;p&gt;They're both valid options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$message-&amp;gt;send()&lt;/code&gt; is a wrapper for &lt;code&gt;Mailer&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/yiisoft/yii2/blob/master/framework/mail/BaseMessage.php#L41-L50&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/yiisoft/yii2/blob/master/framework/mail/BaseMessage.php#L41-L50&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will take an optional Mailer parameter.  If one is not passed it, it will default to the default Yii/Craft::$app-&gt;mailer and ultimately just call &lt;code&gt;send()&lt;/code&gt; on it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-18T22:46:58.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27739" PostTypeId="2" ParentId="27733" CreationDate="2018-09-18T22:51:18.977" Score="1" Body="&lt;p&gt;Doing it through a plugin would be the easiest way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/plugin-guide.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your plugin would have a controller that the form would post to, then you'd grab the data from POST and do whatever you want with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good example of this you can look at is the &lt;a href=&quot;https://github.com/craftcms/guest-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries&lt;/a&gt; plugin, that allows &quot;anonymous&quot; front-end entry submissions.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-18T22:51:18.977" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27740" PostTypeId="1" AcceptedAnswerId="27741" CreationDate="2018-09-19T03:10:27.457" Score="1" ViewCount="172" Body="&lt;p&gt;Can entries of type structure have multiple parents? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/sections-and-entries.html#sections&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/sections-and-entries.html#sections&lt;/a&gt; says that they can be hierarchical, but the UX doesn't seem to let me have more than one parent for any given child structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if that is a hard limit or just something misconfigured on my end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched around a bit and saw this answer: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16518/structure-entry-connected-to-multiple-parent-entries&quot;&gt;Structure entry connected to multiple parent entries&lt;/a&gt; which implies that the way to do this is to use relations, not structures, but wanted to confirm.&lt;/p&gt;&#xA;" OwnerUserId="8814" LastActivityDate="2018-09-19T04:56:05.227" Title="Can a structure have multiple parents?" Tags="&lt;craft3&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27741" PostTypeId="2" ParentId="27740" CreationDate="2018-09-19T04:35:53.900" Score="2" Body="&lt;p&gt;Short answer is &quot;no, you can't have more than one parent.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using relationships is probably the best answer. It's unfortunate that Luke didn't expand on his comments and add an official answer (in that other thread), but he was on the right track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create a relationship field, you can relate your entry to as many other entries as you need.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="57" LastEditDate="2018-09-19T04:56:05.227" LastActivityDate="2018-09-19T04:56:05.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27743" PostTypeId="1" CreationDate="2018-09-19T07:36:52.850" Score="1" ViewCount="46" Body="&lt;p&gt;Is it possible to define a default filter for an image inserted in Redactor text ? Filter twig for front or config ? Thanks&lt;/p&gt;&#xA;" OwnerUserId="8636" LastEditorUserId="57" LastEditDate="2018-09-19T20:14:37.333" LastActivityDate="2018-09-19T20:14:37.333" Title="Redactor image default filter" Tags="&lt;redactor&gt;&lt;image&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27744" PostTypeId="1" CreationDate="2018-09-19T08:32:49.867" Score="1" ViewCount="61" Body="&lt;p&gt;Instead of writing a lot of logic in twig in my template, I tried to create a service and get the fields related to the requested entry in a module. I then want to create a new twig variable to output the whole block in my template. After a lot try and error and reading the docs I'm still not able to achieve this. Maybe someone can give me a hint where to start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: How can I get the fields related to the requested entry in a module?&lt;/p&gt;&#xA;" OwnerUserId="8815" LastActivityDate="2018-09-19T08:32:49.867" Title="Get fields of requested entry in module" Tags="&lt;craft3&gt;&lt;modules&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27748" PostTypeId="2" ParentId="27723" CreationDate="2018-09-19T11:49:18.080" Score="3" Body="&lt;p&gt;Craft will serve one of 3 types of 404 errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When Dev Mode is enabled, you will get something like this, which shows the full stack trace leading up to the NotFoundHttpException:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PAWnH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PAWnH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this looks like what you’re getting, then Dev Mode is &lt;em&gt;definitely&lt;/em&gt; enabled. Double-check &lt;code&gt;config/general.php&lt;/code&gt; for &lt;code&gt;devMode&lt;/code&gt;, or &lt;code&gt;web/index.php&lt;/code&gt; for &lt;code&gt;YII_DEBUG&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you will get something like this in Craft’s Control Panel (as well as the front end if you haven’t specified a 404 template yet):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qlvoL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qlvoL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it’s a front-end request, &lt;em&gt;and&lt;/em&gt; you have a 404 template, then Craft will render your 404 template. If it encounters an error when trying to do that, a plain text error will be displayed, with no styling.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-09-19T14:11:44.910" LastActivityDate="2018-09-19T14:11:44.910" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27749" PostTypeId="1" AcceptedAnswerId="27750" CreationDate="2018-09-19T12:02:28.557" Score="1" ViewCount="77" Body="&lt;p&gt;So i have created my own Element Type and enabled statuses with the &lt;code&gt;hasStatuses()&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the ControlPanel its shown that each element has its own status, but it cant be changed. See image below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/G5dzk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G5dzk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The checkboxes are missing to select the desired entry and then disable or enable it. Im crawling through the source code but i am not able to find a clue on how to enable this feature.&lt;/p&gt;&#xA;" OwnerUserId="8219" LastActivityDate="2018-09-19T12:39:51.617" Title="How to enable changing the status of my own Element Type" Tags="&lt;craft3&gt;&lt;elementtype&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27750" PostTypeId="2" ParentId="27749" CreationDate="2018-09-19T12:31:18.443" Score="2" Body="&lt;p&gt;That's because those buttons are &lt;code&gt;ActionButtons&lt;/code&gt; and they have actually nothing to do with statuses in general since the status is not a single field value nor is there a value in the DB that's called status. For example: the status of an entry depends on several different attributes like &lt;code&gt;expiryDate&lt;/code&gt; or the date when it's published so there is no way to set those statuses via button there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to register the action buttons for your element type. Just take a look at an entries &lt;code&gt;defineActions&lt;/code&gt; function. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-09-19T12:39:51.617" LastActivityDate="2018-09-19T12:39:51.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27751" PostTypeId="2" ParentId="21226" CreationDate="2018-09-19T13:05:57.177" Score="2" Body="&lt;p&gt;I have exactly the same issue, clearing cookies worked for me&lt;/p&gt;&#xA;" OwnerUserId="8818" LastActivityDate="2018-09-19T13:05:57.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27752" PostTypeId="1" CreationDate="2018-09-19T13:48:57.117" Score="1" ViewCount="58" Body="&lt;p&gt;I am trying to insert a div that'll call an ad between two paragraphs of copy text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd like to do it only one instance. The current replace code I'm using is this - which is inserting my test code multiple times. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set str = block.bodyText %}&#xA;    {{ str | replace('&amp;lt;/p&amp;gt;&#xA;    &amp;lt;p&amp;gt;', '&amp;lt;/p&amp;gt;&amp;lt;div id=&quot;test&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;p&amp;gt;') | smartypants }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="8819" LastEditorUserId="8819" LastEditDate="2018-09-19T14:08:33.190" LastActivityDate="2018-09-19T19:00:58.553" Title="Replace in the first instance?" Tags="&lt;replace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27753" PostTypeId="2" ParentId="27752" CreationDate="2018-09-19T14:26:01.910" Score="1" Body="&lt;p&gt;I can't think of a way to do this with Twig's &lt;code&gt;replace&lt;/code&gt; filter but it is possible to do it by splitting the text into an array and iterating over it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set content %}&#xA;  &amp;lt;p&amp;gt;Duis mollis, est non commodo luctus.&amp;lt;/p&amp;gt;&#xA;  &amp;lt;p&amp;gt;Nulla vitae elit libero, a pharetra augue.&amp;lt;/p&amp;gt;&#xA;  &amp;lt;p&amp;gt;Donec sed odio dui. Maecenas faucibus mollis interdum. &amp;lt;/p&amp;gt;&#xA;{% endset %}&#xA;&#xA;{% set inserted %}&#xA;  &amp;lt;p&amp;gt;Inserted text&amp;lt;/p&amp;gt;&#xA;{% endset %}&#xA;&#xA;{# Split text into array on closing &amp;lt;/p&amp;gt; tags #}&#xA;{% for paragraph in content | split('&amp;lt;/p&amp;gt;') %}&#xA;  {# Add the closing tag back, except for possible empty lines  #}&#xA;  {% set paragraph = paragraph | trim | length ? paragraph ~ '&amp;lt;/p&amp;gt;' : '' %}&#xA;  {# Render the text as raw html #}&#xA;  {{ paragraph | raw }}&#xA;  {# Render the inserted paragraph on the first loop #}&#xA;  {% if loop.index == 1 %}&#xA;    {{ inserted }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: Per your question in the comment about the context, this is a good use case for a macro. This code is untested, but you might try something like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro insertAfterFirstParagraph(content, insertContent) %}&#xA;  {% for paragraph in content | split('&amp;lt;/p&amp;gt;') %}&#xA;    {% set paragraph = paragraph | trim | length ? paragraph ~ '&amp;lt;/p&amp;gt;' : '' %}&#xA;    {{ paragraph | raw }}&#xA;    {% if loop.index == 1 %}&#xA;      {{ insertContent }}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import insertAfterFirstParagraph %}&#xA;&#xA;{% set addThisHtml %}&#xA;  &amp;lt;p&amp;gt;Add this paragraph&amp;lt;/p&amp;gt;&#xA;{% endset %}&#xA;&#xA;{% set isAdded = false %}&#xA;{% for block in entry.myMatrixField %}&#xA;  {% if block.type == 'body' and loop.index &amp;gt; 5 and isAdded == false %}&#xA;    {{ insertAfterFirstParagraph(block.bodyField, addThisHtml) }}&#xA;    {% set isAdded = true %}&#xA;  {% else %}&#xA;    {{ block.bodyField }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Robin's suggestion to build a custom Twig filter in a plugin (or module) would be the cleanest solution, but the Twig code above should get the job done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside: &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/web/twig/Extension.php#L431&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft overrides the default Twig replace filter&lt;/a&gt; to use PHP's &lt;a href=&quot;http://php.net/preg_replace&quot; rel=&quot;nofollow noreferrer&quot;&gt;preg_replace()&lt;/a&gt; function but that filter doesn't accept the last two optional arguments, &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;count&lt;/code&gt;. If it did, then something like this could have worked:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;replace('/&amp;lt;\\/p&amp;gt;\\s+?&amp;lt;p&amp;gt;/', '&amp;lt;/p&amp;gt;&amp;lt;div id=&quot;test&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;p&amp;gt;', 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe a feature request is in order.&lt;/p&gt;&#xA;" OwnerUserId="593" LastEditorUserId="593" LastEditDate="2018-09-19T19:00:58.553" LastActivityDate="2018-09-19T19:00:58.553" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27754" PostTypeId="2" ParentId="27752" CreationDate="2018-09-19T14:29:40.690" Score="1" Body="&lt;p&gt;Another way would be to create a Twig filter that does what is explained here &lt;a href=&quot;https://stackoverflow.com/a/1252710/5604055&quot;&gt;replace only first appearance of string&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ str|replace_once() }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-19T14:29:40.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27755" PostTypeId="1" AcceptedAnswerId="27759" CreationDate="2018-09-19T15:05:16.497" Score="0" ViewCount="15" Body="&lt;p&gt;Will ICC profiles here always be a core part of Craft app?&#xA;&lt;code&gt;/craft/app/vendor/pixelandtonic/imagine/lib/Imagine/resources/Adobe/CMYK&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2018-09-19T20:19:04.550" LastActivityDate="2018-09-19T20:21:40.953" Title="How fixed are the ICC profile in core app?" Tags="&lt;app&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27756" PostTypeId="1" AcceptedAnswerId="27758" CreationDate="2018-09-19T15:22:27.433" Score="4" ViewCount="922" Body="&lt;p&gt;This has been a long process that I set aside to resolve &quot;later&quot;. Well, it's &quot;later&quot; and the clients wants to launch asap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only registered users can use this site. There are 2 groups: Manager and Employee. Users in Manager group have permission to create new users and put them in Employee group. It all works in the back end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft front end User Registration template&lt;/a&gt; I added a hidden field for the group id &lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;groups[]&quot; value=&quot;2&quot;&amp;gt;&lt;/code&gt; and when I submit I get &quot;HTTP 403 – Forbidden, This action may only be performed with an elevated session.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some googling lead me to &lt;a href=&quot;https://github.com/craftcms/cms/issues/2311#issuecomment-358087548&quot; rel=&quot;nofollow noreferrer&quot;&gt;this craftcms github comment&lt;/a&gt;. I get what it's saying about the elevated session and needing to send the password again but am having issues doing it. First step is testing with hard coded values on my form submit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.ajax({&#xA;    method: 'POST',&#xA;    url: 'https://www.myurl.ca/',&#xA;    data: { action: 'users/start-elevated-session', password: 'xxx'}&#xA;})&#xA;.done(function( msg ) {&#xA;    alert( &quot;Data: &quot; + msg );&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But nothing is alerted. So something is failing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try &lt;code&gt;https://www.myurl.ca/?action=users/start-elevated-session&amp;amp;password=xxx&lt;/code&gt; in a new browser tab I get &quot;TypeError, Argument 1 passed to craft\web\User::startElevatedSession() must be of the type string, null given, called in /.../vendor/craftcms/cms/src/controllers/UsersController.php on line 234&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it can't find password value. It's just getting null. I feel like maybe I don't know what &quot;body params&quot; means in the github comment. Can someone explain it like I'm 5?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Amanda&lt;/p&gt;&#xA;" OwnerUserId="230" LastActivityDate="2018-10-03T16:45:13.160" Title="Create new users with front end form and put them in a group, need help with start-elevated-session" Tags="&lt;craft3&gt;&lt;elevated-session&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27757" PostTypeId="2" ParentId="27756" CreationDate="2018-09-19T17:07:34.233" Score="2" Body="&lt;p&gt;When you enable public registration in Craft’s user settings, you can select a user group that new users should be added to. Once a group is selected you can override the group programatically from a &lt;code&gt;Users::EVENT_BEFORE_ASSIGN_USER_TO_DEFAULT_GROUP&lt;/code&gt; event handler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Register the handler from your modules/Module.php module’s &lt;code&gt;init()&lt;/code&gt; method. Add the following code to it.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\events\UserAssignGroupEvent;&#xA;use craft\services\Users;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(Users::class, Users::EVENT_BEFORE_ASSIGN_USER_TO_DEFAULT_GROUP, function(UserAssignGroupEvent $event) {&#xA;    $user = $event-&amp;gt;user;&#xA;    $form = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('form');&#xA;&#xA;    $groupMap = [&#xA;        'form-a' =&amp;gt; [2],&#xA;        'form-b' =&amp;gt; [2, 3],&#xA;    ];&#xA;&#xA;    if (($groups = $groupMap[$form] ?? false) !== false) {&#xA;        // Don’t assign the default group and assign groups manually&#xA;        $event-&amp;gt;isValid = false;&#xA;        Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($user-&amp;gt;id, $groups);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Enable bootstrapping of the module in config/app.php, simply un-comment the &lt;code&gt;'bootstrap' =&amp;gt; ['my-module']&lt;/code&gt; line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last step left is to add a hidden input to your registration forms to set a &lt;code&gt;form&lt;/code&gt; param. This param is used in the event handler to lookup the user group IDs the user should be added to when registering with this form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;form&quot; value=&quot;form-b&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a much more secure than passing group IDs with the form, and you don’t have to deal with elevated user sessions at all.&lt;/p&gt;&#xA;" OwnerUserId="125" LastActivityDate="2018-09-19T17:07:34.233" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27758" PostTypeId="2" ParentId="27756" CreationDate="2018-09-19T20:03:22.993" Score="4" Body="&lt;p&gt;Elevated sessions are basically user sessions where the user has proven to Craft that it’s really &lt;em&gt;them&lt;/em&gt; within the last 5 minutes. It’s used whenever Craft is about to increase permissions on a user (either directly or via a user group).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of the concept is to reduce the chances of malicious permission escalation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;In English,&lt;/strong&gt;&lt;/em&gt; that means if a user with certain permissions/groups walks away from their computer, elevated sessions reduces the likelihood that another user could walk up to it, find their own user account, and increase their account permissions. They’d think they’re going to get away with it right up until the point where Craft asks them to re-enter their password, which kicks off the elevated session.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I’m explaining this so that you understand the risk in what I’m about to say.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe the easiest way for you to work around this issue is to just disable elevated sessions on your site. You can do that by opening &lt;code&gt;config/general.php&lt;/code&gt; and adding this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;    'elevatedSessionDuration' =&amp;gt; 0,&#xA;    // ...&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do that, Craft will no longer require elevated sessions anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you need to have the user enter their current password as part of the user form, and send that off to Craft’s &lt;code&gt;users/start-elevated-session&lt;/code&gt; action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get that action URL, and the CSRF token needed to make any POST requests to Craft, and send them to JavaScript like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    window.startElevatedSessionUrl = &quot;{{ actionUrl('users/start-elevated-session')|e('js')|raw }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken|e('js')|raw }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in JavaScript (assuming you’re using jQuery),&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;$.ajax({&#xA;    url: window.startElevatedSessionUrl, {&#xA;    type: 'POST',&#xA;    dataType: 'json',&#xA;    headers: {&#xA;        'X-CSRF-Token': window.csrfTokenValue&#xA;    },&#xA;    data: {&#xA;        password: $('#current-password-input').val()&#xA;    },&#xA;    success: function(response, textStatus) {&#xA;        // submit the user form...&#xA;    }),&#xA;    error: function(jqXHR, textStatus) {&#xA;        // error handling...&#xA;    })&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to get even fancier you can check to make sure the user doesn’t already have an elevated session by running a POST request to &lt;code&gt;users/get-elevated-session-timeout&lt;/code&gt;. If &lt;code&gt;response.timeout&lt;/code&gt; is greater than &lt;code&gt;5&lt;/code&gt; (seconds) or so, then it’s safe to submit the form without prompting them for their current password.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2018-09-19T20:31:49.090" LastActivityDate="2018-09-19T20:31:49.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27759" PostTypeId="2" ParentId="27755" CreationDate="2018-09-19T20:21:40.953" Score="0" Body="&lt;p&gt;Not sure I'm following 100%, but they're part of the &lt;a href=&quot;https://github.com/avalanche123/Imagine/tree/develop/src/resources/Adobe/CMYK&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagine library&lt;/a&gt; so as long as Craft is using that library, they will be included in Craft.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-19T20:21:40.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27760" PostTypeId="1" AcceptedAnswerId="27770" CreationDate="2018-09-19T21:12:45.570" Score="0" ViewCount="186" Body="&lt;p&gt;I'm trying to build a simple dropdown field with a pre-populated set of options, so I figured I'd just import most of the methods from Craft's native Dropdown field. The plugin name is &lt;code&gt;siteutilities&lt;/code&gt; and the field name is &lt;code&gt;Regionselect&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace kgrote\siteutilities\fields;&#xA;&#xA;use kgrote\siteutilities\SiteUtilities;&#xA;&#xA;use Craft;&#xA;use craft\base\ElementInterface;&#xA;use craft\fields\BaseOptionsField; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This pulls in the code from &lt;code&gt;craft/vendor/craftcms/cms/src/fields/BaseOptionsField.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I want to render a custom settings template for my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate(&#xA;        '_components/fields/Regionselect_settings',&#xA;        [&#xA;            'field' =&amp;gt; $this,&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get a Twig error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to find the template&#xA;  “_components/fields/Regionselect_settings”.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My plugin file structure looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kgrote&#xA;|-siteutilities&#xA;  |-src&#xA;    |-fields&#xA;    |  |-Regionselect.php&#xA;    |-templates&#xA;    |  |-_components&#xA;    |    |-fields&#xA;    |      |-Regionselect_settings.html&#xA;    |-SiteUtilities.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2018-09-20T20:01:09.133" LastActivityDate="2018-09-20T21:09:13.433" Title="Custom Plugin Field Using Wrong Template Path" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="27763" PostTypeId="1" CreationDate="2018-09-20T10:15:57.087" Score="2" ViewCount="636" Body="&lt;p&gt;I am preparing to upgrade a site from Craft 2 to 3, and would like to make a custom template to deal with the 503 Service Unavailable when the migrations need to be run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set &lt;code&gt;devMode&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; and tried creating &lt;code&gt;templates/503.html&lt;/code&gt; and also &lt;code&gt;templates/offline.html&lt;/code&gt;, which just contain some plain HTML (no Twig/Craft functions) but each time I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An internal server error occurred.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I turn &lt;code&gt;devMode&lt;/code&gt; back on, I can see where the &lt;code&gt;craft\web\ServiceUnavailableHttpException&lt;/code&gt; is being thrown in &lt;code&gt;craft\web\Application-&amp;gt;_processUpdateLogic()&lt;/code&gt; and above it says in comments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// If an exception gets throw during the rendering of the 503 template, let&#xA;// TemplatesController-&amp;gt;actionRenderError() take care of it.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I can't see this method trying to find and/or serve a &lt;code&gt;503.html&lt;/code&gt; template, or see what is wrong with the template I've created?&lt;/p&gt;&#xA;" OwnerUserId="5470" LastEditorUserId="5470" LastEditDate="2018-09-20T10:31:45.623" LastActivityDate="2018-11-09T19:02:05.363" Title="Custom 503 template" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;error-templates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27767" PostTypeId="1" AcceptedAnswerId="27944" CreationDate="2018-09-20T15:20:08.593" Score="1" ViewCount="215" Body="&lt;p&gt;I am able to capture submissions from a regular HTML form, however if I replicate the POST with JSON I get the following &quot;Template not found&quot; error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Template not found: sprout-forms/entries/save-entry&#xA;1. in /var/www/Applications/vendor/craftcms/cms/src/controllers/TemplatesController.php&#xA;at line 70 61626364656667686970717273747576777879&#xA;  * @param string $template&#xA;  * @param array $variables&#xA;  * @return Response&#xA;  * @throws NotFoundHttpException if the requested template cannot be found&#xA;  */&#xA; public function actionRender(string $template, array $variables = []): Response&#xA; {&#xA;     // Does that template exist?&#xA;     if (!$this-&amp;gt;getView()-&amp;gt;doesTemplateExist($template)) {&#xA;         throw new NotFoundHttpException('Template not found: ' . $template);&#xA;     }&#xA;&#xA;     // Merge any additional route params&#xA;     $routeParams = Craft::$app-&amp;gt;getUrlManager()-&amp;gt;getRouteParams();&#xA;     unset($routeParams['template'], $routeParams['template']);&#xA;     $variables = array_merge($variables, $routeParams);&#xA;&#xA;     return $this-&amp;gt;renderTemplate($template, $variables);&#xA; }&#xA;&#xA;2. craft\controllers\TemplatesController::actionRender('sprout-forms/entries/save-entry', [])&#xA;&#xA;....&#xA;&#xA;11. in /var/www/Applications/web/index.php at line 21 – yii\base\Application::run() 15161718192021&#xA;                     (new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load(); }   // Load and run Craft define('CRAFT_ENVIRONMENT',&#xA;getenv('ENVIRONMENT') ?: 'production'); $app = require&#xA;CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app-&amp;gt;run();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have disabled CSRF for now in the hope of taking that out of the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have replicated the HTML form request with a JSON POST using Postman but am hitting a dead-end. Any assistance with debug steps, or a sample Postman config to a working solution would be hugely appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8824" LastEditorUserId="57" LastEditDate="2018-09-20T18:41:55.380" LastActivityDate="2018-10-23T15:02:57.363" Title="Sprout forms AJAX submission giving Template not found" Tags="&lt;plugins&gt;&lt;ajax&gt;&lt;plugin-sproutforms&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27768" PostTypeId="2" ParentId="23476" CreationDate="2018-09-20T16:53:36.330" Score="1" Body="&lt;p&gt;Just in case anyone is still having issues after the above suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that you have the following option in your &lt;code&gt;craft/config/general.php&lt;/code&gt; config settings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// run tasks auto&#xA;'runTasksAutomatically' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2018-09-20T16:53:36.330" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27769" PostTypeId="1" AcceptedAnswerId="27911" CreationDate="2018-09-20T19:52:01.827" Score="2" ViewCount="291" Body="&lt;p&gt;Is there a plugin or setting that prints the name of every template being rendered in HTML comments? I noticed this type of feature in a Drupal project and it was useful for debugging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is useful if you add it to every template you make, but I'd like to be able to turn it on/off globally for all templates in dev mode:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/449/how-can-i-make-a-template-output-its-own-filename&quot;&gt;How can I make a template output its own filename?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8781" LastEditorUserId="45" LastEditDate="2018-09-30T15:50:18.493" LastActivityDate="2018-10-02T15:54:02.377" Title="How can I print the name of every template being rendered in HTML comments, when in devMode?" Tags="&lt;plugins&gt;&lt;debugging&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27770" PostTypeId="2" ParentId="27760" CreationDate="2018-09-20T21:09:13.433" Score="1" Body="&lt;p&gt;In order to render a template within your custom plugin you need to include your plugin handle in front of your template path. For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugin-handle/_components/fields/Regionselect_settings&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-20T21:09:13.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27771" PostTypeId="2" ParentId="15847" CreationDate="2018-09-20T23:55:56.007" Score="1" Body="&lt;p&gt;Updating the following line in our NGINX configuration also fixed the problem, this is similar to &lt;code&gt;expires -1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;From&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# cache.appcache, your document html and data&#xA;location ~* \.(?:manifest|appcache|html?|xml|json)$ {&#xA;  add_header Cache-Control &quot;max-age=0&quot;;&#xA;}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;To&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# cache.appcache, your document html and data&#xA;location ~* \.(?:manifest|appcache|html?|xml)$ {&#xA;  add_header Cache-Control &quot;max-age=0&quot;;&#xA;}&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="8144" LastActivityDate="2018-09-20T23:55:56.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27773" PostTypeId="1" AcceptedAnswerId="27784" CreationDate="2018-09-21T05:26:08.400" Score="1" ViewCount="115" Body="&lt;p&gt;I had created search in Craft 3, but it returns wrong result when I enter some special characters in it, for example æ ø å. Looking for the solution.&lt;/p&gt;&#xA;" OwnerUserId="7450" LastActivityDate="2018-09-21T19:01:26.663" Title="Search return wrong result with special character like æ ø å in Craft 3" Tags="&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27774" PostTypeId="1" CreationDate="2018-09-21T12:37:43.600" Score="1" ViewCount="50" Body="&lt;p&gt;Fairly new user here.&#xA;I am kinda confused how to template. I want to rearrange the order of blocks in my backend and show them in the right order in the front.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how i am currently writing a template.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Created a section called &quot;Homepage&quot;&lt;/li&gt;&#xA;&lt;li&gt;Then I made a matrix block &quot;content blocks&quot;&lt;/li&gt;&#xA;&lt;li&gt;After that I created 3 Blocks and called them &quot;Image left&quot;, &quot;Image right&quot;, &quot;Full Text&quot;&lt;/li&gt;&#xA;&lt;li&gt;Went into my &lt;code&gt;_entry.html&lt;/code&gt; and wrote some for loops. Example&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.contentblocks.type('imageLeft') % }&#xA;    do something&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I order those fields in my backend it won't show the right order on my frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Backend order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;imageLeft&lt;/li&gt;&#xA;&lt;li&gt;imageRight&lt;/li&gt;&#xA;&lt;li&gt;imageLeft&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Frontent view:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;imageLeft&lt;/li&gt;&#xA;&lt;li&gt;imageLeft&lt;/li&gt;&#xA;&lt;li&gt;imageRight&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know this is happening because the first for loop will check all first and print them one after another before moving to the next for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I prevent this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seriously hope somebody understands my issue.  I am fairly new to Twig and Craft so I take every pointer I can get.&lt;/p&gt;&#xA;" OwnerUserId="8829" LastEditorUserId="5557" LastEditDate="2018-09-26T13:07:25.467" LastActivityDate="2018-09-26T13:07:25.467" Title="Keeping order of blocks like in backend" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;forloop&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27775" PostTypeId="1" CreationDate="2018-09-21T12:55:47.797" Score="1" ViewCount="876" Body="&lt;p&gt;When testing for a variable in a template these two appear to do the same thing. I've read CruftlessCraft's article on &lt;a href=&quot;https://cruftlesscraft.com/how-to-check-for-undefined-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to check for undefined variables&lt;/a&gt; but can't see an explanation of why I should use one over the other. In his examples (below) I note that only the default filter includes &quot;&quot; in the list of results, is that correct or significant?&#xA;Is one faster or more efficient?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if twigVariable|default %}&#xA;    Value is set and not empty&#xA;{% else %}&#xA;    Value is either undefined, false, 0, null, &quot;&quot;, [] or {}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if twigVariable ?? false %}&#xA;    The value is set and not empty&#xA;{% else %}&#xA;    Value is either undefined, false, 0, null, [] or {}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does it make any difference if I don't need a fallback or the else and am just wrapping it around a div that shouldn't be shown if the variable doesn't have any usable content?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-09-21T13:52:59.553" Title="Twig default filter or Null coalescing operator?" Tags="&lt;conditional&gt;&lt;variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27776" PostTypeId="2" ParentId="27774" CreationDate="2018-09-21T12:59:47.510" Score="1" Body="&lt;p&gt;I wrote a switch condition in my for loop and everything went well. My bad!&lt;/p&gt;&#xA;" OwnerUserId="8829" LastActivityDate="2018-09-21T12:59:47.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27778" PostTypeId="2" ParentId="27775" CreationDate="2018-09-21T13:52:59.553" Score="2" Body="&lt;p&gt;So things like the null coalescing operator make it easier to chain things, so if you have a number things to fall back on, it's much neater to write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set woof = bark ?? howl ?? growl ?? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...then it is to try to chain that all together with &lt;code&gt;| default&lt;/code&gt; filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something that may also make your life easier is the &lt;a href=&quot;https://github.com/nystudio107/craft-emptycoalesce&quot; rel=&quot;nofollow noreferrer&quot;&gt;Empty Coalesce plugin&lt;/a&gt;, so you can write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set woof = bark ??? howl ??? growl ??? null %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the difference? The null coalescing operator only checks for &lt;code&gt;null&lt;/code&gt;, so if &lt;code&gt;bark = &quot;&quot;&lt;/code&gt; then it'll choose that, which often isn't what you want for strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a writeup of all of this in &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#coalescing-the-night-away&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what is going to be more performant? Unless you're in a massive inner loop (which we should avoid in a templating language anyway), I doubt it'll matter. PHP code is transpiled to a bytecode that often gets cached, it should be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in theory, &lt;code&gt;??&lt;/code&gt; and &lt;code&gt;???&lt;/code&gt; are probably marginally faster.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-21T13:52:59.553" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27779" PostTypeId="2" ParentId="26696" CreationDate="2018-09-21T14:06:08.423" Score="1" Body="&lt;p&gt;So, if I understand you correctly, you're trying to use the Model IDs channel as a middle man? If so, I think you would just need two steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To get all SSDs from a Memory Entry&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}&#xA;{% set ssds     = craft.entries.section('SSDS SECTION HANDLE').relatedTo(modelIDs).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To get all Memory from an SSD Entry&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set modelIDs = craft.entries.section('MODEL ID SECTION HANDLE').relatedTo(entry).ids() %}&#xA;{% set memory   = craft.entries.section('MEMORY SECTION HANDLE').relatedTo(modelIDs).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="84" LastEditorUserId="84" LastEditDate="2018-09-21T14:21:35.720" LastActivityDate="2018-09-21T14:21:35.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27781" PostTypeId="1" CreationDate="2018-09-21T15:19:07.533" Score="1" ViewCount="159" Body="&lt;p&gt;I have a overview page that combines with two sections (documentation and galleries). Those two sections are attached to a parent Event. So you can select in the event entry a gallery or a documentation entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: How can i display those in order of the event's entry event day?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryGalleryIds         = craft.entries.section('gallery').ids() %}&#xA;{% set entryDocumentationIds   = craft.entries.section('documentation').ids() %}&#xA;&#xA;{% set allEntryIds = entryGalleryIds|merge(entryDocumentationIds) %}&#xA;&#xA;{% set allEntries = craft.entries.id(allEntryIds)|batch(3) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i'm looking like something as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set allEntries = craft.entries.id(allEntryIds).orderBy('events.eventDate desc')|batch(3) %}&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: When i first query all the projects and then query the related galleries the sorting is gone, because of my id(allEntryIds) filter.&lt;/p&gt;&#xA;" OwnerUserId="4427" LastActivityDate="2018-09-21T15:19:07.533" Title="Sorting with reverse relationship" Tags="&lt;craft3&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27782" PostTypeId="1" AcceptedAnswerId="30571" CreationDate="2018-09-21T16:32:32.753" Score="1" ViewCount="124" Body="&lt;p&gt;I haven't found any fields that deal with numbers for a plugin. I've changed a &lt;code&gt;forms.textField&lt;/code&gt; into a &lt;code&gt;type:number&lt;/code&gt; which has seemed to work fine for the most part. But I can't find a way to keep someone from going under 0 or over 100. I've looked in &lt;code&gt;vendor\craftcms\cms\src\templates\_includes&lt;/code&gt; and have come up empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming I'll need to make a custom field type for this but if there is something I'd rather not reinvent the wheel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {{ forms.textField({&#xA;      label: 'Blanket Discount Percent',&#xA;      instructions: 'Set this if you want to offer a blanket discount to all businesses. Do not put in letters or decimals. (10 = 10%)',&#xA;      id: 'blanketDiscount',&#xA;      name: 'settings[blanketDiscount]',&#xA;      value: settings.blanketDiscount,&#xA;      type: 'number',&#xA;   })}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do have a rule for validation setup, I would just prefer to keep people in range at the front as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;['blanketDiscount', 'integer', 'min' =&amp;gt; 0, 'max' =&amp;gt; 100],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2018-09-21T17:04:15.793" LastActivityDate="2019-06-01T06:53:33.837" Title="Type number form in textField for plugin" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27783" PostTypeId="2" ParentId="27492" CreationDate="2018-09-21T16:54:51.553" Score="3" Body="&lt;p&gt;Similar to the deprecated &lt;a href=&quot;https://github.com/boboldehampsink/tagmanager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tag Manager&lt;/a&gt;, there is &lt;strong&gt;&lt;a href=&quot;https://github.com/ethercreative/tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tags&lt;/a&gt;&lt;/strong&gt; by Ethercreative for Craft CMS 3.&lt;/p&gt;&#xA;&lt;p&gt;Not only can you inspect and delete, but also replace tags, with an indication in how many instances the tag is being used within the interface.&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-09-21T16:54:51.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27784" PostTypeId="2" ParentId="27773" CreationDate="2018-09-21T19:01:26.663" Score="1" Body="&lt;p&gt;Not possible natively.  Craft runs each search keyword through a &quot;normalization&quot; process before saving in its search index and part of that is converting characters like &lt;code&gt;å&lt;/code&gt; to their ASCII counterparts &lt;code&gt;a&lt;/code&gt;.  You can see the whole process here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/helpers/Search.php#L41&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/blob/develop/src/helpers/Search.php#L41&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this were solely in the context of the searching on the front-end of the site, you could use/write a plugin that integrated with a 3rd party search service like &lt;a href=&quot;https://www.algolia.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algolia&lt;/a&gt; that offered more flexible options, but that wouldn't affect Control Panel searching until this was implemented: &lt;a href=&quot;https://github.com/craftcms/cms/issues/833&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/833&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-21T19:01:26.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27785" PostTypeId="2" ParentId="27774" CreationDate="2018-09-21T20:22:02.500" Score="1" Body="&lt;p&gt;If you're feeling real adventurous you can do something like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.contentblocks %}&#xA;   {% include &quot;_about-partials/&quot; ~ block.type %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this instance I'd keep files in a directory named _about-partials with the same name as the block type (_about-partials/imageLeft.html) &lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-09-21T20:22:02.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27786" PostTypeId="1" AcceptedAnswerId="27787" CreationDate="2018-09-21T21:32:09.080" Score="1" ViewCount="100" Body="&lt;p&gt;I have a multi-site application where my primary site is my company's main website, and the additional sites are small &quot;microsites&quot; for some of our projects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to share channels between my sites. For example, I have a &quot;testimonials&quot; channel with a basic quote &amp;amp; cite fields in the entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make this channel available to all my sites, but I want each site's testimonials to be unique, since they're about different projects. I also don't have the same number of testimonials for each site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made the channel available to each site, then created the testimonial entries within each site's tab. I thought this would keep each site's testimonial entry list separate, but it instead made one big list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I can do this through filtering or site groups? I don't want to have to create a unique channel for each site that has the exact same functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I've found that I can fudge this by using the &quot;Enable for this site&quot; lightswitch on each entry, but I don't trust my content editors to properly use this function, and I don't want them to have to see all the disabled entries from other sites in the entry list.&lt;/p&gt;&#xA;" OwnerUserId="3900" LastEditorUserId="3900" LastEditDate="2018-09-21T21:41:54.610" LastActivityDate="2018-09-21T21:50:17.537" Title="Can two sites use the same channel, but have unique entries?" Tags="&lt;craft3&gt;&lt;multi-site&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27787" PostTypeId="2" ParentId="27786" CreationDate="2018-09-21T21:50:17.537" Score="4" Body="&lt;p&gt;There is a light switch field in your section settings with the label &quot;propagate entries across all sites&quot;. Just turn it off and your entries will be unique &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-21T21:50:17.537" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27788" PostTypeId="1" AcceptedAnswerId="27789" CreationDate="2018-09-21T22:59:28.243" Score="1" ViewCount="603" Body="&lt;p&gt;I have a custom field with a setting for &lt;code&gt;regionType&lt;/code&gt;, but when I try to save the field I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Setting unknown property:&#xA;  kgrote\siteutilities\fields\Regionselect::regionType&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In my fieldtype file I have this to load the settings field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getSettingsHtml()&#xA;{&#xA;    // Render the settings template&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate(&#xA;        'site-utilities/_components/fields/Regionselect_settings',&#xA;        [&#xA;            'field' =&amp;gt; $this,&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the settings template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;{% set input %}&#xA;    {{ forms.select({&#xA;        id: 'regionType',&#xA;        name: 'regionType',&#xA;        options: ({&#xA;            'usStates' : 'US States &amp;amp; Canadian Provinces',&#xA;            'countries' : 'Countries'&#xA;        })&#xA;    }) }}&#xA;{% endset %}&#xA;&#xA;{{ forms.field(&#xA;    {&#xA;        label: &quot;Region Type&quot;|t('app')&#xA;    }, &#xA;    input &#xA;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My field is a simple pre-filled dropdown, so I'm importing most of the methods for my field from &lt;code&gt;craft/vendor/craftcms/cms/src/fields/BaseOptionsField.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see much in the source code that relates to settings, so I'm not really sure what's causing this error.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-09-22T08:39:39.817" Title="Custom Field Settings: Unknown Property Error" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27789" PostTypeId="2" ParentId="27788" CreationDate="2018-09-22T08:34:37.533" Score="1" Body="&lt;p&gt;The name of your select is &lt;code&gt;regionType&lt;/code&gt; thus it will try to store the property &lt;code&gt;regionType&lt;/code&gt; in your field. When you call the field &lt;code&gt;value&lt;/code&gt; it will set the property &lt;code&gt;value&lt;/code&gt; in you class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You either need to include the property or change it to an existing one.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-09-22T08:39:39.817" LastActivityDate="2018-09-22T08:39:39.817" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27790" PostTypeId="2" ParentId="20466" CreationDate="2018-09-22T14:42:15.527" Score="7" Body="&lt;p&gt;Your code should work as you suggested without the additional stuff. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    UrlManager::class,&#xA;    UrlManager::EVENT_REGISTER_CP_URL_RULES,&#xA;    function (RegisterUrlRulesEvent $event) {&#xA;        $event-&amp;gt;rules['waffles'] = 'waffles/syrup/pour';&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Clarification:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plugin-name = Waffles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;controllerName = SyrupController&lt;/p&gt;&#xA;&#xA;&lt;p&gt;functionName = actionPour()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the information above you should be able to call the function in the controller with waffles/syrup/pour, and as you stated, the &lt;code&gt;rules['waffles']&lt;/code&gt; would be your URL.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-09-22T14:42:15.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27791" PostTypeId="1" CreationDate="2018-09-22T18:52:06.960" Score="1" ViewCount="107" Body="&lt;p&gt;I loaded redactor. When I try to run the install command &#xA;./craft install/plugin redactor&#xA;I get an error back that says craft is a directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears the plugin may already be installed.&#xA;But I do not know the next step to access it.&#xA;I thought I might have a Redactor field type available to select but I do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the plugin store does not load on my local install.&#xA;It says plugin store not available at this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under settings &gt; Plugins nothing shows.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-09-22T18:57:59.980" Title="Issues with Redactor on Local Install" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;redactor&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27792" PostTypeId="2" ParentId="27791" CreationDate="2018-09-22T18:57:59.980" Score="2" Body="&lt;p&gt;Disregard, I loaded redactor in the wrong directory!&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2018-09-22T18:57:59.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27794" PostTypeId="1" AcceptedAnswerId="27795" CreationDate="2018-09-22T21:47:27.000" Score="2" ViewCount="56" Body="&lt;p&gt;All the examples look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ytjB5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ytjB5.png&quot; alt=&quot;Documentation and Examples&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mine looks like the image below where you have to select the site from that top left dropdown and then there are some enabled things on the right:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jslQX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jslQX.png&quot; alt=&quot;Mine&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8456" LastActivityDate="2018-09-22T22:35:09.847" Title="Why does my entry language selection look different from examples?" Tags="&lt;localization&gt;&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27795" PostTypeId="2" ParentId="27794" CreationDate="2018-09-22T22:35:09.847" Score="3" Body="&lt;p&gt;The top screenshot is from Craft 2. The entry language selector (technically, the entry &lt;em&gt;site&lt;/em&gt; selector since Craft 3) was redesigned with Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-09-22T22:35:09.847" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27796" PostTypeId="1" CreationDate="2018-09-22T23:45:21.657" Score="1" ViewCount="401" Body="&lt;p&gt;I have a public registration form and want to redirect to a payment page where I will need some details about the newly created user. I tried doing this in my form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;{{ redirectInput('join/payment/?user={id}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have set a custom route to allow for the query parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   if url = join/payment/*  load template join/payment&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the resulting url does not include the query string, just the first two segments, 'join/payment'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="587" LastEditDate="2018-09-23T02:53:11.287" LastActivityDate="2018-09-23T16:18:20.197" Title="Using redirectInput {id} parameter" Tags="&lt;redirect&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27798" PostTypeId="2" ParentId="27796" CreationDate="2018-09-23T16:18:20.197" Score="2" Body="&lt;p&gt;Sorry, false alarm. My template file was not syncing with the server. To recap, this works like a charm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ redirectInput('join/payment/{id}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a redirect that includes the ID of the entry or user that was just created!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-09-23T16:18:20.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27799" PostTypeId="1" AcceptedAnswerId="27874" CreationDate="2018-09-23T20:31:37.923" Score="1" ViewCount="51" Body="&lt;p&gt;I'm getting example.com/es/es for my Spanish site instead of the expected example.com/es when using the {{ siteUrl }} variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The primary site is producing the expected example.com/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea of how I did that incorrectly?&lt;/p&gt;&#xA;" OwnerUserId="8456" LastActivityDate="2018-09-29T22:54:40.893" Title="The Variable {{ siteUrl }} Produces Two /es/es/ On Multisite" Tags="&lt;localization&gt;&lt;multi-site&gt;&lt;language&gt;&lt;siteurl&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27800" PostTypeId="1" AcceptedAnswerId="27804" CreationDate="2018-09-24T00:45:19.837" Score="1" ViewCount="480" Body="&lt;p&gt;I want to be able to output different values for my fieldtype depending on the twig attribute. So &lt;code&gt;{{ entry.myField }}&lt;/code&gt; would output &lt;code&gt;AK&lt;/code&gt; by default, but &lt;code&gt;{{ entry.myField.label }}&lt;/code&gt; would output &lt;code&gt;Alaska&lt;/code&gt;. Currently I'm using the &lt;code&gt;normalizeValue()&lt;/code&gt; method to handle all this, but I need to know which attribute (if any) is being called by the twig template. How do I get that information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very basic example of what I'm thinking of would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function normalizeValue($value, ElementInterface $element = null)&#xA;{&#xA;    $states = array(&#xA;        'AK' =&amp;gt; 'Alaska',&#xA;        'AL' =&amp;gt; 'Alabama'&#xA;    );&#xA;&#xA;    if( twig.attribute == 'label' )&#xA;    {&#xA;        return $states[$value];&#xA;    }&#xA;    else&#xA;    {&#xA;        return $value;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-09-30T19:42:50.180" Title="How to Access the Twig Attribute Name from the Fieldtype Class" Tags="&lt;plugin-development&gt;&lt;fieldtypes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27801" PostTypeId="2" ParentId="23534" CreationDate="2018-09-24T05:08:53.230" Score="1" Body="&lt;p&gt;I've just been trying to figure this out myself and have a slightly different approach that might work the same with a little less code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'blog/*/id-&amp;lt;entrySlug:{slug}&amp;gt;' =&amp;gt; 'blog/entry',&#xA;'blog/id-&amp;lt;entrySlug:{slug}&amp;gt;' =&amp;gt; 'blog/entry',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 'slug' variable with it's value from the url will be available in the template without having to do anything else.&lt;/p&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="8650" LastEditDate="2018-09-24T05:20:14.723" LastActivityDate="2018-09-24T05:20:14.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27802" PostTypeId="1" CreationDate="2018-09-24T05:56:48.083" Score="1" ViewCount="78" Body="&lt;p&gt;I'm in the process of migrating a large, complex site to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've reached the stage where I like to install Craft in parallel to my existing CMS with the intention of allowing users to help me check the content is migrated correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also with a view to keep parts of the existing site in the current CMS and migrate them later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have advice on how to best do this? How would I redirect requests for different parts of the site to the correct CMS?&lt;/p&gt;&#xA;" OwnerUserId="8596" LastActivityDate="2018-09-24T16:08:48.193" Title="How to install Craft on live server parallel to existing CMS?" Tags="&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27803" PostTypeId="1" CreationDate="2018-09-24T09:52:17.687" Score="1" ViewCount="67" Body="&lt;p&gt;I made a template including a matrix field. I want to wrap all occurrences of a certain block type into a &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; element. How can I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% for block in entry.matrixField.all() %}&#xA;        {% switch block.type %}&#xA;            {% case 'blockType1' %}&#xA;            &amp;lt;div&amp;gt;&#xA;                {{ block.field }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% case 'blockType2' %}&#xA;            &amp;lt;div&amp;gt;&#xA;                {{ block.field }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% case 'blockType3' %}&#xA;            &amp;lt;ul&amp;gt;&#xA;                &amp;lt;li&amp;gt;&#xA;                    {{ block.field }}&#xA;                &amp;lt;/li&amp;gt;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endswitch %}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Current output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want my output like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;    &amp;lt;li&amp;gt;blockfield&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is, I want the &lt;code&gt;ul&lt;/code&gt; tag to follow the loop of blockType3.&lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="960" LastEditDate="2018-09-27T21:30:49.943" LastActivityDate="2018-10-28T08:00:50.550" Title="How to wrap a matrix blocktype occurrence loop inside a ul?" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27804" PostTypeId="2" ParentId="27800" CreationDate="2018-09-24T11:58:40.257" Score="2" Body="&lt;p&gt;Because of several reasons it won't work the way you are going to do it. The easiest approach is to return an object or an array instead of single value in your &lt;code&gt;normalize&lt;/code&gt; functions that contains the value and the states. Craft does the same with nearly all fields. They values are objects with a &lt;code&gt;_toString&lt;/code&gt; function so you don't even know you have an object rather than a string &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-24T11:58:40.257" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="27806" PostTypeId="2" ParentId="27802" CreationDate="2018-09-24T16:08:48.193" Score="1" Body="&lt;p&gt;Is the existing CMS live?&#xA;Often depends on your whole development process.&#xA;Quick thoughts would be to use a subdomain of live site.,e eg 'staging.mysite.com'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For managing redirects the answer is it depends.&#xA;Typically htaccess 301 redirects&#xA;Redirect 301 /my old url  &lt;a href=&quot;https://www.mynewurl.com/my&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mynewurl.com/my&lt;/a&gt; old url&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can replace the latter domain name with subdomain name eg as above 'staging' and then switch to real domain when live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending upon Craft version you could use Retour for Craft2 or check the plugin directory for redirect management solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if the original url structure is solid then you can always make craft match in section  settings :)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-09-24T16:08:48.193" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27807" PostTypeId="1" AcceptedAnswerId="27821" CreationDate="2018-09-24T20:44:08.537" Score="1" ViewCount="88" Body="&lt;p&gt;I'm creating a filter and would like to return entries that must contain multiple categories (and behavior, not or). A sample url would be /events?cat=2,3. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventCat = craft.request.getParam('cat') %}&#xA;{% set events = craft.entries.relatedTo(eventCat).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gives me &quot;or&quot; behavior and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventCat = craft.request.getParam('cat') %}&#xA;{% set events = craft.entries.relatedTo('and', eventCat).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doesn't give me any results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(updated to reflect Craft 3 syntax, thanks Robin!)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="7426" LastEditDate="2018-09-25T14:33:39.453" LastActivityDate="2018-09-25T14:34:38.817" Title="Returning entries that contain both categories" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;relatedto&gt;&lt;query&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27808" PostTypeId="2" ParentId="27807" CreationDate="2018-09-24T21:28:51.493" Score="3" Body="&lt;h3&gt;Answer for Craft 2&lt;/h3&gt;&#xA;&lt;p&gt;Your final result should not look like &lt;code&gt;relatedTo('and', '1,2')&lt;/code&gt; but&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo('and, 1, 2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo(['and', 1, 2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So you just need to do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo('and,' ~ param)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Keep in mind to code defensively, so you might want to check if your query param is not null or something&lt;/p&gt;&#xA;&lt;h3&gt;Answer for Craft 3&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;relatedTo(['and', ['element' =&amp;gt; 1], ['element' =&amp;gt; 2]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-09-25T14:22:47.520" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27809" PostTypeId="2" ParentId="27807" CreationDate="2018-09-24T21:29:14.720" Score="3" Body="&lt;p&gt;This should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set eventCats = craft.request.getParam('cat')|split(',') %}&#xA;{% set events = craft.entries.relatedTo(['and']|merge(eventCats)).find() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-09-24T21:29:14.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27810" PostTypeId="2" ParentId="27767" CreationDate="2018-09-24T22:18:56.193" Score="0" Body="&lt;p&gt;If you're using template overrides, could you please make sure that the next line is in the &lt;code&gt;&amp;lt;form&amp;gt; ... &amp;lt;\form&amp;gt;&lt;/code&gt; tag?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% hook 'sproutForms.modifyForm' %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This line is required in Sprout Forms for Craft3 if you have the spam protection enabled in the plugin settings.&lt;/p&gt;&#xA;" OwnerUserId="4798" LastActivityDate="2018-09-24T22:18:56.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27811" PostTypeId="1" CreationDate="2018-09-25T05:55:09.627" Score="2" ViewCount="491" Body="&lt;p&gt;I'm developing a site using the Craft 3 and I can't figure out how to connect assets with Microsoft Azure Storage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found plugin for Amazon S3 but not available similar plugin for azure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7300" LastActivityDate="2019-03-19T16:15:46.717" Title="Asset integration with Microsoft Azure Storage in Craft 3" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;storage&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27812" PostTypeId="2" ParentId="27667" CreationDate="2018-09-25T07:55:19.733" Score="2" Body="&lt;p&gt;Why do you want to let them register twice? Maybe re-think the way you go about this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Possible solutions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add them to a certain user group (via a plugin) on registration with the appropriate permissions and/or...&lt;/li&gt;&#xA;&lt;li&gt;...if you don't want to write a plugin, you can add a certain category to the user element on registration. You can than check throughout your site if the user has the correct category ('permission') to do something. If they come back and want to become a full member, just let them fill out a new form which UPDATES their already existing user account with a new category/permission.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's the way I used it on a large site and it works rather fine.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2018-09-26T07:36:50.647" LastActivityDate="2018-09-26T07:36:50.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27813" PostTypeId="2" ParentId="27811" CreationDate="2018-09-25T10:10:06.213" Score="0" Body="&lt;p&gt;I'm not aware of any public Craft 3 plugins that integrate with Microsoft Azure Storage and I'm not seeing any on &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.craftcms.com/&lt;/a&gt;, so at this point, you'd have to write your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several Azure Storage PHP libraries that you could use as a starting point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://packagist.org/packages/microsoft/azure-storage?query=microsoft%2Fazure&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://packagist.org/packages/microsoft/azure-storage?query=microsoft%2Fazure&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-09-25T10:10:06.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27814" PostTypeId="2" ParentId="27625" CreationDate="2018-09-25T10:15:27.860" Score="1" Body="&lt;p&gt;Thanks to &lt;strong&gt;@RobinSchambach&lt;/strong&gt; advices, I was able to find a safe solution to handle this permission problematic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is possible using two main addings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Register a &lt;strong&gt;new custom permission&lt;/strong&gt; from the plugin&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;This prevents user from be able to access other users assets&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Add a &lt;strong&gt;custom User field&lt;/strong&gt; on the assets to assign ownership ;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Using this we can verify that it was uploaded from user requesting the file deletion&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the plugin Service:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function linkUserToAssets($assets = [])&#xA;{&#xA;    $currentUser = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;    if ($currentUser &amp;amp;&amp;amp; Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()&#xA;        &amp;amp;&amp;amp; Craft::$app-&amp;gt;request-&amp;gt;getIsPost()) {&#xA;        foreach ($assets-&amp;gt;all() as $asset) {&#xA;            if (isset($asset-&amp;gt;id) &amp;amp;&amp;amp; !empty($asset-&amp;gt;id)) {&#xA;                $asset = Craft::$app-&amp;gt;assets-&amp;gt;getAssetById($asset-&amp;gt;id);&#xA;                if (isset($asset-&amp;gt;assetsOwner)) {&#xA;                    $asset-&amp;gt;assetsOwner = [$currentUser-&amp;gt;id];&#xA;                    Craft::$app-&amp;gt;elements-&amp;gt;saveElement($asset);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds a function to call before each entry is saved, to assign the user's ownership on entry's assets using the &lt;code&gt;assetsOwner&lt;/code&gt; custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the plugin Module:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    UserPermissions::class,&#xA;    UserPermissions::EVENT_REGISTER_PERMISSIONS,&#xA;    function(RegisterUserPermissionsEvent $event) {&#xA;        $event-&amp;gt;permissions['User'] = [&#xA;            'deleteOwnAssets' =&amp;gt; [&#xA;                'label' =&amp;gt; 'Delete Own Assets'&#xA;            ],&#xA;        ];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds a custom permission in the CP which should be added to group of users who will perform this action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the plugin Controller:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDeleteAsset()&#xA;{&#xA;    $currentUser = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;    if ($currentUser) {&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;        $assetId = $request-&amp;gt;getBodyParam('assetId');&#xA;        $asset = Craft::$app-&amp;gt;getAssets()-&amp;gt;getAssetById($assetId);&#xA;&#xA;        if ($asset-&amp;gt;assetsOwner[0]-&amp;gt;id !== $currentUser-&amp;gt;id || !Craft::$app-&amp;gt;user-&amp;gt;checkPermission('deleteOwnAssets')) {&#xA;            return $this-&amp;gt;asErrorJson(Craft::t('app', self::TEXT_PERMISSION_REQUIRED));&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This deletes requested assets if the current user was the owner of the asset (using &lt;code&gt;assetsOwner&lt;/code&gt; custom field) and has the required custom permission (in this case, &lt;code&gt;deleteOwnAssets&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-09-25T10:15:27.860" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27816" PostTypeId="1" AcceptedAnswerId="27819" CreationDate="2018-09-25T11:49:24.147" Score="0" ViewCount="22" Body="&lt;p&gt;my categories have a custom field called &lt;code&gt;titleTag&lt;/code&gt; for SEO as well as a number of other fields. When I render them at their URI (&lt;code&gt;/categories/cat1&lt;/code&gt;) I can output those fields easily with &lt;code&gt;{{category.titleTag}}&lt;/code&gt; etc. However on the main category page I also have a filter button that loads another URI via &lt;code&gt;jQuery.load()&lt;/code&gt; to filter the items based on category. So in the filter template I have this to start.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set filter = craft.request.getParam('filter') %}&#xA;{% set category = craft.categories.slug(filter) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then want to output (amongst other things) the custom field values of the found category like so &lt;code&gt;{{category.titleTag}}&lt;/code&gt; but it comes out null (the category found I am testing with has the field filled out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="8830" LastActivityDate="2018-09-25T14:46:06.327" Title="field from category not available via craft.categories" Tags="&lt;templating&gt;&lt;categories&gt;&lt;field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27817" PostTypeId="1" AcceptedAnswerId="27818" CreationDate="2018-09-25T12:16:47.913" Score="0" ViewCount="158" Body="&lt;p&gt;I have a website with multiple locales (English, Dutch, French, German and Spanish). I'm saving dates on a front-end form through Ajax, but it seems that Craft saves the dates in the locales' format, eg. in English, the 1st February 2018 would be 02/01/2018 and in Dutch it would be 01/02/2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd think Craft would save all dates in the same format, disregarding any locale. I read somewhere that craft saves all dates in UTC format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I'm in the locale EN and I pass the date 01/02/2018, expecting 2nd January 2018 to be saved, it saves OK.&#xA;However, if I'm in NL, DE or FR and I pass the same date, it is saved as 1st February 2018 as these languages switch the day and month around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I always pass &lt;code&gt;MM/DD/YYYY&lt;/code&gt; to the date field whatever locale. &#xA;I'm using the &lt;a href=&quot;https://date-fns.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;dateFns&lt;/a&gt; library for formatting and the date it formats is correct. I use VueJS &lt;a href=&quot;http://www.vcalendar.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;v-calendar&lt;/a&gt; as a datepicker which also shows everything correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when it's saved to Craft it suddenly switched day and month in the back-end!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or explanation, please? Seems like strange behavior choices.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-09-26T07:35:49.213" Title="Does Craft save dates in the locale format?" Tags="&lt;datetime&gt;&lt;ajax&gt;&lt;frontend-form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27818" PostTypeId="2" ParentId="27817" CreationDate="2018-09-25T12:40:01.433" Score="0" Body="&lt;p&gt;Where are you seeing the incorrect date, in the database or when you output it in the templates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think Craft is probably working as expected here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will expect the date submitted to be in the correct format for the locale it was submitted from, so will translate it from that format into UTC to save in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, when the date is output in templates, it is transformed again to the correct format for the locale it is being displayed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;EN&lt;/code&gt; locale presumably assumes US date formatting so &lt;code&gt;01/02/2018&lt;/code&gt; is correct as 2nd January 2018. For European locales, a date submitted as &lt;code&gt;01/02/2018&lt;/code&gt; will correctly be recognised as 2nd February 2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to make sure that the date input in your form is formatted according to the expected way for the locale the form is in.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2018-09-25T12:40:01.433" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27819" PostTypeId="2" ParentId="27816" CreationDate="2018-09-25T14:16:12.987" Score="0" Body="&lt;p&gt;Because your &lt;code&gt;category&lt;/code&gt; variable is no object of type &lt;code&gt;craft\elements\Category&lt;/code&gt; but an &lt;code&gt;ElementQuery&lt;/code&gt; in order to fetch the category you need to use the &lt;code&gt;one()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-Twig prettyprint-override&quot;&gt;&lt;code&gt;{% set category = craft.categories.slug(filter).one() %}  &#xA;{% if category != null %}&#xA;    {{ category.titleTag }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your &lt;code&gt;{{category.titleTag}}&lt;/code&gt; printed the search criteria. Imagine you would like to set other conditions in your query: how is Craft supposed to know when your query ends?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-09-25T14:46:06.327" LastActivityDate="2018-09-25T14:46:06.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27821" PostTypeId="2" ParentId="27807" CreationDate="2018-09-25T14:34:38.817" Score="0" Body="&lt;pre&gt;&lt;code&gt;{% set eventCats = craft.request.getParam('cat') %}&#xA;{% set eventCats = eventCats|split(',') %}&#xA;&#xA;{% set cats = [] %}&#xA;&#xA;{% for eventCat in eventCats %}&#xA;    {% set cats = cats|merge([{element: eventCat}]) %}&#xA;{% endfor %}&#xA;&#xA;{% if cats|length &amp;gt; 0 %}&#xA;    {% set cats = ['and']|merge(cats) %}&#xA;{% endif %}&#xA;&#xA;{% set events = craft.entries.relatedTo(cats) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Shout out to Stephen Hamilton who came up with this answer. &lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-09-25T14:34:38.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27824" PostTypeId="1" AcceptedAnswerId="27827" CreationDate="2018-09-25T16:39:32.677" Score="1" ViewCount="88" Body="&lt;p&gt;I've duplicated a site into a new development environment, and everything works as it should other than the Entries section. It throws the AJAX-based &quot;unknown error&quot;, originating from a 500 error on getElements action. Attempting to bring up that request directly results in a &quot;Bad Request - The request could not be understood by the server due to malformed syntax.&quot; screen. The isolated log from the incident included here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018/09/25 16:31:49 [profile] [system.db.CDbCommand.query] begin:system.db.CDbCommand.query(SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `content`.`field_redirectLink`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (`entries`.`sectionId` IN ('2', '1'))) AND (`entries`.`sectionId` IN ('2', '1'))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `postDate` DESC LIMIT 50. Bound with :locale='en_us')&#xA;2018/09/25 16:31:49 [profile] [system.db.CDbCommand.query] end:system.db.CDbCommand.query(SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `content`.`field_redirectLink`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (`entries`.`sectionId` IN ('2', '1'))) AND (`entries`.`sectionId` IN ('2', '1'))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `postDate` DESC LIMIT 50. Bound with :locale='en_us')&#xA;2018/09/25 16:31:49 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #19 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'craft_lla.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `content`.`field_redirectLink`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (`entries`.`sectionId` IN ('2', '1'))) AND (`entries`.`sectionId` IN ('2', '1'))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `postDate` DESC LIMIT 50. Bound with :locale='en_us'.&#xA;in /Users/marcus/Web/linked-learning-datamart/craft/app/services/ElementsService.php (224)&#xA;in /Users/marcus/Web/linked-learning-datamart/craft/app/models/ElementCriteriaModel.php (284)&#xA;in /Users/marcus/Web/linked-learning-datamart/craft/app/elementtypes/BaseElementType.php (237)&#xA;2018/09/25 16:31:49 [error] [exception.CDbException] CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #19 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'craft_lla.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_body`, `content`.`field_redirectLink`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`&#xA;FROM `craft_elements` `elements`&#xA;JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id&#xA;JOIN `craft_content` `content` ON content.elementId = elements.id&#xA;JOIN `craft_entries` `entries` ON entries.id = elements.id&#xA;JOIN `craft_sections` `sections` ON sections.id = entries.sectionId&#xA;LEFT JOIN `craft_structures` `structures` ON structures.id = sections.structureId&#xA;LEFT JOIN `craft_structureelements` `structureelements` ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (`entries`.`sectionId` IN ('2', '1'))) AND (`entries`.`sectionId` IN ('2', '1'))&#xA;GROUP BY `elements`.`id`&#xA;ORDER BY `postDate` DESC LIMIT 50. Bound with :locale='en_us' in /Users/marcus/Web/linked-learning-datamart/craft/app/framework/db/CDbCommand.php:543&#xA;Stack trace:&#xA;#0 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/db/CDbCommand.php(396): CDbCommand-&amp;gt;queryInternal('fetchAll', Array, Array)&#xA;#1 /Users/marcus/Web/linked-learning-datamart/craft/app/services/ElementsService.php(224): CDbCommand-&amp;gt;queryAll()&#xA;#2 /Users/marcus/Web/linked-learning-datamart/craft/app/models/ElementCriteriaModel.php(284): Craft\ElementsService-&amp;gt;findElements(Object(Craft\ElementCriteriaModel))&#xA;#3 /Users/marcus/Web/linked-learning-datamart/craft/app/elementtypes/BaseElementType.php(237): Craft\ElementCriteriaModel-&amp;gt;find()&#xA;#4 /Users/marcus/Web/linked-learning-datamart/craft/app/controllers/ElementIndexController.php(373): Craft\BaseElementType-&amp;gt;getIndexHtml(Object(Craft\ElementCriteriaModel), Array, Array, '*', 'index', true, true)&#xA;#5 /Users/marcus/Web/linked-learning-datamart/craft/app/controllers/ElementIndexController.php(105): Craft\ElementIndexController-&amp;gt;_getElementResponseData(true, true)&#xA;#6 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ElementIndexController-&amp;gt;actionGetElements()&#xA;#7 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#8 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#9 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#10 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('getElements')&#xA;#11 /Users/marcus/Web/linked-learning-datamart/craft/app/etc/web/WebApp.php(837): CWebApplication-&amp;gt;runController('elementIndex/ge...')&#xA;#12 /Users/marcus/Web/linked-learning-datamart/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#13 /Users/marcus/Web/linked-learning-datamart/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#14 /Users/marcus/Web/linked-learning-datamart/craft/app/index.php(73): CApplication-&amp;gt;run()&#xA;#15 /Users/marcus/Web/linked-learning-datamart/index.php(19): require_once('/Users/marcus/W...')&#xA;#16 {main}&#xA;REQUEST_URI=/index.php/admin/actions/elementIndex/getElements&#xA;HTTP_REFERER=http://lla.local/admin/entries&#xA;---&#xA;2018/09/25 16:31:49 [trace] [system.CModule] Loading &quot;errorHandler&quot; application component&#xA;in /Users/marcus/Web/linked-learning-datamart/craft/app/etc/web/WebApp.php (596)&#xA;&#xA;******************************************************************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried recopying the working site files and database, but this exact same issue shows up each time. Could it be an environmental issue? Despite tracking it this far, I'm at a loss.&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-10-25T17:00:55.557" Title="Admin getElements 500 &quot;unknown error&quot;" Tags="&lt;entries&gt;&lt;admin&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27825" PostTypeId="1" CreationDate="2018-09-25T16:42:08.117" Score="1" ViewCount="530" Body="&lt;p&gt;I have 2 forms on my site, one that registers for the WHOLE site and one that registers for just the downloads on the site. I wrote this custom function to change the user group if the email existed. So basically what i'm going for here is if someone signed up for ONLY the downloads and wanted to signup for the whole site to let them use their email they used to sign up originally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically they fill out the sign up form use the same email etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the code i have isn't working properly. It changes the user group and allows the user to sign up IF they already signed up, however it won't update the rest of my user fields on the form. If a new user comes to the site and tries to sign up for the whole site the signup form doesn't work, it doesn't save the user, just redirects to the login page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JNiPB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JNiPB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-09-25T18:01:52.373" Title="Updating craft user fields from plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27826" PostTypeId="1" CreationDate="2018-09-25T16:45:50.233" Score="1" ViewCount="143" Body="&lt;p&gt;I'm attempting to add a very basic tax adjuster to specific users based on a custom lightswitch field. I currently have a simple plugin with two classes for the plugin and adjuster that mirror the example in the &lt;a href=&quot;https://craftcommerce.com/docs/adjusters&quot; rel=&quot;nofollow noreferrer&quot;&gt;adjuster documentation&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/plugins/taxexemptadjuster/TaxExemptAdjusterPlugin.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Craft;&#xA;&#xA;require_once('Adjusters/TaxExempt_TaxAdjuster.php');&#xA;&#xA;class TaxExemptAdjusterPlugin extends BasePlugin&#xA;{&#xA;    ...&#xA;&#xA;    public function commerce_registerOrderAdjusters()&#xA;    {&#xA;        return [&#xA;            601 =&amp;gt; new \Commerce\Adjusters\TaxExempt_TaxAdjuster&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;craft/plugins/taxexemptadjuster/Adjusters/TaxExempt_TaxAdjuster.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Commerce\Adjusters;&#xA;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class TaxExempt_TaxAdjuster implements Commerce_AdjusterInterface&#xA;{&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = [])&#xA;    {&#xA;        $taxAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;        if (craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;getContent()-&amp;gt;getAttribute('userTaxExempt')) {&#xA;            $order-&amp;gt;baseTax = $order-&amp;gt;baseTax - $order-&amp;gt;baseTax;&#xA;&#xA;            $taxAdjuster-&amp;gt;type = &quot;Tax&quot;;&#xA;            $taxAdjuster-&amp;gt;name = &quot;Tax Exempt&quot;;&#xA;            $taxAdjuster-&amp;gt;description = &quot;Tax Exempt&quot;;&#xA;            $taxAdjuster-&amp;gt;amount = -$order-&amp;gt;baseTax;&#xA;            $taxAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;            $taxAdjuster-&amp;gt;optionsJson = ['lineItemsAffected' =&amp;gt; null];&#xA;            $taxAdjuster-&amp;gt;included = false;&#xA;&#xA;            return [$taxAdjuster];&#xA;        }&#xA;&#xA;        return [];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on the examples I've found in the adjusters documentation this should zero out the baseTax and totalTax values if an authenticated user has the custom userTaxExempt lightswitch field enabled. I've tried removing the conditional to see if there was an issue with the custom field on the user profile but even then none of the adjustments are applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I overlooked?&lt;/p&gt;&#xA;" OwnerUserId="561" LastEditorUserId="561" LastEditDate="2018-09-25T16:58:30.057" LastActivityDate="2018-10-09T19:45:12.100" Title="Tax Exempt Adjuster" Tags="&lt;plugin-craftcommerce&gt;&lt;adjusters&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27827" PostTypeId="2" ParentId="27824" CreationDate="2018-09-25T16:51:53.347" Score="1" Body="&lt;p&gt;A little more pouring over the logs came up with the specific &quot;only_full_group_by&quot; MySQL error. This put me back on the trail, which lead me here:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12084/getting-this-sql-error-group-by-incompatible-with-sql-mode-only-full-group-by&quot;&gt;Getting this SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears the most straightforward approach is to add this line to your environment within /craft/config/db.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'initSQLs' =&amp;gt; array(&quot;SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks again, Brad Bell!&lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2018-09-25T16:51:53.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27828" PostTypeId="2" ParentId="27826" CreationDate="2018-09-25T17:00:37.730" Score="1" Body="&lt;p&gt;I'm not sure but this jumped out at me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$myAdjuster-&amp;gt;amount = -$order-&amp;gt;totalTax;&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think you can &quot;negative&quot; a variable in that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try  &lt;code&gt;$myAdjuster-&amp;gt;amount = $order-&amp;gt;totalTax * -1;&lt;/code&gt; instead&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-25T17:00:37.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27829" PostTypeId="2" ParentId="27825" CreationDate="2018-09-25T18:01:52.373" Score="1" Body="&lt;p&gt;To Create a user do&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = Craft::$app-&amp;gt;getRequest();&#xA;$user = new User();&#xA;$user-&amp;gt;username         = $request-&amp;gt;getBodyParam('username');&#xA;$user-&amp;gt;email            = $request-&amp;gt;getBodyParam('email');&#xA;$user-&amp;gt;newPassword      = $request-&amp;gt;getBodyParam('password');&#xA;$user-&amp;gt;firstName        = $request-&amp;gt;getBodyParam('firstName');&#xA;$user-&amp;gt;lastName         = $request-&amp;gt;getBodyParam('firstName');&#xA;$user-&amp;gt;setScenario(User::SCENARIO_REGISTRATION);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To update a user&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$request            = Craft::$app-&amp;gt;getRequest();&#xA;$user-&amp;gt;username     = $request-&amp;gt;getBodyParam('username');&#xA;$user-&amp;gt;email        = $request-&amp;gt;getBodyParam('email');&#xA;$user-&amp;gt;newPassword  = $request-&amp;gt;getBodyParam('password');&#xA;$user-&amp;gt;firstName    = $request-&amp;gt;getBodyParam('firstName');&#xA;$user-&amp;gt;lastName     = $request-&amp;gt;getBodyParam('firstName');&#xA;$user-&amp;gt;setScenario(User::SCENARIO_LIVE);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's basically the same except the scenario&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-25T18:01:52.373" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27831" PostTypeId="2" ParentId="22552" CreationDate="2018-09-25T21:02:29.443" Score="0" Body="&lt;p&gt;This question is related to YII2 Advanced Template:&#xA;&lt;a href=&quot;https://github.com/yiisoft/yii2-app-advanced/blob/master/frontend/views/layouts/main.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/yiisoft/yii2-app-advanced/blob/master/frontend/views/layouts/main.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frontend Twig layout template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html&amp;gt;&#xA;&amp;lt;head&amp;gt;  &#xA;    {% block head %}&#xA;    &amp;lt;meta charset=&quot;UTF-8&quot;/&amp;gt;&#xA;    &amp;lt;title&amp;gt;Title&amp;lt;/title&amp;gt;&#xA;    {{ head() }} {# css from AssetBundle #}&#xA;    {# {% do view.registerCssFile( &quot;url&quot;) %} #} {# Your custom css #}&#xA;    {% endblock %}&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    {{ beginBody() }} {# js from AssetBundle #}&#xA;        {% block content %} &#xA;            Hello world! &#xA;        {% endblock %}&#xA;    {# {% do view.registerJsFile( &quot;url&quot;) %} #}{# Your custom js #}&#xA;    {{ endBody() }} {# js from AssetBundle #}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your plugin Controller use renderPageTemplate not only renderTemplate. The renderPageTemplate envelops renderTemplate using beginPage() and endPage(), see craft\web\View.php &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The combination renderTemplate and {{endBody}} only generates in HTML &lt;code&gt;&amp;lt;!CDATA ...&amp;gt;&lt;/code&gt; lines.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastEditorUserId="8838" LastEditDate="2018-09-25T21:23:30.473" LastActivityDate="2018-09-25T21:23:30.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27832" PostTypeId="2" ParentId="6708" CreationDate="2018-09-25T21:40:12.983" Score="1" Body="&lt;p&gt;For what it's worth I found this page after doing a web search for the error message, then realized that I had set everything up on the live server but hadn't imported the database.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I realized that when I updated the database password in my .env file I actually had replaced the security key. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So those are other things to check.&lt;/p&gt;&#xA;" OwnerUserId="8839" LastEditorUserId="8839" LastEditDate="2018-09-25T22:02:03.040" LastActivityDate="2018-09-25T22:02:03.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27833" PostTypeId="1" CreationDate="2018-09-25T23:02:01.927" Score="2" ViewCount="1810" Body="&lt;p&gt;In Craft 2, if you have a &lt;strong&gt;plugin&lt;/strong&gt; that needs to load a view from the &lt;strong&gt;site templates&lt;/strong&gt; directory, you could just go:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Set the template context to site templates.&#xA;$path = craft()-&amp;gt;path-&amp;gt;getSiteTemplatesPath();&#xA;craft()-&amp;gt;path-&amp;gt;setTemplatesPath($path);&#xA;&#xA;# Now we can load sweet templates from the sites templates dir, not the plugin one.&#xA;craft()-&amp;gt;templates-&amp;gt;render(&quot;/path/to/particular/site/template&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm struggling with doing this in a &lt;strong&gt;Craft 3 plugin&lt;/strong&gt;. I thought I was on the right track with the below, but the context isn't updating.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Set the template context to site templates.&#xA;$path = Craft::$app-&amp;gt;getPath()-&amp;gt;getSiteTemplatesPath();&#xA;Craft::$app-&amp;gt;getView()-&amp;gt;setTemplatesPath($path);&#xA;&#xA;# Or this seems like it might do the same? &#xA;# Craft::$app-&amp;gt;getView()-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_SITE);&#xA;&#xA;# Render the view!&#xA;Craft::$app-&amp;gt;getView()-&amp;gt;render(&quot;/path/to/particular/site/template&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in explosions. It shows the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to resolve view file for view&#xA;  '/path/to/particular/site/template': no active view context.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Setting the template context is the bit that's not working. It's still looking at the plugin template directory.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-09-26T21:49:45.427" Title="Craft 3 Plugins - Setting Template Path To Site Templates" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27834" PostTypeId="2" ParentId="27833" CreationDate="2018-09-25T23:57:14.050" Score="5" Body="&lt;p&gt;Ok I've made sense of this - if you set the view template mode/context to site, then use the view &lt;strong&gt;renderTemplate()&lt;/strong&gt; method (not render) it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is how you achieve the same thing in &lt;strong&gt;Craft 3&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Set the template context to the site mode.&#xA;Craft::$app-&amp;gt;getView()-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_SITE);&#xA;&#xA;# Now using the renderTemplate() method, it will work.&#xA;$html = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate(&quot;/path/to/particular/site/template&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: Lenka commented pointing out there is actually some &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&quot; rel=&quot;noreferrer&quot;&gt;official documentation&lt;/a&gt; on this.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="4155" LastEditDate="2018-09-26T21:49:45.427" LastActivityDate="2018-09-26T21:49:45.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27835" PostTypeId="1" AcceptedAnswerId="27848" CreationDate="2018-09-26T00:29:21.177" Score="1" ViewCount="125" Body="&lt;p&gt;I want to do some complicated sorting of events coming back from the Solspace Calendar plugin. I'm not certain whether this issue is specific to this plugin or whether it's a general Craft thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the custom plugin I'm writing where I want to do this, I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Solspace\Calendar\Elements\Event;&#xA;&#xA;...&#xA;&#xA;$events = Event::buildQuery([&#xA;    'rangeStart' =&amp;gt; $attributes['start'],&#xA;    'rangeEnd' =&amp;gt; $attributes['end'],&#xA;])&#xA;-&amp;gt;orderBy([&#xA;    'least(&#xA;        datediff(`calendar_events`.`endDate`, `calendar_events`.`startDate`),&#xA;        datediff(`calendar_events`.`endDate`, now())&#xA;    )' =&amp;gt; SORT_ASC,&#xA;    'content.field_feature' =&amp;gt; SORT_DESC,&#xA;    'calendar_events.startDate' =&amp;gt; SORT_ASC,&#xA;    'title' =&amp;gt; SORT_ASC,&#xA;])&#xA;-&amp;gt;all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The events do not come back in the order I expect, which is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;By number remaining days of the event, ascending. (An event which starts tomorrow and runs for 2 days have 2 days remaining. An event which started yesterday and runs for 2 days has 1 day remaining. An event which has already finished has 0 remaining days.)&lt;/li&gt;&#xA;&lt;li&gt;If otherwise equal, then events with the &quot;featured&quot; flag should come earlier.&lt;/li&gt;&#xA;&lt;li&gt;If otherwise equal, then events which start earlier should come earlier.&lt;/li&gt;&#xA;&lt;li&gt;If otherwise equal, then sort by title.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I believe I have the ordering logic correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look at the Craft log I can see the query being run. If I put that into a MySQL console and run it, the results &lt;em&gt;are&lt;/em&gt; in the order I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's such a query (which I've modified a bit to give more useful columns in the result set, so I can verify the order is correct):&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-sql prettyprint-override&quot;&gt;&lt;code&gt;SELECT `elements`.`id`,&#xA;       calendar_events.`startdate`,&#xA;       calendar_events.`enddate`,&#xA;       Datediff(calendar_events.enddate, calendar_events.startdate) durat,&#xA;       Datediff(calendar_events.enddate, Now())                     daystogo,&#xA;       Least(Datediff(calendar_events.enddate, calendar_events.startdate),&#xA;       Datediff(&#xA;       calendar_events.enddate, Now()))                             days,&#xA;       `content`.`title`,&#xA;       `content`.`field_feature`&#xA;FROM   (SELECT `elements`.`id`       AS `elementsId`,&#xA;               `elements_sites`.`id` AS `elementsSitesId`,&#xA;               `content`.`id`        AS `contentId`&#xA;        FROM   `craft_elements` `elements`&#xA;               INNER JOIN `craft_calendar_events` `calendar_events`&#xA;                       ON `calendar_events`.`id` = `elements`.`id`&#xA;               INNER JOIN `craft_elements_sites` `elements_sites`&#xA;                       ON `elements_sites`.`elementid` = `elements`.`id`&#xA;               INNER JOIN `craft_content` `content`&#xA;                       ON `content`.`elementid` = `elements`.`id`&#xA;               INNER JOIN `craft_calendar_calendars`&#xA;                       ON `craft_calendar_calendars`.`id` =&#xA;                          calendar_events.`calendarid`&#xA;               INNER JOIN `craft_users`&#xA;                       ON `craft_users`.`id` = calendar_events.`authorid`&#xA;        WHERE  ( ( calendar_events.`rrule` IS NULL&#xA;                   AND calendar_events.`enddate` &amp;gt;= '2018-10-01 00:00:00' )&#xA;                  OR ( calendar_events.`rrule` IS NOT NULL&#xA;                       AND calendar_events.`until` IS NOT NULL&#xA;                       AND calendar_events.`until` &amp;gt;= '2018-10-01 00:00:00' )&#xA;                  OR ( calendar_events.`rrule` IS NOT NULL&#xA;                       AND calendar_events.`until` IS NULL )&#xA;                  OR ( calendar_events.`freq` = 'SELECT_DATES' ) )&#xA;           AND ( calendar_events.`startdate` &amp;lt;= '2018-10-31 23:59:59'&#xA;                  OR calendar_events.`freq` = 'SELECT_DATES' )&#xA;           AND ( `elements_sites`.`siteid` = '1' )&#xA;           AND ( `calendar_events`.`id` &amp;lt;&amp;gt; 9761 )&#xA;           AND ( `content`.`siteid` = '1' )&#xA;           AND ( `elements`.`archived` = false )&#xA;           AND ( `elements`.`enabled` = true )&#xA;           AND ( `elements_sites`.`enabled` = true )&#xA;        ORDER  BY Least(Datediff(`calendar_events`.`enddate`,&#xA;                        `calendar_events`.`startdate`),&#xA;                             Datediff(`calendar_events`.`enddate`, Now())),&#xA;                  `content`.`field_feature` DESC,&#xA;                  `calendar_events`.`startdate`,&#xA;                  `title`) `subquery`&#xA;       INNER JOIN `craft_calendar_events` `calendar_events`&#xA;               ON `calendar_events`.`id` = `subquery`.`elementsid`&#xA;       INNER JOIN `craft_elements` `elements`&#xA;               ON `elements`.`id` = `subquery`.`elementsid`&#xA;       INNER JOIN `craft_elements_sites` `elements_sites`&#xA;               ON `elements_sites`.`id` = `subquery`.`elementssitesid`&#xA;       INNER JOIN `craft_content` `content`&#xA;               ON `content`.`id` = `subquery`.`contentid`&#xA;       INNER JOIN `craft_calendar_calendars`&#xA;               ON `craft_calendar_calendars`.`id` = calendar_events.`calendarid`&#xA;       INNER JOIN `craft_users`&#xA;               ON `craft_users`.`id` = calendar_events.`authorid`&#xA;ORDER  BY Least(Datediff(`calendar_events`.`enddate`,&#xA;                `calendar_events`.`startdate`),&#xA;                    Datediff(`calendar_events`.`enddate`, Now())),&#xA;          `content`.`field_feature` DESC,&#xA;          `calendar_events`.`startdate`,&#xA;          `title`;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, something must then be happening between the database returning results (in the right order) and the result being returned in my line of PHP code and stored as &lt;code&gt;$events&lt;/code&gt;, because in &lt;code&gt;$events&lt;/code&gt; they're in a totally different order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's happening here? How can I avoid whatever ordering rules are being applied by Craft or Solspace Calendar after my custom ones?&lt;/p&gt;&#xA;" OwnerUserId="8782" LastActivityDate="2018-10-26T23:00:57.067" Title="Advanced sorting of events with database expressions (Solspace Calendar)" Tags="&lt;craft3&gt;&lt;database&gt;&lt;ordering&gt;&lt;sorting&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27836" PostTypeId="1" CreationDate="2018-09-26T00:29:34.987" Score="1" ViewCount="921" Body="&lt;p&gt;In Craft2, when making an ajax request to a plugin controller action, you would use the &lt;strong&gt;returnJson()&lt;/strong&gt; method which is part of the &lt;strong&gt;BaseController&lt;/strong&gt; class - which your plugin controllers extend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sets some headers, echo's the response and kills any further processing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionDoStuff() {&#xA;&#xA;    $response = (object)[&#xA;        &quot;message&quot; =&amp;gt; &quot;Look at me! I'm JSON!&quot;&#xA;    ];&#xA;&#xA;    $this-&amp;gt;returnJson($response);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;strong&gt;Craft 3&lt;/strong&gt;/&lt;strong&gt;Yii 2&lt;/strong&gt; I'm having trouble finding the equivalent.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-10-26T01:00:44.277" Title="Craft 3 Plugin Controller - returnJson() replacement?" Tags="&lt;ajax&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27837" PostTypeId="2" ParentId="27836" CreationDate="2018-09-26T00:32:12.810" Score="3" Body="&lt;p&gt;I wasn't rtfm'ing hard enough. In the docs for &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-controller#asJson()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;\yii\web\Controller&lt;/a&gt;, which is what the &lt;strong&gt;\craft\web\Controller&lt;/strong&gt; class extends (which is what your plugin controllers extend) there is a method &lt;strong&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-controller#asJson()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;asJson()&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;asJson($response);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-09-26T00:32:12.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27839" PostTypeId="2" ParentId="27817" CreationDate="2018-09-26T07:35:49.213" Score="0" Body="&lt;p&gt;The answer of Steve Rowling was correct. For a similar official answer by Brandon you can go here: &lt;a href=&quot;https://github.com/craftcms/cms/issues/3325&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3325&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-09-26T07:35:49.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27841" PostTypeId="2" ParentId="27774" CreationDate="2018-09-26T09:48:41.607" Score="0" Body="&lt;p&gt;I'm aware the answer has been given already , but I just wanted to point out that the &lt;a href=&quot;https://docs.craftcms.com/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft documentation&lt;/a&gt; has a nice code sample on how to handle this as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the other answers already state, it basically boils down to looping over the blocks and using a switch case (or if/else statements) to determine the type and act accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant part of the documentation can be found &lt;a href=&quot;https://docs.craftcms.com/v3/matrix-fields.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;at this link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6991" LastActivityDate="2018-09-26T09:48:41.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27842" PostTypeId="1" CreationDate="2018-09-26T18:01:56.363" Score="0" ViewCount="599" Body="&lt;p&gt;Long story short, I migrated from Craft 2 to Craft 3 but had an issue with a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'emailTemplateId' in 'where clause'&#xA;The SQL being executed was: UPDATE craft_sproutemail_notificationemailsSET emailTemplateId='barrelstrength\sproutforms\integrations\sproutemail\emailtemplates\basic\BasicSproutFormsNotification' WHERE emailTemplateId='sproutforms-basicsproutformsnotification'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told to reinstall Craft 2, update the plugin, and then migrate over to Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I moved the Craft 3 files, reinstall Craft 2 and am trying to import the backup database. The problem is my backup database has existing tables that cause errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/101/best-practice-on-importing-craft-db-backups&quot;&gt;Best practice on importing Craft db backups?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;They key is to get the database from the &quot;backup database&quot; function in &#xA;the control panel that includes&#xA;&#xA;DROP TABLE IF EXISTS craft_analytics_settings; ...&#xA;&#xA;before it creates all the tables so you shouldn't have to delete any &#xA;tables first, been working for us that way since the beginning.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just don't know where to begin doing so. Is there any suggestions? At this point, I just want to get any version of the site back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="7167" LastActivityDate="2018-09-26T18:47:42.947" Title="Importing a database from backup" Tags="&lt;mysql&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27843" PostTypeId="2" ParentId="27833" CreationDate="2018-09-26T18:20:36.633" Score="0" Body="&lt;p&gt;This is a comment, but I'm a new participant, so I can't add it.&#xA;I recommend the official documentation page &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&lt;/a&gt; where you can find all the variants how to updating Rendering Templates from Craft2 to Craft3.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-09-26T18:20:36.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27844" PostTypeId="2" ParentId="27842" CreationDate="2018-09-26T18:47:42.947" Score="1" Body="&lt;p&gt;Your problem is &quot;only&quot; database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing - create a another copy of your backup file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you got phpMyAdmin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a new database and set env file in Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can drop all tables there and try load sql backup. If it is not working try create individual tables first after relations and data. &lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-09-26T18:47:42.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27845" PostTypeId="1" CreationDate="2018-09-26T19:44:31.940" Score="1" ViewCount="136" Body="&lt;p&gt;What is the correct Validation Pattern format to add to a Formerly email field in the Craft admin control panel if I want to stop any submissions from email addresses with a .ru TLD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;!(\.ru)&#xA;/^((?!\.ru).)*$/s&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But they do nothing.&lt;/p&gt;&#xA;" OwnerUserId="8844" LastEditorUserId="8844" LastEditDate="2018-09-26T20:51:35.003" LastActivityDate="2018-10-26T22:00:29.927" Title="Formerly email validation" Tags="&lt;plugins-formerly&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27846" PostTypeId="2" ParentId="27845" CreationDate="2018-09-26T21:01:36.460" Score="1" Body="&lt;p&gt;Try find the regex string in &lt;a href=&quot;https://regex101.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://regex101.com/&lt;/a&gt; where you can define your pos and neg examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.*(?:(?!ru).).$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://stackoverflow.com/questions/16398471/regex-for-string-not-ending-with-given-suffix&quot;&gt;https://stackoverflow.com/questions/16398471/regex-for-string-not-ending-with-given-suffix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-09-26T21:01:36.460" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27847" PostTypeId="2" ParentId="17788" CreationDate="2018-09-26T21:26:06.533" Score="0" Body="&lt;p&gt;I'm not sure if there was an update that made this possible, but OPs code worked for me (Craft v3.0.25). Just note that when calling Super Table, it has to be camel case like so &lt;code&gt;...craft.superTable.getRelatedElements...&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My version: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedMovies = craft.superTable.getRelatedElements({&#xA;    relatedTo: {&#xA;      targetElement: entry,&#xA;      field: 'roles.actor'&#xA;    },&#xA;    section: 'movies'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am calling this inside of an 'actor' entry template which is referenced here: &lt;code&gt;targetElement: entry&lt;/code&gt;.&#xA;Inside the actor template, I want to list all of the movies that the actor was in, hence &lt;code&gt;section: 'movies'&lt;/code&gt;. Inside the movie entry, the actor is referenced inside a Super Table field (&lt;code&gt;'roles'&lt;/code&gt;) with a row handle of &lt;code&gt;'actor'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling the following produces a list of all the movies the actor has been in. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for movie in relatedMovies %}&#xA;  &amp;lt;p&amp;gt;{{movie.title}}&amp;lt;/p&amp;gt;&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps someone that comes across a similar issue!&lt;/p&gt;&#xA;" OwnerUserId="8340" LastActivityDate="2018-09-26T21:26:06.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27848" PostTypeId="2" ParentId="27835" CreationDate="2018-09-26T22:19:58.837" Score="1" Body="&lt;p&gt;I emailed Solspace support about this and had an answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unfortunately it's not possible to have the SQL order events like you need, because after the SQL fetches the events, we have to hydrate all occurences that any given event might have, and then reorder the bulk separately since occurrences usually change the order of all events.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We might be able to fire an event after the sorting's done so you could adjust the order, but it will never be possible to sort everything right using SQL sort alone.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This makes sense -- the database has no idea what the fields to do with event repetition mean, so there's no way it could correctly do the ordering logic where events repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I'm not using the repeating logic, so it's a shame I can't switch this behaviour off, but at least it's explained.&lt;/p&gt;&#xA;" OwnerUserId="8782" LastActivityDate="2018-09-26T22:19:58.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27849" PostTypeId="1" CreationDate="2018-09-27T02:25:33.167" Score="2" ViewCount="73" Body="&lt;p&gt;Can a Craft install run on multiple domains and/or subdomains?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example having the same Craft install running a blog Channel at blog.example.com and also an about Single at example.com&lt;/p&gt;&#xA;" OwnerUserId="8845" LastEditorUserId="57" LastEditDate="2018-10-29T03:50:41.867" LastActivityDate="2018-10-29T03:50:41.867" Title="Is it possible to have one Craft install running" Tags="&lt;multi-site&gt;&lt;subdomain&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27851" PostTypeId="1" CreationDate="2018-09-27T10:05:34.557" Score="1" ViewCount="36" Body="&lt;p&gt;I am using the &lt;a href=&quot;https://github.com/wja-no/craft-weighted-search&quot; rel=&quot;nofollow noreferrer&quot;&gt;weighted search&lt;/a&gt; plugin to inplement a search functionality in my site. It works as it should but I am looking for a way to tell how much results were found of each type. Where type for example is &lt;code&gt;blog&lt;/code&gt; and &lt;code&gt;mapMarker&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how the search bar gets its results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getParam('query') %}&#xA;{% set typesToSearch = ['mapMarker', 'blog'] %} &amp;lt;- This is what I want to count&#xA;{% set results = craft.weightedSearch.substringSearch(query, typesToSearch) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I have a block of code that shows all my results, and this is the place where I want to tell the end user how much results is from each &lt;code&gt;typesToSearch&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I implement such feature in this code? :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for searchResult in results %}&#xA;    {{ searchResult.entry.type|length }} &amp;lt;- I tried this but this doesn't work.&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8846" LastEditorUserId="57" LastEditDate="2018-10-28T02:21:14.997" LastActivityDate="2018-10-29T23:30:39.047" Title="Counting section handle in TWIG with weighted search plugin" Tags="&lt;templating&gt;&lt;plugins&gt;&lt;database&gt;&lt;craft2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27852" PostTypeId="2" ParentId="5305" CreationDate="2018-09-27T13:14:10.243" Score="2" Body="&lt;p&gt;The quickfix for this issue is to login to phpMyAdmin and execute the following command in the SQL tab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;REPAIR TABLE craft_searchindex;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6238" LastActivityDate="2018-09-27T13:14:10.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27853" PostTypeId="1" CreationDate="2018-09-27T16:30:29.987" Score="1" ViewCount="75" Body="&lt;p&gt;I am working with a contact form plugin, written by an external developer several years ago. I want to trigger a file download upon successful completion of the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it stands, I have an &lt;code&gt;onPost&lt;/code&gt; event listener in a separate plugin which fires if the form data is valid and stored in the database correctly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;on('capture_submissions.onPost', array($this, 'triggerDownload'));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried several things such as redirecting to a controller action:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$url = UrlHelper::getActionUrl('myplugin/whitepaper/download', array('id' =&amp;gt; $id));&#xA;craft()-&amp;gt;request-&amp;gt;redirect($url);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also tried to use sendFile:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft()-&amp;gt;request-&amp;gt;sendFile($filepath, $file_contents);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works, however I would like the page to refresh first, displaying a confirmation message and then to trigger the download. As it stands, the download is triggered but the page isn't reloaded so no success message and the form data is still displayed.&lt;/p&gt;&#xA;" OwnerUserId="4965" LastActivityDate="2018-10-31T11:00:16.683" Title="Trigger download after form submission" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27855" PostTypeId="1" CreationDate="2018-09-27T19:03:57.247" Score="1" ViewCount="516" Body="&lt;p&gt;I'm trying to register a user from the front-end and assign them to a specific group. I know that via control panel I can set a default user group, but there is a registration instance where I need the registrant to be assigned to a different group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this to no avail...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;groups&quot; value=&quot;4&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8848" LastActivityDate="2018-09-29T02:13:30.023" Title="Register a user to a specific group" Tags="&lt;craft3&gt;&lt;registration&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27857" PostTypeId="2" ParentId="27855" CreationDate="2018-09-27T21:28:17.130" Score="1" Body="&lt;p&gt;You can only do this with custom PHP otherwise this is going to be a high security risk. Imagine someone just changes your HTML and inserts a different group id: everyone could just join the group he/she likes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you can &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt; - there is already a default one and insert an event to do this by yourself but you need to be careful. I wouldn't trust user input in that case too much.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(ElementEvent $event){&#xA;        if(\get_class($event-&amp;gt;element) === User::class){&#xA;            $joinSpecialGroup = (bool)Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('joinSpecialGroup');&#xA;            if($joinSpecialGroup === true){&#xA;                Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($event-&amp;gt;element-&amp;gt;id, [4]);&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: I woulnd't call the property &lt;code&gt;joinSpecialGroup&lt;/code&gt; - it is just for demonstration&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-27T21:28:17.130" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27858" PostTypeId="2" ParentId="27851" CreationDate="2018-09-27T21:32:52.813" Score="0" Body="&lt;p&gt;Can't you just use the same filter for your &lt;code&gt;typesToSearch&lt;/code&gt; parameter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typesToSearch|length&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-09-27T21:32:52.813" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27859" PostTypeId="2" ParentId="27803" CreationDate="2018-09-28T07:50:55.067" Score="2" Body="&lt;p&gt;A possible solution could be this:&#xA;Instead of outputting your blockType3 immediately, save all blockType3 ID's in an array. When your loop has finished (check for loop.last) output all the blocktypes from the array at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code is just as an example (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set arrBlockType3 = [] %}&#xA;{% for block in entry.matrixField.all() %}&#xA;    {% switch block.type %}&#xA;        {% case 'blockType1' %}&#xA;            &amp;lt;div&amp;gt;&#xA;                {{ block.field }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% case 'blockType2' %}&#xA;            &amp;lt;div&amp;gt;&#xA;                {{ block.field }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            {% case 'blockType3' %}&#xA;                {% set arrBlockType3 = arrBlockType3 | merge([block.id]) %}&#xA;    {% endswitch %}&#xA;    {% if loop.last %}&#xA;        &amp;lt;ul&amp;gt;&#xA;        {% for id in arrBlockType3 %}&#xA;            {% set block = entry.matrixField.id(id).first() %}&#xA;            &amp;lt;li&amp;gt;{{ block.field }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-09-28T07:50:55.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27861" PostTypeId="2" ParentId="27849" CreationDate="2018-09-28T09:40:19.263" Score="2" Body="&lt;p&gt;Sure it can. Craft 3 has &lt;a href=&quot;https://craftcms.com/features/multi-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-site&lt;/a&gt; support.&#xA;And for using a subdomain, you don't even need that, just point that subdomain at the correct template URL (eg. forward blog.example.com to example.com/blog).&#xA;The about single at example.com would just be your homepage.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-09-28T09:40:19.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27862" PostTypeId="1" CreationDate="2018-09-28T10:11:17.107" Score="0" ViewCount="75" Body="&lt;p&gt;I have a custom plugin that uses a custom field leveraging the &lt;code&gt;elementSelect&lt;/code&gt; fieldtype to select an asset (which is then processed on submission via a custom service). However, when I select an asset via my field, I get the following JS error in console:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Uncaught Error: Syntax error, unrecognized expression: [data-id=&quot;[&quot;1286&quot;]&quot;]:first&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The integer above relates to the selected asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone come across this issue before?&#xA;It was working previously so not sure if a Craft update has broken it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin field template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;_includes/forms&quot; as forms %}&#xA;{{ forms.elementSelectField({&#xA;        elementType: elementType,&#xA;        sourceElementId: value,&#xA;        value: value,&#xA;        elements: elements,&#xA;        sources: volumes,&#xA;        label: 'Your asset',&#xA;        limit: 1,&#xA;        id: name,&#xA;        name: name })&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-09-28T10:11:17.107" Title="Custom plugin: asset fieldtype" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;craft3&gt;&lt;custom-fieldtype&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27863" PostTypeId="2" ParentId="8441" CreationDate="2018-09-28T14:22:39.157" Score="1" Body="&lt;p&gt;You can also do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a file, for my purpose i created a file in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_includes/somefile.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in my templates, I reuse the code in somefile.html by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ include(&quot;_includes/somefile&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8854" LastActivityDate="2018-09-28T14:22:39.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27864" PostTypeId="1" AcceptedAnswerId="27867" CreationDate="2018-09-28T15:39:02.177" Score="0" ViewCount="1058" Body="&lt;p&gt;Can someone point me to the craft 3 docs where I can find informations about the request template function: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;craft.app.request.getSegment(2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really struggling understanding the craft cms 3 docs...&#xA;Only found this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is deprecated:&#xA;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-request.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-web-request.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this contains the old and new functions names:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you&#xA;Francesco&lt;/p&gt;&#xA;" OwnerUserId="3328" LastActivityDate="2018-09-28T18:51:35.630" Title="craft 3 request" Tags="&lt;craft3&gt;&lt;request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27865" PostTypeId="1" AcceptedAnswerId="27866" CreationDate="2018-09-28T16:00:05.407" Score="1" ViewCount="858" Body="&lt;p&gt;I've been working on a site locally in &lt;code&gt;devMode&lt;/code&gt;. I moved it from Craft 2 to Craft 3. I set &lt;code&gt;devMode&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; in &lt;code&gt;config/general.php&lt;/code&gt; file and in admin it doesn't show the &lt;code&gt;devMode&lt;/code&gt; bar at the top, but everything in the front of the site was pointing to my local environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that has worked is setting my siteUrl in the 'dev' to the actual site&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Dev environment settings&#xA;'dev' =&amp;gt; [&#xA;    // Base site URL&#xA;    'siteUrl' =&amp;gt; 'https://footwearoutfitters.net',&#xA;&#xA;    // Dev Mode (see https://craftcms.com/support/dev-mode)&#xA;    'devMode' =&amp;gt; false,&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While this works, I'm concerned if it thinks it's running in &lt;code&gt;devMode&lt;/code&gt; I'll have potential security threats.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="57" LastEditDate="2018-10-29T03:52:20.790" LastActivityDate="2018-10-29T03:52:20.790" Title="Craft 3 devMode doesn't turn off" Tags="&lt;craft3&gt;&lt;devmode&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27866" PostTypeId="2" ParentId="27865" CreationDate="2018-09-28T16:33:11.273" Score="1" Body="&lt;p&gt;I missed this in the .env file, I'll leave this here in case anyone else is as bad a space case as myself. :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# The environment Craft is currently running in ('dev', 'staging', 'production', etc.)&#xA;ENVIRONMENT=&quot;dev&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-09-28T16:33:11.273" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27867" PostTypeId="2" ParentId="27864" CreationDate="2018-09-28T18:51:35.630" Score="0" Body="&lt;p&gt;As far as I know the only documentation you will find for this in the section called &quot;Changes in Craft3&quot;, then scroll down to &quot;Template Functions&quot; &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a better explanation, go to the Craft 2 docs - conceptually the same, different syntax.&lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.request.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/craft.request.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-09-28T18:51:35.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27868" PostTypeId="2" ParentId="27800" CreationDate="2018-09-28T20:41:17.800" Score="4" Body="&lt;p&gt;Robin's answer is technically correct but I wanted to add a little more detail on how I got it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function normalizeValue($value, ElementInterface $element = null)&#xA;{&#xA;    if ( $value instanceof SingleOptionFieldData ) &#xA;    {&#xA;        return $value;&#xA;    }&#xA;&#xA;    $nakedOpts = array&#xA;    (&#xA;        &quot;AL&quot; =&amp;gt; &quot;Alabama&quot;, &#xA;        &quot;AK&quot; =&amp;gt; &quot;Alaska&quot;, &#xA;        &quot;AS&quot; =&amp;gt; &quot;American Samoa&quot;, &#xA;        &quot;AZ&quot; =&amp;gt; &quot;Arizona&quot;, &#xA;        &quot;AR&quot; =&amp;gt; &quot;Arkansas&quot;&#xA;    );&#xA;&#xA;    foreach( $nakedOpts as $optval =&amp;gt; $label )&#xA;    {&#xA;        $isSelected = ($value == $optval) ? true : false;&#xA;        $this-&amp;gt;options[] = new OptionData($label, $optval, $isSelected);&#xA;    }&#xA;&#xA;    if( !empty($value) )&#xA;    {&#xA;        $value = new SingleOptionFieldData($nakedOpts[$value], $value, true);&#xA;        $value-&amp;gt;setOptions($this-&amp;gt;options);&#xA;    }&#xA;&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Full Explanation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up using Craft's native &lt;code&gt;OptionData&lt;/code&gt; and &lt;code&gt;SingleOptionFieldData&lt;/code&gt; classes to convert my values and options into objects that Craft knows how to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to start with I added these declarations at the top of my fieldtype file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\fields\data\OptionData;&#xA;use craft\fields\data\SingleOptionFieldData;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now in your fieldtype file you need to do two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert your options to an array of &lt;code&gt;OptionData&lt;/code&gt; objects&lt;/li&gt;&#xA;&lt;li&gt;Convert the &lt;code&gt;$value&lt;/code&gt; to a &lt;code&gt;SingleOptionFieldData&lt;/code&gt; object&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So we need to take our &quot;naked&quot; option array (our array of US states) and convert it to an array of objects, and we also need to mark which of the options is our selected value. The &lt;code&gt;OptionData&lt;/code&gt; object accepts 3 parameters: &lt;code&gt;$label&lt;/code&gt;, &lt;code&gt;$value&lt;/code&gt;, and &lt;code&gt;$selected&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$nakedOpts = array&#xA;(&#xA;    &quot;AL&quot; =&amp;gt; &quot;Alabama&quot;, &#xA;    &quot;AK&quot; =&amp;gt; &quot;Alaska&quot;, &#xA;    &quot;AS&quot; =&amp;gt; &quot;American Samoa&quot;, &#xA;    &quot;AZ&quot; =&amp;gt; &quot;Arizona&quot;, &#xA;    &quot;AR&quot; =&amp;gt; &quot;Arkansas&quot;&#xA;);&#xA;&#xA;foreach( $nakedOpts as $optval =&amp;gt; $label )&#xA;{&#xA;    // is this array item the selected value?&#xA;    $isSelected = ($value == $optval) ? true : false;&#xA;    // create a new object for each item&#xA;    $this-&amp;gt;options[] = new OptionData($label, $optval, $isSelected);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now we need to convert our field &lt;code&gt;$value&lt;/code&gt; to an object so Craft can compare it to the objects in the options list. Again, &lt;code&gt;SingleOptionFieldData&lt;/code&gt; accepts the parameters of &lt;code&gt;$label&lt;/code&gt;, &lt;code&gt;$value&lt;/code&gt;, and &lt;code&gt;$selected&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$value = new SingleOptionFieldData($nakedOpts[$value], $value, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;normalizeValue()&lt;/code&gt; method gets called once when the field is loaded on the publish page, and again when the entry is saved. So you have to check if you've already converted the &lt;code&gt;$value&lt;/code&gt; to an object and bypass the rest of the code if so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( $value instanceof SingleOptionFieldData ) &#xA;{&#xA;    return $value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The advantage of using a Craft object for this instead of a regular array is that Craft already knows how to use this type of data in the template. So the tag &lt;code&gt;{{ entry.region }}&lt;/code&gt; will output &lt;code&gt;AK&lt;/code&gt; without having to add the &lt;code&gt;.value&lt;/code&gt; attribute. And just like a native Craft dropdown field, you can get the label with &lt;code&gt;{{ entry.region.label }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To loop through all of your options in the template, just add this to &lt;code&gt;normalizeValue()&lt;/code&gt; after you've converted the &lt;code&gt;$value&lt;/code&gt; to an object and created your list of option objects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$value-&amp;gt;setOptions($this-&amp;gt;options);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can output a list of your options in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.region.options %}&#xA;    &amp;lt;option value=&quot;{{ option }}&quot;{% if option.selected %} selected{% endif %}&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2018-09-30T19:42:50.180" LastActivityDate="2018-09-30T19:42:50.180" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27869" PostTypeId="1" AcceptedAnswerId="27876" CreationDate="2018-09-28T23:01:29.370" Score="0" ViewCount="218" Body="&lt;p&gt;I'm trying to get the redactor onto my site. I've successfully moved over plugins from the store and a custom plugin I created. But I did those towards the start and had migrated the entire project onto the site. I don't want to move 4,000 files over just to get one plugin to show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried moving &lt;code&gt;composer.json&lt;/code&gt;, &lt;code&gt;composer.lock&lt;/code&gt;, and manually moving the specific vendor folder in as well. I also migrated the database from the dev site to the production site.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-09-30T03:53:22.873" Title="What files need to be moved for Craft3 plugins?" Tags="&lt;craft3&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27870" PostTypeId="2" ParentId="27855" CreationDate="2018-09-29T02:06:00.393" Score="1" Body="&lt;p&gt;We just had to do this and tried Freeform Pro and their Element Connection feature. It took a few minutes to build the whole thing including all the required emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://solspace.com/craft/freeform/docs/user-registration-forms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/user-registration-forms/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also - just noticed Craftquest has a free tutoarial on building user registration form using Freeform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftquest.io/courses/managing-forms-with-solspace-freeform/5246&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftquest.io/courses/managing-forms-with-solspace-freeform/5246&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5428" LastEditorUserId="5428" LastEditDate="2018-09-29T02:13:30.023" LastActivityDate="2018-09-29T02:13:30.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27871" PostTypeId="2" ParentId="27869" CreationDate="2018-09-29T19:41:57.163" Score="0" Body="&lt;p&gt;I hope I understand your question well. You can install Redactor editor directly from Plugin Store. After you can change files in vendor\craftcms\redactor\lib by some other Redactor version. &lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-09-29T19:41:57.163" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27872" PostTypeId="2" ParentId="27213" CreationDate="2018-09-29T20:57:08.583" Score="1" Body="&lt;p&gt;Going from Matthew's answer I went to my database and found the queue table. I had tried his way first but I had no task with a 0, all were null, and I wad one with a 1 in it already. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Matthew said, go to &lt;code&gt;phpMyAdmin &amp;gt; your database &amp;gt; queue&lt;/code&gt;, but rather than edit the information I used &lt;code&gt;TRUNCATE&lt;/code&gt; on the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went back to my site and it was fixed with, as far as I can tell, no issues. I went into utilities and did a clear cache and it successfully ran and finished.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did also up my &lt;code&gt;memory_limit&lt;/code&gt; in my php.ini file to 512M&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I was unsure if this method completely broke my site or not. It seems the answer was likely yes and no. Craft3 let me save an url for a section as &lt;code&gt;{parent}&lt;/code&gt; which is obviously going to cause issues eventually. It couldn't save because of that while working in the background. And if I went back it started new tasks but couldn't get past the first.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2018-09-30T18:55:04.983" LastActivityDate="2018-09-30T18:55:04.983" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27873" PostTypeId="1" AcceptedAnswerId="27875" CreationDate="2018-09-29T21:24:53.410" Score="1" ViewCount="259" Body="&lt;p&gt;This happens on every install (see below suggestions) via Composer on a MAMP Pro stack, running PHP 7.1, Mysql 5.7 &amp;amp; Composer 1.7.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Albeit suggestions, could this affect the performance or plugin compatibility of a base install?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server:lab user$ composer create-project craftcms/craft .&#xA;Installing craftcms/craft (1.0.36)&#xA;  - Installing craftcms/craft (1.0.36): Loading from cache&#xA;Created project in .&#xA;Loading composer repositories with package information&#xA;Updating dependencies (including require-dev)&#xA;Package operations: 50 installs, 0 updates, 0 removals&#xA;  - Installing craftcms/plugin-installer (1.5.2): Loading from cache&#xA;  - Installing yiisoft/yii2-composer (2.0.7): Loading from cache&#xA;  - Installing symfony/polyfill-ctype (v1.9.0): Loading from cache&#xA;  - Installing symfony/polyfill-mbstring (v1.9.0): Loading from cache&#xA;  - Installing twig/twig (v2.5.0): Loading from cache&#xA;  - Installing enshrined/svg-sanitize (0.9.0): Loading from cache&#xA;  - Installing danielstjules/stringy (3.1.0): Loading from cache&#xA;  - Installing zendframework/zend-stdlib (3.2.1): Loading from cache&#xA;  - Installing zendframework/zend-escaper (2.6.0): Loading from cache&#xA;  - Installing doctrine/lexer (v1.0.1): Loading from cache&#xA;  - Installing egulias/email-validator (2.1.6): Loading from cache&#xA;  - Installing swiftmailer/swiftmailer (v6.1.3): Loading from cache&#xA;  - Installing yiisoft/yii2-swiftmailer (2.1.2): Loading from cache&#xA;  - Installing symfony/process (v3.3.6): Loading from cache&#xA;  - Installing yiisoft/yii2 (2.0.15.1): Loading from cache&#xA;  - Installing yiisoft/yii2-debug (2.0.14): Loading from cache&#xA;  - Installing yiisoft/yii2-bootstrap (2.0.8): Loading from cache&#xA;  - Installing zendframework/zend-feed (2.10.3): Loading from cache&#xA;  - Installing craftcms/cms (3.0.25): Loading from cache&#xA;  - Installing yiisoft/yii2-queue (2.1.0): Loading from cache&#xA;  - Installing true/punycode (v2.1.1): Loading from cache&#xA;  - Installing seld/cli-prompt (1.0.3): Loading from cache&#xA;  - Installing pixelandtonic/imagine (v0.7.1.3): Loading from cache&#xA;  - Installing mikehaertl/php-shellcommand (1.4.1): Loading from cache&#xA;  - Installing paragonie/random_compat (v2.0.17): Loading from cache&#xA;  - Installing guzzlehttp/promises (v1.3.1): Loading from cache&#xA;  - Installing psr/http-message (1.0.1): Loading from cache&#xA;  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache&#xA;  - Installing guzzlehttp/guzzle (6.3.3): Loading from cache&#xA;  - Installing league/oauth2-client (2.3.0): Loading from cache&#xA;  - Installing league/flysystem (1.0.47): Loading from cache&#xA;  - Installing elvanto/litemoji (1.4.4): Loading from cache&#xA;  - Installing creocoder/yii2-nested-sets (0.9.0): Loading from cache&#xA;  - Installing craftcms/server-check (1.1.6): Loading from cache&#xA;  - Installing craftcms/oauth2-craftid (1.0.0.1): Loading from cache&#xA;  - Installing symfony/finder (v3.3.6): Loading from cache&#xA;  - Installing symfony/filesystem (v3.3.6): Loading from cache&#xA;  - Installing psr/log (1.0.2): Loading from cache&#xA;  - Installing symfony/debug (v3.3.6): Loading from cache&#xA;  - Installing symfony/console (v3.3.6): Loading from cache&#xA;  - Installing seld/phar-utils (1.0.1): Loading from cache&#xA;  - Installing seld/jsonlint (1.7.1): Loading from cache&#xA;  - Installing justinrainbow/json-schema (5.2.7): Loading from cache&#xA;  - Installing composer/spdx-licenses (1.4.0): Loading from cache&#xA;  - Installing composer/semver (1.4.2): Loading from cache&#xA;  - Installing composer/ca-bundle (1.1.2): Loading from cache&#xA;  - Installing composer/composer (1.6.3): Loading from cache&#xA;  - Installing cebe/markdown (1.1.2): Loading from cache&#xA;  - Installing ezyang/htmlpurifier (v4.10.0): Loading from cache&#xA;  - Installing vlucas/phpdotenv (v2.5.1): Loading from cache&#xA;zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component, for optionally caching feeds between requests)&#xA;zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component, for use with PubSubHubbub)&#xA;zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)&#xA;zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for easily extending ExtensionManager implementations)&#xA;zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent)&#xA;craftcms/cms suggests installing ext-imagick (Adds support for more image processing formats and options.)&#xA;yiisoft/yii2-queue suggests installing yiisoft/yii2-redis (Need for Redis queue.)&#xA;yiisoft/yii2-queue suggests installing pda/pheanstalk (Need for Beanstalk queue.)&#xA;yiisoft/yii2-queue suggests installing php-amqplib/php-amqplib (Need for AMQP queue.)&#xA;yiisoft/yii2-queue suggests installing enqueue/amqp-lib (Need for AMQP interop queue.)&#xA;yiisoft/yii2-queue suggests installing ext-gearman (Need for Gearman queue.)&#xA;yiisoft/yii2-queue suggests installing aws/aws-sdk-php (Need for aws SQS.)&#xA;pixelandtonic/imagine suggests installing ext-imagick (to use the Imagick implementation)&#xA;pixelandtonic/imagine suggests installing ext-gmagick (to use the Gmagick implementation)&#xA;paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)&#xA;league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)&#xA;league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)&#xA;league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)&#xA;league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)&#xA;league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)&#xA;league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)&#xA;league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)&#xA;league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)&#xA;league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)&#xA;league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)&#xA;league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)&#xA;symfony/console suggests installing symfony/event-dispatcher ()&#xA;Writing lock file&#xA;Generating optimized autoload files&#xA;&amp;gt; @php -r &quot;copy('.env.example', '.env');&quot;&#xA;&amp;gt; @php -r &quot;unlink('composer.json');&quot;&#xA;&amp;gt; @php -r &quot;unlink('LICENSE.md');&quot;&#xA;&amp;gt; @php -r &quot;unlink('README.md');&quot;&#xA;&amp;gt; @php -r &quot;rename('composer.json.default', 'composer.json');&quot;&#xA;Generating optimized autoload files&#xA;&amp;gt; @php craft setup/welcome&#xA;&#xA;   ______ .______          ___       _______ .___________.&#xA;  /      ||   _  \        /   \     |   ____||           |&#xA; |  ,----'|  |_)  |      /  ^  \    |  |__   `---|  |----`&#xA; |  |     |      /      /  /_\  \   |   __|      |  |&#xA; |  `----.|  |\  \----./  _____  \  |  |         |  |&#xA;  \______|| _| `._____/__/     \__\ |__|         |__|&#xA;&#xA;     A       N   E   W       I   N   S   T   A   L   L&#xA;               ______ .___  ___.      _______.&#xA;              /      ||   \/   |     /       |&#xA;             |  ,----'|  \  /  |    |   (----`&#xA;             |  |     |  |\/|  |     \   \&#xA;             |  `----.|  |  |  | .----)   |&#xA;              \______||__|  |__| |_______/&#xA;&#xA;&#xA;&#xA;Generating a security key ... done (iD6CQCDo8OEpF36qGnPPcylYpCI9gGz6)&#xA;&#xA;Welcome to Craft CMS! Run the following command if you want to setup Craft from your terminal:&#xA;&#xA;    ~/Studio/clients/lab/craft setup&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5113" LastActivityDate="2018-09-30T03:48:42.097" Title="Install suggestions?" Tags="&lt;install&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27874" PostTypeId="2" ParentId="27799" CreationDate="2018-09-29T22:54:40.893" Score="0" Body="&lt;p&gt;I figured out what was wrong, though I'm confused on why some of it was working fine... Maybe if it broke more fully I would have found it easier, haha. Mats was right, it was the Base URL in the Sites area of the admin control panel. I had entered @web/es thinking that I want it to be the root of the primary site, but that wasn't correct, I needed to just put @web/ because I already told it that it lived at /es through the index.php of that site folder.   &lt;/p&gt;&#xA;" OwnerUserId="8456" LastActivityDate="2018-09-29T22:54:40.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27875" PostTypeId="2" ParentId="27873" CreationDate="2018-09-30T03:48:42.097" Score="0" Body="&lt;p&gt;I'm guessing you mean the &lt;code&gt;suggests installing&lt;/code&gt; part? If so, these are just optional packages that add optional features. I wouldn't sweat it, especially in local dev.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-30T03:48:42.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27876" PostTypeId="2" ParentId="27869" CreationDate="2018-09-30T03:53:22.873" Score="3" Body="&lt;p&gt;So you're really close; &lt;code&gt;composer.json&lt;/code&gt; is a list of packages and their &lt;a href=&quot;https://getcomposer.org/doc/articles/versions.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;semvers&lt;/a&gt; that should be installed. &lt;code&gt;composer.lock&lt;/code&gt; has a manifest of what is &lt;em&gt;actually&lt;/em&gt; installed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to deploy to production, you just need a step that executes &lt;code&gt;composer install&lt;/code&gt; to install what is in the &lt;code&gt;composer.lock&lt;/code&gt; file. Check out the &lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deploying Craft CMS&lt;/a&gt; section of this article for a more thorough run-through.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-09-30T03:53:22.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27877" PostTypeId="1" CreationDate="2018-09-30T12:01:23.240" Score="1" ViewCount="71" Body="&lt;p&gt;I have upgraded redactor 2 to redactor 3, since a lot of things had to be changed. Been fixing those and it works well. I have a problem with image manager plugin which doesn't show up in the toolbar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Needed a help immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8856" LastActivityDate="2018-10-31T00:01:03.283" Title="Imagemanager plugin doesn't show up in toolbar" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27879" PostTypeId="1" AcceptedAnswerId="27880" CreationDate="2018-09-30T15:50:10.093" Score="1" ViewCount="72" Body="&lt;p&gt;Similar to this issue &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16567/render-styled-output-using-printmaker-plugin&quot;&gt;Render styled output using Printmaker plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having the same issue and can't seem to figure out how to style the PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code to generate the PDF:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set html %}&#xA;        {% include '_includes/_pdf/social.twig' %}&#xA;    {% endset %}&#xA;&#xA;    {% set pdfUrl = craft.printmaker.pdfFromHtml(html).url %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ pdfUrl }}&quot; target=&quot;_blank&quot;&amp;gt;Print Page&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This opens the PDF in a separate tab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I am loading &lt;code&gt;pdf.css&lt;/code&gt; into the head of &lt;code&gt;_includes/_pdf/social.twig&lt;/code&gt; but the PDF is not styled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&amp;gt;&#xA;    &amp;lt;head&amp;gt;&#xA;        &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&#xA;        &amp;lt;title&amp;gt;PDF Template&amp;lt;/title&amp;gt;&#xA;        &amp;lt;link href=&quot;pdf.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt;&#xA;    &amp;lt;/head&amp;gt;&#xA;    &amp;lt;body&amp;gt;&#xA;&#xA;        // PDF HTML&#xA;&#xA;    &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is my directory structure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_includes&#xA;    _pdf&#xA;        pdf.css&#xA;        social.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to style the PDF this way or do I need to use &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag or inline styles?&lt;/p&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2018-09-30T16:53:53.187" Title="Trying to style Printmaker Plugin PDF by linking css in head of PDF template" Tags="&lt;craft2&gt;&lt;plugin-printmaker&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27880" PostTypeId="2" ParentId="27879" CreationDate="2018-09-30T16:53:53.187" Score="1" Body="&lt;p&gt;You can link to the CSS in this way, but if it's not working for you then try changing the path to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link href=&quot;./pdf.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;assuming that your CSS is in the site root.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-09-30T16:53:53.187" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27882" PostTypeId="2" ParentId="27877" CreationDate="2018-09-30T23:18:45.817" Score="2" Body="&lt;p&gt;The redactor toolbar can be configured in yourprojectfolder\config\redactor\ and you can choose the toolbar type when you configure your Field. By default, there is Standard.json file, where is the image toolbar button. For example, in menu Settings -&gt; Fields create a new Field named Text, set Field Type to Redactor and now you can select in Redactor Config the Standard toolbar. I hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-09-30T23:18:45.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27883" PostTypeId="2" ParentId="27769" CreationDate="2018-10-01T05:17:33.613" Score="1" Body="&lt;p&gt;I think the answer is &quot;no&quot;. There is no config or existing plugin that adds the debugging information I want.&lt;/p&gt;&#xA;" OwnerUserId="8781" LastActivityDate="2018-10-01T05:17:33.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27884" PostTypeId="1" CreationDate="2018-10-01T07:52:47.270" Score="1" ViewCount="73" Body="&lt;p&gt;is there a plugin or script to import products, accounts, categories from Magento to Craft Commerce?&#xA;Or is this something to be written from scratch with FeedMe?&lt;/p&gt;&#xA;" OwnerUserId="8858" LastActivityDate="2018-10-31T10:00:29.147" Title="import store items from Magento to Craft Commerce" Tags="&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27885" PostTypeId="2" ParentId="27884" CreationDate="2018-10-01T09:05:57.787" Score="1" Body="&lt;p&gt;I don't think there's a plugin that does this. However, I would like to point you to a talk by James Greig that happened last Friday, in which he explains a number of possible ways to migrate content from X to Craft. He too uses FeedMe to do the import part, but has a few approaches to exporting the content on the other side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.greig.cc/dotall2018&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.greig.cc/dotall2018&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-10-01T09:05:57.787" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27886" PostTypeId="1" CreationDate="2018-10-01T09:26:35.820" Score="1" ViewCount="342" Body="&lt;p&gt;I’m building a webshop with Craft Commerce where customers will be able to customize/personalize parts of clothes based on a predefined set of options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a pullover for example, customers should be able to change material, color and prints of the body, sleeves and cuffs individually. The different options are individual products themselves and have their own stock information. So the product bought by the customer will be composed of several product variants for different parts of the pullover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Woo Commerce for example there is a Composite Products Plugin, that seems like a solution to this: &lt;a href=&quot;https://woocommerce.com/products/composite-products/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://woocommerce.com/products/composite-products/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a similar plugin for Craft Commerce, that would help me with building this feature? Or is there another way of solving this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="879" LastActivityDate="2018-10-31T16:00:43.400" Title="Custom-created or personalized products with Craft Commerce?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27887" PostTypeId="2" ParentId="27886" CreationDate="2018-10-01T09:36:52.413" Score="1" Body="&lt;p&gt;I don't think there is a plugin for this, so the only way to solve this would be to build the plugin for this yourself, if you have the skills or resources for this. It could be solved by creating a purchasable with (optional) relations to all the products needed, checking the stock of those products on adding it to the basket, and/or on checkout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would start with, though, is creating an issue on &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commerce's Github&lt;/a&gt;, to see if others have a need for this and hope that Pixel &amp;amp; Tonic's crew will do it for you ;)&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-10-01T09:36:52.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27888" PostTypeId="2" ParentId="27853" CreationDate="2018-10-01T09:45:27.100" Score="1" Body="&lt;p&gt;The way &lt;code&gt;craft()-&amp;gt;request-&amp;gt;sendFile&lt;/code&gt; works, is that it responds to the HTTP(S) request by sending your file of choice to the browsers. As you can only return one answer to an HTTP request, you'd have to first redirect people to a confirmation page. On that page, you could have a download button, and use some Javascript to force the download to take place on page load or short thereafter. Don't leave the button out, as not everyone has JS enabled.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-10-01T09:45:27.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27891" PostTypeId="2" ParentId="27886" CreationDate="2018-10-01T15:32:06.340" Score="1" Body="&lt;p&gt;You shouldn't need a plugin at all. Commerce provides the ability to add &lt;a href=&quot;https://github.com/craftcms/commerce-docs/blob/eaa6649bb3a88f172d097a1d3a23d30bb5462f80/en/adding-to-and-updating-the-cart.md#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom options&lt;/a&gt; for each line item in your add to cart form.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2018-10-01T15:32:06.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27892" PostTypeId="1" CreationDate="2018-10-01T22:24:09.400" Score="0" ViewCount="59" Body="&lt;p&gt;Im trying to setup my Web master tools for my site, but i'm not sure where to place the html file google provides:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HP9qi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HP9qi.png&quot; alt=&quot;Web Master Tools&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v45RC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v45RC.png&quot; alt=&quot;Craft Folder Structure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the 5 main folders root but with no success. Also in the craft's root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ANy advise on where should I put this code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advanced...&lt;/p&gt;&#xA;" OwnerUserId="8861" LastActivityDate="2018-10-02T07:15:18.600" Title="Where to place Webmaster Tools HTML File on CRAFT CMS?" Tags="&lt;analytics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27893" PostTypeId="2" ParentId="27892" CreationDate="2018-10-02T07:15:18.600" Score="2" Body="&lt;p&gt;You should place it in your public folder (may have a different name on your server) not in your Craft folder. The folder where all files (such as your assets) live in that are publicly accessible on your webserver.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-10-02T07:15:18.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27896" PostTypeId="1" CreationDate="2018-10-02T09:19:54.277" Score="1" ViewCount="217" Body="&lt;p&gt;If I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cacheKey = block.id %}&#xA;{% cache using key cacheKey if craft.app.config.general.cache %}&#xA;    {% for item in items %}&#xA;&#xA;        &amp;lt;div class=&quot;swiper-slide ais-hits--item&quot; data-id=&quot;{{ item.id }}&quot;&amp;gt;&#xA;&#xA;            {% set object = (block.contentType == 'events') ? item.show.one : item %}&#xA;&#xA;            {% include '_blocks/blockCard/blockCard' with {&#xA;                content: object,&#xA;                blockId: block.id&#xA;            } %}&#xA;&#xA;            {% include '_blocks/blockCardPreview/blockCardPreview' with {&#xA;                content: object,&#xA;                blockId: block.id&#xA;            } %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an error saying &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PHP Warning – yii\base\ErrorException&lt;/strong&gt;&#xA;Error while sending QUERY packet. PID=881&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;code&gt;using key cacheKey&lt;/code&gt; part it works. But of course al the sliders have the same content.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-10-02T09:19:54.277" Title="Error while sending QUERY packet. PID=881 when using cache key" Tags="&lt;cache&gt;&lt;forloop&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27897" PostTypeId="1" AcceptedAnswerId="27900" CreationDate="2018-10-02T09:34:06.457" Score="1" ViewCount="383" Body="&lt;p&gt;We are trying to setup a second language. We've gone through the steps and created a second website, we defined the base URL as @web/de for the second language (German). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The deeper sections are working fine (e.g. www.url.com/de/kontakt). However we can't get the second homepage to work on the URL www.url.com/de. We get a 403 access denied from nginx. We followed all the steps in the documentation (&lt;a href=&quot;https://docs.craftcms.com/v3/localization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/localization.html&lt;/a&gt;), but can't get it to work. I assume we are missing something or forgot to do something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The homepage is a single. In sections, we have left the URI blank for both, the default english site as well as the german site. The template is the same for both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a dev environment, we are using Local by Flywheel on a local workstation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some screenshots of our configuration:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KPw6L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KPw6L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Site overview:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/k8x3z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k8x3z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8863" LastEditorUserId="8863" LastEditDate="2018-10-02T11:57:16.477" LastActivityDate="2018-10-02T11:57:16.477" Title="403 Error on homepage of second language" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;multi-site&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27898" PostTypeId="1" AcceptedAnswerId="27930" CreationDate="2018-10-02T09:47:44.437" Score="1" ViewCount="388" Body="&lt;p&gt;I am coming to Craft from Perch Runway so am trying to work out how to replicate some functionality from one to the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Runway any form submissions, as well as being emailed to specified addresses, are stored on the database and viewable through the admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have installed the Contact Forms plugin for Craft (&lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt;) and was wondering if there is a way to do the same thing with this? Or do I need to look at another plugin / some custom functionality for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a helpful feature as emails are sometimes missed / fail to deliver etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2021-04-13T11:56:10.700" Title="Store Contact Form submissions" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27899" PostTypeId="1" AcceptedAnswerId="27903" CreationDate="2018-10-02T10:12:24.650" Score="0" ViewCount="225" Body="&lt;p&gt;I just noticed that on a site we launched a month ago, the templatecachequeries table is now 500mb. I'm only using the {% cache %} tag in one place on the site, around the main content matrix field. There are about 52000 rows in the templatecachequeries table now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've cleared the caches from Utilities, and I've re-saved all the sections but the rows are all still there. Are these meant to get deleted at some point? Is it safe to delete the rows?&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2018-10-02T11:21:39.063" Title="How do you clear the templatecachequeries table?" Tags="&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27900" PostTypeId="2" ParentId="27897" CreationDate="2018-10-02T10:47:07.357" Score="1" Body="&lt;p&gt;Did you define the the locale url in your config?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;.env&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SITE_URL_DE=&quot;@web&quot;&#xA;SITE_URL_EN=&quot;@web/en&quot;&#xA;SITE_URL_FR=&quot;@web/fr&quot;&#xA;SITE_URL_IT=&quot;@web/it&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Global settings&#xA;  '*' =&amp;gt; [&#xA;    'siteUrl' =&amp;gt; [&#xA;        'siteDe' =&amp;gt; getenv('SITE_URL_DE'),&#xA;        'siteFr' =&amp;gt; getenv('SITE_URL_FR'),&#xA;        'gsiteEn' =&amp;gt; getenv('SITE_URL_EN'),&#xA;        'siteIt' =&amp;gt; getenv('SITE_URL_IT'),&#xA;    ],&#xA;  ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can use those as your base URL's:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DLV0M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DLV0M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2018-10-02T10:47:07.357" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="27901" PostTypeId="2" ParentId="27898" CreationDate="2018-10-02T10:52:39.410" Score="1" Body="&lt;p&gt;Yeah. The contact-form plugin of craft is rather &lt;code&gt;rough&lt;/code&gt; around the edges. I especially miss a error-handling. The form plugin just fails silently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a replacement I'd go for&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;AM Forms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://solspace.com/craft/freeform/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sospace's Freeform&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="162" LastActivityDate="2018-10-02T10:52:39.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27902" PostTypeId="2" ParentId="4165" CreationDate="2018-10-02T11:13:00.587" Score="1" Body="&lt;p&gt;Unfortunately, the Craft devs have not made this as easy as it should be. Luckily, we can utilize that it's built on Yii2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following solution makes &lt;code&gt;fromName&lt;/code&gt;required, and are compatible with &lt;strong&gt;Contact Form Extensions&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Make a new folder inside &lt;code&gt;modules&lt;/code&gt; and call it &lt;code&gt;contact_form&lt;/code&gt;.&#xA;Create the following file structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;modules\&#xA;  contact_form\&#xA;    controllers\&#xA;      SendController.php&#xA;    models\&#xA;      Submission.php&#xA;    Module.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And enter the following into the files:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SendController.php&lt;/strong&gt; (This is almost an exact copy of &lt;code&gt;craft\contactform\controllers&lt;/code&gt;, but we're pointing it to our own Submission model)&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\contact_form\controllers;&#xA;&#xA;use Craft;    &#xA;use modules\contact_form\models\Submission;&#xA;use craft\contactform\Plugin;&#xA;use craft\web\UploadedFile;&#xA;use yii\web\Response;&#xA;&#xA;class SendController extends \craft\contactform\controllers\SendController&#xA;{&#xA;&#xA;    public function actionIndex()&#xA;    {&#xA;        $this-&amp;gt;requirePostRequest();&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;        $plugin = Plugin::getInstance();&#xA;        $settings = $plugin-&amp;gt;getSettings();&#xA;&#xA;        $submission = new Submission();&#xA;        $submission-&amp;gt;fromEmail = $request-&amp;gt;getBodyParam('fromEmail');&#xA;        $submission-&amp;gt;fromName = $request-&amp;gt;getBodyParam('fromName');&#xA;        $submission-&amp;gt;subject = $request-&amp;gt;getBodyParam('subject');&#xA;&#xA;        $message = $request-&amp;gt;getBodyParam('message');&#xA;        if (is_array($message)) {&#xA;            $submission-&amp;gt;message = array_filter($message, function($value) {&#xA;                return $value !== '';&#xA;            });&#xA;        } else {&#xA;            $submission-&amp;gt;message = $message;&#xA;        }&#xA;&#xA;        if ($settings-&amp;gt;allowAttachments &amp;amp;&amp;amp; isset($_FILES['attachment']) &amp;amp;&amp;amp; isset($_FILES['attachment']['name'])) {&#xA;            if (is_array($_FILES['attachment']['name'])) {&#xA;                $submission-&amp;gt;attachment = UploadedFile::getInstancesByName('attachment');&#xA;            } else {&#xA;                $submission-&amp;gt;attachment = [UploadedFile::getInstanceByName('attachment')];&#xA;            }&#xA;        }&#xA;&#xA;        if (!$plugin-&amp;gt;getMailer()-&amp;gt;send($submission)) {&#xA;            if ($request-&amp;gt;getAcceptsJson()) {&#xA;                return $this-&amp;gt;asJson(['errors' =&amp;gt; $submission-&amp;gt;getErrors()]);&#xA;            }&#xA;&#xA;            Craft::$app-&amp;gt;getSession()-&amp;gt;setError(Craft::t('contact-form', 'There was a problem with your submission, please check the form and try again!'));&#xA;            Craft::$app-&amp;gt;getUrlManager()-&amp;gt;setRouteParams([&#xA;            'variables' =&amp;gt; ['message' =&amp;gt; $submission]&#xA;            ]);&#xA;&#xA;            return null;&#xA;        }&#xA;&#xA;        if ($request-&amp;gt;getAcceptsJson()) {&#xA;            return $this-&amp;gt;asJson(['success' =&amp;gt; true]);&#xA;        }&#xA;&#xA;        Craft::$app-&amp;gt;getSession()-&amp;gt;setNotice($settings-&amp;gt;successFlashMessage);&#xA;        return $this-&amp;gt;redirectToPostedUrl($submission);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Submission.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\contact_form\models;&#xA;&#xA;class Submission extends \craft\contactform\models\Submission&#xA;{&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function rules()&#xA;    {&#xA;        return [&#xA;            [['fromEmail', 'message', 'fromName'], 'required'],&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Module.php&lt;/strong&gt;&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Module extends \yii\base\Module&#xA;{&#xA;    public function init()&#xA;    {&#xA;        $this-&amp;gt;controllerNamespace = 'modules\\contact_form\\controllers';&#xA;        parent::init();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;config\app.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update to include your module:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'modules' =&amp;gt; [&#xA;        ...&#xA;        'contact' =&amp;gt; \modules\contact_form\Module::class&#xA;        ...&#xA;    ],&#xA;    ...&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your view&lt;/strong&gt;&#xA;And finally update your form code to use your new controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact/send&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8864" LastActivityDate="2018-10-02T11:13:00.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27903" PostTypeId="2" ParentId="27899" CreationDate="2018-10-02T11:21:39.063" Score="0" Body="&lt;p&gt;&lt;strike&gt;You can clear the cache from within the settings section of the control panel. It's possible to select which specific caches to clear if necessary.&lt;/strike&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try manually clearing the cache tables. Test it on a backup first but I have done this in the past with no ill effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you need to be adding the &quot;globally&quot; keyword to your cache tags. This will drastically reduce the number of rows in the cache table and most likely speed things up too.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-10-02T11:21:39.063" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27904" PostTypeId="1" AcceptedAnswerId="27906" CreationDate="2018-10-02T11:21:45.900" Score="1" ViewCount="711" Body="&lt;p&gt;The following outputs all sections and their entry types, but I'm struggling to work out how I output only the entry types from the &quot;blog&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for section in craft.app.sections.allSections() %}&#xA;  &amp;lt;h2&amp;gt;{{ section.name }}&amp;lt;/h2&amp;gt;&#xA;&#xA;  &amp;lt;ul&amp;gt;&#xA;    {% for type in section.getEntryTypes() %}&#xA;      &amp;lt;li&amp;gt;{{ type.name }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/ul&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought this would work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for type in craft.entries.section('blog').getEntryTypes() %}&#xA;  &amp;lt;p&amp;gt;{{ type.name }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I've hit a wall because &lt;code&gt;getEntryTypes()&lt;/code&gt; is an unknown method.&lt;/p&gt;&#xA;" OwnerUserId="8865" LastActivityDate="2018-10-02T12:25:41.843" Title="How can I list Entry Types of a single Section?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;sections&gt;&lt;entry-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27905" PostTypeId="1" CreationDate="2018-10-02T11:40:50.427" Score="1" ViewCount="81" Body="&lt;p&gt;I've set up a custom redactor .json file which works and shows up on the dropdown, however, whenever I'm selecting one of the options the text in the field isn't updating to the chosen style.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attached some images so you can see what I mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XjWjt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XjWjt.png&quot; alt=&quot;JSON of custom redactor type&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rzD1j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rzD1j.png&quot; alt=&quot;CraftCMS redactor dropdown with options shown&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l6628.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l6628.png&quot; alt=&quot;highlighted lorem ipsum text in a span tag with a class of red&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4HQYP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4HQYP.png&quot; alt=&quot;lorem ipsum text&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It works on the front end but I'm a little puzzled why it's not showing on this side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first time I've done custom redactor options before so I could've potentially missed a step on getting it to work? I've had a look in the docs and couldn't find what I was looking for so any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="8327" LastActivityDate="2018-10-02T11:40:50.427" Title="Redactor customisation not showing in Redactor text field" Tags="&lt;craft3&gt;&lt;redactor&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27906" PostTypeId="2" ParentId="27904" CreationDate="2018-10-02T12:25:41.843" Score="3" Body="&lt;p&gt;You're close – this should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blogSection = craft.app.sections.getSectionByHandle('blog') %}&#xA;{% set blogSectionEntryTypes = blogSection.getEntryTypes() %}&#xA;&#xA;{% for entryType in blogSectionEntryTypes %}&#xA;    &amp;lt;p&amp;gt;{{ entryType.name }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason why &lt;code&gt;craft.entries.section('blog').getEntryTypes()&lt;/code&gt; didn't work is that &lt;code&gt;craft.entries&lt;/code&gt; will actually create an &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQuery&lt;/a&gt;, which is used to query for elements (e.g. entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you use &lt;code&gt;craft.app.sections&lt;/code&gt; or &lt;code&gt;craft.app.getSections()&lt;/code&gt; (it doesn't really matter which variant you use, although the latter is a micro-optimisation in terms of performance) you're interacting with the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-sections.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sections service&lt;/a&gt;, which is what you need to use to work with sections and their entry types directly, rather than entries.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2018-10-02T12:25:41.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27907" PostTypeId="1" AcceptedAnswerId="27910" CreationDate="2018-10-02T12:53:16.993" Score="1" ViewCount="520" Body="&lt;p&gt;I saw how I can change system language (CP) after installation in Craft 2, but I can't find how to do it in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8862" LastEditorUserId="57" LastEditDate="2018-10-06T18:15:51.810" LastActivityDate="2018-10-06T18:15:51.810" Title="How can I change CP language in Craft 3 after installation?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27908" PostTypeId="2" ParentId="27907" CreationDate="2018-10-02T12:58:21.983" Score="1" Body="&lt;p&gt;Go to settings &gt; sites, there you can change it.&lt;/p&gt;&#xA;" OwnerUserId="6388" LastActivityDate="2018-10-02T12:58:21.983" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27909" PostTypeId="1" AcceptedAnswerId="27913" CreationDate="2018-10-02T12:59:55.683" Score="1" ViewCount="55" Body="&lt;p&gt;Using Craft::Pro Edition, I want to add a specific UserGroup to an existing User in my module. I tried it this way, but the group is not saved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userGroup = Craft::$app-&amp;gt;userGroups-&amp;gt;getGroupByHandle('partner');&#xA;$user-&amp;gt;setGroups([$userGroup]);&#xA;$success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After (successful) saveElement(), $user-&gt;getGroups() still returns an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I add the group in the Admin CP, it works, but it needs a password confirmation. &lt;/p&gt;&#xA;" OwnerUserId="8772" LastActivityDate="2018-10-02T20:08:27.750" Title="Set UserGroups for existing User" Tags="&lt;craft-pro&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27910" PostTypeId="2" ParentId="27907" CreationDate="2018-10-02T14:55:03.817" Score="3" Body="&lt;p&gt;The language of CP depends on user. Therefore, you have to set Users -&gt; admin -&gt; Preferences and set prefered language.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-02T14:55:03.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27911" PostTypeId="2" ParentId="27769" CreationDate="2018-10-02T15:54:02.377" Score="9" Body="&lt;p&gt;So this sounded like a fun problem to solve... so I wrote the &lt;a href=&quot;https://github.com/nystudio107/craft-templatecomments&quot; rel=&quot;noreferrer&quot;&gt;Template Comments&lt;/a&gt; plugin that does what you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This free plugin adds a HTML comment to demarcate &lt;code&gt;{% block %}&lt;/code&gt;s and each Twig template that is included or extended.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-02T15:54:02.377" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27912" PostTypeId="1" AcceptedAnswerId="27917" CreationDate="2018-10-02T18:27:45.750" Score="0" ViewCount="440" Body="&lt;p&gt;I'm trying to use the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager-Craft&lt;/a&gt; plugin to make specific image transformations, but cannot figure out how to access Imager within the &lt;code&gt;element-api.php&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imager shows plenty of template examples, but I'm not sure how to translate template code like this into straight Element API php.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set image = craft.assets().one() %}&#xA;{% set transformedImage = craft.imager.transformImage(image, { width: 1000 }) %}&#xA;&amp;lt;img src=&quot;{{ transformedImage.url }}&quot;&amp;gt;```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Specifically, I'm trying to access that &lt;code&gt;craft.imager.transformImage&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2018-10-02T19:22:18.067" LastActivityDate="2018-10-03T09:04:26.290" Title="Use Imager plugin with Element API?" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;plugin-imager&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27913" PostTypeId="2" ParentId="27909" CreationDate="2018-10-02T20:08:27.750" Score="3" Body="&lt;p&gt;You can assign a user to certain groups via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($user-&amp;gt;id, [1,2,3]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would assign them to the groups with the ids 1, 2 and 3&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-02T20:08:27.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27914" PostTypeId="1" CreationDate="2018-10-02T20:13:39.477" Score="1" ViewCount="24" Body="&lt;p&gt;When I try to arrange some entry field in the CP's sort and display panel, the panel does not show all the fields in the server version, while it display all the fields in my local version. Although, all the fields are in sync between the two databases.&#xA;How can I get all the fields back in the panel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZZLuZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZZLuZ.png&quot; alt=&quot;Here the sort and display panel in my local machine&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OeH4T.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OeH4T.png&quot; alt=&quot;Here the sort and display panel in my server machine for the very same entry&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8869" LastEditorUserId="8869" LastEditDate="2018-10-03T06:51:24.993" LastActivityDate="2018-10-03T06:51:24.993" Title="Sort and display panel in CP does not show all the fields" Tags="&lt;control-panel&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27915" PostTypeId="1" AcceptedAnswerId="28018" CreationDate="2018-10-02T21:15:33.373" Score="1" ViewCount="183" Body="&lt;p&gt;I'm using CKEditor as one of my fields, I'm trying to detect if there is any content within them, unfortunately it's still appearing even using the below code (and the field is actually empty).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.formal is empty %}&#xA;&#xA;{% else %}&#xA;&amp;lt;dl class=&quot;row&quot;&amp;gt;&#xA;  &amp;lt;dt class=&quot;col-sm-3&quot;&amp;gt;Description lists&amp;lt;/dt&amp;gt;&#xA;  &amp;lt;dd class=&quot;col-sm-9&quot;&amp;gt;{{ entry.formal }}&amp;lt;/dd&amp;gt;&#xA;&amp;lt;/dl&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-11-07T13:37:10.203" Title="CKEditor Null Value" Tags="&lt;templating&gt;&lt;ckeditor5&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27916" PostTypeId="2" ParentId="27912" CreationDate="2018-10-02T21:33:43.463" Score="0" Body="&lt;p&gt;I was able to find a working solution, but really not sure if this is the best way use a plugin in the Element API.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(Entry $entry) {&#xA;&#xA;    $imager = new aelvan\imager\services\ImagerService();&#xA;    $image  = $entry-&amp;gt;image-&amp;gt;one();&#xA;&#xA;    $resizedImage = $imager-&amp;gt;transformImage($image, [&#xA;        'width' =&amp;gt; 100&#xA;    ]);&#xA;&#xA;    return [&#xA;        'image' =&amp;gt; $resizedImage-&amp;gt;url&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="64" LastActivityDate="2018-10-02T21:33:43.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27917" PostTypeId="2" ParentId="27912" CreationDate="2018-10-03T09:04:26.290" Score="3" Body="&lt;p&gt;In yii2 every instance of a module is stored in a public static property of the main class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the plugin is called image you can grab it via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Imager::getInstance()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This instance contains all the required components. The imager plugin it has 3 &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/blob/craft3/src/Imager.php#L108&quot; rel=&quot;nofollow noreferrer&quot;&gt;components&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;setComponents([&#xA;    'imager' =&amp;gt; ImagerService::class,&#xA;    'placeholder' =&amp;gt; PlaceholderService::class,&#xA;    'color' =&amp;gt; ImagerColorService::class,&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can access those via &lt;code&gt;Imager::getInstance()-&amp;gt;imager&lt;/code&gt; or &lt;code&gt;placeholder&lt;/code&gt; or &lt;code&gt;color&lt;/code&gt; in this case the instance of the plugin is also stored in a static &lt;code&gt;$plugin&lt;/code&gt; variable. You can call &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Imager::$plugin-&amp;gt;imager&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as well. You can see a working example &lt;a href=&quot;https://github.com/aelvan/Imager-Craft/blob/craft3/src/variables/ImagerVariable.php#L307&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use aelvan\imager\Imager as Plugin;&#xA;.... &#xA;return Plugin::$plugin-&amp;gt;imager-&amp;gt;isAnimated($asset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft/blob/craft3/src/variables/ImagerVariable.php#L35&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is the function that is being called when you do &lt;code&gt;craft.imager.transform&lt;/code&gt; -&gt; the PHP equivalent what you want to do&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-03T09:04:26.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27919" PostTypeId="1" AcceptedAnswerId="28005" CreationDate="2018-10-03T12:14:21.447" Score="2" ViewCount="538" Body="&lt;p&gt;Using this snippet returns me 38 queries on my homepage without the Eager Beaver plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.elements.eagerLoadElements(&#xA;    className(entry),&#xA;    [entry],&#xA;    ['headerImage', 'image1', 'image2']&#xA;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without the above loading all three images with &lt;code&gt;.one()&lt;/code&gt; gives me 33 queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behavior or am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="6098" LastEditorUserId="6098" LastEditDate="2018-10-04T12:38:37.453" LastActivityDate="2018-10-10T07:53:31.487" Title="Eager loading on entry not reducing queries" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;image&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="27920" PostTypeId="1" AcceptedAnswerId="27921" CreationDate="2018-10-03T12:27:52.850" Score="0" ViewCount="281" Body="&lt;p&gt;I have a custom data table PA in the Craft database. I create a craft\db\ActiveRecord model and I want load() and save() data to it. The result will be custom GridView table with CRUD in front end combined with cms pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I call $model-&gt;save() it throws Exception:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dateUpdated' in 'field list'&#xA;&#xA;The SQL being executed was: UPDATE `PA` SET `background`='#ffff00', `dateUpdated`='2018-10-03 11:50:26' &#xA;WHERE `idPA`=17&#xA;Error Info: Array&#xA;(&#xA;[0] =&amp;gt; 42S22&#xA;[1] =&amp;gt; 1054&#xA;[2] =&amp;gt; Unknown column 'dateUpdated' in 'field list'&#xA;)&#xA;&#xA;Caused by: PDOException&#xA;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dateUpdated' in 'field list'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the difference between craft\db\ActiveRecord and yii\db\ActiveRecord? Is there any recommendation how to use it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-03T12:42:21.710" Title="Does Craft ActiveRecord require any special table column (dateUpdated, dateCreated,...)?" Tags="&lt;plugin-development&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27921" PostTypeId="2" ParentId="27920" CreationDate="2018-10-03T12:42:21.710" Score="3" Body="&lt;p&gt;The only difference between Craft and Yii active records are the columns &lt;code&gt;dateCreated&lt;/code&gt;, &lt;code&gt;dateUpdated&lt;/code&gt; and &lt;code&gt;uid&lt;/code&gt; if you have these columns you should extend Crafts &lt;code&gt;ActiveRecord&lt;/code&gt; since it's &lt;code&gt;save&lt;/code&gt; function adds compability to those columns otherwise  just use Yii2 &lt;code&gt;ActiveRecord&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-03T12:42:21.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27922" PostTypeId="1" CreationDate="2018-10-03T12:47:23.707" Score="0" ViewCount="72" Body="&lt;p&gt;I have 3 channels: Reviews, Products and UseCases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the section &quot;Reviews&quot; an entry has a list of &quot;Products&quot;, based on a matrix field. Every block in this matrix field represents one listed &quot;Product&quot;. The block contains of two entries (relationship) fields one to an entry of the Products channel and another one to an entry of the UseCases channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question: Based on this setup, is it possible to query all Products with relation to a UseCase? (I am struggling because there is no direct relationship but only an indirect one via a Matrix block.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am in general relatively familiar with Craft CMS, but unfortunately not on that level of complexity, therefore I am very happy to get your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="517" LastActivityDate="2018-10-03T12:47:23.707" Title="Indirect Relationship defined in Matrix Block" Tags="&lt;matrix&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27923" PostTypeId="1" AcceptedAnswerId="28457" CreationDate="2018-10-03T13:07:34.110" Score="2" ViewCount="198" Body="&lt;p&gt;Per &lt;a href=&quot;https://craftcms.stackexchange.com/a/21986/5072&quot;&gt;this answer&lt;/a&gt;, configuring &lt;code&gt;defaultTokenDuration&lt;/code&gt; is the way to change the lifespan of hidden entries' share links from the default 24 hours. The v2 docs describes this as affecting &quot;system tokens&quot; but no further explanation of system tokens is provided. The v3 docs refers simply to &quot;tokens.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[edit: I believe one other thing this controls is the lifespan of password reset tokens.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to increase the lifespan of draft entries' share links, but wonder what other consequences I should take into account before changing &lt;code&gt;defaultTokenDuration&lt;/code&gt;. What all does it affect?&lt;/p&gt;&#xA;" OwnerUserId="5072" LastEditorUserId="5072" LastEditDate="2018-11-16T15:27:30.613" LastActivityDate="2018-11-17T01:16:47.890" Title="What does defaultTokenDuration affect besides hidden entries' share links?" Tags="&lt;config&gt;&lt;token&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27926" PostTypeId="2" ParentId="1774" CreationDate="2018-10-03T16:31:20.067" Score="7" Body="&lt;p&gt;If you're looking for a &lt;strong&gt;Craft 3&lt;/strong&gt; solution, I just got this set up on a project and hope it helps someone else out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you'll need to add a custom field to your form.  If you want your user to choose which field, then go with a dropdown or radio button and adjust the plugin logic below. My scenario required me using a hidden field and auto-filling in the value based on a query parameter in the url.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;myHiddenInput&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your custom plugin's primary class, &lt;code&gt;use&lt;/code&gt; this service at the top of your file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\services\Users;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then in the &lt;code&gt;init()&lt;/code&gt; function add this event and adjust the code to your liking:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_AFTER_ASSIGN_USER_TO_DEFAULT_GROUP,&#xA;    function(UserAssignGroupEvent $event) {&#xA;&#xA;        // get your hidden input value, 1 for true, 0 for false&#xA;        $isInDifferentGroup = Craft::$app-&amp;gt;getRequest()-&amp;gt;post('myHiddenInput');&#xA;&#xA;        if ($isInDifferentGroup) {&#xA;            $differentGroup = Craft::$app-&amp;gt;userGroups-&amp;gt;getGroupByHandle('differentGroupHandle');&#xA;&#xA;            $userId = $event-&amp;gt;user-&amp;gt;id;&#xA;            $customGroupId = $differentGroup-&amp;gt;id;&#xA;&#xA;            // add more group ids to array in 2nd param to add user to multiple groups&#xA;            Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($userId, [$customGroupId]);&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Shout-out to Oliver Stark from &lt;strong&gt;&lt;a href=&quot;https://www.fortrabbit.com&quot; rel=&quot;noreferrer&quot;&gt;fortrabbit&lt;/a&gt;&lt;/strong&gt; for helping me with this.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-10-03T16:31:20.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27927" PostTypeId="2" ParentId="19010" CreationDate="2018-10-03T16:35:53.183" Score="0" Body="&lt;p&gt;If you're looking for a &lt;strong&gt;Craft 3&lt;/strong&gt; solution, check out my answer in this ticket: &lt;a href=&quot;https://craftcms.stackexchange.com/a/27926/4433&quot;&gt;https://craftcms.stackexchange.com/a/27926/4433&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-10-03T16:35:53.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27929" PostTypeId="2" ParentId="27756" CreationDate="2018-10-03T16:45:13.160" Score="0" Body="&lt;p&gt;You can avoid the elevated session problem with the &lt;code&gt;EVENT_AFTER_ASSIGN_USER_TO_DEFAULT_GROUP&lt;/code&gt; event.  Just register the user as normal, letting them get added to the default group, and then use this event in your custom plugin's primary class &lt;code&gt;init()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an example of my code in this ticket, although I'm doing a standard form post instead of with AJAX, but you could &lt;code&gt;post&lt;/code&gt; to the standard Craft &lt;code&gt;save-user&lt;/code&gt; controller and catch it in the event: &lt;a href=&quot;https://craftcms.stackexchange.com/a/27926/4433&quot;&gt;https://craftcms.stackexchange.com/a/27926/4433&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-10-03T16:45:13.160" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27930" PostTypeId="2" ParentId="27898" CreationDate="2018-10-03T20:31:39.970" Score="1" Body="&lt;p&gt;I have also recently come from Runway to Craft and had the exact same requirement. The &lt;a href=&quot;https://github.com/Rias500/craft-contact-form-extensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form Extension plugin&lt;/a&gt; that does exactly what you need&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did have to create a Craft Module though on one site to get validation working on the name field.&lt;/p&gt;&#xA;" OwnerUserId="8875" LastActivityDate="2018-10-03T20:31:39.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27931" PostTypeId="1" CreationDate="2018-10-03T20:54:41.413" Score="1" ViewCount="235" Body="&lt;p&gt;I'm writing an LDAP authentication plugin, which, if the authentication matches, will log the user into a 'general' username/password, in order to view a protected page.  The 'general' username/password is part of a usergroup with restricted priveleges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin, in the controller file, I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;login($username, $password);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with the $username and $password variables set just above that.  However, the login process does not appear to be happening, as my check in my template is not displaying the username:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;Welcome, {{ currentUser.friendlyName }}!&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I log on as that 'general' username/password, from the login page, and then refresh my template, it does show that the login for that profile has successfully occurred.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What may need to be done to effect a successful login, in the plugin?&lt;br&gt;&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="57" LastEditDate="2018-11-04T03:43:28.553" LastActivityDate="2018-11-04T03:43:28.553" Title="Programmatically Login From Plugin" Tags="&lt;plugin-development&gt;&lt;login&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27932" PostTypeId="2" ParentId="27931" CreationDate="2018-10-03T21:13:30.373" Score="1" Body="&lt;p&gt;If you want to login a user, you need to use the &lt;code&gt;login&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;login($loginName, $password, $rememberMe))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-03T21:13:30.373" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27933" PostTypeId="2" ParentId="19719" CreationDate="2018-10-03T22:43:42.083" Score="2" Body="&lt;p&gt;Just in case anyone stumbles across this and is using craft 3 &quot;craft.request.firstSegment&quot; is now deprecated in favour of &quot;craft.app.request.segments|first&quot;. So this is now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Includes the footer on all pages except homepage, contact and 404 #}&#xA;{% set exclusions = ['', 'contact', '404'] %}&#xA;{% if craft.app.request.segments|first not in exclusions  %}&#xA;    {% include '_footer'%}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2158" LastActivityDate="2018-10-03T22:43:42.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27934" PostTypeId="1" AcceptedAnswerId="28304" CreationDate="2018-10-04T03:41:08.420" Score="2" ViewCount="109" Body="&lt;p&gt;How do I get all the users with an active subscription in Commerce 2? I want to be able to filter entries by subscribed users. &lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="57" LastEditDate="2020-03-17T03:35:30.050" LastActivityDate="2020-03-17T03:35:30.050" Title="How to get all users with active Commerce 2 subscription" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;query&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27937" PostTypeId="1" CreationDate="2018-10-04T09:17:08.150" Score="1" ViewCount="84" Body="&lt;p&gt;I'm new in the Craft CMS world, and I'm approaching it because I need to create a web app where I and my colleague can create reports based on what we do for customers and export them in PDF format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I accomplish this task with Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In positive case can anyone give me some hints about what to do to begin (example.. plugins to study etc..)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks so much.&lt;/p&gt;&#xA;" OwnerUserId="8879" LastEditorUserId="57" LastEditDate="2018-10-09T23:51:21.073" LastActivityDate="2018-10-09T23:51:21.073" Title="Create web report able to be exported in pdf" Tags="&lt;form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27938" PostTypeId="2" ParentId="27937" CreationDate="2018-10-04T10:14:49.713" Score="1" Body="&lt;p&gt;This is a really broad question since it does not cover a specific topic but many things about plugin development. I would suggest you to read articles like So &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;You Wanna Make a Craft 3 Plugin?&lt;/a&gt; or &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing a Craft CMS 3 Website with a Custom Module&lt;/a&gt;. You can create a boilerplate of a plugin with &lt;a href=&quot;http://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pluginfactory.io&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get used to the topic there are &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;official documentations&lt;/a&gt; as well. If you have specific problem/question you can ask it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general there aren't many things that can't be accomplished with Craft. It's a really dynamic and flexible CMS and can be enhanced/extended in many ways. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-04T10:14:49.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27939" PostTypeId="1" AcceptedAnswerId="27943" CreationDate="2018-10-04T10:30:48.787" Score="0" ViewCount="175" Body="&lt;p&gt;Is craft's username field case sensitive when logging in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm importing 80 users into the database and when emailing the users I want to be sure how this works so we don't hit issues when they all try to log in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-10-04T14:11:37.777" Title="Case Sensitive username" Tags="&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27940" PostTypeId="1" CreationDate="2018-10-04T10:40:59.193" Score="1" ViewCount="40" Body="&lt;p&gt;I am building a site where I need to give each individual user access to site content according to the user progression of content consuming. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the example, User A has access to watch entry no.1, than only a week later, he can get access to entry no.2 and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best approach for to create such hierarchy in Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any hint!!&lt;/p&gt;&#xA;" OwnerUserId="3777" LastActivityDate="2018-11-05T15:57:56.730" Title="Individual Content dripping per user" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27941" PostTypeId="2" ParentId="27940" CreationDate="2018-10-04T11:04:45.323" Score="1" Body="&lt;p&gt;You'd most likely need to write a custom plugin. I &lt;em&gt;think&lt;/em&gt; it might be doable (but maybe not advisable) with Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin would contain an array of the entries in the sequence. How you specify this is up to you. It could be from within plugin settings, or a specific entry, or even just hard coded into your plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you need to create some way to store user ids against the last entry they watched and a date. Perhaps in a database table created by your plugin. Alternatively each user would have a custom field on their profile that contained the ids of the last entry they viewed plus the date they watched it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When visiting the url for an entry, there is a check performed against that field.&#xA;If this is the next entry in the sequence, and sufficient time has passed since they viewed the previous entry then allow them access. Also update the database table (or their hidden profile field) with the new entry ID and current date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's really down to scoping out the exact way you want it to work, not worrying about the method or code involved. Once you've got that you can determine how to write the plugin.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-10-04T11:04:45.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27943" PostTypeId="2" ParentId="27939" CreationDate="2018-10-04T14:11:37.777" Score="2" Body="&lt;p&gt;I've tested this locally on Craft3 and Craft2 and it seems that the username field is not case sensitive (e.g. &lt;code&gt;admin&lt;/code&gt;, &lt;code&gt;ADMIN&lt;/code&gt;, and &lt;code&gt;AdMiN&lt;/code&gt; all worked equally as well for me).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-10-04T14:11:37.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27944" PostTypeId="2" ParentId="27767" CreationDate="2018-10-04T14:17:26.477" Score="0" Body="&lt;p&gt;In a separate thread, it was determined that in this situation React was being used and the data being posted to Sprout Forms was null. The general takeaway was to ensure the correct data was being posted to Sprout Forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One crude way to try to see what Sprout Forms is seeing when you submit a post request is to add a die statement to the &lt;code&gt;vendor/barrelstrength/sprout-forms/src/controllers/EntriesController.php&lt;/code&gt; actionSaveEntry method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::dd($_POST);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, make sure you are passing the Sprout Forms action as a parameter in the URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://website.com?action=sprout-forms/entries/save-entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, the data for the React application needed to be passed to the endpoint using the &lt;code&gt;querystring.stringify&lt;/code&gt; as &lt;code&gt;JSON.stringify&lt;/code&gt; did not suffice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;axios.post(url, querystring.stringify(data))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2018-10-23T15:02:57.363" LastActivityDate="2018-10-23T15:02:57.363" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27945" PostTypeId="1" CreationDate="2018-10-04T21:24:41.667" Score="1" ViewCount="117" Body="&lt;p&gt;I'm trying to set the password for a 'test' user account on my localhost test site.  I don't have an email server to send the reset emails, so I've been using the copy URL method.&lt;br&gt;&#xA;When I do go to the URL and change the password, I get a 'Page Not Found' page.  I went ahead and checked to see if the password was in fact changed, but upon successive login tests, they failed.&lt;br&gt;&#xA;I was wondering what might be causing the 'Page Not Found' error?  Is there a way to set the password through a plugin, etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2019-09-02T14:24:45.010" Title="Set Password on Test User Account in Localhost" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;password&gt;&lt;craft2&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27946" PostTypeId="1" AcceptedAnswerId="27947" CreationDate="2018-10-04T23:04:11.337" Score="2" ViewCount="286" Body="&lt;p&gt;I have something I can not get my head around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.relatedTo(['and',{targetElement:22},{targetElement:33}])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I am building an array to use as relation criteria like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set related = [{targetElement:22},{targetElement:33}] %}&#xA;&#xA;.relatedTo(['and',related])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nothing returns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s pretty late here in Berlin and I might be missing something simple but can not see what exactly. Anyone?&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2018-11-04T00:00:42.420" Title="RelatedTo &quot;and&quot; and arrays" Tags="&lt;templating&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27947" PostTypeId="2" ParentId="27946" CreationDate="2018-10-04T23:13:54.940" Score="2" Body="&lt;p&gt;I don’t know what it is – I swear: every time – but the next thing I tried, immediately after posting the question was this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set related = ['and',] %}&#xA;{% for relation in relations %}&#xA;    {% set related = related|merge([{targetElement:relation}]) %}&#xA;{% endfor %}&#xA;&#xA;{% paginate craft.entries&#xA;    .section('documents')&#xA;    .relatedTo(related)&#xA;    as entries %}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That works.&lt;/p&gt;&#xA;" OwnerUserId="524" LastActivityDate="2018-10-04T23:13:54.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27948" PostTypeId="1" AcceptedAnswerId="28035" CreationDate="2018-10-05T07:32:30.530" Score="2" ViewCount="291" Body="&lt;p&gt;I originally had this setting in twig for gallery thumbnails:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set square150 = {&#xA;    mode: 'crop',&#xA;    width: 150,&#xA;    height: 150,&#xA;    quality: 75&#xA;    position: 'center-center'&#xA;} %}&#xA;&#xA;&amp;lt;img width=&quot;{{asset.getWidth(square150)}}&quot; height=&quot;{{asset.getHeight(square150)}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I noticed focal point doesn't apply, so I removed the position property as described on &lt;a href=&quot;https://docs.craftcms.com/v3/image-transforms.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/image-transforms.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now it's &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set square150 = {&#xA;    mode: 'crop',&#xA;    width: 150,&#xA;    height: 150,&#xA;    quality: 75&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the focal point works (I'm writing this out here because it took me some time to find out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it seems to me that the cropping is kind of generous, the area of the thumbnail is quite large. It does contain the focal point, true. But the focal point isn't always in the center of the image, as I'd have expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure the current behaviour is fine for many use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In mine, what I'd expect is that for the focal cropping, the extract of the image is zoomed in so far that the focal point is in the center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set square150 = {&#xA;    mode: 'crop',&#xA;    width: 150,&#xA;    height: 150,&#xA;    quality: 75&#xA;    position: 'focal-point-center-center'&#xA;} %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that possible and did I interpret the behaviour correctly?&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2018-10-11T12:46:11.520" Title="Focal point: more control?" Tags="&lt;image-transforms&gt;&lt;image&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27949" PostTypeId="2" ParentId="27945" CreationDate="2018-10-05T11:59:53.690" Score="0" Body="&lt;p&gt;Sorry, I can not comment yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you try copy your admin password to your test user in database? It can be way. Do you debug the &quot;Page Not Found&quot; error? &lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-05T11:59:53.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27950" PostTypeId="2" ParentId="27937" CreationDate="2018-10-05T12:31:24.650" Score="1" Body="&lt;p&gt;A very broad question gets a very broad answer :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use Craft for this (in various ways). Maybe these plugins can help you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PDF export plugins&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://printmaker.docs.topshelfcraft.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://printmaker.docs.topshelfcraft.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/enupal/snapshot&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/enupal/snapshot&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Report plugin (CSV export)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://superbig.co/plugins/reports&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/reports&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are others out there too that are probably worth a look.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-10-05T12:31:24.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27951" PostTypeId="1" AcceptedAnswerId="27960" CreationDate="2018-10-05T13:26:11.837" Score="1" ViewCount="595" Body="&lt;p&gt;The entries in my Craft app need a unique ‘non-guessable’ URL, so I figured I could use the UID in the URI of the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the section, where I need to provide the URI format I entered &quot;section-name/{uid}&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is giving me issues, since when I initially save an entry, the URI is &quot;section-name&quot;. I think this is because the UID is not available on creation of the URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I save the element for the second time, my problem is solved and the correct URI is generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to prevent this issue from happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already thought about creating a route, but that means that I need to generate the URI myself in every template, and this is prone to error and not future proof if we would like to change the URI format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also thought about creating a module which saves the entry for a second time when a new entry is saved for that section, but I can't find a way to create the correct event-listener.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a better solution or can help me with the event listener in a module?&lt;/p&gt;&#xA;" OwnerUserId="7482" LastEditorUserId="57" LastEditDate="2018-10-10T17:44:13.883" LastActivityDate="2018-10-10T17:44:13.883" Title="How can I use the entry UID in the entry URI" Tags="&lt;url&gt;&lt;modules&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27952" PostTypeId="2" ParentId="27951" CreationDate="2018-10-05T13:42:03.480" Score="1" Body="&lt;p&gt;I may be missing something here, but is the URL of an entry not always unique? How would Craft else know what entry to show?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use the entry's slug in the URI (&lt;code&gt;section-name/{slug}&lt;/code&gt;), wouldn't that do the trick?&#xA;A slug is unique within a section and every section has a unique name, so the URL would be unique too. And {slug} is defenitely known in the URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's an old post and may be outdated, but I read &lt;a href=&quot;https://craftcms.stackexchange.com/a/4949/960&quot;&gt;here&lt;/a&gt; that Craft doesn't expose the UID of an element so maybe that's part of the issue.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="960" LastEditDate="2018-10-05T13:47:39.473" LastActivityDate="2018-10-05T13:47:39.473" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27953" PostTypeId="2" ParentId="26403" CreationDate="2018-10-05T14:57:23.160" Score="3" Body="&lt;p&gt;To piggyback off Brad, Focal Points tell craft where to crop the image but can also be used to position background images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you can get focal point positions: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if slide.backgroundImage.one.hasFocalPoint %}&#xA;    {% set x = slide.backgroundImage.one.focalPoint | first %}&#xA;    {% set y = slide.backgroundImage.one.focalPoint | last %}&#xA;    {{ x }}, {{ y }}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return the focal point position at a decimal (ie .32, .55)&lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-10-05T14:57:23.160" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27954" PostTypeId="2" ParentId="25427" CreationDate="2018-10-05T18:50:01.983" Score="9" Body="&lt;p&gt;Another perhaps simpler approach is to write to your own log file without using the Craft logger at all.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$file = Craft::getAlias('@storage/logs/pluginhandle.log');&#xA;$log = date('Y-m-d H:i:s').' '.$message.&quot;\n&quot;;&#xA;&#xA;\craft\helpers\FileHelper::writeToFile($file, $log, ['append' =&amp;gt; true]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This logic has been put into a helper class for modules and plugins in Craft CMS:&#xA;&lt;a href=&quot;https://github.com/putyourlightson/craft-log-to-file&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/putyourlightson/craft-log-to-file&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2020-02-12T06:05:59.830" LastActivityDate="2020-02-12T06:05:59.830" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27955" PostTypeId="2" ParentId="24081" CreationDate="2018-10-05T18:51:33.550" Score="10" Body="&lt;p&gt;Another perhaps simpler approach is to write to your own log file without using the Craft logger at all.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$file = Craft::getAlias('@storage/logs/pluginhandle.log');&#xA;$log = date('Y-m-d H:i:s').' '.$message.&quot;\n&quot;;&#xA;&#xA;\craft\helpers\FileHelper::writeToFile($file, $log, ['append' =&amp;gt; true]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I released the &lt;a href=&quot;https://github.com/putyourlightson/craft-log-to-file&quot; rel=&quot;nofollow noreferrer&quot;&gt;Log To File Helper&lt;/a&gt; which provides a simple way for logging messages to a specific file and is intended to be used a helper class for modules and plugins.&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2019-07-01T13:09:56.050" LastActivityDate="2019-07-01T13:09:56.050" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27956" PostTypeId="1" CreationDate="2018-10-05T20:03:55.870" Score="1" ViewCount="49" Body="&lt;p&gt;I'm trying to import entries with an Asset inside a subfolder. Since I don't know what the new Craft subfolder ID will be for each Asset I tried to use the &lt;code&gt;folderPath&lt;/code&gt; property from Craft's Asset element class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;{&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutimport\\importers\\elements\\Entry&quot;,&#xA;    &quot;attributes&quot;: {&#xA;        &quot;sectionId&quot;: 2,&#xA;        &quot;typeId&quot;: 2,&#xA;        &quot;authorId&quot;: 1,&#xA;        &quot;slug&quot;: &quot;my-sample-document&quot;,&#xA;        &quot;postDate&quot;: &quot;2017-11-09 13:06:00&quot;,&#xA;        &quot;expiryDate&quot;: null,&#xA;        &quot;enabled&quot;: true&#xA;    },&#xA;    &quot;content&quot;: {&#xA;        &quot;title&quot;: &quot;My Sample Document&quot;,&#xA;        &quot;fields&quot;: {&#xA;            &quot;description&quot;: &quot;&amp;lt;p&amp;gt;Nulla sit amet est. In hac habitasse platea dictumst. Pellentesque ut neque.&amp;lt;/p&amp;gt;&quot;&#xA;        },&#xA;        &quot;related&quot;: {&#xA;            &quot;documentFile&quot;: {&#xA;                &quot;@model&quot;: &quot;barrelstrength\\sproutimport\\importers\\elements\\Asset&quot;,&#xA;                &quot;params&quot;: {&#xA;                    &quot;filename&quot;: [&quot;my-sample-document.pdf&quot;],&#xA;                    &quot;volumeId&quot;: 9,&#xA;                    &quot;folderPath&quot;: &quot;documents/pdfs/&quot;&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However the import fails with this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[error][sprout-import] Setting unknown property: craft\elements\db\AssetQuery::folderPath&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't get an error when I use the &lt;code&gt;folderId&lt;/code&gt; property. Can I only use properties that correspond with database columns? Is there any way to do this if I don't know the subfolder ID for every asset I'm importing?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft 3.0.26.1 &lt;/li&gt;&#xA;&lt;li&gt;Sprout Import 1.0.0-beta.14&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-10-17T13:28:26.627" Title="Sprout Import Doesn't Recognize Asset folderPath Property" Tags="&lt;plugin-sproutimport&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27957" PostTypeId="1" AcceptedAnswerId="27959" CreationDate="2018-10-05T21:10:21.423" Score="1" ViewCount="375" Body="&lt;p&gt;I was wondering if it was possible to translate the labels, like &quot;Singles&quot;,&quot;Entries&quot; in the CP&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's possible with Craft 2, but I didn't find with Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8886" LastActivityDate="2018-10-05T21:21:36.437" Title="Translate labels in CP with Craft CMS 3" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27958" PostTypeId="1" CreationDate="2018-10-05T21:15:57.560" Score="1" ViewCount="257" Body="&lt;p&gt;I found this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10586/edit-multiple-entries-at-once-through-the-front-end&quot;&gt;post&lt;/a&gt;. However, writing a plugin in currently not an option, and I'd like to do this with Vue.js since I'm already using it for form validation &amp;amp; other stuff. Also, this involves toggling radio buttons across entries/forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Structure section called Competitions that allows users to submit one or more (usually three maximum) entries to judged photo competitions. However, they can only submit one or two if they wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the user has submitted entries, let's say three, they can view them and edit them as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Choose which (only one allowed) of the three images they would like to have critiqued by the judges. This is currently a lightswitch radio button. If they select one image it gets set to &lt;code&gt;1&lt;/code&gt; and the other two to &lt;code&gt;0&lt;/code&gt;. I have this working ATM, but if there's a better way, let me know.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choose the order in which they would like to have their images judged (1, 2, or 3. Must be unique per image). This is currently a radio button group per entry. So if entry A is set to 1, B set to 2, and C set to 3, if they set A to 2, then B would be &quot;reset&quot; (no option selected). I don't know how many entries a user will submit, so I'm looping through entries and assigning loop index to buttons.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Delete an entry. Not implemented yet, but I think I can manage.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once the user has made the above changes, I'd like them to be able to click one button called &quot;Save changes&quot; to save all of the entries at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure if the forms should be saved immediately when toggling radio buttons, and then the &quot;Save changes&quot; button is the last step that sends everything to server &amp;amp; refreshes the template to display the changes made to the image order (template orders entries by this field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my code so far. You'll notice that I've created one Vue instance per form. Not sure if this is necessary or even desirable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I don't know if I'm going about this the right way. My skills in this area are limited. Please let me know if there's a better way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sreenshot of what code looks like in browser: &lt;a href=&quot;https://cl.ly/ee7cbf47954a&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cl.ly/ee7cbf47954a&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# One form per entry #}&#xA;{% for entry in submissions %}&#xA;    &amp;lt;form class=&quot;uk-form-horizontal&quot; id=&quot;edit{{ entry.id }}&quot; method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot; novalidate @submit.prevent=&quot;submitForm&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;        {{ redirectInput('/') }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ section.id }}&quot;&amp;gt;&#xA;        {# Set ID of Competition that will be submitting to #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;parentId&quot; value=&quot;{{ competition.id }}&quot;&amp;gt;&#xA;        {# ID of section's entry type #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;typeId&quot; value=&quot;10&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;        {# Required to edit entry #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;        {# Set hidden field to 0 #}&#xA;        {# https://craftcms.stackexchange.com/questions/5146/updating-a-lightswitch-value-not-working-via-front-end #}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[competitionSubmissionCritique]&quot; value=&quot;0&quot;&amp;gt;&#xA;&#xA;        {# Redacted errors macro for brevity #}&#xA;&#xA;        {# Image submission order #}&#xA;        {# Allows users to chose in which order they want their submissions judged #}&#xA;        {% set competitionSubmissionImageOrder = craft.app.fields.getFieldByHandle('competitionSubmissionImageOrder') %}&#xA;        &amp;lt;div class=&quot;uk-margin&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;uk-form-label&quot;&amp;gt;Image order&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;uk-form-controls&quot;&amp;gt;&#xA;                {# Loop through entries to get image order numbers for radio buttons #}&#xA;                {# Use submission instead of entry so don't conflict with entry.id #}&#xA;                {% for submission in currentUserSubmissions %}&#xA;                    &amp;lt;label&amp;gt;&#xA;                        &amp;lt;input class=&quot;uk-radio&quot; type=&quot;radio&quot; id=&quot;{{ loop.index }}&quot; name=&quot;fields[{{ competitionSubmissionImageOrder.handle }}]&quot; {% if entry is defined %}value=&quot;{{ entry.competitionSubmissionImageOrder }}&quot;{% endif %} v-model=&quot;entry.competitionSubmissionImageOrder&quot; v-bind:value=&quot;'{{ loop.index }}'&quot; @change=&quot;setImageOrder{{ entry.id }}&quot;&amp;gt;&#xA;                        {{ loop.index }}&#xA;                    &amp;lt;/label&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {# /Image submission order #}&#xA;&#xA;        {# Image critique #}&#xA;        {# Allows users to chose which image they want judges to critique. Can only be one image. #}&#xA;        &amp;lt;div class=&quot;uk-margin&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;uk-form-label&quot;&amp;gt;Critique image?&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;uk-form-controls&quot;&amp;gt;&#xA;                &amp;lt;div&amp;gt;&#xA;                    &amp;lt;label&amp;gt;&#xA;                        &amp;lt;input class=&quot;uk-radio&quot; type=&quot;radio&quot; name=&quot;fields[competitionSubmissionCritique]&quot; value=&quot;1&quot; {% if entry is defined and entry.competitionSubmissionCritique == 1 %} checked{% endif %} v-model=&quot;entry.competitionSubmissionCritique&quot; @change=&quot;isCritiqued{{ entry.id }}&quot;&amp;gt;&#xA;                    &amp;lt;/label&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        {# /Image critique #}&#xA;&#xA;        {# Save changes button #}&#xA;        &amp;lt;div class=&quot;uk-margin&quot;&amp;gt;&#xA;            &amp;lt;button class=&quot;uk-button uk-button-primary uk-button-large uk-width-1-1&quot; type=&quot;submit&quot; value=&quot;Submit&quot; @click=&quot;submitForm&quot;&amp;gt;&amp;lt;span :data-uk-icon=&quot;'icon: upload'&quot;&amp;gt;&amp;lt;/span&amp;gt; Save changes&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        {# Vue.js debugging #}&#xA;        &amp;lt;p&amp;gt;Vue.js debug:&amp;lt;br&amp;gt;${entry}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Javascript/Vue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    // Required for Vue Resource&#xA;    Vue.http.options.emulateJSON = true;&#xA;    Vue.http.options.emulateHTTP = true;&#xA;&#xA;    // Craft CSRF token&#xA;    window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName }}&quot;;&#xA;    window.csrfToken = &quot;{{ craft.app.request.csrfToken }}&quot;;&#xA;&#xA;    //Vue.use(VeeValidate);&#xA;&#xA;    {# Vue instance for each form. Necessary? #}&#xA;    {% for entry in currentUserSubmissions %}&#xA;        var vm{{ entry.id }} = new Vue({&#xA;            el: '#edit{{ entry.id }}',&#xA;            delimiters: ['${', '}'],&#xA;            data: {&#xA;                entry: {&#xA;                    action: 'entries/save-entry',&#xA;                    entryId: '{{ entry.id }}',&#xA;                    competitionSubmissionImageOrder: '{{ entry.competitionSubmissionImageOrder }}',&#xA;                    competitionSubmissionCritique: '{{ entry.competitionSubmissionCritique }}',&#xA;                },&#xA;            },&#xA;&#xA;            methods: {&#xA;                setImageOrder{{ entry.id }}: function() {&#xA;                    // Not working!!&#xA;                    // Get related entries&#xA;                    {% set relatedEntries = currentUserSubmissions.id('not ' ~ entry.id).all() %}&#xA;                    // Loop through related entries &amp;amp; set them to OFF&#xA;                    {% for relatedEntry in relatedEntries %}&#xA;                        if (vm{{ relatedEntry.id }}.entry.competitionSubmissionImageOrder === this.entry.competitionSubmissionImageOrder) {&#xA;                            vm{{ relatedEntry.id }}.entry.competitionSubmissionImageOrder = '0';&#xA;                        }&#xA;                    {% endfor %}&#xA;                },&#xA;&#xA;                isCritiqued{{ entry.id }}: function() {&#xA;                    // Works!!&#xA;                    // Get related entries&#xA;                    {% set relatedEntries = currentUserSubmissions.id('not ' ~ entry.id).all() %}&#xA;                    // Loop through related entries &amp;amp; set them to OFF&#xA;                    {% for relatedEntry in relatedEntries %}&#xA;                        vm{{ relatedEntry.id }}.entry.competitionSubmissionCritique = 0;&#xA;                    {% endfor %}&#xA;                },&#xA;&#xA;                submitForm: function () {&#xA;                    var form = document.getElementById('edit{{ entry.id }}');&#xA;                    var formData = new FormData(form);&#xA;&#xA;                    //var data = this.entry;&#xA;&#xA;                    formData[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;                    //data[window.csrfTokenName] = window.csrfTokenValue; // Append CSRF Token&#xA;&#xA;                    //data[csrfTokenName] = csrfToken;&#xA;&#xA;                    this.$http.post('/', formData)&#xA;                    //this.$http.post('/', data)&#xA;                        .then(function(response) {&#xA;                            console.log('saved', response);&#xA;                        });&#xA;                },&#xA;            }&#xA;        });&#xA;    {% endfor %}&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that the &lt;code&gt;setImageOrder&lt;/code&gt; function actually works. I had confused myself by the image order change when refreshing template. Calling the &lt;code&gt;submitForm&lt;/code&gt; function from it also seems to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;setImageOrder{{ entry.id }}: function() {&#xA;    // Works&#xA;    // Get related entries&#xA;    {% set relatedEntries = currentUserSubmissions.id('not ' ~ entry.id).all() %}&#xA;    // Loop through related entries &amp;amp; 'reset' if match current entry&#xA;    {% for relatedEntry in relatedEntries %}&#xA;        if (vm{{ relatedEntry.id }}.entry.competitionSubmissionImageOrder === this.entry.competitionSubmissionImageOrder) {&#xA;            vm{{ relatedEntry.id }}.entry.competitionSubmissionImageOrder = '';&#xA;        }&#xA;    {% endfor %}&#xA;&#xA;    // Also works&#xA;    this.submitForm();&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;isCritiqued&lt;/code&gt; is working as follows with &lt;code&gt;setTimeout&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;isCritiqued{{ entry.id }}: function() {&#xA;    // Works 2018-10-08&#xA;    // Get related entries&#xA;    {% set relatedEntries = currentUserSubmissions.id('not ' ~ entry.id).all() %}&#xA;&#xA;    {% for relatedEntry in relatedEntries %}&#xA;        if (vm{{ relatedEntry.id }}.entry.competitionSubmissionCritique === this.entry.competitionSubmissionCritique) {&#xA;            vm{{ relatedEntry.id }}.entry.competitionSubmissionCritique = '0';&#xA;&#xA;            setTimeout(vm{{ relatedEntry.id }}.submitForm, 2000);&#xA;        }&#xA;    {% endfor %}&#xA;&#xA;    this.submitForm();&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-10-26T16:48:37.437" LastActivityDate="2018-10-26T16:48:37.437" Title="How can I edit multiple entries via multiple front-end forms using Vue.js?" Tags="&lt;craft3&gt;&lt;ajax&gt;&lt;javascript&gt;&lt;frontend-form&gt;&lt;vue&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27959" PostTypeId="2" ParentId="27957" CreationDate="2018-10-05T21:21:36.437" Score="1" Body="&lt;p&gt;Yes, it's possible to do. You can do it via &lt;a href=&quot;https://t.co/ZzaIJylmP3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Static Translations&lt;/a&gt;. Just create &lt;code&gt;translations/en-US/app.php&lt;/code&gt; (or whatever your site language is), and do the mapping there as per: &lt;a href=&quot;https://twitter.com/nystudio107/status/1045963809956012032&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twitter.com/nystudio107/status/1045963809956012032&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-05T21:21:36.437" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27960" PostTypeId="2" ParentId="27951" CreationDate="2018-10-05T23:07:21.270" Score="2" Body="&lt;p&gt;I think this can be a starting solution. It rewrite slug of Entry after the Entry is saved to database. The URI is constructed from it. You can try it in any plugin, only register the EVENT_AFTER_SAVE_ELEMENT in init() function of Plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\events\ElementEvent;&#xA;use craft\services\Elements;&#xA;&#xA;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function (ElementEvent $event){&#xA;        //identify the right Entry for example test sectionId, typeId, authorId&#xA;        if ($event-&amp;gt;element instanceof craft\elements\Entry) {  &#xA;            $entry = $event-&amp;gt;element;&#xA;            //only newly created &#xA;            if($event-&amp;gt;isNew){                  &#xA;                $entry-&amp;gt;slug = $entry-&amp;gt;uid;&#xA;                Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);                 &#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-05T23:07:21.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27961" PostTypeId="1" CreationDate="2018-10-06T08:16:28.537" Score="1" ViewCount="199" Body="&lt;p&gt;We're trying to filter by categories AND tags in the one form. However can't seem to get things working as we would like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, we have a form that pulls in the tags and allows multiple filtering dropdowns. The below is out results page code, which outputs odd results. We need all params to match the entries categories/tags but it just doesn't work as expected. Where are we going wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {# Get params #}&#xA;    {% set mainCategory = craft.app.request.getParam(‘category’) %}&#xA;    {% set season = craft.app.request.getParam(‘season’) %}&#xA;    {% set age = craft.app.request.getParam(‘ages’) %}&#xA;&#xA;    {# Set arrays #}&#xA;    {% set mainCat = mainCategory ? craft.categories.group(‘courseCategories’).slug(mainCategory).all() %}&#xA;    {% set seasonCat = season ? craft.tags.group(‘season’).slug(season).all() %}&#xA;    {% set ageCat = age ? craft.tags.group(‘ageRange’).slug(age).all() %}&#xA;&#xA;    {# Set relatedTo #}&#xA;    {% set categoryParam = mainCat ? {targetElement: [‘and’]|merge(mainCat)} %}&#xA;    {% set seasonParam = seasonCat ? {targetElement: [‘and’]|merge(seasonCat)} %}&#xA;    {% set ageParam = ageCat ? {targetElement: [‘and’]|merge(ageCat)} %}&#xA;&#xA;    {# Get entries #}&#xA;    {% set relationParams = [categoryParam, seasonParam, ageParam]|filter %}&#xA;    {% set entries = craft.entries({&#xA;        section: ‘courses’,&#xA;        relatedTo: relationParams ? [‘and’]|merge(relationParams) : null&#xA;    }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7505" LastActivityDate="2018-10-07T10:36:03.550" Title="Filtering by categories AND tags with full match" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;tags&gt;&lt;relatedto&gt;&lt;filtering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27962" PostTypeId="2" ParentId="27961" CreationDate="2018-10-06T08:32:12.337" Score="1" Body="&lt;p&gt;You are always one level too deep. Craft is able to proceed parameters like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    'and',&#xA;    ['targetElement' =&amp;gt; [1, 2, 3],&#xA;    ['targetElement' =&amp;gt; ['or', 1, 2, 3],&#xA;    ['targetElement' =&amp;gt; 1],&#xA;    ['targetElement' =&amp;gt; ['and', 1, 2, 3]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And so on.&#xA;Yours is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'targetElement' =&amp;gt; ['and', [1,2,3]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would suggest you to dump your array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&#xA;{{ dump(array) }}&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To see the result. If you don't care about performance just using &lt;code&gt;.one()&lt;/code&gt; instead of &lt;code&gt;all()&lt;/code&gt; might solve the problem. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-06T08:32:12.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27963" PostTypeId="2" ParentId="19748" CreationDate="2018-10-06T10:55:47.980" Score="1" Body="&lt;p&gt;I ran into username validation because I had to migrate user names containing spaces (not allowed by default).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up creating a custom Username validator and let composer's autoloader use that one instead of craft's default. You can easily add your own validation rules there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class UsernameValidator extends Validator&#xA;{&#xA;  public function validateValue($value)&#xA;  {&#xA;    // your own validation rules here&#xA;&#xA;    // (disabled) Don't allow whitespace in the username&#xA;    // if (preg_match('/\s+/', $value)) {&#xA;    //    return ['{attribute} cannot contain spaces.', []];&#xA;    // }&#xA;&#xA;    return null;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how to use the custom validator instead of the default one.&#xA;Note that if Craft changes it's internals this might have to be adjusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://io.24hoursmedia.com/tech-notes/allow-spaces-in-craft-cms-user-names&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://io.24hoursmedia.com/tech-notes/allow-spaces-in-craft-cms-user-names&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6868" LastActivityDate="2018-10-06T10:55:47.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27964" PostTypeId="1" AcceptedAnswerId="27965" CreationDate="2018-10-06T18:00:54.027" Score="1" ViewCount="122" Body="&lt;p&gt;Is there a way to allow users to edit their email address via a front-end form in Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is this would require an 'elevated' user session. Which I'm guessing can only be achieved via plugin. In the API docs I see that there is a &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-user.html#method-startelevatedsession&quot; rel=&quot;nofollow noreferrer&quot;&gt;startElevatedSession()&lt;/a&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At a minimum, I'm assuming this might work:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Submit form with existing password and new email to a custom controller. &lt;/li&gt;&#xA;&lt;li&gt;Controller starts an elevated session via &lt;code&gt;startElevatedSession()&lt;/code&gt;, sets new password on user, saves user, and redirects to success page.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I were to create a 'confirm email' workflow for security — how might that work? Can I tap into the Craft native workflow? Or would it all need to be custom?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI... in this case, the site is set to &lt;code&gt;useEmailAsUsername&lt;/code&gt; if that makes a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a follow-up, would changing the email address affect relationships to commerce orders? I assume that they are related by something other than just email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any general pointers would be much appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="784" LastEditorUserId="57" LastEditDate="2018-10-10T17:49:14.083" LastActivityDate="2018-10-10T17:49:14.083" Title="Allow users to edit user account email from front end form in Craft 3?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27965" PostTypeId="2" ParentId="27964" CreationDate="2018-10-06T18:53:29.560" Score="2" Body="&lt;p&gt;&lt;code&gt;UsersController::actionStartElevatedSession()&lt;/code&gt; is &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php#L231&quot; rel=&quot;nofollow noreferrer&quot;&gt;public&lt;/a&gt; so you can access it via frontend form but you should only call it via ajax request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just submit your normal user form via ajax and if it contains an error with key &lt;code&gt;currentPassword&lt;/code&gt; you can be sure to require a elevated session and display a password form to enter it in order to create a request to the route above. This will start the session and you can submit the user form a second time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in summary: you don't need a custom controller at all. You can change the user's email and password by submitting a form with &lt;code&gt;newPassword&lt;/code&gt; and &lt;code&gt;email&lt;/code&gt; but you'll receive the error &lt;code&gt;Incorrect current password&lt;/code&gt; if there is no elevated session or if the password parameter doesn't match the user's old password (you always need to submit it together). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want additional security you can send the &lt;code&gt;sendVerificationEmail&lt;/code&gt; to force users to verify their email by sending them a mail. But keep in mind all those things can be manipulated via frontend request. Users are totally free to change the html of your form&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-06T19:06:17.473" LastActivityDate="2018-10-06T19:06:17.473" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27966" PostTypeId="1" AcceptedAnswerId="27970" CreationDate="2018-10-07T00:56:28.560" Score="1" ViewCount="120" Body="&lt;p&gt;I am learning to write my first plugin for Craft CMS 3.x&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a field that gets displayed as a string, but is stored in the database as binary. When I validate it, I write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getElementValidationRules(): array&#xA;{&#xA;    return [&#xA;        /* Other rules, */&#xA;        ['unique']&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I wonder is, will it get compared in its string form to the binary? Or will serializeValue() get called?&lt;/p&gt;&#xA;" OwnerUserId="8731" LastEditorUserId="125" LastEditDate="2018-10-07T14:23:23.173" LastActivityDate="2018-10-07T14:23:23.173" Title="Do field values get serialized before validation?" Tags="&lt;plugin-development&gt;&lt;validation&gt;&lt;serialization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27967" PostTypeId="5" CreationDate="2018-10-07T10:08:34.373" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-10-07T10:08:34.373" LastActivityDate="2018-10-07T10:08:34.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27968" PostTypeId="4" CreationDate="2018-10-07T10:08:34.373" Score="0" Body="This is a special tag that is designed to be used only by the system for questions that have had all of their other tags removed. Do not add this tag to existing questions, it is reserved for use by the system to identify posts with no valid tags." OwnerUserId="6007" LastEditorUserId="6007" LastEditDate="2018-10-09T23:52:25.723" LastActivityDate="2018-10-09T23:52:25.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27969" PostTypeId="2" ParentId="27961" CreationDate="2018-10-07T10:36:03.550" Score="1" Body="&lt;p&gt;So it turns out there were a few things wrong. Firstly my tag slugs were wrong and didn't match in the database (Craft needs to improve how it handles tags...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, I had to change my code as Robin suggested to .one() instead of grabbing the full array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thirdly, I had to change my targetElement to 'or' for each array merge then 'and' for the final parameter merge. Here is my working code for filtering results based on categories/tags combined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainCategory = craft.app.request.getParam('category') %}&#xA;{% set season = craft.app.request.getParam('season') %}&#xA;{% set age = craft.app.request.getParam('ages') %}&#xA;&#xA;{% set mainCat = mainCategory ? craft.categories.group('courseCategories').slug(mainCategory).one() %}&#xA;{% set seasonCat = season ? craft.tags.group('season').slug(season).one() %}&#xA;{% set ageCat = age ? craft.tags.group('ageRange').slug(age).one() %}&#xA;&#xA;{% set categoryParam = mainCat ? {targetElement: ['or']|merge(mainCat)} %}&#xA;{% set seasonParam = seasonCat ? {targetElement: ['or']|merge(seasonCat)} %}&#xA;{% set ageParam = ageCat ? {targetElement: ['or']|merge(ageCat)} %}&#xA;&#xA;{% set relationParams = [categoryParam, seasonParam, ageParam]|filter %}&#xA;{% set entries = craft.entries({&#xA;    section: 'courses',&#xA;    relatedTo: relationParams ? ['and']|merge(relationParams) : null&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7505" LastActivityDate="2018-10-07T10:36:03.550" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27970" PostTypeId="2" ParentId="27966" CreationDate="2018-10-07T13:22:46.530" Score="2" Body="&lt;p&gt;First of all: this validator requires an active record as target in order to know what table it should check to search for uniqueness. Since Craft has not such a thing you would need to create a record for the &lt;code&gt;content&lt;/code&gt; table in order to make it work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you'll need to check the context of the field, if it's inside a matrix or inside a super table field or whatever so you need to set the target Attribute dynamically based on the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally it won't serialize your value automatically and search for the string, instead it will just fail because of &lt;a href=&quot;https://github.com/yiisoft/yii2/blob/master/framework/validators/UniqueValidator.php#L133&quot; rel=&quot;nofollow noreferrer&quot;&gt;these&lt;/a&gt; lines &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($rawConditions as $key =&amp;gt; $value) { &#xA;    if (is_array($value)) { &#xA;        $this-&amp;gt;addError($model, $attribute, Yii::t('yii', '{attribute} is invalid.')); &#xA;         return; &#xA;    } &#xA;    $conditions[] = [$key =&amp;gt; $value];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your value is an array so it will add an error no matter what &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However: you can rebuild the functionality by actually validating the model by yourself with this validator instead of defining a validator and letting Craft handling it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example in the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/fields/Matrix.php#L515&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix field&lt;/a&gt; it inserts just a function that is being called in the class instead of a validator. Then you can create a &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-base-dynamicmodel&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic model &lt;/a&gt; and validate that one. You can read more about  &lt;a href=&quot;https://yii2-framework.readthedocs.io/en/latest/guide/input-validation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ad hock validations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$email = 'test@example.com';&#xA;$validator = new yii\validators\EmailValidator(); &#xA;if ($validator-&amp;gt;validate($email, $error)) { &#xA;    echo 'Email is valid.'; &#xA;} else { &#xA;    echo $error; &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-07T14:03:26.913" LastActivityDate="2018-10-07T14:03:26.913" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27971" PostTypeId="1" CreationDate="2018-10-07T13:56:53.827" Score="1" ViewCount="632" Body="&lt;p&gt;In the footer at the bottom of my page, &lt;a href=&quot;http://www.soldierswish.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;www.soldierswish.org&lt;/a&gt;, there are two links for &lt;code&gt;501c3&lt;/code&gt; and &lt;code&gt;Form 990&lt;/code&gt;. Is there no way to edit these from the GUI? How do I edit these links?&lt;/p&gt;&#xA;" OwnerUserId="8887" LastEditorUserId="5557" LastEditDate="2018-10-07T14:35:23.993" LastActivityDate="2018-10-07T19:43:59.243" Title="How to edit a global footer link" Tags="&lt;globals&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27972" PostTypeId="1" AcceptedAnswerId="27989" CreationDate="2018-10-07T18:32:10.580" Score="1" ViewCount="74" Body="&lt;p&gt;I have a logout button on my site that points to the &lt;code&gt;logoutUrl&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the logout works and ends the user session, the user is brought to a page with the URL similar to &lt;code&gt;domain.tld/domain.tld/&lt;/code&gt; where domain.tld is my test-server's domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally, this results in a 404 since I don't have a template to render a matching URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to fix this or what could be causing it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2018-10-09T02:31:21.873" Title="Craft redirects to domain.tld/domain.tld/ on logout" Tags="&lt;craft3&gt;&lt;users&gt;&lt;session&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27973" PostTypeId="2" ParentId="27971" CreationDate="2018-10-07T19:43:59.243" Score="2" Body="&lt;p&gt;Look under Globals in the Control Panel, which is the likely place for such links. If you do not see it, either you do not have permissions OR there are no Globals. Assuming you do not see them, Robin's suggestion about contacting the developer is the next step. &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-10-07T19:43:59.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27974" PostTypeId="2" ParentId="19581" CreationDate="2018-10-08T02:59:08.923" Score="1" Body="&lt;p&gt;For Commerce 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\elements\Product;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;    'products.json' =&amp;gt; [&#xA;        'elementType' =&amp;gt; Product::class,&#xA;        'transformer' =&amp;gt; function(Product $product) {&#xA;            return [&#xA;                'title' =&amp;gt; $product-&amp;gt;title,&#xA;                'url' =&amp;gt; $product-&amp;gt;url,&#xA;            ];&#xA;        },&#xA;    ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8803" LastActivityDate="2018-10-08T02:59:08.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27975" PostTypeId="1" AcceptedAnswerId="27985" CreationDate="2018-10-08T04:43:20.147" Score="1" ViewCount="98" Body="&lt;p&gt;What permissions do users need in order to access the &quot;edit image&quot; menu in assets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some users can't access this, but I can't see a specific permission for this listed under:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Settings &gt; Users &gt; User Groups&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xiHFd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xiHFd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="567" LastActivityDate="2018-10-08T21:51:18.520" Title="Permissions needed to &quot;edit image&quot;?" Tags="&lt;assets&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27976" PostTypeId="1" AcceptedAnswerId="28045" CreationDate="2018-10-08T10:20:45.360" Score="1" ViewCount="196" Body="&lt;p&gt;We've currently got Subscriptions setup on a site which works a charm, but my main issue is outputting the price of the subscription, after the user has subscribed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the docs/templates I can even see how this is possible?! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get it via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set subscriptions = craft.subscriptions.user(currentUser) %}&#xA;&#xA;{% for subscription in subscriptions %}&#xA;    {{ subscriptionPlanData.plan.amount }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if for example, the plan is &lt;code&gt;£300.00&lt;/code&gt; then it outputs as &lt;code&gt;30000&lt;/code&gt; and when formatted, it comes out like &lt;code&gt;30,000.00&lt;/code&gt; using &lt;code&gt;{{ subscriptionPlanData.plan.amount|number_format(2, '.', ',') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see anyway of showing the user, how much they've paid in a human format without hacking around the number.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2018-10-12T00:18:46.630" Title="Commerce 2 Subscription Prices" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27977" PostTypeId="2" ParentId="27976" CreationDate="2018-10-08T11:17:50.517" Score="2" Body="&lt;p&gt;I could be wrong here as I've not used subscriptions with Commerce yet, but using the filter &lt;code&gt;|currency&lt;/code&gt; worked perfectly for me when outputting the correct format after having tried &lt;code&gt;|replace&lt;/code&gt; and &lt;code&gt;|number&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8327" LastActivityDate="2018-10-08T11:17:50.517" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27978" PostTypeId="1" CreationDate="2018-10-08T12:21:02.253" Score="2" ViewCount="106" Body="&lt;p&gt;I'm currently working on a multi-market Craft3 project with Commerce2. &lt;strong&gt;Each product can and will have a different fixed price on each page.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Product A&lt;br /&gt;&#xA;&lt;code&gt;project.tld/de-de&lt;/code&gt; - € 120&lt;br /&gt;&#xA;&lt;code&gt;project.tld/en-gb&lt;/code&gt; - £ 100&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware that Commerce2 has no multi-site support, but I still need a solution for my problem. I tried to modify the LineItem at the event &lt;code&gt;Order :: EVENT_AFTER_ADD_LINE_ITEM&lt;/code&gt;. But I failed miserably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there perhaps a workaround that could solve the problem?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Order::class, Order::EVENT_AFTER_ADD_LINE_ITEM, function (Event $e) {&#xA;    /** @var Order $order */&#xA;    $order = $e-&amp;gt;sender;&#xA;&#xA;    foreach ($order-&amp;gt;lineItems as $lineItem) {&#xA;        $price = '234.0000';&#xA;        $lineItem-&amp;gt;price = $price;&#xA;        $lineItem-&amp;gt;salePrice = $price;&#xA;        if (is_array($lineItem-&amp;gt;snapshot)) {&#xA;            $snapshot = $lineItem-&amp;gt;snapshot;&#xA;        } else {&#xA;            $snapshot = json_decode($lineItem-&amp;gt;snapshot, true);&#xA;        }&#xA;        $snapshot['price'] = $price;&#xA;        $snapshot['product']['defaultPrice'] = $price;&#xA;        $lineItem-&amp;gt;snapshot = json_encode($snapshot);&#xA;    }&#xA;    $order-&amp;gt;setLineItems($resultLineItems);&#xA;    Craft::$app-&amp;gt;elements-&amp;gt;saveElement($order);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8136" LastActivityDate="2018-10-08T12:21:02.253" Title="Commerce 2 Multi-site Support" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27979" PostTypeId="1" CreationDate="2018-10-08T14:23:17.803" Score="1" ViewCount="109" Body="&lt;p&gt;Working with Craft 2, I have a channel for events that each entry has an expiration date. Live entries should show the upcoming event info and expired entries should show archive info. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a costume route to enable viewing of the expired entries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;news/{slug} →  news/_entry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when I am adding this to the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').slug(slug).status('live, expired').first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see the expired entries info but than if I am viewing a live entry, the data that I am viewing is not from the entry I am visiting but from the first entry in the section. If I drop this line from my code, than I cannot see the info from the expired entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to be able to view both?&lt;/p&gt;&#xA;" OwnerUserId="3777" LastEditorUserId="3777" LastEditDate="2018-10-09T05:36:41.680" LastActivityDate="2018-10-09T05:36:41.680" Title="Viewing expired entries and live one with the same template" Tags="&lt;entries&gt;&lt;status&gt;&lt;expiration&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27980" PostTypeId="1" AcceptedAnswerId="27990" CreationDate="2018-10-08T15:03:25.557" Score="3" ViewCount="472" Body="&lt;p&gt;I'm trying to upgrade Craft 2 -&gt; 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can install Craft 3 no problem, but when I try starting over/upgrading I'm hitting this error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft 2 site is running the latest version of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MacOS High Sierra&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MAMP Pro 5.0.4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9boYE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9boYE.png&quot; alt=&quot;Abort, Try again, Continue Anyway &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I continue anyway I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;An Error occurred while handling another error:&#xA;&#xA;Stack trace:&#xA;yii\base\InvalidArgumentException: Invalid path alias: @baseUrl/ in /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php:154&#xA;#0 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Request.php(1080): yii\BaseYii::getAlias('@baseUrl/')&#xA;#1 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Request.php(167): craft\web\Request-&amp;gt;_requestedSite(Object(craft\services\Sites))&#xA;#2 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request-&amp;gt;init()&#xA;#3 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#4 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#5 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Reque...', Array, Array)&#xA;#6 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Reque...', Array, Array)&#xA;#7 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/config/app.web.php(13): yii\BaseYii::createObject(Array)&#xA;#8 [internal function]: {closure}()&#xA;#9 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#10 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#11 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#12 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#13 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Application.php(333): yii\base\Module-&amp;gt;get('request', true)&#xA;#14 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/ServiceLocator.php(74): craft\web\Application-&amp;gt;get('request')&#xA;#15 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/web/ErrorHandler.php(499): yii\di\ServiceLocator-&amp;gt;__get('request')&#xA;#16 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/web/ErrorHandler.php(115): yii\web\ErrorHandler-&amp;gt;shouldRenderSimpleHtml()&#xA;#17 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/ErrorHandler.php(132): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\InvalidArgumentException))&#xA;#18 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\InvalidArgumentException))&#xA;#19 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/ErrorHandler.php(63): yii\base\ErrorHandler-&amp;gt;handleException(Object(yii\base\InvalidArgumentException))&#xA;#20 [internal function]: craft\web\ErrorHandler-&amp;gt;handleException(Object(yii\base\InvalidArgumentException))&#xA;#21 {main}&#xA;Previous exception:&#xA;yii\base\InvalidArgumentException: Invalid path alias: @baseUrl/ in /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php:154&#xA;Stack trace:&#xA;#0 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Request.php(1080): yii\BaseYii::getAlias('@baseUrl/')&#xA;#1 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Request.php(167): craft\web\Request-&amp;gt;_requestedSite(Object(craft\services\Sites))&#xA;#2 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request-&amp;gt;init()&#xA;#3 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#4 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#5 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Reque...', Array, Array)&#xA;#6 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Reque...', Array, Array)&#xA;#7 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/config/app.web.php(13): yii\BaseYii::createObject(Array)&#xA;#8 [internal function]: {closure}()&#xA;#9 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#10 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#11 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#12 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('request', true)&#xA;#13 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Application.php(333): yii\base\Module-&amp;gt;get('request', true)&#xA;#14 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application-&amp;gt;get('request')&#xA;#15 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/helpers/App.php(371): yii\web\Application-&amp;gt;getRequest()&#xA;#16 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/config/app.php(214): craft\helpers\App::logConfig()&#xA;#17 [internal function]: {closure}()&#xA;#18 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(503): call_user_func_array(Object(Closure), Array)&#xA;#19 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container-&amp;gt;invoke(Object(Closure), Array)&#xA;#20 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))&#xA;#21 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator-&amp;gt;get('log', true)&#xA;#22 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Application.php(333): yii\base\Module-&amp;gt;get('log', true)&#xA;#23 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/Application.php(508): craft\web\Application-&amp;gt;get('log')&#xA;#24 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/base/ApplicationTrait.php(1133): yii\base\Application-&amp;gt;getLog()&#xA;#25 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Application.php(106): craft\web\Application-&amp;gt;_preInit()&#xA;#26 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application-&amp;gt;init()&#xA;#27 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#28 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/src/web/Application.php(97): yii\base\Application-&amp;gt;__construct(Array)&#xA;#29 [internal function]: craft\web\Application-&amp;gt;__construct(Array)&#xA;#30 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass-&amp;gt;newInstanceArgs(Array)&#xA;#31 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container-&amp;gt;build('craft\\web\\Appli...', Array, Array)&#xA;#32 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container-&amp;gt;get('craft\\web\\Appli...', Array, Array)&#xA;#33 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)&#xA;#34 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/vendor/craftcms/cms/bootstrap/web.php(42): require('/Users/charlie....')&#xA;#35 /Users/charlie.triplett/Documents/Work/simple/Craft-3.0.26.1/web/index.php(20): require('/Users/charlie....')&#xA;#36 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5957" LastEditorUserId="57" LastEditDate="2018-10-10T18:02:23.157" LastActivityDate="2018-10-10T18:02:23.157" Title="Attempting Craft 2 -&gt; 3 Upgrade | An Error occurred while handling another error" Tags="&lt;craft3&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27982" PostTypeId="1" AcceptedAnswerId="27983" CreationDate="2018-10-08T19:39:02.150" Score="1" ViewCount="306" Body="&lt;p&gt;Im trying to figure out how to move asset(s) to a different volume. Also if I move it will that affect the entries that are using the asset?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what im using to target the asset:&#xA;&lt;code&gt;$resourceImage = Asset::find()-&amp;gt;volume('resourceImages')-&amp;gt;filename($filename);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to move it to my &lt;code&gt;productImages&lt;/code&gt; volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8759" LastActivityDate="2018-10-08T20:11:31.937" Title="API - Update Asset Volume" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;element&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27983" PostTypeId="2" ParentId="27982" CreationDate="2018-10-08T20:11:31.937" Score="3" Body="&lt;p&gt;You can move them like this&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$asset = Asset::find()-&amp;gt;volume('resourceImages')-&amp;gt;filename($filename)-&amp;gt;one()&#xA;$folder = Craft::$app-&amp;gt;getAssets()-&amp;gt;findFolder(['volumeId' =&amp;gt; X]);&#xA;Craft::$app-&amp;gt;getAssets()-&amp;gt;moveAsset($asset, $folder, $filename);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It won't change your relations or anything else in fact all the function does is:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * Move or rename an Asset.&#xA; *&#xA; * @param Asset $asset The asset whose file should be renamed&#xA; * @param VolumeFolder $folder The Volume Folder to move the Asset to.&#xA; * @param string $filename The new filename&#xA; * @return bool Whether the asset was renamed successfully&#xA; * @throws AssetLogicException if the asset’s volume is missing&#xA; */&#xA;public function moveAsset(Asset $asset, VolumeFolder $folder, string $filename = ''): bool&#xA;{&#xA;    // Set the new combined target location, and save it&#xA;    $asset-&amp;gt;newFilename = $filename;&#xA;    $asset-&amp;gt;newFolderId = $folder-&amp;gt;id;&#xA;    $asset-&amp;gt;setScenario(Asset::SCENARIO_FILEOPS);&#xA;&#xA;    return Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($asset);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-08T20:11:31.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27984" PostTypeId="1" CreationDate="2018-10-08T20:45:48.707" Score="1" ViewCount="20" Body="&lt;p&gt;I'm trying to exclude entries that are tagged &quot;DO NOT PROMOTE&quot; on any page where craft.entries is used minus their actual entry page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've come up with so far is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    /*&#xA;        Exclude DO NOT PROMOTE tagged entries&#xA;    */&#xA;    // Get DO NOT PROMOTE tag id&#xA;    $tagCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Tag);&#xA;    $tagCriteria-&amp;gt;title = 'DO NOT PROMOTE';&#xA;    $tag = $tagCriteria-&amp;gt;first();&#xA;&#xA;    // Get Entries related to above tag&#xA;    $entryCriteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;    $entryCriteria-&amp;gt;limit = null;&#xA;    $entryCriteria-&amp;gt;status = null;&#xA;    $entryCriteria-&amp;gt;relatedTo = [&#xA;        'targetElement' =&amp;gt; $tag,&#xA;        'field' =&amp;gt; 'tags'&#xA;    ];&#xA;    $doNotPromoteEntries = $entryCriteria-&amp;gt;ids();&#xA;&#xA;    craft()-&amp;gt;on('elements.beforeBuildElementsQuery', function(Event $event) use ($doNotPromoteEntries) {&#xA;        $criteria = $event-&amp;gt;params['criteria'];&#xA;&#xA;        $criteria-&amp;gt;id = 'and, not ' . implode(', not ', $doNotPromoteEntries);&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this kind of works. The issue I'm running into is the homepage is now showing an entry post... which is should not be. So, my modifying the criteria has caused this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more eloquent or better way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2018-10-08T20:45:48.707" Title="Excluding entries based on a tag across whole site" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;craft.entries&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27985" PostTypeId="2" ParentId="27975" CreationDate="2018-10-08T21:51:18.520" Score="2" Body="&lt;p&gt;Maybe &lt;a href=&quot;https://github.com/craftcms/cms/issues/3349&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; is what you are looking for &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the deleteFilesAndFoldersInVolume permission is not set, the user cannot edit the image. And dragging files into other folders result in an error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-08T21:51:18.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27986" PostTypeId="1" CreationDate="2018-10-08T21:53:56.173" Score="1" ViewCount="112" Body="&lt;p&gt;I'm working at getting error messages sent from my plugin to my template (on the front end), when there is no session (no logged in user). &#xA;The plugin is for LDAP authentication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: For clarification, this plugin (and the error messages) will be for as-of-yet un-logged-in users.  Would a session structure be the only way to get the messages to those end users?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried this (below), but I get the error message (below):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;code in the plugin controller:   &lt;code&gt;craft()-&amp;gt;userSession-&amp;gt;setFlash('msg_template',&quot;Credentials were not accepted.&quot;)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;code in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.app.session.getFlash('msg_template') %} &#xA;&#xA;{% if message|length &amp;gt; 0 %}&#xA;{{message}} &#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Neither the property &quot;session&quot; nor one of the methods &quot;session()&quot;, &quot;getsession()&quot;/&quot;issession()&quot; or &quot;__call()&quot; exist and have public access in class &quot;Craft\AppVariable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="6879" LastEditDate="2018-10-09T19:54:05.753" LastActivityDate="2018-10-10T23:57:18.653" Title="Sending Error Message to Template With No Logged In User - Craft 2" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;error-message&gt;&lt;craft2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27987" PostTypeId="2" ParentId="27986" CreationDate="2018-10-08T22:09:06.947" Score="1" Body="&lt;p&gt;You are mixing Craft 3 code with Craft 2. There is no native way to access the session in Craft 2 via Twig so you need to inject the functions with your plugin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See a working example &lt;a href=&quot;https://craftcms.stackexchange.com/a/16746/5557&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-08T22:09:06.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27988" PostTypeId="2" ParentId="6798" CreationDate="2018-10-09T00:52:41.330" Score="1" Body="&lt;p&gt;Your entry is tied to the category via the field you have made. You can access the field like every other field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.categoryFieldName.one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will get the first one&lt;/p&gt;&#xA;" OwnerUserId="8876" LastActivityDate="2018-10-09T00:52:41.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27989" PostTypeId="2" ParentId="27972" CreationDate="2018-10-09T02:31:21.873" Score="1" Body="&lt;p&gt;So after a bit of trial an error, setting a protocol for the &lt;code&gt;siteUrl&lt;/code&gt; in &lt;code&gt;config/general.php&lt;/code&gt; fixed it! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex. I had &lt;code&gt;'siteUrl' =&amp;gt; 'domain.tld'&lt;/code&gt; so I changed it to &lt;code&gt;'siteUrl' =&amp;gt; '//domain.tld'&lt;/code&gt; and all is well.&lt;/p&gt;&#xA;" OwnerUserId="7004" LastActivityDate="2018-10-09T02:31:21.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27990" PostTypeId="2" ParentId="27980" CreationDate="2018-10-09T02:57:52.750" Score="1" Body="&lt;p&gt;For anyone who runs into the same error, my Craft 2 site had 3 environment settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dev, Staging and Production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page covers how to carry those settings into Craft 3&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/config/environments.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/environments.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to @lenka for pointing me in the right direction!&lt;/p&gt;&#xA;" OwnerUserId="5957" LastActivityDate="2018-10-09T02:57:52.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27991" PostTypeId="1" CreationDate="2018-10-09T03:32:09.370" Score="1" ViewCount="59" Body="&lt;p&gt;I am having a website with 4 languages and has two main sections B2B and B2C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the final URLs will look like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;@web/b2b/de&lt;/li&gt;&#xA;&lt;li&gt;@web/b2b/&lt;/li&gt;&#xA;&lt;li&gt;@web/de (b2c uses no indication in the link - is default)&lt;/li&gt;&#xA;&lt;li&gt;@web/&lt;/li&gt;&#xA;&lt;li&gt;@web/tc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some articles might be at b2b, some at b2c and some might be at both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach to this is to have two site groups&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;B2B&lt;/li&gt;&#xA;&lt;li&gt;B2C &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and then for each of these categories is to have the site in it's 4 different languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this approach correct?&lt;/p&gt;&#xA;" OwnerUserId="8891" LastEditorUserId="57" LastEditDate="2018-10-09T23:50:35.880" LastActivityDate="2018-10-09T23:50:35.880" Title="Correct Multisite MultiLanguage Approach" Tags="&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27992" PostTypeId="1" AcceptedAnswerId="27993" CreationDate="2018-10-09T04:48:46.660" Score="1" ViewCount="428" Body="&lt;p&gt;I have Single Section(entry) with Matrix field which contains Assets in blocks. I'm trying to fetch assets from a single Matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;element-api.php&lt;/code&gt; code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use craft\elements\Entry;&#xA;use craft\elements\MatrixBlock;&#xA;use craft\elements\Asset;&#xA;use craft\helpers\UrlHelper;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'api/portfolio/&amp;lt;blockId:\d+&amp;gt;.json' =&amp;gt; function($blockId) {&#xA;      return [&#xA;        'elementType' =&amp;gt; MatrixBlock::class,&#xA;        'criteria' =&amp;gt; ['ownerId' =&amp;gt; '4351', 'fieldId' =&amp;gt; '218', 'id' =&amp;gt; $blockId],&#xA;        'pretty' =&amp;gt; true,&#xA;      ];&#xA;    },&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Part of output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &quot;join&quot;: [&#xA;            [&#xA;                &quot;INNER JOIN&quot;,&#xA;                &quot;{{%relations}} relations&quot;,&#xA;                [&#xA;                    &quot;and&quot;,&#xA;                    &quot;[[relations.targetId]] = [[elements.id]]&quot;,&#xA;                    {&#xA;                        &quot;relations.sourceId&quot;: &quot;4402&quot;,&#xA;                        &quot;relations.fieldId&quot;: &quot;219&quot;&#xA;                    },&#xA;                    [&#xA;                        &quot;or&quot;,&#xA;                        {&#xA;                            &quot;relations.sourceSiteId&quot;: null&#xA;                        },&#xA;                        {&#xA;                            &quot;relations.sourceSiteId&quot;: &quot;1&quot;&#xA;                        }&#xA;                    ]&#xA;                ]&#xA;            ]&#xA;        ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so it looks like I'm trying to access related field id 219 which is Assets field inside Matrix block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fields structure:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ccw8D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ccw8D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5587" LastActivityDate="2018-10-09T05:13:40.200" Title="How do you use the Element API plugin to output Assets from Matrix block for an entry?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27993" PostTypeId="2" ParentId="27992" CreationDate="2018-10-09T05:13:40.200" Score="2" Body="&lt;p&gt;You need a &lt;a href=&quot;https://github.com/craftcms/element-api/blob/v2/README.md#transformer&quot; rel=&quot;nofollow noreferrer&quot;&gt;transformer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(MatrixBlock $element){&#xA;    return [&#xA;       'image' =&amp;gt; $element-&amp;gt;getFieldValue('assetFieldHandle')-&amp;gt;one()-&amp;gt;getUrl() &#xA;    ];&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-09T05:13:40.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27994" PostTypeId="1" CreationDate="2018-10-09T12:50:16.233" Score="1" ViewCount="99" Body="&lt;p&gt;Is it possible to create a multi language website in same domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the admin settings, I created a second site with the same domain, but with a different site language.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/&#xA;├── index.twig      --&amp;gt; default homepage template&#xA;└── de/&#xA;    └── index.twig  --&amp;gt; German homepage template&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the on section settings for second site Template &lt;code&gt;de/index&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I toggle specific parts of my templates, depending on the chosen language?&lt;/p&gt;&#xA;" OwnerUserId="8895" LastActivityDate="2018-10-09T12:50:16.233" Title="Craft 3 language switcher with same domain" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27995" PostTypeId="1" AcceptedAnswerId="27999" CreationDate="2018-10-09T15:44:16.497" Score="1" ViewCount="190" Body="&lt;p&gt;I have spreadsheet that i'm parsing and I have available to me a Entry ID and the Asset filename. Can I add the asset to the entry by the filename?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im targeting the product entry with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product = Entry::find()-&amp;gt;section('products')-&amp;gt;id($data[3]);&#xA;$productImages = ($product-&amp;gt;productImages) ? $product-&amp;gt;productImages : array();&#xA;$name = explode('?', basename($data[2])); &#xA;$pushImageId = Asset::find()-&amp;gt;filename($name[0])-&amp;gt;id; // $name[0] = myfilename.jpg&#xA;$productImages = array_push($productImages,$pushImageId);&#xA;$product-&amp;gt;productImages($productImages);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The handle for the asset field is:&#xA;&lt;code&gt;productImages&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I run this i get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Exception: Argument 1 passed to craft\services\Elements::saveElement() must implement interface craft\base\ElementInterface, instance of craft\elements\db\EntryQuery given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the answer from robin in this question &lt;a href=&quot;https://craftcms.stackexchange.com/questions/25305/how-to-save-asset-field-of-an-entry-programmatically-in-craft-3&quot;&gt;How to save Asset field of an Entry programmatically in Craft 3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It you just need to attach the asset ID's as an array. So i re-wrote the following code to create a new array of the original asset ids plus the new one. And it worked!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product = Entry::find()-&amp;gt;section('products')-&amp;gt;id($data[3])-&amp;gt;one();&#xA;$name = explode('?', basename($data[2]));&#xA;$pushImageIds = Asset::find()-&amp;gt;filename($name[0])-&amp;gt;ids(); // $name[0] = myfilename.jpg&#xA;$newProductImagesArray = array();&#xA;foreach($product-&amp;gt;productImages as $image){&#xA;    array_push($newProductImagesArray,$image-&amp;gt;id);&#xA;}&#xA;array_push($newProductImagesArray,$pushImageIds[0]);&#xA;&#xA;$product-&amp;gt;setFieldValue('productImages',$newProductImagesArray);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8759" LastEditorUserId="8759" LastEditDate="2018-10-09T20:59:07.953" LastActivityDate="2018-10-09T20:59:07.953" Title="Push/Add asset to Entry by asset filename" Tags="&lt;entries&gt;&lt;assets&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27996" PostTypeId="1" CreationDate="2018-10-09T15:56:41.353" Score="1" ViewCount="702" Body="&lt;p&gt;I'm looking to let editors determine the alignment of images in a Redactor field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't sure if it worked out of the box with Craft 3 (I'm using 3.0.9). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did find this plugin: &lt;a href=&quot;https://github.com/picdorsey/craft-redactorimageposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/picdorsey/craft-redactorimageposition&lt;/a&gt; but it looks like it is Craft 2 and I don't see any forks that are updated for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to let users in the Control Panel control alignment of images in a WYSIWYG field would be very helpful. (This link suggests using a Matrix field, but I'm not sure how that would give the user control: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/15543/using-the-redactor-rich-text-field-how-can-i-dynamically-wrap-my-images-with-a&quot;&gt;Using the Redactor rich text field, how can I dynamically wrap my images with a fancyBox link (with attributes as parameters)?&lt;/a&gt; )&lt;/p&gt;&#xA;" OwnerUserId="8814" LastEditorUserId="57" LastEditDate="2018-10-10T18:13:26.257" LastActivityDate="2018-10-20T16:54:32.633" Title="Is there a way to allow users to control alignment of images in the Redactor plugin using Craft 3" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27997" PostTypeId="2" ParentId="27996" CreationDate="2018-10-09T16:05:09.580" Score="1" Body="&lt;p&gt;It looks like the right way to do this is to tweak the redactor settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/redactor#redactor-configs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/redactor#redactor-configs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/image/#s-imageposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/docs/settings/image/#s-imageposition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do is add this key to your redactor config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;imagePosition&quot;: true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and clear your control panel cache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The option for image position shows up on the 'edit image' screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use classes to control your image alignment and you want the redactor fields to continue to be WYSIWYG, you need to share those CSS classes between the CP and your front end. This answer will probably help: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10834/where-do-i-add-custom-css-for-the-redactor-editor-in-the-craft-control-panel/10837#10837&quot;&gt;Where do I add custom css for the Redactor editor in the Craft control panel?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8814" LastEditorUserId="8814" LastEditDate="2018-10-20T16:54:32.633" LastActivityDate="2018-10-20T16:54:32.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27998" PostTypeId="1" AcceptedAnswerId="28021" CreationDate="2018-10-09T17:21:57.140" Score="2" ViewCount="103" Body="&lt;p&gt;I'm new to Craft CMS, so pardon me. I've been using the &lt;a href=&quot;https://github.com/elivz/VzAddress-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;VZ Address&lt;/a&gt; plugin to handle all our address entries, and have a couple hundred of workshop address entries already.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to use &lt;a href=&quot;https://plugins.doublesecretagency.com/smart-map/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smart Map&lt;/a&gt; to generate a map, search by zip code, for the workshop addresses that are already been created with VZ Address. How can I grab that info from VZ Address field and use it with Smart Map?&lt;/p&gt;&#xA;&lt;p&gt;Thank you for any help!&lt;/p&gt;&#xA;" OwnerUserId="8898" LastEditorUserId="45" LastEditDate="2021-01-01T07:13:12.310" LastActivityDate="2021-01-01T07:13:12.310" Title="Grabbing the existing address data to use with Smart Map" Tags="&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27999" PostTypeId="2" ParentId="27995" CreationDate="2018-10-09T19:02:17.267" Score="2" Body="&lt;p&gt;You need to fetch the asset and set it as a field value to your entry&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$pushImageId = Asset::find()-&amp;gt;filename($name[0])-&amp;gt;ids();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;id&lt;/code&gt; will display the &lt;code&gt;id&lt;/code&gt; property of your query. You won't fetch any results with it &lt;code&gt;ids()&lt;/code&gt; will return an array of asset ids&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;setFieldValue ('productImages', $productImages);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will set the relation and finally you can store the element&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: and you need to fetch the product as well. Currently you just create the query for it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-09T19:34:04.967" LastActivityDate="2018-10-09T19:34:04.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28000" PostTypeId="2" ParentId="27826" CreationDate="2018-10-09T19:45:12.100" Score="1" Body="&lt;p&gt;It seems you're setting the adjuster &lt;code&gt;$taxAdjuster-&amp;gt;amount&lt;/code&gt; to zero.  This should be the correct adjuster code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Commerce\Adjusters;&#xA;&#xA;use Craft\Commerce_LineItemModel;&#xA;use Craft\Commerce_OrderAdjustmentModel;&#xA;use Craft\Commerce_OrderModel;&#xA;&#xA;class TaxExempt_TaxAdjuster implements Commerce_AdjusterInterface&#xA;{&#xA;    public function adjust(Commerce_OrderModel &amp;amp;$order, array $lineItems = [])&#xA;    {&#xA;        $taxAdjuster = new Commerce_OrderAdjustmentModel();&#xA;&#xA;        if (craft()-&amp;gt;userSession-&amp;gt;getUser()-&amp;gt;getContent()-&amp;gt;getAttribute('userTaxExempt')) {&#xA;            $originalTax = $order-&amp;gt;baseTax;&#xA;            $order-&amp;gt;baseTax = 0;&#xA;&#xA;            $taxAdjuster-&amp;gt;type = &quot;Tax&quot;;&#xA;            $taxAdjuster-&amp;gt;name = &quot;Tax Exempt&quot;;&#xA;            $taxAdjuster-&amp;gt;description = &quot;Tax Exempt&quot;;&#xA;            $taxAdjuster-&amp;gt;amount = $originalTax;&#xA;            $taxAdjuster-&amp;gt;orderId = $order-&amp;gt;id;&#xA;            $taxAdjuster-&amp;gt;optionsJson = ['lineItemsAffected' =&amp;gt; null];&#xA;            $taxAdjuster-&amp;gt;included = false;&#xA;&#xA;            return [$taxAdjuster];&#xA;        }&#xA;&#xA;        return [];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8900" LastActivityDate="2018-10-09T19:45:12.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28001" PostTypeId="1" AcceptedAnswerId="28016" CreationDate="2018-10-09T21:35:45.630" Score="2" ViewCount="687" Body="&lt;p&gt;I really love working with Craft, especially around how easy and user friendly it is. However, I do work with React/Vue and usually I setup a node server/app that will do some routing, render views and so on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be a good idea to have a setup like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frontend: React / Vue&lt;/li&gt;&#xA;&lt;li&gt;Backend: node app that has all my public routes setup, rendering views, server side render React/Vue etc&lt;/li&gt;&#xA;&lt;li&gt;Backend no 2: Craft CMS with Element API setup&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;User requests /contact/person-1&lt;/li&gt;&#xA;&lt;li&gt;The request will be matched in my node app as a valid route&lt;/li&gt;&#xA;&lt;li&gt;Node app will make request to the API that has been setup for Craft, fetches the relevant info about Person 1, returns the result to node&lt;/li&gt;&#xA;&lt;li&gt;Node app renders the view with the data that was fetched&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this O.K. or completely nuts? Will it be ineffective or is it a good way to structure it like this when I'm in need for a nice CMS like Craft... ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me out on finding the best approach!&lt;/p&gt;&#xA;" OwnerUserId="6807" LastEditorUserId="57" LastEditDate="2018-10-11T03:50:42.587" LastActivityDate="2018-10-11T03:50:42.587" Title="Calling Craft API from node.js" Tags="&lt;structure&gt;&lt;plugin-elementapi&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28002" PostTypeId="1" AcceptedAnswerId="28006" CreationDate="2018-10-09T22:51:24.370" Score="1" ViewCount="147" Body="&lt;p&gt;I am new to Craft and I am basically inheriting a site that I now need to maintain.  I am a developer, not really a web designer, and my current task is to change the layout on the homepage.  Something simple, I thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to wrap my head around is the connection between the web content that is defined in Craft and the twig files I see in templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in website content when I look at the Homepage, I see text boxes and other content containers that appear to be where an end user could maintain &quot;changeable&quot; stuff.  Going further, I can see in Settings the &quot;Section&quot; for homepage where there is name, handle, template, etc as well as option to &quot;Edit Entry type&quot; where it seems that you don't layout the page as much as define what parts of the page will be editable content.  Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &quot;Define Your Field Layout&quot; is a bit of a misnomer?  You aren't designing the layout as much as defining what content your &quot;layout&quot; will contain?  So that leaves me with:  Where do I actually lay out the page?  Where is stuff positioned &quot;just so&quot;?  I don't see a WYSIWYG tool for that.  So, can I assume that the &quot;Entry Template&quot; listed in the section is the twig for the actual layout of the content?  In this case, there is 'index' as a value there so I should look for an index.twig that will contain the html and css for the page? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just trying to piece together the components. The last piece, if my assumptions above are correct, is that the index.twig, when I find it, will have twig markup that points back to the fields in the &quot;layout&quot; I saw in the section definition?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There just seems to be many moving parts and my past experience with CMS's is if you fail to understand how stuff hangs together then you tend to do too much work to make it work, rather than following convention.  As a developer, my first instinct is to write code, which can be a bad approach with a CMS...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just want to confirm if my understanding of the basic connections is correct..more questions after I start breaking stuff...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2018-10-10T20:53:46.347" Title="Connection between twig template and website content" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28003" PostTypeId="1" CreationDate="2018-10-10T05:47:57.017" Score="2" ViewCount="83" Body="&lt;p&gt;Is it possible to post a form to Sprout Forms in Craft 2 from a desktop app or another website?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The AJAX example in the docs mentions this - sproutForms/entries/saveEntry&#xA;What would the full URL be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did try &lt;a href=&quot;http://domainname.com/sproutForms/entries/saveEntry&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://domainname.com/sproutForms/entries/saveEntry&lt;/a&gt; but it gives an 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for reading this.&lt;/p&gt;&#xA;" OwnerUserId="8034" LastEditorUserId="57" LastEditDate="2018-10-11T00:03:55.770" LastActivityDate="2018-11-10T01:02:45.540" Title="Post to Sprout Forms plugin from an app or another website" Tags="&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28004" PostTypeId="1" AcceptedAnswerId="28010" CreationDate="2018-10-10T07:49:21.267" Score="1" ViewCount="536" Body="&lt;p&gt;In Craft 3, I want to list all the categories in a group and all the entries related to them. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="7395" LastEditorUserId="57" LastEditDate="2018-10-11T00:08:59.097" LastActivityDate="2018-10-11T00:08:59.097" Title="Element API - Entries Related to a Category" Tags="&lt;categories&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28005" PostTypeId="2" ParentId="27919" CreationDate="2018-10-10T07:53:31.487" Score="3" Body="&lt;p&gt;I don't think eager loading will help in this case because you're trying to eager load fields with only a single relationship (asset). It's not the n+1 query problem eager loading is meant to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had an asset field with multiple assets selected, you would see some benefit. But even then, if there are only a few assets, the small penalty of eager loading might not outweigh the small cost of queries for a few assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bigger gains would come from &lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html#eager-loading-nested-sets-of-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;nested relationships&lt;/a&gt;. For example, a set of related entries each with an asset for a thumbnail image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.elements.eagerLoadElements(&#xA;    className(entry),&#xA;    [entry],&#xA;    ['entriesField.image1']&#xA;) %}&#xA;&#xA;{% for item in entry.entriesField %}&#xA;    {% set image = item.image1[0] ?? null %}&#xA;    {% if image %}&#xA;        {{ image.url }}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, it might be worth noting that in your testing, it matters what data you actually use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my test, this produced 19 queries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.headerImage.one() %}&#xA;{{ asset.title }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this produced 23 queries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = entry.headerImage.one() %}&#xA;{{ asset.url }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-10-10T07:53:31.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28006" PostTypeId="2" ParentId="28002" CreationDate="2018-10-10T08:25:48.793" Score="1" Body="&lt;p&gt;Yes, I think what you're saying is completely correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Settings &gt; Sections &gt; Homepage &gt; Edit entry type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;layout&quot; here is only meant for the back end. This is just how you assign fields you want entries in that section to use and what it will look like for admins to create and edit entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Settings &gt; Sections &gt; Homepage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will show you what template is being called when there's a match for that URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the file system, your template files will be located in either &lt;code&gt;/craft/templates&lt;/code&gt; if you're using Craft 2, or just &lt;code&gt;templates&lt;/code&gt; if your using Craft 3. It's probably worth noting that these directories are usually above the web root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.&#xA;├── craft&#xA;├── templates&#xA;└── web &amp;lt;-- web root&#xA;    └── index.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're afraid of breaking things on a live site, you could create a duplicate of the site and run it locally or on another server. That's a great way to sandbox changes and play with things to see what effect they have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another great way to learn how Craft works is to try out the &lt;a href=&quot;https://github.com/craftcms/demo&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Happy Lager&quot; demo site&lt;/a&gt;. It's a pretty simple Craft site and well organized. I've see live production sites that are incredibly complex or over-engineered. I can't imagine trying to learn Craft with one of those as my only example.&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-10-10T20:53:46.347" LastActivityDate="2018-10-10T20:53:46.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28007" PostTypeId="1" CreationDate="2018-10-10T08:30:31.947" Score="2" ViewCount="67" Body="&lt;p&gt;Does anybody know if it is possible to add a column to the orders list page?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can choose the 'Foo' label, but when the page want to show the orders list I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;{&quot;error&quot;:&quot;An exception has been thrown during the rendering of a template (\&quot;Getting unknown property: craft\commerce\elements\Order::foo\&quot;).&quot;}&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Element::class,&#xA;    Element::EVENT_REGISTER_TABLE_ATTRIBUTES,&#xA;    function(RegisterElementTableAttributesEvent $e) {&#xA;        $e-&amp;gt;tableAttributes['foo'] = [&#xA;            'label' =&amp;gt; &quot;Foo&quot;&#xA;        ];&#xA;});&#xA;&#xA;Event::on(&#xA;    Order::class,&#xA;    Element::EVENT_SET_TABLE_ATTRIBUTE_HTML,&#xA;    function(SetElementTableAttributeHtmlEvent $e) {&#xA;        if($e-&amp;gt;attribute === 'foo'){&#xA;            $e-&amp;gt;html = 'BAR';&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7479" LastActivityDate="2018-10-10T08:30:31.947" Title="Add custom column to the orders list page" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28008" PostTypeId="2" ParentId="10659" CreationDate="2018-10-10T08:46:46.887" Score="4" Body="&lt;p&gt;For Craft 3 using Redactor 3, I have managed to create a small redactor plugin that toggles a class on all the links selected in redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I did it.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create your folders.&lt;/strong&gt; Create a folder called &lt;code&gt;plugins&lt;/code&gt; inside the &lt;code&gt;config/redactor/&lt;/code&gt; folder. Inside the plugin folder create a folder for your plugin. Example I created a a folder called &lt;code&gt;toggleButton&lt;/code&gt;. So the folder structure is &lt;code&gt;config/redactor/plugins/toggleButton&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create your files.&lt;/strong&gt; Create a your &lt;code&gt;js&lt;/code&gt; file and your &lt;code&gt;css&lt;/code&gt; file. It is important that the files are named the same as the folder. So in my example my files would be named &lt;code&gt;toggleButton.js&lt;/code&gt; and &lt;code&gt;toggleButton.css&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add you plugin to your redactor field.&lt;/strong&gt; In your &lt;code&gt;config/redactor&lt;/code&gt; folder you can add different redactor configs. For example I have Simple.json and Standard.json. This can then be selected in the craft admin, when you are adding your redactor field. In your selected config file add the following &lt;code&gt;&quot;plugins&quot;: [&quot;toggleButton&quot;],&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example of my Simple.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;buttons&quot;: [&quot;html&quot;, &quot;link&quot;, &quot;file&quot;],&#xA;  &quot;plugins&quot;: [&quot;toggleButton&quot;],&#xA;  &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Code your plugin.&lt;/strong&gt; In you js file you want to create your redactor plugin code. In my example I add a button that toggles all selected links to have the class button.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is my js code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(function($R) {&#xA;  $R.add('plugin', 'toggleButton', {&#xA;    translations: {&#xA;      en: {&#xA;        toggleButton: 'Button',&#xA;      },&#xA;    },&#xA;    init: function(app) {&#xA;      this.app = app;&#xA;      this.lang = app.lang;&#xA;      this.toolbar = app.toolbar;&#xA;      this.selection = app.selection;&#xA;    },&#xA;    // public&#xA;    start: function() {&#xA;      //Define the button object&#xA;      var btnObj = {&#xA;        title: this.lang.get('toggleButton'),&#xA;        api: 'plugin.toggleButton.toggle',&#xA;      };&#xA;&#xA;      //Add the button to the toolbar&#xA;      this.$button = this.toolbar.addButton('toggleButton', btnObj);&#xA;    },&#xA;    toggle: function() {&#xA;      //This is what happens on when the button is clicked&#xA;&#xA;      //Class that we will toggle&#xA;      var classToToggle = 'button';&#xA;      //Get all the links that are selected&#xA;      var selectedLinks = this.selection.getInlines({ all: true, tags: ['a'] });&#xA;&#xA;      //Loop through all the links and toggle the class&#xA;      selectedLinks.forEach(function(element) {&#xA;        //Crossbrowser toggle class&#xA;        if (element.classList) {&#xA;          element.classList.toggle(classToToggle);&#xA;        } else {&#xA;          // For IE9&#xA;          var classes = element.className.split(' ');&#xA;          var i = classes.indexOf(classToToggle);&#xA;&#xA;          if (i &amp;gt;= 0) classes.splice(i, 1);&#xA;          else classes.push(classToToggle);&#xA;          element.className = classes.join(' ');&#xA;        }&#xA;      });&#xA;    },&#xA;  });&#xA;})(Redactor);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Style your Button.&lt;/strong&gt; In your css file you want to style the links with the class button to look like buttons. So that the author sees that they have become buttons.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is my css code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a.button {&#xA;  display: inline-block;&#xA;  box-sizing: border-box;&#xA;  font-size: 14px;&#xA;  text-align: center;&#xA;  padding: 10px 20px 9px 20px;&#xA;  cursor: pointer;&#xA;  outline: none;&#xA;  border: none;&#xA;  vertical-align: middle;&#xA;  text-decoration: none;&#xA;  zoom: 1;&#xA;  position: relative;&#xA;  color: #29323d !important;&#xA;  border-radius: 2px;&#xA;  background: #eaf0f4;&#xA;  background-image: linear-gradient(#f3f6f9, #eaf0f4);&#xA;  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);&#xA;  margin-right: 5px;&#xA;  margin-bottom: 4px;&#xA;  text-decoration: none !important;&#xA;}&#xA;&#xA;a.button:hover {&#xA;  outline: none;&#xA;  color: #fff !important;&#xA;  background: #449aef !important;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you and your authors can easily make links in to buttons in your redactor field. Then it is up to you how you use that in the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/craftcms/redactor&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/redactor&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#rich-text-fields&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#rich-text-fields&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://imperavi.com/redactor/examples/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/examples/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8684" LastActivityDate="2018-10-10T08:46:46.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28009" PostTypeId="1" CreationDate="2018-10-10T08:47:14.443" Score="1" ViewCount="74" Body="&lt;p&gt;Have to update an order afterwards cause the client can choose a retail partner. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; name=&quot;submitOrder&quot; style=&quot;width: 100%&quot; onkeypress=&quot;return event.keyCode != 13;&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/update-cart&quot;&amp;gt;&#xA;    {{ redirectInput('s/partner?number=' ~ number) }}&#xA;    {{ csrfInput() }}&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; id=&quot;retailPartner&quot;&#xA;           name=&quot;fields[orderCommercePartner][]&quot;&#xA;           value=&quot;0&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; &#xA;           class=&quot;a-button  a-button--black  a-button--bold js-chooseThisPartner&quot;&#xA;           style=&quot;margin-bottom: 40px;&quot;&#xA;           value=&quot;{{ 'Choose this partner' | t }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's my form I fill the value &lt;code&gt;fields[orderCommercePartner][]&lt;/code&gt; via JS and it's filled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the order is not updated. Any Ideas what goes wrong here.  &lt;/p&gt;&#xA;" OwnerUserId="3898" LastEditorUserId="57" LastEditDate="2018-10-11T00:09:53.570" LastActivityDate="2018-10-11T00:09:53.570" Title="Update an order afterwards" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28010" PostTypeId="2" ParentId="28004" CreationDate="2018-10-10T09:11:44.163" Score="2" Body="&lt;p&gt;The slower but easier approach is to fetch all of them and search for related entries&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;'elementType' =&amp;gt; Category::class,&#xA;'criteria'    =&amp;gt; [&#xA;    'group'   =&amp;gt; 'yourGroup', &#xA;],&#xA;'paginate'    =&amp;gt; false,&#xA;'transformer' =&amp;gt; function(Category $category) {&#xA;     $entries = Entry::find()&#xA;        -&amp;gt;relatedTo($category)&#xA;        -&amp;gt;select(['title'])&#xA;        -&amp;gt;asArray()&#xA;        -&amp;gt;column();&#xA;&#xA;    return [&#xA;        'title'   =&amp;gt; $category-&amp;gt;title,&#xA;        'entries' =&amp;gt; $entries     &#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Learn more about &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Queries&lt;/a&gt; especially the different ways to fetch entries via &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/#executing-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;one(), all(), column()&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-10T09:11:44.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28011" PostTypeId="2" ParentId="28009" CreationDate="2018-10-10T09:33:54.043" Score="1" Body="&lt;p&gt;Orders can not be updated after they are completed. The only way around this at the moment is if a plugin used it's own controller action to update the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please submit a feature request here: &lt;a href=&quot;https://github.com/craftcms/commerce/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-10-10T09:33:54.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28012" PostTypeId="1" CreationDate="2018-10-10T11:14:56.440" Score="1" ViewCount="21" Body="&lt;p&gt;I am using Craft 2 and trying to forward users to the right template according to the current active site's language when they reset their password. The problem is that the reset URL that Craft creates and sends the user's email only forwards it to the primary site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more clear, if the user changed site language to Germany and sends for a reset password request, the URL sent to his email sends him to the primary site, which is the French  one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the setPasswordPath in the config file as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'setPasswordPath' =&amp;gt; array(&#xA;    'de' =&amp;gt; 'de/passwordreset'&#xA;    'fr' =&amp;gt; 'passwordreset',&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But still not working. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="8590" LastEditorUserId="57" LastEditDate="2018-10-11T00:12:12.223" LastActivityDate="2018-11-10T02:01:10.210" Title="Forward users to the right template according to the current active site's language" Tags="&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28014" PostTypeId="2" ParentId="28001" CreationDate="2018-10-10T12:03:38.697" Score="1" Body="&lt;p&gt;Sounds like you're using craft in 'headless' mode. I've heard about that for drupal, but not for craft. I don't see any reason why it wouldn't work. You get the craft UX for creating and modifying entities, but use node as a proxy and view generator. &lt;/p&gt;&#xA;" OwnerUserId="8814" LastActivityDate="2018-10-10T12:03:38.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28015" PostTypeId="1" CreationDate="2018-10-10T12:19:59.360" Score="1" ViewCount="61" Body="&lt;p&gt;First time using Commerce and made pretty good progress, but... I need to collect a few bits of information at the &lt;strong&gt;cart&lt;/strong&gt; stage. The site is selling conference tickets, and I need to know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;if the delegate has any dietary requirements&lt;/li&gt;&#xA;&lt;li&gt;whether or not they have been asked to speak&lt;/li&gt;&#xA;&lt;li&gt;and if they have, to provide a short bio&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm aware of the &lt;code&gt;{{ item.note }}&lt;/code&gt; tag, which I'm using for the dietary requirements. But how can I capture the other two fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1109" LastEditorUserId="57" LastEditDate="2018-10-11T03:51:38.983" LastActivityDate="2018-10-11T03:51:38.983" Title="Multiple cart fields/notes" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28016" PostTypeId="2" ParentId="28001" CreationDate="2018-10-10T12:43:17.473" Score="1" Body="&lt;p&gt;So you can definitely do this... the article &lt;a href=&quot;https://nystudio107.com/blog/using-vuejs-graphql-to-make-practical-magic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using VueJS + GraphQL to make Practical Magic&lt;/a&gt; has a detailed explanation of how to accomplish this using the CraftQL plugin and GraphQL... which I think you may find much nicer to work with than custom Element API endpoint(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However you can definitely do it with an Element API endpoint as well. It's just a bit more work, and a bit more in PHP-land.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-10T12:43:17.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28017" PostTypeId="2" ParentId="28015" CreationDate="2018-10-10T16:55:07.993" Score="1" Body="&lt;p&gt;Paul's suggestion of using order fields worked perfectly.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-10-10T16:55:07.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28018" PostTypeId="2" ParentId="27915" CreationDate="2018-10-10T17:41:37.490" Score="1" Body="&lt;p&gt;At least with the &lt;a href=&quot;https://github.com/craftcms/ckeditor/releases/tag/1.0.0-beta.2&quot; rel=&quot;nofollow noreferrer&quot;&gt;1.0.0-beta2&lt;/a&gt; release of the plugin (which is using an old  CKEditor 5 Developer Preview v0.11.0) build, an empty field will will output an &lt;code&gt;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&lt;/code&gt; tag pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This behavior might change once it gets updated to a stable release.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kinda lame, but for now you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.id(2).one() %}&#xA;&#xA;{% set emptyCKEditor = &quot;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&quot; %}&#xA;&#xA;{% if entry.ckeditor == emptyCKEditor %}&#xA;    EMPTY&#xA;{% else %}&#xA;    NOT EMPTY&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-10T17:41:37.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28019" PostTypeId="2" ParentId="27763" CreationDate="2018-10-10T18:23:25.880" Score="1" Body="&lt;p&gt;Check your phperrors.log and see if there are any errors with your 503 template. As you posted, if it encounters any errors in the template, it will just render the 503 error message instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was confounded by the same issue and found it was catching an error with my include statement. Even though the file hadn't changed, Craft3 was throwing an exception where Craft2 never cared before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the log, it'll spit out the stack trace after the human-readable error, so you might want to search for the date you were testing (format example: 10-Oct-2018). There it should say what the error was and where it occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2018-10-10T18:23:25.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28020" PostTypeId="1" AcceptedAnswerId="28022" CreationDate="2018-10-10T18:26:20.007" Score="1" ViewCount="68" Body="&lt;p&gt;I'm having trouble limiting next/previous links in one channel to articles by the author.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;next/previous links are working correctly on the regular blog but when included on the DJ blog I get &lt;code&gt;unknown property errors&lt;/code&gt; in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;strong&gt;merge&lt;/strong&gt; line below pagination appears to work, but includes DJ posts not by the current Dj.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;url looks like &lt;code&gt;https://domain.com/djs/503/firstName-lastName&lt;/code&gt; where 503 is the author.id&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set parameters for prev/next elements list #}&#xA;{% set params = craft.entries.section(channel).orderBy('title asc') %}&#xA;&#xA;{# if djs channel limit to author based on url segment 2 which is author id #}&#xA;{% if craft.app.request.segment(1) == 'djs' %}&#xA;  {# get dj to relate and limit next/prev #}&#xA;  {% set author = craft.app.request.getSegment(2) %}&#xA;  {# {% set dj = craft.users.id(author).one() %} #}&#xA;&#xA;  {# {% set params = craft.entries.section('djBlog').relatedTo(author).orderBy('title asc') %} #}&#xA;&#xA;  {% set params = params | merge({ relatedTo: author }) %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below code is working on all other templates except the DJ blog where I need to restrict pagination to posts by the current author. Only including here in case it may be relevant though I don't think so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;entry-pagination grid-container&quot;&amp;gt; {# grid-container #}&#xA;  &amp;lt;div class=&quot;grid-x grid-padding-x&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;cell small-12 {% if backToPath == 'the-word-for-you-today' %}medium-12{% else %}medium-8 medium-offset-2{% endif %} next-prev&quot;&amp;gt;&#xA;&#xA;      {% if prevEntry %}        &#xA;        &amp;lt;a href=&quot;{{ prevEntry.url }}&quot; class=&quot;prev-blog&quot;&amp;gt;&#xA;          {#&amp;lt;img src=&quot;/assets/images/previous.png&quot; alt=&quot;&quot;&amp;gt;#}&#xA;          {{ macros.icon(&quot;next&quot;, &quot;icon-blue&quot;, &quot;40&quot;, &quot;40&quot;) }}&#xA;           Previous&#xA;        &amp;lt;/a&amp;gt;&#xA;      {% else %}&#xA;        &amp;lt;a href=&quot;&quot; class=&quot;prev-blog&quot; disabled=&quot;true&quot;&amp;gt;&#xA;          {#&amp;lt;img src=&quot;/assets/images/previous.png&quot; alt=&quot;&quot;&amp;gt;#}&#xA;          {{ macros.icon(&quot;next&quot;, &quot;icon-blue&quot;, &quot;40&quot;, &quot;40&quot;) }}&#xA;           Previous&#xA;        &amp;lt;/a&amp;gt;    &#xA;      {% endif %}&#xA;&#xA;      {% if backTo == 'true' %}&#xA;        &amp;lt;a href=&quot;/{{ backToPath }}&quot; class=&quot;button&quot;&amp;gt;&#xA;          Back to {{ backToTitle }}&#xA;          {# &amp;lt;img src=&quot;/assets/images/previous.png&quot; alt=&quot;&quot;&amp;gt; #}&#xA;        &amp;lt;/a&amp;gt;&amp;lt;!-- /.button --&amp;gt;&#xA;      {% endif %}&#xA;&#xA;&#xA;      {% if nextEntry %}&#xA;        &amp;lt;a href=&quot;{{ nextEntry.url }}&quot; class=&quot;next-blog&quot;&amp;gt;&amp;lt;span&amp;gt;Next&amp;lt;/span&amp;gt;{{ macros.icon(&quot;next&quot;, &quot;icon-blue&quot;, &quot;40&quot;, &quot;40&quot;) }}&amp;lt;/a&amp;gt;&#xA;      {% else %}&#xA;        &amp;lt;a href=&quot;&quot; class=&quot;next-blog&quot; disabled=&quot;true&quot;&amp;gt;&amp;lt;span&amp;gt;Next&amp;lt;/span&amp;gt;{{ macros.icon(&quot;next&quot;, &quot;icon-blue&quot;, &quot;40&quot;, &quot;40&quot;) }}&amp;lt;/a&amp;gt;&#xA;      {% endif %}&#xA;    &amp;lt;/div&amp;gt;&amp;lt;!-- /.cell small-12 --&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&amp;lt;!-- /.grid-x grid-padding-x --&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;!-- /.grid-container --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2018-10-11T03:52:29.747" LastActivityDate="2018-10-11T03:52:29.747" Title="Pagination: Next/Previous related to author" Tags="&lt;pagination&gt;&lt;relatedto&gt;&lt;author&gt;&lt;previous-next&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28021" PostTypeId="2" ParentId="27998" CreationDate="2018-10-10T19:37:06.880" Score="1" Body="&lt;p&gt;I'd recommend migrating all of your map data into a Smart Map Address field. Once you've got everything contained within Smart Map, it will be much easier to render maps and conduct proximity searches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to migrate would be to use something like &lt;a href=&quot;https://github.com/verbb/feed-me&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me&lt;/a&gt;...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a simple JSON or RSS feed which contains only (A) the entry ID, and (B) the VZ Address data.&lt;/li&gt;&#xA;&lt;li&gt;Pull that feed right back into the same site, putting the address data into your Smart Map field.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Once you’ve migrated to Smart Map, it opens up a lot more possibilities for using that data!&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-10-10T19:37:06.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28022" PostTypeId="2" ParentId="28020" CreationDate="2018-10-10T19:40:22.357" Score="1" Body="&lt;p&gt;You are trying to merge an object of type &lt;code&gt;ElementQuery&lt;/code&gt; with an array so your object will be transformed as an array and merged with the new array. Of course you'll end up having an array instead of a query so you can't execute it in order to fetch the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of merging it, why not setting the parameter directly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do param.authorId(author) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore authors are not related to entries  (except you set them in an additional field) &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-10T19:40:22.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28023" PostTypeId="1" CreationDate="2018-10-10T19:50:46.743" Score="1" ViewCount="191" Body="&lt;p&gt;I am trying build a hub of sorts using Craft 3. I want the main site to be the hub which manages most of the data, and then subsequent sites are built on top of that, relating where necessary so as to normalize the core data. I do &lt;strong&gt;NOT&lt;/strong&gt; want the entries to propagate from the core site to the sub sites. I want them to only exist in the Core Site and be related to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the basic site structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Core Site En (coresite.com)&lt;/li&gt;&#xA;&lt;li&gt;Core Site Fr (coresite.com/fr)&lt;/li&gt;&#xA;&lt;li&gt;Sub Site En (subsite.coresite.com)&lt;/li&gt;&#xA;&lt;li&gt;Sub Site Fr (subsite.coresite.com/fr)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I then have an entry on Sub Site with a related Entries field. Since the entries do not propagate, when you try to select an entry, the list of options is empty. To fix this I check &quot;Relate entries from a specific site?&quot;. The problem is I can only choose one site, forcing me to choose either the EN or FR version of the Core Site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I choose EN that works fine, but when I'm on Sub Site FR and access the related entry, it's in English and doesn't respect the translated version of it on Core Site FR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to be a big trade off in the decision to treat languages as sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing?&lt;/p&gt;&#xA;" OwnerUserId="5479" LastActivityDate="2018-10-10T21:08:10.403" Title="Craft 3 Multi Site - Have a related entries field relate to another site, but respect localization" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28024" PostTypeId="2" ParentId="28023" CreationDate="2018-10-10T21:08:10.403" Score="2" Body="&lt;p&gt;You can use a matrix field with a block and entries field for each sub-site.&lt;/p&gt;&#xA;" OwnerUserId="31" LastActivityDate="2018-10-10T21:08:10.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28025" PostTypeId="1" CreationDate="2018-10-10T21:45:54.067" Score="1" ViewCount="75" Body="&lt;p&gt;I have a Countries dropdown menu for signing up that i didn't have before. It used to just be a text field where they can input their own country. It works on the front end sign up form properly, but for the users who don't have the country selected from the new dropdown need to select a country. I have the dropdown on a front end profile form, however when the user &quot;updates&quot; their profile if they don't choose the country it just resets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I signed in and my country is set to USA and i go to my account to update my password, it resets what's selected on the countries dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to show the County dropdown for the users who hasn't selected their countries and if the user already selected their country to just show the value they selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below is the code for the select.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdownField = craft.fields.getFieldbyHandle('country') %}&#xA;&amp;lt;label for=&quot;country&quot;&amp;gt;Country&amp;lt;/label&amp;gt;&#xA;&amp;lt;select class=&quot;form-control&quot; id=&quot;country&quot; name=&quot;fields[country]&quot;&amp;gt;&#xA;    {% for option in dropdownField.settings.options %}&#xA;        &amp;lt;option value=&quot;{{ option.value }}&quot; &amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-10-10T22:02:16.137" Title="User Account Form Dropdown" Tags="&lt;craft3&gt;&lt;users&gt;&lt;form&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28026" PostTypeId="1" CreationDate="2018-10-10T21:54:21.910" Score="1" ViewCount="85" Body="&lt;p&gt;We have a freeform form on a site's contact page. In that form there's a dynamic recipient drop-down field for Subject which emails a different person on the team depending on the subject (functionality built into freeform). We also need to send a auto response to the sender but only if they select a specific option for subject. Any ideas how to go about this? Example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Interested in working together&quot; - emails person 1&lt;/li&gt;&#xA;&lt;li&gt;&quot;Business proposal&quot; - emails person 2&lt;/li&gt;&#xA;&lt;li&gt;&quot;Careers enquiry&quot; - emails person 1 AND sends an email to the person who submitted the form&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="642" LastEditorUserId="642" LastEditDate="2018-10-23T08:46:21.823" LastActivityDate="2018-10-23T08:46:21.823" Title="How can I set an auto respond email based on drop-down?" Tags="&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28027" PostTypeId="2" ParentId="28025" CreationDate="2018-10-10T22:02:16.137" Score="2" Body="&lt;p&gt;You need to check the &lt;code&gt;currentUser&lt;/code&gt; country if it's the same as the option value -&gt; select the option &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;option {{ currentUser.country.value == option.value? 'selected' : '' }} value=&quot;{{ option.value }}&quot; &amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-10T22:02:16.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28029" PostTypeId="2" ParentId="27986" CreationDate="2018-10-10T23:57:18.653" Score="0" Body="&lt;p&gt;Craft 2 doesn't have a &lt;code&gt;craft.app&lt;/code&gt; variable you can use like Craft 3 does, but there is a &lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.session.html#getflash-key-defaultvalue-delete&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;craft.session.getFlash()&lt;/code&gt;&lt;/a&gt; exposed to the templates in Craft 2 that you can use.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-10T23:57:18.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28030" PostTypeId="2" ParentId="28003" CreationDate="2018-10-11T00:06:57.023" Score="1" Body="&lt;p&gt;Assuming you're using a hidden &lt;code&gt;action&lt;/code&gt; input, then &lt;code&gt;sproutForms/entries/saveEntry&lt;/code&gt; should be correct.  You can see that in the Craft docs here: &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/controllers.html#posting-to-controller-actions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/controllers.html#posting-to-controller-actions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not using that input, or you're constructing the URL to post to manually, then it will likely be &lt;code&gt;actions/sproutForms/entries/saveEntry&lt;/code&gt; instead, assuming you have set a custom &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#actiontrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;actionTrigger&lt;/a&gt; in your general config.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-11T00:06:57.023" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28031" PostTypeId="2" ParentId="28012" CreationDate="2018-10-11T00:13:57.490" Score="1" Body="&lt;p&gt;I'm not sure there's a good solution for this in Craft 2 without some custom plugin logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be fair, this was the same behavior in Craft 3 until &lt;a href=&quot;https://github.com/craftcms/cms/issues/3029&quot; rel=&quot;nofollow noreferrer&quot;&gt;pretty recently&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to comment on that Github issue to see about the feasibility of backporting something to Craft 2 for this.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-11T00:13:57.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28032" PostTypeId="1" CreationDate="2018-10-11T07:37:56.523" Score="1" ViewCount="228" Body="&lt;p&gt;First I illustrate the way I set up guest entry form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have channels &lt;del&gt;&lt;code&gt;blog&lt;/code&gt;&lt;/del&gt; &lt;code&gt;product&lt;/code&gt; and &lt;del&gt;&lt;code&gt;comment&lt;/code&gt;&lt;/del&gt; &lt;code&gt;cart&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guest entry submits to the &lt;del&gt;&lt;code&gt;comment&lt;/code&gt;&lt;/del&gt; &lt;code&gt;cart&lt;/code&gt; channel. Form lives in template which I use to show &lt;del&gt;blog's&lt;/del&gt; product's entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;Now I just send required field title which won't get passed by validation unless it isn't blank.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://github.com/craftcms/guest-entries#settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guest Entries settings&lt;/a&gt; to show my &lt;del&gt;blog's&lt;/del&gt; product's content along with my guest entry form I have to change the name of &lt;code&gt;entryVariable&lt;/code&gt; key from &lt;code&gt;entry&lt;/code&gt; to whatever not taken variable name let's say &lt;code&gt;entryError&lt;/code&gt; in an event of validation error to not overwrite &lt;del&gt;blog's&lt;/del&gt; product's variable &lt;code&gt;entry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In short this is how the template looks like when &lt;del&gt;blog&lt;/del&gt; product entry load.&lt;/strong&gt; This is just part of the form which is executed when first item is added to the &lt;code&gt;cart&lt;/code&gt; matrix field in &lt;code&gt;cart&lt;/code&gt; channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Product's title #}&#xA;{{ entry.title }}&#xA;&#xA;{# Product's text #}&#xA;{{ entry.text }}&#xA;&#xA;&#xA;{# Show form error #}&#xA;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&#xA;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;guestEntries/saveEntry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;2&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;title&quot; value=&quot;Some dynamic title&quot;&amp;gt;&#xA;&#xA;&#xA;    {# Matrix field &quot;cart&quot; #}&#xA;    {# Block type field we want the product to save in. #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[cart][new1][type]&quot; value=&quot;product&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;fields[cart][new1][fields][productTitle]&quot; value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;&#xA;    {# Quantity #}&#xA;    &amp;lt;label&amp;gt;Quantity *&amp;lt;/label&amp;gt;&#xA;    &amp;lt;select id=&quot;qntySlct&quot; name=&quot;fields[cart][new1][fields][productQuantity]&quot;&amp;gt;&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;--Please, select the quantity--&amp;lt;/option&amp;gt;&#xA;        {% for i in 1..10 %}&#xA;            &amp;lt;option value=&quot;{{ i }}&quot;{% if productQuantity == i %} selected{% endif %}&amp;gt;{{ i }}&amp;lt;/option&amp;gt;&#xA;        {% endfor %}&#xA;        &amp;lt;option value=&quot;&quot;&amp;gt;I need more&amp;lt;/option&amp;gt;&#xA;    &amp;lt;/select&amp;gt;&#xA;&#xA;    {# Error message #}&#xA;    {% if entryError is defined %}&#xA;        &amp;lt;div class=&quot;errMsg&quot;&amp;gt;&#xA;            {{ errorList(entry.getErrors('productQuantity')) }}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Form submits if &lt;del&gt;title&lt;/del&gt; quantity is defined and if not &lt;strong&gt;I get&lt;/strong&gt; &lt;code&gt;entryError&lt;/code&gt; &lt;strong&gt;defined but don't get the &lt;del&gt;title's&lt;/del&gt; quantity's  error shown&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The warning of &lt;del&gt;title's&lt;/del&gt; quantity's error is logged in the Application Log.&lt;br&gt;&#xA;Have anyone came accross this unlikely issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;&lt;strong&gt;CORRECTION&lt;/strong&gt;&lt;/del&gt; &lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to the Robin's comment bellow to debug it with &lt;code&gt;{{ dump() }}&lt;/code&gt; function I found out that &lt;del&gt;input&lt;/del&gt; quantity field &lt;del&gt;with variable &lt;code&gt;title&lt;/code&gt;&lt;/del&gt; &lt;strong&gt;is returning the error value&lt;/strong&gt;. &lt;del&gt;However I didn't mentioned in my question that &lt;strong&gt;I'm actually posting/retrieving to/from matrix field&lt;/strong&gt; as I didn't want to make the question pointlessly complicated with all those fields I've set.&lt;/del&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;del&gt;I've been misleaded/figured that to access field's variable in &lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ errorList(entry.getErrors('variable')) }}&lt;/code&gt; for example, is not valid for matrix field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can't find any info on &lt;strong&gt;how to access matrix field for entry validation&lt;/strong&gt; using: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% macro errorList(errors) %}{% endmacro %}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-10-17T09:00:21.117" LastActivityDate="2018-11-16T09:03:20.660" Title="Matrix field validation on guest entry submission" Tags="&lt;guest-entries&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28033" PostTypeId="1" CreationDate="2018-10-11T09:05:54.687" Score="1" ViewCount="186" Body="&lt;p&gt;Like the title says, I cannot output order PDFs in Commerce 2 and not sure how to debug this. Anyone else encountered the same issue?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2019-04-10T07:02:05.410" Title="&quot;An error occurred while generating this PDF.&quot; in Commerce 2" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28034" PostTypeId="1" AcceptedAnswerId="28037" CreationDate="2018-10-11T09:53:44.217" Score="2" ViewCount="993" Body="&lt;p&gt;I am trying to set up the URIs for some nested categories in Craft 3 but am having some issues. My structure is basically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;service-one&#xA;|-subservice-one-a&#xA;|-subservice-one-b&#xA;service-two&#xA;|-subservice-two-a&#xA;|-subservice-two-b&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have set my &lt;code&gt;Category URI Format&lt;/code&gt; to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;what-we-do/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is working fine, however I would like the URI for the nested categories to look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;what-we-do/service-one/subservice-one-a&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rather than what I have currently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;what-we-do/subservice-one-a&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="8797" LastEditorUserId="8797" LastEditDate="2018-10-11T10:19:16.183" LastActivityDate="2018-10-15T04:52:57.523" Title="URI for nested categories in Craft 3" Tags="&lt;craft3&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28035" PostTypeId="2" ParentId="27948" CreationDate="2018-10-11T12:36:05.400" Score="2" Body="&lt;p&gt;There's no way of doing that natively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're cropping an image with Craft, it zooms in as little as possible.  So, if you have an image that's 800x600 and you crop a square at 500x500, Craft won't zoom in at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When cropping is finished, the next task is to get the focal point as close to the center of the final image without crossing out of bounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider if Craft tried to put the focal point in the center no matter what. If the focal point was 100 pixels away from an edge and you wanted a square of 300x300, that would result in 1.5x zoom which would be a less desired outcome for many people.&lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2018-10-11T12:46:11.520" LastActivityDate="2018-10-11T12:46:11.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28036" PostTypeId="2" ParentId="28034" CreationDate="2018-10-11T16:32:32.913" Score="2" Body="&lt;p&gt;You should be able to set your Category URI Format to &lt;code&gt;{parent.slug}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are on the parent it will only show the parent category. If they are on the child it will show both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd set it to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;what-we-do/{parent.slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is also this answer if you need the path beyond 1 level:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/23610/parent-uri-slug?rq=1&quot;&gt;{parent.uri}/{slug}&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2018-10-11T16:42:31.897" LastActivityDate="2018-10-11T16:42:31.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28037" PostTypeId="2" ParentId="28034" CreationDate="2018-10-11T18:20:32.270" Score="8" Body="&lt;p&gt;You can actually use a bit of Twig logic to determine your category URI formats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this for your &lt;strong&gt;Category URI Format&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent ? parent.uri : 'what-we-do'}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is just a more compact way of doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if parent %}{{ parent.uri }}{% else %}what-we-do{% endif %}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will only add 'what-we-do' to the URI if the current category doesn't have a parent (top-level category). Otherwise, it prepends the entire parent's URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should give you URIs like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/what-we-do/service-one&#xA;/what-we-do/service-one/subservice-one-a&#xA;/what-we-do/service-one/subservice-one-b&#xA;/what-we-do/service-one/subservice-one-b/subservice-one-b-nested&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-10-15T04:52:57.523" LastActivityDate="2018-10-15T04:52:57.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28039" PostTypeId="2" ParentId="21982" CreationDate="2018-10-11T19:05:03.733" Score="2" Body="&lt;p&gt;You can use Twig logic in you &lt;strong&gt;Category URL Format&lt;/strong&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent ? parent.uri : group.handle }/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will prepend the category group's handle (main, about, funding, etc.) if it's a top-level category (no parent). Otherwise it prepends the parent category's full URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given you have a Category Group called &lt;strong&gt;&quot;About&quot;&lt;/strong&gt; with the handle &lt;strong&gt;&quot;about,&quot;&lt;/strong&gt; and that group has nested categories like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|-- cat-1&#xA;|   |-- cat-1-1&#xA;|   |-- cat-1-2&#xA;|       |-- cat-1-2-1&#xA;|&#xA;|-- cat-2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll get URIs like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/about/cat-1&#xA;/about/cat-1/cat-1-1&#xA;/about/cat-1/cat-1-2&#xA;/about/cat-1/cat-1-2/cat-1-2-1&#xA;/about/cat-2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="273" LastActivityDate="2018-10-11T19:05:03.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28042" PostTypeId="2" ParentId="15251" CreationDate="2018-10-11T21:09:47.997" Score="3" Body="&lt;p&gt;Another way for Craft 3&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{# Create an entry query with the 'section' and 'limit' parameters #}&#xA;{% set entryQuery = craft.entries()&#xA;    .section('Blog')&#xA;    .search('entryColor:green')&#xA;    .limit(10) %}&#xA;                &#xA;{# Fetch the entries. #}&#xA;{% set entries = entryQuery.all() %}&#xA;&#xA;{% if entries|length &amp;gt; 0 %}&#xA;    {% for entry in entries %}&#xA;        {{ entry.title }}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="437" LastEditDate="2020-12-02T21:20:56.380" LastActivityDate="2020-12-02T21:20:56.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28044" PostTypeId="1" AcceptedAnswerId="28091" CreationDate="2018-10-11T21:35:27.937" Score="1" ViewCount="99" Body="&lt;p&gt;I am wanting to hook into all my redactor fields content before rendering and update any inline links to include a title=&quot;&quot; attribute. Is it possible to hook into the field before it is rendered? With PHP or in settings (&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imperavi.com/redactor/docs/settings/&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8759" LastActivityDate="2018-10-16T00:09:01.863" Title="Can you hook into a Redactor field before render?" Tags="&lt;redactor&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28045" PostTypeId="2" ParentId="27976" CreationDate="2018-10-12T00:18:46.630" Score="4" Body="&lt;p&gt;Stripe &lt;a href=&quot;https://stripe.com/docs/api#balance_transaction_object-amount&quot; rel=&quot;nofollow noreferrer&quot;&gt;stores the amount in cents&lt;/a&gt;. If you want to format it from the &lt;code&gt;subscriptionPlanData.plan.amount&lt;/code&gt; variable in your template you would need to divide by 100 first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ (subscriptionPlanData.plan.amount / 100)|currency }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="93" LastActivityDate="2018-10-12T00:18:46.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28046" PostTypeId="1" CreationDate="2018-10-12T00:47:21.773" Score="1" ViewCount="319" Body="&lt;p&gt;Is there any good practice to how to serve mobile pages differently from Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to achieve is the following, right now we have pages like:&#xA;&lt;a href=&quot;http://myawsomecraftpage.com/stories/aaa-bbb-ccc&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://myawsomecraftpage.com/stories/aaa-bbb-ccc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template we are doing many things differently, if the browser is mobile, or not mobile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to split the template, and have 1 for mobile 1 for desktop. The issue I also would like to cache this pages (ofc differently for mobile, and for desktop)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the best practice would be to have pages like:&#xA;&lt;a href=&quot;http://myawsomecraftpage.com/m/stories/aaa-bbb-ccc&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://myawsomecraftpage.com/m/stories/aaa-bbb-ccc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue here this is not supported in Craft routing... I mean to generate mobile-aware URL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So another option I guess to add another site right? like&#xA;&lt;a href=&quot;http://m.myawsomecraftpage.com/stories/aaa-bbb-ccc&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://m.myawsomecraftpage.com/stories/aaa-bbb-ccc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work I guess...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again, the issue here is we have different templates (optimization point of view) for desktop and mobile pages, and we would like to cache them (with bitz for example)&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="57" LastEditDate="2018-10-16T00:10:31.680" LastActivityDate="2018-10-16T00:10:31.680" Title="Mobile page support" Tags="&lt;templating&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28047" PostTypeId="2" ParentId="28046" CreationDate="2018-10-12T03:21:02.087" Score="2" Body="&lt;p&gt;In general, I'd discourage the idea of having separate versions of a page depending on whether it is mobile or not. Typically you can do this more effectively via responsive design, media breakpoints, CSS Grid, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still really want to do it, you can have a conditional like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.app.request.isMobileBrowser() %}&#xA;    {% cache using key (&quot;mobile&quot; ~ craft.app.request.pathInfo) %}&#xA;        {% include &quot;mobile-page.html&quot; %}&#xA;    {% endcache %}&#xA;{% else %}&#xA;    {% cache using key (&quot;desktop&quot; ~ craft.app.request.pathInfo) %}&#xA;        {% include &quot;desktop-page.html&quot; %}&#xA;    {% endcache %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but again, the idea of a separate mobile page vs. a desktop page is generally a bit dated these days.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-12T03:21:02.087" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28048" PostTypeId="2" ParentId="28033" CreationDate="2018-10-12T06:23:14.760" Score="1" Body="&lt;p&gt;Looks like there was a broken include in the order template. Sorted now though thanks.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-10-12T06:23:14.760" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28049" PostTypeId="1" AcceptedAnswerId="28051" CreationDate="2018-10-12T07:21:52.150" Score="1" ViewCount="785" Body="&lt;p&gt;I have used the Guest Entries to create a plugin where anonymous users can create a entry. I have a password field on each entry. Now I want the guests who have created the entry to be able to login with this password and edit the entry they created. I don't need user validation etc for this, just a single password. Is this possible in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2019-10-16T13:56:10.380" Title="Craft 3 protecting a page with a password?" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;users&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28050" PostTypeId="2" ParentId="28049" CreationDate="2018-10-12T07:46:48.200" Score="1" Body="&lt;p&gt;I don't think this is possible with Craft out the box, and would require a module / plugin to add this functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly to write the password to the database and encrypt it, so it's not stored in plain text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it would just be a case of having a controller (&lt;a href=&quot;https://docs.craftcms.com/v3/extend/coding-guidelines.html#controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/coding-guidelines.html#controllers&lt;/a&gt;) that checks this password from a form submission and unlocks the ability to edit the entry again.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2018-10-12T07:46:48.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28051" PostTypeId="2" ParentId="28049" CreationDate="2018-10-12T08:03:02.343" Score="1" Body="&lt;p&gt;I think it is possible, just follow this guide: &lt;a href=&quot;https://noahread.net/blog/create-password-protected-pages-in-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://noahread.net/blog/create-password-protected-pages-in-craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After submission you get back an &lt;code&gt;entry&lt;/code&gt; variable containing every information about the recently posted entry (the variable name can be changed in Guest Entries settings), so you can display the user her/his password after submission. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use a little different approach: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generate the password JS into a hidden field on the entry submission form, like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[quote_password]&quot; id=&quot;quote_nonce&quot; value=&quot;&quot;&amp;gt;&#xA;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    var qp = Math.random().toString(36).substring(10),&#xA;        nonce_holder = document.querySelector('#quote_nonce');&#xA;    nonce_holder.setAttribute(&quot;value&quot;, qp);&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on entry page I check if the user has set a correct password OR the user has a cookie with the password (if the user posts a correct password it is stored on the device for 2 days in a cookie) OR the user is an admin: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser %}&#xA;    {% set isAdmin = currentUser.IsInGroup('admin') %}&#xA;{% else %}&#xA;    {% set isAdmin = false %}&#xA;{% endif %}&#xA;&#xA;{% if craft.app.request.getParam('password') == entry.quote_password or getSecureCookie( 'quote_password' ) == entry.quote_password or isAdmin %}&#xA;&#xA;    {% if craft.app.request.getParam('password') == entry.quote_password %}&#xA;        {% if entry.expiryDate.timestamp is defined %}&#xA;            {% set expiryDate = entry.expiryDate.timestamp %}&#xA;        {% else %}&#xA;            {% set expiryDate = now | date_modify(&quot;+2 days&quot;).timestamp %}&#xA;        {% endif %}&#xA;&#xA;        {% do craft.cookies.setSecure('quote_password', craft.app.request.getParam('password'), expiryDate ) %}&#xA;    {% endif %}&#xA;&#xA;    ... Entry content ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5905" LastActivityDate="2018-10-12T08:03:02.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28052" PostTypeId="1" CreationDate="2018-10-12T10:50:41.897" Score="2" ViewCount="575" Body="&lt;p&gt;I've got another update issue with the following error. Can anyone help?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craftcms/cms 3.0.27 requires yiisoft/yii2-queue 2.1.0 -&amp;gt; &#xA;    satisfiable by yiisoft/yii2-queue[2.1.0] but these conflict with your requirements or minimum-stability.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;composer.json looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;&quot;description&quot;: &quot;Craft CMS&quot;,&#xA;&quot;keywords&quot;: [&#xA;&quot;craft&quot;,&#xA;&quot;cms&quot;,&#xA;&quot;craftcms&quot;,&#xA;&quot;project&quot;&#xA;],&#xA;&quot;license&quot;: &quot;MIT&quot;,&#xA;&quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;&quot;type&quot;: &quot;project&quot;,&#xA;&quot;support&quot;: {&#xA;&quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;&quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;&quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;&quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;&quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;&quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;},&#xA;&quot;require&quot;: {&#xA;&quot;craftcms/cms&quot;: &quot;3.0.23.1&quot;,&#xA;&quot;vlucas/phpdotenv&quot;: &quot;v2.4.0&quot;,&#xA;&quot;craftcms/ckeditor&quot;: &quot;1.0.0-beta.2&quot;,&#xA;&quot;craftcms/redactor&quot;: &quot;2.1.6&quot;,&#xA;&quot;cebe/markdown&quot;: &quot;1.1.2&quot;,&#xA;&quot;composer/ca-bundle&quot;: &quot;1.1.1&quot;,&#xA;&quot;composer/composer&quot;: &quot;1.6.3&quot;,&#xA;&quot;composer/semver&quot;: &quot;1.4.2&quot;,&#xA;&quot;composer/spdx-licenses&quot;: &quot;1.3.0&quot;,&#xA;&quot;craftcms/oauth2-craftid&quot;: &quot;1.0.0.1&quot;,&#xA;&quot;craftcms/plugin-installer&quot;: &quot;1.5.2&quot;,&#xA;&quot;craftcms/server-check&quot;: &quot;1.1.1&quot;,&#xA;&quot;creocoder/yii2-nested-sets&quot;: &quot;0.9.0&quot;,&#xA;&quot;danielstjules/stringy&quot;: &quot;3.1.0&quot;,&#xA;&quot;doctrine/lexer&quot;: &quot;v1.0.1&quot;,&#xA;&quot;egulias/email-validator&quot;: &quot;2.1.4&quot;,&#xA;&quot;elvanto/litemoji&quot;: &quot;1.3.1&quot;,&#xA;&quot;ezyang/htmlpurifier&quot;: &quot;v4.10.0&quot;,&#xA;&quot;guzzlehttp/guzzle&quot;: &quot;6.3.3&quot;,&#xA;&quot;guzzlehttp/promises&quot;: &quot;v1.3.1&quot;,&#xA;&quot;guzzlehttp/psr7&quot;: &quot;1.4.2&quot;,&#xA;&quot;justinrainbow/json-schema&quot;: &quot;5.2.7&quot;,&#xA;&quot;league/flysystem&quot;: &quot;1.0.44&quot;,&#xA;&quot;league/oauth2-client&quot;: &quot;2.2.1&quot;,&#xA;&quot;mikehaertl/php-shellcommand&quot;: &quot;1.2.5&quot;,&#xA;&quot;paragonie/random_compat&quot;: &quot;v2.0.12&quot;,&#xA;&quot;pixelandtonic/imagine&quot;: &quot;v0.7.1.3&quot;,&#xA;&quot;psr/http-message&quot;: &quot;1.0.1&quot;,&#xA;&quot;psr/log&quot;: &quot;1.0.2&quot;,&#xA;&quot;seld/cli-prompt&quot;: &quot;1.0.3&quot;,&#xA;&quot;seld/jsonlint&quot;: &quot;1.7.1&quot;,&#xA;&quot;seld/phar-utils&quot;: &quot;1.0.1&quot;,&#xA;&quot;swiftmailer/swiftmailer&quot;: &quot;v6.0.2&quot;,&#xA;&quot;symfony/console&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/debug&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/filesystem&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/finder&quot;: &quot;v3.3.6&quot;,&#xA;&quot;symfony/polyfill-mbstring&quot;: &quot;v1.8.0&quot;,&#xA;&quot;symfony/process&quot;: &quot;v3.3.6&quot;,&#xA;&quot;yiisoft/yii2&quot;: &quot;2.0.15.1&quot;,&#xA;&quot;yiisoft/yii2-bootstrap&quot;: &quot;2.0.8&quot;,&#xA;&quot;yiisoft/yii2-composer&quot;: &quot;2.0.6&quot;,&#xA;&quot;yiisoft/yii2-debug&quot;: &quot;2.0.13&quot;,&#xA;&quot;yiisoft/yii2-queue&quot;: &quot;2.0.2&quot;,&#xA;&quot;yiisoft/yii2-swiftmailer&quot;: &quot;2.1.1&quot;,&#xA;&quot;zendframework/zend-escaper&quot;: &quot;2.6.0&quot;,&#xA;&quot;zendframework/zend-feed&quot;: &quot;2.8.0&quot;,&#xA;&quot;zendframework/zend-stdlib&quot;: &quot;3.2.0&quot;,&#xA;&quot;solspace/craft3-freeform&quot;: &quot;2.4.0&quot;,&#xA;&quot;dolphiq/redirect&quot;: &quot;1.0.18&quot;&#xA; },&#xA;&quot;autoload&quot;: {&#xA;&quot;psr-4&quot;: {&#xA;  &quot;modules\\&quot;: &quot;modules/&quot;&#xA;}&#xA;},&#xA;&quot;config&quot;: {&#xA;&quot;optimize-autoloader&quot;: true,&#xA;&quot;platform&quot;: {&#xA;  &quot;php&quot;: &quot;7.0&quot;&#xA;}&#xA;},&#xA;&quot;scripts&quot;: {&#xA;&quot;post-root-package-install&quot;: [&#xA;  &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;],&#xA;&quot;post-create-project-cmd&quot;: [&#xA;  &quot;@composer dump-autoload -o&quot;,&#xA;  &quot;@php craft setup/welcome&quot;&#xA;]&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6614" LastEditorUserId="6614" LastEditDate="2018-10-30T12:36:38.327" LastActivityDate="2019-09-26T05:02:40.363" Title="Unable to update Craft: 'requires yiisoft/yii2-queue 2.1.0'" Tags="&lt;updating&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28053" PostTypeId="1" CreationDate="2018-10-12T13:13:42.087" Score="1" ViewCount="30" Body="&lt;p&gt;I'm currenty running Craft (v3) Commerce (v2) and have a difficult structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my menu now:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;single&lt;/code&gt; home page.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;single&lt;/code&gt; about page.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;channel&lt;/code&gt; blog page.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It has to be with the products in the menu, but I don't know what would be the best structure. The products are under 2 categories. So it has te be something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;single&lt;/code&gt; home page.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;single&lt;/code&gt; about page.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;channel&lt;/code&gt; blog page.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;?&lt;/code&gt; cars (products) page&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;?&lt;/code&gt; fast cars page&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fast car 1&lt;/li&gt;&#xA;&lt;li&gt;Fast car 2&lt;/li&gt;&#xA;&lt;li&gt;Fast car 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;?&lt;/code&gt; slow cars&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;?&lt;/code&gt; brand&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Slow car 1&lt;/li&gt;&#xA;&lt;li&gt;Slow car 2&lt;/li&gt;&#xA;&lt;li&gt;Slow car 3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;?&lt;/code&gt; other brand&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Slow car 4&lt;/li&gt;&#xA;&lt;li&gt;Slow car 5&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At the &lt;code&gt;?&lt;/code&gt; I don't know what is the best type of page, or maybe it has to be a category. Also, the uri for the slow car has to be: &lt;code&gt;cars/slow-cars/brand/{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone an idea what would be the best solution?&lt;/p&gt;&#xA;" OwnerUserId="8914" LastActivityDate="2018-10-12T13:13:42.087" Title="Product in nested navigation" Tags="&lt;structure&gt;&lt;elementtype&gt;&lt;menu&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28054" PostTypeId="1" AcceptedAnswerId="28066" CreationDate="2018-10-12T13:56:20.077" Score="1" ViewCount="460" Body="&lt;p&gt;When creating a new field, I received a Database Exception error - &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SQLSTATE[42000]: Syntax error or access violation: 3057 Incorrect user-level lock name '/var/www/storage/runtime/compiled_classes/ElementQueryBehavior.php'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Loading an older database backup did not resolve the error, and neither did checking out an older branch. I am unable to access the panel or the site itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Installed Plugins&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SEOmatic&lt;/li&gt;&#xA;&lt;li&gt;Element API&lt;/li&gt;&#xA;&lt;li&gt;SuperTable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be greatly appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CRLZh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CRLZh.png&quot; alt=&quot;Error Screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: After dropping/creating the database multiple times, I am now getting this error instead&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BWUVU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BWUVU.png&quot; alt=&quot;Content Behavior Not Found&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2: Here is a link to the full stack trace, which was posted to imgur due to the length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imgur.com/a/ADSvGCj&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/ADSvGCj&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8915" LastEditorUserId="8915" LastEditDate="2018-10-16T16:18:22.990" LastActivityDate="2018-10-16T16:18:22.990" Title="Incorrect user-level lock name - Local Vagrant Environment - Craft 3" Tags="&lt;craft3&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28055" PostTypeId="1" AcceptedAnswerId="28056" CreationDate="2018-10-12T14:14:03.897" Score="2" ViewCount="120" Body="&lt;p&gt;Is there an updated version for Craft 3 showing how to change the name of 'Singles' and 'Structures'? &lt;a href=&quot;https://www.youtube.com/watch?v=ObC4mhXjiOE&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=ObC4mhXjiOE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5654" LastActivityDate="2018-10-12T14:19:52.990" Title="Change name of Singles" Tags="&lt;config&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28056" PostTypeId="2" ParentId="28055" CreationDate="2018-10-12T14:19:52.990" Score="3" Body="&lt;p&gt;Add a /translations/ folder to your project root and within that folder a /fill-in-locale-here/ folder. Add a file &quot;app.php&quot; to that /translations/fill-in-locale-here/ folder which returns an array of those translations. Here's an example =&gt; &lt;a href=&quot;https://cl.ly/6e5132433d70&quot; rel=&quot;nofollow noreferrer&quot;&gt;view screenshot&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6360" LastActivityDate="2018-10-12T14:19:52.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28057" PostTypeId="1" CreationDate="2018-10-12T21:11:59.183" Score="1" ViewCount="93" Body="&lt;p&gt;I am trying to create a link that would allow a logged in user to access their profile from the front end. Basically, the user has one page they can edit from the front end when logged in, and I'd like to link to that page in the navigation. I've seen similar things done in Craft 2 but not in Craft 3. So far I tried this: but it didn't work. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntry = craft.entries.section('userProfiles').authorId(currentUser.id).limit(1) %}&#xA;&amp;lt;a href=&quot;{{ userProfiles.url() }}&quot;&amp;gt;My Profile&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as well as..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ myEntry.limit(1).url() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="8228" LastEditorUserId="57" LastEditDate="2018-10-16T00:12:37.637" LastActivityDate="2018-10-16T00:12:37.637" Title="Getting a entry link created by current User" Tags="&lt;craft3&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28058" PostTypeId="2" ParentId="28057" CreationDate="2018-10-12T21:25:41.700" Score="1" Body="&lt;p&gt;You need to fetch the entry with &lt;code&gt;one()&lt;/code&gt; keep in mind in order to be able to be an author the user needs the permission to create entries in that section &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myEntry = craft.entries.section('userProfiles').authorId(currentUser.id).one() %} &#xA;&amp;lt;a href=&quot;{{ myEntry.getUrl() }}&quot;&amp;gt;My Profile&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should also consider to code defensively and check if there is a current user and if &lt;code&gt;myEntry&lt;/code&gt; is not null &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-12T21:25:41.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28059" PostTypeId="1" AcceptedAnswerId="28060" CreationDate="2018-10-12T22:07:16.190" Score="2" ViewCount="326" Body="&lt;p&gt;I am trying to achieve the following markup for my categories navigation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h3&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Top Category One&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category One A&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category One B&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category One C&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&amp;lt;h3&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Top Category Two&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category Two A&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category Two B&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;categoryurl&quot;&amp;gt;Sub Category Two C&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If have the following code which is &lt;em&gt;nearly&lt;/em&gt; working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('projectType').all() %}&#xA;{% for category in categories %}&#xA;  {% if category.level == 1 %}&#xA;    &amp;lt;h3 class=&quot;h5&quot;&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;  {% endif %}&#xA;  {% if category.level == 2 %}&#xA;    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am just missing the wrapping &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; tags around the subcategory list items. Is there a way I can achieve this? The category group is limited to 2 levels so I can use the &lt;code&gt;category.level&lt;/code&gt; if statements without a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any pointers!&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2018-10-14T07:34:17.037" Title="Nested category navigation" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28060" PostTypeId="2" ParentId="28059" CreationDate="2018-10-12T22:20:54.910" Score="4" Body="&lt;p&gt;You'll need to use the &lt;code&gt;{% nav %}&lt;/code&gt; tag to output nested &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;s as documented here:&#xA;&lt;a href=&quot;https://craftcms.com/guides/displaying-a-navigation-for-a-structure-section&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/displaying-a-navigation-for-a-structure-section&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('projectType').all() %}&#xA;{% nav category in categories %}&#xA;  {% if category.level == 1 %}&#xA;    &amp;lt;h3 class=&quot;h5&quot;&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;  {% else %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;  {% ifchildren %}&#xA;    &amp;lt;ul class=&quot;unstyled&quot;&amp;gt;&#xA;      {% children %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;  {% endifchildren %}&#xA;{% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This answer should help too:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/a/4453&quot;&gt;https://craftcms.stackexchange.com/a/4453&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2018-10-14T07:34:17.037" LastActivityDate="2018-10-14T07:34:17.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28061" PostTypeId="1" AcceptedAnswerId="28086" CreationDate="2018-10-13T12:37:39.527" Score="1" ViewCount="84" Body="&lt;p&gt;Very new to Craft, so can someone please tell me what class/file I'd add the 'The beforeSend event' code, as I'd like to filter out some spam?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/hooks-and-events.html#hooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/hooks-and-events.html#hooks&lt;/a&gt; says that the new event listener should be added to the plugins 'init' function, but there isn't one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;many thanks&lt;/p&gt;&#xA;" OwnerUserId="8844" LastEditorUserId="8844" LastEditDate="2018-10-14T08:56:30.257" LastActivityDate="2018-10-15T21:44:02.540" Title="P&amp;T Contact Form v1 adding code for 'beforeSend'" Tags="&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28062" PostTypeId="1" AcceptedAnswerId="28064" CreationDate="2018-10-13T15:52:44.070" Score="2" ViewCount="1240" Body="&lt;p&gt;First things first: This is quite similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17817/how-to-use-the-element-api-plugin-only-when-logged-in&quot;&gt;this&lt;/a&gt;, yet different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to get authentication/login for Element-API for Craft 3 to work. Meaning I would like to restrict access to certain endpoints that require the client to be logged in and also (essentially, this is the question) have a way to login via the API (or a different way, but preferably over the API).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I got so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;use Craft;&#xA;use craft\elements\Entry;&#xA;use craft\helpers\UrlHelper;&#xA;&#xA;function requireLogin(){&#xA;    header(&quot;Access-Control-Allow-Origin: *&quot;);&#xA;    header(&quot;Access-Control-Allow-Headers: X-Requested-With&quot;);&#xA;&#xA;    if (!Craft::$app-&amp;gt;user-&amp;gt;isGuest) {&#xA;        // you are authenticated&#xA;    } else {&#xA;        // check params&#xA;        $loginName = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('loginName');&#xA;        $password = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('password');&#xA;&#xA;        if (Craft::$app-&amp;gt;user-&amp;gt;login($loginName, $password)) {&#xA;            // login success&#xA;            $user = Craft::$app-&amp;gt;userSession-&amp;gt;getUser();&#xA;        } else {&#xA;            // login fails echo message&#xA;            $errorCode = Craft::$app-&amp;gt;userSession-&amp;gt;getLoginErrorCode();&#xA;            $errorMessage = Craft::$app-&amp;gt;userSession-&amp;gt;getLoginErrorMessage($errorCode, $loginName);&#xA;            Craft::$app-&amp;gt;end(JsonHelper::encode(array('data' =&amp;gt; array( ['status' =&amp;gt; 'error','message' =&amp;gt;'wrong login']  ))));&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&#xA;return [&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;using &lt;code&gt;requireLogin();&lt;/code&gt; inside the &lt;code&gt;transformer&lt;/code&gt; of the given endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of this is copied from the before mentioned, related link. But as I'm no PHP developer I kind of struggle getting it to work.&#xA;The error I get is the following with this code:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to yii\web\User::login() must be an instance of yii\web\IdentityInterface, null given&#xA;  as a result of &lt;code&gt;Craft::$app-&amp;gt;user-&amp;gt;login($loginName, $password)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I do understand whats happening and am capable of reading the error, but I'm not very familiar with &lt;code&gt;yii&lt;/code&gt;, nor PHP. If someone could point out what needs to be done, which problems also might occur of if I'm on the wrong track or even post a working solution, I would be very grateful.&lt;/p&gt;&#xA;" OwnerUserId="5855" LastActivityDate="2018-10-13T17:49:21.453" Title="Craft 3 Element API Authentication/Login" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;login&gt;&lt;authentication&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28063" PostTypeId="1" CreationDate="2018-10-13T16:40:09.307" Score="2" ViewCount="469" Body="&lt;p&gt;Just wondering how to only query the children on subcategories. For example...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Food&#xA;├── Fruit&#xA;│   ├── Apples&#xA;│   ├── Bananas&#xA;│   └── Oranges&#xA;└── Vegetables&#xA;    ├── Brussels sprouts&#xA;    ├── Carrots&#xA;    └── Celery&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I only want to query the children directly of fruit without having to get all of the food then have to loop around. As this isn't the best practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought it would be something like ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories()&#xA;.group('food')&#xA;.ancestorOf('fruit')&#xA;.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8918" LastActivityDate="2020-04-30T21:09:41.067" Title="Craft 3 query children of sub categories" Tags="&lt;craft3&gt;&lt;categories&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28064" PostTypeId="2" ParentId="28062" CreationDate="2018-10-13T17:39:15.367" Score="1" Body="&lt;p&gt;First of all passing the password and username as query strings is one of the most insecure things you can do. It would highly suggest you to &lt;strong&gt;not&lt;/strong&gt; do that unless you want to expose your accounts to everyone with minor knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you are mixing Craft 2 with Craft 3. There is no &lt;code&gt;userSession&lt;/code&gt; in Craft 3. I don't want to post a code snipped that would work with the way you are trying since would could eventually copy it without knowing the harm it might cause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end: you should either create some kind of access token, don't pass the params via get request or do something similar. Globally passing sensitive data via url is not clever &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-13T17:49:21.453" LastActivityDate="2018-10-13T17:49:21.453" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28065" PostTypeId="1" CreationDate="2018-10-13T18:04:37.517" Score="1" ViewCount="38" Body="&lt;p&gt;On my Products details page I have 2 selects.&#xA;The 1st select list out the Primary variants. Based on the selected Primary variant the 2nd select is auto-completed in with Secondary variants that have the same Primary variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing setting this initially via an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myVariants = [] %}&#xA;&#xA;{% for variant in product.variants %}&#xA;&#xA;{% set variantId = variant.id %}&#xA;{% set Primary = variant.primary %}&#xA;{% set Secondary = variant.secondary %}&#xA;&#xA;{% if Primary not in myVariants | keys %}&#xA;    {% set myVariants = myVariants | merge({&#xA;        (Primary): [Secondary]&#xA;    }) %}&#xA;{% else %}&#xA;    {% set myVariants = myVariants | merge({&#xA;        (Primary): myVariants[Primary] | merge([Secondary])&#xA;    }) %}&#xA;{% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This outputs an array like so when dumped:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(5) { &#xA;  [&quot;0.375&quot;]=&amp;gt; array(2) { &#xA;    [0]=&amp;gt; string(5) &quot;0.125&quot; &#xA;    [1]=&amp;gt; string(5) &quot;0.415&quot; &#xA;  } &#xA;  [&quot;0.500&quot;]=&amp;gt; array(1) { &#xA;    [0]=&amp;gt; string(5) &quot;0.768&quot; &#xA;  } &#xA;  [&quot;0.625&quot;]=&amp;gt; array(1) { &#xA;    [0]=&amp;gt; string(5) &quot;1.151&quot; &#xA;  } &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So based on the selected Primary and Secondary variants a specific variant ID should be pulled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried starting with the variant IDs, then passing the Primary variant to reproduce a similar array like above but it doesn't put them in a 2nd array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, based on the selection of Primary and Secondary, not only will the ID need to be pulled but also 2 additional variants and the sku; each of which are specific to that variant.&lt;/p&gt;&#xA;" OwnerUserId="6371" LastActivityDate="2018-10-13T18:04:37.517" Title="Product variant association" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;array&gt;&lt;plugin-craftcommerce2&gt;&lt;variants&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28066" PostTypeId="2" ParentId="28054" CreationDate="2018-10-13T20:48:26.897" Score="1" Body="&lt;p&gt;I just  ran into the exact same error on my Vagrant/Homestead environment when creating a field just with the lock name '/home/vagrant/code/craft/storage/runtime/compiled_classes/ContentBehavior.php'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After getting this error the page cannot be accessed at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using SuperTable, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error itself seems to come from MySQL 5.7 where there is a character limit for the user-level lock names of 64 characters. Here the GET_LOCK statement fails. I just don't know how to fix it right now.&lt;/p&gt;&#xA;" OwnerUserId="8920" LastActivityDate="2018-10-13T20:48:26.897" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="28067" PostTypeId="1" AcceptedAnswerId="28073" CreationDate="2018-10-13T21:21:35.763" Score="1" ViewCount="453" Body="&lt;p&gt;Suddenly, I can't add any entry to a structure.&#xA;When I try to save a record, I've got &quot;Could not find a unique URI for this element“. Although, the slug is perfectly valid and unique, but whatever I type in the slug field, same message &quot;Could not find a unique URI for this element&quot;. I only got a couple of entries in this structure, so I could not have possibly hit the  'maxSlugIncrement' limit…&#xA;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="8869" LastActivityDate="2018-10-14T18:58:29.993" Title="Could not find a unique URI for this element" Tags="&lt;slug&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28068" PostTypeId="2" ParentId="28059" CreationDate="2018-10-13T21:24:14.720" Score="1" Body="&lt;p&gt;This is how I have solved it, with help from Ben above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('projectType').all() %}&#xA;            {% nav category in categories %}&#xA;              {% if category.level == 1 %}&#xA;                &amp;lt;h3 class=&quot;h5&quot;&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;              {% else %}&#xA;              &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;              {% endif %}&#xA;              {% ifchildren %}&#xA;                &amp;lt;ul class=&quot;unstyled&quot;&amp;gt;&#xA;                  {% children %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;              {% endifchildren %}&#xA;            {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2018-10-13T21:24:14.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28069" PostTypeId="1" CreationDate="2018-10-13T23:29:47.950" Score="1" ViewCount="76" Body="&lt;p&gt;Updating Craft (and sometimes plugins like Commerce) through Craft 3 admin gives errors. Usually undefined, but have gotten &quot;Backend fetch failed&quot; most recently. Once I refresh the window, it seems to be updated. Since the prior update pseudo-failure there was a message about maintenance mode and a button to continue (which I'm assuming is a flag set somewhere from the prior update). It's a live site on shared open_basedir hosting and proc_open() disabled—which is accounted for in the general config, disabling backups when updating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody experience this and/or have a solution? All the folder permissions and so forth look correct.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2018-10-16T00:22:56.347" Title="Updating fails (except it does indeed update)" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28070" PostTypeId="1" CreationDate="2018-10-14T13:35:11.370" Score="2" ViewCount="453" Body="&lt;p&gt;I am developing a site with a customer logged in area. I don't want anyone to access the section if they are logged out and instead redirect them to the login form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could just add {% requireLogin %} to the top of all the member templates, but its open to error, especially if we have loads. I am concerned we may forget to add it, accidentally delete the line one day. Then private pages are public, not good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I thought I would add the function to a plugin I have created for this site, to remove it from the template, and I can also target the whole /account/ segment where member templates are located.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT, the plugin can be uninstalled or disabled. Various people will be Admins, and there is always the possibility someone could disable this for some reason, and then all private pages become public!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can we disable the ability to disable and uninstall plugins in the CP? The plugin will contain this and other site essential functions that we cant just have someone delete. They need to be fixed into the system to prevent accidental disabling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, is there an alternative way to add functions without using a plugin or controller, so we can override core actions like this without any CP control. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2018-10-14T18:16:14.523" Title="How to disable plugin Disable and Uninstall?" Tags="&lt;plugin-development&gt;&lt;login&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28071" PostTypeId="2" ParentId="28070" CreationDate="2018-10-14T14:57:48.597" Score="1" Body="&lt;p&gt;Yes you can disable the ability to delete the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all you can overwrite the function &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/base/Plugin.php#L158&quot; rel=&quot;nofollow noreferrer&quot;&gt;uninstall&lt;/a&gt; and just return false so it won't be removed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore you could use the event &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/services/Plugins.php#L421&quot; rel=&quot;nofollow noreferrer&quot;&gt;EVENT_AFTER_DISABLE_PLUGIN&lt;/a&gt; to enable it again. However: it seems like a simple module is better for this job instead of a plugin since they can't be uninstalled or deleted &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-14T14:57:48.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28072" PostTypeId="2" ParentId="28070" CreationDate="2018-10-14T18:16:14.523" Score="2" Body="&lt;p&gt;This can be easy, write a module which can't be disabled or uninstall. See what's difference between module and plugin &lt;a href=&quot;https://docs.craftcms.com/v3/extend/#modules-vs-plugins&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/#modules-vs-plugins&lt;/a&gt; or &lt;a href=&quot;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-14T18:16:14.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28073" PostTypeId="2" ParentId="28067" CreationDate="2018-10-14T18:58:29.993" Score="1" Body="&lt;p&gt;The Uri of each element must be unique but if your Uri format is something that might not render a unique string you'll receive the error you are facing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as you include some unique identifier like &lt;code&gt;{ id }&lt;/code&gt; or &lt;code&gt;{ slug }&lt;/code&gt; into your sections uri it will work again. Right now you can only save an entry if the field value is unique &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-14T18:58:29.993" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28074" PostTypeId="1" CreationDate="2018-10-15T06:30:31.537" Score="1" ViewCount="32" Body="&lt;p&gt;I have a plugin which runs a task on order complete. The tasks runs successfully without any errors. But the problem is the task is only completed when admin is logged in. So if someone has completed the order, they have to wait until an admin logs in to dashboard. What could I be missing? The code I'm using is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CustomPlugin.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onOrderComplete', [$this, 'initializeTask']);&#xA;&#xA;public function initializeTask(Event $event){&#xA;    $order = $event-&amp;gt;params['order'];&#xA;    foreach ($order-&amp;gt;lineItems as $lineItem) {&#xA;        craft()-&amp;gt;tasks-&amp;gt;createTask('Custom', null, [&#xA;            'id' =&amp;gt; $order-&amp;gt;id,&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CustomTask.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class CustomTask extends BaseTask&#xA;{&#xA;    protected function defineSettings()&#xA;    {&#xA;        return [&#xA;            'id' =&amp;gt; AttributeType::Number,&#xA;        ];&#xA;    }&#xA;&#xA;    public function getDescription()&#xA;    {&#xA;        return 'Custom Task';&#xA;    }&#xA;&#xA;    public function getTotalSteps()&#xA;    {&#xA;        return 1;&#xA;    }&#xA;&#xA;    public function runStep($step)&#xA;    {&#xA;        $orderId = $this-&amp;gt;getSettings()-&amp;gt;orderId;&#xA;        .&#xA;        .&#xA;        .&#xA;        return true;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any type of priority or setting that needs to be set?&lt;/p&gt;&#xA;" OwnerUserId="8164" LastEditorUserId="8164" LastEditDate="2018-10-15T07:26:50.827" LastActivityDate="2018-10-15T11:45:36.070" Title="Tasks runs only after admin is logged in" Tags="&lt;plugin-development&gt;&lt;tasks&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28075" PostTypeId="1" AcceptedAnswerId="28099" CreationDate="2018-10-15T08:04:29.030" Score="1" ViewCount="123" Body="&lt;p&gt;There is white space being added to the start of my templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't really an issue but because its happening to an RSS template that is breaking the feed and causing it to not validate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I edit the template in my text editor the white space is not there, so I think it is Craft adding when when rendering the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code looks like this, you can see on line 1 there are no spaces before I declare the XML version. &lt;code&gt;&amp;lt;?xml&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8vHfg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8vHfg.png&quot; alt=&quot;RSS template start&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on the front end it is rendering like so: I have highlighted the space in blue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mbNut.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mbNut.png&quot; alt=&quot;White space being added to RSS doc&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this, the RSS template is not validating and is causing my feed to break.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This started recently, I am not sure if it is linked to a recent Craft update but it started happening around the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft v3.0.26.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated :) Thanks&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="4990" LastEditDate="2018-10-15T08:25:54.123" LastActivityDate="2018-10-16T08:09:58.807" Title="White space added to start of template's" Tags="&lt;craft3&gt;&lt;rss&gt;&lt;whitespace&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28076" PostTypeId="2" ParentId="16653" CreationDate="2018-10-15T09:57:28.670" Score="1" Body="&lt;pre&gt;&lt;code&gt;//get element in the specifict language site        &#xA;function langEntry($entry_id) {&#xA;    return GlobalSet::find()-&amp;gt;id($entry_id)-&amp;gt;site(&quot;site_name_lang&quot;)-&amp;gt;one();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can replace GlobaSet for Entry, Section, etc&lt;/p&gt;&#xA;" OwnerUserId="8817" LastEditorUserId="8817" LastEditDate="2018-10-15T10:14:10.450" LastActivityDate="2018-10-15T10:14:10.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28077" PostTypeId="1" CreationDate="2018-10-15T10:38:14.733" Score="1" ViewCount="44" Body="&lt;p&gt;I am currently building a website for Hot Tubs and within this there will be New Tubs, Used Tubs and Hire Tubs (each will be a top level page on the navigation, and each tub will have a details page). Each tub will only exist in one of the three sections. The templates will be different and so I have decided to go for 3 individual channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, any thoughts from a URL structure/SEO etc on the different approaches to URLS for sections.&#xA;I am thinking of either keeping them all separate like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.domain.co.uk/used-hot-tubs/  &#xA;www.domain.co.uk/used-hot-tubs/name-of-used-tub/ &#xA;&#xA;www.domain.co.uk/hot-tubs/  &#xA;www.domain.co.uk/hot-tubs/name-of-new-tub/  &#xA;&#xA;www.domain.co.uk/hot-tubs-for-hire/  &#xA;www.domain.co.uk/hot-tubs-for-hire/name-of-hire-tub/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or whether they should all be structure like so?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.domain.co.uk/hot-tubs/used/  &#xA;www.domain.co.uk/hot-tubs/used/name-of-used-tub/&#xA;&#xA;www.domain.co.uk/hot-tubs/new/  &#xA;www.domain.co.uk/hot-tubs/new/name-of-new-tub/ &#xA;&#xA;www.domain.co.uk/hot-tubs/hire/  &#xA;www.domain.co.uk/hot-tubs/hire/name-of-hire-tub/  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;www.domain.co.uk/used/&#xA;www.domain.co.uk/used/name-of-used-tub/&#xA;&#xA;www.domain.co.uk/new/&#xA;www.domain.co.uk/new/name-of-new-tub/&#xA;&#xA;www.domain.co.uk/hire/&#xA;www.domain.co.uk/hire/name-of-hire-tub/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any input/thoughts appreciated….&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I should add this is not an eCommerce website, although the structure could lends itself to that and that the top level domain does contain the words hottubs. &lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2018-10-15T12:03:28.157" LastActivityDate="2018-10-15T13:53:20.557" Title="URL Structure - advise and thoughts of best approach?" Tags="&lt;url&gt;&lt;structure&gt;&lt;seo&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28079" PostTypeId="2" ParentId="28077" CreationDate="2018-10-15T11:21:46.277" Score="3" Body="&lt;p&gt;I’d go for /hot-tubs/used etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can also have /accessories/pipes etc&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-10-15T11:21:46.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28080" PostTypeId="2" ParentId="28074" CreationDate="2018-10-15T11:45:36.070" Score="1" Body="&lt;p&gt;Got it. Added the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (!craft()-&amp;gt;tasks-&amp;gt;isTaskRunning()){&#xA;    $task = craft()-&amp;gt;tasks-&amp;gt;getNextPendingTask();&#xA;&#xA;    if ($task){&#xA;        craft()-&amp;gt;tasks-&amp;gt;runPendingTasks();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8164" LastActivityDate="2018-10-15T11:45:36.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28081" PostTypeId="2" ParentId="28077" CreationDate="2018-10-15T13:53:20.557" Score="3" Body="&lt;p&gt;The general rule of thumb is to start with the most general thing, and end in the most specific thing. The nice part of this is that it makes sense to humans, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd go with &lt;code&gt;/hot-tubs/new/name-of-hot-sub&lt;/code&gt; for that reason... in addition to reading well (just from the URL, you know what it is), you'll have more flexibility in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try to have your page &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt;s and &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; or other semantic tags mirror this pattern.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-15T13:53:20.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28082" PostTypeId="1" AcceptedAnswerId="28103" CreationDate="2018-10-15T16:34:51.760" Score="1" ViewCount="61" Body="&lt;p&gt;I'm using &lt;code&gt;craft-stripecheckout&lt;/code&gt; to accept payments on my site, but want to email the user with the custom fields &lt;strong&gt;after&lt;/strong&gt; they have been redirected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Easiest way to describe this is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page 1 - User is asked for payment amount and other custom inputs such as age.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page 2 - Confirmation of details is shown, and Stripe payment button appears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page 3 - User is redirected here via the plugin after payment is completed. &lt;em&gt;this is when the email is sent with custom fields, such as age&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to store all of the POST data, and use it again on the confirmation page?&lt;/p&gt;&#xA;" OwnerUserId="8039" LastActivityDate="2018-10-16T12:23:18.567" Title="Storing data for page in twig" Tags="&lt;post&gt;&lt;stripe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28083" PostTypeId="1" AcceptedAnswerId="28087" CreationDate="2018-10-15T16:37:28.873" Score="1" ViewCount="201" Body="&lt;p&gt;I'm trying to install Sprout Report plugin, so I downloaded from &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-reports&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&#xA;so I followed the instructions from the plugin documentation site: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/reports/installing-and-updating-craft-2.html#requirements&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to that documentation the zip folder from GitHub just need to be placed on craft/plugins folder but after I do this the plugin still does not show on dashboard.&lt;/p&gt;&#xA;&lt;p&gt;Do I have to do something else so it can be displayed?&lt;/p&gt;&#xA;&lt;p&gt;Also the zip file from GitHub gives me a folder name: &lt;strong&gt;craft-sprout-reports-1&lt;/strong&gt; but according to the official documentation the plugin folder's name should be named as: &lt;strong&gt;sproutreports&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Will be the name of the folder the reason why it's not showing?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;&lt;h1&gt;plugin-sproutreports&lt;/h1&gt;&#xA;&lt;h1&gt;plugin-sproutforms&lt;/h1&gt;&#xA;" OwnerUserId="8861" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-10-15T22:07:37.863" Title="Plugin not displayed on Plugins Section" Tags="&lt;plugins&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28084" PostTypeId="1" AcceptedAnswerId="28095" CreationDate="2018-10-15T16:42:17.747" Score="1" ViewCount="43" Body="&lt;p&gt;Is there some documentation/summary to which degree Craft's CP supports accessibility (a11y), WCAG2 compliance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially support for color blindness and keyboard only usage is requested in an upcoming project, screen reader support preferred, but optional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8315" LastActivityDate="2018-10-16T00:28:25.150" Title="Craft CP and a11y" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28085" PostTypeId="2" ParentId="28082" CreationDate="2018-10-15T20:58:58.987" Score="1" Body="&lt;p&gt;I'm not exactly sure how this plugin works, but in general the best way to do this is to rely on Webhooks.  You can listen for &lt;code&gt;charge.succeeded&lt;/code&gt; events and send an email when those occur.  If you're not a programmer, you can always use something like Zapier or IFTTT to do this too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;:)  Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="8923" LastActivityDate="2018-10-15T20:58:58.987" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28086" PostTypeId="2" ParentId="28061" CreationDate="2018-10-15T21:44:02.540" Score="1" Body="&lt;p&gt;Correct way is little bit longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, you need your own plugin, you can generate skeleton here: &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; It's better than rewrite someone else's, because you can't update it after you add a code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, you add your beforeSend Event to Plugin class by add it to init function - the function will be generated in step one - it is in the YourNamePlugin php file in root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you start a new project, it is better to work in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastActivityDate="2018-10-15T21:44:02.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28087" PostTypeId="2" ParentId="28083" CreationDate="2018-10-15T22:07:37.863" Score="2" Body="&lt;p&gt;When downloading from the Github releases tab be sure that you are downloading the latest plugin release for the version of Craft you are using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Sprout Reports:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;v0.x releases are for Craft 2&lt;/li&gt;&#xA;&lt;li&gt;v1.x releases are for Craft 3&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When in doubt you can look at the files within the plugin folder and try to determine which version of Craft the plugin is for. Most Craft 3 plugins will have a composer.json file and &lt;code&gt;src/&lt;/code&gt; folder.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-10-15T22:07:37.863" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28088" PostTypeId="1" CreationDate="2018-10-15T23:28:20.877" Score="1" ViewCount="493" Body="&lt;p&gt;I'm using Craft CMS 3 multisite installation with more than 20 website based on subdomains.&#xA;There are websites:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;website.com&#xA;one.website.com&#xA;two.website.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with identical url paths but different content.&#xA;I need to redirect each website from &lt;code&gt;http&lt;/code&gt; to &lt;code&gt;https&lt;/code&gt;.&#xA;Root website htaccess:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&#xA;    RewriteCond %{HTTP:X-Forwarded-Proto} !=https&#xA;    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this adds &lt;code&gt;index.php&lt;/code&gt; to URL while redirects. So &lt;code&gt;http://one.website.com/test&lt;/code&gt; become into &lt;code&gt;https://one.website.com/index.php?p=test&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5587" LastActivityDate="2019-01-30T11:35:09.887" Title="Force redirect from HTTP to HTTPS via htaccess with multisite installation" Tags="&lt;craft3&gt;&lt;redirect&gt;&lt;htaccess&gt;&lt;https&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28089" PostTypeId="1" CreationDate="2018-10-15T23:46:51.503" Score="1" ViewCount="398" Body="&lt;p&gt;Is anyone aware of a solution for using Craft user data with something like MailChimp? This is a very simple use case of sending newsletters/announcements to registered Craft users. Would be even better if it could be by User Group, but I will settle for all users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that Sprout Email can connect to MailChimp mailing lists, but that does not address the issue of having to manually sync the Craft User data with a MailChimp list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2020-09-17T08:09:38.843" Title="Integration with MailChimp et al" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28090" PostTypeId="1" AcceptedAnswerId="28096" CreationDate="2018-10-16T00:05:36.077" Score="1" ViewCount="277" Body="&lt;p&gt;I'm trying to validate user's new password and confirm password in my custom plugin &lt;code&gt;init()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(User::class, User::EVENT_BEFORE_SAVE, function(Event $event) {&#xA;    $formData = $_POST;&#xA;    $newPassword =  $formData['newPassword'];&#xA;    $confirmPassword =  $formData['confirmPassword'];&#xA;&#xA;    if ($newPassword != $confirmPassword){&#xA;        Craft::$app-&amp;gt;session-&amp;gt;setError('Confirm password does not match new password');&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set error = craft.app.session.getFlash('error') %}&#xA;{% if error|length &amp;gt; 0 %}&#xA;    {{error}}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with this is, it displays the message &quot;Confirm password does not match new password&quot; on frontend but the password gets changed into &lt;code&gt;newPassword&lt;/code&gt; value. Is there a way to stop processing any further after returning error?&lt;/p&gt;&#xA;" OwnerUserId="7215" LastEditorUserId="57" LastEditDate="2018-10-16T00:30:30.587" LastActivityDate="2018-10-16T00:32:31.930" Title="Craft 3 validate new password in change password" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28091" PostTypeId="2" ParentId="28044" CreationDate="2018-10-16T00:09:01.863" Score="0" Body="&lt;p&gt;Probably several ways you could tackle this like with a custom Redactor JS plugin, but I'd probably write a Craft plugin that forked and extended the original Craft Redactor plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you could overwrite the Redactor field's &lt;code&gt;normalizeValue()&lt;/code&gt; method and parse the input to make whatever changes you want before returning.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-16T00:09:01.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28092" PostTypeId="2" ParentId="28089" CreationDate="2018-10-16T00:16:28.553" Score="2" Body="&lt;p&gt;Most email service providers like MailChimp won't let you send to a list of addresses, even if they're user accounts on your site, without first adding them to a list inside the ESP's control panel.&lt;/p&gt;&#xA;&lt;p&gt;If you're planning on sending out user emails through a tool like this, it's best to determine the sync strategy before you start signing up users.&lt;/p&gt;&#xA;&lt;p&gt;That said you have a couple options for existing users:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a template to export your user information in CSV format, save it's output and import into MailChimp&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the &lt;a href=&quot;https://putyourlightson.com/plugins/campaign&quot; rel=&quot;nofollow noreferrer&quot;&gt;Campaign Plugin&lt;/a&gt; to send out messages&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14" LastEditorUserId="180" LastEditDate="2020-09-17T08:09:38.843" LastActivityDate="2020-09-17T08:09:38.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28093" PostTypeId="2" ParentId="28063" CreationDate="2018-10-16T00:17:18.147" Score="3" Body="&lt;p&gt;Building on &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28063/craft-3-query-children-of-sub-categories#comment36550_28063&quot;&gt;Robin's comment&lt;/a&gt;, the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/category-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancestorOf&lt;/a&gt; parameter expects either an element ID or the actual element as a parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you know the ID of the &lt;code&gt;fruit&lt;/code&gt; category is &lt;code&gt;3&lt;/code&gt;, you'd use &lt;code&gt;.anscestorOf(3)&lt;/code&gt;, or if you already had the fruit category element, you'd do like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fruitCategory = craft.categories.id(3).one() %}&#xA;&#xA;{% set categories = craft.categories()&#xA;    .group('food')&#xA;    .ancestorOf(fruitCategory)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-16T00:17:18.147" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28094" PostTypeId="2" ParentId="28069" CreationDate="2018-10-16T00:22:56.347" Score="1" Body="&lt;p&gt;My guess is that you're bumping into your php.ini file's &lt;code&gt;memory_limit&lt;/code&gt; and/or &lt;code&gt;max_execution_time&lt;/code&gt; setting.  It just happens to be towards the end of the update process where Craft is (for all practical purposes) updating, and it fails in the &quot;cleaning up&quot; portion of the update process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bump those up to something like &lt;code&gt;256M&lt;/code&gt; and &lt;code&gt;120&lt;/code&gt; (respectively) and see if that helps going forward.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since the prior update pseudo-failure there was a message about maintenance mode and a button to continue (which I'm assuming is a flag set somewhere from the prior update). &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yup, it's a flag set that never gets reset if there's a fatal PHP error (live above).  It'll go away after the next successful update.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-16T00:22:56.347" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28095" PostTypeId="2" ParentId="28084" CreationDate="2018-10-16T00:28:25.150" Score="1" Body="&lt;p&gt;There's no documentation I'm aware of (official or unofficial), but there is a Github issue here to improve some aspects of a11y you might want to comment and ask for clarification on: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1533&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1533&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-16T00:28:25.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28096" PostTypeId="2" ParentId="28090" CreationDate="2018-10-16T00:32:31.930" Score="2" Body="&lt;p&gt;I believe what you're looking for is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($newPassword != $confirmPassword){&#xA;    Craft::$app-&amp;gt;session-&amp;gt;setError('Confirm password does not match new password');&#xA;    $event-&amp;gt;isValid = false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;code&gt;isValid&lt;/code&gt; to false will stop further processing of that element (the user in this case).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-16T00:32:31.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28097" PostTypeId="2" ParentId="27956" CreationDate="2018-10-16T06:44:20.280" Score="1" Body="&lt;p&gt;&lt;code&gt;folderPath&lt;/code&gt; is not supported when relating an asset to an Entry but there is a workaround. In your generation script you can call the code below to get the &lt;code&gt;folderId&lt;/code&gt; with the given path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$folderId = \craft\records\VolumeFolder::find()&#xA;-&amp;gt;where(['path' =&amp;gt; 'documents/pdfs/'])&#xA;-&amp;gt;scalar();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5365" LastEditorUserId="5365" LastEditDate="2018-10-17T13:28:26.627" LastActivityDate="2018-10-17T13:28:26.627" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28099" PostTypeId="2" ParentId="28075" CreationDate="2018-10-16T08:09:58.807" Score="2" Body="&lt;p&gt;As Brad kindly pointed out, I checked my files in the &lt;code&gt;config&lt;/code&gt; directory and noticed a few spaces before I started the &lt;code&gt;&amp;lt;?php&lt;/code&gt; in my &lt;code&gt;/craft/config/imager.php&lt;/code&gt; file. I would never have thought to check this, so thanks Brad!&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-10-16T08:09:58.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28100" PostTypeId="1" AcceptedAnswerId="28102" CreationDate="2018-10-16T11:19:57.073" Score="1" ViewCount="106" Body="&lt;p&gt;This may be a simple question but I am not sure how to approach it - again trying to work out best practice for these things!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &quot;single&quot; at &lt;code&gt;/our-work&lt;/code&gt;, which among other things displays a projects listing - basically a list of links to the full entry for that project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now wish to filter that listing by the category they are in. I also wish to update the URL to reflect that filter e.g. &lt;code&gt;/our-work/branding&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have got the below code - listing out all the projects with their links, and also outputting the category links for the filter. When the links are clicked I currently I get an error - unsurprising considering the page doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I best achieve both the filtering and the required url change? Any help or pointers gratefully received by a craft beginner!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/main&quot; %}&#xA;&#xA;{% block main %}&#xA;&#xA;{% set categories = craft.categories.group('projectType').level(1).all() %}&#xA;&#xA;{% for category in categories %}&#xA;  &amp;lt;a href=&quot;/our-work/{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for project in craft.entries.section('projects').all() %}&#xA;  &amp;lt;a href=&quot;{{ project.url }}&quot;&amp;gt;&#xA;    {{ project.title }}&#xA;  &amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2018-10-16T12:13:27.343" Title="Filter by category and update URL" Tags="&lt;craft3&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28102" PostTypeId="2" ParentId="28100" CreationDate="2018-10-16T12:13:27.343" Score="1" Body="&lt;p&gt;When setting up the category, you should be able to specify the URI Format which in your case would be &quot;our-work/{slug}&quot; then setting the template field to point where ever your category template is (You could point this at the same template as the overview and do a some checks but if you're beginner you'd probably better off having them in separate files).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you're loading in the new template, you need to get the projects that are related to the category by doing: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set projects = craft.entries.section('projects').relatedTo(category).all() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4119" LastActivityDate="2018-10-16T12:13:27.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28103" PostTypeId="2" ParentId="28082" CreationDate="2018-10-16T12:23:18.567" Score="0" Body="&lt;p&gt;I ended up doing an intermediate solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I stored the serialized POST data in a record, with a unique identifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I passed the &lt;code&gt;unique_id&lt;/code&gt; (a random md5 hash) to Stripe as metadata.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the webhook, I used the &lt;code&gt;unique_id&lt;/code&gt; to retrieve the POST data.&lt;/p&gt;&#xA;" OwnerUserId="8039" LastActivityDate="2018-10-16T12:23:18.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28105" PostTypeId="1" CreationDate="2018-10-16T12:57:11.673" Score="1" ViewCount="172" Body="&lt;p&gt;I have a relatively simple task which is exposing an issue with efficiency. In that it isn't very efficient and the server cries and quits. Here's the high level overview:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a category called &quot;Locations&quot;. There are 791 locations.&#xA;Users have three Category Fields; First Choice, Second Choice, Third Choice. The pick one location in each field. There are 1809 Users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to generate a report that shows how popular each location is (how many Users chose [LOCATION] as their 1st, 2nd, and 3rd choice). A nice simple table that's 4 cells wide and 791 rows deep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I keep running out of memory and execution time regardless of how high I take each limit. I've tried it in Twig and I've tried it in PHP as a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My strategy, via creating a Service and a Variable... :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set locations = craft.categories.group('locations').limit(null) %}&#xA;{% set users     = craft.users.group('members').limit(null) %}&#xA;&#xA;{{ craft.reporting.locationPopularity(locations,users) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The ReportsService.php file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function locationPopularity($locations = null, $users = null) {&#xA;    $response = &quot;&quot;;&#xA;&#xA;    foreach($locations as $location) {&#xA;        $firstChoiceCount = 0;&#xA;        $secondChoiceCount = 0;&#xA;        $thirdChoiceCount = 0;&#xA;&#xA;        foreach($users as $user) {&#xA;            if($user-&amp;gt;firstChoiceLocation-&amp;gt;last() == $location){ $firstChoiceCount += 1; }&#xA;            if($user-&amp;gt;secondChoiceLocation-&amp;gt;last() == $location){ $secondChoiceCount += 1; }&#xA;            if($user-&amp;gt;thirdChoiceLocation-&amp;gt;last() == $location){ $thirdChoiceCount += 1; }&#xA;        }&#xA;&#xA;        $response = $response . &quot;&#xA;            &amp;lt;h2&amp;gt;$location-&amp;gt;title&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;p&amp;gt;First Choice: $firstChoiceCount, Second Choice: $secondChoiceCount, Third Choice: $thirdChoiceCount.&amp;lt;/p&amp;gt;&quot;;&#xA;    }&#xA;&#xA;    return $response;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get this to work? 1,430,919 loop iterations seems to be a no go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following works, but 2400+ queries...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for location in craft.categories.group('locations').limit(null).find() %}&#xA;    {% set firstChoiceCount = craft.users.relatedTo({&#xA;        element: location,&#xA;        field: 'firstChoiceLocation'&#xA;    }).limit(null).count() %}&#xA;&#xA;    {% set secondChoiceCount = craft.users.relatedTo({&#xA;        element: location,&#xA;        field: 'secondChoiceLocation'&#xA;    }).limit(null).count() %}&#xA;&#xA;    {% set thirdChoiceCount = craft.users.relatedTo({&#xA;        element: location,&#xA;        field: 'thirdChoiceLocation'&#xA;    }).limit(null).count() %}&#xA;&#xA;    ... output ...&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastEditorUserId="219" LastEditDate="2018-10-16T14:50:00.717" LastActivityDate="2018-10-16T14:50:00.717" Title="Reducing memory usage?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28106" PostTypeId="1" AcceptedAnswerId="28108" CreationDate="2018-10-16T13:04:00.363" Score="1" ViewCount="109" Body="&lt;p&gt;My problem is that I can't update the specific &lt;code&gt;$userId&lt;/code&gt;. have the values I've selected. I also get an error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Call to a member function where() on integer &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I just started to learn Craft. It can be simple for you but not for me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function updateUserName($userId, $updateUser)&#xA;{&#xA;&#xA;    $update = craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update('contest_user', array(&#xA;        'name' =&amp;gt; $updateUser))-&amp;gt;where('id', $userId);&#xA;&#xA;    return $update;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8859" LastEditorUserId="57" LastEditDate="2018-10-17T00:03:13.470" LastActivityDate="2018-11-06T11:46:04.497" Title="where command sql query not working" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;query&gt;&lt;craft2&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28107" PostTypeId="2" ParentId="28105" CreationDate="2018-10-16T13:25:16.723" Score="1" Body="&lt;p&gt;First of all &lt;code&gt;-&amp;gt;last()&lt;/code&gt; will always produce 2 queries, one fetches the total amount of results, the other one fetches the result with the offset given by the first query -&gt; you can reduce the amount of queries by using &lt;code&gt;first()&lt;/code&gt; if there is only one choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore: I would make use of &lt;a href=&quot;https://docs.craftcms.com/v2/templating/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager loading&lt;/a&gt; so you don't even fetch the fields again and again (like currently)&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% set users = craft&#xA;    .users&#xA;    .group('members')&#xA;    .limit(null)&#xA;    .with([&#xA;        'firstChoiceLocation', &#xA;        'secondChoiceLocation', &#xA;        'thirdChoiceLocation'&#xA;    ])&#xA;    .find() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Besides that - if you don't execute your &lt;code&gt;$users&lt;/code&gt; query Craft might fetch the results again and again in certain circumstances so you don't have an array of elements but a query that is fired every single time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end I would highly suggest to not loop each user again and again, instead fetch the number of related users for each category via custom Query.&#xA;You can just &lt;code&gt;count&lt;/code&gt; &lt;code&gt;relations.targetId&lt;/code&gt; from the relations table where the sourceIds are your category ids and loop the result within PHP. I could show it for Craft 3 but I didn't use Craft 2 syntax for over a year&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-16T13:33:33.000" LastActivityDate="2018-10-16T13:33:33.000" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28108" PostTypeId="2" ParentId="28106" CreationDate="2018-10-16T13:39:20.483" Score="1" Body="&lt;p&gt;When you take a look at the &lt;a href=&quot;https://www.yiiframework.com/doc/api/1.1/CDbCommand#update-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; the interface for the &lt;code&gt;update&lt;/code&gt; function is the following.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public integer update(string $table, array $columns, mixed $conditions='', array $params=array ())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus your code should look like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public function updateUserName($userId, $updateUser)&#xA;{&#xA;    $update = craft()-&amp;gt;db-&amp;gt;createCommand()-&amp;gt;update(&#xA;        'contest_user', &#xA;        array('name' =&amp;gt; $updateUser), &#xA;        'id=:id',&#xA;        array(':id', $userId)&#xA;    );&#xA;&#xA;    return $update;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see a working example here:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;// build and execute the following SQL:&#xA;// UPDATE `tbl_user` SET `name`=:name WHERE id=:id&#xA;$command-&amp;gt;update('tbl_user', array(&#xA;    'name'=&amp;gt;'Tester',&#xA;), 'id=:id', array(':id'=&amp;gt;1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="8859" LastEditDate="2018-11-06T11:46:04.497" LastActivityDate="2018-11-06T11:46:04.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28109" PostTypeId="1" AcceptedAnswerId="28145" CreationDate="2018-10-16T13:53:49.640" Score="1" ViewCount="291" Body="&lt;p&gt;I've noticed that Craft 3 log files in storage/logs e.g. web-404s.log and web.log don't seem to have a max size or rotate like with Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The web-404s.log file is nearly 10 megs for 1 site now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should the log files continually grow like this or is there just an issue with my setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there config settings to set the max log file size or disable certain logging that I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="135" LastActivityDate="2018-10-20T02:43:51.953" Title="Craft 3 large log file sizes" Tags="&lt;craft3&gt;&lt;config&gt;&lt;logs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28110" PostTypeId="1" AcceptedAnswerId="28113" CreationDate="2018-10-16T15:36:43.577" Score="1" ViewCount="142" Body="&lt;p&gt;I'm using Braintree with Craft Commerce using this Omnipay Braintree Gateway for Craft Commerce&#xA;&lt;a href=&quot;https://github.com/samuelbirch/craftcommerce-braintree&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/samuelbirch/craftcommerce-braintree&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's working well, but I noticed that some customer data is not passed through to Braintree at the time of a successful purchase. Specifically, the customer information that is mapped from the &lt;code&gt;customer&lt;/code&gt; parameters in the transactions sale call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working directly with Braintree API it would be done as part of the &lt;a href=&quot;https://developers.braintreepayments.com/reference/request/transaction/sale/php#customer&quot; rel=&quot;nofollow noreferrer&quot;&gt;sale&lt;/a&gt; method that includes &lt;code&gt;amount&lt;/code&gt; and &lt;code&gt;creditCard&lt;/code&gt; etc on the transaction.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Braintree_Transaction::sale([...], array('customer' =&amp;gt; array())); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm a bit stuck trying to find where to actually make a modification to pass this data through in the context of Omnipay and Craft Commerce. Does anyone have an idea of where to start? I realize this is a vague question... please comment if there is something specific that I can clarify to make this question more answerable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like maybe what I should be using is a Craft Commerce hook. Probably &lt;code&gt;commerce_modifyGatewayRequestData&lt;/code&gt;. So I'm starting there, but if anyone has tips it would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2018-10-16T16:10:49.177" LastActivityDate="2018-10-22T19:19:44.307" Title="Craft Commerce: where to modify data sent to gateway (need to send customer data)?" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28112" PostTypeId="2" ParentId="28110" CreationDate="2018-10-17T01:18:46.620" Score="2" Body="&lt;p&gt;Ok so it works pretty much how the documentation would lead you to think.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for Commerce V1 but apart from hooking up to the event, it should be much the same for V2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function commerce_modifyGatewayRequestData($data,$type,$transaction)&#xA;{&#xA;&#xA;        // Dump the data to see what is there...you can do what you like to $data and then you return it at the end...&#xA;        BusinessLogicPlugin::log(&quot;commerce_modifyGatewayRequestData - UNMODIFIED DATA&quot;); &#xA;        BusinessLogicPlugin::log(&quot;data&quot;);&#xA;        BusinessLogicPlugin::log($data);&#xA;        BusinessLogicPlugin::log(&quot;type&quot;);&#xA;        BusinessLogicPlugin::log($type);&#xA;        BusinessLogicPlugin::log(&quot;transaction&quot;);&#xA;        BusinessLogicPlugin::log($transaction);&#xA;    }&#xA;&#xA;    # Example...&#xA;    # TRUNCATE any over-sized data eWay might not like....&#xA;    # Data limits come from here: https://eway.io/api-v3/#direct-connection&#xA;&#xA;    if(isset($data['Customer']['FirstName']))&#xA;        $data['Customer']['FirstName'] = substr($data['Customer']['FirstName'], 0, 49);&#xA;&#xA;    ...etc&#xA;&#xA;        // Dump the modified data for checking if you need to...&#xA;&#xA;        BusinessLogicPlugin::log(&quot;commerce_modifyGatewayRequestData - MODIFIED DATA&quot;); &#xA;        BusinessLogicPlugin::log(&quot;data&quot;);&#xA;&#xA;    // Now actually return the modified data...&#xA;    return $data&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-10-17T01:18:46.620" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28113" PostTypeId="2" ParentId="28110" CreationDate="2018-10-17T02:33:29.813" Score="1" Body="&lt;p&gt;The &lt;code&gt;commerce_modifyGatewayRequestData&lt;/code&gt; hook did work for my purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One unexpected error I countered when using this hook was a missing Braintree &lt;code&gt;merchantId&lt;/code&gt;, &lt;code&gt;publicKey&lt;/code&gt;, &lt;code&gt;privateKey&lt;/code&gt;, and &lt;code&gt;environment&lt;/code&gt;. I expected these to already be set, since they're configured and working fine in Craft Commerce Payment Method settings when I do not use this hook. This error occurred even when I returned &lt;code&gt;$data&lt;/code&gt; from this hook as-is.  Not sure why this is, but setting it manually with &lt;code&gt;Braintree_Configuration&lt;/code&gt; inside the function did the trick:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Braintree_Configuration;&#xA;&#xA;public function commerce_modifyGatewayRequestData($data, $type, $transaction){&#xA;&#xA;    // Get the Commerce order&#xA;    $orderId = $transaction-&amp;gt;orderId;&#xA;    $order = craft()-&amp;gt;commerce_orders-&amp;gt;getOrderById($orderId);&#xA;&#xA;    // Set the customer data from the Commerce order&#xA;    $customer['email'] = $order-&amp;gt;email;&#xA;    $customer['firstName'] = $order-&amp;gt;billingAddress-&amp;gt;firstName;&#xA;    $customer['lastName'] = $order-&amp;gt;billingAddress-&amp;gt;lastName;&#xA;    $customer['phone'] = $order-&amp;gt;billingAddress-&amp;gt;phone;&#xA;&#xA;    // Add customer to $data sent to Braintree&#xA;    $data['customer'] = $customer;&#xA;&#xA;    // For some reason this needs to be set manually here, &#xA;    // Should already be set via Craft Commerce?&#xA;    Braintree_Configuration::merchantId(craft()-&amp;gt;config-&amp;gt;get('braintreeMerchantId'));&#xA;    Braintree_Configuration::environment(craft()-&amp;gt;config-&amp;gt;get('braintreeEnvironment'));&#xA;    Braintree_Configuration::publicKey(craft()-&amp;gt;config-&amp;gt;get('braintreePublicKey'));&#xA;    Braintree_Configuration::privateKey(craft()-&amp;gt;config-&amp;gt;get('braintreePrivateKey'));&#xA;&#xA;    return $data;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2018-10-22T19:19:44.307" LastActivityDate="2018-10-22T19:19:44.307" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28114" PostTypeId="1" AcceptedAnswerId="33196" CreationDate="2018-10-17T04:44:46.230" Score="1" ViewCount="913" Body="&lt;p&gt;I have a Craft 3 install on my client's Windows machine running Apache, PHP and MySQL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We purchased an SSL certificate but the main Admin login page (on SSL) keeps loading cpresources assets over HTTP which cause all of these CSS and JS assets to be blocked by the browser.  However, loading these assets over https in a browser works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Site URL is indeed set to https.  I've tried to force change the URL in config/general.php using the siteUrl and baseCpUrl parameters.  I've also tried clearing Craft's cache and removed the www/storage/* and web/cpresources/* content but nothing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have a https redirect in .htaccess as I believe the force redirect was set up when the SSL was installed (I don't have how this step was done).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to solve this?  The admin page is totally broken and unusable at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the server setup is different, this issue might be related to the below.  However I wasn't able to solve my problem based on it.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19383/craft-admin-assets-do-not-load-over-https-apache-cloudflare&quot;&gt;Craft Admin assets do not load over https (Apache &amp;amp; Cloudflare)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2019-12-05T04:07:20.180" Title="Craft 3 Admin not loading cpresources files over HTTPS" Tags="&lt;control-panel&gt;&lt;config&gt;&lt;admin&gt;&lt;https&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28115" PostTypeId="1" CreationDate="2018-10-17T06:14:09.010" Score="1" ViewCount="254" Body="&lt;p&gt;When I am creating a new field (and I've tried plain text, redactor, supertable and matrix field) and associating it with an existing entry type (using the Control Panel to do so), I run into an issue where I can't load data to the field  with a migration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's code from the migration I might try to run to put some data in this field (in this case, it is a redactor).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  foreach ($attorneys as $attorney) { // iterate over json data we are going to import.&#xA;    $craft_attorney_id = // lookup attorney id&#xA;    $entry = Entry::find()-&amp;gt;id($craft_attorney_id)-&amp;gt;status(['enabled','disabled'])-&amp;gt;one();&#xA;    if (!$entry) {&#xA;      continue;&#xA;    }&#xA;    $accolades = 'test text';&#xA;    $entry-&amp;gt;setFieldValues(array('accolades' =&amp;gt; $accolades));&#xA;    if(!\Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry)) {&#xA;        throw new \Exception(&quot;Couldn't save entry: &quot; . print_r($entry-&amp;gt;getErrors(), true));&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I view one entry in the CP and enter data in the new field, and then rerun the migration (take it down then up), the new data from the migration is saved just fine (for that element. but not for any others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've set the redactor field to 'full html', and also stripped the tags from the field to be inserted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our content table has 56 columns, but many are text, so I don't think I'm running into an issue with row length ( &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html#innodb-maximums-minimums&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html#innodb-maximums-minimums&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried clearing all the caches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried upgrading from 3.0.9 to 3.0.27.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried to refresh fields on the fields service:       &lt;code&gt;\Craft::$app-&amp;gt;fields-&amp;gt;refreshFields();&lt;/code&gt; at the beginning of the migraiton.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to read from the entry in the same migration, I get this exception&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Invalid field handle: accolades (/.../vendor/craftcms/cms/src/base/Element.php:1932)&#xA;#0 /../vendor/craftcms/cms/src/base/Element.php(1612): craft\base\Element-&amp;gt;normalizeFieldValue('accolades')&#xA;#1 /../migrations/m181016_224151_import_accolades_v2.php(59): craft\base\Element-&amp;gt;getFieldValue('accolades')&#xA;#2 /../vendor/craftcms/cms/src/db/Migration.php(56): craft\contentmigrations\m181016_224151_import_accolades_v2-&amp;gt;safeUp()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Except I can find that field using the fieldService. Maybe it is something to do with the normalization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I saving the entry incorrectly? Do I need to do some kind of special call to refresh the element mapping of fields?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8814" LastEditorUserId="8814" LastEditDate="2018-10-22T14:33:42.333" LastActivityDate="2018-10-22T14:33:42.333" Title="Unable to add data via migration to a new field" Tags="&lt;craft3&gt;&lt;field&gt;&lt;migration&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28116" PostTypeId="2" ParentId="28032" CreationDate="2018-10-17T08:59:24.420" Score="1" Body="&lt;p&gt;To grab validation error of a &lt;em&gt;matrix field&lt;/em&gt; -&gt; &lt;em&gt;first block type&lt;/em&gt; -&gt; &lt;em&gt;field&lt;/em&gt;, you must access entry's matrix field with the function &lt;code&gt;first()&lt;/code&gt; and than access block type field using &lt;code&gt;getError(&quot;fieldHandle&quot;)&lt;/code&gt; function at the end of &lt;code&gt;ElementCriteriaModel&lt;/code&gt; like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.matrixField.first().getError(&quot;customFieldHandle&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or to the question related problem&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entryError.cart.first().getError(&quot;productQuantity&quot;) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing this way you don't have to loop through Matrix's blocks and it make sense if you need to access first block type only or you have only one block type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show validation error under each &lt;code&gt;block.type&lt;/code&gt; of a custom field you'll have to loop in &lt;code&gt;MatrixBlockModel&lt;/code&gt; of the &lt;code&gt;cart&lt;/code&gt; channel like so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entryError is defined %}&#xA;    {% for block in entryError.cart %}&#xA;        {% if block.getErrors() %}&#xA;            {{ block.getError('productQuantity') }}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like Brad pointed out to me in support ticket &quot;you can decide how you want to display them&quot;.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastActivityDate="2018-10-17T08:59:24.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28117" PostTypeId="1" CreationDate="2018-10-17T09:05:45.373" Score="1" ViewCount="155" Body="&lt;p&gt;I am developing a custom authentication plugin for Craft 3. But I can't route to my Controller via &lt;code&gt;POST&lt;/code&gt; request with my login form. Request via &lt;code&gt;GET&lt;/code&gt; work&lt;/p&gt;&#xA;" OwnerUserId="8926" LastEditorUserId="5557" LastEditDate="2018-10-17T13:35:10.843" LastActivityDate="2018-10-19T15:23:30.830" Title="plugins route post controller?" Tags="&lt;plugins&gt;&lt;login&gt;&lt;post&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28118" PostTypeId="1" CreationDate="2018-10-17T09:25:27.263" Score="0" ViewCount="197" Body="&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had big issues on a Craft 2 multilingual site with dozens of thousands of entries that were using Matrix fields. The site had become extremely slow (almost unusable), especially when recording new data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was certainly caused by the searchindex table which handled very massive records (that weren't particularly necessary for the search features of this project).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently working on a Craft 3 site using PostgreSQL and fear the same kind of issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since Craft 3, and following &lt;a href=&quot;https://craftcms.stackexchange.com/a/13495/131&quot;&gt;this post&lt;/a&gt;, there is now a &lt;code&gt;RegisterElementSearchableAttributesEvent&lt;/code&gt; event that a plugin can listen to modify what gets saved to the search index table when an element is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use this event in my &lt;code&gt;CustomModule.php&lt;/code&gt; file using this simple test, in order to exclude every fields of the search index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Element::class,&#xA;    Element::EVENT_REGISTER_SEARCHABLE_ATTRIBUTES,&#xA;    function (RegisterElementSearchableAttributesEvent $event) {&#xA;        $event-&amp;gt;attributes = [];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But unfortunately, this change nothing: on save, all the same fields are still saved in the &lt;code&gt;searchindex&lt;/code&gt; table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given Section, how can I exclude certains fields (specifically Matrix fields) from the search index on save (both from a CP or a front end entry save)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I'm a new to Module development&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2018-10-17T10:54:21.833" LastActivityDate="2018-10-17T10:54:21.833" Title="How to exclude some fields from the searchindex using the RegisterElementSearchableAttributesEvent event?" Tags="&lt;plugin-development&gt;&lt;search&gt;&lt;events&gt;&lt;modules&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="28119" PostTypeId="1" AcceptedAnswerId="28124" CreationDate="2018-10-17T09:46:16.807" Score="2" ViewCount="356" Body="&lt;p&gt;I'm trying to do something akin to Andrew's excellent &lt;a href=&quot;https://nystudio107.com/blog/lazy-loading-with-the-element-api-vuejs&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; whereby I have a 'more' button that spits out 6 more entries at a time. I'm nearly there, but running into some issues. I don't get past the spinner, and looks like I have some syntax issues lines 17 and/or 24 (because it works if I comment those out). Pretty new to Element API and working this way, and can't Google up anything that makes sense to me as a fix. Anyone help me out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my element-api.php:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use craft\elements\Entry;&#xA;use craft\helpers\UrlHelper;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/news.json' =&amp;gt; function() {&#xA;            return [&#xA;                'elementType' =&amp;gt; Entry::class,&#xA;                'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;                'elementsPerPage' =&amp;gt; 6,&#xA;                'transformer' =&amp;gt; function(Entry $entry) {&#xA;                    // Generate new image transforms right away&#xA;                    craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;                    // Get card image&#xA;                    $srcImage = $entry-&amp;gt;cardImage-&amp;gt;one();&#xA;&#xA;                    if ($srcImage) {&#xA;                        $imageUrl = $srcImage-&amp;gt;getUrl();&#xA;                        // Check if Imager plugin installed&#xA;                        if (craft()-&amp;gt;plugins-&amp;gt;getPlugin('Imager')) {&#xA;                            $image = craft()-&amp;gt;imager-&amp;gt;transformImage($srcImage, [&#xA;                                'width' =&amp;gt; 800,&#xA;                                'format' =&amp;gt; 'jpg',&#xA;                                'ratio' =&amp;gt; 3/2,&#xA;                                'allowUpscale' =&amp;gt; false,&#xA;                                'mode' =&amp;gt; 'crop',&#xA;                                'jpegQuality' =&amp;gt; 60,&#xA;                                'position' =&amp;gt; $srcImage-&amp;gt;focusPctX() . '% ' . $srcImage-&amp;gt;focusPctY() . '%',&#xA;                                'interlace' =&amp;gt; true&#xA;                            ], null, null);&#xA;                            $imageUrl = $image-&amp;gt;url;&#xA;                        } else {&#xA;                            $imageUrl = $srcImage-&amp;gt;getUrl(['width' =&amp;gt; 800, 'height' =&amp;gt; 533]);&#xA;                        }&#xA;                    } else {&#xA;                        $imageUrl = null;&#xA;                    }&#xA;&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                        'jsonUrl' =&amp;gt; UrlHelper::url(&quot;news/{$entry-&amp;gt;slug}.json&quot;),&#xA;                        'postDate' =&amp;gt; $entry-&amp;gt;postDate-&amp;gt;format(\DateTime::ATOM),&#xA;                        'author' =&amp;gt; ['name' =&amp;gt; $entry-&amp;gt;author-&amp;gt;name],&#xA;                        'cardImageUrl' =&amp;gt; $imageUrl,&#xA;                        'summary' =&amp;gt; $entry-&amp;gt;summary,&#xA;                    ];&#xA;                },&#xA;                'meta' =&amp;gt; [&#xA;                    'description' =&amp;gt; 'Latest news',&#xA;                ],&#xA;                'pretty' =&amp;gt; true,&#xA;            ];&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-10-18T02:51:49.313" Title="Element API, VueJs and Imager!" Tags="&lt;plugin-elementapi&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28121" PostTypeId="1" CreationDate="2018-10-17T14:55:36.853" Score="1" ViewCount="114" Body="&lt;p&gt;After redirecting a website to https environment I had the difficulty that .php/ was added to the url which resulted in double content. I have been able to get past this mistake but now I need to force a /  on in the end if the url’s does not have that yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Domainname.com/example/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Domainname.com/example&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Are now visible in Google. I want only the one with the /&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current .htaccess is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DirectoryIndex index.php&#xA;ErrorDocument 404 /404.html&#xA;&#xA;RewriteEngine On&#xA;### START WWW &amp;amp; HTTPS&#xA;# ensure www.&#xA;RewriteCond %{HTTP_HOST} !^www\. [NC]&#xA;RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]&#xA;&#xA;# ensure https&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !https&#xA;RewriteCond %{HTTPS} off&#xA;RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]&#xA;&#xA;### END WWW &amp;amp; HTTPS&#xA;RewriteBase / &#xA;RewriteRule ^([^.?]+[^.?/])$ $1/ [R=301,L]&#xA;RewriteCond %{DOCUMENT_ROOT}/$1.php -f&#xA;RewriteRule ^(.*[^/])/?$ /$1.php [QSA,L]&#xA;&#xA;RewriteRule ^index\.php$ / [R=301,L]&#xA;&#xA;#1)externally redirect &quot;/file.php&quot; to &quot;/file&quot;   &#xA;RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]&#xA;RewriteRule ^ /%1 [NC,L,R]&#xA;#2)Internally map &quot;/file&quot; back to &quot;/file.php&quot;&#xA;RewriteCond %{REQUEST_FILENAME}.php -f&#xA;RewriteRule ^(.*?)/?$ /$1.php [NC,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8928" LastEditorUserId="273" LastEditDate="2018-10-17T19:45:14.203" LastActivityDate="2018-10-17T19:55:39.400" Title="Forcing a / with .htaccess" Tags="&lt;redirect&gt;&lt;htaccess&gt;&lt;https&gt;&lt;redirection&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28122" PostTypeId="2" ParentId="28121" CreationDate="2018-10-17T19:47:27.557" Score="1" Body="&lt;p&gt;I don't think this is particularly &lt;strong&gt;Craft CMS&lt;/strong&gt; specific problem. Just Apache .htaccess rules in general. I would try to search for and answer of Stack Overflow. I have a strong feeling it's been answered there already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/7780859/htaccess-rewrite-to-force-trailing-slash-at-the-end&quot;&gt;https://stackoverflow.com/questions/7780859/htaccess-rewrite-to-force-trailing-slash-at-the-end&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="273" LastEditorUserId="273" LastEditDate="2018-10-17T19:55:39.400" LastActivityDate="2018-10-17T19:55:39.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28123" PostTypeId="1" CreationDate="2018-10-17T23:37:14.240" Score="1" ViewCount="96" Body="&lt;p&gt;I'm trying to install a backup from production site which is running craft 3.0.26 to a UAT site. While installing, faced an error regarding PHP versions. Since both the sites are in the same server, where server shows php71 as the version, but while trying to install craft on UAT site using ssh, its showing error since PHP is running on 5.6.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help need regarding this.&lt;/p&gt;&#xA;" OwnerUserId="8856" LastActivityDate="2019-04-04T14:56:01.637" Title="Craft install failed with error php7 not found, but server has php 7 installed" Tags="&lt;craft3&gt;&lt;php&gt;&lt;installation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28124" PostTypeId="2" ParentId="28119" CreationDate="2018-10-18T00:59:08.307" Score="1" Body="&lt;p&gt;So the problem is that you're using an example from my older article, which was written for Craft 2.x. This line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;config-&amp;gt;set('generateTransformsBeforePageLoad', true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and also these lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (craft()-&amp;gt;plugins-&amp;gt;getPlugin('Imager')) {&#xA;    $image = craft()-&amp;gt;imager-&amp;gt;transformImage($srcImage, [&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...are specific to Craft 2.x; anything &lt;code&gt;craft()&lt;/code&gt; is Craft 2.x; you can see some of the changes here: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#high-level-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#high-level-notes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-10-18T02:51:49.313" LastActivityDate="2018-10-18T02:51:49.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28125" PostTypeId="1" AcceptedAnswerId="28128" CreationDate="2018-10-18T05:08:01.560" Score="1" ViewCount="160" Body="&lt;p&gt;Thank you in advance for any tips on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Barely-related-background: I made a mistake on my development machine. In gparted, I chose &quot;ignore&quot; instead of &quot;cancel&quot;. This is called 'choosing poorly'. Anyway, I now have freshly reinstalled my OS, apache, php, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as the title says, when I click &quot;Update Asset Indexes&quot; it gives a popup saying &lt;code&gt;getFileList() is not implemented&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions what I need to do?&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2018-10-18T15:09:52.397" Title="Update Asset Indexes gives &quot;getFileList() is not implemented&quot;" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28126" PostTypeId="1" CreationDate="2018-10-18T07:54:02.217" Score="1" ViewCount="25" Body="&lt;p&gt;I have the following code to return some grants, but whilst most of the entries are coming back alphabetically ordered, after the last &quot;Z&quot; entry, there are a few more entries also alphabetically ordered. But they are all the same category.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set searchParams = {&#xA;    relatedTo:  relationParam,&#xA;    section: 'grants',&#xA;    limit: 9,&#xA;    order: 'categoryYearForSorting desc, title asc'&#xA;} %}&#xA;&#xA;{% paginate craft.entries(searchParams) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I feel like i've seen this before, but cannot think what the reason might have been :(&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2018-10-18T07:54:02.217" Title="Entries sorted by title have some entries not alphabetical" Tags="&lt;templating&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28127" PostTypeId="1" CreationDate="2018-10-18T12:52:33.050" Score="1" ViewCount="114" Body="&lt;p&gt;Is there a way to deactivate this functionality? We dont want our clients to use it just yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could delete them with my Module's js, but it is triggered after the site is build and the &quot;popping&quot; away of the buttons is not really pretty.&lt;/p&gt;&#xA;" OwnerUserId="8219" LastActivityDate="2018-10-18T17:13:05.307" Title="Removing the LivePreview and Share Buttons?" Tags="&lt;craft3&gt;&lt;control-panel&gt;&lt;live-preview&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28128" PostTypeId="2" ParentId="28125" CreationDate="2018-10-18T15:09:52.397" Score="2" Body="&lt;p&gt;This exception in thrown in the class &lt;code&gt;craft\volumes\MissingVolume&lt;/code&gt; that states one of your Volumes has an invalid class &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function getFileList(string $directory, bool $recursive): array&#xA;{&#xA;    throw new NotSupportedException('getFileList() is not implemented.');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe you uninstalled a plugin that adds a certain Volume class like S3 or something?&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-18T15:09:52.397" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28129" PostTypeId="2" ParentId="28127" CreationDate="2018-10-18T17:13:05.307" Score="1" Body="&lt;p&gt;If you add a blank or invalid template path in your Section's settings (Settings &gt; Sections &gt; Edit Section) then both live preview and the share button will be disabled.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-10-18T17:13:05.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28130" PostTypeId="2" ParentId="28123" CreationDate="2018-10-18T17:18:49.413" Score="1" Body="&lt;p&gt;It sounds like your server environments are different. It is possible to run different version of PHP on different parts of a server, so it really depends on your setup, but that is surely what is going on here. Without more details about your server I don't think it will be possible to give a more detailed answer. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-10-18T17:18:49.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28131" PostTypeId="1" AcceptedAnswerId="28150" CreationDate="2018-10-18T17:46:33.210" Score="1" ViewCount="136" Body="&lt;p&gt;I need to update the limit setting for Images allowed to be empty, so as to allow for no limit. How do I go about updating the 'limit' setting?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldsService = Craft::$app-&amp;gt;getFields();&#xA;$field = $fieldsService-&amp;gt;getFieldByHandle('productImages');&#xA;// Need to update 'limit' to equal '' (currently limited to '5')&#xA;// Then save the new setting&#xA;$fieldsService-&amp;gt;saveField($field);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;SOLUTION&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to accomplish this by using &lt;code&gt;setAttributes&lt;/code&gt; and setting the second argument &lt;code&gt;$safeOnly&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field-&amp;gt;setAttributes([&#xA;    'limit' =&amp;gt; ''&#xA;],false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8759" LastEditorUserId="8759" LastEditDate="2018-10-18T18:37:49.947" LastActivityDate="2018-10-20T23:42:06.913" Title="Update field setting value using getFieldByHandle" Tags="&lt;plugin-development&gt;&lt;field&gt;&lt;image&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28133" PostTypeId="2" ParentId="13452" CreationDate="2018-10-19T07:15:59.593" Score="0" Body="&lt;p&gt;For Craft3, we can also use&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Craft::$app-&amp;gt;getAssets()-&amp;gt;getAssetUrl($image,'myTransform', true)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8932" LastEditorUserId="5557" LastEditDate="2018-10-22T10:28:32.680" LastActivityDate="2018-10-22T10:28:32.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28134" PostTypeId="1" CreationDate="2018-10-19T09:52:00.440" Score="2" ViewCount="52" Body="&lt;p&gt;Craft 2.x using latest Charge plugin...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When ending a subscription using the Charge area of the control panel I'm unable to  end the subscription because I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Page Not Found&#xA;Unable to resolve the request &quot;site&quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out where the route &quot;site&quot; is coming from. Does anyone know?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-10-23T12:01:37.330" LastActivityDate="2019-04-19T14:54:34.297" Title="Charge plugin cannot end subscription" Tags="&lt;plugin-charge&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28135" PostTypeId="2" ParentId="9320" CreationDate="2018-10-19T10:56:14.040" Score="1" Body="&lt;pre&gt;&lt;code&gt;    Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_BEFORE_SAVE_ELEMENT,&#xA;        function (ElementEvent $event) {&#xA;            $element = $event-&amp;gt;element;&#xA;            //IF CAREERS SECTION&#xA;            if ($element-&amp;gt;section-&amp;gt;id == 6) {&#xA;                //IF FIELD IS EMPTY&#xA;                if (!$element-&amp;gt;expiryDate) {&#xA;&#xA;  $event-&amp;gt;params['entry']-&amp;gt;addError('expiryDate', Craft::t('Expiration Date cannot be blank.'));&#xA;  $event-&amp;gt;performAction = false;&#xA;&#xA;                }&#xA;            }&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just not sure on this bit: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$event-&gt;params['entry']-&gt;addError('expiryDate', Craft::t('Expiration Date cannot be blank.'));&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$event-&gt;performAction = false;&lt;/p&gt;&#xA;" OwnerUserId="5838" LastActivityDate="2018-10-19T10:56:14.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28136" PostTypeId="1" CreationDate="2018-10-19T14:51:28.733" Score="1" ViewCount="40" Body="&lt;p&gt;I have to create the following categories hierachically : One book has between 1 and 150 chapters.&#xA;I have to do this for several books.  Dealing with chapters is painful using the GUI. Is there any way to achieve this directly using json, queries ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category &quot;Book 1&quot; is consisted of 100 chapters subcategory&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Book 1 -&gt; Chap 1 &lt;/li&gt;&#xA;&lt;li&gt;Book 1 -&gt; Chap 2 &lt;/li&gt;&#xA;&lt;li&gt;...  &lt;/li&gt;&#xA;&lt;li&gt;Book 1 -&gt; Chap 100&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Category &quot;Book 1&quot; is consisted of 10 chapters subcategory&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Book 2 -&gt; Chap 1 &lt;/li&gt;&#xA;&lt;li&gt;Book 2 -&gt; Chap 2 &lt;/li&gt;&#xA;&lt;li&gt;...  &lt;/li&gt;&#xA;&lt;li&gt;Book 1 -&gt; Chap 10&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8894" LastEditorUserId="8894" LastEditDate="2018-10-19T14:56:59.393" LastActivityDate="2018-10-19T16:47:51.507" Title="Create several subcategories without using the GUI in craft" Tags="&lt;craft3&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28138" PostTypeId="2" ParentId="28117" CreationDate="2018-10-19T15:23:30.830" Score="1" Body="&lt;p&gt;Although your question is lacking in detail, here is a shot at helping you track down the issue. The fact that GET requests are working but POST requests are not, your form is likely missing a CSRF token. You can add it to your form using the following twig code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot;&amp;gt;&#xA;&#xA;   {{ csrfInput() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your POST request is coming through as an AJAX request then you can create and submit a CSRF token as described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/6588/180&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-10-19T15:23:30.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28139" PostTypeId="2" ParentId="28136" CreationDate="2018-10-19T16:47:51.507" Score="1" Body="&lt;p&gt;If you have the JSON of the chapters or want to create it, you could import them using FeedMe Pro (required to import the Category element type). It'll import the categories and create child categories if they're not already created.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-10-19T16:47:51.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28140" PostTypeId="1" CreationDate="2018-10-19T18:22:27.397" Score="1" ViewCount="139" Body="&lt;p&gt;I'm seeing a lot of &quot;Invalid argument&quot; errors in the web.log for a &quot;Multiple Option Variant&quot; module I have running. It seems to be working just fine on the site, but curious as to what the issue might be. Do I need to put in some &quot;guards&quot; in the code, and if so, what would that look like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[error][yii\base\ErrorException:2] yii\base\ErrorException: Invalid argument supplied for foreach() in /httpd.www/craft/modules/multipleoptionvariantmodule/src/variables/MultipleOptionVariantModuleVariable.php:52&#xA;#0 /httpd.www/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler-&amp;gt;handleError(2, 'Invalid argumen...', '/httpd.www/...', 52)&#xA;#1 /httpd.www/craft/modules/multipleoptionvariantmodule/src/variables/MultipleOptionVariantModuleVariable.php(52): craft\web\ErrorHandler-&amp;gt;handleError(2, 'Invalid argumen...', '/httpd.www/...', 52, Array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The referenced file at looks like this—and it seems to be the foreach function that's the culprit;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\multipleoptionvariantmodule\variables;&#xA;&#xA;use modules\multipleoptionvariantmodule\MultipleOptionVariantModule;&#xA;&#xA;use Craft;&#xA;&#xA;class MultipleOptionVariantModuleVariable&#xA;{&#xA;     public function getUniqueVariantAttributeValues($fieldName, $variants, $onlyInStock=false) {&#xA;         $addedIds = array();&#xA;         $sizes = array();&#xA;&#xA;         foreach($variants as $variant) {&#xA;             $outOfStock = (($variant-&amp;gt;stock &amp;lt;= 0) &amp;amp;&amp;amp; ($variant-&amp;gt;hasUnlimitedStock == false));&#xA;&#xA;             if (!$onlyInStock || ($onlyInStock &amp;amp;&amp;amp; !$outOfStock)) {&#xA;                 if (isset($variant-&amp;gt;{$fieldName}[0])) {&#xA;                     if (array_search($variant-&amp;gt;{$fieldName}[0]-&amp;gt;slug, $addedIds, true) === false) {&#xA;                         $sizes[] = $variant-&amp;gt;{$fieldName}[0];&#xA;                         $addedIds[] = $variant-&amp;gt;{$fieldName}[0]-&amp;gt;slug;&#xA;                     }&#xA;                 }&#xA;             }&#xA;         }&#xA;&#xA;         return $sizes;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is then how that is used in the template(s);&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variants = product.variants %}&#xA;{% set variantColors = craft.multipleOptionVariantModule.getUniqueVariantAttributeValues('variantColor', variants, false) %}&#xA;{% set variantTypes = craft.multipleOptionVariantModule.getUniqueVariantAttributeValues('variantType', variants, false) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd take any hints on how to convert that php functionality to pure twig too. :)&#xA;That would actually be ideal.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-08-16T05:02:30.313" Title="Craft 3 Module Working but Throwing Errors in web.log" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28141" PostTypeId="1" CreationDate="2018-10-19T20:14:45.060" Score="0" ViewCount="170" Body="&lt;p&gt;I'm having a weird issue with the Rich Text Editor (Redactor -&gt; simple.json, only &quot;bold&quot; and &quot;italic&quot;) on newly added fields and only ONE (that i know of) older field.&#xA;Every time i add a &quot;bold&quot; format and then save the entry, it goes back to its previous state and never actually saves it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a bold word in that block and i try to add / modify other blocks, nothing saves either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i don't use &quot;bold&quot; in THAT specific field or newly created ones, it all works perfectly. Even the &quot;italic&quot; option works. If i use &quot;bold&quot; in an other older field, it works perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It used to work like a charm, no updates has been done since (i did it afterwards to try and solve it: nothing changed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No trace about that in the craft logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what's the problem? Or how to debug further? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: That one is on Craft 2.7.2!&lt;/p&gt;&#xA;" OwnerUserId="8516" LastActivityDate="2018-10-28T01:32:40.090" Title="Entry not saving when Redactor bold" Tags="&lt;entry&gt;&lt;redactor&gt;&lt;saveentry&gt;&lt;saving&gt;&lt;onsaveentry&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28142" PostTypeId="2" ParentId="23289" CreationDate="2018-10-19T20:48:42.147" Score="1" Body="&lt;p&gt;&lt;strong&gt;Try Removing EXIF data from your images&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After increasing PHP Memory and upload limits I would still occasionally run into issues while uploading images and it didn't matter if I was uploading local to the server or to an S3 bucket. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far my issues appear to be PNG files, so I tried making the images smaller not only by actual file sizes but also dimensionally smaller (width x height). My troubled files were as small as 300kb and only 300 x 800 wide when in other cases I had no issues uploading several 3mb+ images in a single shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that Craft is quite capable of handling the images so what gives? If the image itself is so basic then maybe some string in the meta data is too long? Well, removing EXIF data has worked well thus far. I found a free program online that lives on the Mac App Store so I am guessing you shouldn't have trouble finding a similar application.&lt;/p&gt;&#xA;" OwnerUserId="8935" LastActivityDate="2018-10-19T20:48:42.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28143" PostTypeId="1" CreationDate="2018-10-19T21:14:27.043" Score="2" ViewCount="135" Body="&lt;p&gt;I am new to Craft, but one of my clients has a website built in Craft. They would like to &quot;gate&quot; the content on a page of their website. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A. Is it possible to gate content in the Craft CMS? Client wants to add the capability of requiring an email address before viewing the content on a certain page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B. If it is possible, what are the steps to adding/implementing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. &lt;/p&gt;&#xA;" OwnerUserId="8936" LastActivityDate="2018-10-22T07:10:51.603" Title="How Do You Add A Form on a Page to Gate the Content?" Tags="&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28144" PostTypeId="1" AcceptedAnswerId="28147" CreationDate="2018-10-20T00:37:58.263" Score="1" ViewCount="158" Body="&lt;p&gt;I have a front end form for entry creation. I have a few options I don't want tampered with. &lt;a href=&quot;https://docs.craftcms.com/v3/dev/filters.html#hash&quot; rel=&quot;nofollow noreferrer&quot;&gt;The docs for |hash say&lt;/a&gt; &quot;&lt;em&gt;Prefixes the given string with a keyed-hash message authentication code (HMAC), for securely passing data in forms that should not be tampered with.&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a dropdown field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[businessStatus][]&quot; value=&quot;{{ 'created'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When &lt;code&gt;|hash&lt;/code&gt; is added the page just reloads instead of going to the correct redirect URL. So I tried a plain text field with &lt;code&gt;|hash&lt;/code&gt; and a hashed string is submitted instead of the string before the filter. I'm guessing this is why the page reloads for the dropdown field, what's being submitted doesn't match one of the field's values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Am I misunderstanding how &lt;code&gt;|hash&lt;/code&gt; works?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, it says &quot;&lt;em&gt;Prefixes the given &lt;strong&gt;string&lt;/em&gt;&lt;/strong&gt;&quot;, what if you need to protect a integer?&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-10-20T03:22:46.093" Title="hashing form fields to prevent tampering" Tags="&lt;templating&gt;&lt;form&gt;&lt;security&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28145" PostTypeId="2" ParentId="28109" CreationDate="2018-10-20T02:43:51.953" Score="1" Body="&lt;p&gt;Craft goes with Yii 2's defaults in the FileTarget class, which is 10MB for a log file before rotating. &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#&lt;/a&gt;$maxFileSize-detail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can overwrite that behavior from your &lt;code&gt;config/app.php&lt;/code&gt; file by using something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'components' =&amp;gt; [&#xA;        'log' =&amp;gt; function() {&#xA;            $log = Craft::createObject([&#xA;                'class' =&amp;gt; yii\log\Dispatcher::class,&#xA;                'targets' =&amp;gt; [&#xA;                    [&#xA;                        'class' =&amp;gt; craft\log\FileTarget::class,&#xA;                        'levels' =&amp;gt; !YII_DEBUG ? yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING : yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING | yii\log\Logger::LEVEL_INFO | yii\log\Logger::LEVEL_TRACE | yii\log\Logger::LEVEL_PROFILE,&#xA;                        'maxFileSize' =&amp;gt; 5120, // 5MB&#xA;                    ],&#xA;                ],&#xA;            ]);&#xA;&#xA;            return $log;&#xA;        },&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-20T02:43:51.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28146" PostTypeId="2" ParentId="28140" CreationDate="2018-10-20T03:11:02.557" Score="1" Body="&lt;p&gt;You'll get that error in PHP when you try to iterate over a variable that isn't an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you'd be able to guard against it with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (is_array($variants)) {&#xA;    foreach($variants as $variant) {&#xA;    ...&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-20T03:11:02.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28147" PostTypeId="2" ParentId="28144" CreationDate="2018-10-20T03:22:46.093" Score="1" Body="&lt;p&gt;If you're posting to Craft's &lt;code&gt;EntriesController-&amp;gt;saveEntry()&lt;/code&gt;, then it doesn't do any hash validation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to post to a controller of your own (from a plugin or module if you're on Craft 3), then validate the data yourself like the example in the docs you linked to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$foo = Craft::$app-&amp;gt;request-&amp;gt;getPost('foo');&#xA;$foo = Craft::$app-&amp;gt;security-&amp;gt;validateData($foo);&#xA;&#xA;if ($foo !== false) {&#xA;    // data is valid&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then your controller would manually save the entry similar to how Craft does after your validation.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-20T03:22:46.093" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28148" PostTypeId="1" CreationDate="2018-10-20T20:52:44.093" Score="2" ViewCount="39" Body="&lt;p&gt;I need to display entries from the past 12 months. I'd like to create an entry query and set the timeframe of the entries I need.&lt;/p&gt;&#xA;" OwnerUserId="7445" LastActivityDate="2018-10-20T20:52:44.093" Title="How to show entires from past 12 months?" Tags="&lt;entry&gt;&lt;query&gt;&lt;queries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28149" PostTypeId="2" ParentId="28148" CreationDate="2018-10-20T20:52:44.093" Score="2" Body="&lt;p&gt;I used the &lt;code&gt;after&lt;/code&gt; parameter in my query.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries({&#xA;    after: now|date_modify('5:00 -12 months')&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm grabbing todays date, then modifying with the &lt;code&gt;date_modify&lt;/code&gt; filter. The &lt;code&gt;5:00&lt;/code&gt; string makes sure it changes at the same time everyday. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got the usage of &lt;code&gt;date_modify&lt;/code&gt; from carlcs's answer here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19023/how-to-only-show-entries-older-than-12-months&quot;&gt;How to only show entries older than 12 months&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7445" LastActivityDate="2018-10-20T20:52:44.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28150" PostTypeId="2" ParentId="28131" CreationDate="2018-10-20T23:42:06.913" Score="2" Body="&lt;p&gt;MY SOLUTION&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;setAttributes&lt;/code&gt; and set the second argument &lt;code&gt;$safeOnly&lt;/code&gt; to false&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldsService = Craft::$app-&amp;gt;getFields();&#xA;$field = $fieldsService-&amp;gt;getFieldByHandle('productImages');&#xA;// Update 'limit' value to be empty in order to accept as many images as needed&#xA;$field-&amp;gt;setAttributes([&#xA;    'limit' =&amp;gt; ''&#xA;],false);&#xA;$fieldsService-&amp;gt;saveField($field);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8759" LastActivityDate="2018-10-20T23:42:06.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28152" PostTypeId="1" CreationDate="2018-10-21T07:33:03.783" Score="1" ViewCount="110" Body="&lt;p&gt;I'm needing to get the unique entry submission amount for a value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;Item1, Item2, Item1, Item3, Item1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Would return:&lt;/strong&gt;&#xA;3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to use the workaround here &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23277/search-filter-freeform-submissions-by-field-value&quot;&gt;Search/Filter Freeform submissions by field value&lt;/a&gt; to get the specific submission amount but only wanting to know the number of unique submission values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="8937" LastActivityDate="2019-05-14T08:40:02.127" Title="Freeform plugin unique submission amount" Tags="&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28153" PostTypeId="1" AcceptedAnswerId="28161" CreationDate="2018-10-21T21:47:50.983" Score="1" ViewCount="401" Body="&lt;p&gt;I've successfully upgraded a Craft 2 install to Craft 3 on my local machine, but now that I've moved everything to production, I'm getting this error anytime I try to load a template that uses Freeform or edit an entry that uses the Freeform Matrix field, or when I try to remove the Freeform Matrix field from use.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ParseError: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccessor.php:36&#xA;Stack trace:&#xA;#0 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/nfs/c12/h02/mn...')&#xA;#1 [internal function]: Composer\Autoload\ClassLoader-&amp;gt;loadClass('Symfony\\Compone...')&#xA;#2 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccessorBuilder.php(131): spl_autoload_call('Symfony\\Compone...')&#xA;#3 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/symfony/property-access/PropertyAccess.php(28): Symfony\Component\PropertyAccess\PropertyAccessorBuilder-&amp;gt;getPropertyAccessor()&#xA;#4 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/AbstractField.php(82): Symfony\Component\PropertyAccess\PropertyAccess::createPropertyAccessor()&#xA;#5 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Factories/ComposerFieldFactory.php(75): Solspace\Freeform\Library\Composer\Components\AbstractField::createFromProperties(Object(Solspace\Freeform\Library\Composer\Components\Form), Object(Solspace\Freeform\Library\Composer\Components\Properties\FieldProperties), Object(Solspace\Freeform\Library\Session\FormValueContext), 0)&#xA;#6 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Layout.php(364): Solspace\Freeform\Library\Factories\ComposerFieldFactory::createFromProperties(Object(Solspace\Freeform\Library\Composer\Components\Form), Object(Solspace\Freeform\Library\Composer\Components\Properties\FieldProperties), Object(Solspace\Freeform\Library\Session\FormValueContext), 0)&#xA;#7 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Layout.php(101): Solspace\Freeform\Library\Composer\Components\Layout-&amp;gt;buildLayout(Object(Solspace\Freeform\Library\Session\FormValueContext))&#xA;#8 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Components/Form.php(179): Solspace\Freeform\Library\Composer\Components\Layout-&amp;gt;__construct(Object(Solspace\Freeform\Library\Composer\Components\Form), Array, Object(Solspace\Freeform\Library\Composer\Components\Properties), Object(Solspace\Freeform\Library\Session\FormValueContext), Object(Solspace\Freeform\Library\Translations\CraftTranslator))&#xA;#9 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Composer.php(226): Solspace\Freeform\Library\Composer\Components\Form-&amp;gt;__construct(Object(Solspace\Freeform\Library\Composer\Components\Properties), Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes), Array, Object(Solspace\Freeform\Services\FormsService), Object(Solspace\Freeform\Services\FieldsService), Object(Solspace\Freeform\Services\SubmissionsService), Object(Solspace\Freeform\Services\SpamSubmissionsService), Object(Solspace\Freeform\Services\FilesService), Object(Solspace\Freeform\Library\Translations\CraftTranslator), Object(Monolog\Logger))&#xA;#10 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Library/Composer/Composer.php(112): Solspace\Freeform\Library\Composer\Composer-&amp;gt;validateComposerData(Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes))&#xA;#11 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Models/FormModel.php(141): Solspace\Freeform\Library\Composer\Composer-&amp;gt;__construct(Array, Object(Solspace\Freeform\Library\Composer\Attributes\FormAttributes), Object(Solspace\Freeform\Services\FormsService), Object(Solspace\Freeform\Services\FieldsService), Object(Solspace\Freeform\Services\SubmissionsService), Object(Solspace\Freeform\Services\SpamSubmissionsService), Object(Solspace\Freeform\Services\FilesService), Object(Solspace\Freeform\Services\StatusesService), Object(Solspace\Freeform\Library\Translations\CraftTranslator), Object(Monolog\Logger))&#xA;#12 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Models/FormModel.php(181): Solspace\Freeform\Models\FormModel-&amp;gt;getComposer()&#xA;#13 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/solspace/craft3-freeform/src/Variables/FreeformVariable.php(39): Solspace\Freeform\Models\FormModel-&amp;gt;getForm()&#xA;#14 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Extension/Core.php(1619): Solspace\Freeform\Variables\FreeformVariable-&amp;gt;form('contact')&#xA;#15 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/helpers/Template.php(73): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(Solspace\Freeform\Variables\FreeformVariable), 'form', Array, 'method', false, false)&#xA;#16 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(1134): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(Solspace\Freeform\Variables\FreeformVariable), 'form', Array, 'method')&#xA;#17 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(189): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df_1371066880-&amp;gt;block_content(Array, Array)&#xA;#18 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/e1/e18892d07e96f54281b257243b47df5c3c472532bb04f3dcd598cc90f7caf331.php(33): Twig_Template-&amp;gt;displayBlock('content', Array, Array)&#xA;#19 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_a9075adcd269d2a009f2e9ea0a663da5fb05a154b25ba8bfe126edf0b84781bf-&amp;gt;doDisplay(Array, Array)&#xA;#20 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#21 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#22 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#23 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(435): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#24 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df_1371066880-&amp;gt;doDisplay(Array, Array)&#xA;#25 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#26 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#27 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#28 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/49/490c1e38c73774194ec4db7b0d434edd73b90ada852ba19a47d7151deaf8baae.php(91): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#29 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_df6084533b45dbb97216b53f70d72500723f0c627d73d735f02e06ac485c51df-&amp;gt;doDisplay(Array, Array)&#xA;#30 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#31 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#32 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#33 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/55/5508cdc0a50b370b23f6ec0ba3962a8c8153a034e0b199e7615d133dde1089c9.php(41): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#34 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(189): __TwigTemplate_b21fc72ed6773279e32ba5c448920e81587c43b17bf5d251d680273efee40c38-&amp;gt;block_content(Array, Array)&#xA;#35 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/50/50ddd0fb8796360ec27783bd66594cb5d81bb2d0d7c6c3aa7efd96a7d6c6f4b3.php(123): Twig_Template-&amp;gt;displayBlock('content', Array, Array)&#xA;#36 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_2e2b57df12e19bc3a90c2a8d5cecd81a1a85b4424d1a3677d92914c0df6b3f10-&amp;gt;doDisplay(Array, Array)&#xA;#37 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#38 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#39 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#40 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/storage/runtime/compiled_templates/55/5508cdc0a50b370b23f6ec0ba3962a8c8153a034e0b199e7615d133dde1089c9.php(31): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#41 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_b21fc72ed6773279e32ba5c448920e81587c43b17bf5d251d680273efee40c38-&amp;gt;doDisplay(Array, Array)&#xA;#42 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#43 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#44 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#45 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#46 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#47 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment-&amp;gt;render('index', Array)&#xA;#48 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/View.php(378): craft\web\View-&amp;gt;renderTemplate('index', Array)&#xA;#49 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Controller.php(156): craft\web\View-&amp;gt;renderPageTemplate('index', Array)&#xA;#50 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/controllers/TemplatesController.php(78): craft\web\Controller-&amp;gt;renderTemplate('index', Array)&#xA;#51 [internal function]: craft\controllers\TemplatesController-&amp;gt;actionRender('index', Array)&#xA;#52 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#53 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#54 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller-&amp;gt;runAction('render', Array)&#xA;#55 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('render', Array)&#xA;#56 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('templates/rende...', Array)&#xA;#57 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&amp;gt;runAction('templates/rende...', Array)&#xA;#58 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/craftcms/cms/src/web/Application.php(271): yii\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#59 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#60 /nfs/c12/h02/mnt/xxxxxx/domains/domain.com/html/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#61 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5957" LastEditorUserId="57" LastEditDate="2018-10-22T15:31:17.803" LastActivityDate="2018-10-22T15:38:40.373" Title="CraftCMS 2 -&gt; 3 Migration error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)" Tags="&lt;error&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28154" PostTypeId="1" CreationDate="2018-10-22T05:11:16.253" Score="1" ViewCount="379" Body="&lt;p&gt;I am developing a website on Craft CMS and now I need to change the domain for my Craft account. Because it's giving me an error &quot;The license located at config/license.key belongs to....&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not have any details about the Craft ID all I have is the license key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to recover my Craft credentials using my Craft license key.&lt;/p&gt;&#xA;" OwnerUserId="8162" LastEditorUserId="57" LastEditDate="2018-10-22T15:49:00.677" LastActivityDate="2021-04-22T14:08:05.780" Title="How to find my Craft ID account details" Tags="&lt;craft3&gt;&lt;license&gt;&lt;craft-id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28155" PostTypeId="2" ParentId="28143" CreationDate="2018-10-22T07:02:11.067" Score="2" Body="&lt;p&gt;Depending on your Craft License you could make use of a login form as described inside the docs &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you got the loginform working, simply use &lt;code&gt;{% requireLogin %}&lt;/code&gt; on the site template (i.e. inside the twig template file) that should have restricted access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your goal is to just provide an E-Mail without a password you would need to tinker around a bit and maybe just write up a small plugin. To get startet I suggest reading &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://nystudio107.com/blog/so-you-wanna-make-a-craft-3-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;. Out of the box this is not possible as far as I know.&#xA;I would advise not just using an E-Mail for validation as &lt;code&gt;ab@c.de&lt;/code&gt; for example is a valid E-Mail, though unlikely that it is real. Some sort of login/auth would provide a more solid experience and enforces that the user is real and has validated their E-Mail with the CMS (as craft can send a validation link to given E-Mail after registering with the site).&lt;/p&gt;&#xA;" OwnerUserId="5855" LastEditorUserId="5855" LastEditDate="2018-10-22T07:10:51.603" LastActivityDate="2018-10-22T07:10:51.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28156" PostTypeId="1" CreationDate="2018-10-22T10:16:47.123" Score="2" ViewCount="632" Body="&lt;p&gt;In the multi-site Live Preview in admin panel show error in the console.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Failed to load &lt;a href=&quot;http://www.example.local/test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.local/test&lt;/a&gt;: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin '&lt;a href=&quot;http://www.example.test&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.example.test&lt;/a&gt;' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="57" LastEditDate="2018-10-22T17:20:50.977" LastActivityDate="2019-04-11T12:42:31.393" Title="Multi-site Live Preview not working in Craft 3" Tags="&lt;craft3&gt;&lt;htaccess&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28157" PostTypeId="1" CreationDate="2018-10-22T11:27:32.380" Score="1" ViewCount="52" Body="&lt;p&gt;We have a online-shop for german customers (Craft 2 + Commerce 1) and will expand the shop for american customers (via second domain).&#xA;Is there a way to filter the order (status) views in the Backend by domain/language.&#xA;The purpose is that the american backend user should only see orders that come via the american domain and the german backend user should see only german based orders.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-10-22T11:43:32.430" Title="Special order filter (by language) in CP for Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;control-panel&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28158" PostTypeId="2" ParentId="28157" CreationDate="2018-10-22T11:43:32.430" Score="1" Body="&lt;p&gt;Not possible with the system by default. Commerce doesn't support multi-store yet (and wont in Commerce 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want, a plugin could modify the order sources on the left side of the order listing screen using the hook:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcommerce.com/docs/hooks-reference#commerce_modifyordersources&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcommerce.com/docs/hooks-reference#commerce_modifyordersources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this hook you could show/hide sources depending on the user, and add sources for filtering my orderLanguage etc.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-10-22T11:43:32.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28159" PostTypeId="1" AcceptedAnswerId="28198" CreationDate="2018-10-22T13:29:30.770" Score="2" ViewCount="500" Body="&lt;p&gt;I have an entry type that includes an Assets field. When this entry is created/saved via the CP or a front-end form, I want to rename the Asset file as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Entry's author id&lt;/strong&gt;. E.g: 148&lt;/li&gt;&#xA;&lt;li&gt;01, 02, 03 based on how many entries the author has already submitted.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So files would look like: 148-01.jpg 148-02.jpg, 148-03.jpg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some point, I would also like to add the value of a custom field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would like to limit this to entry for a certain type in a certain section: Section name: &quot;Competitions&quot;, Entry type: &quot;Submission&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot: &lt;a href=&quot;https://cl.ly/a526f40c6d58&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cl.ly/a526f40c6d58&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far In my Craft 3 Module I have this. I can get the Asset id, but I can't get the Entry's Author Id:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function (ElementEvent $event) {&#xA;        $asset = $event-&amp;gt;element;&#xA;        $id = $event-&amp;gt;element-&amp;gt;getId();&#xA;        if ($event-&amp;gt;isNew &amp;amp;&amp;amp; $asset instanceof craft\elements\Asset) {&#xA;            $newFileName = &quot;new-file-name-&quot; . $id . &quot;.jpg&quot;;&#xA;            Craft::$app-&amp;gt;assets-&amp;gt;moveAsset($asset, $asset-&amp;gt;getFolder(), $newFileName);&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found this answer &lt;a href=&quot;https://craftcms.stackexchange.com/a/13199/298&quot;&gt;https://craftcms.stackexchange.com/a/13199/298&lt;/a&gt;, but it's for Craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('entries.beforeSaveEntry', function(Event $event)&#xA;{&#xA;    $entry = $event-&amp;gt;params['entry'];&#xA;&#xA;    if (($entry-&amp;gt;section['handle'] == 'friends') &amp;amp;&amp;amp; ($entry-&amp;gt;type['handle'] == 'friends'))&#xA;    {&#xA;        $title = $entry-&amp;gt;slug;&#xA;        $assets = $entry-&amp;gt;imgdir;&#xA;&#xA;        if (count($assets) != 1)&#xA;        {&#xA;            $event-&amp;gt;params['entry']-&amp;gt;addError('imgdir', Craft::t('Exactly 1 asset has to be selected.'));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;        else&#xA;        {&#xA;            $filename = $title.'.'.$assets[0]-&amp;gt;getExtension();&#xA;&#xA;            craft()-&amp;gt;assets-&amp;gt;renameFile($assets[0], $filename);&#xA;            craft()-&amp;gt;assets-&amp;gt;storeFile($assets[0]);&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do this in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-10-22T17:16:05.403" LastActivityDate="2018-10-24T13:18:32.673" Title="How can I rename an asset file on upload when an entry is saved (Craft 3)?" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28160" PostTypeId="1" CreationDate="2018-10-22T15:21:03.237" Score="1" ViewCount="745" Body="&lt;p&gt;Just successfully installed a fresh copy of Craft CMS via web browser method under:&#xA;&lt;a href=&quot;http://kultursprung.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kultursprung.org&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frontend is visible but the admin is showing raw Apache error 500 after fresh install:&#xA;&lt;a href=&quot;http://kultursprung.org/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kultursprung.org/admin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 500 error is not the styled Craft dev one but instead the raw Apache version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Server requirements check passed:&#xA;&lt;a href=&quot;http://kultursprung.org/server/checkit.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kultursprung.org/server/checkit.php&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did set all correct file and folder permissions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Database is showing all necessary tables as expected after a successful fresh install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;phperrors.log:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EQG6C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EQG6C.png&quot; alt=&quot;phperrors.log&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I access the admin via this URL:&#xA;&lt;a href=&quot;http://kultursprung.org/index.php?p=admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kultursprung.org/index.php?p=admin&lt;/a&gt;&#xA;i can provide an additional Craft styled error:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XBReP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XBReP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="8939" LastEditorUserId="57" LastEditDate="2018-10-22T16:01:12.810" LastActivityDate="2021-04-10T00:04:40.450" Title="Craft 3: admin is showing &quot;500 Internal Server Error&quot; (apache) after fresh install" Tags="&lt;craft3&gt;&lt;error&gt;&lt;admin&gt;&lt;install&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28161" PostTypeId="2" ParentId="28153" CreationDate="2018-10-22T15:38:40.373" Score="2" Body="&lt;p&gt;That error means that your Craft installation is choking on one of Craft's Composer dependencies that is using newer PHP 7.1 syntax and your current box is using PHP 7.0.x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually when that happens, someone did a Composer install/update locally using a newer version of PHP than what you have on then box you're getting the error on, then deployed the composer.json, composer.lock and vendor folder up using the latest and greatest dependencies Composer thinks you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In cases like this, it's usually better to add something like this to your composer.json file &lt;a href=&quot;https://github.com/pixelandtonic/craftnet/blob/develop/composer.json#L37-L41&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/pixelandtonic/craftnet/blob/develop/composer.json#L37-L41&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you set that to the &quot;lowest common PHP denominator&quot; across all of your environments. That way, Composer will never try to bring in a dependency that's greater than any environment can support.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-22T15:38:40.373" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28162" PostTypeId="2" ParentId="28154" CreationDate="2018-10-22T15:42:34.657" Score="0" Body="&lt;p&gt;You don't automatically get a Craft ID account just from making a purchase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd need to manually create one at &lt;a href=&quot;https://id.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://id.craftcms.com&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create one with the same email address you've made purchases with, those purchases and license.key files will automatically be tied to your account so you can manage them and the domains they are associated with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make purchases with different email addresses, you'll have ways of claiming those licenses via alternative email addresses from within your Craft ID account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you already have a Craft ID account and you don't remember the password, you can go through the &quot;Forgot your password&quot; link on &lt;a href=&quot;https://id.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://id.craftcms.com&lt;/a&gt; by entering your existing username or email.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-22T15:42:34.657" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28163" PostTypeId="2" ParentId="28160" CreationDate="2018-10-22T15:55:40.907" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;(/usr/local/lib/php/extensions/no-debug-non-zts-20170718/imagick.so.so: cannot open shared object file: Permission denied))&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does that file exist on your server?  I'm asking because the &lt;code&gt;.so.so&lt;/code&gt; extension seems odd.  If it does and it's just &lt;code&gt;.so&lt;/code&gt;, it might be as simple as editing your php.ini file so it's loading &lt;code&gt;imagick.so&lt;/code&gt; instead of &lt;code&gt;imagick.so.so&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you php.ini file is already loading &lt;code&gt;imagick.so&lt;/code&gt; and that file exists on your server at that location, then check the permissions of that file and make sure that whatever user:group your web server is running as has permissions to read that file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-22T15:55:40.907" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28164" PostTypeId="1" CreationDate="2018-10-22T16:26:42.320" Score="1" ViewCount="190" Body="&lt;p&gt;I've got a newly upgraded Craft 3 site. I have one section with a few entry types. However, when attempting to switch to a different entry type I get a JS error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failed to load resource: the server responded with a status of 500 () &lt;a href=&quot;https://domain.com/index.php?p=admin/actions/entries/switch-entry-type&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://domain.com/index.php?p=admin/actions/entries/switch-entry-type&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've verified the site url and each field in the entry types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the yii debugger:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; TypeError: Argument 1 passed to craft\services\Elements::getElementById() must be of the type integer, string given, called in /home/xxxx/craft3/vendor/barrelstrength/sprout-seo/src/fields/ElementMetadata.php on line 189 and defined in /home/xxxx/craft3/vendor/craftcms/cms/src/services/Elements.php:174&#xA;Stack trace:&#xA;#0 /home/xxxx/craft3/vendor/barrelstrength/sprout-seo/src/fields/ElementMetadata.php(189): craft\services\Elements-&amp;gt;getElementById('')&#xA;#1 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Extension/Core.php(1619): barrelstrength\sproutseo\fields\ElementMetadata-&amp;gt;getInputHtml(Object(barrelstrength\sproutseo\models\Metadata), Object(craft\elements\Entry))&#xA;#2 /home/xxxx/craft3/vendor/craftcms/cms/src/helpers/Template.php(73): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(barrelstrength\sproutseo\fields\ElementMetadata), 'getInputHtml', Array, 'method', false, false)&#xA;#3 /home/xxxx/craft3/storage/runtime/compiled_templates/46/46a7b66548802d89cb6e5e9120dba7ea1ad7665705cd35d5875d2f2159ea89b8.php(83): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(barrelstrength\sproutseo\fields\ElementMetadata), 'getInputHtml', Array, 'method')&#xA;#4 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_95cfe8b626753c0b28835c72443139945f42ded55602d1a15240c5a71d272740-&amp;gt;doDisplay(Array, Array)&#xA;#5 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#6 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#7 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#8 /home/xxxx/craft3/storage/runtime/compiled_templates/ad/ad67eeee9d6a0c49d9fa00e4e63b57f23e8aa6d49bc3e39ca25b08dce15d23f5.php(47): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#9 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_81ae65a6f8373ba5cf70bf8aca79f49038baa5a381623bc7b797f2a894a29a1a-&amp;gt;doDisplay(Array, Array)&#xA;#10 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#11 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#12 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#13 /home/xxxx/craft3/storage/runtime/compiled_templates/79/79255023f7a23e8fe6f99b0179ae2940e4618e223d8ec3ad853784cf76bfb479.php(59): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#14 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_01b4e3e362dd97c023ddf1eecf2e1a873239f75ff1449d71ff06d570334500da-&amp;gt;doDisplay(Array, Array)&#xA;#15 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#16 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#17 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#18 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#19 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#20 /home/xxxx/craft3/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment-&amp;gt;render('entries/_fields', Array)&#xA;#21 /home/xxxx/craft3/vendor/craftcms/cms/src/controllers/EntriesController.php(406): craft\web\View-&amp;gt;renderTemplate('entries/_fields', Array)&#xA;#22 [internal function]: craft\controllers\EntriesController-&amp;gt;actionSwitchEntryType()&#xA;#23 /home/xxxx/craft3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#24 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#25 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller-&amp;gt;runAction('switch-entry-ty...', Array)&#xA;#26 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('switch-entry-ty...', Array)&#xA;#27 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('entries/switch-...', Array)&#xA;#28 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application-&amp;gt;runAction('entries/switch-...', Array)&#xA;#29 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#30 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#31 /home/xxxx/dev.xxxx/index.php(23): yii\base\Application-&amp;gt;run()&#xA;#32 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="877" LastEditorUserId="57" LastEditDate="2018-10-22T22:10:36.733" LastActivityDate="2018-10-29T22:02:25.517" Title="Cannot switch entry type" Tags="&lt;craft3&gt;&lt;entry-type&gt;&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28165" PostTypeId="2" ParentId="28156" CreationDate="2018-10-22T17:37:00.817" Score="1" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been implemented for the upcoming Craft 3.1 release.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Currently Live Preview will only work across sub-domains (i.e. site1.domain.com and site2.domain.com), not completely different domains (site1.com and site2.com) &#xA; Here's a guide on how you'd set that up: &lt;a href=&quot;https://craftcms.com/guides/using-live-preview-across-multiple-subdomains&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/using-live-preview-across-multiple-subdomains&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for it to work across completely different domains, &lt;a href=&quot;https://github.com/craftcms/cms/issues/1521&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1521&lt;/a&gt; will need to be implemented.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-11-22T00:04:41.507" LastActivityDate="2018-11-22T00:04:41.507" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28166" PostTypeId="2" ParentId="28152" CreationDate="2018-10-22T17:50:16.210" Score="1" Body="&lt;p&gt;Looks like there's a Craft 2 plugin that exposes PHP's &lt;a href=&quot;https://secure.php.net/manual/en/function.array-unique.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;array_unique&lt;/a&gt; method to Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to continue on the example you linked to, it would be something like this with that plugin installed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Initiate the hash in which we'll store matching submissions. #}&#xA;{% set matchingSubmissions = [] %}&#xA;&#xA;{#&#xA;    Loop through all submissions, checking if the specified field&#xA;    matches the desired value.&#xA;#}&#xA;{% for submission in submissions if submission.fieldWithValue == '123' %}&#xA;&#xA;    {# If the field matches, add it to the hash #}&#xA;    {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{# Count the size of the resulting hash and save it. #}&#xA;{% set totalUniques = matchingSubmissions|unique|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-22T17:50:16.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28167" PostTypeId="1" AcceptedAnswerId="28168" CreationDate="2018-10-22T18:39:25.990" Score="1" ViewCount="167" Body="&lt;p&gt;I'm looking to show recent categories ordered by their associated entries' postDate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I don't want to list the entries within the category&lt;/li&gt;&#xA;&lt;li&gt;I simply want to list 4 categories that have recently updated related entries.&lt;/li&gt;&#xA;&lt;li&gt;Entries from any section can be associated to my site's global categories.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3991" LastActivityDate="2018-10-22T21:25:16.580" Title="Get categories ordered by the associated entries' postDate" Tags="&lt;categories&gt;&lt;relatedto&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28168" PostTypeId="2" ParentId="28167" CreationDate="2018-10-22T21:25:16.580" Score="2" Body="&lt;p&gt;You could technically do this with a lot of custom SQL, but it would be messy. I think your best bet would be to create a custom Date field on your categories called “Last Used”, and then to write a &lt;a href=&quot;https://docs.craftcms.com/v3/extend/&quot; rel=&quot;nofollow noreferrer&quot;&gt;module&lt;/a&gt; that keeps its value updated as entries are saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default Craft 3 project comes with a &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/modules/Module.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;module file&lt;/a&gt; out of the box, so you can use that as a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, add this to the top of the module file, after the &lt;code&gt;namespace&lt;/code&gt; line:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\elements\Category;&#xA;use craft\elements\Entry;&#xA;use craft\events\ModelEvent;&#xA;use yii\base\Event;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in its &lt;code&gt;init()&lt;/code&gt; method, add this after the &lt;code&gt;parent::init()&lt;/code&gt; line:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, function(ModelEvent $event) {&#xA;    /** @var Entry $entry */&#xA;    $entry = $event-&amp;gt;sender;&#xA;&#xA;    if ($entry-&amp;gt;enabled) {&#xA;        // Loop through the related categories&#xA;        foreach ($entry-&amp;gt;myCategoriesField as $category) {&#xA;            /** @var Category $category */&#xA;            // Is this entry's post date more recent than the current Last Used value?&#xA;            if ($entry-&amp;gt;postDate &amp;gt; $category-&amp;gt;lastUsed) {&#xA;                $category-&amp;gt;setFieldValue('lastUsed', $entry-&amp;gt;postDate);&#xA;                Craft::$app-&amp;gt;elements-&amp;gt;saveElement($category, false);&#xA;            }&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can get Craft to re-save all of your entries by re-saving each of your sections’ settings. (You don’t need to change anything.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that in place, you can start sorting by that custom field in your templates.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set categories = craft.categories()&#xA;    .group('myCategoryGroup')&#xA;    .lastUsed('not :empty:')&#xA;    .orderBy('lastUsed desc')&#xA;    .limit(4)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-10-22T21:25:16.580" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28169" PostTypeId="1" CreationDate="2018-10-22T22:55:11.423" Score="1" ViewCount="195" Body="&lt;p&gt;Working on fixing a lot of deprecated code, enviroment is setup as dev so getting a lot of warnings. Some are easily idetified, others are pretty generic and come from core files. Doesn't show where the issue is... So I have been going through each block template removing code till the page loads to narrow it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example Warning:&#xA;strtolower() expects parameter 1 to be string, array given from /vendor/craftcms/cms/src/helpers/Db.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $firstVal = strtolower(reset($value));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have narrowed an existing issue down to the following code from a block template, however I have tried a few different ways but the page will not load with the following code. Anyone know a way to resolve this, it seems to be an issue with the relatedTo&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source of problem? Setting up section&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for feed in block.feeds %}&#xA;    {% if feed == 'all' %}&#xA;        {% set data = ['blog', 'caseStudies', 'dataSheets', 'events', 'news', 'webinars', 'whitePapers', 'artices', 'productDemos'] %}&#xA;        {% set break = true %}&#xA;    {% else %}&#xA;        {% set data = data|merge({ (loop.index0):feed }) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source of problem? Setting up relatedTo&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for related in block.relatedTo %}&#xA;    {% if related == 'All' %}&#xA;        {% set reldata = false %}&#xA;        {% set break = true %}&#xA;    {% else %}&#xA;        {% set reldata = reldata|merge({ (loop.index0):related }) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then Setting up the query seems to be an issue with the section(data) but not sure what needs changed as I do not see a clear deprecation warning, or stacktrace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if reldata %}&#xA;    {% set tag = craft.tags.title(reldata) %}&#xA;    {% set feat = craft.entries.section(data).relatedTo(tag).limit(8).all() %}&#xA;{% else %}&#xA;    {% set feat = craft.entries.section(data).limit(8).all() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2018-10-23T01:16:56.007" LastActivityDate="2019-04-21T06:02:00.320" Title="Fixing deprecated code, relatedTo issue" Tags="&lt;craft3&gt;&lt;sections&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28170" PostTypeId="1" CreationDate="2018-10-23T02:22:54.607" Score="2" ViewCount="282" Body="&lt;p&gt;Working in devMode, when trying to edit an existing single or structure entry, I get an InvalidArgument error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yii\base\InvalidArgumentException: Syntax error. in ...vendor/yiisoft/yii2/helpers/BaseJson.php:133&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (isset($availableErrors[$lastError])) {&#xA;    throw new InvalidArgumentException($availableErrors[$lastError], $lastError);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I notice in Chrome tools I get a bunch of Craft is not defined errors any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="57" LastEditDate="2018-11-22T04:27:53.600" LastActivityDate="2020-01-30T14:30:33.343" Title="Unable to edit single or structures, channels working fine after update to Craft 3" Tags="&lt;entries&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28171" PostTypeId="2" ParentId="28170" CreationDate="2018-10-23T03:37:26.160" Score="4" Body="&lt;p&gt;Was an issue with my Simple.json redactor config&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    buttons: [bold, italic],&#xA;    toolbarFixed: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Needed to be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&quot;bold&quot;, &quot;italic&quot;],&#xA;    &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2018-10-23T03:37:26.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28172" PostTypeId="2" ParentId="28169" CreationDate="2018-10-23T03:38:33.513" Score="1" Body="&lt;p&gt;This seems to have fixed the issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if reldata %}&#xA;    {% set tag = craft.tags.title(reldata|join(', ')) %}&#xA;    {% set feat = craft.entries.section(data|join(', ')).relatedTo(tag).limit(8).all() %}&#xA;{% else %}&#xA;    {% set feat = craft.entries.section(data|join(', ')).limit(8).all() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2018-10-23T03:38:33.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28173" PostTypeId="1" CreationDate="2018-10-23T05:35:02.593" Score="2" ViewCount="1462" Body="&lt;p&gt;How do I filter a list of entries by the value of a field using the value of a variable? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = block.locationVacancies %}&#xA;{% set entries = craft.entries.section('careers').search('locationVacancies:&quot;{{location}}&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;doesn't work for me. But if I replace &lt;code&gt;{{location}}&lt;/code&gt; with the value of the string &lt;code&gt;location&lt;/code&gt; by hand then it works&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.section('careers').search('locationVacancies:&quot;uk&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8941" LastActivityDate="2018-10-30T16:44:29.383" Title="Filter entries by Field value using a variable" Tags="&lt;entries&gt;&lt;search&gt;&lt;variable&gt;&lt;filtering&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28174" PostTypeId="2" ParentId="28173" CreationDate="2018-10-23T06:08:29.900" Score="1" Body="&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set location = block.locationVacancies %}&#xA;{% set entries = craft&#xA;    .entries&#xA;    .section('careers')&#xA;    .search('locationVacancies:&quot;' ~ location ~ '&quot;')&#xA;    .find()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-23T06:08:29.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28175" PostTypeId="1" AcceptedAnswerId="28179" CreationDate="2018-10-23T09:58:30.217" Score="1" ViewCount="196" Body="&lt;p&gt;After some research surrounding this I can't seem to fix this issue. So for a project I made a simple module with some variables that simply has to make an OAuth1 call and return some data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The provider of the website advised me to use :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/thephpleague/oauth1-client&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/thephpleague/oauth1-client&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my module I initialised another composer.json and required the package above. It gets correctly installed to the vendor map in my module. However whenever I call the new OAuth() or new OAuth1() it can't be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried adding it while using the packagepath in the top of my module.php as well as my moduleVariable.php but to no avail. I was wondering if I'm doing something wrong? Or forgetting something? What's the best way to add composer libraries to your own custom module?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards!&lt;/p&gt;&#xA;" OwnerUserId="8359" LastActivityDate="2018-10-23T13:15:06.530" Title="Craft CMS module composer dependancy" Tags="&lt;plugins&gt;&lt;php&gt;&lt;composer&gt;&lt;authentication&gt;&lt;modules&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28176" PostTypeId="2" ParentId="28175" CreationDate="2018-10-23T10:36:27.113" Score="1" Body="&lt;p&gt;The easiest way around this is to include the required library in your main-project &lt;code&gt;composer.json&lt;/code&gt; and let it handle it rather than your modules &lt;code&gt;composer.json&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative is to require your module properly in your main composer file as you do with plugins and install it via path which kinda breaks the idea of it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-23T10:36:27.113" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28177" PostTypeId="1" AcceptedAnswerId="28178" CreationDate="2018-10-23T12:29:25.963" Score="1" ViewCount="352" Body="&lt;p&gt;An entry could be validated by the following code in craft 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;content-&amp;gt;validateContent($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How could be the same done in Craft 3 ?&lt;/p&gt;&#xA;" OwnerUserId="8164" LastActivityDate="2018-10-24T12:23:08.760" Title="How to validate entry in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28178" PostTypeId="2" ParentId="28177" CreationDate="2018-10-23T12:49:33.710" Score="2" Body="&lt;p&gt;Every model has a &lt;code&gt;validate()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// set the scenario to live&#xA;$entry-&amp;gt;setScenario(Element::SCENARIO_LIVE);&#xA;&#xA;// validate the model&#xA;$entry-&amp;gt;validate();&#xA;&#xA;// get the errors,&#xA;$errors = $entry-&amp;gt;getErrors();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="180" LastEditDate="2018-10-24T12:23:08.760" LastActivityDate="2018-10-24T12:23:08.760" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28179" PostTypeId="2" ParentId="28175" CreationDate="2018-10-23T13:15:06.530" Score="1" Body="&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Had to do a sudo pecl install oauth in order to get access to the right OAuth. Had to add the extension to my php.ini and restart my server.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function apiCall($consumer_key, $consumer_secret, $token, $token_secret, $baseURL) {&#xA;    try {&#xA;&#xA;        $oauth = new \OAuth($consumer_key, $consumer_secret,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);&#xA;        $oauth-&amp;gt;setToken($token,$token_secret);&#xA;&#xA;        $oauth-&amp;gt;fetch($baseURL);&#xA;&#xA;        $response_info = $oauth-&amp;gt;getLastResponseInfo();&#xA;        return $oauth-&amp;gt;getLastResponse();&#xA;&#xA;    } catch(OAuthException $E) {&#xA;&#xA;        echo &quot;Exception caught!\n&quot;;&#xA;        echo &quot;Response: &quot;. $E-&amp;gt;lastResponse . &quot;\n&quot;;&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And lastly had to execute the above function in order to get the data I asked for.&lt;/p&gt;&#xA;" OwnerUserId="8359" LastActivityDate="2018-10-23T13:15:06.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28180" PostTypeId="1" AcceptedAnswerId="28195" CreationDate="2018-10-23T14:53:50.793" Score="2" ViewCount="615" Body="&lt;p&gt;I'm trying out the recommended Hyperlane hosting with Craft CMS. After installing on Hyperlane, I then clone the repo on to my local machine and run 'composer install'. That runs fine, and I create a .env file with my db connection details in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens next is I go to install on my machine by viewing the admin panel but I get the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Database Connection Error – craft\errors\DbConnectException&#xA;Craft CMS can’t connect to the database with the credentials in config/db.php.&#xA;↵&#xA;Caused by: Invalid Configuration – yii\base\InvalidConfigException&#xA;Connection::dsn cannot be empty.&#xA;in C:\Users\clive\OneDrive\Desktop\repos\projectname\vendor\yiisoft\yii2\db\Connection.php at line 602&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I add the database details to config/db.php myself, it works fine. It just seems to be a problem with fetching them from .env.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using WAMP on Windows and have numerous Craft 3 projects already running. This same project is fine if I install locally from scratch. It's just when I start by cloning from Hyperlane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-10-24T07:35:50.510" LastActivityDate="2018-10-24T07:36:46.417" Title="Working locally after cloning Craft 3 from Hyperlane" Tags="&lt;craft3&gt;&lt;database&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28181" PostTypeId="1" CreationDate="2018-10-23T15:56:41.603" Score="1" ViewCount="25" Body="&lt;p&gt;I'm looking for a way to query all categories that have at least one relation.  I'm not looking for the relatedTo() parameter, which would give me categories related to something specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, if we talk in Wordpress terms, I'm looking for hideEmpty = true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything like that in Craft?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Something like: craft.categories.group('products').hasRelated()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2018-10-23T16:47:36.547" Title="Is there a query parameter to get categories that are related to anything else?" Tags="&lt;templating&gt;&lt;categories&gt;&lt;query&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28183" PostTypeId="2" ParentId="28181" CreationDate="2018-10-23T16:47:36.547" Score="1" Body="&lt;p&gt;Add this to your chain...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.yourCategoryField(':notempty:')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not very well documented, but you can see it described in &lt;a href=&quot;https://craftcms.stackexchange.com/a/453/45&quot;&gt;this old SE thread&lt;/a&gt;. In the docs, it's mentioned very briefly &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-db.html#method-parseparam&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-10-23T16:47:36.547" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28184" PostTypeId="1" AcceptedAnswerId="28190" CreationDate="2018-10-23T17:15:15.870" Score="1" ViewCount="123" Body="&lt;p&gt;Would it be possible for someone to create a demo of a barebones Adjuster module, similar to &lt;a href=&quot;https://github.com/cliveportman/craftcommerce-adjuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/cliveportman/craftcommerce-adjuster&lt;/a&gt; but for Commerce 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to follow the docs but can't piece everything together.... basically just looking for the most basic module possible for something that adjust the prices of an item in the cart.&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-10-23T23:10:28.520" Title="Demo repo for an Adjuster module for Commerce 2?" Tags="&lt;plugin-craftcommerce2&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28186" PostTypeId="1" CreationDate="2018-10-23T17:40:15.407" Score="2" ViewCount="250" Body="&lt;p&gt;Here is my query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resources = craft.entries({&#xA;    section: 'resources',&#xA;    type: 'not caseStudyLanding'&#xA;    relatedTo: filterParams,&#xA;    orderBy: 'postDate desc'&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to exclude two entry types (caseStudyLanding and webinarsLanding) but I have been struggling with the syntax. &lt;/p&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="57" LastEditDate="2018-10-27T21:18:48.853" LastActivityDate="2018-10-27T21:18:48.853" Title="exclude array of entry types in query" Tags="&lt;entry-type&gt;&lt;query&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28187" PostTypeId="2" ParentId="28186" CreationDate="2018-10-23T17:54:19.330" Score="2" Body="&lt;p&gt;I found it here: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        type: ['not', 'webinarsLanding', 'caseStudyLanding'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8185" LastActivityDate="2018-10-23T17:54:19.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28188" PostTypeId="1" AcceptedAnswerId="28200" CreationDate="2018-10-23T18:46:14.700" Score="1" ViewCount="143" Body="&lt;p&gt;I'm not sure if the issue is with Craft 3, the Preparse plugin, or me, so I'm posting here first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a front-end form that includes an Assets field used to upload images. The entry type contains Preparse fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Preparse plugin is enabled and I submit the front-end form with an image, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Image Exception – craft\errors\ImageException&#xA;The file &quot;assets5bcf19ef8f6bc6.04658934.jpg&quot; does not appear to be an image.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Screenshot with more details: &lt;a href=&quot;https://cl.ly/edfbc0c07bde&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cl.ly/edfbc0c07bde&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry still gets created and the .jpg file is uploaded as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any issues when creating entries via the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I disable the Preparse plugin and submit the front-end form, the error does not appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I upload a .pdf file instead of a .jpg while the Preparse plugin is enabled, I don't get an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, it appears to be an issue with the Preparse plugin and image files in Craft 3 front-end forms (tested both .jpg &amp;amp; .png).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this?&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-10-24T19:36:40.877" Title="How can I fix Image Exception error when uploading image via front-end form while Preparse plugin enabled?" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;image&gt;&lt;frontend-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28190" PostTypeId="2" ParentId="28184" CreationDate="2018-10-23T23:10:28.520" Score="3" Body="&lt;p&gt;I've created a stub/reference Adjuster module, &lt;a href=&quot;https://github.com/oof-bar/commerce-example-adjuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This demonstrates how to register two Adjusters via a custom module—one that creates a 5% discount on each line item, and one that creates a 10% discount on the entire order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These adjusters have their logic hard-coded, which is to say: in order to modify the behavior/value of the adjustments, you have to change PHP files. Part of the benefit of Craft's built-in adjusters (Taxes, Discounts) is that they base their calculations on input from the merchant/admin, in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can replace the two calls to &lt;code&gt;$adjustment-&amp;gt;amount = $myAmount;&lt;/code&gt; with anything you like—including Craft API calls that fetch values off of Elements, get plugin or environment settings, inspect &lt;code&gt;LineItem&lt;/code&gt; options, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where Adjusters become immensely powerful. As long as you can provide a positive or negative value, a label, and a description for your &lt;code&gt;Adjustment&lt;/code&gt;, it doesn't matter how you derive it. ✌️&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This module is not meant to be installed as a plugin, or used as a submodule—it's probably best to just lift the code out and replace the generic classes and namespaces.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A bit of context: James and I spoke in Slack earlier today, which prompted the creation of this repo. The code has been adapted from private projects, but is now available under the MIT license.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-10-23T23:10:28.520" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28191" PostTypeId="1" AcceptedAnswerId="28229" CreationDate="2018-10-24T01:02:00.623" Score="1" ViewCount="552" Body="&lt;p&gt;I know that Craft3 now requires Redactor or CKEditor plugins to handle rich text editing, however after installing the Redactor plugin through the store, I am getting this error in the 'Body'.&#xA;The title and everything else works, just the body gets the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to find component class 'RedactorI'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QvHVh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QvHVh.png&quot; alt=&quot;error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple.json&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;{&#xA;  &quot;buttons&quot;: [&quot;bold&quot;, &quot;italic&quot;]&#xA;}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&#xA;Standard.json&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;{&#xA;  &quot;formatting&quot;: [&quot;h2&quot;,&quot;h3&quot;,&quot;h4&quot;,&quot;h5&quot;,&quot;p&quot;, &quot;blockquote&quot;],&#xA;  &quot;buttons&quot;: [&quot;html&quot;,&quot;formatting&quot;,&quot;alignment&quot;,&quot;bold&quot;,&quot;italic&quot;,&quot;unorderedlist&quot;,&quot;orderedlist&quot;,&quot;link&quot;,&quot;file&quot;,&quot;image&quot;,&quot;video&quot;,&quot;table&quot;],&#xA;  &quot;plugins&quot;: [&quot;fullscreen&quot;,&quot;video&quot;,&quot;table&quot;],&#xA;  &quot;toolbarFixed&quot;: true&#xA;}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've checked my craft/config/redactor simple and standard JSON files and they're properly formatted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8945" LastActivityDate="2018-10-28T00:03:38.460" Title="Craft 3 Upgrade having issues with rich text editor" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;richtext&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28192" PostTypeId="1" CreationDate="2018-10-24T05:21:34.657" Score="1" ViewCount="651" Body="&lt;p&gt;The &lt;a href=&quot;https://craftcommerce.com/docs/purchasables&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs for v1&lt;/a&gt; mention a method &lt;code&gt;craft()-&amp;gt;commerce_purchasables-&amp;gt;saveElement()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is omitted in the &lt;a href=&quot;https://github.com/craftcms/commerce-docs&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs for v2&lt;/a&gt;. Does anyone know how I can create a product programmatically in PHP?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $product = new Product();&#xA;        $product-&amp;gt;title = &quot;Test Product 1&quot;;&#xA;        $product-&amp;gt;typeId = 2;&#xA;        $product-&amp;gt;enabled = true;&#xA;        $product-&amp;gt;promotable = true;&#xA;&#xA;    $variant = new Variant();&#xA;            $variant-&amp;gt;isDefault = true;&#xA;&#xA;    $product-&amp;gt;setVariants([$variant]);&#xA;&#xA;    Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above code I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Call to a member function getProductTypes() on null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know the typeId is correct, because I can output it on a product template with &lt;code&gt;{{ product.typeId }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8876" LastEditorUserId="8876" LastEditDate="2018-10-29T08:19:45.507" LastActivityDate="2019-03-06T14:56:54.970" Title="Programmatically create a product using Craft Commerce 2?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28193" PostTypeId="2" ParentId="28192" CreationDate="2018-10-24T05:37:48.513" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Populate a product model (&lt;code&gt;$product&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Populate an array of variant models (&lt;code&gt;$variants&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;$product-&amp;gt;setVariants($variants);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($product);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If step 4 returns false, validation errors occurred on the variants or product, and the errors be on the &lt;code&gt;$product&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-10-24T05:37:48.513" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28194" PostTypeId="2" ParentId="28173" CreationDate="2018-10-24T06:15:26.790" Score="2" Body="&lt;p&gt;Twig has an &lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#string-interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;interpolation syntax&lt;/a&gt; (using &lt;code&gt;#{}&lt;/code&gt; inside a double-quoted string) to accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = block.locationVacancies %}&#xA;{% set entries = craft&#xA;    .entries&#xA;    .section('careers')&#xA;    .search(&quot;locationVacancies:#{location}&quot;)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In addition, you can be more explicit about the values you’re searching for (and avoid any kind of sneaky &lt;code&gt;search&lt;/code&gt; capabilities/side-effects exposed by using raw query input):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = block.locationVacancies %}&#xA;{% set entries = craft&#xA;    .entries&#xA;    .section('careers')&#xA;    .locationVacancies(&quot;*#{location}*&quot;)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…or even using Twig object syntax…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set location = block.locationVacancies %}&#xA;{% set entries = craft.entries({&#xA;    section: 'careers',&#xA;    locationVacancies: &quot;*#{location}*&quot;&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;code&gt;locationVacancies: location&lt;/code&gt; will also work, but disables partial matching)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It should be noted: if you're looking to associate multiple explicit entries, you can also make the field within your (presumed) Matrix Block an &lt;code&gt;Entries&lt;/code&gt; field, which establishes actual relationships in the database—accessing such a field (&lt;code&gt;myBlock.myLocationEntriesField.all()&lt;/code&gt;) will return that list of Entries, exactly as set in the admin) If you just need a dynamic search param, what you have is a fine solution!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-10-30T16:44:29.383" LastActivityDate="2018-10-30T16:44:29.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28195" PostTypeId="2" ParentId="28180" CreationDate="2018-10-24T07:30:32.847" Score="4" Body="&lt;p&gt;Solved. The config/db.php cloned from Hyperlane refers to different env variable names than those used within my .env file. Changing the names in config/db.php solved the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'driver' =&amp;gt; getenv('DB_DRIVER'),&#xA;    'server' =&amp;gt; getenv('DB_HOST'),&#xA;    'user' =&amp;gt; getenv('DB_USER'),&#xA;    'password' =&amp;gt; getenv('DB_PASSWORD'),&#xA;    'database' =&amp;gt; getenv('DB_NAME'),&#xA;    'schema' =&amp;gt; getenv('DB_SCHEMA'),&#xA;    'tablePrefix' =&amp;gt; getenv('DB_TABLE_PREFIX'),&#xA;    'port' =&amp;gt; getenv('DB_PORT')&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'driver' =&amp;gt; getenv('DB_DRIVER'),&#xA;    'server' =&amp;gt; getenv('DB_SERVER'), // changed&#xA;    'user' =&amp;gt; getenv('DB_USER'),&#xA;    'password' =&amp;gt; getenv('DB_PASSWORD'),&#xA;    'database' =&amp;gt; getenv('DB_DATABASE'), // changed&#xA;    'schema' =&amp;gt; getenv('DB_SCHEMA'),&#xA;    'tablePrefix' =&amp;gt; getenv('DB_TABLE_PREFIX'),&#xA;    'port' =&amp;gt; getenv('DB_PORT')&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastEditorUserId="167" LastEditDate="2018-10-24T07:36:46.417" LastActivityDate="2018-10-24T07:36:46.417" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28196" PostTypeId="1" CreationDate="2018-10-24T09:42:24.017" Score="1" ViewCount="1128" Body="&lt;p&gt;I deployed a Craft 3 site and the site is fine, however when I try and go to /admin to login I get a Craft &quot;Internal Server Error - Server Error&quot; message and can't access the dashboard.&#xA;Any ideas where to look?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="8931" LastActivityDate="2018-10-24T10:44:46.107" Title="Internal Server Error for admin login and dashboard" Tags="&lt;craft3&gt;&lt;admin&gt;&lt;server&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28197" PostTypeId="2" ParentId="28196" CreationDate="2018-10-24T10:44:46.107" Score="2" Body="&lt;p&gt;To get some ideas we'll need more information. I suggest&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to storage/logs folder&lt;/li&gt;&#xA;&lt;li&gt;Hit from that directory &lt;code&gt;tail -f *&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then go to your chrome and try to access your : admin page&lt;/li&gt;&#xA;&lt;li&gt;Go back to your tail -f you will see some error &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Tell us more about the error your find.&lt;/p&gt;&#xA;" OwnerUserId="8894" LastActivityDate="2018-10-24T10:44:46.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28198" PostTypeId="2" ParentId="28159" CreationDate="2018-10-24T13:18:32.673" Score="1" Body="&lt;p&gt;The code below is working for me so far. The answer at &lt;a href=&quot;https://craftcms.stackexchange.com/a/28168/298&quot;&gt;https://craftcms.stackexchange.com/a/28168/298&lt;/a&gt; helped me figure things out for Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Entry::class,&#xA;    Entry::EVENT_AFTER_SAVE,&#xA;    function(ModelEvent $event) {&#xA;        /** @var Entry $entry */&#xA;        $entry = $event-&amp;gt;sender;&#xA;        //Set entry's author ID&#xA;        $authorId = $entry-&amp;gt;authorId;&#xA;        //Set value of custom field&#xA;        $imageOrder = $entry-&amp;gt;myCustomField;&#xA;&#xA;        if ($entry-&amp;gt;enabled &amp;amp;&amp;amp; $entry-&amp;gt;section-&amp;gt;handle === 'mySectionHandle' &amp;amp;&amp;amp; $entry-&amp;gt;type-&amp;gt;handle === 'myEntryTypeHandle') {&#xA;            /** @var Asset $asset */&#xA;            foreach ($entry-&amp;gt;myAssetField as $asset) {&#xA;                $newFileName = &quot;0&quot; . $imageOrder . &quot;-&quot; . $authorId . &quot;-&quot; . date('YmdHis') . &quot;.&quot; . $asset-&amp;gt;getExtension();&#xA;                Craft::$app-&amp;gt;assets-&amp;gt;moveAsset($asset, $asset-&amp;gt;getFolder(), $newFileName);&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can it be improved? For e.g., can I do without the foreach loop? Let me know and I'll update this answer and then mark it as accepted.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-10-24T13:18:32.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28199" PostTypeId="1" AcceptedAnswerId="28201" CreationDate="2018-10-24T19:34:15.947" Score="1" ViewCount="36" Body="&lt;p&gt;Trying to get my head around plugin development. Sorry if this is a super basic question. How do you add a method to an existing element? I’m trying to get any active Commerce 2 subscriptions for a user. I figured out how to add it as a variable to my plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getActiveSubscriptions(int $userId): array&#xA;{&#xA;    return Subscription::find()&#xA;        -&amp;gt;userId($userId)&#xA;        -&amp;gt;status(Subscription::STATUS_ACTIVE)&#xA;        -&amp;gt;all();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It’s called by &lt;code&gt;{% set subscriptions = craft.myPlugin.getActiveSubscriptions(currentUser.id) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That works, but I feel like the “right” way is to be able to do this &lt;code&gt;{% set subscriptions = currentUser.getActiveSubscriptions() %}&lt;/code&gt; How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-10-25T06:15:22.310" Title="Add a method to an existing element" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28200" PostTypeId="2" ParentId="28188" CreationDate="2018-10-24T19:36:40.877" Score="1" Body="&lt;p&gt;Fixed in Preparse Plugin v 1.0.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;View changelog at: &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft/blob/craft3/CHANGELOG.md#103---2018-10-24&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Preparse-Field-Craft/blob/craft3/CHANGELOG.md#103---2018-10-24&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-10-24T19:36:40.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28201" PostTypeId="2" ParentId="28199" CreationDate="2018-10-25T06:15:22.310" Score="2" Body="&lt;p&gt;You can do that with &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-behaviors&quot; rel=&quot;nofollow noreferrer&quot;&gt;Behaviors&lt;/a&gt;. There is a good Working example made by Pixel and Tonic team within their Git for the &lt;a href=&quot;https://github.com/craftcms/ontherocks/blob/step-12/src/behaviors/UserBehavior.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DotAll workshop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;namespace ontherocks\behaviors;&#xA;&#xA;use craft\elements\db\EntryQuery;&#xA;use craft\elements\Entry;&#xA;use craft\elements\User;&#xA;use yii\base\Behavior;&#xA;&#xA;/**&#xA; * Class UserBehavior&#xA; *&#xA; * @property User $owner&#xA; * @property EntryQuery $recipes&#xA; */&#xA;class UserBehavior extends Behavior&#xA;{&#xA;    public function getRecipes(): EntryQuery&#xA;    {&#xA;        if (!$this-&amp;gt;owner-&amp;gt;id) {&#xA;            // just return a query that is doomed to fail&#xA;            return Entry::find()&#xA;                -&amp;gt;id(false);&#xA;        }&#xA;        return Entry::find()&#xA;            -&amp;gt;section('recipes')&#xA;            -&amp;gt;authorId($this-&amp;gt;owner-&amp;gt;id);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See how to attach behaviors&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// define user behavior&#xA;Event::on(User::class, Element::EVENT_DEFINE_BEHAVIORS, function(DefineBehaviorsEvent $event) {&#xA;    $event-&amp;gt;behaviors[$this-&amp;gt;id] = UserBehavior::class;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can attach your custom behavior to the user class as well exactly like the code above and do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set user = currentUser %}&#xA;{% set subscriptions = user.getActiveSubscriptions() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you attach the behavior to the &lt;code&gt;SubscriptionQuery&lt;/code&gt; and do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set subscriptions = craft.subcriptions.activeSubscriptions(currentUser).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-25T06:15:22.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28202" PostTypeId="1" AcceptedAnswerId="28301" CreationDate="2018-10-25T14:11:59.657" Score="2" ViewCount="217" Body="&lt;p&gt;I have a question about the {% cache %} tag with Craft 3. I am reading this article (&lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&lt;/a&gt;), and trying out implementing the tags; however, when I check the amount of db queries before and after adding the tags, the amount of queries goes up instead of down as suggested in the article. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would cause this to happen? This is the code I’m currently testing the cache tag on, there are 5000+ entires in the 'articles' section. Without the cache tag there are 19 database queries, with it there are 32 queries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% cache %}&#xA;    {% for entry in craft.entries.section('articles').all() %}&#xA;      {{ entry.title }}&amp;lt;br&amp;gt;&#xA;    {% endfor %}&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7902" LastEditorUserId="57" LastEditDate="2018-10-27T21:28:00.677" LastActivityDate="2018-11-02T22:10:05.297" Title="Craft 3 - Cache tag increasing number of database queries" Tags="&lt;craft3&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28203" PostTypeId="1" AcceptedAnswerId="28204" CreationDate="2018-10-25T15:38:17.520" Score="1" ViewCount="135" Body="&lt;pre&gt;&lt;code&gt;Event::on(\craft\services\Elements::class, \craft\services\Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) {&#xA;    if ($event-&amp;gt;element instanceof \craft\elements\User) {&#xA;        $user = Craft::$app-&amp;gt;getUsers()-&amp;gt;getUserById($event-&amp;gt;element-&amp;gt;id);&#xA;        if ($user-&amp;gt;isInGroup('abc')) {&#xA;            // Do something&#xA;        } else {&#xA;            // Do something different&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I created a C3 module on pluginfactory.io. The code above works just fine in detecting when a user is saved/updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sake of simplicity I have two user groups 1) &lt;code&gt;abc&lt;/code&gt; 2) &lt;code&gt;def&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I uncheck the user from &lt;code&gt;def&lt;/code&gt; and check him into &lt;code&gt;abc&lt;/code&gt; (or the other way around), and save the user, my code won't register that the user group has changed, but thinks the user is still in the previously selected group. If I re-save the user (without changing groups), suddenly the code sees the correct group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that despite using &lt;code&gt;EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt;, the system still saves the user group change to the db after the &lt;code&gt;Event&lt;/code&gt; triggers. Could that be it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's weird though, because any other field I pull from the user, e.g. if I change their email, my code is able to pick up the new email on the first save, so why not the change in user group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance is greatly appreciated,&#xA;cheers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Made problem clearer to understand.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="57" LastEditDate="2018-10-27T21:31:18.147" LastActivityDate="2018-10-27T21:31:18.147" Title="Module: EVENT_AFTER_SAVE_ELEMENT won't detect changed user group" Tags="&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28204" PostTypeId="2" ParentId="28203" CreationDate="2018-10-25T17:06:30.247" Score="2" Body="&lt;p&gt;That's because groups are not attached to the user directly. At the moment Craft stores the user it hasn't handled the permissions not the user groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The workflow is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Handling all kinds of variables and data&lt;/li&gt;&#xA;&lt;li&gt;Fetch/Create a user&lt;/li&gt;&#xA;&lt;li&gt;Populate the new field values for the user&lt;/li&gt;&#xA;&lt;li&gt;Store the user&lt;/li&gt;&#xA;&lt;li&gt;Handle verifications such as sending them an email&lt;/li&gt;&#xA;&lt;li&gt;Assign the user to groups and grant them permissions&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;At the moment your event triggers the user wasn't assigned to the groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change users depending on their groups you should use the  &lt;code&gt;Users::EVENT_AFTER_ASSIGN_USER_TO_GROUPS&lt;/code&gt; event &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-25T17:06:30.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28205" PostTypeId="2" ParentId="24104" CreationDate="2018-10-25T19:19:26.673" Score="2" Body="&lt;p&gt;In Craft's v3 API documentation they give an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-elements.html#method-saveelement&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-services-elements.html#method-saveelement&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry = new Entry();&#xA;$entry-&amp;gt;sectionId = 10;&#xA;$entry-&amp;gt;typeId = 1;&#xA;$entry-&amp;gt;authorId = 5;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;title = &quot;Hello World!&quot;;&#xA;$entry-&amp;gt;setFieldValues([&#xA;    'body' =&amp;gt; &quot;&amp;lt;p&amp;gt;I can’t believe I literally just called this “Hello World!”.&amp;lt;/p&amp;gt;&quot;,&#xA;]);&#xA;$success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;if (!$success) {&#xA;    Craft::error('Couldn’t save the entry &quot;'.$entry-&amp;gt;title.'&quot;', __METHOD__);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8594" LastActivityDate="2018-10-25T19:19:26.673" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28206" PostTypeId="1" CreationDate="2018-10-25T19:46:57.097" Score="1" ViewCount="200" Body="&lt;p&gt;I am trying to use the new multisort filter to sort an array in reverse order using a date key, but can't seem to figure out the correct syntax. Here is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rides in allRides|multisort(eventDate,SORT_DESC,SORT_REGULAR) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This throws an error saying &quot;Variable eventDate does not exist&quot;. eventDate is definitely a key in the array 'allRides'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this, it works fine, but gets sorted by eventDate ascending:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rides in allRides|sort %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some guidance on using the multisort filter would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2018-10-27T21:38:27.857" LastActivityDate="2019-07-17T13:10:35.287" Title="Syntax for Multisort Filter" Tags="&lt;filter&gt;&lt;array&gt;&lt;sort&gt;&lt;multisort&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28207" PostTypeId="1" CreationDate="2018-10-25T20:17:42.327" Score="1" ViewCount="128" Body="&lt;p&gt;I have a custom registration form in my Craft site based on this info.&#xA;&lt;a href=&quot;https://docs.craftcms.com/v2/templating/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/templating/user-registration-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I want to show error message when the password doesn't meet the requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I made a password requirement like here, and defined a few error messages.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/12165/how-do-i-enforce-stronger-password-requirements-on-my-craft-site&quot;&gt;How do I enforce stronger password requirements on my Craft site?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, no error message appears even if the password is not fine.&#xA;Just the form redirects to the same form page, without any message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, could you tell me how to set the error message?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please not that it works fine in the login form to dashboard, like here;&#xA;{SiteURL}/admin/&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My Craft version is 2.7&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2018-10-25T20:17:42.327" Title="Error message regarding password in user registration form" Tags="&lt;form&gt;&lt;error-message&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28208" PostTypeId="1" AcceptedAnswerId="28212" CreationDate="2018-10-25T21:41:19.523" Score="1" ViewCount="150" Body="&lt;p&gt;I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page.&#xA;I need to be able to test whether any of the fields have the light switch enabled, and also loop through all of those entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Orignally, both light switch fields were named 'anchor', but that seemed to cause problems, so now they have two different labels. I'm having trouble combining them into a single object though, or even working with them separately in the same template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set anchors = entry.pageBuilder.type('subhead').anchor('= 1') %}&#xA;{% set anchorLinks = entry.pageBuilder.type('copy').anchorLink('= 1') %}&#xA;&#xA;Anchors: {{ anchors|length }}&#xA;AnchorLinks: {{ anchorLinks|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I use the code above as-is, the value of one of the objects is always 0. But if I use either of those lines indivdually, they return the proper value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried merging the two objects, but I still run into the same issue of the value of one of the objects being incorrectly set to 0.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set anchors2 = entry.pageBuilder.type('copy').anchorLink('1').find() %}&#xA;{% set anchors1 = entry.pageBuilder.type('subhead').anchor('1').find() %}&#xA;&#xA;{% set allAnchors = anchors1|merge(anchors2) %}&#xA;&#xA;one {{ anchors1|length }}&#xA;two {{ anchors2|length }}&#xA;all {{ allAnchors|length }}&#xA;&#xA;{% for anchor in allAnchors %}&#xA;    {{ anchor.subhead }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this a bug, or am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2018-10-25T23:04:18.737" Title="filter matrix blocks by multiple light switch value, and then merge them" Tags="&lt;matrix&gt;&lt;lightswitch&gt;&lt;merge&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28209" PostTypeId="1" AcceptedAnswerId="28210" CreationDate="2018-10-25T22:11:01.203" Score="1" ViewCount="61" Body="&lt;p&gt;I have a &lt;code&gt;videoPost&lt;/code&gt; block in a Matrix field. Each &lt;code&gt;videoPost&lt;/code&gt; has a &lt;code&gt;imageField&lt;/code&gt;. I am trying to display the block’s image if &lt;code&gt;imageField&lt;/code&gt; is defined. This is returning images for each block that has &lt;code&gt;imageField&lt;/code&gt; defined when I only want to return the specific block’s image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.matrixField.type('videoPost') %}&#xA;    {% if block.imageField | length %}&#xA;        {% for asset in block.imageField %}&#xA;            &amp;lt;img src=&quot;{{asset.getUrl}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;        {% endfor %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4162" LastActivityDate="2018-10-25T22:26:38.743" Title="Display a Matrix field block entry when the block's entry exists" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28210" PostTypeId="2" ParentId="28209" CreationDate="2018-10-25T22:26:38.743" Score="1" Body="&lt;p&gt;Try replacing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for asset in block.imageField %}&#xA;    &amp;lt;img src=&quot;{{asset.getUrl}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set asset = block.imageField.first() %}&#xA;&amp;lt;img src=&quot;{{asset.getUrl}}&quot; alt=&quot;{{ asset.title }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're using Craft 3, replace .first() with .one()&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2018-10-25T22:26:38.743" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28211" PostTypeId="1" AcceptedAnswerId="28215" CreationDate="2018-10-25T22:39:41.603" Score="2" ViewCount="990" Body="&lt;p&gt;I've used redactor's custom formatting option before, but now I can't get anything to work. Here's what my file currently looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;buttons&quot;: [&#xA;        &quot;formatting&quot;,&#xA;        &quot;bold&quot;,&#xA;        &quot;italic&quot;,&#xA;        &quot;lists&quot;,&#xA;        &quot;link&quot;&#xA;    ],&#xA;    &quot;formatting&quot;: [&quot;p&quot;,&quot;blockquote&quot;],&#xA;    &quot;formattingAdd&quot;: {&#xA;        &quot;h2&quot;: {&#xA;            &quot;title&quot;: &quot;Heading&quot;,&#xA;            &quot;args&quot;: [&quot;h2&quot;]&#xA;        },&#xA;        &quot;h4&quot;: {&#xA;            &quot;title&quot;: &quot;Subheading&quot;,&#xA;            &quot;args&quot;: [&quot;h4&quot;]&#xA;        },&#xA;        &quot;caption&quot;: {&#xA;            &quot;title&quot;: &quot;Caption&quot;,&#xA;            &quot;args&quot;: [&quot;p&quot;, &quot;class&quot;, &quot;caption&quot;]        &#xA;        }&#xA;    },&#xA;    &quot;buttonsAdd&quot;: [&quot;sup&quot;, &quot;sub&quot;],&#xA;    &quot;linkNewTab&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the &quot;h2&quot; and &quot;h4&quot; under &quot;formattingAdd&quot; because I wanted them to use custom titles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, none of my custom formats are working. The &quot;p&quot; and &quot;blockquote&quot; from &quot;formatting&quot; are working properly, but the other three styles don't do anything. They appear in the list, but don't restyle the text in the editor, or create the elements in the output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something in the syntax I'm missing? I'm in Craft 3, with the redactor plugin updated to the latest version.&lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2020-01-06T15:28:36.840" Title="Redactor formattingAdd not working" Tags="&lt;craft3&gt;&lt;redactor&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28212" PostTypeId="2" ParentId="28208" CreationDate="2018-10-25T23:04:18.737" Score="2" Body="&lt;p&gt;Keep in mind objects in PHP are always called by reference not by value thus your &lt;code&gt;anchors&lt;/code&gt; query will always return blocks from the type &lt;code&gt;subhead&lt;/code&gt; with the field value &lt;code&gt;anchor =1&lt;/code&gt; while your matrix query &lt;code&gt;anchorLinks&lt;/code&gt; will return blocks of type &lt;code&gt;copy&lt;/code&gt; with the field value &lt;code&gt;anchor = 1&lt;/code&gt; and &lt;code&gt;anchorLink = 1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why you don't fetch the results in one single query as it would be faster and easier in my opinion but you want to create 2 queries you need to either reset the previously set property to &lt;code&gt;null&lt;/code&gt; or use the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#cloning-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;clone&lt;/a&gt;  function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set anchors2 = clone(entry.pageBuilder).type('copy').anchorLink('1').all() %}&#xA;{% set anchors1 = clone(entry.pageBuilder).type('subhead').anchor('1').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-25T23:04:18.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28213" PostTypeId="1" CreationDate="2018-10-26T00:34:04.163" Score="4" ViewCount="769" Body="&lt;p&gt;I've got a Craft CMS installation that is set to production mode. I notice that my logs get flooded with a bunch of entries which don't seem very useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in a matter of several days, I've already got &lt;code&gt;console.log&lt;/code&gt; up to &lt;code&gt;console.log.5&lt;/code&gt; - So it's rotated the log file 5 times already. These files are filled with what seems like every single query that gets executed on the website. They're 70k lines a piece. It also logs a lot of entries in &lt;code&gt;queue.log&lt;/code&gt;, among other files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I stop logging information and only log things which require my attention, such as errors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8397" LastActivityDate="2021-04-27T11:25:43.030" Title="Is it possible to stop Craft from logging so much?" Tags="&lt;craft3&gt;&lt;config&gt;&lt;logs&gt;&lt;logging&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28214" PostTypeId="1" CreationDate="2018-10-26T10:30:40.267" Score="1" ViewCount="47" Body="&lt;p&gt;I'm using the Dukt Videos plugin v1.2.5 on Craft v2.7.2. Is there a way to control or remove the video suggestions that are displayed once my video has played through to the end. Or perhaps have the video restart once it reaches the end ? &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2018-10-26T14:26:28.307" Title="Remove related / suggested videos from the end of an embedded YouTube video" Tags="&lt;plugin-duktvideos&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28215" PostTypeId="2" ParentId="28211" CreationDate="2018-10-26T11:16:33.027" Score="3" Body="&lt;p&gt;That syntax looks to be for Redactor 2. The latest versions of the redactor plugin (starting from 2.0) use Redactor 3. The syntax has &lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#s-formattingadd&quot; rel=&quot;nofollow noreferrer&quot;&gt;changed slightly&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-10-26T11:16:33.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28216" PostTypeId="1" AcceptedAnswerId="28224" CreationDate="2018-10-26T13:24:19.160" Score="2" ViewCount="584" Body="&lt;p&gt;I have the following code in my site module:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    User::class,&#xA;    User::EVENT_BEFORE_SAVE,&#xA;    function (ModelEvent $event) {&#xA;        /** @var User $user */&#xA;        $user = $event-&amp;gt;sender;&#xA;        if ($event-&amp;gt;isNew === true) {&#xA;            $user-&amp;gt;pending = true;&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It was working as expected until I updated from Craft 3.0.25 to 3.0.27.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this issue is related to a change in the &lt;code&gt;src/controllers/UsersController.php&lt;/code&gt; file as per GitHub &lt;a href=&quot;https://github.com/craftcms/cms/commit/db089251994329d0fbe082c0d3ff234a01d82c98&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/db089251994329d0fbe082c0d3ff234a01d82c98&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I replaced my 3.0.27.1 &lt;code&gt;UsersController.php&lt;/code&gt; with one from a 3.0.25 install, and my code works again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best/correct/official way to set new user accounts to pending status in a module that won't break with future Craft updates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_BEFORE_ACTIVATE_USER,&#xA;    function (UserEvent $event) {&#xA;        $event-&amp;gt;isValid = false;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but got &lt;code&gt;There was a problem activating the user.&lt;/code&gt; when trying to activate the user account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: &lt;code&gt;Verify email addresses?&lt;/code&gt; is disabled in &lt;code&gt;User Settings&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-10-26T13:36:07.470" LastActivityDate="2018-10-26T23:18:31.247" Title="How can I set new user accounts to pending status in a Craft 3 module?" Tags="&lt;craft3&gt;&lt;users&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28217" PostTypeId="2" ParentId="28214" CreationDate="2018-10-26T14:26:28.307" Score="1" Body="&lt;p&gt;This answer isn't specific to the Dukt plugin, but I was going to suggest that passing in the parameter of &lt;code&gt;rel&lt;/code&gt; with a value of&lt;code&gt;0&lt;/code&gt; would be the solution. Looking at the docs for YouTube embed shows this is no longer good as of Sept 25, 2018 though:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://developers.google.com/youtube/player_parameters#rel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developers.google.com/youtube/player_parameters#rel&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you used to be able to shut off related videos, but YouTube has removed that ability. You're stuck with them if you choose to use YouTube as your video provider.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After the change [&lt;em&gt;made on Sept 25, 2018&lt;/em&gt;], you will not be able to disable related videos. Instead, if the rel parameter is set to 0, related videos will come from the same channel as the video that was just played.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="349" LastActivityDate="2018-10-26T14:26:28.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28218" PostTypeId="2" ParentId="26403" CreationDate="2018-10-26T16:20:24.903" Score="11" Body="&lt;p&gt;While we’re piggybacking, here’s a snippet that goes one step further and generates the necessary CSS to position an untransformed image:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;{% set img = entry.headingImage.one %}&#xA;&#xA;{% if img %}&#xA;    {% set imgStyles = &quot;background-image: url('&quot; ~ img.getUrl() ~ &quot;');&quot;|raw %}&#xA;&#xA;    {% if img.hasFocalPoint %}&#xA;        {% set x = img.focalPoint | first * 100 ~ '%' %}&#xA;        {% set y = img.focalPoint | last * 100 ~ '%' %}&#xA;        {% set imgStyles = imgStyles ~ ' background-position: ' ~ [x, y]|join(' ') %}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;div class=&quot;block-header&quot; style=&quot;{{ imgStyles is defined ? imgStyles }}&quot;&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Mmm, backgrounds&amp;lt;/h1&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3327" LastEditorUserId="3327" LastEditDate="2019-02-12T15:43:53.117" LastActivityDate="2019-02-12T15:43:53.117" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28219" PostTypeId="1" CreationDate="2018-10-26T20:43:30.140" Score="1" ViewCount="50" Body="&lt;p&gt;Craft looks VERY promising to me! Still try to figure out if it could be perfect for our new project, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our website will be in English and German (accessible under ONE domain - see below). I understand that there is a plugin with which I can switch the language while staying on the very same page - PERFEKT!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my questions. Can those requirements be fulfilled by Craft?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;We want the English content to be placed in the folder &quot;website.com/en&quot; and the German in &quot;website.com/de&quot;. We would manually put an index.php with a redirect to our default language (not decided yet) in the root folder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we completely build up the site in one language first - and then kinda &quot;import/duplicate&quot; it to the second language and translate it? language-switch links should still work afterwards. Means: Craft should know which articles of each language belong together.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no 'tab' above an WYSIWYG field under the very same article where I can switch between languages and fill in the corresponding content on the very same admin-page, right?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'll open another question for my questions concerning my other topics...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help and greetings!&lt;/p&gt;&#xA;" OwnerUserId="8957" LastEditorUserId="57" LastEditDate="2018-10-28T01:34:55.907" LastActivityDate="2018-10-28T01:34:55.907" Title="multi language - each in its own folder?" Tags="&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28220" PostTypeId="2" ParentId="28219" CreationDate="2018-10-26T20:56:12.543" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;there is no 'tab' above an wysiwyg field under the very same article where i can switch between languages and fill in the corresponding content on the very same admin-page, right?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actually, there is (sort of). It's not a tab per se, but you can switch between the different versions of &lt;em&gt;each entry&lt;/em&gt; as you are editing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gEUBf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gEUBf.png&quot; alt=&quot;languages&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you would add all of your entries in English first, then circle back and adjust the content for each entry in German.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as you mentioned, there is a &lt;a href=&quot;https://github.com/doublesecretagency/craft-siteswitcher&quot; rel=&quot;nofollow noreferrer&quot;&gt;Site Switcher&lt;/a&gt; plugin (disclaimer, I am the author) to let you easily switch between languages while staying on the same page.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-10-26T20:56:12.543" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="28221" PostTypeId="1" CreationDate="2018-10-26T21:24:52.253" Score="1" ViewCount="64" Body="&lt;p&gt;Craft looks VERY promising to me! Still try to figure out if it could be perfect for our new project, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can those requirements be fulfilled by craft?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there an image gallery module where i can define captions? means small (copyright)text under the thumbnails and also under the enlarged images (say, in a modal)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I define a folder full of images and tell Craft to use this as the source for my gallery, so it automatically generates the gallery for me? An image description (or alt text etc.) should automatically be used and displayed as captions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'll open another question for my questions concerning my other topics...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for your help and greetings!&lt;/p&gt;&#xA;" OwnerUserId="8957" LastEditorUserId="57" LastEditDate="2018-10-28T02:02:56.520" LastActivityDate="2018-10-28T02:02:56.520" Title="image galleries - auto generated?" Tags="&lt;gallery&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28223" PostTypeId="2" ParentId="11703" CreationDate="2018-10-26T22:13:56.050" Score="10" Body="&lt;p&gt;In Craft 3 you can do this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;use craft\helpers\UrlHelper;&#xA;UrlHelper::siteUrl();&#xA;&#xA;Craft::$app-&amp;gt;sites-&amp;gt;currentSite-&amp;gt;name;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2020-12-07T06:13:03.867" LastActivityDate="2020-12-07T06:13:03.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28224" PostTypeId="2" ParentId="28216" CreationDate="2018-10-26T23:18:31.247" Score="3" Body="&lt;p&gt;Yeah you’re correct that &lt;a href=&quot;https://github.com/craftcms/cms/commit/db089251994329d0fbe082c0d3ff234a01d82c98&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;db089251&lt;/code&gt;&lt;/a&gt; is the culprit here, which fixed a bug where user activation events weren’t getting fired when users were first created, if the “Verify email addresses?” setting was disabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your new code is close, but that is going to get called each time Craft tries to activate a user—both when they are first created, and when you try to manually activate a user later on. So you just need to add a condition to your event handler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a starting point, maybe just check if it’s a site (front-end) request.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_BEFORE_ACTIVATE_USER,&#xA;    function (UserEvent $event) {&#xA;        if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;            $event-&amp;gt;isValid = false;&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-10-26T23:18:31.247" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28225" PostTypeId="1" AcceptedAnswerId="28226" CreationDate="2018-10-27T05:12:02.233" Score="1" ViewCount="249" Body="&lt;p&gt;How do I access a subscription plan's planData? Maybe as an object? I'm using Commerce 2 with the Stripe gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plans = craft.commerce.getPlans().getAllPlans() %}&#xA;{% for plan in plans %}&#xA;    {{ dump(plan.planData) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;planData&lt;/code&gt; looks like JSON stored as a string. How do I access its data (&lt;code&gt;amount&lt;/code&gt;, &lt;code&gt;trial_period_days&lt;/code&gt; etc.) on the front end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this need to be handled by a custom plugin? Seems like something that should be available out of the box. Hopefully I just over looked it.&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-10-27T07:57:24.270" LastActivityDate="2018-10-27T22:33:07.420" Title="Get Commerce 2's Stripe subscription planData as object" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28226" PostTypeId="2" ParentId="28225" CreationDate="2018-10-27T13:14:06.240" Score="3" Body="&lt;p&gt;A subscription's &lt;code&gt;planData&lt;/code&gt; is currently only stored as JSON. You can use that JSON in your template but you'll need to decode it first. Marion Newlevant’s &lt;a href=&quot;https://github.com/marionnewlevant/craft-twig_perversion/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twig Perversion&lt;/a&gt; plugin adds a &lt;code&gt;json_decode&lt;/code&gt; filter among other helpful capabilities to Twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that plugin installed, set &lt;code&gt;planData&lt;/code&gt; to a variable with the &lt;code&gt;json_decode&lt;/code&gt; filter applied to it then you can access attributes of &lt;code&gt;planData&lt;/code&gt; as you normally would in Twig.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plans = craft.commerce.getPlans().getAllPlans() %}&#xA;{% for plan in plans %}&#xA;    {% set planData = plan.planData|json_decode %}&#xA;    {{ planData.plan.amount }}&#xA;    {# Stripe stores the amount as cents, so formatting for dollars or euros might look like this #}&#xA;    {{ (planData.plan.amount / 100)|currency }}&#xA;    {# Trial period  #}&#xA;    {{ planData.plan.trial_period_days }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="93" LastEditorUserId="93" LastEditDate="2018-10-27T22:33:07.420" LastActivityDate="2018-10-27T22:33:07.420" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28227" PostTypeId="2" ParentId="28206" CreationDate="2018-10-27T21:38:09.597" Score="1" Body="&lt;p&gt;I think this should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rides in allRides|multisort(['eventDate'],['SORT_DESC'],['SORT_REGULAR']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-27T21:38:09.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28229" PostTypeId="2" ParentId="28191" CreationDate="2018-10-28T00:03:38.460" Score="1" Body="&lt;p&gt;Solved it by installing the Redactor plugin, going through admin/settings/fields on the admin page and changing the field types dropdown from Plain Text to Redactor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kvPtv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kvPtv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8945" LastActivityDate="2018-10-28T00:03:38.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28230" PostTypeId="2" ParentId="28141" CreationDate="2018-10-28T01:32:40.090" Score="1" Body="&lt;p&gt;Looks like this was a &lt;a href=&quot;https://www.modsecurity.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ModSecurity&lt;/a&gt; tripping up the contents of the particular Redactor field in the POST request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nuclear option for a fix is to disable ModSecurity.  The more nuanced fix is to find the particular rule that is tripping up the request and either disable it or to modify it so it allows that content through.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-28T01:32:40.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28231" PostTypeId="2" ParentId="28213" CreationDate="2018-10-28T02:27:04.260" Score="2" Body="&lt;p&gt;This will be a similar answer as here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28109/craft-3-large-log-file-sizes/28145#28145&quot;&gt;Craft 3 large log file sizes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically Craft goes with Yii's default &lt;code&gt;FileTarget&lt;/code&gt; settings, which is 5 log files of 10MB each before they start rotating out.  Those are individual limits for both &lt;code&gt;web.log&lt;/code&gt; and &lt;code&gt;console.log&lt;/code&gt; files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change those behaviors you'll need to modify those properties via a &lt;code&gt;config/app.php&lt;/code&gt; file using your own FileTarget settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's another post here with some useful guidance: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/25427/craft-3-plugins-logging-in-a-separate-log-file/25430#25430&quot;&gt;Craft 3 plugins - Logging in a separate *.log file&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-28T02:27:04.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28232" PostTypeId="1" AcceptedAnswerId="28234" CreationDate="2018-10-28T20:54:53.627" Score="1" ViewCount="522" Body="&lt;p&gt;I have quite a substantial amount of queries heading out for this bit of code below. I've tried quite a few things to get it down, but I need to eager load some things just to try and reduce the overhead of this, but I still think it won't do enough. Is there anything I can look at to optimise this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set brandIds = craft.entries().section('brands').relatedTo({ targetElement: category }).ids() %}&#xA;    {% set offers = craft.entries().section('offers').relatedTo(brandIds).limit(6) %}&#xA;&#xA;    {% for entry in offers %}&#xA;      &amp;lt;div class=&quot;card category-card&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.relatedBrand.one.url }}#{{ entry.id }}&quot; title=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;          &amp;lt;div class=&quot;col-md-12 col-4&quot;&amp;gt;&#xA;              {% for asset in entry.relatedBrand.one.brandLogo.all() %}&#xA;                &amp;lt;img class=&quot;card-img-top&quot; src=&quot;{{ asset.geturl }}&quot; alt=&quot;Card image cap&quot;&amp;gt;&#xA;              {% endfor %}&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;div class=&quot;col-md-12 col-8&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;              &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h5&amp;gt;&#xA;              &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;              &amp;lt;small class=&quot;text-muted&quot;&amp;gt;{{ entry.relatedBrand.one }}&amp;lt;/small&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-10-29T11:52:16.103" Title="Eager Loading Relatedto &amp; Target Elements" Tags="&lt;templating&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28233" PostTypeId="2" ParentId="27851" CreationDate="2018-10-28T22:55:54.370" Score="1" Body="&lt;p&gt;You can search each section separately, count the totals of each and then merge them back together to form your full results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Search each section separately #}&#xA;{% set query = craft.request.getParam('query') %}&#xA;{% set mapMarkerResults = craft.weightedSearch.substringSearch(query, ['mapMarker']) %}&#xA;{% set blogResults = craft.weightedSearch.substringSearch(query, ['blog']) %}&#xA;&#xA;{# Merge the two sections' results together #}&#xA;{% set fullResults = mapMarkerResults|merge(blogResults) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because Twig's &lt;code&gt;|merge&lt;/code&gt; filter will add all the &lt;code&gt;blogResults&lt;/code&gt; after &lt;code&gt;mapMarkerResults&lt;/code&gt; the sort order will be wrong. Using the &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperSort plugin&lt;/a&gt; (version 1.2.0 supports Craft 2) you can fix that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Use SuperSort's rsortAs method to sort the results by Weighted Search's score in descending order #}&#xA;{% set fullResults = fullResults|supersort('rsortAs', '{score}') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can handle the output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;There's {{ blogResults|length }} results from the Blog section.&#xA;There's {{ mapMarkerResults|length }} results from the Map Marker section.&#xA;&#xA;{% for searchResult in fullResults %}&#xA;    {{ searchResult.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; SuperSort might not sort exactly the same as Weighted Search. They will correctly be sorted by score in descending order, but it might not break ties the same way (e.g. two entries with a score of 1). If it's important for the search results to be in &lt;strong&gt;exactly&lt;/strong&gt; the same order as Weighted Search you should run the search again. This is obviously more server intensive and I wouldn't recommend it as it'll slow down your page loads.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mapMarkerResultsCount = craft.weightedSearch.substringSearch(query, ['mapMarker'])|length %}&#xA;{% set blogResultsCount = craft.weightedSearch.substringSearch(query, ['blog'])|length %}&#xA;{% set fullResults = craft.weightedSearch.substringSearch(query, ['people', 'blog']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-10-29T23:30:39.047" LastActivityDate="2018-10-29T23:30:39.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28234" PostTypeId="2" ParentId="28232" CreationDate="2018-10-29T11:52:16.103" Score="2" Body="&lt;p&gt;First of all just a few ideas about best practices&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Don't&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ entry.relatedBrand.one.url }}&#xA;{{ entry.relatedBrand.one.title }}&#xA;{{ entry.relatedBrand.one.size }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Do&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set relatedImage = entry.relatedBrand.one() %}&#xA;{{ relatedImage.url }}&#xA;{{ relatedImage.title }}&#xA;{{ relatedImage.size }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore your code with eager loading&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set brandIds = craft&#xA;    .entries()&#xA;    .section('brands')&#xA;    .relatedTo({ targetElement: category })&#xA;    .ids() &#xA;%}&#xA;{% set offers = craft&#xA;    .entries()&#xA;    .section('offers')&#xA;    .with(['relatedBrand.brandLogo'])&#xA;    .relatedTo(brandIds)&#xA;    .limit(6) &#xA;    .all()&#xA;%}&#xA;&#xA;{% for entry in offers %}&#xA;  &amp;lt;div class=&quot;card category-card&quot;&amp;gt;&#xA;    {% set relatedBrand = entry.relatedBrand? entry.relatedBrand[0] : null %}&#xA;    &amp;lt;a href=&quot;{{ relatedBrand.url?? '' }}#{{ entry.id }}&quot; title=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;col-md-12 col-4&quot;&amp;gt;&#xA;          {% set logos = relatedBrand? relatedBrand.brandLogo : [] %}&#xA;          {% for asset in logos %}&#xA;            &amp;lt;img class=&quot;card-img-top&quot; src=&quot;{{ asset.geturl }}&quot; alt=&quot;Card image cap&quot;&amp;gt;&#xA;          {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;col-md-12 col-8&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;          &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ entry.title }}&amp;lt;/h5&amp;gt;&#xA;          &amp;lt;p&amp;gt;{{ entry.body }}&amp;lt;/p&amp;gt;&#xA;          &amp;lt;small class=&quot;text-muted&quot;&amp;gt;{{ relatedBrand.title?? '' }}&amp;lt;/small&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-29T11:52:16.103" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28235" PostTypeId="1" CreationDate="2018-10-29T12:56:02.370" Score="2" ViewCount="1087" Body="&lt;p&gt;We could use some help tracking down a consistent error on our Craft installs according to Acunetix Security Audits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;URL Rewrite Vulnerability&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It was identified that this application supports the legacy headers&#xA;  &lt;strong&gt;X-Original-URL&lt;/strong&gt; and/or &lt;strong&gt;X-Rewrite-URL&lt;/strong&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Support for these headers lets users override the path in the request&#xA;  URL via the X-Original-URL or X-Rewrite-URL HTTP request header and&#xA;  allows a user to access one URL but have web application return a&#xA;  different one which can bypass restrictions on higher level caches and&#xA;  web servers.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Many web frameworks such as Symfony 2.7.0 to 2.7.48, 2.8.0 to 2.8.43,&#xA;  3.3.0 to 3.3.17, 3.4.0 to 3.4.13, 4.0.0 to 4.0.13 and 4.1.0 to 4.1.2 , zend-diactoros up to 1.8.4, zend-http up to 2.8.1, zend-feed up to&#xA;  2.10.3 are affected by this security issue.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://symfony.com/blog/cve-2018-14773-remove-support-for-legacy-and-risky-http-headers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://symfony.com/blog/cve-2018-14773-remove-support-for-legacy-and-risky-http-headers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://framework.zend.com/security/advisory/ZF2018-01&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://framework.zend.com/security/advisory/ZF2018-01&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;These sites are hosted on Forge / Linode servers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Versions vary, but most are recent-ish Craft 2.X&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A couple (though not all) use the Redirect Manager plugin&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2018-11-28T13:07:02.613" Title="Does Craft Have a URL Rewrite Vulnerability?" Tags="&lt;redirect&gt;&lt;security&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28236" PostTypeId="1" AcceptedAnswerId="28237" CreationDate="2018-10-29T15:16:00.320" Score="0" ViewCount="84" Body="&lt;p&gt;I want to disable google tag manager on 404 templates, I am able to add the additional condition for the script &quot;Google Tag Manager Settings&quot;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aDbUp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aDbUp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has stopped GTM script code, but &lt;code&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; tracking is still rendering on the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9za06.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9za06.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is their way inside plugin options/SeoMatic template variable, soi can hide &lt;code&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; code as well on specific pages&lt;/p&gt;&#xA;" OwnerUserId="8961" LastActivityDate="2018-10-29T15:41:55.117" Title="Craft SeoMatic GTM &lt;noscript&gt; disable on 404 pages" Tags="&lt;craft3&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28237" PostTypeId="2" ParentId="28236" CreationDate="2018-10-29T15:41:55.117" Score="1" Body="&lt;p&gt;SEOmatic author here -- what version of SEOmatic are you using? I think the best way to do this would be to just disable the container from being included in your 404 Twig template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seomatic.script.get('googleTagManager').include(false) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As per: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#google-tag-manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#google-tag-manager&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-29T15:41:55.117" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28238" PostTypeId="2" ParentId="28206" CreationDate="2018-10-29T16:14:45.317" Score="2" Body="&lt;p&gt;For those of you reading through this post, I thought it might be useful to provide a bit of background on my question. The Craft Docs list &quot;multisort&quot; under Filters and it sounded like something that would work nicely for me. However, the Craft Docs do not give an example, instead directing the reader to Yii docs. Those docs confirmed it was exactly what I needed - sorting an array by a given key, descending, numeric. However, the syntax does not make sense in term of using it within a template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the answer from Brad and Andrew, which works great:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for rides in allRides|multisort(['eventDate'],['SORT_DESC'],['SORT_REGULAR']) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is what you will find on the &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-helpers-basearrayhelper#multisort()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii docs page&lt;/a&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static void multisort ( &amp;amp;$array, $key, $direction = SORT_ASC, $sortFlag = SORT_REGULAR )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suppose if you are a php wizard, which, as you might have guessed, I am not, you might figure this out on your own. Having said that, it would save many of us lots of time if the Craft docs simply included the example that Brad was kind enough to provide.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-10-29T16:14:45.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28239" PostTypeId="1" CreationDate="2018-10-29T17:04:15.580" Score="1" ViewCount="125" Body="&lt;p&gt;Have been using nystudio107 scripts to manage database workflow. Just launched first Craft 3 site and noticed that when i went to sync the database locally from server the /tmp partition on the server maxed out in seconds and brought the whole server down when trying to copy the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The culprit turned out to be 5G of cache content in craft_templatecachequeries which maxed out the partition tmp size (4GB)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had added cache tags around main for loops, but i spotted that i had lazily tried to cache the whole news index page with the news index template being cached from top to bottom. I have removed these.THe cache table size has improved to a more stable 1GB but that seems incredibly high still.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal for Craft3?&#xA;(I guess there is a possible separate issue with scripts for db sync/pulling)&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-10-29T18:01:11.727" Title="Cache table filling too quickly" Tags="&lt;craft3&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28240" PostTypeId="1" CreationDate="2018-10-29T17:12:37.100" Score="1" ViewCount="44" Body="&lt;p&gt;How can I make related entries and globals part of the search considerations? &#xA;So I have a website search bar that searches the whole website. &#xA;Within some jobs pages there are some global elements that exist, a related entries to pull through some on page related content (a call out bar) and some general text that is used on all jobs pages. The reason these are global, is that they can be updated and applied to multiple pages in one go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, doing a search for the phrase 'benefits' does not include any jobs pages at all, even though the call-out bar and the global benefits content are used on each job page/template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equally on other pages, there is a related module type that links to related entries ((call out bars) and I would like these to be part of the search considerations too, so this issue stretches further than just one section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-10-29T19:13:15.147" Title="How can I make related entries and globals part of the search considerations?" Tags="&lt;relations&gt;&lt;search&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28241" PostTypeId="2" ParentId="28235" CreationDate="2018-10-29T17:37:56.597" Score="2" Body="&lt;p&gt;Both Yii 1 and Yii 2 will check for the &lt;code&gt;X-Rewrite-URL&lt;/code&gt; header when determining the requested URI, however no known vulnerabilities exist related to that, because Craft is sure to use the same URI (whatever its source) for both routing and any other URI-related logic throughout the system. So it’s not possible to have Craft base its routing on one URI and template logic off of another URI, for example.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-10-29T17:37:56.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28242" PostTypeId="2" ParentId="28239" CreationDate="2018-10-29T18:01:11.727" Score="1" Body="&lt;p&gt;I'm not sure if it's the same thing, but if the queries you are caching are complex (nested queries, etc), it may be caused by the queries being serialized in Craft 3. Have a look at Brad's answer to a question I had a while go, to see if it covers your case as well:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/26886/caching-in-craft-3-causes-out-of-memory-when-including-grouped-for-loop&quot;&gt;Caching in Craft 3 causes out of memory when including grouped for loop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up using the Cache Flag plugin to work around this.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2018-10-29T18:01:11.727" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28243" PostTypeId="2" ParentId="28240" CreationDate="2018-10-29T19:13:15.147" Score="1" Body="&lt;p&gt;I am going to guess that Search does work on rendered templates, so relatedTo items and globals would not figure into the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add something to the query string? If so, you could modify the search results page with a &quot;related to&quot; query.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-10-29T19:13:15.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28244" PostTypeId="1" AcceptedAnswerId="28247" CreationDate="2018-10-29T21:05:23.933" Score="2" ViewCount="105" Body="&lt;p&gt;I have a front-end form that registered users can log into and edit entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am checking for the correct user group, then also checking for the permission:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if currentUser.isInGroup('myGroup') %}&#xA;&#xA;    {# Get the entry #}&#xA;    {% set request = craft.app.request.segment(3) %}&#xA;    {% set entry = craft.entries.section('mySection').slug(request).one() %}&#xA;&#xA;    {% if entry|length &amp;gt; 0 %}&#xA;        {% if currentUser.can('editEntries:7') %}&#xA;          {# user can edit the current entry #}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All is fine, but if I change the url to another valid url (where the logged in user is not the author) I am still able to see the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to prevent that? Is it as easy as just checking/comparing authors? Or is there a more eloquent way? I do have other permissions disabled...&#xA;&lt;a href=&quot;https://i.stack.imgur.com/E3Dr3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E3Dr3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-10-29T22:24:27.267" LastActivityDate="2018-10-29T23:41:25.100" Title="How can I only allow authors to edit their own entires via front-end?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28245" PostTypeId="1" CreationDate="2018-10-29T21:52:47.167" Score="2" ViewCount="77" Body="&lt;p&gt;Okay, so similar issue to this question (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/19505/sprout-email-notifications-setting-the-recipient&quot;&gt;Sprout email notifications - setting the recipient?&lt;/a&gt;). I must be doing something stupid here because. Trying to set the recipient from an entry form, with a hidden field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;recipient&quot; value=&quot;{{ 'name@address.co.uk'|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the control panel, the &lt;em&gt;Recipients&lt;/em&gt; field has {recipient}. That should work right, but I don't receive the email. If I manually set an email address in the control panel &lt;em&gt;Recipients&lt;/em&gt; field, it works fine.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-12-17T22:25:18.687" Title="Set Recipient in Sprout Email Notification" Tags="&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28246" PostTypeId="2" ParentId="28164" CreationDate="2018-10-29T22:02:25.517" Score="1" Body="&lt;p&gt;This was a bug and has been resolved in &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/craft-plugins/seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout SEO&lt;/a&gt; v4.0.0-beta.10. You can update via the Plugin Store.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-10-29T22:02:25.517" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28247" PostTypeId="2" ParentId="28244" CreationDate="2018-10-29T23:41:25.100" Score="2" Body="&lt;p&gt;You can check if the current entry's author is the &lt;code&gt;currentUser&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.id == currentUser.id %}&#xA;    {# User can edit entry #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-10-29T23:41:25.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28248" PostTypeId="1" AcceptedAnswerId="28250" CreationDate="2018-10-30T03:09:44.297" Score="1" ViewCount="302" Body="&lt;p&gt;How do I change the link that's sent in a forgot password email that's sent to front end users in Craft 3? The &lt;code&gt;setPasswordPath&lt;/code&gt; config isn't working for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The users don't have access to the CP. In my global config settings I have &lt;code&gt;'setPasswordPath' =&amp;gt; '/account/set-password'&lt;/code&gt; I have a template based on the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;doc's Set Password Form example&lt;/a&gt; that loads at &lt;em&gt;mysite.test/account/set-password&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email is sent via a template that is based on the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/forgot-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;doc's Forgot Password Form example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The links in the emails look like this: &lt;em&gt;mysite.test/&lt;strong&gt;actions/users/set-password&lt;/strong&gt;?code=r8tyzUikpXko0b2o5A785TC73geK0jvh&amp;amp;id=a91a64a3-8869-4f0d-a11b-2ad54d69303c&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want them to link to my template like this: &lt;em&gt;mysite.test/&lt;strong&gt;account/set-password&lt;/strong&gt;?code=r8tyzUikpXko0b2o5A785TC73geK0jvh&amp;amp;id=a91a64a3-8869-4f0d-a11b-2ad54d69303c&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-10-30T06:10:40.350" Title="Craft 3 setPasswordPath config not working for front end users" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;users&gt;&lt;config&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28249" PostTypeId="1" AcceptedAnswerId="28253" CreationDate="2018-10-30T03:42:10.713" Score="3" ViewCount="222" Body="&lt;p&gt;I have a custom field type I am porting from Craft 2 to Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This field type used &lt;code&gt;prepValueFromPost&lt;/code&gt; to grab a reference to a just uploaded file and then saves said file to an appropriate place for temporary storage (the file is sent on to a ticketing system which keeps its own copy so really it's only needed here for a few seconds).  The actual field value is jsut set to the full file path/name as a record.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really struggling to port this across to Craft 3 as this area has seemingly been re-factored a lot...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I need to use &lt;code&gt;serializeValue&lt;/code&gt; in place of &lt;code&gt;prepValueFromPost&lt;/code&gt;, but I can't grab the actual filename from input in there and the value received is null (I &lt;em&gt;expected&lt;/em&gt; it to be the filename..but it's not).  I used to use &lt;code&gt;getContentPostLocation();&lt;/code&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My specific questions are - is serializeValue() the right place to do this?  I want it to occur, once (per field - this is in a matrix), when the element (a Commerce Order) is saved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And - how do I get the name of the uploaded file (i.e. what has replaced &lt;code&gt;getContentPostLocation&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code that worked in Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function prepValueFromPost($value, $element)&#xA;{&#xA;&#xA;    $finalFilePath = null;&#xA;&#xA;    //Weird function that works out the dynamic name of this field&#xA;    $filename = $this-&amp;gt;getContentPostLocation();&#xA;    $file = UploadedFile::getInstanceByName($filename);&#xA;&#xA;    //Save the file where we want it, delete the temporary file&#xA;    $outputDir = craft()-&amp;gt;path-&amp;gt;getTempPath() . &quot;BusinessLogicPlugin_upload_&quot; . time();&#xA;    IOHelper::ensureFolderExists($outputDir);&#xA;    //Was needed on dev, can't really hurt...leave it here.&#xA;    chmod($outputDir, 0775);&#xA;&#xA;    $finalFilePath = $outputDir .&quot;/&quot; . $file-&amp;gt;name;&#xA;&#xA;    if(!($file-&amp;gt;saveAs($finalFilePath, false))){&#xA;        BusinessLogicPlugin::log(&quot;Unable to save actual file [$finalFilePath], file will not be attached&quot;);&#xA;        $finalFilePath = &quot;&quot;;&#xA;    }&#xA;&#xA;    //Save the pathname of the file, if we were able to save it, otherwise empty string.&#xA;    return $finalFilePath;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2018-12-12T23:25:18.967" Title="Craft 3 Custom Field Type with a File Uploader" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28250" PostTypeId="2" ParentId="28248" CreationDate="2018-10-30T06:10:40.350" Score="2" Body="&lt;p&gt;If you really want to change the password action url (not the password path) you can only do that in your Twig template and use the &lt;code&gt;|replace('actions/users/set-password', 'account/set-password')&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action url is hard coded in PHP and I would suggest you not to change it unless you know what you are doing. It would by default route to an action that does several important things and then redirects to the &lt;code&gt;passwordPath&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you replace the route you should include the logic into your custom controller or create a site url rule to the default action &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-30T06:10:40.350" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="28251" PostTypeId="1" AcceptedAnswerId="29116" CreationDate="2018-10-30T06:58:07.490" Score="1" ViewCount="82" Body="&lt;p&gt;Using freeform on another CMS, I was able to pass the last segment of the previous page url (when navigating to the form page) to a form field in the freeform composer, is this feature possible in the Craft version? Or alternatively, would this be possible passing an entry title? Thanks&lt;/p&gt;&#xA;" OwnerUserId="2187" LastActivityDate="2019-01-14T20:04:26.257" Title="Pass last segment to solspace freeform field" Tags="&lt;variable&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28252" PostTypeId="1" CreationDate="2018-10-30T09:19:10.890" Score="1" ViewCount="27" Body="&lt;p&gt;I have a section where most entries have a category assigned to them, but a few ones have no category at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need help how to connect these entries' URLs to my entry template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I used a route to catch these cases and assign them to the entry template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Route URLs like &lt;code&gt;section/slug&lt;/code&gt; to template &lt;code&gt;/section/_entry&lt;/code&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I realised that this also catches all entries that have a category, so both these URLs would be valid: &lt;code&gt;/section/category1/slug1&lt;/code&gt; and &lt;code&gt;/section/slug1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all entries with a category assigned to them should raise a 404 if their category is missing from the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks like a common scenario, but so far I only found a solution where those entries are &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1523/is-there-any-way-of-specifying-a-default-category-for-a-category-field&quot;&gt;given a default category&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I handle my case?&lt;/p&gt;&#xA;" OwnerUserId="8596" LastActivityDate="2018-10-30T09:19:10.890" Title="How to handle URLs of entries with no category?" Tags="&lt;templating&gt;&lt;category&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28253" PostTypeId="2" ParentId="28249" CreationDate="2018-10-30T09:54:43.723" Score="4" Body="&lt;p&gt;Just as a little example how to store files in a custom field&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * @inheritdoc&#xA; */&#xA;public function normalizeValue($value, ElementInterface $element = null)&#xA;{&#xA;&#xA;    $namespace = $element? $element-&amp;gt;getFieldParamNamespace() . '.' : '';&#xA;    $file = UploadedFile::getInstanceByName($namespace . $this-&amp;gt;handle);&#xA;    if($file !== null){&#xA;        // replace this&#xA;        $somePath = __DIR__ . DIRECTORY_SEPARATOR . $file-&amp;gt;name;&#xA;        $file-&amp;gt;saveAs($somePath);&#xA;    }&#xA;    return $file;&#xA;}&#xA;&#xA;/**&#xA; * @inheritdoc&#xA; */&#xA;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    Craft::$app-&amp;gt;getView()-&amp;gt;registerJs('Craft.cp.$primaryForm.attr(\'enctype\', \'multipart/form-data\');');&#xA;    return '&amp;lt;input type=&quot;file&quot; name=&quot;' . $this-&amp;gt;handle . '&quot;&amp;gt;';&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Edit:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you want to store the file path in your Database you would check if &lt;code&gt;$value&lt;/code&gt; is an instance of &lt;code&gt;File&lt;/code&gt; and if so return the path. Otherwise just declare your field has &lt;code&gt;contentColumn = false&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-30T10:27:59.377" LastActivityDate="2018-10-30T10:27:59.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28254" PostTypeId="1" CreationDate="2018-10-30T10:53:13.727" Score="1" ViewCount="244" Body="&lt;p&gt;I wanted to build a commerce website using Craft 3. And I wanted to create parent registration form so each parent will have an account to use on the site. Then after they sign in I want them to be able to add their children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do using Craft 3. The only thing I found is user registration form on the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a blog or documentation that shows how to integrate this feature using Craft 3 or is there anything I missed so far.&lt;/p&gt;&#xA;" OwnerUserId="8964" LastEditorUserId="57" LastEditDate="2018-10-31T00:44:55.583" LastActivityDate="2018-10-31T00:44:55.583" Title="User account registration using Craft 3" Tags="&lt;craft3&gt;&lt;users&gt;&lt;craft-features&gt;&lt;user-groups&gt;&lt;current-user&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28255" PostTypeId="1" AcceptedAnswerId="28259" CreationDate="2018-10-30T11:38:19.783" Score="1" ViewCount="370" Body="&lt;p&gt;I'm trying to modify Craft 3's example '&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/set-password-form.html#app&quot; rel=&quot;nofollow noreferrer&quot;&gt;Change password&lt;/a&gt;' form to work with a logged in Commerce 2 user, and have copied that code to &lt;code&gt;templates/setpassword.twig&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two problems...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) The {{ code }} and {{ id }} variables throw &lt;em&gt;Don't exist&lt;/em&gt; errors.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) If I comment those variables out, I get a &lt;em&gt;Page not found/&quot;Unable to resolve the request: users/setPassword&quot;&lt;/em&gt; error when submitting the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly I'm doing this totally wrong ... can anyone set me straight?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;{{ csrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/set-password&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;code&quot; value=&quot;{{ code }}&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;{{ id }}&quot;&amp;gt;&#xA;&#xA;&amp;lt;h3&amp;gt;&amp;lt;label for=&quot;newPassword&quot;&amp;gt;New Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;&amp;lt;input id=&quot;newPassword&quot; type=&quot;password&quot; name=&quot;newPassword&quot;&amp;gt;&#xA;{% if errors is defined %}&#xA;    &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;        {% for error in errors %}&#xA;            &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-10-30T14:46:41.243" Title="Frontend form to change Craft Commerce user's password?" Tags="&lt;password&gt;&lt;frontend-form&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28256" PostTypeId="2" ParentId="28255" CreationDate="2018-10-30T12:45:47.647" Score="-1" Body="&lt;p&gt;I &lt;a href=&quot;https://github.com/craftcms/docs/pull/206&quot; rel=&quot;nofollow noreferrer&quot;&gt;raised a PR&lt;/a&gt; for this last week but it was closed. Apparently you're not supposed to load those templates from the front end as those variables are not auto-populated by craft. (&lt;a href=&quot;https://github.com/craftcms/docs/pull/206/commits/8ad7fd8ea1a7b3915d77d1b2a9fe3bebadafa46c&quot; rel=&quot;nofollow noreferrer&quot;&gt;This code&lt;/a&gt; fixes the problem)&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2018-10-30T12:45:47.647" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28257" PostTypeId="1" CreationDate="2018-10-30T13:54:28.540" Score="3" ViewCount="374" Body="&lt;p&gt;I want to change the filename before the file is stored, to prevent ugly, long and weird filenames uploaded by users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found an example for Craft 2, but because of the changes for events I can't rebuild this for Craft 3 (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/13154/change-asset-name-on-upload&quot;&gt;Change asset name on upload&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to change it a event, no luck;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Asset::class,&#xA;    Asset::EVENT_BEFORE_HANDLE_FILE,&#xA;    function(AssetEvent $event) {&#xA;&#xA;        $asset = $event-&amp;gt;asset;                         &#xA;        $filename = 'filename'.md5(time()).'.'.$asset-&amp;gt;getExtension();&#xA;        $asset-&amp;gt;filename = $filename;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apparently the filename property is read-only, so you can only change properties like the title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8965" LastActivityDate="2018-10-30T14:02:52.343" Title="How to rename filename of asset before (or after) upload in Craft 3" Tags="&lt;assets&gt;&lt;craft3&gt;&lt;upload&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28258" PostTypeId="2" ParentId="28257" CreationDate="2018-10-30T14:02:52.343" Score="5" Body="&lt;p&gt;Well, after searching for this for more than 2 hours, I bumped into a working solution;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Elements::class,&#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(ElementEvent $event)   {&#xA;&#xA;        $asset = $event-&amp;gt;element;&#xA;&#xA;        if ($event-&amp;gt;isNew &amp;amp;&amp;amp; $asset instanceof craft\elements\Asset) {&#xA;            $newFileName = 'file-'.md5(time()).'.'.$asset-&amp;gt;getExtension();&#xA;            Craft::$app-&amp;gt;assets-&amp;gt;moveAsset($asset, $asset-&amp;gt;getFolder(), $newFileName);&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case somebody needs it!&lt;/p&gt;&#xA;" OwnerUserId="8965" LastActivityDate="2018-10-30T14:02:52.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28259" PostTypeId="2" ParentId="28255" CreationDate="2018-10-30T14:29:06.017" Score="3" Body="&lt;p&gt;The code you are currently using is for the &lt;code&gt;Set Password&lt;/code&gt; form that is used when a user forgets their password and you send them a &lt;code&gt;Password reset email&lt;/code&gt; as documented at &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I'm using to allow users to &lt;strong&gt;change&lt;/strong&gt; their passwords on demand. It is based on the &lt;code&gt;User Profile Form&lt;/code&gt; documented at &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/user-profile-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/user-profile-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;    {# Change to suit your needs #}&#xA;    {{ redirectInput('users/'~currentUser.username) }}&#xA;    {# Get logged-in user's ID #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;    {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;    {# Enter current password #}&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;password&quot;&amp;gt;Current Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(user.getErrors('password')) }}&#xA;    {% endif %}&#xA;&#xA;    {# Enter new password #}&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;newPassword&quot;&amp;gt;New Password&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;newPassword&quot; type=&quot;password&quot; name=&quot;newPassword&quot;&amp;gt;&#xA;&#xA;    {% if account is defined %}&#xA;        {{ errorList(user.getErrors('newPassword')) }}&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: updated form to include error handling.&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-10-30T14:46:41.243" LastActivityDate="2018-10-30T14:46:41.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28260" PostTypeId="1" CreationDate="2018-10-30T15:20:14.353" Score="1" ViewCount="34" Body="&lt;p&gt;I have a A-Z menu to filter entries by their first letter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   &amp;lt;ul class=&quot;directory-letters&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;all current&quot; data-filter=&quot;all&quot;&amp;gt;ALL&amp;lt;/li&amp;gt;&#xA;    {% for entry in craft.entries.section('membershipDirectory').order('title asc') %}&#xA;      &amp;lt;li data-filter=&quot;letter-{{ entry.companyName|slice(0, 1)|lower|replace(&quot;/[^a-z]/&quot;, &quot;0-9&quot;) }}&quot;&amp;gt;{{ entry.companyName|slice(0, 1) }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;   &amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Issue I have is if there are 4 entries beginning with 'C' the output will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A B C C C C D E F...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I limit each letter once so I'll get 1 'C' is there are 1+ entries starting with 'C'?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now getting the right number of instances created but no text inside my &lt;li&gt;. Likely a rookie error somewhere:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = &#xA;craft.entries.section('membershipDirectory').order('title asc') %}&#xA;{% set allEntriesByFirstCharacter = &#xA; allEntries|group('companyName|slice(0, 1)|lower|replace(&quot;/[^a-z]/&quot;, &#xA; &quot;0-9&quot;)' ) %}&#xA;&#xA; &amp;lt;ul class=&quot;directory-letters&quot;&amp;gt;&#xA;    &amp;lt;li class=&quot;all current&quot; data-filter=&quot;all&quot;&amp;gt;ALL&amp;lt;/li&amp;gt;&#xA;    {% for allEntries in allEntriesByFirstCharacter %}&#xA;       &amp;lt;li data-filter=&quot;letter-{{ entry.companyName|slice(0, 1)|lower|replace(&quot;/[^a-z]/&quot;, &quot;0-9&quot;) }}&quot;&amp;gt;{{ entry.companyName|slice(0, 1)|lower|replace(&quot;/[^a-z]/&quot;, &quot;0-9&quot;) }}&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2018-10-30T16:55:07.103" LastActivityDate="2018-10-30T16:55:07.103" Title="A-Z filter menu - limiting output to one when there are multiples" Tags="&lt;entries&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28261" PostTypeId="2" ParentId="28260" CreationDate="2018-10-30T15:36:02.920" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://docs.craftcms.com/v2/templating/filters.html#filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;group&lt;/a&gt; filter and create a 2d array with the letter as the first index and the entries as second index. &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set allEntriesByFirstCharacter = allEntries|group('companyName|slice(0, 1)|lower|replace(&quot;/[^a-z]/&quot;, &quot;0-9&quot;)' ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The string passed in the filter will get rendered as an object template an equal results will be grouped by the same key. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-30T15:36:02.920" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28262" PostTypeId="1" CreationDate="2018-10-30T15:40:17.513" Score="1" ViewCount="14" Body="&lt;p&gt;I have a front-end form that allows registered users to edit content. In this case, it is a podcast. I have multiple podcasts that blog to different providers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I am selecting the provider that belongs to the &lt;code&gt;currentUser&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set provider = craft.entries()&#xA;    .section('provider').relatedTo({&#xA;        element: currentUser,&#xA;        field: 'contributors'&#xA;    }).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works great. From there, here is how I am selecting the podcast that belongs to the current provider (selected above).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set podcast = craft.entries()&#xA;    .section('podcast').relatedTo({&#xA;        targetElement: provider,&#xA;        field: 'podcastProvider'&#xA;    }).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works well, I am able to get the podcast and do whatever with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd also like to make a double check that this podcast belongs to the current provider - which belongs to the &lt;code&gt;currentUser&lt;/code&gt;. Maybe that's overkill, I'd like to hear thoughts about that...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I am trying, but not having much luck.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set podcast = craft.entries()&#xA;    .section('podcast')&#xA;    .relatedTo(['and',&#xA;        {targetElement: provider, field: 'podcastProvider'},&#xA;        {targetElement: currentUser, field: 'provider.contributors'}&#xA;    ]).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;currentUser&lt;/code&gt; is of course the user that is currently logged in. &lt;code&gt;contributors&lt;/code&gt; is a &lt;code&gt;users&lt;/code&gt; field that exists on the provider entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I was trying to make double-sure that the person who was logged in, not only belong to the provider, but the podcast they are editing belongs to the provider - that they (the currentUser) belongs to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, is this completely overkill? Thank you for your suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-10-30T16:07:25.267" LastActivityDate="2018-10-30T16:07:25.267" Title="How can I use a double relation to include the currentUser as criteria?" Tags="&lt;craft3&gt;&lt;relations&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28263" PostTypeId="1" CreationDate="2018-10-30T16:59:45.370" Score="1" ViewCount="36" Body="&lt;p&gt;I created a Shop page here: &lt;a href=&quot;https://www.intermountaincleaning.net/shop/products/diamond-magic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.intermountaincleaning.net/shop/products/diamond-magic&lt;/a&gt;. The rest of the site is just static HTML (not Craft), and the Shop page is in a Shop folder within the public_html for the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is pulling in the correct _layout file, and it's including the _nav and _footer, but if you open dev tools there's a 404 error on the products/_product template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm staging the site here, and it's working just fine with the same templates: &lt;a href=&quot;http://diamondmagic.jonathanweedin.com/shop/products/diamond-magic&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://diamondmagic.jonathanweedin.com/shop/products/diamond-magic&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out why Craft isn't pulling in the products/_product template. Attaching screenshots of my CP area, Craft folder, and public_html folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance would be much appreciated. Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ik7QC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ik7QC.png&quot; alt=&quot;CP area of Craft Commerce&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nai8f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nai8f.png&quot; alt=&quot;Craft folder on the server&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HP0PR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HP0PR.png&quot; alt=&quot;public_html folder on the server&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;config/general.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;    return array(&#xA;        'siteUrl' =&amp;gt; 'intermountaincleaning.net',&#xA;        'environmentVariables' =&amp;gt; array(&#xA;            'baseUrl' =&amp;gt; 'intermountaincleaning.net'&#xA;        ),&#xA;        'defaultWeekStartDay' =&amp;gt; 0,&#xA;        'enableCsrfProtection' =&amp;gt; true,&#xA;        'omitScriptNameInUrls' =&amp;gt; 'auto',&#xA;        'cpTrigger' =&amp;gt; '***********', // I'm ommitting this from StackExchange&#xA;        'devMode' =&amp;gt; true,&#xA;        'tokenParam' =&amp;gt; 'paypalexpress',&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8967" LastEditorUserId="50" LastEditDate="2018-10-30T22:46:38.753" LastActivityDate="2018-10-30T22:46:38.753" Title="404 error on entry template in dev tools, but layout template loads" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28265" PostTypeId="1" CreationDate="2018-10-30T19:22:45.343" Score="1" ViewCount="62" Body="&lt;p&gt;I have a form where the checkbox group options I show would ideally be based on details for the logged in user. Is it possible to dynamically set checkbox group or radio group options for a Freeform Form within a Twig template?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2018-10-30T19:22:45.343" Title="Is it possible to set dynamic checkbox group options in a Solspace Freeform form?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28266" PostTypeId="2" ParentId="28052" CreationDate="2018-10-31T00:48:27.893" Score="0" Body="&lt;p&gt;Change your composer.json's &quot;require&quot; section to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.23.1&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^v2.4.0&quot;,&#xA;    &quot;craftcms/ckeditor&quot;: &quot;^1.0.0-beta.2&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;^2.1.6&quot;,&#xA;    &quot;solspace/craft3-freeform&quot;: &quot;^2.4.0&quot;,&#xA;   &quot;dolphiq/redirect&quot;: &quot;^1.0.18&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have Composer installed from the command line (&lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&lt;/a&gt;), then you can run &lt;code&gt;composer update&lt;/code&gt; from your project's root, let it complete, load the Craft Control Panel and you should be set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have Composer installed from the command line, then running an update from Craft's Control Panel should basically achieve the same thing.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-10-31T00:48:27.893" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28267" PostTypeId="1" AcceptedAnswerId="28268" CreationDate="2018-10-31T02:13:56.090" Score="1" ViewCount="139" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i5uzm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i5uzm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a custom utility template. Inside the template, I would like to use the built-in asset select modal for the &quot;Add image&quot; button. Any way to do this please?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="8123" LastEditDate="2018-10-31T04:15:37.297" LastActivityDate="2018-10-31T07:48:02.667" Title="How can I use asset select modal in utility?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;control-panel&gt;&lt;garnish&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28268" PostTypeId="2" ParentId="28267" CreationDate="2018-10-31T07:48:02.667" Score="2" Body="&lt;p&gt;The field is just a normal &lt;code&gt;ElementSelect&lt;/code&gt; field with the element type &lt;code&gt;craft\\elements\\Asset&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{{ forms.elementSelectField({&#xA;    label: &quot;Asset&quot;|t('app'),&#xA;    id: 'assetSelect', &#xA;    name: 'assetSelect',&#xA;    elementType: 'craft\\elements\\Asset',&#xA;   selectionLabel: &quot;Choose&quot;|t('app'),&#xA;   elements: elements, //array of selected elements &#xA; }) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-10-31T07:48:02.667" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28269" PostTypeId="1" CreationDate="2018-10-31T14:19:44.293" Score="1" ViewCount="94" Body="&lt;p&gt;I need to be able to side load an image and attach to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My image is coming from an external url... such as &lt;a href=&quot;http://someplace.com/image.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://someplace.com/image.jpg&lt;/a&gt; - i can store this in a temporary file so its locally accessible.  But then how do I upload this image (without using $_POST or $_FILES) and attach to an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method i'm trying at the moment i'm using something like:&#xA;uploadNewAsset(UploadedFile $uploadedFile, $folderId)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But UploadedFile seems to only want to accept POST variables, unless i'm missing something&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8769" LastActivityDate="2018-10-31T15:19:37.093" Title="Sideloading an image from a function in a plugin" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28270" PostTypeId="1" AcceptedAnswerId="28272" CreationDate="2018-10-31T15:10:01.390" Score="1" ViewCount="133" Body="&lt;p&gt;Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;number_format() expects parameter 1 to be float, string given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a way for it to check and remove non-numeric characters from the field on save? Or maybe my setup is incorrect?&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5275" LastEditDate="2018-11-02T19:03:33.927" LastActivityDate="2018-11-02T19:03:33.927" Title="Non-numeric characters in number field producing errors" Tags="&lt;craft3&gt;&lt;entry&gt;&lt;field&gt;&lt;number&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28271" PostTypeId="2" ParentId="28269" CreationDate="2018-10-31T15:10:58.753" Score="1" Body="&lt;p&gt;You can see an entire example how to fetch a file via curl, save it into an asset and relate it to an entry &lt;a href=&quot;https://github.com/Anubarak/api-caller/blob/master/src/services/ApiCallerService.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;// get the entries service&#xA;$entries = Craft::$app-&amp;gt;getElements();&#xA;&#xA;// get the entry&#xA;$entry = \craft\elements\Entry::find()-&amp;gt;one();&#xA;&#xA;// somehow grab the path of your image&#xA;$client = Craft::createGuzzleClient();&#xA;$response = $client-&amp;gt;get('https://www.google.com/logos/2018/halloween18/rc5/cta.png');&#xA;&#xA;$image = $response-&amp;gt;getBody()-&amp;gt;getContents();&#xA;$path = Craft::$app-&amp;gt;getPath()-&amp;gt;getTempPath() . DIRECTORY_SEPARATOR  . 'someFile.png';&#xA;FileHelper::writeToFile($path, $image);&#xA;&#xA;// the folder for the image&#xA;$folder = Craft::$app-&amp;gt;getAssets()-&amp;gt;getFolderById(1);&#xA;&#xA;// create a new asset&#xA;$asset = new \craft\elements\Asset();&#xA;$asset-&amp;gt;tempFilePath = $path;&#xA;$asset-&amp;gt;filename = 'someFileName.jpg';&#xA;$asset-&amp;gt;title = 'someTitle';&#xA;$asset-&amp;gt;newFolderId = $folder-&amp;gt;id;&#xA;$asset-&amp;gt;volumeId = $folder-&amp;gt;volumeId;&#xA;$asset-&amp;gt;avoidFilenameConflicts = true;&#xA;$asset-&amp;gt;setScenario(\craft\elements\Asset::SCENARIO_CREATE);&#xA;if($entries-&amp;gt;saveElement($asset) === true){&#xA;    // file was saved &#xA;    $entry-&amp;gt;setFieldValue('assetFieldHandle', [$asset-&amp;gt;id]);&#xA;    $entries-&amp;gt;saveElement($entry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-10-31T15:19:37.093" LastActivityDate="2018-10-31T15:19:37.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28272" PostTypeId="2" ParentId="28270" CreationDate="2018-10-31T15:30:56.010" Score="3" Body="&lt;p&gt;Just tested this on a local Craft3 setup and here's what I discovered...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;decimal points&lt;/code&gt; setting on the number field is set to &lt;code&gt;0&lt;/code&gt;, adding text in the number field will display the pretty errors below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h5vkx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h5vkx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;decimal points&lt;/code&gt; setting is set to anything else, you get the Twig error mentioned in the title of this post:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;number_format() expects parameter 1 to be float, string given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd recommend opening an issue in the &lt;a href=&quot;https://github.com/craftcms/cms/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS repo&lt;/a&gt; as I imagine the number field ought to display the pretty errors no matter if &lt;code&gt;decimal points&lt;/code&gt; is set or not.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-10-31T15:30:56.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28273" PostTypeId="1" CreationDate="2018-10-31T15:37:23.737" Score="1" ViewCount="302" Body="&lt;p&gt;Right so my nginx config is a trimmed down version of Andrew Welch's config as detailed &lt;a href=&quot;https://nystudio107.com/blog/static-caching-with-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All good. Caching works a dream on all the public pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However now when I go to /admin, it loads the content for the homepage, and all URLs become relative to site.com/admin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can go to /admin/login, but logging in doesn't actually work - it just redirects me to /admin/login again with no error message.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fastcgi_cache_path /home/forge/{sitename}/cache levels=1:2 keys_zone=stagecache:100m inactive=1d use_temp_path=off max_size=100m;&#xA;&#xA;# FORGE CONFIG (DOT NOT REMOVE!)&#xA;include forge-conf/{sitename}/before/*;&#xA;&#xA;server {&#xA;  listen 80;&#xA;  listen [::]:80;&#xA;  server_name {server};&#xA;  root /home/forge/{sitename}/web;&#xA;&#xA;  # FORGE SSL (DO NOT REMOVE!)&#xA;  # ssl_certificate;&#xA;  # ssl_certificate_key;&#xA;&#xA;  ssl_protocols TLSv1.2;&#xA;  ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;&#xA;  ssl_prefer_server_ciphers on;&#xA;  ssl_dhparam /etc/nginx/dhparams.pem;&#xA;&#xA;  add_header X-Frame-Options &quot;SAMEORIGIN&quot;;&#xA;  add_header X-XSS-Protection &quot;1; mode=block&quot;;&#xA;  add_header X-Content-Type-Options &quot;nosniff&quot;;&#xA;&#xA;  index index.html index.htm index.php;&#xA;  charset utf-8;&#xA;  ssi on;&#xA;&#xA;  client_max_body_size 8M;&#xA;&#xA;  # Cache everything by default&#xA;  fastcgi_cache_key &quot;$scheme$request_method$host$request_uri&quot;;&#xA;  add_header X-Cache $upstream_cache_status;&#xA;  set $no_cache 0;&#xA;  if ($request_method = POST)&#xA;  {&#xA;    set $no_cache 1;&#xA;  }&#xA;  if ($request_uri ~* &quot;/(admin/|cpresources/)&quot;)&#xA;  {&#xA;    set $no_cache 1;&#xA;  }&#xA;&#xA;  # Change // -&amp;gt; / for all URLs, so it works for our php location block, too&#xA;  merge_slashes off;&#xA;  rewrite (.*)//+(.*) $1/$2 permanent;&#xA;&#xA;  # Access and error logging&#xA;  access_log off;&#xA;  error_log /var/log/nginx/{sitename}-error.log error;&#xA;&#xA;  # FORGE CONFIG (DOT NOT REMOVE!)&#xA;  include forge-conf/{sitename}/server/*;&#xA;&#xA;  # Load configuration files from nginx-partials&#xA;  include /etc/nginx/nginx-partials/*.conf;&#xA;&#xA;  # Root directory location handler&#xA;  location / {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;  }&#xA;&#xA;  # Craft-specific location handlers to ensure AdminCP requests route through index.php&#xA;  # If you change your `cpTrigger`, change it here as well&#xA;  location ^~ /admin {&#xA;    try_files $uri $uri/ @phpfpm_nocache;&#xA;  }&#xA;  location ^~ /index.php/admin {&#xA;    try_files $uri $uri/ @phpfpm_nocache;&#xA;  }&#xA;  location ^~ /cpresources {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;  }&#xA;&#xA;  # php-fpm configuration&#xA;  location ~ [^/]\.php(/|$) {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi_params;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&#xA;    fastcgi_param PATH_INFO $fastcgi_path_info;&#xA;&#xA;    # shared php-fpm configuration&#xA;    fastcgi_intercept_errors off;&#xA;    fastcgi_buffer_size 16k;&#xA;    fastcgi_buffers 4 16k;&#xA;    fastcgi_connect_timeout 300;&#xA;    fastcgi_send_timeout 300;&#xA;    fastcgi_read_timeout 300;&#xA;&#xA;    # FastCGI Cache settings&#xA;    fastcgi_ignore_headers Cache-Control Expires Set-Cookie;&#xA;    fastcgi_cache stagecache;&#xA;    fastcgi_hide_header Set-Cookie;&#xA;    fastcgi_cache_valid 200 1d;&#xA;    fastcgi_cache_use_stale updating error timeout invalid_header http_500;&#xA;    fastcgi_cache_bypass $no_cache;&#xA;    fastcgi_no_cache $no_cache;&#xA;  }&#xA;&#xA;  # php-fpm configuration for non-cached content&#xA;  location @phpfpm_nocache {&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;&#xA;    fastcgi_index index.php;&#xA;    include fastcgi_params;&#xA;    fastcgi_param SCRIPT_FILENAME $document_root/index.php;&#xA;    fastcgi_param PATH_INFO $query_string;&#xA;&#xA;    # shared php-fpm configuration&#xA;    fastcgi_intercept_errors off;&#xA;    fastcgi_buffer_size 16k;&#xA;    fastcgi_buffers 4 16k;&#xA;    fastcgi_connect_timeout 300;&#xA;    fastcgi_send_timeout 300;&#xA;    fastcgi_read_timeout 300;&#xA;&#xA;    # No FastCGI Cache&#xA;    fastcgi_cache_bypass 1;&#xA;    fastcgi_no_cache 1;&#xA;  }&#xA;&#xA;  location ~ /\.ht {&#xA;    deny all;&#xA;  }&#xA;}&#xA;&#xA;# FORGE CONFIG (DOT NOT REMOVE!)&#xA;include forge-conf/{sitename}/after/*;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;by looking at the headers it doesn't seem that /admin is being cached or anything, and I send a test header in the &lt;code&gt;@phpfpm_nocache&lt;/code&gt; block to prove that it's going to the right place, which makes me think it's a problem with the &lt;code&gt;@phpfpm_nocache&lt;/code&gt; block. And that's where I am now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So... what's going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2018-10-31T17:18:53.553" Title="/admin displays homepage content, and I can't login" Tags="&lt;craft3&gt;&lt;admin&gt;&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28275" PostTypeId="2" ParentId="28273" CreationDate="2018-10-31T17:18:53.553" Score="1" Body="&lt;p&gt;It's a bit hard to tell from here, but have you tried putting this in your &lt;code&gt;general.php&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'usePathInfo' =&amp;gt; true,&#xA;'omitScriptNameInUrls' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and see how you go?&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-10-31T17:18:53.553" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28276" PostTypeId="1" CreationDate="2018-10-31T23:19:51.400" Score="1" ViewCount="116" Body="&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Structure section called Competitions that allows users to submit one or more (usually three maximum) entries to judged photo competitions. However, they can only submit one or two if they wish.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Competitions (section)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Competition (parent entry type)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Submission (child entry type)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The Submission entry type's field that the users need to edit are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Image order: a number field that is chosen from a radio button group. The number of buttons in the group corresponds to the number of entries the user has submitted. This is usually max 3. If I have the following order: Image 01, image 02, &amp;amp; image 03, and the user deletes image 02, image 03's order needs to change to 02.&lt;/li&gt;&#xA;&lt;li&gt;Critique image: a ligthswitch field in a single radio button. They can only select one image for critique.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There's also an asset field for an image. This needs to be renamed according to the chosen image order. E.g: 01-compId-dateTime.jpg. I have this part working via a Craft 3 Module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an annotated screenshot to illustrate: &lt;a href=&quot;https://cl.ly/ba29ed3cfc19&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cl.ly/ba29ed3cfc19&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to do this via Javascript (Vue.js), but it breaks when an entry is deleted. In the end, it's just not robust enough, and I prefer having a single save button that sends all form data to the server. Here's that attempt: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/27958/how-can-i-edit-multiple-entries-via-multiple-front-end-forms-using-vue-js&quot;&gt;How can I edit multiple entries via multiple front-end forms using Vue.js?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/8682/how-do-i-create-a-plugin-to-create-and-save-multiple-entries-from-one-front-end&quot;&gt;How do I create a plugin to create and save multiple entries from one front-end form?&lt;/a&gt;, but the answer isn't detailed enough for my current skill level, and it's for Craft 2. Same with this: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/10586/edit-multiple-entries-at-once-through-the-front-end&quot;&gt;Edit multiple entries at once through the front-end&lt;/a&gt;. The answer at &lt;a href=&quot;https://craftcms.stackexchange.com/questions/22749/entry-form-multiple-entries-entry-type-parent&quot;&gt;Entry Form - Multiple Entries &amp;amp; Entry Type &amp;amp; Parent&lt;/a&gt; contains the detail I need, but it's for Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-10-31T23:19:51.400" Title="How can I create a Module/Plugin to edit multiple entries via a single front-end form in Craft 3?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;craft3&gt;&lt;form&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28279" PostTypeId="1" CreationDate="2018-11-01T03:34:29.033" Score="1" ViewCount="21" Body="&lt;p&gt;long time listener, first time caller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having some issues getting localisation setup on my homestead/vagrant craft 2 site. I'm running into issues, I believe, with the craft cache when I try to visit a localised url I have set up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been following the guide &lt;a href=&quot;https://docs.craftcms.com/v2/localization-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but haven't been able to have any luck with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the folder structure in my public folder as follows  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    /public  &#xA;      -index.php  &#xA;      -.htaccess  &#xA;      /es&#xA;        -index.php  &#xA;        -.htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My config/general.php file is like this,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    define('URI_SCHEME', (isset($_SERVER['HTTPS'] ) ) ? &quot;https://&quot; : &#xA;    &quot;http://&quot;);&#xA;    define('SITE_URL',    URI_SCHEME.$_SERVER['SERVER_NAME']);&#xA;    define('BASEPATH',     realpath(dirname(__FILE__) . '/../'));&#xA;&#xA;    return array(&#xA;&#xA;&#xA;    '*' =&amp;gt; array(&#xA;      'appId' =&amp;gt; 'app',&#xA;      'validationKey' =&amp;gt; getenv('VALIDATION_KEY'),&#xA;      'devMode' =&amp;gt; true,&#xA;      'backupDbOnUpdate' =&amp;gt; false,&#xA;      'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;      'siteUrl' =&amp;gt; array(&#xA;         'en' =&amp;gt; 'http://example.test/',&#xA;         'es' =&amp;gt; 'http://example.test/es/'&#xA;      ),&#xA;      'cacheMethod' =&amp;gt; getenv('CACHE_METHOD'),&#xA;&#xA;      'environmentVariables' =&amp;gt; array(&#xA;        'basePath' =&amp;gt; BASEPATH,&#xA;        'siteUrl'  =&amp;gt; SITE_URL&#xA;&#xA;      ),&#xA;     ),&#xA;&#xA;    ),&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My public/es/index.php file is pointing to the correct craft folder and has a &lt;code&gt;define(CRAFT_LOCALE, 'es')&lt;/code&gt;. I'm stuck as how to progress and any pointers or tips are very appreciated&lt;br&gt;&#xA;Heres a screen shot of the actual error on example.test/es&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/f3Nt2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f3Nt2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8970" LastEditorUserId="8970" LastEditDate="2018-11-08T01:18:22.423" LastActivityDate="2018-12-08T21:01:40.313" Title="Craft localisation caching error" Tags="&lt;cache&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28280" PostTypeId="1" CreationDate="2018-11-01T08:28:30.320" Score="1" ViewCount="246" Body="&lt;p&gt;Experiencing a weird issue trying to do a fixed order display of entries.&#xA;I have a bunch (array) of ids for entries I want to show as fixed order then want to append the remainder of relevant entries after (eg if related to a certain category).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this works a charm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elements = craft.entries() %}&#xA;{% set elements = elements.relatedTo( element ) %}&#xA;{% set elements = elements.id( ids ).fixedOrder( true ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But then if i do this to append to the ids array with the remaining entries it resorts to the default sorting order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set elements = craft.entries() %}&#xA;{% set elements = elements.relatedTo( element ) %}&#xA;{% for item in elements if item.id not in ids %}&#xA;    {% set ids = ids|merge([item.id]) %}&#xA;{% endfor %} &#xA;{% set elements = elements.id( ids ).fixedOrder( true ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on why or how best to achieve this (eg return those that are set in order then append remainder)? Anything I am obviously missing in the above example?&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2018-11-01T08:28:30.320" Title="Fixed order query" Tags="&lt;craft3&gt;&lt;sorting&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28281" PostTypeId="1" AcceptedAnswerId="28290" CreationDate="2018-11-01T11:16:43.920" Score="2" ViewCount="192" Body="&lt;p&gt;I am working on a site which has the multisite concept. Each site has its own base URL. The issue is that, if I have logged in to the admin with the primary site and access the preview option for the secondary site in the system then it is showing the cross-domain error in the console of the browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to solve the issue?&lt;/p&gt;&#xA;" OwnerUserId="8973" LastActivityDate="2018-11-02T04:24:32.690" Title="Live preview option not working for multi-site functionality" Tags="&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28282" PostTypeId="1" AcceptedAnswerId="28283" CreationDate="2018-11-01T12:28:46.537" Score="1" ViewCount="39" Body="&lt;p&gt;How can I incorporate the date_modify into the craft.entries query so that the pagination takes into account this criteria? At the moment the limit is also accounting for past entries and I'm hitting errors whatever I try.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate craft.entries.section('events').limit(10).order('date asc') as entries %}&#xA;&#xA;    {% for entry in entries if entry.date &amp;gt; now|date_modify('-1 day')  %}&#xA;&#xA;        ...&#xA;&#xA;    {% endfor %}&#xA;&#xA;&#xA;    {% include &quot;includes/_pagination&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="57" LastEditDate="2018-11-02T04:25:49.747" LastActivityDate="2018-11-02T04:25:49.747" Title="Pagination with if statement date modify" Tags="&lt;datetime&gt;&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28283" PostTypeId="2" ParentId="28282" CreationDate="2018-11-01T13:09:04.347" Score="1" Body="&lt;p&gt;You can add it like every other criteria property&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.date('&amp;gt;' ~ now|date_modify('-1 day')|atom) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-11-01T13:09:04.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28284" PostTypeId="1" AcceptedAnswerId="28288" CreationDate="2018-11-01T17:53:37.900" Score="1" ViewCount="658" Body="&lt;p&gt;In EE, if there was a template &lt;code&gt;/foo/bar.html&lt;/code&gt;, one could access the contents of that template by going to either &lt;code&gt;example.com/foo/bar&lt;/code&gt; or &lt;code&gt;example.com/foo/bar/more/segments/here&lt;/code&gt;. The additional URL segments didn't prevent EE from loading the most-accurately-matching template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving over to Craft, &lt;code&gt;bar&lt;/code&gt; is now an entry's slug. The section for that entry is properly set up with the &quot;Entry URI Format&quot; and &quot;Template&quot; pointing to &lt;code&gt;foo/{slug}&lt;/code&gt; and &lt;code&gt;foo/_entry.html&lt;/code&gt;, respectively. Is there a way to get the same &quot;most-accurate&quot; template-matching behavior in Craft? Perhaps with routes? I would want the &lt;code&gt;{{ entry }}&lt;/code&gt; variable to be automatically available for either URL.&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-11-01T19:05:31.493" Title="Templates, Routes, and URL segments" Tags="&lt;templating&gt;&lt;routes&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28285" PostTypeId="1" CreationDate="2018-11-01T18:24:55.053" Score="3" ViewCount="336" Body="&lt;p&gt;Many shared hosting accounts require custom flags that are passed to sendmail in order for them to work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Craft 3 uses &lt;a href=&quot;https://github.com/swiftmailer/swiftmailer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Swiftmailer&lt;/a&gt; for its mailing library and Swiftmailer's default Sendmail command is &lt;code&gt;/usr/sbin/sendmail -bs&lt;/code&gt; (&lt;a href=&quot;https://github.com/swiftmailer/swiftmailer/blob/master/lib/classes/Swift/Transport/SendmailTransport.php#L30&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/swiftmailer/swiftmailer/blob/master/lib/classes/Swift/Transport/SendmailTransport.php#L30&lt;/a&gt;), is there a way to override that from Craft's &lt;code&gt;config/app.php&lt;/code&gt; to set a custom sendmail command?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-01T18:24:55.053" Title="Can you override the default sendmail path in Sendmail transport config in Craft 3?" Tags="&lt;craft3&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28286" PostTypeId="2" ParentId="28285" CreationDate="2018-11-01T18:24:55.053" Score="3" Body="&lt;p&gt;There are some examples of how to override the mailer component and transport settings in the official Craft docs here: &lt;a href=&quot;https://docs.craftcms.com/v3/config/#mailer-component&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/#mailer-component&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this particular sendmail example, you'd need to do something like this from &lt;code&gt;config/app.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'components' =&amp;gt; [&#xA;    'mailer' =&amp;gt; function() {&#xA;        // Get the stored email settings&#xA;        $settings = Craft::$app-&amp;gt;systemSettings-&amp;gt;getEmailSettings();&#xA;&#xA;        // Override the transport adapter class&#xA;        $settings-&amp;gt;transportType = craft\mail\transportadapters\Sendmail::class;&#xA;&#xA;        // Create a Mailer component config with these settings&#xA;        $config = craft\helpers\App::mailerConfig($settings);&#xA;        $config['transport']['command'] = '/usr/bin/sendmail -customflags';&#xA;&#xA;        // Instantiate and return it&#xA;        return Craft::createObject($config);&#xA;    },&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-01T18:24:55.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28288" PostTypeId="2" ParentId="28284" CreationDate="2018-11-01T18:51:04.040" Score="2" Body="&lt;p&gt;Yes and no. &#xA;Yes it is possible to include as many additional segments to &lt;strong&gt;selected&lt;/strong&gt; routes and it's even possible to achieve what you want but it might become resource heavy and you would need to handle the entire routing on your own.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Channels&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If it's for a channel with a set &lt;code&gt;URI&lt;/code&gt; format like &lt;code&gt;foo/{slug}&lt;/code&gt; you can implement a route like&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    UrlManager::class,&#xA;    UrlManager::EVENT_REGISTER_SITE_URL_RULES,&#xA;    function(RegisterUrlRulesEvent $event) {&#xA;        $event-&amp;gt;rules[] = [&#xA;            'pattern'  =&amp;gt; 'foo/&amp;lt;uri:\S+&amp;gt;/&amp;lt;additionals:\S+&amp;gt;',&#xA;            'route'    =&amp;gt; 'your-module/your-controller/route',&#xA;            'defaults' =&amp;gt; [&#xA;                'additionals' =&amp;gt; ''&#xA;            ]&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all your urls like &lt;code&gt;foo/{slug}&lt;/code&gt; as well as &lt;code&gt;foo/{slug}/bar/whatever&lt;/code&gt;  will be routed to your controller &lt;code&gt;YourController::actionRoute&lt;/code&gt; with the parameters &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionRoute(string $uri, string $additionals = null)&#xA;{&#xA;    $element = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementByUri($uri);&#xA;    $template = (new Query())-&amp;gt;select('template')&#xA;        -&amp;gt;from('sections_sites')&#xA;        -&amp;gt;where(['=', 'siteId', $element-&amp;gt;site-&amp;gt;id])&#xA;        -&amp;gt;andWhere(['=', 'sectionId', $element-&amp;gt;sectionId])&#xA;        -&amp;gt;scalar();&#xA;&#xA;    return $this-&amp;gt;renderTemplate($template, ['entry' =&amp;gt; $element]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; keep in mind this will only work if the &lt;code&gt;uri&lt;/code&gt; format is rather simple like &lt;code&gt;foo/{slug}&lt;/code&gt; it won't really work for things like &lt;code&gt;foo/{author}/{category.id}/{slug}/{title}&lt;/code&gt; you'll need the rule mentioned in &quot;structures&quot; for it&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Singles&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If it's for singles you can do it dynamically &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;try {&#xA;    $uris = (new Query())&#xA;        -&amp;gt;select('uriFormat')&#xA;        -&amp;gt;from('sections_sites')-&#xA;        -&amp;gt;where(['=', 'siteId', Craft::$app-&amp;gt;getSites()-&amp;gt;getCurrentSite()-&amp;gt;id])&#xA;        -&amp;gt;andWhere(['=', 'sectionId', [array of your section ids])&#xA;        -&amp;gt;column();&#xA;} catch (Exception $exception) {&#xA;    $uris = [];&#xA;}&#xA;&#xA;if (empty($uris) === false) {&#xA;    $event-&amp;gt;rules[] = [&#xA;        'pattern'  =&amp;gt; '&amp;lt;uri:(' . implode('|', $uris) . ')&amp;gt;' . '/&amp;lt;additional:\S+&amp;gt;',&#xA;        'route'    =&amp;gt; 'module/controller/action',&#xA;        'defaults' =&amp;gt; [&#xA;            'additional' =&amp;gt; ''&#xA;        ]&#xA;    ];&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Structures&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;For structures it's not that easy... You would need to recursively remove one segment and try to search for a matching route if there is one, use it, otherwise remove the next one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attention pseudocode&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$path = get your full path&#xA;while($element === null){&#xA;    $path = $path - lastSegment;&#xA;    $element = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementByUri($path);&#xA;}  &#xA;// attach the route `path` as you can see above&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I would &lt;strong&gt;not&lt;/strong&gt; suggest the code above since it will search for a matching element for each segment for &lt;strong&gt;every&lt;/strong&gt; request. I would highly recommend to include many conditions around it like &lt;code&gt;Craft::$app-&amp;gt;getRequest()-&amp;gt;isSiteRequest() === true&lt;/code&gt; and &lt;code&gt;$request-&amp;gt;isAjaxRequest() === false&lt;/code&gt; and so on to reduce the amount of queries as much as possible&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-11-01T19:05:31.493" LastActivityDate="2018-11-01T19:05:31.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28289" PostTypeId="1" CreationDate="2018-11-01T19:02:41.317" Score="0" ViewCount="129" Body="&lt;p&gt;I used &lt;a href=&quot;https://craftcms.stackexchange.com/questions/4650/any-working-rss-feed-examples-out-there&quot;&gt;this&lt;/a&gt; example to create an RSS feed in Craft, saved it as “feed.rss”, uploaded it into the “craft/templates” directory. When I go to www.my-website.com/rss, I get a 404. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here? Any help is highly appretiated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6995" LastActivityDate="2018-11-02T19:01:43.490" Title="RSS throwing 404 error" Tags="&lt;error&gt;&lt;404&gt;&lt;rss&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28290" PostTypeId="2" ParentId="28281" CreationDate="2018-11-02T04:24:32.690" Score="2" Body="&lt;p&gt;Essentially you're looking for this feature request: &lt;a href=&quot;https://github.com/craftcms/cms/issues/1160&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1160&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That has been resolved in &lt;a href=&quot;https://github.com/craftcms/cms/commit/1ab6b6e6e3cd5a13c949d113c8367e7faf930ee4&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/1ab6b6e6e3cd5a13c949d113c8367e7faf930ee4&lt;/a&gt; which will be released in Craft 3.1.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-02T04:24:32.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28291" PostTypeId="2" ParentId="28289" CreationDate="2018-11-02T09:00:30.187" Score="1" Body="&lt;p&gt;You have named the file &lt;code&gt;feed.rss&lt;/code&gt;, and you are trying to access it by going to &lt;code&gt;/rss&lt;/code&gt;. So I can see two issues here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The template file needs to be either &lt;code&gt;.html&lt;/code&gt; or &lt;code&gt;.twig&lt;/code&gt;, as per the&#xA;tutorial you have referenced&lt;/li&gt;&#xA;&lt;li&gt;The name of the template file will dictate the URL for that template. If you re-name your template file to &lt;code&gt;feed.twig&lt;/code&gt;, you access that template by going to &lt;code&gt;/feed&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="344" LastActivityDate="2018-11-02T09:00:30.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28293" PostTypeId="1" CreationDate="2018-11-02T12:54:20.917" Score="2" ViewCount="1348" Body="&lt;p&gt;I am going to do an internship in February where they work with Craft CMS and thus I am going to learn it at home with XAMPP ( localhost). However I've installed it and now it will simply give me the following error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;D:\xampp\htdocs/storage doesn't exist or isn't writable by PHP. Please fix that.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have tried to remove the &quot;read-only &quot;. Everything is on full control through the security tab. I got no clue how to &quot;allow&quot; this to write.&lt;/p&gt;&#xA;" OwnerUserId="8980" LastEditorUserId="57" LastEditDate="2018-11-02T21:59:58.963" LastActivityDate="2019-01-01T22:01:40.760" Title="Craft CMS 3 storage doesn't exist or isn't writable by PHP" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28294" PostTypeId="2" ParentId="13756" CreationDate="2018-11-02T15:32:09.490" Score="4" Body="&lt;p&gt;There is a plugin called 'Transcoder' But it's not free:&#xA;&lt;a href=&quot;https://github.com/nystudio107/craft-transcoder/blob/v1/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-transcoder/blob/v1/README.md&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8981" LastActivityDate="2018-11-02T15:32:09.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28295" PostTypeId="1" AcceptedAnswerId="28300" CreationDate="2018-11-02T16:41:57.393" Score="1" ViewCount="188" Body="&lt;p&gt;I have a plugin installed from a well known Craft developer. I have made significant tweaks and changes to the plugin and need to prevent it from updating. Is there an easy line of code to add to the composer.json file to prevent it from updating? I may have to go the route of breaking it out into our my plugin but for time reasons I am looking for simple ways to prevent updating.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-11-02T22:04:33.957" Title="How to Prevent Composer from Updating Plugin?" Tags="&lt;plugins&gt;&lt;composer&gt;&lt;auto-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28296" PostTypeId="1" AcceptedAnswerId="28298" CreationDate="2018-11-02T16:45:14.520" Score="1" ViewCount="1314" Body="&lt;p&gt;Trying to ajax add to cart but each submit returns a &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://www.website.com/commerce/cart/updateCart 404 (Not Found)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have this in my twig template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for book in craft.products().type('books').limit(8).all() %}&#xA;&amp;lt;a href=&quot;{{ book.url }}&quot; class=&quot;book&quot;&amp;gt;&#xA;    {% for image in book.productImages.limit(1).all() %}&#xA;    &amp;lt;div class=&quot;b-img&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; /&amp;gt;&#xA;        &amp;lt;div class=&quot;hover-cart&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;success&quot;&amp;gt;&amp;lt;i class=&quot;fas fa-check-circle&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&#xA;            {% set variant = book.defaultVariant %}&#xA;            &amp;lt;form method=&quot;POST&quot; class=&quot;add-to-cart&quot;&amp;gt;&#xA;                {{ csrfInput() }}&#xA;                &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ variant.id }}&quot;&amp;gt;&#xA;                &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;                &amp;lt;button type=&quot;submit&quot;&amp;gt;&amp;lt;i class=&quot;fas fa-shopping-cart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;            &amp;lt;/form&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;h3&amp;gt;{{ book.title }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;span class=&quot;price&quot;&amp;gt;{{ book.defaultVariant.price|currency }}&amp;lt;/span&amp;gt;&#xA;&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this as my javascript:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.add-to-cart').on('submit', function(e) {&#xA;    console.log('add to cart clicked');&#xA;    e.preventDefault();&#xA;    var form_data = $(this).serializeArray();&#xA;    console.log(form_data);&#xA;    $.ajax({&#xA;        type: 'post',&#xA;        url: 'commerce/cart/updateCart',&#xA;        data: form_data,&#xA;        success: function(response) {&#xA;            if (response.success) {&#xA;                console.log('success');&#xA;                console.log(response.success);&#xA;                $(this).hide();&#xA;                $(this).siblings('.success').show();&#xA;                $(this).parents('.hover-cart').fadeOut();&#xA;            }&#xA;            else {&#xA;                console.log('error');&#xA;                console.log(response.success);&#xA;                alert(&quot;We're sorry, but the item couldn't be added to your cart. Please try again. If the issue persists, please send an email to webmaster@lwf.org&quot;);&#xA;            }&#xA;        }&#xA;    });        &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-11-02T23:37:54.713" Title="Craft Commerce 2 Ajax Add to Cart" Tags="&lt;plugin-craftcommerce&gt;&lt;form&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28298" PostTypeId="2" ParentId="28296" CreationDate="2018-11-02T19:07:21.737" Score="3" Body="&lt;p&gt;Controllers in Craft 3/Commerce 2 use kebab-case (&lt;code&gt;update-cart&lt;/code&gt;) instead of camelCase (&lt;code&gt;updateCate&lt;/code&gt;), so adjusting that may correct your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The common convention for forms processed by Craft controllers is to leave the &lt;code&gt;action&lt;/code&gt; attribute blank and include a hidden input with the action URL value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, you can do that by adding an &lt;code&gt;action&lt;/code&gt; param to your &lt;code&gt;form_data&lt;/code&gt; variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var form_data = $(this).serializeArray();&#xA;// Add the action URL to the submitted data&#xA;form_data['action'] = 'commerce/cart/update-cart'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'd leave the &lt;code&gt;url&lt;/code&gt; param on your Ajax request blank. The updated code would look something like this if you add the action in your script.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('.add-to-cart').on('submit', function(e) {&#xA;    console.log('add to cart clicked');&#xA;    e.preventDefault();&#xA;    var form_data = $(this).serializeArray();&#xA;    // Add the action URL to the submitted data&#xA;    form_data['action'] = 'commerce/cart/update-cart'&#xA;    console.log(form_data);&#xA;    $.ajax({&#xA;        type: 'post',&#xA;        url: '',&#xA;        data: form_data,&#xA;        dataType: 'json',&#xA;        success: function(response) {&#xA;            if (response.success) {&#xA;                console.log('success');&#xA;                console.log(response.success);&#xA;                $(this).hide();&#xA;                $(this).siblings('.success').show();&#xA;                $(this).parents('.hover-cart').fadeOut();&#xA;            }&#xA;            else {&#xA;                console.log('error');&#xA;                console.log(response.success);&#xA;                alert(&quot;We're sorry, but the item couldn't be added to your cart. Please try again. If the issue persists, please send an email to webmaster@lwf.org&quot;);&#xA;            }&#xA;        }&#xA;    });        &#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or the snippet below if you want to add the action to your Twig template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;POST&quot; class=&quot;add-to-cart&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    {# Include the controller used to process the form  #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/update-cart&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;purchasableId&quot; value=&quot;{{ variant.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;number&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;&amp;lt;i class=&quot;fas fa-shopping-cart&quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use the Twig code above, make sure you update the &lt;code&gt;url&lt;/code&gt; property of your Ajax request to remove the existing URL.&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="340" LastEditDate="2018-11-02T23:37:54.713" LastActivityDate="2018-11-02T23:37:54.713" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28299" PostTypeId="2" ParentId="28293" CreationDate="2018-11-02T21:59:48.997" Score="1" Body="&lt;p&gt;I'm on Windows 10, so if you're on another version of Windows, things might be slightly different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you right click on that &quot;storage&quot; folder, go to Properties, click the &quot;Security&quot; tab, click &quot;Edit&quot;, click &quot;Add&quot;, type &quot;Everyone&quot;, then click &quot;Check Names&quot; so it finds the user (an underline will show up under it), click &quot;OK&quot;, make sure &quot;Everyone&quot; is selected, then check the &quot;Full control&quot; checkbox under permissions, click &quot;OK&quot;, then &quot;OK&quot; to close the final modal, that will give everyone access to write to that folder (including PHP/Craft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, don't do this on production, but since you're on a local box you should be fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-02T21:59:48.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28300" PostTypeId="2" ParentId="28295" CreationDate="2018-11-02T22:04:33.957" Score="2" Body="&lt;p&gt;If you have version 1.2.3 of the plugin installed and you don't want to Composer to update past that version, you'd just modify your &lt;code&gt;composer.json&lt;/code&gt; file so it's locked to that exact version.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;require&quot;: {&#xA;    &quot;plugindeveloper/pluginhandle&quot;: &quot;1.2.3&quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-02T22:04:33.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28301" PostTypeId="2" ParentId="28202" CreationDate="2018-11-02T22:10:05.297" Score="2" Body="&lt;p&gt;When you first load the template using the &lt;code&gt;{% cache %}&lt;/code&gt; tags, the number of queries will likely be higher because it still has to retrieve the correct data from the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subsequent loads of that template should show a lower amount of queries because it's returning actual cached content at that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing will happen once the cache is busted from expiration on the next template load as well.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-02T22:10:05.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28302" PostTypeId="1" AcceptedAnswerId="28303" CreationDate="2018-11-02T22:42:05.000" Score="1" ViewCount="33" Body="&lt;p&gt;I recently put together a basic &lt;a href=&quot;https://github.com/madebyraygun/constant-contact&quot; rel=&quot;nofollow noreferrer&quot;&gt;Constant Contact plugin&lt;/a&gt; for a project, and I'd like to clean it up and improve it for a public release. The problem is that it requires a development version of the Constant Contact SDK for compatibility with PHP 7+. I did this by adding a custom repository to the composer.json file pointing to the github repo, and then requiring the development branch. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;repositories&quot;: [&#xA;  {&#xA;    &quot;type&quot;: &quot;git&quot;,&#xA;    &quot;url&quot;: &quot;https://github.com/constantcontact/php-sdk.git&quot;&#xA;  }&#xA;],&#xA;&quot;require&quot;: {&#xA;  &quot;craftcms/cms&quot;: &quot;^3.0.0-RC1&quot;,&#xA;  &quot;constantcontact/constantcontact&quot;: &quot;dev-development&quot;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order for this to work, I had to change the stability requirements in my main composer.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;minimum-stability&quot;: &quot;dev&quot;,&#xA;&quot;prefer-stable&quot; : true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems to me this would not be ideal for a plugin in the Plugin Store. Is packaging all of the dependencies up into a vendor subfolder within the project a better option?&lt;/p&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="5589" LastEditDate="2018-11-02T22:47:20.190" LastActivityDate="2018-11-02T23:07:24.710" Title="Can plugins in the Plugin Store require development versions of libraries via Composer?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28303" PostTypeId="2" ParentId="28302" CreationDate="2018-11-02T23:07:24.710" Score="1" Body="&lt;p&gt;Currently the Plugin Store requires non-development dependencies in your &lt;code&gt;composer.json&lt;/code&gt; file.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-02T23:07:24.710" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28304" PostTypeId="2" ParentId="27934" CreationDate="2018-11-03T01:46:04.563" Score="1" Body="&lt;p&gt;I solved this by creating a simple plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\db\Query;&#xA;&#xA;class MyPluginVariable&#xA;{&#xA;      public function allActivelySubscribedUserIds()&#xA;      {&#xA;           $subscribedUserIds = (new Query())&#xA;                -&amp;gt;select('userId')&#xA;                -&amp;gt;from(['{{%commerce_subscriptions}}'])&#xA;                -&amp;gt;distinct()&#xA;                -&amp;gt;all();&#xA;&#xA;            // Create array of just user IDs&#xA;            $subscribedUserIds = array_column($subscribedUserIds, 'userId');&#xA;&#xA;            return $subscribedUserIds;&#xA;       }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I my case I needed to display all entries authored by users that are currently subscribed. In my template I used the variable like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set subscribedUserIds = craft.MyPlugin.allActivelySubscribedUserIds %}&#xA;&#xA;{% set entries = craft.entries()&#xA;    .authorId(subscribedUserIds)&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastActivityDate="2018-11-03T01:46:04.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28305" PostTypeId="1" AcceptedAnswerId="28306" CreationDate="2018-11-03T18:45:25.470" Score="2" ViewCount="67" Body="&lt;p&gt;I am trying to get a value of a text field that is in a Section which is a &lt;em&gt;structure&lt;/em&gt; and has multiple entry types. I don't want to use a loop. I tried this and some other variations but does not give me the correct value.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set value = craft.entries.section('mySectionHandle').type('entryTypeHandle').myTextFieldHandle.first() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the correct syntax? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4815" LastActivityDate="2018-11-03T20:57:13.570" Title="How to directly get value of text field in a given section of type structure?" Tags="&lt;templating&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28306" PostTypeId="2" ParentId="28305" CreationDate="2018-11-03T20:57:13.570" Score="3" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set value = craft.entries.section('mySectionHandle').type('entryTypeHandle').first().myTextFieldHandle %}&#xA;&#xA;{{ value }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just with your field handle at the end&lt;/p&gt;&#xA;" OwnerUserId="522" LastActivityDate="2018-11-03T20:57:13.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28307" PostTypeId="1" CreationDate="2018-11-03T22:39:40.643" Score="1" ViewCount="97" Body="&lt;p&gt;For some of the extremely static content on my site, I use caching to prevent multiple db queries during every single load. I also have multiple locale on my site with custom cache key names. The actual execution of cache is running perfectly at the moment on all the locales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I make changes to any entry which has cache enabled, I get &lt;em&gt;stale template delete failed&lt;/em&gt; error. When I take look at the actual MySQL table, I see that the requisite cache row is deleted from the table upon making changes to an entry. So I don't quite understand why this error shows up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a typical cache directive I used in my templates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% cache globally using key  &quot;www-features&quot; for 24 hours %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I look at the runtime logs, I see following error which I am assuming it to be associated with this problem&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2018/11/03 19:10:42 [error] [application] Encountered an error running task 17 (DeleteStaleTemplateCaches), step 13 of 29: An exception was thrown: &#xA;  CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'dateCreated' in order clause is ambiguous. &#xA;  The SQL statement executed was: &#xA;  SELECT &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;sectionId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;typeId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;authorId&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;postDate&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;.&lt;code&gt;expiryDate&lt;/code&gt;&#xA;  FROM &lt;code&gt;craft_elements&lt;/code&gt; &lt;code&gt;elements&lt;/code&gt;&#xA;  JOIN &lt;code&gt;craft_elements_i18n&lt;/code&gt; &lt;code&gt;elements_i18n&lt;/code&gt; ON elements_i18n.elementId = elements.id&#xA;  JOIN &lt;code&gt;craft_content&lt;/code&gt; &lt;code&gt;content&lt;/code&gt; ON content.elementId = elements.id&#xA;  JOIN &lt;code&gt;craft_entries&lt;/code&gt; &lt;code&gt;entries&lt;/code&gt; ON entries.id = elements.id&#xA;  JOIN &lt;code&gt;craft_sections&lt;/code&gt; &lt;code&gt;sections&lt;/code&gt; ON sections.id = entries.sectionId&#xA;  LEFT JOIN &lt;code&gt;craft_structures&lt;/code&gt; &lt;code&gt;structures&lt;/code&gt; ON structures.id = sections.structureId&#xA;  LEFT JOIN &lt;code&gt;craft_structureelements&lt;/code&gt; &lt;code&gt;structureelements&lt;/code&gt; ON (structureelements.structureId = structures.id) AND (structureelements.elementId = entries.id)&#xA;  WHERE ((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements_i18n.enabled = 1)) AND (&lt;code&gt;sections&lt;/code&gt;.&lt;code&gt;handle&lt;/code&gt; IN ('policies'))&#xA;  GROUP BY &lt;code&gt;elements&lt;/code&gt;.&lt;code&gt;id&lt;/code&gt;&#xA;  ORDER BY &lt;code&gt;dateCreated&lt;/code&gt;. Bound with :locale='en_us'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looks like you have &lt;code&gt;dateCreated&lt;/code&gt; field in multiple tables used in the join and the statement is not explicitly defining the identity of the table ???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to fix this?&lt;/p&gt;&#xA;" OwnerUserId="4815" LastEditorUserId="45" LastEditDate="2018-11-04T03:47:49.447" LastActivityDate="2018-11-04T03:47:49.447" Title="Failed Stale Template Cache Delete Error...Analyzed...But No Answer" Tags="&lt;templating&gt;&lt;cache&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28308" PostTypeId="2" ParentId="28307" CreationDate="2018-11-03T22:54:29.333" Score="2" Body="&lt;p&gt;OK, I found the answer to this. Here is the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/17458/failed-task-and-various-errors-in-logs&quot;&gt;correct answer.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically change &lt;code&gt;dateCreated&lt;/code&gt; to &lt;code&gt;elements.dateCreated&lt;/code&gt; in my template.&lt;/p&gt;&#xA;" OwnerUserId="4815" LastActivityDate="2018-11-03T22:54:29.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28309" PostTypeId="2" ParentId="21171" CreationDate="2018-11-03T23:04:39.480" Score="1" Body="&lt;p&gt;You might also need to add something like this for your actions pages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;location ^~ /actions/users/setpassword {&#xA;    try_files $uri $uri/ @phpfpm_nocache;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5868" LastActivityDate="2018-11-03T23:04:39.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28310" PostTypeId="2" ParentId="19473" CreationDate="2018-11-04T11:04:51.997" Score="2" Body="&lt;p&gt;I believe you can always simply use &lt;code&gt;product.defaultVariant.salePrice&lt;/code&gt; as this will be set to equal &lt;code&gt;product.defaultVariant.price&lt;/code&gt; if there is no sale applied.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-11-04T11:04:51.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28311" PostTypeId="1" CreationDate="2018-11-04T18:50:47.013" Score="3" ViewCount="1179" Body="&lt;p&gt;I have a service called &lt;code&gt;useTR.php&lt;/code&gt;. It has a public method &lt;code&gt;exampleService()&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the variables folder I have added the following code in my &lt;code&gt;KGVariable.php&lt;/code&gt; (KG is my plugin name)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function sayHello() {&#xA;    return craft()-&amp;gt;useTR-&amp;gt;exampleService();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my templates folder I have an html that gets loaded after a form submission and that html has the following code. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Thank you {{ craft.KG.sayHello() }} will contact you soon&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When this HTML is loaded, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Twig Runtime Error – Twig_Error_Runtime&#xA;  Calling unknown method: craft\web\twig\variables\CraftVariable::keyword()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? Kindly help (I am a beginner at Craft). Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8983" LastEditorUserId="57" LastEditDate="2018-11-05T20:04:40.703" LastActivityDate="2019-01-04T21:01:40.333" Title="Plugin service and variable" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28312" PostTypeId="1" CreationDate="2018-11-05T06:51:16.893" Score="3" ViewCount="520" Body="&lt;p&gt;I've been pulling my head for the past day on how to filter products with multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a long search, I found and implemented on my project, &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19256/advanced-search-with-tags-and-categories&quot;&gt;Advanced Search with tags and categories&lt;/a&gt;&#xA;It worked on single selection, but when I modified it for multiple categories selection I was not getting any result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I pass through multiple values with Sort options? Here's what I have so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&quot;&quot; method=&quot;get&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;search&quot; name=&quot;query&quot; placeholder=&quot;Search Products&quot; style=&quot;width: 100%;&quot;&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;brand[]&quot; multiple&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot; selected&amp;gt;All Brands&amp;lt;/option&amp;gt;&#xA;    {% set brands = craft.categories.group('brand') %}&#xA;    {% for supplier in brands %}&#xA;        &amp;lt;option value=&quot;{{ supplier.slug }}&quot;&amp;gt;{{ supplier.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;size[]&quot; multiple&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot; selected&amp;gt;All Sizes&amp;lt;/option&amp;gt;&#xA;    {% set sizes = craft.categories.group('size') %}&#xA;    {% for product in sizes %}&#xA;        &amp;lt;option value=&quot;{{ product.slug }}&quot;&amp;gt;{{ product.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;select name=&quot;tag[]&quot; multiple&amp;gt;&#xA;    &amp;lt;option value=&quot;&quot;&amp;gt;All Applications&amp;lt;/option&amp;gt;&#xA;    {% set tags = craft.tags %}&#xA;    {% for delivery in tags %}&#xA;        &amp;lt;option value=&quot;{{ delivery.slug }}&quot;&amp;gt;{{ delivery.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Apply&quot;&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set query = craft.request.getParam('q') %}&#xA;{% set brand = craft.request.getParam('brand') %}&#xA;{% set size = craft.request.getParam('size') %}&#xA;{% set tag = craft.request.getParam('tag') %}&#xA;&#xA;{% set brandCat = brand ? craft.categories.group('brand').slug(brand).all() %}&#xA;{% set sizeCat = size ? craft.categories.group('size').slug(size).all() %}&#xA;{% set tagCat = craft.tags.slug(tag).all() %}&#xA;&#xA;&#xA;{% set brandParam = brandCat ? {targetElement: ['and']|merge(brandCat)} %}&#xA;{% set sizeParam = sizeCat ? {targetElement:['and']|merge(sizeCat) } %}&#xA;{% set tagParam = tagCat ? {targetElement: ['and']|merge(tagCat)} %}&#xA;&#xA;{% set relationParams = [brandParam, sizeParam, tagParam]|filter %}&#xA;&#xA;{% set productResults = craft.products({&#xA;    type: 'buildingMaterials',&#xA;    relatedTo: relationParams ? ['and']|merge(relationParams) : null,&#xA;    search: query&#xA;}) %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sort Options&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;% set sortOptions = [&#xA;    {&#xA;        label: 'Newest',&#xA;        value: 'postDate desc'&#xA;    },&#xA;    {&#xA;        label: 'Highest Rates',&#xA;        value: 'score desc'&#xA;    },&#xA;    {&#xA;        label: 'Price Low-High',&#xA;        value: 'defaultPrice'&#xA;    },&#xA;    {&#xA;        label: 'Price High-Low',&#xA;        value: 'defaultPrice desc'&#xA;    },&#xA;] %}&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;sortSelect&quot; class=&quot;form-group&quot;&amp;gt;&#xA;&amp;lt;select class=&quot;selectpicker show-tick form-control&quot; data-name=&quot;Sort&quot; id=&quot;sortQuery&quot;&#xA;        name=&quot;Sort&quot; title=&quot;Sort By:&quot;&amp;gt;&#xA;    {% for sortOption in sortOptions %}&#xA;        &amp;lt;option value=&quot;{{ sortOption.value }}&quot; {{ sortOption.value == selectedSortOption ? 'selected' }}&amp;gt;&#xA;            {{ sortOption.label }}&#xA;        &amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% set orderJs %}&#xA;    $(function(){&#xA;    $('#sortQuery').on(&quot;change&quot;, function(e){&#xA;    // Get the value from the select&#xA;    var filter = $(this).val();&#xA;    location.href = location.origin + location.pathname + '?order=' + filter;&#xA;    });&#xA;    })&#xA;{% endset %}&#xA;    {% js orderJs %}&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Get Entries&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% paginate productResults.orderBy(selectedSortOption).limit(12).with([&#xA;    'productImageGallery:image',&#xA;    'url:url',&#xA;    'title',&#xA;    'type:type',&#xA;    'defaultPrice',&#xA;    'productSummary|stiptags'&#xA;]) as pageInfo, products %}&#xA;&#xA;{% for product in products %}&#xA;...&#xA;{% endfor %}&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pagination&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if pageInfo.prevUrl %}&#xA;&amp;lt;li class=&quot;page-item&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;page-link prev&quot; href=&quot;{{ pageInfo.prevUrl }}?orderBy={{ selectedSortOption }}&quot;&amp;gt;&#xA;        &amp;lt;span class=&quot;fa fa-angle-left&quot;&amp;gt;&amp;lt;/span&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&#xA;{% endif %}&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="8987" LastEditorUserId="8987" LastEditDate="2018-11-05T22:53:41.233" LastActivityDate="2018-11-05T22:53:41.233" Title="Searching for Multiple Categories and Tags" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;relations&gt;&lt;search&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28313" PostTypeId="1" CreationDate="2018-11-05T08:02:23.900" Score="1" ViewCount="57" Body="&lt;p&gt;I have a content site and I want to launch a department store, but I have over 5000 products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to launch a department store with Craft CMS; of course, my blog's section is WordPress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="8988" LastEditorUserId="57" LastEditDate="2018-11-05T20:07:10.990" LastActivityDate="2018-12-01T11:37:26.980" Title="Craft Commerce with WordPress" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28314" PostTypeId="2" ParentId="28313" CreationDate="2018-11-05T09:03:58.010" Score="1" Body="&lt;p&gt;Yes it's possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're kind of making more work for yourself by keeping the blog on one platform and the store on another but there is no reason you can't do it that way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to run the blog and the store on separate domains i.e. &lt;code&gt;www.yoursite.com&lt;/code&gt; and &lt;code&gt;shop.yoursite.com&lt;/code&gt; or else move the blog over to Craft (or run your store on Wordpress).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be extra challenges involved if you want to share data between the 2 sites - because they will effectively be 2 separate websites. But again, totally possible with the right planning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce will cope fine with 5000 products.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-11-05T09:03:58.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28315" PostTypeId="2" ParentId="14511" CreationDate="2018-11-05T12:32:04.293" Score="1" Body="&lt;p&gt;Thanks for this it helped a lot! I am using grunt-assets-versioning and took me some time to get it to work properly, so let me share my approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So grunt-assets-versioning creates the file &lt;strong&gt;/public/css/app.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{&#xA;  &quot;version&quot;:&quot;b2ff9f&quot;,&#xA;  &quot;originalPath&quot;:&quot;public/css/app.css&quot;,&#xA;  &quot;versionedPath&quot;:&quot;public/css/app.b2ff9f.css&quot;&#xA; }]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The trick is to use @json_decode(path, &lt;strong&gt;true&lt;/strong&gt;) , so add this to your general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$appCSS = @json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'].'/css/app.json'), true) ?: [];&#xA;&#xA;return array(&#xA;    ...&#xA;    'appCSS' =&amp;gt; str_replace('public', '', $appCSS[0]['versionedPath'])&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove the word 'public' so the final path will be &quot;/css/app.b2ff9f.css&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can call the file from your template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;{{ craft.config.vendorCSS ?? '/css/vendor.css' }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5873" LastActivityDate="2018-11-05T12:32:04.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28318" PostTypeId="2" ParentId="27940" CreationDate="2018-11-05T15:57:56.730" Score="1" Body="&lt;p&gt;I did the same thing, had to create a custom plugin, try checking out this thread i made awhile back might give you a little insight on how to go about doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/27021/entry-tracker-to-see-who-has-completed-the-course&quot;&gt;Entry Tracker to see who has completed the course&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-11-05T15:57:56.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28319" PostTypeId="2" ParentId="14511" CreationDate="2018-11-05T17:49:57.500" Score="1" Body="&lt;p&gt;So while this is not a direct answer the the questions asked here, I think these resources (which weren't written at the time of the posted question) might be useful to someone else in the same situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re: using Gulp with Craft:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/a-better-package-json-for-the-frontend&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Better package.json for the Frontend&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/a-gulp-workflow-for-frontend-development-automation&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Gulp Workflow for Frontend Development Automation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you're interested in using a modern webpack setup to for the same:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Annotated webpack 4 Config for Frontend Web Development&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nystudio107/craft-twigpack&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twigpack plugin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-05T17:49:57.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28320" PostTypeId="2" ParentId="28311" CreationDate="2018-11-05T20:04:22.410" Score="1" Body="&lt;p&gt;There's a lot going on here, but a) assuming you're really using Craft 3 and b) you generated your plugin, service and variable scaffolding on &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io&lt;/a&gt;, this should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;KGVariable.php&lt;/code&gt; Variable&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace kg\variables;&#xA;&#xA;class KGVariable&#xA;{&#xA;    public function sayHello()&#xA;    {&#xA;        return \kg\KG::$plugin-&amp;gt;useTR-&amp;gt;exampleService();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;UseTR.php&lt;/code&gt; Service&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace kg\services;&#xA;&#xA;use craft\base\Component;&#xA;&#xA;class UseTR extends Component&#xA;{&#xA;    public function exampleService()&#xA;    {&#xA;        $result = 'hello';&#xA;        return $result;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then using this in a template will return &lt;code&gt;hello&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.kG.sayHello() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-05T20:04:22.410" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28321" PostTypeId="2" ParentId="17414" CreationDate="2018-11-05T22:05:01.417" Score="6" Body="&lt;p&gt;In Craft 3 / Guest Entries 2, you could pull this off without hacking Guest Entries by writing  a &lt;a href=&quot;https://docs.craftcms.com/v3/extend/module-guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;module&lt;/a&gt; that listens to the &lt;a href=&quot;https://github.com/craftcms/guest-entries#the-beforesaveentry-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;beforeSaveEntry&lt;/a&gt; event, and sets the &lt;code&gt;id&lt;/code&gt; on the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\elements\Entry;&#xA;use craft\guestentries\controllers\SaveController;&#xA;use craft\guestentries\events\SaveEvent;&#xA;use yii\base\Event;&#xA;use yii\web\BadRequestHttpException;&#xA;&#xA;// ...&#xA;&#xA;public function init()&#xA;{&#xA;    // ...&#xA;&#xA;    Event::on(SaveController::class, SaveController::EVENT_BEFORE_SAVE_ENTRY, function(SaveEvent $event) {&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;&#xA;        // Get the entry being edited&#xA;        $entryId = $request-&amp;gt;getValidatedBodyParam('entryId');&#xA;        $currentEntry = Entry::find()-&amp;gt;id($entryId)-&amp;gt;anyStatus()-&amp;gt;one();&#xA;&#xA;        if (!$currentEntry) {&#xA;            throw new BadRequestHttpException('Invalid entry ID: ' . $entryId);&#xA;        }&#xA;&#xA;        // Populate the guest submission with the entry ID, UID, and content ID&#xA;        $event-&amp;gt;entry-&amp;gt;id = $currentEntry-&amp;gt;id;&#xA;        $event-&amp;gt;entry-&amp;gt;uid = $currentEntry-&amp;gt;uid;&#xA;        $event-&amp;gt;entry-&amp;gt;contentId = $currentEntry-&amp;gt;contentId;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your form, add an &lt;code&gt;entryId&lt;/code&gt; input set to the hashed entry ID.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It’s important that you hash the entry ID and use &lt;code&gt;getValidatedBodyParam()&lt;/code&gt; instead of &lt;code&gt;getBodyParam()&lt;/code&gt; so users can’t repurpose the form to edit &lt;em&gt;any&lt;/em&gt; entry on your site.&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-06-20T17:12:11.363" LastActivityDate="2019-06-20T17:12:11.363" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28324" PostTypeId="1" AcceptedAnswerId="28329" CreationDate="2018-11-06T10:47:03.707" Score="1" ViewCount="219" Body="&lt;p&gt;I currently have auto-generated titles that contains accents and so does the slugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the slug is used to generate assets folders, accents aren't suitable and results in question marks in the folder names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping that limitAutoSlugsToAscii would answer this problem but it only affects the javascript for dynamically generated slugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple way to achieve this ?&lt;/p&gt;&#xA;" OwnerUserId="5311" LastActivityDate="2018-11-06T18:34:33.010" Title="Limit slugs to ASCII for auto-generated titles" Tags="&lt;craft3&gt;&lt;slug&gt;&lt;titles&gt;&lt;auto-generate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28325" PostTypeId="1" AcceptedAnswerId="28348" CreationDate="2018-11-06T12:31:46.390" Score="2" ViewCount="238" Body="&lt;p&gt;Using Solspace Freeform, I am trying to hardcode a radio gorup and its options in to a template. My effort is below but its not working&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get the radio group field #}&#xA;{% set interestedIn = form.get(&quot;interestedIn&quot;) %}&#xA;{# Loop through the radio options #}                        &#xA;{% for option in interestedIn %}&#xA;&amp;lt;input type=&quot;radio&quot; id=&quot;form-input-{{ interestedIn.handle }}&quot; name=&quot;{{ interestedIn.handle }}&quot; value=&quot;email&quot;&amp;gt;&#xA;&amp;lt;label for=&quot;form-input-{{ interestedIn.handle }}&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-11-07T22:43:03.493" Title="Solspace Freeform: Looping through Radio group options in template" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28326" PostTypeId="1" AcceptedAnswerId="28337" CreationDate="2018-11-06T13:44:47.090" Score="1" ViewCount="1244" Body="&lt;p&gt;I am using Craft in headless mode with the CraftQL plugin. My front end is built using Gatsby JS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to query entries and output the data to my templates, however Global fields are not available. Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// gatsby-config.js&#xA;plugins: [&#xA;  {&#xA;        resolve: `gatsby-source-craftcms`,&#xA;        options: {&#xA;            endpoint: `http://cms.local/api`,&#xA;            token: `REDACTED`,&#xA;            query: `{&#xA;                globals: globals {&#xA;                    contact {&#xA;                        address&#xA;                    }&#xA;                },&#xA;                home: entries(section:[home]) {&#xA;                    id&#xA;                    title&#xA;                    ... on Home {&#xA;                        subHeading&#xA;                        intro&#xA;                        ctaButton {&#xA;                            ... on CtaButtonButton {&#xA;                                __typename&#xA;                                text&#xA;                                linkUrl&#xA;                            }&#xA;                        }&#xA;                    }&#xA;                },&#xA;// etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;export const query = graphql`&#xA;  query {&#xA;    home {&#xA;        title&#xA;        subHeading&#xA;        intro&#xA;        ctaButton {&#xA;            text&#xA;            linkUrl&#xA;        }&#xA;    }&#xA;    globals {&#xA;        contact {&#xA;            address&#xA;        }&#xA;    }&#xA;  }&#xA;`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my console I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error  Cannot query field &quot;globals&quot; on type &quot;Query&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;code&gt;globals&lt;/code&gt; from the query I can successfully build and output &lt;code&gt;data.home.title&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using the CraftQL browser in the CMS and I can successfully query globals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/chjTo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/chjTo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confident I'm missing something but can find nothing in the docs for &lt;a href=&quot;https://github.com/gusnips/gatsby-source-craftcms/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gatsby-Source-Craft&lt;/a&gt; or &lt;a href=&quot;https://github.com/markhuot/craftql&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftQL&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea what I'm doing wrong here??&lt;/p&gt;&#xA;" OwnerUserId="4618" LastEditorUserId="4618" LastEditDate="2018-11-06T16:03:45.110" LastActivityDate="2018-11-07T10:06:59.537" Title="Querying Global fields using CraftQL and Gatsby JS" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28327" PostTypeId="2" ParentId="28326" CreationDate="2018-11-06T16:00:11.500" Score="1" Body="&lt;p&gt;In looking at this, the first thing I notice is that your query has a field called &lt;code&gt;globals&lt;/code&gt;, but your error has the singular &lt;code&gt;global&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you open Gatsby’s GraphiQL instance (&lt;code&gt;http://localhost/8000/___graphql&lt;/code&gt; in develop mode), can you see the Craft CMS data in the docs? That might help zero in on the query to use in Gatsby.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="8992" LastActivityDate="2018-11-06T16:00:11.500" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28328" PostTypeId="2" ParentId="24233" CreationDate="2018-11-06T18:32:13.133" Score="2" Body="&lt;p&gt;For anyone else trying this: the solution I eventually came up for was to follow &lt;a href=&quot;https://devcenter.heroku.com/articles/php-logging#adding-logging-for-legacy-applications&quot; rel=&quot;nofollow noreferrer&quot;&gt;these instructions&lt;/a&gt; for adding an argument to the Procfile to tell Heroku to tail Craft's log file into the &quot;Logplex&quot; stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might well be situations where Brad's suggestion (using a plugin to write the logs to stderr) is preferable, but I wasn't sure what the implications would be for logs in development (where it's fine for them to be written to the file system). Adding an argument to the Procfile side-steps this issue, since it's only run by Heroku.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Procfile now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;web: vendor/bin/heroku-php-nginx -C nginx_app.conf -l storage/logs/web.log web&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="328" LastActivityDate="2018-11-06T18:32:13.133" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28329" PostTypeId="2" ParentId="28324" CreationDate="2018-11-06T18:34:33.010" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Since the slug is used to generate assets folders, accents aren't suitable and results in question marks in the folder names.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could do something similar to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28257/how-to-rename-filename-of-asset-before-or-after-upload-in-craft-3&quot;&gt;How to rename filename of asset before (or after) upload in Craft 3&lt;/a&gt; in a plugin except you run the folder name through the same ASCII normalization process that auto-generated slugs go though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-06T18:34:33.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28331" PostTypeId="2" ParentId="10900" CreationDate="2018-11-06T21:05:04.550" Score="1" Body="&lt;p&gt;Should be I think:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Entry URL Format in the Section Settings:&#xA;gallery/{category.first.slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8993" LastActivityDate="2018-11-06T21:05:04.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28332" PostTypeId="1" CreationDate="2018-11-06T22:56:41.180" Score="1" ViewCount="164" Body="&lt;p&gt;I have a plugin, which is using another plugin. The issue is that, I am calling some other plugin information in the init function, and I do receive sometimes this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-11-07 11:44:57 [-][-][k91hcavi6st542afnhsvhdp61u][error][yii\base\ErrorException:8] yii\base\ErrorException: Trying to get property 'mobileDetectService' of non-object in /home/forge/plugins/releases/20181106223004/src/services/CacheService.php:193&#xA;Stack trace:&#xA;#0 /home/forge/new.trendsideas.com/releases/20181106223038/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler-&amp;gt;handleError(8, 'Trying to get p...', '/home/forge/plu...', 193)&#xA;#1 /home/forge/plugins/releases/20181106223004/src/services/CacheService.php(193): craft\web\ErrorHandler-&amp;gt;handleError(8, 'Trying to get p...', '/home/forge/plu...', 193, Array)&#xA;#2 /home/forge/plugins/releases/20181106223004/src/services/CacheService.php(126): trendspublishing\craftplugin\services\CacheService-&amp;gt;_generateUri('/hubs/bathroom')&#xA;#3 /home/forge/plugins/releases/20181106223004/src/Plugin.php(90): trendspublishing\craftplugin\services\CacheService-&amp;gt;uriToFilePath('/hubs/bathroom')&#xA;#4 /home/forge/new.trendsideas.com/releases/20181106223038/vendor/yiisoft/yii2/base/BaseObject.php(109): trendspublishing\craftplugin\Plugin-&amp;gt;init()&#xA;#5 /home/forge/new.trendsideas.com/releases/20181106223038/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#6 /home/forge/new.trendsideas.com/releases/20181106223038/vendor/craftcms/cms/src/base/Plugin.php(113): yii\base\Module-&amp;gt;__construct('craftplugin', Object(craft\web\Application), Array)&#xA;#7 [internal function]: craft\base\Plugin-&amp;gt;__construct('craftplugin', Object(craft\web\Application), Array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the error in question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$mobile_detect = MobileDetect::$plugin-&amp;gt;mobileDetectService;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not able to replicate it, sometimes a simple database reload is helping sometimes not. So that's why I am only guessing, because I do invoke this call from the plugin init function, that's why the other plugin is not ready yet...&#xA;Any thought, best practice on this one?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2018-11-06T23:35:12.513" Title="Plugin init order issue" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28334" PostTypeId="2" ParentId="28332" CreationDate="2018-11-06T23:35:12.513" Score="4" Body="&lt;p&gt;What I do is I listen for the &lt;code&gt;Plugins::EVENT_AFTER_LOAD_PLUGINS&lt;/code&gt; event, and then do my code that relies on other plugins being loaded:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Handler: Plugins::EVENT_AFTER_LOAD_PLUGINS&#xA;    Event::on(&#xA;        Plugins::class,&#xA;        Plugins::EVENT_AFTER_LOAD_PLUGINS,&#xA;        function () {&#xA;            // Do stuff only after all other plugins have loaded&#xA;        }&#xA;    );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-06T23:35:12.513" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28335" PostTypeId="1" CreationDate="2018-11-07T02:09:04.640" Score="1" ViewCount="69" Body="&lt;p&gt;There's a section called &lt;code&gt;locations&lt;/code&gt; and another called &lt;code&gt;vacancies&lt;/code&gt;. In &lt;code&gt;vacancies&lt;/code&gt; the admin can assign a &lt;code&gt;location&lt;/code&gt; entry to a &lt;code&gt;vacancy&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the careers overview page we want to display selected vacancies &lt;code&gt;block.vacancySelected&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template we loop through all locations and would like to display the number of vacancies per location. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lparas = {&#xA;    section: 'locations'&#xA;    } %}&#xA;{% set locations = craft.entries(lparas) %}&#xA;&#xA;{% if locations | length %}&#xA;   {% for location in locations %}&#xA;      {% set cEntries = block.vacancySelected.relatedTo(location) %}&#xA;      {% if cEntries| length %}&#xA;         {{ location.locationName }} ({{ cEntries | length }})&#xA;      {% endif %}&#xA;   {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But for some reason it shows all locations and the total number of vacancies per locations. It seems to ignore that we only want to show the locations of the selected vacancies.&lt;/p&gt;&#xA;" OwnerUserId="8941" LastActivityDate="2018-11-07T13:18:14.817" Title="Filter entries by other entry" Tags="&lt;entries&gt;&lt;relations&gt;&lt;filter&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28336" PostTypeId="1" CreationDate="2018-11-07T08:22:33.660" Score="2" ViewCount="43" Body="&lt;p&gt;Coming from ruby and rails, I’ve been using slim (&lt;a href=&quot;https://slim-lang.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://slim-lang.org&lt;/a&gt;) for years. It’s brevity and clarity have become the norm to me and writing and reading  full html feels a bit exhausting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, is there a way to use slim with twig templates in Craft? Does anyone here use this combination? Would you be willing to share your setup?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4691" LastEditorUserId="57" LastEditDate="2018-11-07T21:32:14.237" LastActivityDate="2018-11-07T21:32:14.237" Title="How can I use slim templates with Craft?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28337" PostTypeId="2" ParentId="28326" CreationDate="2018-11-07T10:06:59.537" Score="1" Body="&lt;p&gt;So having spoken to the maker of CraftQL yesterday, my mistake was assuming I needed to use &lt;code&gt;gatsby-source-craftcms&lt;/code&gt; as my source plugin. In actual fact, the standard &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-source-graphql/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;gatsby-source-graphql&lt;/code&gt;&lt;/a&gt; was much better and more abstract, meaning you don't need to construct giant graphQL queries in the &lt;code&gt;gatsby-config&lt;/code&gt;. Also the docs for it are much better explained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now my &lt;code&gt;gatsby-config.js&lt;/code&gt; looks like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plugins: [&#xA;    {&#xA;        resolve: `gatsby-source-graphql`,&#xA;        options: {&#xA;    typeName: &quot;Craft&quot;,&#xA;    fieldName: &quot;craft&quot;,&#xA;    // Url to query from&#xA;    url: &quot;http://cms.local/api&quot;,&#xA;    // HTTP headers&#xA;    headers: {&#xA;      Authorization: `bearer ACCESSTOKENHERE`,&#xA;    }&#xA;        },&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my query looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  craft {&#xA;    globals {&#xA;      contact {&#xA;        address&#xA;      }&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is much more sane and closer the the normal Twig API&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can view the &lt;a href=&quot;https://twitter.com/markhuot/status/1059850263706640385&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twitter exchange here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4618" LastActivityDate="2018-11-07T10:06:59.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28338" PostTypeId="1" AcceptedAnswerId="28339" CreationDate="2018-11-07T12:06:56.160" Score="2" ViewCount="280" Body="&lt;p&gt;How can I log in a user in Craft 3 and redirect to a url?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = $user-&amp;gt;username;&#xA;$userCode = $user-&amp;gt;teamCode;&#xA;Craft::$app-&amp;gt;user-&amp;gt;login($username, $userCode);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2018-11-07T12:47:43.167" Title="Log in User (Craft 3)" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28339" PostTypeId="2" ParentId="28338" CreationDate="2018-11-07T12:14:45.137" Score="3" Body="&lt;p&gt;Documentation for this can be found in &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-user.html#method-loginbyuserid&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's class reference&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Login as user, by id&#xA;Craft::$app-&amp;gt;getUser()-&amp;gt;loginByUserId($user-&amp;gt;id);&#xA;&#xA;# Redirect&#xA;return Craft::$app-&amp;gt;getResponse()-&amp;gt;redirect($url)-&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, if you're in a controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;redirect($url);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2018-11-07T12:47:43.167" LastActivityDate="2018-11-07T12:47:43.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28340" PostTypeId="2" ParentId="28336" CreationDate="2018-11-07T12:45:19.473" Score="1" Body="&lt;p&gt;To answer your question: I think you CAN, but it will not be easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is built on top of the Yii framework. It lets you override things (settings, classes) in the &lt;a href=&quot;https://docs.craftcms.com/v3/config/#application-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;config/app.php&lt;/code&gt;&lt;/a&gt; file that gets installed by default. So, you should be able to change the view renderer to anything you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    'components' =&amp;gt; [&#xA;        'view' =&amp;gt; [&#xA;            'class' =&amp;gt; 'craft\web\View',&#xA;            'renderers' =&amp;gt; [&#xA;                'slim' =&amp;gt; [&#xA;                    'class' =&amp;gt; 'path\to\your\slim\ViewRenderer',&#xA;                ],&#xA;            ],&#xA;        ],&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this would require a Yii ViewRenderer based on Slim, which I don't think is  available (yet). You could build it yourself, based on the Twig ViewRenderer used by Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I would not do it, is that Craft has several Twig filters en functions that make your templating life easier. You'd have to create wrappers for those, to be able to use them. I don't think the added complexity of all this weighs up to the advantage of using Slim.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-07T12:45:19.473" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28341" PostTypeId="2" ParentId="28335" CreationDate="2018-11-07T13:01:56.500" Score="2" Body="&lt;p&gt;If I correctly understand your question, you want to show each location with at least one vacancy, and the number of vacancies for that location? I don't really get what &lt;code&gt;block.vacancySelected&lt;/code&gt; is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I would do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all locations #}&#xA;{% set allLocations = craft.entries.section('locations').all() %}&#xA;&#xA;{% for location in location %}&#xA;    {# get a vacancy count for this location #}&#xA;    {% set vacancyCountForLocation = craft.entries.section('vacancies').relatedTo({&#xA;        field: 'locationFieldHandle',&#xA;        targetElement: location,&#xA;    }).count() %}&#xA;&#xA;    {% if vacancyCountForLocation %}&#xA;        {{ location.locationName }} ({{ vacancyCountForLocation }})&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To prevent loading all locations, even if they have no vacancies, you could also try (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get all locations, but only if they have related vacancies #}&#xA;{% set allVacancies = craft.entries.section('vacancies').ids() %}&#xA;{% set allLocations = craft.entries.section('locations').relatedTo({&#xA;    field: 'locationFieldHandle',&#xA;    sourceElement: allVacancies,&#xA;}).all() %}&#xA;&#xA;{% for location in location %}&#xA;    {# get a vacancy count for this location #}&#xA;    {% set vacancyCountForLocation = craft.entries.section('vacancies').relatedTo({&#xA;        field: 'locationFieldHandle',&#xA;        targetElement: location,&#xA;    }).count() %}&#xA;&#xA;    {{ location.locationName }} ({{ vacancyCountForLocation }})&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2018-11-07T13:18:14.817" LastActivityDate="2018-11-07T13:18:14.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28342" PostTypeId="1" CreationDate="2018-11-07T15:19:01.003" Score="1" ViewCount="56" Body="&lt;p&gt;Following the answer in this thread -&lt;a href=&quot;https://craftcms.stackexchange.com/questions/11508/linking-and-showing-archive-by-month&quot;&gt;Linking and showing archive by month&lt;/a&gt;  by P&amp;amp;T has worked fine for previous sites but now I'm getting the following error. I've checked I have a Time zone selected in System settings. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DateTime::modify(): Failed to parse time string (first day of archive &#xA;2018 00:00:00) at position 13 (a): The timezone could not be found in &#xA;the database&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.segment(3) %}&#xA;{% set year = craft.request.segment(4) %}&#xA;&#xA;{% set firstDay = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDay = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;{% set archive  = craft.entries.section('bulletinOnline').postDate('and', '&amp;gt;= ' ~ firstDay, '&amp;lt;= ' ~ lastDay) %}&#xA;&#xA;{% for entry in archive %}  &#xA;&#xA;  ...&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2018-11-07T15:19:01.003" Title="Archiving by month and year - timezone could not be found error" Tags="&lt;datetime&gt;&lt;archives&gt;&lt;timezone&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28343" PostTypeId="1" CreationDate="2018-11-07T16:21:19.213" Score="1" ViewCount="32" Body="&lt;p&gt;I've been using globals many times but this is my first time encounter with such problem. Let's go from the bottom. I have two global sets with handles &lt;code&gt;tax&lt;/code&gt; and &lt;code&gt;company&lt;/code&gt;. The Tax set have only one plain text field &lt;code&gt;taxRate&lt;/code&gt; which can be accessed like &lt;a href=&quot;https://docs.craftcms.com/v2/globals.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; says &lt;code&gt;{{ tax.taxRate }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Company set have more plain text fields and one table field.&#xA;Odd thing happens when I try to access any plain text field the same way. Example: &lt;code&gt;{{ company.businessName }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to see what I get outputted using &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/dump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;dump()&lt;/a&gt; function of that field and the output is quiet broader than the dump output of &lt;code&gt;{{ tax.taxRate }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(tax.taxRate) }}` -&amp;gt; string(2) &quot;20&quot;&#xA;&#xA;{{ dump(company.businessName) }}` -&amp;gt; object(Craft\ElementCriteriaModel)#942 (17) {&#xA;[&quot;strictAttributes&quot;:protected]=&amp;amp;gt;&#xA;bool(false)&#xA;[&quot;_elementType&quot;:&quot;Craft\ElementCriteriaModel&quot;:private]=&amp;amp;gt;&#xA;object(Craft\EntryElementType)#372 (7) {&#xA;[&quot;componentType&quot;:protected]=&amp;amp;gt;&#xA;string(11) &quot;ElementType&quot;&#xA;[&quot;_sourcesByContext&quot;:&quot;Craft\BaseElementType&quot;:private]=&amp;amp;gt;&#xA;NULL&#xA;[&quot;_classHandle&quot;:&quot;Craft\BaseComponentType&quot;:private]=&amp;amp;gt;&#xA;NULL ... and another dozens lines of it&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can access it using &lt;code&gt;craft.globals.getSetByHandle('company')&lt;/code&gt; but I don't understand why I'm getting &lt;strong&gt;object&lt;/strong&gt; returned in the set Company and &lt;strong&gt;string&lt;/strong&gt; returned in the set Tax using the same fetch approach? &lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-11-08T07:18:56.930" LastActivityDate="2018-11-08T07:18:56.930" Title="Accessing global set's field gives object that couldn't be converted to string" Tags="&lt;globals&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28344" PostTypeId="2" ParentId="28343" CreationDate="2018-11-07T18:09:21.723" Score="1" Body="&lt;p&gt;Well, when I went properly through the output of &lt;code&gt;{{ dump(company.businessName) }}&lt;/code&gt; I found out right from the start that it is element criteria model of entry type.&#xA;That led me to check for the &lt;code&gt;handle&lt;/code&gt; &lt;code&gt;company&lt;/code&gt; that could exists twice in system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found section with the &lt;code&gt;handle&lt;/code&gt; &lt;code&gt;company&lt;/code&gt;. So two identical handles in system were causing my problem. But on the first place, how could Craft let me save the global set with the &lt;code&gt;handle&lt;/code&gt; that already existed in system even if they are different type of element criteria model and Craft would throw that string conversion error anyway?&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-11-07T18:51:31.677" LastActivityDate="2018-11-07T18:51:31.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28345" PostTypeId="1" AcceptedAnswerId="32749" CreationDate="2018-11-07T19:26:33.180" Score="3" ViewCount="835" Body="&lt;p&gt;Is there anyway to get my date formats looking like Facebook? I'd like to get my articles to have this as a date format: &quot;5 min ago&quot;, &quot;yesterday&quot;, &quot;3 days ago&quot;, &quot;4 months ago&quot; and then once it reaches a full year ago, make it have a date format like &quot;Dec 5, 2016&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has gotten this working, would you mind sharing with me(and the world) your code on how to achieve this in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2019-10-14T09:22:36.077" Title="Entry Post Date Format time since - X days ago" Tags="&lt;datetime&gt;&lt;postdate&gt;&lt;format&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28346" PostTypeId="2" ParentId="28345" CreationDate="2018-11-07T19:49:48.343" Score="4" Body="&lt;p&gt;It looks as though Craft 3’s &lt;a href=&quot;https://docs.craftcms.com/v3/dev/filters.html#duration&quot; rel=&quot;nofollow noreferrer&quot;&gt;built-in &lt;code&gt;duration&lt;/code&gt; Twig filter&lt;/a&gt; might help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Posted {{ entry.myDateField.diff(now) | duration }} ago.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With a bit of additional logic, you can make this more useful, after an Entry leaves a specified window:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateOneYearAgo = now.modify('- 1 year') %}&#xA;{% set dateOneMonthAgo = now.modify('- 1 month') %}&#xA;{% set dateOneDayAgo = now.modify('- 1 day') %}&#xA;&#xA;{% set elapsedMonths = entry.myDateField.diff(now).m %}&#xA;{% set elapsedDays = entry.myDateField.diff(now).d %}&#xA;&#xA;{% if entry.myDateField &amp;lt; dateOneYearAgo %}&#xA;    {# Posted longer ago than one year... #}&#xA;    Posted on {{ entry.myDateField | date('M j, Y') %}&#xA;{% elseif entry.myDateField &amp;lt; dateOneMonthAgo %}&#xA;    {# Posted longer ago than one month (but more recently than one year, as we caught that, above)... #}&#xA;    Posted {{ elapsedMonths }} month{{ elapsedMonths != 1 ? 's' : '' }} ago&#xA;{% elseif entry.myDateField &amp;lt; dateOneDayAgo %}&#xA;    {# Posted longer ago than one day (but, as above, more recently than a month ago)... #}&#xA;    Posted {{ elapsedDays }} day{{ elapsedDays != 1 ? 's' : '' }} ago&#xA;{% else %}&#xA;    Posted {{ entry.myDateField.diff(now) | duration }} ago.&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;if&lt;/code&gt; statements compare the date objects, and returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;entry.myDateField&lt;/code&gt; is earlier than the date one year ago (&lt;code&gt;- 1 year&lt;/code&gt;), one month ago (&lt;code&gt;-1 month&lt;/code&gt;), etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;now.modify(…)&lt;/code&gt; is a convenient and human-readable way of getting a date relative to the current time—you can pass this method any &lt;a href=&quot;https://secure.php.net/manual/en/datetime.formats.relative.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;relative date&lt;/a&gt; string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ternary statements (like &lt;code&gt;{{ elapsedDays != 1 ? 's' : '' }}&lt;/code&gt;) are just a crummy way of properly pluralizing the units of time—I'd recommend using the &lt;a href=&quot;https://github.com/nystudio107/craft-typogrify&quot; rel=&quot;nofollow noreferrer&quot;&gt;Typogrify&lt;/a&gt; plugin, instead, as it offers some more declarative ways to handling this— say, &lt;code&gt;{{ 'month' | pluralize(elapsedDays) }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note: I've omitted special circumstances for things like “yesterday,” as these constraints can be layered in as new &lt;code&gt;else if&lt;/code&gt; statements—just be sure to put the tightest constraints at the top, so that it matches your priorities (i.e. a test for “last week” should come after a test for “yesterday”). Anything you don't care about can fall through to the default &lt;code&gt;duration&lt;/code&gt; filter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-11-14T19:00:00.187" LastActivityDate="2018-11-14T19:00:00.187" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28347" PostTypeId="1" CreationDate="2018-11-07T21:44:12.167" Score="5" ViewCount="638" Body="&lt;p&gt;I'm currently using &lt;a href=&quot;https://github.com/am-impact/amforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;amforms from a&amp;amp;m impact&lt;/a&gt; on a couple of sites. However, it looks like this plugin won't get a craftcms version 3 update. In addition, my requirements for a form plugin have expanded considerably since my clients want more advanced functionality. Therefore, I am now searching for a good alternative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My requirements are as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It should be possible to prepopulate fields with existing data&lt;/li&gt;&#xA;&lt;li&gt;Duplicating forms should be possible&lt;/li&gt;&#xA;&lt;li&gt;Templating completely customizable &lt;/li&gt;&#xA;&lt;li&gt;Ability to dynamically add more rows of fields (like in a reservation for a hotel where you can add more rooms or persons)&lt;/li&gt;&#xA;&lt;li&gt;Validation for at least the basic field types &lt;/li&gt;&#xA;&lt;li&gt;File uploads should be possible&lt;/li&gt;&#xA;&lt;li&gt;Custom conditions for custom fields (like a checkbox only checkable after checking another one before)&lt;/li&gt;&#xA;&lt;li&gt;Custom email template&lt;/li&gt;&#xA;&lt;li&gt;Translatable&lt;/li&gt;&#xA;&lt;li&gt;Good documentation&lt;/li&gt;&#xA;&lt;li&gt;Active development&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Right now &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace's Freeform&lt;/a&gt; looks most promising and I already know their calendar plugin. However, &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms&lt;/a&gt; also looks quite capable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone of you has experience with one of these plugins or can recommend another plugin that meets all or most of the criteria?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for your help!&lt;/p&gt;&#xA;" OwnerUserId="5424" LastEditorUserId="4496" LastEditDate="2019-11-05T15:24:32.680" LastActivityDate="2019-11-07T14:27:57.530" Title="Looking for an advanced form plugin for Craft CMS" Tags="&lt;plugins&gt;&lt;form&gt;&lt;plugin-sproutforms&gt;&lt;plugin-contactform&gt;&lt;plugin-freeform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28348" PostTypeId="2" ParentId="28325" CreationDate="2018-11-07T22:43:03.493" Score="0" Body="&lt;p&gt;To manually generate multi-option fields like radios, your code would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set yourFieldHandle = form.get(&quot;yourFieldHandle&quot;) %}&#xA;&#xA;&amp;lt;label&amp;gt;{{ yourFieldHandle.label }}&amp;lt;/label&amp;gt;&#xA;{% for option in yourFieldHandle.options %}&#xA;   &amp;lt;div class=&quot;radio&quot;&amp;gt;&#xA;      &amp;lt;label&amp;gt;&#xA;         &amp;lt;input type=&quot;radio&quot; name=&quot;yourFieldHandle&quot; value=&quot;{{ option.value }}&quot; {{ option.checked ? &quot;checked&quot; }} /&amp;gt;&#xA;         {{ option.label|raw }}&#xA;      &amp;lt;/label&amp;gt;&#xA;   &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-11-07T22:43:03.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28349" PostTypeId="1" CreationDate="2018-11-07T22:57:59.287" Score="1" ViewCount="374" Body="&lt;p&gt;Been struggling for hours to solve this with no solution and I'm under a deadline for a client. Any help would be so amazing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what happened: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I set up the initial craft project with craft create &lt;/li&gt;&#xA;&lt;li&gt;This got pushed to Github and other devs have been continuing work&lt;/li&gt;&#xA;&lt;li&gt;We were collaborating just fine on the project back and fourth with changes. &lt;/li&gt;&#xA;&lt;li&gt;In my development I somehow deleted my &lt;code&gt;.env&lt;/code&gt; file. &lt;/li&gt;&#xA;&lt;li&gt;Now - I can't get my &lt;code&gt;/admin/dashboard&lt;/code&gt; to show up or the craft site at all. &lt;/li&gt;&#xA;&lt;li&gt;I've been playing with the settings in the &lt;code&gt;.env&lt;/code&gt; I've been going back and fourth with the &lt;code&gt;/phpMyAdmin/?lang=en&lt;/code&gt; page trying to set up and link a database. &lt;/li&gt;&#xA;&lt;li&gt;It seems: the project is fine, the database is fine, but I can't seem to link my database and the craft project and get craft to run at all. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any tips? Any direction? I am just seeing this in the browser: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This page isn’t working localhost is currently unable to handle this request.&#xA;HTTP ERROR 500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Help please! Thanks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI - I am on MacOS running MAMP (From my applications folder) and I have PHP 7.2.11 all installed and running. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="8997" LastActivityDate="2018-11-07T23:12:05.097" Title="This page isn’t working // I think it's my .env?" Tags="&lt;craft3&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28350" PostTypeId="2" ParentId="28349" CreationDate="2018-11-07T23:10:19.360" Score="2" Body="&lt;p&gt;Yes, the &lt;code&gt;.env&lt;/code&gt; file holds the environmental-specific settings/&quot;secrets&quot; that Craft needs to run. So you'll need to recreate it; here's a template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/craft/blob/master/.env.example&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/craft/blob/master/.env.example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information can be found here: &lt;a href=&quot;https://docs.craftcms.com/v3/config/environments.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Environmental Configuration&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-11-07T23:12:05.097" LastActivityDate="2018-11-07T23:12:05.097" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28352" PostTypeId="1" AcceptedAnswerId="28353" CreationDate="2018-11-08T01:03:46.447" Score="3" ViewCount="394" Body="&lt;p&gt;I recently upgraded a site from Craft 2 to Craft 3, so I'm trying to figure out what was deprecated and caused this error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the top of the page I have this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set solutions = craft.entries.section('solutions').level(1).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'm trying to invoke a dropdown menu like so &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;nav-item {% if craft.request.segment(1) == 'solutions' %}active{% endif %}&quot;&amp;gt;&#xA;    {% nav solution in solutions.limit(1) %}&#xA;        &amp;lt;a class=&quot;nav-link&quot; href=&quot;{{ solution.url }}&quot;&amp;gt;solutions&amp;lt;span class=&quot;sr-only&quot;&amp;gt;(current)&amp;lt;/span&amp;gt; &amp;lt;i class=&quot;icon-downarrow&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;/a&amp;gt;&#xA;    {% endnav %}&#xA;    &amp;lt;ul class=&quot;submenu&quot;&amp;gt;&#xA;        {% nav solution in solutions %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ solution.url }}&quot;&amp;gt;{{ solution.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before I didn't have &lt;code&gt;.all()&lt;/code&gt; at the end, but only the first menuitem was showing up.&#xA;When I added &lt;code&gt;.all()&lt;/code&gt; in, I get the error &lt;code&gt;&quot;Impossible to invoke a method (&quot;limit&quot;) on an array.&quot;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8999" LastEditorUserId="5275" LastEditDate="2019-05-17T12:46:34.857" LastActivityDate="2019-05-17T12:46:34.857" Title="Impossible to invoke a method (&quot;limit&quot;) on an array" Tags="&lt;craft3&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28353" PostTypeId="2" ParentId="28352" CreationDate="2018-11-08T02:11:35.570" Score="2" Body="&lt;p&gt;&lt;code&gt;craft.entries&lt;/code&gt; now returns an &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ElementQuery&lt;/a&gt;. When you add the &lt;code&gt;.all()&lt;/code&gt; you're telling Craft to execute the query, which returns an &lt;code&gt;array&lt;/code&gt; of Elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that &lt;code&gt;solutions&lt;/code&gt; is now a simple array, and won't have methods like &lt;code&gt;.limit(1)&lt;/code&gt; that can be executed on it. It looks like you just want to use the first item in the &lt;code&gt;solutions&lt;/code&gt; array, so try changing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      {% nav solution in solutions.limit(1) %}&#xA;           &amp;lt;a class=&quot;nav-link&quot; href=&quot;{{ solution.url }}&quot;&amp;gt;solutions&amp;lt;span class=&quot;sr-only&quot;&amp;gt;(current)&amp;lt;/span&amp;gt; &amp;lt;i class=&quot;icon-downarrow&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;/a&amp;gt;&#xA;      {% endnav %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       &amp;lt;a class=&quot;nav-link&quot; href=&quot;{{ solutions[0].url }}&quot;&amp;gt;solutions&amp;lt;span class=&quot;sr-only&quot;&amp;gt;(current)&amp;lt;/span&amp;gt; &amp;lt;i class=&quot;icon-downarrow&quot;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More here: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/nav.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% nav %} Tags&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-08T02:11:35.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28354" PostTypeId="1" CreationDate="2018-11-08T09:56:38.630" Score="1" ViewCount="587" Body="&lt;p&gt;I've been struggling to make this work within a plugin. I have a html file in my templates folder called _email.html. I try to load it in my plugin but then I get an error. This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;mailer-&amp;gt;compose('_email.html', ['body' =&amp;gt; $emailBody])&#xA;            -&amp;gt;setFrom($fromMail)&#xA;            -&amp;gt;setTo($toMail)&#xA;            -&amp;gt;setSubject($subject)&#xA;            -&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that the Yii mailer is looking in the vendor folder instead of the templates folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The view file does not exist: /Applications/MAMP/htdocs/project/vendor/craftcms/cms/src/mail/_email&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even when I try going back to the templates folder it doesn't seem to work and I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The view file does not exist: /Applications/MAMP/htdocs/project/vendor/craftcms/cms/src/mail/../../../../../../templates/_email&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found out that if I copy and paste the contents of the _email.html file and do the following it does work, but this obviously is a pretty bad workaround&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-&amp;gt;setHtmlBody(&quot;&amp;lt;!DOCTYPE html......&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any advice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5619" LastActivityDate="2020-02-21T08:04:25.140" Title="Loading email templates in a Craft 3 plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;emails&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28355" PostTypeId="1" AcceptedAnswerId="28576" CreationDate="2018-11-08T10:59:29.060" Score="2" ViewCount="350" Body="&lt;p&gt;When using Commerce 2, is there a way to fill a client's cart with the contents of an (inactive) cart, by using a link? Use case: abandoned cart email.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-28T12:10:59.760" Title="(How) can I fill a visitor's cart by using a link?" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28356" PostTypeId="2" ParentId="28354" CreationDate="2018-11-08T11:51:12.230" Score="1" Body="&lt;p&gt;I think you have to set the template mode to 'SITE', to let Craft know where to look for the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = \Craft::$app-&amp;gt;getView();         &#xA;if ($view-&amp;gt;getTemplateMode() !== $view::TEMPLATE_MODE_SITE) {&#xA;    $view-&amp;gt;setTemplateMode($view::TEMPLATE_MODE_SITE);&#xA;}&#xA;&#xA;Craft::$app-&amp;gt;mailer-&amp;gt;compose('_email.html', ['body' =&amp;gt; $emailBody])&#xA;    -&amp;gt;setFrom($fromMail)&#xA;    -&amp;gt;setTo($toMail)&#xA;    -&amp;gt;setSubject($subject)&#xA;    -&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-08T11:51:12.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28358" PostTypeId="2" ParentId="28347" CreationDate="2018-11-08T13:26:40.747" Score="3" Body="&lt;p&gt;I work with Sprout and can answer your questions with regards to Sprout Forms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. It should be possible to prepopulate fields with existing data&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will happen by default in a lot of standard use cases when you are using &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/default-form-templates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Templates&lt;/a&gt; and when validation fails, for example. It's also possible to populate a Form Entry dynamically using the &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/entries.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;setEntry&lt;/a&gt; variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Duplicating forms should be possible&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can duplicate a form by selecting &lt;code&gt;Save-&amp;gt;Save as New Form&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Templating completely customizable&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms templates are 100% customizable down to the individual field type. See:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; - allow you to override form templates with your own custom HTML right within your Craft templates/ folder. You get full access to the form templates being output and can customize them however you'd like.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/custom-form-templates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Templates API&lt;/a&gt; - allows you to manage Template Overrides as custom, reusable Form Templates in a plugin or module&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/rendering-options.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rendering Options&lt;/a&gt; - allow you to dynamically override certain characteristics in existing Form Templates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. Ability to dynamically add more rows of fields (like in a reservation for a hotel where you can add more rooms or persons)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms avoids supporting fields that may require javascript and interactivity on the front-end by default (as we can't predict all the potential use cases of how this type of interactivity should be implemented), however, we do support custom &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/custom-form-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Fields&lt;/a&gt; and &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; which should give you all the control you need to create the advanced field types you need on the front-end and style and script them however you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. Validation for at least the basic field types&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All Form Fields provide validation. Custom &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/custom-form-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Fields&lt;/a&gt; can be created to support additional validation requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;6. File uploads should be possible&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File Uploads are supported via the File Upload Form Field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;7. Custom conditions for custom fields (like a checkbox only checkable after checking another one before)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forms allow you to add Conditional Rules for your Fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more advanced scenarios, conditional logic could also be handled via your templates and CSS and Javascript. Form Fields support adding custom CSS Classes, &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Template Overrides&lt;/a&gt; allow you to customize any details about how your Form and Field HTML is output so you can interact with it how you need, and while it's currently undocumented, you can also add pre-defined CSS Classes as a dropdown option if you create custom &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/custom-form-templates.html#form-template-class&quot; rel=&quot;nofollow noreferrer&quot;&gt;Form Templates&lt;/a&gt; via the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;8. Custom email template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms Notifications are powered by an integration with Sprout Email so you have the full feature set of Sprout Email Notification Emails in Sprout Forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar to Form Templates, Email Notifications allow you to control every detail of the HTML and Text versions of your emails via &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/email/template-overrides.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Email Template Overrides&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reporting is handled in a similar way and is powered by Sprout Reports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;9. Translatable&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Translating forms is tricky business. This is because the problem is the reverse of the problem Craft is solving by default. Craft Elements support translations of the content being submitted to custom fields where Form Elements need to support translations of the Labels and Descriptions of the fields being submitted, and the user adds the content afterward in whatever language they are given the option to submit it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms supports translating a form by duplicating a form. Outside of that, Sprout Forms ensures the plugin itself is translatable however the translation itself would have to happen outside of the plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;10. Good documentation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We think we have decent docs and we're always looking to improve, so please drop us a note if you feel we could add a useful example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sprout Forms Documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you ever feel stuck or are curious about how to tackle a hard problem using Sprout Plugins, we also offer a free half-hour &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/support/training.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;coaching session&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;11. Active development&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms is built by Barrel Strength Design who is has been involved in the Craft CMS community since it was called Blocks CMS. All of our commercial plugins are actively developed and supported and Sprout Forms will continue to benefit from new features we are developing in our other plugins as well (Email, Reporting, Imports, Fields).&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="115" LastEditDate="2019-10-17T22:30:18.590" LastActivityDate="2019-10-17T22:30:18.590" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28359" PostTypeId="1" AcceptedAnswerId="28360" CreationDate="2018-11-08T13:38:51.973" Score="1" ViewCount="1091" Body="&lt;p&gt;How can I register and login a user in my Controller? I have tried something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newUser = new User($userName, $userPassword, $userEmail);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveUser($newUser);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2018-11-08T14:06:58.867" Title="Save and login user in a Plugin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;login&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28360" PostTypeId="2" ParentId="28359" CreationDate="2018-11-08T14:06:58.867" Score="3" Body="&lt;p&gt;Put this at the top of the file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\User;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Within your function use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new User();&#xA;$user-&amp;gt;pending = true;&#xA;$user-&amp;gt;username = $contact[&quot;login_email&quot;];&#xA;$user-&amp;gt;firstName = $contact[&quot;first_name&quot;];&#xA;$user-&amp;gt;lastName = $contact[&quot;last_name&quot;];&#xA;$user-&amp;gt;email = $contact[&quot;login_email&quot;];&#xA;$user-&amp;gt;passwordResetRequired = false;&#xA;$user-&amp;gt;validate(null, false);&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user, false);&#xA;Craft::$app-&amp;gt;users-&amp;gt;assignUserToGroups($user-&amp;gt;id, [1]);&#xA;Craft::$app-&amp;gt;getUsers()-&amp;gt;sendActivationEmail($user);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sendActivationEmail is not a required step and can be removed but this code is working on a Craft 3 site I've been building and it creates user accounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes that a $contacts array has been set with all of the correct values, just swap these out for your own values or omit them if you don't have any. From here you should be able to customise it though for what you need once the user account is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final step for you to log in as that user would be to use something like this, this is untested however and may need some tweaking but has come from the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-user.html#method-loginbyuserid&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$userLogin = new \Craft\web\User();&#xA;$userLogin-&amp;gt;loginByUserId($user-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2018-11-08T14:06:58.867" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28361" PostTypeId="1" CreationDate="2018-11-08T14:20:22.880" Score="1" ViewCount="34" Body="&lt;p&gt;An event in Solspace Calendar that repeats weekly should have an &lt;a href=&quot;https://docs.craftcms.com/v3/entries-fields.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries field&lt;/a&gt;, that can be changed per single occurrence. E.g. Tuesday’s evening class is usually tought by teacher A, except next week, where it’s going to be teacher B (both teachers have an entry I’d like to link to in the event’s popover).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="9001" LastActivityDate="2018-11-09T18:28:24.627" Title="Is it possible to add an entries field to recurring events that can be changed per occurrence?" Tags="&lt;craft3&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28362" PostTypeId="1" CreationDate="2018-11-08T19:00:22.093" Score="1" ViewCount="125" Body="&lt;p&gt;I'm working on the language switcher and have it working. The only thing is I want it to pull from &lt;code&gt;group&lt;/code&gt; &lt;code&gt;data-id=1&lt;/code&gt; It's pulling from all sites because of the &lt;code&gt;i18n&lt;/code&gt; to change the language name to it's native name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a &quot;disabled&quot; group in Craft CMS 3 and put Russian in it and it shows up with &lt;code&gt;i18n&lt;/code&gt;.  I had it working before by only the 2 letter abbreviation showed such as &quot;de&quot; instead of Deutsch and Russian didn't show.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;language-menu&quot; aria-labelledby=&quot;navbarDropdownMenuLink&quot; id=&quot;language-menu&quot;&amp;gt;&#xA;{% set currentSite = craft.app.sites.currentSite %}&#xA;{% for siteInGroup in currentSite.getGroup.getSites() %}&#xA;   {% if siteInGroup.id == entry.siteId %}&#xA;      {% for locale in craft.i18n.getSiteLocales() %}&#xA;        &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ locale.getDisplayName() }}&amp;lt;/a&amp;gt;&#xA;   {% else %}&#xA;      {% set entryForOtherSite = craft.entries.id(entry.id).site(siteInGroup).one() %}&#xA;        &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ locale.getDisplayName(siteInGroup.language) }}&amp;lt;/a&amp;gt;&#xA;      {% endfor %}&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I figured it out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% set currentSite = craft.app.sites.currentSite %}&#xA;{% for siteInGroup in currentSite.getGroup.getSites() %}&#xA;   {% if siteInGroup.id == entry.siteId %}&#xA;        &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ locale.getDisplayName() }}&amp;lt;/a&amp;gt;&#xA;   {% else %}&#xA;      {% set entryForOtherSite = craft.entries.id(entry.id).site(siteInGroup).one() %}&#xA;      {% set locale = craft.i18n.getLocaleById(siteInGroup.language) %}&#xA;        &amp;lt;a href=&quot;{{ entryForOtherSite.getUrl() }}&quot;&amp;gt;{{ locale.getDisplayName(siteInGroup.language) }}&amp;lt;/a&amp;gt;&#xA;   {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9002" LastEditorUserId="9002" LastEditDate="2018-11-08T21:34:56.583" LastActivityDate="2018-11-08T21:34:56.583" Title="Craft 3 Launguage Switcher by certain group" Tags="&lt;craft3&gt;&lt;language&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28363" PostTypeId="1" CreationDate="2018-11-08T19:51:01.403" Score="0" ViewCount="134" Body="&lt;p&gt;When using the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt;, how do you go about using the &lt;a href=&quot;https://github.com/benjamminf/craft-embedded-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedded Assets plugin&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a regular asset, in the API transformer you can pull out assets and include them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; function(craft\elements\Entry $entry) {&#xA;    // Create an array of all the photo URLs&#xA;    $photos = [];&#xA;    foreach ($entry-&amp;gt;photos-&amp;gt;all() as $photo) {&#xA;        $photos[] = $photo-&amp;gt;url;&#xA;    }&#xA;&#xA;    return [&#xA;        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;        'description' =&amp;gt; (string)$entry-&amp;gt;description,&#xA;        'photos' =&amp;gt; $photos&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This approach however gives me the URL to the &lt;strong&gt;json file&lt;/strong&gt; that Embedded Assets uses to store some information about the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way than parsing that file as json in php and pulling the iframe from that? Is there some plugin code that can be used to handle this more elegantly?&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-11-08T19:51:01.403" Title="Using Embedded Assets Plugin With Element API" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;plugin-embeddedassets&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28364" PostTypeId="2" ParentId="12904" CreationDate="2018-11-08T20:10:37.843" Score="4" Body="&lt;p&gt;I too just had this problem - upon any action in the control panel flashed &quot;An unknown error occurred&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I found in my craft web.log was: &#xA;&quot;ErrorException: ignore_user_abort() has been disabled for security reasons in&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently in my server setup via Runcloud there are various advanced boilerplate Disable_Functions. I removed &quot;ignore_user_abort&quot;. Problem solved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is what does ignore_user_abort actually do... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3&#xA;PHP 7.2&lt;/p&gt;&#xA;" OwnerUserId="5407" LastActivityDate="2018-11-08T20:10:37.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28365" PostTypeId="2" ParentId="28279" CreationDate="2018-11-08T20:11:54.787" Score="1" Body="&lt;p&gt;My guess is this is the cause:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'cacheMethod' =&amp;gt; getenv('CACHE_METHOD'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;getenv('CACHE_METHOD')&lt;/code&gt; is probably returning &lt;code&gt;null&lt;/code&gt; because that environment variable isn't being set like you expect or its set to an unknown caching driver.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-08T20:11:54.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28366" PostTypeId="1" CreationDate="2018-11-08T21:06:49.200" Score="1" ViewCount="85" Body="&lt;p&gt;In my template, I have an &lt;code&gt;includeJSFile&lt;/code&gt; that loads properly on the first load, but disappears on subsequent loads. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;includeJSFile&lt;/code&gt; is outside the caching tags, so I'm not sure why this is still happening. There's no caching in my &lt;code&gt;layout.twig&lt;/code&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a variable set in my template that I'm calling in via the &lt;code&gt;includeJS&lt;/code&gt; tag (placed outside of the cache tags), and that seems to be having the same issue as well. Any idea to resolve this? Here's the setup.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;{% block content %}&#xA;    {% cache globally using key craft.request.path %}&#xA;&#xA;    {% set entries = craft.entries({&#xA;        section: 'MY-SECTION',&#xA;        with: [&#xA;        'MY-ASSET-FIELD'&#xA;        ]&#xA;    }) %}&#xA;&#xA;    -- MY ENTRY LOOP -- &#xA;&#xA;{% endcache %}&#xA;&#xA;{% includeJsFile 'MY-JS.js' %}&#xA;&#xA;{% set MY-JS-VARIABLE %}&#xA;&#xA;    -- MY JS CONTENT THAT LOOPS THROUGH SECTION ENTRIES TO INSTANTIATE MY JS OBJECTS --&#xA;&#xA;{% endset %}&#xA;&#xA;{% includeJs MY-JS-CONTENT %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5958" LastActivityDate="2018-11-08T21:06:49.200" Title="Avoiding includeJsFile, includeJS from caching" Tags="&lt;cache&gt;&lt;craft2&gt;&lt;includejs&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28367" PostTypeId="1" AcceptedAnswerId="28368" CreationDate="2018-11-08T21:31:50.250" Score="3" ViewCount="134" Body="&lt;p&gt;The following code works great in a template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set priceProduct = currentUser.priceTable.relatedTo({    &#xA;    targetElement: product.id,&#xA;    field: 'product'&#xA;}).one() %}&#xA;&#xA;{{ priceProduct.price }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where priceTable is a Super Table, product.id is from an entry element (we're in loop).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'product' is an entry field in the Super Table row and 'price' is a plaintext field in the Super Table row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How might we go about replicating this functionality in a plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft Pro 3.0.29&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Super Table 2.0.11&lt;/p&gt;&#xA;" OwnerUserId="4097" LastEditorUserId="4097" LastEditDate="2018-11-09T15:59:44.013" LastActivityDate="2018-11-09T15:59:44.013" Title="How to get a Super Table relation in PHP?" Tags="&lt;plugin-development&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28368" PostTypeId="2" ParentId="28367" CreationDate="2018-11-08T21:45:41.303" Score="5" Body="&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$element = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;priceTable-&amp;gt;relatedTo([&#xA;    'targetElement' =&amp;gt; $product-&amp;gt;id,&#xA;    'field' =&amp;gt; 'product'&#xA;])-&amp;gt;one()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But to be honest your code in Twig should not work as expected since you only grab the query and modify it. Your output is your search criteria, not the value of an element. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2018-11-08T21:54:51.197" LastActivityDate="2018-11-08T21:54:51.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28369" PostTypeId="1" CreationDate="2018-11-08T22:03:48.940" Score="1" ViewCount="48" Body="&lt;p&gt;I have a channel where I need each entry's URI include the year and then a sequential number, like this:&#xA;2018/1/&#xA;2018/2/&#xA;2018/3/&#xA;2019/4/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no problem getting the year, but is there a way to get the entry slug to be a sequential number?&lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2018-11-08T22:03:48.940" Title="Use sequential numbers for entry slug" Tags="&lt;url&gt;&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28371" PostTypeId="1" CreationDate="2018-11-08T23:06:22.733" Score="0" ViewCount="90" Body="&lt;p&gt;I have added public profiles following an answer on this stack exchange and it works great, the problem arises when adding a &quot;User Profile Form&quot; which allows users to update their own settings. The problem is that currently, anyone can edit anyone's profile if they were to hardcode the URL to another person profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to safeguard it by making sure the profile belongs to the currentUser. This is my setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_layout.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;_profile.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;  {% set user = craft.users.username( craft.request.segment(2) ).first() %}&#xA;  {{ user.username }}&#xA;&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;account.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layout&quot; %}&#xA;&#xA;{% block content %}&#xA;&#xA;  {% if currentUser.username == user.username %}&#xA;    &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;      {{ getCsrfInput() }}&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/saveUser&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users/{{ currentUser.username }}&quot;&amp;gt;&#xA;      &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;      &amp;lt;label for=&quot;location&quot;&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;&#xA;      &amp;lt;label for=&quot;bio&quot;&amp;gt;Bio&amp;lt;/label&amp;gt;&#xA;&#xA;      &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;    &amp;lt;/form&amp;gt;&#xA;  {% endif %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Right now I'm getting &lt;code&gt;Variable &quot;user&quot; does not exist.&lt;/code&gt; but I'm unsure what's the best way to go about safe guarding this?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-11-08T23:06:22.733" Title="Only allowing users to change their own profiles" Tags="&lt;templating&gt;&lt;users&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28372" PostTypeId="1" CreationDate="2018-11-09T00:12:35.930" Score="1" ViewCount="821" Body="&lt;p&gt;I am &lt;em&gt;just&lt;/em&gt; getting to grips with Craft CMS and am finding the Contact Form plugin tricky to use. I have built a reasonable site structure, figured how fields, sections, etc work at a relatively basic level and have produced a one-for-all template so far in the templates/ root folder. But the form eludes me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added the contact form example from &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt; to the main template at present, and this shows on my /contact/ page. However, the submission of the form returns an error as follows:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Template not found: contact/thanks&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would assume I need to make a section/entry for the contact/thanks page? So I have now done that. The form submits but just goes to a blank page at contact/thanks even though I have created content on that entry. It's not drawing any of the data items specified in the Twig template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also &lt;em&gt;does not&lt;/em&gt; send an email. I have implemented and tested the Settings &gt; Email webserver details successfully. But all submissions are being collated in the &quot;Form Submissions&quot; area (Contat Form Extensions plugin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I note that the form has no action, but the hidden field below exists:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do I need to create a page for &lt;strong&gt;contact-form/send&lt;/strong&gt; too? I have clearly made the naive assumption that the plugin would sort the sendmail part but some action is required on my part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, I'm a noob. Guidance appreciated. &lt;/p&gt;&#xA;" OwnerUserId="9003" LastEditorUserId="57" LastEditDate="2018-11-09T00:33:13.827" LastActivityDate="2020-09-03T05:18:40.460" Title="Contact Form Setup on Craft CMS" Tags="&lt;templating&gt;&lt;entries&gt;&lt;plugin-contactform&gt;&lt;plugin-contactformextensions&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28373" PostTypeId="2" ParentId="28372" CreationDate="2018-11-09T00:43:39.917" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I would assume I need to make a section/entry for the contact/thanks page?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily.  You could just make a &lt;code&gt;templates/contact/thanks.html&lt;/code&gt; file and that would resolve.  You can also change that value to whatever you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ redirectInput('neato') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you'd put a &lt;code&gt;templates/neato.html&lt;/code&gt; file in place it would load.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do I need to create a page for contact-form/send too?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with the Contact Form Extensions plugin, but if the submissions are making it into the database, then that &lt;code&gt;contact-form/send&lt;/code&gt; controller endpoint is probably being hit properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your email settings are working properly under Settings-&gt;Email in the Control Panel (you can test with the &quot;Test&quot; button), then there can be other reasons why emails aren't being delivered you could check:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/guides/troubleshooting-email-errors#dealing-with-email-delivery-issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/troubleshooting-email-errors#dealing-with-email-delivery-issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/guides/why-doesnt-craft-send-emails&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/why-doesnt-craft-send-emails&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-09T00:43:39.917" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28374" PostTypeId="2" ParentId="12977" CreationDate="2018-11-09T09:33:34.877" Score="3" Body="&lt;p&gt;Probably you are caching the page. You can't cache a sprout form. The csrf will be the same for all the users.&lt;/p&gt;&#xA;" OwnerUserId="9005" LastActivityDate="2018-11-09T09:33:34.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28375" PostTypeId="1" AcceptedAnswerId="28378" CreationDate="2018-11-09T10:52:45.217" Score="2" ViewCount="70" Body="&lt;p&gt;Hi i really would like some advise on best practices on setting up some data for my Craft APP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of my documents will be linked to vehicle make/model/trim/year. EG Audi A5 Sport 2009-2016 and/Or Audi A5 Sportback 2017+ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to do this? Would it be to create a new field type or use something like a table?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My First Idea was to do the following:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A Structure&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Level 1 : Vehicle Make&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Level 2 : Vehicle Model&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Level 3 : Vehicle Trim&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then create a field (table) where i select either the trim or model, then select a date range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what i want to do is in the front end select documents by everything under Make and/or Model and/or Trim and/or Year&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But i am not sure this is the best solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone recommend?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2018-11-09T14:21:46.253" Title="Craft CMS 3 data structure advice for vehicle make, model, trim, year tagging" Tags="&lt;craft3&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;table-field&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28376" PostTypeId="1" AcceptedAnswerId="28377" CreationDate="2018-11-09T13:34:36.993" Score="2" ViewCount="138" Body="&lt;p&gt;I’m trying to use a plugin to set up a site route that will direct every page request to a special template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I’ve set up in my plugin file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;    {&#xA;        return array(&#xA;            '*' =&amp;gt; 'special/index',&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the above doesn’t seem to do anything. If I replace * with a word, then try to visit that URL I get something different but not my template.&#xA;would love it if someone could put me right here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&#xA;If I change tact a bit and route to a controller using a specific url then I can see it gets there&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function registerSiteRoutes()&#xA;    {&#xA;        return array(&#xA;            'beer' =&amp;gt; array('action'=&amp;gt;'beer/index'),&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to catch &lt;em&gt;all&lt;/em&gt; requests  using &lt;code&gt;*&lt;/code&gt; doesn't appear to do anything&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&#xA;@robin helped me out massively here with some more info outside the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically  in Craft 2 the plugin routes get called first no matter what. So I can hijack the init method to load my special template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2 &#xA;I made this into a Craft 2 plugin. &#xA;&lt;a href=&quot;https://github.com/moresoda/craft-emergency-mode&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/moresoda/craft-emergency-mode&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3 plugin coming soon.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-11-14T21:01:18.327" LastActivityDate="2018-11-14T21:01:18.327" Title="Set a route for all requests within a plugin" Tags="&lt;plugin-development&gt;&lt;routes&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28377" PostTypeId="2" ParentId="28376" CreationDate="2018-11-09T14:13:58.717" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#catchall-route&quot; rel=&quot;nofollow noreferrer&quot;&gt;catch all route &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'catchAll' =&amp;gt; ['site/offline'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For yii1 you can also do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'&amp;lt;url:(.*)&amp;gt;' =&amp;gt; 'controller/action'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-11-09T14:13:58.717" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28378" PostTypeId="2" ParentId="28375" CreationDate="2018-11-09T14:21:46.253" Score="2" Body="&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Filter documents by related vehicle characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first idea would be to create it as such:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create an assets volume where all your documents will be uploaded to.&lt;/li&gt;&#xA;&lt;li&gt;Create a vehicle category group for your vehicles such as you already defined (the structure you mentioned)&lt;/li&gt;&#xA;&lt;li&gt;Add 2 fields to the assets volume:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Vehicle (category field)&lt;/li&gt;&#xA;&lt;li&gt;Year (date field)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This will allow you to add the relevant data to each document. You can than &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/asset-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;display&lt;/a&gt; the documents on your frontend and search/filter them by category and/or date. &#xA;How you do that is up to you, either with Twig serverside or with VueJS for example client side.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-11-09T14:21:46.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28379" PostTypeId="2" ParentId="28361" CreationDate="2018-11-09T18:28:24.627" Score="1" Body="&lt;p&gt;Calendar's event recurrences are only simulated/inflated by a repeat rule for the main event. Since there is no database entry for each recurrence, there's unfortunately no way to achieve something like this at this time.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-11-09T18:28:24.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28380" PostTypeId="1" AcceptedAnswerId="28405" CreationDate="2018-11-09T19:16:38.403" Score="2" ViewCount="38" Body="&lt;p&gt;I'm creating a new Craft 3 site and migrating a lot of content from a wordpress setup. I'm wondering if it is better to separate assets into more sources - thus reducing the number of files per directory. An example would be a different asset source per section. Or is it fine to lump them all into one large directory? Is there any performance advantage to the former?&lt;/p&gt;&#xA;" OwnerUserId="877" LastActivityDate="2018-11-12T22:46:56.263" Title="Multiple Asset source question" Tags="&lt;assets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28382" PostTypeId="1" CreationDate="2018-11-10T09:40:55.177" Score="2" ViewCount="126" Body="&lt;p&gt;I have tried to save a custom field of &quot;user field&quot; type which resulted in this error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Failed to set unsafe attribute&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$order-&amp;gt;setAttributes(array(&#xA;    'operatorUid' =&amp;gt; Craft::$app-&amp;gt;user-&amp;gt;id&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has anyone encountered a similar issue or can you let me know how to save a custom userType field to an order?&lt;/p&gt;&#xA;" OwnerUserId="9010" LastEditorUserId="57" LastEditDate="2018-11-12T22:26:47.280" LastActivityDate="2018-11-12T22:26:47.280" Title="saving user field type custom field - Failed to set unsafe attribute" Tags="&lt;custom-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28383" PostTypeId="2" ParentId="28382" CreationDate="2018-11-10T10:29:32.553" Score="3" Body="&lt;p&gt;In order to set field values there is &lt;code&gt;setFieldValue&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$element-&amp;gt;setFieldValue('fieldHandle', [Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;id]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All relation fields only accept the values as an array &lt;code&gt;[1]&lt;/code&gt; rather than integer &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2018-11-10T10:29:32.553" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28384" PostTypeId="1" AcceptedAnswerId="28403" CreationDate="2018-11-10T14:59:49.840" Score="2" ViewCount="245" Body="&lt;p&gt;I need to find out if any changes have been made to the entry on successful save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using events &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/events-reference.html#entries-onbeforesaveentry&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries.onBeforeSaveEntry&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/v2/plugins/events-reference.html#entries-onsaveentry&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries.onSaveEntry&lt;/a&gt; seems to be a way to do it. Maybe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I pass some entry variables as arguments to the function on event listener?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    $oldVar = &quot;&quot;;&#xA;&#xA;    //Event: onBeforeSaveEntry&#xA;    craft()-&amp;gt;on('entries.beforeSaveEntry', function (Event $event)&#xA;    {&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;        $oldVar     = $entryModel-&amp;gt;fieldVar;&#xA;    });&#xA;&#xA;    //Event: onSaveEntry&#xA;    craft()-&amp;gt;on('entries.saveEntry', function (Event $event)&#xA;    {&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;        $newVar     = $entryModel-&amp;gt;fieldVar;&#xA;&#xA;        if ( $oldVar !== $newVar ){&#xA;            // ...&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="180" LastEditDate="2018-11-21T08:26:57.847" LastActivityDate="2018-11-21T08:26:57.847" Title="Is it possible to pass a variable to an event in a plugin?" Tags="&lt;plugin-development&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28385" PostTypeId="1" CreationDate="2018-11-10T16:03:12.667" Score="1" ViewCount="59" Body="&lt;p&gt;I am trying to learn Craft and since I don't know how to create a form with one text area and a button. On the button press, I want to redirect to another html found in the template directory, I am messing around with Craft's contact form to get the desired functionality. I had this code which was working fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;    {{ redirectInput('contact/thanks.html?from={fromName}') }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-name&quot;&amp;gt;Your Name&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-email&quot;&amp;gt;Your Email&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;subject&quot;&amp;gt;Subject&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{{ message.subject ?? '' }}&quot;&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{{ message.message ?? '' }}&amp;lt;/textarea&amp;gt;&#xA;    {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I did to only have one textbox and a button, I removed a lot of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;    {{ redirectInput('contact/thanks.html?from={fromName}') }}&#xA;&#xA;&#xA;    &amp;lt;h3&amp;gt;&amp;lt;label for=&quot;from-email&quot;&amp;gt;From&amp;lt;/label&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Send&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My thanks.html has the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Thank you {{ craft.app.request.getQueryParam('from') }} will contact you soon&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before changing the code, the redirect worked fine and I was getting the 'from' replaced after the 'Thank you'. After I changed the code, on pressing the button the page refreshes but nothing happens and it doesn't get redirected to the thanks.html page. Please help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, kindly direct me to the documentation which tells in detail about front end development in Craft as the official documentation is very vague (or seems vague to me :( )&lt;/p&gt;&#xA;" OwnerUserId="8983" LastEditorUserId="273" LastEditDate="2018-11-11T04:01:47.427" LastActivityDate="2018-11-12T23:04:46.803" Title="Help needed for a simple form" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28386" PostTypeId="2" ParentId="566" CreationDate="2018-11-10T19:11:02.070" Score="9" Body="&lt;p&gt;multiply by 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ 12.50 * 1 }} == 12.5&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ 12.0 * 1 }} == 12&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9012" LastEditorUserId="9012" LastEditDate="2018-11-11T10:00:37.380" LastActivityDate="2018-11-11T10:00:37.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28387" PostTypeId="1" CreationDate="2018-11-10T21:21:39.817" Score="1" ViewCount="190" Body="&lt;p&gt;Some of the changes in craft 3 have been killing me. I know Yii does validation using the public &lt;code&gt;rules&lt;/code&gt; function. Here is a rules function I grabbed from the &lt;strong&gt;MatrixBlockType model.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function rules()&#xA;{&#xA;    return [&#xA;        [['id', 'fieldId', 'sortOrder'], 'number', 'integerOnly' =&amp;gt; true],&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is simple. I for the life of me can't find where the validator &lt;code&gt;number&lt;/code&gt; is defined. I'm assuming it validates using Yii's &lt;code&gt;NumberValidator.php&lt;/code&gt; function but can't verify that. Any ideas on &lt;strong&gt;where I can find the number validator?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9013" LastEditorUserId="57" LastEditDate="2018-11-12T22:27:27.390" LastActivityDate="2018-11-12T22:27:27.390" Title="Craft Rules and Validation" Tags="&lt;craft3&gt;&lt;validation&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28388" PostTypeId="2" ParentId="28387" CreationDate="2018-11-10T21:27:10.480" Score="2" Body="&lt;p&gt;I just figured out the answer so I'm going to post it if anyone else is asking this question. Yii accepts aliases as well as function/class names when evaluating the rules function. When using &lt;code&gt;number&lt;/code&gt; you're really &lt;strong&gt;using an alias&lt;/strong&gt; that points to the &lt;code&gt;yii\validators\NumberValidator&lt;/code&gt; class. &lt;strong&gt;See &lt;code&gt;yii2/validators/Validator.php&lt;/code&gt; to see a list of default aliases created by Yii.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9013" LastActivityDate="2018-11-10T21:27:10.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28389" PostTypeId="1" AcceptedAnswerId="28390" CreationDate="2018-11-11T00:02:02.117" Score="2" ViewCount="84" Body="&lt;p&gt;I've set up a Resources section on a multi-site installation with the type of Channel. For Site 1 I've set the routing rule to be &lt;code&gt;{resourcesParent.one.slug}/{slug}&lt;/code&gt; and for Site 2 I've set the rule as &lt;code&gt;{slug}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cHZlO.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cHZlO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for Site 1 a resource titled &lt;code&gt;sample-resource&lt;/code&gt; would resolve to &lt;code&gt;www.example.com/parent-slug/sample-resource&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for Site 2 it would resolve as &lt;code&gt;sub.example.com/sample-resource&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything works fine for Site 1, however when I go to &lt;code&gt;sub.example.com/sample-resource&lt;/code&gt; I get a &quot;template not found: sample-resource&quot; 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like this should work so I'm not sure what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I just noticed that &lt;code&gt;sub.example.com/parent-slug/sample-resource&lt;/code&gt; is resolving, so I think something's wrong with my config. Here's what I have for my dev environment in &lt;code&gt;craft/config/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;    'siteUrl' =&amp;gt; array(&#xA;        '//www.example.com',&#xA;        '//sub.example.com'&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2018-11-11T00:12:15.697" LastActivityDate="2018-11-11T00:45:18.797" Title="Second Site Channel URL Route Not Working" Tags="&lt;routing&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28390" PostTypeId="2" ParentId="28389" CreationDate="2018-11-11T00:45:18.797" Score="1" Body="&lt;p&gt;I forgot to add &lt;code&gt;define('CRAFT_SITE', 'sub');&lt;/code&gt; to the &lt;code&gt;index.php&lt;/code&gt; file on my Site 2 web root.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-11-11T00:45:18.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28394" PostTypeId="1" AcceptedAnswerId="28415" CreationDate="2018-11-12T00:45:16.853" Score="0" ViewCount="1169" Body="&lt;p&gt;Apologies if this has come up before. I did check but the previous post referred to version 2.x and was regarding a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up 2 image transforms for images but nothing works. The assets folder is writable. Files upload without issues and I can crop them, rotate them, etc. but Image Transforms don't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what the issue could be?&lt;/p&gt;&#xA;" OwnerUserId="9018" LastActivityDate="2018-11-14T03:38:13.113" Title="Image Transforms not happening" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28395" PostTypeId="1" CreationDate="2018-11-12T12:42:01.273" Score="2" ViewCount="283" Body="&lt;p&gt;I want to modify this query so that the dated entries are sorted in descending order on a custom field called 'startDate'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have tried adding &lt;code&gt;.order('startDate')&lt;/code&gt; to the end of the &lt;code&gt;craft.entries(query)...&lt;/code&gt; but this causes any entry with a startDate to be excluded from the query. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Maybe it's possible to set the order on just the &lt;code&gt;{% for entry in programmeEntriesDated...&lt;/code&gt; loop?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = { section: 'programme' } %}&#xA;{% set query = category is defined ? query | merge({ relatedTo: category }) : query %}&#xA;{% set programmeEntriesDated = craft.entries(query) %}&#xA;&#xA;{# Show programme entries if available #}&#xA;{% if programmeEntriesDated|length %}&#xA;&amp;lt;div class=&quot;flex flex-wrap flex-row-ns&quot;&amp;gt;&#xA;  {# DATED ENTRIES #}&#xA;  {% for entry in programmeEntriesDated if (&#xA;        (entry.startDate|date('Y-m-d') &amp;gt;= now|date('Y-m-d'))&#xA;    or  (entry.endDate is not null and entry.endDate|date('Y-m-d') &amp;gt;= now|date('Y-m-d'))&#xA;    ) and&#xA;        (entry.type != 'old_programme_entry')&#xA;    and (entry.isOngoing == 0)&#xA;  %}&#xA;    {% include &quot;_blocks/event_single.html&quot; with { 'blockWidth' : 'w-100 w-third-ns' } %}&#xA;  {% endfor %}&#xA;&#xA;  {# ONGOING ENTRIES  #}&#xA;  {% for entry in programmeEntriesDated if (entry.isOngoing) and&#xA;        (entry.type != 'old_programme_entry')&#xA;  %}&#xA;    {% include &quot;_blocks/event_single.html&quot; with { 'blockWidth' : 'w-100 w-third-ns' } %}&#xA;  {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="7356" LastEditDate="2018-11-12T12:47:50.353" LastActivityDate="2018-11-12T12:47:50.353" Title="Order entries by custom date field" Tags="&lt;datetime&gt;&lt;ordering&gt;&lt;craft2&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28396" PostTypeId="1" CreationDate="2018-11-12T12:50:19.343" Score="3" ViewCount="28" Body="&lt;p&gt;Is it possible to store partial dates? EG i want to create a document that covers a date range, sometimes that range could be Jan/2013 to JUN/2014 other times we may need it more specific EG 20/JAN/2013 to FEB 2014 and sometimes even less specific like 2013-2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would i need to create a new custom field type?&lt;/p&gt;&#xA;" OwnerUserId="9007" LastActivityDate="2018-11-12T14:01:11.993" Title="Partial Dates within Craft" Tags="&lt;field&gt;&lt;fieldtypes&gt;&lt;custom-fieldtype&gt;&lt;custom-field&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28397" PostTypeId="2" ParentId="28396" CreationDate="2018-11-12T13:56:06.210" Score="1" Body="&lt;p&gt;I'd set this up with regular date fields. You can then display the dates in whatever format you require on the front end using Twig's date formatting filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the data stored as dates you can do a lot more with it compared to simply storing strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to show a date range, such as &quot;2013-2015&quot; then it would probably be best to use 2 fields. A &quot;date from&quot; and a &quot;date to&quot; field. You could then use some logic to display one, or both, depending on whether there was something in the &quot;date to&quot; field.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-11-12T14:01:11.993" LastActivityDate="2018-11-12T14:01:11.993" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28398" PostTypeId="1" AcceptedAnswerId="28414" CreationDate="2018-11-12T14:50:35.960" Score="1" ViewCount="193" Body="&lt;p&gt;I try to finish a plugin which imports data into my craftcms project. I already created a console based method/service, which I trigger/run in my shell. Inside my method(s) I receive data &lt;code&gt;(XML or JSON)&lt;/code&gt; I parse my data and try to create and fill an entry of a specific channel I already created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;&quot;saveElement()&quot;&lt;/code&gt; which doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some tuts and informations for craftcms v2 (for example: &lt;a href=&quot;https://docs.craftcms.com/api/v2/craft-entriesservice.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v2/craft-entriesservice.html#public-methods&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i am stuck and i can not find any informations on how to solve this with craftcms v3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my last version of code after hours of different trys :(&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('testentry');&#xA;$entryTypes = $section-&amp;gt;getEntryTypes();&#xA;$entryType = $entryTypes[0];&#xA;// Save Entry&#xA;//$entry = new EntryModel();&#xA;$entry = new \craft\elements\Entry();&#xA;$entry-&amp;gt;sectionId = $section-&amp;gt;id;&#xA;$entry-&amp;gt;typeId = $entryType-&amp;gt;id;&#xA;//$entry-&amp;gt;locale = Craft::$app-&amp;gt;i18n-&amp;gt;getPrimarySiteLocaleId();&#xA;//$entry-&amp;gt;authorId = 1;  // TODO:  Set author&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;postDate = $post['post_date'];&#xA;$entry-&amp;gt;slug = $post['post_name'];&#xA;//      $entry-&amp;gt;getContent()-&amp;gt;title = $post['post_title'];&#xA;//      $entry-&amp;gt;setContentFromPost(array(&#xA;//          'body' =&amp;gt; $postContent,&#xA;//          'categoryCareer' =&amp;gt; NULL,&#xA;//      ));&#xA;&#xA;if (Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry)) {&#xA;    $result = true;&#xA;} &#xA;else {&#xA;    echo 'Could not save the Job entry.'.&quot;\n&quot;;&#xA;    $result = false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8529" LastEditorUserId="180" LastEditDate="2018-11-12T20:37:25.520" LastActivityDate="2018-11-13T22:16:09.427" Title="Craft 3 plugin to import channel entries" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;plugins&gt;&lt;import&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28399" PostTypeId="1" CreationDate="2018-11-12T14:55:36.287" Score="1" ViewCount="146" Body="&lt;p&gt;About matrix block fields handles: should they be unique ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance if I have a matrix with handle &lt;code&gt;galleryMatrix&lt;/code&gt;,&#xA;than should I name my block &lt;code&gt;galleryMatrixImage&lt;/code&gt; or just &lt;code&gt;image&lt;/code&gt;?&#xA;And than my fields in my block: &lt;code&gt;galleryMatrixImageName&lt;/code&gt;, &lt;code&gt;galleryMatrixImageAsset&lt;/code&gt; or &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;asset&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not quite sure about how to manage these handles the proper way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would prefer being able to name them with short handles, but i'm not sure if they have to be unique within a block, or unique for a whole website ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9020" LastEditorUserId="50" LastEditDate="2018-11-14T00:49:04.090" LastActivityDate="2018-11-14T00:49:04.090" Title="Best practices to name Matrix fields handles" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28400" PostTypeId="2" ParentId="28399" CreationDate="2018-11-12T15:31:46.320" Score="1" Body="&lt;p&gt;They only have to be unique within a block. So your initial idea would be best. &#xA;Have a &lt;code&gt;galleryMatrix&lt;/code&gt; field with an &lt;code&gt;image&lt;/code&gt; block and fields with handles &lt;code&gt;imgName&lt;/code&gt; and &lt;code&gt;imgAsset&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think you can use &lt;code&gt;name&lt;/code&gt; as a handle, because it is a reserved word. &lt;code&gt;Asset&lt;/code&gt; may be possible.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-11-12T15:31:46.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28401" PostTypeId="2" ParentId="28385" CreationDate="2018-11-12T17:21:25.817" Score="1" Body="&lt;p&gt;I recommend the tutorial &lt;a href=&quot;https://craftquest.io/courses/how-to-create-craft-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftquest.io/courses/how-to-create-craft-plugin&lt;/a&gt; Now, It is free after registration. After 1/2h you have your own plugin with settings and form with controller. Simple, straightforward, with craft form component. Your code is quite messy, try tutorial.&lt;/p&gt;&#xA;" OwnerUserId="8838" LastEditorUserId="8838" LastEditDate="2018-11-12T23:04:46.803" LastActivityDate="2018-11-12T23:04:46.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28402" PostTypeId="1" AcceptedAnswerId="28406" CreationDate="2018-11-12T19:59:15.757" Score="0" ViewCount="654" Body="&lt;p&gt;I use Google storage for photos. The Google storage volume is mapped to a bucket's subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c5A3Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c5A3Q.png&quot; alt=&quot;google storage bucket subfolder as a volume&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately these appear as subfolders in assets, along with a set of repeated folder structure. I did not create these. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VLw43.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VLw43.png&quot; alt=&quot;undesirable folders auto-created by craft&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way to prevent CraftCMS from creating them? What is the cause they get created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Is it possible that they are the remainder of subfolders which I created on the filesystem before setting up the assets to use google storage? I did delete the local storage assets volume between creating the google storage one. But, the local storage did have the ahtletes/photos in the local assets folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this time, the local assets folder does not have the athletes/photos subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand what action or process creates these folders?&lt;/p&gt;&#xA;" OwnerUserId="4691" LastEditorUserId="57" LastEditDate="2018-11-12T22:34:28.643" LastActivityDate="2018-11-13T01:04:15.613" Title="Craft 3 auto-creates sub-folders in assets. How can I prevent this?" Tags="&lt;craft3&gt;&lt;assets&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28403" PostTypeId="2" ParentId="28384" CreationDate="2018-11-12T20:48:17.377" Score="2" Body="&lt;p&gt;This will not work as the field value will be the new value in both events. You'll need to get the old value from the entry that exists in Craft before saving the new entry, and then perform the comparison. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the value has changed then store the entry ID to process once the entry has successfully saved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;code&gt;$entryIdChanged&lt;/code&gt; variable in the anonymous event functions is not in the same as that in the &lt;code&gt;init()&lt;/code&gt; method. You can resolve this as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bring the &lt;code&gt;$entryIdChanged&lt;/code&gt; variable into the anonymous functions using the &lt;code&gt;use&lt;/code&gt; operator.  &lt;/li&gt;&#xA;&lt;li&gt;PHP will by default &quot;pass by value&quot;, meaning that if the value of the variable within the function is changed, it does not get changed outside of the function. So you should pass the variable in &quot;by reference&quot;, using an ampersand &lt;code&gt;&amp;amp;&lt;/code&gt; before the variable name, which will change it outside the function as well.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;See the PHP guide on &lt;a href=&quot;http://php.net/manual/en/language.references.pass.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Passing by Reference&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;&#xA;    $entryIdChanged = null;&#xA;&#xA;    // Event: onBeforeSaveEntry&#xA;    craft()-&amp;gt;on('entries.beforeSaveEntry', function (Event $event) use (&amp;amp;$entryIdChanged)&#xA;    {&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;        $newVar     = $entryModel-&amp;gt;fieldVar;&#xA;&#xA;        $oldEntry = craft()-&amp;gt;entries-&amp;gt;getEntryById($entryModel-&amp;gt;id);&#xA;        $oldVar = $oldEntry !== null ? $oldEntry-&amp;gt;fieldVar : '';&#xA;&#xA;        if ($oldVar !== $newVar){&#xA;            $entryIdChanged = $entryModel-&amp;gt;id;&#xA;        }&#xA;    });&#xA;&#xA;    // Event: onSaveEntry&#xA;    craft()-&amp;gt;on('entries.SaveEntry', function (Event $event) use ($entryIdChanged)&#xA;    {&#xA;        $entryModel = $event-&amp;gt;params['entry'];&#xA;&#xA;        if ($entryModel-&amp;gt;id === $entryIdChanged){&#xA;            // ...&#xA;        }&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2018-11-21T08:25:11.153" LastActivityDate="2018-11-21T08:25:11.153" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="28405" PostTypeId="2" ParentId="28380" CreationDate="2018-11-12T22:46:56.263" Score="2" Body="&lt;p&gt;For most sites, there probably wouldn't be a difference, but if you're purely looking at performance and your site has a large number of assets, then 20 sources with 5,000 images and folders in each is going to scale better than a single source with 100,000 images and folders in them.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-12T22:46:56.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28406" PostTypeId="2" ParentId="28402" CreationDate="2018-11-13T01:04:15.613" Score="1" Body="&lt;p&gt;My guess would be your Asset Indexes are out of sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go to Settings-&gt;Utilities in the Control Panel, there is one that says &quot;Update Asset Indexes&quot;.  Click it, let it run and you might be prompted to resolve some out-of-sync indexes.  Once you do that, it should work normally.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-13T01:04:15.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28407" PostTypeId="1" CreationDate="2018-11-13T01:42:30.993" Score="1" ViewCount="271" Body="&lt;p&gt;I need your help, please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At &lt;a href=&quot;https://docs.craftcms.com/v3/installation.html#step-1-download-craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/installation.html#step-1-download-craft&lt;/a&gt; I have this instruction:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;To create a new Craft project, run this command (substituting  with the path where Composer should create the project): composer create-project craftcms/craft &quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I get &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;[InvalidArgumentException] .Could not find package craftcms/users/lestone2 with stability stable&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;on entering &lt;code&gt;composer create-project craftcms/Users/lestone2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the same message on entering &lt;code&gt;php composer.phar create-project craftcms/Users/lestone2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me to set up the instruction correctly? Or do I have a permissions issue? (I am logged on as the admin.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found one related question at: &lt;a href=&quot;https://stackoverflow.com/questions/36897084/could-not-open-input-file-composer&quot;&gt;https://stackoverflow.com/questions/36897084/could-not-open-input-file-composer&lt;/a&gt; but the issue there is not the same as mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I downloaded v1.7.3 of composer at &lt;a href=&quot;https://getcomposer.org/download/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/download/&lt;/a&gt; , and the file's integrity was confirmed.&lt;/p&gt;&#xA;" OwnerUserId="9022" LastEditorUserId="57" LastEditDate="2018-11-14T00:29:04.203" LastActivityDate="2018-11-14T00:29:04.203" Title="InvalidArgumentException with composer" Tags="&lt;php&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28408" PostTypeId="2" ParentId="28407" CreationDate="2018-11-13T03:58:35.950" Score="1" Body="&lt;p&gt;You're just entering the command slightly wrong is all. Where you go:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer create-project craftcms/Users/lestone2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer create-project craftcms/craft /path/to/project&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The craftcms/craft bit isn't a directory, it's vendor/package. The path to where you want your project to be (including the name) comes after. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2018-11-13T03:58:35.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28411" PostTypeId="1" CreationDate="2018-11-13T11:24:28.777" Score="1" ViewCount="184" Body="&lt;p&gt;I'd like to create an entry in Craft that talks about a new discount, and then choose that discount via a field (so a bit like you can choose an entry or a product). That way, should the parameters of the discount change, I'm not having to manually update the information in the entry to match any changes to the discount details. Is there a plugin for this?&lt;/p&gt;&#xA;" OwnerUserId="7312" LastActivityDate="2018-11-13T12:27:31.990" Title="Commerce discount promotions as a fieldtype?" Tags="&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;fieldtypes&gt;&lt;relatedto&gt;&lt;promotions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28412" PostTypeId="2" ParentId="28411" CreationDate="2018-11-13T12:27:31.990" Score="3" Body="&lt;p&gt;That field type doesn’t currently exist, but it wouldn’t be hard to &lt;a href=&quot;https://docs.craftcms.com/v3/extend/field-types.html#registering-custom-field-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;create it&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s the relevant code you’d need if you want to take a stab at it:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use Craft;&#xA;use craft\base\ElementInterface;&#xA;use craft\commerce\models\Discount;&#xA;use craft\commerce\Plugin as Commerce;&#xA;&#xA;// ...&#xA;&#xA;public function normalizeValue($value, ElementInterface $element = null)&#xA;{&#xA;    if ($value !== null) {&#xA;        return Commerce::getInstance()-&amp;gt;discounts-&amp;gt;getDiscountById($value);&#xA;    }&#xA;&#xA;    return $value;&#xA;}&#xA;&#xA;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    $options = [];&#xA;    foreach (Commerce::getInstance()-&amp;gt;discounts-&amp;gt;getAllDiscounts() as $discount) {&#xA;        $options[] = ['value' =&amp;gt; $discount-&amp;gt;id, 'label' =&amp;gt; $discount-&amp;gt;name];&#xA;    }&#xA;&#xA;    /** @var Discount|null $value */&#xA;    return Craft::$app-&amp;gt;view-&amp;gt;renderTemplate('_includes/forms/select', [&#xA;        'id' =&amp;gt; $this-&amp;gt;handle,&#xA;        'name' =&amp;gt; $this-&amp;gt;handle,&#xA;        'options' =&amp;gt; $options,&#xA;        'value' =&amp;gt; $value-&amp;gt;id ?? null,&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With that, the field type’s value would always either be a &lt;a href=&quot;https://docs.craftcms.com/commerce/api/v2/craft-commerce-models-discount.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discount model&lt;/a&gt; or &lt;code&gt;null&lt;/code&gt;, so in your templates you could do this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.myDiscountField %}&#xA;    Code: &amp;lt;code&amp;gt;{{ entry.myDiscountField.code }}&amp;lt;/code&amp;gt;&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could pull this off with a simple Plain Text field that stores a discount code, and then fetch the discount manually from your template.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.myDiscountCodeField %}&#xA;    {% set discount = craft.commerce.discounts.getDiscountByCode(entry.myDiscountCodeField) %}&#xA;{% else %}&#xA;    {% set discount = null %}&#xA;{% endif %}&#xA;&#xA;{% if discount %}&#xA;    Code: &amp;lt;code&amp;gt;{{ discount.code }}&amp;lt;/code&amp;gt;&#xA;    ...&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-11-13T12:27:31.990" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28413" PostTypeId="1" CreationDate="2018-11-13T13:16:30.137" Score="0" ViewCount="259" Body="&lt;p&gt;We've a Craft 3 site hosted with Digital Ocean (Serverpilot set-up) with the DNS routed through Cloudflare.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The client has experienced issues uploading large ZIP files to (c140MB), returning a 413 error. After updating the PHP conf to enable larger files and tweaked the Nginx conf realised that the issue was with Cloudflare file upload limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having set up a subdomain for the site to bypass Cloudflare we are now getting 500 errors in the browser console when trying to upload large files through the Craft control panel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;POST https://admin.site.com/index.php?p=admin/actions/assets/save-asset 500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are no errors in the server logs and nothing showing up in the Craft debug toolbar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on debugging and resolving this issue or on what might be causing the 500 error?&lt;/p&gt;&#xA;" OwnerUserId="992" LastEditorUserId="57" LastEditDate="2018-11-14T21:53:51.873" LastActivityDate="2018-11-14T21:53:51.873" Title="Large file upload, 500 server error" Tags="&lt;craft3&gt;&lt;assets&gt;&lt;error&gt;&lt;upload&gt;&lt;server&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28414" PostTypeId="2" ParentId="28398" CreationDate="2018-11-13T22:16:09.427" Score="0" Body="&lt;p&gt;As per your comments, the title field is required and causing a validation error. This can be resolved simply by setting the title.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;title = 'The Title';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can output the validation errors to be notified of any issues with saving the entries as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($result === false) {&#xA;    \Craft:dd($entry-&amp;gt;getErrors());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-11-13T22:16:09.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28415" PostTypeId="2" ParentId="28394" CreationDate="2018-11-14T03:38:13.113" Score="0" Body="&lt;p&gt;What Mike Pierce said in the comments above is your answer; Craft doesn't create the image transforms until you ask for them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for instance, in a &lt;code&gt;index.twig&lt;/code&gt; file you might do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.someAsset.getUrl() }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...which would output the image. If instead you wanted to output the image transformed based on one of the transforms you made in the AdminCP, you'd do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ entry.someAsset.getUrl(&quot;someTransform&quot;) }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...where &lt;code&gt;someTransform&lt;/code&gt; is the &lt;em&gt;handle&lt;/em&gt; to the transform you created in the AdminCP backend. Craft will then perform the image transform, and it'll output the transformed image on the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next time that the same transform on the same image is requested, rather than doing the transform all over again, it'll just use the already transformed image that it's saved to disk.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-14T03:38:13.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28417" PostTypeId="2" ParentId="23113" CreationDate="2018-11-14T13:37:10.080" Score="1" Body="&lt;p&gt;This note is a &quot;thank you&quot; to the commentators above. After a few hours of &quot;slugging&quot; (starting with the effort to download composer), here is what worked for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Which database driver ... : mysql&#xA;Database server name or IP ... : 127.0.0.1&#xA;Database port: [3306] 8889 (note: via MAMP)&#xA;Database username: [root] root&#xA;Database password:&#xA;Database name: EnergyAudit&#xA;Database table prefix (type &quot;none&quot; for none): Probs&#xA;Testing database credentials ... success!&#xA;Saving database credentials to your .env file ... done&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9029" LastEditorUserId="57" LastEditDate="2018-11-14T23:29:18.023" LastActivityDate="2018-11-14T23:29:18.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28418" PostTypeId="1" CreationDate="2018-11-14T13:43:41.787" Score="1" ViewCount="1333" Body="&lt;p&gt;The installation instructions say: &quot;A few seconds later, you should have a working Craft install!&#xA; ... If it was successful, Craft will redirect your browser to the Control Panel.&quot; My installation route was Terminal, and all I have at the end is &quot;*** installed Craft successfully (time: 53.862s)&quot;. So, please help me to find the URL where I can start learning to use this design facility. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9029" LastActivityDate="2018-11-15T00:36:01.673" Title="What is the Control Panel URL?" Tags="&lt;control-panel&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28419" PostTypeId="1" AcceptedAnswerId="28421" CreationDate="2018-11-14T14:02:08.543" Score="1" ViewCount="177" Body="&lt;p&gt;I have an entry field that is a selector tool for the page call to action at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel of four or five entries and I'd like one of them to be the default selection so it's one less thing to setup on a site full of pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't seen any details or questions for this sort of request as of yet so I thought I'd ask the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Jay&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-11-14T14:22:15.867" Title="Setting a default entry for the entry field" Tags="&lt;entry&gt;&lt;field&gt;&lt;channels&gt;&lt;default&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28420" PostTypeId="2" ParentId="28418" CreationDate="2018-11-14T14:10:03.163" Score="2" Body="&lt;p&gt;The default URL to access Craft is &lt;code&gt;/admin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also this can be changed to anything you like using the &lt;code&gt;cpTrigger&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#cptrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;config variable&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2018-11-14T14:10:03.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28421" PostTypeId="2" ParentId="28419" CreationDate="2018-11-14T14:16:55.377" Score="2" Body="&lt;p&gt;&lt;em&gt;Entry fields do not natively support setting a default entry, but you can use the &lt;a href=&quot;https://docs.craftcms.com/v3/globals.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Globals&lt;/strong&gt;&lt;/a&gt; section to achieve the same effect.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a 'Default Call to Action Entry' field in your globals, and set the default entry for all pages there. For extra functionality, I would then also have a 'Call to Action Entry' field on your entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this set-up, a user can select a custom entry to use on that entry if they want, but by default it will fall-back to the entry selected in the Globals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your template would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set ctaEntry = entry.callToActionEntry.one|default('globalHandle.defaultCallToActionEntry.one') %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you didn't want to build the ability to override the default entry on a per-page basis, you can just use the field in the Globals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set ctaEntry = globalHandle.defaultCallToActionEntry.one %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastEditorUserId="344" LastEditDate="2018-11-14T14:22:15.867" LastActivityDate="2018-11-14T14:22:15.867" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28422" PostTypeId="1" AcceptedAnswerId="28424" CreationDate="2018-11-14T15:04:39.123" Score="1" ViewCount="79" Body="&lt;p&gt;I have come up with the following code to group entries by categories;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set hotTubs = craft.entries()&#xA;  .section('newHotTubs')&#xA;  .orderBy('price asc')&#xA;%}&#xA;&#xA;{% set hotTubsCats = craft.categories()&#xA;  .group('newHotTubBrands')&#xA;  .relatedTo(hotTubs)&#xA;%}&#xA;&#xA;{% block content %}&#xA;&#xA;  {# Loop the categories #}&#xA;  {% for category in hotTubsCats.all() %}&#xA;&#xA;    {{ category.title }}&#xA;&#xA;    {# Get and loop through entries related to this cat #}&#xA;    {% set hotTubs = craft.entries.relatedTo(category) %}&#xA;    {% for entry in hotTubs.all() %}&#xA;      {% include '_includes/blocks/related-tub-new' %}&#xA;    {% endfor %}&#xA;&#xA;  {% endfor %}&#xA;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I wanted to check if this is the most efficient approach or if this could be improved upon?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-11-14T15:28:11.823" Title="Grouping entries by category - most efficient approach" Tags="&lt;categories&gt;&lt;group&gt;&lt;best-practice&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28423" PostTypeId="1" CreationDate="2018-11-14T15:26:58.903" Score="1" ViewCount="282" Body="&lt;p&gt;I've got a basic image transform in a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set crop = {&#xA;    mode: 'crop',&#xA;    width: 560,&#xA;    height: 550,&#xA;    quality: 80&#xA;} %}&#xA;&#xA;&amp;lt;img src=&quot;{{ image.getUrl(crop) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once the transforms are generated for a page, it seems like changes to the focal point don't trigger a regeneration of the image transform. Altering the template code (eg. from &lt;code&gt;quality: 80&lt;/code&gt; to &lt;code&gt;quality: 79&lt;/code&gt;) &lt;em&gt;does&lt;/em&gt; trigger the regeneration of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behavior?&lt;/p&gt;&#xA;" OwnerUserId="3904" LastActivityDate="2018-12-07T13:18:00.123" Title="Craft isn't regenerating the image transform when the focal point changes" Tags="&lt;image-transforms&gt;&lt;focal-point&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28424" PostTypeId="2" ParentId="28422" CreationDate="2018-11-14T15:28:11.823" Score="5" Body="&lt;p&gt;One improvement I think could be made is to fetch only the ID's of your hotTubs entries at the start of your code. You're only using this to get the related categories and fetching ID's is faster than fetching the actual elements. The relatedTo parameter works perfectly with ID's. So that could speed up things.&#xA;You can drop the orderBy parameter also as this doesn't have any effect there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set hotTubs = craft.entries()&#xA;  .section('newHotTubs')&#xA;  .ids()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-11-14T15:28:11.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28426" PostTypeId="2" ParentId="28418" CreationDate="2018-11-14T15:52:58.757" Score="1" Body="&lt;p&gt;You need to configure your local development environment. You need a web server with a host and domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, using MAMP Pro, I would set up a host for say, local.mytestsite.dev and have it serve files from the @web directory within the Craft 3 installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would use &lt;code&gt;local.mytestsite.dev/admin&lt;/code&gt; to get to the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is all dependant on how you have set up your system.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-11-14T15:52:58.757" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28427" PostTypeId="1" CreationDate="2018-11-14T17:37:05.527" Score="1" ViewCount="754" Body="&lt;p&gt;How do I add the html code to the head of my website in Craft CMS? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to install a plugin, or is there somewhere I can access the code?&lt;/p&gt;&#xA;" OwnerUserId="9031" LastEditorUserId="57" LastEditDate="2018-11-14T23:32:52.143" LastActivityDate="2018-11-15T10:52:50.420" Title="How to add Facebook pixel code to my website" Tags="&lt;getheadhtml&gt;&lt;headers&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28429" PostTypeId="1" CreationDate="2018-11-14T19:53:08.263" Score="2" ViewCount="87" Body="&lt;p&gt;I am using redactor plugin for my field type and I want to use global values of the same field type to be used as pre-fill value when creating a new entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each year there is an edition of a program with more or less the same text (multiple fields), but minor adjustments can occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by creating a new edition (entry) in the control panel, I want to already pre-fill the standard values of the fields (configured as a global)&#xA;Then I can update, if necessary, some text for this new edition and save it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="9009" LastActivityDate="2018-11-15T12:36:13.517" Title="Pre-fill fields when creating an entry in CP" Tags="&lt;entries&gt;&lt;redactor&gt;&lt;fieldtypes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28430" PostTypeId="1" CreationDate="2018-11-14T20:01:38.350" Score="1" ViewCount="85" Body="&lt;p&gt;I am building a german calendar and am struggling having one language throughout all datetime outputs. The website is set to lang = de but the outputs of the solspace calendar is still english.&lt;/p&gt;&#xA;" OwnerUserId="7812" LastEditorUserId="7812" LastEditDate="2018-11-22T17:13:05.393" LastActivityDate="2019-04-21T18:02:15.533" Title="How do I assign a language to all datetime outputs" Tags="&lt;templating&gt;&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28431" PostTypeId="2" ParentId="28427" CreationDate="2018-11-14T20:44:16.943" Score="2" Body="&lt;p&gt;Craft makes no assumptions on how your site should be built so it's impossible for us to say exactly where to put the pixel code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would add the code to whichever template you needed it in. This depends entirely on how your site is put together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oftentimes the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; portion will be within your main &lt;code&gt;_layout&lt;/code&gt; file but that is not necessarily always the case. This file can also be anywhere within your templates directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft 2, look in your &lt;code&gt;/craft/templates&lt;/code&gt; directory&#xA;For Craft 3, look in your &lt;code&gt;/templates&lt;/code&gt; directory&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2018-11-15T10:52:50.420" LastActivityDate="2018-11-15T10:52:50.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28432" PostTypeId="1" CreationDate="2018-11-14T21:14:23.157" Score="3" ViewCount="31" Body="&lt;p&gt;Currently, this is NEARLY doing what I want except instead of the output being entries that do NOT have the id, it's output is ONLY the entries with the id.  I'm not sure why, since I've included the 'not' keyword within the parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = &#xA;craft.entries.section('driverPositions').limit(null).relatedTo('not' , 7192) %}&#xA;&#xA;{% for entry in entries.order('state, city').limit(null) %}&#xA;&#xA;&amp;lt;option value=&quot;{{entry.url}}&quot;&amp;gt;{{ entry.state }} - {{ entry.city }}&amp;lt;/option&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9032" LastActivityDate="2018-11-16T04:11:54.840" Title="Output values from all entries in a specific section EXCEPT those with a specific category id" Tags="&lt;categories&gt;&lt;entry&gt;&lt;category&gt;&lt;output&gt;&lt;id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28434" PostTypeId="2" ParentId="22309" CreationDate="2018-11-15T00:09:44.520" Score="2" Body="&lt;p&gt;Documentation has been added for this: &lt;a href=&quot;https://docs.craftcms.com/v3/localization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/localization.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7801" LastActivityDate="2018-11-15T00:09:44.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28435" PostTypeId="2" ParentId="28418" CreationDate="2018-11-15T00:11:47.940" Score="1" Body="&lt;p&gt;For those using a Mac, who are not prof. developers, and who used Terminal to get successful installation, I provide the following steps, which have worked for me.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;After you get the message which says that installation was successful, search for a folder named “craftcms” inside the folder that has your own User files, within the “Users” folder.  For example, on my Mac, the “craftcms” is inside “lestone2” folder, where we have ‘Macintosh HD&gt;Users&gt;lestone2’ as the pathway.  I would advise you to place a copy of this valuable folder in off-line storage somewhere.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Head over to the folder named “htdocs”, whose pathway is ‘Macintosh HD&gt;Applications&gt;MAMP&gt;htdocs’.  Move a copy of the “craftcms” folder inside htdocs. (It is a good idea to confirm that you have moved all the hidden files in the process.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to your browser and enter what will be your analog of “&lt;a href=&quot;http://localhost:8888/craftcms/web/admin/dashboard&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888/craftcms/web/admin/dashboard&lt;/a&gt;&quot; , and you will land right at the Control Panel. (N.B. All this assumes you have already adopted MAMP and have used it to set up a database with at least one test table at MySQL, you have instructed MAMP to “turn on servers” and the port for  the turned-on Apache is some number like the 8888 you see above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Good luck! &lt;/p&gt;&#xA;" OwnerUserId="9029" LastEditorUserId="57" LastEditDate="2018-11-15T00:36:01.673" LastActivityDate="2018-11-15T00:36:01.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28436" PostTypeId="1" CreationDate="2018-11-15T01:38:19.127" Score="1" ViewCount="110" Body="&lt;p&gt;We just migrated a site from Craft 2 to Craft 3 and I'm running into an issue with some redirects we used to have setup in Sprout SEO. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our site runs a Craft CMS backend with a Nuxt frontend along with a 3rd vanity URL. We used to have Sprout SEO setup in a way that all requests to the vanity URL would get redirected to the main domain running on Nuxt. However, it seems that Sprout now appends the Base URL to the redirect along with using the 'Sites' functionality in Craft 3, which has effectively broken the redirects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I guess my question comes down to this: is there a good way in Sprout to redirect from one domain to another like was possible in the Craft 2 instance? And if not, is there a different way to do so within Craft? We want to be able to give our content team the ability to add redirects rather than hardcoding them in the nginx config.&lt;/p&gt;&#xA;" OwnerUserId="8182" LastActivityDate="2018-11-15T01:38:19.127" Title="Sprout SEO: Redirect to Separate Domain" Tags="&lt;craft3&gt;&lt;plugin-sproutseo&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28437" PostTypeId="2" ParentId="28432" CreationDate="2018-11-15T02:18:13.803" Score="3" Body="&lt;p&gt;You can get the entry IDs that have are related to the category and then exclude them from the all the entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryIdsWithCategory = &#xA;craft.entries.section('driverPositions').relatedTo('7192').limit(null).ids() %}&#xA;&#xA;{% set entryIdsWithoutCategory = craft.entries.section('driverPositions').limit(null).ids()|without(entryIdsWithCategory) %}&#xA;&#xA;{% set entries = craft.entries.section('businesses').limit(null).id(entryIdsWithoutCategory).order('state, city') %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;option value=&quot;{{entry.url}}&quot;&amp;gt;{{ entry.state }} - {{ entry.city }}&amp;lt;/option&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="50" LastEditorUserId="50" LastEditDate="2018-11-16T04:11:54.840" LastActivityDate="2018-11-16T04:11:54.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28438" PostTypeId="1" CreationDate="2018-11-15T08:01:28.263" Score="1" ViewCount="54" Body="&lt;p&gt;In the front-end, I create a form and submit the data to backend. In the controller, if got some errors, I would like to redirect to the previous page with some information&lt;a href=&quot;https://craftcms.stackexchange.com&quot;&gt;.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9034" LastEditorUserId="9034" LastEditDate="2018-11-21T07:25:40.847" LastActivityDate="2018-11-21T07:25:40.847" Title="How to redirect the page" Tags="&lt;plugin-sproutseo&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-12-03T20:49:35.300" ContentLicense="CC BY-SA 4.0" />
  <row Id="28439" PostTypeId="2" ParentId="28427" CreationDate="2018-11-15T09:41:09.397" Score="1" Body="&lt;p&gt;If you're using SEOmatic for Craft3 it has a setting to add facebook pixel and various other tracking scripts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/seomatic&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic github&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastActivityDate="2018-11-15T09:41:09.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28440" PostTypeId="2" ParentId="28429" CreationDate="2018-11-15T12:36:13.517" Score="2" Body="&lt;p&gt;This functionality could be created in a plugin or module, but why wouldn't you &lt;strong&gt;duplicate&lt;/strong&gt; the entry and change the fields you need to change?&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-15T12:36:13.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28443" PostTypeId="1" AcceptedAnswerId="28458" CreationDate="2018-11-15T17:32:16.777" Score="2" ViewCount="480" Body="&lt;p&gt;I am having trouble getting the related category passed thru to the entry api endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cant use :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;        $criteria-&amp;gt;id = $catId;&#xA;        $category = $criteria-&amp;gt;first();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the equivalent in craft 3 api v2?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/v1/ship/category/&amp;lt;catId:\d+&amp;gt;.json' =&amp;gt; function($catId) {&#xA;//old api craft 2&#xA;        $criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category);&#xA;        $criteria-&amp;gt;id = $catId;&#xA;        $category = $criteria-&amp;gt;first();&#xA;&#xA;//api craft 3&#xA;        return [&#xA;            'elementType' =&amp;gt; Entry::class,&#xA;            'elementsPerPage' =&amp;gt; 30,&#xA;            'criteria' =&amp;gt; [&#xA;                'criteria' =&amp;gt; ['section' =&amp;gt; 'ship'],&#xA;                'relatedTo' =&amp;gt; ['targetElement' =&amp;gt; $category],&#xA;            ],&#xA;            'transformer' =&amp;gt; function(Entry $entry) {&#xA;                return [&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'id' =&amp;gt; (int) $entry-&amp;gt;id,&#xA;                    'slug' =&amp;gt; $entry-&amp;gt;slug,&#xA;                    'postDate' =&amp;gt; $entry-&amp;gt;postDate&#xA;                ];&#xA;            },&#xA;            'pretty' =&amp;gt; true&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2018-11-17T12:41:13.180" LastActivityDate="2019-05-12T04:14:49.557" Title="Element-API migration - entries by category" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28445" PostTypeId="2" ParentId="11579" CreationDate="2018-11-15T23:25:53.567" Score="2" Body="&lt;p&gt;Don't forget to rewrite &quot;?p=&quot; as well...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# remove index.php&#xA;RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]&#xA;RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC]&#xA;RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]&#xA;&#xA;# remove ?p=&#xA;RewriteCond %{THE_REQUEST} ^GET\ /\?(([^&amp;amp;\s]*&amp;amp;)*)p=([^&amp;amp;\s]+)&amp;amp;?([^\s]*)&#xA;RewriteRule ^(.*)$ /%3?%1%4 [L,R=301]&#xA;&#xA;# send would-be 404 requests to craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5873" LastActivityDate="2018-11-15T23:25:53.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28446" PostTypeId="1" CreationDate="2018-11-16T01:06:35.707" Score="2" ViewCount="93" Body="&lt;p&gt;&lt;code&gt;{% paginate %}&lt;/code&gt; tag takes current subpapage number from url address. Can this behaviour be bypassed and page number be passed directly into &lt;code&gt;{% paginate %}&lt;/code&gt; tag?&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2018-11-17T00:30:26.063" Title="Manually passing page number to paginate tag" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28449" PostTypeId="1" AcceptedAnswerId="28462" CreationDate="2018-11-16T14:41:59.583" Score="2" ViewCount="332" Body="&lt;p&gt;Am I correct in saying you cannot search for specific text in a table field. e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Table Fields Might hold the following data:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SKU1&lt;/li&gt;&#xA;&lt;li&gt;SKU2&lt;/li&gt;&#xA;&lt;li&gt;SKU3&lt;/li&gt;&#xA;&lt;li&gt;SKU33&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I then want to search for items that only return SKU3 not SKU33.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;body::salty&lt;/code&gt; search will not work because i believe the field is stored as JSON.&lt;/p&gt;&#xA;" OwnerUserId="9007" LastEditorUserId="57" LastEditDate="2018-11-17T01:18:52.900" LastActivityDate="2018-11-18T00:56:17.917" Title="Query Craft CMS Table Field for exact values" Tags="&lt;search&gt;&lt;table-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28450" PostTypeId="2" ParentId="28449" CreationDate="2018-11-16T17:22:58.393" Score="2" Body="&lt;p&gt;Yeah because the data is stored as a JSON blob, I'm not sure this is going to be possible without retrieving all the data, parsing the JSON, then doing the exact match search via PHP, and then returning the results subset.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-11-16T19:59:32.727" LastActivityDate="2018-11-16T19:59:32.727" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28451" PostTypeId="1" CreationDate="2018-11-16T17:44:06.377" Score="3" ViewCount="267" Body="&lt;p&gt;This really stressing me out!&#xA;When trying to log back in to Craft CMS today after som time my password wouldn´t work. I have not changed it and when trying to reset the password I´m only getting: &quot;There was a problem sending the password reset email.&quot;&#xA;Is there anyway to find out through eg. my FTP and looking at the backend what the &quot;user/password&quot; is set to and what my reset email is set to?&#xA;I have not changed any of this, but since I´m locked out now something must have happened..&lt;/p&gt;&#xA;" OwnerUserId="9041" LastActivityDate="2018-11-16T18:24:18.390" Title="Locked out of my Account, how to get back in?" Tags="&lt;error&gt;&lt;admin&gt;&lt;login&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28452" PostTypeId="1" AcceptedAnswerId="28705" CreationDate="2018-11-16T18:02:00.167" Score="1" ViewCount="259" Body="&lt;p&gt;Scenario: I want to programatically bulk resave entries in a certain Site in a certain Section of a certain Type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Craft 3 Module with a Console Controller containing following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionResaveEntries()&#xA;{&#xA;    $site = Craft::$app-&amp;gt;sites-&amp;gt;getSiteById(self::SITE_ID);&#xA;    $section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionById(self::SECTION_ID);&#xA;    $entryType = Craft::$app-&amp;gt;sections-&amp;gt;getEntryTypeById(self::ENTRY_TYPE_ID);&#xA;&#xA;    Craft::$app-&amp;gt;getQueue()-&amp;gt;push(new ResaveElements([&#xA;        'description' =&amp;gt; Craft::t('app', 'Resaving {section}, {type} entries', [&#xA;            'section' =&amp;gt; $section, 'type' =&amp;gt; $entryType-&amp;gt;name,&#xA;        ]),&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; [&#xA;            'siteId' =&amp;gt; $site-&amp;gt;id,&#xA;            'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;            'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;            'status' =&amp;gt; null,&#xA;            'enabledForSite' =&amp;gt; true&#xA;        ]&#xA;    ]));&#xA;&#xA;    $result = 'something';&#xA;    echo &quot;Resaving entries\n&quot;;&#xA;    return $result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works as expected when running &lt;code&gt;./craft resave-entries-module/resave-entries/resave-entries&lt;/code&gt; from the command line &amp;amp; also via a cron job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I now want to modify my code to run &lt;code&gt;Craft::$app-&amp;gt;getQueue()-&amp;gt;push(new ResaveElements()&lt;/code&gt; only under certain conditions. Specifically, when a deadline (custom date/time field in entry type) has passed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried following, but it doesn't run at all regardless if before or after deadline date. The conditional seems to be ignored.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionResaveEntries()&#xA;{&#xA;    $site = Craft::$app-&amp;gt;sites-&amp;gt;getSiteById(self::SITE_ID);&#xA;    $section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionById(self::SECTION_ID);&#xA;    $entryType = Craft::$app-&amp;gt;sections-&amp;gt;getEntryTypeById(self::ENTRY_TYPE_ID);&#xA;&#xA;    $entries = Entry::find()&#xA;        -&amp;gt;siteId(self::SITE_ID)&#xA;        -&amp;gt;sectionId(self::SECTION_ID)&#xA;        -&amp;gt;typeId(self::COMP_ENTRY_TYPE_ID)&#xA;        -&amp;gt;all();&#xA;&#xA;    foreach ($entries as $entry) {&#xA;        // Set deadline&#xA;        $deadline = $entry-&amp;gt;competitionJudgingEnd;&#xA;        // Check if after deadline&#xA;        $now = new DateTime();&#xA;        if ($now &amp;gt; $deadline) {&#xA;            Craft::$app-&amp;gt;getQueue()-&amp;gt;push(new ResaveElements([&#xA;                'description' =&amp;gt; Craft::t('app', 'Resaving {section}, {type} entries', [&#xA;                    'section' =&amp;gt; $section, 'type' =&amp;gt; $entryType-&amp;gt;name,&#xA;                ]),&#xA;                'elementType' =&amp;gt; Entry::class,&#xA;                'criteria' =&amp;gt; [&#xA;                    'siteId' =&amp;gt; $site-&amp;gt;id,&#xA;                    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;                    'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;                    'status' =&amp;gt; null,&#xA;                    'enabledForSite' =&amp;gt; true&#xA;                ]&#xA;            ]));&#xA;&#xA;            //$result = 'something';&#xA;            echo &quot;Resaving entries\n&quot;;&#xA;            //return $result;&#xA;        } else {&#xA;            //$result = 'nothing';&#xA;            echo &quot;Not resaving entries\n&quot;;&#xA;            //return $result;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In an effort to troubleshoot, I changed the conditional to &lt;code&gt;if ($entry-&amp;gt;title == &quot;A known title&quot;)&lt;/code&gt;, but it also seems to be ignored. I.e. resave not occurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong, and what can I do to get this working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 01:&lt;/strong&gt; The conditionals are actually working. There are 3 entries that meet criteria in &lt;code&gt;$entries = Entry::find()&lt;/code&gt;. However, the loop seems to be stop at the first entry. This entry changes if I change the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 02:&lt;/strong&gt; It looks like the &lt;code&gt;return $result;&lt;/code&gt; was breaking the loop. Updated code above by commenting out return statements.&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-11-16T22:18:28.860" LastActivityDate="2018-12-07T17:57:44.637" Title="How can I conditionally resave entries based on the value of an entry's field in a Craft 3 Module/Plugin?" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;plugins&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28453" PostTypeId="2" ParentId="28451" CreationDate="2018-11-16T18:24:18.390" Score="5" Body="&lt;p&gt;This is not actually my answer since it's from Andrew Welch on Twitter here: &lt;a href=&quot;https://mobile.twitter.com/nystudio107/status/1063135843441954816&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mobile.twitter.com/nystudio107/status/1063135843441954816&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If you have access to MySQL, you can change the admin user password to &lt;code&gt;secret&lt;/code&gt; using this hash:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;$2y$13$FfVKvo1W1N5Gsba3c19r8uz.x9R5NRQgRu8jmXvOjVCStg1sKGcoW&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="349" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2018-11-16T18:24:18.390" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28454" PostTypeId="1" CreationDate="2018-11-16T20:38:58.327" Score="1" ViewCount="50" Body="&lt;p&gt;I'm very new to Craft and recently built my first Craft-powered website (locally) and it works fantastic. Now, I want to move it to production, and I'm having trouble. Locally, everything went very smooth with Composer but unfortunately, I can't do that on my hosting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went through the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Made a database backup through the Craft admin&lt;/li&gt;&#xA;&lt;li&gt;Made a new database my website and imported it&lt;/li&gt;&#xA;&lt;li&gt;Moved all files from local to production&lt;/li&gt;&#xA;&lt;li&gt;Changed &lt;code&gt;.env&lt;/code&gt; with the correct credentials and info&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But after this, I only get blank pages (both index and admin)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am i missing? Is there a better way (without using Composer) to deploy?&lt;/p&gt;&#xA;" OwnerUserId="9042" LastEditorUserId="4169" LastEditDate="2018-11-17T00:19:23.467" LastActivityDate="2018-11-17T00:19:23.467" Title="Blank pages after moving from Local development to Production" Tags="&lt;deployment&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28456" PostTypeId="2" ParentId="28446" CreationDate="2018-11-17T00:30:26.063" Score="2" Body="&lt;p&gt;If you're looking to display a set of Elements that &lt;em&gt;simulate&lt;/em&gt; a paginated query, you might actually be looking for the &lt;code&gt;offset&lt;/code&gt; Query parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of fetching a “page” of results based on a number of &lt;code&gt;entriesPerPage&lt;/code&gt; and the number of &lt;code&gt;pagesToSkip&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set customPageOfEntries = craft.entries()&#xA;    .offset(entriesPerPage * pagesToSkip)&#xA;    .limit(entriesPerPage)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this doesn't include the ability to see how many pages of results you have, or to generate links to other pages of results.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-11-17T00:30:26.063" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28457" PostTypeId="2" ParentId="27923" CreationDate="2018-11-17T01:16:47.890" Score="1" Body="&lt;p&gt;Currently (as of Craft 3.0), it will affect entry and category share links.  Some additional things might be using it in the upcoming 3.1 and plugins are free to use it for whatever they want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in Commerce 2, it is used for creating product preview share links.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-17T01:16:47.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28458" PostTypeId="2" ParentId="28443" CreationDate="2018-11-17T12:41:26.573" Score="1" Body="&lt;p&gt;Solved it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//categories&#xA;    'api/v1/ship/category/&amp;lt;catId:\d+&amp;gt;.json' =&amp;gt; function($catId) {&#xA;        return [&#xA;            'elementType' =&amp;gt; Category::class,&#xA;            'criteria'    =&amp;gt; ['id'   =&amp;gt; $catId],&#xA;            'paginate'    =&amp;gt; false,&#xA;            'transformer' =&amp;gt; function(Category $category) {&#xA;                $entries = Entry::find()-&amp;gt;relatedTo($category)-&amp;gt;all();&#xA;&#xA;                $en=[];&#xA;                foreach($entries as $entry) {&#xA;&#xA;&#xA;                    //Final return&#xA;                    $en[]= [&#xA;                        &quot;type&quot; =&amp;gt; &quot;shipItem&quot;,&#xA;                        'sendtoseafarerhelp' =&amp;gt; $entry-&amp;gt;sendToSeafarerHelp,&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                        'categoryTitle' =&amp;gt; $entry-&amp;gt;shipCategory[0]-&amp;gt;title,&#xA;                        'categorySlug' =&amp;gt; $entry-&amp;gt;shipCategory[0]-&amp;gt;slug,&#xA;                        'categoryUrl' =&amp;gt; $entry-&amp;gt;shipCategory[0]-&amp;gt;uri,&#xA;                        'summary' =&amp;gt; $entry-&amp;gt;shipIntroText,&#xA;                        'descripton' =&amp;gt; $entry-&amp;gt;shipDescription,&#xA;                        'pdfs' =&amp;gt; $pdfs,&#xA;                        'thumbs' =&amp;gt; $thumbs,&#xA;                        'sponsors' =&amp;gt; $sponsors                            &#xA;                    ];&#xA;                }&#xA;&#xA;                return [&#xA;                    'title'   =&amp;gt; $category-&amp;gt;title,&#xA;                    'entries' =&amp;gt; $en&#xA;                ];&#xA;            }&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-11-17T12:41:26.573" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28459" PostTypeId="2" ParentId="554" CreationDate="2018-11-17T17:28:05.883" Score="2" Body="&lt;p&gt;I know this post is old, but I'd like to share another technique I've been using for the past year. If you need a &quot;hard-coded&quot; navigation with no editing capabilities in the admin but still want dynamic information from the section ID number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use multilingual sites, this is super practical because it will get the correct language page title, URL and check if it's currently active.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;                    &#xA;    {% set homepage = craft.entries.id(13).one() %}&#xA;    &amp;lt;a href=&quot;{{ homepage.getUrl }}&quot; {% if craft.app.request.absoluteUrl == homepage.url %} class=&quot;active&quot;{% endif %}&amp;gt;{{ homepage.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&amp;lt;li&amp;gt;                    &#xA;    {% set about = craft.entries.id(23).one() %}&#xA;    &amp;lt;a href=&quot;{{ about.getUrl }}&quot; {% if craft.app.request.absoluteUrl == about.url %} class=&quot;active&quot;{% endif %}&amp;gt;{{ about.title }}&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see in the example above I get 2 pages for my navigation, home and about pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this helps out someone in the near future.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-11-17T17:28:05.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28460" PostTypeId="1" CreationDate="2018-11-17T21:42:30.790" Score="2" ViewCount="252" Body="&lt;p&gt;Has anyone tried using the Craft reCAPTCHA plugin from Matt West? The issue I am experiencing is that if a Contact Form is submitted without ticking the reCAPTCHA widget, the form does not submit - that's good! - but there is no error message posted on the form page to remind the user to 'prove they are human'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions! &lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="57" LastEditDate="2018-11-18T01:00:21.247" LastActivityDate="2019-12-03T07:48:35.687" Title="Craft reCAPTCHA Plugin (Matt West)" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;plugin-recaptcha&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28462" PostTypeId="2" ParentId="28449" CreationDate="2018-11-18T00:56:17.917" Score="1" Body="&lt;p&gt;If you're looking to see if the search term matches &lt;em&gt;any&lt;/em&gt; row/column value in the field, then it should work: &lt;code&gt;myTableFieldHandle::SKU3&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking to find the exact row/column that matched, you'd have to do some custom development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though a table field's data is stored as a JSON blob in the Craft content table, search index keywords are extracted from every row/column and saved as a single row in the search index table.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-18T00:56:17.917" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28463" PostTypeId="1" CreationDate="2018-11-18T03:02:15.260" Score="1" ViewCount="76" Body="&lt;p&gt;Craft Commerce Digital Products:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why aren't there checkboxes next to the product names so I can delete multiple items at once?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It exists in regular Craft Commerce Products.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="4102" LastEditDate="2018-11-19T17:07:08.743" LastActivityDate="2018-11-19T21:51:40.717" Title="Craft Commerce Digital Products delete multiples" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28464" PostTypeId="1" AcceptedAnswerId="28465" CreationDate="2018-11-18T13:53:47.403" Score="1" ViewCount="38" Body="&lt;p&gt;I'm looking for a way to restrict how a field gets formatted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a channel for a podcast that should always be in the format of hh:mm:ss - despite the instructions making this clear, editors tend to ignore and invariably we end up with 45.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can take that input and format appropriately or even alert on the frontend that what they've given doesn't validate?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2018-11-18T14:18:15.740" Title="Field formatting" Tags="&lt;validation&gt;&lt;format&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28465" PostTypeId="2" ParentId="28464" CreationDate="2018-11-18T14:18:15.740" Score="2" Body="&lt;p&gt;What about using a table field with a column for HH/MM/SS, with each one restricted to numbers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KL2az.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KL2az.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could use &lt;a href=&quot;https://github.com/fruitstudios/craft-validateit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/fruitstudios/craft-validateit&lt;/a&gt; with a custom regex rule, but I've no idea what that would need to be.&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-11-18T14:18:15.740" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28466" PostTypeId="1" CreationDate="2018-11-18T15:12:30.377" Score="2" ViewCount="301" Body="&lt;p&gt;My users have a relationship field called Organisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my plugin, I am trying to fetch all users that are related to the organisation I pass it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT I would like ALL users including Pending, so those who have not verified their email and set a password yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using this code but it only fetches the verified users, not pending. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = craft\elements\User::find();&#xA;&#xA;$relatedEntries = $entries-&amp;gt;relatedTo(&#xA;    array(&#xA;        'targetElement' =&amp;gt; $organisationId, &#xA;        'field'         =&amp;gt; 'organisation'&#xA;    )&#xA;);&#xA;&#xA;// Fetch all entries&#xA;$relatedEntries = $relatedEntries-&amp;gt;all(); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried using combinations of -&gt;status(null), e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = craft\elements\User::find();&#xA;&#xA;    $relatedEntries = $entries-&amp;gt;relatedTo(&#xA;        array(&#xA;            'targetElement' =&amp;gt; $organisationId, &#xA;            'field'         =&amp;gt; 'organisation'&#xA;        )&#xA;    );&#xA;&#xA;    // Fetch all entries&#xA;    $relatedEntries = $relatedEntries-&amp;gt;status(null)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = craft\elements\User::find()-&amp;gt;status(null);&#xA;&#xA;    $relatedEntries = $entries-&amp;gt;relatedTo(&#xA;        array(&#xA;            'targetElement' =&amp;gt; $organisationId, &#xA;            'field'         =&amp;gt; 'organisation'&#xA;        )&#xA;    );&#xA;&#xA;    // Fetch all entries&#xA;    $relatedEntries = $relatedEntries-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But they always just show all verified users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have changed my logic and database setup a bit, and so decided to try using just template tags now. And so I got it working OK using .status(null with template tags. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set organisations = craft.entries().section('suppliers').authorId(currentUser.id) %}&#xA;&#xA;{% for organisation in organisations %}&#xA;&#xA;    {% set users = craft.users().relatedTo(organisation).status(null %}&#xA;    {% for user in users %}&#xA;        {{user.firstName}} {{user.lastName}} - {{user.status}}&amp;lt;br/&amp;gt;&#xA;    {% endfor%}&#xA;&#xA;{% endfor%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="4993" LastEditDate="2018-11-20T18:45:43.677" LastActivityDate="2019-04-19T20:02:25.447" Title="How to fetch ALL users related to a field, including unverified/pending?" Tags="&lt;craft3&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28467" PostTypeId="2" ParentId="28438" CreationDate="2018-11-18T16:20:42.333" Score="1" Body="&lt;p&gt;If you're using the Pixel &amp;amp; Tonic Contact Form plugin then there is a way to set your redirect using &lt;code&gt;{{ redirectInput('contact/thanks') }}&lt;/code&gt; as seen here: &lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've just noticed you've tagged this question with &lt;code&gt;plugin-sproutseo&lt;/code&gt;, but I'm not aware of that plugin interacting with contact forms in any way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To more specifically try to answer your question, firstly to redirect and pass some information, I have used query params before so I've set my redirect link to be &lt;code&gt;/thankyou?name={{ formstuff.name }}&lt;/code&gt; so I can access the user's name with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set name = craft.app.request.getParam('name') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when it comes to redirecting back to the user's previous page, have a read of this answer below. It's a few years old, but it'd potentially still give you an option to resolve your issue: &lt;a href=&quot;https://craftcms.stackexchange.com/a/13488/5845&quot;&gt;https://craftcms.stackexchange.com/a/13488/5845&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: After a look at some other questions, I've noticed this one has an almost identical wording so this one should be marked as duplicate. See dupe below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/28433/how-to-redirect-the-page-with-params&quot;&gt;How to redirect the page with params?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-11-18T16:20:42.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28469" PostTypeId="1" CreationDate="2018-11-18T22:08:49.820" Score="1" ViewCount="1105" Body="&lt;p&gt;I get this message while trying to access embedded Asset with the plugin &lt;strong&gt;Embedded Assets 1.0.2&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Calling unknown method: craft\web\twig\variables\CraftVariable::embeddedAssets()&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was fiddling around with the code all evening and aint got no idea,&#xA;how to get embedded Assets out of my matrix block.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% case &quot;externeLinks&quot; %}&#xA;&#xA;        {% for asset in block.externalAssets.all() %} &#xA;&#xA;        {% set embeddedAsset = craft.embeddedAssets.get(asset) %}&#xA;            {{ embeddedAsset ? embeddedAsset.html }}&#xA;        {% endfor %}&#xA;&#xA;{% endswitch %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If someone could help me, I would really appreciate it. I am new to Craft. If you need any more code, I will provide it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9047" LastEditorUserId="57" LastEditDate="2018-11-20T03:26:20.877" LastActivityDate="2018-11-20T03:26:20.877" Title="Calling unknown method: craft\web\twig\variables\CraftVariable::embeddedAssets()" Tags="&lt;templating&gt;&lt;plugin-embeddedassets&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28470" PostTypeId="1" AcceptedAnswerId="28493" CreationDate="2018-11-18T23:44:25.287" Score="1" ViewCount="85" Body="&lt;p&gt;Can I resolve full URL to some object - entry or category, from inside Twig template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mind you, I don't mean searching for something by slug, but by full URL. So, for example, instead of passing &lt;code&gt;'some-slug'&lt;/code&gt; to function, i want to pass &lt;code&gt;'some-category/some-subcategory/some-slug'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to to this, because i want to create breadcrumbs links based on &lt;code&gt;craft.request.segments&lt;/code&gt; object. So, i need to look up for entry object for &lt;code&gt;some-category&lt;/code&gt;, then entry for &lt;code&gt;some-category/some-subcategory/&lt;/code&gt; and then for &lt;code&gt;some-category/some-subcategory/some-slug&lt;/code&gt; (well, i dont really need last one because its just page im on currently).&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="9038" LastEditDate="2018-11-20T19:07:22.517" LastActivityDate="2018-11-20T20:55:23.840" Title="Resolve url from inside template" Tags="&lt;url&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28471" PostTypeId="2" ParentId="26502" CreationDate="2018-11-19T03:56:05.850" Score="2" Body="&lt;p&gt;Here is something I'm using. It traverses the url segments and loads the associated entry to build the breadcrumb (using Bootstrap 4.x) - Not sure this is the most efficient/correct way, but hopefully this helps someone:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.segments %}&#xA;&amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-sm-12&quot;&amp;gt;&#xA;            &amp;lt;nav aria-label=&quot;breadcrumb&quot;&amp;gt;&#xA;              &amp;lt;ol class=&quot;breadcrumb&quot;&amp;gt;&#xA;                &amp;lt;li class=&quot;breadcrumb-item&quot;&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% for segment in craft.request.segments %}&#xA;                {% set segmentEntries = craft.entries.slug(segment).find() %}&#xA;                {% for segmentEntry in segmentEntries %}&#xA;                    {% if segmentEntry.id == entry.id %}&#xA;                    &amp;lt;li class=&quot;breadcrumb-item&quot;&amp;gt;{{ segmentEntry.title }}&amp;lt;/li&amp;gt;&#xA;                    {% else %}&#xA;                    &amp;lt;li class=&quot;breadcrumb-item&quot;&amp;gt;&amp;lt;a href=&quot;{{ segmentEntry.url }}&quot;&amp;gt;{{ segmentEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;                {% endfor %}&#xA;              &amp;lt;/ol&amp;gt;&#xA;            &amp;lt;/nav&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Built using code from this thread as inspiration: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1655/what-is-the-best-way-to-create-breadcrumbs-based-on-a-structure&quot;&gt;What is the best way to create breadcrumbs based on a structure?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7801" LastActivityDate="2018-11-19T03:56:05.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28472" PostTypeId="1" AcceptedAnswerId="28526" CreationDate="2018-11-19T09:37:05.043" Score="1" ViewCount="271" Body="&lt;p&gt;Got Imager running great on my S3 hosted images. However it's cacheing transforms locally on my server. I'd like to save some disc space and have the transforms on S3 too, but struggling to get my config right. I've created a couple of folders on S3 (imagertransforms) and added the following to my imager config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'imagerSystemPath' =&amp;gt; 'imager/',&#xA;'imagerUrl' =&amp;gt; 'https://myaddress.s3.amazonaws.com/_imagertransforms/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doesn't seem to be working though and not sure how best to debug. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2018-11-23T17:11:26.753" Title="Imager Transforms, Cacheing and S3" Tags="&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28474" PostTypeId="1" AcceptedAnswerId="28476" CreationDate="2018-11-19T11:32:28.033" Score="1" ViewCount="119" Body="&lt;p&gt;Does anyone have any recommended boilerpoints or guides on setting up Craft CMS 3 with front-end tooling? Looking for an initial install to be setup properly with a preconfigured database, NPM, node.js, Sass, and page templates configured to get any web project started.&lt;/p&gt;&#xA;" OwnerUserId="5374" LastActivityDate="2018-11-19T15:09:37.327" Title="Craft CMS 3 Boilerpoint Web Project Setups Available?" Tags="&lt;templating&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28475" PostTypeId="2" ParentId="28470" CreationDate="2018-11-19T15:08:51.807" Score="0" Body="&lt;p&gt;Usually I have a {{baseUrl}} defined in config or .env available globally;&#xA;then {{baseUrl}}/{{entry.uri}}&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2018-11-19T15:08:51.807" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28476" PostTypeId="2" ParentId="28474" CreationDate="2018-11-19T15:09:37.327" Score="3" Body="&lt;p&gt;A good starting point would be the nystudio107 or marbles craft scaffolding projects:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/nystudio107/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Marbles/craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Marbles/craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastActivityDate="2018-11-19T15:09:37.327" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28477" PostTypeId="2" ParentId="26502" CreationDate="2018-11-19T15:22:01.673" Score="1" Body="&lt;p&gt;The verbb navigation plugin has a good breadcrumbs service:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/verbb/navigation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/navigation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastActivityDate="2018-11-19T15:22:01.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28478" PostTypeId="1" AcceptedAnswerId="28499" CreationDate="2018-11-19T18:46:39.087" Score="3" ViewCount="1646" Body="&lt;p&gt;i simply can not get my &quot;job&quot; done. I try to create a plugin for Craft, a simple one. It reads some date and should create new entries out of this data. First i stuck on a stupid save-mistake, someone here helped me get my error :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, i  can create and save an entry.&#xA;But i can not add a category, an image or a matrix-based entry.&#xA;I tried several old craft 2 tutorials and got with the categories to Craft::$app-&gt;relations-&gt;saveRelations, but after i got rid of all errors, it saves my entry, create a ne row in my database relation table, but in the entry, i can not find the relation. The database row in relations seems to be incorrect. Last version of my code: i tried to convert this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/16209/saverelations-returning-null&quot;&gt;Problem/Example&lt;/a&gt; into my version in craft 3. No success :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think, if i understand my problem, i will be able to create several relations, because categories, Assets and so on are just types of fields. And they are related to the entries - am i right ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll show my current code.....has anyone a good advise or an example how to add a relation(category) and how to create and add an image asset ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    $section = Craft::$app-&gt;sections-&gt;getSectionByHandle('mychannelentryhandle');&#xA;    $entryTypes = $section-&gt;getEntryTypes();&#xA;    $entryType = $entryTypes[0];&#xA;    $entry = new \craft\elements\Entry();&#xA;    //      $entry-&gt;id = $uid;&#xA;    $entry-&gt;title = $title;&#xA;    $entry-&gt;sectionId = $section-&gt;id;&#xA;    $entry-&gt;typeId = $entryType-&gt;id;&#xA;    $entry-&gt;siteId = 1;&#xA;    $entry-&gt;authorId = 1;&#xA;    $entry-&gt;enabled = true;  // TODO:  Decide if published or not&#xA;    $entry-&gt;postDate = $postDate;&#xA;    $entry-&gt;slug = 'test_' . $uid;&#xA;&#xA;&#xA;&#xA;    if (Craft::$app-&gt;elements-&gt;saveElement($entry)) {&#xA;        echo 'New entry created successfully.';&#xA;&#xA;        // SAVE CATEGORY RELATION&#xA;        $field = Craft::$app-&gt;fields-&gt;getFieldByHandle('categoryfieldhandle');&#xA;        try {&#xA;            $relationsIds[] = $entry-&gt;id;&#xA;            Craft::$app-&gt;relations-&gt;saveRelations($field, $category, $relationsIds);&#xA;        } catch (\Exception $e) {&#xA;            // Something went wrong – return `false` or an error message, log the exception?&#xA;            print_r('ERROR WHILE SAVING CATEGORY');&#xA;            print_r($e-&gt;getMessage());&#xA;            return false;&#xA;        }&#xA;&#xA;        // Save the new Relation&#xA;        Craft::$app-&gt;elements-&gt;saveElement($entry);&#xA;&#xA;        $result = true;&#xA;    } else {&#xA;        echo 'Could not save the new entry.' . &quot;\n&quot;;&#xA;        print_r($entry-&gt;getErrors());&#xA;        $result = false;&#xA;    }&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just testing code, not pretty but functional ;)&lt;/p&gt;&#xA;" OwnerUserId="8529" LastActivityDate="2021-05-18T21:33:21.137" Title="Craft 3 - Save new Entry with Relations (Categories/Assets)" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;assets&gt;&lt;relations&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28479" PostTypeId="1" AcceptedAnswerId="28480" CreationDate="2018-11-19T20:22:49.197" Score="1" ViewCount="27" Body="&lt;p&gt;I recently moved a Craft 2 install from a server running PHP 5.x to one running PHP 7.x. All seems to be well. The custom &quot;system offline&quot; message appears as expected when visiting the home page, anyway. It also appears when visiting a random URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when visiting the admin URL I'm redirected to the installer. I'd obviously rather not do this as the system and DB are already there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have any options here?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="57" LastEditDate="2018-11-20T03:36:48.710" LastActivityDate="2018-11-20T03:36:48.710" Title="Visiting admin brings up the installer" Tags="&lt;admin&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28480" PostTypeId="2" ParentId="28479" CreationDate="2018-11-19T20:50:10.627" Score="3" Body="&lt;p&gt;Sounds like it's viewing the DB as being empty. The access credentials are correct (it's technically connecting to the database), but &lt;strong&gt;it's not seeing any tables in the database.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does your site use a prefix (ie: &lt;code&gt;craft_&lt;/code&gt;) before the database tables? Check to make sure that the prefix specified in &lt;code&gt;config/db.php&lt;/code&gt; matches the actual table prefixes.&lt;/li&gt;&#xA;&lt;li&gt;Double-check to make sure you're connecting to the &lt;em&gt;right&lt;/em&gt; database.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-11-19T20:50:10.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28481" PostTypeId="1" AcceptedAnswerId="28487" CreationDate="2018-11-19T20:54:55.850" Score="1" ViewCount="80" Body="&lt;p&gt;Is it possible to get, from one of the &lt;code&gt;cart.adjustments&lt;/code&gt; of type &lt;code&gt;discount&lt;/code&gt;, whether the discount was added with a coupon code, and if so, what that coupon code is?&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2018-11-20T06:32:13.273" Title="Get discount data from adjustment object" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28482" PostTypeId="2" ParentId="23761" CreationDate="2018-11-19T21:01:34.670" Score="2" Body="&lt;p&gt;To use your G Suite Gmail (business Gmail) with Craft you need to do following.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Admin Console &gt; Security &gt; Basic Settings &gt; Go to settings to less secure apps&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Once you are there, check &lt;em&gt;&quot;&lt;strong&gt;Enforce access to less secure apps for all users&lt;/strong&gt;&quot;&lt;/em&gt; option. It will allow you to log in on Non-Google apps, like a third party mail client or a web application.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Admin Console &gt; Apps &gt; G Suite &gt; Gmail &gt; Advanced settings &gt; Allow per-user outbound gateways&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And check &lt;em&gt;&quot;&lt;strong&gt;Allow users to send mail through an external SMTP server when configuring a &quot;from&quot; address hosted outside your email domains&lt;/strong&gt;&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Allow some time to propagate changes for the last step. To do those changes you must be &quot;Super Admin&quot; or &quot;Admin&quot; with required permission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft's control panel &gt; Email &gt; select SMTP protocol.&#xA;Than follow this &lt;a href=&quot;https://support.google.com/a/answer/9003945&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To connect to Gmail server use settings from the&#xA;&quot;Step 2: Set up your mail client to access Gmail&quot; &gt; Other mail clients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you followed both steps from the Google's answer you should now be able to send a test email.&lt;/p&gt;&#xA;" OwnerUserId="2167" LastEditorUserId="2167" LastEditDate="2018-11-19T21:10:22.970" LastActivityDate="2018-11-19T21:10:22.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28483" PostTypeId="2" ParentId="28463" CreationDate="2018-11-19T21:51:40.717" Score="1" Body="&lt;p&gt;I don't believe there is a technical reason for this, but feel free to make a feature request requesting it: &lt;a href=&quot;https://github.com/craftcms/digital-products/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/digital-products/issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-19T21:51:40.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28484" PostTypeId="1" AcceptedAnswerId="28501" CreationDate="2018-11-19T23:25:42.287" Score="2" ViewCount="263" Body="&lt;p&gt;I have a &lt;strong&gt;people channel&lt;/strong&gt; that historically has used another field to decide if they're a &quot;featured&quot; person or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field set for &quot;&lt;strong&gt;featured&lt;/strong&gt;&quot; people has now diverged from what a normal person has, so I'm wanting to create a new entry type in the people channel (&lt;strong&gt;featuredPeople&lt;/strong&gt;) and programatically shift these people to the new entry type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field set is additive to the old one, so I'm hoping due to there being no field/structural changes this isn't too hard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the bones of a script together to do this, but I'm struggling to find any info on how to actually change the entry type on the entry.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;# Get all people&#xA;$peopleCrit = Entry::find();&#xA;$peopleCrit-&amp;gt;section = &quot;people&quot;;&#xA;$people = $peopleCrit-&amp;gt;all() ?? [];&#xA;&#xA;foreach ($people as $person) {&#xA;&#xA;    # If this was a &quot;featured&quot; person, shift to new featuredPeople entry type.&#xA;    if (historical &quot;is featured&quot; check) {&#xA;&#xA;        # Move to featuredPeople entry type&#xA;        ???&#xA;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastActivityDate="2021-02-27T12:41:33.280" Title="Programatically Changing Entry Types?" Tags="&lt;plugin-development&gt;&lt;entries&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28485" PostTypeId="1" CreationDate="2018-11-20T00:22:28.957" Score="0" ViewCount="20" Body="&lt;p&gt;I can't find this anywhere so I'm going to assume it hasn't been asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to duplicate my products from my primary site to my subdomain? It seems like it should have done it automatically but it hasn't.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-11-20T00:22:28.957" Title="Duplicate products to subdomain" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28486" PostTypeId="2" ParentId="28466" CreationDate="2018-11-20T03:24:44.003" Score="1" Body="&lt;p&gt;The correct syntax or finding &lt;em&gt;all&lt;/em&gt; users regardless of status is &lt;code&gt;status(null)&lt;/code&gt;, which you've tried, but the issue isn't your status parameter, it's the &lt;code&gt;targetElement&lt;/code&gt; parameter of your &lt;code&gt;relatedTo&lt;/code&gt; query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It only accepts the actual element you're looking to query, not its ID.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you already have the target element object, you can just pass that in. If you don't, you can retrieve it with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$targetElement = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($organizationId);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array(&#xA;    'targetElement' =&amp;gt; $targetElement, &#xA;    'field'         =&amp;gt; 'organisation'&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Relevant docs here: &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-20T03:24:44.003" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28487" PostTypeId="2" ParentId="28481" CreationDate="2018-11-20T06:32:13.273" Score="2" Body="&lt;p&gt;An adjustment will take a snapshot of the source object that contained the rule for its application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the following is an array of a discounts attribute if you have a discount adjustment&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ adjustment.sourceSnapshot }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could get the coupon code with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ adjustment.sourceSnapshot.code }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-11-20T06:32:13.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28488" PostTypeId="1" AcceptedAnswerId="28491" CreationDate="2018-11-20T11:31:05.260" Score="1" ViewCount="132" Body="&lt;p&gt;Plugins and application information is detailed in the system report. Is it possible to get my module to list itself there? And if not, is there somewhere else in the CMS to see modules that a registered and working?&lt;/p&gt;&#xA;" OwnerUserId="475" LastActivityDate="2018-11-20T17:46:35.877" Title="List Modules in Craft System Report" Tags="&lt;plugins&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28491" PostTypeId="2" ParentId="28488" CreationDate="2018-11-20T17:46:35.877" Score="2" Body="&lt;p&gt;This isn't something that is built-in, probably the cleanest way would be to write a plugin that adds a Utility that lists your installed modules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;em&gt;all&lt;/em&gt; of the installed modules via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;modules&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...but keep in mind that this will include all of your plugins as well, since they are modules, too. You can exclude them by doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach (Craft::$app-&amp;gt;modules as $module) {&#xA;    if (!is_a($module, Plugin::class)) {&#xA;    // This is some kind of module that isn't a plugin&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this will include other things like the &lt;code&gt;yii\debug\Module&lt;/code&gt; and even &lt;code&gt;craft\web\Application&lt;/code&gt; too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see just the &lt;em&gt;loaded&lt;/em&gt; modules for the current request, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;loadedModules&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(not all modules may be loaded for each request)&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-20T17:46:35.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28493" PostTypeId="2" ParentId="28470" CreationDate="2018-11-20T20:55:23.840" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;According to the &lt;code&gt;EntryQuery&lt;/code&gt; documentation&lt;/a&gt;, you can search by URI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most basic use (searching by the complete URI) would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entryWithUri = craft.entries({&#xA;  uri: craft.app.request.path | literal&#xA;}).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But to progressively dive into the segments (say, to create breadcrumbs like you mentioned), it takes a little more work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set segments = craft.app.request.segments %}&#xA;&#xA;{% for segment in segments %}&#xA;  {% set uriPart = segments[0:loop.index] %}&#xA;&#xA;  {% set entryAtPath = craft.entries({&#xA;    uri: uriPart | join('/') | literal&#xA;  }).one() %}&#xA;&#xA;  {% if entryAtPath %}&#xA;    {{ entryAtPath.link }}&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Supposing &lt;code&gt;entryAtPath&lt;/code&gt; is empty, you may then need to fall back to a Category query, then a Tag query, etc. Unfortunately, there isn't a great way to fetch across Element types—which would make this a little easier.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-11-20T20:55:23.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28494" PostTypeId="1" CreationDate="2018-11-20T21:53:22.977" Score="1" ViewCount="37" Body="&lt;p&gt;In Craft 2 Commerce 1 one could apply a coupon code with &quot;per email limit&quot; during checkout, without having the email added to the order/cart model(s).&#xA;In Craft 3 Commerce 2 the same scenario yields this error;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Discount is limited in use to those who have supplied their email address.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is probably good behavior, for the most part, but is there any way around it to have it work like in Craft 2 Commerce 1? Meaning; make coupon codes with email limits applicable to carts without an email. The reason being the convention of having your cart overview with some initial cost details, wherein you could add discounts and then proceed to checkout and shipping and all that.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2018-11-20T23:42:53.710" LastActivityDate="2018-11-20T23:42:53.710" Title="Commerce Discount Issue/Discepancy" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28495" PostTypeId="1" CreationDate="2018-11-21T00:28:50.590" Score="1" ViewCount="122" Body="&lt;p&gt;My entries within specific section can be related to each other using &quot;Entries&quot; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If entry1 &quot;Entries&quot; field is filled with entry2, i want to entry2 url look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry1/entry2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can this be acomplished?&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2018-11-23T04:17:09.153" Title="Query for entry related to current entry in section URI settings" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28498" PostTypeId="1" AcceptedAnswerId="28500" CreationDate="2018-11-21T08:14:20.677" Score="1" ViewCount="145" Body="&lt;p&gt;Our client would like to run a promotion which would require a user to spend at least £30 in order to get a certain product for free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have setup a ‘codeless’ discount that has:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the product that they get free in the &lt;code&gt;Product&lt;/code&gt; field in conditions&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Purchase Total&lt;/code&gt; set to 30 (although I think this means the total value of the above products)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Base Discount&lt;/code&gt; amount to be the same as the value of the product (3.99).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I had assumed, that provided the cart &gt; 30 and that product was in their cart, the 3.99 would be automatically removed from the total. Now I’m guessing it’s not doing that because of the way the &lt;code&gt;Purchase Total&lt;/code&gt; works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is the case, does anyone know how I’d achieve the desired outcome?&lt;/p&gt;&#xA;" OwnerUserId="5297" LastActivityDate="2018-11-21T08:35:23.300" Title="Discounts applied based on cart total" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28499" PostTypeId="2" ParentId="28478" CreationDate="2018-11-21T08:35:03.850" Score="5" Body="&lt;p&gt;This should be as simple as setting the relation field (category, asset, etc.) value on the entry as an array of related element IDs before saving.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setFieldValue('categoryFieldHandle', [$categoryId1, $categoryId2]);&#xA;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will work for all relation fields:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$entry-&amp;gt;setFieldValue('assetFieldHandle', [$assetId1, $assetId2]);&#xA;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2021-05-18T21:33:21.137" LastActivityDate="2021-05-18T21:33:21.137" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28500" PostTypeId="2" ParentId="28498" CreationDate="2018-11-21T08:35:23.300" Score="1" Body="&lt;p&gt;You are correct, purchase total is the total of items selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will look to add a 'Total Order Price' condition in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now you would need to make your own custom discount adjuster to build special discount conditions.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-11-21T08:35:23.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28501" PostTypeId="2" ParentId="28484" CreationDate="2018-11-21T08:45:19.590" Score="2" Body="&lt;p&gt;Something like this should work. I've also cleaned up the code a bit to be correct PHP syntax as my assumption is that you''ll be doing this in a module/plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get all people entries&#xA;$entries = Entry::find()-&amp;gt;section('people')-&amp;gt;all();&#xA;&#xA;foreach ($entries as $entry) {&#xA;    // If this was a &quot;featured&quot; historical person&#xA;    if ($entry-&amp;gt;historical == 'featured') {&#xA;        // Change to featuredPeople entry type&#xA;        $entry-&amp;gt;typeId = $featuredPeopleEntryTypeId;&#xA;&#xA;        // Save entry&#xA;        Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-11-21T08:45:19.590" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28502" PostTypeId="1" CreationDate="2018-11-21T13:56:38.787" Score="1" ViewCount="172" Body="&lt;p&gt;I'm looking to extend Craft Commerce with a custom Purchasable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to implement this using a module if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented the base class for my new Purchasable and that's all good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wondering is can I add this new Purchasable type to the Commerce &lt;code&gt;cpNavItem&lt;/code&gt; list? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My new Purchasable extends the base Purchasable class as follows:&#xA;&lt;code&gt;class Donation extends Purchasable&lt;/code&gt; and I'm registering using the following Events:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Purchasables::class, Purchasables::EVENT_REGISTER_PURCHASABLE_ELEMENT_TYPES, function(RegisterComponentTypesEvent $event) {&#xA;            $event-&amp;gt;types[] = CustomPurchasable::class;&#xA;        });&#xA;&#xA;Event::on(Elements::class, Elements::EVENT_REGISTER_ELEMENT_TYPES, function(RegisterComponentTypesEvent $e) {&#xA;            $e-&amp;gt;types[] = CustomPurchasable::class;&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that if I go the plugin route I can register a new control panel nav section but I'd like to avoid that if possible and keep this new Purchasable inside of the Commmerce nav section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;piaras&lt;/p&gt;&#xA;" OwnerUserId="6624" LastActivityDate="2018-11-21T13:56:38.787" Title="Extending Craft Commerce Purchasable Nav Items" Tags="&lt;craft3&gt;&lt;php&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28503" PostTypeId="1" CreationDate="2018-11-21T15:38:08.433" Score="1" ViewCount="75" Body="&lt;p&gt;Does anyone have an idea how to contact Solspace support? The email seems to be dead for about a week now. &lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-11-23T21:55:01.140" Title="Not able to contact Solspace support" Tags="&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28504" PostTypeId="2" ParentId="28503" CreationDate="2018-11-21T17:35:10.293" Score="2" Body="&lt;p&gt;Try contacting them on the Craft CMS Slack workspace. They have an account on there, it's worked for me in the past!&lt;/p&gt;&#xA;" OwnerUserId="8228" LastActivityDate="2018-11-21T17:35:10.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28506" PostTypeId="2" ParentId="28503" CreationDate="2018-11-21T21:58:44.883" Score="1" Body="&lt;p&gt;Use their support form. I quite often get a response after a day or so and they’re very helpful. Here is their Freeform plugin support form &lt;a href=&quot;https://solspace.com/craft/freeform/support/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/support/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-11-21T21:58:44.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28510" PostTypeId="1" CreationDate="2018-11-22T11:52:32.740" Score="1" ViewCount="146" Body="&lt;p&gt;I was updating an Craft install on Mediatemple server yesterday. Im now getting the following error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cannot use barrelstrength\sproutbase\app\import\base\FieldImporter as FieldImporter because the name is already in use  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried creating a new install but I get the same error - any ideas what I can do to rectify? &lt;/p&gt;&#xA;" OwnerUserId="6725" LastActivityDate="2018-11-26T05:11:37.477" Title="Error on updating Craft install with Sprout vendor files" Tags="&lt;plugins&gt;&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28512" PostTypeId="2" ParentId="28430" CreationDate="2018-11-22T16:58:22.337" Score="1" Body="&lt;p&gt;Thanks to Kelsey Martens of solspace I found the key. The solspace demo calender uses the .format() method which doesn't translate to the sites language. Now I use the |date filter instead which translates also month and daynames.&lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-11-22T16:58:22.337" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28513" PostTypeId="1" CreationDate="2018-11-22T17:31:19.777" Score="1" ViewCount="106" Body="&lt;p&gt;We've created a site which now has 40 entries in a Structure.  We need to retrospectively remove the URI's because there isn't an individual page for each entry, they're all on one page but search engines are tracking individual pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've removed {slug} from the Section and replaced with 'projects' (no quotes) but of course CraftCMS sees this as duplicate when it tries to resave all the entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="6143" LastActivityDate="2018-11-24T22:45:39.533" Title="Removing URL's from Existing Entries" Tags="&lt;entries&gt;&lt;structure&gt;&lt;craft.entries&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28514" PostTypeId="2" ParentId="13327" CreationDate="2018-11-23T03:52:37.680" Score="1" Body="&lt;p&gt;Try&#xA;HTML:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p class=&quot;rich-test&quot;&amp;gt;Line breaks were the first thought.&amp;lt;br class=&quot;hide-for-small show- &#xA;for-large&quot;&amp;gt;Not an afterthought.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p.rich-text{&#xA;  white-space: pre-line;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8259" LastActivityDate="2018-11-23T03:52:37.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28515" PostTypeId="2" ParentId="28495" CreationDate="2018-11-23T04:17:09.153" Score="1" Body="&lt;p&gt;Your will need to set up a route for the entry1 section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your entry1 uri is looke like entry1section/{slug}, and your template is like &quot;_entry1section/index&quot; then the route would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;entry1section/{slug}/* to &quot;_entry1section/index&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the template, using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set lastSegment = craft.request.getLastSegment() %}&#xA;{% set all_slug_in_entry1_section = someFunctionToRetrieveSlug() %}&#xA;{% set all_slug_in_entry2_section = someFunctionToRetrieveSlug() %}&#xA;&#xA;{% if lastSegment in all_slug_in_entry1_section %}&#xA;&#xA;  {# means your request url is {siteUrl}entry1section/{slug} #}&#xA;  {# display the content from entry1 #}&#xA;&#xA;{% elseif lastSegment in all_slug_in_entry2_section %}&#xA;&#xA;  {# means your request url is {siteUrl}entry1section/{entry1-slug}/{entry2-slug} #}&#xA;  {# display the content from entry2 #}&#xA;&#xA;{% else %}&#xA;&#xA;  {% redirect '404.html' %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8259" LastActivityDate="2018-11-23T04:17:09.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28516" PostTypeId="2" ParentId="28513" CreationDate="2018-11-23T04:28:27.370" Score="1" Body="&lt;p&gt;As a quick but not elegant fix, You can disabled the entries you don't want to show up in the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you want to use the content just put &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft.entries({&#xA;   section: someSection,&#xA;   status: null&#xA; })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; craft.entries({....}).status(null)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8259" LastActivityDate="2018-11-23T04:28:27.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28517" PostTypeId="2" ParentId="28510" CreationDate="2018-11-23T04:34:42.287" Score="2" Body="&lt;p&gt;I was also getting the same error and tried so many times install/uninstall but couldn't succeed. In my case, it was basically php 7 version compatibility issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should change your php version to php 7.1.16 or higher, if using lower like php 7.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed by Dev: &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms/issues/195&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-forms/issues/195&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code to be modified: &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-base/commit/5e8ce5eb9b1815d1d2a66ed69664a890271d6620&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/barrelstrength/craft-sprout-base/commit/5e8ce5eb9b1815d1d2a66ed69664a890271d6620&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ankit Chauhan &lt;/p&gt;&#xA;" OwnerUserId="7300" LastEditorUserId="7300" LastEditDate="2018-11-26T05:11:37.477" LastActivityDate="2018-11-26T05:11:37.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28518" PostTypeId="1" CreationDate="2018-11-23T08:55:47.583" Score="1" ViewCount="139" Body="&lt;p&gt;So, I'm trying to set circles around marker locations using Smart Map and some JS.&lt;/p&gt;&#xA;&lt;p&gt;I've got the following which gives no errors, but outputs no circles.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;&#xA;  $.each( smartMap.marker, function( key, value ) {&#xA;&#xA;    var circle = new google.maps.Circle({&#xA;                    map: smartMap.map['smartmap-mapcanvas-1'],&#xA;                    radius: 40233,    // 25 miles in metres&#xA;                    fillColor: '#000000'&#xA;                 });&#xA;    circle.bindTo('center', marker, value.getPosition());&#xA;&#xA;    });&#xA;&#xA;  });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm out of ideas at this point!&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="45" LastEditDate="2021-01-01T07:14:34.443" LastActivityDate="2021-01-01T07:14:34.443" Title="Setting Google maps circles using Smart Map plugin" Tags="&lt;javascript&gt;&lt;plugin-smartmap&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28519" PostTypeId="1" CreationDate="2018-11-23T09:37:02.530" Score="3" ViewCount="1848" Body="&lt;p&gt;I want to deploy a local craftCMS 3 website to a server, but I didn't manage to get answers to some of the questions I have rightnow on Google search. So I hope you can help me with this and can help me finding the right / a better workflow to do these things instead of me reinventing the wheel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the website build locally and want to deploy it. I installed composer on the webserver via SSH by putty (Win) and installed Craft 3 on the server with composer and the craft webinstaller whithout any problems. But that's obviously just an empty craftcms and not the locally build cms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the questions I have right now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) What's the preferred way to install a build craft website on the server?&lt;/strong&gt; Do you use the craft installer or just copy all local files of the project to the server by FTP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a new craft project with composer the 'public' files are in 'web'. So if I install a new craft project with composer on the webserver inside public_html, the public files will be in &lt;code&gt;domain.com/project/web&lt;/code&gt; or in &lt;code&gt;domain/web&lt;/code&gt; if I use public_html as a path.&#xA;But in both cases some critical files, like the config files with passwords and all, will be in the public_html folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of coarse I use htaccess to protect things, but I'm not sure this is the right and secure location to have this folderstructure on the server as meant to be and wonder if the project should go on a higher folder instead with only 'web' exposed on public_html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) What's the right location on the server to install the craft project to to keep everything secure, like having config, vendor and all 'out of sight'?&lt;/strong&gt; Do you guys install craft directly in the public_html folder, or on a higher parent folder? And in case of the latter do you only have the 'web' folder inside public_html somehow (how to do that?)? So what's the right/preferred way/location to install Craft3 in a secure way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an older CMS/framework I used I just copied local files by ftp to deploy. But it seems like using composer is a better way to do this and like to improve my workflow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3) If you make changes to the website locally, how do you deploy them once the website is setup on the server?&lt;/strong&gt; Do you just use ftp to upload your changed files (and update the database) or is there a better way to do this with composer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to do things in a way that works best and the CMS is meant for instead of reinventing the wheel and do things differently than the 'standard'. Hope you guys can help. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8483" LastEditorUserId="57" LastEditDate="2018-11-26T06:01:34.233" LastActivityDate="2018-11-26T06:01:34.233" Title="SOLVED: Best way to deploy Craft 3 to webserver?" Tags="&lt;deployment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28520" PostTypeId="1" CreationDate="2018-11-23T10:23:44.050" Score="1" ViewCount="101" Body="&lt;p&gt;I'm trying to load a plugin template via ajax inside another plugin template like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $(&quot;#modal&quot;).load(&quot;/mypluginname/myplugintemplatefolder/myplugintemplate.html?queryvar=&quot;+var); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it keeps looking for myplugintemplate.html on the frontend templates folder instead of in my plugin template folder - I don't understand how to tell it that I'm trying to load a file from my plugintemplate folder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I'm trying to refresh a section of my template by reloading an include &lt;/p&gt;&#xA;" OwnerUserId="5417" LastActivityDate="2018-11-23T11:44:03.130" Title="Loading a plugin template via ajax" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28521" PostTypeId="2" ParentId="28520" CreationDate="2018-11-23T11:44:03.130" Score="1" Body="&lt;p&gt;Plugin files are located outside your web root, thats why you can't access them directly. You should create a controller action and render the template from there.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class DefaultController extends Controller{&#xA;  protected $allowAnonymous = ['getTemplate'];&#xA;&#xA;  public function actionGetTemplate(){&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $templatevar = $request-&amp;gt;getParam('templatevar');&#xA;&#xA;    use craft\web\View;&#xA;    $oldMode = \Craft::$app-&amp;gt;view-&amp;gt;getTemplateMode();&#xA;    \Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_CP);&#xA;    $html = \Craft::$app-&amp;gt;view-&amp;gt;renderTemplate('plugin-handle/path/to/template');&#xA;    \Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode($oldMode);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(see &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can define the route to your controller action in your plugin file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init(){&#xA;  Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_SITE_URL_RULES, &#xA;  function(RegisterUrlRulesEvent $event) {&#xA;      $event-&amp;gt;rules['gettemplate/&amp;lt;templatevar:\w+&amp;gt;''] = 'myPlugin/getTemplate';&#xA;  });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and call it via&#xA; $(&quot;#modal&quot;).load(&quot;/gettemplate/&quot;+templatevar);&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-11-23T11:44:03.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28522" PostTypeId="2" ParentId="28519" CreationDate="2018-11-23T12:00:15.917" Score="2" Body="&lt;p&gt;I install Craft CMS generally via composer on my local system and copy the files preferably via git to the server. I have one project where i have to copy files via ftp, thats a bit more complicated but it works. If i make updates locally i can see, what files changed in my git repository and know what i have to upload via ftp. Just make sure you add all important files to your git repo (included /vendor). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the web root: Copy all files to /public_html on your server and make sure the web root then points to the Craft /web directory! &lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-11-23T12:00:15.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28523" PostTypeId="1" CreationDate="2018-11-23T12:33:11.663" Score="2" ViewCount="308" Body="&lt;p&gt;In my Craft 3 plugin I would like to pass a variable defined in my Controller to my PluginVariable.php file. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="7395" LastActivityDate="2018-11-24T06:10:23.683" Title="How can I pass a variable defined in a Controller to my variables?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;variable&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28525" PostTypeId="1" CreationDate="2018-11-23T16:24:12.590" Score="1" ViewCount="95" Body="&lt;p&gt;Is there a lesson/tutorial/docs about going from local to production on server with Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What files should be uploaded  ( and which not )&lt;/li&gt;&#xA;&lt;li&gt;What folders need to be one level up of the root - where to change the paths to this folders&lt;/li&gt;&#xA;&lt;li&gt;Change config files.&lt;/li&gt;&#xA;&lt;li&gt;Go from dev to production.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3665" LastActivityDate="2018-11-23T17:55:20.753" Title="Go from local to public with Craft 3" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28526" PostTypeId="2" ParentId="28472" CreationDate="2018-11-23T17:11:26.753" Score="1" Body="&lt;p&gt;Imager will always create and store the transformed images locally in your &lt;code&gt;imagerSystemPath&lt;/code&gt;, even if you choose to upload and serve them from an external storage. The files in that folder acts as the cache, so that Imager knows if a transform has been created or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, Imager either would have to; 1) make a request for each transformed image to see if it existed in the external storage, or 2) have some other method of keeping track of what transforms has been made (DB, DB-like file, or something). Option 1) adds an insane amount of overhead, whereas 2) adds quite a bit of complexity and possibly some overhead (like Craft's built-in transforms, which requires DB queries). So I opted for speed and simplicity, and sacrificed disk space. :)&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2018-11-23T17:11:26.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28527" PostTypeId="2" ParentId="28519" CreationDate="2018-11-23T17:36:27.047" Score="3" Body="&lt;p&gt;At the risk of &quot;link&quot; answers, we talk about different deployment strategies here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://devmode.fm/episodes/website-deployment-without-tears&quot; rel=&quot;nofollow noreferrer&quot;&gt;Website Deployment without Tears&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;...and there's a writeup of deploying Craft CMS here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Setting up a New Craft CMS 3 Project&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's hard to do a TL;DR on this, because it's fairly involved, but essentially ignore your &lt;code&gt;vendor/&lt;/code&gt; directory, and do a &lt;code&gt;composer install&lt;/code&gt; on your production/staging server to install the &lt;code&gt;vendor/&lt;/code&gt; directory there, synced up with your &lt;code&gt;composer.lock&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using some kind of deployment tool like &lt;a href=&quot;https://forge.laravel.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forge&lt;/a&gt; or &lt;a href=&quot;https://buddy.works/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Buddy.works&lt;/a&gt; will also make your life easier.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-11-24T22:32:45.123" LastActivityDate="2018-11-24T22:32:45.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28528" PostTypeId="2" ParentId="28525" CreationDate="2018-11-23T17:48:41.520" Score="2" Body="&lt;p&gt;Check out the discussion in this SE question: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28519/best-way-to-deploy-craft3-to-webserver&quot;&gt;Best way to deploy Craft3 to webserver?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-11-23T17:55:20.753" LastActivityDate="2018-11-23T17:55:20.753" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28529" PostTypeId="1" AcceptedAnswerId="30786" CreationDate="2018-11-23T19:18:57.040" Score="1" ViewCount="178" Body="&lt;p&gt;I am trying to change/set a customers shippingAddress via &lt;code&gt;axios&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does work e.g. for setting the &lt;code&gt;shippingMethod&lt;/code&gt; or the quantity for a product. However if i want to set a new &lt;code&gt;shippingAddress&lt;/code&gt; the &lt;code&gt;axios post&lt;/code&gt; fails with a &lt;code&gt;500 status&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my axios post request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;updateShipping() {&#xA;        const options = {&#xA;            method: 'POST',&#xA;            headers: {&#xA;                'content-type': 'application/x-www-form-urlencoded',&#xA;                'X-CSRF-Token': window.Craft.csrfToken,&#xA;            },&#xA;            data: qs.stringify({&#xA;                shippingMethodHandle: 'standardShipping', //works&#xA;                shippingSameAsBilling: false, // wont work&#xA;                shippingAddressId: 'new', // wont work, also tried an existing&#xA;                shippingAddress: {&#xA;                   firstName: 'test',&#xA;                   ...&#xA;                },&#xA;            }),&#xA;            url: '/actions/commerce/cart/update-cart',&#xA;        };&#xA;        axios(options)&#xA;            .then(response =&amp;gt; {...})&#xA;            .catch(error =&amp;gt; {...});&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-11-26T10:36:56.160" LastActivityDate="2019-06-27T06:03:45.850" Title="Setting a new / override shippingAddress via axios" Tags="&lt;craft3&gt;&lt;javascript&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28530" PostTypeId="2" ParentId="28503" CreationDate="2018-11-23T21:55:01.140" Score="4" Body="&lt;p&gt;Sorry about the trouble. We typically answer most tickets within 24 hours:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Freeform&lt;/strong&gt;: &lt;a href=&quot;https://solspace.com/craft/freeform/support/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/support/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Calendar&lt;/strong&gt;: &lt;a href=&quot;https://solspace.com/craft/calendar/support/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/calendar/support/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the Support Form isn't working for you, you can always email us directly at support@solspace.com :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2018-11-23T21:55:01.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28531" PostTypeId="2" ParentId="28523" CreationDate="2018-11-24T06:10:23.683" Score="3" Body="&lt;p&gt;The shortest answer is &quot;that's not possible,&quot; and the slightly longer answer is &quot;that's not possible because Controllers and Variables have no reason to ever interact.&quot; If your Controller relies on a Variable (or vice versa), something is architecturally incorrect. There's no reason for the two to cross paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of a &lt;strong&gt;Controller&lt;/strong&gt; is to receive input from a form, AJAX call, or to be used as an API endpoint. It can also be used via routing to show a particular template under particular conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of a &lt;strong&gt;Variable&lt;/strong&gt; is simply to render a value in your Twig template.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-11-24T06:10:23.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28532" PostTypeId="2" ParentId="28518" CreationDate="2018-11-24T06:27:20.263" Score="1" Body="&lt;p&gt;This is a shot in the dark, so let me know if this does/doesn't work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you're starting your loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$.each( smartMap.marker, function( key, value ) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And near the end, you reference a &lt;code&gt;marker&lt;/code&gt; object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circle.bindTo('center', marker, value.getPosition());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But as far as I can tell, &lt;code&gt;marker&lt;/code&gt; is never defined. Did you mean to pass in &lt;code&gt;value&lt;/code&gt; instead?&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-11-24T06:27:20.263" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28533" PostTypeId="1" CreationDate="2018-11-24T11:35:14.130" Score="3" ViewCount="207" Body="&lt;p&gt;I'm trying to use Supersort to sort entries using a date/time field within a matrix, for example 1/6/2019 12:00AM. These dates will always be in the future. I want to sort it so that the entries that are closest to happening are displayed first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it more complicated, entries with multiple dates in the matrix are split apart, so I need to sort each of these according to their date (from &lt;a href=&quot;https://gocrowsnest.ca/events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gocrowsnest.ca/events&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UpcsA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UpcsA.png&quot; alt=&quot;https://gocrowsnest.ca/events&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how exactly I'm supposed to do this. What I have: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageEntries = craft.entries.section('events') | supersort('sortAs', '{dates.type(&quot;date&quot;).first.startDate.getTimestamp}') %}&#xA;{% for event in pageEntries %}&#xA;    {% for block in event.dates.all() %}&#xA;        {# Event code #}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is sorting each entry by the first matrix date, not by each date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix handle: dates, block: date, field (date/time): startDate.&lt;/p&gt;&#xA;" OwnerUserId="7411" LastEditorUserId="7411" LastEditDate="2018-11-27T03:10:50.537" LastActivityDate="2018-11-27T03:10:50.537" Title="Using a matrix Date/Time field to sort entries" Tags="&lt;plugin-supersort&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28535" PostTypeId="2" ParentId="28513" CreationDate="2018-11-24T22:45:39.533" Score="1" Body="&lt;p&gt;I'd first set up a 301 redirect to ensure that anyone who does land on one of these search engine indexed pages is redirected to the single page that lists them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I'd just turn URLs off for that Section.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-24T22:45:39.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28536" PostTypeId="1" CreationDate="2018-11-25T14:06:10.660" Score="1" ViewCount="32" Body="&lt;p&gt;In the code below I am trying to check for the presence of a quote block to help define some layout columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as i count an individual block, the loop block below it outputs nothing. If remove the column logic based on length of quote block the loop below then outputs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# position columns width if there is a quote #}&#xA;{% if entry.contentBlock.type('quote').limit(1) | length %}&#xA;    {% set col1 = &quot;12u$(medium) 7u  &quot; %}&#xA;    {% set col2 = &quot;5u 12u$(medium)  &quot; %}&#xA;{% else %}&#xA;    {% set col1 = &quot;12u$(small) 6u -3u  &quot; %}&#xA;    {% set col2 = &quot;hide &quot; %}&#xA;{% endif %}&#xA;&#xA;&amp;lt;div class=&quot;{{ col1 }}&quot;&amp;gt;&#xA;    &amp;lt;h3&amp;gt; {{ entry.title }} &amp;lt;/h3&amp;gt;&#xA;&#xA;    {% for block in entry.contentBlock.all() %}&#xA;        {% if block.type.handle == &quot;text&quot; or block.type.handle == &quot;image&quot; %}&#xA;            {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&amp;lt;div class=&quot;{{ col2 }}&quot;&amp;gt;&#xA;    {% for block in entry.contentBlock.type('quote').all() %}&#xA;        {% include ('page/_partials/_' ~ blockPrefix ~ 'block_' ~ block.type.handle) %}&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="5275" LastEditDate="2018-11-27T00:22:49.157" LastActivityDate="2018-11-27T00:22:49.157" Title="Why does calling matrix block type before matrix block loop lead to no loop output" Tags="&lt;matrix&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28537" PostTypeId="1" AcceptedAnswerId="28798" CreationDate="2018-11-26T04:29:43.937" Score="1" ViewCount="486" Body="&lt;p&gt;I am trying to locally install Craft Typed Link Field from the plugin store and I'm getting this PHP error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already upped my memory_limit to 256M within my php.ini file, yet this is claiming to need 400M to run these updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd rather try to deal with the root cause instead of upping my memory_limit to 410M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trace is following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A fatal error has occurred:&#xA;&#xA;Status: Internal Server Error&#xA;&#xA;Response: &amp;lt;pre&amp;gt;PHP Fatal Error &amp;amp;#039;yii\base\ErrorException&amp;amp;#039; with message &amp;amp;#039;Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes)&amp;amp;#039;&#xA;&#xA;in /Users/name/project/build/vendor/composer/composer/src/Composer/DependencyResolver/Solver.php:220&#xA;&#xA;Stack trace:&#xA;#0 [internal function]: yii\base\ErrorHandler-&amp;amp;gt;handleFatalError()&#xA;#1 {main}&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-14T12:32:50.900" Title="Getting fatal error when installing new plugin by hitting memory_limit" Tags="&lt;php&gt;&lt;updates&gt;&lt;composer&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28538" PostTypeId="1" CreationDate="2018-11-26T07:38:47.913" Score="1" ViewCount="77" Body="&lt;p&gt;I have an existing website built with Craft CMS. I made a few changes locally and now I want to update the 'live' website. The problem is that I added a couple of fields and sections but I can't just replace the live database with the one I am currently working with locally because the content in the live database is more up to date and I don't want to override that content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I get those new fields and sections in the live/production database without losing any data in said database?&lt;/p&gt;&#xA;" OwnerUserId="8402" LastActivityDate="2018-11-26T09:29:07.337" Title="How do I update a Craft website without losing data?" Tags="&lt;craft3&gt;&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28539" PostTypeId="2" ParentId="28538" CreationDate="2018-11-26T08:13:26.633" Score="2" Body="&lt;p&gt;You can always add the fields manually to the live site, works best imo if you made a limited amount of changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have made a lot of changes, a plugin like &lt;a href=&quot;https://github.com/Firstborn/Craft-Migration-Manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Firstborn's Migration Manager&lt;/a&gt; could do the trick. I have never used it personally, but it seems to do a lot of great things and uses the built-in migration system of Craft 3. Probably worth to give it a spin. There's also a Craft 2 version.&lt;/p&gt;&#xA;" OwnerUserId="960" LastActivityDate="2018-11-26T08:13:26.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28540" PostTypeId="2" ParentId="28538" CreationDate="2018-11-26T09:29:07.337" Score="1" Body="&lt;p&gt;Another plugin that should do the job is &lt;a href=&quot;https://github.com/Pennebaker/craft-architect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Architect&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-11-26T09:29:07.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28541" PostTypeId="2" ParentId="28537" CreationDate="2018-11-26T10:27:34.817" Score="1" Body="&lt;p&gt;This is more of a Composer than a Craft issue. Depending on your project dependencies, Composer could easily need 1GB of memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you got the 410M from the &lt;code&gt;4039 bytes&lt;/code&gt; in the error. That's only what Composer can't allocate for what it's doing, you might need more later in the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would start by upping my memory_limit to 512M and see where it gets you.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-26T10:27:34.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28543" PostTypeId="1" AcceptedAnswerId="28544" CreationDate="2018-11-26T17:36:21.373" Score="2" ViewCount="556" Body="&lt;p&gt;I added a custom formattingAdd to my Standard.json file in my Redactor config. It's supposed to add the attribute &lt;code&gt;data-aos=&quot;fade-right&quot;&lt;/code&gt; to a paragraph tag. The &quot;Animate&quot; format option is showing up in the CP, but when I select that format the code doesn't change (it stays just a normal &lt;code&gt;p&lt;/code&gt; without the &lt;code&gt;data-aos=&quot;fade-right&lt;/code&gt; attribute).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;buttons&quot;: [&quot;html&quot;, &quot;formatting&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;unorderedlist&quot;, &quot;orderedlist&quot;, &quot;link&quot;],&#xA;  &quot;plugins&quot;: [&quot;fullscreen&quot;, &quot;video&quot;],&#xA;  &quot;linkNewTab&quot;: true,&#xA;  &quot;toolbarFixed&quot;: true,&#xA;  &quot;formatting&quot; : [&quot;animate&quot;, &quot;h1&quot;, &quot;h2&quot;, &quot;h3&quot;, &quot;h4&quot;, &quot;h5&quot;, &quot;h6&quot;, &quot;p&quot;],&#xA;  &quot;formattingAdd&quot;: {&#xA;    &quot;animate&quot;: {&#xA;      &quot;title&quot;: &quot;Animate&quot;,&#xA;      &quot;args&quot;: [&quot;p&quot;, &quot;data-aos&quot;, &quot;fade-right&quot;, &quot;toggle&quot;]&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried this with classes as well, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;formattingAdd&quot;: {&#xA;  &quot;note&quot;: {&#xA;    &quot;title&quot;: &quot;Note&quot;,&#xA;    &quot;args&quot;: [&quot;p&quot;, &quot;class&quot;, &quot;note&quot;]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the &lt;code&gt;note&lt;/code&gt; class isn't added to the &lt;code&gt;p&lt;/code&gt; tags either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why the attribute and class aren't showing up in the &lt;code&gt;p&lt;/code&gt; tags?&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2018-11-26T17:59:10.423" Title="Redactor - formattingAdd isn't changing code" Tags="&lt;craft3&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28544" PostTypeId="2" ParentId="28543" CreationDate="2018-11-26T17:48:31.953" Score="1" Body="&lt;p&gt;Try this for data attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;formattingAdd&quot;: {&#xA;    &quot;add-animate&quot;: {&#xA;        &quot;title&quot;: &quot;Animate&quot;,&#xA;        &quot;api&quot;: &quot;module.block.format&quot;,&#xA;        &quot;args&quot;: {&#xA;            &quot;tag&quot;: &quot;p&quot;,&#xA;            &quot;attr&quot;: {&#xA;                &quot;data-aos&quot;: &quot;fade-right&quot;&#xA;            },&#xA;            &quot;type&quot;: &quot;toggle&quot;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This for classes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;formattingAdd&quot;: {&#xA;    &quot;add-note&quot;: {&#xA;        &quot;title&quot;: &quot;Note&quot;,&#xA;        &quot;api&quot;: &quot;module.block.format&quot;,&#xA;        &quot;args&quot;: {&#xA;            &quot;tag&quot;: &quot;p&quot;,&#xA;            &quot;class&quot;: &quot;note&quot;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://imperavi.com/redactor/docs/settings/formatting/#s-formattingadd&quot; rel=&quot;nofollow noreferrer&quot;&gt;redactor settings formatting&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-11-26T17:59:10.423" LastActivityDate="2018-11-26T17:59:10.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28545" PostTypeId="1" CreationDate="2018-11-26T18:46:24.430" Score="2" ViewCount="94" Body="&lt;p&gt;I have a condition that checks entry Id. The condition seems to not work for Japanese locale but works fine on English. I would think that entry ID remains the same irrespective of the locale. Please confirm or correct me if I'm wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6995" LastActivityDate="2018-11-27T09:56:02.993" Title="Does entry ID change with locale?" Tags="&lt;entries&gt;&lt;localization&gt;&lt;id&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28546" PostTypeId="2" ParentId="28533" CreationDate="2018-11-26T19:32:59.507" Score="1" Body="&lt;p&gt;So you're not getting your matrix field's value properly. You're going to want to access it the same way you'd output the data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ event.dates.type('date').first().startDate.getTimestamp() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what we're doing here is getting the &lt;code&gt;dates&lt;/code&gt; matrix field, selecting the blocks that have a type of &lt;code&gt;date&lt;/code&gt;, getting the first of those blocks (should be our only block but &lt;code&gt;.first&lt;/code&gt; is still needed), then get the &lt;code&gt;startDate&lt;/code&gt; field in that block. During my testing I found you needed something like &lt;code&gt;.getTimestamp()&lt;/code&gt; or &lt;code&gt;.atom()&lt;/code&gt; to turn the date into a string that SuperSort could understand (not sure why the examples in our docs don't use that, will definitely look into that though).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like this should achieve what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pageEntries = craft.entries.section('events') | supersort('sortAs', '{dates.type(&quot;date&quot;).first.startDate.getTimestamp}') %}&#xA;{% for event in pageEntries %}&#xA;    {# event data #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fwiw, I work for TopShelfCraft (who made the SuperSort plugin)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-11-26T19:32:59.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28548" PostTypeId="1" AcceptedAnswerId="28616" CreationDate="2018-11-27T02:34:08.893" Score="2" ViewCount="279" Body="&lt;p&gt;I'm writing a custom plugin for a customer that does 2 things.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Uses prices from Pricing Categories. There are 10,000 digital products, so adjusting prices for large quantities is cumbersome on a per-product basis.&lt;/li&gt;&#xA;&lt;li&gt;Uses a Stock Photo model system of PrePay. Purchase a set amount of credits like $100, and get 10% off the products.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strike&gt;I have successfully completed the first step by using the &lt;code&gt;EVENT_POPULATE_LINE_ITEM&lt;/code&gt; listener. The following works perfectly.&lt;/strike&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon consultation with the wonderful Michael Rog, I am taking a different apporoach to this project.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a function on the backend that upon an product entry save, assign the price from the category. This will assign the price in the CP, rather than doing any line item editing and cart manipulation on the front end.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I will be creating my own adjuster that will fire after a Gift Voucher has been added to the cart that will then apply the sale percentage to the line item in addition to the whole voucher process.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'll post my update when successful.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="4102" LastEditDate="2018-11-29T19:55:26.723" LastActivityDate="2018-12-01T05:11:16.143" Title="Check for whole cart adjustment and apply line item discount" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;&lt;adjusters&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28549" PostTypeId="1" AcceptedAnswerId="28557" CreationDate="2018-11-27T03:50:00.680" Score="1" ViewCount="92" Body="&lt;p&gt;We have a Craft site with nearly 800 entries. For SEO purposes we need to change the page title and page (SEO) description for each entry, a laborious task to say the least. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to have, say, a PageTitle variable which we apply to all entries with SEOmatic, and if we need to change the structure of the title, we just have to change the PageTitle variable once. This variable itself would have variables within it, e.g:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Beautiful {villaBedrooms} bedroom villa in {villaLocation.last.title}, Bali. From just ${villaPrice}. {villaHook} &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6348" LastEditorUserId="57" LastEditDate="2018-11-27T04:45:01.707" LastActivityDate="2018-11-27T18:34:48.257" Title="SEOmatic and Global Variables" Tags="&lt;variable&gt;&lt;globals&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28552" PostTypeId="2" ParentId="28545" CreationDate="2018-11-27T09:56:02.993" Score="3" Body="&lt;p&gt;The ID won't change in different locales, check this answer for reference: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23710/craft-3-language-switcher&quot;&gt;Craft 3 language switcher&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also test it in your templates e.g. :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for locale in craft.app.sites.getAllSites() %}&#xA;    {{ craft.entries.siteId(locale.id).one().id }} : {{ craft.entries.siteId(locale.id).one().title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastActivityDate="2018-11-27T09:56:02.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28554" PostTypeId="1" AcceptedAnswerId="28555" CreationDate="2018-11-27T14:52:48.340" Score="1" ViewCount="191" Body="&lt;p&gt;I am trying to work through deprecation warning. I have not touched Craft in a few months, so I am a bit rusty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Deprecation Message is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DateTime::year is deprecated. Use the |date('Y') filter instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The offending line is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{% for year in now.year .. firstEntryEver.postDate.year %}   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is the context:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEntryEver = craft.entries.section('posts').orderBy('postDate asc').one() %}&#xA;{% for year in now.year .. firstEntryEver.postDate.year %}                        &#xA; &amp;lt;a href=&quot;/archives/{{ year }}&quot; class=&quot;dropdown-item&quot;&amp;gt;&#xA; &amp;lt;i class=&quot;material-icons&quot;&amp;gt;date_range&amp;lt;/i&amp;gt; {{ year }}&amp;lt;/a&amp;gt;&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, how do I fix this?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2018-11-28T02:14:54.253" LastActivityDate="2018-11-28T02:14:54.253" Title="How do I fix a deprecation error for DateTime::year?" Tags="&lt;templating&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28555" PostTypeId="2" ParentId="28554" CreationDate="2018-11-27T15:34:24.077" Score="1" Body="&lt;p&gt;This is how you fix this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Old code #}&#xA;{% for year in now.year .. firstEntryEver.postDate.year %}&#xA;&#xA;{# New code #}&#xA;{% for year in now.year .. firstEntryEver.postDate |date('Y') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-27T15:34:24.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28556" PostTypeId="1" AcceptedAnswerId="28562" CreationDate="2018-11-27T16:36:51.933" Score="1" ViewCount="149" Body="&lt;p&gt;I followed &lt;a href=&quot;https://medium.com/@madebyraygun/a-quick-and-easy-local-environment-for-craft-3-4fd7c7ff5815&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide&lt;/a&gt; to move my local hosting from WAMP, which has been giving me a bunch of 500 errors since switching to Craft 3, to Local By Flywheel. After getting everything configured, I can access the site and everything seems to be working fine. The issue I'm having is I'm unable to access the control panel to make changes. The login screen keeps just redirecting back to the login screen after entering the credentials. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the details I have as far as what's going on:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I know the credentials I'm entering are correct. I get an error on the login page when I put in an incorrect password&lt;/li&gt;&#xA;&lt;li&gt;I've checked the Craft logs and don't see any obvious warnings or error messages related to login&lt;/li&gt;&#xA;&lt;li&gt;Removing everything in the Craft log folder doesn't change anything&lt;/li&gt;&#xA;&lt;li&gt;I'm running Apache (2.4.1, I believe), PHP 7.0.3, and MySQL 5.5.6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is the .htaccess we're using (I don't think it's the issue but I know it's a common one for this sort of stuff):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_expires.c&amp;gt;&#xA; ExpiresActive on&#xA; # Perhaps better to whitelist expires rules? Perhaps.&#xA; ExpiresDefault &quot;access plus 1 month&quot;&#xA; # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)&#xA; ExpiresByType text/cache-manifest &quot;access plus 0 seconds&quot;&#xA; # Your document html&#xA; ExpiresByType text/html &quot;access plus 0 seconds&quot;&#xA; # Data&#xA; ExpiresByType text/xml &quot;access plus 0 seconds&quot;&#xA; ExpiresByType application/xml &quot;access plus 0 seconds&quot;&#xA; ExpiresByType application/json &quot;access plus 0 seconds&quot;&#xA; # Feed&#xA; ExpiresByType application/rss+xml &quot;access plus 1 hour&quot;&#xA; ExpiresByType application/atom+xml &quot;access plus 1 hour&quot;&#xA; # Favicon (cannot be renamed)&#xA; ExpiresByType image/x-icon &quot;access plus 1 week&quot;&#xA; # Media: images, video, audio&#xA; ExpiresByType image/gif &quot;access plus 1 month&quot;&#xA; ExpiresByType image/png &quot;access plus 1 month&quot;&#xA; ExpiresByType image/jpeg &quot;access plus 1 month&quot;&#xA; ExpiresByType video/ogg &quot;access plus 1 month&quot;&#xA; ExpiresByType audio/ogg &quot;access plus 1 month&quot;&#xA; ExpiresByType video/mp4 &quot;access plus 1 month&quot;&#xA; ExpiresByType video/webm &quot;access plus 1 month&quot;&#xA; # Webfonts&#xA; ExpiresByType application/x-font-ttf &quot;access plus 1 month&quot;&#xA; ExpiresByType font/opentype &quot;access plus 1 month&quot;&#xA; ExpiresByType application/x-font-woff &quot;access plus 1 month&quot;&#xA; ExpiresByType image/svg+xml &quot;access plus 1 month&quot;&#xA; ExpiresByType application/vnd.ms-fontobject &quot;access plus 1 month&quot;&#xA; ExpiresByType text/css &quot;access plus 1 year&quot;&#xA; ExpiresByType application/javascript &quot;access plus 1 year&quot;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_deflate.c&amp;gt;&#xA; AddOutputFilterByType DEFLATE text/html text/plain text/css application/json&#xA; AddOutputFilterByType DEFLATE application/javascript&#xA; AddOutputFilterByType DEFLATE text/xml application/xml text/x-component&#xA; AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml&#xA; Addtype font/opentype .otf&#xA; Addtype font/truetype .ttf&#xA; AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.msfontobject application/x-font-ttf font/opentype font/truetype&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&#xA;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;     RewriteEngine On&#xA;&#xA;    # remove version numbers used for cache busting.&#xA;    # maps site.min.1234.css to site.min.css&#xA;    # See https://nystudio107.com/blog/simple-static-asset-versioning&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]&#xA;&#xA;    #301 redirect with trailing slash&#xA;        RewriteCond %{REQUEST_URI} /+[^\.]+$&#xA;        RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]&#xA;&#xA;    #Send would-be 404 requests to Craft&#xA;        RewriteCond %{REQUEST_FILENAME} !-f&#xA;        RewriteCond %{REQUEST_FILENAME} !-d&#xA;        RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;        RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;  AddType text/x-component .htc&#xA;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only thing that seems a bit odd is on the login page, it keeps redirecting from the HTTPS version to the HTTP version upon form submission. Same login page, but after submission it goes from HTTPs to HTTP and then I can't get past then on subsequent attempts. The rest of the site works fine on HTTPs. Not sure if that could be tied to the issue or what's going on there but wanted to call that out as being of note.&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="3465" LastEditDate="2018-11-27T18:14:49.893" LastActivityDate="2018-11-27T21:24:39.223" Title="Can't Get Past Control Panel Login. Keeps Redirecting Back to Login Page" Tags="&lt;control-panel&gt;&lt;redirect&gt;&lt;login&gt;&lt;htaccess&gt;&lt;https&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28557" PostTypeId="2" ParentId="28549" CreationDate="2018-11-27T18:34:48.257" Score="0" Body="&lt;p&gt;So for Craft 2.x, what I'd suggest is just doing this via Twig. This is discussed here: &lt;a href=&quot;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/seomatic/wiki/10.-Dynamic-Twig-SEO-Meta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-27T18:34:48.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28558" PostTypeId="1" AcceptedAnswerId="28588" CreationDate="2018-11-27T19:25:22.273" Score="1" ViewCount="593" Body="&lt;p&gt;I have a custom user field 'myuserfield'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I save a value to this field via a plugin in Craft3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current attempt.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $myvar = '12345';&#xA;    Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;setFieldValue('myuserfield', $myvar);&#xA;    $myid = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;getFieldValue('myuserfield');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I echo $myid it does, in fact, give me the new value ($myvar or 12345) but when I check the control panel the value is not saved.&lt;/p&gt;&#xA;" OwnerUserId="603" LastEditorUserId="603" LastEditDate="2018-11-28T16:29:22.560" LastActivityDate="2019-04-13T23:27:55.907" Title="Saving Custom Field Values to User Profile" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;usermodel&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28559" PostTypeId="1" CreationDate="2018-11-27T20:35:00.423" Score="2" ViewCount="533" Body="&lt;p&gt;I am trying to figure out how to return asset field(s) in a PHP entry query. Also if I could learn how to return &quot;custom fields&quot; when returning an Object that would be great too! Right now I am having to specify &lt;code&gt;asArray()&lt;/code&gt; to even get access to most of my &quot;custom fields&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As as example: I have a Vehicle Entry which has a custom field with the handle of price (number field) and another custom field (asset field) with the handle of images. When I execute the query without specifying the asArray() param I cannot find the custom fields included in the results. But if I specify asArray() then they are all there with the exception of my images field which I think is because it is an asset field or possible because it can be a collection of images? How can I make sure all the fields tied to an entry are returned in my query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some examples of queries and the corresponding results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP Query &lt;strong&gt;without asArray()&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry_query = Entry::find()&#xA;-&amp;gt;section('inventory')&#xA;-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Returns: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/S01K6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S01K6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP Query results &lt;strong&gt;with asArray()&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entry_query = Entry::find()&#xA;-&amp;gt;section('inventory')&#xA;-&amp;gt;asArray();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KjnWq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KjnWq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However even when specifing to make the result set an array I still cannot figure out how to include the 'images' field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images is a field added to the section (see below)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Gwg8a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gwg8a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having a difficult time finding an answer via the documentation or an example of someone doing the same. All the examples i find are for the template side in twig. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8434" LastActivityDate="2018-11-28T10:26:55.093" Title="How to include asset fields in query in php?" Tags="&lt;craft3&gt;&lt;query&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28560" PostTypeId="1" AcceptedAnswerId="28570" CreationDate="2018-11-27T21:07:17.450" Score="1" ViewCount="60" Body="&lt;p&gt;I'm trying to translate the labels for a global checkbox field in my front-end templates like in this post: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/13709/is-there-a-way-to-have-checkbox-field-labels-translatable&quot;&gt;Is there a way to have checkbox field labels translatable?&lt;/a&gt;. &#xA;This looked promising but I can't seem to get it working (maybe it's Craft2 and things have changed in 3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it's using namespacing in the translations file e.g for a French translation file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;  'field.fruits.option.apple.label' =&amp;gt; 'pomme',&#xA;  'field.fruits.option.lemon.label' =&amp;gt; 'citron',&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But no translations showing in the template when I try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for fruit in myGlobalSet.fruits %}&#xA;    {{ fruit.label|t }}&#xA;{% endfor %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I'm sure it must be syntax related or wrong namespacing but I'm not getting any errors.&lt;/p&gt;&#xA;" OwnerUserId="2257" LastEditorUserId="2257" LastEditDate="2018-11-27T23:52:42.033" LastActivityDate="2018-11-30T23:52:44.880" Title="Translating checkbox labels" Tags="&lt;templating&gt;&lt;localization&gt;&lt;globals&gt;&lt;checkboxes&gt;&lt;label&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28561" PostTypeId="2" ParentId="28559" CreationDate="2018-11-27T21:14:45.940" Score="2" Body="&lt;p&gt;You can skip the &lt;code&gt;asArray()&lt;/code&gt; part, as the object has all you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// This bit returns only the query that defines what objects to get&#xA;$entryQuery = Entry::find()-&amp;gt;section('inventory');&#xA;&#xA;/*&#xA; * This will get you one object, based on the query. &#xA; * Use all() if you want an array of objects&#xA; */&#xA;$entry = $entryQuery-&amp;gt;one();&#xA;&#xA;// Of course, this could be written as&#xA;$entry = Entry::find()-&amp;gt;section('inventory')-&amp;gt;one();&#xA;&#xA;/* &#xA; * Thanks to Yii2's magic getters and setters, &#xA; * and the way Craft uses them, any custom field can be &#xA; * obtained by using the field's handle:&#xA; */&#xA;$customFieldContent = $entry-&amp;gt;customFieldHandle;&#xA;&#xA;/*&#xA; * If the custom field is any kind of relation field (assets, categories, tags ...),&#xA; * this custom field attribute would return a new query object.&#xA; * You'd need to call all() or one() again to get the actual related objects:&#xA; */&#xA; $images = $entry-&amp;gt;customImagesFieldHandle-&amp;gt;all();&#xA;&#xA;/*&#xA; * To improve performance, you can eager load the images:&#xA; */&#xA;$entry = Entry::find()&#xA;    -&amp;gt;section('inventory')&#xA;    -&amp;gt;with(['customImagesFieldHandle'])&#xA;    -&amp;gt;one();&#xA;&#xA;/*&#xA; * ... which would result in an array of images as the value of the&#xA; * customImagesFieldHandle attribute&#xA; */&#xA;$images = $entry-&amp;gt;customImagesFieldHandle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some light reading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;About entry queries&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html#eager-loading-image-transform-indexes&quot; rel=&quot;nofollow noreferrer&quot;&gt;About eager loading&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addition, after seeing exactly what it is you want. Use Craft's (or actually Yii's) &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/helper-array#building-maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;ArrayHelper map() function&lt;/a&gt; to loop through your entries and mapping entry content to what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\helpers\ArrayHelper&#xA;&#xA;// Use the map() function to do what you want&#xA;$entries = Entry::find()-&amp;gt;section('inventory')-&amp;gt;all();&#xA;&#xA;$entriesAsYouWantThem = ArrayHelper::map($entries, 'id', function($entry) {&#xA;    return (object)[&#xA;        'images' =&amp;gt; $entry-&amp;gt;images-&amp;gt;all(), // or without all, if you use -&amp;gt;with()&#xA;        'price' =&amp;gt; $entry-&amp;gt;price,&#xA;        'year' =&amp;gt; $entry-&amp;gt;year,&#xA;        ... All other fields&#xA;    ];&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastEditorUserId="110" LastEditDate="2018-11-28T10:26:55.093" LastActivityDate="2018-11-28T10:26:55.093" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28562" PostTypeId="2" ParentId="28556" CreationDate="2018-11-27T21:24:39.223" Score="1" Body="&lt;p&gt;This &lt;a href=&quot;https://github.com/craftcms/cms/issues/2622&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github issue&lt;/a&gt; helped me solve the problem and it was indeed tied to not forcing everything to SSL. Once I added the code below to my .htaccess to force all HTTP to HTTPs, it solved the problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteCond %{HTTP:X-Forwarded-Proto} !https&#xA;RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3465" LastActivityDate="2018-11-27T21:24:39.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28563" PostTypeId="2" ParentId="28559" CreationDate="2018-11-27T22:35:36.920" Score="1" Body="&lt;p&gt;Here is what I ended up doing. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $vehicles = array(); // empty container to hold our modified entries&#xA;    // Lets Query our Inventory - all of it&#xA;    /** @var array $entry_query   the name of our query to get our inventory - return a list of inventory after we execute query */&#xA;    $entries = Entry::find()&#xA;        -&amp;gt;section('inventory')&#xA;        -&amp;gt;all();&#xA;&#xA;    foreach($entries as $entry) {&#xA;        /*&#xA;         * Let's get all our custom fields we want&#xA;         * to include with our entries&#xA;         */&#xA;        // Get our image field and add to result set - because it's an asset field this returns a query object&#xA;        $ourimages = $entry-&amp;gt;images-&amp;gt;all(); // get all our images&#xA;        $price = $entry-&amp;gt;price;&#xA;        $featured = $entry-&amp;gt;featureThisVehicle;&#xA;        $make = $entry-&amp;gt;make;&#xA;        $model = $entry-&amp;gt;model;&#xA;        $year = $entry-&amp;gt;year;&#xA;        $description = $entry-&amp;gt;description;&#xA;        $inventoryStatus = $entry-&amp;gt;inventoryStatus;&#xA;        $bodyStyle = $entry-&amp;gt;bodyStyle;&#xA;        $color = $entry-&amp;gt;color;&#xA;        $miles = $entry-&amp;gt;miles;&#xA;        $vin = $entry-&amp;gt;vin;&#xA;        $stkid = $entry-&amp;gt;stkid;&#xA;&#xA;        // cast out entry object as an array - so we can add props to it&#xA;        $entry = (array)$entry;&#xA;&#xA;        // add our custom fields to our newly casted entry array&#xA;        $entry['images'] = $ourimages;&#xA;        $entry['price'] = $price;&#xA;        $entry['featured'] = $featured;&#xA;        $entry['make'] = $make;&#xA;        $entry['model'] = $model;&#xA;        $entry['year'] = $year;&#xA;        $entry['description'] = $description;&#xA;        $entry['inventoryStatus'] = $inventoryStatus;&#xA;        $entry['bodyStyle'] = $bodyStyle;&#xA;        $entry['color'] = $color;&#xA;        $entry['miles'] = $miles;&#xA;        $entry['vin'] = $vin;&#xA;        $entry['stkid'] = $stkid;&#xA;&#xA;        // Recast back to object just cause (not really necessary since we are json_encode'ing this)&#xA;        $entry = (object)$entry;&#xA;        array_push($vehicles, $entry);&#xA;    }&#xA;&#xA;    return json_encode($vehicles);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8434" LastActivityDate="2018-11-27T22:35:36.920" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28564" PostTypeId="1" CreationDate="2018-11-27T23:03:31.987" Score="1" ViewCount="90" Body="&lt;p&gt;I would like to know if there is a way unit test templates using Craft 2.5? For example trying to prevent null pointers happening in production when an image is remove from the entry&lt;/p&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="57" LastEditDate="2018-11-28T04:42:01.630" LastActivityDate="2018-11-28T04:42:01.630" Title="What the best strategy to test Craft template?" Tags="&lt;templating&gt;&lt;tests&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28565" PostTypeId="1" AcceptedAnswerId="28571" CreationDate="2018-11-28T00:02:14.463" Score="1" ViewCount="581" Body="&lt;p&gt;I currently have a freeform which allows logged in users to create an entry from the front end. I'm looking to build an edit page for each of these entry's so the user can come back and edit it if they've made a mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting confused on how to do this on a per entry basis. e.g. how do I make a link on the front end for each entry that links to it's own &lt;code&gt;/entry_slug/edit&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-11-28T17:31:40.583" Title="Edit Entry Page" Tags="&lt;templating&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28566" PostTypeId="2" ParentId="28565" CreationDate="2018-11-28T00:55:40.543" Score="2" Body="&lt;p&gt;In my &lt;code&gt;_entry.html&lt;/code&gt; (or &lt;code&gt;_entry.twig&lt;/code&gt;), I have the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ entry.url }}/edit&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would look like: &lt;a href=&quot;http://example.com/my-section/my-entry/edit&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://example.com/my-section/my-entry/edit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;a href=&quot;{{ url(entry.url ~ '/edit') }}&quot;&amp;gt;Edit entry&amp;lt;/a&amp;gt;&lt;/code&gt; may be considered a better practice.&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-11-28T01:05:20.537" LastActivityDate="2018-11-28T01:05:20.537" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28567" PostTypeId="1" AcceptedAnswerId="28601" CreationDate="2018-11-28T01:50:55.740" Score="2" ViewCount="448" Body="&lt;p&gt;I've setup a plugin like so &lt;code&gt;http://domain/admin/plugin-handle&lt;/code&gt; (cp section) and a settings page here &lt;code&gt;http://domain/admin/settings/plugins/plugin-handle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can edit my plugin settings under the latter URL, however I would like non admins to be able to do so as well, but under &lt;code&gt;http://domain/admin/plugin-handle&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about this? Adding e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ forms.textField({&#xA;    label: 'Headline'|t('craft-terms-of-service'),&#xA;    instructions: 'Enter the headline of your TOS here.'|t('craft-terms-of-service'),&#xA;    id: 'tosHeadline',&#xA;    name: 'tosHeadline',&#xA;    value: settings['tosHeadline']})&#xA;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the &lt;code&gt;http://domain/admin/plugin-handle&lt;/code&gt; template (&lt;code&gt;src/templates/index.twig&lt;/code&gt;) (cp section) non-admins have access to, I get &lt;code&gt;Variable &quot;settings&quot; does not exist.&lt;/code&gt; I can't figure out how to make it accessible/exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figured out how to add fields to the cp section through the &quot;Getting Started with Craft Plugin Development&quot; course on craftquest.io, however the way I'm saving the settings to the db is rather crude. I'm just doing &lt;code&gt;Craft::$app-&amp;gt;db-&amp;gt;createCommand(....&lt;/code&gt; to update the &lt;code&gt;plugins&lt;/code&gt; table. It works, but I'm sure there are much more elegant ways of doing it?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2018-11-28T16:48:47.480" LastActivityDate="2018-11-30T00:28:26.863" Title="Add settings to plugins cp section instead of settings page" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28569" PostTypeId="1" AcceptedAnswerId="28572" CreationDate="2018-11-28T03:48:10.453" Score="1" ViewCount="113" Body="&lt;p&gt;I'm having this weird issue that both of my custom plugin logs are not working but all other third party ones including craft.log work fine. By 'not working' I mean the log file is generated, but empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another weird thing is the issue only happens on production environment. Tested on local environment and staging environment, they all work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I got the code right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;MyPlugin::log(&quot;Errors:\n\n&quot; . print_r($fieldsData, true), LogLevel::Error);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's Craft 2 by the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything ideas?&lt;/p&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2018-11-28T08:28:08.527" Title="Custom plugin log not logging" Tags="&lt;craft2&gt;&lt;logs&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28570" PostTypeId="2" ParentId="28560" CreationDate="2018-11-28T04:55:00.963" Score="0" Body="&lt;p&gt;In order to do the namespaced trick in Craft 3, you'd do it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create your folder structure like this for your locale with one file for the Control Panel and one for the front-end of the site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FmhvE.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FmhvE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contents of files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K5A2n.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K5A2n.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Settings for Checkbox field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RsbWj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RsbWj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jklcE.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jklcE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Front-end results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qtttt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qtttt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit entry results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BcGvL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BcGvL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-11-30T23:52:44.880" LastActivityDate="2018-11-30T23:52:44.880" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28571" PostTypeId="2" ParentId="28565" CreationDate="2018-11-28T06:25:26.313" Score="3" Body="&lt;p&gt;Andrea's answer is part of the solution!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to set up a route, either via &lt;code&gt;routes.php&lt;/code&gt;, or via the admin. I tend to prefer PHP routes, so you never have to worry about the functionality being removed from the app due to actions in the CP.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'my/path/&amp;lt;entrySlug:{slug}&amp;gt;' =&amp;gt; ['template' =&amp;gt; '_my/path/edit-entry']&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Create a form in &lt;code&gt;templates/_my/path/edit-entry&lt;/code&gt; that contains all the fields you want a user to be able to edit.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;This doesn't actually restrict which fields they can update&lt;/em&gt;, but you don't have to display everything, if you don't want or need to. The only way to control which fields are updatable is via a custom module/plugin controller.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The edit page should include, at minimum:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Find the entry by slug and author: #}&#xA;{% set entry = craft.entries({&#xA;    slug: entrySlug,&#xA;    authorId: currentUser.id&#xA;}).one() %}&#xA;&#xA;{# If the entry wasn't found, or didn't belong to the current user, throw up the 404 page: #}&#xA;{% unless entry %}&#xA;    {% exit 404 %}&#xA;{% endunless %}&#xA;&#xA;{# Create a small form with your attributes: #}&#xA;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;title&quot; value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[myFieldHandle]&quot; value=&quot;{{ entry.myFieldHandle }}&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-11-28T17:31:40.583" LastActivityDate="2018-11-28T17:31:40.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28572" PostTypeId="2" ParentId="28569" CreationDate="2018-11-28T08:28:08.527" Score="2" Body="&lt;p&gt;Put the force parameter to true&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::log(&quot;Errors:\n\n&quot; . print_r($fieldsData, true), LogLevel::Error, true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2895/custom-log-in-craft&quot;&gt;Custom Log in Craft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9074" LastActivityDate="2018-11-28T08:28:08.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28573" PostTypeId="2" ParentId="23664" CreationDate="2018-11-28T09:08:03.570" Score="1" Body="&lt;p&gt;To give this an answer, the URI can be set on a per-site basis, so it is simply a matter of setting the URI for the English site to &lt;code&gt;about-us&lt;/code&gt; and the URI for the Dutch site to &lt;code&gt;over-ons&lt;/code&gt; on the section's settings page.&lt;/p&gt;&#xA;" OwnerUserId="180" LastActivityDate="2018-11-28T09:08:03.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28575" PostTypeId="1" AcceptedAnswerId="28582" CreationDate="2018-11-28T11:54:45.310" Score="1" ViewCount="225" Body="&lt;p&gt;I currently have a routing set up as follows to enable an &quot;Edit&quot; entry page following on from &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28565/edit-entry-page/28571#28571&quot;&gt;this question&lt;/a&gt; but I'm getting the following error message when going to that page.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;entrySlug&quot; does not exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have my routing set up as follows within my CP, which loads a URL like so &lt;code&gt;mydomain.com/marketplace/authorname/entryname/edit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/deO5g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/deO5g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and within my &lt;code&gt;listings/_edit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Find the entry by slug and author: #}&#xA;{% set listing = craft.entries({&#xA;    section: 'networks',&#xA;    slug: entrySlug,&#xA;    author: currentUser&#xA;}).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm really unsure why it can't find the slug of the entry.&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-11-28T17:15:02.173" Title="Variable &quot;entrySlug&quot; does not exist Routing" Tags="&lt;templating&gt;&lt;routes&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28576" PostTypeId="2" ParentId="28355" CreationDate="2018-11-28T12:10:59.760" Score="4" Body="&lt;p&gt;There is currently no way to populate a cart from a link as a standard feature of Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you could accomplish this in 2 ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) With a smart template to add all items from the order to the current cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a template that takes an order number param like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cart/start-order?number=5bnuy8843nuy48bdy48u3bd84&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that template you would do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# @var craft \craft\web\twig\variables\CraftVariable #}&#xA;&#xA;{% set number = craft.app.request.param('number') %}&#xA;{% set previousOrder = craft.orders.number(number).one() %}&#xA;&#xA;{% if not order %}&#xA;  {% redirect 'shop' %}&#xA;{% endif %}&#xA;&#xA;{# Get the current cart if there is one, also make sure the cart is persisted so we can add to it. #}&#xA;&#xA;{% if cart is not defined %}&#xA;  {% set cart = craft.commerce.getCarts().getCart(true) %}&#xA;{% endif %}&#xA;&#xA;{# Clears the current cart. This is optional as you may just want to add the items to the cart #}&#xA;{% do cart.setLineItems([]) %}&#xA;&#xA;{% for oldLineItem in previousOrder.lineItems %}&#xA;&#xA;  {% set lineItem = craft.commerce.lineitems.createLineItem(cart.id, oldLineItem.purchasableId, oldLineItem.options, oldLineItem.qty, oldLineItem.note) %}&#xA;&#xA;  {% do cart.addLineItem(lineItem) %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% do craft.app.elements.saveElement(cart) %}&#xA;&#xA;{%  for lineItem in cart.lineItems %}&#xA;  {{  lineItem.qty }} * {{ lineItem.description }}&#xA;{%  endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This add all items from the cart in the email link to the current cart. You would do a similar thing to populate addresses etc if you wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Alternatively, if you just want to replace the current cart in the users session with the incomplete cart you passed in from the email’s number param, you could do the following&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a plugin/model with a controller action.&lt;/li&gt;&#xA;&lt;li&gt;The controller action would accept an order number param (like the template example above)&lt;/li&gt;&#xA;&lt;li&gt;The controller action would do the following:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$request = Craft::$app-&amp;gt;getRequest();&#xA;$session = Craft::$app-&amp;gt;getSession();&#xA;&#xA;$number = $request-&amp;gt;getParam('number');&#xA;$order = \craft\commerce\elements\Order:find()-&amp;gt;number($number)-&amp;gt;one();&#xA;&#xA;if ($order &amp;amp;&amp;amp; !$order-&amp;gt;isCompleted){&#xA;  // Forget the current cart in their session.&#xA;  \craft\commerce\Plugin::getInstance()-&amp;gt;getCarts()-&amp;gt;forgetCart();&#xA;&#xA;  $session-&amp;gt;set('commerce_cart', $number);&#xA;  return $this-&amp;gt;redirect('shop/cart');&#xA;}&#xA;&#xA;return $this-&amp;gt;redirect('shop/cartLoadError');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should get you mostly there. Let me know if you have any questions.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-11-28T12:10:59.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28577" PostTypeId="2" ParentId="28235" CreationDate="2018-11-28T13:07:02.613" Score="0" Body="&lt;p&gt;Maybe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what Acunetix has to say about it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The test checks if a web application supports headers X-Original-URL&#xA;  or X-Rewrite-URL.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In this case, Craft CMS supports X-Rewrite-URL. Support of these&#xA;  headers is not a vulnerability itself, but more like misconfiguration&#xA;  which in some circumstances could lead to a vulnerability.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, if there is a reverse proxy(e.g Nginx) in from of Craft&#xA;  CMS and an administrator wants to restrict access to /admin/, s/he can&#xA;  set a deny rule on the proxy for location /admin/.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;location /admin/ {&#xA;          deny all;&#xA;          return 403;&#xA;      }&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;However an attacker is still able to access the admin interface as&#xA;  Nginx knows nothing about X-Rewrite-URL. So the attacker just sends a&#xA;  request like this:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;GET /something HTTP/1.1 Host: anything.com X-Rewrite-URL:&#xA;  /admin/login&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;A similar problem could be if a website is located behind a cache&#xA;  proxy. In this case, an attacker may exploit the cache poisoning&#xA;  attack which leads to XSS. It's a more complicated one. More&#xA;  information could be found here:&#xA;  &lt;a href=&quot;https://portswigger.net/blog/practical-web-cache-poisoning&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://portswigger.net/blog/practical-web-cache-poisoning&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Therefore, the support of these headers (X-Original-URL or&#xA;  X-Rewrite-UR) doesn't lead to vulnerabilities of the site&#xA;  anything.com (at least, from the first glance), but it would be&#xA;  much safer for all user of Craft CMS if Craft CMS will make a fix&#xA;  (remove the support of these headers).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4097" LastActivityDate="2018-11-28T13:07:02.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28578" PostTypeId="1" AcceptedAnswerId="28583" CreationDate="2018-11-28T13:50:41.377" Score="1" ViewCount="41" Body="&lt;p&gt;In my experience is the build-in process of image transform not too kind to the image quality, even with the highest quality. In my case the brighter tones in the images are lost which means that images have no properly defined edges.&#xA;Is there a good possibility to modify images troughout so they don't drop to total white?&lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2018-11-28T17:40:39.707" Title="modify image contrast" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28580" PostTypeId="1" AcceptedAnswerId="28581" CreationDate="2018-11-28T16:07:55.600" Score="1" ViewCount="34" Body="&lt;p&gt;I'm getting an &quot;UnexpectedValueException&quot; on the pages /admin/settings/categories/new and /admin/settings/email after updating to the beta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pUkUM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pUkUM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-11-28T16:11:29.687" Title="Craft 3.1 Beta - Email settings and categories not working" Tags="&lt;craft3&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28581" PostTypeId="2" ParentId="28580" CreationDate="2018-11-28T16:11:29.687" Score="1" Body="&lt;p&gt;Cause: Moved the template folder from / to /src/&#xA;This also apparently affect the backend / admin templates for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution: Update index.php to use the right path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NHJvZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHJvZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-11-28T16:11:29.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28582" PostTypeId="2" ParentId="28575" CreationDate="2018-11-28T16:38:51.787" Score="3" Body="&lt;p&gt;If I'm not mistaken, I don't think setting up the route via the CP does the fancy advanced rule stuff described &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. You'll therefore want to do that via the &lt;code&gt;config/routes.php&lt;/code&gt; file with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'marketplace/&amp;lt;authorSlug:[^\/]+&amp;gt;/&amp;lt;entrySlug:{slug}&amp;gt;/edit' =&amp;gt; ['template' =&amp;gt; 'listings/_edit'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;authorSlug&lt;/code&gt; and &lt;code&gt;entrySlug&lt;/code&gt; will be available for use in your &lt;code&gt;listings/_edit.twig&lt;/code&gt; template...&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-11-28T17:15:02.173" LastActivityDate="2018-11-28T17:15:02.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28583" PostTypeId="2" ParentId="28578" CreationDate="2018-11-28T17:40:39.707" Score="2" Body="&lt;p&gt;Do you know which image driver your instance is using? GD or Imagick? If GD, try changing the driver first to see if that's the case.&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2018-11-28T17:40:39.707" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28584" PostTypeId="1" CreationDate="2018-11-28T17:42:08.277" Score="1" ViewCount="35" Body="&lt;p&gt;I have a gallery in my site's &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; with images that are defined in a matrix field on each of my categories. If I'm viewing a category page or an entry with related categories I want to display this image gallery in the footer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I currently have is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if category is defined %}&#xA;    {% if category.actionBilder.exists() %}&#xA;        &amp;lt;div id=&quot;footerslide&quot;&amp;gt;&#xA;            {% for block in category.actionBilder.limit(3).orderBy('RAND()').all() %}&#xA;                {% if block.type == &quot;actionImg&quot; %}&#xA;                    &amp;lt;div data-image=&quot;{{block.image.one().url}}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;{% endif %}&#xA;&#xA;{% if entry is defined %}&#xA;    {% set categories = craft.categories.relatedTo(entry) %}&#xA;    {% for category in categories %}&#xA;        {% if category.actionBilder.exists() %}&#xA;            &amp;lt;div id=&quot;footerslide&quot;&amp;gt;&#xA;                {% for block in category.actionBilder.limit(3).orderBy('RAND()').all() %}&#xA;                    {% if block.type == &quot;actionImg&quot; %}&#xA;                        &amp;lt;div data-image=&quot;{{block.image.one().url}}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;                    {% endif %}&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While it's working fine, I don't think that this is the best solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you change my code to make it better?&lt;/p&gt;&#xA;" OwnerUserId="9083" LastEditorUserId="5275" LastEditDate="2018-12-13T18:58:13.793" LastActivityDate="2018-12-13T18:58:13.793" Title="Displaying gallery when viewing category page or entry with related categories - code review" Tags="&lt;entry&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28585" PostTypeId="2" ParentId="28558" CreationDate="2018-11-28T18:56:59.490" Score="1" Body="&lt;p&gt;Be sure and stash a reference to the User element you want to edit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myUser = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;$myUser-&amp;gt;setFieldValue('myUserField', 'New Field Value');&#xA;&#xA;if (Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($myUser)) {&#xA;    echo &quot;User saved.&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you may end up repeatedly fetching the stale record out of the database, instead of saving the modified instance.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note: The similarly-named &lt;code&gt;Craft::$app-&amp;gt;getUsers()&lt;/code&gt; is a method for getting the Users Service instance, which is responsible for saving users. Not to be confused with &lt;code&gt;Craft::$app-&amp;gt;getUser()&lt;/code&gt;, which is a (Yii) method for fetching the current user (the subsequent call to &lt;code&gt;getIdentity()&lt;/code&gt; retrieves the Craft Element for the user).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2019-04-13T23:27:55.907" LastActivityDate="2019-04-13T23:27:55.907" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28587" PostTypeId="1" CreationDate="2018-11-29T00:30:09.297" Score="1" ViewCount="38" Body="&lt;p&gt;So i'm trying to update a checkbox field using a custom plugin i built. I have three tiers on my site, tier one that you only get access to certain items, tier two you get access to tier one and other additional assets and tier three you get access to everything in both tier 1, 2 and 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sign up for tier two (while being signed in) the form i have shows the currentUser info already filled into the form. The only item NOT filled is a checkbox that is a terms of use, each form has a different terms of use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to be able to view the user and what Terms of Use they have accepted.&lt;/p&gt;&#xA;" OwnerUserId="8619" LastActivityDate="2018-11-29T00:30:09.297" Title="Updating Field from plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28588" PostTypeId="2" ParentId="28558" CreationDate="2018-11-29T10:41:16.527" Score="3" Body="&lt;p&gt;I used August's answer, but fixed it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put this at the top:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\User;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the updating code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$myUser = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;$myUser-&amp;gt;setFieldValue('fieldHand', 'value');&#xA;&#xA;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($myUser, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8039" LastActivityDate="2018-11-29T10:41:16.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28589" PostTypeId="1" CreationDate="2018-11-29T12:56:39.230" Score="2" ViewCount="54" Body="&lt;p&gt;New to this and just looking at a few solutions for a small start-up. Would I be able to take address details directly from Craft and interface directly to preferred carrier which is DPD here in UK? Currently my customer is typing address details from existing e-commerce site into DPD !!!&lt;/p&gt;&#xA;" OwnerUserId="9088" LastEditorUserId="57" LastEditDate="2018-11-30T03:42:41.257" LastActivityDate="2018-12-30T04:05:41.050" Title="I want to know if I can interface Craft address details into DPD shipping site" Tags="&lt;shipping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28590" PostTypeId="1" CreationDate="2018-11-29T13:02:59.637" Score="1" ViewCount="87" Body="&lt;p&gt;We're in the process of scoping out an online assessment form to be build in Craft CMS. We need to give the client the ability to add, edit and remove questions (custom fields) and would ideally like to handle all entries through a channel, rather than a dedicated form plugin. The thing I'm struggling with at the moment is how to render the field layout for a channel in my template. &lt;a href=&quot;https://docs.expressionengine.com/latest/channel/channel_form/examples.html#id3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expression Engine handles this using the {custom_fields} loop&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an equivalent template tag for Craft CMS? Or would we be better of working with Freeform or SproutForms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9087" LastActivityDate="2018-11-29T14:44:36.293" Title="Does Craft have an equivalent of EE's Custom Fields loop for front-end entry forms?" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;&lt;plugin-freeform&gt;&lt;entry-form&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28591" PostTypeId="1" AcceptedAnswerId="28592" CreationDate="2018-11-29T13:19:40.813" Score="1" ViewCount="236" Body="&lt;p&gt;I've got &lt;code&gt;$entryA&lt;/code&gt; with a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to programatically create a new &lt;code&gt;$entryB&lt;/code&gt; and copy the Matrix field from &lt;code&gt;$entryA&lt;/code&gt; to &lt;code&gt;$entryB&lt;/code&gt;.  How do I go about this?&lt;/p&gt;&#xA;" OwnerUserId="9089" LastEditorUserId="57" LastEditDate="2018-11-30T03:37:14.563" LastActivityDate="2018-11-30T03:37:14.563" Title="How to copy Matrix from one entry to another in Craft 3" Tags="&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28592" PostTypeId="2" ParentId="28591" CreationDate="2018-11-29T13:40:22.267" Score="2" Body="&lt;p&gt;The blocks in a Matrix field are all elements, with their owner ID set to the corresponding entry. This is how you could copy them (untested):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\MatrixBlock;&#xA;&#xA;foreach ($entryA-&amp;gt;matrixFieldHandle-&amp;gt;all() as $matrixBlockA) {&#xA;    $matrixBlockB = new MatrixBlock();&#xA;    $matrixBlockB-&amp;gt;fieldId = $matrixBlockA-&amp;gt;fieldId;&#xA;    $matrixBlockB-&amp;gt;typeId = $matrixBlockA-&amp;gt;typeId;&#xA;    $matrixBlockB-&amp;gt;ownerId = $entryB-&amp;gt;id;&#xA;    $matrixBlockB-&amp;gt;siteId = $entryB-&amp;gt;siteId;&#xA;    $matrixBlockB-&amp;gt;enabled = $matrixBlockA-&amp;gt;enabled;&#xA;    $matrixBlockB-&amp;gt;sortOrder = $matrixBlockA-&amp;gt;sortOrder;&#xA;    $matrixBlockB-&amp;gt;setFieldValues($matrixBlockA-&amp;gt;getFieldValues());&#xA;&#xA;    Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($matrixBlockB);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Things can get tricky if you have multiple sites and the entries do or do not get propagated (etc), but this is how it works in a nutshell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the above code to work, you have to first save Entry B, to get an entry ID for it. So, create Entry B, fill 'normal' fields, save Entry B, create Matrix B, save Matrix B.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-29T13:40:22.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28593" PostTypeId="2" ParentId="28590" CreationDate="2018-11-29T14:26:56.027" Score="1" Body="&lt;p&gt;Personally I don't have any experience with Free Form but have been using Sprout forms for quite some time now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Sprout forms your client can create entire forms or just add a couple of fields however you like it. The support on Sprout forms is decent aswell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus sprout forms got email notifications aswell which might be interesting for your client.&lt;/p&gt;&#xA;" OwnerUserId="3848" LastActivityDate="2018-11-29T14:26:56.027" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28594" PostTypeId="2" ParentId="28590" CreationDate="2018-11-29T14:44:36.293" Score="1" Body="&lt;p&gt;Yes, you can do this without a plugin. You just need a frontend entry form, ala &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/entry-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/entry-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you want them to be able to add/remove fields, then instead of hardcoding the fields, you'll need to iterate through the fields that are in a particular field layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A way to do that is discussed here: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2926/how-to-display-all-fields-belonging-to-current-entry/2928&quot;&gt;How to display all fields belonging to current entry?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-11-29T14:44:36.293" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28595" PostTypeId="1" CreationDate="2018-11-29T15:29:58.823" Score="2" ViewCount="54" Body="&lt;p&gt;I have a filter with a few different parameters that get pulled in and I was wondering if there was a relatedTo wildcard that I could use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set function = craft.app.request.getParam(&quot;function&quot;) %}&#xA;&#xA;{% set functionSection = 'craft.categories.group('businessFunction')'  %}&#xA;&#xA;{% if function | length %}&#xA;    {% set functionSection = craft.categories.group('businessFunction').slug( function|split(',') ) %}&#xA;{% endif %}&#xA;&#xA;&#xA;{% set posts = craft.entries({&#xA;          section: category,&#xA;          relatedTo: [&#xA;              'and',&#xA;              { element: functionSection } &#xA;          ]&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is if an entry doesn't have any Business Function selected then it's not related. I could have a conditional that ignores the relationship but there's multiple relations in the real code - it'd be easier if I could set functionSelect equal &quot;all&quot; or something similar.&lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2018-12-03T19:45:58.873" Title="Relation fallback if no category has been selected" Tags="&lt;categories&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28596" PostTypeId="1" AcceptedAnswerId="28597" CreationDate="2018-11-29T15:58:07.047" Score="1" ViewCount="270" Body="&lt;p&gt;I am using imageoptimize plugin to crop images, but I am unable to find cropping position setup in a template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set optimzedImages = craft.imageOptimize.createOptimizedImages(&#xA;       entry.backgroundImage.one(),&#xA;          [&#xA;                    {&#xA;                        'width': 1440,&#xA;                        'useAspectRatio': true,&#xA;                        'aspectRatioX': 1.0,&#xA;                        'aspectRatioY': 0.35,&#xA;                        'retinaSizes': ['1'],&#xA;                        'quality': 82,&#xA;                        'format': entry.backgroundImage.one().extension,&#xA;                        'position' : 'top-center'&#xA;                    }&#xA;                ]&#xA;            ) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code is cropping image in &lt;code&gt;center-center&lt;/code&gt; and I want to crop an image from top to aspect ratio height.&lt;/p&gt;&#xA;" OwnerUserId="8961" LastEditorUserId="57" LastEditDate="2018-11-30T03:39:34.930" LastActivityDate="2018-11-30T03:40:07.397" Title="craft-imageoptimize plugin cropping position" Tags="&lt;craft3&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28597" PostTypeId="2" ParentId="28596" CreationDate="2018-11-29T16:23:14.440" Score="2" Body="&lt;p&gt;FWIW, I would not recommend doing image resizing via your Twig templates, because it will do them on page load time. Rather, I’d recommend doing them via an Optimized Images field as per: &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize/blob/v1/README.md#dynamically-creating-optimized-image-variants&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-imageoptimize/blob/v1/README.md#dynamically-creating-optimized-image-variants&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you really want to do it, the parameter there is the same as you’d use for regular Craft transforms: &lt;a href=&quot;https://docs.craftcms.com/v3/image-transforms.html#defining-transforms-in-your-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/image-transforms.html#defining-transforms-in-your-templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could do &lt;code&gt;'top-center'&lt;/code&gt; or such&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But especially since you’re just creating one image variant, there’s no real advantage to doing this via ImageOptimize in your templates. Just use a regular Craft transform. With ImageOptimize installed, the resulting image will be optimized when done via Craft transforms, too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real benefit of using ImageOptimize to create image transforms is to make creating responsive image &lt;code&gt;srcset&lt;/code&gt;s easier. &lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="57" LastEditDate="2018-11-30T03:40:07.397" LastActivityDate="2018-11-30T03:40:07.397" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28599" PostTypeId="1" AcceptedAnswerId="28607" CreationDate="2018-11-29T22:15:26.750" Score="3" ViewCount="510" Body="&lt;p&gt;I need some direction in how to store (complex) data into users (best practice)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are skills and level 2 entries progressions for these skills, in the progressions I made a matrix containing a content field for an exercise, a table for data such as sets and reps and some practical information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is how it should work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The user starts a workout, a workout contains 4 or more exercises to complete for the workout to be finished. Now when every set of an exercise is done, the user has to fill in a number of repetitions he/she did for every set. When the workout finishes I would like to save all this data in the user (Or should i make a section for this?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &quot;skillID&quot;: {&#xA;      &quot;set1&quot;:&quot;rep1&quot;&#xA;      &quot;set2&quot;:&quot;rep2&quot;&#xA;    }, etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This data is important, the next time this user is logging in and starting a workout I want to retrieve this data to give the user overview of how he/she is progressing, so like comparing the workout data with the user data. Plus it should be some kind of history too. Here it gets a bit to complicated for me, but I want to learn this! My thoughts were this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 1: I create a section, here I create user data entries (so they are related with the user who create them) I store the data somehow on these entries, with tables or something&#xA;Option 2: I store 2 JSON models into the user (if possible), 1 for writing and overwriting the progress of each workout (when doing the same workout it overwrites the existing data) and 1 for the history, were every date of doing a workout is a key and the value is the whole workout data provided by the users input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to go?&lt;/p&gt;&#xA;" OwnerUserId="6623" LastEditorUserId="6623" LastEditDate="2018-11-30T13:23:58.693" LastActivityDate="2019-10-20T06:01:34.117" Title="How to store custom data into a user" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;&lt;json&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28601" PostTypeId="2" ParentId="28567" CreationDate="2018-11-30T00:28:26.863" Score="1" Body="&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my &lt;code&gt;src/template/index&lt;/code&gt; file I added this to make the form work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% import &quot;_includes/forms&quot; as forms %}&#xA;&#xA;&amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;&#xA;{{ csrfInput() }}&#xA;&#xA;{{ forms.hidden({&#xA;    name: 'action',&#xA;    value: 'craft-terms-of-service/default/save-tos'&#xA;}) }}&#xA;&#xA;{{ forms.hidden({&#xA;    name: 'tosCurrentVersion',&#xA;    value: now.timestamp&#xA;}) }}&#xA;&#xA;{{ forms.lightswitchField({&#xA;    label: 'Enable TOS?'|t,&#xA;    id: 'tosEnabled',&#xA;    name: 'tosEnabled',&#xA;    on: craft.craftTermsOfService.get('tosEnabled'),&#xA;    first: true&#xA;}) }}&#xA;&#xA;{{ forms.textField({&#xA;    label: 'Headline'|t('craft-terms-of-service'),&#xA;    instructions: 'Enter the headline of your TOS here.'|t('craft-terms-of-service'),&#xA;    id: 'tosHeadline',&#xA;    name: 'tosHeadline',&#xA;    value: craft.craftTermsOfService.get('tosHeadline')&#xA;}) }}&#xA;&#xA;{{ craft.craftTermsOfService.redactorField({&#xA;    label: 'Terms of Service'|t('craft-terms-of-service'),&#xA;    instructions: 'Enter the TOS every user must accept before using the site below.'|t('craft-terms-of-service'),&#xA;    name: 'tosBody',&#xA;    rows: 4,&#xA;    value: craft.craftTermsOfService.get('tosBody')|raw&#xA;})|raw }}&#xA;&#xA;&amp;lt;input type=&quot;submit&quot; class=&quot;submit btn&quot; value=&quot;{{ 'Save'|t }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;actions/craft-terms-of-service/default/save-tos&lt;/code&gt; controller I took the data from the request and updated the data in the &lt;code&gt;plugins&lt;/code&gt; table. Also in the form in my &lt;code&gt;index&lt;/code&gt; template I used the &lt;code&gt;craft.craftTermsOfService.get&lt;/code&gt; variable to fetch the settings from the &lt;code&gt;plugins&lt;/code&gt; table and give each form element its appropriate value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For details, see the &lt;a href=&quot;https://github.com/stianmandarin/crafttermsofservice/blob/master/src/controllers/DefaultController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller on github&lt;/a&gt; and the &lt;a href=&quot;https://github.com/stianmandarin/crafttermsofservice/blob/master/src/variables/CraftTermsOfServiceVariable.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;variable&lt;/a&gt; on github. Note this is the first time I make a plugin, so it's probably a mess, sorry about that.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2018-11-30T00:28:26.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28602" PostTypeId="2" ParentId="28589" CreationDate="2018-11-30T03:47:37.957" Score="1" Body="&lt;p&gt;Probably depends on exactly what you're looking to do, but it does look like DPD has some APIs you can integrate with: &lt;a href=&quot;https://www.dpd.com/nl_en/business_customers/help_en_tools/labelprint_tools/dpd_integration_services&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dpd.com/nl_en/business_customers/help_en_tools/labelprint_tools/dpd_integration_services&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that's the case, you'd be able to write a Craft/Commerce plugin to pull the data out that you need and interface with their APIs.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-30T03:47:37.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28603" PostTypeId="2" ParentId="1467" CreationDate="2018-11-30T08:36:35.313" Score="3" Body="&lt;p&gt;From an IA and content-modelling perspective, putting all your site's &quot;pages&quot; in a Structure is fraught with problems, and, in my opinion, does a terrible disservice to the future-friendly approach with which you should be building sites. I wrote about this at length recently: &lt;a href=&quot;https://cld.agency/blog/content-utopia&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cld.agency/blog/content-utopia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To more directly answer the question:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;stop mixing all your content types together in a single Structure (see article);&lt;/li&gt;&#xA;&lt;li&gt;divorce your navigation from the content;&lt;/li&gt;&#xA;&lt;li&gt;use a dedicated Channel or Structure for home page entries (note the plural - allows for A/B tests and seasonal variations, permanent storing of draft home pages etc), then load the most recent or first-structure-ordered entry manually in your home page template.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="271" LastActivityDate="2018-11-30T08:36:35.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28604" PostTypeId="1" AcceptedAnswerId="28615" CreationDate="2018-11-30T11:22:19.390" Score="1" ViewCount="2130" Body="&lt;p&gt;I'm trying to update Craft, but I'm getting an error while updating stating it's not possible to make a database backup. I've therefore gone for the suggestion to revert back instead of pushing on. Back in the CMS now when I try to create a backup manually (utilities-&gt; database backup) it tells me: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;there was a problem backing up your database. Please check the logs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done that and it says this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2018-11-30 11:43:57 [-][1][-][error][yii\base\Exception] yii\base\Exception: Could not create backup: proc_open() has been disabled for security reasons in /home/bxrdvjsx/xxxxxx.de/vendor/craftcms/cms/src/controllers/UtilitiesController.php:382&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how I can fix this? If it isn't obvious from my question I'm not very familiar with Craft and have inherited this website from the person who built it.&lt;/p&gt;&#xA;" OwnerUserId="8863" LastActivityDate="2018-11-30T23:13:59.307" Title="proc_open() has been disabled for security reasons" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28605" PostTypeId="1" AcceptedAnswerId="28608" CreationDate="2018-11-30T14:23:00.143" Score="2" ViewCount="836" Body="&lt;p&gt;I have this form &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;form method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;          &amp;lt;label&amp;gt;Listing Title&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;text&quot; name=&quot;title&quot; class=&quot;form-control&quot; value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;   &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to add a delete button to this form or will it have to be within another form targeting a different end point for entries?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-15T14:25:48.550" Title="Delete Entry from Front End" Tags="&lt;templating&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28606" PostTypeId="2" ParentId="28605" CreationDate="2018-11-30T14:41:43.853" Score="1" Body="&lt;p&gt;According to the corresponding &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/controllers/EntriesController.php#L465-L593&quot; rel=&quot;nofollow noreferrer&quot;&gt;controller method&lt;/a&gt;, there is no way to delete the entry on save. You'd have to call &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/controllers/EntriesController.php#L601-L644&quot; rel=&quot;nofollow noreferrer&quot;&gt;entries/delete-entry&lt;/a&gt; for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if this is really something you want and you're comfortable writing some PHP code, you could programmatically delete the entry before or after save, using a plugin or module.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-11-30T14:41:43.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28607" PostTypeId="2" ParentId="28599" CreationDate="2018-11-30T15:26:09.153" Score="3" Body="&lt;p&gt;There are a whole bunch of ways to do what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add custom fields to user accounts. If you wanted to go with option 2 then you could create a custom text field and write the JSON into that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way would be to add a Matrix field to the user accounts and write a new row for each workout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And another way would be to create a new channel for Workouts. When a user completes a workout, a new entry is created and related to them. You can then retrieve entries relating to that user to display their workout history.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yet another way, would be to create a custom model for a Workout and relate it to the user account. Your plugin would then create records using that model and you could retrieve them to display the user's progress.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-11-30T15:26:09.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28608" PostTypeId="2" ParentId="28605" CreationDate="2018-11-30T16:02:39.550" Score="5" Body="&lt;p&gt;I have a single form with a Save button and a Delete button.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action value is set to &lt;code&gt;entries/save-entry&lt;/code&gt; by default. However, when the user clicks the Delete button, the action value is changed to &lt;code&gt;entries/delete-entry&lt;/code&gt; via JavaScript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using &lt;a href=&quot;https://vuejs.org/&quot; rel=&quot;noreferrer&quot;&gt;Vue.js&lt;/a&gt; to accomplish this as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; id=&quot;action&quot; v-bind:value=&quot;'entries/' + actionVal&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Delete button:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;button type=&quot;submit&quot; value=&quot;delete&quot; v-on:click=&quot;actionVal = 'delete-entry'&quot;&amp;gt;Delete&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my Vue instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new Vue({&#xA;    el: '#app',&#xA;    delimiters: ['${', '}'],&#xA;    data: {&#xA;        actionVal: 'save-entry'&#xA;    },&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-11-30T16:02:39.550" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28609" PostTypeId="1" AcceptedAnswerId="30828" CreationDate="2018-11-30T16:55:06.880" Score="4" ViewCount="279" Body="&lt;p&gt;I've noticed that tasks only run when logged into the admin panel, is there anyway to avoid this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some context: I have jobs scheduled on a cron to run every 30 minutes, when I log in it seems that all of the items get queued up from the last time I logged in and proceed to run, this isn't terrible - but this app won't be seeing much login activity down the road.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`public function execute($queue)&#xA;{&#xA;    $section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('orders');&#xA;    $entryTypes = $section-&amp;gt;getEntryTypes();&#xA;    $entryType = reset($entryTypes);&#xA;&#xA;// Create an entry&#xA;    $entry = new Entry([&#xA;        'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;        'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;        'fieldLayoutId' =&amp;gt; $entryType-&amp;gt;fieldLayoutId,&#xA;        'authorId' =&amp;gt; 1,&#xA;        'title' =&amp;gt; 'Order Number: ' . $this-&amp;gt;orderId,&#xA;        'slug' =&amp;gt; $this-&amp;gt;orderId,&#xA;        'postDate' =&amp;gt; new DateTime(),&#xA;    ]);&#xA;&#xA;&#xA;    $entry-&amp;gt;setFieldValues([&#xA;        'orderId' =&amp;gt; $this-&amp;gt;orderId,&#xA;        'lineItemMatrix' =&amp;gt; $this-&amp;gt;lineItemMatrix,&#xA;        'couponMatrix' =&amp;gt; $this-&amp;gt;couponMatrix,&#xA;        'amountPayable' =&amp;gt; $this-&amp;gt;amountPayable,&#xA;        'orderTotal' =&amp;gt; $this-&amp;gt;orderTotal,&#xA;        'tax' =&amp;gt; $this-&amp;gt;tax,&#xA;        'sellerDiscount' =&amp;gt; $this-&amp;gt;sellerDiscount,&#xA;        'shipping' =&amp;gt; $this-&amp;gt;shipping&#xA;    ]);&#xA;    //check to see if entry exists.&#xA;    $existing = Entry::find()-&amp;gt;section('orders')-&amp;gt;slug($entry-&amp;gt;slug)-&amp;gt;one();&#xA;&#xA;    if (is_null($existing)){&#xA;        return Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;    } else {&#xA;       // don't do anything;&#xA;        return false;&#xA;    }&#xA;}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9094" LastEditorUserId="180" LastEditDate="2019-07-01T15:33:46.000" LastActivityDate="2019-07-01T15:33:46.000" Title="How can I get tasks to complete when not logged in to the CP?" Tags="&lt;php&gt;&lt;queue&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28610" PostTypeId="1" CreationDate="2018-11-30T16:59:29.520" Score="1" ViewCount="171" Body="&lt;p&gt;I am trying to create an export from an old Craft2 site over to a new Craft3 site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure and fields are all different, so I figured the easiest way was to create a json file from my entries and use FeedMe to import them back into Craft3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm having problems formatting the text so that it validates as json, but keeps the html markup so it looks nice again when imported to Craft3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;bio&quot;: {{ person.mainContent }}&quot;,&#xA;&quot;bio&quot;: {{ person.mainContent|escape }}&quot; (with and without ('js'), ('html')&#xA;&quot;bio&quot;: {{ person.mainContent|raw }}&quot;,&#xA;&quot;bio&quot;: {{ person.mainContent|json_encode }}&quot;,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a combination of these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seem to be some invisible newline or other character(s) preventing this from validating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the |replace filter with &quot;\n&quot; and &quot;\r&quot; to &quot;&lt;br /&gt; but it still fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only times I have gotten the json to validate and get imported by FeedMe the HTML is encoded too, so it just shows up in the rich text editor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some easy fix I am missing, or do i have to create a gigantic replace function?&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-11-30T16:59:29.520" Title="Escaping rich text fields to json but keep html markup" Tags="&lt;templating&gt;&lt;json&gt;&lt;plugin-feedme&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28611" PostTypeId="1" AcceptedAnswerId="28613" CreationDate="2018-11-30T17:03:47.630" Score="1" ViewCount="46" Body="&lt;p&gt;I have this form, there's no errors getting thrown and the User photo field is not updating via this form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;        {{ csrfInput() }}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;users/{{ currentUser.username }}&quot;&amp;gt;&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;          {% if currentUser.photoUrl|length %}&#xA;              &amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot; class=&quot;img-fluid mb-2 border&quot; /&amp;gt;&#xA;          {% else %}&#xA;            &amp;lt;img src=&quot;http://placehold.it/1024x468/f5f5f5/ccc.png&quot; class=&quot;img-fluid mb-2&quot; alt=&quot;{{ entry.title }}&quot; /&amp;gt;&#xA;          {% endif %}&#xA;          &amp;lt;label&amp;gt;Profile Picture&amp;lt;/label&amp;gt;&#xA;          &amp;lt;input type=&quot;file&quot; name=&quot;fields[photo]&quot; class=&quot;form-control-file upload&quot;&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;input type=&quot;submit&quot; value=&quot;Save Profile&quot;&amp;gt;&#xA;&#xA;      &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm unsure why it's not working, as it's fairly identical to some questions on SO.&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-11-30T20:28:09.377" Title="Updating User Photo from Front-End" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28613" PostTypeId="2" ParentId="28611" CreationDate="2018-11-30T17:35:52.673" Score="2" Body="&lt;p&gt;Im my form, I also have a hidden field for the user photo:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;photo&quot; value=&quot;{{ currentUser.photo }}&quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;code&gt;{% if currentUser.photo %}&lt;/code&gt; instead of &lt;code&gt;{% if currentUser.photoUrl|length %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;code&gt;&amp;lt;img src=&quot;{{ currentUser.getPhoto.getUrl() }}&quot;&amp;gt;&lt;/code&gt; instead of &lt;code&gt;&amp;lt;img src=&quot;{{ currentUser.photoUrl }}&quot;&amp;gt;&lt;/code&gt;. This should display the current photo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File input field name should be &lt;code&gt;photo&lt;/code&gt;: &lt;code&gt;&amp;lt;input type=&quot;file&quot; id=&quot;photo&quot; name=&quot;photo&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="298" LastEditDate="2018-11-30T20:28:09.377" LastActivityDate="2018-11-30T20:28:09.377" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28615" PostTypeId="2" ParentId="28604" CreationDate="2018-11-30T23:13:59.307" Score="1" Body="&lt;p&gt;Your host has likely added &lt;code&gt;proc_open&lt;/code&gt; to your php.ini file's &lt;a href=&quot;https://secure.php.net/manual/en/ini.core.php#ini.disable-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;disable_functions&lt;/a&gt; setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to it, you can remove it from that setting.  If not, you'll have to ask your host to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that Craft requires the PHP &lt;code&gt;proc_*&lt;/code&gt; methods to be able to perform some operations here: &lt;a href=&quot;https://docs.craftcms.com/v3/requirements.html#optional-php-methods-and-configurations&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/requirements.html#optional-php-methods-and-configurations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-11-30T23:13:59.307" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28616" PostTypeId="2" ParentId="28548" CreationDate="2018-12-01T04:28:15.957" Score="2" Body="&lt;p&gt;Success!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I have an Event that does a EVENT_BEFORE_SAVE_ELEMENT check.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_BEFORE_SAVE_ELEMENT, function(Event $event){&#xA;&#xA;    /**&#xA;     *  Runs so an admin doesn't have to set SKU or Slug when creating a NEW SONG&#xA;     *  This Event will also set the Price based on the Price Group Category Selected&#xA;     */&#xA;&#xA;    // Only perform action if we are working with a Digital Product and Song Type&#xA;    if ( ($event-&amp;gt;element instanceof \craft\digitalproducts\elements\Product) &amp;amp;&amp;amp; ($event-&amp;gt;element-&amp;gt;typeId == 1) ) {&#xA;&#xA;        // Only adjust the SKU and Slug if this is a NEW Digital Product&#xA;        if ($event-&amp;gt;isNew) {&#xA;&#xA;            // Get the last row from the Content Table&#xA;            $lastId = (new \craft\db\Query())&#xA;                -&amp;gt;select([&#xA;                    'elements.id'&#xA;                ])&#xA;                -&amp;gt;from('elements')&#xA;                -&amp;gt;orderBy('id DESC')&#xA;                -&amp;gt;limit(1)&#xA;                -&amp;gt;one();&#xA;&#xA;            // Increment the Last ID number by One. This will work fine unless the last item was deleted.&#xA;            // But the point of this is to assign a new, unused number to the Slug and SKU anyway&#xA;            $songId = $lastId['id'] + 1;&#xA;&#xA;            // Assign the SKU and Slug&#xA;            $event-&amp;gt;element-&amp;gt;sku = 'song-' . $songId;&#xA;            $event-&amp;gt;element-&amp;gt;slug = $songId;&#xA;        }&#xA;&#xA;        // Get the price from the Price Category&#xA;        $categories = $event-&amp;gt;element-&amp;gt;getfieldValue('priceCategory')-&amp;gt;one();&#xA;        $productPrice = $categories['productPrice'];&#xA;&#xA;        $event-&amp;gt;element-&amp;gt;price = $productPrice;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also have a method that checks the Categories. If the price changes there, then it goes back and updates the prices on all the products, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Then, to connect the Verbb Gift Voucher plugin and to adjust the Line Items by a percent discount, I run this EVENT_REGISTER_ORDER_ADJUSTERS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(OrderAdjustments::class, OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS, function(RegisterComponentTypesEvent $event) {&#xA;    $event-&amp;gt;types[] = CartAdjustmentsAdjuster::class;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is this:&#xA;    class CartAdjustmentsAdjuster implements AdjusterInterface&#xA;    {&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Properties&#xA;    // =========================================================================&#xA;&#xA;    private $_orderLineItems;&#xA;&#xA;    // Public Methods&#xA;    // =========================================================================&#xA;&#xA;    public function adjust(Order $order): array&#xA;    {&#xA;        $adjustments = [];&#xA;&#xA;        $this-&amp;gt;_orderLineItems = $order-&amp;gt;getLineItems();&#xA;&#xA;        // Get the Voucher code by session&#xA;        $giftVoucherCodes = Craft::$app-&amp;gt;getSession()-&amp;gt;get('giftVoucher.giftVoucherCodes');&#xA;&#xA;        if (!$giftVoucherCodes || count($giftVoucherCodes) == 0) {&#xA;            return [];&#xA;        }&#xA;&#xA;        foreach ($giftVoucherCodes as $giftVoucherCode) {&#xA;            $voucherCode = Code::find()&#xA;                -&amp;gt;where(['=', 'codeKey', $giftVoucherCode])&#xA;                -&amp;gt;one();&#xA;&#xA;            if ($voucherCode) {&#xA;&#xA;                $priceAdjust = (new \craft\db\Query())&#xA;                    -&amp;gt;select([&#xA;                        'content.field_prePayDiscount'&#xA;                    ])&#xA;                    -&amp;gt;from('content')&#xA;                    -&amp;gt;innerJoin('giftvoucher_codes', '[[giftvoucher_codes.voucherId]] = [[content.elementId]]')&#xA;                    -&amp;gt;where(['=', 'giftvoucher_codes.codeKey', $voucherCode])&#xA;                    -&amp;gt;all();&#xA;&#xA;                $discount = $priceAdjust[0]['field_prePayDiscount'];&#xA;                if($discount &amp;gt; 0) {&#xA;&#xA;                    foreach ($this-&amp;gt;_orderLineItems as $item)&#xA;                    {&#xA;                        $origAmt = $item-&amp;gt;price;&#xA;                        $saleAmt = ($discount / 100);&#xA;                        $discountAmt = $saleAmt * $origAmt;&#xA;                        $discountPrice = $origAmt - $discountAmt;&#xA;&#xA;                        $item-&amp;gt;saleAmount = $saleAmt;&#xA;                        $item-&amp;gt;salePrice = $discountPrice;&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        return $adjustments;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One important note is that this custom adjuster needs to be installed first before the Verbb Gift Voucher plugin so that the Gift Voucher amount will be applied after the Line Item adjustments are made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/adjusters.html#register-a-new-adjuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You could have a project level event listener, that could reorder these adjusters, and not append any new ones.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But installing in this order works, too.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="4102" LastEditDate="2018-12-01T05:11:16.143" LastActivityDate="2018-12-01T05:11:16.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28618" PostTypeId="1" CreationDate="2018-12-01T14:51:24.573" Score="1" ViewCount="121" Body="&lt;p&gt;I'm editing an entry via an entry form as documented here:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/entry-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/entry-form.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I be able to save a link field that's using &lt;a href=&quot;https://github.com/sebastian-lenz/craft-linkfield&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/sebastian-lenz/craft-linkfield&lt;/a&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;website&quot; type=&quot;text&quot; name=&quot;fields[website]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(where &quot;website&quot; is the handle of the link field) but that just throws a syntax error (in json_decode) at vendor/sebastianlenz/linkfield/src/fields/LinkField.php:112&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works fine for other  elements that use one of the built-in field types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible using the standard entries/save-entry endpoint? Or would I need to write a custom controller, and how so? &lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2018-12-01T15:18:21.280" Title="Saving a &quot;craft-linkfield&quot; field via an entry form" Tags="&lt;craft3&gt;&lt;custom-fieldtype&gt;&lt;link&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28619" PostTypeId="2" ParentId="28618" CreationDate="2018-12-01T15:18:21.280" Score="1" Body="&lt;p&gt;Found a solution by inspecting the HTML for the entry edit form in the CP. This works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input id=&quot;fields-website-type&quot; name=&quot;fields[website][type]&quot; value=&quot;url&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;fields-website-isCpFormData&quot; name=&quot;fields[website][isCpFormData]&quot; value=&quot;true&quot; type=&quot;hidden&quot;&amp;gt;&#xA;&amp;lt;input id=&quot;website&quot; type=&quot;text&quot; name=&quot;fields[website][url]&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2018-12-01T15:18:21.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28620" PostTypeId="1" CreationDate="2018-12-01T15:47:38.400" Score="1" ViewCount="46" Body="&lt;p&gt;I added a nginx config rewrite rule to remove static asset numbers from file names. It works great on the server config file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    # enable static file caching&#xA;    location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ {&#xA;     try_files $uri $1.$2;&#xA;    }&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I'm now trying to use a custome serve-craft.sh on my homestead local to replace the default serve.laravel.sh. (to prevent losing my nginx config every time I do a reload --provision).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not familiar with sh syntax and the following doesn't seem to work when I load the sh by adding a &quot;type:craft&quot; to my homestead.yaml&#xA;I suspect the try_files line has syntax error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I rewrite this in shell script?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea anyone?&lt;/p&gt;&#xA;" OwnerUserId="8889" LastEditorUserId="8889" LastEditDate="2018-12-01T16:19:31.050" LastActivityDate="2019-01-02T17:02:30.457" Title="shell script question on homestead" Tags="&lt;nginx&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28621" PostTypeId="1" AcceptedAnswerId="28622" CreationDate="2018-12-01T19:08:57.550" Score="2" ViewCount="261" Body="&lt;p&gt;I have created a plain text field that is assigned to a section and is available in the tabs for entries in that section. I want to use this field's value to modify the CSS on my template. My _entry.html file looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/site&quot; %}&#xA;{% set title = entry.title %}&#xA;{% set modifierClass = entry.shortName %}&#xA;{% set bodyClass = &quot;work modifierClass&quot; %}&#xA;&#xA;{% block main %}&#xA;&amp;lt;section class=&quot;entry is-centered cf&quot;&amp;gt;&#xA;  &amp;lt;article&amp;gt;&#xA;  &amp;lt;/article&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have assigned the entry.shortName to the customClass variable, but it is not working correctly. The text &quot;modifierClass&quot; is outputted in the body tag instead of what is entered in the entry.shortName field. If I place the &lt;code&gt;{{ entry.shortName }}&lt;/code&gt; within the &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; tags, it is outputted correctly there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any reason why this is not working? Or am I not understanding how field values can be assigned to variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;" OwnerUserId="9101" LastActivityDate="2018-12-01T20:10:28.503" Title="Use an entry field's value in body class" Tags="&lt;entries&gt;&lt;entries-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28622" PostTypeId="2" ParentId="28621" CreationDate="2018-12-01T20:10:28.503" Score="3" Body="&lt;p&gt;You've assigned the string &lt;code&gt;'work modifierClass'&lt;/code&gt; to the &lt;code&gt;bodyClass&lt;/code&gt; variable, rather than adding the &lt;em&gt;value&lt;/em&gt; of the &lt;code&gt;modifierClass&lt;/code&gt; variable to &lt;code&gt;bodyClass&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can assign the value of &lt;code&gt;modifierClass&lt;/code&gt; to &lt;code&gt;bodyClass&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyClass = 'work ' ~ modifierClass %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The ~ (tilde) character is Twig's string concatenation operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could even remove the &lt;code&gt;modifierClass&lt;/code&gt; variable altogether and just do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyClass = 'work ' ~ entry.shortName %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8173" LastActivityDate="2018-12-01T20:10:28.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28623" PostTypeId="1" AcceptedAnswerId="29205" CreationDate="2018-12-01T23:01:25.633" Score="1" ViewCount="142" Body="&lt;p&gt;What's the best way to hide the URL from the user/browser task bar? The only way I can get the link to work for a customer is to select the &quot;Assets have public URL&quot;, which I really would prefer not to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though the link to the files are on a protected My Downloads page surrounded by If License, it wouldn't be hard for a knowledgeable internet user to start guessing other file paths. I already have the filenames closely related, but not exact to the product title and the products are in a subfolder by entry id. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A preferred way would be to have the product file directory be above the web root, but I can't seem to find any way to do that with the plugin as it is. Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose I could just make my download folder a string of 30 random characters so at least you can't see the full URL in the bottom of a browser as it would get cut off. But a smart user could still copy the link to the clipboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there is the &lt;a href=&quot;https://github.com/tikiatua/internal-assets-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;Internal Assets&lt;/a&gt; plugin that looks to do what I want, but it's based on User Permissions. So I assume I would have to write a plugin that assigns a user permission to a file once they get a license generated, but it would be nice to have that feature be a part of the Digital Products itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other options?&lt;/p&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2019-01-21T03:48:21.270" Title="Hide or obfuscate Digital Product file path?" Tags="&lt;plugin-craftcommerce2&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28624" PostTypeId="1" CreationDate="2018-12-01T23:55:17.500" Score="1" ViewCount="161" Body="&lt;p&gt;with &lt;code&gt;{{ block.timeLimit|date('M d Y H:i')}}&lt;/code&gt; i can get the real Date &amp;amp; Time in always the real Language from the Site. &#xA;If the Page is German output is Dez, in English output is Dec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i set the output of this Date always to en? Whatever language the Site has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for every help!&lt;/p&gt;&#xA;" OwnerUserId="9083" LastActivityDate="2020-02-15T16:31:12.783" Title="Multi-Language Site but the Date should be always in English" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;datetime&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28626" PostTypeId="1" AcceptedAnswerId="28628" CreationDate="2018-12-02T16:00:45.867" Score="1" ViewCount="257" Body="&lt;p&gt;I'm calling user photo's from my template, but it error's out when trying to obviously call a user photo which is empty. What I'm trying to achieve is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;if there is no user photo, use the default placeholder image craft supplies&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The problem I'm having trouble getting to the bottom of is, how to access the default user photo?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;img class=&quot;img-fluid rounded-circle&quot; src=&quot;{{ entry.author.getPhoto().url }}&quot; width=&quot;100&quot; height=&quot;100&quot; alt=&quot;{{ entry.author }} Picture&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be great&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-03T01:18:35.863" Title="Access Default User Photo" Tags="&lt;templating&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28627" PostTypeId="1" CreationDate="2018-12-02T18:15:16.670" Score="1" ViewCount="63" Body="&lt;p&gt;User Access Question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use Craft to create users that can only use the site?  These users would only be viewers of the content.  They would NOT have access to Craft or any of its features.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way, users login to my site and I have Craft (theoretically) setup to control their access to either the entire site or specific sections only, NOT edit or have access to any Craft features.  I don't even want them to know craft exists. '&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I only want paid clients to have access to the site. &lt;/p&gt;&#xA;" OwnerUserId="5490" LastActivityDate="2018-12-03T08:25:41.183" Title="Can I use Craft to Manage Site Access?" Tags="&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28628" PostTypeId="2" ParentId="28626" CreationDate="2018-12-03T01:18:35.863" Score="1" Body="&lt;p&gt;You want to use the default blank user SVG from the Control Panel on the front-end of the site when there is no photo selected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, it's probably easiest just to copy it from &lt;code&gt;vendor/craftcms/cms/web/assets/cp/dist/images/user.svg&lt;/code&gt; to a place in your public HTML folder and reference it there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.author.getPhoto() %}&#xA;    {{ entry.author.getPhoto().url }}&#xA;{% else %}&#xA;    {{ url('path/to/user.svg') }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-03T01:18:35.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28629" PostTypeId="2" ParentId="28627" CreationDate="2018-12-03T08:25:41.183" Score="1" Body="&lt;p&gt;Yes, absolutely. You can use the &lt;code&gt;{% requireLogin %}&lt;/code&gt; tag at the top of any templates that you want to protect, and you can create a login form very easily to allow registered users to login and access the site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/login-form.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8173" LastActivityDate="2018-12-03T08:25:41.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28630" PostTypeId="1" AcceptedAnswerId="28634" CreationDate="2018-12-03T10:15:23.760" Score="2" ViewCount="80" Body="&lt;p&gt;Do the ImageOptimize variants that are set on volumes replace the default image transforms that can be set within Craft asset settings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to check as the &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin documentation&lt;/a&gt; isn't really explicit about this.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="57" LastEditDate="2018-12-03T16:00:37.270" LastActivityDate="2018-12-03T16:50:11.560" Title="Do ImageOptimize Volume Variant Transforms replace Craft's default Asset Transforms?" Tags="&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28631" PostTypeId="1" AcceptedAnswerId="28632" CreationDate="2018-12-03T12:21:04.740" Score="1" ViewCount="49" Body="&lt;p&gt;I am working on a project with multiple developers and another member of the team is getting on with a Plugin to assist with some CraftCommerce integrations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it's not a publicly available plugin, it's being stored locally in our repo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, whenever I run any Composer command on my local machine I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[RuntimeException]&#xA;  Package &amp;lt;agency&amp;gt;/&amp;lt;plugin&amp;gt; cannot install to&#xA;  &quot;/Users/jaycollett/Development/project/build/custom/&amp;lt;plugin&amp;gt;&quot;&#xA;  inside its source at &quot;/Users/jaycollett/Development/project/build/&#xA;  custom/&amp;lt;plugin&amp;gt;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We have found this response from Andrew Welch, but it can't be this because our Composer.json repositories section is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;composer&quot;,&#xA;      &quot;url&quot;: &quot;https://asset-packagist.org&quot;&#xA;    },&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;./custom/&amp;lt;plugin&amp;gt;&quot;&#xA;    }&#xA;  ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-03T12:37:53.893" Title="Error running any Composer command" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28632" PostTypeId="2" ParentId="28631" CreationDate="2018-12-03T12:37:53.893" Score="1" Body="&lt;p&gt;After discussing it with the team we worked out that deleting the plugin directory from the &lt;code&gt;/vendors&lt;/code&gt; folder and rerunning &lt;code&gt;composer install&lt;/code&gt; resolved it. Not sure why though...&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-03T12:37:53.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28633" PostTypeId="2" ParentId="28595" CreationDate="2018-12-03T15:25:14.620" Score="1" Body="&lt;p&gt;I had to use a bunch of conditionals to accomplish this - it's not ideal but here's what I came up with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set category = craft.app.request.getParam(&quot;category&quot;) %}&#xA;{% set function = craft.app.request.getParam(&quot;function&quot;) %}&#xA;{% set industry = craft.app.request.getParam(&quot;industries&quot;) %}&#xA;&#xA;{% if not category | length %}&#xA;        {% set category = &quot;blog,caseStudies,videos,webinar,whitePapers&quot; %}&#xA;{% endif %}&#xA;&#xA;{% set category = category | split(',') %}&#xA;&#xA;&#xA;{% set posts = craft.entries({&#xA;    section: category,&#xA;    orderBy: &quot;postDate desc&quot;&#xA;}) %}&#xA;&#xA;  {% if function | length %}&#xA;    {% set functionSection = craft.categories.group('businessFunction').slug( function|split(',') ) %}&#xA;    {% set posts = posts.relatedTo(functionSection) %}&#xA;  {% endif %}&#xA;&#xA;  {% if industry | length %}&#xA;    {% set industrySection = craft.categories.group('industry').slug( industry|split(',') ) %}&#xA;    {% set posts = posts.relatedTo(industrySection) %}&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="7426" LastEditDate="2018-12-03T19:45:58.873" LastActivityDate="2018-12-03T19:45:58.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28634" PostTypeId="2" ParentId="28630" CreationDate="2018-12-03T16:09:03.823" Score="2" Body="&lt;p&gt;No, they do not replace Craft transforms. They are in addition to. And in fact, Image Optimize uses regular old Craft Transforms under the hood.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image Optimize will do three major things for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every image transform you do, whether it be via Craft image transforms, or the Optimized Images field will be run through a variety of image optimizers that you have installed, including making &lt;code&gt;.webp&lt;/code&gt; variants&lt;/li&gt;&#xA;&lt;li&gt;An Optimized Images field makes it easy to create an image &lt;code&gt;srcset&lt;/code&gt; for doing responsive images&lt;/li&gt;&#xA;&lt;li&gt;You can entirely replace the transform method from your local server to a service like Imgix or Thumbor&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These all operate independent of each other, but they can work together as well.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-12-03T16:50:11.560" LastActivityDate="2018-12-03T16:50:11.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28635" PostTypeId="1" CreationDate="2018-12-03T16:41:25.373" Score="1" ViewCount="360" Body="&lt;p&gt;I am trying to set an entires status to &lt;code&gt;disabled&lt;/code&gt; from a front-end form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the click event listener I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).on('click', '.delete', function (event) {&#xA;    let $this = $(event.currentTarget);&#xA;    let verify = confirm(&quot;Are you sure you want to remove this?&quot;);&#xA;&#xA;    if (verify) {&#xA;        let params = {&#xA;            'entryId': $this.data('id'),&#xA;            'sectionId': $this.data('section'),&#xA;            'enabled': 0&#xA;        };&#xA;&#xA;        // append CSRF token.&#xA;        params[window.csrfTokenName] = window.csrfTokenValue;&#xA;&#xA;        onSetEntryStatus(params, function (res) {&#xA;            console.log(res);&#xA;        });&#xA;    } else {&#xA;        console.log('do nothing');&#xA;    }&#xA;&#xA;    event.preventDefault();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my ajax method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function onSetEntryStatus(data, callback) {&#xA;    $.ajax({&#xA;        type: 'post',&#xA;        contentType: 'application/json; charset=UTF-8',&#xA;        cache: false,&#xA;        data: data,&#xA;        url: '/actions/entries/save-entry',&#xA;        processData: false,&#xA;        dataType: 'json',&#xA;        timeout: 50000&#xA;    }).done(function (response) {&#xA;        console.log('response', response);&#xA;    }).fail(function (error) {&#xA;        // Total fail.&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(also tried posting to &lt;code&gt;actions/entries/save-entry&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Request payload is coming across as: &lt;code&gt;[object Object]&lt;/code&gt; so clearly I'm having a brain-fart moment there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything I have commented out, are things that i've seen in the console when setting the status from the CP. Currently, I am getting a 403 error back. I am able to verify that I am passing in the csrf token, so I am guessing it is because of the (incorrect) way I am sending data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grateful for any suggestions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When logging out what params I'm sending to the ajax method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;enabled: 0&#xA;entryId: 1465&#xA;sectionId: 5&#xA;_token: 'really-long-string'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastEditorUserId="2275" LastEditDate="2018-12-04T17:10:50.637" LastActivityDate="2018-12-04T18:06:00.063" Title="How can I set an entires status via ajax from a front-end form?" Tags="&lt;craft3&gt;&lt;entry&gt;&lt;status&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28636" PostTypeId="2" ParentId="28620" CreationDate="2018-12-03T16:47:16.713" Score="2" Body="&lt;p&gt;The best way to accomplish what you're trying to accomplish would be to utilize the &lt;code&gt;after.sh&lt;/code&gt; shell script that Homestead provides. Check out &lt;a href=&quot;https://laravel.com/docs/5.7/homestead#extending-homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Extending Homestead&lt;/a&gt; and &lt;a href=&quot;https://nystudio107.com/blog/local-development-with-vagrant-homestead&quot; rel=&quot;nofollow noreferrer&quot;&gt;Local Development with Vagrant / Homestead&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-03T16:47:16.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28637" PostTypeId="2" ParentId="28635" CreationDate="2018-12-03T19:14:18.763" Score="1" Body="&lt;p&gt;My best guess, based on what you want to do, is that you don't have the correct permissions to change the entry's status. The &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-web-controller.html#method-requirepermission&quot; rel=&quot;nofollow noreferrer&quot;&gt;requirePermission&lt;/a&gt; method kicks in and will send a 403 if you don't have permission to enable an entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the only way to change this, is to make sure that the logged in user has the correct permission(s).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-12-03T19:14:18.763" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28638" PostTypeId="1" CreationDate="2018-12-03T22:59:18.197" Score="2" ViewCount="512" Body="&lt;p&gt;Is there a way to access another database outside of the one Craft uses for its content? I need to able to access data fields from an external source for a project I'm working on.&lt;/p&gt;&#xA;" OwnerUserId="8999" LastActivityDate="2018-12-04T01:57:58.463" Title="Accessing Multiple Databases in Craft" Tags="&lt;craft3&gt;&lt;database&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28639" PostTypeId="2" ParentId="28638" CreationDate="2018-12-03T23:30:53.320" Score="6" Body="&lt;p&gt;From your &lt;code&gt;config/app.php&lt;/code&gt; file you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'components' =&amp;gt; [&#xA;        'otherDb' =&amp;gt; [&#xA;            'class' =&amp;gt; craft\db\Connection::class,&#xA;            'driverName' =&amp;gt; 'mysql',&#xA;            'dsn' =&amp;gt; 'mysql:host=localhost;dbname=mydb;port=3306;',&#xA;            'username' =&amp;gt; 'myuser',&#xA;            'password' =&amp;gt; 'mypass',&#xA;            'charset' =&amp;gt; 'utf8',&#xA;            'tablePrefix' =&amp;gt; '',&#xA;            'enableSchemaCache' =&amp;gt; !YII_DEBUG,&#xA;        ],&#xA;    ],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might not need all of those depending on what you're doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from PHP, could access it like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;otherDb-&amp;gt;createCommand(...);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And from a template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.app.otherDb... }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-12-04T01:57:58.463" LastActivityDate="2018-12-04T01:57:58.463" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28640" PostTypeId="2" ParentId="28638" CreationDate="2018-12-03T23:31:24.247" Score="1" Body="&lt;p&gt;I wrote a free plugin to allow you to do exactly that: &lt;a href=&quot;https://github.com/nystudio107/craft-connect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Connect&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-03T23:31:24.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28641" PostTypeId="1" CreationDate="2018-12-04T01:37:02.867" Score="1" ViewCount="1214" Body="&lt;p&gt;I'm using MAMP Pro for local development and was gong to set up my site with SSL this time around. I got a self-signed cert for local dev and I can go to my development site over https:// without any trouble but when I try to go to the control panel I get  404 error. I've updated the .htaccess file as suggested on &lt;a href=&quot;https://craftcms.com/guides/enforcing-ssl-for-cp-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enforcing SSL for CP Requests&lt;/a&gt; but I still get a 404 error. All the Stack articles I could find on this issue were of no help either. Any suggestions? Something obvious that I'm overlooking?&lt;/p&gt;&#xA;" OwnerUserId="231" LastActivityDate="2019-03-08T15:56:00.497" Title="Craft CMS 3 admin panel returns 404 with SSL" Tags="&lt;craft3&gt;&lt;control-panel&gt;&lt;404&gt;&lt;ssl&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28642" PostTypeId="1" AcceptedAnswerId="28754" CreationDate="2018-12-04T09:05:15.553" Score="2" ViewCount="205" Body="&lt;p&gt;Do ImageOptomize and SEOmatic work together - or to be more specific do I need an image variant for the social and SEO images defined in SEOmatic?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have been importing content into a News entry. &lt;/li&gt;&#xA;&lt;li&gt;I am defining my image variations using imageOptimize on the News Volume.&lt;/li&gt;&#xA;&lt;li&gt;I have a &quot;meta image&quot; asset field which is being used to serve the SEO and Social Media images to SEOmatic's SEO settings for the entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Before installing and using imageOptimize the meta image previews were working fine with SEOmatic in the entry editor. Now they are not getting picked up... do I need to define an image variant that matches the SEO and Meta image sizes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also... SEOmatic is such a time saver, I estimate I have saved at least two weeks dev time with this plugin. Thank you Andrew!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9sh9y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9sh9y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2018-12-11T19:13:47.567" Title="ImageOptomize and SEOmatic - Is Image Variant Required for Social and SEO images?" Tags="&lt;plugin-seomatic&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28643" PostTypeId="1" CreationDate="2018-12-04T09:07:29.840" Score="2" ViewCount="1801" Body="&lt;p&gt;I'm working on my first Craft 3 plugin and want to add some buttons to my plugin's control panel section which post form data to a controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin is called 'myplugin', the controller I wish to post to is called 'products' and the method in that controller is 'get-products'. I figured I should therefore create the URL on the forms as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ actionUrl('products/get-products') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this yields a 404 error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HTTP 404 – Not Found – yii\web\NotFoundHttpException&#xA;Page not found.&#xA;↵&#xA;Caused by: Invalid Route – yii\base\InvalidRouteException&#xA;Unable to resolve the request &quot;https:/local.mydomain.co.uk/index.php?p=admin/actions/products/get-products&quot;.&#xA;in /Users/pete/projects/myclient/dev/build/vendor/yiisoft/yii2/base/Module.php at line 537&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I call the URL directly by using &lt;code&gt;https://local.mydomain.co.uk/admin/actions/myplugin/products/get-products&lt;/code&gt; then it behaves as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously I'm missing some really important bit of knowledge here and would love if someone could help me understand what's going on.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-04T12:54:21.067" Title="Action URLs from CP to a Craft 3 plugin controller" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;error&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28644" PostTypeId="2" ParentId="28643" CreationDate="2018-12-04T09:28:10.853" Score="2" Body="&lt;p&gt;I think you should use &lt;code&gt;{{ actionUrl('myplugin/products/get-products') }}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in a form, it's maybe even better/easier to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;myplugin/products/get-products&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-12-04T09:28:10.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28645" PostTypeId="1" CreationDate="2018-12-04T10:11:39.543" Score="1" ViewCount="61" Body="&lt;p&gt;I followed &lt;a href=&quot;https://craftcms.stackexchange.com/questions/26642/how-can-i-install-modules-with-composer&quot;&gt;this question&lt;/a&gt; like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;&quot;repositories&quot;: [{&#xA;    &quot;type&quot;: &quot;vcs&quot;,&#xA;    &quot;url&quot;: &quot;git@bitbucket.org:jorgeanzola/mymodule.git&quot;&#xA;}&#xA;],&#xA;...&#xA;&#xA;&quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.0&quot;,&#xA;    ...&#xA;    &quot;jorgeanzola/mymodule&quot;: &quot;^1.0.0&quot;&#xA;},&#xA;&#xA;...&#xA;&quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;        ...&#xA;        &quot;modules\\mymodule\\&quot;: &quot;modules/mymodule/src/&quot;,&#xA;    }&#xA;},&#xA;...&#xA;&#xA;&quot;extra&quot;: {&#xA;  &quot;installer-types&quot;: [&quot;craft-module&quot;],&#xA;  &quot;installer-paths&quot;: {&#xA;    &quot;modules/mymodule&quot;: [&quot;type:craft-module&quot;]&#xA;  }&#xA;},&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I do a &lt;code&gt;composer install&lt;/code&gt;, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[RuntimeException]&lt;br&gt;&#xA;craft/plugins/schematic/ does not exist and could not be created.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my module I don't do anything with Schematic. Any idea what am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2018-12-04T10:11:39.543" Title="Installing module via composer" Tags="&lt;composer&gt;&lt;modules&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28647" PostTypeId="1" CreationDate="2018-12-04T11:52:13.497" Score="1" ViewCount="32" Body="&lt;p&gt;I have a structure called &quot;Projects&quot;, which I am currently listing on a page. The layout looks like the below - with the every row starting or finishing with a &lt;code&gt;.wide&lt;/code&gt; class thumbnail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qstIZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qstIZ.png&quot; alt=&quot;Current layout&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code used to generate that layout (simpified here for clarity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;image-link-grid&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;container&quot;&amp;gt;&#xA;  {% for project in craft.entries.section('projects').all() %}&#xA;&#xA;  {# Set a variable to check if it is a wide one or not #}&#xA;  {% set wide = 0 %}&#xA;  {% if (loop.index is divisible by(6) or loop.index0 is divisible by(6)) %}&#xA;    {% set wide = 1 %}&#xA;  {% endif %}&#xA;&amp;lt;div class=&quot;link-holder{% if wide %} wide{% endif %}&quot;&amp;gt;&#xA;  &amp;lt;a href=&quot;{{ project.url }}&quot; class=&quot;image-link&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;info&quot;&amp;gt;&#xA;      &amp;lt;h4&amp;gt;{{ project.title }}&amp;lt;/h4&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some of the projects now have a lightswitch added (&lt;code&gt;project.story&lt;/code&gt;) which makes them a &quot;Story&quot;. These need to have a &lt;code&gt;.story&lt;/code&gt; class added to them, and be injected into the layout every 6 entries, for as many as there are. Apart from that the standard project entries should list in the same order they appear in Craft. The Stories have a wider thumbnail image and some different content output in the listing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are more stories than standard entries they should then all list at the bottom, likewise if there are more standard entries these should list out. Below are images of those two scenarios:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UNdEG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UNdEG.png&quot; alt=&quot;Desired outcome 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ICcBw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ICcBw.png&quot; alt=&quot;Desired outcome 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please help with how I need to adjust my twig template to generate these layouts? I can add the &lt;code&gt;.story&lt;/code&gt; class based on the lightswitch but am at a loss how to adapt the layout to have them appear where I need them to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2018-12-04T21:30:39.700" Title="Structure listing order &amp; classes based on lightswitch value" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28648" PostTypeId="1" AcceptedAnswerId="28650" CreationDate="2018-12-04T11:55:04.330" Score="2" ViewCount="224" Body="&lt;p&gt;I have a question about best-practice for naming fields; I am creating a craft site for a football club, which include the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;club name (Global)&lt;/li&gt;&#xA;&lt;li&gt;team names &lt;/li&gt;&#xA;&lt;li&gt;player names&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are all plaintext fields. In the interest of being DRY, should I create one 'Name' field for all? Is this problematic - and therefore better to create different fields for each, so I have teamName, playerName, clubName handles etc? &lt;/p&gt;&#xA;" OwnerUserId="8833" LastActivityDate="2018-12-04T17:17:31.993" Title="Best practice for naming fields shared across entries in CraftCMS" Tags="&lt;entries&gt;&lt;best-practice&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28649" PostTypeId="2" ParentId="28643" CreationDate="2018-12-04T12:54:21.067" Score="2" Body="&lt;p&gt;The problem was two-fold and partly related to my plugin requiring POST data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set the URL to &lt;code&gt;myplugin/products/get-products&lt;/code&gt; then it hits the correct controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then set the form method to &lt;code&gt;post&lt;/code&gt; and added the necessary &lt;code&gt;{{ csrfInput() }}&lt;/code&gt; tag to generate the CSRF fields in the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;{{ actionUrl() }}&lt;/code&gt; still doesn't work but I figured that's because it creates a GET request.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-04T12:54:21.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28650" PostTypeId="2" ParentId="28648" CreationDate="2018-12-04T13:07:08.387" Score="2" Body="&lt;p&gt;If the fields can all use the same description and settings (allow multiple lines, text size), you could use the same field (we do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's even the slightest chance the description need to be different (in the future), create different fields (or use the &lt;a href=&quot;https://github.com/Anubarak/craft-relabel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relabel plugin&lt;/a&gt; to create different names and descriptions for the same field).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2018-12-04T13:07:08.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28653" PostTypeId="2" ParentId="22891" CreationDate="2018-12-04T15:16:11.190" Score="2" Body="&lt;p&gt;For Craft3 in JS you can use &lt;code&gt;var tokenInput = Craft.getCsrfInput();&lt;/code&gt; to get the HTML input or &lt;code&gt;Craft.csrfTokenName&lt;/code&gt; and &lt;code&gt;Craft.csrfTokenValue&lt;/code&gt; for the Name and Value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your post url should be&lt;br&gt;&#xA;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;actions/plugin/default/ajax-call&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally in the controller&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionAjaxCall()&#xA;     {&#xA;        $result = 'Welcome to the DefaultController actionAjaxCall() method';&#xA;&#xA;        return $result;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should be all you need&lt;/p&gt;&#xA;" OwnerUserId="8759" LastActivityDate="2018-12-04T15:16:11.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28654" PostTypeId="1" AcceptedAnswerId="28655" CreationDate="2018-12-04T16:03:35.800" Score="1" ViewCount="98" Body="&lt;p&gt;I am rendering some headings using twig and want to know if there is a better and more readable way of doing the following...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;{{ block.headingType }} class=&quot;measure-wide&quot;&amp;gt;{{ block.headingText }}&amp;lt;/{{ block.headingType }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ block.headingType }}&lt;/code&gt; is the value of the heading selected in the editor. The values are h2, h3, h4, h5 etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way the HTML headings are templated looks ugly (even though the rendering works). Is there a better way of rendering out the heading tags in twig based on the value selected?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2018-12-04T16:30:48.040" Title="Rendering HTML Heading Elements in Twig" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28655" PostTypeId="2" ParentId="28654" CreationDate="2018-12-04T16:30:48.040" Score="3" Body="&lt;p&gt;Is there any reason you dont use a rich text field like redactor?&#xA;You can make a custom config so that field only has h1,2,3 and no links, lists etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And instead of having the class &quot;measure-wide&quot; on the heading element you can wrap it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like {{ block.heading }}&#xA;Where block.heading is a custom redactor field.&lt;/p&gt;&#xA;" OwnerUserId="6148" LastActivityDate="2018-12-04T16:30:48.040" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28656" PostTypeId="2" ParentId="28648" CreationDate="2018-12-04T17:17:31.993" Score="5" Body="&lt;p&gt;The job of naming something is sometimes the most difficult part of a project! This is pretty subjective, but even though it seems like those three fields would share the same settings and requirements (as mentioned by @Paul Werheul), if it was me I would choose field names like &lt;code&gt;clubName&lt;/code&gt;, &lt;code&gt;teamName&lt;/code&gt;, and &lt;code&gt;playerName&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way the field names explicitly state what is expected to be entered or returned in your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My very humble two cents!&lt;/p&gt;&#xA;" OwnerUserId="5471" LastActivityDate="2018-12-04T17:17:31.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28657" PostTypeId="2" ParentId="28635" CreationDate="2018-12-04T18:06:00.063" Score="1" Body="&lt;p&gt;Thank you for all of the time spent Paul - I very much appreciate it.&#xA;Instead of using ajax, I went with a more &quot;traditional&quot; approach. This is what my template looks like now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {% set redirect = 'my-custom-route' %}&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;    {{ redirectInput(redirect) }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;{{ entry.section.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;0&quot;&amp;gt;&#xA;    &amp;lt;button type=&quot;button&quot; class=&quot;btn-danger btn-sm btn-delete&quot;&amp;gt;&#xA;        &amp;lt;i class=&quot;far fa-trash-alt&quot;&amp;gt;&amp;lt;/i&amp;gt;&#xA;    &amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have some js that is listening to the &lt;code&gt;.btn-delete&lt;/code&gt; event that will display a confirmation dialog:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).on('click', '.btn-delete', function (event) {&#xA;    return confirm('Are you sure you want to remove this?');&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2018-12-04T18:06:00.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28658" PostTypeId="1" AcceptedAnswerId="28715" CreationDate="2018-12-04T19:27:27.370" Score="1" ViewCount="481" Body="&lt;p&gt;I have a site that's been running Craft 3 and has been running smoothly for several months now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was going to update a post today, and noticed that there were updates to Craft 3 that needed to happen (there were several craft updates, along with two plugins). I selected the Craft CMS first to update, and after hitting the update button, it did its thing for about a minute, then gave me a message that the update failed. When I tried to go back to my admin panel, I got the HTTP ERROR 500. Same when going straight to the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried change my php mode from FastCGI to just CGI as suggested in another post, but that hasn't helped. I also tried setting the devMode to true in my general.php config file, but nothing has changed there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I'm dead in the water.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="895" LastActivityDate="2018-12-09T17:04:02.783" Title="Update Craft CMS, now I get HTTP ERROR 500" Tags="&lt;updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28659" PostTypeId="1" AcceptedAnswerId="28683" CreationDate="2018-12-04T20:14:38.287" Score="0" ViewCount="867" Body="&lt;p&gt;When I try to login to my admin area, I get this error:&#xA;HTTP 400 - Bad Request - yii/web/BadRequestHttpException&#xA;Unable to verify your data submission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The login button stays faded out, but it usually turns red once I type in the username/password. Front-end of the site is working just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried clearing my cache/cookies and using a completely different browser/computer, but it's still giving me that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack trace:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-12-04 11:43:49 [-][-][hms8j39h5es918dp04hkjcmjs1][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /vendor/yiisoft/yii2/web/Controller.php:166&#xA;Stack trace:&#xA;#0 /vendor/craftcms/cms/src/web/Controller.php(83): yii\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;#1 /vendor/yiisoft/yii2/base/Controller.php(155): craft\web\Controller-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;#2 /vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller-&amp;gt;runAction('login', Array)&#xA;#3 /vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('login', Array)&#xA;#4 /vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('users/login', Array)&#xA;#5 /vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application-&amp;gt;runAction('users/login', Array)&#xA;#6 /vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#7 /vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#8 /index.php(21): yii\base\Application-&amp;gt;run()&#xA;#9 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8967" LastEditorUserId="8967" LastEditDate="2018-12-04T20:30:45.400" LastActivityDate="2018-12-06T00:10:14.283" Title="400 error on login" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28661" PostTypeId="2" ParentId="28647" CreationDate="2018-12-04T21:30:39.700" Score="1" Body="&lt;p&gt;Whilst I can’t offer the exact template code for an answer right now as I am in bed (have I broke the stack rules?) it might be worth checking out the &lt;code&gt;|batch&lt;/code&gt; filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or taking elements of this answer and making it suit your requirements &lt;a href=&quot;https://craftcms.stackexchange.com/questions/19179/making-an-entry-grid-with-batch-2-3-2-in-row-then-3-in-row&quot;&gt;Making an entry grid with Batch 2,3 (2 in row then 3 in row)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And reading this &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/batch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/filters/batch.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2018-12-04T21:30:39.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28662" PostTypeId="2" ParentId="28658" CreationDate="2018-12-04T21:40:49.283" Score="1" Body="&lt;p&gt;If the error 500 is displayed by craft, look in craft/storage/logs (i.e. phperrors.log)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise have a look at the server logfiles, if you have access to them. The Apache (or whatever http server you use) error log might be useful.&lt;/p&gt;&#xA;" OwnerUserId="7751" LastEditorUserId="7751" LastEditDate="2018-12-04T21:55:38.763" LastActivityDate="2018-12-04T21:55:38.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28663" PostTypeId="1" AcceptedAnswerId="28688" CreationDate="2018-12-04T22:58:03.327" Score="1" ViewCount="273" Body="&lt;p&gt;I am using a Controller to get Variables from a field in my Plugin.&#xA;How and what would be the best way to pass and use them in other &lt;code&gt;classes&lt;/code&gt; or my main plugin file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about using &lt;code&gt;Sessions&lt;/code&gt; or passing them via URL Parameters, but i am not sure if thats the most convenient way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\web\Controller;&#xA;&#xA;class SetUserController extends Controller {&#xA;    public function actionSubmitUser() {&#xA;&#xA;        $request = \Craft::$app-&amp;gt;getRequest();&#xA;&#xA;        $dateTime = $request-&amp;gt;getParam('dateTime');&#xA;        $user = $request-&amp;gt;getRequiredParam('user');&#xA;&#xA;    }&#xA;}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;e.g. in my main plugin file i would like to pass the variable to a function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// check if commerce record for craft user exists&#xA;public function checkCommerceRecord($user) {&#xA;    return $this-&amp;gt;customers-&amp;gt;getCustomerByUserId($user);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured that i need to setup a module, however i cant save the variables into the module, getting &lt;code&gt;Setting unknown property: wewereyoung\wfwplugin\models\WFWPluginModel::userId&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Module:&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace wewereyoung\wfwplugin\models;&#xA;&#xA;use craft\base\Model;&#xA;use craft\validators\ArrayValidator;&#xA;&#xA;class WFWPluginModel extends Model {&#xA;&#xA;    public $setUser = [&#xA;        'userId',&#xA;        'timeDate'&#xA;    ];&#xA;&#xA;    public function rules() {&#xA;        return [&#xA;            [&#xA;                [&#xA;                    'setUser'&#xA;                ],&#xA;                ArrayValidator::class&#xA;            ]&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Updated Controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace wewereyoung\wfwplugin\controllers;&#xA;&#xA;use craft\web\Controller;&#xA;use wewereyoung\wfwplugin\models\WFWPluginModel;&#xA;&#xA;class SetUserController extends Controller {&#xA;    public function actionSubmitUser() {&#xA;&#xA;        $request = \Craft::$app-&amp;gt;getRequest();&#xA;&#xA;        $dateTime = $request-&amp;gt;getParam( 'dateTime' );&#xA;        $userId   = $request-&amp;gt;getParam( 'user' );&#xA;&#xA;        $setUser            = new WFWPluginModel();&#xA;        $setUser-&amp;gt;userId   = $userId;&#xA;        $setUser-&amp;gt;dateTime = $dateTime;&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="180" LastEditDate="2018-12-06T12:35:25.323" LastActivityDate="2018-12-06T12:35:25.323" Title="Pass Controller Variables into a Model" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28665" PostTypeId="1" CreationDate="2018-12-05T10:44:37.420" Score="1" ViewCount="398" Body="&lt;p&gt;I can't manage to combine all above options. Tested with several options and examples only the most examples focusses only on on problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example of .htaccess below is okay but i cannot manage to add the trailing slash combining with www and the http.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Testing with: &lt;a href=&quot;https://htaccess.madewithlove.be/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://htaccess.madewithlove.be/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SEO company want's to get rid of trailing slash. I see that most of CraftCMS installs responds to slash AND non slash. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See : craftcms website pricing and pricing/ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;are also both okay....thats also not ideal while you can introduce duplicate pages for google.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.domainname.nl&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.domainname.nl&lt;/a&gt;  -&gt; &lt;a href=&quot;https://domainname.nl&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://domainname.nl&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.domainname.nl/products/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.domainname.nl/products/&lt;/a&gt; -&gt; &lt;a href=&quot;https://domainname.nl/products&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://domainname.nl/products&lt;/a&gt; (without trailing slash)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://domainname.nl/products/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://domainname.nl/products/&lt;/a&gt;      &lt;a href=&quot;https://domainname.nl/products&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://domainname.nl/products&lt;/a&gt; (without trailing slash)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;    RewriteEngine On&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect www to non www&#xA;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ https://%1/$1 [R=301,L]&#xA;&#xA;# Redirect http to https&#xA;RewriteCond %{HTTPS} !on&#xA;&#xA;RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&#xA;&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="9116" LastActivityDate="2018-12-06T14:36:36.853" Title="Combine .htaccess. ( http to https AND www to non www AND remove trailing slash ) extending normal craftcms .htaccess" Tags="&lt;htaccess&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28666" PostTypeId="1" AcceptedAnswerId="28667" CreationDate="2018-12-05T10:56:05.483" Score="1" ViewCount="217" Body="&lt;p&gt;I'm new to Craft and need to add a link to the right side of the footer on this site &lt;a href=&quot;http://britainthinks.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://britainthinks.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't see anything in the dashboard that holds the existing content or any obvious templates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a Global called footer but this doesn't have the links, just some contact info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would welcome any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9117" LastActivityDate="2018-12-05T11:07:15.383" Title="Edit links in footer" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28667" PostTypeId="2" ParentId="28666" CreationDate="2018-12-05T11:07:15.383" Score="1" Body="&lt;p&gt;It's pretty much impossible to be sure just by looking at the site. But there's a good chance the links are coded into the templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the exact template could be anywhere. It's common to create a partial include it in a layout template but could equally just be within the layout template itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't say if this is Craft 2 or Craft 3 but you'll need to look in either &lt;code&gt;/craft/templates&lt;/code&gt; for Craft 2 or &lt;code&gt;/templates&lt;/code&gt; for Craft 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also find you have an add on such as NavEE or A&amp;amp;M Nav installed. This allows the creation of navigation blocks which can be included in templates. So you might find the links in there.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-05T11:07:15.383" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28669" PostTypeId="2" ParentId="28665" CreationDate="2018-12-05T13:23:55.147" Score="1" Body="&lt;p&gt;Update 12/06/2018:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tested now succesfully following version on my server&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Redirect www to non www&#xA;RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]&#xA;RewriteRule ^(.*)$ https://%1/$1 [R=301,L]&#xA;&#xA;# Redirect http to https&#xA;RewriteCond %{HTTPS} !on&#xA;RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]&#xA;&#xA;# redirect /bla/ to /bla&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} (.+)/$&#xA;RewriteRule ^ %1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2018-12-06T14:36:36.853" LastActivityDate="2018-12-06T14:36:36.853" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28670" PostTypeId="2" ParentId="9828" CreationDate="2018-12-05T13:24:25.040" Score="2" Body="&lt;p&gt;&lt;strong&gt;Step 01.&lt;/strong&gt; &#xA;Open your php.ini file.&lt;br&gt;&#xA;File path for php 5.6: /etc/php/5.6/apache2/php.ini&lt;br&gt;&#xA;File path for php 7.1: /etc/php/7.1/apache2/php.ini&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 02:&lt;/strong&gt;&lt;br&gt;&#xA;Then increase &lt;code&gt;max_exection_time&lt;/code&gt; from &lt;code&gt;30&lt;/code&gt; to &lt;code&gt;300&lt;/code&gt; or other as you like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 03:&lt;/strong&gt;&lt;br&gt;&#xA;Restart your server &lt;code&gt;sudo service apache2 restart&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 04:&lt;/strong&gt;&lt;br&gt;&#xA;Go to your web's root directory then run this command &lt;code&gt;composer update&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now browse your site.&lt;/p&gt;&#xA;" OwnerUserId="9119" LastActivityDate="2018-12-05T13:24:25.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28673" PostTypeId="1" AcceptedAnswerId="28675" CreationDate="2018-12-05T15:05:56.267" Score="1" ViewCount="62" Body="&lt;p&gt;I have not used Craft much, but can I setup multiple sites under one Craft install?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can, which version of Craft is needed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="2185" LastEditorUserId="57" LastEditDate="2018-12-06T04:05:50.267" LastActivityDate="2018-12-06T04:05:50.267" Title="Can I setup multiple sites under one Craft install?" Tags="&lt;multi-site&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28674" PostTypeId="2" ParentId="22999" CreationDate="2018-12-05T15:15:23.090" Score="1" Body="&lt;p&gt;One problem I see on that code is that you always &lt;code&gt;return true;&lt;/code&gt; on &lt;code&gt;safeUp&lt;/code&gt;. The migrations appear as successful if you return &lt;code&gt;true&lt;/code&gt; and as failed if you return &lt;code&gt;false&lt;/code&gt;. So with your code you will never see the migration fail even if it did. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I added this to my migration: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    foreach ($fields as $field) {&#xA;        $isSaved = Craft::$app-&amp;gt;fields-&amp;gt;saveField($field);&#xA;&#xA;        if (!$isSaved) {&#xA;            echo &quot;Error while saving field {$field['name']}. Reverting...\n&quot;;&#xA;            self::safeDown();&#xA;&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    return true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure is the best approach (there's so little info about migrations that probably there's a better approach I don't know about), but at least I know if the migration fails, and it reverts all changes if something didn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing: you can use &lt;a href=&quot;https://www.yiiframework.com/wiki/857/show-raw-sql-query&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;-&amp;gt;getRawSql()&lt;/code&gt;&lt;/a&gt; for dumping your query, so you are able to execute it directly on your database and see what might be the problem.&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2018-12-05T15:15:23.090" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28675" PostTypeId="2" ParentId="28673" CreationDate="2018-12-05T15:25:19.993" Score="1" Body="&lt;p&gt;you definitely can, both in Craft 2 and Craft 3. I would recommend using Craft 3 (3.1 beta if you can) so you use the latest improvements available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On Craft 3 you can set different Groups for different pages and then different sites within each group for the different languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend &lt;a href=&quot;https://mijingo.com/lessons/craft-3-multi-site/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video&lt;/a&gt;, it helps a lot with the set-up and understanding how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I am not sure if you might need different license type for setting more than one site on production. &lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2018-12-05T15:25:19.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28676" PostTypeId="1" AcceptedAnswerId="28677" CreationDate="2018-12-05T15:46:38.420" Score="1" ViewCount="607" Body="&lt;p&gt;I could only transfer licenses that were not yet assigned to any other Craft ID account. But how can I transfer the licenses, which are assigned with my other Craft ID account?&lt;/p&gt;&#xA;" OwnerUserId="5274" LastActivityDate="2018-12-05T15:59:48.427" Title="Transfer licenses into another Craft ID account" Tags="&lt;craft-id&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28677" PostTypeId="2" ParentId="28676" CreationDate="2018-12-05T15:59:48.427" Score="1" Body="&lt;p&gt;You will have to release the license in your Craft ID account:&#xA;&lt;a href=&quot;https://id.craftcms.com/account/licenses/cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://id.craftcms.com/account/licenses/cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that you will be able to claim the license in your other Craft ID account:&#xA;&lt;a href=&quot;https://id.craftcms.com/account/licenses/claim&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://id.craftcms.com/account/licenses/claim&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5012" LastActivityDate="2018-12-05T15:59:48.427" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28678" PostTypeId="1" CreationDate="2018-12-05T16:06:47.983" Score="1" ViewCount="837" Body="&lt;p&gt;I want to create a login page.  It would be a Single. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URI is set to login.  So how do I name and map the twig file?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;creating a login folder under templates.  &lt;/li&gt;&#xA;&lt;li&gt;naming the twig file either &lt;code&gt;login.twig&lt;/code&gt; or &lt;code&gt;index.twig&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;setting the template location to &lt;code&gt;login/login.twig&lt;/code&gt; or &lt;code&gt;login/index&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Neither approach worked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I setup a login page so that when I use &lt;code&gt;requireLogin&lt;/code&gt; the login page is in the right location for &lt;code&gt;loginPath&lt;/code&gt;.  At the bare minimum, where is the easiest location to place the login path?&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="57" LastEditDate="2018-12-06T04:23:39.227" LastActivityDate="2019-01-05T07:01:05.213" Title="How do I setup the Login Page to work with requireLogin?" Tags="&lt;templating&gt;&lt;singles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28679" PostTypeId="1" CreationDate="2018-12-05T16:11:16.363" Score="1" ViewCount="133" Body="&lt;p&gt;The documentation indicates it is possible to add sources for entries like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\base\Element;&#xA;use craft\elements\Entry;&#xA;use craft\events\RegisterElementSourcesEvent;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(Entry::class, Element::EVENT_REGISTER_SOURCES, function(RegisterElementSourcesEvent $event) {&#xA;    if ($event-&amp;gt;context === 'index') {&#xA;        $event-&amp;gt;sources[] = [&#xA;            'heading' =&amp;gt; \Craft::t('plugin-handle', 'Statuses'),&#xA;        ];&#xA;&#xA;        foreach (Entry::statuses() as $status =&amp;gt; $label) {&#xA;            $event-&amp;gt;sources[] = [&#xA;                'key' =&amp;gt; 'status:'.$status,&#xA;                'label' =&amp;gt; $label,&#xA;                'criteria' =&amp;gt; ['status' =&amp;gt; $status]&#xA;            ];&#xA;        }&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just implementing this example alone in a module will indeed add the sources in the left source column, but activating the source options do not present tables of element with the respective status, as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I add sources that show entries with a specific status, as well as other criteria and what criteria options are possible to use?&lt;/p&gt;&#xA;" OwnerUserId="5567" LastActivityDate="2018-12-05T16:11:16.363" Title="How to add sources for Entries" Tags="&lt;plugin-development&gt;&lt;sources&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28680" PostTypeId="1" AcceptedAnswerId="28686" CreationDate="2018-12-05T21:57:00.887" Score="1" ViewCount="1789" Body="&lt;p&gt;How do I add js and css files to frontend page loads via a plugin? I did reference this issue:&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a-plugin-add-js-or-css-to-the-control-panel&quot;&gt;Can a plugin add JS or CSS to the control panel?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that is for Craft 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the docs here:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-tags&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-tags&lt;/a&gt;&#xA;and here&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/asset-bundles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/asset-bundles.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;show that Craft 3 is much different. I've looked through several Craft 3 plugins that do load scripts and styles on the frontend but each seems to handle this in very different ways. Is there a straight-forward standard that should be used if a plugin is loaded and needs to add resources to frontend page loads?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Asset Bundles doc page, it seems you can link directly to the asset in the plugin init but a comment further down the page suggests that you need to load the assets into the template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;With that in place, all that is left is to register the asset bundle wherever its JS/CSS files are needed.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or I may be understanding this incorrectly.&#xA;Can I accomplish what I'm trying just by placing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;sourcePath = '@ns/prefix/resources';&#xA;    $this-&amp;gt;depends = [&#xA;        CpAsset::class,&#xA;    ];&#xA;&#xA;    $this-&amp;gt;js = [&#xA;        'custom-scripts.js',&#xA;    ];&#xA;&#xA;    $this-&amp;gt;css = [&#xA;        'custom-styles.css',&#xA;    ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;within the init function? Is this enough to get those files onto the frontend loads or do I need something else and something to tell them not to load onto backend pages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help. Most of my plugin knowledge is based on reverse engineering plugins and in this area I'm still confused.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2020-02-11T02:09:51.093" Title="Craft 3 Plugin Development: Add CSS and JS File to Frontend Templates" Tags="&lt;plugin-development&gt;&lt;assets&gt;&lt;plugins&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28682" PostTypeId="1" AcceptedAnswerId="28712" CreationDate="2018-12-05T23:54:18.673" Score="1" ViewCount="452" Body="&lt;p&gt;I am trying to import a database backup into a craft instance running on Docker, but none of the fields or content from the latest backup are importing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the steps I took&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I used these default.conf and docker-compose.yml files &lt;a href=&quot;https://github.com/CraftQuest/craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;  to create a local environment with Docker.&lt;/li&gt;&#xA;&lt;li&gt;I made a site locally, and backed up the database several times (and so now have a series of backups - see image below)&lt;/li&gt;&#xA;&lt;li&gt;I restarted Docker after updating to the latest version, then ran &lt;code&gt;docker-compose up&lt;/code&gt; to relaunch.&lt;/li&gt;&#xA;&lt;li&gt;Craft loaded with the initial DB, but none of the fields or content from the latest backup appear (localhost actually returns a Twig runtime err when it encounters the first field.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is how my backup folder looks:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Dhrpb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dhrpb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the issue lies with my docker-compose.yml (below), but I don't see how to edit this to call the right DB backup.&#xA;Any help or advice much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# docker-compose.yml&#xA;version: '2.1'&#xA;&#xA;services:&#xA;  nginx:&#xA;    image: nginx:alpine&#xA;    ports:&#xA;      - 80:80&#xA;    depends_on:&#xA;      - craft&#xA;    volumes_from:&#xA;      - craft&#xA;    volumes:&#xA;      - ./default.conf:/etc/nginx/conf.d/default.conf # nginx configuration (see below)&#xA;      - ./assets:/var/www/html/web/assets # For static assets (media, js and css). We don't need PHP for them.&#xA;&#xA;  craft:&#xA;    image: urbantrout/craftcms:mysql&#xA;    depends_on:&#xA;      - mariadb&#xA;    volumes:&#xA;      - ./backups:/var/www/html/storage/backups&#xA;      - ./templates:/var/www/html/templates # Craft CMS template files&#xA;      - ./modules:/var/www/html/modules # Craft modules directory&#xA;      - ./config/element-api.php:/var/www/html/config/element-api.php # Element API file - we require the plugin below&#xA;    environment:&#xA;      DEPENDENCIES: &amp;gt;- # additional composer packages (must be comma separated)&#xA;        yiisoft/yii2-redis,&#xA;        craftcms/redactor,&#xA;        craftcms/element-api,&#xA;        nystudio107/craft-seomatic&#xA;&#xA;      CRAFTCMS_EMAIL: XXXXXXXXXXXXX&#xA;      CRAFTCMS_USERNAME: admin&#xA;      CRAFTCMS_PASSWORD: XXXXXXXXXXXXXX&#xA;      CRAFTCMS_SITENAME: Craft CMS Installation&#xA;      CRAFTCMS_LANGUAGE: en-US&#xA;&#xA;      REDIS_HOST: redis&#xA;      SESSION_DRIVER: redis&#xA;      CACHE_DRIVER: redis&#xA;&#xA;      DB_SERVER: mariadb&#xA;      DB_NAME: craft&#xA;      DB_USER: craft&#xA;      DB_PASSWORD: secret&#xA;      DB_DATABASE: craft&#xA;      DB_SCHEMA: public&#xA;      DB_DRIVER: mysql&#xA;      DB_PORT: 3306&#xA;&#xA;  mariadb:&#xA;    image: mariadb:10.1&#xA;    environment:&#xA;      MYSQL_ROOT_PASSWORD: root&#xA;      MYSQL_USER: craft&#xA;      MYSQL_PASSWORD: secret&#xA;      MYSQL_DATABASE: craft&#xA;    volumes:&#xA;      # Persistent data&#xA;      - dbdata:/var/lib/mysql&#xA;&#xA;  redis:&#xA;    image: redis:4-alpine&#xA;    volumes:&#xA;      - redisdata:/data&#xA;&#xA;volumes:&#xA;  dbdata:&#xA;  redisdata:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8833" LastActivityDate="2018-12-08T03:37:45.190" Title="Import database backup when using docker" Tags="&lt;craft3&gt;&lt;database&gt;&lt;import&gt;&lt;back-up&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28683" PostTypeId="2" ParentId="28659" CreationDate="2018-12-06T00:10:14.283" Score="1" Body="&lt;p&gt;I fixed it! Just renamed &lt;code&gt;cpresources&lt;/code&gt; folder to &lt;code&gt;cpresources2&lt;/code&gt; (could also have deleted it, I suppose), cleared my cache, and now I can log in.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2018-12-06T00:10:14.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28684" PostTypeId="2" ParentId="28678" CreationDate="2018-12-06T06:44:22.230" Score="1" Body="&lt;p&gt;You didn't specify Craft 2 or 3, but I'm pretty sure this answer applies to both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template should live at &lt;code&gt;templates/login/index.twig&lt;/code&gt; or &lt;code&gt;templates/login.twig&lt;/code&gt;. Craft will resolve to both of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested this on a fresh Craft Pro install and created a Single with a template path of &lt;code&gt;login&lt;/code&gt;.  There is a &lt;code&gt;templates/login.twig&lt;/code&gt; with the login example here: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/login-form.html&lt;/a&gt; and a &lt;code&gt;templates/test.twig&lt;/code&gt; that only has &lt;code&gt;{% requireLogin %}&lt;/code&gt; in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I logged out of Craft, then went to &lt;code&gt;mysite.com/test&lt;/code&gt; in a browser and was successfully redirected to &lt;code&gt;mysite.com/login&lt;/code&gt; that rendered the example login template.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-06T06:44:22.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28686" PostTypeId="2" ParentId="28680" CreationDate="2018-12-06T10:48:06.283" Score="2" Body="&lt;p&gt;Did you place the init function within your asset bundle class as stated in the docs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace ns\prefix;&#xA;&#xA;use craft\web\AssetBundle;&#xA;use craft\web\assets\cp\CpAsset;&#xA;&#xA;class MyPluginAsset extends AssetBundle&#xA;{&#xA;    public function init()&#xA;    {&#xA;        // define the path that your publishable resources live&#xA;        $this-&amp;gt;sourcePath = '@ns/prefix/resources';&#xA;&#xA;        // define the dependencies&#xA;        $this-&amp;gt;depends = [&#xA;            CpAsset::class,&#xA;        ];&#xA;&#xA;        // define the relative path to CSS/JS files that should be registered with the page&#xA;        // when this asset bundle is registered&#xA;        $this-&amp;gt;js = [&#xA;            'script.js',&#xA;        ];&#xA;&#xA;        $this-&amp;gt;css = [&#xA;            'styles.css',&#xA;        ];&#xA;&#xA;        parent::init();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If so, there is only one step left to register the asset in your template (e.g. &lt;code&gt;yourplugin/src/templates/index.twig&lt;/code&gt;), you simply have to register it in your template with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% do view.registerAssetBundle(&quot;ns\\prefix\\FooBundle&quot;) %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it still does't work, you could generate a minimalistic plugin scaffolding with &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; , its all set up for you and commented out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&#xA;To register the plugins assetbundle in your frontend layout, add &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body&amp;gt;&#xA;  {{ beginBody() }&#xA;    .&#xA;    .&#xA;    .&#xA;    content&#xA;    .&#xA;    .&#xA;    .&#xA;    {% do view.registerAssetBundle(&quot;ns\\prefix\\FooBundle&quot;) %}&#xA;  {{ endBody() }}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to your frontend templates, e.g. in your main &lt;code&gt;layout.twig&lt;/code&gt; at the start and the end of the body tag. &lt;/p&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="5012" LastEditDate="2018-12-07T19:32:58.020" LastActivityDate="2018-12-07T19:32:58.020" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28687" PostTypeId="2" ParentId="28682" CreationDate="2018-12-06T11:03:08.800" Score="1" Body="&lt;p&gt;Partial solution - I removed all backups except the most recent from the backups folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that changing the site name prevented the site from finding the correct sql file or adding new backups to .ignore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change the name then be sure to remove other backups from the site directory.&lt;/p&gt;&#xA;" OwnerUserId="8833" LastActivityDate="2018-12-06T11:03:08.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28688" PostTypeId="2" ParentId="28663" CreationDate="2018-12-06T11:56:29.457" Score="2" Body="&lt;p&gt;To simply pass the variables to your plugin or module use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::getInstance()-&amp;gt;checkCommerceRecord($user, $dateTime);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pass to a service (see the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/services.html#creating-a-service&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating a Service&lt;/a&gt; section of the docs) use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MyPlugin::getInstance()-&amp;gt;myService-&amp;gt;checkCommerceRecord($user, $dateTime);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To pass it with your model use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$model = new WFWPluginModel(['setUser' =&amp;gt; [$userId, $dateTime]]);&#xA;&#xA;MyPlugin::getInstance()-&amp;gt;myService-&amp;gt;checkCommerceRecord($model);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="180" LastEditorUserId="180" LastEditDate="2018-12-06T12:19:14.123" LastActivityDate="2018-12-06T12:19:14.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28689" PostTypeId="1" AcceptedAnswerId="28690" CreationDate="2018-12-06T14:59:42.063" Score="1" ViewCount="285" Body="&lt;p&gt;I am using the Stripe gateway plugin for Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done the following: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entered the stripe API keys correctly.&lt;/li&gt;&#xA;&lt;li&gt;Set the Webhook URL up correctly in Stripe.&lt;/li&gt;&#xA;&lt;li&gt;Correctly disabled CSRF protection for the webhook url.&lt;/li&gt;&#xA;&lt;li&gt;Used the example templates with the stripe.js token submitting correctly.&lt;/li&gt;&#xA;&lt;li&gt;Since I am using 3dSecure, I am getting redirect offsite correctly.&lt;/li&gt;&#xA;&lt;li&gt;After returning from offsite, I see the completed order successfully.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the control panel the order is completed, but it is unpaid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last transaction has the status 'processing'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas why the order isn't paid?&lt;/p&gt;&#xA;" OwnerUserId="5086" LastEditorUserId="91" LastEditDate="2018-12-06T15:17:06.740" LastActivityDate="2018-12-06T15:17:06.740" Title="Commerce 2 Stripe gateway seems to be working correctly, but order remains unpaid" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28690" PostTypeId="2" ParentId="28689" CreationDate="2018-12-06T15:13:00.203" Score="3" Body="&lt;p&gt;The processing transaction status is used when a gateway returns from offsite correctly (the user has done everything they can to make payment on the order) but since we didn't get a definitive answer from the gateway that the card has been charged, we put the transaction into a 'processing' status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This status means we complete the order as there is nothing more for the customer to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We later get a response from the gateway (outside of the user checkout flow) to the webhook URL to let us know the payment charge on the card has been made. We then update the order with a successful payment transaction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like the webhook isn't being hit with that update information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After looking at your logs and config, I see that after the webhook request from stripe comes in, the system raises an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error is caused by the fact that you have set the &lt;code&gt;isSystemOn&lt;/code&gt; config to &lt;code&gt;false&lt;/code&gt; in production. This means the webhook request from stripe is failing, since only logged-in admins can access the system with that config setting set to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is you made the payment with the example templates while admin :)&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-12-06T15:13:00.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28691" PostTypeId="1" CreationDate="2018-12-06T17:15:21.070" Score="1" ViewCount="98" Body="&lt;p&gt;I have created an event that is called on beforeSave within my plugin. Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;        Entry::class,&#xA;        Entry::EVENT_BEFORE_SAVE,&#xA;        function(ModelEvent $event){&#xA;            /** @var Entry $entry */&#xA;            $entry = $event-&amp;gt;sender;&#xA;&#xA;            if($entry-&amp;gt;section == 'Question' &amp;amp;&amp;amp; $entry-&amp;gt;type=='reply') {&#xA;                if($entry-&amp;gt;newParentId != $entry-&amp;gt;question-&amp;gt;id[0]){&#xA;                    $entry-&amp;gt;newParentId = $entry-&amp;gt;question-&amp;gt;id[0];&#xA;                }&#xA;            }&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can change things like title and that works fine but the parent will never set. I have even added the following to see if this helps but it doesn't&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ($entry-&amp;gt;newParentId) {&#xA;    $parentEntry = Craft::$app-&amp;gt;getEntries()-&amp;gt;getEntryById($entry-&amp;gt;newParentId, $entry-&amp;gt;siteId);&#xA;    if (!$parentEntry) {&#xA;         throw new Exception('Invalid entry ID: ' . $entry-&amp;gt;newParentId);&#xA;    }&#xA;} else {&#xA;    $parentEntry = null;&#xA;}&#xA;&#xA;$entry-&amp;gt;setParent($parentEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please Note: This is not a custom element!&lt;/p&gt;&#xA;" OwnerUserId="9007" LastEditorUserId="57" LastEditDate="2018-12-06T23:36:29.320" LastActivityDate="2018-12-06T23:36:29.320" Title="Can't set structured entry parentId in BEFORE_SAVE event using field data" Tags="&lt;plugin-development&gt;&lt;events&gt;&lt;onsaveentry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28692" PostTypeId="1" AcceptedAnswerId="29210" CreationDate="2018-12-06T17:39:35.320" Score="1" ViewCount="969" Body="&lt;p&gt;I have an Freeform entry field &lt;code&gt;{{ pageForm }}&lt;/code&gt; where the user can select a form to display on the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then in the page template I load the form in to the page using &lt;code&gt;{{ entry.pageForm.render() }}&lt;/code&gt;. Cool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want them to be able to choose the return URL from an Entries field e.g &lt;code&gt;{{ entry.formThankyouUrl }}&lt;/code&gt;. Is there any way to pass that formThankyouUrl to the renderTag? E.g the below setup would be ideal..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Page template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.formPageForm|length %}&#xA;   {% set thankyouUrl = row.formThankYou.one() ?? null %}&#xA;   {{ entry.formPageForm.render() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Form template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ form.renderTag({&#xA;  returnUrl: thankyouUrl&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason I ask is that the default Return URL functionality in freeform is quite limited in that you have to paste in the URL, would be good to select it form a entries dropdown&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2019-01-21T05:56:30.100" Title="Solspace Freeform pass variable to form" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28694" PostTypeId="1" AcceptedAnswerId="28706" CreationDate="2018-12-06T20:44:56.937" Score="1" ViewCount="71" Body="&lt;p&gt;I'm successfully using the .search element attribute to search asset filenames stored locally.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to search filenames stored on a remote Amazon S3 volume?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my testing, it doesn't seem to be finding the remote files. It works when searching the local volume folderId('3') by not when the remote S3 folder folderId('6').&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&#xA;There is no direct relationship between an entry and assets. I upload all assets to the server via FTP and then index the volume in my Craft Control Panel. I can see the S3 asset in Craft CP and have cleared cache and reindexed the S3 folder source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a url query string to tell the template what the LogID is for the entry that is displayed. Then, the code searches the asset folder for any assets that contain that LogID number. If there are any matches, then those assets are displayed on the front end page in a slider.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the S3 asset if I type in the direct asset url link so the permissions of Public seem to be set correctly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is my code that is searching the asset filename on the server:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!-- grab log id and use slice filter  --&amp;gt;&#xA;{% set vLogID = craft.app.request.segments|last %}&#xA;&#xA;&amp;lt;!-- Check to see if there is any media uploaded  --&amp;gt;&#xA;{% set mediaExists = craft.assets.folderId('6').search('filename:' ~ vLogID|slice(0, 5)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The above code says:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grab the LogID from the url query string (example: 12345).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, search the asset folder (set by folderID), search all of the files in the folder for any filenames that contain LogID (example 12345).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works when searching the local volume folderId('3') but not when the remote S3 folder folderId('6').&lt;/p&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="3418" LastEditDate="2018-12-06T22:08:23.877" LastActivityDate="2018-12-07T18:06:22.857" Title="Is it possible to search an asset filename stored on a remote Amazon S3 volume?" Tags="&lt;assets&gt;&lt;search&gt;&lt;s3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28695" PostTypeId="1" AcceptedAnswerId="28696" CreationDate="2018-12-06T21:14:49.037" Score="1" ViewCount="107" Body="&lt;p&gt;I'm trying to create an email newsletter template to make it easier to send out blog newsletters by looping over entries and generating the email straight out of craft. I did this often with Wordpress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm getting twig syntax errors because of the inline CSS. I know you can do this &lt;code&gt;&amp;lt;style&amp;gt;{{ source('file.css') }}&amp;lt;/style&amp;gt;&lt;/code&gt; but that's not going to cut it for all the tables I need to add inline CSS to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing a Twig filter that I could wrap all my HTML code it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to be clear I am only trying to generate, not send the email newsletter through Craft. &lt;/p&gt;&#xA;" OwnerUserId="8185" LastEditorUserId="57" LastEditDate="2018-12-06T23:37:48.187" LastActivityDate="2018-12-06T23:49:26.620" Title="Custom Newsletter template" Tags="&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28696" PostTypeId="2" ParentId="28695" CreationDate="2018-12-06T23:49:26.620" Score="1" Body="&lt;p&gt;You can include standard HTML in Twig templates. So something like this would work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table style=&quot;background-color: gray&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You don't &lt;strong&gt;have&lt;/strong&gt; to use Twig filters to add CSS or CSS files. Although you could create some CSS variables using &lt;code&gt;{% set gray = '#eee' %}&lt;/code&gt; or &lt;code&gt;{% set border = 'border: 1px solid black' %}&lt;/code&gt; for repeated styles such as colors, borders, etc., and then reference those like this, using the variable name:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table style=&quot;background-color: {{ gray }}; {{ border }}&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2018-12-06T23:49:26.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28697" PostTypeId="1" AcceptedAnswerId="28733" CreationDate="2018-12-07T02:40:18.580" Score="1" ViewCount="481" Body="&lt;p&gt;I have a custom generated sitemap which I'd like to append to my SEOmatic sitemap.xml file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose the simple alternative would be to just add an extra sitemap to Google Search Console?&lt;/p&gt;&#xA;" OwnerUserId="9071" LastActivityDate="2018-12-11T03:53:07.387" Title="Append custom sitemap to sitemap index" Tags="&lt;plugin-seomatic&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28699" PostTypeId="1" AcceptedAnswerId="28721" CreationDate="2018-12-07T11:00:43.810" Score="1" ViewCount="610" Body="&lt;p&gt;Is there any way of searching both entries and products at the same time? Wanting a single search on the site which will return all entries and products containing the searched for phrase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looked at combining the results from &lt;code&gt;craft.entries.search()&lt;/code&gt; and &lt;code&gt;craft.products.search()&lt;/code&gt; but this stops us from using pagination which we would like to have. Anybody got a solution or suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would prefer not to split into 2 search pages if possible. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2018-12-10T11:36:46.803" Title="Search products and entries with pagination" Tags="&lt;entries&gt;&lt;plugin-craftcommerce&gt;&lt;search&gt;&lt;pagination&gt;&lt;products&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28700" PostTypeId="2" ParentId="28699" CreationDate="2018-12-07T11:11:19.503" Score="1" Body="&lt;p&gt;Unfortunately you would need to do 2 element query searches and combine the results on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most developers tend to go for &lt;a href=&quot;https://algolia.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algolia.com&lt;/a&gt; when they want fast advanced search, including searching across elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably easiest to get started by searching for an Algolia plugin in the plugin store. I only know &lt;a href=&quot;https://github.com/Rias500/craft-scout&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft-scout&lt;/a&gt; for Craft 3 at the moment.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-12-07T11:11:19.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28701" PostTypeId="1" AcceptedAnswerId="28703" CreationDate="2018-12-07T13:05:30.443" Score="1" ViewCount="36" Body="&lt;p&gt;I am struggling with closure and saving a variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my class &lt;code&gt;somePlugin&lt;/code&gt; i do have a public var &lt;code&gt;$customerId&lt;/code&gt; , which should be updated after i execute my &lt;code&gt;setUser()&lt;/code&gt; function. To do so i have a setter and getter function. In my &lt;code&gt;init()&lt;/code&gt; function i do want to use the new var on a later &lt;code&gt;EVENT_BEFORE_COMPLETE_ORDER&lt;/code&gt; event. However the variable &lt;code&gt;$customerId&lt;/code&gt; does get reset to the default value after page reload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would i avoid that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using session but it seems like the session has been overwritten on reload as well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class somePlugin extends Plugin {&#xA;&#xA;    public $customerId = '1234';&#xA;&#xA;    public function init() {&#xA;&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;        Event::on( Order::class, Order::EVENT_BEFORE_COMPLETE_ORDER, function( Event $e ) {&#xA;            $order             = $e-&amp;gt;sender;&#xA;            $customerId        = $this-&amp;gt;getCustomerId();&#xA;&#xA;            // on every page reload it does get reset to the default var, what is not wanted&#xA;            $order-&amp;gt;customerId = $customerId;&#xA;        } );&#xA;    }&#xA;&#xA;    public function setUser( $userId ) {&#xA;&#xA;        self::$plugin = $this;&#xA;&#xA;        // get userModel by userId&#xA;        $userModel = Craft::$app-&amp;gt;users-&amp;gt;getUserById( $userId );&#xA;&#xA;        // check if  commerce record for craft user exists&#xA;        if ( ! $this-&amp;gt;customers-&amp;gt;getCustomerByUserId( $userId ) ) {&#xA;&#xA;            // create and save new customer&#xA;            $newCustomer       = new Customer();&#xA;            $newCustomer-&amp;gt;user = $userModel;&#xA;            $this-&amp;gt;customers-&amp;gt;saveCustomer( $newCustomer, false );&#xA;        }&#xA;&#xA;        // store customerId&#xA;        $customerId = $this-&amp;gt;customers-&amp;gt;getCustomerByUserId( $userId )-&amp;gt;id;&#xA;&#xA;       // sets the new and wanted it wich gets overwritten by page reload&#xA;        $this-&amp;gt;setCustomerId( $customerId );&#xA;&#xA;    }&#xA;&#xA;    public function setCustomerId( $customerId ) {&#xA;        $this-&amp;gt;customerId = $customerId;&#xA;    }&#xA;&#xA;    public function getCustomerId() {&#xA;        return $this-&amp;gt;customerId;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastEditorUserId="57" LastEditDate="2018-12-07T22:53:43.097" LastActivityDate="2018-12-07T22:53:43.097" Title="Closure in plugin class/ saving and passing a public property" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;php&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28702" PostTypeId="2" ParentId="28423" CreationDate="2018-12-07T13:18:00.123" Score="1" Body="&lt;p&gt;Changing a focal point will delete all the transform files as well as transform index entries, so I suspect that you're just seeing cached data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why it works when changing quality is that that will actually affect the path where the transform is located, so the browser will actually have to look for the new file instead of assuming that the cached version is safe to use.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2018-12-07T13:18:00.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28703" PostTypeId="2" ParentId="28701" CreationDate="2018-12-07T16:09:11.777" Score="1" Body="&lt;p&gt;I figured that i could just use &lt;code&gt;Craft::$app-&amp;gt;getSession()-&amp;gt;set( 'key', $value );&lt;/code&gt; to store the vars in the craft session.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class somePlugin extends Plugin {&#xA;&#xA;    public function init() {&#xA;&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;        Event::on( Order::class, Order::EVENT_BEFORE_COMPLETE_ORDER, function( Event $e ) {&#xA;            $order             = $e-&amp;gt;sender;&#xA;            $order-&amp;gt;customerId = $this-&amp;gt;getCustomerId();&#xA;        } );&#xA;    }&#xA;&#xA;    public function setUser( $userId ) {&#xA;&#xA;        self::$plugin = $this;&#xA;&#xA;        // get userModel by userId&#xA;        $userModel = Craft::$app-&amp;gt;users-&amp;gt;getUserById( $userId );&#xA;&#xA;        // check if  commerce record for craft user exists&#xA;        if ( ! $this-&amp;gt;customers-&amp;gt;getCustomerByUserId( $userId ) ) {&#xA;&#xA;            // create and save new customer&#xA;            $newCustomer       = new Customer();&#xA;            $newCustomer-&amp;gt;user = $userModel;&#xA;            $this-&amp;gt;customers-&amp;gt;saveCustomer( $newCustomer, false );&#xA;        }&#xA;&#xA;        // get and store customerId&#xA;        $customerId = $this-&amp;gt;customers-&amp;gt;getCustomerByUserId( $userId )-&amp;gt;id;&#xA;        $this-&amp;gt;setCustomerId( $customerId );&#xA;&#xA;    }&#xA;&#xA;    public function setCustomerId( $customerId ) {&#xA;        Craft::$app-&amp;gt;getSession()-&amp;gt;set( 'customerId', $customerId );&#xA;    }&#xA;&#xA;    public function getCustomerId() {&#xA;        return Craft::$app-&amp;gt;getSession()-&amp;gt;get( 'customerId' );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5012" LastActivityDate="2018-12-07T16:09:11.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28704" PostTypeId="1" AcceptedAnswerId="28773" CreationDate="2018-12-07T17:56:22.523" Score="1" ViewCount="342" Body="&lt;p&gt;I created a payment gateway for Commerce 2. When I try to make a payment, an error happens and the flash error I get is this &quot;Invalid payment or order. Please review.&quot;.&#xA;I don't know if my gateway is returning the error or Craft.&#xA;How do I know what is the error especifically?&lt;/p&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2018-12-13T02:54:28.190" Title="How to debug a payment gateway error" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28705" PostTypeId="2" ParentId="28452" CreationDate="2018-12-07T17:57:44.637" Score="0" Body="&lt;p&gt;My working solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionResaveEntries()&#xA;{&#xA;    $site = Craft::$app-&amp;gt;sites-&amp;gt;getSiteById(self::SITE_ID);&#xA;    $section = Craft::$app-&amp;gt;sections-&amp;gt;getSectionById(self::SECTION_ID);&#xA;    $entryType = Craft::$app-&amp;gt;sections-&amp;gt;getEntryTypeById(self::ENTRY_TYPE_ID);&#xA;&#xA;    $entries = Entry::find()&#xA;        -&amp;gt;siteId(self::SITE_ID)&#xA;        -&amp;gt;sectionId(self::SECTION_ID)&#xA;        -&amp;gt;typeId(self::COMP_ENTRY_TYPE_ID)&#xA;        -&amp;gt;all();&#xA;&#xA;    foreach ($entries as $entry) {&#xA;        // Set deadline&#xA;        $deadline = $entry-&amp;gt;competitionJudgingEnd;&#xA;        // Check if after deadline&#xA;        $now = new DateTime();&#xA;        if ($now &amp;gt; $deadline) {&#xA;            Craft::$app-&amp;gt;getQueue()-&amp;gt;push(new ResaveElements([&#xA;                'description' =&amp;gt; Craft::t('app', 'Resaving {section}, {type} entries', [&#xA;                    'section' =&amp;gt; $section, 'type' =&amp;gt; $entryType-&amp;gt;name,&#xA;                ]),&#xA;                'elementType' =&amp;gt; Entry::class,&#xA;                'criteria' =&amp;gt; [&#xA;                    'siteId' =&amp;gt; $site-&amp;gt;id,&#xA;                    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;                    'typeId' =&amp;gt; $entryType-&amp;gt;id,&#xA;                    'status' =&amp;gt; null,&#xA;                    'enabledForSite' =&amp;gt; true&#xA;                ]&#xA;            ]));&#xA;            echo &quot;Resaving entries\n&quot;&#xA;        } else &#xA;            echo &quot;Not resaving entries\n&quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="298" LastActivityDate="2018-12-07T17:57:44.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28706" PostTypeId="2" ParentId="28694" CreationDate="2018-12-07T18:06:22.857" Score="1" Body="&lt;p&gt;I figured it out.  I was using folderID instead of volumeID.  It looks like this parameter changed from Craft 2 to Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2018-12-07T18:06:22.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28707" PostTypeId="1" CreationDate="2018-12-07T18:07:08.990" Score="1" ViewCount="338" Body="&lt;p&gt;I am using CSRF tokens in a form on CraftCMS. Submissions are successful with a standard configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Introducing &quot;fresh&quot; CSRF tokens via AJAX on page load is causing some trouble. This is necessary as production has caching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some observations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Disabling CSRF validation in &lt;code&gt;config/general.php&lt;/code&gt; resolves the issue entirely; however, of course, this is not the solution.&lt;/li&gt;&#xA;&lt;li&gt;Disabling CSRF cookies does not resolve the issue.&lt;/li&gt;&#xA;&lt;li&gt;Failed attempts appear most commonly in iOS on Safari. It also occurs sometimes on Edge. It appears to work always in Chrome.&lt;/li&gt;&#xA;&lt;li&gt;Regarding Safari: one idea here was that the browser disrespects &lt;code&gt;Cache-Control&lt;/code&gt; and thinks it should be caching this request, hence resulting in a failed CSRF validation. Adding in a timestamp to the request in a query string did not resolve the issue.&lt;/li&gt;&#xA;&lt;li&gt;Failed attempts result in a &quot;400 Bad Request&quot; response. The body sometimes reads: &lt;code&gt;Bad Request: Unable to verify your data submission.&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Failed attempts occur regardless of server side caching. This has been tested on local environments (Homestead) with no non-standard caching configurations.&lt;/li&gt;&#xA;&lt;li&gt;The token returned on the CSRF AJAX request is different each time.&lt;/li&gt;&#xA;&lt;li&gt;The form is built with &lt;a href=&quot;https://solspace.com/craft/freeform&quot; rel=&quot;nofollow noreferrer&quot;&gt;FreeForm&lt;/a&gt;, but I do not think that is of significance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How does one track the request further to find the reason for failure?&lt;/li&gt;&#xA;&lt;li&gt;Is providing CSRF tokens via an AJAX request sensible? The typical response I see is adding in the token via an inline Javascript variable. (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/6580/how-can-i-use-csrf-protection-with-ajax-routes?rq=1&quot;&gt;Read&lt;/a&gt;) That route is not an option here.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any pointers here would be very appreciated. Thanks in advanced!&lt;/p&gt;&#xA;" OwnerUserId="9127" LastEditorUserId="9127" LastEditDate="2018-12-07T18:29:04.940" LastActivityDate="2018-12-08T12:00:14.660" Title="AJAX CSRF Producing Inconsistent Results" Tags="&lt;form&gt;&lt;ajax&gt;&lt;plugin-freeform&gt;&lt;csrf&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28708" PostTypeId="2" ParentId="28697" CreationDate="2018-12-07T19:34:57.893" Score="2" Body="&lt;p&gt;This is actually pretty simple...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you navigate to &lt;strong&gt;SEOmatic → Site Settings → Miscellaneous&lt;/strong&gt;, you'll see a table at the bottom of the page where you can input custom sitemap urls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nROZz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nROZz.png&quot; alt=&quot;SEOmatic Miscellaneous Site Settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you add a url in here and save it, it will get added to a custom index sitemap that is included at the bottom of your main index sitemap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/sitemaps/1/sitemap.xml&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;sitemapindex xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&amp;gt;&#xA;  ...&#xA;  &amp;lt;sitemap&amp;gt;&#xA;    &amp;lt;loc&amp;gt; http://site.test/sitemaps/1/global/custom/1/sitemap.xml &amp;lt;/loc&amp;gt;&#xA;    &amp;lt;lastmod&amp;gt; 2018-11-16T10:06:31-05:00 &amp;lt;/lastmod&amp;gt;&#xA;  &amp;lt;/sitemap&amp;gt;&#xA;&amp;lt;/sitemapindex&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;/sitemaps/1/global/custom/1/sitemap.xml&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&amp;gt;&#xA;  &amp;lt;url&amp;gt;&#xA;    &amp;lt;loc&amp;gt; http://site.test/custom.xml &amp;lt;/loc&amp;gt;&#xA;    &amp;lt;lastmod&amp;gt; 2018-12-07T14:26:25-05:00 &amp;lt;/lastmod&amp;gt;&#xA;    &amp;lt;changefreq&amp;gt; weekly &amp;lt;/changefreq&amp;gt;&#xA;    &amp;lt;priority&amp;gt; 0.5 &amp;lt;/priority&amp;gt;&#xA;  &amp;lt;/url&amp;gt;&#xA;&amp;lt;/urlset&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for more info → &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#additional-sitemap-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#additional-sitemap-urls&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-07T19:34:57.893" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28709" PostTypeId="1" CreationDate="2018-12-07T21:25:43.900" Score="1" ViewCount="46" Body="&lt;p&gt;I continue to get this error each time I try to update Freefrom.&#xA;I don't was to alter the table structure since data exists.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CirjG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CirjG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2018-12-07T22:49:00.960" Title="Unable able to update Freeform Pro from 2.2 to 2.5" Tags="&lt;craft3&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28710" PostTypeId="2" ParentId="28680" CreationDate="2018-12-07T21:32:34.700" Score="1" Body="&lt;p&gt;I found Yii's documentation on Assets to be helpful in understanding how to get asset dependencies. &#xA;&lt;strong&gt;Assets&lt;/strong&gt;&#xA;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/structure-assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/guide/2.0/en/structure-assets&lt;/a&gt;&#xA;&lt;strong&gt;Asset Bundle Class documentation&lt;/strong&gt;&#xA;&lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-assetbundle&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/api/2.0/yii-web-assetbundle&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2018-12-07T21:32:34.700" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28711" PostTypeId="2" ParentId="28709" CreationDate="2018-12-07T22:49:00.960" Score="1" Body="&lt;p&gt;Solution: Instead of using the Craft updater, execute a composer require composer require solspace/craft3-freeform-pro&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2018-12-07T22:49:00.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28712" PostTypeId="2" ParentId="28682" CreationDate="2018-12-08T03:37:45.190" Score="1" Body="&lt;p&gt;You can expose a port on your mariadb service then upload your backup using Sequel Pro or Workbench. Don't forget to add the restart:always to the service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7JVaf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7JVaf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2018-12-08T03:37:45.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28713" PostTypeId="2" ParentId="28707" CreationDate="2018-12-08T11:23:39.307" Score="1" Body="&lt;p&gt;Trying to understand the issue in general. These are my thoughts, not sure if they will help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that by caching, you mean some sort of full page cache and the comments below are based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AJAX requests to support CSRF in craft, require the tokens name/value passed as a param in the request data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you introduce a full page cache system on your system, you generally need a 'hole punching' mechanism to exclude from caching, any dynamically set variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a common use for eCommerce websites. For example where you might have a mini-cart feature on your page which needs refreshing when you perform an 'add to cart' action using AJAX. So the page does not refresh, but that bit of template needs refreshing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within Craft, I would try to exclude from caching the javascript lines that introduce the CSRF token, as well as excluding from cache any twig methods that generate the CSRF token in the templates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to perform 'hole punching' depends on the type of full page caching you are using. Each system have their own method.&lt;/p&gt;&#xA;" OwnerUserId="8921" LastEditorUserId="8921" LastEditDate="2018-12-08T12:00:14.660" LastActivityDate="2018-12-08T12:00:14.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28714" PostTypeId="1" AcceptedAnswerId="28716" CreationDate="2018-12-08T13:30:36.620" Score="1" ViewCount="790" Body="&lt;p&gt;For a client I need to connect a rather complex contact form with the Zoho CRM. They're offering a &lt;a href=&quot;https://www.zoho.com/crm/help/developer/server-side-sdks/php.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PHP SDK&lt;/a&gt; which sounds great, but I can't get it to work. It's very likely that I'm just stupid, because I can't even include the SDK to just call the initial setup method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation says (under &quot;Using the PHP SDK&quot;) to include the following line where needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require ‘vendor/autoload.php’&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That doesn't seem to be needed, as it's already done in the main &lt;strong&gt;index.php&lt;/strong&gt; by Craft itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the SDK within a service class I've created under &lt;strong&gt;modules/services&lt;/strong&gt;. So within my class I tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require &quot;../vendor/zohocrm/php-sdk/src/index.php&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's getting the the &lt;strong&gt;index.php&lt;/strong&gt; from the SDK but when I'm calling the method &lt;code&gt;ZCRMRestClient::initialize()&lt;/code&gt; I just get the following error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Class 'modules\services\ZCRMRestClient' not found&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm probably missing some really basic stuff but I just don't know what else to do.&lt;/p&gt;&#xA;" OwnerUserId="9048" LastActivityDate="2018-12-09T20:55:06.440" Title="Install Zoho CRM SDK (or any SDK for that matter)" Tags="&lt;error-message&gt;&lt;composer&gt;&lt;services&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28715" PostTypeId="2" ParentId="28658" CreationDate="2018-12-09T17:04:02.783" Score="1" Body="&lt;p&gt;Brad Bell responded directly to my support question. Here's what he suggested that worked for me. Editing the php.ini file wasn't the solution (but that could be because I'm on a VPN on Dreamhost, and have had similar issues with a wordpress build. Wanted to included it in case someone finds it useful). Deleting the Vendor folder did the trick for me.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Most likely what initially happened was you hit a fatal PHP error like PHP timing out, or runs out of memory.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Try editing your php.ini file and increasing the memory_limit setting to at least 256M, and the max_execution_time setting to at least 120.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you’re not sure where your php.ini file is located, create a PHP file called ini.php alongside your index.php file with this:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;php&#xA;  echo 'Loaded php.ini: ' . php_ini_loaded_file();&#xA;  Then access that file in your web browser by going to &lt;a href=&quot;http://your-&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://your-&lt;/a&gt;&gt; project.test/ini.php.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Once you’ve made your changes, restart your web server and that should prevent it from happening again going forward.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To fix your immediate situation and get your site back into a usable state, the easiest thing to do is if you have Composer installed from the command line (&lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&lt;/a&gt;), the nuke your site's vendor folder and composer.lock file, then run composer update from your project's root to get a fresh set of Craft and its dependencies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="895" LastActivityDate="2018-12-09T17:04:02.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28716" PostTypeId="2" ParentId="28714" CreationDate="2018-12-09T20:55:06.440" Score="0" Body="&lt;p&gt;Assuming you've got Composer installed from the &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;command line&lt;/a&gt;, you can navigate to your project's root (where your project's composer.json file lives), then run this from the command line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require zohocrm/php-sdk&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From there, Composer and Craft pretty much take care of everything, including setting up the autoloading and you can reference &lt;code&gt;ZCRMRestClient::initialize();&lt;/code&gt; from your module/service.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-09T20:55:06.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28717" PostTypeId="2" ParentId="28372" CreationDate="2018-12-09T22:55:31.440" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Without an entry with slug contact/thanks then the page just returns an error Variable &quot;entry&quot; does not exist. But still it doesn't draw any content from the entry. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You do not need to create an entry for the Thanks page - in most cases it is easier to just add the actual text to your template file. If you do want to make it editable, then create a Single Entry, name it whatever you want, then go to Settings &gt; Sections &gt; &lt;em&gt;yourSection&lt;/em&gt; and edit the uri and path variables. The URI should be contact/thanks, and the template path would likely be something like thanks.html&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-12-09T22:55:31.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28718" PostTypeId="1" AcceptedAnswerId="28726" CreationDate="2018-12-09T23:34:18.363" Score="1" ViewCount="180" Body="&lt;p&gt;My front-end new entry form works, but when I add the complexity of a dropdown to the mix - it error's and doesn't save the entry. (I found this out with trial and error, removing fields until I found the culprit - the dropdowns)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure what errors it's returning, but I'm sure something may be off with the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% macro errorList(errors) %}&#xA;            {% if errors %}&#xA;                &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                    {% for error in errors %}&#xA;                        &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endif %}&#xA;        {% endmacro %}&#xA;&#xA;        {% from _self import errorList %}&#xA;&#xA;        &amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;            {{ csrfInput() }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;            {{ redirectInput('/listings/') }}&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;1&quot;&amp;gt;&#xA;            &amp;lt;input type=&quot;hidden&quot; name=&quot;enabled&quot; value=&quot;1&quot;&amp;gt;&#xA;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;              &amp;lt;label&amp;gt;Demographic&amp;lt;/label&amp;gt;&#xA;              &amp;lt;select class=&quot;form-control&quot; id=&quot;listingType&quot; name=&quot;fields[demographic]&quot;&amp;gt;&#xA;                {% set demographicField = craft.fields.getFieldbyHandle('demographic') %}&#xA;                {% for option in demographicField.settings.options %}&#xA;                  &amp;lt;option&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;                {% endfor %}&#xA;              &amp;lt;/select&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;            &amp;lt;button class=&quot;btn btn-primary btn-md semi-bold&quot; type=&quot;submit&quot;&amp;gt;Create Listing&amp;lt;/button&amp;gt;&#xA;&#xA;        &amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-10T15:58:17.410" Title="Front End Entry Form Select Dropdown Error" Tags="&lt;templating&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28719" PostTypeId="1" AcceptedAnswerId="28777" CreationDate="2018-12-09T23:37:41.620" Score="0" ViewCount="68" Body="&lt;p&gt;I have a site that shows upcoming football matches in a table, and I would like to include the clubs' logos next to each club name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following sections and entry types, both generated using an API and feedme to create entries &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Teams section (includes fields for teamIDs and logos)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matches section (includes fields for home team &amp;amp; home team ID, away team &amp;amp; away team ID, match time and location, but does not include logos)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The team ids and home/away team IDs match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To display logos, I imagine the process should go something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;for each hometeam and awayteam in each row of the match table, identify the team ID&lt;/li&gt;&#xA;&lt;li&gt;Use the ID to find the related teams in the teams section, &lt;/li&gt;&#xA;&lt;li&gt;output the asset (logo) related teams logo in the match table.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This feels like a relatedTo / reverse relations problem, where i can say - in twig - something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% if homeTeamId or awayTeamId in the fixtures section is the same as a Teamid field in the Team Section, then output that related teams's logo. %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest the most efficient way to structure this in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lo7Qr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lo7Qr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HBx12.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HBx12.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1oLBt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1oLBt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8833" LastEditorUserId="8833" LastEditDate="2018-12-13T11:41:20.503" LastActivityDate="2018-12-13T13:28:18.440" Title="Displaying related image assets from another section with twig" Tags="&lt;templating&gt;&lt;entries&gt;&lt;assets&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28720" PostTypeId="1" CreationDate="2018-12-10T09:52:13.780" Score="1" ViewCount="128" Body="&lt;pre&gt;&lt;code&gt;% set entriesList = craft.entries.section('parks').relatedTo(entry.Line.one()).all %}&#xA;    {% if entriesList|length %}&#xA;    &amp;lt;div id=&quot;found-in&quot; class=&quot;park&quot;&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entriesList %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a class=&quot;underline&quot; href=&quot;{{entry.url}}&quot;&amp;gt;{{entry.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Every Element has a Table where a Number is set&#xA;I want to order it by the Number. How can i do it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9131" LastActivityDate="2018-12-10T11:49:05.283" Title="order by Table Number Field" Tags="&lt;craft3&gt;&lt;relations&gt;&lt;table-field&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28721" PostTypeId="2" ParentId="28699" CreationDate="2018-12-10T11:36:46.803" Score="1" Body="&lt;p&gt;Ended up creating a custom plugin to achieve this functionality. Also added some custom pagination logic. Set up a gist showing the variable and service files of the plugin as well as an example twig template to output the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/matt-adigital/e79b2fd2e14327b3f306a907f4e7e02e&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/matt-adigital/e79b2fd2e14327b3f306a907f4e7e02e&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All working well but it would be great if this was in core or just a little easier to implement. If we could leverage Crafts pagination for our own usage by passing in a dataset instead of being confined to the craft\elements\db\ElementQueryInterface object, then this would be a big help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option could be to allow craft\elements\db\ElementQuery to accept multiple elementTypes or a null value, tried to submit with null but it is in fact required to be a string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully anyone else who wants to use this functionality without going down the Algolia route will find this helpful.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2018-12-10T11:36:46.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28722" PostTypeId="2" ParentId="28720" CreationDate="2018-12-10T11:49:05.283" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#orderby&quot; rel=&quot;nofollow noreferrer&quot;&gt;orderBy()&lt;/a&gt; should do the trick.&#xA;The docs show following syntax: &lt;code&gt;.orderBy('elements.dateCreated asc')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesList = craft.entries.section('parks')&#xA;   .relatedTo(entry.Line.one())&#xA;   .orderBy('elements.tableName.row(n).columnName asc')&#xA;   .all&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2018-12-10T11:49:05.283" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28723" PostTypeId="1" AcceptedAnswerId="28728" CreationDate="2018-12-10T12:37:45.507" Score="1" ViewCount="49" Body="&lt;p&gt;What's the best way to update Craft offline and then upload the files to the server? Reason I'm asking is because my updates often fail because of too low PHP memory and I don't have control over the server to update the minimum value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my process right now:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Backup everything (files + db)&lt;/li&gt;&#xA;&lt;li&gt;Updating the composer.json file manually to the versions that are shown in the admin panel. &lt;/li&gt;&#xA;&lt;li&gt;Run 'composer update --no-dev'&lt;/li&gt;&#xA;&lt;li&gt;Upload vendor directory, composer.json and composer.lock to the server&lt;/li&gt;&#xA;&lt;li&gt;Refresh admin panel and finish update. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this the way to go or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="7892" LastEditorUserId="57" LastEditDate="2018-12-10T16:12:13.507" LastActivityDate="2018-12-10T16:15:33.173" Title="Offline update then upload files to server" Tags="&lt;updates&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28724" PostTypeId="2" ParentId="28624" CreationDate="2018-12-10T14:53:26.133" Score="3" Body="&lt;p&gt;I made a plugin to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/IndigoViking/Translitedated&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/IndigoViking/Translitedated&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use it just like the |date filter (new filter is |dated) and pass it the date format and the locale you would like to use. In you case the locale would be 'en'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example from your question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ block.timeLimit|dated('M d Y H:i', 'en') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will always output an English date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any issues with it, just submit an issue via GitHub.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's available via packagist so you can run&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require indigoviking/translitedated&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it is in process to be approved on the plugin store (should only be a day or so. If you need more features/requests/or help with it, please let me know!&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-10T14:53:26.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28725" PostTypeId="1" CreationDate="2018-12-10T15:42:36.230" Score="2" ViewCount="352" Body="&lt;p&gt;I seem to be stuck with a simple -- but quite annoying -- question. I'm setting my own styling for a form and keep running into issues where I'm fighting with Freeform's default styling. I'm not including this anywhere in the template, at least that I know of, yet Freeform still seems to be injecting it's own styling onto the page. Am I missing something here where i can turn that off? Any help here would be greatly appreciated. I have attached an image showing what gets injected that I'd like removed.&lt;a href=&quot;https://i.stack.imgur.com/I4u24.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I4u24.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6733" LastActivityDate="2018-12-11T11:12:57.750" Title="Freeform: Remove default styling injection" Tags="&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28726" PostTypeId="2" ParentId="28718" CreationDate="2018-12-10T15:58:17.410" Score="2" Body="&lt;p&gt;On your dropdown field's &lt;code&gt;name&lt;/code&gt;, you need a &lt;code&gt;[]&lt;/code&gt; on the end for it to submit properly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;name=&quot;fields[demographic][]&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As mentioned in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/1787/assign-category-via-guest-entry-form&quot;&gt;this answer&lt;/a&gt;, the dropdown field is basically an array of options, so you need that empty array on the end for them to be stored in.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-10T15:58:17.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28727" PostTypeId="1" CreationDate="2018-12-10T16:08:18.777" Score="2" ViewCount="97" Body="&lt;p&gt;I started to work with Craft CMS a couple month ago, I have a client that wants to have a clustered map, I went over Smart Map documentation but I couldn't find anything about on how to add Google MarkerClusterer library.&lt;/p&gt;&#xA;" OwnerUserId="8353" LastEditorUserId="45" LastEditDate="2018-12-10T20:27:39.543" LastActivityDate="2021-01-04T18:45:50.910" Title="How can I add Google MarkerClusterer library to Smart Map?" Tags="&lt;templating&gt;&lt;javascript&gt;&lt;plugin-smartmap&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28728" PostTypeId="2" ParentId="28723" CreationDate="2018-12-10T16:15:33.173" Score="0" Body="&lt;p&gt;If you're not able to increase your server's &lt;code&gt;memory_limit&lt;/code&gt; and/or &lt;code&gt;max_execution_time&lt;/code&gt; settings, then your current process is a way to &quot;manually&quot; update Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if your server has Composer &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;installed&lt;/a&gt; from the command line and you have SSH access, you can perform the composer update locally, then upload your &lt;code&gt;composer.json&lt;/code&gt; and &lt;code&gt;composer.lock&lt;/code&gt; files, then execute &lt;code&gt;composer install&lt;/code&gt; from your project's root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That method should use less memory than updating from the Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-10T16:15:33.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28729" PostTypeId="2" ParentId="28727" CreationDate="2018-12-10T18:22:45.590" Score="1" Body="&lt;p&gt;I don't believe Smart Map currently offers that functionality. I'd recommend opening an issue with your feature request over at &lt;a href=&quot;https://github.com/doublesecretagency/craft-smartmap&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/doublesecretagency/craft-smartmap&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-10T18:22:45.590" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28730" PostTypeId="2" ParentId="28727" CreationDate="2018-12-10T20:26:17.757" Score="3" Body="&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).&lt;/p&gt;&#xA;&lt;p&gt;The new library can be found here...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/googlemaps/js-markerclustererplus&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/googlemaps/js-markerclustererplus&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Not sure how much that affects the original JavaScript example below, but it's probably still a reasonable starting point.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As Jalen mentioned in his answer, this functionality isn't &lt;em&gt;(currently)&lt;/em&gt; built into Smart Map. However, it's very easy to add yourself...&lt;/p&gt;&#xA;&lt;p&gt;First, you'll need to add the &lt;strong&gt;MarkerClusterer&lt;/strong&gt; library to your map page. You can link to it normally, just as you would with any other JS library.&lt;/p&gt;&#xA;&lt;p&gt;Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var map = smartMap.map['smartmap-mapcanvas-1'];&#xA;var markers = smartMap.marker;&#xA;&#xA;var markerCluster = new MarkerClusterer(map, markers);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Pretty much everything else happens automagically!&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2021-01-04T18:45:50.910" LastActivityDate="2021-01-04T18:45:50.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28731" PostTypeId="1" AcceptedAnswerId="28732" CreationDate="2018-12-10T21:35:07.183" Score="2" ViewCount="557" Body="&lt;p&gt;I am trying to get Products using the Element API plugin. I set the 'elementType' to &lt;code&gt;Commerce_Products&lt;/code&gt;, &lt;code&gt;CommerceProducts&lt;/code&gt;, etc.., but the endpoint keeps returning:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Endpoint has an invalid elementType&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is my endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\elements\Product as ProductsModel;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/search' =&amp;gt; [&#xA;            'elementType' =&amp;gt; 'ProductsModel',&#xA;            'paginate' =&amp;gt; false,&#xA;            'pretty' =&amp;gt; true,&#xA;            'criteria' =&amp;gt; [&#xA;                'limit' =&amp;gt; 15,&#xA;                'search' =&amp;gt; (Craft::$app-&amp;gt;request-&amp;gt;getParam('keyName')) ? 'title:'.'*'.Craft::$app-&amp;gt;request-&amp;gt;getParam('keyName').'*' : ''&#xA;            ],&#xA;            'transformer' =&amp;gt; function(ProductsModel $product) {&#xA;                return [&#xA;                    'title' =&amp;gt; $product-&amp;gt;title,&#xA;                    'url' =&amp;gt; $product-&amp;gt;url&#xA;                ];&#xA;            },&#xA;        ],&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I fix it?&lt;/p&gt;&#xA;" OwnerUserId="8590" LastEditorUserId="4169" LastEditDate="2018-12-10T21:57:51.377" LastActivityDate="2021-03-12T06:40:41.010" Title="Getting Commerce Products using Element API in Craft 3" Tags="&lt;plugin-elementapi&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28732" PostTypeId="2" ParentId="28731" CreationDate="2018-12-10T21:50:49.867" Score="3" Body="&lt;p&gt;You're so close! Just one change (see the &lt;code&gt;elementType&lt;/code&gt; key, and the added comment)…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\elements\Product;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'api/search' =&amp;gt; [&#xA;            'elementType' =&amp;gt; Product::class, // This provides Element API the fully qualified Element namespace + class.&#xA;            'paginate' =&amp;gt; false,&#xA;            'pretty' =&amp;gt; true,&#xA;            'criteria' =&amp;gt; [&#xA;                'limit' =&amp;gt; 15,&#xA;                'search' =&amp;gt; (Craft::$app-&amp;gt;request-&amp;gt;getParam('keyName')) ? 'title:'.'*'.Craft::$app-&amp;gt;request-&amp;gt;getParam('keyName').'*' : ''&#xA;            ],&#xA;            'transformer' =&amp;gt; function(Product $product) {&#xA;                return [&#xA;                    'title' =&amp;gt; $product-&amp;gt;title,&#xA;                    'url' =&amp;gt; $product-&amp;gt;url&#xA;                ];&#xA;            },&#xA;        ],&#xA;    ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I'd recommend leaving the &lt;code&gt;use&lt;/code&gt; statement as just &lt;code&gt;Product&lt;/code&gt;, as I've done above. What you're importing is a class that inherits from the Craft &lt;code&gt;Element&lt;/code&gt; class… “Model” has some other specific connotations in Craft + Yii, and even though at a lower level, Elements are still models, I think it's a good idea to leave them named as-is… after all, this is the &lt;em&gt;Element&lt;/em&gt; API! &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-12-10T21:53:46.490" LastActivityDate="2018-12-10T21:53:46.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28733" PostTypeId="2" ParentId="28697" CreationDate="2018-12-10T22:48:34.513" Score="2" Body="&lt;p&gt;This has been added in SEOmatic 3.1.36 as per &lt;a href=&quot;https://twitter.com/nystudio107/status/1072260946276597767&quot; rel=&quot;nofollow noreferrer&quot;&gt;this release announcement tweet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do it via the GUI in &lt;strong&gt;SEOmatic&lt;/strong&gt; -&gt; &lt;strong&gt;Site Settings&lt;/strong&gt; -&gt; &lt;strong&gt;Sitemap&lt;/strong&gt;: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#additional-sitemaps&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#additional-sitemaps&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3KMHd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3KMHd.png&quot; alt=&quot;Additional Sitemaps&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...or you can do it via plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use nystudio107\seomatic\events\RegisterSitemapsEvent;&#xA;use nystudio107\seomatic\models\SitemapIndexTemplate;&#xA;use yii\base\Event;&#xA;Event::on(SitemapIndexTemplate::class, SitemapIndexTemplate::EVENT_REGISTER_SITEMAPS, function(RegisterSitemapsEvent $e) {&#xA;    $e-&amp;gt;sitemaps[] = [&#xA;        'loc' =&amp;gt; $url,&#xA;        'lastmod' =&amp;gt; $lastMod,&#xA;    ];&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-12-11T03:53:07.387" LastActivityDate="2018-12-11T03:53:07.387" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28734" PostTypeId="1" AcceptedAnswerId="28757" CreationDate="2018-12-10T23:16:59.590" Score="1" ViewCount="384" Body="&lt;p&gt;I'm suddenly unable to load my site's assets page. All of my asset sources are local, and loading the main assets page or any source folder or subfolder results in &quot;An unknown error occurred.&quot; being displayed. No images are displayed. The assets section of the CP had previously been working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can still see my assets when uploading an asset within an entry editing screen, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant log info (I hope) is below. Seems to be an issue with Imager, which I think was updated recently: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2018-12-10 17:04:05 [-][1][-][error][yii\base\UnknownPropertyException] yii\base\UnknownPropertyException: Getting unknown property: aelvan\imager\models\ConfigModel::imgixEnablePurgeElementAction in /path/to/site/vendor/yiisoft/yii2/base/Component.php:154&#xA;&#xA;Stack trace:&#xA;&#xA;0 /path/to/site/vendor/aelvan/imager/src/Imager.php(154): yii\base\Component-&amp;gt;__get('imgixEnablePurg...')&#xA;&#xA;1 [internal function]: aelvan\imager\Imager-&amp;gt;aelvan\imager\{closure}(Object(craft\events\RegisterElementActionsEvent))&#xA;&#xA;2 /path/to/site/vendor/yiisoft/yii2/base/Event.php(310): call_user_func(Object(Closure), Object(craft\events\RegisterElementActionsEvent))&#xA;&#xA;3 /path/to/site/vendor/craftcms/cms/src/base/Element.php(320): yii\base\Event::trigger('craft\\elements\\...', 'registerActions', Object(craft\events\RegisterElementActionsEvent))&#xA;&#xA;4 /path/to/site/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(409): craft\base\Element::actions('folder:3')&#xA;&#xA;5 /path/to/site/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(90): craft\controllers\ElementIndexesController-&amp;gt;_availableActions()&#xA;&#xA;6 /path/to/site/vendor/yiisoft/yii2/base/Controller.php(155): craft\controllers\ElementIndexesController-&amp;gt;beforeAction(Object(yii\base\InlineAction))&#xA;&#xA;7 /path/to/site/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller-&amp;gt;runAction('get-elements', Array)&#xA;&#xA;8 /path/to/site/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('get-elements', Array)&#xA;&#xA;9 /path/to/site/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&amp;gt;runAction('element-indexes...', Array)&#xA;&#xA;10 /path/to/site/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application-&amp;gt;runAction('element-indexes...', Array)&#xA;&#xA;11 /path/to/site/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;&#xA;12 /path/to/site/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;&#xA;13 /path/to/site/web/index.php(21): yii\base\Application-&amp;gt;run()&#xA;&#xA;14 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="323" LastEditorUserId="5275" LastEditDate="2018-12-12T17:00:56.417" LastActivityDate="2018-12-12T17:00:56.417" Title="Assets page &quot;An unknown error occurred&quot;" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28735" PostTypeId="1" AcceptedAnswerId="28767" CreationDate="2018-12-10T23:58:56.493" Score="2" ViewCount="1329" Body="&lt;p&gt;There are a number of answers here about how to send CSRF tokens along with AJAX requests, but I think my question is a little different. Please excuse the abstractness here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a headless application, I'd like to be able to log users in via AJAX, and keep a fresh CSRF token in the client-side application's state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to get a new token, once one has been consumed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine a case where a customer adds an item to their cart—that token is consumed, and a new one is issued on the next page load… but what if there &lt;em&gt;isn't&lt;/em&gt; a new page load?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I even thinking about this the right way?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;In looking at the &lt;code&gt;UsersController&lt;/code&gt;, I noticed that the &lt;code&gt;get-remaining-session-time&lt;/code&gt; action sends a &lt;code&gt;csrfTokenValue&lt;/code&gt;. Any chance this is part of the answer?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-12-15T20:44:01.387" LastActivityDate="2019-02-21T08:06:34.597" Title="CSRF in “Headless” Applications" Tags="&lt;craft3&gt;&lt;ajax&gt;&lt;headless&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28736" PostTypeId="1" CreationDate="2018-12-11T01:07:06.930" Score="2" ViewCount="34" Body="&lt;p&gt;Saying I want to convert the following SQL query into ElementCriteriaModel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM users WHERE fieldA = 1 AND (fieldB = 1 or fieldC = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find a way in ElementCriteriaModel to do so.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.users({&#xA;    fieldA: 1,&#xA;    fieldB: 1,&#xA;    fieldC: 1, // where can we put the 'or' filter?&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can do this using DbCommand, but just curious if there's anyway we can do that via ElementCriteriaModel?&lt;/p&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2018-12-11T01:26:24.457" Title="ElementCriteriaModel combine with 'and' and 'or' filters" Tags="&lt;elementcriteriamodel&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28737" PostTypeId="2" ParentId="28736" CreationDate="2018-12-11T01:26:24.457" Score="1" Body="&lt;p&gt;I suspect you're looking for &lt;a href=&quot;https://docs.craftcms.com/v2/templating/elementcriteriamodel.html#setting-the-parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;this section&lt;/a&gt; on passing parameters to &lt;code&gt;ElementCriteriaModel&lt;/code&gt;s, in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The examples fail to highlight one aspect of the query you're building, but I think you'll find the same strategies hold up for many field values, as well as basic Element properties (like &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.users({ myFieldA: [1, 2, 3] }).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…will fetch &lt;code&gt;User&lt;/code&gt; Elements with the custom &lt;code&gt;myFieldA&lt;/code&gt; matching the values &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt;, or &lt;code&gt;3&lt;/code&gt;. The &lt;code&gt;or&lt;/code&gt; is implicit!&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-12-11T01:26:24.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28738" PostTypeId="2" ParentId="2898" CreationDate="2018-12-11T09:56:02.003" Score="5" Body="&lt;pre&gt;&lt;code&gt;{% for category in entry.mediaType %}&#xA;    &amp;lt;b&amp;gt;{{ category.title }}&amp;lt;/b&amp;gt;{{ &quot;,&quot; if not loop.last }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9139" LastEditorUserId="-1" LastEditDate="2019-02-27T06:33:47.363" LastActivityDate="2019-02-27T06:33:47.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28739" PostTypeId="1" CreationDate="2018-12-11T10:44:04.837" Score="1" ViewCount="29" Body="&lt;p&gt;I am trying to retrieve search suggestions for a search form. I sent the parameter entered by the user, but how do I do it in the criteria?&#xA;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [&#xA;    'search' =&amp;gt; 'title: *'.Craft::$app-&amp;gt;request-&amp;gt;getParam(&quot;key&quot;).'*'&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it does not return any results. What am I doing wrong?&#xA;this is my entire endpoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'suggests' =&amp;gt;function(){&#xA;        return [&#xA;            'elementType' =&amp;gt; Product::class,&#xA;            'paginate' =&amp;gt; false,&#xA;            'pretty' =&amp;gt; true,&#xA;            'criteria' =&amp;gt; [&#xA;                'limit' =&amp;gt; 15,&#xA;                'search' =&amp;gt; 'title: *'.Craft::$app-&amp;gt;request-&amp;gt;getParam(&quot;key&quot;).'*'&#xA;            ],&#xA;            'transformer' =&amp;gt; function(Product $product)  {&#xA;                return [&#xA;                    'title' =&amp;gt; $product-&amp;gt;title,&#xA;                    'url' =&amp;gt; $product-&amp;gt;url&#xA;                ];&#xA;            },&#xA;        ];&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8590" LastEditorUserId="57" LastEditDate="2018-12-12T23:33:36.790" LastActivityDate="2018-12-12T23:33:36.790" Title="Check if title field has a string in ElementAPI" Tags="&lt;plugin-elementapi&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28740" PostTypeId="2" ParentId="28725" CreationDate="2018-12-11T11:12:57.750" Score="4" Body="&lt;p&gt;This is probably injected as part of the form template that's used to render the form. In the Freeform section of the CP, if you edit a form and choose the 'cog' icon in the right-hand pane to access the form settings, you'll see a dropdown labelled 'Formatting Template', which lets you choose a template to render out the form markup, with a number of popular frameworks listed (Bootstrap, Foundation etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to override this markup (and remove the CSS include), you can create your own custom templates using one of these templates as a guide. The Freeform docs cover how to do this &lt;a href=&quot;https://solspace.com/craft/freeform/docs/formatting-template-examples/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default templates are located here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vendor/solspace/craft3-freeform/src/templates/_defaultFormTemplates&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a copy of the file you want to use as a base, and place it in your own &lt;code&gt;templates&lt;/code&gt; directory; I tend to use &lt;code&gt;templates/_forms&lt;/code&gt; for form templates. Give your new form template a meaningful name - Freeform does some nice parsing of custom template names to display them in the Formatting Template dropdown, so it's worth naming it well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open your new custom template and look for a line right at the top that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% css formCss %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove that line from your template and save it. Finally, make sure in the Admin CP &gt; Freeform Lite/Pro &gt; Settings &gt; Formatting Templates, you've included the path to your custom forms template directory relative to your main &lt;code&gt;templates&lt;/code&gt; directory. For my example directory above, I'd enter &lt;code&gt;_forms&lt;/code&gt; as the directory path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, edit your form and when you open the Formatting Template dropdown in the form settings, you should see your new custom form template. Select it, save your form and refresh the front-end form page. Hopefully, the Freeform CSS that was being injected is now removed from the markup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="8173" LastActivityDate="2018-12-11T11:12:57.750" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28742" PostTypeId="1" AcceptedAnswerId="28748" CreationDate="2018-12-11T11:19:35.077" Score="1" ViewCount="69" Body="&lt;p&gt;I hope someone can help me to understand this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Channel called eg. &quot;My channel&quot;. In that channel i have two entries:&lt;br&gt; Post 1 and Post 2. Those two entries have different titles and content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go to &quot;my-channel/post-1&quot; in the browser, and then to &quot;my-channel/post-2&quot; they have the same content based on the Post 2 (last created entry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I make &quot;Post 2&quot; inactive, then Post 1 will have the correct content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am i forgetting here?&lt;/p&gt;&#xA;" OwnerUserId="6532" LastEditorUserId="6532" LastEditDate="2018-12-11T12:20:25.377" LastActivityDate="2018-12-11T13:29:14.843" Title="Same content on different slugs" Tags="&lt;slug&gt;&lt;channels&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28743" PostTypeId="1" AcceptedAnswerId="28814" CreationDate="2018-12-11T11:37:57.463" Score="1" ViewCount="103" Body="&lt;p&gt;I'm looking to add a custom fields to the &lt;code&gt;details&lt;/code&gt; section on the right of the entry edit view in the control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that in Craft 2 this was possible using:&#xA;&lt;code&gt;Craft::$app-&amp;gt;view-&amp;gt;hook('cp.entries.edit.details', functionThatReturnsView())&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more Craft 3 way to do this or do we still use the Craft 2 API for this kind of extension to control panel?&lt;/p&gt;&#xA;" OwnerUserId="6624" LastActivityDate="2018-12-15T02:21:10.613" Title="Added custom entry details fields" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28744" PostTypeId="1" CreationDate="2018-12-11T12:06:36.987" Score="2" ViewCount="284" Body="&lt;p&gt;I am looking at creating an events site, and am thinking about using subdomains for each event. They will all be micro-sites listing exhibitors, timetables etc. I would like the domain structure to be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;eventone.amazingevents.com&lt;/code&gt;&#xA;&lt;code&gt;eventtwo.amazingevents.com&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so on. The editor would need to be able to create these through Craft, and then add pages within them. Is this possible within Craft, and if so is there any best practice for this? The micro-site frameworks would be very similar, just with different content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any insight&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2018-12-11T12:59:23.167" Title="Craft subdomains" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28745" PostTypeId="1" AcceptedAnswerId="28747" CreationDate="2018-12-11T12:11:39.100" Score="1" ViewCount="74" Body="&lt;p&gt;Is it at all possible to get forms to display per site and not all forms displaying to a site admin user? Also an admin user doesn't seem to be able to run reports on there own site, without being an admin of the entire Craft CMS instance.&lt;/p&gt;&#xA;" OwnerUserId="4623" LastActivityDate="2018-12-11T13:05:25.077" Title="Sprout Forms and Multi-site on Craft 3" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28746" PostTypeId="2" ParentId="28744" CreationDate="2018-12-11T12:59:23.167" Score="2" Body="&lt;p&gt;Yes, this is possible and fairly easy to setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest checking out this page:&#xA;&lt;a href=&quot;https://mijingo.com/lessons/craft-3-multi-site/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mijingo.com/lessons/craft-3-multi-site/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how you can accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create your subdomains and point their document roots to the same location.&lt;/li&gt;&#xA;&lt;li&gt;In Craft-&gt;Settings-&gt;Sites, add each subdomain as a site&lt;/li&gt;&#xA;&lt;li&gt;Add sections and turn them on for each site.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Use the toggle that appears at the top in the dashboard to change sites.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-11T12:59:23.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28747" PostTypeId="2" ParentId="28745" CreationDate="2018-12-11T13:05:25.077" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/multi-site.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/docs/multi-site.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like multisite support for Sprout Forms is a planned/under review addition&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-11T13:05:25.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28748" PostTypeId="2" ParentId="28742" CreationDate="2018-12-11T13:29:14.843" Score="2" Body="&lt;p&gt;Because your Entry URI is setup as my-channel/{slug} , When you go to my-channel/post-slug-1 Craft automatically sets the variable 'entry' to the entry post-slug-1. You don't need to loop through the channel at this point. You can just use the entry variable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;entry.fieldName&#xA;entry.slug&#xA;entry.url &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So just remove your for loop and use 'entry'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('my-channel').limit(1).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will get the first entry of the my-channel section. That's useful for pages where you need to list out all of your entries in that section or get specific ones.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-11T13:29:14.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28749" PostTypeId="1" CreationDate="2018-12-11T15:20:22.140" Score="1" ViewCount="101" Body="&lt;p&gt;I have already searched for information on this topic but I did not find much. I hope I did not overlook something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My problem is the following:&lt;/strong&gt; I want to try to write a plugin that lists entries from an external service via API calls. I have already done this in Craft2 with a custom field type (a dropdown-field) that listed all available elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for Craft3, I want to go one step further and implement a Modal like the AssetPicker where the user can list elements in a table or thumbnail view or even search for one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making the API-calls is easy. Nothing to fancy there. However, I struggle with how to integrate it into craft and how to do the templating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started with a custom FieldType like I did the last time. &lt;strong&gt;However, I am not sure whether it would be better to use an Element Type?&lt;/strong&gt; As far as I understand, Element Types store their entries in the database, which I do not plan to do, since I access a remote database via an API. I only want to store the item-id in my custom field. On the other hand, I have the feeling that there are already available functions like  &lt;code&gt;Craft.createElementSelectorModal()&lt;/code&gt; that implement many functions I need and work great with custom Element Types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not yet totally understand the concepts of element types and field types and how they differ. If you have good sources of documentation, I am also thankful for that, especially information on how to use the ElementSelectorModal. I did not find much information about this.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;In summary:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Would you suggest using a custom field type or custom element type? &lt;/li&gt;&#xA;&lt;li&gt;Is it possible to use custom element types without storing everything in a database?&lt;/li&gt;&#xA;&lt;li&gt;Do you have any good resources of information on these topics?&lt;/li&gt;&#xA;&lt;li&gt;Do you have good resources of information about the ElemetSelectorModal?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I did overlook an answer to my question, already available on this platform, please feel free to refer to it. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I have read a lot now about modals, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/895/is-it-possible-to-use-the-elementtype-modal-ui-for-a-custom-field-type-plugin&quot;&gt;Is it possible to use the ElementType Modal UI for a custom Field Type Plugin?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/374/how-can-my-plugin-generate-a-generic-modal-window-in-the-control-panel/384#384&quot;&gt;How can my plugin generate a generic modal window in the Control Panel?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/1805/possible-to-override-garnish-modal-plugin&quot;&gt;Possible to override Garnish.Modal? [Plugin]&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And I found this post, which almost exactly describes my problem: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/7094/use-entries-fieldtype-functionality-in-plugin-populated-by-rest-api-data&quot;&gt;Use Entries fieldtype functionality in plugin populated by REST api data&lt;/a&gt;, however, some of the linked entries are not accessible to me and it referred to Craft 2.0, not version 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that I can build my own modal using the Garnish-code. However, I would love to use the already existing functionality of the element type-modal. Therefore my question is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Is it possible to define a custom element type without a database storage connected to it?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I considered copying all API-results into the database and update it regularly by a cronjob. However, this duplicated the content from the external source which is unnecessary in my eyes. I would rather love to &quot;populate&quot; a custom field type &quot;on the go&quot; by a API-call, without writing it to the database. Is there any way to do this?&lt;/p&gt;&#xA;" OwnerUserId="5424" LastEditorUserId="5424" LastEditDate="2018-12-11T16:47:19.503" LastActivityDate="2018-12-11T16:47:19.503" Title="Element type vs. Field type - or: Element type without database storage?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;custom-fieldtype&gt;&lt;elementtype&gt;&lt;custom-field&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28750" PostTypeId="2" ParentId="12663" CreationDate="2018-12-11T15:51:49.190" Score="6" Body="&lt;p&gt;You need to add &quot;html&quot; in the &lt;code&gt;buttons&lt;/code&gt; array, and not &quot;source&quot; in the &lt;code&gt;plugins&lt;/code&gt; array.&lt;/p&gt;&#xA;" OwnerUserId="9143" LastEditorUserId="45" LastEditDate="2018-12-12T06:35:10.983" LastActivityDate="2018-12-12T06:35:10.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28753" PostTypeId="1" AcceptedAnswerId="28887" CreationDate="2018-12-11T18:07:05.417" Score="2" ViewCount="93" Body="&lt;p&gt;I've created a module for a project that has several actions, all of which are called through AJAX. Each is a post request that sends over any required params plus the CSRF token using the method described here: &lt;a href=&quot;https://craftcms.com/guides/enabling-csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/enabling-csrf-protection#updating-your-javascript&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On localhost, everything works correctly. On the staging server, some work correctly but others return a 404 error. Specifically, the response gives &quot;Template not found: actions/module-name/location/geocode-inputs&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;web.log doesn't look to be throwing any errors, and I'm not sure where else to look. Any ideas on what might be going wrong?&lt;/p&gt;&#xA;" OwnerUserId="9144" LastActivityDate="2018-12-19T17:48:37.677" Title="Some (but not all) controller action routes return 404 on staging server" Tags="&lt;controller&gt;&lt;multi-environment&gt;&lt;404&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28754" PostTypeId="2" ParentId="28642" CreationDate="2018-12-11T19:13:47.567" Score="4" Body="&lt;p&gt;I've used SEOmatic and ImageOptimize together before and never had those issues. SEOmatic should care less about the presence of the ImageOptimize field on the asset and you definitely don't need to specify custom ImageOptimize variants for your SEO/social purposes. SEOmatic grabs the raw image (like you would grab the asset url in the templates) and does its &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic/blob/66bb72dab898263210960de09c844701a68eceef/src/helpers/ImageTransform.php#L82&quot; rel=&quot;nofollow noreferrer&quot;&gt;own transforms&lt;/a&gt; to get that image ready for social/SEO use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is something is incorrectly setup in the Content SEO settings for whatever section the entry you're currently editing exists in. If you still can't figure it out, I'd be curious to see screenshots of those settings...&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, fwiw, Andrew does provide a very handy &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#seo-settings-field&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEO Settings field&lt;/a&gt; that might be worth considering as a replacement to the setup you've got going on currently. As he mentions in the plugin README:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Modern SEO works best if it actually reflects what is on the page, visible to the user, so pulling from your page's content will work well in most cases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what I've done (and would recommend, though it would mean you would lose your client-friendly field descriptions) is to pull the SEO/social data out of the content of the page and then add the SEO Settings field to that last tab just in case you need to overwrite stuff. For example, rather than adding the asset used as the masthead image and the asset used for SEO/social separately, use the same field for both. Makes it simpler on the client and on you! And then, if and when you do need a different image for the social/SEO metadata, you can use the SEO Settings field.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-11T19:13:47.567" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28755" PostTypeId="1" CreationDate="2018-12-11T22:28:07.007" Score="1" ViewCount="106" Body="&lt;p&gt;I have this code which merged entries when in Craft 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesOne = craft.entries.section('publications').search('nonMembers:0').ids() %}&#xA;{% set entriesTwo = craft.entries.section('improveYourClub').search('membersExclusive:1').ids() %}&#xA;&#xA;{% set entriesIds = entriesOne|merge(entriesTwo) %}&#xA;&#xA;{% set entries = craft.entries.id(entriesIds) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However when I updated the site to Craft 3 I'm no longer seeing entries merged. I only get results for the &lt;code&gt;entriesOne&lt;/code&gt;. not a list of combined entries as expected.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-12-11T22:28:07.007" Title="Merging Entries - Craft 2 worked but not Craft 3" Tags="&lt;merge&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28756" PostTypeId="1" CreationDate="2018-12-12T00:07:44.337" Score="0" ViewCount="191" Body="&lt;p&gt;I currently have this dropdown on a front-end form, the problem I'm having is that it's saving the &lt;code&gt;value&lt;/code&gt; where I really want to use the label in my templates such as &lt;code&gt;United Kingdom&lt;/code&gt; instead of &lt;code&gt;unitedKingdom&lt;/code&gt;. Is this something I should be changing in my Dashboard/Front-end/Dropdown?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;          &amp;lt;label&amp;gt;Location&amp;lt;/label&amp;gt;&#xA;          &amp;lt;select class=&quot;form-control&quot; id=&quot;listingType&quot; name=&quot;fields[location][]&quot; required&amp;gt;&#xA;            {% set locationField = craft.fields.getFieldbyHandle('location') %}&#xA;            {% for option in locationField.settings.options %}&#xA;            &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;&#xA;              {{ option.label }}&#xA;            &amp;lt;/option&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/select&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Front End &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ entry.author.location|ucwords }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-01-17T18:00:33.527" Title="Using Label instead of Value from Dropdown" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28757" PostTypeId="2" ParentId="28734" CreationDate="2018-12-12T01:59:32.727" Score="2" Body="&lt;p&gt;As noted in the comments, sounds like you've got an error in your Imager config (prob an incorrect value set for the &lt;a href=&quot;https://github.com/aelvan/Imager-Craft#imgixenablepurgeelementaction-bool&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;imgixEnablePurgeElementAction&lt;/code&gt;&lt;/a&gt; option or one of the lines close by).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-12T01:59:32.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28758" PostTypeId="2" ParentId="28584" CreationDate="2018-12-12T02:26:23.727" Score="1" Body="&lt;p&gt;Some &quot;problems&quot; I see with your solution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You're repeating yourself twice there - it would be much better if you had your &lt;code&gt;actionBilder&lt;/code&gt; loop in there only once. When writing code, try to use the DRY principle: &lt;strong&gt;D&lt;/strong&gt;on't &lt;strong&gt;R&lt;/strong&gt;epeat &lt;strong&gt;Y&lt;/strong&gt;ourself (obviously exceptions to that rule but this is one case where you could simplify).&lt;/li&gt;&#xA;&lt;li&gt;Not sure why exactly you're using &lt;code&gt;exists()&lt;/code&gt; to check you matrix block's presence. I've actually never seen that method in use before and had to look it up to see what exactly it does. Based on &lt;a href=&quot;https://docs.craftcms.com/v3/categories-fields.html#examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt;, looks like you would use it to check if there are any related categories (but don’t need to fetch them). But like I said, I've never heard of &lt;code&gt;exists()&lt;/code&gt; so could be I'm wrong... &lt;em&gt;Fwiw, here's a &lt;a href=&quot;https://craftcms.stackexchange.com/a/842/5275&quot;&gt;great answer&lt;/a&gt; by Brandon Kelly on what you should use to check if a field is empty or non-existent.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;This may not be a problem in your current setup but at the moment you're fetching three blocks from your matrix field and only displaying them if they are a particular type. This means if you were to ever add another block to your matrix you could end up with two, one, or even no images at all (because the three blocks you queried for are all of a different type). It would be better to grab three blocks of that particular type and then loop through them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's what I'd recommend doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# are we dealing with an entry page? #}&#xA;{% if entry is defined %}&#xA;&#xA;    {# if so we create an array of related categories #}&#xA;    {% set categories = craft.categories.relatedTo(entry) %}&#xA;&#xA;{# otherwise we'll check if this is a category page #}&#xA;{% elseif category is defined %}&#xA;&#xA;    {# if so we create an array with our one category #}&#xA;    {% set categories = [ category ] %}&#xA;&#xA;{% endif %}&#xA;&#xA;{# make sure we actually have categories in the array #}&#xA;{% if categories | length %}&#xA;&#xA;    {# start the `for` loop #}&#xA;    {% for category in categories %}&#xA;&#xA;        {# does the matrix field exist and does it contain any blocks? #}&#xA;        {% if category.actionBilder | length %}&#xA;&#xA;            &amp;lt;div id=&quot;footerslide&quot;&amp;gt;&#xA;&#xA;                {# get 3 `actionImg` blocks randomly #}&#xA;                {% for block in category.actionBilder.limit(3).type('actionImg').orderBy('RAND()').all() %}&#xA;&#xA;                    {# get the block's first image's url #}&#xA;                    &amp;lt;div data-image=&quot;{{block.image.one().url}}&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that's helpful!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-12-12T02:39:17.817" LastActivityDate="2018-12-12T02:39:17.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28759" PostTypeId="2" ParentId="28739" CreationDate="2018-12-12T12:06:40.290" Score="1" Body="&lt;p&gt;I got it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'criteria' =&amp;gt; [ 'title' =&amp;gt; '*'.Craft::$app-&amp;gt;request-&amp;gt;getParam(&quot;key&quot;).'*' ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2018-12-12T12:06:40.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28760" PostTypeId="2" ParentId="5502" CreationDate="2018-12-12T13:51:55.497" Score="5" Body="&lt;p&gt;You now can use the &lt;code&gt;filesize&lt;/code&gt; filter:&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/filters.html#filesize&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/filters.html#filesize&lt;/a&gt;.&#xA;This will make the file size readable, and the unit will be selected automatically.&lt;/p&gt;&#xA;" OwnerUserId="131" LastActivityDate="2018-12-12T13:51:55.497" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28761" PostTypeId="1" AcceptedAnswerId="28763" CreationDate="2018-12-12T14:02:29.810" Score="1" ViewCount="559" Body="&lt;p&gt;When I try to install or update a plugin from the Control Panel, I see a message &quot;&lt;strong&gt;&lt;em&gt;Updating Composer Dependencies&lt;/em&gt;&lt;/strong&gt;&quot; and then the following error occurs. I'm running Craft on a local environment. Installing and updating from the command line works fine. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Status: Internal Server Error&#xA;&#xA;Response:&#xA;PHP Fatal Error &amp;amp;#039;yii\base\ErrorException&amp;amp;#039; with message &amp;amp;#039;Maximum execution time of 30 seconds exceeded&amp;amp;#039;&#xA;in ...\vendor\composer\composer\src\Composer\Util\RemoteFilesystem.php:555&#xA;&#xA;Stack trace:&#xA;#0 [internal function]: yii\base\ErrorHandler-&amp;amp;gt;handleFatalError()&#xA;#1 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9128" LastEditorUserId="5275" LastEditDate="2018-12-12T14:18:50.493" LastActivityDate="2018-12-12T14:40:19.000" Title="Maximum execution time exceeded when adding or updating plugins from the Control Panel" Tags="&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28762" PostTypeId="1" AcceptedAnswerId="28764" CreationDate="2018-12-12T14:14:55.737" Score="2" ViewCount="106" Body="&lt;p&gt;When I output my ImageOptimize field in the template, my images are not showing up. If you inspect the image url, it's missing a folder name I'm specifying as part of the url in my multi-environment setup and volume config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I manually change the image url in the browser tools to include the missing folder, the image shows up. Other images are rendered fine when using the standard asset field code so I'm not sure what could be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things to note:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am using Andrew's &lt;a href=&quot;https://github.com/nystudio107/craft3-multi-environment/blob/master/config/general.php#L42&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-environment setup&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;I have two separate folders in my web root folder:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the folder &lt;code&gt;assets/&lt;/code&gt;, I'm serving my template assets like css, images, and fonts. &lt;/li&gt;&#xA;&lt;li&gt;In the folder &lt;code&gt;content/&lt;/code&gt;, I'm serving the files uploaded to the volumes I have setup in Craft - images, logos, documents etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fCZmd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fCZmd.png&quot; alt=&quot;asset folder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My environment variables:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'BASE_URL' =&amp;gt; $protocol . $httpHost . '/',&#xA;&#xA;'BASE_PATH' =&amp;gt; realpath(dirname(__FILE__)) . '/web/content/',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My aliases (set for all environments):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;    '@basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH'),&#xA;    '@baseUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My volume config:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;    'images' =&amp;gt; [&#xA;        'path' =&amp;gt; '@basePath/images',&#xA;        'url' =&amp;gt; '@baseUrl/content/images',&#xA;    ],&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My ImageOptimize snippet:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;{{ optimizedImages.src() }}&quot;&#xA;             srcset=&quot;{{ optimizedImages.srcset() }}&quot;&#xA;             sizes=&quot;100vw&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The image path being used on the frontend (note the absence of the &lt;code&gt;content/&lt;/code&gt; folder):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;https://franklin.test/images/_1920x1080_crop_center-center_82_line/national-formulation-centre.jpg&quot; srcset=&quot;https://franklin.test/images/_1920x1080_crop_center-center_82_line/national-formulation-centre.jpg 1920w&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5275" LastEditDate="2018-12-12T15:36:11.537" LastActivityDate="2018-12-12T15:41:16.193" Title="ImageOptimize not using image url specified in my multi-environment setup and my volume config" Tags="&lt;assets&gt;&lt;multi-environment&gt;&lt;environmentvariables&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28763" PostTypeId="2" ParentId="28761" CreationDate="2018-12-12T14:40:19.000" Score="2" Body="&lt;p&gt;You need to figure out where your PHP config file is located (&lt;code&gt;php.ini&lt;/code&gt;) and increase the value for the &lt;a href=&quot;https://secure.php.net/manual/en/info.configuration.php#ini.max-execution-time&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;max_execution_time&lt;/code&gt; setting&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The best way to locate your &lt;code&gt;php.ini&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you can run &lt;code&gt;php&lt;/code&gt; from the command line, run &lt;code&gt;php --ini&lt;/code&gt;. Alternatively you could use &lt;code&gt;php -i | grep 'Configuration File'&lt;/code&gt; to search the full &lt;code&gt;phpinfo()&lt;/code&gt;. &lt;a href=&quot;https://stackoverflow.com/q/2750580/4914302&quot;&gt;More info...&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;code&gt;php&lt;/code&gt; isn't accessible via the CLI, you can also create a simple php file that contains the following snippet. Load it up in your browser and search the page for &quot;Configuration File&quot;. This will give you the location of your &lt;code&gt;php.ini&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;phpinfo();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you're using a Laravel Valet / Homebrew setup, the &lt;code&gt;php.ini&lt;/code&gt; file is located at &lt;code&gt;/usr/local/etc/php/X.X/php.ini&lt;/code&gt; where &lt;code&gt;X.X&lt;/code&gt; is your PHP version number.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you're running MAMP Pro, I believe they provide a built in editor to customize this - see &lt;a href=&quot;https://stackoverflow.com/q/37824946/4914302&quot;&gt;&lt;em&gt;How do you change php.ini values in MAMP Pro?&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-12T14:40:19.000" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28764" PostTypeId="2" ParentId="28762" CreationDate="2018-12-12T15:41:16.193" Score="1" Body="&lt;p&gt;You need to re-index your assets to show the correct URL after changes to your volume location when using imageOptimize. Just re-save the volume from within Craft CMS. Even if you have made amends to your volume config file you will need to re-save from within Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quote &lt;a href=&quot;https://github.com/nystudio107/craft-imageoptimize/issues/78#issuecomment-385978902&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew&lt;/a&gt;, the plugin author...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;So I want to say that this is normal (though maybe not desirable?)l.&#xA;  The URLs in the OptimizedImages fields get resolved at asset save&#xA;  time. So the full absolute URL to each image will resolve to whatever&#xA;  the alias is.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Potentially this resolution could be postponed until runtime, but in&#xA;  the interim, if you re-index your assets on the environment.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2018-12-12T15:41:16.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28765" PostTypeId="2" ParentId="18850" CreationDate="2018-12-12T15:59:56.597" Score="1" Body="&lt;p&gt;Based on Brandon's answer &lt;a href=&quot;https://craftcms.stackexchange.com/a/19310/5275&quot;&gt;here&lt;/a&gt;, this is currently not a feature of Craft CMS (as of v3.0.34).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need this functionality, I'd look into doing one of the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As mentioned in the comments and in Brandon's answer (linked above), create a matrix field with a block containing a category field that is limited to one category. This will allow you to add multiple categories but be able to rearrange the matrix blocks as needed (thereby changing the order of the categories).&lt;/li&gt;&#xA;&lt;li&gt;Build your own plugin to achieve this functionality. Also check the current list of &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;available plugins&lt;/a&gt;, as it's possible someone else has already created a plugin to achieve this.&lt;/li&gt;&#xA;&lt;li&gt;Open an issue on the &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS repo&lt;/a&gt; (based on Brandon's answer though, seems like P&amp;amp;T don't really think selected categories need to get reordered, so not sure how far you'll get with this unless P&amp;amp;T have changed their minds).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-12T15:59:56.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28767" PostTypeId="2" ParentId="28735" CreationDate="2018-12-12T19:40:08.497" Score="4" Body="&lt;p&gt;A similar question was asked in the Craft Slack today, so I thought I'd transcribe the consensus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internally, CSRF tokens come from a call to &lt;code&gt;Craft::$app-&amp;gt;getRequest()-&amp;gt;getCsrfToken()&lt;/code&gt;. This means that any controller (or template, for that matter—more often handled by the &lt;code&gt;{{ csrfInput() }}&lt;/code&gt; shortcut method) can grab a CSRF token at will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the original post, I'd noted that the &lt;code&gt;users/get-remaining-session-time&lt;/code&gt; action returns a token—that token comes from the above call, so it certainly sounds like a valid built-in method for grabbing tokens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, it does have some potential side effects related to the session (aside from refreshing the CSRF token).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately—provided the time—it seems like the recommended method is to create a custom controller and call the method explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the client-side handling… if your application has a means to consolidate AJAX calls, it'd be worth automating the refresh and inclusion of CSRF tokens as HTTP headers. For example, before a regular POST request is initiated, the client might first ensure it has a fresh CSRF token, &lt;em&gt;then&lt;/em&gt; issue the request with the new token.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps anyone else getting started with client-rendered applications!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;a href=&quot;https://github.com/craftcms/cms/issues/3858&quot; rel=&quot;nofollow noreferrer&quot;&gt;As of Craft 3.1.13&lt;/a&gt;, you get a CSRF token in the JSON response when a user logs in (assuming the login occurs over Ajax)!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2019-02-21T08:06:34.597" LastActivityDate="2019-02-21T08:06:34.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28768" PostTypeId="1" CreationDate="2018-12-12T21:17:37.313" Score="1" ViewCount="40" Body="&lt;p&gt;I'm trying to determine if a user has changed their email address via a front-end form. From what I've gleaned, the best way to do this would be by checking the existing record during &lt;code&gt;users.beforeSaveUser&lt;/code&gt;, store the old email, then compare to the new email during &lt;code&gt;users.onSaveUser&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I get a user's record during &lt;code&gt;users.beforeSaveUser&lt;/code&gt;, the newly-submitted email address has already overwritten their record.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('users.beforeSaveUser', function(Event $event)&#xA;{&#xA;    if(!$event-&amp;gt;params['isNewUser'])&#xA;    {&#xA;        $currentUser = craft()-&amp;gt;users-&amp;gt;getUserById($user-&amp;gt;id);&#xA;        exit($currentUser-&amp;gt;email);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code shows the new email, not the old one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behaviour? Any other way to accomplish what I need to?&lt;/p&gt;&#xA;" OwnerUserId="63" LastActivityDate="2018-12-13T09:00:13.920" Title="How to determine if a user's email has changed" Tags="&lt;users&gt;&lt;frontend-form&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28769" PostTypeId="1" AcceptedAnswerId="28779" CreationDate="2018-12-12T21:58:03.803" Score="1" ViewCount="140" Body="&lt;p&gt;Is there any way to migrate the configuration of a Sprout Form between my local environment and the production environment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm on Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'd love to generate a migration using the migration manager &lt;a href=&quot;https://github.com/Firstborn/Craft-CMS-Migration-Manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Firstborn/Craft-CMS-Migration-Manager&lt;/a&gt; but would love any way to move the settings of a form.&lt;/p&gt;&#xA;" OwnerUserId="8814" LastEditorUserId="57" LastEditDate="2018-12-15T01:42:29.560" LastActivityDate="2018-12-15T01:42:29.560" Title="Migrate sprout forms" Tags="&lt;plugin-sproutforms&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28770" PostTypeId="1" AcceptedAnswerId="28772" CreationDate="2018-12-12T23:07:57.980" Score="1" ViewCount="765" Body="&lt;p&gt;The previous install (3.0.34) was working fine until I ran the updater from the CP. The update failed with error (couldn't access web.config (IIS))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now loading CP or front end displays the following error:&#xA;Warning: require(C:...Craft\Projects\Untye/vendor/craftcms/cms/bootstrap/web.php): failed to open stream: No such file or directory in C:\Users\rickn\Documents\Craft\Projects\Untye\web\index.php on line 20&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fatal error: require(): Failed opening required 'C:...\Craft\Projects\Untye/vendor/craftcms/cms/bootstrap/web.php' (include_path='.;C:\php\pear') in C:...Craft\Projects\Untye\web\index.php on line 20&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to finish the install manually and keep the previous work and data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{&#xA;&lt;/code&gt;&quot;require&quot;: {&#xA;   &lt;code&gt;&quot;craftcms/cms&quot;: &quot;3.0.35&quot;,&#xA;&lt;/code&gt; &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &lt;code&gt;&quot;craftcms/redactor&quot;: &quot;^2.1&quot;,&#xA;&lt;/code&gt;&quot;craftcms/mailgun&quot;: &quot;^1.3&quot;,&#xA;   &lt;code&gt;&quot;craftcms/contact-form&quot;: &quot;^2.2&quot;,&#xA;&lt;/code&gt;&quot;indigoviking/liquid-letters&quot;: &quot;^1.2&quot;,&#xA;    &lt;code&gt;&quot;lukeyouell/craft-contactformtemplates&quot;: &quot;1.0.1&quot;,&#xA;&lt;/code&gt;&quot;doublesecretagency/craft-bootstrap&quot;: &quot;4.1.1.2&quot;,&#xA;   &lt;code&gt;&quot;fatfish/navigation&quot;: &quot;1.0.7&quot;,&#xA;&lt;/code&gt; &quot;superbig/craft3-templateselect&quot;: &quot;^2.0&quot;,&#xA;   &lt;code&gt;&quot;craftcms/ckeditor&quot;: &quot;1.0.0-beta.2&quot;,&#xA;&lt;/code&gt; &quot;verbb/navigation&quot;: &quot;^1.0&quot;,&#xA;   &lt;code&gt;&quot;enupal/slider&quot;: &quot;1.2.2&quot;,&#xA;&lt;/code&gt; &quot;studioespresso/craft-dumper&quot;: &quot;^1.3&quot;,&#xA;   &lt;code&gt;&quot;topshelfcraft/wordsmith&quot;: &quot;^3.0&quot;,&#xA;&lt;/code&gt; &quot;craftcms/craft&quot;: &quot;^1.0&quot;&#xA; &lt;code&gt;},&#xA;&lt;/code&gt; &quot;autoload&quot;: {&#xA; &lt;code&gt;&quot;psr-4&quot;: {&#xA;&lt;/code&gt;    &quot;modules\&quot;: &quot;modules/&quot;&#xA;  &lt;code&gt;}&#xA;&lt;/code&gt; },&#xA; &lt;code&gt;&quot;config&quot;: {&#xA;&lt;/code&gt;   &quot;optimize-autoloader&quot;: true,&#xA; &lt;code&gt;&quot;platform&quot;: {&#xA;&lt;/code&gt;     &quot;php&quot;: &quot;7.0&quot;&#xA;  &lt;code&gt;}&#xA;&lt;/code&gt; },&#xA; &lt;code&gt;&quot;scripts&quot;: {&#xA;&lt;/code&gt;  &quot;post-root-package-install&quot;: [&#xA; &lt;code&gt;&quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;&lt;/code&gt;   ]&#xA; &lt;code&gt;}&#xA;&lt;/code&gt;}&lt;/p&gt;&#xA;" OwnerUserId="9128" LastEditorUserId="9128" LastEditDate="2018-12-13T02:23:56.053" LastActivityDate="2018-12-13T02:32:00.860" Title="Ran the Craft Updater from Control Panel the current install is no longer working" Tags="&lt;install&gt;&lt;manual-updates&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28772" PostTypeId="2" ParentId="28770" CreationDate="2018-12-12T23:33:40.987" Score="1" Body="&lt;p&gt;Try running&#xA;    composer update&#xA;Via the command line while in ssh&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or download the latest Craft files and replace your files. Mainly vendor/craftcms it looks like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update composer.json to this and try running composer update again.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;^3.0.35&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;^2.1&quot;,&#xA;    &quot;craftcms/mailgun&quot;: &quot;^1.3&quot;,&#xA;    &quot;craftcms/contact-form&quot;: &quot;^2.2&quot;,&#xA;    &quot;indigoviking/liquid-letters&quot;: &quot;^1.2&quot;,&#xA;    &quot;lukeyouell/craft-contactformtemplates&quot;: &quot;1.0.1&quot;,&#xA;    &quot;doublesecretagency/craft-bootstrap&quot;: &quot;4.1.1.2&quot;,&#xA;    &quot;fatfish/navigation&quot;: &quot;1.0.7&quot;,&#xA;    &quot;superbig/craft3-templateselect&quot;: &quot;^2.0&quot;,&#xA;    &quot;craftcms/ckeditor&quot;: &quot;1.0.0-beta.2&quot;,&#xA;    &quot;verbb/navigation&quot;: &quot;^1.0&quot;,&#xA;    &quot;enupal/slider&quot;: &quot;1.2.2&quot;,&#xA;    &quot;studioespresso/craft-dumper&quot;: &quot;^1.3&quot;,&#xA;    &quot;topshelfcraft/wordsmith&quot;: &quot;^3.0&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5501" LastEditDate="2018-12-13T02:32:00.860" LastActivityDate="2018-12-13T02:32:00.860" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="28773" PostTypeId="2" ParentId="28704" CreationDate="2018-12-13T02:54:28.190" Score="3" Body="&lt;p&gt;On the Transactions tab of the order, there should be a payment attempt with a failed status. There's a small information icon which returns the gateway response.&lt;/p&gt;&#xA;" OwnerUserId="9149" LastActivityDate="2018-12-13T02:54:28.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28774" PostTypeId="2" ParentId="28768" CreationDate="2018-12-13T09:00:13.920" Score="1" Body="&lt;p&gt;Only thing I can think of off the top of my head would be to create a new, separate database table that stores user Ids against email addresses. Perhaps also with a timestamp of when the row was written.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then write the user's email address to that upon registration and use it to check against the &quot;official&quot; email address when you need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you find a change, do whatever it is you need to do and update your table with the new email address.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-13T09:00:13.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28775" PostTypeId="1" CreationDate="2018-12-13T10:24:16.210" Score="1" ViewCount="638" Body="&lt;p&gt;I have a frontend entry form which included a file field to upload files to the entry. All works fine. I even have a delete function to remove individual uploaded files from the entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is if a user wants to attach a file they have already uploaded. Uploading the file results in the same file uploaded but with a different filename (a timestamp added to the end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is going to result in unused files being left on the server and a nightmare version control going on - people left wondering what version is correct, which is being used, is it safe to delete the old ones etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So ideally what is needed is the user can browse the assets uploaded on the front end and ideally be able to upload within that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a facility to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-01-24T15:25:46.183" Title="How to browse uploaded assets on the front end?" Tags="&lt;assets&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28776" PostTypeId="1" CreationDate="2018-12-13T10:47:30.200" Score="1" ViewCount="93" Body="&lt;p&gt;I'm working on a custom payment gateway, and the concept of tax adjustments are giving me some headache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this adjustment system, especially regarding tax, supposed to be used? Would it be normal, or at least make sense, for some stores to use both included and excluded tax on certain items?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets use this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The Last Knee-High    $60.00&#xA;Exclude               $3.00 (5%)&#xA;Included              $1.75 (3% inc)&#xA;Total USD:            $63.00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The payment provider I'm integrating with require the tax amount and tax rate to be sent with the order to the API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tax amount is marked as VAT in the overview, would it then be correct to send:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$3.00 5% VAT ?&lt;/li&gt;&#xA;&lt;li&gt;$1.75 3% VAT ?&lt;/li&gt;&#xA;&lt;li&gt;$4.75 X% VAT ?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Or is it just not likely that any company would need both included and excluded taxing in the store? For European stores I looks like its custom to display prices inc tax/vat, while US it looks more normal to include the tax/vat in the cart, not while browsing. So I can't just say that VAT = excluded tax &lt;strong&gt;or&lt;/strong&gt; included tax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully I've explained my question well enough for someone to shed some light.  &lt;/p&gt;&#xA;" OwnerUserId="8864" LastActivityDate="2018-12-13T10:47:30.200" Title="Adjustables - Tax and VAT" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28777" PostTypeId="2" ParentId="28719" CreationDate="2018-12-13T13:28:18.440" Score="1" Body="&lt;p&gt;The best way is to change home team ID and away team ID to entry fields that select the club. If you are using a plugin like Feed Me to bring in the matches, and you have all of the club IDs already entered in the club entries, you should be able to import matches and use the home and away IDs and match them to the appropriate Club in Feed Me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once that is done, you won't have to loop through all of the Clubs, just pull the one from each of the matches home and away fields like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for team in fixture.homeTeamId.limit(1).all() %}&#xA;    {% for logo in team.clubLogo.limit(1).all() %}&#xA;        &amp;lt;img src=&quot;{{ logo.getUrl() }}&quot; /&amp;gt;&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your API isn't brought in with Feed Me (or akin) and you can't change the home/away fields to entry selectable fields, you can select a team by matching its ID field to the given ID field like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set awayId = fixture.awayTeamId %}&#xA;{% set awayTeam = craft.entries.section('clubs').search('clubId:'~awayId).limit(1) %}&#xA;  {% for team in awayTeam %}&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-13T13:28:18.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28778" PostTypeId="1" CreationDate="2018-12-13T13:36:27.287" Score="2" ViewCount="31" Body="&lt;p&gt;Is it possible to use a wildcard when specifying the template path for a Commerce 2 product type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to format my URLs as &lt;code&gt;/type/product/variant&lt;/code&gt;&lt;br&gt;&#xA;Where 'variant' could be a custom field applied to the product variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the settings for my product type I've tried a few things, including setting the &quot;Category URI Format&quot; to variations of &lt;code&gt;/type/{slug}/{variant.customField}&lt;/code&gt; all to no avail. The template isn't found as soon as I include that third segment to the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel this should be possible to do with Routes but having much the same problem.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-13T13:53:09.010" Title="Including a variant segment in product type template route in Commerce 2" Tags="&lt;templating&gt;&lt;plugin-craftcommerce2&gt;&lt;products&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28779" PostTypeId="2" ParentId="28769" CreationDate="2018-12-13T13:49:53.343" Score="2" Body="&lt;p&gt;Sprout Forms will be adding support for &lt;a href=&quot;https://github.com/craftcms/cms/blob/3.1/docs/project-config.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Project Config&lt;/a&gt; in Craft 3.1. At the time of this posting the Craft Project Config has not yet been released, the Project Config will likely give us a much better workflow to maintain plugin settings between environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While there is an alternative, the export/import path described below would be a bit tedious to maintain and could just be easier to do manually depending on how many Forms you need to migrate (as you will have to define those forms in the export JSON to get them exported). &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Sprout Forms has a Sprout Import integration and supports importing &lt;code&gt;Form&lt;/code&gt; and Form &lt;code&gt;Entry&lt;/code&gt; Elements via the Sprout Import &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/import/element-importers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element Importer API&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the Sprout Forms/Sprout Import integration you could:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a Twig template or script that outputs your Forms (and/or Entries) to a JSON file&lt;/li&gt;&#xA;&lt;li&gt;Create a &lt;a href=&quot;https://docs.craftcms.com/v3/extend/migrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Migration&lt;/a&gt; that grabs that JSON export and hands it off to Sprout Import to import.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This import can be triggered using the Sprout Import service layer or via a &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/import/console-commands.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;console command&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;./craft sprout/import/run --file=&quot;@root/import.json&quot;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More on importing forms using this API: &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/importing-data.html#forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sprout.barrelstrengthdesign.com/docs/forms/importing-data.html#forms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="8814" LastEditDate="2018-12-13T22:47:04.843" LastActivityDate="2018-12-13T22:47:04.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28780" PostTypeId="2" ParentId="28778" CreationDate="2018-12-13T13:53:09.010" Score="1" Body="&lt;p&gt;Have figured out that instead of setting a template path in my product type I can leave that blank and use a custom route instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case I set up a route for &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/type/*/*&lt;/code&gt; -&gt; &lt;code&gt;shop/variant&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means I need to fetch the product entry manually in the template but that's no problem and it seems to be working.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2018-12-13T13:53:09.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28781" PostTypeId="1" AcceptedAnswerId="28782" CreationDate="2018-12-13T18:54:57.057" Score="1" ViewCount="620" Body="&lt;p&gt;I need to create a &lt;strong&gt;features structure section&lt;/strong&gt; for a website that will have parent features and child features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1:&lt;/strong&gt; How do I get different URL Format for parent &amp;amp; child pages?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I need the parent features here: &lt;code&gt;website.com/features/parent-feature&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;And the Child features here &lt;code&gt;website.com/parent-feature/child-feature&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2:&lt;/strong&gt; How do I display the Parent &amp;amp; Child in different templates? I want the parent features to look more dominant than the child features.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-12-13T18:54:57.057" Title="How do I get different URL Format with parent/child structures &amp; how do I display different templates?" Tags="&lt;url&gt;&lt;structure&gt;&lt;sections&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28782" PostTypeId="2" ParentId="28781" CreationDate="2018-12-13T18:54:57.057" Score="3" Body="&lt;p&gt;To get different URL Format for parent &amp;amp; child pages, you need to go to the CP structure settings and edit the &lt;strong&gt;Entry URI Format&lt;/strong&gt;. This is how your URI should look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if level == 1 %}features/{slug}{% else %}{parent.slug}/{slug}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your templating question, if you want a different template for parents and children, you need an if statement in your template file for that structure. So in your CP structure settings, you will have one template file:  &lt;code&gt;features/feature_entry.twig&lt;/code&gt; and inside that file you will have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.children|length %} &#xA;&#xA;   &amp;lt;!-- If it has a child, it's a parent page --&amp;gt;&#xA;   {% include 'features/_parent.twig' %}&#xA;&#xA;{% else %}&amp;lt;!-- it's a child page --&amp;gt;&#xA;&#xA;   {% include 'features/_child.twig' %}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just like that... You now have 2 different templates in 2 different .twig files.&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-12-13T18:54:57.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28783" PostTypeId="1" AcceptedAnswerId="28846" CreationDate="2018-12-13T20:33:14.333" Score="1" ViewCount="428" Body="&lt;p&gt;A bit of a background on the project. I have a features structure section, that has 2 levels: Parent features &amp;amp; Child features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set features = craft.entries.section('features').all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to get an active class on the parent if the parent page is active or if it's got a child that is active and also get an active class on the child if its active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;{% children %}&lt;/code&gt; tag doesn't allow for custom HTML.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking to get something similar to this left navigation. But instead of anchors, each feature will be its own page.&#xA;&lt;a href=&quot;https://craftcms.com/features/all#section-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/features/all#section-types&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6586" LastEditorUserId="6586" LastEditDate="2018-12-13T20:41:22.370" LastActivityDate="2018-12-17T21:43:08.527" Title="How do I create a structure side navigation that will show active parent list-item and active child list-item" Tags="&lt;structure&gt;&lt;navigation&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28784" PostTypeId="1" AcceptedAnswerId="28829" CreationDate="2018-12-13T20:34:38.637" Score="1" ViewCount="87" Body="&lt;p&gt;I am currently in the process of building a commerce 2 site with a very detailed level of nesting in the product options so we're looking to list all variants for a product. (Sounds silly, but it works in this case!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, while trying to use paginate, I'm getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impossible to invoke a method (&quot;limit&quot;) on an array.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate variants.limit(12) as pageInfo, pageEntries %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it even possible to paginate variants?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are getting all the product variants as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variants = product.variants %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But if we use the limit here outside of the pagination, won't that mean we will always get the same first 12 items. Whereas we need to limit it within the paginator so we get the first 12, the next 12 etc etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-12-14T12:31:21.487" LastActivityDate="2018-12-17T03:02:48.400" Title="Possible to paginate product variants in Craft Commerce 2?" Tags="&lt;plugin-craftcommerce&gt;&lt;loop&gt;&lt;plugin-craftcommerce2&gt;&lt;paginate&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28785" PostTypeId="1" AcceptedAnswerId="28787" CreationDate="2018-12-13T20:40:52.887" Score="2" ViewCount="1513" Body="&lt;p&gt;In craft 2 I had a simple plugin that I used to run some php code. I could call the function like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.pluginname.functionname }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I have been unable to do the same thing in craft 3. I have created a new plugin for craft 3. Moved my functions to the main plugin file in src.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a new way to call a function from a plugin in craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Ok got it figured out.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;author below = root plugin path in vendor folder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In main plugin file had to add&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use author\pluginname\variables\variablename;&#xA;use craft\web\twig\variables\CraftVariable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Updated init event to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    CraftVariable::class,&#xA;    CraftVariable::EVENT_INIT,&#xA;    function (Event $event) {&#xA;        /** @var CraftVariable $variable */&#xA;        $variable = $event-&amp;gt;sender;&#xA;        $variable-&amp;gt;set('pluginname', variablename::class);&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Created variables file in variables folder src/variables/variablename.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace author\pluginname\variables;&#xA;use author\pluginname\mainClassName;&#xA;use Craft;&#xA;&#xA;class variablename&#xA;{&#xA;    //Custom Functions Here&#xA;    public function test() {&#xA;        echo 'Test';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then from a template I was able to use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.pluginname.test }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="3579" LastEditDate="2018-12-14T00:38:01.243" LastActivityDate="2018-12-14T00:38:01.243" Title="Call function from plugin in template" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28786" PostTypeId="1" AcceptedAnswerId="28792" CreationDate="2018-12-13T22:14:33.137" Score="1" ViewCount="118" Body="&lt;p&gt;I have a problem with the CkEditor for Craft CMS.&#xA;If I leave the textfield empty and save it, the output in the browser will still contain &lt;code&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/code&gt; when I want it to be blank. I am thinking about to filtering out with javascript, but I hope someone has a better idea about what to do.&lt;/p&gt;&#xA;" OwnerUserId="6532" LastActivityDate="2018-12-17T04:43:28.887" Title="Plugin CKEditor outputs something with nothing?" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;ckeditor5&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28787" PostTypeId="2" ParentId="28785" CreationDate="2018-12-13T22:17:16.790" Score="2" Body="&lt;p&gt;You'll need to register your variable in your plugin's &lt;code&gt;init()&lt;/code&gt; method, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    CraftVariable::class,&#xA;    CraftVariable::EVENT_INIT,&#xA;    function (Event $event) {&#xA;        /** @var CraftVariable $variable */&#xA;        $variable = $event-&amp;gt;sender;&#xA;        $variable-&amp;gt;set('pluginname', PluginVariable::class);&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/extending-twig.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/extending-twig.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="45" LastEditDate="2018-12-13T23:15:49.360" LastActivityDate="2018-12-13T23:15:49.360" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28788" PostTypeId="1" CreationDate="2018-12-13T22:56:38.597" Score="1" ViewCount="140" Body="&lt;p&gt;Really new to this platform and could use some help with how to upload a theme/template which I downloaded from ThemeForest.  The files are compatible with HTML 5 and Craft 3 is on an Ubuntu server.&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="57" LastEditDate="2018-12-15T01:40:11.390" LastActivityDate="2018-12-15T01:40:11.390" Title="How to upload a template in Craft CMS 3 on an Ubuntu web server" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28789" PostTypeId="1" CreationDate="2018-12-13T23:59:42.560" Score="1" ViewCount="177" Body="&lt;p&gt;I have two category groups - brands and resources. Under these I have product videos and documentation entries - section ‘resources’. I’m using the brands categories elsewhere for products too so I’ve taken care to use .section(‘resources').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three templates - a landing page (all good), a category page (all good) which shows the resources categories entries and filtered by the resources categories fine. This is the URL structure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://kelairpumps-craft.local/resources/product-videos&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kelairpumps-craft.local/resources/product-videos&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jGUIp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jGUIp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a further ‘brands’ template which I’m trying to combine the two categories for - URL structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://kelairpumps-craft.local/resources/product-videos/atlas&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://kelairpumps-craft.local/resources/product-videos/atlas&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve succeeded in filtering the entries fine but cant for some reason get the ‘brands’ nav to work properly. Whatever I do it's showing either nothing under brands or all of the brands categories with entries when I need it to show for example product-videos + brand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that it is showing the Corken brand category when the product-videos and a brand category are selected which it shouldn’t because there are no product videos for Corken. I’ve only added Corken under Operating manuals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HFXh4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HFXh4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PGydw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PGydw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/lOUrK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOUrK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I created this route:-&#xA;I’m just not grokking the source/target/element part of the relatedTo equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ‘brands’ template follows which is show for the third segment situation. Please tell me what I’m doing wrong here…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get categories from url segments #}&#xA;{% set resourceSlug = craft.app.request.segment(2) %}&#xA;{% set brandSlug = craft.app.request.segment(3) %}&#xA;&#xA;{# match current categories #}&#xA;{% set currentCategory1 = craft.categories.group('resources').slug(resourceSlug).one() %}&#xA;{% set currentCategory2 = craft.categories.group('brands').slug(brandSlug).one() %}&#xA;&#xA;&#xA;&amp;lt;div class=&quot;body-copy&quot;&amp;gt;&#xA;&#xA;    &amp;lt;header class=&quot;inset&quot;&amp;gt;&#xA;        &amp;lt;h1&amp;gt;{{ currentCategory1 }} - {{ currentCategory2 }}&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;/header&amp;gt;&#xA;&#xA;    {% paginate craft.entries.relatedTo(['and',&#xA;        { targetElement: currentCategory1.id, field: 'resourceCategories' },&#xA;        { targetElement: currentCategory2.id, field: 'brands' }&#xA;    ]).limit('12').orderBy('title') as pageInfo, catentries %}&#xA;&#xA;    &amp;lt;ul class=&quot;hlisting&quot;&amp;gt;&#xA;        {% for entry in catentries %}&#xA;            &amp;lt;li class=&quot;entry clearfix&quot;&amp;gt;&#xA;&#xA;                {% set teaserimage = entry.resourceImage.one() %}&#xA;                {% if teaserimage %}&#xA;                    &amp;lt;div class=&quot;img-container vid-thumb&quot;&amp;gt;&#xA;                        &amp;lt;a class=&quot;image&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;                            &amp;lt;img class=&quot;border&quot; alt=&quot;{{ teaserimage.title }}&quot; srcset=&quot;{{ teaserimage.getUrl('smallListingThumb') }}&quot; src=&quot;&quot;&amp;gt;&#xA;                        &amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {% endif %}&#xA;&#xA;                &amp;lt;h2 class=&quot;&quot;&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/h2&amp;gt;&#xA;&#xA;                {{ entry.resourceSummary }}&#xA;&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% if pageInfo.totalPages &amp;gt; 1 %}&#xA;        {% include '_includes/pagination' %}&#xA;    {% endif %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;&amp;lt;aside class=&quot;secondary-copy&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;gutter&quot;&amp;gt;&#xA;&#xA;        &amp;lt;h2 class=&quot;h4&quot;&amp;gt;&amp;lt;a href=&quot;/resources&quot;&amp;gt;Resources&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&#xA;&#xA;        {# Resource Categories Global Query #}&#xA;        {# Grab all entry ID's from Resources #}&#xA;        {% set entryIds = craft.entries.section('resources').ids() %}&#xA;&#xA;        {# Create a category query with the resources 'group' parameter #}&#xA;        {% set myCategoryQuery = craft.categories().group('resources') %}&#xA;&#xA;        {# match current category for active class #}&#xA;        {% set categorySlug = craft.app.request.segment(2) %}&#xA;        {% set currentCategory = craft.categories.group('resources').slug(categorySlug).one() %}&#xA;&#xA;        {# Fetch the categories - only return categories that have a relationship with one of our entry ids #}&#xA;        {% set categories = myCategoryQuery.relatedTo({ sourceElement: entryIds }).all() %}&#xA;&#xA;        {# Create a category query with the brands 'group' parameter #}&#xA;        {% set myBrandCategoryQuery = craft.categories().group('brands') %}&#xA;&#xA;        {# match current brands category for active class #}&#xA;        {% set brandsCategorySlug = craft.app.request.segment(3) %}&#xA;        {% set currentBrandCategory = craft.categories.group('brands').slug(brandsCategorySlug).one() %}&#xA;&#xA;        {# Fetch the categories - only return categories that have a relationship with one of our entry ids #}&#xA;        {% set brandCategories = myBrandCategoryQuery.relatedTo({ sourceElement: entryIds }).all() %}&#xA;&#xA;        {# Display the navigation #}&#xA;        &amp;lt;ul class=&quot;section_nav&quot;&amp;gt;&#xA;            {% nav category in categories %}&#xA;                {% set activeClass = category.id == currentCategory.id ? 'selected' %}&#xA;                &amp;lt;li{% if activeClass %} class=&quot;{{ activeClass }}&quot;{% endif %}&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ category.url }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;        {# Display the brand navigation #}&#xA;        &amp;lt;h2 class=&quot;h4&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;/brands&quot;&amp;gt;By Brand&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/h2&amp;gt;&#xA;&#xA;        &amp;lt;ul class=&quot;section_nav&quot;&amp;gt;&#xA;            {% nav category in brandCategories %}&#xA;                {% set activeClass = category.id == currentBrandCategory.id ? 'selected' %}&#xA;                &amp;lt;li{% if activeClass %} class=&quot;{{ activeClass }}&quot;{% endif %}&amp;gt;&#xA;                    &amp;lt;a href=&quot;{{ siteUrl ~ 'resources/'  ~ categorySlug ~ '/' ~ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/a&amp;gt;&#xA;                &amp;lt;/li&amp;gt;&#xA;            {% endnav %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/aside&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6748" LastEditorUserId="5275" LastEditDate="2018-12-14T11:49:56.673" LastActivityDate="2018-12-14T11:49:56.673" Title="Combining multiple categories based on URL segments" Tags="&lt;categories&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28790" PostTypeId="2" ParentId="28784" CreationDate="2018-12-14T02:37:14.537" Score="1" Body="&lt;p&gt;I'm interested how you are calling &lt;code&gt;variants&lt;/code&gt; - have you tried using &lt;code&gt;craft.variants.limit(12)&lt;/code&gt; versus &lt;code&gt;variants.limit(12)&lt;/code&gt;? &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/dev/element-queries/variant-queries.html#example&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Docs - sample variant query&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/781/paginate-an-array-of-entries&quot;&gt;Here&lt;/a&gt; is another example where Brad shares insights on paginating after using the search service.&lt;/p&gt;&#xA;" OwnerUserId="8045" LastEditorUserId="8045" LastEditDate="2018-12-14T02:54:38.507" LastActivityDate="2018-12-14T02:54:38.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28791" PostTypeId="1" AcceptedAnswerId="28812" CreationDate="2018-12-14T02:50:01.533" Score="1" ViewCount="153" Body="&lt;p&gt;I recently saw a very helpful post about how to connect to an external database from a Craft plugin and I wanted to confirm I understood the implementation correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;a href=&quot;https://craftcms.stackexchange.com/a/8977/712&quot;&gt;this response&lt;/a&gt; the author recommended a way to leverage Yii's Query Builder on external databases. Is the following snippet the way to properly implement this in a service? Do I need to manually &quot;close&quot; this connection or is this alone the way to implement this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;// Connect to an external database&#xA;$db = Craft::createComponent([&#xA;    'emulatePrepare'    =&amp;gt; true,&#xA;    'charset'           =&amp;gt; 'utf8',&#xA;    'class'             =&amp;gt; 'Craft\DbConnection',&#xA;    'autoConnect'       =&amp;gt; true,&#xA;]);&#xA;&#xA;$db-&amp;gt;connectionString = 'mysql:host=localhost;dbname=MY_DB;port=3306';&#xA;$db-&amp;gt;username = 'UN';&#xA;$db-&amp;gt;password = 'PW';&#xA;&#xA;// Use Query Builder to fetch data from the database&#xA;$data = $db-&amp;gt;createCommand()&#xA;    -&amp;gt;select(&quot;*&quot;)&#xA;    -&amp;gt;from(&quot;TBL&quot;)&#xA;    -&amp;gt;queryAll();&#xA;&#xA;// Pass along the data to be used in a template via variables&#xA;return $data;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="712" LastActivityDate="2018-12-15T01:48:57.860" Title="Connect to an external database from a Craft 2.x plugin" Tags="&lt;plugin-development&gt;&lt;database&gt;&lt;query&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28792" PostTypeId="2" ParentId="28786" CreationDate="2018-12-14T03:38:09.997" Score="1" Body="&lt;p&gt;This has been fixed in the master branch, but not yet tagged in a release: &lt;a href=&quot;https://github.com/craftcms/ckeditor/pull/6&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/ckeditor/pull/6&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until it's tagged, you won't be able to get that fix in from the Plugin Store, but you can pull it in with Composer in the command line if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, it's currently a pretty minimal beta version of the plugin using an older dev preview version of CKEditor 5, so I wouldn't rely on it too heavily until it gets updated.&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2018-12-17T04:43:28.887" LastActivityDate="2018-12-17T04:43:28.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28793" PostTypeId="2" ParentId="28775" CreationDate="2018-12-14T07:20:04.767" Score="2" Body="&lt;p&gt;Craft &lt;a href=&quot;https://github.com/craftcms/cms/issues/3553&quot; rel=&quot;nofollow noreferrer&quot;&gt;doesn't store information&lt;/a&gt; about the uploader for assets, so, if you want to make sure each user only sees their own respective assets, you could use &lt;a href=&quot;https://docs.craftcms.com/v3/assets-fields.html#dynamic-subfolder-paths&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic subfolder paths&lt;/a&gt; and account for that when listing the available assets for that user. For example, you could use a dynamic path &lt;code&gt;user-uploads/{{currentUser.id}}&lt;/code&gt;. Later, when querying for the assets, you could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set folder = craft.app.assets.findFolder({path: 'user-uploads/' ~ currentUser.id}) %}&#xA;{% set assets = craft.assets.folderId(folder.id).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach to take when separating downloads into folders by users is making use of temporary upload folders, which are separate for each user. You can do that by calling &lt;code&gt;{% set folder = craft.app.assets.getCurrentUserTemporaryUploadFolder() %}&lt;/code&gt;, which will set the &lt;code&gt;folder&lt;/code&gt; variable to an instance of &lt;code&gt;craft\models\VolumeFolder&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use that as a starting point to build your own simple asset browser and then for saving asset relation data to any relations field (Assets, Entries, Users..) you just save the entry and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18485/how-do-i-allow-a-user-to-remove-an-uploaded-asset-from-a-front-end-entry-form&quot;&gt;submit a list&lt;/a&gt; of ids that you want. &lt;/p&gt;&#xA;" OwnerUserId="258" LastEditorUserId="258" LastEditDate="2018-12-17T14:07:00.590" LastActivityDate="2018-12-17T14:07:00.590" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28794" PostTypeId="1" AcceptedAnswerId="28796" CreationDate="2018-12-14T08:08:43.350" Score="1" ViewCount="1289" Body="&lt;p&gt;Is it possible to redirect the user to a specific page after they successfully complete the front-end registration form (before activation)? I've tried adding:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;registration-successful&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it currently just redirects back to the home page. I really need to redirect the user to a page that prompts them to check their email for the activation link. It currently feels a bit broken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9087" LastActivityDate="2021-01-04T07:10:08.043" Title="Craft 3 Registration Form Success Redirect" Tags="&lt;form&gt;&lt;redirect&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28796" PostTypeId="2" ParentId="28794" CreationDate="2018-12-14T10:15:36.123" Score="2" Body="&lt;p&gt;The URL needs to be hashed. Try using &lt;code&gt;{{ redirectInput('registration-successful') }}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;As documented here: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8431" LastEditorUserId="-1" LastEditDate="2020-10-08T05:08:42.430" LastActivityDate="2020-10-08T05:08:42.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28797" PostTypeId="1" AcceptedAnswerId="28802" CreationDate="2018-12-14T11:42:53.937" Score="1" ViewCount="199" Body="&lt;p&gt;So I've got a multisite going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most of the sites, most of the time, they'll be using the same templates. But I want a good way to handle siteX needing one template to be different from the other sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when going to siteX.com/news, I'd like for the template served to be siteX/news.html if it exists, otherwise default/news.html.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could change the template path in the DB, but I'd rather keep it in the code for development/deployment simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I could could create custom routes, but I'd rather not create a route for &lt;em&gt;every&lt;/em&gt; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I'm doing this by creating a root/news.html file, which just says&#xA;&lt;code&gt;&#xA;{% include [currentSite.handle ~ '/news', 'default/news'] %}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it'd be nice to not have to do this for every template I create. It also seems inefficient to do this on a template level (though I don't actually &lt;em&gt;know&lt;/em&gt; this to be true).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;(How) can I overwrite Craft's template resolver to do what I want?&lt;/li&gt;&#xA;&lt;li&gt;Is this the best way to go about this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2018-12-14T15:46:00.563" Title="Good way to handle multisite fallback templates" Tags="&lt;craft3&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28798" PostTypeId="2" ParentId="28537" CreationDate="2018-12-14T12:32:50.900" Score="1" Body="&lt;p&gt;This issue was due to the version of the custom plugin I installed on project setup was broken. Since then, it's been updated and fixed so when I removed my vendors directory and installed all the packages, this issue appears to have been resolved.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-14T12:32:50.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28799" PostTypeId="1" AcceptedAnswerId="28800" CreationDate="2018-12-14T13:54:52.687" Score="1" ViewCount="179" Body="&lt;p&gt;I have been unable to locate anything in the docs or any questions on here regarding how to print the dimensions associated with a variant in the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I have managed to find is how to print the dimension unit using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dimensionUnits = craft.commerce.settings.dimensionUnits %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-14T14:25:06.350" Title="Accessing Commerce product variant dimensions in the template" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;&lt;variants&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28800" PostTypeId="2" ParentId="28799" CreationDate="2018-12-14T14:25:06.350" Score="3" Body="&lt;p&gt;Dimensions are set and accessed individually:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set variant = product.defaultVariant %}&#xA;&#xA;{{ variant.width }}&#xA;{{ variant.height }}&#xA;{{ variant.length }}&#xA;{{ variant.weight }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-14T14:25:06.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28801" PostTypeId="2" ParentId="28783" CreationDate="2018-12-14T15:41:00.790" Score="0" Body="&lt;p&gt;There is a plugin that might be doing what you are looking for. You start with building your navigation and put that into a variable. Then you run this through a TwigExtension provided by the plugin &quot;k4navigationCraft3&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set mainnavigation %}&#xA;    {% cache globally using key &quot;main-navigation&quot; %}&#xA;    {% set entries = craft.entries.section('features').all() %}&#xA;&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% nav entry in entries %}&#xA;            &amp;lt;li&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;                {% ifchildren %}&#xA;                    &amp;lt;ul&amp;gt;&#xA;                        {% children %}&#xA;                    &amp;lt;/ul&amp;gt;&#xA;                {% endifchildren %}&#xA;            &amp;lt;/li&amp;gt;&#xA;        {% endnav %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;    {% endcache %}&#xA;{% endset %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can use one of the plugins TwigExtensions to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ mainnavigation | k4NavigationGetActivePath(url(craft.app.request.pathInfo)) | raw }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin is named &quot;k4navigationCraft3&quot; and can be found on &lt;a href=&quot;https://bitbucket.org/kreisvierdigital/k4navigationcraft3/src/master/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bitbucket&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7751" LastActivityDate="2018-12-14T15:41:00.790" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28802" PostTypeId="2" ParentId="28797" CreationDate="2018-12-14T15:46:00.563" Score="3" Body="&lt;p&gt;You can create localized template files by placing them in a subfolder of templates/ named after the site handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://docs.craftcms.com/v3/dev/#template-localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/#template-localization&lt;/a&gt; for a full explanation.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2018-12-14T15:46:00.563" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28803" PostTypeId="1" CreationDate="2018-12-14T15:48:41.920" Score="1" ViewCount="44" Body="&lt;p&gt;Is there any barrier to using AuthorizeNet CIM gateway in Commerce 1? The vendor/omnipay/authorizenet folder has a CIMGateway class but there doesn't appear to be a corresponding AuthorizeNet_CIM_GatewayAdapter. I'm wondering why it's not supported by default, and how difficult it would be to implement it for a client.&lt;/p&gt;&#xA;" OwnerUserId="8792" LastActivityDate="2018-12-14T21:19:52.160" Title="AuthorizeNet CIM gateway in Commerce 1" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28805" PostTypeId="2" ParentId="28788" CreationDate="2018-12-14T16:07:33.353" Score="1" Body="&lt;p&gt;The answer will depend on the extent of your web development skills.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have access to the web server via FTP?&#xA;If so, upload the template files to the templates folder where you installed craft. The templates will have to be edited to bring in your sections, entries, and content that you add in the Craft dashboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out these docs to learning templating and converting templates to twig/Craft templates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-14T16:07:33.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28806" PostTypeId="2" ParentId="28788" CreationDate="2018-12-14T16:22:16.100" Score="1" Body="&lt;p&gt;Do you have shell access (like SSH)? On an Ubuntu Server (and others), you typically have the following path to the html documents:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/var/www/html/&amp;lt;yourwebsite-folder&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As Indigo Viking stated correctly, the details on how to do this vary based on your setup, i.e. your server setup, your virtual host setup on the server and your craft installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Craft 3, there is a &quot;templates&quot; folder inside the &quot;craft&quot; folder where you could put your template. But in order to dynamically display content from the cms, you need to setup Craft in the Controlpanel with fields and sections and add Twig code to the template pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checkout out this excellent (and free after registration) course on getting to know Craft CMS: &lt;a href=&quot;https://craftquest.io/courses/craft-cms-3-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftquest.io/courses/craft-cms-3-tutorials&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7751" LastActivityDate="2018-12-14T16:22:16.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28808" PostTypeId="2" ParentId="28803" CreationDate="2018-12-14T21:19:52.160" Score="1" Body="&lt;p&gt;This Authorize.Net Accept.js gateway for Craft Commerce might be a good place to start: &lt;a href=&quot;https://github.com/marionnewlevant/craft-acceptjs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marionnewlevant/craft-acceptjs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="130" LastActivityDate="2018-12-14T21:19:52.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28809" PostTypeId="1" CreationDate="2018-12-14T21:46:01.613" Score="1" ViewCount="31" Body="&lt;p&gt;I'm trying to get the next field in an entry if a passwordRequired Lightswitch Field is switched off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about that?&lt;/p&gt;&#xA;" OwnerUserId="3468" LastActivityDate="2019-05-17T16:03:25.777" Title="Next in structure if lightswitch field off?" Tags="&lt;previous-next&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28810" PostTypeId="1" CreationDate="2018-12-14T21:56:51.873" Score="1" ViewCount="173" Body="&lt;p&gt;I am moving our current site to a subdomain and get this: &quot;Craft CMS requires the PHP multibyte string extension in order to run.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have updated the &lt;code&gt;$craftPath&lt;/code&gt; variable and &lt;code&gt;System-&amp;gt;General-&amp;gt;SiteUrl&lt;/code&gt; CP setting to the updated URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="9158" LastEditorUserId="57" LastEditDate="2018-12-15T02:05:39.867" LastActivityDate="2021-05-03T08:13:21.290" Title="Moving site to subdomain" Tags="&lt;siteurl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28811" PostTypeId="1" CreationDate="2018-12-14T23:00:20.763" Score="2" ViewCount="32" Body="&lt;p&gt;I currently have an asset upload field, but I'm trying to make it call errors back if the image isn't an extension that's set within the field, allowing users to understand why the form didn't save.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% macro errorList(errors) %}&#xA;        {% if errors %}&#xA;            &amp;lt;ul class=&quot;errors&quot;&amp;gt;&#xA;                {% for error in errors %}&#xA;                    &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;    {% endmacro %}&#xA;&#xA;    {% from _self import errorList %}&#xA;&#xA;&#xA;        &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;          &amp;lt;label&amp;gt;Featured Image&amp;lt;/label&amp;gt;&#xA;          &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;custom-file&quot;&amp;gt;&#xA;              &amp;lt;input id=&quot;inputGroupFile01&quot; type=&quot;file&quot; class=&quot;custom-file-input&quot; name=&quot;fields[networkImage]&quot;&amp;gt;&#xA;              &amp;lt;label class=&quot;custom-file-label&quot; for=&quot;inputGroupFile01&quot;&amp;gt;Choose file&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;          &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find any documentation on error calling for this certain scenario? Or a catch-all error for the form field would be great!&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-14T23:00:20.763" Title="Asset Upload Form Field Error States" Tags="&lt;templating&gt;&lt;form&gt;&lt;error-message&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28812" PostTypeId="2" ParentId="28791" CreationDate="2018-12-15T01:48:57.860" Score="1" Body="&lt;p&gt;If only the service will be connecting to it and only one method, then your example works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If only the service will be connecting to, but you use it across multiple methods, then you might want to move the bootstrapping part to the service &lt;code&gt;init()&lt;/code&gt; method and save the database connection as a private instance variable in the service so everything in the service can access it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do I need to manually &quot;close&quot; this connection&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I wouldn't worry about it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-15T01:48:57.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28813" PostTypeId="2" ParentId="28810" CreationDate="2018-12-15T02:09:26.067" Score="0" Body="&lt;p&gt;I'm guessing the site you're setting up on the subdomain is on a new server?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Craft CMS requires the PHP multibyte string extension in order to run.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That error means that the PHP &lt;a href=&quot;https://secure.php.net/manual/en/book.mbstring.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;multibyte extension&lt;/a&gt; isn't installed or enabled on your server and both Craft 2 and Craft 3 require it. &lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-15T02:09:26.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28814" PostTypeId="2" ParentId="28743" CreationDate="2018-12-15T02:21:10.613" Score="2" Body="&lt;pre&gt;&lt;code&gt;$view-&amp;gt;hook('cp.entries.edit.details', functionThatReturnsView())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the correct way in Craft 3.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-15T02:21:10.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28815" PostTypeId="2" ParentId="28605" CreationDate="2018-12-15T14:25:48.550" Score="4" Body="&lt;p&gt;Andrea's question is definitely the best way to solve this. However, if you did not want to use Vue in your project, here's how you would solve this in plain JS:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Add an &lt;code&gt;id&lt;/code&gt; to your form and to your hidden action input:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form id=&quot;myForm&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input id=&quot;formAction&quot; type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;{{ entry.id }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;        &amp;lt;label&amp;gt;Listing Title&amp;lt;/label&amp;gt;&#xA;        &amp;lt;input type=&quot;text&quot; name=&quot;title&quot; class=&quot;form-control&quot; value=&quot;{{ entry.title }}&quot;&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Include two buttons with &lt;code&gt;onclick&lt;/code&gt; attributes:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;button value=&quot;save&quot; onclick=&quot;submitForm('entries/save-entry')&quot;&amp;gt;Save&amp;lt;/button&amp;gt;&#xA;&amp;lt;button value=&quot;delete&quot; onclick=&quot;submitForm('entries/delete-entry')&quot;&amp;gt;Delete&amp;lt;/button&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add this script tag to handle the form action swapping:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;    function submitForm(action) {&#xA;        document.getElementById('formAction').value = action;&#xA;        document.getElementById('myForm').submit();&#xA;    }&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-15T14:25:48.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28816" PostTypeId="1" AcceptedAnswerId="28817" CreationDate="2018-12-15T15:02:43.657" Score="0" ViewCount="114" Body="&lt;p&gt;I want to expand functionality of &lt;a href=&quot;https://github.com/ohlincik/craft-perform&quot; rel=&quot;nofollow noreferrer&quot;&gt;perform plugin&lt;/a&gt; with generating pdf from message submission data and attaching it to email this plugin sends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't use events for this, because this plugin doesnt emit any. Can i somehow overwrite specific method in craft cms plugin, without resorting do directly changing code in &lt;code&gt;vendor&lt;/code&gt; directory?&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2018-12-15T20:57:12.783" Title="Overwriting specific method in plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28817" PostTypeId="2" ParentId="28816" CreationDate="2018-12-15T20:57:12.783" Score="3" Body="&lt;p&gt;If the methods you need to alter are part of an auto-instantiated Service in the PerForm plugin, you might consider using Yii 2 “Behaviors.”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;…to attach a behavior dynamically, call the &lt;code&gt;yii\base\Component::attachBehavior()&lt;/code&gt; method of the component to which the behavior is being attached…&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-behaviors#attaching-behaviors&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, in a custom Craft module, you might put something like this, in your &lt;code&gt;init&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use perfectus\perform\PerForm;&#xA;use modules\mymodule\MyBehavior;&#xA;&#xA;// ...&#xA;&#xA;PerForm::$plugin-&amp;gt;emailService-&amp;gt;attachBehavior('myBehaviorHandle', new MyBehavior);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives you a chance to &lt;a href=&quot;https://en.wikipedia.org/wiki/Monkey_patch&quot; rel=&quot;nofollow noreferrer&quot;&gt;monkey-patch&lt;/a&gt; the service with your own functionality… but I can't speak to how inheritance works, or whether you'll be able to call &lt;code&gt;parent::myPatchedMethod($args)&lt;/code&gt; (or, in Behavior-land, &lt;code&gt;$this-&amp;gt;owner-&amp;gt;myPatchedMethod($args)&lt;/code&gt;) to ensure the least code is duplicated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Overall, I agree with Indigo: The best way to ensure this will continue to work is to make a PR to the plugin that adds support for events at key moments, and shuttles the right kind of data around to accomplish what you want. This is the only way to ensure you have a stable event API.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2018-12-15T20:57:12.783" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28818" PostTypeId="1" CreationDate="2018-12-16T00:39:36.427" Score="1" ViewCount="33" Body="&lt;p&gt;I'm processing some feeds using &lt;code&gt;craft.app.feeds.getFeedItems()&lt;/code&gt; and it works if I pass the limit as a hard coded number like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.app.feeds.getFeedItems(entry.rssURL, '5') %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for item in items %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ item.permalink }}&quot;&amp;gt;{{ item.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However if I change &lt;code&gt;'5'&lt;/code&gt; to a field handle I get errors. where &lt;code&gt;entry.feedLimit&lt;/code&gt; is a number such as 3 or 5&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set items = craft.app.feeds.getFeedItems(entry.rssURL, entry.feedLimit) %}&#xA;&amp;lt;ul&amp;gt;&#xA;    {% for item in items %}&#xA;      &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ item.permalink }}&quot;&amp;gt;{{ item.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %} &#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The errors I get is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;TypeError Argument 2 passed to craft\feeds\Feeds::getFeedItems() must&#xA;  be of the type integer or null, object given, called in&#xA;  /path/to/vendor/twig/twig/lib/Twig/Extension/Core.php&#xA;  on line 1619&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This code was previously working on Craft 2, but after the update it is now broken. I've temporarily hard coded the limit in, but that's not ideal.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-12-16T01:14:25.067" Title="Erros when using Entry Variable in craft.app.feeds.getFeedItems" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;error&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28819" PostTypeId="2" ParentId="28818" CreationDate="2018-12-16T01:14:25.067" Score="1" Body="&lt;p&gt;Solution is simple, the field type is a select so I need to change &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.feedLimit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;entry.feedLimit.value&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then it works&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-12-16T01:14:25.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28820" PostTypeId="1" CreationDate="2018-12-16T12:59:35.550" Score="1" ViewCount="151" Body="&lt;p&gt;I've got a very special case in a big offline installation .&#xA;For strange technical and administrative reasons, I must have 5 different Craft instances each one in it's own server (on the local network) , but all Crafts should look and act as one.&#xA;That is: for the client there is only 1 CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the access to be centralized through a single index.php displaying a menu with all the applications.&#xA;When the client click one app, he should be redirected to the Craft CP instance ( on its own server) where that App is located. So:&#xA;App1 links to &lt;a href=&quot;http://192.168.1.20/app1/admin/entries/app1&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://192.168.1.20/app1/admin/entries/app1&lt;/a&gt;&#xA;App2 links to &lt;a href=&quot;http://192.168.1.32/app2/admin/entries/app2&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://192.168.1.32/app2/admin/entries/app2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the number of Crafts and servers should be invisible to client.&#xA;He only cliks an app and he go to edit that App.&#xA;He don't mind if it is on a server or on another....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the problems I'm facing is CP login.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 1st time the client wants to edit App1 (located on server A) has to login (on Craft's A Control Panel ) .&#xA;But if he wants to edit App2 (located on server B) has to login (on Craft's B Control Panel ) .&#xA;But I don't want he to login twice. This should be transparent...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to create a login form at index for he to login once.&#xA;Then I'd like to send login creadentials via AJAX to every Craft instance to be pre-logged.&#xA;Then, if client access that server, Craft will not request to login again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&#xA;How can I send user &amp;amp; pass credentials to Craft to be pre-logged in a hidden way ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another &quot;solution&quot; could be remove CP login.&#xA;As this case is an offline installation (with no connection outside), and there's only 1 user profile, looks to me that there's no need for login. &#xA;How could I remove it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advanced&lt;/p&gt;&#xA;" OwnerUserId="9161" LastActivityDate="2018-12-16T14:09:17.950" Title="Bypass CP login" Tags="&lt;control-panel&gt;&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28821" PostTypeId="1" CreationDate="2018-12-16T13:35:05.863" Score="0" ViewCount="39" Body="&lt;p&gt;I have links on a partial within my templates, but it seems to be trying to load a template when it should just be loading the outbound href of the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag. I don't have a clue why this would be happening?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% if user.userWebsite %}&#xA;  &amp;lt;li class=&quot;list-inline-item m-1&quot;&amp;gt;&#xA;    &amp;lt;a class=&quot;btn btn-light&quot; href=&quot;{{ user.userWebsite }}&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;i class='bx bx-rss bx-tiny'&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&#xA;  &amp;lt;/li&amp;gt;&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will link out to &lt;code&gt;mysite.com/profile/pinterest.com/username&lt;/code&gt; when really it should be going to &lt;code&gt;pinterest.com/username&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas to why?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2018-12-18T13:53:04.313" Title="Partial links not going outbound" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28822" PostTypeId="2" ParentId="28820" CreationDate="2018-12-16T14:09:17.950" Score="1" Body="&lt;p&gt;For your second &quot;solution&quot;, try the Auto Login plugin, which lets you whitelist an IP address or username(s)&#xA;&lt;a href=&quot;https://github.com/sjelfull/craft3-autologin&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/sjelfull/craft3-autologin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-12-16T14:09:17.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28823" PostTypeId="1" AcceptedAnswerId="28824" CreationDate="2018-12-16T15:46:15.890" Score="5" ViewCount="2186" Body="&lt;p&gt;I cannot find a way to render templates from a plugin controller in Craft 3. I feel as though I've tried every variation advised online but for some reason this still isn't working.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace abc\members\controllers;&#xA;&#xA;class LoginController extends \craft\web\Controller&#xA;{&#xA;    public function actionForm()&#xA;    {&#xA;        $this-&amp;gt;renderTemplate('abc-members/login.html');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plugin handle is &quot;abc-members&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin has a &quot;templates&quot; directory with &quot;login.html&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following, with and without the .html extension, but none can find the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;renderTemplate('abc-members/login.html');&#xA;$this-&amp;gt;renderTemplate('abc-members/templates/login.html');&#xA;$this-&amp;gt;renderTemplate('abc-members/src/templates/login.html');&#xA;$this-&amp;gt;renderTemplate('abc/members/src/templates/login.html');&#xA;$this-&amp;gt;renderTemplate('plugins/abc/members/src/templates/login.html');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following works fine but then I cannot include templates from the installation's main template directory.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace abc\members\controllers;&#xA;&#xA;class LoginController extends \craft\web\Controller&#xA;{&#xA;    public function actionForm()&#xA;    {&#xA;        \Craft::$app-&amp;gt;view-&amp;gt;setTemplatesPath(__DIR__ . '/../templates');&#xA;        $this-&amp;gt;renderTemplate('login.html');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions as to where I'm going wrong? I find the Craft 3 docs are a bit lacking in the whole area of plugin controllers, routing and templates other than in the Craft 2 =&gt; Craft 3 upgrade guide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9162" LastActivityDate="2018-12-19T13:41:33.427" Title="How to render plugin templates in Craft CMS 3?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;controller&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28824" PostTypeId="2" ParentId="28823" CreationDate="2018-12-16T16:31:53.087" Score="6" Body="&lt;p&gt;You don't specify, but it sounds like you're trying to have the plugin render its templates as a result of frontend requests? If so, you'd need to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Craft;&#xA;use craft\web\View;&#xA;&#xA;$oldMode = \Craft::$app-&amp;gt;view-&amp;gt;getTemplateMode();&#xA;Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_CP);&#xA;$html = \Craft::$app-&amp;gt;view-&amp;gt;renderTemplate('plugin-handle/path/to/template');&#xA;Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode($oldMode);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're trying to mix and match between the normal Craft templates directory and your plugin's templates, you'd need to change the template mode as you bounce back and forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-16T16:31:53.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28825" PostTypeId="1" CreationDate="2018-12-16T21:37:58.573" Score="0" ViewCount="151" Body="&lt;p&gt;Our developer has disappeared and we need some help in changing and adding a few things on our website (www.fincarosablanca.com)? Would like to have somebody in Costa Rica but it doesn't really matter.&lt;/p&gt;&#xA;" OwnerUserId="7075" LastActivityDate="2018-12-17T04:39:49.160" Title="Need somebody to help us with our existing Craft web page" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-12-17T06:23:04.203" ContentLicense="CC BY-SA 4.0" />
  <row Id="28826" PostTypeId="1" AcceptedAnswerId="28837" CreationDate="2018-12-16T22:14:19.493" Score="2" ViewCount="266" Body="&lt;p&gt;I have a layout template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bodyClass = [] %}&#xA;&#xA;&amp;lt;body class=&quot;{% for class in bodyClass %}{{ class }} {% endfor %}&quot;&amp;gt;&#xA;    {{ block('pageBody') }}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a template that extends it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout' %}&#xA;&#xA;{% set bodyClass = bodyClass|merge(['myclass']) %}&#xA;&#xA;{% block pageBody %}&#xA;    &amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, consequuntur!&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to append to the &lt;code&gt;bodyClass&lt;/code&gt; variable I get the error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;bodyClass&quot; does not exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However if I call the variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for class in bodyClass %}&#xA;  {{ class  }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The template renders fine. Why can't I merge onto a variable that's been set in an extended template? Is there another way to do this?&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-06T02:34:37.973" Title="Updating Array Variable In Extending Template" Tags="&lt;templating&gt;&lt;variable&gt;&lt;array&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28828" PostTypeId="2" ParentId="25542" CreationDate="2018-12-17T02:44:49.483" Score="0" Body="&lt;p&gt;I had the same problems after installing Craft CMS 3. I have been able to resolve it by adding write permissions to all directories in the storage directory. Just issue &lt;code&gt;sudo chmod 777 -R storage&lt;/code&gt;. &#xA;Then I could login to the admin page. &lt;/p&gt;&#xA;" OwnerUserId="9165" LastEditorUserId="960" LastEditDate="2018-12-17T11:08:55.670" LastActivityDate="2018-12-17T11:08:55.670" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28829" PostTypeId="2" ParentId="28784" CreationDate="2018-12-17T03:02:48.400" Score="3" Body="&lt;p&gt;&lt;code&gt;product.variants&lt;/code&gt; returns the variants for the product as an array only. It is not like a element relationship field which returns an element query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use a element query of variants for a particular product you can do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.variants.product(product).all&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-12-17T03:02:48.400" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28830" PostTypeId="2" ParentId="28825" CreationDate="2018-12-17T04:39:49.160" Score="6" Body="&lt;p&gt;Sorry to hear about your disappearing developer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack Exchange as a Q&amp;amp;A site usually isn't the best place to find a developer, unless you'd like to post to Stack Overflow Jobs (&lt;a href=&quot;https://stackoverflow.com/jobs&quot;&gt;https://stackoverflow.com/jobs&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Craft specific developers, there are a couple of places you could look:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/partners&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/partners&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.workwithcraft.com/&quot; rel=&quot;noreferrer&quot;&gt;https://www.workwithcraft.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/jobs&quot; rel=&quot;noreferrer&quot;&gt;https://straightupcraft.com/jobs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Craft Slack #jobs channel: &lt;a href=&quot;https://craftcms.com/community#slack&quot; rel=&quot;noreferrer&quot;&gt;https://craftcms.com/community#slack&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-17T04:39:49.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28831" PostTypeId="1" AcceptedAnswerId="28836" CreationDate="2018-12-17T12:13:30.793" Score="1" ViewCount="346" Body="&lt;p&gt;I have written a plugin that works fine, it has a subnav which i build like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getCpNavItem()&#xA;  {&#xA;    $item = parent::getCpNavItem();&#xA;    $item['subnav'] = [&#xA;      'moderateentries' =&amp;gt; ['label' =&amp;gt; 'Moderate Entries', 'url' =&amp;gt; 'entry-moderator'],&#xA;      'notificationmessages' =&amp;gt; ['label' =&amp;gt; 'Messages', 'url' =&amp;gt; 'entry-moderator/notificationmessages'],&#xA;      'log' =&amp;gt; ['label' =&amp;gt; 'Log', 'url' =&amp;gt; 'entry-moderator/log'],&#xA;    ];&#xA;    return $item;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Problem i am having is that i cannot get the left hand nav item to display as active, the only one that has the &lt;code&gt;sel&lt;/code&gt; class applied is 'moderateentries', if i click on the second or third nav item, the first one is the one that is displayed as active with the &lt;code&gt;sel&lt;/code&gt; css class. where am i going wrong?&lt;/p&gt;&#xA;" OwnerUserId="4936" LastEditorUserId="4936" LastEditDate="2018-12-17T17:58:48.453" LastActivityDate="2018-12-17T18:13:39.883" Title="Setting plugin subnav to active" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;navigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28832" PostTypeId="1" CreationDate="2018-12-17T12:14:53.010" Score="0" ViewCount="41" Body="&lt;p&gt;I am running Craft 2 CMS for one website. Its in Norwegian for our client.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its about SKI School. Where Parents reserves sport dates for there children. In database there are parents profile with there children information, date of birth and names in craft_content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to have on website dropdown, when parents login and go to sport dates, they can choose there children, instead of writing it, they choose also dates when there children participate, and price is multiple for chosen dates, on end they see total for payment, they can reserve, and pay later/or at once?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there solution for it. I have twig file for templates.&lt;/p&gt;&#xA;" OwnerUserId="9025" LastEditorUserId="9025" LastEditDate="2019-01-29T12:56:16.357" LastActivityDate="2019-01-29T12:56:16.357" Title="Craft 2, child dropdown, database" Tags="&lt;children&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28833" PostTypeId="1" CreationDate="2018-12-17T12:57:49.477" Score="1" ViewCount="156" Body="&lt;p&gt;Is there any way or plugin to implement Cloudways CDN with Craft? &lt;/p&gt;&#xA;" OwnerUserId="613" LastActivityDate="2019-05-17T17:02:30.453" Title="Implement Cloudways CDN with Craft" Tags="&lt;plugins&gt;&lt;cdn&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28834" PostTypeId="2" ParentId="12084" CreationDate="2018-12-17T14:00:15.643" Score="2" Body="&lt;p&gt;If you're using MAMP, it will constantly complain about existence of a &quot;&lt;em&gt;global&lt;/em&gt;&quot; &lt;strong&gt;my.cnf&lt;/strong&gt; file.&lt;br&gt;&#xA;So, you need to update MySQL config template file inside your MAMP application.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start MAMP&lt;/li&gt;&#xA;&lt;li&gt;Go &lt;em&gt;File&lt;/em&gt; &gt; &lt;em&gt;Edit Template&lt;/em&gt; &gt; &lt;em&gt;MySQL (my.cnf)&lt;/em&gt; &gt; &quot;&lt;em&gt;choose whatever version you're using&lt;/em&gt;&quot;&lt;/li&gt;&#xA;&lt;li&gt;Dump these two lines in the end of the opened file:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[mysqld]&#xA;  sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="6956" LastActivityDate="2018-12-17T14:00:15.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28835" PostTypeId="1" AcceptedAnswerId="28838" CreationDate="2018-12-17T14:16:40.150" Score="3" ViewCount="109" Body="&lt;p&gt;I'm keen to set my image variants dynamically from content editor and not quite sure how I do this in twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three variants. They are named &lt;code&gt;imageVariantsThumb&lt;/code&gt;, &lt;code&gt;imageVariants16by9&lt;/code&gt;, and &lt;code&gt;imageVariants3by2&lt;/code&gt; in craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To render the variant on the image I use the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set optimizedImages = item.itemImage.one().imageVariantsThumb %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on the dropdown selected in the editor (say the values are &lt;code&gt;thumb&lt;/code&gt;, &lt;code&gt;16by9&lt;/code&gt; and &lt;code&gt;3by2&lt;/code&gt;) I want to change the variant name in this line of code. How do I use the value from my drop-down field to change the variant name on the end of the code above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried defining a variable using the value and replacing &lt;code&gt;imageVariantsThumb&lt;/code&gt; above but it doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.listImageRatio == '16by9' %}&#xA;  {% set imageRatio = 'imageVariants16by9' %}&#xA;{% endif %}&#xA;&#xA;{% set optimizedImages = item.itemImage.one().imageRatio %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5275" LastEditDate="2018-12-18T22:38:38.413" LastActivityDate="2018-12-18T22:38:38.413" Title="Dynamic Image Variant in Template" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28836" PostTypeId="2" ParentId="28831" CreationDate="2018-12-17T14:37:42.927" Score="3" Body="&lt;p&gt;Based on &lt;a href=&quot;https://docs.craftcms.com/v3/extend/cp-section.html#subnavs&quot; rel=&quot;nofollow noreferrer&quot;&gt;the docs&lt;/a&gt; and &lt;a href=&quot;https://craftcms.com/guides/updating-plugins-for-craft-2-5#control-panel-subnavs&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide&lt;/a&gt;, looks like you'll want to set &lt;code&gt;selectedSubnavItem&lt;/code&gt; in your Twig template(s) to whatever the key of your selected subnav item is (&lt;code&gt;moderateentries&lt;/code&gt;, &lt;code&gt;notificationmessages&lt;/code&gt;, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could do somthing similar to what Andrew Welch does in his SEOmatic plugin; he &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic/blob/e3cd8734d50fd5b6a41bf8bd51d440c936c06acf/src/controllers/SettingsController.php#L141&quot; rel=&quot;nofollow noreferrer&quot;&gt;sets the &lt;code&gt;selectedSubnavItem&lt;/code&gt; variable&lt;/a&gt; as a keyed item in a &lt;code&gt;variables&lt;/code&gt; array and then right after that &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic/blob/e3cd8734d50fd5b6a41bf8bd51d440c936c06acf/src/controllers/SettingsController.php#L192&quot; rel=&quot;nofollow noreferrer&quot;&gt;renders his plugin template&lt;/a&gt; (including that &lt;code&gt;variables&lt;/code&gt; array in the render method).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-12-17T18:13:39.883" LastActivityDate="2018-12-17T18:13:39.883" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28837" PostTypeId="2" ParentId="28826" CreationDate="2018-12-17T14:38:17.697" Score="4" Body="&lt;p&gt;You can only access the parent's variable, not modify it. You could however simply add another block specifically for the body class, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Layout template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;body class=&quot;{% block body_class %}default-class-1 default-class-2{% endblock %}&quot;&amp;gt;&#xA;    {{ block('pageBody') }}&#xA;&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Template that extends it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'layout' %}&#xA;&#xA;{% block body_class %}{{ parent() }} myclass{% endblock %}&#xA;&#xA;{% block pageBody %}&#xA;    &amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;&#xA;    &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, consequuntur!&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the call to parent() that includes the default classes defined in the parent template.&lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2018-12-17T14:38:17.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28838" PostTypeId="2" ParentId="28835" CreationDate="2018-12-17T15:21:05.957" Score="4" Body="&lt;p&gt;So instead of using the dot syntax &lt;code&gt;.&lt;/code&gt;, this would be a good place to use the subscript syntax &lt;code&gt;[]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# dot syntax #}&#xA;{{ foo.bar }}&#xA;&#xA;{# subscript syntax #}&#xA;{{ foo['bar'] }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you use the subscript syntax to access a variable's attributes, you can safely use variables (by just removing the single quotes surrounding the attribute).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set bar = 'helloWorld' %}&#xA;{{ foo[bar] }}&#xA;{# functions just like foo.helloWorld #}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So for your example, you would do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.listImageRatio == '16by9' %}&#xA;    {% set imageRatio = 'imageVariants16by9' %}&#xA;{% endif %}&#xA;&#xA;{% set optimizedImages = item.itemImage.one()[imageRatio] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/templates.html#variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Twig docs)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-17T15:21:05.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28839" PostTypeId="1" AcceptedAnswerId="28840" CreationDate="2018-12-17T16:18:11.343" Score="1" ViewCount="698" Body="&lt;p&gt;I'm trying to filter entries down based on keywords and also if they have selected a letter that matches the first letter of an entry title on Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set keywordParam = craft.request.param('keyword') %}&#xA;{% set characterParam = craft.request.param('filterByCharacter') %}&#xA;&#xA;{% set entriesParams = {&#xA;   section: 'people',&#xA;   level: 1&#xA;} %}&#xA;&#xA;{% set searchArray = ['OR'] %}&#xA;&#xA;{% if characterParam|length %}&#xA;   {% set searchArray = searchArray|merge(['title:' ~ characterParam ~ '*']) %}&#xA;{% endif %}&#xA;&#xA;{% if keywordParam|length %}&#xA;   {% set searchArray = searchArray|merge(['title:' ~ keywordParam]) %}&#xA;{% endif %}&#xA;&#xA;{% if searchArray|length %}&#xA;   {% set entriesParams = entriesParams|merge({ search: searchArray }) %}&#xA;{% endif %}&#xA;&#xA;{% set peopleEntries = craft.entries(entriesParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the moment this is producing the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Undefined index: query&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've narrowed it down to this line(s):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if searchArray|length %}&#xA;   {% set entriesParams = entriesParams|merge({ search: searchArray }) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out what is wrong with this, and what could be going wrong!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example URL is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://localhost:3000/our-people?keyword=sach&amp;amp;filterByCharacter=M&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:3000/our-people?keyword=sach&amp;amp;filterByCharacter=M&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2018-12-17T16:43:53.787" Title="Using multiple 'search' parameter values to filter entries" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28840" PostTypeId="2" ParentId="28839" CreationDate="2018-12-17T16:43:53.787" Score="3" Body="&lt;p&gt;Just looked at the docs (&lt;a href=&quot;https://docs.craftcms.com/v3/searching.html#supported-syntaxes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/searching.html#supported-syntaxes&lt;/a&gt;) and it looks like the accepted syntax for this would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;title::M* OR title:sach&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, modifying your code like so should achieve this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set keywordParam = craft.request.param('keyword') %}&#xA;{% set characterParam = craft.request.param('filterByCharacter') %}&#xA;&#xA;{% set entriesParams = {&#xA;   section: 'people',&#xA;   level: 1&#xA;} %}&#xA;&#xA;{% set searchArray = [] %}&#xA;&#xA;{% if characterParam|length %}&#xA;   {% set searchArray = searchArray|merge(['title::' ~ characterParam ~ '*']) %}&#xA;{% endif %}&#xA;&#xA;{% if keywordParam|length %}&#xA;   {% set searchArray = searchArray|merge(['title:' ~ keywordParam]) %}&#xA;{% endif %}&#xA;&#xA;{% if searchArray|length %}&#xA;   {% set searchParam = searchArray|join(' OR ') %}&#xA;   {% set entriesParams = entriesParams|merge({ search: searchParam }) %}&#xA;{% endif %}&#xA;&#xA;{% set peopleEntries = craft.entries(entriesParams) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that resolves it for you.&lt;/p&gt;&#xA;" OwnerUserId="5835" LastActivityDate="2018-12-17T16:43:53.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28841" PostTypeId="1" AcceptedAnswerId="28851" CreationDate="2018-12-17T17:36:51.290" Score="2" ViewCount="949" Body="&lt;p&gt;I'm trying to display a list of child structure links, but only from a specific parent. The template I'm working on isn't for the parent in question so I don't think I can use 'entry.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My structure is set up like this&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Parent 1&lt;/strong&gt; &lt;/li&gt;&#xA;&lt;li&gt;--Child One&lt;/li&gt;&#xA;&lt;li&gt;--Child Two&lt;/li&gt;&#xA;&lt;li&gt;--Child Three&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Parent 2&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;--Child One&lt;/li&gt;&#xA;&lt;li&gt;--Child Two&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I only want to display the children of Parent 1. What I have so far is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul id=&quot;sub-menu&quot;&amp;gt;&#xA;{% set pages = craft.entries.section('visit').level('&amp;gt;1') %}&#xA;{% nav entry in pages %}&#xA;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;    {% ifchildren %}&#xA;        &amp;lt;ul&amp;gt;&#xA;           {% children %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;     {% endifchildren %}&#xA;&amp;lt;/li&amp;gt;&#xA;{% endnav %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using this outputs all of the second level children instead of just the children from Parent 1. Is there any way to specify that the only children I want to display must come from Parent 1? Can I specify a slug somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help much appreciated&lt;/p&gt;&#xA;" OwnerUserId="7841" LastEditorUserId="45" LastEditDate="2018-12-17T20:08:11.510" LastActivityDate="2018-12-18T01:22:50.960" Title="How can I display second level children only from a specific parent structure item?" Tags="&lt;craft3&gt;&lt;structure&gt;&lt;navigation&gt;&lt;children&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28842" PostTypeId="1" AcceptedAnswerId="28852" CreationDate="2018-12-17T18:19:53.870" Score="3" ViewCount="800" Body="&lt;p&gt;I had a simple Password Confirmation validation function in Craft 2. In porting the function to Craft 3, I'm struggling to figure out how to handle the same thing. In Craft 2, all events were consistently handled by setting &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt; but in Craft 3, only a subset of events have a similar &lt;code&gt;isValid&lt;/code&gt; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my previous Craft 2 version, triggered on &lt;code&gt;onBeforeSaveUser&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function confirmPassword($event)&#xA;{&#xA;    // Only do anything if it is a front end submission&#xA;    // Only validates against passwordConfirm if field is present&#xA;    if (craft()-&amp;gt;request-&amp;gt;isSiteRequest()) {&#xA;        $password = Craft::$app-&amp;gt;request-&amp;gt;post('password');&#xA;        $passwordConfirm = Craft::$app-&amp;gt;request-&amp;gt;post('passwordConfirm');&#xA;        if (isset($passwordConfirm) &amp;amp;&amp;amp; strcmp($password, $passwordConfirm) !== 0) {&#xA;            $event-&amp;gt;user-&amp;gt;addErrors(array('passwordConfirm' =&amp;gt; Craft::t('Passwords do not match.')));&#xA;            $event-&amp;gt;performAction = false;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my attempt to port to Craft 3, right now, I'm listening for &lt;code&gt;EVENT_BEFORE_SAVE_ELEMENT&lt;/code&gt; and then doing...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function confirmPassword(ElementEvent $event)&#xA;{&#xA;    // Only do anything if it is a front end submission&#xA;    // Only validates against passwordConfirm if field is present&#xA;&#xA;    if (Craft::$app-&amp;gt;request-&amp;gt;isSiteRequest) {&#xA;&#xA;        $password = Craft::$app-&amp;gt;request-&amp;gt;getBodyParam('password');&#xA;        $passwordConfirm = Craft::$app-&amp;gt;request-&amp;gt;getBodyParam('passwordConfirm');&#xA;&#xA;        if (isset($passwordConfirm) &amp;amp;&amp;amp; strcmp($password, $passwordConfirm) !== 0) {&#xA;&#xA;            $event-&amp;gt;element-&amp;gt;addErrors([&#xA;                'password' =&amp;gt; 'Passwords do not match.'&#xA;            ]);&#xA;&#xA;            // WHAT DO I DO HERE TO PREVENT USER ELEMENT FROM SAVING?&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I print out &lt;code&gt;$event-&amp;gt;element-&amp;gt;errors&lt;/code&gt;, it correctly shows the errors. But the element is still saved. Am I missing a step here? Or is there a better way to handle this simple/custom validation?&lt;/p&gt;&#xA;" OwnerUserId="9167" LastActivityDate="2019-01-08T14:36:32.813" Title="Craft 3: Preventing Element from Saving in Plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28843" PostTypeId="1" AcceptedAnswerId="28845" CreationDate="2018-12-17T20:07:31.603" Score="2" ViewCount="100" Body="&lt;p&gt;I have sprout reports (twig template) exporting tens of thousands of records. Problem is that its timing out. I appreciate that this is expected and my only likely option is to up the server spec.&#xA;Is there anything i can do to optimise the report itself? e.g, through tasks where it exports the report over a period of time rather than all in one go?&lt;/p&gt;&#xA;" OwnerUserId="4936" LastActivityDate="2018-12-17T20:33:35.680" Title="Sprout reports timing out on thousands of records" Tags="&lt;plugin-sproutforms&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28844" PostTypeId="2" ParentId="28842" CreationDate="2018-12-17T20:14:32.037" Score="2" Body="&lt;p&gt;I think you want the &lt;code&gt;$handled&lt;/code&gt; property set to true. This is a base Yii property that says &quot;I've handled this, stop processing anything else for it.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could be wrong, but the &lt;code&gt;$isValid&lt;/code&gt; is only for &quot;CancelableEvent&quot; type and maybe some others as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at these pages:&#xA;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-events-cancelableevent.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-events-cancelableevent.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-base-event#&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/api/2.0/yii-base-event#&lt;/a&gt;$handled-detail&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's worth a shot.&lt;/p&gt;&#xA;" OwnerUserId="9135" LastActivityDate="2018-12-17T20:14:32.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28845" PostTypeId="2" ParentId="28843" CreationDate="2018-12-17T20:33:35.680" Score="3" Body="&lt;p&gt;As you suspected, Sprout Reports is not designed to handle large quantities of data if it's more than your server can handle. As for how many records you could export, it really just depends on how impressive your query is and how much your server can handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could potentially consider adding support for batching large exports. I've created a ticket if you'd like to add your vote for it: &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-reports/issues/39&quot; rel=&quot;nofollow noreferrer&quot;&gt;Add support for batch exporting large data sets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, if you plan to do this on a regular basis you may want to invest in writing a script that makes this a bit easier to do or reach out and contract us to prioritize adding support for this feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the scope of optimizing the existing queries in your Twig template reports, you could potentially use techniques like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eager Loading&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Saving related data ahead of time using a field like the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparse Field&lt;/a&gt; which could potentially reduce the need for complex joins when performing the actual query. &lt;/li&gt;&#xA;&lt;li&gt;Advanced Twig query techniques (I don't know where these are documented but Brandon mentioned them in his slides &lt;a href=&quot;https://speakerdeck.com/brandonkelly/intro-to-craft-3?slide=46&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Create custom variables or twig functions in your own custom plugins to help optimize how the queries are actually being handled.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Outside of optimizing the query, you could add date range (or some other) settings that lets you give the user control over reducing the size of the full query. There is an example of creating a &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-reports/blob/v1/src/examples/tutorialreport/settings.html#L149&quot; rel=&quot;nofollow noreferrer&quot;&gt;date range field&lt;/a&gt; in the example templates provided in the plugin.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-12-17T20:33:35.680" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28846" PostTypeId="2" ParentId="28783" CreationDate="2018-12-17T21:43:08.527" Score="1" Body="&lt;p&gt;After a long search and lots of trial and error, I've found the perfect solution!&#xA;This is how I created a dynamic structure navigation : parent/child (2 levels deep) with &lt;code&gt;class=&quot;active&quot;&lt;/code&gt; on the parent and the child &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;Navigation&quot;&amp;gt;&#xA;&#xA;{# Get top-level entries in structure section 'features' #}&#xA;{% set parentFeatures = craft.entries.section('features').level(1) %}&#xA;&#xA;{# Loop through top-level entries #}&#xA;{% for parentFeature in parentFeatures %}&#xA;&#xA;    {# Check if entry has descendants/children #}&#xA;    {% if not parentFeature.hasDescendants %}&#xA;&#xA;        {# List navigation item if entry has NO child entries #}&#xA;        &amp;lt;li class=&quot;Navigation-item {% if craft.app.request.absoluteUrl == parentFeature.url %}active{% endif %}&quot;&amp;gt;&#xA;            &amp;lt;a href=&quot;{{ parentFeature.getUrl }}&quot; class=&quot;Navigation-link&quot;&amp;gt;{{ parentFeature.title }}&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;    {% else %}&#xA;&#xA;        {# List navigation item if entry does have child entries #}&#xA;        {# Show an active class if it is active or if it contains a child that is active #}&#xA;        &amp;lt;li class=&quot;Navigation-item Navigation-item--dropdown {% if parentFeature.slug == craft.request.getSegment(parentFeature.level) %}active{% endif %}&quot;&amp;gt;&#xA;&#xA;            &amp;lt;a href=&quot;{{ parentFeature.getUrl }}&quot; class=&quot;Navigation-link&quot;&amp;gt;{{ parentFeature.title }}&amp;lt;/a&amp;gt;&#xA;            &amp;lt;ul class=&quot;Navigation Navigation--subMenu&quot;&amp;gt;&#xA;&#xA;                {# Get child entries of current iteration's top-level entry #}&#xA;                {% set subPages = parentFeature.getChildren() %}&#xA;&#xA;                {# Loop through those 2nd-level entries #}&#xA;                {% for subPage in subPages %}&#xA;&#xA;                    {# This is the place where you'd nest the next menu hierarchy !! #}&#xA;&#xA;                    {# List sub-menu navigation item #}&#xA;                    &amp;lt;li class=&quot;Navigation-item Navigation-item--subMenu {% if craft.app.request.absoluteUrl == subPage.url %}active{% endif %}&quot;&amp;gt;&#xA;                        &amp;lt;a href=&quot;{{ subPage.getUrl }}&quot; class=&quot;Navigation-link Navigation-link--subMenu&quot;&amp;gt;{{ subPage.title }}&amp;lt;/a&amp;gt;&#xA;                    &amp;lt;/li&amp;gt;&#xA;&#xA;                {% endfor %}&#xA;&#xA;            &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thanks to &lt;strong&gt;Carlcs&lt;/strong&gt;'s old answer about this found here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/1847/6586&quot;&gt;https://craftcms.stackexchange.com/a/1847/6586&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2018-12-17T21:43:08.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28847" PostTypeId="1" CreationDate="2018-12-17T22:07:52.703" Score="1" ViewCount="22" Body="&lt;p&gt;Internal Server Error&#xA;Craft\MatrixBlockModel and its behaviors do not have a method or closure named &quot;header&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apache Version  2.4.37&#xA;PHP Version 7.1.24&#xA;MySQL Version   5.7.24&#xA;Architecture    x86_64&#xA;Operating System    Linux Cent OS&lt;/p&gt;&#xA;" OwnerUserId="9168" LastActivityDate="2019-05-17T14:03:20.703" Title="After migrating, I am getting this error for several of my buttons and menus on Craft 2.6" Tags="&lt;configuration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28848" PostTypeId="2" ParentId="28245" CreationDate="2018-12-17T22:25:18.687" Score="1" Body="&lt;p&gt;This is possible with the Sprout Forms Invisible Field (be sure to update to the latest version). Using the Invisible Field will ensure your email address never shows up in the template. To set this up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Add an Invisible Field (&lt;code&gt;invisibleFieldHandle&lt;/code&gt;) to your form and set its value to &lt;code&gt;{recipient}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Setup a Notification Email and set your Recipient field to the name of your Invisible Field Handle: &lt;code&gt;{invisibleFieldHandle}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Before your Sprout Forms &lt;code&gt;displayForm&lt;/code&gt; tag, set the value of the Email Address where you want to trigger the Notification Email:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutForms.addFieldVariables({ &#xA;  recipient: 'email@website.com'&#xA;}) %}&#xA;&#xA;{% craft.sproutForms.displayForm('contact') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="115" LastActivityDate="2018-12-17T22:25:18.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28849" PostTypeId="1" AcceptedAnswerId="28850" CreationDate="2018-12-17T22:31:23.463" Score="1" ViewCount="1130" Body="&lt;p&gt;I'm currently setting up a Structure nav and am trying to set it up so that child pages only display if;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The child page itself (or it's sibling) is currently active&#xA;2) The parent page of that child is currently active&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment all I can get working is having the child pages display regardless of what page is active. Even if a page has no children, the child pages are still being shown beneath another parent page, whereas ideally those child pages would not be seen until those pages are become active.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('about').level('1') %}&#xA;&#xA;&amp;lt;ul class=&quot;side-nav p-0&quot;&amp;gt;&#xA;{% for page in pages %}&#xA;{% set activePage = (entry.slug == craft.request.segment(2)) %}&#xA;&amp;lt;li class=&quot;{% if activePage %} active{% endif %}&quot;&amp;gt;&#xA;  &amp;lt;a href=&quot;{{page.url}}&quot;&amp;gt;{{ page.title }}&amp;amp;nbsp;&amp;lt;/a&amp;gt;&#xA;  {% if activePage %}&#xA;    {% set subPage = craft.entries.descendantOf(page) %}&#xA;    &amp;lt;ul class=&quot;p-0 pl-5&quot;&amp;gt;&#xA;      {% for child in subPage %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{child.url}}&quot;&amp;gt;{{child.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;      {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;   {% endif %}&#xA; &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any solution out there for this as I feel like I maybe close to getting it working. Can anybody shed any light on this?&lt;/p&gt;&#xA;" OwnerUserId="7841" LastActivityDate="2018-12-18T01:07:35.727" Title="Craft CMS Structure: How can I display parent and child items on an active parent page?" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;structure&gt;&lt;navigation&gt;&lt;children&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28850" PostTypeId="2" ParentId="28849" CreationDate="2018-12-18T01:07:35.727" Score="2" Body="&lt;p&gt;I hope I have understand your problem..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at your code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;One sidenote: It might be good to limit your &lt;code&gt;pages&lt;/code&gt;-selection only to active pages:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('about').level(1).status('live') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First of all, store the elements of the slug in an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slugs = craft.request.segments %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Here is the first for-loop for the first-level elements:&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;side-nav p-0&quot;&amp;gt;&#xA;{% for page in pages %}&#xA;    {% set activePage = (page.slug in slugs) %}&#xA;    &amp;lt;li class=&quot;{% if activePage %} active{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{page.url}}&quot;&amp;gt;{{ page.title }}&amp;amp;nbsp;&amp;lt;/a&amp;gt;&#xA; &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important part here is to check whether the &lt;strong&gt;slug of the page in the for-loop&lt;/strong&gt; is active. In your code, you checked the slug of the entry (of the currently active page, not the page in the loop) with the slug of the request. This will always yield a true result, which is what you experienced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the code above you will by now receive a list of all first-level pages, the active one with labelled with &lt;code&gt;class=&quot;active&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Now let's look into the second loop for the subpages.&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set activeSubPage = (entry.level == 2 and entry.getParent().slug == page.slug) %}&#xA;{% if activePage or activeSubPage %}&#xA;    {% set subPage = craft.entries.descendantOf(page) %}&#xA;    &amp;lt;ul class=&quot;p-0 pl-5&quot;&amp;gt;&#xA;        {% for child in subPage %}&#xA;            &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{child.url}}&quot;&amp;gt;{{child.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This time it is not enough to check whether the slug of the active page in the loop matches the slug of the actual page (this will show children only if the parent page is selected), we also need to check whether the parent's slug matches the active page (to show children even if the active page is one of the children itself and not the parent).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;activeSubPage&lt;/code&gt; we check at first, whether the page is level 2 (therefore it has a parent and we won't run into an error for an undefined attribute on pages that are level 1 and do not have a parent) and if so, whether the parent's slug is equal to the slug of the current page in the loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We enclose the second for-loop with an if-clause that checks both of the results, whether the current item in the loop is either  &lt;code&gt;activePage&lt;/code&gt; or &lt;code&gt;activeSubPage&lt;/code&gt;. The remaining code is identical to your code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could now check again, whether the sub-item is active, by using the same principle: &lt;code&gt;{% if  (child.slug in slugs) %}active{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete updated code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.section('about').level(1).status('live') %}&#xA;{% set slugs = craft.request.segments %}&#xA;&#xA;&amp;lt;ul class=&quot;side-nav p-0&quot;&amp;gt;&#xA;{% for page in pages %}&#xA;    {% set activePage = (page.slug in slugs) %}&#xA;    &amp;lt;li class=&quot;{% if activePage %} active{% endif %}&quot;&amp;gt;&#xA;        &amp;lt;a href=&quot;{{page.url}}&quot;&amp;gt;{{ page.title }}&amp;amp;nbsp;&amp;lt;/a&amp;gt;&#xA;        {% set activeSubPage = (entry.level == 2 and entry.getParent().slug == page.slug) %}&#xA;        {% if activePage or activeSubPage %}&#xA;            {% set subPage = craft.entries.descendantOf(page) %}&#xA;            &amp;lt;ul class=&quot;p-0 pl-5&quot;&amp;gt;&#xA;                {% for child in subPage %}&#xA;                    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{child.url}}&quot;&amp;gt;{{child.title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA; &amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps and solves your problem. If you have any questions or if you do not understand my explanation (sorry for my bad English, I'm not a native speaker): Don't hesitate to ask!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Further improvements:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;With some small improvements you could put this code into a file and use it recursively for navigations with more than two levels. In your template, you would then be able to include it like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;_includes/nav_links_withchildren&quot; with { 'slug' : 'about' } %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and would then include itself again to list sub-pages.&lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2018-12-18T01:07:35.727" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28851" PostTypeId="2" ParentId="28841" CreationDate="2018-12-18T01:17:19.940" Score="2" Body="&lt;p&gt;yes you can!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may search for a slug &lt;code&gt;craft.entries.slug('slug-of-first-parent')&lt;/code&gt;, select the first result &lt;code&gt;.one()&lt;/code&gt;, and then the children by &lt;code&gt;.getChildren()&lt;/code&gt;. Now you can proceed as you already did and limit your result to only elements with a level greater than 1 &lt;code&gt;.level('&amp;gt;1')&lt;/code&gt; and list.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set pages = craft.entries.slug('slug-of-first-parent').one().getChildren().level('&amp;gt;1') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure whether this is the best and most effective solution, but it should definitely do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You can display information about an entry and the methods and variables available by dumping them either by using &lt;code&gt;var_dump($variable)&lt;/code&gt; in php code or &lt;code&gt;{{ d($variable) }}&lt;/code&gt; (by using &lt;a href=&quot;https://github.com/studioespresso/craft3-dumper&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; free plugin) in your twig template. This can help a lot when dealing with entries and finding children or parents.&lt;/p&gt;&#xA;" OwnerUserId="5424" LastEditorUserId="5424" LastEditDate="2018-12-18T01:22:50.960" LastActivityDate="2018-12-18T01:22:50.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28852" PostTypeId="2" ParentId="28842" CreationDate="2018-12-18T07:47:19.453" Score="7" Body="&lt;p&gt;The event fired by element service is not cancellable, as that is a bit too broad to be controlled like that. Instead, you should be listening to the &lt;code&gt;EVENT_BEFORE_SAVE&lt;/code&gt; on the &lt;code&gt;User&lt;/code&gt; element as that supports the &lt;code&gt;isValid&lt;/code&gt; property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\events\ModelEvent;&#xA;use craft\elements\User;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(User::class, User::EVENT_BEFORE_SAVE, function(ModelEvent $event) {&#xA;    $event-&amp;gt;sender-&amp;gt;addErrors([&#xA;        'password' =&amp;gt; 'Passwords do not match.'&#xA;    ]);&#xA;    $event-&amp;gt;isValid = false;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="258" LastEditorUserId="9167" LastEditDate="2019-01-08T14:36:32.813" LastActivityDate="2019-01-08T14:36:32.813" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28855" PostTypeId="1" CreationDate="2018-12-18T11:16:19.567" Score="0" ViewCount="37" Body="&lt;p&gt;I'm trying to use a charting library within a Craft template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chart expects an array of numbers that I'm building up from a table but I'm getting an array of strings instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set donutData = [] %}&#xA;{% for p in block.donutValues %}&#xA;    {% set donutData = donutData|merge([&#xA;        p.value&#xA;    ]) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then if I do &lt;code&gt;{{ donutData|json_encode }}&lt;/code&gt; I get an array of strings returned that my chart library can't interpret.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;value&lt;/code&gt; is set to be a number field in the Craft table column so not sure why I'm getting a string returned.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2018-12-18T11:38:35.277" Title="Replace quotes in an array" Tags="&lt;array&gt;&lt;merge&gt;&lt;string&gt;&lt;number&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28856" PostTypeId="2" ParentId="28855" CreationDate="2018-12-18T11:38:35.277" Score="1" Body="&lt;p&gt;So it seems that even although the Craft field is set to &lt;code&gt;number&lt;/code&gt; it doesn't actually define a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the field from a regular Craft table field to a Super Table field and my &lt;code&gt;{{ donutData|json_encode }}&lt;/code&gt; corrects spits out an array of numbers.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2018-12-18T11:38:35.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28858" PostTypeId="2" ParentId="28847" CreationDate="2018-12-18T13:30:07.273" Score="1" Body="&lt;p&gt;This error indicates that you don't have a matrix block, called header, setup in the CMS, but your template is expecting one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to create a new matrix field;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;settings &gt; fields &gt; new field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field type should be “matrix” and it's handle needs to be “header”.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-12-18T13:30:07.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28859" PostTypeId="1" CreationDate="2018-12-18T13:30:32.997" Score="1" ViewCount="196" Body="&lt;p&gt;I need to add and/or change an attribute in the order table on &lt;code&gt;/admin/commerce/orders&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Order Element itself does not have a &lt;code&gt;EVENT_SET_TABLE_ATTRIBUTE_HTML&lt;/code&gt;, and I've tried with variations like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    Event::on(Element::class, Element::EVENT_SET_TABLE_ATTRIBUTE_HTML,[$this, 'setOrderStatusTableAttributeHtml']);&#xA;}&#xA;&#xA;public function setOrderStatusTableAttributeHtml($event, $attribute)&#xA;{&#xA;    if ($event-&amp;gt;element instanceof \craft\commerce\elements\Order &amp;amp;&amp;amp; $attribute == 'orderStatus') {&#xA;        return 'Changed';&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The event does not show up in the debug bar. I've also tried a &lt;code&gt;EVENT_INIT&lt;/code&gt; with &lt;code&gt;die('died')&lt;/code&gt; an that kills the execution, so my plugin is installed and loading.&lt;/p&gt;&#xA;" OwnerUserId="8864" LastActivityDate="2018-12-21T08:32:17.237" Title="Modify Order table in Control Panel" Tags="&lt;plugin-craftcommerce&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28860" PostTypeId="2" ParentId="28832" CreationDate="2018-12-18T13:43:07.783" Score="1" Body="&lt;p&gt;If I understand correctly, you want to create a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; element with options from fields you already setup in the CMS. In that case you can use something like this to get the data for the field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;label for=&quot;yourField&quot;&amp;gt;Your Field&amp;lt;/label&amp;gt;&#xA;&amp;lt;select id=&quot;yourField&quot; name=&quot;yourFieldHandle&quot;&amp;gt;&#xA;&#xA;  {% set dropdownField = craft.fields.getFieldbyHandle('yourFieldHandle') %}&#xA;  {% for option in dropdownField.settings.options %}&#xA;    &amp;lt;option value=&quot;{{ option.value }}&quot;&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…replacing &lt;code&gt;yourFieldHandle&lt;/code&gt; with the handle of your field, e.g.: &lt;code&gt;children&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-12-18T13:43:07.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28861" PostTypeId="2" ParentId="28821" CreationDate="2018-12-18T13:53:04.313" Score="1" Body="&lt;p&gt;The browser reads &lt;code&gt;user.userWebsite&lt;/code&gt; as a relative URL, not an absolute one, I guess because your &lt;code&gt;user.userWebsite&lt;/code&gt; field does not store the protocol, i.e.: http or https. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't specify a protocol in a URL a browser &lt;em&gt;must&lt;/em&gt; assume that it is a link to a resource on your own site. The solution is to either store the protocol within userWebsite (probably the best option), or prepend it in your template, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;href=&quot;https://{{ user.userWebsite }}&quot;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-12-18T13:53:04.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28862" PostTypeId="2" ParentId="28833" CreationDate="2018-12-18T15:25:46.263" Score="1" Body="&lt;p&gt;There is a CDN plugin called Upper. You could do a feature request on there github.com/ostark/upper/issues . Or look at how they implement the CDNs in their plugins and make your own.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-18T15:25:46.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28863" PostTypeId="2" ParentId="28833" CreationDate="2018-12-18T15:38:16.687" Score="1" Body="&lt;p&gt;Looks like Cloudways is just a pull CDN, so you probably won't have to do anything to support it, just set up the origin properly, and change your Asset URLs as appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TL;DR on pull CDNs is that you give them an &quot;origin&quot; (your website in most cases), and change your asset URLs to point to the CDN. When an asset is requested, it looks for it in its cache, and if it isn't there, it pulls it from the origin (your website) and caches it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's very little setup you need to do just to get the basic functionality working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't get any automatic purging, that'd have to come from a plugin or such, but it should work without modification in Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done similar things setting up MaxCDN to work with Craft CMS.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-18T15:38:16.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28864" PostTypeId="2" ParentId="28809" CreationDate="2018-12-18T15:42:45.483" Score="1" Body="&lt;p&gt;&lt;strong&gt;If you are really trying to get the next field in order on an entry type:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Field order can't be set on an entry type's field layout. Craft seems to set their order when you create them in Settings-&gt;Fields. Whatever you are trying to setup/accomplish this way I would recommend against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you are trying to retrieve entries that the lightswitch field is off:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('sectionHandle').all().lightSwitchField('not 1') %}&#xA;{{ entry.field }}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you are trying to get the sibling of an entry if the current entry's lightswitch field is off:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not entry.lightswitchField %}&#xA;    {% set sibling = craft.entries().nextSiblingOf(entry).one() %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to give you several examples/solutions as your question isn't explicit.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-18T15:42:45.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28865" PostTypeId="2" ParentId="28756" CreationDate="2018-12-18T15:46:41.360" Score="1" Body="&lt;p&gt;The value of dropdown fields are set in the dashboard. How to set the value is dependent on the form plugin or craft field type you are using.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-18T15:46:41.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28866" PostTypeId="2" ParentId="26797" CreationDate="2018-12-18T16:14:48.790" Score="3" Body="&lt;p&gt;You can also try &lt;code&gt;User::EVENT_BEFORE_SAVE&lt;/code&gt;. I'm not sure that it's documented anywhere, or if it was added after Brad responded, but it might work too.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use yii\base\Event;&#xA;use craft\elements\User&#xA;use craft\events\ModelEvent;&#xA;&#xA;Event::on(&#xA;    User::class,&#xA;    User::EVENT_AFTER_SAVE,&#xA;    function(ModelEvent $event) {&#xA;        ...&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9167" LastActivityDate="2018-12-18T16:14:48.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28867" PostTypeId="1" AcceptedAnswerId="28896" CreationDate="2018-12-18T16:33:45.070" Score="2" ViewCount="408" Body="&lt;p&gt;I want to be able to retrieve the current users Cart via a JSON API endpoint, so I can loop through the products in the cart in JS on the front end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the Element API plugin installed, but I am not understanding how to grab the current cart from inside the endpoint via PHP. Any help much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;use craft\helpers\UrlHelper;&#xA;use craft\commerce\elements\Product;&#xA;use craft\commerce\elements\Order;&#xA;&#xA;function requireLogin() {&#xA;    $currentUser = Craft::$app-&amp;gt;user-&amp;gt;getIdentity();&#xA;&#xA;    if(!$currentUser) {&#xA;        throw new \yii\web\ForbiddenHttpException(&quot;You are not logged in&quot;);&#xA;    }&#xA;}&#xA;&#xA;function requireCart() {&#xA;    // TWIG would be: {% set cart = craft.commerce.getCarts().getCart() %}&#xA;    $currentCart = Craft::WHAT?;&#xA;    $cartId      = $currentCart-&amp;gt;id;&#xA;&#xA;    if(!$currentCart) {&#xA;        throw new \yii\web\ForbiddenHttpException(&quot;You don't have a cart yet&quot;);&#xA;    }&#xA;}&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'cart.json' =&amp;gt; function() {&#xA;            requireLogin();&#xA;            requireCart();&#xA;&#xA;            \Craft::$app-&amp;gt;response-&amp;gt;headers-&amp;gt;set('Access-Control-Allow-Origin', '*');&#xA;&#xA;            return [&#xA;                'elementType' =&amp;gt; Order::class,&#xA;                'criteria'    =&amp;gt; ['id' =&amp;gt; $cartId],&#xA;                'transformer' =&amp;gt; function(Order $order) {&#xA;                    $items = [];&#xA;&#xA;                    foreach($order-&amp;gt;lineItems as $lineItem) {&#xA;                        $items[] = [array(&#xA;                            'itemTitle' =&amp;gt; $lineItem-&amp;gt;title&#xA;                        )];&#xA;                    }&#xA;&#xA;                    return [&#xA;                        'items' =&amp;gt; $items&#xA;                    ];&#xA;                }&#xA;            ];&#xA;        }&#xA;    ]&#xA;]&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="219" LastActivityDate="2018-12-20T13:19:40.510" Title="Exposing current Commerce2 Cart via the Element API" Tags="&lt;plugin-elementapi&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28868" PostTypeId="1" AcceptedAnswerId="28886" CreationDate="2018-12-18T17:37:03.827" Score="2" ViewCount="63" Body="&lt;p&gt;I am using Craft 3 to populate content over a REST api. Now I have a use case, where I want to update an internal field of an entry without changing the dateUpdated. Otherwise the clients would get informed about an update, but it is just for internal/system use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I somehow save an entry without changing the dateUpdated or do I need to find another solution for my use case?&lt;/p&gt;&#xA;" OwnerUserId="9172" LastEditorUserId="9172" LastEditDate="2018-12-18T22:59:28.897" LastActivityDate="2018-12-19T17:45:12.283" Title="Disable dateUpdated" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28869" PostTypeId="1" AcceptedAnswerId="28870" CreationDate="2018-12-18T18:42:00.620" Score="2" ViewCount="382" Body="&lt;p&gt;I have a selection of category groups as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Suitability&#xA;Colour&#xA;Finish&#xA;etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They all have many categories within them. I have set up some routes for &lt;code&gt;/suitability&lt;/code&gt; etc to show the user a &lt;code&gt;/shop/category.twig&lt;/code&gt; template for the category group landing pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my issue I'm having is getting the context of the page based on the slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12253/display-category-group-name-in-template&quot;&gt;very old SE post&lt;/a&gt; that kind of offers a solution, but it's only useful for getting the name. I need to build on this to get the group. But it doesn't look like there's a way to 'get' a category group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may be wrong and missed something but I've only found ways to obtain category group info based on context of a category itself as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# get the category group slug #}&#xA;{% set slug = craft.app.request.segment(1) %}&#xA;&#xA;{# get the first category within this group and output the groups' name #}&#xA;{% set catGroupName = craft.categories.group(slug).first.group %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any advice on a much neater way to obtain a category group would be handy. Thanks&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2018-12-18T18:53:47.400" LastActivityDate="2018-12-18T19:11:59.473" Title="Method for creating Category Group landing pages" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;category&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28870" PostTypeId="2" ParentId="28869" CreationDate="2018-12-18T18:49:02.390" Score="3" Body="&lt;p&gt;2nd Revision:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The category group field layout is for categories within that group. Categories groups do not have fields assigned to them, only to the categories within a group.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;1st Revision:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the fields of a category group, set the category like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set group = craft.categories.group('suitability').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And use fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ group.someFieldHandle }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Original Answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To retrieve the category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.app.request.segment(1) %}&#xA;{% set category = craft.categories.group('suitability').slug(slug).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then use its fields or related:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ category.title }}&#xA;{{ category.somePlainTextField }}&#xA;{% set entries = craft.entries.relatedTo(category).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be better to set the template for the category on the category group settings page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set the URI to /suitability/{{ slug }} and the template to /shop/category.twig&#xA;Then you can just use the category in the template without having to set it by getting slug and pulling the category from the group. Also, this allows you to point multiple category groups to the same template if their template will be similar.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5501" LastEditDate="2018-12-18T19:11:59.473" LastActivityDate="2018-12-18T19:11:59.473" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28871" PostTypeId="1" AcceptedAnswerId="28881" CreationDate="2018-12-18T18:59:34.010" Score="3" ViewCount="70" Body="&lt;p&gt;I have a &lt;code&gt;suitability&lt;/code&gt; category field in my product type that allows the content writer to select which categories this product is associated with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my issue is that on the product page I need to show a full list of these 'suitability' categories with a &quot;yes&quot; or &quot;no&quot; next to them indicating which categories are appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am getting the 'suitability' category group:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set suitability = craft.categories.group('suitability').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I am simply looping over this list, but I'm unsure how to format my if statement to dictate if this category needs a &quot;yes&quot; or a &quot;no&quot;. I know it's probably something to do with the &lt;code&gt;.relatedTo()&lt;/code&gt; parameter but I'm not quite sure on the formatting.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for category in suitability %}&#xA;    &amp;lt;dt class=&quot;data-list__item data-list__item--title&quot;&amp;gt;{{ category.title }}&amp;lt;/dt&amp;gt;&#xA;    &amp;lt;dd class=&quot;data-list__item data-list__item--value&quot;&amp;gt;&#xA;        {% if product.relatedTo(category) %}Yes{% else %}No{% endif %}&#xA;    &amp;lt;/dd&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2018-12-19T14:52:41.317" Title="Showing a list of selected/related categories to entry" Tags="&lt;categories&gt;&lt;relatedto&gt;&lt;products&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28872" PostTypeId="2" ParentId="28871" CreationDate="2018-12-18T19:09:25.190" Score="2" Body="&lt;pre&gt;&lt;code&gt;{% set suitability = craft.categories.group('suitability').all() %}&#xA;&#xA;{% for category in suitability %}&#xA;    &amp;lt;dt class=&quot;data-list__item data-list__item--title&quot;&amp;gt;&#xA;        {{ category.title }}&#xA;    &amp;lt;/dt&amp;gt;&#xA;    &amp;lt;dd class=&quot;data-list__item data-list__item--value&quot;&amp;gt;&#xA;        {% for selectedCategory in product.suitability.all() %}&#xA;            {% if selectedCategory.slug == category.slug %}&#xA;                Yes&#xA;            {% else %}&#xA;                No&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;    &amp;lt;/dd&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll want to loop over the list of selected categories in your product's category field (&lt;code&gt;product.suitability&lt;/code&gt;) and then check the if the slug of each selected category is the same as the current slug in your main &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;" OwnerUserId="5501" LastEditorUserId="5275" LastEditDate="2018-12-19T14:47:38.250" LastActivityDate="2018-12-19T14:47:38.250" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28873" PostTypeId="1" CreationDate="2018-12-19T12:23:15.500" Score="0" ViewCount="76" Body="&lt;p&gt;I'm brand new to Craft, having been a Wordpress user. I'm managing a site for a small charity.&#xA;Having done some new pages and a blog page without any problem, I did a blog yesterday in which the hyperlinks are live are not visible (ie not showing as underlined). I've tried various different routes for getting the text to use, and tried a new blog, but with no luck.&#xA;Can anyone help me? ...in as plain English as possible please, I'm not familiar yet with html or Craft language.&#xA;The blog post I've don that is fine is:&#xA;&lt;a href=&quot;https://timetoshineleeds.org/blog/learning-lunches-and-breakfasts-and-teas&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://timetoshineleeds.org/blog/learning-lunches-and-breakfasts-and-teas&lt;/a&gt;&#xA;\the blog post that won't show the hyperlinks is:&#xA;&lt;a href=&quot;https://timetoshineleeds.org/blog/free-training-opportunity-project-management&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://timetoshineleeds.org/blog/free-training-opportunity-project-management&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&#xA;Rob&lt;/p&gt;&#xA;" OwnerUserId="9175" LastActivityDate="2018-12-22T14:57:19.627" Title="Hyperlinks in blog are not showing underlined" Tags="&lt;entries&gt;&lt;post&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28875" PostTypeId="2" ParentId="28873" CreationDate="2018-12-19T12:42:56.913" Score="2" Body="&lt;p&gt;Hyperlink styles are defined in you stylesheet (CSS).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the underline text-decoration property like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;text-decoration: underline;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-19T12:42:56.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28876" PostTypeId="1" AcceptedAnswerId="28880" CreationDate="2018-12-19T13:38:28.987" Score="1" ViewCount="227" Body="&lt;p&gt;I have a dropdown field that has three options. In my template, I want to do one thing if option 1 is selected and do something else if option 2 is selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what my code looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in entry.transparentMenu.options %}&#xA;    {% if entry.transparentMenu.value == &quot;menuLight&quot; %}&#xA;        &amp;lt;h3&amp;gt;white&amp;lt;/h3&amp;gt;&#xA;    {% elseif entry.transparentMenu.value == &quot;menuDark&quot; %}&#xA;        &amp;lt;h3&amp;gt;black&amp;lt;/h3&amp;gt;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code seems to work but the output is: &lt;code&gt;black&lt;/code&gt; &lt;code&gt;black&lt;/code&gt; &lt;code&gt;black&lt;/code&gt;; I only want &lt;code&gt;black&lt;/code&gt; to display once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="9176" LastEditorUserId="5275" LastEditDate="2018-12-19T14:15:06.843" LastActivityDate="2018-12-19T14:15:06.843" Title="Dropdown field value getting outputted multiple times" Tags="&lt;craft3&gt;&lt;drop-down&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28877" PostTypeId="2" ParentId="28823" CreationDate="2018-12-19T13:41:33.427" Score="8" Body="&lt;p&gt;After becoming more familiar with Craft and Yii, I've found a more appropriate solution for my use case. I have a couple of ideal requirements:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Templates are stored in a directory within my module or plugin.&lt;/li&gt;&#xA;&lt;li&gt;Templates can be mixed with general application templates (e.g. my module or plugin template can extend from a general site layout template).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It turns out that the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/template-roots.html&quot; rel=&quot;noreferrer&quot;&gt;Template Roots&lt;/a&gt; functionality enables this, so it is documented but for some reason I was overlooking this previously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simply register the template root during plugin/module init like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $event) {&#xA;   $event-&amp;gt;roots['_my_prefix'] = __DIR__ . '/templates';&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then templates in the defined directory can be rendered using the defined prefix (&lt;code&gt;_my_prefix&lt;/code&gt; in this case), as though that directory exists in the main templates directory. This means they can be used in any context and extend or include templates in the main directory ‒ desirable for app specific plugins/modules.&lt;/p&gt;&#xA;" OwnerUserId="9162" LastActivityDate="2018-12-19T13:41:33.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28878" PostTypeId="1" CreationDate="2018-12-19T13:51:16.850" Score="3" ViewCount="195" Body="&lt;p&gt;I have an entry with a matrix field which I'm updating from front-end. The update works fine, but when the (font-end) page reloads after submitting the form, the CP bundle assets get included (selectize.css, craft.css, charts.css). If I then reload the page, the CP assets are no longer included. I believe have narrowed it down to the use of $entry-&gt;setFieldValue(). Does anyone know why that's happening and how to stop it? Or is there a different way to update an entry with a matrix field from font-end that doesn't require me to use setFieldValue()?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the relevant part of my update function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$field = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('fieldHandle');&#xA;$existingMatrixQuery = $entry-&amp;gt;getFieldValue('fieldHandle');&#xA;&#xA;$serializedMatrix = $field-&amp;gt;serializeValue($existingMatrixQuery, $entry);&#xA;$serializedMatrix['new1'] = [&#xA;    'type' =&amp;gt; 'update',&#xA;    'enabled' =&amp;gt; 1,&#xA;    'collapsed' =&amp;gt; true,&#xA;    'fields' =&amp;gt; array_merge($params['fields'], $params['required'])&#xA;];&#xA;$entry-&amp;gt;setFieldValue('fieldHandle', $serializedMatrix);&#xA;&#xA;if (Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($entry)) {&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2019-01-08T11:50:23.143" Title="Updating matrix field from font-end with $entry-&gt;setFieldValue() pulls in Cp bundle on save" Tags="&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28879" PostTypeId="2" ParentId="28876" CreationDate="2018-12-19T14:02:17.200" Score="-1" Body="&lt;p&gt;I don't know your structure, but if &lt;code&gt;transparentMenu&lt;/code&gt; is a select or checkbox or something with &lt;code&gt;menuLight&lt;/code&gt; and &lt;code&gt;menuDark&lt;/code&gt; as options, it should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for option in entry.transparentMenu.options %}&#xA;        {% if entry.header.transparentMenu.value == &quot;menuLight&quot; %}&#xA;            &amp;lt;h3&amp;gt;white&amp;lt;/h3&amp;gt;&#xA;        {% elseif entry.header.transparentMenu.value == &quot;menuDark&quot; %}&#xA;            &amp;lt;h3&amp;gt;black&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;instead of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% for option in entry.transparentMenu.options %}&#xA;        {% if entry.transparentMenu.value == &quot;menuLight&quot; %}&#xA;            &amp;lt;h3&amp;gt;white&amp;lt;/h3&amp;gt;&#xA;        {% elseif entry.header.transparentMenu.value == &quot;menuDark&quot; %}&#xA;            &amp;lt;h3&amp;gt;black&amp;lt;/h3&amp;gt;&#xA;        {% endif %}&#xA;    {% endfor %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;right?&lt;/p&gt;&#xA;" OwnerUserId="9177" LastActivityDate="2018-12-19T14:02:17.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28880" PostTypeId="2" ParentId="28876" CreationDate="2018-12-19T14:02:25.160" Score="1" Body="&lt;p&gt;You don't need the &lt;code&gt;for&lt;/code&gt; loop in this case. What's happening is you're looping over each option in your dropdown field, and each time it's checking the value of the dropdown and displaying &lt;code&gt;white&lt;/code&gt; or &lt;code&gt;black&lt;/code&gt;. Since you have three options, you're going to get the dropdown value displayed three times (which is why you're seeing &lt;code&gt;black&lt;/code&gt; &lt;code&gt;black&lt;/code&gt; &lt;code&gt;black&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need is just the &lt;code&gt;if&lt;/code&gt; conditional:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.transparentMenu.value == &quot;menuLight&quot; %}&#xA;    &amp;lt;h3&amp;gt;white&amp;lt;/h3&amp;gt;&#xA;{% elseif entry.transparentMenu.value == &quot;menuDark&quot; %}&#xA;    &amp;lt;h3&amp;gt;black&amp;lt;/h3&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also, fwiw looks like you have a typo in your code ️ - you use &lt;code&gt;entry.transparentMenu&lt;/code&gt; twice and &lt;code&gt;entry.header.transparentMenu&lt;/code&gt; once. I'm guessing you want &lt;code&gt;entry.transparentMenu&lt;/code&gt; everywhere...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The only time you'd want to use the &lt;code&gt;for&lt;/code&gt; loop to get all the dropdown field's options is if you wanted to display those in the template (in a list for example or to create your own dropdown on the frontend):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;    {% for option in entry.dropdownFieldHandle.options %}&#xA;        &amp;lt;li&amp;gt;{{ option }}&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in your case, you just want the current value and not all the options, so just remove the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-19T14:02:25.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28881" PostTypeId="2" ParentId="28871" CreationDate="2018-12-19T14:52:41.317" Score="3" Body="&lt;p&gt;Indigo Viking's code will achieve what you want, but if you want a simpler solution (possibly a bit more performant since there's no second &lt;code&gt;for&lt;/code&gt; loop), you could do this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set suitability = craft.categories.group('suitability').all() %}&#xA;&#xA;{% for category in suitability %}&#xA;    &amp;lt;dt class=&quot;data-list__item data-list__item--title&quot;&amp;gt;&#xA;        {{ category.title }}&#xA;    &amp;lt;/dt&amp;gt;&#xA;    &amp;lt;dd class=&quot;data-list__item data-list__item--value&quot;&amp;gt;&#xA;        {% if category.id in product.suitability.ids() %}&#xA;            Yes&#xA;        {% else %}&#xA;            No&#xA;        {% endif %}&#xA;    &amp;lt;/dd&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The way this works is &lt;code&gt;product.suitability.ids()&lt;/code&gt; returns an array of the element ids of the categories selected in your &lt;code&gt;suitability&lt;/code&gt; field. Then you just check if the current category's id is in that array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fast, simple, and easy!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-19T14:52:41.317" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28885" PostTypeId="1" AcceptedAnswerId="28889" CreationDate="2018-12-19T17:40:10.880" Score="2" ViewCount="137" Body="&lt;p&gt;I am trying to get the value of a custom field in entries, but I can't seem to get it to grab that value. I'm assuming I'm pulling it too early or too late, otherwise I have no idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can pull the value the of the lightswitch &lt;code&gt;enabled&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) &#xA;    {&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;&#xA;        // will successfully send email if enabled lightswitch is on&#xA;        if($request-&amp;gt;getBodyParam('enabled') == 1)&#xA;        {&#xA;            $html = $request-&amp;gt;getBodyParam('enabled');&#xA;            $subject = &quot;testing&quot;;&#xA;            $mail = &quot;example@gmail.com&quot;;&#xA;            return $this-&amp;gt;sendMail($html, $subject, $mail);&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The below doesn't return anything at all for the custom field &lt;code&gt;fields[sendEmail]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) &#xA;    {&#xA;        $request = Craft::$app-&amp;gt;getRequest();&#xA;&#xA;        // will not send email no matter what position the lightswitch is in&#xA;        if($request-&amp;gt;getBodyParam('fields[sendEmail]') == 1)&#xA;        {&#xA;            $html = $request-&amp;gt;getBodyParam('fields[sendEmail]');&#xA;            $subject = &quot;testing&quot;;&#xA;            $mail = &quot;example@gmail.com&quot;;&#xA;            return $this-&amp;gt;sendMail($html, $subject, $mail);&#xA;        }&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried changing the event handler to &lt;code&gt;EVENT_BEFORE_SAVE_ELEMENT&lt;/code&gt; but it made no difference.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2018-12-19T19:54:17.793" Title="Craft 3 Plugin not returning custom field value" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28886" PostTypeId="2" ParentId="28868" CreationDate="2018-12-19T17:45:12.283" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Otherwise the clients would get informed about an update, but it is just for internal/system use.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It sounds like you're relying on the &lt;code&gt;dateUpdated&lt;/code&gt; column to notify clients of updates, which probably isn't a good idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugins can update it, migrations can update it, re-saving a section's settings can update it, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I would add a custom date/time field and have a plugin that listens to the save element event that updates your custom field with that last &quot;date updated&quot; instead and base your notifications off of that.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-19T17:45:12.283" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28887" PostTypeId="2" ParentId="28753" CreationDate="2018-12-19T17:48:37.677" Score="2" Body="&lt;p&gt;I figured this one out, it was bad error handling on my part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the service you're calling returns NULL, this will appear in the network tab as a 404.&lt;/p&gt;&#xA;" OwnerUserId="9144" LastActivityDate="2018-12-19T17:48:37.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28888" PostTypeId="1" AcceptedAnswerId="28891" CreationDate="2018-12-19T18:12:31.850" Score="2" ViewCount="197" Body="&lt;p&gt;Not sure if this is a bug or my logic is off. I'm trying to add caching logic to templates to not cache certain pages if they have a block type &lt;code&gt;form&lt;/code&gt; present because of the dynamic &lt;code&gt;CSRF&lt;/code&gt; tokens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set doNotCache = entry.mainBody.type('form').all()|length or craft.retour.getHttpStatus != 200 ? true : false %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the page returns &lt;code&gt;true&lt;/code&gt;, the page renders properly. If the logic returns &lt;code&gt;false&lt;/code&gt; the &lt;code&gt;entry.mainBody&lt;/code&gt; object is empty (ie. doesn't render the matrix content). If I remove the logic all together the pages render properly. &lt;/p&gt;&#xA;" OwnerUserId="202" LastEditorUserId="5275" LastEditDate="2018-12-19T21:26:45.163" LastActivityDate="2018-12-19T21:26:45.163" Title="Empty matrix object after checking for a block type" Tags="&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28889" PostTypeId="2" ParentId="28885" CreationDate="2018-12-19T18:29:44.553" Score="2" Body="&lt;p&gt;Found my answer &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/web/Request.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// get $_POST['foo']['bar'], if it exists&#xA;$bar = Craft::$app-&amp;gt;request-&amp;gt;getBodyParam('foo.bar');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or inserting it into my code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) &#xA;{&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;&#xA;    if($request-&amp;gt;getBodyParam('fields.sendEmail') == 1)&#xA;    {&#xA;        $html = $request-&amp;gt;getBodyParam('fields.sendEmail');&#xA;        $subject = &quot;testing&quot;;&#xA;        $mail = &quot;example@gmail.com&quot;;&#xA;        $this-&amp;gt;sendMail($html, $subject, $mail);&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="6955" LastEditDate="2018-12-19T19:54:17.793" LastActivityDate="2018-12-19T19:54:17.793" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28890" PostTypeId="2" ParentId="13781" CreationDate="2018-12-19T19:31:11.793" Score="5" Body="&lt;p&gt;If you don't want to mess about trying to insert code in the Craft/Yii stack, v3 just calls password_hash():&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;password_hash($your_password_string, PASSWORD_DEFAULT, ['cost' =&amp;gt; 13]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a possibly helpful addendum (I was just trying to run the site locally and needed to log in); if you find you still can't login after changing the password via the database and are running PHP locally, it might be because you're accessing via socket and should add this to &lt;code&gt;config/general.php&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'requireUserAgentAndIpForSession' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9179" LastActivityDate="2018-12-19T19:31:11.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28891" PostTypeId="2" ParentId="28888" CreationDate="2018-12-19T21:26:25.527" Score="3" Body="&lt;p&gt;So there are some changes to how &lt;code&gt;.type()&lt;/code&gt; works in Craft 3 which you can read about &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#cloning-element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. What's happening is the &lt;code&gt;type()&lt;/code&gt; you're setting here in your &lt;code&gt;doNotCache&lt;/code&gt; is also getting applied later on in your template when you start actually looping over the blocks in &lt;code&gt;entry.mainBody&lt;/code&gt;. There are two ways to solve this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Reset the &lt;code&gt;type()&lt;/code&gt; in your matrix block loop&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.mainBody.type(null).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Clone the &lt;code&gt;mainBody&lt;/code&gt; field before you manipulate it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set doNotCache = clone(entry.mainBody).type('form').all()|length or craft.retour.getHttpStatus != 200 ? true : false %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-19T21:26:25.527" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28892" PostTypeId="1" CreationDate="2018-12-20T10:46:22.753" Score="2" ViewCount="407" Body="&lt;p&gt;I would like to display dynamic content in the middle of a text block. For example, a list of entries pulled in from the backend, in the middle of content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Wordpress we can use Shortcodes. Does Craft have something similar? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I just add an include statement to include a template? (I cant get this working using normal twig include code). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could create a new field for someone to add in in between two other text block fields, but its quote over the top for what should be a simple include statement to include a template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="4993" LastEditDate="2018-12-27T18:36:20.000" LastActivityDate="2018-12-27T23:01:18.550" Title="How to include twig in the editor? e.g. Shortcodes for dynamic content" Tags="&lt;include&gt;&lt;editor&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28893" PostTypeId="2" ParentId="28878" CreationDate="2018-12-20T12:18:29.143" Score="2" Body="&lt;p&gt;Turns our it was this line causing the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'collapsed' =&amp;gt; true,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Removed it and all works as expected.&lt;/p&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2018-12-20T12:18:29.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28894" PostTypeId="2" ParentId="28859" CreationDate="2018-12-20T12:19:33.730" Score="1" Body="&lt;p&gt;I solved this by overriding the routes set by craft commerce and extend the OrderController and the Order element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a good solution (I'm going upload this as a plugin) and if several plugins overwrite the same route, only the latest plugin will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone have a proper solution I'll accept that. I'll leave this answer here in the meantime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin::init()&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function (RegisterUrlRulesEvent $event) {&#xA;        $event-&amp;gt;rules['commerce/orders'] = 'commerce-easy-order-management/orders/order-index';&#xA;        $event-&amp;gt;rules['commerce/orders/&amp;lt;orderId:\d+&amp;gt;'] = 'commerce-easy-order-management/orders/edit-order';&#xA;        $event-&amp;gt;rules['commerce/orders/action/&amp;lt;orderId:\d+&amp;gt;'] = 'commerce-easy-order-management/orders/order-action';&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;controllers\OrdersController&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class OrdersController extends \craft\commerce\controllers\OrdersController&#xA;{&#xA;    /**&#xA;     * Index of Orders&#xA;     * Overwriting commerce/controllers/OrderController::actionOrderIndex()&#xA;     *&#xA;     * @return Response&#xA;     * @throws \Throwable&#xA;     */&#xA;    public function actionOrderIndex(): Response&#xA;    {&#xA;        // Remove all incomplete carts older than a certain date in config.&#xA;        Plugin::getInstance()-&amp;gt;getCarts()-&amp;gt;purgeIncompleteCarts();&#xA;&#xA;        Craft::$app-&amp;gt;view-&amp;gt;registerCssFile('https://use.fontawesome.com/releases/v5.3.1/css/all.css');&#xA;&#xA;        return $this-&amp;gt;renderTemplate('commerce-easy-order-management/orders/_index');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;elements\Order&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Order extends \craft\commerce\elements\Order&#xA;{&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    public function getTableAttributeHtml(string $attribute): string&#xA;    {&#xA;        if($attribute !== 'orderActions') return parent::getTableAttributeHtml($attribute);&#xA;        return 'MyActionHTML';&#xA;    }&#xA;&#xA;    /**&#xA;     * @inheritdoc&#xA;     */&#xA;    protected static function defineTableAttributes(): array&#xA;    {&#xA;        $attributes = parent::defineTableAttributes();&#xA;        $attributes['orderActions'] = ['label' =&amp;gt; Craft::t('commerce', 'Actions')];&#xA;        return $attributes;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;templates/orders/_index.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/elementindex&quot; %}&#xA;&#xA;{% set title = &quot;Orders&quot;|t('commerce') %}&#xA;{% set docTitle = title~' - '~'Commerce' %}&#xA;{% set elementType = 'MY_NAMESPACE\\elements\\Order' %} &#xA;{% set selectedTab = 'orders' %}&#xA;{% set selectedSubnavItem = &quot;orders&quot; %}&#xA;{% set bodyClass = (bodyClass is defined ? bodyClass~' ' : '') ~ &quot;commerceorders     commerceordersindex&quot; %}&#xA;&#xA;{% do craft.app.view.registerTranslations('commerce', [&#xA;    &quot;Total Revenue&quot;,&#xA;    &quot;Last 7 days&quot;,&#xA;    &quot;Last 30 days&quot;,&#xA;    &quot;Last Week&quot;,&#xA;    &quot;Last Month&quot;,&#xA;    &quot;Custom Range&quot;,&#xA;    &quot;Apply&quot;&#xA;]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8864" LastEditorUserId="8864" LastEditDate="2018-12-21T08:32:17.237" LastActivityDate="2018-12-21T08:32:17.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28895" PostTypeId="2" ParentId="28892" CreationDate="2018-12-20T12:31:49.713" Score="3" Body="&lt;p&gt;The typical 'Craft' way of doing this would be via a Matrix field instead of a single text block field, so that editors can sandwich the dynamic content (which would be its own block type) in between whatever other block types they select. That way is very powerful, flexible, extensible, and clean...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, assuming migrating your content to a Matrix setup would be too onerous or undesirable for other reasons, there's nothing to stop you creating your own basic shortcode replacement functionality via Twig's &lt;code&gt;replace&lt;/code&gt; filter. For example, in your body field you might insert arbitrary markers like &lt;code&gt;[list-of-entries]&lt;/code&gt;... then in the template that outputs the field, you can go to town with defining what each shortcode represents and then &lt;code&gt;replace&lt;/code&gt; them like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listOfEntries %}&#xA;    &amp;lt;ul&amp;gt;&#xA;        {% for item in craft.entries.section('something').all %}&#xA;            &amp;lt;li&amp;gt;{{ item.title }}&amp;lt;/li&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/ul&amp;gt;&#xA;{% endset %}&#xA;&#xA;{% set parsedBody = entry.body|replace({&#xA;    &quot;[dynamic-address-injection]&quot; : craft.entries.section('something').one().addressField,&#xA;    &quot;[video]&quot; : entry.videos.one().embedCode,&#xA;    &quot;[list-of-entries]&quot; : listOfEntries&#xA;}) %}&#xA;&#xA;{{ parsedBody }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="271" LastActivityDate="2018-12-20T12:31:49.713" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28896" PostTypeId="2" ParentId="28867" CreationDate="2018-12-20T13:19:40.510" Score="4" Body="&lt;p&gt;The cart is not baked into \Craft, but craft\commerce\Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$cart = craft\commerce\Plugin::getInstance()-&amp;gt;getCarts()-&amp;gt;getCart();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Uses the &lt;a href=&quot;https://docs.craftcms.com/commerce/api/v2/craft-commerce-services-carts.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;following function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Get the current cart for this session.&#xA; *&#xA; * @param bool $forceSave Force the cart to save when requesting it.&#xA; * @return Order&#xA; * @throws Exception&#xA; * @throws \Throwable&#xA; * @throws \craft\errors\ElementNotFoundException&#xA; */&#xA;public function getCart($forceSave = false): Order&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8864" LastActivityDate="2018-12-20T13:19:40.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28897" PostTypeId="1" AcceptedAnswerId="28984" CreationDate="2018-12-20T13:22:07.913" Score="2" ViewCount="149" Body="&lt;p&gt;Currently using Craft Commerce 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if it's possible to order products by the lowest priced variant. I have tried something along the lines of this, but it doesn't do anything different with the ordering:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.products.type('accommodation').all() %}&#xA;&#xA;{% for product in products %}&#xA;   {% if product.getVariants()|length %}&#xA;&#xA;        {% set variants = craft.variants ({&#xA;            product: product,&#xA;            orderBy: 'price asc'&#xA;        }) %}&#xA;&#xA;        {% for purchasable in variants %}&#xA;            // Products Here&#xA;        {% endfor %}&#xA;&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have also tried something else along the lines of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.commerce.products({&#xA;    relatedTo: 'accommodation', &#xA;    order: 'defaultPrice asc',&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2018-12-20T14:13:47.297" LastActivityDate="2019-01-02T14:18:48.517" Title="Order products by lowest product variant" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;order&gt;&lt;variants&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28898" PostTypeId="1" AcceptedAnswerId="29015" CreationDate="2018-12-20T14:20:22.093" Score="1" ViewCount="123" Body="&lt;p&gt;I'm creating a new user using &lt;code&gt;$user-&amp;gt;setContentFromPost()&lt;/code&gt;. It all works fine except I can't attach an entry to an Entries field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new UserModel();&#xA;$user-&amp;gt;username         = $email;&#xA;$user-&amp;gt;email            = $email;&#xA;$user-&amp;gt;unverifiedEmail  = $email;&#xA;&#xA;$user-&amp;gt;setContentFromPost(array(&#xA;  'companyName' =&amp;gt; $admin-&amp;gt;companyName, &#xA;  'companyId' =&amp;gt; $admin-&amp;gt;companyId, &#xA;  'partnerManager[]' =&amp;gt; $admin-&amp;gt;partnerManager[0]-&amp;gt;id&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will create user but the &lt;code&gt;partnerManager&lt;/code&gt; Entries field will be empty. I've tried a few different syntax variations, but none of them seem to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'fields[partnerManager][]' =&amp;gt; $admin-&amp;gt;partnerManager[0]-&amp;gt;id&#xA;'partnerManager' =&amp;gt; $admin-&amp;gt;partnerManager[0]-&amp;gt;id&#xA;'partnerManager[0]' =&amp;gt; $admin-&amp;gt;partnerManager[0]-&amp;gt;id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to fill this field?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="157" LastEditDate="2019-01-07T11:49:46.753" LastActivityDate="2019-01-07T11:49:46.753" Title="Adding entry type using setContentFromPost" Tags="&lt;plugin-development&gt;&lt;usermodel&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28899" PostTypeId="1" AcceptedAnswerId="28902" CreationDate="2018-12-20T17:21:19.177" Score="2" ViewCount="98" Body="&lt;p&gt;I'm working with a Structure of resort locations. Each resort has a field &lt;code&gt;address&lt;/code&gt; which is a Smart Map field. I'm trying to create an initial display page that groups the resorts based on their state (a Smart Map address part), but I would like to order the output first based on the state and then by resort title.&lt;/p&gt;&#xA;&lt;p&gt;Something like.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Arkansas&lt;/li&gt;&#xA;&lt;li&gt;Awesome Place&lt;/li&gt;&#xA;&lt;li&gt;Best Place&lt;/li&gt;&#xA;&lt;li&gt;Alabama&lt;/li&gt;&#xA;&lt;li&gt;Alright Place&lt;/li&gt;&#xA;&lt;li&gt;Better Place&lt;/li&gt;&#xA;&lt;li&gt;Florida&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I'm partially there using the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% set resorts = craft.entries().section('resortsList').orderBy('title ASC').all() %}&#xA;{% set resortsByState = resorts|group('address.state') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And then outputting the list...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{% for state, resortsInState in resortsByState %}&#xA;  &amp;lt;h2&amp;gt;{{ state }}&amp;lt;/h2&amp;gt;&#xA;  {% for resort in resortsInState %}&#xA;    &amp;lt;p&amp;gt;{{ resort.link }} - {{ resort.address.state }}&amp;lt;/p&amp;gt;&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This gives me the list grouped by the state and ordered by the resort title which gets me partially there. I've tried adding &lt;code&gt;address.state&lt;/code&gt; as part of the ordering declaration, but I'm only getting errors (Unknown column 'address.state' in 'order clause'). Is there a proper way I should be doing this?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="45" LastEditDate="2021-01-01T07:16:12.990" LastActivityDate="2021-01-01T07:16:12.990" Title="Set OrderBy on Grouped Query Involving Smart Map Field" Tags="&lt;ordering&gt;&lt;plugin-smartmap&gt;&lt;group&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28900" PostTypeId="1" CreationDate="2018-12-20T18:24:07.737" Score="0" ViewCount="46" Body="&lt;p&gt;I have a site running Craft 2.7.3. My update flow is to make sure that my development branch is up to date (with no outstanding commits) and that my local db is up to date with production. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then log in to my development site (site.localhost) and click the Update button. Changes are tested. I then commit the updated files and merge/push to staging and then to production. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Occasionally, updating staging and production will require visiting /admin to trigger a db update. This doesn't seem to be the case with the update from 2.7.3 to 2.7.4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, development has been updated to 2.7.4. I then committed and pushed to staging. However, when I log in to the CP on staging, I still see an update badge and the system is telling me that I need to update to 2.7.4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have verified that the files changed as a result of updating to 2.7.4 have been deployed to the server. Specifically, I can see that &lt;code&gt;craft/app/Info.php&lt;/code&gt; defines the &lt;code&gt;CRAFT_VERSION&lt;/code&gt; constant as 2.7.4. When I log into the staging db and check the &lt;code&gt;craft_info&lt;/code&gt; table, I see that the value in the &lt;code&gt;version&lt;/code&gt; column is still 2.7.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have subsequently clicked the &quot;check for updates&quot; links in the CP multiple times, but the system never recognizes the update to 2.7.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, I have also used Settings &gt; Clear Caches just in case, but that hasn't had any effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3954" LastActivityDate="2018-12-20T18:24:07.737" Title="CP doesn't recognize update from 2.7.3 to 2.7.4" Tags="&lt;updates&gt;&lt;craft2&gt;&lt;auto-updates&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28901" PostTypeId="1" AcceptedAnswerId="28904" CreationDate="2018-12-20T18:33:56.520" Score="3" ViewCount="131" Body="&lt;p&gt;I'm using a migration script to clear out the values for a field on one of my entries. The field is an Entry Field and is not required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;components = [];&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 1 passed to craft\fields\BaseRelationField::_all() must&#xA;  implement interface craft\elements\db\ElementQueryInterface, array&#xA;  given, called in&#xA;  /var/www/html/vendor/craftcms/cms/src/fields/BaseRelationField.php on&#xA;  line 382&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can clear out other fields, even entry fields, just fine. But this particular one gives me this error every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;components = null;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;components = false;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2018-12-21T00:24:31.167" Title="Error clearing a field via migration script" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28902" PostTypeId="2" ParentId="28899" CreationDate="2018-12-20T21:30:31.190" Score="2" Body="&lt;p&gt;Okay, I've been able to solve this and figured I'd share what I discovered. The key for each group is the value of the state so really what I was after here was a key sort and just didn't realize it. So I found Michael Rog's &quot;&lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperSort&lt;/a&gt;&quot; plugin which has a twig filter for running a ksort and that addressed it perfectly for me making a small adjustment to use supersort in the response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set resorts = craft.entries().section('resortsList').orderBy('title ASC').all() %}&#xA;{% set resortsByState = resorts|group('address.state')|supersort('ksort') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm interested in other solutions too that don't require a plugin, but this particular direction got things going for me.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2018-12-20T22:06:23.010" LastActivityDate="2018-12-20T22:06:23.010" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28903" PostTypeId="1" AcceptedAnswerId="28947" CreationDate="2018-12-20T23:22:34.737" Score="1" ViewCount="168" Body="&lt;p&gt;I'm trying to group entries by user on my front-end. I've got so far but I can't seem to get any further to my goal of &lt;code&gt;displaying what type of entries they have posted e.g. lifestyle or tech.&lt;/code&gt; to do this I need to get the &lt;code&gt;users entries&lt;/code&gt; and query a &lt;code&gt;service&lt;/code&gt; dropdown field, if they have &lt;code&gt;lifestyle&lt;/code&gt; selected in multiple entries only display 1x tag showing the user has &lt;code&gt;lifestyle&lt;/code&gt; posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I'm just trying to query each user's entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listings = craft.entries.section('listings') %}&#xA;{% set users = craft.users.group('influencer').all() %}&#xA;&#xA;&#xA;      {% for user in users %}&#xA;&#xA;          {% if user.getPhoto() %}&#xA;              &amp;lt;img class=&quot;img-fluid rounded-circle&quot; src=&quot;{{ user.getPhoto().getUrl('thumbnail') }}&quot;&amp;gt;&#xA;          {% else %}&#xA;              &amp;lt;img class=&quot;img-fluid rounded-circle&quot; src=&quot;{{ url('images/user-ph.png') }}&quot;&amp;gt;&#xA;          {% endif %}&#xA;&#xA;            &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ user.username }}&amp;lt;/h5&amp;gt;&#xA;            &amp;lt;small&amp;gt;{{ user.location }}&amp;lt;/small&amp;gt;&#xA;            &amp;lt;p class=&quot;card-text&quot;&amp;gt;{{ user.richText }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% for user, entries in craft.entries.find() | group('users') %}&#xA;          {% for entry in entries %}&#xA;            {{ entry.title }}&#xA;          {% endfor %}&#xA;        {% endfor %}&#xA;&#xA;      {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2018-12-20T23:53:30.060" LastActivityDate="2018-12-27T14:16:41.737" Title="Display Entries Belonging to User" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28904" PostTypeId="2" ParentId="28901" CreationDate="2018-12-21T00:24:31.167" Score="4" Body="&lt;p&gt;I figured it out. I'm not sure understand the why of it. But here is the how:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;setFieldValue('components', []);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess setFieldValue() does some other stuff in it that the magic methods do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more you know! :)&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2018-12-21T00:24:31.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28905" PostTypeId="1" CreationDate="2018-12-21T06:30:54.497" Score="1" ViewCount="59" Body="&lt;p&gt;We are having issues staying logged in to Craft (2.6). There was a plugin error which is what we thought was causing the issues, so we removed the sprout SEO plugin. However the error still persists. We keep getting kicked out, and sometimes the words 'unkown error' pop up. We have not bee able to load any new content due to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please may you assist us urgently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks you so much,&#xA;Ashton &lt;/p&gt;&#xA;" OwnerUserId="9183" LastEditorUserId="115" LastEditDate="2018-12-21T15:50:09.527" LastActivityDate="2019-05-22T03:02:11.797" Title="Craft 2.6 Session Issues" Tags="&lt;cache&gt;&lt;session&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28906" PostTypeId="1" CreationDate="2018-12-21T10:20:05.833" Score="2" ViewCount="197" Body="&lt;p&gt;After installing craft on apache server, when I try to access control panel using &lt;code&gt;web/admin&lt;/code&gt;, serwer throws 404 error.&#xA;I didnt changed &lt;code&gt;cpTrigger&lt;/code&gt; setting. Default craft template that displays after installation is displayed correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;.htaccess&lt;/code&gt; file in &lt;code&gt;web&lt;/code&gt; directory was not modified in any way, its contents are default:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;&#xA;    RewriteEngine On&#xA;&#xA;    # Send would-be 404 requests to Craft&#xA;    RewriteCond %{REQUEST_FILENAME} !-f&#xA;    RewriteCond %{REQUEST_FILENAME} !-d&#xA;    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;    RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="8366" LastEditDate="2018-12-21T16:23:02.423" LastActivityDate="2019-01-20T17:03:10.660" Title="Cannot find control panel after installation" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28907" PostTypeId="1" CreationDate="2018-12-21T15:10:05.400" Score="1" ViewCount="51" Body="&lt;p&gt;I'd like to change the entry type that's pre-selected when creating a new entry depending on the site that's being edited (doing that with JS).&#xA;In control panel, does anyone know how I can trigger the &lt;code&gt;Craft.EntryTypeSwitcher&lt;/code&gt; &lt;code&gt;change&lt;/code&gt; event? I can detect which site is currently being edited and I can change the value of the Entry Type dropdown, but I don't know how to trigger the event that then reloads the page to get the fields for that entry type. I'm assuming I need something similar to this: &lt;a href=&quot;https://craftcms.stackexchange.com/a/25828/6516&quot;&gt;https://craftcms.stackexchange.com/a/25828/6516&lt;/a&gt; (it's just that I need to trigger an event and not hook up to it)? Does anyone know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="6516" LastActivityDate="2018-12-21T15:10:05.400" Title="Pre-select entry type based on site being edited" Tags="&lt;craft3&gt;&lt;control-panel&gt;&lt;garnish&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28908" PostTypeId="2" ParentId="28906" CreationDate="2018-12-21T15:24:25.473" Score="1" Body="&lt;p&gt;Web is the public web folder if you followed the recommended install location, so the link to login is just /admin, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://your-domain/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://your-domain/admin&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2018-12-21T15:24:25.473" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28910" PostTypeId="1" AcceptedAnswerId="28911" CreationDate="2018-12-21T19:35:22.453" Score="1" ViewCount="297" Body="&lt;p&gt;I'm trying to add a product to a cart (and emptying the cart first) if a user just visits a template. My goal is to make a one-page checkout: so I want the address info on the product page itself. This is what I have so far. I thought the first line would make a cart if there is no cart yet, but it seems nothing happens. (&lt;code&gt;cart.id&lt;/code&gt; = &lt;code&gt;null&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.carts.cart %}&#xA;Cart ID is {{ cart.id }}&#xA;{% do cart.setLineItems([]) %}&#xA;{% set lineItem = craft.commerce.lineitems.resolveLineItem(cart.id, product.id, [], 1, '') %}&#xA;{% do cart.addLineItem(lineItem) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2018-12-21T21:22:31.453" Title="Trying to automatically add a product in Commerce" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28911" PostTypeId="2" ParentId="28910" CreationDate="2018-12-21T21:22:31.453" Score="1" Body="&lt;p&gt;I tried this myself and it threw an error when there was no cart attached to the session.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then found these two lines of code in the Craft Commerce &lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/src/controllers/CartController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;CartController.php&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        // Get the cart from the current users session, or return a new cart attached to the session&#xA;        $cart = Plugin::getInstance()-&amp;gt;getCarts()-&amp;gt;getCart(true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;getCart() can be found in the &lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/src/services/Carts.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Carts Service&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which lead me to try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.carts.cart(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if you pass in true, you force it to save the cart and thus you seem to be able to create a new (empty) cart.&lt;/p&gt;&#xA;" OwnerUserId="7751" LastActivityDate="2018-12-21T21:22:31.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28912" PostTypeId="2" ParentId="28905" CreationDate="2018-12-22T00:13:45.730" Score="1" Body="&lt;p&gt;There are several reasons (mostly environmental) why a person would be logged out from the CP discussed in these posts (along with fixes/workarounds):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/952/craft-constantly-logging-out-from-admin-area&quot;&gt;Craft constantly logging out from admin area&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/9628/migrated-server-now-getting-logged-out-constantly&quot;&gt;Migrated Server, Now Getting Logged Out Constantly&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/17289/keep-on-getting-logged-out-when-deploying-using-capistano&quot;&gt;Keep on getting logged out when deploying using Capistano&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/22226/users-are-always-logged-out-on-front-end&quot;&gt;Users are always logged out on front end&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/21324/load-balancing-craft-cms-admin-gets-logged-out-instantly&quot;&gt;Load Balancing Craft CMS - Admin gets logged out instantly&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start by reviewing those.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;and sometimes the words 'unknown error' pop up.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My hunch is it's related to your session issues, but you can check your &lt;code&gt;craft/storage/runtime/logs&lt;/code&gt; folder for the underlying error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also related and may be helpful:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/the-case-of-the-missing-php-session&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Case of the Missing PHP Session&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastEditorUserId="819" LastEditDate="2018-12-23T01:34:10.630" LastActivityDate="2018-12-23T01:34:10.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28913" PostTypeId="1" CreationDate="2018-12-22T00:17:16.003" Score="1" ViewCount="86" Body="&lt;p&gt;If you insert an image in a Rich Text field you get an option to apply a transform, but that is not true when using an Asset field to choose an image, which seems strange. Is there any way to accomplish that?&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2018-12-22T05:19:22.310" Title="Select Transform Feature with Asset Field" Tags="&lt;image-transforms&gt;&lt;image&gt;&lt;assets-field&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28914" PostTypeId="2" ParentId="28913" CreationDate="2018-12-22T05:19:22.310" Score="1" Body="&lt;p&gt;Asset fields require a transform to be set manually in the template or can be Created in the dashboard and the transform name used in the template.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set thumb = {&#xA;    mode: 'crop',&#xA;    width: 100,&#xA;    height: 100,&#xA;    quality: 75,&#xA;    position: 'top-center'&#xA;} %}&#xA;&#xA;&amp;lt;img src=&quot;{{ asset.getUrl(thumb) }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-22T05:19:22.310" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28915" PostTypeId="1" AcceptedAnswerId="28917" CreationDate="2018-12-22T14:04:17.493" Score="1" ViewCount="4391" Body="&lt;p&gt;I had a problem with my cloud server and all my sites were generating 500 errors. The response page the visitor saw varied between Craft 2, Craft 3 and ExpressionEngine 2 sites.&#xA;The Craft 3 ones showed:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]:&#xA;  General error: 1 Can't create/write to file '/tmp/#sql3fa0.MYI'&#xA;  (Errcode: 28)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Some showed what I think is the generic cPanel page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Internal Server Error&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The server encountered an internal error or misconfiguration and was&#xA;  unable to complete your request.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Please contact the server administrator at webmaster@scottish6days.com&#xA;  to inform them of the time this error occurred, and the actions you&#xA;  performed just before this error.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;More information about this error may be available in the server error&#xA;  log.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Additionally, a 500 Internal Server Error error was encountered while&#xA;  trying to use an ErrorDocument to handle the request.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Others a blank page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now want to have a nice/useful/descriptive 500 error page shown if it happens again.&#xA;So after reading up on this, in particular, the &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt; NY Studio 107 article on error pages&lt;/a&gt; I want to be able to test if my new 500 error page does get shown when there is a real 500 error situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hosting company suggested adding a 500.html file in the public_html, adding ErrorDocument 500 /500.html to my .htaccess and creating a script file with this in it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;ini_set('display_errors', 0);&#xA;throw new Exception('Test');&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and calling it in the browser, but it didn't work. Their response was:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sorry, in this case the HTTP 500 error is not caught by Apache in a&#xA;  way it can handle it. There are ways of doing PHP error handling in&#xA;  PHP, but it will depend on the application to do it for you.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any suggestions as to how to test that it's all working properly?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2018-12-24T14:01:00.870" Title="How can I test my 500 error page works" Tags="&lt;error-message&gt;&lt;error-templates&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28916" PostTypeId="2" ParentId="28873" CreationDate="2018-12-22T14:57:19.627" Score="0" Body="&lt;p&gt;Link styling is done with CSS. In your case, you should to narrow your styling to links that are within your &quot;body-copy&quot; div that wraps your CMS content. If you apply this CSS rule:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a { text-decoration: underline; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will see underlines on every &quot;a&quot; element on the page. If you apply this CSS rule, you'll only see underlines on links within the &quot;body-copy&quot; div:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.body-copy a { text-decoration: underline; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-12-22T14:57:19.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28917" PostTypeId="2" ParentId="28915" CreationDate="2018-12-22T15:00:18.793" Score="1" Body="&lt;p&gt;Any chance you're out of disk space? That error shows that it can't create a file in &lt;code&gt;/tmp&lt;/code&gt; which means either the permissions on &lt;code&gt;/tmp&lt;/code&gt; are wrong, or potentially you're out of disk space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c.f.: &lt;a href=&quot;https://stackoverflow.com/questions/11997012/mysql-cant-create-write-to-file-tmp-sql-3c6-0-myi-errcode-2-what-does&quot;&gt;https://stackoverflow.com/questions/11997012/mysql-cant-create-write-to-file-tmp-sql-3c6-0-myi-errcode-2-what-does&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the error page, if you just want to view the page, you can navigate to it directly... if you want to force a 500 error to happen, just change the db password in your .env to something that doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-12-24T14:01:00.870" LastActivityDate="2018-12-24T14:01:00.870" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="28918" PostTypeId="1" CreationDate="2018-12-22T15:09:03.010" Score="1" ViewCount="189" Body="&lt;p&gt;Assume my website (developed using Craft, of course) is expected to have 1000 concurrent access. How many MySQL db connections would be required to open? Does Craft control this or does it depend on program code?&lt;/p&gt;&#xA;" OwnerUserId="9186" LastEditorUserId="57" LastEditDate="2018-12-26T23:07:43.653" LastActivityDate="2018-12-26T23:07:43.653" Title="# of MySQL connections" Tags="&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28919" PostTypeId="2" ParentId="28918" CreationDate="2018-12-22T15:37:50.827" Score="2" Body="&lt;p&gt;In MySQL, there's a &quot;max_connections&quot; variable: &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Apache (assuming you're using Apache) there's a &quot;MaxClients&quot; directive: &lt;a href=&quot;http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://web.archive.org/web/20160415001028/http://www.genericarticles.com/mediawiki/index.php?title=How_to_optimize_apache_web_server_for_maximum_concurrent_connections_or_increase_max_clients_in_apache&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure of your situation, but you may need to modify both of these to achieve what you need. These settings are not controlled through CraftCMS, but instead need to be controlled by editing your server environment configs.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2018-12-22T15:43:48.597" LastActivityDate="2018-12-22T15:43:48.597" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28922" PostTypeId="1" AcceptedAnswerId="28923" CreationDate="2018-12-23T02:05:37.400" Score="1" ViewCount="242" Body="&lt;p&gt;How do I pull in entries from every site? I can't even seem to pass more than one argument to the &lt;code&gt;.siteId&lt;/code&gt; parameter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({ &#xA;    section: 'resources', &#xA;    siteId: [1,2,3],&#xA;}).all %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gives me the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Argument 2 passed to craft\services\Elements::getPlaceholderElement()&#xA;  must be of the type integer, array given&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({ &#xA;    section: 'resources', &#xA;    siteId: craft.app.sites.allSiteIds,&#xA;}).all %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But got the same error. &lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2018-12-23T02:29:59.373" Title="Get Entries from Every Site" Tags="&lt;templating&gt;&lt;entries&gt;&lt;sites&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28923" PostTypeId="2" ParentId="28922" CreationDate="2018-12-23T02:29:59.373" Score="2" Body="&lt;p&gt;Per current conversation on Github, this isn’t possible. &lt;a href=&quot;https://github.com/craftcms/cms/issues/2854&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2854&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5501" LastActivityDate="2018-12-23T02:29:59.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28926" PostTypeId="1" CreationDate="2018-12-24T10:51:36.990" Score="2" ViewCount="339" Body="&lt;p&gt;I'm having a very hard time making a one-page checkout. What I actually want is: automatically add the item to the cart. The cart can only contain one item. On the product page (that automatically adds the item to the cart) I want name and address fields and that's it. A pay button below that redirects to the payment gateway. This is what I have now, but the page keeps redirecting to the same page instead of going to the payment gateway.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set cart = craft.commerce.getCarts().getCart(true)%}&#xA;{% do cart.setLineItems([]) %}&#xA;{% set lineItem = craft.commerce.lineitems.resolveLineItem(cart.id, product.defaultVariant.id, [], 1, '') %}&#xA;{% do cart.addLineItem(lineItem) %}&#xA;&amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/payments/pay&quot;/&amp;gt;&#xA;{{ redirectInput('/shop/customer/order?number='~cart.number) }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;cancelUrl&quot; value=&quot;{{ '/shop/checkout/payment'|hash }}&quot;/&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;orderEmail&quot; value=&quot;bart.rylant+ordermail@gmail.com&quot;/&amp;gt;&#xA;{{ csrfInput() }}&#xA;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[firstName]&quot; value=&quot;dsfdsfsd&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; name=&quot;shippingAddress[lastName]&quot; value=&quot;sdfsdfsfsdfs&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingAddress[countryId]&quot; value=&quot;166&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-address1&quot; name=&quot;shippingAddress[address1]&quot; value=&quot;straatnaam nummer&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-city&quot; name=&quot;shippingAddress[city]&quot; value=&quot;Gemeente&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-zipCode&quot;name=&quot;shippingAddress[zipCode]&quot; value=&quot;2910&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;text&quot; id=&quot;shippingAddress-phone&quot; name=&quot;shippingAddress[phone]&quot; value=&quot;4545546544654465&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;email&quot; id=&quot;email&quot; name=&quot;email&quot; value=&quot;testmailsdfsdfsd@gmail.com&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;shippingMethodHandle&quot; value=&quot;freeShipping&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; id=&quot;paymentMethod&quot; name=&quot;paymentMethod&quot; value=&quot;gateway:2&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; value=&quot;Pay&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2018-12-27T19:32:09.127" Title="Same-page checkout" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28927" PostTypeId="1" CreationDate="2018-12-24T15:47:48.720" Score="3" ViewCount="182" Body="&lt;p&gt;I have a staging site that has the &lt;code&gt;isSystemOn&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt; since I don't want people to stumble upon the site and be able to view content. I would like to have &lt;strong&gt;1&lt;/strong&gt; page still &quot;visible&quot; though. This URL would a simple &lt;em&gt;health check&lt;/em&gt; page, that I direct a monitoring service to check on. I'm stumped at overriding a system level &lt;code&gt;isSystemOn&lt;/code&gt; config setting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I have &lt;code&gt;staging.example.com/my-secret-health-check-url&lt;/code&gt; return a valid code of &lt;code&gt;200&lt;/code&gt; so my monitoring service can correctly see that my staging site is working?&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2018-12-26T12:20:04.447" Title="Overriding isSystemOn setting for a single page" Tags="&lt;craft3&gt;&lt;config&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28928" PostTypeId="2" ParentId="28927" CreationDate="2018-12-24T16:29:47.143" Score="2" Body="&lt;p&gt;Just have that page not be in the CMS. Create something like &lt;code&gt;web/ping.html&lt;/code&gt; and point the monitoring service at that static file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it to work anyway, you could have an &lt;code&gt;offline.html&lt;/code&gt; template, and you could change the status code that it returns... but that would be a little weird.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was changed to &lt;code&gt;isSystemLive&lt;/code&gt; btw... more info here: &lt;a href=&quot;https://nystudio107.com/blog/handling-errors-gracefully-in-craft-cms#offline-staging-sites&quot; rel=&quot;nofollow noreferrer&quot;&gt;Handling Errors Gracefully in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2018-12-25T15:07:45.627" LastActivityDate="2018-12-25T15:07:45.627" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28930" PostTypeId="1" CreationDate="2018-12-24T16:31:51.750" Score="2" ViewCount="198" Body="&lt;p&gt;I am trying to update an order's custom field after order complete. &#xA;I set it like this in my plugin:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e) {&#xA;        $order = $e-&amp;gt;sender;&#xA;        $order-&amp;gt;setFieldValue(&quot;customFieldHandle&quot;, &quot;My value&quot;);&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it is not working. I guess I used the wrong method to do it. &lt;/p&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2018-12-24T18:05:34.390" Title="Update an order custom field after order complete in Craft 3" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28931" PostTypeId="2" ParentId="28930" CreationDate="2018-12-24T18:05:34.390" Score="2" Body="&lt;p&gt;What I wrote is correct. I debugged it, and I had a problem in another place where the order did not get completed in the first place. silly me LOL.&#xA;So my answer is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e) {&#xA;    $order = $e-&amp;gt;sender;&#xA;    $order-&amp;gt;setFieldValue(&quot;customFieldHandle&quot;, &quot;My value&quot;);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2018-12-24T18:05:34.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28933" PostTypeId="2" ParentId="20751" CreationDate="2018-12-25T14:34:37.200" Score="1" Body="&lt;p&gt;I used the &lt;a href=&quot;https://github.com/aelvan/Preparse-Field-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;preparse plugin&lt;/a&gt; to save a date value from a SuperTable field into a static field as 'yyyymmdd'. I could then sort my entries based on that static field.&lt;/p&gt;&#xA;" OwnerUserId="6453" LastActivityDate="2018-12-25T14:34:37.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28934" PostTypeId="1" AcceptedAnswerId="28939" CreationDate="2018-12-25T19:48:33.687" Score="2" ViewCount="353" Body="&lt;p&gt;In &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/content-mapping/field-types#assets&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/content-mapping/field-types#assets&lt;/a&gt; the documentation says yes, but I cannot get it to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also find the documentation confusing: &quot;You should supply the filename only, excluding the full path to the asset&quot;. How can it even know where to get the file then?&lt;/p&gt;&#xA;" OwnerUserId="8743" LastActivityDate="2018-12-26T20:59:39.507" Title="Verbb Feed Me for Craft 3 - Possible to read assets from local disk?" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28935" PostTypeId="2" ParentId="28927" CreationDate="2018-12-26T12:20:04.447" Score="5" Body="&lt;p&gt;I realized there is a simpler solution after stepping away from this issue for a bit. There is one page that still returns a 200 code on a Craft site even when the &lt;code&gt;isSystemOn&lt;/code&gt; (or &lt;code&gt;isSystemLive&lt;/code&gt; as of Craft 3.1) is &lt;code&gt;false&lt;/code&gt;. Using the &lt;strong&gt;control panel login page&lt;/strong&gt; as a health check url is the solution. &lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2018-12-26T12:20:04.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28936" PostTypeId="1" AcceptedAnswerId="28937" CreationDate="2018-12-26T14:06:55.707" Score="3" ViewCount="1650" Body="&lt;p&gt;I have a number field used for episode numbers and I would like to automatically add a leading zero when the number is less than 10. I have this working with a conditional but it seems inefficient. Is there a twig filter that I don't know about that does this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry.episodeNumber &amp;lt; &quot;10&quot; %}&#xA;    {% set episodeNumber = '0' ~ entry.episodeNumber %}&#xA;{% else %}&#xA;    {% set episodeNumber = entry.episodeNumber %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above works but seems overly long to accomplish what should be a simple task.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="57" LastEditDate="2018-12-27T01:01:48.833" LastActivityDate="2018-12-29T15:09:47.120" Title="Add a Leading Zero with a number field" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28937" PostTypeId="2" ParentId="28936" CreationDate="2018-12-26T16:09:36.527" Score="6" Body="&lt;p&gt;There aren't any filters built in to Craft (or Twig) that does this, but your &lt;code&gt;{% if %}&lt;/code&gt; conditional could be trimmed down to a single-line &lt;em&gt;ternary operation&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set episodeNumber = (entry.episodeNumber &amp;lt; 10 ? '0') ~ entry.episodeNumber %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;span&amp;gt;{{ (entry.episodeNumber &amp;lt; 10 ? '0') ~ entry.episodeNumber }}&amp;lt;/span&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastEditorUserId="1098" LastEditDate="2018-12-28T11:09:36.240" LastActivityDate="2018-12-28T11:09:36.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28938" PostTypeId="1" AcceptedAnswerId="28944" CreationDate="2018-12-26T20:45:53.070" Score="2" ViewCount="1034" Body="&lt;p&gt;Using &lt;code&gt;replace&lt;/code&gt; filter we can match pattern using regular expressions, but can we use part of the matched string in the second argument of filter? For example, I want to match all numbers and replace each matched number with a matched number enclosed in parentheses.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="57" LastEditDate="2018-12-27T01:03:50.397" LastActivityDate="2018-12-27T01:22:24.430" Title="Twig replace filter - use part of regex match" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28939" PostTypeId="2" ParentId="28934" CreationDate="2018-12-26T20:59:39.507" Score="3" Body="&lt;p&gt;Files and assets are two different concepts. An asset represents a file already in Craft, and you'll be able to search and browse for it in the Assets section. Whereas in a number of different cases, you'll want to create (upload) an asset from a URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an existing asset in Craft already, so you don't want to upload it, then provide just the filename and extension in your feed. This is as per the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to create an asset from a remote URL, you'll need to tick the &quot;Create asset from URL&quot; checkbox in the mapping screen for Feed Me. If you do this option however, you'll need to provide an &lt;strong&gt;absolute URL&lt;/strong&gt; to the file you want to import into Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, with the above in mind, the short answer to your question is that Feed Me doesn't support creating assets from a local path, but it does support it from a local URL. You'll need to change the path in your feed to point to a full URL, which you can achieve by moving it to a folder in your project, or setting up a virtual host in your favourite local dev environment.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-12-26T20:59:39.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28940" PostTypeId="2" ParentId="26575" CreationDate="2018-12-26T21:03:47.480" Score="1" Body="&lt;p&gt;Just by the way, Neo is currently not supported with Feed Me. You're welcome to upvote this feature request - &lt;a href=&quot;https://github.com/verbb/feed-me/issues/335&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/feed-me/issues/335&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-12-26T21:03:47.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28941" PostTypeId="2" ParentId="26282" CreationDate="2018-12-26T21:06:21.157" Score="2" Body="&lt;p&gt;I believe this has been fixed in the latest version of Feed Me (&lt;a href=&quot;https://github.com/verbb/feed-me/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.2.1&lt;/a&gt; at time of writing). Do feel free to comment if not, or get in touch via the &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/support/get-support&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me support channels&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-12-26T21:06:21.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28942" PostTypeId="2" ParentId="26212" CreationDate="2018-12-26T21:08:06.590" Score="1" Body="&lt;p&gt;I believe this has been fixed in the latest version of Feed Me (&lt;a href=&quot;https://github.com/verbb/feed-me/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.2.1&lt;/a&gt; at time of writing). Do feel free to comment if not, or get in touch via the &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/support/get-support&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me support channels&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-12-26T21:08:06.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28943" PostTypeId="2" ParentId="22222" CreationDate="2018-12-26T21:10:20.067" Score="1" Body="&lt;p&gt;I believe this has been fixed in the latest version of Feed Me (&lt;a href=&quot;https://github.com/verbb/feed-me/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.0.2.1&lt;/a&gt; at time of writing). Do feel free to comment if not, or get in touch via the &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/support/get-support&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feed Me support channels&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2018-12-26T21:10:20.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28944" PostTypeId="2" ParentId="28938" CreationDate="2018-12-27T01:22:24.430" Score="2" Body="&lt;p&gt;Craft's &lt;code&gt;replace&lt;/code&gt; filter will just use PHP's &lt;code&gt;preg_replace&lt;/code&gt; method behind the scenes if it detects that a regular expression has been passed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you're looking for the PHP &lt;a href=&quot;https://secure.php.net/manual/en/function.preg-match.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;preg_match&lt;/a&gt; method, which isn't available natively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was &lt;a href=&quot;https://github.com/victor-sm/Craft-TwigPCRE&quot; rel=&quot;nofollow noreferrer&quot;&gt;a plugin&lt;/a&gt; that added support for this in Craft 2, but I don't think it's been ported to Craft 3. You might be able to use that as a starting point if you'd like to port it, though.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-27T01:22:24.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28945" PostTypeId="2" ParentId="28213" CreationDate="2018-12-27T04:04:37.910" Score="3" Body="&lt;p&gt;As someone who theoretically might inherit your site one day... and also as future-you trying to diagnose a problem... please don't try to limit what Craft logs. If you want a quicker way to look for critical problems, check out the Yii2 Debug Toolbar as discussed here &lt;a href=&quot;https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Profiling your Website with Craft CMS 3’s Debug Toolbar&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can use it to very quickly and easily see only errors, or only warnings, and so on. And then if the additional data that Craft logs is needed to help you diagnose a problem, it'll still be there.&lt;/p&gt;&#xA;&lt;p&gt;To learn how to parse the Craft CMS log files quickly, check out the &lt;a href=&quot;https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zen and the Art of Craft CMS Log File Reading&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you do end up wanting to make your own logger, check out the &lt;a href=&quot;https://nystudio107.com/blog/creating-a-custom-logger-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating a Custom Logger for Craft CMS&lt;/a&gt; article&lt;/p&gt;&#xA;&lt;p&gt;I echo Brad's comments, though, unless for some reason &lt;code&gt;devMode&lt;/code&gt; is on, it shouldn't be logging every query, except for performance profiling.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2020-07-16T12:06:35.587" LastActivityDate="2020-07-16T12:06:35.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28946" PostTypeId="2" ParentId="27628" CreationDate="2018-12-27T04:04:57.237" Score="2" Body="&lt;p&gt;When you're creating a new local asset volume, you choose a file system path. I use both the site handle and the section handle in the path. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/assets/&amp;lt;SiteHandle&amp;gt;/images/&amp;lt;SectionHandle&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or, referencing your example (and using 'blog' as a section in your site):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/assets/site1/images/blog&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find that it's important to divide up the assets this way so that if you need to migrate content or backup, it will be much easier to figure out which assets go with which content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the sites share images in common (eg. social icons), I usually make a common folder to hold these above the site level in assets:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/assets/common/images&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I ultimately recommend that instead of local storage, you use Amazon S3 Buckets. It's relatively simple to set up and you'll see much better performance from Amazon's CDNs. You can use this same concept outlined for local files on Amazon S3.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-12-27T04:04:57.237" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28947" PostTypeId="2" ParentId="28903" CreationDate="2018-12-27T14:09:16.740" Score="2" Body="&lt;p&gt;First off, the easiest way to fetch the user's entries is to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.authorId(user.id) %}&#xA;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The way this works is you fetch all the entries that were authored by the current &lt;code&gt;user&lt;/code&gt; in your main &lt;code&gt;for&lt;/code&gt; loop by using &lt;code&gt;authorId(user.id)&lt;/code&gt;. In my opinion, this is a lot cleaner and more performant over what you were trying to accomplish with the  &lt;code&gt;group&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, to answer your question; here's how I would solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, create an empty array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set services = [] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, inside your user's entries &lt;code&gt;for&lt;/code&gt; loop, we'd grab the value of the service field (for each entry) and see if it exists in the &lt;code&gt;services&lt;/code&gt; array. If not, we'll merge it in.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dropdown = entry.service.label %}&#xA;{% if dropdown not in services %}&#xA;     {% set services = services | merge([ dropdown ]) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then we can use this array to display whatever we want on the frontend:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for item in services %}&#xA;    {{ item }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, all together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set users = craft.users.group('influencer').all() %}&#xA;&#xA;{% for user in users %}&#xA;&#xA;    {% if user.getPhoto() %}&#xA;        &amp;lt;img class=&quot;img-fluid rounded-circle&quot; src=&quot;{{ user.getPhoto().getUrl('thumbnail') }}&quot;&amp;gt;&#xA;    {% else %}&#xA;        &amp;lt;img class=&quot;img-fluid rounded-circle&quot; src=&quot;{{ url('images/user-ph.png') }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    &amp;lt;h5 class=&quot;card-title&quot;&amp;gt;{{ user.username }}&amp;lt;/h5&amp;gt;&#xA;    &amp;lt;small&amp;gt;{{ user.location }}&amp;lt;/small&amp;gt;&#xA;    &amp;lt;p class=&quot;card-text&quot;&amp;gt;{{ user.richText }}&amp;lt;/p&amp;gt;&#xA;&#xA;    {% set entries = craft.entries.authorId(user.id) %}&#xA;    {% set services = [] %}&#xA;    {% for entry in entries %}&#xA;        {% set dropdown = entry.services.label %}&#xA;        {% if dropdown not in services %}&#xA;            {% set services = services | merge([ dropdown ]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;&#xA;    {% for item in services %}&#xA;        {{ item }}&#xA;    {% endfor %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2018-12-27T14:16:41.737" LastActivityDate="2018-12-27T14:16:41.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28948" PostTypeId="2" ParentId="28926" CreationDate="2018-12-27T19:32:09.127" Score="2" Body="&lt;p&gt;As Indigo mentions in the comment, the add to cart (items), update cart (with address details) and payment are different controller methods, you would need 3 different calls. The form as you have currently have it, wouldn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though for this to work on onepage checkout, you should not have any restrictions related to the payment method (the payment method is always available for any address, order value etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 ways of achieving it.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Custom route and controller method that incorporates all three different methods calling the related services where your form is submitted. This implementation might be problematic though if not thoroughly tested.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Front end AJAX calls with promises/callbacks that first add to cart, then update   addresses, and then submit the payment. Imho, this is preferred, as you have better control on errors of each call which you can display on the page (stopping the process) and the user does not get confused.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In your case, as you set the cart line items within the template, you can just process 2 calls (update cart with addresses and then payment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="8921" LastActivityDate="2018-12-27T19:32:09.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28949" PostTypeId="2" ParentId="28892" CreationDate="2018-12-27T23:01:18.550" Score="1" Body="&lt;p&gt;There's also the &lt;a href=&quot;https://github.com/samhernandez/craft-shortcodes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shortcodes&lt;/a&gt; plugin&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-27T23:01:18.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28950" PostTypeId="1" AcceptedAnswerId="28952" CreationDate="2018-12-27T23:32:26.553" Score="1" ViewCount="443" Body="&lt;p&gt;I'm trying to clean-up the assets in a specific folder that aren't being used at all, i.e. aren't related to anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got the list O.K. just using this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$assets = Asset::find()-&amp;gt;volume('artists')-&amp;gt;kind('image')-&amp;gt;limit(50000)-&amp;gt;ids();&#xA;&#xA;$assetsToDelete = [];&#xA;&#xA;foreach($assets as $asset) {&#xA;    $results = (new Query())&#xA;        -&amp;gt;select(['id'])&#xA;        -&amp;gt;from(['{{%relations}}'])&#xA;        -&amp;gt;where(['targetId' =&amp;gt; $asset])&#xA;        -&amp;gt;orWhere(['sourceId' =&amp;gt; $asset])&#xA;        -&amp;gt;all();&#xA;&#xA;    if (!count($results)) {&#xA;        $assetsToDelete[]  = $asset;&#xA;    }     &#xA;}&#xA;&#xA;return  $this-&amp;gt;asJson($assetsToDelete);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Right now I'm just returning all the ids in an array but I'm hoping to find a command to delete the element AND delete the stored asset on the server&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="57" LastEditDate="2018-12-28T17:18:05.827" LastActivityDate="2018-12-28T17:18:05.827" Title="How do I delete an asset with module or plugin" Tags="&lt;assets&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28951" PostTypeId="1" CreationDate="2018-12-28T03:23:13.687" Score="1" ViewCount="57" Body="&lt;p&gt;I have a custom plugin set up to speak to Stripe's API and process a card charge.  The code triggers in a &lt;code&gt;craft\elements\Entry::EVENT_AFTER_SAVE&lt;/code&gt; event because I want to pass along certain data about the entry like its ID to Stripe's &lt;code&gt;metadata&lt;/code&gt; parameter.  I figure if the charge fails, it would be fine to have the entry already saved, return the user back to the form with Stripe's error message, and let the user try again, saving the entry again after they correct their card info and resubmit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure how to send this information back to my template with &lt;code&gt;entry&lt;/code&gt; and the error message so I can inform the user instead of passively log an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an abbreviated example of my charge method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function charge($data, $savedEntry)&#xA;{&#xA;    // set Stripe api key&#xA;&#xA;    $settings = [&#xA;        // settings filled with $data&#xA;    ];&#xA;&#xA;    $charge = null;&#xA;&#xA;    // charge the card&#xA;    try {&#xA;        $charge = Stripe\Charge::create($settings);&#xA;    } catch (Stripe\Error\Card $e) {&#xA;        $body = $e-&amp;gt;getJsonBody();&#xA;        $error  = $body['error'];&#xA;&#xA;        // since there's an error, return user to form with $savedEntry and $error['message']&#xA;        // ...&#xA;    }&#xA;&#xA;    return $charge;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2018-12-28T03:23:13.687" Title="Display Stripe card error in Craft 3 front-end entry form template" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;error-message&gt;&lt;frontend-form&gt;&lt;stripe&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28952" PostTypeId="2" ParentId="28950" CreationDate="2018-12-28T05:18:11.890" Score="2" Body="&lt;p&gt;I'm not sure how well it'd go with 50,000 Assets, but you should just be able to call &lt;code&gt;Craft::$app-&amp;gt;elements-&amp;gt;deleteElement($asset)&lt;/code&gt; for each one, or &lt;code&gt;Craft::$app-&amp;gt;elements-&amp;gt;deleteElementById($asset-&amp;gt;id)&lt;/code&gt;, as seen in the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-services-elements.html#method-deleteelement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elements Class Reference&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2018-12-28T05:18:11.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28953" PostTypeId="1" AcceptedAnswerId="28955" CreationDate="2018-12-28T06:05:00.497" Score="2" ViewCount="381" Body="&lt;p&gt;I'm developing locally and adding images to my Amazon S3 bucket. I have the same connection to the bucket on my remote environment. On my local environment, I can see the images I've uploaded, but on my remote environment none of the images that I uploaded locally are showing when I browse assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my remote environment, if I attempt to re-upload the image, I get a message: A file with the name “mylogo.svg” already exists. So I know that the assets field is correctly connected to the bucket in the remote environment.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-12-28T12:54:40.897" Title="Amazon S3 Images not showing up in Assets" Tags="&lt;assets&gt;&lt;s3&gt;&lt;amazon&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28954" PostTypeId="1" CreationDate="2018-12-28T08:53:24.657" Score="1" ViewCount="44" Body="&lt;p&gt;I'm selling the same website build in Craft to multiple clients and was wondering if it is possible to clear all user generated content of an install.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So delete all the entries, categories, assets, globals, ...&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2018-12-28T10:08:28.203" Title="How can I &quot;clear&quot; an entire website" Tags="&lt;install&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28955" PostTypeId="2" ParentId="28953" CreationDate="2018-12-28T09:56:50.797" Score="4" Body="&lt;p&gt;I'd recommend updating the asset indexes via &lt;em&gt;Utilities → Asset Indexes&lt;/em&gt; (or &lt;em&gt;Settings → Update Asset Indexes&lt;/em&gt; if you're on Craft 2) in your Control Panel.&lt;/p&gt;&#xA;" OwnerUserId="5204" LastEditorUserId="5275" LastEditDate="2018-12-28T12:54:40.897" LastActivityDate="2018-12-28T12:54:40.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28956" PostTypeId="2" ParentId="28954" CreationDate="2018-12-28T10:08:28.203" Score="3" Body="&lt;p&gt;You could achieve this using a tool like schematic &lt;a href=&quot;https://github.com/nerds-and-company/schematic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nerds-and-company/schematic&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to generate all your fields and sections from a file without content. Combine this with a migration to seed dummy data (if you need that)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, craft 3.1 will ship with a &lt;a href=&quot;https://github.com/craftcms/cms/blob/3.1/docs/project-config.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Project config&lt;/a&gt; which will do the same thing.&lt;/p&gt;&#xA;" OwnerUserId="5204" LastActivityDate="2018-12-28T10:08:28.203" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28957" PostTypeId="1" CreationDate="2018-12-28T11:04:11.520" Score="1" ViewCount="147" Body="&lt;p&gt;Newbie here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Craft 3 CMS build and fumbling with logic of Matrix blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a relatively simple matrix field, and I can output plain text and dropdown options, but not sure how to do a multiple choice field like checkboxes within a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9193" LastActivityDate="2018-12-28T12:42:14.643" Title="How to output 'selected' checkbox labels within a matrix" Tags="&lt;craft3&gt;&lt;matrix&gt;&lt;checkboxes&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28959" PostTypeId="2" ParentId="28957" CreationDate="2018-12-28T12:42:14.643" Score="1" Body="&lt;p&gt;You'd use the checkbox fields much the same way they would be used if they were added directly to the entry and not in the matrix field. Assuming you've got a basic matrix field structure (using &lt;a href=&quot;https://docs.craftcms.com/v3/matrix-fields.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;if&lt;/code&gt;/&lt;code&gt;else&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/switch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;switch&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for block in entry.myMatrixField.all() %}&#xA;&#xA;    {% switch block.type %}&#xA;&#xA;        {% case &quot;text&quot; %}&#xA;&#xA;            {{ block.textField | markdown }}&#xA;&#xA;        {% case &quot;image&quot; %}&#xA;&#xA;            {{ block.image[0].getImg() }}&#xA;&#xA;        {% case &quot;checkboxes&quot; %}&#xA;&#xA;            // HELP!!!&#xA;&#xA;        {% default %}&#xA;&#xA;            &amp;lt;p&amp;gt;A font walks into a bar.&amp;lt;/p&amp;gt;&#xA;            &amp;lt;p&amp;gt;The bartender says, “Hey, we don’t serve your type in here!”&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could use the same examples that are in the &lt;a href=&quot;https://docs.craftcms.com/v3/checkboxes-fields.html#templating-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; and just switch &lt;code&gt;entry&lt;/code&gt; for the name of your block variable (&lt;code&gt;block&lt;/code&gt; in our case):&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Loop through the checked checkboxes:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in block.checkboxFieldHandle %}&#xA;    Label: {{ option.label }}&#xA;    Value: {{ option }} or {{ option.value }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Loop through all of the available checkboxes:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for option in block.checkboxFieldHandle.options %}&#xA;    Label:   {{ option.label }}&#xA;    Value:   {{ option }} or {{ option.value }}&#xA;    Checked: {{ option.selected ? 'Yes' : 'No' }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;See if any checkboxes are checked:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.checkboxFieldHandle|length %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;See if a particular checkbox is checked:&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if block.checkboxFieldHandle.contains('optionValue') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2018-12-28T12:42:14.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28960" PostTypeId="1" CreationDate="2018-12-28T15:57:01.663" Score="1" ViewCount="302" Body="&lt;p&gt;How can I prevent bots from sending tons of messages from a frontend form, it uses the Craft Guest Entries plugin. I'm using Recaptcha 2 but it only hides the submit button and it doesn't work using Craft 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other solutions (antispam) that I check seems quite old...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="3665" LastEditorUserId="57" LastEditDate="2018-12-28T17:25:18.987" LastActivityDate="2018-12-28T17:28:16.057" Title="Using Recaptcha v2 and Guest Entries plugin" Tags="&lt;craft2&gt;&lt;plugin-guestentries&gt;&lt;plugin-recaptcha&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28961" PostTypeId="2" ParentId="28960" CreationDate="2018-12-28T17:28:16.057" Score="1" Body="&lt;p&gt;I don't have much experience with these, but here are some potential plugins you can look into for Craft 2 that use various anti-spam techniques:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/snaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/snaptcha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/sprout-invisible-captcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/sprout-invisible-captcha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/google-recaptcha&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/google-recaptcha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://straightupcraft.com/craft-plugins/spam-guard&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/craft-plugins/spam-guard&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2018-12-28T17:28:16.057" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28962" PostTypeId="1" AcceptedAnswerId="28969" CreationDate="2018-12-28T20:14:55.623" Score="1" ViewCount="54" Body="&lt;p&gt;We're adding advertising to our Craft site. The ads come from our business members and are displayed randomly with article pages, based on tags and categories. All that is working fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question comes up, how to report impression counts of the ads back to the advertisers? I'm newish to Craft; I don't know if it is possible to write back to a field of an asset (displayCount = displayCount + 1 kind of thing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas or suggestions would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7491" LastEditorUserId="57" LastEditDate="2018-12-30T18:53:57.370" LastActivityDate="2018-12-30T18:53:57.370" Title="How to count ad impressions" Tags="&lt;count&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28963" PostTypeId="1" AcceptedAnswerId="28964" CreationDate="2018-12-28T22:00:49.457" Score="1" ViewCount="608" Body="&lt;p&gt;I tried using Andrew Welch's &lt;a href=&quot;https://github.com/nystudio107/craft-connect&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft-connect&lt;/a&gt; plugin, but the plugin was throwing an error on the REMOTE_DB_SERVER variable. I commented the variable out in the .env file, but I still could not connect. I also tried just using the IP address of the remote server in the DB_SERVER variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I hope to accomplish is a shared development DB which exists on a remote server. I can then connect both of my local environments to that development DB. When I know that the development DB is good to go, I will synch it with my production DB. But, I cannot sort out how to accomplish a remote DB connection with CraftCMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can connect to my development DB using the SSH method in SequelPro (requires SSH host IP, SSH user and SSH password). I've tried replacing the DB server variable with the IP address of my server in my .env file, but that doesn't work. If I'm tunneling into the server using SSH first in SequelPro, wouldn't I also need to do the same with my connection in Craft?&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-12-28T22:25:33.980" Title="How to connect to a Remote DB using CraftCMS 3.1+" Tags="&lt;database&gt;&lt;mysql&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28964" PostTypeId="2" ParentId="28963" CreationDate="2018-12-28T22:25:33.980" Score="2" Body="&lt;p&gt;Probably the database doesn't listen for connections from the outside world. So yeah you'd need some kind of an ssh tunnel to connect to it. I think you may find, though, that doing development via a remote db can be pretty slow; check out &lt;a href=&quot;https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Database &amp;amp; Asset Syncing Between Environments in Craft CMS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2018-12-28T22:25:33.980" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28965" PostTypeId="1" AcceptedAnswerId="28979" CreationDate="2018-12-28T22:53:35.143" Score="3" ViewCount="748" Body="&lt;p&gt;I'm suddenly getting an error on my plugin fieldtype even though I didn't make any changes to it. On Craft's publish page where my field is supposed to be I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Unable to find component class 'kgrote\siteutilities\fields\Regionselect'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Really have no idea where to start looking here. The &lt;code&gt;Regionselect&lt;/code&gt; class exists in the fieldtype file and the name of the file matches the class. It might help if I knew where this error was originating from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the plugin shows as &quot;Disabled&quot; in the Settings area and I can't enable it, and there is no &quot;Uninstall&quot; option available in the dropdown.&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2018-12-29T00:08:02.167" LastActivityDate="2019-01-01T01:38:18.983" Title="Plugin Error: &quot;Unable to find component class&quot;" Tags="&lt;plugin-development&gt;&lt;custom-fieldtype&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28966" PostTypeId="2" ParentId="28965" CreationDate="2018-12-28T23:21:09.327" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Additionally, the plugin shows as &quot;Disabled&quot; in the Settings area and I can't enable it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This seems like the crux of the problem. If you can figure out how to re-enable the plugin it should then be able to find the missing component class.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2018-12-28T23:21:09.327" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28967" PostTypeId="1" AcceptedAnswerId="29067" CreationDate="2018-12-29T01:04:41.740" Score="2" ViewCount="34" Body="&lt;p&gt;I'm trying to update existing entries with Sprout Import but when I run the import even though there are no errors the entry's data is not updated. I simplified the JSON script as much as I could and it's still not working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    {&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;    &quot;related&quot;: {&#xA;      &quot;relatedResources&quot;: {&#xA;          &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;          &quot;params&quot;: {&#xA;              &quot;slug&quot;: &quot;test-import-child&quot;,&#xA;              &quot;sectionId&quot;: 2&#xA;            }&#xA;        }&#xA;    },&#xA;    &quot;settings&quot;: {&#xA;      &quot;updateElement&quot;: {&#xA;        &quot;params&quot;: {&#xA;          &quot;slug&quot;: &quot;test-import-parent&quot;,&#xA;          &quot;sectionId&quot;: 2&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried doing it with just a plain text field instead of a relationship field and still didn't get any change.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;    &quot;content&quot;: {&#xA;        &quot;body&quot;: &quot;Lorem ipsum dolor sit amet.&quot;&#xA;    },&#xA;    &quot;settings&quot;: {&#xA;      &quot;updateElement&quot;: {&#xA;        &quot;params&quot;: {&#xA;          &quot;slug&quot;: &quot;test-import-parent&quot;,&#xA;          &quot;sectionId&quot;: 2&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-10T21:28:03.797" Title="Sprout Import: No Changes When Updating Entry" Tags="&lt;plugin-sproutimport&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28968" PostTypeId="2" ParentId="28936" CreationDate="2018-12-29T15:09:47.120" Score="5" Body="&lt;p&gt;You can use PHP's sprintf function via [the format filter in Twig].&lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/format.html&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to add a leading zero to single digit numbers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{ &quot;%02d&quot;|format('4') }}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which would return &lt;code&gt;04&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Or in your case &lt;code&gt;{{ &quot;%02d&quot;|format(entry.episodeNumber) }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2018-12-29T15:09:47.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28969" PostTypeId="2" ParentId="28962" CreationDate="2018-12-30T01:20:11.777" Score="2" Body="&lt;p&gt;Since it sounds like you're rolling-your-own, and can afford a relatively simple implementation, I'd recommend checking out the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#seq-name-length-next&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;seq(…)&lt;/code&gt; Twig function&lt;/a&gt; that Craft provides.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seq(&quot;ad-impressions-#{ad.uid}&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, if you have a dashboard of some kind for advertisers/partners, you could display those tallies by iterating over their “owned” advertisements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for ad in ads %}&#xA;    {{ ad.title }} views: {{ seq(&quot;ad-impressions-#{ad.uid}&quot;, null, false) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, the third argument tells the function to &lt;em&gt;read&lt;/em&gt; the value, but not increment it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Of course, this is &lt;em&gt;extremely&lt;/em&gt; crude. It assumes you only need to count &lt;em&gt;the number of times an ad is rendered into a page&lt;/em&gt;, and makes no guarantees about how many times it’s actually &lt;em&gt;seen&lt;/em&gt;. It also won't increment if the page is cached.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Overall, I'd recommend outputting the ad with some kind of identifying information, and firing a custom Google Analytics event… or—time permitting—write a custom controller to ping via AJAX when an ad is actually displayed in a browser. Keep in mind that somewhere in here, you're apt to be able to deliver a better product with an existing plugin! &lt;/p&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2018-12-30T01:44:27.197" LastActivityDate="2018-12-30T01:44:27.197" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28970" PostTypeId="1" CreationDate="2018-12-30T14:27:36.053" Score="3" ViewCount="112" Body="&lt;p&gt;We have a channel on the following page that shows 'Issues' of our magazine: &lt;a href=&quot;http://ambitmagazine.co.uk/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ambitmagazine.co.uk/issues&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have issues going all the way back to issue 1, but the channel page currently only shows issues back as far as issue 32:&#xA;&lt;a href=&quot;http://ambitmagazine.co.uk/issues/32&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ambitmagazine.co.uk/issues/32&lt;/a&gt; (displaying in the channel feed)&#xA;&lt;a href=&quot;http://ambitmagazine.co.uk/issues/31&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ambitmagazine.co.uk/issues/31&lt;/a&gt; (not displaying but the URL returns the issue information, and no other settings are different in the backend).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why this page might not be showing everything? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9196" LastActivityDate="2018-12-30T15:20:46.247" Title="Channel not showing all items?" Tags="&lt;channels&gt;&lt;feed&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28971" PostTypeId="2" ParentId="28970" CreationDate="2018-12-30T15:20:46.247" Score="6" Body="&lt;p&gt;Set a limit of nulll on your entry query which means no limit. If you do not specify a limit, you will only see 100 entries.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.limit(null)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2018-12-30T15:20:46.247" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28972" PostTypeId="1" AcceptedAnswerId="28974" CreationDate="2018-12-30T19:57:48.183" Score="2" ViewCount="62" Body="&lt;p&gt;This is a site that was recently updated from Craft 2 to Craft 3 and before the update this issue did not occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# all entries sorted by year/month #}&#xA; {% set allEntries = craft.entries.section('photoblog').limit(null).orderBy('postDate desc').all() %}&#xA;&#xA;  &amp;lt;div class=&quot;years&quot;&amp;gt;&#xA;    {% for year, entriesInYear in allEntries | group(&quot;postDate|date('Y')&quot;) %}&#xA;        &amp;lt;div class=&quot;col-sm-3 col-xs-4&quot; data-mh=&quot;years&quot;&amp;gt;&#xA;          &amp;lt;h3&amp;gt;{{ year }}&amp;lt;/h3&amp;gt;&#xA;          &amp;lt;ul class=&quot;list-unstyled&quot;&amp;gt;&#xA;          {% for month, entries in entriesInYear | group(&quot;postDate|date('F')&quot; ) |  reverse %}&#xA;              &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/calendar/{{ year }}/{{ month|date('m') }}&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;          {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;  &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything works correctly except for February which always outputs &lt;code&gt;03&lt;/code&gt; and not &lt;code&gt;02&lt;/code&gt; as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go to &lt;a href=&quot;https://sean-smith.net/calendar&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sean-smith.net/calendar&lt;/a&gt; and hover over any &lt;strong&gt;February&lt;/strong&gt; link you'll see that the link is set to March inexplicably.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-12-31T14:10:08.987" Title="February always comes out as March - expect /yyyy/mm to be 2018/02 but it's 2018/03" Tags="&lt;templating&gt;&lt;postdate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28973" PostTypeId="2" ParentId="28972" CreationDate="2018-12-30T23:17:56.413" Score="4" Body="&lt;p&gt;I think the problem is that you are not being specific enough with the date that you are passing to the date function. You are in effect calling date(&quot;February&quot;) and the PHP date function has to make an assumption and uses the current day of the month, i.e. February 30 which equates to March. If this is correct you will have even more issues tomorrow being the 31st!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make the date being passed more specific i.e. February 1 it should work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A related PHP bug post, that wasn't a bug, explains it &lt;a href=&quot;https://bugs.php.net/bug.php?id=49115&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://bugs.php.net/bug.php?id=49115&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7213" LastActivityDate="2018-12-30T23:17:56.413" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28974" PostTypeId="2" ParentId="28972" CreationDate="2018-12-31T14:10:08.987" Score="0" Body="&lt;p&gt;As @jollyR said in their response there is a bug with php dates. I resolved this issue by changing the relevant code to below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;li&amp;gt;&#xA;  {# need month to include year to avoide a bug with short months when the current day is 30 or 31 i.e. february #}&#xA;  {% set thisMonth = month ~ '-' ~ year %}&#xA;&#xA;  &amp;lt;a href=&quot;/calendar/{{ year }}/{{ thisMonth|date('m') }}&quot;&amp;gt;{{ month }}&amp;amp;nbsp;({{ entries|length }})&amp;lt;/a&amp;gt;&#xA;&amp;lt;/li&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2018-12-31T14:10:08.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28975" PostTypeId="1" AcceptedAnswerId="28982" CreationDate="2018-12-31T19:21:23.150" Score="1" ViewCount="75" Body="&lt;p&gt;I have a custom date field - &quot;renewalDate&quot; - which I want to use to limit an entry query. Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run that it throws this error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Calling unknown method: craft\behaviors\ElementQueryBehavior::renewalDate()&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateStart = now|date('Y-m-d H:i')  %}&#xA;{% set dateEnd = date('next month') | date('Y-m-d H:i')  %}&#xA;&#xA;{% set list = craft.users()&#xA;.group('members') &#xA;.status(null)&#xA;.orderBy('lastName asc')&#xA;.renewalDate('and', '&amp;gt;= #{dateStart}', '&amp;lt; #{dateEnd}')&#xA;&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set list = craft.users()&#xA;.group('members') &#xA;.status(null)&#xA;.orderBy('lastName asc')&#xA;.renewalDate('&amp;gt;= #{dateStart}') &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, the problem seems to be related to using &quot;and&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done this before using Craft 2, but it is not working with Craft 3. I am missing something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="8431" LastEditDate="2018-12-31T23:03:06.217" LastActivityDate="2019-01-02T23:25:12.777" Title="Date Limit on Element Query" Tags="&lt;datetime&gt;&lt;limit&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28976" PostTypeId="1" AcceptedAnswerId="28978" CreationDate="2018-12-31T19:26:14.963" Score="2" ViewCount="480" Body="&lt;p&gt;I have an entry called &quot;reviews&quot; and within reviews I have a table field with several values. I would like to use the field values to display entry listings in a particular way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First: I would like to be able to display entry listings so that if the field value is = x to display a particular set of entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second: I would like to be able to display these values so that they are in an ascending order.&lt;/p&gt;&#xA;" OwnerUserId="9201" LastActivityDate="2018-12-31T21:33:24.750" Title="Is it possible to filter entries based on entry table field values?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28978" PostTypeId="2" ParentId="28976" CreationDate="2018-12-31T20:53:59.567" Score="2" Body="&lt;p&gt;OK, one possible way is the use the value of the colour field in an &lt;em&gt;if statement&lt;/em&gt;, something this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# list rows that have &quot;blue&quot; in the colour field #}&#xA;{% for row in table.fieldName %}&#xA;{% if row.colour == 'blue' %} // probably best to make &quot;blue&quot; a variable&#xA;    &amp;lt;li&amp;gt;{{ row.age }} - {{ row.provider }} - etc.&amp;lt;/li&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to sort the table by a field value you will have to create a new array with the table data, then order by the name value. Will work that up for you in a bit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also do it with JavaScript, but that is nasty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete code using an Array to sort by the age field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tableBlock = [] %}&#xA;{% set tableRow = [] %} &#xA;&#xA;{% for row in entry.myTableField %} &#xA;    {% if row.colour == &quot;blue&quot; %}&#xA;&#xA;    {% set tableRow = {&#xA;        'age' : row.age,&#xA;        'colour' : row.colour,&#xA;        'provider' : row.provider&#xA;    } %}&#xA;{% set tableBlock = tableBlock|merge([tableRow]) %} &#xA;    {% endif %}&#xA;&#xA;{% endfor %}&#xA;&#xA;{% for row in tableBlock|sort %}&#xA;    &lt;li&gt;{{row.age}} {{row.colour}} {{row.provider}}&lt;/li&gt;&#xA;{% endfor %}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason the code block formatting is not working...&lt;/p&gt;&#xA;" OwnerUserId="587" LastEditorUserId="587" LastEditDate="2018-12-31T21:33:24.750" LastActivityDate="2018-12-31T21:33:24.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28979" PostTypeId="2" ParentId="28965" CreationDate="2019-01-01T01:38:18.983" Score="3" Body="&lt;p&gt;So what happened was I un-gitignored my Composer files so I could deploy them to another environment. Then I switched from that branch to a different branch with different Composer files. After I switched back, I ran into a Composer bug (&lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html#loading-your-plugin-into-a-craft-project&quot; rel=&quot;nofollow noreferrer&quot;&gt;mentioned here in the docs&lt;/a&gt;) where Composer will forget about plugins loaded using the &lt;code&gt;path&lt;/code&gt; method if the files change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I had to perform these steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;navigate to my craft project folder in the terminal&lt;/li&gt;&#xA;&lt;li&gt;execute &lt;code&gt;composer remove kgrote/siteutilities&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;delete the &lt;code&gt;kgrote&lt;/code&gt; directory from &lt;code&gt;craft/vendor&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;execute &lt;code&gt;composer install kgrote/siteutilities&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;SUUUUUPER annoying, but there you have it.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-01T01:38:18.983" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28980" PostTypeId="1" CreationDate="2019-01-01T12:09:23.870" Score="1" ViewCount="168" Body="&lt;p&gt;In our production environment, we have set up a three-tier architecture. Craft CMS is deployed on a server sitting in the private zone. We want to have it serving client browser's request through a proxy server which sits in the DMZ. We want to make sure the app server does not have internet access for security.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems to us that craft CMS admin page is trying to access the internet. We would like to know why it is doing that and whether this can be disabled.&lt;/p&gt;&#xA;" OwnerUserId="9202" LastEditorUserId="4169" LastEditDate="2019-01-01T22:36:10.627" LastActivityDate="2019-01-01T22:36:10.627" Title="Can the Craft CMS admin be blocked from accessing the Internet?" Tags="&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28981" PostTypeId="2" ParentId="28980" CreationDate="2019-01-01T15:57:43.603" Score="2" Body="&lt;p&gt;Instead of blocking the CMS's access to the internet, you should consider firewalling access to the CMS from the outside world. Basically, block all incoming IP addresses but your own. I can understand your need for security, but the CMS's core functionality relies on being able to communicate with the outside world to keep the system updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you block access as you're wanting to do, I think you will find that it's going to be much more difficult to manage the system. Things that come to mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You'll need to be able to keep the system updated with source control (eg. Git) which requires internet access.&lt;/li&gt;&#xA;&lt;li&gt;If you get into a situation where an update fails in the CMS, you may need to  run Composer via command line on the server. This will require the internet to update packages.&lt;/li&gt;&#xA;&lt;li&gt;One of the best ways to manage assets (images) in CraftCMS is to use a CDN like Amazon S3. You'll get much better site performance with a CDN. If your server cannot communicate with the internet, you'll lose this ability.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm sure there are many more ways that you'd essentially be hobbling the system. I'm not directly answering your question here (which I would prefer to do), but instead I'm trying to dissuade you from creating a system that is unmanageable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I began thinking about this more, I came up with a few more things to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Keep your CraftCMS site files on a server that has access to the internet, and connect it to a database on a server which has no internet access. I did this for a previous client using Rackspace's Rackconnect which is essentially a back-door network that is only accessible to other Rackspace servers. I'm not sure how you host, but I'm sure this can be done with other service providers. At the end of the day, what you really want to protect is the contents of the DB.&lt;/li&gt;&#xA;&lt;li&gt;Set up a VPN and require that users authenticate to the VPN before being able to connect to crucial protocols like SSH. I had this scenario set up for a previous client as well. Essentially, you must establish a VPN connection first, then you can SSH into the server.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Caveat, I'm not a server security person. I've set up a bunch of servers, and learned along the way what makes good security from people smarter than me. Your IT people may have even better suggestions than what I've provided.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2019-01-01T16:34:47.140" LastActivityDate="2019-01-01T16:34:47.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28982" PostTypeId="2" ParentId="28975" CreationDate="2019-01-01T22:07:12.893" Score="2" Body="&lt;p&gt;Have you tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.renewalDate('and', &quot;&amp;gt;= #{dateStart}&quot;, &quot;&amp;lt; #{dateEnd}&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The difference is the double quotes. I don't think that single quotes support interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure in that case why the version without the 'and' works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, have just tried it myself...&#xA;I created a section called test and added a single date field called renewalDate and the code below works on a simple listing page.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set dateStart = now|date('Y-m-d H:i')  %}&#xA;{% set dateEnd = date('next month') | date('Y-m-d H:i')  %}&#xA;&#xA;{% set params = {&#xA;  section : 'test',&#xA;  orderBy : 'renewalDate asc',&#xA;  renewalDate : ['and', &quot;&amp;gt;= #{dateStart}&quot;, &quot;&amp;lt; #{dateEnd}&quot;]&#xA;} %}&#xA;&#xA;&amp;lt;h1&amp;gt;Entries&amp;lt;/h1&amp;gt;&#xA;{% for entry in craft.entries(params).all() %}&#xA;    &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7213" LastEditorUserId="7213" LastEditDate="2019-01-02T23:25:12.777" LastActivityDate="2019-01-02T23:25:12.777" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28983" PostTypeId="1" AcceptedAnswerId="28985" CreationDate="2019-01-02T11:43:20.147" Score="2" ViewCount="47" Body="&lt;p&gt;SEOmatic throws up a lot of errors in the debug. Most of the errors seem to be with fields I haven't filled in as they are not required like Facebook App ID etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this an issue or do I just ignore? Disabling the plugin reduced the number of database requests to 50 instead of the 140 being shown and improved the speed slightly so just wondering if the errors are creating performance issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XKHjg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XKHjg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-01-02T16:36:34.880" Title="SEOmatic Errors in Debug - Can they be fixed?" Tags="&lt;seo&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28984" PostTypeId="2" ParentId="28897" CreationDate="2019-01-02T14:18:48.517" Score="2" Body="&lt;p&gt;I managed to resolve this using the &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;supersort&lt;/a&gt; plugin and using 'defaultPrice' instead of 'price'. Example below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.products.type('accommodation').all() %}&#xA;{% set order = products|supersort('sortAs', '{{ object.defaultPrice }}') %}&#xA;&#xA;{% for product in order %}&#xA;&#xA;    // Products&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2019-01-02T14:18:48.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28985" PostTypeId="2" ParentId="28983" CreationDate="2019-01-02T15:38:00.240" Score="2" Body="&lt;p&gt;These errors will only appear with &lt;code&gt;devMode&lt;/code&gt; on, and they are intended to help you diagnose potential problems with the meta tags and other information that you are rendering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all soft errors, though. You can safely ignore them if they are a result of you not filling in things that you don't intend to fill in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more about it here: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#meta-object-validation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#meta-object-validation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2019-01-02T16:36:34.880" LastActivityDate="2019-01-02T16:36:34.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28986" PostTypeId="1" AcceptedAnswerId="28988" CreationDate="2019-01-02T18:07:16.393" Score="1" ViewCount="151" Body="&lt;p&gt;I have got multiple category groups and I need to concatenate them into one list for a filter UI element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I have the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = craft.categories.group('colour').all() %}&#xA;{% set categories = categories|merge(craft.categories.group('suitability').all()) %}&#xA;{% set categories = categories|merge(craft.categories.group('finish').all()) %}&#xA;{% set categories = categories|merge(craft.categories.group('shape').all()) %}&#xA;{% set categories = categories|merge(craft.categories.group('material').all()) %}&#xA;{% set categories = categories|merge(craft.categories.group('edge').all()) %}&#xA;{% set categories = categories|merge(craft.categories.group('surface').all()) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now I have a list of all the categories within these groups, I can loop over them as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;categories&quot;&amp;gt;&#xA;    {% for cat in categories %}&#xA;        &amp;lt;li class=&quot;categories__item&quot;&amp;gt;&#xA;            &amp;lt;button class=&quot;button categories__btn&quot;&amp;gt;{{ cat.title }}&amp;lt;/button&amp;gt;&#xA;        &amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the issue I'm having is that the array of categories is outputting them in the order they're being added. I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categories = categories.orderBy('title asc').all() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it returns &quot;Impossible to invoke a method (&quot;orderBy&quot;) on an array.&quot;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-01-02T21:15:11.637" Title="How to create ordered list of categories from multiple category groups" Tags="&lt;categories&gt;&lt;ordering&gt;&lt;order&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28987" PostTypeId="1" CreationDate="2019-01-02T19:38:27.113" Score="1" ViewCount="23" Body="&lt;p&gt;I have got a category multi-select feature that allows users to filter variants by more than one category. On selection the URL is concatenated as a new category as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;?cat=blue&#xA;?cat=blue+decorative&#xA;?cat=blue+decorative+white&#xA;etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am just trying to setup the paginate tag to show a list of variants that are filtering by the categories from multiple category fields that the variants have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case they are 'colour' and 'shape'. There are discussions amongst the team about converting a multiple category group structure into a single nested category group to make functions like this easier.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-01-02T19:38:27.113" Title="Paginate a list of product variants with categories parameters" Tags="&lt;plugin-craftcommerce&gt;&lt;category&gt;&lt;plugin-craftcommerce2&gt;&lt;params&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28988" PostTypeId="2" ParentId="28986" CreationDate="2019-01-02T21:15:11.637" Score="2" Body="&lt;p&gt;You can query on multiple category groups like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.group('suitability, finish, shape, material, edge, surface').all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It can also be done with an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.categories.group([&#xA;  'suitability',&#xA;  'finish',&#xA;  'shape',&#xA;  'material',&#xA;  'edge',&#xA;  'surface'&#xA;]).all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whenever you invoke &lt;code&gt;.all()&lt;/code&gt; it returns an array. As those arrays were merged, they created a larger array. In that last bit of code, &lt;code&gt;categories.orderBy()&lt;/code&gt; failed because &lt;code&gt;categories&lt;/code&gt; was an array and arrays do not have a method named &lt;code&gt;orderBy&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2019-01-02T21:15:11.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28989" PostTypeId="1" CreationDate="2019-01-02T22:52:40.783" Score="1" ViewCount="161" Body="&lt;p&gt;I have a multi-site Craft install.  I'd like to offer the ability for each site to upload an icon that will be used for favicons.  I noticed a lot of 404s for both /favicon.ico and /apple-touch-icon.png, which appear to be hardcoded in various clients.  I'd thus like to route those URLs directly to the requisite asset files, but on a per-site basis.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I can't just put the files into /web, since that's shared among all the sites, and I want site-specific icons.&lt;/li&gt;&#xA;&lt;li&gt;I'm hosting assets on S3 (since we are using a load balancer).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to do this in Craft without writing a custom plugin to do so?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If there exists a plugin to do this, or if I could do it via Craft directly, that would be wonderful, but I cannot find a way to do so.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have to write a custom plugin, I'd have it basically:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Respond to those URLs&lt;/li&gt;&#xA;&lt;li&gt;Look up the requisite field in Globals for the assets on a per-site basis.&lt;/li&gt;&#xA;&lt;li&gt;Download the asset file locally (and cache locally in /storage)&lt;/li&gt;&#xA;&lt;li&gt;Set the proper MIME type&lt;/li&gt;&#xA;&lt;li&gt;Serve the file from /storage directly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does this sound reasonable or would there be a better way to handle this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any assistance!&lt;/p&gt;&#xA;" OwnerUserId="7413" LastActivityDate="2019-01-03T04:20:24.057" Title="Route directly to an S3-hosted asset?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;assets&gt;&lt;plugins&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28990" PostTypeId="1" AcceptedAnswerId="29036" CreationDate="2019-01-02T23:37:51.507" Score="1" ViewCount="238" Body="&lt;p&gt;When using a Redactor field for a section, I can’t upload assets or link to entries. I just get an empty modal with no ability to select a section or asset folder. Thoughts on what I’m doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7x5xx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7x5xx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[UPDATED] See video: &lt;a href=&quot;https://drive.google.com/file/d/1hKKKKizSfmr1-QeblzfSbQ1B3Pf6Bybv/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://drive.google.com/file/d/1hKKKKizSfmr1-QeblzfSbQ1B3Pf6Bybv/view?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5560" LastEditorUserId="5560" LastEditDate="2019-01-08T21:20:44.273" LastActivityDate="2019-01-09T08:06:54.067" Title="Can't link to entries or assets via a Redactor field" Tags="&lt;assets&gt;&lt;matrix&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28992" PostTypeId="2" ParentId="28989" CreationDate="2019-01-03T04:09:28.423" Score="1" Body="&lt;p&gt;By default browsers look for a favicon at the root of your web directory. So if you do not add a link in your head section, but you have a favicon.ico at webroot, you will still see it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, a favicon can technically be located anywhere. If you have a multi-site installation you can reference it like this (note that you should always use a fully qualified URL or you may run into issues with IE):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;shortcut icon&quot; href=&quot;https://yourbucket.s3.amazonaws.com/{{currentSite.handle}}/favicons/favicon.ico&quot; type=&quot;image/x-icon&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Insert Craft's current site handle tag so that you can use the same code on all sites. Then you'll just need to create a paths in your S3 bucket to match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding multiple sizes, you should include more than just a 16x16 favicon. This is what I have which is all related to icon display:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;link rel=&quot;shortcut icon&quot; href=&quot;favicon.ico&quot; type=&quot;image/x-icon&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;180x180&quot; href=&quot;/apple-touch-icon.png&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;icon&quot; type=&quot;image/png&quot; sizes=&quot;32x32&quot; href=&quot;/favicon-32x32.png&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;icon&quot; type=&quot;image/png&quot; sizes=&quot;16x16&quot; href=&quot;/favicon-16x16.png&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;manifest&quot; href=&quot;/site.webmanifest&quot;&amp;gt;&#xA;&amp;lt;link rel=&quot;mask-icon&quot; href=&quot;/safari-pinned-tab.svg&quot; color=&quot;#888888&quot;&amp;gt;&#xA;&amp;lt;meta name=&quot;msapplication-TileColor&quot; content=&quot;#ffc40d&quot;&amp;gt;&#xA;&amp;lt;meta name=&quot;theme-color&quot; content=&quot;#ffffff&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The manifest, mask-icon, msapplication-TileColor, and theme-color all refer to how your favicon will appear on platforms including Safari, Windows and Android devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could add an image transform to your asset volume which creates each of the required sizes, or you could direct your client to upload multiple sizes. It may be easier to send them to &lt;a href=&quot;https://realfavicongenerator.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this site&lt;/a&gt; to generate favicons which they can then upload to their assets volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer, I have no affiliation to the Favicon Generator site -- I just use it frequently. I generated the code you see above using this tool. If you're looking for a reliable way to generate your favicon size variations and the associated code, this online tool does the trick.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2019-01-03T04:20:24.057" LastActivityDate="2019-01-03T04:20:24.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28994" PostTypeId="1" CreationDate="2019-01-03T13:34:40.960" Score="1" ViewCount="23" Body="&lt;p&gt;The current CMS I use allows me to create data tables with list data that I can then re-use across different page-types throughout the sites that I build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can see to make use of concept in a similar way without developing a custom plugin in Craft is to create specific entry types with tables to input and retrieve data from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any advice on what the best practice would be with Craft with regards to larger sets of table data?&lt;/p&gt;&#xA;" OwnerUserId="9201" LastEditorUserId="9201" LastEditDate="2019-01-03T15:54:12.150" LastActivityDate="2019-01-03T15:54:12.150" Title="How to setup re-usable non-entry specific data in Craft?" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28995" PostTypeId="1" CreationDate="2019-01-03T15:13:11.830" Score="0" ViewCount="42" Body="&lt;p&gt;I have got a list of product variants being filtered by a string of category ids if there is some data in the category parameter with the following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that I'm using the + character between category IDs, which getParam converts into spaces, so I'm splitting on spaces)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set categoryParams = craft.app.request.getParam('cat') %}&#xA;{% set categoryParamsArray = categoryParams|split(' ') %}&#xA;&#xA;{% if categoryParams|length %}&#xA;    {% set results = craft.variants({product: product}).relatedTo(categoryParamsArray) %}&#xA;{% else %}&#xA;    {% set results = craft.variants({product: product}) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works perfectly if there is one category selected but no longer works when I select two or more. The responses are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;✅No category selected: 22 results &lt;/p&gt;&#xA;&#xA;&lt;p&gt;✅One category selected: 5 results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;❌Two categories selected: 22 results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice on this method would be appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2019-01-04T11:23:21.507" LastActivityDate="2019-01-04T11:23:21.507" Title="Using relatedTo with a string of category ids" Tags="&lt;category&gt;&lt;params&gt;&lt;filtering&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28996" PostTypeId="1" AcceptedAnswerId="28998" CreationDate="2019-01-03T15:38:33.847" Score="2" ViewCount="66" Body="&lt;p&gt;I'm trying to get my Craft translations to work with the translation management tool &lt;a href=&quot;https://phraseapp.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phraseapp&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard format for translation-files in Craft CMS looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# de.php&#xA;&#xA;return [ &#xA;    'good_morning' =&amp;gt; 'Guten morgen', &#xA;    'KEY' =&amp;gt; 'GERMAN_TRANSLATION_VALUE'&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this format is not supported by Phraseapp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to return &lt;strong&gt;json&lt;/strong&gt; or &lt;strong&gt;yaml&lt;/strong&gt; instead? &lt;/p&gt;&#xA;" OwnerUserId="8977" LastEditorUserId="57" LastEditDate="2019-01-03T22:08:39.170" LastActivityDate="2019-01-03T22:10:17.210" Title="Change translation format in Craft CMS" Tags="&lt;craft3&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28998" PostTypeId="2" ParentId="28996" CreationDate="2019-01-03T22:10:17.210" Score="1" Body="&lt;p&gt;We used to use PhraseApp to manage Craft translations, but as of Craft 3, we don't anymore (everything is now on &lt;a href=&quot;https://github.com/craftcms/cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we were using them, we wrote a quick PHP script that would take the PHP based translation file format Craft uses, parse them and convert them to a format that PhraseApp could use.  Then there was another quick script that would reverse the process when we pulled them down.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-03T22:10:17.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29000" PostTypeId="2" ParentId="2377" CreationDate="2019-01-04T10:35:05.220" Score="4" Body="&lt;p&gt;Bit of an old question, but here's a (subjectively) more elegant solution than the accepted answer using &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;loop.revindex0&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for tag in tags %}&#xA;    {{ tag.type }}{{ loop.revindex0 == 1 ? ' and' : loop.revindex0 ? ', '  }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9212" LastActivityDate="2019-01-04T10:35:05.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29001" PostTypeId="1" CreationDate="2019-01-04T11:10:37.110" Score="1" ViewCount="1289" Body="&lt;p&gt;I see a lot of information about using environment variables on php files or twig templates, but I want to use them on javascript. I need to pass the environment, located on the &lt;code&gt;.env&lt;/code&gt; file, to the Sentry init, located on &lt;code&gt;assets/js/app.js&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I safely access this? Do I need to install dotenv or similar or is there a 'Craft way' of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any help on how to do this, or maybe a suggestion for a different approach.&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2019-01-04T12:50:22.007" Title="How can I access environment variables from a javascript file in Craft 3?" Tags="&lt;craft3&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29002" PostTypeId="2" ParentId="29001" CreationDate="2019-01-04T12:39:37.470" Score="2" Body="&lt;p&gt;The .env file is on the server and javascript is running in the client so you need to pass it through to javascript in your twig template inside a script tag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set env = getenv('ENVIRONMENT') %}&#xA;&amp;lt;script&amp;gt;&#xA;    var myVariable = '{{ env|e('js') }}'&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You probably don't need to escape it like in my example above, but good practice anyway. If you are then using the variable in that script you are good to go. From elsewhere on the page you can get the variable using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;document.addEventListener('DOMContentLoaded', () =&amp;gt; {&#xA;    const myVar = window.myVariable;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Great article about this and more &lt;a href=&quot;https://cruftlesscraft.com/passing-data-from-twig-to-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cruftlesscraft.com/passing-data-from-twig-to-javascript&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7213" LastEditorUserId="7213" LastEditDate="2019-01-04T12:50:22.007" LastActivityDate="2019-01-04T12:50:22.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29003" PostTypeId="1" CreationDate="2019-01-04T14:35:41.890" Score="1" ViewCount="233" Body="&lt;p&gt;In Craft 3, I keep running into an issue when I try to move a large amount of files (around 200) by dragging and dropping from my “Holding” folder into a “Live” folder using Craft Assets section. Both folders are hosted on Amazon S3.  Even moving three files seems to take a really long time (about a minute).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After checking the server logs it looks like I am filling my max apache connection due to the search-index-perform-action.  The error suggested I increase my “MaxRequestWorkers” setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I move about 2,000 files every month and never had a problem on Craft 2.  I don’t know if should change the “MaxRequestWorkers” setting or if there is something else I should consider doing.  If I should change the setting, where is it, I can't seem to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use Transmit FTP to initially move the files into the Holding folder and then index the assets in that folder. Then in Craft CMS control panel, I drag the files from Holding folder to the main Live folder so that the asset index gets updated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked in my &lt;code&gt;phperror.log&lt;/code&gt; file and found these three types of errors occuring:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 1048576 bytes) in /storage/avxxxxx/www/public_html/vendor/craftcms/cms/src/helpers/DateTimeHelper.php on line 231&#xA;&#xA;PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /storage/avxxxxx/www/public_html/vendor/craftcms/cms/src/elements/db/ElementQuery.php on line 2215&#xA;&#xA;PHP Fatal error:  Maximum execution time of 90 seconds exceeded in /storage/avxxxxx/www/public_html/vendor/league/flysystem/src/Util.php on line 322&#xA;&#xA;PHP Fatal error:  Maximum execution time of 90 seconds exceeded in /storage/avxxxxx/www/public_html/vendor/league/flysystem-aws-s3-v3/src/AwsS3Adapter.php on line 294&#xA;&#xA;PHP Fatal error:  Maximum execution time of 90 seconds exceeded in /storage/avxxxxx/www/public_html/vendor/league/flysystem/src/Util/ContentListingFormatter.php on line 52&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems like when I move a file from Holding (950 files) to Live (20,000) files is where things get hung up.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Holding -&gt; Live = 1 file takes 7 seconds to move&lt;/li&gt;&#xA;&lt;li&gt;Live -&gt; Holding = 1 file takes 20 seconds to move&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could it be an issue with the cache or search-index?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my current settings if it helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;memory_limit 256M&#xA;&#xA;max_execution_time = 90&#xA;&#xA;Max Requests = Per Child: 300 - Keep Alive: on - Max Per Connection: 150&#xA;&#xA;Timeouts = Connection: 10 - Keep-Alive: 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastEditorUserId="3418" LastEditDate="2019-01-09T18:00:45.203" LastActivityDate="2021-05-28T22:08:50.830" Title="Craft 3 - Moving assets between folders causes apache connection to max out" Tags="&lt;assets&gt;&lt;error-message&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29004" PostTypeId="1" AcceptedAnswerId="29016" CreationDate="2019-01-04T14:57:56.067" Score="1" ViewCount="90" Body="&lt;p&gt;I'm getting a deprecation error about looping through element queries, but in my markup all my loops are being setup with the &lt;code&gt;.all()&lt;/code&gt; method, so I'm struggling to find this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it's one that is coming up every time I clear my errors, so the CMS clearly still thinks it's an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/POe6v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/POe6v.png&quot; alt=&quot;Deprecation error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-01-07T19:00:54.680" Title="Best way to find a deprecation error with no location hint?" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29005" PostTypeId="2" ParentId="29003" CreationDate="2019-01-04T22:29:28.463" Score="0" Body="&lt;p&gt;I would remove the overhead of the CMS all together by using an app like Filezilla, Cyberduck or similar app to move files. There are plenty of tutorials out there on how to connect to an S3 bucket using one of these apps (eg. &lt;a href=&quot;https://stackoverflow.com/questions/45293159/how-to-setup-filezilla-pro-to-access-to-my-s3-bucket&quot;&gt;https://stackoverflow.com/questions/45293159/how-to-setup-filezilla-pro-to-access-to-my-s3-bucket&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you do this you will most likely need to update your asset indexes in the control panel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Utilities → Asset Indexes (or Settings → Update Asset Indexes if you're on Craft 2)&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2019-01-04T22:29:28.463" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29006" PostTypeId="1" AcceptedAnswerId="29071" CreationDate="2019-01-05T04:05:25.993" Score="1" ViewCount="388" Body="&lt;p&gt;I have an Events section on my site, and to display upcoming and passed events (entries with a status of &lt;code&gt;pending&lt;/code&gt; or &lt;code&gt;expired&lt;/code&gt;) I manually set the entry in the template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the URL is &lt;code&gt;/events/my-event-title&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries({&#xA;    section: 'Events',&#xA;    slug: craft.app.request.segment(2),&#xA;    status: ['live','pending','expired']&#xA;}).one %}&#xA;&#xA;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&#xA;{{ entry.body }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great except when I go to publish a new Event and use the Live Preview. Since the new entry doesn't have a slug yet, the &lt;code&gt;craft.app.request.segment(2)&lt;/code&gt; variable returns null, and so &lt;code&gt;entry&lt;/code&gt; returns the last-published Event entry instead. So all of my template variables are pre-populated with a different entry's content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I set this up so my Live Preview displays blank until I enter content?&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2019-01-05T22:01:52.630" LastActivityDate="2019-01-10T23:51:32.967" Title="Live Preview for Upcoming Entries" Tags="&lt;templating&gt;&lt;events&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29007" PostTypeId="2" ParentId="29006" CreationDate="2019-01-05T06:43:00.460" Score="1" Body="&lt;p&gt;If your “event” Entry's Section settings define a URI and a template path, Craft will take care of defining &lt;code&gt;entry&lt;/code&gt; in the template. No need to look it up by segment!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, this will “just work” for Live Preview, as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt; I'd recommend setting the Event Section's &lt;code&gt;Template&lt;/code&gt; to &lt;code&gt;_events/event&lt;/code&gt;, and creating &lt;code&gt;templates/_events/event.twig&lt;/code&gt; in your project folder. Then, &lt;code&gt;entry&lt;/code&gt; will be automatically available when the template is rendered, either from a front-end request, or via Live Preview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't speak exactly to the internals of Live Preview—but I can say that it side-steps the normal routing by laterally &lt;code&gt;POST&lt;/code&gt;ing the updated content to a &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-controllers-entriescontroller.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Controller&lt;/a&gt; that independently resolves and renders the template. That said, once it starts rendering the template, it's almost exactly the same context you'll get when the Entry is live, and requested via its normal URL.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt; Using an underscore in the template's path will make sure the template is not directly accessible, and is only rendered during a request that Craft has determined matches an Element (in your case, the event Entry), or via the Live Preview controller. Read more about how Craft routes requests, &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2019-01-05T06:43:00.460" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29008" PostTypeId="1" AcceptedAnswerId="29010" CreationDate="2019-01-05T15:37:58.190" Score="1" ViewCount="2147" Body="&lt;p&gt;I'm trying to build my first little plugin.&#xA;I'm stuck with a problem: I need to modify the value of the specific field &lt;code&gt;reference&lt;/code&gt;, right after the saving of the entry because the new value is supposed to be based on the same entry &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works to get the Entry object and modify the reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;            Element::class, &#xA;            Element::EVENT_AFTER_SAVE, &#xA;            function(Event $event) {&#xA;                if ($event-&amp;gt;sender instanceof Entry) {&#xA;                    $idLast = Entry::find('id')&#xA;                        -&amp;gt;section('annunci')&#xA;                        -&amp;gt;orderBy('elements.dateUpdated desc')&#xA;                        -&amp;gt;one();&#xA;                    $newRef = 'AV' . $idLast['id'];&#xA;                    // assign new reference ? At this point the record is already saved!!!&#xA;                    $event-&amp;gt;sender-&amp;gt;setFieldValue('reference', $newRef);&#xA;                    // then what?&#xA;                }&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can  manage to retrieve the last saved entry, grab its id, and then create my &lt;code&gt;$newRef&lt;/code&gt;, but after that, how am I supposed to resave the entry and update the entry record with the new value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question: I would like to intercept the event only on the first save (aka on creation), and avoiding recalculating the field value on every successive saving. Is this possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help, much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3806" LastEditorUserId="3806" LastEditDate="2019-01-05T16:19:38.630" LastActivityDate="2019-06-24T20:33:05.247" Title="How to modify and save a field in entry on EVENT_AFTER_SAVE in a plugin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;entry&gt;&lt;events&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29009" PostTypeId="2" ParentId="28826" CreationDate="2019-01-06T02:34:37.973" Score="0" Body="&lt;p&gt;I often just declare a second (optional) variable in each template, with the default classes set in a layout, and merged with any additional ones:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# __layout/base.twig #}&#xA;&#xA;{% set defaultBodyClasses = ['app'] %}&#xA;{# Use `default([])` to make this a non-mandatory assignment in your templates: #}&#xA;{% set bodyClasses = templateProvidedBodyClasses | default([]) | merge(defaultBodyClasses) %}&#xA;&#xA;&amp;lt;body class=&quot;{{ bodyClasses | join(' ') }}&quot;&amp;gt;...&amp;lt;/body&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;…and then in a template, say rendering an Entry…&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# _pages/page.twig #}&#xA;&#xA;{% extends '__layouts/base' %}&#xA;&#xA;{% set templateProvidedBodyClasses = [&#xA;    'app--my-static-flag',&#xA;    &quot;app--section-#{entry.section.handle}&quot;,&#xA;    &quot;app--type-#{entry.type.handle}&quot;&#xA;] %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps illuminate another option!&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2019-01-06T02:34:37.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29010" PostTypeId="2" ParentId="29008" CreationDate="2019-01-06T14:46:57.120" Score="2" Body="&lt;p&gt;Following @lenka suggestion, I was able to make the script work this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\services\Elements;&#xA;use craft\events\ElementEvent;&#xA;use craft\elements\Entry;&#xA;&#xA;Event::on(&#xA;    Elements::class, &#xA;    Elements::EVENT_AFTER_SAVE_ELEMENT, &#xA;    function(ElementEvent $event) {&#xA;        if ($event-&amp;gt;element instanceof Entry) {&#xA;            $entry = $event-&amp;gt;element;&#xA;            if($event-&amp;gt;isNew){&#xA;                $entry-&amp;gt;reference= 'AV' . (string)$entry-&amp;gt;id;&#xA;                Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);    &#xA;            }&#xA;        }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3806" LastEditorUserId="4433" LastEditDate="2019-06-24T19:42:57.437" LastActivityDate="2019-06-24T19:42:57.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29011" PostTypeId="1" CreationDate="2019-01-06T17:38:01.680" Score="1" ViewCount="28" Body="&lt;p&gt;I have the following problem. When I set shipping and billing address on my cart and exit the page, the addresses are cleared once I open the page again. Is it possible to disable this behavior?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &#xA;Kamen&lt;/p&gt;&#xA;" OwnerUserId="8399" LastActivityDate="2019-01-06T17:38:01.680" Title="Shipping and billing addresses dissapear when close and open the page" Tags="&lt;plugin-craftcommerce&gt;&lt;craft2&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29012" PostTypeId="2" ParentId="10861" CreationDate="2019-01-06T18:02:54.303" Score="1" Body="&lt;p&gt;Finally figured it out, I had been so close! The following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set days       = craft.categories.group('day').slug(abc) %}&#xA;{% set activities = craft.categories.group('activity').slug(xyz) %}&#xA;&#xA;{% for day in days %}&#xA;    &amp;lt;h2&amp;gt;{{ day.title }}&amp;lt;/h2&amp;gt;&#xA;&#xA;    {% for activity in activities %}&#xA;        {% set entries = craft.entries.section('attractions').relatedTo(&#xA;          'and',&#xA;          { targetElement: day },&#xA;          { targetElement: area }&#xA;        ) %}&#xA;&#xA;        {% if entries | length %}&#xA;            &amp;lt;h3&amp;gt;{{ area.title }}&amp;lt;/h3&amp;gt;&#xA;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt; &#xA;                {{ entry.startTime|date('H:i') }}&amp;lt;/p&amp;gt;&#xA;            {% endfor %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9219" LastEditorUserId="57" LastEditDate="2019-01-07T02:29:58.347" LastActivityDate="2019-01-07T02:29:58.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29014" PostTypeId="2" ParentId="28967" CreationDate="2019-01-07T09:20:18.743" Score="2" Body="&lt;p&gt;Reasons why it is not updating&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The fields data should be wrapped with &lt;strong&gt;fields&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If entry is on other site add &lt;strong&gt;siteId&lt;/strong&gt; on params&#xA;E.g.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[&#xA;  {&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;    &quot;content&quot;: {&#xA;      &quot;title&quot;: &quot;Test Import Parent&quot;,&#xA;      &quot;fields&quot;: {&#xA;        &quot;body&quot;: &quot;Lorem ipsum dolor sit amet.&quot;&#xA;      }&#xA;    },&#xA;    &quot;settings&quot;: {&#xA;      &quot;updateElement&quot;: {&#xA;        &quot;params&quot;: {&#xA;          &quot;slug&quot;: &quot;test-import-parent&quot;,&#xA;          &quot;sectionId&quot;: 2,&#xA;          &quot;siteId&quot;: 1&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;]&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5365" LastActivityDate="2019-01-07T09:20:18.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29015" PostTypeId="2" ParentId="28898" CreationDate="2019-01-07T11:45:51.777" Score="2" Body="&lt;p&gt;Relationships are always added as arrays of IDs, even if you are only relating a single element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user-&amp;gt;setContentFromPost(array(&#xA;    'companyName' =&amp;gt; $admin-&amp;gt;companyName, &#xA;    'companyId' =&amp;gt; $admin-&amp;gt;companyId, &#xA;    'partnerManager' =&amp;gt; array($admin-&amp;gt;partnerManager[0]-&amp;gt;id)&#xA;));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastActivityDate="2019-01-07T11:45:51.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29016" PostTypeId="2" ParentId="29004" CreationDate="2019-01-07T13:28:32.307" Score="4" Body="&lt;p&gt;If you look in the list of file paths in the stack trace there will be one or more files in the &lt;code&gt;storage/runtime/compiled_templates&lt;/code&gt; directory. In this particular case there is &lt;code&gt;storage/runtime/compiled_templates/1a/1a584296a...ccfb9.php&lt;/code&gt; under number 33 in the stack trace. (If you're using PhpStorm you can press &lt;kbd&gt;shift&lt;/kbd&gt; twice and paste in the filename to find it quickly.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This file contains a PHP class that Twig &lt;a href=&quot;https://twig.symfony.com/doc/2.x/internals.html#the-compiler&quot; rel=&quot;nofollow noreferrer&quot;&gt;compiles&lt;/a&gt; when the template is first accessed, so that it doesn't need to parse through all the twig code converting it into PHP every time the template is accessed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the top of this file is a comment that contains the path of the actual twig template. If needed, you might be able to work out a bit more context by looking at code at the line number in the stack trace (it's the &lt;code&gt;:43&lt;/code&gt; for this one). There will be another comment above this line that will tell you the line number in the twig template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may also be some clues in the stack trace itself. For example, here (again number 33 in the stack trace) you have the line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;twig_array_merge([], craft\elements\db\CategoryQuery)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This suggests to me that you're using the &lt;code&gt;|merge&lt;/code&gt; filter, on a &lt;code&gt;craft.categories&lt;/code&gt; query without calling &lt;code&gt;.all()&lt;/code&gt; on it first, which also makes sense given the deprecation notice.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2019-01-07T19:00:54.680" LastActivityDate="2019-01-07T19:00:54.680" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29017" PostTypeId="1" AcceptedAnswerId="29022" CreationDate="2019-01-07T15:15:39.087" Score="2" ViewCount="3847" Body="&lt;p&gt;I'm trying to pass a variable value from an include into a template file.  The variable is imageRatio. Within this include file I have the logic which sets the right image ratio. My goal with this is to have one place to set the logic which I can reuse in different templates - I'm trying to keep the code DRY.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do the below get an error saying Variable &quot;imageRatio&quot; does not exist. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Main Template&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# The Image Ratio include #}&#xA;{% include '_includes/builders/images/imageVariants' %}&#xA;&#xA;{# Create an Image Variant #}&#xA;{% set optimizedImages = block.image.one()[imageRatio] %}&#xA;{% include '_includes/builders/images/imageOptimize' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image Ratio Include&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Define Image Varient #}&#xA;{% if block.imageRatio == 'thumb' %}&#xA;    {% set imageRatio = 'imageVariantsThumb' %}&#xA;{% elseif block.imageRatio == '16by9' %}&#xA;    {% set imageRatio = 'imageVariants16by9' %}&#xA;{% elseif block.imageRatio == '3by2' %}&#xA;    {% set imageRatio = 'imageVariants3by2' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2019-01-07T16:28:19.130" LastActivityDate="2019-01-09T10:17:24.513" Title="Passing Twig Variable into Template from Include?" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29018" PostTypeId="2" ParentId="29017" CreationDate="2019-01-07T15:34:51.563" Score="0" Body="&lt;p&gt;You can find the details on include for twig here: &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/include.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/tags/include.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer being&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# template.html will have access to the variables from the current context and the additional ones provided #}&#xA;{% include 'template.html' with {'foo': 'bar'} %}&#xA;&#xA;{% set vars = {'foo': 'bar'} %}&#xA;{% include 'template.html' with vars %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7065" LastActivityDate="2019-01-07T15:34:51.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29019" PostTypeId="1" CreationDate="2019-01-07T16:03:38.133" Score="1" ViewCount="160" Body="&lt;p&gt;I am creating a news item page for a future release but I can't figure out how to preview it in Live View without Enabling it.  Is there a way to view a page in progress without publishing it live?&lt;/p&gt;&#xA;" OwnerUserId="9223" LastActivityDate="2019-01-07T18:45:34.077" Title="How to view a draft page in live view without publishing it" Tags="&lt;draft&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29021" PostTypeId="2" ParentId="29019" CreationDate="2019-01-07T18:45:34.077" Score="2" Body="&lt;p&gt;This should be possible right out of the box. Make sure that you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Have the correct entry template set in the Section's settings&lt;/li&gt;&#xA;&lt;li&gt;Are using Craft's native &lt;code&gt;{{ entry }}&lt;/code&gt; variables in the template.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It might be helpful if you posted your template code.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-07T18:45:34.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29022" PostTypeId="2" ParentId="29017" CreationDate="2019-01-07T19:19:32.063" Score="2" Body="&lt;p&gt;I suggest using macro (and &lt;code&gt;switch&lt;/code&gt; tag instead of &lt;code&gt;if&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro ratio(block) %}&#xA;{% spaceless %}&#xA;    {% switch block.imageRatio %}&#xA;        {% case &quot;thumb&quot; %}&#xA;            imageVariantsThumb&#xA;        {% case &quot;16by9&quot; %}&#xA;            imageVariants16by9&#xA;        {% case &quot;3by2&quot; %}&#xA;            imageVariants3by2&#xA;    {% endswitch %}&#xA;{% endspaceless %}    &#xA;{% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Macro would be used like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import 'macro' as macroRatio %}&#xA;{% set imageRatio = macroRatio.ratio(block)|trim %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="5257" LastEditDate="2019-01-09T10:17:24.513" LastActivityDate="2019-01-09T10:17:24.513" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29023" PostTypeId="2" ParentId="722" CreationDate="2019-01-08T01:44:31.327" Score="3" Body="&lt;p&gt;In craft 3 it is actually possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.app.view.evaluateDynamicContent('phpinfo();') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see above, php code is passed as string to evaluateDynamicContent function. On inside, evaluateDynamicContent is just running &lt;code&gt;eval&lt;/code&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, even if you can do this, doesn't mean that you should. Before doing this, consider if you have other alternatives for doing what you want to achieve. Using php code inside template can run you into all kind of unpredicted security issues.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-01-08T01:44:31.327" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29024" PostTypeId="2" ParentId="661" CreationDate="2019-01-08T01:51:47.213" Score="1" Body="&lt;p&gt;If you need to allow or disallow specific tags, you can use wordsmith plugin and its &lt;a href=&quot;https://wordsmith.docs.topshelfcraft.com/guide/truncation.html#chop&quot; rel=&quot;nofollow noreferrer&quot;&gt;chop&lt;/a&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you don't need such advanced functionality, you can just use Twig macros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In article &lt;a href=&quot;http://craftsnippets.com/articles/truncating-text-with-twig-macros-in-craft-cms?s=s&quot; rel=&quot;nofollow noreferrer&quot;&gt;Truncating text with Twig macros in Craft CMS&#xA;&lt;/a&gt; on my blog I describe two macros - one that truncates by &lt;strong&gt;number of words&lt;/strong&gt; and one that truncates by &lt;strong&gt;number of characters&lt;/strong&gt; - while ensuring that truncated string does not have split words.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="9038" LastEditDate="2019-07-11T19:36:12.347" LastActivityDate="2019-07-11T19:36:12.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29027" PostTypeId="1" CreationDate="2019-01-08T12:02:15.200" Score="1" ViewCount="54" Body="&lt;p&gt;I'm retiring a section of my website and want to remove all existing internal links to this section. Is there an existing way to find any links to each entry in that section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These links are all in Redactor fields (eg. inserted via the toolbar), and these fields may have different names etc across multiple sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried running a regex search across a Craft database dump, looking for a pattern of &lt;code&gt;{entry:[0-9]+:url}&lt;/code&gt; which shows me all the places that link to other entries, but this alone only gives me the entry IDs so I'll have to write further code to look up those IDs and work out which ones are in the section I'm removing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easier way to do this, or is it going to be a semi-manual job?&lt;/p&gt;&#xA;" OwnerUserId="6844" LastActivityDate="2019-01-08T21:49:13.780" Title="How can I find entries that link to a given entry?" Tags="&lt;entry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29028" PostTypeId="1" CreationDate="2019-01-08T13:44:55.343" Score="1" ViewCount="36" Body="&lt;p&gt;I use the plugin freeform and now i need a checkbox/lightswitch/selectbox where i can select a specific behaviour (custom variable/attribute)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i simply want to add a checkbox above &quot;Collect IP Addresses&quot; (or any other place) in the form settings. I think i need a plugin which extends the freeform-plugin. But i can not find a hook/example how to add fields/variables/attributes in the adminpanel, which can be checked by the admin/user and are available in the further process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To explain it more in detail: I use a custom plugin to extend the behaviour after submit - so a custom action happens. If the checkbox is checked, a second action should be triggered. I do not want to define the handles of specific forms, because the adminuser should be able to create a new form and enable my switch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to create i lightswitch field on the same page, where i insert the form. But because of using &quot;freeform.form(xxx).render&quot; i am not able to transfer my variable into the &quot;EVENT_AFTER_SUBMIT&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope you understand my thoughts and someone has a good idea on how to solve this. Maybe it is even impossible, even this would help me ;)&lt;/p&gt;&#xA;" OwnerUserId="8529" LastActivityDate="2019-01-08T13:44:55.343" Title="Add Checkbox to adminpanel / form settings" Tags="&lt;plugin-freeform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29029" PostTypeId="1" CreationDate="2019-01-08T15:09:50.113" Score="0" ViewCount="84" Body="&lt;p&gt;I'm having a Craft Commerce issue receiving cart.adjustments data in my twig templates. I've created a shipping category and shipping method with a rule to add a base rate of $10 to every order, but am not receiving any data from the front end; cart.adjustments is shown as empty. could someone please help me with resolving this issue? thank you&lt;/p&gt;&#xA;" OwnerUserId="9228" LastActivityDate="2019-01-17T06:06:01.817" Title="Craft Commerce - empty cart.adjustments data" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29030" PostTypeId="1" CreationDate="2019-01-08T16:49:38.820" Score="1" ViewCount="374" Body="&lt;p&gt;Getting error: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Calling unknown method:&#xA;  craft\web\twig\variables\CraftVariable::markAsReadModule()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Trying to use a template variable that I created in my Craft 3 module, I use this module for other things that work as expected but I am running into an issue with this in the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.markAsReadModule.read(entry.id) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the init method for &lt;code&gt;craft/modules/markasreadmodule/MarkAsReadModule.php&lt;/code&gt; I register the variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\web\twig\variables\CraftVariable;&#xA;use modules\markasreadmodule\variables\MarkAsReadModuleVariable;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I have this in the init:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    CraftVariable::class,&#xA;    CraftVariable::EVENT_INIT,&#xA;    function (Event $event) {&#xA;        /** @var CraftVariable $variable */&#xA;        $variable = $event-&amp;gt;sender;&#xA;        $variable-&amp;gt;set('markAsReadModule', MarkAsReadModuleVariable::class);&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;craft/modules/markasreadmodule/variables/MarkAsReadModuleVariable.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function read($entryId)&#xA;{&#xA;    $service = new MarkAsRead(); // initialize the service class&#xA;    $read = $service-&amp;gt;read($entryId);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I suspect I am setting the naming convention where I include it in the template and/or in the init method within &lt;code&gt;craft/modules/markasreadmodule/MarkAsReadModule.php&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3618" LastEditorUserId="57" LastEditDate="2019-01-08T19:25:58.263" LastActivityDate="2020-02-11T11:30:14.227" Title="Incorrectly setting module template variable" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;variable&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29031" PostTypeId="1" AcceptedAnswerId="29033" CreationDate="2019-01-08T17:03:39.910" Score="2" ViewCount="92" Body="&lt;p&gt;I am migrating my plugin to Craft 3 / Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to call another plugins method like &lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;getOrderByNumber($number)&lt;/code&gt; from my plugins service?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-08T22:03:45.023" Title="Correct way to getOrderByNumber() from my Plugin in Commerce 2" Tags="&lt;plugin-development&gt;&lt;migration&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29033" PostTypeId="2" ParentId="29031" CreationDate="2019-01-08T17:26:04.190" Score="1" Body="&lt;p&gt;All of Craft’s core services are available via the &lt;code&gt;Craft::$app-&amp;gt;getServiceName()-&amp;gt;callServiceMethod()&lt;/code&gt; signature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the Elements service would be &lt;code&gt;Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of other plugins, most will make their Singleton “instance” available as a property on (or method of) their primary plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft/commerce/Plugin as Commerce;&#xA;// Maybe a class declaration, and inside your own method…&#xA;Commerce::getInstance()-&amp;gt;getOrders()-&amp;gt;getOrderByNumber('abc123...');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2019-01-08T22:03:45.023" LastActivityDate="2019-01-08T22:03:45.023" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29034" PostTypeId="1" AcceptedAnswerId="29037" CreationDate="2019-01-08T20:34:09.177" Score="1" ViewCount="432" Body="&lt;p&gt;On a site with Commerce 1, I have set up some custom fields for order related data. I can set them using form inputs like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[myCustomField]&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd prefer to set it from a plugin using an even hook.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event) {&#xA;    $order = $event-&amp;gt;params['order'];&#xA;    $order&amp;gt;myCustomField = 3;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It fails with a &lt;code&gt;CExeption&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Property &quot;Craft\Commerce_OrderModel.myCustomField&quot; is not defined.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can set my field from the form and then read the value from my plugin, so the field is readable, but I am unable to set it. So far, all I can figure out is that the Craft BaseModel strictAttributes parameter is set to true, and the model does not seem to have any attributes set for my field. The BaseModel attempts to set the field value by calling parent::_set(), which is what triggers the CExeption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to set my field from my plugin?&lt;/p&gt;&#xA;" OwnerUserId="8792" LastEditorUserId="8792" LastEditDate="2019-01-08T22:51:11.257" LastActivityDate="2019-01-09T23:24:28.800" Title="Can I set a Commerce order custom field from a plugin" Tags="&lt;plugin-craftcommerce&gt;&lt;order&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29035" PostTypeId="2" ParentId="29027" CreationDate="2019-01-08T21:49:13.780" Score="1" Body="&lt;p&gt;Have you thought about running something like Screaming Frog &lt;a href=&quot;https://www.screamingfrog.co.uk/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.screamingfrog.co.uk/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-01-08T21:49:13.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29036" PostTypeId="2" ParentId="28990" CreationDate="2019-01-09T08:06:54.067" Score="1" Body="&lt;p&gt;Currently, there is no Craft 3.1 compatible version of the Redactor plugin. There's a branch in the Redactor plugin repository that has such a version, but that will be released only when Craft 3.1 is released as well.&lt;/p&gt;&#xA;" OwnerUserId="258" LastActivityDate="2019-01-09T08:06:54.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29037" PostTypeId="2" ParentId="29034" CreationDate="2019-01-09T09:20:12.950" Score="2" Body="&lt;p&gt;You can use $order-&gt;setContent()&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;on('commerce_orders.onBeforeOrderComplete', function($event) {&#xA;  $order = $event-&amp;gt;params['order'];&#xA;  $content = array('myCustomField' =&amp;gt; 3);&#xA;  $order-&amp;gt;setContent($content);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-09T09:20:12.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29038" PostTypeId="1" AcceptedAnswerId="29041" CreationDate="2019-01-09T09:37:40.407" Score="1" ViewCount="28" Body="&lt;p&gt;We sell vouchers to our shop users. To prevent them for being used on vouchers themself, i could relate them to specific productTypes or even products in Commerce 1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;commerce_discounts-&amp;gt;saveDiscount($discount, $groups, $productTypes, $products)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Commerce 2 the 3rd and 4th parametes are gone. How can i relate vouchers to product types programmaticely? &lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-09T11:07:49.940" Title="What happened to commerce_discounts-&gt;saveDiscounts or How to relate vouchers to product types in Commerce 2?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29039" PostTypeId="1" AcceptedAnswerId="29040" CreationDate="2019-01-09T09:48:25.600" Score="1" ViewCount="39" Body="&lt;p&gt;In Commerce i got an instance of DiscountModel Class as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$discount = new Commerce_DiscountModel();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the right way in Commerce 2?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\models\Discount as DiscountModel;&#xA;...&#xA;$discount = DiscountModel::instance();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-09T10:50:29.980" Title="How to get instance of DiscountModel in Commerce 2?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29040" PostTypeId="2" ParentId="29039" CreationDate="2019-01-09T10:50:29.980" Score="1" Body="&lt;pre&gt;&lt;code&gt;$discount = new \craft\commerce\models\Discount();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-09T10:50:29.980" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29041" PostTypeId="2" ParentId="29038" CreationDate="2019-01-09T11:07:49.940" Score="1" Body="&lt;p&gt;You now need to set the groups, product types, and purchasables on the discount model directly, then just pass the discount model to the saveDiscount method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Plugin::getInstance()-&amp;gt;getDiscounts()-&amp;gt;saveDiscount($discount)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of setting these things on the discount before saving can be found in the discount controller:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/src/controllers/DiscountsController.php#L128-L166&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/blob/develop/src/controllers/DiscountsController.php#L128-L166&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-09T11:07:49.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29042" PostTypeId="1" AcceptedAnswerId="29043" CreationDate="2019-01-09T11:53:03.063" Score="1" ViewCount="87" Body="&lt;p&gt;I'm using SEOmatic plugin in craft cms 3 and I need to set the seoTitle in my template but can't figure out how to do it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that in Craft 2, it was possible to merge the seomatic variable. I tried something like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seomatic = seomatic|merge({&#xA;    meta: {&#xA;        seoTitle: 'my title'&#xA;    }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't work because the merge filter only works with arrays or &quot;Traversable&quot;, and I got object... I'm kind of stuck with this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone ever managed to make a merge of seoTitle?&lt;/p&gt;&#xA;" OwnerUserId="5897" LastEditorUserId="57" LastEditDate="2019-01-09T18:21:47.010" LastActivityDate="2019-01-09T18:21:47.010" Title="How to merge SEOmatic object in Craft 3?" Tags="&lt;craft3&gt;&lt;plugin-seomatic&gt;&lt;merge&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29043" PostTypeId="2" ParentId="29042" CreationDate="2019-01-09T12:09:05.187" Score="2" Body="&lt;p&gt;Based on the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#seomatic-variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic docs&lt;/a&gt;, something like this should do the trick nicely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seomatic.meta.seoTitle(&quot;my title&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2019-01-09T12:09:05.187" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29045" PostTypeId="2" ParentId="22462" CreationDate="2019-01-09T14:50:28.837" Score="4" Body="&lt;p&gt;There are so many tables that phpMyAdmin paginates them. All the tables that came after craft_tags alphabetically are on the second page, making it look like there is no craft_users table. Pagination controls are at the top:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9QxUE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9QxUE.png&quot; alt=&quot;craft_users is on the second page&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason I know? I just made the same mistake.&lt;/p&gt;&#xA;" OwnerUserId="9232" LastActivityDate="2019-01-09T14:50:28.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29046" PostTypeId="1" CreationDate="2019-01-09T16:17:56.810" Score="1" ViewCount="39" Body="&lt;p&gt;How can a script loaded as an ES module be reinitiated after changes are made in Live Preview? In my experience a script loaded as a module is  executed the first time Live Preview is opened, but then isn’t executed on subsequent loads as the page refreshes with edited content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://jakearchibald.com/2017/es-modules-in-browsers/#modules-only-execute-once&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, modules will only execute once per page. I’m including a function that is executed on the window’s &lt;code&gt;load&lt;/code&gt; event and it is fired each time Live Preview is updated — which makes me think the script should be loaded and executed each time Live Preview updates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simplified case. Include a script that alerts some text when the script is loaded and on the window’s &lt;code&gt;load&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alert('Script Loaded')&#xA;&#xA;window.addEventListener('load', () =&amp;gt; {&#xA;    alert('Window Loaded')&#xA;})&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Include it in the page as a module:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script type=&quot;module&quot; src=&quot;app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Open Live Preview and the alerts fire. Make a change, page refreshes, content is updated — no alerts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Include it as a regular script&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Open Live Preview and the alerts fire. Make a change, page refreshes, content is updated — alerts fire again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m working around it by loading a legacy &lt;code&gt;nomodule&lt;/code&gt; version of the script  in Live Preview, but curious if there is another solution or event to listen for to trigger the JS to execute again when Live Preview is updated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#&#xA; # Load legacy JS in Live Preview because modules&#xA; # aren’t executed after the page reloads&#xA;/#}&#xA;{% if craft.app.request.isLivePreview %}&#xA;    &amp;lt;script src=&quot;app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;{% else %}&#xA;    &amp;lt;script type=&quot;module&quot; src=&quot;app.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="93" LastActivityDate="2019-01-09T16:17:56.810" Title="Can scripts loaded as ES Modules work with Live Preview?" Tags="&lt;javascript&gt;&lt;live-preview&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29048" PostTypeId="1" AcceptedAnswerId="29061" CreationDate="2019-01-09T22:44:14.200" Score="2" ViewCount="476" Body="&lt;p&gt;I want to upload all my Craft files along with the database to an Ubuntu server using composer. This server is an EC2 instance of AWS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="57" LastEditDate="2019-01-10T18:19:52.153" LastActivityDate="2020-09-23T07:32:06.673" Title="How to deploy website from dev to staging from localhost to remote server using composer" Tags="&lt;craft3&gt;&lt;aws&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29049" PostTypeId="2" ParentId="29034" CreationDate="2019-01-09T23:24:28.800" Score="1" Body="&lt;p&gt;To set the content of a specific custom field on an order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$order-&amp;gt;setFieldValue(&quot;yourFieldHandle&quot;, $data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="340" LastActivityDate="2019-01-09T23:24:28.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29051" PostTypeId="1" AcceptedAnswerId="29276" CreationDate="2019-01-10T01:00:53.283" Score="1" ViewCount="395" Body="&lt;p&gt;As my first delve into webhooks I've just installed the Pixel&amp;amp;Tonic Webhooks plugin. I'm trying to send data from a front end contact form to Zapier. The front end form uses the Pixel&amp;amp;Tonic Contact Form plugin and the webhook setting is set to the &lt;code&gt;beforeSend&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the connections working although the webhook doesn't seem to fire automatically. It only sends data to Zapier when I refresh the admin control panel (a 'Sending webhook ...' task displays briefly at the bottom of the control panel's left sidebar). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The email is sending just fine and is immediately received, it's just the webhook that seems to be getting 'stuck'. Is there anything I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ol9LZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ol9LZ.png&quot; alt=&quot;Webhooks settings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ptjbb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ptjbb.png&quot; alt=&quot;Queue db table with stuck task&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2257" LastEditorUserId="2257" LastEditDate="2019-01-11T00:57:21.210" LastActivityDate="2019-01-26T15:24:01.180" Title="Webhook plugin &amp; hooking into Contact Form" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;plugin-contactform&gt;&lt;tasks&gt;&lt;hook&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29052" PostTypeId="1" AcceptedAnswerId="29053" CreationDate="2019-01-10T02:21:14.277" Score="1" ViewCount="307" Body="&lt;p&gt;I'm trying to route users to a &quot;locations&quot; structure entry that normally has a URL structure that looks like: &lt;code&gt;locations/&amp;lt;slug&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My client wants to use the structure of links from their old site to preserve SEO and wants to have the URL structure of: &lt;code&gt;locations/&amp;lt;state&amp;gt;/&amp;lt;slug&amp;gt;&lt;/code&gt; where state is a 2 letter string. So, I'm trying to set up a route rule that just ignores the  parameter and redirects to the regular route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In routes.php I have the following rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'locations/&amp;lt;state:[a-z]{2}&amp;gt;/&amp;lt;slug:{slug}&amp;gt;' =&amp;gt; 'locations/&amp;lt;slug&amp;gt;'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try to hit a route (for example &lt;code&gt;locations/ca/slug-name&lt;/code&gt;) I get an InvalidRouteException and an error message saying: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unable to resolve the request &quot;locations/slug-name&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks like it's stripping out the state parameter successfully but I'm not sure why &lt;code&gt;locations/slug-name&lt;/code&gt; isn't recognized as a valid route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing? Is there an easier way to do this? &lt;/p&gt;&#xA;" OwnerUserId="9144" LastActivityDate="2019-01-10T04:45:03.473" Title="Routing: How can I ignore a parameter in route definition?" Tags="&lt;config&gt;&lt;routes&gt;&lt;routing&gt;&lt;regex&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29053" PostTypeId="2" ParentId="29052" CreationDate="2019-01-10T04:45:03.473" Score="3" Body="&lt;p&gt;It sounds like you might be trying to blend Craft/Yii routing with Rewrites (if you're coming from an Apache background).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe what Craft interprets this as is an attempt to map a request to &lt;code&gt;locations/or/my-entry-slug&lt;/code&gt; to the &lt;code&gt;&amp;lt;slug&amp;gt;&lt;/code&gt; (literal) action of the &lt;code&gt;locations&lt;/code&gt; controller (which doesn't exist).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want to render a template for these entries, you can set up your route like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'locations/&amp;lt;state:[a-z]{2}&amp;gt;/&amp;lt;slug:{slug}&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'locations/entry']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way, you'll get a &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;slug&lt;/code&gt; variable in the &lt;code&gt;templates/locations/entry.twig&lt;/code&gt; template, with which you can look up the Locations Entry you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To troubleshoot further, we might need a bit more information about how your Locations Section is set up, and the goals for the route!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you're just looking to capture and redirect legacy URLs, be sure and &lt;a href=&quot;https://github.com/nystudio107/craft-retour&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out the Retour plugin&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Additionally (and for anyone who finds this in the future), I'd recommend reviewing the &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules&quot; rel=&quot;nofollow noreferrer&quot;&gt;advanced routing&lt;/a&gt; docs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2019-01-10T04:45:03.473" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29054" PostTypeId="2" ParentId="14960" CreationDate="2019-01-10T08:43:05.283" Score="7" Body="&lt;p&gt;If anyone comes here looking for this answer for Craft 3 the function you are looking for is &lt;code&gt;Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsCpRequest()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="129" LastActivityDate="2019-01-10T08:43:05.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29055" PostTypeId="2" ParentId="26514" CreationDate="2019-01-10T08:48:10.593" Score="3" Body="&lt;p&gt;I created a plugin specifically to do this - &#xA;&lt;a href=&quot;https://github.com/bymayo/craft-pdf-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bymayo/craft-pdf-transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It takes Asset PDF files and coverts them to JPEG / PNG files automatically when they are uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, do theres a Twig method that lets you convert the PDF to an image if the image already exists in Assets. But this can be a bit labour intensive on the server to do when a template is rendering so is only advised for small files.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-01-10T08:48:10.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29056" PostTypeId="2" ParentId="15638" CreationDate="2019-01-10T08:49:56.780" Score="1" Body="&lt;p&gt;For anyone looking to do this on Craft 3, I used pThumb previously, but I created a plugin specifically to do this for Craft 3 - &lt;a href=&quot;https://github.com/bymayo/craft-pdf-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bymayo/craft-pdf-transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It takes Asset PDF files and coverts them to JPEG / PNG files automatically when they are uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, do theres a Twig method that lets you convert the PDF to an image if the image already exists in Assets. But this can be a bit labour intensive on the server to do when a template is rendering so is only advised for small files.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-01-10T08:49:56.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29058" PostTypeId="1" CreationDate="2019-01-10T10:11:51.587" Score="0" ViewCount="265" Body="&lt;p&gt;I have a lot of News entries in a Craft 2.6.2990 website that I would like to export and then import into Wordpress.&#xA;Most of the advice out there is for doing this the other way round.&#xA;I need Title, Post content, featured image and date created for each entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking that I should be using the Sprout plugin to export to a csv file. Can anyone offer any advice on this and confirm if this is the right way to go about it? I am not very familiar with Craft.&#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="9238" LastActivityDate="2019-01-18T12:00:51.197" Title="How to export 1 Entries type (&quot;news&quot;) from Craft to Wordpress" Tags="&lt;csv&gt;&lt;export&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29059" PostTypeId="2" ParentId="29058" CreationDate="2019-01-10T10:41:00.087" Score="1" Body="&lt;p&gt;Most people are going the other way. Is there a particular reason you want to downgrade? ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being serious though...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need the entries in a CSV format then yes you could use an export plugin such as Sprout or Export. Or you could make a template that outputs your content in the format required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose a plugin, then you'd need to read the documentation to find out how to set that up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for importing into Wordpress. That's dependent on your Wordpress setup and what you are using to do the import and is probably outside the scope of this particular Stack Exchange site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But bear in mind that Craft is incredibly flexible so if the reason you're wanting to switch is related to particular functionality it could almost certainly be achieved with Craft.&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2019-01-10T10:41:00.087" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29060" PostTypeId="2" ParentId="709" CreationDate="2019-01-10T13:40:41.190" Score="1" Body="&lt;p&gt;Had the same issue. However, I had valid URLs and templates, as I used the same setup for other news sections on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I resorted to creating a new section for the entries with the same details as the previous (had to change the details of the original one first) then, in the database I changed the section IDs in the entries to move them to the new section I created. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fixed the odd issue I had, where everything looked fine but didn't work.  &lt;/p&gt;&#xA;" OwnerUserId="9240" LastActivityDate="2019-01-10T13:40:41.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29061" PostTypeId="2" ParentId="29048" CreationDate="2019-01-10T14:45:14.170" Score="2" Body="&lt;p&gt;There is a course on CraftQuest regarding deployment of Craft CMS you might want to check out: &lt;a href=&quot;https://craftquest.io/courses/deploying-craft-cms-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftquest.io/courses/deploying-craft-cms-3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my personal workflow, I develop locally then push my codebase to Github. Since my servers are built using Laravel Forge, I have it set up to deploy my code to my server, which can be an AWS server, Digital Ocean, or any number of places. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some sites, I use a more robust deployment service. I've used both Envoyer.io and Deploybot to do that. I wrote a post on the Deploybot set up I used. You can find that post here: &lt;a href=&quot;https://supergeekery.com/blog/laravel-forge-and-deploy-bot&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://supergeekery.com/blog/laravel-forge-and-deploy-bot&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="349" LastActivityDate="2019-01-10T14:45:14.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29062" PostTypeId="1" AcceptedAnswerId="29063" CreationDate="2019-01-10T17:32:32.030" Score="1" ViewCount="360" Body="&lt;p&gt;I've reference this &lt;a href=&quot;https://craftcms.stackexchange.com/questions/9344/exclude-category-from-channel-entries-with-pagination&quot;&gt;related thread&lt;/a&gt; but haven't found a working solution that supports pagination and will exclude entries that have multiple categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code example will not include Category One, but when an entry has Category One and Category Two it will still display because Category Two is included in the cateogries array. Is there a way to still exclude the entry even if it's second category is included?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# Get all the categories you want to INCLUDE #}&#xA;  {% set categories = craft.categories({&#xA;      group: 'categories',&#xA;      slug: [&#xA;        'not category-one',&#xA;      ],&#xA;      limit: null,&#xA;    }).all() %}&#xA;&#xA;  {# Get entries related to your desired categories #}&#xA;  {% set latestNews = craft.entries({&#xA;      section: 'news',&#xA;      relatedTo: categories,&#xA;      with: ([&#xA;        ['image', {&#xA;          withTransforms: ['medium']&#xA;        }]&#xA;      ]),&#xA;      orderBy: 'postDate desc',&#xA;      limit: 4&#xA;    }).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9241" LastActivityDate="2019-01-10T18:43:36.127" Title="Issue Excluding Entries with Multiple Categories in Query" Tags="&lt;craft3&gt;&lt;categories&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29063" PostTypeId="2" ParentId="29062" CreationDate="2019-01-10T18:43:36.127" Score="3" Body="&lt;p&gt;Start by getting the category ID(s) you want to exclude:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set categoryIds = craft.categories()&#xA;    .group('categories')&#xA;    .slug('category-one')&#xA;    .ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then get all the entry IDs that are related to them, which should be excluded:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set excludeIds = craft.entries()&#xA;    .relatedTo({&#xA;        targetElement: categoryIds&#xA;    })&#xA;    .ids() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then run your main news query, excluding those entry IDs.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set latestNews = craft.entries()&#xA;    .section('news')&#xA;    .id(['not']|merge(excludeIds))&#xA;    .with([&#xA;        ['image', {&#xA;            withTransforms: ['medium']&#xA;        }]&#xA;    ])&#xA;    .orderBy('postDate desc')&#xA;    .limit(4)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-01-10T18:43:36.127" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29064" PostTypeId="1" AcceptedAnswerId="29065" CreationDate="2019-01-10T18:57:49.187" Score="1" ViewCount="29" Body="&lt;p&gt;I'm preparing to migrate an old ExpressionEngine site to Craft and there are channels with images that are being resized by wrapping the rich text editor with &lt;a href=&quot;https://docs.causingeffect.com/expressionengine/ce-image/user-guide/basics.html#bulk-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;ce image bulk tag&lt;/a&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{exp:ce_img:bulk attributes=&quot;class='img-responsive'&quot;}&#xA; {brand_copy}&#xA;{/exp:ce_img:bulk}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to accomplish the same thing in Craft.. apply bulk transforms to images in a  rich text editor? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Need this for legacy content that will be moved in with feedme, new content will have a matrix set up using a different entry type.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-01-10T19:29:26.210" Title="Craft Equivelent of EE addon CE Image Bulk Tag?" Tags="&lt;image-transforms&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29065" PostTypeId="2" ParentId="29064" CreationDate="2019-01-10T19:29:26.210" Score="1" Body="&lt;p&gt;You can do the same thing using the &lt;a href=&quot;https://github.com/mmikkel/Retcon-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon plugin&lt;/a&gt; for Craft. Have a look at the &lt;a href=&quot;https://github.com/mmikkel/Retcon-Craft/wiki/Transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki entry for the &lt;code&gt;transform&lt;/code&gt; filter&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2019-01-10T19:29:26.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29066" PostTypeId="1" CreationDate="2019-01-10T19:53:45.363" Score="1" ViewCount="190" Body="&lt;p&gt;I am installing a repo locally, and everything runs smoothly and I am able to see the site and login to my admin. But when I import my DB then visit my site: I get the error message &quot;Site unavailable&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I visit my admin area I see the message: &quot;To complete the update, some changes must be made to your database.&quot; I click proceed and see the message &quot;Craft couldn’t backup the database. How would you like to proceed?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Craft 3. But the DB I am importing from uses the older 'craft_' prefix, which I defined in the setup. Am stumped on how to solve this.&lt;/p&gt;&#xA;" OwnerUserId="9229" LastEditorUserId="57" LastEditDate="2019-01-11T00:30:33.040" LastActivityDate="2019-06-10T16:04:25.637" Title="Unable to access site after importing DB" Tags="&lt;craft3&gt;&lt;database&gt;&lt;installation&gt;&lt;craft2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29067" PostTypeId="2" ParentId="28967" CreationDate="2019-01-10T21:28:03.797" Score="2" Body="&lt;p&gt;I needed to put my &lt;code&gt;&quot;related&quot;&lt;/code&gt; array inside a &lt;code&gt;&quot;content&quot;&lt;/code&gt; array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;&#xA;  {&#xA;    &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;    &quot;content&quot;: {&#xA;      &quot;related&quot;: {&#xA;        &quot;relatedResources&quot;: {&#xA;            &quot;@model&quot;: &quot;barrelstrength\\sproutbase\\app\\import\\importers\\elements\\Entry&quot;,&#xA;            &quot;params&quot;: {&#xA;                &quot;slug&quot;: &quot;test-import-child&quot;,&#xA;                &quot;sectionId&quot;: 2,&#xA;                &quot;siteId&quot;: 1&#xA;              }&#xA;          }&#xA;      }&#xA;    },&#xA;    &quot;settings&quot;: {&#xA;      &quot;updateElement&quot;: {&#xA;        &quot;params&quot;: {&#xA;          &quot;slug&quot;: &quot;test-import-parent&quot;,&#xA;          &quot;sectionId&quot;: 2,&#xA;          &quot;siteId&quot;: 1&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also added the &lt;code&gt;siteId&lt;/code&gt; parameter as a matter of good practice but it's not strictly necessary.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-10T21:28:03.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29068" PostTypeId="1" AcceptedAnswerId="29382" CreationDate="2019-01-10T22:29:07.243" Score="4" ViewCount="755" Body="&lt;p&gt;I've got this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Creating users through frontend&#xA;    Event::on(Users::class, Users::EVENT_BEFORE_ACTIVATE_USER, function(UserEvent $event) {&#xA;        $userId = $event-&amp;gt;user-&amp;gt;id;&#xA;&#xA;        // Allow assigning user groups through the frontend (circumvent elevated user sessions)&#xA;        $groupId = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('userGroup');&#xA;        if ($groupId) {&#xA;            Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($userId, [$groupId]);&#xA;        }&#xA;&#xA;        // This does not work&#xA;        Craft::$app-&amp;gt;users-&amp;gt;getUserById($userId)-&amp;gt;setFieldValue('discountPercentage', 15);&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assigning the user group works fine, so I don't get why assigning a field value doesn't. The &lt;code&gt;discountPercentage&lt;/code&gt; field is a simple Number fieldtype&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried &lt;code&gt;$event-&amp;gt;user-&amp;gt;setFieldValue('discountPercentage', 15);&lt;/code&gt; without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I tried surrounding &lt;code&gt;15&lt;/code&gt; in quotes, like &lt;code&gt;'15'&lt;/code&gt;, but that didn't work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Submitting the &quot;create user form&quot; through the frontend gives no errors. &lt;code&gt;discountPercentage&lt;/code&gt; is just left blank.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2020-05-15T22:06:38.410" Title="Can't get setFieldValue to work" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29069" PostTypeId="2" ParentId="25354" CreationDate="2019-01-10T23:11:38.340" Score="1" Body="&lt;p&gt;Try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\recoveryfinder\craftnav\Craftnav::getInstance()-&amp;gt;getSettings()-&amp;gt;ulStateClass;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming your main plugin file/class is Craftnav.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-10T23:11:38.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29071" PostTypeId="2" ParentId="29006" CreationDate="2019-01-10T23:51:32.967" Score="1" Body="&lt;p&gt;I updated my template to conditionally set the &lt;code&gt;{{ entry }}&lt;/code&gt; variable depending on if the request is a live preview or not.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if not craft.app.request.isLivePreview() %}&#xA;    {% set entry = craft.entries({&#xA;        section: 'Events',&#xA;        slug: craft.app.request.segment(2),&#xA;        status: ['live','pending','expired']&#xA;    }).one %}&#xA;{% endif %}&#xA;&#xA;&#xA;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;{{ entry.body }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if it's a Live Preview request, tell Craft to use its native dynamic &lt;code&gt;{{ entry }}&lt;/code&gt; variable, which will work in Live Preview no matter what the entry's status is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if the request is not a live preview, we need to explicitly tell the template what entry we're trying to access, so we set the &lt;code&gt;craft.entries&lt;/code&gt; variable.&lt;/p&gt;&#xA;" OwnerUserId="234" LastActivityDate="2019-01-10T23:51:32.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29072" PostTypeId="2" ParentId="29066" CreationDate="2019-01-11T00:30:20.043" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But when I import my DB then visit my site: I get the error message &quot;Site unavailable&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You get that because it's a front-end site request and Craft needs to make updates to the database that can be triggered by the Control Panel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I click proceed and see the message &quot;Craft couldn’t backup the database. How would you like to proceed?&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because Craft uses &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;mysqldump&lt;/a&gt; (if you're using MySQL) to perform database backups and the path to that currently isn't available to PHP in your environment. The easiest way to fix it is to add the path to &lt;code&gt;mysqldump&lt;/code&gt; to your system PATH environment varible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can manually perform a database backup using your favorite database client, and click the &quot;Continue anyway&quot; button to let Craft finish performing the update.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-11T00:30:20.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29073" PostTypeId="1" CreationDate="2019-01-11T01:40:58.493" Score="2" ViewCount="155" Body="&lt;p&gt;I'm new to Craft Commerce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to add around 10 price tiers to each product. Users are in groups and the group determines which price tier they pay. All the data is to be imported (and kept up to date) via API from an inventory management system. There are around 5000 products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sales and Discounts do not seem to be a good option as these are applied to whole groups of products whereas in my case each product has different pricing at each tier - there is no standard formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another SE question,&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/14769/multiple-prices-based-on-user-in-craft-commerce&quot;&gt;Multiple Prices based on User in Craft Commerce&lt;/a&gt;, uses variants. Is this the best way to go? For me the only difference is price so I feel it is not really a variant and this is a rather cluttered approach, especially as for each variant I will have to repeat a number of other fields. (And I might want to be able to use variants for the real variants rather than have the real variants as separate products to avoid a variants-squared situation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm looking for advice on overall direction. It will be Craft 3/Commerce 2. TIA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; I was able to import the price tiers into custom fields on each product, and then on the product page display the correct price based on the user category selecting the right price tier. And then use this in a hidden field - I had to use options because I couldn't get it to work otherwise - not sure what I was doing wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;options[customPrice]&quot; value=&quot;{{price}}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then (not knowing much anything about OOP PHP, but being a good scrounger who can copy and paste) I was able to modify the line item in the checkout page like so in Plugin class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init() {&#xA;  Event::on(LineItems::class, LineItems::EVENT_POPULATE_LINE_ITEM, function(LineItemEvent $e) {&#xA;    $lineItem = $e-&amp;gt;lineItem;&#xA;    if(isset($lineItem-&amp;gt;options['customPrice'])){&#xA;        $lineItem-&amp;gt;price =  $lineItem-&amp;gt;options['customPrice']; &#xA;    }&#xA;});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems to work, but who knows what sensibility boundaries I have crossed. The OOP side of things may as well be Greek to me.&lt;/p&gt;&#xA;" OwnerUserId="695" LastEditorUserId="695" LastEditDate="2019-01-15T03:45:57.467" LastActivityDate="2019-01-15T03:45:57.467" Title="How best to add price tiers based on user group" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29074" PostTypeId="1" AcceptedAnswerId="29076" CreationDate="2019-01-11T10:14:32.587" Score="1" ViewCount="98" Body="&lt;p&gt;I need to displaying some notifications on a Craft site, and I want to allow users to mark each notification as read. There won't be many users or notifications, so a plugin seems overkill. Instead I've created a &lt;em&gt;Notifications&lt;/em&gt; section with a &lt;em&gt;Read by&lt;/em&gt; (Users) field called &lt;code&gt;notificationReadBy&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notifications display on the template inside an entry form, with a hidden multi-select field containing all users who've marked the notification as read (i.e. already submitted the form) plus the current user's id in case they want to mark as read too. That works fine to build a list of users who've already read the notification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step is to hide the notification altogether if the current user has already marked it as read, and is listed in the &lt;em&gt;Read by&lt;/em&gt; field. So I thought something like this might work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries&#xA;    .section('notifications')&#xA;    .all() %}&#xA;    {% set readBy = entry.notificationReadBy %}&#xA;    {% if currentUser.id not in readBy %}&#xA;        {# Show the notification #}&#xA;    {% endif %}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does that make sense? Anyway, it's not working as expected and is displaying the entry regardless of whether the current user is listed in &lt;em&gt;Read by&lt;/em&gt; or not. Any ideas? Maybe it's neater to move the query up to the entries tag, using the &lt;code&gt;.search()&lt;/code&gt; param, but I can't get that working either?&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2019-01-11T14:37:42.430" Title="Querying an array of users" Tags="&lt;entries&gt;&lt;users&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29075" PostTypeId="2" ParentId="29074" CreationDate="2019-01-11T13:33:36.073" Score="1" Body="&lt;p&gt;If it's a multi-select field, have you tried doing something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if currentUser.id not in readBy.options %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also might be worth scrapping the multi-select and having it as a &lt;code&gt;text&lt;/code&gt; field and adding it as a fake array, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;['234','53', '90', '103']&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-01-11T13:33:36.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29076" PostTypeId="2" ParentId="29074" CreationDate="2019-01-11T14:37:42.430" Score="2" Body="&lt;p&gt;Thanks to Jason and Ben for the assist. I changed tac a bit and moved the field on to the user (as an Entries field). Now got this working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Display unread notifications for current user #}&#xA;{% set notificationsRead = currentUser.userNotificationsRead.ids() %}&#xA;{% set notifications = craft.entries&#xA;    .id(['not']|merge(notificationsRead))&#xA;    .section('notifications')&#xA;    .all() %}&#xA;&#xA;{% for entry in notifications %}&#xA;    {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2019-01-11T14:37:42.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29077" PostTypeId="2" ParentId="29066" CreationDate="2019-01-11T15:18:28.807" Score="1" Body="&lt;p&gt;Ended up getting this resolved, by downloading DB from Craft staging site and importing, instead of using Sequel Pro. Also make sure your configs in general.php are correct. &lt;/p&gt;&#xA;" OwnerUserId="9229" LastActivityDate="2019-01-11T15:18:28.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29078" PostTypeId="1" AcceptedAnswerId="29084" CreationDate="2019-01-11T16:23:30.683" Score="1" ViewCount="42" Body="&lt;p&gt;I'm trying to re-write my font loading detection using the &lt;a href=&quot;https://github.com/nystudio107/craft-cookies&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Cookies Plugin&lt;/a&gt;. I'm unsure if what I have done is correct...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;!--# if expr=&quot;$HTTP_COOKIE=/fonts\-loaded\=1/&quot; --&amp;gt;&#xA;&amp;lt;html class=&quot;fonts-loaded&quot; lang=&quot;{{ craft.app.language |slice(0,2) }}&quot; prefix=&quot;og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;&amp;lt;!--# else --&amp;gt;&#xA;&amp;lt;html lang=&quot;{{ craft.app.language |slice(0,2) }}&quot; prefix=&quot;og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;&amp;lt;!--# endif --&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if getCookie('fonts-loaded') %}&#xA;    {% do setCookie('fonts-loaded', fontLoad, now | date_modify(&quot;+1 hour&quot;).timestamp) %}&#xA;    &amp;lt;html class=&quot;fonts-loaded&quot; lang=&quot;{{ craft.app.language |slice(0,2) }}&quot; prefix=&quot;og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;{% else %}&#xA;      &amp;lt;html lang=&quot;{{ craft.app.language |slice(0,2) }}&quot; prefix=&quot;og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#&quot;&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2019-01-12T00:32:25.703" LastActivityDate="2019-01-12T00:32:25.703" Title="Craft Cookies Plugin: Font Loading Detection" Tags="&lt;craft3&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29079" PostTypeId="2" ParentId="12055" CreationDate="2019-01-11T16:57:33.613" Score="1" Body="&lt;p&gt;AFAIK this is still an issue with Craft 3. My solution was to create a new text field for the desired section called &lt;code&gt;templateFile&lt;/code&gt;. Then I edited my page template so that whenever &lt;code&gt;templateFile&lt;/code&gt; is non-empty, it will &lt;code&gt;{% include block.templateFile %}&lt;/code&gt; instead of the usual content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows me to bypass Redactor completely while restricting any generated &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags to templates, which requires access to the server files as well as the CMS. That keeps non-admin editors from accidentally including damaging code.&lt;/p&gt;&#xA;" OwnerUserId="8905" LastActivityDate="2019-01-11T16:57:33.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29080" PostTypeId="1" CreationDate="2019-01-11T17:18:29.373" Score="1" ViewCount="308" Body="&lt;pre&gt;&lt;code&gt;{# Set parameters for prev/next elements list #}&#xA;{% set params = craft.entries.section('nieuws').all() %}&#xA;&#xA;{# Get the prev/next elements #}&#xA;{% set nextEntry = entry.getNext(params) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This used to work in Craft 2 in v3 I get an unknown property error. I can retrieve the prev and next links via the paginate tag but how do I retrieve the titles of the prev and next entry??&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="57" LastEditDate="2019-01-11T23:00:29.390" LastActivityDate="2020-08-13T13:36:16.880" Title="In Craft 3 how do I find the title of the previous and next entry when looping through a channel?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29081" PostTypeId="2" ParentId="29080" CreationDate="2019-01-11T17:49:24.140" Score="2" Body="&lt;p&gt;This did the trick - I'm assuming a news channel here with datestamped entries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries&#xA;    .section('nieuws')&#xA;    .id('not ' ~ entry.id)&#xA;    .limit(1) %}&#xA;&#xA;{% set prevEntry = clone(query)&#xA;    .postDate('&amp;lt;= ' ~ entry.postDate.timestamp)&#xA;    .order('postDate desc')&#xA;    .one() %}&#xA;&#xA;{% set nextEntry = clone(query)&#xA;    .postDate('&amp;gt;= ' ~ entry.postDate.timestamp)&#xA;    .order('postDate asc')&#xA;    .one() %}&#xA;&#xA;{% if prevEntry %}&#xA;  &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ prevEntry.url }}&quot;&amp;gt;&amp;lt; {{ prevEntry.title }}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&#xA;{% if nextEntry %}&#xA;  &amp;lt;p&amp;gt;&amp;lt;a href=&quot;{{ nextEntry.url }}&quot;&amp;gt;{{ nextEntry.title }} &amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hat tip to &lt;a href=&quot;https://craftcms.stackexchange.com/questions/27269/how-to-get-the-previous-or-next-two-entries&quot;&gt;How to get the previous or next two entries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2019-01-11T17:49:24.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29082" PostTypeId="1" CreationDate="2019-01-11T19:32:53.660" Score="1" ViewCount="161" Body="&lt;p&gt;&lt;strong&gt;-- UPDATED --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of how the cache busting works is to make sure the query is within the &lt;code&gt;{% cache %}&lt;/code&gt; tag. When looking into how it works I may not really be understanding the ins and outs of using the cache tag properly. Correct me if I'm wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal with this example is to show posts on the index and any category page that excludes &lt;code&gt;cateogry-one&lt;/code&gt; unless a user is viewing the category one page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have an entry that is initially not tagged with &lt;code&gt;category-one&lt;/code&gt; and it will output as expected as well as when I tag that entry with that category. However if I were to again edit that entry and remove category one the cache doesn't bust and won't output the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blog Index Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Get all the categories you want to INCLUDE #}&#xA;{% set categoryIds = craft.categories()&#xA;    .group('categories')&#xA;    .slug('category-one')&#xA;    .ids() %}&#xA;&#xA;{% set excludeIds = craft.entries()&#xA;    .relatedTo({&#xA;        targetElement: categoryIds&#xA;    })&#xA;    .ids() %}&#xA;&#xA;{% cache globally using key craft.app.request.pathInfo ~ '/p' ~ craft.app.request.pageNum %}&#xA;&#xA;    {% set blogEntriesCriteria = craft.entries({&#xA;        section: 'blog',&#xA;        id: ['not']|merge(excludeIds),&#xA;        with: ([&#xA;            ['image', {&#xA;               withTransforms: ['medium']&#xA;            }]&#xA;        ])&#xA;    }) %}&#xA;    {% set isFirstPage = craft.app.request.pageNum() == 1 %}&#xA;    {% set limit = 10 %}&#xA;    {% paginate blogEntriesCriteria.limit(limit) as pageInfo, blogEntries %}&#xA;&#xA;    {% if blogEntries %}&#xA;&#xA;        {# Loop through this page's News entries #}&#xA;        {% for entry in blogEntries %}&#xA;&#xA;            {% include 'includes/components/_news-card' %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;Sorry, no posts found.&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Blog Category Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set catIdCheck = false %}&#xA;&#xA;{# Get all the categories you want to INCLUDE #}&#xA;{% set categoryIds = craft.categories()&#xA;    .group('categories')&#xA;    .slug('category-one')&#xA;    .ids() %}&#xA;&#xA;{% set excludeIds = craft.entries()&#xA;    .relatedTo({&#xA;        targetElement: categoryIds&#xA;    })&#xA;    .ids() %}&#xA;&#xA;{% if category.id == categoryIds[0] %}&#xA;    {% set catIdCheck = true %}&#xA;{% endif %}&#xA;&#xA;{% cache globally using key craft.app.request.pathInfo ~ '/p' ~ craft.app.request.pageNum %}&#xA;&#xA;    {% if catIdCheck == true %}  &#xA;        {# If true show category-one entries &#xA;        on Category One Page #}&#xA;        {% set blogEntriesCriteria = craft.entries({&#xA;            section: 'blog',&#xA;            relatedTo: category,&#xA;            with: ([&#xA;               ['image', {&#xA;                   withTransforms: ['medium']&#xA;               }]&#xA;            ])&#xA;        }) %}&#xA;    {% endif %}&#xA;&#xA;    {% if catIdCheck == false %}&#xA;        {# If false show all posts that &#xA;        do not include category-one on all other&#xA;        category pages #}             &#xA;        {% set blogEntriesCriteria = craft.entries({&#xA;            section: 'news',&#xA;            relatedTo: category,&#xA;            id: ['not']|merge(excludeIds),&#xA;                with: ([&#xA;                    ['image', {&#xA;                        withTransforms: ['medium']&#xA;                    }]&#xA;                 ])&#xA;          }) %}&#xA;    {% endif %}&#xA;&#xA;    {% set isFirstPage = craft.app.request.pageNum() == 1 %}&#xA;    {% set limit = 10 %}&#xA;    {% paginate blogEntriesCriteria.limit(limit) as pageInfo, blogEntries %}&#xA;&#xA;    {% if blogEntries %}&#xA;&#xA;        {# Loop through this page's News entries #}&#xA;        {% for entry in blogEntries %}&#xA;&#xA;            {% include 'includes/components/_news-card' %}&#xA;&#xA;        {% endfor %}&#xA;&#xA;    {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;Sorry, no posts found.&amp;lt;/p&amp;gt;&#xA;&#xA;    {% endif %}&#xA;&#xA;{% endcache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have had success with the busting the cache for the category page when I use the following code, which does not include &lt;code&gt;id: ['not']|merge(excludeIds)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight about the cache tag and if the &lt;em&gt;id not array&lt;/em&gt; would be really helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&#xA;I have updated my Blog Category file to have the if statements outside of the cache tag recommended by @RitterKnight but this did not fix the cache issue related to excluding entry ids.&lt;/p&gt;&#xA;" OwnerUserId="9241" LastEditorUserId="9241" LastEditDate="2019-01-14T16:58:43.120" LastActivityDate="2019-01-14T16:58:43.120" Title="Excluding Array of Entry Ids Not Busting Cache" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;cache&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29083" PostTypeId="2" ParentId="29082" CreationDate="2019-01-11T20:25:33.797" Score="1" Body="&lt;p&gt;The cache tag is somewhat misunderstood and it tends to trip up even the most seasoned Crafters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to explain about the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/cache.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;{% cache %}&lt;/code&gt;&lt;/a&gt; tag is to think of it as a snapshot in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first time the template runs, Craft saves the &lt;strong&gt;output&lt;/strong&gt; to the database. It &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12445/caching-queries-not-working-as-expected&quot;&gt;does not actually save queries&lt;/a&gt;.  On subsequent runs, Craft simply grabs the output from the cache. Again, it doesn't save state or variables, it simply saves the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I see you have &lt;code&gt;{% if %}&lt;/code&gt; tags inside &lt;code&gt;{% cache %}&lt;/code&gt;. Those conditionals will only run once. The &lt;code&gt;{% if %}&lt;/code&gt; tags won't re-execute and the output is going to be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if whatever %} &#xA;      {% cache %} &#xA;         {{ do some output stuff }}&#xA;      {%endcache%}&#xA;{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, check out &lt;a href=&quot;https://straightupcraft.com/events/the-cache-tag&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight UP Craft&lt;/a&gt; as well as Andrew Welch's &lt;a href=&quot;https://nystudio107.com/blog/the-craft-cache-tag-in-depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;great piece&lt;/a&gt; on the subject. &lt;/p&gt;&#xA;" OwnerUserId="1016" LastActivityDate="2019-01-11T20:25:33.797" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29084" PostTypeId="2" ParentId="29078" CreationDate="2019-01-11T21:33:00.337" Score="1" Body="&lt;p&gt;So I'm not sure what you're accomplishing with this line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% do setCookie('fonts-loaded', fontLoad, now | date_modify(&quot;+1 hour&quot;).timestamp) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess trying to give the cookie a longer duration if it was already set? Probably it's best to set the &lt;code&gt;fonts-loaded&lt;/code&gt; cookie via JavaScript once FontFaceObserver tells us that the font as been loaded; there's probably no reason to do it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, we can start using the &lt;code&gt;font-display&lt;/code&gt; property as a progressive enhancement now to want to eliminate FOUT on modern browsers. Older browsers will still work, but they'll get FOUT: &lt;a href=&quot;https://caniuse.com/#search=font-display&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://caniuse.com/#search=font-display&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-01-11T21:33:00.337" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29085" PostTypeId="1" AcceptedAnswerId="29115" CreationDate="2019-01-11T22:17:05.867" Score="1" ViewCount="601" Body="&lt;p&gt;I have been all over the docs page and various other topics across the web on this, and nothing seems to solve it for me. It's probably something obvious, but I am stuck. I recently installed Craft 3 on an Amazon Lightsail LAMP server. My file structure is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/opt/bitnami/apache2/&lt;strong&gt;htdocs&lt;/strong&gt;/ (My root folder)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside that root folder, I have this structure: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;cms&lt;/strong&gt; (contains all of the Craft installation files)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;web&lt;/strong&gt; (contains index.php, cpresources,.htaccess)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I load my site at www.example.com, I arrive at a page that just shows my file structure. Only when I click into the web folder (www.example.com/web), does my initial page of my site load up. I want that page to load up without showing &quot;web&quot; in the URL. I have tried the following things with no success:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Changing the Base URL&lt;/li&gt;&#xA;&lt;li&gt;Changing my httppd.conf file to point to &quot;web&quot; as the root&lt;/li&gt;&#xA;&lt;li&gt;Moving all of the files inside the web folder into my root folder (htdocs)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And a few other random things. I really am having a hard time pinpointing this exact issue in any of the documentation. Looking for any advice anybody can offer. &lt;/p&gt;&#xA;" OwnerUserId="9245" LastActivityDate="2019-01-14T18:12:02.040" Title="How do I get rid of &quot;web&quot; in URL?" Tags="&lt;url&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29086" PostTypeId="1" CreationDate="2019-01-11T22:22:56.230" Score="4" ViewCount="757" Body="&lt;p&gt;Similar to the other post &lt;a href=&quot;https://craftcms.stackexchange.com/questions/20598/feed-me-how-to-format-json-for-a-table-field&quot;&gt;Feed Me: How to format JSON for a table field&lt;/a&gt;. I'm looking for a solution on how to format the CSV field so I can import it as a table field. Basically I have a list of products and each product has multiple serial numbers which I'd like to have each as a row in the table. So for the serial number field I've tried things like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;[12345, 54211, 55511]&quot;&#xA;&quot;[{12345}, {54211}, {55511}]&quot;&#xA;&quot;[{&quot;12345&quot;}, {&quot;54211&quot;}, {&quot;55511&quot;}]&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on the best way to approach this field?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-01-21T17:41:02.997" Title="Feed Me: How to format CSV data for a table field" Tags="&lt;plugin-feedme&gt;&lt;table-field&gt;&lt;csv&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29087" PostTypeId="2" ParentId="29085" CreationDate="2019-01-11T22:30:16.503" Score="1" Body="&lt;p&gt;Sounds like you need to move everything up one level...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/opt/bitnami/apache2/cms/ (if you can)&#xA;/opt/bitnami/apache2/htdocs/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;web&lt;/code&gt; folder can be renamed to &lt;code&gt;htdocs&lt;/code&gt; (or anything, really) and it will work normally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't get above &lt;code&gt;htdocs&lt;/code&gt;, you'll want to do it like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/opt/bitnami/apache2/htdocs/cms/&#xA;/opt/bitnami/apache2/htdocs/index.php&#xA;/opt/bitnami/apache2/htdocs/cpresources&#xA;/opt/bitnami/apache2/htdocs/.htaccess&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-01-11T22:30:16.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29088" PostTypeId="2" ParentId="29085" CreationDate="2019-01-11T22:46:53.220" Score="1" Body="&lt;p&gt;It should be possible to point the server at the &lt;code&gt;/web&lt;/code&gt; directory, then specify the path to Craft's files in &lt;code&gt;index.php&lt;/code&gt; by setting the &lt;code&gt;CRAFT_BASE_PATH&lt;/code&gt; value. You probably already read it, but just in case not: &lt;a href=&quot;https://craftcms.com/guides/moving-craft-files&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/moving-craft-files&lt;/a&gt;. If that's not the problem, there might be file permissions issues.&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2019-01-11T22:46:53.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29090" PostTypeId="1" CreationDate="2019-01-11T23:56:46.993" Score="2" ViewCount="197" Body="&lt;p&gt;Trying to get type of a field (dropdown, checkbox, etc) to render those fields in app, there is all sorts of info available in &lt;code&gt;$variant-&amp;gt;fieldLayout-&amp;gt;fields&lt;/code&gt; like handles, values, ids except type of a field.&#xA;Based on docs there is no property like &lt;code&gt;type&lt;/code&gt; in &lt;code&gt;craft\fields&lt;/code&gt; class.&#xA;Maybe someone knows the way how to get this type of a field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my element-api config for getting a product:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/products/&amp;lt;slug:{slug}&amp;gt;.json' =&amp;gt; function($slug) {&#xA;  return [&#xA;    'elementType' =&amp;gt; Product::class,&#xA;    'criteria' =&amp;gt; ['slug' =&amp;gt; $slug],&#xA;    'one' =&amp;gt; true,&#xA;    'transformer' =&amp;gt; function(Product $product) {&#xA;&#xA;      $variants = [];&#xA;      foreach ($product-&amp;gt;variants as $variant) {&#xA;        $fields = $variant-&amp;gt;fieldLayout-&amp;gt;fields;&#xA;        $fieldsSelected = $variant-&amp;gt;fieldValues;&#xA;        $variant = (array)$variant;&#xA;        $variant['fields'] = $fields;&#xA;        $variant['fieldsSelected'] = $fieldsSelected;&#xA;        $variant = (object)$variant;&#xA;        $variants[] = $variant;&#xA;      }&#xA;&#xA;      return [&#xA;        'title' =&amp;gt; $product-&amp;gt;title,&#xA;        'url' =&amp;gt; $product-&amp;gt;url,&#xA;        'defaultVariant' =&amp;gt; $product-&amp;gt;defaultVariant,&#xA;        'variants' =&amp;gt; $variants&#xA;      ];&#xA;    }&#xA;  ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8563" LastActivityDate="2019-01-11T23:56:46.993" Title="Get field type of product or variant with element api" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29091" PostTypeId="1" AcceptedAnswerId="29093" CreationDate="2019-01-12T07:50:39.377" Score="1" ViewCount="241" Body="&lt;p&gt;I've set up the routing for a specific URL in my plugin to trigger the actionIndex controller method. I after logging a message to the Craft logs, I want to return the rendered twig file as the view, which is supposed to look just like an empty Control Panel page. Pretty simple in theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything in the twig file seems to render just fine (text &amp;amp; images) except for the CSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Controller: Controller.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Controller extends \craft\web\Controller&#xA;{&#xA;    public function actionIndex(){&#xA;&#xA;        Craft::info(&quot;hello!&quot;, __METHOD__);&#xA;&#xA;        return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('plugin/done');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template: done.twig&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;_layouts/cp&quot; %}&#xA;{% set title = &quot;Manual Sync&quot;|t('plugin') %}&#xA;&#xA;{% block content %}&#xA;    &amp;lt;p&amp;gt;Manual Sync Done.&amp;lt;/p&amp;gt;&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've attached a screenshot of the elements that are rendered on the page.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/t4lJt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t4lJt.png&quot; alt=&quot;Screenshot of rendered elements&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that is enough for someone to help bounce some ideas around with me. Any advice and suggestions would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="9248" LastActivityDate="2019-01-12T16:51:49.193" Title="renderTemplate() renders the twig file without any CSS" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;controller&gt;&lt;css&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29092" PostTypeId="2" ParentId="29091" CreationDate="2019-01-12T12:57:31.457" Score="2" Body="&lt;p&gt;To me it looks like something with your sites URL is wrong or your server's configuration and therefore the CSS is not loaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you take a look into your HTML-Output regarding the Links to the CSS-files? Are they linked correctly? Is both http/s? &lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2019-01-12T12:57:31.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29093" PostTypeId="2" ParentId="29091" CreationDate="2019-01-12T16:51:49.193" Score="5" Body="&lt;p&gt;I sincerely appreciate the responses!&#xA;I've since resolved this issue, below is the changed code. My controller was extending the Craft web controller (\craft\web\Controller) which has its own renderTemplate() method that I switched to, which fetches the Control Panel assets I wanted for styling the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template twig file remains identical as is above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(Modified) Controller: Controller.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Controller extends \craft\web\Controller&#xA;{&#xA;    public function actionIndex(){&#xA;&#xA;        Craft::info(&quot;hello!&quot;, __METHOD__);&#xA;&#xA;        return $this-&amp;gt;renderTemplate('plugin/done');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This did the trick for what I wanted. Thanks again!&lt;/p&gt;&#xA;" OwnerUserId="9248" LastActivityDate="2019-01-12T16:51:49.193" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29094" PostTypeId="1" CreationDate="2019-01-12T17:51:33.410" Score="4" ViewCount="2095" Body="&lt;p&gt;How does one set a flash message in the templates? I can't find any documentation about this, only for plugins or getting the message. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My use-case is, I am checking if a user is allowed to access a certain page and if they cannot I want to set a flash message, then redirect them to another page. I prefer this than to keep them on the same page and is if else logic to show the message or the rest of the page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-01-15T00:29:03.663" Title="How do you set a flash message in the template in Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29096" PostTypeId="1" CreationDate="2019-01-13T13:28:32.307" Score="1" ViewCount="80" Body="&lt;p&gt;I have users that are assigned to an organisation. An organisation can have many users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like users within the same organisation to be able edit entries (in this case projects) created by a &quot;parent&quot; user in that organisation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could allow users to edit other users entries, and code into the template a check if they are not in the project's organisation then dont allow them to edit it, but this is not fool proof because someone could change the hidden project ID fields in the HTML and therefore could save an entry for another organisation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas how best to accomplish the above? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-01-13T14:54:07.020" Title="How would one allow users to edit only some other users entries but not all? Linked via a related field" Tags="&lt;craft3&gt;&lt;users&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29097" PostTypeId="1" CreationDate="2019-01-13T14:09:58.047" Score="0" ViewCount="639" Body="&lt;p&gt;I've got a local installation of Craft 3.0.37 and Craft Commerce 2.0.0-beta.15 running on MAMP. When completing an order, an empty response is given by the browser. The same thing happens when trying to look at that error from the admin area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look into the MYSQL logs, I see the following error for both situations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2019-01-13T13:32:43.718637Z 300 [Note] Aborted connection 300 to db: 'DBNAME' user: 'root' host: 'localhost' (Got an error reading communication packets)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried upping the limits of the MYSQL setup, but to no avail. &lt;/p&gt;&#xA;" OwnerUserId="9251" LastActivityDate="2021-05-14T11:05:05.603" Title="ERR_EMPTY_RESPONSE when accessing order data (MAMP)" Tags="&lt;craft3&gt;&lt;mysql&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29098" PostTypeId="2" ParentId="29096" CreationDate="2019-01-13T14:39:50.320" Score="1" Body="&lt;p&gt;I managed to implement it, don't know if it's the best way. Ideally I would like to disallow users to edit other entries, then in the EVENT_BEFORE_SAVE grant permissions, but I think the permissions are being checked before EVENT_BEFORE_SAVE so I could not find a way to tap into it before then. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I have granted the user permissions to edit other users entries, then the following code will check if the user is in the same organisation, and if they are not set the event isValid to false, which stops it saving. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;Entry::class,&#xA;Entry::EVENT_BEFORE_SAVE,&#xA;function(Event $event)&#xA;{&#xA;    // Only do it on front end&#xA;    if (Craft::$app-&amp;gt;request-&amp;gt;isSiteRequest)&#xA;    {&#xA;        // Get Entry Data&#xA;        $entry = $event-&amp;gt;sender;&#xA;&#xA;        // Only call it if its sectionId 1 = Projects or 22 = KPIs&#xA;        if( $entry-&amp;gt;sectionId == 1 || $entry-&amp;gt;sectionId == 22)&#xA;        {&#xA;            // Entry Organisation ID&#xA;            $entry_organisation_id = $entry-&amp;gt;client-&amp;gt;id[0];&#xA;&#xA;            // User Organisation ID&#xA;            $user = Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity();&#xA;            $user_organisation_id = $user-&amp;gt;getFieldValue('organisation')-&amp;gt;first()-&amp;gt;id ;&#xA;&#xA;            if($user_organisation_id != $entry_organisation_id)&#xA;            {&#xA;                // Disallow!&#xA;                $event-&amp;gt;isValid = false;&#xA;            }&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code goes into a plugin init() function I have for my site. &lt;/p&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="4993" LastEditDate="2019-01-13T14:54:07.020" LastActivityDate="2019-01-13T14:54:07.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29099" PostTypeId="1" AcceptedAnswerId="29102" CreationDate="2019-01-13T15:04:55.133" Score="1" ViewCount="114" Body="&lt;p&gt;Craft 3.0.37&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code which I expect to output all entries (live and pending) but it doesn't&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  {% for entry in craft.entries.section('podcast').status('live','pending').relatedTo(season).orderBy('postDate', 'asc').all() %}&#xA;    &amp;lt;li &amp;gt;&amp;lt;span&amp;gt;{{ entry.episodeNumber }}&amp;lt;/span&amp;gt; &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt; {{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change the status to only pending it outputs pending entries, if live, outputs live. However it will not output both pending and live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-01-14T08:26:05.530" Title="live and pending entries together not working" Tags="&lt;templating&gt;&lt;entries&gt;&lt;status&gt;&lt;pending&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29100" PostTypeId="1" CreationDate="2019-01-14T02:53:06.503" Score="1" ViewCount="112" Body="&lt;p&gt;I developed a web site some years ago in PHP and mySQL.  I'm wondering if it would be worthwhile to convert it to a CMS like Craft.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The site -- &lt;a href=&quot;http://blacksmiths.mygenwebs.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://blacksmiths.mygenwebs.com&lt;/a&gt; -- displays information on historical figures -- &quot;tradesmen&quot;.  These are arranged by region, so &quot;Devon&quot;, for example, contains all people who lived in that region and performed that service.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The lady the site belongs to collects the data and puts it into a spreadsheet and uploads the comma-delimited .csv files to the site.  (no, she won't consider abandoning her spreadsheets)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The software reads the .csv files and creates a page for each .csv file&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It also uses the CSV file to create the home page (at the link above)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to change the operation slightly&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;have the uploaded .csv data placed into a database table and the pages be dynamically generated from there (there are only nine fields in each row).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;have a form where she can input new data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;be able to export the data to the spreadsheet format she likes&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is also an administrative back-end, all in PHP-mySQL, that stores data on contributors, which tradsman they contributed and their email address, if it is to be displayed on one of the pages (right now, the email uses javascript obfuscation, but each should really use a contact form to protect the email addresses).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it would be useful to create links between the tradesman table record and the contributor table record.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can do all this in PHP, but I'd like to see if Craft could make this simpler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for suggestions as to whether going to a CMS like Craft would be a good idea and perhaps some suggestions on how to go about it.&lt;/p&gt;&#xA;" OwnerUserId="9253" LastActivityDate="2019-01-16T15:31:54.717" Title="whether to use Craft or not?" Tags="&lt;craft3&gt;&lt;import&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29101" PostTypeId="1" AcceptedAnswerId="29106" CreationDate="2019-01-14T07:25:23.220" Score="0" ViewCount="683" Body="&lt;p&gt;I keep getting this error whenever I try to install a plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6gk2p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6gk2p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure how to troubleshoot / resolve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I need the Contact Form and CKEditor plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setup: I'm running AMPPS with PHP 7.1, Apache and MySQL.&lt;/p&gt;&#xA;" OwnerUserId="9254" LastActivityDate="2019-01-14T13:40:01.917" Title="Error when Attempting to Install Plugins" Tags="&lt;plugins&gt;&lt;error&gt;&lt;installation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29102" PostTypeId="2" ParentId="29099" CreationDate="2019-01-14T07:51:06.473" Score="1" Body="&lt;p&gt;Use &lt;code&gt;status(['live','pending'])&lt;/code&gt; to get all entries with both states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later, to get the linked entry you need to setup a custom route like `podcasts/{slug}. In the template you query the entry like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set slug = craft.request.lastSegment() %}&#xA;{% set entry = craft.entries.slug(slug).status(['live', 'pending']).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4538" LastEditorUserId="4538" LastEditDate="2019-01-14T08:26:05.530" LastActivityDate="2019-01-14T08:26:05.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29103" PostTypeId="1" AcceptedAnswerId="29108" CreationDate="2019-01-14T10:15:10.547" Score="0" ViewCount="167" Body="&lt;p&gt;I'm using the amazing SEOmatic plugin in a multi-site config in craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a total of 18 sites and they share a lot of identical data. So I was wondering if it was possible to export the configuration I made for the main site and import it to the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to avoid configuring 18x the same thing? It will save me a bunch of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="5897" LastActivityDate="2019-01-14T14:33:40.620" Title="How can I handle the identical SEOmatic config for multi-sites?" Tags="&lt;craft3&gt;&lt;multi-site&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29104" PostTypeId="2" ParentId="29100" CreationDate="2019-01-14T10:42:03.273" Score="2" Body="&lt;p&gt;Craft &lt;em&gt;is&lt;/em&gt; using PHP and MySQL. What it gives you is a framework where a lot of the difficult stuff is already covered. Things like content modelling, user administration, security, etc is already done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition there is a good plugin environment that can help fill in gaps to required functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you can also extend it as you wish to add even more custom functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your particular use case I'd say Craft is a very good fit. You wouldn't need to be concerned with building an administration interface and the data you wish to store can be easily modelled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your client wants to keep the spreadsheets then a plugin like FeedMe would be brilliant. You can set up an import in FeedMe and have it pull in the data from the spreadsheet using a cronjob or when your client wants to run an update. She'd just need to click a button. The data from the spreadsheet would be imported and used to create new, or update existing, content entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might find that given Craft's really nice control panel she would also find that it's easier to enter data directly than follow the spreadsheet-&gt;import process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yes. Craft would be a very good fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edited in light of your comment/question&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't need to create your own database tables or write your own queries. That is what Craft is doing for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft is extremely flexible in that it will allow you to model your content pretty much however you wish. This data model is then stored within Craft's own database schema and content is written/read (by Craft) using the Yii/Yii2 PHP framework. You would then use the templating language (Twig) to create a front-end for the website with no need to use PHP at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say you had a Section of entries for Blacksmiths. Each Blacksmith is an entry, with whatever fields you wish stored within them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume you want to list out all of the Blacksmith's stored in the Blacksmiths section to create an index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might do that within your template with Twig like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set blacksmiths = craft.entries.section('blacksmiths').orderBy('title').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would give you an iterable object named 'blacksmiths' that you could loop over to output the content you want (taking a rough version of your actual listing page).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;&#xA;    {% for blacksmith in blacksmiths %}&#xA;     &amp;lt;tr&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ blacksmith.surname }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ blacksmith.firstname }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ blacksmith.trade }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ blacksmith.year }}&amp;lt;/td&amp;gt;&#xA;        &amp;lt;td&amp;gt;{{ blacksmith.notes }}&amp;lt;/td&amp;gt;&#xA;      &amp;lt;/tr&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/table&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wanted to alter precisely which blacksmith entries to retrieve you would include some additional criteria in your initial query. You don't need to worry about joins because the data has been stored within Craft's schema and Craft handles any criteria or relations that are required.&lt;/p&gt;&#xA;" OwnerUserId="210" LastEditorUserId="210" LastEditDate="2019-01-16T12:59:58.780" LastActivityDate="2019-01-16T12:59:58.780" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29105" PostTypeId="2" ParentId="9400" CreationDate="2019-01-14T11:40:53.550" Score="1" Body="&lt;p&gt;I've moved from Digital Ocean onto &lt;a href=&quot;https://www.fortrabbit.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fortrabbit&lt;/a&gt;. They're an official CraftCMS hosting partner and they've been great. Amazing support, great speeds. Can't ask for anything more.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-01-14T11:40:53.550" CommentCount="0" CommunityOwnedDate="2019-01-14T11:40:53.550" ContentLicense="CC BY-SA 4.0" />
  <row Id="29106" PostTypeId="2" ParentId="29101" CreationDate="2019-01-14T13:40:01.917" Score="1" Body="&lt;p&gt;I don't really know what is causing this error but I've got the same problem for plugins install and update. To avoid this annoying error page, I prefer to install/update plugins via composer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer update&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composer require {plugin name}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5897" LastActivityDate="2019-01-14T13:40:01.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29108" PostTypeId="2" ParentId="29103" CreationDate="2019-01-14T14:33:40.620" Score="0" Body="&lt;p&gt;So check out this issue for ways I'm thinking about tackling this problem; any input from you would be welcome: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic/issues/227&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic/issues/227&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-01-14T14:33:40.620" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29109" PostTypeId="1" AcceptedAnswerId="29110" CreationDate="2019-01-14T15:10:50.247" Score="0" ViewCount="128" Body="&lt;p&gt;I'm using a script to animate four sets of numbers on a page.  I would like the numbers to be editable from within the admin (a SuperTable field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ul class=&quot;counters&quot;&amp;gt;&#xA;   {% for stats in entry.statsPanels %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;span id=&quot;tal-{{ loop.index0 }}&quot; class=&quot;tal&quot;&amp;gt;0&amp;lt;/span&amp;gt;{{ stats.statDescription }}&amp;lt;/li&amp;gt;&#xA;   {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is working fine for looping through and pulling back the 'Stat Descriptions'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0mrFm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0mrFm.png&quot; alt=&quot;SuperTable field in Admin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somehow I also need to loop through the 'Stats Number' column and embed this into the JavaScript that animates the numbers...  at the moment they're hard coded '400, 60, 1800, 40'.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     $(document).ready(function(){&#xA;      function numberWithCommas(n) {&#xA;       var parts=n.toString().split(&quot;.&quot;);&#xA;       return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, &quot;,&quot;);&#xA;      }&#xA;&#xA;      var endingCounterVar = [400, 60, 1800, 40];&#xA;&#xA;      for (let i = 0; i &amp;lt;= 3; i++) {&#xA;&#xA;      let counter = { var: 0 };&#xA;      let tal = document.getElementById(&quot;tal-&quot;+i);&#xA;&#xA;      TweenMax.to(counter, 5, {&#xA;       var: endingCounterVar[i],&#xA;       onUpdate: function () {&#xA;        let nwc = numberWithCommas(counter.var);&#xA;        tal.innerHTML = nwc;&#xA;       },&#xA;       ease:Circ.easeOut&#xA;     });&#xA;    }&#xA;   });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help is very much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2019-01-14T15:40:40.787" Title="For loop through custom field in JavaScript" Tags="&lt;forloop&gt;&lt;javascript&gt;&lt;custom-field&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29110" PostTypeId="2" ParentId="29109" CreationDate="2019-01-14T15:40:40.787" Score="0" Body="&lt;p&gt;You could output the numbers in a data attribute on a wrapping HTML element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set numbers = '' %} &#xA;&#xA;{% for stats in entry.statsPanels %}&#xA;    {% set numbers = numbers ~ stats.statsNumber %}&#xA;    {% if not loop.last %}&#xA;        {% set numbers = numbers ~ ',' %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&quot;myComponent&quot; data-numbers=&quot;{{ numbers }}&quot;&amp;gt;&#xA;...&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can read them in your JavaScript file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var endCounterVar = $('.myComponent').data('numbers');&#xA;&#xA;if (endCounterVar.length) {&#xA;    endCounterVar = endCounterVar.split(',');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This might not be the cleanest/shortest way to achieve this in Twig, mind you!&lt;/p&gt;&#xA;" OwnerUserId="8173" LastActivityDate="2019-01-14T15:40:40.787" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="29111" PostTypeId="1" AcceptedAnswerId="29117" CreationDate="2019-01-14T15:46:09.140" Score="1" ViewCount="329" Body="&lt;p&gt;I need to get a list of variants from multiple products, but in a way that allows us to show the results in Craft's handy &lt;code&gt;{% paginate %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far we have this less-than-appealing markup:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstProduct  = craft.products.relatedTo(category).one() %}&#xA;{% set results = craft.variants({product: firstProduct}) %}&#xA;&#xA;{% set products  = craft.products.relatedTo(category).all() %}&#xA;&#xA;{% for product in products %}&#xA;    {% set results = results|merge(craft.variants({product: product})) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, because we're using merge it's turning our &lt;code&gt;ElementCriteriaModel&lt;/code&gt; into an &lt;code&gt;Array&lt;/code&gt;. Is there a way to use the &lt;code&gt;{{ craft.variants({product: product}) }}&lt;/code&gt; tag and pass it multiple products?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Craft3 and Commerce2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Final markup that ended up working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# All products within this category #}&#xA;{% set products = craft.products.relatedTo(category).all() %}&#xA;&#xA;{# Empty variant id array #}&#xA;{% set variantIds = [] %}&#xA;&#xA;{# Populating variant id array #}&#xA;{% for product in products %}&#xA;    {% set variantIds = variantIds|merge(craft.variants({product: product}).ids()) %}&#xA;{% endfor %}&#xA;&#xA;{# Get all variants from the variant id array #}&#xA;{% set results = craft.variants.id(variantIds).orderBy('title asc') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="5845" LastEditDate="2019-01-15T15:47:36.327" LastActivityDate="2019-01-16T16:59:55.117" Title="Get all variants from multiple products" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;elementcriteriamodel&gt;&lt;array&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29112" PostTypeId="1" AcceptedAnswerId="29122" CreationDate="2019-01-14T16:52:36.143" Score="0" ViewCount="276" Body="&lt;p&gt;I'm trying to build a filter for a blog section in Craft 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to Craft and my client now wants a dropdown filter where they can filter out authors. Thus, I want to write a query that fetches a unique list of authors from my blog channel structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure is: &#xA;section: &lt;code&gt;blogEntries&lt;/code&gt; (Channel) with an entry type &lt;code&gt;blogEntry&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each &lt;code&gt;blogEntry&lt;/code&gt; has a &lt;code&gt;content&lt;/code&gt; (matrix) and and &lt;code&gt;writer&lt;/code&gt; entry field which is connected to one or more &lt;code&gt;employee&lt;/code&gt; entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So; &lt;code&gt;blogEntries &amp;gt; blogEntry &amp;gt; writer(s) &amp;gt; employee&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want is something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('blogEntries').column('writer').distinct().all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Way too slow #}&#xA;{% for item in craft.entries.section('blogEntries').all() %}&#xA;    {% if item.writer|length %}&#xA;        {% set person = item.writer.one() %}&#xA;        {% set name =  person.firstname ~ (person.surname|length ? ' ' ~ person.surname : '') %}&#xA;        {% if name not in writers %}&#xA;            {% set writers = writers|merge([name]) %}&#xA;        {% endif %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Terrible solution, terrible performance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I improve this code? Any ideas would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8442" LastActivityDate="2019-01-14T23:55:34.100" Title="Template query: Advanced section query to get unique items from custom entry type field" Tags="&lt;craft3&gt;&lt;querystring&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29113" PostTypeId="1" AcceptedAnswerId="29157" CreationDate="2019-01-14T16:58:13.200" Score="1" ViewCount="69" Body="&lt;p&gt;Is it possible to use the {{ siteUrl }} Variable in a html Field in freeform? I tried it and it threw an error that the variable was not valid. Is it possible to use twig in a html field?&lt;/p&gt;&#xA;" OwnerUserId="7812" LastEditorUserId="7812" LastEditDate="2019-01-14T21:10:51.990" LastActivityDate="2019-01-17T13:38:32.117" Title="Can I use Twig in a FreeForm html field?" Tags="&lt;craft3&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29114" PostTypeId="1" AcceptedAnswerId="37637" CreationDate="2019-01-14T18:09:42.857" Score="3" ViewCount="394" Body="&lt;p&gt;I would like to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('mySection').field1('&amp;gt; field2').all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it should return all the entries in &lt;code&gt;mySection&lt;/code&gt; whose &lt;code&gt;field1&lt;/code&gt; value is greater than their &lt;code&gt;field2&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2021-04-27T17:13:45.340" Title="Element query: find entries where a field's value is greater than, or less than another field's value?" Tags="&lt;entries&gt;&lt;craft3&gt;&lt;field&gt;&lt;elementquery&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29115" PostTypeId="2" ParentId="29085" CreationDate="2019-01-14T18:12:02.040" Score="0" Body="&lt;p&gt;Thanks for your help. As it turns out, I was able to move all of the &quot;web&quot; files into my htdocs root directory, however the update I made to my index.php to reference the new base path was not working as expected. I was referencing another stackexchange post that said to do it this way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__).'/cms');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;^ this format was throwing an error each time. But it works when I switched to using this format instead: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', __DIR__.'/cms');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likely just an obvious thing that went over my head, but happy to say it worked!&lt;/p&gt;&#xA;" OwnerUserId="9245" LastActivityDate="2019-01-14T18:12:02.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29116" PostTypeId="2" ParentId="28251" CreationDate="2019-01-14T20:04:26.257" Score="0" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://solspace.com/craft/freeform/docs/freeform.form/#param-overridevalues&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;overrideValues&lt;/code&gt; parameter&lt;/a&gt; to set field values automatically and dynamically. E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;composerForm&quot;, {&#xA;    labelClass: &quot;form-label&quot;,&#xA;    inputClass: &quot;form-control&quot;,&#xA;    overrideValues: {&#xA;        myFieldHandle: entry.title,&#xA;        myOtherField: craft.app.request.getSegment(3),&#xA;    }&#xA;}).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-14T20:04:26.257" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29117" PostTypeId="2" ParentId="29111" CreationDate="2019-01-14T20:24:15.500" Score="2" Body="&lt;p&gt;The &quot;variant&quot; method can receive multiple ids using the following: &lt;code&gt;craft.variants().id([1,2,3])&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following that, you can easily populate an array while looping through your (specific) products, and then use that array to fetch the variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/commerce/v2/dev/element-queries/variant-queries.html#id&quot; rel=&quot;nofollow noreferrer&quot;&gt;Official documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-01-16T16:59:55.117" LastActivityDate="2019-01-16T16:59:55.117" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29118" PostTypeId="1" CreationDate="2019-01-14T20:49:47.993" Score="2" ViewCount="458" Body="&lt;p&gt;Is it possible to access &lt;code&gt;customAttributes&lt;/code&gt; on a FreeForm field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently attempting to do this via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for row in form %}&#xA;  {% for field in row %}&#xA;    {{ dump(field.customAttributes) }}&#xA;  {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where form is a FreeForm object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm getting an error that indicates that attribute does not exist or I can't access it. &lt;/p&gt;&#xA;" OwnerUserId="9257" LastActivityDate="2019-02-13T12:07:38.197" Title="FreeForm: Accessing a fields customAttributes" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29119" PostTypeId="1" AcceptedAnswerId="29134" CreationDate="2019-01-14T21:42:25.580" Score="1" ViewCount="300" Body="&lt;p&gt;Using the Element API is there a way to get entries by &lt;code&gt;dateUpdated&lt;/code&gt; OR &lt;code&gt;dateCreated&lt;/code&gt; within the last whatever time, say day?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or a way to get the entry IDs for both of those criteria then do a query based on just the IDs from both results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get any entry that was created or updated within the last day using the API but can't quite get it.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2019-01-15T20:14:44.250" Title="Use conditional for Element API results?" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29120" PostTypeId="2" ParentId="29114" CreationDate="2019-01-14T22:51:16.900" Score="0" Body="&lt;p&gt;You could just do (Assuming your field1 and field2 are set to numbers as Field type):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries.section('mySection').all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as your query then within your loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {% if entry.field1 &amp;gt; entry.field2 %}&#xA;        // Show the entry&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It depends on what you need but this would work.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-14T22:51:16.900" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29122" PostTypeId="2" ParentId="29112" CreationDate="2019-01-14T23:50:31.930" Score="0" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Return all ids for your posts' section&#xA;{% set postIds = craft.entries.section('blogEntries').ids() %}&#xA;&#xA;// Look for and return employees which have a relation with any of the posts returned in 'postIds'&#xA;{% set writers = craft.entries.section('employee').relatedTo({ sourceElement: entryIds }).all() %}&#xA;&#xA;// Loop and display&#xA;{% for writer in writers %}&#xA;    {{ writer.title }} &amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will only return a list of writers who have written a post, not a list of all writers but I guess that's what you want..?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-14T23:55:34.100" LastActivityDate="2019-01-14T23:55:34.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29123" PostTypeId="2" ParentId="29094" CreationDate="2019-01-15T00:16:38.917" Score="11" Body="&lt;p&gt;You can set &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/runtime-sessions-cookies#flash-data&quot; rel=&quot;noreferrer&quot;&gt;flash messages&lt;/a&gt; using &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-session#setFlash()-detail&quot; rel=&quot;noreferrer&quot;&gt;yii\web\Session::setFlash()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;session&lt;/code&gt; component is available to templates via &lt;code&gt;craft.app.session&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.session.setFlash('error', 'You’re not allowed to go there.') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For convenience, Craft’s &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-behaviors-sessionbehavior.html&quot; rel=&quot;noreferrer&quot;&gt;SessionBehavior&lt;/a&gt; class adds shortcut &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-behaviors-sessionbehavior.html#method-seterror&quot; rel=&quot;noreferrer&quot;&gt;setError()&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-behaviors-sessionbehavior.html#method-setnotice&quot; rel=&quot;noreferrer&quot;&gt;setNotice()&lt;/a&gt; methods to the &lt;code&gt;session&lt;/code&gt; component as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.session.setError('You’re not allowed to go there.') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can place that right before your &lt;code&gt;{% redirect %}&lt;/code&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-01-15T00:16:38.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29124" PostTypeId="2" ParentId="29094" CreationDate="2019-01-15T00:23:34.023" Score="7" Body="&lt;p&gt;&lt;strong&gt;Edit: Brandon replied as I was writing this. Feel free to remove :)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do that using this in your conditional, just above your redirect tag&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.app.session.setFlash('error', 'no no no') %}&#xA;{% redirect &quot;tosomewhere&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in the template you are redirecting to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.app.session.getFlash('error', null, true) %}&#xA;{% if message %}&#xA;    {{ message }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-15T00:29:03.663" LastActivityDate="2019-01-15T00:29:03.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29125" PostTypeId="2" ParentId="29118" CreationDate="2019-01-15T01:26:38.817" Score="1" Body="&lt;p&gt;You'll need to access the properties individually like this, assuming you've set them on the Form object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ form.customAttributes.rowClass }}&#xA;{{ form.customAttributes.columnClass }}&#xA;{{ form.customAttributes.inputClass }}&#xA;Etc...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://solspace.com/craft/freeform/docs/form/#prop-custom-attributes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://solspace.com/craft/freeform/docs/form/#prop-custom-attributes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-15T01:26:38.817" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29126" PostTypeId="2" ParentId="455" CreationDate="2019-01-15T04:42:16.460" Score="1" Body="&lt;pre&gt;&lt;code&gt;$email-&amp;gt;cc = array(&#xA;    array('email' =&amp;gt; 'cc1@example.com', 'name' =&amp;gt; 'Person One'),&#xA;    // ...&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want emails recipients to see other recipients listed in the email, use 'cc'; otherwise, use the loop as the other answer suggested, or 'bcc'.&lt;/p&gt;&#xA;" OwnerUserId="7136" LastEditorUserId="7136" LastEditDate="2019-01-15T05:05:06.587" LastActivityDate="2019-01-15T05:05:06.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29128" PostTypeId="2" ParentId="11913" CreationDate="2019-01-15T15:53:52.553" Score="1" Body="&lt;p&gt;In case you need this for CraftCMS version 3, as I did today, the code slightly changed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;redirect(Craft::$app-&amp;gt;getRequest()-&amp;gt;referrer);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine with version 3.&lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2019-01-15T15:53:52.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29129" PostTypeId="1" CreationDate="2019-01-15T16:10:31.720" Score="1" ViewCount="576" Body="&lt;p&gt;In Craft 3, Commerce 2 is there a way to set a different tax category or rate on a cart/site when using commerce in a multi site environment? Site A (b2c website) has tax rate 1 (21% with tax included in price) and site B has tax rate 2 and 3 (21% with tax excluded in price and a 0% tax rate). Both sites use the same products/inventory but are targeted for different audiences (b2c and b2b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m looking for a solution that works simular like posting  to the update-cart action when adding products to the cart. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, even better would be to be able to set defaults for the cart when setting {% set cart = craft.commerce.carts.cart %}.&lt;/p&gt;&#xA;" OwnerUserId="9261" LastActivityDate="2019-02-14T17:03:20.687" Title="Craft Commerce multisite, different tax rates" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;multi-site&gt;&lt;tax&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29130" PostTypeId="1" CreationDate="2019-01-15T16:14:10.377" Score="4" ViewCount="280" Body="&lt;p&gt;Is there a way to control the weighting of certain fields in Craft when using search in the front-end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Products Channel which I am trying to search against and I want to be able to boost certain entries, ideally via specific keywords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to do this via a tag field but this doesn't seem to have a noticeable impact on the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the following query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set tmpEntries = craft.entries({&#xA;section: 'products',&#xA;search: q,&#xA;orderBy: 'score',&#xA;with: ['product_preview','productCategory','searchWeighting'],&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I carry this out against the term &lt;code&gt;LAS8001&lt;/code&gt; I get the following results and scores:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;LAS8001M (83.25)&lt;/li&gt;&#xA;&lt;li&gt;LAS8001 si (46.4841269841)&lt;/li&gt;&#xA;&lt;li&gt;LAS9010 (0.488017429194)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to work out why the weighting is so different for the first two results. Both entries have associated assets with the search term in file names. In trying to boost the second result I have added a &lt;code&gt;tag&lt;/code&gt; field and included the search term in that field but with only a negligible boost in search score (from 46.4841269841 to 53.1507936508).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any documentation on how the search algorithms are calculated or ways in which we can control the weighting of specific fields over others?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2019-01-15T16:14:10.377" Title="Search weighting" Tags="&lt;craft3&gt;&lt;search&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29131" PostTypeId="2" ParentId="29129" CreationDate="2019-01-15T16:28:12.527" Score="1" Body="&lt;p&gt;As of Commerce 2.0, there is no support for multi-site apart from a product’s custom field information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cart exists in the session, once per Craft installation, and there are not separate carts per site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multi-site is something we plan to add in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, a cart stores the current &lt;code&gt;orderLanguage&lt;/code&gt; based on the current language of the site the order is being made in. A custom adjuster could be written to add custom tax costs based on this information: &lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/docs/adjusters.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/blob/develop/docs/adjusters.md&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-15T16:28:12.527" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29132" PostTypeId="1" AcceptedAnswerId="29133" CreationDate="2019-01-15T16:39:09.063" Score="1" ViewCount="38" Body="&lt;p&gt;in the CP settings, timezone is set to UTC +1 Europe/Zurich&#xA;when I try this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currDay = now|date() %}&#xA;    {{ currDay|date('l d F Y') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it outputs &quot;Mercredi, 16 janvier 2019&quot;, but we're still Tuesday 15th&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3.0.37&lt;/p&gt;&#xA;" OwnerUserId="785" LastActivityDate="2019-01-15T17:23:04.850" Title="Current day display on day later" Tags="&lt;datetime&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29133" PostTypeId="2" ParentId="29132" CreationDate="2019-01-15T17:16:05.090" Score="1" Body="&lt;p&gt;Try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set currDay = now|date('M j, Y H:i:s') %}&#xA;{{ currDay }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Applying the &lt;code&gt;|date()&lt;/code&gt; filter to the &lt;code&gt;now&lt;/code&gt; object when you set the variable &lt;code&gt;currDay&lt;/code&gt; makes &lt;code&gt;currDay&lt;/code&gt; a string. When you then try try to reapply &lt;code&gt;|date()&lt;/code&gt; a second time, something funny must be happening..?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-15T17:23:04.850" LastActivityDate="2019-01-15T17:23:04.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29134" PostTypeId="2" ParentId="29119" CreationDate="2019-01-15T20:14:44.250" Score="2" Body="&lt;p&gt;If you want the latest of both, unless I'm missing something, you should just be able to query on &lt;code&gt;dateUpdated&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you create an entry the first time, its &lt;code&gt;dateUpdated&lt;/code&gt; gets set to the same date as the &lt;code&gt;dateCreated&lt;/code&gt;... So if you query your entries on &lt;code&gt;dateUpdated&lt;/code&gt; only, you will get all entries created + updated in your time frame I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as code goes, this should do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'entries.json' =&amp;gt; function() {&#xA;            $timeframe = (new \DateTime('1 day ago'))-&amp;gt;format(\DateTime::ATOM);&#xA;            return [&#xA;                'elementType' =&amp;gt; Entry::class,&#xA;                'criteria' =&amp;gt; [&#xA;                    'section' =&amp;gt; 'entries',&#xA;                    'dateUpdated' =&amp;gt; '&amp;gt;=' . $timeframe,&#xA;                ],&#xA;                'transformer' =&amp;gt; function(Entry $entry) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                        'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                    ];&#xA;                },&#xA;            ];&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-15T20:14:44.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29135" PostTypeId="1" CreationDate="2019-01-15T21:11:09.823" Score="1" ViewCount="323" Body="&lt;p&gt;I just updated to 3.1 and I'm getting the php error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PHP Notice – yii\base\ErrorException&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Undefined index: settings&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It probably has to do with the Cheat Sheet plugin.  I deleted that folder in the vendor directly but no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can send along the link showing the errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastActivityDate="2021-02-08T03:08:35.853" Title="Getting PHP Error on upgrade from 3.0.36 to 3.1" Tags="&lt;php&gt;&lt;error-message&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29136" PostTypeId="1" AcceptedAnswerId="29265" CreationDate="2019-01-15T22:41:02.287" Score="1" ViewCount="88" Body="&lt;p&gt;I'm trying to set up a past events archive. Followed the guide provided by PT: &lt;a href=&quot;https://craftcms.com/guides/creating-an-archive-page-for-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft cms guide to set up an archive&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference is that I use a custom date field (dateAndTime) and not postDate. The route leads to the correct template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The issue&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it loads the archives/agenda/2018 template (f. ex.), it displays all 2018 events (grouped by month) but also all 2019 events that where entered in Craft in 2018. This under the correct month, but obviously the wrong year.&#xA;When it load the 2019 template, only the 2019 events that where entered in 2019 show up.&#xA;I can't figure out where the code is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Route&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;url: archives/agenda/year (token)&#xA;template: _sections/archives/agenda/index&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Nav&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEntryEver = craft.entries.section('agenda').orderBy('dateAndTime asc').one() %}&#xA;    &amp;lt;ul&amp;gt;&#xA;    {% for year in now|date('Y') .. firstEntryEver.dateAndTime|date('Y') %}&#xA;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;archives/agenda/{{ year }}&quot;&amp;gt;{{ year }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Index&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;lt;h1&amp;gt;{{ year }}&amp;lt;/h1&amp;gt;&#xA;&#xA;    {% set entriesInYear = craft.entries.section('agenda').limit(null).after(year).before(year+1).all() %}&#xA;    {% for month, entries in entriesInYear | group(&quot;dateAndTime|date('F')&quot;) %}&#xA;        &amp;lt;h2&amp;gt;{{ month }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;ul&amp;gt;&#xA;            {% for entry in entries %}&#xA;                &amp;lt;li&amp;gt;{{ entry.getLink() }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;        &amp;lt;/ul&amp;gt;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="785" LastActivityDate="2019-01-25T15:32:31.910" Title="Event archives with custom date field" Tags="&lt;datetime&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29139" PostTypeId="1" CreationDate="2019-01-16T10:09:44.423" Score="1" ViewCount="483" Body="&lt;p&gt;I currently try to use the Element API to build a search. Unfortunately I'm kind of stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;baseEntry&lt;/code&gt;, that has a field that references entries (let's call them &lt;code&gt;subEntries&lt;/code&gt;) of the section &lt;code&gt;subEntries&lt;/code&gt;, where &lt;code&gt;subEntries&lt;/code&gt; have a field that references other entries (let's call those &lt;code&gt;categoryEntries&lt;/code&gt;), where &lt;code&gt;categoryEntries&lt;/code&gt; (for simplicity) only have a &lt;code&gt;title&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to output all &lt;code&gt;baseEntry&lt;/code&gt;s that contain one ore more &lt;code&gt;subEntry&lt;/code&gt;s which have one or more &lt;code&gt;categoryEntry&lt;/code&gt;s with the title of my query... I tried to do this via &lt;code&gt;endpoint.json?section=baseEntry&amp;amp;q=subEntryHandleFromBaseEntry:*:categoryEntryHandleFromSubEntry:mySearchTerm&lt;/code&gt; but that didn't work using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoint.json' =&amp;gt; function() {&#xA;    return [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'paginate' =&amp;gt; false,&#xA;        'one' =&amp;gt; true,&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;&#xA;            $items = [];&#xA;            $section = Craft::$app-&amp;gt;getRequest()-&amp;gt;getParam('section');&#xA;            $param = Craft::$app-&amp;gt;getRequest()-&amp;gt;getParam('q');&#xA;            if ($param &amp;amp;&amp;amp; $section) {&#xA;&#xA;&#xA;                $entries = \craft\elements\Entry::find()&#xA;                -&amp;gt;search($param)&#xA;                -&amp;gt;section($section)&#xA;                -&amp;gt;all();&#xA;&#xA;                foreach ($entries as $entry) {&#xA;                    $items[] = UrlHelper::url(&quot;{$entry-&amp;gt;type-&amp;gt;handle}/{$entry-&amp;gt;id}.json&quot;);&#xA;                }&#xA;            }&#xA;&#xA;            return [&#xA;                $items&#xA;            ];&#xA;        },&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also tried narrowing it down like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = \craft\elements\Entry::find()&#xA;-&amp;gt;section($section)&#xA;-&amp;gt;all();&#xA;&#xA;foreach ($entries as $entry) {&#xA;    $items = \craft\elements\Entry::find()&#xA;    -&amp;gt;search($param)&#xA;    -&amp;gt;relatedTo($entry)&#xA;    -&amp;gt;all();&#xA;&#xA;    foreach ($items as $item) {&#xA;        $items[] = UrlHelper::url(&quot;{$item-&amp;gt;type-&amp;gt;handle}/{$item-&amp;gt;id}.json&quot;);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;didnt work either. I'm kind of lost. I'm looking into the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#relatedto&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; but can't seem to get it working.&lt;/p&gt;&#xA;" OwnerUserId="5855" LastEditorUserId="5855" LastEditDate="2019-01-16T11:13:52.930" LastActivityDate="2019-01-16T11:13:52.930" Title="Element API SearchQuery to search for value inside child-entries" Tags="&lt;craft3&gt;&lt;search&gt;&lt;plugin-elementapi&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29140" PostTypeId="1" CreationDate="2019-01-16T10:30:08.883" Score="1" ViewCount="42" Body="&lt;p&gt;Dear Craft Users/Developers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have inherited a customer on our server platform using CraftCMS 2.7.4. They had their site before moving to us hosted with images using Rackspace via the CraftCMS Pro Agents for RackSpace. The new hosting is based on nice fast SSD and we have created a second Asset Store using Local Folder. The Posts have been relinked to assets stored on the new local asset store. The problem we have seems to be when we tell craft that the original store is no longer required. The moment we delete the original store we get lots of red references to missing assets in the backend Admin. Yet the site all looks great with no missing images even after full cache empty. We have PHPAdmin access to the database and I can see there are ID's for the two stores. Not sure how to progress as at some point we will want to cancel the account with Rack Space. Any help gratefully appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John James&lt;/p&gt;&#xA;" OwnerUserId="9267" LastActivityDate="2019-01-16T10:30:08.883" Title="Image Store Issue" Tags="&lt;assets&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29141" PostTypeId="1" CreationDate="2019-01-16T11:54:47.100" Score="1" ViewCount="67" Body="&lt;p&gt;My database was corrupted after updating to &lt;code&gt;3.1.0&lt;/code&gt; and no backup. Is there any script to move &lt;code&gt;fields&lt;/code&gt;, &lt;code&gt;sections&lt;/code&gt; and other staff to new fresh database? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;I found something like &lt;a href=&quot;https://github.com/nystudio107/craft-scripts&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; scripts, but its not that one I needed&lt;/p&gt;&#xA;" OwnerUserId="9259" LastActivityDate="2019-02-19T02:01:30.447" Title="Craft CMS 3 Content Mover" Tags="&lt;craft3&gt;&lt;database&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29142" PostTypeId="1" CreationDate="2019-01-16T12:15:13.620" Score="2" ViewCount="30" Body="&lt;p&gt;I use the same form for adding an entry on the front end as I do for editing it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when editing it, we need to insert the field values in the fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When editing or adding it we also need to re-populate the values in the form from the POST submission in case of form validation error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this means checking if there is a post request, assigning the values from the post to some variables used in the form, but if not then assigning them from the entry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I always think the method I use is a bit of a hack, and there should be some built in way to do it, but cant find it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the most efficient code I have yet but it's needed for each field. What it does is if there is a post entry then to assign it to the entry object, so that way in my form the value is just the entry.myCustomField which is set whether we're editing or posting (priority to post value if it exists). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wanted to know if there is an even more efficient way, something built in, or if I could even iterate through all post fields automatically without having to create the below code for each field. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPost('fields.myCustomField') is not null %}&#xA;    {% set entry = entry|merge({'myCustomField': craft.request.getPost('fields.myCustomField')}) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did think maybe I could just assign the whole POST to the entry as follows which would be ideal, but I get the error 'The merge filter only works with arrays or &quot;Traversable&quot;'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if craft.request.getPost('fields') is not null %}&#xA;    {% set entry = entry|merge(craft.request.getPost('fields')) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another idea I had was to get all the fields from the section and iterate through them, but I don't know how I can create variables named after the values of the field handles. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set fields = craft.sections.getSectionByHandle('mySection').getEntryTypes()[0].getFieldLayout().getFields() %}&#xA;{% for field in fields %}&#xA;    {# dont know how to create each field named after the field.handle so I can enter my code above once and iterate over it per field #}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="4993" LastEditDate="2019-01-17T10:27:45.767" LastActivityDate="2019-01-17T10:27:45.767" Title="How to process POST and entry fields when using same form for Add as Edit on front end?" Tags="&lt;entries&gt;&lt;form&gt;&lt;post&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29143" PostTypeId="1" CreationDate="2019-01-16T14:07:31.047" Score="1" ViewCount="82" Body="&lt;p&gt;I have a Craft install setup on a LAMP Digital Ocean droplet - everything has been configured to the install requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yesterday I started having issues with not being able to delete entries, sections, categories - basically anything in the CMS. I noticed there was an update from 3.0.47 to 3.1.0, I updated hoping that would solve my issue but it has not. I looked through the php and apache error logs though there's nothing helpful there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking the delete button on anything makes the CMS go unresponsive for 3 minutes or so and then it reloads the webpage with no changes. I'm at a loss for what to do next as there's no console log errors or php/apache errors. &lt;/p&gt;&#xA;" OwnerUserId="9268" LastActivityDate="2019-01-16T14:07:31.047" Title="Craft 3.1 Deleting Anything Renders CMS Unresponsive" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29144" PostTypeId="1" AcceptedAnswerId="29145" CreationDate="2019-01-16T14:35:15.263" Score="1" ViewCount="404" Body="&lt;p&gt;If I am confident in the users of our webpage that they will never be messing with the Twig templates, then what risk is there to creating a &lt;code&gt;|php&lt;/code&gt; filter for Twig that just does this? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set text = &quot;echo 'Hello World';&quot; %) &#xA;{{ text | php }} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Filter function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function myPhpEvalFunction ($text = null) {&#xA;   return eval($text);&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3690" LastEditorUserId="57" LastEditDate="2019-01-20T00:29:04.667" LastActivityDate="2019-01-20T00:29:04.667" Title="PHP eval filter for Twig" Tags="&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29145" PostTypeId="2" ParentId="29144" CreationDate="2019-01-16T15:06:48.463" Score="3" Body="&lt;p&gt;In Craft 3 it is actually possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.app.view.evaluateDynamicContent('phpinfo();') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/722/can-we-use-php-in-our-templates-instead-of-twig&quot;&gt;Can we use PHP in our templates instead of Twig?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="57" LastEditDate="2019-01-20T00:28:38.033" LastActivityDate="2019-01-20T00:28:38.033" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29146" PostTypeId="2" ParentId="29100" CreationDate="2019-01-16T15:31:54.717" Score="2" Body="&lt;p&gt;Pros:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft is extremely flexible--so it is definitely possible to&#xA;accomplish whatever you want &lt;/li&gt;&#xA;&lt;li&gt;It has a great back-end interface for the maintainer of the website (can update the site just from your phone, even. However, it sounds like your 'client' is not really interested in that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Cons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft is quite complex under the hood, and to write the kind of plugin you might want, you need to understand topics like PHP namespacing. If you are used to just writing some down-and-dirty php to make the job work, I would advise that you face integrating that into a much larger structure that was designed by somebody else.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Philosophical point: It seems that every technology that will improve or speed things up for us comes with a learning curve that ultimately steals that benefit away. The up-front time spent learning a new system doesn't save us time in the end, unless we use that system constantly. So if you're planning to become a full-time Craft CMS developer, then learning this will be great. Otherwise, it would be faster to keep going the way you have been, and spend your life doing other things.&lt;/p&gt;&#xA;" OwnerUserId="3690" LastActivityDate="2019-01-16T15:31:54.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29147" PostTypeId="2" ParentId="29142" CreationDate="2019-01-16T20:04:57.460" Score="1" Body="&lt;p&gt;This may not be possible but can you not just make your form itself an include and have a &quot;create&quot; template and another &quot;edit&quot; template which have their own logic but include the same base form?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-16T20:04:57.460" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29148" PostTypeId="1" CreationDate="2019-01-16T21:35:56.483" Score="1" ViewCount="240" Body="&lt;p&gt;I have two Mailchimp subscribe forms on the same page – one in the sidebar and one in the footer. They are created as separate forms in the admin, albeit one a duplicate of the other, with different IDs on the forms and different IDs on the Mailchimp field. &quot;Enable AJAX&quot; is selected on both forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I submit the first form from the sidebar, it submits successfully but reloads the page (No AJAX). The second form works correctly, submitting via AJAX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a known limitation of Freeform Pro or simply a matter of a duplicate ID or class that I'm missing somewhere? I'd like to have AJAX work on both.&lt;/p&gt;&#xA;" OwnerUserId="4438" LastActivityDate="2020-11-06T06:11:48.597" Title="Freeform AJAX submission not working when two forms are on same page" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29149" PostTypeId="1" CreationDate="2019-01-16T22:24:20.807" Score="1" ViewCount="657" Body="&lt;p&gt;Is there anything with craft like &lt;a href=&quot;https://laravel.com/docs/5.7/validation#creating-form-requests&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laravel's Form Requests&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing a plugin with a custom entry type. Right now, I am doing the store/edit pages and I do not want to reinvent the wheel ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way in craft/yii to easily validate the submitted values from a post request? Or what is the &lt;em&gt;best practice&lt;/em&gt; in this case for craft?&lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2019-02-19T03:03:40.737" Title="How to validate a form request" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;form&gt;&lt;validation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29150" PostTypeId="2" ParentId="29142" CreationDate="2019-01-16T22:34:46.520" Score="1" Body="&lt;p&gt;This might not be the perfect solution, but I think it's the way craft itself handles it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was recently digging through the edit template of the categories section. Craft has only one template here &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/templates/categories/_edit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;_edit&lt;/code&gt;&lt;/a&gt;, they therefore do the same thing as you want to: Use one template for both actions. In their template, they simply use a &lt;code&gt;category&lt;/code&gt; object, either an empty one (if new) or an existing one. This is passed to the template by the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/CategoriesController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;CategoriesController&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a deeper look at the &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/CategoriesController.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;CategoriesController&lt;/code&gt;&lt;/a&gt;. As far as I understand, in &lt;code&gt;_populateCategoryModel()&lt;/code&gt; they fill the elements object with the data from the request and pass it back to the template (see at &lt;code&gt;actionSaveCategory&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this workaround would solve your problem. &lt;/p&gt;&#xA;" OwnerUserId="5424" LastActivityDate="2019-01-16T22:34:46.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29151" PostTypeId="2" ParentId="29029" CreationDate="2019-01-17T06:06:01.817" Score="1" Body="&lt;p&gt;Sounds like you have not submitted a shipping method selection to the cart.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-17T06:06:01.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29153" PostTypeId="1" AcceptedAnswerId="29158" CreationDate="2019-01-17T07:23:59.287" Score="1" ViewCount="413" Body="&lt;p&gt;I need to log flash messages from &lt;code&gt;craft.session.getFlashes&lt;/code&gt; to a error log file from a particular twig template in Craft 2. Is there a way to do it ? &lt;/p&gt;&#xA;" OwnerUserId="9271" LastActivityDate="2019-01-17T14:56:12.420" Title="Log Errors from twig template" Tags="&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29154" PostTypeId="1" CreationDate="2019-01-17T08:57:57.257" Score="1" ViewCount="315" Body="&lt;p&gt;I updated to the newest Craft Version 3.1.1. Since then I have the following problem. I lost all the data from Matrix Filed stored in a Super Table Field after changing Field Setup (Matrix - Asset props.) again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting:&#xA;Craft CMS: 3.1.1, &#xA;Super Table: 2.0.14&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)&#xA;I created a Super Table Field which stores a simple Text Field and a Matrix-Field with one Block which stores a simple Text and an Asset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)&#xA;I added the Field to a Single Entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3)&#xA;I created all Content with the Super Table Field in the Entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4)&#xA;jumped back to Super Table Field Settings and changed something in the Matrix Asset properties&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) after Saving i lost all the Data in the Matrix Field, which i stored in the entry&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really bad, because the Super Table field i created in the entry was complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone else have the same problem? - What did I Wrong?&lt;/p&gt;&#xA;" OwnerUserId="5301" LastActivityDate="2019-01-19T00:31:06.077" Title="Super Table -&gt; Matrix data loss" Tags="&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29155" PostTypeId="1" CreationDate="2019-01-17T10:37:06.570" Score="1" ViewCount="78" Body="&lt;p&gt;I have created in Craft 2 CMS, under the profile of users (ex. parents), new tab for (children), where parents can fill in there children information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is saved in a database under the craft_content&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use the dropdown in a Twig file, data for child to be shown?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help with the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have installed Neo plugin in Craft CMS&lt;/p&gt;&#xA;" OwnerUserId="9025" LastEditorUserId="57" LastEditDate="2019-01-20T00:52:46.037" LastActivityDate="2019-01-20T00:52:46.037" Title="Craft 2, MySQL database, Twig, JavaScript files" Tags="&lt;templating&gt;&lt;database&gt;&lt;javascript&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29157" PostTypeId="2" ParentId="29113" CreationDate="2019-01-17T13:38:32.117" Score="1" Body="&lt;p&gt;Thanks Kelsey: &quot;Sorry, unfortunately you cannot, as these fields are pre-rendered beforehand. Kelsey Martens&quot; &lt;/p&gt;&#xA;" OwnerUserId="7812" LastActivityDate="2019-01-17T13:38:32.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29158" PostTypeId="2" ParentId="29153" CreationDate="2019-01-17T14:56:12.420" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Create a plugin (&lt;a href=&quot;https://docs.craftcms.com/v2/plugins/introduction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/introduction.html&lt;/a&gt;,  &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Create a Variable class with a log function (&lt;a href=&quot;https://docs.craftcms.com/v2/plugins/variables.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v2/plugins/variables.html&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Pass data from getFlashes to your function from within the template like e.g. &lt;code&gt;craft.yourPluginName.yourVariableFunctionName(craft.session.getFlashes)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Tip: Use YourPluginName::log('blabla' . $string); to log anything to /storage/runtime/logs/yourpluginname.log from within your Plugin&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-17T14:56:12.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29159" PostTypeId="1" CreationDate="2019-01-17T15:16:12.317" Score="1" ViewCount="67" Body="&lt;p&gt;I'm trying to purchase a pro license for Craft 2. The site was on a staging server which is now uploaded to the live server. At first, there were 2 warning messages. First saying running Craft Pro on Solo license. And another saying you are using a license belonging to the staging site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I removed the license .key from the config folder and cleared the cache and this re-created the license and cleared the staging site message. However, when I go to purchase a pro license it goes through the fields and ends with a message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Craft is unable to purchase an edition upgrade at this time.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea what is going on and how to resolve this? The site needs to go live today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3404" LastEditorUserId="57" LastEditDate="2019-01-20T00:47:04.327" LastActivityDate="2019-01-20T00:47:04.327" Title="Pro licence error - Craft is unable to purchase an edition upgrade at this time" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29160" PostTypeId="1" AcceptedAnswerId="29194" CreationDate="2019-01-17T15:42:13.783" Score="1" ViewCount="1312" Body="&lt;p&gt;I would like to create a custom console command for my Craft 3 plugin. I've looked at the Yii docs and understand commands are defined using controllers extending &lt;code&gt;\yii\console\Controller&lt;/code&gt; but cannot work out how these controllers should be registered with the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To register site routes in Craft 3, we listen for the &lt;code&gt;UrlManager::EVENT_REGISTER_SITE_URL_RULES&lt;/code&gt; event and then define rules. What's the equivalent for registering console commands?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9162" LastActivityDate="2019-01-20T00:40:52.743" Title="How do I create console commands for my module or plugin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;&lt;yii&gt;&lt;console&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29162" PostTypeId="1" CreationDate="2019-01-17T16:16:01.050" Score="1" ViewCount="56" Body="&lt;p&gt;I'm a bit confused by the way that Craft now handles Matrix blocks. I've read the documentation a few times and I'm still not sure if I have it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myMatrixBlockQuery = craft.matrixBlocks().ownerId(4).type('block__artists') %}&#xA;{% set matrixBlocks = myMatrixBlockQuery.all() %}&#xA;{% for block in matrixBlocks %}&#xA;  &amp;lt;li&amp;gt;{{ block.id }} / {{ block.artistName }}&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But all that gets output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;8 /&#xA;9 /&#xA;10 /&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;10&lt;/code&gt; (etc) is the ID of the block. It's not outputting the artistName despite that field existing and having content. Is my query wrong?&lt;/p&gt;&#xA;" OwnerUserId="9274" LastActivityDate="2019-01-18T09:56:39.303" Title="Query returns nothing on matrixBlock" Tags="&lt;matrix&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29164" PostTypeId="1" CreationDate="2019-01-17T19:35:42.580" Score="1" ViewCount="64" Body="&lt;p&gt;Hello and good evening,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the one click update the message 'Interne Serverfout' appears on the screen. One can no longer connect to either the fron or backend of the installation ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct procedure to roll back to a working website here ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Ruud&lt;/p&gt;&#xA;" OwnerUserId="5030" LastActivityDate="2019-01-21T07:15:32.953" Title="Interne Serverfout after one click update" Tags="&lt;updating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29166" PostTypeId="1" CreationDate="2019-01-17T22:38:03.977" Score="1" ViewCount="152" Body="&lt;p&gt;I’ve installed CraftQL and can successfully query from the Craft admin interface but when I hit the endpoint using Axios I get a 500 server error. I've checked that my endpoint matches what's set in CraftQL's settings. Any idea why this is failing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here’s my Axios code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;axios&#xA;  .create({&#xA;    baseURL: &quot;/api&quot;,&#xA;    headers: {&#xA;      Authorization: `Bearer R0Fq9-AAAAA-7hXQrigZqiFfq9BevLGdHrZWn6FNVaABCJsq-CZQuGxqklmntl`,&#xA;      &quot;X-Requested-With&quot;: &quot;XMLHttpRequest&quot;&#xA;    }&#xA;  })&#xA;  .post(&quot;&quot;, {&#xA;    query: `&#xA;    {&#xA;    entries(section:[testSection], limit:5) {&#xA;      ...on TestSection {&#xA;        title&#xA;        url&#xA;      }&#xA;    }&#xA;    }&#xA;`,&#xA;    variables: &quot;&quot;&#xA;  })&#xA;  .then(result =&amp;gt; {&#xA;    console.log(result.data);&#xA;  })&#xA;  .catch(error =&amp;gt; {&#xA;    console.log(error);&#xA;  });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6170" LastEditorUserId="57" LastEditDate="2019-01-20T00:45:57.417" LastActivityDate="2019-01-20T00:45:57.417" Title="500 Error with CraftQL" Tags="&lt;craft3&gt;&lt;plugin-craftql&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29167" PostTypeId="2" ParentId="29159" CreationDate="2019-01-18T07:25:06.290" Score="1" Body="&lt;p&gt;According to their Tweet it seems there was an error on P&amp;amp;T's end: &#xA;&lt;a href=&quot;https://twitter.com/CraftCMS/status/1085975322443448321&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twitter.com/CraftCMS/status/1085975322443448321&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5905" LastActivityDate="2019-01-18T07:25:06.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29168" PostTypeId="2" ParentId="29162" CreationDate="2019-01-18T09:56:39.303" Score="2" Body="&lt;p&gt;I think you need to add the fieldId() param to your query as per &lt;a href=&quot;https://github.com/craftcms/cms/issues/1789&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/1789&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2019-01-18T09:56:39.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29169" PostTypeId="1" CreationDate="2019-01-18T10:09:59.410" Score="2" ViewCount="146" Body="&lt;p&gt;Migrating Plugins to Craft 3 starts bugging me, seems that really everything changed.&#xA;Is there an equivalent to &lt;code&gt;IOHelper::ensureFolderExists&lt;/code&gt; in Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-18T13:08:01.190" Title="Is there an equivalent to IOHelper::ensureFolderExists in Craft 3?" Tags="&lt;plugin-development&gt;&lt;migration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29170" PostTypeId="2" ParentId="24008" CreationDate="2019-01-18T11:01:36.913" Score="3" Body="&lt;p&gt;I needed to aggregate blog posts entries from ~20 schools (multi-sites) and display them on the main site. Like others, I realised way to0 late in the development that this wasn't an out of the box feature. However by using the Twig array &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/merge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;merge filter&lt;/a&gt; you can build an array of aggregated entries from your multi-sites. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using the &lt;a href=&quot;https://github.com/TopShelfCraft/SuperSort&quot; rel=&quot;nofollow noreferrer&quot;&gt;superSort&lt;/a&gt; plugin you can subsequently sort the merged array into whatever order you like, chronological in our case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On this particular multi-site setup, we use a lightswitch &lt;code&gt;showOnMainSite&lt;/code&gt; that admin users can switch to the on position to select what entries are pulled through to the main site. In the example below, we use the search filter to filter the entries output accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simplified version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{#-- create an empty array --#}&#xA;{% set multiSiteEntries = [] %}&#xA;&#xA;{#-- fetch the multi-site IDS using the getSitesByGroupId method --#}&#xA;{% set sites = craft.app.sites.getSitesByGroupId(2) %}&#xA;&#xA;    {#-- loop through the sites in groupId 2 using the site.id, searching for the showOnMainSite lightswitch field --#}&#xA;    {% for site in sites %}&#xA;&#xA;        {#-- add retrieved site entries to the multiSiteEntries array --#}&#xA;        {% set multiSiteEntries = multiSiteEntries|merge(&#xA;            craft.entries().&#xA;            siteId(site.id).&#xA;            section('blog').&#xA;            search('showOnMainSite:1').&#xA;            all()) &#xA;        %}&#xA;&#xA;    {% endfor %}&#xA;&#xA;{#-- loop through our populated array of multi-site enries and use the superSort plugin to sort them chronologically --#}&#xA;{% for entry in multiSiteEntries|supersort('rsortAs', '{{ object.postDate|date(&quot;U&quot;) }}') %}&#xA;&#xA;    {#-- our multi-site entries output --#}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        {{ entry.title }} | {{ entry.postDate|date('jS F Y')}}&#xA;    &amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We limit each site output to 3 entries, so overall we are pulling ~60 entries in from 20 multi-sites to use as a landing page for end users to browse at a glance all the news across the 20 schools. &lt;/p&gt;&#xA;" OwnerUserId="145" LastActivityDate="2019-01-18T11:01:36.913" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29171" PostTypeId="2" ParentId="29058" CreationDate="2019-01-18T12:00:51.197" Score="1" Body="&lt;p&gt;I did install the Sprout Reports but found the user interface to be very challenging, not at all obvious to me how to go about getting what I wanted. &#xA;In the end, I installed Boboldehampsink Export plugin for Craft 2. This was much easier to use and I got most of my data out that way. The missing piece I was able to export direct from the database using SQL. &#xA;&lt;a href=&quot;https://github.com/boboldehampsink/export&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/boboldehampsink/export&lt;/a&gt;&#xA;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="9238" LastActivityDate="2019-01-18T12:00:51.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29172" PostTypeId="1" CreationDate="2019-01-18T12:30:22.177" Score="2" ViewCount="483" Body="&lt;p&gt;I am looking for a simple shopping solution for one of my customers. Since their website is already running with CraftCMS, I am looking if there is any integrated solution available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, so far I have found only 3 plugins compatible with Craft3:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://enupal.com/craft-plugins/stripe-payments&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stripe Payments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://enupal.com/craft-plugins/paypal&quot; rel=&quot;nofollow noreferrer&quot;&gt;PayPal Buy Now Button&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.com/commerce&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Commerce&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Am I missing one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have experience with one or more of these shop systems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, Craft Commerce Lite looks the best to me, but I am not sure whether I am overlooking something. &lt;/p&gt;&#xA;" OwnerUserId="5424" LastEditorUserId="57" LastEditDate="2019-01-20T00:49:28.033" LastActivityDate="2019-01-20T00:49:28.033" Title="Simple webshop solution (Craft Commerce)?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29173" PostTypeId="2" ParentId="29172" CreationDate="2019-01-18T12:36:38.280" Score="4" Body="&lt;p&gt;You could use &lt;a href=&quot;https://snipcart.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://snipcart.com/&lt;/a&gt;, with the product data populated via Craft fields, for an easy/low-cost solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No plugin required for this - although &lt;a href=&quot;https://superbig.co/plugins/snipcart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://superbig.co/plugins/snipcart&lt;/a&gt; is in the works for an even tighter integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example see &lt;a href=&quot;https://www.bernatkleinfoundation.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.bernatkleinfoundation.org&lt;/a&gt;, here's a screenshot of the product entry used to populate products in Snipcart:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m2ZZ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m2ZZ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2019-01-18T12:36:38.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29174" PostTypeId="2" ParentId="29169" CreationDate="2019-01-18T13:08:01.190" Score="3" Body="&lt;p&gt;In Craft 3, the &lt;code&gt;IOHelper&lt;/code&gt; class has been replaced by the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-filehelper.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;FileHelper&lt;/code&gt;&lt;/a&gt; class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest Craft 3 equivalent to &lt;code&gt;IOHelper::ensureFolderExists()&lt;/code&gt; is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FileHelper::createDirectory($path);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2019-01-18T13:08:01.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29176" PostTypeId="1" CreationDate="2019-01-18T13:29:45.280" Score="1" ViewCount="145" Body="&lt;p&gt;Is there an equivalent function to &lt;code&gt;commerce_shippingMethods-&amp;gt;getAllCoreShippingMethods()&lt;/code&gt; in Commerce 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only find &lt;code&gt;Commerce::getInstance()-&amp;gt;getShippingMethods()-&amp;gt;getAllShippingMethods();&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also cant find an equivalent to &lt;code&gt;craft()-&amp;gt;commerce_orders-&amp;gt;saveOrder($order)&lt;/code&gt; anywhere.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="3463" LastEditDate="2019-01-21T14:00:01.293" LastActivityDate="2019-06-27T02:00:07.417" Title="How to get core shipping methods in Commerce 2? How to save an order?" Tags="&lt;plugin-development&gt;&lt;migration&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29177" PostTypeId="1" CreationDate="2019-01-18T15:01:23.847" Score="1" ViewCount="753" Body="&lt;p&gt;I just tried to update Craft to 3.1.1 from within the CP. The install failed and I got an Internal Server 500 error. I now can't load either the front or backend of the site, I get a 500 error in both cases. The phperror log shows these errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[18-Jan-2019 06:03:54 America/Los_Angeles] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 14680096 bytes) in /home/vps/proto.site.com/craft/vendor/composer/composer/src/Composer/Util/RemoteFilesystem.php on line 300&#xA;[18-Jan-2019 06:03:54 America/Los_Angeles] PHP Fatal error:  Uncaught yii\base\InvalidRouteException: Unable to resolve the request &quot;templates/render-error&quot;. in /home/vps/proto.ibiscycles.com/craft/vendor/yiisoft/yii2/base/Module.php:537&#xA;Stack trace:&#xA;#0 /home/vps/proto.site.com/craft/vendor/craftcms/cms/src/web/Application.php(284): yii\base\Module-&amp;gt;runAction('templates/rende...', Array)&#xA;#1 /home/vps/proto.site.com/craft/vendor/yiisoft/yii2/web/ErrorHandler.php(108): craft\web\Application-&amp;gt;runAction('templates/rende...')&#xA;#2 /home/vps/proto.site.com/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(132): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#3 /home/vps/proto.site.com/craft/vendor/yiisoft/yii2/base/ErrorHandler.php(262): craft\web\ErrorHandler-&amp;gt;renderException(Object(yii\base\ErrorException))&#xA;#4 [internal function]: yii\base\ErrorHandler-&amp;gt;handleFatalError()&#xA;#5 {main}&#xA;  thrown in /home/vps/proto.site.com/craft/vendor/yiisoft/yii2/base/Module.php on line 537&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have successfully updated Craft via the CP over the last couple of months, this is the first time it's failed. I also updated the php.ini memory_limit to 512M (from 256M) and the max_execution_time to 300 (from 30) after the update failed but I still can't view either the front end or CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm in the middle of migrating a site from Expression Engine to Craft, this is kind of worrying! I've never see a complete failure like this without any indication of what the problem is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="8616" LastActivityDate="2019-01-18T19:02:39.017" Title="HTTP 500 Error after trying to update to Craft 3.1.1" Tags="&lt;craft3&gt;&lt;error&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29178" PostTypeId="2" ParentId="23319" CreationDate="2019-01-18T17:13:08.420" Score="1" Body="&lt;p&gt;I got this error and checked my error log. I found a bunch of errors like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2019-01-18 09:03:30 [-][-][soundnpevuons07lqg8c911grb][error][yii\base\ErrorException:2] yii\base\ErrorException: fopen(/craft/web/cpresources/725d4d8/jquery-ui.min.js): failed to open stream: No such file or directory in /craft/vendor/yiisoft/yii2/web/Response.php:485. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When researching I found that there might be some write issue errors with the sub folders of the /web/cpresources folder. I cleared out all the sub folders and then tried to log in again. Now it all works.&lt;/p&gt;&#xA;" OwnerUserId="9279" LastActivityDate="2019-01-18T17:13:08.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29179" PostTypeId="2" ParentId="29177" CreationDate="2019-01-18T19:02:39.017" Score="1" Body="&lt;p&gt;The error message indicates your &lt;code&gt;php.ini&lt;/code&gt; file's &lt;code&gt;memory_limit&lt;/code&gt; setting is still sitting at 256M (268435456).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Double check you've bumped it up to 512M and you're editing the correct php.ini file for the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, the quickest way to get the site back up and running is if you have &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer installed&lt;/a&gt; from the command line, to nuke your &lt;code&gt;vendor&lt;/code&gt; folder and &lt;code&gt;composer.lock&lt;/code&gt; file, then run &lt;code&gt;composer update&lt;/code&gt; from your project's root to pull in a fresh set of Craft's dependencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be safe, you'll probably also want to restore your database from a pre-update attempt database backup as well (you can't be sure at what point the original fatal error occurred during the update process).&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-18T19:02:39.017" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29180" PostTypeId="2" ParentId="29155" CreationDate="2019-01-18T20:08:30.727" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I have all ready created form, for parents profile that has child info. On website i need to add dropdown menu, in which is information of there children, so parents when is log on website, don't need to fill out information for children, they can choose from dropdown.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It sounds like you want to loop through the children (Entries?) and output the data as a dropdown menu...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set children = craft.entries.section('children').all() %}&#xA;&#xA;&amp;lt;select name=&quot;fields[children]&quot;&amp;gt;&#xA;    {% for child in children %}&#xA;        &amp;lt;option value=&quot;{{ child.id }}&quot;&amp;gt;{{ child.title }}&amp;lt;/option&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/select&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more information, see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2437/category-as-select-dropdown-box&quot;&gt;this thread...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-01-18T20:08:30.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29181" PostTypeId="2" ParentId="29154" CreationDate="2019-01-19T00:31:06.077" Score="1" Body="&lt;p&gt;Firstly, my apologies for your issues, and its a direct result of the changes made in Craft 3.1.x. Fortunately, the Craft team has been amazingly helpful in coming up with a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This issue should be fixed in &lt;a href=&quot;https://github.com/verbb/super-table/releases/tag/2.1.1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table 2.1.1&lt;/a&gt; and &lt;a href=&quot;https://github.com/craftcms/cms/releases/tag/3.1.2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3.1.2&lt;/a&gt;. Please update both Super Table and Craft as these changes effect both packages.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-01-19T00:31:06.077" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29182" PostTypeId="2" ParentId="14428" CreationDate="2019-01-19T00:56:22.307" Score="11" Body="&lt;p&gt;Actually, reading from the &lt;a href=&quot;https://docs.craftcms.com/v2/templating/craft.request.html#methods&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Craft 2&lt;/strong&gt; docs&lt;/a&gt; it's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.request.getQueryString()      // returns the whole query string&#xA;craft.request.getQuery('success')   // returns only the value of 'success'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8778" LastEditorUserId="8778" LastEditDate="2019-01-22T02:17:44.017" LastActivityDate="2019-01-22T02:17:44.017" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29183" PostTypeId="1" AcceptedAnswerId="29188" CreationDate="2019-01-19T07:12:17.600" Score="0" ViewCount="76" Body="&lt;p&gt;This is my first template that im working on in craft cms3, i've managed to make the most of the homepage and other tabs of website dynamic using the CMS, but I can't figure out how do I make tags and categories dynamic on the homepage and sidebars of all the related pages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The bottom of homepage which I want to make dynamic&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T6dVK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T6dVK.png&quot; alt=&quot;the part whicih I want to make dyanmic on homepage&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The sidebar of the page that I want to make dynamic&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B6MKZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B6MKZ.png&quot; alt=&quot;these are the sidebars which &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you want to have a look at the website im working on heres the server link &lt;a href=&quot;http://52.65.202.173/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://52.65.202.173/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will be really grateful for the help, thanks!&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="9153" LastEditDate="2019-01-19T07:32:13.913" LastActivityDate="2019-01-19T23:56:06.960" Title="How to add tags in craft CMS 3" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;tags&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29184" PostTypeId="1" CreationDate="2019-01-19T11:31:15.640" Score="1" ViewCount="35" Body="&lt;p&gt;Our malware scanner detected punycode as malware in &lt;code&gt;/vendor/bower-asset/punycode/...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In light of punycode being used to mask some IDNs like wikipedia.org etc. I would like to know what the usage of punycode is in Craft installations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw that punycode is listed under the &lt;code&gt;devDependencies&lt;/code&gt; in &lt;code&gt;/vendor/craftcms/cms/package.json&lt;/code&gt; however it was not installed on all of our Craft installations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file that's being marked as malware is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/vendor/bower-asset/punycode/tests/data.js&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8507" LastActivityDate="2019-01-19T22:42:21.080" Title="Craft CMS usage of punycode" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29185" PostTypeId="1" AcceptedAnswerId="29197" CreationDate="2019-01-19T15:14:15.390" Score="4" ViewCount="1186" Body="&lt;p&gt;I have a problem related &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12649/my-website-isnt-working-craft-does-not-support-backtracking-to-this-version&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14993/craft-files-and-db-out-of-sync&quot;&gt;this&lt;/a&gt; question. I began updating a long time ago (2017?) and got the error &quot;Craft CMS does not support backtracking to this version. Please upload Craft CMS 0 or later&quot; when I try to access the site or admin. I'm just now trying to fix it. I have tried replacing the app folder with a clean craft 2 version and I'm getting a blank white screen on everything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I run a local install and a live install from the same DB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else can I try? &lt;/p&gt;&#xA;" OwnerUserId="558" LastActivityDate="2019-04-05T08:23:36.817" Title="&quot;Craft CMS does not support backtracking to this version. Please upload Craft CMS 0 or later.&quot;" Tags="&lt;database&gt;&lt;error-message&gt;&lt;manual-updates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29187" PostTypeId="2" ParentId="29184" CreationDate="2019-01-19T22:42:21.080" Score="2" Body="&lt;p&gt;I can't say officially (since I had nothing to do with building it), but it looks like the &lt;a href=&quot;https://github.com/true/php-punycode&quot; rel=&quot;nofollow noreferrer&quot;&gt;Punycode library&lt;/a&gt; specifically does this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This library converts a Unicode encoded domain name to a IDNA ASCII form and vice-versa.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why it's getting flagged as malware, it seems like a pretty harmless little library. If you're still concerned about it, I'd either reach out to Pixel &amp;amp; Tonic directly (support@craftcms.com) or post an &lt;a href=&quot;https://github.com/true/php-punycode/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; on the Punycode repo.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-01-19T22:42:21.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29188" PostTypeId="2" ParentId="29183" CreationDate="2019-01-19T23:56:06.960" Score="2" Body="&lt;p&gt;Here are some basics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, tags and categories are two different things. As a first step, think long and hard about how you want to organize your content. Keep in mind that Categories can be hierarchical, whereas Tags are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start using Categories, you must first create a Category set, say, &quot;Blog&quot;, then specify categories within that set, e.g. Beauty, Health, etc. Note that you can assign fields to a category set, so you can associate things like icons or brief description for each one! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use your Categories in entries, first create a Category field(s) and then add it to one or more of your channel entry types. then, when you create a new entry, you can assign a category to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To access entries by category in your templates, refer to &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/category-queries.html#example&quot; rel=&quot;nofollow noreferrer&quot;&gt;this section of Craft Docs&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-01-19T23:56:06.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29189" PostTypeId="2" ParentId="29135" CreationDate="2019-01-20T00:19:16.433" Score="0" Body="&lt;p&gt;If you restore from a 3.0.36 database backup, then update to the latest Craft 3.1 release (currently &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#3122---2019-01-19&quot; rel=&quot;nofollow noreferrer&quot;&gt;3.1.2.2&lt;/a&gt;, this shouldn't be an issue anymore.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:19:16.433" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29190" PostTypeId="2" ParentId="29097" CreationDate="2019-01-20T00:22:58.867" Score="0" Body="&lt;p&gt;Try updating your MySQL config &lt;code&gt;max_allowed_packet&lt;/code&gt; config setting to a higher value and verify the change has been applied to your running instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dba.stackexchange.com/questions/19135/mysql-error-reading-communication-packets&quot;&gt;https://dba.stackexchange.com/questions/19135/mysql-error-reading-communication-packets&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:22:58.867" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29191" PostTypeId="2" ParentId="29141" CreationDate="2019-01-20T00:27:42.430" Score="1" Body="&lt;p&gt;Depending on the level of &quot;corruption&quot;, if the 3.1 Control Panel is still accessible and loading, you can use something like &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/features&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeedMe&lt;/a&gt; to export the content you're looking for into a new Craft 3 install.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:27:42.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29192" PostTypeId="2" ParentId="29149" CreationDate="2019-01-20T00:35:08.887" Score="1" Body="&lt;p&gt;Yii 2 (which is what Craft 3 is built upon) has similar looking form/model validation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/input-validation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/guide/2.0/en/input-validation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also look at how Craft does it in its own &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/models&quot; rel=&quot;nofollow noreferrer&quot;&gt;models&lt;/a&gt; and &lt;a href=&quot;https://github.com/craftcms/cms/tree/develop/src/controllers&quot; rel=&quot;nofollow noreferrer&quot;&gt;controllers&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:35:08.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29194" PostTypeId="2" ParentId="29160" CreationDate="2019-01-20T00:40:52.743" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What's the equivalent for registering console commands?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You don't need to listen to an event to create a console command. Assuming your namespacing and autoloading is set up correctly, they'll &quot;just work&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest going over to &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; and select with Craft 3 plugin or module and tick the &quot;Console Commands&quot; checkbox to see a working example of how the files and structure is set up.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:40:52.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29195" PostTypeId="2" ParentId="29164" CreationDate="2019-01-20T00:44:06.240" Score="1" Body="&lt;p&gt;Interne Serverfout (Internal Server Error) is a fatal error that has happened and your web server killed the request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, fatal errors like this are either because PHP times out, or runs out of memory... the underlying error message will be either in your web server's error logs or Craft error logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try editing your php.ini file and increasing the &lt;code&gt;memory_limit&lt;/code&gt; setting to at least 256M, and the &lt;code&gt;max_execution_time&lt;/code&gt; setting to at least 120.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’re not sure where your php.ini file is located, create a PHP file called &lt;code&gt;ini.php&lt;/code&gt; alongside your &lt;code&gt;index.php&lt;/code&gt; file with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php&#xA;echo 'Loaded php.ini: ' . php_ini_loaded_file();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then access that file in your web browser by going to &lt;code&gt;http://your-project.test/ini.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you’ve made your changes, restart your web server, restore your database from a pre-update attempt database backup and then try again.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-20T00:44:06.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29196" PostTypeId="1" AcceptedAnswerId="29298" CreationDate="2019-01-20T13:23:17.027" Score="1" ViewCount="118" Body="&lt;p&gt;User password reset mail is acting weird. When resetting the user password the mail I receive has &lt;code&gt;forgot_password_subject&lt;/code&gt; subject and &lt;code&gt;forgot_password_body&lt;/code&gt; content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried checking the source code but after an hour I gave up. I think this might be an issue with the database. I am guessing after few updates of Craft the database got corrupted? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas if this configuration is stored in any of the database tables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reset user password functionality works normally while being accessed via admin page.&lt;/p&gt;&#xA;" OwnerUserId="8326" LastEditorUserId="57" LastEditDate="2019-01-30T02:32:20.690" LastActivityDate="2019-01-30T02:32:20.690" Title="Reset user password" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29197" PostTypeId="2" ParentId="29185" CreationDate="2019-01-20T14:03:45.180" Score="2" Body="&lt;p&gt;Turns out I hadn't fully uploaded the app folder when I tried to access it earlier. Tried again, made sure it was finished before renaming and it worked fine. &lt;/p&gt;&#xA;" OwnerUserId="558" LastActivityDate="2019-01-20T14:03:45.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29198" PostTypeId="1" AcceptedAnswerId="29199" CreationDate="2019-01-20T17:02:09.013" Score="3" ViewCount="306" Body="&lt;p&gt;Trying to send an email&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;setViewPath('/Users/stian/dev/site.com/templates/');&#xA;Craft::$app-&amp;gt;mailer-&amp;gt;compose('confirmation.twig', ['orderId' =&amp;gt; $orderId, 'customerId' =&amp;gt; $customerId])&#xA;    -&amp;gt;setFrom('me@me.com')&#xA;    -&amp;gt;setTo('me@me.com')&#xA;    -&amp;gt;setSubject('hey')&#xA;    -&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting &lt;code&gt;The view file does not exist: /Users/stian/dev/site.com/vendor/craftcms/cms/src/mail/confirmation.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I correctly understand how to render a view for sending as an email, how can I correctly point to its location?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2019-01-20T17:50:28.800" Title="How to set view path for rendering email templates?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29199" PostTypeId="2" ParentId="29198" CreationDate="2019-01-20T17:08:53.177" Score="3" Body="&lt;p&gt;For anyone struggling with this, apparently this is one way of doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I struggled with this for quite some time before posting my original question, but regardless, sorry about that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, here it is.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;setViewPath('/path/to/templates/');&#xA;$body = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('confirmation.twig', ['orderId' =&amp;gt; $orderId, 'customerId' =&amp;gt; $customerId]);&#xA;Craft::$app-&amp;gt;mailer-&amp;gt;compose()&#xA;    -&amp;gt;setFrom(['me@me.com')&#xA;    -&amp;gt;setTo('me@me.com')&#xA;    -&amp;gt;setSubject('hey')&#xA;    -&amp;gt;setHtmlBody($body)&#xA;    -&amp;gt;send();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's probably a better way of doing this, but if you're working in multiple environments, you can do this in &lt;code&gt;general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'dev' =&amp;gt; [&#xA;    'templatePath' =&amp;gt; '/Users/stian/dev/site.com/templates/',&#xA;],&#xA;'staging' =&amp;gt; [&#xA;    'templatePath' =&amp;gt; '/Users/stian/dev/site.com/templates/',&#xA;],&#xA;etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then &lt;code&gt;Craft::$app-&amp;gt;setViewPath(Craft::$app-&amp;gt;config-&amp;gt;general-&amp;gt;templatePath)&lt;/code&gt; in your plugin/module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS! Will mark as answered once I'm allowed&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2019-01-20T17:50:28.800" LastActivityDate="2019-01-20T17:50:28.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29200" PostTypeId="1" AcceptedAnswerId="29211" CreationDate="2019-01-20T18:29:06.637" Score="1" ViewCount="119" Body="&lt;p&gt;I get this JSON error when trying to output content of a matrix block called proLinks using the Element API.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Call to a member function all() on null&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The code is as follows (I've shortened it and removed the other content, this is the only one that I can't get to work):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use craft\elements\Entry;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'discproj.json' =&amp;gt; function() {&#xA;      return [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'dPs'],&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;&#xA;          $linkBlocks = [];&#xA;          foreach ($entry-&amp;gt;proLinks-&amp;gt;all() as $block) {&#xA;            switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;              case 'external':&#xA;              $linkBlocks[] = [&#xA;                'externalTitle' =&amp;gt; $block-&amp;gt;externalTitle,&#xA;                'externalLink' =&amp;gt; $block-&amp;gt;externalLink,&#xA;              ];&#xA;              break;&#xA;            }&#xA;          }&#xA;&#xA;          return [&#xA;            'projectLinks' =&amp;gt; $linkBlocks,&#xA;          ];&#xA;        },&#xA;      ];&#xA;    },&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've looked at the other questions about this here, and they all seem to do things a little bit different from each other. I think I have the general structure, but there is obviously something missing.&lt;/p&gt;&#xA;" OwnerUserId="7195" LastActivityDate="2019-01-21T06:06:51.587" Title="Matrix block Element API call on null error" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29201" PostTypeId="1" AcceptedAnswerId="29209" CreationDate="2019-01-20T18:56:54.597" Score="2" ViewCount="300" Body="&lt;p&gt;I am a newbie to CraftCMS and just installed my very first Craft Project on local Xampp. Everything looks good except the &quot;&lt;strong&gt;Plugin Store&lt;/strong&gt;&quot; navigation menu is not showing up. Is there any trick or tweak to appear the default menu?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gqkcM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gqkcM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9284" LastActivityDate="2019-01-21T05:45:08.263" Title="Missing &quot;Plugin Store&quot; navigation on Craft 3 admin section" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;menu&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29202" PostTypeId="2" ParentId="26506" CreationDate="2019-01-20T19:21:47.177" Score="1" Body="&lt;p&gt;I learned in &lt;a href=&quot;https://craftcms.stackexchange.com/questions/14516/how-to-add-a-custom-button-at-the-right-section-of-an-entry&quot;&gt;this ticket&lt;/a&gt; that you can do this with &lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook()&lt;/code&gt; in your plugin's &lt;code&gt;init()&lt;/code&gt; method.  It won't put the button in the top near the &quot;Share&quot; button but rather in the sidebar under the settings.  Here's an example (you'll want to customize it to your liking):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook('cp.entries.edit.details', function(array &amp;amp;$context) {&#xA;&#xA;    $entry = $context['entry'];&#xA;&#xA;    if ((int)$entry-&amp;gt;sectionId === YOUR_SECTION_ID_HERE) {&#xA;&#xA;        $url = '/your/controller/action/url/';&#xA;&#xA;        return '&amp;lt;div class=&quot;meta&quot;&amp;gt;&amp;lt;a href=&quot;' . $url . '&quot; class=&quot;btn&quot;&amp;gt;My Button&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;';&#xA;    }&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2019-01-20T19:21:47.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29203" PostTypeId="1" CreationDate="2019-01-20T20:25:54.687" Score="1" ViewCount="332" Body="&lt;p&gt;I understand the implications of having a script tag in my redactor field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am importing approx. 5k articles in to a Redactor field, some of which have various  tags from embedded Podcasts, Twitter cards etc.. These are obviously getting stripped out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It's not possible for me to go through all of the entries and break out those embeds in to a Matrix style set etc..)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I &lt;strong&gt;need&lt;/strong&gt; to be able to edit the HTML Purifier config to allow these tags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;/config/htmlpurifier/config.json&lt;/code&gt; file looks like below but I am not having any luck.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;Core.AggressivelyRemoveScript&quot;: false,&#xA;    &quot;HTML.SafeScripting&quot;: [&quot;script&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And my Redactor config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;buttons&quot;: [&quot;formatting&quot;, &quot;bold&quot;, &quot;italic&quot;, &quot;unorderedlist&quot;, &quot;orderedlist&quot;, &quot;link&quot;, &quot;image&quot;, &quot;video&quot;, &quot;html&quot;],&#xA;  &quot;plugins&quot;: [&quot;fullscreen&quot;, &quot;video&quot;, &quot;clips&quot;, &quot;table&quot;],&#xA;  &quot;linkNewTab&quot;: true,&#xA;  &quot;toolbarFixed&quot;: true,&#xA;  &quot;allowedTags&quot;: [&quot;script&quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has any ever managed to get Script tags to work and can offer some guidance here? There's a few other Script related configs here &lt;a href=&quot;http://htmlpurifier.org/live/configdoc/plain.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://htmlpurifier.org/live/configdoc/plain.html&lt;/a&gt; I've tried all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of an embed in one of my imported articles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script src=&quot;https://www.buzzsprout.com/xxxxxxxxxxx&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&amp;gt;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've seen other questions similar to this but no real solution other than put script tags in plain text etc.. but this is not an option in this case. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4990" LastActivityDate="2019-01-20T20:25:54.687" Title="HTML Purifier Allow &lt;script" Tags="&lt;redactor&gt;&lt;config&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29204" PostTypeId="1" AcceptedAnswerId="29443" CreationDate="2019-01-21T00:07:46.980" Score="2" ViewCount="138" Body="&lt;p&gt;How do I check permission for editing entries belonging to a specific section?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try &lt;code&gt;{{currentUser.can('editEntries:'~entry.sectionId) }}&lt;/code&gt;, it returns false - and I am sure that &lt;code&gt;currentUser&lt;/code&gt; can edit entries from this section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;Its craft 3.1&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="57" LastEditDate="2019-02-08T00:45:04.673" LastActivityDate="2019-02-08T00:45:04.673" Title="Checking permission for editing entries from inside template" Tags="&lt;permissions&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29205" PostTypeId="2" ParentId="28623" CreationDate="2019-01-21T03:48:21.270" Score="0" Body="&lt;p&gt;Well, I figured out a way to do this. This works.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set file = variant.songFile.one() %}&#xA;{% if file %}&#xA;  &amp;lt;form method=&quot;post&quot; target=&quot;_blank&quot;&amp;gt;&#xA;    {{ getCsrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;assets/download-asset&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;assetId&quot; value=&quot;{{ file.id }}&quot; /&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Download&quot; /&amp;gt;&#xA;  &amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Courtesy of this old answer: &lt;a href=&quot;https://craftcms.stackexchange.com/a/22850&quot;&gt;https://craftcms.stackexchange.com/a/22850&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2019-01-21T03:48:21.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29206" PostTypeId="2" ParentId="28347" CreationDate="2019-01-21T05:31:51.787" Score="6" Body="&lt;p&gt;To answer your questions in regards to how they will fit with Freeform...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If what you mean by &lt;strong&gt;pre-populating fields with existing data&lt;/strong&gt; is being able to fill fields with data from other elements, Freeform can do this. It allows you to &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/fields-field-types.html#populating-fields-with-elements-predefined-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;populate fields with data from other Craft Elements or even common Predefined data&lt;/a&gt; included with Freeform such as States, Months, Date ranges, number ranges, etc. If what you mean is that you'd like a submitted form to retain its existing data when there's an error upon submitting the form, it can do that as well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Forms can be duplicated&lt;/strong&gt; in Freeform.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have &lt;strong&gt;full control over your &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/formatting-templates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;template formatting&lt;/a&gt;&lt;/strong&gt; in Freeform. You can use one of the &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/templating-extras/formatting-template-examples.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;default formatting templates included with Freeform&lt;/a&gt; (preset for popular frameworks), use one as a starting point and adjust as necessary, or completely customize your own thing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The best choice here would be to use Freeform's built-in &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/fields-field-types.html#table&quot; rel=&quot;nofollow noreferrer&quot;&gt;Table field&lt;/a&gt;, which allows you to collect and handle repeating data nicely.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freeform offers &lt;strong&gt;&lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/fields-field-types.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a wide variety of field types&lt;/a&gt;&lt;/strong&gt;, and included with them is the necessary validation for each.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/fields-field-types.html#file-upload&quot; rel=&quot;nofollow noreferrer&quot;&gt;File Upload fields&lt;/a&gt; are available with Freeform.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freeform's &lt;strong&gt;&lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/conditional-rules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Conditional Rules&lt;/a&gt; feature allows you to show/hide fields based on the contents or selection or check of other field(s)&lt;/strong&gt;. Included in this is also page jumping in &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/multi-page-forms.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;multi-page forms&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freeform offers &lt;strong&gt;5 different ways to send &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/overview/email-notifications.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;email notifications&lt;/a&gt;&lt;/strong&gt;, and you can have &lt;strong&gt;as many different types of email notification templates&lt;/strong&gt;, and &lt;strong&gt;customize them however you please&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It depends what you mean by &lt;em&gt;translatable&lt;/em&gt;, but &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/setup/translating.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeform forms can be translated&lt;/a&gt; with &lt;strong&gt;static translation files&lt;/strong&gt;. The CP itself is also translatable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freeform has what we believe is fairly &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;comprehensive documentation&lt;/a&gt;, and it's always getting better. And when questions or issues arise, you can always &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/support.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;contact us for help&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freeform is the most popular third party form plugin for Craft CMS, and it has &lt;strong&gt;a proven history of active development for years&lt;/strong&gt;. You can preview the meaty &lt;a href=&quot;https://docs.solspace.com/craft/freeform/v3/setup/changelog.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;changelog&lt;/a&gt; filled with countless feature additions, improvements and bug fixes. It's actively developed by &lt;a href=&quot;https://solspace.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace&lt;/a&gt;, which has been around and developing software for well over a decade. :)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="4496" LastEditDate="2019-11-07T14:27:57.530" LastActivityDate="2019-11-07T14:27:57.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29207" PostTypeId="2" ParentId="23157" CreationDate="2019-01-21T05:39:54.017" Score="1" Body="&lt;p&gt;Using the &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/fields-field-types.html#populating-fields-with-elements-predefined-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Element or Predefined Data feature in Freeform&lt;/a&gt;, you can easily setup options (from Craft Entries, States, Number ranges, etc) for when you're creating additional fields. If you're referring to custom data, if you've created the field through &lt;strong&gt;Freeform&lt;/strong&gt; -&gt; &lt;strong&gt;Fields&lt;/strong&gt; manager area with the options, you can also duplicate fields from there.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-21T05:39:54.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29208" PostTypeId="2" ParentId="21012" CreationDate="2019-01-21T05:44:48.453" Score="1" Body="&lt;p&gt;Freeform allows you to send &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#types-of-email-notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;email notifications 5 different ways&lt;/a&gt; (all of them each being able to have their own notification templates, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;strong&gt;&lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#types-of-email-notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Submitter Notifications&lt;/a&gt;&lt;/strong&gt; specifically, you would follow these instructions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Email notifications can be sent to the user submitting the form using the Email field type. This is often used to send an email confirmation for the user. To setup:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;In Field Editor (Freeform -&gt; Fields) or Composer Quick Field (Add New Field button at left), create a new field of the &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/fields-field-types.html#fields-email&quot; rel=&quot;nofollow noreferrer&quot;&gt;Email field type&lt;/a&gt;.&#xA;  In Composer interface for the form, drag that field into field layout.&lt;/li&gt;&#xA;  &lt;li&gt;Click on field inside field layout and look over to the Property Editor (right column).&lt;/li&gt;&#xA;  &lt;li&gt;Select and/or add an email template.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;When the form submitter enters their email address in this field, Freeform will use that email address to send the email notification to.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-21T05:44:48.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29209" PostTypeId="2" ParentId="29201" CreationDate="2019-01-21T05:45:08.263" Score="3" Body="&lt;p&gt;You need &lt;a href=&quot;https://craftcms.com/blog/craft-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3&lt;/a&gt; for that. Looks like you are on version 2.7.4&#xA;The link provided gives information about new features in version 3, among them being the Plugin store.&lt;/p&gt;&#xA;" OwnerUserId="7195" LastActivityDate="2019-01-21T05:45:08.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29210" PostTypeId="2" ParentId="28692" CreationDate="2019-01-21T05:56:30.100" Score="1" Body="&lt;p&gt;You can pass values from other Craft elements or from URL segments, etc to your Freeform forms. Specifically when using with the &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/fieldtype.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element fieldtype&lt;/a&gt;, when wanting to &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/template-objects/form.html#prop-custattr-returnurl&quot; rel=&quot;nofollow noreferrer&quot;&gt;override the return URL&lt;/a&gt;, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ form.renderTag({&#xA;  returnUrl: entry.thankyouUrl&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When wanting to &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/template-objects/form.html#prop-custattr-overridevalues&quot; rel=&quot;nofollow noreferrer&quot;&gt;override Freeform field data values or options&lt;/a&gt;, you can do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ form.renderTag({&#xA;   overrideValues: {&#xA;      hiddenFieldHandle: entry.id,&#xA;      stateSelect: &quot;AZ&quot;,&#xA;      availability: [&quot;tue&quot;, &quot;thu&quot;],&#xA;   }&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-21T05:56:30.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29211" PostTypeId="2" ParentId="29200" CreationDate="2019-01-21T05:58:42.503" Score="1" Body="&lt;p&gt;I figured it out. Not every entry uses the matrix block, the error appears when the script hits that empty/non-existing block (null) it can't go looking for something inside it. Adding a conditional around the foreach solves it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use craft\elements\Entry;&#xA;&#xA;return [&#xA;  'endpoints' =&amp;gt; [&#xA;    'discproj.json' =&amp;gt; function() {&#xA;      return [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; ['section' =&amp;gt; 'dPs'],&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;&#xA;          $linkBlocks = null;&#xA;          if ($entry-&amp;gt;proLinks) {&#xA;            foreach ($entry-&amp;gt;proLinks-&amp;gt;all() as $block) {&#xA;              switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                case 'external':&#xA;                $linkBlocks[] = [&#xA;                  'externalTitle' =&amp;gt; $block-&amp;gt;externalTitle,&#xA;                  'externalLink' =&amp;gt; $block-&amp;gt;externalLink,&#xA;                ];&#xA;                break;&#xA;              }&#xA;            }&#xA;          }&#xA;&#xA;          return [&#xA;            'projectLinks' =&amp;gt; $linkBlocks,&#xA;          ];&#xA;        },&#xA;      ];&#xA;    },&#xA;  ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7195" LastEditorUserId="7195" LastEditDate="2019-01-21T06:06:51.587" LastActivityDate="2019-01-21T06:06:51.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29212" PostTypeId="2" ParentId="25579" CreationDate="2019-01-21T06:02:30.177" Score="1" Body="&lt;p&gt;Freeform allows you to &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;send email notifications 5 different ways&lt;/a&gt; (all of them each being able to have their own notification templates, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For setting up &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#admin-notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Admin Notifications&lt;/a&gt; specifically, follow these instructions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Email notifications can be sent to one or more admin email addresses. To setup:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;In Composer interface for the form, click on the Admin Notifications (envelope icon) tab at the top right.&lt;/li&gt;&#xA;  &lt;li&gt;Select and/or add an email template.&lt;/li&gt;&#xA;  &lt;li&gt;Specify admin email address(es) in the text area below. Separated multiples by line breaks only.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As for actually choosing between database-based notifications or HTML file-based notifications, setting them up, etc, you can &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#overview-of-email-notification-template-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out the documentation here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-01-21T06:02:30.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29214" PostTypeId="1" CreationDate="2019-01-21T13:47:41.907" Score="1" ViewCount="68" Body="&lt;p&gt;I have a channel (handle: &quot;infopages&quot;) with entries.&#xA;I have a channel (handle: &quot;products&quot;) with entries.&#xA;I have a category (handle: &quot;productTypes&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every entry from &quot;infopages&quot; has a category field, called &quot;relatedCat&quot;. Every entry from &quot;products&quot; has a category field, called &quot;relatedCat&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the template for the infopages, I want to show all entries from &quot;products&quot; that share the same category. So if an infopage is related to the category &quot;robotmowers&quot;, I want to show all the entries from &quot;products&quot; that are also related to &quot;robotmowers&quot;. Every entry in every channel can be related to multiple categories, that's where the hard part comes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could loop through the &quot;relatedCat&quot; field and get all the related entries from &quot;products&quot; in a loop. However, if multiple categories are selected, that means I possible get the same product entry more than once. I guess there must be a better way to do this?&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2019-02-21T17:02:15.413" Title="Get entries related to same category" Tags="&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29215" PostTypeId="1" CreationDate="2019-01-21T13:54:44.087" Score="1" ViewCount="46" Body="&lt;p&gt;As the question states. Is it possible to reset the focal point in the CMS?&#xA;I cannot see any obvious setting? &#xA;If not could this perhaps be a feature request for a reset focal point button?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2019-01-25T11:26:17.143" Title="Is there a way to reset the focal point in Craft?" Tags="&lt;assets&gt;&lt;image&gt;&lt;focal-point&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29216" PostTypeId="1" CreationDate="2019-01-21T14:02:19.443" Score="4" ViewCount="1911" Body="&lt;p&gt;I'm in a multi config env, local, staging &amp;amp; production. I sync my databases down to local then usually update locally, then push to staging and check again before going live.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recent 3.1 updates aren't working for me.&#xA;Usually, I go thru the control panel and all is fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I get the below. Minor issues for plugins I can usually sort out but how do I solve this one?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Composer output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- craftcms/vue-asset 1.0.2 requires craftcms/cms ~3.0.0-beta.1 -&amp;gt; satisfiable by craftcms/cms[3.0.37, 3.0.36, 3.0.35, 3.0.34, 3.0.33, 3.0.32, 3.0.31, 3.0.30.2, 3.0.30.1, 3.0.30, 3.0.29, 3.0.28, 3.0.27.1, 3.0.27, 3.0.26, 3.0.26.1, 3.0.25, 3.0.24, 3.0.19, 3.0.23.1, 3.0.23, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-beta.3, 3.0.0-beta.4, 3.0.0-beta.5, 3.0.0-beta.6, 3.0.0-beta.7, 3.0.0-beta.8, 3.0.0-beta.9, 3.0.0-beta.10, 3.0.0-beta.11, 3.0.0-beta.12, 3.0.0-beta.13, 3.0.0-beta.14, 3.0.0-beta.15, 3.0.0-beta.16, 3.0.0-beta.17, 3.0.0-beta.18, 3.0.0-beta.19, 3.0.0-beta.20, 3.0.0-beta.21, 3.0.0-beta.22, 3.0.0-beta.23, 3.0.0-beta.24, 3.0.0-beta.25, 3.0.0-beta.26, 3.0.0-beta.27, 3.0.0-beta.28, 3.0.0-beta.29, 3.0.0-beta.30, 3.0.0-beta.31, 3.0.0-beta.32, 3.0.0-beta.33, 3.0.0-beta.34, 3.0.0-beta.35, 3.0.0-beta.36, 3.0.0-RC1, 3.0.0-RC2, 3.0.0-RC3, 3.0.0-RC4, 3.0.0-RC5, 3.0.0-RC6, 3.0.0-RC7, 3.0.0-RC7.1, 3.0.0-RC8, 3.0.0-RC9, 3.0.0-RC10, 3.0.0-RC10.1, 3.0.0-RC11, 3.0.0-RC12, 3.0.0-RC13, 3.0.0-RC14, 3.0.0-RC15, 3.0.0-RC16, 3.0.0-RC16.1, 3.0.0-RC17, 3.0.0-RC17.1, 3.0.0, 3.0.0.1, 3.0.0.2, 3.0.1, 3.0.2, 3.0.3, 3.0.3.1, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.0.10, 3.0.10.1, 3.0.10.2, 3.0.10.3, 3.0.11, 3.0.12, 3.0.13, 3.0.13.1, 3.0.13.2, 3.0.14, 3.0.15, 3.0.16, 3.0.16.1, 3.0.17, 3.0.17.1, 3.0.18, 3.0.20, 3.0.21, 3.0.22] but these conflict with your requirements or minimum-stability.&#xA;- craftcms/vue-asset 1.0.2 requires craftcms/cms ~3.0.0-beta.1 -&amp;gt; satisfiable by craftcms/cms[3.0.37, 3.0.36, 3.0.35, 3.0.34, 3.0.33, 3.0.32, 3.0.31, 3.0.30.2, 3.0.30.1, 3.0.30, 3.0.29, 3.0.28, 3.0.27.1, 3.0.27, 3.0.26, 3.0.26.1, 3.0.25, 3.0.24, 3.0.19, 3.0.23.1, 3.0.23, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-beta.3, 3.0.0-beta.4, 3.0.0-beta.5, 3.0.0-beta.6, 3.0.0-beta.7, 3.0.0-beta.8, 3.0.0-beta.9, 3.0.0-beta.10, 3.0.0-beta.11, 3.0.0-beta.12, 3.0.0-beta.13, 3.0.0-beta.14, 3.0.0-beta.15, 3.0.0-beta.16, 3.0.0-beta.17, 3.0.0-beta.18, 3.0.0-beta.19, 3.0.0-beta.20, 3.0.0-beta.21, 3.0.0-beta.22, 3.0.0-beta.23, 3.0.0-beta.24, 3.0.0-beta.25, 3.0.0-beta.26, 3.0.0-beta.27, 3.0.0-beta.28, 3.0.0-beta.29, 3.0.0-beta.30, 3.0.0-beta.31, 3.0.0-beta.32, 3.0.0-beta.33, 3.0.0-beta.34, 3.0.0-beta.35, 3.0.0-beta.36, 3.0.0-RC1, 3.0.0-RC2, 3.0.0-RC3, 3.0.0-RC4, 3.0.0-RC5, 3.0.0-RC6, 3.0.0-RC7, 3.0.0-RC7.1, 3.0.0-RC8, 3.0.0-RC9, 3.0.0-RC10, 3.0.0-RC10.1, 3.0.0-RC11, 3.0.0-RC12, 3.0.0-RC13, 3.0.0-RC14, 3.0.0-RC15, 3.0.0-RC16, 3.0.0-RC16.1, 3.0.0-RC17, 3.0.0-RC17.1, 3.0.0, 3.0.0.1, 3.0.0.2, 3.0.1, 3.0.2, 3.0.3, 3.0.3.1, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.0.10, 3.0.10.1, 3.0.10.2, 3.0.10.3, 3.0.11, 3.0.12, 3.0.13, 3.0.13.1, 3.0.13.2, 3.0.14, 3.0.15, 3.0.16, 3.0.16.1, 3.0.17, 3.0.17.1, 3.0.18, 3.0.20, 3.0.21, 3.0.22] but these conflict with your requirements or minimum-stability.&#xA;- craftcms/vue-asset 1.0.2 requires craftcms/cms ~3.0.0-beta.1 -&amp;gt; satisfiable by craftcms/cms[3.0.37, 3.0.36, 3.0.35, 3.0.34, 3.0.33, 3.0.32, 3.0.31, 3.0.30.2, 3.0.30.1, 3.0.30, 3.0.29, 3.0.28, 3.0.27.1, 3.0.27, 3.0.26, 3.0.26.1, 3.0.25, 3.0.24, 3.0.19, 3.0.23.1, 3.0.23, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-beta.3, 3.0.0-beta.4, 3.0.0-beta.5, 3.0.0-beta.6, 3.0.0-beta.7, 3.0.0-beta.8, 3.0.0-beta.9, 3.0.0-beta.10, 3.0.0-beta.11, 3.0.0-beta.12, 3.0.0-beta.13, 3.0.0-beta.14, 3.0.0-beta.15, 3.0.0-beta.16, 3.0.0-beta.17, 3.0.0-beta.18, 3.0.0-beta.19, 3.0.0-beta.20, 3.0.0-beta.21, 3.0.0-beta.22, 3.0.0-beta.23, 3.0.0-beta.24, 3.0.0-beta.25, 3.0.0-beta.26, 3.0.0-beta.27, 3.0.0-beta.28, 3.0.0-beta.29, 3.0.0-beta.30, 3.0.0-beta.31, 3.0.0-beta.32, 3.0.0-beta.33, 3.0.0-beta.34, 3.0.0-beta.35, 3.0.0-beta.36, 3.0.0-RC1, 3.0.0-RC2, 3.0.0-RC3, 3.0.0-RC4, 3.0.0-RC5, 3.0.0-RC6, 3.0.0-RC7, 3.0.0-RC7.1, 3.0.0-RC8, 3.0.0-RC9, 3.0.0-RC10, 3.0.0-RC10.1, 3.0.0-RC11, 3.0.0-RC12, 3.0.0-RC13, 3.0.0-RC14, 3.0.0-RC15, 3.0.0-RC16, 3.0.0-RC16.1, 3.0.0-RC17, 3.0.0-RC17.1, 3.0.0, 3.0.0.1, 3.0.0.2, 3.0.1, 3.0.2, 3.0.3, 3.0.3.1, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.0.10, 3.0.10.1, 3.0.10.2, 3.0.10.3, 3.0.11, 3.0.12, 3.0.13, 3.0.13.1, 3.0.13.2, 3.0.14, 3.0.15, 3.0.16, 3.0.16.1, 3.0.17, 3.0.17.1, 3.0.18, 3.0.20, 3.0.21, 3.0.22] but these conflict with your requirements or minimum-stability.&#xA;- Installation request for craftcms/vue-asset 1.0.2 -&amp;gt; satisfiable by craftcms/vue-asset[1.0.2].&#xA;&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Composer file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;  &quot;keywords&quot;: [&#xA;    &quot;craft&quot;,&#xA;    &quot;cms&quot;,&#xA;    &quot;craftcms&quot;,&#xA;    &quot;project&quot;&#xA;  ],&#xA;  &quot;license&quot;: &quot;MIT&quot;,&#xA;  &quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;  &quot;type&quot;: &quot;project&quot;,&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;    &quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;    &quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;    &quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;    &quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;    &quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.0.33&quot;,&#xA;    &quot;superbig/craft3-mobiledetect&quot;: &quot;1.0.1&quot;,&#xA;    &quot;pennebaker/craft-architect&quot;: &quot;2.2.11&quot;,&#xA;    &quot;mikestecker/craft-readability&quot;: &quot;1.0.4&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.1.6&quot;,&#xA;    &quot;verbb/feed-me&quot;: &quot;3.0.0&quot;,&#xA;    &quot;verbb/redactor-tweaks&quot;: &quot;2.0.1&quot;,&#xA;    &quot;solspace/craft3-freeform-pro&quot;: &quot;2.5.3&quot;,&#xA;    &quot;nystudio107/craft-typogrify&quot;: &quot;1.1.16&quot;,&#xA;    &quot;rias/craft-position-fieldtype&quot;: &quot;1.0.14&quot;,&#xA;    &quot;svenjungnickel/redactor-font-awesome&quot;: &quot;2.0.4&quot;,&#xA;    &quot;dolphiq/iconpicker&quot;: &quot;1.0.5&quot;,&#xA;    &quot;verbb/super-table&quot;: &quot;2.0.14&quot;,&#xA;    &quot;superbig/craft3-templateselect&quot;: &quot;2.0.0&quot;,&#xA;    &quot;charliedev/section-field&quot;: &quot;1.1.0&quot;,&#xA;    &quot;dukt/facebook&quot;: &quot;2.0.1&quot;,&#xA;    &quot;joomkit/pdfthumbnailer&quot;: &quot;1.0&quot;,&#xA;    &quot;craftcms/guest-entries&quot;: &quot;2.1.3&quot;,&#xA;    &quot;nystudio107/craft-fastcgicachebust&quot;: &quot;1.0.8&quot;,&#xA;    &quot;studioespresso/craft-splashingimages&quot;: &quot;1.1.0&quot;,&#xA;    &quot;solspace/craft3-freeform&quot;: &quot;2.5.3&quot;,&#xA;    &quot;balazscsaba2006/cookiebot&quot;: &quot;1.0.6&quot;,&#xA;    &quot;nystudio107/craft-seomatic&quot;: &quot;3.1.38&quot;,&#xA;    &quot;aws/aws-sdk-php&quot;: &quot;3.63.1&quot;,&#xA;    &quot;bower-asset/bootstrap&quot;: &quot;v3.3.7&quot;,&#xA;    &quot;bower-asset/inputmask&quot;: &quot;3.3.11&quot;,&#xA;    &quot;bower-asset/jquery&quot;: &quot;3.2.1&quot;,&#xA;    &quot;bower-asset/punycode&quot;: &quot;v1.3.2&quot;,&#xA;    &quot;bower-asset/yii2-pjax&quot;: &quot;2.0.7.1&quot;,&#xA;    &quot;cakephp/core&quot;: &quot;3.6.7&quot;,&#xA;    &quot;cakephp/utility&quot;: &quot;3.6.7&quot;,&#xA;    &quot;craftcms/vue-asset&quot;: &quot;1.0.2&quot;,&#xA;    &quot;firebase/php-jwt&quot;: &quot;v5.0.0&quot;,&#xA;    &quot;google/auth&quot;: &quot;v1.3.0&quot;,&#xA;    &quot;google/cloud&quot;: &quot;v0.71.0&quot;,&#xA;    &quot;google/gax&quot;: &quot;0.34.0&quot;,&#xA;    &quot;google/protobuf&quot;: &quot;v3.6.0.1&quot;,&#xA;    &quot;grpc/grpc&quot;: &quot;1.13.0&quot;,&#xA;    &quot;hashids/hashids&quot;: &quot;2.0.4&quot;,&#xA;    &quot;hughbertd/oauth2-unsplash&quot;: &quot;1.0.3&quot;,&#xA;    &quot;imageoptim/imageoptim&quot;: &quot;^1.3&quot;,&#xA;    &quot;jakeasmith/http_build_url&quot;: &quot;1.0.1&quot;,&#xA;    &quot;kraken-io/kraken-php&quot;: &quot;1.6&quot;,&#xA;    &quot;ksubileau/color-thief-php&quot;: &quot;v1.3.1&quot;,&#xA;    &quot;league/csv&quot;: &quot;8.2.3&quot;,&#xA;    &quot;league/oauth2-facebook&quot;: &quot;2.0.1&quot;,&#xA;    &quot;masterminds/html5&quot;: &quot;2.3.0&quot;,&#xA;    &quot;michelf/php-smartypants&quot;: &quot;1.8.1&quot;,&#xA;    &quot;mobiledetect/mobiledetectlib&quot;: &quot;2.8.32&quot;,&#xA;    &quot;monolog/monolog&quot;: &quot;1.23.0&quot;,&#xA;    &quot;mtdowling/jmespath.php&quot;: &quot;2.4.0&quot;,&#xA;    &quot;mundschenk-at/php-typography&quot;: &quot;v6.1.5&quot;,&#xA;    &quot;nesbot/carbon&quot;: &quot;1.32.0&quot;,&#xA;    &quot;phenx/php-font-lib&quot;: &quot;0.5.1&quot;,&#xA;    &quot;php-science/textrank&quot;: &quot;1.0.4&quot;,&#xA;    &quot;pixel418/markdownify&quot;: &quot;v2.1.11&quot;,&#xA;    &quot;psr/cache&quot;: &quot;1.0.1&quot;,&#xA;    &quot;ralouphie/mimey&quot;: &quot;1.0.8&quot;,&#xA;    &quot;ramsey/uuid&quot;: &quot;3.7.3&quot;,&#xA;    &quot;rize/uri-template&quot;: &quot;0.3.2&quot;,&#xA;    &quot;sunra/php-simple-html-dom-parser&quot;: &quot;v1.5.2&quot;,&#xA;    &quot;symfony/inflector&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/polyfill-php70&quot;: &quot;v1.8.0&quot;,&#xA;    &quot;symfony/property-access&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;symfony/translation&quot;: &quot;v3.3.6&quot;,&#xA;    &quot;tinify/tinify&quot;: &quot;1.5.2&quot;,&#xA;    &quot;unsplash/unsplash&quot;: &quot;2.4.3&quot;,&#xA;    &quot;aelvan/imager&quot;: &quot;v2.1.2&quot;,&#xA;    &quot;craftcms/element-api&quot;: &quot;^2.5&quot;,&#xA;    &quot;nerds-and-company/schematic&quot;: &quot;4.1.0&quot;&#xA;  },&#xA;  &quot;repositories&quot;: [&#xA;    {&#xA;      &quot;type&quot;: &quot;composer&quot;,&#xA;      &quot;url&quot;: &quot;https://asset-packagist.org&quot;&#xA;    },&#xA;    {&#xA;      &quot;type&quot;: &quot;path&quot;,&#xA;      &quot;url&quot;: &quot;plugins/joomkit/pdfthumbnailer/&quot;&#xA;    }&#xA;  ],&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@composer dump-autoload -o&quot;,&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="4052" LastEditDate="2019-01-21T17:07:51.907" LastActivityDate="2019-01-24T13:27:36.597" Title="Can't update to 3.1.x" Tags="&lt;updates&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29217" PostTypeId="1" CreationDate="2019-01-21T16:09:20.957" Score="1" ViewCount="151" Body="&lt;p&gt;Not sure if this is related to Craft 3.1.x, but since I ran that update this afternoon, I can't update details of my Site anymore. If I go to Settings &gt; Sites and try to update anything in there (like changing @siteUrl to @web), I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Getting unknown property: craft\records\SiteGroup::craft\errors\SiteNotFoundException&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eah6K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eah6K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="642" LastActivityDate="2019-06-21T09:02:35.273" Title="3.1.x SiteNotFoundException" Tags="&lt;craft3&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29218" PostTypeId="1" AcceptedAnswerId="29219" CreationDate="2019-01-21T16:17:20.447" Score="1" ViewCount="289" Body="&lt;p&gt;Currently working on an e-commerce site, which currently has over 4000 products with a mass of variants (averaging 3 variants per product) - and hit a few hurdles on the way...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present, craft.products.hasVariant({hasSales: true}) takes over 4 minutes to return the data of items on sale. And again running a product count against the brand (category) is a similar issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I understand the sheer amount of queries for the above is getting a little ridiculous around 300 are showing in the Logs each time this is run - so running these queries from twig is next to impossible with the overheads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now turned to use a plugin with a public function in order to try and ease the pressure from the front end...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone any ideas on how get the same results with a craft\db\Query...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this makes sense...&lt;/p&gt;&#xA;" OwnerUserId="9194" LastActivityDate="2019-01-24T22:29:21.227" Title="DB Queries in Craft Commerce 2 with large data" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29219" PostTypeId="2" ParentId="29218" CreationDate="2019-01-21T16:53:23.133" Score="1" Body="&lt;p&gt;Have you considered the &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API plugin&lt;/a&gt; as a in-between solution? I don’t know how it managed to take less ressources (if so) - or which data you need to use/search - but we use this plugin to search in large entries selection (not 4K, but still) and it works well.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-01-21T16:53:23.133" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29220" PostTypeId="2" ParentId="29086" CreationDate="2019-01-21T17:41:02.997" Score="3" Body="&lt;p&gt;You can create a feed-me.php file under your /config directory, then you can configure the data delimiter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    '*' =&amp;gt; [&#xA;        'pluginName' =&amp;gt; 'Feed Me',&#xA;        'dataDelimiter' =&amp;gt; '-|-',&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On my side, that is not working all the time (if almost never), but the doc says it should! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/get-started/configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://verbb.io/craft-plugins/feed-me/docs/get-started/configuration&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://github.com/verbb/feed-me/issues/449&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/feed-me/issues/449&lt;/a&gt;  ---&gt; created just now)&lt;/p&gt;&#xA;" OwnerUserId="8516" LastActivityDate="2019-01-21T17:41:02.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29221" PostTypeId="1" AcceptedAnswerId="29224" CreationDate="2019-01-21T18:22:15.813" Score="2" ViewCount="513" Body="&lt;p&gt;I'm trying to augment a Commerce query with additional parameters like so, but I can't get 'colour' and 'range' working together. Clearly my and/relatedTo syntax is wrong but how exactly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set colour = craft.app.request.getQueryParam('colour') ?? null %}&#xA;  {% set range = craft.app.request.getQueryParam('range') ?? null %}&#xA;&#xA;  {% set query = {&#xA;    type: 'fabric',&#xA;    limit: 999,&#xA;    orderBy: 'defaultSku asc'&#xA;  } %}&#xA;&#xA;  {% set query = colour is defined ? query|merge({ relatedTo: ['and', { targetElement: craft.categories.slug(colour) }]}) : query %}&#xA;&#xA;  {% set query = range is defined ? query|merge({ relatedTo: ['and', { targetElement: craft.categories.slug(range) }]}) : query %}&#xA;&#xA;  {% set swatches = craft.products(query).all() %}&#xA;  {% for swatch in swatches %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Also need to add further queries params for texture etc which are also related to categories)&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2019-02-21T10:02:55.620" Title="How to merge multiple 'relatedTo' queries via query parameters" Tags="&lt;craft3&gt;&lt;elementcriteriamodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29223" PostTypeId="1" AcceptedAnswerId="29317" CreationDate="2019-01-22T08:35:06.220" Score="1" ViewCount="684" Body="&lt;p&gt;I'm experienced in Yii2 framework, but I just discovered Craft CMS and I already love it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use to develop Yii 2 modules using their own DB tables, models, controllers and views.&lt;br&gt;&#xA;I usually use Yii extensions and widgets from Krajee (&lt;a href=&quot;http://demos.krajee.com/widgets&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://demos.krajee.com/widgets&lt;/a&gt;) for the frontend, to create rather complex forms.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to integrate such modules and widgets in some pages of a Craft-managed website, using Craft for user management/access control and templating if possible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which structure would you recommend ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I keep a separate instance of Yii 2 on the same server ?  If so, how can I integrate Yii2 views (PHP code) in Twig templates (no PHP) ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I redevelop Craft modules or plugins using Twig ?  If so, how can I integrate Yii 2 frontend widgets and extensions in Twig templates and Craft CMS modules ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your advice.&lt;/p&gt;&#xA;" OwnerUserId="9288" LastActivityDate="2019-01-30T13:37:20.047" Title="Integrating Yii 2 modules and frontend widgets with Craft CMS 3" Tags="&lt;modules&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29224" PostTypeId="2" ParentId="29221" CreationDate="2019-01-22T09:55:11.717" Score="2" Body="&lt;p&gt;I figured it out with help from &lt;a href=&quot;https://craftcms.stackexchange.com/a/5339/7356&quot;&gt;https://craftcms.stackexchange.com/a/5339/7356&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could probably be further refined but...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# Get query parameters from URL #}&#xA;  {% set colour = craft.app.request.getQueryParam('colour') ?? null %}&#xA;  {% set range = craft.app.request.getQueryParam('range') ?? null %}&#xA;  {% set texture = craft.app.request.getQueryParam('texture') ?? null %}&#xA;&#xA;  {# Tee up the product query #}&#xA;  {% set queryParams = [colour, range, texture] %}&#xA;  {% set hasValidQueryParams = false %}&#xA;  {% set relationParam = ['and'] %}&#xA;  {% set query = {&#xA;    type: 'fabric',&#xA;    limit: 999,&#xA;    orderBy: 'defaultSku asc'&#xA;  } %}&#xA;&#xA;  {# Store any valid query parameters #}&#xA;  {% for param in queryParams %}&#xA;    {% if param != null %}&#xA;      {% set hasValidQueryParams = true %}&#xA;      {% set relationParam = relationParam|merge([{targetElement: craft.categories.slug(param) }]) %}&#xA;    {% endif %}&#xA;  {% endfor %}&#xA;&#xA;  {# Merge query parameters into the main product query  #}&#xA;  {% if hasValidQueryParams %}&#xA;    {% set query = query|merge({relatedTo: relationParam}) %}&#xA;  {% endif %}&#xA;&#xA;  {# Display the result  #}&#xA;  {% set swatches = craft.products(query).all() %}&#xA;  {% for swatch in swatches %}&#xA;    {% include 'range/_fabric_swatch' with { 'visible': true } %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2019-01-22T09:55:11.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29225" PostTypeId="2" ParentId="29216" CreationDate="2019-01-22T10:57:54.620" Score="1" Body="&lt;p&gt;Solved:&#xA;removed   &quot;craftcms/vue-asset&quot;: &quot;1.0.2&quot;&#xA;and changed craftcms version number.&#xA;I also had to manually change a few required items as phpstorm seemed to be reverting their versions creating more problems&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-01-22T10:57:54.620" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29226" PostTypeId="2" ParentId="4756" CreationDate="2019-01-22T11:22:30.350" Score="1" Body="&lt;p&gt;May be because Craft CMS uses &lt;code&gt;gulp&lt;/code&gt; for compiling the SASS and js and minimizes it ultimately. So you need too follow some steps,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1).&lt;/strong&gt;  Install &lt;code&gt;gulp&lt;/code&gt; locally or globally(recomended),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get install gulp -g&lt;/code&gt; or &lt;code&gt;sudo npm install gulp --save&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2).&lt;/strong&gt; Need to run and make build everytime you change the CSS or JS files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;gulp build&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3).&lt;/strong&gt; Or optionally &lt;code&gt;gulp&lt;/code&gt; can track all the changes real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;gulp watch&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hope this will help you.&lt;/p&gt;&#xA;" OwnerUserId="9290" LastActivityDate="2019-01-22T11:22:30.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29227" PostTypeId="1" CreationDate="2019-01-22T13:25:17.470" Score="1" ViewCount="28" Body="&lt;p&gt;I've created my first Craft3 plugin and installed it locally via a composer.json path. After doing the &lt;code&gt;composer require&lt;/code&gt;, the plugin showed up as installed (with a green dot) under Admin-&gt;Settings-&gt;Plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the plugin has the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$plugins=Craft::$app-&amp;gt;plugins-&amp;gt;getAllPluginInfo();&#xA;error_log('We have version '.$this-&amp;gt;getVersion().' and handle '.$this-&amp;gt;getHandle());&#xA;$plugin=Craft::$app-&amp;gt;plugins-&amp;gt;getPlugin($this-&amp;gt;getHandle());&#xA;if ($plugin==null) {&#xA;     error_log('Could not find self');&#xA;} else {&#xA;     error_log('Fond self with version: '.$plugin-&amp;gt;getVersion());&#xA;}&#xA;/* @var PluginInterface $plugin */&#xA;foreach ($plugins as $plugin) {&#xA;     error_log(json_encode($plugin));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;calling any page and then checking &lt;code&gt;storage/logs/phperrors.log&lt;/code&gt; shows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;22-Jan-2019 13:18:52 Europe/London] We have version 1.0.0 and handle craft-project-name&#xA;[22-Jan-2019 13:18:52 Europe/London] Could not find self&#xA;...&#xA;[22-Jan-2019 13:18:52 Europe/London] {&#xA;&quot;developer&quot;:&quot;myname&quot;,&#xA;&quot;developerUrl&quot;:&quot;https:\/\/www.example.com&quot;,&#xA;&quot;description&quot;:&quot;Example plugin&quot;,&#xA;&quot;documentationUrl&quot;:&quot;https:\/\/www.example.com&quot;,&#xA;&quot;class&quot;:&quot;rbairwell\\craftprojectname\\Plugin&quot;,&#xA;&quot;basePath&quot;:&quot;\/Applications\/Dev\/craftcms\/craft-project-name\/src&quot;,&#xA;&quot;aliases&quot;:{&quot;@rbairwell\/craftprojectname&quot;:&quot;\/Applications\/Dev\/craftcms\/vendor\/rbairwell\/craft-project-name\/src&quot;},&#xA;&quot;name&quot;:&quot;Craft Project Name&quot;,&#xA;&quot;version&quot;:&quot;1.0.0&quot;,&#xA;&quot;sourceLanguage&quot;:&quot;en-US&quot;,&#xA;&quot;hasCpSection&quot;:false,&#xA;&quot;packageName&quot;:&quot;rbairwell\/craft-project-name&quot;,&#xA;&quot;isInstalled&quot;:true,&#xA;&quot;isEnabled&quot;:false,&#xA;&quot;moduleId&quot;:&quot;craft-project-name&quot;,&#xA;&quot;edition&quot;:&quot;standard&quot;,&#xA;&quot;hasMultipleEditions&quot;:false,&#xA;&quot;hasCpSettings&quot;:false,&#xA;&quot;licenseKey&quot;:null,&#xA;&quot;licenseKeyStatus&quot;:&quot;unknown&quot;,&#xA;&quot;licensedEdition&quot;:null,&#xA;&quot;licenseIssues&quot;:[],&#xA;&quot;isTrial&quot;:false,&#xA;&quot;upgradeAvailable&quot;:false}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is the plugin unable to find itself using &lt;code&gt;getPlugin&lt;/code&gt; even though it's confirm it's handle name and why, in the list of plugins does it come up &lt;code&gt;isEnabled: false&lt;/code&gt; even though the admin front end shows it as installed+enabled and obviously the plugin is functioning?&lt;/p&gt;&#xA;" OwnerUserId="9291" LastActivityDate="2019-01-22T15:58:45.810" Title="Plugin not fully registered/enabled" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29228" PostTypeId="1" CreationDate="2019-01-22T13:46:44.207" Score="1" ViewCount="626" Body="&lt;p&gt;I use subdomains for staging environments. That meant in Craft 2 I had to move the public_html folder content up a level and change&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = '../craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$craftPath = 'craft';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting myself in a bit of a mess how to do this for Craft 3. I've moved the contents of 'web' into the root folder for the subdomain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have to change these settings&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__));&#xA;define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it's a bit over my head, so any help to what I change these to would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My hosting doesn't allow configuring the webserver to point to the /web folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Structure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;li&gt;css&lt;/li&gt;&#xA;&lt;li&gt;js&lt;/li&gt;&#xA;&lt;li&gt;craftcms&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;config&lt;/li&gt;&#xA;&lt;li&gt;modules&lt;/li&gt;&#xA;&lt;li&gt;storage&lt;/li&gt;&#xA;&lt;li&gt;templates&lt;/li&gt;&#xA;&lt;li&gt;vendor&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2019-01-22T18:39:23.103" LastActivityDate="2019-01-23T11:19:01.850" Title="Web folder content moved up a level - Craft Path settings" Tags="&lt;craft3&gt;&lt;config&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29229" PostTypeId="1" AcceptedAnswerId="29243" CreationDate="2019-01-22T14:34:32.643" Score="1" ViewCount="678" Body="&lt;p&gt;So, the subject.&#xA;I am currently working with customer of craftcms v2.&#xA;I am setting up Structure Section where I want to add Entry Type for index listing of items and add some items in list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here is my setup:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Section: &lt;a href=&quot;https://imgur.com/a/afXBU4M&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/afXBU4M&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Section EntryType: &lt;a href=&quot;https://imgur.com/a/ugkEkGh&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/ugkEkGh&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Field Settings tab: &lt;a href=&quot;https://imgur.com/a/efAe0Kp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/efAe0Kp&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Field Layout tab: &lt;a href=&quot;https://imgur.com/a/4FuZcAZ&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/4FuZcAZ&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Entry Example: &lt;a href=&quot;https://imgur.com/a/KIxOdbO&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/KIxOdbO&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have 3 Entries added.&#xA;I made this setup exactly the same as was for same page type (Structure Section too). But page I did throws error as in subject title.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've googled and found that the key for 'entry' object in template using is to check this option in Section settings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Entries in this section have their own URLs' &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found that in this article: &lt;a href=&quot;https://straightupcraft.com/articles/the-craft-entry-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://straightupcraft.com/articles/the-craft-entry-variable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what may be the problem? This option is checked. Also exactly the same page (called Features) works well! It's kind of magic I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple code in template raises the error: &lt;a href=&quot;https://pastebin.com/fjqeb1LT&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.com/fjqeb1LT&lt;/a&gt;&#xA;I am using template in 'app/craft/templates/reviews/index.twig' folder.&lt;/p&gt;&#xA;" OwnerUserId="9292" LastActivityDate="2019-01-23T10:17:38.877" Title="Variable &quot;entry&quot; does not exist in template at Structure Section" Tags="&lt;craft2&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29231" PostTypeId="2" ParentId="29228" CreationDate="2019-01-22T15:44:25.013" Score="2" Body="&lt;p&gt;To replicate what you did in craft 2, you would change your web/index.php to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__,1) . '/nameofthefolderwherecraftlives');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;,1&lt;/code&gt; tells craft to go up &lt;strong&gt;1&lt;/strong&gt; level and change &lt;code&gt;/nameofthefolderwherecraftlives&lt;/code&gt; to well... The name of the folder where craft lives :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for what I show you above, your structure will be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;web&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;nameofthefolderwherecraftlives&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;config&lt;/li&gt;&#xA;&lt;li&gt;modules&lt;/li&gt;&#xA;&lt;li&gt;storage&lt;/li&gt;&#xA;&lt;li&gt;templates&lt;/li&gt;&#xA;&lt;li&gt;vendor&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's &lt;a href=&quot;https://docs.craftcms.com/v3/config/php-constants.html#craft-base-path&quot; rel=&quot;nofollow noreferrer&quot;&gt;here in the docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-22T15:44:25.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29232" PostTypeId="2" ParentId="29227" CreationDate="2019-01-22T15:58:45.810" Score="1" Body="&lt;p&gt;You seem to have discrepancies in your naming. There is craft-project-name and craftprojectname in there. Could it be that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fix the naming and try to delete the plugin row in the database, composer remove it then re install..?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-22T15:58:45.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29233" PostTypeId="2" ParentId="29214" CreationDate="2019-01-22T16:29:27.587" Score="2" Body="&lt;p&gt;If you have infoPage with category A and B lets say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you have a &lt;strong&gt;Product 1&lt;/strong&gt; with category A and B also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If in your template you do (with &lt;code&gt;entry&lt;/code&gt; being the current infoPage entry):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedProducts = craft.entries.section('products').relatedTo(entry.relatedCat).all() %}&#xA;&#xA;{% for relatedProduct in relatedProducts %}&#xA;    {{ relatedProduct.title }} &amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should not get &lt;strong&gt;Product 1&lt;/strong&gt; returned to you twice..? Have you actually tried?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-22T16:36:33.623" LastActivityDate="2019-01-22T16:36:33.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29234" PostTypeId="2" ParentId="5313" CreationDate="2019-01-22T17:39:42.490" Score="2" Body="&lt;p&gt;Using &lt;code&gt;macro&lt;/code&gt; command you can replace the &lt;code&gt;set&lt;/code&gt; command, avoiding the disadvantage of long code every time you need to call a variable. I had the same need, and my solution is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parent template &quot;main.twig.html&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% import &quot;constants.twig&quot; as constants %}&#xA;var priceA = {{ constants.priceA }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Child template &quot;constants.twig&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro priceA () %}   15.10   {% endmacro %}&#xA;{% macro priceB () %}   26.20   {% endmacro %}&#xA;{% macro priceC () %}   30.40   {% endmacro %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is nice and simple to read AND short to write whenever you need to call a variable.&lt;/p&gt;&#xA;" OwnerUserId="9294" LastActivityDate="2019-01-22T17:39:42.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29235" PostTypeId="1" CreationDate="2019-01-22T17:40:25.733" Score="1" ViewCount="133" Body="&lt;p&gt;I've inherited an existing website created using CraftCMS and hosted on Fortrabbit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to CraftCMS but anxious to get started on a couple of updates. The site currently exists on Fortrabbit. I have SSH and SFTP access and can see the files and have a fresh version of CraftCMS locally installed but unsure how to bring in the files. I'm aware it's built on the server so just not sure what parts I need to bring locally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already grabbed and imported the DB to the MySQL content but just need this last step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="9293" LastEditorUserId="57" LastEditDate="2019-01-26T01:27:47.007" LastActivityDate="2019-01-26T01:28:12.403" Title="Importing Craft CMS Locally" Tags="&lt;install&gt;&lt;import&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29236" PostTypeId="1" CreationDate="2019-01-22T19:53:10.660" Score="1" ViewCount="165" Body="&lt;p&gt;I created a user group that has full permissions for User options in the CP, i.e. all the boxed ticked. However, they are not able to edit a user's email address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When changing the email field and clicking Save it asks for password as usual, accepts it and closes the user form. However, the email does not change and there is no error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I go in as Admin, it works fine, but not for any User Group, irrespective of the fact that their permissions include changing email addresses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible clue is that these users were migrated from an older site and the email addresses have not yet been confirmed. Any thoughts would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-01-23T23:58:08.150" Title="Editing User Email Address" Tags="&lt;emails&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29238" PostTypeId="1" CreationDate="2019-01-22T23:21:33.337" Score="1" ViewCount="24" Body="&lt;p&gt;I have 2 channels set up: &lt;strong&gt;Channel A&lt;/strong&gt; and &lt;strong&gt;Channel B&lt;/strong&gt;.  I also have public registration so users can log in and fill out two forms (&lt;strong&gt;Form A&lt;/strong&gt; and &lt;strong&gt;Form B&lt;/strong&gt;), each form creating an entry in their respective channel with the user as the author.  The user can only create an entry in Channel B if they already have an entry in Channel A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get all the users who have an entry in Channel A but not in Channel B, I tried writing something like this in my class:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getUsersWithoutChannelBEntry()&#xA;{&#xA;    $channel_A_entries = Entry::find()&#xA;        -&amp;gt;sectionId(1)&#xA;        -&amp;gt;all();&#xA;&#xA;    $userIds = [];&#xA;    foreach ($channel_A_entries as $entry) {&#xA;&#xA;        $channel_B_entry_exists = Entry::find()&#xA;            -&amp;gt;sectionId(2)&#xA;            -&amp;gt;authorId($entry-&amp;gt;authorId)&#xA;            -&amp;gt;exists();&#xA;&#xA;        if (! $channel_B_entry_exists) {&#xA;            $userIds[] = $entry-&amp;gt;authorId;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    return User::find()&#xA;        -&amp;gt;id($userIds)&#xA;        -&amp;gt;all();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this creates an N+1 problem. I have roughly 200 users, so potentially 200 entries in either channel, and thus a lot of db queries and a substantially larger load time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative approach, I've also tried looping through Channel A, adding each author ID into an array (Array A), then doing the same with Channel B making Array B.  Then I use &lt;code&gt;array_diff()&lt;/code&gt; to extract the author IDs that are in Array A but not in Array B.  However, this still causes a bit of long load time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked into eager loading, but that seems to only apply to related fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more efficient way to get all users who authored a Channel A entry but not Channel B entry?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2019-01-23T11:59:25.127" Title="Checking if user authored an entry in another channel while in loop, N+1 problem" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29239" PostTypeId="1" CreationDate="2019-01-22T23:41:36.277" Score="1" ViewCount="43" Body="&lt;p&gt;Does Craft provide a way to programmatically add a new multisite site through a plugin or module?&lt;/p&gt;&#xA;" OwnerUserId="414" LastActivityDate="2019-01-23T01:40:14.193" Title="Is it possible to create a new multisite site via a Craft Plugin/Module?" Tags="&lt;plugin-development&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29240" PostTypeId="2" ParentId="29239" CreationDate="2019-01-23T01:40:14.193" Score="1" Body="&lt;p&gt;You have access to the same APIs that Craft itself has; so sure, you could programmatically create new sites via a plugin or module.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-01-23T01:40:14.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29241" PostTypeId="1" AcceptedAnswerId="29245" CreationDate="2019-01-23T04:13:14.903" Score="1" ViewCount="72" Body="&lt;p&gt;I'm trying to install the Craft demo site on my local dev environment but I'm getting stuck trying to install Composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This command from the instructions didn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd happylager.test&#xA;composer install&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The I tried this command from the Composer website:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php -r &quot;copy('https://getcomposer.org/installer', 'composer-setup.php');&quot;&#xA;php -r &quot;if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;&quot;&#xA;php composer-setup.php&#xA;php -r &quot;unlink('composer-setup.php');&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried both as-is and putting it after the path to my directory first like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /path to directory&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the above command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It did seem to install a file named composer.phar but I'm not sure this is it, and moreover I don't have a vendor subfolder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing anything? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9295" LastActivityDate="2019-01-23T12:01:43.487" Title="Help installing demo site" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29242" PostTypeId="2" ParentId="29235" CreationDate="2019-01-23T08:28:59.110" Score="1" Body="&lt;p&gt;So having tried bringing it locally and getting a multitude of errors, I realized the live site was version 2 and I was installing version 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the upgrade guide solved it for me (among some minor plugin tweaks).&lt;/p&gt;&#xA;" OwnerUserId="9293" LastEditorUserId="57" LastEditDate="2019-01-26T01:28:12.403" LastActivityDate="2019-01-26T01:28:12.403" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29243" PostTypeId="2" ParentId="29229" CreationDate="2019-01-23T10:17:38.877" Score="2" Body="&lt;p&gt;That &lt;code&gt;entry&lt;/code&gt; variable will only be predefined for the template when you go to one of your entry’s URLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your section’s Entry URL Format for top-level entries is &lt;code&gt;{slug}&lt;/code&gt;, and your entry’s slug is &lt;code&gt;qweasdzxc&lt;/code&gt;, so that would make your entry’s URL &lt;code&gt;&amp;lt;site-url&amp;gt;/qweasdzxc&lt;/code&gt; (&lt;a href=&quot;http://localhost/qweasdzxc&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost/qweasdzxc&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change your section’s top-level Entry URL Format to &lt;code&gt;reviews/{slug}&lt;/code&gt; instead of just &lt;code&gt;{slug}&lt;/code&gt;, then the entry’s URL will become &lt;code&gt;&amp;lt;site-url&amp;gt;/reviews/qweasdzxc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you go to &lt;code&gt;&amp;lt;site-url&amp;gt;/reviews&lt;/code&gt;, you’re just accessing the &lt;code&gt;reviews/index.twig&lt;/code&gt; template directly, so the &lt;code&gt;entry&lt;/code&gt; variable was never defined, which is causing the error you’re getting.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-01-23T10:17:38.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29244" PostTypeId="2" ParentId="29228" CreationDate="2019-01-23T11:19:01.850" Score="1" Body="&lt;p&gt;Oh I see. Then if the root folder where your index.php lives is let's say &lt;code&gt;public_html&lt;/code&gt; you could do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__DIR__) . '/public_html/craftcms');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution would be to use &lt;code&gt;__FILE__&lt;/code&gt; instead of &lt;code&gt;__DIR__&lt;/code&gt; and you could do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;define('CRAFT_BASE_PATH', dirname(__FILE__) . '/craftcms');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't know the implications of the second option. It works for me when I test locally and doesn't break anything but I can't be sure... Maybe the Craft guys could tell us more on this..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway I hope this gets you up and running :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-23T11:19:01.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29245" PostTypeId="2" ParentId="29241" CreationDate="2019-01-23T11:42:42.003" Score="1" Body="&lt;p&gt;So If you still have everything on your machine, the thing going wrong here is the &lt;code&gt;composer install&lt;/code&gt; bit. It looks like you have installed composer locally inside the folder &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#globally&quot; rel=&quot;nofollow noreferrer&quot;&gt;but not globally&lt;/a&gt;. You have a file called &lt;code&gt;composer.phar&lt;/code&gt; inside you happylager.test folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way you have composer at the moment (locally), you cannot do &lt;code&gt;composer install&lt;/code&gt; in your terminal you have to do &lt;code&gt;php composer.phar install&lt;/code&gt; from within you happylager.test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should sort it for you and you will get the vendor folder from it. Then, simply follow the other steps to installing the demo. I strongly recommend you &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#globally&quot; rel=&quot;nofollow noreferrer&quot;&gt;install composer globally&lt;/a&gt; though, it'll be easier for you in the future :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-23T12:01:43.487" LastActivityDate="2019-01-23T12:01:43.487" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29246" PostTypeId="2" ParentId="29238" CreationDate="2019-01-23T11:59:25.127" Score="1" Body="&lt;p&gt;There's one bit missing in the constrains you explain above, do users end up with 1 entry &lt;strong&gt;only&lt;/strong&gt; per channel so a total of 2 posts max?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, we know that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;each users can have a max of 2 posts&lt;/li&gt;&#xA;&lt;li&gt;a user cannot post in B is they haven't completed their post in A&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So assuming this first condition is also true (2 entries/user) you could just loop through users post count looking for those with less than 2 posts and they would automatically be the users who haven't posted in B..? Just a shot in the dark :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-23T11:59:25.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29247" PostTypeId="1" CreationDate="2019-01-23T14:35:24.847" Score="1" ViewCount="41" Body="&lt;p&gt;In Commerce 1 i can select orders by a specific property as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Order');&#xA;$criteria['orderStatusId'] = 1;&#xA;return craft()-&amp;gt;elements-&amp;gt;getCriteria('Commerce_Order', $criteria);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can i do this in Commerce 2?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastActivityDate="2019-01-23T14:53:41.470" Title="Getting orders by property in Commerce 2 from Plugin" Tags="&lt;plugin-development&gt;&lt;elementcriteriamodel&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29248" PostTypeId="1" CreationDate="2019-01-23T14:44:40.390" Score="1" ViewCount="146" Body="&lt;p&gt;Am I completely stupid or have the e-mail settings been removed after an update?&#xA;I am searching for the text E-Mails they are sent if a new User is created, someone has his Passwort forgotten and so on… I am really sure that i saw this already but where?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="9131" LastActivityDate="2019-01-23T14:56:33.970" Title="Where are the E-Mail Templates?" Tags="&lt;craft3&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29249" PostTypeId="2" ParentId="29247" CreationDate="2019-01-23T14:53:41.470" Score="1" Body="&lt;pre&gt;&lt;code&gt;use craft\commerce\elements\Product;&#xA;&#xA;$products = Product::find()-&amp;gt;orderStatus(1)-&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-23T14:53:41.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29250" PostTypeId="2" ParentId="29248" CreationDate="2019-01-23T14:56:33.970" Score="3" Body="&lt;p&gt;These were moved to &quot;Utilities&quot; so they now have their own permission and users can have access to them without needing be have admin rights.&lt;/p&gt;&#xA;" OwnerUserId="5206" LastActivityDate="2019-01-23T14:56:33.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29251" PostTypeId="2" ParentId="29236" CreationDate="2019-01-23T23:58:08.150" Score="1" Body="&lt;p&gt;The &quot;verify user email&quot; setting will keep anyone other than the user or an Admin from changing an email address&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-01-23T23:58:08.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29252" PostTypeId="2" ParentId="29218" CreationDate="2019-01-24T10:26:11.420" Score="2" Body="&lt;p&gt;Okay for anyone who runs into issues with Craft Commerce and has large amounts of products (over 4K) with 8K's worth of variants...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to create a plugin and execute a function in the variables.php like so...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function getClearanceProductIds() {&#xA;      $rows = (new \craft\db\Query())&#xA;      -&amp;gt;select('craft_commerce_variants.productId')&#xA;      -&amp;gt;from('craft_commerce_sale_purchasables')&#xA;      -&amp;gt;join('JOIN','craft_commerce_variants','craft_commerce_variants.id = craft_commerce_sale_purchasables.purchasableId')&#xA;      -&amp;gt;where(array(&#xA;        'like',&#xA;        'craft_commerce_sale_purchasables.saleId',&#xA;        '2'&#xA;      ))&#xA;      -&amp;gt;column();&#xA;&#xA;      $rows = implode(&quot;,&quot;, $rows);&#xA;&#xA;      return $rows;&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then query the products in the normal way with the ids array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products   = craft.products.id(saleItems).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Otherwise, every your resources and CPU will overload by doing things the craft way i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set products = craft.products.hasVariant({hasSales: true}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps someone with a similar issue!&lt;/p&gt;&#xA;" OwnerUserId="9194" LastEditorUserId="9194" LastEditDate="2019-01-24T22:29:21.227" LastActivityDate="2019-01-24T22:29:21.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29253" PostTypeId="2" ParentId="29216" CreationDate="2019-01-24T13:07:19.423" Score="2" Body="&lt;p&gt;Have the same issue with upgrading. In my case, the package itself doesn't appear in my &lt;code&gt;composer.json&lt;/code&gt;. It does appear in my &lt;code&gt;composer.lock&lt;/code&gt; file thought. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Removing the &lt;code&gt;composer.lock&lt;/code&gt; and doing a fresh install fixed this issue for me. The package was a dependency for SEOmatic, but removing SEOmatic didn't remove it from my lock file.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2019-01-24T13:27:36.597" LastActivityDate="2019-01-24T13:27:36.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29254" PostTypeId="2" ParentId="28775" CreationDate="2019-01-24T15:25:46.183" Score="3" Body="&lt;p&gt;For Craft 3, there is &lt;a href=&quot;https://github.com/fruitstudios/craft-uploadit&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;UploadIt&lt;/strong&gt;&lt;/a&gt;, a  front end asset uploader.&lt;/p&gt;&#xA;" OwnerUserId="37" LastActivityDate="2019-01-24T15:25:46.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29256" PostTypeId="1" AcceptedAnswerId="29295" CreationDate="2019-01-24T16:43:26.300" Score="1" ViewCount="47" Body="&lt;p&gt;I build a plugin for Craft 2 which imports data from an excel file into craft commerce products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that it needs to import excels with like 10.0000 rows and 30 columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a simple page in the CP where they can upload the file and then view the progress inside of the tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running just 1 task was not good because if it crashes on the first row it just stops. I wanted to make some kind of batching with tasks so this s what I came up with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function startExcelImportTasks($fileName){&#xA;    $return = false;&#xA;    $dataObject = craft()-&amp;gt;myplugin_productsInfo-&amp;gt;getDataByExcelName($fileName);&#xA;    $grandTotal = count((array)$dataObject);&#xA;    $batchSize = 500;&#xA;    if ($grandTotal &amp;gt; 0) {&#xA;        for ($i=0; $i &amp;lt; $grandTotal; $i+=$batchSize) { &#xA;            $numberOfTasks = $batchSize;&#xA;            //if last loop set numberoftasks to total left&#xA;            if (($i + $batchSize) &amp;gt; $grandTotal){&#xA;                $numberOfTasks = $grandTotal - $i;&#xA;            }&#xA;            unset($dataObjectSlice, $dataObjectSliceString, $task);&#xA;            $dataObjectSlice = array_slice( $dataObject , $i , $numberOfTasks );&#xA;            $dataObjectSliceString = json_encode($dataObjectSlice);&#xA;            //create a task per batch&#xA;            $task = craft()-&amp;gt;tasks-&amp;gt;createTask('Myplugin_ImportExcel', 'Import excel - ('. $i . '-' . ($numberOfTasks + $i) .')', ['totalSteps' =&amp;gt; $numberOfTasks, 'offset' =&amp;gt; $i, 'grandTotal' =&amp;gt; $grandTotal, 'dataObject' =&amp;gt; $dataObjectSliceString]);&#xA;        }&#xA;        $return = true;&#xA;    }&#xA;    unset($dataObject,$grandTotal,$batchSize,$numberOfTasks,$dataObjectSlice,$dataObjectSliceString, $task);&#xA;    return $return;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this is all running very well, I get tasks split up by 500 rows. My problem is memory usage, I thought when a new task would start it would free up the memory of the previous task but when I log my memory usage with memory_get_usage(true) it does not reset after the first loop and just continues to build up loop after loop until it finally crashes. It then goes to the next step starting with all free memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to reset the memory for each loop? Loop 2 does not need to know ANYTHING that loop 1 needs since I slice the data and pass it to the right task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using some unsets in the code but that doesn't seem to do very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also came across some subtask posts but I do not think that will change anything? I also like that the batching is shown in different tasks in the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is welcome,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6857" LastEditorUserId="57" LastEditDate="2019-01-26T01:32:06.253" LastActivityDate="2019-01-29T13:09:09.740" Title="Lowering memory usage on task batches" Tags="&lt;plugin-development&gt;&lt;import&gt;&lt;tasks&gt;&lt;memory&gt;&lt;batch&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29257" PostTypeId="1" AcceptedAnswerId="29261" CreationDate="2019-01-24T17:14:01.243" Score="3" ViewCount="374" Body="&lt;p&gt;If not, how would you best approach this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For us, different sites have different categories, and also, not always the same number of categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, when we create a category, it gets created for all sites and only thing we can do is rename it on different sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we delete a category from one site, it gets deleted on all sites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only solution that I can think of at the moment, is to have all categories created on all sites. In backend, all categories would be visible and available on all sites. On frontend we would just display only those categories which have entries in them, per site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we are talking about a lot of categories here, it would be messy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any better solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3545" LastActivityDate="2020-05-01T14:46:52.917" Title="Is it possible to create category for only one site in a multisite setup?" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;multi-site&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29258" PostTypeId="1" CreationDate="2019-01-24T19:25:35.970" Score="1" ViewCount="112" Body="&lt;p&gt;&lt;strong&gt;Is it possible to submit checkbox array and text values on a front end form into a plaintext Craft field in Craft 3?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution worked in Craft 2 but it broke in Craft 3 due to some under the hood changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this matters, but I'm using Matrix entries to build the actual form in the template.  So the checkboxes and text form fields are being generated from the Matrix entries.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using fieldnames with brackets like &lt;code&gt;fields[logGeneral_logInputIndications][]&lt;/code&gt; to collect all of the values so they are appended and not overwritten (like it would be if I made it a single line text field.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of what is submitted to the Craft plaintext field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&quot;Cardiac Activity&quot;,&quot;Normal&quot;,&quot;Effusion&quot;,&quot;Small&quot;,&quot;No LV Function Assessment Performed&quot;,&quot;No RV Diameter Assessment Performed&quot;,&quot;No IVC Diameter Assessment Performed&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All of the items you see above like &quot;Cardiac Activity&quot;, &quot;Normal&quot;, etc. are all checkboxes or text form fields on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using fieldnames with brackets like &lt;code&gt;fields[logGeneral_logInputIndications][]&lt;/code&gt; to collect all of the values so they are appended and not overwritten (like it would be if I made it a single line text field.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Craft 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I submit the form in Craft 3, I get &lt;code&gt;trim() expects parameter 1 to be string, array given&lt;/code&gt; error because the form field I'm submitting like &lt;code&gt;fields[logGeneral_logInputIndications][]&lt;/code&gt; is an array but the Craft field the values are writing to is plaintext.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to merge the values without building a module?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2019-01-24T19:25:35.970" Title="Craft 3: Possible to merge checkbox and text values from a frontend form and put into a plaintext Craft field?" Tags="&lt;craft3&gt;&lt;matrix&gt;&lt;form&gt;&lt;frontend-form&gt;&lt;checkboxes&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29259" PostTypeId="1" CreationDate="2019-01-25T08:58:46.623" Score="1" ViewCount="213" Body="&lt;p&gt;I have 2 sites (fr and en), fr is default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;index.php&lt;/code&gt;, I have &lt;code&gt;define('CRAFT_SITE', 'fr')&lt;/code&gt; and &lt;code&gt;define('CRAFT_SITE', 'en')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In templates, I'm using &lt;code&gt;{{ 'Texte FR'|t }}&lt;/code&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;/craft/translations/en/site.php&lt;/code&gt;, I have my translation : &lt;code&gt;'Texte FR' =&amp;gt; 'Text EN'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I test the English version, it's OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I test the French version, English translations are displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remove translations folder, of course, it's OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add 'fr' folder in translations, Englishis  still displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to trace the choice of the translation file by Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find why ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank for help. :)&lt;/p&gt;&#xA;" OwnerUserId="6079" LastEditorUserId="57" LastEditDate="2019-01-26T01:35:16.507" LastActivityDate="2019-01-26T01:35:16.507" Title="Craft CMS 3 - Always load &quot;en&quot; translation file" Tags="&lt;craft3&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29260" PostTypeId="2" ParentId="29259" CreationDate="2019-01-25T09:37:23.297" Score="1" Body="&lt;p&gt;In Craft 3 the setup works a little bit different from the Craft 2 setup. You don't actually have to make changes to your &lt;code&gt;index.php&lt;/code&gt; to switch the languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The languages are defined on a Site base. The translation folder now lives in the root of your projects: &lt;code&gt;projectFolder/translations/fr/site.php&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of Craft 3.1, you can set the Base Url of each site to a variable in your &lt;code&gt;.env&lt;/code&gt; file and use that variable in the admin panel with the site setup. &lt;code&gt;@web&lt;/code&gt; as your Base URL doesn't work to properly detect what site you are on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, make two sites in the admin panel. Make two variables in your &lt;code&gt;.env&lt;/code&gt; file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SITE_URL_FR = '...'fr/'&#xA;SITE_URL_EN = '.../en/'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use those variables to set your Base Url in the sites config. You can target them with &lt;code&gt;$SITE_URL_FR&lt;/code&gt;. That should do the trick.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2019-01-25T09:51:55.877" LastActivityDate="2019-01-25T09:51:55.877" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="29261" PostTypeId="2" ParentId="29257" CreationDate="2019-01-25T10:58:20.280" Score="3" Body="&lt;p&gt;While this was originaly scheduled for Craft 3.2 (&lt;a href=&quot;https://github.com/craftcms/cms/issues/2122&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2122&lt;/a&gt;) this was not in the 3.2 release. Brandon mentioned on Discord (&lt;a href=&quot;https://discordapp.com/channels/456442477667418113/456442477667418115/575506608952442891?utm_campaign=Craft%2BLink%2BList&amp;amp;utm_medium=web&amp;amp;utm_source=Craft_Link_List_88&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;) that categories will be going away altogether in Craft 4.0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is his &lt;a href=&quot;https://i.imgur.com/opB7N7o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;comment&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;tags and categories are both going away in Craft 4.&#xA;  3.x (maybe as early as 3.2) will see a big update to Entries fields, where they will be able to behave more like current Categories and&#xA;  Tags fields, if desired and 4.0 will just convert all existing&#xA;  categories &amp;amp; tags over to entries&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So as it stand, I wouldn't use categories anymore and use structures instead.&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="10759" LastEditDate="2020-05-01T14:46:52.917" LastActivityDate="2020-05-01T14:46:52.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29262" PostTypeId="2" ParentId="29215" CreationDate="2019-01-25T11:26:17.143" Score="1" Body="&lt;p&gt;if you're referring to an image focal point then...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/26403/how-do-image-focal-points-work-in-craft-3&quot;&gt;How do image focal points work in Craft 3?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;help out somewhat...&lt;/p&gt;&#xA;" OwnerUserId="9194" LastActivityDate="2019-01-25T11:26:17.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29263" PostTypeId="1" CreationDate="2019-01-25T13:16:05.013" Score="1" ViewCount="51" Body="&lt;p&gt;Is there any possibility to use &quot;entry&quot; from the for-loop inside the &quot;main&quot; block inside another block (&quot;header&quot; in my case)? See example below:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;main&quot; %}&#xA;    {% block header %}&#xA;        {{ entry.id }}&#xA;    {% endblock %}&#xA;&#xA;{% block main %}&#xA;    {% for entry in craft.entries.section('blogPosts').limit(5).all() %}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9308" LastActivityDate="2019-01-25T16:08:37.833" Title="Passing variables between sibling blocks" Tags="&lt;templating&gt;&lt;entries&gt;&lt;craft3&gt;&lt;frontend&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29264" PostTypeId="1" CreationDate="2019-01-25T14:30:17.993" Score="1" ViewCount="213" Body="&lt;p&gt;Not sure of this is intentional or a bug but, when we add a route using Settings -&gt; Routes in the CMS, routes.php does not work. I guess maybe its due to us using a wildcard and this takes presedence over routes.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The route we needed to add in the CMS was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*/&amp;lt;teamid&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason we need a wildcard is because I don't want to hard code the page slug as this could be changed by a website administrator which would break functionality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added it in the CMS Routes because I can't find out how to add a wildcard in routes.php (perhaps worthy of another question as I would like that answer too!). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the meantime I have to use routes.php and hard code the slug URLs as follows for each locale:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'contact-us/&amp;lt;teamid&amp;gt;'         =&amp;gt; ['template' =&amp;gt; 'pages/index'],&#xA;'cysylltu-â-ni/&amp;lt;teamid&amp;gt;'         =&amp;gt; ['template' =&amp;gt; 'pages/index'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It would be great if I could either:&#xA;1) Use the CMS routes with this wildcard AND routes.php still works for all my others, or &#xA;2) Add a wildcard in routes.php (my preference)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-01-26T14:49:10.907" Title="When using Settings -&gt; Routes in the CMS with wildcard, routes.php does not work" Tags="&lt;routes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29265" PostTypeId="2" ParentId="29136" CreationDate="2019-01-25T15:27:21.843" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entriesInYear = craft.entries&#xA;    .section('agenda')&#xA;    .limit(null)&#xA;    . dateAndTime([&#xA;        'and',&#xA;        '&amp;gt;=' ~ year,&#xA;        '&amp;lt;' ~ (year + 1)&#xA;    ])&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-db-entryquery.html#method-before&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.before()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-db-entryquery.html#method-after&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;.after()&lt;/code&gt;&lt;/a&gt; methods are convenience methods that hide the complexity of the date query on Craft's &lt;code&gt;postDate&lt;/code&gt; field. They don't affect any other custom date fields like your &lt;code&gt;dateAndTime&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The array for your &lt;code&gt;dateAndTime&lt;/code&gt; field condition (in the above example) is more of a Yii Framework query thing where the optional &lt;code&gt;'and'&lt;/code&gt; operator in the first position means all of the following conditions must apply. If omitted, it's assumed to be &lt;code&gt;'or'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you prefer, the array can also be expressed as a string of comma-separated conditions like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.dateAndTime('and, &amp;gt;= ' ~ year ~ ', &amp;lt; ' ~ (year + 1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="593" LastEditorUserId="593" LastEditDate="2019-01-25T15:32:31.910" LastActivityDate="2019-01-25T15:32:31.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29266" PostTypeId="2" ParentId="29263" CreationDate="2019-01-25T15:56:28.477" Score="1" Body="&lt;p&gt;I don't understand what you want to achieve? In your example, the for loop would run 5 times so which &lt;code&gt;entry.id&lt;/code&gt; do you want to get out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to use common variables in both your blocks would be to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends &quot;main&quot; %}&#xA;{% set entries = craft.entries.section('blogPosts').limit(5).all() %}&#xA;&#xA;{% block header %}&#xA;    {% for entry in entries %}&#xA;        {# access entries in here #}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&#xA;{% block main %}&#xA;    {% for entry in entries %}&#xA;        {# and also in here #}&#xA;    {% endfor %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-25T15:56:28.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29267" PostTypeId="2" ParentId="29263" CreationDate="2019-01-25T16:08:37.833" Score="1" Body="&lt;p&gt;The &quot;entry&quot; variable used inside the loop is restricted to the loop only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a variable earlier in the process, outside the blocks, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set posts = craft.entries.section('blogPosts').limit(5).all() -%}&#xA;{%- extends &quot;main&quot; -%}&#xA;{%- block header -%}&#xA;    {%- for post in posts -%}&#xA;        {{- post.id -}}&#xA;    {%- endfor -%}&#xA;{%- endblock -%}&#xA;&#xA;{%- block main -%}&#xA;    {%- for post in posts -%}&#xA;    {%- endfor -%}&#xA;{%- endblock -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then loop through it where you need to.&lt;/p&gt;&#xA;" OwnerUserId="8516" LastActivityDate="2019-01-25T16:08:37.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29268" PostTypeId="1" CreationDate="2019-01-25T16:25:00.283" Score="1" ViewCount="507" Body="&lt;p&gt;I have a multi-site setup and toggled the primary site inside settings -&gt; sites to &quot;off&quot;. So now I don't have any primary site anymore and I get an error preventing me from accessing my admin page saying: &quot;craft\errors\SiteNotFoundException: No primary site exists in xyz&quot;. How can I redefine a primary site?&lt;/p&gt;&#xA;" OwnerUserId="9308" LastEditorUserId="9308" LastEditDate="2019-01-25T17:00:48.587" LastActivityDate="2019-08-21T18:45:48.247" Title="Set primary site" Tags="&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29269" PostTypeId="2" ParentId="29264" CreationDate="2019-01-25T17:10:01.443" Score="1" Body="&lt;p&gt;I don't know if it's great practice to do this but if you want a &quot;wildcard&quot;, especially as your first segment, you should a) put it in your &lt;code&gt;routes.php&lt;/code&gt; manually b) make it the &lt;strong&gt;last route&lt;/strong&gt; (always) otherwise it will take precedence just as you said and the other routes won't work. Also, using regex in your named parameters is good practice, if you are sure that &lt;code&gt;teamid&amp;gt;&lt;/code&gt; is always and only a number, you could do this &lt;code&gt;&amp;lt;teamid:\d+&amp;gt;&lt;/code&gt; so that someone visiting &lt;code&gt;contact-us/peanuts&lt;/code&gt; would get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as setting this catch all route you want, just use a named parameter again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'&amp;lt;anything&amp;gt;/&amp;lt;teamid:\d+&amp;gt;'         =&amp;gt; ['template' =&amp;gt; 'pages/index'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would have your catch all effect and will allow you to fetch the first segment if you need to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you expect a certain format for this first segment, in your template by calling &lt;code&gt;{{ anything }}&lt;/code&gt; you could do some sort of validation. Also you could use regular expression to narrow the possibilities down a bit... With this as is, &lt;code&gt;500shoes/54896&lt;/code&gt; would return your index page...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-26T14:49:10.907" LastActivityDate="2019-01-26T14:49:10.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29271" PostTypeId="1" CreationDate="2019-01-26T00:19:43.607" Score="1" ViewCount="79" Body="&lt;p&gt;I am working with a plugin and wish to return a value from it to the template that calls it.  In my plugin, there is an XML feed call, and I would like to pass a value(variable) from the plugin to the template that indicates whether there is any value for a particular XML query.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently am working with a Plugin Variable, which returns the XML output.&lt;br&gt;&#xA;How would I be able to return a second value to the template for a conditional 'display/don't display' value?  Would I need to set up a second class, apart from my main XML feed variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the basic layout of the plugin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;XmlFeedVariable.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;namespace Craft;&#xA;&#xA;class AiPaginationTestVariable&#xA;{&#xA;        public function AiPaginationTestVariable($optional = null)&#xA;        //the '$optional' in the function call passes to the xml call for the query&#xA;            {&#xA;            //performs XML call and string assembly here, then echo's to output&#xA;            //if there is no xml returned, I would like to do this:&#xA;            //$xml_return='no';&#xA;            //then have the template pick it up.&#xA;            }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6879" LastEditorUserId="57" LastEditDate="2019-01-26T06:21:18.583" LastActivityDate="2019-01-26T06:21:18.583" Title="Craft 2 - Returning Value in Variable from Plugin to Template" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;variable&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29272" PostTypeId="2" ParentId="29271" CreationDate="2019-01-26T05:58:25.033" Score="1" Body="&lt;p&gt;You're close, you don't necessarily need another class or function. Though you may want to change the function name to be a bit more clear, and you may want to move the heavy XML logic into a separate private method.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;class AiPaginationTestVariable&#xA;{&#xA;        public function getXml($params = null)&#xA;        {&#xA;            // Compile XML&#xA;            $xml = $this-&amp;gt;_compileXml($params);&#xA;&#xA;            // Return XML or false&#xA;            if ($xml) {&#xA;                return $xml;&#xA;            } else {&#xA;                return false;&#xA;            }&#xA;        }&#xA;&#xA;        private function _compileXml($params = null)&#xA;        {&#xA;            // Whatever it takes to compile XML&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then in your Twig template, you can do something like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set xml = craft.aiPaginationTest.getXml() %}&#xA;&#xA;{% if false == xml %}&#xA;    {# Handle no XML #}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This might not directly answer your question, but I hope it's enough to get  you back on track.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-01-26T05:58:25.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29273" PostTypeId="1" CreationDate="2019-01-26T08:33:13.660" Score="2" ViewCount="165" Body="&lt;p&gt;Unlike in Craft2, there doesn't seem to be a way in Craft3 for a plugin to automatically login a user after a password reset. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft2, a plugin could listen for &lt;code&gt;users.onSetPassword&lt;/code&gt; to determine when a user had reset their password, and then log the user in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Craft3 doesn't seem to raise any suitable event -- presumably if it did, it would be done in &lt;code&gt;UsersController-&amp;gt;actionSetPassword&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/set-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The documentation&lt;/a&gt; does state: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The setPasswordSuccessPath config setting designates where the user should be redirected to after they finish resetting their password (and get automatically logged-in).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, this bit about getting automatically logged in doesn't seem to apply when &lt;code&gt;setPasswordSuccessPath&lt;/code&gt; is set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something that I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="9310" LastActivityDate="2019-02-03T01:36:30.437" Title="Auto login user after password reset via a plugin in Craft3" Tags="&lt;craft3&gt;&lt;password&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29274" PostTypeId="2" ParentId="29268" CreationDate="2019-01-26T13:59:43.927" Score="1" Body="&lt;p&gt;Try to change the &lt;code&gt;primary&lt;/code&gt; field, from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt;, in the &lt;code&gt;craft_sites&lt;/code&gt; DB table.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-01-26T13:59:43.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29275" PostTypeId="2" ParentId="29264" CreationDate="2019-01-26T14:07:59.687" Score="1" Body="&lt;p&gt;Since you use the routes.php, I think you will not need any custom route in the control panel. On the other side, you'll need something stronger to avoid (as Olivier Bon said) catching anything before your teamID. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a Single, then no user will be able to change your page slug&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to keep it that way, add a rule in your template to look if the  param matches your target page (but the solution 1 is still better).&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-01-26T14:07:59.687" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="29276" PostTypeId="2" ParentId="29051" CreationDate="2019-01-26T15:24:01.180" Score="1" Body="&lt;p&gt;I had a similar issue where some queues would only run when I logged in via the control panel. The root cause is usually stalled or failed tasks, but I was able to get webhook tasks to run instantly by installing the &lt;a href=&quot;https://plugins.craftcms.com/async-queue&quot; rel=&quot;nofollow noreferrer&quot;&gt;AsyncQueue plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From their &lt;a href=&quot;https://github.com/ostark/craft-async-queue/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This plugin replaces Craft's default queue handler and moves queue execution to a non-blocking background process. The command craft queue/run gets executed right after you push a Job to the queue.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="93" LastActivityDate="2019-01-26T15:24:01.180" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29277" PostTypeId="1" CreationDate="2019-01-27T17:03:31.553" Score="1" ViewCount="125" Body="&lt;p&gt;Is it possible to get the english content on the, for example, Spanish site if the Text for the specific language is not defined yet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not mean a redirect! The English version should be displayed until the Spanish content has been inserted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if someone has a Idea! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9176" LastActivityDate="2019-01-30T10:41:06.320" Title="If other languages are not defined show english" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29279" PostTypeId="1" CreationDate="2019-01-27T17:58:48.130" Score="2" ViewCount="291" Body="&lt;p&gt;I carefully read the installation manual, read PHP and apache error logs, but I still don't know why it's failed.&lt;br&gt;&#xA;(&lt;strong&gt;Solution - Maximum execution time of 120 seconds is not enough&lt;/strong&gt;)&lt;br&gt;&#xA; - Windows 10 64&lt;br&gt;&#xA; - WAMP 3.1.7 64&lt;br&gt;&#xA; - Craft 3.0.37&lt;br&gt;&#xA; - PHP 7.2.14 with all ext&lt;br&gt;&#xA; - MySQL 5.7.24  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done to install:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) download Craft zip from official site&lt;br&gt;&#xA;2) create folder for Craft site in &quot;www&quot; directory in WAMP folder&lt;br&gt;&#xA;3) unpack Craft zip in that folder&lt;br&gt;&#xA;4) create virtual host with directory: &lt;code&gt;www/craft/web&lt;/code&gt; through WAMP virtualHost manager&lt;br&gt;&#xA;5) uncheck &quot;read-only&quot; box for .env, composer.json, composer.lock, config/license.key, storage/&lt;em&gt;, vendor/&lt;/em&gt;, web/cpresources/*&lt;br&gt;&#xA;6) manually set security key in .env&lt;br&gt;&#xA;7) create database with utf8 unicode general ci&lt;br&gt;&#xA;8) open &lt;a href=&quot;http://myHostName/index.php?p=admin/install&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://myHostName/index.php?p=admin/install&lt;/a&gt; in browser&lt;br&gt;&#xA;9) take steps in wizzard and start installation procces&lt;br&gt;&#xA;10) after a minute recieve this page&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QQsMn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QQsMn.png&quot; alt=&quot;error massage screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;11) Check WAMP apache-error, php-error, mysql logs and found no records&lt;br&gt;&#xA;12) check acces.log  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;::1 - - [28/Jan/2019:12:41:50 +0300] &quot;GET /index.php?p=admin/install HTTP/1.1&quot; 200 134469&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/49ee4f09/css/craft.css?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/79140749/selectize.css?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/49ee4f09/css/charts.css?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/5f5e13e4/install.css?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/19922aaf/d3.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/da22e3a5/element-resize-detector.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/2b68d36c/jquery.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/45bbaf3c/jquery.mobile-events.min.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:52 +0300] &quot;GET /cpresources/f7ebee0a/velocity.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/10721d1a/garnish.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/fee67a92/jquery-ui.min.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/7e624b4f/datepicker-ru.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/8f12d058/picturefill.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/3fd53370/jquery.payment.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/79140749/selectize.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/6dadc32d/jquery.fileupload.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/221c0e10/xregexp-all.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/f8dd2f28/fabric.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/49ee4f09/js/Craft.min.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/5f5e13e4/install.min.js?v=1548609540 HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:53 +0300] &quot;GET /cpresources/5f5e13e4/images/install-bg-1920.png HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:54 +0300] &quot;GET /cpresources/49ee4f09/images/spinner_big.gif HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:41:57 +0300] &quot;GET /cpresources/49ee4f09/fonts/Craft.woff HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:42:03 +0300] &quot;GET /cpresources/5f5e13e4/images/spinner_submit.gif HTTP/1.1&quot; 304 -&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:42:03 +0300] &quot;POST /index.php?p=admin/actions/install/validate-account HTTP/1.1&quot; 200 30&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:44:39 +0300] &quot;POST /index.php?p=admin/actions/install/validate-site HTTP/1.1&quot; 200 30&lt;br&gt;&#xA;  ::1 - - [28/Jan/2019:12:44:39 +0300] &quot;POST /index.php?p=admin/actions/install/install HTTP/1.1&quot; 500 598  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Database screenshot&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VMtwI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMtwI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to read or to do with this to fix this?&lt;/p&gt;&#xA;" OwnerUserId="9312" LastEditorUserId="9312" LastEditDate="2019-01-30T10:54:43.290" LastActivityDate="2019-01-30T10:54:43.290" Title="Craft install failed on WAMP" Tags="&lt;install&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="29280" PostTypeId="1" AcceptedAnswerId="29283" CreationDate="2019-01-27T22:06:57.787" Score="3" ViewCount="290" Body="&lt;p&gt;I just noticed I had to update some templates after updating to the latest Commerce version (2.0.2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one go about getting the method's rule description?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have it set up to apply a rule based on geographical shipping location (like contiguous US states / Hawaii and Alaska / Russia / World / Oceania)—but &lt;code&gt;{{ method.description }}&lt;/code&gt; from within &lt;code&gt;{% for handle, method in cart.availableShippingMethods %}&lt;/code&gt; breaks the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2019-01-28T00:01:01.990" LastActivityDate="2019-01-28T03:32:33.017" Title="Craft Commerce 2.0.2 Shipping Rule Names &amp; Descriptions—How?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29281" PostTypeId="2" ParentId="29176" CreationDate="2019-01-28T00:06:32.433" Score="1" Body="&lt;p&gt;&lt;code&gt;Commerce::getInstance()-&amp;gt;getShippingMethods()-&amp;gt;getAllShippingMethods();&lt;/code&gt; would be the functional equivilant of Commerce 1's&lt;code&gt;commerce_shippingMethods-&amp;gt;getAllCoreShippingMethods()&lt;/code&gt; since it returns the the shipping methods defined in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Commerce::getInstance()-&amp;gt;getShippingMethods()-&amp;gt;getAvailableShippingMethods();&lt;/code&gt; will return the shipping methods in the database as well as any 3rd party defined shipping methods.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-28T00:06:32.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29282" PostTypeId="2" ParentId="29280" CreationDate="2019-01-28T03:09:42.767" Score="4" Body="&lt;p&gt;You &lt;s&gt;have to &lt;/s&gt;can loop through the shipping rules for the shipping method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for handle, method in cart.availableShippingMethods %}&#xA;&#xA;  {% if method.shippingRules|length %}&#xA;    {% for shippingRule in method.shippingRules %}&#xA;      {{ shippingRule.name }}&#xA;      {{ shippingRule.description }}&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="217" LastEditorUserId="217" LastEditDate="2019-01-28T03:32:33.017" LastActivityDate="2019-01-28T03:32:33.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29283" PostTypeId="2" ParentId="29280" CreationDate="2019-01-28T03:11:37.793" Score="4" Body="&lt;p&gt;calling &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set methods = cart.availableShippingMethods %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is the same as calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set methods = craft.commerce.shippingMethods.getAvailableShippingMethods(cart) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the above returns an array of shipping method models, keyed by the shipping method handle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to get the matching rule for each available method&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for method in methods %}&#xA;{% set rule = method.getMatchingShippingRule(cart) %}&#xA;{% set price = method.getPriceForOrder(cart) %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-28T03:11:37.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29286" PostTypeId="1" CreationDate="2019-01-28T16:11:21.250" Score="1" ViewCount="1694" Body="&lt;p&gt;Trying to get entries between two dates and am getting: 'A hash key must be followed by a colon (:). Unexpected token &quot;operator&quot; of value &quot;~&quot; (&quot;punctuation&quot; expected with value &quot;:&quot;)' &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set posts = craft.entries({&#xA;    section: animal,&#xA;    orderBy: &quot;postDate&quot; })  %}&#xA;&#xA;&#xA;{% set puppyAnimals = posts({&#xA;    animalDateOfBirth: 'and',  &quot;&amp;gt;= &quot; ~ now|date , '&amp;lt;=' ~ now|date_modify('-1 year')|date })  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's Craft 3 so I may just have the syntax wrong.&lt;/p&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="57" LastEditDate="2019-01-30T02:35:05.343" LastActivityDate="2019-01-30T02:35:05.343" Title="A hash key must be followed by a colon (:) syntax error" Tags="&lt;entries&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29287" PostTypeId="1" AcceptedAnswerId="29296" CreationDate="2019-01-28T16:35:36.347" Score="1" ViewCount="40" Body="&lt;p&gt;I have strange issue and cannot find out the solution for that.&#xA;I have this field (matrix with some text values): &lt;a href=&quot;https://imgur.com/a/KaFXubJ&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/KaFXubJ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I have this entry: &lt;a href=&quot;https://imgur.com/a/cPMrGul&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/cPMrGul&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is how it rendered (it shows not value of fields but id of matrix block table): &lt;a href=&quot;https://imgur.com/a/SR3HgQZ&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/SR3HgQZ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how it looks like in template: &lt;a href=&quot;https://pastebin.com/viVbPLqj&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pastebin.com/viVbPLqj&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried multiple combinations but nothing was solution. Also other fields are works well (fields which not related to &quot;companyInformation&quot; matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what may I do wrong?&lt;/p&gt;&#xA;" OwnerUserId="9292" LastActivityDate="2019-01-29T18:59:42.663" Title="ID of matrix printed instead of value" Tags="&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29288" PostTypeId="2" ParentId="29286" CreationDate="2019-01-28T17:45:08.450" Score="3" Body="&lt;p&gt;You're nearly there! The &lt;code&gt;and&lt;/code&gt; query you’re building just needs to be declared as an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set puppyAnimals = craft.entries({&#xA;    section: 'animals',&#xA;    orderBy: 'postDate',&#xA;    animalDateOfBirth: ['and',  &quot;&amp;lt;= #{now | atom}&quot;, &quot;&amp;gt;= #{now | date_modify('-1 year') | atom}&quot;]&#xA;}).all()  %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The brackets around the value provided for &lt;code&gt;animalDateOfBirth&lt;/code&gt; was being interpreted as a single string, followed by a missing key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I also opted for Twig’s interpolation syntax to make the series of array elements a little clearer, and used the &lt;code&gt;atom&lt;/code&gt; filter to produce fully-qualified dates)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One more note: I switched the greater-than and less-than operators, as I suspect the query would have returned no results—(after today, but earlier than last year)! &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4169" LastEditorUserId="4169" LastEditDate="2019-01-29T21:59:29.523" LastActivityDate="2019-01-29T21:59:29.523" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29289" PostTypeId="1" AcceptedAnswerId="29533" CreationDate="2019-01-28T20:06:09.033" Score="2" ViewCount="578" Body="&lt;p&gt;I tried upgrading a Craft 3.0 installation to 3.1, and got the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;value of craft/web/Application::getIsLive() must be of type boolean, null returned&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Has anyone else run into this?  Does anyone know a fix?&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="57" LastEditDate="2019-01-30T02:24:51.403" LastActivityDate="2019-02-14T15:15:01.903" Title="Craft 3.1: value of craft/web/Application::getIsLive() must be of type boolean, null returned" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29291" PostTypeId="1" CreationDate="2019-01-29T09:48:11.243" Score="2" ViewCount="99" Body="&lt;p&gt;I'm currently trying to implement and understand how Subscriptions work on Commerce 2. I'm using Stripe API and have created the subscriptions on their CP. I've listed them on my shop page and added the form that goes to &quot;commerce/subscriptions/subscribe&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when i click on the submit button, the page is simply reloading itself without any error message. I've tried looking for any _POST response but not are found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me the correct flow please? I assume you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;List the subscriptions&lt;/li&gt;&#xA;&lt;li&gt;Submit the subscription with the subscription id (to commerce/subscriptions/subscribe)&lt;/li&gt;&#xA;&lt;li&gt;It checks for stored card details and if none found, presents the add card page&lt;/li&gt;&#xA;&lt;li&gt;Submits those details and processes returning result&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="9293" LastActivityDate="2019-01-29T09:48:11.243" Title="Commerce 2 Subscriptions (Using Stripe API)" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29292" PostTypeId="2" ParentId="29277" CreationDate="2019-01-29T10:07:52.343" Score="1" Body="&lt;p&gt;You could choose which value to translate your content into using the &lt;code&gt;|t($lang)&lt;/code&gt; filter based on some condition. You condition could be a lightswitch field on each entry saying whether it's been translated or not, or check if a content field is empty or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;set lang = entry.lang&#xA;&#xA;if entry.isTranslated == false {&#xA;   set lang = 'english'&#xA;}&#xA;&#xA;{{ content|t(lang) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2019-01-29T10:07:52.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29293" PostTypeId="1" AcceptedAnswerId="29299" CreationDate="2019-01-29T10:59:08.810" Score="4" ViewCount="3589" Body="&lt;p&gt;I just updated to Craft 3.1 and logged into the admin to make the required updates to the database and this all worked fine. However, when I use the new &lt;code&gt;./craft update&lt;/code&gt; CLI feature, it responds with &quot;Craft isn't installed yet&quot;, even though it's on a year old Craft project and just successfully updated to Craft 3.1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's not really any other messages to go on for this one. See below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qbntf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qbntf.png&quot; alt=&quot;Craft 3.1 update error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2020-03-16T15:30:26.750" Title="&quot;Craft isn't installed yet&quot; error after updating to Craft 3.1" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;composer&gt;&lt;cli&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29294" PostTypeId="1" AcceptedAnswerId="29306" CreationDate="2019-01-29T12:12:45.883" Score="1" ViewCount="289" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got an e-commerce site that I'm upgrading. I've upgraded to Craft 3 and can reach the CP and the home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This site is tightly integrated with Commerce 1. When I visit the plug-in page, Commerce is listed but &quot;missing&quot;. I've attempted to claim the license (using the license number listed on the plug-ins page) but the license number is not recognized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have any options other than purchasing a complete new license? Is there a way to use Commerce 1 with Craft 3?&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2019-01-29T23:44:55.600" Title="Upgrading Commerce 1 to Commerce 2" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29295" PostTypeId="2" ParentId="29256" CreationDate="2019-01-29T13:09:09.740" Score="1" Body="&lt;p&gt;Ok, update..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem of my high memory usage was caused by (I think the logging of) devmode.. When I set devmode to false the moment that hit 10+gig memory before now has 100mb of memory usage... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resetting memory on the different tasks that get initiated in the same function or as subtasks is not possible I guess?&lt;/p&gt;&#xA;" OwnerUserId="6857" LastActivityDate="2019-01-29T13:09:09.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29296" PostTypeId="2" ParentId="29287" CreationDate="2019-01-29T15:51:24.363" Score="1" Body="&lt;p&gt;Technically the data you're seeking are under the first matrix block (not the first data of your &lt;code&gt;.companyName&lt;/code&gt; - which is not valid)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedCaseStudy = reviewFeatured.relatedCaseStudy.first %}&#xA;{% set firstCompany = relatedCaseStudy.companyInformation.first %}&#xA;{{ firstCompany.companyName }}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: If you plan to have only one company, think about a &lt;a href=&quot;https://github.com/verbb/super-table&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt; field in 'static' mode (only one occurence).&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-01-29T18:59:42.663" LastActivityDate="2019-01-29T18:59:42.663" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29297" PostTypeId="1" CreationDate="2019-01-29T16:50:06.493" Score="2" ViewCount="319" Body="&lt;p&gt;I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just fine like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'endpoints' =&amp;gt; [&#xA;    'api/v1/release_years' =&amp;gt; function () {&#xA;    return [&#xA;        'class' =&amp;gt; EntryResource::class,&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'products',&#xA;            'orderBy' =&amp;gt; 'field_releaseDate',&#xA;            'where' =&amp;gt; 'field_releaseDate IS NOT NULL',&#xA;//          'groupBy' =&amp;gt; '????????'&#xA;        ],&#xA;        'transformer' =&amp;gt; function (Entry $entry) {&#xA;            return [$entry-&amp;gt;releaseDate-&amp;gt;format('Y')];&#xA;        },&#xA;        'pretty' =&amp;gt; true&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the minute I add a group clause to the criteria section, it fails. I've tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'groupBy' =&amp;gt; 'YEAR(field_relaseDate)'&#xA;&#xA;'groupBy' =&amp;gt; 'YEAR(relaseDate)'&#xA;&#xA;'groupBy' =&amp;gt; 'field_releaseDate.year'&#xA;&#xA;'groupBy' =&amp;gt; 'releaseDate.year'&#xA;&#xA;'group' =&amp;gt; 'YEAR(field_relaseDate)'&#xA;&#xA;'group' =&amp;gt; 'YEAR(relaseDate)'&#xA;&#xA;'group' =&amp;gt; 'field_releaseDate.year'&#xA;&#xA;'group' =&amp;gt; 'releaseDate.year'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas if this is even possible? Also does anyone know if you can return a single array from Element API instead of a multi-level array? This output seems a bit inefficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'data' = [&#xA;    [2010],&#xA;    [2011],&#xA;    [2012],&#xA;    [2013],&#xA;    [2014],&#xA;    [2015],&#xA;    [2016],&#xA;    [2017],&#xA;    [2018],&#xA;    [2019],&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would much prefer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'data' = [&#xA;    2011,&#xA;    2012,&#xA;    2013,&#xA;    2014,&#xA;    2015,&#xA;    2016,&#xA;    2017,&#xA;    2018,&#xA;    2019&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2019-01-29T16:50:06.493" Title="Group by Date Field in Element API Query" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;elementquery&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29298" PostTypeId="2" ParentId="29196" CreationDate="2019-01-29T17:17:19.123" Score="1" Body="&lt;p&gt;For the &quot;-1&quot; hater, it was actually a bug in the craft, &lt;a href=&quot;https://github.com/craftcms/cms/issues/3673&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8326" LastActivityDate="2019-01-29T17:17:19.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29299" PostTypeId="2" ParentId="29293" CreationDate="2019-01-29T18:59:41.220" Score="6" Body="&lt;p&gt;Have you tried running &lt;code&gt;./craft setup&lt;/code&gt; to double check if your setup is correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;./craft setup&lt;/code&gt; completes successfully &lt;code&gt;./craft&lt;/code&gt; should find the existing installation and complete any required setup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience, this is usually related to a non-default &lt;code&gt;/config/db.php&lt;/code&gt; or problematic &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Always do a backup before trying anything related to setup just to be on the safe side.&lt;/p&gt;&#xA;" OwnerUserId="5881" LastEditorUserId="5881" LastEditDate="2019-01-30T10:02:01.637" LastActivityDate="2019-01-30T10:02:01.637" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29300" PostTypeId="2" ParentId="11797" CreationDate="2019-01-29T19:34:30.053" Score="2" Body="&lt;p&gt;An addition on this, probably for later versions of Craft than @brandonkelly's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to be careful where Asset definitions are made in the CP - specifically, under Settings&gt;Assets&gt;Volumes&gt;yourAssetsName.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the default or practice at some point was to have urls of the form:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    @web/your/resource/path&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;however, as of Craft 3.1, a red-lettered advisory will appear, not to use @web alias here. Indeed, with the proper form, all will work as expected, and https will be used when appropriate:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    /your/resource/path&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works however you are accessing the url, even in CraftQL or element-api, because the path will always be root url-relative.&lt;/p&gt;&#xA;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2019-01-30T23:04:15.780" LastActivityDate="2019-01-30T23:04:15.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29301" PostTypeId="1" CreationDate="2019-01-29T19:53:46.197" Score="3" ViewCount="84" Body="&lt;p&gt;Craft version 3.1 introduced the &lt;a href=&quot;https://docs.craftcms.com/v3/project-config.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;project config&lt;/a&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation mentions &quot;plugins may not support it yet:&quot;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any plugins that are storing configuration settings outside of their main plugin settings will need to be updated to support the project config. So there may still be some cases where changes need to be manually made on each environment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there any way to know if a plugin for Craft 3 supports project config files?&lt;/p&gt;&#xA;" OwnerUserId="273" LastActivityDate="2019-01-29T19:53:46.197" Title="How do I know if a plugin supports Craft 3.1's project config?" Tags="&lt;plugins&gt;&lt;projectconfig&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29302" PostTypeId="2" ParentId="29301" CreationDate="2019-01-29T19:53:46.197" Score="2" Body="&lt;p&gt;The best I could find was searching thru a plugin's changelog in the &lt;a href=&quot;https://plugins.craftcms.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft Plugin Store&lt;/a&gt; for something like &quot;Added support for Craft 3.1 project config.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.craftcms.com/super-table#2.1.1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super Table version 2.1.1&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Added support for Craft 3.1 project config.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.craftcms.com/redactor#2.2.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Redactor version 2.2.0&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Redactor for Craft CMS now requires Craft 3.1.&lt;/li&gt;&#xA;&lt;li&gt;Improved Project Config compatibility.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="273" LastActivityDate="2019-01-29T19:53:46.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29303" PostTypeId="1" CreationDate="2019-01-29T21:00:59.737" Score="2" ViewCount="1347" Body="&lt;p&gt;I moved a Craft 3 site to a new server. The previous server was a plain vanilla Ubuntu 16 LTS LAMP stack. The new web server is a Bitnami Ubuntu 16 LTS with a LAP stack (no local MySQL). In the new environment I have setup the Craft 3 site to connect to the remote server via SSL. The SSL connection seems to be working fine, but I am getting the following error when I navigate to the site on the new server:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An Error occurred while handling another error:&lt;br&gt;&#xA;  craft\errors\SiteNotFoundException: No primary site exists in /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/services/Sites.php:422&lt;br&gt;&#xA;  Stack trace:&lt;br&gt;&#xA;      #0 /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/web/Request.php(1120): craft\services\Sites-&gt;getPrimarySite()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have tried adding a siteUrl setting in the general.php file, but that didn't help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas on how to fix this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9322" LastEditorUserId="6007" LastEditDate="2019-02-02T05:14:08.677" LastActivityDate="2020-10-12T09:51:42.593" Title="Moved Craft 3 site to new server and getting &quot;No primary site exists&quot; error" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29305" PostTypeId="1" CreationDate="2019-01-29T23:26:33.417" Score="1" ViewCount="469" Body="&lt;p&gt;I'm trying to find a way of using php's print_r to output the entries that were pulled from the entries in the database. I'm pretty much brand new to Craft cms coming from Laravel, so a common thing I've done in the past with querying the database is seeing what I got back by outputting my array using either print_r or laravel's dd($array) during testing for a sanity check. I can't seem to find an easy way of doing this in Craft. This is what I've tried so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set listItems = craft.entries().section('todoList').all() %}&#xA;&#xA;{{ listItems }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The {{ listItems }} of course gives the array to string conversion error when rendering the page, so I tried doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ listItems | join }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that only outputs the title of the entry. Thank you in advance for any help!&lt;/p&gt;&#xA;" OwnerUserId="9324" LastActivityDate="2019-01-30T02:38:14.223" Title="Trying to output contents of array" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29306" PostTypeId="2" ParentId="29294" CreationDate="2019-01-29T23:44:55.600" Score="1" Body="&lt;p&gt;You can not run Commerce 1 on Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commerce was completely re-written for Craft 3 compatibility.  Indeed the final release of Commerce 2 actually requires Craft 3.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, your license for Commerce 1 should work for Commerce 2 once you have that installed but note there is a lot more to upgrading sites to Craft 3/Commerce 2 than just installing the new versions - there are extensive changes needed to both - including template and fundamental changes to custom plugins if you have written any of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.craftcms.com/commerce/v2/changes-in-commerce-2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/changes-in-commerce-2.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="340" LastActivityDate="2019-01-29T23:44:55.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29307" PostTypeId="2" ParentId="29305" CreationDate="2019-01-30T00:13:20.327" Score="1" Body="&lt;p&gt;It looks like using &lt;code&gt;{{ dump(listItems) }}&lt;/code&gt; gave me enough to work with. I forgot to mention I had tried this before. It didn't work the last time, but I suspect I gave it an incompatible data type.&lt;/p&gt;&#xA;" OwnerUserId="9324" LastEditorUserId="57" LastEditDate="2019-01-30T02:38:14.223" LastActivityDate="2019-01-30T02:38:14.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29308" PostTypeId="2" ParentId="26273" CreationDate="2019-01-30T00:42:29.833" Score="3" Body="&lt;p&gt;As of 3.1.2 you can now index assets via the cli tool:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft index-assets/all &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft index-assets/one {handle}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2019-01-30T00:42:29.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29309" PostTypeId="2" ParentId="29289" CreationDate="2019-01-30T02:24:35.037" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;value of craft/web/Application::getIsLive() must be of type boolean, null returned&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you're getting that, then &lt;code&gt;$this-&amp;gt;getProjectConfig()-&amp;gt;get('system.live');&lt;/code&gt; (which is what that line is using), is returning something other than &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;, then some update along with the way in all of your attempts didn't complete correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you happen to have a 3.0.x database backup from before you started this available, then try restoring from that and attempting the update to 3.1 again noting any errors you might be receiving during the update process first.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-01-30T02:24:35.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29310" PostTypeId="2" ParentId="29277" CreationDate="2019-01-30T10:41:06.320" Score="0" Body="&lt;p&gt;I think it have something to do with &lt;code&gt;.handle('spanish')&lt;/code&gt; or &lt;code&gt;.siteId('2')&lt;/code&gt;. I tried it but seems to be more complicated than I thought.&lt;/p&gt;&#xA;" OwnerUserId="9131" LastActivityDate="2019-01-30T10:41:06.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29312" PostTypeId="1" AcceptedAnswerId="29316" CreationDate="2019-01-30T11:10:25.670" Score="5" ViewCount="2238" Body="&lt;p&gt;Love the new new project config functionality, but if there are changes that need to be synchronised the site essentially goes down until the changes are applied manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wondered if anyone had a simple way to programmatically apply the changes automatically when the site is deployed, via a webhook?&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2021-05-13T02:01:57.003" Title="Is there a way to apply project.yaml changes on deployment?" Tags="&lt;craft3&gt;&lt;projectconfig&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29313" PostTypeId="2" ParentId="28088" CreationDate="2019-01-30T11:35:09.887" Score="1" Body="&lt;p&gt;move these lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; RewriteEngine On&#xA;# Send would-be 404 requests to Craft&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]&#xA;RewriteRule (.+) index.php?p=$1 [QSA,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the end of the file&lt;/p&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2019-01-30T11:35:09.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29314" PostTypeId="1" AcceptedAnswerId="29315" CreationDate="2019-01-30T12:10:18.127" Score="1" ViewCount="773" Body="&lt;p&gt;I want entries in a specific PlainText field for a named group to be pre-filled with random content. I am aware of the &lt;a href=&quot;https://github.com/lukeyouell/craft-randomkeygenerator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/lukeyouell/craft-randomkeygenerator&lt;/a&gt; plugin and am aware that I could create my own field type, but I am intending to use jQuery to do this instead (which should be easier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://craftcms.stackexchange.com/questions/267/can-a%20-plugin-add-js-or-css-to-the-control-panel&quot;&gt;Can a plugin add JS or CSS to the control panel?&lt;/a&gt; describes how to do this in Craft 2 (I assume that the code works). My equivalent in Craft3 is... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyPlugin extends Plugin {&#xA;    if (Craft::$app-&amp;gt;request-&amp;gt;getIsCpRequest())&#xA;    {&#xA;      Craft::$app-&amp;gt;templates-&amp;gt;includeJs('alert(&quot;xxx&quot;)');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but $app-&gt;templates does not work. So is there a Craft3 equivalent of this line?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NB: I have already written a plugin that is adding a file volume (for encrypting files uploaded as Assets) so intend to add to that.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="6929" LastEditorUserId="57" LastEditDate="2019-01-30T21:35:22.470" LastActivityDate="2019-02-01T10:22:52.343" Title="Can a plugin add JS or CSS to the control panel in Craft 3?" Tags="&lt;plugins&gt;&lt;control-panel&gt;&lt;javascript&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29315" PostTypeId="2" ParentId="29314" CreationDate="2019-01-30T12:22:06.027" Score="3" Body="&lt;p&gt;You should be able to do this with &lt;a href=&quot;https://docs.craftcms.com/v3/extend/asset-bundles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Asset Bundles&lt;/a&gt;. Full documentation on this is &lt;a href=&quot;https://docs.craftcms.com/v3/extend/asset-bundles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-01-30T12:22:06.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29316" PostTypeId="2" ParentId="29312" CreationDate="2019-01-30T12:28:37.857" Score="10" Body="&lt;p&gt;You can create a script to use the craft executable to sync your project config file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft project-config/sync&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8850" LastActivityDate="2019-01-30T12:28:37.857" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29317" PostTypeId="2" ParentId="29223" CreationDate="2019-01-30T13:37:20.047" Score="1" Body="&lt;p&gt;If you go down the route of creating your own modules for craft/yii2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can register access from twig to PHP services in your modules &lt;code&gt;init()&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(CraftVariable::class, CraftVariable::EVENT_INIT, function(Event $e) {&#xA;&#xA;        $e-&amp;gt;sender-&amp;gt;set('phpaccess',services\yourService::class);&#xA;&#xA;&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Access functions within this service in twig with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% craft.phpaccess.yourfunctionname() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also return a twig template from your modules controller with some additional variables&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = $this-&amp;gt;getView();&#xA;$html = $view-&amp;gt;renderTemplate(&#xA;    '/_templatename.twig',&#xA;    [&#xA;        'additionalvar' =&amp;gt; $somephpvar&#xA;    ]&#xA;);&#xA;&#xA;return $html;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also if you havn't already seen the &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory&lt;/a&gt; utility, it does save a lot of time!&lt;/p&gt;&#xA;" OwnerUserId="8850" LastActivityDate="2019-01-30T13:37:20.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29318" PostTypeId="1" CreationDate="2019-01-30T14:22:56.727" Score="2" ViewCount="153" Body="&lt;p&gt;This worked fine last week when the site was in development:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% requirePermission 'editEntries:1' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We made the site live a few days ago. I dont know if its related, but when I now go to pages with this on, I am getting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HTTP 403 – Forbidden – yii\web\ForbiddenHttpException&#xA;User is not permitted to perform this action&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have doubled checked all settings, they are still the same. The logged in user getting this message is in a group that is allowed to editEntries for section 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-01-30T14:55:23.643" Title="Any reason why {% requirePermission 'editEntries:1' %} would stop working within the past week or so?" Tags="&lt;craft3&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29319" PostTypeId="2" ParentId="29303" CreationDate="2019-01-30T14:51:41.273" Score="3" Body="&lt;p&gt;I was able to resolve this issue by reimporting the database.&lt;/p&gt;&#xA;" OwnerUserId="9322" LastActivityDate="2019-01-30T14:51:41.273" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29320" PostTypeId="2" ParentId="29318" CreationDate="2019-01-30T14:55:23.643" Score="4" Body="&lt;p&gt;Assuming you've recently updated to Craft 3.1, if you look in your &lt;code&gt;userpermissions&lt;/code&gt; table you'll see that they're now lowercase and using UIDs rather than integer IDs, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;editentries:3bb69b06-3e65-4ae5-8d70-6c47c1a88fbe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only place I can find anything like this documented is in the &quot;Updating Plugins for Craft 3.1&quot; guide&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.com/guides/updating-plugins-for-craft-3-1#update-element-source-key-references&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/guides/updating-plugins-for-craft-3-1#update-element-source-key-references&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastActivityDate="2019-01-30T14:55:23.643" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29324" PostTypeId="1" CreationDate="2019-01-30T17:01:53.450" Score="1" ViewCount="39" Body="&lt;p&gt;When i use some kind of variable in url settings of section, it always uses default language version of this variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, blog has two languages, english (default) and german. If i use these settings in URL settings for single post section, in german version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{{craft.entries.section('archive').one().uri}}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It returns english (default, not german) version o archive section uri.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it expected behaviour?&lt;/p&gt;&#xA;" OwnerUserId="8366" LastActivityDate="2019-01-30T19:15:27.090" Title="Using language specific variables inside section URL settings" Tags="&lt;localization&gt;&lt;url&gt;&lt;sections&gt;&lt;language&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29326" PostTypeId="1" AcceptedAnswerId="29327" CreationDate="2019-01-30T17:40:48.400" Score="1" ViewCount="38" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LzqTY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LzqTY.png&quot; alt=&quot;Screenshot of the Craft Control Panel, Entries section&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just started looking around the example project happy-lager, and I realised that on the Entries there's a bunch of columns displayed that I don't see on my company project (URI, Service Icon and some others in different Entries, such as background colour or image thumbnails). I didn't know this was possible, but it's great. How are those set? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI: Our project was updated from Craft 2, I don't know if this might be related.&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2019-01-30T18:20:47.033" Title="Where are all these columns coming from on the Entries in happy-lagger.test project?" Tags="&lt;craft3&gt;&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29327" PostTypeId="2" ParentId="29326" CreationDate="2019-01-30T18:20:47.033" Score="2" Body="&lt;p&gt;On every entry type (or even on the &quot;All entries&quot;) you can specify the columns visible in the Panel. Click on the cog at the bottom of the light-grey sidebar. You'll have access to all entry' fields!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magic of Craft ;)&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-01-30T18:20:47.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29328" PostTypeId="2" ParentId="29324" CreationDate="2019-01-30T19:15:27.090" Score="2" Body="&lt;p&gt;Maybe include the &lt;code&gt;.site&lt;/code&gt; in your query &lt;code&gt;craft.entries.section('archive').site('YOUR_SITE_HANDLE').one()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the section type of your &quot;Archive&quot; entry ? If its a single, maybe it will be more effective to write the handle down manually instead of doing a Query every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: You can also use &lt;code&gt;.siteId()&lt;/code&gt; instead of &lt;code&gt;.site()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-01-30T19:15:27.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29330" PostTypeId="1" CreationDate="2019-01-31T09:35:05.457" Score="1" ViewCount="132" Body="&lt;p&gt;I just noticed that I can't see my files if I go into the assets section.&#xA;An Error blinks up and says &quot;An unknown error occurred&quot;. In the front-end, I see every file and I can upload files to an asset too and see there uploaded files and selecting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log file says nothing. &#xA;I use for Image Transforms Imager without imgix.&lt;br&gt;&#xA;If i want to edit an Image i get a error too:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Getting unknown property: aelvan\imager\models\ConfigModel::imgixEnableAutoPurging&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It has always worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only imagine that an update has changed something?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help. Really big problem&lt;/p&gt;&#xA;" OwnerUserId="9131" LastEditorUserId="57" LastEditDate="2019-02-02T05:03:32.273" LastActivityDate="2019-02-02T05:03:32.273" Title="Assets are not loading anymore (maybe an update)" Tags="&lt;craft3&gt;&lt;assets&gt;&lt;error-message&gt;&lt;plugin-imager&gt;&lt;imagick&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29331" PostTypeId="2" ParentId="29330" CreationDate="2019-01-31T09:54:56.653" Score="1" Body="&lt;p&gt;Solved the complete error with a reset of the imager config file.&lt;/p&gt;&#xA;" OwnerUserId="9131" LastActivityDate="2019-01-31T09:54:56.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29332" PostTypeId="1" AcceptedAnswerId="29334" CreationDate="2019-01-31T10:16:13.547" Score="1" ViewCount="32" Body="&lt;p&gt;I am basically wondering where does this &lt;code&gt;section('services')&lt;/code&gt; is set up and how. &lt;a href=&quot;https://github.com/craftcms/demo/blob/3f224f1f2e260c3e18190b16420c2e661cbb35ee/templates/services/_entry.html#L22&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/demo/blob/3f224f1f2e260c3e18190b16420c2e661cbb35ee/templates/services/_entry.html#L22&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to loop through the collection entries on the &lt;code&gt;_index.html&lt;/code&gt; to display a small card for each one, but I don't know how to reach them from the index.&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2019-01-31T12:55:57.003" Title="How can I loop through a collection in the index file?" Tags="&lt;craft3&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29334" PostTypeId="2" ParentId="29332" CreationDate="2019-01-31T12:25:57.020" Score="3" Body="&lt;p&gt;To set up a section (or check the one you are referring to), in your control panel, go to &lt;strong&gt;Settings&lt;/strong&gt; then &lt;strong&gt;Sections&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To loop through entries on a template, for this service section for example, you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('services').all() %}&#xA;    {{ entry.title }} &amp;lt;br&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-01-31T12:55:57.003" LastActivityDate="2019-01-31T12:55:57.003" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29335" PostTypeId="1" AcceptedAnswerId="29345" CreationDate="2019-01-31T14:30:26.677" Score="1" ViewCount="220" Body="&lt;p&gt;We've a WIP that need virtual products. Not the official plugin, but a custom product type that don’t required any shipping. I was wondering if anyone ever try to do so, and how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about a Switch Field for that particular Product Type that will affect all the checkout process (if no product need shipping in the order, of course) : don't show the &quot;Shipping Address&quot; form, skip the Shipping Method choice and hide any shipping mentions on the order and emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I already have a custom module to do custom actions on event for this product type. Extend Craft Commerce is a possibility.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-02-01T14:16:59.160" Title="Skipping the shipping part for custom virtual product" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;shipping&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29336" PostTypeId="2" ParentId="29335" CreationDate="2019-01-31T14:35:48.863" Score="1" Body="&lt;p&gt;There is nothing stopping you selling products that are not physical. Just mark the product as free shipping, and skip the address and shipping method selection screens entirely (the front-end is totally up to you).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s Product Type settings even have a 'has dimensions' checkbox you can turn off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.p.s check out &lt;a href=&quot;https://github.com/craftcms/digital-products&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/digital-products&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-01-31T14:35:48.863" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29337" PostTypeId="1" AcceptedAnswerId="29363" CreationDate="2019-01-31T14:58:52.780" Score="1" ViewCount="273" Body="&lt;p&gt;I am trying to return entries that relate to a series of categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I am trying to return clothing, in this example, I want to &lt;strong&gt;return all entries related to (flannel or denim) and (blue or red)&lt;/strong&gt; in the products channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Flannel, denim, blue and red are all apart of the same category group called: filters, and the category field handle is productFilters&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying to return all those entries but it returns 0 entries, any help is appreciated. I know I can do this probably using the craft cms element query in the template but I need to do this in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$color_categories = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category, [&#xA;    'slug'  =&amp;gt; ['blue', 'red'],&#xA;    'group' =&amp;gt; 'filters'&#xA;])-&amp;gt;find();&#xA;&#xA;$fabric_categories = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Category, [&#xA;    'slug'  =&amp;gt; ['denim', 'flannel'],&#xA;    'group' =&amp;gt; 'filters'&#xA;])-&amp;gt;find();&#xA;&#xA;$entries = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;    'section'           =&amp;gt; 'products',&#xA;    'relatedTo'         =&amp;gt; ['and', $fabric_categories, $color_categories],&#xA;]);&#xA;&#xA;return $entries;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3618" LastActivityDate="2019-02-03T12:29:16.890" Title="Multiple and or relatedTo in plugin element criteria" Tags="&lt;plugin-development&gt;&lt;categories&gt;&lt;elementcriteriamodel&gt;&lt;relatedto&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29339" PostTypeId="1" AcceptedAnswerId="29344" CreationDate="2019-01-31T19:13:33.213" Score="1" ViewCount="119" Body="&lt;p&gt;I am working on a plugin and I have the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private function _tagProducts(array $products, array $names)&#xA;{&#xA;    foreach ($products as $productId)&#xA;    {&#xA;        $product = Craft::$app-&amp;gt;getElements()-&amp;gt;getElementById($productId, Product::class, null);&#xA;        $product['businessTag'] = ['something'];&#xA;        $product['purchasedWithVoucher'] = 'no';&#xA;        Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($product);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove/comment out the line &lt;code&gt;$product['businessTag'] = ['something'];&lt;/code&gt; this snippet runs just fine and updates the field &lt;code&gt;purchasedWithVoucher&lt;/code&gt; just fine. But, if I keep the &lt;code&gt;businessTag&lt;/code&gt; line in I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(Integrity constraint violation – yii\db\IntegrityException)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried updating the tag field as &lt;code&gt;$product['businessTag'] = 'something';&lt;/code&gt; which at least throws no errors, but the product is not updated with the new tag, however the &lt;code&gt;$product['purchasedWithVoucher'];&lt;/code&gt; line does update so I know that simply saving the changes isn't the issue.&lt;/p&gt;&#xA;" OwnerUserId="6955" LastEditorUserId="57" LastEditDate="2019-02-02T05:12:26.173" LastActivityDate="2019-02-06T22:30:52.207" Title="How can I save a tag value in an entry in Craft 3" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29340" PostTypeId="1" CreationDate="2019-01-31T21:52:01.340" Score="2" ViewCount="104" Body="&lt;p&gt;I have a site setup for Craft 3 like below&#xA;.env variables for development&#xA;local&#xA;staging &#xA;production&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Folder structure is standard.&#xA;My assest volumes are like below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'@assetBaseUrl/documents/xx'&#xA;'@assetBaseUrl/web/assets/documents/xx'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to add a new site on separate domain which i have done in Craft control site manager. For the moment its called &quot;awards&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added domain specific variables to .env like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CRAFTENV_BASE_URL_AWARDS = &quot;https://awards.com/&quot;&#xA;CRAFTENV_BASE_PATH_AWARDS = &quot;/mypath/&quot;&#xA;ASSET_BASE_URL_AWARDS=&quot;https://awards.com/assets&quot;&#xA;ASSET_BASE_PATH_AWARDS=&quot;/mypathft3/public_html/assets/awards&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My config file only references asset paths for domain 1 from the .env file.  For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'baseUrl'  =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;    'basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH'),&#xA;    'aliases' =&amp;gt; [&#xA;        '@assetBaseUrl' =&amp;gt; getenv('ASSET_BASE_URL'),&#xA;        '@assetBasePath' =&amp;gt; getenv('ASSET_BASE_PATH'),&#xA;        '@baseUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;        '@basePath' =&amp;gt; getenv('CRAFTENV_BASE_PATH')&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using the same templates folder for domain 2 as domain 1 and craft is finding this OK with my one basic section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/templates/&amp;lt;sitename2&amp;gt;/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;SO my question is how do i achieve separation of assets volumes for domain 2?&#xA;Do i use domain 2 specific env variables in asset folder paths that can read my .env domain specific vars then use these in new volumes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I want to share volumes across sites?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Been baking my noodle for hours&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-01-31T21:52:01.340" Title="How to reference domain specific asset path in multi domain multi env setup?" Tags="&lt;multi-environment&gt;&lt;multi-domain&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29342" PostTypeId="2" ParentId="29314" CreationDate="2019-02-01T10:22:52.343" Score="1" Body="&lt;p&gt;Thanks for those. I found out for the specific need I had that I could take the existing Craft3 Plaintext field file, duplicate it (in my plugin folder), change the 'value' line of the getInputHtml function and then add a EVENT_REGISTER_FIELD_TYPES event to the main Plugin file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are other situations where I may need to add Javascript so I have reviewed the Asset Bundle page, but I will not be able to check it in detail until a specific job requires its use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this 'answer' matches the guidelines as it (strictly) does not answer my original question (only its need).&lt;/p&gt;&#xA;" OwnerUserId="6929" LastActivityDate="2019-02-01T10:22:52.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29344" PostTypeId="2" ParentId="29339" CreationDate="2019-02-01T12:55:43.853" Score="3" Body="&lt;p&gt;The trick here is that Tags are also elements, so you'll need to save them or look them up to assign them. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public function createOrGetTag($keyword, $groupId) {&#xA;        $tagQuery = new TagQuery(Tag::class);&#xA;        $tagQuery-&amp;gt;groupId = $groupId;&#xA;        $tagQuery-&amp;gt;title = $keyword;&#xA;        $tag = $tagQuery-&amp;gt;one();&#xA;&#xA;        if (!$tag) {&#xA;            $tag = new Tag();&#xA;            $tag-&amp;gt;groupId = $groupId;&#xA;            $tag-&amp;gt;title = $keyword;&#xA;            Craft::$app-&amp;gt;elements-&amp;gt;saveElement($tag);&#xA;        }&#xA;&#xA;        return $tag;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your field setting, you'd do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product-&amp;gt;businessTag-&amp;gt;id[] = $tag-&amp;gt;id;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8665" LastEditorUserId="6955" LastEditDate="2019-02-06T22:30:52.207" LastActivityDate="2019-02-06T22:30:52.207" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29345" PostTypeId="2" ParentId="29335" CreationDate="2019-02-01T14:16:59.160" Score="1" Body="&lt;p&gt;Finally found a solution by adding a template variable to my custom module. I can now test from both front-end and back-end if the order really need shipping* with a single &lt;code&gt;if&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I split my product types in two segment; physical and virtual, so I can easily loop through my order &lt;code&gt;lineItems&lt;/code&gt; to look at the product &lt;code&gt;typeId&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-02-01T14:16:59.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29346" PostTypeId="1" AcceptedAnswerId="29348" CreationDate="2019-02-01T15:58:58.683" Score="1" ViewCount="526" Body="&lt;p&gt;I have a front end form with multiple checkboxes. Is it possible to convert the checkbox values from an array to a string before it's submitted to the database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to save the checkbox values into a PlainText Craft field in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to submit the front end form checkbox values into a PlainText field currently, I get the error: &lt;code&gt;trim() expects parameter 1 to be string, array given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like perhaps using the &lt;code&gt;join&lt;/code&gt; or &lt;code&gt;merge&lt;/code&gt; filter may accomplish this but I'm not sure. &lt;/p&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2019-02-01T19:10:33.623" Title="Convert checkbox values from an array to a string" Tags="&lt;form&gt;&lt;checkboxes&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29347" PostTypeId="2" ParentId="29346" CreationDate="2019-02-01T16:36:57.360" Score="1" Body="&lt;p&gt;If you need to do this in a twig template, the &lt;code&gt;join&lt;/code&gt; filter will do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;{{ yourCheckboxesValues|join(', ') }}&lt;/code&gt; to print something like that : &lt;code&gt;value1, value2, value3&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-02-01T16:36:57.360" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="29348" PostTypeId="2" ParentId="29346" CreationDate="2019-02-01T17:18:34.210" Score="1" Body="&lt;p&gt;If you have access to jQuery in your project, you can &lt;a href=&quot;https://gist.github.com/olivierbon/6c9013fa9b2841bb954909070c02e236&quot; rel=&quot;nofollow noreferrer&quot;&gt;do this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change the name of your checkboxes so craft doesn't look at them when the form gets posted and have a hidden input (named inline with your form) that you populate using using js.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This uses jQuery but you can convert to Javascript if needed. It's not perfect but it might get you on the way :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-01T19:10:33.623" LastActivityDate="2019-02-01T19:10:33.623" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="29349" PostTypeId="1" CreationDate="2019-02-01T17:29:20.863" Score="1" ViewCount="45" Body="&lt;p&gt;&lt;em&gt;&lt;strong&gt;Edit:&lt;/strong&gt; This is confirmed as a bug in Craft, that will be fixed in its next release. If you're running into this, please see the temporary fix over at GitHub: &lt;a href=&quot;https://github.com/craftcms/cms/issues/3772&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3772&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'm leaving up the original post for posterity.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running into an issue with the recent update for Craft 3.1. I've not changed any of my code on the archive pages, but the list of entries on my archive pages stopped showing up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I use to set up the date ordering.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set firstEntryEver = craft.entries.section('posts').orderBy('postDate asc').one() %}&#xA;{% set lastEntryEver = craft.entries.section('posts').orderBy('postDate desc').one() %}&#xA;{% if craft.app.request.getSegment(2) is null %}&#xA;    {% set year = 2018 %}&#xA;{% else %}&#xA;    {% set year = craft.app.request.getSegment(2) %}&#xA;{% endif %}&#xA;{% set archiveBlurbs = craft.entries.section('archives').type('yearBlurb').archiveYear(year) %}&#xA;{% set monthBlurbs = craft.entries.section('archives').type('monthBlurb').archiveYear(year) %}&#xA;{% set entriesInYear = craft.entries.section('posts').limit(null).after(year).before(year+1).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the call I use is &lt;code&gt;{% for month, entriesInMonth in entriesInYear | group(&quot;postDate|date('F')&quot;) %}&lt;/code&gt;. The content is then separated by month over a single year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logic I use here &lt;a href=&quot;https://craftcms.com/guides/creating-an-archive-page-for-entries&quot; rel=&quot;nofollow noreferrer&quot;&gt;generally follows the official docs&lt;/a&gt; with some light modifications. I find that the content for all years shows up if I remove the &lt;code&gt;before&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what might be at play here?&lt;/p&gt;&#xA;" OwnerUserId="9252" LastEditorUserId="9252" LastEditDate="2019-02-02T16:24:36.347" LastActivityDate="2019-02-02T16:24:36.347" Title="Archive page date logic stopped working" Tags="&lt;craft3&gt;&lt;datetime&gt;&lt;postdate&gt;&lt;archives&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29350" PostTypeId="2" ParentId="29349" CreationDate="2019-02-01T17:56:06.357" Score="1" Body="&lt;p&gt;It seems that &lt;code&gt;before&lt;/code&gt; and &lt;code&gt;after()&lt;/code&gt; don't work with the year as an &lt;code&gt;int&lt;/code&gt;, if instead of '2018', you use '2018-01-01', your code works again. &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, use a &lt;a href=&quot;http://php.net/class.datetime&quot; rel=&quot;nofollow noreferrer&quot;&gt;DateTime&lt;/a&gt; object&#xA;:)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-01T17:56:06.357" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29351" PostTypeId="1" AcceptedAnswerId="29354" CreationDate="2019-02-01T18:07:23.567" Score="1" ViewCount="29" Body="&lt;p&gt;I have a set of categories that I would like to display on a sidebar as a way to filter the list of entries displayed. However, some of those categories haven't been associated with any entries yet so clicking on that category with return 0 results. &#xA;What is the most efficient way to exclude those categories?&lt;/p&gt;&#xA;" OwnerUserId="5881" LastActivityDate="2019-02-01T18:20:36.193" Title="Exclude categories that are not associated to any entry" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29352" PostTypeId="1" CreationDate="2019-02-01T18:16:06.427" Score="3" ViewCount="97" Body="&lt;p&gt;I had a &lt;strong&gt;dropdown&lt;/strong&gt; field with a handle of &lt;code&gt;hLevel&lt;/code&gt;, with only numeric values in it, anticipating that I could do math with the values in my template. But it seems I can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set dif = subhead.hLevel - subhead.next.hLevel %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…returns an error message ending in:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“could not be converted to int”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I found a thread convinced that &lt;code&gt;number_format&lt;/code&gt; “&lt;a href=&quot;https://stackoverflow.com/questions/24488946/intval-in-twig-template#comment81690544_24489675&quot;&gt;converts a string to a number&lt;/a&gt;”, so I tried that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set dif = subhead.hLevel|number_format - subhead.next.hLevel|number_format %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;…but that doesn't work either. The error message changes to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;“could not be converted to double”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which doesn't surprise me as I did think that &lt;code&gt;number_format&lt;/code&gt; is for float to formatted string conversion, not the other way round as well.  ¯\_(ツ)_/¯&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I change the field format to &lt;strong&gt;number&lt;/strong&gt; everything works fine, but…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be good if there is an option to have &lt;strong&gt;dropdown&lt;/strong&gt; field values be &lt;strong&gt;parsed as numbers&lt;/strong&gt;, because from a UX perspective I would prefer that the field is a dropdown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there some workaround I've missed?&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2019-02-01T18:23:01.260" LastActivityDate="2019-02-01T18:23:01.260" Title="Math with numeric values derived from a dropdown field" Tags="&lt;drop-down&gt;&lt;number&gt;&lt;math&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29353" PostTypeId="2" ParentId="29339" CreationDate="2019-02-01T18:16:07.967" Score="1" Body="&lt;p&gt;I had an issue with Ransom Roberson code &lt;code&gt;$product-&amp;gt;businessTag-&amp;gt;id[] = $tag-&amp;gt;id;&lt;/code&gt; but otherwise everything else worked. The problem is the snippet above will update the tag and then overwrite every tag the entry/product has. So I wrote the code below. Ransom's code works perfectly aside from the last part, so putting this with it should help anyone in the future who is might struggle with this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$existingTags = $product-&amp;gt;businessTag-&amp;gt;ids();&#xA;&#xA;    foreach ($existingTags as $eTag)&#xA;    {&#xA;        $product-&amp;gt;businessTag-&amp;gt;id[] = $eTag;&#xA;    }&#xA;&#xA;    $product-&amp;gt;businessTag-&amp;gt;id[] = $tag-&amp;gt;id&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6955" LastActivityDate="2019-02-01T18:16:07.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29354" PostTypeId="2" ParentId="29351" CreationDate="2019-02-01T18:20:36.193" Score="1" Body="&lt;p&gt;You could get the entries ids, then get the categories related to those entries.&#xA;Like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- set ids= craft.entries.section('sectionHandle').ids() -%}&#xA;&#xA;{%- for cat in craft.categories.relatedTo({ sourceElement: ids }).group('categoryHandle') -%}&#xA;    {{- cat.title -}}&#xA;{%- endfor -%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will only print categories with an entry associated with.&lt;/p&gt;&#xA;" OwnerUserId="8516" LastActivityDate="2019-02-01T18:20:36.193" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29355" PostTypeId="2" ParentId="29352" CreationDate="2019-02-01T18:21:40.410" Score="5" Body="&lt;p&gt;Have you tried &lt;code&gt;subhead.hLevel.value&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-01T18:21:40.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29356" PostTypeId="1" AcceptedAnswerId="29818" CreationDate="2019-02-01T18:31:42.307" Score="1" ViewCount="149" Body="&lt;p&gt;Has anyone been successful using Satis for composer repo(s) with Craft plugins? I have a repo set up with artifacts, that are posted as a public composer repo in the network. It finds the plugins and downloads, but for some reason I keep getting the following error whenever I try to do &lt;code&gt;composer update&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[craft\composer\InvalidPluginException]&#xA;  Couldn't install vendor/plugin: Unable to determine the base path&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works if I do a local path and pull it in that way.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-03-14T06:08:00.460" Title="Private Plugin Repository Using Satis" Tags="&lt;plugin-development&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29357" PostTypeId="1" CreationDate="2019-02-01T22:14:31.093" Score="1" ViewCount="76" Body="&lt;p&gt;I'm using &lt;strong&gt;Freeform Pro&lt;/strong&gt;'s Composer to build front-end forms - seems to work great, including the association to an Element... creating entries from the form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to allow the author to do a little &quot;Edit&quot; of their entries? (such as sending an element type and ID to the function, so it loads that data in the form and allows us to save it?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ craft.freeform.form(&quot;blogEntryForm&quot;).render() }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2019-02-11T21:33:09.143" Title="Using Freeform's Composer for CRUD operations?" Tags="&lt;craft3&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29359" PostTypeId="1" AcceptedAnswerId="29360" CreationDate="2019-02-02T23:51:37.973" Score="2" ViewCount="214" Body="&lt;p&gt;I have setup a boilerplate for Craft sites with a homepage Single setup, plugins installed, common field types setup and a few other jobs I have to do every single time I start a new project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if this is something I can safely turn into a CraftCMS boilerplate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an ideal world it's something I'd keep in Git and when I start a new project in 3 months time or whatever it may be, I can copy this &lt;code&gt;project.yaml&lt;/code&gt; into my new project and I'm an hour or so ahead of where I would be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know technically I probably could, but I'd like some advice on whether this is something I should or should not be doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-02-03T00:55:31.313" Title="Is it possible to create a Craft boilerplate out of a project.yaml file?" Tags="&lt;projectconfig&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29360" PostTypeId="2" ParentId="29359" CreationDate="2019-02-03T00:55:31.313" Score="2" Body="&lt;p&gt;I have just setup a Craft 3 boilerplate and got it working great. So yeah... this does work.&lt;/p&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-02-03T00:55:31.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29361" PostTypeId="2" ParentId="29273" CreationDate="2019-02-03T01:36:30.437" Score="2" Body="&lt;p&gt;Those docs were a bit confusing/misleading, so sorry about that. (I don’t even know what it meant by that!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They’ve been updated for clarity:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After the user successfully logs in, they will be redirected to the path defined by the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#setpasswordsuccesspath&quot; rel=&quot;nofollow noreferrer&quot;&gt;setPasswordSuccessPath&lt;/a&gt; config setting.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additionally, the next Craft release (3.1.8) will start automatically logging users in after resetting their password, if the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#autologinafteraccountactivation&quot; rel=&quot;nofollow noreferrer&quot;&gt;autoLoginAfterAccountActivation&lt;/a&gt; config setting is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer your question, there won’t be any custom plugin/module code needed for this; just update to 3.1.8 when it comes out and enable that config setting.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-02-03T01:36:30.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29363" PostTypeId="2" ParentId="29337" CreationDate="2019-02-03T12:29:16.890" Score="2" Body="&lt;p&gt;Aren't you missing the &lt;code&gt;-&amp;gt;find()&lt;/code&gt; on the last bit?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$entries = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry, [&#xA;    'section'           =&amp;gt; 'products',&#xA;    'relatedTo'         =&amp;gt; ['and', $fabric_categories, $color_categories],&#xA;])-&amp;gt;find();&#xA;return $entries;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-03T12:29:16.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29365" PostTypeId="2" ParentId="2830" CreationDate="2019-02-03T19:23:45.923" Score="2" Body="&lt;p&gt;I'm using Craft v3.1, I noticed that none of the answers worked for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only got it to work by placing &lt;code&gt;raw&lt;/code&gt; before &lt;code&gt;nl2br&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what worked for me: &lt;code&gt;{{ entry.customFieldName |raw|nl2br }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2019-02-03T19:23:45.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29366" PostTypeId="1" AcceptedAnswerId="29367" CreationDate="2019-02-03T21:47:46.163" Score="1" ViewCount="373" Body="&lt;p&gt;Good Evening,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please bear with me I'm very new to Craft 3. I'm getting deprecation errors when outputting information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to output a single entry from a section using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('homepage') %}{{ entry.richText }}{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is giving me the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7415" LastEditorUserId="57" LastEditDate="2019-02-06T04:51:36.610" LastActivityDate="2019-02-06T04:51:36.610" Title="Output deprecation error" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29367" PostTypeId="2" ParentId="29366" CreationDate="2019-02-03T22:09:45.770" Score="2" Body="&lt;p&gt;In your example, &lt;code&gt;for entry in craft.entries.section('homepage')&lt;/code&gt; is attempting to loop through &lt;code&gt;homepage&lt;/code&gt; entries as though they're an array. In Craft CMS 3, this is now deprecated just like the error message is telling you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means you need to use &lt;code&gt;.all()&lt;/code&gt; when querying entries, meaning...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('homepage') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...becomes...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('homepage').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ryan Irelan produced &lt;a href=&quot;https://mijingo.com/lessons/using-dot-all-in-craft-3-element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;a nice video about this&lt;/a&gt; and it's also &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#element-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;covered explicitly in the Craft 3 docs&lt;/a&gt;. If you've worked with Craft 2 and you're just getting started with Craft 3, that &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Changes in Craft 3&lt;/em&gt;&lt;/a&gt; guide is an excellent place to start.&lt;/p&gt;&#xA;" OwnerUserId="22" LastActivityDate="2019-02-03T22:09:45.770" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29368" PostTypeId="1" AcceptedAnswerId="29404" CreationDate="2019-02-04T00:33:52.037" Score="1" ViewCount="78" Body="&lt;p&gt;I added &lt;code&gt;tomodomo/twig-pluralize-extension&lt;/code&gt; to my project composer, loaded with a custom module like that :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;    // Add in our Twig extension&#xA;    $pluralize = new \Tomodomo\Twig\Pluralize;&#xA;    Craft::$app-&amp;gt;view-&amp;gt;registerTwigExtension($pluralize);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use this to pluralize some string in my templates and email templates. When I check the url to my email template, everything work fine but the email didn’t send out because of &quot;unknown function pluralize&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have another custom module (to handle something else in my emails) and this part work fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to register/declare TwigExtensions with another method to get them work in emails ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The only error related to my emails in the logs is about pluralize&#xA;function missing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Everything work fine if I don’t use &lt;code&gt;|pluralize&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-02-04T00:43:04.973" LastActivityDate="2019-02-06T15:14:16.733" Title="TwigExtension added to Craft don’t work in emails" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;modules&gt;&lt;twigextension&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29369" PostTypeId="2" ParentId="29368" CreationDate="2019-02-04T06:28:05.240" Score="1" Body="&lt;p&gt;All you should need to do is remove this condition check:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You are only registering the twig extension for front end (site) requests, but emails can be triggered both on a cart complete front end (site) requests AND a back-end (CP) order status changes.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-02-04T06:28:05.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29370" PostTypeId="1" AcceptedAnswerId="29423" CreationDate="2019-02-04T10:06:54.383" Score="1" ViewCount="143" Body="&lt;p&gt;I'm porting the functionality of an existing plugin from another CMS into Craft 3 through a custom Craft module. The functionality is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When an option from a multi-value checkbox is checked on the &quot;master&quot; entry, the module will (1) create a new corresponding entry, and (2) reset the checkbox options on the &quot;master&quot; entry, so that no options are selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Research&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to be a good Craft citizen and have spent time studying the following articles. However, they either fail to mention what &lt;code&gt;event&lt;/code&gt; they are using, or they end up using &lt;code&gt;EVENT_BEFORE_SAVE_ELEMENT&lt;/code&gt;, or the solutions do not work with the current version of Craft (3.1.7):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/26014/update-checkbox-value-through-plugin-craft-3&quot;&gt;Update checkbox value through plugin (Craft 3)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/20962/how-to-save-a-new-entry-with-custom-fields-craft-3&quot;&gt;How to save a new entry with custom fields - Craft 3&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/26772/how-to-saveelement-in-event-after-save-element-without-infinite-loop&quot;&gt;How to saveElement in EVENT_AFTER_SAVE_ELEMENT without infinite loop&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://craftcodingchallenge.com/challenge-6-the-chicken-or-the-egg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcodingchallenge.com/challenge-6-the-chicken-or-the-egg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempted Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function creatNewEntry()&#xA;{&#xA;    Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;        function(ElementEvent $event) {&#xA;&#xA;            // Ignore any element that is not an entry&#xA;            if (!($event-&amp;gt;element instanceof Entry)) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Ignore entries that are new because they have no id&#xA;            if ($event-&amp;gt;isNew) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Ignore entries that do not belong in section id&#xA;            if ($event-&amp;gt;element-&amp;gt;sectionId != 5) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Ignore entries that are not in the primary site...&#xA;            // This is important if you have a multi-site setup&#xA;            if ($event-&amp;gt;element-&amp;gt;siteId != 1) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Fetch current entry from db. Let's call this the master entry...&#xA;            $masterEntry = Craft::$app-&amp;gt;entries-&amp;gt;getEntryById($event-&amp;gt;element-&amp;gt;id, $event-&amp;gt;element-&amp;gt;siteId);&#xA;&#xA;            // Get values from checkbox from the master entry...&#xA;            $checkboxOptions = $masterEntry-&amp;gt;multiCheckboxField-&amp;gt;getOptions();&#xA;&#xA;            foreach ( $checkboxOptions as $option ) {&#xA;&#xA;                // What should happen when a particular checkbox value is selected?&#xA;                if ( ($option-&amp;gt;selected == true) &amp;amp;&amp;amp; ($option-&amp;gt;value == 'example1') ) {&#xA;&#xA;                    // Create new entry...&#xA;                    $newEntry = new Entry();&#xA;                    $newEntry-&amp;gt;sectionId = $masterEntry-&amp;gt;sectionId;&#xA;                    $newEntry-&amp;gt;typeId = $masterEntry-&amp;gt;typeId;&#xA;                    $newEntry-&amp;gt;title = $masterEntry-&amp;gt;title . 'example1';&#xA;                    $newEntry-&amp;gt;enabled = $masterEntry-&amp;gt;enabled;&#xA;                    $newEntry-&amp;gt;siteId = $masterEntry-&amp;gt;siteId;&#xA;                    $newEntry-&amp;gt;slug = $masterEntry-&amp;gt;slug . 'example1';&#xA;&#xA;                }&#xA;&#xA;                if ( ($option-&amp;gt;selected == true) &amp;amp;&amp;amp; ($option-&amp;gt;value == 'example2') ) {&#xA;&#xA;                    // Create new entry...&#xA;                    $newEntry = new Entry();&#xA;                    $newEntry-&amp;gt;sectionId = $masterEntry-&amp;gt;sectionId;&#xA;                    $newEntry-&amp;gt;typeId = $masterEntry-&amp;gt;typeId;&#xA;                    $newEntry-&amp;gt;title = $masterEntry-&amp;gt;title . 'example2';&#xA;                    $newEntry-&amp;gt;enabled = $masterEntry-&amp;gt;enabled;&#xA;                    $newEntry-&amp;gt;siteId = $masterEntry-&amp;gt;siteId;&#xA;                    $newEntry-&amp;gt;slug = $masterEntry-&amp;gt;slug . 'example2';&#xA;&#xA;                }&#xA;&#xA;            }&#xA;&#xA;            // Handle successful / failure of new entry...&#xA;            if (isset($newEntry)) {&#xA;&#xA;                $success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($newEntry);&#xA;&#xA;                if (!$success) {&#xA;                    Craft::error('Error saving entry: '.$newEntry-&amp;gt;title.' ('.$newEntry-&amp;gt;id.')', __METHOD__);&#xA;                } else {&#xA;                    Craft::info('New entry saved: '.$newEntry-&amp;gt;title.' ('.$newEntry-&amp;gt;id.')', __METHOD__);&#xA;                }&#xA;&#xA;            }&#xA;&#xA;        }&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works great! However, there is no logic in the module that resets the multi-value checkbox on the master entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst debugging, I have tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;adding &lt;code&gt;$event-&amp;gt;element-&amp;gt;multiCheckboxField = [];&lt;/code&gt; on &lt;code&gt;EVENT_BEFORE_SAVE_ELEMENT&lt;/code&gt; which resets the checkbox selected value from &lt;code&gt;true&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;, which is what I want! However, this does not work on &lt;code&gt;EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt;. I can't use &lt;code&gt;EVENT_BEFORE_SAVE_ELEMENT&lt;/code&gt; because it will require a user to save twice in the CP for my module to fire off the checkbox value.&lt;/li&gt;&#xA;&lt;li&gt;adding another static function, which saves the current event element however, this triggers an endless loop, which bounces between &lt;code&gt;isNew' =&amp;gt; $isNewElement&lt;/code&gt; on the &lt;code&gt;afterSaveElement&lt;/code&gt; and the &lt;code&gt;saveElement()&lt;/code&gt; in my module.&lt;/li&gt;&#xA;&lt;li&gt;Thought about using a hacky JS solution in the CP - which I don't want to resort to!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9344" LastEditorUserId="9344" LastEditDate="2019-02-04T11:01:00.340" LastActivityDate="2020-02-14T18:50:01.937" Title="How to reset a multi-value checkbox using EVENT_AFTER_SAVE_ELEMENT in Craft 3?" Tags="&lt;plugin-development&gt;&lt;plugin-elementapi&gt;&lt;events&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29372" PostTypeId="1" CreationDate="2019-02-04T13:52:36.163" Score="1" ViewCount="68" Body="&lt;p&gt;I have some Charge payments on my website, and I have registered the onCharge event in my plugin, like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;    parent::init();&#xA;    craft()-&amp;gt;on('charge.onCharge', function(Event $event) {&#xA;        // Function logic here&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And 95% of the time it works, but sometimes it doesn't trigger. The transaction goes through, and I can see in my Stripe account that it has been successful, but the payment does not appear in my Charge Logs in Craft, and the onCharge event never triggers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help? Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Jai&lt;/p&gt;&#xA;" OwnerUserId="6916" LastActivityDate="2019-02-12T12:40:38.367" Title="Charge Plugin - Stripe payments occasionally not being received in craft" Tags="&lt;plugin-development&gt;&lt;plugin-charge&gt;&lt;stripe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29373" PostTypeId="1" CreationDate="2019-02-04T14:08:43.593" Score="1" ViewCount="78" Body="&lt;p&gt;I have a site A using the Element API plugin to feed content to site B via JSON and handlebars templates. The process is both sites are up to date with content 'x' and it works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the CP updates on site A and it finishes the data on site B never shows until the site A cache is cleared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behavior?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2019-02-06T23:32:57.993" LastActivityDate="2019-02-07T10:44:32.050" Title="Craft update process affecting Element API cache" Tags="&lt;cache&gt;&lt;plugin-elementapi&gt;&lt;updating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29374" PostTypeId="1" AcceptedAnswerId="29376" CreationDate="2019-02-04T15:05:01.923" Score="2" ViewCount="85" Body="&lt;p&gt;I don't know if it's possible, but what I would like is to have a structure with 3 levels linked to a single entry that would act as the index. The problem is the examples I've seen are only with 1 level structures, so what they do is they set the single index URI as &lt;code&gt;services/&lt;/code&gt; and then the structure URI as &lt;code&gt;services/{slug}&lt;/code&gt;. This, for a level 3 structure, gives me &lt;code&gt;services/level3slug&lt;/code&gt;. &#xA;I want to display the parent URI on the level 3 entries, but if I do &lt;code&gt;services/{parent.uri}/{slug}&lt;/code&gt;, I end up having a URI that is &lt;code&gt;services/level1slug/services/level2slug/services/level3slug&lt;/code&gt;. When I would just have &lt;code&gt;services/level1slug/level2slug/level3slug&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of setting the single page as parent of the structure so I can just do &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2019-02-04T15:49:58.657" Title="How to set index page as parent of a structure" Tags="&lt;craft3&gt;&lt;structure&gt;&lt;slug&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29375" PostTypeId="1" CreationDate="2019-02-04T15:37:54.320" Score="2" ViewCount="210" Body="&lt;p&gt;Could you help me with something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a frontend template, I'm trying to go through the string, find all substrings between double curly brackets &lt;code&gt;{{ something }}&lt;/code&gt; using regular expressions and replace them with field values that have the substring in the name. I want it to work dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. replace string &lt;code&gt;{{ something }}&lt;/code&gt; with value of field &lt;code&gt;{{ entry.something }}&lt;/code&gt;, replace string &lt;code&gt;{{ something-else }}&lt;/code&gt; with value of field &lt;code&gt;{{ entry.something-else }}&lt;/code&gt; ...etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the replace filter, and I'm able to find the strings between curly brackets, but I don't know how to replace them with actual fields values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3684" LastEditorUserId="57" LastEditDate="2019-02-06T23:57:49.323" LastActivityDate="2019-02-06T23:57:49.323" Title="Replace substring in string with variable named as substring?" Tags="&lt;replace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29376" PostTypeId="2" ParentId="29374" CreationDate="2019-02-04T15:49:58.657" Score="2" Body="&lt;p&gt;If I understand your question, you want to combine a Single and a Structure into the same family of URL's, something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services&lt;/code&gt; - &lt;em&gt;(Single)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services/service-01&lt;/code&gt; - &lt;em&gt;(Structure Entry)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services/services-01/example-sub-service-01&lt;/code&gt; - &lt;em&gt;(Structure Entry)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services/services-01/example-sub-service-02&lt;/code&gt; - &lt;em&gt;(Structure Entry)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services/service-02&lt;/code&gt; - &lt;em&gt;(Structure Entry)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/services/service-03&lt;/code&gt; - &lt;em&gt;(Structure Entry)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As you rightly said, you would create a &lt;strong&gt;Single&lt;/strong&gt; for your Services homepage and set the URI to &lt;code&gt;services&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would then create a &lt;strong&gt;Structure&lt;/strong&gt; called &quot;Servcies&quot;, and set the URI to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{parent.uri ? parent.uri: '/services'}/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This nice bit of Twig checks if &lt;code&gt;parent.uri&lt;/code&gt; is defined, and outputs it if it is. Otherwise (if the entry is top level in the structure, it just outputs &lt;code&gt;/services/{slug}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-02-04T15:49:58.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29377" PostTypeId="2" ParentId="28156" CreationDate="2019-02-04T16:00:21.063" Score="0" Body="&lt;p&gt;I have updated to craft 3.1.7&#xA;I can only see live preview on homepage of add on domain. Other entries do not have live preview available&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-02-04T16:00:21.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29379" PostTypeId="2" ParentId="29375" CreationDate="2019-02-04T16:10:32.817" Score="3" Body="&lt;p&gt;It sounds like you'd be better off using &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#message-formatting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii's Message Translations&lt;/a&gt; for this, if that's possible in your situation. They are what powers Craft's &lt;code&gt;|t&lt;/code&gt; / &lt;code&gt;|translate&lt;/code&gt; filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;String with {something} and {somethingElse}&quot;|t('site', entry) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this, &lt;code&gt;{something}&lt;/code&gt; and &lt;code&gt;{somethingElse}&lt;/code&gt; would be replaced with the string values of &lt;code&gt;entry.something&lt;/code&gt; and &lt;code&gt;entry.somethingElse&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also pass an array for more complex substitutions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ &quot;String with {something} and {somethingElse}&quot;|t('site', {&#xA;    something: entry.something,&#xA;    somethingElse: entry.somethingElse,&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="157" LastEditDate="2019-02-04T16:21:19.827" LastActivityDate="2019-02-04T16:21:19.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29380" PostTypeId="1" CreationDate="2019-02-04T16:40:43.640" Score="2" ViewCount="152" Body="&lt;p&gt;I am running sta-A and site-b on same installation.&#xA;I have cookie set for domain and have htaccess with CORS origin set to allow *, and also updated the nginx config to allow CORs. I know this last one works as font-awesome was blocked and is now working once i had updated the local nginx conf file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second domain only has live preview available on its home page. Any other entries created for the second domain have the link icon in the entries list in CP but when editing have no live preview option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought 3.1.7 tokenized this?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2020-12-09T07:01:16.200" Title="Craft 3.1.7 live preview multi-site only works on home page" Tags="&lt;multi-site&gt;&lt;live-preview&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29381" PostTypeId="2" ParentId="29380" CreationDate="2019-02-04T16:48:16.967" Score="1" Body="&lt;p&gt;Are those the fields on the non-visible entries translatable by site? It's the most common problem, not setting up some of the fields or subfield as translatable by site.&lt;/p&gt;&#xA;" OwnerUserId="8841" LastActivityDate="2019-02-04T16:48:16.967" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29382" PostTypeId="2" ParentId="29068" CreationDate="2019-02-04T17:08:01.893" Score="5" Body="&lt;p&gt;If you are going to set the fieldValue, you need to save the element:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    $userObject = Craft::$app-&amp;gt;users-&amp;gt;getUserById($userId);&#xA;    $userObject-&amp;gt;setFieldValue('discountPercentage', 15); &#xA;    Craft::$app-&amp;gt;elements-&amp;gt;saveElement($userObject);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should do the trick.&lt;/p&gt;&#xA;" OwnerUserId="9255" LastEditorUserId="5275" LastEditDate="2020-05-15T22:06:38.410" LastActivityDate="2020-05-15T22:06:38.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29383" PostTypeId="1" CreationDate="2019-02-04T17:52:15.040" Score="1" ViewCount="142" Body="&lt;p&gt;I'm working on upgrading a site from Craft2 to Craft3. I've run through the steps in the &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade&quot; rel=&quot;nofollow noreferrer&quot;&gt;upgrade guide&lt;/a&gt; and when I go to &lt;code&gt;/admin&lt;/code&gt; and press the button to run the Database upgrade I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Integrity constraint violation: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'createfoldersinvolume:bb790fdf-3d6b-46b8-a023-b9f7ffe8aba5' for key 'craft_userpermissions_name_unq_idx'&#xA;The SQL being executed was: UPDATE craft_userpermissions SET name='createfoldersinvolume:bb790fdf-3d6b-46b8-a023-b9f7ffe8aba5', dateUpdated='2019-02-04 17:39:32' WHERE id=173&#xA;&#xA;Migration: craft\migrations\m180518_173000_permissions_to_uid&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can restore the database so that's fine but not sure how best to proceed with the upgrade. Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8437" LastActivityDate="2019-02-04T20:16:40.753" Title="Upgrading Craft 2 to 3 hits database error" Tags="&lt;craft3&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2019-02-04T20:16:51.700" ContentLicense="CC BY-SA 4.0" />
  <row Id="29384" PostTypeId="2" ParentId="29383" CreationDate="2019-02-04T20:16:40.753" Score="1" Body="&lt;p&gt;This sounds like a bug, you should probably report it directly to support@craftcms.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm posting this as an answer however, because you may be able to skirt the issue... Try updating to Craft 3.0.x &lt;em&gt;first&lt;/em&gt;, and then updating the 3.1.x from there.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-02-04T20:16:40.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29385" PostTypeId="1" CreationDate="2019-02-04T21:51:56.743" Score="1" ViewCount="573" Body="&lt;p&gt;I'm attempting to get matrix fields to populate in an entry form (using the guest post plugin) and so far just can't seem to crack it. I've tried various examples, but all assume that you're just editing an existing entry, not posting a new one (that a non-cp user would never need to edit). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is so wrong there's little point posting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure if someone can point me in the right direction, I'd be able to take it from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix field is called &lt;code&gt;traveller&lt;/code&gt;, the block is called &lt;code&gt;travellerDetails&lt;/code&gt; and the field I want to try is called &lt;code&gt;travellerTitle&lt;/code&gt; (a dropdown field).&lt;/p&gt;&#xA;" OwnerUserId="9348" LastActivityDate="2019-02-07T18:45:46.577" Title="Matrix fields in an entry form" Tags="&lt;craft3&gt;&lt;matrix&gt;&lt;entry-form&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29386" PostTypeId="2" ParentId="29385" CreationDate="2019-02-04T23:32:52.440" Score="3" Body="&lt;p&gt;The trick, as it were, is to define the Matrix field in your form as an array. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the Matrix entry field itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[traveller][new1][type]&quot; value=&quot;travellerDetails&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;fields[traveller][new1][enabled]&quot; value=&quot;1&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, for each field within the Matrix block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; name=&quot;fields[traveller][new1][fields][travellerTitle]&quot; value=&quot;&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are going to allow for more than one Matrix field in your form, you must increment the block number, e.g. &quot;new1&quot; becomes &quot;new2&quot;. You can do that with some JS.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-02-04T23:32:52.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29387" PostTypeId="1" AcceptedAnswerId="29392" CreationDate="2019-02-05T05:35:49.737" Score="1" ViewCount="176" Body="&lt;p&gt;In PHP, is it possible to grab the customer model from a user model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I just noticed that it is possible to attach a customer info field to the user.  How do we achieve this?&lt;/p&gt;&#xA;" OwnerUserId="4646" LastEditorUserId="4646" LastEditDate="2019-02-05T06:39:30.073" LastActivityDate="2019-02-05T10:11:58.907" Title="Commerce 1 get customer from user model" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;users&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29388" PostTypeId="2" ParentId="29387" CreationDate="2019-02-05T06:44:54.870" Score="0" Body="&lt;p&gt;Figured it out.  For anyone else looking for this info, the answer is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a field of type Customer Customer Info.  Add it as a field in the User Field Settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Access it using the handle you assigned it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$customer = $user-&amp;gt;customerInfo;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2019-02-05T06:44:54.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29389" PostTypeId="1" AcceptedAnswerId="29394" CreationDate="2019-02-05T06:57:53.457" Score="4" ViewCount="380" Body="&lt;p&gt;I've seen many other questions about Craft deployment, some of which even use Git, but none seem to thoroughly address how one would use version control on their local development environment, push changes to a remote repository, and then pull changes down to the staging or production server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, you can handle modifications to static assets and templates this way, but those changes often require modifications to sections, entries, categories, and globals, all of which are stored in the database. How would one manage the &lt;em&gt;entire&lt;/em&gt; website through version control?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9347" LastActivityDate="2019-02-05T14:12:12.510" Title="How should one go about using Craft with Git? [not duplicate]" Tags="&lt;craft3&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29390" PostTypeId="1" CreationDate="2019-02-05T07:12:38.240" Score="1" ViewCount="93" Body="&lt;p&gt;How can this be done in PHP?  I can't find anything in the docs. &lt;/p&gt;&#xA;" OwnerUserId="4646" LastActivityDate="2020-01-06T09:54:41.537" Title="Commerce 1 create a new order programmatically" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;order&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29392" PostTypeId="2" ParentId="29387" CreationDate="2019-02-05T10:11:58.907" Score="2" Body="&lt;p&gt;You shouldn't really need to do that, you're just adding custom fields to the user when those can be fetched easilly.&#xA;A customer will always be a user, but a user might not be a customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you intend to get the customer details from a plugin (with PHP) you can just get the customer details (if exist) from the user, by using the Commerce_CustomersService&lt;/p&gt;&#xA;&#xA;&lt;p&gt;code example would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$customer = craft()-&amp;gt;commerce_customers-&amp;gt;getCustomerByUserId($user-&amp;gt;id);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this will either return the customer model or null (if a customer is not created against the user).&lt;/p&gt;&#xA;" OwnerUserId="8921" LastActivityDate="2019-02-05T10:11:58.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29393" PostTypeId="1" AcceptedAnswerId="29399" CreationDate="2019-02-05T10:39:42.467" Score="2" ViewCount="311" Body="&lt;p&gt;I'm trying to use the &lt;code&gt;./craft clear-caches/all&lt;/code&gt; CLI command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working fine, except that I always get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error clearing cache Control Panel resources: Unable to clear Control&#xA;  Panel resources because the location isn't known for console commands.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I set this resources folder?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2019-02-06T08:57:55.973" LastActivityDate="2019-02-06T08:57:55.973" Title="How to I set the location folder of Control Panel resources?" Tags="&lt;control-panel&gt;&lt;cache&gt;&lt;cli&gt;&lt;resources&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29394" PostTypeId="2" ParentId="29389" CreationDate="2019-02-05T14:12:12.510" Score="2" Body="&lt;p&gt;Have a look at the project config feature in craft 3.1, it generates a yaml file describing all developer created data, e.g. fields, sections etc. which can be stored in GIT. However this does not save user created data e.g entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/project-config.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/project-config.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also look at migrations; php scripts to create schema / data in DB. (Which can be stored in GIT) Migration Manager plugin will auto generate them for you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/migrations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/migrations.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://packagist.org/packages/firstborn/migrationmanager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://packagist.org/packages/firstborn/migrationmanager&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8850" LastActivityDate="2019-02-05T14:12:12.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29395" PostTypeId="1" AcceptedAnswerId="29398" CreationDate="2019-02-05T14:52:46.813" Score="1" ViewCount="382" Body="&lt;p&gt;I've built a product filtering system using tags and currently have 2 available tag groups under different fields. &lt;code&gt;Size&lt;/code&gt; and &lt;code&gt;Type&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently if I select 1 tag from both size and type, it shows all products with either selected, however I want it to only show if the product contains both tags.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.request.getQuery() %}&#xA;{% set selectedTagsIds = query.tags ?? [] %}&#xA;&#xA;{% for tag in craft.tags.group('size').all() %}&#xA;    {% set checkedAttr = tag.id in selectedTagsIds ? 'checked' : '' %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ tag.id }}&quot; {{ checkedAttr }}&amp;gt;{{ tag.title }}&amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for tag in craft.tags.group('type').all() %}&#xA;    {% set checkedAttr = tag.id in selectedTagsIds ? 'checked' : '' %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ tag.id }}&quot; {{ checkedAttr }}&amp;gt;{{ tag.title }}&amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% set relatedToParam = ['or'] %}&#xA;&#xA;{% for id in selectedTagsIds %}&#xA;    {% set relatedToParam = relatedToParam|merge([{&#xA;        targetElement: id&#xA;    }]) %}&#xA;{% endfor %}&#xA;&#xA;{% set relatedToParam = relatedToParam|length &amp;gt; 1 ? relatedToParam : null %}&#xA;&#xA;{% set entries = craft.products.type('accommodation').relatedTo(relatedToParam) %}&#xA;&#xA;{% for product in entries %}&#xA;    // Product content here&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can modify what I have above to make it so that if user selects an option from each tag group, that it only shows products with both selected tags? And if more than 1 of each group are selected to show those too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've based my current code based off &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18447/how-to-filter-entries-based-on-tags&quot;&gt;this&lt;/a&gt; answer.&lt;/p&gt;&#xA;" OwnerUserId="6795" LastEditorUserId="6795" LastEditDate="2019-02-05T15:34:43.287" LastActivityDate="2019-02-08T00:02:45.920" Title="Product Filtering with Tags" Tags="&lt;craft3&gt;&lt;tags&gt;&lt;plugin-craftcommerce2&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29396" PostTypeId="1" CreationDate="2019-02-05T16:01:15.863" Score="1" ViewCount="94" Body="&lt;p&gt;I have a Craft 2 install that's been working fine until recently when the admin page is giving an error: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;file_put_contents(): Exclusive locks are not supported for this stream&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The front end is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems (according to &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/config-settings.html&lt;/a&gt;) that NFS filesystems do not like Exclusive Locks, and the host uses NFS (the webserver the site is on connects to a backend filer via NFS to read the actual webfiles) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I have tried changing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/config/general.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that useFileLock is set to 'false' but this hasn't changed anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7119" LastActivityDate="2021-02-26T04:04:55.480" Title="Craft error on NFS filesystem" Tags="&lt;craft2&gt;&lt;hosting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29397" PostTypeId="1" AcceptedAnswerId="29401" CreationDate="2019-02-05T17:04:40.553" Score="2" ViewCount="455" Body="&lt;p&gt;I have to update Craft 3 from ver. 3.0.28 10/23/2018, but i got this message:&#xA;You’ve reached a breakpoint! More updates will become available after you install Craft CMS 3.0.40.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i fix this problem?&#xA;Updating from the Terminal is no available with my version.&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/updating.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/updating.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8862" LastActivityDate="2019-02-06T09:14:40.643" Title="Updating Craft 3 from ver. 3.0.28 10/23/2018" Tags="&lt;updating&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29398" PostTypeId="2" ParentId="29395" CreationDate="2019-02-05T19:29:37.617" Score="2" Body="&lt;p&gt;Not sure i understand well, but to be sure: you want to be able to filter for (let's say you sell shirts) a Red AND Large shirt, so it filters only the shirts which contain the color red and that are available in large?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On that note, have you tried setting &lt;code&gt;relatedToParam&lt;/code&gt; to &lt;code&gt;and&lt;/code&gt; instead of &lt;code&gt;or&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://craftcms.stackexchange.com/questions/18447/how-to-filter-entries-based-on-tags&quot;&gt;answer&lt;/a&gt; you linked seems to work for multiple selections that are not related. For example: i want the website to show me all the red shirts and all the large shirts, but not necessarily just the red large shirts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following that logic, changing &lt;code&gt;relatedToParam&lt;/code&gt; to &lt;code&gt;and&lt;/code&gt; should do the trick?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT (2019-02-07):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, i tried quite a few solutions and that seems to be working, please read the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was an issue! &#xA;For example, if no size was selected, the loop simply won't do nothing. You could switch the loop to start with types, but then again, if no type is selected, same problem. &#xA;Now it's working but still really NOT versatile. &#xA;Feel free to edit or comment with a better solution!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sizes = craft.tags.group('size').all() %}&#xA;{% set types = craft.tags.group('type').all() %}&#xA;&#xA;{# You'll need to separate tags inside the query itself #}&#xA;{# ?size=......&amp;amp;type=...... #}&#xA;&#xA;{# The split filter doesn't work directly on getParam #}&#xA;&#xA;{# Error when getParam is empty #}&#xA;{# Because it is set to [] and we can't split on an array #}&#xA;{# You will need to find a little condition to make it bulletproof #}&#xA;&#xA;{% set selectedSizesIds = craft.app.request.getParam('size') ?? [] %}&#xA;{% set selectedSizesIds = selectedSizesIds|split(',') %}&#xA;&#xA;{% set selectedTypesIds = craft.app.request.getParam('type') ?? [] %}&#xA;{% set selectedTypesIds = selectedTypesIds|split(',') %}&#xA;&#xA;{# You can actually use a if inside a print statement #}&#xA;{# Take a look at the &quot;checked&quot; print condition #}&#xA;&#xA;{% for size in sizes %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ size.id }}&quot; {{ (size.id in selectedSizesIds) ? 'checked' : '' }}&amp;gt;{{ size.title }}&amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{% for type in types %}&#xA;    &amp;lt;input type=&quot;checkbox&quot; name=&quot;tags[]&quot; value=&quot;{{ type.id }}&quot; {{ (type.id in selectedTypesIds) ? 'checked' : '' }}&amp;gt;{{ type.title }}&amp;lt;/input&amp;gt;&#xA;{% endfor %}&#xA;&#xA;{# Where it gets tricky #}&#xA;{% set relatedToParam = ['and'] %}&#xA;&#xA;{# Loop through the second set of tags while looping through the first set of tags #}&#xA;{# Still not quite sure that's the best way to go but it works well #}&#xA;&#xA;{% if selectedSizesIds|length &amp;gt; 0 %}&#xA;    {% for size in selectedSizesIds %}&#xA;        {% if selectedTypesIds|length &amp;gt; 0 %}&#xA;            {% for type in selectedTypesIds %}&#xA;                {% set relatedToParam = relatedToParam|merge([&#xA;                    { targetElement : [size,type] }&#xA;                ]) %}&#xA;            {% endfor %}&#xA;        {% else %}&#xA;            {% set relatedToParam = relatedToParam|merge([&#xA;                { targetElement : size }&#xA;            ]) %}&#xA;        {% endif %}&#xA;    {% endfor %}&#xA;{% elseif selectedTypesIds|length &amp;gt; 0 %}&#xA;    {% for type in selectedTypesIds %}&#xA;        {% set relatedToParam = relatedToParam|merge([&#xA;            { targetElement : type }&#xA;        ]) %}&#xA;    {% endfor %}&#xA;{% endif %}&#xA;&#xA;{% set relatedToParam = relatedToParam|length &amp;gt; 1 ? relatedToParam : null %}&#xA;&#xA;{% set entries = craft.products.type('accommodation').relatedTo(&#xA;    relatedToParam&#xA;).all() %}&#xA;&#xA;{% for product in entries %}&#xA;   {{ product.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8516" LastEditorUserId="8516" LastEditDate="2019-02-08T00:02:45.920" LastActivityDate="2019-02-08T00:02:45.920" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29399" PostTypeId="2" ParentId="29393" CreationDate="2019-02-06T08:53:43.360" Score="2" Body="&lt;p&gt;Thank you &lt;strong&gt;@Brandon Kelly&lt;/strong&gt; for the solution:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That’s because &lt;code&gt;@webroot&lt;/code&gt; is only reliable on web requests. To fix,&#xA;  update your &lt;code&gt;resourceBasePath&lt;/code&gt; config setting to a real path:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;'resourceBasePath' =&amp;gt; dirname(__DIR__) . '/web/cpresources'&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="131" LastActivityDate="2019-02-06T08:53:43.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29400" PostTypeId="2" ParentId="29397" CreationDate="2019-02-06T09:07:44.847" Score="1" Body="&lt;p&gt;Not 100% sure what it means to be in the breakpoint status, but could you manually change the Craft version in your composer.json and then &lt;code&gt;composer install&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2019-02-06T09:07:44.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29401" PostTypeId="2" ParentId="29397" CreationDate="2019-02-06T09:14:40.643" Score="2" Body="&lt;p&gt;You need to manually update to the latest version of Craft &lt;code&gt;3.0.x&lt;/code&gt;, then update to &lt;code&gt;Craft 3.1.x&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In your &lt;code&gt;composer.json&lt;/code&gt;, change your Craft package to &lt;code&gt;&quot;craftcms/cms&quot;: &quot;3.0.40&quot;,&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;composer update&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then in your &lt;code&gt;composer.json&lt;/code&gt;, change your Craft package to &lt;code&gt;&quot;craftcms/cms&quot;: &quot;^3.0.40&quot;,&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;composer update&lt;/code&gt; again&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-02-06T09:14:40.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29402" PostTypeId="1" CreationDate="2019-02-06T12:21:00.873" Score="1" ViewCount="302" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm slowly working my way through a Craft3/Commerce2 upgrade. My current issue:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When updating redactor I receive multiple errors. I just want to be sure I'm on the right track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cannot create cache directory /.composer/cache/files/, or directory is not writable. Proceeding without cache&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cannot create cache directory /.composer/cache/repo/https---composer.craftcms.com/, or directory is not writable. Proceeding without cache&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cannot create cache directory /.composer/cache/files/, or directory is not writable. Proceeding without cache&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the &lt;strong&gt;vendor &gt; composer&lt;/strong&gt; folder needs to be writable to make this work, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Package &quot;craftcms/vue-asset&quot; listed for update is not installed. Ignoring.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems straightforward but where do I find this? I figured as it seems to be part of Craft it would already be there.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2019-02-06T17:24:13.540" Title="Errors when updating Redactor" Tags="&lt;upgrades&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29403" PostTypeId="1" CreationDate="2019-02-06T14:38:20.753" Score="1" ViewCount="49" Body="&lt;p&gt;In the &lt;code&gt;Globals&lt;/code&gt; I have a &lt;code&gt;field&lt;/code&gt; which is of type &lt;code&gt;table&lt;/code&gt;. I was trying to access this table in the javascript in order to get the values of particular rows. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;        var myTable = &quot;{{ craft.globals.getSetByHandle('myGlobal').myTable }}&quot;; &#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It returns a string &lt;code&gt;&quot;Array&quot;&lt;/code&gt;. If I put &lt;code&gt;[]&lt;/code&gt; around the expression, it will return &lt;code&gt;[&quot;Array&quot;]&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know a way to get access to this table? &lt;/p&gt;&#xA;" OwnerUserId="9355" LastActivityDate="2019-02-07T00:22:11.103" Title="Access table from Globals in script" Tags="&lt;javascript&gt;&lt;globals&gt;&lt;table&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29404" PostTypeId="2" ParentId="29368" CreationDate="2019-02-06T15:14:16.733" Score="1" Body="&lt;p&gt;Replace my &lt;code&gt;if&lt;/code&gt; condition by &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ( Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest() || Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsCpRequest() ) {&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to Luke Holder for pushing in the right direction!&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-02-06T15:14:16.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29405" PostTypeId="1" CreationDate="2019-02-06T15:19:25.263" Score="2" ViewCount="27" Body="&lt;p&gt;I'm looking for replacements for the events &lt;code&gt;onBeforeAddToCart&lt;/code&gt; and &lt;code&gt;onBeforeGatewayRequestSend&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;code&gt;onBeforeAddToCart&lt;/code&gt; to prevent the user from adding an article from different article groups to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;onBeforeGatewayRequestSend&lt;/code&gt; is used to check a mandatory field and to increment our own order/invoice numbers (the md5-style numbers are not convenient for German business).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to set &lt;code&gt;$event-&amp;gt;performAction = false&lt;/code&gt; and &lt;code&gt;$transaction-&amp;gt;message = &quot;Please agree with our terms and conditions&quot;&lt;/code&gt; if the mandatory field is not checked, like I did in Commerce 1.&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2019-02-07T00:19:58.663" LastActivityDate="2019-02-07T00:19:58.663" Title="What are the replacements for the order events onBeforeAddToCart and onBeforeGatewayRequestSend in Commerce 2" Tags="&lt;events&gt;&lt;migration&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29406" PostTypeId="1" AcceptedAnswerId="29437" CreationDate="2019-02-06T16:33:32.797" Score="2" ViewCount="180" Body="&lt;p&gt;I have a custom module that is adding sections to the CP, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Register CP routes&#xA;Event::on(&#xA;    UrlManager::class,&#xA;    UrlManager::EVENT_REGISTER_CP_URL_RULES,&#xA;    function(craft\events\RegisterUrlRulesEvent $event) {&#xA;        $event-&amp;gt;rules['&amp;lt;controller:(subscriptions|purchases)&amp;gt;/&amp;lt;action:&amp;gt;'] = [&#xA;            'route' =&amp;gt; 'module/&amp;lt;controller&amp;gt;/&amp;lt;action&amp;gt;', &#xA;            'defaults' =&amp;gt; [&#xA;                'action' =&amp;gt; 'index',&#xA;            ],&#xA;        ];&#xA;    }&#xA;);&#xA;&#xA;// Add CP nav items&#xA;Event::on(&#xA;    Cp::class,&#xA;    Cp::EVENT_REGISTER_CP_NAV_ITEMS,&#xA;    function(craft\events\RegisterCpNavItemsEvent $event) {&#xA;        $event-&amp;gt;navItems[] = [&#xA;            'url' =&amp;gt; 'subscriptions',&#xA;            'label' =&amp;gt; 'Subscriptions',&#xA;        ];&#xA;        $event-&amp;gt;navItems[] = [&#xA;            'url' =&amp;gt; 'purchases',&#xA;            'label' =&amp;gt; 'Purchases',&#xA;        ];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;SubscriptionsController&lt;/code&gt; and a &lt;code&gt;PurchasesController&lt;/code&gt;, inside of which there is an &lt;code&gt;actionIndex()&lt;/code&gt; method that computes some stuff and renders the appropriate template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;renderTemplate('module/cp/subscriptions/index', [&#xA;    'stuff' =&amp;gt; $stuff,&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All this works fine, but I realized that the above registers some URLs that I do not want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Controllers automatically register URLs in the format &lt;code&gt;admin/actions/&amp;lt;module&amp;gt;/&amp;lt;controller&amp;gt;/&amp;lt;action&amp;gt;&lt;/code&gt; AND &lt;code&gt;actions/&amp;lt;module&amp;gt;/&amp;lt;controller/&amp;lt;action&amp;gt;&lt;/code&gt;. I'm fine with the first one even though it causes duplicate URLs due to my custom &lt;code&gt;&amp;lt;controller:(subscriptions|purchases)&amp;gt;/&amp;lt;action:&amp;gt;&lt;/code&gt; rule, but the second one is problematic because they're not even CP URLs, yet they invoke a controller that is only meant to be used in the CP. It's causing an error when trying to render the template, because the &lt;code&gt;module&lt;/code&gt; template root is only registered for the CP with the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set the base CP template directory&#xA;Event::on(&#xA;    View::class,&#xA;    View::EVENT_REGISTER_CP_TEMPLATE_ROOTS,&#xA;    function (craft\events\RegisterTemplateRootsEvent $event) {&#xA;        $event-&amp;gt;roots['module'] = $this-&amp;gt;getBasePath() . DIRECTORY_SEPARATOR . 'templates';&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Craft automatically creates routes based on my template structure, meaning I can render the &lt;code&gt;module/subscriptions/index.twig&lt;/code&gt; template directly from this URL: &lt;code&gt;admin/module/subscriptions&lt;/code&gt;. This is also causing an error because the template requires variables that are passed to it in the controller action, but they're not set when rendering the template directly. I usually work around this issue on the front-end by setting the &lt;code&gt;general.php&lt;/code&gt; config setting &lt;code&gt;privateTemplateTrigger&lt;/code&gt; to an empty string &lt;code&gt;''&lt;/code&gt;, but it doesn't seem to have any effect on the CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help with these two issues would be greatly appreciated. :)&lt;/p&gt;&#xA;" OwnerUserId="6909" LastEditorUserId="6909" LastEditDate="2019-02-07T17:36:30.557" LastActivityDate="2019-02-07T18:57:13.150" Title="How do I prevent a controller from creating unwanted routes?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;modules&gt;&lt;yii&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29407" PostTypeId="2" ParentId="29403" CreationDate="2019-02-06T16:42:51.580" Score="1" Body="&lt;p&gt;If you want to get the values of your global table field, you need to loop through it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;somewhere in a template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% js %}&#xA;    var table = '&#xA;    {% for row in global.tableFieldName %}&#xA;      ({{ row.column1 }} - {{ row.column2 }}){% if not loop.last %},{% endif %} &#xA;    {% endfor %}'&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;var table = '(Value 1-1 - Value 1-2),(Value 2-1 - Value 2-2)';&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should check out the documentation about &lt;a href=&quot;https://docs.craftcms.com/v3/table-fields.html#settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3 Table Fields&lt;/a&gt;, &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/js.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;{% js %} Tag&lt;/a&gt; and for removing the trailing comma &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2898/remove-trailing-comma-from-an-output-loop&quot;&gt;Remove trailing comma from an output loop?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="7707" LastEditorUserId="57" LastEditDate="2019-02-07T00:22:11.103" LastActivityDate="2019-02-07T00:22:11.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29408" PostTypeId="1" AcceptedAnswerId="29764" CreationDate="2019-02-06T17:01:11.080" Score="0" ViewCount="56" Body="&lt;p&gt;One of my clients' sites is &lt;a href=&quot;https://anovaworks.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://anovaworks.com/&lt;/a&gt;. The second section on the homepage looks like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7wpax.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7wpax.png&quot; alt=&quot;https://anovaworks.com/&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's some small black text in the top left of the image that's coming from a matrix field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's supposed to look like this, and if you go to &lt;a href=&quot;https://anovaworks.com/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://anovaworks.com/index.php&lt;/a&gt; or &lt;a href=&quot;https://anovaworks.com/?&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://anovaworks.com/?&lt;/a&gt;, it looks correct:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FyogU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FyogU.png&quot; alt=&quot;https://anovaworks.com/index.php&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot figure out what's causing this. Anyone have any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;homepage-tagline&quot;&amp;gt;&#xA;  &amp;lt;div class=&quot;grid-container&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;grid-x&quot;&amp;gt;&#xA;      &amp;lt;div class=&quot;cell small-12 medium-7 large-5 circle-container&quot;&amp;gt;&#xA;        {# blue circle svg #}&#xA;        {% for matrix in entry.homepageTagline.all() %}&#xA;          &amp;lt;h2&amp;gt;{{ matrix.firstLine}}&amp;lt;br&amp;gt;{{ matrix.secondLine }}&amp;lt;/h2&amp;gt;&#xA;        {% endfor %}&#xA;          &amp;lt;a href=&quot;{{ entry.homepageTaglineButtonLink.one().url }}&quot;&amp;gt;&amp;lt;button class=&quot;button&quot;&amp;gt;{{ entry.homepageTaglineButtonText }}&amp;lt;/button&amp;gt;&amp;lt;/a&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;  &amp;lt;/div&amp;gt;&#xA;&amp;lt;/section&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8967" LastEditorUserId="8967" LastEditDate="2019-02-06T18:19:35.713" LastActivityDate="2019-03-08T17:10:30.960" Title="Page ignoring template" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="29409" PostTypeId="2" ParentId="29402" CreationDate="2019-02-06T17:24:13.540" Score="1" Body="&lt;p&gt;With update issues like this, you'll have to run &lt;code&gt;composer update&lt;/code&gt; rather than using the CP update button. You can either SSH into your server to run &lt;code&gt;composer update&lt;/code&gt; or update the files on your local computer and push the new files (they'll be in vendor &gt; craftcms &gt; redactor) to your server. Make sure you do a database backup before doing this. After doing this manual update, when you go to your Craft CP, you'll probably get a notice that Craft needs to make changes to your database, so just click ok or whatever it says.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Composer says there's nothing to update, you'll need to edit your composer.json file. At the top of composer.json under &quot;require&quot; you'll see your Redactor plugin; edit the numbers to the version number you see in the Craft updates in your Control Panel, then run &lt;code&gt;composer update&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-06T17:24:13.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29410" PostTypeId="2" ParentId="29385" CreationDate="2019-02-06T17:38:17.430" Score="1" Body="&lt;p&gt;Do you have something like &lt;code&gt;{{ entry.traveller.one().travellerDetails.one().travellerTitle }}&lt;/code&gt;? Even if you limit the number of matrixes to 1, Craft still creates an array, so you need to include &lt;code&gt;.one()&lt;/code&gt; after the matrix field name and matrix block name. If you use a &lt;code&gt;for&lt;/code&gt; loop, you wouldn't need the &lt;code&gt;.one()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-06T17:38:17.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29411" PostTypeId="1" CreationDate="2019-02-06T17:50:42.143" Score="1" ViewCount="317" Body="&lt;p&gt;The blog post should display the posts created but when I got to the slug /blog it says 404 not found as well as the press news should be displayed here /press-news but same thing happens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i access the posts directly : site.com/blog/blog-post-name it is displayed correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;an you help me giving me some probable causes so that i can check how to fix it? thanks&lt;/p&gt;&#xA;" OwnerUserId="8861" LastActivityDate="2019-02-07T20:55:11.903" Title="Blog template not displaying posts" Tags="&lt;craft3&gt;&lt;error-templates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29412" PostTypeId="2" ParentId="29411" CreationDate="2019-02-06T18:12:31.063" Score="2" Body="&lt;p&gt;If you've setup a channel, it does not include a &quot;blog index&quot; by default, for this you need to make it yourself by placing an index.twig file within the blog folder (If that is a directory in your templates folder).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the answer in this question for an example on how to do the twig code.&#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/2387/whats-the-right-way-to-create-a-simple-blog-in-craft&quot;&gt;What&amp;#39;s the right way to create a simple blog in Craft?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7068" LastEditorUserId="7068" LastEditDate="2019-02-07T20:55:11.903" LastActivityDate="2019-02-07T20:55:11.903" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29413" PostTypeId="1" CreationDate="2019-02-06T19:10:19.897" Score="1" ViewCount="139" Body="&lt;p&gt;I've tried following the guide for setting up multiple sites (&lt;a href=&quot;https://docs.craftcms.com/v3/sites.html#creating-a-site&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/sites.html#creating-a-site&lt;/a&gt;) but I think i'm missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly the craft install on your beta site, does it share the same database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly I'm not exactly sure what 'step 7' is asking me to do, could you please explain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, I'm using plesk on my hosting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="9356" LastActivityDate="2019-03-09T05:02:20.447" Title="Setting Up Multiple Sites" Tags="&lt;database&gt;&lt;multi-site&gt;&lt;multi-domain&gt;&lt;sites&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29414" PostTypeId="1" CreationDate="2019-02-06T19:49:04.053" Score="2" ViewCount="206" Body="&lt;p&gt;Despite setting baseUrl alias with trailing slash it appears it gets stripped off in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CRAFTENV_BASE_URL=&quot;https://domain.test/&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  'aliases' =&amp;gt; [&#xA;      '@siteUrl' =&amp;gt; getenv('CRAFTENV_SITE_URL'),&#xA;      '@baseUrl' =&amp;gt; getenv('CRAFTENV_BASE_URL'),&#xA;      '@basePath'   =&amp;gt; getenv('CRAFTENV_BASE_PATH')&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;template&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set baseUrl = alias('@baseUrl') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which renders&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://domain.test&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and breaks my craft 2 template links to stylesheets etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can fix with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set baseUrl = alias('@baseUrl') ~ '/' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but can't help but think trailing slash was compulsory in Craft 2.&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-02-06T19:49:04.053" Title="baseUrl and trailing slash Craft 3" Tags="&lt;config&gt;&lt;configuration&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29415" PostTypeId="2" ParentId="29411" CreationDate="2019-02-06T20:50:38.620" Score="2" Body="&lt;p&gt;If &lt;code&gt;blog&lt;/code&gt; is a channel and &lt;code&gt;site.com/blog/blog-post-name&lt;/code&gt; is correctly displayed but you can't access &lt;code&gt;site.com/blog&lt;/code&gt;, that is probably because you are missing an &lt;code&gt;index.html&lt;/code&gt; template inside the &lt;code&gt;blog&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft will do the route automatically if you add an index.html file inside a section folder. (rightly named)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, what you want is to display the blog related posts inside that template.&#xA;From there, just make a simple Craft request and loop through the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like that should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in craft.entries.section('blog').all %}&#xA;    &amp;lt;article&amp;gt;&#xA;        &amp;lt;h3&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;/article&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I invite you to read the &lt;a href=&quot;https://docs.craftcms.com/v3/sections-and-entries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;official doc&lt;/a&gt;, all the basics (like that one) are well documented and a lot of examples are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also take a look at the &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Routing documentation&lt;/a&gt; to understand the step behind Craft routing. &lt;/p&gt;&#xA;" OwnerUserId="8516" LastEditorUserId="9256" LastEditDate="2019-02-07T05:00:36.763" LastActivityDate="2019-02-07T05:00:36.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29416" PostTypeId="2" ParentId="29408" CreationDate="2019-02-06T21:44:41.740" Score="2" Body="&lt;p&gt;Your &lt;code&gt;&amp;lt;div class=&quot;cell small-12 medium-7 large-5 circle-container&quot;&amp;gt;&lt;/code&gt; is well displayed in the source code, but not in the inspector; Try to remove and/or fix what interfere with this piece of HTML (JS?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: If I disable JavaScript on my browser, everything is fine on your site.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-02-07T02:07:57.953" LastActivityDate="2019-02-07T02:07:57.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29417" PostTypeId="1" AcceptedAnswerId="29422" CreationDate="2019-02-06T21:53:03.573" Score="1" ViewCount="323" Body="&lt;p&gt;Sometimes when your javascripts or stylesheets are formatted a certain way, twig seems to try and render those snippets (whom always include curly brackets in some way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you end you're CSS stylesheet with something like this;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@media only screen and (max-width: 600px) {&#xA;  body {&#xA;    background-color: lightblue;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I can't remember the exact case off the top of my head, but I believe this is it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stylesheet won't render, as twig throws an exception giving you a 500 error. It seems to be that the curly brackets (two next to each other in the flow) gets interpreted as twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same goes for JavaScript, where a concrete example is instafeed.js if you import and compile with Parcel or Webpack or the likes, there's a line of code in that library that makes the .js file throw a 500 error because twig interprets the file. Specifically this line;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pattern = /(?:\{{2})([\w\[\]\.]+)(?:\}{2})/;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again the curly brackets breaks the loading of the .js file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually haven't gotten around to simply loading the javascript and css though basic tags in the html, so it might be that the issue is only present when loading through &lt;code&gt;{% do view.registerCssFile(url) %}&lt;/code&gt; or &lt;code&gt;{% do view.registerJsFile(url) %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any simple workaround for this (maybe just loading with html like &lt;code&gt;&amp;lt;script src=&quot;{{ path-to-file }}&quot;&amp;gt;&lt;/code&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-02-07T06:12:52.413" Title="Twig sometimes breaks JavaScript or CSS" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29418" PostTypeId="2" ParentId="29417" CreationDate="2019-02-06T22:50:13.530" Score="0" Body="&lt;p&gt;Try using &lt;code&gt;{% verbatim %}CSS or JS code here{% endverbatim %}&lt;/code&gt;. Twig won't process text inside the &lt;code&gt;verbatim&lt;/code&gt; tags.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-06T22:50:13.530" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29420" PostTypeId="2" ParentId="29396" CreationDate="2019-02-07T00:08:10.207" Score="0" Body="&lt;p&gt;Two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure you're using &lt;code&gt;false&lt;/code&gt; the boolean and not &lt;code&gt;'false'&lt;/code&gt; the string.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After you change &lt;code&gt;useFileLocks&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;, clear the &lt;code&gt;craft/storage/runtime/cache&lt;/code&gt; folder as I believe that setting is cached for whatever the &lt;a href=&quot;https://docs.craftcms.com/v2/config-settings.html#cacheduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;cacheDuration&lt;/a&gt; config setting is set to.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-07T00:08:10.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29421" PostTypeId="2" ParentId="29413" CreationDate="2019-02-07T05:00:03.407" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Firstly the Craft install on your beta site, does it share the same database?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Craft's multi-site setup is meant to use a single database.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Secondly I'm not exactly sure what 'step 7' is asking me to do, could you please explain?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Step 7: Configure Your Web Server and DNS&#xA;&#xA;1.  Configure your web server so the domain (e.g. beta.craftcms.com) points at the web directory. Craft will automatically detect which site the browser is requesting.&#xA;2.  Update your DNS records so the domain points at the web server.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will be difficult to answer without knowing your specific environment and where your domain name is registered or if you're just doing this locally with a development domain.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-07T05:00:03.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29422" PostTypeId="2" ParentId="29417" CreationDate="2019-02-07T06:12:52.413" Score="3" Body="&lt;p&gt;Don't put your CSS and JS files in the &lt;code&gt;/templates&lt;/code&gt; folder. Store them on the front-end in the &lt;code&gt;/web&lt;/code&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they're not in the templates folder, Twig won't try to parse them.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-02-07T06:12:52.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29423" PostTypeId="2" ParentId="29370" CreationDate="2019-02-07T08:51:42.580" Score="1" Body="&lt;p&gt;After a few days of reflection;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided that resetting the checkbox values programatically on &lt;code&gt;EVENT_AFTER_SAVE_ELEMENT&lt;/code&gt; was not really needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up using a JS solution that unsets my checkbox values from &lt;code&gt;true&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; on page load. Works very well. I added my JS through an Asset Bundle, which is loaded through my module. My Asset Bundle function looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Load asset bundle&#xA;protected static function loadAssetBundle()&#xA;{&#xA;    // Load AssetBundle&#xA;    if (Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsCpRequest()) {&#xA;&#xA;        // Don't show asset bundle on CP login&#xA;        if (Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity() !== NULL ) {&#xA;&#xA;            Event::on(&#xA;                View::class,&#xA;                View::EVENT_BEFORE_RENDER_TEMPLATE,&#xA;                function (TemplateEvent $event) {&#xA;&#xA;                    try {&#xA;                        Craft::$app-&amp;gt;getView()-&amp;gt;registerAssetBundle(YourModuleAsset::class);&#xA;                    } catch (InvalidConfigException $e) {&#xA;                        Craft::error(&#xA;                            'Error registering YourModuleAssetBundle - '.$e-&amp;gt;getMessage(),&#xA;                            __METHOD__&#xA;                        );&#xA;                    }&#xA;&#xA;                }&#xA;            );&#xA;&#xA;        }&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Asset Bundle JS looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// reset checkbox values after save&#xA;// Use the &quot;Control Panel Body Classes&quot; plugin to assign classes to &amp;lt;body&amp;gt;&#xA;if ($('body.class-set-by-cp-body-classes-plugin')[0]){&#xA;    $(&quot;input[name='fields[myCheckboxField][]']&quot;).prop('checked', false);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: This no longer works since upgrading to Craft 3.4. Visually, the fields are reset in the CP, but the reset values do not persist when the entry is saved&lt;/p&gt;&#xA;" OwnerUserId="9344" LastEditorUserId="9344" LastEditDate="2020-02-14T18:50:01.937" LastActivityDate="2020-02-14T18:50:01.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29424" PostTypeId="1" AcceptedAnswerId="29428" CreationDate="2019-02-07T09:38:33.300" Score="1" ViewCount="260" Body="&lt;p&gt;Is there a &quot;Craft&quot; way of handling this in 3.1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solutions to this question on SE are based on older versions of Craft which no longer work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Custom fields can be duplicated by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$newEntry-&amp;gt;customFieldHandle = $masterEntry-&amp;gt;customFieldHandle;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tested this with Plain Text, Number, Dropdown, Date/Time, Entries fields and it works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this with a matrix field (not expecting it to work, as I appreciate Matrix fields are handled differently). The matrix content and fields are copied across when a &lt;code&gt;newEntry&lt;/code&gt; is generated, but is deleted from the &lt;code&gt;masterEntry&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example module:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function createNewEntry()&#xA;{&#xA;    Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;        function(ElementEvent $event) {&#xA;&#xA;            // Ignore any element that is not an entry&#xA;            if (!($event-&amp;gt;element instanceof Entry)) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Ignore entries that are new because they have no id&#xA;            if ($event-&amp;gt;isNew) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Fetch current entry and assign siteid&#xA;            $masterEntry = Craft::$app-&amp;gt;entries-&amp;gt;getEntryById($event-&amp;gt;element-&amp;gt;id, $event-&amp;gt;element-&amp;gt;siteId);&#xA;&#xA;            // Basic Craft fields...&#xA;            $newEntry = new Entry();&#xA;            $newEntry-&amp;gt;sectionId = $masterEntry-&amp;gt;sectionId;&#xA;            // more craft fields here...&#xA;&#xA;            // Custom fields &#xA;            $newEntry-&amp;gt;contentLongtitle = $masterEntry-&amp;gt;contentLongtitle;&#xA;            // more craft custom fields here...&#xA;&#xA;            // Matrix field &#xA;            // Doing this copies the matrix content to newEntry&#xA;            // but deletes it from masterEntry&#xA;            $newEntry-&amp;gt;matrixSchedule = $masterEntry-&amp;gt;matrixSchedule;&#xA;&#xA;            $success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($newEntry);&#xA;            // Handle success/failure logic here...&#xA;&#xA;        }&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9344" LastEditorUserId="9344" LastEditDate="2019-02-07T10:01:32.070" LastActivityDate="2019-02-07T13:20:29.993" Title="How to duplicate a matrix field programatically in Craft 3.1?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;matrix&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29425" PostTypeId="1" CreationDate="2019-02-07T09:58:11.730" Score="2" ViewCount="259" Body="&lt;p&gt;We have set up a &lt;strong&gt;remote&lt;/strong&gt; database connection for Craft CMS so that I and my colleague can work on the same database locally. The connect seems very slow both front end and in the admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contacting the VPS provider they assure us that the Database is running efficiently. They tested using MySQL Workbench (see results below) and concluded that the slow speed we are experiencing is on connectivity/CMS level. We know this isn't isolated to one ISP as we experience the same thing at home as well as work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit stumped as to what the issue could be. I don't 'think' this is a front end issue but I have also attached a screenshots of the Database Debug for the front end and admin area for entries... just in case this reveals anything... I'm not entirely sure what I'm meant to be looking for. Any help/tips and ideas would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Database Debug (frontend for entry)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wZSS2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wZSS2.png&quot; alt=&quot;Database Debug (frontend for entry)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Database Debug (admin area for entry editor)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PB9w4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PB9w4.png&quot; alt=&quot;Database Debug (admin area for entry editor)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Database Workbench Testing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IrBku.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IrBku.png&quot; alt=&quot;Database Workbench Testing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Slowest Database Queries&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZMkkf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZMkkf.png&quot; alt=&quot;Slowest Database Queries&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2019-02-08T09:05:20.420" LastActivityDate="2019-02-08T09:05:20.420" Title="Diagnosing Slow Database Connection for Entries (Frontend and Craft Admin)" Tags="&lt;craft3&gt;&lt;database&gt;&lt;speed&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29426" PostTypeId="2" ParentId="29373" CreationDate="2019-02-07T10:44:32.050" Score="1" Body="&lt;p&gt;Got to the bottom of it. It was a CORS thing - permission with the domain htaccess and elementAPI. A shift from non-www, to www redirection seemed to be the cause so now solved&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-02-07T10:44:32.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29427" PostTypeId="1" CreationDate="2019-02-07T12:24:49.033" Score="1" ViewCount="76" Body="&lt;p&gt;I've run into issues with the contact form plugin - &lt;a href=&quot;https://github.com/craftcms/contact-form/issues/156&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form/issues/156&lt;/a&gt; - Any ideas&lt;/p&gt;&#xA;" OwnerUserId="9361" LastActivityDate="2019-02-08T00:20:38.937" Title="Contact form on form submission redirects to index.twig" Tags="&lt;plugin-contactform&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29428" PostTypeId="2" ParentId="29424" CreationDate="2019-02-07T13:20:29.993" Score="1" Body="&lt;p&gt;I've just found this: &lt;a href=&quot;https://craftcms.stackexchange.com/a/25961/9344&quot;&gt;https://craftcms.stackexchange.com/a/25961/9344&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading Robins comments, I can see where I was going wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My working example code now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function createNewEntry()&#xA;{&#xA;    Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;        function(ElementEvent $event) {&#xA;&#xA;            // Ignore any element that is not an entry&#xA;            if (!($event-&amp;gt;element instanceof Entry)) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Ignore entries that are new because they have no id&#xA;            if ($event-&amp;gt;isNew) {&#xA;                return;&#xA;            }&#xA;&#xA;            // Fetch current entry and assign siteid&#xA;            $masterEntry = Craft::$app-&amp;gt;entries-&amp;gt;getEntryById($event-&amp;gt;element-&amp;gt;id, $event-&amp;gt;element-&amp;gt;siteId);&#xA;&#xA;            // Fetch matrix fields by handle&#xA;            $masterEntryMatrix = Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('matrixSchedule');&#xA;            // get the existing matrixSchedule value&#xA;            $masterEntryMatrixQuery = $masterEntry-&amp;gt;getFieldValue('matrixSchedule');&#xA;            // serialize the data in order to get an array&#xA;            $masterEntryMatrixSerialized = $masterEntryMatrix-&amp;gt;serializeValue($masterEntryMatrixQuery, $masterEntry);&#xA;&#xA;            // Basic Craft fields...&#xA;            $newEntry = new Entry();&#xA;            $newEntry-&amp;gt;sectionId = $masterEntry-&amp;gt;sectionId;&#xA;            // more craft fields here...&#xA;&#xA;            // Custom fields &#xA;            $newEntry-&amp;gt;contentLongtitle = $masterEntry-&amp;gt;contentLongtitle;&#xA;            // more craft custom fields here...&#xA;&#xA;            // Matrix field &#xA;            $newEntry-&amp;gt;setFieldValue('matrixSchedule', $masterEntryMatrixSerialized);&#xA;&#xA;            $success = Craft::$app-&amp;gt;elements-&amp;gt;saveElement($newEntry);&#xA;            // Handle success/failure logic here...&#xA;&#xA;        }&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9344" LastActivityDate="2019-02-07T13:20:29.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29430" PostTypeId="1" AcceptedAnswerId="29431" CreationDate="2019-02-07T15:06:20.703" Score="2" ViewCount="473" Body="&lt;p&gt;I'm &lt;a href=&quot;http://hdm.wsm.mybluehost.me/&quot; rel=&quot;nofollow noreferrer&quot;&gt;developing a site&lt;/a&gt; in Craft 2, using a modal to display the login form. The modal can be seen by clicking the Login button at top right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm essentially using the form as outlined in the &lt;a href=&quot;https://docs.craftcms.com/v2/templating/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 2 docs here&lt;/a&gt;. But it's not set up to work properly with a modal behavior. Currently, if a user types the wrong password credentials, the form still executes, refreshing to the homepage. It's only when the user once again clicks the &quot;login&quot; button that the modal is once again revealed, now showing the error message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How might I check whether the user's credentials are valid &lt;strong&gt;&lt;em&gt;before&lt;/em&gt;&lt;/strong&gt; submitting the form? If credentials are incorrect, I'd like to prevent execution of the form and keep the modal on screen for the user to try again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3349" LastEditorUserId="57" LastEditDate="2019-02-08T00:11:34.360" LastActivityDate="2019-12-06T19:44:42.423" Title="Login Modal - How to handle incorrect password / credentials?" Tags="&lt;login&gt;&lt;modal&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29431" PostTypeId="2" ParentId="29430" CreationDate="2019-02-07T15:16:23.127" Score="2" Body="&lt;p&gt;You may use some ajax to send your form so your modal will not validate and/or close and your page wont reload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a working example of what you will need to do in JS (this example use jQuery):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#yourFormId').submit( function (e ) {&#xA;      e.preventDefault();&#xA;      var data = $(this).serialize();&#xA;      $.ajax({&#xA;        method: 'POST',&#xA;        url: '/',&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'}&#xA;      })&#xA;    .success(function(data) {&#xA;          console.log('success', data);&#xA;    })&#xA;      .error(function(data) {&#xA;        console.log('error', data);&#xA;      });&#xA;    });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If validation errors happen, you will see that in the data object folowwing the &lt;code&gt;.error&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-02-07T15:32:39.053" LastActivityDate="2019-02-07T15:32:39.053" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29432" PostTypeId="1" CreationDate="2019-02-07T15:27:08.327" Score="1" ViewCount="27" Body="&lt;p&gt;Looks that I really used every functionality in my plugin that changed or has been removed in Commerce 2. :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to modify paypal &lt;code&gt;transactionId&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt; what i did as follows in Commerce 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function commerce_modifyPaymentRequest(array $request){&#xA;  // set (paypal) payment description&#xA;  $request['transactionId'] = substr($request['order']['number'], 0, 7) . &quot;*&quot;;&#xA;  $request['description'] = &quot;Bestell ID: &quot; . substr($request['order']['number'], 0, 7) . &quot;*&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do that in Commerce 2?&lt;/p&gt;&#xA;" OwnerUserId="3463" LastEditorUserId="57" LastEditDate="2019-02-08T00:10:44.863" LastActivityDate="2019-02-08T00:10:44.863" Title="How to modifyPaymentRequest() in Commerce 2?" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;&lt;hook&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29433" PostTypeId="1" AcceptedAnswerId="29505" CreationDate="2019-02-07T16:10:37.413" Score="2" ViewCount="350" Body="&lt;p&gt;This is probably a bit niche but anyone especially au fait with the element api here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On project X I have a custom module within which I am referencing a service from another plugin (&lt;code&gt;bolden/google-maps-api&lt;/code&gt;). If I access the module directly (eg via a controller or variable belonging to my module) then all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - if I try and access my module service from within an element api endpoint, then the service doesn't work (or rather returns null when trying to access the third-party plugin/service).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in my endpoint I am calling the service ($location is a string): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$data = MyModule::getInstance()-&amp;gt;ServiceName-&amp;gt;ServiceMethod( $location );&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this returns the following Response: &lt;code&gt;Call to a member function placeFromText() on null&lt;/code&gt; (the stack trace highlights the corresponding line within my module/service), eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$googleMaps = GoogleMapsApi::getInstance();&#xA;$result = $googleMaps-&amp;gt;googleMapsApiService-&amp;gt;placeFromText( $place, 'geometry' );        &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same query, when accessed within my module (eg a controller or variable), works fine and returns a data object from the Google Maps API (as expected).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bit confused - anyone have any thoughts on why this service isn't accessible from my module when accessed via the element API?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this issue would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cole&lt;/p&gt;&#xA;" OwnerUserId="992" LastActivityDate="2019-02-13T16:13:09.623" Title="Element API calling Module that integrates with third-party plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-elementapi&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29434" PostTypeId="2" ParentId="29430" CreationDate="2019-02-07T16:51:49.487" Score="2" Body="&lt;p&gt;@Maxime, I had to edit your code slightly, as $.ajax() doesn't accept .success as a chain. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#login-form').submit( function (e ) {&#xA;    e.preventDefault();&#xA;    var data = $(this).serialize();&#xA;    $.ajax({&#xA;        method: 'POST',&#xA;        url: '/',&#xA;        data: data,&#xA;        headers: {'Content-Type': 'application/x-www-form-urlencoded'},&#xA;        success: function(){&#xA;            console.log('success', data);&#xA;        },&#xA;        error: function() {&#xA;            console.log('error', data);&#xA;        }&#xA;&#xA;    });&#xA;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, I notice that the code above returns success regardless of whether the password is correct. That is, if I type the wrong password, I still get &quot;success&quot; and the data string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3349" LastActivityDate="2019-02-07T16:51:49.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29435" PostTypeId="2" ParentId="27648" CreationDate="2019-02-07T17:11:01.737" Score="1" Body="&lt;p&gt;I ran into this problem myself recently. It turned out to be a autoloader problem. I had forgotten to run composer dump-autoload on my project directory. I generally don't bother editing the composer autoload file manually.&lt;/p&gt;&#xA;" OwnerUserId="8792" LastActivityDate="2019-02-07T17:11:01.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29436" PostTypeId="1" CreationDate="2019-02-07T17:13:18.657" Score="1" ViewCount="45" Body="&lt;p&gt;How do I set the cart to save / stay active in a users account. When I add some products to my cart (when logged in) and logout or close my browser the next time I come back my cart is empty. I'd like to have the cart 'stay alive' until I complete the order. Help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="9261" LastEditorUserId="57" LastEditDate="2019-02-08T00:13:20.413" LastActivityDate="2019-02-08T00:13:20.413" Title="How to keep a users cart active after logout - Craft Commerce 2" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29437" PostTypeId="2" ParentId="29406" CreationDate="2019-02-07T17:45:48.023" Score="1" Body="&lt;p&gt;After too much time spent on this, I think I found a solution to both issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) To prevent controller actions meant for the CP from being accessible on the front-end (via &lt;code&gt;actions/&amp;lt;module&amp;gt;/&amp;lt;controller&amp;gt;/&amp;lt;action&amp;gt;&lt;/code&gt; URLs), simply add this line of code at the top of the action's method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$this-&amp;gt;requireCpRequest();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The non-CP action URLs will now return a &lt;code&gt;400&lt;/code&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Although it doesn't seem possible to change the private template trigger on the CP to prevent any template from being directly accessed with a URL, using an underscore at the beginning of any file or folder in the path works. But even better -- the template root itself can be private:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Set the base CP template directory&#xA;Event::on(&#xA;    View::class,&#xA;    View::EVENT_REGISTER_CP_TEMPLATE_ROOTS,&#xA;    function(craft\events\RegisterTemplateRootsEvent $event) {&#xA;        $event-&amp;gt;roots['_module'] = $this-&amp;gt;getBasePath() . DIRECTORY_SEPARATOR . 'templates';&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the underscore in front of &lt;code&gt;_module&lt;/code&gt;. This ensures that the module's templates will only render programmatically.&lt;/p&gt;&#xA;" OwnerUserId="6909" LastActivityDate="2019-02-07T17:45:48.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29438" PostTypeId="1" CreationDate="2019-02-07T18:08:05.857" Score="0" ViewCount="98" Body="&lt;p&gt;When I uploaded the website to a new server, some transforms don't generate and throw an exception instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;HTTP status “401” encountered while attempting to download “https://domain.com/web/uploads/image.png”&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure what causes this - some images cause this problem and some don't. All are from the same asset source.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="57" LastEditDate="2019-02-08T00:14:42.913" LastActivityDate="2019-02-08T00:14:42.913" Title="Imager - HTTP status “401” error while generating transform" Tags="&lt;plugin-imager&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29439" PostTypeId="2" ParentId="29427" CreationDate="2019-02-07T18:25:15.663" Score="1" Body="&lt;p&gt;I inspected your form, and the redirect value is &lt;strong&gt;45e4c422dc3ef7c10d24f04e10a42c07affd1f5456fb253747b332aed6481678thanks&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps try being more explicit with your redirect, something like: &lt;code&gt;{{ redirectInput(siteUrl ~ 'thanks') }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-07T18:25:15.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29440" PostTypeId="2" ParentId="29385" CreationDate="2019-02-07T18:45:46.577" Score="1" Body="&lt;p&gt;Thanks to everyone for their input, but I solved the problem using an alternative fieldtype. I'd have rather stuck with a native fieldtype, but deadlines are an unforgiving mistress.&lt;/p&gt;&#xA;" OwnerUserId="9348" LastActivityDate="2019-02-07T18:45:46.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29441" PostTypeId="2" ParentId="29406" CreationDate="2019-02-07T18:57:13.150" Score="1" Body="&lt;p&gt;I think you're &quot;fighting the system&quot; for no great gain, but anyway I think this is what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    /**&#xA;     * @var bool|string[] Whether this controller’s actions can be accessed anonymously&#xA;     * If set to false, you are required to be logged in to execute any of the given controller's actions.&#xA;     * If set to true, anonymous access is allowed for all of the given controller's actions.&#xA;     * If the value is an array of action IDs, then you must be logged in for any actions except for the ones in&#xA;     * the array list.&#xA;     * If you have a controller that where the majority of actions allow anonymous access, but you only want require&#xA;     * login on a few, you can set this to true and call [[requireLogin()]] in the individual methods.&#xA;     */&#xA;    protected $allowAnonymous = false;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-02-07T18:57:13.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29442" PostTypeId="2" ParentId="29427" CreationDate="2019-02-08T00:20:38.937" Score="0" Body="&lt;p&gt;Responded to your Github issue, but my guess is you're getting a form validation error on submission and your template code isn't doing anything to display those errors.  You can see here for an example: &lt;a href=&quot;https://github.com/craftcms/guest-entries#usage&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/guest-entries#usage&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-08T00:20:38.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29443" PostTypeId="2" ParentId="29204" CreationDate="2019-02-08T00:44:39.380" Score="2" Body="&lt;p&gt;In Craft 3.1, permissions checks are done based on &lt;code&gt;uid&lt;/code&gt; now, not &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ currentUser.can('editEntries:'~entry.getSection().uid) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-08T00:44:39.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29444" PostTypeId="1" CreationDate="2019-02-08T05:42:12.723" Score="1" ViewCount="633" Body="&lt;p&gt;I'm trying to migrate to a server from my local environment. I keep getting Internal Server Error. I have the latest version of 3+ of CraftCMS. Everything works fine locally but on the server not so much. Here is what I'm seeing in my Craft log file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    2019-02-08 05:02:35 [-][-][-][error][yii\base\ErrorException:8] yii\base\ErrorException: unserialize(): Error at offset 352 of 93525 bytes in /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php:997&#xA;Stack trace:&#xA;#0 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler-&amp;gt;handleError(8, 'unserialize(): ...', '/home/kinolicli...', 997)&#xA;#1 [internal function]: craft\web\ErrorHandler-&amp;gt;handleError(8, 'unserialize(): ...', '/home/kinolicli...', 997, Array)&#xA;#2 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php(997): unserialize('a:17:{s:12:&quot;dat...', Array)&#xA;#3 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php(982): craft\services\ProjectConfig-&amp;gt;_getStoredConfig()&#xA;#4 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php(912): craft\services\ProjectConfig-&amp;gt;_getLoadedConfig()&#xA;#5 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php(227): craft\services\ProjectConfig-&amp;gt;_getConfigurationFromYaml()&#xA;#6 /home/kinoliclients/public_html/jbbls/cms/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\services\ProjectConfig-&amp;gt;init()&#xA;#7 [internal function]: yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The PHP log file gives a bit more information.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[08-Feb-2019 13:36:48 UTC] PHP Notice:  unserialize(): Error at offset 352 of 93525 bytes in /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php on line 997&#xA;[08-Feb-2019 13:36:48 UTC] An Error occurred while handling another error:&#xA;TypeError: Return value of craft\services\ProjectConfig::_getStoredConfig() must be of the type array, boolean returned in /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php:997&#xA;Stack trace:&#xA;#0 /home/kinoliclients/public_html/jbbls/cms/vendor/craftcms/cms/src/services/ProjectConfig.php(982): craft\services\ProjectConfig-&amp;gt;_getStoredConfig()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, just for context. I had the site running on the remote server but then did an update (the one that said, this is a difficult update). The update put it in a vegetative state (internal server error). The same update worked locally, so I then copied the files and database to the remote server hoping that would fix the issue remotely. However, it didn't. Was their a new PHP extension requirement or something, that might have done this?&lt;/p&gt;&#xA;" OwnerUserId="7931" LastEditorUserId="7931" LastEditDate="2019-02-08T13:41:41.150" LastActivityDate="2019-02-12T04:22:16.643" Title="Internal Server Error while migrating to new server" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29445" PostTypeId="1" CreationDate="2019-02-08T11:47:17.943" Score="1" ViewCount="79" Body="&lt;p&gt;I have created copy whole HTML from here (&lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&lt;/a&gt;). and trying to register but it's showing me an error or we can say it redirects me to 404 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;URL: lawbros.uldev.co/users/registration.html&lt;/p&gt;&#xA;" OwnerUserId="9366" LastEditorUserId="57" LastEditDate="2019-02-09T18:46:02.127" LastActivityDate="2019-02-09T18:46:02.127" Title="Craft 3 redirecting me 404 after fill up registration form" Tags="&lt;craft3&gt;&lt;registration&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29446" PostTypeId="2" ParentId="29445" CreationDate="2019-02-08T12:07:47.087" Score="1" Body="&lt;p&gt;I had made a small mistake to add action in the form tag. its 'users/saveUser' needs to be updated to 'users/save-user'.&lt;/p&gt;&#xA;" OwnerUserId="9366" LastActivityDate="2019-02-08T12:07:47.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29447" PostTypeId="1" AcceptedAnswerId="29449" CreationDate="2019-02-08T14:55:49.797" Score="1" ViewCount="678" Body="&lt;p&gt;Good morning, If have have a URL that passes parameters: &lt;a href=&quot;http://url?month=January&amp;amp;Year=2018&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://url?month=January&amp;amp;Year=2018&lt;/a&gt;, how would I go about querying all entries in section where the postDate equals January 2018?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the parameters by using: &lt;code&gt;craft.app.request.getParam('month')&lt;/code&gt; and &lt;code&gt;craft.app.request.getParam('year')&lt;/code&gt; but I can seem to figure out the correct way to only show me entries based on these parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I noticed a post that had the following answer and the response was that it worked. I tried it, and received the error:&#xA;&lt;code&gt;Object of class DateTime could not be converted to string&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('month') %}&#xA;{% set year = craft.request.getParam('year')  %}&#xA;&#xA;{% set firstDayOfMonth = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDayOfMonth = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;{% set entries = craft.entries.section('yourSection').postDate('and', '&amp;gt;= ' ~ firstDayOfMonth, '&amp;lt;= ' ~ lastDayOfMonth) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8678" LastEditorUserId="5836" LastEditDate="2019-07-30T15:40:19.180" LastActivityDate="2019-07-30T15:40:19.180" Title="Querying Entries by Month and Year" Tags="&lt;craft3&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29448" PostTypeId="2" ParentId="29447" CreationDate="2019-02-08T15:14:28.680" Score="2" Body="&lt;p&gt;You'll want to use the dateCreated entry query: &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#datecreated&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#datecreated&lt;/a&gt;. You'll also want to change the parameter to something like &lt;code&gt;?startdate=2018-01-01&amp;amp;enddate=2018-01-31&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# create variables for start and end dates, getting values from params #}&#xA;{% set start = craft.app.request.getParam(startdate)|atom %}&#xA;{% set end = craft.app.request.getParam(enddate)|atom %}&#xA;&#xA;{# loop through entries that match date created, and set loop to a variable #}&#xA;{% set entries = craft.entries()&#xA;    .dateCreated(['and', &quot;&amp;gt;= #{start}&quot;, &quot;&amp;lt; #{end}&quot;])&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-08T15:14:28.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29449" PostTypeId="2" ParentId="29447" CreationDate="2019-02-08T16:15:59.920" Score="3" Body="&lt;p&gt;Jon's answer is excellent, but if you want to keep the same &lt;code&gt;month&lt;/code&gt; and &lt;code&gt;year&lt;/code&gt; URL query params, I offer this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that &lt;code&gt;firstDayOfMonth&lt;/code&gt; and &lt;code&gt;lastDayOfMonth&lt;/code&gt; are PHP class objects and can't be inlined as text. They need to be formatted as text with a &lt;code&gt;date()&lt;/code&gt; or &lt;code&gt;atom&lt;/code&gt; filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's your code with the filters added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('month') %}&#xA;{% set year = craft.request.getParam('year')  %}&#xA;&#xA;{% set firstDayOfMonth = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set lastDayOfMonth = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;{% set entries = craft.entries.section('yourSection').postDate('and', '&amp;gt;= ' ~ (firstDayOfMonth|atom), '&amp;lt;= ' ~ (lastDayOfMonth|atom)) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can make it extra readable by using the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#after&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;after&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#before&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;before&lt;/code&gt;&lt;/a&gt; methods since your query is based on Craft's &lt;code&gt;postDate&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('month') %}&#xA;{% set year = craft.request.getParam('year')  %}&#xA;&#xA;{% set firstDayOfMonth = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;{% set firstDayOfNextMonth = firstDayOfMonth | date_modify('+1 month') %}&#xA;&#xA;{% set entries = craft.entries&#xA;    .section('yourSection')&#xA;    .after(firstDayOfMonth|atom)&#xA;    .before(firstDayOfNextMonth|atom)&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure you're aware, but it's worth noting for anyone finding this answer later: This is a bit fragile. If the URL query string does not have a valid month name and four-digit year number, it'll chuck errors.&lt;/p&gt;&#xA;" OwnerUserId="593" LastActivityDate="2019-02-08T16:15:59.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29450" PostTypeId="2" ParentId="29447" CreationDate="2019-02-08T16:34:29.233" Score="1" Body="&lt;p&gt;I also found a solution. Seems to be working correctly. If I can simplify it, please let me know.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% set month = craft.app.request.getParam('month') ?? null %}&#xA;            {% set year = craft.app.request.getParam('year') ?? null %}&#xA;&#xA;            {% set firstDayOfMonth = now | date_modify('first day of ' ~ month ~ ' ' ~ year ~ ' 00:00:00') %}&#xA;            {% set lastDayOfMonth = now | date_modify('last day of ' ~ month ~ ' ' ~ year ~ ' 23:59:59') %}&#xA;&#xA;            {% set firstDayOfMonth = firstDayOfMonth|date('Y-m-d') %}&#xA;            {% set lastDayOfMonth = lastDayOfMonth|date('Y-m-d') %}&#xA;&#xA;            {% if month|length %}&#xA;                {# {% set newsEntries = craft.entries.section('news').postDate('and', '&amp;gt;= ' ~ firstDayOfMonth|date('Y-m-d'), '&amp;lt;= ' ~ lastDayOfMonth|date('Y-m-d')) %} #}&#xA;                {% paginate craft.entries.section('news').postDate(['and', &quot;&amp;gt;= #{firstDayOfMonth}&quot;, &quot;&amp;lt;= #{lastDayOfMonth}&quot;]).orderBy('postDate desc').limit(10) as newsInfo, newsEntries %}&#xA;                &amp;lt;h3&amp;gt;{{ month}} {{ year }} Archives&amp;lt;/h3&amp;gt;&#xA;            {% else %}&#xA;                {% paginate craft.entries.section('news').orderBy('postDate desc').limit(10) as newsInfo, newsEntries %}&#xA;                &amp;lt;h3&amp;gt;All Releases&amp;lt;/h3&amp;gt;&#xA;            {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8678" LastActivityDate="2019-02-08T16:34:29.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29451" PostTypeId="1" CreationDate="2019-02-08T18:04:31.020" Score="1" ViewCount="274" Body="&lt;p&gt;I'm getting the following internal server error message when I try and make a change on my website. It is only happening on one page! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;file_get_contents(&lt;a href=&quot;https://maps.googleapis.com/maps/api/geocode/json?sensor=false&amp;amp;address=610+Bunker+Ave.+Kellogg%2C+Idaho+83837&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://maps.googleapis.com/maps/api/geocode/json?sensor=false&amp;amp;address=610+Bunker+Ave.+Kellogg%2C+Idaho+83837&lt;/a&gt;): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden&lt;/p&gt;&#xA;" OwnerUserId="9368" LastEditorUserId="57" LastEditDate="2019-02-11T03:27:03.983" LastActivityDate="2019-02-11T03:27:03.983" Title="Internal server error message" Tags="&lt;entries&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29452" PostTypeId="1" AcceptedAnswerId="29542" CreationDate="2019-02-08T18:24:37.917" Score="1" ViewCount="2820" Body="&lt;p&gt;I'm new to using Composer and I'm having trouble deploying to Laravel Forge. I am getting an error message that says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Your requirements could not be resolved to an installable set of packages.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Problem 1&#xA;      - Installation request for illuminate/support v5.5.44 -&gt; satisfiable by illuminate/support[v5.5.44].&#xA;      - don't install tightenco/collect v5.5.33|don't install illuminate/support v5.5.44&#xA;      - Installation request for tightenco/collect v5.5.33 -&gt; satisfiable by tightenco/collect[v5.5.33].&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I didn't add these packages, they are dependencies of something I have added. So I have a few questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, how do I resolve this? I am thinking that I should not go in and try to change the version numbers on anything because that would break things most likely, correct? Also, since they are not in my composer.json file, I'm not sure how I would do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, how do I determine what package I am installing uses this as a dependency? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, I have a couple of plugins that I have uninstalled in the CP that are still showing up in the composer.json file.Do I need to go back into my composer.json file and remove them? I thought this was done automatically when a plugin was uninstalled, but that may be my mistake. I am wondering if one or more of those plugins might be the culprit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brian&lt;/p&gt;&#xA;" OwnerUserId="2265" LastActivityDate="2019-02-15T23:33:39.573" Title="How do I resolve dependency conflicts in Composer?" Tags="&lt;craft3&gt;&lt;composer&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29453" PostTypeId="1" CreationDate="2019-02-09T11:04:05.727" Score="1" ViewCount="62" Body="&lt;p&gt;I'm getting this strange error when I'm trying to upload an .jpg in the assets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Env: Localhost&lt;br&gt;&#xA;Craft version 3.1.8  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MAMP:&lt;br&gt;&#xA;- PHP(7.2.7)&lt;br&gt;&#xA;- MySQL: 5.7.21&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upload failed. The error message was: &quot;SQLSTATE[23000]: Integrity constant violation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SobPU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SobPU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9369" LastActivityDate="2019-02-09T16:02:28.730" Title="Upload failed. The error message was: &quot;SQLSTATE[23000]: Integrity constant violation:" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;mysql&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29454" PostTypeId="1" CreationDate="2019-02-09T11:38:47.850" Score="1" ViewCount="473" Body="&lt;p&gt;I converted a channel into a structure and now my entries are listed in reverse order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a very large number of entries. Is there a way or a plugin to permanently sort them and store the order?&lt;/p&gt;&#xA;" OwnerUserId="9370" LastEditorUserId="9370" LastEditDate="2019-02-09T23:42:51.013" LastActivityDate="2019-02-09T23:42:51.013" Title="How to reorder structure entries in the Admin panel?" Tags="&lt;structure&gt;&lt;order&gt;&lt;sort&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29455" PostTypeId="1" AcceptedAnswerId="31492" CreationDate="2019-02-09T13:17:21.963" Score="1" ViewCount="190" Body="&lt;p&gt;I have a Super Table field with two columns, one is a category field, the other an assets field (limit 1 on both). How can I iterate through it to get the category and asset selected for each row in the table?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$superTable = $entry-&amp;gt;colors;&#xA;foreach ($superTable as $row) {&#xA;    // Category field handle is `color`&#xA;    // Asset field handle is `image`&#xA;&#xA;    // I've tried various things here, but I don't understand how to get the fields&#xA;    // I'm looking for the category ID and asset ID in every row of the table&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2019-09-10T14:06:05.013" Title="Iterate through Super Table field in plugin" Tags="&lt;plugin-development&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29456" PostTypeId="2" ParentId="29454" CreationDate="2019-02-09T14:31:50.617" Score="1" Body="&lt;p&gt;I don't know if there's a quick/easy way to do this within the admin area, but if you go to Entries, then click on your Structure, there's a little 4-dot symbol to the left of the Entry's title (make sure you have Structure selected in the drop-down to the right of the Search bar). You can click that 4-dot icon and move them around manually. Doing this will reorder the way entries appear on your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just looking to reorder the entries within the admin area (and not reorder them on the front-end site), then click the drop-down to the right of the Search bar. You'll see options like Title and Post Date. Once you click one of those, you'll see headers for Title, Post Date, etc., that you can click on to sort entries. Again, this method won't affect how entries are displayed on your site; this only affects the admin area.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-09T14:31:50.617" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29457" PostTypeId="2" ParentId="29453" CreationDate="2019-02-09T14:36:14.923" Score="1" Body="&lt;p&gt;Does this only happen with this one particular image? If so, try renaming the image file to golden-pothos-2.jpg or something and then uploading again.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-09T14:36:14.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29458" PostTypeId="2" ParentId="29451" CreationDate="2019-02-09T14:42:06.687" Score="1" Body="&lt;p&gt;I'm guessing you're using some sort of Google Maps plugin on your site. Google recently started limiting access to their Maps API, and now you need a key to be able to make Maps requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go here to request an API key: &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/get-api-key&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://developers.google.com/maps/documentation/javascript/get-api-key&lt;/a&gt;. Then input the key into whatever plugin is using Google Maps. There should be a field in the plugin settings that asks for the key.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-09T14:42:06.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29459" PostTypeId="2" ParentId="29453" CreationDate="2019-02-09T16:02:28.730" Score="1" Body="&lt;p&gt;Do as Jon mentioned. This was a bug that will be fixed in the next release &lt;a href=&quot;https://github.com/craftcms/cms/issues/3773&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3773&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9344" LastActivityDate="2019-02-09T16:02:28.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29461" PostTypeId="2" ParentId="18182" CreationDate="2019-02-09T20:02:55.693" Score="3" Body="&lt;p&gt;For those using Craft Commerce 2, additional address validation rules can be added by using to the &lt;code&gt;Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\commerce\events\RegisterAddressRulesEvent;&#xA;use craft\commerce\models\Address;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(&#xA;    Address::class,&#xA;    Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES,&#xA;    function (RegisterAddressRulesEvent $event) {&#xA;        $event-&amp;gt;rules[] = [['attention'], 'required'];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/events.html#other-events&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/events.html#other-events&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="993" LastEditorUserId="993" LastEditDate="2019-03-05T07:56:43.120" LastActivityDate="2019-03-05T07:56:43.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29465" PostTypeId="1" CreationDate="2019-02-10T11:22:50.170" Score="0" ViewCount="44" Body="&lt;p&gt;I'm working locally and am unable to create or edit fields if I have project config enabled in general.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;  'useProjectConfigFile' =&amp;gt; true,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I change that to false I can add fields, but as soon as I change it back to true, the fields disappear from the control panel.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-02-10T11:22:50.170" Title="Cannot add new field when Project Config enabled" Tags="&lt;projectconfig&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29466" PostTypeId="1" AcceptedAnswerId="29473" CreationDate="2019-02-10T12:13:44.517" Score="1" ViewCount="86" Body="&lt;p&gt;I'm using Feedme to &lt;a href=&quot;https://verbb.io/craft-plugins/feed-me/docs/feature-tour/using-in-your-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;display content in my temmplates&lt;/a&gt; from a podcast RSS feed - &lt;strong&gt;not&lt;/strong&gt; importing entries, just displaying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is working fine except that I can't display the &lt;code&gt;&amp;lt;itunes:summary&amp;gt;&lt;/code&gt; node.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use this code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# podcaast #}&#xA;{% set params = {&#xA;    url: 'https://website101podcast.com/feed.rss',&#xA;    type: 'rss',&#xA;    element: 'item',&#xA;    cache: 60,&#xA;} %}&#xA;&#xA;{% set feed = craft.feedme.feed(params) %}&#xA;&#xA;&#xA;{% for node in feed|reverse %}&#xA;  {% if loop.index &amp;lt;= 1 %}&#xA;    &amp;lt;h3 &amp;gt;{{ node.title }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p&amp;gt;{{ itunes:summary }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ node.link }}&quot;&amp;gt;Listen Now&amp;lt;/a&amp;gt;&amp;lt;!-- /.btn btn-default --&amp;gt;&#xA;  {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following template errors:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unexpected token &quot;punctuation&quot; of value &quot;:&quot; (&quot;end of print statement&quot; expected).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is it possible to call in the itunes field?&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-02-10T20:59:29.103" Title="Feed Me in Templates - can't pull in &lt;itunes:summary&gt;" Tags="&lt;templating&gt;&lt;plugin-feedme&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29467" PostTypeId="1" CreationDate="2019-02-10T12:36:12.853" Score="1" ViewCount="190" Body="&lt;p&gt;I am working on my SEO and I am getting a duplicate title in Craft.&#xA;I want to make a custom title using the URI segment in using PHP.&lt;/p&gt;&#xA;" OwnerUserId="9372" LastEditorUserId="57" LastEditDate="2019-02-11T03:39:44.047" LastActivityDate="2019-02-11T03:39:44.047" Title="Custom title using URI segment" Tags="&lt;craft3&gt;&lt;php&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29468" PostTypeId="2" ParentId="29467" CreationDate="2019-02-10T16:24:55.620" Score="1" Body="&lt;p&gt;You can use something like this in your main layout template. You'll need to add a filter after &quot;segments&quot; to get the URI segment you want, e.g.: &lt;code&gt;|first&lt;/code&gt; or &lt;code&gt;|last&lt;/code&gt;, and you'll also need to &lt;a href=&quot;https://docs.craftcms.com/v3/dev/filters.html#replace&quot; rel=&quot;nofollow noreferrer&quot;&gt;|replace&lt;/a&gt; any hyphens and then &lt;a href=&quot;https://twig.symfony.com/doc/2.x/filters/capitalize.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;|capitalize&lt;/a&gt; the first letter of the result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myUri = craft.app.request.segments %}&#xA;&#xA;&amp;lt;title&amp;gt;{{ myUri }}&amp;lt;/title&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more on segments: &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-10T16:24:55.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29469" PostTypeId="2" ParentId="29466" CreationDate="2019-02-10T16:29:53.010" Score="1" Body="&lt;p&gt;I'm guessing it's this line: &lt;code&gt;&amp;lt;p&amp;gt;{{ itunes:summary }}&amp;lt;/p&amp;gt;&lt;/code&gt;. Does &lt;code&gt;&amp;lt;p&amp;gt;{{ itunes.summary }}&amp;lt;/p&amp;gt;&lt;/code&gt; work (replaced the : with a .)?&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-02-10T16:29:53.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29471" PostTypeId="1" CreationDate="2019-02-10T19:14:38.013" Score="1" ViewCount="15" Body="&lt;p&gt;A small team and I have inherited a Craft 2 site. We are brand new to craft with no previous experience with it. In wanting to work on offline copies of the sight the team is attempting to migrate the Craft site to our local LAMP servers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The migration seems to have been somewhat successful. We are able to access the homepage of the site but there is no styling (please see image). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gTkY5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gTkY5.png&quot; alt=&quot;image of HTML but no CSS styling&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the links click through to Not Found errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what additional information can be provided to help troubleshoot the problem. If I can provide the data I will! Thanks for any assistance you can provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps. I wasn't sure if this is the correct place to ask this question. If it isn't please relocate it&lt;/p&gt;&#xA;" OwnerUserId="9374" LastEditorUserId="57" LastEditDate="2019-02-11T03:42:36.413" LastActivityDate="2019-02-11T03:42:36.413" Title="Templating not displaying after Craft server migration" Tags="&lt;craft2&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29473" PostTypeId="2" ParentId="29466" CreationDate="2019-02-10T20:59:29.103" Score="2" Body="&lt;p&gt;You'll not be able to use the dot notation here, and instead use the array notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try: &lt;code&gt;{{ node['itunes:summary'] }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-02-10T20:59:29.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29474" PostTypeId="1" CreationDate="2019-02-10T21:15:41.257" Score="1" ViewCount="364" Body="&lt;p&gt;I've moved my Craft 3 installation to a new server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When connecting to the original database, everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when trying to connect to a new MySQL database (I've tried hosting this on both the new server and RDS) I'm getting the error: &lt;code&gt;Access denied for user&lt;/code&gt;. I migrated to the new database by exporting via the Craft CP and then importing to the new database via MySQL Workbench.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried connecting to both servers using a vanilla PHP connection (i.e. &lt;code&gt;new mysqli(host, username, password)&lt;/code&gt; and it works perfectly fine -- I can even query the database and return results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only run into this error when the connection is opened by the original Craft &lt;code&gt;index.php&lt;/code&gt; (the one with the &lt;code&gt;$app-&amp;gt;run()&lt;/code&gt; command). I've checked the output of the &lt;code&gt;(new Dotenv\Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&lt;/code&gt; line and it does properly return the settings defined in &lt;code&gt;.env&lt;/code&gt;, which are the same as the ones used in the vanilla connection I mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The side-effect of this error in &lt;code&gt;storage/logs/phperrors.log&lt;/code&gt; is &lt;code&gt;Allowed memory size of &amp;lt;memory_limit&amp;gt; bytes exhausted ... in /var/www/craft/vendor/yiisoft/yii2/db/Connection.php&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5364" LastActivityDate="2019-02-10T23:46:20.517" Title="MySQL &quot;Access denied for user&quot; after moving to new server" Tags="&lt;craft3&gt;&lt;database&gt;&lt;migration&gt;&lt;mysql&gt;&lt;aws&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29475" PostTypeId="2" ParentId="29474" CreationDate="2019-02-10T23:46:20.517" Score="1" Body="&lt;p&gt;Seems this is not a Craft issue at all, but an issue with MySQL connections over PDO. Not sure of the precise environmental conditions that cause this, but I was experiencing the issue on both an AWS EC2 Ubuntu server as well as a MySQL RDS instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I discovered the solution here: &lt;a href=&quot;https://stackoverflow.com/questions/38809418/unable-to-connect-to-aws-rds-through-pdo&quot;&gt;https://stackoverflow.com/questions/38809418/unable-to-connect-to-aws-rds-through-pdo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the &lt;code&gt;!&lt;/code&gt; in my password was causing the problem. After replacing it with a &lt;code&gt;.&lt;/code&gt;, the issue is resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks Amazon...&lt;/p&gt;&#xA;" OwnerUserId="5364" LastActivityDate="2019-02-10T23:46:20.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29477" PostTypeId="1" AcceptedAnswerId="29508" CreationDate="2019-02-11T02:15:06.973" Score="1" ViewCount="338" Body="&lt;p&gt;This is the template im using and the index of the file is taking the css and printing it nicely however, the _entry.twig is only loading text, please check out the screenshots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the index of directory which loads css completely fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And one after is the _entry.twig which isn't taking any CSS.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TTAej.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TTAej.png&quot; alt=&quot;index of the directory&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oBzop.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oBzop.png&quot; alt=&quot;This is _entry.twig of the same directory which isn&amp;#39;t loadingany css&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9138" LastActivityDate="2019-02-13T20:22:27.413" Title="_entry.twig isn't reading css while index does" Tags="&lt;craft3&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29478" PostTypeId="1" AcceptedAnswerId="29479" CreationDate="2019-02-11T07:22:50.990" Score="1" ViewCount="42" Body="&lt;p&gt;I need some help. Really struggle understanding how to build relationships between channels/entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Context/Want:&#xA;I have two separate channels:&#xA;1. &quot;Plant catalogue&quot;&#xA;2. &quot;Plant care&quot;&#xA;I want to re-use the entries from &quot;Plant catalogue&quot; across the whole website wherever I need it accesing speicifc fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have:&#xA;&quot;Plant care&quot; has an entries field type to help build the relationship with &quot;Plant catalogue&quot;: field name: &quot;plantEntity&quot;&#xA;&quot;Plant catalogue&quot; has an asset field that include a photo of the plant. fiel name: &quot;plantPhoto&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plantcareListing = craft.entries().section('plantCare').limit(null)%}&#xA;{% set entries = plantcareListing.all() %}&#xA;&#xA;{% for entry in entries %}&#xA;  {% for image in entry.plantEntity %} {# how do I access the asset field &quot;plantPhoto&quot; here? :( #}&#xA;    &amp;lt;img src=&quot;{{ image.getUrl() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;  {% endfor %}&#xA;&#xA;  {{ entry.title }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would appreciate your advice. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9375" LastActivityDate="2019-02-11T09:16:35.590" Title="Relationship between channels/entries" Tags="&lt;entries&gt;&lt;relations&gt;&lt;channels&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29479" PostTypeId="2" ParentId="29478" CreationDate="2019-02-11T09:05:26.403" Score="2" Body="&lt;p&gt;It’s important to understand that using relations fields in the template works similar to using &lt;code&gt;craft.entries&lt;/code&gt;. They return a &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;element query object&lt;/a&gt;, for example &lt;code&gt;entry.plantEntity&lt;/code&gt; in your entries loop. And you need to call the &lt;code&gt;all()&lt;/code&gt; method on them to query for the elements. The same applies to querying for the asset elements in your inner entries loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plantCares = craft.entries&#xA;    .section('plantCare')&#xA;    .all() %}&#xA;&#xA;{% for plantCare in plantCares %}&#xA;    {% for plantEntity in plantCare.plantEntity.all() %}&#xA;        {% for plantPhoto in plantEntity.plantPhoto.all() %}&#xA;            &amp;lt;img src=&quot;{{ plantPhoto.getUrl() }}&quot; alt=&quot;{{ plantPhoto.title }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {{ plantEntity.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should generally avoid querying in a loop though, and use &lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;eager-loading&lt;/a&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set plantCares = craft.entries&#xA;    .section('plantCare')&#xA;    .with([&#xA;        'plantEntity',&#xA;        'plantEntity.plantPhoto'&#xA;    ])&#xA;    .all() %}&#xA;&#xA;{% for plantCare in plantCares %}&#xA;    {% for plantEntity in plantCare.plantEntity %}&#xA;        {% for plantPhoto in plantEntity.plantPhoto %}&#xA;            &amp;lt;img src=&quot;{{ plantPhoto.getUrl() }}&quot; alt=&quot;{{ plantPhoto.title }}&quot;&amp;gt;&#xA;        {% endfor %}&#xA;&#xA;        {{ plantEntity.title }}&#xA;    {% endfor %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you’ve got many &lt;code&gt;plantCare&lt;/code&gt; entries consider &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/paginate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;paginating&lt;/a&gt; through them.&lt;/p&gt;&#xA;" OwnerUserId="125" LastEditorUserId="125" LastEditDate="2019-02-11T09:16:35.590" LastActivityDate="2019-02-11T09:16:35.590" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29480" PostTypeId="1" CreationDate="2019-02-11T09:39:02.760" Score="3" ViewCount="219" Body="&lt;p&gt;We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at Solspace Calendar, it offers almost exactly the fields we need for this out of the box: (screenshot below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to either:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Recreate this setup as fields on a Commerce product . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Create a relationship between a Solspace Calendar event and a Commerce product (that only allows for a certain number of products to be sold for each date in the calendar).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XfjR8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XfjR8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="7356" LastEditDate="2019-02-11T09:51:10.913" LastActivityDate="2019-02-13T14:23:25.663" Title="Selling tickets to repeating events with Commerce (and Solspace Calendar?)" Tags="&lt;craft3&gt;&lt;events&gt;&lt;plugin-craftcommerce2&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29481" PostTypeId="1" AcceptedAnswerId="29515" CreationDate="2019-02-11T18:39:31.487" Score="1" ViewCount="31" Body="&lt;p&gt;I have  a client who would like to edit a users permissions. However instead of adding permissions on a per user basis, they would like to remove permissions for that user by unchecking the item. However because it's enabled for the users usergroup it's not possible to uncheck. Am I missing something? Or should we create a new user group?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nI2mv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nI2mv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the above photo I'd like to uncheck, for this user only, a couple of different permissions.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-02-13T23:10:28.143" Title="Revoke user permissions but not change the usergroup" Tags="&lt;users&gt;&lt;permissions&gt;&lt;user-groups&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29483" PostTypeId="1" AcceptedAnswerId="29532" CreationDate="2019-02-11T21:38:50.807" Score="1" ViewCount="141" Body="&lt;p&gt;I've been able to repopulate text fields this way, but the radio buttons remain unchecked even when there was a value submitted.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for field in application.fieldMetaData %}&#xA;    {% set submittedValues = submittedValues|merge({ (field.handle): attribute(application, field.handle).value}) %}&#xA;{% endfor %}&#xA;&#xA;{% if form|length %}&#xA;    {{ craft.freeform.form(form.handle, {&#xA;      returnUrl: '/',&#xA;      overrideValues: submittedValues&#xA;    }).render() }}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7423" LastEditorUserId="7423" LastEditDate="2019-02-11T23:12:36.120" LastActivityDate="2019-02-14T15:07:10.447" Title="Is it possible to repopulate radio button inputs with values from submission.fieldMetaData using the standard form.render() method?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29484" PostTypeId="1" AcceptedAnswerId="29485" CreationDate="2019-02-12T00:13:08.787" Score="1" ViewCount="1869" Body="&lt;p&gt;I have made a Craft 3 plugin that is manually used in the Craft Admin CP area; click a button and we sync products in Craft with a Shopify API. Now I am trying to automate the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iMymh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iMymh.png&quot; alt=&quot;Craft 3 Admin CP Plugin Section &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to schedule a task that runs the controller that is executed when an admin user manually clicks the &lt;em&gt;Manual Sync&lt;/em&gt; button, shown above. Clicking the button runs the actionIndex() method of my plugin's controller, which extends the Craft 3 web controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace vendor\shopify\controllers;&#xA;&#xA;use \vendor\shopify\Shopify;&#xA;use craft\elements\Entry;&#xA;use craft\elements\MatrixBlock;&#xA;use DateTime;&#xA;&#xA;class SyncController extends \craft\web\Controller&#xA;{&#xA;    public function actionIndex()&#xA;    {&#xA;        $apiKey = \vendor\shopify\Shopify::getInstance()-&amp;gt;getSettings()-&amp;gt;apiKey;&#xA;        $password = \vendor\shopify\Shopify::getInstance()-&amp;gt;getSettings()-&amp;gt;password;&#xA;        $secret = \vendor\shopify\Shopify::getInstance()-&amp;gt;getSettings()-&amp;gt;secret;&#xA;        $hostname = \vendor\shopify\Shopify::getInstance()-&amp;gt;getSettings()-&amp;gt;hostname;&#xA;&#xA;        $curl = curl_init();&#xA;        curl_setopt_array($curl, array(&#xA;            CURLOPT_URL =&amp;gt; &quot;https://$apiKey:$password@$hostname/admin/products.json&quot;,&#xA;            CURLOPT_RETURNTRANSFER =&amp;gt; true,&#xA;            CURLOPT_ENCODING =&amp;gt; &quot;&quot;,&#xA;            CURLOPT_MAXREDIRS =&amp;gt; 10,&#xA;            CURLOPT_TIMEOUT =&amp;gt; 30,&#xA;            CURLOPT_HTTP_VERSION =&amp;gt; CURL_HTTP_VERSION_1_1,&#xA;            CURLOPT_CUSTOMREQUEST =&amp;gt; &quot;GET&quot;,&#xA;            CURLOPT_POSTFIELDS =&amp;gt; &quot;&quot;,&#xA;            CURLOPT_HTTPHEADER =&amp;gt; array(&#xA;                &quot;cache-control: no-cache&quot;&#xA;            ),&#xA;        ));&#xA;        $response = curl_exec($curl);&#xA;        $err = curl_error($curl);&#xA;        curl_close($curl);&#xA;&#xA;        if ($err) {&#xA;            \Craft::info(&quot;(Vendor Shopify plugin) cURL Error #:&quot; . $err, __METHOD__);&#xA;        }&#xA;        else {&#xA;            $section = \Craft::$app-&amp;gt;sections-&amp;gt;getSectionByHandle('products');&#xA;            $entryTypes = $section-&amp;gt;getEntryTypes();&#xA;&#xA;            foreach (json_decode($response)-&amp;gt;products as $product) {&#xA;                $query = Entry::find();&#xA;                $query-&amp;gt;section('products');&#xA;                $query-&amp;gt;shopifyProduct($product-&amp;gt;id);&#xA;                $currentEntries = $query-&amp;gt;exists();&#xA;&#xA;                if ($currentEntries) {&#xA;                    $existingEntry = $query-&amp;gt;all();&#xA;                    $existingEntry = $existingEntry[0];&#xA;                    $blockIds = [];&#xA;&#xA;                    $field = \Craft::$app-&amp;gt;getFields()-&amp;gt;getFieldByHandle('productVariants');&#xA;                    $existingMatrixQuery = $existingEntry-&amp;gt;getFieldValue('productVariants');&#xA;&#xA;                    foreach ($existingMatrixQuery-&amp;gt;all() as $block) {&#xA;                        $blockIds[] = $block-&amp;gt;id;&#xA;                        \Craft::info(&quot;(Vendor Shopify plugin) Block Id??: &quot; . json_encode($block-&amp;gt;id), __METHOD__);&#xA;                    }&#xA;&#xA;                    $serializedMatrix = $field-&amp;gt;serializeValue($existingMatrixQuery, $existingEntry);&#xA;&#xA;                    if (count($product-&amp;gt;variants) === count($blockIds)) {&#xA;                        foreach ($product-&amp;gt;variants as $key =&amp;gt; $variant) {&#xA;                            $serializedMatrix[$blockIds[$key]] = [&#xA;                                'type' =&amp;gt; 'productVariant',&#xA;                                'enabled' =&amp;gt; true,&#xA;                                'fields' =&amp;gt; [&#xA;                                    'sku' =&amp;gt; $variant-&amp;gt;sku,&#xA;                                    'variantSize' =&amp;gt; $variant-&amp;gt;title,&#xA;                                    'variantPrice' =&amp;gt; number_format((float)$variant-&amp;gt;price, 2, '.', ''),&#xA;                                    'variantCompareAtPrice' =&amp;gt; number_format((float)$variant-&amp;gt;compare_at_price, 2, '.', ''),&#xA;                                    'variantQuantity' =&amp;gt; $variant-&amp;gt;inventory_quantity,&#xA;                                ]&#xA;                            ];&#xA;                        }&#xA;                    }&#xA;                    else {&#xA;                        $serializedMatrix = [];&#xA;                        foreach ($product-&amp;gt;variants as $key =&amp;gt; $variant) {&#xA;                            $serializedMatrix['new' . $key] = [&#xA;                                'type' =&amp;gt; 'productVariant',&#xA;                                'enabled' =&amp;gt; true,&#xA;                                'fields' =&amp;gt; [&#xA;                                    'sku' =&amp;gt; $variant-&amp;gt;sku,&#xA;                                    'variantSize' =&amp;gt; $variant-&amp;gt;title,&#xA;                                    'variantPrice' =&amp;gt; number_format((float)$variant-&amp;gt;price, 2, '.', ''),&#xA;                                    'variantCompareAtPrice' =&amp;gt; number_format((float)$variant-&amp;gt;compare_at_price, 2, '.', ''),&#xA;                                    'variantQuantity' =&amp;gt; $variant-&amp;gt;inventory_quantity,&#xA;                                ]&#xA;                            ];&#xA;                        }&#xA;                    };&#xA;&#xA;                    $existingEntry-&amp;gt;setFieldValues([&#xA;                        'productDescription' =&amp;gt; $product-&amp;gt;body_html,&#xA;                        'productVariants' =&amp;gt; $serializedMatrix,&#xA;                    ]);&#xA;&#xA;                    $success = \Craft::$app-&amp;gt;elements-&amp;gt;saveElement($existingEntry);&#xA;&#xA;                    if (!$success) {&#xA;                        \Craft::info(&quot;(Vendor Shopify plugin) Error Saving Product: &quot; . $product-&amp;gt;title . &quot; &quot; . $err, __METHOD__);&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;        \Craft::$app-&amp;gt;getSession()-&amp;gt;setNotice('Manual Sync complete.');&#xA;        return $this-&amp;gt;renderTemplate('shopify/done');&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far, I have explored options discussed in these two StackExchange questions that are somewhat related to my issue (&lt;a href=&quot;https://craftcms.stackexchange.com/questions/16233/call-craft-controller-with-cron-job&quot;&gt;Call Craft controller with cron job&lt;/a&gt; and &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12973/craft-taskservice-overview-cron-job&quot;&gt;Craft TaskService Overview/Cron Job&lt;/a&gt;). Unfortunately my labors haven't been fruitful! I am open to any and all suggestions in regards to how I might accomplish the automation of calling this plugin class's actionIndex method. Thank you, I sincerely appreciate any feedback!&lt;/p&gt;&#xA;" OwnerUserId="9248" LastEditorUserId="9" LastEditDate="2019-02-12T01:18:09.260" LastActivityDate="2019-02-12T19:04:28.693" Title="Craft 3: Cron job to run Controller actionIndex method of a Plugin" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugins&gt;&lt;cron&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29485" PostTypeId="2" ParentId="29484" CreationDate="2019-02-12T01:08:34.450" Score="3" Body="&lt;p&gt;You could add console command in your plugin then use third party cron job package to run the console command, your console command will be responsible for calling index function. i had similar kind of requirement earlier, i accomplished this using third party cron job package which was dependency for my plugin to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is new craft 3 plugin call scheduler &lt;a href=&quot;https://github.com/supercool/scheduler&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/supercool/scheduler&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not 100% sure that this idea will work on your side but just a heads up for you to get started.&lt;/p&gt;&#xA;" OwnerUserId="8099" LastActivityDate="2019-02-12T01:08:34.450" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29486" PostTypeId="2" ParentId="29444" CreationDate="2019-02-12T04:22:16.643" Score="1" Body="&lt;p&gt;It ended up being an unserialization issue. After exporting the sql file, I updated it with the new domain. The serialization part within the craft_info table needs to have the correct character length in front of the domain. Fixing that fixed my problem.&lt;/p&gt;&#xA;" OwnerUserId="7931" LastActivityDate="2019-02-12T04:22:16.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29488" PostTypeId="2" ParentId="29372" CreationDate="2019-02-12T12:40:38.367" Score="1" Body="&lt;p&gt;At first glance I cannot tell you why your plugin runs intermittently.&#xA;But if your plugin is interacting with Charge, there are some log functions you can use that may be helpful. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;charge_log-&amp;gt;email(&quot;yada yada&quot;);&#xA;craft()-&amp;gt;charge_log-&amp;gt;note(&quot;yada yada&quot;);&#xA;craft()-&amp;gt;charge_log-&amp;gt;error(&quot;yada yada&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2019-02-12T12:40:38.367" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29489" PostTypeId="1" CreationDate="2019-02-12T12:59:52.503" Score="1" ViewCount="212" Body="&lt;p&gt;I just created my first Craft 3 plugin. In the plugin I also have a custom (select)field. Everything is working as expected, which is great!&#xA;But I can't for the life of me figure out, how to add this field as a Table Column? It's not showing up. The field is added and filled in the entries within the section. Just to be clear, this is where I mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IbK14.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IbK14.png&quot; alt=&quot;Table Columns&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7532" LastActivityDate="2019-02-13T10:24:02.793" Title="Custom plugin field in Table Columns?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29490" PostTypeId="1" AcceptedAnswerId="29491" CreationDate="2019-02-12T13:10:25.283" Score="2" ViewCount="348" Body="&lt;p&gt;The newer versions of Craft CMS stimulate using environment variables in the CP. It works perfectly. I have set two variables for sites in my .env file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DUTCH_SITE_URL=&quot;http://company.test&quot;&#xA;ENGLISH_SITE_URL=&quot;http://company.test/en&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One thing that's not clear to me is the right way to request the baseUrl in templates. For example: I'm using a simple language switcher to switch between two languages:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.getAllSites() | without(currentSite) %}&#xA;{% for site in sites %}&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ site.baseUrl }}&quot; title=&quot;{{ site.language }}&quot;&amp;gt;{{ site.language }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When viewing the Dutch website the language switcher shows the link to the English website. The problem is that site.baseUrl outputs the environment variables instead of the English site url. The link looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://company.test/$ENGLISH_SITE_URL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the proper way to deal with this?&lt;/p&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2019-02-12T15:03:00.590" Title="baseUrl outputs environment variable" Tags="&lt;craft3&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29491" PostTypeId="2" ParentId="29490" CreationDate="2019-02-12T15:03:00.590" Score="2" Body="&lt;p&gt;You can get it to return the url using the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#siteurl-path-params-scheme-siteid&quot; rel=&quot;nofollow noreferrer&quot;&gt;siteUrl function&lt;/a&gt; and passing it a &lt;code&gt;siteId&lt;/code&gt; parameter. So do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set sites = craft.app.sites.getAllSites() | without(currentSite) %}&#xA;{% for site in sites %}&#xA;   &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl(siteId=site.id) }}&quot; title=&quot;{{ site.language }}&quot;&amp;gt;{{ site.language }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know if it's the best way but it works :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-12T15:03:00.590" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29492" PostTypeId="2" ParentId="19822" CreationDate="2019-02-12T15:58:43.730" Score="1" Body="&lt;p&gt;I came across this post while searching for the same answer. Figured it out eventually. For future reference, the correct syntax in a (Craft 2) plugin would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$criterea-&amp;gt;with = [&#xA;    [&quot;coolImage&quot;, [&quot;withTransforms&quot; =&amp;gt; [&quot;transform&quot;]]],&#xA;    &quot;otherAssetField&quot;,&#xA;    &quot;someCategoryField&quot;&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9386" LastActivityDate="2019-02-12T15:58:43.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29493" PostTypeId="2" ParentId="29484" CreationDate="2019-02-12T19:04:28.693" Score="2" Body="&lt;p&gt;I took the route of adding a controller with methods that could be triggered as craft console commands, and then simply ran these commands via cron tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;strong&gt;init()&lt;/strong&gt; public method of the main plugin class, I added the console commands controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function init()&#xA;{&#xA;   // ...&#xA;&#xA;   // Add in our console commands&#xA;   if (Craft::$app instanceof ConsoleApplication) {&#xA;      $this-&amp;gt;controllerNamespace = 'vendor\shopify\console\controllers';&#xA;   }&#xA;&#xA;   // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inside this namespace of console controllers above, I have a single controller named &lt;strong&gt;CronCroller&lt;/strong&gt;, which extends &lt;em&gt;yii\console\Controller&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace vendor\shopify\console\controllers;&#xA;&#xA;use vendor\shopify\Shopify;&#xA;&#xA;use Craft;&#xA;use yii\console\Controller;&#xA;use craft\elements\Entry;&#xA;&#xA;/**&#xA; * Shopify plugin commands for cron automation&#xA; *&#xA; * The first line of this class docblock is displayed as the description&#xA; * of the Console Command in ./craft help&#xA; *&#xA; * Craft can be invoked via commandline console by using the `./craft` command&#xA; * from the project root.&#xA; *&#xA; * Console Commands are just controllers that are invoked to handle console&#xA; * actions. The segment routing is plugin-name/controller-name/action-name&#xA; *&#xA; * The actionIndex() method is what is executed if no sub-commands are supplied.&#xA; *&#xA; * Actions must be in 'kebab-case' so actionDoSomething() maps to 'do-something'&#xA; *&#xA; */&#xA;class CronController extends Controller&#xA;{&#xA;    // Public Methods&#xA;    // =========================================================================&#xA;&#xA;    /**&#xA;     * Run Shopify product Sync&#xA;     *&#xA;     * The first line of this method docblock is displayed as the description&#xA;     * of the Console Command in ./craft help&#xA;     *&#xA;     * @return mixed&#xA;     */&#xA;    public function actionSync()&#xA;    {&#xA;        echo &quot;\nSyncing Craft products with Shopify.\n&quot;;&#xA;&#xA;        // [Automated Task Processes]&#xA;&#xA;        echo &quot;\nSuccess.\n&quot;;&#xA;        return;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the name of the controller is &lt;em&gt;CronController&lt;/em&gt;, I can run the code in the &lt;strong&gt;actionSync()&lt;/strong&gt; public method through the terminal with a command like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;php craft shopify/cron/sync;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PluginFactory.io&lt;/a&gt; is a terrific resource for exploring and learning more, which is how I set up my plugin's console commands.&lt;/p&gt;&#xA;" OwnerUserId="9248" LastActivityDate="2019-02-12T19:04:28.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29495" PostTypeId="1" AcceptedAnswerId="29496" CreationDate="2019-02-13T10:03:59.717" Score="2" ViewCount="223" Body="&lt;p&gt;In this video it looks like Courtney has tabs (Content | Design) in the individual fields in a Matrix. I can't work out how to do this, is it a plugin? It seems a great way of organising the fields for the editor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://vimeo.com/294976443&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://vimeo.com/294976443&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screengrab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vVBua.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vVBua.png&quot; alt=&quot;Matrix field with Tabs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any insight&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2020-07-13T19:52:05.677" Title="Tabs in a Matrix Field" Tags="&lt;matrix&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29496" PostTypeId="2" ParentId="29495" CreationDate="2019-02-13T10:14:41.440" Score="4" Body="&lt;p&gt;This is a plugin, yes. It's &lt;a href=&quot;https://plugins.craftcms.com/spoon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spoon by Angell &amp;amp; Co&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-13T10:25:09.367" LastActivityDate="2019-02-13T10:25:09.367" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29497" PostTypeId="2" ParentId="29489" CreationDate="2019-02-13T10:24:02.793" Score="1" Body="&lt;p&gt;If I understand your question well, you need to use the &lt;code&gt;EVENT_REGISTER_TABLE_ATTRIBUTES&lt;/code&gt; event. &lt;a href=&quot;https://craftcms.stackexchange.com/a/25335/3630&quot;&gt;This thread&lt;/a&gt; should get you on your way :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-13T10:24:02.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29500" PostTypeId="1" AcceptedAnswerId="32585" CreationDate="2019-02-13T12:35:32.977" Score="1" ViewCount="1043" Body="&lt;p&gt;My entries' titles are auto-generated from several fields values on first save.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When one of these fields values change, I would like to update the auto-generated slug also:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    \craft\services\Elements::class,&#xA;    \craft\services\Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function (Event $event) {&#xA;        $entry = Entry::find()&#xA;            -&amp;gt;id($event-&amp;gt;element-&amp;gt;id)&#xA;            -&amp;gt;one();&#xA;&#xA;        if ([] !== $entry) {&#xA;            $title = craft\helpers\StringHelper::toAscii($entry-&amp;gt;id.'-'.$entry-&amp;gt;title);&#xA;            $title = craft\helpers\StringHelper::toLowerCase($title);&#xA;            $title = str_replace(' ', '-', $title);&#xA;&#xA;            //  I tried this below, but none works&#xA;            $entry-&amp;gt;slug = $title; // ⬅️ Not working&#xA;            $entry-&amp;gt;setFieldValue('slug', $title); // ⬅️ Error&#xA;            Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry); // ⬅️ Infinite loop&#xA;            $event-&amp;gt;element-&amp;gt;slug = $event-&amp;gt;element-&amp;gt;id; // ⬅️ Not working&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, none of these methods works. Any idea how to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="5471" LastEditDate="2019-04-30T14:10:27.693" LastActivityDate="2019-10-02T08:35:50.137" Title="How to change an entry's slug on EVENT_AFTER_SAVE_ELEMENT?" Tags="&lt;events&gt;&lt;slug&gt;&lt;modules&gt;&lt;onsaveentry&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29501" PostTypeId="1" CreationDate="2019-02-13T12:45:46.133" Score="1" ViewCount="74" Body="&lt;p&gt;It appears on Craft 3.1.8 that I can't set the CRAFT_TEMPLATE_PATH from .env without throwing a PHP notice error. This appears to be because the .env is loaded after the defines and I want to access the .ENV for my CRAFTENV_template path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set CRAFT_TEMPLATE_PATH from my .env without producing an error/warning?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastEditorUserId="57" LastEditDate="2019-02-13T23:46:03.707" LastActivityDate="2021-03-05T03:09:25.950" Title="Allowing CRAFT_TEMPLATE_PATH in index.php from .env variable" Tags="&lt;config&gt;&lt;environmentvariables&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29502" PostTypeId="2" ParentId="29500" CreationDate="2019-02-13T12:51:23.680" Score="4" Body="&lt;p&gt;You can change the value in the DB directly instead of using the &lt;code&gt;Elements&lt;/code&gt; service&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$entry = $event-&amp;gt;element;&#xA;$elementId = $entry-&amp;gt;id;&#xA;$siteId = $entry-&amp;gt;siteId;&#xA;Craft::$app-&amp;gt;getDb()-&amp;gt;createCommand()&#xA;    -&amp;gt;update(&#xA;        '{{%elements_sites}}',&#xA;        ['slug' =&amp;gt; ElementHelper::createSlug('new-slug')],&#xA;        [&#xA;            'elementId' =&amp;gt; $elementId,&#xA;            'siteId'    =&amp;gt; $siteId&#xA;        ]&#xA;    )-&amp;gt;execute();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By the way the following condition &lt;code&gt;[] !== $entry&lt;/code&gt; won't be any good when you fetch an element with &lt;code&gt;one()&lt;/code&gt; because &lt;code&gt;one&lt;/code&gt; returns an object of instance &lt;code&gt;ElementInterface&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt; but never an empty array. You can check &lt;code&gt;!== null&lt;/code&gt; instead and if you fetch things via &lt;code&gt;all&lt;/code&gt; you can perform an empty check &lt;code&gt;if( empty($entries) === false)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-02-13T12:56:38.673" LastActivityDate="2019-02-13T12:56:38.673" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29503" PostTypeId="1" CreationDate="2019-02-13T13:33:21.017" Score="0" ViewCount="267" Body="&lt;p&gt;I have a page where updating the asset indexes is not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I hit «Update asset indexes» The loading animation shows and never stops the animation.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Installed &lt;a href=&quot;https://github.com/ostark/craft-async-queue&quot; rel=&quot;nofollow noreferrer&quot;&gt;AsyncQueue&lt;/a&gt; = Same effect&lt;/li&gt;&#xA;&lt;li&gt;Increased memory_limit to 128M&lt;/li&gt;&#xA;&lt;li&gt;max_execution_time is set to 30&lt;/li&gt;&#xA;&lt;li&gt;There are no stuck tasks&lt;/li&gt;&#xA;&lt;li&gt;php 7.0.33&lt;/li&gt;&#xA;&lt;li&gt;CraftCMS 3.15&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It works locally (MAMP Apache) so I guess it must be a server thing?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are about 10 pdf &amp;amp; jpg assets so it's not a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else can I do?&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2019-02-13T13:40:14.637" LastActivityDate="2019-02-13T13:40:14.637" Title="Updating asset indexes doesn't work" Tags="&lt;craft3&gt;&lt;tasks&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29504" PostTypeId="2" ParentId="29480" CreationDate="2019-02-13T14:23:25.663" Score="2" Body="&lt;p&gt;I think you will have to get your hands a bit dirty with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Calendar Events fieldtype will get you part of the way, but you still need some module code to pull this off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A suggested approach is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a product type with the &lt;strong&gt;Events&lt;/strong&gt; fieldtype&lt;/li&gt;&#xA;&lt;li&gt;Create some module code that creates/updates a product + variants for each date, where the inventory is set to &lt;em&gt;n&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;List the events as you would normally do, and pull in the products and its variants with the reverse relationship.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If the available number of tickets is always the same, you could have one field on the event where you enter the number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the amount of tickets vary by day, there is probably multiple approaches. Maybe a Matrix field that assumes position of block with quantity field === date in same position/with a date picker, maybe something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a example module over at &lt;a href=&quot;https://pluginfactory.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2019-02-13T14:23:25.663" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29505" PostTypeId="2" ParentId="29433" CreationDate="2019-02-13T16:13:09.623" Score="1" Body="&lt;p&gt;You have to use full namespaces in Element API because anything within those functions is out of scope. So you need to use the full path to the Google class.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$googleMaps = new \Vendor\Module\GoogleMapsApi();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Putting a &quot;use&quot; directive at the top of the file will not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had the exact same problem and that resolved my issues immediately.&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2019-02-13T16:13:09.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29507" PostTypeId="1" AcceptedAnswerId="29566" CreationDate="2019-02-13T17:36:52.190" Score="1" ViewCount="109" Body="&lt;p&gt;Just like the post says, I'm getting unknown errors when selecting a category from a field. Nothing shows up in the craft error logs but here's what the console says: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MZ2HJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MZ2HJ.png&quot; alt=&quot;error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just wondering if anyone else experienced this or if it's just a problem with our build. &lt;/p&gt;&#xA;" OwnerUserId="7426" LastActivityDate="2019-02-19T00:11:32.397" Title="Unknown Errors when trying to select category" Tags="&lt;error&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="29508" PostTypeId="2" ParentId="29477" CreationDate="2019-02-13T20:22:27.413" Score="1" Body="&lt;p&gt;Are you using a relative file path? Try to omit them where you can and see if it resolves?&lt;/p&gt;&#xA;" OwnerUserId="8045" LastActivityDate="2019-02-13T20:22:27.413" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29510" PostTypeId="1" AcceptedAnswerId="29511" CreationDate="2019-02-13T21:50:13.540" Score="2" ViewCount="262" Body="&lt;p&gt;I have an event section in my website with a couple of fields on the entries and one of them is a &quot;related events&quot; field where I can select a other event entries to be shown at the end of the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also use the .search() function to search within events and it happens that events are listed in the results of searches for a certain keyword, where the only appearance is within the related events, which is unwanted behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need is to exclude this one field where I can select the related events from the search index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be solved?&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-02-13T21:50:13.540" Title="How to exclude certain fields from .search()" Tags="&lt;search&gt;&lt;field&gt;&lt;exclude&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29511" PostTypeId="2" ParentId="29510" CreationDate="2019-02-13T21:50:13.540" Score="3" Body="&lt;p&gt;Starting with Craft 3.1 the solution is easy. In the field definition there is a new checkbox: &quot;Use this field's value as search keywords&quot;. Uncheck and you're done!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1AArL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1AArL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please note that there was a bug until Craft 3.1.9.1 which prevented this from working. Thanks to Romain poirier and Brandon Kelly (&lt;a href=&quot;https://github.com/craftcms/cms/issues/3837&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3837&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-02-13T21:50:13.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29512" PostTypeId="1" AcceptedAnswerId="29518" CreationDate="2019-02-13T22:05:50.813" Score="1" ViewCount="67" Body="&lt;p&gt;I've got this working but it seems terribly verbose to do something, that in my opinion should be easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to get the assets from 2 different fields, merge them and output them in a random order?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set clientLogos = logos.clientLogos.all() %}&#xA;{% set agencyLogos = logos.agencyLogos.all() %}&#xA;&#xA;{# set empty array #}&#xA;{% set logoIds = [] %}&#xA;&#xA;{# add logos from clients #}&#xA;{% for logo in clientLogos %}&#xA;  {% set logoIds = logoIds|merge([logo.id]) %}&#xA;{% endfor %}&#xA;&#xA;{#  add logos from agencies #}&#xA;{% for logo in agencyLogos %}&#xA;  {% set logoIds = logoIds|merge([logo.id]) %}&#xA;{% endfor %}&#xA;&#xA;{# looped through merged logos #}&#xA;{% for logo in craft.assets().volume('uploads').kind('image').id(logoIds).orderBy('RAND()') %}&#xA;  &amp;lt;img src=&quot;{{ logo.url(croppedlogo) }}&quot; alt=&quot;{{ logo.title }}&quot; class=&quot;m-4&quot;/&amp;gt;&#xA;{% endfor %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-02-14T11:48:53.967" Title="Merging Assets Fields" Tags="&lt;templating&gt;&lt;assets&gt;&lt;merge&gt;&lt;assets-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29513" PostTypeId="1" CreationDate="2019-02-13T22:50:18.477" Score="1" ViewCount="55" Body="&lt;p&gt;Hey there and thanks in advance. We just moved our site to production as a beta site. The only thing that is different between this site and our local/staging site is the config file. The allowUpdates and allowAdminChanges is set to false. Databases are separate and all sites are running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We I update entries on prod, they save but my site does not update. When I do the same change on local/dev the changes render on my dev site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? Does allowUpdates and allowAdminChanges affect whether or not content will be updated on the site? Thought it might be a cache issue but why would it work on dev and not prod?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;" OwnerUserId="8678" LastActivityDate="2019-02-14T00:00:31.250" Title="Entries save but site doesn't update" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29514" PostTypeId="1" AcceptedAnswerId="29544" CreationDate="2019-02-13T23:01:05.643" Score="2" ViewCount="700" Body="&lt;p&gt;I have an events channel where each entry has three custom date/time fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;startDate (Date Only)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;startTime (Time Only)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;endTime (Time Only)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was originally using this code to set my entries, but it causes problems if they aren't all entered on the same day:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('sparkSchedule').limit(null).orderBy('startDate asc').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've seen answers from Craft 2 saying that i could use time(startTime) to sort by just the time portion of my startTime field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('sparkSchedule').limit(null).orderBy('startDate asc, time(startTime)').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when I do that, i get this error:&#xA;SQLSTATE[42S22]: Column not found: 1054 Unknown column 'startTime' in 'order clause'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="323" LastEditorUserId="323" LastEditDate="2019-02-14T16:23:11.347" LastActivityDate="2019-02-16T00:17:37.157" Title="Order entries by custom date and time fields" Tags="&lt;craft3&gt;&lt;datetime&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29515" PostTypeId="2" ParentId="29481" CreationDate="2019-02-13T23:10:28.143" Score="0" Body="&lt;p&gt;A user inherits the permissions of any user groups they belong to additively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to remove specific permissions for that user, you'd need to remove them from the user group(s) they're currently in and either create a new user group for them with their specific permission or add the permissions directly to the user.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-13T23:10:28.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29516" PostTypeId="2" ParentId="19924" CreationDate="2019-02-13T23:48:18.413" Score="3" Body="&lt;p&gt;It seems that &lt;code&gt;offset&lt;/code&gt; doesn't work when &lt;code&gt;pagination&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt; (which is its default value). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you don't need pagination for your results&lt;/strong&gt;, you can add your &lt;code&gt;offset&lt;/code&gt; in &lt;code&gt;criteria&lt;/code&gt; and set &lt;code&gt;pagination&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you do need pagination and the desired &lt;code&gt;offset&lt;/code&gt; is the same as &lt;code&gt;elementsPerPage&lt;/code&gt;&lt;/strong&gt;, you can get your results starting from page 2. You'll have to make sure you're actually getting page 2 because it will return page 1 if there aren't enough results for a second page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you do need pagination and the desired &lt;code&gt;offset&lt;/code&gt; is different from &lt;code&gt;elementsPerPage&lt;/code&gt;&lt;/strong&gt;, you can try what I've done here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'stories.json' =&amp;gt; function() {&#xA;    // Get get IDs of the &quot;offset&quot; entries. Set `limit` to the offset amount you want.&#xA;    $excludedIds = Entry::find()&#xA;        -&amp;gt;section('stories')&#xA;        -&amp;gt;limit(4)&#xA;        -&amp;gt;ids();&#xA;&#xA;    // Form value for id in criteria to exclude the above entries.&#xA;    $criteriaId = count($excludedIds) ? ('and, not ' . implode(', not ', $excludedIds)) : null;&#xA;&#xA;    return [&#xA;        'elementType' =&amp;gt; Entry::class,&#xA;        'criteria' =&amp;gt; [&#xA;            'section' =&amp;gt; 'stories',&#xA;            'id' =&amp;gt; $criteriaId,&#xA;        ],&#xA;        'pretty' =&amp;gt; true,&#xA;        'elementsPerPage' =&amp;gt; 6,&#xA;        'transformer' =&amp;gt; function(Entry $entry) {&#xA;            return [&#xA;                'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                'url' =&amp;gt; $entry-&amp;gt;url,&#xA;                'id' =&amp;gt; $entry-&amp;gt;id,&#xA;            ];&#xA;        },&#xA;    ];&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found that you can still paginate results with a value for &lt;code&gt;id&lt;/code&gt; set in &lt;code&gt;criteria&lt;/code&gt;. So, I've excluded the IDs of the offset entries and paginated the results with those entries removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also made an issue on the Element API Github repo to see if there's a better solution:&#xA;&lt;a href=&quot;https://github.com/craftcms/element-api/issues/99&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/element-api/issues/99&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8781" LastEditorUserId="8781" LastEditDate="2019-02-15T20:36:08.513" LastActivityDate="2019-02-15T20:36:08.513" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29517" PostTypeId="2" ParentId="29501" CreationDate="2019-02-13T23:48:37.173" Score="0" Body="&lt;p&gt;If you add it after you load the dot env stuff in your public index.php file, it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Load dotenv?&#xA;if (file_exists(CRAFT_BASE_PATH.'/.env')) {&#xA;    (new Dotenv(CRAFT_BASE_PATH))-&amp;gt;load();&#xA;}&#xA;&#xA;define('CRAFT_TEMPLATE_PATH', getenv('CRAFT_TEMPLATE_PATH'));&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-13T23:48:37.173" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29518" PostTypeId="2" ParentId="29512" CreationDate="2019-02-13T23:57:17.727" Score="1" Body="&lt;p&gt;From Twig, this seems like a decent solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could possibly be streamlined a bit if you wanted to do it from PHP, but as long as you're not dealing with large amounts of images, it's probably not worth it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-13T23:57:17.727" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29519" PostTypeId="2" ParentId="29513" CreationDate="2019-02-14T00:00:31.250" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does allowUpdates and allowAdminChanges affect whether or not content will be updated on the site?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thought it might be a cache issue but why would it work on dev and not prod?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Caching is my first thought. Is production behind a CDN, Varnish or some other caching solution that dev is not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#enabletemplatecaching&quot; rel=&quot;nofollow noreferrer&quot;&gt;enableTemplateCaching&lt;/a&gt; config setting is set to &lt;code&gt;false&lt;/code&gt; for non-production environments?&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-14T00:00:31.250" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29520" PostTypeId="1" AcceptedAnswerId="29633" CreationDate="2019-02-14T01:11:39.873" Score="1" ViewCount="1342" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #28 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'site.structureelements.root' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The site is working locally through MAMP, and on a remote apache dev server. I have an nginx server built for shared hosting through Laravel Forge. All of the PHP settings are identical, and I used the database backup from the dev site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I removed all of the tables and the standard craft install worked fine.&lt;/p&gt;&#xA;" OwnerUserId="6138" LastActivityDate="2019-02-25T13:51:33.983" Title="What is CDbException Error: SQLSTATE[42000]: Syntax error or access violation while moving a site to remote?" Tags="&lt;database&gt;&lt;mysql&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29521" PostTypeId="1" AcceptedAnswerId="35006" CreationDate="2019-02-14T02:17:44.940" Score="1" ViewCount="87" Body="&lt;p&gt;I need to search for all commerce variants related to a custom element &quot;Account&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The account element is related to a variant through a matrix field with handle&lt;br&gt;&#xA;&lt;code&gt;varientaccountmapping&lt;/code&gt;, block handle &lt;code&gt;mapping&lt;/code&gt; field handle &lt;code&gt;account&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allowedVarients = craft.variants().relatedTo({&#xA;    targetElement: accountElement,&#xA;    field: 'varientaccountmapping.account'&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;works, however it returns results whether the matrix block is enabled or disabled - ignoring the status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get this to return only results where the matrix block it is related to is &lt;strong&gt;enabled&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8850" LastActivityDate="2020-03-29T10:49:02.427" Title="RelatedTo relation - checking matrix block status is enabled" Tags="&lt;craft3&gt;&lt;relations&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29522" PostTypeId="2" ParentId="23111" CreationDate="2019-02-14T02:19:15.570" Score="4" Body="&lt;p&gt;You're using &lt;code&gt;$view-&amp;gt;resolveTemplate('_blog-entry')&lt;/code&gt; which is returning the absolute path to the template as a string, and then passing that to &lt;code&gt;$view-&amp;gt;render&lt;/code&gt; which is expecting a &lt;em&gt;relative&lt;/em&gt; path, not an absolute one. Internally I expect it's trying to run &lt;code&gt;resolveTemplate&lt;/code&gt; on its argument, and it isn't sophisticated enough to recognize that a path is already absolute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your comment on the other answer it looks like you solved this, though didn't highlight it as the solution: &lt;strong&gt;just pass the relative template path straight to &lt;code&gt;render&lt;/code&gt;; no need to use &lt;code&gt;resolveTemplate&lt;/code&gt; first&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So corrected full code might be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$view = Craft::$app-&amp;gt;getView();&#xA;$html = $view-&amp;gt;render('_blog-entry', ['entry' =&amp;gt; $blogpost]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't believe switching the template mode, as suggested in the other answer, is actually required, at least not under all circumstances.&lt;/p&gt;&#xA;" OwnerUserId="8782" LastActivityDate="2019-02-14T02:19:15.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29523" PostTypeId="1" AcceptedAnswerId="29543" CreationDate="2019-02-14T07:27:56.240" Score="1" ViewCount="691" Body="&lt;p&gt;In Craft 2, we used to be able to do so by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft()-&amp;gt;plugin1-&amp;gt;myMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from Plugin 2's service for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in Craft 3, I couldn't figure out a way to do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin1::$plugin-&amp;gt;myService-&amp;gt;myMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;seems to only work within the Plugin 1's code base.&lt;/p&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2020-12-02T22:00:24.660" Title="Craft 3: how to call methods in another plugin's service?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;services&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29524" PostTypeId="1" AcceptedAnswerId="29525" CreationDate="2019-02-14T10:48:12.227" Score="1" ViewCount="102" Body="&lt;p&gt;On a CP edit entry page there is a box for 'Notes about your changes'.&#xA;I have entered text in there and saved the entry, but it doesn't seem show up anywhere. How does it work?&lt;/p&gt;&#xA;" OwnerUserId="152" LastActivityDate="2019-02-14T11:06:16.730" Title="Notes about your changes" Tags="&lt;control-panel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29525" PostTypeId="2" ParentId="29524" CreationDate="2019-02-14T11:06:16.730" Score="1" Body="&lt;p&gt;For my answer I am going to assume you are running Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes are displayed in the sidebar:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zsStU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zsStU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When viewing the &quot;Current&quot; version of an entry, you can see the notes in the sidebar from when that entry was &lt;strong&gt;last saved&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go back through the version history of an entry, the notes in the sidebar will change to the notes left from the &lt;strong&gt;previous version of that entry&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also add notes to a draft version of an entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qtwbi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qtwbi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the draft has been published, the draft version will now become the &quot;Current&quot; version, and the notes from the draft should show in the sidebar.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-02-14T11:06:16.730" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29526" PostTypeId="1" AcceptedAnswerId="29528" CreationDate="2019-02-14T11:43:01.630" Score="1" ViewCount="69" Body="&lt;p&gt;I have the following setup for a language switcher. I have Member Directory pages which are using Users (rather than Entires or Categories). How can I update this to get it working on these pages?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set langSwitcher = craft.app.sites.getAllSites() %}&#xA;&#xA;&amp;lt;div class=&quot;flag&quot;&amp;gt;&#xA; {% for lang in langSwitcher %}&#xA; {# Set homepage as default #}&#xA; {% set url = alias(lang.baseUrl) %}&#xA;&#xA; {# Entry is defined #}&#xA; {% if entry is defined %}&#xA;  {# Check if that entry exists in other locale #}&#xA;  {% set otherLocaleEntry = craft.entries.siteId(lang.id).id(entry.id).one() %}&#xA;  {% if otherLocaleEntry %}&#xA;    {% set url = otherLocaleEntry.url %}&#xA;  {% endif %}&#xA;&#xA;{# Category is defined #}&#xA;{% elseif category is defined %}&#xA;  {# Check if that entry exists in other locale #}&#xA;  {% set otherLocaleCat = craft.categories.siteId(lang.id).id(category.id).one() %}&#xA;  {% if otherLocaleCat %}&#xA;    {% set url = otherLocaleCat.url %}&#xA;  {% endif %}&#xA;{% endif %}&#xA;&#xA; &amp;lt;div {% if lang.id == currentSite.id %}class=&quot;active&quot;{% endif %}&amp;gt;&#xA;  &amp;lt;a href=&quot;{{url}}&quot; &amp;gt; &amp;lt;img src=&quot;/assets/images/site/flag-{{lang.name|lower}}.svg&quot; alt=&quot;{{lang.name|upper}}&quot;&amp;gt;&amp;lt;/a&amp;gt;&#xA; &amp;lt;p class=&quot;small-hide&quot;&amp;gt;&amp;lt;a href=&quot;{{url}}&quot; &amp;gt;{{lang.name|upper}}&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#xA; &amp;lt;/div&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="3742" LastEditorUserId="3742" LastEditDate="2019-02-14T12:11:55.040" LastActivityDate="2019-02-14T13:26:45.523" Title="Language Switcher with Users" Tags="&lt;users&gt;&lt;localization&gt;&lt;multi-site&gt;&lt;language&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29527" PostTypeId="2" ParentId="29512" CreationDate="2019-02-14T11:48:53.967" Score="0" Body="&lt;p&gt;Assuming this is an entry page and you don't have other asset fields (though you could use &lt;code&gt;targetElement&lt;/code&gt;), you could fetch assets &lt;code&gt;relatedTo&lt;/code&gt; your current entry?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-14T11:48:53.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29528" PostTypeId="2" ParentId="29526" CreationDate="2019-02-14T13:20:39.747" Score="2" Body="&lt;p&gt;This isn't perfect by any means and might need tweaking but to get you on your way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that on a user page, you are doing &lt;code&gt;{% set user = ... %}&lt;/code&gt; somewhere (as you would do &lt;code&gt;{% set entry = ... %}&lt;/code&gt; on an entry page), You just add another clause to your if statement, after checking for category, you check for user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# User is defined #}&#xA;{% elseif user is defined %}&#xA;  {% set url = lang.baseUrl ~ 'membership/directory/' ~ craft.app.request.segments|last %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you have set the user:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# User is defined #}&#xA;{% elseif user is defined %}&#xA;  {% set url = lang.baseUrl ~ 'membership/directory/' ~ user.id %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-14T13:26:45.523" LastActivityDate="2019-02-14T13:26:45.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29529" PostTypeId="1" CreationDate="2019-02-14T14:07:29.920" Score="1" ViewCount="112" Body="&lt;p&gt;I have a use case where I want to limit the allowed file size for a certain Assets Volume to 20kb. All other volumes should be allowed files no matter the size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at some other threads already that suggest developing a plugin to do this, or use the Yii event system for file uploads. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have made other simple plugins before that interacted with entries, but I cannot understand how to make a plugin that latches onto the file uploading event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any good documentation for where to begin with this? It is version 3.0&lt;/p&gt;&#xA;" OwnerUserId="9396" LastActivityDate="2019-02-14T16:22:40.047" Title="Restricting file size for an Assets Volume" Tags="&lt;assets&gt;&lt;limit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29530" PostTypeId="2" ParentId="29529" CreationDate="2019-02-14T14:37:25.947" Score="2" Body="&lt;p&gt;There's no way for the moment to limit filesize by Volume, but your can create a custom module with the &lt;code&gt;EVENT_BEFORE_SAVE&lt;/code&gt; hooked on Assets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;https://craftcms.stackexchange.com/questions/23261/how-to-set-different-file-size-upload-limits-for-different-asset-sources&quot;&gt;related post&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="9256" LastEditDate="2019-02-14T16:22:40.047" LastActivityDate="2019-02-14T16:22:40.047" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29531" PostTypeId="1" CreationDate="2019-02-14T14:51:40.730" Score="1" ViewCount="126" Body="&lt;p&gt;I'm trying to modify the element's data during the import. I'm using EVENT_STEP_BEFORE_ELEMENT_SAVE to modify the $contentData. I added some logging at each step and I can see that the $contentData is being changed to &quot; - blah - &quot; for each element in the feed but the original value for 'productDescription' is still being saved for the element. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(Process::class, Process::EVENT_STEP_BEFORE_ELEMENT_SAVE, function(FeedProcessEvent $event) {&#xA; $event-&amp;gt;contentData['productDescription'] = &quot; - blah - &quot;;         &#xA;}); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the logging (irrelevant data omitted):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{before modifying ($contentData) ==== &quot;productDescription&quot;:&quot;Freestanding Spring Horses&quot;}&#xA;{after modifying ($contentData) ::::: &quot;productDescription&quot;:&quot; - blah - &quot;}&#xA;{Data ready to import ($contentData) -&amp;gt; &quot;productDescription&quot;:&quot; - blah - &quot;}&#xA;{After saving ($contentData) ---- &quot;productDescription&quot;:&quot; - blah - &quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I look at the productDescription field for the element that was just imported I see: &quot;Freestanding Spring Horses&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I modify the data that gets saved for each element?&lt;/p&gt;&#xA;" OwnerUserId="9397" LastActivityDate="2019-02-15T04:57:24.583" Title="How to modify element's data during import?" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29532" PostTypeId="2" ParentId="29483" CreationDate="2019-02-14T15:07:10.447" Score="1" Body="&lt;p&gt;A little messy but here's how I got it to work in case anyone else has this question. It even seems to respect the conditional display rules on my form.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if form|length %}&#xA;    {{ form.renderTag }}&#xA;&#xA;    {% if form.hasErrors %}&#xA;      &amp;lt;div class=&quot;freeform-form-has-errors&quot;&amp;gt;&#xA;        {{ &quot;Error! Please review the form and try submitting again.&quot;|t('freeform') }}&#xA;&#xA;        {% if form.errors|length %}&#xA;          &amp;lt;ul&amp;gt;&#xA;            {% for error in form.errors %}&#xA;              &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;            {% endfor %}&#xA;          &amp;lt;/ul&amp;gt;&#xA;        {% endif %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {% for row in form %}&#xA;      &amp;lt;div class=&quot;freeform-row {{ form.customAttributes.rowClass }}&quot;&amp;gt;&#xA;        {% for field in row %}&#xA;          {% set columnClass = &quot;freeform-column &quot; ~ form.customAttributes.columnClass %}&#xA;          {% if field.type == &quot;submit&quot; %}&#xA;            {% set columnClass = columnClass ~ &quot; freeform-column-content-align-&quot; ~ field.position %}&#xA;          {% endif %}&#xA;          {% if field.type == &quot;radio_group&quot; %}&#xA;            &amp;lt;div class=&quot;{{ columnClass }}&quot;{{ field.rulesHtmlData }}&amp;gt;&#xA;                {{ field.renderLabel() }}&#xA;                &amp;lt;div class=&quot;freeform-instructions&quot;&amp;gt;&#xA;                 {{ field.renderInstructions() }}&#xA;                &amp;lt;/div&amp;gt;&#xA;                {% if field.errors %}&#xA;                &amp;lt;ul class=&quot;errors freeform-errors&quot;&amp;gt;&#xA;                    {% for error in field.errors %}&#xA;                        &amp;lt;li&amp;gt;{{ error }}&amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;                {% endif %}&#xA;                {% for option in field.options %}&#xA;                    &amp;lt;label&amp;gt;&#xA;                        &amp;lt;input type=&quot;radio&quot; class=&quot;freeform-input&quot; &#xA;                          name=&quot;{{ field.handle }}&quot; type=&quot;radio&quot; &#xA;                          id=&quot;form-input-{{ field.handle }}-{{ loop.index }}&quot; &#xA;                          value=&quot;{{ option.value }}&quot; &#xA;                          {{ option.value == submittedValues[field.handle] ? 'checked' : '' }}&amp;gt;&#xA;                        {{ option.label }}&#xA;                    &amp;lt;/label&amp;gt;&#xA;                {% endfor %}&#xA;            &amp;lt;/div&amp;gt;&#xA;          {% else %}&#xA;          &amp;lt;div class=&quot;{{ columnClass }}&quot;{{ field.rulesHtmlData }}&amp;gt;&#xA;            {{ field.render({&#xA;              class: field.type != &quot;submit&quot; ? &quot;freeform-input&quot; : &quot;&quot;,&#xA;              labelClass: &quot;freeform-label&quot; ~ (field.inputOnly ? &quot; freeform-input-only-label&quot; : &quot;&quot;) ~ (field.required ? &quot; freeform-required&quot; : &quot;&quot;),&#xA;              errorClass: &quot;freeform-errors&quot;,&#xA;              instructionsClass: &quot;freeform-instructions&quot;,&#xA;              overrideValue: field.handle ? submittedValues[field.handle] : ''&#xA;            }) }}&#xA;          &amp;lt;/div&amp;gt;&#xA;          {% endif %}&#xA;        {% endfor %}&#xA;      &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;statusId&quot; value=&quot;2&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;submissionId&quot; value=&quot;{{ application.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;userEmail&quot; value=&quot;{{ currentUser.email }}&quot;&amp;gt;&#xA;    {{ form.renderClosingTag }}&#xA;    {% endif %}&#xA;&#xA;{% js %}&#xA;    var act = document.getElementsByName('action');&#xA;    act[0].value = 'freeform/submissions/save'&#xA;{% endjs %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7423" LastActivityDate="2019-02-14T15:07:10.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29533" PostTypeId="2" ParentId="29289" CreationDate="2019-02-14T15:15:01.903" Score="4" Body="&lt;p&gt;I resolved this by adding &lt;code&gt;'isSystemLive' =&amp;gt; true&lt;/code&gt; in general.php&lt;/p&gt;&#xA;" OwnerUserId="9398" LastActivityDate="2019-02-14T15:15:01.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29534" PostTypeId="2" ParentId="29531" CreationDate="2019-02-15T04:57:24.583" Score="1" Body="&lt;p&gt;The &lt;code&gt;EVENT_STEP_BEFORE_ELEMENT_SAVE&lt;/code&gt; is actually fired after the content has been applied to element attributes and field content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you'll want to modify the element's content directly. You can do this via:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$event-&amp;gt;element-&amp;gt;productDescription = &quot; - blah - &quot;;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As the plugin author, I may change this so it acts as you've suggested. Currently, modifying &lt;code&gt;$contentData&lt;/code&gt; essentially does nothing. However, this will require a change to the event where it passes in &lt;code&gt;attributeData&lt;/code&gt; and &lt;code&gt;fieldData&lt;/code&gt; separately, as they need to be applied separately back on the element. I'll look at adding this in the next version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if that doesn't work!&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-02-15T04:57:24.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29535" PostTypeId="1" CreationDate="2019-02-15T10:24:46.163" Score="1" ViewCount="108" Body="&lt;p&gt;I would like to count comments that belong to a certain entry (product). I have this so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set comments = craft.entries().section('productcomments').all() %}&#xA; {% set counter = 0 %}&#xA;  {% for comment in comments %}&#xA;   {% if comment.title|length and comment.title == entry.title %}&#xA;    {% set counter = counter+1 %}               &#xA;    {{ counter }} comments&#xA;   {% endif %}&#xA;  {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This actually works, but it displays the results after each other (like this:1 comment 2 comment 3 comment - if i have 3 comments).&#xA;I would like to show only &quot;3 comments&quot;. Actually display the max result.&#xA;Twig's &quot;loop.last&quot; doesn't work because of the condition.&#xA;Is there another way?&#xA;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="6061" LastActivityDate="2019-02-15T11:12:53.013" Title="Count entries with condition" Tags="&lt;loop&gt;&lt;comments&gt;&lt;count&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29536" PostTypeId="2" ParentId="29535" CreationDate="2019-02-15T11:12:53.013" Score="3" Body="&lt;p&gt;Assuming that your products are entries, and comments are related to a product through an entries field, you can use the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set comments = craft.entries.section('productcomments').relatedTo(entry).all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This uses the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#relatedto&quot; rel=&quot;nofollow noreferrer&quot;&gt;relatedTo&lt;/a&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then return how many comments are found by using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if comments|length %}&#xA;    &amp;lt;p&amp;gt;{{ comments|length }} comments&amp;lt;/p&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-02-15T11:12:53.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29537" PostTypeId="1" AcceptedAnswerId="29538" CreationDate="2019-02-15T17:23:56.087" Score="3" ViewCount="137" Body="&lt;p&gt;I want to test for the existence of disabled entries for the logged in author in a section. So far I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set profileEntryQuery = craft.entries()&#xA;    .section('profileEntry')&#xA;    .status(null) %}&#xA;&#xA;{% set entries = profileEntryQuery.all() %}    &#xA;&#xA;{% for entry in entries %}&#xA;&#xA;  {% if currentUser.id == entry.author.id %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the status(null) checks for disabled &lt;em&gt;and&lt;/em&gt; enabled entries. How can I get a positive if only disabled entries exist but not enabled.&lt;/p&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2019-02-15T17:54:26.260" Title="Test for entry status" Tags="&lt;entries&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29538" PostTypeId="2" ParentId="29537" CreationDate="2019-02-15T17:54:26.260" Score="3" Body="&lt;p&gt;&lt;code&gt;status('disabled')&lt;/code&gt; should do the trick for you &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries()&#xA;    .section('profileEntry')&#xA;    .status('disabled')&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2019-02-15T17:54:26.260" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29540" PostTypeId="2" ParentId="20695" CreationDate="2019-02-15T19:32:03.063" Score="1" Body="&lt;p&gt;This is Craft CMS, so there is no 'correct' way of doing it. With the routing and slug manipulation you can achieve this is many ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, to me it feels like 'Categories' would be the way to go. To get your URL hierarchy that you have suggested, you'd need to set the following for the Category URI format in Settings &gt; Categories:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% if object.level == 1 %}{slug}{% else %}{parent.uri}/{slug}{% endif %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4208" LastActivityDate="2019-02-15T19:32:03.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29541" PostTypeId="1" AcceptedAnswerId="29545" CreationDate="2019-02-15T21:26:15.200" Score="1" ViewCount="62" Body="&lt;p&gt;For a given structure entry, I need to return the previous three, and the next three entries as one array. But if the given entry is the last in the structure, I need the &quot;next three&quot; to wrap around and select the first three entries, if that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The given structure entry should not be included the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how I can achive this: all my efforts so far have failed or are far too complex.&lt;/p&gt;&#xA;" OwnerUserId="161" LastActivityDate="2019-02-16T14:45:08.140" Title="Fetch the three entries before, and after, a given Structure entry, with wrapping" Tags="&lt;craft3&gt;&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29542" PostTypeId="2" ParentId="29452" CreationDate="2019-02-15T23:33:39.573" Score="0" Body="&lt;p&gt;I was able to take your composer.json file, run &lt;code&gt;composer update&lt;/code&gt; from it without any issues, do an install of Craft from that and update Craft/plugins and install/uninstall Craft/plugins from the Control Panel without any issues.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;symfony/yaml v4.1.0 requires php ^7.1.3 -&amp;gt; your PHP version (7.2.14-1+ubuntu18.04.1+deb.sury.org+1) overridden by &quot;config.platform.php&quot; version (7.0) does not satisfy that requirement.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For that one, you've got this in your composer.json file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;config&quot;: {&#xA;    &quot;sort-packages&quot;: true,&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Change it to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;config&quot;: {&#xA;    &quot;sort-packages&quot;: true,&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.2.14&quot;&#xA;    }&#xA;  },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it will go away.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-15T23:33:39.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29543" PostTypeId="2" ParentId="29523" CreationDate="2019-02-16T00:09:20.440" Score="2" Body="&lt;p&gt;Assuming &lt;code&gt;Plugin1&lt;/code&gt; is their main plugin class file name, you could do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;\fully\qualified\namespace\Plugin1::getInstance()-&amp;gt;myService-&amp;gt;myMethod();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In order for this to work:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Craft must be installed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Plugin1&lt;/code&gt; must be installed and enabled in Craft.&lt;/li&gt;&#xA;&lt;li&gt;Composer autoloading has to be working so that it knows where to find &lt;code&gt;Plugin1&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If you're doing this from a custom module, then you'll need to listen for the &lt;code&gt;EVENT_INIT&lt;/code&gt; event, because plugins get instantiated after modules.&lt;/p&gt;&#xA;&lt;p&gt;i.e.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Craft::$app-&amp;gt;on(Application::EVENT_INIT, function() {&#xA;    \fully\qualified\namespace\Plugin1::getInstance()-&amp;gt;myService-&amp;gt;myMethod();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastEditorUserId="57" LastEditDate="2020-12-02T22:00:24.660" LastActivityDate="2020-12-02T22:00:24.660" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29544" PostTypeId="2" ParentId="29514" CreationDate="2019-02-16T00:17:37.157" Score="3" Body="&lt;p&gt;You'll want to change that &lt;code&gt;startTime&lt;/code&gt; to &lt;code&gt;field_startTime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything in the &lt;code&gt;orderBy&lt;/code&gt; gets passed directly onto SQL and Craft is smart enough to do the replacement for &lt;code&gt;startDate&lt;/code&gt; behind the scenes, but columns in methods (like &lt;code&gt;time()&lt;/code&gt;) or aggregate functions need to be manually prefixed.  This should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries.section('sparkSchedule').limit(null).orderBy('startDate asc, time(field_startTime)').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-16T00:17:37.157" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29545" PostTypeId="2" ParentId="29541" CreationDate="2019-02-16T13:08:22.837" Score="1" Body="&lt;p&gt;Assuming that when you are on the first page, you don't show the last 3 entries of your structure and the single array you need is an array of entries, this should do it for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Set how many entries to have around current entry #}&#xA;{% set surroundingEntries = 3 %}&#xA;&#xA;{# Fetch prev 3 entries - reverse order because of limit() #}&#xA;{% set prevEntries = craft.entries.positionedBefore(entry).orderBy('lft desc').limit(surroundingEntries).all() %}&#xA;&#xA;{# Fetch next 3 entries #}&#xA;{% set nextEntries = craft.entries.positionedAfter(entry).limit(surroundingEntries).all() %}&#xA;&#xA;{# if there aren't enough nextEntries, add some #}&#xA;{% if nextEntries|length &amp;lt; surroundingEntries %}&#xA;    {% set limit = surroundingEntries - nextEntries|length %}&#xA;    {% set extraEntries = craft.entries.section('sectionName').limit(limit).all() %}&#xA;    {% set nextEntries = nextEntries|merge(extraEntries) %}&#xA;{% endif %}&#xA;&#xA;{# Put prevEntries back in order and merge nextEntries to it #}&#xA;{% set results = prevEntries | reverse | merge(nextEntries) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need an array of ids, replace &lt;code&gt;.all()&lt;/code&gt; with &lt;code&gt;.ids()&lt;/code&gt; and if I misunderstood you and  you need two separate arrays, simply don't merge them as &lt;code&gt;results&lt;/code&gt; and use &lt;code&gt;nextEntries&lt;/code&gt; / &lt;code&gt;prevEntries&lt;/code&gt; but don't forget to &lt;code&gt;|reverse&lt;/code&gt; your &lt;code&gt;prevEntries&lt;/code&gt; to get them back in order :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-16T14:45:08.140" LastActivityDate="2019-02-16T14:45:08.140" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29548" PostTypeId="1" CreationDate="2019-02-17T16:46:28.677" Score="2" ViewCount="367" Body="&lt;p&gt;Craft's Web Controller has a &lt;a href=&quot;https://github.com/craftcms/cms/blob/3.1.12/src/web/Controller.php#L312&quot; rel=&quot;nofollow noreferrer&quot;&gt;redirectToPostedUrl&lt;/a&gt; method. Copied here for the sake of discussion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function redirectToPostedUrl($object = null, string $default = null): YiiResponse&#xA;{&#xA;    $url = Craft::$app-&amp;gt;getRequest()-&amp;gt;getValidatedBodyParam('redirect');&#xA;    if ($url === null) {&#xA;        if ($default !== null) {&#xA;            $url = $default;&#xA;        } else {&#xA;            $url = Craft::$app-&amp;gt;getRequest()-&amp;gt;getPathInfo();&#xA;        }&#xA;    }&#xA;    if ($object) {&#xA;        $url = Craft::$app-&amp;gt;getView()-&amp;gt;renderObjectTemplate($url, $object);&#xA;    }&#xA;    return $this-&amp;gt;redirect($url);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can call this method from our plugin controllers to redirect to the posted URL in the &lt;code&gt;redirect&lt;/code&gt; input field and use a dynamic &lt;code&gt;{siteUrl}&lt;/code&gt; variable. In my template, I have a redirect value that uses &lt;code&gt;{siteUrl}&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;6026760a62b9c6007a4b5695a65acbabG2540f8cb3727b998a1c78da45db863f{siteUrl}?id={id}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in my Controller, I receive that value and redirect to that location:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;return $this-&amp;gt;redirectToPostedUrl($object);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That all works fine. I can pass my custom &lt;code&gt;$object&lt;/code&gt; to this method and the &lt;code&gt;{id}&lt;/code&gt; or any other part of the model I wish to process can appear in the URL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, where is &lt;code&gt;{siteUrl}&lt;/code&gt; being made available to the &lt;code&gt;redirectToPostedUrl&lt;/code&gt; method? In looking closer at &lt;code&gt;renderObjectTemplate&lt;/code&gt; it never appears to specifically make global variables available. And, if I try other global variables such as &lt;code&gt;{currentUser.id}&lt;/code&gt; nothing gets rendered. In Craft 2 I believe this method made &lt;code&gt;environmentalVariables&lt;/code&gt; available for parsing but those are no longer supported in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why and how does &lt;code&gt;{siteUrl}&lt;/code&gt; work? Are there other variables that are available to be used in the redirect URLs too that we don't explicitly make available by passing them in via the &lt;code&gt;$object&lt;/code&gt; argument?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-02-18T19:16:58.417" Title="What variables are available to redirectToPostedUrl?" Tags="&lt;plugin-development&gt;&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29550" PostTypeId="1" AcceptedAnswerId="29553" CreationDate="2019-02-17T17:49:16.673" Score="1" ViewCount="137" Body="&lt;p&gt;I have an entry where I select which form displays on the page. Is there a way for me on the entry using a text input for an email address to use that email address for the sending of emails via the sprout form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in other words, I have an entry with a selected Sprout Form as well as an email address filled out in the entry, where the selected Sprout Form needs to send the email to. e.g. a hidden field where I can add the email address to, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great, thanks.&lt;/p&gt;&#xA;" OwnerUserId="4623" LastActivityDate="2019-02-17T22:31:09.723" Title="Sprout Forms Email" Tags="&lt;craft3&gt;&lt;plugin-sproutforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29553" PostTypeId="2" ParentId="29550" CreationDate="2019-02-17T22:31:09.723" Score="2" Body="&lt;p&gt;Yes, this is possible. It will require a few steps in a few different places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your Form:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a Form with an Invisible Field (handle: &lt;code&gt;invisibleEmailField&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Set the &lt;code&gt;Invisible Field Value&lt;/code&gt; setting to match the value of a hidden email Field Variable (that you will define in your Twig Templates below: &lt;code&gt;{secretEmailAddress}&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In your Notification Email:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set the Recipient field to the handle of your Invisible Field &lt;code&gt;{invisibleEmailField}&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In your Section:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create an Email Address Field (handle: &lt;code&gt;notificationEmail&lt;/code&gt;, type: Plain Text Field or Email Field)&lt;/li&gt;&#xA;&lt;li&gt;Create a Form Relations Field (handle: &lt;code&gt;selectedForm&lt;/code&gt;, type: Form Relations Field)&lt;/li&gt;&#xA;&lt;li&gt;Define the email address you wish to use in your Plain Text field&lt;/li&gt;&#xA;&lt;li&gt;Create a relationship to your form&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In your Twig Template:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the &lt;code&gt;addFieldVariables&lt;/code&gt; tag to make your Entry's Email Address value available to your Invisible Field. Your page template would look something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Use the addFieldVariables tag to make variables &#xA;   available to the Invisible Field settings&#xA;   This tag has to come before the `displayForm` tag. #}&#xA;{% do craft.sproutForms.addFieldVariables({&#xA;    'secretEmailAddress': entry.notificationEmail&#xA;}) %}&#xA;&#xA;{% set formHandle = entry.selectedForm.one().handle %}&#xA;&#xA;{# Output the Form selected in your Form Relations field #}&#xA;{{ craft.sproutForms.displayForm( formHandle ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When this form is submitted, the &lt;code&gt;secretEmailAddress&lt;/code&gt; value is available to be processed by your Form's Invisible Field. And when the Notification Email is triggered, the Notification Email has access to the submitted Form Entry which has your custom Invisible Field.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-02-17T22:31:09.723" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29555" PostTypeId="1" CreationDate="2019-02-18T12:02:45.733" Score="1" ViewCount="155" Body="&lt;p&gt;I created a new custom action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A new button is added in &lt;code&gt;getAvailableActions()&lt;/code&gt; as we can se in below screenshot in red marked rectangle, now when i click on that button &#xA; (&lt;code&gt;Cusotm Action&lt;/code&gt;) i want to open a pop up box ( i used &lt;a href=&quot;https://github.com/pixelandtonic/garnishjs/blob/master/src/Modal.js&quot; rel=&quot;nofollow noreferrer&quot;&gt;Default pop up&lt;/a&gt; js lib.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ViGCW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ViGCW.png&quot; alt=&quot;custombutton&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template File path : /craft/plugins/tagmanager/templates/_mergetags.twig&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% includeJsResource &quot;tagmanager/js/tagmanager.js&quot; %}&#xA;&#xA;    &amp;lt;div class=&quot;btn menubtn btnMeregeTags&quot; role=&quot;button&quot;&amp;gt;{{ &quot;Merge Tags&quot;|t }}&amp;lt;/div&amp;gt;&#xA;    &amp;lt;div class=&quot;menu&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;mergetags-modal&quot; class=&quot;modal&quot;&amp;gt; &#xA;        &amp;lt;div id=&quot;modal&quot; class=&quot;body&quot;&amp;gt;&#xA;            &amp;lt;header class=&quot;header&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;Modal header&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;/header&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;js part&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(function () {&#xA;  $modal = new Garnish.Modal($('#mergetags-modal')); //create a new modal&#xA;  $modal.show();&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Iuz1z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Iuz1z.png&quot; alt=&quot;default pop up&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not able to open pop up correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="9313" LastEditDate="2019-02-23T18:20:04.373" LastActivityDate="2019-02-23T18:20:04.373" Title="Open pop on click of custom action and get filled data" Tags="&lt;plugin-development&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29556" PostTypeId="1" AcceptedAnswerId="29557" CreationDate="2019-02-18T12:24:41.687" Score="1" ViewCount="96" Body="&lt;p&gt;I'm aiming to display disabled entries for a logged in user and a message if no entries with this criteria exist. I've tried two different ways without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Version 1&lt;/strong&gt; gets all entries - live and disabled, gets those by the logged in user, and then tests for the entry status of disabled (which doesn't work).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section('profileEntry')&#xA;    .status(null)&#xA;    .all() %}&#xA;&#xA;     {% for entry in entries %}&#xA;&#xA;        {% if currentUser.id == entry.author.id %}&#xA;&#xA;            {% if entry.status == entry.status('disabled') %}&#xA;&#xA;                &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;&#xA;                {% else %}&#xA;&#xA;                &amp;lt;p&amp;gt;No entries exist&amp;lt;/p&amp;gt;&#xA;&#xA;            {% endif %} &#xA;&#xA;        {% endif %}     &#xA;&#xA;&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Version 2&lt;/strong&gt; only gets the disabled status entries, then the entries by the logged in user. Which doesn't work either.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section('profileEntry')&#xA;    .status('disabled')&#xA;    .all() %}    &#xA;&#xA;{% for entry in entries %}&#xA;&#xA;        {% if currentUser.id == entry.author.id %}&#xA;&#xA;        &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% else %}&#xA;&#xA;        &amp;lt;p&amp;gt;No entries exist&amp;lt;/p&amp;gt;&#xA;&#xA;        {% endif %}&#xA;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6614" LastActivityDate="2019-02-18T12:36:44.870" Title="Display notification if no entries exist for status criteria and logged in user" Tags="&lt;entries&gt;&lt;status&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29557" PostTypeId="2" ParentId="29556" CreationDate="2019-02-18T12:36:44.870" Score="2" Body="&lt;p&gt;Why don't you just grab &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#status&quot; rel=&quot;nofollow noreferrer&quot;&gt;disabled&lt;/a&gt; entries from the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#authorid&quot; rel=&quot;nofollow noreferrer&quot;&gt;author&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% set entries = craft.entries&#xA;    .section('profileEntry')&#xA;    .status('disabled')&#xA;    .authorId(currentUser.id)&#xA;    .all() %} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-else-clause&quot; rel=&quot;nofollow noreferrer&quot;&gt;loop&lt;/a&gt; those&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in entries %}&#xA;    {{ entry.title }}&#xA;{% else %}&#xA;    no entries found&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-18T12:36:44.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29558" PostTypeId="1" CreationDate="2019-02-18T13:15:04.220" Score="2" ViewCount="192" Body="&lt;p&gt;I have three volumes: content, hero and overview.&#xA;Each volume has his specific OptimizedImages Field(s).&#xA;Asset Fields are restricted to its specific source volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: A Super Table Field named hero that contains an Asset Field, which is restricted to the hero source volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an asset is set as a hero image and the client would move the asset in the asset manager to a different volume, two problems appear.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;On the entry, the image is set as hero image although the field doesn't allow an asset from an other source.&lt;/li&gt;&#xA;&lt;li&gt;In the template you can't call the hero OptimizedImages Field on the asset.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Even if you provide multiple conditionals in the template and some kind of fallback image, the client still sees the image set in the Craft CMS backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions how to solve this problem without putting everything in one volume?&lt;/p&gt;&#xA;" OwnerUserId="6843" LastActivityDate="2019-02-18T13:15:04.220" Title="Move an asset to another volume with volume specific OptimizedImages Field and on the entry a volume restricted Asset Field" Tags="&lt;craft3&gt;&lt;assets&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29559" PostTypeId="1" CreationDate="2019-02-18T15:44:11.393" Score="1" ViewCount="132" Body="&lt;p&gt;This works for filtering by tag array &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set relatedToParam = ['or'] %}&#xA;&#xA;{% for id in selectedTagIds %}&#xA;    {% set relatedToParam = relatedToParam|merge([{&#xA;        targetElement: id&#xA;    }]) %}&#xA;{% endfor %}&#xA;&#xA;{% set entries = craft.entries.relatedTo(relatedToParam) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can we add another relatedTo param for category so the results only show the selected tag entries from a category?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...WHERE categoryid = 'myid' AND (tag1 LIKE 'green' OR tag2 LIKE 'red' OR tag3 LIKE 'yellow' etc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9412" LastEditorUserId="57" LastEditDate="2019-02-19T00:09:52.823" LastActivityDate="2019-02-19T00:09:52.823" Title="How to filter entries by tags array using ['or'] and by category not using or" Tags="&lt;filtering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29560" PostTypeId="1" AcceptedAnswerId="29564" CreationDate="2019-02-18T17:36:31.823" Score="1" ViewCount="259" Body="&lt;p&gt;Getting this notification at the top of the control panel. This is a solo/free license version of Craft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It happened after I updated my client's domain's DNS to point to my server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I originally set it up, I installed craft on my media temple grid server. The access domain for it at that time was: &lt;a href=&quot;http://centraldsmhomes.com.s179491.gridserver.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://centraldsmhomes.com.s179491.gridserver.com&lt;/a&gt;. As soon as I updated the DNS for centraldshhomes.com to point to my mediatemple server, I got the license issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't seem to find any solutions to this problem. &lt;/p&gt;&#xA;" OwnerUserId="5938" LastActivityDate="2019-02-18T18:50:23.527" Title="&quot;The license located at config/license.key belongs to gridserver.com&quot;" Tags="&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29561" PostTypeId="2" ParentId="29559" CreationDate="2019-02-18T17:44:10.763" Score="2" Body="&lt;p&gt;The &lt;code&gt;relatedTo&lt;/code&gt; function accepts multiple different formats. If you want to search for Elements that are related to a list of categories and a list of tags you can do that like this&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;relatedTo([&#xA;    'and',&#xA;    ['element' =&amp;gt; [1, 2, 3]],&#xA;    ['element' =&amp;gt; [4, 5, 6]]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will return you all Elements that are related to the first array and related to the second array. So you goal should be to create an array of category IDs and Tag IDs and pass them together in the &lt;code&gt;relatedTo&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get Elements that are related to all elements of one array and a single one from another array do the following&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;relatedTo([&#xA;    'and',&#xA;    ['element' =&amp;gt; [1, 2, 3]],&#xA;    ['element' =&amp;gt; ['and', 4, 5, 6]]&#xA;]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-18T17:44:10.763" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29563" PostTypeId="1" CreationDate="2019-02-18T18:48:14.533" Score="1" ViewCount="43" Body="&lt;p&gt;I have an include that is being used for plain entries, and is also being used for categories. (Categories have their own urls)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% set entry = entry %}&#xA;{% elseif category is defined %}&#xA;    {% set entry = category %}&#xA;{% elseif event is defined %}&#xA;    {% set entry = event %}&#xA;{% endif %}&#xA;&#xA;...&#xA;&#xA;&amp;lt;h1&amp;gt;{{ entry.title }}&amp;lt;/h1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using the &lt;a href=&quot;https://solspace.com/craft/calendar/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solspace&lt;/a&gt; Calendar and would like to use the same hero template. However, I'm getting the &quot;entry is not defined&quot;. I am not sure what the calendar entry type is. Is there a way to output what Craft is expecting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if entry is defined %}&#xA;    {% set entry = entry %}&#xA;{% elseif category is defined %}&#xA;    {% set entry = category %}&#xA;{% elseif calendar is defined %}&#xA;    ...&#xA;{% endif %}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="2275" LastActivityDate="2019-02-18T18:48:14.533" Title="How can I find out what type of entry is getting used?" Tags="&lt;templating&gt;&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29564" PostTypeId="2" ParentId="29560" CreationDate="2019-02-18T18:50:23.527" Score="1" Body="&lt;p&gt;You need to log into id.craftcms.com and re-assign the license to the appropriate domain e.g. centraldshhomes.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft automatically gets the top level domain when you grab a license, as part of our workflow we just assign it closer to go live / deployment.&lt;/p&gt;&#xA;" OwnerUserId="8171" LastActivityDate="2019-02-18T18:50:23.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29565" PostTypeId="2" ParentId="29548" CreationDate="2019-02-18T19:09:19.657" Score="2" Body="&lt;p&gt;When you take a deeper look into &lt;code&gt;redirectToPostedUrl&lt;/code&gt; you'll see &lt;a href=&quot;https://github.com/craftcms/cms/blob/master/src/web/View.php#L484&quot; rel=&quot;nofollow noreferrer&quot;&gt;these lines&lt;/a&gt;. All they do is convert the &lt;code&gt;Object&lt;/code&gt; into an array, so they fetch every property of the object and pass those to the template to use them directly. You have everything the Object has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can access those attributes via short syntax &lt;code&gt;{title}&lt;/code&gt; which is the same as &lt;code&gt;{{ object.title }}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you have an &lt;code&gt;yii/model/MyFancyModel&lt;/code&gt; with the following attributes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    'id' =&amp;gt; 4,&#xA;    'title' =&amp;gt; 'foo',&#xA;    'someRelation =&amp;gt; ['foo' =&amp;gt; 'bar']&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Craft will merge this array with &lt;code&gt;['object' =&amp;gt; $object]&lt;/code&gt; and you have access to &lt;code&gt;{ id }&lt;/code&gt;, &lt;code&gt;{ title }&lt;/code&gt;, &lt;code&gt;{ someRelation.foo }&lt;/code&gt; as well as &lt;code&gt;{{ object.id }}&lt;/code&gt; (and all others) as well as all other variables passed via &lt;code&gt;variables&lt;/code&gt; the third attribute of the function, since &lt;code&gt;redirectToPostedUrl&lt;/code&gt; doesn't pass a third argument these additional attributes are an empty array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;code&gt;{ siteUrl }&lt;/code&gt; is nothing else than &lt;code&gt;{{ object.siteUrl }}&lt;/code&gt; which is basically &lt;code&gt;{{ entry.siteUrl }}&lt;/code&gt; that means the &lt;code&gt;siteUrl&lt;/code&gt; of your Element. When you do &lt;code&gt;{ type.handle }&lt;/code&gt; (with an Entry)  it will render the &lt;code&gt;handle&lt;/code&gt; of your &lt;code&gt;EntryType&lt;/code&gt;. When your Object is a user you can do &lt;code&gt;{ email }&lt;/code&gt; to display his/her email.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more note: The attributes of the Model are fetched via &lt;code&gt;Arrayable&lt;/code&gt; Trait if it has it. So it grabs all &lt;code&gt;fields&lt;/code&gt; and &lt;code&gt;extraFields&lt;/code&gt; gets those attributes. I can provide further explanations about &lt;code&gt;fields&lt;/code&gt; and how they work exactly in detail if you like&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-02-18T19:16:58.417" LastActivityDate="2019-02-18T19:16:58.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29566" PostTypeId="2" ParentId="29507" CreationDate="2019-02-18T21:04:47.443" Score="1" Body="&lt;p&gt;Looks like the server didn't like the .htaccess file we use for Craft 2 - specifically this part: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_mime.c&amp;gt;&#xA;   AddCharset utf-8 .atom \&#xA;                    .bbaw \&#xA;                    .css \&#xA;                    .geojson \&#xA;                    .ics \&#xA;                    .js \&#xA;                    .json \&#xA;                    .jsonld \&#xA;                    .manifest \&#xA;                    .markdown \&#xA;                    .md \&#xA;                    .mjs \&#xA;                    .rdf \&#xA;                    .rss \&#xA;                    .topojson \&#xA;                    .webapp \&#xA;                    .webmanifest \&#xA;                    .xloc \&#xA;                    .xml&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There weren't any errors in Craft but the PHP logs did have some information that helped us track this down.&lt;/p&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="57" LastEditDate="2019-02-19T00:11:32.397" LastActivityDate="2019-02-19T00:11:32.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29567" PostTypeId="2" ParentId="14746" CreationDate="2019-02-19T06:51:11.643" Score="5" Body="&lt;p&gt;If you're here looking for a Craft 3 answer, the &lt;a href=&quot;https://wordsmith.docs.topshelfcraft.com/guide/markdown.html#markdown&quot; rel=&quot;noreferrer&quot;&gt;Wordsmith plugin&lt;/a&gt; offers the same ability to only parse inline and not include paragraph tags:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.title|markdown(inlineOnly=true) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastActivityDate="2019-02-19T06:51:11.643" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29568" PostTypeId="1" CreationDate="2019-02-19T10:31:39.033" Score="2" ViewCount="246" Body="&lt;p&gt;I'm working with Matrix field. When adding and then removing and then adding again fields with the same handle I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Handle &quot;videoUrl&quot; has already been taken.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of removing old handles that are not being used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually creating issues adding new fields with a different handle too. Even though a new handle is being used an old handle is being referenced as a blocker to adding a new field. I get the following error when trying to save a post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Invalid field handle: embed&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Embed' isn't even listed in the field manager area as a field handle but the problem persists.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2019-02-19T11:16:18.290" LastActivityDate="2019-02-19T11:54:13.670" Title="Removing old Block Handles in Matrix Field?" Tags="&lt;craft3&gt;&lt;matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29569" PostTypeId="2" ParentId="23111" CreationDate="2019-02-19T11:02:14.130" Score="1" Body="&lt;p&gt;I wrote a transformer class that does exactly this:&#xA;    &#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace your\awesome\namespace;&#xA;&#xA;use Craft;&#xA;use craft\elements\Entry;&#xA;use League\Fractal\TransformerAbstract;&#xA;use craft\web\View;&#xA;&#xA;/**&#xA; * Class TwigTransformer&#xA; * Renders a TWIG entry for each item&#xA; */&#xA;&#xA;class TwigTransformer extends TransformerAbstract&#xA;{&#xA;    private $twigTemplateFilePath;&#xA;&#xA;    public function __construct($twigTemplateFilePath)&#xA;    {&#xA;        $this-&amp;gt;twigTemplateFilePath = $twigTemplateFilePath;&#xA;    }&#xA;&#xA;    public function transform(Entry $entry)&#xA;    {&#xA;        $oldMode = Craft::$app-&amp;gt;view-&amp;gt;getTemplateMode();&#xA;        Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_SITE);&#xA;        $html = Craft::$app-&amp;gt;view-&amp;gt;renderTemplate( $this-&amp;gt;twigTemplateFilePath, ['entry' =&amp;gt; $entry]);&#xA;        Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode($oldMode);&#xA;&#xA;        return [&#xA;            'id' =&amp;gt; $entry-&amp;gt;id,&#xA;            'html' =&amp;gt; $html&#xA;        ];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could use the class likes this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'transformer' =&amp;gt; new TwigTransformer('includes/_overview-entry.twig'),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9416" LastActivityDate="2019-02-19T11:02:14.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29570" PostTypeId="2" ParentId="29568" CreationDate="2019-02-19T11:05:05.843" Score="1" Body="&lt;p&gt;Tried it here and seems ok. Once you have deleted your field, are you saving your matrix block (top right button)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you delete the field then try to recreate it straight away (or any other field for that matter), it gives you the &lt;em&gt;Handle &quot;videoUrl&quot; has already been taken.&lt;/em&gt; until you save the block. Once you save, you should be ok to recreate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does seem a bit buggy though as you need to save in between each action... Might need to see what the craft guys think.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-19T11:05:05.843" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29571" PostTypeId="1" AcceptedAnswerId="29572" CreationDate="2019-02-19T11:25:11.190" Score="1" ViewCount="17" Body="&lt;p&gt;How do I get pagination set up with the following? It should be easy but I'm getting in a muddle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set myUserQuery = craft.users().group('members').order('companyName asc').limit(10).find %}&#xA;{% set users = myUserQuery %}&#xA;&#xA;&#xA;&amp;lt;div class=&quot;col-24 gutter-bottom--none flex-container&quot;&amp;gt;&#xA;&#xA;  {% for user in users %}&#xA;      {% include &quot;includes/_directory-list&quot; %}&#xA;  {% endfor %}&#xA;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% include &quot;includes/_pagination&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I thought I might be able to do this, but no&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% paginate users %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2019-02-19T11:36:28.697" Title="Pagination with users" Tags="&lt;pagination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29572" PostTypeId="2" ParentId="29571" CreationDate="2019-02-19T11:36:28.697" Score="1" Body="&lt;pre&gt;&lt;code&gt;{% paginate myUserQuery as users  %}&#xA;&#xA;{% for user in users %}&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/paginate.html#showing-the-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;This should help you&lt;/a&gt; also.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-02-19T11:36:28.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29575" PostTypeId="2" ParentId="29568" CreationDate="2019-02-19T11:54:13.670" Score="0" Body="&lt;p&gt;So I used the following to find unused fields in the database. Then I manually removed them. Please backup before doing this!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT f.* FROM fields f LEFT JOIN fieldlayoutfields l ON l.fieldId = f.id WHERE l.id IS NULL&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-02-19T11:54:13.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29576" PostTypeId="1" CreationDate="2019-02-19T12:49:46.887" Score="1" ViewCount="61" Body="&lt;p&gt;I have a lot of trouble in understanding the database/model structure and how to work with the query builder.&#xA;I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. I would like some help with a query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix field is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entry&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;audienceTarget(matrix)&lt;/li&gt;&#xA;&lt;li&gt;audience (block type)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;targetName (field type: category)&lt;/li&gt;&#xA;&lt;li&gt;points (field type: dropdown)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We use this to segment entries for certain users so we can show users that are segmented more relevant entries&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before i'm running the query i have the ids of the audience.targetName i want to favour in a variable let say $mainSegment. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What i am trying to do:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I want to query entries with the default order &quot;postDate&quot; but i like to place the relevant entries first. so all the entries that has the category id i specify must be first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when a user is segmented on targetName(category) with id 2.&#xA;I want to favour all the posts that has a block type with segment 2 selected on the matrix in my order by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could not find a lot of craft examples with complex queries so it would be very helpful if someone could give me some examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="9416" LastEditorUserId="9416" LastEditDate="2019-02-20T16:02:14.723" LastActivityDate="2019-02-20T16:02:14.723" Title="Order entries by a matrix field category" Tags="&lt;matrix&gt;&lt;query&gt;&lt;entrymodel&gt;&lt;yii&gt;&lt;elementquery&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29577" PostTypeId="2" ParentId="19668" CreationDate="2019-02-19T14:45:29.590" Score="1" Body="&lt;p&gt;This can be done using an Invisible Field and the &lt;code&gt;addFieldVariables&lt;/code&gt; tag.  Define the value you want as your email in your template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do craft.sproutForms.addFieldVariables({&#xA;    'secretEmailAddress': entry.author.email&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Set the Invisible Field to target that value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{secretEmailAddress}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then customize the Notification Email Recipients field to target the handle of the Invisible Field:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{invisibleFieldHandle}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another example of doing this dynamically from an Entry with a Form Relations field has been posted in response to another question here: &lt;a href=&quot;https://craftcms.stackexchange.com/a/29553/115&quot;&gt;https://craftcms.stackexchange.com/a/29553/115&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-02-19T14:45:29.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29578" PostTypeId="1" CreationDate="2019-02-19T15:11:38.713" Score="1" ViewCount="39" Body="&lt;p&gt;We're just in the process of upgrading from Craft 2 with Commerce 1 to Craft 3 and Commerce 2. One of the issues we had before was that the client was getting confirmation emails for test orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to set the confirmation email destination in the .env file so our team can set themselves as the target emails for their own local testing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="57" LastEditDate="2019-02-19T18:40:21.403" LastActivityDate="2019-02-20T09:28:42.220" Title="How to set Commerce 2 confirmation email in .env file?" Tags="&lt;plugin-craftcommerce&gt;&lt;multi-environment&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29579" PostTypeId="2" ParentId="29578" CreationDate="2019-02-19T16:05:43.937" Score="2" Body="&lt;p&gt;Could you use the &lt;code&gt;testToEmailAddress&lt;/code&gt; config setting in your &lt;code&gt;config.php&lt;/code&gt;? As this will send all emails to a single address. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'testToEmailAddress' =&amp;gt; getenv('TEST_TO_EMAIL_ADDRESS')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your &lt;code&gt;.env&lt;/code&gt; set:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;TEST_TO_EMAIL_ADDRESS=&quot;email@email.com&quot;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="3807" LastEditDate="2019-02-20T09:28:42.220" LastActivityDate="2019-02-20T09:28:42.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29580" PostTypeId="1" CreationDate="2019-02-19T16:30:01.950" Score="1" ViewCount="133" Body="&lt;p&gt;I've been using Craft CMS for a while, but haven't seen any way to get the following done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking to create a page with a large image on it. The image would be overlayed with buttons that pop-out a text box or overlaid image. I'd like to place the pop-out boxes/graphics all over the image in specific places, but the creation interfaces I've seen only let me put one image after another in a list, or rectilinear fashion. &#xA;I'm hoping to create a map of a neighborhood where clicking on different buildings/elements pops out another window with more information regarding that area/element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this is understandable, if more clarity is needed please let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9417" LastEditorUserId="57" LastEditDate="2019-07-24T04:38:14.660" LastActivityDate="2019-07-24T04:38:14.660" Title="Custom Clickable Image" Tags="&lt;image&gt;&lt;custom&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29581" PostTypeId="1" AcceptedAnswerId="29585" CreationDate="2019-02-19T16:45:55.553" Score="1" ViewCount="496" Body="&lt;p&gt;I'm finding myself stuck with filtering entries that are related to categories using a category field. I'm looking to build a sub-navigation on a page, where I can select from a select field or from a dropdown nav. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried following this but no luck. It doesn't work for me. &#xA;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/15218/how-to-load-entries-via-ajax-when-a-filter-is-clicked?rq=1&quot;&gt;How to load entries via ajax when a filter is clicked?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also would love to have 2 or 3 category fields. In the end, I am trying to create something very similar to crafts partner page filtering.&#xA;&lt;a href=&quot;https://craftcms.com/partners/category?locations=&amp;amp;partnerCapabilities=&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftcms.com/partners/category?locations=&amp;amp;partnerCapabilities=&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could share their filtering snippets, I would greatly appreciate it :)&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2019-02-20T07:34:55.133" Title="Filter Entries by Category fields &amp; refresh URL and list with AJAX" Tags="&lt;categories&gt;&lt;ajax&gt;&lt;filter&gt;&lt;filtering&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29582" PostTypeId="1" AcceptedAnswerId="29617" CreationDate="2019-02-19T17:33:10.937" Score="1" ViewCount="75" Body="&lt;p&gt;I'll freely admit to being a bit of a newb when it comes to SSH but wanting to start utilizing it more for my Craft3 sites. Maybe this is an irrelevant question but is it possible to update craft on the live server through ssh?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm ssh'd into my server and tried &lt;code&gt;./craft update all&lt;/code&gt; but I keep getting &lt;code&gt;Permission denied&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;composer update&lt;/code&gt; works fine though. Am I making a mistake or is it more of a hosting configuration issue?&lt;/p&gt;&#xA;" OwnerUserId="2257" LastEditorUserId="57" LastEditDate="2019-02-23T03:42:22.967" LastActivityDate="2019-02-23T03:42:22.967" Title="Updates on live server without using Control Panel" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;cli&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29583" PostTypeId="1" AcceptedAnswerId="29648" CreationDate="2019-02-19T18:16:17.400" Score="1" ViewCount="64" Body="&lt;p&gt;I have created a digital product type and a digital product but strangely on the digital products template I can't access any information regarding the product like for example, entry.title. I'm getting a &lt;code&gt;Variable &quot;entry&quot; does not exist.&lt;/code&gt; error. Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2019-02-26T13:09:37.040" Title="How to access a digital products information on the products page in Craft Commerce?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;plugin-digitalproducts&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29585" PostTypeId="2" ParentId="29581" CreationDate="2019-02-20T07:34:55.133" Score="2" Body="&lt;p&gt;First you need some HTML/Twig logic to display your categories&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div&amp;gt;&#xA;    {% for category in categories %}&#xA;        &amp;lt;input data-id=&quot;{{ category.id }}&quot; data-slug=&quot;{{ category.slug }}&quot; type=&quot;checkbox&quot; class=&quot;category-filter&quot;&amp;gt;{{ category.title }}&#xA;    {% endfor %}&#xA;&#xA;    &amp;lt;a href=&quot;&quot; id=&quot;submit&quot;&amp;gt;Submit&amp;lt;/a&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then some Javascript logic to make an ajax request, keep in mind you need some variables for csrf protection&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-JS prettyprint-override&quot;&gt;&lt;code&gt;window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName|e('js') }}&quot;&#xA;window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken|e('js') }}&quot;;&#xA;window.siteUrl = '{{ entry.getUrl() }}';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$(document).ready(function () {&#xA;    $('#submit').click(function (e) {&#xA;        e.preventDefault();&#xA;        var checked = $('.category-filter:checked');&#xA;        var ids = [];&#xA;        var slugs = [];&#xA;        $.each(checked, function (index, item) {&#xA;            ids.push(item.dataset.id);&#xA;            slugs.push(item.dataset.slug);&#xA;        });&#xA;&#xA;        var data = {&#xA;            action: 'plugin-id/controller-id/action-id',&#xA;            ids: ids&#xA;        }&#xA;        data[window.csrfTokenName] = window.csrfTokenValue&#xA;&#xA;        var newUrl = siteUrl + '?location=' + slugs.join();&#xA;        $.ajax({&#xA;            url: '/',&#xA;            data: data,&#xA;            type: 'POST',&#xA;            dataType: 'json',&#xA;            success: function (response) {&#xA;                console.log(response);&#xA;                history.replaceState({}, '', newUrl);&#xA;            }&#xA;        });&#xA;    })&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally your Controller&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public function actionIndex()&#xA;{&#xA;    $ids = Craft::$app-&amp;gt;getRequest()-&amp;gt;getBodyParam('ids');&#xA;    $entries = Entry::find()&#xA;        -&amp;gt;relatedTo($ids)&#xA;        -&amp;gt;asArray()&#xA;        -&amp;gt;select(['elements.id', 'title'])&#xA;        -&amp;gt;all();&#xA;&#xA;    return $this-&amp;gt;asJson([&#xA;        'entries' =&amp;gt; $entries&#xA;    ]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-20T07:34:55.133" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29586" PostTypeId="1" AcceptedAnswerId="29587" CreationDate="2019-02-20T07:49:23.823" Score="1" ViewCount="388" Body="&lt;p&gt;I would like to get all enabled variants for a product. I refer to the following question, where a method for limiting a for-loop is given:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/21093/disabled-product-variant-still-shows-in-for-loop&quot;&gt;Disabled product variant still shows in {% for %} loop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the comments Andreas provides a way to get all enabled variants for a product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set variants = craft.commerce.variants({ product: product, enabled: true }) %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in my case this does not return any variants, while there are two active. Instead, it returns the following object:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object(craft\commerce\services\Variants)#2364 (3) {&#xA;  [&quot;_events&quot;:&quot;yii\base\Component&quot;:private]=&amp;gt;&#xA;  array(0) {&#xA;  }&#xA;  [&quot;_eventWildcards&quot;:&quot;yii\base\Component&quot;:private]=&amp;gt;&#xA;  array(0) {&#xA;  }&#xA;  [&quot;_behaviors&quot;:&quot;yii\base\Component&quot;:private]=&amp;gt;&#xA;  NULL&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I get all the active variants for a product?&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="57" LastEditDate="2019-02-21T04:39:43.337" LastActivityDate="2019-02-21T04:39:43.337" Title="Get only enabled variants of a product" Tags="&lt;plugin-craftcommerce&gt;&lt;variants&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29587" PostTypeId="2" ParentId="29586" CreationDate="2019-02-20T08:17:38.087" Score="3" Body="&lt;p&gt;If you already have the product&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$product = Product::find()-&amp;gt;one();&#xA;$variants = ArrayHelper::filterByValue($product-&amp;gt;variants, 'enabled', 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set product = craft.products.one() %}&#xA;{% set variants = product.variants|filterByValue('enabled', &quot;1&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you don't have the product&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Twig&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set variants = craft&#xA;    .commerce&#xA;    .variants&#xA;    .productId(x)&#xA;    .all() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;PHP&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$variants = Variant::find()&#xA;    -&amp;gt;productId(x)&#xA;    -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-02-20T08:24:17.760" LastActivityDate="2019-02-20T08:24:17.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29588" PostTypeId="2" ParentId="29580" CreationDate="2019-02-20T08:56:07.400" Score="2" Body="&lt;p&gt;Whilst this mainly seems like a front-end development question, and Dr_Codswallop has perfectly summed up some steps in the comments to tackle that, as an answer for the Craft CMS specific side of the question there is a plugin I have used in the past that is very helpful, but it is only for &lt;strong&gt;Craft 2.x&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/simplygoodwork/donkeytail-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;Donkeytail&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have had a look through the &lt;a href=&quot;https://plugins.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin store&lt;/a&gt; and I can't find an alternative plugin for &lt;strong&gt;Craft 3.x&lt;/strong&gt;, so it looks like you will need to follow Dr_Codswallops instructions and build up something manually if you are running this version of Craft.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-02-20T08:56:07.400" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29589" PostTypeId="1" AcceptedAnswerId="29590" CreationDate="2019-02-20T11:29:09.593" Score="0" ViewCount="459" Body="&lt;p&gt;I'm trying to make a simple post request with ajax to a controller in plugin.&#xA;The problem I'm having is that I always get a 400 Bad request because I don't send a valid CSRF Token.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't figure out how to get this in javascript. I found multiple examples saying you get it by calling&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft.getCsrfInput();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this only works in &quot;CP mode&quot;, on the front-end the Craft object is not available. I also found that importing it is not a good idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So anyone who can tell me how to do this?&lt;/p&gt;&#xA;" OwnerUserId="7577" LastActivityDate="2019-02-20T12:30:44.050" Title="Ajax post request front-end csrf token" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;ajax&gt;&lt;javascript&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29590" PostTypeId="2" ParentId="29589" CreationDate="2019-02-20T12:30:44.050" Score="2" Body="&lt;p&gt;You can take a look at the guide &lt;a href=&quot;https://craftcms.com/guides/enabling-csrf-protection#updating-your-javascript&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enabling CSRF Protection&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-JavaScript prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&#xA;    window.csrfTokenName = &quot;{{ craft.app.config.general.csrfTokenName|e('js') }}&quot;;&#xA;    window.csrfTokenValue = &quot;{{ craft.app.request.csrfToken|e('js') }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;var data = {&#xA;    // ...&#xA;};&#xA;&#xA;// Add the CSRF Token&#xA;data[csrfTokenName] = csrfTokenValue;&#xA;&#xA;$.post('/some/url', data, function(response, textStatus, jqXHR) {&#xA;    // ...&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-20T12:30:44.050" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29591" PostTypeId="1" AcceptedAnswerId="29592" CreationDate="2019-02-20T14:23:11.940" Score="1" ViewCount="795" Body="&lt;p&gt;I am using the Craft Contact Form plugin (&lt;a href=&quot;https://github.com/craftcms/contact-form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/contact-form&lt;/a&gt;) and am having an issue where I get an error page on submission. The form is submitting correctly (the submission is appearing in Form Submissions from this plugin &lt;a href=&quot;https://github.com/Rias500/craft-contact-form-extensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Rias500/craft-contact-form-extensions&lt;/a&gt;) but I am getting an error page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I would like to be redirected to the same &lt;code&gt;/contact&lt;/code&gt; page with the Success flash message displayed instead of the contact form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have on my &lt;code&gt;contact.twig&lt;/code&gt; page template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        &amp;lt;div class=&quot;contact-form&quot;&amp;gt;&#xA;          {% if craft.app.session.hasFlash('notice') %}&#xA;          &amp;lt;div class=&quot;notification&quot;&amp;gt;&#xA;    &amp;lt;p class=&quot;message notice&quot;&amp;gt;{{ craft.app.session.getFlash('notice') }}&amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% elseif craft.app.session.hasFlash('error') %}&#xA;    &amp;lt;p class=&quot;message error&quot;&amp;gt;{{ craft.app.session.getFlash('error') }}&amp;lt;/p&amp;gt;&#xA;{% else %}&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;    {{ redirectInput('contact') }}&#xA;      &amp;lt;div class=&quot;element&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;name&quot;&amp;gt;Name &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;name&quot; type=&quot;text&quot; required name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;element&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;email&quot;&amp;gt;Email Address &amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt;&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;email&quot; type=&quot;email&quot; required name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;element&quot;&amp;gt;&#xA;      &amp;lt;label for=&quot;phone&quot;&amp;gt;Telephone Number&amp;lt;/label&amp;gt;&#xA;      &amp;lt;input id=&quot;phone&quot; type=&quot;text&quot; required name=&quot;message[phone]&quot; value=&quot;{{ message.phone ?? '' }}&quot;&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;element&quot;&amp;gt;&#xA;        &amp;lt;p class=&quot;required-info text-small&quot;&amp;gt;&amp;lt;span class=&quot;required&quot;&amp;gt;*&amp;lt;/span&amp;gt; Required Fields&amp;lt;/p&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;      &amp;lt;div class=&quot;element&quot;&amp;gt;&#xA;        &amp;lt;label for=&quot;message&quot;&amp;gt;Message&amp;lt;/label&amp;gt;&#xA;        &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&amp;gt;{{ message.message ?? '' }}&amp;lt;/textarea&amp;gt;&#xA;      &amp;lt;/div&amp;gt;&#xA;    &amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;{% endif %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the error I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft\web\twig\TemplateLoaderException: Unable to find the template “”. in /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/twig/TemplateLoader.php:122&#xA;Stack trace:&#xA;#0 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/twig/TemplateLoader.php(75): craft\web\twig\TemplateLoader-&amp;gt;_resolveTemplate('')&#xA;#1 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/twig/twig/lib/Twig/Environment.php(270): craft\web\twig\TemplateLoader-&amp;gt;getCacheKey('')&#xA;#2 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/twig/twig/lib/Twig/Environment.php(350): Twig_Environment-&amp;gt;getTemplateClass('')&#xA;#3 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/twig/Environment.php(40): Twig_Environment-&amp;gt;loadTemplate('', NULL)&#xA;#4 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/twig/twig/lib/Twig/Environment.php(289): craft\web\twig\Environment-&amp;gt;loadTemplate('')&#xA;#5 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/View.php(337): Twig_Environment-&amp;gt;render('', Array)&#xA;#6 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/rias/craft-contact-form-extensions/src/ContactFormExtensions.php(136): craft\web\View-&amp;gt;renderTemplate('', Array)&#xA;#7 [internal function]: rias\contactformextensions\ContactFormExtensions-&amp;gt;rias\contactformextensions\{closure}(Object(craft\contactform\events\SendEvent))&#xA;#8 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/Event.php(310): call_user_func(Object(Closure), Object(craft\contactform\events\SendEvent))&#xA;#9 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\\contactfo...', 'beforeSend', Object(craft\contactform\events\SendEvent))&#xA;#10 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/contact-form/src/Mailer.php(93): yii\base\Component-&amp;gt;trigger('beforeSend', Object(craft\contactform\events\SendEvent))&#xA;#11 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/contact-form/src/controllers/SendController.php(59): craft\contactform\Mailer-&amp;gt;send(Object(craft\contactform\models\Submission))&#xA;#12 [internal function]: craft\contactform\controllers\SendController-&amp;gt;actionIndex()&#xA;#13 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#14 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#15 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller-&amp;gt;runAction('', Array)&#xA;#16 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('', Array)&#xA;#17 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module-&amp;gt;runAction('contact-form/se...', Array)&#xA;#18 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/Application.php(561): craft\web\Application-&amp;gt;runAction('contact-form/se...', Array)&#xA;#19 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application-&amp;gt;_processActionRequest(Object(craft\web\Request))&#xA;#20 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#21 /Users/user/Dropbox/GIANT/Potter Group Website/Site/build/public_html/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#22 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no idea where I am going wrong with this so any help greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="8797" LastActivityDate="2019-02-20T14:46:10.833" Title="Error with Contact Form plugin on submission" Tags="&lt;craft3&gt;&lt;plugin-contactform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29592" PostTypeId="2" ParentId="29591" CreationDate="2019-02-20T14:29:11.300" Score="2" Body="&lt;p&gt;If you want to redirect to the same page as you are sending, you can remove &lt;code&gt;{{ redirectInput('contact') }}&lt;/code&gt; as &lt;a href=&quot;https://github.com/craftcms/contact-form#redirecting-after-submit&quot; rel=&quot;nofollow noreferrer&quot;&gt;per here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here though, it's the ContactFormExtensions plugin shouting at you. Do you have an email template set in there? If you enabled the 'Send confirmation' setting, you need to give it a template.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-20T14:46:10.833" LastActivityDate="2019-02-20T14:46:10.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29593" PostTypeId="1" CreationDate="2019-02-20T19:29:38.440" Score="1" ViewCount="186" Body="&lt;p&gt;When using XMLHttpRequest to update cart like the following, I get a 500 error for &lt;code&gt;'lineItems': {[lineitem]: {'qty': value}}&lt;/code&gt; (and also &lt;code&gt;{[lineitem]: {'remove': true}}&lt;/code&gt;, any other submission works);&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = document.querySelector('form#cart-form input[name=&quot;action&quot;]').value;&#xA;var data = {&#xA;    'action': 'commerce/cart/update-cart',&#xA;    'lineItems': {[lineitem]: {'qty': value}}&#xA;}&#xA;data[csrfname] = csrfvalue;&#xA;&#xA;atomic(url, {&#xA;    method: 'POST',&#xA;    data: data,&#xA;    headers: {&#xA;        &quot;Content-Type&quot;: 'application/x-www-form-urlencoded',&#xA;        'X-Requested-With': 'XMLHttpRequest',&#xA;        'Accept': 'application/json'&#xA;    }&#xA;}).then(function(response) {&#xA;    console.log(response.data);&#xA;    console.log(response.xhr);&#xA;}).catch(function(error) {&#xA;    console.log(error.status);&#xA;    console.log(error.statusText);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(The code above uses &lt;a href=&quot;https://github.com/cferdinandi/atomic/&quot; rel=&quot;nofollow noreferrer&quot;&gt;atomic&lt;/a&gt;, which is just a small library to wrap XMLHttpRequest into a promise structure similar to using fetch).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The submitted data is (and looks) exactly the same as what I pass through JQuery Ajax, which works;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var url = document.querySelector('form#cart-form input[name=&quot;action&quot;]').value;&#xA;var data = {&#xA;    'action': 'commerce/cart/update-cart',&#xA;    'lineItems': {[lineitem]: {'qty': value}}&#xA;}&#xA;data[csrfname] = csrfvalue;&#xA;&#xA;$.ajax({&#xA;    type: &quot;POST&quot;,&#xA;    dataType: 'json',&#xA;    url: '',&#xA;    data: data,&#xA;    success: function(response){&#xA;        console.log(response);&#xA;        }&#xA;    }&#xA;}).fail(function(error) {&#xA;    console.log('Error: ' + error);&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't seem to figure out what the issue is, as the POST data being submitted looks EXACTLY the same. Changing the &lt;code&gt;Content-Type&lt;/code&gt; to &lt;code&gt;application/json&lt;/code&gt; doesn't work either. Anyone run into this issue?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2019-02-20T22:07:36.807" LastActivityDate="2019-02-20T22:07:36.807" Title="XMLHttpRequest Craft Commerce Cart Update Issues" Tags="&lt;craft3&gt;&lt;ajax&gt;&lt;plugin-craftcommerce2&gt;&lt;xmlhttprequest&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29594" PostTypeId="1" AcceptedAnswerId="29670" CreationDate="2019-02-20T19:48:25.877" Score="1" ViewCount="61" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm creating a localized site on Craft2 and CraftCommerce. I have followed the instructions for creating a localized site but none of the content shows at the localized URL and the homepage shows the craft default template. The default template has no content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CP, the language is available in the upper right of an entry. The fields that are translatable are labelled. When I click the language, the Craft &quot;not found&quot; page is shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that because no fields exist for the language, no fields can be shown on the front end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error from the logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2019/02/22 11:28:37 [error] [exception.Craft\HttpException.404] Craft\HttpException in /usr/home/name/temp.domain.com/craft/app/controllers/EntriesController.php:773&#xA;Stack trace:&#xA;#0 /usr/home/name/temp.domain.com/craft/app/controllers/EntriesController.php(52): Craft\EntriesController-&amp;gt;_prepEditEntryVariables(Array)&#xA;#1 [internal function]: Craft\EntriesController-&amp;gt;actionEditEntry(Array)&#xA;#2 /usr/home/name/temp.domain.com/craft/app/framework/web/actions/CAction.php(109): ReflectionMethod-&amp;gt;invokeArgs(Object(Craft\EntriesController), Array)&#xA;#3 /usr/home/name/temp.domain.com/craft/app/framework/web/actions/CInlineAction.php(47): CAction-&amp;gt;runWithParamsInternal(Object(Craft\EntriesController), Object(ReflectionMethod), Array)&#xA;#4 /usr/home/name/temp.domain.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#5 /usr/home/name/temp.domain.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#6 /usr/home/name/temp.domain.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#7 /usr/home/name/temp.domain.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('editEntry')&#xA;#8 /usr/home/name/temp.domain.com/craft/app/framework/web/CWebApplication.php(141): CWebApplication-&amp;gt;runController('entries/editEnt...')&#xA;#9 /usr/home/name/temp.domain.com/craft/app/etc/web/WebApp.php(291): CWebApplication-&amp;gt;processRequest()&#xA;#10 /usr/home/name/temp.domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#11 /usr/home/name/temp.domain.com/craft/app/index.php(73): CApplication-&amp;gt;run()&#xA;#12 /usr/home/name/temp.domain.com/public_html/index.php(20): require_once('/usr/home/name/...')&#xA;#13 {main}&#xA;REQUEST_URI=/admin/entries/contact/5-contact/en_gb&#xA;HTTP_REFERER=http://temp.domain.com/admin/entries/contact/5-contact&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I've done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned, I've followed the instructions in the Craft docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have updated the asset indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used environment variables like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'temp.domain.com' =&amp;gt; array(&#xA;        'environmentVariables' =&amp;gt; array(&#xA;        'devMode' =&amp;gt; true,&#xA;        'basePath' =&amp;gt; '/usr/home/business/temp.domain.com/public_html/',&#xA;        'baseUrl'  =&amp;gt; 'http://temp.domain.com/',&#xA;        ),&#xA;        'siteUrl' =&amp;gt; array(&#xA;        'en_us' =&amp;gt; 'http://temp.domain.com/',&#xA;        'en_gb' =&amp;gt; 'http://temp.domain.com/en_gb',&#xA;        )&#xA;    ),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have verified that asset source settings are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{basePath}images_product/&#xA;{baseUrl}images_product/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have made appropriate fields translatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I enabled the locales for each section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created and populated subfolders. Index.php looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Path to your craft/ folder&#xA;$craftPath = '../../craft';&#xA;&#xA;// Tell Craft to serve the British content&#xA;define('CRAFT_LOCALE', 'en_gb');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additional info:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using SEOMatic and that does work as advertised with different meta content showing up for the localized site even if nothing else shows on the page.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2019-02-22T11:57:03.857" LastActivityDate="2019-02-27T20:09:37.660" Title="Localization - &quot;not found&quot; in CP on language selection" Tags="&lt;plugin-craftcommerce&gt;&lt;localization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29598" PostTypeId="1" CreationDate="2019-02-21T09:53:50.390" Score="2" ViewCount="240" Body="&lt;p&gt;In Craft Commerce 1 we could get the tax amount for a line item by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lineItem.tax&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, in Craft Commerce 2, this always returns 0. How can I get a line item's (or variant's) tax amount, or subtotal without taxes, using twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: on top of that, the suggested method for getting a cart's total tax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getAdjustmentsTotalByType('tax')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;also returns 0, no matter whether there are tax adjustments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Following Robin Schambach's comment, when the tax amount is included in the price, passing 'true' as second option is necessary:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getAdjustmentsTotalByType('tax', true)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns the tax amount from the order or the lineItem, thanks Robin!&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="4121" LastEditDate="2019-02-25T08:13:35.640" LastActivityDate="2019-02-25T08:13:35.640" Title="Commerce 2: How to get the tax amount of a line item, or the line item subtotal without taxes?" Tags="&lt;tax&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29600" PostTypeId="1" AcceptedAnswerId="29605" CreationDate="2019-02-21T10:29:51.213" Score="1" ViewCount="243" Body="&lt;p&gt;I've had a good look around and can't find any template reference to uploading multiple images with Freeform.  In settings i've allowed for 5 files in 'File Count'.  I'm using the following template code but it only allows a single file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;field row field13&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;uploadPhotos&quot; class=&quot;label&quot;&amp;gt;Upload photos of the fault&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input id=&quot;uploadPhotos&quot; type=&quot;file&quot; name=&quot;uploadPhotos.handle[]&quot; placeholder=&quot;Please provide any images of the fault&quot; /&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any guidance appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martin&lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2019-02-21T16:52:49.473" Title="Solspace Freeform upload multiple image files" Tags="&lt;templating&gt;&lt;plugin-freeform&gt;&lt;files&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29602" PostTypeId="1" AcceptedAnswerId="29609" CreationDate="2019-02-21T11:59:22.483" Score="1" ViewCount="342" Body="&lt;p&gt;I'm creating a module that contains some predefined templates. How can I load them directly out of the vendor folder? I've tried doing &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $event) {&#xA;    if (is_dir($baseDir = $this-&amp;gt;getBasePath().DIRECTORY_SEPARATOR.'templates')) {&#xA;        $event-&amp;gt;roots[$this-&amp;gt;id] = $baseDir;&#xA;    }&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That part seems to be working, cause if I dump it, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&#xA;    'my-module' =&amp;gt; '/app/modules/mymodule/src/templates'&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my module, I have a &lt;code&gt;templates/test.twig&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I do &lt;code&gt;mysite.com/test&lt;/code&gt;, I still get a 404.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried a different approach, in the routes.php, I put:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'test' =&amp;gt; ['template' =&amp;gt; '@modules/my-module/test'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I could differently?&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2019-02-22T09:18:12.293" Title="How can I load the templates from a module?" Tags="&lt;plugin-development&gt;&lt;templating&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29603" PostTypeId="1" AcceptedAnswerId="29672" CreationDate="2019-02-21T13:04:49.917" Score="1" ViewCount="344" Body="&lt;p&gt;I currently use &lt;code&gt;Feed-Me&lt;/code&gt; to pull data from an API-Endpoint. This API-Endpoint does change from time to time, providing new elements with each change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to manually trigger the Feed-Me-Reimport each time I notice a change.&#xA;I do know that Feed-Me provides actions URLs for each &lt;code&gt;feed-entry&lt;/code&gt; but as the amount of different import-feeds will grow rapidly soon, I don't think it's feasable to manually create those feeds, and after creation also manually put the URL into a custom cronjob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the end what I'd like to have is simply a script that is triggered by a single cronjob, then gets all Feed-Me feeds and for each feed run the reimport.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PluginFactory&lt;/a&gt; I already generated a plugin that provides me an endpoint(/controller) to be called by &lt;code&gt;cron&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionAutoImport()&#xA;    {&#xA;        $result = 'Autoimport engaged';&#xA;&#xA;        return $result;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But now I am wondering: How do I get information from the Feed-Me plugin i.e. get all existing feeds and trigger a run on each?&lt;/p&gt;&#xA;" OwnerUserId="5855" LastActivityDate="2019-02-28T04:31:43.343" Title="Craft 3 Feed-Me Auto run all feed" Tags="&lt;craft3&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29605" PostTypeId="2" ParentId="29600" CreationDate="2019-02-21T16:52:49.473" Score="2" Body="&lt;p&gt;There appears to be 2 errors in your code. &lt;code&gt;name=&quot;uploadPhotos.handle[]&quot;&lt;/code&gt; should be &lt;code&gt;name=&quot;uploadPhotos[]&quot;&lt;/code&gt;, assuming your field name is &lt;code&gt;uploadPhotos&lt;/code&gt;. The &lt;code&gt;handle&lt;/code&gt; part is unnecessary, unless you were using it like &lt;code&gt;name=&quot;{{ uploadPhotos.handle }}[]&quot;&lt;/code&gt;, but it's redundant since you already are calling the handle to get the handle (but makes more sense when you're automating the template code). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, you need to specify &lt;code&gt;multiple&lt;/code&gt; attribute if you wish to have more than 1 file uploaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct code should be:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;field row field13&quot;&amp;gt;&#xA;  &amp;lt;label for=&quot;uploadPhotos&quot; class=&quot;label&quot;&amp;gt;Upload photos of the fault&amp;lt;/label&amp;gt;&#xA;  &amp;lt;input id=&quot;uploadPhotos&quot; type=&quot;file&quot; name=&quot;uploadPhotos[]&quot; multiple /&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-02-21T16:52:49.473" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29606" PostTypeId="1" CreationDate="2019-02-21T19:30:06.917" Score="1" ViewCount="20" Body="&lt;p&gt;When sending email notifications to users via FreeForm, the recipient's name is a zero; see screenshot. Looking at the documentation, it doesn't appear I can set the recipient's name in the heading comment block. Thoughts on why this &quot;0&quot; is appearing as the user's name? Is there any way to override it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o5spR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o5spR.png&quot; alt=&quot;screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5560" LastEditorUserId="57" LastEditDate="2019-02-22T04:51:02.607" LastActivityDate="2019-02-22T04:51:02.607" Title="FreeFrom recipient's name is a zero" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29607" PostTypeId="1" AcceptedAnswerId="29608" CreationDate="2019-02-22T04:35:37.077" Score="8" ViewCount="2355" Body="&lt;p&gt;I've been looking for an Event Reference doc for Craft 3 just like what we had for Craft 2, but couldn't find one. The only events doc I found for Craft 3 is the plugin updating guide: &lt;a href=&quot;https://docs.craftcms.com/v3/extend/updating-plugins.html#events&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/updating-plugins.html#events&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I miss anything? Appreciate if someone can post a link here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, for Craft 2 events, we used to be able to do $event-&gt;params[$paramName] to get the params passed into the events, but I struggle to find a way to do similar things in Craft 3. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="7136" LastActivityDate="2019-10-16T15:53:48.830" Title="Events documentation for Craft 3" Tags="&lt;craft3&gt;&lt;events&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29608" PostTypeId="2" ParentId="29607" CreationDate="2019-02-22T06:03:10.943" Score="6" Body="&lt;p&gt;Here's a list of Event classes and the &quot;Public Properties&quot; that you can get or set:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-events-assetevent.html&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-events-assetevent.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;An example of getting event data:&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_BEFORE_ACTIVATE_USER,&#xA;    function (UserEvent $event) {&#xA;        $userElement = $event-&amp;gt;user;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Class reference: &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-events-userevent.html&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-events-userevent.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;An example of setting event data:&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;    Fields::class,&#xA;    Fields::EVENT_REGISTER_FIELD_TYPES,&#xA;    function (RegisterComponentTypesEvent $event) {&#xA;        $event-&amp;gt;types[] = UserState::class;&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Class reference: &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-events-registercomponenttypesevent.html&quot; rel=&quot;noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-events-registercomponenttypesevent.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4794" LastActivityDate="2019-02-22T06:03:10.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29609" PostTypeId="2" ParentId="29602" CreationDate="2019-02-22T09:18:12.293" Score="1" Body="&lt;p&gt;Answer from &lt;a href=&quot;https://craftcms.stackexchange.com/users/5557/robin-schambach&quot;&gt;@robin-schambach&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;It's not possible the way you do it... or the way you are trying to do it&#xA;During site requests only templates from your template folder can be loaded&#xA;otherwise it would be a high security issue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2019-02-22T09:18:12.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29610" PostTypeId="1" CreationDate="2019-02-22T10:08:14.350" Score="1" ViewCount="44" Body="&lt;p&gt;I'm using the Redactor plugin throughout a Craft 3 site and I'm also using a custom HTML Purifier config to clean up the HTML (surprise).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;HTML.ForbiddenElements&quot;: [&quot;&amp;amp;nbsp;&quot;, &quot;br&quot;],&#xA;  &quot;AutoFormat.RemoveEmpty.RemoveNbsp&quot;: true,&#xA;  &quot;AutoFormat.RemoveEmpty&quot;: true,&#xA;  &quot;AutoFormat.Linkify&quot;: true,&#xA;  &quot;AutoFormat.RemoveSpansWithoutAttributes&quot;: true&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it looks like it overrides Redactor's link target blank option and that override is either on (open in new tabs) or off (strip target blank).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can give that choice back to the user? Maybe I can stop Craft using the full url for links other than external links?&lt;/p&gt;&#xA;" OwnerUserId="8865" LastActivityDate="2019-02-22T11:28:56.863" Title="Can I have non-boolean TargetBlank output using HTMLPurifier and the Redactor plugin?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;redactor&gt;&lt;output&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29613" PostTypeId="2" ParentId="29610" CreationDate="2019-02-22T11:28:56.863" Score="1" Body="&lt;p&gt;And this solved the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;Attr.AllowedFrameTargets&quot;: [&quot;_blank&quot;]&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8865" LastActivityDate="2019-02-22T11:28:56.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29614" PostTypeId="1" CreationDate="2019-02-22T18:29:35.717" Score="1" ViewCount="213" Body="&lt;p&gt;I am playing around with Craft 3 and for the life of me cannot get it to save an element programmatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to save a Global Set from a module like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$config = [&#xA;    'name' =&amp;gt; &quot;My New Global Set&quot;,&#xA;    'handle' =&amp;gt; &quot;mfSet2&quot;,&#xA;];&#xA;&#xA;$glob = new \craft\elements\GlobalSet($config);&#xA;&#xA;$success = Craft::$app-&amp;gt;getGlobals()-&amp;gt;saveSet($glob);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$success&lt;/code&gt; returns true and there are no errors. But nothing is saved. There doesn't seem to be any documentation that helps and searching just turns up Craft 2 examples.&lt;/p&gt;&#xA;" OwnerUserId="9430" LastEditorUserId="57" LastEditDate="2019-02-23T03:34:16.223" LastActivityDate="2019-02-23T03:34:16.223" Title="Craft 3 Cannot Save Global Set" Tags="&lt;craft3&gt;&lt;globals&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29615" PostTypeId="1" AcceptedAnswerId="29650" CreationDate="2019-02-22T18:34:17.757" Score="2" ViewCount="175" Body="&lt;p&gt;I need to include the contents of a hidden field in my form's notification emails. I know the field value is being captured, as I can see it in the CP, but it's not included in the emails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought maybe I needed to create custom template, but the path to the default Sprout Email templates in the docs is no longer accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Sprout Forms 3.0.0-beta.44 and Craft 3.1.14 &lt;/p&gt;&#xA;" OwnerUserId="323" LastActivityDate="2019-02-26T15:00:58.797" Title="Sprout Forms - include hidden fields in notification emails" Tags="&lt;plugin-sproutforms&gt;&lt;plugin-sproutemail&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29616" PostTypeId="1" AcceptedAnswerId="29625" CreationDate="2019-02-22T18:41:33.077" Score="1" ViewCount="148" Body="&lt;p&gt;Craft noob here. I have an include file which I'm calling a &quot;component&quot; so I can reuse it across the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The component is set up like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;{{ heading }}&amp;lt;/h2&amp;gt;&#xA;{{ bodyContent }}&#xA;{% if ctaUrl is defined %}&#xA;  &amp;lt;a class=&quot;primary link&quot; href=&quot;{{ ctaUrl }}&quot;&amp;gt;Click&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then on the template, I include it and pass some variables. In this case, the variables are from a Matrix field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set matrixBlocks = entry.fullContentMatrix.all() %}&#xA;&#xA;{% for block in matrixBlocks %}&#xA;    {% if block.type == 'imageRight' %}&#xA;&#xA;        {% include '_components/imageRight' with {&#xA;            heading: block.heading,&#xA;            bodyContent: block.bodyContent,&#xA;            ctaUrl: block.ctaUrl&#xA;        } %}&#xA;&#xA;...etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This all works great. Until I have fields that are optional and have no value, in this case, the &lt;code&gt;ctaUrl&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to write this so that variables are only passed to the include if they are defined?&lt;/p&gt;&#xA;" OwnerUserId="9431" LastEditorUserId="57" LastEditDate="2019-02-23T03:41:35.727" LastActivityDate="2019-02-24T21:36:13.910" Title="Passing optional variable values into an include template" Tags="&lt;craft3&gt;&lt;matrix&gt;&lt;variable&gt;&lt;include&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29617" PostTypeId="2" ParentId="29582" CreationDate="2019-02-23T03:24:51.177" Score="0" Body="&lt;p&gt;You probably need to &lt;code&gt;chmod +x craft&lt;/code&gt; on the &lt;code&gt;craft&lt;/code&gt; executable so it an execute: &lt;a href=&quot;https://askubuntu.com/questions/443789/what-does-chmod-x-filename-do-and-how-do-i-use-it/443799&quot;&gt;https://askubuntu.com/questions/443789/what-does-chmod-x-filename-do-and-how-do-i-use-it/443799&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-02-23T03:24:51.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29620" PostTypeId="1" CreationDate="2019-02-23T14:44:48.530" Score="0" ViewCount="57" Body="&lt;p&gt;I have an Element. It's a Structure, with one level (not sure if that is relevant). I'd like to add a Sort Option that allows a user to sort the Element Index page for this Element by a number. The number attribute is stored in the database as an &lt;code&gt;int&lt;/code&gt; and named &lt;code&gt;count&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Element class, I can add a way to sort the Element by a row alphabetically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function defineSortOptions(): array&#xA;{&#xA;  $attributes = [&#xA;    'someTextField' =&amp;gt; Craft::t('my-plugin', 'Some Text Field')&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I haven't yet been able to figure out how to give the option to sort by a number:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function defineSortOptions(): array&#xA;{&#xA;  $attributes = [&#xA;    'someTextField' =&amp;gt; Craft::t('my-plugin', 'Some Text Field'),&#xA;    'count' =&amp;gt; Craft::t('my-plugin', 'Count')&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above example does not work. I've also explored the non-shorthand syntax that I see in the Craft Commerce Subscription sort options, however, have been unable to figure out how to adjust things to work with numbers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected static function defineSortOptions(): array&#xA;{&#xA;    return [&#xA;        [&#xA;            'label' =&amp;gt; Craft::t('commerce', 'Subscription date'),&#xA;            'orderBy' =&amp;gt; 'commerce_subscriptions.dateCreated',&#xA;            'attribute' =&amp;gt; 'dateCreated'&#xA;        ],&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I allow a user to order an Element Index page by a numeric column?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-02-23T14:44:48.530" Title="How to add an Element sortOption to sort by number?" Tags="&lt;elementtype&gt;&lt;elementquery&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29621" PostTypeId="2" ParentId="29555" CreationDate="2019-02-23T18:10:01.097" Score="1" Body="&lt;p&gt;I'm not sure what your Question is exactly and what your expected outcome is but to create a Modal you can use this HTML&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;div id=&quot;my-awesome-modal&quot; class=&quot;modal&quot;&amp;gt;&#xA;    &amp;lt;div id=&quot;modal-body&quot; class=&quot;body&quot;&amp;gt;&#xA;        &amp;lt;header class=&quot;header&quot;&amp;gt;&#xA;            &amp;lt;h2&amp;gt;My Awesome Modal&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;/header&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and via JavaScript you can show it&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-JS prettyprint-override&quot;&gt;&lt;code&gt;//create it&#xA;var modal = new Garnish.Modal($('#my-awesome-modal')); &#xA;modal.show();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-23T18:10:01.097" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29622" PostTypeId="1" AcceptedAnswerId="29623" CreationDate="2019-02-23T22:06:23.617" Score="1" ViewCount="521" Body="&lt;p&gt;Not sure if this is the best place to post, but since it's a Craft 3 plugin I'll give it a shot.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach ($numbers as $number){&#xA;    $number = $twilio-&amp;gt;lookups-&amp;gt;v1-&amp;gt;phoneNumbers($user-&amp;gt;mobil)-&amp;gt;fetch(['countryCode' =&amp;gt; 'NO'])-&amp;gt;phoneNumber;&#xA;&#xA;    try {&#xA;        // Send SMS&#xA;        $twilio-&amp;gt;messages-&amp;gt;create(&#xA;            $number,&#xA;            [&#xA;                'from' =&amp;gt; $settings-&amp;gt;twilioNumber,&#xA;                'body' =&amp;gt; $request-&amp;gt;post('body')&#xA;            ]&#xA;        );&#xA;    } catch (\Exception $e) {&#xA;        continue; // Continue (loop) to next number as this one failed/is invalid.&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In short, whenever a &lt;code&gt;$number&lt;/code&gt; is invalid, execution stops giving &lt;code&gt;Twilio\Exceptions\RestException [HTTP 404] Unable to fetch record: The requested resource /PhoneNumbers/&quot;the-invalid-number&quot; was not found&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the &lt;code&gt;catch&lt;/code&gt; is never reached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I have tried replacing &lt;code&gt;\Exception&lt;/code&gt; with the following to no avail.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Twilio\Exceptions\ConfigurationException;&#xA;use Twilio\Exceptions\DeserializeException;&#xA;use Twilio\Exceptions\EnvironmentException;&#xA;use Twilio\Exceptions\HttpException;&#xA;use Twilio\Exceptions\RestException;&#xA;use Twilio\Exceptions\TwimlException;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regardless, I thought &lt;code&gt;\Exception&lt;/code&gt; would catch any exception?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here's the solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;try {&#xA;    // Validate the number&#xA;    $number = $twilio-&amp;gt;lookups-&amp;gt;v1-&amp;gt;phoneNumbers($user-&amp;gt;mobil)-&amp;gt;fetch(['countryCode' =&amp;gt; 'NO'])-&amp;gt;phoneNumber;&#xA;&#xA;    // Send SMS&#xA;    $twilio-&amp;gt;messages-&amp;gt;create(&#xA;        $number,&#xA;        [&#xA;            'from' =&amp;gt; $settings-&amp;gt;twilioNumber,&#xA;            'body' =&amp;gt; $request-&amp;gt;post('body')&#xA;        ]&#xA;    );&#xA;} catch (\Exception $e) {&#xA;    // Number is invalid; continue to next number&#xA;    continue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2019-02-24T16:00:54.840" LastActivityDate="2019-02-24T16:00:54.840" Title="Not able to catch exception sending SMS with Twilio in plugin" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29623" PostTypeId="2" ParentId="29622" CreationDate="2019-02-24T03:11:10.923" Score="2" Body="&lt;p&gt;The exception is thrown before you enter your catch block during this line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $number = $twilio-&amp;gt;lookups-&amp;gt;v1-&amp;gt;phoneNumbers($user-&amp;gt;mobil)-&amp;gt;fetch(['countryCode' =&amp;gt; 'NO'])-&amp;gt;phoneNumber; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's why it can't be cached. Move it into the same block and handle every single possible exception that can be thrown accordingly or via generic &lt;code&gt;\Exception&lt;/code&gt; class &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-24T03:11:10.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29624" PostTypeId="1" AcceptedAnswerId="36318" CreationDate="2019-02-24T16:10:05.527" Score="2" ViewCount="107" Body="&lt;p&gt;Following &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/adjusters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/adjusters.html&lt;/a&gt; I am unable to register an adjuster in my module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in my Module.php file I have placed the following inside init() alongside other stuff being registered (that are working)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\events\RegisterComponentTypesEvent;&#xA;use craft\commerce\services\OrderAdjustments;&#xA;use modules\mymodule\adjusters\DiscountAdjuster;&#xA;&#xA;Event::on(OrderAdjustments::class, &#xA;    OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS, function(RegisterComponentTypesEvent $event) {&#xA;    $event-&amp;gt;types[] = DiscountAdjuster::class;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And in src/adjusters/DiscountAdjuster.php I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace modules\mymodule\adjusters;&#xA;&#xA;use Craft;&#xA;use craft\base\Component;&#xA;use craft\commerce\base\AdjusterInterface;&#xA;use craft\commerce\elements\Order;&#xA;use craft\commerce\models\OrderAdjustment;&#xA;&#xA;class DiscountAdjuster extends Component implements AdjusterInterface&#xA;{&#xA;&#xA;    public function adjust(Order $order): array&#xA;    {&#xA;        $adjustments = [];&#xA;&#xA;        foreach ($order-&amp;gt;getLineItems() as $item) {&#xA;            $adjustment = new OrderAdjustment;&#xA;            $adjustment-&amp;gt;type = 'discount';&#xA;            $adjustment-&amp;gt;name = '$2 off';&#xA;            $adjustment-&amp;gt;description = '$2 off everything in the store';&#xA;            $adjustment-&amp;gt;sourceSnapshot = [ 'data' =&amp;gt; 'value']; // This can contain information about how the adjustment came to be&#xA;            $adjustment-&amp;gt;amount = -2;&#xA;            $adjustment-&amp;gt;setOrder($order);&#xA;            $adjustment-&amp;gt;setLineItem($item);&#xA;&#xA;            $adjustments[] = $adjustment;&#xA;        }&#xA;&#xA;        return $adjustments;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should take 2 off of every line item when I add items to the cart, no? Nothing happens though. And if i put something like &lt;code&gt;die()&lt;/code&gt; in &lt;code&gt;public function adjust&lt;/code&gt;, that isn't registered either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried adapting this example: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28184/demo-repo-for-an-adjuster-module-for-commerce-2&quot;&gt;Demo repo for an Adjuster module for Commerce 2?&lt;/a&gt; However I'm faced with the same issue.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="57" LastEditDate="2019-02-25T00:35:08.800" LastActivityDate="2020-09-25T09:31:57.270" Title="Unable to register adjuster in module" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;modules&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29625" PostTypeId="2" ParentId="29616" CreationDate="2019-02-24T19:25:01.393" Score="2" Body="&lt;p&gt;So in this case with &lt;code&gt;ctaUrl&lt;/code&gt;, the issue is that you are checking &lt;code&gt;if ctaUrl is defined&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as a field exists, &lt;code&gt;is defined&lt;/code&gt; will return &lt;code&gt;true&lt;/code&gt; as in reality, the variable &lt;code&gt;block.ctaUrl&lt;/code&gt; exists, it's just empty. To check for content in your case, you should test for &lt;code&gt;NULL&lt;/code&gt;. So &lt;code&gt;if ctaUrl is not NULL&lt;/code&gt; show your link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of organisation of your code, it's up to you. Like Roi said, you don't need the &lt;code&gt;with&lt;/code&gt;. Your &lt;code&gt;matrixBlocks&lt;/code&gt; will be available within the component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether you set stuff up in the main template is up to you. Personally, I would do my logic in the component rather than the main templates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to be consistant with your naming but the component is where you need this logic so if it's is in there, you don't need to dig around to understand what is going on. If you remove a component, the logic goes with it as suppose to have a bloated main template and also, you don't do a lot of stuff before you need to. No need in checking if you have a &lt;code&gt;ctaUrl&lt;/code&gt; if your &lt;code&gt;_components/imageRight&lt;/code&gt; isn't requested... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One reason for doing the logic in the main template would be that you would have less duplication (maybe) but from experience, I'm not sure it's worth it. So In your case:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set matrixBlocks = entry.fullContentMatrix.all() %}&#xA;&#xA;{% for block in matrixBlocks %}&#xA;    {% if block.type == 'imageRight' %}&#xA;        {% include '_components/imageRight' %}&#xA;    {% elseif block.type == 'imageLeft' %}&#xA;        {% include '_components/imageLeft' %}&#xA;    {% elseif block.type == 'someOtherBlock' %}&#xA;        ....&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then do your work in your components:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;h2&amp;gt;{{ block.heading }}&amp;lt;/h2&amp;gt;&#xA;{{ block.bodyContent }}&#xA;{% if ctaUrl is not NULL %}&#xA;  &amp;lt;a class=&quot;primary link&quot; href=&quot;{{ block.ctaUrl }}&quot;&amp;gt;Click&amp;lt;/a&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing this, you will have a lean and clear main template and the component level logic will live in the component where it belongs. My opinion only though... Plenty of ways to do this :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the best way to write this so that variables are only passed to the include if they are defined?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In your case, don't worry about that, check if they are defined when you need to use them, at component level.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-02-24T21:36:13.910" LastActivityDate="2019-02-24T21:36:13.910" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29627" PostTypeId="1" AcceptedAnswerId="29636" CreationDate="2019-02-25T02:25:21.100" Score="2" ViewCount="141" Body="&lt;p&gt;Just wanted to know if there's an easy way to hook Solspace Freeform submission to external API? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got a form built using Solspace freefrom Pro, and I'd like to post each submission of the form to an external API. Whats the easiest way to go about this using Craft?  &lt;/p&gt;&#xA;" OwnerUserId="9436" LastActivityDate="2019-02-25T16:53:13.180" Title="Solspace freeform webhook" Tags="&lt;craft3&gt;&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29628" PostTypeId="1" AcceptedAnswerId="29629" CreationDate="2019-02-25T08:44:03.590" Score="1" ViewCount="2850" Body="&lt;p&gt;When I include specific Twig template component multiple times, how can I give it a unique ID (or class)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Components are not inside &lt;code&gt;for&lt;/code&gt; loop, so I cannot use &lt;code&gt;loop.index&lt;/code&gt;. I also don't wont to pass unique variable myself when I include it. And using &lt;code&gt;random&lt;/code&gt; Twig function doesn't ensure that the result is unique. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's also assume that each component doesn't have unique Craft element assigned to it, like entry - in such case, I could just use this entry ID.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="9038" LastEditDate="2019-02-25T08:52:31.207" LastActivityDate="2021-05-14T16:09:03.510" Title="Give included twig component unique ID" Tags="&lt;templating&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29629" PostTypeId="2" ParentId="29628" CreationDate="2019-02-25T09:29:47.487" Score="3" Body="&lt;p&gt;You can create a unique ID function in PHP and pass it to Twig&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set uniqueId = uniqueId() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your PHP part&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;class Extension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface&#xA;{&#xA;    public $uniqueIds;&#xA;&#xA;    public function getFunctions(): array&#xA;    {&#xA;        return [&#xA;             new Twig_SimpleFunction('uniqueId', [$this, 'getUniqueId'])&#xA;        ];&#xA;    }&#xA;&#xA;    /**&#xA;     * getUniqueId&#xA;     *&#xA;     * @return string&#xA;     */&#xA;    public function getUniqueId(): string &#xA;    {&#xA;        // generate a random string&#xA;        $id = StringHelper::randomString('12');&#xA;&#xA;        // check if it's already set&#xA;        while (\in_array($id, $this-&amp;gt;uniqueIds, true)){&#xA;            // if so, use another one&#xA;            $id = StringHelper::randomString('12');&#xA;        }&#xA;        // set it as &quot;used&quot;&#xA;        $this-&amp;gt;uniqueIds[] = $id;&#xA;&#xA;        return $id;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-25T09:29:47.487" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29630" PostTypeId="1" AcceptedAnswerId="29653" CreationDate="2019-02-25T12:19:33.497" Score="1" ViewCount="786" Body="&lt;p&gt;I'm currently in the process of calling an API endpoint and trying to display the data relating to it. But I'm having a bit of trouble using 'Guzzle/Fetch' in this scenario. I have the following code but it seems to be outputting nothing at all. (Plugin is all installed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Template.html&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set client = {&#xA;    base_uri : 'https://api.tickets.com/rest/v2/Events/2704/Reviews?order=1&amp;amp;count=30',&#xA;    timeout : 10&#xA;} %}&#xA;&#xA;{% set options = {&#xA;    headers: new Headers({&#xA;      'Content-Type': 'application/json',&#xA;      'apiKey': 'aaabbbcccdddeee',&#xA;    })&#xA;} %}&#xA;&#xA;{% set request = fetch(client, 'GET', options) %}&#xA;&#xA;{% echo $request-&amp;gt;getReasonPhrase(); %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-02-26T20:51:21.950" Title="Fetching &amp; Displaying an API Request using 'Fetch'" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29631" PostTypeId="1" AcceptedAnswerId="29667" CreationDate="2019-02-25T12:59:38.423" Score="2" ViewCount="358" Body="&lt;p&gt;My element API endpoint throws a 404 when I'm logged out of the CP, but works fine when I'm logged in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When logged out it throws a regular 404 with stack trace exactly as any other non-existing url, when logged in it spits out JSON as it should be. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;HTTP 404 – Not Found – yii\web\NotFoundHttpException&#xA;Template not found: news.json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notably the front-end of the page works fine always..this just affects the element API.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried clearing craft caches + all cookies, still the same.&#xA;Found nothing suspicious in web.log, phperrors.log or web-404.log&#xA;I tried it with a very simple element-api.php and it still produces the same issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, even this element-api.php does not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;use craft\elements\Entry;&#xA;&#xA;return [&#xA;    'endpoints' =&amp;gt; [&#xA;        'news.json' =&amp;gt; function() {&#xA;            return [&#xA;                'elementType' =&amp;gt; Entry::class,&#xA;                'criteria' =&amp;gt; ['section' =&amp;gt; 'news'],&#xA;                'transformer' =&amp;gt; function(Entry $entry) {&#xA;                    return [&#xA;                        'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    ];&#xA;                },&#xA;            ];&#xA;        },&#xA;    ]&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(copied straight from the docs. The section &quot;news&quot; exists in my DB and has valid entries.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea what could be the cause of this or where to further investigate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is on Craft 3.1.12.&lt;/p&gt;&#xA;" OwnerUserId="8431" LastEditorUserId="8431" LastEditDate="2019-02-26T18:25:26.210" LastActivityDate="2019-02-27T11:38:00.797" Title="Element API throws 404 when not logged into CP" Tags="&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29632" PostTypeId="1" AcceptedAnswerId="29639" CreationDate="2019-02-25T13:04:42.330" Score="1" ViewCount="39" Body="&lt;p&gt;I want to access a variable created in Plugin itself. In Craft 2, it could be simply done by &lt;code&gt;craft()-&amp;gt;pluginName-&amp;gt;getVar()&lt;/code&gt; but I couldn't find a way in Craft 3. I have tried &lt;code&gt;Craft::$app-&amp;gt;pluginName-&amp;gt;getVar()&lt;/code&gt; but that throws an error.&lt;/p&gt;&#xA;" OwnerUserId="9437" LastActivityDate="2019-02-25T18:35:44.037" Title="How to access Plugin Variable in Plugin?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29633" PostTypeId="2" ParentId="29520" CreationDate="2019-02-25T13:51:33.983" Score="1" Body="&lt;p&gt;Brad was correct in the comments above. The answer is the sql_mode. This is a duplicate of &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12084/getting-this-sql-error-group-by-incompatible-with-sql-mode-only-full-group-by&quot;&gt;Getting this SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6138" LastActivityDate="2019-02-25T13:51:33.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29634" PostTypeId="1" CreationDate="2019-02-25T15:20:00.883" Score="1" ViewCount="152" Body="&lt;p&gt;We have a site with multiple languages so I created a site for each language.&#xA;I named these according to the language so, one is named &quot;French&quot;, another &quot;English&quot; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the backend this is all fine, when creating entries its clear what the language is you are working in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I soon noticed these are also used in the front-end and that creates some problems. The site name in a template is easily override by adding something like &lt;code&gt;{% set siteName = getenv('SITE_NAME') %}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But harder to fix are for example the mails send out when creating a account, they now say something like &quot;Thank you for creating an account on English!&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a fix by setting the same site name in the config/general.php, this works, but now all the sites in the site switcher in the backend are the same. So not really a good fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having to set a different name for each site is kinda weird, in most cases the brand name is the same in every language. Google is Google no matter the language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone who knows a decent way to handle this?&lt;/p&gt;&#xA;" OwnerUserId="7577" LastActivityDate="2019-02-27T12:27:18.153" Title="Same site name in multiple languages" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;multi-site&gt;&lt;sites&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29635" PostTypeId="1" CreationDate="2019-02-25T16:07:29.923" Score="1" ViewCount="138" Body="&lt;p&gt;Currently I have a field that extends BaseRelationField, and 2 types of elements. I want the field on elements A to be able to select from elements B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far the field itself works, which I tested by registering it and adding it to an entry. It shows elements B as options and stores it in the relations table.&lt;br&gt;&#xA;So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't want to add this field to an entry, but to elements A. My current attempts revolved around using Craft::$app-&gt;fields-&gt;createField() and Craft::$app-&gt;fields-&gt;saveField() to create the field (which also gives it an id) since Craft::$app-&gt;getRelations()-&gt;saveRelations() requires the field to have an id (which makes sense to me). But this means my field will show up in the settings/fields in the cp. Also using this method, I don't know how to properly retrieve the values to fill the index page of the element and the edit page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way to add the field without adding it to the 'normal' part of the cp while being able to use the relations table or am I going at this completely wrong? And also how to retrieve the stored data in the most convenient way?&lt;/p&gt;&#xA;" OwnerUserId="9438" LastActivityDate="2019-02-25T16:07:29.923" Title="How do I use a relation field in an element?" Tags="&lt;relations&gt;&lt;modules&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29636" PostTypeId="2" ParentId="29627" CreationDate="2019-02-25T16:53:13.180" Score="3" Body="&lt;p&gt;There is an entire section here that discusses API integrations, including the ones that come with Freeform.  &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.solspace.com/craft/freeform/v2/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2019-02-25T16:53:13.180" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29637" PostTypeId="1" AcceptedAnswerId="29664" CreationDate="2019-02-25T17:14:27.610" Score="1" ViewCount="78" Body="&lt;p&gt;On my page, I have a form which is using Freeform (Solspace). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to setup a custom redirect URL for the form. The form will apply to numerous entries in a channel and some will require different redirect URLs. The main channel in question (Animals) has a relation field which relates it to another channel (Adoption Price). This channel contains a URL field which ideally, I would like the user to be redirected to upon submitting the form. Below is what I have tried so far but with no luck. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  //Setting the variable&#xA;&#xA;  {% for priceBracket in entry.relatedAdoptionLink %}&#xA;      {% set priceURL = priceBracket.adoptionPriceLink %}       &#xA;  {% endfor %}&#xA;&#xA;  //The Form&#xA;&#xA;    {% set form = craft.freeform.form(&quot;animalAdoptionForm&quot;, {&#xA;        labelClass: &quot;form-label&quot;,&#xA;        inputClass: &quot;form-control&quot;,&#xA;        instructionsBelowField: true,&#xA;        overrideValues: {&#xA;          animalToAdopt: entry.title,&#xA;        }&#xA;    }) %}&#xA;&#xA;    {{ form.renderTag({returnUrl: &quot;{{priceURL}}&quot;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anybody help me out with this? Setting the variable directly via the entry would be more straight forward but I'm trying to pull the information I need from a relation in another channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7841" LastEditorUserId="57" LastEditDate="2019-02-27T02:22:49.687" LastActivityDate="2019-02-27T07:44:37.520" Title="Need help trying to pass a variable of a related entry" Tags="&lt;craft3&gt;&lt;relations&gt;&lt;redirect&gt;&lt;variable&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29638" PostTypeId="2" ParentId="17752" CreationDate="2019-02-25T17:56:47.963" Score="-1" Body="&lt;p&gt;On old versions of python, the python library mimetypes didnt have a definition for svg file types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this issue: &lt;a href=&quot;https://bugs.python.org/issue19377&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://bugs.python.org/issue19377&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added &lt;code&gt;'.svg' : 'image/svg+xml',&lt;/code&gt; into the &lt;code&gt;types_map&lt;/code&gt; in &lt;code&gt;mimetypes.py&lt;/code&gt; and then the aws cli got the correct type for SVGs.&lt;/p&gt;&#xA;" OwnerUserId="9439" LastActivityDate="2019-02-25T17:56:47.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29639" PostTypeId="2" ParentId="29632" CreationDate="2019-02-25T18:35:44.037" Score="2" Body="&lt;p&gt;You can access your plugin via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::getInstance()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then access its components defined by &lt;code&gt;setComponents&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::getInstance()-&amp;gt;componentName&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Plugin::getInstance()-&amp;gt;get('componentName')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you just want to get properties of your main plugin class it's the same way as above. Not sure what you mean exactly by &lt;code&gt;Plugin Variable&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-25T18:35:44.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29640" PostTypeId="1" AcceptedAnswerId="29655" CreationDate="2019-02-25T19:44:59.847" Score="1" ViewCount="342" Body="&lt;p&gt;Is it at all possible to set a different Redirect URL on a FreeForm form if a checkbox is checked? To summarise, I have a FreeForm form which contains a checkbox. I would like the submission redirect URL to differ depending on whether or not the checkbox is checked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed any light on this and offer some advice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7841" LastEditorUserId="57" LastEditDate="2019-02-27T03:44:32.397" LastActivityDate="2019-02-27T03:44:32.397" Title="Change Freeform redirect URL according to checkbox field" Tags="&lt;craft3&gt;&lt;redirect&gt;&lt;plugin-freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29642" PostTypeId="1" CreationDate="2019-02-26T10:04:27.293" Score="1" ViewCount="32" Body="&lt;pre&gt;&lt;code&gt;{% set blog = craft.entries.section('blog').all() %}&#xA;{% set news = craft.entries.section('news').all() %}&#xA;{% set caseStudies = craft.entries.section('caseStudies').all() %}&#xA;{% set allEntries = blog|merge(news)|merge(caseStudies) %}&#xA;{% for entry in allEntries %}  &#xA; &amp;lt;span&amp;gt;  &#xA;       {{entry.nameSection}} | {{entry.dateNews|date(&quot;F  d, Y&quot;)}}&#xA;&amp;lt;/span&amp;gt;&#xA;&amp;lt;h3 class=&quot;title post-title&quot;&amp;gt;&#xA;      {{entry.title}}&#xA;&amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9443" LastActivityDate="2019-02-26T10:55:39.163" Title="How I can sort my entry that belong to 3 section on date?" Tags="&lt;entries&gt;&lt;datetime&gt;&lt;filter&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29643" PostTypeId="2" ParentId="29634" CreationDate="2019-02-26T10:10:47.613" Score="1" Body="&lt;p&gt;I ended up using the suggestion of Robin Schambach, in front-end templates using the &lt;code&gt;{{ site.group.name }}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;E-mail contents can be changed in the admin section, using {{currentSite.group.name}}&lt;/p&gt;&#xA;&lt;h3&gt;Craft 2:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;settings -&amp;gt; email -&amp;gt; Messages&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Craft 3.0:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;settings -&amp;gt; email -&amp;gt; Messages&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Craft 3.1:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;Utilities -&amp;gt; System Messages&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7577" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-02-27T12:27:18.153" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29644" PostTypeId="2" ParentId="29642" CreationDate="2019-02-26T10:55:39.163" Score="3" Body="&lt;p&gt;Try chaining the sections together like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set allEntries = craft.entries({&#xA;  section: ['blog', 'news', 'caseStudies']&#xA;}).orderBy('elements.dateCreated asc').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in allEntries %}  &#xA;   &amp;lt;span&amp;gt;  &#xA;       {{entry.nameSection}} | {{entry.dateNews|date(&quot;F  d, Y&quot;)}}&#xA;   &amp;lt;/span&amp;gt;&#xA;&#xA;   &amp;lt;h3 class=&quot;title post-title&quot;&amp;gt;&#xA;       {{entry.title}}&#xA;   &amp;lt;/h3&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4119" LastActivityDate="2019-02-26T10:55:39.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29645" PostTypeId="1" AcceptedAnswerId="29646" CreationDate="2019-02-26T11:25:24.337" Score="1" ViewCount="181" Body="&lt;p&gt;I have a matrix field that has two different block types. The matrix field is on an entry that lists a number of benefits for a given product on a corporate website. The two different blocks are firstly an &amp;quot;intro&amp;quot; block that has a couple of text fields for a headline and description and then secondly a &amp;quot;benefits&amp;quot; to create a list of benefits. I then output the items in the template as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for intro in entry.benefits %}&#xA;    {% for image in intro.leadImage %}&#xA;        &amp;lt;img class=&amp;quot;headImage&amp;quot; src=&amp;quot;{{ image.getUrl() }}&amp;quot; width=&amp;quot;{{ image.getWidth() }}&amp;quot; height=&amp;quot;{{ image.getHeight() }}&amp;quot; alt=&amp;quot;{{ image.title }}&amp;quot;&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;h3 class=&amp;quot;sectionHead&amp;quot;&amp;gt;{{ intro.introTitle }}&amp;lt;/h3&amp;gt;&#xA;    &amp;lt;p class=&amp;quot;intro&amp;quot;&amp;gt;{{ intro.introParagraph }}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&#xA;&amp;lt;div class=&amp;quot;details&amp;quot;&amp;gt;&#xA;    {% for benefitsItem in entry.benefits %}&#xA;        &amp;lt;p&amp;gt;&amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;{{ benefitsItem.benefit }}&amp;lt;/span&amp;gt; - {{ benefitsItem.description }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are two different for loops, one that lists the &amp;quot;intro&amp;quot; block and one that lists the &amp;quot;benefitsItem&amp;quot; block. The problem I have is that I want to be able to separate lists of benefits into sections by inserting another &amp;quot;intro&amp;quot; block in the CMS content but of course no matter where I order my &amp;quot;intro&amp;quot; blocks in the admin they will always appear above all the benefits where the for loop puts them out. Does anyone know how I would go about creating a matrix field or changing my template so that I can order things as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Intro&lt;br&gt;&#xA;Benefit&lt;br&gt;&#xA;Benefit&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;Intro&lt;br&gt;&#xA;Benefit&lt;br&gt;&#xA;Benefit&lt;br&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Any ideas greatly appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5715" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-02-28T08:55:58.147" Title="Templating repeatable blocks in a matrix field" Tags="&lt;templating&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29646" PostTypeId="2" ParentId="29645" CreationDate="2019-02-26T11:50:49.167" Score="2" Body="&lt;p&gt;It might be worth checking the types of the matrix block like:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% for block in entry.benefits.all() %}&#xA;    {% switch block.type %}&#xA;        {% case &quot;intro&quot; %} {# &amp;lt;=== ASSUMING BLOCK TYPE HANDLE #}&#xA;            {% for image in block.leadImage.all() %}&#xA;                &amp;lt;img class=&quot;headImage&quot; src=&quot;{{ image.getUrl() }}&quot; width=&quot;{{ image.getWidth() }}&quot; height=&quot;{{ image.getHeight() }}&quot; alt=&quot;{{ image.title }}&quot;&amp;gt;&#xA;            {% endfor %}&#xA;            &amp;lt;h3 class=&quot;sectionHead&quot;&amp;gt;{{ block.introTitle }}&amp;lt;/h3&amp;gt;&#xA;            &amp;lt;p class=&quot;intro&quot;&amp;gt;{{ block.introParagraph }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% case &quot;details&quot; %} {# &amp;lt;=== ASSUMING BLOCK TYPE HANDLE #}&#xA;            &amp;lt;div class=&quot;details&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;&amp;lt;span class=&quot;orange&quot;&amp;gt;{{ block.benefit }}&amp;lt;/span&amp;gt; - {{ block.description }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;&#xA;    {% endswitch %}&#xA;{% endfor %}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're wanting a list inside of a matrix (matrix in a matrix for the Benefits), I'd suggest killing the Benefits block type and adding a &lt;a href=&quot;https://plugins.craftcms.com/super-table&quot; rel=&quot;nofollow noreferrer&quot;&gt;SuperTable&lt;/a&gt; or &lt;a href=&quot;https://plugins.craftcms.com/neo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neo&lt;/a&gt; field to the Intro block type then you'll be able to list the benefits below each intro in a for loop.&lt;/p&gt;&#xA;" OwnerUserId="4119" LastEditorUserId="5557" LastEditDate="2019-02-26T16:18:46.413" LastActivityDate="2019-02-26T16:18:46.413" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29647" PostTypeId="1" CreationDate="2019-02-26T12:53:21.920" Score="1" ViewCount="107" Body="&lt;p&gt;i have 3 asset volumes in my craft install (3.1.5). If i want to create an embedded asset(Embedded Assets Plugin 1.0.2) in the first volume (CP) in my volume List than it appears in the second. Every Embed Asset appears in the second Volume!&#xA;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KXbrM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KXbrM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5301" LastEditorUserId="5301" LastEditDate="2019-02-26T13:03:57.523" LastActivityDate="2019-02-26T16:17:06.950" Title="Craft “Embedded Assets” Plug-in didn't save Embed in selected Asset Volume in CP" Tags="&lt;assets&gt;&lt;plugin-embeddedassets&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29648" PostTypeId="2" ParentId="29583" CreationDate="2019-02-26T13:09:37.040" Score="1" Body="&lt;p&gt;Instead of &lt;code&gt;entry&lt;/code&gt; use &lt;code&gt;product&lt;/code&gt; variable. For example, &lt;code&gt;{{product.title}}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2019-02-26T13:09:37.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29649" PostTypeId="1" CreationDate="2019-02-26T14:58:13.880" Score="0" ViewCount="41" Body="&lt;p&gt;Could my sudden bad requests on form submissions be linked to defaultCookieDomain&#xA;and multi site use with separate add on domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We added defaultCookieDomain as live preview wasn't working - didnt fix it by the way - but our add on domin is obviously the same. Can we just leave it blank?&lt;/p&gt;&#xA;" OwnerUserId="4052" LastActivityDate="2019-02-26T14:58:13.880" Title="Bad request on form submissions" Tags="&lt;multi-site&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29650" PostTypeId="2" ParentId="29615" CreationDate="2019-02-26T15:00:58.797" Score="3" Body="&lt;p&gt;By default, several fields do not display in the default Email Template such as the Hidden Field, Invisible Field, Section Heading Field, Private Notes Field, and Custom HTML field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to display any or all of those fields, you can override the default email template by in your Notification Email settings. Select the &quot;Custom Templates&quot; option and add a path to a folder in your template folder where you will place your &lt;code&gt;email.twig&lt;/code&gt; override file. More info on &lt;a href=&quot;https://sprout.barrelstrengthdesign.com/docs/forms/notifications.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Notifications and Email Template overrides&lt;/a&gt; in our docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can copy the default Email Template as a starting point and the line that you'll want to update is &lt;code&gt;{% for field in fields if not field.isPlainInput() %}&lt;/code&gt; which you can see &lt;a href=&quot;https://github.com/barrelstrength/craft-sprout-forms/blob/v3.0.0-beta.44/src/templates/_integrations/sproutemail/emailtemplates/basic/email.twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can remove the &lt;code&gt;if not field.isPlainInput()&lt;/code&gt; condition in that for loop to display all fields in your email. And conditionally hide or handle other fields uniquely in your templates by targeting them by their unique folder name: &lt;code&gt;field.getFieldInputFolder()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-02-26T15:00:58.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29651" PostTypeId="1" CreationDate="2019-02-26T15:07:27.920" Score="1" ViewCount="25" Body="&lt;p&gt;I have an issue. I have custom fields in the user profile, some of them are required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a change your password page and a change your email password.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A user can create an account (Without the custom fields).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when he/she tries to change the password without completing the profile (In the change password page), the password won't be saved as there are some required fields empty.&lt;/p&gt;&#xA;" OwnerUserId="6398" LastActivityDate="2019-02-26T15:07:27.920" Title="A user cannot change the password without completing the profile" Tags="&lt;templating&gt;&lt;user-profile&gt;&lt;registration&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29652" PostTypeId="1" AcceptedAnswerId="30037" CreationDate="2019-02-26T15:19:39.247" Score="3" ViewCount="612" Body="&lt;p&gt;I'am a bit helpless at the moment, because my project staging workflow using project.yaml stopped working and a) I don't know why and b) have no clue if I can solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem:&#xA;Until some days ago my staging worked like that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.) We are 3 developers working in our office, sharing the craft db on a central mysql. Dev User files were synced using an internal dropbox. When we wanted to bring our Craft DB changes to the QS machine, we enabled projectConfig, craft wrote a project.yaml, we pushed it to our repo and the QS installation of Craft took the project yaml and imported them. This worked great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.) Now this stopped working. We had a couple of new globals, fields, etc.  but they were not taken over to QS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.) When I look into my database I can see the fields, globals etc. in the corresponding tables (looking good). But when I look at the config column in the info table, the settings there do not match my database. e.g. I found the same fields and fieldgroups with different UIDs duplicated in there. So I know there is something wrong here, but I do not know what. And I also know that my project.yaml is the same as my config column so maybe this is the reason, why my QS installation does not take over any recent changes to my project db structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions are rather general:&#xA;- Can this problem be solved? &#xA;- Can the config column in the info be rewritten according to the real existing structure on the source Craft installation?&#xA;- Can a broken Craft database in some way be repaired?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that we already have some (not too much tough) customer content in the QS system and unless I want to manually recreate the Craft installation I would definitely prefer a way of repairing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Matthias&lt;/p&gt;&#xA;" OwnerUserId="6886" LastEditorUserId="6886" LastEditDate="2019-02-26T15:30:43.677" LastActivityDate="2019-04-05T10:58:45.943" Title="project.yaml stopped syncing changes in the staging process" Tags="&lt;migration&gt;&lt;projectconfig&gt;&lt;project.yaml&gt;&lt;staging&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29653" PostTypeId="2" ParentId="29630" CreationDate="2019-02-26T15:36:52.577" Score="5" Body="&lt;p&gt;So there are two things wrong with your code snippet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, the &lt;code&gt;fetch()&lt;/code&gt; method takes four parameters in the following order: &lt;code&gt;client&lt;/code&gt;, &lt;code&gt;method&lt;/code&gt;, &lt;code&gt;destination&lt;/code&gt;, and &lt;code&gt;options&lt;/code&gt;. In your example above, you're passing your options object in as the &lt;code&gt;destination&lt;/code&gt; (because that is the third parameter), which is not going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'll want to do something like the following instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set client = {&#xA;    base_uri : 'https://api.tickets.com',&#xA;    timeout : 10&#xA;} %}&#xA;&#xA;{% set destination = 'rest/v2/Events/2704/Reviews?order=1&amp;amp;count=30' %}&#xA;&#xA;{% set options = {&#xA;    headers: {&#xA;        'Content-Type': 'application/json',&#xA;        'apiKey': 'aaabbbcccdddeee',&#xA;    }&#xA;} %}&#xA;&#xA;{% set request = fetch(client, 'GET', destination, options) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We've made the &lt;code&gt;client.base_uri&lt;/code&gt; actually the Base URI (by removing the segments and query strings) and moved those to a separate variable (which is &lt;em&gt;technically&lt;/em&gt; where they belong). This allows us to now have four parameters that we're passing into &lt;code&gt;fetch()&lt;/code&gt; in the right order (notice our &lt;code&gt;options&lt;/code&gt; object is now the fourth parameter like it should be).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, it should be &lt;code&gt;headers: {&lt;/code&gt;, not &lt;code&gt;headers: new Headers({&lt;/code&gt; in your options hash. &lt;code&gt;headers: new Headers({&lt;/code&gt; is not valid Twig. Not sure where you got the &lt;code&gt;new Headers()&lt;/code&gt; from but a simple hash should work well (similar to &lt;a href=&quot;http://docs.guzzlephp.org/en/stable/request-options.html#headers&quot; rel=&quot;nofollow noreferrer&quot;&gt;the PHP example&lt;/a&gt; in the Guzzle docs).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your second issue (and this is the bigger one) is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% echo $request-&amp;gt;getReasonPhrase(); %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is not proper Twig at all. Looks like you grabbed a bit of PHP code from somewhere and popped it inside &lt;code&gt;{% ... %}&lt;/code&gt;, which is &lt;strong&gt;&lt;em&gt;never&lt;/em&gt;&lt;/strong&gt; going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a look at the &lt;a href=&quot;https://github.com/lukeyouell/craft-fetch&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fetch README&lt;/a&gt;, it shows you what a response is going to look like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;statusCode&quot;:200,&#xA;    &quot;reason&quot;:&quot;OK&quot;,&#xA;    &quot;body&quot;: {&#xA;        &quot;credits_left&quot;:30,&#xA;        &quot;test_id&quot;:&quot;JDHFbrt7&quot;,&#xA;        &quot;poll_state_url&quot;:&quot;https:\/\/gtmetrix.com\/api\/0.1\/test\/JDHFbrt7&quot;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What this snippet means is after you run &lt;code&gt;{% set request = fetch(...) %}&lt;/code&gt;, the &lt;code&gt;request&lt;/code&gt; variable is now going to equal a Twig object (more properly &lt;a href=&quot;https://mijingo.com/blog/key-value-arrays-in-twig&quot; rel=&quot;nofollow noreferrer&quot;&gt;known as a &lt;code&gt;hash&lt;/code&gt;&lt;/a&gt;) containing the status code of the response, the reason phrase (which is basically just a &lt;a href=&quot;https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;description of a status code&lt;/a&gt;; so the corresponding reason phrase for a status code of &lt;code&gt;200&lt;/code&gt; is &lt;code&gt;OK&lt;/code&gt;, for a &lt;code&gt;404&lt;/code&gt; it's going to be &lt;code&gt;Not Found&lt;/code&gt;, etc.), and then finally the body of the response returned from the API endpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd access these variables no differently than you would any other hash in Twig. To get the status code and/or the reason phrase, do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ request.statusCode }} - {{ request.reason }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To access any property of the request body, you would do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ request.body.myProperty }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on the structure of the API response, you might have to dig down into several levels of nested hashes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ request.body.oneHash.subHash.somethingElse.myProperty }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You get the idea...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not sure what the API response looks like (often times the API you're using will show you an example of what the response body will look like, so I'd look at the API docs first), you can just &lt;code&gt;dump()&lt;/code&gt; the whole body property to see what it contains:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ dump(request.body) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps!&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2019-02-26T20:51:21.950" LastActivityDate="2019-02-26T20:51:21.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29654" PostTypeId="2" ParentId="29647" CreationDate="2019-02-26T16:17:06.950" Score="1" Body="&lt;p&gt;Have you seen this: &lt;a href=&quot;https://github.com/spicywebau/craft-embedded-assets/issues/95&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/spicywebau/craft-embedded-assets/issues/95&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might be related and a fix is expected in Monday.&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-02-26T16:17:06.950" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29655" PostTypeId="2" ParentId="29640" CreationDate="2019-02-26T16:29:24.070" Score="1" Body="&lt;p&gt;This should be doable. If you have a field in your formatting template with the name &lt;code&gt;formReturnUrl&lt;/code&gt;, when checked, it would override the Freeform return URL. You'd likely need to manually hardcode this into your form template code though:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;checkbox&quot; name=&quot;formReturnUrl&quot; value=&quot;{{ siteUrl }}freeform-demo/bootstrap/my-url&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-02-26T16:29:24.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29656" PostTypeId="1" AcceptedAnswerId="29658" CreationDate="2019-02-26T17:42:17.560" Score="2" ViewCount="56" Body="&lt;p&gt;I have a Product entry type that contains a field for Components (which are also products) and a field for Related Products (again, also Products). I want to be able to find a parent product from a Component, but using a relatedTo() gives me all the Products on which it is a Related Product as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to specify which field you want to use with the relatedTo() method?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product = Entry::find()-&amp;gt;section('products')-&amp;gt;relatedTo($component)-&amp;gt;one();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Expected result = The parent product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual result = A random product on which the component is a related item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this was all working great until I just recently added the Related Products field.&lt;/p&gt;&#xA;" OwnerUserId="8685" LastEditorUserId="8685" LastEditDate="2019-02-26T17:47:34.880" LastActivityDate="2019-02-26T17:59:56.117" Title="relatedTo() only on one field?" Tags="&lt;craft3&gt;&lt;entry&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29657" PostTypeId="1" CreationDate="2019-02-26T17:48:46.097" Score="1" ViewCount="226" Body="&lt;p&gt;What is going on in Craft 3, seems like Composer has caused more problems than good. Every time I have had to update a dev/staging environment I run into issues and have to go and manually update the composer.json file to get updates to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem like how things should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway on to the latest error trying to update to Craft 3.1.14&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Composer output: Loading composer repositories with package information&#xA;Updating dependencies&#xA;Your requirements could not be resolved to an installable set of packages.&#xA;&#xA;Problem 1&#xA;- Can only install one of: yiisoft/yii2[2.0.16, 2.0.15.1].&#xA;- Can only install one of: yiisoft/yii2[2.0.16, 2.0.15.1].&#xA;- craftcms/cms 3.1.14 requires yiisoft/yii2 ~2.0.16.0 -&amp;gt; satisfiable by yiisoft/yii2[2.0.16].&#xA;- Installation request for craftcms/cms 3.1.14 -&amp;gt; satisfiable by craftcms/cms[3.1.14].&#xA;- Installation request for yiisoft/yii2 (installed at 2.0.15.1) -&amp;gt; satisfiable by yiisoft/yii2[2.0.15.1].&#xA;&#xA;Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastEditorUserId="57" LastEditDate="2019-02-27T04:56:46.657" LastActivityDate="2019-02-27T04:56:46.657" Title="Every time I perform updates on Craft 3, I get errors" Tags="&lt;craft3&gt;&lt;updates&gt;&lt;composer&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29658" PostTypeId="2" ParentId="29656" CreationDate="2019-02-26T17:59:56.117" Score="2" Body="&lt;p&gt;Haha. I figured it out. Leaving the answer here in case anyone else runs into the same problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$product = Entry::find()-&amp;gt;section('products')-&amp;gt;relatedTo([&#xA;    'element' =&amp;gt; $component,&#xA;    'field' =&amp;gt; 'productComponents'&#xA;])-&amp;gt;one();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can pass an object/array to the relatedTo() method as described here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relations | Craft 3 Documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8685" LastActivityDate="2019-02-26T17:59:56.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29659" PostTypeId="1" AcceptedAnswerId="29660" CreationDate="2019-02-26T18:45:50.243" Score="1" ViewCount="54" Body="&lt;p&gt;I am grabbing a date range from a URL query string like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://website.com/qa/search-feedback-results?datestart=2019-01-01&amp;amp;dateend=2019-02-26&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to include posts that were submitted on the end date that is in the range. In the above example, any posts dated &lt;code&gt;2019-02-26&lt;/code&gt; are not showing up in my results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vDatestart = craft.app.request.getParam('datestart')|date('Y-m-d') %}&#xA;{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') %}&#xA;{% set vParams = vParams|merge({ postDate: ['and', '&amp;gt;= ' ~ vDatestart, '&amp;lt;= ' ~ vDateend] }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3418" LastActivityDate="2019-02-26T19:21:29.890" Title="Date range to include end date" Tags="&lt;datetime&gt;&lt;postdate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29660" PostTypeId="2" ParentId="29659" CreationDate="2019-02-26T19:21:29.890" Score="2" Body="&lt;p&gt;have you tried setting a time for the end date? because I think Craft always saves time with your date fields.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') ~ ' 23:59:59' %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-02-26T19:21:29.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29661" PostTypeId="1" CreationDate="2019-02-26T19:59:34.823" Score="1" ViewCount="233" Body="&lt;p&gt;Quote from the {% requireLogin %} docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This tag will ensure that the user is logged in. If they aren’t, they&#xA;  will be redirected to the Login page, and returned to the original&#xA;  page after successfully logging in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quote from the Login Form example in the docs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;craft.session.returnUrl is set to the original URL that included the {% requireLogin %} tag that initiated the redirect to this login form. By default, users will be redirected based on your postLoginRedirect config setting value after logging in. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That seems to be contradictory - the first sentence saying the return path will be the page that contained the requireLogin tag and the second saying the return path is defined by a config setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to have the redirect go to the page that calls the login (I have &#xA; a few of them), but do not see a way of doing that. Using a return parameter in the login form does not work for obvious reasons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something here? Any wisdom greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-02-26T20:21:13.207" Title="Confusion over 'require login' behavior" Tags="&lt;login&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29662" PostTypeId="2" ParentId="29661" CreationDate="2019-02-26T20:14:50.207" Score="1" Body="&lt;p&gt;By default Craft checks the postLoginRedirect setting in your config. Depending on this value the user is going to be redirected to certain place. But if there is a value in the user session that's set when the &lt;code&gt;requireLogin&lt;/code&gt; function is called Yii2 will use this value instead. So the workflow is the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check for a session value, if there is one, redirect the user&lt;/li&gt;&#xA;&lt;li&gt;Check for &lt;code&gt;postLoginRedirect&lt;/code&gt; value, if there is one, redirect the user&lt;/li&gt;&#xA;&lt;li&gt;Redirect to homepage&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Using a return parameter in the login form does not work for obvious reasons.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could you explain those obvious reasons? Because I always use the &lt;code&gt;returnUrl&lt;/code&gt; from &lt;code&gt;UsersController&lt;/code&gt; when I create a login via ajax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't have to do anything actually. Just include the Twig token and Yii2 will handle it&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-02-26T20:21:13.207" LastActivityDate="2019-02-26T20:21:13.207" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29663" PostTypeId="1" AcceptedAnswerId="29678" CreationDate="2019-02-27T00:09:06.890" Score="1" ViewCount="102" Body="&lt;p&gt;After I run an update, I get this error:  '⚠' is not a numeric value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to run the updates multiple times with the same result. I was also able to update plugins with no issues.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\base\InvalidArgumentException: '⚠' is not a numeric value. in /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/i18n/Formatter.php:1727&#xA;Stack trace:&#xA;#0 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/i18n/Formatter.php(1120): yii\i18n\Formatter-&amp;gt;normalizeNumericValue('\xE2\x9A\xA0')&#xA;#1 /Users/mariovasquez/Documents/CODE/craft-3/storage/runtime/compiled_templates/2a/2a36518ebcb9289a64362cd02a4e956e899306f594506209175012a354aa7f4a.php(256): yii\i18n\Formatter-&amp;gt;asDecimal('\xE2\x9A\xA0')&#xA;#2 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(189): __TwigTemplate_309d4a2d35cb1be418317a1eb31479912dc2e29bd3ce7de12b3a82e142f925b1-&amp;gt;block_body(Array, Array)&#xA;#3 /Users/mariovasquez/Documents/CODE/craft-3/storage/runtime/compiled_templates/8f/8f387ea7239e223174d45ae0db27e78376dd6e6173ff6af3424e619d468194a3.php(60): Twig_Template-&amp;gt;displayBlock('body', Array, Array)&#xA;#4 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_528fb73bf994ffb8674e86b1402d5674f1759e4d18c4ec17f78c8f7e25afea1a-&amp;gt;doDisplay(Array, Array)&#xA;#5 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#6 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#7 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#8 /Users/mariovasquez/Documents/CODE/craft-3/storage/runtime/compiled_templates/b8/b81a0968284caf5539abd48dd170f68a8f9af859c2dd07891efa76851f233b2f.php(40): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#9 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_3eb157a482306a2333e424d0364b9e19e8fac10078663d1717682b5b86788461-&amp;gt;doDisplay(Array, Array)&#xA;#10 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#11 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#12 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#13 /Users/mariovasquez/Documents/CODE/craft-3/storage/runtime/compiled_templates/2a/2a36518ebcb9289a64362cd02a4e956e899306f594506209175012a354aa7f4a.php(95): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#14 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_309d4a2d35cb1be418317a1eb31479912dc2e29bd3ce7de12b3a82e142f925b1-&amp;gt;doDisplay(Array, Array)&#xA;#15 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#16 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#17 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#18 /Users/mariovasquez/Documents/CODE/craft-3/storage/runtime/compiled_templates/0f/0f685de995db652b5d0a838725a18baf3c14d5372176507e7c9ba8f9e729361c.php(32): craft\web\twig\Template-&amp;gt;display(Array, Array)&#xA;#19 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_866c826e7a1cf0e14d098c3c82972cffd04d519091073cfa11c0b12e056a263c-&amp;gt;doDisplay(Array, Array)&#xA;#20 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#21 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&amp;gt;displayWithErrorHandling(Array, Array)&#xA;#22 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#23 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Template.php(371): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#24 /Users/mariovasquez/Documents/CODE/craft-3/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#25 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/View.php(337): Twig_Environment-&amp;gt;render('utilities/_inde...', Array)&#xA;#26 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/View.php(384): craft\web\View-&amp;gt;renderTemplate('utilities/_inde...', Array)&#xA;#27 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/Controller.php(161): craft\web\View-&amp;gt;renderPageTemplate('utilities/_inde...', Array)&#xA;#28 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/controllers/UtilitiesController.php(92): craft\web\Controller-&amp;gt;renderTemplate('utilities/_inde...', Array)&#xA;#29 [internal function]: craft\controllers\UtilitiesController-&amp;gt;actionShowUtility('updates')&#xA;#30 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#31 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#32 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller-&amp;gt;runAction('show-utility', Array)&#xA;#33 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('show-utility', Array)&#xA;#34 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module-&amp;gt;runAction('utilities/show-...', Array)&#xA;#35 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&amp;gt;runAction('utilities/show-...', Array)&#xA;#36 /Users/mariovasquez/Documents/CODE/craft-3/vendor/craftcms/cms/src/web/Application.php(286): yii\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#37 /Users/mariovasquez/Documents/CODE/craft-3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#38 /Users/mariovasquez/Documents/CODE/craft-3/web/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#39 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8524" LastEditorUserId="8524" LastEditDate="2019-02-27T16:22:54.823" LastActivityDate="2019-02-28T12:22:04.670" Title="Error when updating from 3.1.11 to 3.1.15" Tags="&lt;craft3&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29664" PostTypeId="2" ParentId="29637" CreationDate="2019-02-27T07:44:37.520" Score="0" Body="&lt;p&gt;This is how it could look like from Twig point of view. I don't know if the Solespace part is correct&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% set priceBracket = entry.relatedAdoptionLink.one() %}&#xA;{% set priceUrl = priceBracket !== null? priceBracket.getUrl() : '' %}&#xA;&#xA;{{ form.renderTag({returnUrl: priceURL}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-27T07:44:37.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29666" PostTypeId="1" AcceptedAnswerId="29668" CreationDate="2019-02-27T11:03:18.417" Score="1" ViewCount="148" Body="&lt;p&gt;I am trying to get the entries in my custom plugin template ( CP )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each entry has a lightswitch I want to fetch only those where lightswitch is enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In controller file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$criteria = craft()-&amp;gt;elements-&amp;gt;getCriteria(ElementType::Entry);&#xA;$criteria-&amp;gt;section('articles');&#xA;$criteria-&amp;gt;relatedTo(array(&#xA;    'field' =&amp;gt; 'lightswitchFieldHandle'&#xA;));&#xA;$criteria-&amp;gt;limit = 20;&#xA;$products['entries'] = $criteria-&amp;gt;find();&#xA;$this-&amp;gt;renderTemplate('sponsoredentries/_index', $products);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I am getting 20 entries (as per limit but not as per field)&lt;/p&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="57" LastEditDate="2019-02-28T04:14:32.473" LastActivityDate="2019-02-28T04:14:32.473" Title="Get entries based on custom field lightswitch in custom plugin in Craft 2" Tags="&lt;plugin-development&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29667" PostTypeId="2" ParentId="29631" CreationDate="2019-02-27T11:38:00.797" Score="2" Body="&lt;p&gt;The issue ended up being related to the yii debug toolbar failing to execute correctly. Disabling it in app.php fixed it.&lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2019-02-27T11:38:00.797" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29668" PostTypeId="2" ParentId="29666" CreationDate="2019-02-27T16:11:00.007" Score="1" Body="&lt;p&gt;You need to set the value of your Lightswitch field directly instead of using the &lt;code&gt;relatedTo&lt;/code&gt; parameter&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$criteria-&amp;gt;lightswitchFieldHandle = '1';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-27T16:11:00.007" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="29669" PostTypeId="1" CreationDate="2019-02-27T19:49:25.987" Score="1" ViewCount="48" Body="&lt;p&gt;Just planning out an entry form that includes a file upload field – an assets field hooked up to an S3 bucket. I see some documentation on entry form assets &lt;a href=&quot;https://docs.craftcms.com/v3/assets-fields.html#templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but need some advice on getting this working with S3 if anyone's done this before? Any help very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1109" LastActivityDate="2019-02-27T20:47:14.773" Title="Advice on entry form file uploads and S3" Tags="&lt;assets&gt;&lt;s3&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29670" PostTypeId="2" ParentId="29594" CreationDate="2019-02-27T20:09:37.660" Score="1" Body="&lt;p&gt;This turned out to be an issue with stalled tasks. There were a number of stalled tasks that were blocking the queue, preventing the localized pages from being created (&quot;resave all localizable elements&quot;). Clearing the stalled tasks resolved the issue. Thanks to Brad Bell for resolving this.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2019-02-27T20:09:37.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29671" PostTypeId="2" ParentId="29669" CreationDate="2019-02-27T20:47:14.773" Score="1" Body="&lt;p&gt;This is a great learning resource. Worth the investment, IMO, if you're building a lot of sites with Craft CMS.&#xA;&lt;a href=&quot;https://craftquest.io/lessons/switching-from-craft-local-assets-volume-to-s3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://craftquest.io/lessons/switching-from-craft-local-assets-volume-to-s3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9448" LastActivityDate="2019-02-27T20:47:14.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29672" PostTypeId="2" ParentId="29603" CreationDate="2019-02-28T04:31:43.343" Score="3" Body="&lt;p&gt;You should be able to use something similar to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use Craft;&#xA;use verbb\feedme\FeedMe;&#xA;use verbb\feedme\queue\jobs\FeedImport;&#xA;&#xA;$feeds = FeedMe::$plugin-&amp;gt;feeds-&amp;gt;getFeeds();&#xA;&#xA;foreach ($feeds as $feed) {&#xA;    $limit = null;&#xA;    $offset = null;&#xA;    $processedElementIds = [];&#xA;&#xA;    Craft::$app-&amp;gt;getQueue()-&amp;gt;delay(0)-&amp;gt;push(new FeedImport([&#xA;        'feed' =&amp;gt; $feed,&#xA;        'limit' =&amp;gt; $limit,&#xA;        'offset' =&amp;gt; $offset,&#xA;        'processedElementIds' =&amp;gt; $processedElementIds,&#xA;    ]));&#xA;}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above will add all your feeds to Craft's queue system and start them.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-02-28T04:31:43.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29673" PostTypeId="1" AcceptedAnswerId="29676" CreationDate="2019-02-28T05:41:02.957" Score="2" ViewCount="79" Body="&lt;p&gt;How can I edit a lightswitch field in an entries field layout via PHP? This is my current approach&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public function actionSponsoredEntriesPriority() {&#xA;    $this-&amp;gt;requireAdmin();&#xA;    $this-&amp;gt;requireAjaxRequest();&#xA;    $success = false;&#xA;    $message = Craft::t('Any message from controller');&#xA;&#xA;    $newPriority = craft()-&amp;gt;request-&amp;gt;getPost('newPriority');&#xA;    $entryId = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;&#xA;    $entries = craft()-&amp;gt;entries;&#xA;&#xA;    $entry = $entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;    if ($entry != null) {&#xA;        $entry-&amp;gt;getContent()-&amp;gt;setAttributes(array(&#xA;            'lightswitchFieldHandle' =&amp;gt; 1&#xA;        ));&#xA;&#xA;        $success = $entries-&amp;gt;saveEntry($entry);&#xA;        $success == true;&#xA;    } else {&#xA;        //return null;&#xA;        $success = false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But since there are other required fields that are currently empty for this entry I receive the following response&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;message: {featureImage: [&quot;Feature Image cannot be blank.&quot;], hero: [&quot;Header cannot be blank.&quot;]}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried to resave the required fields still stuck at matrix field.&#xA;Here is code &lt;a href=&quot;https://gist.github.com/maddyBoy/feed5b2c2daa97398d5ac93d63418fc5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reset required field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error : Correct the errors listed above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do i need to update the required field as well or there is a way to bypass while updating a field ?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Update : Solution as suggested in answer [Update field directly ]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionSponsoredEntriesPriority() {&#xA;        // $this-&amp;gt;requireAdmin();&#xA;        // $this-&amp;gt;requireAjaxRequest();&#xA;        $newPriority = craft()-&amp;gt;request-&amp;gt;getPost('newPriority');&#xA;        $entryId = craft()-&amp;gt;request-&amp;gt;getPost('entryId');&#xA;        $success = false;&#xA;        $message = Craft::t('Any message from controller');&#xA;&#xA;        // entries object&#xA;        $entries = craft()-&amp;gt;entries;&#xA;        // entries  by id ( $entryId passed by js )&#xA;        $entry = $entries-&amp;gt;getEntryById($entryId);&#xA;&#xA;        if ($entry != null) {&#xA;                $command = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;                $success = $command-&amp;gt;update(&#xA;                    'content', // table name&#xA;                    array(&#xA;                    'field_lightswitchFieldHandle' =&amp;gt; 1,&#xA;                    'field_sponsoredEntriesPriority' =&amp;gt; $newPriority&#xA;                    ), // fields&#xA;                    'elementId=:id',&#xA;                    array(':id'=&amp;gt; $entryId)&#xA;                    );&#xA;                $message = Craft::t('Priority saved');&#xA;                $success == true;&#xA;            } else {&#xA;            //return null;&#xA;            $success = false;&#xA;        }&#xA;        // send response true/false with message&#xA;       if($success == true){&#xA;           $this-&amp;gt;returnJson(&#xA;            array(&#xA;                'success' =&amp;gt; $success,&#xA;                'message' =&amp;gt; $message&#xA;            ));&#xA;       }else{&#xA;           $this-&amp;gt;returnJson(&#xA;            array(&#xA;                'success' =&amp;gt; $success,&#xA;                'message' =&amp;gt; $entry-&amp;gt;getErrors()&#xA;            ));&#xA;       }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="9313" LastEditDate="2019-03-01T05:05:39.203" LastActivityDate="2019-03-01T05:05:39.203" Title="Update a lightswitch field in Craft CMS 2" Tags="&lt;controller&gt;&lt;craft2&gt;&lt;saveentry&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29674" PostTypeId="1" AcceptedAnswerId="29675" CreationDate="2019-02-28T08:00:05.637" Score="1" ViewCount="382" Body="&lt;p&gt;How can I get sites by their group handle/name within twig templates?&#xA;Documentation only mentions querying sites by group id - &lt;code&gt;getSitesByGroupId&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-02-28T08:43:10.693" Title="How do i get sites by group handle/name?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29675" PostTypeId="2" ParentId="29674" CreationDate="2019-02-28T08:43:10.693" Score="2" Body="&lt;p&gt;I would rather suggest you to do that in PHP but the Twig way would be the following&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% set allSites = craft.app.getSites().getAllSites() %}&#xA;{% set sitesWithGroup = [] %}&#xA;{% for site in allSites %}&#xA;    {% if site.getGroup().name == 'my group name' %}&#xA;        {% set sitesWithGroup = sitesWithGroup|merge([site]) %}&#xA;    {% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-28T08:43:10.693" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29676" PostTypeId="2" ParentId="29673" CreationDate="2019-02-28T11:22:50.893" Score="2" Body="&lt;p&gt;If it's only one single field and you want to bypass all Craft validations for required fields you can change the value directly in your database using &lt;a href=&quot;https://www.yiiframework.com/doc/guide/1.1/en/database.query-builder#building-data-manipulation-queries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii commands&lt;/a&gt; and the &lt;code&gt;update&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;function update($table, $columns, $conditions='', $params=array())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$command = craft()-&amp;gt;db-&amp;gt;createCommand();&#xA;$command-&amp;gt;update('craft_content', &#xA;    array(&#xA;        'field_yourLightSwitchField' =&amp;gt; 1,&#xA;    ), &#xA;    'elementId=:id', array(':id'=&amp;gt;1)&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have a multilocale setup you need to include the condition for the correct locale as well&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-02-28T11:22:50.893" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29678" PostTypeId="2" ParentId="29663" CreationDate="2019-02-28T12:22:04.670" Score="0" Body="&lt;p&gt;This is an issue that I fixed in &lt;a href=&quot;https://github.com/nystudio107/craft-webperf/releases/tag/1.0.4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Webperf 1.0.4&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was using the badge count to display an emoji, and then a change in Craft 3.1.15 caused them to enforce that the badge count could be numeric only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, just update to the latest &lt;a href=&quot;https://nystudio107.com/plugins/webperf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Webperf&lt;/a&gt; and you'll be all set.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-02-28T12:22:04.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29680" PostTypeId="1" AcceptedAnswerId="29682" CreationDate="2019-02-28T15:47:49.480" Score="1" ViewCount="28" Body="&lt;p&gt;I have a &lt;a href=&quot;https://github.com/hillholliday/Craft-User-Manual/&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom plugin&lt;/a&gt; registered with &lt;a href=&quot;https://id.craftcms.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;id.craftcms.com&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://cl.ly/368a5bd83718/Screen%20Shot%202019-02-28%20at%2010.46.10%20AM.jpg&quot; alt=&quot;id.craft.cms changelog screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plugin store currently sees it at as 2.0.0, but I have since updated the plugin to 2.0.1 (and subsequently tried to force a silent 2.0.2 update) and noted so in my &lt;a href=&quot;https://github.com/hillholliday/Craft-User-Manual/blob/master/CHANGELOG.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;changelog&lt;/a&gt; but the plugin store is not seeing this update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The contents of my changelog look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Release Notes for Craft User Manual&#xA;&#xA;## 2.0.2 - 2019-02-27&#xA;### Updated&#xA;- Forcing new version for deprecation issues&#xA;&#xA;## 2.0.1 - 2018-08-24&#xA;### Fixed&#xA;- Deprecation Issues&#xA;&#xA;## 2.0.0 - 2018-08-24&#xA;### Added&#xA; - Initial Craft 3 release&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This was lifted directly from &lt;a href=&quot;https://docs.craftcms.com/v3/extend/changelogs-and-updates.html#setting-up-a-changelog&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft's documentation&lt;/a&gt; on changelogs so I'm not sure what I'm missing. Is there anything else I can try or debug?&lt;/p&gt;&#xA;" OwnerUserId="218" LastActivityDate="2019-03-01T00:35:18.627" Title="Plugin not updating in the plugin store from changelog updates" Tags="&lt;plugin-development&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29682" PostTypeId="2" ParentId="29680" CreationDate="2019-03-01T00:35:18.627" Score="1" Body="&lt;p&gt;The reason the Plugin Store hasn't picked up the 2.0.1 release is that you've got 3 different 2.0.1 tags in the repo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kXtZr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXtZr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, that's not a problem as it will just pick the first one by date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, if you browse the first &quot;V2.0.1&quot; tag, you'll see that its composer.json file has a listed version of 2.0.0, which is a version mismatch, so the Plugin Store will ignore it. &lt;a href=&quot;https://github.com/hillholliday/Craft-User-Manual/blob/00e2808e328e5bfe793fd343a59b5d2445d84d27/composer.json#L5&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/hillholliday/Craft-User-Manual/blob/00e2808e328e5bfe793fd343a59b5d2445d84d27/composer.json#L5&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reasons 2.0.2 never got picked up is because there is no 2.0.2 tag in the repo.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-01T00:35:18.627" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29683" PostTypeId="1" AcceptedAnswerId="29684" CreationDate="2019-03-01T01:03:35.877" Score="1" ViewCount="856" Body="&lt;p&gt;I have been stuck on trying to make an ajax call to a custom plugin controller in Craft 2 for a few days after trying everything from following the documentation for Craft 2 as well as looking up other posts that basically reiterate what the documentation says, but nothing seems to work. According to the documentation for Craft 2, I should be able to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[PluginHandle]/[ControllerName]/[ActionName]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in a hidden field. I've even tried using the full method name, actionGetLocations, just to rule that out. Here is what I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;/actions/googleMap/getLocations&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ siteUrl }}map-test&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my controller:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;namespace Craft;&#xA;&#xA;class GoogleMap_MapController extends BaseController&#xA;{&#xA;    public function actionGetLocations()&#xA;    {&#xA;        $this-&amp;gt;requireAjaxRequest();&#xA;&#xA;        return $this-&amp;gt;returnJson([&#xA;            'success' =&amp;gt; [&#xA;                'state' =&amp;gt; &quot;This would be states&quot;,&#xA;                'locations' =&amp;gt; &quot;This would be locations&quot;&#xA;            ]&#xA;        ]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My controller file is named &lt;code&gt;GoogleMap_MapController.php&lt;/code&gt; to follow the naming scheme. I also have my ajax request, which needs to be written in vanilla javascript for this site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var xhr = new XMLHttpRequest();&#xA;            xhr.open('POST', '/actions/googleMap/getLocations');&#xA;&#xA;            xhr.onreadystatechange = function() {&#xA;                if(xhr.status === 200) {&#xA;                    console.log(xhr);&#xA;                }&#xA;                else {&#xA;                    console.log(&quot;The request failed, returned status of &quot; + xhr.status);&#xA;                    console.log(xhr);&#xA;                }&#xA;            };&#xA;&#xA;            xhr.send(data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a 404 error for page not found, which makes sense since it's not really a page, but the documentation says that it will attempt to determine if the request URL is an action first. I tried changing the ajax call to post to '/' instead, but that returns the HTML from the page '/' successfully, which is not what I'm trying to get at all. I've tried sticking my hidden input tags in a form tag, however the submit causes the page to redirect to this non-existent route. I added in &lt;code&gt;onsubmit=&quot;event.preventDefault();&quot;&lt;/code&gt; to my form tag, and while it doesn't redirect, I still get a 404 error response. I'm completely at a loss at this point any help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9324" LastEditorUserId="57" LastEditDate="2019-03-02T06:33:46.470" LastActivityDate="2019-03-02T06:33:46.470" Title="Ajax Post to Plugin Controller" Tags="&lt;plugin-development&gt;&lt;ajax&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29684" PostTypeId="2" ParentId="29683" CreationDate="2019-03-01T01:26:37.310" Score="3" Body="&lt;p&gt;Based on your controller's class name, I believe you need to POST to this endpoint...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/actions/googleMap/map/getLocations&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-03-01T01:26:37.310" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29685" PostTypeId="1" CreationDate="2019-03-01T04:47:06.090" Score="2" ViewCount="91" Body="&lt;p&gt;Is there a way to set a discount in Commerce 2 that applies when, for example, three various products are in the cart? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use case;&#xA;Say you have a blue shirt, a black pant and a red cardigan, in the cart, and you wish to treat those as a kit. When all three are in the cart (either specific color variant, or simply a product), subtract $20 (or a percentage) from the total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit;&#xA;It would seem that adjusters is the way to go. Can someone shed some light on where those go, and how one would go about it when checking for multiple products against each other? Is the best way to create a module? Is there no admin UI whatsoever for adjustments? Is there a way to build adjustments with twig? Sorry, that's a lot of questions in one topic.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2019-03-02T18:33:34.457" LastActivityDate="2019-03-06T04:08:27.520" Title="Product Combination Discount in Commerce 2?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29686" PostTypeId="1" AcceptedAnswerId="29704" CreationDate="2019-03-01T11:58:42.760" Score="1" ViewCount="290" Body="&lt;p&gt;I have 2 front end registration forms. One for normal users and one for admins. In each form I have a hidden input with a group value like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;group&quot; value=&quot;ypo&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In craft I have &lt;strong&gt;allow public registration&lt;/strong&gt; checked and &lt;strong&gt;verify user address&lt;/strong&gt; unchecked&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I have a module that does two things:&#xA;One, it assigns new registrations to the correct group based on the hidden field and that part works like a charm, but I'll still post it here just in case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;        Elements::class,&#xA;        Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;        function(ElementEvent $event){&#xA;          // Check it's a front end request&#xA;          if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;            if($event-&amp;gt;element instanceof \craft\elements\User){&#xA;              $user = $event-&amp;gt;element;&#xA;              if($event-&amp;gt;isNew) {&#xA;                  $formName = Craft::$app-&amp;gt;getRequest()-&amp;gt;post('group');&#xA;                  if($formName==='ypo')&#xA;                  {&#xA;                    Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($event-&amp;gt;element-&amp;gt;id, [1]);&#xA;                    logMessage('Assigning Member - id: '.$event-&amp;gt;element-&amp;gt;id);&#xA;                  }&#xA;                  if($formName==='yp')&#xA;                  {&#xA;                    Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($event-&amp;gt;element-&amp;gt;id, [2]);&#xA;                    logMessage('Assigning Website User - id: '.$event-&amp;gt;element-&amp;gt;id);&#xA;                    $users =  Craft::$app-&amp;gt;getUsers();&#xA;                    if($users-&amp;gt;sendActivationEmail($user)) {&#xA;                      logMessage('Activation Email Sent');&#xA;                    }&#xA;                  }&#xA;              }&#xA;            }&#xA;          }&#xA;        }&#xA;      );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two, it blocks new users from being activated like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Event::on(&#xA;          Users::class,&#xA;          Users::EVENT_BEFORE_ACTIVATE_USER,&#xA;          function (UserEvent $event) {&#xA;              if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;                // Only trigger when request comes from the specified form&#xA;                $formName = Craft::$app-&amp;gt;getRequest()-&amp;gt;post('group');&#xA;                if($formName==='ypo' || $formName===&quot;yp&quot;) {&#xA;                  logMessage('Activation Withold');&#xA;                  $event-&amp;gt;isValid = false;&#xA;&#xA;                }&#xA;              }&#xA;          }&#xA;      );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I based this code on Brandon's answer to  [a very similar question][1] and it works, in a sense it sets the status to pending, but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/28216/how-can-i-set-new-user-accounts-to-pending-status-in-a-craft-3-module&quot;&gt;How can I set new user accounts to pending status in a Craft 3 module?&lt;/a&gt; but added the safeguard that the code will only be triggered when the accompanying hidden form fields are present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that whenever I want to activate the account,by emailing the activation code (manually or by my script), I get an error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Return value of craft\web\twig\variables\UserSession::getRememberedUsername() must be of the type string, null returned&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT: error was due to having 'autoLoginAfterAccountActivation' =&gt; true in settings. Switching that off got rid of the error, but the activation still doesn't work.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's even more weird is when I use the activation code from the admin panel, I'm then redirected to set your new password page instead of activation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My log doesn't show that my script has been triggered, so it shouldn't prevent activation from link or email. Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I did a lot of testing, If I remove EVENT_BEFORE_ACTIVATE_USER code and register a user, and then put it back in and send email, activation works. This means that setting craft\events\UserEvent::$isValid to false is permanent and can no longer be activated. Any idea why?&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2019-03-01T13:46:09.757" LastActivityDate="2019-03-02T16:27:15.697" Title="How to pragmatically set registered user status to pending and then manually send activation email" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;users&gt;&lt;modules&gt;&lt;usermodel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29688" PostTypeId="1" CreationDate="2019-03-01T14:34:11.803" Score="1" ViewCount="48" Body="&lt;p&gt;I have created a custom element type and cant get the reference tags to parse correctly, I've set the refHandle and the action to copy reference tag which seems to be correct format when I copy a reference tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to parse that in a template it doesn't work, it just stays in the reference format {refHandle:identifier}, I have the syntax correct because it works with entries and other base element types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something from my element type? I can't see anything from the docs or from looking through the craft commerce plugin as a guide.&lt;/p&gt;&#xA;" OwnerUserId="9303" LastEditorUserId="9303" LastEditDate="2019-03-01T14:39:41.717" LastActivityDate="2019-03-01T14:39:41.717" Title="Custom Element Reference Tags" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;elementtype&gt;&lt;reference-tags&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29689" PostTypeId="1" AcceptedAnswerId="29690" CreationDate="2019-03-01T15:11:17.187" Score="1" ViewCount="57" Body="&lt;p&gt;I have an index page for a Section which lists out the entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this index template doesn't have a title field associated with it how do I get the Section name in the SEOmatic's SEO Title Source?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-01T15:28:12.560" Title="Add Section Name to SEOmatic Title Field" Tags="&lt;craft3&gt;&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29690" PostTypeId="2" ParentId="29689" CreationDate="2019-03-01T15:28:12.560" Score="2" Body="&lt;p&gt;So you can do this via Twig as discussed here: &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#twig-templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/nystudio107/craft-seomatic#twig-templating&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...but you can also just make an Single for your Index page (this is what I usually do) and all of this will &quot;just work&quot; including the SEO sidebar previews in the CP.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-03-01T15:28:12.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29691" PostTypeId="2" ParentId="13751" CreationDate="2019-03-01T16:25:11.303" Score="1" Body="&lt;p&gt;I know this is a very old thread, but I stumbled onto it today because I was having a similar problem. I found that the source of my particular problem was due to the fact that I was also using Redirect plugin for Craft 3 on the site. The Redirect plugin appends a route to redirect everything to the 404 handler. I assume it was meant to be the last appended rule and to act as a default handler in the event no other route is matched. Unfortunately the element-api route got appended to the route rules array after that Redirect plugin default route, so the Craft routing never read the element-api route. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I deactivated the Redirect plugin and the element-api routing works now.&lt;/p&gt;&#xA;" OwnerUserId="8792" LastActivityDate="2019-03-01T16:25:11.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29692" PostTypeId="1" AcceptedAnswerId="29695" CreationDate="2019-03-01T17:15:25.823" Score="1" ViewCount="49" Body="&lt;p&gt;I'm looking to eager load and set another variable within the eager loading. But I can't seem to find out how on numerous guides/tutorials, and the query seems to be slowing the system down a bit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {% set entries = craft.entries ({&#xA;          section: 'events',&#xA;          order: 'postDate desc',&#xA;          with: ['eventMainImage'],[''],&#xA;          relatedTo: category&#xA;      }) %}&#xA;&#xA;  {% for entry in entries %}&#xA;    --&amp;gt; {% set venue = entry.eventVenueId.one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see by the arrow, I'm wanting to set this property, is this possible within an eager load?&lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-03-01T20:36:14.023" Title="Set Property within Eager Loading" Tags="&lt;templating&gt;&lt;eager-loading&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29693" PostTypeId="1" CreationDate="2019-03-01T17:59:26.720" Score="1" ViewCount="364" Body="&lt;h3&gt;Description&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I am getting this error after importing a database supplied from my colleague. I have deleted the vendors directory and composer lock file in an attempt to re-install Redactor. I have also updated all plugins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only result when I search for this error code is this ticket: &lt;a href=&quot;https://github.com/craftcms/commerce/issues/134&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/issues/134&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it doesn't look relevant to what's happening with mine. What can I supply that could potentially help resolve this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yii\base\UnknownPropertyException: Setting unknown property: craft\redactor\Field::configFile in /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/Component.php:209&#xA;Stack trace:&#xA;#0 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component-&amp;gt;__set('configFile', '')&#xA;#1 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\redactor\Field), Array)&#xA;#2 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/redactor/src/Field.php(111): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#3 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/helpers/Component.php(80): craft\redactor\Field-&amp;gt;__construct(Array)&#xA;#4 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/services/Fields.php(548): craft\helpers\Component::createComponent(Array, 'craft\\base\\Fiel...')&#xA;#5 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/services/Fields.php(573): craft\services\Fields-&amp;gt;createField(Array)&#xA;#6 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1536): craft\services\Fields-&amp;gt;getAllFields()&#xA;#7 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1073): craft\elements\db\ElementQuery-&amp;gt;customFields()&#xA;#8 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery-&amp;gt;prepare(Object(craft\db\mysql\QueryBuilder))&#xA;#9 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/db/Query.php(146): yii\db\QueryBuilder-&amp;gt;build(Object(craft\elements\db\EntryQuery))&#xA;#10 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/db/Query.php(274): yii\db\Query-&amp;gt;createCommand(Object(craft\db\Connection))&#xA;#11 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/db/Query.php(177): yii\db\Query-&amp;gt;one(NULL)&#xA;#12 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1215): craft\db\Query-&amp;gt;one(NULL)&#xA;#13 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/services/Elements.php(215): craft\elements\db\ElementQuery-&amp;gt;one()&#xA;#14 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/services/Elements.php(272): craft\services\Elements-&amp;gt;getElementById(2, 'craft\\elements\\...', 1)&#xA;#15 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/nystudio107/craft-seomatic/src/services/MetaContainers.php(763): craft\services\Elements-&amp;gt;getElementByUri('__home__', 1, false)&#xA;#16 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/nystudio107/craft-seomatic/src/services/MetaContainers.php(140): nystudio107\seomatic\services\MetaContainers-&amp;gt;setMatchedElement('', '1')&#xA;#17 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/nystudio107/craft-seomatic/src/twigextensions/SeomaticTwigExtension.php(47): nystudio107\seomatic\services\MetaContainers-&amp;gt;loadMetaContainers('', NULL)&#xA;#18 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/ExtensionSet.php(339): nystudio107\seomatic\twigextensions\SeomaticTwigExtension-&amp;gt;getGlobals()&#xA;#19 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/Environment.php(903): Twig_ExtensionSet-&amp;gt;getGlobals()&#xA;#20 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/Environment.php(923): Twig_Environment-&amp;gt;getGlobals()&#xA;#21 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/Template.php(363): Twig_Environment-&amp;gt;mergeGlobals(Array)&#xA;#22 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&amp;gt;display(Array, Array)&#xA;#23 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/Template.php(371): craft\web\twig\Template-&amp;gt;display(Array)&#xA;#24 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&amp;gt;render(Array)&#xA;#25 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/View.php(337): Twig_Environment-&amp;gt;render('_special/config...', Array)&#xA;#26 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/View.php(384): craft\web\View-&amp;gt;renderTemplate('_special/config...', Array)&#xA;#27 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/Controller.php(161): craft\web\View-&amp;gt;renderPageTemplate('_special/config...', Array)&#xA;#28 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/controllers/TemplatesController.php(115): craft\web\Controller-&amp;gt;renderTemplate('_special/config...')&#xA;#29 [internal function]: craft\controllers\TemplatesController-&amp;gt;actionConfigSyncKickoff()&#xA;#30 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#31 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#32 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller-&amp;gt;runAction('config-sync-kic...', Array)&#xA;#33 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('config-sync-kic...', Array)&#xA;#34 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module-&amp;gt;runAction('templates/confi...', Array)&#xA;#35 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/Application.php(709): craft\web\Application-&amp;gt;runAction('templates/confi...')&#xA;#36 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/craftcms/cms/src/web/Application.php(248): craft\web\Application-&amp;gt;_processConfigSyncLogic(Object(craft\web\Request))&#xA;#37 /Users/jaycollett/Development/dng/cmh-craft3/build/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#38 /Users/jaycollett/Development/dng/cmh-craft3/build/public/index.php(21): yii\base\Application-&amp;gt;run()&#xA;#39 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Additional info&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Craft version: 3.1.15&lt;/li&gt;&#xA;&lt;li&gt;PHP version: 7.1.22&lt;/li&gt;&#xA;&lt;li&gt;Database driver &amp;amp; version: MySQL 5.7.23&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5845" LastActivityDate="2019-03-01T17:59:26.720" Title="Strange Redactor Config error when importing colleague's database" Tags="&lt;craft3&gt;&lt;redactor&gt;&lt;config&gt;&lt;error&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29694" PostTypeId="1" CreationDate="2019-03-01T20:20:31.743" Score="1" ViewCount="337" Body="&lt;p&gt;Some of my entries have the optional plaintext field &lt;code&gt;myCustomField&lt;/code&gt;. I want to retrieve all entries except those where &lt;code&gt;myCustomField&lt;/code&gt; is filled out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get all entries that have an empty &lt;code&gt;myCustomField&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;    myCustomField: ':empty:',&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that doesn't include entries that don't have the field &lt;code&gt;myCustomField&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5072" LastActivityDate="2019-03-13T18:38:58.340" Title="how to search for entries where a custom field is either not present or is empty" Tags="&lt;search&gt;&lt;custom-field&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29695" PostTypeId="2" ParentId="29692" CreationDate="2019-03-01T20:36:14.023" Score="2" Body="&lt;p&gt;Eager-Loading is not like a hook or a callback. You wouldn't set variables within it. You'd want to use eager-loading to load your &lt;code&gt;eventVenueId&lt;/code&gt; then in your loop you'd set the variable a little differently.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; {% set entries = craft.entries ({&#xA;          section: 'events',&#xA;          order: 'postDate desc',&#xA;          with: ['eventMainImage', 'eventVenueId'],&#xA;          relatedTo: category&#xA;  }) %}&#xA;&#xA; {% for entry in entries %}&#xA;    {% set venue = entry.eventVenueId[0] ?? null %}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additionally you could look at eager-loading a &lt;a href=&quot;https://docs.craftcms.com/v3/dev/eager-loading-elements.html#eager-loading-nested-sets-of-elements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nested Set of Elements&lt;/a&gt; to further optimize your query if possible with the data you need off your &lt;code&gt;eventVenueId&lt;/code&gt; elements.&lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2019-03-01T20:36:14.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29696" PostTypeId="2" ParentId="29694" CreationDate="2019-03-01T21:05:47.020" Score="1" Body="&lt;p&gt;I don't know if you can do that at query level without adding the field to your other sections but you can do (although it's not very economical):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries.all() %}&#xA;&#xA;{% for entry in entries %}&#xA;{% if entry.text is empty %}&#xA;    {{ entry.title }} &amp;lt;br&amp;gt;&#xA;{% endif %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-01T21:05:47.020" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29697" PostTypeId="1" CreationDate="2019-03-02T00:34:28.533" Score="1" ViewCount="319" Body="&lt;p&gt;I'm having an issue with Craft 2.6 and the CSRF token. I enabled Csrf Protection in my general.php file by adding this line $config['*'] array so it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$config['*'] = [&#xA;...&#xA;    'enableCsrfProtection' =&amp;gt; true,&#xA;...&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried adding this line to the section for // Global variables after this array, but still no luck. I try to attach the token to the window object like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&#xA;        window.csrfTokenName = &quot;{{ craft.config.csrfTokenName }}&quot;;&#xA;        window.csrfTokenValue = &quot;{{ craft.request.csrfTokenValue }}&quot;;&#xA;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the &lt;code&gt;window.csrfTokenName = &quot;CRAFT_CSRF_TOKEN&quot;;&lt;/code&gt; but &lt;code&gt;window.csrfTokenValue = &quot;&quot;;&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how else to get a csrf token and I can't find any documentation that says anything else. I'm just trying to see if I'm missing something really easy or if there is actually something else I need to add. Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="9324" LastEditorUserId="9324" LastEditDate="2019-03-02T00:44:20.630" LastActivityDate="2019-03-02T00:45:03.370" Title="CSRF token is null or empty in craft 2" Tags="&lt;ajax&gt;&lt;craft2&gt;&lt;csrf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29698" PostTypeId="2" ParentId="29697" CreationDate="2019-03-02T00:45:03.370" Score="2" Body="&lt;p&gt;For Craft 2, these are the values you're looking for...&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;window.csrfTokenName = &quot;{{ craft.config.get('csrfTokenName') }}&quot;;&#xA;window.csrfTokenValue = &quot;{{ craft.request.getCsrfToken }}&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They changed slightly in Craft 3, which can be seen &lt;a href=&quot;https://craftcms.stackexchange.com/a/6588/45&quot;&gt;here...&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-03-02T00:45:03.370" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29699" PostTypeId="1" AcceptedAnswerId="29700" CreationDate="2019-03-02T14:19:17.390" Score="1" ViewCount="17" Body="&lt;p&gt;I've got a notification set up when a user is saved/updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to add the author/user who made the update &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried the following to see what returns and nothing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{author}&#xA;&#xA;{author.email}&#xA;&#xA;{author.firstName}&#xA;&#xA;{{object.author.email}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2019-03-02T14:43:32.250" Title="Sprout Email - output the" Tags="&lt;plugin-sproutemail&gt;&lt;author&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29700" PostTypeId="2" ParentId="29699" CreationDate="2019-03-02T14:43:32.250" Score="1" Body="&lt;p&gt;The dynamic object passed to a Notification Event depends on which Event is being triggered. In your case, the &quot;When a user is saved&quot; event has access to the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-user.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;User Model&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the attributes you are trying to access are on that User Model and are directly associated with the model itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{firstName}&#xA;{lastName}&#xA;{email}&#xA;&#xA;{{ object.firstName }}&#xA;{{ object.LastName }}&#xA;{{ object.email }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your example, you are trying to access the attribute &lt;code&gt;author&lt;/code&gt;. However, &lt;code&gt;author&lt;/code&gt; is an attribute from the &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-elements-entry.html#property-author&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry Model&lt;/a&gt;. The Entry Model is available to the &quot;When an entry is saved&quot; event and other Entry-specific events.&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-03-02T14:43:32.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29701" PostTypeId="1" AcceptedAnswerId="29702" CreationDate="2019-03-02T15:07:21.807" Score="1" ViewCount="344" Body="&lt;p&gt;I am trying to display the error message coming from the payment gateway ONLY.&#xA;I know I can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set message = craft.app.session.getFlash('error') %}&#xA;{{ message|length ? message }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but commerce returns to me a vague error like this &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unable to update cart.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If anything happens to the cart, even if it is not the payment. I don't know what the error is, nor does the customer. So is there a way to catch payment errors of the cart only?&lt;/p&gt;&#xA;" OwnerUserId="8590" LastActivityDate="2020-05-24T05:50:06.280" Title="How to display payment gateway error message only" Tags="&lt;plugin-craftcommerce2&gt;&lt;error-handling&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29702" PostTypeId="2" ParentId="29701" CreationDate="2019-03-02T15:46:08.157" Score="2" Body="&lt;p&gt;You mean the errors of your form? You can access those via &lt;code&gt;paymentForm&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-Twig prettyprint-override&quot;&gt;&lt;code&gt;{% for attribute, error in paymentForm %}&#xA;    {{ attribute }}: {{ dump(error) }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-02T15:46:08.157" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29703" PostTypeId="1" AcceptedAnswerId="29714" CreationDate="2019-03-02T16:02:31.063" Score="1" ViewCount="552" Body="&lt;p&gt;Getting Numerous errors when trying to test a staging environment with Craft 3.1. States &lt;code&gt;Install Failed - Check Logs&lt;/code&gt; which I have and I'm seeing the following logs being given. I don't understand what's causing this problem at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the server starts, it presents me with the following error repeated many times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data.db (postgresql[daemon]) ::  STATEMENT:  INSERT INTO &quot;resourcepaths&quot; (&quot;path&quot;, &quot;hash&quot;) VALUES ($1, $2)&#xA;data.db (postgresql[daemon]) ::  ERROR:  relation &quot;resourcepaths&quot; does not exist at character 13&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then when I head through the install window it presents me with the following error outputs in the link below (was too much to paste here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://paste.ee/p/lrFsi&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://paste.ee/p/lrFsi&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;db.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA; return [&#xA;     'driver'      =&amp;gt; 'pgsql',&#xA;     'server'      =&amp;gt; $_ENV['DATA_DB_HOST'],&#xA;     'user'        =&amp;gt; $_ENV['DATA_DB_USER'],&#xA;     'password'    =&amp;gt; $_ENV['DATA_DB_PASS'],&#xA;     'database'    =&amp;gt; 'gonano',&#xA;     'schema'      =&amp;gt; 'public',&#xA;     'tablePrefix' =&amp;gt; '',&#xA;     'port'        =&amp;gt; 5432&#xA; ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;.env&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# The database driver that will be used ('mysql' or 'pgsql')&#xA;DB_DRIVER=&quot;pgsql&quot;&#xA;&#xA;# The database server name or IP address (usually this is 'localhost' or '127.0.0.1')&#xA;DB_SERVER=&quot;localhost&quot;&#xA;&#xA;# The database username to connect with&#xA;DB_USER=&quot;root&quot;&#xA;&#xA;# The database password to connect with&#xA;DB_PASSWORD=&quot;&quot;&#xA;&#xA;# The name of the database to select&#xA;DB_DATABASE=&quot;&quot;&#xA;&#xA;# The database schema that will be used (PostgreSQL only)&#xA;DB_SCHEMA=&quot;public&quot;&#xA;&#xA;# The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)&#xA;DB_TABLE_PREFIX=&quot;&quot;&#xA;&#xA;# The port to connect to the database with. Will default to 5432 for PostgreSQL and 3306 for MySQL.&#xA;DB_PORT=&quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Composer.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.1.15&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.3.2&quot;,&#xA;    &quot;lukeyouell/craft-fetch&quot;: &quot;1.2.0&quot;,&#xA;    &quot;nystudio107/craft-seomatic&quot;: &quot;3.1.44&quot;,&#xA;    &quot;verbb/feed-me&quot;: &quot;3.1.10&quot;,&#xA;    &quot;verbb/feed-me-pro&quot;: &quot;3.0.4&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;sort-packages&quot;: true,&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Project.yaml&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://paste.ee/p/VkgNe#F3NWs50GBWk0M1B7AgmQDuVphbDcwRau&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://paste.ee/p/VkgNe#F3NWs50GBWk0M1B7AgmQDuVphbDcwRau&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6570" LastEditorUserId="6570" LastEditDate="2019-03-02T17:38:05.660" LastActivityDate="2019-03-04T15:07:14.740" Title="Install Failed - Numerous Errors when running with pgsql" Tags="&lt;database&gt;&lt;install&gt;&lt;installation&gt;&lt;postgresql&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29704" PostTypeId="2" ParentId="29686" CreationDate="2019-03-02T16:27:15.697" Score="1" Body="&lt;p&gt;So, for the part preventing the activation, don't use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest())&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just do:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    Users::class,&#xA;    Users::EVENT_BEFORE_ACTIVATE_USER,&#xA;    function(Event $event){&#xA;        $formName = Craft::$app-&amp;gt;getRequest()-&amp;gt;post('group');&#xA;        if ($formName==='ypo' || $formName===&quot;yp&quot;) {&#xA;           $event-&amp;gt;isValid = false;&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the other part:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;Elements::class,&#xA;Elements::EVENT_AFTER_SAVE_ELEMENT,&#xA;    function(Event $event){&#xA;        // Check it's a front end request&#xA;        if (Craft::$app-&amp;gt;request-&amp;gt;getIsSiteRequest()) {&#xA;            if($event-&amp;gt;element instanceof \craft\elements\User) {&#xA;                $user = $event-&amp;gt;element;&#xA;                if($event-&amp;gt;isNew) {&#xA;                    $user-&amp;gt;unverifiedEmail = $user-&amp;gt;email;&#xA;                    Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user, false);&#xA;                    $formName = Craft::$app-&amp;gt;getRequest()-&amp;gt;post('group');&#xA;&#xA;                    if($formName==='ypo') {&#xA;                        Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($user-&amp;gt;id, [1]);&#xA;                    }&#xA;                    if($formName==='yp') {&#xA;                        Craft::$app-&amp;gt;getUsers()-&amp;gt;assignUserToGroups($user-&amp;gt;id, [2]);&#xA;                        $emailSent = Craft::$app-&amp;gt;getUsers()-&amp;gt;sendActivationEmail($user);    &#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because you don't enforce email verification in control panel/user settings, you are skipping populating the &lt;code&gt;unverifiedEmail&lt;/code&gt; field for the new user which is &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php#L1171&quot; rel=&quot;nofollow noreferrer&quot;&gt;done here&lt;/a&gt; and that was part of the issue too :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-02T16:27:15.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29708" PostTypeId="1" AcceptedAnswerId="29709" CreationDate="2019-03-03T16:29:54.840" Score="1" ViewCount="58" Body="&lt;p&gt;Standard &quot;when article has no summary, output the first 200 characters of the body minus HTML&quot; logic going on here. We're implementing some Spanish-language features for the first time and, while special characters are stored fine in the database (utf_unicode_ci collation) and they output fine on the front end when convert_encoding isn't applied, they come out garbled when convert_encoding is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ item.articleBodySpanish.type('bodyText')[0].bodyText|striptags|convert_encoding('UTF-8', 'HTML-ENTITIES')|slice(0, 200)|default('Lee mas') }}...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an entry where the database contains this for articleBodySpanish: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;Empuja sus puños contra los postes y sigue insistiendo en que ve a los fantasmas.&amp;amp;nbsp;Empuja sus puños contra los postes y sigue insistiendo en que ve a los fantasmas.&amp;lt;/p&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the code above, the output I get is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Empuja sus puÃ±os contra los postes y sigue insistiendo en que ve a los fantasmas. Empuja sus puÃ±os contra los postes y sigue insistiendo en que ve a los fantasmas.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I remove the &lt;strong&gt;|convert_encoding('UTF-8', 'HTML-ENTITIES')&lt;/strong&gt; the output becomes this, so I can't even just take it out to moot the issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Empuja sus puños contra los postes y sigue insistiendo en que ve a los fantasmas.&amp;amp;nbsp;Empuja sus puños contra los postes y sigue insistiendo en que ve a los fantasmas.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What can I do here?&lt;/p&gt;&#xA;" OwnerUserId="7748" LastActivityDate="2019-03-03T19:16:03.117" Title="convert_encoding is screwing up Spanish-language characters" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29709" PostTypeId="2" ParentId="29708" CreationDate="2019-03-03T19:16:03.117" Score="1" Body="&lt;p&gt;You shouldn't need any &lt;code&gt;convert_encoding&lt;/code&gt; here. From your results, the special characters are coming out fine, it's your &lt;code&gt;&amp;amp;nbsp&lt;/code&gt; that is your problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this to go you can use the &lt;code&gt;|raw&lt;/code&gt; Twig filter.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-03T19:16:03.117" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29710" PostTypeId="1" AcceptedAnswerId="29866" CreationDate="2019-03-04T11:33:30.160" Score="1" ViewCount="358" Body="&lt;p&gt;We've got a AWS setup with an ELB in front, 2 varnish cache servers and 2 Craft CMS backends, with Redis for php sessions and Craft cache shared amongst the backend servers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do not have sticky sessions, so each request can end up on a different server.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is with cpresources and the generated files. First request generates files on server 1, but as each request can end up on a different server, the other servers will not have the same files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best approach here? What alternatives do we have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to avoid sharing cpresources amongst the servers if possible (via mount), as it slightly complicates setup and its &quot;one more thing that may break&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Edit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have been experimenting with AWS EFS (Elastic File Storage) to share disks between servers, but unfortunately its too slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We noticed that in Craft CMS 2, static files were served through index.php, which allows php to create the files, should they not exist, which would solve this particular issue. However, in Craft CMS 3, this changed and they are served directly. It would be great if someone official in Craft CMS could verify this change and comment why it was designed the way it is in Craft CMS 3 and also comment on how that change is beneficial in a multi-backend-setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are now looking into an EC2 instance to serve the purpose of an NFS share, but doing this we are introducing a single point of failure in an architecture that was suppose to eliminate that exact thing.&lt;/p&gt;&#xA;" OwnerUserId="9089" LastEditorUserId="9089" LastEditDate="2019-03-06T09:43:25.927" LastActivityDate="2019-03-19T09:49:39.430" Title="Multiple backends on CraftCMS 3 - Problem with cpresources" Tags="&lt;setup&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29711" PostTypeId="2" ParentId="29710" CreationDate="2019-03-04T11:41:00.313" Score="2" Body="&lt;p&gt;Running into the same issue here!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the uploaded files I have solved it by creating a NFS share on all backends (15 servers). Not ideal but it's working for now. Maybe mounting the cpresources to NFS share would also do the job, but I haven't tested it. &lt;/p&gt;&#xA;" OwnerUserId="8965" LastActivityDate="2019-03-04T11:41:00.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29713" PostTypeId="1" CreationDate="2019-03-04T12:57:04.463" Score="1" ViewCount="87" Body="&lt;p&gt;How do I mark a cart as complete from a plugin?&#xA;I tried setting isComplete = 1, it gets moved to orders but it is still a cart.&lt;/p&gt;&#xA;" OwnerUserId="8590" LastEditorUserId="8590" LastEditDate="2019-03-04T13:14:52.800" LastActivityDate="2019-03-04T15:26:17.177" Title="Mark a cart as complete from a plugin" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29714" PostTypeId="2" ParentId="29703" CreationDate="2019-03-04T15:07:14.740" Score="1" Body="&lt;p&gt;This was due to the following problems on the system, some where 'gotchas' and some were just generic mistakes on my part. Putting this as an answer to help others.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nanobox's &lt;code&gt;boxfile.yml&lt;/code&gt;&lt;/strong&gt; was classing anything that was in &lt;code&gt;storage/logs/web.log&lt;/code&gt; as an &lt;code&gt;[error]&lt;/code&gt; but obviously, it's not an error but rather a stack trace. This was fixed by changing it to the following within the boxfile:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    craft[stacktrace]: /app/storage/logs/web.log&#xA;    craft[error]: /app/storage/logs/phperrors.log&#xA;    php[error]: /data/var/log/php/php_error.log&#xA;    php[fpm]: /data/var/log/php-fpm.log&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;db.php &lt;code&gt;driver&lt;/code&gt; was set to &lt;code&gt;mysql&lt;/code&gt;&lt;/strong&gt; when it was using postgres as a database. Changing it to the following 1/2 fixed the problem of installing.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'driver'      =&amp;gt; 'pgsql'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;code&gt;.env&lt;/code&gt; was correctly set to &lt;code&gt;DB_DRIVER=&quot;pgsql&quot;&lt;/code&gt; but obviously this didn't match up to what my database was booting up as. This was the final piece of the puzzle.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Essentially the learning from this was make sure your &lt;code&gt;db.php&lt;/code&gt; is nicely matched up to your &lt;code&gt;.env&lt;/code&gt; file especially regarding your database structure. Make sure you properly set your logs to report as the correct things. As you can see above there are numerous log's craft reports into. &lt;/p&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-03-04T15:07:14.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29715" PostTypeId="2" ParentId="29713" CreationDate="2019-03-04T15:26:17.177" Score="2" Body="&lt;p&gt;When you take a look at the &lt;code&gt;BookingsController&lt;/code&gt; you can see exactly what happens when you need to mark an order as complete&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public function actionCompleteOrder(): Response&#xA;{&#xA;    $this-&amp;gt;requireAcceptsJson();&#xA;    $orderId = Craft::$app-&amp;gt;getRequest()-&amp;gt;getParam('orderId');&#xA;&#xA;    $order = Plugin::getInstance()-&amp;gt;getOrders()-&amp;gt;getOrderById($orderId);&#xA;&#xA;    if ($order &amp;amp;&amp;amp; !$order-&amp;gt;isCompleted &amp;amp;&amp;amp; $order-&amp;gt;markAsComplete()) {&#xA;        $date = new \DateTime($order-&amp;gt;dateOrdered);&#xA;        return $this-&amp;gt;asJson(['success' =&amp;gt; true, 'dateOrdered' =&amp;gt; $date]);&#xA;    }&#xA;&#xA;    return $this-&amp;gt;asErrorJson(Craft::t('commerce', 'Could not mark the order as completed.'));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all you need to do is &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$order-&amp;gt;markAsComplete();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which does &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;$this-&amp;gt;isCompleted = true;&#xA;$this-&amp;gt;dateOrdered = Db::prepareDateForDb(new \DateTime());&#xA;$this-&amp;gt;reference = 'xxxx';&#xA;$this-&amp;gt;orderStatusId = y;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You need to set the 4 parameters above to complete an order correctly, not just the &lt;code&gt;isComplete&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-04T15:26:17.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29717" PostTypeId="1" CreationDate="2019-03-04T16:45:12.963" Score="1" ViewCount="53" Body="&lt;p&gt;Suppose I have an assets field in my orders fields, how could I attach those files in the confirmation email?&lt;/p&gt;&#xA;" OwnerUserId="3874" LastActivityDate="2019-03-07T14:35:04.730" Title="Add attachments with Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;emails&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29718" PostTypeId="1" AcceptedAnswerId="29719" CreationDate="2019-03-04T17:56:58.317" Score="1" ViewCount="319" Body="&lt;p&gt;In Craft Commerce 1, there is documentation on how to re-order adjustments that do similar things.&#xA;&lt;a href=&quot;https://docs.craftcms.com/commerce/v1/adjusters.html#ordering-adjustments&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v1/adjusters.html#ordering-adjustments&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't see any similar documentation for how to do that in Commerce 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 plugins that make adjustments to the Sale price and then Order total, but if run in the wrong order, it doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple solution is to uninstall the plugins and install them in the correct sequence, but was wondering if there was still a way to force them to run in a certain order.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2019-03-04T19:08:30.490" Title="Order Adjusters in Commerce 2" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29719" PostTypeId="2" ParentId="29718" CreationDate="2019-03-04T19:08:30.490" Score="1" Body="&lt;p&gt;Looking at the &lt;code&gt;\craft\commerce\services\OrderAdjustments&lt;/code&gt; you should be able to change the ordering of your adjustments by using the &lt;code&gt;\craft\commerce\services\OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS&lt;/code&gt; event.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\events\RegisterComponentTypesEvent;&#xA;use craft\commerce\services\OrderAdjustments;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(&#xA;    OrderAdjustments::class,&#xA;    OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS,&#xA;    function (RegisterComponentTypesEvent $e) {&#xA;        $e-&amp;gt;types = [&#xA;            // Add the adjusters in whatever order you want here. Leaving this empty would disable all adjusters.&#xA;        ];&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="993" LastActivityDate="2019-03-04T19:08:30.490" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29720" PostTypeId="2" ParentId="29717" CreationDate="2019-03-04T19:28:53.033" Score="1" Body="&lt;p&gt;I suppose you could use the &lt;code&gt;\craft\commerce\services\Emails::EVENT_BEFORE_SEND_MAIL&lt;/code&gt; event for that.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;use craft\commerce\events\MailEvent;&#xA;use craft\commerce\services\Emails;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(&#xA;    Emails::class,&#xA;    Emails::EVENT_BEFORE_SEND_MAIL,&#xA;    function (MailEvent $e) {&#xA;        // You would be able to access the `\craft\mail\Message` like so&#xA;        // $e-&amp;gt;craftEmail;&#xA;&#xA;        // And the `\craft\commerce\elements\Order` like so&#xA;        // $e-&amp;gt;order&#xA;&#xA;        // So adding an asset could be done by accessing the `attach` method.&#xA;        // https://www.yiiframework.com/extension/yiisoft/yii2-swiftmailer/doc/api/2.1/yii-swiftmailer-message#attach()-detail&#xA;        $e-&amp;gt;craftEmail-&amp;gt;attach(...);&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="993" LastEditorUserId="993" LastEditDate="2019-03-07T14:35:04.730" LastActivityDate="2019-03-07T14:35:04.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29721" PostTypeId="1" CreationDate="2019-03-04T20:52:20.160" Score="1" ViewCount="128" Body="&lt;p&gt;I am needing to set up two distinct users (one for each of two LDAP log ins) and I need for them both to use the same admin email address.  However, Craft 2 will not let me do this.  Is there a way to do this for this type of special admin/ldap user?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6879" LastActivityDate="2019-04-05T04:05:51.157" Title="Use Same Email Address On Multiple User Accounts" Tags="&lt;emails&gt;&lt;user-profile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29722" PostTypeId="1" AcceptedAnswerId="29727" CreationDate="2019-03-05T06:02:24.687" Score="1" ViewCount="93" Body="&lt;p&gt;Having to log in again every few minutes while on a local development environment significantly slows your workflow.&lt;/p&gt;&#xA;" OwnerUserId="9347" LastActivityDate="2019-03-05T12:48:02.617" Title="Is there a way to remove the admin panel logout timer?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29723" PostTypeId="1" CreationDate="2019-03-05T08:19:53.310" Score="1" ViewCount="224" Body="&lt;p&gt;I'm trying to deploy our Craft 3 site on an Apache server. When running &lt;code&gt;composer install&lt;/code&gt; I get the following error.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;@php nys-setup update&#xA;  Script @php nys-setup update handling the post-install-cmd event returned with error code 255&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what the reason could be or where I could get more detail on the error?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-04-05T12:03:35.810" Title="Deploying Craft on Apache Server - Error code 255" Tags="&lt;craft3&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29724" PostTypeId="1" AcceptedAnswerId="29725" CreationDate="2019-03-05T08:20:01.603" Score="1" ViewCount="924" Body="&lt;p&gt;I'm not sure if I understand the alias concept entirely&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to create an alias.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I write a variable into my &lt;code&gt;.env&lt;/code&gt; File: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SITE_URL_DE=&quot;http://hello.local&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I put it into my &lt;code&gt;general.php&lt;/code&gt; File:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;    //other settings as well here&#xA;    'aliases' =&amp;gt; [&#xA;      '@myNewAlias' =&amp;gt; getenv('SITE_URL_DE'),&#xA;    ],&#xA;  ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to print it in my template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ alias('@myNewAlias') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Invalid path alias: @myNewAlias&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But why?&lt;/p&gt;&#xA;" OwnerUserId="162" LastActivityDate="2019-03-05T08:34:11.347" Title="Invalid path alias" Tags="&lt;config&gt;&lt;siteurl&gt;&lt;alias&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29725" PostTypeId="2" ParentId="29724" CreationDate="2019-03-05T08:34:11.347" Score="2" Body="&lt;p&gt;You need to set it without an &lt;code&gt;@&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;    'aliases' =&amp;gt; [&#xA;        'myNewAlias' =&amp;gt; getenv('SITE_URL_DE')&#xA;     ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can do&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{{ alias('@myNewAlias') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in PHP&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Craft::getAlias('@myNewAlias');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-05T08:34:11.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29727" PostTypeId="2" ParentId="29722" CreationDate="2019-03-05T12:48:02.617" Score="4" Body="&lt;p&gt;The duration of the session can be extended via &lt;code&gt;userSessionDuration&lt;/code&gt; in your &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#usersessionduration&quot; rel=&quot;nofollow noreferrer&quot;&gt;Configuration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'userSessionDuration' =&amp;gt; 7200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-05T12:48:02.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29728" PostTypeId="1" CreationDate="2019-03-05T19:10:21.477" Score="0" ViewCount="130" Body="&lt;p&gt;The new donations purchasable looks super handy for charity websites, thank you for this :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the UK we have a thing called &lt;a href=&quot;https://www.gov.uk/claim-gift-aid&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gift Aid&lt;/a&gt; that allows charities to claim an extra 25% on donations/purchases if the customer opts into the scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way you could modify the new Donation purchasable so that two (or more) kinds of donation can be logged in Craft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg something like &lt;code&gt;craft.commerce.donation.type(normal)&lt;/code&gt; and &lt;code&gt;craft.commerce.donation.type(giftaid)&lt;/code&gt; - and then ideally a way to export a CSV of each donation type via the control panel?&lt;/p&gt;&#xA;" OwnerUserId="7356" LastActivityDate="2019-03-28T12:59:00.947" Title="Create different types of Donation purchasable? (for Gift Aid etc)" Tags="&lt;plugin-craftcommerce2&gt;&lt;modules&gt;&lt;donations&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29729" PostTypeId="2" ParentId="10542" CreationDate="2019-03-05T20:05:59.020" Score="1" Body="&lt;p&gt;The accepted answer only works for single-level structures, since &lt;code&gt;positionedBefore()&lt;/code&gt; doesn't include its parent entry. I don't know why this is, maybe it's a bug? Anyways, the result is that first child entry will get the same &quot;index&quot; as their parent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home (1)&lt;/li&gt;&#xA;&lt;li&gt;About (2)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Company (2)&lt;/li&gt;&#xA;&lt;li&gt;Contact (3)&lt;/li&gt;&#xA;&lt;li&gt;Location (4)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Blog (6)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Because &lt;a href=&quot;https://github.com/craftcms/cms/blob/f5c3ea9a2f675392b9492978b3b0b5c5f01b6cf9/src/base/Element.php#L410&quot; rel=&quot;nofollow noreferrer&quot;&gt;structures are ordered by &lt;code&gt;lft&lt;/code&gt; by default&lt;/a&gt;, we can get a number corresponding to the entry's order in a structure by searching for entries in a section where its &lt;code&gt;lft&lt;/code&gt; value is less than the reference entry.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set position = craft.entries&#xA;  .section('MySection')&#xA;  .andWhere('lft &amp;lt; &quot;' ~ entry.lft ~ '&quot;')&#xA;  .count() + 1&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will result:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Home (1)&lt;/li&gt;&#xA;&lt;li&gt;About (2)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Company (3)&lt;/li&gt;&#xA;&lt;li&gt;Contact (4)&lt;/li&gt;&#xA;&lt;li&gt;Location (5)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Blog (6)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Update: Seems the issue with &lt;code&gt;positionedBefore()&lt;/code&gt; is a bug after all. I think I'll still leave this here in case someone's using a version of Craft without the fix? Not sure if Craft 2 has the bug or not.&lt;/p&gt;&#xA;" OwnerUserId="8781" LastEditorUserId="8781" LastEditDate="2019-03-05T20:15:36.310" LastActivityDate="2019-03-05T20:15:36.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29730" PostTypeId="2" ParentId="29685" CreationDate="2019-03-06T00:27:01.490" Score="1" Body="&lt;p&gt;Indeed, the way to go is setting up a module or plugin for this sort of thing. While I did get that working in practice, I still have questions regarding how one can loop through and compare using the Craft CMS 3 Commerce 2 APIs to actually apply the discount based on custom fields on the variants. That will be a separate question entirely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you stumble upon this issue, the starting point I used was this;&#xA;&lt;a href=&quot;https://github.com/oof-bar/commerce-example-adjuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/oof-bar/commerce-example-adjuster&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/29732/looping-over-categories-product-variants-and-subsequently-applying-adjusters&quot;&gt;Here's a link to the new question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4918" LastEditorUserId="4918" LastEditDate="2019-03-06T04:08:27.520" LastActivityDate="2019-03-06T04:08:27.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29731" PostTypeId="2" ParentId="29721" CreationDate="2019-03-06T03:32:24.250" Score="1" Body="&lt;p&gt;Not natively because Craft places a unique index on the &lt;code&gt;email&lt;/code&gt; column of the &lt;code&gt;craft_users&lt;/code&gt; table in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without knowing the specifics of what you're trying to achieve, I'd probably write a custom plugin that listened to user registration events in Craft and saved the necessary LDAP information in its own database tables that had foreign keys back to the native &lt;code&gt;craft_users&lt;/code&gt; table.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-06T03:32:24.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29732" PostTypeId="1" CreationDate="2019-03-06T04:06:38.863" Score="1" ViewCount="61" Body="&lt;p&gt;Using the Craft 3 and Commerce 2 APIs, how would one go about looping through products in the cart to apply adjusters, looking at the following example;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A category, &quot;Product Packs&quot; is set up where different &quot;packs&quot; for products are defined. In a product, the variants have a field where one can optionally add that category. If we then have a pack, named &quot;summer kit&quot; in that category applied to a couple of variants of a T-Shirt product, to one variant of a Pants product, and a couple of variants of a Sweatshirt product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one go about looping over those products in the cart, check for the associated category, make sure it's the same category, and only applicable to 1 t-shirt, 1 pair of pants and 1 sweatshirt, while still being able to apply it again over another set of the same product variants? So if you had 1 white t-shirt, 1 red t-shirt, 2 pairs of pants and 2 different style sweatshirts, you end up with the pack discount for both those &quot;kits&quot;, individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any resources with examples of similar functionality, perhaps? Any hint is helpful, I'm a bit at a loss with the PHP/API side of Craft/Commerce.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-03-06T04:06:38.863" Title="Looping over categories, product variants, and subsequently applying adjuster(s)?" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;&lt;modules&gt;&lt;adjusters&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29734" PostTypeId="1" AcceptedAnswerId="29735" CreationDate="2019-03-06T10:39:25.253" Score="1" ViewCount="120" Body="&lt;p&gt;I want to create a staging site, on our production site and I dont know why on the homepage we've got an index of all the folders and if we click on web's folder, we can view the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone had an idea to solde this problem?&lt;/p&gt;&#xA;" OwnerUserId="8886" LastActivityDate="2019-03-06T10:57:46.780" Title="Homepage | Index of" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29735" PostTypeId="2" ParentId="29734" CreationDate="2019-03-06T10:57:46.780" Score="1" Body="&lt;p&gt;Your web server doesn't point to your &lt;code&gt;web&lt;/code&gt; directory. In order to see your homepage directly you need to change the path your URL points to&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-06T10:57:46.780" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29737" PostTypeId="2" ParentId="29723" CreationDate="2019-03-06T11:29:19.590" Score="1" Body="&lt;p&gt;That error was due to the php version not being specified when I had executed the command. I've tried running it with the specified path to the current php version and it seemed to work.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-06T11:29:19.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29738" PostTypeId="1" CreationDate="2019-03-06T12:31:01.417" Score="1" ViewCount="976" Body="&lt;p&gt;1) Updated existing Craft 2 from the Control Panel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;code&gt;.env&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DB_DRIVER=&quot;mysql&quot;&#xA;DB_SERVER=&quot;localhost&quot;&#xA;DB_USER=&quot;root&quot;&#xA;DB_PASSWORD=&quot;pwd&quot;&#xA;DB_DATABASE=&quot;dbname&quot;&#xA;DB_SCHEMA=&quot;public&quot;&#xA;DB_TABLE_PREFIX=&quot;some_&quot;&#xA;DB_PORT=&quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3 ) &lt;code&gt;/var/www/html/somename/config/general.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;return [&#xA;    // Global settings&#xA;    '*' =&amp;gt; [&#xA;        'defaultWeekStartDay' =&amp;gt; 1,&#xA;&#xA;        'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;        'cpTrigger' =&amp;gt; 'admin',&#xA;&#xA;        'securityKey' =&amp;gt; getenv('SECURITY_KEY'),&#xA;&#xA;&#xA;        'useProjectConfigFile' =&amp;gt; true,&#xA;    ],&#xA;    // Dev environment settings&#xA;    'dev' =&amp;gt; [&#xA;        'devMode' =&amp;gt; true,&#xA;        'useCompressedJs' =&amp;gt; false,&#xA;        'allowUpdates' =&amp;gt; true,&#xA;        'environmentVariables' =&amp;gt; [&#xA;            'basePath' =&amp;gt; '/var/www/html/craftcms3/web/',&#xA;            'baseUrl'  =&amp;gt; 'http://craftcms3.local/',&#xA;        ],&#xA;        'siteUrl' =&amp;gt; 'http://craftcms3.local/',&#xA;    ],&#xA;&#xA;    // Staging environment settings&#xA;    'staging' =&amp;gt; [&#xA;        // Prevent administrative changes from being made on staging&#xA;        'allowAdminChanges' =&amp;gt; false,&#xA;    ],&#xA;&#xA;    // Production environment settings&#xA;    'production' =&amp;gt; [&#xA;        // Prevent administrative changes from being made on production&#xA;        'allowAdminChanges' =&amp;gt; false,&#xA;    ],&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;4) and followed other mentioned steps at &lt;a href=&quot;https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Permission at root:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo chown www-data:www-data  -R *&#xA;sudo find . -type d -exec chmod 755 {} \;&#xA;sudo find . -type f -exec chmod 644 {} \;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error when I hit &lt;a href=&quot;http://craftcms3.local/admin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftcms3.local/admin&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft\web\ServiceUnavailableHttpException in /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php:689&#xA;Stack trace:&#xA;#0 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application-&amp;gt;_processUpdateLogic(Object(craft\web\Request))&#xA;#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#2 /var/www/html/craftcms3/web/index.php(22): yii\base\Application-&amp;gt;run()&#xA;#3 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Till now I haven't installed any plugins in Craft 3&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Update: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried again by following all steps above got the DB UPDATE screen after long time my system freezes now i got this error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'&#xA;The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale`&#xA;&#xA;Migration: craft\migrations\m160807_144858_sites&#xA;&#xA;Output:&#xA;&#xA;&amp;gt; execute SQL: SET FOREIGN_KEY_CHECKS = 0 ... done (time: 0.000s)&#xA;&amp;gt; dropping {{%sites}} if it exists ... done (time: 0.271s)&#xA;&amp;gt; create table {{%sites}} ... done (time: 0.385s)&#xA;&amp;gt; create unique index craft_sites_handle_unq_idx on {{%sites}} (handle) ... done (time: 0.343s)&#xA;&amp;gt; create index craft_sites_sortOrder_idx on {{%sites}} (sortOrder) ... done (time: 0.284s)&#xA;&amp;gt; insert into {{%sites}} ... done (time: 0.041s)&#xA;&amp;gt; update in {{%userpermissions}} ... done (time: 0.004s)&#xA;&amp;gt; add column siteId integer AFTER `locale` to table {{%categorygroups_i18n}} ...Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'&#xA;The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale` (/var/www/html/craftcms3/vendor/yiisoft/yii2/db/Schema.php:664)&#xA;#0 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema-&amp;gt;convertException(Object(PDOException), 'ALTER TABLE `cr...')&#xA;#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command-&amp;gt;internalExecute('ALTER TABLE `cr...')&#xA;#2 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Migration.php(377): yii\db\Command-&amp;gt;execute()&#xA;#3 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(547): yii\db\Migration-&amp;gt;addColumn('{{%categorygrou...', 'siteId', Object(craft\db\mysql\ColumnSchemaBuilder))&#xA;#4 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(150): craft\migrations\m160807_144858_sites-&amp;gt;addSiteColumn('{{%categorygrou...', 'siteId', true, 'locale')&#xA;#5 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\m160807_144858_sites-&amp;gt;safeUp()&#xA;#6 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration-&amp;gt;up(true)&#xA;#7 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(163): craft\db\MigrationManager-&amp;gt;migrateUp(Object(craft\migrations\m160807_144858_sites))&#xA;#8 /var/www/html/craftcms3/vendor/craftcms/cms/src/services/Updates.php(215): craft\db\MigrationManager-&amp;gt;up()&#xA;#9 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(521): craft\services\Updates-&amp;gt;runMigrations(Array)&#xA;#10 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/UpdaterController.php(209): craft\controllers\BaseUpdaterController-&amp;gt;runMigrations(Array, 'restore-db')&#xA;#11 [internal function]: craft\controllers\UpdaterController-&amp;gt;actionMigrate()&#xA;#12 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#13 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#14 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller-&amp;gt;runAction('migrate', Array)&#xA;#15 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&amp;gt;runAction('migrate', Array)&#xA;#16 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module-&amp;gt;runAction('updater/migrate', Array)&#xA;#17 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(683): craft\web\Application-&amp;gt;runAction('updater/migrate')&#xA;#18 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application-&amp;gt;_processUpdateLogic(Object(craft\web\Request))&#xA;#19 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&amp;gt;handleRequest(Object(craft\web\Request))&#xA;#20 /var/www/html/craftcms3/web/index.php(22): yii\base\Application-&amp;gt;run()&#xA;#21 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="9313" LastEditDate="2019-03-07T05:50:54.773" LastActivityDate="2019-03-07T05:50:54.773" Title="Got HTTP 503 – Service Unavailable error while updating to Craft 3" Tags="&lt;craft3&gt;&lt;upgrades&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29739" PostTypeId="1" AcceptedAnswerId="29754" CreationDate="2019-03-06T13:02:35.647" Score="6" ViewCount="2131" Body="&lt;p&gt;I had an issue with my site running Craft 3.1.15 where I wasn't able to update the site to the most recent 3.1.16, and also wasn't able to install any plugins. Every plugin I tried would throw this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Blockquote Invalid plugin: No plugin exists with the handle &quot;plugin-slug&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried creating a fresh install of craft through composer, this time running 3.1.16, and I'm faced with the same error. All my other craft sites run locally seem to update fine and have no issues installing new plugins. Is there an issue with the latest craft updates? Or is there something I need to do to resolve this?&lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2019-11-22T22:00:10.570" Title="Invalid plugin: No plugin exists with the handle - Craft 3" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;updates&gt;" AnswerCount="7" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29743" PostTypeId="2" ParentId="28192" CreationDate="2019-03-06T14:56:54.970" Score="2" Body="&lt;p&gt;You probably have it figured by now, but for anyone wondering, here's a complete working example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\elements\Product;&#xA;use craft\commerce\elements\Variant;&#xA;&#xA;// Create product&#xA;$product = new Product();&#xA;$product-&amp;gt;title = 'Hello world';&#xA;$product-&amp;gt;typeId = 2;&#xA;$product-&amp;gt;enabled = true;&#xA;&#xA;// Create variant&#xA;$variant = new Variant();&#xA;$variant-&amp;gt;title = 'hey';&#xA;$variant-&amp;gt;sku = 'hey';&#xA;$variant-&amp;gt;price = 123;&#xA;$variant-&amp;gt;stock = 5;&#xA;&#xA;// Save product with variant&#xA;$product-&amp;gt;setVariants([$variant]);&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($product);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2019-03-06T14:56:54.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29744" PostTypeId="1" AcceptedAnswerId="30012" CreationDate="2019-03-06T15:16:43.167" Score="1" ViewCount="26" Body="&lt;p&gt;Recently I've found that when a customer goes to checkout and hits the &lt;code&gt;craft\commerce\controllers actionPay()&lt;/code&gt; using a custom gateway that it's automatically marking the cart as complete. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This never used to happen, the gateway would set the cart to complete after receiving a webhook response itself at a later time, allowing the customer to go back and update their cart before checking out properly(or not as they decide).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if they hit the back button they, obviously, have an empty cart as it's been marked as completed (along with the automated emails etc that are sent at that time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction on how to stop this auto-complete from happening?&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2019-04-02T15:47:11.533" Title="Cart completed at gateway redirect issue" Tags="&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29745" PostTypeId="1" AcceptedAnswerId="29746" CreationDate="2019-03-06T21:25:58.360" Score="1" ViewCount="57" Body="&lt;p&gt;I have a structure where the Entry URI Format is &lt;code&gt;{parent.uri}/{slug}&lt;/code&gt; - what I'm looking to do is conditionally not include entry slugs within the uri based on a show/hide setting in the entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I might have structure where an entry, &lt;code&gt;sub-page2&lt;/code&gt; has a uri like so &lt;code&gt;page/sub-page/sub-page2&lt;/code&gt; but if there is a setting on sub-page to exclude it, it's uri should be &lt;code&gt;page/sub-page2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would mean that the conditional to show it should only be considered if it's being called as a parent. &lt;code&gt;sub-page&lt;/code&gt; should still be accessible from &lt;code&gt;page/sub-page&lt;/code&gt; - trying to find a way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="490" LastActivityDate="2019-03-06T21:47:22.660" Title="Custom URI to exclude entries in structure" Tags="&lt;structure&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29746" PostTypeId="2" ParentId="29745" CreationDate="2019-03-06T21:47:22.660" Score="2" Body="&lt;p&gt;You have the full power of Twig in your template to render the entries Uri so you can conditionally render what you want. This could be your template in your section settings &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% if object.parent.field == true %}{{ object.parent.uri }}{% else %}{{object.parent.slug}}{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are no real limitations since you can do what you are used to in Twig in your frontend &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-06T21:47:22.660" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="29747" PostTypeId="2" ParentId="4634" CreationDate="2019-03-07T02:20:55.340" Score="1" Body="&lt;p&gt;Yes I have. I even wrote an article that describes the application I created to automate the install process less than two minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/@bshelling/craft-mac-n-cheez-creates-a-craftcms-docker-dev-environment-in-seconds-33731a1aa685&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftCMS + Docker Dev Environment in seconds&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2019-03-07T02:20:55.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29748" PostTypeId="2" ParentId="29739" CreationDate="2019-03-07T02:30:13.453" Score="1" Body="&lt;p&gt;Have you tried running the &lt;code&gt;./craft update&lt;/code&gt; command? They describe this command here &lt;a href=&quot;https://docs.craftcms.com/v3/updating.html#updating-from-the-control-panel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/updating.html#updating-from-the-control-panel&lt;/a&gt;. That's one solution, the other thing you could try is for the plugins is removing the vendor folder and executing the &lt;code&gt;composer install&lt;/code&gt; command&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/@bshelling/craft-mac-n-cheez-creates-a-craftcms-docker-dev-environment-in-seconds-33731a1aa685&quot; rel=&quot;nofollow noreferrer&quot;&gt;Install CraftCMS and Docker Environment in seconds&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2019-03-07T02:30:13.453" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29749" PostTypeId="1" AcceptedAnswerId="29750" CreationDate="2019-03-07T05:56:48.547" Score="2" ViewCount="111" Body="&lt;p&gt;I have a &lt;code&gt;matrix&lt;/code&gt; with a couple of &lt;code&gt;text fields&lt;/code&gt; for a caption, location and URL and an image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time this page loads I want a random slide to show - so the background image is random, as well as the relevant text fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried several variations of the below but keep getting a template error of &quot;Array to string conversion&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this happening? How can I achieve the desired result?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;{% if entry.carouselMatrix is not empty %}&#xA;    {% set currentSlide = shuffle(entry.carouselMatrix.slides).first() %}&#xA;    &amp;lt;div class=&quot;hero__wrapper&quot;&amp;gt;&#xA;        {% for slide in currentSlide.first() %}&#xA;            {% set image = slide.image.first() %}&#xA;            &amp;lt;div class=&quot;hero__image&quot; style=&quot;background-image: url('{{ image.getUrl('heroHome') }}');&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;hero__wrapper--inner grid&quot;&amp;gt;&#xA;                &amp;lt;h1 class=&quot;hero__text grid__item desk-two-thirds&quot;&amp;gt;&#xA;                    {{ entry.heroText }}&#xA;                &amp;lt;/h1&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;hero__image--caption&quot;&amp;gt;&#xA;                &amp;lt;a href=&quot;{{ slide.linkUrl }}&quot;&amp;gt;&#xA;                    &amp;lt;span&amp;gt;{{ slide.caption }}&amp;lt;/span&amp;gt;&#xA;                &amp;lt;/a&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8675" LastEditorUserId="57" LastEditDate="2019-03-08T00:11:07.257" LastActivityDate="2019-03-08T00:11:07.257" Title="How can I return only 1 random block in a Matrix in Craft using Twig?" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29750" PostTypeId="2" ParentId="29749" CreationDate="2019-03-07T07:22:40.310" Score="4" Body="&lt;p&gt;You can create a random order by including &lt;code&gt;rand()&lt;/code&gt; in your &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/matrix-block-queries.html#orderby&quot; rel=&quot;nofollow noreferrer&quot;&gt;OrderBy&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;{% set randomBlock = entry.carouselMatrix.orderBy('rand()').one() %}&#xA;{% if randomBlock is not null %}&#xA;    {% set randomSlide = randomBlock.slides.orderBy('rand()').one() %}&#xA;    {% if randomSlide is not null %}&#xA;        {{ randomSlide .caption }}&#xA;        {% set image = randomSlide.image.one() %}&#xA;        {{ image is not null? image.getUrl() : '' }}&#xA;    {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-07T07:22:40.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29751" PostTypeId="1" AcceptedAnswerId="29753" CreationDate="2019-03-07T11:26:50.347" Score="1" ViewCount="132" Body="&lt;p&gt;In my project I have a &lt;code&gt;tickets&lt;/code&gt; which are edited in multiple steps where each step has it's own front end for. Now, of course. to continue editing an ticket I am required to fetch that exact ticket. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To accomplish this I have a search form include which will be displayed before the form is showed. When the search form returns an entry the form is shown, when this fails the search form include will be shown again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly: The search does work when I search for an entry where the title does not contain a spacebar, So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the title is 'Test' I can find it, when the title is &lt;code&gt;test ticket&lt;/code&gt; I can't find it using the search form, even though they do both exist!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General.php settings:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'defaultSearchTermOptions' =&amp;gt; [&#xA;    'attribute' =&amp;gt; 'title',&#xA;    'exact' =&amp;gt; true,&#xA;    'subRight' =&amp;gt; false,&#xA;    'subLeft' =&amp;gt; false,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My search form:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;form novalidate&amp;gt;&#xA;    &amp;lt;input id=&quot;search&quot; type=&quot;search&quot; name=&quot;ticket_number&quot;/&amp;gt;&#xA;    &amp;lt;button type=&quot;submit&quot;&amp;gt;Search&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;URL&lt;/code&gt; after submitting the form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.com?ticket_number=ticket+number+test+search&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My page:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;{% set searchQuery = craft.app.request.getParam('ticket_number') %}&#xA;{% set ticket = craft.entries().search(searchQuery).section('ticketLog').one() %}&#xA;&#xA;{% if ticket|length %}&#xA;    &amp;lt;div class=&quot;row&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;col-12&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;card&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;card-body&quot;&amp;gt;&#xA;                    &amp;lt;h4 class=&quot;card-title&quot;&amp;gt;Start Picking - {{ ticket.title }}&amp;lt;/h4&amp;gt;&#xA;                    &amp;lt;h6 class=&quot;card-subtitle&quot;&amp;gt;Fill in this form to start picking.&amp;lt;/h6&amp;gt;&#xA;                    {% include '/_components/includes/form' with {&#xA;                        'redirect' : siteUrl,&#xA;                        'section_handle' : 'ticketLog',&#xA;                        'fields' : [{&#xA;                            type : 'datetime',&#xA;                            handle : 'pickingStartTime',&#xA;                        },{&#xA;                            type : 'user',&#xA;                            title : 'Picker',&#xA;                            query : 'teamleader',&#xA;                            required : 'required',&#xA;                            size : '12',&#xA;                        }, {&#xA;                            type : 'submit',&#xA;                            text : 'Save Ticket',&#xA;                        }]&#xA;                    } %}&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;{% else %}&#xA;    &amp;lt;p&amp;gt;Your search for “{{ searchQuery }}” didn’t return any Tickets, please try again below.&amp;lt;/p&amp;gt;&#xA;    {% include 'ticket_log/forms/search_form.twig' %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope someone sees what I am doing wrong there!&lt;/p&gt;&#xA;" OwnerUserId="8846" LastActivityDate="2019-03-07T12:14:27.750" Title="Search query for entries doesn't seem to work correctly" Tags="&lt;templating&gt;&lt;search&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29752" PostTypeId="2" ParentId="29751" CreationDate="2019-03-07T12:09:42.180" Score="0" Body="&lt;p&gt;I found out that the problem can be resolved by changing the query from :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set ticket = craft.entries().search(searchQuery).section('ticketLog').one() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set ticket = craft.entries().title(searchQuery).section('ticketLog').one() %}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8846" LastActivityDate="2019-03-07T12:09:42.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29753" PostTypeId="2" ParentId="29751" CreationDate="2019-03-07T12:14:27.750" Score="1" Body="&lt;p&gt;I think the problem originates from the space in your search term: &lt;code&gt;test ticket&lt;/code&gt;.&#xA;To verify that, could you try altering your query to either&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.search('&quot;' ~ searchQuery ~ '&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;.search('fieldHandle:&quot;' ~ searchQuery ~ '&quot;')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The latter can be used if the search has to take place in only one field.&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2019-03-07T12:14:27.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29754" PostTypeId="2" ParentId="29739" CreationDate="2019-03-07T12:23:26.723" Score="1" Body="&lt;p&gt;The issue for this case was something related to my composer not installing it correctly. I downloaded the most recent version of Craft straight from the site and I don't face any of the above issues.&lt;/p&gt;&#xA;" OwnerUserId="6795" LastActivityDate="2019-03-07T12:23:26.723" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29755" PostTypeId="1" AcceptedAnswerId="29756" CreationDate="2019-03-07T13:40:23.640" Score="4" ViewCount="496" Body="&lt;p&gt;I would like to add my own external JS sources at the very end of the body tag in the Craft control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do view.registerJsFile(&quot;&amp;lt;CDN_URL&amp;gt;&quot;, {position:3}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;according to &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-view#registerJsFile()-detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/api/2.0/yii-web-view#registerJsFile()-detail&lt;/a&gt;, but Craft is always adding its own JS sources after mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="57" LastEditDate="2019-03-08T00:12:21.427" LastActivityDate="2019-03-08T00:12:21.427" Title="Register JS files at the end of the body tag in the Control Panel" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;includejs&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29756" PostTypeId="2" ParentId="29755" CreationDate="2019-03-07T14:56:20.343" Score="4" Body="&lt;p&gt;You can set the CP asset as depency then it will be loaded after it&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% do view.registerJsFile(&quot;&amp;lt;CDN_URL&amp;gt;&quot;,{&#xA;    depends: 'craft\\web\\assets\\cp\\CpAsset',&#xA;    position:3&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's because Yii2 will always register Bundles without any dependencies first / in the order they are defined. If you require the &lt;code&gt;CpAsset&lt;/code&gt; it will be loaded afterwards&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-07T14:56:20.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29757" PostTypeId="1" AcceptedAnswerId="29758" CreationDate="2019-03-07T17:17:06.053" Score="1" ViewCount="102" Body="&lt;p&gt;Trying to get started with Craft CMS 3 for the first time, and it's running locally via Valet. from the front end, I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; HTTP 503 – Service Unavailable – craft\web\ServiceUnavailableHttpException&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And on the admin side, I'm getting a 404. I've looked at similar questions, but none of the answers are helping me. I've set this up twice following &lt;a href=&quot;https://medium.com/@jalendport/running-craft-cms-3-on-laravel-valet-6df61e5193fd&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article on running Craft with Valet&lt;/a&gt;, and gotten the same result both times.&lt;/p&gt;&#xA;" OwnerUserId="9418" LastActivityDate="2019-03-07T19:00:42.177" Title="ServiceUnavailableHttpException on front end, and 404 on admin" Tags="&lt;craft3&gt;&lt;valet&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29758" PostTypeId="2" ParentId="29757" CreationDate="2019-03-07T19:00:42.177" Score="2" Body="&lt;p&gt;It turns out it was because I had Apache running and on port 80. I saw something about this somewhere in the guides I followed, but forgot to come back and stop Apache. Oops.&lt;/p&gt;&#xA;" OwnerUserId="9418" LastActivityDate="2019-03-07T19:00:42.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29761" PostTypeId="2" ParentId="28641" CreationDate="2019-03-08T15:56:00.497" Score="2" Body="&lt;p&gt;&lt;strong&gt;tl;dr:&lt;/strong&gt; In my case, adding &lt;code&gt;AllowOverride All&lt;/code&gt; back in to httpd.conf fixed the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was having the same issue on my staging server. I noticed that, in addition to &lt;code&gt;/admin&lt;/code&gt; throwing a 404, all of my site's subpages were 404-ing. This cause me to try the unrouted index.php url for a subpage (&lt;code&gt;mysite.com/index.php?p=subpage&lt;/code&gt;) and it worked! Note, this wasn't working for &lt;code&gt;/index.php?p=admin&lt;/code&gt; because it was properly routing to &lt;code&gt;/admin/login&lt;/code&gt;. Plugging in &lt;code&gt;/index.php?p=admin/login&lt;/code&gt; worked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran through the &lt;a href=&quot;https://craftcms.com/guides/removing-index-php-from-urls&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft guide for removing index.php from urls&lt;/a&gt;. Everything was set up properly, but my server admin found that &lt;code&gt;AllowOverride All&lt;/code&gt; had been commented out of httpd.conf during a server update and was never un-commented. Adding &lt;code&gt;AllowOverride All&lt;/code&gt; back in to httpd.conf fixed the issue.&lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2019-03-08T15:56:00.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29763" PostTypeId="2" ParentId="19113" CreationDate="2019-03-08T16:40:26.103" Score="1" Body="&lt;p&gt;This is the mySQL query I have used to update a lightswitch field in the database.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UPDATE `table` SET `field_name` = replace(field_name,'original content', 'updated content')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UPDATE `craft_content` SET `field_imageLightbox` = replace(field_imageLightbox,'0', '1')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2019-03-08T16:40:26.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29764" PostTypeId="2" ParentId="29408" CreationDate="2019-03-08T17:10:30.960" Score="1" Body="&lt;p&gt;Finally figured this out! GoDaddy was adding some random JavaScript to my page because my client had purchased a &quot;Search Engine Visibility&quot; package from them. When I turned off that package inside GoDaddy, my page worked as expected.&lt;/p&gt;&#xA;" OwnerUserId="8967" LastActivityDate="2019-03-08T17:10:30.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29765" PostTypeId="1" AcceptedAnswerId="29774" CreationDate="2019-03-09T00:36:18.297" Score="1" ViewCount="132" Body="&lt;p&gt;I ran the updater from the Admin (local install.) &#xA;After a few minutes, the update failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I try to load the site:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning: require(C:\Users\rickn\Documents\Craft\Projects\Untye/vendor/craftcms/cms/bootstrap/web.php): failed to open stream: No such file or directory in C:\Users\rickn\Documents\Craft\Projects\Untye\wwwroot\index.php on line 20&#xA;&#xA;Fatal error: require(): Failed opening required 'C:\Users\rickn\Documents\Craft\Projects\Untye/vendor/craftcms/cms/bootstrap/web.php' (include_path='.;C:\php\pear') in C:\Users\rickn\Documents\Craft\Projects\Untye\wwwroot\index.php on line 20&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is no &lt;code&gt;&quot;vendor/craftcms/cms&quot;&lt;/code&gt; folder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to manually update an existing install? I don't see that option in v3 update instructions.&lt;/p&gt;&#xA;" OwnerUserId="9128" LastEditorUserId="57" LastEditDate="2019-03-11T04:13:20.507" LastActivityDate="2019-04-10T05:02:35.510" Title="Errors after Upgrading from 3.0.35 &gt; 3.041" Tags="&lt;installation&gt;&lt;upgrades&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29766" PostTypeId="1" AcceptedAnswerId="29779" CreationDate="2019-03-09T04:53:45.937" Score="2" ViewCount="2035" Body="&lt;p&gt;I need the final tag to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;http://mysite.com/uploads/resources/_hero/myimage.jpg&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I use something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seoImage = entry.featuredImage.one().getUrl('hero') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I end up with a relative URL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;/uploads/resources/_hero/myimage.jpg&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I thought &quot;okay, I'll concatenate the site URL to the front and trim off one of the backslashes&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seoImage = siteUrl ~ entry.featuredImage.one().getUrl('hero')|trim('/', 'left') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That worked fine until the server has to generate a new image using image transform. Then we end up, just the once, with a URL that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;meta property=&quot;og:image&quot; content=&quot;http://mysite.com/http://mysite.com/index.php/actions/assets/generate-transform?transformId=46&quot;&amp;gt;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Darn, No idea what to do from here. Any ideas on how to get an absolute URL for the OG image tag EVERY time? &lt;/p&gt;&#xA;" OwnerUserId="9467" LastActivityDate="2019-03-11T12:50:42.440" Title="How can I set an absolute image url for Open Graph Image tags?" Tags="&lt;templating&gt;&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29768" PostTypeId="1" CreationDate="2019-03-09T23:01:45.860" Score="1" ViewCount="19" Body="&lt;p&gt;Somehow, shipping rates are not applied to the total when checking out and paying. It does show when selecting the shipping method, but not on the final order review and is not submitted as part of the payment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way it's set up is essentially a single shipping method, with geographical rules/zones. There's a &quot;General&quot; category, which is the default, and then an &quot;Accessories&quot; category which applies to smaller items related to that category. In the shipping method's various rules there's a different price set for the two shipping categories, and the non-default &quot;Accessories&quot; category is not being applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming/hoping it's a user-error on my part, and curious if anyone has run into this, and know of a fix?&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-03-09T23:10:19.870" Title="Shipping for other category than what's set as default is not applied to total" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29769" PostTypeId="2" ParentId="29768" CreationDate="2019-03-09T23:10:19.870" Score="1" Body="&lt;p&gt;Upon further investigation, it seems that no shipping is being applied after updating to the latest Commerce 2. Will report back here.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-03-09T23:10:19.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29770" PostTypeId="1" CreationDate="2019-03-10T18:11:54.700" Score="2" ViewCount="72" Body="&lt;p&gt;Is there a way to pass value of an entries field into category URI format?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if object.level == 1 %}&#xA;&#xA;{slug}-{entries.one().slug}&#xA;&#xA;{% else %}&#xA;&#xA;{slug}-{parent.uri}&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2019-03-10T18:31:35.500" Title="Entries field in categories URI" Tags="&lt;url&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29771" PostTypeId="2" ParentId="29770" CreationDate="2019-03-10T18:31:35.500" Score="2" Body="&lt;p&gt;If your entries field is in the layout of your category&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% if object.level == 1 %}&#xA;    {% set entry = object.entriesFieldHandle.one() %}&#xA;    {slug}-{{ entry? entry.slug : '' }}&#xA;{% else %}&#xA;    {slug}-{parent.uri}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-10T18:31:35.500" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29773" PostTypeId="1" AcceptedAnswerId="29775" CreationDate="2019-03-10T21:21:24.160" Score="2" ViewCount="110" Body="&lt;p&gt;Let's say we're on the order details page with the 3 tabs - Order Details, Transactions, Status History&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I add an extra tab with content?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft V3 / Commerce V2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9484" LastEditorUserId="57" LastEditDate="2019-03-11T04:17:41.887" LastActivityDate="2019-03-11T07:22:06.167" Title="Craft Commerce 2 - extend Order details page" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;&lt;craft-pro&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29774" PostTypeId="2" ParentId="29765" CreationDate="2019-03-11T04:15:56.677" Score="1" Body="&lt;p&gt;The easiest way is to make sure you have &lt;a href=&quot;https://getcomposer.org/doc/00-intro.md#installation-windows&quot; rel=&quot;nofollow noreferrer&quot;&gt;Composer installed&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can go to your project's root and run &lt;code&gt;composer update&lt;/code&gt; to pull in a fresh set of dependencies.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-11T04:15:56.677" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29775" PostTypeId="2" ParentId="29773" CreationDate="2019-03-11T07:22:06.167" Score="2" Body="&lt;p&gt;To include additional tabs you can include several different field layout tabs in your field layout designer. When you open &lt;code&gt;/admin/commerce/settings/ordersettings&lt;/code&gt; you can see the field layout for your orders. There you can click on &lt;code&gt;+ New Tab&lt;/code&gt; and drag and drop the fields you like&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-11T07:22:06.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29777" PostTypeId="2" ParentId="4225" CreationDate="2019-03-11T11:25:15.947" Score="2" Body="&lt;p&gt;For Craft 3 you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{%- do view.registerJsFile(view.getAssetManager().getPublishedUrl('@vendor/craftcms/redactor/lib/redactor/redactor.js')) -%}&#xA;{%- do view.registerCssFile(view.getAssetManager().getPublishedUrl('@vendor/craftcms/redactor/lib/redactor/redactor.css')) -%}&#xA;&#xA;&amp;lt;textarea id=&quot;jobOverview&quot; name=&quot;fields[jobOverview]&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&#xA;{% includeJs &quot;$R('#jobOverview');&quot; %}&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9486" LastEditorUserId="10786" LastEditDate="2020-05-21T14:55:15.250" LastActivityDate="2020-05-21T14:55:15.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29778" PostTypeId="2" ParentId="1384" CreationDate="2019-03-11T12:01:57.303" Score="2" Body="&lt;p&gt;Here’s a Craft 3-friendly way of achieving what Mike suggested. This assumes your app already has a custom twig extension, if it doesn’t you can easily &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;create one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &lt;code&gt;use craft\web\View;&lt;/code&gt; to the top of your TwigExtension, then in &lt;code&gt;getFunctions()&lt;/code&gt; add your function definition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new \Twig\TwigFunction('field', [$this, 'renderFormMacro'], ['is_safe' =&amp;gt; ['html']]),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the function itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function renderFormMacro(string $fieldType, array $fieldOptions) : string&#xA;{&#xA;    $oldMode = \Craft::$app-&amp;gt;view-&amp;gt;getTemplateMode();&#xA;    \Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode(View::TEMPLATE_MODE_CP);&#xA;    $html = \Craft::$app-&amp;gt;view-&amp;gt;renderTemplateMacro('_includes/forms', $fieldType, [$fieldOptions]);&#xA;    \Craft::$app-&amp;gt;view-&amp;gt;setTemplateMode($oldMode);&#xA;&#xA;    return $html;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then display fields in your frontend templates with code like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ field('text', {&#xA;    name: 'location',&#xA;    value: 'Timbuktu'&#xA;}) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3327" LastEditorUserId="3327" LastEditDate="2019-03-11T12:12:55.677" LastActivityDate="2019-03-11T12:12:55.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29779" PostTypeId="2" ParentId="29766" CreationDate="2019-03-11T12:50:42.440" Score="0" Body="&lt;p&gt;I'm pretty sure the reason this is happening is because you did not set an absolute Base URL in your asset settings. So if you use &lt;code&gt;/assets/images/folder&lt;/code&gt; in your asset settings, that's what the urls will look like on the frontend. If you instead use &lt;code&gt;http://my-project.com/assets/images/folder&lt;/code&gt;, your asset urls will include the domain name.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'd recommend setting up &lt;a href=&quot;https://docs.craftcms.com/v3/config/#aliases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yii Aliases in your config&lt;/a&gt; (if you haven't already) and using those instead of hard-coding the url. So you'd do something like this in Craft's &lt;code&gt;general.php&lt;/code&gt; config:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;    '@assetBaseUrl' =&amp;gt; 'http://my-project.com/assets',&#xA;    '@assetBasePath' =&amp;gt; '/path/to/web/assets',&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your asset settings you'd be able to use &lt;code&gt;@assetBaseUrl/images/folder&lt;/code&gt; instead of &lt;code&gt;http://my-project.com/assets/images/folder&lt;/code&gt;. Just a way to keep everything as DRY and clean as possible &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The above solution should solve your issue, but fwiw, I'm pretty sure you can force your site to use absolute urls regardless of your asset settings. If you use the &lt;code&gt;url()&lt;/code&gt; method and specify what scheme you want, I believe it will always resolve to an absolute url. So something like the following should work (but it feels very icky to me):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seoImage = entry.featuredImage.one().getUrl('hero') %}&#xA;{% set absoluteImageUrl = url(seoImage, '', 'https') %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2019-03-11T12:50:42.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29780" PostTypeId="1" CreationDate="2019-03-11T18:48:29.890" Score="1" ViewCount="167" Body="&lt;p&gt;I need to add the &lt;code&gt;SameSite&lt;/code&gt; directive to my site's CSRF cookie, as explained in these &lt;a href=&quot;https://infosec.mozilla.org/guidelines/web_security#directives-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;mozilla security guidelines&lt;/a&gt;. According to the &lt;a href=&quot;https://craftcms.com/guides/enabling-csrf-protection&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft docs&lt;/a&gt;, &quot;Craft handles the cookie creation automatically.&quot; Is there a way I can configure the cookie? &lt;/p&gt;&#xA;" OwnerUserId="3900" LastActivityDate="2019-03-11T19:30:38.810" Title="How to add CSRF cookie directive?" Tags="&lt;csrf&gt;&lt;cookies&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29782" PostTypeId="2" ParentId="29780" CreationDate="2019-03-11T19:30:38.810" Score="2" Body="&lt;p&gt;It is actually possible but it's a little bit difficult for beginners. You'll need make use of &lt;a href=&quot;https://www.yiiframework.com/doc/guide/2.0/en/concept-service-locator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Service Locators&lt;/a&gt; and overwrite &lt;code&gt;craft\web\Response&lt;/code&gt; to change this method&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;foreach ($this-&amp;gt;getCookies() as $cookie) {&#xA;    $value = $cookie-&amp;gt;value;&#xA;    if ($cookie-&amp;gt;expire != 1 &amp;amp;&amp;amp; isset($validationKey)) {&#xA;        $value = Yii::$app-&amp;gt;getSecurity()-&amp;gt;hashData(serialize([$cookie-&amp;gt;name, $value]), $validationKey);&#xA;    }&#xA;    setcookie($cookie-&amp;gt;name, $value, $cookie-&amp;gt;expire, $cookie-&amp;gt;path, $cookie-&amp;gt;domain, $cookie-&amp;gt;secure, $cookie-&amp;gt;httpOnly);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;setcookie&lt;/code&gt; is the key here, because if you use it like that, you can't really include the parameter, so you need call it accordingly with &lt;a href=&quot;http://php.net/manual/en/function.setcookie.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;options&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;setcookie ( string $name [, string $value = &quot;&quot; [, array $options = [] ]] ) : bool&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each &lt;code&gt;yii\web\Cookie&lt;/code&gt; only has the following Attributes&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;public $name;&#xA;public $value = '';&#xA;public $domain = '';&#xA;public $expire = 0;&#xA;public $path = '/';&#xA;public $secure = false;&#xA;public $httpOnly = true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since there is no &lt;code&gt;sameSite&lt;/code&gt; attribut you have to think about an intelligent way to set it. There is already a &lt;a href=&quot;https://github.com/yiisoft/yii2/issues/14742&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; for it. Maybe it's easier to ask about the current status.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-11T19:30:38.810" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29784" PostTypeId="1" CreationDate="2019-03-12T10:19:20.927" Score="1" ViewCount="45" Body="&lt;p&gt;Short question: Can I use GraphicsMagick with Craft CMS? If yes, how can it be configured? thanks&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-03-12T11:25:38.193" Title="Can I use GraphicsMagick with Craft CMS?" Tags="&lt;image-transforms&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29785" PostTypeId="2" ParentId="29784" CreationDate="2019-03-12T11:25:38.193" Score="1" Body="&lt;p&gt;No, Craft only supports GD and Imagick, not Gmagick (which would be the PHP extension that interfaces with GraphicsMagick). The underlying PHP library, &lt;a href=&quot;https://github.com/avalanche123/Imagine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagine&lt;/a&gt;, actually does, so I guess it would be feasible to add support for it, but I suspect that there's not that huge a demand in the community. You could try &lt;a href=&quot;https://github.com/craftcms/cms/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;submitting a feature request&lt;/a&gt; for it.&lt;/p&gt;&#xA;" OwnerUserId="141" LastActivityDate="2019-03-12T11:25:38.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29786" PostTypeId="2" ParentId="23587" CreationDate="2019-03-12T11:52:52.673" Score="5" Body="&lt;p&gt;For anyone finding it annoying having to be authenticated to enable the debug bar, particularly when testing in multiple browsers, it’s easy to override this behaviour with a &lt;a href=&quot;https://github.com/craftcms/craft/blob/master/modules/Module.php&quot; rel=&quot;noreferrer&quot;&gt;custom module&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add the following to your &lt;code&gt;init()&lt;/code&gt; code:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;// In dev envs override user debug toolbar prefs based on devMode setting&#xA;if (getenv('ENVIRONMENT') === 'dev' &amp;amp;&amp;amp; ! Craft::$app-&amp;gt;getRequest()-&amp;gt;getIsConsoleRequest()) {&#xA;    $session = Craft::$app-&amp;gt;getSession();&#xA;    $session-&amp;gt;set('enableDebugToolbarForSite', Craft::$app-&amp;gt;config-&amp;gt;general-&amp;gt;devMode);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code toggles the debug bar based on the devMode setting, and only in your dev environment. This is handy as you can quickly set devMode to false to test a production-like response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bear in mind that because this calls &lt;code&gt;$session-&amp;gt;set&lt;/code&gt;, even if you delete the code, your current session will retain whatever preference you last had set.&lt;/p&gt;&#xA;" OwnerUserId="3327" LastEditorUserId="3327" LastEditDate="2019-03-12T13:08:03.120" LastActivityDate="2019-03-12T13:08:03.120" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29787" PostTypeId="1" CreationDate="2019-03-12T12:09:26.023" Score="1" ViewCount="49" Body="&lt;p&gt;Channel: Restaurants&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Channel: Nutrition / contains entries field named restaurant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Required URL format:&#xA;    restaurant-name-nutrition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since the URL structure is merged I can't use getSegement(x) while getting entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in other scenario where the URL would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nutrition/restaurant-name&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set seg2 = craft.request.getSegment(2)&#xA;{% for entry in craft.entries.section('nutrition').slug(seg2) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but what is the right approach for that one?&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2019-03-12T12:26:15.623" Title="Filter by slug from URL (advanced)" Tags="&lt;url&gt;&lt;segments&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29788" PostTypeId="2" ParentId="29787" CreationDate="2019-03-12T12:26:15.623" Score="1" Body="&lt;p&gt;Why don't you use your current entry as reference?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set nutritions = craft.entries.section('nutrition').relatedTo({&#xA;    field: 'restaurant',&#xA;    targetElement: entry&#xA;}).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since your current entry is related to the entry you want to fetch this would be the besser solution. However that URL structure is not really optimal to beginn with. There are many cases it will break as soon as someone edits your entries, but filtering by slug alone is never a good idea in such a way.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-12T12:26:15.623" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29789" PostTypeId="1" CreationDate="2019-03-12T13:07:49.550" Score="1" ViewCount="225" Body="&lt;p&gt;I'm trying to migrate an existing blog into Craft using the FeedMe plugin. The old blog has an XML RSS feed that I'm importing and for the most part, everything works fine but the content section of the XML element contains HTML tags. When importing these tags are not removed or displayed properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way using the FeedMe plugin (Free or Pro version) to strip these tags or have them display properly?&lt;/p&gt;&#xA;" OwnerUserId="9493" LastEditorUserId="57" LastEditDate="2019-03-13T05:49:31.967" LastActivityDate="2019-09-22T04:04:11.120" Title="FeedMe Import XML feed with HTML" Tags="&lt;craft3&gt;&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29790" PostTypeId="1" AcceptedAnswerId="29794" CreationDate="2019-03-12T13:21:46.433" Score="1" ViewCount="268" Body="&lt;p&gt;Basically I have a select in my freeform, say with values catalogue A, catalogue B, catalogue C.&#xA;Is it possible to set the email recipient depending on the value that the user will select? e.g. requests for catalogue A,B should go to one email address, catalogue C to another one. Any advice appreciated!&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2019-03-12T14:51:02.630" Title="Set email recipient based on value of select in freeform - possible?" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29791" PostTypeId="1" AcceptedAnswerId="29793" CreationDate="2019-03-12T14:21:18.367" Score="1" ViewCount="83" Body="&lt;p&gt;I've made a plugin, that I'm now trying to include in a live project, but when I try to install it via the plugin installer, I get a 500 error, and if I try to include it using composer, I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ composer require mustasj/expanded-search&#xA;[InvalidArgumentException] Could not find a matching version of&#xA;package mustasj/expanded-search. Check the package spelling, your&#xA;version constraint and that the package is available in a stability&#xA;which matches your minimum-stability (stable).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've set the version to 1.0.1 in GitHub: &lt;a href=&quot;https://github.com/mustasj/expanded-search/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mustasj/expanded-search/releases&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="968" LastActivityDate="2019-03-13T00:51:40.970" Title="How to set stability version in plugins?" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29792" PostTypeId="1" CreationDate="2019-03-12T14:39:32.637" Score="1" ViewCount="68" Body="&lt;p&gt;Is there any way for an admin to use the Manual gateway and create an order for another customer in the system? Or is the only option for the admin to Log In as User feature and go through the checkout process that way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of either a plugin or front-end templates protected by &lt;code&gt;{% if currentUser.can('accessCp') %}&lt;/code&gt; where the admin can select customers from a drop-down, select a product from another drop-down, then checkout using the Manual Gateway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My situation is I have a labor request product. My client sells digital PowerPoint files of church hymnal songs. A customer can purchase a &quot;Song Request&quot; if the customer needs a song that my client has not created yet. So the sale is on the request. But once the product is made available, I need a way to give that product to the customer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is anyway to edit an order, so is there anyway to manually create a new order? Maybe there is a way I can use guest checkout with the customer email address, but still stay logged in as the admin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this note from the sample &lt;code&gt;shop\checkout\index.html&lt;/code&gt; template seems to indicate that you can't manually set the email address to someone else if you are already logged in, yourself.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{#&#xA;              Setting the guest email address on the guest customer and order.&#xA;              This will have no affect if the user is currently logged in as the cart uses the currentUsers email address.&#xA;              #}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is there any way to edit the Order Options after a product has been purchased? If I could assign during the checkout &lt;code&gt;{{ item.options.ProductId}} = 0&lt;/code&gt;, then after the product is uploaded, I could just edit that Option to match the new product (or variant) id and query that for the customer on their account page.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="4102" LastEditDate="2019-03-12T17:43:44.513" LastActivityDate="2019-03-12T17:43:44.513" Title="Create Manual Order for another customer" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29793" PostTypeId="2" ParentId="29791" CreationDate="2019-03-12T14:43:20.123" Score="2" Body="&lt;p&gt;Looks like you haven't submitted your plugin repo to &lt;a href=&quot;https://packagist.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Packagist&lt;/a&gt; yet. You'll need to do that before it's available via Composer (&lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html#packagist&quot; rel=&quot;nofollow noreferrer&quot;&gt;per the docs&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update and additional info:&lt;/em&gt;&lt;/strong&gt;&#xA;Like you mentioned in the comments, and like it's mentioned in the docs (see the &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-store.html#submit-for-approval&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tip box here&lt;/a&gt;), Packagist is optional for your Craft plugin. You can totally add your plugin to the plugin store and install it via the plugin store without ever putting it on Packagist. If you use Craft's &lt;code&gt;Update&lt;/code&gt; button in the dashboard, everything will work like you'd expect. The reason is because Craft is using its own logic (relying on Craftnet) to resolve packages. However, once you switch to running composer commands in the CLI to do your updating/installing/whatever, those packages won't be found (because they don't exist on Packagist yet) and Composer is obviously not using Craftnet's logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to be able to install/update your plugin via Composer, I'd recommend adding your plugin to Packagist. It honestly doesn't take that long (like 2 min maybe) and it will save you from quite a few support tickets down the road of people using Composer and having issues with your plugin's &quot;absence&quot;.&lt;/p&gt;&#xA;" OwnerUserId="5275" LastEditorUserId="5275" LastEditDate="2019-03-13T00:51:40.970" LastActivityDate="2019-03-13T00:51:40.970" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29794" PostTypeId="2" ParentId="29790" CreationDate="2019-03-12T14:51:02.630" Score="2" Body="&lt;p&gt;FreeForm actually has a &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#dynamic-recipients&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Recipients field&lt;/a&gt; that sounds like it will do what you're wanting. I believe you can choose to have it displayed as a select field, radio buttons, or checkboxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could probably create a little custom Twig and set up &lt;a href=&quot;http://docs.solspace.com/craft/freeform/v2/overview/email-notifications.html#dynamic-template-notifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic template notifications&lt;/a&gt;. I would think you should be able to switch the recipient array there based on the value of your select field for each submission (but it's possible I'm wrong; the Dynamic Recipients field definitely seems like the better option).&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2019-03-12T14:51:02.630" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29795" PostTypeId="1" AcceptedAnswerId="29835" CreationDate="2019-03-12T15:05:39.250" Score="1" ViewCount="41" Body="&lt;p&gt;I want to configure deeplinks for an app and want to set up 'universal links'. Right now I'll send an entry id to the element api to get the right content. But with universal links I didn't have a entry id, only a url. Based on the url I'll need to get the right entry instead of based on the entry id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Down here is my current endpoint to get the right entry based on a id. But if I didn't have an id how can I get the entry id based on the url.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example website.com/pages/welcom has entry id 123, in the app I can open it with sending 123 to the api endpoint. With universal links I open a link from my mail app for example then the app launches and I can send 'website.com/pages/welcom' to the api but how I'll get the right content from that page that has entry id 123.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'api/pages/&amp;lt;entryId:\d+&amp;gt;' =&amp;gt; function($entryId) {&#xA;&#xA;        requireLogin();&#xA;&#xA;        return array(&#xA;            'elementType' =&amp;gt; 'Entry',&#xA;            'criteria' =&amp;gt; ['section' =&amp;gt; 'pages', 'id' =&amp;gt; $entryId],&#xA;            'transformer' =&amp;gt; function(EntryModel $entry) {&#xA;&#xA;&#xA;&#xA;                $bodyBlocks = [];&#xA;                foreach ($entry-&amp;gt;contentBlokken as $block) {&#xA;                    switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                        case 'tekst':&#xA;                            $bodyBlocks[] = [&#xA;                                'text' =&amp;gt; $block-&amp;gt;description-&amp;gt;getParsedContent(),&#xA;                            ];&#xA;                            break;&#xA;                    }&#xA;                }&#xA;&#xA;                return array(&#xA;                    'id' =&amp;gt; $entry-&amp;gt;id,&#xA;                    'title' =&amp;gt; $entry-&amp;gt;title,&#xA;                    'description' =&amp;gt; $bodyBlocks,&#xA;                );&#xA;            }&#xA;        );&#xA;    },&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2019-03-15T10:45:09.220" LastActivityDate="2019-03-15T15:31:25.437" Title="How I’ll get an entryId based on a given URL?" Tags="&lt;entries&gt;&lt;url&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29796" PostTypeId="1" AcceptedAnswerId="29954" CreationDate="2019-03-12T15:53:59.297" Score="1" ViewCount="43" Body="&lt;p&gt;Im grabbing entries from two sections and displaying them using the group filter. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries().section('extendedEvents, festivalEvents')%}&#xA;{% set allEvents = entries %}&#xA;{% set allEventsBySection = allEvents|group('section') %}&#xA;&#xA;{% for section, eventsInSection in allEventsBySection %}&#xA;- results- &#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No matter what I do the results are coming back ordered as section2 (entry, entry, entry) then section 1 (entry, entry, entry)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I affect the order of the sections when displaying the results?                      &lt;/p&gt;&#xA;" OwnerUserId="5055" LastActivityDate="2019-04-27T13:02:20.413" Title="Grouping entries and ordering by section" Tags="&lt;templating&gt;&lt;filter&gt;&lt;ordering&gt;&lt;group&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29798" PostTypeId="1" AcceptedAnswerId="29801" CreationDate="2019-03-12T21:42:22.383" Score="1" ViewCount="1012" Body="&lt;p&gt;I have have a text field for copy-pasting an iFrame code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;iframe src=&quot;https://webpagelink.com/l/3556456/2019-03-06/34576&quot; width=&quot;100%&quot; &#xA;height=&quot;500&quot; type=&quot;text/html&quot; frameborder=&quot;0&quot; allowTransparency=&quot;true&quot; &#xA;style=&quot;border: 0&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I need help with is striping out the URL within the &lt;code&gt;src=&quot;&quot;&lt;/code&gt; value from the iframe. Is this possible using Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="6586" LastActivityDate="2019-03-13T10:10:41.557" Title="How to strip out src=&quot;&quot; value with twig from iframe code" Tags="&lt;templating&gt;&lt;twigextension&gt;&lt;plaintext&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29799" PostTypeId="1" CreationDate="2019-03-13T08:31:48.673" Score="1" ViewCount="252" Body="&lt;p&gt;I'm trying to figure out why I am able to preview a PDF in all other browser apart from Safari. The PDF is generated using DOMPDF (printmaker plugin) and output to the browser though PHP using Craft CMS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the PDF is &lt;a href=&quot;https://kendal.ac.uk/courses/2018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://kendal.ac.uk/courses/2018.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help with this would be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="9496" LastActivityDate="2019-03-13T08:54:41.007" Title="Preview PDF doesn't work in Safari but works in other browser" Tags="&lt;craft2&gt;&lt;plugin-printmaker&gt;&lt;dompdf&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29800" PostTypeId="2" ParentId="29799" CreationDate="2019-03-13T08:54:41.007" Score="1" Body="&lt;p&gt;I think this question does not really belong here but I'll answer it anyway. Sarafi changed the way it displays PDF documents. You can see instructions from &lt;a href=&quot;https://helpx.adobe.com/acrobat/using/display-pdf-in-browser.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adobe&lt;/a&gt; how to enable the browser view. Besides that you have not really a chance to force other Safari users to open PDFs in their browsers. You can as well see other multiple other discussions about it the &lt;a href=&quot;https://discussions.apple.com/thread/8162544&quot; rel=&quot;nofollow noreferrer&quot;&gt;Apple Forum&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-13T08:54:41.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29801" PostTypeId="2" ParentId="29798" CreationDate="2019-03-13T10:10:41.557" Score="2" Body="&lt;p&gt;You could write a module that adds a twig extension to return the value of src from the string. That way you get to utilise PHP as per &lt;a href=&quot;https://stackoverflow.com/questions/17017684/how-to-get-url-from-the-iframe-using-php&quot;&gt;https://stackoverflow.com/questions/17017684/how-to-get-url-from-the-iframe-using-php&lt;/a&gt; to get the value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt; is a good starting point for adding a module to Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alternative very dirty approach: If the iframe markup is always going to be the same, you could do &lt;code&gt;|replace()&lt;/code&gt;, replacing everything before the &lt;code&gt;src=&quot;&lt;/code&gt; and everthing after the &lt;code&gt;&quot; width&lt;/code&gt; with empty strings. Then replace &lt;code&gt;&quot; width&lt;/code&gt; with an empty string.&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2019-03-13T10:10:41.557" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29802" PostTypeId="1" AcceptedAnswerId="29808" CreationDate="2019-03-13T11:42:03.143" Score="1" ViewCount="1319" Body="&lt;p&gt;This was asked and solved previously, but for Craft 2, see &lt;a href=&quot;https://craftcms.stackexchange.com/questions/12557/error-connecting-to-mamp-pro-database-in-console-command&quot;&gt;Error Connecting To (MAMP Pro) Database in Console Command&lt;/a&gt;. Unable to make it work here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, running console commands like &lt;code&gt;./craft abc&lt;/code&gt; in Craft 3 configured using MAMP gives&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Craft isn’t installed yet!    &#xA;&#xA;Exception 'craft\errors\DbConnectException' with message 'Craft CMS can’t connect to the database with the credentials in config/db.php.'&#xA;&#xA;in /Users/stian/dev/site.no/vendor/craftcms/cms/src/db/Connection.php:179&#xA;&#xA;Stack trace:&#xA;#0 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/Connection.php(996): craft\db\Connection-&amp;gt;open()&#xA;#1 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/Connection.php(983): yii\db\Connection-&amp;gt;getMasterPdo()&#xA;#2 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(380): yii\db\Connection-&amp;gt;getSlavePdo()&#xA;#3 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(399): yii\db\mysql\QueryBuilder-&amp;gt;supportsFractionalSeconds()&#xA;#4 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(57): yii\db\mysql\QueryBuilder-&amp;gt;defaultTimeTypeMap()&#xA;#5 /Users/stian/dev/site.no/vendor/craftcms/cms/src/db/mysql/QueryBuilder.php(27): yii\db\mysql\QueryBuilder-&amp;gt;init()&#xA;#6 /Users/stian/dev/site.no/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\db\mysql\QueryBuilder-&amp;gt;init()&#xA;#7 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/QueryBuilder.php(116): yii\base\BaseObject-&amp;gt;__construct(Array)&#xA;#8 /Users/stian/dev/site.no/vendor/craftcms/cms/src/db/mysql/Schema.php(71): yii\db\QueryBuilder-&amp;gt;__construct(Object(craft\db\Connection), Array)&#xA;#9 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/Schema.php(249): craft\db\mysql\Schema-&amp;gt;createQueryBuilder()&#xA;#10 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/Connection.php(836): yii\db\Schema-&amp;gt;getQueryBuilder()&#xA;#11 /Users/stian/dev/site.no/vendor/yiisoft/yii2/db/Command.php(580): yii\db\Connection-&amp;gt;getQueryBuilder()&#xA;#12 /Users/stian/dev/site.no/vendor/craftcms/cms/src/db/Command.php(142): yii\db\Command-&amp;gt;update('{{%queue}}', Array, '[[timeUpdated]]...', Array)&#xA;#13 /Users/stian/dev/site.no/vendor/craftcms/cms/src/queue/Queue.php(507): craft\db\Command-&amp;gt;update('{{%queue}}', Array, '[[timeUpdated]]...', Array, false)&#xA;#14 /Users/stian/dev/site.no/vendor/craftcms/cms/src/queue/Queue.php(449): craft\queue\Queue-&amp;gt;_moveExpired()&#xA;#15 /Users/stian/dev/site.no/vendor/craftcms/cms/src/queue/Queue.php(95): craft\queue\Queue-&amp;gt;reserve()&#xA;#16 /Users/stian/dev/site.no/vendor/craftcms/cms/src/queue/Command.php(82): craft\queue\Queue-&amp;gt;run()&#xA;#17 [internal function]: craft\queue\Command-&amp;gt;actionRun()&#xA;#18 /Users/stian/dev/site.no/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)&#xA;#19 /Users/stian/dev/site.no/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&amp;gt;runWithParams(Array)&#xA;#20 /Users/stian/dev/site.no/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller-&amp;gt;runAction('run', Array)&#xA;#21 /Users/stian/dev/site.no/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller-&amp;gt;runAction('run', Array)&#xA;#22 /Users/stian/dev/site.no/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module-&amp;gt;runAction('queue/run', Array)&#xA;#23 /Users/stian/dev/site.no/vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application-&amp;gt;runAction('queue/run', Array)&#xA;#24 /Users/stian/dev/site.no/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application-&amp;gt;runAction('queue/run', Array)&#xA;#25 /Users/stian/dev/site.no/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application-&amp;gt;handleRequest(Object(craft\console\Request))&#xA;#26 /Users/stian/dev/site.no/craft(22): yii\base\Application-&amp;gt;run()&#xA;#27 {main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ideas?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="57" LastEditDate="2019-03-13T22:11:11.493" LastActivityDate="2020-03-09T05:04:03.237" Title="Unable to run console commands (Craft 3, MAMP)" Tags="&lt;craft3&gt;&lt;error-message&gt;&lt;console&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29803" PostTypeId="1" CreationDate="2019-03-13T12:12:46.507" Score="1" ViewCount="187" Body="&lt;p&gt;Still very new to Craft but just can't figure this problem out, it's a level above me at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an FAQ page as a 'single' that I would like to display all entries from a channel by default. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all these entries will have a tag option (either 'red' or 'blue').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I sort these entries via a sub nav to display only all, red or blue tagged entries?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. &lt;/p&gt;&#xA;" OwnerUserId="5390" LastEditorUserId="57" LastEditDate="2019-03-13T22:07:41.780" LastActivityDate="2019-03-13T22:07:41.780" Title="Filter entries by tags" Tags="&lt;navigation&gt;&lt;tags&gt;&lt;sorting&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29804" PostTypeId="2" ParentId="29803" CreationDate="2019-03-13T12:48:31.483" Score="1" Body="&lt;p&gt;You can read about how to use &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relations&lt;/a&gt; in the docs. All relations such as (Tags) can be fetched via &lt;code&gt;relatedTo&lt;/code&gt; parameter in your &lt;code&gt;ElementsQuery&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;{% set tagId = craft.app.getRequest().getQueryParam('tagId') %}&#xA;{% set entries = craft&#xA;    .entries&#xA;    .section('faq')&#xA;    .relatedTo(tagId)&#xA;    .all() &#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This assumes you include the parameter &lt;code&gt;tagId&lt;/code&gt; when someone clicks on your Tag, and that represents the ID of your Tag&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% for tag in craft.tags.group(1).all() %}&#xA;    &amp;lt;a href=&quot;?tagId={{ tag.id }}&quot;&amp;gt;{{ tag.title }}&amp;lt;/a&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-13T12:48:31.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29805" PostTypeId="1" AcceptedAnswerId="29806" CreationDate="2019-03-13T13:36:59.183" Score="1" ViewCount="115" Body="&lt;p&gt;Currently trying to use the new Donations feature of Commerce 2 - &lt;a href=&quot;https://docs.craftcms.com/commerce/v2/donations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/donations.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order goes through fine and I can see the donation purchasable in the order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can't do though is get it to assign the status of &lt;code&gt;Donation&lt;/code&gt; to the donation/order. It currently comes through as a &lt;code&gt;New&lt;/code&gt; status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is extremely handy to break apart Orders from Donations and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set the donation status as default to all donations, or somehow assigning the status to the donation via the form when the payment is processed? &lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-03-13T13:49:02.913" Title="Donation Status Commerce 2" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;&lt;donations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29806" PostTypeId="2" ParentId="29805" CreationDate="2019-03-13T13:49:02.913" Score="2" Body="&lt;p&gt;Donations are like anything else, and can be bought along side regular products so they are a part of normal orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the event below to inspect the order and choose youre own default status if you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\events\DefaultOrderStatusEvent;&#xA;use craft\commerce\services\OrderStatuses;&#xA;use yii\base\Event;&#xA;&#xA;Event::on(OrderStatuses::class, OrderStatuses::EVENT_DEFAULT_ORDER_STATUS, function(DefaultOrderStatusEvent $e) {&#xA; // Do something - perhaps figure out a better default order statues than the one set in CP&#xA; // $e-&amp;gt;order&#xA; // $e-&amp;gt;orderStatus (the order status to set as the default for this order)&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-03-13T13:49:02.913" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29807" PostTypeId="1" CreationDate="2019-03-13T16:18:33.437" Score="1" ViewCount="89" Body="&lt;p&gt;Saving an entry with multiple parentheses (in a redactor field) throw a 403. I know it's from ModSecurity - but never experienced that behaviors with another CMS (WP, Kirby, etc.) or with Craft2. This issue appears on 2 (different) projects in development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone got something similar?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Field details:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Clean up HTML : checked&lt;/li&gt;&#xA;&lt;li&gt;Purify HTML : checked&lt;/li&gt;&#xA;&lt;li&gt;HTML Purifier Config : Default&lt;/li&gt;&#xA;&lt;li&gt;Column Type : 64KB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS. If I remove the &lt;code&gt;()&lt;/code&gt; from the text or replace them with brackets &lt;code&gt;[]&lt;/code&gt;, the entry saved correctly. We experienced that issue on multiple computers from different offices and didn't reproduce it on local environment (MAMP or XAMP) - so it's not machine/location oriented.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PPS. Deactivate ModSecurity is not a solution&lt;/p&gt;&#xA;" OwnerUserId="9256" LastEditorUserId="57" LastEditDate="2019-03-13T22:08:59.367" LastActivityDate="2019-04-12T23:02:45.550" Title="Saving an entry with multiple parentheses throw a 403" Tags="&lt;craft3&gt;&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29808" PostTypeId="2" ParentId="29802" CreationDate="2019-03-13T16:24:13.477" Score="2" Body="&lt;p&gt;You might not have MAMP's PHP set as your CLI PHP. &lt;a href=&quot;https://craftcms.com/guides/mamp-with-composer-and-mysql-on-the-command-line&quot; rel=&quot;nofollow noreferrer&quot;&gt;Have a look at this guide&lt;/a&gt; and see if it gets you further&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-13T16:24:13.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29809" PostTypeId="2" ParentId="29802" CreationDate="2019-03-13T17:27:12.747" Score="1" Body="&lt;p&gt;Try with &lt;code&gt;php craft ..&lt;/code&gt; instead of &lt;code&gt;./craft ...&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9256" LastActivityDate="2019-03-13T17:27:12.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29810" PostTypeId="1" AcceptedAnswerId="29814" CreationDate="2019-03-13T17:54:49.150" Score="1" ViewCount="105" Body="&lt;p&gt;I'm using Solspace Calendar for Craft and I'm currently trying to implement the edit event form. Once a user selects an event on the calendar they are taken to the event page. On this page I have the edit event form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fields in this form will be added to the event entry once submitted. The issue I'm having is getting the form to submit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;                    {{ csrfInput() }}&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;calendar/events/save-event&quot; /&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ (siteUrl~&quot;availability/event/{id}&quot;)|hash }}&quot; /&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;eventId&quot; value=&quot;{{ event.id }}&quot; /&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;slug&quot; value=&quot;{{ event.slug }}&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the demo documentation, the two fields I'm not too sure about is the 'action' and 'redirect' fields. I have changed the redirect field to match the current event page. But I don't know what needs to go into the 'action' field. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently as you can see, it's 'calendar/events/save-event'. Is this a demo template I have missed. Does this need to be changed to something more specific. Any help much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7841" LastActivityDate="2019-03-13T20:59:03.120" Title="Solspace Calendar Event Editing" Tags="&lt;craft3&gt;&lt;events&gt;&lt;solspace&gt;&lt;plugin-solspacecalendar&gt;&lt;editing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29811" PostTypeId="2" ParentId="29694" CreationDate="2019-03-13T18:38:58.340" Score="1" Body="&lt;p&gt;I've found that this &lt;em&gt;is&lt;/em&gt; possible for lightswitch fields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;craft.entries.myLightswitchField(':empty:')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;aka&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;craft.entries({&#xA;    myLightswitchField: ':empty:'&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns all entries where the lightswitch field is toggled off &lt;em&gt;and&lt;/em&gt; entries that don't have the lightswitch field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not a solution for my text field need, but similar enough that it may be useful for other people.&lt;/p&gt;&#xA;" OwnerUserId="5072" LastActivityDate="2019-03-13T18:38:58.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29812" PostTypeId="1" CreationDate="2019-03-13T20:38:40.517" Score="1" ViewCount="629" Body="&lt;p&gt;Following the Minjingo CraftQuest tutorial, I am getting an error on the front end when I access any routes other than the root/home page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my template folder, I have a structure that looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;templates/&#xA;├── index.twig&#xA;├── about/&#xA;│   └── _entry.twig&#xA;├── drinks/&#xA;│   └── _entry.twig&#xA;└── news/&#xA;    └── _entry.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my about section settings, my template is &lt;code&gt;about/_entry&lt;/code&gt;, as it is in the tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error I get is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;HTTP 404 – Not Found – yii\web\NotFoundHttpException&#xA;Template not found: about&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe I missed a step? What should I look for?&lt;/p&gt;&#xA;" OwnerUserId="9418" LastEditorUserId="9418" LastEditDate="2019-03-13T21:33:33.830" LastActivityDate="2019-03-14T16:41:27.820" Title="404 – Not Found from _entry.twig templates in subdirectories" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29813" PostTypeId="2" ParentId="29812" CreationDate="2019-03-13T20:41:52.143" Score="1" Body="&lt;p&gt;Templates or folder with an underscore are private and can't be accessed via template routing. Remove the &lt;code&gt;_&lt;/code&gt; and you are fine. For example &lt;code&gt;news/entry&lt;/code&gt; instead of &lt;code&gt;news/_entry&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-13T20:41:52.143" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="29814" PostTypeId="2" ParentId="29810" CreationDate="2019-03-13T20:59:03.120" Score="2" Body="&lt;p&gt;You'll want to make sure you include all of the Calendar field inputs in order for this to work. If you're trying to hide them for your workflow, you can set the fields to hidden, or wrap them in a &lt;code&gt;div&lt;/code&gt; and hide them with CSS. :)&lt;/p&gt;&#xA;" OwnerUserId="4496" LastActivityDate="2019-03-13T20:59:03.120" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29815" PostTypeId="2" ParentId="29807" CreationDate="2019-03-13T22:10:33.953" Score="1" Body="&lt;p&gt;If you check the ModSecurity logs, you can find exactly which of its rules Redactor/that POST request is tripping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either modify that rule to allow it to pass or just disabled that specific rule.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-13T22:10:33.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29816" PostTypeId="2" ParentId="29812" CreationDate="2019-03-13T22:18:50.990" Score="1" Body="&lt;p&gt;I haven't seen the video but just reading you I think that he may be using a layout file in the tutorial and use the &lt;code&gt;_templates&lt;/code&gt; as includes. So inside a master template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% include &quot;about/_entry&quot; %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or... if you have &lt;code&gt;index.twig&lt;/code&gt; with:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;&#xA;&amp;lt;html lang=&quot;en&quot;&amp;gt;&#xA;&amp;lt;head&amp;gt;&#xA;    ...&#xA;&amp;lt;/head&amp;gt;&#xA;&amp;lt;body&amp;gt;&#xA;    &amp;lt;h1&amp;gt;Your site&amp;lt;/h1&amp;gt;&#xA;    {% block content %}&#xA;        &amp;lt;p&amp;gt;You shouldn't see me&amp;lt;/p&amp;gt;&#xA;    {% endblock %}&#xA;&amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And &lt;code&gt;about/_entry.twig&lt;/code&gt; with:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% block content %}&#xA;    Hello or {{entry.title}} if you have content in there&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would work also... I may also be reading you completely wrong :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-03-13T22:48:18.897" LastActivityDate="2019-03-13T22:48:18.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29817" PostTypeId="1" CreationDate="2019-03-14T03:27:24.317" Score="1" ViewCount="41" Body="&lt;p&gt;What's given:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Channel: Nutrition&#xA;Entries Fieldtype: restaurant&#xA;Category Fieldtype : menu&#xA;&#xA;Category: Menu&#xA;&#xA;Channel: Menus that also use relations using restaurant field.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each item in the nutrition channel has restaurant and menu category selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a restaurant's menu page I'm trying to list menu items from the nutrition channel grouped by categories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I use the following snippet&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            {% for category in craft.categories.group('menu').all() %}&#xA;                &amp;lt;h3 id=&quot;{{ category.slug }}&quot;&amp;gt;{{ category.title }}&amp;lt;/h2&amp;gt;&#xA;                &amp;lt;ul class=&quot;menu-items&quot;&amp;gt;&#xA;                    {% for entry in craft.entries.section('nutrition').relatedTo(category).orderBy('title').all() %}&#xA;                        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;                    {% endfor %}&#xA;                &amp;lt;/ul&amp;gt;&#xA;            {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works fine. However if I add more nutrition items and assign them to another restaurant they'll be listed as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume we need to define restaurant first&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set restaurant = craft.entries.section('restaurant').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but what are my next steps?&lt;/p&gt;&#xA;" OwnerUserId="720" LastActivityDate="2019-03-15T14:28:11.340" Title="Relations and Categories" Tags="&lt;categories&gt;&lt;relations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29818" PostTypeId="2" ParentId="29356" CreationDate="2019-03-14T06:08:00.460" Score="1" Body="&lt;p&gt;Instead of wrestling with artifacts and that whole approach I simply created a private repo on github, then set up a local satis that pulls in from that repo and then serves it to the installs as a composer repository when running &lt;code&gt;composer update&lt;/code&gt;. Works like a charm.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2019-03-14T06:08:00.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29819" PostTypeId="1" CreationDate="2019-03-14T06:10:12.497" Score="1" ViewCount="83" Body="&lt;p&gt;Is it possible to update private repo plugins from the admin at all? Would love that functionality, especially for smaller projects that are installed where there's no CLI access.&lt;/p&gt;&#xA;" OwnerUserId="4918" LastActivityDate="2021-04-03T02:01:55.193" Title="Updating private repo plugins from admin?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;admin&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29820" PostTypeId="1" CreationDate="2019-03-14T08:55:12.810" Score="1" ViewCount="78" Body="&lt;p&gt;It isn't currently clear how licences work with dev, staging and live environments or to be clearer how it works with different domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following domains setup for different environments.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Local: name.test&lt;/li&gt;&#xA;&lt;li&gt;Staging: sub.domain.co.uk&lt;/li&gt;&#xA;&lt;li&gt;Preproduction: domain.co.uk&lt;/li&gt;&#xA;&lt;li&gt;Production: livedomain.com&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But this can't be configured on the Craft ID site as far as I'm aware? This also results in Licence Errors across staging and preproduction environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution to what I'm describing?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-14T09:38:05.383" Title="Craft Licensing and Multiple Environments on Different Domains" Tags="&lt;craft3&gt;&lt;license&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29821" PostTypeId="2" ParentId="18290" CreationDate="2019-03-14T09:08:55.433" Score="1" Body="&lt;p&gt;A little bit late to the party, but I recently came across &lt;a href=&quot;https://medium.com/@drifter/the-power-of-t-in-craft-3-b4bc3489edc4&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; on the power of &lt;code&gt;t()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In it he does a bit of magic like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 'We are {n,spellout} in line' | t({n: 138}) }} &#xA;en-US =&amp;gt; We are one hundred thirty-eight&#xA;hu-HU =&amp;gt; Százharmincnyolc vagyunk&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="968" LastActivityDate="2019-03-14T09:08:55.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29822" PostTypeId="2" ParentId="29820" CreationDate="2019-03-14T09:38:05.383" Score="1" Body="&lt;p&gt;There's a &lt;a href=&quot;https://craftcms.com/guides/how-craft-license-enforcement-works#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;guide to how licensing is enforced&lt;/a&gt; :)&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-14T09:38:05.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29823" PostTypeId="1" AcceptedAnswerId="30315" CreationDate="2019-03-14T10:38:29.103" Score="2" ViewCount="229" Body="&lt;p&gt;I have added the &quot;file&quot; option in my Standard.json file for Redactor.&#xA;Wehn using the Redactor field then I can click on the file button and select the image ok.&#xA;When I view source the file is linked to fine in the html.&#xA;But when I save the entry and go back to view it - the link is stripped out - it just displays: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;a&amp;gt;link text&amp;lt;/a&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried disabling Clean Up HTML and Purify HTML on the field options and saving again but still have the same problem - the link is being stripped out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have a similiar issue?&lt;/p&gt;&#xA;" OwnerUserId="622" LastActivityDate="2019-05-06T15:32:25.617" Title="Redactor - can't link to files" Tags="&lt;redactor&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29824" PostTypeId="1" CreationDate="2019-03-14T14:10:31.107" Score="0" ViewCount="46" Body="&lt;p&gt;In the assets area when wanting to edit an image (focus point etc), the server hangs after double clicking an asset. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you checkmark an asset and then select Edit Image, set the focal point and click save, the website hangs as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are using Forge and hosting images on Digital Ocean Spaces. We are also using the imageOptimize plugin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is happening locally as well as on our staging server. Restarting the server is the only way to access craft again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where would we start looking to resolve this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below image illustrates how our image volumes are set up. The settings are defined in the .env.php file and given aliases in the general.php config file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y6yCQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y6yCQ.png&quot; alt=&quot;image volume&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="5257" LastEditDate="2019-03-15T15:04:48.207" LastActivityDate="2020-09-29T22:47:22.567" Title="Editing Images in Craft Cause Server to Hang" Tags="&lt;craft3&gt;&lt;plugin-imageoptimize&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29825" PostTypeId="2" ParentId="29812" CreationDate="2019-03-14T16:09:52.133" Score="0" Body="&lt;p&gt;I problem was that I missed the part where the slug for the About Craft Coffee entry was changed. In video 26, Creating a Structure Section, at 2:58, the slug &lt;code&gt;about-crafty-coffee&lt;/code&gt; was changed to just &lt;code&gt;about&lt;/code&gt;. He did it real quick, and I had to go back and watch the whole video to notice that. I should have rewatched it sooner. So that's why my element routing was not working; there wasn't an entry that matched the slug, because I hadn't changed mine.&lt;/p&gt;&#xA;" OwnerUserId="9418" LastEditorUserId="9418" LastEditDate="2019-03-14T16:41:27.820" LastActivityDate="2019-03-14T16:41:27.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29826" PostTypeId="1" AcceptedAnswerId="29833" CreationDate="2019-03-14T17:13:05.703" Score="3" ViewCount="217" Body="&lt;p&gt;In Craft 2 you used to be able to do something like &lt;code&gt;{% set entries = craft.entries.section('something').locale('de') %}&lt;/code&gt; but &lt;code&gt;.locale()&lt;/code&gt; has been removed and there's nothing similar &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the docs&lt;/a&gt; that I see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware that the locale automatically gets included based on the url, and I'm aware that &quot;Locales&quot; have been replaced by &quot;Sites&quot;, but I want to force a query of entries from a specific locale on the one and only site I have regardless of what's in the URL. How can this be done?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2019-03-15T14:24:34.227" Title="How to query entries written in a specific locale? (Craft 3)" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;localization&gt;&lt;query&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29828" PostTypeId="1" CreationDate="2019-03-14T20:31:53.363" Score="1" ViewCount="144" Body="&lt;p&gt;Hi upon migrating my site from Craft 2 to 3 I'm getting errors like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Twig Runtime Error – Twig_Error_Runtime&#xA;Variable &quot;largeImage&quot; does not exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;largeImage&quot; refers to an image transform, this error happens with all image transforms where I've used an assets field to place a picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also whenever I have embedded a picture inside an editor, this doesn't show either and the URL that is written out is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; src=&quot;@baseUrl/images/image.png&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clearly, something has gone wrong for @baseUrl to appear there. I've checked my base URL settings and it is set to &quot;&lt;a href=&quot;http://localhost:8888&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://localhost:8888&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what else to try so any help would be much appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8331" LastEditorUserId="57" LastEditDate="2019-03-14T22:01:41.750" LastActivityDate="2019-03-15T20:05:01.950" Title="Images not showing after Craft 2 to 3 migration" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29830" PostTypeId="2" ParentId="29819" CreationDate="2019-03-14T21:44:09.390" Score="0" Body="&lt;p&gt;It's not currently possible. The CP update process involves interactions with the Craft web services and the Craft web services don't have any information about the private repository for your site.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-14T21:44:09.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29831" PostTypeId="2" ParentId="8271" CreationDate="2019-03-15T02:24:51.557" Score="2" Body="&lt;p&gt;You can also use the free &lt;a href=&quot;https://plugins.craftcms.com/retcon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retcon plugin&lt;/a&gt; to apply named or inline transforms at the template level, using Craft's native transforms or &lt;a href=&quot;https://plugins.craftcms.com/imager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imager&lt;/a&gt; if you have that installed as well. This isn't limited to Redactor fields, but any HTML at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples from the documentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | retconTransform( 'yourNamedTransform' ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.body | retconTransform( { width : 1024, height : 768, mode : 'fit' } ) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="22" LastActivityDate="2019-03-15T02:24:51.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29832" PostTypeId="1" CreationDate="2019-03-15T11:16:14.143" Score="1" ViewCount="97" Body="&lt;p&gt;I'm on Craft 3.1.17.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My multisite setup is using different domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm on a.com, I can Live Preview everything on b.com fine, except the homepage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the error &lt;code&gt;Access to XMLHttpRequest at 'b.com' from origin 'a.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add &lt;code&gt;Access-Control-Allow-Origin *&lt;/code&gt; to my Nginx config, none of the pages work and it complains about a duplicate value of (a.com, *).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Other questions I've browsed all suggest this has been fixed in Craft 3.1, and none of the docs indicate the I need to do anything to get this to work.&lt;/p&gt;&#xA;" OwnerUserId="4123" LastActivityDate="2019-03-15T11:16:14.143" Title="Multi site live preview not working on index page" Tags="&lt;multi-site&gt;&lt;live-preview&gt;&lt;nginx&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29833" PostTypeId="2" ParentId="29826" CreationDate="2019-03-15T14:24:34.227" Score="4" Body="&lt;p&gt;In Craft 3, you can't really have locales. If in Craft 2 you had multiple locales, that should have been automatically migrated to multiple sites (as now the site is always single locale)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, you now need to use &lt;code&gt;site&lt;/code&gt; or &lt;code&gt;siteId&lt;/code&gt; parameter &lt;a href=&quot;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#site&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#site&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2019-03-15T14:24:34.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29834" PostTypeId="2" ParentId="29817" CreationDate="2019-03-15T14:28:11.340" Score="1" Body="&lt;p&gt;The next step is that you would need to chain &lt;code&gt;.relatedTo(restaurant)&lt;/code&gt; to your existing &lt;code&gt;craft.entries()&lt;/code&gt; call&lt;/p&gt;&#xA;" OwnerUserId="1104" LastActivityDate="2019-03-15T14:28:11.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29835" PostTypeId="2" ParentId="29795" CreationDate="2019-03-15T15:31:25.437" Score="2" Body="&lt;p&gt;I'm assuming that &quot;welcome&quot; is also your page slug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could query the craft_elements_i18n table (pseudo code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$sql = &quot;select id from craft_elements_i18n where slug = 'welcome' limit 1&quot;&#xA;$result = get($sql);&#xA;$entry_id = $result['id'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then feed that into your function.&#xA;Replace 'welcome' with a read of the uri to make it dynamic.&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2019-03-15T15:31:25.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29836" PostTypeId="1" AcceptedAnswerId="29867" CreationDate="2019-03-15T16:32:33.267" Score="1" ViewCount="639" Body="&lt;p&gt;I'm currently trying to adjust the line items in a particular cart/order after an event is triggered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\commerce\Plugin as CommercePlugin;&#xA;&#xA;$this-&amp;gt;requirePostRequest();&#xA;$request = Craft::$app-&amp;gt;getRequest();&#xA;&#xA;$cart = CommercePlugin::getInstance()-&amp;gt;getCarts()-&amp;gt;getCart(true);&#xA;&#xA;$lineItem = CommercePlugin::getInstance()-&amp;gt;getLineItems()-&amp;gt;getLineItemById($cart-&amp;gt;lineItems[0]-&amp;gt;id);&#xA;&#xA;$lineItem-&amp;gt;price = 100.0000;&#xA;$lineItem-&amp;gt;salePrice = 100.0000;&#xA;$lineItem-&amp;gt;qty = 1;&#xA;$lineItem-&amp;gt;note = '';&#xA;&#xA;$cart-&amp;gt;addLineItem($lineItem);&#xA;&#xA;$cart-&amp;gt;email = $request-&amp;gt;getParam('orderEmail');&#xA;&#xA;if (!Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($cart)) {&#xA;   return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this seems to not do anything, except update &lt;code&gt;$lineItem&lt;/code&gt; and not update the line item when the cart is then saved.&lt;/p&gt;&#xA;" OwnerUserId="3807" LastEditorUserId="3807" LastEditDate="2019-03-19T11:09:08.820" LastActivityDate="2019-03-19T11:09:34.277" Title="Dynamically update line item in Commerce 2" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29837" PostTypeId="2" ParentId="29828" CreationDate="2019-03-15T20:05:01.950" Score="1" Body="&lt;p&gt;I did manage to fix this problem with some support, however I now have a few other problems as a cause of this and I think it is best to try and start a fresh post on it. I had to change the baseUrl which fixed the error but now have broken images across the website and duplicate folders in my assets. Argghh.&lt;/p&gt;&#xA;" OwnerUserId="8331" LastActivityDate="2019-03-15T20:05:01.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29838" PostTypeId="1" CreationDate="2019-03-15T20:40:03.843" Score="1" ViewCount="76" Body="&lt;p&gt;I’m runnung a few Craft sites with Redis cache enabled. It works fine. Except that Craft only uses around 3mb of Redis memory, with peaks up to 5, while there’s 128mb available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to set the amount of memory Craft can use? I couldn’t find anything in the documentation.&lt;/p&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2019-03-18T05:10:33.123" Title="Redis cache memory usage" Tags="&lt;cache&gt;&lt;memory&gt;&lt;redis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29840" PostTypeId="1" AcceptedAnswerId="29841" CreationDate="2019-03-15T21:54:27.640" Score="1" ViewCount="431" Body="&lt;p&gt;I tried installing a site I developed on my work mac (high sierra), pushed to its repo, pulled it down at home on my mac (mojave)and on running composer update get this displayed in my terminal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Seems you have upgraded Yii Framework from version 2.0.15.1 to 2.0.16.1.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in the browser get this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PHP Warning – yii\base\ErrorException&#xA;Declaration of craft\web\twig\Environment::compileSource(Twig_Source $source) should be compatible with Twig\Environment::compileSource(Twig\Source $source)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried deleting the vendor folder and running composer install but get the same, however when I delete all database tables and allow craft to reinstall it's fine (albeit no content!!!) I have no idea how to resolve this, any tips appreciated!&lt;/p&gt;&#xA;" OwnerUserId="2187" LastEditorUserId="45" LastEditDate="2019-03-15T22:14:45.427" LastActivityDate="2019-03-15T22:16:13.470" Title="upgrade issue Yii Framework from version 2.0.15.1 to 2.0.16.1" Tags="&lt;composer&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29841" PostTypeId="2" ParentId="29840" CreationDate="2019-03-15T22:16:13.470" Score="1" Body="&lt;p&gt;Not sure about the Yii message, though it may be irrelevant. The Twig message refers to an issue where Twig itself was upgraded (to 2.7.2) which broke Craft. The makers of Craft were able to publish an fix within 48 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update to the latest version of Craft, this has already been fixed.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-03-15T22:16:13.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29842" PostTypeId="1" CreationDate="2019-03-15T23:43:09.990" Score="1" ViewCount="423" Body="&lt;p&gt;So I have the following in my Composer file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ],&#xA;    &quot;post-update-cmd&quot;: [&#xA;      &quot;@php craft migrate/all&quot;,&#xA;      &quot;@php craft project-config/sync&quot;,&#xA;      &quot;@php craft clear-caches/compiled-templates&quot;,&#xA;      &quot;@php craft clear-caches/cp-resources&quot;,&#xA;      &quot;@php craft clear-caches/data&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-frontendtemplate-caches&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-metabundle-caches&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-sitemap-caches&quot;,&#xA;      &quot;@php craft clear-caches/temp-files&quot;,&#xA;      &quot;@php craft clear-caches/template-caches&quot;&#xA;    ],&#xA;    &quot;post-install-cmd&quot;: [&#xA;      &quot;@php craft migrate/all&quot;,&#xA;      &quot;@php craft project-config/sync&quot;,&#xA;      &quot;@php craft clear-caches/compiled-templates&quot;,&#xA;      &quot;@php craft clear-caches/cp-resources&quot;,&#xA;      &quot;@php craft clear-caches/data&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-frontendtemplate-caches&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-metabundle-caches&quot;,&#xA;      &quot;@php craft clear-caches/seomatic-sitemap-caches&quot;,&#xA;      &quot;@php craft clear-caches/temp-files&quot;,&#xA;      &quot;@php craft clear-caches/template-caches&quot;&#xA;    ]&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and on my deployment (deployHQ) I have the following SSH command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd %path% &#xA;composer install&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, sync changes (project-config/sync) doesn't take effect and each time I have to manually click the button.&#xA;Any ideas what I am missing in the process?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2019-03-15T23:43:09.990" Title="Auto trigger craft project-config/sync on deployment" Tags="&lt;craft3&gt;&lt;deployment&gt;&lt;cli&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29843" PostTypeId="1" AcceptedAnswerId="29844" CreationDate="2019-03-16T10:32:15.037" Score="1" ViewCount="136" Body="&lt;p&gt;We would like to have a 'translators' user group, where the members can edit only the 'translatable' fields, but not the non translatable things (images, categories etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;May be i missed something, but giving users permission to edit a specific site lets them edit all attributes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way (permission/plugin/code snippet/best practice) to achieve that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking of writing a custom validation comparing old to new, or hiding/disabling fields via specific css.&lt;/p&gt;&#xA;" OwnerUserId="8315" LastActivityDate="2019-03-16T15:48:26.827" Title="Restrict a users permission to only edit 'translatable' fields on a specific site?" Tags="&lt;localization&gt;&lt;permissions&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29844" PostTypeId="2" ParentId="29843" CreationDate="2019-03-16T12:52:48.127" Score="1" Body="&lt;p&gt;Of course you can just remove the fields via CSS/JS but you could as well remove those fields from the visible layout from the beginning&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Craft::$app-&amp;gt;getView()-&amp;gt;hook(&#xA;/**&#xA; * @param array $context&#xA; */&#xA;    'cp.entries.edit',&#xA;    function(array &amp;amp;$context) {&#xA;        /** @var Section $section */&#xA;        $section = $context['section'];&#xA;&#xA;        /** @var \craft\models\EntryType $entryType */&#xA;        $entryType = $context['entryType'];&#xA;&#xA;        /** @var Entry $entry */&#xA;        $entry = $context['entry'];&#xA;        /**&#xA;         * Array of field handles you want to remove&#xA;         */&#xA;        $fieldsYouWantToRemove = [&#xA;            'relation',&#xA;            'tag',&#xA;            'category'&#xA;        ];&#xA;&#xA;        // include certain conditions you like, either by registering custom permissions and do&#xA;        // Craft::$app-&amp;gt;getUser()-&amp;gt;checkPermission('myFancyPermission');&#xA;        // or just search for the current users groups&#xA;        // Craft::$app-&amp;gt;getUser()-&amp;gt;getIdentity()-&amp;gt;getGroups();&#xA;        if($entry-&amp;gt;siteId === 4 &amp;amp;&amp;amp; $section-&amp;gt;handle === 'insertYourSectionHandle' &amp;amp;&amp;amp; $entryType-&amp;gt;handle === 'yourEntryTypeHandle'){&#xA;            // grab all the fields in the layout&#xA;            foreach ($entryType-&amp;gt;getFieldLayout()-&amp;gt;getTabs() as $tab){&#xA;                /** @var \craft\base\Field[] $fields */&#xA;                $fields = $tab-&amp;gt;getFields();&#xA;                foreach ($fields as $key =&amp;gt; $field){&#xA;                    // check if the fields handle is forbidden&#xA;                    if(in_array($field-&amp;gt;handle, $fieldsYouWantToRemove, true) === true){&#xA;                        // remove the field&#xA;                        unset($fields[$key]);&#xA;                    }&#xA;                }&#xA;                // set the fields back&#xA;                $tab-&amp;gt;setFields($fields);&#xA;            }    &#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;'cp.entries.edit'&lt;/code&gt; is a hook that enables you to manipulate all variables in the given context, so you check if the entry has a certain type and is in a certain section and remove all the fields from the tabs that you don't want to show.&lt;/p&gt;&#xA;&lt;p&gt;You can &lt;a href=&quot;https://docs.craftcms.com/v3/extend/user-permissions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;register custom permissions&lt;/a&gt; for each field, for each site or you can even use events to check if the content has changed if you really want to make sure they didn't manipulate the HTML&lt;/p&gt;&#xA;&lt;h3&gt;edit&lt;/h3&gt;&#xA;&lt;p&gt;You can as well check for the translation setting in the field&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;if($field-&amp;gt;translationMethod === Field::TRANSLATION_METHOD_SITE){&#xA;    unset($fields[$key]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;if($field-&amp;gt;translationMethod !== Field::TRANSLATION_METHOD_NONE){&#xA;    unset($fields[$key]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Whatever you need&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="-1" LastEditDate="2020-06-17T08:56:27.903" LastActivityDate="2019-03-16T15:48:26.827" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29846" PostTypeId="1" AcceptedAnswerId="29849" CreationDate="2019-03-17T11:05:12.743" Score="1" ViewCount="689" Body="&lt;p&gt;I've now tried installing Craft on multiple PCs to run a local dev environment, but keep getting the same problem. It installs fine, the System Report shows all green,  but when I first load the Dashboard I get the message &quot;An unknown error has occurred&quot; and it fails to fetch Craft News items or updates, and then on the Plugin Store it states &quot;The Plugin Store is not available, please try again later.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried playing around with my Apache setup, but honestly I'm not particularly knowledgeable in that area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All PCs have been running Windows 10, the latest version of WAMP server, PHP 7.2, and &quot;latest&quot; version of Craft (though it's now two installs behind, which is why I know the updates aren't working despite stating that I'm &quot;up to date&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Live version of the site is working perfectly after upload via FTP, and I've tried reinstalling several times.&lt;/p&gt;&#xA;" OwnerUserId="9508" LastActivityDate="2019-03-17T15:08:45.323" Title="Localhost can't connect to plugin store or updates (WAMP Server)" Tags="&lt;apache&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29847" PostTypeId="1" AcceptedAnswerId="29850" CreationDate="2019-03-17T13:41:26.333" Score="1" ViewCount="279" Body="&lt;p&gt;I have two Craft websites running locally and they both have broken css on the backend due to the error below. Every time I update it is temporarily fixed but after a few clicks or refreshes it's back again. I've checked the permissions but the problem seems to be the location of the file. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: File to import not found or unreadable: ../../../../../lib/craftcms-sass/mixins&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When opening the dashboard.scss I can see the path is incorrect but I'm very unsure what the proper path should be, and whether I should manually change it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a known problem? I hope someone here can help me out!&lt;/p&gt;&#xA;" OwnerUserId="6836" LastActivityDate="2019-03-17T16:00:50.637" Title="Error: File to import not found or unreadable: ../../../../../lib/craftcms-sass/mixins" Tags="&lt;permissions&gt;&lt;css&gt;&lt;files&gt;&lt;filesystem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29848" PostTypeId="1" AcceptedAnswerId="29861" CreationDate="2019-03-17T14:32:05.067" Score="2" ViewCount="476" Body="&lt;p&gt;In general what is the best practice to handle invoices from orders made in Craft Commerce ?&lt;/p&gt;&#xA;" OwnerUserId="6561" LastActivityDate="2019-03-18T19:22:24.640" Title="Craft commerce and invoices" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29849" PostTypeId="2" ParentId="29846" CreationDate="2019-03-17T15:08:45.323" Score="1" Body="&lt;p&gt;You need to &lt;a href=&quot;https://curl.haxx.se/docs/caextract.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;download the CA certificate for curl&lt;/a&gt; and add it to your &lt;code&gt;php.ini&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-17T15:08:45.323" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29850" PostTypeId="2" ParentId="29847" CreationDate="2019-03-17T16:00:50.637" Score="1" Body="&lt;p&gt;Okay, so it turns out my file watcher (WebStorm) was the cause.&#xA;It compiled the dashboard.scss, so I simply changed the Scope to make sure it only compiled my own files.&lt;/p&gt;&#xA;" OwnerUserId="6836" LastActivityDate="2019-03-17T16:00:50.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29851" PostTypeId="1" AcceptedAnswerId="33405" CreationDate="2019-03-18T03:08:49.113" Score="2" ViewCount="813" Body="&lt;p&gt;&lt;strong&gt;Is it possible to configure Craft 3 to store session data in the database?&lt;/strong&gt; On some other CMS's this can be enabled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I'm exploring this is because we're having an issue whereby PHP sessions get &quot;locked up&quot; due to a long-running request that forces all other PHP requests under the same session to be queued up until the prior ones complete (until the session files are written and released from their lock). This isn't ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is a common one amongst PHP apps that use file-based sessions. This article explains it in-depth:&lt;br&gt;&#xA;&lt;a href=&quot;https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen &lt;a href=&quot;https://github.com/imarc/craft-dbsessions&quot; rel=&quot;nofollow noreferrer&quot;&gt;this plugin&lt;/a&gt; which appears to support DB sessions in Craft 2, but haven't come across anything for v3.&lt;/p&gt;&#xA;" OwnerUserId="5437" LastActivityDate="2020-03-09T03:47:50.813" Title="How can I store Craft sessions in the database?" Tags="&lt;session&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29852" PostTypeId="2" ParentId="29838" CreationDate="2019-03-18T05:10:33.123" Score="1" Body="&lt;p&gt;You don't mention if it's Crat 2 or Craft 3, but I'm not seeing anything in either codebase where Craft (or Yii) would limit the amount of memory available in its caching classes.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-18T05:10:33.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29854" PostTypeId="2" ParentId="29851" CreationDate="2019-03-18T06:23:01.190" Score="1" Body="&lt;p&gt;Yes it is. Yii2 provides a &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-web-dbsession&quot; rel=&quot;nofollow noreferrer&quot;&gt;DB Session&lt;/a&gt; for it that extends the normal session and stores the values in your database instead. But you need to attach Crafts &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/behaviors/SessionBehavior.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;SessionBehavior&lt;/a&gt; and maybe make it compatible with it &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-03-18T06:30:30.567" LastActivityDate="2019-03-18T06:30:30.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29855" PostTypeId="1" AcceptedAnswerId="29857" CreationDate="2019-03-18T10:52:47.460" Score="1" ViewCount="1043" Body="&lt;p&gt;We have previously used the &lt;code&gt;Schematic&lt;/code&gt; plugin for database import inside a &lt;code&gt;Docker&lt;/code&gt; container for a Python script. This is the command used for the importing, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$/data/craft/craft schematic/export --file=schema.yml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;/data/craft/craft&lt;/code&gt; means we run the command inside the preceding folder and the command itself is &lt;code&gt;schematic/export --file=schema.yml&lt;/code&gt;. The file &lt;code&gt;schema.yml&lt;/code&gt; has the database definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you import and export the databases using the Craft 3.1.x?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we use the &lt;code&gt;Craft 3.1&lt;/code&gt; which doesn't work with the &lt;code&gt;Schematic&lt;/code&gt;.  I have this project config file after we upgraded to the &lt;code&gt;Craft 3&lt;/code&gt;, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dateModified: 1552904208&#xA;plugins:&#xA;  aws-s3:&#xA;    edition: standard&#xA;    enabled: true&#xA;    schemaVersion: '1.2'&#xA;  redactor:&#xA;    edition: standard&#xA;    enabled: true&#xA;    schemaVersion: 2.2.2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9481" LastActivityDate="2019-03-18T11:09:56.253" Title="How do I import database using the CMS Craft 3" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;database&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29856" PostTypeId="1" CreationDate="2019-03-18T11:00:34.787" Score="1" ViewCount="182" Body="&lt;p&gt;I would like to exclude some of my entries, via my own validation inside the &lt;code&gt;Transformer&lt;/code&gt;, from the api output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a possibility to move on to the next Entry without outputing anything? Right now im just returning an empty array, but i think it would be cleaner to return nothing.&lt;/p&gt;&#xA;" OwnerUserId="8219" LastActivityDate="2019-03-18T13:10:01.103" Title="Element API: Is it possible to ignore/skip an Entry?" Tags="&lt;craft3&gt;&lt;plugin-elementapi&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29857" PostTypeId="2" ParentId="29855" CreationDate="2019-03-18T11:09:56.253" Score="2" Body="&lt;p&gt;For syncing your database in Craft 3 you can use the &lt;a href=&quot;https://docs.craftcms.com/v3/project-config.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Project Config&lt;/a&gt; please read the instructions in the link how to use it and what it does&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Once that’s enabled, Craft will start storing the project config in a config/project.yaml file. Any time something changes that is managed by the project config, that file will get updated to match. And any time Craft detects that project.yaml has been updated on its own (e.g. if it was changed in a Git commit that was recently pulled down), any changes in it will be propagated to the local Craft install.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So store the file in your directory and Craft will do the rest&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-18T11:09:56.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29858" PostTypeId="2" ParentId="29856" CreationDate="2019-03-18T13:10:01.103" Score="1" Body="&lt;p&gt;Couldn't you modify the criteria to exclude that entry ?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id =&amp;gt; &quot;not X&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3524" LastActivityDate="2019-03-18T13:10:01.103" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29859" PostTypeId="1" CreationDate="2019-03-18T13:51:35.820" Score="1" ViewCount="23" Body="&lt;p&gt;Is there a way to exclude a User Group from a sale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a trade user account that applies a flat 20% discount across all products but we're trying to run a different sale for all customers on a few products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is any customer within the trade user group is getting the flat 20% discount and the further 25% on these specific products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="9498" LastActivityDate="2019-03-18T13:51:35.820" Title="Exclude User Group from Sale" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29861" PostTypeId="2" ParentId="29848" CreationDate="2019-03-18T19:22:24.640" Score="2" Body="&lt;p&gt;You can provide a link to download a PDF version of the invoice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set the path to your invoice template in the Commerce General Settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to provide a frontend link to download the PDF use &lt;code&gt;{{ order.getPdfUrl() }}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2019-03-18T19:22:24.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29863" PostTypeId="2" ParentId="27393" CreationDate="2019-03-18T21:35:07.877" Score="2" Body="&lt;p&gt;Currently, you unfortunately can't query all sites within your entires, you will have to separate your results out with a for-loop by site, as @aran did above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3.2 will thankfully fix this by allowing you to pass sites to an array or query sites('*') to return entries from all your sites:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/cms/commit/d01702278bd84b84392e11da72aa4d0b6f4f0943&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/commit/d01702278bd84b84392e11da72aa4d0b6f4f0943&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9511" LastActivityDate="2019-03-18T21:35:07.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29866" PostTypeId="2" ParentId="29710" CreationDate="2019-03-19T09:49:39.430" Score="0" Body="&lt;p&gt;It seems this is actually already solved from 3.0.13 &lt;a href=&quot;https://github.com/craftcms/cms/issues/2500&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/2500&lt;/a&gt; and onwards, but the reason it did not work was because of how the webserver was configured (nginx, apache).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By directing requests for these type of files to index.php instead Craft will handle generating the files should they be missing.&lt;/p&gt;&#xA;" OwnerUserId="9089" LastActivityDate="2019-03-19T09:49:39.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29867" PostTypeId="2" ParentId="29836" CreationDate="2019-03-19T11:09:34.277" Score="2" Body="&lt;p&gt;Turns out I just replace:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$cart-&amp;gt;addLineItem($lineItem);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CommercePlugin::getInstance()-&amp;gt;getLineItems()-&amp;gt;saveLineItem($lineItem, false);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-03-19T11:09:34.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29868" PostTypeId="2" ParentId="15165" CreationDate="2019-03-19T11:53:49.837" Score="2" Body="&lt;p&gt;For reference, the Craft 3 version of &lt;code&gt;setContentFromPost&lt;/code&gt; is &lt;code&gt;setFieldValuesFromRequest&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can so things like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$order-&amp;gt;setFieldValue(&quot;customFieldHandle&quot;, &quot;My value&quot;);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-elementinterface.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/api/v3/craft-base-elementinterface.html#public-methods&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3807" LastActivityDate="2019-03-19T11:53:49.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29869" PostTypeId="1" CreationDate="2019-03-19T13:21:26.077" Score="1" ViewCount="45" Body="&lt;p&gt;I have two asset (image) fields in project entry type, both with the same setting and with different outputs… Anyone knows why? Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My fields are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;intro image field&lt;/li&gt;&#xA;&lt;li&gt;gallery image field&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both should save uploaded images into one folder named by project and it's two levels category:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;projects/{category.one().slug}/{category.inReverse().one().slug}/{slug}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My categories might look like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;accommodation&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;hotels&lt;/li&gt;&#xA;&lt;li&gt;hostels&lt;/li&gt;&#xA;&lt;li&gt;apartements&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;bussiness&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;offices&lt;/li&gt;&#xA;&lt;li&gt;stores&lt;/li&gt;&#xA;&lt;li&gt;fastfood&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So both image fields should be saved to one folder, example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;projects/accommodation/hotels/project_slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But they usually ends in two separate folders:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;projects/accomodations/hotels/project_slug (intro image)&#xA;projects/hotels/hotels/project_slug (gallery field)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what is the problem and why the dynamic field folder structure varies from field to field?&lt;/p&gt;&#xA;" OwnerUserId="4733" LastActivityDate="2019-03-19T13:21:26.077" Title="Asset field - saving assets with dynamic subfolder by categories not working consistently" Tags="&lt;assets&gt;&lt;field&gt;&lt;bug&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29871" PostTypeId="1" CreationDate="2019-03-19T15:18:54.660" Score="1" ViewCount="1916" Body="&lt;pre&gt;&lt;code&gt;Internal Server Error&#xA;Unexpected token &quot;name&quot; of value &quot;name&quot; (&quot;end of statement block&quot; expected).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Getting this error on my commerce/products template.  What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% extends 'shop/_layouts/main' %}&#xA;{% block main %}&#xA;&#xA;{% for product in craft.commerce.products.limit(5).find() %}&#xA;    &amp;lt;div class=&quot;row product&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;two columns&quot;&amp;gt;&#xA;          {% include &quot;shop/_images/product&quot; with { class: 'u-max-full-width' } %}&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;ten columns&quot;&amp;gt;&#xA;            &amp;lt;h5&amp;gt;{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}&amp;lt;/h5&amp;gt;&#xA;&#xA;&#xA;            {% if product.variants|length %}&#xA;                &amp;lt;form method=&quot;POST&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;commerce/cart/updateCart&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;shop/cart&quot;&amp;gt;&#xA;                    &amp;lt;input type=&quot;hidden&quot; name=&quot;qty&quot; value=&quot;1&quot;&amp;gt;&#xA;                    {{ getCsrfInput() }}&#xA;&#xA;                    &amp;lt;select name=&quot;purchasableId&quot; class=&quot;purchasableId&quot;&amp;gt;&#xA;                        {%- for purchasable in product.variants -%}&#xA;                            &amp;lt;option {% if purchasable.stock &amp;lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %}&#xA;                                    data-info=&quot;product-{{ product.id }}-purchasable-{{ purchasable.id }}&quot;&#xA;                                    value=&quot;{{ purchasable.purchasableId }}&quot;&amp;gt;&#xA;                                    {{ purchasable.description }} {{ purchasable.salePrice|commerceCurrency(cart.currency) }}&#xA;                            &amp;lt;/option&amp;gt;&#xA;                        {%- endfor -%}&#xA;                    &amp;lt;/select&amp;gt;&#xA;&#xA;                    {% if product.unlimitedStock or (product.unlimitedStock == false and product.totalStock &amp;gt; 0 ) %}&#xA;                  &amp;lt;button type=&quot;submit&quot;&amp;gt;{{ &quot;Add to cart&quot;|t }}&amp;lt;/button&amp;gt;&#xA;                    {% else %}&#xA;                        {{ &quot;Out of Stock&quot;|t }}&#xA;                    {% endif %}&#xA;                &amp;lt;/form&amp;gt;&#xA;&#xA;                {% if currentUser %}&#xA;                {% set order = craft.commerce&#xA;                &amp;lt;select name=&quot;options[giftWrapped]&quot;&amp;gt;&#xA;                  &amp;lt;option value=&quot;no&quot;&amp;gt;No gift wrap.&amp;lt;/option&amp;gt;&#xA;                  &amp;lt;option value=&quot;yes&quot;&amp;gt;Gift wrapped.&amp;lt;/option&amp;gt;&#xA;                &amp;lt;/select&amp;gt;&#xA;          .orders.user(currentUser).hasPurchasables(product.defaultVariant).find() %}&#xA;          {% if order|length %} &amp;lt;strong&amp;gt;I already own this product: &amp;lt;/strong&amp;gt; &amp;lt;a href=&quot;customer/order?orderNumber={{ order[0].number }}&quot;&amp;gt;Order #{{ order[0].shortNumber }}&amp;lt;/a&amp;gt;&#xA;                {% endif %}&#xA;                {% endif %}&#xA;&#xA;                {%- for purchasable in product.variants -%}&#xA;                    &amp;lt;div id=&quot;product-{{ product.id }}-purchasable-{{ purchasable.id }}&quot; class=&quot;purchasableInfo&quot; style=&quot;display:none;&quot;&amp;gt;&#xA;                        &amp;lt;strong&amp;gt;Regular Price: &amp;lt;/strong&amp;gt;&amp;lt;strike&amp;gt;{{ purchasable.price|commerceCurrency(cart.currency) }}&amp;lt;/strike&amp;gt;&amp;lt;br&amp;gt;&#xA;                        &amp;lt;strong&amp;gt;Now: &amp;lt;/strong&amp;gt;{{ purchasable.salePrice|commerceCurrency(cart.currency) }}&amp;lt;br&amp;gt;&#xA;                        {% if purchasable.salesApplied %}&amp;lt;strong&amp;gt;Sales Applied:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;{% endif %}&#xA;                        &amp;lt;ul&amp;gt;&#xA;                            {% for sale in purchasable.salesApplied  %}&#xA;                            &amp;lt;li&amp;gt;&amp;lt;strong&amp;gt;{{ sale.name }}&amp;lt;/strong&amp;gt; {{ sale.description }}&amp;lt;/li&amp;gt;&#xA;                            {% endfor %}&#xA;                        &amp;lt;/ul&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                {%- endfor -%}&#xA;&#xA;            {% endif %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;{% includejs %}&#xA;    $( &quot;.purchasableId&quot; ).change(function(e) {&#xA;        $(&quot;.purchasableInfo&quot;).hide();&#xA;        $(&quot;#&quot;+($(this).find(&quot;:selected&quot;).data('info'))).toggle();&#xA;    });&#xA;{% endincludejs %}&#xA;{% endblock %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9515" LastActivityDate="2019-03-19T15:48:29.733" Title="Unexpected token &quot;name&quot; of value &quot;name&quot; (&quot;end of statement block&quot; expected)" Tags="&lt;plugin-craftcommerce&gt;&lt;ecommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29872" PostTypeId="1" AcceptedAnswerId="29876" CreationDate="2019-03-19T15:45:43.860" Score="3" ViewCount="53" Body="&lt;p&gt;I have a multi site setup and a front facing entry form, which saves entries always to the same site (and not the current one which is weird). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to define to which site the current entry should be saved? Something in the lines of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ csrfInput() }}&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;entries/save-entry&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;sectionId&quot; value=&quot;1&quot;&amp;gt;&#xA;&amp;lt;input type=&quot;hidden&quot; name=&quot;site&quot; value=&quot;{{ currentSite.id }}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5884" LastActivityDate="2019-03-19T16:30:44.643" Title="How to save entry to the current site from the front end?" Tags="&lt;multi-site&gt;&lt;entry-form&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29873" PostTypeId="1" AcceptedAnswerId="29877" CreationDate="2019-03-19T15:47:47.347" Score="1" ViewCount="86" Body="&lt;p&gt;I have 2 Matrix fields in an entry type, both of which use Dropdown fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Matrix: urls&#xA;    address (block type)&#xA;        context (dropdown field values include 'own')&#xA;        address&#xA;        urn&#xA;&#xA;Matrix: logos&#xA;   svg (block type)&#xA;        usage (dropdown field values include 'monoNeg')&#xA;        aspectRatio&#xA;        svg (source code)&#xA;   img (block type)&#xA;        usage (equivalent dropdown field)&#xA;        img&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Entries are assigned to a &lt;code&gt;footer&lt;/code&gt; Globals field, from which I'm pairing a &lt;strong&gt;urls&lt;/strong&gt; value with a &lt;strong&gt;logos&lt;/strong&gt; value in a loop to write linked logos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the relevant URL easily enough with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for org in footer.footerAccreditations %}&#xA;    {% set orgUrl = org.urls.context('own').one() %}&#xA;    {{ orgUrl.address }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which prints the &lt;code&gt;address&lt;/code&gt; URL just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the same approach for the &lt;code&gt;svg&lt;/code&gt; logo isn't working. Either one of the following returns &lt;code&gt;0&lt;/code&gt;, even when I know for sure that the &lt;code&gt;org&lt;/code&gt; entry in question has a &lt;code&gt;monoNeg&lt;/code&gt; SVG source.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set negLogoDirect = org.logos.usage('monoNeg').one() %}&#xA;{{ negLogoDirect|length }}&#xA;&#xA;{% set negLogoTyped = org.logos.type('svg').usage('monoNeg').one() %}&#xA;{{ negLogoTyped|length }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I run through an &lt;code&gt;all&lt;/code&gt; loop for the logos their &lt;code&gt;usage&lt;/code&gt; reports exactly as I would expect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set orgLogos = org.logos.all() %}&#xA;&#xA;{% for logo in orgLogos %}&#xA;    {{ logo.usage }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume I can make my template more verbose and get what I need, but I don't see why the same approach should work for one Matrix dropdown field and not for another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="3507" LastEditorUserId="3507" LastEditDate="2019-03-19T15:54:39.360" LastActivityDate="2019-03-19T16:31:43.650" Title="Craft 3: fetching a single Matrix row by its dropdown field value" Tags="&lt;matrix&gt;&lt;drop-down&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29874" PostTypeId="2" ParentId="29871" CreationDate="2019-03-19T15:48:29.733" Score="1" Body="&lt;p&gt;This line is incomplete:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set order = craft.commerce&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="167" LastActivityDate="2019-03-19T15:48:29.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29875" PostTypeId="2" ParentId="27811" CreationDate="2019-03-19T16:15:46.717" Score="1" Body="&lt;p&gt;You could try fronting Blob with &lt;a href=&quot;https://github.com/gaul/s3proxy&quot; rel=&quot;nofollow noreferrer&quot;&gt;s3proxy&lt;/a&gt; as a workaround.&lt;/p&gt;&#xA;" OwnerUserId="9516" LastActivityDate="2019-03-19T16:15:46.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29876" PostTypeId="2" ParentId="29872" CreationDate="2019-03-19T16:30:44.643" Score="4" Body="&lt;p&gt;The parameter is called &lt;code&gt;siteId&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;siteId&quot; value=&quot;{{ currentSite.id }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-19T16:30:44.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29877" PostTypeId="2" ParentId="29873" CreationDate="2019-03-19T16:31:43.650" Score="2" Body="&lt;p&gt;That is most likely happening because &lt;code&gt;usage&lt;/code&gt; is ambiguous for your &lt;code&gt;logos&lt;/code&gt; field, so Craft isn’t sure which column to assign the condition to. If you give the &lt;code&gt;usage&lt;/code&gt; field within your &lt;code&gt;img&lt;/code&gt; block type a different handle, you should get reliable results.&lt;/p&gt;&#xA;" OwnerUserId="9" LastActivityDate="2019-03-19T16:31:43.650" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29878" PostTypeId="1" CreationDate="2019-03-19T16:32:09.823" Score="0" ViewCount="273" Body="&lt;p&gt;When I upload a JPG image through Assets, the image quality is terrible. I dont mean a slight difference for web optimisation, but I mean REALLY bad! See screenshot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't find any helpful about this issue which is strange. A few other posts mention the issue with image transforms, but this is not an image transform, its just the main image uploaded. Opening the image direct on the server shows this bad image so the original is clearly processed. I would not want our images processed if it affects quality (we optimise images ourselves). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not done much at all really, no plugins/modules added yet, just a basic template and a few text and asset fields. Its just to demonstrate Craft to a customer at the moment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have many CMSs on this server, like Wordpress and other Craft 2 installs, and we don't get this issue with other systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have GD installed, I would prefer to keep that and not use ImageMagick, shouldn't have to use any image processing for just image upload should I? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, if I open the original image on my computer and do a screenshot and create a new image from that, then upload that new image, it does not have such bad quality, it looks OK. So maybe its something inside the image. But the images are already used on another website (Wordpress) fine. I was hoping I can just import the images into Craft and not have to do any manual processing first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photoshop shows the image as RGB colour at 8 bits.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;GD Spec from in Craft PHP Info:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;GD Support  enabled&#xA;GD Version  bundled (2.1.0 compatible)&#xA;FreeType Support    enabled&#xA;FreeType Linkage    with freetype&#xA;FreeType Version    2.4.11&#xA;GIF Read Support    enabled&#xA;GIF Create Support  enabled&#xA;JPEG Support    enabled&#xA;libJPEG Version 6b&#xA;PNG Support enabled&#xA;libPNG Version  1.5.13&#xA;WBMP Support    enabled&#xA;XPM Support enabled&#xA;libXpm Version  30411&#xA;XBM Support enabled&#xA;WebP Support    enabled&#xA;gd.jpeg_ignore_warning  0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lKEmj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lKEmj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update July 24th 2019&lt;/strong&gt;: Issue now gone, see comment below for further info. &lt;/p&gt;&#xA;" OwnerUserId="4993" LastEditorUserId="4993" LastEditDate="2019-07-24T21:41:26.223" LastActivityDate="2019-07-24T21:41:26.223" Title="Assets uploaded image quality is terrible" Tags="&lt;craft3&gt;&lt;assets&gt;&lt;image&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29879" PostTypeId="1" AcceptedAnswerId="29880" CreationDate="2019-03-19T16:42:00.137" Score="1" ViewCount="90" Body="&lt;p&gt;How do I display the featured image on a Commerce product:  &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;figure&amp;gt;&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;img src=&quot;{{ entry.featuredImage[0].getUrl('medium') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;&amp;lt;/figure&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9515" LastEditorUserId="5557" LastEditDate="2019-03-19T16:43:42.833" LastActivityDate="2019-03-19T16:45:16.587" Title="How to display the featured image on a Commerce product:" Tags="&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29880" PostTypeId="2" ParentId="29879" CreationDate="2019-03-19T16:45:16.587" Score="1" Body="&lt;p&gt;A good approach is always to check if the element even has a related asset or not, otherwhise you'll receive exceptions.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% set asset = entry.featuredImage.one() %}&#xA;{% if asset is not null %}&#xA;    &amp;lt;figure&amp;gt;&#xA;        &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ asset.getUrl('medium') }}&quot; alt=&quot;&quot;&amp;gt;&#xA;        &amp;lt;/a&amp;gt;&#xA;    &amp;lt;/figure&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-19T16:45:16.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29881" PostTypeId="1" AcceptedAnswerId="29883" CreationDate="2019-03-19T21:10:57.433" Score="1" ViewCount="340" Body="&lt;p&gt;I was looking for a way to show all fields/properties of a given object, and came across this useful tidbit: &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2926/how-to-display-all-fields-belonging-to-current-entry&quot;&gt;How to display all fields belonging to current entry?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to Craft/Twig and didn't actually know what type of object I'm trying to output properties of. I'm not sure when I output the object with &lt;code&gt;{{ mysteryObject }}&lt;/code&gt; it outputs a number. That doesn't seem useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do the loop like in the &lt;a href=&quot;https://craftcms.stackexchange.com/questions/2926/how-to-display-all-fields-belonging-to-current-entry&quot;&gt;question I referenced above&lt;/a&gt; like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for prop in mysteryObject.getFields() %}&#xA;        {# get the field Model from the fieldId #}&#xA;        {% set field = craft.fields.getFieldById(mysteryObject.fieldId) %}&#xA;        {# print the field handle and the field content  #}&#xA;        {{ field.handle }}&#xA;        :&#xA;        {{ entry.getContent()[field.handle] }}&#xA;    {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Calling unknown method: craft\elements\MatrixBlock::getFields()&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Cool, so now I know my object is a &lt;code&gt;MatrixBlock&lt;/code&gt;, but this makes me wonder how I would go about inspecting the properties of just any object, like you can in JavaScript, without knowing what the object is.&lt;/p&gt;&#xA;" OwnerUserId="9418" LastActivityDate="2020-04-01T06:09:04.793" Title="Display all fields without knowing object type?" Tags="&lt;templating&gt;&lt;craft3&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29882" PostTypeId="1" AcceptedAnswerId="29886" CreationDate="2019-03-19T21:38:44.857" Score="2" ViewCount="135" Body="&lt;p&gt;My customer will have lots of sections and lots of entries in each, for each site. Over time they will add new language sites. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a new site is added, there are no sections or entries for it. So we have to then edit each section to set the URL format and template, even though they will be the same for each site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to make it as easy and quick for the customer to add new sites. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there a way I can automatically set these values, enable the site, and propagate entries, for every section (or even certain sections), every time they create a new Site? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c4hs7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4hs7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-03-20T11:04:54.643" Title="Is there a way to auto-create a sections Site Settings and propagate when a new site is created?" Tags="&lt;localization&gt;&lt;sites&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29883" PostTypeId="2" ParentId="29881" CreationDate="2019-03-19T21:48:23.890" Score="2" Body="&lt;p&gt;You can&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&#xA;{{ dump(myObject) }}&#xA;&amp;lt;/pre&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And see it's type and attributes. You can as well use &lt;code&gt;{{ dump(Object.getAttributes) }}&lt;/code&gt; with nearly everything in Yii2. If it's just about getting to know what object you currently have this function will be your friend once you know how to use it. Another approach would be much simpler yet more powerful: take a look at the source code or enable intellisense for your IDE and let your IDE show you everything &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="10669" LastEditDate="2020-04-01T06:09:04.793" LastActivityDate="2020-04-01T06:09:04.793" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29886" PostTypeId="2" ParentId="29882" CreationDate="2019-03-20T11:04:54.643" Score="3" Body="&lt;p&gt;You can use the &lt;code&gt;EVENT_AFTER_SAVE_SITE&lt;/code&gt; event to create/update the new section settings&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;Event::on(&#xA;    Sites::class,&#xA;    Sites::EVENT_AFTER_SAVE_SITE,&#xA;    function (SiteEvent $event) {&#xA;        if ($event-&amp;gt;isNew) {&#xA;&#xA;            ProjectConfigHelper::ensureAllSitesProcessed();&#xA;            $siteId = $event-&amp;gt;site-&amp;gt;id;&#xA;&#xA;            // array of sections you want to propagate&#xA;            $sectionsToActivate = [&#xA;                'test',&#xA;            ];&#xA;&#xA;            foreach ($sectionsToActivate as $sectionHandle){&#xA;&#xA;                $section = Craft::$app-&amp;gt;getSections()-&amp;gt;getSectionByHandle($sectionHandle);&#xA;                if($section !== null){&#xA;                    /** @var \craft\models\Section_SiteSettings[] $siteSettings */&#xA;                    $siteSettings = $section-&amp;gt;getSiteSettings();&#xA;&#xA;                    // the site you want to clone from&#xA;                    $siteSettings[$siteId] = clone $siteSettings[1]; &#xA;                    $siteSettings[$siteId]-&amp;gt;id = null;&#xA;                    $siteSettings[$siteId]-&amp;gt;siteId = $siteId;&#xA;&#xA;                    // eventually you want to change some other settings ¯\_(ツ)_/¯&#xA;                    //$siteSettings[$siteId]-&amp;gt;template = '';&#xA;                    //$siteSettings[$siteId]-&amp;gt;uriFormat = '';&#xA;                    //$siteSettings[$siteId]-&amp;gt;hasUrls = '';&#xA;&#xA;                    $section-&amp;gt;setSiteSettings($siteSettings);&#xA;                   Craft::$app-&amp;gt;getSections()-&amp;gt;saveSection($section);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: As soon as you create a new site, you'll loop all sections you want to activate and grab their &quot;main&quot; site settings, copy them and set the &lt;code&gt;id&lt;/code&gt; to null in order to create a new record&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-20T11:04:54.643" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29887" PostTypeId="1" AcceptedAnswerId="29894" CreationDate="2019-03-20T11:30:19.160" Score="1" ViewCount="260" Body="&lt;p&gt;I need to loop related entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a SuperTable field with the handle &quot;related&quot; with an entry field with the handle &quot;contentEntry&quot; and two text fields for alternative text and descriptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;contentEntry&quot; field is limited to two entries being selected. The issue I'm having is that the following code repeats the first entry twice and doesn't loop and display the second. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# Related Entry #}&#xA;&#xA;{% set relatedEntries = block.related.all %}&#xA;{% set relatedEntry = block.related.contentEntry.all() %}&#xA;{% set relatedAltDesc = block.related.altDescription %}&#xA;{% set relatedAltTitle = block.related.altTitle %}&#xA;&#xA;&#xA;{% if relatedEntries %}&#xA;&#xA;&amp;lt;div class=&quot;{{ padding }} {{ fontsize }}&quot; id=&quot;{{ blockID }}&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;{{ margin }}&quot;&amp;gt;&#xA;&#xA;            {% for entries in relatedEntries %}&#xA;&#xA;              {% for rel in relatedEntry %}&#xA;&#xA;                {% if relatedAltTitle %}&#xA;                  {{ relatedAltTitle }}&#xA;                {% else %}&#xA;                  {{ rel.title }}&#xA;                {% endif %}&#xA;&#xA;&#xA;                {% if relatedAltDesc %}&#xA;                  {{ relatedAltDesc }}&#xA;                {% else %}&#xA;                  {{ rel.previewDescription }}&#xA;                {% endif %}&#xA;&#xA;              {% endfor %}&#xA;&#xA;            {% endfor %}&#xA;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jEZ66.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jEZ66.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-21T09:23:39.330" Title="Looping Related Entries with a Super Table" Tags="&lt;templating&gt;&lt;forloop&gt;&lt;plugin-supertable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29888" PostTypeId="1" CreationDate="2019-03-20T13:12:06.230" Score="1" ViewCount="160" Body="&lt;p&gt;We are building a multi-site set up in Craft. We will have a lot of &quot;microsites&quot; for different locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a site group called &quot;Microsites&quot; and I would like the home page for each of these sites to load a template inside /templates/microsites/index.twig&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to create individual folders in the template folder for each site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I'll provide overview of the site setup&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I will have over 100 different sites on here representing a location. We have a Locations channel on the main site that will hold the data we will query in the Microsite template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each microsite will have its own base URL like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@web/san-francisco&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so whenever that page is loaded, I want it to go into /templates/microsite/_index.twig &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every single microsite home page will use that same template and have the data be loaded dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we can't just use Channel entries is because we will need localized blogs for them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm going about this all wrong?&lt;/p&gt;&#xA;" OwnerUserId="9518" LastEditorUserId="9518" LastEditDate="2019-03-20T19:10:23.277" LastActivityDate="2019-04-03T10:37:03.013" Title="Template for Site Group rather than site handle" Tags="&lt;multi-site&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29889" PostTypeId="1" CreationDate="2019-03-20T14:31:30.773" Score="1" ViewCount="61" Body="&lt;p&gt;I have been staring at this all morning, comparing to other plugins online and cannot see why my plugin settings page never registers. I have verified the actual settings model is populated, but settingsHtml() is never called.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything obvious I have missed?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Storefront extends Plugin&#xA;{&#xA;    public static $plugin;&#xA;    public $schemaVersion = '1.0.1';&#xA;    public $hasCpSettings = true;&#xA;    public function init()&#xA;    {&#xA;        parent::init();&#xA;        self::$plugin = $this;&#xA;&#xA;       $this-&amp;gt;setComponents([&#xA;        'tracking' =&amp;gt; TrackingService::class,&#xA;       ]);&#xA;&#xA;        Event::on(&#xA;            Plugins::class,&#xA;            Plugins::EVENT_AFTER_INSTALL_PLUGIN,&#xA;            function (PluginEvent $event) {&#xA;                if ($event-&amp;gt;plugin === $this) {&#xA;                }&#xA;            }&#xA;        );&#xA;&#xA;        Craft::info(&#xA;            Craft::t(&#xA;                'storefront',&#xA;                '{name} plugin loaded',&#xA;                ['name' =&amp;gt; $this-&amp;gt;name]&#xA;            ),&#xA;            __METHOD__&#xA;        );&#xA;    }&#xA;    public function hasCpSection()&#xA;    {&#xA;        return false;&#xA;    }&#xA;    public function hasSettings()&#xA;    {&#xA;        return true;&#xA;    }&#xA;    protected function createSettingsModel()&#xA;    {&#xA;        return new Settings();&#xA;    }&#xA;&#xA;    protected function settingsHtml(): string&#xA;    {&#xA;        return Craft::$app-&amp;gt;view-&amp;gt;renderTemplate('storefront/settings',&#xA;            [&#xA;            'settings' =&amp;gt; $this-&amp;gt;getSettings()&#xA;            ]&#xA;        );&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9519" LastActivityDate="2019-03-20T14:44:27.510" Title="My plugin settings page is never loaded" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;settings&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29890" PostTypeId="2" ParentId="29889" CreationDate="2019-03-20T14:44:27.510" Score="1" Body="&lt;p&gt;I overlooked the settings in composer.json to enable a settings page.&lt;/p&gt;&#xA;" OwnerUserId="9519" LastActivityDate="2019-03-20T14:44:27.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29891" PostTypeId="1" AcceptedAnswerId="29895" CreationDate="2019-03-20T15:05:52.947" Score="2" ViewCount="42" Body="&lt;p&gt;When working on a plugin recently, I decided to add a CP section:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;composer.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    ...&#xA;    &quot;extra&quot;:&#xA;        ...&#xA;        &quot;hasCpSection&quot;: true&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only way that I was able to have this change reflected in Craft was to uninstall/reinstall the plugin. Is there an alternate way (e.g. CLI) to do so?&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2019-03-20T19:29:11.137" Title="Possible to reflect changes to a plugin's composer.json without uninstall/reinstall?" Tags="&lt;plugin-development&gt;&lt;composer&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29892" PostTypeId="2" ParentId="26397" CreationDate="2019-03-20T15:16:09.913" Score="2" Body="&lt;p&gt;To get this to work, have a look at the format of the &lt;code&gt;general.php&lt;/code&gt; config file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is to include the &lt;code&gt;'*'=&amp;gt;[]&lt;/code&gt; at the start.&lt;/p&gt;&#xA;" OwnerUserId="9520" LastActivityDate="2019-03-20T15:16:09.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29894" PostTypeId="2" ParentId="29887" CreationDate="2019-03-20T19:19:05.823" Score="2" Body="&lt;p&gt;The issue is: you don't really loop your entries at all.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{# get all super table rows #}&#xA;{% set superTableRows = block.related.all %}&#xA;&#xA;{% if superTableRows is not empty %}&#xA;    &amp;lt;div class=&quot;{{ padding }} {{ fontsize }}&quot; id=&quot;{{ blockID }}&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;{{ margin }}&quot;&amp;gt;&#xA;&#xA;            {# loop all of your super tables #}&#xA;            {% for row in superTableRows %}&#xA;&#xA;                {# loop all contentEntries in each row #}&#xA;                {% for entry in row.contentEntry.all() %}&#xA;&#xA;                    {# &#xA;                        display the alternative title set in your supertablerow &#xA;                        and if thats not set display the entries title&#xA;                    #}&#xA;                    {{ row.altTitle?? entry.title }}&#xA;&#xA;                    {# same as above #}&#xA;                    {{ row.altDescription ?? entry.previewDescription }}&#xA;&#xA;                {% endfor %}&#xA;            {% endfor %}&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;block.related&lt;/code&gt; is an Object of type &lt;code&gt;ElementQuery&lt;/code&gt;. &lt;code&gt;block.related.altDescription&lt;/code&gt; returns the criteria of this Query, this is mostly empty since no criteria is set by default. &lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-03-21T09:23:39.330" LastActivityDate="2019-03-21T09:23:39.330" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29895" PostTypeId="2" ParentId="29891" CreationDate="2019-03-20T19:29:11.137" Score="2" Body="&lt;p&gt;You can uninstall the plugin via CLI but I guess that's not really what you are after. The only other way is to change the auto generated config file in &lt;code&gt;vendor/craftcms/plugins.php&lt;/code&gt; and change the parameter for your plugin there. But you can't ever change this attribute for others that downloaded your plugin remotely without doing things you should not do.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-20T19:29:11.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29896" PostTypeId="1" AcceptedAnswerId="29897" CreationDate="2019-03-20T22:13:53.820" Score="1" ViewCount="29" Body="&lt;p&gt;I am new to craft and twig and need some help showing only added entries to matrix block. What I have now is showing all entries from the section. I may be going about this all wrong, I don't know. I have 11 entries but only want to show the 6 I have added to the block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9T44n.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9T44n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BJ70j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJ70j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    {% for block in entry.sessionsContent.all() %}&#xA;&#xA;{% switch block.type %}&#xA;&#xA;    {% case &quot;sessionsHeader&quot; %}&#xA;    &amp;lt;section class=&quot;small-header&quot; style=&quot;background-image: url({{ siteUrl }}/images/background-images{{ block.backgroundImage.one().getUrl() }});&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;small-header-title&quot;&amp;gt;&#xA;            &amp;lt;h1&amp;gt;{{ block.headerTitle }}&amp;lt;/h1&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/section&amp;gt;&#xA;&#xA;    {% case &quot;sessionsIntro&quot; %}&#xA;    &amp;lt;div class=&quot;sessions-intro&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;intro-title&quot;&amp;gt;&#xA;                &amp;lt;h2&amp;gt;{{ block.introTitle }}&amp;lt;/h2&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;intro-description&quot;&amp;gt;&#xA;                &amp;lt;p&amp;gt;{{ block.introDescription }}&amp;lt;/p&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case &quot;sideBlock&quot; %}&#xA;    {% if block.isWhiteBackground %}&#xA;        {% set divColor = 'white-background' %}&#xA;    {% endif %}&#xA;    {% if block.isBlockOnTheRight %}&#xA;        {% set divPosition = 'float-right' %}&#xA;    {% endif %}&#xA;    &amp;lt;div class=&quot;side-block&quot; style=&quot;background-image: url({{ siteUrl }}/images/background-images{{ block.blockBackgroundImage.one().getUrl() }})&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;standard_wrapper {{divPosition}} {{divColor}}&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;inner&quot;&amp;gt;&#xA;                &amp;lt;div class=&quot;block-title&quot;&amp;gt;&amp;lt;h2&amp;gt;{{ block.blockTitle }}&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;block-teaser&quot;&amp;gt;&amp;lt;p&amp;gt;{{ block.blockTeaser }}&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&quot;block-description&quot;&amp;gt;&#xA;                    &amp;lt;p&amp;gt;{{ block.blockDescription }}&amp;lt;/p&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;&#xA;    {% case &quot;backgroundImageDivider&quot; %}&#xA;    &amp;lt;div class=&quot;divider&quot; style=&quot;background-image: url({{ siteUrl }}/images/background-images{{ block.backgroundImage.one().getUrl() }});&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;standard-wrapper&quot;&amp;gt;&#xA;        &amp;lt;h2 class=&quot;divider-title&quot;&amp;gt;{{ block.dividerTitle }}&amp;lt;/h2&amp;gt;&#xA;        &amp;lt;div class=&quot;divider-description&quot;&amp;gt;{{ block.dividerDescription }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;button-block&quot;&amp;gt;{{ block.button }}&amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% case &quot;blockTiles&quot; %}&#xA;    &amp;lt;div class=&quot;block-inner&quot;&amp;gt;&#xA;    {% for entry in craft.entries.section('sessionTiles').all() %}&#xA;    &amp;lt;div class=&quot;sessions-block&quot;&amp;gt;&#xA;            &amp;lt;img src=&quot;{{ siteUrl }}/images/session-images{{ entry.sessionTileImage.one().getUrl() }}&quot; /&amp;gt;&#xA;            &amp;lt;div class=&quot;inner-text&quot;&amp;gt;&#xA;                &amp;lt;h5 class=&quot;sessions-title&quot;&amp;gt;{{ entry.sessionTileTitle }}&amp;lt;/h5&amp;gt;&#xA;                &amp;lt;div class=&quot;sessions-description&quot;&amp;gt;{{ entry.sessionTileDescription }}&amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    {% endfor %}&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    {% default %}&#xA;&#xA;{% endswitch %}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9495" LastActivityDate="2019-03-21T07:40:47.303" Title="Entries Field Type showing all entries instead of entries selected" Tags="&lt;entries&gt;&lt;matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29897" PostTypeId="2" ParentId="29896" CreationDate="2019-03-21T07:40:47.303" Score="1" Body="&lt;p&gt;You need to use the &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter&quot; rel=&quot;nofollow noreferrer&quot;&gt;relatedTo&lt;/a&gt; parameter&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% for entry in craft.entries.relatedTo(block).section('sessionTiles').all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even more simple the &lt;a href=&quot;https://docs.craftcms.com/v3/relations.html#getting-target-elements-via-the-source-element&quot; rel=&quot;nofollow noreferrer&quot;&gt;short syntax&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% for sessionTile in block.blockTilesContent.all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-21T07:40:47.303" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29898" PostTypeId="1" CreationDate="2019-03-21T10:24:34.077" Score="1" ViewCount="350" Body="&lt;p&gt;I can't find it in the web folder or anywhere else, but its there when I visit the file in the browser.&lt;/p&gt;&#xA;" OwnerUserId="9523" LastActivityDate="2019-03-22T09:49:43.713" Title="Where can I find the robots.txt file in Craft 3?" Tags="&lt;craft3&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29899" PostTypeId="1" CreationDate="2019-03-21T11:22:12.127" Score="1" ViewCount="94" Body="&lt;p&gt;I've manage to install Craft CMS with command line, I've the message &quot;installed craft successfully&quot; so I guess it worked, plus my database has been completely populated.&#xA;But then, how do we access the CMS lol ?&#xA;I've installed it at localhost/craftcms/ but then I don't know where I have to go to use the tool.&#xA;I use wamp ( on Windows of course).&#xA;Thanks for all, and sorry for my question that I'm sure is stupid but I can't find an answer&lt;/p&gt;&#xA;" OwnerUserId="9525" LastActivityDate="2019-03-22T21:54:56.820" Title="How to use Craft CMS?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29900" PostTypeId="2" ParentId="29899" CreationDate="2019-03-21T13:22:16.803" Score="1" Body="&lt;p&gt;The default URL to access Craft is &lt;code&gt;/admin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also this can be changed to anything you like using the &lt;code&gt;cpTrigger&lt;/code&gt; &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#cptrigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;config variable&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-03-21T13:22:16.803" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29901" PostTypeId="1" AcceptedAnswerId="29904" CreationDate="2019-03-21T13:38:00.950" Score="1" ViewCount="79" Body="&lt;p&gt;I'm trying to set dynamic paths for values such as &lt;code&gt;activateAccountSuccessPath&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This kind of code below from my &lt;code&gt;routes.php&lt;/code&gt; file works very well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;use craft\elements\Entry;&#xA;&#xA;$myAccount = Entry::find()-&amp;gt;section('myAccount');&#xA;&#xA;return [&#xA;    $myAccount-&amp;gt;type('user')-&amp;gt;one()-&amp;gt;uri . '/&amp;lt;id&amp;gt;-&amp;lt;slug&amp;gt;' =&amp;gt; ['template' =&amp;gt; '_myAccount/user']&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it seems that &lt;code&gt;craft\elements\Entry&lt;/code&gt; can't be used at the top of &lt;code&gt;general.php&lt;/code&gt; (which make sense...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea of a simple workaround to load Entry data at this time? Like this, I could set dynamic paths depending of the context and language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could already set paths like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'activateAccountSuccessPath' =&amp;gt; array(&#xA;     'fr' =&amp;gt; 'mon-compte',&#xA;     'nl' =&amp;gt; 'mijn-account'&#xA;),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is not enough, I would like the path match dynamically another existing URI in a Structure.&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="131" LastEditDate="2019-03-21T13:44:55.987" LastActivityDate="2019-03-21T21:39:15.753" Title="How to load entries data in the General Configuration file?" Tags="&lt;url&gt;&lt;config&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29902" PostTypeId="1" AcceptedAnswerId="29903" CreationDate="2019-03-21T15:02:16.543" Score="1" ViewCount="592" Body="&lt;p&gt;I've used this tool to generate a module: &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pluginfactory.io/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my constructor, I have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {&#xA;            if (is_dir($baseDir = $this-&amp;gt;getBasePath().DIRECTORY_SEPARATOR.'templates')) {&#xA;                $e-&amp;gt;roots[$this-&amp;gt;id] = $baseDir;&#xA;            }&#xA;        });&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my init() function I have this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Event::on(&#xA;            Cp::class,&#xA;            Cp::EVENT_REGISTER_CP_NAV_ITEMS,&#xA;            function(RegisterCpNavItemsEvent $event) {&#xA;                $event-&amp;gt;navItems[] = [&#xA;                    'url' =&amp;gt; 'leads',&#xA;                    'label' =&amp;gt; 'Leads Management'&#xA;                ];&#xA;            }&#xA;        );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I click the link on the control panel, I will get a Template Not Found error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My template folder is located at &lt;code&gt;modules/leadsmodule/src/templates&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside templates I have a file called &lt;code&gt;leads.twig&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did die() on the &lt;code&gt;$baseDir&lt;/code&gt; that it's being set to in the constructor and got the path: &lt;code&gt;modules\leadsmodule\src\templates&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need my control panel item to load a specific template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: the control panel URI for my item looks like &lt;code&gt;/admin/leads&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my config/app.php&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'*' =&amp;gt; [&#xA;        'modules'   =&amp;gt; [&#xA;            'leads-module' =&amp;gt; [&#xA;                'class' =&amp;gt; \modules\leadsmodule\LeadsModule::class,&#xA;            ],&#xA;        ],&#xA;        'bootstrap' =&amp;gt; ['leads-module'],&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried every combination to load the template I can think of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In side my modules/leadmodule/src/templates I've placed the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;admin/leads-module/leads.twig&#xA;&#xA;admin/leadsmodule/leads.twig&#xA;&#xA;/admin/leads.twig&#xA;&#xA;/leads-module/admin/leads.twig&#xA;&#xA;/leads-module/leads.twig&#xA;&#xA;/leadsmodule/admin/leads.twig&#xA;&#xA;/leadsmodule/leads.twig&#xA;&#xA;/leads.twig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still get a 404 template not found: leads when accesses /admin/leads from the control panel&lt;/p&gt;&#xA;" OwnerUserId="9518" LastEditorUserId="9518" LastEditDate="2019-03-21T15:39:55.937" LastActivityDate="2019-03-21T15:39:55.937" Title="Modules - CP Template not found" Tags="&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29903" PostTypeId="2" ParentId="29902" CreationDate="2019-03-21T15:11:56.653" Score="2" Body="&lt;p&gt;It must be &lt;code&gt;/admin/module-id/leads&lt;/code&gt;. So in your case maybe &lt;code&gt;/admin/leadsmodule/leads&lt;/code&gt; or &lt;code&gt;/admin/leads-module/leads&lt;/code&gt; depending on your ID if you want to access it directly via template route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwhise you need to create custom URL rules&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-21T15:11:56.653" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29904" PostTypeId="2" ParentId="29901" CreationDate="2019-03-21T21:39:15.753" Score="3" Body="&lt;p&gt;When you take a look at the Docs you'll see&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;See &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-helpers-confighelper.html#method-localizedvalue&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft\helpers\ConfigHelper::localizedValue()&lt;/a&gt; for a list of supported value types.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And that contains&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;$value (mixed) – The config setting value. This can be specified in one of the following forms:&lt;/li&gt;&#xA;  &lt;li&gt;A scalar value or null: represents the desired value directly, and will be returned verbatim.&lt;/li&gt;&#xA;  &lt;li&gt;An associative array: represents the desired values across all sites, indexed by site handles. If a matching site handle isn’t listed, the first value will be returned.&lt;/li&gt;&#xA;  &lt;li&gt;A PHP callable: either an anonymous function or an array representing a class method ([$class or $object, $method]). The callable will be passed the site handle if known, and should return the desired config value.&lt;/li&gt;&#xA;  &lt;li&gt;$siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.&#xA;  Returns&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The interesting thing is &lt;code&gt;a function&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;'activateAccountSuccessPath' =&amp;gt; function(){&#xA;    return Entry::find()-&amp;gt;section('myAccount')..... // do your thing&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-21T21:39:15.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29905" PostTypeId="1" CreationDate="2019-03-22T05:02:41.260" Score="1" ViewCount="134" Body="&lt;p&gt;I'm at a loss here. Hopefully, someone here can shed some light into a Search Plus plugin and Algolia index population issue I'm having. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to add an item (page, blog post, product) to the item's respective index by editing the item but when I kick off the Search Plus index population process it quickly times out/fails. I have an index that literally has one item.  It populates the index when I edit it but the same item does not get added to the index when done via the Search Plus index population process. I'm skeptical that this is an Algolia API record size limit because I just described but I could be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do see the following errors in the Craft admin console:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2019-03-21 22:38:52&#xA;Level   error&#xA;Category    application&#xA;Message Encountered an error running task 2591 (SearchPlus_Population), step 1 of 2: Trying to get property of non-object on line 519 of /craft/plugins/searchplus/services/SearchPlus_AlgoliaService.php&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2019-03-21 22:38:52&#xA;Level   error&#xA;Category    php&#xA;Message Trying to get property of non-object (//craft/plugins/searchplus/services/SearchPlus_AlgoliaService.php:519)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft CMS 2.7.6 and Search Plus 1.5.2 on Nginx with PHP-FPM 7.1.  I checked the the Algolia credentials are correct. I have adjusted the Nginx configuration and PHP's timeout settings and max post size settings.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I reached out to the Search Plus developer and he replied once telling to adjust the PHP configuration and has been unresponsive since the initial exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, someone here can shed some light on this issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&#xA;Sal&lt;/p&gt;&#xA;" OwnerUserId="9413" LastActivityDate="2021-04-10T20:06:05.547" Title="Why is the Algolia index population process with Search Plus timing out?" Tags="&lt;plugin-searchplus&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29907" PostTypeId="1" AcceptedAnswerId="29908" CreationDate="2019-03-22T08:11:43.037" Score="1" ViewCount="127" Body="&lt;p&gt;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img{{ block.imageWidth|length ? ' width=&quot;' ~ block.imageWidth ~ 'px&quot;' }} /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If imageWidth is specified as 120, it should output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img width=&quot;120px&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However it is outputting this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;img width=&amp;amp;quot;120px&amp;amp;quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried using |raw but that doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9370" LastActivityDate="2019-03-22T08:34:55.920" Title="Output raw html from if statement and combining strings?" Tags="&lt;templating&gt;&lt;twigextension&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29908" PostTypeId="2" ParentId="29907" CreationDate="2019-03-22T08:34:55.920" Score="2" Body="&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{# set test variable, to make your code work #}&#xA;{% set block = {imageWidth: 300} %}&#xA;&#xA;{# the real output #}&#xA;&amp;lt;img{{ block.imageWidth|length ? (' width=&quot;' ~ block.imageWidth~ 'px&quot;')|raw }} /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Works for me&lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-22T08:34:55.920" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29909" PostTypeId="2" ParentId="29898" CreationDate="2019-03-22T09:49:43.713" Score="1" Body="&lt;p&gt;Ok, so my hosting provider Hyperlane overwrites the robots.txt as long as you visit the file on their address. The file should be in the web/ folder and will show up when you visit it with your domain. &lt;/p&gt;&#xA;" OwnerUserId="9523" LastActivityDate="2019-03-22T09:49:43.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29910" PostTypeId="1" AcceptedAnswerId="29966" CreationDate="2019-03-22T11:10:21.563" Score="1" ViewCount="178" Body="&lt;p&gt;First time using the Imager plugin and really unsure how to code it. Looking over the documentation I'm not clear on what the 'logo' is referring to to know what to change it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ watermark: { image: logo, width: 80, height: 80, position: { right: 30, bottom: 30 }, opacity: 0.8, blendMode: 'multiply' } }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/aelvan/Imager-Craft&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/aelvan/Imager-Craft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set imageWatermark = [{ watermark: { image: logo, width: 80, height: 80, position: { right: 30, bottom: 30 }, opacity: 0.8, blendMode: 'multiply' } }] %}&#xA;&#xA;{% set transformedImages = craft.imager.transformImage(image, imageWatermark) %}&#xA;&#xA;{# Output image #}&#xA;&amp;lt;img src=&quot;{{ asset.getUrl('transformedImages') }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3742" LastActivityDate="2019-03-28T20:43:04.500" Title="Imager plugin for watermarks" Tags="&lt;plugin-imager&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29911" PostTypeId="1" CreationDate="2019-03-22T11:25:40.637" Score="1" ViewCount="103" Body="&lt;p&gt;We are looking to place a contact form across all pages and want to integrate HubSpot. I noticed that there was the ability to match up the fields with HubSpot - which is great - my question is how do we pass through the current page's Title and URL the form is shown on? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of matching the field that or is it done a different way?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-22T14:25:20.140" Title="FreeForm and HubSpot - Current Page" Tags="&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29913" PostTypeId="2" ParentId="29911" CreationDate="2019-03-22T14:25:20.140" Score="1" Body="&lt;p&gt;It would be fairly easy to create a hidden field and read the page URL into it.&#xA;As for the title, is your form an embed inside the channel entries call? Then it's pretty easy to get the title as well. If not you may have to be a bit creative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the hidden field config, it even tells you how to pull in the current url.&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2019-03-22T14:25:20.140" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29914" PostTypeId="1" AcceptedAnswerId="29924" CreationDate="2019-03-22T14:52:27.983" Score="1" ViewCount="385" Body="&lt;p&gt;We want to use Memcached but are struggling to find Craft 3 specific config examples and documentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The docs mention several things that seem to lead to dead-ends: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/config/app.html#cache-component&quot; rel=&quot;nofollow noreferrer&quot;&gt;App config docs here&lt;/a&gt; show how to configure the component in config/app.php. But in terms of 'enabling' that component, the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#memcache&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs here&lt;/a&gt; say that &lt;code&gt;cacheMethod&lt;/code&gt; might need to be used, presumably in config/general.php, but the &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#cachemethod&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to cacheMethod&lt;/a&gt; goes nowhere. Also here in the &lt;a href=&quot;https://docs.craftcms.com/v3/changes-in-craft-3.html#config-settings&quot; rel=&quot;nofollow noreferrer&quot;&gt;changes in v3 article&lt;/a&gt;, is says that &lt;code&gt;cacheMethod&lt;/code&gt; has &quot;been removed entirely&quot; and instead point readers to &lt;a href=&quot;https://docs.craftcms.com/v3/config/#data-caching-config&quot; rel=&quot;nofollow noreferrer&quot;&gt;Configuration → Data Caching Config&lt;/a&gt; which is a missing section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of the server setup, Memcached is enabled and we have 2 nodes/hosts available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very confused, please help.&lt;/p&gt;&#xA;" OwnerUserId="8748" LastActivityDate="2019-03-26T10:36:40.440" Title="Help setting up Memcached in Craft 3" Tags="&lt;cache&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29916" PostTypeId="1" CreationDate="2019-03-22T16:09:57.827" Score="1" ViewCount="92" Body="&lt;p&gt;I have a simple plugin which reads in a CSV file, and based on the first row of data will create a new field group, and then create fields within that group. The first time I run it everything goes well. The group is created, and the fields are also all created. However, if I re-run it with a new field it will delete the field group. Does anyone have any thoughts on why this is? This is the code, below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This block checks if the desired group exists, and if not creates it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;protected function getFieldGroup($groupName) {&#xA;    $groups = Craft::$app-&amp;gt;fields-&amp;gt;getAllGroups();&#xA;    foreach ($groups as $group) {&#xA;        if ($group-&amp;gt;name == $groupName) {&#xA;            return $group-&amp;gt;id;&#xA;        }&#xA;    }&#xA;&#xA;    $group = new FieldGroup();&#xA;    $group-&amp;gt;name = $groupName;&#xA;    Craft::$app-&amp;gt;getFields()-&amp;gt;saveGroup($group);&#xA;&#xA;    return $group-&amp;gt;id;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following is the code to then create the fields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$fieldsService = Craft::$app-&amp;gt;getFields();&#xA;$groupId = $this-&amp;gt;getFieldGroup('My Group');&#xA;foreach ($fieldNames as $fieldName) {&#xA;    $fieldHandle = lcfirst(str_replace(' ', '', $fieldName));&#xA;    $fieldHandle = str_replace('#of', 'numOf', $fieldHandle);&#xA;&#xA;    $field = $fieldsService-&amp;gt;createField([&#xA;        'type'    =&amp;gt; 'craft\fields\PlainText',&#xA;        'name'    =&amp;gt; $fieldName,&#xA;        'handle'  =&amp;gt; $fieldHandle,&#xA;        'groupId' =&amp;gt; $groupId,&#xA;    ]);&#xA;&#xA;    $fieldsService-&amp;gt;saveField($field);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The point at which the field group is deleted is on running the $fieldsService-&gt;saveField($field); command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, just to reiterate:&#xA;The first time this runs there are no issues. Group and fields are created.&#xA;Running it a second time, if a new field is being added, the group gets deleted. This results in all the fields created for that group being assigned &quot;NULL&quot; in their groupId in the database, which causes errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated, thank you!&lt;/p&gt;&#xA;" OwnerUserId="9530" LastActivityDate="2019-04-05T23:18:52.493" Title="Custom plugin: Creating new fields will delete the field group they're being created in" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;field&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29917" PostTypeId="2" ParentId="29905" CreationDate="2019-03-22T16:59:56.830" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Trying to get property of non-object on line 519 of /craft/plugins/searchplus/services/SearchPlus_AlgoliaService.php&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That sounds suspiciously like a bug in the plugin to me.  I'd recommend contacting the plugin's author and reporting it to them for further debugging:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://transition.topshelfcraft.com/software/craft/searchplus/faq/how-can-i-get-support&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://transition.topshelfcraft.com/software/craft/searchplus/faq/how-can-i-get-support&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-22T16:59:56.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29918" PostTypeId="2" ParentId="29899" CreationDate="2019-03-22T21:54:56.820" Score="1" Body="&lt;p&gt;Make sure WAMP Document root is pointing to your 'Web' folder in the Craft install or whatever you might have changed it to.&lt;/p&gt;&#xA;" OwnerUserId="587" LastActivityDate="2019-03-22T21:54:56.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29920" PostTypeId="1" CreationDate="2019-03-23T06:43:31.687" Score="2" ViewCount="194" Body="&lt;p&gt;I was wondering if the following setup is a good practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my .env file I defined a single rootUrl var which contains the site root url like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ROOT_URL=&quot;https://www.mydomain.test&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the general.php config file i've created an alias (@rootUrl) that contains the ROOT_URL env var value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;        '@rootUrl' =&amp;gt; getenv('ROOT_URL'),&#xA;    ],&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I define my craft sites as following (multilingual site), each site BASE URL is constructed with the rootUrl and a language:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/1284055/54807616-185f4d80-4c7e-11e9-9c3c-45d8954ed3f3.png&quot; alt=&quot;Schermafbeelding 2019-03-22 om 08 39 32&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advantages&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You don't have to define every site (language) in the code, languages are managed through the cms (in case of multisite setup, you should define a ROOT_URL for every site).&lt;/li&gt;&#xA;&lt;li&gt;the @rootUrl alias can be used as part of the resource path in the templates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Disadvantages&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Could this also resolve in a caching issue (&lt;a href=&quot;https://twitter.com/nystudio107/status/1074429502615379968&quot; rel=&quot;nofollow noreferrer&quot;&gt;like the @web alias&lt;/a&gt;)?&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does this logic makes sense or is it generally a bad idea to use aliases for the site BASE URL setting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="9534" LastActivityDate="2019-03-24T15:52:59.573" Title="Use alias for site url based on root url defined as env var?" Tags="&lt;config&gt;&lt;siteurl&gt;&lt;setup&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29921" PostTypeId="1" AcceptedAnswerId="29922" CreationDate="2019-03-24T01:27:20.677" Score="2" ViewCount="700" Body="&lt;p&gt;So I've created a boilerplate for my web development company using Craft. However, I'm encountering so much inconsistency across different machines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently set up a new website at my public domain. I set up the webserver, and did a Git pull from the boilerplate Bitbucket I've got going.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the pull, I did a &lt;code&gt;composer install&lt;/code&gt; and installed Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point the website is working, but I can't login. The Craft setup never prompted me to create a new user/password. Not sure why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless of this issue, I have to import my DB from my local box to the web server. So after doing so, I can now login. Great right? Not quite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I login, I can't access any Settings in the backend and get a error about my license key. I've since fiddled around with my License Key settings on Craft's website, but I &lt;em&gt;still&lt;/em&gt; can't access the Settings panels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there's a process to deploying a site to production, but so far I can't find any consistency. Any advice is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eNj0N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eNj0N.png&quot; alt=&quot;Dashboard View&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9535" LastActivityDate="2019-03-24T01:54:08.443" Title="Unable to Access &quot;Settings&quot; in Backend" Tags="&lt;craft3&gt;&lt;deployment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29922" PostTypeId="2" ParentId="29921" CreationDate="2019-03-24T01:54:08.443" Score="2" Body="&lt;p&gt;In your general.php for a production site you'll probably see &lt;code&gt;&quot;allowAdminChanges&quot;&lt;/code&gt; set to false. This is not an inconsistency, this is how it is supposed to work. &#xA;Every change you make on your local development will be added to a project config file ( yaml file in your config folder ) and fields / sections / settings you create locally will then automatically be synced into your staging or production environment, the reason admin changes aren't allowed by default in there is simple, if you make changes in many places, the project.yaml file will be inconsistent and you'll run into a lot of issues trying to sync your install across different environments.&lt;/p&gt;&#xA;" OwnerUserId="9398" LastActivityDate="2019-03-24T01:54:08.443" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29923" PostTypeId="2" ParentId="29920" CreationDate="2019-03-24T15:52:59.573" Score="2" Body="&lt;p&gt;Good practice imo, it's what I do as well. Values come from the &lt;code&gt;.env&lt;/code&gt; vars, and for things that are URLs or paths, I make aliases out of them to take advantage of what you're showing above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This cannot cause any kind of issue like &lt;code&gt;@web&lt;/code&gt; -- the only thing wrong with &lt;code&gt;@web&lt;/code&gt; is that the host name is computed dynamically, potentially from untrusted browser data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're not doing that here, you are explicitly providing the host name, so it's totally fine. You could even do:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'aliases' =&amp;gt; [&#xA;        '@web' =&amp;gt; getenv('ROOT_URL'),&#xA;    ],&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...to redefine the dynamically generated &lt;code&gt;@web&lt;/code&gt; alias to something that is from a static value for the URL.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-03-24T15:52:59.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29924" PostTypeId="2" ParentId="29914" CreationDate="2019-03-25T04:31:24.613" Score="1" Body="&lt;p&gt;The docs here are what you need: &lt;a href=&quot;https://docs.craftcms.com/v3/config/app.html#memcached-example&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/app.html#memcached-example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is 99% exactly what Yii uses (since they have an example of using multiple servers): &lt;a href=&quot;https://www.yiiframework.com/doc/api/2.0/yii-caching-memcache&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.yiiframework.com/doc/api/2.0/yii-caching-memcache&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-25T04:31:24.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29925" PostTypeId="1" AcceptedAnswerId="30002" CreationDate="2019-03-25T10:47:19.523" Score="3" ViewCount="242" Body="&lt;p&gt;I'm using the Expanded Search plugin to display results of the search query with an excerpt of the text matching the query for each result. I want to limit the results to 10 per page, using pagination. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how I could limit the &lt;code&gt;expandedResults&lt;/code&gt; from the Expanded Search plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pagination works with the following code, but the Expanded Search results does not respect the limit to entries and instead shows all the results without limit, on each paginated page (e.g. If I have 14 results, the pagination will have 2 pages available, but all 14 results are displayed across both pages):&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Expanded Search Results&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  {# Get the user's search query from the 'q' query-string param #}&#xA;  {% set searchQuery = craft.app.request.getParam('q') %}&#xA;&#xA;  {# Fetch entries that match the search query #}&#xA;  {% set entries = craft.entries()&#xA;      .search(searchQuery)&#xA;      .orderBy('score') &#xA;      .limit(10) %}&#xA;&#xA;  {# Paginate the entries #}&#xA;  {% paginate entries as pageInfo, pageEntries %}&#xA;&#xA;  {# Get the search result excerpts from the Expanded Results plugin #}&#xA;  {% set expandedResults = craft.expandedSearch.search(searchQuery, { length: 155 }) %}&#xA;&#xA;  {% if entries|length %}&#xA;&#xA;      {# List search result entries #}&#xA;      {% for result in expandedResults %}&#xA;          &amp;lt;a href=&quot;{{ result.entry.url }}&quot;&amp;gt;&#xA;              &amp;lt;h3&amp;gt;{{ result.entry.title }}&amp;lt;/h3&amp;gt;&#xA;              &amp;lt;cite&amp;gt;{{ result.entry.url }}&amp;lt;/cite&amp;gt;&#xA;          &amp;lt;/a&amp;gt;&#xA;          {% if result.matchedValue %}&amp;lt;p&amp;gt;{{ result.matchedValue | raw }}&amp;lt;/p&amp;gt;{% else %}&amp;lt;p&amp;gt;No preview available&amp;lt;/p&amp;gt;{% endif %}&#xA;          &amp;lt;p&amp;gt;{% if result.entry.dateUpdated %}{{ result.entry.dateUpdated | date(&quot;j F Y&quot;) }}{% else %}{{ result.entry.postDate | date(&quot;j F Y&quot;) }}{% endif %}&amp;lt;/p&amp;gt;&#xA;      {% endfor %}&#xA;&#xA;      {# Display pagination if there are more than 10 entries #}&#xA;      {% if pageInfo.prevUrl or pageInfo.nextUrl %}&#xA;            {% if pageInfo.prevUrl %}&amp;lt;a href=&quot;{{ pageInfo.prevUrl }}?q={{ searchQuery }}&quot;&amp;gt;Previous Page&amp;lt;/a&amp;gt;{% endif %}&#xA;            {% for page, url in pageInfo.getPrevUrls(2) %}&#xA;                &amp;lt;a href=&quot;{{ url }}?q={{ searchQuery }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;            {{ pageInfo.currentPage }}&#xA;            {% for page, url in pageInfo.getNextUrls(2) %}&#xA;                &amp;lt;a href=&quot;{{ url }}?q={{ searchQuery }}&quot;&amp;gt;{{ page }}&amp;lt;/a&amp;gt;&#xA;            {% endfor %}&#xA;            {% if pageInfo.nextUrl %}&amp;lt;a href=&quot;{{ pageInfo.nextUrl }}?q={{ searchQuery }}&quot;&amp;gt;Next Page&amp;lt;/a&amp;gt;{% endif %}&#xA;            &amp;lt;p&amp;gt;Page {{ pageInfo.currentPage }} of {{ pageInfo.totalPages }}&amp;lt;/p&amp;gt;&#xA;      {% endif %}&#xA;&#xA;  {% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've also tried it this way, where I'm using the &lt;code&gt;expandedResults&lt;/code&gt; for the result excerpt only. As expected, the pagination and entry limit is this time respected, but this time, every result excerpt displays the excerpts from all the results (e.g. I have 14 results, split between 2 paginated pages but each result features all 14 excerpts):&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Entry Results with Partial Expanded Search Result&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{# List search result entries #}&#xA;{% for entry in pageEntries %}&#xA;    &amp;lt;a href=&quot;{{ entry.url }}&quot;&amp;gt;&#xA;        &amp;lt;h3&amp;gt;{{ entry.title }}&amp;lt;/h3&amp;gt;&#xA;        &amp;lt;cite&amp;gt;{{ entry.url }}&amp;lt;/cite&amp;gt;&#xA;    &amp;lt;/a&amp;gt;&#xA;    {# Show excerpt with matching value if available #}&#xA;    {% for result in expandedResults %}&#xA;        {% if result.matchedValue %}&amp;lt;p&amp;gt;{{ result.matchedValue | raw }}&amp;lt;/p&amp;gt;{% else %}&amp;lt;p&amp;gt;No preview available&amp;lt;/p&amp;gt;{% endif %}&#xA;    {% endfor %}&#xA;    &amp;lt;p&amp;gt;{% if entry.dateUpdated %}{{ entry.dateUpdated | date(&quot;j F Y&quot;) }}{% else %}{{ entry.postDate | date(&quot;j F Y&quot;) }}{% endif %}&amp;lt;/p&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9537" LastEditorUserId="9537" LastEditDate="2019-03-25T10:56:04.497" LastActivityDate="2019-04-01T09:42:09.490" Title="How to limit Expanded Search (plugin) query results for pagination?" Tags="&lt;craft3&gt;&lt;entries&gt;&lt;plugins&gt;&lt;search&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29926" PostTypeId="1" AcceptedAnswerId="29929" CreationDate="2019-03-25T12:22:00.527" Score="1" ViewCount="45" Body="&lt;p&gt;We want to remove an image ratio from out variant options. Will the files with that image size automatically be removed when we do so? If not how do we ensure they are?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are looking to remove them to increase the storage amount on our s3 instance.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-25T13:28:43.370" Title="ImageOptimze - Will removing image Variant Ratio delete image files?" Tags="&lt;plugin-imageoptimize&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29927" PostTypeId="1" AcceptedAnswerId="29928" CreationDate="2019-03-25T12:43:53.957" Score="1" ViewCount="174" Body="&lt;p&gt;I'm creating a footer menu and want to show an entry id and its children, atm I'm just getting the descendants but struggling to show the parent and children as well&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&quot;cell small-12&quot;&amp;gt;&#xA;&#xA;    &amp;lt;ul class=&quot;nested  menu vertical&quot;&amp;gt;&#xA;&#xA;        {% set entries = craft.entries.section('pages').descendantOf(8) %}&#xA;&#xA;        &amp;lt;p&amp;gt;{{ entry.parent }}&amp;lt;/p&amp;gt;&#xA;&#xA;        {% nav entry in entries %}&#xA;&#xA;        &amp;lt;li&amp;gt;&amp;lt;a class=&quot;c-main-nav__li__a&quot; href=&quot;{{ entry.url }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;            {% ifchildren %}&#xA;            &amp;lt;ul class=&quot;menu vertical sub-items&quot;&amp;gt;&#xA;                {% children %}&#xA;            &amp;lt;/ul&amp;gt;&#xA;            {% endifchildren %}&#xA;&#xA;        &amp;lt;/li&amp;gt;&#xA;&#xA;        {% endnav %}&#xA;&#xA;    &amp;lt;/ul&amp;gt;&#xA;&#xA;&amp;lt;/nav&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Appreciate this is the wrong approach any feedback appreciated on how to display the title of id 8 as well as its children, atm parent.entry is not showing&lt;/p&gt;&#xA;" OwnerUserId="5654" LastEditorUserId="5654" LastEditDate="2019-03-25T12:56:28.677" LastActivityDate="2019-03-25T13:21:33.240" Title="How would you show a specific entry 'and' its children" Tags="&lt;entry&gt;&lt;structure&gt;&lt;parents&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29928" PostTypeId="2" ParentId="29927" CreationDate="2019-03-25T13:21:33.240" Score="1" Body="&lt;p&gt;Try merging like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set parent = craft.entries.section('pages').id(8) %}&#xA;&#xA;{% set entries = craft.entries.section('pages').descendantOf(8).limit(1) %}&#xA;&#xA;{% set entries = parent|merge(entries) %}&#xA;&#xA;{% for entry in entries.all() %}&#xA;  output your entries here&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="193" LastActivityDate="2019-03-25T13:21:33.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29929" PostTypeId="2" ParentId="29926" CreationDate="2019-03-25T13:28:43.370" Score="2" Body="&lt;p&gt;So &lt;a href=&quot;https://nystudio107.com/plugins/imageoptimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Optimize&lt;/a&gt; just uses regular old Craft Transforms to do its thing. So whatever would happen to transformed images that you deleted the transform for would happen here as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the answer specifically, but if I had to guess, it'd be that Craft will not &quot;clean up&quot; its image transforms, and delete the ones that are no longer used. But you can do that manually, have it rebuild your Asset Indexes.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-03-25T13:28:43.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29930" PostTypeId="1" CreationDate="2019-03-25T14:33:13.427" Score="1" ViewCount="21" Body="&lt;p&gt;How does one get the total no. of pages for a multi-step form? The following doesn't work. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set count = form.pages().count() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2019-03-25T14:33:13.427" Title="Freeform Plugin: Get Total No. of Pages" Tags="&lt;craft3&gt;&lt;plugin-freeform&gt;&lt;freeform&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29932" PostTypeId="2" ParentId="23858" CreationDate="2019-03-25T21:01:34.467" Score="4" Body="&lt;p&gt;With the release of Craft 3.1 you can now keep fields (and other things) in sync between multiple environments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read more here: &lt;a href=&quot;https://docs.craftcms.com/v3/project-config.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/project-config.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8434" LastActivityDate="2019-03-25T21:01:34.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29933" PostTypeId="1" AcceptedAnswerId="29943" CreationDate="2019-03-26T02:37:01.017" Score="1" ViewCount="35" Body="&lt;p&gt;Is there a way to get the first and last days of a multi-day event? I want to be able to style the first and last days differently. I don't see anything like this in the docs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in Craft 3 and Calendar 2.0.17&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2019-04-03T20:18:54.480" Title="Getting the first and last days of a multi-day event - Solspace Calendar" Tags="&lt;craft3&gt;&lt;plugin-solspacecalendar&gt;&lt;calendar&gt;&lt;plugin-calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29934" PostTypeId="2" ParentId="20803" CreationDate="2019-03-26T06:09:59.007" Score="1" Body="&lt;p&gt;A few weeks ago we have made recent fix to Craft Commerce in 2.x that takes into account the removed tax from a line item when calculated the other tax rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/craftcms/commerce/blob/develop/CHANGELOG-v2.md#fixed-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/commerce/blob/develop/CHANGELOG-v2.md#fixed-7&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a single included VAT rate that matches the default zone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IarqS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IarqS.png&quot; alt=&quot;German VAT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then with the removed default VAT tax, and the new tax added, now are the same amounts if they are the same %:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BTVuJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BTVuJ.png&quot; alt=&quot;UK VAT first removes the German VAT and adds the UK Vat&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know if you have tried the latest Commerce release and if it fixes the issues you mention.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-03-26T06:09:59.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29935" PostTypeId="1" CreationDate="2019-03-26T08:18:20.950" Score="1" ViewCount="185" Body="&lt;p&gt;I have this code which used to work with 2.x versions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foobars = craft.entries({ section: &quot;foobars&quot;}).order(&quot;(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 5) WHEN title LIKE 'A %' THEN SUBSTRING(title, 3) ELSE title END) asc&quot;) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The idea is sort the entries ignoring the possible &quot;The &quot; and &quot;A &quot; prefix in the entry title, so that the order is more natural and what my client expects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the code is giving a SQL error message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`subquery` INNER JOIN `entries` `entries` ON `entries`.`id` = `subquery`.`elemen' at line 9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to achieve the same functionality on Craft 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SOLVED (thanks to Brad):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foobars = craft.entries({ section: &quot;foobars&quot; }).orderBy(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc&quot;).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is still unsolved:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition I have to get the previous and next entry in this channel based on the entry title, while excluding &quot;The &quot; and &quot;A &quot; in the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Craft 2 this was done with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set foobars = craft.entries({ section: &quot;foobars&quot; }).order(&quot;(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 5) WHEN title LIKE 'A %' THEN SUBSTRING(title, 3) ELSE title END) asc&quot;) %}&#xA;&#xA;{% set prev = entry.getPrev(foobars) %}&#xA;{% set next = entry.getNext(foobars) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Craft 3 this seems to be a bit more complicated than that. According to what I've discovered this would almost work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries.section(&quot;foobars&quot;).id(&quot;not &quot; ~ entry.id).limit(1) %}&#xA;{% set prev = clone(query).title(&quot;&amp;lt;= &quot; ~ entry.title).orderBy(&quot;title desc&quot;).all() %}&#xA;{% set next = clone(query).title(&quot;&amp;gt;= &quot; ~ entry.title).orderBy(&quot;title asc&quot;).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I would have to be able to set the orderBy-clause to use the &quot;(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 5) WHEN title LIKE 'A %' THEN SUBSTRING(title, 3) ELSE title END) asc&quot;, which does not work in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I've tried using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set query = craft.entries.section(&quot;foobars&quot;).id(&quot;not &quot; ~ entry.id).limit(1) %}&#xA;&#xA;{% set prev = clone(query).title(&quot;&amp;lt; &quot; ~ entry.title).orderBy(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) desc&quot;).one() %}&#xA;&#xA;{% set next = clone(query).title(&quot;&amp;gt; &quot; ~ entry.title).orderBy(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc&quot;).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the problem is that if I'm on an entry titled &quot;The Foobar&quot;, I would need to search for entries around &quot;Foobar&quot; and not &quot;The Foobar&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you modify the query, so that it would include the MySQL &quot;(CASE WHEN...)&quot; logic?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set prev = clone(query).search(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) &amp;lt; 'Foobar'&quot;).orderBy(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) desc&quot;).one() %} ?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="8169" LastEditDate="2019-04-08T08:24:00.380" LastActivityDate="2019-04-08T08:24:00.380" Title="Ignoring &quot;The &quot; and &quot;A &quot; when sorting entries" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;ordering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29936" PostTypeId="2" ParentId="29914" CreationDate="2019-03-26T10:36:40.440" Score="1" Body="&lt;p&gt;Thanks to the Craft support team who responded here and via email. Some of the docs/links I mentioned have since been corrected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the salient part of the reply I got from Brandon at Craft:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;&lt;em&gt;...So to be clear, the only thing you need to do to get Craft to use&#xA;  Memcached is follow our &lt;a href=&quot;https://docs.craftcms.com/v3/config/app.html#memcached-example&quot; rel=&quot;nofollow noreferrer&quot;&gt;Memcached&#xA;  Example&lt;/a&gt;&#xA;  from the Application Configuration page. That code should be placed in&#xA;  &lt;code&gt;config/app.php&lt;/code&gt;, and you will need to customize the config values as&#xA;  needed, and create the &lt;code&gt;MEMCACHED_USERNAME&lt;/code&gt; and &lt;code&gt;MEMCACHED_PASSWORD&lt;/code&gt;&#xA;  environment variables (named whatever you want as long as you update&#xA;  the config file appropriately – or you can just hardcode the values&#xA;  but we wouldn’t recommend that).&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can confirm that this works. &lt;/p&gt;&#xA;" OwnerUserId="8748" LastActivityDate="2019-03-26T10:36:40.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29942" PostTypeId="1" AcceptedAnswerId="29945" CreationDate="2019-03-27T01:12:15.333" Score="1" ViewCount="25" Body="&lt;p&gt;I'm trying to create a submission page at the following URL structure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/campaigns/this-is-a-test-creation/submissions&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see &lt;code&gt;/campaigns/&lt;/code&gt; is the Channel and the &lt;code&gt;/this-is-a-test-creation/&lt;/code&gt; is the entry slug. I'm trying to currently set up my page using routing and fetch the related entry, but I'm having difficulties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My route in the CP is set up as follows and works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/campaigns/{slug}/submissions&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code to fetch the relating entry doesn't&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{% set entry = craft.entries.section('campaigns').slug('craft.app.request.getSegment(3)').one() %}&#xA;{{ entry.title }}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This returns:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Impossible to access an attribute (&quot;title&quot;) on a null variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-03-27T07:32:11.740" Title="Display Relating Entry based on Page Routing" Tags="&lt;templating&gt;&lt;routes&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29943" PostTypeId="2" ParentId="29933" CreationDate="2019-03-27T03:49:44.817" Score="1" Body="&lt;p&gt;Within the context of &lt;code&gt;calendar.month&lt;/code&gt;, if you check out the demo templates, we style the beginning and end of multi-day events with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% if event.multiDay %}&#xA;    {% set classes = classes ~ &quot; multi_day&quot; %}&#xA;    {% set classes = classes ~ (day.containsDate(event.startDateLocalized) ? &quot; first_day&quot;) %}&#xA;    {% set classes = classes ~ (day.containsDate(event.endDateLocalized) ? &quot; last_day&quot;) %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4496" LastEditorUserId="4496" LastEditDate="2019-04-03T20:18:54.480" LastActivityDate="2019-04-03T20:18:54.480" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="29944" PostTypeId="1" AcceptedAnswerId="29946" CreationDate="2019-03-27T07:19:25.627" Score="1" ViewCount="162" Body="&lt;p&gt;How do I add additional attributes values while registering a CSS/JS file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add a &lt;code&gt;media&lt;/code&gt; attribute to one of the CSS links&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do view.registerCssFile(siteUrl ~ 'css/print.css', [ ['media' =&amp;gt; 'print'] ]) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code produces an &lt;code&gt;Unexpected token &quot;operator&quot;&lt;/code&gt; error.&lt;/p&gt;&#xA;" OwnerUserId="9254" LastEditorUserId="57" LastEditDate="2019-03-28T03:27:18.877" LastActivityDate="2019-03-28T03:27:18.877" Title="How to add attributes to links/scripts?" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29945" PostTypeId="2" ParentId="29942" CreationDate="2019-03-27T07:32:11.740" Score="2" Body="&lt;p&gt;Looks to me like there shouldn't be any quotes around &lt;code&gt;craft.app.request.getSegment(3)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I'd use &lt;a href=&quot;https://docs.craftcms.com/v3/routing.html#accessing-named-parameters-in-your-templates&quot; rel=&quot;nofollow noreferrer&quot;&gt;named parameters&lt;/a&gt; instead of .getSegment just seems a little bit more readable and robust.&lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2019-03-27T07:32:11.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29946" PostTypeId="2" ParentId="29944" CreationDate="2019-03-27T07:38:59.807" Score="1" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do view.registerCssFile(siteUrl ~ 'css/print.css', {'media' : 'print'}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2019-03-27T07:38:59.807" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29949" PostTypeId="1" CreationDate="2019-03-27T15:07:33.763" Score="1" ViewCount="158" Body="&lt;p&gt;I'm relating entries from another site in my installation, and I'm having issues getting the correct URL for the entry. This is an example of what I currently have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set carouselEntries = entry.contentCarouselEntries.all() %}&#xA;&#xA;{% for entry in carouselEntries %}&#xA;&#xA;    &amp;lt;a href=&quot;{{ entry.getUrl() }}&quot;&amp;gt;{{ entry.title }}&amp;lt;/a&amp;gt;&#xA;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will get the correct title, however, it does not get the correct URL in that it does not include the site. Assume that the current site is mywebsite.com, and the URL for the site I'm retrieving the related entry is news.mywebsite.com. I'd expect the URL to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://news.mywebsite.com/article/article-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead it's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://mywebsite.com/article/article-slug&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The article/article-slug comes from Entry URI field in Settings &gt; Sections &gt; Site Settings &gt; Entry URI Format&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is undoubtedly easy stuff, but I'm blanking on how to output this in my template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that I need to query these entries in a different way? Whatever the solution, the entries need to output in the same order they were added to the entries field (contentCarouselEntries) on mywebsite.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the solution needs to be dynamic in that I cannot just build the URL in my template like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://news.mywebsite.com/article/{{ entry.slug }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The related entries actually come from multiple sites in my installation including 'blog' and 'news', and from multiple environments like .local and .com. So, the link should include the site the entry is from and the environment you're in.&lt;/p&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="7475" LastEditDate="2019-03-27T15:22:46.890" LastActivityDate="2019-03-27T15:22:46.890" Title="How to get url from related entry in another site" Tags="&lt;entries&gt;&lt;url&gt;&lt;query&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29950" PostTypeId="1" CreationDate="2019-03-27T16:39:33.813" Score="1" ViewCount="230" Body="&lt;p&gt;I am trying to get all entries from my events section in Craft 3 that occur after 17:00.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current code is:&#xA;&lt;code&gt;{% set events = craft.entries.section('events').eventStartTime('&amp;gt;= ' ~ '17:00'|time ).all() %}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;&amp;gt;=&lt;/code&gt; is being ignored as far as I can tell. The query just returns all events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;eventStartTime&lt;/code&gt; field is a Date/Time field that is set to just show the time (I know that behind the scenes Craft still treats this as a DateTime object but I was hoping that the &lt;code&gt;|time&lt;/code&gt; filter would help with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I have created similar queries on a DateTime field but looking at the date rather than time, they have worked as expected - maybe I am missing something when it comes to the time portion of the object? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5663" LastEditorUserId="5663" LastEditDate="2019-03-28T08:16:18.870" LastActivityDate="2019-11-23T00:27:04.293" Title="Get entries after a certain time" Tags="&lt;search&gt;&lt;entry&gt;&lt;datetime&gt;&lt;query&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29952" PostTypeId="1" CreationDate="2019-03-27T17:40:37.867" Score="1" ViewCount="241" Body="&lt;p&gt;I'm getting started with plugin/module development. I want to get the template file, pass some variables to it, and get rendered HTML of that template into a string variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="57" LastEditDate="2019-03-28T03:40:54.730" LastActivityDate="2019-03-28T16:28:53.213" Title="Get HTML of rendered template inside module" Tags="&lt;plugin-development&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29953" PostTypeId="1" CreationDate="2019-03-27T17:51:07.570" Score="1" ViewCount="157" Body="&lt;p&gt;I have been using Solspace Freeform plugin (Lite edition) with Craft 3.&#xA;However, I cannot find how to develop validations for the form.&#xA;Could you tell me how to develop form validations?&#xA;(E.g. postal code, password)&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2020-07-01T20:45:12.347" Title="Validate fields in Solspace Freeform plugin" Tags="&lt;plugin-freeform&gt;&lt;solspace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29954" PostTypeId="2" ParentId="29796" CreationDate="2019-03-28T12:27:35.033" Score="0" Body="&lt;p&gt;The suggestion to order by sectionId resolved my issue here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% set entries = craft.entries().section('extendedEvents, festivalEvents'). orderBy({sectionId: SORT_ASC}) %}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it was, I was working with two sections, so my quick fix was to simply reverse the order of the output of the for loop...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{% for section, eventsInSection in allEventsBySection | reverse %}                          &lt;/p&gt;&#xA;" OwnerUserId="5055" LastActivityDate="2019-03-28T12:27:35.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29955" PostTypeId="2" ParentId="29728" CreationDate="2019-03-28T12:59:00.947" Score="1" Body="&lt;p&gt;Maybe a bit late but we've implemented gift aid for a client's donations site and whilst in Craft2 and using the Charge plugin it might help a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We added a field to the Charge order which is a lightswitch of GiftAid on or off. As August suggested this could be done in the line item as an options[giftaid] value of Craft Commerce&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then created a couple of twig templates restricted to admin users only. The first one is an index file that lists the calendar months as links to another twig template that lists the details of that months orders as a CSV file for GiftAid reporting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for the css twig template looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set month = craft.request.getParam('d') %}&#xA;{% set year = craft.request.getParam('y') %}&#xA;{% set firstDay = date(year ~ '-' ~ month ~ '-01') %}&#xA;{% set lastDay = firstDay|date_modify('first day of next month') %}&#xA;{% header &quot;Content-Type: application/csv&quot; %}&#xA;{% header &quot;Content-Disposition: attachment; filename=&quot; ~ month ~ &quot;-&quot; ~ year ~ &quot;-GiftAidReport.csv&quot; %}&#xA;{% set postDateParam = ['and', '&amp;gt;= ' ~ firstDay|date('c'), '&amp;lt; ' ~ lastDay|date('c')] %}&#xA;{% set charges = craft.charge.charges({  &#xA;    giftAid: 1,&#xA;    dateCreated: postDateParam,&#xA;    refunded: false&#xA;})%}&#xA;CharityNumber, CharityName, ProjectName, FundraisingCampaign, DonorTitle,DonorFirstName,DonorLastName,DonorAddress,DonorPostcode, Description, DonatonDate, DonationAmount, DonationCurrency, GiftAidValue&#xA;{% for charge in charges %}&#xA;{% set thisName = charge.customer.name|split(' ') %}&#xA;&amp;lt;this is your list of CSV fields&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm sure there is a much nicer way of doing this all in a plugin within the backend but this was a nice quick and easy way to do it.&lt;/p&gt;&#xA;" OwnerUserId="5284" LastActivityDate="2019-03-28T12:59:00.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29956" PostTypeId="1" AcceptedAnswerId="32703" CreationDate="2019-03-28T15:00:16.567" Score="1" ViewCount="91" Body="&lt;p&gt;I can detect and match up the fields from my json file but when doing the import I get the following error in the log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No feed items to process.   3/28/2019 2:53 PM&#xA;&#xA;error   Unable to reach data/case-studies.json. Message: File path cannot be found.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For some reason, it isn't picking up the file when doing an import. How do I resolve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have validated the json file and it is correct so I'm stumped! &lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="7082" LastEditDate="2019-05-08T20:59:50.033" LastActivityDate="2019-10-07T15:56:57.190" Title="Feed Me Plugin: Can Match fields but feed not importing" Tags="&lt;craft3&gt;&lt;plugin-feedme&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29957" PostTypeId="2" ParentId="25718" CreationDate="2019-03-28T15:10:07.747" Score="1" Body="&lt;p&gt;My issue was the database settings. I needed to change my db to: Default Collation: utf8_unicode_ci.&lt;/p&gt;&#xA;" OwnerUserId="9551" LastEditorUserId="9551" LastEditDate="2019-03-28T16:57:50.633" LastActivityDate="2019-03-28T16:57:50.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29958" PostTypeId="1" CreationDate="2019-03-28T15:35:30.513" Score="3" ViewCount="519" Body="&lt;p&gt;Having difficulties creating a new user in a custom controller, here's my implementation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;use craft\records\User;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new User;&#xA;$user-&amp;gt;firstName = $userData['firstName'];&#xA;$user-&amp;gt;lastName = $userData['lastName'];&#xA;$user-&amp;gt;username = $userData['loginName'];&#xA;$user-&amp;gt;email = $userData['loginName'];&#xA;$user-&amp;gt;password = $userData['password'];&#xA;&#xA;$response = $user-&amp;gt;insert();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value&#xA;The SQL being executed was: INSERT INTO `craft_users` (`firstName`, `lastName`, `username`, `email`, `password`, `dateCreated`, `uid`, `dateUpdated`) VALUES ('Tristan', 'Gemus', 'registertest@gmail.com', 'registertest@gmail.com', 'password', '2019-03-28 15:53:10', '85468ad6-63cc-499d-baf4-32aaaf55bfb2', '2019-03-28 15:53:10')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The response returns false. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="9552" LastEditorUserId="9552" LastEditDate="2019-03-28T15:54:18.163" LastActivityDate="2019-03-29T03:01:10.980" Title="Craft CMS V3 Create New User" Tags="&lt;craft3&gt;&lt;yii&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29959" PostTypeId="2" ParentId="29952" CreationDate="2019-03-28T16:28:53.213" Score="1" Body="&lt;p&gt;I figured it out. I will paste it here in case someone needs it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$html = Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate('template.twig', $variables);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8366" LastActivityDate="2019-03-28T16:28:53.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29960" PostTypeId="2" ParentId="13519" CreationDate="2019-03-28T16:46:03.837" Score="1" Body="&lt;p&gt;I wanted to do something similar to this, but ran into the problem that if they were on another tab taking actions, they could extend the timeout, which would render the original set timeout to no longer be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To account for that, I created a controller in one of my plugins which would get the timeout for the user, and return that.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function actionGetAuthTimeout()&#xA;{&#xA;    $authTimeout = craft()-&amp;gt;userSession-&amp;gt;getAuthTimeout() * 1000;&#xA;&#xA;    $this-&amp;gt;returnJson($authTimeout);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in the &lt;code&gt;routes.php&lt;/code&gt; file, add a route for that controller action, such as&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'getAuthTimeout' =&amp;gt; ['action' =&amp;gt; 'pluginName/controllerName/getAuthTimeout'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, in the front end, you can access that &lt;em&gt;making sure to pass the param to not extend the session&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;document.addEventListener(&quot;DOMContentLoaded&quot;, function(event)&#xA;{ &#xA;    checkTimeout()&#xA;})&#xA;&#xA;// Check the remaining timeout until the user is logged out&#xA;function checkTimeout()&#xA;{&#xA;    $.get('/auth/getAuthTimeout&amp;amp;dontExtendSession=1', function(timeout)&#xA;    {&#xA;        if (timeout &amp;lt;= 1000)&#xA;        {&#xA;            // I chose to force log them out too, just to make sure&#xA;            window.axios.get('/logout')&#xA;&#xA;            // Do whatever else you want&#xA;        }&#xA;        else&#xA;        {&#xA;            setTimeout(function()&#xA;            {&#xA;                checkTimeout()&#xA;            }, timeout)&#xA;        }&#xA;    })&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On a side note, if you want to make this a lot easier for testing, just add the following line in your &lt;code&gt;craft/config/general.php&lt;/code&gt; file to expire after 10 seconds:&#xA;&lt;code&gt;'userSessionDuration' =&amp;gt; 'PT10S',&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9276" LastEditorUserId="9276" LastEditDate="2019-04-04T19:09:06.733" LastActivityDate="2019-04-04T19:09:06.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29961" PostTypeId="1" CreationDate="2019-03-28T19:33:22.497" Score="1" ViewCount="88" Body="&lt;p&gt;I feel like there must be something i've missed but i've followed the ReadMes for both of these plugins and they don't seem to work on my website. Does anyone have any experience with them? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Craft 3 and used the plugin store to install them. I have tried them one at a time so that they don't interfere with each other. I've also made sure the site environment is set to production.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gatekeeper:&#xA;&lt;a href=&quot;https://github.com/tomdiggle/craft-gatekeeper/blob/v1/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/tomdiggle/craft-gatekeeper/blob/v1/README.md&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knock Knock&#xA;&lt;a href=&quot;https://github.com/verbb/knock-knock&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/knock-knock&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3556" LastActivityDate="2019-03-28T20:30:37.083" Title="Gatekeeper/Knock Knock Pluging not working" Tags="&lt;craft3&gt;&lt;plugins&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29962" PostTypeId="2" ParentId="4128" CreationDate="2019-03-28T19:57:07.457" Score="1" Body="&lt;p&gt;Because I have so little reputation I cannot comment or like anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But @&lt;a href=&quot;https://craftcms.stackexchange.com/a/4129/5557&quot;&gt;naboovalley&lt;/a&gt; 's answer did the trick for me! all the other ones gave me  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ERR_TOO_MANY_REDIRECTS!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the right answer to this question is probably:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RewriteEngine On&#xA;RewriteBase /&#xA;&#xA;# If the request is not secure&#xA;RewriteCond %{HTTPS} off&#xA;# Redirect to the secure version&#xA;RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]&#xA;&#xA;# Normal redirect rules&#xA;RewriteCond %{REQUEST_FILENAME} !-f&#xA;RewriteCond %{REQUEST_FILENAME} !-d&#xA;RewriteRule ^(.*)$ /index.php/$1 [L] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you @&lt;a href=&quot;https://craftcms.stackexchange.com/a/4129/5557&quot;&gt;naboovalley&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="9554" LastEditorUserId="5557" LastEditDate="2019-04-04T16:56:15.580" LastActivityDate="2019-04-04T16:56:15.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29963" PostTypeId="2" ParentId="29961" CreationDate="2019-03-28T20:30:37.083" Score="2" Body="&lt;p&gt;I can't speak for Gatekeeper, but I'm a big fan of Knock Knock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Were you logged out at the time? If you are logged in, it will bypass the security screen.&lt;/p&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-03-28T20:30:37.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29964" PostTypeId="1" CreationDate="2019-03-28T20:39:08.730" Score="1" ViewCount="47" Body="&lt;p&gt;I have a handful of custom routes configured on this project like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'action/(?P&amp;lt;custom_id&amp;gt;[a-zA-Z][0-9]{6})/(?P&amp;lt;slug&amp;gt;.*)' =&amp;gt; 'action/_member',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm reading the docs correctly, then those need to change to become&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'action/&amp;lt;custom_id:[a-zA-Z][0-9]{6}&amp;gt;/&amp;lt;entrySlug:{slug}.*&amp;gt;' =&amp;gt; [&#xA;        'template' =&amp;gt; 'action/_member'&#xA;    ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that gives me a template not found error when I hit &lt;code&gt;localhost/action/L100582/&amp;amp;session=115&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I simplify the rule to become&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;action/steven' =&amp;gt; [ 'template' =&amp;gt; 'action/_member' ]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and hit, &lt;code&gt;localhost/action/steven&lt;/code&gt; the template loads just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't wrap my little head around what I'm missing.&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2019-08-26T13:02:40.333" Title="Migrating custom routes from v2 to v3" Tags="&lt;url&gt;&lt;routing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29965" PostTypeId="1" AcceptedAnswerId="29972" CreationDate="2019-03-28T20:39:56.987" Score="1" ViewCount="188" Body="&lt;p&gt;I'm attempting to restore a postgres DB backup on to my local dev environment but I encounter an error when trying to login as the admin user (the salient parts being):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column &quot;id&quot; violates not-null constraint&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The SQL being executed was: INSERT INTO &quot;sessions&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it seems as though it correctly authenticates my username and password and then tries to create a new entry in the sessions table but fails to do so because the session service is returning a null value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this interpretation correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using redis for my session storage, so I tried clearing the keys from there but it doesn't fix the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really blocked on this one and would appreciate any thoughts!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;kind regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;piaras hoban&lt;/p&gt;&#xA;" OwnerUserId="6624" LastEditorUserId="6624" LastEditDate="2019-03-29T09:45:02.207" LastActivityDate="2019-03-29T09:45:02.207" Title="Can't login after restoring production DB locally" Tags="&lt;craft3&gt;&lt;database&gt;&lt;back-up&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29966" PostTypeId="2" ParentId="29910" CreationDate="2019-03-28T20:43:04.500" Score="2" Body="&lt;p&gt;Have a look a little further down in the Readme and you will see more information regarding Watermark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Readme...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;image: The image that is to be used as watermark. Just as the image parameter in the craft.imager.transformImage method, this can be an AssetFileModel, a string to a previously transformed Imager image, or a string to an external image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set logo = craft.assets({ id: 11 }).first() %}&#xA;{% set watermarkedImage = craft.imager.transformImage(image, { &#xA;    width: 600, &#xA;    watermark: { image: logo, width: 80, height: 80, position: { right: 30, bottom: 30 }, opacity: 0.8, blendMode: 'multiply' }&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also a link to a Watermark demo &lt;a href=&quot;https://imager.vaersaagod.no/?img=6&amp;amp;demo=watermarks&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imager.vaersaagod.no/?img=6&amp;amp;demo=watermarks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7213" LastActivityDate="2019-03-28T20:43:04.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29967" PostTypeId="1" AcceptedAnswerId="29995" CreationDate="2019-03-28T23:38:37.477" Score="1" ViewCount="194" Body="&lt;p&gt;I am trying to get all entries posted from 2018 and only 2018. All the other methods I've seen are for from a specific date or between two dates. Is there a simple way to get all posts from 2018 without having to specify &lt;code&gt;get all entries between 1 January 2018 and 31 December 2018&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The markup below is where I have got to, but this is getting all entries from 2018 onwards. But when I change the &lt;code&gt;&amp;gt;=&lt;/code&gt; parameter to &lt;code&gt;==&lt;/code&gt; it appears to break it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set event = craft.entries.section('events').startDate('&amp;gt;=' ~ formYear).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5845" LastEditorUserId="57" LastEditDate="2019-03-30T22:44:58.207" LastActivityDate="2019-03-30T23:08:33.053" Title="How to get all entries posted within a specific year?" Tags="&lt;entries&gt;&lt;datetime&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29968" PostTypeId="2" ParentId="2028" CreationDate="2019-03-29T00:14:18.040" Score="1" Body="&lt;p&gt;In Craft 3, you can use &lt;a href=&quot;https://docs.craftcms.com/v3/config/app.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;app.php&lt;/a&gt; file to connect to an external SMTP server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Article on my blog craftSnippets describes how to do this. It deals with Mailtrap, fake SMTP server, but you can connect to any server that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftsnippets.com/articles/testing-and-debugging-emails-sent-by-craft-cms-using-mailtrap&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftsnippets.com/articles/testing-and-debugging-emails-sent-by-craft-cms-using-mailtrap&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-03-29T00:14:18.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29969" PostTypeId="2" ParentId="4650" CreationDate="2019-03-29T00:15:44.087" Score="2" Body="&lt;p&gt;I made an article about RSS feed template component for Craft CMS - you can read it here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-03-29T00:15:44.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29970" PostTypeId="1" CreationDate="2019-03-29T02:27:54.033" Score="1" ViewCount="611" Body="&lt;p&gt;When I go to control panel &gt; Settings &gt; Fields, I get a page that throws &lt;code&gt;TypeError: Argument 1 passed to craft\services\Fields::getGroupById() must be of the type integer, null given&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is identical to the issue described here: &lt;a href=&quot;https://github.com/craftcms/cms/issues/3561&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3561&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas as to what might be causing this issue? &lt;/p&gt;&#xA;" OwnerUserId="9556" LastActivityDate="2019-08-26T19:03:30.430" Title="TypeError: Argument 1 passed to craft\services\Fields::getGroupById() must be of the type integer, null given" Tags="&lt;craft3&gt;&lt;error-message&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29971" PostTypeId="2" ParentId="29958" CreationDate="2019-03-29T03:01:10.980" Score="3" Body="&lt;p&gt;Take a look at Craft's own &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php#L919-L1212&quot; rel=&quot;nofollow noreferrer&quot;&gt;UsersController-&gt;actionSaveUser()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're probably looking for something closer to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = new craft\elements\User();&#xA;&#xA;$user-&amp;gt;firstName = $firstName;&#xA;$user-&amp;gt;lastName = $lastName;&#xA;$user-&amp;gt;username = $userName;&#xA;$user-&amp;gt;email = $email;&#xA;$user-&amp;gt;password = $password;&#xA;&#xA;if ($user-&amp;gt;validate(null, false)) {&#xA;    Craft::$app-&amp;gt;getElements()-&amp;gt;saveElement($user, false);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-29T03:01:10.980" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29972" PostTypeId="2" ParentId="29965" CreationDate="2019-03-29T03:09:36.853" Score="0" Body="&lt;p&gt;The &lt;code&gt;id&lt;/code&gt; primary key column in the &lt;code&gt;sessions&lt;/code&gt; table (and nearly all Craft tables) is set to be auto-incrementing (if you're on MySQL).  It should look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE `sessions`  (&#xA;  `id` int(11) NOT NULL AUTO_INCREMENT,&#xA;  `userId` int(11) NOT NULL,&#xA;  `token` char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,&#xA;  `dateCreated` datetime(0) NOT NULL,&#xA;  `dateUpdated` datetime(0) NOT NULL,&#xA;  `uid` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',&#xA;  PRIMARY KEY (`id`) USING BTREE,&#xA;  INDEX `sessions_uid_idx`(`uid`) USING BTREE,&#xA;  INDEX `sessions_token_idx`(`token`) USING BTREE,&#xA;  INDEX `sessions_dateUpdated_idx`(`dateUpdated`) USING BTREE,&#xA;  INDEX `sessions_userId_idx`(`userId`) USING BTREE,&#xA;  CONSTRAINT `sessions_userId_fk` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT&#xA;) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It sounds to me like that table is missing it's &lt;code&gt;AUTO_INCREMENT&lt;/code&gt; on the &lt;code&gt;id&lt;/code&gt; column.  Craft assumes it's there and that the database will automatically insert it.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-29T03:09:36.853" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29973" PostTypeId="1" AcceptedAnswerId="30017" CreationDate="2019-03-29T06:39:56.150" Score="1" ViewCount="551" Body="&lt;p&gt;I'm currently working on migrating a Craft 2 project which has a bunch of bespoke custom plugins that provided various bits of additional functionality that's tailored to this project only. I've been reading up on the recommended approach in Craft 3 and have understood that modules are better suited in a lot of cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've come across a snag with a previous Craft 2 plugin, that basically existed to provide settings that could be referenced in PHP/Twig. This plugin implemented various settings that were defined at &lt;code&gt;config/mycustompluginhandle.php&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to have the same again but as a module, but it looks like the settings model isn't the same as a plugin and you have to &quot;roll your own&quot; setup for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is can is a module provide settings via a &lt;code&gt;config/something.php&lt;/code&gt; file and can these settings be referenced in other parts of the application i.e. PHP/Twig or another plugin/module? If so, how can I go about doing achieving it?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2019-03-29T08:46:50.693" LastActivityDate="2019-04-03T09:03:46.043" Title="Custom module that can define and have settings referenced (Craft 3)" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;modules&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29974" PostTypeId="2" ParentId="29964" CreationDate="2019-03-29T09:06:10.897" Score="1" Body="&lt;p&gt;The &lt;code&gt;{slug}&lt;/code&gt; token you’re using there is going to get replaced with Craft’s slug pattern:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(?:[\p{L}\p{N}\p{M}\.\_\-]+)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since that’s not an optional pattern, the resulting regex isn’t going to match your example URL, which doesn’t have a slug after the &lt;code&gt;custom_id&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’d recommend you use two separate routes that both point to the same template:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'action/&amp;lt;custom_id:[a-zA-Z][0-9]{6}&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'action/_member'],&#xA;'action/&amp;lt;custom_id:[a-zA-Z][0-9]{6}&amp;gt;/&amp;lt;entrySlug:{slug}&amp;gt;' =&amp;gt; ['template' =&amp;gt; 'action/_member'],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(And just in case it wasn’t intentional, worth pointing out that the slug is going to be called &lt;code&gt;entrySlug&lt;/code&gt; as opposed to &lt;code&gt;slug&lt;/code&gt; with that route, which is another change from your Craft 2 route. Use &lt;code&gt;&amp;lt;slug:{slug}&amp;gt;&lt;/code&gt; if you didn’t mean to change the name.)&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="9" LastEditDate="2019-03-29T11:20:20.423" LastActivityDate="2019-03-29T11:20:20.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29975" PostTypeId="1" CreationDate="2019-03-29T10:12:55.827" Score="4" ViewCount="802" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm running Craft Pro 3.1.19 on PHP 7.2.15&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS, by default, uses vlucas/phpdotenv to get the configuration (containing secrets / credentials and lots of other stuff) from .env&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft CMS logs PHP errors to storage/logs/phperrors.log&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the PHP error log, the all the data from .env is logged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is available in the $_SERVER superglobal, and is appended to stack traces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: Call to undefined function this_is_a_fatal_error() in /srv/app/web/index.php:24&#xA;Stack trace:&#xA;#0 {main}&#xA;...&#xA;...&#xA;$_SERVER = [&#xA;    ...&#xA;    ...&#xA;    'SECURITY_KEY' =&amp;gt; 'exposed-secret'&#xA;    'DB_USER' =&amp;gt; 'my-db-user',&#xA;    'DB_PASSWORD' =&amp;gt; 'exposed-secret',&#xA;    'DB_DATABASE' =&amp;gt; 'my-db-name',&#xA;    ...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the Craft CMS web.log, sensitive data is masked before writing the log. Yay!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Stack trace:&#xA;#0 {main}&#xA;...&#xA;...&#xA;$_SERVER = [&#xA;    ...&#xA;    ...&#xA;    'SECURITY_KEY' =&amp;gt; '**************'&#xA;    'DB_USER' =&amp;gt; 'my-db-user',&#xA;    'DB_PASSWORD' =&amp;gt; '**************',&#xA;    'DB_DATABASE' =&amp;gt; 'my-db-name',&#xA;    ...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I prevent secrets beeing logged in the PHP error log?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is not a Craft CMS specific problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The secrets could ofcourse also be exposed in other ways than in the log, with a careless phpinfo() or something similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I've searched a lot, and read a lot, and found various options / suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to ask for your opinion on the options / solutions (listed below), or if you have any more options I've not found yet...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the stuff I've read:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://movingfast.io/articles/environment-variables-considered-harmful/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://movingfast.io/articles/environment-variables-considered-harmful/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blog.fortrabbit.com/how-to-keep-a-secret&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blog.fortrabbit.com/how-to-keep-a-secret&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nystudio107.com/blog/multi-environment-config-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://12factor.net/config&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://12factor.net/config&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I have more, but I don't have the rep to post more links)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A general conclusion I've made so far is that configuration in the environment is a good idea, but credentials / secrets in the environment is a bad idea.&#xA;Is this a general consensus?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1 - turn off error logging:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has been brought up before; &lt;a href=&quot;https://github.com/craftcms/cms/issues/3619&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/craftcms/cms/issues/3619&lt;/a&gt; - &lt;a href=&quot;https://docs.craftcms.com/v3/config/php-constants.html#craft-log-php-errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/config/php-constants.html#craft-log-php-errors&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the solution here is to tell Craft to turn off PHP error logging (you also have to turn of logging in php.ini).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really do not want to turn of error logging unless all the other options are not possible...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2 - Move production configration to the webserver:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phpdotenv documentation used to say &quot;phpdotenv is made for development environments, and generally should not be used in production.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vlucas/phpdotenv/issues/207&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/vlucas/phpdotenv/issues/207&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though the documentation does not say this anymore, it might still be a good idea to move the config from .env to the webserver config (in production).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Nginx - you can add a fastcgi_param for each key/value to the vhost config. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use a tool like nystudio107/dotenvy to help getting the correct config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not really solve anything, as the secrets are still loaded into the environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus: This has a small performance benefit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 3 - Modify the way Craft CMS uses phpdotenv:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laravel also uses vlucas/phpdotenv, but not in the same way.&#xA;It reads the .env, and stores the config in a cache file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, the environment is not &quot;polluted&quot; with sensitive data.&#xA;See &lt;a href=&quot;https://laravel.com/docs/5.8/configuration#configuration-caching&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://laravel.com/docs/5.8/configuration#configuration-caching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could this be a viable option for Craft CMS as well?&#xA;Would probably need to add some more steps when deploying code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds great to me, but may break backwards compatibility.&#xA;Also, this requires P&amp;amp;T to do some magic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 4 - Roll your own?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove vlucas/phpdotenv, and use something else to encrypt the .env-file, or implement option 3 myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found these (all are on github, but I don't have the reputation to post enough complete links):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;arrilot/dotenv-php  &lt;/li&gt;&#xA;&lt;li&gt;johnathanmiller/secure-env-php&lt;/li&gt;&#xA;&lt;li&gt;psecio/secure_dotenv  &lt;/li&gt;&#xA;&lt;li&gt;josegonzalez/php-dotenv&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Has anyone done something like this?&#xA;The environment is still &quot;polluted&quot;, but it won't be in plain text when it's logged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is good enough for me, but &quot;roll your own security/crypto&quot; isn't the best idea... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 5 - Something I do not know about yet?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know something I don't? Please tell me!&#xA;Do you have any suggestions for further reading?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update / clarification:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a bit more context, that I left out of the original post to try to keep it a bit more simple:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm writing a lot about &quot;I&quot; and &quot;me&quot;, but I'm part of a bigger team of developers and ops-people from a provider.&lt;/li&gt;&#xA;&lt;li&gt;We're using AWS CloudWatch, and all our logs are sent to this service.&lt;/li&gt;&#xA;&lt;li&gt;We're following a set of company imposed security guidelines that requires us to evaluate the storage and &quot;containment&quot; of secrets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm not really afraid of the people having access to the server.&#xA;If they have access, they most likley know about, and can access the secrets in .env directly anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm more concerned about a rouge debug-statment in our code, a bug in Craft / Yii / a plugin or something like that, that exposes the secrects inadvertently. So option 1, turning off logging, doesn't really solve the problem either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More people have access to the AWS dashboards / CloudWatch, also the ops-people that are on rotation in the evening/nights, who may or may not have in depth knowledge about our application, or what data not to send around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would also be nice to have some sort of dashboard on a giant screen of our own in the office, showing the status and latest errors on the servers, without having to worry about random guests or colleagues from other departments seeing our precious credentials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this was my own personal server setup, with just me as a user/developer, I'd not think of this whole thing as a problem.&lt;/p&gt;&#xA;" OwnerUserId="9557" LastEditorUserId="9557" LastEditDate="2019-04-01T07:51:44.877" LastActivityDate="2019-04-01T07:51:44.877" Title="How do I prevent secrets beeing logged in the PHP error log?" Tags="&lt;craft3&gt;&lt;config&gt;&lt;php&gt;&lt;security&gt;&lt;logging&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29976" PostTypeId="2" ParentId="29975" CreationDate="2019-03-29T10:27:22.340" Score="1" Body="&lt;p&gt;First, full disclosure here, the company I work for is a customer of Fort Rabbit. The &lt;code&gt;secrets.json&lt;/code&gt; approach is something I think that strikes the balance between flexibility and security for really sensitive keys like API, OAuth, Amazon S3 and other sensitive secrets. dotenv is great, but having these in plain text is a risk, which I think you are mindful of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach I take is to use the &lt;code&gt;secrets.json&lt;/code&gt; concept. With Craft 3, you can make your secrets available as environment variables, but they won't be visible when dumping out phpinfo().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;secrets.json&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;CUSTOM&quot;: {&#xA;      &quot;SECRET_KEY_1&quot;: &quot;secretValue&quot;,&#xA;      &quot;SECRET_KEY_2&quot;: &quot;anotherSecretValue&quot;&#xA;      ....&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;config/app.php&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create secrets as env variables&#xA;if (getenv('APP_SECRETS')) {&#xA;&#xA;    $secrets = json_decode(file_get_contents(getenv('APP_SECRETS')), true);&#xA;&#xA;    if (isset($secrets['CUSTOM'])) {&#xA;        foreach($secrets['CUSTOM'] as $k =&amp;gt; $v) {&#xA;            putenv(&quot;$k=$v&quot;);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;.env&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;APP_SECRETS=&quot;/app/secrets.json&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You set the &lt;code&gt;APP_SECRETS&lt;/code&gt; environment variable which will be the file path to your JSON file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then reference the values in &lt;code&gt;secrets.json&lt;/code&gt; as environment variables with &lt;code&gt;getenv()&lt;/code&gt; and even the Craft &lt;code&gt;$SECRET_KEY_1&lt;/code&gt; syntax if a plugin supports &lt;code&gt;Craft::parseEnv&lt;/code&gt; on a field/setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is however a bit bespoke and tailored to Fort Rabbit's environment, but the concept can be applied generally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the whole other argument about dotenv in production due to the overhead and performance impact, but that's another story!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure there is a perfect solution, but I hope that gives you one example or what I'd consider &quot;good practice&quot;.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2019-03-30T14:48:05.293" LastActivityDate="2019-03-30T14:48:05.293" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29977" PostTypeId="1" CreationDate="2019-03-29T10:45:44.427" Score="2" ViewCount="158" Body="&lt;p&gt;In Craft 3 Sites, there are some default fields like language, handle, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to add additional fields. Is this possible. Specifically, I want to add an Image field so we can add a flag that we will use in the front end switcher. We also use Geo location and the Geo location databases have their own country identifiers (e.g. Maxmind returns GB for UK), and so I would like to have a field for the Maxmind country code when creating a site so we can match it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I could probably create a new channel or globals in which we can enter the Site handle, then fetch this data for the site on the front end, but it would be cleaner to have additional fields in the Sites settings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4993" LastActivityDate="2019-03-29T13:39:31.527" Title="How can additional custom fields be added to the Sites settings?" Tags="&lt;craft3&gt;&lt;custom-field&gt;&lt;sites&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29978" PostTypeId="1" CreationDate="2019-03-29T11:19:01.023" Score="1" ViewCount="109" Body="&lt;p&gt;How can I clear products template cache after update sale ?&#xA;Because product price don't change ...&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6079" LastActivityDate="2019-03-29T22:30:19.020" Title="Clear template cache after update sale on Craft Commerce" Tags="&lt;plugin-craftcommerce&gt;&lt;cache&gt;&lt;craft2&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29980" PostTypeId="2" ParentId="29977" CreationDate="2019-03-29T13:39:31.527" Score="2" Body="&lt;p&gt;I would say the easiest thing is to create a set of Globals with all site specific settings. You can include custom settings for sites via Behaviors and Events and include your custom HTML and run custom logic to store those values in custom tables but I doubt it's worth it. A global set should be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way: GlobalSets are site specific - you don't need to include a site handle or something. Just insert different settings for each site, Craft will fetch the correct one by itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to loop a set for all sites&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-TWIG prettyprint-override&quot;&gt;&lt;code&gt;{% for site in craft.app.getSites().getAllSites() %}&#xA;    {% set globalSet = craft.app.globals.getSetByHandle('myset', site.id) %}&#xA;    {{ globalSet.myValue }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-03-29T13:39:31.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29981" PostTypeId="1" CreationDate="2019-03-29T15:19:25.397" Score="1" ViewCount="87" Body="&lt;p&gt;What's the most performant way to get reverse related entries within an Element Query?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a contrived example of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have thousands of &quot;book&quot; entries and thousands of &quot;collection&quot; entries. I need to generate a list of all the books and present a comma separated list of the collections it appears in. Some books might be in 10 collections, some might be in 50+.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the code below creates the n+1 query problem. But I can't eager load this because this is a reverse relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I achieve this in a more performant way?&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;?php&#xA;&#xA;$query = Entry::find()&#xA;    -&amp;gt;section('books')&#xA;    -&amp;gt;all();&#xA;&#xA;foreach ($query as $book) {&#xA;  $data[] = [&#xA;    &quot;title&quot; =&amp;gt; $book-&amp;gt;title,&#xA;    &quot;author&quot; =&amp;gt; $book-&amp;gt;authorName,&#xA;    &quot;inCollections&quot; =&amp;gt; $this-&amp;gt;_getBookCollections($book)&#xA;  ];&#xA;}&#xA;&#xA;// ... later in the class&#xA;&#xA;private function _getBookCollections($book)&#xA;{&#xA;    $query = Entry::find()&#xA;      -&amp;gt;section('collections')&#xA;      -&amp;gt;relatedTo($book)&#xA;      -&amp;gt;all();&#xA;&#xA;    return implode(&quot;, &quot;, ArrayHelper::getColumn($query, &quot;title&quot;));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="712" LastActivityDate="2019-03-29T15:19:25.397" Title="What's the most performant way to get reverse related entries within an Element Query?" Tags="&lt;plugin-development&gt;&lt;relations&gt;&lt;performance&gt;&lt;query&gt;&lt;elementquery&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29982" PostTypeId="2" ParentId="29970" CreationDate="2019-03-29T18:47:37.513" Score="1" Body="&lt;p&gt;This could be due to an issue with your project-config being out of sync somehow. You could try the new &lt;code&gt;./craft project-config/rebuild&lt;/code&gt; console command &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#3120---2019-03-27&quot; rel=&quot;nofollow noreferrer&quot;&gt;that's just been added to Craft&lt;/a&gt; and see if that gets you back on track.&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2019-03-29T18:47:37.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29984" PostTypeId="1" AcceptedAnswerId="29991" CreationDate="2019-03-29T19:20:36.557" Score="1" ViewCount="278" Body="&lt;p&gt;Folks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been running this site for 2 years without issue but today, this cropped up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;CDbTransaction is inactive and cannot perform commit or roll back operations.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This occurs when adding a product to the cart. Note that this only occurs on a specific set of products. Others do not have this issue. And the product is added to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full error from the logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2019/03/29 15:33:54 [error] [exception.CDbException] exception 'CDbException' with message 'CDbTransaction is inactive and cannot perform commit or roll back operations.' in /usr/home/business/domain.com/craft/app/framework/db/CDbTransaction.php:84&#xA;Stack trace:`&#xA;#0 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(124): CDbTransaction-&amp;gt;rollback()`&#xA;#1 /usr/home/business/domain.com/craft/plugins/commerce/controllers`/Commerce_CartController.php(173): ``Craft\Commerce_CartService-&amp;gt;addToCart(Object(Craft\Commerce_OrderModel), '762', '1', '', Array, '')&#xA;#2 /usr/home/business/domain.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\Commerce_CartController-&amp;gt;actionUpdateCart()&#xA;#3 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#4 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#5 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#6 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('updateCart')&#xA;#7 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication-&amp;gt;runController('commerce/cart/u...')&#xA;#8 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#9 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#10 /usr/home/business/domain.com/craft/app/index.php(73): CApplication-&amp;gt;run()&#xA;#11 /usr/home/business/domain.com/public_html/index.php(20): require_once('/usr/home/business/...')&#xA;#12 {main}&#xA;REQUEST_URI=/support/replacementparts&#xA;HTTP_REFERER=https://www.domain.com/support/replacementparts`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Interestingly, the client encountered a different error when adding a product to the cart: &quot;Property &quot;Craft\Commerce_ProductModel.product&quot; is not defined.&quot; From the logs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2019/03/29 17:59:31 [error] [exception.CException] exception 'CException' with message 'Property &quot;Craft\Commerce_ProductModel.product&quot; is not defined.' in /usr/home/business/domain.com/craft/app/framework/base/CComponent.php:130&#xA;Stack trace:&#xA;#0 /usr/home/business/domain.com/craft/app/models/BaseModel.php(87): CComponent-&amp;gt;__get('product')&#xA;#1 /usr/home/business/domain.com/craft/app/models/BaseElementModel.php(141): Craft\BaseModel-&amp;gt;__get('product')&#xA;#2 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(644): Craft\BaseElementModel-&amp;gt;__get('product')&#xA;#3 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(411): Craft\InstantAnalyticsService-&amp;gt;_pullDataFromField(Object(Craft\Commerce_ProductModel), 'product_name')&#xA;#4 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(512): Craft\InstantAnalyticsService-&amp;gt;addProductDataFromLineItem(Object(Craft\IAnalytics), Object(Craft\Commerce_LineItemModel))&#xA;#5 /usr/home/business/domain.com/craft/plugins/instantanalytics/InstantAnalyticsPlugin.php(107): Craft\InstantAnalyticsService-&amp;gt;removeFromCart(NULL, Object(Craft\Commerce_LineItemModel))&#xA;#6 [internal function]: Craft\InstantAnalyticsPlugin-&amp;gt;Craft\{closure}(Object(Craft\Event))&#xA;#7 /usr/home/business/domain.com/craft/app/framework/base/CComponent.php(567): call_user_func(Object(Closure), Object(Craft\Event))&#xA;#8 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(573): CComponent-&amp;gt;raiseEvent('onBeforeRemoveF...', Object(Craft\Event))&#xA;#9 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(506): Craft\Commerce_CartService-&amp;gt;onBeforeRemoveFromCart(Object(Craft\Event))&#xA;#10 /usr/home/business/domain.com/craft/plugins/commerce/controllers/Commerce_CartController.php(107): Craft\Commerce_CartService-&amp;gt;removeFromCart(Object(Craft\Commerce_OrderModel), '21997')&#xA;#11 /usr/home/business/domain.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\Commerce_CartController-&amp;gt;actionRemoveLineItem()&#xA;#12 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction-&amp;gt;runWithParams(Array)&#xA;#13 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController-&amp;gt;runAction(Object(CInlineAction))&#xA;#14 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController-&amp;gt;runActionWithFilters(Object(CInlineAction), Array)&#xA;#15 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController-&amp;gt;run('removeLineItem')&#xA;#16 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication-&amp;gt;runController('commerce/cart/r...')&#xA;#17 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&amp;gt;_processActionRequest()&#xA;#18 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&amp;gt;processRequest()&#xA;#19 /usr/home/business/domain.com/craft/app/index.php(73): CApplication-&amp;gt;run()&#xA;#20 /usr/home/business/domain.com/public_html/index.php(20): require_once('/usr/home/business/...')&#xA;#21 {main}&#xA;REQUEST_URI=/commerce/cart&#xA;HTTP_REFERER=https://www.domain.com/commerce/cart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still on Craft2 and Commerce1 with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance would be great.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastEditorUserId="4506" LastEditDate="2019-03-29T19:32:53.333" LastActivityDate="2019-03-30T14:43:25.173" Title="CDbTransaction is inactive and cannot perform commit or roll back operations" Tags="&lt;plugin-craftcommerce&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29985" PostTypeId="2" ParentId="29950" CreationDate="2019-03-29T19:35:34.187" Score="1" Body="&lt;p&gt;That will give you all entries, from today (so not past entries) starting after 5PM:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{% set startAfterTime = '17.00'|date('U') %}&#xA;{% set today = now|atom|date %}&#xA;&#xA;{% set events = craft.entries()&#xA;    .section('events')&#xA;    .status(['live', 'pending'])&#xA;    .postDate('&amp;gt;=' ~ today )&#xA;    .eventStartTime('&amp;gt;=' ~ startAfterTime)&#xA;    .all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3630" LastEditorUserId="3630" LastEditDate="2019-03-30T16:03:30.467" LastActivityDate="2019-03-30T16:03:30.467" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29986" PostTypeId="2" ParentId="29978" CreationDate="2019-03-29T22:30:19.020" Score="2" Body="&lt;p&gt;More than likely the issue is not the prices not updating, but the sale conditions as Luke mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, Craft will automatically clear template caches when an element within the cached region is updated (note one trap is this process of deleting stale template caches runs as a job task, so may not happen absolutely &lt;em&gt;immediately&lt;/em&gt;...give things 30 seconds or so before you check them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If things don't seem to be working for whatever reason, you can clear caches manually using the Craft control panel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, in case it is somehow cache related:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 2: Control panel -&gt; settings -&gt; clear caches&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BT32C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BT32C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Craft 3:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are now console commands to clear caches (run &lt;code&gt;./craft&lt;/code&gt; on its own and it will list all of the available commands e.g. &lt;code&gt;./craft clear-caches/template-caches&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, you can of course still use the control panel-&gt; utilities -&gt; clear caches&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dn55o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dn55o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastActivityDate="2019-03-29T22:30:19.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29988" PostTypeId="2" ParentId="16260" CreationDate="2019-03-30T10:44:45.913" Score="2" Body="&lt;p&gt;For search autocomplete functionality, you can use &lt;a href=&quot;https://github.com/craftcms/element-api&quot; rel=&quot;nofollow noreferrer&quot;&gt;Element API&lt;/a&gt; plugin. It creates API endpoint that can be queried with ajax and it will return JSON (or any other format) results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my blog you will find how to implement search autocomplete functionality this way:&#xA;&lt;a href=&quot;http://craftsnippets.com/articles/search-autocomplete-component-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftsnippets.com/articles/search-autocomplete-component-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-03-30T10:44:45.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29989" PostTypeId="2" ParentId="7104" CreationDate="2019-03-30T10:54:43.510" Score="1" Body="&lt;p&gt;Here is Craft CMS 3 solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftsnippets.com/articles/quick-edit&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftsnippets.com/articles/quick-edit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works both with entries and categories and it takes multiple things into account while deciding if edit link should be displayed:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the current user has access rights to control panel?&lt;/li&gt;&#xA;&lt;li&gt;If the current user has rights to edit current entry/category?&lt;/li&gt;&#xA;&lt;li&gt;If entry/category is not displayed through live preview?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-03-30T10:54:43.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29990" PostTypeId="1" AcceptedAnswerId="33005" CreationDate="2019-03-30T12:09:25.753" Score="2" ViewCount="3665" Body="&lt;p&gt;I'm trying to run a check within my &lt;code&gt;_layout.html' to remove the navigation bar if the user is on the homepage. I've tried with the following code below, but browsing to a page which is the&lt;/code&gt;index.html` of a Channel breaks the code with the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Variable &quot;entry&quot; does not exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the code within my &lt;code&gt;_layout.html&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set handle = entry.section.handle %}&#xA;{% if handle == 'homepage' %}&#xA;{% else %}&#xA;  {% if not craft.app.user.isGuest %}&#xA;      {% set users = craft.users %}&#xA;      {% include '_navigation'%}&#xA;    {% else %}&#xA;  {% endif %}&#xA;{% endif %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2020-11-29T18:46:55.880" Title="Check if current page is the homepage" Tags="&lt;templating&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29991" PostTypeId="2" ParentId="29984" CreationDate="2019-03-30T14:43:25.173" Score="1" Body="&lt;p&gt;After some mucking around, I traced this to the InstantAnalytics plug-in. Essentially, I had changed the setting Commerce Product Brand Field from &quot;none&quot; to &quot;Name&quot;. This worked fine for most products but not all. Reverting this back to &quot;none&quot; fixed the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page was helpful: &lt;a href=&quot;https://github.com/verbb/multi-add/issues/8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/verbb/multi-add/issues/8&lt;/a&gt;. Particularly the bit of commenting out &lt;code&gt;$transaction-&amp;gt;rollback();&lt;/code&gt; in Commerce_CartService.php. That provided an error in the log that led right to the issue.&lt;/p&gt;&#xA;" OwnerUserId="4506" LastActivityDate="2019-03-30T14:43:25.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29992" PostTypeId="2" ParentId="29990" CreationDate="2019-03-30T14:58:58.143" Score="2" Body="&lt;p&gt;To prevent a Twig exception, you may wish to use &lt;code&gt;entry is defined&lt;/code&gt; to catch this error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://twig.symfony.com/doc/2.x/tests/defined.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twig.symfony.com/doc/2.x/tests/defined.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to detect the homepage would be looking at the request with &lt;code&gt;craft.app.request&lt;/code&gt;, something like &lt;code&gt;craft.app.request.pathInfo&lt;/code&gt;, if it equals &lt;code&gt;/&lt;/code&gt;, then you've got your condition.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="5193" LastEditDate="2019-03-30T15:28:02.647" LastActivityDate="2019-03-30T15:28:02.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29993" PostTypeId="1" AcceptedAnswerId="30035" CreationDate="2019-03-30T19:00:26.787" Score="1" ViewCount="354" Body="&lt;p&gt;I have a multi site setup for supporting multiple languages in Craft 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;'/' =&amp;gt; German&#xA;'/en/' =&amp;gt; English&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my general.php I have &lt;code&gt;'errorTemplatePrefix' =&amp;gt; 'error/',&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I enter '/notexisting', my &lt;code&gt;error/error.twig&lt;/code&gt; gets called. But when I enter '/en/notexisting', then the default Craft error message gets displayed &quot;Page Not Found, Template not found: notexisting&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get my &lt;code&gt;error.twig&lt;/code&gt; called also for other sites?&lt;/p&gt;&#xA;" OwnerUserId="9172" LastActivityDate="2019-04-05T06:18:24.687" Title="Error pages in multi site setup" Tags="&lt;craft3&gt;&lt;multi-site&gt;&lt;error-handling&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29995" PostTypeId="2" ParentId="29967" CreationDate="2019-03-30T23:08:33.053" Score="2" Body="&lt;p&gt;This should do what you're looking for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set event = craft.entries({&#xA;    section: 'events',&#xA;    startDate: 'and, &amp;gt;= ' ~ formYear ~ ', &amp;lt; ' ~ (formYear + 1)&#xA;}).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-30T23:08:33.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29996" PostTypeId="2" ParentId="29935" CreationDate="2019-03-30T23:23:12.390" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How to achieve the same functionality on Craft 3?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a MySQL specific answer (Craft 3 supports PostgreSQL as well), but you probably just need to escape your column names like so and that should solve both of your problems:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entries = craft.entries({ section: &quot;test&quot;}).order(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc&quot;).all() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-03-30T23:23:12.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29997" PostTypeId="1" CreationDate="2019-03-31T03:04:15.747" Score="1" ViewCount="160" Body="&lt;p&gt;I've set up a category field for events. Multiple categories can be chosen. And I've set up a form to &quot;filter&quot; events to a specific category using query parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The URL looks something like this (simplified; region is the category):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;domain.com/events/month?&amp;amp;region=portland&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a way to show events that pertain to the category param in the month view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Been banging my head and can't figure it out.&lt;/p&gt;&#xA;" OwnerUserId="256" LastActivityDate="2019-03-31T22:48:33.563" Title="Show events in month by specific category - Solspace Calendar" Tags="&lt;craft3&gt;&lt;plugin-solspacecalendar&gt;&lt;calendar&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29998" PostTypeId="1" AcceptedAnswerId="30095" CreationDate="2019-03-31T18:12:24.270" Score="1" ViewCount="292" Body="&lt;p&gt;Has anyone had success with using Craft and WTServer (WinNMP) together? I'm getting a 400 error at &quot;&lt;a href=&quot;http://craft.test/index.php?p=admintrigger/actions/users/login&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craft.test/index.php?p=admintrigger/actions/users/login&lt;/a&gt;&quot; after trying to login the admin. I'm suspicious that my Nginx config rewrites aren't working, but unsure how to troubleshoot it. The front-end displays fine, and the login screen works but the login submit throws the 400 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;nginx server block...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;&#xA;listen      127.0.0.1:80;&#xA;server_name     craft.test craft.dev;&#xA;charset utf-8;&#xA;root    &quot;c:/wtserver/www/craft/web&quot;; # locked&#xA;allow       127.0.0.1;&#xA;deny        all;&#xA;index index.html index.htm index.php;&#xA;ssi on;&#xA;client_max_body_size 0;&#xA;error_page 404 /index.php?$query_string;&#xA;&#xA;location / {&#xA;    try_files $uri/index.html $uri $uri/ /index.php?$query_string;&#xA;}&#xA;&#xA;location ~ [^/]\.php(/|$) {&#xA;    try_files $uri $uri/ /index.php?$query_string;&#xA;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&#xA;    # Change this to whatever version of php you are using&#xA;    include     nginx.fastcgi.conf;&#xA;    include     nginx.redis.conf;&#xA;    fastcgi_pass    php_farm;&#xA;    fastcgi_hide_header X-Powered-By;&#xA;&#xA;    add_header Last-Modified $date_gmt;&#xA;    add_header Cache-Control &quot;no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0&quot;;&#xA;    if_modified_since off;&#xA;    expires off;&#xA;    etag off;&#xA;&#xA;    fastcgi_intercept_errors off;&#xA;    fastcgi_buffer_size 16k;&#xA;    fastcgi_buffers 4 16k;&#xA;    fastcgi_connect_timeout 300;&#xA;    fastcgi_send_timeout 300;&#xA;    fastcgi_read_timeout 300;&#xA;}&#xA;&#xA;location ~ /\.(ht|svn|git) {&#xA;    deny all;&#xA;}&#xA;&#xA;sendfile off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;general.php&lt;/h3&gt;&#xA;&#xA;&lt;pre class=&quot;lang-PHP prettyprint-override&quot;&gt;&lt;code&gt;return [&#xA;// Global settings&#xA;'*' =&amp;gt; [&#xA;    // Default Week Start Day (0 = Sunday, 1 = Monday...)&#xA;    'defaultWeekStartDay' =&amp;gt; 1,&#xA;&#xA;    // Whether generated URLs should omit &quot;index.php&quot;&#xA;    'omitScriptNameInUrls' =&amp;gt; true,&#xA;&#xA;    // Control Panel trigger word&#xA;    'cpTrigger' =&amp;gt; 'admintrigger',&#xA;&#xA;    // The secure key Craft will use for hashing and encrypting data&#xA;    'securityKey' =&amp;gt; getenv('SECURITY_KEY'),&#xA;&#xA;    // Whether to save the project config out to config/project.yaml&#xA;    // (see https://docs.craftcms.com/v3/project-config.html)&#xA;    'useProjectConfigFile' =&amp;gt; false,&#xA;],&#xA;&#xA;// Dev environment settings&#xA;'dev' =&amp;gt; [&#xA;    // Dev Mode (see https://craftcms.com/guides/what-dev-mode-does)&#xA;    'devMode' =&amp;gt; true,&#xA;],&#xA;&#xA;// Staging environment settings&#xA;'staging' =&amp;gt; [&#xA;    // Set this to `false` to prevent administrative changes from being made on staging&#xA;    'allowAdminChanges' =&amp;gt; true,&#xA;],&#xA;&#xA;// Production environment settings&#xA;'production' =&amp;gt; [&#xA;    // Set this to `false` to prevent administrative changes from being made on production&#xA;    'allowAdminChanges' =&amp;gt; true,&#xA;],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Error in the Network console...&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rX4tP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rX4tP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;404s...&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;2019-04-07 10:54:44 [-][-][dc567ad367247e3bf37e7ce11ac60e93][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: favicon.ico in C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\controllers\TemplatesController.php:70&#xA;Stack trace:&#xA;0 [internal function]: craft\controllers\TemplatesController-&gt;actionRender('favicon.ico', Array)&#xA;1 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)&#xA;2 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)&#xA;3 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Controller.php(109): yii\base\Controller-&gt;runAction('render', Array)&#xA;4 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller-&gt;runAction('render', Array)&#xA;5 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(297): yii\base\Module-&gt;runAction('templates/rende...', Array)&#xA;6 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\web\Application.php(103): craft\web\Application-&gt;runAction('templates/rende...', Array)&#xA;7 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(286): yii\web\Application-&gt;handleRequest(Object(craft\web\Request))&#xA;8 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))&#xA;9 C:\WinNMP\WWW\craft\web\index.php(21): yii\base\Application-&gt;run()&#xA;10 {main}&lt;/p&gt;&#xA;" OwnerUserId="9562" LastEditorUserId="9562" LastEditDate="2019-05-05T17:17:33.593" LastActivityDate="2019-05-05T17:17:33.593" Title="CraftCMS config on WTServer / WinNMP for Windows with Nginx" Tags="&lt;craft3&gt;&lt;nginx&gt;&lt;yii&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29999" PostTypeId="2" ParentId="29998" CreationDate="2019-03-31T18:45:00.533" Score="1" Body="&lt;p&gt;This is my clean wtserver/winnmp nginx conf file for Craft (and pretty much anything else like Laravel etc.).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;server {&#xA;&#xA;    listen          127.0.0.1:80;&#xA;    server_name     icraft.test; # locked&#xA;    root            &quot;c:\web\icraft\public&quot;; # locked&#xA;&#xA;    allow           127.0.0.1;&#xA;    deny            all;&#xA;    autoindex       on;&#xA;&#xA;    location / {&#xA;        try_files $uri $uri/ /index.php?$query_string;&#xA;    }&#xA;&#xA;    location ~ \.php$ {&#xA;        try_files $uri =404;&#xA;        include         nginx.fastcgi.conf;&#xA;        include         nginx.redis.conf;&#xA;        fastcgi_pass    php_farm;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming you installed winnmp to &lt;code&gt;c:\web\winnmp&lt;/code&gt;, this file would go to &lt;code&gt;c:\web\winnmp\conf\domains.d\icraft.conf&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can drop the &lt;code&gt;index.php?p=&lt;/code&gt; part (just use pretty URLs) - if you're still having issues, post your &lt;code&gt;config\general.php&lt;/code&gt;, you might have a Craft config issue.&lt;/p&gt;&#xA;" OwnerUserId="1091" LastActivityDate="2019-03-31T18:45:00.533" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30000" PostTypeId="2" ParentId="29997" CreationDate="2019-03-31T22:48:33.563" Score="1" Body="&lt;p&gt;Figured it out. For anyone else seeing this later on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set regionCategory = craft.categories.group('eventRegions').slug(region).one() %}&#xA;&#xA;{% set month = craft.calendar.month({ relatedTo: regionCategory }) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="256" LastActivityDate="2019-03-31T22:48:33.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30001" PostTypeId="1" CreationDate="2019-04-01T01:18:43.350" Score="1" ViewCount="598" Body="&lt;p&gt;I have a Craft instance running via Valet, per the instructions &lt;a href=&quot;https://medium.com/@jalendport/running-craft-cms-3-on-laravel-valet-6df61e5193fd&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running the project via &lt;code&gt;valet link&lt;/code&gt; works great, and &lt;code&gt;valet share&lt;/code&gt; works, except when I try to access the admin side. I'm using &lt;code&gt;valet share&lt;/code&gt; to try to access the site over a local network for a demo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Chrome from &lt;code&gt;http://ad3f5068.ngrok.io/admin/login&lt;/code&gt; when I try to log in, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPTIONS http://craftycoffee.test:60/index.php?p=admin/actions/users/login 404 (Not Found)&#xA;Access to XMLHttpRequest at 'http://craftycoffee.test:60/index.php?p=admin/actions/users/login' from origin 'http://ad3f5068.ngrok.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I use HTTPS, I get net::ERR_SSL_PROTOCOL_ERROR across a bunch of requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing to get this to share over a local host?&lt;/p&gt;&#xA;" OwnerUserId="9418" LastEditorUserId="9418" LastEditDate="2019-04-01T20:22:23.120" LastActivityDate="2019-04-01T20:22:23.120" Title="valet share, ngrok giving 404, CORS errors" Tags="&lt;hosting&gt;&lt;valet&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30002" PostTypeId="2" ParentId="29925" CreationDate="2019-04-01T09:42:09.490" Score="2" Body="&lt;p&gt;This was solved in my latest release: &lt;a href=&quot;https://github.com/mustasj/expanded-search/releases&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mustasj/expanded-search/releases&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to use it with pagination, you can now add &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;offset&lt;/code&gt; to the settings param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case the top of your template would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set limit = 10 %}&#xA;{% set entries = craft.entries()&#xA;    .search(searchQuery)&#xA;    .orderBy('score')&#xA;    .limit(limit) %}&#xA;&#xA;{# Paginate the entries #}&#xA;{% paginate entries as pageInfo, pageEntries %}&#xA;{% set expandedResults = craft.expandedSearch.search(searchQuery, {&#xA;    length: 155,&#xA;    offset: (pageInfo.currentPage - 1) * limit,&#xA;    limit: limit&#xA;}) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="968" LastActivityDate="2019-04-01T09:42:09.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30003" PostTypeId="2" ParentId="30001" CreationDate="2019-04-01T12:43:07.837" Score="2" Body="&lt;p&gt;I'm not 100% sure this is the answer to your issue; but this &lt;em&gt;might&lt;/em&gt; be the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Helge has written an article &lt;a href=&quot;https://startingcraft.com/articles/how-to-use-ngrok-with-craftcms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; about using ngrok with Craft CMS (which I'd recommend looking over if you haven't already). In particular, he mentions he has the following lines in his Craft config particularly for logging into the CP over ngrok:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Logging in to the CP will fail unless you turn off CSRF protection.&#xA;'enableCsrfProtection' =&amp;gt; false,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try that config option and see if that fixes the issue for you...&lt;/p&gt;&#xA;" OwnerUserId="5275" LastActivityDate="2019-04-01T12:43:07.837" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30005" PostTypeId="1" CreationDate="2019-04-01T19:28:26.897" Score="1" ViewCount="335" Body="&lt;p&gt;Running Craft 3.1.19 and have started getting twig error in the control panel.  When I click on the utilities link I get this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Declaration of craft\web\twig\Environment::compileSource(Twig\Source $source) should be compatible with Twig_Environment::compileSource(Twig_Source $source)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when I try to create a new field I get this error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Key &quot;defaultUploadLocationSubpath&quot; in object with ArrayAccess of class &quot;craft\fields\Assets&quot; does not exist.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any idea what is going on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="57" LastEditDate="2019-04-01T20:54:02.340" LastActivityDate="2019-04-04T13:26:02.040" Title="Twig errors on v3.1.19" Tags="&lt;templating&gt;&lt;error&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30006" PostTypeId="2" ParentId="30005" CreationDate="2019-04-01T20:56:49.397" Score="0" Body="&lt;p&gt;Updating to the latest release (currently &lt;a href=&quot;https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#31201---2019-03-27&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft 3.1.20.1&lt;/a&gt;) should fix your first error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if it'll fix your second one, but comment back here if it doesn't.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-04-01T20:56:49.397" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="30007" PostTypeId="1" AcceptedAnswerId="30008" CreationDate="2019-04-02T06:53:19.280" Score="1" ViewCount="55" Body="&lt;p&gt;I have a redactor field whose HTML contents contain links to other parts of the website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I render variables located in the HTML content of a Redactor field in Twig?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample redactor content:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;{{ siteUrl }}contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In output of this results in the braces being encoded:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;%7B%7B%20siteUrl%20%7D%7D/about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;%7B%7B%20siteUrl%20%7D%7D/contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want it the output to be whatever &lt;code&gt;siteUrl&lt;/code&gt; is. Eg on &lt;strong&gt;localhost&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;http://localhost/about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;  &amp;lt;li&amp;gt;&amp;lt;a href=&quot;http://localhost/contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#xA;&amp;lt;/ul&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9254" LastActivityDate="2019-04-02T07:45:26.430" Title="String interpolation in Redactor" Tags="&lt;templating&gt;&lt;redactor&gt;&lt;string&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30008" PostTypeId="2" ParentId="30007" CreationDate="2019-04-02T07:45:26.430" Score="1" Body="&lt;p&gt;Redactor fields are not meant to process twig both for security reasons (as they can be changed by any user) and for usability (you cannot expect authors to remember / preserve twig tags).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific example, the site url is probably not necessary (starting a URL with / will link to the current domain just fine) - so you would not actually need twig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I cannot think of one good reason to build a menu in a redactor field. I would either include it directly in the page templates (.twig files) or use a matrix field as a &lt;a href=&quot;https://nystudio107.com/blog/creating-a-content-builder-in-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;content builder&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8431" LastActivityDate="2019-04-02T07:45:26.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30009" PostTypeId="1" CreationDate="2019-04-02T09:28:57.793" Score="1" ViewCount="191" Body="&lt;p&gt;I have a section with a Super Table field that has an entry field. &#xA;Now I want to find the entries that have a relation to that entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this answer here. This but I can not get it to work with the entry field type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://craftcms.stackexchange.com/questions/27345/query-on-super-table-fields-date-field&quot;&gt;query on Super Table field&amp;#39;s date field&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; $events = Entry::find()&#xA;        -&amp;gt;section('foo')&#xA;        -&amp;gt;leftJoin('supertableblocks', 'supertableblocks.ownerId = entries.id')&#xA;        -&amp;gt;leftJoin('stc_foo', 'stc_foo.elementId = supertableblocks.id')&#xA;        -&amp;gt;groupBy('supertableblocks.ownerId')&#xA;        -&amp;gt;where(I don't know what to do here with the entry field)&#xA;        -&amp;gt;all();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9005" LastActivityDate="2019-04-02T09:28:57.793" Title="Query on Super Table field's entry field" Tags="&lt;craft3&gt;&lt;plugin-supertable&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30011" PostTypeId="2" ParentId="16081" CreationDate="2019-04-02T09:37:04.303" Score="1" Body="&lt;p&gt;For anyone interested, you can use &lt;a href=&quot;https://github.com/lukeyouell/craft-contactformtemplates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contact Form Templates&lt;/a&gt; to make custom email templates in Craft CMS 3.&lt;/p&gt;&#xA;" OwnerUserId="9573" LastActivityDate="2019-04-02T09:37:04.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30012" PostTypeId="2" ParentId="29744" CreationDate="2019-04-02T15:47:11.533" Score="1" Body="&lt;p&gt;Just to update this with an answer, thanks very much to P&amp;amp;T's excellent dev team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The model implementing &lt;code&gt;RequestResponseInterface&lt;/code&gt; returned from the gateway's &lt;code&gt;authorize()&lt;/code&gt; method &lt;code&gt;isSuccessful()&lt;/code&gt; method should &lt;strong&gt;only return true when completing a payment&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also had to return false on the &lt;code&gt;isProcessing()&lt;/code&gt; method during my tests. Not sure what that method does but setting both those methods to return &lt;code&gt;false&lt;/code&gt; fixed the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was a recent change in the commerce code that identified this bug in my gateway's code.&lt;/p&gt;&#xA;" OwnerUserId="365" LastActivityDate="2019-04-02T15:47:11.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30014" PostTypeId="2" ParentId="29739" CreationDate="2019-04-02T23:48:44.153" Score="16" Body="&lt;p&gt;For future reference, I had the same error and resolved it with Craft Support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case the project.yaml file got out of sync with what was in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running craft project-config/rebuild from the project's root resolved the issue and allowed us to re-enable the plugins&lt;/p&gt;&#xA;" OwnerUserId="196" LastActivityDate="2019-04-02T23:48:44.153" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30015" PostTypeId="1" CreationDate="2019-04-03T01:38:35.573" Score="1" ViewCount="162" Body="&lt;p&gt;I am getting the following error when trying to save a structured entry:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Could not generate a unique URI based on the URI format.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Title of entry is: Hells Gate Mud Bath &amp;amp; Spa&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slug: &lt;code&gt;hells-gate-mud-bath-spa&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entry title is 100% unique also. Any ideas what is causing this and what the fix may be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PypKQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PypKQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9576" LastEditorUserId="5557" LastEditDate="2019-04-04T16:53:53.300" LastActivityDate="2019-04-04T16:53:53.300" Title="Unique URI error" Tags="&lt;entry&gt;&lt;error-message&gt;&lt;entry-slug&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30016" PostTypeId="2" ParentId="30015" CreationDate="2019-04-03T01:43:13.567" Score="3" Body="&lt;p&gt;Turns out the error was because {slug} was missing from the Section Setting: Entry URI Format&lt;/p&gt;&#xA;" OwnerUserId="9576" LastActivityDate="2019-04-03T01:43:13.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30017" PostTypeId="2" ParentId="29973" CreationDate="2019-04-03T09:03:46.043" Score="1" Body="&lt;p&gt;So based on a bit of research. I don't think you necessarily have to create a settings model, if the settings are purely required from a config file. You could use something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$settings = Craft::$app-&amp;gt;config-&amp;gt;getConfigFromFile('configfilename');&#xA;$exampleSettings = $settings['exampleSomething'];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;$settings&lt;/code&gt; would be an array, which you could then access each array key.&lt;/p&gt;&#xA;" OwnerUserId="5193" LastActivityDate="2019-04-03T09:03:46.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30018" PostTypeId="1" CreationDate="2019-04-03T09:25:17.407" Score="2" ViewCount="179" Body="&lt;p&gt;Our client wants a specific option built in Craft Commerce. I guess is possible, but don't know how? Maybe you can help me out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A customer selects a box: for example &quot;giftbox custom 4&quot; (priced $ 15). After selecting the box. The customer can pick 4 different tastes of chocolate cookies (e.g. 2 brownies, 2 white choco. etc). After picking the cookies, the client can add this to the cart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought is to use a note fields for this, storing all the cookie data. But how can I make sure that each &quot;giftbox custom 4&quot; is a unique line item? Now Craft is adding all the &quot;giftbox custom 4&quot; together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I want to create:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2x Giftbox custom 4&lt;/strong&gt;&lt;br&gt;&#xA;Containing: 2 caramel, 2 brownies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1x Giftbox custom 4&lt;/strong&gt;&lt;br&gt;&#xA;Containing: 1 white choco, 3 caramel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2x Giftbox custom 4&lt;/strong&gt;&lt;br&gt;&#xA;Containing: 2 dark choco, 1 caramel, 1 fruit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In total there a more than 14 different giftbox sizes. &#xA;Giftbox custom 2, Giftbox custom 4, Giftbox custom 6, etc.&lt;br&gt;&#xA;And you can choose from &gt; 30 different cookies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Luke Holder:&#xA;When I am using line-item options: For example: Giftbox 4 -&gt; with options ABCD.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After submitting: they appear in my basket. Perfect, and i can change the quantity of Giftbox 4 -&gt; with options ABCD . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I go back to the shop and add an extra giftbox to the cart: Giftbox 4 -&gt; with options EFGH. Giftbox 4 -&gt; with options ABCD are removed from my cart. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;So i want the &quot;Giftbox 4&quot; products separated:&lt;/em&gt;&lt;br&gt;&#xA;1x Giftbox 4 -&gt; with options ABCD .&lt;br&gt;&#xA;1x Giftbox 4 -&gt; with options EFGH&lt;/p&gt;&#xA;" OwnerUserId="9578" LastEditorUserId="9578" LastEditDate="2019-04-03T11:21:13.350" LastActivityDate="2019-04-30T16:25:07.310" Title="Craft Commerce cart product as unique product with different notes" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30019" PostTypeId="2" ParentId="30018" CreationDate="2019-04-03T10:02:00.097" Score="1" Body="&lt;p&gt;Line item options are built in and are designed exactly for this use-case: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/commerce/v2/adding-to-and-updating-the-cart.html#line-item-options-and-notes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-04-03T10:02:00.097" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30020" PostTypeId="2" ParentId="29888" CreationDate="2019-04-03T10:37:03.013" Score="1" Body="&lt;p&gt;It's not ideal, but you can use one template folder for each group and then create symbolic links for all the language sites.&lt;/p&gt;&#xA;" OwnerUserId="4975" LastActivityDate="2019-04-03T10:37:03.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30022" PostTypeId="1" CreationDate="2019-04-03T15:54:20.620" Score="1" ViewCount="40" Body="&lt;p&gt;I have a site where I'd like customers to login and be immediately presented with their profile page (and ONLY their profile page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On this page they can:&#xA;1. See progress reports on their jobs (custom fields)&#xA;2. Create new jobs and edit existing jobs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added a load of custom fields to the user group but I don't actually want the customers to be exposed to the admin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions for the process of creating this scenario?&lt;/p&gt;&#xA;" OwnerUserId="189" LastEditorUserId="57" LastEditDate="2019-04-03T20:23:54.340" LastActivityDate="2019-04-03T20:23:54.340" Title="Customer (Member) Profile Page" Tags="&lt;users&gt;&lt;user-profile&gt;&lt;custom-field&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30023" PostTypeId="2" ParentId="30018" CreationDate="2019-04-04T08:06:55.877" Score="0" Body="&lt;p&gt;Solved the problem. Omg, I forgot to enable Craft Commerce Pro. That's why it didn't work. &lt;/p&gt;&#xA;" OwnerUserId="9578" LastEditorUserId="57" LastEditDate="2019-04-04T21:05:21.120" LastActivityDate="2019-04-04T21:05:21.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30024" PostTypeId="2" ParentId="281" CreationDate="2019-04-04T09:00:04.747" Score="0" Body="&lt;p&gt;For anyone who is looking for an answer, noticed that this doesn't work without the date filter in craft 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.dateUpdated|date('Y-m-d') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or date time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.dateUpdated|date }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="421" LastEditorUserId="421" LastEditDate="2019-04-04T09:15:33.883" LastActivityDate="2019-04-04T09:15:33.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30025" PostTypeId="2" ParentId="6526" CreationDate="2019-04-04T10:46:48.897" Score="4" Body="&lt;p&gt;In Craft3, the correct way of setting HTTP status codes is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Craft::$app-&amp;gt;getResponse()-&amp;gt;setStatusCode(404);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9574" LastActivityDate="2019-04-04T10:46:48.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30026" PostTypeId="2" ParentId="30005" CreationDate="2019-04-04T13:26:02.040" Score="1" Body="&lt;p&gt;I also got the second error when trying to create a new field and the solution for me was running &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./craft clear-caches/all&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;after a refresh it started working again&lt;/p&gt;&#xA;" OwnerUserId="9406" LastActivityDate="2019-04-04T13:26:02.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30027" PostTypeId="2" ParentId="28123" CreationDate="2019-04-04T14:56:01.637" Score="1" Body="&lt;p&gt;I have the same issue. The Cloud server is running Plesk with multiple PHP versions. Even though the subdomain I install onto is set to PHP 7.2, SSH comes back as though it is PHP 5 - because SSH is ignoring what the domain is, and only looking at what the server is.&lt;/p&gt;&#xA;" OwnerUserId="9583" LastActivityDate="2019-04-04T14:56:01.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30028" PostTypeId="1" AcceptedAnswerId="30063" CreationDate="2019-04-04T14:57:13.287" Score="1" ViewCount="27" Body="&lt;p&gt;This is more advanced: We want to sell activation keys for digital products. We know that in Craft a variant has a stock. So every single item &quot;in&quot; the stock needs a unique activation key. When we sell one item of the stock we sell a activation key. Of course, an activation key can only be sold once. For each product we will have a limited number of activation keys, so this will be reflected by the stock number itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that this feature requires some customization. Question is: is this achievable in an easy or hard way via Craft Commerce? How would an elegant approach look like?&lt;/p&gt;&#xA;" OwnerUserId="9582" LastActivityDate="2019-04-08T10:05:13.420" Title="Individual persistent property per item in stock" Tags="&lt;plugin-craftcommerce&gt;&lt;stock&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30030" PostTypeId="1" CreationDate="2019-04-04T17:10:33.717" Score="1" ViewCount="34" Body="&lt;p&gt;I'm in the process of scoping out a project in Craft, which requires porting an existing site built in EE. The EE site in question relies quite heavily on relationships (using Playa) and not I'm 100% sure how/if Feed Me will be able to retain those relationships when importing into Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? Or will we have to remap the relationships &lt;em&gt;after&lt;/em&gt; importing the content?&lt;/p&gt;&#xA;" OwnerUserId="9087" LastActivityDate="2019-04-04T20:29:51.620" Title="Has anyone tried a port from Expression Engine to Craft using Verbb's Feed Me plugin?" Tags="&lt;plugin-feedme&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30031" PostTypeId="2" ParentId="30030" CreationDate="2019-04-04T20:29:51.620" Score="1" Body="&lt;p&gt;If you import the related items first then you should be able to make the relationship when you import the parent entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's really down to the complexity of the relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find it simpler to do the import in stages. Start with the bare bones to create entries with the appropriate names/slugs and then bring in the other data bit by bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would favour using XML or JSON for my import format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also find it useful to also include some craft fields into which I import the legacy EE id (and any other pertinent information).&lt;/p&gt;&#xA;" OwnerUserId="210" LastActivityDate="2019-04-04T20:29:51.620" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30033" PostTypeId="1" CreationDate="2019-04-05T04:49:28.467" Score="1" ViewCount="475" Body="&lt;p&gt;I've tried so many different things and can't get this to work...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set makeCat = craft.categories()&#xA;   .group('make')&#xA;   .orderBy('title')&#xA;   .limit(21) %}&#xA;&#xA;{% paginate makeCat as pageInfo, makeCars %}&#xA;{% for make in makeCars %}&#xA;{% set entries = craft.entries()&#xA;   .section('cars')&#xA;   .carStatus('Inventory')&#xA;   .relatedTo(make)&#xA;   .all() %}&#xA;&#xA;    {% for entry in entries %}&#xA;       &amp;lt;p&amp;gt;{{ entry.title }}&amp;lt;/p&amp;gt;&#xA;    {% endfor %}&#xA; {% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm trying to list cars with a status of 'Inventory', order them by a single category field alphabetically by car make and paginate...is this not possible in Craft?  This code gets me the closest but doesn't paginate properly.  I want the 60+ entries to paginate 21 per page but in order of the make of the car ie. BMW, Ferrari, Porsche, etc.  Not sure what I'm missing or doing wrong but any help and direction would be super!  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9585" LastEditorUserId="57" LastEditDate="2019-04-05T23:17:09.633" LastActivityDate="2019-04-05T23:17:09.633" Title="Order entries by a category field alphabetically then paginate" Tags="&lt;craft3&gt;&lt;categories&gt;&lt;pagination&gt;&lt;ordering&gt;&lt;relatedto&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30034" PostTypeId="2" ParentId="30033" CreationDate="2019-04-05T06:11:51.280" Score="3" Body="&lt;p&gt;In order to sort your entries by a related field you need to join the relations and the content table and sort your entries by the column you want. The it doesn't change the behavior of your paginate&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# the field ID of your relation field, you can as well grab it via #}&#xA;{# set field = craft.app.getFields().getFieldByHandle('carCategory').id #}&#xA;{% set fieldId = &amp;gt;&amp;gt; number &amp;lt;&amp;lt; %}&#xA;{% set entries = craft&#xA;    .entries&#xA;    .section('cars')&#xA;    .leftJoin('{{%relations}} as myrelations', '[[myrelations.sourceId]] = [[elements.id]] and [[myrelations.fieldId]] = ' ~ fieldId)&#xA;    .leftJoin('{{%content}} as mycontent', '[[myrelations.targetId]] = [[mycontent.elementId]]')&#xA;    .groupBy('elements.id')&#xA;    .orderBy({'mycontent.title': SORT_ASC})&#xA;    .all()&#xA;%}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-05T06:11:51.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30035" PostTypeId="2" ParentId="29993" CreationDate="2019-04-05T06:18:24.687" Score="3" Body="&lt;p&gt;There are several things that might be the issue in such cases, I'll list a few of them&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Did you change your index.php so maybe Craft is unable to detect the current site?&lt;/li&gt;&#xA;&lt;li&gt;Are there different index.php files in different folders in order to do the multisite setup instead of the single one? -&gt; You should only have one for all&lt;/li&gt;&#xA;&lt;li&gt;Do you have any plugins that might interfer and offer their custom error page / error behaviors?&lt;/li&gt;&#xA;&lt;li&gt;Do you have any other events in your own custom plugin/module that includes a custom error handling?&lt;/li&gt;&#xA;&lt;li&gt;Is your error template in the templates roots folder and not in a site/site group subfolder so Craft only selects it for a single site instead of globally?&lt;/li&gt;&#xA;&lt;li&gt;Make sure dev mode is off&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-05T06:18:24.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30036" PostTypeId="2" ParentId="29185" CreationDate="2019-04-05T08:23:36.817" Score="2" Body="&lt;p&gt;I have the same error and used an older dump. I was, later on, able to access the admin panel. &lt;/p&gt;&#xA;" OwnerUserId="9481" LastActivityDate="2019-04-05T08:23:36.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30037" PostTypeId="2" ParentId="29652" CreationDate="2019-04-05T10:58:45.943" Score="2" Body="&lt;p&gt;P&amp;amp;T recently released an update with a new console command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;project-config/rebuild&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does exactly what it sounds like, it rebuilds the config ...&lt;/p&gt;&#xA;" OwnerUserId="6886" LastActivityDate="2019-04-05T10:58:45.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30038" PostTypeId="1" CreationDate="2019-04-05T13:23:16.247" Score="1" ViewCount="83" Body="&lt;p&gt;I am using Seomatic and i want to conditionally render google tag manager trancking code - or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I disable it using some Twig template code?&lt;/p&gt;&#xA;" OwnerUserId="9038" LastActivityDate="2019-04-06T14:09:26.197" Title="Seomatic - disable tag manager from inside template" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30039" PostTypeId="2" ParentId="30038" CreationDate="2019-04-05T13:37:54.653" Score="1" Body="&lt;p&gt;This code will let you disable the inclusion of the tag:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seomatic.script.get('googleTagManager').include(false) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more, check out the &lt;a href=&quot;https://github.com/nystudio107/craft-seomatic#twig-templating&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEOmatic Twig Templating documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're changing the inclusion of the tag or not based on some other variable such that the tag may be included or not for the exact same URI, you'll want to bust the cache, too (which is URI-based):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% do seomatic.script.container().clearCache(true) %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also check out the &lt;a href=&quot;https://nystudio107.com/blog/tips-for-using-seomatic-effectively&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advanced SEOmatic Tips&lt;/a&gt; article for some deeper reading.&lt;/p&gt;&#xA;" OwnerUserId="819" LastEditorUserId="819" LastEditDate="2019-04-06T14:09:26.197" LastActivityDate="2019-04-06T14:09:26.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30040" PostTypeId="1" CreationDate="2019-04-05T18:34:10.223" Score="2" ViewCount="194" Body="&lt;p&gt;&lt;strong&gt;Versions:&lt;/strong&gt; &#xA; - Craft CMS (3.1.21)&#xA; - Craft Commerce (2.1.2)&#xA; - Stripe for Craft Commerce (1.2.0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; &#xA;- My website offers user's ability to subscribe to several subscriptions at the same time. Currently, I have created products that represent each subscription so they may be added to the cart. These products are purchased like a regular 'purchasable' element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plugin listens to the event &lt;strong&gt;EVENT_AFTER_COMPLETE_ORDER&lt;/strong&gt; and finds all subscriptions that were in the completed order.&#xA;I could create each subscription individually using Craft's &lt;strong&gt;createSubscription()&lt;/strong&gt; method found in &lt;strong&gt;craft\commerce\services&lt;/strong&gt;, but doing so causes multiple invoices to be sent out to customers and each invoice created is also charged a fee by Stripe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Goal is to create one subscription that contains several subscriptions inside of it (&lt;a href=&quot;https://stripe.com/docs/billing/subscriptions/multiplan&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://stripe.com/docs/billing/subscriptions/multiplan&lt;/a&gt;). This would only generate one invoice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to use the Stripe API to do this successfully but at the cost of bypassing Craft. Is there a way to do this through Craft so it knows about all subscriptions that have been created? &lt;/p&gt;&#xA;" OwnerUserId="9587" LastActivityDate="2019-04-05T18:34:10.223" Title="Creating multiple plan subscriptions" Tags="&lt;plugin-development&gt;&lt;plugin-craftcommerce&gt;&lt;plugins&gt;&lt;stripe&gt;&lt;products&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30041" PostTypeId="2" ParentId="26502" CreationDate="2019-04-05T18:58:40.970" Score="1" Body="&lt;p&gt;Here is a link to the breadcrumb template component for Craft CMS 3. It is automatically created from URL structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://craftsnippets.com/articles/breadcrumb-created-from-url-for-craft-cms&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://craftsnippets.com/articles/breadcrumb-created-from-url-for-craft-cms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It creates proper links for entries, categories and any other elements that have their own page.&lt;/li&gt;&#xA;&lt;li&gt;It works out of the box. No need to adjust anything unless you are dealing with custom routes instead of regular entries and categories.&lt;/li&gt;&#xA;&lt;li&gt;It has proper google structured data and ARIA attributes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9038" LastEditorUserId="9038" LastEditDate="2019-04-15T01:57:11.257" LastActivityDate="2019-04-15T01:57:11.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30043" PostTypeId="1" AcceptedAnswerId="30088" CreationDate="2019-04-05T21:21:16.663" Score="1" ViewCount="151" Body="&lt;p&gt;This morning there were new updates for Craft CMS, Contact Form and Simplemap on a Craft Pro site I host. I updated everything through the Craft CP. After the update, the CP still shows available plugin updates. When I check composer.json everything is already updated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried running ./craft update all through SSH, deleted caches, checked the OPcache settings with my hosting provider and checked the logs. Can’t find any reason why the CP shows plugin updates while everything is already updated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also contacted Craft support, and they suggested putting the question here. I hope anyone does have an idea what’s going on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The server environment:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PHP 7.0.33&lt;/li&gt;&#xA;&lt;li&gt;MySQL 5.5.5&lt;/li&gt;&#xA;&lt;li&gt;Craft Pro 3.1.21.1&lt;/li&gt;&#xA;&lt;li&gt;Yii 2.0.17&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My composer file:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-js prettyprint-override&quot;&gt;&lt;code&gt;{&#xA;  &quot;name&quot;: &quot;craftcms/craft&quot;,&#xA;  &quot;description&quot;: &quot;Craft CMS&quot;,&#xA;  &quot;keywords&quot;: [&#xA;    &quot;craft&quot;,&#xA;    &quot;cms&quot;,&#xA;    &quot;craftcms&quot;,&#xA;    &quot;project&quot;&#xA;  ],&#xA;  &quot;license&quot;: &quot;MIT&quot;,&#xA;  &quot;homepage&quot;: &quot;https://craftcms.com/&quot;,&#xA;  &quot;type&quot;: &quot;project&quot;,&#xA;  &quot;support&quot;: {&#xA;    &quot;email&quot;: &quot;support@craftcms.com&quot;,&#xA;    &quot;issues&quot;: &quot;https://github.com/craftcms/cms/issues&quot;,&#xA;    &quot;forum&quot;: &quot;https://craftcms.stackexchange.com/&quot;,&#xA;    &quot;source&quot;: &quot;https://github.com/craftcms/cms&quot;,&#xA;    &quot;docs&quot;: &quot;https://craftcms.com/docs&quot;,&#xA;    &quot;rss&quot;: &quot;https://craftcms.com/changelog.rss&quot;&#xA;  },&#xA;  &quot;require&quot;: {&#xA;    &quot;craftcms/cms&quot;: &quot;3.1.21.1&quot;,&#xA;    &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;,&#xA;    &quot;craftcms/redactor&quot;: &quot;2.3.2&quot;,&#xA;    &quot;rias/craft-position-fieldtype&quot;: &quot;1.0.14&quot;,&#xA;    &quot;craftcms/contact-form&quot;: &quot;2.2.4&quot;,&#xA;    &quot;ether/seo&quot;: &quot;3.5.4&quot;,&#xA;    &quot;ether/simplemap&quot;: &quot;3.4.10&quot;,&#xA;    &quot;nystudio107/craft-typogrify&quot;: &quot;1.1.17&quot;,&#xA;    &quot;matt-west/craft-recaptcha&quot;: &quot;1.3.0&quot;&#xA;  },&#xA;  &quot;autoload&quot;: {&#xA;    &quot;psr-4&quot;: {&#xA;      &quot;modules\\&quot;: &quot;modules/&quot;&#xA;    }&#xA;  },&#xA;  &quot;config&quot;: {&#xA;    &quot;optimize-autoloader&quot;: true,&#xA;    &quot;platform&quot;: {&#xA;      &quot;php&quot;: &quot;7.0&quot;&#xA;    }&#xA;  },&#xA;  &quot;scripts&quot;: {&#xA;    &quot;post-root-package-install&quot;: [&#xA;      &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;&#xA;    ],&#xA;    &quot;post-create-project-cmd&quot;: [&#xA;      &quot;@composer dump-autoload -o&quot;,&#xA;      &quot;@php craft setup/welcome&quot;&#xA;    ]&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8298" LastEditorUserId="5557" LastEditDate="2019-04-09T14:08:10.880" LastActivityDate="2019-04-09T14:08:10.880" Title="Craft CP showing plugin updates, but already updated" Tags="&lt;control-panel&gt;&lt;updates&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30045" PostTypeId="1" CreationDate="2019-04-06T00:07:24.393" Score="1" ViewCount="36" Body="&lt;p&gt;Is it possible to build categories with a list of entries that have different styling, like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% for entry in entries %}&#xA;    Row 1 - Entry 1 - full-wide&#xA;    Row 2 - 3 entries with (1/3 width of each)&#xA;    Row 3 - 2 entries (1/3 and 2/3 width)&#xA;    ....&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="9591" LastEditorUserId="57" LastEditDate="2019-04-06T03:59:02.993" LastActivityDate="2019-09-04T01:03:05.447" Title="Entries with different styling" Tags="&lt;templating&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30046" PostTypeId="1" CreationDate="2019-04-06T14:06:22.300" Score="1" ViewCount="23" Body="&lt;p&gt;I want to use search but exclude some &lt;code&gt;types&lt;/code&gt; but when I use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; paginate craft.entries({&#xA;     search: query&#xA; }).type('not faq').limit(4).order('postDate desc') as pageInfo, results %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;results&lt;/code&gt; are always an empty array&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when I remove &lt;code&gt;not&lt;/code&gt; it search only in &lt;code&gt;faq&lt;/code&gt; type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also try: &lt;code&gt;!faq&lt;/code&gt;, &lt;code&gt;~faq&lt;/code&gt;, &lt;code&gt;-faq&lt;/code&gt;;&lt;/p&gt;&#xA;" OwnerUserId="9593" LastActivityDate="2019-04-06T14:06:22.300" Title="Exclude entries" Tags="&lt;craft2&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2019-04-07T10:22:38.167" ContentLicense="CC BY-SA 4.0" />
  <row Id="30047" PostTypeId="1" AcceptedAnswerId="30050" CreationDate="2019-04-06T14:42:10.867" Score="1" ViewCount="130" Body="&lt;p&gt;The &lt;code&gt;craft&lt;/code&gt; variable allows you to chain queries for your Elements. For example, you can query the first Entry in a section with either of the following syntaxes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries({ section: 'news' }).one() %}&#xA;{% set entry = craft.entries.section('news').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do we support both of these syntaxes in a Custom Element type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Craft Variable defines the &lt;code&gt;entries&lt;/code&gt; tag like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function entries(array $criteria = []): EntryQuery&#xA;{&#xA;  $query = Entry::find();&#xA;  Craft::configure($query, $criteria);&#xA;&#xA;  return $query;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And, within the &lt;code&gt;EntryQuery&lt;/code&gt; class, a public &lt;code&gt;section&lt;/code&gt; method is defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function section($value)&#xA;{&#xA;  if ($value instanceof Section) {&#xA;    $this-&amp;gt;structureId = ($value-&amp;gt;structureId ?: false);&#xA;    $this-&amp;gt;sectionId = $value-&amp;gt;id;&#xA;  } else if ($value !== null) {&#xA;    $this-&amp;gt;sectionId = (new Query())&#xA;      -&amp;gt;select(['id'])&#xA;      -&amp;gt;from([Table::SECTIONS])&#xA;      -&amp;gt;where(Db::parseParam('handle', $value))&#xA;      -&amp;gt;column();&#xA;  } else {&#xA;    $this-&amp;gt;sectionId = null;&#xA;  }&#xA;&#xA;  return $this;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And there appears to be a &lt;code&gt;__set&lt;/code&gt; method on the EntryQuery that also references the &lt;code&gt;section&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function __set($name, $value)&#xA;{&#xA;  switch ($name) {&#xA;    case 'section':&#xA;      $this-&amp;gt;section($value);&#xA;      break;&#xA;    case 'type':&#xA;      $this-&amp;gt;type($value);&#xA;      break;&#xA;    case 'authorGroup':&#xA;      $this-&amp;gt;authorGroup($value);&#xA;      break;&#xA;    default:&#xA;      parent::__set($name, $value);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've experimented with all of those and still only seem to be able to support the first syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries({ section: 'news' }).one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But can't seem to find a way to support the second syntax:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set entry = craft.entries.section('news').one() %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I overlooking? What does a custom Element Type need to add to support the chained syntax for an Element Query via a Twig variable?&lt;/p&gt;&#xA;" OwnerUserId="115" LastActivityDate="2019-04-06T19:32:10.153" Title="How to support chained Element queries with Twig tags" Tags="&lt;elementtype&gt;&lt;elementquery&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30048" PostTypeId="1" CreationDate="2019-04-06T17:52:01.150" Score="1" ViewCount="25" Body="&lt;p&gt;The goal is to create a global variable that allows the user to specify how they would like to format the date/time for entries. I'd like to remove the hardcoded format shown here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate|date('Y.d.m') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And replace it with something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate|date('{{ global__siteMetadata.gv__articleDateFormat }}') }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The user would add &quot;Y.d.m&quot; or any other PHP date format they like through the global field in the CMS. But when I use this, I get the following output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ 1THURSDAY2019PMTHURSDAY__001631AMERICA/CHICAGOMARAMERICA/CHICAGO31PM21PM31PM.1CT__PMTHU, 21 MAR 2019 13:16:00 -050031162019-03-21T13:16:00-05:00THURSDAYAMERICA/CHICAGOTHUPM31AMERICA/CHICAGOMARCH2019THU, 21 MAR 2019 13:16:00 -050003PM31 }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, the global variable is not being parsed. Any thoughts on how to make this happen?&lt;/p&gt;&#xA;" OwnerUserId="7475" LastActivityDate="2019-04-06T18:42:49.393" Title="Can I use a Global Variable for date/time?" Tags="&lt;datetime&gt;&lt;globals&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30049" PostTypeId="2" ParentId="30048" CreationDate="2019-04-06T18:42:49.393" Score="1" Body="&lt;p&gt;You never need to nest Twig tags. It looks like &lt;code&gt;{{ glo...&lt;/code&gt; is all being processed (or attempted to process) as PHP date shorthand codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this instead...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{ entry.postDate|date(global__siteMetadata.gv__articleDateFormat) }}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastActivityDate="2019-04-06T18:42:49.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30050" PostTypeId="2" ParentId="30047" CreationDate="2019-04-06T19:32:10.153" Score="3" Body="&lt;p&gt;You need to return the instance in every single &lt;code&gt;set&lt;/code&gt; call. As you noticed correctly the last line in &lt;strong&gt;every&lt;/strong&gt; function that changes properties of your query is &lt;code&gt;return $this&lt;/code&gt; which allows you to chain another function after the call. Simple as that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Always return the query until you execute it with &lt;code&gt;all()&lt;/code&gt; or another function like that is enough &lt;/p&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-06T19:32:10.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30051" PostTypeId="2" ParentId="30045" CreationDate="2019-04-06T23:15:09.793" Score="1" Body="&lt;p&gt;I'm not sure how dynamic you need this to be. One way would be to set an order of classes to loop through with &lt;a href=&quot;https://twig.symfony.com/doc/2.x/functions/cycle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tiwg's Cycle function&lt;/a&gt;. This would go through each class in the array, in a cycle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% set classes = ['full-wide', 'third-wide', 'third-wide', 'third-wide', 'half-wide', 'half-wide'] %}&#xA;&#xA;{% for entry in entries %}&#xA;    &amp;lt;div class=&quot;{{ cycle(classes, loop.index0) }}&quot;&amp;gt;&#xA;        {# output entry #}&#xA;    &amp;lt;/div&amp;gt;&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need a bit more flexibility you could use conditionals querying the &lt;a href=&quot;https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable&quot; rel=&quot;nofollow noreferrer&quot;&gt;loop variable&lt;/a&gt; to determine where you are in the output.&lt;/p&gt;&#xA;" OwnerUserId="50" LastActivityDate="2019-04-06T23:15:09.793" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="30052" PostTypeId="2" ParentId="29789" CreationDate="2019-04-07T02:30:33.373" Score="1" Body="&lt;p&gt;Probably need a little more information (as in, an example of your feed), but if you're trying to import HTML content in an XML-based feed, you'll want to wrap that with &lt;code&gt;CDATA&lt;/code&gt;, so its escaped properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;![CDATA[&amp;lt;p&amp;gt;This is &amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;]]&amp;gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-04-07T02:30:33.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30053" PostTypeId="2" ParentId="29956" CreationDate="2019-04-07T02:31:42.020" Score="1" Body="&lt;p&gt;Would you be able to send a support ticket through the plugin? I'm happy to help (as the developer of Feed Me), but I'd need some more information about your setup, including the current version you're on, the path you're using, etc.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2019-04-07T02:31:42.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30054" PostTypeId="1" AcceptedAnswerId="30055" CreationDate="2019-04-07T09:22:06.123" Score="1" ViewCount="164" Body="&lt;p&gt;I have installed Craft 3 Solo and it's installed on my local machine. I would like to know how can I get an option in Setting -&gt; General to Logo (upload Login Page Logo).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/T2qVW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T2qVW.png&quot; alt=&quot;Upload Login Page Logo&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to Craft, so would like to get a little bit of guidance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9594" LastEditorUserId="57" LastEditDate="2019-04-08T00:32:29.327" LastActivityDate="2019-04-08T00:32:29.327" Title="Craft 3 CMS Solo setting general Logo option" Tags="&lt;craft3&gt;&lt;craft-features&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30055" PostTypeId="2" ParentId="30054" CreationDate="2019-04-07T11:18:45.807" Score="2" Body="&lt;p&gt;The login logo option is only visible with Craft Pro’s rebranding options. So, if you need this, you’d need to upgrade to Pro (or give it a  try without purchasing it, if you’re on a &lt;a href=&quot;https://craftcms.com/guides/how-craft-license-enforcement-works#how-do-we-determine-craft-is-running-on-a-public-domain&quot; rel=&quot;nofollow noreferrer&quot;&gt;dev-domain&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="110" LastActivityDate="2019-04-07T11:18:45.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30058" PostTypeId="1" AcceptedAnswerId="30076" CreationDate="2019-04-08T01:30:29.030" Score="1" ViewCount="266" Body="&lt;p&gt;Hi I have I'm using Craft CMS 3.1.21.1 with the Contact Form plugin version (2.2.4) and Contact Form Honeypot plugin (1.0.2) along with jquery 3.2.1 on the site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever the form is filled out and I hit send, the form hangs with an error &quot;Failed to load resource: the server responded with a status of 400 ()&quot; in the console.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sends just fine whenever I remove the javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the markup of the form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% macro errorList(errors) %}&#xA;    {% if errors %}&#xA;        &amp;lt;span class=&quot;form-error is-visible&quot;&amp;gt;&#xA;            {% for error in errors %}&#xA;                {{ error }}&#xA;            {% endfor %}&#xA;        &amp;lt;/span&amp;gt;&#xA;    {% endif %}&#xA;{% endmacro %}&#xA;&#xA;{% from _self import errorList %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; id=&quot;ajax-contact&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&amp;gt;&#xA;    {{ redirectInput('pages/contact') }}&#xA;    &amp;lt;div class=&quot;small-12&quot; itemprop=&quot;text&quot;&amp;gt;&#xA;        &amp;lt;p id=&quot;thanks&quot; class=&quot;contact-form-success&quot; style=&quot;display: none&quot;&amp;gt;&#xA;            {{ 'Your message has been sent.' | translate }}&#xA;        &amp;lt;/p&amp;gt;&#xA;        &amp;lt;p id=&quot;error&quot; class=&quot;contact-form-error&quot; style=&quot;display: none;&quot;&amp;gt;&#xA;            {{ 'An error occurred. Please try again.' | translate }}&#xA;        &amp;lt;/p&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&#xA;    &amp;lt;div class=&quot;row form-columns&quot;&amp;gt;&#xA;        &amp;lt;div class=&quot;medium-6 columns first-column&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;from-name&quot;&amp;gt;{{ 'Name' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot; required&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('fromName')) }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;from-email&quot;&amp;gt;{{ 'Email' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot; required&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;h4&amp;gt;{{ 'What services are you interested in?' | translate }}&amp;lt;/h4&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;weddings&quot; name=&quot;message[Services][]&quot; value=&quot;Weddings&quot;&amp;gt;&amp;amp;nbsp;{{ 'Weddings' | translate }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;engagements&quot; name=&quot;message[Services][]&quot; value=&quot;Engagements&quot;&amp;gt;&amp;amp;nbsp;{{ 'Engagements' | translate }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;families&quot; name=&quot;message[Services][]&quot; value=&quot;Families&quot;&amp;gt;&amp;amp;nbsp;{{ 'Families' | translate }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label&amp;gt;&amp;lt;input type=&quot;checkbox&quot; id=&quot;other&quot; name=&quot;message[Services][]&quot; value=&quot;Other&quot;&amp;gt;&amp;amp;nbsp;{{ 'Other' | translate }}&amp;lt;/label&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot; id=&quot;wedding-date-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;wedding-date&quot;&amp;gt;{{ 'Wedding Date' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;div class=&quot;input-group&quot;&amp;gt;&#xA;                    &amp;lt;span class=&quot;input-group-label&quot;&amp;gt;&amp;lt;svg class=&quot;icon icon-calendar&quot;&amp;gt;&amp;lt;use xlink:href=&quot;#icon-calendar&quot;&amp;gt;&amp;lt;/use&amp;gt;&amp;lt;/svg&amp;gt;&amp;lt;/span&amp;gt;&#xA;                    &amp;lt;input id=&quot;wedding-date&quot; name=&quot;message[WeddingDate][]&quot; type=&quot;date&quot;&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot; id=&quot;wedding-location-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;wedding-location&quot;&amp;gt;{{ 'Wedding Location' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input id=&quot;wedding-location&quot; name=&quot;message[WeddingLocation][]&quot; type=&quot;text&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;        &amp;lt;div class=&quot;medium-6 columns second-column&quot;&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;how-did-you-hear-about-us&quot;&amp;gt;{{ 'How did you hear about us?' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input id=&quot;how-did-you-hear-about-us&quot; name=&quot;message[HowDidYouHear][]&quot; type=&quot;text&quot;&amp;gt;&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;subject&quot;&amp;gt;{{ 'Subject' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{{ message.subject ?? '' }}&quot;  required&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('subject')) }}&#xA;            &amp;lt;/div&amp;gt;&#xA;            &amp;lt;div class=&quot;form-group&quot;&amp;gt;&#xA;                &amp;lt;label for=&quot;message&quot;&amp;gt;{{ 'Message' | translate }}&amp;lt;/label&amp;gt;&#xA;                &amp;lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message[body]&quot; required&amp;gt;{{ message.message ?? '' }}&amp;lt;/textarea&amp;gt;&#xA;                {{ message is defined and message ? errorList(message.getErrors('message')) }}&#xA;            &amp;lt;/div&amp;gt;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;    &amp;lt;input class=&quot;hide&quot; id=&quot;preferredKitten&quot; name=&quot;preferredKitten&quot; type=&quot;text&quot;&amp;gt;&#xA;    &amp;lt;div class=&quot;form-group contact-form-submit row column&quot;&amp;gt;&#xA;        &amp;lt;button type=&quot;submit&quot; data-text=&quot;Send&quot; class=&quot;button&quot;&amp;gt;{{ 'Send Enquiry' | translate }}&amp;lt;/button&amp;gt;&#xA;        &amp;lt;div id=&quot;spinner&quot; class=&quot;form-spinner spinner-loading&quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plus here is the JS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$('#ajax-contact').submit(function(ev) {&#xA;    // Prevent the form from actually submitting&#xA;    ev.preventDefault();&#xA;    $('#spinner').addClass('show');&#xA;&#xA;    // Send it to the server&#xA;    $.post({&#xA;        url: '/',&#xA;        dataType: 'json',&#xA;        data: $(this).serialize(),&#xA;        success: function(response) {&#xA;            if (response.success) {&#xA;                $('#thanks').fadeIn();&#xA;                $('#error').fadeOut();&#xA;                $('#spinner').removeClass('show');&#xA;                $('#ajax-contact').each(function () {&#xA;                    this.reset();&#xA;                });&#xA;            } else {&#xA;                // response.error will be an object containing any validation errors that occurred, indexed by field name&#xA;                // e.g. response.error.fromName =&amp;gt; ['From Name is required']&#xA;                $('#error').fadeIn();&#xA;                $('#thanks').fadeOut();&#xA;                $('#spinner').removeClass('show');&#xA;            }&#xA;        }&#xA;    });&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help for this would be very much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6297" LastActivityDate="2021-05-12T11:40:14.357" Title="Ajax Contact Form not sending with Error 400" Tags="&lt;templating&gt;&lt;craft3&gt;&lt;plugins&gt;&lt;ajax&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30059" PostTypeId="1" CreationDate="2019-04-08T06:15:04.323" Score="0" ViewCount="23" Body="&lt;p&gt;I'm writing a simple plugin for 'Craft 2' and It seems that a &lt;code&gt;slug&lt;/code&gt; of an entry is returned if you reffer it like: &lt;code&gt;$entry['slug']&lt;/code&gt; but calling &lt;code&gt;$entry-&amp;gt;slug&lt;/code&gt; returns same value as entry title. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an explanation of why it happens and what is the best practice of getting values of the entry fields with a homemade plugin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;God bless ya'll. &lt;/p&gt;&#xA;" OwnerUserId="6956" LastActivityDate="2019-04-08T06:15:04.323" Title="Why does $entry['slug'] and $entry-&gt;slug return different values?" Tags="&lt;plugins&gt;&lt;craft2&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="30060" PostTypeId="1" AcceptedAnswerId="30067" CreationDate="2019-04-08T09:10:01.420" Score="1" ViewCount="685" Body="&lt;p&gt;I cant get this to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing a post to a controller action. From that action I'm doing a lot of validations, db insert, file uploads etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming from Laravel Im used to is doing like this: (&lt;em&gt;example with no real variables or methods. Just for visual presentation&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(!$something-&amp;gt;success){&#xA;  return redirect(&quot;controller-url&quot;)-&amp;gt;withErrors([$model-&amp;gt;errors]);&#xA;}&#xA;// Next steps...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From what I can read in the docs Craft recommend posting to the same page to handle errors and pass the model down to the view, but then doing a page refresh will do the same again so I dont like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Controller is like this : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Index&lt;/strong&gt; (Renders index template)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionIndex()&#xA;{&#xA;    $this-&amp;gt;renderTemplate(&quot;plugin/settings&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Post&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public function actionPost()&#xA;{&#xA;  if(!$model-&amp;gt;validate()){&#xA;    Craft::$app-&amp;gt;getSession()-&amp;gt;setError($message);&#xA;    return $this-&amp;gt;redirect(&quot;url-to-index-action&quot;);&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the setError() works fine but I want to the pass all the errors from the model to the index action after a redirect and then down to the twig template. How?&lt;/p&gt;&#xA;" OwnerUserId="9596" LastEditorUserId="9596" LastEditDate="2019-04-09T07:25:10.013" LastActivityDate="2019-04-09T07:25:10.013" Title="Craft 3 Controller - Redirect with errors" Tags="&lt;plugin-development&gt;&lt;controller&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30061" PostTypeId="1" AcceptedAnswerId="30062" CreationDate="2019-04-08T09:29:42.387" Score="1" ViewCount="192" Body="&lt;p&gt;When setting an &quot;Entry URI Format&quot; for a section, the values currently available to me are &lt;code&gt;{slug}&lt;/code&gt; which is the title of the entry, or &lt;code&gt;{id}&lt;/code&gt; which is usually a small number. I'd like to have an obfuscated hash/uuid for this path, eg &lt;code&gt;c54be165-fc95-4583-bef8-2e2abd2a4f37&lt;/code&gt;. Is this possible without writing any custom code?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2019-04-08T09:54:38.903" Title="Use a UUID for an entry ID in a URL path" Tags="&lt;craft3&gt;&lt;entries&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30062" PostTypeId="2" ParentId="30061" CreationDate="2019-04-08T09:54:38.903" Score="2" Body="&lt;p&gt;You can use &lt;code&gt;{uid}&lt;/code&gt; inside the &quot;Entry URI Format&quot; field.&lt;/p&gt;&#xA;" OwnerUserId="1098" LastActivityDate="2019-04-08T09:54:38.903" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30063" PostTypeId="2" ParentId="30028" CreationDate="2019-04-08T10:05:13.420" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://github.com/craftcms/digital-products#the-beforegeneratelicensekey-event&quot; rel=&quot;nofollow noreferrer&quot;&gt;beforeGenerateLicenseKey&lt;/a&gt; event and query for a custom key in your custom table and set the license key&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;Event::on(License::class, License::EVENT_GENERATE_LICENSE_KEY, function(GenerateKeyEvent $e) {&#xA;    $licenseKey = (new Query())&#xA;                      -&amp;gt;select(['mykey'])&#xA;                      -&amp;gt;from('{{%mytable}}')&#xA;                      -&amp;gt;where(['used' =&amp;gt; false])&#xA;                      -&amp;gt;scalar();&#xA;&#xA;    $e-&amp;gt;licenseKey = $licenseKey;&#xA;});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you insert new keys in your custom DB table, you can change the stock of your variant accordingly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$variant = //grab the variant you need for your product&#xA;$variant-&amp;gt;stock = (new Query())-&amp;gt;from('mytable')-&amp;gt;count();&#xA;// store the variant&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-08T10:05:13.420" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30065" PostTypeId="1" CreationDate="2019-04-08T11:06:23.870" Score="1" ViewCount="179" Body="&lt;p&gt;I would like to &quot;hide&quot; Certain Pages or entries from the Content SEO Section as they are never seen by the end user and are not used in the XML sitemap. Is there a way to do this ?&lt;/p&gt;&#xA;" OwnerUserId="9597" LastActivityDate="2019-04-08T12:41:15.957" Title="Is it possible to hide certain entries in the Content SEO section of SEO Matic?" Tags="&lt;plugin-seomatic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30067" PostTypeId="2" ParentId="30060" CreationDate="2019-04-08T11:41:27.113" Score="1" Body="&lt;p&gt;In Yii2 there is no such a thing as &quot;redirectWithErrors&quot;. Usually you have 2 scenarios&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are validation errors -&gt; display the form again with those errors&lt;/li&gt;&#xA;&lt;li&gt;Successful -&gt; redirect&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first one doesn't require a redirect. You just return &lt;code&gt;null&lt;/code&gt; in your controller and Yii2 will route the to the url specified via &lt;code&gt;GET&lt;/code&gt;parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can have a form like this. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; action=&quot;myUrl&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;mycontroller/save&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yii2 will do the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Route to your controller and hit the &lt;code&gt;save&lt;/code&gt; action&lt;/li&gt;&#xA;&lt;li&gt;When you redirect or return a valid object of type &lt;code&gt;yii\web\Response&lt;/code&gt; or a string that can be converted into that it will return the &lt;code&gt;Response&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;When you don't return something it will route the request a second time with your get param &lt;code&gt;myUrl&lt;/code&gt;, that can be treated as you &lt;code&gt;routeWithErrors&lt;/code&gt; function because you set the errors &lt;code&gt;Craft::$app-&amp;gt;getUrlManager()-&amp;gt;setRouteParams(['model' =&amp;gt; $model])&lt;/code&gt; and have then access to these parameters.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you really dislike this, you could use &lt;code&gt;return Craft::runAction('controller/action', $parameters);&lt;/code&gt; to run a controller action with certain values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &#xA;Usually you want to leave &lt;code&gt;action=&quot;myUrl&quot;&lt;/code&gt; blank and don't insert it. That way Yii2 will automatically reload the current route so you can dispaly your errors&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-04-08T14:59:53.117" LastActivityDate="2019-04-08T14:59:53.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30068" PostTypeId="2" ParentId="30065" CreationDate="2019-04-08T12:41:15.957" Score="1" Body="&lt;p&gt;A Section only appear in Content SEO if it has public URLs. If it has public URLs, that means that Google and users will be able to find it eventually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a setting to disable the sitemap for a section via Content SEO, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you elaborate on what you're trying to accomplish?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also we got into detail on sitemaps for a while on the &lt;a href=&quot;https://devMode.fm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;devMode.fm&lt;/a&gt; episode &lt;a href=&quot;https://devmode.fm/episodes/web-developers-you-dont-know-seo&quot; rel=&quot;nofollow noreferrer&quot;&gt;SEO for Web Developers: The Silence of the Chickens&lt;/a&gt; which might be useful to you.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-04-08T12:41:15.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30069" PostTypeId="2" ParentId="17677" CreationDate="2019-04-08T16:41:09.843" Score="3" Body="&lt;p&gt;In Craft 3 and PHP you can use &lt;code&gt;\Craft::$app-&amp;gt;getRequest()-&amp;gt;absoluteUrl&lt;/code&gt; or &lt;code&gt;\Craft::$app-&amp;gt;request-&amp;gt;absoluteUrl&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9599" LastActivityDate="2019-04-08T16:41:09.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30071" PostTypeId="1" AcceptedAnswerId="30623" CreationDate="2019-04-08T18:32:03.280" Score="3" ViewCount="221" Body="&lt;h2&gt;&lt;em&gt;How can I pass in a quantity value while creating a subscription?&lt;/em&gt;&lt;/h2&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plugin (version):&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Craft CMS&lt;/strong&gt; (3.1.21)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Craft Commerce&lt;/strong&gt; (2.1.2) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stripe for Craft Commerce&lt;/strong&gt; (1.2.0)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; My website allows users to subscribe to meal plans. For example, a user can subscribe to receive 5 vegetarian meals per week. Another user may also subscribe to recieve 10 meals per week. Currently, I must create two subscritpion plans on Stripe and on Craft (i.e Vegetarian-5 and Vegetarian-10). &lt;strong&gt;Stripe's API&lt;/strong&gt; offers the ability to create a single plan that &lt;a href=&quot;https://stripe.com/docs/billing/subscriptions/quantities&quot; rel=&quot;nofollow noreferrer&quot;&gt;charges per quantity&lt;/a&gt; (i.e I want to create one Vegetarian Plan and charge $10 per meal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a &lt;strong&gt;plugin&lt;/strong&gt; that uses &lt;strong&gt;createSubscription()&lt;/strong&gt; from &lt;a href=&quot;https://docs.craftcms.com/commerce/api/v2/craft-commerce-services-subscriptions.html#public-methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;craft\commerce\services&lt;/a&gt;. However, ideally I want to send a quantity value but after reviewing Craft's logic for this function, I am unable to figure out a way to pass in a &lt;strong&gt;quantity&lt;/strong&gt; value. However, I could easily bypass Craft and use the Stripe's API to do this (&lt;a href=&quot;https://stripe.com/docs/billing/subscriptions/quantities&quot; rel=&quot;nofollow noreferrer&quot;&gt;setting subscription quantity through stripe API&lt;/a&gt;) but that feels like the wrong solution. &lt;/p&gt;&#xA;" OwnerUserId="9587" LastActivityDate="2019-06-11T12:45:07.060" Title="Setting Quantity Field on Subscriptions" Tags="&lt;craft3&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30072" PostTypeId="1" AcceptedAnswerId="30073" CreationDate="2019-04-08T19:48:14.197" Score="1" ViewCount="448" Body="&lt;p&gt;I am new to Craft CMS and am struggling with what and how to get the correct files in the right places. I started out with a LAMP stack on a Ubuntu 18.04 Digital Ocean droplet and proceeded with the Craft CMS setup. Currently I get a 404 ERROR stating &quot;The requested URL /index.php was not found on this server&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where should I put it? Does this answer help and still work in this case : &lt;a href=&quot;https://stackoverflow.com/questions/5891802/how-do-i-change-the-root-directory-of-an-apache-server/23175981#23175981&quot;&gt;https://stackoverflow.com/questions/5891802/how-do-i-change-the-root-directory-of-an-apache-server/23175981#23175981&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My VH file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;&#xA;     ServerAdmin admin@example.com&#xA;     DocumentRoot /var/www/html/craftcms&#xA;     ServerName example.com&#xA;     ServerAlias www.example.com&#xA;&#xA;     &amp;lt;Directory /var/www/html/craftcms/&amp;gt;&#xA;          Options FollowSymlinks&#xA;          AllowOverride All&#xA;          Require all granted&#xA;     &amp;lt;/Directory&amp;gt;&#xA;&#xA;     ErrorLog ${APACHE_LOG_DIR}/error.log&#xA;     CustomLog ${APACHE_LOG_DIR}/access.log combined&#xA;&#xA;     &amp;lt;Directory /var/www/html/craftcms/&amp;gt;&#xA;            RewriteEngine on&#xA;            RewriteBase /&#xA;            RewriteCond %{REQUEST_FILENAME} !-f&#xA;            RewriteRule ^(.*) index.php [PT,L]&#xA;    &amp;lt;/Directory&amp;gt;&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9600" LastActivityDate="2019-04-08T20:05:49.237" Title="Craft 3 vs Apache directory structure" Tags="&lt;craft3&gt;&lt;apache&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30073" PostTypeId="2" ParentId="30072" CreationDate="2019-04-08T20:05:49.237" Score="1" Body="&lt;p&gt;If the &lt;code&gt;craftcms&lt;/code&gt; folder is more or less the &lt;a href=&quot;https://docs.craftcms.com/v3/directory-structure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;out-of-the-box Craft 3 installation&lt;/a&gt;, you should be able to just point your &lt;code&gt;Directory&lt;/code&gt; blocks and &lt;code&gt;DocumentRoot&lt;/code&gt; at &lt;code&gt;/var/www/html/craftcms/web&lt;/code&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only the &lt;code&gt;web&lt;/code&gt; folder is intended to be public—everything else should be hidden, above the web root—think of it as sandboxing access to just one folder of your application.&lt;/p&gt;&#xA;" OwnerUserId="4169" LastActivityDate="2019-04-08T20:05:49.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30074" PostTypeId="1" AcceptedAnswerId="30096" CreationDate="2019-04-08T20:06:49.687" Score="1" ViewCount="103" Body="&lt;p&gt;I am new to craft cms and would like to learn craft cms with tutorials. I am ready to pay for the subscription but would like to know is there any best place where I can learn the craft ?&lt;/p&gt;&#xA;" OwnerUserId="9594" LastActivityDate="2019-04-10T03:05:18.647" Title="Which is the best place to learn Craft CMS with tutorials?" Tags="&lt;craft3&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30075" PostTypeId="2" ParentId="30074" CreationDate="2019-04-08T20:38:34.373" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://craftquest.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CraftQuest.io&lt;/a&gt; has some great Craft CMS videos; many are free, but some of the more in-depth ones are not.&lt;/p&gt;&#xA;" OwnerUserId="819" LastActivityDate="2019-04-08T20:38:34.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30076" PostTypeId="2" ParentId="30058" CreationDate="2019-04-09T01:01:25.207" Score="1" Body="&lt;p&gt;Figured out that it wasn't sending because the CSRF token was being cached. A workaround was installing the No Cache plugin and doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{% nocache %}&#xA;    {{ csrfInput() }}&#xA;{% endnocache %}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6297" LastActivityDate="2019-04-09T01:01:25.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30079" PostTypeId="1" CreationDate="2019-04-09T08:01:09.483" Score="1" ViewCount="80" Body="&lt;p&gt;I need all of the custom fields on an order submitted to ZenDesk to create a new ticket once the order is completed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once a ticket is created in ZenDesk, we will need the ticket number saved on a new custom field on the order. This will be used later for grabbing comments on the ticket.&lt;/p&gt;&#xA;" OwnerUserId="9366" LastActivityDate="2019-04-09T08:41:01.437" Title="Custom Plugin for ZenDesk Tickets" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;plugin-craftcommerce&gt;&lt;plugin-craftcommerce2&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-04-30T03:41:52.123" ContentLicense="CC BY-SA 4.0" />
  <row Id="30080" PostTypeId="2" ParentId="30079" CreationDate="2019-04-09T08:41:01.437" Score="2" Body="&lt;p&gt;There is a Zendesk plugin for Craft CMS that could be of use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://plugins.craftcms.com/zendesk&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://plugins.craftcms.com/zendesk&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This plugin can work either as a dashboard widget on your clients website, or you can post to it from a frontend form on your own website.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="344" LastActivityDate="2019-04-09T08:41:01.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30081" PostTypeId="1" AcceptedAnswerId="30082" CreationDate="2019-04-09T09:37:21.767" Score="1" ViewCount="156" Body="&lt;p&gt;I've got 2 sites, each with a locale (dutch - nl &amp;amp; french - fr). I've set up a frontend entry form that works nicely for all not translated fields, I am however struggling to get it to accept submissions for the translated field in both languages at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what should the name of my HTML input tag be so I can use a translated field in a front-end entry form ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this might not have been clear before, the goal is to be able to send content for both languages in a single form submit. As I understand this will involve some PHP code, which is certainly no problem, but I'm a bit stuck as to what to add where so any pointers are much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EXAMPLE&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a field with the handle &lt;code&gt;description&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following input names but without result&#xA; - &lt;code&gt;fields[description][nl]&lt;/code&gt;&#xA; - &lt;code&gt;fields[nl][description]&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6991" LastEditorUserId="6991" LastEditDate="2019-04-09T09:47:43.593" LastActivityDate="2019-04-10T07:12:27.030" Title="Entry form with field translated accross multiple sites" Tags="&lt;craft3&gt;&lt;localization&gt;&lt;entry&gt;&lt;form&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30082" PostTypeId="2" ParentId="30081" CreationDate="2019-04-09T09:39:13.670" Score="1" Body="&lt;p&gt;Craft has no default process to handle such things, you need to do that on your own. Here is a form and a controller example how it could be achieved.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;{# just to show you.. you can edit existing one as well #}&#xA;{% set entry1 = craft.entries.id(11).siteId(1).one() %}&#xA;{% set entry2 = craft.entries.id(11).siteId(2).one() %}&#xA;&#xA;&amp;lt;form method=&quot;post&quot;&amp;gt;&#xA;    {{ csrfInput() }}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;my-module/save&quot;&amp;gt;&#xA;&#xA;    {# if you have an ID use it #}&#xA;    {% if entry1 is defined and entry1 is not null %}&#xA;        &amp;lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;{{ entry1.id }}&quot;&amp;gt;&#xA;    {% endif %}&#xA;&#xA;    {# the site ids you want to store, you can as well use the handle or whatever you want #}&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;siteId[]&quot; value=&quot;1&quot;&amp;gt;&#xA;    &amp;lt;input type=&quot;hidden&quot; name=&quot;siteId[]&quot; value=&quot;2&quot;&amp;gt;&#xA;&#xA;    {# title #}&#xA;    &amp;lt;p&amp;gt;Title Site 1&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;title[1]&quot; value=&quot;{{ entry1.title?? '' }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;Title Site 2&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;title[2]&quot; value=&quot;{{ entry2.title?? '' }}&quot;&amp;gt;&#xA;&#xA;    {# a field #}&#xA;    &amp;lt;p&amp;gt;Headline site 1&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[1][headline]&quot; value=&quot;{{ entry1.headline?? '' }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;Headline site 2&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;fields[2][headline]&quot; value=&quot;{{ entry2.headline?? '' }}&quot;&amp;gt;&#xA;&#xA;    {# slug #}&#xA;    &amp;lt;p&amp;gt;Slug site 1&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;slug[1]&quot; value=&quot;{{ entry1.slug?? '' }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;p&amp;gt;Slug site 2&amp;lt;/p&amp;gt;&#xA;    &amp;lt;input type=&quot;text&quot; name=&quot;slug[2]&quot; value=&quot;{{ entry2.slug?? '' }}&quot;&amp;gt;&#xA;&#xA;    &amp;lt;input type=&quot;submit&quot;&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then in your Controller&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;/**&#xA; * actionIndex&#xA; *&#xA; *&#xA; * @throws \Throwable&#xA; * @throws \craft\errors\ElementNotFoundException&#xA; * @throws \yii\base\Exception&#xA; * @throws \yii\web\BadRequestHttpException&#xA; * @return \yii\web\Response&#xA; */&#xA;public function actionIndex(): \yii\web\Response&#xA;{&#xA;    // grab all the sites you want to store&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $sites = $request-&amp;gt;getRequiredBodyParam('siteId');&#xA;&#xA;    $elements = Craft::$app-&amp;gt;getElements();&#xA;    // change the handle of course&#xA;    $section = Craft::$app-&amp;gt;getSections()-&amp;gt;getSectionByHandle('news');&#xA;    // only applies to me, you need to figure out the type on your own&#xA;    // note: don't just grab things by id if you use the project config&#xA;    // please check if those variables are not null&#xA;    $type = $section-&amp;gt;getEntryTypes()[0];&#xA;&#xA;    $elementId = null;&#xA;    $element = null;&#xA;    foreach ($sites as $siteId) {&#xA;        // TODO check if the site exists&#xA;        $elementId = (int)$request-&amp;gt;getBodyParam('id', $elementId);&#xA;        if ($elementId !== 0) {&#xA;            $element = $elements-&amp;gt;getElementById($elementId, Entry::class, (int) $siteId);&#xA;        }&#xA;&#xA;        if ($element === null) {&#xA;            $element = new Entry(&#xA;                [&#xA;                    'sectionId' =&amp;gt; $section-&amp;gt;id,&#xA;                    'typeId'    =&amp;gt; $type-&amp;gt;id&#xA;                ]&#xA;            );&#xA;        }&#xA;&#xA;        $this-&amp;gt;populateModel($element, $siteId);&#xA;        if($elements-&amp;gt;saveElement($element) === false){&#xA;            // handle errors somehow&#xA;            echo &quot;&amp;lt;pre&amp;gt;&quot;;&#xA;            var_dump($element-&amp;gt;getErrors());&#xA;            echo &quot;&amp;lt;/pre&amp;gt;&quot;;&#xA;            die();&#xA;        }&#xA;&#xA;        $elementId = $element-&amp;gt;id;&#xA;    }&#xA;&#xA;    return $this-&amp;gt;asJson(['success' =&amp;gt; true]);&#xA;}&#xA;&#xA;/**&#xA; * populateModel&#xA; *&#xA; * @param \craft\base\ElementInterface $element&#xA; * @param                              $siteId&#xA; */&#xA;public function populateModel(ElementInterface $element, $siteId)&#xA;{&#xA;    /** @var Entry $element */&#xA;    $request = Craft::$app-&amp;gt;getRequest();&#xA;    $element-&amp;gt;title = $request-&amp;gt;getBodyParam('title.' . $siteId, $element-&amp;gt;title);&#xA;    $element-&amp;gt;slug = $request-&amp;gt;getBodyParam('slug.' . $siteId, $element-&amp;gt;slug);&#xA;    $element-&amp;gt;enabled = $request-&amp;gt;getBodyParam('enabled.' . $siteId, $element-&amp;gt;enabled);&#xA;    // and so on.. continue with the rest you want to post + the author..&#xA;&#xA;    $fieldsLocation = 'fields.' . $siteId;&#xA;    $element-&amp;gt;setFieldValuesFromRequest($fieldsLocation);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-04-10T07:12:27.030" LastActivityDate="2019-04-10T07:12:27.030" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30084" PostTypeId="1" CreationDate="2019-04-09T11:48:28.440" Score="0" ViewCount="105" Body="&lt;p&gt;I'm making a blog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a wheelform comments input type that needs to be stored as utf8mb4 in the local database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My MySQL database version 5.6 is configured to utf8mb4 in the database, tables, and columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time I send an emoji to the database it is stored as four question marks ????.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to save emojis correctly in the database? Perhaps using encodeMb4(), but I don't know where and how to apply it.&lt;/p&gt;&#xA;" OwnerUserId="9605" LastEditorUserId="57" LastEditDate="2019-04-11T02:35:29.673" LastActivityDate="2019-04-11T02:35:29.673" Title="Emojis on Craft 3 front office" Tags="&lt;craft3&gt;&lt;php&gt;&lt;mysql&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30085" PostTypeId="1" AcceptedAnswerId="30086" CreationDate="2019-04-09T12:28:59.893" Score="1" ViewCount="186" Body="&lt;p&gt;I'm trying to make a form redirect to the current page, but it's currently redirecting itself to the homepage every time the form submits? I can't see anything wrong with the code itself?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA;  {{ csrfInput() }}&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users/save-user&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.request.url }}&quot;&amp;gt;&#xA;  &amp;lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{ currentUser.id }}&quot;&amp;gt;&#xA;  &amp;lt;textarea id=&quot;summernote&quot; name=&quot;fields[userAbout]&quot;&amp;gt;{{ currentUser.userAbout }}&amp;lt;/textarea&amp;gt;&#xA;  &amp;lt;button class=&quot;btn btn-primary btn-md semi-bold mt-4&quot; type=&quot;submit&quot;&amp;gt;Save Profile&amp;lt;/button&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6570" LastActivityDate="2019-04-09T13:00:19.883" Title="Form Redirecting to Homepage" Tags="&lt;templating&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30086" PostTypeId="2" ParentId="30085" CreationDate="2019-04-09T12:49:59.117" Score="3" Body="&lt;p&gt;I believe its because you are not &quot;hashing&quot; the URL. Either use this &lt;a href=&quot;https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url&lt;/a&gt; or as that the link also mentions: &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-twig prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;{{ craft.app.request.absoluteUrl|hash }}&quot;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9607" LastEditorUserId="5557" LastEditDate="2019-04-09T13:00:19.883" LastActivityDate="2019-04-09T13:00:19.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30087" PostTypeId="1" AcceptedAnswerId="30089" CreationDate="2019-04-09T13:32:35.493" Score="1" ViewCount="129" Body="&lt;p&gt;I want to output all globals with one endpoint. This is trivial for the most part but I need to have some objects in a specific shape. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a matrix block to handle the content. The main issue I have is I need the json for the &lt;code&gt;footerLinks&lt;/code&gt; array to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &quot;data&quot;: [&#xA;        {&#xA;            &quot;footerLinks&quot;: [&#xA;                {&#xA;                    &quot;title&quot;: &quot;Legal information&quot;,&#xA;                    &quot;items&quot;:[&#xA;                        {&#xA;                            &quot;link&quot;: &quot;Cookies and privacy&quot;,&#xA;                            &quot;url&quot;: &quot;/cookies-privacy&quot;&#xA;                        }&#xA;                    ]&#xA;                },&#xA;                {&#xA;                    &quot;title&quot;: &quot;About Company&quot;,&#xA;                    &quot;items&quot;:[&#xA;                        {&#xA;                            &quot;link&quot;: &quot;What we do&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        },&#xA;                        {&#xA;                            &quot;link&quot;: &quot;Contact us&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        },&#xA;                        {&#xA;                            &quot;link&quot;: &quot;Accessibility&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        }&#xA;                    ]&#xA;                },&#xA;                {&#xA;                    &quot;title&quot;: &quot;Statistics&quot;,&#xA;                    &quot;items&quot;: [&#xA;                        {&#xA;                            &quot;link&quot;: &quot;Authority&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        },&#xA;&#xA;                        {&#xA;                            &quot;link&quot;: &quot;Releases&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        },&#xA;                        {&#xA;                            &quot;link&quot;: &quot;News&quot;,&#xA;                            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;                        }&#xA;                    ]&#xA;                }&#xA;            ]&#xA;        }&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the code I have so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        'api/globals.json' =&amp;gt; function() {&#xA;            $langHandle = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('lang', 'en');&#xA;            return [&#xA;                'elementType' =&amp;gt; GlobalSet::class,&#xA;                'criteria' =&amp;gt; ['site' =&amp;gt; $langHandle],&#xA;                'transformer' =&amp;gt; function(GlobalSet $globalSet) {&#xA;                    $footerBlocks = [];&#xA;                    foreach ($globalSet-&amp;gt;globals as $block) {&#xA;                        switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                            case 'listItem':&#xA;                                $footerBlocks[] = [ &#xA;                                    array(&#xA;                                        'link' =&amp;gt; $block-&amp;gt;listText,&#xA;                                        'url' =&amp;gt; $block-&amp;gt;listUrl,&#xA;                                    )&#xA;                                ];&#xA;                            break;&#xA;                            case 'listHeader':&#xA;                                $footerBlocks[] = [&#xA;                                    'title' =&amp;gt; $block-&amp;gt;listTitle,&#xA;                                ];&#xA;                            break;&#xA;                        }   &#xA;                    }&#xA;                    return [&#xA;                        'footerLinks' =&amp;gt; $footerBlocks,&#xA;                    ];&#xA;                }&#xA;            ];&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the current output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  &quot;data&quot;: [&#xA;    {&#xA;      &quot;footerLinks&quot;: [&#xA;        {&#xA;          &quot;title&quot;: &quot;Legal information&quot;&#xA;        },&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;Cookies and privacy&quot;,&#xA;            &quot;url&quot;: &quot;/cookies-privacy&quot;&#xA;          }&#xA;        ],&#xA;        {&#xA;          &quot;title&quot;: &quot;About&quot;&#xA;        },&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;What we do&quot;,&#xA;            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;          }&#xA;        ],&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;Contact us&quot;,&#xA;            &quot;url&quot;: &quot;/contact-us&quot;&#xA;          }&#xA;        ],&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;Accessibility&quot;,&#xA;            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;          }&#xA;        ],&#xA;        {&#xA;          &quot;title&quot;: &quot;Statistics&quot;&#xA;        },&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;Authority&quot;,&#xA;            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;          }&#xA;        ],&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;Release calendar&quot;,&#xA;            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;          }&#xA;        ],&#xA;        [&#xA;          {&#xA;            &quot;link&quot;: &quot;News&quot;,&#xA;            &quot;url&quot;: &quot;https://someurl.com&quot;&#xA;          }&#xA;        ]&#xA;      ]&#xA;    }&#xA;  ],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is a screenshot of the matrix block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/1015442/55803971-54ded600-5ad3-11e9-85ed-aee182225d9e.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially I need to create a new object for each &lt;code&gt;listHeader&lt;/code&gt; and &lt;code&gt;listItem&lt;/code&gt; set and also wrap each set of &lt;code&gt;listItem&lt;/code&gt; objects in an array called &lt;code&gt;items&lt;/code&gt;. Currently it doesn't group anything together and outputs each individual &lt;code&gt;listItem&lt;/code&gt; in an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great.&lt;/p&gt;&#xA;" OwnerUserId="9546" LastActivityDate="2019-04-09T14:00:57.830" Title="Element api JSON output formatting" Tags="&lt;plugin-elementapi&gt;&lt;json&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30088" PostTypeId="2" ParentId="30043" CreationDate="2019-04-09T13:54:15.560" Score="0" Body="&lt;p&gt;There was something wrong inside the vendor folder. Couldn't find what. What I did to solve it (thanks to Craft support):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Rename &lt;code&gt;vendor&lt;/code&gt; folder to &lt;code&gt;vendor-old&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ran &lt;code&gt;composer clearcache&lt;/code&gt; to delete all content from Composer's cache directories&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ran &lt;code&gt;composer install&lt;/code&gt; to install all depencies in composer.json&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Deleted &lt;code&gt;vendor-old&lt;/code&gt; folder&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2019-04-09T13:54:15.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30089" PostTypeId="2" ParentId="30087" CreationDate="2019-04-09T14:00:57.830" Score="1" Body="&lt;p&gt;This should work&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;'api/globals.json' =&amp;gt; function() {&#xA;    $langHandle = Craft::$app-&amp;gt;request-&amp;gt;getQueryParam('lang', 'en');&#xA;    return [&#xA;        'elementType' =&amp;gt; GlobalSet::class,&#xA;        'criteria' =&amp;gt; ['site' =&amp;gt; $langHandle],&#xA;        'transformer' =&amp;gt; function(GlobalSet $globalSet) {&#xA;            // start with -1 so the first one will be 0 if you start with a listHeader&#xA;            // this is your current index&#xA;            $index = -1;&#xA;            // the data you like to return&#xA;            $data = [];&#xA;            foreach ($globalSet-&amp;gt;globals as $block) {&#xA;                switch ($block-&amp;gt;type-&amp;gt;handle) {&#xA;                    case 'listHeader':&#xA;                        // new header, increase the index, store the title and an empty items array&#xA;                        $index++;&#xA;                        $data[$index]['title'] = $block-&amp;gt;listTitle;&#xA;                        $data[$index]['items'] = [];&#xA;                        break;&#xA;                    case 'listItem':&#xA;                        // include the listItem to the current index as item&#xA;                        $data[$index]['items'][] = [&#xA;                            'link' =&amp;gt; $block-&amp;gt;listText,&#xA;                            'url' =&amp;gt; $block-&amp;gt;listUrl,&#xA;                        ];&#xA;                        break;&#xA;                }&#xA;            }&#xA;            return [&#xA;                'footerLinks' =&amp;gt; $data,&#xA;            ];&#xA;        }&#xA;    ];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-09T14:00:57.830" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30090" PostTypeId="1" CreationDate="2019-04-09T14:20:44.217" Score="2" ViewCount="1246" Body="&lt;p&gt;I have to make a website that needs an &lt;strong&gt;user area with login&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that area users should be able to upload to admin area or download files from admin area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each user has its own account that is separate from other users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used to work with cake framework but in the several past weeks i made a few projects in craft cms 3 and liked it due to the easy and fast time to go up and running a full stack website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to make the users area in the frontoffice of craft cms 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is, there is a plugin available to do it (i searched and didn't find one), or can somebody point me the steps that are needed to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks. &lt;/p&gt;&#xA;" OwnerUserId="9605" LastActivityDate="2019-04-09T14:34:36.473" Title="Craft 3 best way/steps to create a login client area in frontend" Tags="&lt;craft3&gt;&lt;plugins&gt;&lt;users&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30091" PostTypeId="2" ParentId="30090" CreationDate="2019-04-09T14:31:01.790" Score="2" Body="&lt;p&gt;I don't know any plugins that do that for you since it's integrated in Craft by default. There are &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/user-registration-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Registration forms&lt;/a&gt; as well as &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/login-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Login form examples&lt;/a&gt; and you can create &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/entry-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entry forms&lt;/a&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For gating content behind logins there is the &lt;a href=&quot;https://docs.craftcms.com/v3/dev/tags/requirelogin.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;requireLogin&lt;/a&gt; tag which will automatically redirect you to your login route and after a successful login return to the url you wanted to visit.&#xA;Not sure what else you might need since your question is really broad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a registration Craft will certain system messages (utilities -&gt; systemmessages) with activation links for their account (double-opt-in). In case a user lost/forgot his/her password you can &lt;a href=&quot;https://docs.craftcms.com/v3/dev/examples/forgot-password-form.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;send them a new one&lt;/a&gt; automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check certain config values such as &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#loginpath&quot; rel=&quot;nofollow noreferrer&quot;&gt;loginPath&lt;/a&gt; or &lt;a href=&quot;https://docs.craftcms.com/v3/config/config-settings.html#postloginredirect&quot; rel=&quot;nofollow noreferrer&quot;&gt;postLoginRedirects&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="5557" LastEditorUserId="5557" LastEditDate="2019-04-09T14:34:36.473" LastActivityDate="2019-04-09T14:34:36.473" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="30092" PostTypeId="1" CreationDate="2019-04-09T14:35:44.503" Score="3" ViewCount="2168" Body="&lt;p&gt;I have been struggling to create my own custom field, so I would like to ask how to create it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I don't know where the files should be in.&#xA;I have some custom fields in Craft 2.&#xA;It might be able to be migrated, but it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have these files under src folder in a plugin.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fields/{fieldtypeName}FieldType.php&#xA;templates/_fieldtypes/{fieldtypeHandle}/input.html&#xA;templates/_fieldtypes/{fieldtypeHandle}/settings.html&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I added a registration as the documentation, but Craft says it is not found.&#xA;&lt;a href=&quot;https://docs.craftcms.com/v3/extend/field-types.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.craftcms.com/v3/extend/field-types.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="5557" LastEditDate="2019-04-09T14:42:49.743" LastActivityDate="2019-09-06T16:01:40.180" Title="How to create custom field type in Craft 3" Tags="&lt;custom-fieldtype&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30093" PostTypeId="2" ParentId="30092" CreationDate="2019-04-09T15:04:09.460" Score="5" Body="&lt;p&gt;In order to include a custom field type you first need to register your own &lt;a href=&quot;https://docs.craftcms.com/v3/extend/module-guide.html#app&quot; rel=&quot;noreferrer&quot;&gt;module&lt;/a&gt; or &lt;a href=&quot;https://docs.craftcms.com/v3/extend/plugin-guide.html&quot; rel=&quot;noreferrer&quot;&gt;plugin&lt;/a&gt; you can create the basic structure for both from &lt;a href=&quot;https://pluginfactory.io/&quot; rel=&quot;noreferrer&quot;&gt;pluginfactory.io&lt;/a&gt; and register them as you like. There is also a default module that comes with every Craft 3 installation. You only need to bootstrap it in your &lt;code&gt;app.php&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in your module you need the following code &lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function init()&#xA;{&#xA;    Event::on(Fields::class, Fields::EVENT_REGISTER_FIELD_TYPES, function(RegisterComponentTypesEvent $event) {&#xA;        $event-&amp;gt;types[] = MyField::class;&#xA;    });&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And your class could look like the &lt;a href=&quot;https://github.com/mmikkel/IncognitoField-Craft3/blob/master/src/fields/IncognitoFieldType.php&quot; rel=&quot;noreferrer&quot;&gt;Incognito Field&lt;/a&gt; for example.&#xA;Basically every field has several methods implemented in the &lt;code&gt;FieldInterface&lt;/code&gt; such as &lt;code&gt;getInputHtml&lt;/code&gt; to render the HTML or &lt;code&gt;normalizeValue&lt;/code&gt; to create a field value based on user or DB input and &lt;code&gt;serializeValue&lt;/code&gt; to prepare the value for your DB. The &lt;a href=&quot;https://docs.craftcms.com/api/v3/craft-base-fieldinterface.html&quot; rel=&quot;noreferrer&quot;&gt;interface&lt;/a&gt; has everything you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good example to get started is to extend the &lt;code&gt;PlainText&lt;/code&gt; field and customize it's functions. You can overwrite the &lt;code&gt;inputHtml&lt;/code&gt; function and render a custom template&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;public function getInputHtml($value, ElementInterface $element = null): string&#xA;{&#xA;    // Get our id and namespace&#xA;    $id = Craft::$app-&amp;gt;getView()-&amp;gt;formatInputId($this-&amp;gt;handle);&#xA;    $namespacedId = Craft::$app-&amp;gt;getView()-&amp;gt;namespaceInputId($id);&#xA;&#xA;    // Render the input template&#xA;    return Craft::$app-&amp;gt;getView()-&amp;gt;renderTemplate(&#xA;        'module-id/fields/hidden/_input',&#xA;        [&#xA;            'name' =&amp;gt; $this-&amp;gt;handle,&#xA;            'value' =&amp;gt; $value,&#xA;            'field' =&amp;gt; $this,&#xA;            'id' =&amp;gt; $id,&#xA;            'namespacedId' =&amp;gt; $namespacedId,&#xA;        ]&#xA;    );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5557" LastActivityDate="2019-04-09T15:04:09.460" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30094" PostTypeId="1" CreationDate="2019-04-09T15:35:30.873" Score="3" ViewCount="699" Body="&lt;p&gt;I've made a plugin that let's you import Entries from a CSV file and I'm working through adding localization (Sites) support to it, but I can't figure out the right way to enable an Entry for a second Site.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry = New Entry();&#xA;$entry-&amp;gt;authorId = $authorId;&#xA;$entry-&amp;gt;sectionId = $sectionId;&#xA;$entry-&amp;gt;typeId = $typeId;&#xA;$entry-&amp;gt;enabled = true;&#xA;$entry-&amp;gt;title = $title;&#xA;$entry-&amp;gt;Slug = $slug;&#xA;$entry-&amp;gt;siteId = $firstSiteId;&#xA;&#xA;$entry-&amp;gt;setFieldValues($attrs);&#xA;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything above works, but it's this next part which I can't get to work properly. It just throws errors about violating the constraint for a duplicate element ID/site ID pair:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$entry-&amp;gt;siteId = $secondSiteId;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($entry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I also tried this, but the query never returns any results:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-php prettyprint-override&quot;&gt;&lt;code&gt;$findTheNewEntry = Entry::find()&#xA;    -&amp;gt;sectionId($sectionId)&#xA;    -&amp;gt;id($entry-&amp;gt;id)&#xA;    -&amp;gt;status(null)&#xA;    -&amp;gt;siteId($secondSiteId)&#xA;    -&amp;gt;one();&#xA;&#xA;$findTheNewEntry-&amp;gt;enabled = true;&#xA;Craft::$app-&amp;gt;elements-&amp;gt;saveElement($findTheNewEntry);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wish it was as simple as being able to provide an array or such for &lt;code&gt;-&amp;gt;siteId&lt;/code&gt; but I know that's wrong.&lt;/p&gt;&#xA;" OwnerUserId="3895" LastActivityDate="2019-04-11T12:43:31.060" Title="How do you save a new Entry to be enabled on 2+ Sites?" Tags="&lt;plugin-development&gt;&lt;craft3&gt;&lt;multi-site&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30095" PostTypeId="2" ParentId="29998" CreationDate="2019-04-09T22:21:53.220" Score="0" Body="&lt;p&gt;For me, this didn't have anything to do with rewrites.  I installed WTServer (WinNMP) and a fresh copy of Craft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed the same 400 response when trying to log in and was seeing this in the body:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;400 Request Header Or Cookie Too Large&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;After a quick Google, I noticed that the default nginx config that WTServer has these set:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;client_header_buffer_size   1k;&#xA;large_client_header_buffers 2 1k;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I bumped those up to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;client_header_buffer_size   8k;&#xA;large_client_header_buffers 8 16k;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Restarted nginx and everything started working fine.&lt;/p&gt;&#xA;" OwnerUserId="57" LastActivityDate="2019-04-09T22:21:53.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30096" PostTypeId="2" ParentId="30074" CreationDate="2019-04-10T03:05:18.647" Score="1" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://craftcms.stackexchange.com/a/30075/57&quot;&gt;CraftQuest&lt;/a&gt;, I'll add a few other learning resources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.craftcms.com/v3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craft CMS docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;